From: support Date: Tue, 4 Apr 2023 07:53:19 +0000 (+0000) Subject: Built motion from commit 511216ff.|2.6.34 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=5d208f93332d20e93b1c8c83fce82ebc382519df;p=motion2.git Built motion from commit 511216ff.|2.6.34 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 137a5a3..0c3d32a 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-04-04T07:25:29.663Z", + "time": "2023-04-04T07:41:54.877Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 5317a45..d2ff86a 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-04-04T07:25:29.663Z", + "time": "2023-04-04T07:41:54.877Z", "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 62c3afe..87d1f5f 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 _0x5ff9=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','action','contactManager','integration','motionbar','jscripty','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING'];(function(_0x3da096,_0x59b644){var _0x144fbf=function(_0x14c243){while(--_0x14c243){_0x3da096['push'](_0x3da096['shift']());}};_0x144fbf(++_0x59b644);}(_0x5ff9,0x155));var _0x95ff=function(_0x3262c5,_0x2773e0){_0x3262c5=_0x3262c5-0x0;var _0x2737da=_0x5ff9[_0x3262c5];return _0x2737da;};'use strict';var Sequelize=require(_0x95ff('0x0'));module[_0x95ff('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x312ecc){return this['getDataValue'](_0x95ff('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x95ff('0x3'),_0x95ff('0x4'),_0x95ff('0x5'),_0x95ff('0x6'),'urlForward','browser',_0x95ff('0x7'),_0x95ff('0x8')]],'msg':_0x95ff('0x9')}},'comment':_0x95ff('0x9')},'data1':{'type':Sequelize[_0x95ff('0xa')](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0x95ff('0xa')](0x1000),'comment':_0x95ff('0xb')},'data3':{'type':Sequelize[_0x95ff('0xa')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x95ff('0xa')](0x1000),'comments':_0x95ff('0xc')},'data5':{'type':Sequelize[_0x95ff('0xa')](0x1000),'comments':_0x95ff('0xd')},'data6':{'type':Sequelize[_0x95ff('0xa')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x95ff('0xe')],'comments':_0x95ff('0xf')}}; \ No newline at end of file +var _0x6af2=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','getDataValue','STRING','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6af2,0x1d9));var _0x26af=function(_0x1c11a6,_0x154a32){_0x1c11a6=_0x1c11a6-0x0;var _0x1d9786=_0x6af2[_0x1c11a6];return _0x1d9786;};'use strict';var Sequelize=require(_0x26af('0x0'));module[_0x26af('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x191a6d){return this[_0x26af('0x2')]('action');}},'action':{'type':Sequelize[_0x26af('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x26af('0x4'),_0x26af('0x5'),_0x26af('0x6'),_0x26af('0x7'),_0x26af('0x8'),_0x26af('0x9'),_0x26af('0xa')]],'msg':_0x26af('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x26af('0x3')](0x1000),'comment':_0x26af('0xc')},'data2':{'type':Sequelize[_0x26af('0x3')](0x1000),'comment':_0x26af('0xd')},'data3':{'type':Sequelize[_0x26af('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x26af('0x3')](0x1000),'comments':_0x26af('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x26af('0xf')},'data6':{'type':Sequelize['STRING'],'comments':_0x26af('0x10')},'data7':{'type':Sequelize[_0x26af('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5d8ae06..25a5892 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 _0x5709=['apply','reject','save','update','then','destroy','end','error','stack','name','body','params','catch','Action','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','count','offset','limit','json'];(function(_0x11a83e,_0x1533ee){var _0xbd3bd5=function(_0xc15afd){while(--_0xc15afd){_0x11a83e['push'](_0x11a83e['shift']());}};_0xbd3bd5(++_0x1533ee);}(_0x5709,0x158));var _0x9570=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5709[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9570('0x0'));var rimraf=require(_0x9570('0x1'));var zipdir=require(_0x9570('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9570('0x3'));var moment=require(_0x9570('0x4'));var BPromise=require(_0x9570('0x5'));var Mustache=require('mustache');var util=require(_0x9570('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9570('0x7'));var ejs=require(_0x9570('0x8'));var fs=require('fs');var fs_extra=require(_0x9570('0x9'));var _=require(_0x9570('0xa'));var squel=require(_0x9570('0xb'));var crypto=require(_0x9570('0xc'));var jsforce=require(_0x9570('0xd'));var deskjs=require(_0x9570('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9570('0xf'));var Redis=require(_0x9570('0x10'));var authService=require(_0x9570('0x11'));var qs=require(_0x9570('0x12'));var as=require(_0x9570('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9570('0x14'))(_0x9570('0x15'));var utils=require(_0x9570('0x16'));var config=require(_0x9570('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9570('0x18'))['db'];function respondWithStatusCode(_0x4e1e96,_0x2575c5){_0x2575c5=_0x2575c5||0xcc;return function(_0x588aa5){if(_0x588aa5){return _0x4e1e96[_0x9570('0x19')](_0x2575c5);}return _0x4e1e96[_0x9570('0x1a')](_0x2575c5)['end']();};}function respondWithResult(_0x26b898,_0x43a3cd){_0x43a3cd=_0x43a3cd||0xc8;return function(_0xb8d323){if(_0xb8d323){return _0x26b898[_0x9570('0x1a')](_0x43a3cd)['json'](_0xb8d323);}};}function respondWithFilteredResult(_0x29dff8,_0x1e628d){return function(_0x44fad0){if(_0x44fad0){var _0x362ebd=typeof _0x1e628d['offset']===_0x9570('0x1b')&&typeof _0x1e628d['limit']==='undefined';var _0x2c8cac=_0x44fad0[_0x9570('0x1c')];var _0x1ca5ec=_0x362ebd?0x0:_0x1e628d[_0x9570('0x1d')];var _0x8a3dc8=_0x362ebd?_0x44fad0[_0x9570('0x1c')]:_0x1e628d[_0x9570('0x1d')]+_0x1e628d[_0x9570('0x1e')];var _0x427ce3;if(_0x8a3dc8>=_0x2c8cac){_0x8a3dc8=_0x2c8cac;_0x427ce3=0xc8;}else{_0x427ce3=0xce;}_0x29dff8[_0x9570('0x1a')](_0x427ce3);return _0x29dff8['set']('Content-Range',_0x1ca5ec+'-'+_0x8a3dc8+'/'+_0x2c8cac)[_0x9570('0x1f')](_0x44fad0);}return null;};}function patchUpdates(_0x21807d){return function(_0x43cf3e){try{jsonpatch[_0x9570('0x20')](_0x43cf3e,_0x21807d,!![]);}catch(_0x4b0f0a){return BPromise[_0x9570('0x21')](_0x4b0f0a);}return _0x43cf3e[_0x9570('0x22')]();};}function saveUpdates(_0x4508f1,_0x4c7493){return function(_0xaac112){if(_0xaac112){return _0xaac112[_0x9570('0x23')](_0x4508f1)[_0x9570('0x24')](function(_0x5f069){return _0x5f069;});}return null;};}function removeEntity(_0x1104f8,_0x5066bc){return function(_0x2f5032){if(_0x2f5032){return _0x2f5032[_0x9570('0x25')]()[_0x9570('0x24')](function(){_0x1104f8[_0x9570('0x1a')](0xcc)[_0x9570('0x26')]();});}};}function handleEntityNotFound(_0x2c0664,_0x3717b1){return function(_0x48f3bf){if(!_0x48f3bf){_0x2c0664[_0x9570('0x19')](0x194);}return _0x48f3bf;};}function handleError(_0xb402c0,_0xcd2097){_0xcd2097=_0xcd2097||0x1f4;return function(_0x1e7378){logger[_0x9570('0x27')](_0x1e7378[_0x9570('0x28')]);if(_0x1e7378['name']){delete _0x1e7378[_0x9570('0x29')];}_0xb402c0[_0x9570('0x1a')](_0xcd2097)['send'](_0x1e7378);};}exports[_0x9570('0x23')]=function(_0x3ccb08,_0x170a51){if(_0x3ccb08[_0x9570('0x2a')]['id']){delete _0x3ccb08[_0x9570('0x2a')]['id'];}return db['Action']['find']({'where':{'id':_0x3ccb08[_0x9570('0x2b')]['id']}})['then'](handleEntityNotFound(_0x170a51,null))[_0x9570('0x24')](saveUpdates(_0x3ccb08[_0x9570('0x2a')],null))['then'](respondWithResult(_0x170a51,null))[_0x9570('0x2c')](handleError(_0x170a51,null));};exports[_0x9570('0x25')]=function(_0x53edaf,_0x463aa6){return db[_0x9570('0x2d')][_0x9570('0x2e')]({'where':{'id':_0x53edaf[_0x9570('0x2b')]['id']}})[_0x9570('0x24')](handleEntityNotFound(_0x463aa6,null))[_0x9570('0x24')](removeEntity(_0x463aa6,null))[_0x9570('0x2c')](handleError(_0x463aa6,null));}; \ No newline at end of file +var _0xc76f=['params','catch','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','body','find'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xc76f,0x1ba));var _0xfc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfc76('0x0'));var rimraf=require(_0xfc76('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc76('0x2'));var rp=require('request-promise');var moment=require(_0xfc76('0x3'));var BPromise=require(_0xfc76('0x4'));var Mustache=require('mustache');var util=require(_0xfc76('0x5'));var path=require(_0xfc76('0x6'));var sox=require(_0xfc76('0x7'));var csv=require('to-csv');var ejs=require(_0xfc76('0x8'));var fs=require('fs');var fs_extra=require(_0xfc76('0x9'));var _=require(_0xfc76('0xa'));var squel=require(_0xfc76('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc76('0xc'));var toCsv=require(_0xfc76('0xd'));var querystring=require(_0xfc76('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfc76('0xf'));var as=require(_0xfc76('0x10'));var hardwareService=require(_0xfc76('0x11'));var logger=require(_0xfc76('0x12'))(_0xfc76('0x13'));var utils=require(_0xfc76('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5be805,_0x4d038b){_0x4d038b=_0x4d038b||0xcc;return function(_0x292e29){if(_0x292e29){return _0x5be805[_0xfc76('0x15')](_0x4d038b);}return _0x5be805[_0xfc76('0x16')](_0x4d038b)[_0xfc76('0x17')]();};}function respondWithResult(_0x69fc7a,_0x5e9530){_0x5e9530=_0x5e9530||0xc8;return function(_0x2abee2){if(_0x2abee2){return _0x69fc7a['status'](_0x5e9530)[_0xfc76('0x18')](_0x2abee2);}};}function respondWithFilteredResult(_0x5834e0,_0x45ac7a){return function(_0x4a721c){if(_0x4a721c){var _0x2e71dc=typeof _0x45ac7a[_0xfc76('0x19')]===_0xfc76('0x1a')&&typeof _0x45ac7a[_0xfc76('0x1b')]===_0xfc76('0x1a');var _0x542e1c=_0x4a721c['count'];var _0x44a3c=_0x2e71dc?0x0:_0x45ac7a[_0xfc76('0x19')];var _0x39725e=_0x2e71dc?_0x4a721c[_0xfc76('0x1c')]:_0x45ac7a[_0xfc76('0x19')]+_0x45ac7a[_0xfc76('0x1b')];var _0x49cc6b;if(_0x39725e>=_0x542e1c){_0x39725e=_0x542e1c;_0x49cc6b=0xc8;}else{_0x49cc6b=0xce;}_0x5834e0['status'](_0x49cc6b);return _0x5834e0[_0xfc76('0x1d')](_0xfc76('0x1e'),_0x44a3c+'-'+_0x39725e+'/'+_0x542e1c)[_0xfc76('0x18')](_0x4a721c);}return null;};}function patchUpdates(_0x1a0483){return function(_0x431a64){try{jsonpatch[_0xfc76('0x1f')](_0x431a64,_0x1a0483,!![]);}catch(_0x1a8dbb){return BPromise[_0xfc76('0x20')](_0x1a8dbb);}return _0x431a64['save']();};}function saveUpdates(_0x4e673b,_0x5ad14a){return function(_0x547b3a){if(_0x547b3a){return _0x547b3a[_0xfc76('0x21')](_0x4e673b)[_0xfc76('0x22')](function(_0x4f379e){return _0x4f379e;});}return null;};}function removeEntity(_0x128687,_0xbaffad){return function(_0x4790d6){if(_0x4790d6){return _0x4790d6[_0xfc76('0x23')]()[_0xfc76('0x22')](function(){_0x128687['status'](0xcc)[_0xfc76('0x17')]();});}};}function handleEntityNotFound(_0x2d0421,_0x8d4b8){return function(_0x1c8f3d){if(!_0x1c8f3d){_0x2d0421[_0xfc76('0x15')](0x194);}return _0x1c8f3d;};}function handleError(_0x474f1e,_0x3663a3){_0x3663a3=_0x3663a3||0x1f4;return function(_0x1a70bd){logger[_0xfc76('0x24')](_0x1a70bd[_0xfc76('0x25')]);if(_0x1a70bd['name']){delete _0x1a70bd[_0xfc76('0x26')];}_0x474f1e['status'](_0x3663a3)[_0xfc76('0x27')](_0x1a70bd);};}exports[_0xfc76('0x21')]=function(_0x551b81,_0x2a53c1){if(_0x551b81['body']['id']){delete _0x551b81[_0xfc76('0x28')]['id'];}return db['Action'][_0xfc76('0x29')]({'where':{'id':_0x551b81[_0xfc76('0x2a')]['id']}})[_0xfc76('0x22')](handleEntityNotFound(_0x2a53c1,null))[_0xfc76('0x22')](saveUpdates(_0x551b81['body'],null))[_0xfc76('0x22')](respondWithResult(_0x2a53c1,null))[_0xfc76('0x2b')](handleError(_0x2a53c1,null));};exports['destroy']=function(_0x10504c,_0xce724c){return db['Action']['find']({'where':{'id':_0x10504c[_0xfc76('0x2a')]['id']}})[_0xfc76('0x22')](handleEntityNotFound(_0xce724c,null))['then'](removeEntity(_0xce724c,null))[_0xfc76('0x2b')](handleError(_0xce724c,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 3d40cef..47d82a1 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 _0x4d41=['path','rimraf','./action.attributes','exports','define','Action','lodash','../../config/logger','moment','bluebird'];(function(_0x5b734f,_0x474dbe){var _0x50ce5c=function(_0x144911){while(--_0x144911){_0x5b734f['push'](_0x5b734f['shift']());}};_0x50ce5c(++_0x474dbe);}(_0x4d41,0x1a0));var _0x14d4=function(_0x3a833e,_0x5a1878){_0x3a833e=_0x3a833e-0x0;var _0xdff445=_0x4d41[_0x3a833e];return _0xdff445;};'use strict';var _=require(_0x14d4('0x0'));var util=require('util');var logger=require(_0x14d4('0x1'))('api');var moment=require(_0x14d4('0x2'));var BPromise=require(_0x14d4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x14d4('0x4'));var rimraf=require(_0x14d4('0x5'));var config=require('../../config/environment');var attributes=require(_0x14d4('0x6'));module[_0x14d4('0x7')]=function(_0x2b1c1d,_0x2fb9b5){return _0x2b1c1d[_0x14d4('0x8')](_0x14d4('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa893=['path','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash','util','moment','bluebird','request-promise'];(function(_0x882c95,_0x2fd99f){var _0x26d96b=function(_0x2d73a6){while(--_0x2d73a6){_0x882c95['push'](_0x882c95['shift']());}};_0x26d96b(++_0x2fd99f);}(_0xa893,0x1c3));var _0x3a89=function(_0x39bc8f,_0x5f4e5d){_0x39bc8f=_0x39bc8f-0x0;var _0x162014=_0xa893[_0x39bc8f];return _0x162014;};'use strict';var _=require(_0x3a89('0x0'));var util=require(_0x3a89('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3a89('0x2'));var BPromise=require(_0x3a89('0x3'));var rp=require(_0x3a89('0x4'));var fs=require('fs');var path=require(_0x3a89('0x5'));var rimraf=require(_0x3a89('0x6'));var config=require(_0x3a89('0x7'));var attributes=require(_0x3a89('0x8'));module[_0x3a89('0x9')]=function(_0x3946e7,_0x1b85d0){return _0x3946e7[_0x3a89('0xa')](_0x3a89('0xb'),attributes,{'tableName':'tools_actions','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 6e87f51..e7737b4 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\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(_0x2091fd,_0x54cb51){var _0x1169e6=function(_0x205526){while(--_0x205526){_0x2091fd['push'](_0x2091fd['shift']());}};_0x1169e6(++_0x54cb51);}(_0x1261,0x144));var _0x1126=function(_0x1c3b41,_0x50f776){_0x1c3b41=_0x1c3b41-0x0;var _0x41e3fe=_0x1261[_0x1c3b41];return _0x41e3fe;};'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')]('Action,\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 +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x37de7d,_0x1e80f4){var _0x53211c=function(_0xdfeb92){while(--_0xdfeb92){_0x37de7d['push'](_0x37de7d['shift']());}};_0x53211c(++_0x1e80f4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x5fc3[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 6df1b26..92fe177 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 _0xd3af=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','multer','path'];(function(_0x4291bc,_0x153760){var _0x7167ed=function(_0x433d5c){while(--_0x433d5c){_0x4291bc['push'](_0x4291bc['shift']());}};_0x7167ed(++_0x153760);}(_0xd3af,0x8a));var _0xfd3a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd3af[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xfd3a('0x0'));var util=require('util');var path=require(_0xfd3a('0x1'));var timeout=require('connect-timeout');var express=require(_0xfd3a('0x2'));var router=express[_0xfd3a('0x3')]();var fs_extra=require(_0xfd3a('0x4'));var auth=require(_0xfd3a('0x5'));var interaction=require(_0xfd3a('0x6'));var config=require(_0xfd3a('0x7'));var controller=require(_0xfd3a('0x8'));router['put'](_0xfd3a('0x9'),auth[_0xfd3a('0xa')](),controller[_0xfd3a('0xb')]);router[_0xfd3a('0xc')](_0xfd3a('0x9'),auth['isAuthenticated'](),controller[_0xfd3a('0xd')]);module['exports']=router; \ No newline at end of file +var _0x94bf=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','delete','destroy','exports','multer','connect-timeout'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x94bf,0x1da));var _0xf94b=function(_0x44c596,_0xe8d581){_0x44c596=_0x44c596-0x0;var _0x37930f=_0x94bf[_0x44c596];return _0x37930f;};'use strict';var multer=require(_0xf94b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf94b('0x1'));var express=require(_0xf94b('0x2'));var router=express[_0xf94b('0x3')]();var fs_extra=require(_0xf94b('0x4'));var auth=require(_0xf94b('0x5'));var interaction=require(_0xf94b('0x6'));var config=require(_0xf94b('0x7'));var controller=require(_0xf94b('0x8'));router['put'](_0xf94b('0x9'),auth[_0xf94b('0xa')](),controller['update']);router[_0xf94b('0xb')](_0xf94b('0x9'),auth[_0xf94b('0xa')](),controller[_0xf94b('0xc')]);module[_0xf94b('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 3c7549c..1b37389 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x2ce6ea,_0x4f06f6){var _0x512085=function(_0x315de3){while(--_0x315de3){_0x2ce6ea['push'](_0x2ce6ea['shift']());}};_0x512085(++_0x4f06f6);}(_0x31f0,0xb7));var _0x031f=function(_0x1447fd,_0x313162){_0x1447fd=_0x1447fd-0x0;var _0x721a7e=_0x31f0[_0x1447fd];return _0x721a7e;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file +var _0xa630=['STRING','TEXT','sequelize','exports'];(function(_0x1a8651,_0x5252e4){var _0x50984b=function(_0x37ebfb){while(--_0x37ebfb){_0x1a8651['push'](_0x1a8651['shift']());}};_0x50984b(++_0x5252e4);}(_0xa630,0xbe));var _0x0a63=function(_0x337fb9,_0x2c5935){_0x337fb9=_0x337fb9-0x0;var _0x1e1d20=_0xa630[_0x337fb9];return _0x1e1d20;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x0a63('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x0a63('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 1e6d013..b91f29a 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 _0x1aac=['right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','replace','function','format','groupBy','orderBy','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','toString','sequelize','QueryTypes','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','select','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','SELECT','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','IS\x20NOT\x20NULL','DESC','alias','debug','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','get','CustomReports','UserProfileResource','error','name','send','map','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x1aac,0xf7));var _0xc1aa=function(_0x33eb9b,_0x58cfb6){_0x33eb9b=_0x33eb9b-0x0;var _0x4ee9bd=_0x1aac[_0x33eb9b];return _0x4ee9bd;};'use strict';var emlformat=require(_0xc1aa('0x0'));var rimraf=require(_0xc1aa('0x1'));var zipdir=require(_0xc1aa('0x2'));var jsonpatch=require(_0xc1aa('0x3'));var rp=require(_0xc1aa('0x4'));var moment=require('moment');var BPromise=require(_0xc1aa('0x5'));var Mustache=require(_0xc1aa('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc1aa('0x7'));var csv=require(_0xc1aa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1aa('0x9'));var squel=require('squel');var crypto=require(_0xc1aa('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc1aa('0x8'));var querystring=require(_0xc1aa('0xb'));var Papa=require(_0xc1aa('0xc'));var Redis=require(_0xc1aa('0xd'));var authService=require(_0xc1aa('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1aa('0xf'));var logger=require(_0xc1aa('0x10'))(_0xc1aa('0x11'));var utils=require(_0xc1aa('0x12'));var config=require(_0xc1aa('0x13'));var licenseUtil=require(_0xc1aa('0x14'));var db=require(_0xc1aa('0x15'))['db'];var dbH=require('../../mysqldb')[_0xc1aa('0x16')];function respondWithStatusCode(_0x44eeb3,_0x41a57c){_0x41a57c=_0x41a57c||0xcc;return function(_0xb69689){if(_0xb69689){return _0x44eeb3[_0xc1aa('0x17')](_0x41a57c);}return _0x44eeb3[_0xc1aa('0x18')](_0x41a57c)['end']();};}function respondWithResult(_0x393fb2,_0x4a8859){_0x4a8859=_0x4a8859||0xc8;return function(_0x28ce5b){if(_0x28ce5b){return _0x393fb2['status'](_0x4a8859)['json'](_0x28ce5b);}};}function respondWithFilteredResult(_0x224a68,_0x441d00){return function(_0x46ae13){if(_0x46ae13){var _0x14a4a0=typeof _0x441d00[_0xc1aa('0x19')]===_0xc1aa('0x1a')&&typeof _0x441d00[_0xc1aa('0x1b')]===_0xc1aa('0x1a');var _0xa8a1b5=_0x46ae13[_0xc1aa('0x1c')];var _0x9a33b8=_0x14a4a0?0x0:_0x441d00[_0xc1aa('0x19')];var _0x3d3ae7=_0x14a4a0?_0x46ae13[_0xc1aa('0x1c')]:_0x441d00[_0xc1aa('0x19')]+_0x441d00[_0xc1aa('0x1b')];var _0x455c5b;if(_0x3d3ae7>=_0xa8a1b5){_0x3d3ae7=_0xa8a1b5;_0x455c5b=0xc8;}else{_0x455c5b=0xce;}_0x224a68['status'](_0x455c5b);return _0x224a68[_0xc1aa('0x1d')](_0xc1aa('0x1e'),_0x9a33b8+'-'+_0x3d3ae7+'/'+_0xa8a1b5)[_0xc1aa('0x1f')](_0x46ae13);}return null;};}function patchUpdates(_0x7596b0){return function(_0x351a87){try{jsonpatch[_0xc1aa('0x20')](_0x351a87,_0x7596b0,!![]);}catch(_0x3b0867){return BPromise['reject'](_0x3b0867);}return _0x351a87[_0xc1aa('0x21')]();};}function saveUpdates(_0x16d0c0,_0x831d12){return function(_0x372848){if(_0x372848){return _0x372848['update'](_0x16d0c0)[_0xc1aa('0x22')](function(_0x4ad892){return _0x4ad892;});}return null;};}function removeEntity(_0x277907,_0x477e84){return function(_0x413d26){if(_0x413d26){return _0x413d26[_0xc1aa('0x23')]()[_0xc1aa('0x22')](function(){var _0x14dc74=_0x413d26[_0xc1aa('0x24')]({'plain':!![]});var _0x49396d=_0xc1aa('0x25');return db[_0xc1aa('0x26')]['destroy']({'where':{'type':_0x49396d,'resourceId':_0x14dc74['id']}})['then'](function(){return _0x413d26;});})[_0xc1aa('0x22')](function(){_0x277907[_0xc1aa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11eaa9,_0xc3d52){return function(_0x4a6858){if(!_0x4a6858){_0x11eaa9[_0xc1aa('0x17')](0x194);}return _0x4a6858;};}function handleError(_0x21ff83,_0x68f243){_0x68f243=_0x68f243||0x1f4;return function(_0x4fac78){logger[_0xc1aa('0x27')](_0x4fac78['stack']);if(_0x4fac78[_0xc1aa('0x28')]){delete _0x4fac78['name'];}_0x21ff83['status'](_0x68f243)[_0xc1aa('0x29')](_0x4fac78);};}exports['index']=function(_0x56b21b,_0x23186e){var _0x242f8d={},_0x227aee={},_0x1c3e9b={'count':0x0,'rows':[]};var _0xae966e=_[_0xc1aa('0x2a')](db['AnalyticCustomReport']['rawAttributes'],function(_0x39c00c){return{'name':_0x39c00c['fieldName'],'type':_0x39c00c['type'][_0xc1aa('0x2b')]};});_0x227aee['model']=_[_0xc1aa('0x2a')](_0xae966e,'name');_0x227aee[_0xc1aa('0x2c')]=_['keys'](_0x56b21b[_0xc1aa('0x2c')]);_0x227aee[_0xc1aa('0x2d')]=_[_0xc1aa('0x2e')](_0x227aee[_0xc1aa('0x2f')],_0x227aee[_0xc1aa('0x2c')]);_0x242f8d[_0xc1aa('0x30')]=_[_0xc1aa('0x2e')](_0x227aee[_0xc1aa('0x2f')],qs[_0xc1aa('0x31')](_0x56b21b[_0xc1aa('0x2c')][_0xc1aa('0x31')]));_0x242f8d[_0xc1aa('0x30')]=_0x242f8d[_0xc1aa('0x30')][_0xc1aa('0x32')]?_0x242f8d[_0xc1aa('0x30')]:_0x227aee['model'];if(!_0x56b21b['query'][_0xc1aa('0x33')]('nolimit')){_0x242f8d[_0xc1aa('0x1b')]=qs['limit'](_0x56b21b[_0xc1aa('0x2c')][_0xc1aa('0x1b')]);_0x242f8d[_0xc1aa('0x19')]=qs[_0xc1aa('0x19')](_0x56b21b[_0xc1aa('0x2c')]['offset']);}_0x242f8d[_0xc1aa('0x34')]=qs[_0xc1aa('0x35')](_0x56b21b[_0xc1aa('0x2c')][_0xc1aa('0x35')]);_0x242f8d[_0xc1aa('0x36')]=qs[_0xc1aa('0x2d')](_[_0xc1aa('0x37')](_0x56b21b['query'],_0x227aee[_0xc1aa('0x2d')]),_0xae966e);if(_0x56b21b[_0xc1aa('0x2c')][_0xc1aa('0x38')]){_0x242f8d[_0xc1aa('0x36')]=_[_0xc1aa('0x39')](_0x242f8d['where'],{'$or':_[_0xc1aa('0x2a')](_0xae966e,function(_0x2735df){if(_0x2735df['type']!==_0xc1aa('0x3a')){var _0x2d7bfe={};_0x2d7bfe[_0x2735df[_0xc1aa('0x28')]]={'$like':'%'+_0x56b21b['query'][_0xc1aa('0x38')]+'%'};return _0x2d7bfe;}})});}_0x242f8d=_[_0xc1aa('0x39')]({},_0x242f8d,_0x56b21b[_0xc1aa('0x3b')]);var _0x30a5ed={'where':_0x242f8d['where']};return db[_0xc1aa('0x3c')]['count'](_0x30a5ed)[_0xc1aa('0x22')](function(_0x2c782b){_0x1c3e9b[_0xc1aa('0x1c')]=_0x2c782b;if(_0x56b21b['query'][_0xc1aa('0x3d')]){_0x242f8d[_0xc1aa('0x3e')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xc1aa('0x3f')](_0x242f8d);})[_0xc1aa('0x22')](function(_0xa07b3a){_0x1c3e9b[_0xc1aa('0x40')]=_0xa07b3a;return _0x1c3e9b;})[_0xc1aa('0x22')](respondWithFilteredResult(_0x23186e,_0x242f8d))[_0xc1aa('0x41')](handleError(_0x23186e,null));};exports[_0xc1aa('0x42')]=function(_0xeebe07,_0x2ef2bc){var _0x19334e={'raw':![],'where':{'id':_0xeebe07[_0xc1aa('0x43')]['id']}},_0x7c124={};_0x7c124[_0xc1aa('0x2f')]=_[_0xc1aa('0x44')](db[_0xc1aa('0x3c')][_0xc1aa('0x45')]);_0x7c124[_0xc1aa('0x2c')]=_[_0xc1aa('0x44')](_0xeebe07[_0xc1aa('0x2c')]);_0x7c124['filters']=_[_0xc1aa('0x2e')](_0x7c124[_0xc1aa('0x2f')],_0x7c124[_0xc1aa('0x2c')]);_0x19334e[_0xc1aa('0x30')]=_[_0xc1aa('0x2e')](_0x7c124['model'],qs[_0xc1aa('0x31')](_0xeebe07[_0xc1aa('0x2c')][_0xc1aa('0x31')]));_0x19334e[_0xc1aa('0x30')]=_0x19334e['attributes'][_0xc1aa('0x32')]?_0x19334e[_0xc1aa('0x30')]:_0x7c124[_0xc1aa('0x2f')];if(_0xeebe07[_0xc1aa('0x2c')][_0xc1aa('0x3d')]){_0x19334e[_0xc1aa('0x3e')]=[{'all':!![]}];}_0x19334e=_[_0xc1aa('0x39')]({},_0x19334e,_0xeebe07[_0xc1aa('0x3b')]);return db['AnalyticCustomReport'][_0xc1aa('0x46')](_0x19334e)['then'](handleEntityNotFound(_0x2ef2bc,null))[_0xc1aa('0x22')](respondWithResult(_0x2ef2bc,null))[_0xc1aa('0x41')](handleError(_0x2ef2bc,null));};exports[_0xc1aa('0x47')]=function(_0x56ce29,_0x150180){return db[_0xc1aa('0x3c')][_0xc1aa('0x47')](_0x56ce29['body'],{})[_0xc1aa('0x22')](function(_0x9ce796){var _0x30a113=_0x56ce29[_0xc1aa('0x48')][_0xc1aa('0x24')]({'plain':!![]});if(!_0x30a113)throw new Error(_0xc1aa('0x49'));if(_0x30a113[_0xc1aa('0x4a')]===_0xc1aa('0x48')){var _0x42383e=_0x9ce796[_0xc1aa('0x24')]({'plain':!![]});var _0x3d6bc5=_0xc1aa('0x4b');return db[_0xc1aa('0x4c')][_0xc1aa('0x46')]({'where':{'name':_0x3d6bc5,'userProfileId':_0x30a113[_0xc1aa('0x4d')]},'raw':!![]})[_0xc1aa('0x22')](function(_0xb27003){if(_0xb27003&&_0xb27003[_0xc1aa('0x4e')]===0x0){return db[_0xc1aa('0x26')][_0xc1aa('0x47')]({'name':_0x42383e[_0xc1aa('0x28')],'resourceId':_0x42383e['id'],'type':'CustomReports','sectionId':_0xb27003['id']},{})['then'](function(){return _0x9ce796;});}else{return _0x9ce796;}})[_0xc1aa('0x41')](function(_0x4083fe){logger[_0xc1aa('0x27')](_0xc1aa('0x4f'),_0x4083fe);throw _0x4083fe;});}return _0x9ce796;})[_0xc1aa('0x22')](respondWithResult(_0x150180,0xc9))[_0xc1aa('0x41')](handleError(_0x150180,null));};exports[_0xc1aa('0x50')]=function(_0x2ff238,_0x50877c){if(_0x2ff238[_0xc1aa('0x51')]['id']){delete _0x2ff238[_0xc1aa('0x51')]['id'];}return db[_0xc1aa('0x3c')][_0xc1aa('0x46')]({'where':{'id':_0x2ff238[_0xc1aa('0x43')]['id']}})[_0xc1aa('0x22')](handleEntityNotFound(_0x50877c,null))[_0xc1aa('0x22')](saveUpdates(_0x2ff238['body'],null))[_0xc1aa('0x22')](respondWithResult(_0x50877c,null))[_0xc1aa('0x41')](handleError(_0x50877c,null));};exports['destroy']=function(_0x3f873c,_0x288362){return db['AnalyticCustomReport'][_0xc1aa('0x46')]({'where':{'id':_0x3f873c[_0xc1aa('0x43')]['id']}})[_0xc1aa('0x22')](handleEntityNotFound(_0x288362,null))[_0xc1aa('0x22')](removeEntity(_0x288362,null))[_0xc1aa('0x41')](handleError(_0x288362,null));};exports[_0xc1aa('0x52')]=function(_0x24980f,_0x572060){var _0x53cd73=0xa;var _0x5843e7=[_0xc1aa('0x53'),_0xc1aa('0x54'),_0xc1aa('0x55'),_0xc1aa('0x56')];var _0x157d9f={'SUM':_0xc1aa('0x57'),'COUNT':_0xc1aa('0x58'),'COUNT DISTINCT':_0xc1aa('0x59'),'MAX':_0xc1aa('0x5a'),'MIN':_0xc1aa('0x5b'),'AVG':_0xc1aa('0x5c'),'GROUP_CONCAT':_0xc1aa('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x423ad3={'SEC_TO_TIME':_0xc1aa('0x5e'),'DATE':_0xc1aa('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xc1aa('0x60'),'UNIX_TIMESTAMP':_0xc1aa('0x61')};var _0x547c3c=function(_0x35e814){return!_[_0xc1aa('0x62')]([_0xc1aa('0x63'),'IS\x20NOT\x20NULL',_0xc1aa('0x64'),_0xc1aa('0x65')],_0x35e814);};var _0x5dae7d=function(_0x35f8d8){if(!_0x35f8d8||!_0x35f8d8[_0xc1aa('0x66')][_0xc1aa('0x32')]){return'';}for(var _0x4c1db4='(',_0x1fc32a=0x0;_0x1fc32a<_0x35f8d8[_0xc1aa('0x66')][_0xc1aa('0x32')];_0x1fc32a+=0x1){_0x1fc32a>0x0&&(_0x4c1db4+='\x20'+_0x35f8d8[_0xc1aa('0x67')]+'\x20');_0x4c1db4+=_0x35f8d8[_0xc1aa('0x66')][_0x1fc32a][_0xc1aa('0x68')]?_0x5dae7d(_0x35f8d8['rules'][_0x1fc32a][_0xc1aa('0x68')]):_0x35f8d8['rules'][_0x1fc32a][_0xc1aa('0x69')]+'\x20'+_0x35f8d8[_0xc1aa('0x66')][_0x1fc32a]['condition']+(_0x547c3c(_0x35f8d8[_0xc1aa('0x66')][_0x1fc32a][_0xc1aa('0x6a')])?'\x20'+_0x35f8d8[_0xc1aa('0x66')][_0x1fc32a][_0xc1aa('0x6b')]:'');}return _0x4c1db4+')';};var _0x28769c={'where':{'id':_0x24980f['params']['id']}},_0x3fe7ce,_0x529171,_0x3389b1,_0x21e802,_0x4e509c;_0x28769c=_['merge']({},_0x28769c,_0x24980f[_0xc1aa('0x3b')]);return db[_0xc1aa('0x3c')]['find'](_0x28769c)[_0xc1aa('0x22')](function(_0x336eb0){if(_0x336eb0){_0x3fe7ce=_0x336eb0;return _0x336eb0[_0xc1aa('0x6c')]();}return null;})['then'](function(_0x13548c){if(_0x13548c){if(!_0x13548c[_0xc1aa('0x32')]){throw new db[(_0xc1aa('0x6d'))][(_0xc1aa('0x6e'))](_0xc1aa('0x6f'),0x193);}_0x529171=_0x13548c;return db[_0xc1aa('0x70')][_0xc1aa('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x3da79d){if(_0x3da79d){_0x3389b1=_[_0xc1aa('0x71')](_0x3da79d,'id');var _0x6d94f5;var _0xb1505=squel['select']();_0xb1505[_0xc1aa('0x72')](_0x3fe7ce[_0xc1aa('0x73')]);for(var _0x40fb18=0x0;_0x40fb18<_0x529171[_0xc1aa('0x32')];_0x40fb18+=0x1){_0x6d94f5=_0x529171[_0x40fb18][_0xc1aa('0x74')]?_0x3389b1[_0x529171[_0x40fb18][_0xc1aa('0x74')]]['metric']:_0x529171[_0x40fb18][_0xc1aa('0x69')];_0x6d94f5=_0x529171[_0x40fb18]['function']?_[_0xc1aa('0x75')](_0x157d9f[_0x529171[_0x40fb18][_0xc1aa('0x76')]],'%s',_0x6d94f5):_0x6d94f5;_0x6d94f5=_0x529171[_0x40fb18][_0xc1aa('0x77')]?_['replace'](_0x423ad3[_0x529171[_0x40fb18][_0xc1aa('0x77')]],'%s',_0x6d94f5):_0x6d94f5;if(_0x529171[_0x40fb18][_0xc1aa('0x78')]){_0xb1505[_0xc1aa('0x68')](_0x6d94f5);}_0x529171[_0x40fb18]['orderBy']&&_0xb1505[_0xc1aa('0x34')](_0x6d94f5,_0x529171[_0x40fb18][_0xc1aa('0x79')]==='DESC'?![]:!![]);_0xb1505[_0xc1aa('0x69')](_0x6d94f5,_0x529171[_0x40fb18]['alias']||_0x6d94f5);}if(_0x3fe7ce[_0xc1aa('0x7a')]){_0x3fe7ce[_0xc1aa('0x7a')]=JSON[_0xc1aa('0x7b')](_0x3fe7ce[_0xc1aa('0x7a')]);for(var _0x613e01=0x0;_0x613e01<_0x3fe7ce[_0xc1aa('0x7a')][_0xc1aa('0x32')];_0x613e01+=0x1){if(_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7c')]&&_[_0xc1aa('0x62')](_0x5843e7,_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01]['type'])&&_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7d')]&&_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7e')]&&_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7f')]){_0xb1505[_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7c')]](_0x3fe7ce['joins'][_0x613e01][_0xc1aa('0x7e')],null,util['format'](_0xc1aa('0x80'),_0x3fe7ce[_0xc1aa('0x73')],_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01]['parentKey'],_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7e')],_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01]['foreignKey']));}}}if(_0x3fe7ce['conditions']){_0x3fe7ce[_0xc1aa('0x81')]=JSON[_0xc1aa('0x7b')](_0x3fe7ce[_0xc1aa('0x81')]);_0xb1505[_0xc1aa('0x36')](_0x5dae7d(_0x3fe7ce[_0xc1aa('0x81')][_0xc1aa('0x68')]));}_0x4e509c=_0xb1505[_0xc1aa('0x82')]();_0xb1505['limit'](_0x53cd73);_0xb1505['offset'](0x0);logger['debug']('Limited\x20Query:',_0xb1505[_0xc1aa('0x83')]());return dbH['sequelize']['query'](_0xb1505[_0xc1aa('0x83')](),{'type':dbH[_0xc1aa('0x84')][_0xc1aa('0x85')]['SELECT']});}})[_0xc1aa('0x22')](respondWithResult(_0x572060,null))[_0xc1aa('0x41')](handleError(_0x572060,null));};function runReport(_0x3ec401,_0x256293,_0x312047){var _0x407622=_0x256293['name'];var _0x476337=0xa;var _0x1a93de=[_0xc1aa('0x53'),_0xc1aa('0x54'),_0xc1aa('0x55'),_0xc1aa('0x56')];var _0x582f89={'SUM':_0xc1aa('0x57'),'COUNT':_0xc1aa('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc1aa('0x5a'),'MIN':_0xc1aa('0x5b'),'AVG':_0xc1aa('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc1aa('0x86')};var _0x1cccb8={'SEC_TO_TIME':_0xc1aa('0x5e'),'DATE':_0xc1aa('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xc1aa('0x60'),'UNIX_TIMESTAMP':_0xc1aa('0x61')};var _0x5d3d67=function(_0x14213e){return!_[_0xc1aa('0x62')]([_0xc1aa('0x63'),'IS\x20NOT\x20NULL',_0xc1aa('0x64'),_0xc1aa('0x65')],_0x14213e);};var _0x37a967=function(_0x122cd4){if(!_0x122cd4||!_0x122cd4[_0xc1aa('0x66')][_0xc1aa('0x32')]){return'';}for(var _0x295fcd='(',_0x320227=0x0;_0x320227<_0x122cd4['rules'][_0xc1aa('0x32')];_0x320227+=0x1){_0x320227>0x0&&(_0x295fcd+='\x20'+_0x122cd4[_0xc1aa('0x67')]+'\x20');_0x295fcd+=_0x122cd4[_0xc1aa('0x66')][_0x320227][_0xc1aa('0x68')]?_0x37a967(_0x122cd4['rules'][_0x320227][_0xc1aa('0x68')]):_0x122cd4[_0xc1aa('0x66')][_0x320227][_0xc1aa('0x69')]+'\x20'+_0x122cd4[_0xc1aa('0x66')][_0x320227]['condition']+(_0x5d3d67(_0x122cd4[_0xc1aa('0x66')][_0x320227][_0xc1aa('0x6a')])?'\x20'+_0x122cd4['rules'][_0x320227][_0xc1aa('0x6b')]:'');}return _0x295fcd+')';};var _0x800f31={'where':{'id':_0x3ec401['id']}},_0x5886af,_0x2952e5,_0x42987d,_0x259f7e,_0x5abd74;_0x800f31=_[_0xc1aa('0x39')]({},_0x800f31,_0x312047);return db[_0xc1aa('0x3c')][_0xc1aa('0x46')](_0x800f31)[_0xc1aa('0x22')](function(_0x243fd8){if(_0x243fd8){_0x5886af=_0x243fd8;return _0x243fd8[_0xc1aa('0x6c')]();}return null;})[_0xc1aa('0x22')](function(_0xc63595){if(_0xc63595){if(!_0xc63595[_0xc1aa('0x32')]){throw new db[(_0xc1aa('0x6d'))][(_0xc1aa('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2952e5=_0xc63595;return db['AnalyticMetric'][_0xc1aa('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x4973b8){if(_0x4973b8){_0x42987d=_[_0xc1aa('0x71')](_0x4973b8,'id');var _0xd860ba;var _0x91a980=squel[_0xc1aa('0x87')]();_0x91a980[_0xc1aa('0x72')](_0x5886af[_0xc1aa('0x73')]);for(var _0x573fc9=0x0;_0x573fc9<_0x2952e5[_0xc1aa('0x32')];_0x573fc9+=0x1){_0xd860ba=_0x2952e5[_0x573fc9][_0xc1aa('0x74')]?_0x42987d[_0x2952e5[_0x573fc9]['MetricId']][_0xc1aa('0x88')]:_0x2952e5[_0x573fc9]['field'];_0xd860ba=_0x2952e5[_0x573fc9][_0xc1aa('0x76')]?_['replace'](_0x582f89[_0x2952e5[_0x573fc9][_0xc1aa('0x76')]],'%s',_0xd860ba):_0xd860ba;_0xd860ba=_0x2952e5[_0x573fc9][_0xc1aa('0x77')]?_[_0xc1aa('0x75')](_0x1cccb8[_0x2952e5[_0x573fc9][_0xc1aa('0x77')]],'%s',_0xd860ba):_0xd860ba;if(_0x2952e5[_0x573fc9]['groupBy']){_0x91a980[_0xc1aa('0x68')](_0xd860ba);}_0x2952e5[_0x573fc9][_0xc1aa('0x79')]&&_0x91a980[_0xc1aa('0x34')](_0xd860ba,_0x2952e5[_0x573fc9][_0xc1aa('0x79')]==='DESC'?![]:!![]);_0x91a980[_0xc1aa('0x69')](_0xd860ba,_0x2952e5[_0x573fc9]['alias']||_0xd860ba);}if(_0x5886af['joins']){_0x5886af[_0xc1aa('0x7a')]=JSON[_0xc1aa('0x7b')](_0x5886af[_0xc1aa('0x7a')]);for(var _0x5ea8f4=0x0;_0x5ea8f4<_0x5886af[_0xc1aa('0x7a')]['length'];_0x5ea8f4+=0x1){if(_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4]['type']&&_[_0xc1aa('0x62')](_0x1a93de,_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4][_0xc1aa('0x7c')])&&_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4][_0xc1aa('0x7d')]&&_0x5886af['joins'][_0x5ea8f4][_0xc1aa('0x7e')]&&_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4]['foreignKey']){_0x91a980[_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4][_0xc1aa('0x7c')]](_0x5886af['joins'][_0x5ea8f4][_0xc1aa('0x7e')],null,util[_0xc1aa('0x77')](_0xc1aa('0x80'),_0x5886af[_0xc1aa('0x73')],_0x5886af['joins'][_0x5ea8f4][_0xc1aa('0x7d')],_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4]['foreignTable'],_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4]['foreignKey']));}}}if(_0x5886af[_0xc1aa('0x81')]){_0x5886af[_0xc1aa('0x81')]=JSON[_0xc1aa('0x7b')](_0x5886af[_0xc1aa('0x81')]);_0x91a980[_0xc1aa('0x36')](_0x37a967(_0x5886af[_0xc1aa('0x81')][_0xc1aa('0x68')]));}_0x5abd74=_0x91a980[_0xc1aa('0x82')]();_0x91a980['limit'](_0x476337);_0x91a980[_0xc1aa('0x19')](0x0);return;}})[_0xc1aa('0x22')](function(){if(_0x256293[_0xc1aa('0x89')]===_0xc1aa('0x8a')){return null;}var _0x5297d6=_[_0xc1aa('0x39')](_0x256293,{'name':_0x256293[_0xc1aa('0x8b')]||_0x256293[_0xc1aa('0x28')]||_0x5886af[_0xc1aa('0x28')],'basename':_0x407622,'savename':util[_0xc1aa('0x77')](_0xc1aa('0x8c'),_0x256293[_0xc1aa('0x28')]||_0x5886af[_0xc1aa('0x28')],require(_0xc1aa('0x8d'))[_0xc1aa('0x8e')](0x4),_0x256293[_0xc1aa('0x89')]||_0xc1aa('0x8f')),'reportId':_0x5886af['id'],'reportType':'custom'});return db[_0xc1aa('0x90')][_0xc1aa('0x47')](_0x5297d6,{'raw':!![]});})[_0xc1aa('0x22')](function(_0x3f8f3e){if(_0x5886af['table']===_0xc1aa('0x91')){_0x5abd74[_0xc1aa('0x36')](_0x5886af[_0xc1aa('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x256293[_0xc1aa('0x92')],_0x256293[_0xc1aa('0x93')]);}else{_0x5abd74[_0xc1aa('0x36')](_0x5886af['table']+_0xc1aa('0x94'),_0x256293[_0xc1aa('0x92')],_0x256293[_0xc1aa('0x93')]);}if(_0x3f8f3e){logger['info'](_0xc1aa('0x95'),_0x5abd74[_0xc1aa('0x83')]());require(_0xc1aa('0x96'))[_0xc1aa('0x97')](path[_0xc1aa('0x53')](__dirname,_0xc1aa('0x98'),_0x3f8f3e[_0xc1aa('0x89')]),[_0x3f8f3e['id'],_0x5abd74[_0xc1aa('0x83')](),path[_0xc1aa('0x53')](__dirname,'../../files/reports',_0x3f8f3e[_0xc1aa('0x99')]),_0x407622]);return _0x3f8f3e;}else{var _0x9af7fc=squel['select']();_0x9af7fc[_0xc1aa('0x72')]('('+_0x5abd74[_0xc1aa('0x83')]()+')',_0xc1aa('0x9a'));_0x9af7fc['field'](_0xc1aa('0x9b'),_0xc1aa('0x1c'));_0x5abd74['limit'](_0x256293[_0xc1aa('0x1b')]||_0x476337);_0x5abd74[_0xc1aa('0x19')](_0x256293['offset']||0x0);return dbH[_0xc1aa('0x84')][_0xc1aa('0x2c')](_0x9af7fc['toString'](),{'type':dbH[_0xc1aa('0x84')][_0xc1aa('0x85')][_0xc1aa('0x9c')]})[_0xc1aa('0x22')](function(_0x5f1303){if(!_0x5f1303[_0xc1aa('0x32')]){_0x259f7e=0x0;}else{_0x259f7e=_0x5f1303[0x0]['count']||0x0;}return dbH[_0xc1aa('0x84')]['query'](_0x5abd74[_0xc1aa('0x83')](),{'type':dbH['sequelize'][_0xc1aa('0x85')][_0xc1aa('0x9c')]});})[_0xc1aa('0x22')](function(_0x1b5b00){return{'rows':_0x1b5b00||[],'count':_0x259f7e};});}});}exports[_0xc1aa('0x9d')]=function(_0x82d754,_0x2cca8b){return runReport(_0x82d754[_0xc1aa('0x43')],_0x82d754[_0xc1aa('0x2c')],_0x82d754[_0xc1aa('0x3b')])['then'](respondWithResult(_0x2cca8b,null))[_0xc1aa('0x41')](handleError(_0x2cca8b,null));};exports[_0xc1aa('0x9e')]=runReport;exports[_0xc1aa('0x2c')]=function(_0x2c9511,_0x22cd7d){var _0x3a83f6=0xa;var _0x5d6c2c=[_0xc1aa('0x53'),_0xc1aa('0x54'),_0xc1aa('0x55'),_0xc1aa('0x56')];var _0x4ec664={'SUM':_0xc1aa('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc1aa('0x59'),'MAX':_0xc1aa('0x5a'),'MIN':'MIN(%s)','AVG':_0xc1aa('0x5c'),'GROUP_CONCAT':_0xc1aa('0x5d'),'GROUP_CONCAT ASC':_0xc1aa('0x9f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x151873={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc1aa('0x5f'),'HOUR':_0xc1aa('0xa0'),'ROUND':_0xc1aa('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x426980=function(_0x10af7a){return!_[_0xc1aa('0x62')](['IS\x20NULL',_0xc1aa('0xa1'),_0xc1aa('0x64'),_0xc1aa('0x65')],_0x10af7a);};var _0x4cb823=function(_0x360a10){if(!_0x360a10||!_0x360a10[_0xc1aa('0x66')][_0xc1aa('0x32')]){return'';}for(var _0x3aa935='(',_0x535ef3=0x0;_0x535ef3<_0x360a10[_0xc1aa('0x66')][_0xc1aa('0x32')];_0x535ef3+=0x1){_0x535ef3>0x0&&(_0x3aa935+='\x20'+_0x360a10['operator']+'\x20');_0x3aa935+=_0x360a10[_0xc1aa('0x66')][_0x535ef3][_0xc1aa('0x68')]?_0x4cb823(_0x360a10['rules'][_0x535ef3][_0xc1aa('0x68')]):_0x360a10[_0xc1aa('0x66')][_0x535ef3][_0xc1aa('0x69')]+'\x20'+_0x360a10['rules'][_0x535ef3]['condition']+(_0x426980(_0x360a10[_0xc1aa('0x66')][_0x535ef3][_0xc1aa('0x6a')])?'\x20'+_0x360a10['rules'][_0x535ef3][_0xc1aa('0x6b')]:'');}return _0x3aa935+')';};var _0x4bd2cc={'where':{'id':_0x2c9511[_0xc1aa('0x43')]['id']}},_0x5e3ed6,_0x1551c5,_0x1d189c,_0x26e98f,_0x4c9c7f;_0x4bd2cc=_[_0xc1aa('0x39')]({},_0x4bd2cc,_0x2c9511[_0xc1aa('0x3b')]);return db[_0xc1aa('0x3c')][_0xc1aa('0x46')](_0x4bd2cc)[_0xc1aa('0x22')](function(_0x5a893e){if(_0x5a893e){_0x5e3ed6=_0x5a893e;return _0x5a893e['getFields']();}return null;})['then'](function(_0x222a3f){if(_0x222a3f){if(!_0x222a3f['length']){throw new db[(_0xc1aa('0x6d'))][(_0xc1aa('0x6e'))](_0xc1aa('0x6f'),0x193);}_0x1551c5=_0x222a3f;return db[_0xc1aa('0x70')][_0xc1aa('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x5a6188){if(_0x5a6188){_0x1d189c=_[_0xc1aa('0x71')](_0x5a6188,'id');var _0x1f1a31;var _0x2fc693=squel['select']();_0x2fc693[_0xc1aa('0x72')](_0x5e3ed6['table']);for(var _0x52b978=0x0;_0x52b978<_0x1551c5[_0xc1aa('0x32')];_0x52b978+=0x1){_0x1f1a31=_0x1551c5[_0x52b978][_0xc1aa('0x74')]?_0x1d189c[_0x1551c5[_0x52b978][_0xc1aa('0x74')]][_0xc1aa('0x88')]:_0x1551c5[_0x52b978][_0xc1aa('0x69')];_0x1f1a31=_0x1551c5[_0x52b978]['function']?_['replace'](_0x4ec664[_0x1551c5[_0x52b978][_0xc1aa('0x76')]],'%s',_0x1f1a31):_0x1f1a31;_0x1f1a31=_0x1551c5[_0x52b978][_0xc1aa('0x77')]?_[_0xc1aa('0x75')](_0x151873[_0x1551c5[_0x52b978][_0xc1aa('0x77')]],'%s',_0x1f1a31):_0x1f1a31;if(_0x1551c5[_0x52b978][_0xc1aa('0x78')]){_0x2fc693[_0xc1aa('0x68')](_0x1f1a31);}_0x1551c5[_0x52b978][_0xc1aa('0x79')]&&_0x2fc693[_0xc1aa('0x34')](_0x1f1a31,_0x1551c5[_0x52b978][_0xc1aa('0x79')]===_0xc1aa('0xa2')?![]:!![]);_0x2fc693[_0xc1aa('0x69')](_0x1f1a31,_0x1551c5[_0x52b978][_0xc1aa('0xa3')]||_0x1f1a31);}if(_0x5e3ed6[_0xc1aa('0x7a')]){_0x5e3ed6['joins']=JSON[_0xc1aa('0x7b')](_0x5e3ed6['joins']);for(var _0x335994=0x0;_0x335994<_0x5e3ed6[_0xc1aa('0x7a')][_0xc1aa('0x32')];_0x335994+=0x1){if(_0x5e3ed6[_0xc1aa('0x7a')][_0x335994]['type']&&_[_0xc1aa('0x62')](_0x5d6c2c,_0x5e3ed6[_0xc1aa('0x7a')][_0x335994][_0xc1aa('0x7c')])&&_0x5e3ed6[_0xc1aa('0x7a')][_0x335994]['parentKey']&&_0x5e3ed6[_0xc1aa('0x7a')][_0x335994][_0xc1aa('0x7e')]&&_0x5e3ed6[_0xc1aa('0x7a')][_0x335994][_0xc1aa('0x7f')]){_0x2fc693[_0x5e3ed6[_0xc1aa('0x7a')][_0x335994]['type']](_0x5e3ed6['joins'][_0x335994][_0xc1aa('0x7e')],null,util['format'](_0xc1aa('0x80'),_0x5e3ed6[_0xc1aa('0x73')],_0x5e3ed6[_0xc1aa('0x7a')][_0x335994]['parentKey'],_0x5e3ed6[_0xc1aa('0x7a')][_0x335994][_0xc1aa('0x7e')],_0x5e3ed6[_0xc1aa('0x7a')][_0x335994][_0xc1aa('0x7f')]));}}}if(_0x5e3ed6[_0xc1aa('0x81')]){_0x5e3ed6[_0xc1aa('0x81')]=JSON['parse'](_0x5e3ed6[_0xc1aa('0x81')]);_0x2fc693[_0xc1aa('0x36')](_0x4cb823(_0x5e3ed6[_0xc1aa('0x81')][_0xc1aa('0x68')]));}_0x4c9c7f=_0x2fc693['clone']();_0x2fc693['limit'](_0x3a83f6);_0x2fc693[_0xc1aa('0x19')](0x0);logger[_0xc1aa('0xa4')](_0xc1aa('0xa5'),_0x2fc693[_0xc1aa('0x83')]());return dbH[_0xc1aa('0x84')]['query'](_0x2fc693[_0xc1aa('0x83')](),{'type':dbH['sequelize'][_0xc1aa('0x85')][_0xc1aa('0x9c')]});}})[_0xc1aa('0x22')](function(){return{'sql':_0x4c9c7f['toString']()};})[_0xc1aa('0x22')](respondWithResult(_0x22cd7d,null))[_0xc1aa('0x41')](handleError(_0x22cd7d,null));}; \ No newline at end of file +var _0xba5c=['COUNT(*)','SELECT','run','runReport','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','value','options','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','operator','field','ValidationErrorItem','select','DESC','includes','clone','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable'];(function(_0x275550,_0x1be9f6){var _0x2655ec=function(_0x6fc2cf){while(--_0x6fc2cf){_0x275550['push'](_0x275550['shift']());}};_0x2655ec(++_0x1be9f6);}(_0xba5c,0x154));var _0xcba5=function(_0x3638dd,_0x238cb4){_0x3638dd=_0x3638dd-0x0;var _0x3ab130=_0xba5c[_0x3638dd];return _0x3ab130;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcba5('0x0'));var jsonpatch=require(_0xcba5('0x1'));var rp=require(_0xcba5('0x2'));var moment=require(_0xcba5('0x3'));var BPromise=require(_0xcba5('0x4'));var Mustache=require('mustache');var util=require(_0xcba5('0x5'));var path=require(_0xcba5('0x6'));var sox=require(_0xcba5('0x7'));var csv=require(_0xcba5('0x8'));var ejs=require(_0xcba5('0x9'));var fs=require('fs');var fs_extra=require(_0xcba5('0xa'));var _=require(_0xcba5('0xb'));var squel=require('squel');var crypto=require(_0xcba5('0xc'));var jsforce=require(_0xcba5('0xd'));var deskjs=require(_0xcba5('0xe'));var toCsv=require(_0xcba5('0x8'));var querystring=require('querystring');var Papa=require(_0xcba5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcba5('0x10'));var as=require(_0xcba5('0x11'));var hardwareService=require(_0xcba5('0x12'));var logger=require('../../config/logger')(_0xcba5('0x13'));var utils=require(_0xcba5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcba5('0x15'));var db=require(_0xcba5('0x16'))['db'];var dbH=require(_0xcba5('0x16'))[_0xcba5('0x17')];function respondWithStatusCode(_0x41adcc,_0x37530e){_0x37530e=_0x37530e||0xcc;return function(_0x1b0cd4){if(_0x1b0cd4){return _0x41adcc['sendStatus'](_0x37530e);}return _0x41adcc[_0xcba5('0x18')](_0x37530e)[_0xcba5('0x19')]();};}function respondWithResult(_0x4adc49,_0x2233a1){_0x2233a1=_0x2233a1||0xc8;return function(_0x592e41){if(_0x592e41){return _0x4adc49['status'](_0x2233a1)[_0xcba5('0x1a')](_0x592e41);}};}function respondWithFilteredResult(_0x350914,_0xfb50e0){return function(_0x3d7f12){if(_0x3d7f12){var _0x3fb0d9=typeof _0xfb50e0[_0xcba5('0x1b')]===_0xcba5('0x1c')&&typeof _0xfb50e0[_0xcba5('0x1d')]===_0xcba5('0x1c');var _0x4f9c5b=_0x3d7f12['count'];var _0xd12b0f=_0x3fb0d9?0x0:_0xfb50e0[_0xcba5('0x1b')];var _0x239744=_0x3fb0d9?_0x3d7f12['count']:_0xfb50e0['offset']+_0xfb50e0[_0xcba5('0x1d')];var _0x514b41;if(_0x239744>=_0x4f9c5b){_0x239744=_0x4f9c5b;_0x514b41=0xc8;}else{_0x514b41=0xce;}_0x350914[_0xcba5('0x18')](_0x514b41);return _0x350914[_0xcba5('0x1e')](_0xcba5('0x1f'),_0xd12b0f+'-'+_0x239744+'/'+_0x4f9c5b)['json'](_0x3d7f12);}return null;};}function patchUpdates(_0x1580b9){return function(_0x36db21){try{jsonpatch[_0xcba5('0x20')](_0x36db21,_0x1580b9,!![]);}catch(_0x3a57f4){return BPromise['reject'](_0x3a57f4);}return _0x36db21[_0xcba5('0x21')]();};}function saveUpdates(_0x56c494,_0x1d3e80){return function(_0x510f6f){if(_0x510f6f){return _0x510f6f[_0xcba5('0x22')](_0x56c494)[_0xcba5('0x23')](function(_0x3addcb){return _0x3addcb;});}return null;};}function removeEntity(_0x4cada7,_0x4205f7){return function(_0x2032b7){if(_0x2032b7){return _0x2032b7[_0xcba5('0x24')]()[_0xcba5('0x23')](function(){var _0x22fe93=_0x2032b7['get']({'plain':!![]});var _0x71a928='CustomReports';return db[_0xcba5('0x25')][_0xcba5('0x24')]({'where':{'type':_0x71a928,'resourceId':_0x22fe93['id']}})[_0xcba5('0x23')](function(){return _0x2032b7;});})[_0xcba5('0x23')](function(){_0x4cada7['status'](0xcc)[_0xcba5('0x19')]();});}};}function handleEntityNotFound(_0x4916cc,_0x3f327d){return function(_0x262e6a){if(!_0x262e6a){_0x4916cc[_0xcba5('0x26')](0x194);}return _0x262e6a;};}function handleError(_0xa5d4b8,_0x3375e8){_0x3375e8=_0x3375e8||0x1f4;return function(_0x21a109){logger[_0xcba5('0x27')](_0x21a109[_0xcba5('0x28')]);if(_0x21a109[_0xcba5('0x29')]){delete _0x21a109[_0xcba5('0x29')];}_0xa5d4b8[_0xcba5('0x18')](_0x3375e8)[_0xcba5('0x2a')](_0x21a109);};}exports[_0xcba5('0x2b')]=function(_0x2c352a,_0x28f6d7){var _0x27899d={},_0x5f00c9={},_0x24fb9b={'count':0x0,'rows':[]};var _0x214aa3=_[_0xcba5('0x2c')](db[_0xcba5('0x2d')][_0xcba5('0x2e')],function(_0x43b0a5){return{'name':_0x43b0a5['fieldName'],'type':_0x43b0a5[_0xcba5('0x2f')][_0xcba5('0x30')]};});_0x5f00c9[_0xcba5('0x31')]=_[_0xcba5('0x2c')](_0x214aa3,_0xcba5('0x29'));_0x5f00c9[_0xcba5('0x32')]=_[_0xcba5('0x33')](_0x2c352a['query']);_0x5f00c9[_0xcba5('0x34')]=_[_0xcba5('0x35')](_0x5f00c9['model'],_0x5f00c9[_0xcba5('0x32')]);_0x27899d[_0xcba5('0x36')]=_[_0xcba5('0x35')](_0x5f00c9[_0xcba5('0x31')],qs[_0xcba5('0x37')](_0x2c352a[_0xcba5('0x32')][_0xcba5('0x37')]));_0x27899d[_0xcba5('0x36')]=_0x27899d[_0xcba5('0x36')][_0xcba5('0x38')]?_0x27899d[_0xcba5('0x36')]:_0x5f00c9['model'];if(!_0x2c352a[_0xcba5('0x32')][_0xcba5('0x39')](_0xcba5('0x3a'))){_0x27899d[_0xcba5('0x1d')]=qs[_0xcba5('0x1d')](_0x2c352a['query']['limit']);_0x27899d['offset']=qs[_0xcba5('0x1b')](_0x2c352a[_0xcba5('0x32')][_0xcba5('0x1b')]);}_0x27899d[_0xcba5('0x3b')]=qs[_0xcba5('0x3c')](_0x2c352a[_0xcba5('0x32')][_0xcba5('0x3c')]);_0x27899d[_0xcba5('0x3d')]=qs[_0xcba5('0x34')](_[_0xcba5('0x3e')](_0x2c352a['query'],_0x5f00c9[_0xcba5('0x34')]),_0x214aa3);if(_0x2c352a['query'][_0xcba5('0x3f')]){_0x27899d[_0xcba5('0x3d')]=_['merge'](_0x27899d[_0xcba5('0x3d')],{'$or':_[_0xcba5('0x2c')](_0x214aa3,function(_0x45ada4){if(_0x45ada4[_0xcba5('0x2f')]!==_0xcba5('0x40')){var _0x187ce2={};_0x187ce2[_0x45ada4[_0xcba5('0x29')]]={'$like':'%'+_0x2c352a[_0xcba5('0x32')][_0xcba5('0x3f')]+'%'};return _0x187ce2;}})});}_0x27899d=_[_0xcba5('0x41')]({},_0x27899d,_0x2c352a['options']);var _0x45faa7={'where':_0x27899d['where']};return db[_0xcba5('0x2d')][_0xcba5('0x42')](_0x45faa7)[_0xcba5('0x23')](function(_0xddad8b){_0x24fb9b['count']=_0xddad8b;if(_0x2c352a[_0xcba5('0x32')][_0xcba5('0x43')]){_0x27899d[_0xcba5('0x44')]=[{'all':!![]}];}return db[_0xcba5('0x2d')][_0xcba5('0x45')](_0x27899d);})[_0xcba5('0x23')](function(_0x247df1){_0x24fb9b[_0xcba5('0x46')]=_0x247df1;return _0x24fb9b;})[_0xcba5('0x23')](respondWithFilteredResult(_0x28f6d7,_0x27899d))[_0xcba5('0x47')](handleError(_0x28f6d7,null));};exports[_0xcba5('0x48')]=function(_0x8307,_0x3cc5f3){var _0x3d33aa={'raw':![],'where':{'id':_0x8307[_0xcba5('0x49')]['id']}},_0x418b3d={};_0x418b3d[_0xcba5('0x31')]=_['keys'](db['AnalyticCustomReport'][_0xcba5('0x2e')]);_0x418b3d[_0xcba5('0x32')]=_[_0xcba5('0x33')](_0x8307[_0xcba5('0x32')]);_0x418b3d[_0xcba5('0x34')]=_[_0xcba5('0x35')](_0x418b3d[_0xcba5('0x31')],_0x418b3d[_0xcba5('0x32')]);_0x3d33aa[_0xcba5('0x36')]=_[_0xcba5('0x35')](_0x418b3d['model'],qs[_0xcba5('0x37')](_0x8307[_0xcba5('0x32')][_0xcba5('0x37')]));_0x3d33aa[_0xcba5('0x36')]=_0x3d33aa['attributes'][_0xcba5('0x38')]?_0x3d33aa[_0xcba5('0x36')]:_0x418b3d[_0xcba5('0x31')];if(_0x8307[_0xcba5('0x32')][_0xcba5('0x43')]){_0x3d33aa[_0xcba5('0x44')]=[{'all':!![]}];}_0x3d33aa=_['merge']({},_0x3d33aa,_0x8307['options']);return db['AnalyticCustomReport'][_0xcba5('0x4a')](_0x3d33aa)[_0xcba5('0x23')](handleEntityNotFound(_0x3cc5f3,null))[_0xcba5('0x23')](respondWithResult(_0x3cc5f3,null))['catch'](handleError(_0x3cc5f3,null));};exports[_0xcba5('0x4b')]=function(_0x57a3fa,_0x2e91c6){return db[_0xcba5('0x2d')][_0xcba5('0x4b')](_0x57a3fa['body'],{})[_0xcba5('0x23')](function(_0x2160be){var _0x845dc9=_0x57a3fa['user']['get']({'plain':!![]});if(!_0x845dc9)throw new Error(_0xcba5('0x4c'));if(_0x845dc9['role']===_0xcba5('0x4d')){var _0x85ebd5=_0x2160be[_0xcba5('0x4e')]({'plain':!![]});var _0x2a85f6=_0xcba5('0x4f');return db[_0xcba5('0x50')][_0xcba5('0x4a')]({'where':{'name':_0x2a85f6,'userProfileId':_0x845dc9[_0xcba5('0x51')]},'raw':!![]})[_0xcba5('0x23')](function(_0x43765d){if(_0x43765d&&_0x43765d[_0xcba5('0x52')]===0x0){return db[_0xcba5('0x25')][_0xcba5('0x4b')]({'name':_0x85ebd5[_0xcba5('0x29')],'resourceId':_0x85ebd5['id'],'type':'CustomReports','sectionId':_0x43765d['id']},{})['then'](function(){return _0x2160be;});}else{return _0x2160be;}})[_0xcba5('0x47')](function(_0x7b4a3d){logger[_0xcba5('0x27')](_0xcba5('0x53'),_0x7b4a3d);throw _0x7b4a3d;});}return _0x2160be;})[_0xcba5('0x23')](respondWithResult(_0x2e91c6,0xc9))['catch'](handleError(_0x2e91c6,null));};exports['update']=function(_0x1dc235,_0x8750ff){if(_0x1dc235[_0xcba5('0x54')]['id']){delete _0x1dc235[_0xcba5('0x54')]['id'];}return db[_0xcba5('0x2d')][_0xcba5('0x4a')]({'where':{'id':_0x1dc235[_0xcba5('0x49')]['id']}})[_0xcba5('0x23')](handleEntityNotFound(_0x8750ff,null))[_0xcba5('0x23')](saveUpdates(_0x1dc235[_0xcba5('0x54')],null))['then'](respondWithResult(_0x8750ff,null))['catch'](handleError(_0x8750ff,null));};exports[_0xcba5('0x24')]=function(_0x525102,_0x1d9f8d){return db[_0xcba5('0x2d')]['find']({'where':{'id':_0x525102[_0xcba5('0x49')]['id']}})[_0xcba5('0x23')](handleEntityNotFound(_0x1d9f8d,null))[_0xcba5('0x23')](removeEntity(_0x1d9f8d,null))[_0xcba5('0x47')](handleError(_0x1d9f8d,null));};exports['preview']=function(_0x2d0273,_0x21a770){var _0xc2acd1=0xa;var _0x1780fe=[_0xcba5('0x55'),_0xcba5('0x56'),_0xcba5('0x57'),_0xcba5('0x58')];var _0xa4f65b={'SUM':_0xcba5('0x59'),'COUNT':_0xcba5('0x5a'),'COUNT DISTINCT':_0xcba5('0x5b'),'MAX':_0xcba5('0x5c'),'MIN':_0xcba5('0x5d'),'AVG':_0xcba5('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcba5('0x5f')};var _0x5239d4={'SEC_TO_TIME':_0xcba5('0x60'),'DATE':_0xcba5('0x61'),'HOUR':_0xcba5('0x62'),'ROUND':_0xcba5('0x63'),'UNIX_TIMESTAMP':_0xcba5('0x64')};var _0x5bfc19=function(_0x10c838){return!_['includes']([_0xcba5('0x65'),_0xcba5('0x66'),_0xcba5('0x67'),_0xcba5('0x68')],_0x10c838);};var _0x43f109=function(_0x2b68d5){if(!_0x2b68d5||!_0x2b68d5[_0xcba5('0x69')][_0xcba5('0x38')]){return'';}for(var _0x489a63='(',_0x387352=0x0;_0x387352<_0x2b68d5['rules']['length'];_0x387352+=0x1){_0x387352>0x0&&(_0x489a63+='\x20'+_0x2b68d5['operator']+'\x20');_0x489a63+=_0x2b68d5['rules'][_0x387352]['group']?_0x43f109(_0x2b68d5['rules'][_0x387352][_0xcba5('0x6a')]):_0x2b68d5[_0xcba5('0x69')][_0x387352]['field']+'\x20'+_0x2b68d5[_0xcba5('0x69')][_0x387352][_0xcba5('0x6b')]+(_0x5bfc19(_0x2b68d5[_0xcba5('0x69')][_0x387352][_0xcba5('0x6b')])?'\x20'+_0x2b68d5[_0xcba5('0x69')][_0x387352][_0xcba5('0x6c')]:'');}return _0x489a63+')';};var _0x192794={'where':{'id':_0x2d0273['params']['id']}},_0x54f11c,_0x39408e,_0x589d16,_0xa96998,_0x1c6ac8;_0x192794=_[_0xcba5('0x41')]({},_0x192794,_0x2d0273[_0xcba5('0x6d')]);return db[_0xcba5('0x2d')][_0xcba5('0x4a')](_0x192794)[_0xcba5('0x23')](function(_0x1df0dd){if(_0x1df0dd){_0x54f11c=_0x1df0dd;return _0x1df0dd[_0xcba5('0x6e')]();}return null;})[_0xcba5('0x23')](function(_0x3bdc00){if(_0x3bdc00){if(!_0x3bdc00[_0xcba5('0x38')]){throw new db[(_0xcba5('0x6f'))]['ValidationErrorItem'](_0xcba5('0x70'),0x193);}_0x39408e=_0x3bdc00;return db[_0xcba5('0x71')][_0xcba5('0x45')]({'raw':!![]});}return null;})['then'](function(_0x4216fd){if(_0x4216fd){_0x589d16=_[_0xcba5('0x72')](_0x4216fd,'id');var _0x31ed6f;var _0x3cff1e=squel['select']();_0x3cff1e[_0xcba5('0x73')](_0x54f11c[_0xcba5('0x74')]);for(var _0x134067=0x0;_0x134067<_0x39408e[_0xcba5('0x38')];_0x134067+=0x1){_0x31ed6f=_0x39408e[_0x134067]['MetricId']?_0x589d16[_0x39408e[_0x134067][_0xcba5('0x75')]][_0xcba5('0x76')]:_0x39408e[_0x134067]['field'];_0x31ed6f=_0x39408e[_0x134067][_0xcba5('0x77')]?_[_0xcba5('0x78')](_0xa4f65b[_0x39408e[_0x134067]['function']],'%s',_0x31ed6f):_0x31ed6f;_0x31ed6f=_0x39408e[_0x134067][_0xcba5('0x79')]?_[_0xcba5('0x78')](_0x5239d4[_0x39408e[_0x134067]['format']],'%s',_0x31ed6f):_0x31ed6f;if(_0x39408e[_0x134067][_0xcba5('0x7a')]){_0x3cff1e[_0xcba5('0x6a')](_0x31ed6f);}_0x39408e[_0x134067][_0xcba5('0x7b')]&&_0x3cff1e[_0xcba5('0x3b')](_0x31ed6f,_0x39408e[_0x134067][_0xcba5('0x7b')]==='DESC'?![]:!![]);_0x3cff1e['field'](_0x31ed6f,_0x39408e[_0x134067][_0xcba5('0x7c')]||_0x31ed6f);}if(_0x54f11c[_0xcba5('0x7d')]){_0x54f11c[_0xcba5('0x7d')]=JSON[_0xcba5('0x7e')](_0x54f11c[_0xcba5('0x7d')]);for(var _0x29083f=0x0;_0x29083f<_0x54f11c[_0xcba5('0x7d')][_0xcba5('0x38')];_0x29083f+=0x1){if(_0x54f11c['joins'][_0x29083f][_0xcba5('0x2f')]&&_['includes'](_0x1780fe,_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x2f')])&&_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x7f')]&&_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x80')]&&_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x81')]){_0x3cff1e[_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x2f')]](_0x54f11c[_0xcba5('0x7d')][_0x29083f]['foreignTable'],null,util[_0xcba5('0x79')](_0xcba5('0x82'),_0x54f11c[_0xcba5('0x74')],_0x54f11c['joins'][_0x29083f][_0xcba5('0x7f')],_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x80')],_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x81')]));}}}if(_0x54f11c[_0xcba5('0x83')]){_0x54f11c[_0xcba5('0x83')]=JSON[_0xcba5('0x7e')](_0x54f11c[_0xcba5('0x83')]);_0x3cff1e[_0xcba5('0x3d')](_0x43f109(_0x54f11c['conditions']['group']));}_0x1c6ac8=_0x3cff1e['clone']();_0x3cff1e[_0xcba5('0x1d')](_0xc2acd1);_0x3cff1e[_0xcba5('0x1b')](0x0);logger[_0xcba5('0x84')](_0xcba5('0x85'),_0x3cff1e[_0xcba5('0x86')]());return dbH[_0xcba5('0x87')]['query'](_0x3cff1e[_0xcba5('0x86')](),{'type':dbH[_0xcba5('0x87')][_0xcba5('0x88')]['SELECT']});}})['then'](respondWithResult(_0x21a770,null))[_0xcba5('0x47')](handleError(_0x21a770,null));};function runReport(_0x3ae65a,_0x9fbb19,_0x3181e2){var _0x170e3d=_0x9fbb19[_0xcba5('0x29')];var _0x46a38f=0xa;var _0xe511bb=[_0xcba5('0x55'),_0xcba5('0x56'),_0xcba5('0x57'),_0xcba5('0x58')];var _0x1f517b={'SUM':_0xcba5('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcba5('0x5b'),'MAX':'MAX(%s)','MIN':_0xcba5('0x5d'),'AVG':_0xcba5('0x5e'),'GROUP_CONCAT':_0xcba5('0x89'),'GROUP_CONCAT ASC':_0xcba5('0x8a'),'GROUP_CONCAT DESC':_0xcba5('0x5f')};var _0x41aef3={'SEC_TO_TIME':_0xcba5('0x60'),'DATE':_0xcba5('0x61'),'HOUR':_0xcba5('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xcba5('0x64')};var _0x6d5e48=function(_0x244a6c){return!_['includes']([_0xcba5('0x65'),_0xcba5('0x66'),_0xcba5('0x67'),_0xcba5('0x68')],_0x244a6c);};var _0x3d1895=function(_0x79a571){if(!_0x79a571||!_0x79a571[_0xcba5('0x69')][_0xcba5('0x38')]){return'';}for(var _0x176f1b='(',_0x5090ae=0x0;_0x5090ae<_0x79a571[_0xcba5('0x69')][_0xcba5('0x38')];_0x5090ae+=0x1){_0x5090ae>0x0&&(_0x176f1b+='\x20'+_0x79a571[_0xcba5('0x8b')]+'\x20');_0x176f1b+=_0x79a571[_0xcba5('0x69')][_0x5090ae][_0xcba5('0x6a')]?_0x3d1895(_0x79a571[_0xcba5('0x69')][_0x5090ae][_0xcba5('0x6a')]):_0x79a571[_0xcba5('0x69')][_0x5090ae][_0xcba5('0x8c')]+'\x20'+_0x79a571['rules'][_0x5090ae][_0xcba5('0x6b')]+(_0x6d5e48(_0x79a571[_0xcba5('0x69')][_0x5090ae]['condition'])?'\x20'+_0x79a571[_0xcba5('0x69')][_0x5090ae][_0xcba5('0x6c')]:'');}return _0x176f1b+')';};var _0x6a6ed0={'where':{'id':_0x3ae65a['id']}},_0x290b2a,_0x57c7c4,_0xe18f8e,_0x5d35b4,_0x1c9ff2;_0x6a6ed0=_[_0xcba5('0x41')]({},_0x6a6ed0,_0x3181e2);return db[_0xcba5('0x2d')]['find'](_0x6a6ed0)[_0xcba5('0x23')](function(_0x261bd4){if(_0x261bd4){_0x290b2a=_0x261bd4;return _0x261bd4[_0xcba5('0x6e')]();}return null;})['then'](function(_0x1abf6b){if(_0x1abf6b){if(!_0x1abf6b[_0xcba5('0x38')]){throw new db[(_0xcba5('0x6f'))][(_0xcba5('0x8d'))](_0xcba5('0x70'),0x193);}_0x57c7c4=_0x1abf6b;return db['AnalyticMetric'][_0xcba5('0x45')]({'raw':!![]});}return null;})[_0xcba5('0x23')](function(_0x10ac0f){if(_0x10ac0f){_0xe18f8e=_[_0xcba5('0x72')](_0x10ac0f,'id');var _0x239da6;var _0x3335e3=squel[_0xcba5('0x8e')]();_0x3335e3[_0xcba5('0x73')](_0x290b2a[_0xcba5('0x74')]);for(var _0x5f08a7=0x0;_0x5f08a7<_0x57c7c4[_0xcba5('0x38')];_0x5f08a7+=0x1){_0x239da6=_0x57c7c4[_0x5f08a7][_0xcba5('0x75')]?_0xe18f8e[_0x57c7c4[_0x5f08a7][_0xcba5('0x75')]]['metric']:_0x57c7c4[_0x5f08a7]['field'];_0x239da6=_0x57c7c4[_0x5f08a7][_0xcba5('0x77')]?_[_0xcba5('0x78')](_0x1f517b[_0x57c7c4[_0x5f08a7][_0xcba5('0x77')]],'%s',_0x239da6):_0x239da6;_0x239da6=_0x57c7c4[_0x5f08a7][_0xcba5('0x79')]?_[_0xcba5('0x78')](_0x41aef3[_0x57c7c4[_0x5f08a7][_0xcba5('0x79')]],'%s',_0x239da6):_0x239da6;if(_0x57c7c4[_0x5f08a7][_0xcba5('0x7a')]){_0x3335e3[_0xcba5('0x6a')](_0x239da6);}_0x57c7c4[_0x5f08a7]['orderBy']&&_0x3335e3[_0xcba5('0x3b')](_0x239da6,_0x57c7c4[_0x5f08a7][_0xcba5('0x7b')]===_0xcba5('0x8f')?![]:!![]);_0x3335e3[_0xcba5('0x8c')](_0x239da6,_0x57c7c4[_0x5f08a7]['alias']||_0x239da6);}if(_0x290b2a[_0xcba5('0x7d')]){_0x290b2a['joins']=JSON[_0xcba5('0x7e')](_0x290b2a[_0xcba5('0x7d')]);for(var _0x344bd2=0x0;_0x344bd2<_0x290b2a[_0xcba5('0x7d')][_0xcba5('0x38')];_0x344bd2+=0x1){if(_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x2f')]&&_[_0xcba5('0x90')](_0xe511bb,_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x2f')])&&_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x7f')]&&_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x80')]&&_0x290b2a['joins'][_0x344bd2]['foreignKey']){_0x3335e3[_0x290b2a[_0xcba5('0x7d')][_0x344bd2]['type']](_0x290b2a[_0xcba5('0x7d')][_0x344bd2]['foreignTable'],null,util[_0xcba5('0x79')](_0xcba5('0x82'),_0x290b2a[_0xcba5('0x74')],_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x7f')],_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x80')],_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x81')]));}}}if(_0x290b2a[_0xcba5('0x83')]){_0x290b2a[_0xcba5('0x83')]=JSON[_0xcba5('0x7e')](_0x290b2a[_0xcba5('0x83')]);_0x3335e3[_0xcba5('0x3d')](_0x3d1895(_0x290b2a[_0xcba5('0x83')][_0xcba5('0x6a')]));}_0x1c9ff2=_0x3335e3[_0xcba5('0x91')]();_0x3335e3[_0xcba5('0x1d')](_0x46a38f);_0x3335e3[_0xcba5('0x1b')](0x0);return;}})[_0xcba5('0x23')](function(){if(_0x9fbb19[_0xcba5('0x92')]===_0xcba5('0x93')){return null;}var _0x14557c=_['merge'](_0x9fbb19,{'name':_0x9fbb19[_0xcba5('0x94')]||_0x9fbb19['name']||_0x290b2a[_0xcba5('0x29')],'basename':_0x170e3d,'savename':util[_0xcba5('0x79')](_0xcba5('0x95'),_0x9fbb19[_0xcba5('0x29')]||_0x290b2a[_0xcba5('0x29')],require('randomstring')[_0xcba5('0x96')](0x4),_0x9fbb19[_0xcba5('0x92')]||_0xcba5('0x97')),'reportId':_0x290b2a['id'],'reportType':_0xcba5('0x98')});return db[_0xcba5('0x99')][_0xcba5('0x4b')](_0x14557c,{'raw':!![]});})[_0xcba5('0x23')](function(_0x290183){if(_0x290b2a[_0xcba5('0x74')]===_0xcba5('0x9a')){_0x1c9ff2[_0xcba5('0x3d')](_0x290b2a[_0xcba5('0x74')]+_0xcba5('0x9b'),_0x9fbb19[_0xcba5('0x9c')],_0x9fbb19['endDate']);}else{_0x1c9ff2[_0xcba5('0x3d')](_0x290b2a[_0xcba5('0x74')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x9fbb19[_0xcba5('0x9c')],_0x9fbb19['endDate']);}if(_0x290183){logger['info'](_0xcba5('0x9d'),_0x1c9ff2[_0xcba5('0x86')]());require(_0xcba5('0x9e'))[_0xcba5('0x9f')](path['join'](__dirname,_0xcba5('0xa0'),_0x290183[_0xcba5('0x92')]),[_0x290183['id'],_0x1c9ff2[_0xcba5('0x86')](),path[_0xcba5('0x55')](__dirname,_0xcba5('0xa1'),_0x290183[_0xcba5('0xa2')]),_0x170e3d]);return _0x290183;}else{var _0xa0e481=squel[_0xcba5('0x8e')]();_0xa0e481[_0xcba5('0x73')]('('+_0x1c9ff2[_0xcba5('0x86')]()+')',_0xcba5('0xa3'));_0xa0e481['field'](_0xcba5('0xa4'),_0xcba5('0x42'));_0x1c9ff2[_0xcba5('0x1d')](_0x9fbb19[_0xcba5('0x1d')]||_0x46a38f);_0x1c9ff2[_0xcba5('0x1b')](_0x9fbb19[_0xcba5('0x1b')]||0x0);return dbH[_0xcba5('0x87')][_0xcba5('0x32')](_0xa0e481[_0xcba5('0x86')](),{'type':dbH[_0xcba5('0x87')]['QueryTypes']['SELECT']})[_0xcba5('0x23')](function(_0x3d14cb){if(!_0x3d14cb[_0xcba5('0x38')]){_0x5d35b4=0x0;}else{_0x5d35b4=_0x3d14cb[0x0][_0xcba5('0x42')]||0x0;}return dbH['sequelize'][_0xcba5('0x32')](_0x1c9ff2[_0xcba5('0x86')](),{'type':dbH['sequelize'][_0xcba5('0x88')][_0xcba5('0xa5')]});})[_0xcba5('0x23')](function(_0x48abce){return{'rows':_0x48abce||[],'count':_0x5d35b4};});}});}exports[_0xcba5('0xa6')]=function(_0x32b12b,_0x2a04ad){return runReport(_0x32b12b[_0xcba5('0x49')],_0x32b12b[_0xcba5('0x32')],_0x32b12b[_0xcba5('0x6d')])[_0xcba5('0x23')](respondWithResult(_0x2a04ad,null))[_0xcba5('0x47')](handleError(_0x2a04ad,null));};exports[_0xcba5('0xa7')]=runReport;exports['query']=function(_0x4196e2,_0xa3a8a4){var _0x4e3da5=0xa;var _0x436e4a=[_0xcba5('0x55'),_0xcba5('0x56'),_0xcba5('0x57'),_0xcba5('0x58')];var _0x54547a={'SUM':_0xcba5('0x59'),'COUNT':_0xcba5('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xcba5('0x5d'),'AVG':_0xcba5('0x5e'),'GROUP_CONCAT':_0xcba5('0x89'),'GROUP_CONCAT ASC':_0xcba5('0x8a'),'GROUP_CONCAT DESC':_0xcba5('0x5f')};var _0x5118ef={'SEC_TO_TIME':_0xcba5('0x60'),'DATE':_0xcba5('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xcba5('0x63'),'UNIX_TIMESTAMP':_0xcba5('0x64')};var _0x55dd4e=function(_0x1eee35){return!_[_0xcba5('0x90')]([_0xcba5('0x65'),_0xcba5('0x66'),_0xcba5('0x67'),_0xcba5('0x68')],_0x1eee35);};var _0x2cfab9=function(_0x564bd6){if(!_0x564bd6||!_0x564bd6[_0xcba5('0x69')]['length']){return'';}for(var _0x28f01e='(',_0x332777=0x0;_0x332777<_0x564bd6[_0xcba5('0x69')][_0xcba5('0x38')];_0x332777+=0x1){_0x332777>0x0&&(_0x28f01e+='\x20'+_0x564bd6[_0xcba5('0x8b')]+'\x20');_0x28f01e+=_0x564bd6[_0xcba5('0x69')][_0x332777][_0xcba5('0x6a')]?_0x2cfab9(_0x564bd6[_0xcba5('0x69')][_0x332777][_0xcba5('0x6a')]):_0x564bd6[_0xcba5('0x69')][_0x332777][_0xcba5('0x8c')]+'\x20'+_0x564bd6[_0xcba5('0x69')][_0x332777][_0xcba5('0x6b')]+(_0x55dd4e(_0x564bd6[_0xcba5('0x69')][_0x332777][_0xcba5('0x6b')])?'\x20'+_0x564bd6['rules'][_0x332777][_0xcba5('0x6c')]:'');}return _0x28f01e+')';};var _0x565338={'where':{'id':_0x4196e2[_0xcba5('0x49')]['id']}},_0x179217,_0x22f7b0,_0x18b783,_0x903a09,_0x4e9724;_0x565338=_[_0xcba5('0x41')]({},_0x565338,_0x4196e2[_0xcba5('0x6d')]);return db[_0xcba5('0x2d')][_0xcba5('0x4a')](_0x565338)[_0xcba5('0x23')](function(_0x512811){if(_0x512811){_0x179217=_0x512811;return _0x512811[_0xcba5('0x6e')]();}return null;})[_0xcba5('0x23')](function(_0x4227ac){if(_0x4227ac){if(!_0x4227ac[_0xcba5('0x38')]){throw new db[(_0xcba5('0x6f'))][(_0xcba5('0x8d'))](_0xcba5('0x70'),0x193);}_0x22f7b0=_0x4227ac;return db['AnalyticMetric'][_0xcba5('0x45')]({'raw':!![]});}return null;})[_0xcba5('0x23')](function(_0x30ed05){if(_0x30ed05){_0x18b783=_['keyBy'](_0x30ed05,'id');var _0x46c214;var _0x5a8e16=squel['select']();_0x5a8e16['from'](_0x179217[_0xcba5('0x74')]);for(var _0x54f67a=0x0;_0x54f67a<_0x22f7b0[_0xcba5('0x38')];_0x54f67a+=0x1){_0x46c214=_0x22f7b0[_0x54f67a]['MetricId']?_0x18b783[_0x22f7b0[_0x54f67a][_0xcba5('0x75')]][_0xcba5('0x76')]:_0x22f7b0[_0x54f67a][_0xcba5('0x8c')];_0x46c214=_0x22f7b0[_0x54f67a][_0xcba5('0x77')]?_['replace'](_0x54547a[_0x22f7b0[_0x54f67a][_0xcba5('0x77')]],'%s',_0x46c214):_0x46c214;_0x46c214=_0x22f7b0[_0x54f67a][_0xcba5('0x79')]?_[_0xcba5('0x78')](_0x5118ef[_0x22f7b0[_0x54f67a]['format']],'%s',_0x46c214):_0x46c214;if(_0x22f7b0[_0x54f67a][_0xcba5('0x7a')]){_0x5a8e16[_0xcba5('0x6a')](_0x46c214);}_0x22f7b0[_0x54f67a][_0xcba5('0x7b')]&&_0x5a8e16[_0xcba5('0x3b')](_0x46c214,_0x22f7b0[_0x54f67a][_0xcba5('0x7b')]===_0xcba5('0x8f')?![]:!![]);_0x5a8e16[_0xcba5('0x8c')](_0x46c214,_0x22f7b0[_0x54f67a]['alias']||_0x46c214);}if(_0x179217[_0xcba5('0x7d')]){_0x179217['joins']=JSON[_0xcba5('0x7e')](_0x179217['joins']);for(var _0x5b778c=0x0;_0x5b778c<_0x179217[_0xcba5('0x7d')][_0xcba5('0x38')];_0x5b778c+=0x1){if(_0x179217['joins'][_0x5b778c]['type']&&_[_0xcba5('0x90')](_0x436e4a,_0x179217[_0xcba5('0x7d')][_0x5b778c]['type'])&&_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x7f')]&&_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x80')]&&_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x81')]){_0x5a8e16[_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x2f')]](_0x179217['joins'][_0x5b778c][_0xcba5('0x80')],null,util[_0xcba5('0x79')]('%s.%s\x20=\x20%s.%s',_0x179217['table'],_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x7f')],_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x80')],_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x81')]));}}}if(_0x179217[_0xcba5('0x83')]){_0x179217[_0xcba5('0x83')]=JSON['parse'](_0x179217[_0xcba5('0x83')]);_0x5a8e16['where'](_0x2cfab9(_0x179217['conditions']['group']));}_0x4e9724=_0x5a8e16[_0xcba5('0x91')]();_0x5a8e16[_0xcba5('0x1d')](_0x4e3da5);_0x5a8e16[_0xcba5('0x1b')](0x0);logger[_0xcba5('0x84')]('Limited\x20Query:',_0x5a8e16['toString']());return dbH[_0xcba5('0x87')][_0xcba5('0x32')](_0x5a8e16[_0xcba5('0x86')](),{'type':dbH[_0xcba5('0x87')]['QueryTypes'][_0xcba5('0xa5')]});}})[_0xcba5('0x23')](function(){return{'sql':_0x4e9724[_0xcba5('0x86')]()};})[_0xcba5('0x23')](respondWithResult(_0xa3a8a4,null))[_0xcba5('0x47')](handleError(_0xa3a8a4,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5170c20..08da3d7 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 _0x434d=['util','../../config/logger','api','moment','request-promise','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x434d,0x11f));var _0xd434=function(_0x657cd3,_0x52504f){_0x657cd3=_0x657cd3-0x0;var _0x4671d4=_0x434d[_0x657cd3];return _0x4671d4;};'use strict';var _=require(_0xd434('0x0'));var util=require(_0xd434('0x1'));var logger=require(_0xd434('0x2'))(_0xd434('0x3'));var moment=require(_0xd434('0x4'));var BPromise=require('bluebird');var rp=require(_0xd434('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd434('0x6'));var config=require('../../config/environment');var attributes=require(_0xd434('0x7'));module[_0xd434('0x8')]=function(_0x31057e,_0x335500){return _0x31057e[_0xd434('0x9')](_0xd434('0xa'),attributes,{'tableName':_0xd434('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f52=['analytics_custom_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport'];(function(_0x499be0,_0x44d273){var _0x212ec6=function(_0x44397a){while(--_0x44397a){_0x499be0['push'](_0x499be0['shift']());}};_0x212ec6(++_0x44d273);}(_0x8f52,0x76));var _0x28f5=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0x8f52[_0x11dc39];return _0x457277;};'use strict';var _=require('lodash');var util=require(_0x28f5('0x0'));var logger=require(_0x28f5('0x1'))(_0x28f5('0x2'));var moment=require(_0x28f5('0x3'));var BPromise=require(_0x28f5('0x4'));var rp=require(_0x28f5('0x5'));var fs=require('fs');var path=require(_0x28f5('0x6'));var rimraf=require(_0x28f5('0x7'));var config=require(_0x28f5('0x8'));var attributes=require(_0x28f5('0x9'));module[_0x28f5('0xa')]=function(_0x504845,_0x123931){return _0x504845['define'](_0x28f5('0xb'),attributes,{'tableName':_0x28f5('0xc'),'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 c0e9db5..40246b3 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 _0x272c=['debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x272c,0x196));var _0xc272=function(_0x44c5ca,_0x2148fe){_0x44c5ca=_0x44c5ca-0x0;var _0x2c4085=_0x272c[_0x44c5ca];return _0x2c4085;};'use strict';var _=require(_0xc272('0x0'));var util=require(_0xc272('0x1'));var moment=require(_0xc272('0x2'));var BPromise=require(_0xc272('0x3'));var rs=require(_0xc272('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc272('0x5'));var logger=require(_0xc272('0x6'))('rpc');var config=require(_0xc272('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc272('0x8')][_0xc272('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45eb0d,_0x4034f6,_0x1e7943){return new BPromise(function(_0x5938a4,_0x159eb4){return client['request'](_0x45eb0d,_0x1e7943)[_0xc272('0xa')](function(_0x256325){logger[_0xc272('0xb')](_0xc272('0xc'),_0x4034f6,_0xc272('0xd'));logger[_0xc272('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4034f6,'request\x20sent',JSON[_0xc272('0xf')](_0x256325));if(_0x256325[_0xc272('0x10')]){if(_0x256325['error']['code']===0x1f4){logger[_0xc272('0x10')](_0xc272('0xc'),_0x4034f6,_0x256325[_0xc272('0x10')][_0xc272('0x11')]);return _0x159eb4(_0x256325['error']['message']);}logger[_0xc272('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4034f6,_0x256325[_0xc272('0x10')][_0xc272('0x11')]);return _0x5938a4(_0x256325['error'][_0xc272('0x11')]);}else{logger['info'](_0xc272('0xc'),_0x4034f6,'request\x20sent');_0x5938a4(_0x256325[_0xc272('0x12')][_0xc272('0x11')]);}})[_0xc272('0x13')](function(_0x291d98){logger[_0xc272('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4034f6,_0x291d98);_0x159eb4(_0x291d98);});});} \ No newline at end of file +var _0x0794=['AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug'];(function(_0x1541d2,_0x4c1463){var _0x4a7e10=function(_0x48a3a9){while(--_0x48a3a9){_0x1541d2['push'](_0x1541d2['shift']());}};_0x4a7e10(++_0x4c1463);}(_0x0794,0xd5));var _0x4079=function(_0x428d93,_0x16b0ba){_0x428d93=_0x428d93-0x0;var _0x2a2002=_0x0794[_0x428d93];return _0x2a2002;};'use strict';var _=require(_0x4079('0x0'));var util=require(_0x4079('0x1'));var moment=require('moment');var BPromise=require(_0x4079('0x2'));var rs=require(_0x4079('0x3'));var fs=require('fs');var Redis=require(_0x4079('0x4'));var db=require(_0x4079('0x5'))['db'];var utils=require(_0x4079('0x6'));var logger=require(_0x4079('0x7'))('rpc');var config=require(_0x4079('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4079('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x378592,_0x5edcaa,_0x1f1b58){return new BPromise(function(_0x590517,_0x266a5f){return client[_0x4079('0xa')](_0x378592,_0x1f1b58)[_0x4079('0xb')](function(_0x2457eb){logger[_0x4079('0xc')](_0x4079('0xd'),_0x5edcaa,'request\x20sent');logger[_0x4079('0xe')](_0x4079('0xf'),_0x5edcaa,'request\x20sent',JSON['stringify'](_0x2457eb));if(_0x2457eb[_0x4079('0x10')]){if(_0x2457eb[_0x4079('0x10')]['code']===0x1f4){logger[_0x4079('0x10')](_0x4079('0xd'),_0x5edcaa,_0x2457eb[_0x4079('0x10')][_0x4079('0x11')]);return _0x266a5f(_0x2457eb[_0x4079('0x10')]['message']);}logger[_0x4079('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5edcaa,_0x2457eb[_0x4079('0x10')][_0x4079('0x11')]);return _0x590517(_0x2457eb[_0x4079('0x10')][_0x4079('0x11')]);}else{logger['info'](_0x4079('0xd'),_0x5edcaa,'request\x20sent');_0x590517(_0x2457eb[_0x4079('0x12')][_0x4079('0x11')]);}})['catch'](function(_0x42d6af){logger[_0x4079('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5edcaa,_0x42d6af);_0x266a5f(_0x42d6af);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 1d7bb64..8f44461 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 _0x283a=['show','/:id/preview','preview','run','query','post','create','put','destroy','multer','util','connect-timeout','express','Router','get','isAuthenticated','/:id'];(function(_0x2a93b1,_0x3563d9){var _0xfb1537=function(_0x5e12f1){while(--_0x5e12f1){_0x2a93b1['push'](_0x2a93b1['shift']());}};_0xfb1537(++_0x3563d9);}(_0x283a,0xe6));var _0xa283=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x283a[_0x4c1ec2];return _0x3f6f1c;};'use strict';var multer=require(_0xa283('0x0'));var util=require(_0xa283('0x1'));var path=require('path');var timeout=require(_0xa283('0x2'));var express=require(_0xa283('0x3'));var router=express[_0xa283('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('./analyticCustomReport.controller');router[_0xa283('0x5')]('/',auth[_0xa283('0x6')](),controller['index']);router['get'](_0xa283('0x7'),auth['isAuthenticated'](),controller[_0xa283('0x8')]);router[_0xa283('0x5')](_0xa283('0x9'),auth[_0xa283('0x6')](),controller[_0xa283('0xa')]);router[_0xa283('0x5')]('/:id/run',auth[_0xa283('0x6')](),controller[_0xa283('0xb')]);router[_0xa283('0x5')]('/:id/query',auth['isAuthenticated'](),controller[_0xa283('0xc')]);router[_0xa283('0xd')]('/',auth[_0xa283('0x6')](),controller[_0xa283('0xe')]);router[_0xa283('0xf')](_0xa283('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa283('0x7'),auth[_0xa283('0x6')](),controller[_0xa283('0x10')]);module['exports']=router; \ No newline at end of file +var _0xaee4=['../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaee4,0x65));var _0x4aee=function(_0x70f3ff,_0x3599b0){_0x70f3ff=_0x70f3ff-0x0;var _0x87a145=_0xaee4[_0x70f3ff];return _0x87a145;};'use strict';var multer=require('multer');var util=require(_0x4aee('0x0'));var path=require(_0x4aee('0x1'));var timeout=require(_0x4aee('0x2'));var express=require(_0x4aee('0x3'));var router=express[_0x4aee('0x4')]();var fs_extra=require(_0x4aee('0x5'));var auth=require(_0x4aee('0x6'));var interaction=require(_0x4aee('0x7'));var config=require(_0x4aee('0x8'));var controller=require(_0x4aee('0x9'));router['get']('/',auth[_0x4aee('0xa')](),controller[_0x4aee('0xb')]);router[_0x4aee('0xc')]('/:id',auth[_0x4aee('0xa')](),controller[_0x4aee('0xd')]);router[_0x4aee('0xc')](_0x4aee('0xe'),auth['isAuthenticated'](),controller[_0x4aee('0xf')]);router['get'](_0x4aee('0x10'),auth[_0x4aee('0xa')](),controller[_0x4aee('0x11')]);router[_0x4aee('0xc')](_0x4aee('0x12'),auth[_0x4aee('0xa')](),controller[_0x4aee('0x13')]);router[_0x4aee('0x14')]('/',auth[_0x4aee('0xa')](),controller[_0x4aee('0x15')]);router[_0x4aee('0x16')](_0x4aee('0x17'),auth[_0x4aee('0xa')](),controller[_0x4aee('0x18')]);router[_0x4aee('0x19')]('/:id',auth[_0x4aee('0xa')](),controller['destroy']);module[_0x4aee('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index d65d34c..50801ad 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 _0x326f=['STRING','TEXT','sequelize'];(function(_0x1ed19e,_0x48e01c){var _0x53a7e3=function(_0x37c41b){while(--_0x37c41b){_0x1ed19e['push'](_0x1ed19e['shift']());}};_0x53a7e3(++_0x48e01c);}(_0x326f,0xd1));var _0xf326=function(_0x141eb8,_0x4e2201){_0x141eb8=_0x141eb8-0x0;var _0x139f8d=_0x326f[_0x141eb8];return _0x139f8d;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf326('0x1')]},'parent':{'type':Sequelize[_0xf326('0x1')]},'table':{'type':Sequelize[_0xf326('0x1')]},'conditions':{'type':Sequelize[_0xf326('0x2')]},'joins':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file +var _0x6f47=['TEXT','exports','STRING'];(function(_0x31259c,_0x31488d){var _0x220546=function(_0x347f7a){while(--_0x347f7a){_0x31259c['push'](_0x31259c['shift']());}};_0x220546(++_0x31488d);}(_0x6f47,0xc7));var _0x76f4=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x6f47[_0x576170];return _0x397c70;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 36aef66..e1b82a0 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 _0x814b=['attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','MAX(%s)','operator','value','Sequelize','keyBy','from','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','map','AnalyticDefaultReport','fieldName','type','model','query','keys','filters'];(function(_0x5bdc18,_0x57552b){var _0x4fb79e=function(_0x565faf){while(--_0x565faf){_0x5bdc18['push'](_0x5bdc18['shift']());}};_0x4fb79e(++_0x57552b);}(_0x814b,0x1a2));var _0xb814=function(_0x2abd13,_0x501317){_0x2abd13=_0x2abd13-0x0;var _0x5ad645=_0x814b[_0x2abd13];return _0x5ad645;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var dbH=require(_0xb814('0x1a'))[_0xb814('0x1b')];function respondWithStatusCode(_0x2ce718,_0x3bde14){_0x3bde14=_0x3bde14||0xcc;return function(_0x1438e7){if(_0x1438e7){return _0x2ce718[_0xb814('0x1c')](_0x3bde14);}return _0x2ce718[_0xb814('0x1d')](_0x3bde14)[_0xb814('0x1e')]();};}function respondWithResult(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xc8;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x1d')](_0x44fb96)[_0xb814('0x1f')](_0x17f5bd);}};}function respondWithFilteredResult(_0x3a71d6,_0x45e0d0){return function(_0x265a83){if(_0x265a83){var _0x125ce2=typeof _0x45e0d0[_0xb814('0x20')]===_0xb814('0x21')&&typeof _0x45e0d0['limit']===_0xb814('0x21');var _0x55ba16=_0x265a83[_0xb814('0x22')];var _0xfac75b=_0x125ce2?0x0:_0x45e0d0['offset'];var _0x4b55a7=_0x125ce2?_0x265a83['count']:_0x45e0d0[_0xb814('0x20')]+_0x45e0d0['limit'];var _0x57c128;if(_0x4b55a7>=_0x55ba16){_0x4b55a7=_0x55ba16;_0x57c128=0xc8;}else{_0x57c128=0xce;}_0x3a71d6[_0xb814('0x1d')](_0x57c128);return _0x3a71d6[_0xb814('0x23')](_0xb814('0x24'),_0xfac75b+'-'+_0x4b55a7+'/'+_0x55ba16)['json'](_0x265a83);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x25')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x26')](_0x1808a3);}return _0x531032[_0xb814('0x27')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x28')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x29')]()[_0xb814('0x28')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2a')]({'plain':!![]});var _0x5755ea=_0xb814('0x2b');return db[_0xb814('0x2c')][_0xb814('0x29')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x28')](function(){return _0x31c7ec;});})[_0xb814('0x28')](function(){_0x3f81d0[_0xb814('0x1d')](0xcc)[_0xb814('0x1e')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x1c')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x2d')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x2e')]){delete _0x37d24d[_0xb814('0x2e')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x2f')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x30')](db[_0xb814('0x31')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x32')],'type':_0x51d5ae[_0xb814('0x33')]['key']};});_0x419cd9[_0xb814('0x34')]=_[_0xb814('0x30')](_0x2431e2,_0xb814('0x2e'));_0x419cd9[_0xb814('0x35')]=_[_0xb814('0x36')](_0x6efe9a[_0xb814('0x35')]);_0x419cd9[_0xb814('0x37')]=_['intersection'](_0x419cd9[_0xb814('0x34')],_0x419cd9[_0xb814('0x35')]);_0x4cfc58[_0xb814('0x38')]=_[_0xb814('0x39')](_0x419cd9[_0xb814('0x34')],qs['fields'](_0x6efe9a[_0xb814('0x35')]['fields']));_0x4cfc58[_0xb814('0x38')]=_0x4cfc58[_0xb814('0x38')][_0xb814('0x3a')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x34')];if(!_0x6efe9a[_0xb814('0x35')]['hasOwnProperty'](_0xb814('0x3b'))){_0x4cfc58[_0xb814('0x3c')]=qs[_0xb814('0x3c')](_0x6efe9a[_0xb814('0x35')][_0xb814('0x3c')]);_0x4cfc58[_0xb814('0x20')]=qs['offset'](_0x6efe9a[_0xb814('0x35')]['offset']);}_0x4cfc58[_0xb814('0x3d')]=qs['sort'](_0x6efe9a[_0xb814('0x35')]['sort']);_0x4cfc58[_0xb814('0x3e')]=qs[_0xb814('0x37')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x3f')]){_0x4cfc58[_0xb814('0x3e')]=_[_0xb814('0x40')](_0x4cfc58[_0xb814('0x3e')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x33')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x2e')]]={'$like':'%'+_0x6efe9a[_0xb814('0x35')][_0xb814('0x3f')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x40')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x41')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x3e')]};return db[_0xb814('0x31')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x22')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x31')][_0xb814('0x43')](_0x4cfc58);})[_0xb814('0x28')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x28')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x44')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x45')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x46')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x34')]=_[_0xb814('0x36')](db[_0xb814('0x31')][_0xb814('0x47')]);_0x534eb8[_0xb814('0x35')]=_[_0xb814('0x36')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],_0x534eb8[_0xb814('0x35')]);_0x450a08[_0xb814('0x38')]=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],qs[_0xb814('0x48')](_0x22cf27[_0xb814('0x35')][_0xb814('0x48')]));_0x450a08[_0xb814('0x38')]=_0x450a08[_0xb814('0x38')]['length']?_0x450a08[_0xb814('0x38')]:_0x534eb8[_0xb814('0x34')];if(_0x22cf27['query'][_0xb814('0x42')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x40')]({},_0x450a08,_0x22cf27[_0xb814('0x41')]);return db[_0xb814('0x31')][_0xb814('0x49')](_0x450a08)[_0xb814('0x28')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x28')](respondWithResult(_0x7d92aa,null))[_0xb814('0x44')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4a')]=function(_0x32a397,_0x2a422a){return db['AnalyticDefaultReport']['create'](_0x32a397[_0xb814('0x4b')],{})[_0xb814('0x28')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x4c')][_0xb814('0x2a')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x4d'));if(_0x3f8e29['role']===_0xb814('0x4c')){var _0x388324=_0x4156d8[_0xb814('0x2a')]({'plain':!![]});var _0x5a916d=_0xb814('0x4e');return db['UserProfileSection'][_0xb814('0x49')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x28')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2c')][_0xb814('0x4a')]({'name':_0x388324[_0xb814('0x2e')],'resourceId':_0x388324['id'],'type':'DefaultReports','sectionId':_0x3cf8f8['id']},{})[_0xb814('0x28')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x28')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4b')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x31')]['find']({'where':{'id':_0x3b9709[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4b')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x44')](handleError(_0x35f59a,null));};exports[_0xb814('0x29')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x31')][_0xb814('0x49')]({'where':{'id':_0xb2bd82[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x44')](handleError(_0x113fe5,null));};exports[_0xb814('0x4f')]=function(_0x5d71d5,_0x29a127){var _0xe14249=0xa;var _0x4d13db=[_0xb814('0x50'),'left_join','right_join',_0xb814('0x51')];var _0x5257be={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb814('0x56'),'GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x176585={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x4d611d=function(_0x211194){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x211194);};var _0x52edfa=function(_0x135e13){if(!_0x135e13||!_0x135e13['rules'][_0xb814('0x3a')]){return'';}for(var _0x39b754='(',_0xac95cf=0x0;_0xac95cf<_0x135e13['rules'][_0xb814('0x3a')];_0xac95cf+=0x1){_0xac95cf>0x0&&(_0x39b754+='\x20'+_0x135e13['operator']+'\x20');_0x39b754+=_0x135e13[_0xb814('0x63')][_0xac95cf]['group']?_0x52edfa(_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x64')]):_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x65')]+'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x66')]+(_0x4d611d(_0x135e13[_0xb814('0x63')][_0xac95cf]['condition'])?'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf]['value']:'');}return _0x39b754+')';};var _0x255047={'where':{'id':_0x5d71d5['params']['id']}},_0x22c73f,_0x1b989d,_0x3dcaeb,_0x19fa45,_0x139531;_0x255047=_[_0xb814('0x40')]({},_0x255047,_0x5d71d5[_0xb814('0x41')]);return db['AnalyticDefaultReport'][_0xb814('0x49')](_0x255047)[_0xb814('0x28')](function(_0x263699){if(_0x263699){_0x22c73f=_0x263699;return _0x263699[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x51d834){if(_0x51d834){if(!_0x51d834[_0xb814('0x3a')]){throw new db['Sequelize'][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x1b989d=_0x51d834;return db[_0xb814('0x6a')][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x41bcaf){if(_0x41bcaf){_0x3dcaeb=_['keyBy'](_0x41bcaf,'id');var _0x506bf2;var _0x5d064b=squel[_0xb814('0x6b')]();_0x5d064b['from'](_0x22c73f[_0xb814('0x6c')]);for(var _0x1d3954=0x0;_0x1d3954<_0x1b989d[_0xb814('0x3a')];_0x1d3954+=0x1){_0x506bf2=_0x1b989d[_0x1d3954]['MetricId']?_0x3dcaeb[_0x1b989d[_0x1d3954][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x1b989d[_0x1d3954][_0xb814('0x65')];_0x506bf2=_0x1b989d[_0x1d3954]['function']?_[_0xb814('0x6f')](_0x5257be[_0x1b989d[_0x1d3954][_0xb814('0x70')]],'%s',_0x506bf2):_0x506bf2;_0x506bf2=_0x1b989d[_0x1d3954][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x176585[_0x1b989d[_0x1d3954]['format']],'%s',_0x506bf2):_0x506bf2;if(_0x1b989d[_0x1d3954]['groupBy']){_0x5d064b[_0xb814('0x64')](_0x506bf2);}_0x1b989d[_0x1d3954][_0xb814('0x72')]&&_0x5d064b[_0xb814('0x3d')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x5d064b[_0xb814('0x65')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x74')]||_0x506bf2);}if(_0x22c73f[_0xb814('0x75')]){_0x22c73f[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x22c73f[_0xb814('0x75')]);for(var _0x226b0e=0x0;_0x226b0e<_0x22c73f[_0xb814('0x75')][_0xb814('0x3a')];_0x226b0e+=0x1){if(_0x22c73f[_0xb814('0x75')][_0x226b0e]['type']&&_[_0xb814('0x5e')](_0x4d13db,_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')])&&_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')]&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignTable']&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignKey']){_0x5d064b[_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')]](_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],null,util[_0xb814('0x71')]('%s.%s\x20=\x20%s.%s',_0x22c73f['table'],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],_0x22c73f['joins'][_0x226b0e][_0xb814('0x79')]));}}}if(_0x22c73f['conditions']){_0x22c73f[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x22c73f['conditions']);_0x5d064b['where'](_0x52edfa(_0x22c73f[_0xb814('0x7a')]['group']));}_0x139531=_0x5d064b[_0xb814('0x7b')]();_0x5d064b[_0xb814('0x3c')](_0xe14249);_0x5d064b[_0xb814('0x20')](0x0);logger[_0xb814('0x7c')](_0xb814('0x7d'),_0x5d064b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')]['query'](_0x5d064b[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')]['SELECT']});}})[_0xb814('0x28')](respondWithResult(_0x29a127,null))[_0xb814('0x44')](handleError(_0x29a127,null));};function runReport(_0x58d56c,_0x10a90d,_0x583f26){var _0x37adec=_0x10a90d[_0xb814('0x2e')];var _0x4e15c2=0xa;var _0x5a0c4a=[_0xb814('0x50'),_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x51')];var _0x220f8b={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':_0xb814('0x83'),'MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52b6da={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1fb1ea=function(_0x31c072){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x31c072);};var _0x5cf5ad=function(_0x20efc3){if(!_0x20efc3||!_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x30faa0='(',_0x55ceb8=0x0;_0x55ceb8<_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')];_0x55ceb8+=0x1){_0x55ceb8>0x0&&(_0x30faa0+='\x20'+_0x20efc3[_0xb814('0x84')]+'\x20');_0x30faa0+=_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x64')]?_0x5cf5ad(_0x20efc3['rules'][_0x55ceb8]['group']):_0x20efc3[_0xb814('0x63')][_0x55ceb8]['field']+'\x20'+_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x66')]+(_0x1fb1ea(_0x20efc3['rules'][_0x55ceb8][_0xb814('0x66')])?'\x20'+_0x20efc3['rules'][_0x55ceb8][_0xb814('0x85')]:'');}return _0x30faa0+')';};var _0x520d0f={'where':{'id':_0x58d56c['id']}},_0x44e668,_0x1aff2b,_0x41867b,_0x2c3948,_0x2d8899;_0x520d0f=_[_0xb814('0x40')]({},_0x520d0f,_0x583f26);return db[_0xb814('0x31')]['find'](_0x520d0f)['then'](function(_0x21aa36){if(_0x21aa36){_0x44e668=_0x21aa36;return _0x21aa36['getFields']();}return null;})['then'](function(_0x2d0061){if(_0x2d0061){if(!_0x2d0061[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))]['ValidationErrorItem'](_0xb814('0x69'),0x193);}_0x1aff2b=_0x2d0061;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x14ec54){if(_0x14ec54){_0x41867b=_[_0xb814('0x87')](_0x14ec54,'id');var _0x4c8a00;var _0x1454b3=squel[_0xb814('0x6b')]();_0x1454b3[_0xb814('0x88')](_0x44e668['table']);for(var _0x1ebbf6=0x0;_0x1ebbf6<_0x1aff2b[_0xb814('0x3a')];_0x1ebbf6+=0x1){_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x6d')]?_0x41867b[_0x1aff2b[_0x1ebbf6]['MetricId']][_0xb814('0x6e')]:_0x1aff2b[_0x1ebbf6][_0xb814('0x65')];_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]?_[_0xb814('0x6f')](_0x220f8b[_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]],'%s',_0x4c8a00):_0x4c8a00;_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x52b6da[_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]],'%s',_0x4c8a00):_0x4c8a00;if(_0x1aff2b[_0x1ebbf6][_0xb814('0x89')]){_0x1454b3[_0xb814('0x64')](_0x4c8a00);}_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]&&_0x1454b3[_0xb814('0x3d')](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]==='DESC'?![]:!![]);_0x1454b3['field'](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x74')]||_0x4c8a00);}if(_0x44e668['joins']){_0x44e668[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x44e668[_0xb814('0x75')]);for(var _0x2bc95b=0x0;_0x2bc95b<_0x44e668[_0xb814('0x75')][_0xb814('0x3a')];_0x2bc95b+=0x1){if(_0x44e668[_0xb814('0x75')][_0x2bc95b]['type']&&_['includes'](_0x5a0c4a,_0x44e668[_0xb814('0x75')][_0x2bc95b]['type'])&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')]&&_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable']&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]){_0x1454b3[_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x33')]](_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],null,util[_0xb814('0x71')](_0xb814('0x8a'),_0x44e668['table'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')],_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]));}}}if(_0x44e668['conditions']){_0x44e668[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x44e668['conditions']);_0x1454b3[_0xb814('0x3e')](_0x5cf5ad(_0x44e668[_0xb814('0x7a')][_0xb814('0x64')]));}_0x2d8899=_0x1454b3[_0xb814('0x7b')]();_0x1454b3[_0xb814('0x3c')](_0x4e15c2);_0x1454b3[_0xb814('0x20')](0x0);return;}})[_0xb814('0x28')](function(){if(_0x10a90d[_0xb814('0x8b')]===_0xb814('0x8c')){return null;}var _0x1f8c7a=_[_0xb814('0x40')](_0x10a90d,{'name':_0x10a90d[_0xb814('0x8d')]||_0x10a90d['name']||_0x44e668['name'],'basename':_0x37adec,'savename':util[_0xb814('0x71')]('%s-%s.%s',_0x10a90d['name']||_0x44e668[_0xb814('0x2e')],require('randomstring')['generate'](0x4),_0x10a90d['output']||_0xb814('0x8e')),'reportId':_0x44e668['id'],'reportType':_0xb814('0x8f')});return db[_0xb814('0x90')]['create'](_0x1f8c7a,{'raw':!![]});})[_0xb814('0x28')](function(_0x4dbe89){if(_0x44e668[_0xb814('0x6c')]===_0xb814('0x91')){_0x2d8899['where'](_0x44e668[_0xb814('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}else{_0x2d8899[_0xb814('0x3e')](_0x44e668[_0xb814('0x6c')]+_0xb814('0x94'),_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}if(_0x4dbe89){logger[_0xb814('0x95')](_0xb814('0x96'),_0x2d8899[_0xb814('0x7e')]());require(_0xb814('0x97'))[_0xb814('0x98')](path[_0xb814('0x50')](__dirname,_0xb814('0x99'),_0x4dbe89[_0xb814('0x8b')]),[_0x4dbe89['id'],_0x2d8899['toString'](),path[_0xb814('0x50')](__dirname,_0xb814('0x9a'),_0x4dbe89['savename']),_0x37adec]);return _0x4dbe89;}else{var _0x2c7cd6=squel[_0xb814('0x6b')]();_0x2c7cd6[_0xb814('0x88')]('('+_0x2d8899['toString']()+')','countTable');_0x2c7cd6[_0xb814('0x65')]('COUNT(*)',_0xb814('0x22'));_0x2d8899['limit'](_0x10a90d[_0xb814('0x3c')]||_0x4e15c2);_0x2d8899['offset'](_0x10a90d['offset']||0x0);return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x2c7cd6[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]})[_0xb814('0x28')](function(_0x4543c3){if(!_0x4543c3[_0xb814('0x3a')]){_0x2c3948=0x0;}else{_0x2c3948=_0x4543c3[0x0][_0xb814('0x22')]||0x0;}return dbH[_0xb814('0x7f')]['query'](_0x2d8899[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')][_0xb814('0x9b')]});})[_0xb814('0x28')](function(_0x4fde6a){return{'rows':_0x4fde6a||[],'count':_0x2c3948};});}});}exports[_0xb814('0x9c')]=function(_0x18fb74,_0x371e92){return runReport(_0x18fb74[_0xb814('0x46')],_0x18fb74[_0xb814('0x35')],_0x18fb74[_0xb814('0x41')])[_0xb814('0x28')](respondWithResult(_0x371e92,null))[_0xb814('0x44')](handleError(_0x371e92,null));};exports[_0xb814('0x9d')]=runReport;exports[_0xb814('0x35')]=function(_0x3b65c0,_0x11e0c3){var _0x22c811=0xa;var _0x3fd24c=[_0xb814('0x50'),'left_join',_0xb814('0x82'),_0xb814('0x51')];var _0x3e61eb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x5be0bb={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1bd9ab=function(_0x20e608){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),'IS\x20NOT\x20EMPTY'],_0x20e608);};var _0x2a5dff=function(_0x553635){if(!_0x553635||!_0x553635[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x35e8f7='(',_0xa7ff62=0x0;_0xa7ff62<_0x553635[_0xb814('0x63')][_0xb814('0x3a')];_0xa7ff62+=0x1){_0xa7ff62>0x0&&(_0x35e8f7+='\x20'+_0x553635[_0xb814('0x84')]+'\x20');_0x35e8f7+=_0x553635[_0xb814('0x63')][_0xa7ff62]['group']?_0x2a5dff(_0x553635['rules'][_0xa7ff62]['group']):_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x65')]+'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')]+(_0x1bd9ab(_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')])?'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x85')]:'');}return _0x35e8f7+')';};var _0x41847e={'where':{'id':_0x3b65c0[_0xb814('0x46')]['id']}},_0x1a5685,_0x51313d,_0x5c989a,_0x41486b,_0x16c05b;_0x41847e=_[_0xb814('0x40')]({},_0x41847e,_0x3b65c0[_0xb814('0x41')]);return db[_0xb814('0x31')]['find'](_0x41847e)[_0xb814('0x28')](function(_0x52899a){if(_0x52899a){_0x1a5685=_0x52899a;return _0x52899a[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x205c6c){if(_0x205c6c){if(!_0x205c6c[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x51313d=_0x205c6c;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x1f04eb){if(_0x1f04eb){_0x5c989a=_[_0xb814('0x87')](_0x1f04eb,'id');var _0x4a1c4e;var _0x17c63b=squel[_0xb814('0x6b')]();_0x17c63b[_0xb814('0x88')](_0x1a5685[_0xb814('0x6c')]);for(var _0xa66ca3=0x0;_0xa66ca3<_0x51313d['length'];_0xa66ca3+=0x1){_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x6d')]?_0x5c989a[_0x51313d[_0xa66ca3][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x51313d[_0xa66ca3]['field'];_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x70')]?_['replace'](_0x3e61eb[_0x51313d[_0xa66ca3][_0xb814('0x70')]],'%s',_0x4a1c4e):_0x4a1c4e;_0x4a1c4e=_0x51313d[_0xa66ca3]['format']?_[_0xb814('0x6f')](_0x5be0bb[_0x51313d[_0xa66ca3][_0xb814('0x71')]],'%s',_0x4a1c4e):_0x4a1c4e;if(_0x51313d[_0xa66ca3][_0xb814('0x89')]){_0x17c63b[_0xb814('0x64')](_0x4a1c4e);}_0x51313d[_0xa66ca3]['orderBy']&&_0x17c63b[_0xb814('0x3d')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x17c63b[_0xb814('0x65')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x74')]||_0x4a1c4e);}if(_0x1a5685[_0xb814('0x75')]){_0x1a5685[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x75')]);for(var _0x152260=0x0;_0x152260<_0x1a5685[_0xb814('0x75')][_0xb814('0x3a')];_0x152260+=0x1){if(_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]&&_[_0xb814('0x5e')](_0x3fd24c,_0x1a5685['joins'][_0x152260][_0xb814('0x33')])&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')]&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')]&&_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']){_0x17c63b[_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]](_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1a5685[_0xb814('0x6c')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']));}}}if(_0x1a5685[_0xb814('0x7a')]){_0x1a5685[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x7a')]);_0x17c63b['where'](_0x2a5dff(_0x1a5685[_0xb814('0x7a')][_0xb814('0x64')]));}_0x16c05b=_0x17c63b[_0xb814('0x7b')]();_0x17c63b[_0xb814('0x3c')](_0x22c811);_0x17c63b[_0xb814('0x20')](0x0);logger['debug'](_0xb814('0x7d'),_0x17c63b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x17c63b[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]});}})[_0xb814('0x28')](function(){return{'sql':_0x16c05b[_0xb814('0x7e')]()};})[_0xb814('0x28')](respondWithResult(_0x11e0c3,null))[_0xb814('0x44')](handleError(_0x11e0c3,null));}; \ No newline at end of file +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(_0xb331b1,_0x1e66e6){var _0x1ba713=function(_0x26ab5e){while(--_0x26ab5e){_0xb331b1['push'](_0xb331b1['shift']());}};_0x1ba713(++_0x1e66e6);}(_0x1967,0x173));var _0x7196=function(_0x3a7497,_0x2a27a4){_0x3a7497=_0x3a7497-0x0;var _0x5b8342=_0x1967[_0x3a7497];return _0x5b8342;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 7f35440..da78ea2 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 _0x594f=['exports','define','AnalyticDefaultReport','lodash','util','../../config/logger','bluebird','path','./analyticDefaultReport.attributes'];(function(_0x3a76e4,_0x82586d){var _0x56fd7c=function(_0x5ab5af){while(--_0x5ab5af){_0x3a76e4['push'](_0x3a76e4['shift']());}};_0x56fd7c(++_0x82586d);}(_0x594f,0x78));var _0xf594=function(_0xb27b4b,_0x17546c){_0xb27b4b=_0xb27b4b-0x0;var _0x2dc7a9=_0x594f[_0xb27b4b];return _0x2dc7a9;};'use strict';var _=require(_0xf594('0x0'));var util=require(_0xf594('0x1'));var logger=require(_0xf594('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf594('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf594('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf594('0x5'));module[_0xf594('0x6')]=function(_0x3c25eb,_0x2303f4){return _0x3c25eb[_0xf594('0x7')](_0xf594('0x8'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1749=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x36edd2,_0x44c0b5){var _0x55bdb7=function(_0x12a3a7){while(--_0x12a3a7){_0x36edd2['push'](_0x36edd2['shift']());}};_0x55bdb7(++_0x44c0b5);}(_0x1749,0xba));var _0x9174=function(_0x4f5b11,_0x44a329){_0x4f5b11=_0x4f5b11-0x0;var _0x1d81a8=_0x1749[_0x4f5b11];return _0x1d81a8;};'use strict';var _=require(_0x9174('0x0'));var util=require(_0x9174('0x1'));var logger=require(_0x9174('0x2'))('api');var moment=require(_0x9174('0x3'));var BPromise=require(_0x9174('0x4'));var rp=require(_0x9174('0x5'));var fs=require('fs');var path=require(_0x9174('0x6'));var rimraf=require(_0x9174('0x7'));var config=require(_0x9174('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x9174('0x9')]=function(_0x85b92d,_0x185cd6){return _0x85b92d[_0x9174('0xa')](_0x9174('0xb'),attributes,{'tableName':_0x9174('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 5c85172..9eb36d2 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 _0x338c=['then','info','request\x20sent','debug','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x1dfdd5,_0x3e2af3){var _0x4524b6=function(_0x45a29b){while(--_0x45a29b){_0x1dfdd5['push'](_0x1dfdd5['shift']());}};_0x4524b6(++_0x3e2af3);}(_0x338c,0xf1));var _0xc338=function(_0x4ea1bb,_0x35efe8){_0x4ea1bb=_0x4ea1bb-0x0;var _0x2b6fab=_0x338c[_0x4ea1bb];return _0x2b6fab;};'use strict';var _=require(_0xc338('0x0'));var util=require('util');var moment=require(_0xc338('0x1'));var BPromise=require(_0xc338('0x2'));var rs=require(_0xc338('0x3'));var fs=require('fs');var Redis=require(_0xc338('0x4'));var db=require(_0xc338('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc338('0x6'))('rpc');var config=require(_0xc338('0x7'));var jayson=require(_0xc338('0x8'));var client=jayson[_0xc338('0x9')][_0xc338('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eaa24,_0x305e74,_0x10cad0){return new BPromise(function(_0x30f9cb,_0xd3d3a1){return client[_0xc338('0xb')](_0x1eaa24,_0x10cad0)[_0xc338('0xc')](function(_0x20da44){logger[_0xc338('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x305e74,_0xc338('0xe'));logger[_0xc338('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x305e74,'request\x20sent',JSON[_0xc338('0x10')](_0x20da44));if(_0x20da44[_0xc338('0x11')]){if(_0x20da44[_0xc338('0x11')][_0xc338('0x12')]===0x1f4){logger['error'](_0xc338('0x13'),_0x305e74,_0x20da44[_0xc338('0x11')][_0xc338('0x14')]);return _0xd3d3a1(_0x20da44[_0xc338('0x11')][_0xc338('0x14')]);}logger[_0xc338('0x11')](_0xc338('0x13'),_0x305e74,_0x20da44[_0xc338('0x11')]['message']);return _0x30f9cb(_0x20da44['error']['message']);}else{logger[_0xc338('0xd')](_0xc338('0x13'),_0x305e74,'request\x20sent');_0x30f9cb(_0x20da44[_0xc338('0x15')][_0xc338('0x14')]);}})[_0xc338('0x16')](function(_0x58cc19){logger[_0xc338('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x305e74,_0x58cc19);_0xd3d3a1(_0x58cc19);});});} \ No newline at end of file +var _0x5c1d=['code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xd988e6,_0x4f84fa){var _0x5b2947=function(_0x405a30){while(--_0x405a30){_0xd988e6['push'](_0xd988e6['shift']());}};_0x5b2947(++_0x4f84fa);}(_0x5c1d,0x1bb));var _0xd5c1=function(_0x7bb360,_0x1984aa){_0x7bb360=_0x7bb360-0x0;var _0x19f0a0=_0x5c1d[_0x7bb360];return _0x19f0a0;};'use strict';var _=require(_0xd5c1('0x0'));var util=require(_0xd5c1('0x1'));var moment=require(_0xd5c1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5c1('0x3'));var db=require(_0xd5c1('0x4'))['db'];var utils=require(_0xd5c1('0x5'));var logger=require('../../config/logger')(_0xd5c1('0x6'));var config=require('../../config/environment');var jayson=require(_0xd5c1('0x7'));var client=jayson[_0xd5c1('0x8')][_0xd5c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42798b,_0x819d2f,_0x258681){return new BPromise(function(_0x3983aa,_0x15ee50){return client[_0xd5c1('0xa')](_0x42798b,_0x258681)['then'](function(_0x4dfc26){logger[_0xd5c1('0xb')](_0xd5c1('0xc'),_0x819d2f,'request\x20sent');logger['debug'](_0xd5c1('0xd'),_0x819d2f,_0xd5c1('0xe'),JSON[_0xd5c1('0xf')](_0x4dfc26));if(_0x4dfc26[_0xd5c1('0x10')]){if(_0x4dfc26[_0xd5c1('0x10')][_0xd5c1('0x11')]===0x1f4){logger[_0xd5c1('0x10')](_0xd5c1('0xc'),_0x819d2f,_0x4dfc26[_0xd5c1('0x10')][_0xd5c1('0x12')]);return _0x15ee50(_0x4dfc26['error'][_0xd5c1('0x12')]);}logger['error'](_0xd5c1('0xc'),_0x819d2f,_0x4dfc26['error'][_0xd5c1('0x12')]);return _0x3983aa(_0x4dfc26['error'][_0xd5c1('0x12')]);}else{logger[_0xd5c1('0xb')](_0xd5c1('0xc'),_0x819d2f,_0xd5c1('0xe'));_0x3983aa(_0x4dfc26['result']['message']);}})[_0xd5c1('0x13')](function(_0x2f4a10){logger[_0xd5c1('0x10')](_0xd5c1('0xc'),_0x819d2f,_0x2f4a10);_0x15ee50(_0x2f4a10);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f6825bc..d279a74 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 _0x8c25=['../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','show','/:id/preview','preview','run','get','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x51ef6c,_0x1ecc7c){var _0x4ae3a5=function(_0x34b006){while(--_0x34b006){_0x51ef6c['push'](_0x51ef6c['shift']());}};_0x4ae3a5(++_0x1ecc7c);}(_0x8c25,0xe2));var _0x58c2=function(_0x5508a6,_0x41cb72){_0x5508a6=_0x5508a6-0x0;var _0x4660a1=_0x8c25[_0x5508a6];return _0x4660a1;};'use strict';var multer=require('multer');var util=require(_0x58c2('0x0'));var path=require('path');var timeout=require(_0x58c2('0x1'));var express=require(_0x58c2('0x2'));var router=express[_0x58c2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x58c2('0x4'));var config=require(_0x58c2('0x5'));var controller=require(_0x58c2('0x6'));router['get']('/',auth[_0x58c2('0x7')](),controller[_0x58c2('0x8')]);router['get']('/:id',auth[_0x58c2('0x7')](),controller[_0x58c2('0x9')]);router['get'](_0x58c2('0xa'),auth[_0x58c2('0x7')](),controller[_0x58c2('0xb')]);router['get']('/:id/run',auth[_0x58c2('0x7')](),controller[_0x58c2('0xc')]);router[_0x58c2('0xd')]('/:id/query',auth[_0x58c2('0x7')](),controller['query']);router['post']('/',auth[_0x58c2('0x7')](),controller[_0x58c2('0xe')]);router[_0x58c2('0xf')](_0x58c2('0x10'),auth[_0x58c2('0x7')](),controller[_0x58c2('0x11')]);router[_0x58c2('0x12')]('/:id',auth[_0x58c2('0x7')](),controller[_0x58c2('0x13')]);module[_0x58c2('0x14')]=router; \ No newline at end of file +var _0x08d4=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2f8ef3,_0xc96ff2){var _0x223a26=function(_0x22aa0a){while(--_0x22aa0a){_0x2f8ef3['push'](_0x2f8ef3['shift']());}};_0x223a26(++_0xc96ff2);}(_0x08d4,0x1af));var _0x408d=function(_0x402b42,_0x205681){_0x402b42=_0x402b42-0x0;var _0x1b4560=_0x08d4[_0x402b42];return _0x1b4560;};'use strict';var multer=require(_0x408d('0x0'));var util=require(_0x408d('0x1'));var path=require(_0x408d('0x2'));var timeout=require(_0x408d('0x3'));var express=require(_0x408d('0x4'));var router=express[_0x408d('0x5')]();var fs_extra=require(_0x408d('0x6'));var auth=require(_0x408d('0x7'));var interaction=require(_0x408d('0x8'));var config=require(_0x408d('0x9'));var controller=require('./analyticDefaultReport.controller');router[_0x408d('0xa')]('/',auth[_0x408d('0xb')](),controller[_0x408d('0xc')]);router[_0x408d('0xa')](_0x408d('0xd'),auth[_0x408d('0xb')](),controller[_0x408d('0xe')]);router[_0x408d('0xa')](_0x408d('0xf'),auth[_0x408d('0xb')](),controller[_0x408d('0x10')]);router['get']('/:id/run',auth[_0x408d('0xb')](),controller[_0x408d('0x11')]);router['get'](_0x408d('0x12'),auth['isAuthenticated'](),controller[_0x408d('0x13')]);router[_0x408d('0x14')]('/',auth[_0x408d('0xb')](),controller[_0x408d('0x15')]);router[_0x408d('0x16')]('/:id',auth[_0x408d('0xb')](),controller[_0x408d('0x17')]);router[_0x408d('0x18')](_0x408d('0xd'),auth[_0x408d('0xb')](),controller[_0x408d('0x19')]);module[_0x408d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f9ccae4..4b98df0 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 _0xe3f7=['sequelize','moment','STRING','pdf','xlsx','csv','DATE','Loading','ENUM','manual','scheduled','INTEGER'];(function(_0x38043c,_0x46d1ec){var _0x32088d=function(_0x56d01a){while(--_0x56d01a){_0x38043c['push'](_0x38043c['shift']());}};_0x32088d(++_0x46d1ec);}(_0xe3f7,0x1ec));var _0x7e3f=function(_0xfc2c73,_0x2a6325){_0xfc2c73=_0xfc2c73-0x0;var _0x2c0ba5=_0xe3f7[_0xfc2c73];return _0x2c0ba5;};'use strict';var Sequelize=require(_0x7e3f('0x0'));var moment=require(_0x7e3f('0x1'));module['exports']={'name':{'type':Sequelize[_0x7e3f('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x7e3f('0x3'),_0x7e3f('0x4')),'allowNull':![],'defaultValue':_0x7e3f('0x5')},'savename':{'type':Sequelize[_0x7e3f('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x7e3f('0x6')]},'status':{'type':Sequelize[_0x7e3f('0x2')],'defaultValue':_0x7e3f('0x7')},'type':{'type':Sequelize[_0x7e3f('0x8')](_0x7e3f('0x9'),_0x7e3f('0xa')),'allowNull':![],'defaultValue':_0x7e3f('0x9')},'reportId':{'type':Sequelize[_0x7e3f('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x7e3f('0x2')]}}; \ No newline at end of file +var _0x3e2c=['DATE','Loading','scheduled','manual','INTEGER','sequelize','moment','exports','STRING','ENUM','pdf','xlsx'];(function(_0x4a1315,_0x58b7d5){var _0x16125a=function(_0x4854f7){while(--_0x4854f7){_0x4a1315['push'](_0x4a1315['shift']());}};_0x16125a(++_0x58b7d5);}(_0x3e2c,0x1cd));var _0xc3e2=function(_0x486f8e,_0x52fb5f){_0x486f8e=_0x486f8e-0x0;var _0x528b66=_0x3e2c[_0x486f8e];return _0x528b66;};'use strict';var Sequelize=require(_0xc3e2('0x0'));var moment=require(_0xc3e2('0x1'));module[_0xc3e2('0x2')]={'name':{'type':Sequelize[_0xc3e2('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xc3e2('0x4')]('csv',_0xc3e2('0x5'),_0xc3e2('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xc3e2('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc3e2('0x7')]},'endDate':{'type':Sequelize[_0xc3e2('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xc3e2('0x8')},'type':{'type':Sequelize[_0xc3e2('0x4')]('manual',_0xc3e2('0x9')),'allowNull':![],'defaultValue':_0xc3e2('0xa')},'reportId':{'type':Sequelize[_0xc3e2('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xc3e2('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5e3c851..3693d97 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 _0xaf76=['sox','fs-extra','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','ExtractedReports','destroy','then','stack','name','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','%s.%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x123599,_0x374e14){var _0x3bf01d=function(_0x60b9bc){while(--_0x60b9bc){_0x123599['push'](_0x123599['shift']());}};_0x3bf01d(++_0x374e14);}(_0xaf76,0xb0));var _0x6af7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf76[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6af7('0x0'));var rimraf=require(_0x6af7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6af7('0x2'));var rp=require(_0x6af7('0x3'));var moment=require(_0x6af7('0x4'));var BPromise=require(_0x6af7('0x5'));var Mustache=require('mustache');var util=require(_0x6af7('0x6'));var path=require(_0x6af7('0x7'));var sox=require(_0x6af7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6af7('0x9'));var _=require(_0x6af7('0xa'));var squel=require('squel');var crypto=require(_0x6af7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6af7('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6af7('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6af7('0xe'));var hardwareService=require(_0x6af7('0xf'));var logger=require(_0x6af7('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x6af7('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x6af7('0x12'))['db'];function respondWithStatusCode(_0x22135d,_0x1c3604){_0x1c3604=_0x1c3604||0xcc;return function(_0x3d4301){if(_0x3d4301){return _0x22135d[_0x6af7('0x13')](_0x1c3604);}return _0x22135d[_0x6af7('0x14')](_0x1c3604)[_0x6af7('0x15')]();};}function respondWithResult(_0x447ccf,_0x1f4eef){_0x1f4eef=_0x1f4eef||0xc8;return function(_0x507372){if(_0x507372){return _0x447ccf['status'](_0x1f4eef)[_0x6af7('0x16')](_0x507372);}};}function respondWithFilteredResult(_0x3a94a4,_0x4e7f76){return function(_0x432896){if(_0x432896){var _0x3fa345=typeof _0x4e7f76[_0x6af7('0x17')]===_0x6af7('0x18')&&typeof _0x4e7f76[_0x6af7('0x19')]===_0x6af7('0x18');var _0x57d79d=_0x432896[_0x6af7('0x1a')];var _0x351fdb=_0x3fa345?0x0:_0x4e7f76[_0x6af7('0x17')];var _0x495c75=_0x3fa345?_0x432896[_0x6af7('0x1a')]:_0x4e7f76[_0x6af7('0x17')]+_0x4e7f76[_0x6af7('0x19')];var _0x4a071a;if(_0x495c75>=_0x57d79d){_0x495c75=_0x57d79d;_0x4a071a=0xc8;}else{_0x4a071a=0xce;}_0x3a94a4[_0x6af7('0x14')](_0x4a071a);return _0x3a94a4[_0x6af7('0x1b')]('Content-Range',_0x351fdb+'-'+_0x495c75+'/'+_0x57d79d)[_0x6af7('0x16')](_0x432896);}return null;};}function patchUpdates(_0x50e996){return function(_0x499567){try{jsonpatch[_0x6af7('0x1c')](_0x499567,_0x50e996,!![]);}catch(_0x202e4c){return BPromise[_0x6af7('0x1d')](_0x202e4c);}return _0x499567[_0x6af7('0x1e')]();};}function saveUpdates(_0x54ecdf,_0x3b550d){return function(_0x23e8b5){if(_0x23e8b5){return _0x23e8b5[_0x6af7('0x1f')](_0x54ecdf)['then'](function(_0xb93ce2){return _0xb93ce2;});}return null;};}function removeEntity(_0xd8eb5b,_0x1243d6){return function(_0x38b97c){if(_0x38b97c){return _0x38b97c['destroy']()['then'](function(){var _0x32642f=_0x38b97c['get']({'plain':!![]});var _0x40c380=_0x6af7('0x20');return db['UserProfileResource'][_0x6af7('0x21')]({'where':{'type':_0x40c380,'resourceId':_0x32642f['id']}})['then'](function(){return _0x38b97c;});})[_0x6af7('0x22')](function(){_0xd8eb5b[_0x6af7('0x14')](0xcc)[_0x6af7('0x15')]();});}};}function handleEntityNotFound(_0x15d50d,_0x262654){return function(_0x46e99f){if(!_0x46e99f){_0x15d50d[_0x6af7('0x13')](0x194);}return _0x46e99f;};}function handleError(_0x57023e,_0x7b6191){_0x7b6191=_0x7b6191||0x1f4;return function(_0x435cc6){logger['error'](_0x435cc6[_0x6af7('0x23')]);if(_0x435cc6[_0x6af7('0x24')]){delete _0x435cc6[_0x6af7('0x24')];}_0x57023e[_0x6af7('0x14')](_0x7b6191)['send'](_0x435cc6);};}exports[_0x6af7('0x25')]=function(_0x3304a3,_0x1adb71){var _0x1648f5={},_0x489c22={},_0xf562fe={'count':0x0,'rows':[]};var _0x26ace8=_[_0x6af7('0x26')](db[_0x6af7('0x27')]['rawAttributes'],function(_0x56a35b){return{'name':_0x56a35b[_0x6af7('0x28')],'type':_0x56a35b[_0x6af7('0x29')][_0x6af7('0x2a')]};});_0x489c22[_0x6af7('0x2b')]=_[_0x6af7('0x26')](_0x26ace8,_0x6af7('0x24'));_0x489c22[_0x6af7('0x2c')]=_[_0x6af7('0x2d')](_0x3304a3[_0x6af7('0x2c')]);_0x489c22[_0x6af7('0x2e')]=_['intersection'](_0x489c22['model'],_0x489c22[_0x6af7('0x2c')]);_0x1648f5[_0x6af7('0x2f')]=_[_0x6af7('0x30')](_0x489c22['model'],qs[_0x6af7('0x31')](_0x3304a3['query'][_0x6af7('0x31')]));_0x1648f5[_0x6af7('0x2f')]=_0x1648f5[_0x6af7('0x2f')][_0x6af7('0x32')]?_0x1648f5[_0x6af7('0x2f')]:_0x489c22['model'];if(!_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x33')](_0x6af7('0x34'))){_0x1648f5[_0x6af7('0x19')]=qs[_0x6af7('0x19')](_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x19')]);_0x1648f5[_0x6af7('0x17')]=qs[_0x6af7('0x17')](_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x17')]);}_0x1648f5[_0x6af7('0x35')]=qs[_0x6af7('0x36')](_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x36')]);_0x1648f5[_0x6af7('0x37')]=qs[_0x6af7('0x2e')](_[_0x6af7('0x38')](_0x3304a3[_0x6af7('0x2c')],_0x489c22[_0x6af7('0x2e')]),_0x26ace8);if(_0x3304a3['query'][_0x6af7('0x39')]){_0x1648f5['where']=_[_0x6af7('0x3a')](_0x1648f5[_0x6af7('0x37')],{'$or':_[_0x6af7('0x26')](_0x26ace8,function(_0x10cda5){if(_0x10cda5['type']!=='VIRTUAL'){var _0x106fa5={};_0x106fa5[_0x10cda5[_0x6af7('0x24')]]={'$like':'%'+_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x39')]+'%'};return _0x106fa5;}})});}_0x1648f5=_[_0x6af7('0x3a')]({},_0x1648f5,_0x3304a3[_0x6af7('0x3b')]);var _0x37a6bd={'where':_0x1648f5[_0x6af7('0x37')]};return db[_0x6af7('0x27')][_0x6af7('0x1a')](_0x37a6bd)[_0x6af7('0x22')](function(_0x2426b5){_0xf562fe[_0x6af7('0x1a')]=_0x2426b5;if(_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x3c')]){_0x1648f5['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x6af7('0x3d')](_0x1648f5);})[_0x6af7('0x22')](function(_0x193cc4){_0xf562fe[_0x6af7('0x3e')]=_0x193cc4;return _0xf562fe;})['then'](respondWithFilteredResult(_0x1adb71,_0x1648f5))[_0x6af7('0x3f')](handleError(_0x1adb71,null));};exports[_0x6af7('0x40')]=function(_0x335c51,_0x1a4515){var _0x45bb37={'raw':!![],'where':{'id':_0x335c51[_0x6af7('0x41')]['id']}},_0x1d5a76={};_0x1d5a76[_0x6af7('0x2b')]=_[_0x6af7('0x2d')](db[_0x6af7('0x27')]['rawAttributes']);_0x1d5a76[_0x6af7('0x2c')]=_[_0x6af7('0x2d')](_0x335c51['query']);_0x1d5a76[_0x6af7('0x2e')]=_['intersection'](_0x1d5a76['model'],_0x1d5a76[_0x6af7('0x2c')]);_0x45bb37[_0x6af7('0x2f')]=_[_0x6af7('0x30')](_0x1d5a76[_0x6af7('0x2b')],qs[_0x6af7('0x31')](_0x335c51[_0x6af7('0x2c')][_0x6af7('0x31')]));_0x45bb37[_0x6af7('0x2f')]=_0x45bb37[_0x6af7('0x2f')][_0x6af7('0x32')]?_0x45bb37[_0x6af7('0x2f')]:_0x1d5a76[_0x6af7('0x2b')];if(_0x335c51[_0x6af7('0x2c')][_0x6af7('0x3c')]){_0x45bb37[_0x6af7('0x42')]=[{'all':!![]}];}_0x45bb37=_[_0x6af7('0x3a')]({},_0x45bb37,_0x335c51['options']);return db['AnalyticExtractedReport'][_0x6af7('0x43')](_0x45bb37)['then'](handleEntityNotFound(_0x1a4515,null))[_0x6af7('0x22')](respondWithResult(_0x1a4515,null))[_0x6af7('0x3f')](handleError(_0x1a4515,null));};exports[_0x6af7('0x44')]=function(_0x4e73c9,_0x3f738f){return db[_0x6af7('0x27')][_0x6af7('0x44')](_0x4e73c9[_0x6af7('0x45')],{})[_0x6af7('0x22')](function(_0x4e0e50){var _0x43ccf5=_0x4e73c9['user']['get']({'plain':!![]});if(!_0x43ccf5)throw new Error(_0x6af7('0x46'));if(_0x43ccf5[_0x6af7('0x47')]===_0x6af7('0x48')){var _0x3c737d=_0x4e0e50[_0x6af7('0x49')]({'plain':!![]});var _0x59ffbc='ExtractedReports';return db[_0x6af7('0x4a')][_0x6af7('0x43')]({'where':{'name':_0x59ffbc,'userProfileId':_0x43ccf5[_0x6af7('0x4b')]},'raw':!![]})[_0x6af7('0x22')](function(_0x332a60){if(_0x332a60&&_0x332a60[_0x6af7('0x4c')]===0x0){return db[_0x6af7('0x4d')]['create']({'name':_0x3c737d[_0x6af7('0x24')],'resourceId':_0x3c737d['id'],'type':_0x332a60[_0x6af7('0x24')],'sectionId':_0x332a60['id']},{})[_0x6af7('0x22')](function(){return _0x4e0e50;});}else{return _0x4e0e50;}})[_0x6af7('0x3f')](function(_0x3acb42){logger[_0x6af7('0x4e')](_0x6af7('0x4f'),_0x3acb42);throw _0x3acb42;});}return _0x4e0e50;})[_0x6af7('0x22')](respondWithResult(_0x3f738f,0xc9))[_0x6af7('0x3f')](handleError(_0x3f738f,null));};exports[_0x6af7('0x1f')]=function(_0xaf09b1,_0x36528f){if(_0xaf09b1[_0x6af7('0x45')]['id']){delete _0xaf09b1['body']['id'];}return db[_0x6af7('0x27')][_0x6af7('0x43')]({'where':{'id':_0xaf09b1[_0x6af7('0x41')]['id']}})['then'](handleEntityNotFound(_0x36528f,null))[_0x6af7('0x22')](saveUpdates(_0xaf09b1['body'],null))['then'](respondWithResult(_0x36528f,null))[_0x6af7('0x3f')](handleError(_0x36528f,null));};exports[_0x6af7('0x21')]=function(_0x24534a,_0x1e7e73){return db[_0x6af7('0x27')][_0x6af7('0x43')]({'where':{'id':_0x24534a[_0x6af7('0x41')]['id']}})[_0x6af7('0x22')](handleEntityNotFound(_0x1e7e73,null))[_0x6af7('0x22')](removeEntity(_0x1e7e73,null))[_0x6af7('0x3f')](handleError(_0x1e7e73,null));};exports[_0x6af7('0x50')]=function(_0x584c14,_0x423e86,_0x21e1cb){return db[_0x6af7('0x27')][_0x6af7('0x43')]({'where':{'id':_0x584c14[_0x6af7('0x41')]['id']},'attributes':[_0x6af7('0x24'),_0x6af7('0x51'),_0x6af7('0x52'),'output'],'raw':!![]})[_0x6af7('0x22')](handleEntityNotFound(_0x423e86,null))['then'](function(_0x3e2a4e){if(_0x3e2a4e){if(!fs[_0x6af7('0x53')](path[_0x6af7('0x54')](config[_0x6af7('0x55')],'server/files/reports',_0x3e2a4e[_0x6af7('0x52')]))){throw new db[(_0x6af7('0x56'))][(_0x6af7('0x57'))](_0x6af7('0x58'));}if(_0x584c14[_0x6af7('0x2c')][_0x6af7('0x59')]){return _0x423e86[_0x6af7('0x13')](0xc8);}return _0x423e86[_0x6af7('0x50')](path[_0x6af7('0x54')](config[_0x6af7('0x55')],_0x6af7('0x5a'),_0x3e2a4e['savename']),util['format'](_0x6af7('0x5b'),_0x3e2a4e[_0x6af7('0x51')]||_0x3e2a4e[_0x6af7('0x24')],_0x3e2a4e['output']['toLowerCase']()));}})[_0x6af7('0x3f')](handleError(_0x423e86,null));}; \ No newline at end of file +var _0x7759=['AnalyticExtractedReport','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','savename','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','index','map'];(function(_0x451353,_0x19710b){var _0x102315=function(_0x51204c){while(--_0x51204c){_0x451353['push'](_0x451353['shift']());}};_0x102315(++_0x19710b);}(_0x7759,0x194));var _0x9775=function(_0x22662a,_0x1cbd57){_0x22662a=_0x22662a-0x0;var _0x2aba64=_0x7759[_0x22662a];return _0x2aba64;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9775('0x0'));var zipdir=require(_0x9775('0x1'));var jsonpatch=require(_0x9775('0x2'));var rp=require(_0x9775('0x3'));var moment=require('moment');var BPromise=require(_0x9775('0x4'));var Mustache=require(_0x9775('0x5'));var util=require(_0x9775('0x6'));var path=require(_0x9775('0x7'));var sox=require('sox');var csv=require(_0x9775('0x8'));var ejs=require(_0x9775('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9775('0xa'));var squel=require(_0x9775('0xb'));var crypto=require(_0x9775('0xc'));var jsforce=require(_0x9775('0xd'));var deskjs=require(_0x9775('0xe'));var toCsv=require(_0x9775('0x8'));var querystring=require(_0x9775('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9775('0x10'));var qs=require(_0x9775('0x11'));var as=require(_0x9775('0x12'));var hardwareService=require(_0x9775('0x13'));var logger=require(_0x9775('0x14'))('api');var utils=require(_0x9775('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9775('0x16'));var db=require(_0x9775('0x17'))['db'];function respondWithStatusCode(_0x5b6809,_0xd1c228){_0xd1c228=_0xd1c228||0xcc;return function(_0x282fb5){if(_0x282fb5){return _0x5b6809[_0x9775('0x18')](_0xd1c228);}return _0x5b6809['status'](_0xd1c228)[_0x9775('0x19')]();};}function respondWithResult(_0x253102,_0x4bb0cd){_0x4bb0cd=_0x4bb0cd||0xc8;return function(_0x636671){if(_0x636671){return _0x253102[_0x9775('0x1a')](_0x4bb0cd)[_0x9775('0x1b')](_0x636671);}};}function respondWithFilteredResult(_0x47e5fa,_0x2483f9){return function(_0x584f82){if(_0x584f82){var _0x426fc5=typeof _0x2483f9[_0x9775('0x1c')]===_0x9775('0x1d')&&typeof _0x2483f9[_0x9775('0x1e')]===_0x9775('0x1d');var _0x307af3=_0x584f82[_0x9775('0x1f')];var _0x532fc8=_0x426fc5?0x0:_0x2483f9[_0x9775('0x1c')];var _0x2320e0=_0x426fc5?_0x584f82['count']:_0x2483f9[_0x9775('0x1c')]+_0x2483f9[_0x9775('0x1e')];var _0x1ed595;if(_0x2320e0>=_0x307af3){_0x2320e0=_0x307af3;_0x1ed595=0xc8;}else{_0x1ed595=0xce;}_0x47e5fa[_0x9775('0x1a')](_0x1ed595);return _0x47e5fa[_0x9775('0x20')]('Content-Range',_0x532fc8+'-'+_0x2320e0+'/'+_0x307af3)['json'](_0x584f82);}return null;};}function patchUpdates(_0x38cf19){return function(_0x448f4b){try{jsonpatch['apply'](_0x448f4b,_0x38cf19,!![]);}catch(_0x4d004e){return BPromise[_0x9775('0x21')](_0x4d004e);}return _0x448f4b[_0x9775('0x22')]();};}function saveUpdates(_0x428b48,_0x5a280f){return function(_0x28d255){if(_0x28d255){return _0x28d255[_0x9775('0x23')](_0x428b48)[_0x9775('0x24')](function(_0x5d948a){return _0x5d948a;});}return null;};}function removeEntity(_0x4c1042,_0xfd46de){return function(_0x2247b1){if(_0x2247b1){return _0x2247b1[_0x9775('0x25')]()[_0x9775('0x24')](function(){var _0x9bd5a8=_0x2247b1[_0x9775('0x26')]({'plain':!![]});var _0x2517a4=_0x9775('0x27');return db[_0x9775('0x28')]['destroy']({'where':{'type':_0x2517a4,'resourceId':_0x9bd5a8['id']}})[_0x9775('0x24')](function(){return _0x2247b1;});})['then'](function(){_0x4c1042[_0x9775('0x1a')](0xcc)[_0x9775('0x19')]();});}};}function handleEntityNotFound(_0x5f409e,_0x8806a6){return function(_0x57af3d){if(!_0x57af3d){_0x5f409e[_0x9775('0x18')](0x194);}return _0x57af3d;};}function handleError(_0x1b8d84,_0x173f2b){_0x173f2b=_0x173f2b||0x1f4;return function(_0x1f385b){logger[_0x9775('0x29')](_0x1f385b[_0x9775('0x2a')]);if(_0x1f385b[_0x9775('0x2b')]){delete _0x1f385b['name'];}_0x1b8d84['status'](_0x173f2b)['send'](_0x1f385b);};}exports[_0x9775('0x2c')]=function(_0x5c5751,_0x5e7f1f){var _0x366530={},_0x573909={},_0x3971ef={'count':0x0,'rows':[]};var _0x114b91=_[_0x9775('0x2d')](db[_0x9775('0x2e')][_0x9775('0x2f')],function(_0x55726d){return{'name':_0x55726d['fieldName'],'type':_0x55726d[_0x9775('0x30')][_0x9775('0x31')]};});_0x573909[_0x9775('0x32')]=_[_0x9775('0x2d')](_0x114b91,_0x9775('0x2b'));_0x573909['query']=_[_0x9775('0x33')](_0x5c5751[_0x9775('0x34')]);_0x573909['filters']=_[_0x9775('0x35')](_0x573909[_0x9775('0x32')],_0x573909['query']);_0x366530[_0x9775('0x36')]=_[_0x9775('0x35')](_0x573909[_0x9775('0x32')],qs[_0x9775('0x37')](_0x5c5751[_0x9775('0x34')][_0x9775('0x37')]));_0x366530[_0x9775('0x36')]=_0x366530['attributes'][_0x9775('0x38')]?_0x366530['attributes']:_0x573909[_0x9775('0x32')];if(!_0x5c5751['query']['hasOwnProperty'](_0x9775('0x39'))){_0x366530[_0x9775('0x1e')]=qs[_0x9775('0x1e')](_0x5c5751[_0x9775('0x34')][_0x9775('0x1e')]);_0x366530[_0x9775('0x1c')]=qs[_0x9775('0x1c')](_0x5c5751[_0x9775('0x34')][_0x9775('0x1c')]);}_0x366530['order']=qs[_0x9775('0x3a')](_0x5c5751[_0x9775('0x34')]['sort']);_0x366530['where']=qs[_0x9775('0x3b')](_['pick'](_0x5c5751[_0x9775('0x34')],_0x573909[_0x9775('0x3b')]),_0x114b91);if(_0x5c5751[_0x9775('0x34')][_0x9775('0x3c')]){_0x366530[_0x9775('0x3d')]=_[_0x9775('0x3e')](_0x366530[_0x9775('0x3d')],{'$or':_[_0x9775('0x2d')](_0x114b91,function(_0x30fa76){if(_0x30fa76[_0x9775('0x30')]!==_0x9775('0x3f')){var _0x2466dc={};_0x2466dc[_0x30fa76['name']]={'$like':'%'+_0x5c5751[_0x9775('0x34')][_0x9775('0x3c')]+'%'};return _0x2466dc;}})});}_0x366530=_[_0x9775('0x3e')]({},_0x366530,_0x5c5751[_0x9775('0x40')]);var _0x582ee2={'where':_0x366530[_0x9775('0x3d')]};return db[_0x9775('0x2e')]['count'](_0x582ee2)[_0x9775('0x24')](function(_0x2df0ce){_0x3971ef['count']=_0x2df0ce;if(_0x5c5751[_0x9775('0x34')][_0x9775('0x41')]){_0x366530[_0x9775('0x42')]=[{'all':!![]}];}return db[_0x9775('0x2e')]['findAll'](_0x366530);})[_0x9775('0x24')](function(_0x5c8031){_0x3971ef[_0x9775('0x43')]=_0x5c8031;return _0x3971ef;})['then'](respondWithFilteredResult(_0x5e7f1f,_0x366530))[_0x9775('0x44')](handleError(_0x5e7f1f,null));};exports[_0x9775('0x45')]=function(_0x4e858f,_0x4891db){var _0xcc1c42={'raw':!![],'where':{'id':_0x4e858f[_0x9775('0x46')]['id']}},_0x395970={};_0x395970[_0x9775('0x32')]=_['keys'](db['AnalyticExtractedReport'][_0x9775('0x2f')]);_0x395970[_0x9775('0x34')]=_[_0x9775('0x33')](_0x4e858f[_0x9775('0x34')]);_0x395970[_0x9775('0x3b')]=_[_0x9775('0x35')](_0x395970['model'],_0x395970[_0x9775('0x34')]);_0xcc1c42['attributes']=_[_0x9775('0x35')](_0x395970[_0x9775('0x32')],qs[_0x9775('0x37')](_0x4e858f['query'][_0x9775('0x37')]));_0xcc1c42[_0x9775('0x36')]=_0xcc1c42[_0x9775('0x36')][_0x9775('0x38')]?_0xcc1c42[_0x9775('0x36')]:_0x395970['model'];if(_0x4e858f['query'][_0x9775('0x41')]){_0xcc1c42[_0x9775('0x42')]=[{'all':!![]}];}_0xcc1c42=_['merge']({},_0xcc1c42,_0x4e858f[_0x9775('0x40')]);return db[_0x9775('0x2e')][_0x9775('0x47')](_0xcc1c42)[_0x9775('0x24')](handleEntityNotFound(_0x4891db,null))['then'](respondWithResult(_0x4891db,null))['catch'](handleError(_0x4891db,null));};exports[_0x9775('0x48')]=function(_0x10c69f,_0x383eb9){return db['AnalyticExtractedReport'][_0x9775('0x48')](_0x10c69f[_0x9775('0x49')],{})[_0x9775('0x24')](function(_0x1dd075){var _0xa1687d=_0x10c69f[_0x9775('0x4a')][_0x9775('0x26')]({'plain':!![]});if(!_0xa1687d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa1687d[_0x9775('0x4b')]===_0x9775('0x4a')){var _0x527546=_0x1dd075[_0x9775('0x26')]({'plain':!![]});var _0x57e073=_0x9775('0x27');return db[_0x9775('0x4c')][_0x9775('0x47')]({'where':{'name':_0x57e073,'userProfileId':_0xa1687d[_0x9775('0x4d')]},'raw':!![]})[_0x9775('0x24')](function(_0x2cf963){if(_0x2cf963&&_0x2cf963['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x527546[_0x9775('0x2b')],'resourceId':_0x527546['id'],'type':_0x2cf963['name'],'sectionId':_0x2cf963['id']},{})[_0x9775('0x24')](function(){return _0x1dd075;});}else{return _0x1dd075;}})['catch'](function(_0x50dbb0){logger['error'](_0x9775('0x4e'),_0x50dbb0);throw _0x50dbb0;});}return _0x1dd075;})[_0x9775('0x24')](respondWithResult(_0x383eb9,0xc9))['catch'](handleError(_0x383eb9,null));};exports['update']=function(_0x236004,_0x275f00){if(_0x236004['body']['id']){delete _0x236004[_0x9775('0x49')]['id'];}return db[_0x9775('0x2e')][_0x9775('0x47')]({'where':{'id':_0x236004[_0x9775('0x46')]['id']}})[_0x9775('0x24')](handleEntityNotFound(_0x275f00,null))[_0x9775('0x24')](saveUpdates(_0x236004[_0x9775('0x49')],null))[_0x9775('0x24')](respondWithResult(_0x275f00,null))[_0x9775('0x44')](handleError(_0x275f00,null));};exports[_0x9775('0x25')]=function(_0x3bc5f1,_0x1159ff){return db[_0x9775('0x2e')][_0x9775('0x47')]({'where':{'id':_0x3bc5f1[_0x9775('0x46')]['id']}})[_0x9775('0x24')](handleEntityNotFound(_0x1159ff,null))[_0x9775('0x24')](removeEntity(_0x1159ff,null))[_0x9775('0x44')](handleError(_0x1159ff,null));};exports[_0x9775('0x4f')]=function(_0x1b3f96,_0xee0fc0,_0x53fa5d){return db[_0x9775('0x2e')][_0x9775('0x47')]({'where':{'id':_0x1b3f96[_0x9775('0x46')]['id']},'attributes':[_0x9775('0x2b'),_0x9775('0x50'),'savename',_0x9775('0x51')],'raw':!![]})[_0x9775('0x24')](handleEntityNotFound(_0xee0fc0,null))[_0x9775('0x24')](function(_0x1403ff){if(_0x1403ff){if(!fs[_0x9775('0x52')](path['join'](config[_0x9775('0x53')],_0x9775('0x54'),_0x1403ff['savename']))){throw new db['Sequelize'][(_0x9775('0x55'))](_0x9775('0x56'));}if(_0x1b3f96[_0x9775('0x34')][_0x9775('0x57')]){return _0xee0fc0['sendStatus'](0xc8);}return _0xee0fc0[_0x9775('0x4f')](path['join'](config[_0x9775('0x53')],'server/files/reports',_0x1403ff[_0x9775('0x58')]),util['format']('%s.%s',_0x1403ff[_0x9775('0x50')]||_0x1403ff[_0x9775('0x2b')],_0x1403ff[_0x9775('0x51')][_0x9775('0x59')]()));}})['catch'](handleError(_0xee0fc0,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d3abc2b..4de52ac 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 _0xa02f=['analytics_extracted_reports','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x998637,_0x16e418){var _0x32e308=function(_0x4ad169){while(--_0x4ad169){_0x998637['push'](_0x998637['shift']());}};_0x32e308(++_0x16e418);}(_0xa02f,0xbc));var _0xfa02=function(_0x427bee,_0x173029){_0x427bee=_0x427bee-0x0;var _0x1d7f7a=_0xa02f[_0x427bee];return _0x1d7f7a;};'use strict';var _=require(_0xfa02('0x0'));var util=require(_0xfa02('0x1'));var logger=require(_0xfa02('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfa02('0x3'));var rp=require(_0xfa02('0x4'));var fs=require('fs');var path=require(_0xfa02('0x5'));var rimraf=require(_0xfa02('0x6'));var config=require(_0xfa02('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0xfa02('0x8')]=function(_0x492275,_0x19af77){return _0x492275[_0xfa02('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0xfa02('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10da=['exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./analyticExtractedReport.attributes'];(function(_0x3854e6,_0x45df01){var _0x1ee60d=function(_0x569ec0){while(--_0x569ec0){_0x3854e6['push'](_0x3854e6['shift']());}};_0x1ee60d(++_0x45df01);}(_0x10da,0x1b0));var _0xa10d=function(_0x48912e,_0x2276f4){_0x48912e=_0x48912e-0x0;var _0x4d00c2=_0x10da[_0x48912e];return _0x4d00c2;};'use strict';var _=require(_0xa10d('0x0'));var util=require(_0xa10d('0x1'));var logger=require(_0xa10d('0x2'))(_0xa10d('0x3'));var moment=require('moment');var BPromise=require(_0xa10d('0x4'));var rp=require(_0xa10d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa10d('0x6'));var config=require('../../config/environment');var attributes=require(_0xa10d('0x7'));module[_0xa10d('0x8')]=function(_0x398681,_0x1443b8){return _0x398681[_0xa10d('0x9')](_0xa10d('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 27060ef..de852df 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 _0x8748=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x52ab80,_0x3878bd){var _0x3ba0bb=function(_0x362694){while(--_0x362694){_0x52ab80['push'](_0x52ab80['shift']());}};_0x3ba0bb(++_0x3878bd);}(_0x8748,0x9e));var _0x8874=function(_0x1d2323,_0x2b56f1){_0x1d2323=_0x1d2323-0x0;var _0x36cdd8=_0x8748[_0x1d2323];return _0x36cdd8;};'use strict';var _=require(_0x8874('0x0'));var util=require(_0x8874('0x1'));var moment=require(_0x8874('0x2'));var BPromise=require(_0x8874('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8874('0x4'));var db=require(_0x8874('0x5'))['db'];var utils=require(_0x8874('0x6'));var logger=require(_0x8874('0x7'))(_0x8874('0x8'));var config=require(_0x8874('0x9'));var jayson=require(_0x8874('0xa'));var client=jayson['client'][_0x8874('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b372a,_0x1f57b3,_0x482f29){return new BPromise(function(_0x548467,_0x424872){return client['request'](_0x5b372a,_0x482f29)[_0x8874('0xc')](function(_0x21b54d){logger[_0x8874('0xd')](_0x8874('0xe'),_0x1f57b3,_0x8874('0xf'));logger[_0x8874('0x10')](_0x8874('0x11'),_0x1f57b3,_0x8874('0xf'),JSON[_0x8874('0x12')](_0x21b54d));if(_0x21b54d[_0x8874('0x13')]){if(_0x21b54d[_0x8874('0x13')][_0x8874('0x14')]===0x1f4){logger[_0x8874('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1f57b3,_0x21b54d[_0x8874('0x13')][_0x8874('0x15')]);return _0x424872(_0x21b54d['error'][_0x8874('0x15')]);}logger['error'](_0x8874('0xe'),_0x1f57b3,_0x21b54d[_0x8874('0x13')][_0x8874('0x15')]);return _0x548467(_0x21b54d[_0x8874('0x13')]['message']);}else{logger[_0x8874('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1f57b3,_0x8874('0xf'));_0x548467(_0x21b54d[_0x8874('0x16')][_0x8874('0x15')]);}})['catch'](function(_0x1b0501){logger['error'](_0x8874('0xe'),_0x1f57b3,_0x1b0501);_0x424872(_0x1b0501);});});} \ No newline at end of file +var _0xa153=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xa153,0x85));var _0x3a15=function(_0xf8bfc3,_0x29cf48){_0xf8bfc3=_0xf8bfc3-0x0;var _0x4d7a6b=_0xa153[_0xf8bfc3];return _0x4d7a6b;};'use strict';var _=require(_0x3a15('0x0'));var util=require(_0x3a15('0x1'));var moment=require(_0x3a15('0x2'));var BPromise=require(_0x3a15('0x3'));var rs=require(_0x3a15('0x4'));var fs=require('fs');var Redis=require(_0x3a15('0x5'));var db=require(_0x3a15('0x6'))['db'];var utils=require(_0x3a15('0x7'));var logger=require(_0x3a15('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3a15('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x476fb0,_0xd33b23,_0x22eaf8){return new BPromise(function(_0x35b5cc,_0x46bde5){return client['request'](_0x476fb0,_0x22eaf8)[_0x3a15('0xa')](function(_0x21eee8){logger[_0x3a15('0xb')](_0x3a15('0xc'),_0xd33b23,_0x3a15('0xd'));logger[_0x3a15('0xe')](_0x3a15('0xf'),_0xd33b23,_0x3a15('0xd'),JSON[_0x3a15('0x10')](_0x21eee8));if(_0x21eee8['error']){if(_0x21eee8[_0x3a15('0x11')][_0x3a15('0x12')]===0x1f4){logger['error'](_0x3a15('0xc'),_0xd33b23,_0x21eee8['error']['message']);return _0x46bde5(_0x21eee8[_0x3a15('0x11')]['message']);}logger['error'](_0x3a15('0xc'),_0xd33b23,_0x21eee8['error'][_0x3a15('0x13')]);return _0x35b5cc(_0x21eee8[_0x3a15('0x11')][_0x3a15('0x13')]);}else{logger['info'](_0x3a15('0xc'),_0xd33b23,_0x3a15('0xd'));_0x35b5cc(_0x21eee8[_0x3a15('0x14')][_0x3a15('0x13')]);}})[_0x3a15('0x15')](function(_0x5a8111){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0xd33b23,_0x5a8111);_0x46bde5(_0x5a8111);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a806e7b..9538a1e 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 _0x539f=['index','/:id','show','/:id/download','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0x539f,0x100));var _0xf539=function(_0x592b77,_0x5b35f1){_0x592b77=_0x592b77-0x0;var _0x3a4849=_0x539f[_0x592b77];return _0x3a4849;};'use strict';var multer=require(_0xf539('0x0'));var util=require(_0xf539('0x1'));var path=require(_0xf539('0x2'));var timeout=require(_0xf539('0x3'));var express=require('express');var router=express[_0xf539('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf539('0x5'));var interaction=require(_0xf539('0x6'));var config=require(_0xf539('0x7'));var controller=require(_0xf539('0x8'));router['get']('/',auth[_0xf539('0x9')](),controller[_0xf539('0xa')]);router['get'](_0xf539('0xb'),auth[_0xf539('0x9')](),controller[_0xf539('0xc')]);router['get'](_0xf539('0xd'),auth[_0xf539('0x9')](),controller['download']);router[_0xf539('0xe')]('/',auth[_0xf539('0x9')](),controller['create']);router['put'](_0xf539('0xb'),auth[_0xf539('0x9')](),controller[_0xf539('0xf')]);router[_0xf539('0x10')](_0xf539('0xb'),auth['isAuthenticated'](),controller[_0xf539('0x11')]);module[_0xf539('0x12')]=router; \ No newline at end of file +var _0xc6e4=['../../config/environment','get','isAuthenticated','index','show','download','post','create','/:id','delete','destroy','exports','multer','path','Router','fs-extra','../../components/interaction/service'];(function(_0x2371a3,_0x84a147){var _0x41f614=function(_0x219ba7){while(--_0x219ba7){_0x2371a3['push'](_0x2371a3['shift']());}};_0x41f614(++_0x84a147);}(_0xc6e4,0x11c));var _0x4c6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc6e4[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4c6e('0x0'));var util=require('util');var path=require(_0x4c6e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4c6e('0x2')]();var fs_extra=require(_0x4c6e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4c6e('0x4'));var config=require(_0x4c6e('0x5'));var controller=require('./analyticExtractedReport.controller');router[_0x4c6e('0x6')]('/',auth[_0x4c6e('0x7')](),controller[_0x4c6e('0x8')]);router['get']('/:id',auth[_0x4c6e('0x7')](),controller[_0x4c6e('0x9')]);router[_0x4c6e('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x4c6e('0xa')]);router[_0x4c6e('0xb')]('/',auth[_0x4c6e('0x7')](),controller[_0x4c6e('0xc')]);router['put'](_0x4c6e('0xd'),auth[_0x4c6e('0x7')](),controller['update']);router[_0x4c6e('0xe')](_0x4c6e('0xd'),auth[_0x4c6e('0x7')](),controller[_0x4c6e('0xf')]);module[_0x4c6e('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 494a0e5..aa34234 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 _0x1b9b=['exports','TEXT','STRING','BOOLEAN'];(function(_0x964d16,_0x22e8b2){var _0x5af22b=function(_0x16bcb9){while(--_0x16bcb9){_0x964d16['push'](_0x964d16['shift']());}};_0x5af22b(++_0x22e8b2);}(_0x1b9b,0x1dc));var _0xb1b9=function(_0x17809c,_0xa6ceb9){_0x17809c=_0x17809c-0x0;var _0x144a29=_0x1b9b[_0x17809c];return _0x144a29;};'use strict';var Sequelize=require('sequelize');module[_0xb1b9('0x0')]={'field':{'type':Sequelize[_0xb1b9('0x1')]},'alias':{'type':Sequelize[_0xb1b9('0x2')]},'function':{'type':Sequelize[_0xb1b9('0x2')]},'format':{'type':Sequelize[_0xb1b9('0x2')]},'groupBy':{'type':Sequelize[_0xb1b9('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb1b9('0x2')]},'custom':{'type':Sequelize[_0xb1b9('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x86f2=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x5a4795,_0x7db3ad){var _0x3549d6=function(_0x2e66e9){while(--_0x2e66e9){_0x5a4795['push'](_0x5a4795['shift']());}};_0x3549d6(++_0x7db3ad);}(_0x86f2,0x76));var _0x286f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x86f2[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x286f('0x0'));module['exports']={'field':{'type':Sequelize[_0x286f('0x1')]},'alias':{'type':Sequelize[_0x286f('0x2')]},'function':{'type':Sequelize[_0x286f('0x2')]},'format':{'type':Sequelize[_0x286f('0x2')]},'groupBy':{'type':Sequelize[_0x286f('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x286f('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 403a6ea..7fe080f 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 _0xc6af=['json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','name','send','index','map','AnalyticFieldReport','fieldName','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0xc6af,0x137));var _0xfc6a=function(_0x4ea38e,_0xc50e8a){_0x4ea38e=_0x4ea38e-0x0;var _0x31dc07=_0xc6af[_0x4ea38e];return _0x31dc07;};'use strict';var emlformat=require(_0xfc6a('0x0'));var rimraf=require(_0xfc6a('0x1'));var zipdir=require(_0xfc6a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc6a('0x3'));var moment=require(_0xfc6a('0x4'));var BPromise=require(_0xfc6a('0x5'));var Mustache=require(_0xfc6a('0x6'));var util=require(_0xfc6a('0x7'));var path=require(_0xfc6a('0x8'));var sox=require(_0xfc6a('0x9'));var csv=require(_0xfc6a('0xa'));var ejs=require(_0xfc6a('0xb'));var fs=require('fs');var fs_extra=require(_0xfc6a('0xc'));var _=require(_0xfc6a('0xd'));var squel=require('squel');var crypto=require(_0xfc6a('0xe'));var jsforce=require(_0xfc6a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfc6a('0xa'));var querystring=require(_0xfc6a('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc6a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfc6a('0x12'));var as=require(_0xfc6a('0x13'));var hardwareService=require(_0xfc6a('0x14'));var logger=require(_0xfc6a('0x15'))(_0xfc6a('0x16'));var utils=require(_0xfc6a('0x17'));var config=require(_0xfc6a('0x18'));var licenseUtil=require(_0xfc6a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a6321,_0x304cd4){_0x304cd4=_0x304cd4||0xcc;return function(_0x3156a5){if(_0x3156a5){return _0x2a6321[_0xfc6a('0x1a')](_0x304cd4);}return _0x2a6321[_0xfc6a('0x1b')](_0x304cd4)[_0xfc6a('0x1c')]();};}function respondWithResult(_0x39fb0a,_0x33461e){_0x33461e=_0x33461e||0xc8;return function(_0x566647){if(_0x566647){return _0x39fb0a[_0xfc6a('0x1b')](_0x33461e)[_0xfc6a('0x1d')](_0x566647);}};}function respondWithFilteredResult(_0x39d866,_0x50881b){return function(_0x433210){if(_0x433210){var _0x322eab=typeof _0x50881b[_0xfc6a('0x1e')]===_0xfc6a('0x1f')&&typeof _0x50881b[_0xfc6a('0x20')]===_0xfc6a('0x1f');var _0x4f1709=_0x433210[_0xfc6a('0x21')];var _0x2a7868=_0x322eab?0x0:_0x50881b['offset'];var _0x2dc33d=_0x322eab?_0x433210[_0xfc6a('0x21')]:_0x50881b['offset']+_0x50881b[_0xfc6a('0x20')];var _0x5d51cb;if(_0x2dc33d>=_0x4f1709){_0x2dc33d=_0x4f1709;_0x5d51cb=0xc8;}else{_0x5d51cb=0xce;}_0x39d866[_0xfc6a('0x1b')](_0x5d51cb);return _0x39d866[_0xfc6a('0x22')](_0xfc6a('0x23'),_0x2a7868+'-'+_0x2dc33d+'/'+_0x4f1709)[_0xfc6a('0x1d')](_0x433210);}return null;};}function patchUpdates(_0x142c8f){return function(_0x5938e5){try{jsonpatch['apply'](_0x5938e5,_0x142c8f,!![]);}catch(_0x7bee97){return BPromise['reject'](_0x7bee97);}return _0x5938e5[_0xfc6a('0x24')]();};}function saveUpdates(_0x3fcf99,_0x21cfdf){return function(_0x23119f){if(_0x23119f){return _0x23119f[_0xfc6a('0x25')](_0x3fcf99)[_0xfc6a('0x26')](function(_0x4d3c6a){return _0x4d3c6a;});}return null;};}function removeEntity(_0x3a3e70,_0x1ad5e9){return function(_0x5f4c1e){if(_0x5f4c1e){return _0x5f4c1e[_0xfc6a('0x27')]()[_0xfc6a('0x26')](function(){_0x3a3e70['status'](0xcc)[_0xfc6a('0x1c')]();});}};}function handleEntityNotFound(_0x8c8cde,_0x37d2a4){return function(_0x45537a){if(!_0x45537a){_0x8c8cde[_0xfc6a('0x1a')](0x194);}return _0x45537a;};}function handleError(_0x569392,_0x4ae030){_0x4ae030=_0x4ae030||0x1f4;return function(_0x40f8bc){logger[_0xfc6a('0x28')](_0x40f8bc['stack']);if(_0x40f8bc[_0xfc6a('0x29')]){delete _0x40f8bc[_0xfc6a('0x29')];}_0x569392[_0xfc6a('0x1b')](_0x4ae030)[_0xfc6a('0x2a')](_0x40f8bc);};}exports[_0xfc6a('0x2b')]=function(_0x141134,_0x7b7923){var _0x1b74c5={},_0x1a700f={},_0x3e0fa3={'count':0x0,'rows':[]};var _0x5bbda2=_[_0xfc6a('0x2c')](db[_0xfc6a('0x2d')]['rawAttributes'],function(_0x4852ec){return{'name':_0x4852ec[_0xfc6a('0x2e')],'type':_0x4852ec['type'][_0xfc6a('0x2f')]};});_0x1a700f['model']=_[_0xfc6a('0x2c')](_0x5bbda2,_0xfc6a('0x29'));_0x1a700f['query']=_[_0xfc6a('0x30')](_0x141134['query']);_0x1a700f[_0xfc6a('0x31')]=_['intersection'](_0x1a700f[_0xfc6a('0x32')],_0x1a700f[_0xfc6a('0x33')]);_0x1b74c5[_0xfc6a('0x34')]=_[_0xfc6a('0x35')](_0x1a700f['model'],qs[_0xfc6a('0x36')](_0x141134[_0xfc6a('0x33')][_0xfc6a('0x36')]));_0x1b74c5[_0xfc6a('0x34')]=_0x1b74c5[_0xfc6a('0x34')][_0xfc6a('0x37')]?_0x1b74c5[_0xfc6a('0x34')]:_0x1a700f[_0xfc6a('0x32')];if(!_0x141134[_0xfc6a('0x33')][_0xfc6a('0x38')](_0xfc6a('0x39'))){_0x1b74c5[_0xfc6a('0x20')]=qs[_0xfc6a('0x20')](_0x141134['query'][_0xfc6a('0x20')]);_0x1b74c5[_0xfc6a('0x1e')]=qs[_0xfc6a('0x1e')](_0x141134['query']['offset']);}_0x1b74c5[_0xfc6a('0x3a')]=qs[_0xfc6a('0x3b')](_0x141134[_0xfc6a('0x33')][_0xfc6a('0x3b')]);_0x1b74c5['where']=qs[_0xfc6a('0x31')](_['pick'](_0x141134[_0xfc6a('0x33')],_0x1a700f[_0xfc6a('0x31')]),_0x5bbda2);if(_0x141134[_0xfc6a('0x33')][_0xfc6a('0x3c')]){_0x1b74c5[_0xfc6a('0x3d')]=_[_0xfc6a('0x3e')](_0x1b74c5[_0xfc6a('0x3d')],{'$or':_['map'](_0x5bbda2,function(_0x5069d7){if(_0x5069d7[_0xfc6a('0x3f')]!==_0xfc6a('0x40')){var _0x3ae67e={};_0x3ae67e[_0x5069d7[_0xfc6a('0x29')]]={'$like':'%'+_0x141134[_0xfc6a('0x33')][_0xfc6a('0x3c')]+'%'};return _0x3ae67e;}})});}_0x1b74c5=_[_0xfc6a('0x3e')]({},_0x1b74c5,_0x141134[_0xfc6a('0x41')]);var _0x49910b={'where':_0x1b74c5[_0xfc6a('0x3d')]};return db[_0xfc6a('0x2d')][_0xfc6a('0x21')](_0x49910b)[_0xfc6a('0x26')](function(_0x1b1008){_0x3e0fa3[_0xfc6a('0x21')]=_0x1b1008;if(_0x141134[_0xfc6a('0x33')][_0xfc6a('0x42')]){_0x1b74c5[_0xfc6a('0x43')]=[{'all':!![]}];}return db[_0xfc6a('0x2d')][_0xfc6a('0x44')](_0x1b74c5);})[_0xfc6a('0x26')](function(_0x3c9225){_0x3e0fa3['rows']=_0x3c9225;return _0x3e0fa3;})[_0xfc6a('0x26')](respondWithFilteredResult(_0x7b7923,_0x1b74c5))[_0xfc6a('0x45')](handleError(_0x7b7923,null));};exports[_0xfc6a('0x46')]=function(_0x5c055d,_0x14004b){var _0x3c17e3={'raw':![],'where':{'id':_0x5c055d[_0xfc6a('0x47')]['id']}},_0x42f972={};_0x42f972[_0xfc6a('0x32')]=_[_0xfc6a('0x30')](db[_0xfc6a('0x2d')][_0xfc6a('0x48')]);_0x42f972['query']=_[_0xfc6a('0x30')](_0x5c055d[_0xfc6a('0x33')]);_0x42f972[_0xfc6a('0x31')]=_[_0xfc6a('0x35')](_0x42f972[_0xfc6a('0x32')],_0x42f972['query']);_0x3c17e3[_0xfc6a('0x34')]=_[_0xfc6a('0x35')](_0x42f972[_0xfc6a('0x32')],qs['fields'](_0x5c055d[_0xfc6a('0x33')][_0xfc6a('0x36')]));_0x3c17e3[_0xfc6a('0x34')]=_0x3c17e3[_0xfc6a('0x34')]['length']?_0x3c17e3['attributes']:_0x42f972[_0xfc6a('0x32')];if(_0x5c055d[_0xfc6a('0x33')][_0xfc6a('0x42')]){_0x3c17e3[_0xfc6a('0x43')]=[{'all':!![]}];}_0x3c17e3=_[_0xfc6a('0x3e')]({},_0x3c17e3,_0x5c055d[_0xfc6a('0x41')]);return db[_0xfc6a('0x2d')][_0xfc6a('0x49')](_0x3c17e3)['then'](handleEntityNotFound(_0x14004b,null))[_0xfc6a('0x26')](respondWithResult(_0x14004b,null))['catch'](handleError(_0x14004b,null));};exports['create']=function(_0x40da92,_0x19e293){return db[_0xfc6a('0x2d')][_0xfc6a('0x4a')](_0x40da92[_0xfc6a('0x4b')],{})['then'](respondWithResult(_0x19e293,0xc9))[_0xfc6a('0x45')](handleError(_0x19e293,null));};exports['bulkCreate']=function(_0x27d782,_0x5dfe5e){return db['AnalyticFieldReport'][_0xfc6a('0x4c')](_0x27d782[_0xfc6a('0x4b')],{'raw':![],'individualHooks':!![]})[_0xfc6a('0x26')](respondWithResult(_0x5dfe5e,0xc9))[_0xfc6a('0x45')](handleError(_0x5dfe5e,null));};exports[_0xfc6a('0x25')]=function(_0x13ce17,_0x52ab42){if(_0x13ce17['body']['id']){delete _0x13ce17[_0xfc6a('0x4b')]['id'];}return db[_0xfc6a('0x2d')]['find']({'where':{'id':_0x13ce17[_0xfc6a('0x47')]['id']}})[_0xfc6a('0x26')](handleEntityNotFound(_0x52ab42,null))[_0xfc6a('0x26')](saveUpdates(_0x13ce17['body'],null))[_0xfc6a('0x26')](respondWithResult(_0x52ab42,null))[_0xfc6a('0x45')](handleError(_0x52ab42,null));};exports[_0xfc6a('0x27')]=function(_0x159f9f,_0x3dff6a){return db[_0xfc6a('0x2d')][_0xfc6a('0x49')]({'where':{'id':_0x159f9f[_0xfc6a('0x47')]['id']}})[_0xfc6a('0x26')](handleEntityNotFound(_0x3dff6a,null))['then'](removeEntity(_0x3dff6a,null))[_0xfc6a('0x45')](handleError(_0x3dff6a,null));};exports[_0xfc6a('0x4d')]=function(_0x134a92,_0x31efcc){return db[_0xfc6a('0x2d')][_0xfc6a('0x27')]({'where':{'id':_0x134a92[_0xfc6a('0x33')][_0xfc6a('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0xfc6a('0x26')](respondWithResult(_0x31efcc,0xcc))[_0xfc6a('0x45')](handleError(_0x31efcc,null));};exports[_0xfc6a('0x4f')]=function(_0x37ae5a,_0x5a258c,_0x68b9b4){return db[_0xfc6a('0x50')][_0xfc6a('0x51')]({'where':{'id':_0x37ae5a[_0xfc6a('0x47')]['id']}})[_0xfc6a('0x26')](handleEntityNotFound(_0x5a258c,null))['then'](function(_0x1d354c){if(_0x1d354c){return db[_0xfc6a('0x52')][_0xfc6a('0x53')](function(_0x12c002){return db['AnalyticFieldReport'][_0xfc6a('0x27')]({'where':{'CustomReportId':_0x37ae5a['params']['id']},'transaction':_0x12c002})['then'](function(_0x4de021){var _0x2dad31=_[_0xfc6a('0x2c')](_0x37ae5a[_0xfc6a('0x4b')],function(_0x5c0328){delete _0x5c0328['id'];_0x5c0328[_0xfc6a('0x54')]=_0x37ae5a[_0xfc6a('0x47')]['id'];return _0x5c0328;});return db[_0xfc6a('0x2d')][_0xfc6a('0x4c')](_0x2dad31,{'transaction':_0x12c002});});})['then'](function(){return db[_0xfc6a('0x2d')]['findAll']({'where':{'CustomReportId':_0x37ae5a[_0xfc6a('0x47')]['id']}});});}})[_0xfc6a('0x26')](respondWithResult(_0x5a258c,null))[_0xfc6a('0x45')](handleError(_0x5a258c,null));}; \ No newline at end of file +var _0xaffb=['length','options','find','create','body','bulkCreate','bulkDestroy','ids','findOne','transaction','CustomReportId','findAll','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','status','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','params','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaffb,0x1e6));var _0xbaff=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xaffb[_0x55d8c5];return _0x225ae5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbaff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbaff('0x1'));var moment=require(_0xbaff('0x2'));var BPromise=require(_0xbaff('0x3'));var Mustache=require(_0xbaff('0x4'));var util=require(_0xbaff('0x5'));var path=require(_0xbaff('0x6'));var sox=require(_0xbaff('0x7'));var csv=require(_0xbaff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbaff('0x9'));var squel=require(_0xbaff('0xa'));var crypto=require(_0xbaff('0xb'));var jsforce=require(_0xbaff('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbaff('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbaff('0xd'));var authService=require(_0xbaff('0xe'));var qs=require(_0xbaff('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbaff('0x10'))(_0xbaff('0x11'));var utils=require('../../config/utils');var config=require(_0xbaff('0x12'));var licenseUtil=require(_0xbaff('0x13'));var db=require(_0xbaff('0x14'))['db'];function respondWithStatusCode(_0x574fd4,_0x12917f){_0x12917f=_0x12917f||0xcc;return function(_0x578409){if(_0x578409){return _0x574fd4[_0xbaff('0x15')](_0x12917f);}return _0x574fd4['status'](_0x12917f)[_0xbaff('0x16')]();};}function respondWithResult(_0x34420d,_0x23fb1c){_0x23fb1c=_0x23fb1c||0xc8;return function(_0x16e356){if(_0x16e356){return _0x34420d['status'](_0x23fb1c)[_0xbaff('0x17')](_0x16e356);}};}function respondWithFilteredResult(_0x30e3fa,_0x541636){return function(_0x5c4c6c){if(_0x5c4c6c){var _0x1f3506=typeof _0x541636[_0xbaff('0x18')]===_0xbaff('0x19')&&typeof _0x541636['limit']===_0xbaff('0x19');var _0x5a01e0=_0x5c4c6c[_0xbaff('0x1a')];var _0x3947e0=_0x1f3506?0x0:_0x541636[_0xbaff('0x18')];var _0x3f9258=_0x1f3506?_0x5c4c6c[_0xbaff('0x1a')]:_0x541636[_0xbaff('0x18')]+_0x541636[_0xbaff('0x1b')];var _0x5dcb6a;if(_0x3f9258>=_0x5a01e0){_0x3f9258=_0x5a01e0;_0x5dcb6a=0xc8;}else{_0x5dcb6a=0xce;}_0x30e3fa['status'](_0x5dcb6a);return _0x30e3fa[_0xbaff('0x1c')](_0xbaff('0x1d'),_0x3947e0+'-'+_0x3f9258+'/'+_0x5a01e0)[_0xbaff('0x17')](_0x5c4c6c);}return null;};}function patchUpdates(_0x4382de){return function(_0xddf46f){try{jsonpatch[_0xbaff('0x1e')](_0xddf46f,_0x4382de,!![]);}catch(_0x2df365){return BPromise[_0xbaff('0x1f')](_0x2df365);}return _0xddf46f['save']();};}function saveUpdates(_0x4009a4,_0x1fbb65){return function(_0x36b462){if(_0x36b462){return _0x36b462[_0xbaff('0x20')](_0x4009a4)[_0xbaff('0x21')](function(_0x524501){return _0x524501;});}return null;};}function removeEntity(_0x302765,_0x3598d4){return function(_0x52f1e8){if(_0x52f1e8){return _0x52f1e8[_0xbaff('0x22')]()[_0xbaff('0x21')](function(){_0x302765[_0xbaff('0x23')](0xcc)[_0xbaff('0x16')]();});}};}function handleEntityNotFound(_0x444296,_0x4cafc9){return function(_0x36d017){if(!_0x36d017){_0x444296[_0xbaff('0x15')](0x194);}return _0x36d017;};}function handleError(_0x390ce3,_0x340225){_0x340225=_0x340225||0x1f4;return function(_0x4aa8b4){logger[_0xbaff('0x24')](_0x4aa8b4[_0xbaff('0x25')]);if(_0x4aa8b4['name']){delete _0x4aa8b4[_0xbaff('0x26')];}_0x390ce3[_0xbaff('0x23')](_0x340225)[_0xbaff('0x27')](_0x4aa8b4);};}exports[_0xbaff('0x28')]=function(_0x1bd18e,_0x13c91f){var _0x5a096e={},_0x14300c={},_0x62292f={'count':0x0,'rows':[]};var _0x5b6f01=_['map'](db[_0xbaff('0x29')][_0xbaff('0x2a')],function(_0x48d2d1){return{'name':_0x48d2d1[_0xbaff('0x2b')],'type':_0x48d2d1[_0xbaff('0x2c')][_0xbaff('0x2d')]};});_0x14300c[_0xbaff('0x2e')]=_[_0xbaff('0x2f')](_0x5b6f01,_0xbaff('0x26'));_0x14300c[_0xbaff('0x30')]=_[_0xbaff('0x31')](_0x1bd18e[_0xbaff('0x30')]);_0x14300c[_0xbaff('0x32')]=_[_0xbaff('0x33')](_0x14300c['model'],_0x14300c[_0xbaff('0x30')]);_0x5a096e[_0xbaff('0x34')]=_[_0xbaff('0x33')](_0x14300c[_0xbaff('0x2e')],qs['fields'](_0x1bd18e['query']['fields']));_0x5a096e[_0xbaff('0x34')]=_0x5a096e[_0xbaff('0x34')]['length']?_0x5a096e['attributes']:_0x14300c[_0xbaff('0x2e')];if(!_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x35')]('nolimit')){_0x5a096e[_0xbaff('0x1b')]=qs[_0xbaff('0x1b')](_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x1b')]);_0x5a096e[_0xbaff('0x18')]=qs[_0xbaff('0x18')](_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x18')]);}_0x5a096e[_0xbaff('0x36')]=qs[_0xbaff('0x37')](_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x37')]);_0x5a096e['where']=qs['filters'](_[_0xbaff('0x38')](_0x1bd18e[_0xbaff('0x30')],_0x14300c[_0xbaff('0x32')]),_0x5b6f01);if(_0x1bd18e['query'][_0xbaff('0x39')]){_0x5a096e[_0xbaff('0x3a')]=_[_0xbaff('0x3b')](_0x5a096e['where'],{'$or':_[_0xbaff('0x2f')](_0x5b6f01,function(_0x35f980){if(_0x35f980['type']!==_0xbaff('0x3c')){var _0x114fe5={};_0x114fe5[_0x35f980[_0xbaff('0x26')]]={'$like':'%'+_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x39')]+'%'};return _0x114fe5;}})});}_0x5a096e=_[_0xbaff('0x3b')]({},_0x5a096e,_0x1bd18e['options']);var _0x18c543={'where':_0x5a096e[_0xbaff('0x3a')]};return db[_0xbaff('0x29')][_0xbaff('0x1a')](_0x18c543)['then'](function(_0x40c6c7){_0x62292f[_0xbaff('0x1a')]=_0x40c6c7;if(_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x3d')]){_0x5a096e[_0xbaff('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x5a096e);})[_0xbaff('0x21')](function(_0x4c8604){_0x62292f[_0xbaff('0x3f')]=_0x4c8604;return _0x62292f;})[_0xbaff('0x21')](respondWithFilteredResult(_0x13c91f,_0x5a096e))[_0xbaff('0x40')](handleError(_0x13c91f,null));};exports['show']=function(_0x2a7159,_0x2c24ef){var _0x183b9c={'raw':![],'where':{'id':_0x2a7159[_0xbaff('0x41')]['id']}},_0x25262a={};_0x25262a[_0xbaff('0x2e')]=_[_0xbaff('0x31')](db[_0xbaff('0x29')][_0xbaff('0x2a')]);_0x25262a['query']=_['keys'](_0x2a7159['query']);_0x25262a[_0xbaff('0x32')]=_[_0xbaff('0x33')](_0x25262a[_0xbaff('0x2e')],_0x25262a[_0xbaff('0x30')]);_0x183b9c[_0xbaff('0x34')]=_[_0xbaff('0x33')](_0x25262a[_0xbaff('0x2e')],qs['fields'](_0x2a7159[_0xbaff('0x30')][_0xbaff('0x42')]));_0x183b9c['attributes']=_0x183b9c[_0xbaff('0x34')][_0xbaff('0x43')]?_0x183b9c[_0xbaff('0x34')]:_0x25262a['model'];if(_0x2a7159[_0xbaff('0x30')]['includeAll']){_0x183b9c[_0xbaff('0x3e')]=[{'all':!![]}];}_0x183b9c=_['merge']({},_0x183b9c,_0x2a7159[_0xbaff('0x44')]);return db['AnalyticFieldReport'][_0xbaff('0x45')](_0x183b9c)[_0xbaff('0x21')](handleEntityNotFound(_0x2c24ef,null))[_0xbaff('0x21')](respondWithResult(_0x2c24ef,null))[_0xbaff('0x40')](handleError(_0x2c24ef,null));};exports[_0xbaff('0x46')]=function(_0x3fb500,_0x56d08d){return db[_0xbaff('0x29')][_0xbaff('0x46')](_0x3fb500[_0xbaff('0x47')],{})[_0xbaff('0x21')](respondWithResult(_0x56d08d,0xc9))[_0xbaff('0x40')](handleError(_0x56d08d,null));};exports[_0xbaff('0x48')]=function(_0x14c4ac,_0x52bacf){return db[_0xbaff('0x29')][_0xbaff('0x48')](_0x14c4ac[_0xbaff('0x47')],{'raw':![],'individualHooks':!![]})[_0xbaff('0x21')](respondWithResult(_0x52bacf,0xc9))['catch'](handleError(_0x52bacf,null));};exports[_0xbaff('0x20')]=function(_0x980c31,_0x93936c){if(_0x980c31[_0xbaff('0x47')]['id']){delete _0x980c31[_0xbaff('0x47')]['id'];}return db[_0xbaff('0x29')][_0xbaff('0x45')]({'where':{'id':_0x980c31[_0xbaff('0x41')]['id']}})[_0xbaff('0x21')](handleEntityNotFound(_0x93936c,null))['then'](saveUpdates(_0x980c31[_0xbaff('0x47')],null))[_0xbaff('0x21')](respondWithResult(_0x93936c,null))[_0xbaff('0x40')](handleError(_0x93936c,null));};exports[_0xbaff('0x22')]=function(_0x327c53,_0x54bd9f){return db[_0xbaff('0x29')][_0xbaff('0x45')]({'where':{'id':_0x327c53[_0xbaff('0x41')]['id']}})['then'](handleEntityNotFound(_0x54bd9f,null))[_0xbaff('0x21')](removeEntity(_0x54bd9f,null))[_0xbaff('0x40')](handleError(_0x54bd9f,null));};exports[_0xbaff('0x49')]=function(_0x660c88,_0x53b3e3){return db[_0xbaff('0x29')][_0xbaff('0x22')]({'where':{'id':_0x660c88[_0xbaff('0x30')][_0xbaff('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xbaff('0x21')](respondWithResult(_0x53b3e3,0xcc))[_0xbaff('0x40')](handleError(_0x53b3e3,null));};exports['addFields']=function(_0x24ac62,_0x94618a,_0xbd3a69){return db['AnalyticCustomReport'][_0xbaff('0x4b')]({'where':{'id':_0x24ac62[_0xbaff('0x41')]['id']}})[_0xbaff('0x21')](handleEntityNotFound(_0x94618a,null))[_0xbaff('0x21')](function(_0x4542ba){if(_0x4542ba){return db['sequelize'][_0xbaff('0x4c')](function(_0x4c3771){return db[_0xbaff('0x29')]['destroy']({'where':{'CustomReportId':_0x24ac62[_0xbaff('0x41')]['id']},'transaction':_0x4c3771})[_0xbaff('0x21')](function(_0x14b8c7){var _0x40f159=_[_0xbaff('0x2f')](_0x24ac62[_0xbaff('0x47')],function(_0x197f48){delete _0x197f48['id'];_0x197f48[_0xbaff('0x4d')]=_0x24ac62[_0xbaff('0x41')]['id'];return _0x197f48;});return db[_0xbaff('0x29')][_0xbaff('0x48')](_0x40f159,{'transaction':_0x4c3771});});})[_0xbaff('0x21')](function(){return db['AnalyticFieldReport'][_0xbaff('0x4e')]({'where':{'CustomReportId':_0x24ac62[_0xbaff('0x41')]['id']}});});}})['then'](respondWithResult(_0x94618a,null))['catch'](handleError(_0x94618a,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 5fbb89e..4e35902 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 _0xb0cb=['AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','define'];(function(_0x253b7b,_0x5f4bf9){var _0xab484=function(_0x12ef6f){while(--_0x12ef6f){_0x253b7b['push'](_0x253b7b['shift']());}};_0xab484(++_0x5f4bf9);}(_0xb0cb,0x17b));var _0xbb0c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xb0cb[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xbb0c('0x0'));var util=require(_0xbb0c('0x1'));var logger=require(_0xbb0c('0x2'))(_0xbb0c('0x3'));var moment=require(_0xbb0c('0x4'));var BPromise=require(_0xbb0c('0x5'));var rp=require(_0xbb0c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb0c('0x7'));var config=require(_0xbb0c('0x8'));var attributes=require(_0xbb0c('0x9'));module['exports']=function(_0x1a19f0,_0x49bc9f){return _0x1a19f0[_0xbb0c('0xa')](_0xbb0c('0xb'),attributes,{'tableName':_0xbb0c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9dc=['AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x3ec744,_0x340800){var _0x239fba=function(_0x256f79){while(--_0x256f79){_0x3ec744['push'](_0x3ec744['shift']());}};_0x239fba(++_0x340800);}(_0xc9dc,0xda));var _0xcc9d=function(_0x5e8ba5,_0x40e58d){_0x5e8ba5=_0x5e8ba5-0x0;var _0x420ab4=_0xc9dc[_0x5e8ba5];return _0x420ab4;};'use strict';var _=require(_0xcc9d('0x0'));var util=require(_0xcc9d('0x1'));var logger=require(_0xcc9d('0x2'))(_0xcc9d('0x3'));var moment=require(_0xcc9d('0x4'));var BPromise=require(_0xcc9d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc9d('0x6'));var rimraf=require('rimraf');var config=require(_0xcc9d('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0xcc9d('0x8')]=function(_0x480968,_0xbaf26b){return _0x480968[_0xcc9d('0x9')](_0xcc9d('0xa'),attributes,{'tableName':_0xcc9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 580cb3e..7405631 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 _0x374e=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x374e,0xba));var _0xe374=function(_0x1f2e32,_0x5eb322){_0x1f2e32=_0x1f2e32-0x0;var _0x4e0b6d=_0x374e[_0x1f2e32];return _0x4e0b6d;};'use strict';var _=require(_0xe374('0x0'));var util=require('util');var moment=require(_0xe374('0x1'));var BPromise=require(_0xe374('0x2'));var rs=require(_0xe374('0x3'));var fs=require('fs');var Redis=require(_0xe374('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe374('0x5'));var logger=require(_0xe374('0x6'))('rpc');var config=require(_0xe374('0x7'));var jayson=require(_0xe374('0x8'));var client=jayson[_0xe374('0x9')][_0xe374('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227423,_0x3b9afd,_0x39fea0){return new BPromise(function(_0x37922a,_0x4f31e3){return client[_0xe374('0xb')](_0x227423,_0x39fea0)[_0xe374('0xc')](function(_0x3da1d1){logger[_0xe374('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3b9afd,'request\x20sent');logger[_0xe374('0xe')](_0xe374('0xf'),_0x3b9afd,_0xe374('0x10'),JSON[_0xe374('0x11')](_0x3da1d1));if(_0x3da1d1[_0xe374('0x12')]){if(_0x3da1d1[_0xe374('0x12')][_0xe374('0x13')]===0x1f4){logger[_0xe374('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3b9afd,_0x3da1d1[_0xe374('0x12')]['message']);return _0x4f31e3(_0x3da1d1[_0xe374('0x12')][_0xe374('0x14')]);}logger[_0xe374('0x12')](_0xe374('0x15'),_0x3b9afd,_0x3da1d1['error'][_0xe374('0x14')]);return _0x37922a(_0x3da1d1['error'][_0xe374('0x14')]);}else{logger[_0xe374('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3b9afd,_0xe374('0x10'));_0x37922a(_0x3da1d1[_0xe374('0x16')]['message']);}})[_0xe374('0x17')](function(_0x58ddc4){logger[_0xe374('0x12')](_0xe374('0x15'),_0x3b9afd,_0x58ddc4);_0x4f31e3(_0x58ddc4);});});} \ No newline at end of file +var _0x25d5=['../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x2921a8,_0x30e287){var _0xc8ff65=function(_0x469ac0){while(--_0x469ac0){_0x2921a8['push'](_0x2921a8['shift']());}};_0xc8ff65(++_0x30e287);}(_0x25d5,0x165));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x525d('0x0'));var moment=require('moment');var BPromise=require(_0x525d('0x1'));var rs=require(_0x525d('0x2'));var fs=require('fs');var Redis=require(_0x525d('0x3'));var db=require(_0x525d('0x4'))['db'];var utils=require(_0x525d('0x5'));var logger=require(_0x525d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x525d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x17bb4d,_0x2bd3e4,_0x4021c7){return new BPromise(function(_0x56c076,_0x8210c3){return client[_0x525d('0x8')](_0x17bb4d,_0x4021c7)[_0x525d('0x9')](function(_0x439b18){logger[_0x525d('0xa')](_0x525d('0xb'),_0x2bd3e4,_0x525d('0xc'));logger['debug'](_0x525d('0xd'),_0x2bd3e4,_0x525d('0xc'),JSON[_0x525d('0xe')](_0x439b18));if(_0x439b18[_0x525d('0xf')]){if(_0x439b18['error']['code']===0x1f4){logger[_0x525d('0xf')](_0x525d('0xb'),_0x2bd3e4,_0x439b18['error'][_0x525d('0x10')]);return _0x8210c3(_0x439b18[_0x525d('0xf')][_0x525d('0x10')]);}logger[_0x525d('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2bd3e4,_0x439b18[_0x525d('0xf')][_0x525d('0x10')]);return _0x56c076(_0x439b18[_0x525d('0xf')][_0x525d('0x10')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x2bd3e4,_0x525d('0xc'));_0x56c076(_0x439b18[_0x525d('0x11')][_0x525d('0x10')]);}})[_0x525d('0x12')](function(_0x3844f3){logger[_0x525d('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2bd3e4,_0x3844f3);_0x8210c3(_0x3844f3);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 17bc258..2b2907f 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(_0x1d638b,_0x52dd72){var _0x492ad9=function(_0x4ae4d7){while(--_0x4ae4d7){_0x1d638b['push'](_0x1d638b['shift']());}};_0x492ad9(++_0x52dd72);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x3c9010,_0x970251){var _0x373e8a=function(_0x3a8a9e){while(--_0x3a8a9e){_0x3c9010['push'](_0x3c9010['shift']());}};_0x373e8a(++_0x970251);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 7e17130..c8b6b78 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 _0xede3=['exports','name','STRING','TEXT'];(function(_0xdba210,_0x17d434){var _0x5c7712=function(_0x36ad83){while(--_0x36ad83){_0xdba210['push'](_0xdba210['shift']());}};_0x5c7712(++_0x17d434);}(_0xede3,0xc0));var _0x3ede=function(_0x1f1ea6,_0x51eb08){_0x1f1ea6=_0x1f1ea6-0x0;var _0x4ead57=_0xede3[_0x1f1ea6];return _0x4ead57;};'use strict';var Sequelize=require('sequelize');module[_0x3ede('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3ede('0x1')},'table':{'type':Sequelize[_0x3ede('0x2')]},'metric':{'type':Sequelize[_0x3ede('0x3')]},'description':{'type':Sequelize[_0x3ede('0x2')]}}; \ No newline at end of file +var _0x0c1a=['exports','STRING','TEXT','sequelize'];(function(_0x18412f,_0x441675){var _0x130b9d=function(_0x4a3aff){while(--_0x4a3aff){_0x18412f['push'](_0x18412f['shift']());}};_0x130b9d(++_0x441675);}(_0x0c1a,0x127));var _0xa0c1=function(_0xb496cf,_0x45e1fa){_0xb496cf=_0xb496cf-0x0;var _0x769aac=_0x0c1a[_0xb496cf];return _0x769aac;};'use strict';var Sequelize=require(_0xa0c1('0x0'));module[_0xa0c1('0x1')]={'name':{'type':Sequelize[_0xa0c1('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xa0c1('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 4ca3d27..7d53070 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 _0x98a8=['../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Metrics','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x6c1057,_0x1e35a6){var _0x515a94=function(_0x355b51){while(--_0x355b51){_0x6c1057['push'](_0x6c1057['shift']());}};_0x515a94(++_0x1e35a6);}(_0x98a8,0x12c));var _0x898a=function(_0xf84bc9,_0x27d951){_0xf84bc9=_0xf84bc9-0x0;var _0x55fc35=_0x98a8[_0xf84bc9];return _0x55fc35;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){var _0x32eca5=_0x274cdf[_0x898a('0x25')]({'plain':!![]});var _0x1426e3='Metrics';return db[_0x898a('0x26')]['destroy']({'where':{'type':_0x1426e3,'resourceId':_0x32eca5['id']}})['then'](function(){return _0x274cdf;});})['then'](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x420b25,_0x40b3db){return function(_0x28ae6a){if(!_0x28ae6a){_0x420b25[_0x898a('0x27')](0x194);}return _0x28ae6a;};}function handleError(_0x398e98,_0xac1fc4){_0xac1fc4=_0xac1fc4||0x1f4;return function(_0xd31922){logger['error'](_0xd31922['stack']);if(_0xd31922['name']){delete _0xd31922[_0x898a('0x28')];}_0x398e98[_0x898a('0x1a')](_0xac1fc4)[_0x898a('0x29')](_0xd31922);};}exports[_0x898a('0x2a')]=function(_0x34f447,_0x560000){var _0xe3c983={},_0xf74645={},_0x18773a={'count':0x0,'rows':[]};var _0x4287da=_[_0x898a('0x2b')](db[_0x898a('0x2c')]['rawAttributes'],function(_0x7a1eb5){return{'name':_0x7a1eb5[_0x898a('0x2d')],'type':_0x7a1eb5[_0x898a('0x2e')][_0x898a('0x2f')]};});_0xf74645[_0x898a('0x30')]=_['map'](_0x4287da,'name');_0xf74645[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34f447[_0x898a('0x31')]);_0xf74645['filters']=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],_0xf74645[_0x898a('0x31')]);_0xe3c983[_0x898a('0x34')]=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],qs[_0x898a('0x35')](_0x34f447[_0x898a('0x31')]['fields']));_0xe3c983[_0x898a('0x34')]=_0xe3c983['attributes']['length']?_0xe3c983[_0x898a('0x34')]:_0xf74645['model'];if(!_0x34f447[_0x898a('0x31')]['hasOwnProperty'](_0x898a('0x36'))){_0xe3c983['limit']=qs[_0x898a('0x37')](_0x34f447[_0x898a('0x31')][_0x898a('0x37')]);_0xe3c983['offset']=qs['offset'](_0x34f447['query'][_0x898a('0x1e')]);}_0xe3c983[_0x898a('0x38')]=qs['sort'](_0x34f447[_0x898a('0x31')][_0x898a('0x39')]);_0xe3c983[_0x898a('0x3a')]=qs[_0x898a('0x3b')](_['pick'](_0x34f447['query'],_0xf74645[_0x898a('0x3b')]),_0x4287da);if(_0x34f447[_0x898a('0x31')]['filter']){_0xe3c983['where']=_[_0x898a('0x3c')](_0xe3c983[_0x898a('0x3a')],{'$or':_[_0x898a('0x2b')](_0x4287da,function(_0xa45405){if(_0xa45405['type']!==_0x898a('0x3d')){var _0x369c02={};_0x369c02[_0xa45405['name']]={'$like':'%'+_0x34f447['query']['filter']+'%'};return _0x369c02;}})});}_0xe3c983=_[_0x898a('0x3c')]({},_0xe3c983,_0x34f447[_0x898a('0x3e')]);var _0x35d767={'where':_0xe3c983[_0x898a('0x3a')]};return db[_0x898a('0x2c')][_0x898a('0x1d')](_0x35d767)[_0x898a('0x23')](function(_0x1432ec){_0x18773a[_0x898a('0x1d')]=_0x1432ec;if(_0x34f447[_0x898a('0x31')][_0x898a('0x3f')]){_0xe3c983[_0x898a('0x40')]=[{'all':!![]}];}return db[_0x898a('0x2c')][_0x898a('0x41')](_0xe3c983);})[_0x898a('0x23')](function(_0x4c8628){_0x18773a[_0x898a('0x42')]=_0x4c8628;return _0x18773a;})[_0x898a('0x23')](respondWithFilteredResult(_0x560000,_0xe3c983))[_0x898a('0x43')](handleError(_0x560000,null));};exports['show']=function(_0x34029e,_0x2e5451){var _0x3a8663={'raw':!![],'where':{'id':_0x34029e[_0x898a('0x44')]['id']}},_0x6ab441={};_0x6ab441[_0x898a('0x30')]=_[_0x898a('0x32')](db[_0x898a('0x2c')]['rawAttributes']);_0x6ab441[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34029e[_0x898a('0x31')]);_0x6ab441[_0x898a('0x3b')]=_['intersection'](_0x6ab441[_0x898a('0x30')],_0x6ab441[_0x898a('0x31')]);_0x3a8663['attributes']=_[_0x898a('0x33')](_0x6ab441['model'],qs[_0x898a('0x35')](_0x34029e['query']['fields']));_0x3a8663[_0x898a('0x34')]=_0x3a8663['attributes'][_0x898a('0x45')]?_0x3a8663[_0x898a('0x34')]:_0x6ab441['model'];if(_0x34029e[_0x898a('0x31')][_0x898a('0x3f')]){_0x3a8663['include']=[{'all':!![]}];}_0x3a8663=_[_0x898a('0x3c')]({},_0x3a8663,_0x34029e[_0x898a('0x3e')]);return db[_0x898a('0x2c')][_0x898a('0x46')](_0x3a8663)['then'](handleEntityNotFound(_0x2e5451,null))[_0x898a('0x23')](respondWithResult(_0x2e5451,null))[_0x898a('0x43')](handleError(_0x2e5451,null));};exports['create']=function(_0x25adcc,_0x1d8c16){return db['AnalyticMetric'][_0x898a('0x47')](_0x25adcc['body'],{})[_0x898a('0x23')](function(_0x41f291){var _0x32ccb9=_0x25adcc['user'][_0x898a('0x25')]({'plain':!![]});if(!_0x32ccb9)throw new Error(_0x898a('0x48'));if(_0x32ccb9[_0x898a('0x49')]===_0x898a('0x4a')){var _0x5a8a2c=_0x41f291[_0x898a('0x25')]({'plain':!![]});var _0x529d7c=_0x898a('0x4b');return db[_0x898a('0x4c')][_0x898a('0x46')]({'where':{'name':_0x529d7c,'userProfileId':_0x32ccb9['userProfileId']},'raw':!![]})[_0x898a('0x23')](function(_0x3c4db0){if(_0x3c4db0&&_0x3c4db0[_0x898a('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a8a2c[_0x898a('0x28')],'resourceId':_0x5a8a2c['id'],'type':_0x3c4db0[_0x898a('0x28')],'sectionId':_0x3c4db0['id']},{})[_0x898a('0x23')](function(){return _0x41f291;});}else{return _0x41f291;}})[_0x898a('0x43')](function(_0x28b8c9){logger[_0x898a('0x4e')](_0x898a('0x4f'),_0x28b8c9);throw _0x28b8c9;});}return _0x41f291;})[_0x898a('0x23')](respondWithResult(_0x1d8c16,0xc9))[_0x898a('0x43')](handleError(_0x1d8c16,null));};exports[_0x898a('0x22')]=function(_0x2382a9,_0x5e9329){if(_0x2382a9[_0x898a('0x50')]['id']){delete _0x2382a9[_0x898a('0x50')]['id'];}return db['AnalyticMetric'][_0x898a('0x46')]({'where':{'id':_0x2382a9['params']['id']}})['then'](handleEntityNotFound(_0x5e9329,null))[_0x898a('0x23')](saveUpdates(_0x2382a9[_0x898a('0x50')],null))[_0x898a('0x23')](respondWithResult(_0x5e9329,null))['catch'](handleError(_0x5e9329,null));};exports['destroy']=function(_0x11a07a,_0x1f5e4b){return db['AnalyticMetric'][_0x898a('0x46')]({'where':{'id':_0x11a07a[_0x898a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f5e4b,null))[_0x898a('0x23')](removeEntity(_0x1f5e4b,null))[_0x898a('0x43')](handleError(_0x1f5e4b,null));}; \ No newline at end of file +var _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0x84ab,0x12f));var _0xb84a=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x84ab[_0x77d310];return _0x2cdce4;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 6c84d39..fe0680c 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 _0xdfa0=['path','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x214ec2,_0x3a437b){var _0x18b531=function(_0x48234f){while(--_0x48234f){_0x214ec2['push'](_0x214ec2['shift']());}};_0x18b531(++_0x3a437b);}(_0xdfa0,0x69));var _0x0dfa=function(_0x2761f8,_0x54996e){_0x2761f8=_0x2761f8-0x0;var _0x33f750=_0xdfa0[_0x2761f8];return _0x33f750;};'use strict';var _=require(_0x0dfa('0x0'));var util=require('util');var logger=require(_0x0dfa('0x1'))(_0x0dfa('0x2'));var moment=require('moment');var BPromise=require(_0x0dfa('0x3'));var rp=require(_0x0dfa('0x4'));var fs=require('fs');var path=require(_0x0dfa('0x5'));var rimraf=require('rimraf');var config=require(_0x0dfa('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x0dfa('0x7')]=function(_0x2efe20,_0x4830b6){return _0x2efe20[_0x0dfa('0x8')](_0x0dfa('0x9'),attributes,{'tableName':_0x0dfa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae30=['../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xc153db,_0x516c10){var _0x4dc97d=function(_0x10fc05){while(--_0x10fc05){_0xc153db['push'](_0xc153db['shift']());}};_0x4dc97d(++_0x516c10);}(_0xae30,0x10a));var _0x0ae3=function(_0x40c9bc,_0x6eb340){_0x40c9bc=_0x40c9bc-0x0;var _0x3acedf=_0xae30[_0x40c9bc];return _0x3acedf;};'use strict';var _=require(_0x0ae3('0x0'));var util=require(_0x0ae3('0x1'));var logger=require(_0x0ae3('0x2'))('api');var moment=require(_0x0ae3('0x3'));var BPromise=require(_0x0ae3('0x4'));var rp=require(_0x0ae3('0x5'));var fs=require('fs');var path=require(_0x0ae3('0x6'));var rimraf=require('rimraf');var config=require(_0x0ae3('0x7'));var attributes=require(_0x0ae3('0x8'));module[_0x0ae3('0x9')]=function(_0x7ce33e,_0x2b8c53){return _0x7ce33e[_0x0ae3('0xa')](_0x0ae3('0xb'),attributes,{'tableName':_0x0ae3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index f434bec..e3d0de5 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 _0xff84=['rpc','../../config/environment','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x26d720,_0x25c8eb){var _0x37fcc1=function(_0x40b59e){while(--_0x40b59e){_0x26d720['push'](_0x26d720['shift']());}};_0x37fcc1(++_0x25c8eb);}(_0xff84,0x120));var _0x4ff8=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xff84[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x4ff8('0x0'));var moment=require(_0x4ff8('0x1'));var BPromise=require(_0x4ff8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ff8('0x3'));var db=require(_0x4ff8('0x4'))['db'];var utils=require(_0x4ff8('0x5'));var logger=require('../../config/logger')(_0x4ff8('0x6'));var config=require(_0x4ff8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4ff8('0x8')][_0x4ff8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cabe5,_0x2effc6,_0x811f5f){return new BPromise(function(_0x11a6db,_0x4bb5ef){return client['request'](_0x5cabe5,_0x811f5f)[_0x4ff8('0xa')](function(_0x3037c7){logger[_0x4ff8('0xb')](_0x4ff8('0xc'),_0x2effc6,_0x4ff8('0xd'));logger['debug'](_0x4ff8('0xe'),_0x2effc6,'request\x20sent',JSON[_0x4ff8('0xf')](_0x3037c7));if(_0x3037c7['error']){if(_0x3037c7[_0x4ff8('0x10')][_0x4ff8('0x11')]===0x1f4){logger[_0x4ff8('0x10')](_0x4ff8('0xc'),_0x2effc6,_0x3037c7['error']['message']);return _0x4bb5ef(_0x3037c7[_0x4ff8('0x10')][_0x4ff8('0x12')]);}logger[_0x4ff8('0x10')](_0x4ff8('0xc'),_0x2effc6,_0x3037c7[_0x4ff8('0x10')][_0x4ff8('0x12')]);return _0x11a6db(_0x3037c7[_0x4ff8('0x10')]['message']);}else{logger[_0x4ff8('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x2effc6,_0x4ff8('0xd'));_0x11a6db(_0x3037c7[_0x4ff8('0x13')]['message']);}})[_0x4ff8('0x14')](function(_0x2843b3){logger[_0x4ff8('0x10')](_0x4ff8('0xc'),_0x2effc6,_0x2843b3);_0x4bb5ef(_0x2843b3);});});} \ No newline at end of file +var _0x0849=['error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x0849,0x1bc));var _0x9084=function(_0xf090bb,_0x4b4d9f){_0xf090bb=_0xf090bb-0x0;var _0x4a57f5=_0x0849[_0xf090bb];return _0x4a57f5;};'use strict';var _=require('lodash');var util=require(_0x9084('0x0'));var moment=require('moment');var BPromise=require(_0x9084('0x1'));var rs=require(_0x9084('0x2'));var fs=require('fs');var Redis=require(_0x9084('0x3'));var db=require(_0x9084('0x4'))['db'];var utils=require(_0x9084('0x5'));var logger=require(_0x9084('0x6'))(_0x9084('0x7'));var config=require('../../config/environment');var jayson=require(_0x9084('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42c3c2,_0x5f1321,_0x1e506d){return new BPromise(function(_0x179906,_0x461599){return client[_0x9084('0x9')](_0x42c3c2,_0x1e506d)[_0x9084('0xa')](function(_0x35753a){logger[_0x9084('0xb')](_0x9084('0xc'),_0x5f1321,'request\x20sent');logger[_0x9084('0xd')](_0x9084('0xe'),_0x5f1321,_0x9084('0xf'),JSON[_0x9084('0x10')](_0x35753a));if(_0x35753a['error']){if(_0x35753a['error'][_0x9084('0x11')]===0x1f4){logger[_0x9084('0x12')](_0x9084('0xc'),_0x5f1321,_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);return _0x461599(_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);}logger[_0x9084('0x12')](_0x9084('0xc'),_0x5f1321,_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);return _0x179906(_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);}else{logger[_0x9084('0xb')](_0x9084('0xc'),_0x5f1321,_0x9084('0xf'));_0x179906(_0x35753a[_0x9084('0x14')][_0x9084('0x13')]);}})['catch'](function(_0x3e2c10){logger[_0x9084('0x12')](_0x9084('0xc'),_0x5f1321,_0x3e2c10);_0x461599(_0x3e2c10);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 7ff0441..b993540 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 _0x37a7=['util','Router','fs-extra','./analyticMetric.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2de753,_0x4a544d){var _0x8e70a5=function(_0x498455){while(--_0x498455){_0x2de753['push'](_0x2de753['shift']());}};_0x8e70a5(++_0x4a544d);}(_0x37a7,0x6f));var _0x737a=function(_0x4cf382,_0x1533d4){_0x4cf382=_0x4cf382-0x0;var _0x1fed91=_0x37a7[_0x4cf382];return _0x1fed91;};'use strict';var multer=require(_0x737a('0x0'));var util=require(_0x737a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x737a('0x2')]();var fs_extra=require(_0x737a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x737a('0x4'));router[_0x737a('0x5')]('/',auth[_0x737a('0x6')](),controller[_0x737a('0x7')]);router[_0x737a('0x5')]('/:id',auth[_0x737a('0x6')](),controller[_0x737a('0x8')]);router[_0x737a('0x9')]('/',auth[_0x737a('0x6')](),controller['create']);router[_0x737a('0xa')](_0x737a('0xb'),auth['isAuthenticated'](),controller[_0x737a('0xc')]);router[_0x737a('0xd')](_0x737a('0xb'),auth[_0x737a('0x6')](),controller[_0x737a('0xe')]);module[_0x737a('0xf')]=router; \ No newline at end of file +var _0x5785=['../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0x5785,0x119));var _0x5578=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x5785[_0x468b0f];return _0x3e74d9;};'use strict';var multer=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var path=require(_0x5578('0x2'));var timeout=require(_0x5578('0x3'));var express=require(_0x5578('0x4'));var router=express['Router']();var fs_extra=require(_0x5578('0x5'));var auth=require(_0x5578('0x6'));var interaction=require(_0x5578('0x7'));var config=require(_0x5578('0x8'));var controller=require(_0x5578('0x9'));router[_0x5578('0xa')]('/',auth[_0x5578('0xb')](),controller[_0x5578('0xc')]);router[_0x5578('0xa')](_0x5578('0xd'),auth['isAuthenticated'](),controller[_0x5578('0xe')]);router[_0x5578('0xf')]('/',auth[_0x5578('0xb')](),controller['create']);router[_0x5578('0x10')]('/:id',auth[_0x5578('0xb')](),controller['update']);router[_0x5578('0x11')](_0x5578('0xd'),auth[_0x5578('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 8a6dd55..f6cf58a 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 _0xdedc=['TEXT','sequelize'];(function(_0x2dcefe,_0x1b804a){var _0x47c352=function(_0x1a4fdf){while(--_0x1a4fdf){_0x2dcefe['push'](_0x2dcefe['shift']());}};_0x47c352(++_0x1b804a);}(_0xdedc,0x151));var _0xcded=function(_0x4b078b,_0x53030c){_0x4b078b=_0x4b078b-0x0;var _0x4bc65c=_0xdedc[_0x4b078b];return _0x4bc65c;};'use strict';var Sequelize=require(_0xcded('0x0'));module['exports']={'tree':{'type':Sequelize[_0xcded('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5142=['TEXT','sequelize','exports'];(function(_0x58c654,_0x56f774){var _0x1b1164=function(_0x4ed7db){while(--_0x4ed7db){_0x58c654['push'](_0x58c654['shift']());}};_0x1b1164(++_0x56f774);}(_0x5142,0xbb));var _0x2514=function(_0x1e3d2a,_0x103793){_0x1e3d2a=_0x1e3d2a-0x0;var _0x18c87e=_0x5142[_0x1e3d2a];return _0x18c87e;};'use strict';var Sequelize=require(_0x2514('0x0'));module[_0x2514('0x1')]={'tree':{'type':Sequelize[_0x2514('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 14476c5..5e0c49f 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 _0x610c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','AnalyticTreeReport','findAll','rows','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x610c,0x1b4));var _0xc610=function(_0x31281a,_0x10040e){_0x31281a=_0x31281a-0x0;var _0x23aa3f=_0x610c[_0x31281a];return _0x23aa3f;};'use strict';var emlformat=require(_0xc610('0x0'));var rimraf=require(_0xc610('0x1'));var zipdir=require(_0xc610('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc610('0x3'));var moment=require(_0xc610('0x4'));var BPromise=require(_0xc610('0x5'));var Mustache=require(_0xc610('0x6'));var util=require(_0xc610('0x7'));var path=require(_0xc610('0x8'));var sox=require(_0xc610('0x9'));var csv=require('to-csv');var ejs=require(_0xc610('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc610('0xb'));var squel=require(_0xc610('0xc'));var crypto=require(_0xc610('0xd'));var jsforce=require(_0xc610('0xe'));var deskjs=require(_0xc610('0xf'));var toCsv=require(_0xc610('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc610('0x11'));var authService=require(_0xc610('0x12'));var qs=require(_0xc610('0x13'));var as=require(_0xc610('0x14'));var hardwareService=require(_0xc610('0x15'));var logger=require('../../config/logger')(_0xc610('0x16'));var utils=require(_0xc610('0x17'));var config=require(_0xc610('0x18'));var licenseUtil=require(_0xc610('0x19'));var db=require(_0xc610('0x1a'))['db'];function respondWithStatusCode(_0x88bac0,_0x26f697){_0x26f697=_0x26f697||0xcc;return function(_0x449b69){if(_0x449b69){return _0x88bac0[_0xc610('0x1b')](_0x26f697);}return _0x88bac0[_0xc610('0x1c')](_0x26f697)[_0xc610('0x1d')]();};}function respondWithResult(_0x2b4070,_0x28ef86){_0x28ef86=_0x28ef86||0xc8;return function(_0x494c1c){if(_0x494c1c){return _0x2b4070[_0xc610('0x1c')](_0x28ef86)['json'](_0x494c1c);}};}function respondWithFilteredResult(_0xa1eefc,_0x178373){return function(_0x3d9d17){if(_0x3d9d17){var _0x1432ef=typeof _0x178373['offset']===_0xc610('0x1e')&&typeof _0x178373[_0xc610('0x1f')]===_0xc610('0x1e');var _0x3441de=_0x3d9d17[_0xc610('0x20')];var _0x2caa07=_0x1432ef?0x0:_0x178373[_0xc610('0x21')];var _0x139e16=_0x1432ef?_0x3d9d17[_0xc610('0x20')]:_0x178373[_0xc610('0x21')]+_0x178373['limit'];var _0x114dab;if(_0x139e16>=_0x3441de){_0x139e16=_0x3441de;_0x114dab=0xc8;}else{_0x114dab=0xce;}_0xa1eefc[_0xc610('0x1c')](_0x114dab);return _0xa1eefc['set']('Content-Range',_0x2caa07+'-'+_0x139e16+'/'+_0x3441de)[_0xc610('0x22')](_0x3d9d17);}return null;};}function patchUpdates(_0x171e79){return function(_0x376d8f){try{jsonpatch[_0xc610('0x23')](_0x376d8f,_0x171e79,!![]);}catch(_0x2b2f4e){return BPromise[_0xc610('0x24')](_0x2b2f4e);}return _0x376d8f[_0xc610('0x25')]();};}function saveUpdates(_0x5986b8,_0x55a19f){return function(_0x436826){if(_0x436826){return _0x436826[_0xc610('0x26')](_0x5986b8)[_0xc610('0x27')](function(_0x59f3fb){return _0x59f3fb;});}return null;};}function removeEntity(_0x1a9aa4,_0x4e2180){return function(_0x4d2471){if(_0x4d2471){return _0x4d2471[_0xc610('0x28')]()[_0xc610('0x27')](function(){_0x1a9aa4[_0xc610('0x1c')](0xcc)[_0xc610('0x1d')]();});}};}function handleEntityNotFound(_0x4ef396,_0x55a7fd){return function(_0x3e202e){if(!_0x3e202e){_0x4ef396[_0xc610('0x1b')](0x194);}return _0x3e202e;};}function handleError(_0x3ad415,_0x472403){_0x472403=_0x472403||0x1f4;return function(_0x1dd4a9){logger['error'](_0x1dd4a9[_0xc610('0x29')]);if(_0x1dd4a9[_0xc610('0x2a')]){delete _0x1dd4a9[_0xc610('0x2a')];}_0x3ad415[_0xc610('0x1c')](_0x472403)[_0xc610('0x2b')](_0x1dd4a9);};}exports[_0xc610('0x2c')]=function(_0x285839,_0x225ffd){var _0x3353de={},_0x311cdb={},_0x1d70e3={'count':0x0,'rows':[]};var _0x3dde9f=_['map'](db['AnalyticTreeReport'][_0xc610('0x2d')],function(_0x23ad48){return{'name':_0x23ad48[_0xc610('0x2e')],'type':_0x23ad48['type'][_0xc610('0x2f')]};});_0x311cdb[_0xc610('0x30')]=_[_0xc610('0x31')](_0x3dde9f,_0xc610('0x2a'));_0x311cdb[_0xc610('0x32')]=_[_0xc610('0x33')](_0x285839[_0xc610('0x32')]);_0x311cdb['filters']=_['intersection'](_0x311cdb['model'],_0x311cdb[_0xc610('0x32')]);_0x3353de[_0xc610('0x34')]=_[_0xc610('0x35')](_0x311cdb[_0xc610('0x30')],qs[_0xc610('0x36')](_0x285839[_0xc610('0x32')][_0xc610('0x36')]));_0x3353de[_0xc610('0x34')]=_0x3353de[_0xc610('0x34')][_0xc610('0x37')]?_0x3353de[_0xc610('0x34')]:_0x311cdb[_0xc610('0x30')];if(!_0x285839['query']['hasOwnProperty'](_0xc610('0x38'))){_0x3353de[_0xc610('0x1f')]=qs[_0xc610('0x1f')](_0x285839['query'][_0xc610('0x1f')]);_0x3353de['offset']=qs[_0xc610('0x21')](_0x285839[_0xc610('0x32')]['offset']);}_0x3353de['order']=qs[_0xc610('0x39')](_0x285839[_0xc610('0x32')][_0xc610('0x39')]);_0x3353de[_0xc610('0x3a')]=qs[_0xc610('0x3b')](_['pick'](_0x285839['query'],_0x311cdb[_0xc610('0x3b')]),_0x3dde9f);if(_0x285839[_0xc610('0x32')][_0xc610('0x3c')]){_0x3353de[_0xc610('0x3a')]=_[_0xc610('0x3d')](_0x3353de['where'],{'$or':_[_0xc610('0x31')](_0x3dde9f,function(_0x35fa6c){if(_0x35fa6c[_0xc610('0x3e')]!==_0xc610('0x3f')){var _0x34e365={};_0x34e365[_0x35fa6c[_0xc610('0x2a')]]={'$like':'%'+_0x285839[_0xc610('0x32')]['filter']+'%'};return _0x34e365;}})});}_0x3353de=_[_0xc610('0x3d')]({},_0x3353de,_0x285839['options']);var _0x56e4ac={'where':_0x3353de[_0xc610('0x3a')]};return db['AnalyticTreeReport'][_0xc610('0x20')](_0x56e4ac)[_0xc610('0x27')](function(_0x1e1fd7){_0x1d70e3[_0xc610('0x20')]=_0x1e1fd7;if(_0x285839[_0xc610('0x32')][_0xc610('0x40')]){_0x3353de[_0xc610('0x41')]=[{'all':!![]}];}return db[_0xc610('0x42')][_0xc610('0x43')](_0x3353de);})['then'](function(_0x30f7f4){_0x1d70e3[_0xc610('0x44')]=_0x30f7f4;return _0x1d70e3;})['then'](respondWithFilteredResult(_0x225ffd,_0x3353de))['catch'](handleError(_0x225ffd,null));};exports[_0xc610('0x45')]=function(_0x4c1717,_0x5e476e){var _0x2aad46={'raw':!![],'where':{'id':_0x4c1717[_0xc610('0x46')]['id']}},_0x4bbe4f={};_0x4bbe4f[_0xc610('0x30')]=_[_0xc610('0x33')](db['AnalyticTreeReport']['rawAttributes']);_0x4bbe4f[_0xc610('0x32')]=_[_0xc610('0x33')](_0x4c1717[_0xc610('0x32')]);_0x4bbe4f[_0xc610('0x3b')]=_[_0xc610('0x35')](_0x4bbe4f['model'],_0x4bbe4f['query']);_0x2aad46[_0xc610('0x34')]=_[_0xc610('0x35')](_0x4bbe4f[_0xc610('0x30')],qs[_0xc610('0x36')](_0x4c1717[_0xc610('0x32')][_0xc610('0x36')]));_0x2aad46[_0xc610('0x34')]=_0x2aad46[_0xc610('0x34')][_0xc610('0x37')]?_0x2aad46[_0xc610('0x34')]:_0x4bbe4f[_0xc610('0x30')];if(_0x4c1717['query'][_0xc610('0x40')]){_0x2aad46[_0xc610('0x41')]=[{'all':!![]}];}_0x2aad46=_[_0xc610('0x3d')]({},_0x2aad46,_0x4c1717[_0xc610('0x47')]);return db[_0xc610('0x42')][_0xc610('0x48')](_0x2aad46)[_0xc610('0x27')](handleEntityNotFound(_0x5e476e,null))['then'](respondWithResult(_0x5e476e,null))[_0xc610('0x49')](handleError(_0x5e476e,null));};exports[_0xc610('0x4a')]=function(_0x4c1135,_0x455f70){return db[_0xc610('0x42')][_0xc610('0x4a')](_0x4c1135[_0xc610('0x4b')],{})[_0xc610('0x27')](respondWithResult(_0x455f70,0xc9))[_0xc610('0x49')](handleError(_0x455f70,null));};exports[_0xc610('0x26')]=function(_0x47b94a,_0x42b85a){if(_0x47b94a[_0xc610('0x4b')]['id']){delete _0x47b94a[_0xc610('0x4b')]['id'];}return db[_0xc610('0x42')]['find']({'where':{'id':_0x47b94a[_0xc610('0x46')]['id']}})['then'](handleEntityNotFound(_0x42b85a,null))[_0xc610('0x27')](saveUpdates(_0x47b94a[_0xc610('0x4b')],null))['then'](respondWithResult(_0x42b85a,null))[_0xc610('0x49')](handleError(_0x42b85a,null));};exports[_0xc610('0x28')]=function(_0x10c1bb,_0x48ff77){return db[_0xc610('0x42')][_0xc610('0x48')]({'where':{'id':_0x10c1bb[_0xc610('0x46')]['id']}})[_0xc610('0x27')](handleEntityNotFound(_0x48ff77,null))[_0xc610('0x27')](removeEntity(_0x48ff77,null))[_0xc610('0x49')](handleError(_0x48ff77,null));}; \ No newline at end of file +var _0xdd52=['params','keys','includeAll','merge','find','create','body','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','include','findAll','rows','catch','show'];(function(_0x1eccef,_0x1181d4){var _0x51c6f2=function(_0x151fba){while(--_0x151fba){_0x1eccef['push'](_0x1eccef['shift']());}};_0x51c6f2(++_0x1181d4);}(_0xdd52,0xa9));var _0x2dd5=function(_0x11a2e9,_0x3c112b){_0x11a2e9=_0x11a2e9-0x0;var _0x20388f=_0xdd52[_0x11a2e9];return _0x20388f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2dd5('0x0'));var zipdir=require(_0x2dd5('0x1'));var jsonpatch=require(_0x2dd5('0x2'));var rp=require(_0x2dd5('0x3'));var moment=require(_0x2dd5('0x4'));var BPromise=require(_0x2dd5('0x5'));var Mustache=require(_0x2dd5('0x6'));var util=require(_0x2dd5('0x7'));var path=require(_0x2dd5('0x8'));var sox=require(_0x2dd5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2dd5('0xa'));var _=require(_0x2dd5('0xb'));var squel=require(_0x2dd5('0xc'));var crypto=require(_0x2dd5('0xd'));var jsforce=require(_0x2dd5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2dd5('0xf'));var querystring=require(_0x2dd5('0x10'));var Papa=require(_0x2dd5('0x11'));var Redis=require(_0x2dd5('0x12'));var authService=require(_0x2dd5('0x13'));var qs=require(_0x2dd5('0x14'));var as=require(_0x2dd5('0x15'));var hardwareService=require(_0x2dd5('0x16'));var logger=require(_0x2dd5('0x17'))(_0x2dd5('0x18'));var utils=require(_0x2dd5('0x19'));var config=require(_0x2dd5('0x1a'));var licenseUtil=require(_0x2dd5('0x1b'));var db=require(_0x2dd5('0x1c'))['db'];function respondWithStatusCode(_0x3b8371,_0xaf3738){_0xaf3738=_0xaf3738||0xcc;return function(_0x293e85){if(_0x293e85){return _0x3b8371[_0x2dd5('0x1d')](_0xaf3738);}return _0x3b8371[_0x2dd5('0x1e')](_0xaf3738)[_0x2dd5('0x1f')]();};}function respondWithResult(_0x5d19be,_0x93d250){_0x93d250=_0x93d250||0xc8;return function(_0x208266){if(_0x208266){return _0x5d19be[_0x2dd5('0x1e')](_0x93d250)[_0x2dd5('0x20')](_0x208266);}};}function respondWithFilteredResult(_0x153cc1,_0x72d724){return function(_0x162fe3){if(_0x162fe3){var _0x203544=typeof _0x72d724[_0x2dd5('0x21')]===_0x2dd5('0x22')&&typeof _0x72d724[_0x2dd5('0x23')]===_0x2dd5('0x22');var _0x2e95d6=_0x162fe3['count'];var _0x1f17e1=_0x203544?0x0:_0x72d724[_0x2dd5('0x21')];var _0x159e30=_0x203544?_0x162fe3[_0x2dd5('0x24')]:_0x72d724['offset']+_0x72d724['limit'];var _0xcc557d;if(_0x159e30>=_0x2e95d6){_0x159e30=_0x2e95d6;_0xcc557d=0xc8;}else{_0xcc557d=0xce;}_0x153cc1['status'](_0xcc557d);return _0x153cc1[_0x2dd5('0x25')]('Content-Range',_0x1f17e1+'-'+_0x159e30+'/'+_0x2e95d6)[_0x2dd5('0x20')](_0x162fe3);}return null;};}function patchUpdates(_0x169f9f){return function(_0x423f1d){try{jsonpatch[_0x2dd5('0x26')](_0x423f1d,_0x169f9f,!![]);}catch(_0x4d67bf){return BPromise[_0x2dd5('0x27')](_0x4d67bf);}return _0x423f1d[_0x2dd5('0x28')]();};}function saveUpdates(_0x3a75da,_0x512280){return function(_0x545e6a){if(_0x545e6a){return _0x545e6a[_0x2dd5('0x29')](_0x3a75da)[_0x2dd5('0x2a')](function(_0x4911cf){return _0x4911cf;});}return null;};}function removeEntity(_0x5bbde9,_0x4e65de){return function(_0x2d6d6b){if(_0x2d6d6b){return _0x2d6d6b[_0x2dd5('0x2b')]()['then'](function(){_0x5bbde9[_0x2dd5('0x1e')](0xcc)[_0x2dd5('0x1f')]();});}};}function handleEntityNotFound(_0x505708,_0x42a6af){return function(_0x4e556e){if(!_0x4e556e){_0x505708['sendStatus'](0x194);}return _0x4e556e;};}function handleError(_0x48f8d5,_0x4f299a){_0x4f299a=_0x4f299a||0x1f4;return function(_0x324075){logger[_0x2dd5('0x2c')](_0x324075[_0x2dd5('0x2d')]);if(_0x324075['name']){delete _0x324075[_0x2dd5('0x2e')];}_0x48f8d5[_0x2dd5('0x1e')](_0x4f299a)[_0x2dd5('0x2f')](_0x324075);};}exports[_0x2dd5('0x30')]=function(_0x4d7066,_0x4614fe){var _0x5bea29={},_0x56aa79={},_0x2cb076={'count':0x0,'rows':[]};var _0x435d18=_[_0x2dd5('0x31')](db[_0x2dd5('0x32')][_0x2dd5('0x33')],function(_0x36d875){return{'name':_0x36d875[_0x2dd5('0x34')],'type':_0x36d875[_0x2dd5('0x35')][_0x2dd5('0x36')]};});_0x56aa79[_0x2dd5('0x37')]=_['map'](_0x435d18,'name');_0x56aa79['query']=_['keys'](_0x4d7066['query']);_0x56aa79[_0x2dd5('0x38')]=_[_0x2dd5('0x39')](_0x56aa79[_0x2dd5('0x37')],_0x56aa79[_0x2dd5('0x3a')]);_0x5bea29[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0x56aa79['model'],qs[_0x2dd5('0x3c')](_0x4d7066['query'][_0x2dd5('0x3c')]));_0x5bea29[_0x2dd5('0x3b')]=_0x5bea29[_0x2dd5('0x3b')][_0x2dd5('0x3d')]?_0x5bea29[_0x2dd5('0x3b')]:_0x56aa79['model'];if(!_0x4d7066[_0x2dd5('0x3a')][_0x2dd5('0x3e')](_0x2dd5('0x3f'))){_0x5bea29['limit']=qs[_0x2dd5('0x23')](_0x4d7066[_0x2dd5('0x3a')][_0x2dd5('0x23')]);_0x5bea29[_0x2dd5('0x21')]=qs[_0x2dd5('0x21')](_0x4d7066[_0x2dd5('0x3a')]['offset']);}_0x5bea29['order']=qs[_0x2dd5('0x40')](_0x4d7066[_0x2dd5('0x3a')][_0x2dd5('0x40')]);_0x5bea29[_0x2dd5('0x41')]=qs['filters'](_['pick'](_0x4d7066[_0x2dd5('0x3a')],_0x56aa79[_0x2dd5('0x38')]),_0x435d18);if(_0x4d7066[_0x2dd5('0x3a')][_0x2dd5('0x42')]){_0x5bea29[_0x2dd5('0x41')]=_['merge'](_0x5bea29[_0x2dd5('0x41')],{'$or':_['map'](_0x435d18,function(_0x142071){if(_0x142071['type']!==_0x2dd5('0x43')){var _0x36565d={};_0x36565d[_0x142071[_0x2dd5('0x2e')]]={'$like':'%'+_0x4d7066[_0x2dd5('0x3a')][_0x2dd5('0x42')]+'%'};return _0x36565d;}})});}_0x5bea29=_['merge']({},_0x5bea29,_0x4d7066[_0x2dd5('0x44')]);var _0x1dd56e={'where':_0x5bea29['where']};return db['AnalyticTreeReport'][_0x2dd5('0x24')](_0x1dd56e)[_0x2dd5('0x2a')](function(_0x429e0e){_0x2cb076[_0x2dd5('0x24')]=_0x429e0e;if(_0x4d7066['query']['includeAll']){_0x5bea29[_0x2dd5('0x45')]=[{'all':!![]}];}return db[_0x2dd5('0x32')][_0x2dd5('0x46')](_0x5bea29);})[_0x2dd5('0x2a')](function(_0x4e45ac){_0x2cb076[_0x2dd5('0x47')]=_0x4e45ac;return _0x2cb076;})[_0x2dd5('0x2a')](respondWithFilteredResult(_0x4614fe,_0x5bea29))[_0x2dd5('0x48')](handleError(_0x4614fe,null));};exports[_0x2dd5('0x49')]=function(_0x456f24,_0x276f84){var _0x5fa1b1={'raw':!![],'where':{'id':_0x456f24[_0x2dd5('0x4a')]['id']}},_0xc75a25={};_0xc75a25['model']=_[_0x2dd5('0x4b')](db[_0x2dd5('0x32')][_0x2dd5('0x33')]);_0xc75a25['query']=_[_0x2dd5('0x4b')](_0x456f24[_0x2dd5('0x3a')]);_0xc75a25[_0x2dd5('0x38')]=_['intersection'](_0xc75a25[_0x2dd5('0x37')],_0xc75a25['query']);_0x5fa1b1[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0xc75a25[_0x2dd5('0x37')],qs['fields'](_0x456f24[_0x2dd5('0x3a')][_0x2dd5('0x3c')]));_0x5fa1b1[_0x2dd5('0x3b')]=_0x5fa1b1[_0x2dd5('0x3b')][_0x2dd5('0x3d')]?_0x5fa1b1[_0x2dd5('0x3b')]:_0xc75a25[_0x2dd5('0x37')];if(_0x456f24[_0x2dd5('0x3a')][_0x2dd5('0x4c')]){_0x5fa1b1['include']=[{'all':!![]}];}_0x5fa1b1=_[_0x2dd5('0x4d')]({},_0x5fa1b1,_0x456f24[_0x2dd5('0x44')]);return db[_0x2dd5('0x32')][_0x2dd5('0x4e')](_0x5fa1b1)[_0x2dd5('0x2a')](handleEntityNotFound(_0x276f84,null))[_0x2dd5('0x2a')](respondWithResult(_0x276f84,null))[_0x2dd5('0x48')](handleError(_0x276f84,null));};exports['create']=function(_0x2bca55,_0x320cb3){return db[_0x2dd5('0x32')][_0x2dd5('0x4f')](_0x2bca55[_0x2dd5('0x50')],{})[_0x2dd5('0x2a')](respondWithResult(_0x320cb3,0xc9))[_0x2dd5('0x48')](handleError(_0x320cb3,null));};exports[_0x2dd5('0x29')]=function(_0x57d0c2,_0x516909){if(_0x57d0c2[_0x2dd5('0x50')]['id']){delete _0x57d0c2[_0x2dd5('0x50')]['id'];}return db[_0x2dd5('0x32')]['find']({'where':{'id':_0x57d0c2['params']['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x516909,null))[_0x2dd5('0x2a')](saveUpdates(_0x57d0c2[_0x2dd5('0x50')],null))[_0x2dd5('0x2a')](respondWithResult(_0x516909,null))[_0x2dd5('0x48')](handleError(_0x516909,null));};exports[_0x2dd5('0x2b')]=function(_0x565e4d,_0x8a7cf6){return db[_0x2dd5('0x32')]['find']({'where':{'id':_0x565e4d[_0x2dd5('0x4a')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x8a7cf6,null))[_0x2dd5('0x2a')](removeEntity(_0x8a7cf6,null))[_0x2dd5('0x48')](handleError(_0x8a7cf6,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e187928..0508fef 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 _0xd8b9=['AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define'];(function(_0xd250ec,_0x446153){var _0x108b01=function(_0x3ce68f){while(--_0x3ce68f){_0xd250ec['push'](_0xd250ec['shift']());}};_0x108b01(++_0x446153);}(_0xd8b9,0x6a));var _0x9d8b=function(_0x25b4b7,_0x315052){_0x25b4b7=_0x25b4b7-0x0;var _0x5edf88=_0xd8b9[_0x25b4b7];return _0x5edf88;};'use strict';var _=require(_0x9d8b('0x0'));var util=require('util');var logger=require(_0x9d8b('0x1'))(_0x9d8b('0x2'));var moment=require(_0x9d8b('0x3'));var BPromise=require(_0x9d8b('0x4'));var rp=require(_0x9d8b('0x5'));var fs=require('fs');var path=require(_0x9d8b('0x6'));var rimraf=require(_0x9d8b('0x7'));var config=require(_0x9d8b('0x8'));var attributes=require(_0x9d8b('0x9'));module['exports']=function(_0x21b3fd,_0x4813ab){return _0x21b3fd[_0x9d8b('0xa')](_0x9d8b('0xb'),attributes,{'tableName':_0x9d8b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5710=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','../../config/logger','api','moment'];(function(_0x169630,_0x2a57b1){var _0x1641dd=function(_0x5aabbb){while(--_0x5aabbb){_0x169630['push'](_0x169630['shift']());}};_0x1641dd(++_0x2a57b1);}(_0x5710,0xb1));var _0x0571=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5710[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0571('0x0'));var util=require(_0x0571('0x1'));var logger=require(_0x0571('0x2'))(_0x0571('0x3'));var moment=require(_0x0571('0x4'));var BPromise=require(_0x0571('0x5'));var rp=require(_0x0571('0x6'));var fs=require('fs');var path=require(_0x0571('0x7'));var rimraf=require(_0x0571('0x8'));var config=require(_0x0571('0x9'));var attributes=require(_0x0571('0xa'));module[_0x0571('0xb')]=function(_0x96ded2,_0x3bbbe7){return _0x96ded2[_0x0571('0xc')]('AnalyticTreeReport',attributes,{'tableName':_0x0571('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index edab94f..127a158 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(_0x5516a1,_0x215ca4){var _0x4a957b=function(_0x39b0e6){while(--_0x39b0e6){_0x5516a1['push'](_0x5516a1['shift']());}};_0x4a957b(++_0x215ca4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2eebf2,_0x15e7ca){var _0x1ca79=function(_0x430405){while(--_0x430405){_0x2eebf2['push'](_0x2eebf2['shift']());}};_0x1ca79(++_0x15e7ca);}(_0x5f2f,0x73));var _0xf5f2=function(_0xe92bc6,_0x35937e){_0xe92bc6=_0xe92bc6-0x0;var _0x4d5b66=_0x5f2f[_0xe92bc6];return _0x4d5b66;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 7a0ffdf..53293c1 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 _0xc03d=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get'];(function(_0x3fdf10,_0x420bb1){var _0x3acf07=function(_0x7dd2ea){while(--_0x7dd2ea){_0x3fdf10['push'](_0x3fdf10['shift']());}};_0x3acf07(++_0x420bb1);}(_0xc03d,0xef));var _0xdc03=function(_0x3d76e8,_0x1f965d){_0x3d76e8=_0x3d76e8-0x0;var _0x198af2=_0xc03d[_0x3d76e8];return _0x198af2;};'use strict';var multer=require(_0xdc03('0x0'));var util=require(_0xdc03('0x1'));var path=require(_0xdc03('0x2'));var timeout=require(_0xdc03('0x3'));var express=require(_0xdc03('0x4'));var router=express[_0xdc03('0x5')]();var fs_extra=require(_0xdc03('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdc03('0x7'));var config=require(_0xdc03('0x8'));var controller=require(_0xdc03('0x9'));router['get']('/',auth[_0xdc03('0xa')](),controller[_0xdc03('0xb')]);router[_0xdc03('0xc')](_0xdc03('0xd'),auth[_0xdc03('0xa')](),controller[_0xdc03('0xe')]);router[_0xdc03('0xf')]('/',auth[_0xdc03('0xa')](),controller[_0xdc03('0x10')]);router[_0xdc03('0x11')](_0xdc03('0xd'),auth[_0xdc03('0xa')](),controller[_0xdc03('0x12')]);router[_0xdc03('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdc03('0x14')]=router; \ No newline at end of file +var _0x5ec2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x5f6171,_0x308104){var _0x3e5257=function(_0x42d8ce){while(--_0x42d8ce){_0x5f6171['push'](_0x5f6171['shift']());}};_0x3e5257(++_0x308104);}(_0x5ec2,0x18a));var _0x25ec=function(_0x2e6dee,_0x1a61b0){_0x2e6dee=_0x2e6dee-0x0;var _0x47706=_0x5ec2[_0x2e6dee];return _0x47706;};'use strict';var multer=require(_0x25ec('0x0'));var util=require(_0x25ec('0x1'));var path=require(_0x25ec('0x2'));var timeout=require(_0x25ec('0x3'));var express=require('express');var router=express[_0x25ec('0x4')]();var fs_extra=require(_0x25ec('0x5'));var auth=require(_0x25ec('0x6'));var interaction=require(_0x25ec('0x7'));var config=require(_0x25ec('0x8'));var controller=require(_0x25ec('0x9'));router[_0x25ec('0xa')]('/',auth[_0x25ec('0xb')](),controller['index']);router[_0x25ec('0xa')](_0x25ec('0xc'),auth[_0x25ec('0xb')](),controller['show']);router[_0x25ec('0xd')]('/',auth[_0x25ec('0xb')](),controller[_0x25ec('0xe')]);router[_0x25ec('0xf')](_0x25ec('0xc'),auth['isAuthenticated'](),controller[_0x25ec('0x10')]);router[_0x25ec('0x11')]('/:id',auth[_0x25ec('0xb')](),controller[_0x25ec('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 5920897..7c03353 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 _0x2d17=['STRING','sequelize','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2d17,0x17e));var _0x72d1=function(_0x5bcae4,_0x5f56d0){_0x5bcae4=_0x5bcae4-0x0;var _0x18289d=_0x2d17[_0x5bcae4];return _0x18289d;};'use strict';var Sequelize=require(_0x72d1('0x0'));module[_0x72d1('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x72d1('0x2')]},'type':{'type':Sequelize[_0x72d1('0x2')]}}; \ No newline at end of file +var _0xbb53=['STRING','sequelize','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xbb53,0x121));var _0x3bb5=function(_0x358436,_0x5c3c5f){_0x358436=_0x358436-0x0;var _0x343cb=_0xbb53[_0x358436];return _0x343cb;};'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 diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 87a5140..5203038 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 _0xe5fd=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','catch','keys','rawAttributes','length','merge','find','clone','params','omit','updatedAt','body','createdAt','create','file','originalname','basename','mimetype','findOne','root','server/files/attachments/','join','download','eml-format','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','fieldName','type','key','model','query','filters','intersection'];(function(_0x372d95,_0x14b2e8){var _0x258f8e=function(_0x62d3c0){while(--_0x62d3c0){_0x372d95['push'](_0x372d95['shift']());}};_0x258f8e(++_0x14b2e8);}(_0xe5fd,0x7d));var _0xde5f=function(_0x23a6b7,_0x5a3533){_0x23a6b7=_0x23a6b7-0x0;var _0x43bf1f=_0xe5fd[_0x23a6b7];return _0x43bf1f;};'use strict';var emlformat=require(_0xde5f('0x0'));var rimraf=require(_0xde5f('0x1'));var zipdir=require(_0xde5f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde5f('0x3'));var moment=require(_0xde5f('0x4'));var BPromise=require(_0xde5f('0x5'));var Mustache=require(_0xde5f('0x6'));var util=require(_0xde5f('0x7'));var path=require(_0xde5f('0x8'));var sox=require(_0xde5f('0x9'));var csv=require(_0xde5f('0xa'));var ejs=require(_0xde5f('0xb'));var fs=require('fs');var fs_extra=require(_0xde5f('0xc'));var _=require(_0xde5f('0xd'));var squel=require('squel');var crypto=require(_0xde5f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xde5f('0xf'));var toCsv=require(_0xde5f('0xa'));var querystring=require(_0xde5f('0x10'));var Papa=require(_0xde5f('0x11'));var Redis=require(_0xde5f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xde5f('0x13'));var hardwareService=require(_0xde5f('0x14'));var logger=require(_0xde5f('0x15'))('api');var utils=require(_0xde5f('0x16'));var config=require(_0xde5f('0x17'));var licenseUtil=require(_0xde5f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44eb64,_0x586236){_0x586236=_0x586236||0xcc;return function(_0x5f3ae1){if(_0x5f3ae1){return _0x44eb64['sendStatus'](_0x586236);}return _0x44eb64[_0xde5f('0x19')](_0x586236)['end']();};}function respondWithResult(_0x5f18a5,_0x1251b5){_0x1251b5=_0x1251b5||0xc8;return function(_0x34f433){if(_0x34f433){return _0x5f18a5['status'](_0x1251b5)['json'](_0x34f433);}};}function respondWithFilteredResult(_0x85ac7c,_0x20215c){return function(_0x4312e8){if(_0x4312e8){var _0x9bac3a=typeof _0x20215c[_0xde5f('0x1a')]===_0xde5f('0x1b')&&typeof _0x20215c[_0xde5f('0x1c')]==='undefined';var _0x56c110=_0x4312e8['count'];var _0x23a19f=_0x9bac3a?0x0:_0x20215c['offset'];var _0xf232c8=_0x9bac3a?_0x4312e8[_0xde5f('0x1d')]:_0x20215c[_0xde5f('0x1a')]+_0x20215c[_0xde5f('0x1c')];var _0x44f842;if(_0xf232c8>=_0x56c110){_0xf232c8=_0x56c110;_0x44f842=0xc8;}else{_0x44f842=0xce;}_0x85ac7c[_0xde5f('0x19')](_0x44f842);return _0x85ac7c[_0xde5f('0x1e')]('Content-Range',_0x23a19f+'-'+_0xf232c8+'/'+_0x56c110)[_0xde5f('0x1f')](_0x4312e8);}return null;};}function patchUpdates(_0x4ddec9){return function(_0x2ade30){try{jsonpatch[_0xde5f('0x20')](_0x2ade30,_0x4ddec9,!![]);}catch(_0x333918){return BPromise[_0xde5f('0x21')](_0x333918);}return _0x2ade30[_0xde5f('0x22')]();};}function saveUpdates(_0x32c71e,_0x7adf){return function(_0x41c58f){if(_0x41c58f){return _0x41c58f[_0xde5f('0x23')](_0x32c71e)[_0xde5f('0x24')](function(_0x397dd3){return _0x397dd3;});}return null;};}function removeEntity(_0x16fcf,_0x6180ed){return function(_0x586ec3){if(_0x586ec3){return _0x586ec3[_0xde5f('0x25')]()['then'](function(){_0x16fcf[_0xde5f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb013e9,_0x385869){return function(_0xadbd4b){if(!_0xadbd4b){_0xb013e9[_0xde5f('0x26')](0x194);}return _0xadbd4b;};}function handleError(_0x545874,_0x31b07e){_0x31b07e=_0x31b07e||0x1f4;return function(_0x288c90){logger[_0xde5f('0x27')](_0x288c90[_0xde5f('0x28')]);if(_0x288c90[_0xde5f('0x29')]){delete _0x288c90[_0xde5f('0x29')];}_0x545874[_0xde5f('0x19')](_0x31b07e)[_0xde5f('0x2a')](_0x288c90);};}exports[_0xde5f('0x2b')]=function(_0x17ad3c,_0x7f0eb7){var _0x95006e={},_0x391384={},_0x18d335={'count':0x0,'rows':[]};var _0x50f094=_[_0xde5f('0x2c')](db[_0xde5f('0x2d')]['rawAttributes'],function(_0x575366){return{'name':_0x575366[_0xde5f('0x2e')],'type':_0x575366[_0xde5f('0x2f')][_0xde5f('0x30')]};});_0x391384[_0xde5f('0x31')]=_[_0xde5f('0x2c')](_0x50f094,_0xde5f('0x29'));_0x391384['query']=_['keys'](_0x17ad3c[_0xde5f('0x32')]);_0x391384[_0xde5f('0x33')]=_[_0xde5f('0x34')](_0x391384[_0xde5f('0x31')],_0x391384[_0xde5f('0x32')]);_0x95006e[_0xde5f('0x35')]=_[_0xde5f('0x34')](_0x391384[_0xde5f('0x31')],qs[_0xde5f('0x36')](_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x36')]));_0x95006e['attributes']=_0x95006e[_0xde5f('0x35')]['length']?_0x95006e[_0xde5f('0x35')]:_0x391384[_0xde5f('0x31')];if(!_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x37')](_0xde5f('0x38'))){_0x95006e[_0xde5f('0x1c')]=qs[_0xde5f('0x1c')](_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x1c')]);_0x95006e[_0xde5f('0x1a')]=qs[_0xde5f('0x1a')](_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x1a')]);}_0x95006e[_0xde5f('0x39')]=qs[_0xde5f('0x3a')](_0x17ad3c['query']['sort']);_0x95006e[_0xde5f('0x3b')]=qs[_0xde5f('0x33')](_[_0xde5f('0x3c')](_0x17ad3c[_0xde5f('0x32')],_0x391384[_0xde5f('0x33')]),_0x50f094);if(_0x17ad3c[_0xde5f('0x32')]['filter']){_0x95006e[_0xde5f('0x3b')]=_['merge'](_0x95006e[_0xde5f('0x3b')],{'$or':_[_0xde5f('0x2c')](_0x50f094,function(_0x5a80a1){if(_0x5a80a1[_0xde5f('0x2f')]!==_0xde5f('0x3d')){var _0x4fa755={};_0x4fa755[_0x5a80a1[_0xde5f('0x29')]]={'$like':'%'+_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x3e')]+'%'};return _0x4fa755;}})});}_0x95006e=_['merge']({},_0x95006e,_0x17ad3c[_0xde5f('0x3f')]);var _0x2741c3={'where':_0x95006e[_0xde5f('0x3b')]};return db['Attachment'][_0xde5f('0x1d')](_0x2741c3)[_0xde5f('0x24')](function(_0x46c204){_0x18d335[_0xde5f('0x1d')]=_0x46c204;if(_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x40')]){_0x95006e[_0xde5f('0x41')]=[{'all':!![]}];}return db[_0xde5f('0x2d')]['findAll'](_0x95006e);})['then'](function(_0x24df70){_0x18d335[_0xde5f('0x42')]=_0x24df70;return _0x18d335;})[_0xde5f('0x24')](respondWithFilteredResult(_0x7f0eb7,_0x95006e))[_0xde5f('0x43')](handleError(_0x7f0eb7,null));};exports['show']=function(_0x47b6aa,_0x5e41ce){var _0x2556f7={'raw':!![],'where':{'id':_0x47b6aa['params']['id']}},_0x5503d1={};_0x5503d1[_0xde5f('0x31')]=_[_0xde5f('0x44')](db[_0xde5f('0x2d')][_0xde5f('0x45')]);_0x5503d1[_0xde5f('0x32')]=_[_0xde5f('0x44')](_0x47b6aa['query']);_0x5503d1[_0xde5f('0x33')]=_[_0xde5f('0x34')](_0x5503d1[_0xde5f('0x31')],_0x5503d1[_0xde5f('0x32')]);_0x2556f7[_0xde5f('0x35')]=_['intersection'](_0x5503d1[_0xde5f('0x31')],qs['fields'](_0x47b6aa[_0xde5f('0x32')][_0xde5f('0x36')]));_0x2556f7[_0xde5f('0x35')]=_0x2556f7[_0xde5f('0x35')][_0xde5f('0x46')]?_0x2556f7[_0xde5f('0x35')]:_0x5503d1['model'];if(_0x47b6aa[_0xde5f('0x32')]['includeAll']){_0x2556f7['include']=[{'all':!![]}];}_0x2556f7=_[_0xde5f('0x47')]({},_0x2556f7,_0x47b6aa['options']);return db['Attachment'][_0xde5f('0x48')](_0x2556f7)[_0xde5f('0x24')](handleEntityNotFound(_0x5e41ce,null))[_0xde5f('0x24')](respondWithResult(_0x5e41ce,null))[_0xde5f('0x43')](handleError(_0x5e41ce,null));};exports[_0xde5f('0x49')]=function(_0xf9b310,_0x3f99ca){var _0x1a6676={'where':{'id':_0xf9b310[_0xde5f('0x4a')]['id']}},_0xdaef1a={};_0xdaef1a[_0xde5f('0x31')]=_['keys'](db[_0xde5f('0x2d')][_0xde5f('0x45')]);_0x1a6676[_0xde5f('0x35')]=_[_0xde5f('0x34')](_0xdaef1a[_0xde5f('0x31')],qs[_0xde5f('0x36')](_0xf9b310[_0xde5f('0x32')][_0xde5f('0x36')]));_0x1a6676[_0xde5f('0x35')]=_0x1a6676[_0xde5f('0x35')][_0xde5f('0x46')]?_0x1a6676[_0xde5f('0x35')]:_0xdaef1a[_0xde5f('0x31')];if(_0xf9b310['query'][_0xde5f('0x40')]){_0x1a6676[_0xde5f('0x41')]=[{'all':!![]}];}_0x1a6676=_[_0xde5f('0x47')]({},_0x1a6676,_0xf9b310[_0xde5f('0x3f')]);return db[_0xde5f('0x2d')][_0xde5f('0x48')](_0x1a6676)['then'](handleEntityNotFound(_0x3f99ca,null))[_0xde5f('0x24')](function(_0x2f3a53){if(_0x2f3a53){var _0xbe17d4=_0x2f3a53['get']({'plain':!![]});_0xbe17d4=qs[_0xde5f('0x4b')](_0xbe17d4,['id','createdAt',_0xde5f('0x4c')]);_0xf9b310[_0xde5f('0x4d')]=_[_0xde5f('0x4b')](_0xf9b310[_0xde5f('0x4d')],['id',_0xde5f('0x4e'),_0xde5f('0x4c')]);return db[_0xde5f('0x2d')][_0xde5f('0x4f')](_[_0xde5f('0x47')](_0xbe17d4,_0xf9b310[_0xde5f('0x4d')]),{'include':_0xf9b310['query'][_0xde5f('0x40')]?[{'all':!![]}]:undefined});}})[_0xde5f('0x24')](respondWithResult(_0x3f99ca,0xc9))[_0xde5f('0x43')](handleError(_0x3f99ca,null));};exports[_0xde5f('0x23')]=function(_0x3d24ed,_0xc7c722){if(_0x3d24ed['body']['id']){delete _0x3d24ed[_0xde5f('0x4d')]['id'];}return db[_0xde5f('0x2d')][_0xde5f('0x48')]({'where':{'id':_0x3d24ed[_0xde5f('0x4a')]['id']}})[_0xde5f('0x24')](handleEntityNotFound(_0xc7c722,null))['then'](saveUpdates(_0x3d24ed[_0xde5f('0x4d')],null))['then'](respondWithResult(_0xc7c722,null))[_0xde5f('0x43')](handleError(_0xc7c722,null));};exports[_0xde5f('0x25')]=function(_0x390e96,_0x4e173f){return db['Attachment'][_0xde5f('0x48')]({'where':{'id':_0x390e96[_0xde5f('0x4a')]['id']}})[_0xde5f('0x24')](handleEntityNotFound(_0x4e173f,null))['then'](removeEntity(_0x4e173f,null))[_0xde5f('0x43')](handleError(_0x4e173f,null));};exports[_0xde5f('0x4f')]=function(_0x3b9925,_0x2170b4,_0x5b334b){_0x3b9925[_0xde5f('0x4d')][_0xde5f('0x29')]=_0x3b9925[_0xde5f('0x50')][_0xde5f('0x51')];_0x3b9925['body'][_0xde5f('0x52')]=_0x3b9925[_0xde5f('0x50')]['filename'];_0x3b9925[_0xde5f('0x4d')][_0xde5f('0x2f')]=_0x3b9925['file'][_0xde5f('0x53')];return db[_0xde5f('0x2d')][_0xde5f('0x4f')](_0x3b9925[_0xde5f('0x4d')])['then'](respondWithResult(_0x2170b4,0xc9))[_0xde5f('0x43')](handleError(_0x2170b4,null));};exports['download']=function(_0x587178,_0x5b6b14,_0xd5c96d){return db[_0xde5f('0x2d')][_0xde5f('0x54')]({'where':{'id':_0x587178[_0xde5f('0x4a')]['id']},'raw':!![]})[_0xde5f('0x24')](handleEntityNotFound(_0x5b6b14,null))[_0xde5f('0x24')](function(_0x45ec1e){if(_0x45ec1e){var _0x430b69=_0x45ec1e['ChatOfflineMessageId']!==null;var _0x4b4205=path['join'](config[_0xde5f('0x55')],_0xde5f('0x56'));if(_0x430b69){_0x4b4205=path[_0xde5f('0x57')](_0x4b4205,'offline-chat/');}var _0x223512=path[_0xde5f('0x57')](_0x4b4205,_0x45ec1e[_0xde5f('0x52')]);return _0x5b6b14[_0xde5f('0x58')](_0x223512);}})[_0xde5f('0x43')](handleError(_0x5b6b14,null));}; \ No newline at end of file +var _0xd387=['params','includeAll','include','options','find','get','updatedAt','body','omit','create','file','originalname','basename','filename','type','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','sendStatus','error','stack','name','index','map','Attachment','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','findAll','rows','catch','show'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0xd387,0x1ca));var _0x7d38=function(_0xb8eb35,_0x3e0b35){_0xb8eb35=_0xb8eb35-0x0;var _0x35cd19=_0xd387[_0xb8eb35];return _0x35cd19;};'use strict';var emlformat=require(_0x7d38('0x0'));var rimraf=require(_0x7d38('0x1'));var zipdir=require(_0x7d38('0x2'));var jsonpatch=require(_0x7d38('0x3'));var rp=require(_0x7d38('0x4'));var moment=require(_0x7d38('0x5'));var BPromise=require(_0x7d38('0x6'));var Mustache=require(_0x7d38('0x7'));var util=require(_0x7d38('0x8'));var path=require(_0x7d38('0x9'));var sox=require('sox');var csv=require(_0x7d38('0xa'));var ejs=require(_0x7d38('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d38('0xc'));var squel=require(_0x7d38('0xd'));var crypto=require(_0x7d38('0xe'));var jsforce=require(_0x7d38('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7d38('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7d38('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7d38('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d38('0x12'))('api');var utils=require(_0x7d38('0x13'));var config=require(_0x7d38('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d38('0x15'))['db'];function respondWithStatusCode(_0x3f376a,_0x52621f){_0x52621f=_0x52621f||0xcc;return function(_0x5846ab){if(_0x5846ab){return _0x3f376a['sendStatus'](_0x52621f);}return _0x3f376a[_0x7d38('0x16')](_0x52621f)[_0x7d38('0x17')]();};}function respondWithResult(_0xb9a7e9,_0x59945f){_0x59945f=_0x59945f||0xc8;return function(_0x26af27){if(_0x26af27){return _0xb9a7e9[_0x7d38('0x16')](_0x59945f)[_0x7d38('0x18')](_0x26af27);}};}function respondWithFilteredResult(_0x2c075d,_0x1f10fe){return function(_0x12b494){if(_0x12b494){var _0x4b4e5f=typeof _0x1f10fe[_0x7d38('0x19')]===_0x7d38('0x1a')&&typeof _0x1f10fe[_0x7d38('0x1b')]===_0x7d38('0x1a');var _0x24035d=_0x12b494[_0x7d38('0x1c')];var _0x1b8fb1=_0x4b4e5f?0x0:_0x1f10fe[_0x7d38('0x19')];var _0x1e7dec=_0x4b4e5f?_0x12b494['count']:_0x1f10fe[_0x7d38('0x19')]+_0x1f10fe[_0x7d38('0x1b')];var _0x300bd4;if(_0x1e7dec>=_0x24035d){_0x1e7dec=_0x24035d;_0x300bd4=0xc8;}else{_0x300bd4=0xce;}_0x2c075d[_0x7d38('0x16')](_0x300bd4);return _0x2c075d['set'](_0x7d38('0x1d'),_0x1b8fb1+'-'+_0x1e7dec+'/'+_0x24035d)[_0x7d38('0x18')](_0x12b494);}return null;};}function patchUpdates(_0x4ce5fc){return function(_0x275170){try{jsonpatch['apply'](_0x275170,_0x4ce5fc,!![]);}catch(_0x548003){return BPromise[_0x7d38('0x1e')](_0x548003);}return _0x275170[_0x7d38('0x1f')]();};}function saveUpdates(_0xf669ef,_0x2fe995){return function(_0x481614){if(_0x481614){return _0x481614[_0x7d38('0x20')](_0xf669ef)[_0x7d38('0x21')](function(_0x5494d2){return _0x5494d2;});}return null;};}function removeEntity(_0x181a5b,_0x3ad26d){return function(_0xb6da75){if(_0xb6da75){return _0xb6da75['destroy']()[_0x7d38('0x21')](function(){_0x181a5b[_0x7d38('0x16')](0xcc)[_0x7d38('0x17')]();});}};}function handleEntityNotFound(_0x488c70,_0x1ce8dd){return function(_0x54164c){if(!_0x54164c){_0x488c70[_0x7d38('0x22')](0x194);}return _0x54164c;};}function handleError(_0x1e8236,_0x1a5a4a){_0x1a5a4a=_0x1a5a4a||0x1f4;return function(_0x3aaa96){logger[_0x7d38('0x23')](_0x3aaa96[_0x7d38('0x24')]);if(_0x3aaa96['name']){delete _0x3aaa96[_0x7d38('0x25')];}_0x1e8236[_0x7d38('0x16')](_0x1a5a4a)['send'](_0x3aaa96);};}exports[_0x7d38('0x26')]=function(_0x676441,_0x36130c){var _0xd0d3a7={},_0x5a7580={},_0x4d6502={'count':0x0,'rows':[]};var _0x172856=_[_0x7d38('0x27')](db[_0x7d38('0x28')][_0x7d38('0x29')],function(_0x30a2e1){return{'name':_0x30a2e1[_0x7d38('0x2a')],'type':_0x30a2e1['type'][_0x7d38('0x2b')]};});_0x5a7580['model']=_['map'](_0x172856,_0x7d38('0x25'));_0x5a7580['query']=_[_0x7d38('0x2c')](_0x676441[_0x7d38('0x2d')]);_0x5a7580['filters']=_[_0x7d38('0x2e')](_0x5a7580[_0x7d38('0x2f')],_0x5a7580['query']);_0xd0d3a7[_0x7d38('0x30')]=_[_0x7d38('0x2e')](_0x5a7580['model'],qs[_0x7d38('0x31')](_0x676441[_0x7d38('0x2d')][_0x7d38('0x31')]));_0xd0d3a7[_0x7d38('0x30')]=_0xd0d3a7[_0x7d38('0x30')]['length']?_0xd0d3a7['attributes']:_0x5a7580[_0x7d38('0x2f')];if(!_0x676441['query'][_0x7d38('0x32')](_0x7d38('0x33'))){_0xd0d3a7['limit']=qs[_0x7d38('0x1b')](_0x676441[_0x7d38('0x2d')][_0x7d38('0x1b')]);_0xd0d3a7['offset']=qs[_0x7d38('0x19')](_0x676441[_0x7d38('0x2d')][_0x7d38('0x19')]);}_0xd0d3a7[_0x7d38('0x34')]=qs[_0x7d38('0x35')](_0x676441[_0x7d38('0x2d')]['sort']);_0xd0d3a7[_0x7d38('0x36')]=qs[_0x7d38('0x37')](_[_0x7d38('0x38')](_0x676441[_0x7d38('0x2d')],_0x5a7580[_0x7d38('0x37')]),_0x172856);if(_0x676441[_0x7d38('0x2d')]['filter']){_0xd0d3a7[_0x7d38('0x36')]=_[_0x7d38('0x39')](_0xd0d3a7[_0x7d38('0x36')],{'$or':_['map'](_0x172856,function(_0x371371){if(_0x371371['type']!==_0x7d38('0x3a')){var _0x526f81={};_0x526f81[_0x371371[_0x7d38('0x25')]]={'$like':'%'+_0x676441['query'][_0x7d38('0x3b')]+'%'};return _0x526f81;}})});}_0xd0d3a7=_[_0x7d38('0x39')]({},_0xd0d3a7,_0x676441['options']);var _0x4f8dd6={'where':_0xd0d3a7[_0x7d38('0x36')]};return db[_0x7d38('0x28')]['count'](_0x4f8dd6)['then'](function(_0x170d80){_0x4d6502[_0x7d38('0x1c')]=_0x170d80;if(_0x676441[_0x7d38('0x2d')]['includeAll']){_0xd0d3a7['include']=[{'all':!![]}];}return db['Attachment'][_0x7d38('0x3c')](_0xd0d3a7);})[_0x7d38('0x21')](function(_0x1d8a15){_0x4d6502[_0x7d38('0x3d')]=_0x1d8a15;return _0x4d6502;})[_0x7d38('0x21')](respondWithFilteredResult(_0x36130c,_0xd0d3a7))[_0x7d38('0x3e')](handleError(_0x36130c,null));};exports[_0x7d38('0x3f')]=function(_0x5a4834,_0x5c78a9){var _0xb1093a={'raw':!![],'where':{'id':_0x5a4834[_0x7d38('0x40')]['id']}},_0x20c1be={};_0x20c1be[_0x7d38('0x2f')]=_[_0x7d38('0x2c')](db[_0x7d38('0x28')][_0x7d38('0x29')]);_0x20c1be[_0x7d38('0x2d')]=_[_0x7d38('0x2c')](_0x5a4834[_0x7d38('0x2d')]);_0x20c1be['filters']=_['intersection'](_0x20c1be['model'],_0x20c1be['query']);_0xb1093a['attributes']=_['intersection'](_0x20c1be[_0x7d38('0x2f')],qs['fields'](_0x5a4834[_0x7d38('0x2d')][_0x7d38('0x31')]));_0xb1093a[_0x7d38('0x30')]=_0xb1093a[_0x7d38('0x30')]['length']?_0xb1093a[_0x7d38('0x30')]:_0x20c1be[_0x7d38('0x2f')];if(_0x5a4834['query'][_0x7d38('0x41')]){_0xb1093a[_0x7d38('0x42')]=[{'all':!![]}];}_0xb1093a=_[_0x7d38('0x39')]({},_0xb1093a,_0x5a4834[_0x7d38('0x43')]);return db[_0x7d38('0x28')][_0x7d38('0x44')](_0xb1093a)[_0x7d38('0x21')](handleEntityNotFound(_0x5c78a9,null))[_0x7d38('0x21')](respondWithResult(_0x5c78a9,null))[_0x7d38('0x3e')](handleError(_0x5c78a9,null));};exports['clone']=function(_0x25de27,_0x51d563){var _0x236ed9={'where':{'id':_0x25de27[_0x7d38('0x40')]['id']}},_0x371462={};_0x371462[_0x7d38('0x2f')]=_[_0x7d38('0x2c')](db[_0x7d38('0x28')][_0x7d38('0x29')]);_0x236ed9[_0x7d38('0x30')]=_[_0x7d38('0x2e')](_0x371462[_0x7d38('0x2f')],qs['fields'](_0x25de27[_0x7d38('0x2d')][_0x7d38('0x31')]));_0x236ed9[_0x7d38('0x30')]=_0x236ed9[_0x7d38('0x30')]['length']?_0x236ed9[_0x7d38('0x30')]:_0x371462[_0x7d38('0x2f')];if(_0x25de27[_0x7d38('0x2d')][_0x7d38('0x41')]){_0x236ed9[_0x7d38('0x42')]=[{'all':!![]}];}_0x236ed9=_[_0x7d38('0x39')]({},_0x236ed9,_0x25de27[_0x7d38('0x43')]);return db['Attachment'][_0x7d38('0x44')](_0x236ed9)[_0x7d38('0x21')](handleEntityNotFound(_0x51d563,null))[_0x7d38('0x21')](function(_0x5048cc){if(_0x5048cc){var _0x5b45a9=_0x5048cc[_0x7d38('0x45')]({'plain':!![]});_0x5b45a9=qs['omit'](_0x5b45a9,['id','createdAt',_0x7d38('0x46')]);_0x25de27[_0x7d38('0x47')]=_[_0x7d38('0x48')](_0x25de27[_0x7d38('0x47')],['id','createdAt',_0x7d38('0x46')]);return db[_0x7d38('0x28')][_0x7d38('0x49')](_['merge'](_0x5b45a9,_0x25de27[_0x7d38('0x47')]),{'include':_0x25de27[_0x7d38('0x2d')][_0x7d38('0x41')]?[{'all':!![]}]:undefined});}})[_0x7d38('0x21')](respondWithResult(_0x51d563,0xc9))[_0x7d38('0x3e')](handleError(_0x51d563,null));};exports[_0x7d38('0x20')]=function(_0x382a94,_0x3f287b){if(_0x382a94['body']['id']){delete _0x382a94['body']['id'];}return db[_0x7d38('0x28')][_0x7d38('0x44')]({'where':{'id':_0x382a94[_0x7d38('0x40')]['id']}})['then'](handleEntityNotFound(_0x3f287b,null))[_0x7d38('0x21')](saveUpdates(_0x382a94['body'],null))[_0x7d38('0x21')](respondWithResult(_0x3f287b,null))[_0x7d38('0x3e')](handleError(_0x3f287b,null));};exports['destroy']=function(_0x3e4145,_0x28be2a){return db[_0x7d38('0x28')][_0x7d38('0x44')]({'where':{'id':_0x3e4145[_0x7d38('0x40')]['id']}})[_0x7d38('0x21')](handleEntityNotFound(_0x28be2a,null))[_0x7d38('0x21')](removeEntity(_0x28be2a,null))[_0x7d38('0x3e')](handleError(_0x28be2a,null));};exports['create']=function(_0x1b92d6,_0x1c9e80,_0x27fb3c){_0x1b92d6['body']['name']=_0x1b92d6[_0x7d38('0x4a')][_0x7d38('0x4b')];_0x1b92d6[_0x7d38('0x47')][_0x7d38('0x4c')]=_0x1b92d6[_0x7d38('0x4a')][_0x7d38('0x4d')];_0x1b92d6[_0x7d38('0x47')][_0x7d38('0x4e')]=_0x1b92d6['file'][_0x7d38('0x4f')];return db['Attachment'][_0x7d38('0x49')](_0x1b92d6['body'])['then'](respondWithResult(_0x1c9e80,0xc9))[_0x7d38('0x3e')](handleError(_0x1c9e80,null));};exports[_0x7d38('0x50')]=function(_0x45d099,_0x2e3f0e,_0x5695a5){return db[_0x7d38('0x28')][_0x7d38('0x51')]({'where':{'id':_0x45d099[_0x7d38('0x40')]['id']},'raw':!![]})[_0x7d38('0x21')](handleEntityNotFound(_0x2e3f0e,null))['then'](function(_0x13d7c5){if(_0x13d7c5){var _0x4537af=_0x13d7c5[_0x7d38('0x52')]!==null;var _0x209053=path['join'](config[_0x7d38('0x53')],_0x7d38('0x54'));if(_0x4537af){_0x209053=path['join'](_0x209053,_0x7d38('0x55'));}var _0x311e62=path[_0x7d38('0x56')](_0x209053,_0x13d7c5[_0x7d38('0x4c')]);return _0x2e3f0e[_0x7d38('0x50')](_0x311e62);}})[_0x7d38('0x3e')](handleError(_0x2e3f0e,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 0679cc1..2a519f5 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 _0x8438=['./attachment.attributes','exports','define','attachments','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5292ed,_0x74bd26){var _0x2a2bc7=function(_0x5b3dbe){while(--_0x5b3dbe){_0x5292ed['push'](_0x5292ed['shift']());}};_0x2a2bc7(++_0x74bd26);}(_0x8438,0x13c));var _0x8843=function(_0xe94610,_0x2e3b8b){_0xe94610=_0xe94610-0x0;var _0x9b6f20=_0x8438[_0xe94610];return _0x9b6f20;};'use strict';var _=require(_0x8843('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8843('0x1'));var moment=require(_0x8843('0x2'));var BPromise=require(_0x8843('0x3'));var rp=require(_0x8843('0x4'));var fs=require('fs');var path=require(_0x8843('0x5'));var rimraf=require(_0x8843('0x6'));var config=require(_0x8843('0x7'));var attributes=require(_0x8843('0x8'));module[_0x8843('0x9')]=function(_0x5ee512,_0x213ddc){return _0x5ee512[_0x8843('0xa')]('Attachment',attributes,{'tableName':_0x8843('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4824=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x55ea33,_0x448c1e){var _0x3e4081=function(_0x290b02){while(--_0x290b02){_0x55ea33['push'](_0x55ea33['shift']());}};_0x3e4081(++_0x448c1e);}(_0x4824,0xd9));var _0x4482=function(_0x23ed50,_0x483c69){_0x23ed50=_0x23ed50-0x0;var _0x1eff7d=_0x4824[_0x23ed50];return _0x1eff7d;};'use strict';var _=require(_0x4482('0x0'));var util=require(_0x4482('0x1'));var logger=require(_0x4482('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4482('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4482('0x4'));var rimraf=require(_0x4482('0x5'));var config=require(_0x4482('0x6'));var attributes=require(_0x4482('0x7'));module['exports']=function(_0xa645fc,_0x3fe9fb){return _0xa645fc[_0x4482('0x8')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index d071351..b678bc8 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 _0x202c=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','Attachment','options','raw','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x1e896c,_0x3f9948){var _0xd149d9=function(_0x3281e5){while(--_0x3281e5){_0x1e896c['push'](_0x1e896c['shift']());}};_0xd149d9(++_0x3f9948);}(_0x202c,0x178));var _0xc202=function(_0x5e5d33,_0x3f76f5){_0x5e5d33=_0x5e5d33-0x0;var _0x8d2331=_0x202c[_0x5e5d33];return _0x8d2331;};'use strict';var _=require(_0xc202('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc202('0x1'));var rs=require(_0xc202('0x2'));var fs=require('fs');var Redis=require(_0xc202('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc202('0x4'));var logger=require(_0xc202('0x5'))(_0xc202('0x6'));var config=require(_0xc202('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc202('0x8')][_0xc202('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59563a,_0xc2b3eb,_0x574549){return new BPromise(function(_0x872c1a,_0x5978fe){return client[_0xc202('0xa')](_0x59563a,_0x574549)[_0xc202('0xb')](function(_0x36fcb7){logger[_0xc202('0xc')](_0xc202('0xd'),_0xc2b3eb,_0xc202('0xe'));logger[_0xc202('0xf')](_0xc202('0x10'),_0xc2b3eb,_0xc202('0xe'),JSON[_0xc202('0x11')](_0x36fcb7));if(_0x36fcb7[_0xc202('0x12')]){if(_0x36fcb7['error'][_0xc202('0x13')]===0x1f4){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);return _0x5978fe(_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);}logger['error'](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')]['message']);return _0x872c1a(_0x36fcb7['error']['message']);}else{logger[_0xc202('0xc')]('Attachment,\x20%s,\x20%s',_0xc2b3eb,_0xc202('0xe'));_0x872c1a(_0x36fcb7['result'][_0xc202('0x14')]);}})[_0xc202('0x15')](function(_0x3018c8){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x3018c8);_0x5978fe(_0x3018c8);});});}exports[_0xc202('0x16')]=function(_0x9620a0){var _0x591ecc=this;return new Promise(function(_0x16ec7c,_0x2c5557){return db[_0xc202('0x17')]['create'](_0x9620a0['body'],{'raw':_0x9620a0[_0xc202('0x18')]?_0x9620a0[_0xc202('0x18')][_0xc202('0x19')]===undefined?!![]:![]:!![]})[_0xc202('0xb')](function(_0x2ae3c1){logger['info']('CreateAttachment',_0x9620a0);logger[_0xc202('0xf')]('CreateAttachment',_0x9620a0,JSON[_0xc202('0x11')](_0x2ae3c1));_0x16ec7c(_0x2ae3c1);})[_0xc202('0x15')](function(_0x56e979){logger['error'](_0xc202('0x16'),_0x56e979['message'],_0x9620a0);_0x2c5557(_0x591ecc[_0xc202('0x12')](0x1f4,_0x56e979[_0xc202('0x14')]));});});}; \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','options','raw'];(function(_0x2f0bfc,_0x1e0d82){var _0x2e4ed1=function(_0x1f3821){while(--_0x1f3821){_0x2f0bfc['push'](_0x2f0bfc['shift']());}};_0x2e4ed1(++_0x1e0d82);}(_0x34e8,0x12c));var _0x834e=function(_0x39bd93,_0x1cd986){_0x39bd93=_0x39bd93-0x0;var _0x368ce7=_0x34e8[_0x39bd93];return _0x368ce7;};'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')]('Attachment,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('Attachment,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});}exports[_0x834e('0x19')]=function(_0x211e9a){var _0x34e41a=this;return new Promise(function(_0xb993a1,_0x237947){return db[_0x834e('0x1a')][_0x834e('0x1b')](_0x211e9a['body'],{'raw':_0x211e9a[_0x834e('0x1c')]?_0x211e9a[_0x834e('0x1c')][_0x834e('0x1d')]===undefined?!![]:![]:!![]})[_0x834e('0xd')](function(_0x4ab05d){logger[_0x834e('0xe')](_0x834e('0x19'),_0x211e9a);logger['debug'](_0x834e('0x19'),_0x211e9a,JSON[_0x834e('0x13')](_0x4ab05d));_0xb993a1(_0x4ab05d);})[_0x834e('0x18')](function(_0x5c55ca){logger['error'](_0x834e('0x19'),_0x5c55ca[_0x834e('0x16')],_0x211e9a);_0x237947(_0x34e41a['error'](0x1f4,_0x5c55ca[_0x834e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 88f0783..346b227 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x509e7f,_0x2d9f99){var _0x28a735=function(_0x1c080a){while(--_0x1c080a){_0x509e7f['push'](_0x509e7f['shift']());}};_0x28a735(++_0x2d9f99);}(_0xb10b,0x12a));var _0xbb10=function(_0x14eb9e,_0x29fe9e){_0x14eb9e=_0x14eb9e-0x0;var _0x4c59c4=_0xb10b[_0x14eb9e];return _0x4c59c4;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x5891f6,_0x280aef){var _0x33114b=function(_0x580fd8){while(--_0x580fd8){_0x5891f6['push'](_0x5891f6['shift']());}};_0x33114b(++_0x280aef);}(_0x757a,0xde));var _0xa757=function(_0x18f693,_0x312616){_0x18f693=_0x18f693-0x0;var _0x13a5c9=_0x757a[_0x18f693];return _0x13a5c9;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 071b8b7..1e1e60b 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 _0x8ba5=['../../mysqldb','../../components/auth/service','../../config/logger','activedirectory','undefined','baseDN','url','domain','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','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','user','then','getLicense','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','util'];(function(_0x426bdf,_0x45f9be){var _0x5aad3a=function(_0x2ead03){while(--_0x2ead03){_0x426bdf['push'](_0x426bdf['shift']());}};_0x5aad3a(++_0x45f9be);}(_0x8ba5,0x1da));var _0x58ba=function(_0x2199db,_0x64fe69){_0x2199db=_0x2199db-0x0;var _0x1823bc=_0x8ba5[_0x2199db];return _0x1823bc;};'use strict';var passport=require(_0x58ba('0x0'));var LocalStrategy=require(_0x58ba('0x1'))[_0x58ba('0x2')];var moment=require(_0x58ba('0x3'));var ActiveDirectory=require(_0x58ba('0x4'));var BPromise=require('bluebird');var util=require(_0x58ba('0x5'));var db=require(_0x58ba('0x6'))['db'];var authService=require(_0x58ba('0x7'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0x58ba('0x8'))('api');function isActiveDirectoryConfigured(_0x4fb96e){var _0x48b43b=![];if(typeof _0x4fb96e[_0x58ba('0x9')]!==_0x58ba('0xa')){_0x48b43b=_0x4fb96e[_0x58ba('0x9')][_0x58ba('0xb')]&&_0x4fb96e['activedirectory'][_0x58ba('0xc')]&&_0x4fb96e['activedirectory'][_0x58ba('0xd')];}return _0x48b43b;}function adAuthenticate(_0x223b7e,_0x63c802,_0x5b1607){return new BPromise(function(_0x44bf4d,_0x57a2e5){try{var _0xfbe7f1=new ActiveDirectory(_0x223b7e);_0xfbe7f1['authenticate'](_0x63c802,_0x5b1607,function(_0x4ba989,_0x11aa55){if(_0x4ba989){logger[_0x58ba('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x63c802,util[_0x58ba('0xf')](_0x4ba989,{'showHidden':![],'depth':null}));_0x57a2e5(_0x58ba('0x10'));}else if(!_0x11aa55){logger[_0x58ba('0xe')](_0x58ba('0x11'),_0x63c802);_0x57a2e5(_0x58ba('0x10'));}else{_0x44bf4d(_0x11aa55);}});}catch(_0x5b6cc0){_0x57a2e5(_0x5b6cc0);}});}function ActiveDirectoryAuthenticate(_0x2be273,_0x235a5a,_0x4c5cd1,_0x43107d){var _0x3dbbdb,_0x464b8e;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x58ba('0x12'),_0x235a5a);return _0x43107d(null,![],{'message':_0x58ba('0x10')});}return db['Setting'][_0x58ba('0x13')]({'where':{'id':0x1},'attributes':[_0x58ba('0x14'),_0x58ba('0x15')],'raw':!![]})['then'](function(_0x5783de){_0x3dbbdb=_0x5783de;if(!_0x3dbbdb[_0x58ba('0x14')]){logger[_0x58ba('0xe')](_0x58ba('0x16'),_0x235a5a);throw new Error(_0x58ba('0x10'));}return _0x2be273[_0x58ba('0x13')]({'attributes':['id',_0x58ba('0x17'),_0x58ba('0x18'),_0x58ba('0x19'),_0x58ba('0x1a'),_0x58ba('0x1b'),_0x58ba('0x1c'),_0x58ba('0x1d'),_0x58ba('0x1e')],'where':{'name':_0x235a5a,'role':{'$or':['admin',_0x58ba('0x1f'),'agent']},'adSsoEnabled':!![]}});})[_0x58ba('0x20')](function(_0x78c779){if(!_0x78c779||_0x78c779&&_0x78c779[_0x58ba('0x17')]!==_0x235a5a){throw new Error(_0x58ba('0x10'));}_0x464b8e=_0x78c779;var _0x3d8b11=_0x464b8e[_0x58ba('0x17')]+'@'+config['activedirectory'][_0x58ba('0xd')];return adAuthenticate(config['activedirectory'],_0x3d8b11,_0x4c5cd1);})[_0x58ba('0x20')](function(_0x56d333){if(_0x464b8e[_0x58ba('0x1b')]){throw new Error(_0x58ba('0x10'));}if(_0x3dbbdb[_0x58ba('0x15')]>0x0){if(_0x464b8e[_0x58ba('0x1c')]){if(moment(_0x464b8e[_0x58ba('0x1d')])['add'](_0x3dbbdb[_0x58ba('0x15')],'minutes')>moment()){throw new Error(_0x58ba('0x10'));}return utils['clearBlockUser'](_0x464b8e,0x0,![],null)[_0x58ba('0x20')](function(){return utils['getLicense'](_0x464b8e);})[_0x58ba('0x20')](function(){return _0x43107d(null,_0x464b8e);});}else{return utils[_0x58ba('0x21')](_0x464b8e)[_0x58ba('0x20')](function(){return _0x43107d(null,_0x464b8e);});}}else{return utils[_0x58ba('0x21')](_0x464b8e)['then'](function(){return _0x43107d(null,_0x464b8e);});}})['catch'](function(_0x13e87b){return _0x43107d(null,![],_0x13e87b);});}function handleError(_0x596236,_0x30238b,_0x14cf8a){return _0x596236['status'](_0x30238b||0x1f4)['send']({'message':_0x14cf8a?_0x14cf8a['message']||_0x14cf8a:''});}exports['login']=function(_0x7d7698,_0x157ed0,_0x40fa38){passport[_0x58ba('0x22')](_0x58ba('0x23'),function(_0x447638,_0x4abae0,_0x50c59e){var _0x4651fa=_0x447638||_0x50c59e;if(_0x4651fa){return handleError(_0x157ed0,0x191,_0x4651fa);}if(!_0x4abae0){return handleError(_0x157ed0,0x194,{'message':_0x58ba('0x24')});}else{var _0x36714c={'payload':{'id':_0x4abae0['id'],'role':_0x4abae0[_0x58ba('0x1a')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x36714c)['then'](function(_0x3cd688){_0x157ed0[_0x58ba('0x25')]({'id':_0x4abae0['id'],'token':_0x3cd688,'statusCall':'','isAlreadyLogged':_0x4abae0[_0x58ba('0x1e')]});});}})(_0x7d7698,_0x157ed0,_0x40fa38);};passport[_0x58ba('0x26')](_0x58ba('0x23'),new LocalStrategy({'usernameField':'name','passwordField':_0x58ba('0x18')},function(_0x13aefd,_0x288d61,_0x3bbb99){return ActiveDirectoryAuthenticate(db[_0x58ba('0x27')],_0x13aefd,_0x288d61,_0x3bbb99);})); \ No newline at end of file +var _0x697e=['status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','ad-login','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/environment','activedirectory','undefined','baseDN','url','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','admin','agent','domain','blockedAt','clearBlockUser','getLicense','catch'];(function(_0x2a5bc6,_0x4f72e3){var _0x22348a=function(_0x4bb6a6){while(--_0x4bb6a6){_0x2a5bc6['push'](_0x2a5bc6['shift']());}};_0x22348a(++_0x4f72e3);}(_0x697e,0x178));var _0xe697=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x697e[_0x20a584];return _0x4b41a8;};'use strict';var passport=require(_0xe697('0x0'));var LocalStrategy=require(_0xe697('0x1'))[_0xe697('0x2')];var moment=require(_0xe697('0x3'));var ActiveDirectory=require(_0xe697('0x4'));var BPromise=require(_0xe697('0x5'));var util=require(_0xe697('0x6'));var db=require(_0xe697('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0xe697('0x8'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x4908df){var _0x2cfd52=![];if(typeof _0x4908df[_0xe697('0x9')]!==_0xe697('0xa')){_0x2cfd52=_0x4908df['activedirectory'][_0xe697('0xb')]&&_0x4908df[_0xe697('0x9')][_0xe697('0xc')]&&_0x4908df[_0xe697('0x9')]['domain'];}return _0x2cfd52;}function adAuthenticate(_0x5c845d,_0x33787b,_0x713797){return new BPromise(function(_0x390a7a,_0x53daef){try{var _0x341b76=new ActiveDirectory(_0x5c845d);_0x341b76[_0xe697('0xd')](_0x33787b,_0x713797,function(_0x1bc10e,_0x4286ef){if(_0x1bc10e){logger['error'](_0xe697('0xe'),_0x33787b,util[_0xe697('0xf')](_0x1bc10e,{'showHidden':![],'depth':null}));_0x53daef(_0xe697('0x10'));}else if(!_0x4286ef){logger['error'](_0xe697('0x11'),_0x33787b);_0x53daef(_0xe697('0x10'));}else{_0x390a7a(_0x4286ef);}});}catch(_0x142140){_0x53daef(_0x142140);}});}function ActiveDirectoryAuthenticate(_0x2abd5d,_0x25cc29,_0x31a514,_0x203e48){var _0x12128d,_0x5ce42c;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xe697('0x12'),_0x25cc29);return _0x203e48(null,![],{'message':_0xe697('0x10')});}return db[_0xe697('0x13')][_0xe697('0x14')]({'where':{'id':0x1},'attributes':[_0xe697('0x15'),_0xe697('0x16')],'raw':!![]})[_0xe697('0x17')](function(_0x37f417){_0x12128d=_0x37f417;if(!_0x12128d[_0xe697('0x15')]){logger['error'](_0xe697('0x18'),_0x25cc29);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x2abd5d['findOne']({'attributes':['id',_0xe697('0x19'),_0xe697('0x1a'),_0xe697('0x1b'),_0xe697('0x1c'),_0xe697('0x1d'),_0xe697('0x1e'),'blockedAt','online'],'where':{'name':_0x25cc29,'role':{'$or':[_0xe697('0x1f'),'user',_0xe697('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x26b78d){if(!_0x26b78d||_0x26b78d&&_0x26b78d[_0xe697('0x19')]!==_0x25cc29){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x5ce42c=_0x26b78d;var _0xfd7965=_0x5ce42c[_0xe697('0x19')]+'@'+config[_0xe697('0x9')][_0xe697('0x21')];return adAuthenticate(config['activedirectory'],_0xfd7965,_0x31a514);})[_0xe697('0x17')](function(_0x15746f){if(_0x5ce42c[_0xe697('0x1d')]){throw new Error(_0xe697('0x10'));}if(_0x12128d[_0xe697('0x16')]>0x0){if(_0x5ce42c[_0xe697('0x1e')]){if(moment(_0x5ce42c[_0xe697('0x22')])['add'](_0x12128d[_0xe697('0x16')],'minutes')>moment()){throw new Error(_0xe697('0x10'));}return utils[_0xe697('0x23')](_0x5ce42c,0x0,![],null)[_0xe697('0x17')](function(){return utils['getLicense'](_0x5ce42c);})[_0xe697('0x17')](function(){return _0x203e48(null,_0x5ce42c);});}else{return utils[_0xe697('0x24')](_0x5ce42c)[_0xe697('0x17')](function(){return _0x203e48(null,_0x5ce42c);});}}else{return utils['getLicense'](_0x5ce42c)[_0xe697('0x17')](function(){return _0x203e48(null,_0x5ce42c);});}})[_0xe697('0x25')](function(_0x120230){return _0x203e48(null,![],_0x120230);});}function handleError(_0x17e16e,_0x522236,_0x1e9817){return _0x17e16e[_0xe697('0x26')](_0x522236||0x1f4)[_0xe697('0x27')]({'message':_0x1e9817?_0x1e9817[_0xe697('0x28')]||_0x1e9817:''});}exports[_0xe697('0x29')]=function(_0x117bc4,_0x50e40f,_0x22ff8c){passport[_0xe697('0xd')]('ad-login',function(_0x570ae1,_0x4c9381,_0x57840e){var _0x1e8574=_0x570ae1||_0x57840e;if(_0x1e8574){return handleError(_0x50e40f,0x191,_0x1e8574);}if(!_0x4c9381){return handleError(_0x50e40f,0x194,{'message':_0xe697('0x2a')});}else{var _0x1f2f1c={'payload':{'id':_0x4c9381['id'],'role':_0x4c9381['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1f2f1c)[_0xe697('0x17')](function(_0x2ddec3){_0x50e40f['json']({'id':_0x4c9381['id'],'token':_0x2ddec3,'statusCall':'','isAlreadyLogged':_0x4c9381[_0xe697('0x2b')]});});}})(_0x117bc4,_0x50e40f,_0x22ff8c);};passport['use'](_0xe697('0x2c'),new LocalStrategy({'usernameField':_0xe697('0x19'),'passwordField':_0xe697('0x1a')},function(_0x2bb42e,_0x3927d1,_0x5fdd92){return ActiveDirectoryAuthenticate(db[_0xe697('0x2d')],_0x2bb42e,_0x3927d1,_0x5fdd92);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 0c29f7d..e61e5c3 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 _0xace5=['login','exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xace5,0x1ca));var _0x5ace=function(_0x55bb3e,_0x55846c){_0x55bb3e=_0x55bb3e-0x0;var _0x335c3f=_0xace5[_0x55bb3e];return _0x335c3f;};'use strict';var express=require(_0x5ace('0x0'));var router=express[_0x5ace('0x1')]();var controller=require(_0x5ace('0x2'));router[_0x5ace('0x3')]('/',controller[_0x5ace('0x4')]);module[_0x5ace('0x5')]=router; \ No newline at end of file +var _0x8202=['./authActiveDirectory.controller','post','login','exports','express'];(function(_0x5d9af0,_0x52930a){var _0x23ac2d=function(_0x35cdb6){while(--_0x35cdb6){_0x5d9af0['push'](_0x5d9af0['shift']());}};_0x23ac2d(++_0x52930a);}(_0x8202,0x1e9));var _0x2820=function(_0xf0abca,_0x23ccaf){_0xf0abca=_0xf0abca-0x0;var _0x242f10=_0x8202[_0xf0abca];return _0x242f10;};'use strict';var express=require(_0x2820('0x0'));var router=express['Router']();var controller=require(_0x2820('0x1'));router[_0x2820('0x2')]('/',controller[_0x2820('0x3')]);module[_0x2820('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 27a5829..8a4efee 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x3840fc,_0x403990){var _0x1af7ae=function(_0x4153b3){while(--_0x4153b3){_0x3840fc['push'](_0x3840fc['shift']());}};_0x1af7ae(++_0x403990);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x428029,_0x1a5eb3){var _0x52033a=function(_0x5d73a8){while(--_0x5d73a8){_0x428029['push'](_0x428029['shift']());}};_0x52033a(++_0x1a5eb3);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 6cfd8e6..c397e3b 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 _0xb555=['exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x5d8c9a,_0x5858ea){var _0x45d9a5=function(_0x506850){while(--_0x506850){_0x5d8c9a['push'](_0x5d8c9a['shift']());}};_0x45d9a5(++_0x5858ea);}(_0xb555,0xe5));var _0x5b55=function(_0x4d0b53,_0xb4d39a){_0x4d0b53=_0x4d0b53-0x0;var _0x3638db=_0xb555[_0x4d0b53];return _0x3638db;};'use strict';var express=require(_0x5b55('0x0'));var passport=require(_0x5b55('0x1'));var router=express[_0x5b55('0x2')]();var controller=require(_0x5b55('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x5b55('0x4'));router[_0x5b55('0x5')]('/',controller[_0x5b55('0x6')]);router[_0x5b55('0x5')](_0x5b55('0x7'),controller[_0x5b55('0x8')],authService[_0x5b55('0x9')],userController['login'],authService[_0x5b55('0xa')]);module[_0x5b55('0xb')]=router; \ No newline at end of file +var _0xb879=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','setTokenCookie','exports','Router'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb879,0x15d));var _0x9b87=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb879[_0x1694f5];return _0x5b4321;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x9b87('0x0')]();var controller=require(_0x9b87('0x1'));var userController=require(_0x9b87('0x2'));var authService=require(_0x9b87('0x3'));router['get']('/',controller[_0x9b87('0x4')]);router[_0x9b87('0x5')](_0x9b87('0x6'),controller[_0x9b87('0x7')],authService['isMiddleware'],userController[_0x9b87('0x4')],authService[_0x9b87('0x8')]);module[_0x9b87('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index cbb788a..9cad76b 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 _0x9d27=['signToken','json','online','generate','trim','toLowerCase','User','body','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','password','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','use','util','passport','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','salt','role','disabled','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','email','Smtp','user','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0xe19c82,_0x2e9ec9){var _0x60433d=function(_0xaf76a7){while(--_0xaf76a7){_0xe19c82['push'](_0xe19c82['shift']());}};_0x60433d(++_0x2e9ec9);}(_0x9d27,0xcd));var _0x79d2=function(_0x34b6aa,_0x5ddd29){_0x34b6aa=_0x34b6aa-0x0;var _0x3ead29=_0x9d27[_0x34b6aa];return _0x3ead29;};'use strict';var util=require(_0x79d2('0x0'));var passport=require(_0x79d2('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x79d2('0x2'));var _=require('lodash');var rs=require(_0x79d2('0x3'));var moment=require(_0x79d2('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x79d2('0x5'));var utils=require(_0x79d2('0x6'));var client=jayson[_0x79d2('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x221af7,_0x2fe8fc,_0x5c5720,_0x36a09a){var _0x3b521c,_0x24f06c;return db[_0x79d2('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x79d2('0x9'),_0x79d2('0xa')],'raw':!![]})[_0x79d2('0xb')](function(_0x7b01fa){_0x3b521c=_0x7b01fa;return _0x221af7[_0x79d2('0xc')]({'attributes':['id',_0x79d2('0xd'),'password',_0x79d2('0xe'),_0x79d2('0xf'),_0x79d2('0x10'),'blocked',_0x79d2('0x11'),_0x79d2('0x12')],'where':{'name':_0x2fe8fc,'role':{'$or':[_0x79d2('0x13'),'user',_0x79d2('0x14')]}}});})[_0x79d2('0xb')](function(_0x309c02){if(!_0x309c02||_0x309c02&&_0x309c02[_0x79d2('0xd')]!==_0x2fe8fc){throw new Error(_0x79d2('0x15'));}else{_0x24f06c=_0x309c02;return _0x24f06c;}})['then'](function(){_0x24f06c[_0x79d2('0x16')](_0x5c5720,function(_0xd283c9,_0x563461){var _0x569e33=_0x24f06c[_0x79d2('0x12')]+0x1;if(_0xd283c9){return _0x36a09a(_0xd283c9);}else if(!_0x563461){if(_0x24f06c['disabled']){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}else if(_0x3b521c[_0x79d2('0x9')]>0x0){if(_0x24f06c[_0x79d2('0x17')]){if(_0x3b521c[_0x79d2('0xa')]>0x0){if(moment(_0x24f06c['blockedAt'])[_0x79d2('0x18')](_0x3b521c[_0x79d2('0xa')],_0x79d2('0x19'))>moment()){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}else{return utils[_0x79d2('0x1a')](_0x24f06c,_0x569e33,![],null)[_0x79d2('0xb')](function(){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});});}}else{return _0x36a09a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x569e33>=_0x3b521c[_0x79d2('0x9')]){return utils['clearBlockUser'](_0x24f06c,0x0,!![],moment())[_0x79d2('0xb')](function(){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});});}else{return utils[_0x79d2('0x1a')](_0x24f06c,_0x569e33,![],null)[_0x79d2('0xb')](function(){return _0x36a09a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}}else{if(_0x24f06c[_0x79d2('0x10')]){return _0x36a09a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3b521c[_0x79d2('0x9')]>0x0){if(_0x24f06c[_0x79d2('0x17')]){if(_0x3b521c[_0x79d2('0xa')]>0x0){if(moment(_0x24f06c['blockedAt'])[_0x79d2('0x18')](_0x3b521c[_0x79d2('0xa')],_0x79d2('0x19'))>moment()){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}else{return utils[_0x79d2('0x1a')](_0x24f06c,0x0,![],null)['then'](function(){return utils[_0x79d2('0x1b')](_0x24f06c);})['then'](function(){return _0x36a09a(null,_0x24f06c);});}}else{return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}}else{return utils[_0x79d2('0x1a')](_0x24f06c,0x0,![],null)[_0x79d2('0xb')](function(){return utils[_0x79d2('0x1b')](_0x24f06c);})[_0x79d2('0xb')](function(){return _0x36a09a(null,_0x24f06c);})[_0x79d2('0x1c')](function(_0x59382d){return _0x36a09a(null,![],_0x59382d);});}}else{if(_0x24f06c[_0x79d2('0x17')]){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}else{return utils[_0x79d2('0x1b')](_0x24f06c)['then'](function(){return _0x36a09a(null,_0x24f06c);});}}}});})[_0x79d2('0x1c')](function(_0x2280eb){return _0x36a09a(null,![],_0x2280eb);});}function sendServiceMail(_0x4f4407){return db[_0x79d2('0x1d')][_0x79d2('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x79d2('0xd'),'email'],'include':[{'model':db[_0x79d2('0x1f')],'as':'Smtp','include':[{'model':db[_0x79d2('0x20')],'as':_0x79d2('0x20')}]}]})['then'](function(_0xcc1d80){if(!_0xcc1d80){throw new Error(_0x79d2('0x21'));}var _0x4bc086=_0xcc1d80[_0x79d2('0x22')]();var _0x583655={'account':_0x4bc086,'message':_[_0x79d2('0x23')]({'from':util[_0x79d2('0x24')]('\x22%s\x22\x20<%s>',_0xcc1d80[_0x79d2('0xd')],_0xcc1d80[_0x79d2('0x25')]||_0xcc1d80[_0x79d2('0x26')][_0x79d2('0x27')])},_0x4f4407)};return client['request'](_0x79d2('0x28'),_0x583655);})[_0x79d2('0xb')](function(_0xae6f26){if(_0xae6f26[_0x79d2('0x29')]){throw new Error(util[_0x79d2('0x24')](_0x79d2('0x2a'),_0xae6f26['error'][_0x79d2('0x2b')]||JSON[_0x79d2('0x2c')](_0xae6f26[_0x79d2('0x29')])));}return!![];});}function handleError(_0x46d06b,_0x141569,_0x4ce9eb){return _0x46d06b[_0x79d2('0x2d')](_0x141569||0x1f4)[_0x79d2('0x2e')]({'message':_0x4ce9eb?_0x4ce9eb['message']||_0x4ce9eb:''});}exports[_0x79d2('0x2f')]=function(_0x2f0c6b,_0x1e02d6,_0x5dc7d6){passport[_0x79d2('0x16')](_0x79d2('0x30'),function(_0x20ce31,_0x867957,_0x5a6c53){var _0x575511=_0x20ce31||_0x5a6c53;if(_0x575511){return handleError(_0x1e02d6,0x191,_0x575511);}if(!_0x867957){return handleError(_0x1e02d6,0x194,{'message':_0x79d2('0x31')});}else{var _0x176d74={'payload':{'id':_0x867957['id'],'role':_0x867957[_0x79d2('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x79d2('0x32')](_0x176d74)[_0x79d2('0xb')](function(_0x1261c5){_0x1e02d6[_0x79d2('0x33')]({'id':_0x867957['id'],'token':_0x1261c5,'statusCall':'','isAlreadyLogged':_0x867957[_0x79d2('0x34')]});});}})(_0x2f0c6b,_0x1e02d6,_0x5dc7d6);};exports['forgot']=function(_0x183da7,_0x2470a5){if(!_0x183da7['body'][_0x79d2('0x25')]){return handleError(_0x2470a5,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x4141c8=rs[_0x79d2('0x35')]();_0x183da7['body']['email']=_0x183da7['body'][_0x79d2('0x25')][_0x79d2('0x36')]()[_0x79d2('0x37')]();var _0x510a2b;return db[_0x79d2('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x79d2('0x9'),_0x79d2('0xa')],'raw':!![]})['then'](function(_0x27a339){_0x510a2b=_0x27a339;return db[_0x79d2('0x38')][_0x79d2('0x1e')]({'where':{'email':_0x183da7[_0x79d2('0x39')]['email']}});})['then'](function(_0x364353){if(!_0x364353){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x364353[_0x79d2('0x10')]){throw new Error(_0x79d2('0x3a'));}if(_0x364353[_0x79d2('0x17')]){if(moment(_0x364353[_0x79d2('0x11')])[_0x79d2('0x18')](_0x510a2b[_0x79d2('0xa')],'minutes')>moment()){throw new Error(_0x79d2('0x3b'));}else{_0x364353[_0x79d2('0x17')]=![];_0x364353[_0x79d2('0x11')]=null;}}_0x364353[_0x79d2('0x3c')]=_0x4141c8;_0x364353[_0x79d2('0x3d')]=Date[_0x79d2('0x3e')]()+0x36ee80;return _0x364353[_0x79d2('0x3f')]();})[_0x79d2('0xb')](function(){return sendServiceMail({'to':_0x183da7[_0x79d2('0x39')][_0x79d2('0x25')],'subject':_0x79d2('0x40'),'text':_0x79d2('0x41')+_0x79d2('0x42')+_0x79d2('0x43')+_0x183da7[_0x79d2('0x44')][_0x79d2('0x45')]+_0x79d2('0x46')+_0x4141c8+'\x0a\x0a'+_0x79d2('0x47')});})[_0x79d2('0xb')](function(){_0x2470a5['status'](0xc8)[_0x79d2('0x2e')]({'message':_0x79d2('0x48')});})[_0x79d2('0x1c')](function(_0x382434){return handleError(_0x2470a5,0x1f4,_0x382434);});};exports[_0x79d2('0x49')]=function(_0x43994c,_0x56586d){return db['User'][_0x79d2('0x1e')]({'where':{'resetPasswordToken':_0x43994c[_0x79d2('0x4a')][_0x79d2('0x4b')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x79d2('0xb')](function(_0x5e9171){if(!_0x5e9171){throw new Error(_0x79d2('0x4c'));}return db[_0x79d2('0x8')][_0x79d2('0xc')]({'attributes':['id',_0x79d2('0x4d'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x79d2('0xb')](function(_0x9bf9c2){if(_0x9bf9c2[_0x79d2('0x4d')])authService[_0x79d2('0x4e')](_0x43994c[_0x79d2('0x39')][_0x79d2('0x4f')]);if(!_0x9bf9c2[_0x79d2('0x50')]||!_0x5e9171['previousPasswords'])return _0x5e9171;authService[_0x79d2('0x51')](_0x43994c[_0x79d2('0x39')][_0x79d2('0x4f')],_0x5e9171[_0x79d2('0x52')],_0x9bf9c2[_0x79d2('0x53')]);return _0x5e9171;})['then'](function(){_0x5e9171[_0x79d2('0x4f')]=_0x43994c['body'][_0x79d2('0x4f')];_0x5e9171[_0x79d2('0x3c')]=null;_0x5e9171['resetPasswordExpires']=null;return _0x5e9171[_0x79d2('0x3f')]();});})[_0x79d2('0xb')](function(){_0x56586d['status'](0xc8)[_0x79d2('0x2e')]({'message':'Password\x20reset!'});})['catch'](function(_0x7ba7aa){return handleError(_0x56586d,0x1f4,_0x7ba7aa);});};passport[_0x79d2('0x54')](_0x79d2('0x30'),new LocalStrategy({'usernameField':_0x79d2('0xd'),'passwordField':'password'},function(_0x10b13f,_0x2186de,_0x2fb732){return localAuthenticate(db[_0x79d2('0x38')],_0x10b13f,_0x2186de,_0x2fb732);})); \ No newline at end of file +var _0xa5b9=['CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','request','error','format','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','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','https://','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','Password\x20reset!','use','local-login','util','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','then','findOne','name','password','salt','role','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','disabled','blockDuration','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp'];(function(_0x15c5b8,_0x3b670f){var _0xd45fe6=function(_0x15a775){while(--_0x15a775){_0x15c5b8['push'](_0x15c5b8['shift']());}};_0xd45fe6(++_0x3b670f);}(_0xa5b9,0x1cc));var _0x9a5b=function(_0x41ba8c,_0x304ef3){_0x41ba8c=_0x41ba8c-0x0;var _0x5245fa=_0xa5b9[_0x41ba8c];return _0x5245fa;};'use strict';var util=require(_0x9a5b('0x0'));var passport=require('passport');var LocalStrategy=require(_0x9a5b('0x1'))['Strategy'];var jayson=require(_0x9a5b('0x2'));var _=require(_0x9a5b('0x3'));var rs=require(_0x9a5b('0x4'));var moment=require(_0x9a5b('0x5'));var db=require(_0x9a5b('0x6'))['db'];var authService=require(_0x9a5b('0x7'));var utils=require(_0x9a5b('0x8'));var client=jayson[_0x9a5b('0x9')][_0x9a5b('0xa')]({'port':0x232b});function localAuthenticate(_0x302ada,_0x599918,_0x4b80a1,_0x34a315){var _0x25a525,_0xd1737a;return db[_0x9a5b('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x9a5b('0xc'),'blockDuration'],'raw':!![]})[_0x9a5b('0xd')](function(_0x413d4c){_0x25a525=_0x413d4c;return _0x302ada[_0x9a5b('0xe')]({'attributes':['id',_0x9a5b('0xf'),_0x9a5b('0x10'),_0x9a5b('0x11'),_0x9a5b('0x12'),'disabled',_0x9a5b('0x13'),_0x9a5b('0x14'),'loginAttempts'],'where':{'name':_0x599918,'role':{'$or':[_0x9a5b('0x15'),_0x9a5b('0x16'),_0x9a5b('0x17')]}}});})[_0x9a5b('0xd')](function(_0x3f8e55){if(!_0x3f8e55||_0x3f8e55&&_0x3f8e55[_0x9a5b('0xf')]!==_0x599918){throw new Error(_0x9a5b('0x18'));}else{_0xd1737a=_0x3f8e55;return _0xd1737a;}})['then'](function(){_0xd1737a[_0x9a5b('0x19')](_0x4b80a1,function(_0x2aa4bc,_0x1d9d2a){var _0x2385d2=_0xd1737a[_0x9a5b('0x1a')]+0x1;if(_0x2aa4bc){return _0x34a315(_0x2aa4bc);}else if(!_0x1d9d2a){if(_0xd1737a[_0x9a5b('0x1b')]){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});}else if(_0x25a525['allowedLoginAttempts']>0x0){if(_0xd1737a[_0x9a5b('0x13')]){if(_0x25a525[_0x9a5b('0x1c')]>0x0){if(moment(_0xd1737a[_0x9a5b('0x14')])[_0x9a5b('0x1d')](_0x25a525[_0x9a5b('0x1c')],_0x9a5b('0x1e'))>moment()){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});}else{return utils[_0x9a5b('0x1f')](_0xd1737a,_0x2385d2,![],null)[_0x9a5b('0xd')](function(){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});});}}else{return _0x34a315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2385d2>=_0x25a525[_0x9a5b('0xc')]){return utils[_0x9a5b('0x1f')](_0xd1737a,0x0,!![],moment())[_0x9a5b('0xd')](function(){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});});}else{return utils[_0x9a5b('0x1f')](_0xd1737a,_0x2385d2,![],null)[_0x9a5b('0xd')](function(){return _0x34a315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x34a315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xd1737a[_0x9a5b('0x1b')]){return _0x34a315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x25a525[_0x9a5b('0xc')]>0x0){if(_0xd1737a[_0x9a5b('0x13')]){if(_0x25a525['blockDuration']>0x0){if(moment(_0xd1737a[_0x9a5b('0x14')])[_0x9a5b('0x1d')](_0x25a525[_0x9a5b('0x1c')],_0x9a5b('0x1e'))>moment()){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});}else{return utils[_0x9a5b('0x1f')](_0xd1737a,0x0,![],null)['then'](function(){return utils['getLicense'](_0xd1737a);})[_0x9a5b('0xd')](function(){return _0x34a315(null,_0xd1737a);});}}else{return _0x34a315(null,![],{'message':_0x9a5b('0x18')});}}else{return utils['clearBlockUser'](_0xd1737a,0x0,![],null)[_0x9a5b('0xd')](function(){return utils[_0x9a5b('0x20')](_0xd1737a);})[_0x9a5b('0xd')](function(){return _0x34a315(null,_0xd1737a);})[_0x9a5b('0x21')](function(_0x33eebe){return _0x34a315(null,![],_0x33eebe);});}}else{if(_0xd1737a[_0x9a5b('0x13')]){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});}else{return utils['getLicense'](_0xd1737a)[_0x9a5b('0xd')](function(){return _0x34a315(null,_0xd1737a);});}}}});})['catch'](function(_0x17a7dc){return _0x34a315(null,![],_0x17a7dc);});}function sendServiceMail(_0x2e9038){return db['MailAccount'][_0x9a5b('0x22')]({'where':{'service':!![]},'attributes':['id',_0x9a5b('0xf'),_0x9a5b('0x23')],'include':[{'model':db[_0x9a5b('0x24')],'as':_0x9a5b('0x25'),'include':[{'model':db['CloudProvider'],'as':_0x9a5b('0x26')}]}]})['then'](function(_0x2a3f65){if(!_0x2a3f65){throw new Error(_0x9a5b('0x27'));}var _0xdea8b7=_0x2a3f65[_0x9a5b('0x28')]();var _0x37a49d={'account':_0xdea8b7,'message':_[_0x9a5b('0x29')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x2a3f65[_0x9a5b('0xf')],_0x2a3f65['email']||_0x2a3f65['Smtp'][_0x9a5b('0x16')])},_0x2e9038)};return client[_0x9a5b('0x2a')]('SendMail',_0x37a49d);})[_0x9a5b('0xd')](function(_0x66f609){if(_0x66f609[_0x9a5b('0x2b')]){throw new Error(util[_0x9a5b('0x2c')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x66f609[_0x9a5b('0x2b')][_0x9a5b('0x2d')]||JSON[_0x9a5b('0x2e')](_0x66f609[_0x9a5b('0x2b')])));}return!![];});}function handleError(_0x5d17ef,_0x13875f,_0x9fe6dd){return _0x5d17ef[_0x9a5b('0x2f')](_0x13875f||0x1f4)[_0x9a5b('0x30')]({'message':_0x9fe6dd?_0x9fe6dd[_0x9a5b('0x2d')]||_0x9fe6dd:''});}exports[_0x9a5b('0x31')]=function(_0x1fda88,_0x502b72,_0x220f9d){passport[_0x9a5b('0x19')]('local-login',function(_0x2f8704,_0x47a295,_0x42b818){var _0x5ec66c=_0x2f8704||_0x42b818;if(_0x5ec66c){return handleError(_0x502b72,0x191,_0x5ec66c);}if(!_0x47a295){return handleError(_0x502b72,0x194,{'message':_0x9a5b('0x32')});}else{var _0x7c7b1d={'payload':{'id':_0x47a295['id'],'role':_0x47a295[_0x9a5b('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x9a5b('0x33')](_0x7c7b1d)[_0x9a5b('0xd')](function(_0x3288e0){_0x502b72[_0x9a5b('0x34')]({'id':_0x47a295['id'],'token':_0x3288e0,'statusCall':'','isAlreadyLogged':_0x47a295[_0x9a5b('0x35')]});});}})(_0x1fda88,_0x502b72,_0x220f9d);};exports[_0x9a5b('0x36')]=function(_0x376872,_0x23670e){if(!_0x376872[_0x9a5b('0x37')][_0x9a5b('0x23')]){return handleError(_0x23670e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xa1faf8=rs['generate']();_0x376872[_0x9a5b('0x37')][_0x9a5b('0x23')]=_0x376872[_0x9a5b('0x37')]['email'][_0x9a5b('0x38')]()[_0x9a5b('0x39')]();var _0x107a20;return db[_0x9a5b('0xb')][_0x9a5b('0xe')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9a5b('0x1c')],'raw':!![]})[_0x9a5b('0xd')](function(_0x2d03e2){_0x107a20=_0x2d03e2;return db[_0x9a5b('0x3a')][_0x9a5b('0x22')]({'where':{'email':_0x376872[_0x9a5b('0x37')]['email']}});})[_0x9a5b('0xd')](function(_0x101848){if(!_0x101848){throw new Error(_0x9a5b('0x3b'));}if(_0x101848[_0x9a5b('0x1b')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x101848['blocked']){if(moment(_0x101848[_0x9a5b('0x14')])[_0x9a5b('0x1d')](_0x107a20['blockDuration'],_0x9a5b('0x1e'))>moment()){throw new Error(_0x9a5b('0x3c'));}else{_0x101848['blocked']=![];_0x101848[_0x9a5b('0x14')]=null;}}_0x101848[_0x9a5b('0x3d')]=_0xa1faf8;_0x101848[_0x9a5b('0x3e')]=Date[_0x9a5b('0x3f')]()+0x36ee80;return _0x101848[_0x9a5b('0x40')]();})[_0x9a5b('0xd')](function(){return sendServiceMail({'to':_0x376872[_0x9a5b('0x37')][_0x9a5b('0x23')],'subject':_0x9a5b('0x41'),'text':_0x9a5b('0x42')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x9a5b('0x43')+_0x376872['headers'][_0x9a5b('0x44')]+'/reset/'+_0xa1faf8+'\x0a\x0a'+_0x9a5b('0x45')});})[_0x9a5b('0xd')](function(){_0x23670e[_0x9a5b('0x2f')](0xc8)[_0x9a5b('0x30')]({'message':_0x9a5b('0x46')});})[_0x9a5b('0x21')](function(_0x9824b5){return handleError(_0x23670e,0x1f4,_0x9824b5);});};exports[_0x9a5b('0x47')]=function(_0x15ac14,_0x15dcb6){return db[_0x9a5b('0x3a')]['find']({'where':{'resetPasswordToken':_0x15ac14[_0x9a5b('0x48')][_0x9a5b('0x49')],'resetPasswordExpires':{'$gt':Date[_0x9a5b('0x3f')]()}}})[_0x9a5b('0xd')](function(_0x5d4171){if(!_0x5d4171){throw new Error(_0x9a5b('0x4a'));}return db[_0x9a5b('0xb')]['findOne']({'attributes':['id',_0x9a5b('0x4b'),_0x9a5b('0x4c'),_0x9a5b('0x4d')]})[_0x9a5b('0xd')](function(_0x23a0ef){if(_0x23a0ef[_0x9a5b('0x4b')])authService['validatePasswordPattern'](_0x15ac14[_0x9a5b('0x37')][_0x9a5b('0x10')]);if(!_0x23a0ef[_0x9a5b('0x4c')]||!_0x5d4171[_0x9a5b('0x4e')])return _0x5d4171;authService[_0x9a5b('0x4f')](_0x15ac14[_0x9a5b('0x37')][_0x9a5b('0x10')],_0x5d4171[_0x9a5b('0x4e')],_0x23a0ef[_0x9a5b('0x4d')]);return _0x5d4171;})[_0x9a5b('0xd')](function(){_0x5d4171[_0x9a5b('0x10')]=_0x15ac14[_0x9a5b('0x37')]['password'];_0x5d4171[_0x9a5b('0x3d')]=null;_0x5d4171[_0x9a5b('0x3e')]=null;return _0x5d4171[_0x9a5b('0x40')]();});})['then'](function(){_0x15dcb6['status'](0xc8)[_0x9a5b('0x30')]({'message':_0x9a5b('0x50')});})['catch'](function(_0xffaea3){return handleError(_0x15dcb6,0x1f4,_0xffaea3);});};passport[_0x9a5b('0x51')](_0x9a5b('0x52'),new LocalStrategy({'usernameField':_0x9a5b('0xf'),'passwordField':'password'},function(_0x4bab76,_0xa35269,_0x404321){return localAuthenticate(db[_0x9a5b('0x3a')],_0x4bab76,_0xa35269,_0x404321);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index d39329e..022744f 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 _0x248c=['/reset/:token','exports','express','Router','./authLocal.controller','post','login','forgot'];(function(_0x1c95d5,_0xc1059b){var _0x20f69b=function(_0x18128b){while(--_0x18128b){_0x1c95d5['push'](_0x1c95d5['shift']());}};_0x20f69b(++_0xc1059b);}(_0x248c,0x10a));var _0xc248=function(_0x18b42a,_0x226226){_0x18b42a=_0x18b42a-0x0;var _0x4e3ed3=_0x248c[_0x18b42a];return _0x4e3ed3;};'use strict';var express=require(_0xc248('0x0'));var router=express[_0xc248('0x1')]();var controller=require(_0xc248('0x2'));router[_0xc248('0x3')]('/',controller[_0xc248('0x4')]);router['post']('/forgot',controller[_0xc248('0x5')]);router[_0xc248('0x3')](_0xc248('0x6'),controller['reset']);module[_0xc248('0x7')]=router; \ No newline at end of file +var _0x2cd9=['post','/reset/:token','exports','express','Router','./authLocal.controller','login','/forgot','forgot'];(function(_0x4cb394,_0x2922dd){var _0xfaa442=function(_0x14470f){while(--_0x14470f){_0x4cb394['push'](_0x4cb394['shift']());}};_0xfaa442(++_0x2922dd);}(_0x2cd9,0x135));var _0x92cd=function(_0x454b43,_0xbbd840){_0x454b43=_0x454b43-0x0;var _0x18b44b=_0x2cd9[_0x454b43];return _0x18b44b;};'use strict';var express=require(_0x92cd('0x0'));var router=express[_0x92cd('0x1')]();var controller=require(_0x92cd('0x2'));router['post']('/',controller[_0x92cd('0x3')]);router['post'](_0x92cd('0x4'),controller[_0x92cd('0x5')]);router[_0x92cd('0x6')](_0x92cd('0x7'),controller['reset']);module[_0x92cd('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e9a42cb..eb6d89b 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 _0x042a=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x2e54cb,_0x268ff3){var _0x2aedfc=function(_0x3a05e3){while(--_0x3a05e3){_0x2e54cb['push'](_0x2e54cb['shift']());}};_0x2aedfc(++_0x268ff3);}(_0x042a,0x14c));var _0xa042=function(_0x4f993a,_0x1f3a4b){_0x4f993a=_0x4f993a-0x0;var _0xaaaef6=_0x042a[_0x4f993a];return _0xaaaef6;};'use strict';var Sequelize=require(_0xa042('0x0'));module[_0xa042('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xa042('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa042('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa042('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x3e31=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x1b60e6,_0x2e8a31){var _0x1bbb3d=function(_0x3b07f0){while(--_0x3b07f0){_0x1b60e6['push'](_0x1b60e6['shift']());}};_0x1bbb3d(++_0x2e8a31);}(_0x3e31,0xfe));var _0x13e3=function(_0xf3fd05,_0x23ce73){_0xf3fd05=_0xf3fd05-0x0;var _0x7b9231=_0x3e31[_0xf3fd05];return _0x7b9231;};'use strict';var Sequelize=require(_0x13e3('0x0'));module[_0x13e3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x13e3('0x2')]},'description':{'type':Sequelize[_0x13e3('0x2')]},'status':{'type':Sequelize[_0x13e3('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x13e3('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 05342e1..5cfe34e 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 _0xade5=['limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','intersection','include','merge','find','create','update','body','addConditions','ids','omit','findOne','Condition','order','getConditions','Action','addActions','getActions','map','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x5b7eee,_0x50f167){var _0x506ad8=function(_0x11edcd){while(--_0x11edcd){_0x5b7eee['push'](_0x5b7eee['shift']());}};_0x506ad8(++_0x50f167);}(_0xade5,0x143));var _0x5ade=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xade5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ade('0x0'));var zipdir=require(_0x5ade('0x1'));var jsonpatch=require(_0x5ade('0x2'));var rp=require(_0x5ade('0x3'));var moment=require(_0x5ade('0x4'));var BPromise=require(_0x5ade('0x5'));var Mustache=require('mustache');var util=require(_0x5ade('0x6'));var path=require(_0x5ade('0x7'));var sox=require(_0x5ade('0x8'));var csv=require(_0x5ade('0x9'));var ejs=require(_0x5ade('0xa'));var fs=require('fs');var fs_extra=require(_0x5ade('0xb'));var _=require(_0x5ade('0xc'));var squel=require(_0x5ade('0xd'));var crypto=require(_0x5ade('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5ade('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5ade('0x10'));var Papa=require(_0x5ade('0x11'));var Redis=require(_0x5ade('0x12'));var authService=require(_0x5ade('0x13'));var qs=require(_0x5ade('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ade('0x15'));var logger=require(_0x5ade('0x16'))(_0x5ade('0x17'));var utils=require(_0x5ade('0x18'));var config=require(_0x5ade('0x19'));var licenseUtil=require(_0x5ade('0x1a'));var db=require(_0x5ade('0x1b'))['db'];function respondWithStatusCode(_0x2b51da,_0x35f52a){_0x35f52a=_0x35f52a||0xcc;return function(_0x2a7393){if(_0x2a7393){return _0x2b51da[_0x5ade('0x1c')](_0x35f52a);}return _0x2b51da[_0x5ade('0x1d')](_0x35f52a)[_0x5ade('0x1e')]();};}function respondWithResult(_0x34c9ad,_0x10f676){_0x10f676=_0x10f676||0xc8;return function(_0x8bdf90){if(_0x8bdf90){return _0x34c9ad[_0x5ade('0x1d')](_0x10f676)[_0x5ade('0x1f')](_0x8bdf90);}};}function respondWithFilteredResult(_0x3d19fa,_0x1dc8b3){return function(_0xf6a03c){if(_0xf6a03c){var _0x17ea65=typeof _0x1dc8b3[_0x5ade('0x20')]==='undefined'&&typeof _0x1dc8b3['limit']==='undefined';var _0x2f1f79=_0xf6a03c['count'];var _0x451d8a=_0x17ea65?0x0:_0x1dc8b3[_0x5ade('0x20')];var _0x5d0c48=_0x17ea65?_0xf6a03c['count']:_0x1dc8b3['offset']+_0x1dc8b3[_0x5ade('0x21')];var _0x102b79;if(_0x5d0c48>=_0x2f1f79){_0x5d0c48=_0x2f1f79;_0x102b79=0xc8;}else{_0x102b79=0xce;}_0x3d19fa['status'](_0x102b79);return _0x3d19fa[_0x5ade('0x22')](_0x5ade('0x23'),_0x451d8a+'-'+_0x5d0c48+'/'+_0x2f1f79)[_0x5ade('0x1f')](_0xf6a03c);}return null;};}function patchUpdates(_0x2ff7ec){return function(_0x208ee9){try{jsonpatch[_0x5ade('0x24')](_0x208ee9,_0x2ff7ec,!![]);}catch(_0x47c080){return BPromise[_0x5ade('0x25')](_0x47c080);}return _0x208ee9['save']();};}function saveUpdates(_0x367dcc,_0x56923d){return function(_0x3344ac){if(_0x3344ac){return _0x3344ac['update'](_0x367dcc)[_0x5ade('0x26')](function(_0x170102){return _0x170102;});}return null;};}function removeEntity(_0x1a8da4,_0x2741fa){return function(_0x4dcb26){if(_0x4dcb26){return _0x4dcb26[_0x5ade('0x27')]()['then'](function(){_0x1a8da4[_0x5ade('0x1d')](0xcc)[_0x5ade('0x1e')]();});}};}function handleEntityNotFound(_0x5cca47,_0x16b6a0){return function(_0x731eed){if(!_0x731eed){_0x5cca47['sendStatus'](0x194);}return _0x731eed;};}function handleError(_0x4f9628,_0x144dd0){_0x144dd0=_0x144dd0||0x1f4;return function(_0x27db87){logger[_0x5ade('0x28')](_0x27db87[_0x5ade('0x29')]);if(_0x27db87[_0x5ade('0x2a')]){delete _0x27db87[_0x5ade('0x2a')];}_0x4f9628[_0x5ade('0x1d')](_0x144dd0)[_0x5ade('0x2b')](_0x27db87);};}exports[_0x5ade('0x2c')]=function(_0x367c94,_0x4f6878){var _0x358c5b={},_0x3b6f2a={},_0x3887c8={'count':0x0,'rows':[]};var _0x154252=_['map'](db[_0x5ade('0x2d')][_0x5ade('0x2e')],function(_0x470be4){return{'name':_0x470be4[_0x5ade('0x2f')],'type':_0x470be4[_0x5ade('0x30')]['key']};});_0x3b6f2a[_0x5ade('0x31')]=_['map'](_0x154252,_0x5ade('0x2a'));_0x3b6f2a['query']=_[_0x5ade('0x32')](_0x367c94[_0x5ade('0x33')]);_0x3b6f2a[_0x5ade('0x34')]=_['intersection'](_0x3b6f2a[_0x5ade('0x31')],_0x3b6f2a['query']);_0x358c5b[_0x5ade('0x35')]=_['intersection'](_0x3b6f2a[_0x5ade('0x31')],qs[_0x5ade('0x36')](_0x367c94[_0x5ade('0x33')]['fields']));_0x358c5b['attributes']=_0x358c5b[_0x5ade('0x35')][_0x5ade('0x37')]?_0x358c5b[_0x5ade('0x35')]:_0x3b6f2a[_0x5ade('0x31')];if(!_0x367c94[_0x5ade('0x33')][_0x5ade('0x38')](_0x5ade('0x39'))){_0x358c5b['limit']=qs[_0x5ade('0x21')](_0x367c94[_0x5ade('0x33')][_0x5ade('0x21')]);_0x358c5b[_0x5ade('0x20')]=qs[_0x5ade('0x20')](_0x367c94[_0x5ade('0x33')][_0x5ade('0x20')]);}_0x358c5b['order']=qs[_0x5ade('0x3a')](_0x367c94[_0x5ade('0x33')][_0x5ade('0x3a')]);_0x358c5b[_0x5ade('0x3b')]=qs[_0x5ade('0x34')](_[_0x5ade('0x3c')](_0x367c94['query'],_0x3b6f2a[_0x5ade('0x34')]),_0x154252);if(_0x367c94[_0x5ade('0x33')][_0x5ade('0x3d')]){_0x358c5b[_0x5ade('0x3b')]=_['merge'](_0x358c5b[_0x5ade('0x3b')],{'$or':_['map'](_0x154252,function(_0x4c980a){if(_0x4c980a['type']!==_0x5ade('0x3e')){var _0x523c26={};_0x523c26[_0x4c980a[_0x5ade('0x2a')]]={'$like':'%'+_0x367c94['query'][_0x5ade('0x3d')]+'%'};return _0x523c26;}})});}_0x358c5b=_['merge']({},_0x358c5b,_0x367c94[_0x5ade('0x3f')]);var _0x1b7d63={'where':_0x358c5b['where']};return db[_0x5ade('0x2d')][_0x5ade('0x40')](_0x1b7d63)[_0x5ade('0x26')](function(_0x4ded5c){_0x3887c8[_0x5ade('0x40')]=_0x4ded5c;if(_0x367c94['query'][_0x5ade('0x41')]){_0x358c5b['include']=[{'all':!![]}];}return db[_0x5ade('0x2d')][_0x5ade('0x42')](_0x358c5b);})[_0x5ade('0x26')](function(_0x4c6fe4){_0x3887c8[_0x5ade('0x43')]=_0x4c6fe4;return _0x3887c8;})[_0x5ade('0x26')](respondWithFilteredResult(_0x4f6878,_0x358c5b))[_0x5ade('0x44')](handleError(_0x4f6878,null));};exports[_0x5ade('0x45')]=function(_0x55038a,_0x25a3dd){var _0x4b184d={'raw':![],'where':{'id':_0x55038a[_0x5ade('0x46')]['id']}},_0x1be665={};_0x1be665[_0x5ade('0x31')]=_[_0x5ade('0x32')](db[_0x5ade('0x2d')][_0x5ade('0x2e')]);_0x1be665['query']=_['keys'](_0x55038a[_0x5ade('0x33')]);_0x1be665[_0x5ade('0x34')]=_[_0x5ade('0x47')](_0x1be665[_0x5ade('0x31')],_0x1be665[_0x5ade('0x33')]);_0x4b184d[_0x5ade('0x35')]=_[_0x5ade('0x47')](_0x1be665[_0x5ade('0x31')],qs[_0x5ade('0x36')](_0x55038a[_0x5ade('0x33')][_0x5ade('0x36')]));_0x4b184d[_0x5ade('0x35')]=_0x4b184d[_0x5ade('0x35')][_0x5ade('0x37')]?_0x4b184d['attributes']:_0x1be665[_0x5ade('0x31')];if(_0x55038a[_0x5ade('0x33')][_0x5ade('0x41')]){_0x4b184d[_0x5ade('0x48')]=[{'all':!![]}];}_0x4b184d=_[_0x5ade('0x49')]({},_0x4b184d,_0x55038a[_0x5ade('0x3f')]);return db[_0x5ade('0x2d')][_0x5ade('0x4a')](_0x4b184d)['then'](handleEntityNotFound(_0x25a3dd,null))[_0x5ade('0x26')](respondWithResult(_0x25a3dd,null))[_0x5ade('0x44')](handleError(_0x25a3dd,null));};exports[_0x5ade('0x4b')]=function(_0x169317,_0x441cc2){return db[_0x5ade('0x2d')][_0x5ade('0x4b')](_0x169317['body'],{})[_0x5ade('0x26')](respondWithResult(_0x441cc2,0xc9))['catch'](handleError(_0x441cc2,null));};exports[_0x5ade('0x4c')]=function(_0x3fcbb8,_0x593df1){if(_0x3fcbb8['body']['id']){delete _0x3fcbb8[_0x5ade('0x4d')]['id'];}return db[_0x5ade('0x2d')][_0x5ade('0x4a')]({'where':{'id':_0x3fcbb8[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x593df1,null))[_0x5ade('0x26')](saveUpdates(_0x3fcbb8[_0x5ade('0x4d')],null))[_0x5ade('0x26')](respondWithResult(_0x593df1,null))[_0x5ade('0x44')](handleError(_0x593df1,null));};exports['destroy']=function(_0x1253c4,_0x5c7f69){return db[_0x5ade('0x2d')][_0x5ade('0x4a')]({'where':{'id':_0x1253c4[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x5c7f69,null))[_0x5ade('0x26')](removeEntity(_0x5c7f69,null))['catch'](handleError(_0x5c7f69,null));};exports[_0x5ade('0x4e')]=function(_0x50f4c2,_0x51c7ee,_0x135c2c){return db['Condition'][_0x5ade('0x4a')]({'where':{'id':_0x50f4c2[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x51c7ee,null))['then'](function(_0x5b2e07){if(_0x5b2e07){return _0x5b2e07[_0x5ade('0x4e')](_0x50f4c2[_0x5ade('0x4d')][_0x5ade('0x4f')],_[_0x5ade('0x50')](_0x50f4c2['body'],[_0x5ade('0x4f'),'id'])||{});}})[_0x5ade('0x26')](respondWithResult(_0x51c7ee,null))[_0x5ade('0x44')](handleError(_0x51c7ee,null));};exports['getConditions']=function(_0x1a1a5d,_0x5514ba,_0xe31a5){var _0x4c382b={};var _0x42bd8c={};var _0x4aca4e;var _0x3ae420;return db[_0x5ade('0x2d')][_0x5ade('0x51')]({'where':{'id':_0x1a1a5d[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x5514ba,null))[_0x5ade('0x26')](function(_0x33a1ee){if(_0x33a1ee){_0x4aca4e=_0x33a1ee;_0x42bd8c[_0x5ade('0x31')]=_[_0x5ade('0x32')](db[_0x5ade('0x52')][_0x5ade('0x2e')]);_0x42bd8c['query']=_[_0x5ade('0x32')](_0x1a1a5d[_0x5ade('0x33')]);_0x42bd8c[_0x5ade('0x34')]=_['intersection'](_0x42bd8c[_0x5ade('0x31')],_0x42bd8c['query']);_0x4c382b[_0x5ade('0x35')]=_['intersection'](_0x42bd8c[_0x5ade('0x31')],qs[_0x5ade('0x36')](_0x1a1a5d[_0x5ade('0x33')]['fields']));_0x4c382b[_0x5ade('0x35')]=_0x4c382b[_0x5ade('0x35')][_0x5ade('0x37')]?_0x4c382b[_0x5ade('0x35')]:_0x42bd8c[_0x5ade('0x31')];_0x4c382b[_0x5ade('0x53')]=qs['sort'](_0x1a1a5d[_0x5ade('0x33')][_0x5ade('0x3a')]);_0x4c382b['where']=qs[_0x5ade('0x34')](_['pick'](_0x1a1a5d[_0x5ade('0x33')],_0x42bd8c[_0x5ade('0x34')]));if(_0x1a1a5d[_0x5ade('0x33')][_0x5ade('0x3d')]){_0x4c382b[_0x5ade('0x3b')]=_['merge'](_0x4c382b['where'],{'$or':_['map'](_0x4c382b[_0x5ade('0x35')],function(_0x3dd551){var _0x485594={};_0x485594[_0x3dd551]={'$like':'%'+_0x1a1a5d[_0x5ade('0x33')][_0x5ade('0x3d')]+'%'};return _0x485594;})});}_0x4c382b=_[_0x5ade('0x49')]({},_0x4c382b,_0x1a1a5d[_0x5ade('0x3f')]);return _0x4aca4e[_0x5ade('0x54')](_0x4c382b);}})[_0x5ade('0x26')](function(_0x49487d){if(_0x49487d){_0x3ae420=_0x49487d[_0x5ade('0x37')];if(!_0x1a1a5d[_0x5ade('0x33')]['hasOwnProperty']('nolimit')){_0x4c382b[_0x5ade('0x21')]=qs[_0x5ade('0x21')](_0x1a1a5d[_0x5ade('0x33')][_0x5ade('0x21')]);_0x4c382b[_0x5ade('0x20')]=qs['offset'](_0x1a1a5d[_0x5ade('0x33')][_0x5ade('0x20')]);}return _0x4aca4e[_0x5ade('0x54')](_0x4c382b);}})[_0x5ade('0x26')](function(_0x3068ca){if(_0x3068ca){return _0x3068ca?{'count':_0x3ae420,'rows':_0x3068ca}:null;}})[_0x5ade('0x26')](respondWithResult(_0x5514ba,null))[_0x5ade('0x44')](handleError(_0x5514ba,null));};exports['addActions']=function(_0xe2090c,_0x240426,_0x15266c){return db[_0x5ade('0x55')]['find']({'where':{'id':_0xe2090c[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x240426,null))[_0x5ade('0x26')](function(_0x53e25c){if(_0x53e25c){return _0x53e25c[_0x5ade('0x56')](_0xe2090c[_0x5ade('0x4d')][_0x5ade('0x4f')],_[_0x5ade('0x50')](_0xe2090c[_0x5ade('0x4d')],[_0x5ade('0x4f'),'id'])||{});}})[_0x5ade('0x26')](respondWithResult(_0x240426,null))[_0x5ade('0x44')](handleError(_0x240426,null));};exports[_0x5ade('0x57')]=function(_0x3045dc,_0x29fdc4,_0xca5ddf){var _0x5667c7={};var _0x2cfd2f={};var _0xc569df;var _0x299f15;return db[_0x5ade('0x2d')][_0x5ade('0x51')]({'where':{'id':_0x3045dc[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x29fdc4,null))[_0x5ade('0x26')](function(_0x4f543d){if(_0x4f543d){_0xc569df=_0x4f543d;_0x2cfd2f[_0x5ade('0x31')]=_[_0x5ade('0x32')](db['Action'][_0x5ade('0x2e')]);_0x2cfd2f[_0x5ade('0x33')]=_['keys'](_0x3045dc[_0x5ade('0x33')]);_0x2cfd2f[_0x5ade('0x34')]=_['intersection'](_0x2cfd2f[_0x5ade('0x31')],_0x2cfd2f[_0x5ade('0x33')]);_0x5667c7['attributes']=_[_0x5ade('0x47')](_0x2cfd2f['model'],qs[_0x5ade('0x36')](_0x3045dc[_0x5ade('0x33')][_0x5ade('0x36')]));_0x5667c7[_0x5ade('0x35')]=_0x5667c7[_0x5ade('0x35')][_0x5ade('0x37')]?_0x5667c7[_0x5ade('0x35')]:_0x2cfd2f['model'];_0x5667c7[_0x5ade('0x53')]=qs[_0x5ade('0x3a')](_0x3045dc[_0x5ade('0x33')][_0x5ade('0x3a')]);_0x5667c7[_0x5ade('0x3b')]=qs[_0x5ade('0x34')](_[_0x5ade('0x3c')](_0x3045dc['query'],_0x2cfd2f[_0x5ade('0x34')]));if(_0x3045dc[_0x5ade('0x33')][_0x5ade('0x3d')]){_0x5667c7[_0x5ade('0x3b')]=_[_0x5ade('0x49')](_0x5667c7[_0x5ade('0x3b')],{'$or':_[_0x5ade('0x58')](_0x5667c7[_0x5ade('0x35')],function(_0x1b0e12){var _0x1863b8={};_0x1863b8[_0x1b0e12]={'$like':'%'+_0x3045dc[_0x5ade('0x33')][_0x5ade('0x3d')]+'%'};return _0x1863b8;})});}_0x5667c7=_[_0x5ade('0x49')]({},_0x5667c7,_0x3045dc[_0x5ade('0x3f')]);return _0xc569df[_0x5ade('0x57')](_0x5667c7);}})[_0x5ade('0x26')](function(_0x475383){if(_0x475383){_0x299f15=_0x475383[_0x5ade('0x37')];if(!_0x3045dc[_0x5ade('0x33')][_0x5ade('0x38')](_0x5ade('0x39'))){_0x5667c7['limit']=qs[_0x5ade('0x21')](_0x3045dc[_0x5ade('0x33')][_0x5ade('0x21')]);_0x5667c7[_0x5ade('0x20')]=qs[_0x5ade('0x20')](_0x3045dc['query'][_0x5ade('0x20')]);}return _0xc569df[_0x5ade('0x57')](_0x5667c7);}})[_0x5ade('0x26')](function(_0x500c18){if(_0x500c18){return _0x500c18?{'count':_0x299f15,'rows':_0x500c18}:null;}})[_0x5ade('0x26')](respondWithResult(_0x29fdc4,null))['catch'](handleError(_0x29fdc4,null));}; \ No newline at end of file +var _0x1248=['../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','length','query','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','Automation','includeAll','include','findAll','params','fields','options','find','catch','create','body','addConditions','Condition','ids','getConditions','findOne','addActions','Action','omit','getActions','eml-format','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x56716d,_0x2f6690){var _0x126a2c=function(_0x5bf306){while(--_0x5bf306){_0x56716d['push'](_0x56716d['shift']());}};_0x126a2c(++_0x2f6690);}(_0x1248,0xe9));var _0x8124=function(_0x9f90cf,_0x503641){_0x9f90cf=_0x9f90cf-0x0;var _0x4d2bd3=_0x1248[_0x9f90cf];return _0x4d2bd3;};'use strict';var emlformat=require(_0x8124('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8124('0x1'));var jsonpatch=require(_0x8124('0x2'));var rp=require(_0x8124('0x3'));var moment=require(_0x8124('0x4'));var BPromise=require(_0x8124('0x5'));var Mustache=require(_0x8124('0x6'));var util=require(_0x8124('0x7'));var path=require(_0x8124('0x8'));var sox=require(_0x8124('0x9'));var csv=require(_0x8124('0xa'));var ejs=require(_0x8124('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8124('0xc'));var squel=require(_0x8124('0xd'));var crypto=require('crypto');var jsforce=require(_0x8124('0xe'));var deskjs=require(_0x8124('0xf'));var toCsv=require(_0x8124('0xa'));var querystring=require(_0x8124('0x10'));var Papa=require(_0x8124('0x11'));var Redis=require(_0x8124('0x12'));var authService=require(_0x8124('0x13'));var qs=require(_0x8124('0x14'));var as=require(_0x8124('0x15'));var hardwareService=require(_0x8124('0x16'));var logger=require(_0x8124('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8124('0x18'));var db=require(_0x8124('0x19'))['db'];function respondWithStatusCode(_0x508a45,_0x4a9785){_0x4a9785=_0x4a9785||0xcc;return function(_0x54d42b){if(_0x54d42b){return _0x508a45[_0x8124('0x1a')](_0x4a9785);}return _0x508a45[_0x8124('0x1b')](_0x4a9785)[_0x8124('0x1c')]();};}function respondWithResult(_0x4fbe93,_0x12b0e6){_0x12b0e6=_0x12b0e6||0xc8;return function(_0xc735a5){if(_0xc735a5){return _0x4fbe93['status'](_0x12b0e6)['json'](_0xc735a5);}};}function respondWithFilteredResult(_0x4a9816,_0x3aaf5d){return function(_0x352064){if(_0x352064){var _0x6bee46=typeof _0x3aaf5d[_0x8124('0x1d')]===_0x8124('0x1e')&&typeof _0x3aaf5d['limit']===_0x8124('0x1e');var _0x732edb=_0x352064[_0x8124('0x1f')];var _0x1b6810=_0x6bee46?0x0:_0x3aaf5d[_0x8124('0x1d')];var _0x441dbd=_0x6bee46?_0x352064[_0x8124('0x1f')]:_0x3aaf5d[_0x8124('0x1d')]+_0x3aaf5d['limit'];var _0x5410aa;if(_0x441dbd>=_0x732edb){_0x441dbd=_0x732edb;_0x5410aa=0xc8;}else{_0x5410aa=0xce;}_0x4a9816[_0x8124('0x1b')](_0x5410aa);return _0x4a9816['set'](_0x8124('0x20'),_0x1b6810+'-'+_0x441dbd+'/'+_0x732edb)[_0x8124('0x21')](_0x352064);}return null;};}function patchUpdates(_0x5f4290){return function(_0x207aec){try{jsonpatch[_0x8124('0x22')](_0x207aec,_0x5f4290,!![]);}catch(_0x5a770d){return BPromise[_0x8124('0x23')](_0x5a770d);}return _0x207aec[_0x8124('0x24')]();};}function saveUpdates(_0x1d77ac,_0x407ea9){return function(_0x33e63d){if(_0x33e63d){return _0x33e63d[_0x8124('0x25')](_0x1d77ac)[_0x8124('0x26')](function(_0x558721){return _0x558721;});}return null;};}function removeEntity(_0xb1d8ec,_0x1003eb){return function(_0x280607){if(_0x280607){return _0x280607[_0x8124('0x27')]()[_0x8124('0x26')](function(){_0xb1d8ec[_0x8124('0x1b')](0xcc)[_0x8124('0x1c')]();});}};}function handleEntityNotFound(_0x5387f4,_0x4db46b){return function(_0x566ac4){if(!_0x566ac4){_0x5387f4['sendStatus'](0x194);}return _0x566ac4;};}function handleError(_0x2a8332,_0x303171){_0x303171=_0x303171||0x1f4;return function(_0xfb5031){logger[_0x8124('0x28')](_0xfb5031[_0x8124('0x29')]);if(_0xfb5031['name']){delete _0xfb5031[_0x8124('0x2a')];}_0x2a8332[_0x8124('0x1b')](_0x303171)[_0x8124('0x2b')](_0xfb5031);};}exports[_0x8124('0x2c')]=function(_0x2bb32c,_0x451d85){var _0x2fca90={},_0x216f17={},_0xb114c2={'count':0x0,'rows':[]};var _0x158a79=_[_0x8124('0x2d')](db['Automation'][_0x8124('0x2e')],function(_0x5b03d3){return{'name':_0x5b03d3[_0x8124('0x2f')],'type':_0x5b03d3[_0x8124('0x30')]['key']};});_0x216f17['model']=_['map'](_0x158a79,_0x8124('0x2a'));_0x216f17['query']=_[_0x8124('0x31')](_0x2bb32c['query']);_0x216f17[_0x8124('0x32')]=_[_0x8124('0x33')](_0x216f17[_0x8124('0x34')],_0x216f17['query']);_0x2fca90[_0x8124('0x35')]=_[_0x8124('0x33')](_0x216f17[_0x8124('0x34')],qs['fields'](_0x2bb32c['query']['fields']));_0x2fca90['attributes']=_0x2fca90[_0x8124('0x35')][_0x8124('0x36')]?_0x2fca90[_0x8124('0x35')]:_0x216f17[_0x8124('0x34')];if(!_0x2bb32c[_0x8124('0x37')][_0x8124('0x38')](_0x8124('0x39'))){_0x2fca90[_0x8124('0x3a')]=qs[_0x8124('0x3a')](_0x2bb32c[_0x8124('0x37')][_0x8124('0x3a')]);_0x2fca90[_0x8124('0x1d')]=qs[_0x8124('0x1d')](_0x2bb32c[_0x8124('0x37')][_0x8124('0x1d')]);}_0x2fca90[_0x8124('0x3b')]=qs[_0x8124('0x3c')](_0x2bb32c['query']['sort']);_0x2fca90['where']=qs[_0x8124('0x32')](_[_0x8124('0x3d')](_0x2bb32c[_0x8124('0x37')],_0x216f17['filters']),_0x158a79);if(_0x2bb32c[_0x8124('0x37')][_0x8124('0x3e')]){_0x2fca90['where']=_[_0x8124('0x3f')](_0x2fca90[_0x8124('0x40')],{'$or':_[_0x8124('0x2d')](_0x158a79,function(_0x21f1d8){if(_0x21f1d8[_0x8124('0x30')]!=='VIRTUAL'){var _0x5439a6={};_0x5439a6[_0x21f1d8[_0x8124('0x2a')]]={'$like':'%'+_0x2bb32c[_0x8124('0x37')]['filter']+'%'};return _0x5439a6;}})});}_0x2fca90=_[_0x8124('0x3f')]({},_0x2fca90,_0x2bb32c['options']);var _0x55478f={'where':_0x2fca90[_0x8124('0x40')]};return db[_0x8124('0x41')][_0x8124('0x1f')](_0x55478f)[_0x8124('0x26')](function(_0x5648ae){_0xb114c2[_0x8124('0x1f')]=_0x5648ae;if(_0x2bb32c[_0x8124('0x37')][_0x8124('0x42')]){_0x2fca90[_0x8124('0x43')]=[{'all':!![]}];}return db[_0x8124('0x41')][_0x8124('0x44')](_0x2fca90);})[_0x8124('0x26')](function(_0x2a6a89){_0xb114c2['rows']=_0x2a6a89;return _0xb114c2;})[_0x8124('0x26')](respondWithFilteredResult(_0x451d85,_0x2fca90))['catch'](handleError(_0x451d85,null));};exports['show']=function(_0x4d2ff8,_0xabaf08){var _0x371e40={'raw':![],'where':{'id':_0x4d2ff8[_0x8124('0x45')]['id']}},_0x35edd7={};_0x35edd7[_0x8124('0x34')]=_[_0x8124('0x31')](db[_0x8124('0x41')][_0x8124('0x2e')]);_0x35edd7[_0x8124('0x37')]=_[_0x8124('0x31')](_0x4d2ff8[_0x8124('0x37')]);_0x35edd7[_0x8124('0x32')]=_[_0x8124('0x33')](_0x35edd7[_0x8124('0x34')],_0x35edd7[_0x8124('0x37')]);_0x371e40[_0x8124('0x35')]=_[_0x8124('0x33')](_0x35edd7['model'],qs[_0x8124('0x46')](_0x4d2ff8[_0x8124('0x37')]['fields']));_0x371e40[_0x8124('0x35')]=_0x371e40[_0x8124('0x35')][_0x8124('0x36')]?_0x371e40[_0x8124('0x35')]:_0x35edd7[_0x8124('0x34')];if(_0x4d2ff8['query'][_0x8124('0x42')]){_0x371e40[_0x8124('0x43')]=[{'all':!![]}];}_0x371e40=_[_0x8124('0x3f')]({},_0x371e40,_0x4d2ff8[_0x8124('0x47')]);return db['Automation'][_0x8124('0x48')](_0x371e40)['then'](handleEntityNotFound(_0xabaf08,null))['then'](respondWithResult(_0xabaf08,null))[_0x8124('0x49')](handleError(_0xabaf08,null));};exports[_0x8124('0x4a')]=function(_0x4ea287,_0x37edb1){return db[_0x8124('0x41')][_0x8124('0x4a')](_0x4ea287[_0x8124('0x4b')],{})['then'](respondWithResult(_0x37edb1,0xc9))[_0x8124('0x49')](handleError(_0x37edb1,null));};exports[_0x8124('0x25')]=function(_0x172414,_0x1f8311){if(_0x172414['body']['id']){delete _0x172414['body']['id'];}return db[_0x8124('0x41')][_0x8124('0x48')]({'where':{'id':_0x172414[_0x8124('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f8311,null))[_0x8124('0x26')](saveUpdates(_0x172414[_0x8124('0x4b')],null))[_0x8124('0x26')](respondWithResult(_0x1f8311,null))[_0x8124('0x49')](handleError(_0x1f8311,null));};exports['destroy']=function(_0x343450,_0x2c878a){return db[_0x8124('0x41')][_0x8124('0x48')]({'where':{'id':_0x343450['params']['id']}})[_0x8124('0x26')](handleEntityNotFound(_0x2c878a,null))[_0x8124('0x26')](removeEntity(_0x2c878a,null))[_0x8124('0x49')](handleError(_0x2c878a,null));};exports[_0x8124('0x4c')]=function(_0xee7f87,_0x20a0c9,_0x4a093f){return db[_0x8124('0x4d')][_0x8124('0x48')]({'where':{'id':_0xee7f87[_0x8124('0x45')]['id']}})['then'](handleEntityNotFound(_0x20a0c9,null))['then'](function(_0x3b6d4c){if(_0x3b6d4c){return _0x3b6d4c[_0x8124('0x4c')](_0xee7f87[_0x8124('0x4b')][_0x8124('0x4e')],_['omit'](_0xee7f87[_0x8124('0x4b')],[_0x8124('0x4e'),'id'])||{});}})[_0x8124('0x26')](respondWithResult(_0x20a0c9,null))[_0x8124('0x49')](handleError(_0x20a0c9,null));};exports[_0x8124('0x4f')]=function(_0x1c6d72,_0x28c5cb,_0x17bb2a){var _0x4edf6f={};var _0x524e1f={};var _0x4da122;var _0x4a82c8;return db[_0x8124('0x41')][_0x8124('0x50')]({'where':{'id':_0x1c6d72[_0x8124('0x45')]['id']}})['then'](handleEntityNotFound(_0x28c5cb,null))[_0x8124('0x26')](function(_0x293981){if(_0x293981){_0x4da122=_0x293981;_0x524e1f[_0x8124('0x34')]=_[_0x8124('0x31')](db[_0x8124('0x4d')][_0x8124('0x2e')]);_0x524e1f['query']=_[_0x8124('0x31')](_0x1c6d72[_0x8124('0x37')]);_0x524e1f[_0x8124('0x32')]=_['intersection'](_0x524e1f[_0x8124('0x34')],_0x524e1f[_0x8124('0x37')]);_0x4edf6f[_0x8124('0x35')]=_[_0x8124('0x33')](_0x524e1f['model'],qs['fields'](_0x1c6d72[_0x8124('0x37')][_0x8124('0x46')]));_0x4edf6f[_0x8124('0x35')]=_0x4edf6f['attributes'][_0x8124('0x36')]?_0x4edf6f[_0x8124('0x35')]:_0x524e1f['model'];_0x4edf6f['order']=qs['sort'](_0x1c6d72[_0x8124('0x37')][_0x8124('0x3c')]);_0x4edf6f[_0x8124('0x40')]=qs['filters'](_[_0x8124('0x3d')](_0x1c6d72['query'],_0x524e1f[_0x8124('0x32')]));if(_0x1c6d72[_0x8124('0x37')][_0x8124('0x3e')]){_0x4edf6f['where']=_[_0x8124('0x3f')](_0x4edf6f['where'],{'$or':_[_0x8124('0x2d')](_0x4edf6f[_0x8124('0x35')],function(_0x325fef){var _0x290ca3={};_0x290ca3[_0x325fef]={'$like':'%'+_0x1c6d72[_0x8124('0x37')][_0x8124('0x3e')]+'%'};return _0x290ca3;})});}_0x4edf6f=_['merge']({},_0x4edf6f,_0x1c6d72[_0x8124('0x47')]);return _0x4da122['getConditions'](_0x4edf6f);}})[_0x8124('0x26')](function(_0x3a9ece){if(_0x3a9ece){_0x4a82c8=_0x3a9ece[_0x8124('0x36')];if(!_0x1c6d72[_0x8124('0x37')]['hasOwnProperty']('nolimit')){_0x4edf6f[_0x8124('0x3a')]=qs[_0x8124('0x3a')](_0x1c6d72[_0x8124('0x37')]['limit']);_0x4edf6f[_0x8124('0x1d')]=qs['offset'](_0x1c6d72[_0x8124('0x37')][_0x8124('0x1d')]);}return _0x4da122[_0x8124('0x4f')](_0x4edf6f);}})[_0x8124('0x26')](function(_0x13c71e){if(_0x13c71e){return _0x13c71e?{'count':_0x4a82c8,'rows':_0x13c71e}:null;}})[_0x8124('0x26')](respondWithResult(_0x28c5cb,null))[_0x8124('0x49')](handleError(_0x28c5cb,null));};exports[_0x8124('0x51')]=function(_0x273d3c,_0x5403b5,_0x5dadfd){return db[_0x8124('0x52')][_0x8124('0x48')]({'where':{'id':_0x273d3c['params']['id']}})[_0x8124('0x26')](handleEntityNotFound(_0x5403b5,null))[_0x8124('0x26')](function(_0x574cc4){if(_0x574cc4){return _0x574cc4[_0x8124('0x51')](_0x273d3c[_0x8124('0x4b')][_0x8124('0x4e')],_[_0x8124('0x53')](_0x273d3c[_0x8124('0x4b')],[_0x8124('0x4e'),'id'])||{});}})[_0x8124('0x26')](respondWithResult(_0x5403b5,null))[_0x8124('0x49')](handleError(_0x5403b5,null));};exports['getActions']=function(_0x25b580,_0x355aa2,_0x202996){var _0xb03614={};var _0x41f1e4={};var _0x41f1a0;var _0x4f7599;return db['Automation'][_0x8124('0x50')]({'where':{'id':_0x25b580['params']['id']}})[_0x8124('0x26')](handleEntityNotFound(_0x355aa2,null))['then'](function(_0x13a140){if(_0x13a140){_0x41f1a0=_0x13a140;_0x41f1e4['model']=_[_0x8124('0x31')](db[_0x8124('0x52')][_0x8124('0x2e')]);_0x41f1e4[_0x8124('0x37')]=_[_0x8124('0x31')](_0x25b580[_0x8124('0x37')]);_0x41f1e4[_0x8124('0x32')]=_[_0x8124('0x33')](_0x41f1e4[_0x8124('0x34')],_0x41f1e4[_0x8124('0x37')]);_0xb03614[_0x8124('0x35')]=_[_0x8124('0x33')](_0x41f1e4['model'],qs[_0x8124('0x46')](_0x25b580[_0x8124('0x37')][_0x8124('0x46')]));_0xb03614['attributes']=_0xb03614[_0x8124('0x35')][_0x8124('0x36')]?_0xb03614[_0x8124('0x35')]:_0x41f1e4['model'];_0xb03614['order']=qs[_0x8124('0x3c')](_0x25b580[_0x8124('0x37')][_0x8124('0x3c')]);_0xb03614[_0x8124('0x40')]=qs['filters'](_[_0x8124('0x3d')](_0x25b580['query'],_0x41f1e4[_0x8124('0x32')]));if(_0x25b580[_0x8124('0x37')][_0x8124('0x3e')]){_0xb03614[_0x8124('0x40')]=_['merge'](_0xb03614['where'],{'$or':_[_0x8124('0x2d')](_0xb03614[_0x8124('0x35')],function(_0x26c669){var _0x1ea639={};_0x1ea639[_0x26c669]={'$like':'%'+_0x25b580[_0x8124('0x37')][_0x8124('0x3e')]+'%'};return _0x1ea639;})});}_0xb03614=_['merge']({},_0xb03614,_0x25b580['options']);return _0x41f1a0[_0x8124('0x54')](_0xb03614);}})[_0x8124('0x26')](function(_0x639570){if(_0x639570){_0x4f7599=_0x639570[_0x8124('0x36')];if(!_0x25b580['query'][_0x8124('0x38')](_0x8124('0x39'))){_0xb03614[_0x8124('0x3a')]=qs[_0x8124('0x3a')](_0x25b580['query']['limit']);_0xb03614[_0x8124('0x1d')]=qs[_0x8124('0x1d')](_0x25b580[_0x8124('0x37')][_0x8124('0x1d')]);}return _0x41f1a0[_0x8124('0x54')](_0xb03614);}})[_0x8124('0x26')](function(_0x137b9d){if(_0x137b9d){return _0x137b9d?{'count':_0x4f7599,'rows':_0x137b9d}:null;}})[_0x8124('0x26')](respondWithResult(_0x355aa2,null))[_0x8124('0x49')](handleError(_0x355aa2,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 88c181e..40d6118 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 _0x19b9=['./automation.attributes','exports','Automation','tools_automations','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x4114dd,_0x2ad862){var _0x26f44c=function(_0xad2246){while(--_0xad2246){_0x4114dd['push'](_0x4114dd['shift']());}};_0x26f44c(++_0x2ad862);}(_0x19b9,0xc2));var _0x919b=function(_0x1cb890,_0x3b3a68){_0x1cb890=_0x1cb890-0x0;var _0x143993=_0x19b9[_0x1cb890];return _0x143993;};'use strict';var _=require(_0x919b('0x0'));var util=require(_0x919b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x919b('0x2'));var rp=require(_0x919b('0x3'));var fs=require('fs');var path=require(_0x919b('0x4'));var rimraf=require(_0x919b('0x5'));var config=require('../../config/environment');var attributes=require(_0x919b('0x6'));module[_0x919b('0x7')]=function(_0x58c530,_0x33a0ac){return _0x58c530['define'](_0x919b('0x8'),attributes,{'tableName':_0x919b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb270=['../../config/logger','api','moment','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0xb270,0x167));var _0x0b27=function(_0x2b0690,_0x4f742f){_0x2b0690=_0x2b0690-0x0;var _0x82be1=_0xb270[_0x2b0690];return _0x82be1;};'use strict';var _=require('lodash');var util=require(_0x0b27('0x0'));var logger=require(_0x0b27('0x1'))(_0x0b27('0x2'));var moment=require(_0x0b27('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b27('0x4'));var rimraf=require(_0x0b27('0x5'));var config=require(_0x0b27('0x6'));var attributes=require(_0x0b27('0x7'));module[_0x0b27('0x8')]=function(_0x2cab45,_0x436017){return _0x2cab45[_0x0b27('0x9')](_0x0b27('0xa'),attributes,{'tableName':_0x0b27('0xb'),'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 a51f423..dfbab14 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 _0x17a7=['Automation,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info'];(function(_0x1569fc,_0x115095){var _0x277783=function(_0x49e9c1){while(--_0x49e9c1){_0x1569fc['push'](_0x1569fc['shift']());}};_0x277783(++_0x115095);}(_0x17a7,0xc2));var _0x717a=function(_0x8d5d35,_0x4e289b){_0x8d5d35=_0x8d5d35-0x0;var _0x309712=_0x17a7[_0x8d5d35];return _0x309712;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x717a('0x0'));var rs=require(_0x717a('0x1'));var fs=require('fs');var Redis=require(_0x717a('0x2'));var db=require(_0x717a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x717a('0x4'))('rpc');var config=require(_0x717a('0x5'));var jayson=require(_0x717a('0x6'));var client=jayson['client'][_0x717a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ca7a6,_0xd7d2ce,_0x311738){return new BPromise(function(_0x536824,_0x1066d4){return client['request'](_0x1ca7a6,_0x311738)[_0x717a('0x8')](function(_0x567130){logger[_0x717a('0x9')](_0x717a('0xa'),_0xd7d2ce,_0x717a('0xb'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'),JSON[_0x717a('0xc')](_0x567130));if(_0x567130[_0x717a('0xd')]){if(_0x567130[_0x717a('0xd')][_0x717a('0xe')]===0x1f4){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x567130['error'][_0x717a('0xf')]);return _0x1066d4(_0x567130['error']['message']);}logger['error']('Automation,\x20%s,\x20%s',_0xd7d2ce,_0x567130[_0x717a('0xd')]['message']);return _0x536824(_0x567130[_0x717a('0xd')]['message']);}else{logger[_0x717a('0x9')]('Automation,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'));_0x536824(_0x567130[_0x717a('0x10')][_0x717a('0xf')]);}})['catch'](function(_0x186b4d){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x186b4d);_0x1066d4(_0x186b4d);});});} \ No newline at end of file +var _0x4959=['../../config/logger','rpc','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4959,0x9b));var _0x9495=function(_0x3156c9,_0x3ee8b8){_0x3156c9=_0x3156c9-0x0;var _0x486742=_0x4959[_0x3156c9];return _0x486742;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9495('0x0'));var BPromise=require(_0x9495('0x1'));var rs=require(_0x9495('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9495('0x3'))['db'];var utils=require(_0x9495('0x4'));var logger=require(_0x9495('0x5'))(_0x9495('0x6'));var config=require('../../config/environment');var jayson=require(_0x9495('0x7'));var client=jayson[_0x9495('0x8')][_0x9495('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21f4e7,_0xd77231,_0x34744d){return new BPromise(function(_0x2a4754,_0x19f08c){return client[_0x9495('0xa')](_0x21f4e7,_0x34744d)[_0x9495('0xb')](function(_0x6b1466){logger['info'](_0x9495('0xc'),_0xd77231,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0xd77231,'request\x20sent',JSON[_0x9495('0xd')](_0x6b1466));if(_0x6b1466[_0x9495('0xe')]){if(_0x6b1466[_0x9495('0xe')][_0x9495('0xf')]===0x1f4){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x19f08c(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x2a4754(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}else{logger['info'](_0x9495('0xc'),_0xd77231,_0x9495('0x11'));_0x2a4754(_0x6b1466[_0x9495('0x12')][_0x9495('0x10')]);}})[_0x9495('0x13')](function(_0x4c1d9d){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x4c1d9d);_0x19f08c(_0x4c1d9d);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 8cc5f05..af5dfcc 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 _0xbefb=['get','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xbefb,0x13c));var _0xbbef=function(_0x1ebd5c,_0x36150e){_0x1ebd5c=_0x1ebd5c-0x0;var _0x26eefc=_0xbefb[_0x1ebd5c];return _0x26eefc;};'use strict';var multer=require(_0xbbef('0x0'));var util=require(_0xbbef('0x1'));var path=require('path');var timeout=require(_0xbbef('0x2'));var express=require(_0xbbef('0x3'));var router=express['Router']();var fs_extra=require(_0xbbef('0x4'));var auth=require(_0xbbef('0x5'));var interaction=require(_0xbbef('0x6'));var config=require('../../config/environment');var controller=require('./automation.controller');router['get']('/',auth[_0xbbef('0x7')](),controller['index']);router[_0xbbef('0x8')](_0xbbef('0x9'),auth[_0xbbef('0x7')](),controller['show']);router[_0xbbef('0x8')](_0xbbef('0xa'),auth[_0xbbef('0x7')](),controller[_0xbbef('0xb')]);router['get'](_0xbbef('0xc'),auth['isAuthenticated'](),controller[_0xbbef('0xd')]);router[_0xbbef('0xe')]('/',auth[_0xbbef('0x7')](),controller['create']);router['post'](_0xbbef('0xa'),auth[_0xbbef('0x7')](),controller[_0xbbef('0xf')]);router['post']('/:id/actions',auth[_0xbbef('0x7')](),controller[_0xbbef('0x10')]);router['put'](_0xbbef('0x9'),auth[_0xbbef('0x7')](),controller['update']);router[_0xbbef('0x11')](_0xbbef('0x9'),auth[_0xbbef('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb205=['Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','getActions','post','create','addActions','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x28e459,_0x1a066b){var _0x5ccc9e=function(_0x36e31a){while(--_0x36e31a){_0x28e459['push'](_0x28e459['shift']());}};_0x5ccc9e(++_0x1a066b);}(_0xb205,0x156));var _0x5b20=function(_0x43a129,_0x17d8ab){_0x43a129=_0x43a129-0x0;var _0x314353=_0xb205[_0x43a129];return _0x314353;};'use strict';var multer=require(_0x5b20('0x0'));var util=require('util');var path=require(_0x5b20('0x1'));var timeout=require(_0x5b20('0x2'));var express=require('express');var router=express[_0x5b20('0x3')]();var fs_extra=require(_0x5b20('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5b20('0x5'));var config=require(_0x5b20('0x6'));var controller=require(_0x5b20('0x7'));router[_0x5b20('0x8')]('/',auth[_0x5b20('0x9')](),controller[_0x5b20('0xa')]);router[_0x5b20('0x8')](_0x5b20('0xb'),auth[_0x5b20('0x9')](),controller[_0x5b20('0xc')]);router[_0x5b20('0x8')](_0x5b20('0xd'),auth[_0x5b20('0x9')](),controller['getConditions']);router[_0x5b20('0x8')](_0x5b20('0xe'),auth[_0x5b20('0x9')](),controller[_0x5b20('0xf')]);router[_0x5b20('0x10')]('/',auth[_0x5b20('0x9')](),controller[_0x5b20('0x11')]);router['post']('/:id/conditions',auth[_0x5b20('0x9')](),controller['addConditions']);router[_0x5b20('0x10')](_0x5b20('0xe'),auth[_0x5b20('0x9')](),controller[_0x5b20('0x12')]);router['put'](_0x5b20('0xb'),auth[_0x5b20('0x9')](),controller[_0x5b20('0x13')]);router[_0x5b20('0x14')](_0x5b20('0xb'),auth['isAuthenticated'](),controller[_0x5b20('0x15')]);module[_0x5b20('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 22f9ad5..66ce21e 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 _0x5857=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','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,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)'];(function(_0x145450,_0x8d1918){var _0x39b89d=function(_0x51f5e7){while(--_0x51f5e7){_0x145450['push'](_0x145450['shift']());}};_0x39b89d(++_0x8d1918);}(_0x5857,0xbf));var _0x7585=function(_0x4ac523,_0x5ce50e){_0x4ac523=_0x4ac523-0x0;var _0x53aa8d=_0x5857[_0x4ac523];return _0x53aa8d;};'use strict';var Sequelize=require(_0x7585('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7585('0x1')](_0x7585('0x2')),'allowNull':![],'defaultValue':_0x7585('0x2')},'description':{'type':Sequelize[_0x7585('0x3')]},'active':{'type':Sequelize[_0x7585('0x4')],'defaultValue':0x0,'comment':_0x7585('0x5')},'limitCalls':{'type':Sequelize[_0x7585('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7585('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7585('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7585('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7585('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x3,'comment':_0x7585('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7585('0xf')},'dialTimezone':{'type':Sequelize[_0x7585('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7585('0x3')],'defaultValue':_0x7585('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x7585('0x1')](_0x7585('0x11'),_0x7585('0x12'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x7585('0x4')],'defaultValue':0x0,'comment':_0x7585('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7585('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7585('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x7585('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7585('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7585('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7585('0x6')](0x9)[_0x7585('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x7585('0x6')](0x9)[_0x7585('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7585('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7585('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7585('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7585('0x6')](0x5)[_0x7585('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7585('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7585('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7585('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7585('0x1')](_0x7585('0x1b'),_0x7585('0x1c')),'defaultValue':_0x7585('0x1b')},'dialPrefix':{'type':Sequelize[_0x7585('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x7585('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7585('0x1d')},'dialCutDigit':{'type':Sequelize[_0x7585('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7585('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7585('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7585('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7585('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x0f46=['name','ivr','BOOLEAN','Active/Disactive\x20Campaign','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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','#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)','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)','sequelize','exports','STRING'];(function(_0x53d93e,_0x371336){var _0x11b182=function(_0x3e87fe){while(--_0x3e87fe){_0x53d93e['push'](_0x53d93e['shift']());}};_0x11b182(++_0x371336);}(_0x0f46,0x1a1));var _0x60f4=function(_0x812db,_0x2e8c4d){_0x812db=_0x812db-0x0;var _0xbff811=_0x0f46[_0x812db];return _0xbff811;};'use strict';var Sequelize=require(_0x60f4('0x0'));module[_0x60f4('0x1')]={'name':{'type':Sequelize[_0x60f4('0x2')],'unique':_0x60f4('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x60f4('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x60f4('0x5')],'defaultValue':0x0,'comment':_0x60f4('0x6')},'limitCalls':{'type':Sequelize[_0x60f4('0x7')](0x4)[_0x60f4('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x60f4('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x60f4('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x60f4('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x60f4('0x7')](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60f4('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x60f4('0x7')](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'comment':_0x60f4('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x60f4('0xe')},'dialTimezone':{'type':Sequelize[_0x60f4('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x60f4('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x60f4('0xf')](_0x60f4('0x10'),'never','onlyIfOpen'),'defaultValue':_0x60f4('0x10')},'dialAMDActive':{'type':Sequelize[_0x60f4('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x60f4('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x60f4('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x60f4('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x60f4('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x60f4('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x60f4('0x7')](0x9)[_0x60f4('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x60f4('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0x60f4('0x7')](0x9)[_0x60f4('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x60f4('0x7')](0x9)[_0x60f4('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x60f4('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x60f4('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x60f4('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x60f4('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x60f4('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x60f4('0xf')](_0x60f4('0x17'),_0x60f4('0x18')),'defaultValue':_0x60f4('0x17')},'dialPrefix':{'type':Sequelize[_0x60f4('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x60f4('0x7')](0x3)[_0x60f4('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x60f4('0x19')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x60f4('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60f4('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0x60f4('0x7')](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60f4('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x60f4('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60f4('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x60f4('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x60f4('0x8')],'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 b97a0c6..3e01ead 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 _0x3276=['hasOwnProperty','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','NOW()','CmListId','toString','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','select','onlyIfOpen','ContactId','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','OrderBy','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','ListId\x20=\x20?','removeBlackLists','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','destroy','IvrCampaigns','error','stack','name','send','Campaign','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filters','filter','merge','where','map','type','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','getHoppers','findOne'];(function(_0x24e91d,_0x5d6ffe){var _0x324d8d=function(_0x53a0e0){while(--_0x53a0e0){_0x24e91d['push'](_0x24e91d['shift']());}};_0x324d8d(++_0x5d6ffe);}(_0x3276,0xc7));var _0x6327=function(_0xd49307,_0x494d50){_0xd49307=_0xd49307-0x0;var _0x5c519=_0x3276[_0xd49307];return _0x5c519;};'use strict';var emlformat=require(_0x6327('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6327('0x1'));var rp=require(_0x6327('0x2'));var moment=require(_0x6327('0x3'));var BPromise=require(_0x6327('0x4'));var Mustache=require(_0x6327('0x5'));var util=require(_0x6327('0x6'));var path=require(_0x6327('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6327('0x8'));var fs=require('fs');var fs_extra=require(_0x6327('0x9'));var _=require(_0x6327('0xa'));var squel=require('squel');var crypto=require(_0x6327('0xb'));var jsforce=require(_0x6327('0xc'));var deskjs=require(_0x6327('0xd'));var toCsv=require(_0x6327('0xe'));var querystring=require('querystring');var Papa=require(_0x6327('0xf'));var Redis=require(_0x6327('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6327('0x11'));var as=require(_0x6327('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6327('0x13'))(_0x6327('0x14'));var utils=require(_0x6327('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6327('0x16'));var db=require(_0x6327('0x17'))['db'];function respondWithStatusCode(_0xb6de72,_0x32408c){_0x32408c=_0x32408c||0xcc;return function(_0x3ff61b){if(_0x3ff61b){return _0xb6de72[_0x6327('0x18')](_0x32408c);}return _0xb6de72[_0x6327('0x19')](_0x32408c)[_0x6327('0x1a')]();};}function respondWithResult(_0x576b1c,_0x306095){_0x306095=_0x306095||0xc8;return function(_0x48eb75){if(_0x48eb75){return _0x576b1c[_0x6327('0x19')](_0x306095)['json'](_0x48eb75);}};}function respondWithFilteredResult(_0x441ff9,_0x1e850c){return function(_0x43186f){if(_0x43186f){var _0x4e9741=typeof _0x1e850c[_0x6327('0x1b')]===_0x6327('0x1c')&&typeof _0x1e850c[_0x6327('0x1d')]===_0x6327('0x1c');var _0x3ea016=_0x43186f[_0x6327('0x1e')];var _0x341a51=_0x4e9741?0x0:_0x1e850c[_0x6327('0x1b')];var _0x287899=_0x4e9741?_0x43186f[_0x6327('0x1e')]:_0x1e850c[_0x6327('0x1b')]+_0x1e850c[_0x6327('0x1d')];var _0x55cf65;if(_0x287899>=_0x3ea016){_0x287899=_0x3ea016;_0x55cf65=0xc8;}else{_0x55cf65=0xce;}_0x441ff9[_0x6327('0x19')](_0x55cf65);return _0x441ff9[_0x6327('0x1f')](_0x6327('0x20'),_0x341a51+'-'+_0x287899+'/'+_0x3ea016)[_0x6327('0x21')](_0x43186f);}return null;};}function patchUpdates(_0x4cbc80){return function(_0x56249b){try{jsonpatch[_0x6327('0x22')](_0x56249b,_0x4cbc80,!![]);}catch(_0x700766){return BPromise[_0x6327('0x23')](_0x700766);}return _0x56249b[_0x6327('0x24')]();};}function saveUpdates(_0x3078c5,_0x76c718){return function(_0x5754e1){if(_0x5754e1){return _0x5754e1[_0x6327('0x25')](_0x3078c5)[_0x6327('0x26')](function(_0x2f153c){return _0x2f153c;});}return null;};}function removeEntity(_0x1c3d7f,_0x302b3f){return function(_0x254c2f){if(_0x254c2f){return _0x254c2f[_0x6327('0x27')]()[_0x6327('0x26')](function(){var _0x10e312=_0x254c2f['get']({'plain':!![]});var _0x51dbe9=_0x6327('0x28');return db['UserProfileResource'][_0x6327('0x27')]({'where':{'type':_0x51dbe9,'resourceId':_0x10e312['id']}})['then'](function(){return _0x254c2f;});})[_0x6327('0x26')](function(){_0x1c3d7f['status'](0xcc)[_0x6327('0x1a')]();});}};}function handleEntityNotFound(_0x1eae65,_0x486f8e){return function(_0x44caac){if(!_0x44caac){_0x1eae65[_0x6327('0x18')](0x194);}return _0x44caac;};}function handleError(_0x14b41b,_0x2540bf){_0x2540bf=_0x2540bf||0x1f4;return function(_0x894157){logger[_0x6327('0x29')](_0x894157[_0x6327('0x2a')]);if(_0x894157[_0x6327('0x2b')]){delete _0x894157['name'];}_0x14b41b[_0x6327('0x19')](_0x2540bf)[_0x6327('0x2c')](_0x894157);};}exports['index']=function(_0x269c33,_0x40e927){var _0x5e8ff5={},_0x43bcd0={},_0x41ecd5={'count':0x0,'rows':[]};var _0x330471=_['map'](db[_0x6327('0x2d')][_0x6327('0x2e')],function(_0x1066d9){return{'name':_0x1066d9[_0x6327('0x2f')],'type':_0x1066d9['type'][_0x6327('0x30')]};});_0x43bcd0['model']=_['map'](_0x330471,_0x6327('0x2b'));_0x43bcd0[_0x6327('0x31')]=_[_0x6327('0x32')](_0x269c33[_0x6327('0x31')]);_0x43bcd0['filters']=_[_0x6327('0x33')](_0x43bcd0[_0x6327('0x34')],_0x43bcd0[_0x6327('0x31')]);_0x5e8ff5[_0x6327('0x35')]=_['intersection'](_0x43bcd0[_0x6327('0x34')],qs[_0x6327('0x36')](_0x269c33[_0x6327('0x31')]['fields']));_0x5e8ff5[_0x6327('0x35')]=_0x5e8ff5[_0x6327('0x35')][_0x6327('0x37')]?_0x5e8ff5['attributes']:_0x43bcd0['model'];if(!_0x269c33[_0x6327('0x31')]['hasOwnProperty'](_0x6327('0x38'))){_0x5e8ff5['limit']=qs[_0x6327('0x1d')](_0x269c33[_0x6327('0x31')][_0x6327('0x1d')]);_0x5e8ff5[_0x6327('0x1b')]=qs[_0x6327('0x1b')](_0x269c33[_0x6327('0x31')]['offset']);}_0x5e8ff5[_0x6327('0x39')]=qs[_0x6327('0x3a')](_0x269c33[_0x6327('0x31')][_0x6327('0x3a')]);_0x5e8ff5['where']=qs['filters'](_[_0x6327('0x3b')](_0x269c33[_0x6327('0x31')],_0x43bcd0[_0x6327('0x3c')]),_0x330471);if(_0x269c33[_0x6327('0x31')][_0x6327('0x3d')]){_0x5e8ff5['where']=_[_0x6327('0x3e')](_0x5e8ff5[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x330471,function(_0x10b988){if(_0x10b988[_0x6327('0x41')]!=='VIRTUAL'){var _0x49a887={};_0x49a887[_0x10b988[_0x6327('0x2b')]]={'$like':'%'+_0x269c33['query'][_0x6327('0x3d')]+'%'};return _0x49a887;}})});}_0x5e8ff5=_[_0x6327('0x3e')]({},_0x5e8ff5,_0x269c33[_0x6327('0x42')]);var _0x46b813={'where':_0x5e8ff5['where']};return db[_0x6327('0x2d')][_0x6327('0x1e')](_0x46b813)[_0x6327('0x26')](function(_0x592f0e){_0x41ecd5[_0x6327('0x1e')]=_0x592f0e;if(_0x269c33[_0x6327('0x31')]['includeAll']){_0x5e8ff5[_0x6327('0x43')]=[{'all':!![]}];}return db[_0x6327('0x2d')][_0x6327('0x44')](_0x5e8ff5);})[_0x6327('0x26')](function(_0xab88fb){_0x41ecd5[_0x6327('0x45')]=_0xab88fb;return _0x41ecd5;})[_0x6327('0x26')](respondWithFilteredResult(_0x40e927,_0x5e8ff5))[_0x6327('0x46')](handleError(_0x40e927,null));};exports[_0x6327('0x47')]=function(_0xc73e4a,_0x446f7c){var _0x3550c9={'raw':![],'where':{'id':_0xc73e4a[_0x6327('0x48')]['id']}},_0x115ed4={};_0x115ed4[_0x6327('0x34')]=_[_0x6327('0x32')](db[_0x6327('0x2d')][_0x6327('0x2e')]);_0x115ed4['query']=_[_0x6327('0x32')](_0xc73e4a[_0x6327('0x31')]);_0x115ed4['filters']=_['intersection'](_0x115ed4['model'],_0x115ed4[_0x6327('0x31')]);_0x3550c9[_0x6327('0x35')]=_['intersection'](_0x115ed4[_0x6327('0x34')],qs[_0x6327('0x36')](_0xc73e4a[_0x6327('0x31')][_0x6327('0x36')]));_0x3550c9[_0x6327('0x35')]=_0x3550c9[_0x6327('0x35')][_0x6327('0x37')]?_0x3550c9[_0x6327('0x35')]:_0x115ed4[_0x6327('0x34')];if(_0xc73e4a['query'][_0x6327('0x49')]){_0x3550c9[_0x6327('0x43')]=[{'all':!![]}];}_0x3550c9=_[_0x6327('0x3e')]({},_0x3550c9,_0xc73e4a['options']);return db[_0x6327('0x2d')][_0x6327('0x4a')](_0x3550c9)[_0x6327('0x26')](handleEntityNotFound(_0x446f7c,null))[_0x6327('0x26')](respondWithResult(_0x446f7c,null))['catch'](handleError(_0x446f7c,null));};exports[_0x6327('0x4b')]=function(_0x317edf,_0x3fc622){return db[_0x6327('0x2d')][_0x6327('0x4b')](_0x317edf[_0x6327('0x4c')],{})[_0x6327('0x26')](function(_0x33e8d3){var _0x11030e=_0x317edf[_0x6327('0x4d')][_0x6327('0x4e')]({'plain':!![]});if(!_0x11030e)throw new Error(_0x6327('0x4f'));if(_0x11030e[_0x6327('0x50')]===_0x6327('0x4d')){var _0x5e664d=_0x33e8d3['get']({'plain':!![]});var _0x1f95b6=_0x6327('0x28');return db[_0x6327('0x51')][_0x6327('0x4a')]({'where':{'name':_0x1f95b6,'userProfileId':_0x11030e[_0x6327('0x52')]},'raw':!![]})[_0x6327('0x26')](function(_0xc07c32){if(_0xc07c32&&_0xc07c32[_0x6327('0x53')]===0x0){return db[_0x6327('0x54')][_0x6327('0x4b')]({'name':_0x5e664d[_0x6327('0x2b')],'resourceId':_0x5e664d['id'],'type':_0xc07c32[_0x6327('0x2b')],'sectionId':_0xc07c32['id']},{})[_0x6327('0x26')](function(){return _0x33e8d3;});}else{return _0x33e8d3;}})[_0x6327('0x46')](function(_0x5daaed){logger[_0x6327('0x29')](_0x6327('0x55'),_0x5daaed);throw _0x5daaed;});}return _0x33e8d3;})[_0x6327('0x26')](respondWithResult(_0x3fc622,0xc9))[_0x6327('0x46')](handleError(_0x3fc622,null));};exports['clone']=function(_0x3e2b4f,_0x2ad46b){var _0x12862d={'where':{'id':_0x3e2b4f[_0x6327('0x48')]['id']}},_0x1bf90e={};_0x1bf90e['model']=_[_0x6327('0x32')](db['Campaign'][_0x6327('0x2e')]);_0x12862d[_0x6327('0x35')]=_[_0x6327('0x33')](_0x1bf90e[_0x6327('0x34')],qs[_0x6327('0x36')](_0x3e2b4f[_0x6327('0x31')]['fields']));_0x12862d[_0x6327('0x35')]=_0x12862d[_0x6327('0x35')]['length']?_0x12862d[_0x6327('0x35')]:_0x1bf90e[_0x6327('0x34')];if(_0x3e2b4f[_0x6327('0x31')][_0x6327('0x49')]){_0x12862d[_0x6327('0x43')]=[{'all':!![]}];}_0x12862d=_[_0x6327('0x3e')]({},_0x12862d,_0x3e2b4f[_0x6327('0x42')]);return db[_0x6327('0x2d')]['find'](_0x12862d)[_0x6327('0x26')](handleEntityNotFound(_0x2ad46b,null))[_0x6327('0x26')](function(_0x46c6bd){if(_0x46c6bd){var _0x2188c2=_0x46c6bd[_0x6327('0x4e')]({'plain':!![]});_0x2188c2=qs[_0x6327('0x56')](_0x2188c2,['id','createdAt',_0x6327('0x57')]);_0x3e2b4f['body']=_[_0x6327('0x56')](_0x3e2b4f[_0x6327('0x4c')],['id',_0x6327('0x58'),_0x6327('0x57')]);return db[_0x6327('0x2d')][_0x6327('0x4b')](_[_0x6327('0x3e')](_0x2188c2,_0x3e2b4f[_0x6327('0x4c')]),{'include':_0x3e2b4f[_0x6327('0x31')][_0x6327('0x49')]?[{'all':!![]}]:undefined})[_0x6327('0x26')](function(_0x36f28a){var _0x3f0115=_0x3e2b4f['user'][_0x6327('0x4e')]({'plain':!![]});if(!_0x3f0115)throw new Error(_0x6327('0x4f'));if(_0x3f0115[_0x6327('0x50')]==='user'){var _0xbf5d09=_0x36f28a[_0x6327('0x4e')]({'plain':!![]});var _0x57ca83='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x57ca83,'userProfileId':_0x3f0115[_0x6327('0x52')]},'raw':!![]})[_0x6327('0x26')](function(_0x36f8c2){if(_0x36f8c2&&_0x36f8c2[_0x6327('0x53')]===0x0){return db[_0x6327('0x54')]['create']({'name':_0xbf5d09['name'],'resourceId':_0xbf5d09['id'],'type':_0x36f8c2[_0x6327('0x2b')],'sectionId':_0x36f8c2['id']},{})[_0x6327('0x26')](function(){return _0x36f28a;});}else{return _0x36f28a;}})['catch'](function(_0x28f13e){logger[_0x6327('0x29')](_0x6327('0x55'),_0x28f13e);throw _0x28f13e;});}return _0x36f28a;});}})[_0x6327('0x26')](respondWithResult(_0x2ad46b,0xc9))[_0x6327('0x46')](handleError(_0x2ad46b,null));};exports[_0x6327('0x25')]=function(_0x4b4031,_0x5446db){if(_0x4b4031['body']['id']){delete _0x4b4031[_0x6327('0x4c')]['id'];}return db[_0x6327('0x2d')]['find']({'where':{'id':_0x4b4031['params']['id']}})['then'](handleEntityNotFound(_0x5446db,null))[_0x6327('0x26')](saveUpdates(_0x4b4031[_0x6327('0x4c')],null))[_0x6327('0x26')](respondWithResult(_0x5446db,null))[_0x6327('0x46')](handleError(_0x5446db,null));};exports['destroy']=function(_0x3e66b5,_0x276fe1){return db[_0x6327('0x2d')]['find']({'where':{'id':_0x3e66b5['params']['id']}})['then'](handleEntityNotFound(_0x276fe1,null))[_0x6327('0x26')](removeEntity(_0x276fe1,null))[_0x6327('0x46')](handleError(_0x276fe1,null));};exports[_0x6327('0x59')]=function(_0x4c9e12,_0x513e06,_0x54326a){var _0x17b571={'raw':!![],'where':{}};var _0x5bbc4a={};var _0x1e2376={'count':0x0,'rows':[]};return db['Campaign'][_0x6327('0x5a')]({'where':{'id':_0x4c9e12[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x513e06,null))['then'](function(_0x4bdeab){if(_0x4bdeab){_0x5bbc4a[_0x6327('0x34')]=_[_0x6327('0x32')](db['CmHopper'][_0x6327('0x2e')]);_0x5bbc4a[_0x6327('0x31')]=_[_0x6327('0x32')](_0x4c9e12['query']);_0x5bbc4a[_0x6327('0x3c')]=_['intersection'](_0x5bbc4a[_0x6327('0x34')],_0x5bbc4a[_0x6327('0x31')]);_0x17b571[_0x6327('0x35')]=_[_0x6327('0x33')](_0x5bbc4a[_0x6327('0x34')],qs[_0x6327('0x36')](_0x4c9e12[_0x6327('0x31')][_0x6327('0x36')]));_0x17b571['attributes']=_0x17b571[_0x6327('0x35')][_0x6327('0x37')]?_0x17b571[_0x6327('0x35')]:_0x5bbc4a[_0x6327('0x34')];if(!_0x4c9e12['query'][_0x6327('0x5b')](_0x6327('0x38'))){_0x17b571[_0x6327('0x1d')]=qs[_0x6327('0x1d')](_0x4c9e12['query'][_0x6327('0x1d')]);_0x17b571[_0x6327('0x1b')]=qs['offset'](_0x4c9e12[_0x6327('0x31')][_0x6327('0x1b')]);}_0x17b571['order']=qs[_0x6327('0x3a')](_0x4c9e12['query'][_0x6327('0x3a')]);_0x17b571[_0x6327('0x3f')]=qs[_0x6327('0x3c')](_['pick'](_0x4c9e12[_0x6327('0x31')],_0x5bbc4a['filters']));_0x17b571['where'][_0x6327('0x5c')]=_0x4bdeab['id'];if(_0x4c9e12['query'][_0x6327('0x3d')]){_0x17b571[_0x6327('0x3f')]=_[_0x6327('0x3e')](_0x17b571[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x17b571[_0x6327('0x35')],function(_0x1b3a5e){var _0x29ee0f={};_0x29ee0f[_0x1b3a5e]={'$like':'%'+_0x4c9e12[_0x6327('0x31')][_0x6327('0x3d')]+'%'};return _0x29ee0f;})});}_0x17b571=_['merge']({},_0x17b571,_0x4c9e12[_0x6327('0x42')]);return db[_0x6327('0x5d')][_0x6327('0x1e')]({'where':_0x17b571['where']})['then'](function(_0x55645d){_0x1e2376['count']=_0x55645d;if(_0x4c9e12[_0x6327('0x31')][_0x6327('0x49')]){_0x17b571[_0x6327('0x43')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x17b571);})[_0x6327('0x26')](function(_0x45bc3d){_0x1e2376[_0x6327('0x45')]=_0x45bc3d;return _0x1e2376;});}})[_0x6327('0x26')](respondWithFilteredResult(_0x513e06,_0x17b571))['catch'](handleError(_0x513e06,null));};exports[_0x6327('0x5e')]=function(_0x7d3f15,_0x4346b8,_0x3973dd){var _0x188557={'raw':!![],'where':{}};var _0x33b36f={};var _0x3ecb75={'count':0x0,'rows':[]};return db['Campaign'][_0x6327('0x5a')]({'where':{'id':_0x7d3f15['params']['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x4346b8,null))[_0x6327('0x26')](function(_0x101a46){if(_0x101a46){_0x33b36f['model']=_[_0x6327('0x32')](db[_0x6327('0x5f')][_0x6327('0x2e')]);_0x33b36f[_0x6327('0x31')]=_[_0x6327('0x32')](_0x7d3f15['query']);_0x33b36f['filters']=_[_0x6327('0x33')](_0x33b36f[_0x6327('0x34')],_0x33b36f[_0x6327('0x31')]);_0x188557['attributes']=_[_0x6327('0x33')](_0x33b36f[_0x6327('0x34')],qs[_0x6327('0x36')](_0x7d3f15[_0x6327('0x31')]['fields']));_0x188557['attributes']=_0x188557[_0x6327('0x35')][_0x6327('0x37')]?_0x188557['attributes']:_0x33b36f['model'];if(!_0x7d3f15[_0x6327('0x31')][_0x6327('0x5b')](_0x6327('0x38'))){_0x188557[_0x6327('0x1d')]=qs[_0x6327('0x1d')](_0x7d3f15[_0x6327('0x31')][_0x6327('0x1d')]);_0x188557[_0x6327('0x1b')]=qs['offset'](_0x7d3f15['query'][_0x6327('0x1b')]);}_0x188557[_0x6327('0x39')]=qs[_0x6327('0x3a')](_0x7d3f15['query']['sort']);_0x188557['where']=qs[_0x6327('0x3c')](_['pick'](_0x7d3f15[_0x6327('0x31')],_0x33b36f['filters']));_0x188557['where']['CampaignId']=_0x101a46['id'];if(_0x7d3f15[_0x6327('0x31')]['filter']){_0x188557[_0x6327('0x3f')]=_[_0x6327('0x3e')](_0x188557[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x188557['attributes'],function(_0x2936da){var _0x5e721b={};_0x5e721b[_0x2936da]={'$like':'%'+_0x7d3f15[_0x6327('0x31')][_0x6327('0x3d')]+'%'};return _0x5e721b;})});}_0x188557=_[_0x6327('0x3e')]({},_0x188557,_0x7d3f15[_0x6327('0x42')]);return db[_0x6327('0x5f')][_0x6327('0x1e')]({'where':_0x188557[_0x6327('0x3f')]})[_0x6327('0x26')](function(_0x52b63f){_0x3ecb75['count']=_0x52b63f;if(_0x7d3f15[_0x6327('0x31')][_0x6327('0x49')]){_0x188557[_0x6327('0x43')]=[{'all':!![]}];}return db[_0x6327('0x5f')][_0x6327('0x44')](_0x188557);})[_0x6327('0x26')](function(_0x561b1a){_0x3ecb75[_0x6327('0x45')]=_0x561b1a;return _0x3ecb75;});}})[_0x6327('0x26')](respondWithFilteredResult(_0x4346b8,_0x188557))[_0x6327('0x46')](handleError(_0x4346b8,null));};exports['getHopperFinals']=function(_0x59a5cc,_0x15a1dc,_0x424e54){var _0x35477c={'raw':!![],'where':{}};var _0x1193c5={};var _0x12726d={'count':0x0,'rows':[]};return db[_0x6327('0x2d')]['findOne']({'where':{'id':_0x59a5cc[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x15a1dc,null))[_0x6327('0x26')](function(_0x40019b){if(_0x40019b){_0x1193c5[_0x6327('0x34')]=_[_0x6327('0x32')](db[_0x6327('0x60')]['rawAttributes']);_0x1193c5[_0x6327('0x31')]=_[_0x6327('0x32')](_0x59a5cc[_0x6327('0x31')]);_0x1193c5[_0x6327('0x3c')]=_[_0x6327('0x33')](_0x1193c5['model'],_0x1193c5['query']);_0x35477c[_0x6327('0x35')]=_[_0x6327('0x33')](_0x1193c5[_0x6327('0x34')],qs[_0x6327('0x36')](_0x59a5cc[_0x6327('0x31')][_0x6327('0x36')]));_0x35477c['attributes']=_0x35477c[_0x6327('0x35')][_0x6327('0x37')]?_0x35477c[_0x6327('0x35')]:_0x1193c5['model'];if(!_0x59a5cc[_0x6327('0x31')][_0x6327('0x5b')](_0x6327('0x38'))){_0x35477c[_0x6327('0x1d')]=qs['limit'](_0x59a5cc[_0x6327('0x31')][_0x6327('0x1d')]);_0x35477c[_0x6327('0x1b')]=qs[_0x6327('0x1b')](_0x59a5cc[_0x6327('0x31')][_0x6327('0x1b')]);}_0x35477c[_0x6327('0x39')]=qs[_0x6327('0x3a')](_0x59a5cc[_0x6327('0x31')]['sort']);_0x35477c[_0x6327('0x3f')]=qs['filters'](_[_0x6327('0x3b')](_0x59a5cc[_0x6327('0x31')],_0x1193c5['filters']));_0x35477c[_0x6327('0x3f')]['CampaignId']=_0x40019b['id'];if(_0x59a5cc[_0x6327('0x31')]['filter']){_0x35477c[_0x6327('0x3f')]=_['merge'](_0x35477c[_0x6327('0x3f')],{'$or':_['map'](_0x35477c[_0x6327('0x35')],function(_0xb46760){var _0x173560={};_0x173560[_0xb46760]={'$like':'%'+_0x59a5cc['query']['filter']+'%'};return _0x173560;})});}_0x35477c=_[_0x6327('0x3e')]({},_0x35477c,_0x59a5cc[_0x6327('0x42')]);return db['CmHopperFinal'][_0x6327('0x1e')]({'where':_0x35477c[_0x6327('0x3f')]})[_0x6327('0x26')](function(_0x5d6a16){_0x12726d[_0x6327('0x1e')]=_0x5d6a16;if(_0x59a5cc[_0x6327('0x31')]['includeAll']){_0x35477c['include']=[{'all':!![]}];}return db[_0x6327('0x60')][_0x6327('0x44')](_0x35477c);})[_0x6327('0x26')](function(_0x3f23c4){_0x12726d['rows']=_0x3f23c4;return _0x12726d;});}})[_0x6327('0x26')](respondWithFilteredResult(_0x15a1dc,_0x35477c))[_0x6327('0x46')](handleError(_0x15a1dc,null));};exports[_0x6327('0x61')]=function(_0x48645b,_0xf25a85,_0x18cba6){var _0x6c8c4c={'raw':!![],'where':{}};var _0x1b6b96={};var _0x254fdc={'count':0x0,'rows':[]};return db[_0x6327('0x2d')][_0x6327('0x5a')]({'where':{'id':_0x48645b[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0xf25a85,null))[_0x6327('0x26')](function(_0x43eae1){if(_0x43eae1){_0x1b6b96['model']=_[_0x6327('0x32')](db['CmHopperBlack'][_0x6327('0x2e')]);_0x1b6b96[_0x6327('0x31')]=_[_0x6327('0x32')](_0x48645b[_0x6327('0x31')]);_0x1b6b96[_0x6327('0x3c')]=_['intersection'](_0x1b6b96[_0x6327('0x34')],_0x1b6b96['query']);_0x6c8c4c[_0x6327('0x35')]=_[_0x6327('0x33')](_0x1b6b96[_0x6327('0x34')],qs[_0x6327('0x36')](_0x48645b[_0x6327('0x31')][_0x6327('0x36')]));_0x6c8c4c[_0x6327('0x35')]=_0x6c8c4c[_0x6327('0x35')][_0x6327('0x37')]?_0x6c8c4c[_0x6327('0x35')]:_0x1b6b96[_0x6327('0x34')];if(!_0x48645b[_0x6327('0x31')][_0x6327('0x5b')]('nolimit')){_0x6c8c4c[_0x6327('0x1d')]=qs['limit'](_0x48645b['query'][_0x6327('0x1d')]);_0x6c8c4c[_0x6327('0x1b')]=qs[_0x6327('0x1b')](_0x48645b[_0x6327('0x31')]['offset']);}_0x6c8c4c[_0x6327('0x39')]=qs['sort'](_0x48645b['query']['sort']);_0x6c8c4c['where']=qs[_0x6327('0x3c')](_['pick'](_0x48645b[_0x6327('0x31')],_0x1b6b96[_0x6327('0x3c')]));_0x6c8c4c[_0x6327('0x3f')]['CampaignId']=_0x43eae1['id'];if(_0x48645b[_0x6327('0x31')][_0x6327('0x3d')]){_0x6c8c4c[_0x6327('0x3f')]=_['merge'](_0x6c8c4c[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x6c8c4c[_0x6327('0x35')],function(_0x267bdc){var _0x30e33c={};_0x30e33c[_0x267bdc]={'$like':'%'+_0x48645b[_0x6327('0x31')][_0x6327('0x3d')]+'%'};return _0x30e33c;})});}_0x6c8c4c=_[_0x6327('0x3e')]({},_0x6c8c4c,_0x48645b[_0x6327('0x42')]);return db[_0x6327('0x62')][_0x6327('0x1e')]({'where':_0x6c8c4c['where']})['then'](function(_0x2a225b){_0x254fdc[_0x6327('0x1e')]=_0x2a225b;if(_0x48645b[_0x6327('0x31')]['includeAll']){_0x6c8c4c['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x6327('0x44')](_0x6c8c4c);})['then'](function(_0x43381e){_0x254fdc[_0x6327('0x45')]=_0x43381e;return _0x254fdc;});}})['then'](respondWithFilteredResult(_0xf25a85,_0x6c8c4c))[_0x6327('0x46')](handleError(_0xf25a85,null));};exports[_0x6327('0x63')]=function(_0x2bb6e5,_0x59b7f0,_0x1c9921){var _0x3fed01={};var _0x345f6c={};var _0xd091e1;var _0x9f1c8d;return db[_0x6327('0x2d')][_0x6327('0x5a')]({'where':{'id':_0x2bb6e5['params']['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x59b7f0,null))[_0x6327('0x26')](function(_0x27e847){if(_0x27e847){_0xd091e1=_0x27e847;_0x345f6c[_0x6327('0x34')]=_[_0x6327('0x32')](db[_0x6327('0x64')][_0x6327('0x2e')]);_0x345f6c['query']=_[_0x6327('0x32')](_0x2bb6e5[_0x6327('0x31')]);_0x345f6c[_0x6327('0x3c')]=_[_0x6327('0x33')](_0x345f6c[_0x6327('0x34')],_0x345f6c[_0x6327('0x31')]);_0x3fed01[_0x6327('0x35')]=_[_0x6327('0x33')](_0x345f6c[_0x6327('0x34')],qs[_0x6327('0x36')](_0x2bb6e5[_0x6327('0x31')][_0x6327('0x36')]));_0x3fed01[_0x6327('0x35')]=_0x3fed01['attributes']['length']?_0x3fed01[_0x6327('0x35')]:_0x345f6c[_0x6327('0x34')];_0x3fed01[_0x6327('0x39')]=qs[_0x6327('0x3a')](_0x2bb6e5[_0x6327('0x31')][_0x6327('0x3a')]);_0x3fed01[_0x6327('0x3f')]=qs[_0x6327('0x3c')](_[_0x6327('0x3b')](_0x2bb6e5[_0x6327('0x31')],_0x345f6c['filters']));if(_0x2bb6e5[_0x6327('0x31')][_0x6327('0x3d')]){_0x3fed01[_0x6327('0x3f')]=_[_0x6327('0x3e')](_0x3fed01[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x3fed01[_0x6327('0x35')],function(_0x13abc5){var _0x518315={};_0x518315[_0x13abc5]={'$like':'%'+_0x2bb6e5[_0x6327('0x31')][_0x6327('0x3d')]+'%'};return _0x518315;})});}_0x3fed01=_[_0x6327('0x3e')]({},_0x3fed01,_0x2bb6e5['options']);return _0xd091e1[_0x6327('0x63')](_0x3fed01);}})[_0x6327('0x26')](function(_0x42d4ff){if(_0x42d4ff){_0x9f1c8d=_0x42d4ff[_0x6327('0x37')];if(!_0x2bb6e5[_0x6327('0x31')][_0x6327('0x5b')](_0x6327('0x38'))){_0x3fed01[_0x6327('0x1d')]=qs[_0x6327('0x1d')](_0x2bb6e5[_0x6327('0x31')]['limit']);_0x3fed01[_0x6327('0x1b')]=qs[_0x6327('0x1b')](_0x2bb6e5[_0x6327('0x31')][_0x6327('0x1b')]);}return _0xd091e1[_0x6327('0x63')](_0x3fed01);}})['then'](function(_0x48888c){if(_0x48888c){return _0x48888c?{'count':_0x9f1c8d,'rows':_0x48888c}:null;}})['then'](respondWithResult(_0x59b7f0,null))[_0x6327('0x46')](handleError(_0x59b7f0,null));};exports[_0x6327('0x65')]=function(_0x3f1526,_0x3cd50a,_0x718062){var _0x132990,_0x486571;var _0x56c2b0=[];var _0x364719=moment()[_0x6327('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x6327('0x4a')]({'where':{'id':_0x3f1526[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x3cd50a,null))[_0x6327('0x26')](function(_0x594fb3){if(_0x594fb3){_0x486571=_0x594fb3;return _0x594fb3[_0x6327('0x65')](_0x3f1526[_0x6327('0x4c')][_0x6327('0x67')],_[_0x6327('0x56')](_0x3f1526[_0x6327('0x4c')],[_0x6327('0x67'),'id'])||{});}return null;})[_0x6327('0x68')](function(_0x9e2e85){var _0x4174e4;var _0x4fa038;_0x132990=_0x9e2e85||[];var _0x570605=[];if(_0x9e2e85){for(var _0x1aa3ba=0x0;_0x1aa3ba<_0x9e2e85[_0x6327('0x37')];_0x1aa3ba+=0x1){var _0x3534a9=_0x9e2e85[_0x1aa3ba]['get']({'plain':!![]});_0x486571['dialCheckDuplicateType']=_0x3f1526[_0x6327('0x4c')]['dialCheckDuplicateType']?_0x3f1526[_0x6327('0x4c')][_0x6327('0x69')]:_0x486571[_0x6327('0x69')];switch(_0x486571[_0x6327('0x69')]){case _0x6327('0x6a'):_0x4174e4=squel[_0x6327('0x6b')]()[_0x6327('0x6c')](_0x6327('0x6d'))[_0x6327('0x6e')]([_0x6327('0x6f'),_0x6327('0x70'),'ContactId',_0x6327('0x71'),_0x6327('0x5c'),_0x6327('0x58'),_0x6327('0x57')],squel['select']()[_0x6327('0x72')](_0x6327('0x6f'),_0x6327('0x6f'))[_0x6327('0x72')](_0x6327('0x73'),_0x6327('0x70'))[_0x6327('0x72')]('id','ContactId')[_0x6327('0x72')](_0x3534a9[_0x6327('0x74')][_0x6327('0x75')](),'ListId')[_0x6327('0x72')](_0x3f1526['params']['id'][_0x6327('0x75')](),_0x6327('0x5c'))[_0x6327('0x72')]('\x27'+_0x364719+'\x27','createdAt')[_0x6327('0x72')]('\x27'+_0x364719+'\x27',_0x6327('0x57'))[_0x6327('0x76')](_0x6327('0x77'))[_0x6327('0x3f')]('deletedAt\x20IS\x20NULL')[_0x6327('0x3f')]('ListId\x20=\x20?',_0x3534a9[_0x6327('0x74')][_0x6327('0x75')]())[_0x6327('0x3f')](_0x6327('0x78'))[_0x6327('0x3f')](_0x6327('0x79'),squel['select']()['field'](_0x6327('0x7a'))['from'](_0x6327('0x7b'))[_0x6327('0x3f')](_0x6327('0x7c'),_0x3f1526[_0x6327('0x48')]['id'][_0x6327('0x75')]()))[_0x6327('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6327('0x7d')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x6327('0x6d'))[_0x6327('0x3f')]('CampaignId\x20=\x20?',_0x3f1526[_0x6327('0x48')]['id'][_0x6327('0x75')]())))['toString']();break;case _0x6327('0x7e'):_0x4174e4=squel[_0x6327('0x6b')]()[_0x6327('0x6c')](_0x6327('0x6d'))[_0x6327('0x6e')]([_0x6327('0x6f'),_0x6327('0x70'),_0x6327('0x7f'),_0x6327('0x71'),_0x6327('0x5c'),_0x6327('0x58'),_0x6327('0x57')],squel[_0x6327('0x7d')]()[_0x6327('0x72')](_0x6327('0x6f'),_0x6327('0x6f'))[_0x6327('0x72')]('NOW()',_0x6327('0x70'))[_0x6327('0x72')]('id',_0x6327('0x7f'))[_0x6327('0x72')](_0x3534a9[_0x6327('0x74')][_0x6327('0x75')](),_0x6327('0x71'))[_0x6327('0x72')](_0x3f1526[_0x6327('0x48')]['id']['toString'](),_0x6327('0x5c'))[_0x6327('0x72')]('\x27'+_0x364719+'\x27','createdAt')[_0x6327('0x72')]('\x27'+_0x364719+'\x27','updatedAt')[_0x6327('0x76')](_0x6327('0x77'))[_0x6327('0x3f')]('deletedAt\x20IS\x20NULL')[_0x6327('0x3f')]('ListId\x20=\x20?',_0x3534a9[_0x6327('0x74')][_0x6327('0x75')]())[_0x6327('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x6327('0x3f')](_0x6327('0x79'),squel[_0x6327('0x7d')]()[_0x6327('0x72')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x6327('0x3f')]('CampaignId\x20=\x20?',_0x3f1526['params']['id'][_0x6327('0x75')]())))[_0x6327('0x75')]();break;default:_0x4174e4=squel[_0x6327('0x6b')]()[_0x6327('0x6c')]('cm_hopper')['fromQuery']([_0x6327('0x6f'),'scheduledAt',_0x6327('0x7f'),_0x6327('0x71'),'CampaignId',_0x6327('0x58'),'updatedAt'],squel[_0x6327('0x7d')]()['field'](_0x6327('0x6f'),'phone')[_0x6327('0x72')](_0x6327('0x73'),_0x6327('0x70'))[_0x6327('0x72')]('id',_0x6327('0x7f'))[_0x6327('0x72')](_0x3534a9['CmListId'][_0x6327('0x75')](),_0x6327('0x71'))['field'](_0x3f1526['params']['id']['toString'](),_0x6327('0x5c'))['field']('\x27'+_0x364719+'\x27',_0x6327('0x58'))[_0x6327('0x72')]('\x27'+_0x364719+'\x27',_0x6327('0x57'))['from']('cm_contacts')['where'](_0x6327('0x80'))[_0x6327('0x3f')]('ListId\x20=\x20?',_0x3534a9['CmListId'][_0x6327('0x75')]())[_0x6327('0x3f')](_0x6327('0x78')))['toString']();}_0x4fa038=squel[_0x6327('0x6b')]()[_0x6327('0x6c')](_0x6327('0x81'))['fromQuery'](['cmHopperId',_0x6327('0x70'),_0x6327('0x6f'),_0x6327('0x82'),'createdAt','updatedAt'],squel[_0x6327('0x7d')]()[_0x6327('0x72')]('h.id','id')[_0x6327('0x72')](_0x6327('0x73'),'scheduledAt')[_0x6327('0x72')]('ci.item','phone')[_0x6327('0x72')](_0x6327('0x83'),_0x6327('0x82'))[_0x6327('0x72')]('\x27'+_0x364719+'\x27',_0x6327('0x58'))[_0x6327('0x72')]('\x27'+_0x364719+'\x27',_0x6327('0x57'))[_0x6327('0x76')](_0x6327('0x84'),'ci')[_0x6327('0x85')](_0x6327('0x6d'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x6327('0x3f')](_0x6327('0x86'),_0x3534a9[_0x6327('0x74')][_0x6327('0x75')]())[_0x6327('0x3f')](_0x6327('0x87'),_0x3f1526[_0x6327('0x48')]['id'][_0x6327('0x75')]())[_0x6327('0x3f')](_0x6327('0x88'),_0x364719))[_0x6327('0x75')]();_0x570605[_0x6327('0x89')](db[_0x6327('0x8a')]['query'](_0x4174e4));_0x56c2b0[_0x6327('0x89')](db[_0x6327('0x8a')][_0x6327('0x31')](_0x4fa038));}return BPromise[_0x6327('0x8b')](_0x570605);}})['then'](function(){return BPromise[_0x6327('0x8b')](_0x56c2b0);})[_0x6327('0x26')](function(){return _0x132990;})[_0x6327('0x26')](respondWithResult(_0x3cd50a,null))[_0x6327('0x46')](handleError(_0x3cd50a,null));};exports[_0x6327('0x8c')]=function(_0x1a719a,_0x13a38c,_0x457343){return db[_0x6327('0x2d')][_0x6327('0x4a')]({'where':{'id':_0x1a719a[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x13a38c,null))[_0x6327('0x26')](function(_0xdad37e){if(_0xdad37e){return _0xdad37e[_0x6327('0x8c')](_0x1a719a[_0x6327('0x31')][_0x6327('0x67')]);}})[_0x6327('0x26')](function(_0x1f4b95){if(_0x1f4b95){return db[_0x6327('0x5d')][_0x6327('0x27')]({'where':{'ListId':_0x1a719a[_0x6327('0x31')][_0x6327('0x67')],'CampaignId':_0x1a719a[_0x6327('0x48')]['id']}})[_0x6327('0x26')](function(){return _0x1f4b95;});}})[_0x6327('0x26')](respondWithStatusCode(_0x13a38c,null))[_0x6327('0x46')](handleError(_0x13a38c,null));};exports[_0x6327('0x8d')]=function(_0x49975c,_0x6546a9,_0x526d09){var _0x26582e={};var _0x4f0579={};var _0x4ec482;var _0xf593bf;return db[_0x6327('0x2d')][_0x6327('0x5a')]({'where':{'id':_0x49975c[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x6546a9,null))[_0x6327('0x26')](function(_0xaee17e){if(_0xaee17e){_0x4ec482=_0xaee17e;_0x4f0579[_0x6327('0x34')]=_[_0x6327('0x32')](db[_0x6327('0x64')][_0x6327('0x2e')]);_0x4f0579[_0x6327('0x31')]=_[_0x6327('0x32')](_0x49975c[_0x6327('0x31')]);_0x4f0579['filters']=_[_0x6327('0x33')](_0x4f0579[_0x6327('0x34')],_0x4f0579[_0x6327('0x31')]);_0x26582e['attributes']=_['intersection'](_0x4f0579['model'],qs['fields'](_0x49975c[_0x6327('0x31')][_0x6327('0x36')]));_0x26582e[_0x6327('0x35')]=_0x26582e['attributes'][_0x6327('0x37')]?_0x26582e[_0x6327('0x35')]:_0x4f0579[_0x6327('0x34')];_0x26582e[_0x6327('0x39')]=qs[_0x6327('0x3a')](_0x49975c[_0x6327('0x31')][_0x6327('0x3a')]);_0x26582e[_0x6327('0x3f')]=qs[_0x6327('0x3c')](_[_0x6327('0x3b')](_0x49975c[_0x6327('0x31')],_0x4f0579[_0x6327('0x3c')]));if(_0x49975c[_0x6327('0x31')][_0x6327('0x3d')]){_0x26582e[_0x6327('0x3f')]=_[_0x6327('0x3e')](_0x26582e[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x26582e[_0x6327('0x35')],function(_0x3d7eea){var _0x30f233={};_0x30f233[_0x3d7eea]={'$like':'%'+_0x49975c[_0x6327('0x31')][_0x6327('0x3d')]+'%'};return _0x30f233;})});}_0x26582e=_[_0x6327('0x3e')]({},_0x26582e,_0x49975c[_0x6327('0x42')]);return _0x4ec482[_0x6327('0x8d')](_0x26582e);}})[_0x6327('0x26')](function(_0x21df66){if(_0x21df66){_0xf593bf=_0x21df66[_0x6327('0x37')];if(!_0x49975c[_0x6327('0x31')][_0x6327('0x5b')]('nolimit')){_0x26582e['limit']=qs[_0x6327('0x1d')](_0x49975c[_0x6327('0x31')]['limit']);_0x26582e[_0x6327('0x1b')]=qs['offset'](_0x49975c[_0x6327('0x31')]['offset']);}return _0x4ec482[_0x6327('0x8d')](_0x26582e);}})[_0x6327('0x26')](function(_0x52c67a){if(_0x52c67a){return _0x52c67a?{'count':_0xf593bf,'rows':_0x52c67a}:null;}})['then'](respondWithResult(_0x6546a9,null))[_0x6327('0x46')](handleError(_0x6546a9,null));};exports[_0x6327('0x8e')]=function(_0x4e7082,_0x497d7f,_0x3f5ddc){var _0x40047b,_0xf8d14c;var _0x431412=[];var _0x3f1690=moment()[_0x6327('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x6327('0x2d')][_0x6327('0x4a')]({'where':{'id':_0x4e7082[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x497d7f,null))[_0x6327('0x26')](function(_0x4bf469){if(_0x4bf469){_0xf8d14c=_0x4bf469;return _0x4bf469['addBlackLists'](_0x4e7082['body'][_0x6327('0x67')],_['omit'](_0x4e7082[_0x6327('0x4c')],['ids','id'])||{});}return null;})[_0x6327('0x68')](function(_0x2e28c7){var _0x464324;var _0x86039;_0x40047b=_0x2e28c7||[];var _0x2980d1=[];if(_0x2e28c7){for(var _0x589d31=0x0;_0x589d31<_0x2e28c7[_0x6327('0x37')];_0x589d31+=0x1){var _0x2d6ed2=_0x2e28c7[_0x589d31][_0x6327('0x4e')]({'plain':!![]});_0x464324=squel[_0x6327('0x6b')]()['into']('cm_hopper_black')[_0x6327('0x6e')]([_0x6327('0x6f'),_0x6327('0x7f'),_0x6327('0x71'),_0x6327('0x5c'),_0x6327('0x58'),_0x6327('0x57')],squel['select']()[_0x6327('0x72')](_0x6327('0x6f'),_0x6327('0x6f'))['field']('id','ContactId')[_0x6327('0x72')](_0x2d6ed2[_0x6327('0x74')][_0x6327('0x75')](),'ListId')['field'](_0x4e7082[_0x6327('0x48')]['id'][_0x6327('0x75')](),'CampaignId')[_0x6327('0x72')](_0x6327('0x73'),'createdAt')[_0x6327('0x72')](_0x6327('0x73'),_0x6327('0x57'))[_0x6327('0x76')](_0x6327('0x77'))[_0x6327('0x3f')](_0x6327('0x80'))[_0x6327('0x3f')](_0x6327('0x8f'),_0x2d6ed2[_0x6327('0x74')][_0x6327('0x75')]())[_0x6327('0x3f')](_0x6327('0x78')))[_0x6327('0x75')]();_0x2980d1[_0x6327('0x89')](db[_0x6327('0x8a')][_0x6327('0x31')](_0x464324));}return BPromise[_0x6327('0x8b')](_0x2980d1);}})['then'](function(){return _0x40047b;})[_0x6327('0x26')](respondWithResult(_0x497d7f,null))['catch'](handleError(_0x497d7f,null));};exports['removeBlackLists']=function(_0x458d83,_0x440bb7,_0xb44077){return db[_0x6327('0x2d')]['find']({'where':{'id':_0x458d83['params']['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x440bb7,null))[_0x6327('0x26')](function(_0x1dc095){if(_0x1dc095){return _0x1dc095[_0x6327('0x90')](_0x458d83['query'][_0x6327('0x67')]);}})[_0x6327('0x26')](function(_0x593782){if(_0x593782){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x458d83[_0x6327('0x31')][_0x6327('0x67')],'CampaignId':_0x458d83[_0x6327('0x48')]['id']}})[_0x6327('0x26')](function(){return _0x593782;});}})[_0x6327('0x26')](respondWithStatusCode(_0x440bb7,null))[_0x6327('0x46')](handleError(_0x440bb7,null));}; \ No newline at end of file +var _0x0f92=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','clone','find','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getHoppers','findOne','CmHopper','getHopperHistories','CampaignId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ContactId','ListId','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','cm_hopper_additional_phones','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','ListId\x20=\x20?','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','IvrCampaigns','UserProfileResource','name','send','index','Campaign','fieldName','type'];(function(_0xd94f9c,_0x12791e){var _0x2e867a=function(_0x59d098){while(--_0x59d098){_0xd94f9c['push'](_0xd94f9c['shift']());}};_0x2e867a(++_0x12791e);}(_0x0f92,0xfd));var _0x20f9=function(_0x2d733c,_0x5893ce){_0x2d733c=_0x2d733c-0x0;var _0x10582d=_0x0f92[_0x2d733c];return _0x10582d;};'use strict';var emlformat=require(_0x20f9('0x0'));var rimraf=require(_0x20f9('0x1'));var zipdir=require(_0x20f9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20f9('0x3'));var moment=require(_0x20f9('0x4'));var BPromise=require(_0x20f9('0x5'));var Mustache=require(_0x20f9('0x6'));var util=require(_0x20f9('0x7'));var path=require(_0x20f9('0x8'));var sox=require(_0x20f9('0x9'));var csv=require(_0x20f9('0xa'));var ejs=require(_0x20f9('0xb'));var fs=require('fs');var fs_extra=require(_0x20f9('0xc'));var _=require(_0x20f9('0xd'));var squel=require('squel');var crypto=require(_0x20f9('0xe'));var jsforce=require(_0x20f9('0xf'));var deskjs=require(_0x20f9('0x10'));var toCsv=require(_0x20f9('0xa'));var querystring=require(_0x20f9('0x11'));var Papa=require('papaparse');var Redis=require(_0x20f9('0x12'));var authService=require(_0x20f9('0x13'));var qs=require(_0x20f9('0x14'));var as=require(_0x20f9('0x15'));var hardwareService=require(_0x20f9('0x16'));var logger=require('../../config/logger')(_0x20f9('0x17'));var utils=require(_0x20f9('0x18'));var config=require(_0x20f9('0x19'));var licenseUtil=require(_0x20f9('0x1a'));var db=require(_0x20f9('0x1b'))['db'];function respondWithStatusCode(_0x44a279,_0x15cc0d){_0x15cc0d=_0x15cc0d||0xcc;return function(_0x128cbf){if(_0x128cbf){return _0x44a279[_0x20f9('0x1c')](_0x15cc0d);}return _0x44a279[_0x20f9('0x1d')](_0x15cc0d)[_0x20f9('0x1e')]();};}function respondWithResult(_0x510cdf,_0x57b2ba){_0x57b2ba=_0x57b2ba||0xc8;return function(_0x56091c){if(_0x56091c){return _0x510cdf['status'](_0x57b2ba)[_0x20f9('0x1f')](_0x56091c);}};}function respondWithFilteredResult(_0x2a8e47,_0x50b9d0){return function(_0x520dd6){if(_0x520dd6){var _0x342fa8=typeof _0x50b9d0[_0x20f9('0x20')]==='undefined'&&typeof _0x50b9d0[_0x20f9('0x21')]==='undefined';var _0x42a7b0=_0x520dd6['count'];var _0x47b815=_0x342fa8?0x0:_0x50b9d0[_0x20f9('0x20')];var _0x55bf75=_0x342fa8?_0x520dd6[_0x20f9('0x22')]:_0x50b9d0[_0x20f9('0x20')]+_0x50b9d0[_0x20f9('0x21')];var _0x1ba7ef;if(_0x55bf75>=_0x42a7b0){_0x55bf75=_0x42a7b0;_0x1ba7ef=0xc8;}else{_0x1ba7ef=0xce;}_0x2a8e47[_0x20f9('0x1d')](_0x1ba7ef);return _0x2a8e47[_0x20f9('0x23')](_0x20f9('0x24'),_0x47b815+'-'+_0x55bf75+'/'+_0x42a7b0)[_0x20f9('0x1f')](_0x520dd6);}return null;};}function patchUpdates(_0x1ab050){return function(_0x7bece3){try{jsonpatch[_0x20f9('0x25')](_0x7bece3,_0x1ab050,!![]);}catch(_0x3e3768){return BPromise[_0x20f9('0x26')](_0x3e3768);}return _0x7bece3['save']();};}function saveUpdates(_0x39fd68,_0x35f54d){return function(_0x555b1a){if(_0x555b1a){return _0x555b1a[_0x20f9('0x27')](_0x39fd68)['then'](function(_0x4497d4){return _0x4497d4;});}return null;};}function removeEntity(_0x525aaa,_0x41cb76){return function(_0x51c604){if(_0x51c604){return _0x51c604[_0x20f9('0x28')]()[_0x20f9('0x29')](function(){var _0x576539=_0x51c604[_0x20f9('0x2a')]({'plain':!![]});var _0x2d466a=_0x20f9('0x2b');return db[_0x20f9('0x2c')]['destroy']({'where':{'type':_0x2d466a,'resourceId':_0x576539['id']}})[_0x20f9('0x29')](function(){return _0x51c604;});})['then'](function(){_0x525aaa['status'](0xcc)[_0x20f9('0x1e')]();});}};}function handleEntityNotFound(_0x180045,_0x3b3379){return function(_0x3b94e3){if(!_0x3b94e3){_0x180045[_0x20f9('0x1c')](0x194);}return _0x3b94e3;};}function handleError(_0x190cc8,_0x64e240){_0x64e240=_0x64e240||0x1f4;return function(_0x21bf24){logger['error'](_0x21bf24['stack']);if(_0x21bf24[_0x20f9('0x2d')]){delete _0x21bf24['name'];}_0x190cc8[_0x20f9('0x1d')](_0x64e240)[_0x20f9('0x2e')](_0x21bf24);};}exports[_0x20f9('0x2f')]=function(_0x39bfde,_0x1d8259){var _0x56eb57={},_0x3d4bf7={},_0x85a502={'count':0x0,'rows':[]};var _0x511acf=_['map'](db[_0x20f9('0x30')]['rawAttributes'],function(_0x460c78){return{'name':_0x460c78[_0x20f9('0x31')],'type':_0x460c78[_0x20f9('0x32')]['key']};});_0x3d4bf7[_0x20f9('0x33')]=_['map'](_0x511acf,_0x20f9('0x2d'));_0x3d4bf7[_0x20f9('0x34')]=_['keys'](_0x39bfde['query']);_0x3d4bf7[_0x20f9('0x35')]=_[_0x20f9('0x36')](_0x3d4bf7[_0x20f9('0x33')],_0x3d4bf7['query']);_0x56eb57[_0x20f9('0x37')]=_[_0x20f9('0x36')](_0x3d4bf7[_0x20f9('0x33')],qs[_0x20f9('0x38')](_0x39bfde['query'][_0x20f9('0x38')]));_0x56eb57[_0x20f9('0x37')]=_0x56eb57[_0x20f9('0x37')][_0x20f9('0x39')]?_0x56eb57[_0x20f9('0x37')]:_0x3d4bf7[_0x20f9('0x33')];if(!_0x39bfde[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0x56eb57[_0x20f9('0x21')]=qs['limit'](_0x39bfde[_0x20f9('0x34')][_0x20f9('0x21')]);_0x56eb57['offset']=qs[_0x20f9('0x20')](_0x39bfde['query'][_0x20f9('0x20')]);}_0x56eb57[_0x20f9('0x3c')]=qs[_0x20f9('0x3d')](_0x39bfde['query']['sort']);_0x56eb57[_0x20f9('0x3e')]=qs[_0x20f9('0x35')](_[_0x20f9('0x3f')](_0x39bfde[_0x20f9('0x34')],_0x3d4bf7[_0x20f9('0x35')]),_0x511acf);if(_0x39bfde[_0x20f9('0x34')][_0x20f9('0x40')]){_0x56eb57['where']=_['merge'](_0x56eb57[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0x511acf,function(_0x207369){if(_0x207369[_0x20f9('0x32')]!==_0x20f9('0x42')){var _0x3979e4={};_0x3979e4[_0x207369[_0x20f9('0x2d')]]={'$like':'%'+_0x39bfde[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x3979e4;}})});}_0x56eb57=_[_0x20f9('0x43')]({},_0x56eb57,_0x39bfde[_0x20f9('0x44')]);var _0x57d30b={'where':_0x56eb57['where']};return db[_0x20f9('0x30')][_0x20f9('0x22')](_0x57d30b)['then'](function(_0x1e49fe){_0x85a502['count']=_0x1e49fe;if(_0x39bfde[_0x20f9('0x34')][_0x20f9('0x45')]){_0x56eb57[_0x20f9('0x46')]=[{'all':!![]}];}return db[_0x20f9('0x30')][_0x20f9('0x47')](_0x56eb57);})['then'](function(_0x3693b7){_0x85a502[_0x20f9('0x48')]=_0x3693b7;return _0x85a502;})[_0x20f9('0x29')](respondWithFilteredResult(_0x1d8259,_0x56eb57))[_0x20f9('0x49')](handleError(_0x1d8259,null));};exports[_0x20f9('0x4a')]=function(_0x29ff1f,_0x11e65f){var _0x1c2fdd={'raw':![],'where':{'id':_0x29ff1f['params']['id']}},_0x3d97b1={};_0x3d97b1[_0x20f9('0x33')]=_['keys'](db[_0x20f9('0x30')][_0x20f9('0x4b')]);_0x3d97b1[_0x20f9('0x34')]=_[_0x20f9('0x4c')](_0x29ff1f[_0x20f9('0x34')]);_0x3d97b1[_0x20f9('0x35')]=_[_0x20f9('0x36')](_0x3d97b1['model'],_0x3d97b1[_0x20f9('0x34')]);_0x1c2fdd[_0x20f9('0x37')]=_['intersection'](_0x3d97b1['model'],qs[_0x20f9('0x38')](_0x29ff1f[_0x20f9('0x34')][_0x20f9('0x38')]));_0x1c2fdd[_0x20f9('0x37')]=_0x1c2fdd['attributes'][_0x20f9('0x39')]?_0x1c2fdd[_0x20f9('0x37')]:_0x3d97b1['model'];if(_0x29ff1f[_0x20f9('0x34')][_0x20f9('0x45')]){_0x1c2fdd['include']=[{'all':!![]}];}_0x1c2fdd=_[_0x20f9('0x43')]({},_0x1c2fdd,_0x29ff1f[_0x20f9('0x44')]);return db[_0x20f9('0x30')]['find'](_0x1c2fdd)[_0x20f9('0x29')](handleEntityNotFound(_0x11e65f,null))[_0x20f9('0x29')](respondWithResult(_0x11e65f,null))['catch'](handleError(_0x11e65f,null));};exports['create']=function(_0x153a8e,_0x5694e0){return db[_0x20f9('0x30')][_0x20f9('0x4d')](_0x153a8e[_0x20f9('0x4e')],{})[_0x20f9('0x29')](function(_0x10a94d){var _0x5e8e5f=_0x153a8e[_0x20f9('0x4f')][_0x20f9('0x2a')]({'plain':!![]});if(!_0x5e8e5f)throw new Error(_0x20f9('0x50'));if(_0x5e8e5f[_0x20f9('0x51')]===_0x20f9('0x4f')){var _0x261b2b=_0x10a94d[_0x20f9('0x2a')]({'plain':!![]});var _0x4fa068=_0x20f9('0x2b');return db[_0x20f9('0x52')]['find']({'where':{'name':_0x4fa068,'userProfileId':_0x5e8e5f[_0x20f9('0x53')]},'raw':!![]})['then'](function(_0x454948){if(_0x454948&&_0x454948[_0x20f9('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x261b2b[_0x20f9('0x2d')],'resourceId':_0x261b2b['id'],'type':_0x454948[_0x20f9('0x2d')],'sectionId':_0x454948['id']},{})[_0x20f9('0x29')](function(){return _0x10a94d;});}else{return _0x10a94d;}})[_0x20f9('0x49')](function(_0x45475e){logger[_0x20f9('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45475e);throw _0x45475e;});}return _0x10a94d;})[_0x20f9('0x29')](respondWithResult(_0x5694e0,0xc9))[_0x20f9('0x49')](handleError(_0x5694e0,null));};exports[_0x20f9('0x56')]=function(_0x13e638,_0x575b57){var _0x3c3e46={'where':{'id':_0x13e638['params']['id']}},_0x18a97d={};_0x18a97d[_0x20f9('0x33')]=_[_0x20f9('0x4c')](db[_0x20f9('0x30')]['rawAttributes']);_0x3c3e46[_0x20f9('0x37')]=_[_0x20f9('0x36')](_0x18a97d[_0x20f9('0x33')],qs[_0x20f9('0x38')](_0x13e638[_0x20f9('0x34')][_0x20f9('0x38')]));_0x3c3e46[_0x20f9('0x37')]=_0x3c3e46[_0x20f9('0x37')]['length']?_0x3c3e46[_0x20f9('0x37')]:_0x18a97d[_0x20f9('0x33')];if(_0x13e638['query'][_0x20f9('0x45')]){_0x3c3e46[_0x20f9('0x46')]=[{'all':!![]}];}_0x3c3e46=_[_0x20f9('0x43')]({},_0x3c3e46,_0x13e638[_0x20f9('0x44')]);return db[_0x20f9('0x30')][_0x20f9('0x57')](_0x3c3e46)[_0x20f9('0x29')](handleEntityNotFound(_0x575b57,null))['then'](function(_0x5e7cec){if(_0x5e7cec){var _0x4046dc=_0x5e7cec[_0x20f9('0x2a')]({'plain':!![]});_0x4046dc=qs[_0x20f9('0x58')](_0x4046dc,['id',_0x20f9('0x59'),_0x20f9('0x5a')]);_0x13e638['body']=_[_0x20f9('0x58')](_0x13e638[_0x20f9('0x4e')],['id','createdAt',_0x20f9('0x5a')]);return db[_0x20f9('0x30')][_0x20f9('0x4d')](_[_0x20f9('0x43')](_0x4046dc,_0x13e638[_0x20f9('0x4e')]),{'include':_0x13e638['query']['includeAll']?[{'all':!![]}]:undefined})[_0x20f9('0x29')](function(_0x15b746){var _0x2c0255=_0x13e638['user'][_0x20f9('0x2a')]({'plain':!![]});if(!_0x2c0255)throw new Error(_0x20f9('0x50'));if(_0x2c0255[_0x20f9('0x51')]===_0x20f9('0x4f')){var _0x502e1d=_0x15b746[_0x20f9('0x2a')]({'plain':!![]});var _0x8c2388=_0x20f9('0x2b');return db[_0x20f9('0x52')][_0x20f9('0x57')]({'where':{'name':_0x8c2388,'userProfileId':_0x2c0255[_0x20f9('0x53')]},'raw':!![]})[_0x20f9('0x29')](function(_0x57514c){if(_0x57514c&&_0x57514c[_0x20f9('0x54')]===0x0){return db[_0x20f9('0x2c')][_0x20f9('0x4d')]({'name':_0x502e1d[_0x20f9('0x2d')],'resourceId':_0x502e1d['id'],'type':_0x57514c[_0x20f9('0x2d')],'sectionId':_0x57514c['id']},{})[_0x20f9('0x29')](function(){return _0x15b746;});}else{return _0x15b746;}})[_0x20f9('0x49')](function(_0x640f44){logger[_0x20f9('0x55')](_0x20f9('0x5b'),_0x640f44);throw _0x640f44;});}return _0x15b746;});}})[_0x20f9('0x29')](respondWithResult(_0x575b57,0xc9))[_0x20f9('0x49')](handleError(_0x575b57,null));};exports['update']=function(_0x3e3ef2,_0x156421){if(_0x3e3ef2[_0x20f9('0x4e')]['id']){delete _0x3e3ef2[_0x20f9('0x4e')]['id'];}return db[_0x20f9('0x30')][_0x20f9('0x57')]({'where':{'id':_0x3e3ef2[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x156421,null))[_0x20f9('0x29')](saveUpdates(_0x3e3ef2[_0x20f9('0x4e')],null))[_0x20f9('0x29')](respondWithResult(_0x156421,null))['catch'](handleError(_0x156421,null));};exports['destroy']=function(_0x334fe0,_0x49e293){return db[_0x20f9('0x30')][_0x20f9('0x57')]({'where':{'id':_0x334fe0[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x49e293,null))['then'](removeEntity(_0x49e293,null))[_0x20f9('0x49')](handleError(_0x49e293,null));};exports[_0x20f9('0x5d')]=function(_0x3f62c3,_0x574403,_0x3aa622){var _0x18cb22={'raw':!![],'where':{}};var _0x3b2739={};var _0x3cb783={'count':0x0,'rows':[]};return db[_0x20f9('0x30')][_0x20f9('0x5e')]({'where':{'id':_0x3f62c3[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x574403,null))[_0x20f9('0x29')](function(_0x1d6c14){if(_0x1d6c14){_0x3b2739[_0x20f9('0x33')]=_[_0x20f9('0x4c')](db[_0x20f9('0x5f')][_0x20f9('0x4b')]);_0x3b2739[_0x20f9('0x34')]=_[_0x20f9('0x4c')](_0x3f62c3['query']);_0x3b2739[_0x20f9('0x35')]=_['intersection'](_0x3b2739[_0x20f9('0x33')],_0x3b2739[_0x20f9('0x34')]);_0x18cb22['attributes']=_[_0x20f9('0x36')](_0x3b2739[_0x20f9('0x33')],qs[_0x20f9('0x38')](_0x3f62c3[_0x20f9('0x34')][_0x20f9('0x38')]));_0x18cb22[_0x20f9('0x37')]=_0x18cb22[_0x20f9('0x37')]['length']?_0x18cb22[_0x20f9('0x37')]:_0x3b2739[_0x20f9('0x33')];if(!_0x3f62c3[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0x18cb22[_0x20f9('0x21')]=qs[_0x20f9('0x21')](_0x3f62c3['query']['limit']);_0x18cb22[_0x20f9('0x20')]=qs[_0x20f9('0x20')](_0x3f62c3[_0x20f9('0x34')][_0x20f9('0x20')]);}_0x18cb22[_0x20f9('0x3c')]=qs[_0x20f9('0x3d')](_0x3f62c3[_0x20f9('0x34')][_0x20f9('0x3d')]);_0x18cb22['where']=qs[_0x20f9('0x35')](_['pick'](_0x3f62c3['query'],_0x3b2739[_0x20f9('0x35')]));_0x18cb22[_0x20f9('0x3e')]['CampaignId']=_0x1d6c14['id'];if(_0x3f62c3['query']['filter']){_0x18cb22[_0x20f9('0x3e')]=_['merge'](_0x18cb22[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0x18cb22[_0x20f9('0x37')],function(_0x24f606){var _0x15638b={};_0x15638b[_0x24f606]={'$like':'%'+_0x3f62c3[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x15638b;})});}_0x18cb22=_[_0x20f9('0x43')]({},_0x18cb22,_0x3f62c3['options']);return db['CmHopper']['count']({'where':_0x18cb22[_0x20f9('0x3e')]})[_0x20f9('0x29')](function(_0x256c14){_0x3cb783['count']=_0x256c14;if(_0x3f62c3['query'][_0x20f9('0x45')]){_0x18cb22[_0x20f9('0x46')]=[{'all':!![]}];}return db[_0x20f9('0x5f')][_0x20f9('0x47')](_0x18cb22);})[_0x20f9('0x29')](function(_0x4d7493){_0x3cb783[_0x20f9('0x48')]=_0x4d7493;return _0x3cb783;});}})[_0x20f9('0x29')](respondWithFilteredResult(_0x574403,_0x18cb22))[_0x20f9('0x49')](handleError(_0x574403,null));};exports[_0x20f9('0x60')]=function(_0x4680a0,_0xab2b20,_0xe74ea4){var _0x24d68c={'raw':!![],'where':{}};var _0x44b524={};var _0x12d386={'count':0x0,'rows':[]};return db[_0x20f9('0x30')][_0x20f9('0x5e')]({'where':{'id':_0x4680a0[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0xab2b20,null))[_0x20f9('0x29')](function(_0x4e1813){if(_0x4e1813){_0x44b524[_0x20f9('0x33')]=_[_0x20f9('0x4c')](db['CmHopperHistory'][_0x20f9('0x4b')]);_0x44b524[_0x20f9('0x34')]=_[_0x20f9('0x4c')](_0x4680a0[_0x20f9('0x34')]);_0x44b524[_0x20f9('0x35')]=_[_0x20f9('0x36')](_0x44b524[_0x20f9('0x33')],_0x44b524[_0x20f9('0x34')]);_0x24d68c[_0x20f9('0x37')]=_['intersection'](_0x44b524[_0x20f9('0x33')],qs['fields'](_0x4680a0[_0x20f9('0x34')][_0x20f9('0x38')]));_0x24d68c['attributes']=_0x24d68c[_0x20f9('0x37')][_0x20f9('0x39')]?_0x24d68c[_0x20f9('0x37')]:_0x44b524[_0x20f9('0x33')];if(!_0x4680a0[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0x24d68c[_0x20f9('0x21')]=qs[_0x20f9('0x21')](_0x4680a0[_0x20f9('0x34')][_0x20f9('0x21')]);_0x24d68c[_0x20f9('0x20')]=qs[_0x20f9('0x20')](_0x4680a0[_0x20f9('0x34')][_0x20f9('0x20')]);}_0x24d68c['order']=qs['sort'](_0x4680a0['query'][_0x20f9('0x3d')]);_0x24d68c['where']=qs['filters'](_['pick'](_0x4680a0[_0x20f9('0x34')],_0x44b524[_0x20f9('0x35')]));_0x24d68c[_0x20f9('0x3e')][_0x20f9('0x61')]=_0x4e1813['id'];if(_0x4680a0[_0x20f9('0x34')][_0x20f9('0x40')]){_0x24d68c[_0x20f9('0x3e')]=_[_0x20f9('0x43')](_0x24d68c[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0x24d68c['attributes'],function(_0x16026b){var _0x29b6ce={};_0x29b6ce[_0x16026b]={'$like':'%'+_0x4680a0[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x29b6ce;})});}_0x24d68c=_['merge']({},_0x24d68c,_0x4680a0['options']);return db[_0x20f9('0x62')][_0x20f9('0x22')]({'where':_0x24d68c[_0x20f9('0x3e')]})['then'](function(_0x28f0b3){_0x12d386[_0x20f9('0x22')]=_0x28f0b3;if(_0x4680a0[_0x20f9('0x34')]['includeAll']){_0x24d68c[_0x20f9('0x46')]=[{'all':!![]}];}return db[_0x20f9('0x62')]['findAll'](_0x24d68c);})[_0x20f9('0x29')](function(_0x2fdd2a){_0x12d386[_0x20f9('0x48')]=_0x2fdd2a;return _0x12d386;});}})[_0x20f9('0x29')](respondWithFilteredResult(_0xab2b20,_0x24d68c))['catch'](handleError(_0xab2b20,null));};exports['getHopperFinals']=function(_0x59ca1f,_0x48ec95,_0x4bee73){var _0xcbacf9={'raw':!![],'where':{}};var _0x1f88f8={};var _0x291c7e={'count':0x0,'rows':[]};return db[_0x20f9('0x30')]['findOne']({'where':{'id':_0x59ca1f['params']['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x48ec95,null))['then'](function(_0x263503){if(_0x263503){_0x1f88f8['model']=_[_0x20f9('0x4c')](db[_0x20f9('0x63')][_0x20f9('0x4b')]);_0x1f88f8['query']=_[_0x20f9('0x4c')](_0x59ca1f[_0x20f9('0x34')]);_0x1f88f8[_0x20f9('0x35')]=_['intersection'](_0x1f88f8['model'],_0x1f88f8[_0x20f9('0x34')]);_0xcbacf9[_0x20f9('0x37')]=_[_0x20f9('0x36')](_0x1f88f8['model'],qs[_0x20f9('0x38')](_0x59ca1f['query'][_0x20f9('0x38')]));_0xcbacf9['attributes']=_0xcbacf9[_0x20f9('0x37')][_0x20f9('0x39')]?_0xcbacf9[_0x20f9('0x37')]:_0x1f88f8[_0x20f9('0x33')];if(!_0x59ca1f[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0xcbacf9[_0x20f9('0x21')]=qs[_0x20f9('0x21')](_0x59ca1f['query'][_0x20f9('0x21')]);_0xcbacf9[_0x20f9('0x20')]=qs[_0x20f9('0x20')](_0x59ca1f[_0x20f9('0x34')][_0x20f9('0x20')]);}_0xcbacf9['order']=qs[_0x20f9('0x3d')](_0x59ca1f[_0x20f9('0x34')][_0x20f9('0x3d')]);_0xcbacf9['where']=qs[_0x20f9('0x35')](_['pick'](_0x59ca1f[_0x20f9('0x34')],_0x1f88f8[_0x20f9('0x35')]));_0xcbacf9['where'][_0x20f9('0x61')]=_0x263503['id'];if(_0x59ca1f['query']['filter']){_0xcbacf9[_0x20f9('0x3e')]=_[_0x20f9('0x43')](_0xcbacf9[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0xcbacf9[_0x20f9('0x37')],function(_0x20a323){var _0x2373f5={};_0x2373f5[_0x20a323]={'$like':'%'+_0x59ca1f[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x2373f5;})});}_0xcbacf9=_[_0x20f9('0x43')]({},_0xcbacf9,_0x59ca1f[_0x20f9('0x44')]);return db['CmHopperFinal'][_0x20f9('0x22')]({'where':_0xcbacf9[_0x20f9('0x3e')]})[_0x20f9('0x29')](function(_0x3dd80e){_0x291c7e[_0x20f9('0x22')]=_0x3dd80e;if(_0x59ca1f['query'][_0x20f9('0x45')]){_0xcbacf9['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x20f9('0x47')](_0xcbacf9);})[_0x20f9('0x29')](function(_0x1f10f5){_0x291c7e[_0x20f9('0x48')]=_0x1f10f5;return _0x291c7e;});}})['then'](respondWithFilteredResult(_0x48ec95,_0xcbacf9))['catch'](handleError(_0x48ec95,null));};exports[_0x20f9('0x64')]=function(_0x43f05e,_0x213cb6,_0x312e5d){var _0x2ab112={'raw':!![],'where':{}};var _0x4d6b7d={};var _0x4f8e07={'count':0x0,'rows':[]};return db[_0x20f9('0x30')][_0x20f9('0x5e')]({'where':{'id':_0x43f05e[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x213cb6,null))['then'](function(_0x22a1f4){if(_0x22a1f4){_0x4d6b7d[_0x20f9('0x33')]=_['keys'](db[_0x20f9('0x65')][_0x20f9('0x4b')]);_0x4d6b7d[_0x20f9('0x34')]=_[_0x20f9('0x4c')](_0x43f05e[_0x20f9('0x34')]);_0x4d6b7d[_0x20f9('0x35')]=_[_0x20f9('0x36')](_0x4d6b7d['model'],_0x4d6b7d[_0x20f9('0x34')]);_0x2ab112['attributes']=_[_0x20f9('0x36')](_0x4d6b7d['model'],qs[_0x20f9('0x38')](_0x43f05e[_0x20f9('0x34')][_0x20f9('0x38')]));_0x2ab112[_0x20f9('0x37')]=_0x2ab112['attributes'][_0x20f9('0x39')]?_0x2ab112[_0x20f9('0x37')]:_0x4d6b7d['model'];if(!_0x43f05e[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0x2ab112[_0x20f9('0x21')]=qs['limit'](_0x43f05e[_0x20f9('0x34')][_0x20f9('0x21')]);_0x2ab112[_0x20f9('0x20')]=qs['offset'](_0x43f05e[_0x20f9('0x34')]['offset']);}_0x2ab112['order']=qs[_0x20f9('0x3d')](_0x43f05e[_0x20f9('0x34')][_0x20f9('0x3d')]);_0x2ab112['where']=qs[_0x20f9('0x35')](_['pick'](_0x43f05e[_0x20f9('0x34')],_0x4d6b7d[_0x20f9('0x35')]));_0x2ab112[_0x20f9('0x3e')][_0x20f9('0x61')]=_0x22a1f4['id'];if(_0x43f05e['query']['filter']){_0x2ab112[_0x20f9('0x3e')]=_[_0x20f9('0x43')](_0x2ab112[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0x2ab112[_0x20f9('0x37')],function(_0x434269){var _0x1ca22f={};_0x1ca22f[_0x434269]={'$like':'%'+_0x43f05e[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x1ca22f;})});}_0x2ab112=_[_0x20f9('0x43')]({},_0x2ab112,_0x43f05e[_0x20f9('0x44')]);return db[_0x20f9('0x65')][_0x20f9('0x22')]({'where':_0x2ab112[_0x20f9('0x3e')]})[_0x20f9('0x29')](function(_0x548742){_0x4f8e07[_0x20f9('0x22')]=_0x548742;if(_0x43f05e[_0x20f9('0x34')][_0x20f9('0x45')]){_0x2ab112[_0x20f9('0x46')]=[{'all':!![]}];}return db[_0x20f9('0x65')][_0x20f9('0x47')](_0x2ab112);})['then'](function(_0x2689ac){_0x4f8e07['rows']=_0x2689ac;return _0x4f8e07;});}})[_0x20f9('0x29')](respondWithFilteredResult(_0x213cb6,_0x2ab112))['catch'](handleError(_0x213cb6,null));};exports[_0x20f9('0x66')]=function(_0x14a48c,_0x30a713,_0x65e3a){var _0x5925cc={};var _0x5ad507={};var _0x538be1;var _0x7929f5;return db[_0x20f9('0x30')][_0x20f9('0x5e')]({'where':{'id':_0x14a48c['params']['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x30a713,null))[_0x20f9('0x29')](function(_0x221f97){if(_0x221f97){_0x538be1=_0x221f97;_0x5ad507['model']=_[_0x20f9('0x4c')](db[_0x20f9('0x67')][_0x20f9('0x4b')]);_0x5ad507[_0x20f9('0x34')]=_['keys'](_0x14a48c['query']);_0x5ad507['filters']=_[_0x20f9('0x36')](_0x5ad507['model'],_0x5ad507[_0x20f9('0x34')]);_0x5925cc[_0x20f9('0x37')]=_['intersection'](_0x5ad507[_0x20f9('0x33')],qs['fields'](_0x14a48c[_0x20f9('0x34')]['fields']));_0x5925cc[_0x20f9('0x37')]=_0x5925cc[_0x20f9('0x37')][_0x20f9('0x39')]?_0x5925cc[_0x20f9('0x37')]:_0x5ad507['model'];_0x5925cc['order']=qs[_0x20f9('0x3d')](_0x14a48c[_0x20f9('0x34')][_0x20f9('0x3d')]);_0x5925cc[_0x20f9('0x3e')]=qs['filters'](_[_0x20f9('0x3f')](_0x14a48c[_0x20f9('0x34')],_0x5ad507[_0x20f9('0x35')]));if(_0x14a48c[_0x20f9('0x34')][_0x20f9('0x40')]){_0x5925cc[_0x20f9('0x3e')]=_[_0x20f9('0x43')](_0x5925cc[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0x5925cc['attributes'],function(_0x54d801){var _0x4483d9={};_0x4483d9[_0x54d801]={'$like':'%'+_0x14a48c[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x4483d9;})});}_0x5925cc=_[_0x20f9('0x43')]({},_0x5925cc,_0x14a48c[_0x20f9('0x44')]);return _0x538be1['getLists'](_0x5925cc);}})[_0x20f9('0x29')](function(_0x1a1165){if(_0x1a1165){_0x7929f5=_0x1a1165[_0x20f9('0x39')];if(!_0x14a48c[_0x20f9('0x34')]['hasOwnProperty'](_0x20f9('0x3b'))){_0x5925cc['limit']=qs['limit'](_0x14a48c[_0x20f9('0x34')][_0x20f9('0x21')]);_0x5925cc[_0x20f9('0x20')]=qs[_0x20f9('0x20')](_0x14a48c[_0x20f9('0x34')][_0x20f9('0x20')]);}return _0x538be1['getLists'](_0x5925cc);}})[_0x20f9('0x29')](function(_0x31d1e7){if(_0x31d1e7){return _0x31d1e7?{'count':_0x7929f5,'rows':_0x31d1e7}:null;}})['then'](respondWithResult(_0x30a713,null))[_0x20f9('0x49')](handleError(_0x30a713,null));};exports[_0x20f9('0x68')]=function(_0x5bd33b,_0x1a2f9d,_0x503cca){var _0x2dc66a,_0x488f2a;var _0x1bd3c8=[];var _0x1ce109=moment()[_0x20f9('0x69')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x20f9('0x57')]({'where':{'id':_0x5bd33b[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x1a2f9d,null))[_0x20f9('0x29')](function(_0xa1aa8e){if(_0xa1aa8e){_0x488f2a=_0xa1aa8e;return _0xa1aa8e[_0x20f9('0x68')](_0x5bd33b[_0x20f9('0x4e')]['ids'],_[_0x20f9('0x58')](_0x5bd33b['body'],[_0x20f9('0x6a'),'id'])||{});}return null;})[_0x20f9('0x6b')](function(_0x2fc634){var _0x3d0708;var _0x5cfb58;_0x2dc66a=_0x2fc634||[];var _0x59bf20=[];if(_0x2fc634){for(var _0x481371=0x0;_0x481371<_0x2fc634[_0x20f9('0x39')];_0x481371+=0x1){var _0x2e6dfd=_0x2fc634[_0x481371][_0x20f9('0x2a')]({'plain':!![]});_0x488f2a['dialCheckDuplicateType']=_0x5bd33b[_0x20f9('0x4e')]['dialCheckDuplicateType']?_0x5bd33b[_0x20f9('0x4e')]['dialCheckDuplicateType']:_0x488f2a[_0x20f9('0x6c')];switch(_0x488f2a[_0x20f9('0x6c')]){case _0x20f9('0x6d'):_0x3d0708=squel[_0x20f9('0x6e')]()[_0x20f9('0x6f')]('cm_hopper')[_0x20f9('0x70')](['phone',_0x20f9('0x71'),_0x20f9('0x72'),_0x20f9('0x73'),_0x20f9('0x61'),_0x20f9('0x59'),'updatedAt'],squel['select']()[_0x20f9('0x74')](_0x20f9('0x75'),_0x20f9('0x75'))['field'](_0x20f9('0x76'),_0x20f9('0x71'))['field']('id',_0x20f9('0x72'))[_0x20f9('0x74')](_0x2e6dfd[_0x20f9('0x77')][_0x20f9('0x78')](),_0x20f9('0x73'))['field'](_0x5bd33b[_0x20f9('0x5c')]['id'][_0x20f9('0x78')](),'CampaignId')[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27','createdAt')['field']('\x27'+_0x1ce109+'\x27','updatedAt')[_0x20f9('0x79')](_0x20f9('0x7a'))[_0x20f9('0x3e')](_0x20f9('0x7b'))[_0x20f9('0x3e')]('ListId\x20=\x20?',_0x2e6dfd[_0x20f9('0x77')][_0x20f9('0x78')]())[_0x20f9('0x3e')](_0x20f9('0x7c'))[_0x20f9('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x20f9('0x7d')]()['field'](_0x20f9('0x7e'))[_0x20f9('0x79')](_0x20f9('0x7f'))[_0x20f9('0x3e')](_0x20f9('0x80'),_0x5bd33b[_0x20f9('0x5c')]['id'][_0x20f9('0x78')]()))[_0x20f9('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x20f9('0x74')](_0x20f9('0x81'))[_0x20f9('0x79')](_0x20f9('0x82'))[_0x20f9('0x3e')]('CampaignId\x20=\x20?',_0x5bd33b[_0x20f9('0x5c')]['id'][_0x20f9('0x78')]())))[_0x20f9('0x78')]();break;case _0x20f9('0x83'):_0x3d0708=squel[_0x20f9('0x6e')]()[_0x20f9('0x6f')](_0x20f9('0x82'))[_0x20f9('0x70')]([_0x20f9('0x75'),_0x20f9('0x71'),'ContactId',_0x20f9('0x73'),'CampaignId','createdAt',_0x20f9('0x5a')],squel[_0x20f9('0x7d')]()['field'](_0x20f9('0x75'),_0x20f9('0x75'))[_0x20f9('0x74')](_0x20f9('0x76'),_0x20f9('0x71'))[_0x20f9('0x74')]('id',_0x20f9('0x72'))[_0x20f9('0x74')](_0x2e6dfd[_0x20f9('0x77')][_0x20f9('0x78')](),'ListId')[_0x20f9('0x74')](_0x5bd33b[_0x20f9('0x5c')]['id']['toString'](),'CampaignId')[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27',_0x20f9('0x59'))[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27',_0x20f9('0x5a'))['from'](_0x20f9('0x7a'))[_0x20f9('0x3e')](_0x20f9('0x7b'))[_0x20f9('0x3e')]('ListId\x20=\x20?',_0x2e6dfd[_0x20f9('0x77')][_0x20f9('0x78')]())[_0x20f9('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x20f9('0x3e')](_0x20f9('0x84'),squel[_0x20f9('0x7d')]()[_0x20f9('0x74')](_0x20f9('0x81'))[_0x20f9('0x79')](_0x20f9('0x82'))[_0x20f9('0x3e')]('CampaignId\x20=\x20?',_0x5bd33b[_0x20f9('0x5c')]['id'][_0x20f9('0x78')]())))['toString']();break;default:_0x3d0708=squel[_0x20f9('0x6e')]()['into']('cm_hopper')['fromQuery']([_0x20f9('0x75'),'scheduledAt',_0x20f9('0x72'),_0x20f9('0x73'),_0x20f9('0x61'),_0x20f9('0x59'),_0x20f9('0x5a')],squel[_0x20f9('0x7d')]()[_0x20f9('0x74')](_0x20f9('0x75'),_0x20f9('0x75'))[_0x20f9('0x74')](_0x20f9('0x76'),'scheduledAt')[_0x20f9('0x74')]('id','ContactId')[_0x20f9('0x74')](_0x2e6dfd[_0x20f9('0x77')]['toString'](),_0x20f9('0x73'))[_0x20f9('0x74')](_0x5bd33b['params']['id'][_0x20f9('0x78')](),'CampaignId')[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27',_0x20f9('0x59'))[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27','updatedAt')[_0x20f9('0x79')](_0x20f9('0x7a'))[_0x20f9('0x3e')](_0x20f9('0x7b'))[_0x20f9('0x3e')]('ListId\x20=\x20?',_0x2e6dfd[_0x20f9('0x77')][_0x20f9('0x78')]())[_0x20f9('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0x20f9('0x78')]();}_0x5cfb58=squel[_0x20f9('0x6e')]()[_0x20f9('0x6f')](_0x20f9('0x85'))[_0x20f9('0x70')](['cmHopperId',_0x20f9('0x71'),_0x20f9('0x75'),_0x20f9('0x86'),_0x20f9('0x59'),_0x20f9('0x5a')],squel[_0x20f9('0x7d')]()[_0x20f9('0x74')](_0x20f9('0x87'),'id')[_0x20f9('0x74')]('NOW()',_0x20f9('0x71'))[_0x20f9('0x74')](_0x20f9('0x88'),_0x20f9('0x75'))[_0x20f9('0x74')]('ci.OrderBY',_0x20f9('0x86'))[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27',_0x20f9('0x59'))[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27','updatedAt')['from'](_0x20f9('0x89'),'ci')[_0x20f9('0x8a')]('cm_hopper','h',_0x20f9('0x8b'))['where']('h.ListId\x20=\x20?',_0x2e6dfd[_0x20f9('0x77')]['toString']())[_0x20f9('0x3e')](_0x20f9('0x8c'),_0x5bd33b[_0x20f9('0x5c')]['id'][_0x20f9('0x78')]())[_0x20f9('0x3e')](_0x20f9('0x8d'),_0x1ce109))['toString']();_0x59bf20[_0x20f9('0x8e')](db[_0x20f9('0x8f')]['query'](_0x3d0708));_0x1bd3c8['push'](db[_0x20f9('0x8f')][_0x20f9('0x34')](_0x5cfb58));}return BPromise['all'](_0x59bf20);}})[_0x20f9('0x29')](function(){return BPromise[_0x20f9('0x90')](_0x1bd3c8);})[_0x20f9('0x29')](function(){return _0x2dc66a;})[_0x20f9('0x29')](respondWithResult(_0x1a2f9d,null))[_0x20f9('0x49')](handleError(_0x1a2f9d,null));};exports[_0x20f9('0x91')]=function(_0x4deb28,_0xbdf2cf,_0x319926){return db[_0x20f9('0x30')][_0x20f9('0x57')]({'where':{'id':_0x4deb28['params']['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0xbdf2cf,null))[_0x20f9('0x29')](function(_0x4353d2){if(_0x4353d2){return _0x4353d2[_0x20f9('0x91')](_0x4deb28['query']['ids']);}})[_0x20f9('0x29')](function(_0x4fc9c6){if(_0x4fc9c6){return db[_0x20f9('0x5f')][_0x20f9('0x28')]({'where':{'ListId':_0x4deb28[_0x20f9('0x34')][_0x20f9('0x6a')],'CampaignId':_0x4deb28['params']['id']}})[_0x20f9('0x29')](function(){return _0x4fc9c6;});}})[_0x20f9('0x29')](respondWithStatusCode(_0xbdf2cf,null))['catch'](handleError(_0xbdf2cf,null));};exports['getBlackLists']=function(_0x32ea1b,_0x77e4ab,_0x485b18){var _0x164918={};var _0x1726e3={};var _0x399d19;var _0x408a47;return db[_0x20f9('0x30')][_0x20f9('0x5e')]({'where':{'id':_0x32ea1b[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x77e4ab,null))[_0x20f9('0x29')](function(_0x68f949){if(_0x68f949){_0x399d19=_0x68f949;_0x1726e3[_0x20f9('0x33')]=_['keys'](db['CmList'][_0x20f9('0x4b')]);_0x1726e3[_0x20f9('0x34')]=_[_0x20f9('0x4c')](_0x32ea1b[_0x20f9('0x34')]);_0x1726e3[_0x20f9('0x35')]=_[_0x20f9('0x36')](_0x1726e3[_0x20f9('0x33')],_0x1726e3[_0x20f9('0x34')]);_0x164918['attributes']=_[_0x20f9('0x36')](_0x1726e3[_0x20f9('0x33')],qs[_0x20f9('0x38')](_0x32ea1b[_0x20f9('0x34')][_0x20f9('0x38')]));_0x164918[_0x20f9('0x37')]=_0x164918[_0x20f9('0x37')][_0x20f9('0x39')]?_0x164918[_0x20f9('0x37')]:_0x1726e3[_0x20f9('0x33')];_0x164918[_0x20f9('0x3c')]=qs[_0x20f9('0x3d')](_0x32ea1b[_0x20f9('0x34')][_0x20f9('0x3d')]);_0x164918[_0x20f9('0x3e')]=qs['filters'](_[_0x20f9('0x3f')](_0x32ea1b[_0x20f9('0x34')],_0x1726e3[_0x20f9('0x35')]));if(_0x32ea1b['query'][_0x20f9('0x40')]){_0x164918[_0x20f9('0x3e')]=_['merge'](_0x164918['where'],{'$or':_['map'](_0x164918[_0x20f9('0x37')],function(_0x1260dd){var _0x834ae6={};_0x834ae6[_0x1260dd]={'$like':'%'+_0x32ea1b['query'][_0x20f9('0x40')]+'%'};return _0x834ae6;})});}_0x164918=_[_0x20f9('0x43')]({},_0x164918,_0x32ea1b[_0x20f9('0x44')]);return _0x399d19[_0x20f9('0x92')](_0x164918);}})[_0x20f9('0x29')](function(_0x7e6695){if(_0x7e6695){_0x408a47=_0x7e6695[_0x20f9('0x39')];if(!_0x32ea1b[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0x164918[_0x20f9('0x21')]=qs['limit'](_0x32ea1b[_0x20f9('0x34')]['limit']);_0x164918[_0x20f9('0x20')]=qs[_0x20f9('0x20')](_0x32ea1b['query'][_0x20f9('0x20')]);}return _0x399d19[_0x20f9('0x92')](_0x164918);}})[_0x20f9('0x29')](function(_0x400c29){if(_0x400c29){return _0x400c29?{'count':_0x408a47,'rows':_0x400c29}:null;}})[_0x20f9('0x29')](respondWithResult(_0x77e4ab,null))['catch'](handleError(_0x77e4ab,null));};exports[_0x20f9('0x93')]=function(_0xaf1354,_0x759a7c,_0x3fa404){var _0x2af093,_0x56bc21;var _0x149a0f=[];var _0x3faad1=moment()['format'](_0x20f9('0x94'));return db['Campaign'][_0x20f9('0x57')]({'where':{'id':_0xaf1354[_0x20f9('0x5c')]['id']}})['then'](handleEntityNotFound(_0x759a7c,null))[_0x20f9('0x29')](function(_0x501fda){if(_0x501fda){_0x56bc21=_0x501fda;return _0x501fda[_0x20f9('0x93')](_0xaf1354['body'][_0x20f9('0x6a')],_[_0x20f9('0x58')](_0xaf1354[_0x20f9('0x4e')],['ids','id'])||{});}return null;})[_0x20f9('0x6b')](function(_0x14d06c){var _0x1be974;var _0x13bdf9;_0x2af093=_0x14d06c||[];var _0x1841f9=[];if(_0x14d06c){for(var _0xb71fb6=0x0;_0xb71fb6<_0x14d06c[_0x20f9('0x39')];_0xb71fb6+=0x1){var _0x460eb9=_0x14d06c[_0xb71fb6][_0x20f9('0x2a')]({'plain':!![]});_0x1be974=squel[_0x20f9('0x6e')]()[_0x20f9('0x6f')](_0x20f9('0x95'))['fromQuery']([_0x20f9('0x75'),_0x20f9('0x72'),'ListId','CampaignId',_0x20f9('0x59'),_0x20f9('0x5a')],squel[_0x20f9('0x7d')]()[_0x20f9('0x74')](_0x20f9('0x75'),'phone')[_0x20f9('0x74')]('id',_0x20f9('0x72'))['field'](_0x460eb9[_0x20f9('0x77')][_0x20f9('0x78')](),'ListId')[_0x20f9('0x74')](_0xaf1354[_0x20f9('0x5c')]['id'][_0x20f9('0x78')](),_0x20f9('0x61'))['field'](_0x20f9('0x76'),'createdAt')[_0x20f9('0x74')](_0x20f9('0x76'),_0x20f9('0x5a'))[_0x20f9('0x79')](_0x20f9('0x7a'))[_0x20f9('0x3e')](_0x20f9('0x7b'))[_0x20f9('0x3e')](_0x20f9('0x96'),_0x460eb9[_0x20f9('0x77')][_0x20f9('0x78')]())[_0x20f9('0x3e')](_0x20f9('0x7c')))['toString']();_0x1841f9['push'](db['sequelize']['query'](_0x1be974));}return BPromise[_0x20f9('0x90')](_0x1841f9);}})[_0x20f9('0x29')](function(){return _0x2af093;})[_0x20f9('0x29')](respondWithResult(_0x759a7c,null))[_0x20f9('0x49')](handleError(_0x759a7c,null));};exports[_0x20f9('0x97')]=function(_0x5c0dde,_0xde96d2,_0x327ad7){return db[_0x20f9('0x30')][_0x20f9('0x57')]({'where':{'id':_0x5c0dde[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0xde96d2,null))[_0x20f9('0x29')](function(_0x166c3f){if(_0x166c3f){return _0x166c3f[_0x20f9('0x97')](_0x5c0dde['query'][_0x20f9('0x6a')]);}})['then'](function(_0x4e64be){if(_0x4e64be){return db[_0x20f9('0x65')]['destroy']({'where':{'ListId':_0x5c0dde['query'][_0x20f9('0x6a')],'CampaignId':_0x5c0dde[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](function(){return _0x4e64be;});}})[_0x20f9('0x29')](respondWithStatusCode(_0xde96d2,null))[_0x20f9('0x49')](handleError(_0xde96d2,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index dd7dfbd..011347a 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(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 b54298e..fc995f3 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 _0xbbb8=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','attributes','limit','include','model','map','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2c5bc7,_0x4975a6){var _0x4273b1=function(_0x4d82a0){while(--_0x4d82a0){_0x2c5bc7['push'](_0x2c5bc7['shift']());}};_0x4273b1(++_0x4975a6);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x3a268d,_0xef058a){_0x3a268d=_0x3a268d-0x0;var _0x224362=_0xbbb8[_0x3a268d];return _0x224362;};'use strict';var _=require(_0x8bbb('0x0'));var util=require(_0x8bbb('0x1'));var moment=require('moment');var BPromise=require(_0x8bbb('0x2'));var rs=require(_0x8bbb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bbb('0x4'))['db'];var utils=require(_0x8bbb('0x5'));var logger=require(_0x8bbb('0x6'))(_0x8bbb('0x7'));var config=require(_0x8bbb('0x8'));var jayson=require(_0x8bbb('0x9'));var client=jayson[_0x8bbb('0xa')][_0x8bbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d7098,_0x4bbc55,_0x5c744c){return new BPromise(function(_0x4da98e,_0x2d69aa){return client[_0x8bbb('0xc')](_0x2d7098,_0x5c744c)[_0x8bbb('0xd')](function(_0x3a6ced){logger[_0x8bbb('0xe')](_0x8bbb('0xf'),_0x4bbc55,_0x8bbb('0x10'));logger[_0x8bbb('0x11')]('Campaign,\x20%s,\x20%s,\x20%s',_0x4bbc55,_0x8bbb('0x10'),JSON[_0x8bbb('0x12')](_0x3a6ced));if(_0x3a6ced[_0x8bbb('0x13')]){if(_0x3a6ced['error'][_0x8bbb('0x14')]===0x1f4){logger[_0x8bbb('0x13')](_0x8bbb('0xf'),_0x4bbc55,_0x3a6ced['error'][_0x8bbb('0x15')]);return _0x2d69aa(_0x3a6ced[_0x8bbb('0x13')][_0x8bbb('0x15')]);}logger[_0x8bbb('0x13')]('Campaign,\x20%s,\x20%s',_0x4bbc55,_0x3a6ced[_0x8bbb('0x13')][_0x8bbb('0x15')]);return _0x4da98e(_0x3a6ced['error'][_0x8bbb('0x15')]);}else{logger[_0x8bbb('0xe')](_0x8bbb('0xf'),_0x4bbc55,_0x8bbb('0x10'));_0x4da98e(_0x3a6ced[_0x8bbb('0x16')][_0x8bbb('0x15')]);}})[_0x8bbb('0x17')](function(_0x15643c){logger[_0x8bbb('0x13')](_0x8bbb('0xf'),_0x4bbc55,_0x15643c);_0x2d69aa(_0x15643c);});});}exports[_0x8bbb('0x18')]=function(_0x2c2cd4){var _0x12486b=this;return new Promise(function(_0x4abd04,_0x2a6e0){return db[_0x8bbb('0x19')][_0x8bbb('0x1a')]({'raw':_0x2c2cd4[_0x8bbb('0x1b')]?_0x2c2cd4[_0x8bbb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2c2cd4[_0x8bbb('0x1b')]?_0x2c2cd4['options']['where']||null:null,'attributes':_0x2c2cd4[_0x8bbb('0x1b')]?_0x2c2cd4['options'][_0x8bbb('0x1c')]||null:null,'limit':_0x2c2cd4['options']?_0x2c2cd4[_0x8bbb('0x1b')][_0x8bbb('0x1d')]||null:null,'include':_0x2c2cd4['options']?_0x2c2cd4[_0x8bbb('0x1b')][_0x8bbb('0x1e')]?_['map'](_0x2c2cd4[_0x8bbb('0x1b')][_0x8bbb('0x1e')],function(_0x4b2ba6){return{'model':db[_0x4b2ba6[_0x8bbb('0x1f')]],'as':_0x4b2ba6['as'],'attributes':_0x4b2ba6['attributes'],'include':_0x4b2ba6[_0x8bbb('0x1e')]?_[_0x8bbb('0x20')](_0x4b2ba6[_0x8bbb('0x1e')],function(_0x2fff2e){return{'model':db[_0x2fff2e['model']],'as':_0x2fff2e['as'],'attributes':_0x2fff2e[_0x8bbb('0x1c')],'include':_0x2fff2e['include']?_[_0x8bbb('0x20')](_0x2fff2e['include'],function(_0x22a074){return{'model':db[_0x22a074[_0x8bbb('0x1f')]],'as':_0x22a074['as'],'attributes':_0x22a074[_0x8bbb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1375a9){logger['info'](_0x8bbb('0x18'),_0x2c2cd4);logger[_0x8bbb('0x11')](_0x8bbb('0x18'),_0x2c2cd4,JSON[_0x8bbb('0x12')](_0x1375a9));_0x4abd04(_0x1375a9);})['catch'](function(_0x51c251){logger[_0x8bbb('0x13')]('GetCampaign',_0x51c251[_0x8bbb('0x15')],_0x2c2cd4);_0x2a6e0(_0x12486b[_0x8bbb('0x13')](0x1f4,_0x51c251['message']));});});}; \ No newline at end of file +var _0xd6ce=['raw','attributes','limit','map','include','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','GetCampaign','Campaign','options'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd6ce,0x127));var _0xed6c=function(_0x1a3663,_0x48e1ec){_0x1a3663=_0x1a3663-0x0;var _0x57a0ce=_0xd6ce[_0x1a3663];return _0x57a0ce;};'use strict';var _=require(_0xed6c('0x0'));var util=require(_0xed6c('0x1'));var moment=require(_0xed6c('0x2'));var BPromise=require(_0xed6c('0x3'));var rs=require(_0xed6c('0x4'));var fs=require('fs');var Redis=require(_0xed6c('0x5'));var db=require(_0xed6c('0x6'))['db'];var utils=require(_0xed6c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xed6c('0x8'));var jayson=require(_0xed6c('0x9'));var client=jayson[_0xed6c('0xa')][_0xed6c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a6546,_0x5e0e3a,_0x7668a7){return new BPromise(function(_0x46e2c4,_0x4fd673){return client['request'](_0x4a6546,_0x7668a7)[_0xed6c('0xc')](function(_0xc996c4){logger[_0xed6c('0xd')](_0xed6c('0xe'),_0x5e0e3a,'request\x20sent');logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x5e0e3a,'request\x20sent',JSON[_0xed6c('0xf')](_0xc996c4));if(_0xc996c4['error']){if(_0xc996c4['error'][_0xed6c('0x10')]===0x1f4){logger[_0xed6c('0x11')]('Campaign,\x20%s,\x20%s',_0x5e0e3a,_0xc996c4[_0xed6c('0x11')]['message']);return _0x4fd673(_0xc996c4[_0xed6c('0x11')][_0xed6c('0x12')]);}logger['error'](_0xed6c('0xe'),_0x5e0e3a,_0xc996c4[_0xed6c('0x11')][_0xed6c('0x12')]);return _0x46e2c4(_0xc996c4[_0xed6c('0x11')]['message']);}else{logger['info'](_0xed6c('0xe'),_0x5e0e3a,_0xed6c('0x13'));_0x46e2c4(_0xc996c4[_0xed6c('0x14')]['message']);}})[_0xed6c('0x15')](function(_0x526c54){logger[_0xed6c('0x11')](_0xed6c('0xe'),_0x5e0e3a,_0x526c54);_0x4fd673(_0x526c54);});});}exports[_0xed6c('0x16')]=function(_0x1fe8c0){var _0x4a920e=this;return new Promise(function(_0x387ba1,_0x1856f7){return db[_0xed6c('0x17')]['findAll']({'raw':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0[_0xed6c('0x18')][_0xed6c('0x19')]===undefined?!![]:![]:!![],'where':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0[_0xed6c('0x18')]['where']||null:null,'attributes':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0['options'][_0xed6c('0x1a')]||null:null,'limit':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0[_0xed6c('0x18')][_0xed6c('0x1b')]||null:null,'include':_0x1fe8c0['options']?_0x1fe8c0[_0xed6c('0x18')]['include']?_[_0xed6c('0x1c')](_0x1fe8c0['options'][_0xed6c('0x1d')],function(_0x21e0ba){return{'model':db[_0x21e0ba[_0xed6c('0x1e')]],'as':_0x21e0ba['as'],'attributes':_0x21e0ba[_0xed6c('0x1a')],'include':_0x21e0ba[_0xed6c('0x1d')]?_[_0xed6c('0x1c')](_0x21e0ba[_0xed6c('0x1d')],function(_0x27fb6c){return{'model':db[_0x27fb6c[_0xed6c('0x1e')]],'as':_0x27fb6c['as'],'attributes':_0x27fb6c[_0xed6c('0x1a')],'include':_0x27fb6c[_0xed6c('0x1d')]?_['map'](_0x27fb6c[_0xed6c('0x1d')],function(_0x27484c){return{'model':db[_0x27484c[_0xed6c('0x1e')]],'as':_0x27484c['as'],'attributes':_0x27484c[_0xed6c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xed6c('0xc')](function(_0x3574a3){logger['info'](_0xed6c('0x16'),_0x1fe8c0);logger[_0xed6c('0x1f')](_0xed6c('0x16'),_0x1fe8c0,JSON['stringify'](_0x3574a3));_0x387ba1(_0x3574a3);})['catch'](function(_0x531cd0){logger['error'](_0xed6c('0x16'),_0x531cd0['message'],_0x1fe8c0);_0x1856f7(_0x4a920e[_0xed6c('0x11')](0x1f4,_0x531cd0['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 79ffbda..62924a2 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 _0x6cf2=['/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','delete','removeLists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x4c42da,_0x2b1f58){var _0x11c56a=function(_0x3a297d){while(--_0x3a297d){_0x4c42da['push'](_0x4c42da['shift']());}};_0x11c56a(++_0x2b1f58);}(_0x6cf2,0x7c));var _0x26cf=function(_0x39197d,_0x785a79){_0x39197d=_0x39197d-0x0;var _0x48cfab=_0x6cf2[_0x39197d];return _0x48cfab;};'use strict';var multer=require('multer');var util=require(_0x26cf('0x0'));var path=require(_0x26cf('0x1'));var timeout=require(_0x26cf('0x2'));var express=require(_0x26cf('0x3'));var router=express[_0x26cf('0x4')]();var fs_extra=require(_0x26cf('0x5'));var auth=require(_0x26cf('0x6'));var interaction=require(_0x26cf('0x7'));var config=require(_0x26cf('0x8'));var controller=require(_0x26cf('0x9'));router[_0x26cf('0xa')]('/',auth[_0x26cf('0xb')](),controller[_0x26cf('0xc')]);router[_0x26cf('0xa')](_0x26cf('0xd'),auth['isAuthenticated'](),controller[_0x26cf('0xe')]);router['get'](_0x26cf('0xf'),auth[_0x26cf('0xb')](),controller['getHoppers']);router[_0x26cf('0xa')](_0x26cf('0x10'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x11')]);router[_0x26cf('0xa')](_0x26cf('0x12'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x13')]);router['get'](_0x26cf('0x14'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x15')]);router[_0x26cf('0xa')](_0x26cf('0x16'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x17')]);router['get'](_0x26cf('0x18'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x19')]);router[_0x26cf('0x1a')]('/',auth[_0x26cf('0xb')](),controller[_0x26cf('0x1b')]);router[_0x26cf('0x1a')](_0x26cf('0x1c'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x1d')]);router[_0x26cf('0x1a')](_0x26cf('0x16'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x1e')]);router[_0x26cf('0x1a')]('/:id/blacklists',auth[_0x26cf('0xb')](),controller[_0x26cf('0x1f')]);router[_0x26cf('0x20')](_0x26cf('0xd'),auth[_0x26cf('0xb')](),controller['update']);router['delete']('/:id',auth[_0x26cf('0xb')](),controller['destroy']);router[_0x26cf('0x21')](_0x26cf('0x16'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x22')]);router[_0x26cf('0x21')](_0x26cf('0x18'),auth[_0x26cf('0xb')](),controller['removeBlackLists']);module[_0x26cf('0x23')]=router; \ No newline at end of file +var _0x2932=['post','/:id/clone','clone','/:id/lists','addLists','put','/:id','update','delete','destroy','removeLists','removeBlackLists','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists'];(function(_0x12e930,_0x3b89df){var _0x82603c=function(_0x39ec44){while(--_0x39ec44){_0x12e930['push'](_0x12e930['shift']());}};_0x82603c(++_0x3b89df);}(_0x2932,0x198));var _0x2293=function(_0x310990,_0x245984){_0x310990=_0x310990-0x0;var _0x648534=_0x2932[_0x310990];return _0x648534;};'use strict';var multer=require(_0x2293('0x0'));var util=require(_0x2293('0x1'));var path=require(_0x2293('0x2'));var timeout=require('connect-timeout');var express=require(_0x2293('0x3'));var router=express[_0x2293('0x4')]();var fs_extra=require(_0x2293('0x5'));var auth=require(_0x2293('0x6'));var interaction=require(_0x2293('0x7'));var config=require(_0x2293('0x8'));var controller=require('./campaign.controller');router[_0x2293('0x9')]('/',auth['isAuthenticated'](),controller[_0x2293('0xa')]);router['get']('/:id',auth[_0x2293('0xb')](),controller['show']);router['get'](_0x2293('0xc'),auth['isAuthenticated'](),controller[_0x2293('0xd')]);router[_0x2293('0x9')](_0x2293('0xe'),auth[_0x2293('0xb')](),controller[_0x2293('0xf')]);router[_0x2293('0x9')](_0x2293('0x10'),auth[_0x2293('0xb')](),controller[_0x2293('0x11')]);router[_0x2293('0x9')](_0x2293('0x12'),auth[_0x2293('0xb')](),controller['getHopperBlacks']);router[_0x2293('0x9')]('/:id/lists',auth[_0x2293('0xb')](),controller[_0x2293('0x13')]);router[_0x2293('0x9')](_0x2293('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x2293('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2293('0x16'),auth[_0x2293('0xb')](),controller[_0x2293('0x17')]);router[_0x2293('0x15')](_0x2293('0x18'),auth[_0x2293('0xb')](),controller[_0x2293('0x19')]);router[_0x2293('0x15')](_0x2293('0x14'),auth[_0x2293('0xb')](),controller['addBlackLists']);router[_0x2293('0x1a')](_0x2293('0x1b'),auth[_0x2293('0xb')](),controller[_0x2293('0x1c')]);router[_0x2293('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x2293('0x1e')]);router[_0x2293('0x1d')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2293('0x1f')]);router[_0x2293('0x1d')]('/:id/blacklists',auth[_0x2293('0xb')](),controller[_0x2293('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4a3182a..7f4d009 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 _0x8cd3=['exports','TEXT','medium','VIRTUAL','getDataValue','key','sequelize'];(function(_0x255a0a,_0x4d809f){var _0xcb9924=function(_0x52d945){while(--_0x52d945){_0x255a0a['push'](_0x255a0a['shift']());}};_0xcb9924(++_0x4d809f);}(_0x8cd3,0xe6));var _0x38cd=function(_0x1987c2,_0x25e5ea){_0x1987c2=_0x1987c2-0x0;var _0x3fbcf3=_0x8cd3[_0x1987c2];return _0x3fbcf3;};'use strict';var Sequelize=require(_0x38cd('0x0'));module[_0x38cd('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x38cd('0x2')],'length':_0x38cd('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x38cd('0x4')],'get':function(){return this[_0x38cd('0x5')](_0x38cd('0x6'));}}}; \ No newline at end of file +var _0x3d36=['key','sequelize','exports','STRING','TEXT','medium','VIRTUAL','getDataValue'];(function(_0x392750,_0x5c5b7d){var _0x514afd=function(_0x1be1b4){while(--_0x1be1b4){_0x392750['push'](_0x392750['shift']());}};_0x514afd(++_0x5c5b7d);}(_0x3d36,0x171));var _0x63d3=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x3d36[_0x237546];return _0x233e29;};'use strict';var Sequelize=require(_0x63d3('0x0'));module[_0x63d3('0x1')]={'key':{'type':Sequelize[_0x63d3('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x63d3('0x3')],'length':_0x63d3('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x63d3('0x2')]},'name':{'type':Sequelize[_0x63d3('0x5')],'get':function(){return this[_0x63d3('0x6')](_0x63d3('0x7'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index a637e01..08cde5e 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 _0x6107=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','rawAttributes','fields','includeAll','find','body','params','destroy','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x2a5b1f,_0x14f7a8){var _0x374b10=function(_0x5f039e){while(--_0x5f039e){_0x2a5b1f['push'](_0x2a5b1f['shift']());}};_0x374b10(++_0x14f7a8);}(_0x6107,0x9e));var _0x7610=function(_0x3ef412,_0x28691b){_0x3ef412=_0x3ef412-0x0;var _0x2cbaeb=_0x6107[_0x3ef412];return _0x2cbaeb;};'use strict';var emlformat=require(_0x7610('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7610('0x1'));var jsonpatch=require(_0x7610('0x2'));var rp=require(_0x7610('0x3'));var moment=require(_0x7610('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7610('0x5'));var util=require('util');var path=require(_0x7610('0x6'));var sox=require(_0x7610('0x7'));var csv=require(_0x7610('0x8'));var ejs=require(_0x7610('0x9'));var fs=require('fs');var fs_extra=require(_0x7610('0xa'));var _=require(_0x7610('0xb'));var squel=require(_0x7610('0xc'));var crypto=require(_0x7610('0xd'));var jsforce=require(_0x7610('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7610('0x8'));var querystring=require(_0x7610('0xf'));var Papa=require(_0x7610('0x10'));var Redis=require(_0x7610('0x11'));var authService=require(_0x7610('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7610('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7610('0x14'))(_0x7610('0x15'));var utils=require(_0x7610('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7610('0x17'));var db=require(_0x7610('0x18'))['db'];function respondWithStatusCode(_0x22fd75,_0x36e45c){_0x36e45c=_0x36e45c||0xcc;return function(_0x11fc2c){if(_0x11fc2c){return _0x22fd75[_0x7610('0x19')](_0x36e45c);}return _0x22fd75[_0x7610('0x1a')](_0x36e45c)[_0x7610('0x1b')]();};}function respondWithResult(_0x11c178,_0x35a6fb){_0x35a6fb=_0x35a6fb||0xc8;return function(_0x52884e){if(_0x52884e){return _0x11c178[_0x7610('0x1a')](_0x35a6fb)[_0x7610('0x1c')](_0x52884e);}};}function respondWithFilteredResult(_0x39a851,_0x20e869){return function(_0x5e6a39){if(_0x5e6a39){var _0x5e3bb3=typeof _0x20e869[_0x7610('0x1d')]===_0x7610('0x1e')&&typeof _0x20e869[_0x7610('0x1f')]==='undefined';var _0x112218=_0x5e6a39[_0x7610('0x20')];var _0x41f5b6=_0x5e3bb3?0x0:_0x20e869[_0x7610('0x1d')];var _0x4f30b3=_0x5e3bb3?_0x5e6a39[_0x7610('0x20')]:_0x20e869[_0x7610('0x1d')]+_0x20e869[_0x7610('0x1f')];var _0x3b2e2d;if(_0x4f30b3>=_0x112218){_0x4f30b3=_0x112218;_0x3b2e2d=0xc8;}else{_0x3b2e2d=0xce;}_0x39a851[_0x7610('0x1a')](_0x3b2e2d);return _0x39a851[_0x7610('0x21')](_0x7610('0x22'),_0x41f5b6+'-'+_0x4f30b3+'/'+_0x112218)[_0x7610('0x1c')](_0x5e6a39);}return null;};}function patchUpdates(_0x443d4e){return function(_0x41ee76){try{jsonpatch[_0x7610('0x23')](_0x41ee76,_0x443d4e,!![]);}catch(_0x12c64d){return BPromise[_0x7610('0x24')](_0x12c64d);}return _0x41ee76['save']();};}function saveUpdates(_0x4144f7,_0x501f8a){return function(_0x35dd30){if(_0x35dd30){return _0x35dd30[_0x7610('0x25')](_0x4144f7)[_0x7610('0x26')](function(_0x44af3d){return _0x44af3d;});}return null;};}function removeEntity(_0x4aa706,_0x4d7eaa){return function(_0x30fdca){if(_0x30fdca){return _0x30fdca['destroy']()[_0x7610('0x26')](function(){var _0x339d3f=_0x30fdca[_0x7610('0x27')]({'plain':!![]});var _0x22b929=_0x7610('0x28');return db[_0x7610('0x29')]['destroy']({'where':{'type':_0x22b929,'resourceId':_0x339d3f['id']}})[_0x7610('0x26')](function(){return _0x30fdca;});})[_0x7610('0x26')](function(){_0x4aa706[_0x7610('0x1a')](0xcc)[_0x7610('0x1b')]();});}};}function handleEntityNotFound(_0xcccc58,_0x1ed072){return function(_0x458200){if(!_0x458200){_0xcccc58[_0x7610('0x19')](0x194);}return _0x458200;};}function handleError(_0x13e771,_0x30ae04){_0x30ae04=_0x30ae04||0x1f4;return function(_0x3c494f){logger[_0x7610('0x2a')](_0x3c494f[_0x7610('0x2b')]);if(_0x3c494f[_0x7610('0x2c')]){delete _0x3c494f[_0x7610('0x2c')];}_0x13e771[_0x7610('0x1a')](_0x30ae04)[_0x7610('0x2d')](_0x3c494f);};}exports[_0x7610('0x2e')]=function(_0x530025,_0x1508a5){var _0x49d692={},_0x24d5ed={},_0x4c9564={'count':0x0,'rows':[]};var _0x57ef2d=_[_0x7610('0x2f')](db[_0x7610('0x30')]['rawAttributes'],function(_0x3375e2){return{'name':_0x3375e2[_0x7610('0x31')],'type':_0x3375e2[_0x7610('0x32')][_0x7610('0x33')]};});_0x24d5ed[_0x7610('0x34')]=_[_0x7610('0x2f')](_0x57ef2d,_0x7610('0x2c'));_0x24d5ed[_0x7610('0x35')]=_[_0x7610('0x36')](_0x530025[_0x7610('0x35')]);_0x24d5ed[_0x7610('0x37')]=_['intersection'](_0x24d5ed['model'],_0x24d5ed[_0x7610('0x35')]);_0x49d692[_0x7610('0x38')]=_[_0x7610('0x39')](_0x24d5ed['model'],qs['fields'](_0x530025[_0x7610('0x35')]['fields']));_0x49d692['attributes']=_0x49d692['attributes'][_0x7610('0x3a')]?_0x49d692[_0x7610('0x38')]:_0x24d5ed[_0x7610('0x34')];if(!_0x530025['query'][_0x7610('0x3b')](_0x7610('0x3c'))){_0x49d692[_0x7610('0x1f')]=qs[_0x7610('0x1f')](_0x530025[_0x7610('0x35')][_0x7610('0x1f')]);_0x49d692[_0x7610('0x1d')]=qs[_0x7610('0x1d')](_0x530025['query'][_0x7610('0x1d')]);}_0x49d692['order']=qs[_0x7610('0x3d')](_0x530025[_0x7610('0x35')][_0x7610('0x3d')]);_0x49d692['where']=qs[_0x7610('0x37')](_[_0x7610('0x3e')](_0x530025[_0x7610('0x35')],_0x24d5ed[_0x7610('0x37')]),_0x57ef2d);if(_0x530025[_0x7610('0x35')][_0x7610('0x3f')]){_0x49d692[_0x7610('0x40')]=_[_0x7610('0x41')](_0x49d692[_0x7610('0x40')],{'$or':[{'key':{'$like':'%'+_0x530025['query'][_0x7610('0x3f')]+'%'}},{'value':{'$like':'%'+_0x530025[_0x7610('0x35')][_0x7610('0x3f')]+'%'}}]});}_0x49d692=_[_0x7610('0x41')]({},_0x49d692,_0x530025[_0x7610('0x42')]);var _0x103103={'where':_0x49d692[_0x7610('0x40')]};return db[_0x7610('0x30')][_0x7610('0x20')](_0x103103)[_0x7610('0x26')](function(_0xc64d8f){_0x4c9564[_0x7610('0x20')]=_0xc64d8f;if(_0x530025[_0x7610('0x35')]['includeAll']){_0x49d692[_0x7610('0x43')]=[{'all':!![]}];}return db[_0x7610('0x30')][_0x7610('0x44')](_0x49d692);})['then'](function(_0x5c983d){_0x4c9564[_0x7610('0x45')]=_0x5c983d;return _0x4c9564;})[_0x7610('0x26')](respondWithFilteredResult(_0x1508a5,_0x49d692))[_0x7610('0x46')](handleError(_0x1508a5,null));};exports[_0x7610('0x47')]=function(_0x280d48,_0x96dfb3){var _0x331cff={'raw':!![],'where':{'id':_0x280d48['params']['id']}},_0x579949={};_0x579949['model']=_['keys'](db[_0x7610('0x30')][_0x7610('0x48')]);_0x579949[_0x7610('0x35')]=_['keys'](_0x280d48[_0x7610('0x35')]);_0x579949['filters']=_[_0x7610('0x39')](_0x579949[_0x7610('0x34')],_0x579949[_0x7610('0x35')]);_0x331cff[_0x7610('0x38')]=_['intersection'](_0x579949['model'],qs[_0x7610('0x49')](_0x280d48[_0x7610('0x35')][_0x7610('0x49')]));_0x331cff['attributes']=_0x331cff[_0x7610('0x38')][_0x7610('0x3a')]?_0x331cff[_0x7610('0x38')]:_0x579949['model'];if(_0x280d48['query'][_0x7610('0x4a')]){_0x331cff[_0x7610('0x43')]=[{'all':!![]}];}_0x331cff=_[_0x7610('0x41')]({},_0x331cff,_0x280d48[_0x7610('0x42')]);return db['CannedAnswer'][_0x7610('0x4b')](_0x331cff)[_0x7610('0x26')](handleEntityNotFound(_0x96dfb3,null))[_0x7610('0x26')](respondWithResult(_0x96dfb3,null))[_0x7610('0x46')](handleError(_0x96dfb3,null));};exports[_0x7610('0x25')]=function(_0x11ff14,_0x4f7adf){if(_0x11ff14[_0x7610('0x4c')]['id']){delete _0x11ff14[_0x7610('0x4c')]['id'];}return db[_0x7610('0x30')]['find']({'where':{'id':_0x11ff14[_0x7610('0x4d')]['id']}})[_0x7610('0x26')](handleEntityNotFound(_0x4f7adf,null))['then'](saveUpdates(_0x11ff14[_0x7610('0x4c')],null))[_0x7610('0x26')](respondWithResult(_0x4f7adf,null))[_0x7610('0x46')](handleError(_0x4f7adf,null));};exports[_0x7610('0x4e')]=function(_0x1c8032,_0x4d8115){return db[_0x7610('0x30')][_0x7610('0x4b')]({'where':{'id':_0x1c8032['params']['id']}})[_0x7610('0x26')](handleEntityNotFound(_0x4d8115,null))[_0x7610('0x26')](removeEntity(_0x4d8115,null))[_0x7610('0x46')](handleError(_0x4d8115,null));};exports[_0x7610('0x4f')]=function(_0x3530f9,_0x2a51a3){var _0x1b9116={'key':_0x3530f9[_0x7610('0x4c')][_0x7610('0x33')]};if(_0x3530f9[_0x7610('0x4c')][_0x7610('0x50')]){_0x1b9116[_0x7610('0x50')]=_0x3530f9['body'][_0x7610('0x50')];}else if(_0x3530f9[_0x7610('0x4c')][_0x7610('0x51')]){_0x1b9116[_0x7610('0x51')]=_0x3530f9['body'][_0x7610('0x51')];}else if(_0x3530f9['body'][_0x7610('0x52')]){_0x1b9116[_0x7610('0x52')]=_0x3530f9[_0x7610('0x4c')][_0x7610('0x52')];}else if(_0x3530f9[_0x7610('0x4c')][_0x7610('0x53')]){_0x1b9116[_0x7610('0x53')]=_0x3530f9[_0x7610('0x4c')][_0x7610('0x53')];}return db['CannedAnswer']['find']({'where':_0x1b9116})[_0x7610('0x26')](function(_0x2262fd){if(_0x2262fd){throw new db[(_0x7610('0x54'))][(_0x7610('0x55'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x7610('0x30')]['create'](_0x3530f9[_0x7610('0x4c')]);})[_0x7610('0x26')](function(_0x142766){var _0x374852=_0x3530f9['user'][_0x7610('0x27')]({'plain':!![]});if(!_0x374852)throw new Error(_0x7610('0x56'));if(_0x374852[_0x7610('0x57')]==='user'){var _0x4bea7b=_0x142766[_0x7610('0x27')]({'plain':!![]});return db[_0x7610('0x58')][_0x7610('0x4b')]({'where':{'name':_0x7610('0x28'),'userProfileId':_0x374852['userProfileId']},'raw':!![]})[_0x7610('0x26')](function(_0x2f43f0){if(_0x2f43f0&&_0x2f43f0['autoAssociation']===0x0){return db[_0x7610('0x29')][_0x7610('0x4f')]({'name':_0x4bea7b[_0x7610('0x2c')],'resourceId':_0x4bea7b['id'],'type':_0x2f43f0[_0x7610('0x2c')],'sectionId':_0x2f43f0['id']},{})[_0x7610('0x26')](function(){return _0x142766;});}else{return _0x142766;}})[_0x7610('0x46')](function(_0x3a684b){logger['error'](_0x7610('0x59'),_0x3a684b);throw _0x3a684b;});}return _0x142766;})[_0x7610('0x26')](respondWithResult(_0x2a51a3,0xc9))[_0x7610('0x46')](handleError(_0x2a51a3,null));}; \ No newline at end of file +var _0x09e2=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','rows','catch','show','params','body','find','create','key','MailAccountId','SmsAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x09e2,0x1b6));var _0x209e=function(_0x25cfcd,_0x5a294d){_0x25cfcd=_0x25cfcd-0x0;var _0x421a40=_0x09e2[_0x25cfcd];return _0x421a40;};'use strict';var emlformat=require(_0x209e('0x0'));var rimraf=require(_0x209e('0x1'));var zipdir=require(_0x209e('0x2'));var jsonpatch=require(_0x209e('0x3'));var rp=require(_0x209e('0x4'));var moment=require(_0x209e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x209e('0x6'));var util=require(_0x209e('0x7'));var path=require(_0x209e('0x8'));var sox=require(_0x209e('0x9'));var csv=require(_0x209e('0xa'));var ejs=require(_0x209e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x209e('0xc'));var squel=require(_0x209e('0xd'));var crypto=require(_0x209e('0xe'));var jsforce=require(_0x209e('0xf'));var deskjs=require(_0x209e('0x10'));var toCsv=require(_0x209e('0xa'));var querystring=require(_0x209e('0x11'));var Papa=require(_0x209e('0x12'));var Redis=require(_0x209e('0x13'));var authService=require(_0x209e('0x14'));var qs=require(_0x209e('0x15'));var as=require(_0x209e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x209e('0x17'))(_0x209e('0x18'));var utils=require('../../config/utils');var config=require(_0x209e('0x19'));var licenseUtil=require(_0x209e('0x1a'));var db=require(_0x209e('0x1b'))['db'];function respondWithStatusCode(_0x59c41c,_0x3a1040){_0x3a1040=_0x3a1040||0xcc;return function(_0x96c550){if(_0x96c550){return _0x59c41c[_0x209e('0x1c')](_0x3a1040);}return _0x59c41c['status'](_0x3a1040)[_0x209e('0x1d')]();};}function respondWithResult(_0x8627be,_0x55b607){_0x55b607=_0x55b607||0xc8;return function(_0x39c45d){if(_0x39c45d){return _0x8627be[_0x209e('0x1e')](_0x55b607)[_0x209e('0x1f')](_0x39c45d);}};}function respondWithFilteredResult(_0x548200,_0x4a40c1){return function(_0xb0151c){if(_0xb0151c){var _0x4c7eee=typeof _0x4a40c1['offset']==='undefined'&&typeof _0x4a40c1[_0x209e('0x20')]===_0x209e('0x21');var _0x3f5685=_0xb0151c[_0x209e('0x22')];var _0x19460b=_0x4c7eee?0x0:_0x4a40c1[_0x209e('0x23')];var _0x4a3a44=_0x4c7eee?_0xb0151c[_0x209e('0x22')]:_0x4a40c1['offset']+_0x4a40c1[_0x209e('0x20')];var _0x4b204d;if(_0x4a3a44>=_0x3f5685){_0x4a3a44=_0x3f5685;_0x4b204d=0xc8;}else{_0x4b204d=0xce;}_0x548200[_0x209e('0x1e')](_0x4b204d);return _0x548200[_0x209e('0x24')](_0x209e('0x25'),_0x19460b+'-'+_0x4a3a44+'/'+_0x3f5685)[_0x209e('0x1f')](_0xb0151c);}return null;};}function patchUpdates(_0x59cd19){return function(_0x5a1fdb){try{jsonpatch[_0x209e('0x26')](_0x5a1fdb,_0x59cd19,!![]);}catch(_0x4c41b0){return BPromise[_0x209e('0x27')](_0x4c41b0);}return _0x5a1fdb[_0x209e('0x28')]();};}function saveUpdates(_0x2ffcc6,_0x57dfe1){return function(_0x4d383c){if(_0x4d383c){return _0x4d383c[_0x209e('0x29')](_0x2ffcc6)[_0x209e('0x2a')](function(_0xba442e){return _0xba442e;});}return null;};}function removeEntity(_0x113d3d,_0x4ae2e1){return function(_0xbda9d6){if(_0xbda9d6){return _0xbda9d6[_0x209e('0x2b')]()[_0x209e('0x2a')](function(){var _0x29f378=_0xbda9d6['get']({'plain':!![]});var _0x530057=_0x209e('0x2c');return db[_0x209e('0x2d')]['destroy']({'where':{'type':_0x530057,'resourceId':_0x29f378['id']}})[_0x209e('0x2a')](function(){return _0xbda9d6;});})['then'](function(){_0x113d3d[_0x209e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e2938,_0x4de8af){return function(_0x513e3b){if(!_0x513e3b){_0x4e2938[_0x209e('0x1c')](0x194);}return _0x513e3b;};}function handleError(_0x36ccfe,_0x2dad3b){_0x2dad3b=_0x2dad3b||0x1f4;return function(_0x4c6d4){logger['error'](_0x4c6d4[_0x209e('0x2e')]);if(_0x4c6d4[_0x209e('0x2f')]){delete _0x4c6d4[_0x209e('0x2f')];}_0x36ccfe[_0x209e('0x1e')](_0x2dad3b)['send'](_0x4c6d4);};}exports[_0x209e('0x30')]=function(_0x47456a,_0x2b9b8f){var _0x4e3499={},_0x430c9a={},_0x2bccf1={'count':0x0,'rows':[]};var _0x59072a=_[_0x209e('0x31')](db[_0x209e('0x32')][_0x209e('0x33')],function(_0x274992){return{'name':_0x274992[_0x209e('0x34')],'type':_0x274992[_0x209e('0x35')]['key']};});_0x430c9a[_0x209e('0x36')]=_['map'](_0x59072a,_0x209e('0x2f'));_0x430c9a[_0x209e('0x37')]=_[_0x209e('0x38')](_0x47456a[_0x209e('0x37')]);_0x430c9a[_0x209e('0x39')]=_[_0x209e('0x3a')](_0x430c9a['model'],_0x430c9a[_0x209e('0x37')]);_0x4e3499[_0x209e('0x3b')]=_[_0x209e('0x3a')](_0x430c9a[_0x209e('0x36')],qs[_0x209e('0x3c')](_0x47456a[_0x209e('0x37')][_0x209e('0x3c')]));_0x4e3499['attributes']=_0x4e3499[_0x209e('0x3b')][_0x209e('0x3d')]?_0x4e3499[_0x209e('0x3b')]:_0x430c9a[_0x209e('0x36')];if(!_0x47456a['query'][_0x209e('0x3e')]('nolimit')){_0x4e3499[_0x209e('0x20')]=qs[_0x209e('0x20')](_0x47456a['query']['limit']);_0x4e3499[_0x209e('0x23')]=qs[_0x209e('0x23')](_0x47456a['query'][_0x209e('0x23')]);}_0x4e3499[_0x209e('0x3f')]=qs[_0x209e('0x40')](_0x47456a[_0x209e('0x37')][_0x209e('0x40')]);_0x4e3499[_0x209e('0x41')]=qs['filters'](_[_0x209e('0x42')](_0x47456a[_0x209e('0x37')],_0x430c9a[_0x209e('0x39')]),_0x59072a);if(_0x47456a[_0x209e('0x37')][_0x209e('0x43')]){_0x4e3499['where']=_[_0x209e('0x44')](_0x4e3499[_0x209e('0x41')],{'$or':[{'key':{'$like':'%'+_0x47456a['query']['filter']+'%'}},{'value':{'$like':'%'+_0x47456a[_0x209e('0x37')][_0x209e('0x43')]+'%'}}]});}_0x4e3499=_[_0x209e('0x44')]({},_0x4e3499,_0x47456a[_0x209e('0x45')]);var _0x3f41ba={'where':_0x4e3499[_0x209e('0x41')]};return db['CannedAnswer'][_0x209e('0x22')](_0x3f41ba)[_0x209e('0x2a')](function(_0x4a412e){_0x2bccf1[_0x209e('0x22')]=_0x4a412e;if(_0x47456a[_0x209e('0x37')]['includeAll']){_0x4e3499['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4e3499);})[_0x209e('0x2a')](function(_0x114978){_0x2bccf1[_0x209e('0x46')]=_0x114978;return _0x2bccf1;})[_0x209e('0x2a')](respondWithFilteredResult(_0x2b9b8f,_0x4e3499))[_0x209e('0x47')](handleError(_0x2b9b8f,null));};exports[_0x209e('0x48')]=function(_0x418b59,_0xb3fc48){var _0x475208={'raw':!![],'where':{'id':_0x418b59[_0x209e('0x49')]['id']}},_0x193ca7={};_0x193ca7[_0x209e('0x36')]=_[_0x209e('0x38')](db[_0x209e('0x32')][_0x209e('0x33')]);_0x193ca7[_0x209e('0x37')]=_[_0x209e('0x38')](_0x418b59[_0x209e('0x37')]);_0x193ca7['filters']=_[_0x209e('0x3a')](_0x193ca7['model'],_0x193ca7[_0x209e('0x37')]);_0x475208[_0x209e('0x3b')]=_['intersection'](_0x193ca7['model'],qs[_0x209e('0x3c')](_0x418b59[_0x209e('0x37')][_0x209e('0x3c')]));_0x475208['attributes']=_0x475208[_0x209e('0x3b')]['length']?_0x475208[_0x209e('0x3b')]:_0x193ca7['model'];if(_0x418b59['query']['includeAll']){_0x475208['include']=[{'all':!![]}];}_0x475208=_[_0x209e('0x44')]({},_0x475208,_0x418b59[_0x209e('0x45')]);return db[_0x209e('0x32')]['find'](_0x475208)['then'](handleEntityNotFound(_0xb3fc48,null))['then'](respondWithResult(_0xb3fc48,null))[_0x209e('0x47')](handleError(_0xb3fc48,null));};exports[_0x209e('0x29')]=function(_0x4a06a9,_0x456c05){if(_0x4a06a9[_0x209e('0x4a')]['id']){delete _0x4a06a9[_0x209e('0x4a')]['id'];}return db['CannedAnswer'][_0x209e('0x4b')]({'where':{'id':_0x4a06a9[_0x209e('0x49')]['id']}})['then'](handleEntityNotFound(_0x456c05,null))['then'](saveUpdates(_0x4a06a9[_0x209e('0x4a')],null))[_0x209e('0x2a')](respondWithResult(_0x456c05,null))[_0x209e('0x47')](handleError(_0x456c05,null));};exports[_0x209e('0x2b')]=function(_0x28f2fb,_0x1b285f){return db[_0x209e('0x32')][_0x209e('0x4b')]({'where':{'id':_0x28f2fb[_0x209e('0x49')]['id']}})[_0x209e('0x2a')](handleEntityNotFound(_0x1b285f,null))[_0x209e('0x2a')](removeEntity(_0x1b285f,null))['catch'](handleError(_0x1b285f,null));};exports[_0x209e('0x4c')]=function(_0x298cad,_0x37f2ae){var _0x53a30e={'key':_0x298cad[_0x209e('0x4a')][_0x209e('0x4d')]};if(_0x298cad[_0x209e('0x4a')][_0x209e('0x4e')]){_0x53a30e[_0x209e('0x4e')]=_0x298cad['body'][_0x209e('0x4e')];}else if(_0x298cad[_0x209e('0x4a')]['SmsAccountId']){_0x53a30e[_0x209e('0x4f')]=_0x298cad[_0x209e('0x4a')][_0x209e('0x4f')];}else if(_0x298cad[_0x209e('0x4a')]['OpenchannelAccountId']){_0x53a30e['OpenchannelAccountId']=_0x298cad[_0x209e('0x4a')]['OpenchannelAccountId'];}else if(_0x298cad[_0x209e('0x4a')][_0x209e('0x50')]){_0x53a30e[_0x209e('0x50')]=_0x298cad['body'][_0x209e('0x50')];}return db[_0x209e('0x32')][_0x209e('0x4b')]({'where':_0x53a30e})[_0x209e('0x2a')](function(_0x3e9cd3){if(_0x3e9cd3){throw new db[(_0x209e('0x51'))][(_0x209e('0x52'))](_0x209e('0x53'));}return db[_0x209e('0x32')][_0x209e('0x4c')](_0x298cad['body']);})[_0x209e('0x2a')](function(_0x327ae5){var _0x1337d9=_0x298cad['user'][_0x209e('0x54')]({'plain':!![]});if(!_0x1337d9)throw new Error(_0x209e('0x55'));if(_0x1337d9['role']===_0x209e('0x56')){var _0x51883f=_0x327ae5[_0x209e('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x209e('0x4b')]({'where':{'name':_0x209e('0x2c'),'userProfileId':_0x1337d9[_0x209e('0x57')]},'raw':!![]})[_0x209e('0x2a')](function(_0x1a4d5c){if(_0x1a4d5c&&_0x1a4d5c[_0x209e('0x58')]===0x0){return db['UserProfileResource'][_0x209e('0x4c')]({'name':_0x51883f[_0x209e('0x2f')],'resourceId':_0x51883f['id'],'type':_0x1a4d5c[_0x209e('0x2f')],'sectionId':_0x1a4d5c['id']},{})[_0x209e('0x2a')](function(){return _0x327ae5;});}else{return _0x327ae5;}})[_0x209e('0x47')](function(_0x361aa6){logger[_0x209e('0x59')](_0x209e('0x5a'),_0x361aa6);throw _0x361aa6;});}return _0x327ae5;})[_0x209e('0x2a')](respondWithResult(_0x37f2ae,0xc9))[_0x209e('0x47')](handleError(_0x37f2ae,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 20e49e9..0818f91 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 _0xff28=['lodash','util','../../config/logger','api','bluebird','path','rimraf','exports','define','tools_canned_answers','utf8mb4'];(function(_0x7b484,_0x195ad4){var _0x2ae1cf=function(_0x2e6247){while(--_0x2e6247){_0x7b484['push'](_0x7b484['shift']());}};_0x2ae1cf(++_0x195ad4);}(_0xff28,0xdc));var _0x8ff2=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0xff28[_0x443494];return _0x4a6794;};'use strict';var _=require(_0x8ff2('0x0'));var util=require(_0x8ff2('0x1'));var logger=require(_0x8ff2('0x2'))(_0x8ff2('0x3'));var moment=require('moment');var BPromise=require(_0x8ff2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ff2('0x5'));var rimraf=require(_0x8ff2('0x6'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x8ff2('0x7')]=function(_0x3bc7e4,_0x2e8993){return _0x3bc7e4[_0x8ff2('0x8')]('CannedAnswer',attributes,{'tableName':_0x8ff2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ff2('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8f59=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x58d86a,_0x5b2505){var _0x3f5008=function(_0x53ad18){while(--_0x53ad18){_0x58d86a['push'](_0x58d86a['shift']());}};_0x3f5008(++_0x5b2505);}(_0x8f59,0x11d));var _0x98f5=function(_0x5ba736,_0x3470bb){_0x5ba736=_0x5ba736-0x0;var _0xa338e4=_0x8f59[_0x5ba736];return _0xa338e4;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var logger=require(_0x98f5('0x2'))(_0x98f5('0x3'));var moment=require(_0x98f5('0x4'));var BPromise=require(_0x98f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98f5('0x6'));var rimraf=require(_0x98f5('0x7'));var config=require(_0x98f5('0x8'));var attributes=require(_0x98f5('0x9'));module['exports']=function(_0xdcce7a,_0x358618){return _0xdcce7a[_0x98f5('0xa')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x98f5('0xb'),'collate':_0x98f5('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index fa50cd4..c65f87c 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(_0x23f553,_0x445bf3){var _0x26ab08=function(_0x44d3a3){while(--_0x44d3a3){_0x23f553['push'](_0x23f553['shift']());}};_0x26ab08(++_0x445bf3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x3b5ffd,_0x2548d1){var _0x1fa6d5=function(_0x2237c){while(--_0x2237c){_0x3b5ffd['push'](_0x3b5ffd['shift']());}};_0x1fa6d5(++_0x2548d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 2b2d411..e6e1d0a 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 _0x6ff1=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','/:id','isAuthenticated','post'];(function(_0x41daaf,_0x9c8ae8){var _0x492873=function(_0x4283b3){while(--_0x4283b3){_0x41daaf['push'](_0x41daaf['shift']());}};_0x492873(++_0x9c8ae8);}(_0x6ff1,0xf0));var _0x16ff=function(_0x48787a,_0x13f971){_0x48787a=_0x48787a-0x0;var _0x452d03=_0x6ff1[_0x48787a];return _0x452d03;};'use strict';var multer=require(_0x16ff('0x0'));var util=require(_0x16ff('0x1'));var path=require('path');var timeout=require(_0x16ff('0x2'));var express=require(_0x16ff('0x3'));var router=express['Router']();var fs_extra=require(_0x16ff('0x4'));var auth=require(_0x16ff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x16ff('0x6'));var controller=require(_0x16ff('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x16ff('0x8')](_0x16ff('0x9'),auth[_0x16ff('0xa')](),controller['show']);router[_0x16ff('0xb')]('/',auth[_0x16ff('0xa')](),controller[_0x16ff('0xc')]);router[_0x16ff('0xd')](_0x16ff('0x9'),auth['isAuthenticated'](),controller[_0x16ff('0xe')]);router[_0x16ff('0xf')]('/:id',auth[_0x16ff('0xa')](),controller[_0x16ff('0x10')]);module[_0x16ff('0x11')]=router; \ No newline at end of file +var _0x6e54=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','index','get','/:id','post','isAuthenticated','create'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x6e54,0x101));var _0x46e5=function(_0x324fe8,_0x1ccb46){_0x324fe8=_0x324fe8-0x0;var _0x4a1cd9=_0x6e54[_0x324fe8];return _0x4a1cd9;};'use strict';var multer=require(_0x46e5('0x0'));var util=require(_0x46e5('0x1'));var path=require(_0x46e5('0x2'));var timeout=require(_0x46e5('0x3'));var express=require(_0x46e5('0x4'));var router=express[_0x46e5('0x5')]();var fs_extra=require(_0x46e5('0x6'));var auth=require(_0x46e5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x46e5('0x8'));var controller=require(_0x46e5('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x46e5('0xa')]);router[_0x46e5('0xb')](_0x46e5('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x46e5('0xd')]('/',auth[_0x46e5('0xe')](),controller[_0x46e5('0xf')]);router[_0x46e5('0x10')](_0x46e5('0xc'),auth['isAuthenticated'](),controller[_0x46e5('0x11')]);router[_0x46e5('0x12')](_0x46e5('0xc'),auth[_0x46e5('0xe')](),controller[_0x46e5('0x13')]);module[_0x46e5('0x14')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e5b5345..d3c72b4 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 _0xc540=['INTEGER','1970-01-01\x2000:00:01','STRING'];(function(_0xc1c93f,_0x1fba71){var _0x3f81cb=function(_0x20b66f){while(--_0x20b66f){_0xc1c93f['push'](_0xc1c93f['shift']());}};_0x3f81cb(++_0x1fba71);}(_0xc540,0x184));var _0x0c54=function(_0x3956ff,_0x4cd334){_0x3956ff=_0x3956ff-0x0;var _0x3bd57d=_0xc540[_0x3956ff];return _0x3bd57d;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x0c54('0x0')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x0c54('0x1')]},'dst':{'type':Sequelize[_0x0c54('0x1')]},'dcontext':{'type':Sequelize[_0x0c54('0x1')]},'channel':{'type':Sequelize[_0x0c54('0x1')]},'dstchannel':{'type':Sequelize[_0x0c54('0x1')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x0c54('0x1')]},'duration':{'type':Sequelize[_0x0c54('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0c54('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0c54('0x1')]},'amaflags':{'type':Sequelize[_0x0c54('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0c54('0x1')]},'userfield':{'type':Sequelize[_0x0c54('0x1')]},'uniqueid':{'type':Sequelize[_0x0c54('0x1')]},'linkedid':{'type':Sequelize[_0x0c54('0x1')]},'sequence':{'type':Sequelize[_0x0c54('0x1')]},'peeraccount':{'type':Sequelize[_0x0c54('0x1')]},'type':{'type':Sequelize[_0x0c54('0x1')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3a41=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x1ba0f3,_0x4e7ab8){var _0x313c21=function(_0x423f79){while(--_0x423f79){_0x1ba0f3['push'](_0x1ba0f3['shift']());}};_0x313c21(++_0x4e7ab8);}(_0x3a41,0x86));var _0x13a4=function(_0x56de9d,_0x413b89){_0x56de9d=_0x56de9d-0x0;var _0x5b63fd=_0x3a41[_0x56de9d];return _0x5b63fd;};'use strict';var Sequelize=require(_0x13a4('0x0'));module[_0x13a4('0x1')]={'calldate':{'type':Sequelize[_0x13a4('0x2')],'allowNull':![],'defaultValue':_0x13a4('0x3')},'clid':{'type':Sequelize[_0x13a4('0x4')]},'src':{'type':Sequelize[_0x13a4('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x13a4('0x4')]},'channel':{'type':Sequelize[_0x13a4('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x13a4('0x4')]},'duration':{'type':Sequelize[_0x13a4('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x13a4('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x13a4('0x4')]},'amaflags':{'type':Sequelize[_0x13a4('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x13a4('0x4')]},'uniqueid':{'type':Sequelize[_0x13a4('0x4')]},'linkedid':{'type':Sequelize[_0x13a4('0x4')]},'sequence':{'type':Sequelize[_0x13a4('0x4')]},'peeraccount':{'type':Sequelize[_0x13a4('0x4')]},'type':{'type':Sequelize[_0x13a4('0x4')]},'tag':{'type':Sequelize[_0x13a4('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 30a37b5..adf83cf 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 _0xf006=['fieldName','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','destroy','describe','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0xf006,0x146));var _0x6f00=function(_0x57ab57,_0x35db53){_0x57ab57=_0x57ab57-0x0;var _0x5ddf03=_0xf006[_0x57ab57];return _0x5ddf03;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f00('0x0'));var jsonpatch=require(_0x6f00('0x1'));var rp=require('request-promise');var moment=require(_0x6f00('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6f00('0x3'));var util=require('util');var path=require('path');var sox=require(_0x6f00('0x4'));var csv=require(_0x6f00('0x5'));var ejs=require(_0x6f00('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f00('0x7'));var squel=require('squel');var crypto=require(_0x6f00('0x8'));var jsforce=require(_0x6f00('0x9'));var deskjs=require(_0x6f00('0xa'));var toCsv=require(_0x6f00('0x5'));var querystring=require(_0x6f00('0xb'));var Papa=require(_0x6f00('0xc'));var Redis=require(_0x6f00('0xd'));var authService=require(_0x6f00('0xe'));var qs=require(_0x6f00('0xf'));var as=require(_0x6f00('0x10'));var hardwareService=require(_0x6f00('0x11'));var logger=require(_0x6f00('0x12'))(_0x6f00('0x13'));var utils=require('../../config/utils');var config=require(_0x6f00('0x14'));var licenseUtil=require(_0x6f00('0x15'));var db=require(_0x6f00('0x16'))['db'];function respondWithStatusCode(_0x36a2ec,_0x289fe9){_0x289fe9=_0x289fe9||0xcc;return function(_0x5e3264){if(_0x5e3264){return _0x36a2ec[_0x6f00('0x17')](_0x289fe9);}return _0x36a2ec['status'](_0x289fe9)[_0x6f00('0x18')]();};}function respondWithResult(_0x5047f5,_0x324e67){_0x324e67=_0x324e67||0xc8;return function(_0x220e68){if(_0x220e68){return _0x5047f5[_0x6f00('0x19')](_0x324e67)[_0x6f00('0x1a')](_0x220e68);}};}function respondWithFilteredResult(_0xa6e7a1,_0x411203){return function(_0x46bc2c){if(_0x46bc2c){var _0x4d8aee=typeof _0x411203[_0x6f00('0x1b')]==='undefined'&&typeof _0x411203[_0x6f00('0x1c')]==='undefined';var _0x534275=_0x46bc2c[_0x6f00('0x1d')];var _0x6cf83f=_0x4d8aee?0x0:_0x411203[_0x6f00('0x1b')];var _0x340f78=_0x4d8aee?_0x46bc2c[_0x6f00('0x1d')]:_0x411203[_0x6f00('0x1b')]+_0x411203[_0x6f00('0x1c')];var _0x295640;if(_0x340f78>=_0x534275){_0x340f78=_0x534275;_0x295640=0xc8;}else{_0x295640=0xce;}_0xa6e7a1[_0x6f00('0x19')](_0x295640);return _0xa6e7a1[_0x6f00('0x1e')](_0x6f00('0x1f'),_0x6cf83f+'-'+_0x340f78+'/'+_0x534275)[_0x6f00('0x1a')](_0x46bc2c);}return null;};}function patchUpdates(_0x4e11de){return function(_0x4f3031){try{jsonpatch['apply'](_0x4f3031,_0x4e11de,!![]);}catch(_0x2a5286){return BPromise[_0x6f00('0x20')](_0x2a5286);}return _0x4f3031[_0x6f00('0x21')]();};}function saveUpdates(_0x57340f,_0xe301e5){return function(_0x9066ff){if(_0x9066ff){return _0x9066ff[_0x6f00('0x22')](_0x57340f)[_0x6f00('0x23')](function(_0x388983){return _0x388983;});}return null;};}function removeEntity(_0x1cbf1c,_0x90d74c){return function(_0x1ea061){if(_0x1ea061){return _0x1ea061['destroy']()[_0x6f00('0x23')](function(){_0x1cbf1c[_0x6f00('0x19')](0xcc)[_0x6f00('0x18')]();});}};}function handleEntityNotFound(_0x4d41ef,_0x37f062){return function(_0x4f7e29){if(!_0x4f7e29){_0x4d41ef[_0x6f00('0x17')](0x194);}return _0x4f7e29;};}function handleError(_0x511293,_0x434735){_0x434735=_0x434735||0x1f4;return function(_0x39375d){logger[_0x6f00('0x24')](_0x39375d[_0x6f00('0x25')]);if(_0x39375d[_0x6f00('0x26')]){delete _0x39375d['name'];}_0x511293[_0x6f00('0x19')](_0x434735)[_0x6f00('0x27')](_0x39375d);};}exports[_0x6f00('0x28')]=function(_0x4366a4,_0x2671fe){var _0x235a86={},_0xff36ce={},_0x451849={'count':0x0,'rows':[]};var _0x22f107=_[_0x6f00('0x29')](db[_0x6f00('0x2a')][_0x6f00('0x2b')],function(_0x29555d){return{'name':_0x29555d[_0x6f00('0x2c')],'type':_0x29555d['type']['key']};});_0xff36ce['model']=_['map'](_0x22f107,'name');_0xff36ce['query']=_[_0x6f00('0x2d')](_0x4366a4['query']);_0xff36ce[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0xff36ce[_0x6f00('0x30')],_0xff36ce[_0x6f00('0x31')]);_0x235a86[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0xff36ce['model'],qs[_0x6f00('0x33')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x33')]));_0x235a86[_0x6f00('0x32')]=_0x235a86[_0x6f00('0x32')]['length']?_0x235a86['attributes']:_0xff36ce['model'];if(!_0x4366a4[_0x6f00('0x31')][_0x6f00('0x34')](_0x6f00('0x35'))){_0x235a86[_0x6f00('0x1c')]=qs[_0x6f00('0x1c')](_0x4366a4['query'][_0x6f00('0x1c')]);_0x235a86[_0x6f00('0x1b')]=qs[_0x6f00('0x1b')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x1b')]);}_0x235a86[_0x6f00('0x36')]=qs[_0x6f00('0x37')](_0x4366a4['query'][_0x6f00('0x37')]);_0x235a86[_0x6f00('0x38')]=qs[_0x6f00('0x2e')](_['pick'](_0x4366a4[_0x6f00('0x31')],_0xff36ce[_0x6f00('0x2e')]),_0x22f107);if(_0x4366a4[_0x6f00('0x31')]['filter']){_0x235a86[_0x6f00('0x38')]=_['merge'](_0x235a86[_0x6f00('0x38')],{'$or':_['map'](_0x22f107,function(_0x3dc8e3){if(_0x3dc8e3[_0x6f00('0x39')]!==_0x6f00('0x3a')){var _0x896b3f={};_0x896b3f[_0x3dc8e3['name']]={'$like':'%'+_0x4366a4[_0x6f00('0x31')]['filter']+'%'};return _0x896b3f;}})});}_0x235a86=_[_0x6f00('0x3b')]({},_0x235a86,_0x4366a4['options']);var _0x7785e1={'where':_0x235a86[_0x6f00('0x38')]};return db[_0x6f00('0x2a')][_0x6f00('0x1d')](_0x7785e1)['then'](function(_0x53dc8c){_0x451849[_0x6f00('0x1d')]=_0x53dc8c;if(_0x4366a4['query'][_0x6f00('0x3c')]){_0x235a86[_0x6f00('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x6f00('0x3e')](_0x235a86);})['then'](function(_0x4cac2c){_0x451849[_0x6f00('0x3f')]=_0x4cac2c;return _0x451849;})[_0x6f00('0x23')](respondWithFilteredResult(_0x2671fe,_0x235a86))[_0x6f00('0x40')](handleError(_0x2671fe,null));};exports[_0x6f00('0x41')]=function(_0x56399a,_0x38ee25){var _0x4523f2={'raw':!![],'where':{'id':_0x56399a[_0x6f00('0x42')]['id']}},_0x2bb5aa={};_0x2bb5aa[_0x6f00('0x30')]=_[_0x6f00('0x2d')](db['Cdr'][_0x6f00('0x2b')]);_0x2bb5aa[_0x6f00('0x31')]=_[_0x6f00('0x2d')](_0x56399a[_0x6f00('0x31')]);_0x2bb5aa[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],_0x2bb5aa[_0x6f00('0x31')]);_0x4523f2[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],qs[_0x6f00('0x33')](_0x56399a['query'][_0x6f00('0x33')]));_0x4523f2[_0x6f00('0x32')]=_0x4523f2['attributes'][_0x6f00('0x43')]?_0x4523f2['attributes']:_0x2bb5aa[_0x6f00('0x30')];if(_0x56399a[_0x6f00('0x31')][_0x6f00('0x3c')]){_0x4523f2[_0x6f00('0x3d')]=[{'all':!![]}];}_0x4523f2=_['merge']({},_0x4523f2,_0x56399a[_0x6f00('0x44')]);return db['Cdr'][_0x6f00('0x45')](_0x4523f2)['then'](handleEntityNotFound(_0x38ee25,null))[_0x6f00('0x23')](respondWithResult(_0x38ee25,null))[_0x6f00('0x40')](handleError(_0x38ee25,null));};exports[_0x6f00('0x46')]=function(_0x9b003,_0x470ff3){return db[_0x6f00('0x2a')][_0x6f00('0x46')](_0x9b003[_0x6f00('0x47')],{})['then'](respondWithResult(_0x470ff3,0xc9))[_0x6f00('0x40')](handleError(_0x470ff3,null));};exports['update']=function(_0x265666,_0x31fb17){if(_0x265666[_0x6f00('0x47')]['id']){delete _0x265666['body']['id'];}return db['Cdr'][_0x6f00('0x45')]({'where':{'id':_0x265666[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x31fb17,null))[_0x6f00('0x23')](saveUpdates(_0x265666['body'],null))[_0x6f00('0x23')](respondWithResult(_0x31fb17,null))['catch'](handleError(_0x31fb17,null));};exports[_0x6f00('0x48')]=function(_0x222b4c,_0x4c6e06){return db['Cdr'][_0x6f00('0x45')]({'where':{'id':_0x222b4c[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c6e06,null))[_0x6f00('0x23')](removeEntity(_0x4c6e06,null))['catch'](handleError(_0x4c6e06,null));};exports[_0x6f00('0x49')]=function(_0x7f80ed,_0x3100ee){return db[_0x6f00('0x2a')][_0x6f00('0x49')]()[_0x6f00('0x23')](respondWithResult(_0x3100ee,null))[_0x6f00('0x40')](handleError(_0x3100ee,null));}; \ No newline at end of file +var _0x5292=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','fields','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','Cdr'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x5292,0xf7));var _0x2529=function(_0x5e3ac2,_0x225614){_0x5e3ac2=_0x5e3ac2-0x0;var _0x29a007=_0x5292[_0x5e3ac2];return _0x29a007;};'use strict';var emlformat=require(_0x2529('0x0'));var rimraf=require(_0x2529('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2529('0x2'));var rp=require('request-promise');var moment=require(_0x2529('0x3'));var BPromise=require(_0x2529('0x4'));var Mustache=require(_0x2529('0x5'));var util=require(_0x2529('0x6'));var path=require('path');var sox=require(_0x2529('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2529('0x8'));var squel=require(_0x2529('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2529('0xa'));var toCsv=require(_0x2529('0xb'));var querystring=require('querystring');var Papa=require(_0x2529('0xc'));var Redis=require(_0x2529('0xd'));var authService=require(_0x2529('0xe'));var qs=require(_0x2529('0xf'));var as=require(_0x2529('0x10'));var hardwareService=require(_0x2529('0x11'));var logger=require(_0x2529('0x12'))(_0x2529('0x13'));var utils=require('../../config/utils');var config=require(_0x2529('0x14'));var licenseUtil=require(_0x2529('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe333c9,_0x23bfaf){_0x23bfaf=_0x23bfaf||0xcc;return function(_0x149692){if(_0x149692){return _0xe333c9[_0x2529('0x16')](_0x23bfaf);}return _0xe333c9[_0x2529('0x17')](_0x23bfaf)[_0x2529('0x18')]();};}function respondWithResult(_0x3f3b40,_0x5245cf){_0x5245cf=_0x5245cf||0xc8;return function(_0x101668){if(_0x101668){return _0x3f3b40[_0x2529('0x17')](_0x5245cf)[_0x2529('0x19')](_0x101668);}};}function respondWithFilteredResult(_0x19e4bf,_0x1cc716){return function(_0x2598a1){if(_0x2598a1){var _0x1a1ccc=typeof _0x1cc716[_0x2529('0x1a')]==='undefined'&&typeof _0x1cc716[_0x2529('0x1b')]==='undefined';var _0x337720=_0x2598a1[_0x2529('0x1c')];var _0x89be58=_0x1a1ccc?0x0:_0x1cc716['offset'];var _0x5b4d0d=_0x1a1ccc?_0x2598a1[_0x2529('0x1c')]:_0x1cc716[_0x2529('0x1a')]+_0x1cc716[_0x2529('0x1b')];var _0x37204a;if(_0x5b4d0d>=_0x337720){_0x5b4d0d=_0x337720;_0x37204a=0xc8;}else{_0x37204a=0xce;}_0x19e4bf[_0x2529('0x17')](_0x37204a);return _0x19e4bf['set'](_0x2529('0x1d'),_0x89be58+'-'+_0x5b4d0d+'/'+_0x337720)[_0x2529('0x19')](_0x2598a1);}return null;};}function patchUpdates(_0x1ca15f){return function(_0xeff5a6){try{jsonpatch['apply'](_0xeff5a6,_0x1ca15f,!![]);}catch(_0x1fa873){return BPromise[_0x2529('0x1e')](_0x1fa873);}return _0xeff5a6[_0x2529('0x1f')]();};}function saveUpdates(_0x5b4760,_0x3d5d17){return function(_0x3f57da){if(_0x3f57da){return _0x3f57da[_0x2529('0x20')](_0x5b4760)[_0x2529('0x21')](function(_0x5540e4){return _0x5540e4;});}return null;};}function removeEntity(_0x2736f6,_0x2d0c6d){return function(_0x400a01){if(_0x400a01){return _0x400a01[_0x2529('0x22')]()[_0x2529('0x21')](function(){_0x2736f6[_0x2529('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5539ef,_0x856e50){return function(_0x40f42b){if(!_0x40f42b){_0x5539ef[_0x2529('0x16')](0x194);}return _0x40f42b;};}function handleError(_0x431c40,_0x24418a){_0x24418a=_0x24418a||0x1f4;return function(_0x2a8371){logger[_0x2529('0x23')](_0x2a8371[_0x2529('0x24')]);if(_0x2a8371[_0x2529('0x25')]){delete _0x2a8371[_0x2529('0x25')];}_0x431c40['status'](_0x24418a)[_0x2529('0x26')](_0x2a8371);};}exports[_0x2529('0x27')]=function(_0x4dd0fb,_0x1822ce){var _0x3c46c6={},_0x5bea2d={},_0x17bcbd={'count':0x0,'rows':[]};var _0x1d7e98=_['map'](db[_0x2529('0x28')][_0x2529('0x29')],function(_0x4a18f6){return{'name':_0x4a18f6[_0x2529('0x2a')],'type':_0x4a18f6[_0x2529('0x2b')][_0x2529('0x2c')]};});_0x5bea2d[_0x2529('0x2d')]=_[_0x2529('0x2e')](_0x1d7e98,'name');_0x5bea2d[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x4dd0fb[_0x2529('0x2f')]);_0x5bea2d[_0x2529('0x31')]=_[_0x2529('0x32')](_0x5bea2d[_0x2529('0x2d')],_0x5bea2d[_0x2529('0x2f')]);_0x3c46c6['attributes']=_['intersection'](_0x5bea2d[_0x2529('0x2d')],qs['fields'](_0x4dd0fb[_0x2529('0x2f')]['fields']));_0x3c46c6['attributes']=_0x3c46c6['attributes'][_0x2529('0x33')]?_0x3c46c6[_0x2529('0x34')]:_0x5bea2d[_0x2529('0x2d')];if(!_0x4dd0fb['query'][_0x2529('0x35')]('nolimit')){_0x3c46c6['limit']=qs['limit'](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1b')]);_0x3c46c6[_0x2529('0x1a')]=qs[_0x2529('0x1a')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1a')]);}_0x3c46c6[_0x2529('0x36')]=qs[_0x2529('0x37')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x37')]);_0x3c46c6[_0x2529('0x38')]=qs[_0x2529('0x31')](_[_0x2529('0x39')](_0x4dd0fb['query'],_0x5bea2d['filters']),_0x1d7e98);if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]){_0x3c46c6['where']=_[_0x2529('0x3b')](_0x3c46c6[_0x2529('0x38')],{'$or':_[_0x2529('0x2e')](_0x1d7e98,function(_0x1b1f81){if(_0x1b1f81[_0x2529('0x2b')]!==_0x2529('0x3c')){var _0x1b8226={};_0x1b8226[_0x1b1f81['name']]={'$like':'%'+_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]+'%'};return _0x1b8226;}})});}_0x3c46c6=_[_0x2529('0x3b')]({},_0x3c46c6,_0x4dd0fb['options']);var _0x1393b7={'where':_0x3c46c6[_0x2529('0x38')]};return db[_0x2529('0x28')][_0x2529('0x1c')](_0x1393b7)[_0x2529('0x21')](function(_0x33acbf){_0x17bcbd[_0x2529('0x1c')]=_0x33acbf;if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3d')]){_0x3c46c6['include']=[{'all':!![]}];}return db[_0x2529('0x28')][_0x2529('0x3e')](_0x3c46c6);})[_0x2529('0x21')](function(_0x3b4e47){_0x17bcbd[_0x2529('0x3f')]=_0x3b4e47;return _0x17bcbd;})[_0x2529('0x21')](respondWithFilteredResult(_0x1822ce,_0x3c46c6))[_0x2529('0x40')](handleError(_0x1822ce,null));};exports['show']=function(_0x8ced2e,_0x33a13e){var _0x3f76e8={'raw':!![],'where':{'id':_0x8ced2e[_0x2529('0x41')]['id']}},_0x2aaecb={};_0x2aaecb['model']=_[_0x2529('0x30')](db[_0x2529('0x28')][_0x2529('0x29')]);_0x2aaecb[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x8ced2e[_0x2529('0x2f')]);_0x2aaecb['filters']=_['intersection'](_0x2aaecb['model'],_0x2aaecb['query']);_0x3f76e8[_0x2529('0x34')]=_['intersection'](_0x2aaecb[_0x2529('0x2d')],qs[_0x2529('0x42')](_0x8ced2e[_0x2529('0x2f')][_0x2529('0x42')]));_0x3f76e8[_0x2529('0x34')]=_0x3f76e8['attributes'][_0x2529('0x33')]?_0x3f76e8['attributes']:_0x2aaecb[_0x2529('0x2d')];if(_0x8ced2e['query'][_0x2529('0x3d')]){_0x3f76e8['include']=[{'all':!![]}];}_0x3f76e8=_[_0x2529('0x3b')]({},_0x3f76e8,_0x8ced2e[_0x2529('0x43')]);return db['Cdr'][_0x2529('0x44')](_0x3f76e8)['then'](handleEntityNotFound(_0x33a13e,null))[_0x2529('0x21')](respondWithResult(_0x33a13e,null))[_0x2529('0x40')](handleError(_0x33a13e,null));};exports[_0x2529('0x45')]=function(_0x3c6d79,_0xdc4bef){return db[_0x2529('0x28')][_0x2529('0x45')](_0x3c6d79[_0x2529('0x46')],{})[_0x2529('0x21')](respondWithResult(_0xdc4bef,0xc9))['catch'](handleError(_0xdc4bef,null));};exports['update']=function(_0x5e72d1,_0x37a23a){if(_0x5e72d1[_0x2529('0x46')]['id']){delete _0x5e72d1[_0x2529('0x46')]['id'];}return db['Cdr']['find']({'where':{'id':_0x5e72d1[_0x2529('0x41')]['id']}})['then'](handleEntityNotFound(_0x37a23a,null))[_0x2529('0x21')](saveUpdates(_0x5e72d1[_0x2529('0x46')],null))[_0x2529('0x21')](respondWithResult(_0x37a23a,null))[_0x2529('0x40')](handleError(_0x37a23a,null));};exports[_0x2529('0x22')]=function(_0x196ee8,_0x4583ba){return db[_0x2529('0x28')]['find']({'where':{'id':_0x196ee8['params']['id']}})[_0x2529('0x21')](handleEntityNotFound(_0x4583ba,null))[_0x2529('0x21')](removeEntity(_0x4583ba,null))[_0x2529('0x40')](handleError(_0x4583ba,null));};exports[_0x2529('0x47')]=function(_0x1f76d3,_0x3ac799){return db[_0x2529('0x28')][_0x2529('0x47')]()[_0x2529('0x21')](respondWithResult(_0x3ac799,null))[_0x2529('0x40')](handleError(_0x3ac799,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index a45d0e5..988c4d7 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(_0x1220c0,_0x5c06f9){var _0x1cc1b7=function(_0x2ab880){while(--_0x2ab880){_0x1220c0['push'](_0x1220c0['shift']());}};_0x1cc1b7(++_0x5c06f9);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x178961,_0x55fce6){var _0x18a2c8=function(_0x3412d4){while(--_0x3412d4){_0x178961['push'](_0x178961['shift']());}};_0x18a2c8(++_0x55fce6);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index ded0adb..f7c008d 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 _0xb5f9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring'];(function(_0x4dc3a4,_0x886144){var _0x45b80c=function(_0x40f6f8){while(--_0x40f6f8){_0x4dc3a4['push'](_0x4dc3a4['shift']());}};_0x45b80c(++_0x886144);}(_0xb5f9,0x13d));var _0x9b5f=function(_0x137092,_0x446f4f){_0x137092=_0x137092-0x0;var _0x4c0917=_0xb5f9[_0x137092];return _0x4c0917;};'use strict';var _=require('lodash');var util=require(_0x9b5f('0x0'));var moment=require(_0x9b5f('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b5f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9b5f('0x3'));var logger=require(_0x9b5f('0x4'))(_0x9b5f('0x5'));var config=require(_0x9b5f('0x6'));var jayson=require(_0x9b5f('0x7'));var client=jayson[_0x9b5f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cdbdf,_0x255352,_0xacf955){return new BPromise(function(_0x5ada19,_0x272249){return client[_0x9b5f('0x9')](_0x4cdbdf,_0xacf955)['then'](function(_0x17d892){logger[_0x9b5f('0xa')](_0x9b5f('0xb'),_0x255352,_0x9b5f('0xc'));logger[_0x9b5f('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x255352,'request\x20sent',JSON[_0x9b5f('0xe')](_0x17d892));if(_0x17d892[_0x9b5f('0xf')]){if(_0x17d892[_0x9b5f('0xf')][_0x9b5f('0x10')]===0x1f4){logger[_0x9b5f('0xf')](_0x9b5f('0xb'),_0x255352,_0x17d892[_0x9b5f('0xf')][_0x9b5f('0x11')]);return _0x272249(_0x17d892[_0x9b5f('0xf')][_0x9b5f('0x11')]);}logger['error'](_0x9b5f('0xb'),_0x255352,_0x17d892[_0x9b5f('0xf')]['message']);return _0x5ada19(_0x17d892[_0x9b5f('0xf')][_0x9b5f('0x11')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x255352,'request\x20sent');_0x5ada19(_0x17d892[_0x9b5f('0x12')][_0x9b5f('0x11')]);}})[_0x9b5f('0x13')](function(_0x1b3f4a){logger[_0x9b5f('0xf')](_0x9b5f('0xb'),_0x255352,_0x1b3f4a);_0x272249(_0x1b3f4a);});});} \ No newline at end of file +var _0x642e=['error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0x642e,0x1be));var _0xe642=function(_0x41376e,_0x1eb56f){_0x41376e=_0x41376e-0x0;var _0x38a918=_0x642e[_0x41376e];return _0x38a918;};'use strict';var _=require(_0xe642('0x0'));var util=require(_0xe642('0x1'));var moment=require(_0xe642('0x2'));var BPromise=require(_0xe642('0x3'));var rs=require(_0xe642('0x4'));var fs=require('fs');var Redis=require(_0xe642('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe642('0x6'))(_0xe642('0x7'));var config=require(_0xe642('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe642('0x9')][_0xe642('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cab94,_0x56c389,_0x1191c3){return new BPromise(function(_0x3a4297,_0x8e3c35){return client['request'](_0x1cab94,_0x1191c3)[_0xe642('0xb')](function(_0x26c22f){logger['info']('Cdr,\x20%s,\x20%s',_0x56c389,'request\x20sent');logger[_0xe642('0xc')](_0xe642('0xd'),_0x56c389,_0xe642('0xe'),JSON[_0xe642('0xf')](_0x26c22f));if(_0x26c22f['error']){if(_0x26c22f[_0xe642('0x10')][_0xe642('0x11')]===0x1f4){logger[_0xe642('0x10')](_0xe642('0x12'),_0x56c389,_0x26c22f[_0xe642('0x10')][_0xe642('0x13')]);return _0x8e3c35(_0x26c22f[_0xe642('0x10')][_0xe642('0x13')]);}logger[_0xe642('0x10')](_0xe642('0x12'),_0x56c389,_0x26c22f[_0xe642('0x10')]['message']);return _0x3a4297(_0x26c22f['error'][_0xe642('0x13')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x56c389,_0xe642('0xe'));_0x3a4297(_0x26c22f[_0xe642('0x14')]['message']);}})[_0xe642('0x15')](function(_0x5edf4a){logger[_0xe642('0x10')]('Cdr,\x20%s,\x20%s',_0x56c389,_0x5edf4a);_0x8e3c35(_0x5edf4a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 40bf504..4749265 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(_0x608e20,_0x2c546d){var _0x5f498a=function(_0x7ee427){while(--_0x7ee427){_0x608e20['push'](_0x608e20['shift']());}};_0x5f498a(++_0x2c546d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x10548e,_0x80eaff){var _0x540aa4=function(_0x277e0e){while(--_0x277e0e){_0x10548e['push'](_0x10548e['shift']());}};_0x540aa4(++_0x80eaff);}(_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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 2205af9..ac42c10 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 _0xfc22=['*,*,*,*','exports','INTEGER','STRING'];(function(_0x9adf1b,_0x3ac695){var _0x960269=function(_0x368ca6){while(--_0x368ca6){_0x9adf1b['push'](_0x9adf1b['shift']());}};_0x960269(++_0x3ac695);}(_0xfc22,0x79));var _0x2fc2=function(_0x40a614,_0x2ac5ee){_0x40a614=_0x40a614-0x0;var _0x40eeac=_0xfc22[_0x40a614];return _0x40eeac;};'use strict';var Sequelize=require('sequelize');module[_0x2fc2('0x0')]={'priority':{'type':Sequelize[_0x2fc2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2fc2('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2fc2('0x2')],'defaultValue':_0x2fc2('0x3')}}; \ No newline at end of file +var _0x9e1b=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0x46d772,_0x485fbc){var _0x1fd083=function(_0x4ff622){while(--_0x4ff622){_0x46d772['push'](_0x46d772['shift']());}};_0x1fd083(++_0x485fbc);}(_0x9e1b,0x196));var _0xb9e1=function(_0x23e567,_0x21e539){_0x23e567=_0x23e567-0x0;var _0x5db05c=_0x9e1b[_0x23e567];return _0x5db05c;};'use strict';var Sequelize=require('sequelize');module[_0xb9e1('0x0')]={'priority':{'type':Sequelize[_0xb9e1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb9e1('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb9e1('0x3')]()},'description':{'type':Sequelize[_0xb9e1('0x2')]},'interval':{'type':Sequelize[_0xb9e1('0x2')],'defaultValue':_0xb9e1('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index a3e95ff..ef53151 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 _0x3e5c=['Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','params','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','include','merge','options','ChatApplication','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x40b54c,_0x19014b){_0x40b54c=_0x40b54c-0x0;var _0x272365=_0x3e5c[_0x40b54c];return _0x272365;};'use strict';var emlformat=require(_0xc3e5('0x0'));var rimraf=require(_0xc3e5('0x1'));var zipdir=require(_0xc3e5('0x2'));var jsonpatch=require(_0xc3e5('0x3'));var rp=require('request-promise');var moment=require(_0xc3e5('0x4'));var BPromise=require(_0xc3e5('0x5'));var Mustache=require(_0xc3e5('0x6'));var util=require(_0xc3e5('0x7'));var path=require(_0xc3e5('0x8'));var sox=require(_0xc3e5('0x9'));var csv=require('to-csv');var ejs=require(_0xc3e5('0xa'));var fs=require('fs');var fs_extra=require(_0xc3e5('0xb'));var _=require(_0xc3e5('0xc'));var squel=require(_0xc3e5('0xd'));var crypto=require(_0xc3e5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3e5('0xf'));var toCsv=require(_0xc3e5('0x10'));var querystring=require(_0xc3e5('0x11'));var Papa=require(_0xc3e5('0x12'));var Redis=require(_0xc3e5('0x13'));var authService=require(_0xc3e5('0x14'));var qs=require(_0xc3e5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3e5('0x16'));var logger=require(_0xc3e5('0x17'))(_0xc3e5('0x18'));var utils=require(_0xc3e5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc3e5('0x1a'));var db=require(_0xc3e5('0x1b'))['db'];function respondWithStatusCode(_0x36193e,_0x3f0395){_0x3f0395=_0x3f0395||0xcc;return function(_0x3b7441){if(_0x3b7441){return _0x36193e[_0xc3e5('0x1c')](_0x3f0395);}return _0x36193e['status'](_0x3f0395)['end']();};}function respondWithResult(_0x52cca7,_0x27c226){_0x27c226=_0x27c226||0xc8;return function(_0x5a52f1){if(_0x5a52f1){return _0x52cca7[_0xc3e5('0x1d')](_0x27c226)[_0xc3e5('0x1e')](_0x5a52f1);}};}function respondWithFilteredResult(_0x4d1ad9,_0x353dc0){return function(_0x3e3eaa){if(_0x3e3eaa){var _0x2cc476=typeof _0x353dc0[_0xc3e5('0x1f')]===_0xc3e5('0x20')&&typeof _0x353dc0['limit']===_0xc3e5('0x20');var _0x277063=_0x3e3eaa[_0xc3e5('0x21')];var _0xa33d84=_0x2cc476?0x0:_0x353dc0[_0xc3e5('0x1f')];var _0x1e1eea=_0x2cc476?_0x3e3eaa['count']:_0x353dc0[_0xc3e5('0x1f')]+_0x353dc0[_0xc3e5('0x22')];var _0x4a1d86;if(_0x1e1eea>=_0x277063){_0x1e1eea=_0x277063;_0x4a1d86=0xc8;}else{_0x4a1d86=0xce;}_0x4d1ad9[_0xc3e5('0x1d')](_0x4a1d86);return _0x4d1ad9['set'](_0xc3e5('0x23'),_0xa33d84+'-'+_0x1e1eea+'/'+_0x277063)[_0xc3e5('0x1e')](_0x3e3eaa);}return null;};}function patchUpdates(_0x2d551b){return function(_0xebf6dc){try{jsonpatch[_0xc3e5('0x24')](_0xebf6dc,_0x2d551b,!![]);}catch(_0x4a7806){return BPromise[_0xc3e5('0x25')](_0x4a7806);}return _0xebf6dc[_0xc3e5('0x26')]();};}function saveUpdates(_0x2d8c6f,_0x3eb513){return function(_0x414ba9){if(_0x414ba9){return _0x414ba9[_0xc3e5('0x27')](_0x2d8c6f)[_0xc3e5('0x28')](function(_0x47f344){return _0x47f344;});}return null;};}function removeEntity(_0x3a2800,_0x430cb4){return function(_0x43d01e){if(_0x43d01e){return _0x43d01e[_0xc3e5('0x29')]()[_0xc3e5('0x28')](function(){_0x3a2800[_0xc3e5('0x1d')](0xcc)[_0xc3e5('0x2a')]();});}};}function handleEntityNotFound(_0x45556e,_0x564748){return function(_0x25d3a3){if(!_0x25d3a3){_0x45556e['sendStatus'](0x194);}return _0x25d3a3;};}function handleError(_0x4c0cf4,_0x8815af){_0x8815af=_0x8815af||0x1f4;return function(_0x12ad6e){logger[_0xc3e5('0x2b')](_0x12ad6e['stack']);if(_0x12ad6e[_0xc3e5('0x2c')]){delete _0x12ad6e[_0xc3e5('0x2c')];}_0x4c0cf4[_0xc3e5('0x1d')](_0x8815af)[_0xc3e5('0x2d')](_0x12ad6e);};}exports['show']=function(_0xa6766d,_0x497ecf){var _0x45ca6d={'raw':!![],'where':{'id':_0xa6766d[_0xc3e5('0x2e')]['id']}},_0xc0e6e7={};_0xc0e6e7['model']=_['keys'](db['ChatApplication'][_0xc3e5('0x2f')]);_0xc0e6e7[_0xc3e5('0x30')]=_[_0xc3e5('0x31')](_0xa6766d[_0xc3e5('0x30')]);_0xc0e6e7[_0xc3e5('0x32')]=_[_0xc3e5('0x33')](_0xc0e6e7['model'],_0xc0e6e7[_0xc3e5('0x30')]);_0x45ca6d[_0xc3e5('0x34')]=_[_0xc3e5('0x33')](_0xc0e6e7[_0xc3e5('0x35')],qs[_0xc3e5('0x36')](_0xa6766d[_0xc3e5('0x30')][_0xc3e5('0x36')]));_0x45ca6d[_0xc3e5('0x34')]=_0x45ca6d[_0xc3e5('0x34')][_0xc3e5('0x37')]?_0x45ca6d[_0xc3e5('0x34')]:_0xc0e6e7['model'];if(_0xa6766d[_0xc3e5('0x30')]['includeAll']){_0x45ca6d[_0xc3e5('0x38')]=[{'all':!![]}];}_0x45ca6d=_[_0xc3e5('0x39')]({},_0x45ca6d,_0xa6766d[_0xc3e5('0x3a')]);return db[_0xc3e5('0x3b')]['find'](_0x45ca6d)[_0xc3e5('0x28')](handleEntityNotFound(_0x497ecf,null))['then'](respondWithResult(_0x497ecf,null))['catch'](handleError(_0x497ecf,null));};exports[_0xc3e5('0x27')]=function(_0x4f6fe1,_0x3c407f){if(_0x4f6fe1[_0xc3e5('0x3c')]['id']){delete _0x4f6fe1[_0xc3e5('0x3c')]['id'];}return db[_0xc3e5('0x3b')][_0xc3e5('0x3d')]({'where':{'id':_0x4f6fe1['params']['id']}})[_0xc3e5('0x28')](handleEntityNotFound(_0x3c407f,null))[_0xc3e5('0x28')](saveUpdates(_0x4f6fe1[_0xc3e5('0x3c')],null))[_0xc3e5('0x28')](respondWithResult(_0x3c407f,null))[_0xc3e5('0x3e')](handleError(_0x3c407f,null));};exports['destroy']=function(_0x3ab3be,_0x484e21){return db[_0xc3e5('0x3b')][_0xc3e5('0x3d')]({'where':{'id':_0x3ab3be['params']['id']}})[_0xc3e5('0x28')](handleEntityNotFound(_0x484e21,null))['then'](removeEntity(_0x484e21,null))[_0xc3e5('0x3e')](handleError(_0x484e21,null));}; \ No newline at end of file +var _0x2083=['destroy','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','attributes','fields','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','update','then'];(function(_0x322590,_0x324ba9){var _0x3b12b3=function(_0x588c92){while(--_0x588c92){_0x322590['push'](_0x322590['shift']());}};_0x3b12b3(++_0x324ba9);}(_0x2083,0x137));var _0x3208=function(_0x5d2a59,_0x1d517b){_0x5d2a59=_0x5d2a59-0x0;var _0x361157=_0x2083[_0x5d2a59];return _0x361157;};'use strict';var emlformat=require(_0x3208('0x0'));var rimraf=require(_0x3208('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3208('0x2'));var rp=require(_0x3208('0x3'));var moment=require(_0x3208('0x4'));var BPromise=require(_0x3208('0x5'));var Mustache=require(_0x3208('0x6'));var util=require(_0x3208('0x7'));var path=require(_0x3208('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3208('0x9'));var _=require(_0x3208('0xa'));var squel=require(_0x3208('0xb'));var crypto=require(_0x3208('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3208('0xd'));var toCsv=require(_0x3208('0xe'));var querystring=require(_0x3208('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3208('0x10'));var qs=require(_0x3208('0x11'));var as=require(_0x3208('0x12'));var hardwareService=require(_0x3208('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3208('0x14'));var config=require(_0x3208('0x15'));var licenseUtil=require(_0x3208('0x16'));var db=require(_0x3208('0x17'))['db'];function respondWithStatusCode(_0x174620,_0x394883){_0x394883=_0x394883||0xcc;return function(_0xf232e5){if(_0xf232e5){return _0x174620[_0x3208('0x18')](_0x394883);}return _0x174620[_0x3208('0x19')](_0x394883)[_0x3208('0x1a')]();};}function respondWithResult(_0x3deca8,_0x14c24f){_0x14c24f=_0x14c24f||0xc8;return function(_0xa5067){if(_0xa5067){return _0x3deca8[_0x3208('0x19')](_0x14c24f)['json'](_0xa5067);}};}function respondWithFilteredResult(_0x2f1eaf,_0x153cf8){return function(_0x41cdcf){if(_0x41cdcf){var _0x1ef359=typeof _0x153cf8[_0x3208('0x1b')]==='undefined'&&typeof _0x153cf8[_0x3208('0x1c')]===_0x3208('0x1d');var _0x4c1e4d=_0x41cdcf[_0x3208('0x1e')];var _0x3590c5=_0x1ef359?0x0:_0x153cf8[_0x3208('0x1b')];var _0x28e291=_0x1ef359?_0x41cdcf[_0x3208('0x1e')]:_0x153cf8[_0x3208('0x1b')]+_0x153cf8['limit'];var _0x3d44bd;if(_0x28e291>=_0x4c1e4d){_0x28e291=_0x4c1e4d;_0x3d44bd=0xc8;}else{_0x3d44bd=0xce;}_0x2f1eaf[_0x3208('0x19')](_0x3d44bd);return _0x2f1eaf[_0x3208('0x1f')](_0x3208('0x20'),_0x3590c5+'-'+_0x28e291+'/'+_0x4c1e4d)[_0x3208('0x21')](_0x41cdcf);}return null;};}function patchUpdates(_0x46b227){return function(_0x468cca){try{jsonpatch['apply'](_0x468cca,_0x46b227,!![]);}catch(_0x42d97a){return BPromise[_0x3208('0x22')](_0x42d97a);}return _0x468cca['save']();};}function saveUpdates(_0x28d665,_0x361d1c){return function(_0x3c6e34){if(_0x3c6e34){return _0x3c6e34[_0x3208('0x23')](_0x28d665)[_0x3208('0x24')](function(_0x2ce30e){return _0x2ce30e;});}return null;};}function removeEntity(_0x4673c2,_0x523d75){return function(_0x54aa98){if(_0x54aa98){return _0x54aa98[_0x3208('0x25')]()[_0x3208('0x24')](function(){_0x4673c2[_0x3208('0x19')](0xcc)[_0x3208('0x1a')]();});}};}function handleEntityNotFound(_0x14e491,_0x21dc00){return function(_0x47a021){if(!_0x47a021){_0x14e491[_0x3208('0x18')](0x194);}return _0x47a021;};}function handleError(_0x125ae3,_0x270c69){_0x270c69=_0x270c69||0x1f4;return function(_0x10e471){logger['error'](_0x10e471[_0x3208('0x26')]);if(_0x10e471[_0x3208('0x27')]){delete _0x10e471[_0x3208('0x27')];}_0x125ae3['status'](_0x270c69)[_0x3208('0x28')](_0x10e471);};}exports[_0x3208('0x29')]=function(_0xf9e10c,_0x22b561){var _0x283193={'raw':!![],'where':{'id':_0xf9e10c[_0x3208('0x2a')]['id']}},_0x2b153f={};_0x2b153f[_0x3208('0x2b')]=_[_0x3208('0x2c')](db[_0x3208('0x2d')][_0x3208('0x2e')]);_0x2b153f[_0x3208('0x2f')]=_[_0x3208('0x2c')](_0xf9e10c[_0x3208('0x2f')]);_0x2b153f['filters']=_['intersection'](_0x2b153f[_0x3208('0x2b')],_0x2b153f[_0x3208('0x2f')]);_0x283193[_0x3208('0x30')]=_['intersection'](_0x2b153f[_0x3208('0x2b')],qs[_0x3208('0x31')](_0xf9e10c['query'][_0x3208('0x31')]));_0x283193[_0x3208('0x30')]=_0x283193[_0x3208('0x30')][_0x3208('0x32')]?_0x283193[_0x3208('0x30')]:_0x2b153f[_0x3208('0x2b')];if(_0xf9e10c[_0x3208('0x2f')][_0x3208('0x33')]){_0x283193[_0x3208('0x34')]=[{'all':!![]}];}_0x283193=_[_0x3208('0x35')]({},_0x283193,_0xf9e10c[_0x3208('0x36')]);return db[_0x3208('0x2d')][_0x3208('0x37')](_0x283193)['then'](handleEntityNotFound(_0x22b561,null))[_0x3208('0x24')](respondWithResult(_0x22b561,null))[_0x3208('0x38')](handleError(_0x22b561,null));};exports['update']=function(_0x93b8cd,_0x17f0f6){if(_0x93b8cd[_0x3208('0x39')]['id']){delete _0x93b8cd[_0x3208('0x39')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x93b8cd[_0x3208('0x2a')]['id']}})['then'](handleEntityNotFound(_0x17f0f6,null))[_0x3208('0x24')](saveUpdates(_0x93b8cd[_0x3208('0x39')],null))[_0x3208('0x24')](respondWithResult(_0x17f0f6,null))[_0x3208('0x38')](handleError(_0x17f0f6,null));};exports[_0x3208('0x25')]=function(_0x1588f4,_0x7544fc){return db[_0x3208('0x2d')][_0x3208('0x37')]({'where':{'id':_0x1588f4['params']['id']}})[_0x3208('0x24')](handleEntityNotFound(_0x7544fc,null))['then'](removeEntity(_0x7544fc,null))[_0x3208('0x38')](handleError(_0x7544fc,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 9f30292..4e370c2 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 _0x12d7=['request-promise','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x12d7,0x181));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x712d('0x0'));var util=require('util');var logger=require(_0x712d('0x1'))(_0x712d('0x2'));var moment=require(_0x712d('0x3'));var BPromise=require(_0x712d('0x4'));var rp=require(_0x712d('0x5'));var fs=require('fs');var path=require(_0x712d('0x6'));var rimraf=require('rimraf');var config=require(_0x712d('0x7'));var attributes=require(_0x712d('0x8'));module[_0x712d('0x9')]=function(_0x2cf71a,_0x498a92){return _0x2cf71a[_0x712d('0xa')](_0x712d('0xb'),attributes,{'tableName':_0x712d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x712d('0xd'),'collate':_0x712d('0xe')});}; \ No newline at end of file +var _0xa678=['exports','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5c9162,_0x3a87bc){var _0x4d427d=function(_0x4c616a){while(--_0x4c616a){_0x5c9162['push'](_0x5c9162['shift']());}};_0x4d427d(++_0x3a87bc);}(_0xa678,0xe1));var _0x8a67=function(_0x41035d,_0x468124){_0x41035d=_0x41035d-0x0;var _0x53d186=_0xa678[_0x41035d];return _0x53d186;};'use strict';var _=require(_0x8a67('0x0'));var util=require(_0x8a67('0x1'));var logger=require(_0x8a67('0x2'))(_0x8a67('0x3'));var moment=require(_0x8a67('0x4'));var BPromise=require(_0x8a67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a67('0x6'));var rimraf=require(_0x8a67('0x7'));var config=require(_0x8a67('0x8'));var attributes=require('./chatApplication.attributes');module[_0x8a67('0x9')]=function(_0x5ba4dd,_0x16c745){return _0x5ba4dd['define']('ChatApplication',attributes,{'tableName':_0x8a67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8a67('0xb'),'collate':_0x8a67('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 57e561e..0e03ef6 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 _0x3a4a=['error','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x27eda0,_0x42a3cf){var _0x2b63a5=function(_0x431084){while(--_0x431084){_0x27eda0['push'](_0x27eda0['shift']());}};_0x2b63a5(++_0x42a3cf);}(_0x3a4a,0x15e));var _0xa3a4=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x3a4a[_0x1a7550];return _0x426e22;};'use strict';var _=require(_0xa3a4('0x0'));var util=require(_0xa3a4('0x1'));var moment=require(_0xa3a4('0x2'));var BPromise=require(_0xa3a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3a4('0x5'));var logger=require(_0xa3a4('0x6'))(_0xa3a4('0x7'));var config=require(_0xa3a4('0x8'));var jayson=require(_0xa3a4('0x9'));var client=jayson[_0xa3a4('0xa')][_0xa3a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d4546,_0x1b145d,_0x6c0f54){return new BPromise(function(_0x22cc83,_0x5d79dc){return client[_0xa3a4('0xc')](_0x3d4546,_0x6c0f54)[_0xa3a4('0xd')](function(_0x1e57dd){logger[_0xa3a4('0xe')]('ChatApplication,\x20%s,\x20%s',_0x1b145d,_0xa3a4('0xf'));logger[_0xa3a4('0x10')](_0xa3a4('0x11'),_0x1b145d,_0xa3a4('0xf'),JSON['stringify'](_0x1e57dd));if(_0x1e57dd[_0xa3a4('0x12')]){if(_0x1e57dd[_0xa3a4('0x12')]['code']===0x1f4){logger[_0xa3a4('0x12')](_0xa3a4('0x13'),_0x1b145d,_0x1e57dd['error']['message']);return _0x5d79dc(_0x1e57dd[_0xa3a4('0x12')][_0xa3a4('0x14')]);}logger[_0xa3a4('0x12')](_0xa3a4('0x13'),_0x1b145d,_0x1e57dd[_0xa3a4('0x12')]['message']);return _0x22cc83(_0x1e57dd['error'][_0xa3a4('0x14')]);}else{logger[_0xa3a4('0xe')]('ChatApplication,\x20%s,\x20%s',_0x1b145d,_0xa3a4('0xf'));_0x22cc83(_0x1e57dd[_0xa3a4('0x15')][_0xa3a4('0x14')]);}})[_0xa3a4('0x16')](function(_0x49be11){logger[_0xa3a4('0x12')](_0xa3a4('0x13'),_0x1b145d,_0x49be11);_0x5d79dc(_0x49be11);});});} \ No newline at end of file +var _0x82b9=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xd05d0e,_0x222ec6){var _0xa812c=function(_0x207028){while(--_0x207028){_0xd05d0e['push'](_0xd05d0e['shift']());}};_0xa812c(++_0x222ec6);}(_0x82b9,0x149));var _0x982b=function(_0x21745c,_0x186f06){_0x21745c=_0x21745c-0x0;var _0x12e0b8=_0x82b9[_0x21745c];return _0x12e0b8;};'use strict';var _=require(_0x982b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x982b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x982b('0x2'));var db=require(_0x982b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x982b('0x4'))(_0x982b('0x5'));var config=require('../../config/environment');var jayson=require(_0x982b('0x6'));var client=jayson[_0x982b('0x7')][_0x982b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x529a26,_0x4006c4,_0x1479d8){return new BPromise(function(_0x3cdf7b,_0x2df147){return client[_0x982b('0x9')](_0x529a26,_0x1479d8)[_0x982b('0xa')](function(_0x5aa8ec){logger[_0x982b('0xb')](_0x982b('0xc'),_0x4006c4,_0x982b('0xd'));logger[_0x982b('0xe')](_0x982b('0xf'),_0x4006c4,_0x982b('0xd'),JSON[_0x982b('0x10')](_0x5aa8ec));if(_0x5aa8ec[_0x982b('0x11')]){if(_0x5aa8ec[_0x982b('0x11')]['code']===0x1f4){logger[_0x982b('0x11')](_0x982b('0xc'),_0x4006c4,_0x5aa8ec['error'][_0x982b('0x12')]);return _0x2df147(_0x5aa8ec[_0x982b('0x11')][_0x982b('0x12')]);}logger[_0x982b('0x11')](_0x982b('0xc'),_0x4006c4,_0x5aa8ec[_0x982b('0x11')][_0x982b('0x12')]);return _0x3cdf7b(_0x5aa8ec[_0x982b('0x11')][_0x982b('0x12')]);}else{logger[_0x982b('0xb')](_0x982b('0xc'),_0x4006c4,'request\x20sent');_0x3cdf7b(_0x5aa8ec['result']['message']);}})[_0x982b('0x13')](function(_0x38b70a){logger[_0x982b('0x11')](_0x982b('0xc'),_0x4006c4,_0x38b70a);_0x2df147(_0x38b70a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 7266147..9ff5bd7 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 _0xdfc2=['connect-timeout','express','fs-extra','../../components/auth/service','./chatApplication.controller','get','/:id','show','update','isAuthenticated','destroy','exports','multer','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdfc2,0xfc));var _0x2dfc=function(_0x321d0b,_0x41fbca){_0x321d0b=_0x321d0b-0x0;var _0x24b79a=_0xdfc2[_0x321d0b];return _0x24b79a;};'use strict';var multer=require(_0x2dfc('0x0'));var util=require(_0x2dfc('0x1'));var path=require(_0x2dfc('0x2'));var timeout=require(_0x2dfc('0x3'));var express=require(_0x2dfc('0x4'));var router=express['Router']();var fs_extra=require(_0x2dfc('0x5'));var auth=require(_0x2dfc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2dfc('0x7'));router[_0x2dfc('0x8')](_0x2dfc('0x9'),auth['isAuthenticated'](),controller[_0x2dfc('0xa')]);router['put'](_0x2dfc('0x9'),auth['isAuthenticated'](),controller[_0x2dfc('0xb')]);router['delete'](_0x2dfc('0x9'),auth[_0x2dfc('0xc')](),controller[_0x2dfc('0xd')]);module[_0x2dfc('0xe')]=router; \ No newline at end of file +var _0xa051=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','/:id','update','destroy','exports','path','connect-timeout','express'];(function(_0xeb6583,_0x7360e0){var _0x326af8=function(_0x3113fd){while(--_0x3113fd){_0xeb6583['push'](_0xeb6583['shift']());}};_0x326af8(++_0x7360e0);}(_0xa051,0xfd));var _0x1a05=function(_0x6c7a8e,_0x1a3ed6){_0x6c7a8e=_0x6c7a8e-0x0;var _0xafab52=_0xa051[_0x6c7a8e];return _0xafab52;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a05('0x0'));var timeout=require(_0x1a05('0x1'));var express=require(_0x1a05('0x2'));var router=express[_0x1a05('0x3')]();var fs_extra=require(_0x1a05('0x4'));var auth=require(_0x1a05('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a05('0x6'));var controller=require(_0x1a05('0x7'));router[_0x1a05('0x8')]('/:id',auth[_0x1a05('0x9')](),controller[_0x1a05('0xa')]);router[_0x1a05('0xb')](_0x1a05('0xc'),auth['isAuthenticated'](),controller[_0x1a05('0xd')]);router['delete'](_0x1a05('0xc'),auth['isAuthenticated'](),controller[_0x1a05('0xe')]);module[_0x1a05('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 08ac495..9191503 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 _0x8786=['sequelize','STRING'];(function(_0x4f4c85,_0x1fba10){var _0x1a189a=function(_0x4c88a1){while(--_0x4c88a1){_0x4f4c85['push'](_0x4f4c85['shift']());}};_0x1a189a(++_0x1fba10);}(_0x8786,0x138));var _0x6878=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8786[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x6878('0x0'));module['exports']={'name':{'type':Sequelize[_0x6878('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6878('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x2087=['sequelize','exports','STRING'];(function(_0x491e30,_0x1579c2){var _0x53f649=function(_0x42cfbc){while(--_0x42cfbc){_0x491e30['push'](_0x491e30['shift']());}};_0x53f649(++_0x1579c2);}(_0x2087,0xf3));var _0x7208=function(_0x2f70d2,_0x49da1c){_0x2f70d2=_0x2f70d2-0x0;var _0x3581d0=_0x2087[_0x2f70d2];return _0x3581d0;};'use strict';var Sequelize=require(_0x7208('0x0'));module[_0x7208('0x1')]={'name':{'type':Sequelize[_0x7208('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7208('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b4d2891..54f4a1c 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 _0xc277=['send','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','show','params','includeAll','find','catch','create','body','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','User','pick','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error'];(function(_0x253c18,_0x405d0a){var _0xe2752b=function(_0xc0c166){while(--_0xc0c166){_0x253c18['push'](_0x253c18['shift']());}};_0xe2752b(++_0x405d0a);}(_0xc277,0x1b9));var _0x7c27=function(_0x4c1f7b,_0x312d83){_0x4c1f7b=_0x4c1f7b-0x0;var _0x1a0ead=_0xc277[_0x4c1f7b];return _0x1a0ead;};'use strict';var emlformat=require(_0x7c27('0x0'));var rimraf=require(_0x7c27('0x1'));var zipdir=require(_0x7c27('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c27('0x3'));var moment=require('moment');var BPromise=require(_0x7c27('0x4'));var Mustache=require(_0x7c27('0x5'));var util=require(_0x7c27('0x6'));var path=require(_0x7c27('0x7'));var sox=require('sox');var csv=require(_0x7c27('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c27('0x9'));var _=require(_0x7c27('0xa'));var squel=require('squel');var crypto=require(_0x7c27('0xb'));var jsforce=require(_0x7c27('0xc'));var deskjs=require(_0x7c27('0xd'));var toCsv=require(_0x7c27('0x8'));var querystring=require('querystring');var Papa=require(_0x7c27('0xe'));var Redis=require('ioredis');var authService=require(_0x7c27('0xf'));var qs=require(_0x7c27('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c27('0x11'));var logger=require(_0x7c27('0x12'))(_0x7c27('0x13'));var utils=require(_0x7c27('0x14'));var config=require(_0x7c27('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7c27('0x16')]=_['defaults'](config[_0x7c27('0x16')],{'host':_0x7c27('0x17'),'port':0x18eb});var socket=require(_0x7c27('0x18'))(new Redis(config[_0x7c27('0x16')]));require(_0x7c27('0x19'))[_0x7c27('0x1a')](socket);function respondWithStatusCode(_0x559e8d,_0x1fcc4c){_0x1fcc4c=_0x1fcc4c||0xcc;return function(_0x53cf31){if(_0x53cf31){return _0x559e8d['sendStatus'](_0x1fcc4c);}return _0x559e8d[_0x7c27('0x1b')](_0x1fcc4c)[_0x7c27('0x1c')]();};}function respondWithResult(_0x4f7e9c,_0x276363){_0x276363=_0x276363||0xc8;return function(_0x492888){if(_0x492888){return _0x4f7e9c[_0x7c27('0x1b')](_0x276363)[_0x7c27('0x1d')](_0x492888);}};}function respondWithFilteredResult(_0x2dd073,_0x5d41c3){return function(_0x5f7eda){if(_0x5f7eda){var _0x454ea9=typeof _0x5d41c3[_0x7c27('0x1e')]==='undefined'&&typeof _0x5d41c3[_0x7c27('0x1f')]===_0x7c27('0x20');var _0xd9a4e9=_0x5f7eda['count'];var _0x29e33c=_0x454ea9?0x0:_0x5d41c3['offset'];var _0x2f9943=_0x454ea9?_0x5f7eda[_0x7c27('0x21')]:_0x5d41c3[_0x7c27('0x1e')]+_0x5d41c3[_0x7c27('0x1f')];var _0x3dcd37;if(_0x2f9943>=_0xd9a4e9){_0x2f9943=_0xd9a4e9;_0x3dcd37=0xc8;}else{_0x3dcd37=0xce;}_0x2dd073[_0x7c27('0x1b')](_0x3dcd37);return _0x2dd073[_0x7c27('0x22')](_0x7c27('0x23'),_0x29e33c+'-'+_0x2f9943+'/'+_0xd9a4e9)['json'](_0x5f7eda);}return null;};}function patchUpdates(_0x1feef8){return function(_0x41f9cc){try{jsonpatch[_0x7c27('0x24')](_0x41f9cc,_0x1feef8,!![]);}catch(_0x5c5bc9){return BPromise[_0x7c27('0x25')](_0x5c5bc9);}return _0x41f9cc[_0x7c27('0x26')]();};}function saveUpdates(_0x3bf5c5,_0x56955a){return function(_0x5651ea){if(_0x5651ea){return _0x5651ea[_0x7c27('0x27')](_0x3bf5c5)[_0x7c27('0x28')](function(_0x1ede25){return _0x1ede25;});}return null;};}function removeEntity(_0x1d8b03,_0x37d215){return function(_0x5bbde0){if(_0x5bbde0){return _0x5bbde0[_0x7c27('0x29')]()['then'](function(){_0x1d8b03[_0x7c27('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x298d7a,_0x219935){return function(_0x19c452){if(!_0x19c452){_0x298d7a[_0x7c27('0x2a')](0x194);}return _0x19c452;};}function handleError(_0x509825,_0x5eb260){_0x5eb260=_0x5eb260||0x1f4;return function(_0x24d0d9){logger[_0x7c27('0x2b')](_0x24d0d9['stack']);if(_0x24d0d9['name']){delete _0x24d0d9['name'];}_0x509825[_0x7c27('0x1b')](_0x5eb260)[_0x7c27('0x2c')](_0x24d0d9);};}exports[_0x7c27('0x2d')]=function(_0x5f1d02,_0x9b7e3f){var _0x5941a0={},_0x126143={},_0x25ca1e={'count':0x0,'rows':[]};var _0x37dc5f=_['map'](db[_0x7c27('0x2e')][_0x7c27('0x2f')],function(_0x2a88ca){return{'name':_0x2a88ca[_0x7c27('0x30')],'type':_0x2a88ca[_0x7c27('0x31')][_0x7c27('0x32')]};});_0x126143[_0x7c27('0x33')]=_[_0x7c27('0x34')](_0x37dc5f,_0x7c27('0x35'));_0x126143[_0x7c27('0x36')]=_[_0x7c27('0x37')](_0x5f1d02[_0x7c27('0x36')]);_0x126143[_0x7c27('0x38')]=_[_0x7c27('0x39')](_0x126143[_0x7c27('0x33')],_0x126143[_0x7c27('0x36')]);_0x5941a0['attributes']=_[_0x7c27('0x39')](_0x126143['model'],qs[_0x7c27('0x3a')](_0x5f1d02[_0x7c27('0x36')][_0x7c27('0x3a')]));_0x5941a0[_0x7c27('0x3b')]=_0x5941a0[_0x7c27('0x3b')][_0x7c27('0x3c')]?_0x5941a0[_0x7c27('0x3b')]:_0x126143[_0x7c27('0x33')];if(!_0x5f1d02['query']['hasOwnProperty'](_0x7c27('0x3d'))){_0x5941a0[_0x7c27('0x1f')]=qs[_0x7c27('0x1f')](_0x5f1d02['query'][_0x7c27('0x1f')]);_0x5941a0[_0x7c27('0x1e')]=qs['offset'](_0x5f1d02[_0x7c27('0x36')]['offset']);}_0x5941a0[_0x7c27('0x3e')]=qs[_0x7c27('0x3f')](_0x5f1d02[_0x7c27('0x36')][_0x7c27('0x3f')]);_0x5941a0[_0x7c27('0x40')]=qs[_0x7c27('0x38')](_['pick'](_0x5f1d02[_0x7c27('0x36')],_0x126143[_0x7c27('0x38')]),_0x37dc5f);if(_0x5f1d02[_0x7c27('0x36')][_0x7c27('0x41')]){_0x5941a0['where']=_[_0x7c27('0x42')](_0x5941a0[_0x7c27('0x40')],{'$or':_[_0x7c27('0x34')](_0x37dc5f,function(_0x143e74){if(_0x143e74[_0x7c27('0x31')]!==_0x7c27('0x43')){var _0x4982fe={};_0x4982fe[_0x143e74[_0x7c27('0x35')]]={'$like':'%'+_0x5f1d02['query'][_0x7c27('0x41')]+'%'};return _0x4982fe;}})});}_0x5941a0=_[_0x7c27('0x42')]({},_0x5941a0,_0x5f1d02[_0x7c27('0x44')]);var _0x217e05={'where':_0x5941a0[_0x7c27('0x40')]};return db[_0x7c27('0x2e')][_0x7c27('0x21')](_0x217e05)[_0x7c27('0x28')](function(_0x37ac66){_0x25ca1e[_0x7c27('0x21')]=_0x37ac66;if(_0x5f1d02[_0x7c27('0x36')]['includeAll']){_0x5941a0['include']=[{'all':!![]}];}return db[_0x7c27('0x2e')]['findAll'](_0x5941a0);})['then'](function(_0x3885bc){_0x25ca1e[_0x7c27('0x45')]=_0x3885bc;return _0x25ca1e;})[_0x7c27('0x28')](respondWithFilteredResult(_0x9b7e3f,_0x5941a0))['catch'](handleError(_0x9b7e3f,null));};exports[_0x7c27('0x46')]=function(_0x1a1a79,_0x589fd4){var _0x41cac6={'raw':!![],'where':{'id':_0x1a1a79[_0x7c27('0x47')]['id']}},_0x3528fe={};_0x3528fe[_0x7c27('0x33')]=_[_0x7c27('0x37')](db['ChatGroup'][_0x7c27('0x2f')]);_0x3528fe['query']=_['keys'](_0x1a1a79[_0x7c27('0x36')]);_0x3528fe['filters']=_[_0x7c27('0x39')](_0x3528fe[_0x7c27('0x33')],_0x3528fe[_0x7c27('0x36')]);_0x41cac6[_0x7c27('0x3b')]=_['intersection'](_0x3528fe[_0x7c27('0x33')],qs['fields'](_0x1a1a79[_0x7c27('0x36')][_0x7c27('0x3a')]));_0x41cac6['attributes']=_0x41cac6['attributes'][_0x7c27('0x3c')]?_0x41cac6[_0x7c27('0x3b')]:_0x3528fe['model'];if(_0x1a1a79[_0x7c27('0x36')][_0x7c27('0x48')]){_0x41cac6['include']=[{'all':!![]}];}_0x41cac6=_[_0x7c27('0x42')]({},_0x41cac6,_0x1a1a79[_0x7c27('0x44')]);return db[_0x7c27('0x2e')][_0x7c27('0x49')](_0x41cac6)[_0x7c27('0x28')](handleEntityNotFound(_0x589fd4,null))[_0x7c27('0x28')](respondWithResult(_0x589fd4,null))[_0x7c27('0x4a')](handleError(_0x589fd4,null));};exports['create']=function(_0x111117,_0x4cbe47){return db['ChatGroup'][_0x7c27('0x4b')](_0x111117[_0x7c27('0x4c')],{})[_0x7c27('0x28')](respondWithResult(_0x4cbe47,0xc9))['catch'](handleError(_0x4cbe47,null));};exports[_0x7c27('0x27')]=function(_0x462c48,_0x16e150){if(_0x462c48[_0x7c27('0x4c')]['id']){delete _0x462c48[_0x7c27('0x4c')]['id'];}return db[_0x7c27('0x2e')][_0x7c27('0x49')]({'where':{'id':_0x462c48[_0x7c27('0x47')]['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0x16e150,null))[_0x7c27('0x28')](saveUpdates(_0x462c48[_0x7c27('0x4c')],null))[_0x7c27('0x28')](respondWithResult(_0x16e150,null))['catch'](handleError(_0x16e150,null));};exports['destroy']=function(_0x2a3299,_0xa5ebfd){return db['ChatGroup'][_0x7c27('0x49')]({'where':{'id':_0x2a3299['params']['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0xa5ebfd,null))['then'](removeEntity(_0xa5ebfd,null))[_0x7c27('0x4a')](handleError(_0xa5ebfd,null));};exports['describe']=function(_0x1ab399,_0x4105b1){return db[_0x7c27('0x2e')]['describe']()[_0x7c27('0x28')](respondWithResult(_0x4105b1,null))[_0x7c27('0x4a')](handleError(_0x4105b1,null));};exports[_0x7c27('0x4d')]=function(_0x48b66d,_0x4a9424,_0x43651d){return db[_0x7c27('0x4e')][_0x7c27('0x21')]({'where':{'ChatGroupId':_0x48b66d[_0x7c27('0x47')]['id'],'ToId':_0x48b66d[_0x7c27('0x4f')]['id'],'read':![]}})['then'](function(_0x4ec4c3){return{'id':_[_0x7c27('0x50')](_0x48b66d[_0x7c27('0x47')]['id']),'count':_0x4ec4c3};})[_0x7c27('0x28')](respondWithResult(_0x4a9424,null))[_0x7c27('0x4a')](handleError(_0x4a9424,null));};exports[_0x7c27('0x51')]=function(_0xbeecac,_0x18dd50,_0x165910){return db[_0x7c27('0x2e')][_0x7c27('0x49')]({'where':{'id':_0xbeecac[_0x7c27('0x47')]['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0x18dd50,null))[_0x7c27('0x28')](function(_0x55e65a){if(_0x55e65a){return _0x55e65a[_0x7c27('0x51')](_0xbeecac[_0x7c27('0x4c')]['ids'],_[_0x7c27('0x52')](_0xbeecac[_0x7c27('0x4c')],[_0x7c27('0x53'),'id'])||{});}})[_0x7c27('0x28')](respondWithResult(_0x18dd50,null))[_0x7c27('0x4a')](handleError(_0x18dd50,null));};exports[_0x7c27('0x54')]=function(_0xcebf5b,_0x552a2d,_0x37c8c6){var _0x1ef71b={};var _0x5c2624={};var _0x40f43e;var _0x269541;return db[_0x7c27('0x2e')]['findOne']({'where':{'id':_0xcebf5b['params']['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0x552a2d,null))[_0x7c27('0x28')](function(_0x26201c){if(_0x26201c){_0x40f43e=_0x26201c;_0x5c2624['model']=_[_0x7c27('0x37')](db[_0x7c27('0x55')][_0x7c27('0x2f')]);_0x5c2624[_0x7c27('0x36')]=_[_0x7c27('0x37')](_0xcebf5b[_0x7c27('0x36')]);_0x5c2624['filters']=_['intersection'](_0x5c2624[_0x7c27('0x33')],_0x5c2624['query']);_0x1ef71b[_0x7c27('0x3b')]=_[_0x7c27('0x39')](_0x5c2624[_0x7c27('0x33')],qs['fields'](_0xcebf5b[_0x7c27('0x36')][_0x7c27('0x3a')]));_0x1ef71b['attributes']=_0x1ef71b[_0x7c27('0x3b')][_0x7c27('0x3c')]?_0x1ef71b[_0x7c27('0x3b')]:_0x5c2624[_0x7c27('0x33')];_0x1ef71b['order']=qs['sort'](_0xcebf5b['query'][_0x7c27('0x3f')]);_0x1ef71b['where']=qs['filters'](_[_0x7c27('0x56')](_0xcebf5b['query'],_0x5c2624[_0x7c27('0x38')]));if(_0xcebf5b['query'][_0x7c27('0x41')]){_0x1ef71b[_0x7c27('0x40')]=_[_0x7c27('0x42')](_0x1ef71b[_0x7c27('0x40')],{'$or':_[_0x7c27('0x34')](_0x1ef71b[_0x7c27('0x3b')],function(_0x108f98){var _0x203df2={};_0x203df2[_0x108f98]={'$like':'%'+_0xcebf5b[_0x7c27('0x36')][_0x7c27('0x41')]+'%'};return _0x203df2;})});}_0x1ef71b=_['merge']({},_0x1ef71b,_0xcebf5b['options']);return _0x40f43e[_0x7c27('0x54')](_0x1ef71b);}})[_0x7c27('0x28')](function(_0x47c4b0){if(_0x47c4b0){_0x269541=_0x47c4b0[_0x7c27('0x3c')];if(!_0xcebf5b[_0x7c27('0x36')][_0x7c27('0x57')](_0x7c27('0x3d'))){_0x1ef71b[_0x7c27('0x1f')]=qs[_0x7c27('0x1f')](_0xcebf5b[_0x7c27('0x36')][_0x7c27('0x1f')]);_0x1ef71b[_0x7c27('0x1e')]=qs['offset'](_0xcebf5b['query'][_0x7c27('0x1e')]);}return _0x40f43e[_0x7c27('0x54')](_0x1ef71b);}})[_0x7c27('0x28')](function(_0x22d718){if(_0x22d718){return _0x22d718?{'count':_0x269541,'rows':_0x22d718}:null;}})[_0x7c27('0x28')](respondWithResult(_0x552a2d,null))['catch'](handleError(_0x552a2d,null));};exports[_0x7c27('0x58')]=function(_0x17a50f,_0x1c9f62,_0x423134){return db[_0x7c27('0x2e')][_0x7c27('0x49')]({'where':{'id':_0x17a50f[_0x7c27('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c9f62,null))[_0x7c27('0x28')](function(_0x11b120){if(_0x11b120){return _0x11b120[_0x7c27('0x58')](_0x17a50f[_0x7c27('0x36')][_0x7c27('0x53')]);}})['then'](respondWithStatusCode(_0x1c9f62,null))[_0x7c27('0x4a')](handleError(_0x1c9f62,null));};exports[_0x7c27('0x59')]=function(_0x3fe3ea,_0x10e081,_0x3921b3){if(_0x3fe3ea[_0x7c27('0x4c')]['id']){delete _0x3fe3ea[_0x7c27('0x4c')]['id'];}return db[_0x7c27('0x2e')]['find']({'where':{'id':_0x3fe3ea[_0x7c27('0x47')]['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0x10e081,null))[_0x7c27('0x28')](function(_0x2c6c60){if(_0x2c6c60){_0x3fe3ea[_0x7c27('0x4c')][_0x7c27('0x5a')]=_0x2c6c60['id'];return db[_0x7c27('0x4e')][_0x7c27('0x4b')](_0x3fe3ea[_0x7c27('0x4c')]);}})[_0x7c27('0x28')](respondWithResult(_0x10e081,null))[_0x7c27('0x4a')](handleError(_0x10e081,null));};exports[_0x7c27('0x5b')]=function(_0x16c65c,_0x15d3dd,_0x50b147){var _0x56aa6c={};var _0xfcc6fa={};var _0x38c786;var _0x2e5827;return db['ChatGroup'][_0x7c27('0x5c')]({'where':{'id':_0x16c65c[_0x7c27('0x47')]['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0x15d3dd,null))[_0x7c27('0x28')](function(_0x4ab432){if(_0x4ab432){_0x38c786=_0x4ab432;_0xfcc6fa[_0x7c27('0x33')]=_[_0x7c27('0x37')](db['ChatInternalMessage'][_0x7c27('0x2f')]);_0xfcc6fa['query']=_[_0x7c27('0x37')](_0x16c65c[_0x7c27('0x36')]);_0xfcc6fa[_0x7c27('0x38')]=_[_0x7c27('0x39')](_0xfcc6fa[_0x7c27('0x33')],_0xfcc6fa['query']);_0x56aa6c[_0x7c27('0x3b')]=_[_0x7c27('0x39')](_0xfcc6fa[_0x7c27('0x33')],qs[_0x7c27('0x3a')](_0x16c65c[_0x7c27('0x36')][_0x7c27('0x3a')]));_0x56aa6c[_0x7c27('0x3b')]=_0x56aa6c[_0x7c27('0x3b')][_0x7c27('0x3c')]?_0x56aa6c['attributes']:_0xfcc6fa['model'];_0x56aa6c['order']=qs['sort'](_0x16c65c['query'][_0x7c27('0x3f')]);_0x56aa6c[_0x7c27('0x40')]=qs[_0x7c27('0x38')](_['pick'](_0x16c65c['query'],_0xfcc6fa['filters']));if(_0x16c65c['query']['filter']){_0x56aa6c['where']=_[_0x7c27('0x42')](_0x56aa6c['where'],{'$or':_[_0x7c27('0x34')](_0x56aa6c['attributes'],function(_0x263e36){var _0x437f27={};_0x437f27[_0x263e36]={'$like':'%'+_0x16c65c[_0x7c27('0x36')][_0x7c27('0x41')]+'%'};return _0x437f27;})});}if(_0x16c65c[_0x7c27('0x36')][_0x7c27('0x5d')]){var _0x6ed7f5=_0x16c65c[_0x7c27('0x36')][_0x7c27('0x5d')][_0x7c27('0x5e')](',');var _0x3bc2bd={};_0x3bc2bd[_0x6ed7f5[0x0]]={'$gte':moment(_0x6ed7f5[0x1])[_0x7c27('0x5f')](_0x7c27('0x60'))};_0x56aa6c[_0x7c27('0x40')]=_[_0x7c27('0x42')](_0x56aa6c[_0x7c27('0x40')],_0x3bc2bd);}_0x56aa6c=_[_0x7c27('0x42')]({},_0x56aa6c,_0x16c65c[_0x7c27('0x44')]);return _0x38c786['getMessages'](_0x56aa6c);}})[_0x7c27('0x28')](function(_0x43eeec){if(_0x43eeec){_0x2e5827=_0x43eeec[_0x7c27('0x3c')];if(!_0x16c65c[_0x7c27('0x36')]['hasOwnProperty']('nolimit')){_0x56aa6c[_0x7c27('0x1f')]=qs[_0x7c27('0x1f')](_0x16c65c[_0x7c27('0x36')][_0x7c27('0x1f')]);_0x56aa6c[_0x7c27('0x1e')]=qs[_0x7c27('0x1e')](_0x16c65c[_0x7c27('0x36')][_0x7c27('0x1e')]);}return _0x38c786[_0x7c27('0x5b')](_0x56aa6c);}})[_0x7c27('0x28')](function(_0x9a6299){if(_0x9a6299){return _0x9a6299?{'count':_0x2e5827,'rows':_0x9a6299}:null;}})[_0x7c27('0x28')](respondWithResult(_0x15d3dd,null))[_0x7c27('0x4a')](handleError(_0x15d3dd,null));}; \ No newline at end of file +var _0xa7ee=['mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ChatGroup','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','filters','find','create','body','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','rawAttributes','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','hasOwnProperty','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x3fbe46,_0x12a0d1){var _0x27c406=function(_0x4a1020){while(--_0x4a1020){_0x3fbe46['push'](_0x3fbe46['shift']());}};_0x27c406(++_0x12a0d1);}(_0xa7ee,0xb7));var _0xea7e=function(_0x1546c2,_0x22e822){_0x1546c2=_0x1546c2-0x0;var _0x24583c=_0xa7ee[_0x1546c2];return _0x24583c;};'use strict';var emlformat=require(_0xea7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea7e('0x2'));var moment=require(_0xea7e('0x3'));var BPromise=require(_0xea7e('0x4'));var Mustache=require(_0xea7e('0x5'));var util=require('util');var path=require(_0xea7e('0x6'));var sox=require('sox');var csv=require(_0xea7e('0x7'));var ejs=require(_0xea7e('0x8'));var fs=require('fs');var fs_extra=require(_0xea7e('0x9'));var _=require(_0xea7e('0xa'));var squel=require(_0xea7e('0xb'));var crypto=require(_0xea7e('0xc'));var jsforce=require(_0xea7e('0xd'));var deskjs=require(_0xea7e('0xe'));var toCsv=require(_0xea7e('0x7'));var querystring=require('querystring');var Papa=require(_0xea7e('0xf'));var Redis=require(_0xea7e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xea7e('0x11'));var as=require(_0xea7e('0x12'));var hardwareService=require(_0xea7e('0x13'));var logger=require('../../config/logger')(_0xea7e('0x14'));var utils=require(_0xea7e('0x15'));var config=require(_0xea7e('0x16'));var licenseUtil=require(_0xea7e('0x17'));var db=require('../../mysqldb')['db'];config[_0xea7e('0x18')]=_[_0xea7e('0x19')](config[_0xea7e('0x18')],{'host':_0xea7e('0x1a'),'port':0x18eb});var socket=require(_0xea7e('0x1b'))(new Redis(config[_0xea7e('0x18')]));require(_0xea7e('0x1c'))['register'](socket);function respondWithStatusCode(_0x269418,_0xbfebb0){_0xbfebb0=_0xbfebb0||0xcc;return function(_0x4881e0){if(_0x4881e0){return _0x269418['sendStatus'](_0xbfebb0);}return _0x269418[_0xea7e('0x1d')](_0xbfebb0)[_0xea7e('0x1e')]();};}function respondWithResult(_0x14fea9,_0x5b2661){_0x5b2661=_0x5b2661||0xc8;return function(_0x27fc7a){if(_0x27fc7a){return _0x14fea9[_0xea7e('0x1d')](_0x5b2661)['json'](_0x27fc7a);}};}function respondWithFilteredResult(_0xe9e38b,_0xb2da33){return function(_0x4ea52b){if(_0x4ea52b){var _0x2f3207=typeof _0xb2da33[_0xea7e('0x1f')]===_0xea7e('0x20')&&typeof _0xb2da33['limit']==='undefined';var _0x257c35=_0x4ea52b[_0xea7e('0x21')];var _0x21334d=_0x2f3207?0x0:_0xb2da33[_0xea7e('0x1f')];var _0xa0e5b0=_0x2f3207?_0x4ea52b[_0xea7e('0x21')]:_0xb2da33[_0xea7e('0x1f')]+_0xb2da33[_0xea7e('0x22')];var _0x5ddf7e;if(_0xa0e5b0>=_0x257c35){_0xa0e5b0=_0x257c35;_0x5ddf7e=0xc8;}else{_0x5ddf7e=0xce;}_0xe9e38b[_0xea7e('0x1d')](_0x5ddf7e);return _0xe9e38b[_0xea7e('0x23')](_0xea7e('0x24'),_0x21334d+'-'+_0xa0e5b0+'/'+_0x257c35)[_0xea7e('0x25')](_0x4ea52b);}return null;};}function patchUpdates(_0x44bf8b){return function(_0x105edb){try{jsonpatch[_0xea7e('0x26')](_0x105edb,_0x44bf8b,!![]);}catch(_0x43b2b9){return BPromise[_0xea7e('0x27')](_0x43b2b9);}return _0x105edb[_0xea7e('0x28')]();};}function saveUpdates(_0x330754,_0x39bba8){return function(_0x2e4ac9){if(_0x2e4ac9){return _0x2e4ac9[_0xea7e('0x29')](_0x330754)[_0xea7e('0x2a')](function(_0x284d6b){return _0x284d6b;});}return null;};}function removeEntity(_0x371a68,_0x409c34){return function(_0x2ec42f){if(_0x2ec42f){return _0x2ec42f[_0xea7e('0x2b')]()[_0xea7e('0x2a')](function(){_0x371a68[_0xea7e('0x1d')](0xcc)[_0xea7e('0x1e')]();});}};}function handleEntityNotFound(_0x8bf0d6,_0x5104d1){return function(_0x3405a7){if(!_0x3405a7){_0x8bf0d6[_0xea7e('0x2c')](0x194);}return _0x3405a7;};}function handleError(_0xf5d8,_0x420b7e){_0x420b7e=_0x420b7e||0x1f4;return function(_0x17c212){logger[_0xea7e('0x2d')](_0x17c212[_0xea7e('0x2e')]);if(_0x17c212[_0xea7e('0x2f')]){delete _0x17c212[_0xea7e('0x2f')];}_0xf5d8[_0xea7e('0x1d')](_0x420b7e)[_0xea7e('0x30')](_0x17c212);};}exports['index']=function(_0x25974b,_0x2ad0b3){var _0x12f4e0={},_0x3214ec={},_0x123e23={'count':0x0,'rows':[]};var _0x1a54ac=_[_0xea7e('0x31')](db[_0xea7e('0x32')]['rawAttributes'],function(_0x30ec98){return{'name':_0x30ec98[_0xea7e('0x33')],'type':_0x30ec98[_0xea7e('0x34')][_0xea7e('0x35')]};});_0x3214ec[_0xea7e('0x36')]=_['map'](_0x1a54ac,_0xea7e('0x2f'));_0x3214ec['query']=_[_0xea7e('0x37')](_0x25974b['query']);_0x3214ec['filters']=_[_0xea7e('0x38')](_0x3214ec[_0xea7e('0x36')],_0x3214ec[_0xea7e('0x39')]);_0x12f4e0[_0xea7e('0x3a')]=_['intersection'](_0x3214ec[_0xea7e('0x36')],qs[_0xea7e('0x3b')](_0x25974b[_0xea7e('0x39')][_0xea7e('0x3b')]));_0x12f4e0[_0xea7e('0x3a')]=_0x12f4e0['attributes'][_0xea7e('0x3c')]?_0x12f4e0[_0xea7e('0x3a')]:_0x3214ec[_0xea7e('0x36')];if(!_0x25974b['query']['hasOwnProperty'](_0xea7e('0x3d'))){_0x12f4e0[_0xea7e('0x22')]=qs[_0xea7e('0x22')](_0x25974b['query'][_0xea7e('0x22')]);_0x12f4e0['offset']=qs[_0xea7e('0x1f')](_0x25974b['query'][_0xea7e('0x1f')]);}_0x12f4e0[_0xea7e('0x3e')]=qs[_0xea7e('0x3f')](_0x25974b['query'][_0xea7e('0x3f')]);_0x12f4e0[_0xea7e('0x40')]=qs['filters'](_[_0xea7e('0x41')](_0x25974b[_0xea7e('0x39')],_0x3214ec['filters']),_0x1a54ac);if(_0x25974b['query']['filter']){_0x12f4e0[_0xea7e('0x40')]=_[_0xea7e('0x42')](_0x12f4e0[_0xea7e('0x40')],{'$or':_[_0xea7e('0x31')](_0x1a54ac,function(_0x432fe2){if(_0x432fe2['type']!=='VIRTUAL'){var _0x52ffff={};_0x52ffff[_0x432fe2['name']]={'$like':'%'+_0x25974b[_0xea7e('0x39')][_0xea7e('0x43')]+'%'};return _0x52ffff;}})});}_0x12f4e0=_['merge']({},_0x12f4e0,_0x25974b[_0xea7e('0x44')]);var _0x31ca22={'where':_0x12f4e0[_0xea7e('0x40')]};return db[_0xea7e('0x32')][_0xea7e('0x21')](_0x31ca22)[_0xea7e('0x2a')](function(_0x306803){_0x123e23[_0xea7e('0x21')]=_0x306803;if(_0x25974b[_0xea7e('0x39')][_0xea7e('0x45')]){_0x12f4e0[_0xea7e('0x46')]=[{'all':!![]}];}return db[_0xea7e('0x32')]['findAll'](_0x12f4e0);})[_0xea7e('0x2a')](function(_0x203b13){_0x123e23[_0xea7e('0x47')]=_0x203b13;return _0x123e23;})['then'](respondWithFilteredResult(_0x2ad0b3,_0x12f4e0))[_0xea7e('0x48')](handleError(_0x2ad0b3,null));};exports[_0xea7e('0x49')]=function(_0x5120d3,_0x3e10d9){var _0x193e9a={'raw':!![],'where':{'id':_0x5120d3[_0xea7e('0x4a')]['id']}},_0x4990dc={};_0x4990dc[_0xea7e('0x36')]=_[_0xea7e('0x37')](db[_0xea7e('0x32')]['rawAttributes']);_0x4990dc[_0xea7e('0x39')]=_['keys'](_0x5120d3[_0xea7e('0x39')]);_0x4990dc[_0xea7e('0x4b')]=_[_0xea7e('0x38')](_0x4990dc[_0xea7e('0x36')],_0x4990dc[_0xea7e('0x39')]);_0x193e9a[_0xea7e('0x3a')]=_[_0xea7e('0x38')](_0x4990dc['model'],qs[_0xea7e('0x3b')](_0x5120d3[_0xea7e('0x39')]['fields']));_0x193e9a[_0xea7e('0x3a')]=_0x193e9a[_0xea7e('0x3a')][_0xea7e('0x3c')]?_0x193e9a[_0xea7e('0x3a')]:_0x4990dc['model'];if(_0x5120d3[_0xea7e('0x39')][_0xea7e('0x45')]){_0x193e9a[_0xea7e('0x46')]=[{'all':!![]}];}_0x193e9a=_['merge']({},_0x193e9a,_0x5120d3[_0xea7e('0x44')]);return db[_0xea7e('0x32')][_0xea7e('0x4c')](_0x193e9a)[_0xea7e('0x2a')](handleEntityNotFound(_0x3e10d9,null))['then'](respondWithResult(_0x3e10d9,null))[_0xea7e('0x48')](handleError(_0x3e10d9,null));};exports['create']=function(_0x74ff2d,_0x4cdbb8){return db[_0xea7e('0x32')][_0xea7e('0x4d')](_0x74ff2d[_0xea7e('0x4e')],{})[_0xea7e('0x2a')](respondWithResult(_0x4cdbb8,0xc9))[_0xea7e('0x48')](handleError(_0x4cdbb8,null));};exports[_0xea7e('0x29')]=function(_0x1c786c,_0x4f1693){if(_0x1c786c[_0xea7e('0x4e')]['id']){delete _0x1c786c[_0xea7e('0x4e')]['id'];}return db[_0xea7e('0x32')][_0xea7e('0x4c')]({'where':{'id':_0x1c786c[_0xea7e('0x4a')]['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x4f1693,null))[_0xea7e('0x2a')](saveUpdates(_0x1c786c[_0xea7e('0x4e')],null))[_0xea7e('0x2a')](respondWithResult(_0x4f1693,null))[_0xea7e('0x48')](handleError(_0x4f1693,null));};exports[_0xea7e('0x2b')]=function(_0x9465bf,_0x1f6fe1){return db['ChatGroup'][_0xea7e('0x4c')]({'where':{'id':_0x9465bf[_0xea7e('0x4a')]['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x1f6fe1,null))[_0xea7e('0x2a')](removeEntity(_0x1f6fe1,null))[_0xea7e('0x48')](handleError(_0x1f6fe1,null));};exports['describe']=function(_0x266f4e,_0x551976){return db[_0xea7e('0x32')]['describe']()[_0xea7e('0x2a')](respondWithResult(_0x551976,null))[_0xea7e('0x48')](handleError(_0x551976,null));};exports['getUnread']=function(_0x3ed578,_0x5a0f35,_0x161b55){return db[_0xea7e('0x4f')][_0xea7e('0x21')]({'where':{'ChatGroupId':_0x3ed578[_0xea7e('0x4a')]['id'],'ToId':_0x3ed578['user']['id'],'read':![]}})[_0xea7e('0x2a')](function(_0x44c68b){return{'id':_[_0xea7e('0x50')](_0x3ed578['params']['id']),'count':_0x44c68b};})[_0xea7e('0x2a')](respondWithResult(_0x5a0f35,null))[_0xea7e('0x48')](handleError(_0x5a0f35,null));};exports['addMembers']=function(_0x4e1ebd,_0x15eca1,_0x12e767){return db[_0xea7e('0x32')][_0xea7e('0x4c')]({'where':{'id':_0x4e1ebd[_0xea7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x15eca1,null))['then'](function(_0x1ded86){if(_0x1ded86){return _0x1ded86[_0xea7e('0x51')](_0x4e1ebd[_0xea7e('0x4e')]['ids'],_['omit'](_0x4e1ebd[_0xea7e('0x4e')],[_0xea7e('0x52'),'id'])||{});}})['then'](respondWithResult(_0x15eca1,null))['catch'](handleError(_0x15eca1,null));};exports[_0xea7e('0x53')]=function(_0x58303e,_0x3614bb,_0x104fb6){var _0x3cd0a9={};var _0x1a228a={};var _0x5ed490;var _0x4863b3;return db[_0xea7e('0x32')][_0xea7e('0x54')]({'where':{'id':_0x58303e['params']['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x3614bb,null))['then'](function(_0x136313){if(_0x136313){_0x5ed490=_0x136313;_0x1a228a[_0xea7e('0x36')]=_['keys'](db['User'][_0xea7e('0x55')]);_0x1a228a['query']=_[_0xea7e('0x37')](_0x58303e['query']);_0x1a228a[_0xea7e('0x4b')]=_['intersection'](_0x1a228a['model'],_0x1a228a[_0xea7e('0x39')]);_0x3cd0a9[_0xea7e('0x3a')]=_['intersection'](_0x1a228a[_0xea7e('0x36')],qs[_0xea7e('0x3b')](_0x58303e[_0xea7e('0x39')]['fields']));_0x3cd0a9[_0xea7e('0x3a')]=_0x3cd0a9[_0xea7e('0x3a')]['length']?_0x3cd0a9['attributes']:_0x1a228a['model'];_0x3cd0a9[_0xea7e('0x3e')]=qs[_0xea7e('0x3f')](_0x58303e[_0xea7e('0x39')][_0xea7e('0x3f')]);_0x3cd0a9[_0xea7e('0x40')]=qs[_0xea7e('0x4b')](_['pick'](_0x58303e[_0xea7e('0x39')],_0x1a228a[_0xea7e('0x4b')]));if(_0x58303e['query'][_0xea7e('0x43')]){_0x3cd0a9['where']=_[_0xea7e('0x42')](_0x3cd0a9[_0xea7e('0x40')],{'$or':_[_0xea7e('0x31')](_0x3cd0a9[_0xea7e('0x3a')],function(_0x584e9f){var _0x155024={};_0x155024[_0x584e9f]={'$like':'%'+_0x58303e[_0xea7e('0x39')]['filter']+'%'};return _0x155024;})});}_0x3cd0a9=_['merge']({},_0x3cd0a9,_0x58303e['options']);return _0x5ed490[_0xea7e('0x53')](_0x3cd0a9);}})[_0xea7e('0x2a')](function(_0x35d29b){if(_0x35d29b){_0x4863b3=_0x35d29b[_0xea7e('0x3c')];if(!_0x58303e[_0xea7e('0x39')]['hasOwnProperty'](_0xea7e('0x3d'))){_0x3cd0a9['limit']=qs[_0xea7e('0x22')](_0x58303e[_0xea7e('0x39')][_0xea7e('0x22')]);_0x3cd0a9[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x58303e[_0xea7e('0x39')][_0xea7e('0x1f')]);}return _0x5ed490[_0xea7e('0x53')](_0x3cd0a9);}})[_0xea7e('0x2a')](function(_0x590eaa){if(_0x590eaa){return _0x590eaa?{'count':_0x4863b3,'rows':_0x590eaa}:null;}})[_0xea7e('0x2a')](respondWithResult(_0x3614bb,null))[_0xea7e('0x48')](handleError(_0x3614bb,null));};exports[_0xea7e('0x56')]=function(_0xa825de,_0x4136d4,_0x29d878){return db[_0xea7e('0x32')][_0xea7e('0x4c')]({'where':{'id':_0xa825de[_0xea7e('0x4a')]['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x4136d4,null))[_0xea7e('0x2a')](function(_0x2f9d8d){if(_0x2f9d8d){return _0x2f9d8d[_0xea7e('0x56')](_0xa825de[_0xea7e('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x4136d4,null))[_0xea7e('0x48')](handleError(_0x4136d4,null));};exports[_0xea7e('0x57')]=function(_0x120700,_0x547c0f,_0x219fb9){if(_0x120700[_0xea7e('0x4e')]['id']){delete _0x120700['body']['id'];}return db['ChatGroup'][_0xea7e('0x4c')]({'where':{'id':_0x120700['params']['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x547c0f,null))[_0xea7e('0x2a')](function(_0x52f355){if(_0x52f355){_0x120700[_0xea7e('0x4e')][_0xea7e('0x58')]=_0x52f355['id'];return db[_0xea7e('0x4f')][_0xea7e('0x4d')](_0x120700[_0xea7e('0x4e')]);}})[_0xea7e('0x2a')](respondWithResult(_0x547c0f,null))[_0xea7e('0x48')](handleError(_0x547c0f,null));};exports[_0xea7e('0x59')]=function(_0x2025ae,_0x305a23,_0x566a2f){var _0x1ae8f2={};var _0x631eff={};var _0x1632f1;var _0x15ea33;return db['ChatGroup'][_0xea7e('0x54')]({'where':{'id':_0x2025ae[_0xea7e('0x4a')]['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x305a23,null))[_0xea7e('0x2a')](function(_0x47c84d){if(_0x47c84d){_0x1632f1=_0x47c84d;_0x631eff[_0xea7e('0x36')]=_[_0xea7e('0x37')](db['ChatInternalMessage'][_0xea7e('0x55')]);_0x631eff[_0xea7e('0x39')]=_[_0xea7e('0x37')](_0x2025ae[_0xea7e('0x39')]);_0x631eff[_0xea7e('0x4b')]=_[_0xea7e('0x38')](_0x631eff[_0xea7e('0x36')],_0x631eff['query']);_0x1ae8f2['attributes']=_[_0xea7e('0x38')](_0x631eff[_0xea7e('0x36')],qs[_0xea7e('0x3b')](_0x2025ae[_0xea7e('0x39')][_0xea7e('0x3b')]));_0x1ae8f2[_0xea7e('0x3a')]=_0x1ae8f2[_0xea7e('0x3a')][_0xea7e('0x3c')]?_0x1ae8f2[_0xea7e('0x3a')]:_0x631eff['model'];_0x1ae8f2[_0xea7e('0x3e')]=qs[_0xea7e('0x3f')](_0x2025ae[_0xea7e('0x39')]['sort']);_0x1ae8f2[_0xea7e('0x40')]=qs[_0xea7e('0x4b')](_[_0xea7e('0x41')](_0x2025ae['query'],_0x631eff[_0xea7e('0x4b')]));if(_0x2025ae['query'][_0xea7e('0x43')]){_0x1ae8f2[_0xea7e('0x40')]=_['merge'](_0x1ae8f2[_0xea7e('0x40')],{'$or':_['map'](_0x1ae8f2[_0xea7e('0x3a')],function(_0x480b27){var _0x20ea44={};_0x20ea44[_0x480b27]={'$like':'%'+_0x2025ae[_0xea7e('0x39')]['filter']+'%'};return _0x20ea44;})});}if(_0x2025ae['query'][_0xea7e('0x5a')]){var _0x41295b=_0x2025ae[_0xea7e('0x39')][_0xea7e('0x5a')][_0xea7e('0x5b')](',');var _0x2ddb34={};_0x2ddb34[_0x41295b[0x0]]={'$gte':moment(_0x41295b[0x1])[_0xea7e('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1ae8f2[_0xea7e('0x40')]=_[_0xea7e('0x42')](_0x1ae8f2['where'],_0x2ddb34);}_0x1ae8f2=_[_0xea7e('0x42')]({},_0x1ae8f2,_0x2025ae['options']);return _0x1632f1['getMessages'](_0x1ae8f2);}})['then'](function(_0x31c80f){if(_0x31c80f){_0x15ea33=_0x31c80f['length'];if(!_0x2025ae[_0xea7e('0x39')][_0xea7e('0x5d')]('nolimit')){_0x1ae8f2['limit']=qs['limit'](_0x2025ae['query'][_0xea7e('0x22')]);_0x1ae8f2['offset']=qs[_0xea7e('0x1f')](_0x2025ae['query'][_0xea7e('0x1f')]);}return _0x1632f1[_0xea7e('0x59')](_0x1ae8f2);}})[_0xea7e('0x2a')](function(_0x3cbd41){if(_0x3cbd41){return _0x3cbd41?{'count':_0x15ea33,'rows':_0x3cbd41}:null;}})[_0xea7e('0x2a')](respondWithResult(_0x305a23,null))[_0xea7e('0x48')](handleError(_0x305a23,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 9021ba0..484ed01 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 _0xc5e4=['ChatGroup','save','update','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x2d06b1,_0x3aef78){var _0x40532d=function(_0x262c1a){while(--_0x262c1a){_0x2d06b1['push'](_0x2d06b1['shift']());}};_0x40532d(++_0x3aef78);}(_0xc5e4,0x117));var _0x4c5e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc5e4[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x4c5e('0x0'))['db'][_0x4c5e('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4c5e('0x2'),'afterUpdate':_0x4c5e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1197ab){return function(_0xbf9f24,_0x202246,_0x45cfd9){ChatGroupEvents[_0x4c5e('0x4')](_0x1197ab+':'+_0xbf9f24['id'],_0xbf9f24);ChatGroupEvents[_0x4c5e('0x4')](_0x1197ab,_0xbf9f24);_0x45cfd9(null);};}for(var e in events){if(events[_0x4c5e('0x5')](e)){var event=events[e];ChatGroup[_0x4c5e('0x6')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x0b79=['hasOwnProperty','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit'];(function(_0x15eb1a,_0x16dc02){var _0x1e7205=function(_0x32fad8){while(--_0x32fad8){_0x15eb1a['push'](_0x15eb1a['shift']());}};_0x1e7205(++_0x16dc02);}(_0x0b79,0xad));var _0x90b7=function(_0xc85b17,_0x2b981f){_0xc85b17=_0xc85b17-0x0;var _0x490ef8=_0x0b79[_0xc85b17];return _0x490ef8;};'use strict';var EventEmitter=require(_0x90b7('0x0'));var ChatGroup=require(_0x90b7('0x1'))['db'][_0x90b7('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x90b7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x90b7('0x4'),'afterDestroy':_0x90b7('0x5')};function emitEvent(_0x497698){return function(_0xd3671f,_0x4cd6c5,_0xd50b1b){ChatGroupEvents[_0x90b7('0x6')](_0x497698+':'+_0xd3671f['id'],_0xd3671f);ChatGroupEvents[_0x90b7('0x6')](_0x497698,_0xd3671f);_0xd50b1b(null);};}for(var e in events){if(events[_0x90b7('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x90b7('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 9462000..d03dd2c 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 _0xc587=['define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports'];(function(_0x3ed86a,_0x2e6a73){var _0x5a71f1=function(_0x47f9e5){while(--_0x47f9e5){_0x3ed86a['push'](_0x3ed86a['shift']());}};_0x5a71f1(++_0x2e6a73);}(_0xc587,0x129));var _0x7c58=function(_0x1865ff,_0x34ab23){_0x1865ff=_0x1865ff-0x0;var _0x493d64=_0xc587[_0x1865ff];return _0x493d64;};'use strict';var _=require(_0x7c58('0x0'));var util=require(_0x7c58('0x1'));var logger=require(_0x7c58('0x2'))(_0x7c58('0x3'));var moment=require(_0x7c58('0x4'));var BPromise=require(_0x7c58('0x5'));var rp=require(_0x7c58('0x6'));var fs=require('fs');var path=require(_0x7c58('0x7'));var rimraf=require(_0x7c58('0x8'));var config=require('../../config/environment');var attributes=require(_0x7c58('0x9'));module[_0x7c58('0xa')]=function(_0x6c954,_0x2581fd){return _0x6c954[_0x7c58('0xb')](_0x7c58('0xc'),attributes,{'tableName':_0x7c58('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7855=['request-promise','path','./chatGroup.attributes','define','ChatGroup','util','../../config/logger','api','moment','bluebird'];(function(_0xc7f728,_0x4d812f){var _0x3a6dc5=function(_0x8615cd){while(--_0x8615cd){_0xc7f728['push'](_0xc7f728['shift']());}};_0x3a6dc5(++_0x4d812f);}(_0x7855,0x1c7));var _0x5785=function(_0x453c99,_0x4a0d59){_0x453c99=_0x453c99-0x0;var _0x3dc60b=_0x7855[_0x453c99];return _0x3dc60b;};'use strict';var _=require('lodash');var util=require(_0x5785('0x0'));var logger=require(_0x5785('0x1'))(_0x5785('0x2'));var moment=require(_0x5785('0x3'));var BPromise=require(_0x5785('0x4'));var rp=require(_0x5785('0x5'));var fs=require('fs');var path=require(_0x5785('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5785('0x7'));module['exports']=function(_0x483743,_0x2df770){return _0x483743[_0x5785('0x8')](_0x5785('0x9'),attributes,{'tableName':'chat_groups','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 9ea74a9..2da4c14 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 _0x22d3=['stringify','error','message','result','catch','ChatGroup,\x20%s,\x20%s','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x525646,_0x5e435b){var _0x47ce97=function(_0x30e17a){while(--_0x30e17a){_0x525646['push'](_0x525646['shift']());}};_0x47ce97(++_0x5e435b);}(_0x22d3,0x66));var _0x322d=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x22d3[_0x3ceb54];return _0x26d8a6;};'use strict';var _=require('lodash');var util=require(_0x322d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x322d('0x1'));var fs=require('fs');var Redis=require(_0x322d('0x2'));var db=require(_0x322d('0x3'))['db'];var utils=require(_0x322d('0x4'));var logger=require(_0x322d('0x5'))('rpc');var config=require(_0x322d('0x6'));var jayson=require(_0x322d('0x7'));var client=jayson['client'][_0x322d('0x8')]({'port':0x232a});config[_0x322d('0x9')]=_[_0x322d('0xa')](config[_0x322d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x322d('0xb'))(new Redis(config[_0x322d('0x9')]));require(_0x322d('0xc'))[_0x322d('0xd')](socket);function respondWithRpcPromise(_0x2a6b87,_0x29c770,_0xf41a3e){return new BPromise(function(_0x3710a4,_0x2b3a39){return client[_0x322d('0xe')](_0x2a6b87,_0xf41a3e)['then'](function(_0x4e08a3){logger[_0x322d('0xf')]('ChatGroup,\x20%s,\x20%s',_0x29c770,_0x322d('0x10'));logger['debug'](_0x322d('0x11'),_0x29c770,_0x322d('0x10'),JSON[_0x322d('0x12')](_0x4e08a3));if(_0x4e08a3[_0x322d('0x13')]){if(_0x4e08a3[_0x322d('0x13')]['code']===0x1f4){logger[_0x322d('0x13')]('ChatGroup,\x20%s,\x20%s',_0x29c770,_0x4e08a3[_0x322d('0x13')]['message']);return _0x2b3a39(_0x4e08a3['error'][_0x322d('0x14')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x29c770,_0x4e08a3[_0x322d('0x13')][_0x322d('0x14')]);return _0x3710a4(_0x4e08a3[_0x322d('0x13')][_0x322d('0x14')]);}else{logger[_0x322d('0xf')]('ChatGroup,\x20%s,\x20%s',_0x29c770,_0x322d('0x10'));_0x3710a4(_0x4e08a3[_0x322d('0x15')][_0x322d('0x14')]);}})[_0x322d('0x16')](function(_0x497a4f){logger[_0x322d('0x13')](_0x322d('0x17'),_0x29c770,_0x497a4f);_0x2b3a39(_0x497a4f);});});} \ No newline at end of file +var _0x20ce=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x20ce,0x10d));var _0xe20c=function(_0x45fa95,_0x308dd6){_0x45fa95=_0x45fa95-0x0;var _0x414317=_0x20ce[_0x45fa95];return _0x414317;};'use strict';var _=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var moment=require(_0xe20c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe20c('0x3'));var fs=require('fs');var Redis=require(_0xe20c('0x4'));var db=require(_0xe20c('0x5'))['db'];var utils=require(_0xe20c('0x6'));var logger=require(_0xe20c('0x7'))(_0xe20c('0x8'));var config=require(_0xe20c('0x9'));var jayson=require(_0xe20c('0xa'));var client=jayson[_0xe20c('0xb')][_0xe20c('0xc')]({'port':0x232a});config[_0xe20c('0xd')]=_[_0xe20c('0xe')](config[_0xe20c('0xd')],{'host':_0xe20c('0xf'),'port':0x18eb});var socket=require(_0xe20c('0x10'))(new Redis(config[_0xe20c('0xd')]));require(_0xe20c('0x11'))[_0xe20c('0x12')](socket);function respondWithRpcPromise(_0x41379b,_0x16aaaa,_0xb46255){return new BPromise(function(_0x17ecc8,_0x4517d7){return client[_0xe20c('0x13')](_0x41379b,_0xb46255)['then'](function(_0x201b08){logger[_0xe20c('0x14')](_0xe20c('0x15'),_0x16aaaa,_0xe20c('0x16'));logger[_0xe20c('0x17')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x16aaaa,_0xe20c('0x16'),JSON[_0xe20c('0x18')](_0x201b08));if(_0x201b08['error']){if(_0x201b08[_0xe20c('0x19')][_0xe20c('0x1a')]===0x1f4){logger[_0xe20c('0x19')]('ChatGroup,\x20%s,\x20%s',_0x16aaaa,_0x201b08[_0xe20c('0x19')][_0xe20c('0x1b')]);return _0x4517d7(_0x201b08[_0xe20c('0x19')][_0xe20c('0x1b')]);}logger['error'](_0xe20c('0x15'),_0x16aaaa,_0x201b08['error'][_0xe20c('0x1b')]);return _0x17ecc8(_0x201b08[_0xe20c('0x19')][_0xe20c('0x1b')]);}else{logger[_0xe20c('0x14')](_0xe20c('0x15'),_0x16aaaa,_0xe20c('0x16'));_0x17ecc8(_0x201b08[_0xe20c('0x1c')][_0xe20c('0x1b')]);}})[_0xe20c('0x1d')](function(_0x3768b0){logger['error'](_0xe20c('0x15'),_0x16aaaa,_0x3768b0);_0x4517d7(_0x3768b0);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e5259ad..ac5f9c4 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 _0xfe30=['chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0xd48ed9,_0x4aa193){var _0x6cf52a=function(_0x254f76){while(--_0x254f76){_0xd48ed9['push'](_0xd48ed9['shift']());}};_0x6cf52a(++_0x4aa193);}(_0xfe30,0x1ed));var _0x0fe3=function(_0x1adf19,_0x44af9c){_0x1adf19=_0x1adf19-0x0;var _0x17faa2=_0xfe30[_0x1adf19];return _0x17faa2;};'use strict';var ChatGroupEvents=require(_0x0fe3('0x0'));var events=[_0x0fe3('0x1'),_0x0fe3('0x2'),_0x0fe3('0x3')];function createListener(_0x2a7a8e,_0x2e16ff){return function(_0x20d741){_0x2e16ff[_0x0fe3('0x4')](_0x2a7a8e,_0x20d741);};}function removeListener(_0x4cbbdf,_0x491be0){return function(){ChatGroupEvents['removeListener'](_0x4cbbdf,_0x491be0);};}exports['register']=function(_0x1da10e){for(var _0x366347=0x0,_0x466129=events['length'];_0x366347<_0x466129;_0x366347++){var _0x7d2dd4=events[_0x366347];var _0x1a125b=createListener(_0x0fe3('0x5')+_0x7d2dd4,_0x1da10e);ChatGroupEvents['on'](_0x7d2dd4,_0x1a125b);}}; \ No newline at end of file +var _0x37c6=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x1c47e4,_0x86ec7a){var _0x16e15a=function(_0x4663cb){while(--_0x4663cb){_0x1c47e4['push'](_0x1c47e4['shift']());}};_0x16e15a(++_0x86ec7a);}(_0x37c6,0x109));var _0x637c=function(_0x139994,_0x57f3bb){_0x139994=_0x139994-0x0;var _0x40898b=_0x37c6[_0x139994];return _0x40898b;};'use strict';var ChatGroupEvents=require(_0x637c('0x0'));var events=[_0x637c('0x1'),_0x637c('0x2'),_0x637c('0x3')];function createListener(_0x3500ef,_0x52dfde){return function(_0x227182){_0x52dfde[_0x637c('0x4')](_0x3500ef,_0x227182);};}function removeListener(_0x3fd066,_0x319e60){return function(){ChatGroupEvents[_0x637c('0x5')](_0x3fd066,_0x319e60);};}exports[_0x637c('0x6')]=function(_0x3486a5){for(var _0x5f546a=0x0,_0xf638c9=events['length'];_0x5f546a<_0xf638c9;_0x5f546a++){var _0x5d718c=events[_0x5f546a];var _0x4dde1f=createListener(_0x637c('0x7')+_0x5d718c,_0x3486a5);ChatGroupEvents['on'](_0x5d718c,_0x4dde1f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 90a6e3f..55d50d7 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 _0x81db=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','delete','/:id','destroy','multer','util','path'];(function(_0x494aab,_0x4e1cef){var _0x1bc60f=function(_0xfbc68e){while(--_0xfbc68e){_0x494aab['push'](_0x494aab['shift']());}};_0x1bc60f(++_0x4e1cef);}(_0x81db,0x183));var _0xb81d=function(_0x52e572,_0x4c318b){_0x52e572=_0x52e572-0x0;var _0x112a42=_0x81db[_0x52e572];return _0x112a42;};'use strict';var multer=require(_0xb81d('0x0'));var util=require(_0xb81d('0x1'));var path=require(_0xb81d('0x2'));var timeout=require(_0xb81d('0x3'));var express=require(_0xb81d('0x4'));var router=express[_0xb81d('0x5')]();var fs_extra=require(_0xb81d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb81d('0x7'));var config=require(_0xb81d('0x8'));var controller=require('./chatGroup.controller');router[_0xb81d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb81d('0x9')](_0xb81d('0xa'),auth[_0xb81d('0xb')](),controller[_0xb81d('0xc')]);router[_0xb81d('0x9')]('/:id',auth[_0xb81d('0xb')](),controller['show']);router[_0xb81d('0x9')](_0xb81d('0xd'),auth[_0xb81d('0xb')](),controller['getUnread']);router[_0xb81d('0x9')](_0xb81d('0xe'),auth[_0xb81d('0xb')](),controller[_0xb81d('0xf')]);router[_0xb81d('0x9')](_0xb81d('0x10'),auth[_0xb81d('0xb')](),controller[_0xb81d('0x11')]);router[_0xb81d('0x12')]('/',auth[_0xb81d('0xb')](),controller[_0xb81d('0x13')]);router[_0xb81d('0x12')]('/:id/members',auth['isAuthenticated'](),controller[_0xb81d('0x14')]);router[_0xb81d('0x12')]('/:id/messages',auth[_0xb81d('0xb')](),controller[_0xb81d('0x15')]);router[_0xb81d('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb81d('0x17')](_0xb81d('0x18'),auth[_0xb81d('0xb')](),controller[_0xb81d('0x19')]);router[_0xb81d('0x17')]('/:id/members',auth['isAuthenticated'](),controller['removeMembers']);module['exports']=router; \ No newline at end of file +var _0xac4d=['get','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','put','update','delete','destroy','removeMembers','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','index','/describe','isAuthenticated'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xac4d,0x104));var _0xdac4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xac4d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xdac4('0x0'));var util=require('util');var path=require(_0xdac4('0x1'));var timeout=require('connect-timeout');var express=require(_0xdac4('0x2'));var router=express['Router']();var fs_extra=require(_0xdac4('0x3'));var auth=require(_0xdac4('0x4'));var interaction=require(_0xdac4('0x5'));var config=require('../../config/environment');var controller=require(_0xdac4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xdac4('0x7')]);router['get'](_0xdac4('0x8'),auth[_0xdac4('0x9')](),controller['describe']);router[_0xdac4('0xa')](_0xdac4('0xb'),auth[_0xdac4('0x9')](),controller[_0xdac4('0xc')]);router['get'](_0xdac4('0xd'),auth['isAuthenticated'](),controller['getUnread']);router[_0xdac4('0xa')](_0xdac4('0xe'),auth[_0xdac4('0x9')](),controller[_0xdac4('0xf')]);router['get'](_0xdac4('0x10'),auth['isAuthenticated'](),controller[_0xdac4('0x11')]);router['post']('/',auth[_0xdac4('0x9')](),controller[_0xdac4('0x12')]);router[_0xdac4('0x13')]('/:id/members',auth[_0xdac4('0x9')](),controller[_0xdac4('0x14')]);router[_0xdac4('0x13')](_0xdac4('0x10'),auth[_0xdac4('0x9')](),controller['addMessage']);router[_0xdac4('0x15')](_0xdac4('0xb'),auth[_0xdac4('0x9')](),controller[_0xdac4('0x16')]);router[_0xdac4('0x17')]('/:id',auth[_0xdac4('0x9')](),controller[_0xdac4('0x18')]);router[_0xdac4('0x17')]('/:id/members',auth[_0xdac4('0x9')](),controller[_0xdac4('0x19')]);module[_0xdac4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 9cf99fa..b36a988 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 _0x6c1a=['BOOLEAN','sequelize','exports','INTEGER','star','thumb','TEXT','STRING','DATE','long','out'];(function(_0x2697ff,_0x1850ac){var _0x5b56d7=function(_0x114886){while(--_0x114886){_0x2697ff['push'](_0x2697ff['shift']());}};_0x5b56d7(++_0x1850ac);}(_0x6c1a,0x1f0));var _0xa6c1=function(_0x2a6a75,_0x1df599){_0x2a6a75=_0x2a6a75-0x0;var _0x227550=_0x6c1a[_0x2a6a75];return _0x227550;};'use strict';var Sequelize=require(_0xa6c1('0x0'));module[_0xa6c1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa6c1('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xa6c1('0x3'),_0xa6c1('0x4')),'defaultValue':_0xa6c1('0x3')},'ratingMessage':{'type':Sequelize[_0xa6c1('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xa6c1('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa6c1('0x7')]},'disposition':{'type':Sequelize[_0xa6c1('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xa6c1('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xa6c1('0x6')]},'deviceVendor':{'type':Sequelize[_0xa6c1('0x6')]},'deviceType':{'type':Sequelize[_0xa6c1('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xa6c1('0x6')]},'formData':{'type':Sequelize[_0xa6c1('0x5')](_0xa6c1('0x8'))},'read1stAt':{'type':Sequelize[_0xa6c1('0x7')]},'lastMsgAt':{'type':Sequelize[_0xa6c1('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa6c1('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa6c1('0x6')]},'customerPort':{'type':Sequelize[_0xa6c1('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xa6c1('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x421c=['TEXT','STRING','DATE','long','out','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x1f62c2,_0x3977a6){var _0x302a55=function(_0x53ab47){while(--_0x53ab47){_0x1f62c2['push'](_0x1f62c2['shift']());}};_0x302a55(++_0x3977a6);}(_0x421c,0x1bd));var _0xc421=function(_0x2e6428,_0x37e95e){_0x2e6428=_0x2e6428-0x0;var _0x1e0ee7=_0x421c[_0x2e6428];return _0x1e0ee7;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xc421('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc421('0x1')]},'ratingType':{'type':Sequelize[_0xc421('0x2')](_0xc421('0x3'),_0xc421('0x4')),'defaultValue':_0xc421('0x3')},'ratingMessage':{'type':Sequelize[_0xc421('0x5')]},'pathTranscript':{'type':Sequelize[_0xc421('0x5')]},'mailTranscript':{'type':Sequelize[_0xc421('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc421('0x7')]},'disposition':{'type':Sequelize[_0xc421('0x6')]},'secondDisposition':{'type':Sequelize[_0xc421('0x6')]},'thirdDisposition':{'type':Sequelize[_0xc421('0x6')]},'note':{'type':Sequelize[_0xc421('0x6')]},'browserName':{'type':Sequelize[_0xc421('0x6')]},'browserVersion':{'type':Sequelize[_0xc421('0x6')]},'osName':{'type':Sequelize[_0xc421('0x6')]},'osVersion':{'type':Sequelize[_0xc421('0x6')]},'deviceModel':{'type':Sequelize[_0xc421('0x6')]},'deviceVendor':{'type':Sequelize[_0xc421('0x6')]},'deviceType':{'type':Sequelize[_0xc421('0x6')]},'referer':{'type':Sequelize[_0xc421('0x5')]},'customerIp':{'type':Sequelize[_0xc421('0x6')]},'formData':{'type':Sequelize['TEXT'](_0xc421('0x8'))},'read1stAt':{'type':Sequelize[_0xc421('0x7')]},'lastMsgAt':{'type':Sequelize[_0xc421('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc421('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc421('0x6')]},'customerPort':{'type':Sequelize[_0xc421('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc421('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index ae215f2..4c8dc71 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 _0xfff7=['Chat','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','out','Contact','lastName','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','./chatInteraction.socket','register','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','destroy','then','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','fieldName','type','key','findAll','chat','query','user','show','params','keys','rawAttributes','filters','intersection','attributes','model','fields','length','includeAll','include','options','ChatInteraction','find','create','update','describe','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooEscalation','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','closed','disposition','attachmentUpload','file','originalname','basename','filename','mimetype','Unauthorized','Attachment','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','server/files/chat/upload/','format','now','pathTranscript','Messages','User','CmContact','%s%d','agentAlias','customer','ContactId','agentIdentifier','agent_alias','alias','System','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','ids','getMessages','hasOwnProperty','sort','pick','where','ChatInteractionId','filter','$gte','split','count','rows','nolimit','order','includeAgent','push','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','createdAt','read','Owner','get','mkdirSync'];(function(_0x5c6bc9,_0x4276f7){var _0x5b1fa5=function(_0x351e82){while(--_0x351e82){_0x5c6bc9['push'](_0x5c6bc9['shift']());}};_0x5b1fa5(++_0x4276f7);}(_0xfff7,0x1b5));var _0x7fff=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfff7[_0x122ef9];return _0x42fba0;};'use strict';var rimraf=require(_0x7fff('0x0'));var zipdir=require(_0x7fff('0x1'));var rp=require(_0x7fff('0x2'));var moment=require(_0x7fff('0x3'));var BPromise=require(_0x7fff('0x4'));var Mustache=require(_0x7fff('0x5'));var util=require(_0x7fff('0x6'));var path=require(_0x7fff('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7fff('0x8'));var Redis=require(_0x7fff('0x9'));var interaction=require(_0x7fff('0xa'));var qs=require(_0x7fff('0xb'));var pdf=require(_0x7fff('0xc'));var logger=require(_0x7fff('0xd'))(_0x7fff('0xe'));var config=require(_0x7fff('0xf'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7fff('0x10')](config[_0x7fff('0x11')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7fff('0x11')]));require(_0x7fff('0x12'))[_0x7fff('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7fff('0x14')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3173c9,_0x23cab8,_0x2009df,_0x55a2d5){return new BPromise(function(_0x2fef2d,_0x5e9446){var _0x34dc86=_0x55a2d5||client;return _0x34dc86[_0x7fff('0x15')](_0x3173c9,_0x2009df)['then'](function(_0x1a7cb8){logger[_0x7fff('0x16')](_0x7fff('0x17'),_0x23cab8,_0x7fff('0x18'));logger[_0x7fff('0x19')](_0x7fff('0x1a'),_0x23cab8,_0x7fff('0x18'),JSON['stringify'](_0x1a7cb8));if(_0x1a7cb8[_0x7fff('0x1b')]){if(_0x1a7cb8[_0x7fff('0x1b')][_0x7fff('0x1c')]===0x1f4){logger[_0x7fff('0x1b')](_0x7fff('0x17'),_0x23cab8,_0x1a7cb8[_0x7fff('0x1b')]['message']);return _0x5e9446(_0x1a7cb8[_0x7fff('0x1b')][_0x7fff('0x1d')]);}logger[_0x7fff('0x1b')](_0x7fff('0x17'),_0x23cab8,_0x1a7cb8[_0x7fff('0x1b')][_0x7fff('0x1d')]);return _0x2fef2d(_0x1a7cb8[_0x7fff('0x1b')][_0x7fff('0x1d')]);}else{logger['info'](_0x7fff('0x17'),_0x23cab8,_0x7fff('0x18'));_0x2fef2d(_0x1a7cb8['result']['message']);}})[_0x7fff('0x1e')](function(_0x2473f6){logger[_0x7fff('0x1b')](_0x7fff('0x17'),_0x23cab8,_0x2473f6);_0x5e9446(_0x2473f6);});});}function respondWithStatusCode(_0x408b8b,_0xe00102){_0xe00102=_0xe00102||0xcc;return function(_0x1c21db){if(_0x1c21db){return _0x408b8b[_0x7fff('0x1f')](_0xe00102);}return _0x408b8b[_0x7fff('0x20')](_0xe00102)[_0x7fff('0x21')]();};}function respondWithResult(_0x3b3300,_0x1cbc11){_0x1cbc11=_0x1cbc11||0xc8;return function(_0x594cdc){if(_0x594cdc){return _0x3b3300[_0x7fff('0x20')](_0x1cbc11)[_0x7fff('0x22')](_0x594cdc);}};}function respondWithFilteredResult(_0x496645,_0x4c19ef){return function(_0xc8c6af){if(_0xc8c6af){var _0x391611=typeof _0x4c19ef[_0x7fff('0x23')]===_0x7fff('0x24')&&typeof _0x4c19ef[_0x7fff('0x25')]===_0x7fff('0x24');var _0x26ac9c=_0xc8c6af['count'];var _0x2e0b3f=_0x391611?0x0:_0x4c19ef[_0x7fff('0x23')];var _0x490aea=_0x391611?_0xc8c6af['count']:_0x4c19ef[_0x7fff('0x23')]+_0x4c19ef[_0x7fff('0x25')];var _0x2a8fdf;if(_0x490aea>=_0x26ac9c){_0x490aea=_0x26ac9c;_0x2a8fdf=0xc8;}else{_0x2a8fdf=0xce;}_0x496645['status'](_0x2a8fdf);return _0x496645[_0x7fff('0x26')](_0x7fff('0x27'),_0x2e0b3f+'-'+_0x490aea+'/'+_0x26ac9c)['json'](_0xc8c6af);}return null;};}function saveUpdates(_0x49e7b3){return function(_0x1349f1){if(_0x1349f1){return _0x1349f1['update'](_0x49e7b3)['then'](function(_0x3cf50c){return _0x3cf50c;});}return null;};}function removeEntity(_0x281d73){return function(_0x514496){if(_0x514496){return _0x514496[_0x7fff('0x28')]()[_0x7fff('0x29')](function(){_0x281d73[_0x7fff('0x20')](0xcc)[_0x7fff('0x21')]();});}};}function handleEntityNotFound(_0x1b9b0b){return function(_0x12dd0b){if(!_0x12dd0b){_0x1b9b0b[_0x7fff('0x1f')](0x194);}return _0x12dd0b;};}function handleError(_0xd7b598,_0x168748){_0x168748=_0x168748||0x1f4;return function(_0x45910e){logger[_0x7fff('0x1b')](_0x45910e[_0x7fff('0x2a')]);if(_0x45910e[_0x7fff('0x2b')]){delete _0x45910e[_0x7fff('0x2b')];}_0xd7b598[_0x7fff('0x20')](_0x168748)[_0x7fff('0x2c')](_0x45910e);};}function getMustacheRender(_0x31aa1e,_0xbe71d8){return Mustache[_0x7fff('0x2d')](_0x31aa1e,_[_0x7fff('0x2e')](_0xbe71d8[_0x7fff('0x2f')],{'contact':_0xbe71d8[_0x7fff('0x30')],'message':_0xbe71d8['message'],'agent':_0xbe71d8[_0x7fff('0x31')],'interaction':_0xbe71d8[_0x7fff('0x32')],'account':_0xbe71d8[_0x7fff('0x33')]}))||'';}exports[_0x7fff('0x34')]=function(_0x2f785a,_0x485d2f){var _0x3fd41e={};var _0x3f0c9c=_[_0x7fff('0x35')](db['ChatInteraction']['rawAttributes'],function(_0x15e0b3){return{'name':_0x15e0b3[_0x7fff('0x36')],'type':_0x15e0b3[_0x7fff('0x37')][_0x7fff('0x38')]};});_0x3fd41e=qs['getOptions'](_0x3f0c9c,_0x2f785a);return interaction[_0x7fff('0x39')](_0x7fff('0x3a'),_0x2f785a[_0x7fff('0x3b')],_0x2f785a[_0x7fff('0x3c')],_0x3fd41e,_0x3f0c9c)['then'](respondWithFilteredResult(_0x485d2f,_0x3fd41e))['catch'](handleError(_0x485d2f,null));};exports[_0x7fff('0x3d')]=function(_0x155eac,_0x33ce23){var _0xec44={'raw':![],'where':{'id':_0x155eac[_0x7fff('0x3e')]['id']}},_0x5e33f8={};_0x5e33f8['model']=_[_0x7fff('0x3f')](db['ChatInteraction'][_0x7fff('0x40')]);_0x5e33f8[_0x7fff('0x3b')]=_['keys'](_0x155eac['query']);_0x5e33f8[_0x7fff('0x41')]=_[_0x7fff('0x42')](_0x5e33f8['model'],_0x5e33f8['query']);_0xec44[_0x7fff('0x43')]=_['intersection'](_0x5e33f8[_0x7fff('0x44')],qs[_0x7fff('0x45')](_0x155eac['query'][_0x7fff('0x45')]));_0xec44[_0x7fff('0x43')]=_0xec44[_0x7fff('0x43')][_0x7fff('0x46')]?_0xec44[_0x7fff('0x43')]:_0x5e33f8[_0x7fff('0x44')];if(_0x155eac[_0x7fff('0x3b')][_0x7fff('0x47')]){_0xec44[_0x7fff('0x48')]=[{'all':!![]}];}_0xec44=_['merge']({},_0xec44,_0x155eac[_0x7fff('0x49')]);return db[_0x7fff('0x4a')][_0x7fff('0x4b')](_0xec44)[_0x7fff('0x29')](handleEntityNotFound(_0x33ce23,null))[_0x7fff('0x29')](respondWithResult(_0x33ce23,null))[_0x7fff('0x1e')](handleError(_0x33ce23,null));};exports[_0x7fff('0x4c')]=function(_0x21c33b,_0x3c7f28){return db['ChatInteraction'][_0x7fff('0x4c')](_0x21c33b[_0x7fff('0x2f')],{})[_0x7fff('0x29')](respondWithResult(_0x3c7f28,0xc9))[_0x7fff('0x1e')](handleError(_0x3c7f28,null));};exports[_0x7fff('0x4d')]=function(_0x343ec3,_0x428d59){if(_0x343ec3[_0x7fff('0x2f')]['id']){delete _0x343ec3['body']['id'];}return db['ChatInteraction'][_0x7fff('0x4b')]({'where':{'id':_0x343ec3[_0x7fff('0x3e')]['id']}})['then'](handleEntityNotFound(_0x428d59,null))['then'](saveUpdates(_0x343ec3[_0x7fff('0x2f')],null))[_0x7fff('0x29')](respondWithResult(_0x428d59,null))[_0x7fff('0x1e')](handleError(_0x428d59,null));};exports[_0x7fff('0x28')]=function(_0x3c55f8,_0x447bdb){return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x3c55f8[_0x7fff('0x3e')]['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x447bdb,null))['then'](removeEntity(_0x447bdb,null))['catch'](handleError(_0x447bdb,null));};exports[_0x7fff('0x4e')]=function(_0x28cfea,_0x2dc272){return db[_0x7fff('0x4a')]['describe']()[_0x7fff('0x29')](respondWithResult(_0x2dc272,null))[_0x7fff('0x1e')](handleError(_0x2dc272,null));};exports['createVidaooSession']=function(_0x2bf4a6,_0x55fa3e){var _0x292e93=_0x2bf4a6['params']['id'];var _0x1bf1d0;var _0x14426f;var _0x5c0961;return db[_0x7fff('0x4a')]['findOne']({'where':{'id':_0x292e93}})['then'](function(_0x36f3a4){_0x1bf1d0=_0x36f3a4;return db[_0x7fff('0x4f')][_0x7fff('0x50')]({'where':{'id':_0x36f3a4[_0x7fff('0x51')]},'attributes':['id',_0x7fff('0x52'),'vidaooEscalation',_0x7fff('0x53'),_0x7fff('0x54'),'vidaooMetadata'],'raw':!![]});})[_0x7fff('0x29')](function(_0x594e1b){if(_0x594e1b&&_0x594e1b[_0x7fff('0x52')]&&_0x594e1b[_0x7fff('0x55')]){_0x14426f=_0x594e1b;var _0x3396d2={'interaction':{'id':_0x292e93},'agent':{'id':_0x2bf4a6[_0x7fff('0x3c')]['id'],'name':_0x2bf4a6[_0x7fff('0x3c')][_0x7fff('0x2b')],'fullname':_0x2bf4a6[_0x7fff('0x3c')][_0x7fff('0x56')],'email':_0x2bf4a6[_0x7fff('0x3c')][_0x7fff('0x57')]},'contact':_0x2bf4a6[_0x7fff('0x2f')][_0x7fff('0x30')],'account':_0x2bf4a6[_0x7fff('0x2f')][_0x7fff('0x33')]};var _0x5929c1={'rejectUnauthorized':![],'method':_0x7fff('0x58'),'url':_0x7fff('0x59'),'headers':{'X-APIKEY':_0x594e1b[_0x7fff('0x52')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2bf4a6[_0x7fff('0x3c')][_0x7fff('0x57')]],'buttons':null,'topic':_0x14426f[_0x7fff('0x53')],'note':_[_0x7fff('0x5a')](_0x14426f['vidaooNote'])?null:getMustacheRender(_0x14426f['vidaooNote'],_0x3396d2),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x7fff('0x5a')](_0x14426f['vidaooMetadata'])){var _0x464a0a=getMustacheRender(_0x14426f['vidaooMetadata'],_0x3396d2);var _0xaebe30=JSON[_0x7fff('0x5b')](_0x464a0a);_0x5929c1[_0x7fff('0x2f')]['metadata']=_0xaebe30;}}catch(_0x4ac08b){throw new db['Sequelize'][(_0x7fff('0x5c'))](_0x7fff('0x5d'));}return rp(_0x5929c1);}else{throw new db['Sequelize']['ValidationError'](_0x7fff('0x5e'));}})['then'](function(_0x41ec9a){_0x5c0961=_0x41ec9a;if(_0x5c0961['id']){var _0x1a8e7e={'body':_0x5c0961['join_url'],'ChatWebsiteId':_0x14426f['id'],'ChatInteractionId':_0x1bf1d0['id'],'direction':'out','UserId':_0x2bf4a6[_0x7fff('0x3c')]['id']};return db[_0x7fff('0x5f')][_0x7fff('0x4c')](_0x1a8e7e,{});}else{throw new db[(_0x7fff('0x60'))]['ValidationError'](_0x7fff('0x61'));}})[_0x7fff('0x29')](function(){return _0x1bf1d0[_0x7fff('0x62')]({'vidaooSessionId':_0x5c0961['id']});})['then'](respondWithResult(_0x55fa3e,null))['catch'](handleError(_0x55fa3e,null));};exports[_0x7fff('0x63')]=function(_0x531331,_0x31ed3b){if(_0x531331['body']['id']){delete _0x531331[_0x7fff('0x2f')]['id'];}return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x531331['params']['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x7fff('0x29')](handleEntityNotFound(_0x31ed3b,null))[_0x7fff('0x29')](saveUpdates(_0x531331['body'],null))['then'](respondWithResult(_0x31ed3b,null))[_0x7fff('0x1e')](handleError(_0x31ed3b,null));};exports['abandon']=function(_0x365a36,_0xc84c15){if(_0x365a36['body']['id']){delete _0x365a36[_0x7fff('0x2f')]['id'];}return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x365a36[_0x7fff('0x3e')]['id']}})[_0x7fff('0x29')](function(_0x28d6a1){if(!_0x28d6a1){logger[_0x7fff('0x1b')](_0x7fff('0x64'),'abandon',0x194,_0x7fff('0x65'));_0xc84c15[_0x7fff('0x1f')](0x194);}else{if(_0x28d6a1[_0x7fff('0x66')]){throw new db[(_0x7fff('0x60'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x28d6a1;})[_0x7fff('0x29')](function(_0x44bffa){if(_0x44bffa){return _0x44bffa[_0x7fff('0x4d')]({'closed':_0x365a36[_0x7fff('0x2f')][_0x7fff('0x67')],'disposition':_0x365a36[_0x7fff('0x2f')][_0x7fff('0x68')]})['then'](function(_0x340022){return _0x340022;});}})[_0x7fff('0x29')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x365a36[_0x7fff('0x2f')],client9004);})[_0x7fff('0x29')](respondWithResult(_0xc84c15,null))[_0x7fff('0x1e')](handleError(_0xc84c15,null));};exports[_0x7fff('0x69')]=function(_0x1f033a,_0x406d42){_0x1f033a['body'][_0x7fff('0x2b')]=_0x1f033a[_0x7fff('0x6a')][_0x7fff('0x6b')];_0x1f033a['body'][_0x7fff('0x6c')]=_0x1f033a['file'][_0x7fff('0x6d')];_0x1f033a['body'][_0x7fff('0x37')]=_0x1f033a[_0x7fff('0x6a')][_0x7fff('0x6e')];return db['Attachment']['create'](_0x1f033a['body'])[_0x7fff('0x29')](respondWithResult(_0x406d42,0xc9))[_0x7fff('0x1e')](handleError(_0x406d42,null));};exports['attachmentDownload']=function(_0x1fafdd,_0x53db10){return db['ChatInteraction'][_0x7fff('0x50')]({'where':{'id':_0x1fafdd['params']['id']},'raw':!![]})[_0x7fff('0x29')](handleEntityNotFound(_0x53db10,null))[_0x7fff('0x29')](function(_0x30258f){if(_0x30258f){if(_0x30258f[_0x7fff('0x67')]){return _0x53db10['status'](0x193)['json']({'status':0x193,'message':_0x7fff('0x6f')});}return db[_0x7fff('0x70')]['findOne']({'where':{'id':_0x1fafdd['query']['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x53db10,null));}})[_0x7fff('0x29')](function(_0x27ae53){if(_0x27ae53){var _0xeaf5f4=_0x27ae53[_0x7fff('0x71')]!==null;var _0x4e9124=path[_0x7fff('0x72')](config[_0x7fff('0x73')],_0x7fff('0x74'));if(_0xeaf5f4){_0x4e9124=path[_0x7fff('0x72')](_0x4e9124,'offline-chat/');}var _0x103109=path['join'](_0x4e9124,_0x27ae53[_0x7fff('0x6c')]);return _0x53db10[_0x7fff('0x75')](_0x103109);}})[_0x7fff('0x1e')](handleError(_0x53db10,null));};exports[_0x7fff('0x76')]=function(_0x131392,_0x2c552c){var _0x1a8931=null;var _0x3d367c=null;var _0x267f78=null;if(_0x131392[_0x7fff('0x2f')]['id']){delete _0x131392[_0x7fff('0x2f')]['id'];}if(_0x131392[_0x7fff('0x2f')]['mailTranscript']){_0x267f78=path[_0x7fff('0x72')](config['root'],_0x7fff('0x77'),util[_0x7fff('0x78')]('transcript-%s.txt',Date[_0x7fff('0x79')]()));_0x131392[_0x7fff('0x2f')][_0x7fff('0x7a')]=_0x267f78;}return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x131392[_0x7fff('0x3e')]['id']},'include':[{'model':db[_0x7fff('0x5f')],'as':_0x7fff('0x7b'),'include':[{'model':db[_0x7fff('0x7c')],'as':_0x7fff('0x7c')}]}]})[_0x7fff('0x29')](handleEntityNotFound(_0x2c552c,null))[_0x7fff('0x29')](saveUpdates(_0x131392[_0x7fff('0x2f')],null))['then'](function(_0x3d991c){if(_0x3d991c){_0x1a8931=_0x3d991c;return db[_0x7fff('0x4f')][_0x7fff('0x4b')]({'where':{'id':_0x1a8931[_0x7fff('0x51')]}});}})[_0x7fff('0x29')](function(_0x2c76fd){if(_0x2c76fd){_0x3d367c=_0x2c76fd;return db[_0x7fff('0x7d')][_0x7fff('0x4b')]({'where':{'id':_0x1a8931['ContactId']}});}})[_0x7fff('0x29')](function(_0x2cdc5b){if(_0x2cdc5b){if(_0x267f78){var _0x44fd2c=null;for(var _0xdc32dd=0x1;_0xdc32dd<_0x1a8931['Messages'][_0x7fff('0x46')];++_0xdc32dd){_0x44fd2c=_0x1a8931[_0x7fff('0x7b')][_0xdc32dd];var _0x5ef227=_0x44fd2c['UserId']?util[_0x7fff('0x78')](_0x7fff('0x7e'),_0x3d367c[_0x7fff('0x7f')],_0x44fd2c[_0x7fff('0x66')]):'System';var _0x2054c6=_0x131392[_0x7fff('0x2f')][_0x7fff('0x80')]||util[_0x7fff('0x78')](_0x7fff('0x7e'),'Visitor',_0x44fd2c[_0x7fff('0x81')]);switch(_0x3d367c[_0x7fff('0x82')]){case'website_alias':_0x5ef227=_0x44fd2c[_0x7fff('0x66')]?util['format'](_0x7fff('0x7e'),_0x3d367c[_0x7fff('0x7f')],_0x44fd2c['UserId']):'System';break;case _0x7fff('0x83'):_0x5ef227=_0x44fd2c[_0x7fff('0x66')]?_0x44fd2c[_0x7fff('0x7c')][_0x7fff('0x84')]||_0x44fd2c[_0x7fff('0x7c')][_0x7fff('0x56')]:_0x7fff('0x85');break;case'agent_fullname':_0x5ef227=_0x44fd2c[_0x7fff('0x66')]?_0x44fd2c['User'][_0x7fff('0x56')]:_0x7fff('0x85');break;default:_0x5ef227=_0x44fd2c[_0x7fff('0x66')]?util['format'](_0x7fff('0x7e'),_0x3d367c[_0x7fff('0x7f')],_0x44fd2c[_0x7fff('0x66')]):_0x7fff('0x85');}var _0x23ba0c=util[_0x7fff('0x78')](_0x7fff('0x86'),moment(_0x44fd2c['createdAt'])[_0x7fff('0x78')]('MM/DD/YYYY\x20HH:mm:ss'),_0x44fd2c[_0x7fff('0x87')]==='in'?_0x2054c6:_0x5ef227,_0x44fd2c[_0x7fff('0x2f')]);if(!_0x44fd2c[_0x7fff('0x88')]){fs[_0x7fff('0x89')](_0x267f78,_0x23ba0c);}}return db[_0x7fff('0x8a')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x7fff('0x8b')],'as':_0x7fff('0x8c'),'raw':!![],'include':[{'model':db[_0x7fff('0x8d')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x7fff('0x29')](function(_0x13c07e){if(!_0x13c07e||!_0x13c07e['Smtp']||!_0x131392[_0x7fff('0x2f')])return _0x1a8931;var _0x4381df=_0x13c07e['getSmtpOptions']();return respondWithRpcPromise(_0x7fff('0x8e'),_0x7fff('0x8f'),{'account':_0x4381df,'message':{'from':util[_0x7fff('0x78')](_0x7fff('0x90'),_0x13c07e[_0x7fff('0x2b')],_0x13c07e[_0x7fff('0x57')]||_0x13c07e[_0x7fff('0x8c')][_0x7fff('0x3c')]),'to':_0x131392['body']['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x7fff('0x78')](_0x7fff('0x91'),_0x131392[_0x7fff('0x2f')][_0x7fff('0x92')]),'attachments':[{'path':_0x267f78}]}})[_0x7fff('0x29')](function(){return _0x1a8931;})[_0x7fff('0x1e')](function(_0x5f7bb0){logger[_0x7fff('0x1b')](_0x5f7bb0);});})[_0x7fff('0x29')](respondWithStatusCode(_0x2c552c,0xc8))['catch'](handleError(_0x2c552c,null));};exports['addMessage']=function(_0x5f5ad3,_0x17dbc2){return db[_0x7fff('0x5f')]['find']({'where':{'id':_0x5f5ad3[_0x7fff('0x3e')]['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x17dbc2,null))[_0x7fff('0x29')](function(_0x2b88d4){if(_0x2b88d4){return _0x2b88d4['addMessage'](_0x5f5ad3['body'][_0x7fff('0x93')],_['omit'](_0x5f5ad3['body'],['ids','id'])||{});}})[_0x7fff('0x29')](respondWithResult(_0x17dbc2,null))[_0x7fff('0x1e')](handleError(_0x17dbc2,null));};exports[_0x7fff('0x94')]=function(_0x4f0e51,_0x54b4e2){var _0x1771ad={'raw':![],'where':{}};var _0x406aa6={};var _0x607e4d={'count':0x0,'rows':[]};return db[_0x7fff('0x4a')]['findOne']({'where':{'id':_0x4f0e51['params']['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x54b4e2,null))[_0x7fff('0x29')](function(_0x22a481){if(_0x22a481){_0x406aa6[_0x7fff('0x44')]=_[_0x7fff('0x3f')](db['ChatMessage'][_0x7fff('0x40')]);_0x406aa6[_0x7fff('0x3b')]=_[_0x7fff('0x3f')](_0x4f0e51['query']);_0x406aa6[_0x7fff('0x41')]=_[_0x7fff('0x42')](_0x406aa6[_0x7fff('0x44')],_0x406aa6[_0x7fff('0x3b')]);_0x1771ad[_0x7fff('0x43')]=_[_0x7fff('0x42')](_0x406aa6[_0x7fff('0x44')],qs['fields'](_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x45')]));_0x1771ad[_0x7fff('0x43')]=_0x1771ad['attributes'][_0x7fff('0x46')]?_0x1771ad[_0x7fff('0x43')]:_0x406aa6[_0x7fff('0x44')];if(!_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x95')]('nolimit')){_0x1771ad[_0x7fff('0x25')]=qs['limit'](_0x4f0e51['query'][_0x7fff('0x25')]);_0x1771ad['offset']=qs[_0x7fff('0x23')](_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x23')]);}_0x1771ad['order']=qs['sort'](_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x96')]);_0x1771ad['where']=qs[_0x7fff('0x41')](_[_0x7fff('0x97')](_0x4f0e51[_0x7fff('0x3b')],_0x406aa6[_0x7fff('0x41')]));_0x1771ad[_0x7fff('0x98')][_0x7fff('0x99')]=_0x22a481['id'];if(_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x9a')]){_0x1771ad[_0x7fff('0x98')]=_['merge'](_0x1771ad[_0x7fff('0x98')],{'$or':_[_0x7fff('0x35')](_0x1771ad[_0x7fff('0x43')],function(_0x6f67ce){var _0x5083c7={};_0x5083c7[_0x6f67ce]={'$like':'%'+_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x9a')]+'%'};return _0x5083c7;})});}if(_0x4f0e51['query'][_0x7fff('0x9b')]){var _0x1ae7ee=_0x4f0e51[_0x7fff('0x3b')]['$gte'][_0x7fff('0x9c')](',');var _0x58d4de={};_0x58d4de[_0x1ae7ee[0x0]]={'$gte':moment(_0x1ae7ee[0x1])[_0x7fff('0x78')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1771ad[_0x7fff('0x98')]=_[_0x7fff('0x2e')](_0x1771ad[_0x7fff('0x98')],_0x58d4de);}_0x1771ad=_[_0x7fff('0x2e')]({},_0x1771ad,_0x4f0e51[_0x7fff('0x49')]);return db['ChatMessage']['count']({'where':_0x1771ad[_0x7fff('0x98')]})[_0x7fff('0x29')](function(_0x3c6fdd){_0x607e4d[_0x7fff('0x9d')]=_0x3c6fdd;if(_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x47')]){_0x1771ad[_0x7fff('0x48')]=[{'all':!![]}];}return db[_0x7fff('0x5f')][_0x7fff('0x39')](_0x1771ad);})['then'](function(_0x5668b9){_0x607e4d[_0x7fff('0x9e')]=_0x5668b9;return _0x607e4d;});}})['then'](respondWithFilteredResult(_0x54b4e2,_0x1771ad))[_0x7fff('0x1e')](handleError(_0x54b4e2,null));};exports['getMyMessages']=function(_0x4afdbc,_0x1a5b16){var _0x267ed2={'where':{}},_0x1e4c7f={},_0x5d7cb7={'count':0x0,'rows':[]};return db[_0x7fff('0x4a')][_0x7fff('0x50')]({'where':{'id':_0x4afdbc['params']['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x1a5b16,null))[_0x7fff('0x29')](function(_0x301788){if(_0x301788){_0x1e4c7f['model']=_['keys'](db['ChatMessage'][_0x7fff('0x40')]);_0x1e4c7f[_0x7fff('0x3b')]=_[_0x7fff('0x3f')](_0x4afdbc[_0x7fff('0x3b')]);_0x1e4c7f[_0x7fff('0x41')]=_[_0x7fff('0x42')](_0x1e4c7f[_0x7fff('0x44')],_0x1e4c7f[_0x7fff('0x3b')]);_0x267ed2['attributes']=_[_0x7fff('0x42')](_0x1e4c7f[_0x7fff('0x44')],qs['fields'](_0x4afdbc[_0x7fff('0x3b')]['fields']));_0x267ed2['attributes']=_0x267ed2[_0x7fff('0x43')][_0x7fff('0x46')]?_0x267ed2[_0x7fff('0x43')]:_0x1e4c7f[_0x7fff('0x44')];if(!_0x4afdbc[_0x7fff('0x3b')]['hasOwnProperty'](_0x7fff('0x9f'))){_0x267ed2['limit']=qs['limit'](_0x4afdbc[_0x7fff('0x3b')]['limit']);_0x267ed2['offset']=qs[_0x7fff('0x23')](_0x4afdbc[_0x7fff('0x3b')][_0x7fff('0x23')]);}_0x267ed2[_0x7fff('0xa0')]=qs[_0x7fff('0x96')](_0x4afdbc[_0x7fff('0x3b')][_0x7fff('0x96')]);_0x267ed2[_0x7fff('0x98')]=qs[_0x7fff('0x41')](_[_0x7fff('0x97')](_0x4afdbc[_0x7fff('0x3b')],_0x1e4c7f['filters']));_0x267ed2['where'][_0x7fff('0x99')]=_0x301788['id'];if(_0x4afdbc[_0x7fff('0x3b')][_0x7fff('0x9a')]){_0x267ed2[_0x7fff('0x98')]=_[_0x7fff('0x2e')](_0x267ed2['where'],{'$or':_['map'](_0x267ed2[_0x7fff('0x43')],function(_0x472859){var _0x3d5ff8={};_0x3d5ff8[_0x472859]={'$like':'%'+_0x4afdbc[_0x7fff('0x3b')][_0x7fff('0x9a')]+'%'};return _0x3d5ff8;})});}_0x267ed2[_0x7fff('0x98')]['secret']=![];if(_0x4afdbc[_0x7fff('0x3b')]['id']){_0x267ed2[_0x7fff('0x98')]['id']={'$gt':_0x4afdbc['query']['id']};}_0x267ed2=_[_0x7fff('0x2e')]({},_0x267ed2,_0x4afdbc[_0x7fff('0x49')]);return db[_0x7fff('0x5f')][_0x7fff('0x9d')]({'where':_0x267ed2[_0x7fff('0x98')]})['then'](function(_0x2f2ac7){_0x5d7cb7['count']=_0x2f2ac7;_0x267ed2[_0x7fff('0x48')]=[];if(_0x4afdbc[_0x7fff('0x3b')][_0x7fff('0xa1')]){_0x267ed2[_0x7fff('0x48')][_0x7fff('0xa2')]({'model':db['User'],'as':_0x7fff('0x7c'),'attributes':['id',_0x7fff('0x56'),_0x7fff('0x84')]});}if(_0x4afdbc['query']['includeAll']){_0x267ed2[_0x7fff('0x48')]=[{'all':!![]}];}return db[_0x7fff('0x5f')][_0x7fff('0x39')](_0x267ed2);})['then'](function(_0x4a8f98){_0x5d7cb7[_0x7fff('0x9e')]=_0x4a8f98;return _0x5d7cb7;});}})['then'](respondWithFilteredResult(_0x1a5b16,_0x267ed2))[_0x7fff('0x1e')](handleError(_0x1a5b16,null));};exports['addTags']=function(_0x4b1dcd,_0x520b84){return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x4b1dcd[_0x7fff('0x3e')]['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x520b84,null))[_0x7fff('0x29')](function(_0x43fb79){if(_0x43fb79){return _0x43fb79[_0x7fff('0xa3')](_0x4b1dcd['body']['ids'],_[_0x7fff('0xa4')](_0x4b1dcd['body'],[_0x7fff('0x93'),'id'])||{})[_0x7fff('0xa5')](function(){return db[_0x7fff('0xa6')]['findAll']({'attributes':['id',_0x7fff('0x2b'),_0x7fff('0xa7')],'where':{'id':_0x4b1dcd[_0x7fff('0x2f')][_0x7fff('0x93')]}});})['then'](function(_0x2e47ae){socket[_0x7fff('0xa8')](_0x7fff('0xa9'),{'id':Number(_0x4b1dcd[_0x7fff('0x3e')]['id']),'tags':_0x2e47ae||[]});return{'id':Number(_0x4b1dcd[_0x7fff('0x3e')]['id']),'tags':_0x2e47ae||[]};});}})[_0x7fff('0x29')](respondWithResult(_0x520b84,null))[_0x7fff('0x1e')](handleError(_0x520b84,null));};exports[_0x7fff('0xaa')]=function(_0x4db5de,_0x85136b){return db['ChatInteraction'][_0x7fff('0x4b')]({'where':{'id':_0x4db5de[_0x7fff('0x3e')]['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x85136b,null))[_0x7fff('0x29')](function(_0x5ab450){if(_0x5ab450){return _0x5ab450['removeTags'](_0x4db5de[_0x7fff('0x3b')][_0x7fff('0x93')]);}})[_0x7fff('0x29')](respondWithStatusCode(_0x85136b,null))[_0x7fff('0x1e')](handleError(_0x85136b,null));};exports[_0x7fff('0x75')]=function(_0x3cf840,_0x261a43){var _0x1b4479=moment()[_0x7fff('0xab')]()[_0x7fff('0xac')]();var _0x1c30f4=path['join'](config[_0x7fff('0x73')],_0x7fff('0xad'),'files',_0x7fff('0xae'));var _0x24c334=path[_0x7fff('0x72')](config['root'],_0x7fff('0xad'),_0x7fff('0xaf'),_0x7fff('0xb0'));var _0x50be2e=path['join'](_0x1c30f4,_0x1b4479);var _0x2622da=util['format'](_0x7fff('0xb1'),_0x3cf840['params']['id'],_0x1b4479);var _0x159c79=path[_0x7fff('0x72')](_0x1c30f4,_0x2622da);var _0x21b94e=[];_0x21b94e[_0x7fff('0xa2')]({'model':db['User'],'as':_0x7fff('0x7c'),'attributes':['id',_0x7fff('0x56')],'raw':!![]});_0x21b94e['push']({'model':db[_0x7fff('0x7d')],'as':'Contact','attributes':['id',_0x7fff('0xb2'),'lastName'],'raw':!![]});if(_0x3cf840['query'][_0x7fff('0xb0')]){_0x21b94e[_0x7fff('0xa2')]({'model':db[_0x7fff('0x70')],'as':'Attachment','raw':!![]});}var _0x33ba6a=[{'model':db[_0x7fff('0x5f')],'as':'Messages','attributes':['id',_0x7fff('0x2f'),_0x7fff('0xb3'),_0x7fff('0x87'),_0x7fff('0x88'),_0x7fff('0xb4')],'include':_0x21b94e}];_0x33ba6a[_0x7fff('0xa2')]({'model':db[_0x7fff('0x4f')],'as':'Account','attributes':['id',_0x7fff('0x2b')]});_0x33ba6a['push']({'model':db[_0x7fff('0x7c')],'as':_0x7fff('0xb5'),'attributes':['id',_0x7fff('0x56')]});return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x3cf840[_0x7fff('0x3e')]['id']},'include':_0x33ba6a})[_0x7fff('0x29')](handleEntityNotFound(_0x261a43,null))[_0x7fff('0x29')](function(_0x3f17bd){if(_0x3f17bd){var _0x1b3581=_0x3f17bd[_0x7fff('0xb6')]({'plain':!![]});fs[_0x7fff('0xb7')](_0x50be2e);var _0x4bc558={'channel':_0x7fff('0xb8'),'account':_0x1b3581[_0x7fff('0xb9')]['name'],'agent':_0x1b3581[_0x7fff('0xb5')]?_0x1b3581[_0x7fff('0xb5')]['fullname']:_0x7fff('0xba'),'createdAt':moment(_0x1b3581['createdAt'])[_0x7fff('0x78')](_0x7fff('0xbb'))['toString'](),'closedAt':_0x1b3581[_0x7fff('0x67')]?moment(_0x1b3581[_0x7fff('0xbc')])['format'](_0x7fff('0xbb'))['toString']():'','disposition':_0x1b3581[_0x7fff('0x68')],'chatInfo':{'browser':_0x1b3581[_0x7fff('0xbd')],'os':_0x1b3581[_0x7fff('0xbe')],'referer':_0x1b3581[_0x7fff('0xbf')],'customerIp':_0x1b3581[_0x7fff('0xc0')],'customerPort':_0x1b3581[_0x7fff('0xc1')]?_0x1b3581['customerPort']:_0x7fff('0xba')},'messages':_(_0x1b3581[_0x7fff('0x7b')])[_0x7fff('0xc2')]()['filter']({'secret':![]})[_0x7fff('0x35')](function(_0x1bc8ab){if(_0x1bc8ab['Attachment']){var _0x2b2d71=path[_0x7fff('0x72')](_0x24c334,_0x1bc8ab['Attachment'][_0x7fff('0x6c')]);if(fs[_0x7fff('0xc3')](_0x2b2d71)){fs['createReadStream'](_0x2b2d71)[_0x7fff('0xc4')](fs[_0x7fff('0xc5')](path['join'](_0x50be2e,_0x1bc8ab[_0x7fff('0x70')][_0x7fff('0x6c')])));}}return{'date':moment(_0x1bc8ab[_0x7fff('0xb3')])[_0x7fff('0x78')](_0x7fff('0xbb'))[_0x7fff('0xac')](),'sender':_0x1bc8ab[_0x7fff('0x87')]===_0x7fff('0xc6')?_0x1bc8ab['User']?_0x1bc8ab[_0x7fff('0x7c')]['fullname']:_0x7fff('0x85'):_0x1bc8ab[_0x7fff('0xc7')][_0x7fff('0xb2')]+(_0x1bc8ab[_0x7fff('0xc7')][_0x7fff('0xc8')]?'\x20'+_0x1bc8ab[_0x7fff('0xc7')][_0x7fff('0xc8')]:''),'body':_0x1bc8ab[_0x7fff('0x70')]?_0x1bc8ab[_0x7fff('0x70')]['basename']:_0x1bc8ab[_0x7fff('0x2f')],'direction':_0x1bc8ab[_0x7fff('0x87')]===_0x7fff('0xc6')?'A':'C','secret':_0x1bc8ab[_0x7fff('0x88')],'read':_0x1bc8ab[_0x7fff('0xb4')],'attachment':_0x1bc8ab[_0x7fff('0x70')]};})['value']()};return ejs['renderFile'](path[_0x7fff('0x72')](config[_0x7fff('0x73')],_0x7fff('0xad'),_0x7fff('0xc9'),_0x7fff('0xca')),{'interaction':_0x4bc558})['then'](function(_0x504d4d){var _0x3e1159=path['join'](_0x50be2e,_0x7fff('0xcb')+_0x1b3581['id']+'-'+_0x1b4479+_0x7fff('0xcc'));var _0x433c4e={'path':_0x3e1159,'channel':_0x7fff('0xb8'),'interactionId':_0x1b3581['id']};return pdf['createPdfFromHTML'](_0x504d4d,_0x433c4e);})[_0x7fff('0x29')](function(){return new Promise(function(_0x3ca6db,_0x1481bb){zipdir(_0x50be2e,{'saveTo':_0x159c79},function(_0x418737,_0x618339){if(_0x418737)return _0x1481bb(_0x418737);return _0x3ca6db(_0x618339);});})[_0x7fff('0x29')](function(){return new BPromise(function(_0x480ece,_0x157b7d){rimraf(_0x50be2e,function(_0x2f209d){if(_0x2f209d)_0x157b7d(_0x2f209d);return _0x480ece();});});})[_0x7fff('0x29')](function(){return _0x261a43['download'](_0x159c79,_0x2622da,function(_0x568f8b){if(_0x568f8b){logger[_0x7fff('0x1b')](_0x7fff('0xcd'),_0x568f8b);}else{fs[_0x7fff('0xce')](_0x159c79);}});});});}else{return _0x261a43['sendStatus'](0xc8);}})[_0x7fff('0x1e')](handleError(_0x261a43,null));}; \ No newline at end of file +var _0x3d7e=['entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','attachmentUpload','originalname','basename','filename','file','mimetype','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','now','Messages','User','%s%d','agentAlias','System','Visitor','ContactId','website_alias','agent_alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','intersection','hasOwnProperty','sort','where','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','nolimit','order','includeAgent','alias','addTags','setTags','Tag','emit','chatInteractionTags:save','removeTags','server','files','tmp','attachments','push','firstName','lastName','Attachment','Account','Owner','get','mkdirSync','Chat','closedAt','toString','disposition','browserName','referer','customerPort','N.A.','tail','createReadStream','pipe','createWriteStream','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','zip-dir','moment','bluebird','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','name','merge','body','contact','agent','interaction','account','index','ChatInteraction','rawAttributes','type','getOptions','findAll','chat','user','show','params','keys','query','filters','model','attributes','fields','length','includeAll','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','ValidationError','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x4b4b4e,_0x341f0c){var _0xf1a943=function(_0x36fb59){while(--_0x36fb59){_0x4b4b4e['push'](_0x4b4b4e['shift']());}};_0xf1a943(++_0x341f0c);}(_0x3d7e,0x133));var _0xe3d7=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x3d7e[_0x3df223];return _0x562d11;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe3d7('0x0'));var rp=require('request-promise');var moment=require(_0xe3d7('0x1'));var BPromise=require(_0xe3d7('0x2'));var Mustache=require(_0xe3d7('0x3'));var util=require('util');var path=require(_0xe3d7('0x4'));var ejs=require(_0xe3d7('0x5'));var fs=require('fs');var _=require(_0xe3d7('0x6'));var Redis=require(_0xe3d7('0x7'));var interaction=require(_0xe3d7('0x8'));var qs=require(_0xe3d7('0x9'));var pdf=require(_0xe3d7('0xa'));var logger=require(_0xe3d7('0xb'))(_0xe3d7('0xc'));var config=require(_0xe3d7('0xd'));var db=require(_0xe3d7('0xe'))['db'];config['redis']=_[_0xe3d7('0xf')](config['redis'],{'host':_0xe3d7('0x10'),'port':0x18eb});var socket=require(_0xe3d7('0x11'))(new Redis(config[_0xe3d7('0x12')]));require(_0xe3d7('0x13'))[_0xe3d7('0x14')](socket);var jayson=require(_0xe3d7('0x15'));var client=jayson[_0xe3d7('0x16')][_0xe3d7('0x17')]({'port':0x232b});var client9004=jayson[_0xe3d7('0x16')][_0xe3d7('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x8217e0,_0x2e5042,_0x5efa13,_0x4941fc){return new BPromise(function(_0x518fe3,_0x2a18ef){var _0x367588=_0x4941fc||client;return _0x367588[_0xe3d7('0x18')](_0x8217e0,_0x5efa13)[_0xe3d7('0x19')](function(_0x5c5db4){logger[_0xe3d7('0x1a')](_0xe3d7('0x1b'),_0x2e5042,'request\x20sent');logger['debug'](_0xe3d7('0x1c'),_0x2e5042,_0xe3d7('0x1d'),JSON[_0xe3d7('0x1e')](_0x5c5db4));if(_0x5c5db4['error']){if(_0x5c5db4[_0xe3d7('0x1f')][_0xe3d7('0x20')]===0x1f4){logger[_0xe3d7('0x1f')](_0xe3d7('0x1b'),_0x2e5042,_0x5c5db4['error'][_0xe3d7('0x21')]);return _0x2a18ef(_0x5c5db4[_0xe3d7('0x1f')][_0xe3d7('0x21')]);}logger[_0xe3d7('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x2e5042,_0x5c5db4['error'][_0xe3d7('0x21')]);return _0x518fe3(_0x5c5db4[_0xe3d7('0x1f')][_0xe3d7('0x21')]);}else{logger[_0xe3d7('0x1a')](_0xe3d7('0x1b'),_0x2e5042,_0xe3d7('0x1d'));_0x518fe3(_0x5c5db4[_0xe3d7('0x22')][_0xe3d7('0x21')]);}})[_0xe3d7('0x23')](function(_0x43ae31){logger[_0xe3d7('0x1f')](_0xe3d7('0x1b'),_0x2e5042,_0x43ae31);_0x2a18ef(_0x43ae31);});});}function respondWithStatusCode(_0x55d2ec,_0x1a0adb){_0x1a0adb=_0x1a0adb||0xcc;return function(_0x2589ec){if(_0x2589ec){return _0x55d2ec['sendStatus'](_0x1a0adb);}return _0x55d2ec[_0xe3d7('0x24')](_0x1a0adb)[_0xe3d7('0x25')]();};}function respondWithResult(_0x3d8755,_0x1a5513){_0x1a5513=_0x1a5513||0xc8;return function(_0x1a7a29){if(_0x1a7a29){return _0x3d8755[_0xe3d7('0x24')](_0x1a5513)[_0xe3d7('0x26')](_0x1a7a29);}};}function respondWithFilteredResult(_0x2aa9d8,_0x183e90){return function(_0x21bfcb){if(_0x21bfcb){var _0x20328a=typeof _0x183e90[_0xe3d7('0x27')]===_0xe3d7('0x28')&&typeof _0x183e90[_0xe3d7('0x29')]===_0xe3d7('0x28');var _0x159d05=_0x21bfcb[_0xe3d7('0x2a')];var _0x2df044=_0x20328a?0x0:_0x183e90[_0xe3d7('0x27')];var _0x2c0e5d=_0x20328a?_0x21bfcb['count']:_0x183e90[_0xe3d7('0x27')]+_0x183e90[_0xe3d7('0x29')];var _0x316ee3;if(_0x2c0e5d>=_0x159d05){_0x2c0e5d=_0x159d05;_0x316ee3=0xc8;}else{_0x316ee3=0xce;}_0x2aa9d8['status'](_0x316ee3);return _0x2aa9d8[_0xe3d7('0x2b')](_0xe3d7('0x2c'),_0x2df044+'-'+_0x2c0e5d+'/'+_0x159d05)[_0xe3d7('0x26')](_0x21bfcb);}return null;};}function saveUpdates(_0x5f30c2){return function(_0x165a29){if(_0x165a29){return _0x165a29[_0xe3d7('0x2d')](_0x5f30c2)[_0xe3d7('0x19')](function(_0x246421){return _0x246421;});}return null;};}function removeEntity(_0x545862){return function(_0x444236){if(_0x444236){return _0x444236[_0xe3d7('0x2e')]()[_0xe3d7('0x19')](function(){_0x545862[_0xe3d7('0x24')](0xcc)[_0xe3d7('0x25')]();});}};}function handleEntityNotFound(_0x4fa5f2){return function(_0x2bf64e){if(!_0x2bf64e){_0x4fa5f2[_0xe3d7('0x2f')](0x194);}return _0x2bf64e;};}function handleError(_0xcc39e9,_0x46fcf9){_0x46fcf9=_0x46fcf9||0x1f4;return function(_0x42fd61){logger['error'](_0x42fd61['stack']);if(_0x42fd61[_0xe3d7('0x30')]){delete _0x42fd61[_0xe3d7('0x30')];}_0xcc39e9[_0xe3d7('0x24')](_0x46fcf9)['send'](_0x42fd61);};}function getMustacheRender(_0xa93ba3,_0x2644f8){return Mustache['render'](_0xa93ba3,_[_0xe3d7('0x31')](_0x2644f8[_0xe3d7('0x32')],{'contact':_0x2644f8[_0xe3d7('0x33')],'message':_0x2644f8[_0xe3d7('0x21')],'agent':_0x2644f8[_0xe3d7('0x34')],'interaction':_0x2644f8[_0xe3d7('0x35')],'account':_0x2644f8[_0xe3d7('0x36')]}))||'';}exports[_0xe3d7('0x37')]=function(_0x464c01,_0x1ad0f3){var _0x3f8c46={};var _0x142be5=_['map'](db[_0xe3d7('0x38')][_0xe3d7('0x39')],function(_0x48862e){return{'name':_0x48862e['fieldName'],'type':_0x48862e[_0xe3d7('0x3a')]['key']};});_0x3f8c46=qs[_0xe3d7('0x3b')](_0x142be5,_0x464c01);return interaction[_0xe3d7('0x3c')](_0xe3d7('0x3d'),_0x464c01['query'],_0x464c01[_0xe3d7('0x3e')],_0x3f8c46,_0x142be5)[_0xe3d7('0x19')](respondWithFilteredResult(_0x1ad0f3,_0x3f8c46))[_0xe3d7('0x23')](handleError(_0x1ad0f3,null));};exports[_0xe3d7('0x3f')]=function(_0x55a53c,_0x2d3468){var _0x39b9f4={'raw':![],'where':{'id':_0x55a53c[_0xe3d7('0x40')]['id']}},_0x57a2ea={};_0x57a2ea['model']=_[_0xe3d7('0x41')](db[_0xe3d7('0x38')][_0xe3d7('0x39')]);_0x57a2ea[_0xe3d7('0x42')]=_[_0xe3d7('0x41')](_0x55a53c[_0xe3d7('0x42')]);_0x57a2ea[_0xe3d7('0x43')]=_['intersection'](_0x57a2ea[_0xe3d7('0x44')],_0x57a2ea['query']);_0x39b9f4[_0xe3d7('0x45')]=_['intersection'](_0x57a2ea[_0xe3d7('0x44')],qs['fields'](_0x55a53c[_0xe3d7('0x42')][_0xe3d7('0x46')]));_0x39b9f4[_0xe3d7('0x45')]=_0x39b9f4[_0xe3d7('0x45')][_0xe3d7('0x47')]?_0x39b9f4[_0xe3d7('0x45')]:_0x57a2ea[_0xe3d7('0x44')];if(_0x55a53c['query'][_0xe3d7('0x48')]){_0x39b9f4[_0xe3d7('0x49')]=[{'all':!![]}];}_0x39b9f4=_['merge']({},_0x39b9f4,_0x55a53c[_0xe3d7('0x4a')]);return db[_0xe3d7('0x38')][_0xe3d7('0x4b')](_0x39b9f4)[_0xe3d7('0x19')](handleEntityNotFound(_0x2d3468,null))['then'](respondWithResult(_0x2d3468,null))[_0xe3d7('0x23')](handleError(_0x2d3468,null));};exports[_0xe3d7('0x4c')]=function(_0x21e94f,_0x10b7fa){return db[_0xe3d7('0x38')]['create'](_0x21e94f[_0xe3d7('0x32')],{})[_0xe3d7('0x19')](respondWithResult(_0x10b7fa,0xc9))['catch'](handleError(_0x10b7fa,null));};exports[_0xe3d7('0x2d')]=function(_0x21e00c,_0x32deff){if(_0x21e00c[_0xe3d7('0x32')]['id']){delete _0x21e00c[_0xe3d7('0x32')]['id'];}return db[_0xe3d7('0x38')]['find']({'where':{'id':_0x21e00c[_0xe3d7('0x40')]['id']}})[_0xe3d7('0x19')](handleEntityNotFound(_0x32deff,null))[_0xe3d7('0x19')](saveUpdates(_0x21e00c[_0xe3d7('0x32')],null))['then'](respondWithResult(_0x32deff,null))[_0xe3d7('0x23')](handleError(_0x32deff,null));};exports[_0xe3d7('0x2e')]=function(_0x49b2be,_0x32f7db){return db['ChatInteraction'][_0xe3d7('0x4b')]({'where':{'id':_0x49b2be[_0xe3d7('0x40')]['id']}})['then'](handleEntityNotFound(_0x32f7db,null))[_0xe3d7('0x19')](removeEntity(_0x32f7db,null))[_0xe3d7('0x23')](handleError(_0x32f7db,null));};exports[_0xe3d7('0x4d')]=function(_0x3036ff,_0x5befd9){return db[_0xe3d7('0x38')]['describe']()['then'](respondWithResult(_0x5befd9,null))[_0xe3d7('0x23')](handleError(_0x5befd9,null));};exports[_0xe3d7('0x4e')]=function(_0x5d4644,_0x397d13){var _0x3ef358=_0x5d4644[_0xe3d7('0x40')]['id'];var _0x17fe58;var _0x3ed197;var _0x2055c2;return db[_0xe3d7('0x38')][_0xe3d7('0x4f')]({'where':{'id':_0x3ef358}})[_0xe3d7('0x19')](function(_0x687293){_0x17fe58=_0x687293;return db['ChatWebsite'][_0xe3d7('0x4f')]({'where':{'id':_0x687293[_0xe3d7('0x50')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xe3d7('0x51'),_0xe3d7('0x52'),_0xe3d7('0x53')],'raw':!![]});})['then'](function(_0x2c354b){if(_0x2c354b&&_0x2c354b[_0xe3d7('0x54')]&&_0x2c354b['vidaooEscalation']){_0x3ed197=_0x2c354b;var _0x1ad71f={'interaction':{'id':_0x3ef358},'agent':{'id':_0x5d4644[_0xe3d7('0x3e')]['id'],'name':_0x5d4644[_0xe3d7('0x3e')][_0xe3d7('0x30')],'fullname':_0x5d4644[_0xe3d7('0x3e')][_0xe3d7('0x55')],'email':_0x5d4644[_0xe3d7('0x3e')][_0xe3d7('0x56')]},'contact':_0x5d4644['body'][_0xe3d7('0x33')],'account':_0x5d4644[_0xe3d7('0x32')][_0xe3d7('0x36')]};var _0x57d18f={'rejectUnauthorized':![],'method':'POST','url':_0xe3d7('0x57'),'headers':{'X-APIKEY':_0x2c354b['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5d4644[_0xe3d7('0x3e')][_0xe3d7('0x56')]],'buttons':null,'topic':_0x3ed197['vidaooTopic'],'note':_['isNull'](_0x3ed197[_0xe3d7('0x52')])?null:getMustacheRender(_0x3ed197[_0xe3d7('0x52')],_0x1ad71f),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xe3d7('0x58')](_0x3ed197['vidaooMetadata'])){var _0x4b9300=getMustacheRender(_0x3ed197[_0xe3d7('0x53')],_0x1ad71f);var _0x113998=JSON[_0xe3d7('0x59')](_0x4b9300);_0x57d18f[_0xe3d7('0x32')][_0xe3d7('0x5a')]=_0x113998;}}catch(_0x214f82){throw new db['Sequelize']['ValidationError'](_0xe3d7('0x5b'));}return rp(_0x57d18f);}else{throw new db[(_0xe3d7('0x5c'))][(_0xe3d7('0x5d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xe3d7('0x19')](function(_0x297581){_0x2055c2=_0x297581;if(_0x2055c2['id']){var _0x25d5fb={'body':_0x2055c2['join_url'],'ChatWebsiteId':_0x3ed197['id'],'ChatInteractionId':_0x17fe58['id'],'direction':_0xe3d7('0x5e'),'UserId':_0x5d4644['user']['id']};return db[_0xe3d7('0x5f')]['create'](_0x25d5fb,{});}else{throw new db[(_0xe3d7('0x5c'))]['ValidationError'](_0xe3d7('0x60'));}})[_0xe3d7('0x19')](function(){return _0x17fe58[_0xe3d7('0x61')]({'vidaooSessionId':_0x2055c2['id']});})[_0xe3d7('0x19')](respondWithResult(_0x397d13,null))[_0xe3d7('0x23')](handleError(_0x397d13,null));};exports[_0xe3d7('0x62')]=function(_0xa76c6e,_0x3f5749){if(_0xa76c6e[_0xe3d7('0x32')]['id']){delete _0xa76c6e[_0xe3d7('0x32')]['id'];}return db[_0xe3d7('0x38')][_0xe3d7('0x4b')]({'where':{'id':_0xa76c6e[_0xe3d7('0x40')]['id']},'include':[{'model':db[_0xe3d7('0x63')],'as':_0xe3d7('0x64')}]})[_0xe3d7('0x19')](handleEntityNotFound(_0x3f5749,null))['then'](saveUpdates(_0xa76c6e[_0xe3d7('0x32')],null))['then'](respondWithResult(_0x3f5749,null))[_0xe3d7('0x23')](handleError(_0x3f5749,null));};exports[_0xe3d7('0x65')]=function(_0xa59867,_0x1ddac0){if(_0xa59867[_0xe3d7('0x32')]['id']){delete _0xa59867[_0xe3d7('0x32')]['id'];}return db[_0xe3d7('0x38')]['find']({'where':{'id':_0xa59867[_0xe3d7('0x40')]['id']}})[_0xe3d7('0x19')](function(_0x4c291e){if(!_0x4c291e){logger['error'](_0xe3d7('0x66'),_0xe3d7('0x65'),0x194,_0xe3d7('0x67'));_0x1ddac0[_0xe3d7('0x2f')](0x194);}else{if(_0x4c291e[_0xe3d7('0x68')]){throw new db[(_0xe3d7('0x5c'))][(_0xe3d7('0x5d'))](_0xe3d7('0x69'));}}return _0x4c291e;})[_0xe3d7('0x19')](function(_0x3022ed){if(_0x3022ed){return _0x3022ed['update']({'closed':_0xa59867['body'][_0xe3d7('0x6a')],'disposition':_0xa59867[_0xe3d7('0x32')]['disposition']})['then'](function(_0x37b4c0){return _0x37b4c0;});}})[_0xe3d7('0x19')](function(){return respondWithRpcPromise('AbandonInteraction',_0xe3d7('0x65'),_0xa59867[_0xe3d7('0x32')],client9004);})[_0xe3d7('0x19')](respondWithResult(_0x1ddac0,null))[_0xe3d7('0x23')](handleError(_0x1ddac0,null));};exports[_0xe3d7('0x6b')]=function(_0x1cfc67,_0x46d178){_0x1cfc67[_0xe3d7('0x32')]['name']=_0x1cfc67['file'][_0xe3d7('0x6c')];_0x1cfc67[_0xe3d7('0x32')][_0xe3d7('0x6d')]=_0x1cfc67['file'][_0xe3d7('0x6e')];_0x1cfc67[_0xe3d7('0x32')]['type']=_0x1cfc67[_0xe3d7('0x6f')][_0xe3d7('0x70')];return db['Attachment'][_0xe3d7('0x4c')](_0x1cfc67[_0xe3d7('0x32')])['then'](respondWithResult(_0x46d178,0xc9))[_0xe3d7('0x23')](handleError(_0x46d178,null));};exports[_0xe3d7('0x71')]=function(_0x54826d,_0x31578f){return db[_0xe3d7('0x38')][_0xe3d7('0x4f')]({'where':{'id':_0x54826d[_0xe3d7('0x40')]['id']},'raw':!![]})[_0xe3d7('0x19')](handleEntityNotFound(_0x31578f,null))['then'](function(_0x58faa5){if(_0x58faa5){if(_0x58faa5[_0xe3d7('0x6a')]){return _0x31578f['status'](0x193)[_0xe3d7('0x26')]({'status':0x193,'message':_0xe3d7('0x72')});}return db['Attachment'][_0xe3d7('0x4f')]({'where':{'id':_0x54826d[_0xe3d7('0x42')][_0xe3d7('0x73')]},'raw':!![]})[_0xe3d7('0x19')](handleEntityNotFound(_0x31578f,null));}})[_0xe3d7('0x19')](function(_0x23e9a3){if(_0x23e9a3){var _0x4220ba=_0x23e9a3[_0xe3d7('0x74')]!==null;var _0x1d1ab9=path['join'](config[_0xe3d7('0x75')],_0xe3d7('0x76'));if(_0x4220ba){_0x1d1ab9=path[_0xe3d7('0x77')](_0x1d1ab9,_0xe3d7('0x78'));}var _0x1b6c53=path[_0xe3d7('0x77')](_0x1d1ab9,_0x23e9a3[_0xe3d7('0x6d')]);return _0x31578f[_0xe3d7('0x79')](_0x1b6c53);}})[_0xe3d7('0x23')](handleError(_0x31578f,null));};exports[_0xe3d7('0x7a')]=function(_0x12582e,_0x28b098){var _0x2ada23=null;var _0x292d2f=null;var _0x19af44=null;if(_0x12582e['body']['id']){delete _0x12582e[_0xe3d7('0x32')]['id'];}if(_0x12582e[_0xe3d7('0x32')][_0xe3d7('0x7b')]){_0x19af44=path[_0xe3d7('0x77')](config[_0xe3d7('0x75')],_0xe3d7('0x7c'),util[_0xe3d7('0x7d')]('transcript-%s.txt',Date[_0xe3d7('0x7e')]()));_0x12582e[_0xe3d7('0x32')]['pathTranscript']=_0x19af44;}return db[_0xe3d7('0x38')]['find']({'where':{'id':_0x12582e[_0xe3d7('0x40')]['id']},'include':[{'model':db[_0xe3d7('0x5f')],'as':_0xe3d7('0x7f'),'include':[{'model':db[_0xe3d7('0x80')],'as':'User'}]}]})[_0xe3d7('0x19')](handleEntityNotFound(_0x28b098,null))[_0xe3d7('0x19')](saveUpdates(_0x12582e[_0xe3d7('0x32')],null))[_0xe3d7('0x19')](function(_0x188067){if(_0x188067){_0x2ada23=_0x188067;return db['ChatWebsite'][_0xe3d7('0x4b')]({'where':{'id':_0x2ada23['ChatWebsiteId']}});}})[_0xe3d7('0x19')](function(_0x8e9812){if(_0x8e9812){_0x292d2f=_0x8e9812;return db[_0xe3d7('0x63')][_0xe3d7('0x4b')]({'where':{'id':_0x2ada23['ContactId']}});}})[_0xe3d7('0x19')](function(_0x2ee191){if(_0x2ee191){if(_0x19af44){var _0x236da5=null;for(var _0x3cd5b0=0x1;_0x3cd5b0<_0x2ada23[_0xe3d7('0x7f')][_0xe3d7('0x47')];++_0x3cd5b0){_0x236da5=_0x2ada23[_0xe3d7('0x7f')][_0x3cd5b0];var _0x4db57e=_0x236da5['UserId']?util[_0xe3d7('0x7d')](_0xe3d7('0x81'),_0x292d2f[_0xe3d7('0x82')],_0x236da5['UserId']):_0xe3d7('0x83');var _0x5bb26c=_0x12582e[_0xe3d7('0x32')]['customer']||util[_0xe3d7('0x7d')](_0xe3d7('0x81'),_0xe3d7('0x84'),_0x236da5[_0xe3d7('0x85')]);switch(_0x292d2f['agentIdentifier']){case _0xe3d7('0x86'):_0x4db57e=_0x236da5[_0xe3d7('0x68')]?util[_0xe3d7('0x7d')]('%s%d',_0x292d2f[_0xe3d7('0x82')],_0x236da5[_0xe3d7('0x68')]):_0xe3d7('0x83');break;case _0xe3d7('0x87'):_0x4db57e=_0x236da5[_0xe3d7('0x68')]?_0x236da5[_0xe3d7('0x80')]['alias']||_0x236da5[_0xe3d7('0x80')]['fullname']:_0xe3d7('0x83');break;case _0xe3d7('0x88'):_0x4db57e=_0x236da5[_0xe3d7('0x68')]?_0x236da5[_0xe3d7('0x80')][_0xe3d7('0x55')]:_0xe3d7('0x83');break;default:_0x4db57e=_0x236da5[_0xe3d7('0x68')]?util['format']('%s%d',_0x292d2f['agentAlias'],_0x236da5['UserId']):_0xe3d7('0x83');}var _0x57e033=util[_0xe3d7('0x7d')]('[%s]\x20%s:\x20%s\x0a',moment(_0x236da5[_0xe3d7('0x89')])[_0xe3d7('0x7d')](_0xe3d7('0x8a')),_0x236da5[_0xe3d7('0x8b')]==='in'?_0x5bb26c:_0x4db57e,_0x236da5[_0xe3d7('0x32')]);if(!_0x236da5[_0xe3d7('0x8c')]){fs['appendFileSync'](_0x19af44,_0x57e033);}}return db[_0xe3d7('0x8d')][_0xe3d7('0x4f')]({'where':{'service':!![]},'include':[{'model':db[_0xe3d7('0x8e')],'as':_0xe3d7('0x8f'),'raw':!![],'include':[{'model':db[_0xe3d7('0x90')],'as':_0xe3d7('0x90'),'raw':!![]}]}]});}}})[_0xe3d7('0x19')](function(_0x1975ff){if(!_0x1975ff||!_0x1975ff[_0xe3d7('0x8f')]||!_0x12582e['body'])return _0x2ada23;var _0x32b15c=_0x1975ff[_0xe3d7('0x91')]();return respondWithRpcPromise(_0xe3d7('0x92'),_0xe3d7('0x93'),{'account':_0x32b15c,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1975ff[_0xe3d7('0x30')],_0x1975ff['email']||_0x1975ff['Smtp'][_0xe3d7('0x3e')]),'to':_0x12582e[_0xe3d7('0x32')][_0xe3d7('0x7b')],'subject':_0xe3d7('0x94'),'text':util[_0xe3d7('0x7d')](_0xe3d7('0x95'),_0x12582e['body'][_0xe3d7('0x7b')]),'attachments':[{'path':_0x19af44}]}})[_0xe3d7('0x19')](function(){return _0x2ada23;})[_0xe3d7('0x23')](function(_0x12e2f5){logger[_0xe3d7('0x1f')](_0x12e2f5);});})[_0xe3d7('0x19')](respondWithStatusCode(_0x28b098,0xc8))[_0xe3d7('0x23')](handleError(_0x28b098,null));};exports['addMessage']=function(_0x2f6a65,_0x1d3a0c){return db[_0xe3d7('0x5f')][_0xe3d7('0x4b')]({'where':{'id':_0x2f6a65[_0xe3d7('0x40')]['id']}})[_0xe3d7('0x19')](handleEntityNotFound(_0x1d3a0c,null))['then'](function(_0xfbe9e5){if(_0xfbe9e5){return _0xfbe9e5[_0xe3d7('0x96')](_0x2f6a65['body'][_0xe3d7('0x97')],_[_0xe3d7('0x98')](_0x2f6a65['body'],['ids','id'])||{});}})[_0xe3d7('0x19')](respondWithResult(_0x1d3a0c,null))[_0xe3d7('0x23')](handleError(_0x1d3a0c,null));};exports[_0xe3d7('0x99')]=function(_0x1a1711,_0x434abd){var _0x23bead={'raw':![],'where':{}};var _0x4881c8={};var _0x3ed29b={'count':0x0,'rows':[]};return db[_0xe3d7('0x38')][_0xe3d7('0x4f')]({'where':{'id':_0x1a1711['params']['id']}})[_0xe3d7('0x19')](handleEntityNotFound(_0x434abd,null))[_0xe3d7('0x19')](function(_0x284d27){if(_0x284d27){_0x4881c8['model']=_['keys'](db[_0xe3d7('0x5f')]['rawAttributes']);_0x4881c8[_0xe3d7('0x42')]=_[_0xe3d7('0x41')](_0x1a1711['query']);_0x4881c8[_0xe3d7('0x43')]=_[_0xe3d7('0x9a')](_0x4881c8[_0xe3d7('0x44')],_0x4881c8[_0xe3d7('0x42')]);_0x23bead[_0xe3d7('0x45')]=_[_0xe3d7('0x9a')](_0x4881c8['model'],qs['fields'](_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x46')]));_0x23bead[_0xe3d7('0x45')]=_0x23bead[_0xe3d7('0x45')][_0xe3d7('0x47')]?_0x23bead['attributes']:_0x4881c8[_0xe3d7('0x44')];if(!_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x9b')]('nolimit')){_0x23bead[_0xe3d7('0x29')]=qs[_0xe3d7('0x29')](_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x29')]);_0x23bead['offset']=qs[_0xe3d7('0x27')](_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x27')]);}_0x23bead['order']=qs[_0xe3d7('0x9c')](_0x1a1711['query'][_0xe3d7('0x9c')]);_0x23bead[_0xe3d7('0x9d')]=qs[_0xe3d7('0x43')](_['pick'](_0x1a1711[_0xe3d7('0x42')],_0x4881c8[_0xe3d7('0x43')]));_0x23bead[_0xe3d7('0x9d')][_0xe3d7('0x9e')]=_0x284d27['id'];if(_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x9f')]){_0x23bead[_0xe3d7('0x9d')]=_[_0xe3d7('0x31')](_0x23bead['where'],{'$or':_['map'](_0x23bead[_0xe3d7('0x45')],function(_0x1eab8d){var _0x192a4b={};_0x192a4b[_0x1eab8d]={'$like':'%'+_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x9f')]+'%'};return _0x192a4b;})});}if(_0x1a1711['query'][_0xe3d7('0xa0')]){var _0x26484b=_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0xa0')]['split'](',');var _0x2a0eed={};_0x2a0eed[_0x26484b[0x0]]={'$gte':moment(_0x26484b[0x1])[_0xe3d7('0x7d')](_0xe3d7('0xa1'))};_0x23bead['where']=_['merge'](_0x23bead['where'],_0x2a0eed);}_0x23bead=_[_0xe3d7('0x31')]({},_0x23bead,_0x1a1711['options']);return db['ChatMessage'][_0xe3d7('0x2a')]({'where':_0x23bead[_0xe3d7('0x9d')]})[_0xe3d7('0x19')](function(_0x3f402c){_0x3ed29b[_0xe3d7('0x2a')]=_0x3f402c;if(_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x48')]){_0x23bead[_0xe3d7('0x49')]=[{'all':!![]}];}return db[_0xe3d7('0x5f')][_0xe3d7('0x3c')](_0x23bead);})['then'](function(_0x21e252){_0x3ed29b[_0xe3d7('0xa2')]=_0x21e252;return _0x3ed29b;});}})['then'](respondWithFilteredResult(_0x434abd,_0x23bead))[_0xe3d7('0x23')](handleError(_0x434abd,null));};exports[_0xe3d7('0xa3')]=function(_0x404053,_0x242949){var _0x5ae2db={'where':{}},_0x30c228={},_0xe35f4={'count':0x0,'rows':[]};return db[_0xe3d7('0x38')][_0xe3d7('0x4f')]({'where':{'id':_0x404053[_0xe3d7('0x40')]['id']}})[_0xe3d7('0x19')](handleEntityNotFound(_0x242949,null))['then'](function(_0x39ac3d){if(_0x39ac3d){_0x30c228['model']=_['keys'](db[_0xe3d7('0x5f')][_0xe3d7('0x39')]);_0x30c228[_0xe3d7('0x42')]=_[_0xe3d7('0x41')](_0x404053[_0xe3d7('0x42')]);_0x30c228['filters']=_['intersection'](_0x30c228[_0xe3d7('0x44')],_0x30c228[_0xe3d7('0x42')]);_0x5ae2db[_0xe3d7('0x45')]=_[_0xe3d7('0x9a')](_0x30c228[_0xe3d7('0x44')],qs[_0xe3d7('0x46')](_0x404053[_0xe3d7('0x42')][_0xe3d7('0x46')]));_0x5ae2db[_0xe3d7('0x45')]=_0x5ae2db[_0xe3d7('0x45')][_0xe3d7('0x47')]?_0x5ae2db[_0xe3d7('0x45')]:_0x30c228[_0xe3d7('0x44')];if(!_0x404053[_0xe3d7('0x42')][_0xe3d7('0x9b')](_0xe3d7('0xa4'))){_0x5ae2db[_0xe3d7('0x29')]=qs[_0xe3d7('0x29')](_0x404053[_0xe3d7('0x42')][_0xe3d7('0x29')]);_0x5ae2db[_0xe3d7('0x27')]=qs[_0xe3d7('0x27')](_0x404053[_0xe3d7('0x42')]['offset']);}_0x5ae2db[_0xe3d7('0xa5')]=qs[_0xe3d7('0x9c')](_0x404053[_0xe3d7('0x42')]['sort']);_0x5ae2db['where']=qs[_0xe3d7('0x43')](_['pick'](_0x404053[_0xe3d7('0x42')],_0x30c228[_0xe3d7('0x43')]));_0x5ae2db[_0xe3d7('0x9d')][_0xe3d7('0x9e')]=_0x39ac3d['id'];if(_0x404053[_0xe3d7('0x42')]['filter']){_0x5ae2db[_0xe3d7('0x9d')]=_['merge'](_0x5ae2db[_0xe3d7('0x9d')],{'$or':_['map'](_0x5ae2db[_0xe3d7('0x45')],function(_0x2e1d5c){var _0x4e3acd={};_0x4e3acd[_0x2e1d5c]={'$like':'%'+_0x404053[_0xe3d7('0x42')][_0xe3d7('0x9f')]+'%'};return _0x4e3acd;})});}_0x5ae2db['where'][_0xe3d7('0x8c')]=![];if(_0x404053['query']['id']){_0x5ae2db['where']['id']={'$gt':_0x404053[_0xe3d7('0x42')]['id']};}_0x5ae2db=_[_0xe3d7('0x31')]({},_0x5ae2db,_0x404053[_0xe3d7('0x4a')]);return db[_0xe3d7('0x5f')][_0xe3d7('0x2a')]({'where':_0x5ae2db[_0xe3d7('0x9d')]})[_0xe3d7('0x19')](function(_0x22a518){_0xe35f4[_0xe3d7('0x2a')]=_0x22a518;_0x5ae2db['include']=[];if(_0x404053[_0xe3d7('0x42')][_0xe3d7('0xa6')]){_0x5ae2db[_0xe3d7('0x49')]['push']({'model':db['User'],'as':'User','attributes':['id',_0xe3d7('0x55'),_0xe3d7('0xa7')]});}if(_0x404053[_0xe3d7('0x42')][_0xe3d7('0x48')]){_0x5ae2db[_0xe3d7('0x49')]=[{'all':!![]}];}return db[_0xe3d7('0x5f')][_0xe3d7('0x3c')](_0x5ae2db);})[_0xe3d7('0x19')](function(_0x22a42d){_0xe35f4[_0xe3d7('0xa2')]=_0x22a42d;return _0xe35f4;});}})['then'](respondWithFilteredResult(_0x242949,_0x5ae2db))[_0xe3d7('0x23')](handleError(_0x242949,null));};exports[_0xe3d7('0xa8')]=function(_0x3022c4,_0x5cd74b){return db[_0xe3d7('0x38')]['find']({'where':{'id':_0x3022c4[_0xe3d7('0x40')]['id']}})['then'](handleEntityNotFound(_0x5cd74b,null))[_0xe3d7('0x19')](function(_0x1cb3c5){if(_0x1cb3c5){return _0x1cb3c5[_0xe3d7('0xa9')](_0x3022c4[_0xe3d7('0x32')][_0xe3d7('0x97')],_[_0xe3d7('0x98')](_0x3022c4[_0xe3d7('0x32')],['ids','id'])||{})['spread'](function(){return db[_0xe3d7('0xaa')][_0xe3d7('0x3c')]({'attributes':['id',_0xe3d7('0x30'),'color'],'where':{'id':_0x3022c4['body'][_0xe3d7('0x97')]}});})['then'](function(_0x49de37){socket[_0xe3d7('0xab')](_0xe3d7('0xac'),{'id':Number(_0x3022c4['params']['id']),'tags':_0x49de37||[]});return{'id':Number(_0x3022c4[_0xe3d7('0x40')]['id']),'tags':_0x49de37||[]};});}})['then'](respondWithResult(_0x5cd74b,null))[_0xe3d7('0x23')](handleError(_0x5cd74b,null));};exports[_0xe3d7('0xad')]=function(_0x258982,_0x3f500c){return db[_0xe3d7('0x38')][_0xe3d7('0x4b')]({'where':{'id':_0x258982[_0xe3d7('0x40')]['id']}})['then'](handleEntityNotFound(_0x3f500c,null))[_0xe3d7('0x19')](function(_0x3faa22){if(_0x3faa22){return _0x3faa22[_0xe3d7('0xad')](_0x258982[_0xe3d7('0x42')][_0xe3d7('0x97')]);}})[_0xe3d7('0x19')](respondWithStatusCode(_0x3f500c,null))[_0xe3d7('0x23')](handleError(_0x3f500c,null));};exports[_0xe3d7('0x79')]=function(_0x1acf73,_0x304340){var _0xdef376=moment()['unix']()['toString']();var _0x50be80=path[_0xe3d7('0x77')](config[_0xe3d7('0x75')],_0xe3d7('0xae'),_0xe3d7('0xaf'),_0xe3d7('0xb0'));var _0x274b8c=path[_0xe3d7('0x77')](config[_0xe3d7('0x75')],_0xe3d7('0xae'),_0xe3d7('0xaf'),_0xe3d7('0xb1'));var _0x3cc87e=path[_0xe3d7('0x77')](_0x50be80,_0xdef376);var _0x28d423=util[_0xe3d7('0x7d')]('transcript-%d-%s.zip',_0x1acf73['params']['id'],_0xdef376);var _0xe78852=path['join'](_0x50be80,_0x28d423);var _0x31ae0e=[];_0x31ae0e[_0xe3d7('0xb2')]({'model':db[_0xe3d7('0x80')],'as':_0xe3d7('0x80'),'attributes':['id',_0xe3d7('0x55')],'raw':!![]});_0x31ae0e[_0xe3d7('0xb2')]({'model':db['CmContact'],'as':_0xe3d7('0x64'),'attributes':['id',_0xe3d7('0xb3'),_0xe3d7('0xb4')],'raw':!![]});if(_0x1acf73[_0xe3d7('0x42')][_0xe3d7('0xb1')]){_0x31ae0e[_0xe3d7('0xb2')]({'model':db[_0xe3d7('0xb5')],'as':'Attachment','raw':!![]});}var _0x1ab073=[{'model':db[_0xe3d7('0x5f')],'as':_0xe3d7('0x7f'),'attributes':['id','body',_0xe3d7('0x89'),_0xe3d7('0x8b'),_0xe3d7('0x8c'),'read'],'include':_0x31ae0e}];_0x1ab073[_0xe3d7('0xb2')]({'model':db['ChatWebsite'],'as':_0xe3d7('0xb6'),'attributes':['id',_0xe3d7('0x30')]});_0x1ab073[_0xe3d7('0xb2')]({'model':db['User'],'as':_0xe3d7('0xb7'),'attributes':['id',_0xe3d7('0x55')]});return db[_0xe3d7('0x38')][_0xe3d7('0x4b')]({'where':{'id':_0x1acf73[_0xe3d7('0x40')]['id']},'include':_0x1ab073})['then'](handleEntityNotFound(_0x304340,null))[_0xe3d7('0x19')](function(_0x4f0d21){if(_0x4f0d21){var _0x1a25d9=_0x4f0d21[_0xe3d7('0xb8')]({'plain':!![]});fs[_0xe3d7('0xb9')](_0x3cc87e);var _0x3a35ab={'channel':_0xe3d7('0xba'),'account':_0x1a25d9[_0xe3d7('0xb6')][_0xe3d7('0x30')],'agent':_0x1a25d9[_0xe3d7('0xb7')]?_0x1a25d9[_0xe3d7('0xb7')][_0xe3d7('0x55')]:'N.A.','createdAt':moment(_0x1a25d9[_0xe3d7('0x89')])[_0xe3d7('0x7d')](_0xe3d7('0xa1'))['toString'](),'closedAt':_0x1a25d9['closed']?moment(_0x1a25d9[_0xe3d7('0xbb')])['format'](_0xe3d7('0xa1'))[_0xe3d7('0xbc')]():'','disposition':_0x1a25d9[_0xe3d7('0xbd')],'chatInfo':{'browser':_0x1a25d9[_0xe3d7('0xbe')],'os':_0x1a25d9['osName'],'referer':_0x1a25d9[_0xe3d7('0xbf')],'customerIp':_0x1a25d9['customerIp'],'customerPort':_0x1a25d9[_0xe3d7('0xc0')]?_0x1a25d9[_0xe3d7('0xc0')]:_0xe3d7('0xc1')},'messages':_(_0x1a25d9[_0xe3d7('0x7f')])[_0xe3d7('0xc2')]()[_0xe3d7('0x9f')]({'secret':![]})['map'](function(_0x416a57){if(_0x416a57[_0xe3d7('0xb5')]){var _0x5aa021=path['join'](_0x274b8c,_0x416a57['Attachment'][_0xe3d7('0x6d')]);if(fs['existsSync'](_0x5aa021)){fs[_0xe3d7('0xc3')](_0x5aa021)[_0xe3d7('0xc4')](fs[_0xe3d7('0xc5')](path[_0xe3d7('0x77')](_0x3cc87e,_0x416a57[_0xe3d7('0xb5')]['basename'])));}}return{'date':moment(_0x416a57[_0xe3d7('0x89')])['format'](_0xe3d7('0xa1'))[_0xe3d7('0xbc')](),'sender':_0x416a57[_0xe3d7('0x8b')]===_0xe3d7('0x5e')?_0x416a57[_0xe3d7('0x80')]?_0x416a57[_0xe3d7('0x80')][_0xe3d7('0x55')]:_0xe3d7('0x83'):_0x416a57[_0xe3d7('0x64')][_0xe3d7('0xb3')]+(_0x416a57['Contact']['lastName']?'\x20'+_0x416a57['Contact'][_0xe3d7('0xb4')]:''),'body':_0x416a57[_0xe3d7('0xb5')]?_0x416a57['Attachment'][_0xe3d7('0x6d')]:_0x416a57['body'],'direction':_0x416a57[_0xe3d7('0x8b')]===_0xe3d7('0x5e')?'A':'C','secret':_0x416a57[_0xe3d7('0x8c')],'read':_0x416a57['read'],'attachment':_0x416a57[_0xe3d7('0xb5')]};})[_0xe3d7('0xc6')]()};return ejs['renderFile'](path[_0xe3d7('0x77')](config[_0xe3d7('0x75')],_0xe3d7('0xae'),_0xe3d7('0xc7'),_0xe3d7('0xc8')),{'interaction':_0x3a35ab})[_0xe3d7('0x19')](function(_0x798f9e){var _0x30be1b=path[_0xe3d7('0x77')](_0x3cc87e,_0xe3d7('0xc9')+_0x1a25d9['id']+'-'+_0xdef376+_0xe3d7('0xca'));var _0x1e39f4={'path':_0x30be1b,'channel':_0xe3d7('0xba'),'interactionId':_0x1a25d9['id']};return pdf[_0xe3d7('0xcb')](_0x798f9e,_0x1e39f4);})[_0xe3d7('0x19')](function(){return new Promise(function(_0x460708,_0x209a70){zipdir(_0x3cc87e,{'saveTo':_0xe78852},function(_0x34eef1,_0x1c766f){if(_0x34eef1)return _0x209a70(_0x34eef1);return _0x460708(_0x1c766f);});})['then'](function(){return new BPromise(function(_0x1dd09d,_0x5ceac5){rimraf(_0x3cc87e,function(_0x46a526){if(_0x46a526)_0x5ceac5(_0x46a526);return _0x1dd09d();});});})[_0xe3d7('0x19')](function(){return _0x304340[_0xe3d7('0x79')](_0xe78852,_0x28d423,function(_0x38bd23){if(_0x38bd23){logger[_0xe3d7('0x1f')]('err',_0x38bd23);}else{fs[_0xe3d7('0xcc')](_0xe78852);}});});});}else{return _0x304340['sendStatus'](0xc8);}})[_0xe3d7('0x23')](handleError(_0x304340,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 38d6566..8a29c1d 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 _0xec0a=['ChatMessage','setMaxListeners','update','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x218c0c,_0x2b21e3){var _0xf0347d=function(_0xb3b51c){while(--_0xb3b51c){_0x218c0c['push'](_0x218c0c['shift']());}};_0xf0347d(++_0x2b21e3);}(_0xec0a,0x17e));var _0xaec0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xec0a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xaec0('0x0'));var ChatInteraction=require(_0xaec0('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xaec0('0x1'))['db'][_0xaec0('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xaec0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaec0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f4c58){return function(_0x2e5ea7,_0x9495ef,_0x239765){_0x2e5ea7[_0xaec0('0x5')]({'attributes':['id'],'raw':!![]})[_0xaec0('0x6')](function(_0x4cbd60){_0x2e5ea7[_0xaec0('0x7')]('Users',_0x4cbd60['map'](function(_0x12db3e){return{'id':_0x12db3e['id']};}));return ChatMessage[_0xaec0('0x8')]({'where':{'ChatInteractionId':_0x2e5ea7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x8cd841){_0x2e5ea7[_0xaec0('0x7')](_0xaec0('0x9'),_0x8cd841[_0xaec0('0xa')]);ChatInteractionEvents[_0xaec0('0xb')](_0x5f4c58+':'+_0x2e5ea7['id'],_0x2e5ea7);ChatInteractionEvents[_0xaec0('0xb')](_0x5f4c58,_0x2e5ea7);_0x239765(null);})[_0xaec0('0xc')](_0x239765(null));};}for(var e in events){if(events[_0xaec0('0xd')](e)){var event=events[e];ChatInteraction[_0xaec0('0xe')](e,emitEvent(event));}}module[_0xaec0('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xd563=['update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x74e673,_0x15b0c7){var _0x479ed8=function(_0x2f5e98){while(--_0x2f5e98){_0x74e673['push'](_0x74e673['shift']());}};_0x479ed8(++_0x15b0c7);}(_0xd563,0x182));var _0x3d56=function(_0x5670f2,_0x1ce340){_0x5670f2=_0x5670f2-0x0;var _0x1f8715=_0xd563[_0x5670f2];return _0x1f8715;};'use strict';var EventEmitter=require(_0x3d56('0x0'));var ChatInteraction=require(_0x3d56('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x3d56('0x1'))['db'][_0x3d56('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3d56('0x3')](0x0);var events={'afterCreate':_0x3d56('0x4'),'afterUpdate':_0x3d56('0x5'),'afterDestroy':_0x3d56('0x6')};function emitEvent(_0x13642a){return function(_0x57fad5,_0x5f2f77,_0x58bc46){_0x57fad5[_0x3d56('0x7')]({'attributes':['id'],'raw':!![]})[_0x3d56('0x8')](function(_0x17572f){_0x57fad5[_0x3d56('0x9')](_0x3d56('0xa'),_0x17572f['map'](function(_0x1179db){return{'id':_0x1179db['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x57fad5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3d56('0x8')](function(_0x215aed){_0x57fad5['setDataValue'](_0x3d56('0xb'),_0x215aed[_0x3d56('0xc')]);ChatInteractionEvents[_0x3d56('0xd')](_0x13642a+':'+_0x57fad5['id'],_0x57fad5);ChatInteractionEvents[_0x3d56('0xd')](_0x13642a,_0x57fad5);_0x58bc46(null);})[_0x3d56('0xe')](_0x58bc46(null));};}for(var e in events){if(events[_0x3d56('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x3d56('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ab22805..d2d8050 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 _0xd85b=['request-promise','rimraf','../../config/environment','exports','define','ChatInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x2acb93,_0x419a08){var _0x50ffbd=function(_0x34c094){while(--_0x34c094){_0x2acb93['push'](_0x2acb93['shift']());}};_0x50ffbd(++_0x419a08);}(_0xd85b,0xfb));var _0xbd85=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd85b[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbd85('0x0'))(_0xbd85('0x1'));var moment=require(_0xbd85('0x2'));var BPromise=require(_0xbd85('0x3'));var rp=require(_0xbd85('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd85('0x5'));var config=require(_0xbd85('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xbd85('0x7')]=function(_0xaa5286,_0x4b7294){return _0xaa5286[_0xbd85('0x8')](_0xbd85('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8b7c06,_0x3c9ad9,_0x4f2065){if(_0x8b7c06[_0xbd85('0xa')](_0xbd85('0xb'))){_0x8b7c06[_0xbd85('0xc')]=moment()[_0xbd85('0xd')](_0xbd85('0xe'));}_0x4f2065(null,_0x8b7c06);}},'charset':_0xbd85('0xf'),'collate':_0xbd85('0x10')});}; \ No newline at end of file +var _0xb5d3=['path','rimraf','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x366783,_0x339fd8){var _0x3562b7=function(_0x29b013){while(--_0x29b013){_0x366783['push'](_0x366783['shift']());}};_0x3562b7(++_0x339fd8);}(_0xb5d3,0xa2));var _0x3b5d=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0xb5d3[_0x2e913b];return _0x173899;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3b5d('0x0'))(_0x3b5d('0x1'));var moment=require(_0x3b5d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b5d('0x3'));var rimraf=require(_0x3b5d('0x4'));var config=require('../../config/environment');var attributes=require(_0x3b5d('0x5'));module['exports']=function(_0x510b41,_0x15a7ad){return _0x510b41[_0x3b5d('0x6')](_0x3b5d('0x7'),attributes,{'tableName':_0x3b5d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51d9d4,_0x2966ef,_0x3d2cf0){if(_0x51d9d4['changed'](_0x3b5d('0x9'))){_0x51d9d4[_0x3b5d('0xa')]=moment()[_0x3b5d('0xb')](_0x3b5d('0xc'));}_0x3d2cf0(null,_0x51d9d4);}},'charset':_0x3b5d('0xd'),'collate':_0x3b5d('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 4093051..cbfff7f 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 _0x75ad=['localhost','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','find','addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5520bf,_0x30866b){var _0x3c5ef2=function(_0x1bcc23){while(--_0x1bcc23){_0x5520bf['push'](_0x5520bf['shift']());}};_0x3c5ef2(++_0x30866b);}(_0x75ad,0xc4));var _0xd75a=function(_0x4b6ec2,_0x13725c){_0x4b6ec2=_0x4b6ec2-0x0;var _0x3fe2c5=_0x75ad[_0x4b6ec2];return _0x3fe2c5;};'use strict';var _=require(_0xd75a('0x0'));var util=require(_0xd75a('0x1'));var moment=require(_0xd75a('0x2'));var BPromise=require(_0xd75a('0x3'));var rs=require(_0xd75a('0x4'));var fs=require('fs');var Redis=require(_0xd75a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd75a('0x6'));var logger=require(_0xd75a('0x7'))(_0xd75a('0x8'));var config=require(_0xd75a('0x9'));var jayson=require(_0xd75a('0xa'));var client=jayson[_0xd75a('0xb')][_0xd75a('0xc')]({'port':0x232a});config[_0xd75a('0xd')]=_['defaults'](config[_0xd75a('0xd')],{'host':_0xd75a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd75a('0xd')]));require(_0xd75a('0xf'))[_0xd75a('0x10')](socket);function respondWithRpcPromise(_0x166cd4,_0x3b8610,_0x513455){return new BPromise(function(_0xb36732,_0x202e5a){return client['request'](_0x166cd4,_0x513455)[_0xd75a('0x11')](function(_0x44a98e){logger[_0xd75a('0x12')](_0xd75a('0x13'),_0x3b8610,_0xd75a('0x14'));logger[_0xd75a('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3b8610,_0xd75a('0x14'),JSON[_0xd75a('0x16')](_0x44a98e));if(_0x44a98e['error']){if(_0x44a98e[_0xd75a('0x17')][_0xd75a('0x18')]===0x1f4){logger['error'](_0xd75a('0x13'),_0x3b8610,_0x44a98e['error'][_0xd75a('0x19')]);return _0x202e5a(_0x44a98e[_0xd75a('0x17')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3b8610,_0x44a98e[_0xd75a('0x17')][_0xd75a('0x19')]);return _0xb36732(_0x44a98e[_0xd75a('0x17')][_0xd75a('0x19')]);}else{logger[_0xd75a('0x12')](_0xd75a('0x13'),_0x3b8610,_0xd75a('0x14'));_0xb36732(_0x44a98e[_0xd75a('0x1a')][_0xd75a('0x19')]);}})['catch'](function(_0x457c8f){logger[_0xd75a('0x17')](_0xd75a('0x13'),_0x3b8610,_0x457c8f);_0x202e5a(_0x457c8f);});});}exports[_0xd75a('0x1b')]=function(_0x5d7279){var _0xe3ae73=this;return new Promise(function(_0x4e76d5,_0x494489){return db[_0xd75a('0x1c')][_0xd75a('0x1d')](_0x5d7279[_0xd75a('0x1e')],{'raw':_0x5d7279[_0xd75a('0x1f')]?_0x5d7279[_0xd75a('0x1f')][_0xd75a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d7279[_0xd75a('0x1f')]?_0x5d7279[_0xd75a('0x1f')][_0xd75a('0x21')]||null:null,'attributes':_0x5d7279[_0xd75a('0x1f')]?_0x5d7279['options'][_0xd75a('0x22')]||null:null,'limit':_0x5d7279[_0xd75a('0x1f')]?_0x5d7279['options'][_0xd75a('0x23')]||null:null})['then'](function(_0x5b6ebb){logger[_0xd75a('0x12')](_0xd75a('0x1b'),_0x5d7279);logger[_0xd75a('0x15')]('UpdateChatInteraction',_0x5d7279,JSON[_0xd75a('0x16')](_0x5b6ebb));_0x4e76d5(_0x5b6ebb);})[_0xd75a('0x24')](function(_0x24feb8){logger[_0xd75a('0x17')](_0xd75a('0x1b'),_0x24feb8['message'],_0x5d7279);_0x494489(_0xe3ae73[_0xd75a('0x17')](0x1f4,_0x24feb8[_0xd75a('0x19')]));});});};exports[_0xd75a('0x25')]=function(_0xe55f98){return new Promise(function(_0x4d67af,_0x283c1a){return db['ChatInteraction'][_0xd75a('0x26')]({'where':_0xe55f98['options']?_0xe55f98[_0xd75a('0x1f')][_0xd75a('0x21')]||null:null})[_0xd75a('0x11')](function(_0xfcbb10){if(_0xfcbb10){return _0xfcbb10[_0xd75a('0x27')](_0xe55f98[_0xd75a('0x1e')][_0xd75a('0x28')],_['omit'](_0xe55f98[_0xd75a('0x1e')],[_0xd75a('0x28'),'id'])||{});}})['spread'](function(_0x4af248){logger[_0xd75a('0x12')](_0xd75a('0x29'),_0xe55f98);logger[_0xd75a('0x15')](_0xd75a('0x29'),_0xe55f98,JSON[_0xd75a('0x16')](_0x4af248));_0x4d67af(_0x4af248);})[_0xd75a('0x24')](function(_0x1a2a28){logger[_0xd75a('0x17')](_0xd75a('0x29'),_0x1a2a28['message'],_0xe55f98);_0x283c1a(_this[_0xd75a('0x17')](0x1f4,_0x1a2a28['message']));});});}; \ No newline at end of file +var _0x1117=['ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','catch','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x46ef1d,_0x24926){var _0x49ce69=function(_0x5db4fc){while(--_0x5db4fc){_0x46ef1d['push'](_0x46ef1d['shift']());}};_0x49ce69(++_0x24926);}(_0x1117,0x117));var _0x7111=function(_0x458eef,_0x551783){_0x458eef=_0x458eef-0x0;var _0x2fb384=_0x1117[_0x458eef];return _0x2fb384;};'use strict';var _=require('lodash');var util=require(_0x7111('0x0'));var moment=require(_0x7111('0x1'));var BPromise=require(_0x7111('0x2'));var rs=require(_0x7111('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7111('0x4'))['db'];var utils=require(_0x7111('0x5'));var logger=require('../../config/logger')(_0x7111('0x6'));var config=require(_0x7111('0x7'));var jayson=require(_0x7111('0x8'));var client=jayson[_0x7111('0x9')][_0x7111('0xa')]({'port':0x232a});config[_0x7111('0xb')]=_[_0x7111('0xc')](config[_0x7111('0xb')],{'host':_0x7111('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7111('0xb')]));require(_0x7111('0xe'))[_0x7111('0xf')](socket);function respondWithRpcPromise(_0x22794c,_0xfb969c,_0x1f3988){return new BPromise(function(_0x39e9d7,_0x16549e){return client[_0x7111('0x10')](_0x22794c,_0x1f3988)[_0x7111('0x11')](function(_0x157181){logger[_0x7111('0x12')](_0x7111('0x13'),_0xfb969c,_0x7111('0x14'));logger[_0x7111('0x15')](_0x7111('0x16'),_0xfb969c,_0x7111('0x14'),JSON[_0x7111('0x17')](_0x157181));if(_0x157181[_0x7111('0x18')]){if(_0x157181[_0x7111('0x18')][_0x7111('0x19')]===0x1f4){logger[_0x7111('0x18')](_0x7111('0x13'),_0xfb969c,_0x157181[_0x7111('0x18')]['message']);return _0x16549e(_0x157181[_0x7111('0x18')][_0x7111('0x1a')]);}logger['error'](_0x7111('0x13'),_0xfb969c,_0x157181[_0x7111('0x18')][_0x7111('0x1a')]);return _0x39e9d7(_0x157181[_0x7111('0x18')][_0x7111('0x1a')]);}else{logger[_0x7111('0x12')](_0x7111('0x13'),_0xfb969c,_0x7111('0x14'));_0x39e9d7(_0x157181[_0x7111('0x1b')][_0x7111('0x1a')]);}})['catch'](function(_0x45cde5){logger[_0x7111('0x18')](_0x7111('0x13'),_0xfb969c,_0x45cde5);_0x16549e(_0x45cde5);});});}exports[_0x7111('0x1c')]=function(_0x3f620e){var _0x29e27b=this;return new Promise(function(_0x346579,_0x250bd0){return db[_0x7111('0x1d')][_0x7111('0x1e')](_0x3f620e[_0x7111('0x1f')],{'raw':_0x3f620e[_0x7111('0x20')]?_0x3f620e[_0x7111('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f620e[_0x7111('0x20')]?_0x3f620e['options'][_0x7111('0x21')]||null:null,'attributes':_0x3f620e[_0x7111('0x20')]?_0x3f620e[_0x7111('0x20')][_0x7111('0x22')]||null:null,'limit':_0x3f620e['options']?_0x3f620e[_0x7111('0x20')][_0x7111('0x23')]||null:null})[_0x7111('0x11')](function(_0x1bca1f){logger[_0x7111('0x12')](_0x7111('0x1c'),_0x3f620e);logger['debug'](_0x7111('0x1c'),_0x3f620e,JSON['stringify'](_0x1bca1f));_0x346579(_0x1bca1f);})[_0x7111('0x24')](function(_0x251f22){logger['error'](_0x7111('0x1c'),_0x251f22[_0x7111('0x1a')],_0x3f620e);_0x250bd0(_0x29e27b[_0x7111('0x18')](0x1f4,_0x251f22['message']));});});};exports[_0x7111('0x25')]=function(_0x1f3f30){return new Promise(function(_0x278afa,_0x9ad464){return db['ChatInteraction'][_0x7111('0x26')]({'where':_0x1f3f30[_0x7111('0x20')]?_0x1f3f30[_0x7111('0x20')][_0x7111('0x21')]||null:null})[_0x7111('0x11')](function(_0x24277d){if(_0x24277d){return _0x24277d[_0x7111('0x27')](_0x1f3f30[_0x7111('0x1f')][_0x7111('0x28')],_[_0x7111('0x29')](_0x1f3f30[_0x7111('0x1f')],[_0x7111('0x28'),'id'])||{});}})['spread'](function(_0xfcfd8d){logger[_0x7111('0x12')](_0x7111('0x2a'),_0x1f3f30);logger[_0x7111('0x15')](_0x7111('0x2a'),_0x1f3f30,JSON[_0x7111('0x17')](_0xfcfd8d));_0x278afa(_0xfcfd8d);})[_0x7111('0x24')](function(_0x39df17){logger[_0x7111('0x18')](_0x7111('0x2a'),_0x39df17[_0x7111('0x1a')],_0x1f3f30);_0x9ad464(_this[_0x7111('0x18')](0x1f4,_0x39df17[_0x7111('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 15c8143..0db110e 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 _0x0064=['remove','update','removeListener','register','length','chatInteraction:','save'];(function(_0x3d8240,_0x2663d4){var _0x3d0372=function(_0xc47c6b){while(--_0xc47c6b){_0x3d8240['push'](_0x3d8240['shift']());}};_0x3d0372(++_0x2663d4);}(_0x0064,0x68));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4006('0x0'),_0x4006('0x1'),_0x4006('0x2')];function createListener(_0x24571d,_0x4022ac){return function(_0x221755){_0x4022ac['emit'](_0x24571d,_0x221755);};}function removeListener(_0x212654,_0x5643a9){return function(){ChatInteractionEvents[_0x4006('0x3')](_0x212654,_0x5643a9);};}exports[_0x4006('0x4')]=function(_0x14aaa5){for(var _0x2544c3=0x0,_0x5d86c6=events[_0x4006('0x5')];_0x2544c3<_0x5d86c6;_0x2544c3++){var _0x28792a=events[_0x2544c3];var _0x165e0b=createListener(_0x4006('0x6')+_0x28792a,_0x14aaa5);ChatInteractionEvents['on'](_0x28792a,_0x165e0b);}}; \ No newline at end of file +var _0x5d9d=['length','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x3c7db0,_0x5a8f48){var _0x4e1435=function(_0x5367fe){while(--_0x5367fe){_0x3c7db0['push'](_0x3c7db0['shift']());}};_0x4e1435(++_0x5a8f48);}(_0x5d9d,0x101));var _0xd5d9=function(_0x4c3f98,_0x30a8a6){_0x4c3f98=_0x4c3f98-0x0;var _0x54612c=_0x5d9d[_0x4c3f98];return _0x54612c;};'use strict';var ChatInteractionEvents=require(_0xd5d9('0x0'));var events=[_0xd5d9('0x1'),_0xd5d9('0x2'),_0xd5d9('0x3')];function createListener(_0x1c1b10,_0x21a891){return function(_0x5ea221){_0x21a891[_0xd5d9('0x4')](_0x1c1b10,_0x5ea221);};}function removeListener(_0x2bc6a1,_0x44f8e2){return function(){ChatInteractionEvents[_0xd5d9('0x5')](_0x2bc6a1,_0x44f8e2);};}exports[_0xd5d9('0x6')]=function(_0x1233dc){for(var _0x2c489e=0x0,_0x3833fe=events[_0xd5d9('0x7')];_0x2c489e<_0x3833fe;_0x2c489e++){var _0x211416=events[_0x2c489e];var _0x2a673a=createListener('chatInteraction:'+_0x211416,_0x1233dc);ChatInteractionEvents['on'](_0x211416,_0x2a673a);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 3ec59ab..765c7b9 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 _0x201e=['getMyMessages','/:id/download','post','createVidaooSession','diskStorage','join','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','/:id/messages','addMessage','/:id/tags','tracked','chat','addTags','/:id','chatinteraction:update','update','put','/:id/custom_update','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','getMessages','/:id/my_messages'];(function(_0x2bc810,_0x4a1300){var _0x56b881=function(_0x447fa2){while(--_0x447fa2){_0x2bc810['push'](_0x2bc810['shift']());}};_0x56b881(++_0x4a1300);}(_0x201e,0xb0));var _0xe201=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x201e[_0x1a9204];return _0x17ca68;};'use strict';var multer=require('multer');var util=require(_0xe201('0x0'));var path=require(_0xe201('0x1'));var timeout=require(_0xe201('0x2'));var express=require(_0xe201('0x3'));var router=express[_0xe201('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe201('0x5'));var interaction=require(_0xe201('0x6'));var config=require(_0xe201('0x7'));var controller=require('./chatInteraction.controller');router[_0xe201('0x8')]('/',auth[_0xe201('0x9')](),controller[_0xe201('0xa')]);router[_0xe201('0x8')](_0xe201('0xb'),auth[_0xe201('0x9')](),controller[_0xe201('0xc')]);router[_0xe201('0x8')]('/:id',auth[_0xe201('0xd')](),controller['show']);router[_0xe201('0x8')]('/:id/attachment_download',auth[_0xe201('0xd')](),controller['attachmentDownload']);router[_0xe201('0x8')]('/:id/messages',auth[_0xe201('0x9')](),controller[_0xe201('0xe')]);router[_0xe201('0x8')](_0xe201('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xe201('0x10')]);router[_0xe201('0x8')](_0xe201('0x11'),auth[_0xe201('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe201('0x12')]('/:id/vidaoo',auth[_0xe201('0x9')](),controller[_0xe201('0x13')]);var upload=multer({'storage':multer[_0xe201('0x14')]({'destination':function(_0x333f35,_0x20d444,_0x8aa5b4){_0x8aa5b4(null,path[_0xe201('0x15')](config['root'],_0xe201('0x16')));},'filename':function(_0x3e96cc,_0x570461,_0x2a6306){_0x2a6306(null,util[_0xe201('0x17')]('%s-%s',Date[_0xe201('0x18')](),_0x570461[_0xe201('0x19')][_0xe201('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe201('0x12')](_0xe201('0x1b'),upload[_0xe201('0x1c')]('file'),controller['attachmentUpload']);router['post'](_0xe201('0x1d'),auth[_0xe201('0xd')](),controller[_0xe201('0x1e')]);router[_0xe201('0x12')](_0xe201('0x1f'),auth[_0xe201('0x9')](),interaction[_0xe201('0x20')](_0xe201('0x21'),'chatinteraction:addtags'),controller[_0xe201('0x22')]);router['put'](_0xe201('0x23'),auth['isAuthenticated'](),interaction[_0xe201('0x20')]('chat',_0xe201('0x24')),controller[_0xe201('0x25')]);router[_0xe201('0x26')](_0xe201('0x27'),controller['customUpdate']);router[_0xe201('0x26')](_0xe201('0x28'),auth[_0xe201('0xd')](),controller['abandon']);router[_0xe201('0x26')](_0xe201('0x29'),controller[_0xe201('0x2a')]);router[_0xe201('0x2b')](_0xe201('0x23'),auth[_0xe201('0x9')](),interaction[_0xe201('0x20')](_0xe201('0x21'),_0xe201('0x2c')),controller[_0xe201('0x2d')]);router[_0xe201('0x2b')](_0xe201('0x1f'),auth['isAuthenticated'](),controller[_0xe201('0x2e')]);module[_0xe201('0x2f')]=router; \ No newline at end of file +var _0xb983=['tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','now','originalname','replace','single','file','attachmentUpload','/:id/tags'];(function(_0x44d9f8,_0xd9f940){var _0x310b84=function(_0x5f3990){while(--_0x5f3990){_0x44d9f8['push'](_0x44d9f8['shift']());}};_0x310b84(++_0xd9f940);}(_0xb983,0xdb));var _0x3b98=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0xb983[_0x5447aa];return _0xb21e53;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3b98('0x0'));var timeout=require(_0x3b98('0x1'));var express=require(_0x3b98('0x2'));var router=express[_0x3b98('0x3')]();var fs_extra=require(_0x3b98('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3b98('0x5'));var config=require(_0x3b98('0x6'));var controller=require(_0x3b98('0x7'));router[_0x3b98('0x8')]('/',auth[_0x3b98('0x9')](),controller[_0x3b98('0xa')]);router['get'](_0x3b98('0xb'),auth[_0x3b98('0x9')](),controller['describe']);router['get'](_0x3b98('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x3b98('0xd')]);router[_0x3b98('0x8')](_0x3b98('0xe'),auth[_0x3b98('0xf')](),controller[_0x3b98('0x10')]);router['get'](_0x3b98('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0x3b98('0x8')](_0x3b98('0x12'),auth[_0x3b98('0xf')](),controller[_0x3b98('0x13')]);router[_0x3b98('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x3b98('0x14')]);router[_0x3b98('0x15')]('/',auth[_0x3b98('0x9')](),controller[_0x3b98('0x16')]);router[_0x3b98('0x15')](_0x3b98('0x17'),auth['isAuthenticated'](),controller[_0x3b98('0x18')]);var upload=multer({'storage':multer[_0x3b98('0x19')]({'destination':function(_0x543741,_0x2b89ec,_0x1d0969){_0x1d0969(null,path['join'](config[_0x3b98('0x1a')],_0x3b98('0x1b')));},'filename':function(_0x30c44d,_0x304bbf,_0xb06b40){_0xb06b40(null,util[_0x3b98('0x1c')]('%s-%s',Date[_0x3b98('0x1d')](),_0x304bbf[_0x3b98('0x1e')][_0x3b98('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3b98('0x15')]('/:id/attachment_upload',upload[_0x3b98('0x20')](_0x3b98('0x21')),controller[_0x3b98('0x22')]);router['post']('/:id/messages',auth[_0x3b98('0xf')](),controller['addMessage']);router['post'](_0x3b98('0x23'),auth[_0x3b98('0x9')](),interaction[_0x3b98('0x24')](_0x3b98('0x25'),_0x3b98('0x26')),controller[_0x3b98('0x27')]);router['put']('/:id',auth[_0x3b98('0x9')](),interaction[_0x3b98('0x24')](_0x3b98('0x25'),'chatinteraction:update'),controller['update']);router[_0x3b98('0x28')](_0x3b98('0x29'),controller[_0x3b98('0x2a')]);router[_0x3b98('0x28')](_0x3b98('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0x3b98('0x2c')]);router[_0x3b98('0x28')](_0x3b98('0x2d'),controller[_0x3b98('0x2e')]);router[_0x3b98('0x2f')]('/:id',auth[_0x3b98('0x9')](),interaction[_0x3b98('0x24')]('chat',_0x3b98('0x30')),controller[_0x3b98('0x31')]);router['delete'](_0x3b98('0x23'),auth['isAuthenticated'](),controller['removeTags']);module[_0x3b98('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index cf00b05..e078b77 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 _0x3a0d=['INTEGER','medium','BOOLEAN'];(function(_0x31b59c,_0x136fc7){var _0x56db60=function(_0x38f02e){while(--_0x38f02e){_0x31b59c['push'](_0x31b59c['shift']());}};_0x56db60(++_0x136fc7);}(_0x3a0d,0x14b));var _0xd3a0=function(_0x4a1196,_0x21e0c3){_0x4a1196=_0x4a1196-0x0;var _0x58604e=_0x3a0d[_0x4a1196];return _0x58604e;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xd3a0('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0xd3a0('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xd3a0('0x2')]}}; \ No newline at end of file +var _0x5a80=['TEXT','BOOLEAN','sequelize'];(function(_0x331f32,_0x194684){var _0x462529=function(_0x301e9c){while(--_0x301e9c){_0x331f32['push'](_0x331f32['shift']());}};_0x462529(++_0x194684);}(_0x5a80,0xf5));var _0x05a8=function(_0x2571f6,_0x555e23){_0x2571f6=_0x2571f6-0x0;var _0x24e6d7=_0x5a80[_0x2571f6];return _0x24e6d7;};'use strict';var Sequelize=require(_0x05a8('0x0'));module['exports']={'body':{'type':Sequelize[_0x05a8('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x05a8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index d367817..428c680 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 _0xe285=['redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','apply','save','update','then','destroy','stack','name','index','map','ChatInternalMessage','fieldName','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','describe','get','messages','lastMessageAt','format','getUsers','findAll','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2bcddb,_0x3eaf37){var _0x12a9e8=function(_0xeeb678){while(--_0xeeb678){_0x2bcddb['push'](_0x2bcddb['shift']());}};_0x12a9e8(++_0x3eaf37);}(_0xe285,0x19a));var _0x5e28=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xe285[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require(_0x5e28('0x0'));var rimraf=require(_0x5e28('0x1'));var zipdir=require(_0x5e28('0x2'));var jsonpatch=require(_0x5e28('0x3'));var rp=require(_0x5e28('0x4'));var moment=require(_0x5e28('0x5'));var BPromise=require(_0x5e28('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5e28('0x7'));var sox=require(_0x5e28('0x8'));var csv=require(_0x5e28('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e28('0xa'));var _=require(_0x5e28('0xb'));var squel=require(_0x5e28('0xc'));var crypto=require(_0x5e28('0xd'));var jsforce=require(_0x5e28('0xe'));var deskjs=require(_0x5e28('0xf'));var toCsv=require(_0x5e28('0x9'));var querystring=require('querystring');var Papa=require(_0x5e28('0x10'));var Redis=require(_0x5e28('0x11'));var authService=require(_0x5e28('0x12'));var qs=require(_0x5e28('0x13'));var as=require(_0x5e28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e28('0x15'))(_0x5e28('0x16'));var utils=require(_0x5e28('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5e28('0x18'));var db=require(_0x5e28('0x19'))['db'];config[_0x5e28('0x1a')]=_[_0x5e28('0x1b')](config[_0x5e28('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e28('0x1c'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x5e28('0x1d')](socket);function respondWithStatusCode(_0x486c03,_0x17cea6){_0x17cea6=_0x17cea6||0xcc;return function(_0x20d197){if(_0x20d197){return _0x486c03[_0x5e28('0x1e')](_0x17cea6);}return _0x486c03[_0x5e28('0x1f')](_0x17cea6)[_0x5e28('0x20')]();};}function respondWithResult(_0x3af812,_0xf74a7f){_0xf74a7f=_0xf74a7f||0xc8;return function(_0x50ea92){if(_0x50ea92){return _0x3af812[_0x5e28('0x1f')](_0xf74a7f)['json'](_0x50ea92);}};}function respondWithFilteredResult(_0x5308bb,_0x455bab){return function(_0x4be1b9){if(_0x4be1b9){var _0x4e7d05=typeof _0x455bab[_0x5e28('0x21')]===_0x5e28('0x22')&&typeof _0x455bab['limit']===_0x5e28('0x22');var _0x10e5dd=_0x4be1b9[_0x5e28('0x23')];var _0x252ce3=_0x4e7d05?0x0:_0x455bab[_0x5e28('0x21')];var _0x229d40=_0x4e7d05?_0x4be1b9[_0x5e28('0x23')]:_0x455bab[_0x5e28('0x21')]+_0x455bab[_0x5e28('0x24')];var _0x3ddfd1;if(_0x229d40>=_0x10e5dd){_0x229d40=_0x10e5dd;_0x3ddfd1=0xc8;}else{_0x3ddfd1=0xce;}_0x5308bb[_0x5e28('0x1f')](_0x3ddfd1);return _0x5308bb['set']('Content-Range',_0x252ce3+'-'+_0x229d40+'/'+_0x10e5dd)['json'](_0x4be1b9);}return null;};}function patchUpdates(_0x485388){return function(_0x25762d){try{jsonpatch[_0x5e28('0x25')](_0x25762d,_0x485388,!![]);}catch(_0x28b28b){return BPromise['reject'](_0x28b28b);}return _0x25762d[_0x5e28('0x26')]();};}function saveUpdates(_0x461b86,_0x1da8cc){return function(_0x1f3e9f){if(_0x1f3e9f){return _0x1f3e9f[_0x5e28('0x27')](_0x461b86)[_0x5e28('0x28')](function(_0x531595){return _0x531595;});}return null;};}function removeEntity(_0x11bee5,_0x51e9bf){return function(_0x2ea05a){if(_0x2ea05a){return _0x2ea05a[_0x5e28('0x29')]()['then'](function(){_0x11bee5[_0x5e28('0x1f')](0xcc)[_0x5e28('0x20')]();});}};}function handleEntityNotFound(_0x5e7144,_0x528921){return function(_0xcb8b60){if(!_0xcb8b60){_0x5e7144[_0x5e28('0x1e')](0x194);}return _0xcb8b60;};}function handleError(_0x353a3b,_0x419c61){_0x419c61=_0x419c61||0x1f4;return function(_0x4a9036){logger['error'](_0x4a9036[_0x5e28('0x2a')]);if(_0x4a9036[_0x5e28('0x2b')]){delete _0x4a9036[_0x5e28('0x2b')];}_0x353a3b[_0x5e28('0x1f')](_0x419c61)['send'](_0x4a9036);};}exports[_0x5e28('0x2c')]=function(_0x152315,_0xbc7ddf){var _0x554939={},_0x3d1091={},_0x1c15a3={'count':0x0,'rows':[]};var _0x25b512=_[_0x5e28('0x2d')](db[_0x5e28('0x2e')]['rawAttributes'],function(_0x497652){return{'name':_0x497652[_0x5e28('0x2f')],'type':_0x497652['type']['key']};});_0x3d1091[_0x5e28('0x30')]=_['map'](_0x25b512,'name');_0x3d1091['query']=_[_0x5e28('0x31')](_0x152315['query']);_0x3d1091[_0x5e28('0x32')]=_[_0x5e28('0x33')](_0x3d1091['model'],_0x3d1091[_0x5e28('0x34')]);_0x554939['attributes']=_[_0x5e28('0x33')](_0x3d1091[_0x5e28('0x30')],qs[_0x5e28('0x35')](_0x152315[_0x5e28('0x34')]['fields']));_0x554939['attributes']=_0x554939[_0x5e28('0x36')][_0x5e28('0x37')]?_0x554939['attributes']:_0x3d1091['model'];if(!_0x152315[_0x5e28('0x34')][_0x5e28('0x38')](_0x5e28('0x39'))){_0x554939[_0x5e28('0x24')]=qs[_0x5e28('0x24')](_0x152315['query'][_0x5e28('0x24')]);_0x554939[_0x5e28('0x21')]=qs[_0x5e28('0x21')](_0x152315[_0x5e28('0x34')][_0x5e28('0x21')]);}_0x554939['order']=qs[_0x5e28('0x3a')](_0x152315[_0x5e28('0x34')][_0x5e28('0x3a')]);_0x554939['where']=qs[_0x5e28('0x32')](_[_0x5e28('0x3b')](_0x152315[_0x5e28('0x34')],_0x3d1091[_0x5e28('0x32')]),_0x25b512);if(_0x152315[_0x5e28('0x34')]['filter']){_0x554939[_0x5e28('0x3c')]=_[_0x5e28('0x3d')](_0x554939[_0x5e28('0x3c')],{'$or':_['map'](_0x25b512,function(_0x113c62){if(_0x113c62[_0x5e28('0x3e')]!==_0x5e28('0x3f')){var _0x58522e={};_0x58522e[_0x113c62[_0x5e28('0x2b')]]={'$like':'%'+_0x152315['query'][_0x5e28('0x40')]+'%'};return _0x58522e;}})});}_0x554939=_[_0x5e28('0x3d')]({},_0x554939,_0x152315[_0x5e28('0x41')]);var _0x3ecb3d={'where':_0x554939[_0x5e28('0x3c')]};return db[_0x5e28('0x2e')][_0x5e28('0x23')](_0x3ecb3d)['then'](function(_0x26bb37){_0x1c15a3[_0x5e28('0x23')]=_0x26bb37;if(_0x152315[_0x5e28('0x34')][_0x5e28('0x42')]){_0x554939[_0x5e28('0x43')]=[{'all':!![]}];}return db[_0x5e28('0x2e')]['findAll'](_0x554939);})[_0x5e28('0x28')](function(_0x1e681b){_0x1c15a3[_0x5e28('0x44')]=_0x1e681b;return _0x1c15a3;})[_0x5e28('0x28')](respondWithFilteredResult(_0xbc7ddf,_0x554939))[_0x5e28('0x45')](handleError(_0xbc7ddf,null));};exports[_0x5e28('0x46')]=function(_0x31cdff,_0x52ac7a){var _0x22c82d={'raw':!![],'where':{'id':_0x31cdff[_0x5e28('0x47')]['id']}},_0x68eaff={};_0x68eaff['model']=_[_0x5e28('0x31')](db[_0x5e28('0x2e')]['rawAttributes']);_0x68eaff[_0x5e28('0x34')]=_['keys'](_0x31cdff[_0x5e28('0x34')]);_0x68eaff[_0x5e28('0x32')]=_[_0x5e28('0x33')](_0x68eaff[_0x5e28('0x30')],_0x68eaff[_0x5e28('0x34')]);_0x22c82d[_0x5e28('0x36')]=_[_0x5e28('0x33')](_0x68eaff[_0x5e28('0x30')],qs[_0x5e28('0x35')](_0x31cdff[_0x5e28('0x34')][_0x5e28('0x35')]));_0x22c82d[_0x5e28('0x36')]=_0x22c82d[_0x5e28('0x36')]['length']?_0x22c82d['attributes']:_0x68eaff[_0x5e28('0x30')];if(_0x31cdff[_0x5e28('0x34')][_0x5e28('0x42')]){_0x22c82d['include']=[{'all':!![]}];}_0x22c82d=_[_0x5e28('0x3d')]({},_0x22c82d,_0x31cdff[_0x5e28('0x41')]);return db[_0x5e28('0x2e')][_0x5e28('0x48')](_0x22c82d)[_0x5e28('0x28')](handleEntityNotFound(_0x52ac7a,null))['then'](respondWithResult(_0x52ac7a,null))[_0x5e28('0x45')](handleError(_0x52ac7a,null));};exports[_0x5e28('0x49')]=function(_0x41579c,_0x47372f){return db[_0x5e28('0x2e')]['create'](_0x41579c['body'],{})['then'](respondWithResult(_0x47372f,0xc9))[_0x5e28('0x45')](handleError(_0x47372f,null));};exports['update']=function(_0x431958,_0x268f42){if(_0x431958[_0x5e28('0x4a')]['id']){delete _0x431958[_0x5e28('0x4a')]['id'];}return db['ChatInternalMessage'][_0x5e28('0x48')]({'where':{'id':_0x431958['params']['id']}})[_0x5e28('0x28')](handleEntityNotFound(_0x268f42,null))[_0x5e28('0x28')](saveUpdates(_0x431958[_0x5e28('0x4a')],null))[_0x5e28('0x28')](respondWithResult(_0x268f42,null))[_0x5e28('0x45')](handleError(_0x268f42,null));};exports[_0x5e28('0x29')]=function(_0xb4b1ad,_0x3da50d){return db[_0x5e28('0x2e')][_0x5e28('0x48')]({'where':{'id':_0xb4b1ad[_0x5e28('0x47')]['id']}})[_0x5e28('0x28')](handleEntityNotFound(_0x3da50d,null))[_0x5e28('0x28')](removeEntity(_0x3da50d,null))[_0x5e28('0x45')](handleError(_0x3da50d,null));};exports[_0x5e28('0x4b')]=function(_0x4035a0,_0x8cb609){return db[_0x5e28('0x2e')]['describe']()[_0x5e28('0x28')](respondWithResult(_0x8cb609,null))['catch'](handleError(_0x8cb609,null));};function wrapUser(_0x2107ae){return function(_0x5293f3){var _0x278d45=_0x2107ae[_0x5e28('0x4c')]({'plain':!![]});_0x278d45[_0x5e28('0x4d')]=[];if(_0x5293f3){_0x278d45[_0x5e28('0x4e')]=_0x5293f3['createdAt'];_0x278d45['lastMessage']=_0x5293f3;}else{_0x278d45['lastMessageAt']=moment(0x0)[_0x5e28('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x278d45['lastMessage']={};}return _0x278d45;};}exports[_0x5e28('0x50')]=function(_0x3dbc95,_0x532549,_0x3183b2){var _0x1b01a6=[];return db['User'][_0x5e28('0x51')]({'where':{'role':[_0x5e28('0x52'),_0x5e28('0x53'),_0x5e28('0x54')]},'attributes':['id',_0x5e28('0x55'),_0x5e28('0x2b'),_0x5e28('0x56'),_0x5e28('0x57'),_0x5e28('0x58'),_0x5e28('0x59'),_0x5e28('0x5a'),_0x5e28('0x5b'),_0x5e28('0x5c')],'order':qs['sort'](_0x5e28('0x5d')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x5e28('0x2b'),_0x5e28('0x3e')],'through':{'attributes':[]}}]})['then'](function(_0x22e6c3){if(_0x22e6c3){var _0x404567=_0x3dbc95[_0x5e28('0x54')][_0x5e28('0x4c')]({'plain':!![]});if(!_0x404567)throw new Error(_0x5e28('0x5e'));if(_0x404567[_0x5e28('0x56')]===_0x5e28('0x54')){return db[_0x5e28('0x5f')][_0x5e28('0x48')]({'where':{'name':_0x5e28('0x60'),'userProfileId':_0x404567[_0x5e28('0x61')]},'raw':!![]})[_0x5e28('0x28')](function(_0x2e1cac){if(_0x2e1cac){if(_0x2e1cac[_0x5e28('0x62')]===0x0){return db[_0x5e28('0x63')][_0x5e28('0x51')]({'where':{'sectionId':_0x2e1cac['id']},'raw':!![]})[_0x5e28('0x28')](function(_0x46e3c5){var _0x5a3095=[];if(_[_0x5e28('0x64')](_0x46e3c5)){_0x5a3095=_[_0x5e28('0x40')](_0x22e6c3,function(_0x543740){if(_0x543740[_0x5e28('0x56')]!==_0x5e28('0x52')){return _0x543740;}});return _0x5a3095;}else{for(var _0x2e9e11=0x0;_0x2e9e11<_0x22e6c3[_0x5e28('0x37')];_0x2e9e11++){var _0x41348e=_0x22e6c3[_0x2e9e11];if(_0x41348e[_0x5e28('0x56')]===_0x5e28('0x52')){var _0x3da5d8=_['find'](_0x46e3c5,function(_0xc135ab){return _0xc135ab[_0x5e28('0x65')]===_0x41348e['id'];});if(_0x3da5d8)_0x5a3095['push'](_0x41348e);}else{_0x5a3095[_0x5e28('0x66')](_0x41348e);}}return _0x5a3095;}});}else{return _0x22e6c3;}}else{var _0x330227=_[_0x5e28('0x40')](_0x22e6c3,function(_0x29aaa5){if(_0x29aaa5[_0x5e28('0x56')]!==_0x5e28('0x52')){return _0x29aaa5;}});return _0x330227;}});}else{return _0x22e6c3;}}})[_0x5e28('0x28')](function(_0x176ca4){var _0x2364f2=[];if(_0x176ca4){_0x1b01a6=_0x176ca4;for(var _0x135b81=0x0;_0x135b81<_0x176ca4[_0x5e28('0x37')];_0x135b81+=0x1){_0x1b01a6[_0x135b81][_0x5e28('0x4d')]=[];_0x2364f2['push'](db[_0x5e28('0x2e')]['find']({'where':{'FromId':[_0x3dbc95[_0x5e28('0x54')]['id'],_0x176ca4[_0x135b81]['id']],'ToId':[_0x3dbc95['user']['id'],_0x176ca4[_0x135b81]['id']],'ChatGroupId':null},'attributes':['id',_0x5e28('0x67'),_0x5e28('0x68'),_0x5e28('0x69'),_0x5e28('0x6a'),_0x5e28('0x4a')],'order':qs[_0x5e28('0x3a')](_0x5e28('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5e28('0x28')](wrapUser(_0x176ca4[_0x135b81])));}return BPromise[_0x5e28('0x6c')](_0x2364f2);}return[];})[_0x5e28('0x28')](function(_0x10acb2){return{'rows':_0x10acb2,'count':_0x10acb2['length']};})[_0x5e28('0x28')](respondWithResult(_0x532549,null))['catch'](handleError(_0x532549,null));}; \ No newline at end of file +var _0x9d32=['admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','findAll','isEmpty','resourceId','push','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','ChatInternalMessage','includeAll','include','rows','catch','params','options','create','body','update','find','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent'];(function(_0xff1f6a,_0x4f6b5c){var _0x13673a=function(_0x3fd516){while(--_0x3fd516){_0xff1f6a['push'](_0xff1f6a['shift']());}};_0x13673a(++_0x4f6b5c);}(_0x9d32,0xff));var _0x29d3=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0x9d32[_0x30abff];return _0x4c571e;};'use strict';var emlformat=require(_0x29d3('0x0'));var rimraf=require(_0x29d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29d3('0x2'));var rp=require(_0x29d3('0x3'));var moment=require('moment');var BPromise=require(_0x29d3('0x4'));var Mustache=require('mustache');var util=require(_0x29d3('0x5'));var path=require(_0x29d3('0x6'));var sox=require(_0x29d3('0x7'));var csv=require(_0x29d3('0x8'));var ejs=require(_0x29d3('0x9'));var fs=require('fs');var fs_extra=require(_0x29d3('0xa'));var _=require('lodash');var squel=require(_0x29d3('0xb'));var crypto=require(_0x29d3('0xc'));var jsforce=require(_0x29d3('0xd'));var deskjs=require(_0x29d3('0xe'));var toCsv=require(_0x29d3('0x8'));var querystring=require(_0x29d3('0xf'));var Papa=require('papaparse');var Redis=require(_0x29d3('0x10'));var authService=require(_0x29d3('0x11'));var qs=require(_0x29d3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29d3('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x29d3('0x14'));var config=require(_0x29d3('0x15'));var licenseUtil=require(_0x29d3('0x16'));var db=require(_0x29d3('0x17'))['db'];config[_0x29d3('0x18')]=_[_0x29d3('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x29d3('0x1a'))(new Redis(config[_0x29d3('0x18')]));require(_0x29d3('0x1b'))[_0x29d3('0x1c')](socket);function respondWithStatusCode(_0x1a97ec,_0x3a8681){_0x3a8681=_0x3a8681||0xcc;return function(_0x260d83){if(_0x260d83){return _0x1a97ec[_0x29d3('0x1d')](_0x3a8681);}return _0x1a97ec[_0x29d3('0x1e')](_0x3a8681)[_0x29d3('0x1f')]();};}function respondWithResult(_0x246138,_0x2705bc){_0x2705bc=_0x2705bc||0xc8;return function(_0x47074c){if(_0x47074c){return _0x246138[_0x29d3('0x1e')](_0x2705bc)[_0x29d3('0x20')](_0x47074c);}};}function respondWithFilteredResult(_0x32aa16,_0x8e2d4b){return function(_0x448912){if(_0x448912){var _0x3564a7=typeof _0x8e2d4b[_0x29d3('0x21')]===_0x29d3('0x22')&&typeof _0x8e2d4b['limit']==='undefined';var _0x19cf2c=_0x448912[_0x29d3('0x23')];var _0x345296=_0x3564a7?0x0:_0x8e2d4b[_0x29d3('0x21')];var _0x3c4090=_0x3564a7?_0x448912[_0x29d3('0x23')]:_0x8e2d4b[_0x29d3('0x21')]+_0x8e2d4b[_0x29d3('0x24')];var _0x325287;if(_0x3c4090>=_0x19cf2c){_0x3c4090=_0x19cf2c;_0x325287=0xc8;}else{_0x325287=0xce;}_0x32aa16['status'](_0x325287);return _0x32aa16[_0x29d3('0x25')](_0x29d3('0x26'),_0x345296+'-'+_0x3c4090+'/'+_0x19cf2c)[_0x29d3('0x20')](_0x448912);}return null;};}function patchUpdates(_0x2b4c60){return function(_0x8c56aa){try{jsonpatch[_0x29d3('0x27')](_0x8c56aa,_0x2b4c60,!![]);}catch(_0x31d4c4){return BPromise[_0x29d3('0x28')](_0x31d4c4);}return _0x8c56aa[_0x29d3('0x29')]();};}function saveUpdates(_0x3a60c0,_0xd1e9dd){return function(_0xaf86bc){if(_0xaf86bc){return _0xaf86bc['update'](_0x3a60c0)[_0x29d3('0x2a')](function(_0x190214){return _0x190214;});}return null;};}function removeEntity(_0x1b0541,_0x5eb7c6){return function(_0x4ae44d){if(_0x4ae44d){return _0x4ae44d[_0x29d3('0x2b')]()[_0x29d3('0x2a')](function(){_0x1b0541[_0x29d3('0x1e')](0xcc)[_0x29d3('0x1f')]();});}};}function handleEntityNotFound(_0x507cdf,_0x463a76){return function(_0x5ee4e8){if(!_0x5ee4e8){_0x507cdf[_0x29d3('0x1d')](0x194);}return _0x5ee4e8;};}function handleError(_0x58df45,_0x1b5833){_0x1b5833=_0x1b5833||0x1f4;return function(_0x43c658){logger[_0x29d3('0x2c')](_0x43c658['stack']);if(_0x43c658[_0x29d3('0x2d')]){delete _0x43c658[_0x29d3('0x2d')];}_0x58df45[_0x29d3('0x1e')](_0x1b5833)['send'](_0x43c658);};}exports[_0x29d3('0x2e')]=function(_0x3b61c9,_0x55fbf0){var _0x1bb61a={},_0x321928={},_0x35970c={'count':0x0,'rows':[]};var _0x4f0b4f=_[_0x29d3('0x2f')](db['ChatInternalMessage'][_0x29d3('0x30')],function(_0x1c0430){return{'name':_0x1c0430[_0x29d3('0x31')],'type':_0x1c0430[_0x29d3('0x32')][_0x29d3('0x33')]};});_0x321928[_0x29d3('0x34')]=_['map'](_0x4f0b4f,'name');_0x321928[_0x29d3('0x35')]=_[_0x29d3('0x36')](_0x3b61c9[_0x29d3('0x35')]);_0x321928[_0x29d3('0x37')]=_[_0x29d3('0x38')](_0x321928[_0x29d3('0x34')],_0x321928[_0x29d3('0x35')]);_0x1bb61a['attributes']=_[_0x29d3('0x38')](_0x321928[_0x29d3('0x34')],qs[_0x29d3('0x39')](_0x3b61c9['query'][_0x29d3('0x39')]));_0x1bb61a[_0x29d3('0x3a')]=_0x1bb61a['attributes'][_0x29d3('0x3b')]?_0x1bb61a[_0x29d3('0x3a')]:_0x321928[_0x29d3('0x34')];if(!_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x3c')](_0x29d3('0x3d'))){_0x1bb61a[_0x29d3('0x24')]=qs[_0x29d3('0x24')](_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x24')]);_0x1bb61a['offset']=qs[_0x29d3('0x21')](_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x21')]);}_0x1bb61a['order']=qs[_0x29d3('0x3e')](_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x3e')]);_0x1bb61a[_0x29d3('0x3f')]=qs[_0x29d3('0x37')](_[_0x29d3('0x40')](_0x3b61c9[_0x29d3('0x35')],_0x321928[_0x29d3('0x37')]),_0x4f0b4f);if(_0x3b61c9[_0x29d3('0x35')]['filter']){_0x1bb61a['where']=_[_0x29d3('0x41')](_0x1bb61a[_0x29d3('0x3f')],{'$or':_['map'](_0x4f0b4f,function(_0x438afb){if(_0x438afb[_0x29d3('0x32')]!==_0x29d3('0x42')){var _0x295708={};_0x295708[_0x438afb[_0x29d3('0x2d')]]={'$like':'%'+_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x43')]+'%'};return _0x295708;}})});}_0x1bb61a=_[_0x29d3('0x41')]({},_0x1bb61a,_0x3b61c9['options']);var _0x4bb49a={'where':_0x1bb61a[_0x29d3('0x3f')]};return db[_0x29d3('0x44')]['count'](_0x4bb49a)[_0x29d3('0x2a')](function(_0x30a637){_0x35970c[_0x29d3('0x23')]=_0x30a637;if(_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x45')]){_0x1bb61a[_0x29d3('0x46')]=[{'all':!![]}];}return db[_0x29d3('0x44')]['findAll'](_0x1bb61a);})[_0x29d3('0x2a')](function(_0x5c9025){_0x35970c[_0x29d3('0x47')]=_0x5c9025;return _0x35970c;})[_0x29d3('0x2a')](respondWithFilteredResult(_0x55fbf0,_0x1bb61a))[_0x29d3('0x48')](handleError(_0x55fbf0,null));};exports['show']=function(_0x491a3d,_0x2a1cdc){var _0x112f9e={'raw':!![],'where':{'id':_0x491a3d[_0x29d3('0x49')]['id']}},_0x5d9b0c={};_0x5d9b0c[_0x29d3('0x34')]=_[_0x29d3('0x36')](db[_0x29d3('0x44')][_0x29d3('0x30')]);_0x5d9b0c['query']=_['keys'](_0x491a3d['query']);_0x5d9b0c[_0x29d3('0x37')]=_[_0x29d3('0x38')](_0x5d9b0c[_0x29d3('0x34')],_0x5d9b0c[_0x29d3('0x35')]);_0x112f9e[_0x29d3('0x3a')]=_[_0x29d3('0x38')](_0x5d9b0c[_0x29d3('0x34')],qs[_0x29d3('0x39')](_0x491a3d['query']['fields']));_0x112f9e[_0x29d3('0x3a')]=_0x112f9e[_0x29d3('0x3a')][_0x29d3('0x3b')]?_0x112f9e[_0x29d3('0x3a')]:_0x5d9b0c[_0x29d3('0x34')];if(_0x491a3d['query'][_0x29d3('0x45')]){_0x112f9e['include']=[{'all':!![]}];}_0x112f9e=_[_0x29d3('0x41')]({},_0x112f9e,_0x491a3d[_0x29d3('0x4a')]);return db[_0x29d3('0x44')]['find'](_0x112f9e)[_0x29d3('0x2a')](handleEntityNotFound(_0x2a1cdc,null))[_0x29d3('0x2a')](respondWithResult(_0x2a1cdc,null))['catch'](handleError(_0x2a1cdc,null));};exports['create']=function(_0x18331e,_0x2bcb31){return db[_0x29d3('0x44')][_0x29d3('0x4b')](_0x18331e[_0x29d3('0x4c')],{})[_0x29d3('0x2a')](respondWithResult(_0x2bcb31,0xc9))[_0x29d3('0x48')](handleError(_0x2bcb31,null));};exports[_0x29d3('0x4d')]=function(_0x4b2423,_0x1abb7a){if(_0x4b2423[_0x29d3('0x4c')]['id']){delete _0x4b2423[_0x29d3('0x4c')]['id'];}return db[_0x29d3('0x44')][_0x29d3('0x4e')]({'where':{'id':_0x4b2423[_0x29d3('0x49')]['id']}})[_0x29d3('0x2a')](handleEntityNotFound(_0x1abb7a,null))[_0x29d3('0x2a')](saveUpdates(_0x4b2423[_0x29d3('0x4c')],null))[_0x29d3('0x2a')](respondWithResult(_0x1abb7a,null))[_0x29d3('0x48')](handleError(_0x1abb7a,null));};exports['destroy']=function(_0x3ecd70,_0x249ade){return db[_0x29d3('0x44')][_0x29d3('0x4e')]({'where':{'id':_0x3ecd70[_0x29d3('0x49')]['id']}})['then'](handleEntityNotFound(_0x249ade,null))[_0x29d3('0x2a')](removeEntity(_0x249ade,null))[_0x29d3('0x48')](handleError(_0x249ade,null));};exports[_0x29d3('0x4f')]=function(_0xdc8d4,_0x4fea19){return db[_0x29d3('0x44')][_0x29d3('0x4f')]()[_0x29d3('0x2a')](respondWithResult(_0x4fea19,null))[_0x29d3('0x48')](handleError(_0x4fea19,null));};function wrapUser(_0x38e909){return function(_0x1c297d){var _0x3048c7=_0x38e909[_0x29d3('0x50')]({'plain':!![]});_0x3048c7[_0x29d3('0x51')]=[];if(_0x1c297d){_0x3048c7[_0x29d3('0x52')]=_0x1c297d[_0x29d3('0x53')];_0x3048c7['lastMessage']=_0x1c297d;}else{_0x3048c7[_0x29d3('0x52')]=moment(0x0)[_0x29d3('0x54')](_0x29d3('0x55'));_0x3048c7[_0x29d3('0x56')]={};}return _0x3048c7;};}exports[_0x29d3('0x57')]=function(_0x83be9e,_0x5ba7e9,_0x288757){var _0x316a33=[];return db[_0x29d3('0x58')]['findAll']({'where':{'role':[_0x29d3('0x59'),_0x29d3('0x5a'),'user']},'attributes':['id',_0x29d3('0x5b'),'name',_0x29d3('0x5c'),_0x29d3('0x5d'),_0x29d3('0x5e'),_0x29d3('0x5f'),_0x29d3('0x60'),_0x29d3('0x61'),_0x29d3('0x62')],'order':qs[_0x29d3('0x3e')](_0x29d3('0x63')),'include':[{'model':db[_0x29d3('0x64')],'as':'VoiceQueues','attributes':['id',_0x29d3('0x2d'),_0x29d3('0x32')],'through':{'attributes':[]}}]})['then'](function(_0x2ee61c){if(_0x2ee61c){var _0x12e6ba=_0x83be9e[_0x29d3('0x65')][_0x29d3('0x50')]({'plain':!![]});if(!_0x12e6ba)throw new Error(_0x29d3('0x66'));if(_0x12e6ba[_0x29d3('0x5c')]==='user'){return db[_0x29d3('0x67')]['find']({'where':{'name':_0x29d3('0x68'),'userProfileId':_0x12e6ba[_0x29d3('0x69')]},'raw':!![]})[_0x29d3('0x2a')](function(_0x154ce9){if(_0x154ce9){if(_0x154ce9[_0x29d3('0x6a')]===0x0){return db['UserProfileResource'][_0x29d3('0x6b')]({'where':{'sectionId':_0x154ce9['id']},'raw':!![]})[_0x29d3('0x2a')](function(_0x438e4b){var _0x2afdb4=[];if(_[_0x29d3('0x6c')](_0x438e4b)){_0x2afdb4=_[_0x29d3('0x43')](_0x2ee61c,function(_0x27b87e){if(_0x27b87e[_0x29d3('0x5c')]!==_0x29d3('0x59')){return _0x27b87e;}});return _0x2afdb4;}else{for(var _0x257ddb=0x0;_0x257ddb<_0x2ee61c[_0x29d3('0x3b')];_0x257ddb++){var _0x3a8a70=_0x2ee61c[_0x257ddb];if(_0x3a8a70[_0x29d3('0x5c')]===_0x29d3('0x59')){var _0x5074c7=_[_0x29d3('0x4e')](_0x438e4b,function(_0x1c27de){return _0x1c27de[_0x29d3('0x6d')]===_0x3a8a70['id'];});if(_0x5074c7)_0x2afdb4[_0x29d3('0x6e')](_0x3a8a70);}else{_0x2afdb4[_0x29d3('0x6e')](_0x3a8a70);}}return _0x2afdb4;}});}else{return _0x2ee61c;}}else{var _0x513600=_['filter'](_0x2ee61c,function(_0x3d03e8){if(_0x3d03e8[_0x29d3('0x5c')]!=='agent'){return _0x3d03e8;}});return _0x513600;}});}else{return _0x2ee61c;}}})[_0x29d3('0x2a')](function(_0x5a0984){var _0x548d01=[];if(_0x5a0984){_0x316a33=_0x5a0984;for(var _0x37801e=0x0;_0x37801e<_0x5a0984[_0x29d3('0x3b')];_0x37801e+=0x1){_0x316a33[_0x37801e]['messages']=[];_0x548d01['push'](db[_0x29d3('0x44')]['find']({'where':{'FromId':[_0x83be9e[_0x29d3('0x65')]['id'],_0x5a0984[_0x37801e]['id']],'ToId':[_0x83be9e[_0x29d3('0x65')]['id'],_0x5a0984[_0x37801e]['id']],'ChatGroupId':null},'attributes':['id',_0x29d3('0x53'),'FromId',_0x29d3('0x6f'),_0x29d3('0x70'),_0x29d3('0x4c')],'order':qs[_0x29d3('0x3e')](_0x29d3('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5a0984[_0x37801e])));}return BPromise[_0x29d3('0x72')](_0x548d01);}return[];})[_0x29d3('0x2a')](function(_0x38f6e3){return{'rows':_0x38f6e3,'count':_0x38f6e3['length']};})[_0x29d3('0x2a')](respondWithResult(_0x5ba7e9,null))[_0x29d3('0x48')](handleError(_0x5ba7e9,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 0ed7172..1d6f46a 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 _0xea69=['exports','events','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x356d31,_0x151a64){var _0x3b6088=function(_0x26654a){while(--_0x26654a){_0x356d31['push'](_0x356d31['shift']());}};_0x3b6088(++_0x151a64);}(_0xea69,0x97));var _0x9ea6=function(_0x59c45a,_0x1886c4){_0x59c45a=_0x59c45a-0x0;var _0x527e17=_0xea69[_0x59c45a];return _0x527e17;};'use strict';var EventEmitter=require(_0x9ea6('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x9ea6('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x9ea6('0x2')](0x0);var events={'afterCreate':_0x9ea6('0x3'),'afterUpdate':_0x9ea6('0x4'),'afterDestroy':_0x9ea6('0x5')};function emitEvent(_0x43df72){return function(_0x2326e9,_0x58927f,_0x43ecb9){ChatInternalMessageEvents[_0x9ea6('0x6')](_0x43df72+':'+_0x2326e9['id'],_0x2326e9);ChatInternalMessageEvents[_0x9ea6('0x6')](_0x43df72,_0x2326e9);_0x43ecb9(null);};}for(var e in events){if(events[_0x9ea6('0x7')](e)){var event=events[e];ChatInternalMessage[_0x9ea6('0x8')](e,emitEvent(event));}}module[_0x9ea6('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xef2b=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x166b39,_0x2c7292){var _0x196a87=function(_0x99af69){while(--_0x99af69){_0x166b39['push'](_0x166b39['shift']());}};_0x196a87(++_0x2c7292);}(_0xef2b,0x164));var _0xbef2=function(_0x5e3f0f,_0x16c6c7){_0x5e3f0f=_0x5e3f0f-0x0;var _0xbd8d66=_0xef2b[_0x5e3f0f];return _0xbd8d66;};'use strict';var EventEmitter=require(_0xbef2('0x0'));var ChatInternalMessage=require(_0xbef2('0x1'))['db'][_0xbef2('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xbef2('0x3')](0x0);var events={'afterCreate':_0xbef2('0x4'),'afterUpdate':'update','afterDestroy':_0xbef2('0x5')};function emitEvent(_0x56e61a){return function(_0x29619f,_0x114f0e,_0x159f26){ChatInternalMessageEvents[_0xbef2('0x6')](_0x56e61a+':'+_0x29619f['id'],_0x29619f);ChatInternalMessageEvents['emit'](_0x56e61a,_0x29619f);_0x159f26(null);};}for(var e in events){if(events[_0xbef2('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xbef2('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 7d0361d..3bc9e41 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 _0xc006=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x31ed20,_0x2709b4){var _0x2379c9=function(_0x20ed02){while(--_0x20ed02){_0x31ed20['push'](_0x31ed20['shift']());}};_0x2379c9(++_0x2709b4);}(_0xc006,0x1de));var _0x6c00=function(_0x5c8f3e,_0x33ba70){_0x5c8f3e=_0x5c8f3e-0x0;var _0xb55f35=_0xc006[_0x5c8f3e];return _0xb55f35;};'use strict';var _=require(_0x6c00('0x0'));var util=require(_0x6c00('0x1'));var logger=require(_0x6c00('0x2'))(_0x6c00('0x3'));var moment=require(_0x6c00('0x4'));var BPromise=require(_0x6c00('0x5'));var rp=require(_0x6c00('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c00('0x7'));var config=require(_0x6c00('0x8'));var attributes=require(_0x6c00('0x9'));module[_0x6c00('0xa')]=function(_0x215e5b,_0x25671c){return _0x215e5b[_0x6c00('0xb')]('ChatInternalMessage',attributes,{'tableName':_0x6c00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6c00('0xd'),'collate':_0x6c00('0xe')});}; \ No newline at end of file +var _0xa5d6=['../../config/logger','api','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xa5d6,0x7c));var _0x6a5d=function(_0x3f71a4,_0x30c6fe){_0x3f71a4=_0x3f71a4-0x0;var _0x11f064=_0xa5d6[_0x3f71a4];return _0x11f064;};'use strict';var _=require(_0x6a5d('0x0'));var util=require(_0x6a5d('0x1'));var logger=require(_0x6a5d('0x2'))(_0x6a5d('0x3'));var moment=require('moment');var BPromise=require(_0x6a5d('0x4'));var rp=require(_0x6a5d('0x5'));var fs=require('fs');var path=require(_0x6a5d('0x6'));var rimraf=require(_0x6a5d('0x7'));var config=require('../../config/environment');var attributes=require(_0x6a5d('0x8'));module[_0x6a5d('0x9')]=function(_0x481847,_0x30d703){return _0x481847[_0x6a5d('0xa')](_0x6a5d('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6a5d('0xc'),'collate':_0x6a5d('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 335eb99..826b603 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 _0xbe43=['../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4ded39,_0x146dd4){var _0x1259b1=function(_0x3f3ae4){while(--_0x3f3ae4){_0x4ded39['push'](_0x4ded39['shift']());}};_0x1259b1(++_0x146dd4);}(_0xbe43,0xbb));var _0x3be4=function(_0x2cc338,_0x5585d8){_0x2cc338=_0x2cc338-0x0;var _0x2a8920=_0xbe43[_0x2cc338];return _0x2a8920;};'use strict';var _=require(_0x3be4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3be4('0x1'));var fs=require('fs');var Redis=require(_0x3be4('0x2'));var db=require(_0x3be4('0x3'))['db'];var utils=require(_0x3be4('0x4'));var logger=require(_0x3be4('0x5'))('rpc');var config=require(_0x3be4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3be4('0x7')][_0x3be4('0x8')]({'port':0x232a});config[_0x3be4('0x9')]=_['defaults'](config['redis'],{'host':_0x3be4('0xa'),'port':0x18eb});var socket=require(_0x3be4('0xb'))(new Redis(config[_0x3be4('0x9')]));require(_0x3be4('0xc'))['register'](socket);function respondWithRpcPromise(_0x3d7c0d,_0x15b4e6,_0x5ef2ea){return new BPromise(function(_0x11209b,_0x5effd4){return client[_0x3be4('0xd')](_0x3d7c0d,_0x5ef2ea)[_0x3be4('0xe')](function(_0x4ae979){logger[_0x3be4('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x15b4e6,_0x3be4('0x10'));logger['debug'](_0x3be4('0x11'),_0x15b4e6,_0x3be4('0x10'),JSON[_0x3be4('0x12')](_0x4ae979));if(_0x4ae979[_0x3be4('0x13')]){if(_0x4ae979[_0x3be4('0x13')][_0x3be4('0x14')]===0x1f4){logger['error'](_0x3be4('0x15'),_0x15b4e6,_0x4ae979[_0x3be4('0x13')]['message']);return _0x5effd4(_0x4ae979[_0x3be4('0x13')][_0x3be4('0x16')]);}logger['error'](_0x3be4('0x15'),_0x15b4e6,_0x4ae979['error'][_0x3be4('0x16')]);return _0x11209b(_0x4ae979['error'][_0x3be4('0x16')]);}else{logger[_0x3be4('0xf')](_0x3be4('0x15'),_0x15b4e6,_0x3be4('0x10'));_0x11209b(_0x4ae979[_0x3be4('0x17')][_0x3be4('0x16')]);}})['catch'](function(_0x547a92){logger[_0x3be4('0x13')](_0x3be4('0x15'),_0x15b4e6,_0x547a92);_0x5effd4(_0x547a92);});});} \ No newline at end of file +var _0x0e7a=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then'];(function(_0x4b1ea1,_0xff5112){var _0x1cf493=function(_0x4ceec6){while(--_0x4ceec6){_0x4b1ea1['push'](_0x4b1ea1['shift']());}};_0x1cf493(++_0xff5112);}(_0x0e7a,0x71));var _0xa0e7=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0x0e7a[_0x214266];return _0x568f75;};'use strict';var _=require(_0xa0e7('0x0'));var util=require(_0xa0e7('0x1'));var moment=require(_0xa0e7('0x2'));var BPromise=require('bluebird');var rs=require(_0xa0e7('0x3'));var fs=require('fs');var Redis=require(_0xa0e7('0x4'));var db=require(_0xa0e7('0x5'))['db'];var utils=require(_0xa0e7('0x6'));var logger=require('../../config/logger')(_0xa0e7('0x7'));var config=require(_0xa0e7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa0e7('0x9')][_0xa0e7('0xa')]({'port':0x232a});config[_0xa0e7('0xb')]=_[_0xa0e7('0xc')](config['redis'],{'host':_0xa0e7('0xd'),'port':0x18eb});var socket=require(_0xa0e7('0xe'))(new Redis(config[_0xa0e7('0xb')]));require('./chatInternalMessage.socket')[_0xa0e7('0xf')](socket);function respondWithRpcPromise(_0x992df1,_0xc4dc84,_0x24cc32){return new BPromise(function(_0x44f3ec,_0x4cd892){return client['request'](_0x992df1,_0x24cc32)[_0xa0e7('0x10')](function(_0x293867){logger['info'](_0xa0e7('0x11'),_0xc4dc84,_0xa0e7('0x12'));logger['debug'](_0xa0e7('0x13'),_0xc4dc84,'request\x20sent',JSON[_0xa0e7('0x14')](_0x293867));if(_0x293867[_0xa0e7('0x15')]){if(_0x293867[_0xa0e7('0x15')][_0xa0e7('0x16')]===0x1f4){logger[_0xa0e7('0x15')](_0xa0e7('0x11'),_0xc4dc84,_0x293867['error'][_0xa0e7('0x17')]);return _0x4cd892(_0x293867[_0xa0e7('0x15')][_0xa0e7('0x17')]);}logger[_0xa0e7('0x15')](_0xa0e7('0x11'),_0xc4dc84,_0x293867[_0xa0e7('0x15')]['message']);return _0x44f3ec(_0x293867[_0xa0e7('0x15')][_0xa0e7('0x17')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0xc4dc84,_0xa0e7('0x12'));_0x44f3ec(_0x293867[_0xa0e7('0x18')][_0xa0e7('0x17')]);}})[_0xa0e7('0x19')](function(_0x49d432){logger[_0xa0e7('0x15')](_0xa0e7('0x11'),_0xc4dc84,_0x49d432);_0x4cd892(_0x49d432);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4cd5f7c..4764813 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 _0xacea=['update','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xacea,0x1ed));var _0xaace=function(_0x21e75a,_0x40dc8a){_0x21e75a=_0x21e75a-0x0;var _0x6972f8=_0xacea[_0x21e75a];return _0x6972f8;};'use strict';var ChatInternalMessageEvents=require(_0xaace('0x0'));var events=[_0xaace('0x1'),_0xaace('0x2'),_0xaace('0x3')];function createListener(_0x53a913,_0x22ac89){return function(_0x335bb4){_0x22ac89['emit'](_0x53a913,_0x335bb4);};}function removeListener(_0x376786,_0x92c34){return function(){ChatInternalMessageEvents[_0xaace('0x4')](_0x376786,_0x92c34);};}exports[_0xaace('0x5')]=function(_0x203fcf){for(var _0x30e7b0=0x0,_0x52a453=events[_0xaace('0x6')];_0x30e7b0<_0x52a453;_0x30e7b0++){var _0x4d6d51=events[_0x30e7b0];var _0xbd98e0=createListener(_0xaace('0x7')+_0x4d6d51,_0x203fcf);ChatInternalMessageEvents['on'](_0x4d6d51,_0xbd98e0);}}; \ No newline at end of file +var _0x3d45=['save','remove','update','removeListener','register','chatInternalMessage:'];(function(_0x48b55f,_0x2a17e7){var _0x524a3c=function(_0x4d834a){while(--_0x4d834a){_0x48b55f['push'](_0x48b55f['shift']());}};_0x524a3c(++_0x2a17e7);}(_0x3d45,0x66));var _0x53d4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d45[_0x3b380d];return _0x54502b;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x53d4('0x0'),_0x53d4('0x1'),_0x53d4('0x2')];function createListener(_0x2ef7cf,_0x3c660f){return function(_0x203329){_0x3c660f['emit'](_0x2ef7cf,_0x203329);};}function removeListener(_0x3ff2fe,_0x1a31fa){return function(){ChatInternalMessageEvents[_0x53d4('0x3')](_0x3ff2fe,_0x1a31fa);};}exports[_0x53d4('0x4')]=function(_0x571070){for(var _0x2f8160=0x0,_0xce6568=events['length'];_0x2f8160<_0xce6568;_0x2f8160++){var _0x57bd0d=events[_0x2f8160];var _0x59e469=createListener(_0x53d4('0x5')+_0x57bd0d,_0x571070);ChatInternalMessageEvents['on'](_0x57bd0d,_0x59e469);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c956304..7ee3758 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 _0x0b59=['index','/describe','describe','/users','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x391127,_0x5cb2df){var _0x3c4c11=function(_0x350e7){while(--_0x350e7){_0x391127['push'](_0x391127['shift']());}};_0x3c4c11(++_0x5cb2df);}(_0x0b59,0xae));var _0x90b5=function(_0x6a3b0,_0x3ffffe){_0x6a3b0=_0x6a3b0-0x0;var _0x124558=_0x0b59[_0x6a3b0];return _0x124558;};'use strict';var multer=require(_0x90b5('0x0'));var util=require(_0x90b5('0x1'));var path=require(_0x90b5('0x2'));var timeout=require(_0x90b5('0x3'));var express=require(_0x90b5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90b5('0x5'));var interaction=require(_0x90b5('0x6'));var config=require(_0x90b5('0x7'));var controller=require(_0x90b5('0x8'));router[_0x90b5('0x9')]('/',auth['isAuthenticated'](),controller[_0x90b5('0xa')]);router[_0x90b5('0x9')](_0x90b5('0xb'),auth['isAuthenticated'](),controller[_0x90b5('0xc')]);router[_0x90b5('0x9')](_0x90b5('0xd'),auth[_0x90b5('0xe')](),controller['getUsers']);router[_0x90b5('0x9')](_0x90b5('0xf'),auth[_0x90b5('0xe')](),controller[_0x90b5('0x10')]);router['post']('/',auth[_0x90b5('0xe')](),controller[_0x90b5('0x11')]);router[_0x90b5('0x12')](_0x90b5('0xf'),controller[_0x90b5('0x13')]);router[_0x90b5('0x14')]('/:id',auth[_0x90b5('0xe')](),controller[_0x90b5('0x15')]);module[_0x90b5('0x16')]=router; \ No newline at end of file +var _0x9ad3=['fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','/users','getUsers','/:id','show','post','put','update','destroy','util','path','connect-timeout','express'];(function(_0x2b0686,_0xff7aca){var _0xe364a0=function(_0x317360){while(--_0x317360){_0x2b0686['push'](_0x2b0686['shift']());}};_0xe364a0(++_0xff7aca);}(_0x9ad3,0x161));var _0x39ad=function(_0x348088,_0xfdc11d){_0x348088=_0x348088-0x0;var _0x4d43a7=_0x9ad3[_0x348088];return _0x4d43a7;};'use strict';var multer=require('multer');var util=require(_0x39ad('0x0'));var path=require(_0x39ad('0x1'));var timeout=require(_0x39ad('0x2'));var express=require(_0x39ad('0x3'));var router=express['Router']();var fs_extra=require(_0x39ad('0x4'));var auth=require(_0x39ad('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x39ad('0x6'));var controller=require(_0x39ad('0x7'));router[_0x39ad('0x8')]('/',auth['isAuthenticated'](),controller[_0x39ad('0x9')]);router['get'](_0x39ad('0xa'),auth[_0x39ad('0xb')](),controller[_0x39ad('0xc')]);router['get'](_0x39ad('0xd'),auth[_0x39ad('0xb')](),controller[_0x39ad('0xe')]);router['get'](_0x39ad('0xf'),auth[_0x39ad('0xb')](),controller[_0x39ad('0x10')]);router[_0x39ad('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x39ad('0x12')]('/:id',controller[_0x39ad('0x13')]);router['delete'](_0x39ad('0xf'),auth[_0x39ad('0xb')](),controller[_0x39ad('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index ce2fe3f..8225655 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 _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(_0x1ded08,_0x137e95){_0x1ded08=_0x1ded08-0x0;var _0x290eff=_0x8580[_0x1ded08];return _0x290eff;};'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 +var _0x1bc6=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x1bc6,0x94));var _0x61bc=function(_0x1a841e,_0x5d813e){_0x1a841e=_0x1a841e-0x0;var _0x32d59e=_0x1bc6[_0x1a841e];return _0x32d59e;};'use strict';var Sequelize=require(_0x61bc('0x0'));module[_0x61bc('0x1')]={'body':{'type':Sequelize[_0x61bc('0x2')](_0x61bc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x61bc('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x61bc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x61bc('0x5')]('in','out'),'defaultValue':_0x61bc('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x61bc('0x7')]},'providerName':{'type':Sequelize[_0x61bc('0x8')]},'providerResponse':{'type':Sequelize[_0x61bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 5e2b0e4..bb62a65 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 _0x0e87=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','chat-interactions','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','count','limit','Content-Range','json','update','destroy','sendStatus','stack','name','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','includeAll','create','body','find','params','describe','chat','acceptMessage','reject','UserId','user','agent','get','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','internal','interface','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','interaction','util','lodash','../../components/interaction/service'];(function(_0x9709ce,_0x5765af){var _0x414c87=function(_0x51149b){while(--_0x51149b){_0x9709ce['push'](_0x9709ce['shift']());}};_0x414c87(++_0x5765af);}(_0x0e87,0x64));var _0x70e8=function(_0x1b72de,_0x525ddc){_0x1b72de=_0x1b72de-0x0;var _0x17618f=_0x0e87[_0x1b72de];return _0x17618f;};'use strict';var util=require(_0x70e8('0x0'));var _=require(_0x70e8('0x1'));var Redis=require('ioredis');var interactionService=require(_0x70e8('0x2'));var qs=require(_0x70e8('0x3'));var logger=require(_0x70e8('0x4'))(_0x70e8('0x5'));var config=require(_0x70e8('0x6'));var db=require(_0x70e8('0x7'))['db'];config[_0x70e8('0x8')]=_[_0x70e8('0x9')](config[_0x70e8('0x8')],{'host':_0x70e8('0xa'),'port':0x18eb});var socket=require(_0x70e8('0xb'))(new Redis(config['redis']));require(_0x70e8('0xc'))[_0x70e8('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x70e8('0xe')][_0x70e8('0xf')]({'port':0x232c});var client9002=jayson[_0x70e8('0xe')][_0x70e8('0xf')]({'port':0x232a});var interaction_log=require(_0x70e8('0x4'))(_0x70e8('0x10'));function respondWithRpcPromise(_0x40b2f8,_0x64512f,_0x763b4e,_0x3c7ff0){return new Promise(function(_0x13f9df,_0xcb74ad){var _0x3f618d=_0x3c7ff0||client;return _0x3f618d[_0x70e8('0x11')](_0x40b2f8,_0x763b4e)[_0x70e8('0x12')](function(_0x3b6e81){logger[_0x70e8('0x13')](_0x70e8('0x14'),_0x64512f,_0x70e8('0x15'));logger[_0x70e8('0x16')](_0x70e8('0x17'),_0x64512f,'request\x20sent',JSON[_0x70e8('0x18')](_0x3b6e81));if(_0x3b6e81[_0x70e8('0x19')]){if(_0x3b6e81[_0x70e8('0x19')][_0x70e8('0x1a')]===0x1f4){logger[_0x70e8('0x19')](_0x70e8('0x14'),_0x64512f,_0x3b6e81[_0x70e8('0x19')]['message']);return _0xcb74ad(_0x3b6e81[_0x70e8('0x19')][_0x70e8('0x1b')]);}logger[_0x70e8('0x19')]('ChatMessage,\x20%s,\x20%s',_0x64512f,_0x3b6e81[_0x70e8('0x19')][_0x70e8('0x1b')]);return _0x13f9df(_0x3b6e81[_0x70e8('0x19')][_0x70e8('0x1b')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x64512f,_0x70e8('0x15'));_0x13f9df(_0x3b6e81[_0x70e8('0x1c')]['message']);}})[_0x70e8('0x1d')](function(_0x42eca9){logger[_0x70e8('0x19')](_0x70e8('0x14'),_0x64512f,_0x42eca9);_0xcb74ad(_0x42eca9);});});}function respondWithResult(_0x2d1e4b,_0x3a68b4){_0x3a68b4=_0x3a68b4||0xc8;return function(_0x458d22){if(_0x458d22){return _0x2d1e4b[_0x70e8('0x1e')](_0x3a68b4)['json'](_0x458d22);}};}function respondWithFilteredResult(_0x294f9b,_0x3a5d00){return function(_0x4cbc81){if(_0x4cbc81){var _0x241645=typeof _0x3a5d00[_0x70e8('0x1f')]==='undefined'&&typeof _0x3a5d00['limit']===_0x70e8('0x20');var _0x3bd1c5=_0x4cbc81['count'];var _0x37b862=_0x241645?0x0:_0x3a5d00[_0x70e8('0x1f')];var _0x9c664a=_0x241645?_0x4cbc81[_0x70e8('0x21')]:_0x3a5d00[_0x70e8('0x1f')]+_0x3a5d00[_0x70e8('0x22')];var _0x1882d5;if(_0x9c664a>=_0x3bd1c5){_0x9c664a=_0x3bd1c5;_0x1882d5=0xc8;}else{_0x1882d5=0xce;}_0x294f9b[_0x70e8('0x1e')](_0x1882d5);return _0x294f9b['set'](_0x70e8('0x23'),_0x37b862+'-'+_0x9c664a+'/'+_0x3bd1c5)[_0x70e8('0x24')](_0x4cbc81);}return null;};}function saveUpdates(_0x16fd20){return function(_0x128471){if(_0x128471){return _0x128471[_0x70e8('0x25')](_0x16fd20)['then'](function(_0x4550bd){return _0x4550bd;});}return null;};}function removeEntity(_0x7d5821){return function(_0x10091f){if(_0x10091f){return _0x10091f[_0x70e8('0x26')]()[_0x70e8('0x12')](function(){_0x7d5821[_0x70e8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e9d43){return function(_0x25dc34){if(!_0x25dc34){_0x3e9d43[_0x70e8('0x27')](0x194);}return _0x25dc34;};}function handleError(_0x53a543,_0x39905f){_0x39905f=_0x39905f||0x1f4;return function(_0x58eb84){logger['error'](_0x58eb84[_0x70e8('0x28')]);if(_0x58eb84[_0x70e8('0x29')]){delete _0x58eb84[_0x70e8('0x29')];}_0x53a543['status'](_0x39905f)['send'](_0x58eb84);};}exports['index']=function(_0x1cd4dc,_0x2eb92a){var _0x1ee6e2={},_0x11eba0={},_0x29a1be={'count':0x0,'rows':[]};var _0x3990ab=_['map'](db[_0x70e8('0x2a')][_0x70e8('0x2b')],function(_0x3f4f5b){return{'name':_0x3f4f5b[_0x70e8('0x2c')],'type':_0x3f4f5b[_0x70e8('0x2d')][_0x70e8('0x2e')]};});_0x11eba0[_0x70e8('0x2f')]=_['map'](_0x3990ab,_0x70e8('0x29'));_0x11eba0[_0x70e8('0x30')]=_[_0x70e8('0x31')](_0x1cd4dc[_0x70e8('0x30')]);_0x11eba0[_0x70e8('0x32')]=_[_0x70e8('0x33')](_0x11eba0['model'],_0x11eba0[_0x70e8('0x30')]);_0x1ee6e2[_0x70e8('0x34')]=_[_0x70e8('0x33')](_0x11eba0[_0x70e8('0x2f')],qs[_0x70e8('0x35')](_0x1cd4dc[_0x70e8('0x30')]['fields']));_0x1ee6e2[_0x70e8('0x34')]=_0x1ee6e2[_0x70e8('0x34')][_0x70e8('0x36')]?_0x1ee6e2[_0x70e8('0x34')]:_0x11eba0[_0x70e8('0x2f')];if(!_0x1cd4dc[_0x70e8('0x30')][_0x70e8('0x37')](_0x70e8('0x38'))){_0x1ee6e2[_0x70e8('0x22')]=qs[_0x70e8('0x22')](_0x1cd4dc['query'][_0x70e8('0x22')]);_0x1ee6e2['offset']=qs['offset'](_0x1cd4dc[_0x70e8('0x30')][_0x70e8('0x1f')]);}_0x1ee6e2[_0x70e8('0x39')]=qs[_0x70e8('0x3a')](_0x1cd4dc[_0x70e8('0x30')]['sort']);_0x1ee6e2[_0x70e8('0x3b')]=qs[_0x70e8('0x32')](_[_0x70e8('0x3c')](_0x1cd4dc[_0x70e8('0x30')],_0x11eba0[_0x70e8('0x32')]),_0x3990ab);if(_0x1cd4dc[_0x70e8('0x30')][_0x70e8('0x3d')]){_0x1ee6e2[_0x70e8('0x3b')]=_[_0x70e8('0x3e')](_0x1ee6e2['where'],{'$or':_[_0x70e8('0x3f')](_0x3990ab,function(_0xc72a61){if(_0xc72a61[_0x70e8('0x2d')]!==_0x70e8('0x40')){var _0x53e0a8={};_0x53e0a8[_0xc72a61[_0x70e8('0x29')]]={'$like':'%'+_0x1cd4dc[_0x70e8('0x30')][_0x70e8('0x3d')]+'%'};return _0x53e0a8;}})});}_0x1ee6e2=_['merge']({},_0x1ee6e2,_0x1cd4dc[_0x70e8('0x41')]);var _0x4c1956={'where':_0x1ee6e2[_0x70e8('0x3b')]};return db['ChatMessage'][_0x70e8('0x21')](_0x4c1956)[_0x70e8('0x12')](function(_0x210347){_0x29a1be['count']=_0x210347;if(_0x1cd4dc[_0x70e8('0x30')]['includeAll']){_0x1ee6e2[_0x70e8('0x42')]=[{'all':!![]}];}return db[_0x70e8('0x2a')]['findAll'](_0x1ee6e2);})[_0x70e8('0x12')](function(_0x293eb3){_0x29a1be[_0x70e8('0x43')]=_0x293eb3;return _0x29a1be;})[_0x70e8('0x12')](respondWithFilteredResult(_0x2eb92a,_0x1ee6e2))[_0x70e8('0x1d')](handleError(_0x2eb92a,null));};exports['show']=function(_0x2b1b11,_0x209e0c){var _0x205f48={'raw':!![],'where':{'id':_0x2b1b11['params']['id']}},_0x3f8093={};_0x3f8093['model']=_['keys'](db[_0x70e8('0x2a')][_0x70e8('0x2b')]);_0x3f8093[_0x70e8('0x30')]=_[_0x70e8('0x31')](_0x2b1b11[_0x70e8('0x30')]);_0x3f8093['filters']=_[_0x70e8('0x33')](_0x3f8093[_0x70e8('0x2f')],_0x3f8093[_0x70e8('0x30')]);_0x205f48[_0x70e8('0x34')]=_[_0x70e8('0x33')](_0x3f8093[_0x70e8('0x2f')],qs[_0x70e8('0x35')](_0x2b1b11['query'][_0x70e8('0x35')]));_0x205f48[_0x70e8('0x34')]=_0x205f48['attributes'][_0x70e8('0x36')]?_0x205f48[_0x70e8('0x34')]:_0x3f8093[_0x70e8('0x2f')];if(_0x2b1b11[_0x70e8('0x30')][_0x70e8('0x44')]){_0x205f48['include']=[{'all':!![]}];}_0x205f48=_[_0x70e8('0x3e')]({},_0x205f48,_0x2b1b11['options']);return db[_0x70e8('0x2a')]['find'](_0x205f48)[_0x70e8('0x12')](handleEntityNotFound(_0x209e0c,null))[_0x70e8('0x12')](respondWithResult(_0x209e0c,null))[_0x70e8('0x1d')](handleError(_0x209e0c,null));};exports[_0x70e8('0x45')]=function(_0x497fa6,_0xc56069){return db[_0x70e8('0x2a')][_0x70e8('0x45')](_0x497fa6[_0x70e8('0x46')],{})[_0x70e8('0x12')](respondWithResult(_0xc56069,0xc9))[_0x70e8('0x1d')](handleError(_0xc56069,null));};exports[_0x70e8('0x25')]=function(_0x17d1db,_0x3ac69b){if(_0x17d1db[_0x70e8('0x46')]['id']){delete _0x17d1db['body']['id'];}return db[_0x70e8('0x2a')][_0x70e8('0x47')]({'where':{'id':_0x17d1db[_0x70e8('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ac69b,null))[_0x70e8('0x12')](saveUpdates(_0x17d1db[_0x70e8('0x46')],null))[_0x70e8('0x12')](respondWithResult(_0x3ac69b,null))[_0x70e8('0x1d')](handleError(_0x3ac69b,null));};exports[_0x70e8('0x26')]=function(_0x4011a,_0x39bc54){return db[_0x70e8('0x2a')]['find']({'where':{'id':_0x4011a[_0x70e8('0x48')]['id']}})[_0x70e8('0x12')](handleEntityNotFound(_0x39bc54,null))[_0x70e8('0x12')](removeEntity(_0x39bc54,null))[_0x70e8('0x1d')](handleError(_0x39bc54,null));};exports['describe']=function(_0x51aa77,_0x55dc4a){return db[_0x70e8('0x2a')][_0x70e8('0x49')]()['then'](respondWithResult(_0x55dc4a,null))['catch'](handleError(_0x55dc4a,null));};exports['accept']=function(_0x28b77a,_0x3eb6dd){var _0x5c5f4a=_0x70e8('0x4a');return interactionService[_0x70e8('0x4b')](_0x28b77a,_0x5c5f4a)[_0x70e8('0x12')](respondWithResult(_0x3eb6dd,null))[_0x70e8('0x1d')](handleError(_0x3eb6dd,null));};exports[_0x70e8('0x4c')]=function(_0x503428,_0x57923d){var _0x2c83d2={'agent':{},'channel':_0x70e8('0x4a')};if(_0x503428[_0x70e8('0x46')]['id']){delete _0x503428[_0x70e8('0x46')]['id'];}_0x503428['body'][_0x70e8('0x4d')]=_0x503428[_0x70e8('0x46')][_0x70e8('0x4d')]||_0x503428[_0x70e8('0x4e')]['id'];_0x2c83d2[_0x70e8('0x4f')]['id']=_0x503428[_0x70e8('0x46')][_0x70e8('0x4d')];return db[_0x70e8('0x2a')]['find']({'where':{'id':_0x503428[_0x70e8('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x57923d,null))[_0x70e8('0x12')](function(_0x1b783d){if(_0x1b783d){_0x2c83d2[_0x70e8('0x1b')]=_0x1b783d[_0x70e8('0x50')]({'plain':!![]});return db[_0x70e8('0x51')][_0x70e8('0x47')]({'where':{'id':_0x1b783d[_0x70e8('0x52')]}});}return null;})[_0x70e8('0x12')](handleEntityNotFound(_0x57923d,null))[_0x70e8('0x12')](function(_0x357c85){if(_0x357c85){_0x2c83d2['interaction']=_0x357c85['get']({'plain':!![]});interaction_log[_0x70e8('0x13')](_0x70e8('0x53'),_0x503428['user']['id'],_0x503428[_0x70e8('0x4e')][_0x70e8('0x29')],_0x503428[_0x70e8('0x4e')]['role'],_0x2c83d2['interaction']['id'],_0x503428['body']?JSON['stringify'](_0x503428[_0x70e8('0x46')]):_0x70e8('0x54'));return respondWithRpcPromise(_0x70e8('0x55'),_0x70e8('0x56'),_0x2c83d2);}return null;})['then'](function(_0x38d478){var _0x18ce5f=_0x70e8('0x57')+_0x38d478[_0x70e8('0x1b')][_0x70e8('0x58')];return db[_0x70e8('0x59')][_0x70e8('0x30')](_0x18ce5f,{'type':db['Sequelize'][_0x70e8('0x5a')][_0x70e8('0x5b')],'raw':!![]})['then'](function(_0x1d52f4){return _0x1d52f4;});})[_0x70e8('0x12')](function(_0x16b862){if(_0x16b862){_0x2c83d2[_0x70e8('0x1b')][_0x70e8('0x5c')]=_0x16b862[0x0];if(!_0x503428[_0x70e8('0x46')][_0x70e8('0x4d')])return;return db['User']['find']({'where':{'id':_0x503428['body'][_0x70e8('0x4d')],'role':_0x70e8('0x4f')},'attributes':['id','name',_0x70e8('0x5d'),'email',_0x70e8('0x5e')],'raw':!![]});}return null;})[_0x70e8('0x12')](function(_0x4ba089){if(!_0x4ba089)return null;_0x2c83d2[_0x70e8('0x1b')][_0x70e8('0x4f')]=_0x4ba089;return _0x2c83d2;})[_0x70e8('0x12')](function(_0xbf2a9b){if(_0xbf2a9b){_0xbf2a9b['message'][_0x70e8('0x5f')]=util[_0x70e8('0x60')](_0x70e8('0x61'),_0x503428['user'][_0x70e8('0x29')]);_0xbf2a9b['message'][_0x70e8('0x62')]=_0x2c83d2['channel'];_0xbf2a9b['message'][_0x70e8('0x63')]=_0x2c83d2[_0x70e8('0x62')];_0xbf2a9b[_0x70e8('0x1b')]['event']=_0x70e8('0x4c');respondWithRpcPromise(_0x70e8('0x64'),'EventManager',{'event':_0x70e8('0x65'),'message':_[_0x70e8('0x3e')](_0x2c83d2[_0x70e8('0x1b')],JSON['parse'](_0x2c83d2[_0x70e8('0x66')]['formData']))},client9002);return _0x2c83d2;}return null;})[_0x70e8('0x12')](respondWithResult(_0x57923d,null))[_0x70e8('0x1d')](handleError(_0x57923d,null));}; \ No newline at end of file +var _0xe8f3=['role','null','RejectMessage','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','format','channel','motionChannel','event','EventManager','rejectmessage','parse','interaction','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','client','http','chat-interactions','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','undefined','limit','count','offset','set','Content-Range','json','update','then','end','sendStatus','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','ChatMessage','findAll','rows','length','find','create','body','params','describe','accept','chat','reject','UserId','user','agent','get','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x218d84,_0x2f43d2){var _0xdbeedf=function(_0x16db2a){while(--_0x16db2a){_0x218d84['push'](_0x218d84['shift']());}};_0xdbeedf(++_0x2f43d2);}(_0xe8f3,0x77));var _0x3e8f=function(_0x3018eb,_0x570c63){_0x3018eb=_0x3018eb-0x0;var _0x23131f=_0xe8f3[_0x3018eb];return _0x23131f;};'use strict';var util=require(_0x3e8f('0x0'));var _=require(_0x3e8f('0x1'));var Redis=require(_0x3e8f('0x2'));var interactionService=require(_0x3e8f('0x3'));var qs=require(_0x3e8f('0x4'));var logger=require(_0x3e8f('0x5'))('api');var config=require(_0x3e8f('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3e8f('0x7')](config[_0x3e8f('0x8')],{'host':_0x3e8f('0x9'),'port':0x18eb});var socket=require(_0x3e8f('0xa'))(new Redis(config[_0x3e8f('0x8')]));require(_0x3e8f('0xb'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x3e8f('0xc')][_0x3e8f('0xd')]({'port':0x232c});var client9002=jayson[_0x3e8f('0xc')][_0x3e8f('0xd')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x3e8f('0xe'));function respondWithRpcPromise(_0x1c7949,_0x244066,_0x4931f6,_0x4ab24f){return new Promise(function(_0x2054e6,_0x1b5f57){var _0x5bf946=_0x4ab24f||client;return _0x5bf946[_0x3e8f('0xf')](_0x1c7949,_0x4931f6)['then'](function(_0x255f60){logger[_0x3e8f('0x10')](_0x3e8f('0x11'),_0x244066,_0x3e8f('0x12'));logger[_0x3e8f('0x13')](_0x3e8f('0x14'),_0x244066,'request\x20sent',JSON[_0x3e8f('0x15')](_0x255f60));if(_0x255f60[_0x3e8f('0x16')]){if(_0x255f60[_0x3e8f('0x16')]['code']===0x1f4){logger['error'](_0x3e8f('0x11'),_0x244066,_0x255f60[_0x3e8f('0x16')]['message']);return _0x1b5f57(_0x255f60[_0x3e8f('0x16')][_0x3e8f('0x17')]);}logger[_0x3e8f('0x16')](_0x3e8f('0x11'),_0x244066,_0x255f60[_0x3e8f('0x16')][_0x3e8f('0x17')]);return _0x2054e6(_0x255f60[_0x3e8f('0x16')]['message']);}else{logger[_0x3e8f('0x10')](_0x3e8f('0x11'),_0x244066,_0x3e8f('0x12'));_0x2054e6(_0x255f60[_0x3e8f('0x18')][_0x3e8f('0x17')]);}})[_0x3e8f('0x19')](function(_0x348a3c){logger['error']('ChatMessage,\x20%s,\x20%s',_0x244066,_0x348a3c);_0x1b5f57(_0x348a3c);});});}function respondWithResult(_0x5acff4,_0x1cc394){_0x1cc394=_0x1cc394||0xc8;return function(_0x18c487){if(_0x18c487){return _0x5acff4[_0x3e8f('0x1a')](_0x1cc394)['json'](_0x18c487);}};}function respondWithFilteredResult(_0x523a77,_0x585ea9){return function(_0x1c995d){if(_0x1c995d){var _0x55071b=typeof _0x585ea9['offset']===_0x3e8f('0x1b')&&typeof _0x585ea9[_0x3e8f('0x1c')]===_0x3e8f('0x1b');var _0x555b60=_0x1c995d[_0x3e8f('0x1d')];var _0x530c34=_0x55071b?0x0:_0x585ea9[_0x3e8f('0x1e')];var _0x3a8511=_0x55071b?_0x1c995d[_0x3e8f('0x1d')]:_0x585ea9['offset']+_0x585ea9[_0x3e8f('0x1c')];var _0x5f5412;if(_0x3a8511>=_0x555b60){_0x3a8511=_0x555b60;_0x5f5412=0xc8;}else{_0x5f5412=0xce;}_0x523a77[_0x3e8f('0x1a')](_0x5f5412);return _0x523a77[_0x3e8f('0x1f')](_0x3e8f('0x20'),_0x530c34+'-'+_0x3a8511+'/'+_0x555b60)[_0x3e8f('0x21')](_0x1c995d);}return null;};}function saveUpdates(_0x2f884c){return function(_0x2aed88){if(_0x2aed88){return _0x2aed88[_0x3e8f('0x22')](_0x2f884c)[_0x3e8f('0x23')](function(_0x4e1694){return _0x4e1694;});}return null;};}function removeEntity(_0x2b17cc){return function(_0x3cba8f){if(_0x3cba8f){return _0x3cba8f['destroy']()[_0x3e8f('0x23')](function(){_0x2b17cc[_0x3e8f('0x1a')](0xcc)[_0x3e8f('0x24')]();});}};}function handleEntityNotFound(_0x36b126){return function(_0x4dd400){if(!_0x4dd400){_0x36b126[_0x3e8f('0x25')](0x194);}return _0x4dd400;};}function handleError(_0x280d9b,_0x50fa7f){_0x50fa7f=_0x50fa7f||0x1f4;return function(_0x182390){logger['error'](_0x182390[_0x3e8f('0x26')]);if(_0x182390[_0x3e8f('0x27')]){delete _0x182390[_0x3e8f('0x27')];}_0x280d9b[_0x3e8f('0x1a')](_0x50fa7f)['send'](_0x182390);};}exports[_0x3e8f('0x28')]=function(_0x4e0c77,_0x353180){var _0x556eab={},_0x58220e={},_0x316923={'count':0x0,'rows':[]};var _0x4c37d8=_['map'](db['ChatMessage'][_0x3e8f('0x29')],function(_0x59e5c3){return{'name':_0x59e5c3[_0x3e8f('0x2a')],'type':_0x59e5c3['type'][_0x3e8f('0x2b')]};});_0x58220e[_0x3e8f('0x2c')]=_[_0x3e8f('0x2d')](_0x4c37d8,'name');_0x58220e[_0x3e8f('0x2e')]=_[_0x3e8f('0x2f')](_0x4e0c77[_0x3e8f('0x2e')]);_0x58220e[_0x3e8f('0x30')]=_[_0x3e8f('0x31')](_0x58220e[_0x3e8f('0x2c')],_0x58220e[_0x3e8f('0x2e')]);_0x556eab[_0x3e8f('0x32')]=_[_0x3e8f('0x31')](_0x58220e[_0x3e8f('0x2c')],qs[_0x3e8f('0x33')](_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x33')]));_0x556eab[_0x3e8f('0x32')]=_0x556eab[_0x3e8f('0x32')]['length']?_0x556eab['attributes']:_0x58220e[_0x3e8f('0x2c')];if(!_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x34')](_0x3e8f('0x35'))){_0x556eab[_0x3e8f('0x1c')]=qs[_0x3e8f('0x1c')](_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x1c')]);_0x556eab['offset']=qs[_0x3e8f('0x1e')](_0x4e0c77['query'][_0x3e8f('0x1e')]);}_0x556eab[_0x3e8f('0x36')]=qs[_0x3e8f('0x37')](_0x4e0c77[_0x3e8f('0x2e')]['sort']);_0x556eab[_0x3e8f('0x38')]=qs['filters'](_[_0x3e8f('0x39')](_0x4e0c77[_0x3e8f('0x2e')],_0x58220e[_0x3e8f('0x30')]),_0x4c37d8);if(_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x3a')]){_0x556eab[_0x3e8f('0x38')]=_['merge'](_0x556eab[_0x3e8f('0x38')],{'$or':_['map'](_0x4c37d8,function(_0x55b628){if(_0x55b628['type']!=='VIRTUAL'){var _0x10755e={};_0x10755e[_0x55b628[_0x3e8f('0x27')]]={'$like':'%'+_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x3a')]+'%'};return _0x10755e;}})});}_0x556eab=_[_0x3e8f('0x3b')]({},_0x556eab,_0x4e0c77[_0x3e8f('0x3c')]);var _0x1b11a3={'where':_0x556eab[_0x3e8f('0x38')]};return db['ChatMessage']['count'](_0x1b11a3)[_0x3e8f('0x23')](function(_0x2422ed){_0x316923[_0x3e8f('0x1d')]=_0x2422ed;if(_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x3d')]){_0x556eab[_0x3e8f('0x3e')]=[{'all':!![]}];}return db[_0x3e8f('0x3f')][_0x3e8f('0x40')](_0x556eab);})['then'](function(_0x29bd09){_0x316923[_0x3e8f('0x41')]=_0x29bd09;return _0x316923;})[_0x3e8f('0x23')](respondWithFilteredResult(_0x353180,_0x556eab))[_0x3e8f('0x19')](handleError(_0x353180,null));};exports['show']=function(_0x4d2f36,_0x5dfa49){var _0x35c2e5={'raw':!![],'where':{'id':_0x4d2f36['params']['id']}},_0x10dd46={};_0x10dd46[_0x3e8f('0x2c')]=_[_0x3e8f('0x2f')](db['ChatMessage'][_0x3e8f('0x29')]);_0x10dd46[_0x3e8f('0x2e')]=_['keys'](_0x4d2f36['query']);_0x10dd46[_0x3e8f('0x30')]=_[_0x3e8f('0x31')](_0x10dd46[_0x3e8f('0x2c')],_0x10dd46[_0x3e8f('0x2e')]);_0x35c2e5[_0x3e8f('0x32')]=_['intersection'](_0x10dd46[_0x3e8f('0x2c')],qs[_0x3e8f('0x33')](_0x4d2f36['query'][_0x3e8f('0x33')]));_0x35c2e5[_0x3e8f('0x32')]=_0x35c2e5[_0x3e8f('0x32')][_0x3e8f('0x42')]?_0x35c2e5[_0x3e8f('0x32')]:_0x10dd46[_0x3e8f('0x2c')];if(_0x4d2f36['query'][_0x3e8f('0x3d')]){_0x35c2e5['include']=[{'all':!![]}];}_0x35c2e5=_[_0x3e8f('0x3b')]({},_0x35c2e5,_0x4d2f36[_0x3e8f('0x3c')]);return db[_0x3e8f('0x3f')][_0x3e8f('0x43')](_0x35c2e5)['then'](handleEntityNotFound(_0x5dfa49,null))['then'](respondWithResult(_0x5dfa49,null))[_0x3e8f('0x19')](handleError(_0x5dfa49,null));};exports['create']=function(_0x19a6cc,_0x4a8f2a){return db[_0x3e8f('0x3f')][_0x3e8f('0x44')](_0x19a6cc['body'],{})[_0x3e8f('0x23')](respondWithResult(_0x4a8f2a,0xc9))[_0x3e8f('0x19')](handleError(_0x4a8f2a,null));};exports[_0x3e8f('0x22')]=function(_0x350ef6,_0x5348ff){if(_0x350ef6[_0x3e8f('0x45')]['id']){delete _0x350ef6['body']['id'];}return db['ChatMessage'][_0x3e8f('0x43')]({'where':{'id':_0x350ef6[_0x3e8f('0x46')]['id']}})[_0x3e8f('0x23')](handleEntityNotFound(_0x5348ff,null))['then'](saveUpdates(_0x350ef6[_0x3e8f('0x45')],null))[_0x3e8f('0x23')](respondWithResult(_0x5348ff,null))[_0x3e8f('0x19')](handleError(_0x5348ff,null));};exports['destroy']=function(_0x541d99,_0x4ce51b){return db[_0x3e8f('0x3f')][_0x3e8f('0x43')]({'where':{'id':_0x541d99[_0x3e8f('0x46')]['id']}})[_0x3e8f('0x23')](handleEntityNotFound(_0x4ce51b,null))['then'](removeEntity(_0x4ce51b,null))[_0x3e8f('0x19')](handleError(_0x4ce51b,null));};exports['describe']=function(_0x46f1a,_0xe52e19){return db[_0x3e8f('0x3f')][_0x3e8f('0x47')]()[_0x3e8f('0x23')](respondWithResult(_0xe52e19,null))[_0x3e8f('0x19')](handleError(_0xe52e19,null));};exports[_0x3e8f('0x48')]=function(_0x59692c,_0x466c94){var _0x5d1a8f=_0x3e8f('0x49');return interactionService['acceptMessage'](_0x59692c,_0x5d1a8f)['then'](respondWithResult(_0x466c94,null))[_0x3e8f('0x19')](handleError(_0x466c94,null));};exports[_0x3e8f('0x4a')]=function(_0x56a342,_0x5caa7a){var _0x1748fa={'agent':{},'channel':_0x3e8f('0x49')};if(_0x56a342['body']['id']){delete _0x56a342[_0x3e8f('0x45')]['id'];}_0x56a342[_0x3e8f('0x45')][_0x3e8f('0x4b')]=_0x56a342[_0x3e8f('0x45')][_0x3e8f('0x4b')]||_0x56a342[_0x3e8f('0x4c')]['id'];_0x1748fa[_0x3e8f('0x4d')]['id']=_0x56a342['body']['UserId'];return db[_0x3e8f('0x3f')]['find']({'where':{'id':_0x56a342[_0x3e8f('0x46')]['id'],'UserId':null}})[_0x3e8f('0x23')](handleEntityNotFound(_0x5caa7a,null))[_0x3e8f('0x23')](function(_0x3845db){if(_0x3845db){_0x1748fa[_0x3e8f('0x17')]=_0x3845db[_0x3e8f('0x4e')]({'plain':!![]});return db['ChatInteraction'][_0x3e8f('0x43')]({'where':{'id':_0x3845db[_0x3e8f('0x4f')]}});}return null;})[_0x3e8f('0x23')](handleEntityNotFound(_0x5caa7a,null))[_0x3e8f('0x23')](function(_0x5cbad9){if(_0x5cbad9){_0x1748fa['interaction']=_0x5cbad9[_0x3e8f('0x4e')]({'plain':!![]});interaction_log[_0x3e8f('0x10')](_0x3e8f('0x50'),_0x56a342['user']['id'],_0x56a342[_0x3e8f('0x4c')]['name'],_0x56a342[_0x3e8f('0x4c')][_0x3e8f('0x51')],_0x1748fa['interaction']['id'],_0x56a342[_0x3e8f('0x45')]?JSON['stringify'](_0x56a342[_0x3e8f('0x45')]):_0x3e8f('0x52'));return respondWithRpcPromise(_0x3e8f('0x53'),'rejectMessage',_0x1748fa);}return null;})[_0x3e8f('0x23')](function(_0x54156e){var _0x6c3b6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x54156e['message'][_0x3e8f('0x54')];return db['sequelize'][_0x3e8f('0x2e')](_0x6c3b6,{'type':db[_0x3e8f('0x55')][_0x3e8f('0x56')]['SELECT'],'raw':!![]})['then'](function(_0x3bc1d4){return _0x3bc1d4;});})[_0x3e8f('0x23')](function(_0x565fef){if(_0x565fef){_0x1748fa[_0x3e8f('0x17')][_0x3e8f('0x57')]=_0x565fef[0x0];if(!_0x56a342[_0x3e8f('0x45')][_0x3e8f('0x4b')])return;return db[_0x3e8f('0x58')]['find']({'where':{'id':_0x56a342[_0x3e8f('0x45')]['UserId'],'role':_0x3e8f('0x4d')},'attributes':['id',_0x3e8f('0x27'),_0x3e8f('0x59'),_0x3e8f('0x5a'),_0x3e8f('0x5b')],'raw':!![]});}return null;})['then'](function(_0x458fe9){if(!_0x458fe9)return null;_0x1748fa['message'][_0x3e8f('0x4d')]=_0x458fe9;return _0x1748fa;})[_0x3e8f('0x23')](function(_0x2949df){if(_0x2949df){_0x2949df[_0x3e8f('0x17')]['interface']=util[_0x3e8f('0x5c')]('SIP/%s',_0x56a342[_0x3e8f('0x4c')]['name']);_0x2949df[_0x3e8f('0x17')][_0x3e8f('0x5d')]=_0x1748fa[_0x3e8f('0x5d')];_0x2949df[_0x3e8f('0x17')][_0x3e8f('0x5e')]=_0x1748fa[_0x3e8f('0x5d')];_0x2949df[_0x3e8f('0x17')][_0x3e8f('0x5f')]=_0x3e8f('0x4a');respondWithRpcPromise(_0x3e8f('0x60'),_0x3e8f('0x60'),{'event':_0x3e8f('0x61'),'message':_[_0x3e8f('0x3b')](_0x1748fa[_0x3e8f('0x17')],JSON[_0x3e8f('0x62')](_0x1748fa[_0x3e8f('0x63')]['formData']))},client9002);return _0x1748fa;}return null;})[_0x3e8f('0x23')](respondWithResult(_0x5caa7a,null))['catch'](handleError(_0x5caa7a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 7b0868a..a07716d 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 _0x07e3=['update','remove','emit','hasOwnProperty','hook','events','ChatMessage','setMaxListeners','save'];(function(_0x442ece,_0x1c5c60){var _0x303ff5=function(_0x5a94a3){while(--_0x5a94a3){_0x442ece['push'](_0x442ece['shift']());}};_0x303ff5(++_0x1c5c60);}(_0x07e3,0xd4));var _0x307e=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x07e3[_0xbc346f];return _0x9f9260;};'use strict';var EventEmitter=require(_0x307e('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x307e('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x307e('0x2')](0x0);var events={'afterCreate':_0x307e('0x3'),'afterUpdate':_0x307e('0x4'),'afterDestroy':_0x307e('0x5')};function emitEvent(_0x196f4b){return function(_0x52b6b0,_0x14a025,_0x3f22aa){ChatMessageEvents['emit'](_0x196f4b+':'+_0x52b6b0['id'],_0x52b6b0);ChatMessageEvents[_0x307e('0x6')](_0x196f4b,_0x52b6b0);_0x3f22aa(null);};}for(var e in events){if(events[_0x307e('0x7')](e)){var event=events[e];ChatMessage[_0x307e('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x56e3=['update','emit','hook','events','../../mysqldb','ChatMessage','save'];(function(_0x318f2,_0x3bc7b3){var _0x3bcab8=function(_0x19bc02){while(--_0x19bc02){_0x318f2['push'](_0x318f2['shift']());}};_0x3bcab8(++_0x3bc7b3);}(_0x56e3,0x17d));var _0x356e=function(_0x536da7,_0x5686ee){_0x536da7=_0x536da7-0x0;var _0x744edf=_0x56e3[_0x536da7];return _0x744edf;};'use strict';var EventEmitter=require(_0x356e('0x0'));var ChatMessage=require(_0x356e('0x1'))['db'][_0x356e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x356e('0x3'),'afterUpdate':_0x356e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x561596){return function(_0x5c66c9,_0x253610,_0x40a2ba){ChatMessageEvents[_0x356e('0x5')](_0x561596+':'+_0x5c66c9['id'],_0x5c66c9);ChatMessageEvents[_0x356e('0x5')](_0x561596,_0x5c66c9);_0x40a2ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x356e('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index e3b36fc..8fe9294 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 _0xad2c=['get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xad2c,0x13a));var _0xcad2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xad2c[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xcad2('0x0'));var util=require(_0xcad2('0x1'));var logger=require(_0xcad2('0x2'))('api');var moment=require(_0xcad2('0x3'));var BPromise=require(_0xcad2('0x4'));var rp=require(_0xcad2('0x5'));var fs=require('fs');var path=require(_0xcad2('0x6'));var rimraf=require(_0xcad2('0x7'));var config=require('../../config/environment');var attributes=require(_0xcad2('0x8'));module[_0xcad2('0x9')]=function(_0x1203e0,_0x220af1){return _0x1203e0[_0xcad2('0xa')](_0xcad2('0xb'),attributes,{'tableName':_0xcad2('0xc'),'paranoid':![],'indexes':[{'name':_0xcad2('0xd'),'fields':['body'],'type':_0xcad2('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23d966,_0x3a2d16,_0x3e63ce){var _0x552ce9=_0x1203e0[_0xcad2('0xf')];var _0x48d76a=_0x23d966[_0xcad2('0x10')]({'plain':!![]});if(_0x48d76a[_0xcad2('0x11')][_0xcad2('0x12')]()==='in'||_0x48d76a[_0xcad2('0x11')][_0xcad2('0x12')]()===_0xcad2('0x13')&&!_0x48d76a[_0xcad2('0x14')]&&!_[_0xcad2('0x15')](_0x48d76a[_0xcad2('0x16')])){_0x552ce9[_0xcad2('0x17')][_0xcad2('0x18')]({'where':{'id':_0x48d76a[_0xcad2('0x19')]}})['then'](function(_0x1438aa){if(_0x1438aa){_0x1438aa[_0xcad2('0x1a')]({'lastMsgAt':_0x48d76a[_0xcad2('0x1b')],'lastMsgDirection':_0x48d76a[_0xcad2('0x11')][_0xcad2('0x12')]()});}})[_0xcad2('0x1c')](function(_0x46e7c2){console['error'](_0x46e7c2);});}_0x3e63ce();}},'charset':'utf8mb4','collate':_0xcad2('0x1d')});}; \ No newline at end of file +var _0x2395=['request-promise','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird'];(function(_0x49ad45,_0x175d1d){var _0xf043c=function(_0x5b93a2){while(--_0x5b93a2){_0x49ad45['push'](_0x49ad45['shift']());}};_0xf043c(++_0x175d1d);}(_0x2395,0x114));var _0x5239=function(_0x886007,_0x55cca6){_0x886007=_0x886007-0x0;var _0x866e9f=_0x2395[_0x886007];return _0x866e9f;};'use strict';var _=require('lodash');var util=require(_0x5239('0x0'));var logger=require(_0x5239('0x1'))(_0x5239('0x2'));var moment=require('moment');var BPromise=require(_0x5239('0x3'));var rp=require(_0x5239('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5239('0x5'));var config=require(_0x5239('0x6'));var attributes=require(_0x5239('0x7'));module['exports']=function(_0x5c4428,_0x30e7b5){return _0x5c4428[_0x5239('0x8')]('ChatMessage',attributes,{'tableName':_0x5239('0x9'),'paranoid':![],'indexes':[{'name':_0x5239('0xa'),'fields':[_0x5239('0xb')],'type':_0x5239('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12e8ef,_0x3674a9,_0x5c5e6e){var _0xd2988c=_0x5c4428['models'];var _0x373c90=_0x12e8ef[_0x5239('0xd')]({'plain':!![]});if(_0x373c90[_0x5239('0xe')][_0x5239('0xf')]()==='in'||_0x373c90[_0x5239('0xe')][_0x5239('0xf')]()===_0x5239('0x10')&&!_0x373c90[_0x5239('0x11')]&&!_[_0x5239('0x12')](_0x373c90[_0x5239('0x13')])){_0xd2988c[_0x5239('0x14')]['findOne']({'where':{'id':_0x373c90[_0x5239('0x15')]}})[_0x5239('0x16')](function(_0x25c541){if(_0x25c541){_0x25c541[_0x5239('0x17')]({'lastMsgAt':_0x373c90[_0x5239('0x18')],'lastMsgDirection':_0x373c90[_0x5239('0xe')][_0x5239('0xf')]()});}})[_0x5239('0x19')](function(_0x40d9fb){console[_0x5239('0x1a')](_0x40d9fb);});}_0x5c5e6e();}},'charset':'utf8mb4','collate':_0x5239('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 59b2b6a..2a72f16 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 _0x9127=['message','info','catch','CreateChatMessage','ChatMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7b7181,_0x5f065e){var _0x3ea6ef=function(_0x2d6e06){while(--_0x2d6e06){_0x7b7181['push'](_0x7b7181['shift']());}};_0x3ea6ef(++_0x5f065e);}(_0x9127,0x180));var _0x7912=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x9127[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0x7912('0x0'));var util=require(_0x7912('0x1'));var moment=require(_0x7912('0x2'));var BPromise=require(_0x7912('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7912('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7912('0x5'))(_0x7912('0x6'));var config=require(_0x7912('0x7'));var jayson=require(_0x7912('0x8'));var client=jayson[_0x7912('0x9')][_0x7912('0xa')]({'port':0x232a});config[_0x7912('0xb')]=_[_0x7912('0xc')](config['redis'],{'host':_0x7912('0xd'),'port':0x18eb});var socket=require(_0x7912('0xe'))(new Redis(config[_0x7912('0xb')]));require(_0x7912('0xf'))['register'](socket);function respondWithRpcPromise(_0x218dc9,_0x586ccb,_0x438339){return new BPromise(function(_0x9ddd99,_0x4d7522){return client[_0x7912('0x10')](_0x218dc9,_0x438339)[_0x7912('0x11')](function(_0x3b56aa){logger['info'](_0x7912('0x12'),_0x586ccb,_0x7912('0x13'));logger['debug'](_0x7912('0x14'),_0x586ccb,'request\x20sent',JSON[_0x7912('0x15')](_0x3b56aa));if(_0x3b56aa['error']){if(_0x3b56aa[_0x7912('0x16')][_0x7912('0x17')]===0x1f4){logger[_0x7912('0x16')](_0x7912('0x12'),_0x586ccb,_0x3b56aa['error'][_0x7912('0x18')]);return _0x4d7522(_0x3b56aa['error'][_0x7912('0x18')]);}logger[_0x7912('0x16')](_0x7912('0x12'),_0x586ccb,_0x3b56aa[_0x7912('0x16')][_0x7912('0x18')]);return _0x9ddd99(_0x3b56aa[_0x7912('0x16')]['message']);}else{logger[_0x7912('0x19')](_0x7912('0x12'),_0x586ccb,_0x7912('0x13'));_0x9ddd99(_0x3b56aa['result'][_0x7912('0x18')]);}})[_0x7912('0x1a')](function(_0x8173e6){logger[_0x7912('0x16')](_0x7912('0x12'),_0x586ccb,_0x8173e6);_0x4d7522(_0x8173e6);});});}exports[_0x7912('0x1b')]=function(_0x5e1b4e){var _0x15f148=this;return new Promise(function(_0x116390,_0x27f312){return db[_0x7912('0x1c')][_0x7912('0x1d')](_0x5e1b4e[_0x7912('0x1e')],{'raw':_0x5e1b4e[_0x7912('0x1f')]?_0x5e1b4e[_0x7912('0x1f')][_0x7912('0x20')]===undefined?!![]:![]:!![]})[_0x7912('0x11')](function(_0x3e3447){logger[_0x7912('0x19')](_0x7912('0x1b'),_0x5e1b4e);logger[_0x7912('0x21')](_0x7912('0x1b'),_0x5e1b4e,JSON['stringify'](_0x3e3447));_0x116390(_0x3e3447);})[_0x7912('0x1a')](function(_0x4410b4){logger[_0x7912('0x16')](_0x7912('0x1b'),_0x4410b4[_0x7912('0x18')],_0x5e1b4e);_0x27f312(_0x15f148[_0x7912('0x16')](0x1f4,_0x4410b4['message']));});});}; \ No newline at end of file +var _0x1a9a=['client','defaults','redis','localhost','socket.io-emitter','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateChatMessage','ChatMessage','create','options','raw','debug','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x52ce8e,_0x4dacf5){var _0x489cf9=function(_0x374ab2){while(--_0x374ab2){_0x52ce8e['push'](_0x52ce8e['shift']());}};_0x489cf9(++_0x4dacf5);}(_0x1a9a,0x19b));var _0xa1a9=function(_0x3d0a2c,_0x18e9b8){_0x3d0a2c=_0x3d0a2c-0x0;var _0x2265ab=_0x1a9a[_0x3d0a2c];return _0x2265ab;};'use strict';var _=require(_0xa1a9('0x0'));var util=require(_0xa1a9('0x1'));var moment=require(_0xa1a9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1a9('0x3'))['db'];var utils=require(_0xa1a9('0x4'));var logger=require(_0xa1a9('0x5'))(_0xa1a9('0x6'));var config=require(_0xa1a9('0x7'));var jayson=require(_0xa1a9('0x8'));var client=jayson[_0xa1a9('0x9')]['http']({'port':0x232a});config['redis']=_[_0xa1a9('0xa')](config[_0xa1a9('0xb')],{'host':_0xa1a9('0xc'),'port':0x18eb});var socket=require(_0xa1a9('0xd'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a61bb,_0x56ac7f,_0x2550a7){return new BPromise(function(_0x3744cf,_0x4001e0){return client['request'](_0x2a61bb,_0x2550a7)[_0xa1a9('0xe')](function(_0x510b9e){logger['info'](_0xa1a9('0xf'),_0x56ac7f,_0xa1a9('0x10'));logger['debug'](_0xa1a9('0x11'),_0x56ac7f,'request\x20sent',JSON['stringify'](_0x510b9e));if(_0x510b9e[_0xa1a9('0x12')]){if(_0x510b9e['error'][_0xa1a9('0x13')]===0x1f4){logger['error'](_0xa1a9('0xf'),_0x56ac7f,_0x510b9e[_0xa1a9('0x12')][_0xa1a9('0x14')]);return _0x4001e0(_0x510b9e[_0xa1a9('0x12')][_0xa1a9('0x14')]);}logger[_0xa1a9('0x12')](_0xa1a9('0xf'),_0x56ac7f,_0x510b9e[_0xa1a9('0x12')][_0xa1a9('0x14')]);return _0x3744cf(_0x510b9e[_0xa1a9('0x12')]['message']);}else{logger[_0xa1a9('0x15')](_0xa1a9('0xf'),_0x56ac7f,_0xa1a9('0x10'));_0x3744cf(_0x510b9e[_0xa1a9('0x16')]['message']);}})[_0xa1a9('0x17')](function(_0x422d5b){logger['error'](_0xa1a9('0xf'),_0x56ac7f,_0x422d5b);_0x4001e0(_0x422d5b);});});}exports[_0xa1a9('0x18')]=function(_0x537d74){var _0x86d348=this;return new Promise(function(_0x278136,_0x3f8e5f){return db[_0xa1a9('0x19')][_0xa1a9('0x1a')](_0x537d74['body'],{'raw':_0x537d74[_0xa1a9('0x1b')]?_0x537d74[_0xa1a9('0x1b')][_0xa1a9('0x1c')]===undefined?!![]:![]:!![]})[_0xa1a9('0xe')](function(_0x4b8f7e){logger[_0xa1a9('0x15')](_0xa1a9('0x18'),_0x537d74);logger[_0xa1a9('0x1d')](_0xa1a9('0x18'),_0x537d74,JSON['stringify'](_0x4b8f7e));_0x278136(_0x4b8f7e);})[_0xa1a9('0x17')](function(_0x5aa0e0){logger[_0xa1a9('0x12')](_0xa1a9('0x18'),_0x5aa0e0['message'],_0x537d74);_0x3f8e5f(_0x86d348['error'](0x1f4,_0x5aa0e0[_0xa1a9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index abe1e35..37ff7ce 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 _0x5162=['chatMessage:','./chatMessage.events','emit','removeListener','register','length'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x5162,0x103));var _0x2516=function(_0x57f7ea,_0x54da6b){_0x57f7ea=_0x57f7ea-0x0;var _0x54a7e4=_0x5162[_0x57f7ea];return _0x54a7e4;};'use strict';var ChatMessageEvents=require(_0x2516('0x0'));var events=['save','remove','update'];function createListener(_0x4db25c,_0x41fd28){return function(_0x2aaef5){_0x41fd28[_0x2516('0x1')](_0x4db25c,_0x2aaef5);};}function removeListener(_0x2d0b53,_0x2e48b6){return function(){ChatMessageEvents[_0x2516('0x2')](_0x2d0b53,_0x2e48b6);};}exports[_0x2516('0x3')]=function(_0x5b71b5){for(var _0x48f411=0x0,_0x5beeb3=events[_0x2516('0x4')];_0x48f411<_0x5beeb3;_0x48f411++){var _0xba4b36=events[_0x48f411];var _0xa1557=createListener(_0x2516('0x5')+_0xba4b36,_0x5b71b5);ChatMessageEvents['on'](_0xba4b36,_0xa1557);}}; \ No newline at end of file +var _0x0e85=['update','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x4fe1e3,_0x587148){var _0x474845=function(_0x2c8876){while(--_0x2c8876){_0x4fe1e3['push'](_0x4fe1e3['shift']());}};_0x474845(++_0x587148);}(_0x0e85,0x7c));var _0x50e8=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x0e85[_0x369151];return _0x4292d5;};'use strict';var ChatMessageEvents=require(_0x50e8('0x0'));var events=[_0x50e8('0x1'),'remove',_0x50e8('0x2')];function createListener(_0x682d10,_0x55e515){return function(_0x55cba3){_0x55e515['emit'](_0x682d10,_0x55cba3);};}function removeListener(_0x236cf3,_0x4e90e7){return function(){ChatMessageEvents[_0x50e8('0x3')](_0x236cf3,_0x4e90e7);};}exports[_0x50e8('0x4')]=function(_0xe3151e){for(var _0xfde42=0x0,_0x5e8b01=events[_0x50e8('0x5')];_0xfde42<_0x5e8b01;_0xfde42++){var _0x108edc=events[_0xfde42];var _0x42665e=createListener(_0x50e8('0x6')+_0x108edc,_0xe3151e);ChatMessageEvents['on'](_0x108edc,_0x42665e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 0873fae..cbf0549 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 _0xb43a=['create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','/:id','post','tracked','chatmessage:create'];(function(_0x5b33ac,_0x359e75){var _0x304b3f=function(_0xf6f90d){while(--_0xf6f90d){_0x5b33ac['push'](_0x5b33ac['shift']());}};_0x304b3f(++_0x359e75);}(_0xb43a,0x199));var _0xab43=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xb43a[_0x44a64f];return _0x52024b;};'use strict';var multer=require('multer');var util=require(_0xab43('0x0'));var path=require(_0xab43('0x1'));var timeout=require(_0xab43('0x2'));var express=require(_0xab43('0x3'));var router=express[_0xab43('0x4')]();var fs_extra=require(_0xab43('0x5'));var auth=require(_0xab43('0x6'));var interaction=require(_0xab43('0x7'));var config=require(_0xab43('0x8'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0xab43('0x9')](),controller[_0xab43('0xa')]);router['get'](_0xab43('0xb'),auth[_0xab43('0x9')](),controller['describe']);router['get'](_0xab43('0xc'),auth[_0xab43('0x9')](),controller['show']);router[_0xab43('0xd')]('/',auth['isAuthenticated'](),interaction[_0xab43('0xe')]('chat',_0xab43('0xf')),controller[_0xab43('0x10')]);router[_0xab43('0x11')](_0xab43('0xc'),controller[_0xab43('0x12')]);router[_0xab43('0x11')](_0xab43('0x13'),auth[_0xab43('0x9')](),controller[_0xab43('0x14')]);router[_0xab43('0x11')](_0xab43('0x15'),auth['isAuthenticated'](),controller[_0xab43('0x16')]);router[_0xab43('0x17')](_0xab43('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xab43('0x18')]=router; \ No newline at end of file +var _0x4596=['../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2f5dad,_0x4313ad){var _0x38e02d=function(_0x44833a){while(--_0x44833a){_0x2f5dad['push'](_0x2f5dad['shift']());}};_0x38e02d(++_0x4313ad);}(_0x4596,0xe3));var _0x6459=function(_0x498b2e,_0x34a4ed){_0x498b2e=_0x498b2e-0x0;var _0x10ff45=_0x4596[_0x498b2e];return _0x10ff45;};'use strict';var multer=require(_0x6459('0x0'));var util=require(_0x6459('0x1'));var path=require('path');var timeout=require(_0x6459('0x2'));var express=require(_0x6459('0x3'));var router=express[_0x6459('0x4')]();var fs_extra=require(_0x6459('0x5'));var auth=require(_0x6459('0x6'));var interaction=require(_0x6459('0x7'));var config=require(_0x6459('0x8'));var controller=require(_0x6459('0x9'));router[_0x6459('0xa')]('/',auth[_0x6459('0xb')](),controller[_0x6459('0xc')]);router[_0x6459('0xa')]('/describe',auth[_0x6459('0xb')](),controller[_0x6459('0xd')]);router['get'](_0x6459('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x6459('0xf')]('/',auth[_0x6459('0xb')](),interaction['tracked'](_0x6459('0x10'),_0x6459('0x11')),controller[_0x6459('0x12')]);router[_0x6459('0x13')]('/:id',controller[_0x6459('0x14')]);router['put'](_0x6459('0x15'),auth[_0x6459('0xb')](),controller[_0x6459('0x16')]);router[_0x6459('0x13')]('/:id/reject',auth[_0x6459('0xb')](),controller[_0x6459('0x17')]);router['delete'](_0x6459('0xe'),auth[_0x6459('0xb')](),controller[_0x6459('0x18')]);module[_0x6459('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 899d288..8b588dc 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0x26ec0a,_0x3d532d){var _0x48a447=function(_0x4d6705){while(--_0x4d6705){_0x26ec0a['push'](_0x26ec0a['shift']());}};_0x48a447(++_0x3d532d);}(_0xb10b,0x12a));var _0xbb10=function(_0x503d00,_0x323df1){_0x503d00=_0x503d00-0x0;var _0x2263d8=_0xb10b[_0x503d00];return _0x2263d8;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x3411f8,_0x1681d1){var _0x2a7fd2=function(_0x2cda1a){while(--_0x2cda1a){_0x3411f8['push'](_0x3411f8['shift']());}};_0x2a7fd2(++_0x1681d1);}(_0x2032,0xd9));var _0x2203=function(_0x429633,_0x44ea98){_0x429633=_0x429633-0x0;var _0x60087b=_0x2032[_0x429633];return _0x60087b;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 96117e3..9c03507 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(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x5185b8,_0x4282ea){_0x5185b8=_0x5185b8-0x0;var _0x38edb2=_0x7a54[_0x5185b8];return _0x38edb2;};'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 _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1cf6df,_0x1ce352){var _0x1fd96a=function(_0x3400d2){while(--_0x3400d2){_0x1cf6df['push'](_0x1cf6df['shift']());}};_0x1fd96a(++_0x1ce352);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 2708980..0021db4 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 _0xa009=['../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x18a7f3,_0x4cf3c5){var _0x1b070c=function(_0x1a664a){while(--_0x1a664a){_0x18a7f3['push'](_0x18a7f3['shift']());}};_0x1b070c(++_0x4cf3c5);}(_0xa009,0x13a));var _0x9a00=function(_0x4adc6d,_0x11275c){_0x4adc6d=_0x4adc6d-0x0;var _0x4d42e5=_0xa009[_0x4adc6d];return _0x4d42e5;};'use strict';var EventEmitter=require(_0x9a00('0x0'));var ChatOfflineMessage=require(_0x9a00('0x1'))['db'][_0x9a00('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9a00('0x3')](0x0);var events={'afterCreate':_0x9a00('0x4'),'afterUpdate':_0x9a00('0x5'),'afterDestroy':_0x9a00('0x6')};function emitEvent(_0x15730f){return function(_0xf578ba,_0x399968,_0x398e60){ChatOfflineMessageEvents[_0x9a00('0x7')](_0x15730f+':'+_0xf578ba['id'],_0xf578ba);ChatOfflineMessageEvents[_0x9a00('0x7')](_0x15730f,_0xf578ba);_0x398e60(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x9a00('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xd7ea=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save'];(function(_0xeb5f8d,_0x2549bf){var _0x4b3727=function(_0x337bbd){while(--_0x337bbd){_0xeb5f8d['push'](_0xeb5f8d['shift']());}};_0x4b3727(++_0x2549bf);}(_0xd7ea,0xeb));var _0xad7e=function(_0x180f0f,_0x1d2dc2){_0x180f0f=_0x180f0f-0x0;var _0xfd4e6c=_0xd7ea[_0x180f0f];return _0xfd4e6c;};'use strict';var EventEmitter=require(_0xad7e('0x0'));var ChatOfflineMessage=require(_0xad7e('0x1'))['db'][_0xad7e('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xad7e('0x3')](0x0);var events={'afterCreate':_0xad7e('0x4'),'afterUpdate':'update','afterDestroy':_0xad7e('0x5')};function emitEvent(_0x2c987b){return function(_0x532f0d,_0x33aeb1,_0x4972a9){ChatOfflineMessageEvents['emit'](_0x2c987b+':'+_0x532f0d['id'],_0x532f0d);ChatOfflineMessageEvents[_0xad7e('0x6')](_0x2c987b,_0x532f0d);_0x4972a9(null);};}for(var e in events){if(events[_0xad7e('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xad7e('0x8')](e,emitEvent(event));}}module[_0xad7e('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a70a58c..e86be47 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 _0xb35f=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4abd58,_0x523c62){var _0x3608a8=function(_0xa5878){while(--_0xa5878){_0x4abd58['push'](_0x4abd58['shift']());}};_0x3608a8(++_0x523c62);}(_0xb35f,0x131));var _0xfb35=function(_0x6cc07,_0x813f5d){_0x6cc07=_0x6cc07-0x0;var _0x5e745c=_0xb35f[_0x6cc07];return _0x5e745c;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x506702){return _0x506702[_0xfb35('0x0')](_0xfb35('0x1'),attributes,{'tableName':_0xfb35('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb35('0x3'),'collate':_0xfb35('0x4')});}; \ No newline at end of file +var _0x6b78=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x4c3344,_0x4c9e10){var _0x358bde=function(_0x1a1acc){while(--_0x1a1acc){_0x4c3344['push'](_0x4c3344['shift']());}};_0x358bde(++_0x4c9e10);}(_0x6b78,0x1b7));var _0x86b7=function(_0x5b3a85,_0x41f90c){_0x5b3a85=_0x5b3a85-0x0;var _0x1a580b=_0x6b78[_0x5b3a85];return _0x1a580b;};'use strict';var attributes=require(_0x86b7('0x0'));module[_0x86b7('0x1')]=function(_0x3d62f6){return _0x3d62f6[_0x86b7('0x2')](_0x86b7('0x3'),attributes,{'tableName':_0x86b7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86b7('0x5'),'collate':_0x86b7('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 4623b15..e333c13 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 _0xc164=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5ac71e,_0x440c86){var _0x2aaa2b=function(_0x5f37e0){while(--_0x5f37e0){_0x5ac71e['push'](_0x5ac71e['shift']());}};_0x2aaa2b(++_0x440c86);}(_0xc164,0x18e));var _0x4c16=function(_0x1c5104,_0x3bb9cc){_0x1c5104=_0x1c5104-0x0;var _0x21e4b6=_0xc164[_0x1c5104];return _0x21e4b6;};'use strict';var _=require('lodash');var util=require(_0x4c16('0x0'));var moment=require(_0x4c16('0x1'));var BPromise=require(_0x4c16('0x2'));var rs=require(_0x4c16('0x3'));var fs=require('fs');var Redis=require(_0x4c16('0x4'));var db=require(_0x4c16('0x5'))['db'];var utils=require(_0x4c16('0x6'));var logger=require(_0x4c16('0x7'))('rpc');var config=require(_0x4c16('0x8'));var jayson=require(_0x4c16('0x9'));var client=jayson[_0x4c16('0xa')][_0x4c16('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10525f,_0x5e62a8,_0xa6488e){return new BPromise(function(_0x236aa7,_0x233f0a){return client[_0x4c16('0xc')](_0x10525f,_0xa6488e)['then'](function(_0x3ed462){logger[_0x4c16('0xd')](_0x4c16('0xe'),_0x5e62a8,_0x4c16('0xf'));logger[_0x4c16('0x10')](_0x4c16('0x11'),_0x5e62a8,_0x4c16('0xf'),JSON[_0x4c16('0x12')](_0x3ed462));if(_0x3ed462[_0x4c16('0x13')]){if(_0x3ed462['error']['code']===0x1f4){logger[_0x4c16('0x13')](_0x4c16('0xe'),_0x5e62a8,_0x3ed462['error'][_0x4c16('0x14')]);return _0x233f0a(_0x3ed462[_0x4c16('0x13')][_0x4c16('0x14')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x5e62a8,_0x3ed462[_0x4c16('0x13')][_0x4c16('0x14')]);return _0x236aa7(_0x3ed462[_0x4c16('0x13')][_0x4c16('0x14')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x5e62a8,_0x4c16('0xf'));_0x236aa7(_0x3ed462[_0x4c16('0x15')][_0x4c16('0x14')]);}})['catch'](function(_0x3aa010){logger['error'](_0x4c16('0xe'),_0x5e62a8,_0x3aa010);_0x233f0a(_0x3aa010);});});} \ No newline at end of file +var _0x68c6=['then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x34e48b,_0x43ee22){var _0x26ff12=function(_0x1890b4){while(--_0x1890b4){_0x34e48b['push'](_0x34e48b['shift']());}};_0x26ff12(++_0x43ee22);}(_0x68c6,0x137));var _0x668c=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0x68c6[_0x545bed];return _0x16c79c;};'use strict';var _=require('lodash');var util=require(_0x668c('0x0'));var moment=require(_0x668c('0x1'));var BPromise=require(_0x668c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x668c('0x3'));var logger=require(_0x668c('0x4'))(_0x668c('0x5'));var config=require(_0x668c('0x6'));var jayson=require(_0x668c('0x7'));var client=jayson['client'][_0x668c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3420d5,_0x3c4f87,_0x44b279){return new BPromise(function(_0x483ef6,_0x29758b){return client['request'](_0x3420d5,_0x44b279)[_0x668c('0x9')](function(_0x5ba1b8){logger[_0x668c('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3c4f87,_0x668c('0xb'));logger[_0x668c('0xc')](_0x668c('0xd'),_0x3c4f87,_0x668c('0xb'),JSON[_0x668c('0xe')](_0x5ba1b8));if(_0x5ba1b8[_0x668c('0xf')]){if(_0x5ba1b8[_0x668c('0xf')][_0x668c('0x10')]===0x1f4){logger['error'](_0x668c('0x11'),_0x3c4f87,_0x5ba1b8[_0x668c('0xf')][_0x668c('0x12')]);return _0x29758b(_0x5ba1b8['error'][_0x668c('0x12')]);}logger[_0x668c('0xf')](_0x668c('0x11'),_0x3c4f87,_0x5ba1b8['error']['message']);return _0x483ef6(_0x5ba1b8[_0x668c('0xf')][_0x668c('0x12')]);}else{logger[_0x668c('0xa')](_0x668c('0x11'),_0x3c4f87,_0x668c('0xb'));_0x483ef6(_0x5ba1b8['result'][_0x668c('0x12')]);}})[_0x668c('0x13')](function(_0x1cdb1d){logger[_0x668c('0xf')](_0x668c('0x11'),_0x3c4f87,_0x1cdb1d);_0x29758b(_0x1cdb1d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 3bdf499..6e9b502 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 _0x056e=['show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x4624d7,_0x2482e9){var _0x41c718=function(_0x5e099e){while(--_0x5e099e){_0x4624d7['push'](_0x4624d7['shift']());}};_0x41c718(++_0x2482e9);}(_0x056e,0x15a));var _0xe056=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0x056e[_0x39cf70];return _0x580424;};'use strict';var multer=require(_0xe056('0x0'));var util=require(_0xe056('0x1'));var path=require(_0xe056('0x2'));var timeout=require(_0xe056('0x3'));var express=require(_0xe056('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe056('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe056('0x6'));var controller=require(_0xe056('0x7'));router[_0xe056('0x8')]('/',auth['isAuthenticated'](),controller[_0xe056('0x9')]);router[_0xe056('0x8')](_0xe056('0xa'),auth[_0xe056('0xb')](),controller[_0xe056('0xc')]);router[_0xe056('0x8')](_0xe056('0xd'),auth[_0xe056('0xb')](),controller[_0xe056('0xe')]);router['post']('/',auth[_0xe056('0xb')](),controller[_0xe056('0xf')]);router[_0xe056('0x10')]('/:id',auth[_0xe056('0xb')](),controller[_0xe056('0x11')]);router[_0xe056('0x12')](_0xe056('0xd'),auth['isAuthenticated'](),controller[_0xe056('0x13')]);module['exports']=router; \ No newline at end of file +var _0x915c=['update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x1d4297,_0x3cf1f9){var _0x3ba0c9=function(_0x23685d){while(--_0x23685d){_0x1d4297['push'](_0x1d4297['shift']());}};_0x3ba0c9(++_0x3cf1f9);}(_0x915c,0xea));var _0xc915=function(_0x1a98af,_0x377906){_0x1a98af=_0x1a98af-0x0;var _0x23023c=_0x915c[_0x1a98af];return _0x23023c;};'use strict';var multer=require(_0xc915('0x0'));var util=require('util');var path=require(_0xc915('0x1'));var timeout=require(_0xc915('0x2'));var express=require(_0xc915('0x3'));var router=express[_0xc915('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc915('0x5'));var interaction=require(_0xc915('0x6'));var config=require(_0xc915('0x7'));var controller=require(_0xc915('0x8'));router[_0xc915('0x9')]('/',auth[_0xc915('0xa')](),controller[_0xc915('0xb')]);router[_0xc915('0x9')]('/describe',auth[_0xc915('0xa')](),controller[_0xc915('0xc')]);router[_0xc915('0x9')](_0xc915('0xd'),auth[_0xc915('0xa')](),controller[_0xc915('0xe')]);router[_0xc915('0xf')]('/',auth[_0xc915('0xa')](),controller[_0xc915('0x10')]);router[_0xc915('0x11')](_0xc915('0xd'),auth[_0xc915('0xa')](),controller[_0xc915('0x12')]);router['delete'](_0xc915('0xd'),auth[_0xc915('0xa')](),controller[_0xc915('0x13')]);module[_0xc915('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 93fe955..cb1e12f 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 _0xfc31=['mouseOver','timeout','STRING','sequelize'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0xfc31,0x1e3));var _0x1fc3=function(_0x56b6b4,_0x4b81d0){_0x56b6b4=_0x56b6b4-0x0;var _0xe97eeb=_0xfc31[_0x56b6b4];return _0xe97eeb;};'use strict';var Sequelize=require(_0x1fc3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1fc3('0x1'),_0x1fc3('0x2')),'defaultValue':_0x1fc3('0x1')},'selector':{'type':Sequelize[_0x1fc3('0x3')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xdadb=['mouseOver','sequelize','exports','STRING','ENUM'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0xdadb,0x15a));var _0xbdad=function(_0x34584e,_0x6616f4){_0x34584e=_0x34584e-0x0;var _0x570a60=_0xdadb[_0x34584e];return _0x570a60;};'use strict';var Sequelize=require(_0xbdad('0x0'));module[_0xbdad('0x1')]={'name':{'type':Sequelize[_0xbdad('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbdad('0x3')](_0xbdad('0x4'),'timeout'),'defaultValue':_0xbdad('0x4')},'selector':{'type':Sequelize[_0xbdad('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index cf08a9c..76fdba7 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 _0x5243=['mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','name','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','catch','destroy','eml-format','fast-json-patch','request-promise'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x5243,0x71));var _0x3524=function(_0x36b0ca,_0x19b1ab){_0x36b0ca=_0x36b0ca-0x0;var _0x49b07c=_0x5243[_0x36b0ca];return _0x49b07c;};'use strict';var emlformat=require(_0x3524('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3524('0x1'));var rp=require(_0x3524('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3524('0x3'));var util=require(_0x3524('0x4'));var path=require('path');var sox=require(_0x3524('0x5'));var csv=require('to-csv');var ejs=require(_0x3524('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3524('0x7'));var squel=require(_0x3524('0x8'));var crypto=require(_0x3524('0x9'));var jsforce=require(_0x3524('0xa'));var deskjs=require(_0x3524('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3524('0xc'));var Redis=require(_0x3524('0xd'));var authService=require(_0x3524('0xe'));var qs=require(_0x3524('0xf'));var as=require(_0x3524('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3524('0x11'))(_0x3524('0x12'));var utils=require('../../config/utils');var config=require(_0x3524('0x13'));var licenseUtil=require(_0x3524('0x14'));var db=require(_0x3524('0x15'))['db'];function respondWithStatusCode(_0x5d5a60,_0x4f49da){_0x4f49da=_0x4f49da||0xcc;return function(_0x50c11f){if(_0x50c11f){return _0x5d5a60['sendStatus'](_0x4f49da);}return _0x5d5a60[_0x3524('0x16')](_0x4f49da)[_0x3524('0x17')]();};}function respondWithResult(_0x58cd29,_0x3aa2da){_0x3aa2da=_0x3aa2da||0xc8;return function(_0x253d92){if(_0x253d92){return _0x58cd29[_0x3524('0x16')](_0x3aa2da)[_0x3524('0x18')](_0x253d92);}};}function respondWithFilteredResult(_0xe5df67,_0x235cfd){return function(_0x34d9a0){if(_0x34d9a0){var _0x8440a4=typeof _0x235cfd[_0x3524('0x19')]==='undefined'&&typeof _0x235cfd[_0x3524('0x1a')]==='undefined';var _0x2eb681=_0x34d9a0[_0x3524('0x1b')];var _0x44ee2e=_0x8440a4?0x0:_0x235cfd[_0x3524('0x19')];var _0x1ca615=_0x8440a4?_0x34d9a0[_0x3524('0x1b')]:_0x235cfd['offset']+_0x235cfd['limit'];var _0x1acbd1;if(_0x1ca615>=_0x2eb681){_0x1ca615=_0x2eb681;_0x1acbd1=0xc8;}else{_0x1acbd1=0xce;}_0xe5df67['status'](_0x1acbd1);return _0xe5df67[_0x3524('0x1c')](_0x3524('0x1d'),_0x44ee2e+'-'+_0x1ca615+'/'+_0x2eb681)[_0x3524('0x18')](_0x34d9a0);}return null;};}function patchUpdates(_0xd285a3){return function(_0x1d25f8){try{jsonpatch[_0x3524('0x1e')](_0x1d25f8,_0xd285a3,!![]);}catch(_0x4f584a){return BPromise[_0x3524('0x1f')](_0x4f584a);}return _0x1d25f8[_0x3524('0x20')]();};}function saveUpdates(_0x1ab2c5,_0xf1b3b1){return function(_0x2d20c8){if(_0x2d20c8){return _0x2d20c8['update'](_0x1ab2c5)[_0x3524('0x21')](function(_0x52600c){return _0x52600c;});}return null;};}function removeEntity(_0x2eb72f,_0x26c20e){return function(_0x101e9a){if(_0x101e9a){return _0x101e9a['destroy']()[_0x3524('0x21')](function(){_0x2eb72f[_0x3524('0x16')](0xcc)[_0x3524('0x17')]();});}};}function handleEntityNotFound(_0x27bd6a,_0x4dfd49){return function(_0x4256ca){if(!_0x4256ca){_0x27bd6a[_0x3524('0x22')](0x194);}return _0x4256ca;};}function handleError(_0x1765a4,_0x5dc071){_0x5dc071=_0x5dc071||0x1f4;return function(_0x1d351e){logger[_0x3524('0x23')](_0x1d351e['stack']);if(_0x1d351e[_0x3524('0x24')]){delete _0x1d351e[_0x3524('0x24')];}_0x1765a4['status'](_0x5dc071)['send'](_0x1d351e);};}exports[_0x3524('0x25')]=function(_0x3fddc1,_0x225b26){var _0x651f11={'raw':!![],'where':{'id':_0x3fddc1[_0x3524('0x26')]['id']}},_0x5bf38e={};_0x5bf38e['model']=_[_0x3524('0x27')](db[_0x3524('0x28')][_0x3524('0x29')]);_0x5bf38e['query']=_['keys'](_0x3fddc1[_0x3524('0x2a')]);_0x5bf38e[_0x3524('0x2b')]=_['intersection'](_0x5bf38e[_0x3524('0x2c')],_0x5bf38e[_0x3524('0x2a')]);_0x651f11[_0x3524('0x2d')]=_[_0x3524('0x2e')](_0x5bf38e[_0x3524('0x2c')],qs['fields'](_0x3fddc1[_0x3524('0x2a')][_0x3524('0x2f')]));_0x651f11[_0x3524('0x2d')]=_0x651f11['attributes'][_0x3524('0x30')]?_0x651f11[_0x3524('0x2d')]:_0x5bf38e[_0x3524('0x2c')];if(_0x3fddc1[_0x3524('0x2a')][_0x3524('0x31')]){_0x651f11[_0x3524('0x32')]=[{'all':!![]}];}_0x651f11=_[_0x3524('0x33')]({},_0x651f11,_0x3fddc1[_0x3524('0x34')]);return db[_0x3524('0x28')][_0x3524('0x35')](_0x651f11)[_0x3524('0x21')](handleEntityNotFound(_0x225b26,null))['then'](respondWithResult(_0x225b26,null))['catch'](handleError(_0x225b26,null));};exports['create']=function(_0x197f78,_0x48b54b){return db[_0x3524('0x28')][_0x3524('0x36')](_0x197f78[_0x3524('0x37')],{})['then'](respondWithResult(_0x48b54b,0xc9))[_0x3524('0x38')](handleError(_0x48b54b,null));};exports['update']=function(_0x18ee71,_0xcc63d5){if(_0x18ee71[_0x3524('0x37')]['id']){delete _0x18ee71[_0x3524('0x37')]['id'];}return db[_0x3524('0x28')]['find']({'where':{'id':_0x18ee71[_0x3524('0x26')]['id']}})[_0x3524('0x21')](handleEntityNotFound(_0xcc63d5,null))[_0x3524('0x21')](saveUpdates(_0x18ee71[_0x3524('0x37')],null))['then'](respondWithResult(_0xcc63d5,null))[_0x3524('0x38')](handleError(_0xcc63d5,null));};exports[_0x3524('0x39')]=function(_0x449c51,_0x97b711){return db[_0x3524('0x28')]['find']({'where':{'id':_0x449c51['params']['id']}})[_0x3524('0x21')](handleEntityNotFound(_0x97b711,null))[_0x3524('0x21')](removeEntity(_0x97b711,null))[_0x3524('0x38')](handleError(_0x97b711,null));}; \ No newline at end of file +var _0x74f3=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','options','create','body','catch','find','eml-format','rimraf','zip-dir','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74f3,0x164));var _0x374f=function(_0x4f61a1,_0x35820b){_0x4f61a1=_0x4f61a1-0x0;var _0xae8b64=_0x74f3[_0x4f61a1];return _0xae8b64;};'use strict';var emlformat=require(_0x374f('0x0'));var rimraf=require(_0x374f('0x1'));var zipdir=require(_0x374f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x374f('0x3'));var moment=require(_0x374f('0x4'));var BPromise=require(_0x374f('0x5'));var Mustache=require(_0x374f('0x6'));var util=require('util');var path=require(_0x374f('0x7'));var sox=require(_0x374f('0x8'));var csv=require('to-csv');var ejs=require(_0x374f('0x9'));var fs=require('fs');var fs_extra=require(_0x374f('0xa'));var _=require(_0x374f('0xb'));var squel=require(_0x374f('0xc'));var crypto=require(_0x374f('0xd'));var jsforce=require(_0x374f('0xe'));var deskjs=require(_0x374f('0xf'));var toCsv=require(_0x374f('0x10'));var querystring=require('querystring');var Papa=require(_0x374f('0x11'));var Redis=require(_0x374f('0x12'));var authService=require(_0x374f('0x13'));var qs=require(_0x374f('0x14'));var as=require(_0x374f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x374f('0x16'))(_0x374f('0x17'));var utils=require('../../config/utils');var config=require(_0x374f('0x18'));var licenseUtil=require(_0x374f('0x19'));var db=require(_0x374f('0x1a'))['db'];function respondWithStatusCode(_0x5ac724,_0x46c396){_0x46c396=_0x46c396||0xcc;return function(_0x3abcdb){if(_0x3abcdb){return _0x5ac724['sendStatus'](_0x46c396);}return _0x5ac724[_0x374f('0x1b')](_0x46c396)[_0x374f('0x1c')]();};}function respondWithResult(_0x5eca08,_0xcfcc04){_0xcfcc04=_0xcfcc04||0xc8;return function(_0x504dc8){if(_0x504dc8){return _0x5eca08[_0x374f('0x1b')](_0xcfcc04)[_0x374f('0x1d')](_0x504dc8);}};}function respondWithFilteredResult(_0x1060c4,_0x3ae58d){return function(_0x1215d5){if(_0x1215d5){var _0x21db8c=typeof _0x3ae58d[_0x374f('0x1e')]===_0x374f('0x1f')&&typeof _0x3ae58d[_0x374f('0x20')]===_0x374f('0x1f');var _0x729572=_0x1215d5[_0x374f('0x21')];var _0x13c210=_0x21db8c?0x0:_0x3ae58d['offset'];var _0x55eb4f=_0x21db8c?_0x1215d5[_0x374f('0x21')]:_0x3ae58d['offset']+_0x3ae58d[_0x374f('0x20')];var _0x39532b;if(_0x55eb4f>=_0x729572){_0x55eb4f=_0x729572;_0x39532b=0xc8;}else{_0x39532b=0xce;}_0x1060c4[_0x374f('0x1b')](_0x39532b);return _0x1060c4['set'](_0x374f('0x22'),_0x13c210+'-'+_0x55eb4f+'/'+_0x729572)['json'](_0x1215d5);}return null;};}function patchUpdates(_0xbcc48f){return function(_0x3bcd1e){try{jsonpatch[_0x374f('0x23')](_0x3bcd1e,_0xbcc48f,!![]);}catch(_0x4df021){return BPromise[_0x374f('0x24')](_0x4df021);}return _0x3bcd1e['save']();};}function saveUpdates(_0x42dff9,_0x27b9ae){return function(_0x2de93d){if(_0x2de93d){return _0x2de93d[_0x374f('0x25')](_0x42dff9)[_0x374f('0x26')](function(_0x188db8){return _0x188db8;});}return null;};}function removeEntity(_0x56f727,_0x4d7ccf){return function(_0x1146a3){if(_0x1146a3){return _0x1146a3[_0x374f('0x27')]()[_0x374f('0x26')](function(){_0x56f727['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d13e4,_0x5a6ddd){return function(_0x5418cd){if(!_0x5418cd){_0x2d13e4['sendStatus'](0x194);}return _0x5418cd;};}function handleError(_0x5ada90,_0x29d2b2){_0x29d2b2=_0x29d2b2||0x1f4;return function(_0x253239){logger['error'](_0x253239[_0x374f('0x28')]);if(_0x253239[_0x374f('0x29')]){delete _0x253239[_0x374f('0x29')];}_0x5ada90[_0x374f('0x1b')](_0x29d2b2)['send'](_0x253239);};}exports[_0x374f('0x2a')]=function(_0x4900b9,_0x2b6664){var _0x3d42f0={'raw':!![],'where':{'id':_0x4900b9[_0x374f('0x2b')]['id']}},_0x2a21d6={};_0x2a21d6[_0x374f('0x2c')]=_[_0x374f('0x2d')](db[_0x374f('0x2e')][_0x374f('0x2f')]);_0x2a21d6[_0x374f('0x30')]=_[_0x374f('0x2d')](_0x4900b9['query']);_0x2a21d6[_0x374f('0x31')]=_[_0x374f('0x32')](_0x2a21d6['model'],_0x2a21d6[_0x374f('0x30')]);_0x3d42f0['attributes']=_[_0x374f('0x32')](_0x2a21d6[_0x374f('0x2c')],qs['fields'](_0x4900b9[_0x374f('0x30')]['fields']));_0x3d42f0[_0x374f('0x33')]=_0x3d42f0[_0x374f('0x33')][_0x374f('0x34')]?_0x3d42f0['attributes']:_0x2a21d6[_0x374f('0x2c')];if(_0x4900b9[_0x374f('0x30')][_0x374f('0x35')]){_0x3d42f0[_0x374f('0x36')]=[{'all':!![]}];}_0x3d42f0=_['merge']({},_0x3d42f0,_0x4900b9[_0x374f('0x37')]);return db[_0x374f('0x2e')]['find'](_0x3d42f0)[_0x374f('0x26')](handleEntityNotFound(_0x2b6664,null))['then'](respondWithResult(_0x2b6664,null))['catch'](handleError(_0x2b6664,null));};exports['create']=function(_0x1b84ac,_0x34bdec){return db[_0x374f('0x2e')][_0x374f('0x38')](_0x1b84ac[_0x374f('0x39')],{})[_0x374f('0x26')](respondWithResult(_0x34bdec,0xc9))['catch'](handleError(_0x34bdec,null));};exports[_0x374f('0x25')]=function(_0x50c898,_0x59ff69){if(_0x50c898[_0x374f('0x39')]['id']){delete _0x50c898['body']['id'];}return db[_0x374f('0x2e')]['find']({'where':{'id':_0x50c898['params']['id']}})[_0x374f('0x26')](handleEntityNotFound(_0x59ff69,null))[_0x374f('0x26')](saveUpdates(_0x50c898[_0x374f('0x39')],null))[_0x374f('0x26')](respondWithResult(_0x59ff69,null))[_0x374f('0x3a')](handleError(_0x59ff69,null));};exports[_0x374f('0x27')]=function(_0x134fb1,_0x4138b9){return db['ChatProactiveAction'][_0x374f('0x3b')]({'where':{'id':_0x134fb1['params']['id']}})[_0x374f('0x26')](handleEntityNotFound(_0x4138b9,null))[_0x374f('0x26')](removeEntity(_0x4138b9,null))['catch'](handleError(_0x4138b9,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index aa377f8..5e64145 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 _0x5c1d=['util','api','moment','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x5773ed,_0x2270ce){var _0x4a75d9=function(_0x31a9a3){while(--_0x31a9a3){_0x5773ed['push'](_0x5773ed['shift']());}};_0x4a75d9(++_0x2270ce);}(_0x5c1d,0x103));var _0xd5c1=function(_0x910cb0,_0x32746d){_0x910cb0=_0x910cb0-0x0;var _0x474d65=_0x5c1d[_0x910cb0];return _0x474d65;};'use strict';var _=require(_0xd5c1('0x0'));var util=require(_0xd5c1('0x1'));var logger=require('../../config/logger')(_0xd5c1('0x2'));var moment=require(_0xd5c1('0x3'));var BPromise=require(_0xd5c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd5c1('0x5'));var rimraf=require(_0xd5c1('0x6'));var config=require(_0xd5c1('0x7'));var attributes=require(_0xd5c1('0x8'));module[_0xd5c1('0x9')]=function(_0x4d7b76,_0x18ead7){return _0x4d7b76[_0xd5c1('0xa')](_0xd5c1('0xb'),attributes,{'tableName':_0xd5c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbaf=['rimraf','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','bluebird'];(function(_0x284000,_0x3d5360){var _0x45d224=function(_0x4c4385){while(--_0x4c4385){_0x284000['push'](_0x284000['shift']());}};_0x45d224(++_0x3d5360);}(_0xdbaf,0x125));var _0xfdba=function(_0x13eda3,_0x3c908b){_0x13eda3=_0x13eda3-0x0;var _0x419f73=_0xdbaf[_0x13eda3];return _0x419f73;};'use strict';var _=require(_0xfdba('0x0'));var util=require('util');var logger=require(_0xfdba('0x1'))(_0xfdba('0x2'));var moment=require('moment');var BPromise=require(_0xfdba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfdba('0x4'));var config=require('../../config/environment');var attributes=require(_0xfdba('0x5'));module[_0xfdba('0x6')]=function(_0x264ff1,_0x5dead8){return _0x264ff1['define'](_0xfdba('0x7'),attributes,{'tableName':_0xfdba('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 de572b0..790a492 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 _0xd0ba=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd0ba,0x17c));var _0xad0b=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xd0ba[_0x2b5513];return _0x578fd2;};'use strict';var _=require('lodash');var util=require(_0xad0b('0x0'));var moment=require(_0xad0b('0x1'));var BPromise=require(_0xad0b('0x2'));var rs=require(_0xad0b('0x3'));var fs=require('fs');var Redis=require(_0xad0b('0x4'));var db=require(_0xad0b('0x5'))['db'];var utils=require(_0xad0b('0x6'));var logger=require(_0xad0b('0x7'))(_0xad0b('0x8'));var config=require('../../config/environment');var jayson=require(_0xad0b('0x9'));var client=jayson[_0xad0b('0xa')][_0xad0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x482525,_0x407d30,_0x10cf14){return new BPromise(function(_0x529785,_0x4981c3){return client['request'](_0x482525,_0x10cf14)['then'](function(_0x278f33){logger['info'](_0xad0b('0xc'),_0x407d30,_0xad0b('0xd'));logger['debug'](_0xad0b('0xe'),_0x407d30,_0xad0b('0xd'),JSON[_0xad0b('0xf')](_0x278f33));if(_0x278f33[_0xad0b('0x10')]){if(_0x278f33['error']['code']===0x1f4){logger[_0xad0b('0x10')](_0xad0b('0xc'),_0x407d30,_0x278f33[_0xad0b('0x10')][_0xad0b('0x11')]);return _0x4981c3(_0x278f33[_0xad0b('0x10')][_0xad0b('0x11')]);}logger[_0xad0b('0x10')](_0xad0b('0xc'),_0x407d30,_0x278f33[_0xad0b('0x10')][_0xad0b('0x11')]);return _0x529785(_0x278f33['error'][_0xad0b('0x11')]);}else{logger[_0xad0b('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x407d30,_0xad0b('0xd'));_0x529785(_0x278f33['result'][_0xad0b('0x11')]);}})[_0xad0b('0x13')](function(_0x4394be){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x407d30,_0x4394be);_0x4981c3(_0x4394be);});});} \ No newline at end of file +var _0x469c=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3f0bfc,_0x104792){var _0x52b0c3=function(_0x573330){while(--_0x573330){_0x3f0bfc['push'](_0x3f0bfc['shift']());}};_0x52b0c3(++_0x104792);}(_0x469c,0xff));var _0xc469=function(_0x19a90e,_0xe14b0b){_0x19a90e=_0x19a90e-0x0;var _0xa49b11=_0x469c[_0x19a90e];return _0xa49b11;};'use strict';var _=require(_0xc469('0x0'));var util=require(_0xc469('0x1'));var moment=require(_0xc469('0x2'));var BPromise=require(_0xc469('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc469('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc469('0x5'));var logger=require(_0xc469('0x6'))(_0xc469('0x7'));var config=require('../../config/environment');var jayson=require(_0xc469('0x8'));var client=jayson[_0xc469('0x9')][_0xc469('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x476bec,_0x3b7480,_0x22e0c6){return new BPromise(function(_0x427227,_0x44daac){return client['request'](_0x476bec,_0x22e0c6)[_0xc469('0xb')](function(_0x3b27e8){logger[_0xc469('0xc')](_0xc469('0xd'),_0x3b7480,_0xc469('0xe'));logger[_0xc469('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3b7480,_0xc469('0xe'),JSON[_0xc469('0x10')](_0x3b27e8));if(_0x3b27e8['error']){if(_0x3b27e8['error']['code']===0x1f4){logger[_0xc469('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x3b7480,_0x3b27e8['error'][_0xc469('0x12')]);return _0x44daac(_0x3b27e8[_0xc469('0x11')]['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3b7480,_0x3b27e8[_0xc469('0x11')][_0xc469('0x12')]);return _0x427227(_0x3b27e8[_0xc469('0x11')][_0xc469('0x12')]);}else{logger['info'](_0xc469('0xd'),_0x3b7480,_0xc469('0xe'));_0x427227(_0x3b27e8[_0xc469('0x13')]['message']);}})[_0xc469('0x14')](function(_0x12aaf3){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3b7480,_0x12aaf3);_0x44daac(_0x12aaf3);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c65672c..ee6740c 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 _0x6f47=['show','post','create','put','/:id','update','destroy','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated'];(function(_0x2f56b5,_0x582964){var _0x13f229=function(_0x2e81fb){while(--_0x2e81fb){_0x2f56b5['push'](_0x2f56b5['shift']());}};_0x13f229(++_0x582964);}(_0x6f47,0xc7));var _0x76f4=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x6f47[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var fs_extra=require(_0x76f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var controller=require(_0x76f4('0x6'));router[_0x76f4('0x7')]('/:id',auth[_0x76f4('0x8')](),controller[_0x76f4('0x9')]);router[_0x76f4('0xa')]('/',auth['isAuthenticated'](),controller[_0x76f4('0xb')]);router[_0x76f4('0xc')](_0x76f4('0xd'),auth[_0x76f4('0x8')](),controller[_0x76f4('0xe')]);router['delete']('/:id',auth[_0x76f4('0x8')](),controller[_0x76f4('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3eea=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','post','create','update','isAuthenticated','destroy','multer'];(function(_0x12546e,_0x49a072){var _0x5173d9=function(_0x4b860a){while(--_0x4b860a){_0x12546e['push'](_0x12546e['shift']());}};_0x5173d9(++_0x49a072);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x39ab21,_0x265ac4){_0x39ab21=_0x39ab21-0x0;var _0x403d45=_0x3eea[_0x39ab21];return _0x403d45;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')](_0xa3ee('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa3ee('0xc')]('/',auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['put'](_0xa3ee('0xb'),auth['isAuthenticated'](),controller[_0xa3ee('0xe')]);router['delete'](_0xa3ee('0xb'),auth[_0xa3ee('0xf')](),controller[_0xa3ee('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 9dfe46b..6742a2f 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 _0x23ac=['beepall','roundrobin','STRING','name','ENUM'];(function(_0x5e0d54,_0x493251){var _0x280def=function(_0x18bf09){while(--_0x18bf09){_0x5e0d54['push'](_0x5e0d54['shift']());}};_0x280def(++_0x493251);}(_0x23ac,0x11f));var _0xc23a=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x23ac[_0x261e29];return _0x25ef43;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc23a('0x0')],'unique':_0xc23a('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc23a('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc23a('0x2')]('rrmemory',_0xc23a('0x3'),_0xc23a('0x4'))}}; \ No newline at end of file +var _0x0982=['beepall','roundrobin','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x585e84,_0x1d8489){var _0x39f3c4=function(_0x1855a3){while(--_0x1855a3){_0x585e84['push'](_0x585e84['shift']());}};_0x39f3c4(++_0x1d8489);}(_0x0982,0x14b));var _0x2098=function(_0x3c1e73,_0x4b5325){_0x3c1e73=_0x3c1e73-0x0;var _0x4229a3=_0x0982[_0x3c1e73];return _0x4229a3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2098('0x0')],'unique':_0x2098('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2098('0x0')]},'timeout':{'type':Sequelize[_0x2098('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2098('0x3')](_0x2098('0x4'),_0x2098('0x5'),_0x2098('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 2ada005..02caf9e 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 _0xf2d9=['select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','order','bluebird','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','get','ChatQueues','error','stack','name','index','map','ChatQueue','rawAttributes','type','key','getOptions','where','include','show','params','model','keys','query','filters','intersection','fields','attributes','length','merge','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','destroy','getMembers','UserChatQueue','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','options','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams'];(function(_0x13c1ac,_0x19325c){var _0x85cd90=function(_0x35861c){while(--_0x35861c){_0x13c1ac['push'](_0x13c1ac['shift']());}};_0x85cd90(++_0x19325c);}(_0xf2d9,0x17c));var _0x9f2d=function(_0x23d97c,_0x20d452){_0x23d97c=_0x23d97c-0x0;var _0x510fdd=_0xf2d9[_0x23d97c];return _0x510fdd;};'use strict';var BPromise=require(_0x9f2d('0x0'));var util=require(_0x9f2d('0x1'));var _=require('lodash');var squel=require(_0x9f2d('0x2'));var Redis=require(_0x9f2d('0x3'));var qs=require(_0x9f2d('0x4'));var logger=require('../../config/logger')(_0x9f2d('0x5'));var config=require(_0x9f2d('0x6'));var db=require(_0x9f2d('0x7'))['db'];config[_0x9f2d('0x8')]=_[_0x9f2d('0x9')](config[_0x9f2d('0x8')],{'host':_0x9f2d('0xa'),'port':0x18eb});var socket=require(_0x9f2d('0xb'))(new Redis(config[_0x9f2d('0x8')]));require(_0x9f2d('0xc'))[_0x9f2d('0xd')](socket);function respondWithStatusCode(_0x52ab0f,_0x216ae1){_0x216ae1=_0x216ae1||0xcc;return function(_0x26f244){if(_0x26f244){return _0x52ab0f[_0x9f2d('0xe')](_0x216ae1);}return _0x52ab0f[_0x9f2d('0xf')](_0x216ae1)[_0x9f2d('0x10')]();};}function respondWithResult(_0x312f6b,_0x451cfb){_0x451cfb=_0x451cfb||0xc8;return function(_0x32f752){if(_0x32f752){return _0x312f6b[_0x9f2d('0xf')](_0x451cfb)[_0x9f2d('0x11')](_0x32f752);}};}function respondWithFilteredResult(_0x5c2e8f,_0x3d3124){return function(_0x1a06e3){if(_0x1a06e3){var _0x15aa07=typeof _0x3d3124[_0x9f2d('0x12')]===_0x9f2d('0x13')&&typeof _0x3d3124['limit']===_0x9f2d('0x13');var _0x293bcc=_0x1a06e3[_0x9f2d('0x14')];var _0x4e1cb6=_0x15aa07?0x0:_0x3d3124['offset'];var _0x49bc3f=_0x15aa07?_0x1a06e3[_0x9f2d('0x14')]:_0x3d3124['offset']+_0x3d3124[_0x9f2d('0x15')];var _0x2dba24;if(_0x49bc3f>=_0x293bcc){_0x49bc3f=_0x293bcc;_0x2dba24=0xc8;}else{_0x2dba24=0xce;}_0x5c2e8f['status'](_0x2dba24);return _0x5c2e8f[_0x9f2d('0x16')]('Content-Range',_0x4e1cb6+'-'+_0x49bc3f+'/'+_0x293bcc)[_0x9f2d('0x11')](_0x1a06e3);}return null;};}function saveUpdates(_0x3375b2){return function(_0x5bd820){if(_0x5bd820){return _0x5bd820[_0x9f2d('0x17')](_0x3375b2)[_0x9f2d('0x18')](function(_0x56fc62){return _0x56fc62;});}return null;};}function removeEntity(_0x443419){return function(_0x4639b7){if(_0x4639b7){return _0x4639b7['destroy']()[_0x9f2d('0x18')](function(){var _0x4b09d3=_0x4639b7[_0x9f2d('0x19')]({'plain':!![]});var _0x48b647=_0x9f2d('0x1a');return db['UserProfileResource']['destroy']({'where':{'type':_0x48b647,'resourceId':_0x4b09d3['id']}})[_0x9f2d('0x18')](function(){return _0x4639b7;});})[_0x9f2d('0x18')](function(){_0x443419[_0x9f2d('0xf')](0xcc)[_0x9f2d('0x10')]();});}};}function handleEntityNotFound(_0x2c7008){return function(_0x22f715){if(!_0x22f715){_0x2c7008['sendStatus'](0x194);}return _0x22f715;};}function handleError(_0x419128,_0x205973){_0x205973=_0x205973||0x1f4;return function(_0x409fef){logger[_0x9f2d('0x1b')](_0x409fef[_0x9f2d('0x1c')]);if(_0x409fef['name']){delete _0x409fef[_0x9f2d('0x1d')];}_0x419128[_0x9f2d('0xf')](_0x205973)['send'](_0x409fef);};}exports[_0x9f2d('0x1e')]=function(_0x4be0d1,_0x109e85){var _0x1ccfb5={};var _0x510820={'count':0x0,'rows':[]};var _0x43a68f=_[_0x9f2d('0x1f')](db[_0x9f2d('0x20')][_0x9f2d('0x21')],function(_0x2d2736){return{'name':_0x2d2736['fieldName'],'type':_0x2d2736[_0x9f2d('0x22')][_0x9f2d('0x23')]};});_0x1ccfb5=qs[_0x9f2d('0x24')](_0x43a68f,_0x4be0d1);var _0x1d69bf={'where':_0x1ccfb5[_0x9f2d('0x25')]};return db[_0x9f2d('0x20')][_0x9f2d('0x14')](_0x1d69bf)[_0x9f2d('0x18')](function(_0x2d976c){_0x510820['count']=_0x2d976c;_0x1ccfb5[_0x9f2d('0x26')]=qs[_0x9f2d('0x26')](_0x4be0d1['query']);return db[_0x9f2d('0x20')]['findAll'](_0x1ccfb5);})[_0x9f2d('0x18')](function(_0x434193){_0x510820['rows']=_0x434193;return _0x510820;})[_0x9f2d('0x18')](respondWithFilteredResult(_0x109e85,_0x1ccfb5))['catch'](handleError(_0x109e85,null));};exports[_0x9f2d('0x27')]=function(_0x50da43,_0x3a3005){var _0x2323d4={'raw':!![],'where':{'id':_0x50da43[_0x9f2d('0x28')]['id']}},_0x38f17b={};_0x38f17b[_0x9f2d('0x29')]=_[_0x9f2d('0x2a')](db['ChatQueue']['rawAttributes']);_0x38f17b['query']=_[_0x9f2d('0x2a')](_0x50da43[_0x9f2d('0x2b')]);_0x38f17b[_0x9f2d('0x2c')]=_[_0x9f2d('0x2d')](_0x38f17b[_0x9f2d('0x29')],_0x38f17b[_0x9f2d('0x2b')]);_0x2323d4['attributes']=_[_0x9f2d('0x2d')](_0x38f17b[_0x9f2d('0x29')],qs['fields'](_0x50da43['query'][_0x9f2d('0x2e')]));_0x2323d4[_0x9f2d('0x2f')]=_0x2323d4[_0x9f2d('0x2f')][_0x9f2d('0x30')]?_0x2323d4[_0x9f2d('0x2f')]:_0x38f17b[_0x9f2d('0x29')];if(_0x50da43[_0x9f2d('0x2b')]['includeAll']){_0x2323d4[_0x9f2d('0x26')]=[{'all':!![]}];}_0x2323d4=_[_0x9f2d('0x31')]({},_0x2323d4,_0x50da43['options']);return db['ChatQueue'][_0x9f2d('0x32')](_0x2323d4)['then'](handleEntityNotFound(_0x3a3005,null))[_0x9f2d('0x18')](respondWithResult(_0x3a3005,null))[_0x9f2d('0x33')](handleError(_0x3a3005,null));};exports[_0x9f2d('0x34')]=function(_0x4683fd,_0x3db017){return db[_0x9f2d('0x20')][_0x9f2d('0x34')](_0x4683fd[_0x9f2d('0x35')],{})[_0x9f2d('0x18')](function(_0x2e65a8){var _0x28c1aa=_0x4683fd[_0x9f2d('0x36')]['get']({'plain':!![]});if(!_0x28c1aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28c1aa[_0x9f2d('0x37')]===_0x9f2d('0x36')){var _0x15888d=_0x2e65a8[_0x9f2d('0x19')]({'plain':!![]});var _0x1d20c7=_0x9f2d('0x1a');return db[_0x9f2d('0x38')]['find']({'where':{'name':_0x1d20c7,'userProfileId':_0x28c1aa[_0x9f2d('0x39')]},'raw':!![]})[_0x9f2d('0x18')](function(_0x5020b6){if(_0x5020b6&&_0x5020b6[_0x9f2d('0x3a')]===0x0){return db[_0x9f2d('0x3b')][_0x9f2d('0x34')]({'name':_0x15888d['name'],'resourceId':_0x15888d['id'],'type':_0x5020b6[_0x9f2d('0x1d')],'sectionId':_0x5020b6['id']},{})[_0x9f2d('0x18')](function(){return _0x2e65a8;});}else{return _0x2e65a8;}})['catch'](function(_0x2b8e20){logger[_0x9f2d('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b8e20);throw _0x2b8e20;});}return _0x2e65a8;})[_0x9f2d('0x18')](respondWithResult(_0x3db017,0xc9))[_0x9f2d('0x33')](handleError(_0x3db017,null));};exports['update']=function(_0x17f8f4,_0x23bea5){if(_0x17f8f4[_0x9f2d('0x35')]['id']){delete _0x17f8f4[_0x9f2d('0x35')]['id'];}return db[_0x9f2d('0x20')][_0x9f2d('0x32')]({'where':{'id':_0x17f8f4[_0x9f2d('0x28')]['id']}})[_0x9f2d('0x18')](handleEntityNotFound(_0x23bea5,null))[_0x9f2d('0x18')](saveUpdates(_0x17f8f4['body'],null))[_0x9f2d('0x18')](respondWithResult(_0x23bea5,null))['catch'](handleError(_0x23bea5,null));};exports[_0x9f2d('0x3c')]=function(_0x511ac0,_0x569331){return db[_0x9f2d('0x20')]['find']({'where':{'id':_0x511ac0['params']['id']}})[_0x9f2d('0x18')](handleEntityNotFound(_0x569331,null))[_0x9f2d('0x18')](removeEntity(_0x569331,null))[_0x9f2d('0x33')](handleError(_0x569331,null));};exports['describe']=function(_0xe90b0a,_0x1e3e24){return db[_0x9f2d('0x20')]['describe']()['then'](respondWithResult(_0x1e3e24,null))[_0x9f2d('0x33')](handleError(_0x1e3e24,null));};exports[_0x9f2d('0x3d')]=function(_0xb533bd,_0x5a3c52){var _0x3a2fa9={'raw':!![],'where':{}},_0x4adbff={},_0x3eb373;return db[_0x9f2d('0x20')]['findOne']({'where':{'id':_0xb533bd[_0x9f2d('0x28')]['id']}})[_0x9f2d('0x18')](handleEntityNotFound(_0x5a3c52,null))[_0x9f2d('0x18')](function(_0x274b95){if(_0x274b95){_0x3eb373=_0x274b95[_0x9f2d('0x19')]({'plain':!![]});_0x4adbff[_0x9f2d('0x29')]=_[_0x9f2d('0x2a')](db[_0x9f2d('0x3e')][_0x9f2d('0x21')]);_0x4adbff[_0x9f2d('0x2b')]=_[_0x9f2d('0x2a')](_0xb533bd['query']);_0x4adbff[_0x9f2d('0x2c')]=_[_0x9f2d('0x2d')](_0x4adbff[_0x9f2d('0x29')],_0x4adbff[_0x9f2d('0x2b')]);_0x3a2fa9[_0x9f2d('0x2f')]=_[_0x9f2d('0x2d')](_0x4adbff[_0x9f2d('0x29')],qs[_0x9f2d('0x2e')](_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x2e')]));_0x3a2fa9[_0x9f2d('0x2f')]=_0x3a2fa9[_0x9f2d('0x2f')][_0x9f2d('0x30')]?_0x3a2fa9[_0x9f2d('0x2f')]:_0x4adbff[_0x9f2d('0x29')];if(!_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x3f')](_0x9f2d('0x40'))){_0x3a2fa9[_0x9f2d('0x15')]=qs[_0x9f2d('0x15')](_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x15')]);_0x3a2fa9[_0x9f2d('0x12')]=qs['offset'](_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x12')]);}_0x3a2fa9['order']=qs[_0x9f2d('0x41')](_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x41')]);_0x3a2fa9[_0x9f2d('0x25')]=qs[_0x9f2d('0x2c')](_[_0x9f2d('0x42')](_0xb533bd['query'],_0x4adbff['filters']));_0x3a2fa9[_0x9f2d('0x25')][_0x9f2d('0x43')]=_0x274b95['id'];if(_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x44')]){_0x3a2fa9[_0x9f2d('0x25')]=_[_0x9f2d('0x31')](_0x3a2fa9['where'],{'$or':_[_0x9f2d('0x1f')](_0x3a2fa9[_0x9f2d('0x2f')],function(_0x44bf3e){var _0x4687e9={};_0x4687e9[_0x44bf3e]={'$like':'%'+_0xb533bd['query'][_0x9f2d('0x44')]+'%'};return _0x4687e9;})});}_0x3a2fa9=_['merge']({},_0x3a2fa9,_0xb533bd[_0x9f2d('0x45')]);return db[_0x9f2d('0x3e')][_0x9f2d('0x46')](_0x3a2fa9);}})[_0x9f2d('0x18')](function(_0x2afa03){if(_0x2afa03){return db[_0x9f2d('0x47')][_0x9f2d('0x48')]({'where':{'id':_[_0x9f2d('0x1f')](_0x2afa03,_0x9f2d('0x49')),'role':_0x9f2d('0x4a')},'attributes':['id','name',_0x9f2d('0x4b'),_0x9f2d('0x4c'),_0x9f2d('0x4d')]});}})[_0x9f2d('0x18')](function(_0x85814d){if(_0x85814d){return{'count':_0x85814d[_0x9f2d('0x14')],'rows':_[_0x9f2d('0x1f')](_0x85814d['rows'],function(_0x4c4dc7){return{'membername':_0x4c4dc7[_0x9f2d('0x1d')],'UserId':_0x4c4dc7['id'],'queue_name':_0x3eb373['name'],'ChatQueueId':_0x3eb373['id'],'interface':util[_0x9f2d('0x4e')](_0x9f2d('0x4f'),_0x9f2d('0x50'),_0x4c4dc7[_0x9f2d('0x1d')]),'penalty':0x0,'paused':_0x4c4dc7[_0x9f2d('0x4b')],'createdAt':_0x4c4dc7[_0x9f2d('0x4d')],'updatedAt':_0x4c4dc7[_0x9f2d('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9f2d('0x18')](respondWithFilteredResult(_0x5a3c52,_0x3a2fa9))['catch'](handleError(_0x5a3c52,null));};exports['getTeams']=function(_0x4a615b,_0x36bd8a){var _0x38e3b6={};var _0x369f78={};var _0x5b9d88;var _0x57cd22;return db['ChatQueue'][_0x9f2d('0x51')]({'where':{'id':_0x4a615b[_0x9f2d('0x28')]['id']}})['then'](handleEntityNotFound(_0x36bd8a,null))[_0x9f2d('0x18')](function(_0x4ad11c){if(_0x4ad11c){_0x5b9d88=_0x4ad11c;_0x369f78[_0x9f2d('0x29')]=_[_0x9f2d('0x2a')](db[_0x9f2d('0x52')]['rawAttributes']);_0x369f78['query']=_[_0x9f2d('0x2a')](_0x4a615b[_0x9f2d('0x2b')]);_0x369f78[_0x9f2d('0x2c')]=_[_0x9f2d('0x2d')](_0x369f78[_0x9f2d('0x29')],_0x369f78['query']);_0x38e3b6[_0x9f2d('0x2f')]=_[_0x9f2d('0x2d')](_0x369f78[_0x9f2d('0x29')],qs[_0x9f2d('0x2e')](_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x2e')]));_0x38e3b6['attributes']=_0x38e3b6['attributes']['length']?_0x38e3b6[_0x9f2d('0x2f')]:_0x369f78['model'];_0x38e3b6['order']=qs[_0x9f2d('0x41')](_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x41')]);_0x38e3b6[_0x9f2d('0x25')]=qs[_0x9f2d('0x2c')](_[_0x9f2d('0x42')](_0x4a615b['query'],_0x369f78[_0x9f2d('0x2c')]));if(_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x44')]){_0x38e3b6[_0x9f2d('0x25')]=_[_0x9f2d('0x31')](_0x38e3b6[_0x9f2d('0x25')],{'$or':_['map'](_0x38e3b6[_0x9f2d('0x2f')],function(_0x26ceca){var _0x2e8e22={};_0x2e8e22[_0x26ceca]={'$like':'%'+_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x44')]+'%'};return _0x2e8e22;})});}_0x38e3b6=_[_0x9f2d('0x31')]({},_0x38e3b6,_0x4a615b[_0x9f2d('0x45')]);return _0x5b9d88['getTeams'](_0x38e3b6);}})[_0x9f2d('0x18')](function(_0x3cae0e){if(_0x3cae0e){_0x57cd22=_0x3cae0e[_0x9f2d('0x30')];if(!_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x3f')](_0x9f2d('0x40'))){_0x38e3b6['limit']=qs[_0x9f2d('0x15')](_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x15')]);_0x38e3b6[_0x9f2d('0x12')]=qs[_0x9f2d('0x12')](_0x4a615b['query'][_0x9f2d('0x12')]);}return _0x5b9d88['getTeams'](_0x38e3b6);}})[_0x9f2d('0x18')](function(_0x3b39fa){if(_0x3b39fa){return _0x3b39fa?{'count':_0x57cd22,'rows':_0x3b39fa}:null;}})[_0x9f2d('0x18')](respondWithResult(_0x36bd8a,null))['catch'](handleError(_0x36bd8a,null));};exports[_0x9f2d('0x53')]=function(_0x1a99e2,_0x3f8195){var _0x274672=_0x1a99e2[_0x9f2d('0x35')][_0x9f2d('0x54')];return db[_0x9f2d('0x52')]['findAll']({'where':{'id':_0x274672},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9f2d('0x55'),'attributes':['id',_0x9f2d('0x1d'),_0x9f2d('0x56'),_0x9f2d('0x57'),'interface'],'raw':!![]}]})[_0x9f2d('0x18')](function(_0x328c98){if(_0x328c98){var _0x135930=_[_0x9f2d('0x58')](_0x328c98,function(_0x51de04){var _0x1fd719=_0x51de04[_0x9f2d('0x19')]({'plain':!![]});return _0x1fd719[_0x9f2d('0x55')];});return db[_0x9f2d('0x20')]['find']({'where':{'id':_0x1a99e2[_0x9f2d('0x28')]['id']}})[_0x9f2d('0x18')](function(_0x43c8d2){return db[_0x9f2d('0x59')][_0x9f2d('0x5a')](function(_0x38c3c3){return _0x43c8d2[_0x9f2d('0x53')](_0x274672,{'transaction':_0x38c3c3})[_0x9f2d('0x18')](function(){return BPromise[_0x9f2d('0x5b')](_0x135930,function(_0x30d0b1){return db[_0x9f2d('0x3e')]['findOrCreate']({'where':{'UserId':_0x30d0b1['id'],'ChatQueueId':_0x1a99e2[_0x9f2d('0x28')]['id']},'transaction':_0x38c3c3});});})[_0x9f2d('0x18')](function(){_0x135930[_0x9f2d('0x5c')](function(_0x117a52){socket[_0x9f2d('0x5d')](_0x9f2d('0x5e'),{'UserId':_0x117a52['id'],'ChatQueueId':_0x43c8d2['id']});});});});});}})['then'](respondWithStatusCode(_0x3f8195,null))[_0x9f2d('0x33')](handleError(_0x3f8195,null));};exports[_0x9f2d('0x5f')]=function(_0x587ee9,_0x3e654e){return db[_0x9f2d('0x52')][_0x9f2d('0x46')]({'where':{'id':_0x587ee9[_0x9f2d('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9f2d('0x55'),'attributes':['id'],'raw':!![]}]})[_0x9f2d('0x18')](handleEntityNotFound(_0x3e654e,null))[_0x9f2d('0x18')](function(_0x1df143){var _0x1de1d5=_['map'](_0x1df143,'id');var _0x50449a=[];var _0x333870=[];var _0x325a38=squel[_0x9f2d('0x60')]();_0x325a38[_0x9f2d('0x61')](_0x9f2d('0x62'))['from'](_0x9f2d('0x63'),'tq')[_0x9f2d('0x64')](_0x9f2d('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x9f2d('0x66'),_0x587ee9['params']['id']);for(var _0xf7427a=0x0;_0xf7427a<_0x1df143[_0x9f2d('0x30')];_0xf7427a+=0x1){let _0x2ec18f=_0x1df143[_0xf7427a];for(var _0x2b6450=0x0;_0x2b6450<_0x2ec18f[_0x9f2d('0x55')][_0x9f2d('0x30')];_0x2b6450+=0x1){let _0x4f7875=_0x2ec18f[_0x9f2d('0x55')][_0x2b6450];var _0x552b3e=_0x325a38['clone']();_0x552b3e[_0x9f2d('0x25')](_0x9f2d('0x67'),_0x4f7875['id']);_0x333870['push'](db[_0x9f2d('0x59')][_0x9f2d('0x2b')](_0x552b3e[_0x9f2d('0x68')](),{'type':db['sequelize'][_0x9f2d('0x69')][_0x9f2d('0x6a')]})[_0x9f2d('0x18')](function(_0x52d9f1){if(_0x52d9f1[_0x9f2d('0x30')]===0x1){return _0x4f7875['id'];}else{var _0x10e333=_[_0x9f2d('0x6b')](_['map'](_0x52d9f1,_0x9f2d('0x6c')),function(_0xa2564f){return _['includes'](_0x1de1d5,_0xa2564f);});if(_0x10e333){return _0x4f7875['id'];}}}));}}return BPromise[_0x9f2d('0x6d')](_0x333870)[_0x9f2d('0x18')](function(_0x57cf5b){_0x50449a=_(_0x50449a)['union'](_0x57cf5b)[_0x9f2d('0x6e')]()['value']();return db[_0x9f2d('0x20')]['find']({'where':{'id':_0x587ee9[_0x9f2d('0x28')]['id']}})[_0x9f2d('0x18')](function(_0x425629){return db[_0x9f2d('0x59')][_0x9f2d('0x5a')](function(_0x1ef5e2){return _0x425629[_0x9f2d('0x5f')](_0x587ee9[_0x9f2d('0x2b')][_0x9f2d('0x54')],{'transaction':_0x1ef5e2})['then'](function(){if(!_['isEmpty'](_0x50449a)){return _0x425629[_0x9f2d('0x6f')](_0x50449a,{'transaction':_0x1ef5e2});}})[_0x9f2d('0x18')](function(){_0x50449a[_0x9f2d('0x5c')](function(_0x4f6aa5){socket[_0x9f2d('0x5d')](_0x9f2d('0x70'),{'UserId':_0x4f6aa5,'ChatQueueId':_0x425629['id']});});});});});});})['then'](respondWithStatusCode(_0x3e654e,null))[_0x9f2d('0x33')](handleError(_0x3e654e,null));};exports[_0x9f2d('0x71')]=function(_0x1116a7,_0x56a060){return db['ChatQueue'][_0x9f2d('0x32')]({'where':{'id':_0x1116a7[_0x9f2d('0x28')]['id']}})['then'](handleEntityNotFound(_0x56a060,null))[_0x9f2d('0x18')](function(_0x548926){if(_0x548926){return _0x548926[_0x9f2d('0x71')](_0x1116a7[_0x9f2d('0x35')][_0x9f2d('0x54')],_[_0x9f2d('0x72')](_0x1116a7[_0x9f2d('0x35')],[_0x9f2d('0x54'),'id'])||{})[_0x9f2d('0x73')](function(_0x250e60){for(var _0x2094bc=0x0;_0x2094bc<_0x1116a7[_0x9f2d('0x35')][_0x9f2d('0x54')][_0x9f2d('0x30')];_0x2094bc+=0x1){socket[_0x9f2d('0x5d')](_0x9f2d('0x5e'),{'UserId':Number(_0x1116a7[_0x9f2d('0x35')][_0x9f2d('0x54')][_0x2094bc]),'ChatQueueId':Number(_0x1116a7[_0x9f2d('0x28')]['id'])});}return _0x250e60;});}})[_0x9f2d('0x18')](respondWithResult(_0x56a060,null))[_0x9f2d('0x33')](handleError(_0x56a060,null));};exports[_0x9f2d('0x6f')]=function(_0x23a16b,_0xe53192){return db[_0x9f2d('0x20')]['find']({'where':{'id':_0x23a16b['params']['id']}})[_0x9f2d('0x18')](handleEntityNotFound(_0xe53192,null))[_0x9f2d('0x18')](function(_0x387f04){if(_0x387f04){return _0x387f04[_0x9f2d('0x6f')](_0x23a16b[_0x9f2d('0x2b')][_0x9f2d('0x54')])['then'](function(){if(_[_0x9f2d('0x74')](_0x23a16b['query'][_0x9f2d('0x54')])){for(var _0x2ae343=0x0;_0x2ae343<_0x23a16b[_0x9f2d('0x2b')]['ids']['length'];_0x2ae343+=0x1){socket['emit'](_0x9f2d('0x70'),{'UserId':Number(_0x23a16b[_0x9f2d('0x2b')][_0x9f2d('0x54')][_0x2ae343]),'ChatQueueId':Number(_0x23a16b['params']['id'])});}}else{socket[_0x9f2d('0x5d')](_0x9f2d('0x70'),{'UserId':Number(_0x23a16b[_0x9f2d('0x2b')]['ids']),'ChatQueueId':Number(_0x23a16b[_0x9f2d('0x28')]['id'])});}});}})[_0x9f2d('0x18')](respondWithStatusCode(_0xe53192,null))[_0x9f2d('0x33')](handleError(_0xe53192,null));};exports[_0x9f2d('0x75')]=function(_0x23df95,_0x20daa9){var _0x3e9498={};var _0x36a326={};var _0x352982;var _0x36f63a;return db[_0x9f2d('0x20')][_0x9f2d('0x51')]({'where':{'id':_0x23df95[_0x9f2d('0x28')]['id']}})[_0x9f2d('0x18')](handleEntityNotFound(_0x20daa9,null))[_0x9f2d('0x18')](function(_0x4a366d){if(_0x4a366d){_0x352982=_0x4a366d;_0x36a326[_0x9f2d('0x29')]=_[_0x9f2d('0x2a')](db['User'][_0x9f2d('0x21')]);_0x36a326['query']=_['keys'](_0x23df95[_0x9f2d('0x2b')]);_0x36a326[_0x9f2d('0x2c')]=_[_0x9f2d('0x2d')](_0x36a326[_0x9f2d('0x29')],_0x36a326['query']);_0x3e9498[_0x9f2d('0x2f')]=_[_0x9f2d('0x2d')](_0x36a326['model'],qs['fields'](_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x2e')]));_0x3e9498[_0x9f2d('0x2f')]=_0x3e9498[_0x9f2d('0x2f')]['length']?_0x3e9498[_0x9f2d('0x2f')]:_0x36a326[_0x9f2d('0x29')];_0x3e9498[_0x9f2d('0x76')]=qs[_0x9f2d('0x41')](_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x41')]);_0x3e9498[_0x9f2d('0x25')]=qs[_0x9f2d('0x2c')](_[_0x9f2d('0x42')](_0x23df95[_0x9f2d('0x2b')],_0x36a326[_0x9f2d('0x2c')]));if(_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x44')]){_0x3e9498[_0x9f2d('0x25')]=_[_0x9f2d('0x31')](_0x3e9498[_0x9f2d('0x25')],{'$or':_[_0x9f2d('0x1f')](_0x3e9498[_0x9f2d('0x2f')],function(_0x35f2e8){var _0x55a17c={};_0x55a17c[_0x35f2e8]={'$like':'%'+_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x44')]+'%'};return _0x55a17c;})});}_0x3e9498=_[_0x9f2d('0x31')]({},_0x3e9498,_0x23df95['options']);return _0x352982[_0x9f2d('0x75')](_0x3e9498);}})['then'](function(_0x667607){if(_0x667607){_0x36f63a=_0x667607[_0x9f2d('0x30')];if(!_0x23df95[_0x9f2d('0x2b')]['hasOwnProperty']('nolimit')){_0x3e9498[_0x9f2d('0x15')]=qs[_0x9f2d('0x15')](_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x15')]);_0x3e9498[_0x9f2d('0x12')]=qs[_0x9f2d('0x12')](_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x12')]);}return _0x352982[_0x9f2d('0x75')](_0x3e9498);}})[_0x9f2d('0x18')](function(_0xc3e31a){if(_0xc3e31a){return _0xc3e31a?{'count':_0x36f63a,'rows':_0xc3e31a}:null;}})[_0x9f2d('0x18')](respondWithResult(_0x20daa9,null))[_0x9f2d('0x33')](handleError(_0x20daa9,null));}; \ No newline at end of file +var _0xe49d=['each','UserChatQueue','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','User','select','tq.TeamId','from','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','addAgents','isArray','userChatQueue:remove','getAgents','bluebird','util','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','status','end','json','offset','undefined','limit','count','set','update','then','destroy','ChatQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','ChatQueue','rawAttributes','type','getOptions','where','include','query','rows','show','params','model','keys','filters','attributes','intersection','fields','options','find','catch','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','findOne','length','hasOwnProperty','order','sort','pick','ChatQueueId','filter','merge','findAndCountAll','agent','chatPause','createdAt','updatedAt','getTeams','nolimit','addTeams','ids','Team','findAll','online','interface','Agents','sequelize','transaction'];(function(_0x4b775b,_0x2aadc6){var _0xf84d39=function(_0x55ac96){while(--_0x55ac96){_0x4b775b['push'](_0x4b775b['shift']());}};_0xf84d39(++_0x2aadc6);}(_0xe49d,0x1ee));var _0xde49=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe49d[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xde49('0x0'));var util=require(_0xde49('0x1'));var _=require('lodash');var squel=require(_0xde49('0x2'));var Redis=require(_0xde49('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xde49('0x4'))(_0xde49('0x5'));var config=require(_0xde49('0x6'));var db=require(_0xde49('0x7'))['db'];config[_0xde49('0x8')]=_[_0xde49('0x9')](config['redis'],{'host':_0xde49('0xa'),'port':0x18eb});var socket=require(_0xde49('0xb'))(new Redis(config[_0xde49('0x8')]));require(_0xde49('0xc'))[_0xde49('0xd')](socket);function respondWithStatusCode(_0x406d47,_0x2e4cd3){_0x2e4cd3=_0x2e4cd3||0xcc;return function(_0x1efdb7){if(_0x1efdb7){return _0x406d47['sendStatus'](_0x2e4cd3);}return _0x406d47[_0xde49('0xe')](_0x2e4cd3)[_0xde49('0xf')]();};}function respondWithResult(_0x5715a0,_0x4fcd11){_0x4fcd11=_0x4fcd11||0xc8;return function(_0x36baae){if(_0x36baae){return _0x5715a0[_0xde49('0xe')](_0x4fcd11)[_0xde49('0x10')](_0x36baae);}};}function respondWithFilteredResult(_0x364b6d,_0x8dfb87){return function(_0x589485){if(_0x589485){var _0x11187b=typeof _0x8dfb87[_0xde49('0x11')]===_0xde49('0x12')&&typeof _0x8dfb87[_0xde49('0x13')]===_0xde49('0x12');var _0x28d452=_0x589485[_0xde49('0x14')];var _0x30c3de=_0x11187b?0x0:_0x8dfb87[_0xde49('0x11')];var _0x1bef97=_0x11187b?_0x589485[_0xde49('0x14')]:_0x8dfb87['offset']+_0x8dfb87[_0xde49('0x13')];var _0x100dbd;if(_0x1bef97>=_0x28d452){_0x1bef97=_0x28d452;_0x100dbd=0xc8;}else{_0x100dbd=0xce;}_0x364b6d[_0xde49('0xe')](_0x100dbd);return _0x364b6d[_0xde49('0x15')]('Content-Range',_0x30c3de+'-'+_0x1bef97+'/'+_0x28d452)['json'](_0x589485);}return null;};}function saveUpdates(_0x3b4b7b){return function(_0x200f30){if(_0x200f30){return _0x200f30[_0xde49('0x16')](_0x3b4b7b)[_0xde49('0x17')](function(_0x6e5376){return _0x6e5376;});}return null;};}function removeEntity(_0x34bd53){return function(_0x388093){if(_0x388093){return _0x388093[_0xde49('0x18')]()[_0xde49('0x17')](function(){var _0x14515d=_0x388093['get']({'plain':!![]});var _0x21a2f7=_0xde49('0x19');return db[_0xde49('0x1a')][_0xde49('0x18')]({'where':{'type':_0x21a2f7,'resourceId':_0x14515d['id']}})[_0xde49('0x17')](function(){return _0x388093;});})[_0xde49('0x17')](function(){_0x34bd53[_0xde49('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x113b40){return function(_0x6c6a8){if(!_0x6c6a8){_0x113b40[_0xde49('0x1b')](0x194);}return _0x6c6a8;};}function handleError(_0x25725a,_0x2c593d){_0x2c593d=_0x2c593d||0x1f4;return function(_0x870ff3){logger[_0xde49('0x1c')](_0x870ff3[_0xde49('0x1d')]);if(_0x870ff3[_0xde49('0x1e')]){delete _0x870ff3['name'];}_0x25725a[_0xde49('0xe')](_0x2c593d)[_0xde49('0x1f')](_0x870ff3);};}exports[_0xde49('0x20')]=function(_0x107af0,_0xfd9682){var _0x1547e9={};var _0x3bd9b4={'count':0x0,'rows':[]};var _0x72cdad=_[_0xde49('0x21')](db[_0xde49('0x22')][_0xde49('0x23')],function(_0x1f9422){return{'name':_0x1f9422['fieldName'],'type':_0x1f9422[_0xde49('0x24')]['key']};});_0x1547e9=qs[_0xde49('0x25')](_0x72cdad,_0x107af0);var _0x4fd45a={'where':_0x1547e9[_0xde49('0x26')]};return db[_0xde49('0x22')][_0xde49('0x14')](_0x4fd45a)[_0xde49('0x17')](function(_0x281830){_0x3bd9b4[_0xde49('0x14')]=_0x281830;_0x1547e9[_0xde49('0x27')]=qs[_0xde49('0x27')](_0x107af0[_0xde49('0x28')]);return db[_0xde49('0x22')]['findAll'](_0x1547e9);})[_0xde49('0x17')](function(_0x2a0542){_0x3bd9b4[_0xde49('0x29')]=_0x2a0542;return _0x3bd9b4;})[_0xde49('0x17')](respondWithFilteredResult(_0xfd9682,_0x1547e9))['catch'](handleError(_0xfd9682,null));};exports[_0xde49('0x2a')]=function(_0x427262,_0x366f3b){var _0x5cf36d={'raw':!![],'where':{'id':_0x427262[_0xde49('0x2b')]['id']}},_0x5c3c82={};_0x5c3c82[_0xde49('0x2c')]=_['keys'](db[_0xde49('0x22')]['rawAttributes']);_0x5c3c82['query']=_[_0xde49('0x2d')](_0x427262['query']);_0x5c3c82[_0xde49('0x2e')]=_['intersection'](_0x5c3c82[_0xde49('0x2c')],_0x5c3c82[_0xde49('0x28')]);_0x5cf36d[_0xde49('0x2f')]=_[_0xde49('0x30')](_0x5c3c82[_0xde49('0x2c')],qs[_0xde49('0x31')](_0x427262[_0xde49('0x28')][_0xde49('0x31')]));_0x5cf36d[_0xde49('0x2f')]=_0x5cf36d[_0xde49('0x2f')]['length']?_0x5cf36d[_0xde49('0x2f')]:_0x5c3c82['model'];if(_0x427262[_0xde49('0x28')]['includeAll']){_0x5cf36d[_0xde49('0x27')]=[{'all':!![]}];}_0x5cf36d=_['merge']({},_0x5cf36d,_0x427262[_0xde49('0x32')]);return db[_0xde49('0x22')][_0xde49('0x33')](_0x5cf36d)['then'](handleEntityNotFound(_0x366f3b,null))['then'](respondWithResult(_0x366f3b,null))[_0xde49('0x34')](handleError(_0x366f3b,null));};exports[_0xde49('0x35')]=function(_0x1aa804,_0x5d85fe){return db['ChatQueue'][_0xde49('0x35')](_0x1aa804[_0xde49('0x36')],{})[_0xde49('0x17')](function(_0x30e8d1){var _0x41281f=_0x1aa804['user'][_0xde49('0x37')]({'plain':!![]});if(!_0x41281f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41281f[_0xde49('0x38')]===_0xde49('0x39')){var _0x136998=_0x30e8d1[_0xde49('0x37')]({'plain':!![]});var _0x15928c=_0xde49('0x19');return db[_0xde49('0x3a')][_0xde49('0x33')]({'where':{'name':_0x15928c,'userProfileId':_0x41281f[_0xde49('0x3b')]},'raw':!![]})[_0xde49('0x17')](function(_0x2d669f){if(_0x2d669f&&_0x2d669f[_0xde49('0x3c')]===0x0){return db[_0xde49('0x1a')]['create']({'name':_0x136998[_0xde49('0x1e')],'resourceId':_0x136998['id'],'type':_0x2d669f[_0xde49('0x1e')],'sectionId':_0x2d669f['id']},{})[_0xde49('0x17')](function(){return _0x30e8d1;});}else{return _0x30e8d1;}})[_0xde49('0x34')](function(_0x1006ec){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1006ec);throw _0x1006ec;});}return _0x30e8d1;})['then'](respondWithResult(_0x5d85fe,0xc9))[_0xde49('0x34')](handleError(_0x5d85fe,null));};exports['update']=function(_0x56503b,_0x10502c){if(_0x56503b[_0xde49('0x36')]['id']){delete _0x56503b[_0xde49('0x36')]['id'];}return db[_0xde49('0x22')][_0xde49('0x33')]({'where':{'id':_0x56503b[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x10502c,null))[_0xde49('0x17')](saveUpdates(_0x56503b['body'],null))[_0xde49('0x17')](respondWithResult(_0x10502c,null))[_0xde49('0x34')](handleError(_0x10502c,null));};exports[_0xde49('0x18')]=function(_0x53e772,_0x44a246){return db['ChatQueue'][_0xde49('0x33')]({'where':{'id':_0x53e772[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x44a246,null))[_0xde49('0x17')](removeEntity(_0x44a246,null))[_0xde49('0x34')](handleError(_0x44a246,null));};exports['describe']=function(_0x1e56a2,_0x91fc48){return db[_0xde49('0x22')]['describe']()[_0xde49('0x17')](respondWithResult(_0x91fc48,null))[_0xde49('0x34')](handleError(_0x91fc48,null));};exports['getMembers']=function(_0xa11662,_0x12ecd5){var _0x25b15d={'raw':!![],'where':{}},_0x535d76={},_0x1317f4;return db[_0xde49('0x22')][_0xde49('0x3d')]({'where':{'id':_0xa11662[_0xde49('0x2b')]['id']}})['then'](handleEntityNotFound(_0x12ecd5,null))[_0xde49('0x17')](function(_0x5f016f){if(_0x5f016f){_0x1317f4=_0x5f016f[_0xde49('0x37')]({'plain':!![]});_0x535d76[_0xde49('0x2c')]=_[_0xde49('0x2d')](db['UserChatQueue']['rawAttributes']);_0x535d76[_0xde49('0x28')]=_[_0xde49('0x2d')](_0xa11662[_0xde49('0x28')]);_0x535d76[_0xde49('0x2e')]=_[_0xde49('0x30')](_0x535d76[_0xde49('0x2c')],_0x535d76[_0xde49('0x28')]);_0x25b15d[_0xde49('0x2f')]=_[_0xde49('0x30')](_0x535d76['model'],qs[_0xde49('0x31')](_0xa11662['query']['fields']));_0x25b15d['attributes']=_0x25b15d['attributes'][_0xde49('0x3e')]?_0x25b15d['attributes']:_0x535d76[_0xde49('0x2c')];if(!_0xa11662[_0xde49('0x28')][_0xde49('0x3f')]('nolimit')){_0x25b15d[_0xde49('0x13')]=qs['limit'](_0xa11662[_0xde49('0x28')]['limit']);_0x25b15d[_0xde49('0x11')]=qs['offset'](_0xa11662[_0xde49('0x28')][_0xde49('0x11')]);}_0x25b15d[_0xde49('0x40')]=qs[_0xde49('0x41')](_0xa11662[_0xde49('0x28')][_0xde49('0x41')]);_0x25b15d[_0xde49('0x26')]=qs['filters'](_[_0xde49('0x42')](_0xa11662[_0xde49('0x28')],_0x535d76[_0xde49('0x2e')]));_0x25b15d['where'][_0xde49('0x43')]=_0x5f016f['id'];if(_0xa11662[_0xde49('0x28')][_0xde49('0x44')]){_0x25b15d[_0xde49('0x26')]=_[_0xde49('0x45')](_0x25b15d[_0xde49('0x26')],{'$or':_[_0xde49('0x21')](_0x25b15d[_0xde49('0x2f')],function(_0x5da66a){var _0x1a8436={};_0x1a8436[_0x5da66a]={'$like':'%'+_0xa11662[_0xde49('0x28')][_0xde49('0x44')]+'%'};return _0x1a8436;})});}_0x25b15d=_['merge']({},_0x25b15d,_0xa11662[_0xde49('0x32')]);return db['UserChatQueue']['findAll'](_0x25b15d);}})[_0xde49('0x17')](function(_0x3f8472){if(_0x3f8472){return db['User'][_0xde49('0x46')]({'where':{'id':_[_0xde49('0x21')](_0x3f8472,'UserId'),'role':_0xde49('0x47')},'attributes':['id','name',_0xde49('0x48'),'updatedAt',_0xde49('0x49')]});}})[_0xde49('0x17')](function(_0x11004c){if(_0x11004c){return{'count':_0x11004c[_0xde49('0x14')],'rows':_[_0xde49('0x21')](_0x11004c[_0xde49('0x29')],function(_0x3d2f36){return{'membername':_0x3d2f36[_0xde49('0x1e')],'UserId':_0x3d2f36['id'],'queue_name':_0x1317f4[_0xde49('0x1e')],'ChatQueueId':_0x1317f4['id'],'interface':util['format']('%s/%s','SIP',_0x3d2f36[_0xde49('0x1e')]),'penalty':0x0,'paused':_0x3d2f36[_0xde49('0x48')],'createdAt':_0x3d2f36[_0xde49('0x49')],'updatedAt':_0x3d2f36[_0xde49('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xde49('0x17')](respondWithFilteredResult(_0x12ecd5,_0x25b15d))[_0xde49('0x34')](handleError(_0x12ecd5,null));};exports[_0xde49('0x4b')]=function(_0x4f35f2,_0x1bde6f){var _0x292455={};var _0x383c2f={};var _0xe576f5;var _0x17282f;return db['ChatQueue'][_0xde49('0x3d')]({'where':{'id':_0x4f35f2[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x1bde6f,null))['then'](function(_0x3004de){if(_0x3004de){_0xe576f5=_0x3004de;_0x383c2f['model']=_[_0xde49('0x2d')](db['Team'][_0xde49('0x23')]);_0x383c2f[_0xde49('0x28')]=_['keys'](_0x4f35f2['query']);_0x383c2f[_0xde49('0x2e')]=_[_0xde49('0x30')](_0x383c2f[_0xde49('0x2c')],_0x383c2f[_0xde49('0x28')]);_0x292455[_0xde49('0x2f')]=_[_0xde49('0x30')](_0x383c2f[_0xde49('0x2c')],qs['fields'](_0x4f35f2['query'][_0xde49('0x31')]));_0x292455[_0xde49('0x2f')]=_0x292455[_0xde49('0x2f')][_0xde49('0x3e')]?_0x292455[_0xde49('0x2f')]:_0x383c2f['model'];_0x292455['order']=qs[_0xde49('0x41')](_0x4f35f2[_0xde49('0x28')][_0xde49('0x41')]);_0x292455['where']=qs['filters'](_[_0xde49('0x42')](_0x4f35f2[_0xde49('0x28')],_0x383c2f[_0xde49('0x2e')]));if(_0x4f35f2[_0xde49('0x28')][_0xde49('0x44')]){_0x292455[_0xde49('0x26')]=_[_0xde49('0x45')](_0x292455[_0xde49('0x26')],{'$or':_['map'](_0x292455[_0xde49('0x2f')],function(_0x1131da){var _0x451f0b={};_0x451f0b[_0x1131da]={'$like':'%'+_0x4f35f2['query']['filter']+'%'};return _0x451f0b;})});}_0x292455=_['merge']({},_0x292455,_0x4f35f2[_0xde49('0x32')]);return _0xe576f5['getTeams'](_0x292455);}})[_0xde49('0x17')](function(_0x41cddc){if(_0x41cddc){_0x17282f=_0x41cddc[_0xde49('0x3e')];if(!_0x4f35f2[_0xde49('0x28')][_0xde49('0x3f')](_0xde49('0x4c'))){_0x292455['limit']=qs['limit'](_0x4f35f2[_0xde49('0x28')][_0xde49('0x13')]);_0x292455['offset']=qs['offset'](_0x4f35f2[_0xde49('0x28')][_0xde49('0x11')]);}return _0xe576f5[_0xde49('0x4b')](_0x292455);}})[_0xde49('0x17')](function(_0x4290f1){if(_0x4290f1){return _0x4290f1?{'count':_0x17282f,'rows':_0x4290f1}:null;}})[_0xde49('0x17')](respondWithResult(_0x1bde6f,null))['catch'](handleError(_0x1bde6f,null));};exports[_0xde49('0x4d')]=function(_0x358e75,_0x4d25ff){var _0x2f2f41=_0x358e75[_0xde49('0x36')][_0xde49('0x4e')];return db[_0xde49('0x4f')][_0xde49('0x50')]({'where':{'id':_0x2f2f41},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xde49('0x51'),'voicePause',_0xde49('0x52')],'raw':!![]}]})[_0xde49('0x17')](function(_0x5d5ac2){if(_0x5d5ac2){var _0x3506aa=_['flatMap'](_0x5d5ac2,function(_0x11bfe4){var _0x53750e=_0x11bfe4['get']({'plain':!![]});return _0x53750e[_0xde49('0x53')];});return db[_0xde49('0x22')][_0xde49('0x33')]({'where':{'id':_0x358e75[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](function(_0x3b41ee){return db[_0xde49('0x54')][_0xde49('0x55')](function(_0x3bf59a){return _0x3b41ee[_0xde49('0x4d')](_0x2f2f41,{'transaction':_0x3bf59a})[_0xde49('0x17')](function(){return BPromise[_0xde49('0x56')](_0x3506aa,function(_0x27fff2){return db[_0xde49('0x57')][_0xde49('0x58')]({'where':{'UserId':_0x27fff2['id'],'ChatQueueId':_0x358e75[_0xde49('0x2b')]['id']},'transaction':_0x3bf59a});});})[_0xde49('0x17')](function(){_0x3506aa[_0xde49('0x59')](function(_0x246957){socket[_0xde49('0x5a')](_0xde49('0x5b'),{'UserId':_0x246957['id'],'ChatQueueId':_0x3b41ee['id']});});});});});}})[_0xde49('0x17')](respondWithStatusCode(_0x4d25ff,null))[_0xde49('0x34')](handleError(_0x4d25ff,null));};exports[_0xde49('0x5c')]=function(_0x92c259,_0x4ee992){return db['Team'][_0xde49('0x50')]({'where':{'id':_0x92c259['query'][_0xde49('0x4e')]},'attributes':['id'],'include':[{'model':db[_0xde49('0x5d')],'as':_0xde49('0x53'),'attributes':['id'],'raw':!![]}]})[_0xde49('0x17')](handleEntityNotFound(_0x4ee992,null))[_0xde49('0x17')](function(_0x189805){var _0x8af480=_['map'](_0x189805,'id');var _0x1314b5=[];var _0x49d4f2=[];var _0x1128e3=squel[_0xde49('0x5e')]();_0x1128e3['field'](_0xde49('0x5f'))[_0xde49('0x60')]('team_has_chat_queues','tq')[_0xde49('0x61')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xde49('0x26')](_0xde49('0x62'),_0x92c259['params']['id']);for(var _0x4c27cf=0x0;_0x4c27cf<_0x189805['length'];_0x4c27cf+=0x1){let _0x38d1ce=_0x189805[_0x4c27cf];for(var _0x302f64=0x0;_0x302f64<_0x38d1ce[_0xde49('0x53')][_0xde49('0x3e')];_0x302f64+=0x1){let _0x488ae1=_0x38d1ce[_0xde49('0x53')][_0x302f64];var _0x3cb7be=_0x1128e3[_0xde49('0x63')]();_0x3cb7be[_0xde49('0x26')](_0xde49('0x64'),_0x488ae1['id']);_0x49d4f2[_0xde49('0x65')](db[_0xde49('0x54')][_0xde49('0x28')](_0x3cb7be[_0xde49('0x66')](),{'type':db['sequelize']['QueryTypes'][_0xde49('0x67')]})[_0xde49('0x17')](function(_0x56ae21){if(_0x56ae21['length']===0x1){return _0x488ae1['id'];}else{var _0x2edb49=_[_0xde49('0x68')](_[_0xde49('0x21')](_0x56ae21,_0xde49('0x69')),function(_0xb7d482){return _[_0xde49('0x6a')](_0x8af480,_0xb7d482);});if(_0x2edb49){return _0x488ae1['id'];}}}));}}return BPromise[_0xde49('0x6b')](_0x49d4f2)[_0xde49('0x17')](function(_0x7c7c0d){_0x1314b5=_(_0x1314b5)['union'](_0x7c7c0d)[_0xde49('0x6c')]()[_0xde49('0x6d')]();return db['ChatQueue']['find']({'where':{'id':_0x92c259[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](function(_0x320255){return db[_0xde49('0x54')][_0xde49('0x55')](function(_0x1b2418){return _0x320255[_0xde49('0x5c')](_0x92c259['query'][_0xde49('0x4e')],{'transaction':_0x1b2418})[_0xde49('0x17')](function(){if(!_[_0xde49('0x6e')](_0x1314b5)){return _0x320255[_0xde49('0x6f')](_0x1314b5,{'transaction':_0x1b2418});}})[_0xde49('0x17')](function(){_0x1314b5[_0xde49('0x59')](function(_0x1c3b45){socket[_0xde49('0x5a')]('userChatQueue:remove',{'UserId':_0x1c3b45,'ChatQueueId':_0x320255['id']});});});});});});})[_0xde49('0x17')](respondWithStatusCode(_0x4ee992,null))[_0xde49('0x34')](handleError(_0x4ee992,null));};exports[_0xde49('0x70')]=function(_0xdc582d,_0x1058a7){return db[_0xde49('0x22')][_0xde49('0x33')]({'where':{'id':_0xdc582d[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x1058a7,null))[_0xde49('0x17')](function(_0x22e078){if(_0x22e078){return _0x22e078[_0xde49('0x70')](_0xdc582d[_0xde49('0x36')][_0xde49('0x4e')],_['omit'](_0xdc582d[_0xde49('0x36')],[_0xde49('0x4e'),'id'])||{})['spread'](function(_0x4d73f4){for(var _0x8b06b5=0x0;_0x8b06b5<_0xdc582d[_0xde49('0x36')][_0xde49('0x4e')][_0xde49('0x3e')];_0x8b06b5+=0x1){socket[_0xde49('0x5a')](_0xde49('0x5b'),{'UserId':Number(_0xdc582d[_0xde49('0x36')][_0xde49('0x4e')][_0x8b06b5]),'ChatQueueId':Number(_0xdc582d['params']['id'])});}return _0x4d73f4;});}})[_0xde49('0x17')](respondWithResult(_0x1058a7,null))['catch'](handleError(_0x1058a7,null));};exports['removeAgents']=function(_0x186805,_0x55e91a){return db[_0xde49('0x22')][_0xde49('0x33')]({'where':{'id':_0x186805[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x55e91a,null))[_0xde49('0x17')](function(_0x584ed7){if(_0x584ed7){return _0x584ed7[_0xde49('0x6f')](_0x186805['query'][_0xde49('0x4e')])[_0xde49('0x17')](function(){if(_[_0xde49('0x71')](_0x186805[_0xde49('0x28')][_0xde49('0x4e')])){for(var _0x3c3a36=0x0;_0x3c3a36<_0x186805[_0xde49('0x28')][_0xde49('0x4e')][_0xde49('0x3e')];_0x3c3a36+=0x1){socket[_0xde49('0x5a')](_0xde49('0x72'),{'UserId':Number(_0x186805['query'][_0xde49('0x4e')][_0x3c3a36]),'ChatQueueId':Number(_0x186805[_0xde49('0x2b')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x186805['query'][_0xde49('0x4e')]),'ChatQueueId':Number(_0x186805['params']['id'])});}});}})[_0xde49('0x17')](respondWithStatusCode(_0x55e91a,null))[_0xde49('0x34')](handleError(_0x55e91a,null));};exports['getAgents']=function(_0x2d66e4,_0x351ed8){var _0x395c67={};var _0x505a93={};var _0x38d1a4;var _0x198ec8;return db[_0xde49('0x22')]['findOne']({'where':{'id':_0x2d66e4[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x351ed8,null))[_0xde49('0x17')](function(_0x4eedbc){if(_0x4eedbc){_0x38d1a4=_0x4eedbc;_0x505a93[_0xde49('0x2c')]=_['keys'](db[_0xde49('0x5d')][_0xde49('0x23')]);_0x505a93['query']=_[_0xde49('0x2d')](_0x2d66e4['query']);_0x505a93[_0xde49('0x2e')]=_[_0xde49('0x30')](_0x505a93['model'],_0x505a93[_0xde49('0x28')]);_0x395c67[_0xde49('0x2f')]=_[_0xde49('0x30')](_0x505a93[_0xde49('0x2c')],qs[_0xde49('0x31')](_0x2d66e4[_0xde49('0x28')][_0xde49('0x31')]));_0x395c67[_0xde49('0x2f')]=_0x395c67[_0xde49('0x2f')][_0xde49('0x3e')]?_0x395c67['attributes']:_0x505a93['model'];_0x395c67['order']=qs[_0xde49('0x41')](_0x2d66e4[_0xde49('0x28')][_0xde49('0x41')]);_0x395c67[_0xde49('0x26')]=qs[_0xde49('0x2e')](_[_0xde49('0x42')](_0x2d66e4['query'],_0x505a93[_0xde49('0x2e')]));if(_0x2d66e4['query']['filter']){_0x395c67[_0xde49('0x26')]=_[_0xde49('0x45')](_0x395c67['where'],{'$or':_[_0xde49('0x21')](_0x395c67[_0xde49('0x2f')],function(_0x30b1c7){var _0x1a1964={};_0x1a1964[_0x30b1c7]={'$like':'%'+_0x2d66e4['query'][_0xde49('0x44')]+'%'};return _0x1a1964;})});}_0x395c67=_[_0xde49('0x45')]({},_0x395c67,_0x2d66e4['options']);return _0x38d1a4[_0xde49('0x73')](_0x395c67);}})[_0xde49('0x17')](function(_0x30fc76){if(_0x30fc76){_0x198ec8=_0x30fc76[_0xde49('0x3e')];if(!_0x2d66e4[_0xde49('0x28')][_0xde49('0x3f')]('nolimit')){_0x395c67[_0xde49('0x13')]=qs[_0xde49('0x13')](_0x2d66e4['query'][_0xde49('0x13')]);_0x395c67[_0xde49('0x11')]=qs['offset'](_0x2d66e4[_0xde49('0x28')][_0xde49('0x11')]);}return _0x38d1a4['getAgents'](_0x395c67);}})[_0xde49('0x17')](function(_0x255f2c){if(_0x255f2c){return _0x255f2c?{'count':_0x198ec8,'rows':_0x255f2c}:null;}})[_0xde49('0x17')](respondWithResult(_0x351ed8,null))[_0xde49('0x34')](handleError(_0x351ed8,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index acf059c..eb229d4 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 _0x279d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','remove'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x279d,0x1d8));var _0xd279=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x279d[_0x369151];return _0x4292d5;};'use strict';var EventEmitter=require(_0xd279('0x0'));var ChatQueue=require(_0xd279('0x1'))['db'][_0xd279('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd279('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd279('0x4')};function emitEvent(_0x44441d){return function(_0x47cfee,_0x15d034,_0x2a9e8c){ChatQueueEvents[_0xd279('0x5')](_0x44441d+':'+_0x47cfee['id'],_0x47cfee);ChatQueueEvents[_0xd279('0x5')](_0x44441d,_0x47cfee);_0x2a9e8c(null);};}for(var e in events){if(events[_0xd279('0x6')](e)){var event=events[e];ChatQueue[_0xd279('0x7')](e,emitEvent(event));}}module[_0xd279('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x3f5c=['events','ChatQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x159924,_0x39a170){var _0x7aa9b0=function(_0x4cd6ae){while(--_0x4cd6ae){_0x159924['push'](_0x159924['shift']());}};_0x7aa9b0(++_0x39a170);}(_0x3f5c,0x129));var _0xc3f5=function(_0x3a88c4,_0x11773b){_0x3a88c4=_0x3a88c4-0x0;var _0x411580=_0x3f5c[_0x3a88c4];return _0x411580;};'use strict';var EventEmitter=require(_0xc3f5('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xc3f5('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xc3f5('0x2')](0x0);var events={'afterCreate':_0xc3f5('0x3'),'afterUpdate':'update','afterDestroy':_0xc3f5('0x4')};function emitEvent(_0x49be7c){return function(_0x5ccfe2,_0x238645,_0x57a172){ChatQueueEvents[_0xc3f5('0x5')](_0x49be7c+':'+_0x5ccfe2['id'],_0x5ccfe2);ChatQueueEvents[_0xc3f5('0x5')](_0x49be7c,_0x5ccfe2);_0x57a172(null);};}for(var e in events){if(events[_0xc3f5('0x6')](e)){var event=events[e];ChatQueue[_0xc3f5('0x7')](e,emitEvent(event));}}module[_0xc3f5('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 47951f4..aa7983a 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 _0xa787=['./chatQueue.attributes','exports','define','ChatQueue','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x167dc,_0x2e5bf3){var _0x30bbbb=function(_0x3384a5){while(--_0x3384a5){_0x167dc['push'](_0x167dc['shift']());}};_0x30bbbb(++_0x2e5bf3);}(_0xa787,0x19b));var _0x7a78=function(_0x3326f3,_0x27919d){_0x3326f3=_0x3326f3-0x0;var _0x3fc066=_0xa787[_0x3326f3];return _0x3fc066;};'use strict';var _=require('lodash');var util=require(_0x7a78('0x0'));var logger=require(_0x7a78('0x1'))('api');var moment=require(_0x7a78('0x2'));var BPromise=require(_0x7a78('0x3'));var rp=require(_0x7a78('0x4'));var fs=require('fs');var path=require(_0x7a78('0x5'));var rimraf=require(_0x7a78('0x6'));var config=require('../../config/environment');var attributes=require(_0x7a78('0x7'));module[_0x7a78('0x8')]=function(_0x3ac7c5,_0x10d563){return _0x3ac7c5[_0x7a78('0x9')](_0x7a78('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50e5=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x5267cd,_0x30cf7b){var _0x3419ce=function(_0x3a1dfb){while(--_0x3a1dfb){_0x5267cd['push'](_0x5267cd['shift']());}};_0x3419ce(++_0x30cf7b);}(_0x50e5,0xef));var _0x550e=function(_0x1cc666,_0x272d12){_0x1cc666=_0x1cc666-0x0;var _0x3c3764=_0x50e5[_0x1cc666];return _0x3c3764;};'use strict';var _=require(_0x550e('0x0'));var util=require('util');var logger=require(_0x550e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x550e('0x2'));var rp=require(_0x550e('0x3'));var fs=require('fs');var path=require(_0x550e('0x4'));var rimraf=require(_0x550e('0x5'));var config=require(_0x550e('0x6'));var attributes=require(_0x550e('0x7'));module[_0x550e('0x8')]=function(_0x202fca,_0x1303d5){return _0x202fca[_0x550e('0x9')](_0x550e('0xa'),attributes,{'tableName':_0x550e('0xb'),'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 7da80fa..882a507 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 _0x0d74=['jayson/promise','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetChatQueue','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','ChatQueue','find','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x57f8af,_0x3a881a){var _0x1ef58a=function(_0x14c7b4){while(--_0x14c7b4){_0x57f8af['push'](_0x57f8af['shift']());}};_0x1ef58a(++_0x3a881a);}(_0x0d74,0x146));var _0x40d7=function(_0x119709,_0x43cc9d){_0x119709=_0x119709-0x0;var _0x24ef6a=_0x0d74[_0x119709];return _0x24ef6a;};'use strict';var _=require(_0x40d7('0x0'));var util=require(_0x40d7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x40d7('0x2'));var fs=require('fs');var Redis=require(_0x40d7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x40d7('0x4'))(_0x40d7('0x5'));var config=require(_0x40d7('0x6'));var jayson=require(_0x40d7('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x40d7('0x8')](config['redis'],{'host':_0x40d7('0x9'),'port':0x18eb});var socket=require(_0x40d7('0xa'))(new Redis(config['redis']));require(_0x40d7('0xb'))[_0x40d7('0xc')](socket);function respondWithRpcPromise(_0x354f80,_0x2bae78,_0xcb37e3){return new BPromise(function(_0x517d88,_0x5208be){return client[_0x40d7('0xd')](_0x354f80,_0xcb37e3)[_0x40d7('0xe')](function(_0x229937){logger[_0x40d7('0xf')](_0x40d7('0x10'),_0x2bae78,'request\x20sent');logger[_0x40d7('0x11')](_0x40d7('0x12'),_0x2bae78,_0x40d7('0x13'),JSON[_0x40d7('0x14')](_0x229937));if(_0x229937['error']){if(_0x229937[_0x40d7('0x15')][_0x40d7('0x16')]===0x1f4){logger[_0x40d7('0x15')](_0x40d7('0x10'),_0x2bae78,_0x229937[_0x40d7('0x15')][_0x40d7('0x17')]);return _0x5208be(_0x229937[_0x40d7('0x15')][_0x40d7('0x17')]);}logger[_0x40d7('0x15')]('ChatQueue,\x20%s,\x20%s',_0x2bae78,_0x229937['error']['message']);return _0x517d88(_0x229937[_0x40d7('0x15')][_0x40d7('0x17')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x2bae78,_0x40d7('0x13'));_0x517d88(_0x229937['result']['message']);}})[_0x40d7('0x18')](function(_0x22de5a){logger[_0x40d7('0x15')](_0x40d7('0x10'),_0x2bae78,_0x22de5a);_0x5208be(_0x22de5a);});});}exports[_0x40d7('0x19')]=function(_0x28bbc0){var _0x3d2afa=this;return new Promise(function(_0x3ec437,_0x5eb3c1){return db['ChatQueue']['findAll']({'raw':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0['options'][_0x40d7('0x1b')]===undefined?!![]:![]:!![],'where':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1c')]||null:null,'attributes':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1d')]||null:null,'limit':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1e')]||null:null,'include':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0['options'][_0x40d7('0x1f')]?_[_0x40d7('0x20')](_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1f')],function(_0x528ab5){return{'model':db[_0x528ab5['model']],'as':_0x528ab5['as'],'attributes':_0x528ab5[_0x40d7('0x1d')],'include':_0x528ab5['include']?_['map'](_0x528ab5[_0x40d7('0x1f')],function(_0x1ef074){return{'model':db[_0x1ef074[_0x40d7('0x21')]],'as':_0x1ef074['as'],'attributes':_0x1ef074[_0x40d7('0x1d')],'include':_0x1ef074['include']?_['map'](_0x1ef074[_0x40d7('0x1f')],function(_0x2b5f11){return{'model':db[_0x2b5f11[_0x40d7('0x21')]],'as':_0x2b5f11['as'],'attributes':_0x2b5f11['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1102d3){logger[_0x40d7('0xf')]('GetChatQueue',_0x28bbc0);logger[_0x40d7('0x11')](_0x40d7('0x19'),_0x28bbc0,JSON[_0x40d7('0x14')](_0x1102d3));_0x3ec437(_0x1102d3);})[_0x40d7('0x18')](function(_0x555a3b){logger['error'](_0x40d7('0x19'),_0x555a3b[_0x40d7('0x17')],_0x28bbc0);_0x5eb3c1(_0x3d2afa[_0x40d7('0x15')](0x1f4,_0x555a3b[_0x40d7('0x17')]));});});};exports[_0x40d7('0x22')]=function(_0x4a2bc2){var _0x23e560=this;return new Promise(function(_0x5af456,_0x22edd1){return db[_0x40d7('0x23')][_0x40d7('0x24')]({'raw':_0x4a2bc2['options']?_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a2bc2[_0x40d7('0x1a')]?_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1c')]||null:null,'attributes':_0x4a2bc2[_0x40d7('0x1a')]?_0x4a2bc2[_0x40d7('0x1a')]['attributes']||null:null,'include':_0x4a2bc2[_0x40d7('0x1a')]?_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1f')]?_[_0x40d7('0x20')](_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1f')],function(_0x1e6f08){return{'model':db[_0x1e6f08[_0x40d7('0x21')]],'as':_0x1e6f08['as'],'attributes':_0x1e6f08['attributes'],'include':_0x1e6f08['include']?_[_0x40d7('0x20')](_0x1e6f08[_0x40d7('0x1f')],function(_0x4902a1){return{'model':db[_0x4902a1['model']],'as':_0x4902a1['as'],'attributes':_0x4902a1['attributes'],'include':_0x4902a1[_0x40d7('0x1f')]?_['map'](_0x4902a1[_0x40d7('0x1f')],function(_0x56b17c){return{'model':db[_0x56b17c[_0x40d7('0x21')]],'as':_0x56b17c['as'],'attributes':_0x56b17c[_0x40d7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x40d7('0xe')](function(_0x2e4ccb){logger[_0x40d7('0xf')]('ShowChatQueue',_0x4a2bc2);logger[_0x40d7('0x11')](_0x40d7('0x22'),_0x4a2bc2,JSON[_0x40d7('0x14')](_0x2e4ccb));_0x5af456(_0x2e4ccb);})[_0x40d7('0x18')](function(_0x21a675){logger['error']('ShowChatQueue',_0x21a675['message'],_0x4a2bc2);_0x22edd1(_0x23e560[_0x40d7('0x15')](0x1f4,_0x21a675['message']));});});}; \ No newline at end of file +var _0x2cf5=['model','stringify','catch','find','ShowChatQueue','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetChatQueue','ChatQueue','findAll','raw','options','where','attributes','limit','include','map'];(function(_0x7ec7b4,_0x1c8b0e){var _0x307680=function(_0x100a2c){while(--_0x100a2c){_0x7ec7b4['push'](_0x7ec7b4['shift']());}};_0x307680(++_0x1c8b0e);}(_0x2cf5,0x19f));var _0x52cf=function(_0x170b9c,_0x532a97){_0x170b9c=_0x170b9c-0x0;var _0x4d111d=_0x2cf5[_0x170b9c];return _0x4d111d;};'use strict';var _=require(_0x52cf('0x0'));var util=require(_0x52cf('0x1'));var moment=require('moment');var BPromise=require(_0x52cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52cf('0x3'));var db=require(_0x52cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x52cf('0x5'));var config=require(_0x52cf('0x6'));var jayson=require(_0x52cf('0x7'));var client=jayson[_0x52cf('0x8')][_0x52cf('0x9')]({'port':0x232a});config[_0x52cf('0xa')]=_[_0x52cf('0xb')](config[_0x52cf('0xa')],{'host':_0x52cf('0xc'),'port':0x18eb});var socket=require(_0x52cf('0xd'))(new Redis(config[_0x52cf('0xa')]));require('./chatQueue.socket')[_0x52cf('0xe')](socket);function respondWithRpcPromise(_0x201710,_0x2b9974,_0x120dab){return new BPromise(function(_0x4e5b19,_0xadb2a6){return client[_0x52cf('0xf')](_0x201710,_0x120dab)[_0x52cf('0x10')](function(_0x54806d){logger[_0x52cf('0x11')](_0x52cf('0x12'),_0x2b9974,_0x52cf('0x13'));logger[_0x52cf('0x14')](_0x52cf('0x15'),_0x2b9974,_0x52cf('0x13'),JSON['stringify'](_0x54806d));if(_0x54806d['error']){if(_0x54806d[_0x52cf('0x16')][_0x52cf('0x17')]===0x1f4){logger[_0x52cf('0x16')](_0x52cf('0x12'),_0x2b9974,_0x54806d[_0x52cf('0x16')][_0x52cf('0x18')]);return _0xadb2a6(_0x54806d[_0x52cf('0x16')][_0x52cf('0x18')]);}logger['error'](_0x52cf('0x12'),_0x2b9974,_0x54806d[_0x52cf('0x16')][_0x52cf('0x18')]);return _0x4e5b19(_0x54806d['error'][_0x52cf('0x18')]);}else{logger['info'](_0x52cf('0x12'),_0x2b9974,_0x52cf('0x13'));_0x4e5b19(_0x54806d[_0x52cf('0x19')][_0x52cf('0x18')]);}})['catch'](function(_0x229595){logger[_0x52cf('0x16')](_0x52cf('0x12'),_0x2b9974,_0x229595);_0xadb2a6(_0x229595);});});}exports[_0x52cf('0x1a')]=function(_0x4ab08f){var _0x326311=this;return new Promise(function(_0x5f5200,_0x1d9fdd){return db[_0x52cf('0x1b')][_0x52cf('0x1c')]({'raw':_0x4ab08f['options']?_0x4ab08f['options'][_0x52cf('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ab08f[_0x52cf('0x1e')]?_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x1f')]||null:null,'attributes':_0x4ab08f[_0x52cf('0x1e')]?_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x20')]||null:null,'limit':_0x4ab08f[_0x52cf('0x1e')]?_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x21')]||null:null,'include':_0x4ab08f['options']?_0x4ab08f['options'][_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x22')],function(_0x499ac7){return{'model':db[_0x499ac7['model']],'as':_0x499ac7['as'],'attributes':_0x499ac7[_0x52cf('0x20')],'include':_0x499ac7[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x499ac7[_0x52cf('0x22')],function(_0x42132c){return{'model':db[_0x42132c[_0x52cf('0x24')]],'as':_0x42132c['as'],'attributes':_0x42132c[_0x52cf('0x20')],'include':_0x42132c[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x42132c['include'],function(_0x4796b5){return{'model':db[_0x4796b5[_0x52cf('0x24')]],'as':_0x4796b5['as'],'attributes':_0x4796b5[_0x52cf('0x20')]};}):[]};}):[]};}):[]:[]})[_0x52cf('0x10')](function(_0x1e1318){logger['info'](_0x52cf('0x1a'),_0x4ab08f);logger[_0x52cf('0x14')](_0x52cf('0x1a'),_0x4ab08f,JSON[_0x52cf('0x25')](_0x1e1318));_0x5f5200(_0x1e1318);})[_0x52cf('0x26')](function(_0x1ed92a){logger['error'](_0x52cf('0x1a'),_0x1ed92a[_0x52cf('0x18')],_0x4ab08f);_0x1d9fdd(_0x326311[_0x52cf('0x16')](0x1f4,_0x1ed92a[_0x52cf('0x18')]));});});};exports['ShowChatQueue']=function(_0x1c6bc2){var _0xcffed3=this;return new Promise(function(_0x46eca4,_0x141871){return db[_0x52cf('0x1b')][_0x52cf('0x27')]({'raw':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2[_0x52cf('0x1e')][_0x52cf('0x1d')]===undefined?!![]:![]:!![],'where':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2['options']['where']||null:null,'attributes':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2[_0x52cf('0x1e')][_0x52cf('0x20')]||null:null,'include':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2['options']['include']?_[_0x52cf('0x23')](_0x1c6bc2[_0x52cf('0x1e')][_0x52cf('0x22')],function(_0xafd307){return{'model':db[_0xafd307[_0x52cf('0x24')]],'as':_0xafd307['as'],'attributes':_0xafd307[_0x52cf('0x20')],'include':_0xafd307[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0xafd307[_0x52cf('0x22')],function(_0x163181){return{'model':db[_0x163181[_0x52cf('0x24')]],'as':_0x163181['as'],'attributes':_0x163181[_0x52cf('0x20')],'include':_0x163181[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x163181[_0x52cf('0x22')],function(_0x50d881){return{'model':db[_0x50d881[_0x52cf('0x24')]],'as':_0x50d881['as'],'attributes':_0x50d881[_0x52cf('0x20')]};}):[]};}):[]};}):[]:[]})[_0x52cf('0x10')](function(_0x2f9a0a){logger[_0x52cf('0x11')](_0x52cf('0x28'),_0x1c6bc2);logger[_0x52cf('0x14')]('ShowChatQueue',_0x1c6bc2,JSON[_0x52cf('0x25')](_0x2f9a0a));_0x46eca4(_0x2f9a0a);})[_0x52cf('0x26')](function(_0x5e56cc){logger['error'](_0x52cf('0x28'),_0x5e56cc['message'],_0x1c6bc2);_0x141871(_0xcffed3['error'](0x1f4,_0x5e56cc[_0x52cf('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 122f429..f89fc33 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 _0xcb99=['chatQueue:','./chatQueue.events','remove','emit','removeListener','length'];(function(_0x747115,_0x570320){var _0x1d8acf=function(_0x5f3087){while(--_0x5f3087){_0x747115['push'](_0x747115['shift']());}};_0x1d8acf(++_0x570320);}(_0xcb99,0x8b));var _0x9cb9=function(_0x1440d9,_0x4a2c7e){_0x1440d9=_0x1440d9-0x0;var _0x4a0cfb=_0xcb99[_0x1440d9];return _0x4a0cfb;};'use strict';var ChatQueueEvents=require(_0x9cb9('0x0'));var events=['save',_0x9cb9('0x1'),'update'];function createListener(_0x480364,_0x3a2f21){return function(_0x1308a8){_0x3a2f21[_0x9cb9('0x2')](_0x480364,_0x1308a8);};}function removeListener(_0x51f2ee,_0x167735){return function(){ChatQueueEvents[_0x9cb9('0x3')](_0x51f2ee,_0x167735);};}exports['register']=function(_0x214b72){for(var _0x509cfc=0x0,_0x2ed26a=events[_0x9cb9('0x4')];_0x509cfc<_0x2ed26a;_0x509cfc++){var _0x1bf9b7=events[_0x509cfc];var _0x1dd62f=createListener(_0x9cb9('0x5')+_0x1bf9b7,_0x214b72);ChatQueueEvents['on'](_0x1bf9b7,_0x1dd62f);}}; \ No newline at end of file +var _0xfd28=['emit','removeListener','register','chatQueue:','save','remove'];(function(_0x7f3a0f,_0x163bbf){var _0x4ff4e9=function(_0x27c49f){while(--_0x27c49f){_0x7f3a0f['push'](_0x7f3a0f['shift']());}};_0x4ff4e9(++_0x163bbf);}(_0xfd28,0x148));var _0x8fd2=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xfd28[_0x9c2427];return _0x51984f;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8fd2('0x0'),_0x8fd2('0x1'),'update'];function createListener(_0x56f4d0,_0x4e5c5e){return function(_0x37baf5){_0x4e5c5e[_0x8fd2('0x2')](_0x56f4d0,_0x37baf5);};}function removeListener(_0x4e2108,_0x4b22ae){return function(){ChatQueueEvents[_0x8fd2('0x3')](_0x4e2108,_0x4b22ae);};}exports[_0x8fd2('0x4')]=function(_0x2ee87e){for(var _0x36178a=0x0,_0x2f0afc=events['length'];_0x36178a<_0x2f0afc;_0x36178a++){var _0x53d938=events[_0x36178a];var _0x10fccf=createListener(_0x8fd2('0x5')+_0x53d938,_0x2ee87e);ChatQueueEvents['on'](_0x53d938,_0x10fccf);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index f86c2ce..c2f9c2d 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x4af72f,_0xd67b2e){var _0x5a25e4=function(_0x3f7724){while(--_0x3f7724){_0x4af72f['push'](_0x4af72f['shift']());}};_0x5a25e4(++_0xd67b2e);}(_0x55ca,0x126));var _0xa55c=function(_0x57a9e5,_0x5009df){_0x57a9e5=_0x57a9e5-0x0;var _0x36d39e=_0x55ca[_0x57a9e5];return _0x36d39e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x5c3505,_0x3770ce){var _0x5eec90=function(_0x34157c){while(--_0x34157c){_0x5c3505['push'](_0x5c3505['shift']());}};_0x5eec90(++_0x3770ce);}(_0xe14b,0x93));var _0xbe14=function(_0x2c588c,_0x1f0d55){_0x2c588c=_0x2c588c-0x0;var _0x25f6a6=_0xe14b[_0x2c588c];return _0x25f6a6;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 2971427..549b180 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 _0x5a47=['moment','exports','STRING','DATE'];(function(_0x15961d,_0x13827d){var _0x2519ab=function(_0x24dd53){while(--_0x24dd53){_0x15961d['push'](_0x15961d['shift']());}};_0x2519ab(++_0x13827d);}(_0x5a47,0x12c));var _0x75a4=function(_0x12de66,_0x357deb){_0x12de66=_0x12de66-0x0;var _0x2465d7=_0x5a47[_0x12de66];return _0x2465d7;};'use strict';var moment=require(_0x75a4('0x0'));var Sequelize=require('sequelize');module[_0x75a4('0x1')]={'uniqueid':{'type':Sequelize[_0x75a4('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x75a4('0x3')]},'leaveAt':{'type':Sequelize[_0x75a4('0x3')]},'acceptAt':{'type':Sequelize[_0x75a4('0x3')]},'exitAt':{'type':Sequelize[_0x75a4('0x3')]},'reason':{'type':Sequelize[_0x75a4('0x2')]}}; \ No newline at end of file +var _0xf2f5=['DATE','sequelize','STRING'];(function(_0x146b09,_0x345cd3){var _0x4e9e36=function(_0x1d9749){while(--_0x1d9749){_0x146b09['push'](_0x146b09['shift']());}};_0x4e9e36(++_0x345cd3);}(_0xf2f5,0x8e));var _0x5f2f=function(_0x3112ac,_0x4d5efd){_0x3112ac=_0x3112ac-0x0;var _0x343812=_0xf2f5[_0x3112ac];return _0x343812;};'use strict';var moment=require('moment');var Sequelize=require(_0x5f2f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5f2f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x5f2f('0x1')]},'joinAt':{'type':Sequelize[_0x5f2f('0x2')]},'leaveAt':{'type':Sequelize[_0x5f2f('0x2')]},'acceptAt':{'type':Sequelize[_0x5f2f('0x2')]},'exitAt':{'type':Sequelize[_0x5f2f('0x2')]},'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 e16bb3c..a30ef59 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 _0xcd0e=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','destroy','end','error','stack','name','index','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','params','length','options','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3ef5e5,_0x5bbc62){var _0x212d0a=function(_0x18d566){while(--_0x18d566){_0x3ef5e5['push'](_0x3ef5e5['shift']());}};_0x212d0a(++_0x5bbc62);}(_0xcd0e,0xe9));var _0xecd0=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xcd0e[_0x24259d];return _0x5a701;};'use strict';var emlformat=require(_0xecd0('0x0'));var rimraf=require(_0xecd0('0x1'));var zipdir=require(_0xecd0('0x2'));var jsonpatch=require(_0xecd0('0x3'));var rp=require(_0xecd0('0x4'));var moment=require(_0xecd0('0x5'));var BPromise=require(_0xecd0('0x6'));var Mustache=require(_0xecd0('0x7'));var util=require(_0xecd0('0x8'));var path=require(_0xecd0('0x9'));var sox=require(_0xecd0('0xa'));var csv=require(_0xecd0('0xb'));var ejs=require(_0xecd0('0xc'));var fs=require('fs');var fs_extra=require(_0xecd0('0xd'));var _=require(_0xecd0('0xe'));var squel=require(_0xecd0('0xf'));var crypto=require(_0xecd0('0x10'));var jsforce=require(_0xecd0('0x11'));var deskjs=require(_0xecd0('0x12'));var toCsv=require('to-csv');var querystring=require(_0xecd0('0x13'));var Papa=require(_0xecd0('0x14'));var Redis=require(_0xecd0('0x15'));var authService=require(_0xecd0('0x16'));var qs=require(_0xecd0('0x17'));var as=require(_0xecd0('0x18'));var hardwareService=require(_0xecd0('0x19'));var logger=require(_0xecd0('0x1a'))(_0xecd0('0x1b'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xecd0('0x1c'))['db'];function respondWithStatusCode(_0x33af86,_0x241974){_0x241974=_0x241974||0xcc;return function(_0x3bccd2){if(_0x3bccd2){return _0x33af86[_0xecd0('0x1d')](_0x241974);}return _0x33af86[_0xecd0('0x1e')](_0x241974)['end']();};}function respondWithResult(_0x595dd8,_0x35b69b){_0x35b69b=_0x35b69b||0xc8;return function(_0xe13b00){if(_0xe13b00){return _0x595dd8['status'](_0x35b69b)[_0xecd0('0x1f')](_0xe13b00);}};}function respondWithFilteredResult(_0x45184c,_0x4b96d8){return function(_0x51d3bd){if(_0x51d3bd){var _0x118746=typeof _0x4b96d8['offset']===_0xecd0('0x20')&&typeof _0x4b96d8[_0xecd0('0x21')]==='undefined';var _0x367c38=_0x51d3bd[_0xecd0('0x22')];var _0x291300=_0x118746?0x0:_0x4b96d8['offset'];var _0x1b0054=_0x118746?_0x51d3bd[_0xecd0('0x22')]:_0x4b96d8[_0xecd0('0x23')]+_0x4b96d8['limit'];var _0x22a703;if(_0x1b0054>=_0x367c38){_0x1b0054=_0x367c38;_0x22a703=0xc8;}else{_0x22a703=0xce;}_0x45184c[_0xecd0('0x1e')](_0x22a703);return _0x45184c['set'](_0xecd0('0x24'),_0x291300+'-'+_0x1b0054+'/'+_0x367c38)[_0xecd0('0x1f')](_0x51d3bd);}return null;};}function patchUpdates(_0x51ec16){return function(_0x409e0b){try{jsonpatch[_0xecd0('0x25')](_0x409e0b,_0x51ec16,!![]);}catch(_0x4a488c){return BPromise['reject'](_0x4a488c);}return _0x409e0b[_0xecd0('0x26')]();};}function saveUpdates(_0x48fb4c,_0x26ea52){return function(_0x5c0153){if(_0x5c0153){return _0x5c0153['update'](_0x48fb4c)['then'](function(_0x355846){return _0x355846;});}return null;};}function removeEntity(_0x5b0183,_0x25d9e9){return function(_0x4ce453){if(_0x4ce453){return _0x4ce453[_0xecd0('0x27')]()['then'](function(){_0x5b0183['status'](0xcc)[_0xecd0('0x28')]();});}};}function handleEntityNotFound(_0x4f00c9,_0x3625a4){return function(_0x918e){if(!_0x918e){_0x4f00c9[_0xecd0('0x1d')](0x194);}return _0x918e;};}function handleError(_0x133ecd,_0x3b2f14){_0x3b2f14=_0x3b2f14||0x1f4;return function(_0x482321){logger[_0xecd0('0x29')](_0x482321[_0xecd0('0x2a')]);if(_0x482321[_0xecd0('0x2b')]){delete _0x482321[_0xecd0('0x2b')];}_0x133ecd[_0xecd0('0x1e')](_0x3b2f14)['send'](_0x482321);};}exports[_0xecd0('0x2c')]=function(_0x4c0dcb,_0x4374a5){var _0x45fc62={},_0x2a99a2={},_0x22efb3={'count':0x0,'rows':[]};var _0x511ef2=_['map'](db[_0xecd0('0x2d')][_0xecd0('0x2e')],function(_0x1dbfdf){return{'name':_0x1dbfdf[_0xecd0('0x2f')],'type':_0x1dbfdf[_0xecd0('0x30')]['key']};});_0x2a99a2[_0xecd0('0x31')]=_['map'](_0x511ef2,_0xecd0('0x2b'));_0x2a99a2[_0xecd0('0x32')]=_[_0xecd0('0x33')](_0x4c0dcb[_0xecd0('0x32')]);_0x2a99a2['filters']=_[_0xecd0('0x34')](_0x2a99a2[_0xecd0('0x31')],_0x2a99a2[_0xecd0('0x32')]);_0x45fc62[_0xecd0('0x35')]=_[_0xecd0('0x34')](_0x2a99a2[_0xecd0('0x31')],qs[_0xecd0('0x36')](_0x4c0dcb['query'][_0xecd0('0x36')]));_0x45fc62[_0xecd0('0x35')]=_0x45fc62[_0xecd0('0x35')]['length']?_0x45fc62['attributes']:_0x2a99a2[_0xecd0('0x31')];if(!_0x4c0dcb[_0xecd0('0x32')][_0xecd0('0x37')](_0xecd0('0x38'))){_0x45fc62[_0xecd0('0x21')]=qs[_0xecd0('0x21')](_0x4c0dcb[_0xecd0('0x32')][_0xecd0('0x21')]);_0x45fc62[_0xecd0('0x23')]=qs['offset'](_0x4c0dcb['query'][_0xecd0('0x23')]);}_0x45fc62[_0xecd0('0x39')]=qs[_0xecd0('0x3a')](_0x4c0dcb['query'][_0xecd0('0x3a')]);_0x45fc62[_0xecd0('0x3b')]=qs[_0xecd0('0x3c')](_[_0xecd0('0x3d')](_0x4c0dcb[_0xecd0('0x32')],_0x2a99a2[_0xecd0('0x3c')]),_0x511ef2);if(_0x4c0dcb['query']['filter']){_0x45fc62[_0xecd0('0x3b')]=_[_0xecd0('0x3e')](_0x45fc62[_0xecd0('0x3b')],{'$or':_['map'](_0x511ef2,function(_0x58b2a0){if(_0x58b2a0[_0xecd0('0x30')]!==_0xecd0('0x3f')){var _0x30728d={};_0x30728d[_0x58b2a0[_0xecd0('0x2b')]]={'$like':'%'+_0x4c0dcb[_0xecd0('0x32')][_0xecd0('0x40')]+'%'};return _0x30728d;}})});}_0x45fc62=_['merge']({},_0x45fc62,_0x4c0dcb['options']);var _0xed68aa={'where':_0x45fc62[_0xecd0('0x3b')]};return db['ChatQueueReport'][_0xecd0('0x22')](_0xed68aa)[_0xecd0('0x41')](function(_0x3a4fb5){_0x22efb3['count']=_0x3a4fb5;if(_0x4c0dcb[_0xecd0('0x32')][_0xecd0('0x42')]){_0x45fc62[_0xecd0('0x43')]=[{'all':!![]}];}return db[_0xecd0('0x2d')][_0xecd0('0x44')](_0x45fc62);})[_0xecd0('0x41')](function(_0xfc1eee){_0x22efb3[_0xecd0('0x45')]=_0xfc1eee;return _0x22efb3;})[_0xecd0('0x41')](respondWithFilteredResult(_0x4374a5,_0x45fc62))['catch'](handleError(_0x4374a5,null));};exports['show']=function(_0x5cab5e,_0xaa5340){var _0x94e9dd={'raw':!![],'where':{'id':_0x5cab5e[_0xecd0('0x46')]['id']}},_0x3b08ca={};_0x3b08ca['model']=_['keys'](db[_0xecd0('0x2d')][_0xecd0('0x2e')]);_0x3b08ca[_0xecd0('0x32')]=_[_0xecd0('0x33')](_0x5cab5e[_0xecd0('0x32')]);_0x3b08ca['filters']=_['intersection'](_0x3b08ca['model'],_0x3b08ca[_0xecd0('0x32')]);_0x94e9dd['attributes']=_[_0xecd0('0x34')](_0x3b08ca[_0xecd0('0x31')],qs[_0xecd0('0x36')](_0x5cab5e['query'][_0xecd0('0x36')]));_0x94e9dd['attributes']=_0x94e9dd['attributes'][_0xecd0('0x47')]?_0x94e9dd[_0xecd0('0x35')]:_0x3b08ca[_0xecd0('0x31')];if(_0x5cab5e[_0xecd0('0x32')][_0xecd0('0x42')]){_0x94e9dd[_0xecd0('0x43')]=[{'all':!![]}];}_0x94e9dd=_[_0xecd0('0x3e')]({},_0x94e9dd,_0x5cab5e[_0xecd0('0x48')]);return db[_0xecd0('0x2d')]['find'](_0x94e9dd)[_0xecd0('0x41')](handleEntityNotFound(_0xaa5340,null))['then'](respondWithResult(_0xaa5340,null))[_0xecd0('0x49')](handleError(_0xaa5340,null));};exports[_0xecd0('0x4a')]=function(_0x496e2b,_0x563b3c){return db[_0xecd0('0x2d')][_0xecd0('0x4a')](_0x496e2b[_0xecd0('0x4b')],{})['then'](respondWithResult(_0x563b3c,0xc9))[_0xecd0('0x49')](handleError(_0x563b3c,null));};exports[_0xecd0('0x4c')]=function(_0x565829,_0x54de11){if(_0x565829[_0xecd0('0x4b')]['id']){delete _0x565829[_0xecd0('0x4b')]['id'];}return db[_0xecd0('0x2d')][_0xecd0('0x4d')]({'where':{'id':_0x565829[_0xecd0('0x46')]['id']}})[_0xecd0('0x41')](handleEntityNotFound(_0x54de11,null))[_0xecd0('0x41')](saveUpdates(_0x565829['body'],null))[_0xecd0('0x41')](respondWithResult(_0x54de11,null))[_0xecd0('0x49')](handleError(_0x54de11,null));};exports[_0xecd0('0x27')]=function(_0x1806cf,_0x3aef3e){return db['ChatQueueReport'][_0xecd0('0x4d')]({'where':{'id':_0x1806cf[_0xecd0('0x46')]['id']}})[_0xecd0('0x41')](handleEntityNotFound(_0x3aef3e,null))['then'](removeEntity(_0x3aef3e,null))[_0xecd0('0x49')](handleError(_0x3aef3e,null));};exports[_0xecd0('0x4e')]=function(_0x495b6d,_0x39cc8e){return db['ChatQueueReport'][_0xecd0('0x4e')]()[_0xecd0('0x41')](respondWithResult(_0x39cc8e,null))[_0xecd0('0x49')](handleError(_0x39cc8e,null));}; \ No newline at end of file +var _0xb3d8=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','ChatQueueReport','fieldName','type','key','name','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2402ce,_0xa8ef8f){var _0x3434ef=function(_0x1028f2){while(--_0x1028f2){_0x2402ce['push'](_0x2402ce['shift']());}};_0x3434ef(++_0xa8ef8f);}(_0xb3d8,0xdc));var _0x8b3d=function(_0xb75c06,_0x344d72){_0xb75c06=_0xb75c06-0x0;var _0x5a84ba=_0xb3d8[_0xb75c06];return _0x5a84ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b3d('0x0'));var zipdir=require(_0x8b3d('0x1'));var jsonpatch=require(_0x8b3d('0x2'));var rp=require(_0x8b3d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8b3d('0x4'));var util=require(_0x8b3d('0x5'));var path=require(_0x8b3d('0x6'));var sox=require(_0x8b3d('0x7'));var csv=require(_0x8b3d('0x8'));var ejs=require(_0x8b3d('0x9'));var fs=require('fs');var fs_extra=require(_0x8b3d('0xa'));var _=require(_0x8b3d('0xb'));var squel=require(_0x8b3d('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b3d('0xd'));var deskjs=require(_0x8b3d('0xe'));var toCsv=require(_0x8b3d('0x8'));var querystring=require(_0x8b3d('0xf'));var Papa=require(_0x8b3d('0x10'));var Redis=require(_0x8b3d('0x11'));var authService=require(_0x8b3d('0x12'));var qs=require(_0x8b3d('0x13'));var as=require(_0x8b3d('0x14'));var hardwareService=require(_0x8b3d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x8b3d('0x16'));var config=require(_0x8b3d('0x17'));var licenseUtil=require(_0x8b3d('0x18'));var db=require(_0x8b3d('0x19'))['db'];function respondWithStatusCode(_0x16e1fb,_0x1fa985){_0x1fa985=_0x1fa985||0xcc;return function(_0x63293){if(_0x63293){return _0x16e1fb[_0x8b3d('0x1a')](_0x1fa985);}return _0x16e1fb[_0x8b3d('0x1b')](_0x1fa985)[_0x8b3d('0x1c')]();};}function respondWithResult(_0x984b9a,_0x3f03ee){_0x3f03ee=_0x3f03ee||0xc8;return function(_0xb0a303){if(_0xb0a303){return _0x984b9a[_0x8b3d('0x1b')](_0x3f03ee)[_0x8b3d('0x1d')](_0xb0a303);}};}function respondWithFilteredResult(_0x14611e,_0x4fc552){return function(_0x2c624d){if(_0x2c624d){var _0x381c0d=typeof _0x4fc552['offset']===_0x8b3d('0x1e')&&typeof _0x4fc552[_0x8b3d('0x1f')]==='undefined';var _0xb493ac=_0x2c624d[_0x8b3d('0x20')];var _0xcc9b46=_0x381c0d?0x0:_0x4fc552[_0x8b3d('0x21')];var _0x1d96ae=_0x381c0d?_0x2c624d['count']:_0x4fc552['offset']+_0x4fc552[_0x8b3d('0x1f')];var _0x4f1b21;if(_0x1d96ae>=_0xb493ac){_0x1d96ae=_0xb493ac;_0x4f1b21=0xc8;}else{_0x4f1b21=0xce;}_0x14611e['status'](_0x4f1b21);return _0x14611e['set'](_0x8b3d('0x22'),_0xcc9b46+'-'+_0x1d96ae+'/'+_0xb493ac)[_0x8b3d('0x1d')](_0x2c624d);}return null;};}function patchUpdates(_0x4867e4){return function(_0x45c245){try{jsonpatch[_0x8b3d('0x23')](_0x45c245,_0x4867e4,!![]);}catch(_0xff346c){return BPromise[_0x8b3d('0x24')](_0xff346c);}return _0x45c245[_0x8b3d('0x25')]();};}function saveUpdates(_0x43a68,_0x3510f4){return function(_0x116ea4){if(_0x116ea4){return _0x116ea4[_0x8b3d('0x26')](_0x43a68)[_0x8b3d('0x27')](function(_0x338f6b){return _0x338f6b;});}return null;};}function removeEntity(_0x5462c6,_0x37c98e){return function(_0x584a71){if(_0x584a71){return _0x584a71[_0x8b3d('0x28')]()[_0x8b3d('0x27')](function(){_0x5462c6[_0x8b3d('0x1b')](0xcc)[_0x8b3d('0x1c')]();});}};}function handleEntityNotFound(_0x57fe10,_0x219ecb){return function(_0x4fc627){if(!_0x4fc627){_0x57fe10['sendStatus'](0x194);}return _0x4fc627;};}function handleError(_0x39a4bf,_0x513bb1){_0x513bb1=_0x513bb1||0x1f4;return function(_0x4eefbf){logger[_0x8b3d('0x29')](_0x4eefbf[_0x8b3d('0x2a')]);if(_0x4eefbf['name']){delete _0x4eefbf['name'];}_0x39a4bf[_0x8b3d('0x1b')](_0x513bb1)[_0x8b3d('0x2b')](_0x4eefbf);};}exports[_0x8b3d('0x2c')]=function(_0x1cab3a,_0x36f329){var _0x591a4c={},_0x261070={},_0x747446={'count':0x0,'rows':[]};var _0x1125dc=_[_0x8b3d('0x2d')](db[_0x8b3d('0x2e')]['rawAttributes'],function(_0x520a69){return{'name':_0x520a69[_0x8b3d('0x2f')],'type':_0x520a69[_0x8b3d('0x30')][_0x8b3d('0x31')]};});_0x261070['model']=_[_0x8b3d('0x2d')](_0x1125dc,_0x8b3d('0x32'));_0x261070[_0x8b3d('0x33')]=_['keys'](_0x1cab3a[_0x8b3d('0x33')]);_0x261070[_0x8b3d('0x34')]=_[_0x8b3d('0x35')](_0x261070['model'],_0x261070['query']);_0x591a4c[_0x8b3d('0x36')]=_[_0x8b3d('0x35')](_0x261070[_0x8b3d('0x37')],qs[_0x8b3d('0x38')](_0x1cab3a[_0x8b3d('0x33')][_0x8b3d('0x38')]));_0x591a4c[_0x8b3d('0x36')]=_0x591a4c['attributes'][_0x8b3d('0x39')]?_0x591a4c[_0x8b3d('0x36')]:_0x261070[_0x8b3d('0x37')];if(!_0x1cab3a[_0x8b3d('0x33')][_0x8b3d('0x3a')](_0x8b3d('0x3b'))){_0x591a4c[_0x8b3d('0x1f')]=qs[_0x8b3d('0x1f')](_0x1cab3a[_0x8b3d('0x33')][_0x8b3d('0x1f')]);_0x591a4c[_0x8b3d('0x21')]=qs[_0x8b3d('0x21')](_0x1cab3a[_0x8b3d('0x33')][_0x8b3d('0x21')]);}_0x591a4c[_0x8b3d('0x3c')]=qs[_0x8b3d('0x3d')](_0x1cab3a[_0x8b3d('0x33')]['sort']);_0x591a4c['where']=qs[_0x8b3d('0x34')](_['pick'](_0x1cab3a[_0x8b3d('0x33')],_0x261070[_0x8b3d('0x34')]),_0x1125dc);if(_0x1cab3a[_0x8b3d('0x33')]['filter']){_0x591a4c['where']=_[_0x8b3d('0x3e')](_0x591a4c[_0x8b3d('0x3f')],{'$or':_[_0x8b3d('0x2d')](_0x1125dc,function(_0x4b8fef){if(_0x4b8fef['type']!=='VIRTUAL'){var _0xbb0ca9={};_0xbb0ca9[_0x4b8fef[_0x8b3d('0x32')]]={'$like':'%'+_0x1cab3a['query']['filter']+'%'};return _0xbb0ca9;}})});}_0x591a4c=_['merge']({},_0x591a4c,_0x1cab3a[_0x8b3d('0x40')]);var _0x56a690={'where':_0x591a4c[_0x8b3d('0x3f')]};return db[_0x8b3d('0x2e')][_0x8b3d('0x20')](_0x56a690)[_0x8b3d('0x27')](function(_0x328b0c){_0x747446[_0x8b3d('0x20')]=_0x328b0c;if(_0x1cab3a[_0x8b3d('0x33')][_0x8b3d('0x41')]){_0x591a4c[_0x8b3d('0x42')]=[{'all':!![]}];}return db[_0x8b3d('0x2e')][_0x8b3d('0x43')](_0x591a4c);})[_0x8b3d('0x27')](function(_0x42790b){_0x747446[_0x8b3d('0x44')]=_0x42790b;return _0x747446;})[_0x8b3d('0x27')](respondWithFilteredResult(_0x36f329,_0x591a4c))[_0x8b3d('0x45')](handleError(_0x36f329,null));};exports[_0x8b3d('0x46')]=function(_0x26d01a,_0x45c73e){var _0x4b5ac6={'raw':!![],'where':{'id':_0x26d01a['params']['id']}},_0x2d2c5e={};_0x2d2c5e[_0x8b3d('0x37')]=_['keys'](db[_0x8b3d('0x2e')]['rawAttributes']);_0x2d2c5e[_0x8b3d('0x33')]=_[_0x8b3d('0x47')](_0x26d01a[_0x8b3d('0x33')]);_0x2d2c5e[_0x8b3d('0x34')]=_[_0x8b3d('0x35')](_0x2d2c5e[_0x8b3d('0x37')],_0x2d2c5e[_0x8b3d('0x33')]);_0x4b5ac6[_0x8b3d('0x36')]=_['intersection'](_0x2d2c5e[_0x8b3d('0x37')],qs[_0x8b3d('0x38')](_0x26d01a['query'][_0x8b3d('0x38')]));_0x4b5ac6[_0x8b3d('0x36')]=_0x4b5ac6[_0x8b3d('0x36')][_0x8b3d('0x39')]?_0x4b5ac6[_0x8b3d('0x36')]:_0x2d2c5e[_0x8b3d('0x37')];if(_0x26d01a[_0x8b3d('0x33')][_0x8b3d('0x41')]){_0x4b5ac6[_0x8b3d('0x42')]=[{'all':!![]}];}_0x4b5ac6=_[_0x8b3d('0x3e')]({},_0x4b5ac6,_0x26d01a['options']);return db[_0x8b3d('0x2e')]['find'](_0x4b5ac6)[_0x8b3d('0x27')](handleEntityNotFound(_0x45c73e,null))[_0x8b3d('0x27')](respondWithResult(_0x45c73e,null))[_0x8b3d('0x45')](handleError(_0x45c73e,null));};exports[_0x8b3d('0x48')]=function(_0x33507f,_0x52ecc6){return db[_0x8b3d('0x2e')][_0x8b3d('0x48')](_0x33507f[_0x8b3d('0x49')],{})[_0x8b3d('0x27')](respondWithResult(_0x52ecc6,0xc9))['catch'](handleError(_0x52ecc6,null));};exports[_0x8b3d('0x26')]=function(_0x4a49d6,_0x5d94e7){if(_0x4a49d6[_0x8b3d('0x49')]['id']){delete _0x4a49d6[_0x8b3d('0x49')]['id'];}return db[_0x8b3d('0x2e')][_0x8b3d('0x4a')]({'where':{'id':_0x4a49d6['params']['id']}})[_0x8b3d('0x27')](handleEntityNotFound(_0x5d94e7,null))[_0x8b3d('0x27')](saveUpdates(_0x4a49d6['body'],null))[_0x8b3d('0x27')](respondWithResult(_0x5d94e7,null))[_0x8b3d('0x45')](handleError(_0x5d94e7,null));};exports[_0x8b3d('0x28')]=function(_0x455623,_0x2bb19a){return db[_0x8b3d('0x2e')][_0x8b3d('0x4a')]({'where':{'id':_0x455623[_0x8b3d('0x4b')]['id']}})[_0x8b3d('0x27')](handleEntityNotFound(_0x2bb19a,null))[_0x8b3d('0x27')](removeEntity(_0x2bb19a,null))['catch'](handleError(_0x2bb19a,null));};exports[_0x8b3d('0x4c')]=function(_0x5e1353,_0x262e5d){return db['ChatQueueReport'][_0x8b3d('0x4c')]()[_0x8b3d('0x27')](respondWithResult(_0x262e5d,null))[_0x8b3d('0x45')](handleError(_0x262e5d,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b34f1f0..0057bbc 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(_0x5a6669,_0x417479){var _0x543d49=function(_0x1f72ad){while(--_0x1f72ad){_0x5a6669['push'](_0x5a6669['shift']());}};_0x543d49(++_0x417479);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x3e775f,_0x3b55d1){var _0x5f3b28=function(_0x51a351){while(--_0x51a351){_0x3e775f['push'](_0x3e775f['shift']());}};_0x5f3b28(++_0x3b55d1);}(_0x757a,0xde));var _0xa757=function(_0x42e243,_0x132f93){_0x42e243=_0x42e243-0x0;var _0x18261b=_0x757a[_0x42e243];return _0x18261b;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 760eb31..7426160 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 _0xbf5a=['message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','debug','raw','where','attributes','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x21f3c2,_0x406840){var _0xf1069d=function(_0x263ccd){while(--_0x263ccd){_0x21f3c2['push'](_0x21f3c2['shift']());}};_0xf1069d(++_0x406840);}(_0xbf5a,0x16c));var _0xabf5=function(_0x5e4f0e,_0x5a28b3){_0x5e4f0e=_0x5e4f0e-0x0;var _0x4f18a2=_0xbf5a[_0x5e4f0e];return _0x4f18a2;};'use strict';var _=require(_0xabf5('0x0'));var util=require('util');var moment=require(_0xabf5('0x1'));var BPromise=require(_0xabf5('0x2'));var rs=require(_0xabf5('0x3'));var fs=require('fs');var Redis=require(_0xabf5('0x4'));var db=require(_0xabf5('0x5'))['db'];var utils=require(_0xabf5('0x6'));var logger=require(_0xabf5('0x7'))(_0xabf5('0x8'));var config=require(_0xabf5('0x9'));var jayson=require(_0xabf5('0xa'));var client=jayson[_0xabf5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32f17d,_0x1dfe7f,_0x7152cd){return new BPromise(function(_0x12a821,_0x15f970){return client[_0xabf5('0xc')](_0x32f17d,_0x7152cd)[_0xabf5('0xd')](function(_0x56c6fd){logger[_0xabf5('0xe')](_0xabf5('0xf'),_0x1dfe7f,_0xabf5('0x10'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1dfe7f,'request\x20sent',JSON[_0xabf5('0x11')](_0x56c6fd));if(_0x56c6fd[_0xabf5('0x12')]){if(_0x56c6fd[_0xabf5('0x12')][_0xabf5('0x13')]===0x1f4){logger['error'](_0xabf5('0xf'),_0x1dfe7f,_0x56c6fd['error']['message']);return _0x15f970(_0x56c6fd[_0xabf5('0x12')]['message']);}logger[_0xabf5('0x12')](_0xabf5('0xf'),_0x1dfe7f,_0x56c6fd[_0xabf5('0x12')]['message']);return _0x12a821(_0x56c6fd[_0xabf5('0x12')][_0xabf5('0x14')]);}else{logger[_0xabf5('0xe')](_0xabf5('0xf'),_0x1dfe7f,_0xabf5('0x10'));_0x12a821(_0x56c6fd[_0xabf5('0x15')][_0xabf5('0x14')]);}})[_0xabf5('0x16')](function(_0x2e8d4e){logger[_0xabf5('0x12')](_0xabf5('0xf'),_0x1dfe7f,_0x2e8d4e);_0x15f970(_0x2e8d4e);});});}exports[_0xabf5('0x17')]=function(_0x19c4be){var _0x9f72a6=this;return new Promise(function(_0x1c7214,_0x3e5c90){return db[_0xabf5('0x18')]['create'](_0x19c4be[_0xabf5('0x19')],{'raw':_0x19c4be[_0xabf5('0x1a')]?_0x19c4be[_0xabf5('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xabf5('0xd')](function(_0x24115a){logger[_0xabf5('0xe')](_0xabf5('0x17'),_0x19c4be);logger[_0xabf5('0x1b')](_0xabf5('0x17'),_0x19c4be,JSON['stringify'](_0x24115a));_0x1c7214(_0x24115a);})['catch'](function(_0x2bc8ad){logger[_0xabf5('0x12')](_0xabf5('0x17'),_0x2bc8ad[_0xabf5('0x14')],_0x19c4be);_0x3e5c90(_0x9f72a6[_0xabf5('0x12')](0x1f4,_0x2bc8ad[_0xabf5('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x2b17d8){var _0x4f2e9e=this;return new Promise(function(_0x34878d,_0x599816){return db[_0xabf5('0x18')]['update'](_0x2b17d8['body'],{'raw':_0x2b17d8[_0xabf5('0x1a')]?_0x2b17d8[_0xabf5('0x1a')][_0xabf5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b17d8['options']?_0x2b17d8[_0xabf5('0x1a')][_0xabf5('0x1d')]||null:null,'attributes':_0x2b17d8[_0xabf5('0x1a')]?_0x2b17d8['options'][_0xabf5('0x1e')]||null:null,'limit':_0x2b17d8['options']?_0x2b17d8[_0xabf5('0x1a')]['limit']||null:null})[_0xabf5('0xd')](function(_0x46c1ec){logger[_0xabf5('0xe')](_0xabf5('0x1f'),_0x2b17d8);logger[_0xabf5('0x1b')]('UpdateChatQueueReport',_0x2b17d8,JSON[_0xabf5('0x11')](_0x46c1ec));_0x34878d(_0x46c1ec);})[_0xabf5('0x16')](function(_0x18bf14){logger[_0xabf5('0x12')](_0xabf5('0x1f'),_0x18bf14['message'],_0x2b17d8);_0x599816(_0x4f2e9e['error'](0x1f4,_0x18bf14[_0xabf5('0x14')]));});});}; \ No newline at end of file +var _0x0ae2=['http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateChatQueueReport','create','body','raw','debug','stringify','ChatQueueReport','update','options','where','attributes','limit','UpdateChatQueueReport','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x0ae2,0xa5));var _0x20ae=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0x0ae2[_0x13cab0];return _0x38804f;};'use strict';var _=require(_0x20ae('0x0'));var util=require('util');var moment=require(_0x20ae('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20ae('0x2'));var db=require(_0x20ae('0x3'))['db'];var utils=require(_0x20ae('0x4'));var logger=require(_0x20ae('0x5'))(_0x20ae('0x6'));var config=require(_0x20ae('0x7'));var jayson=require(_0x20ae('0x8'));var client=jayson[_0x20ae('0x9')][_0x20ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56c9e7,_0x2ea7c4,_0x38696e){return new BPromise(function(_0x361b55,_0x13dd09){return client[_0x20ae('0xb')](_0x56c9e7,_0x38696e)[_0x20ae('0xc')](function(_0x463563){logger['info'](_0x20ae('0xd'),_0x2ea7c4,_0x20ae('0xe'));logger['debug'](_0x20ae('0xf'),_0x2ea7c4,'request\x20sent',JSON['stringify'](_0x463563));if(_0x463563[_0x20ae('0x10')]){if(_0x463563[_0x20ae('0x10')][_0x20ae('0x11')]===0x1f4){logger[_0x20ae('0x10')](_0x20ae('0xd'),_0x2ea7c4,_0x463563[_0x20ae('0x10')][_0x20ae('0x12')]);return _0x13dd09(_0x463563[_0x20ae('0x10')][_0x20ae('0x12')]);}logger[_0x20ae('0x10')](_0x20ae('0xd'),_0x2ea7c4,_0x463563[_0x20ae('0x10')]['message']);return _0x361b55(_0x463563['error'][_0x20ae('0x12')]);}else{logger[_0x20ae('0x13')](_0x20ae('0xd'),_0x2ea7c4,'request\x20sent');_0x361b55(_0x463563[_0x20ae('0x14')]['message']);}})[_0x20ae('0x15')](function(_0x156488){logger[_0x20ae('0x10')](_0x20ae('0xd'),_0x2ea7c4,_0x156488);_0x13dd09(_0x156488);});});}exports[_0x20ae('0x16')]=function(_0x2e9b47){var _0x2682ca=this;return new Promise(function(_0x4adcb9,_0x2acfb6){return db['ChatQueueReport'][_0x20ae('0x17')](_0x2e9b47[_0x20ae('0x18')],{'raw':_0x2e9b47['options']?_0x2e9b47['options'][_0x20ae('0x19')]===undefined?!![]:![]:!![]})[_0x20ae('0xc')](function(_0x1ef2d0){logger[_0x20ae('0x13')](_0x20ae('0x16'),_0x2e9b47);logger[_0x20ae('0x1a')]('CreateChatQueueReport',_0x2e9b47,JSON[_0x20ae('0x1b')](_0x1ef2d0));_0x4adcb9(_0x1ef2d0);})[_0x20ae('0x15')](function(_0x38df75){logger['error']('CreateChatQueueReport',_0x38df75[_0x20ae('0x12')],_0x2e9b47);_0x2acfb6(_0x2682ca['error'](0x1f4,_0x38df75[_0x20ae('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x5f19bc){var _0x4e4bbe=this;return new Promise(function(_0x525972,_0x14458b){return db[_0x20ae('0x1c')][_0x20ae('0x1d')](_0x5f19bc[_0x20ae('0x18')],{'raw':_0x5f19bc['options']?_0x5f19bc[_0x20ae('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f19bc[_0x20ae('0x1e')]?_0x5f19bc['options'][_0x20ae('0x1f')]||null:null,'attributes':_0x5f19bc[_0x20ae('0x1e')]?_0x5f19bc[_0x20ae('0x1e')][_0x20ae('0x20')]||null:null,'limit':_0x5f19bc[_0x20ae('0x1e')]?_0x5f19bc[_0x20ae('0x1e')][_0x20ae('0x21')]||null:null})[_0x20ae('0xc')](function(_0x87af23){logger[_0x20ae('0x13')](_0x20ae('0x22'),_0x5f19bc);logger[_0x20ae('0x1a')]('UpdateChatQueueReport',_0x5f19bc,JSON[_0x20ae('0x1b')](_0x87af23));_0x525972(_0x87af23);})['catch'](function(_0x2bdf2b){logger[_0x20ae('0x10')]('UpdateChatQueueReport',_0x2bdf2b[_0x20ae('0x12')],_0x5f19bc);_0x14458b(_0x4e4bbe[_0x20ae('0x10')](0x1f4,_0x2bdf2b[_0x20ae('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d28e1a6..a417248 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 _0x6912=['../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3b22e9,_0x354406){var _0x230314=function(_0x29ae96){while(--_0x29ae96){_0x3b22e9['push'](_0x3b22e9['shift']());}};_0x230314(++_0x354406);}(_0x6912,0xa1));var _0x2691=function(_0x468467,_0x1dee78){_0x468467=_0x468467-0x0;var _0x488fc2=_0x6912[_0x468467];return _0x488fc2;};'use strict';var multer=require('multer');var util=require(_0x2691('0x0'));var path=require(_0x2691('0x1'));var timeout=require(_0x2691('0x2'));var express=require(_0x2691('0x3'));var router=express[_0x2691('0x4')]();var fs_extra=require(_0x2691('0x5'));var auth=require(_0x2691('0x6'));var interaction=require(_0x2691('0x7'));var config=require('../../config/environment');var controller=require(_0x2691('0x8'));router[_0x2691('0x9')]('/',auth[_0x2691('0xa')](),controller[_0x2691('0xb')]);router['get'](_0x2691('0xc'),auth[_0x2691('0xa')](),controller[_0x2691('0xd')]);router[_0x2691('0x9')](_0x2691('0xe'),auth['isAuthenticated'](),controller[_0x2691('0xf')]);router[_0x2691('0x10')]('/',auth[_0x2691('0xa')](),controller[_0x2691('0x11')]);router['put'](_0x2691('0xe'),auth[_0x2691('0xa')](),controller[_0x2691('0x12')]);router[_0x2691('0x13')](_0x2691('0xe'),auth[_0x2691('0xa')](),controller['destroy']);module[_0x2691('0x14')]=router; \ No newline at end of file +var _0x3005=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','create','put','delete','exports','path','express','Router','fs-extra'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0x3005,0x183));var _0x5300=function(_0x21d951,_0x511bd9){_0x21d951=_0x21d951-0x0;var _0x149d77=_0x3005[_0x21d951];return _0x149d77;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5300('0x0'));var timeout=require('connect-timeout');var express=require(_0x5300('0x1'));var router=express[_0x5300('0x2')]();var fs_extra=require(_0x5300('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5300('0x4'));var config=require(_0x5300('0x5'));var controller=require('./chatQueueReport.controller');router[_0x5300('0x6')]('/',auth['isAuthenticated'](),controller[_0x5300('0x7')]);router[_0x5300('0x6')](_0x5300('0x8'),auth[_0x5300('0x9')](),controller['describe']);router[_0x5300('0x6')](_0x5300('0xa'),auth[_0x5300('0x9')](),controller[_0x5300('0xb')]);router[_0x5300('0xc')]('/',auth[_0x5300('0x9')](),controller[_0x5300('0xd')]);router[_0x5300('0xe')](_0x5300('0xa'),auth[_0x5300('0x9')](),controller['update']);router[_0x5300('0xf')](_0x5300('0xa'),auth[_0x5300('0x9')](),controller['destroy']);module[_0x5300('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 95ed28f..f785f3f 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4617a5,_0x582345){var _0x2629f9=function(_0x56543c){while(--_0x56543c){_0x4617a5['push'](_0x4617a5['shift']());}};_0x2629f9(++_0x582345);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2bbba5,_0x24e84b){_0x2bbba5=_0x2bbba5-0x0;var _0x3c477c=_0xf4eb[_0x2bbba5];return _0x3c477c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x5f5cce,_0x138cc5){var _0x705ecf=function(_0x28bc5d){while(--_0x28bc5d){_0x5f5cce['push'](_0x5f5cce['shift']());}};_0x705ecf(++_0x138cc5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4d8cf0,_0x1a581f){_0x4d8cf0=_0x4d8cf0-0x0;var _0x251e52=_0xb43b[_0x4d8cf0];return _0x251e52;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 81a2fa6..3cbb711 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 _0xedf5=['sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2328f3,_0x48d111){var _0x2fc749=function(_0x43f897){while(--_0x43f897){_0x2328f3['push'](_0x2328f3['shift']());}};_0x2fc749(++_0x48d111);}(_0xedf5,0x10e));var _0x5edf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xedf5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5edf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5edf('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5edf('0x2'));var Mustache=require(_0x5edf('0x3'));var util=require('util');var path=require(_0x5edf('0x4'));var sox=require('sox');var csv=require(_0x5edf('0x5'));var ejs=require(_0x5edf('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5edf('0x7'));var squel=require(_0x5edf('0x8'));var crypto=require(_0x5edf('0x9'));var jsforce=require(_0x5edf('0xa'));var deskjs=require(_0x5edf('0xb'));var toCsv=require(_0x5edf('0x5'));var querystring=require('querystring');var Papa=require(_0x5edf('0xc'));var Redis=require(_0x5edf('0xd'));var authService=require(_0x5edf('0xe'));var qs=require(_0x5edf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5edf('0x10'));var logger=require(_0x5edf('0x11'))('api');var utils=require(_0x5edf('0x12'));var config=require(_0x5edf('0x13'));var licenseUtil=require(_0x5edf('0x14'));var db=require(_0x5edf('0x15'))['db'];function respondWithStatusCode(_0x22682b,_0x5ad188){_0x5ad188=_0x5ad188||0xcc;return function(_0x462d4f){if(_0x462d4f){return _0x22682b[_0x5edf('0x16')](_0x5ad188);}return _0x22682b['status'](_0x5ad188)['end']();};}function respondWithResult(_0x218d11,_0x5f2016){_0x5f2016=_0x5f2016||0xc8;return function(_0x36aa39){if(_0x36aa39){return _0x218d11[_0x5edf('0x17')](_0x5f2016)[_0x5edf('0x18')](_0x36aa39);}};}function respondWithFilteredResult(_0x98ea8b,_0x1129c6){return function(_0x56feba){if(_0x56feba){var _0x4905fa=typeof _0x1129c6['offset']===_0x5edf('0x19')&&typeof _0x1129c6[_0x5edf('0x1a')]===_0x5edf('0x19');var _0x223ee1=_0x56feba[_0x5edf('0x1b')];var _0x5f12d2=_0x4905fa?0x0:_0x1129c6[_0x5edf('0x1c')];var _0x1839e1=_0x4905fa?_0x56feba[_0x5edf('0x1b')]:_0x1129c6[_0x5edf('0x1c')]+_0x1129c6[_0x5edf('0x1a')];var _0xc20065;if(_0x1839e1>=_0x223ee1){_0x1839e1=_0x223ee1;_0xc20065=0xc8;}else{_0xc20065=0xce;}_0x98ea8b[_0x5edf('0x17')](_0xc20065);return _0x98ea8b['set'](_0x5edf('0x1d'),_0x5f12d2+'-'+_0x1839e1+'/'+_0x223ee1)[_0x5edf('0x18')](_0x56feba);}return null;};}function patchUpdates(_0x44e74c){return function(_0xbaade0){try{jsonpatch[_0x5edf('0x1e')](_0xbaade0,_0x44e74c,!![]);}catch(_0x20dade){return BPromise['reject'](_0x20dade);}return _0xbaade0[_0x5edf('0x1f')]();};}function saveUpdates(_0x347a34,_0x1679dd){return function(_0x1dee83){if(_0x1dee83){return _0x1dee83[_0x5edf('0x20')](_0x347a34)[_0x5edf('0x21')](function(_0x1a7b77){return _0x1a7b77;});}return null;};}function removeEntity(_0x312cb2,_0x4d7d79){return function(_0xced655){if(_0xced655){return _0xced655[_0x5edf('0x22')]()[_0x5edf('0x21')](function(){_0x312cb2[_0x5edf('0x17')](0xcc)[_0x5edf('0x23')]();});}};}function handleEntityNotFound(_0x240ad0,_0x891a3d){return function(_0xe3c0a9){if(!_0xe3c0a9){_0x240ad0[_0x5edf('0x16')](0x194);}return _0xe3c0a9;};}function handleError(_0x1ec19f,_0x195f5b){_0x195f5b=_0x195f5b||0x1f4;return function(_0x180893){logger['error'](_0x180893[_0x5edf('0x24')]);if(_0x180893[_0x5edf('0x25')]){delete _0x180893['name'];}_0x1ec19f['status'](_0x195f5b)[_0x5edf('0x26')](_0x180893);};}exports[_0x5edf('0x27')]=function(_0x23ee4c,_0xe765e){var _0x38a368={},_0xbe4a47={},_0x48698f={'count':0x0,'rows':[]};var _0x23c9b6=_[_0x5edf('0x28')](db[_0x5edf('0x29')][_0x5edf('0x2a')],function(_0x4bbbcf){return{'name':_0x4bbbcf[_0x5edf('0x2b')],'type':_0x4bbbcf['type'][_0x5edf('0x2c')]};});_0xbe4a47['model']=_[_0x5edf('0x28')](_0x23c9b6,_0x5edf('0x25'));_0xbe4a47[_0x5edf('0x2d')]=_[_0x5edf('0x2e')](_0x23ee4c[_0x5edf('0x2d')]);_0xbe4a47[_0x5edf('0x2f')]=_['intersection'](_0xbe4a47['model'],_0xbe4a47[_0x5edf('0x2d')]);_0x38a368[_0x5edf('0x30')]=_[_0x5edf('0x31')](_0xbe4a47[_0x5edf('0x32')],qs[_0x5edf('0x33')](_0x23ee4c[_0x5edf('0x2d')]['fields']));_0x38a368[_0x5edf('0x30')]=_0x38a368['attributes'][_0x5edf('0x34')]?_0x38a368['attributes']:_0xbe4a47[_0x5edf('0x32')];if(!_0x23ee4c['query'][_0x5edf('0x35')](_0x5edf('0x36'))){_0x38a368[_0x5edf('0x1a')]=qs['limit'](_0x23ee4c[_0x5edf('0x2d')][_0x5edf('0x1a')]);_0x38a368['offset']=qs[_0x5edf('0x1c')](_0x23ee4c[_0x5edf('0x2d')][_0x5edf('0x1c')]);}_0x38a368[_0x5edf('0x37')]=qs[_0x5edf('0x38')](_0x23ee4c[_0x5edf('0x2d')][_0x5edf('0x38')]);_0x38a368[_0x5edf('0x39')]=qs[_0x5edf('0x2f')](_['pick'](_0x23ee4c[_0x5edf('0x2d')],_0xbe4a47[_0x5edf('0x2f')]),_0x23c9b6);if(_0x23ee4c[_0x5edf('0x2d')][_0x5edf('0x3a')]){_0x38a368[_0x5edf('0x39')]=_['merge'](_0x38a368['where'],{'$or':_[_0x5edf('0x28')](_0x23c9b6,function(_0x2e4b60){if(_0x2e4b60[_0x5edf('0x3b')]!==_0x5edf('0x3c')){var _0x199d67={};_0x199d67[_0x2e4b60[_0x5edf('0x25')]]={'$like':'%'+_0x23ee4c[_0x5edf('0x2d')]['filter']+'%'};return _0x199d67;}})});}_0x38a368=_['merge']({},_0x38a368,_0x23ee4c[_0x5edf('0x3d')]);var _0x1f747e={'where':_0x38a368['where']};return db['ChatTransferReport'][_0x5edf('0x1b')](_0x1f747e)['then'](function(_0x394b52){_0x48698f['count']=_0x394b52;if(_0x23ee4c[_0x5edf('0x2d')][_0x5edf('0x3e')]){_0x38a368[_0x5edf('0x3f')]=[{'all':!![]}];}return db[_0x5edf('0x29')]['findAll'](_0x38a368);})['then'](function(_0x25e0d7){_0x48698f[_0x5edf('0x40')]=_0x25e0d7;return _0x48698f;})[_0x5edf('0x21')](respondWithFilteredResult(_0xe765e,_0x38a368))[_0x5edf('0x41')](handleError(_0xe765e,null));};exports[_0x5edf('0x42')]=function(_0xa53fd4,_0x31226b){var _0x139e6b={'raw':!![],'where':{'id':_0xa53fd4[_0x5edf('0x43')]['id']}},_0x5ce3e0={};_0x5ce3e0[_0x5edf('0x32')]=_[_0x5edf('0x2e')](db[_0x5edf('0x29')][_0x5edf('0x2a')]);_0x5ce3e0['query']=_[_0x5edf('0x2e')](_0xa53fd4['query']);_0x5ce3e0[_0x5edf('0x2f')]=_[_0x5edf('0x31')](_0x5ce3e0[_0x5edf('0x32')],_0x5ce3e0['query']);_0x139e6b['attributes']=_[_0x5edf('0x31')](_0x5ce3e0[_0x5edf('0x32')],qs[_0x5edf('0x33')](_0xa53fd4[_0x5edf('0x2d')][_0x5edf('0x33')]));_0x139e6b[_0x5edf('0x30')]=_0x139e6b[_0x5edf('0x30')][_0x5edf('0x34')]?_0x139e6b[_0x5edf('0x30')]:_0x5ce3e0[_0x5edf('0x32')];if(_0xa53fd4[_0x5edf('0x2d')][_0x5edf('0x3e')]){_0x139e6b[_0x5edf('0x3f')]=[{'all':!![]}];}_0x139e6b=_[_0x5edf('0x44')]({},_0x139e6b,_0xa53fd4[_0x5edf('0x3d')]);return db['ChatTransferReport'][_0x5edf('0x45')](_0x139e6b)['then'](handleEntityNotFound(_0x31226b,null))['then'](respondWithResult(_0x31226b,null))[_0x5edf('0x41')](handleError(_0x31226b,null));};exports[_0x5edf('0x46')]=function(_0xa6a7b8,_0x1fb776){return db[_0x5edf('0x29')][_0x5edf('0x46')](_0xa6a7b8['body'],{})[_0x5edf('0x21')](respondWithResult(_0x1fb776,0xc9))[_0x5edf('0x41')](handleError(_0x1fb776,null));};exports[_0x5edf('0x20')]=function(_0x116dda,_0x2ce7b3){if(_0x116dda[_0x5edf('0x47')]['id']){delete _0x116dda[_0x5edf('0x47')]['id'];}return db[_0x5edf('0x29')][_0x5edf('0x45')]({'where':{'id':_0x116dda[_0x5edf('0x43')]['id']}})[_0x5edf('0x21')](handleEntityNotFound(_0x2ce7b3,null))[_0x5edf('0x21')](saveUpdates(_0x116dda['body'],null))[_0x5edf('0x21')](respondWithResult(_0x2ce7b3,null))[_0x5edf('0x41')](handleError(_0x2ce7b3,null));};exports[_0x5edf('0x22')]=function(_0x461525,_0x2308ca){return db[_0x5edf('0x29')][_0x5edf('0x45')]({'where':{'id':_0x461525[_0x5edf('0x43')]['id']}})[_0x5edf('0x21')](handleEntityNotFound(_0x2308ca,null))[_0x5edf('0x21')](removeEntity(_0x2308ca,null))[_0x5edf('0x41')](handleError(_0x2308ca,null));};exports['describe']=function(_0x52ad2e,_0x14b658){return db[_0x5edf('0x29')][_0x5edf('0x48')]()[_0x5edf('0x21')](respondWithResult(_0x14b658,null))[_0x5edf('0x41')](handleError(_0x14b658,null));}; \ No newline at end of file +var _0xcc09=['query','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','ChatTransferReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','map','type','keys'];(function(_0x57c1f7,_0x257f29){var _0xc7013c=function(_0x24031e){while(--_0x24031e){_0x57c1f7['push'](_0x57c1f7['shift']());}};_0xc7013c(++_0x257f29);}(_0xcc09,0x1e1));var _0x9cc0=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xcc09[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0x9cc0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9cc0('0x1'));var rp=require(_0x9cc0('0x2'));var moment=require(_0x9cc0('0x3'));var BPromise=require(_0x9cc0('0x4'));var Mustache=require('mustache');var util=require(_0x9cc0('0x5'));var path=require(_0x9cc0('0x6'));var sox=require(_0x9cc0('0x7'));var csv=require(_0x9cc0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9cc0('0x9'));var _=require(_0x9cc0('0xa'));var squel=require('squel');var crypto=require(_0x9cc0('0xb'));var jsforce=require(_0x9cc0('0xc'));var deskjs=require(_0x9cc0('0xd'));var toCsv=require(_0x9cc0('0x8'));var querystring=require(_0x9cc0('0xe'));var Papa=require(_0x9cc0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9cc0('0x10'));var utils=require(_0x9cc0('0x11'));var config=require(_0x9cc0('0x12'));var licenseUtil=require(_0x9cc0('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d3f5b,_0x35aef7){_0x35aef7=_0x35aef7||0xcc;return function(_0x561314){if(_0x561314){return _0x1d3f5b[_0x9cc0('0x14')](_0x35aef7);}return _0x1d3f5b[_0x9cc0('0x15')](_0x35aef7)[_0x9cc0('0x16')]();};}function respondWithResult(_0x1f30fa,_0x3057b8){_0x3057b8=_0x3057b8||0xc8;return function(_0x1c42f9){if(_0x1c42f9){return _0x1f30fa[_0x9cc0('0x15')](_0x3057b8)['json'](_0x1c42f9);}};}function respondWithFilteredResult(_0x1a523f,_0x2f7df9){return function(_0xdd1763){if(_0xdd1763){var _0x54d0aa=typeof _0x2f7df9[_0x9cc0('0x17')]===_0x9cc0('0x18')&&typeof _0x2f7df9[_0x9cc0('0x19')]===_0x9cc0('0x18');var _0x38291d=_0xdd1763[_0x9cc0('0x1a')];var _0x39bbc2=_0x54d0aa?0x0:_0x2f7df9[_0x9cc0('0x17')];var _0x52b020=_0x54d0aa?_0xdd1763['count']:_0x2f7df9[_0x9cc0('0x17')]+_0x2f7df9[_0x9cc0('0x19')];var _0xfd0fd0;if(_0x52b020>=_0x38291d){_0x52b020=_0x38291d;_0xfd0fd0=0xc8;}else{_0xfd0fd0=0xce;}_0x1a523f[_0x9cc0('0x15')](_0xfd0fd0);return _0x1a523f['set']('Content-Range',_0x39bbc2+'-'+_0x52b020+'/'+_0x38291d)['json'](_0xdd1763);}return null;};}function patchUpdates(_0x2ce382){return function(_0x1afa11){try{jsonpatch[_0x9cc0('0x1b')](_0x1afa11,_0x2ce382,!![]);}catch(_0x4e5b03){return BPromise[_0x9cc0('0x1c')](_0x4e5b03);}return _0x1afa11[_0x9cc0('0x1d')]();};}function saveUpdates(_0x21aae9,_0x3f8ff2){return function(_0x48e610){if(_0x48e610){return _0x48e610[_0x9cc0('0x1e')](_0x21aae9)[_0x9cc0('0x1f')](function(_0x41bc21){return _0x41bc21;});}return null;};}function removeEntity(_0x3da676,_0x5cd7a1){return function(_0x2ddc11){if(_0x2ddc11){return _0x2ddc11[_0x9cc0('0x20')]()[_0x9cc0('0x1f')](function(){_0x3da676['status'](0xcc)[_0x9cc0('0x16')]();});}};}function handleEntityNotFound(_0x5bf0c3,_0xb6b7b3){return function(_0x4a5fc4){if(!_0x4a5fc4){_0x5bf0c3[_0x9cc0('0x14')](0x194);}return _0x4a5fc4;};}function handleError(_0x54a581,_0x332ef5){_0x332ef5=_0x332ef5||0x1f4;return function(_0x4cff79){logger['error'](_0x4cff79[_0x9cc0('0x21')]);if(_0x4cff79[_0x9cc0('0x22')]){delete _0x4cff79[_0x9cc0('0x22')];}_0x54a581[_0x9cc0('0x15')](_0x332ef5)[_0x9cc0('0x23')](_0x4cff79);};}exports['index']=function(_0x11ecad,_0x216ea5){var _0x2e947d={},_0x225a64={},_0x4c0471={'count':0x0,'rows':[]};var _0x2ea35b=_[_0x9cc0('0x24')](db['ChatTransferReport']['rawAttributes'],function(_0x30ee8){return{'name':_0x30ee8['fieldName'],'type':_0x30ee8[_0x9cc0('0x25')]['key']};});_0x225a64['model']=_[_0x9cc0('0x24')](_0x2ea35b,_0x9cc0('0x22'));_0x225a64['query']=_[_0x9cc0('0x26')](_0x11ecad[_0x9cc0('0x27')]);_0x225a64['filters']=_['intersection'](_0x225a64[_0x9cc0('0x28')],_0x225a64[_0x9cc0('0x27')]);_0x2e947d[_0x9cc0('0x29')]=_['intersection'](_0x225a64['model'],qs[_0x9cc0('0x2a')](_0x11ecad[_0x9cc0('0x27')]['fields']));_0x2e947d[_0x9cc0('0x29')]=_0x2e947d[_0x9cc0('0x29')][_0x9cc0('0x2b')]?_0x2e947d[_0x9cc0('0x29')]:_0x225a64[_0x9cc0('0x28')];if(!_0x11ecad[_0x9cc0('0x27')][_0x9cc0('0x2c')]('nolimit')){_0x2e947d[_0x9cc0('0x19')]=qs[_0x9cc0('0x19')](_0x11ecad[_0x9cc0('0x27')][_0x9cc0('0x19')]);_0x2e947d[_0x9cc0('0x17')]=qs[_0x9cc0('0x17')](_0x11ecad[_0x9cc0('0x27')][_0x9cc0('0x17')]);}_0x2e947d['order']=qs[_0x9cc0('0x2d')](_0x11ecad[_0x9cc0('0x27')][_0x9cc0('0x2d')]);_0x2e947d[_0x9cc0('0x2e')]=qs['filters'](_[_0x9cc0('0x2f')](_0x11ecad[_0x9cc0('0x27')],_0x225a64['filters']),_0x2ea35b);if(_0x11ecad['query'][_0x9cc0('0x30')]){_0x2e947d['where']=_[_0x9cc0('0x31')](_0x2e947d[_0x9cc0('0x2e')],{'$or':_[_0x9cc0('0x24')](_0x2ea35b,function(_0x302049){if(_0x302049[_0x9cc0('0x25')]!=='VIRTUAL'){var _0x5868ad={};_0x5868ad[_0x302049[_0x9cc0('0x22')]]={'$like':'%'+_0x11ecad['query'][_0x9cc0('0x30')]+'%'};return _0x5868ad;}})});}_0x2e947d=_[_0x9cc0('0x31')]({},_0x2e947d,_0x11ecad['options']);var _0x4e39bc={'where':_0x2e947d[_0x9cc0('0x2e')]};return db[_0x9cc0('0x32')][_0x9cc0('0x1a')](_0x4e39bc)[_0x9cc0('0x1f')](function(_0x1a8938){_0x4c0471[_0x9cc0('0x1a')]=_0x1a8938;if(_0x11ecad[_0x9cc0('0x27')][_0x9cc0('0x33')]){_0x2e947d[_0x9cc0('0x34')]=[{'all':!![]}];}return db[_0x9cc0('0x32')][_0x9cc0('0x35')](_0x2e947d);})[_0x9cc0('0x1f')](function(_0x4599d1){_0x4c0471[_0x9cc0('0x36')]=_0x4599d1;return _0x4c0471;})[_0x9cc0('0x1f')](respondWithFilteredResult(_0x216ea5,_0x2e947d))[_0x9cc0('0x37')](handleError(_0x216ea5,null));};exports[_0x9cc0('0x38')]=function(_0x554adb,_0x356b74){var _0x1285c7={'raw':!![],'where':{'id':_0x554adb[_0x9cc0('0x39')]['id']}},_0x41fadd={};_0x41fadd[_0x9cc0('0x28')]=_[_0x9cc0('0x26')](db[_0x9cc0('0x32')][_0x9cc0('0x3a')]);_0x41fadd[_0x9cc0('0x27')]=_[_0x9cc0('0x26')](_0x554adb[_0x9cc0('0x27')]);_0x41fadd['filters']=_[_0x9cc0('0x3b')](_0x41fadd['model'],_0x41fadd['query']);_0x1285c7['attributes']=_[_0x9cc0('0x3b')](_0x41fadd[_0x9cc0('0x28')],qs[_0x9cc0('0x2a')](_0x554adb[_0x9cc0('0x27')][_0x9cc0('0x2a')]));_0x1285c7[_0x9cc0('0x29')]=_0x1285c7[_0x9cc0('0x29')][_0x9cc0('0x2b')]?_0x1285c7[_0x9cc0('0x29')]:_0x41fadd['model'];if(_0x554adb[_0x9cc0('0x27')]['includeAll']){_0x1285c7[_0x9cc0('0x34')]=[{'all':!![]}];}_0x1285c7=_['merge']({},_0x1285c7,_0x554adb[_0x9cc0('0x3c')]);return db[_0x9cc0('0x32')][_0x9cc0('0x3d')](_0x1285c7)['then'](handleEntityNotFound(_0x356b74,null))['then'](respondWithResult(_0x356b74,null))['catch'](handleError(_0x356b74,null));};exports[_0x9cc0('0x3e')]=function(_0x3dfe3b,_0x56749b){return db[_0x9cc0('0x32')][_0x9cc0('0x3e')](_0x3dfe3b[_0x9cc0('0x3f')],{})[_0x9cc0('0x1f')](respondWithResult(_0x56749b,0xc9))[_0x9cc0('0x37')](handleError(_0x56749b,null));};exports[_0x9cc0('0x1e')]=function(_0x51bfab,_0x28a578){if(_0x51bfab[_0x9cc0('0x3f')]['id']){delete _0x51bfab[_0x9cc0('0x3f')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x51bfab[_0x9cc0('0x39')]['id']}})[_0x9cc0('0x1f')](handleEntityNotFound(_0x28a578,null))[_0x9cc0('0x1f')](saveUpdates(_0x51bfab[_0x9cc0('0x3f')],null))[_0x9cc0('0x1f')](respondWithResult(_0x28a578,null))[_0x9cc0('0x37')](handleError(_0x28a578,null));};exports[_0x9cc0('0x20')]=function(_0x3c86cf,_0x1b146c){return db[_0x9cc0('0x32')][_0x9cc0('0x3d')]({'where':{'id':_0x3c86cf[_0x9cc0('0x39')]['id']}})['then'](handleEntityNotFound(_0x1b146c,null))['then'](removeEntity(_0x1b146c,null))[_0x9cc0('0x37')](handleError(_0x1b146c,null));};exports[_0x9cc0('0x40')]=function(_0x2ae93a,_0x1d5401){return db[_0x9cc0('0x32')]['describe']()[_0x9cc0('0x1f')](respondWithResult(_0x1d5401,null))[_0x9cc0('0x37')](handleError(_0x1d5401,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 412953d..54b26d0 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 _0x36a5=['path','rimraf','../../config/environment','./chatTransferReport.attributes','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3732d4,_0x46447d){var _0x155edf=function(_0x546c7f){while(--_0x546c7f){_0x3732d4['push'](_0x3732d4['shift']());}};_0x155edf(++_0x46447d);}(_0x36a5,0x7d));var _0x536a=function(_0x4dd2aa,_0x5037a9){_0x4dd2aa=_0x4dd2aa-0x0;var _0x1b24ad=_0x36a5[_0x4dd2aa];return _0x1b24ad;};'use strict';var _=require(_0x536a('0x0'));var util=require(_0x536a('0x1'));var logger=require(_0x536a('0x2'))(_0x536a('0x3'));var moment=require(_0x536a('0x4'));var BPromise=require(_0x536a('0x5'));var rp=require(_0x536a('0x6'));var fs=require('fs');var path=require(_0x536a('0x7'));var rimraf=require(_0x536a('0x8'));var config=require(_0x536a('0x9'));var attributes=require(_0x536a('0xa'));module['exports']=function(_0x30d282,_0x35ae4b){return _0x30d282['define']('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x536a('0xb'),'fields':[_0x536a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a82=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x56d5f8,_0x26b8f7){var _0x1afb43=function(_0x217553){while(--_0x217553){_0x56d5f8['push'](_0x56d5f8['shift']());}};_0x1afb43(++_0x26b8f7);}(_0x5a82,0x197));var _0x25a8=function(_0x434660,_0x33aa96){_0x434660=_0x434660-0x0;var _0x26f786=_0x5a82[_0x434660];return _0x26f786;};'use strict';var _=require('lodash');var util=require(_0x25a8('0x0'));var logger=require(_0x25a8('0x1'))(_0x25a8('0x2'));var moment=require(_0x25a8('0x3'));var BPromise=require(_0x25a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x25a8('0x5'));var config=require(_0x25a8('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x25a8('0x7')]=function(_0x3cec3e,_0x25c5d4){return _0x3cec3e['define'](_0x25a8('0x8'),attributes,{'tableName':_0x25a8('0x9'),'paranoid':![],'indexes':[{'name':_0x25a8('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 919f83a..9be0dfe 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 _0xd55f=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xd55f,0x149));var _0xfd55=function(_0x925a4f,_0x124a3f){_0x925a4f=_0x925a4f-0x0;var _0x50120a=_0xd55f[_0x925a4f];return _0x50120a;};'use strict';var _=require(_0xfd55('0x0'));var util=require(_0xfd55('0x1'));var moment=require(_0xfd55('0x2'));var BPromise=require(_0xfd55('0x3'));var rs=require(_0xfd55('0x4'));var fs=require('fs');var Redis=require(_0xfd55('0x5'));var db=require(_0xfd55('0x6'))['db'];var utils=require(_0xfd55('0x7'));var logger=require(_0xfd55('0x8'))(_0xfd55('0x9'));var config=require(_0xfd55('0xa'));var jayson=require(_0xfd55('0xb'));var client=jayson[_0xfd55('0xc')][_0xfd55('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x33a879,_0x1a727b,_0xfd4c1){return new BPromise(function(_0x2f5cc8,_0x2537db){return client['request'](_0x33a879,_0xfd4c1)['then'](function(_0x3c5e13){logger[_0xfd55('0xe')](_0xfd55('0xf'),_0x1a727b,_0xfd55('0x10'));logger[_0xfd55('0x11')](_0xfd55('0x12'),_0x1a727b,_0xfd55('0x10'),JSON[_0xfd55('0x13')](_0x3c5e13));if(_0x3c5e13[_0xfd55('0x14')]){if(_0x3c5e13[_0xfd55('0x14')][_0xfd55('0x15')]===0x1f4){logger[_0xfd55('0x14')](_0xfd55('0xf'),_0x1a727b,_0x3c5e13[_0xfd55('0x14')][_0xfd55('0x16')]);return _0x2537db(_0x3c5e13[_0xfd55('0x14')][_0xfd55('0x16')]);}logger[_0xfd55('0x14')](_0xfd55('0xf'),_0x1a727b,_0x3c5e13['error'][_0xfd55('0x16')]);return _0x2f5cc8(_0x3c5e13['error']['message']);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x1a727b,_0xfd55('0x10'));_0x2f5cc8(_0x3c5e13[_0xfd55('0x17')][_0xfd55('0x16')]);}})[_0xfd55('0x18')](function(_0x5ec6fa){logger[_0xfd55('0x14')](_0xfd55('0xf'),_0x1a727b,_0x5ec6fa);_0x2537db(_0x5ec6fa);});});} \ No newline at end of file +var _0x3622=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x41640b,_0x112967){var _0x59a6c2=function(_0xdfe556){while(--_0xdfe556){_0x41640b['push'](_0x41640b['shift']());}};_0x59a6c2(++_0x112967);}(_0x3622,0x1a5));var _0x2362=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x3622[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0x2362('0x0'));var moment=require(_0x2362('0x1'));var BPromise=require(_0x2362('0x2'));var rs=require(_0x2362('0x3'));var fs=require('fs');var Redis=require(_0x2362('0x4'));var db=require(_0x2362('0x5'))['db'];var utils=require(_0x2362('0x6'));var logger=require(_0x2362('0x7'))('rpc');var config=require(_0x2362('0x8'));var jayson=require(_0x2362('0x9'));var client=jayson[_0x2362('0xa')][_0x2362('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c8aef,_0x59acc4,_0x1381bc){return new BPromise(function(_0x3b11e2,_0x4ada03){return client[_0x2362('0xc')](_0x2c8aef,_0x1381bc)[_0x2362('0xd')](function(_0x4c35d4){logger['info'](_0x2362('0xe'),_0x59acc4,_0x2362('0xf'));logger[_0x2362('0x10')](_0x2362('0x11'),_0x59acc4,'request\x20sent',JSON[_0x2362('0x12')](_0x4c35d4));if(_0x4c35d4[_0x2362('0x13')]){if(_0x4c35d4[_0x2362('0x13')]['code']===0x1f4){logger[_0x2362('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x59acc4,_0x4c35d4['error'][_0x2362('0x14')]);return _0x4ada03(_0x4c35d4['error'][_0x2362('0x14')]);}logger[_0x2362('0x13')](_0x2362('0xe'),_0x59acc4,_0x4c35d4[_0x2362('0x13')]['message']);return _0x3b11e2(_0x4c35d4[_0x2362('0x13')][_0x2362('0x14')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x59acc4,_0x2362('0xf'));_0x3b11e2(_0x4c35d4[_0x2362('0x15')][_0x2362('0x14')]);}})[_0x2362('0x16')](function(_0x3a092e){logger['error'](_0x2362('0xe'),_0x59acc4,_0x3a092e);_0x4ada03(_0x3a092e);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index b8bf205..250fc82 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 _0x41a0=['./chatTransferReport.controller','get','index','/describe','/:id','isAuthenticated','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x41a0,0x123));var _0x041a=function(_0x2efd9a,_0x2bd7d8){_0x2efd9a=_0x2efd9a-0x0;var _0x20c413=_0x41a0[_0x2efd9a];return _0x20c413;};'use strict';var multer=require('multer');var util=require(_0x041a('0x0'));var path=require(_0x041a('0x1'));var timeout=require(_0x041a('0x2'));var express=require(_0x041a('0x3'));var router=express[_0x041a('0x4')]();var fs_extra=require(_0x041a('0x5'));var auth=require(_0x041a('0x6'));var interaction=require(_0x041a('0x7'));var config=require(_0x041a('0x8'));var controller=require(_0x041a('0x9'));router[_0x041a('0xa')]('/',auth['isAuthenticated'](),controller[_0x041a('0xb')]);router['get'](_0x041a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x041a('0xa')](_0x041a('0xd'),auth[_0x041a('0xe')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x041a('0xf')]);router[_0x041a('0x10')](_0x041a('0xd'),auth[_0x041a('0xe')](),controller[_0x041a('0x11')]);router[_0x041a('0x12')](_0x041a('0xd'),auth[_0x041a('0xe')](),controller['destroy']);module[_0x041a('0x13')]=router; \ No newline at end of file +var _0x7c1f=['express','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','/describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x541d74,_0x4d8ac1){var _0x1bd9c4=function(_0x34ecf6){while(--_0x34ecf6){_0x541d74['push'](_0x541d74['shift']());}};_0x1bd9c4(++_0x4d8ac1);}(_0x7c1f,0x1b6));var _0xf7c1=function(_0xbdeccb,_0x1716aa){_0xbdeccb=_0xbdeccb-0x0;var _0x1e8ddf=_0x7c1f[_0xbdeccb];return _0x1e8ddf;};'use strict';var multer=require(_0xf7c1('0x0'));var util=require(_0xf7c1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf7c1('0x2'));var router=express['Router']();var fs_extra=require(_0xf7c1('0x3'));var auth=require(_0xf7c1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf7c1('0x5'));var controller=require(_0xf7c1('0x6'));router['get']('/',auth[_0xf7c1('0x7')](),controller[_0xf7c1('0x8')]);router['get'](_0xf7c1('0x9'),auth[_0xf7c1('0x7')](),controller['describe']);router[_0xf7c1('0xa')](_0xf7c1('0xb'),auth[_0xf7c1('0x7')](),controller[_0xf7c1('0xc')]);router[_0xf7c1('0xd')]('/',auth[_0xf7c1('0x7')](),controller[_0xf7c1('0xe')]);router[_0xf7c1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf7c1('0x10')]);router[_0xf7c1('0x11')](_0xf7c1('0xb'),auth[_0xf7c1('0x7')](),controller[_0xf7c1('0x12')]);module[_0xf7c1('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 5236685..6a03917 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 _0x8a2f=['squared','We\x20are\x20here!','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded'];(function(_0x40ff89,_0x22ea0c){var _0x462cab=function(_0x1a7edf){while(--_0x1a7edf){_0x40ff89['push'](_0x40ff89['shift']());}};_0x462cab(++_0x22ea0c);}(_0x8a2f,0xcf));var _0xf8a2=function(_0x3e49cb,_0x429d1f){_0x3e49cb=_0x3e49cb-0x0;var _0x270b16=_0x8a2f[_0x3e49cb];return _0x270b16;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf8a2('0x0'));module[_0xf8a2('0x1')]={'name':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'defaultValue':_0xf8a2('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'defaultValue':_0xf8a2('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'defaultValue':_0xf8a2('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'defaultValue':_0xf8a2('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf8a2('0x2')]},'animation':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xf8a2('0x8'),_0xf8a2('0x9')),'defaultValue':_0xf8a2('0x8')},'header_online':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xa')},'start_chat_button':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xb')},'header_offline':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xc')},'download_transcript':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf8a2('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf8a2('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xf8a2('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x12')},'noteTitle':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x13')},'placeholderMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x14')},'closingMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x15')},'closingMessageButton':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xb')},'skipMessageButton':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x16')},'conditionAgreement':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xf8a2('0x17')](_0xf8a2('0x18'),'thumb'),'defaultValue':_0xf8a2('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xf8a2('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf8a2('0xf')],'defaultValue':function(){return JSON[_0xf8a2('0x19')]({'items':[{'type':_0xf8a2('0x1a'),'variable':null,'config':{'placeholder':_0xf8a2('0x1b'),'type':_0xf8a2('0x1c'),'required':!![]},'props':{'title':_0xf8a2('0x1b'),'helpText':''}},{'type':_0xf8a2('0x1a'),'props':{'title':_0xf8a2('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf8a2('0x3'),'type':_0xf8a2('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf8a2('0x1d')](_0xf8a2('0x1e'))?JSON[_0xf8a2('0x1f')](this['getDataValue'](_0xf8a2('0x1e'))):{};},'set':function(_0x425af4){return this['setDataValue'](_0xf8a2('0x1e'),JSON[_0xf8a2('0x19')](_0x425af4));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xf8a2('0x1a'),'props':{'title':_0xf8a2('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf8a2('0x3'),'type':_0xf8a2('0x3')},'variable':null},{'type':_0xf8a2('0x20'),'config':{'placeholder':_0xf8a2('0x21')},'props':{'title':'Comments','helpText':_0xf8a2('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xf8a2('0x1d')](_0xf8a2('0x23'))?JSON[_0xf8a2('0x1f')](this[_0xf8a2('0x1d')](_0xf8a2('0x23'))):{};},'set':function(_0x2ffdf2){return this['setDataValue'](_0xf8a2('0x23'),JSON[_0xf8a2('0x19')](_0x2ffdf2));}},'token':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':function(){return rs[_0xf8a2('0x24')]();}},'autoclose':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf8a2('0x2')]},'forwardOffline':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf8a2('0x2')]},'waitingTitle':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x25')},'waitingMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x28')},'skipUnmanaged':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x16')},'sendUnmanaged':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf8a2('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf8a2('0xf')],'defaultValue':function(){return _0xf8a2('0x29');}},'notificationSound':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf8a2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x2b')},'verticalAlignment':{'type':Sequelize[_0xf8a2('0xd')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x2c')},'messagesAlignment':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x2d')},'defaultTitle':{'type':Sequelize[_0xf8a2('0x2')]},'customerAvatar':{'type':Sequelize[_0xf8a2('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf8a2('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf8a2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xf8a2('0x2e')},'systemAvatar':{'type':Sequelize[_0xf8a2('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf8a2('0xd')],'comment':_0xf8a2('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf8a2('0x30'),'set':function(_0x4e8d63){if(!_0x4e8d63)this[_0xf8a2('0x31')](_0xf8a2('0x32'),null);this[_0xf8a2('0x31')](_0xf8a2('0x33'),_0x4e8d63);}},'vidaooEscalation':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf8a2('0x34')},'vidaooNote':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':function(){return _0xf8a2('0x35');}},'vidaooMetadata':{'type':Sequelize[_0xf8a2('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf8a2('0xf')]}}; \ No newline at end of file +var _0xe76d=['textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','CHAT','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','input','name','parse','getDataValue','setDataValue','onlineForm','stringify'];(function(_0x5b959e,_0x2f221a){var _0x4c3e9c=function(_0xb799f1){while(--_0xb799f1){_0x5b959e['push'](_0x5b959e['shift']());}};_0x4c3e9c(++_0x2f221a);}(_0xe76d,0x13a));var _0xde76=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xe76d[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0xde76('0x0'));var rs=require(_0xde76('0x1'));module[_0xde76('0x2')]={'name':{'type':Sequelize[_0xde76('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xde76('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xde76('0x5')},'mapKeyOffline':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x5')},'key':{'type':Sequelize[_0xde76('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x6')},'customerAlias':{'type':Sequelize[_0xde76('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xde76('0x3')],'allowNull':![],'defaultValue':_0xde76('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xde76('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xde76('0x3')],'allowNull':![],'defaultValue':_0xde76('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xde76('0x3')]},'animation':{'type':Sequelize[_0xde76('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xde76('0xa')](_0xde76('0xb'),_0xde76('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0xd')},'start_chat_button':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0xe')},'offline_chat_button':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0xf')},'header_offline':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x10')},'download_transcript':{'type':Sequelize[_0xde76('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xde76('0x11')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x12')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xde76('0x13')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xde76('0x14')},'formSubmitSuccessMessage':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x15')},'formSubmitFailureMessage':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x16')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xde76('0x17')},'placeholderMessage':{'type':Sequelize[_0xde76('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xde76('0x18')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xde76('0xf')},'skipMessageButton':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x19')},'conditionAgreement':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x1a')},'ratingType':{'type':Sequelize[_0xde76('0xa')](_0xde76('0x1b'),_0xde76('0x1c')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xde76('0x11')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xde76('0x13')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xde76('0x1d'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xde76('0x1e'),'helpText':''}},{'type':_0xde76('0x1d'),'props':{'title':_0xde76('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xde76('0x5'),'type':_0xde76('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0xde76('0x1f')](this[_0xde76('0x20')]('onlineForm')):{};},'set':function(_0x58540b){return this[_0xde76('0x21')](_0xde76('0x22'),JSON[_0xde76('0x23')](_0x58540b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xde76('0x23')]({'items':[{'type':_0xde76('0x1d'),'props':{'title':_0xde76('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xde76('0x5'),'type':_0xde76('0x5')},'variable':null},{'type':_0xde76('0x24'),'config':{'placeholder':_0xde76('0x25')},'props':{'title':_0xde76('0x25'),'helpText':_0xde76('0x26')}}],'fromKey':0x0});},'get':function(){return this[_0xde76('0x20')](_0xde76('0x27'))?JSON[_0xde76('0x1f')](this[_0xde76('0x20')](_0xde76('0x27'))):{};},'set':function(_0x544029){return this[_0xde76('0x21')](_0xde76('0x27'),JSON['stringify'](_0x544029));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xde76('0x28')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xde76('0x3')]},'forwardOffline':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xde76('0x3')]},'waitingTitle':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x29')},'waitingMessage':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x2a')},'offlineMessageSubject':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x2b')},'offlineMessageBody':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x2c')},'enableUnmanagedNote':{'type':Sequelize[_0xde76('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xde76('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x19')},'sendUnmanaged':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xde76('0x3')]},'notificationTemplate':{'type':Sequelize[_0xde76('0x13')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xde76('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xde76('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xde76('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xde76('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x2d')},'messagesAlignment':{'type':Sequelize[_0xde76('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xde76('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xde76('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xde76('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x2e')},'systemAvatar':{'type':Sequelize[_0xde76('0x13')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xde76('0x11')],'comment':_0xde76('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x105651){if(!_0x105651)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xde76('0x21')](_0xde76('0x30'),_0x105651);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xde76('0x3')]},'vidaooTopic':{'type':Sequelize[_0xde76('0x3')],'allowNull':![],'defaultValue':_0xde76('0x31')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xde76('0x13')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 4c85bfa..3652936 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 _0x81bd=['autoclose','close','*,*,*,*','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','ValidationError','no\x20available\x20attributes','difference','CompanyId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','files','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','Smtp','mimetype','subjectOffline','mapValues','offlineMessageSubject','Chat','MailAccountId','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','virtual','custom','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.13.0','headers','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','destroy','UserProfileResource','name','send','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','model','device','vendor','%s\x20%s\x20%s','type','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','params','Pause','options','find','create','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findAll','rows','removeDispositions','ids','ChatWebsiteId','CannedAnswer','getAnswers','findOne','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','createdAt','includes','updatedAt','ListId','from','CmList','CmContact','Contacts','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','priority','asc','list','contact','threadId','closed','externalUrl','ContactId','interaction','ChatInteraction','Writing\x20on\x20closed\x20interaction','messageId','created'];(function(_0x503b03,_0x216a86){var _0x8a53d6=function(_0x85e932){while(--_0x85e932){_0x503b03['push'](_0x503b03['shift']());}};_0x8a53d6(++_0x216a86);}(_0x81bd,0x7c));var _0xd81b=function(_0x427502,_0x4e6214){_0x427502=_0x427502-0x0;var _0x1baeff=_0x81bd[_0x427502];return _0x1baeff;};'use strict';var Mustache=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var ejs=require(_0xd81b('0x3'));var fs=require('fs');var fs_extra=require(_0xd81b('0x4'));var _=require(_0xd81b('0x5'));var querystring=require(_0xd81b('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0xd81b('0x7'));var jayson=require(_0xd81b('0x8'));var qs=require(_0xd81b('0x9'));var logger=require('../../config/logger')(_0xd81b('0xa'));var config=require(_0xd81b('0xb'));var APIBadRequestError=require(_0xd81b('0xc'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0xd81b('0xd')];var APIOutOfIntervalError=require('../../errors/api')[_0xd81b('0xe')];var APIHandleError=require(_0xd81b('0xc'))[_0xd81b('0xf')];var APIConflictError=require(_0xd81b('0xc'))[_0xd81b('0x10')];var wildcardUtils=require(_0xd81b('0x11'));var URL=require(_0xd81b('0x12'))[_0xd81b('0x13')];var db=require(_0xd81b('0x14'))['db'];config[_0xd81b('0x15')]=_[_0xd81b('0x16')](config[_0xd81b('0x15')],{'host':_0xd81b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0x15')]));require('./chatWebsite.socket')[_0xd81b('0x18')](socket);var client=jayson[_0xd81b('0x19')]['http']({'port':0x232c});var client9002=jayson[_0xd81b('0x19')]['http']({'port':0x232a});var client9003=jayson[_0xd81b('0x19')][_0xd81b('0x1a')]({'port':0x232b});var client9001=jayson[_0xd81b('0x19')][_0xd81b('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0x128162,_0x552215,_0x1c620d,_0x27b7a0){return new Promise(function(_0x5c2863,_0x2abef4){var _0x26df61=_0x27b7a0||client;return _0x26df61[_0xd81b('0x1b')](_0x128162,_0x1c620d)[_0xd81b('0x1c')](function(_0x5f7db6){logger[_0xd81b('0x1d')](_0xd81b('0x1e'),_0x552215,_0xd81b('0x1f'));logger[_0xd81b('0x20')](_0xd81b('0x21'),_0x552215,_0xd81b('0x1f'),JSON[_0xd81b('0x22')](_0x5f7db6));if(_0x5f7db6[_0xd81b('0x23')]){if(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x24')]===0x1f4){logger[_0xd81b('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x552215,_0x5f7db6['error'][_0xd81b('0x25')]);return _0x2abef4(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x25')]);}logger['error'](_0xd81b('0x1e'),_0x552215,_0x5f7db6[_0xd81b('0x23')]['message']);return _0x5c2863(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x25')]);}else{logger[_0xd81b('0x1d')](_0xd81b('0x1e'),_0x552215,_0xd81b('0x1f'));_0x5c2863(_0x5f7db6[_0xd81b('0x26')][_0xd81b('0x25')]);}})[_0xd81b('0x27')](function(_0x341aec){logger[_0xd81b('0x23')](_0xd81b('0x1e'),_0x552215,_0x341aec);_0x2abef4(_0x341aec);});});}function respondWithStatusCode(_0x1bf351,_0x596389){_0x596389=_0x596389||0xcc;return function(_0x28768f){if(_0x28768f){return _0x1bf351[_0xd81b('0x28')](_0x596389);}return _0x1bf351[_0xd81b('0x29')](_0x596389)[_0xd81b('0x2a')]();};}function respondWithResult(_0x3266c2,_0x2d0d02){_0x2d0d02=_0x2d0d02||0xc8;return function(_0x3e28dd){if(_0x3e28dd){return _0x3266c2[_0xd81b('0x29')](_0x2d0d02)[_0xd81b('0x2b')](_0x3e28dd);}};}function respondWithFilteredResult(_0x483a3d,_0x469cc4){return function(_0x4e2eff){if(_0x4e2eff){var _0x5c8aee=typeof _0x469cc4[_0xd81b('0x2c')]===_0xd81b('0x2d')&&typeof _0x469cc4['limit']==='undefined';var _0x4093c8=_0x4e2eff[_0xd81b('0x2e')];var _0x1b1434=_0x5c8aee?0x0:_0x469cc4[_0xd81b('0x2c')];var _0x1a1572=_0x5c8aee?_0x4e2eff[_0xd81b('0x2e')]:_0x469cc4['offset']+_0x469cc4[_0xd81b('0x2f')];var _0x26f629;if(_0x1a1572>=_0x4093c8){_0x1a1572=_0x4093c8;_0x26f629=0xc8;}else{_0x26f629=0xce;}_0x483a3d['status'](_0x26f629);return _0x483a3d['set'](_0xd81b('0x30'),_0x1b1434+'-'+_0x1a1572+'/'+_0x4093c8)[_0xd81b('0x2b')](_0x4e2eff);}return null;};}function saveUpdates(_0x50472a){return function(_0x50ce25){if(_0x50ce25){return _0x50ce25['update'](_0x50472a)[_0xd81b('0x1c')](function(_0x3ead68){return _0x3ead68;});}return null;};}function removeEntity(_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x31')]()[_0xd81b('0x1c')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='ChatWebsites';return db[_0xd81b('0x32')][_0xd81b('0x31')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1c')](function(){return _0x1c4cf7;});})[_0xd81b('0x1c')](function(){_0x1d2f46[_0xd81b('0x29')](0xcc)[_0xd81b('0x2a')]();});}};}function handleEntityNotFound(_0x1c20d3){return function(_0x2d23b9){if(!_0x2d23b9){_0x1c20d3[_0xd81b('0x28')](0x194);}return _0x2d23b9;};}function handleError(_0xe88a33,_0x1be4e2){_0x1be4e2=_0x1be4e2||0x1f4;return function(_0x3c8371){logger[_0xd81b('0x23')](_0x3c8371['stack']);if(_0x3c8371['name']){delete _0x3c8371[_0xd81b('0x33')];}_0xe88a33[_0xd81b('0x29')](_0x1be4e2)[_0xd81b('0x34')](_0x3c8371);};}function createInteractionObject(_0x59c066,_0x362ebc,_0x37ba34,_0x5a236a){var _0x46f058=require(_0xd81b('0x35'));var _0x512e39=new _0x46f058();var _0xed5272=_0x512e39['setUA'](_0x37ba34[_0xd81b('0x36')])[_0xd81b('0x37')]();var _0x203365=_0x362ebc[_0xd81b('0x38')];if(_0x37ba34['cf-connecting-ip']){_0x203365=_0x37ba34[_0xd81b('0x39')];}else if(_0x37ba34[_0xd81b('0x3a')]){_0x203365=_[_0xd81b('0x3b')](_0x37ba34[_0xd81b('0x3a')][_0xd81b('0x3c')](','));}return{'ContactId':_0x5a236a['id'],'ChatWebsiteId':_0x59c066,'from':(_0x5a236a[_0xd81b('0x3d')]||'')+'\x20'+(_0x5a236a[_0xd81b('0x3e')]||''),'customerIp':_0x203365,'customerPort':_0x37ba34['x-real-port']?_0x37ba34[_0xd81b('0x3f')]:null,'referer':_0x362ebc[_0xd81b('0x40')],'browserName':_0xed5272[_0xd81b('0x41')]['name']&&_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]?util[_0xd81b('0x43')](_0xd81b('0x44'),_0xed5272[_0xd81b('0x41')]['name'],_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]):_0xd81b('0x45'),'browserVersion':_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]||_0xd81b('0x45'),'osName':util[_0xd81b('0x43')](_0xd81b('0x44'),_0xed5272['os'][_0xd81b('0x33')],_0xed5272['os'][_0xd81b('0x42')]),'osVersion':_0xed5272['os'][_0xd81b('0x42')],'deviceModel':_0xed5272['device'][_0xd81b('0x46')]&&_0xed5272[_0xd81b('0x47')][_0xd81b('0x48')]?util[_0xd81b('0x43')](_0xd81b('0x49'),_0xed5272[_0xd81b('0x47')][_0xd81b('0x46')],_0xed5272[_0xd81b('0x47')]['vendor'],_0xed5272['device'][_0xd81b('0x4a')]):null,'deviceVendor':_0xed5272[_0xd81b('0x47')][_0xd81b('0x48')],'deviceType':_0xed5272[_0xd81b('0x47')][_0xd81b('0x4a')],'formData':JSON[_0xd81b('0x22')](_0x362ebc)};}exports[_0xd81b('0x4b')]=function(_0x2e44f3,_0x2fa588){var _0xcfbbc2={'include':[{'model':db['Pause'],'as':_0xd81b('0x4c')}]},_0x41e2e6={},_0x38e436={'count':0x0,'rows':[]};var _0x2b61fc=_[_0xd81b('0x4d')](db[_0xd81b('0x4e')][_0xd81b('0x4f')],function(_0x410ef3){return{'name':_0x410ef3[_0xd81b('0x50')],'type':_0x410ef3[_0xd81b('0x4a')][_0xd81b('0x51')]};});_0x41e2e6['model']=_[_0xd81b('0x4d')](_0x2b61fc,_0xd81b('0x33'));_0x41e2e6[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x2e44f3['query']);_0x41e2e6[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x41e2e6[_0xd81b('0x46')],_0x41e2e6[_0xd81b('0x52')]);_0xcfbbc2[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x41e2e6[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x2e44f3[_0xd81b('0x52')]['fields']));_0xcfbbc2['attributes']=_0xcfbbc2[_0xd81b('0x56')][_0xd81b('0x58')]?_0xcfbbc2[_0xd81b('0x56')]:_0x41e2e6[_0xd81b('0x46')];if(!_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0xcfbbc2[_0xd81b('0x2f')]=qs['limit'](_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x2f')]);_0xcfbbc2[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x2e44f3[_0xd81b('0x52')]['offset']);}_0xcfbbc2[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x2e44f3['query'][_0xd81b('0x5c')]);_0xcfbbc2[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x2e44f3[_0xd81b('0x52')],_0x41e2e6[_0xd81b('0x54')]),_0x2b61fc);if(_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x5f')]){_0xcfbbc2[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0xcfbbc2[_0xd81b('0x5d')],{'$or':_['map'](_0x2b61fc,function(_0x285e82){if(_0x285e82['type']!==_0xd81b('0x61')){var _0x7b438c={};_0x7b438c[_0x285e82[_0xd81b('0x33')]]={'$like':'%'+_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x7b438c;}})});}_0xcfbbc2=_[_0xd81b('0x60')]({},_0xcfbbc2,_0x2e44f3['options']);var _0x2d978d={'where':_0xcfbbc2[_0xd81b('0x5d')]};return db['ChatWebsite']['count'](_0x2d978d)[_0xd81b('0x1c')](function(_0x59e018){_0x38e436[_0xd81b('0x2e')]=_0x59e018;if(_0x2e44f3['query'][_0xd81b('0x62')]){_0xcfbbc2[_0xd81b('0x63')]=[{'all':!![]}];}return db[_0xd81b('0x4e')]['findAll'](_0xcfbbc2);})[_0xd81b('0x1c')](function(_0x10ed99){_0x38e436['rows']=_0x10ed99;return _0x38e436;})[_0xd81b('0x1c')](respondWithFilteredResult(_0x2fa588,_0xcfbbc2))[_0xd81b('0x27')](handleError(_0x2fa588,null));};exports['show']=function(_0x1ba5d6,_0x5e1cd7){var _0x3c9264={'raw':![],'where':{'id':_0x1ba5d6[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x65')],'as':_0xd81b('0x4c')}]},_0x31553e={};_0x31553e[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0x4e')][_0xd81b('0x4f')]);_0x31553e[_0xd81b('0x52')]=_['keys'](_0x1ba5d6[_0xd81b('0x52')]);_0x31553e[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x31553e[_0xd81b('0x46')],_0x31553e[_0xd81b('0x52')]);_0x3c9264[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x31553e['model'],qs['fields'](_0x1ba5d6['query'][_0xd81b('0x57')]));_0x3c9264[_0xd81b('0x56')]=_0x3c9264[_0xd81b('0x56')][_0xd81b('0x58')]?_0x3c9264[_0xd81b('0x56')]:_0x31553e[_0xd81b('0x46')];if(_0x1ba5d6[_0xd81b('0x52')]['includeAll']){_0x3c9264[_0xd81b('0x63')]=[{'all':!![]}];}_0x3c9264=_[_0xd81b('0x60')]({},_0x3c9264,_0x1ba5d6[_0xd81b('0x66')]);return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x3c9264)[_0xd81b('0x1c')](handleEntityNotFound(_0x5e1cd7,null))[_0xd81b('0x1c')](respondWithResult(_0x5e1cd7,null))['catch'](handleError(_0x5e1cd7,null));};exports[_0xd81b('0x68')]=function(_0x15f003,_0x12b2a7){var _0x8cf25d=null;_0x15f003[_0xd81b('0x69')][_0xd81b('0x6a')][_0xd81b('0x3c')](',')[_0xd81b('0x6b')](_0x8fa8cd=>{if(_0x8fa8cd[_0xd81b('0x6c')]()!==''&&!wildcardUtils[_0xd81b('0x6d')](_0x8fa8cd[_0xd81b('0x6c')]())){_0x8cf25d=new APIBadRequestError('\x22'+_0x8fa8cd['trim']()+_0xd81b('0x6e'));}});if(_0x8cf25d){return handleError(_0x12b2a7,null)(_0x8cf25d);}return db['ChatWebsite'][_0xd81b('0x68')](_0x15f003[_0xd81b('0x69')],{})[_0xd81b('0x1c')](function(_0xc3c117){var _0xb94a69=_0x15f003[_0xd81b('0x6f')][_0xd81b('0x70')]({'plain':!![]});if(!_0xb94a69)throw new Error(_0xd81b('0x71'));if(_0xb94a69[_0xd81b('0x72')]===_0xd81b('0x6f')){var _0x5bcfd7=_0xc3c117[_0xd81b('0x70')]({'plain':!![]});var _0x344c32=_0xd81b('0x73');return db[_0xd81b('0x74')][_0xd81b('0x67')]({'where':{'name':_0x344c32,'userProfileId':_0xb94a69['userProfileId']},'raw':!![]})['then'](function(_0x3274d2){if(_0x3274d2&&_0x3274d2[_0xd81b('0x75')]===0x0){return db[_0xd81b('0x32')][_0xd81b('0x68')]({'name':_0x5bcfd7[_0xd81b('0x33')],'resourceId':_0x5bcfd7['id'],'type':_0x3274d2[_0xd81b('0x33')],'sectionId':_0x3274d2['id']},{})[_0xd81b('0x1c')](function(){return _0xc3c117;});}else{return _0xc3c117;}})['catch'](function(_0x2190df){logger[_0xd81b('0x23')](_0xd81b('0x76'),_0x2190df);throw _0x2190df;});}return _0xc3c117;})[_0xd81b('0x1c')](respondWithResult(_0x12b2a7,0xc9))[_0xd81b('0x27')](handleError(_0x12b2a7,null));};exports[_0xd81b('0x77')]=function(_0x1e0da3,_0x185f28){var _0x2315db=null;_0x1e0da3['body'][_0xd81b('0x6a')][_0xd81b('0x3c')](',')[_0xd81b('0x6b')](_0x9c30e7=>{if(_0x9c30e7[_0xd81b('0x6c')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x9c30e7[_0xd81b('0x6c')]())){_0x2315db=new APIBadRequestError('\x22'+_0x9c30e7[_0xd81b('0x6c')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x2315db){return handleError(_0x185f28,null)(_0x2315db);}if(_0x1e0da3[_0xd81b('0x69')]['id']){delete _0x1e0da3[_0xd81b('0x69')]['id'];}return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x1e0da3[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x65')],'as':'mandatoryDispositionPause'}]})[_0xd81b('0x1c')](handleEntityNotFound(_0x185f28,null))[_0xd81b('0x1c')](saveUpdates(_0x1e0da3[_0xd81b('0x69')],null))['then'](respondWithResult(_0x185f28,null))['catch'](handleError(_0x185f28,null));};exports[_0xd81b('0x31')]=function(_0x950cc3,_0x36c694){return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x950cc3[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x36c694,null))[_0xd81b('0x1c')](removeEntity(_0x36c694,null))['catch'](handleError(_0x36c694,null));};exports['describe']=function(_0x42ae01,_0x256696){return db[_0xd81b('0x4e')][_0xd81b('0x78')]()['then'](respondWithResult(_0x256696,null))[_0xd81b('0x27')](handleError(_0x256696,null));};exports[_0xd81b('0x79')]=function(_0x4b8294,_0x46e36b){if(_0x4b8294['body']['id']){delete _0x4b8294[_0xd81b('0x69')]['id'];}return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x4b8294[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x46e36b,null))[_0xd81b('0x1c')](function(_0x2490f1){if(_0x2490f1){_0x4b8294[_0xd81b('0x69')]['ChatWebsiteId']=_0x2490f1['id'];return db[_0xd81b('0x7a')][_0xd81b('0x68')](_0x4b8294[_0xd81b('0x69')]);}})[_0xd81b('0x1c')](respondWithResult(_0x46e36b,null))[_0xd81b('0x27')](handleError(_0x46e36b,null));};exports[_0xd81b('0x7b')]=function(_0x579052,_0x5c8ea0){var _0x31509d={'raw':![],'where':{}};var _0x3023d9={};var _0x97bd3e={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')]['findOne']({'where':{'id':_0x579052[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x5c8ea0,null))[_0xd81b('0x1c')](function(_0x195f1c){if(_0x195f1c){_0x3023d9[_0xd81b('0x46')]=_['keys'](db[_0xd81b('0x7a')][_0xd81b('0x4f')]);_0x3023d9[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x579052[_0xd81b('0x52')]);_0x3023d9[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x3023d9['model'],_0x3023d9[_0xd81b('0x52')]);_0x31509d[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x3023d9[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x579052[_0xd81b('0x52')]['fields']));_0x31509d[_0xd81b('0x56')]=_0x31509d['attributes'][_0xd81b('0x58')]?_0x31509d[_0xd81b('0x56')]:_0x3023d9[_0xd81b('0x46')];if(!_0x579052['query'][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x31509d[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x579052[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x31509d['offset']=qs[_0xd81b('0x2c')](_0x579052['query']['offset']);}_0x31509d[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x579052[_0xd81b('0x52')]['sort']);_0x31509d[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x579052[_0xd81b('0x52')],_0x3023d9[_0xd81b('0x54')]));_0x31509d[_0xd81b('0x5d')]['ChatWebsiteId']=_0x195f1c['id'];if(_0x579052[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x31509d[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x31509d[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x31509d[_0xd81b('0x56')],function(_0x270d82){var _0x380951={};_0x380951[_0x270d82]={'$like':'%'+_0x579052[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x380951;})});}_0x31509d=_[_0xd81b('0x60')]({},_0x31509d,_0x579052[_0xd81b('0x66')]);return db[_0xd81b('0x7a')][_0xd81b('0x2e')]({'where':_0x31509d['where']})[_0xd81b('0x1c')](function(_0x47f90e){_0x97bd3e[_0xd81b('0x2e')]=_0x47f90e;if(_0x579052[_0xd81b('0x52')][_0xd81b('0x62')]){_0x31509d[_0xd81b('0x63')]=[{'all':!![]}];}return db[_0xd81b('0x7a')][_0xd81b('0x7c')](_0x31509d);})['then'](function(_0x3a41e6){_0x97bd3e[_0xd81b('0x7d')]=_0x3a41e6;return _0x97bd3e;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x5c8ea0,_0x31509d))[_0xd81b('0x27')](handleError(_0x5c8ea0,null));};exports[_0xd81b('0x7e')]=function(_0x6e4c25,_0x2481e9){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x6e4c25[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x2481e9,null))[_0xd81b('0x1c')](function(_0x5a02f7){if(_0x5a02f7){return _0x5a02f7[_0xd81b('0x7e')](_0x6e4c25[_0xd81b('0x52')][_0xd81b('0x7f')]);}})[_0xd81b('0x1c')](respondWithStatusCode(_0x2481e9,null))[_0xd81b('0x27')](handleError(_0x2481e9,null));};exports['addAnswer']=function(_0x421c2b,_0x1e61d8){if(_0x421c2b[_0xd81b('0x69')]['id']){delete _0x421c2b[_0xd81b('0x69')]['id'];}return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x421c2b['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x1e61d8,null))['then'](function(_0x4461f3){if(_0x4461f3){_0x421c2b[_0xd81b('0x69')][_0xd81b('0x80')]=_0x4461f3['id'];return db[_0xd81b('0x81')]['create'](_0x421c2b[_0xd81b('0x69')]);}})[_0xd81b('0x1c')](respondWithResult(_0x1e61d8,null))['catch'](handleError(_0x1e61d8,null));};exports[_0xd81b('0x82')]=function(_0x142d78,_0x2c1a0e){var _0x1c6291={'raw':![],'where':{}};var _0x2f9a9f={};var _0x4c8925={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd81b('0x83')]({'where':{'id':_0x142d78['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x2c1a0e,null))['then'](function(_0x509001){if(_0x509001){_0x2f9a9f[_0xd81b('0x46')]=_[_0xd81b('0x53')](db['CannedAnswer']['rawAttributes']);_0x2f9a9f[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x142d78['query']);_0x2f9a9f[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x2f9a9f[_0xd81b('0x46')],_0x2f9a9f[_0xd81b('0x52')]);_0x1c6291['attributes']=_[_0xd81b('0x55')](_0x2f9a9f[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x142d78['query']['fields']));_0x1c6291[_0xd81b('0x56')]=_0x1c6291[_0xd81b('0x56')][_0xd81b('0x58')]?_0x1c6291[_0xd81b('0x56')]:_0x2f9a9f[_0xd81b('0x46')];if(!_0x142d78['query']['hasOwnProperty'](_0xd81b('0x5a'))){_0x1c6291[_0xd81b('0x2f')]=qs['limit'](_0x142d78['query'][_0xd81b('0x2f')]);_0x1c6291[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x142d78[_0xd81b('0x52')][_0xd81b('0x2c')]);}_0x1c6291[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x142d78[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x1c6291[_0xd81b('0x5d')]=qs['filters'](_['pick'](_0x142d78[_0xd81b('0x52')],_0x2f9a9f[_0xd81b('0x54')]));_0x1c6291[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x509001['id'];if(_0x142d78[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x1c6291[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x1c6291[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x1c6291[_0xd81b('0x56')],function(_0x32e484){var _0x30fb62={};_0x30fb62[_0x32e484]={'$like':'%'+_0x142d78[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x30fb62;})});}_0x1c6291=_['merge']({},_0x1c6291,_0x142d78[_0xd81b('0x66')]);return db[_0xd81b('0x81')][_0xd81b('0x2e')]({'where':_0x1c6291['where']})[_0xd81b('0x1c')](function(_0x3bd28c){_0x4c8925[_0xd81b('0x2e')]=_0x3bd28c;if(_0x142d78[_0xd81b('0x52')][_0xd81b('0x62')]){_0x1c6291['include']=[{'all':!![]}];}return db[_0xd81b('0x81')][_0xd81b('0x7c')](_0x1c6291);})[_0xd81b('0x1c')](function(_0x30fe56){_0x4c8925[_0xd81b('0x7d')]=_0x30fe56;return _0x4c8925;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x2c1a0e,_0x1c6291))[_0xd81b('0x27')](handleError(_0x2c1a0e,null));};exports[_0xd81b('0x84')]=function(_0x1c3ea4,_0x282e83){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x1c3ea4['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x282e83,null))[_0xd81b('0x1c')](function(_0x15d52d){if(_0x15d52d){return _0x15d52d['removeAnswers'](_0x1c3ea4[_0xd81b('0x52')][_0xd81b('0x7f')]);}})[_0xd81b('0x1c')](respondWithStatusCode(_0x282e83,null))[_0xd81b('0x27')](handleError(_0x282e83,null));};exports['addLogo']=function(_0x1e5f94,_0x4e037b){_0x1e5f94['body'][_0xd81b('0x85')]=_0x1e5f94[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x1e5f94['params']['id']}})['then'](handleEntityNotFound(_0x4e037b,null))[_0xd81b('0x1c')](saveUpdates(_0x1e5f94[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x4e037b,null))[_0xd81b('0x27')](handleError(_0x4e037b,null));};exports[_0xd81b('0x88')]=function(_0x36611b,_0x368fc6){_0x36611b[_0xd81b('0x69')][_0xd81b('0x89')]=_0x36611b[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x36611b[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x368fc6,null))[_0xd81b('0x1c')](saveUpdates(_0x36611b[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x368fc6,null))[_0xd81b('0x27')](handleError(_0x368fc6,null));};exports[_0xd81b('0x8a')]=function(_0x4c6848,_0x1162c0){_0x4c6848[_0xd81b('0x69')][_0xd81b('0x8b')]=_0x4c6848[_0xd81b('0x86')][_0xd81b('0x87')];return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x4c6848[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x1162c0,null))[_0xd81b('0x1c')](saveUpdates(_0x4c6848[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x1162c0,null))[_0xd81b('0x27')](handleError(_0x1162c0,null));};exports[_0xd81b('0x8c')]=function(_0x11b49d,_0x22e808){_0x11b49d[_0xd81b('0x69')][_0xd81b('0x8d')]=_0x11b49d[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x11b49d[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x22e808,null))[_0xd81b('0x1c')](saveUpdates(_0x11b49d['body'],null))[_0xd81b('0x1c')](respondWithResult(_0x22e808,null))[_0xd81b('0x27')](handleError(_0x22e808,null));};exports[_0xd81b('0x8e')]=function(_0x478b92,_0xf13081){var _0x3069d1=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/logos/default_logo.svg');var _0x2a6dcb={'where':{'id':_0x478b92[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x85')],'raw':!![]};var _0xf2e1b5=![];return require(_0xd81b('0x91'))[_0xd81b('0x92')]()[_0xd81b('0x1c')](function(_0x55384e){if(_0x55384e){_0xf2e1b5=_0x55384e['custom'];}})[_0xd81b('0x1c')](function(){return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x2a6dcb);})['then'](handleEntityNotFound(_0xf13081,null))[_0xd81b('0x1c')](function(_0x5189b8){if(_0x5189b8){if(!_[_0xd81b('0x93')](_0x5189b8[_0xd81b('0x85')])){if(fs[_0xd81b('0x94')](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x95'),_0x5189b8[_0xd81b('0x85')]))&&_0xf2e1b5){_0x3069d1=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/logos/',_0x5189b8[_0xd81b('0x85')]);}}return _0xf13081[_0xd81b('0x96')](_0x3069d1);}})[_0xd81b('0x27')](handleError(_0xf13081,null));};exports['getAvatar']=function(_0x4b2b45,_0x4d44d7){var _0x3c5ea6=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x97'));var _0x175d02={'where':{'id':_0x4b2b45[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x89')],'raw':!![]};return db['ChatWebsite'][_0xd81b('0x67')](_0x175d02)[_0xd81b('0x1c')](handleEntityNotFound(_0x4d44d7,null))[_0xd81b('0x1c')](function(_0x361d5a){if(_0x361d5a){if(!_['isNil'](_0x361d5a[_0xd81b('0x89')])){if(fs['existsSync'](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x98'),_0x361d5a['agentAvatar']))){_0x3c5ea6=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0x361d5a[_0xd81b('0x89')]);}}return _0x4d44d7['download'](_0x3c5ea6);}})[_0xd81b('0x27')](handleError(_0x4d44d7,null));};exports[_0xd81b('0x99')]=function(_0x10449f,_0x539668){var _0x277379=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x9a'));var _0x1e2612={'where':{'id':_0x10449f[_0xd81b('0x64')]['id']},'attributes':['id','customerAvatar',_0xd81b('0x9b')],'raw':!![]};return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x1e2612)['then'](handleEntityNotFound(_0x539668,null))[_0xd81b('0x1c')](function(_0xc9bdfe){if(_0xc9bdfe){if(!_[_0xd81b('0x93')](_0xc9bdfe[_0xd81b('0x8b')])){if(fs[_0xd81b('0x94')](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0xc9bdfe['customerAvatar']))&&_0xc9bdfe['showCustomerAvatar']){_0x277379=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0xc9bdfe[_0xd81b('0x8b')]);}}return _0x539668['download'](_0x277379);}})['catch'](handleError(_0x539668,null));};exports[_0xd81b('0x9c')]=function(_0x397d26,_0x335713){var _0x1b18ef=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x9d'));var _0x13e25f={'where':{'id':_0x397d26[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x8d')],'raw':!![]};return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x13e25f)[_0xd81b('0x1c')](handleEntityNotFound(_0x335713,null))[_0xd81b('0x1c')](function(_0x4283bd){if(_0x4283bd){if(!_['isNil'](_0x4283bd[_0xd81b('0x8d')])){if(fs[_0xd81b('0x94')](path['join'](config[_0xd81b('0x90')],'server/files/images/avatars/',_0x4283bd[_0xd81b('0x8d')]))){_0x1b18ef=path['join'](config[_0xd81b('0x90')],_0xd81b('0x98'),_0x4283bd[_0xd81b('0x8d')]);}}return _0x335713[_0xd81b('0x96')](_0x1b18ef);}})[_0xd81b('0x27')](handleError(_0x335713,null));};function checkWebsiteInterval(_0x2164d4){var _0x7e3d22=_0x2164d4[_0xd81b('0x9e')];if(!_0x7e3d22){return Promise[_0xd81b('0x9f')](_0x2164d4);}var _0x1b0156=_0x2164d4[_0xd81b('0xa0')]||undefined;return _0x7e3d22[_0xd81b('0xa1')](_0x1b0156)['then'](function(_0x8cda4b){if(!_0x8cda4b){throw new APIOutOfIntervalError();}return _0x2164d4;});}exports[_0xd81b('0xa2')]=function(_0x22dd20,_0x2ea321){var _0x305014={'body':_0x22dd20[_0xd81b('0x69')],'channel':_0xd81b('0xa3')};var _0x10382d=[];var _0x282942=[];var _0x24a88b={};var _0x48e6ba=![];if(_0x22dd20[_0xd81b('0x69')]['id']){delete _0x22dd20[_0xd81b('0x69')]['id'];}if(_['isNil'](_0x22dd20[_0xd81b('0x69')]['from'])){throw new APIBadRequestError(_0xd81b('0xa4'));}if(_[_0xd81b('0x93')](_0x22dd20['body'][_0xd81b('0xa5')])){throw new APIBadRequestError(_0xd81b('0xa6'));}if(_[_0xd81b('0xa7')](_0x22dd20[_0xd81b('0x69')]['body'])){throw new APIBadRequestError(_0xd81b('0xa8'));}var _0x3a248d=_0x22dd20[_0xd81b('0x69')][_0xd81b('0x38')]&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0x40')];return db['CmContact'][_0xd81b('0x78')]()[_0xd81b('0x1c')](function(_0x14a219){if(!_0x14a219){throw new Error('No\x20available\x20attributes');}_0x10382d=Object['keys'](_0x14a219)[_0xd81b('0x5f')](function(_0x322771){return![_0xd81b('0xa9'),'updatedAt'][_0xd81b('0xaa')](_0x322771);});_0x282942=Object[_0xd81b('0x53')](_0x14a219)[_0xd81b('0x5f')](function(_0x4719f3){return![_0xd81b('0xa9'),_0xd81b('0xab'),'CompanyId',_0xd81b('0xac')][_0xd81b('0xaa')](_0x4719f3);});if(!_['includes'](_0x282942,_0x22dd20[_0xd81b('0x69')][_0xd81b('0xa5')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x282942[_0xd81b('0x8f')](',\x20'));}_0x24a88b[_0x22dd20[_0xd81b('0x69')][_0xd81b('0xa5')]]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xad')];})[_0xd81b('0x1c')](function(){return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x22dd20[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0xae')],'as':'List','include':[{'model':db[_0xd81b('0xaf')],'as':_0xd81b('0xb0'),'where':_0x24a88b,'limit':0x1,'order':[['updatedAt',_0xd81b('0xb1')]]}]},{'model':db[_0xd81b('0xb2')],'as':_0xd81b('0xb3')},{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0x9e'),'include':[{'model':db['Interval'],'as':_0xd81b('0xb4'),'attributes':['id',_0xd81b('0xb5')],'raw':!![]}]}]});})[_0xd81b('0x1c')](function(_0x9658e){if(!_0x9658e){throw new APINotFoundError(util[_0xd81b('0x43')](_0xd81b('0xb6'),_0x22dd20[_0xd81b('0x64')]['id']));}if(_0x3a248d){return checkWebsiteInterval(_0x9658e);}return _0x9658e;})[_0xd81b('0x1c')](function(_0x44d405){_0x305014[_0xd81b('0xb7')]=_0x44d405;_0x305014[_0xd81b('0xb8')]=_['orderBy'](_0x44d405['Applications'],[_0xd81b('0xb9')],[_0xd81b('0xba')]);if(_0x305014[_0xd81b('0xb7')]['Applications']){delete _0x305014[_0xd81b('0xb7')][_0xd81b('0xb3')];}_0x305014[_0xd81b('0xbb')]=_0x44d405['List']||{'id':_0x44d405[_0xd81b('0xac')]};if(_0x305014[_0xd81b('0xbb')]&&_0x305014['list'][_0xd81b('0xb0')][_0xd81b('0x58')]){return _0x305014[_0xd81b('0xbb')][_0xd81b('0xb0')][0x0];}var _0x8026d7=_[_0xd81b('0x16')](_0x22dd20[_0xd81b('0x69')],{'firstName':_0x22dd20['body'][_0xd81b('0xad')],'ListId':_0x44d405[_0xd81b('0xac')]});_0x8026d7[_0x22dd20['body'][_0xd81b('0xa5')]]=_0x22dd20['body'][_0xd81b('0xad')];return db[_0xd81b('0xaf')][_0xd81b('0x68')](_0x8026d7,{'fields':_0x10382d,'raw':!![]});})[_0xd81b('0x1c')](function(_0x3a6e15){_0x305014[_0xd81b('0xbc')]=_0x3a6e15;var _0x87b315=createInteractionObject(_0x22dd20['params']['id'],_0x22dd20[_0xd81b('0x69')],_0x22dd20['headers'],_0x3a6e15);var _0x48073b={'ChatWebsiteId':_0x22dd20[_0xd81b('0x64')]['id']};if(_0x22dd20['body'][_0xd81b('0xbd')]){_0x48073b[_0xd81b('0xbd')]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')];_0x48073b['closed']=![];return db['ChatInteraction'][_0xd81b('0x67')]({'where':_0x48073b})[_0xd81b('0x1c')](function(_0x50529b){var _0x2ec729=_0x22dd20[_0xd81b('0x69')][_0xd81b('0x38')]&&_0x22dd20['body'][_0xd81b('0x40')];if(_0x50529b){_0x48e6ba=!![];return _0x50529b;}else if(!_0x2ec729&&_0x50529b&&_0x50529b[_0xd81b('0xbe')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x87b315[_0xd81b('0xbd')]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')];_0x87b315[_0xd81b('0xbf')]=_0x22dd20[_0xd81b('0x69')]['externalUrl'];return db['ChatInteraction'][_0xd81b('0x68')](_0x87b315);});}_0x48073b[_0xd81b('0xc0')]=_0x3a6e15['id'];if(_0x22dd20[_0xd81b('0x69')][_0xd81b('0xc1')]&&_0x22dd20['body'][_0xd81b('0xc1')]['id']){_0x48073b['id']=_0x22dd20['body'][_0xd81b('0xc1')]['id'];return db[_0xd81b('0xc2')]['find']({'where':_0x48073b})[_0xd81b('0x1c')](function(_0x264d72){var _0x1d5dac=_0x22dd20['body'][_0xd81b('0x38')]&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0x40')];if(!_0x1d5dac&&_0x264d72&&_0x264d72['closed']){throw new APIConflictError(_0xd81b('0xc3'));}else if(_0x264d72){_0x48e6ba=!![];return _0x264d72;}else{return db[_0xd81b('0xc2')][_0xd81b('0x68')](_0x87b315);}});}return db[_0xd81b('0xc2')][_0xd81b('0x68')](_0x87b315);})['then'](function(_0x5c3dce){if(!_0x48e6ba){return _0x5c3dce;}var _0x105735={'from':(_0x305014[_0xd81b('0xbc')][_0xd81b('0x3d')]||'')+'\x20'+(_0x305014[_0xd81b('0xbc')]['lastName']||'')};if(_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')]&&_0x22dd20[_0xd81b('0x69')]['messageId']&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')]!=_0x22dd20[_0xd81b('0x69')]['messageId']){_0x105735['threadId']=_0x22dd20['body'][_0xd81b('0xc4')];}return _0x5c3dce['update'](_0x105735);})[_0xd81b('0x1c')](function(_0x3d7a57){_0x305014[_0xd81b('0xc1')]=_0x3d7a57['get']({'plain':!![]});_0x305014['interaction'][_0xd81b('0xc5')]=!_0x48e6ba;if(_0x305014['interaction'][_0xd81b('0xc5')]){if(_0x305014[_0xd81b('0xb7')][_0xd81b('0xc6')]){_0x305014[_0xd81b('0xb8')]['push']({'id':0x0,'priority':_0x305014[_0xd81b('0xb8')][_0xd81b('0x58')]+0x1,'app':_0xd81b('0xc7'),'appdata':'unmanaged','interval':_0xd81b('0xc8')});}}return db['ChatMessage'][_0xd81b('0x68')]({'body':_0x22dd20[_0xd81b('0x69')]['body'],'ChatWebsiteId':_0x22dd20[_0xd81b('0x64')]['id'],'ChatInteractionId':_0x3d7a57['id'],'direction':'in','ContactId':_0x305014[_0xd81b('0xbc')]['id'],'AttachmentId':_0x22dd20[_0xd81b('0x69')]['AttachmentId']});})['then'](function(_0x1c10da){_0x305014[_0xd81b('0x25')]=_0x1c10da;if(!_0x305014[_0xd81b('0xc1')][_0xd81b('0xc9')]){return;}return db[_0xd81b('0xca')][_0xd81b('0x67')]({'attributes':['id',_0xd81b('0x33')],'where':{'id':_0x305014['interaction']['UserId']}});})[_0xd81b('0x1c')](function(_0x10f27c){if(_0x10f27c){_0x305014[_0xd81b('0xb8')][_0xd81b('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x10f27c[_0xd81b('0x33')]+','+(_0x305014[_0xd81b('0xb7')][_0xd81b('0xcc')]||0xa),'interval':_0xd81b('0xc8')});_0x305014[_0xd81b('0xcd')]=!![];}if(!_0x305014['interaction']['queueId']){return;}return db[_0xd81b('0xce')][_0xd81b('0x67')]({'attributes':['id',_0xd81b('0x33')],'where':{'id':_0x305014[_0xd81b('0xc1')][_0xd81b('0xcf')]}});})['then'](function(_0x49e5dd){if(_0x49e5dd){_0x305014[_0xd81b('0xb8')]['unshift']({'id':0x0,'priority':0x1,'app':_0xd81b('0xd0'),'appdata':_0x49e5dd[_0xd81b('0x33')]+','+(_0x305014[_0xd81b('0xb7')][_0xd81b('0xd1')]||0x12c),'interval':_0xd81b('0xc8')});}return respondWithRpcPromise(_0xd81b('0xd2'),_0xd81b('0xd3'),_0x305014);})[_0xd81b('0x1c')](function(_0x538cc2){respondWithRpcPromise(_0xd81b('0xd4'),_0xd81b('0xd4'),{'event':_0xd81b('0xa2'),'message':_0x538cc2},client9002);return _0x538cc2;})[_0xd81b('0x1c')](respondWithResult(_0x2ea321,null))[_0xd81b('0x27')](APIHandleError(_0x2ea321));};exports[_0xd81b('0xd5')]=function(_0x2f4b2b,_0x59779e){var _0x1e184c,_0x5d6b18,_0x19eef8;var _0x520762=[];var _0x36650d={};var _0x1c5923=_0x2f4b2b['files']||[];var _0x16865b=[];var _0x522616;return db[_0xd81b('0xaf')][_0xd81b('0x78')]()['then'](function(_0x98f92e){if(!_0x98f92e){throw new db['Sequelize'][(_0xd81b('0xd6'))](_0xd81b('0xd7'));}_0x520762=_[_0xd81b('0xd8')](_[_0xd81b('0x53')](_0x98f92e),[_0xd81b('0xa9'),_0xd81b('0xab'),_0xd81b('0xd9'),_0xd81b('0xac')]);if(_0x2f4b2b[_0xd81b('0x69')]['id']){delete _0x2f4b2b[_0xd81b('0x69')]['id'];}if(_[_0xd81b('0x93')](_0x2f4b2b[_0xd81b('0x69')]['from'])){throw _0x59779e[_0xd81b('0x29')](0x1f4)['send'](new db[(_0xd81b('0xda'))][(_0xd81b('0xd6'))](_0xd81b('0xdb')));}if(_[_0xd81b('0x93')](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0x69')])||_0x2f4b2b[_0xd81b('0x69')]['body']===''){throw _0x59779e[_0xd81b('0x29')](0x1f4)['send'](new db[(_0xd81b('0xda'))]['ValidationError'](_0xd81b('0xdc')));}if(_['isNil'](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0xdd')])){throw _0x59779e[_0xd81b('0x29')](0x1f4)[_0xd81b('0x34')](new db['Sequelize'][(_0xd81b('0xd6'))](_0xd81b('0xde')+_0x520762));}if(!_['includes'](_0x520762,_0x2f4b2b['body']['mapKeyOffline'])){throw _0x59779e[_0xd81b('0x29')](0x1f4)[_0xd81b('0x34')](new db[(_0xd81b('0xda'))][(_0xd81b('0xd6'))](_0xd81b('0xdf')+_0x520762));}_0x36650d[_0x2f4b2b[_0xd81b('0x69')]['mapKeyOffline']]=_0x2f4b2b['body'][_0xd81b('0xad')];})['then'](function(){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x2f4b2b[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0xae')],'as':_0xd81b('0xe0')},{'model':db[_0xd81b('0xe1')],'as':_0xd81b('0xe1')}]});})[_0xd81b('0x1c')](handleEntityNotFound(_0x59779e,null))[_0xd81b('0x1c')](function(_0x28cbe7){if(_0x28cbe7&&_0x28cbe7[_0xd81b('0xe0')]){_0x5d6b18=_0x28cbe7;var _0x30abaf=_[_0xd81b('0x16')](_0x2f4b2b[_0xd81b('0x69')],{'firstName':_0x2f4b2b['body'][_0xd81b('0xad')],'phone':_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0xad')],'ListId':_0x28cbe7[_0xd81b('0xac')]});_0x30abaf[_0x2f4b2b[_0xd81b('0x69')]['mapKeyOffline']]=_0x2f4b2b[_0xd81b('0x69')]['from'];return db['CmContact'][_0xd81b('0xe2')]({'where':_0x36650d,'defaults':_0x30abaf});}})['spread'](function(_0x126aaa){if(_0x126aaa){_0x19eef8=_0x126aaa;var _0x3e8623=fs[_0xd81b('0xe3')](path['join'](config[_0xd81b('0x90')],_0xd81b('0xe4')),_0xd81b('0xe5'));var _0x576d9d=ejs[_0xd81b('0xe6')](_0x3e8623,{'body':_[_0xd81b('0xe7')](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0x69')]),'bodyTitle':_0x5d6b18[_0xd81b('0xe8')]});return db[_0xd81b('0xe9')]['create']({'body':_0x576d9d,'plainBody':htmlToText[_0xd81b('0xea')](_0x576d9d),'ContactId':_0x126aaa['id'],'ChatWebsiteId':_0x5d6b18['id']});}})[_0xd81b('0x1c')](function(_0x3b6ed5){_0x522616=_0x3b6ed5;if(_0x1c5923[_0xd81b('0x58')]){var _0x11b997=_0x1c5923[_0xd81b('0x4d')](function(_0x3ec25d){return{'name':_0x3ec25d[_0xd81b('0xeb')],'basename':_0x3ec25d[_0xd81b('0x87')],'type':_0x3ec25d['mimetype'],'ChatOfflineMessageId':_0x3b6ed5['id']};});_0x16865b=_0x11b997[_0xd81b('0x4d')](_0x10a82f=>{var _0x255f26={'filename':_0x10a82f[_0xd81b('0x33')],'path':path['join'](config[_0xd81b('0x90')],_0xd81b('0xec'),_0xd81b('0xed'),'attachments',_0xd81b('0xee'),_0x10a82f[_0xd81b('0xef')])};return _0x255f26;});if(!_0x5d6b18[_0xd81b('0xf0')]){return db[_0xd81b('0xf1')][_0xd81b('0xf2')](function(_0x4f1d2b){return db[_0xd81b('0xf3')][_0xd81b('0xf4')](_0x11b997,{'transaction':_0x4f1d2b});});}}})[_0xd81b('0x1c')](function(){if(_0x522616){_0x1e184c=_0x522616;return db['MailAccount'][_0xd81b('0x83')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xd81b('0xf5')],'as':_0xd81b('0xf5'),'raw':!![]}]}]});}})['then'](function(_0x2e4523){if(_0x2e4523&&_0x2e4523['Smtp']&&_0x5d6b18[_0xd81b('0xf6')]&&_0x5d6b18[_0xd81b('0xf7')]){var _0x3a10ac=_0x2e4523[_0xd81b('0xf8')]();return respondWithRpcPromise('SendMail',_0xd81b('0xf9'),{'account':_0x3a10ac,'message':{'from':util[_0xd81b('0x43')](_0xd81b('0xfa'),_0x2e4523[_0xd81b('0x33')],_0x2e4523[_0xd81b('0xfb')]||_0x2e4523[_0xd81b('0xfc')]['user']),'to':_0x5d6b18[_0xd81b('0xf7')],'subject':_0x5d6b18['offlineMessageSubject'],'html':_0x1e184c['body'],'attachments':_0x16865b}},client9003)[_0xd81b('0x1c')](function(){return _0x1e184c;})[_0xd81b('0x27')](function(_0xb2d684){logger['error'](_0xb2d684);});}})[_0xd81b('0x1c')](function(){if(_0x5d6b18&&_0x5d6b18[_0xd81b('0xf0')]&&_0x5d6b18['MailAccountId']){var _0x50fbfd=[];if(_0x1c5923[_0xd81b('0x58')]){_0x50fbfd=_0x1c5923[_0xd81b('0x4d')](function(_0x44e2a8){return{'name':_0x44e2a8[_0xd81b('0xeb')],'basename':_0x44e2a8[_0xd81b('0x87')],'type':_0x44e2a8[_0xd81b('0xfd')],'ChatOfflineMessageId':_0x522616['id']};});}var _0x462925;if(!_[_0xd81b('0x93')](_0x5d6b18[_0xd81b('0xfe')])){var _0x41d12a=_[_0xd81b('0x4d')](_0x2f4b2b[_0xd81b('0x69')],function(_0x2f3170){return _0x2f3170;});var _0xfc4221=_['toPairsIn'](_0x41d12a)[0x0];var _0x25939f=_[_0xd81b('0xff')](_0xfc4221,function(_0x5a7cb8){return _0x5a7cb8;});_0x462925=_0x25939f[0x1][_0x5d6b18[_0xd81b('0xfe')]];}var _0x250cd7={'from':_0x19eef8[_0xd81b('0xfb')],'firstName':_0x19eef8[_0xd81b('0x3d')],'lastName':_0x19eef8['lastName'],'mapKey':_0xd81b('0xfb'),'message':{'from':_0x19eef8[_0xd81b('0xfb')],'to':_0x5d6b18[_0xd81b('0xe1')][_0xd81b('0xfb')],'cc':'','subject':_[_0xd81b('0x93')](_0x462925)?_0x5d6b18[_0xd81b('0x100')]:_0x462925,'messageId':'','sentAt':new Date(),'attach':_0x50fbfd['length'],'attachments':_0x50fbfd,'originChannel':_0xd81b('0x101'),'ChatWebsiteId':_0x5d6b18['id'],'ChatOfflineMessageId':_0x1e184c['id'],'originTo':_0x5d6b18[_0xd81b('0xe1')][_0xd81b('0xfb')]},'body':_0x1e184c[_0xd81b('0x69')]};var _0x35320d={'account':{'id':_0x5d6b18[_0xd81b('0x102')]},'body':_0x250cd7,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xd81b('0x103'),_0x35320d,client9001)[_0xd81b('0x1c')](function(){return _0x1e184c;})[_0xd81b('0x27')](function(_0x3c329e){logger['error'](_0x3c329e);});}return;})[_0xd81b('0x1c')](function(){if(_0x1e184c){return _0x1e184c;}})[_0xd81b('0x1c')](respondWithResult(_0x59779e,null))[_0xd81b('0x27')](function(){for(var _0x468794 of _0x1c5923){var _0x1c3473=path['join'](config[_0xd81b('0x90')],'server',_0xd81b('0xed'),_0xd81b('0x104'),'offline-chat',_0x468794['filename']);fs_extra[_0xd81b('0x105')](_0x1c3473)['catch'](function(_0x5f1c6b){logger[_0xd81b('0x23')](_0xd81b('0x106'),_0x1c3473,_0x5f1c6b);});}});};exports[_0xd81b('0x107')]=function(_0x56195b,_0x584698){return db[_0xd81b('0xc2')][_0xd81b('0x67')]({'where':{'id':_0x56195b[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x584698,null))[_0xd81b('0x1c')](function(_0xae9cb8){if(_0xae9cb8){return _0xae9cb8['addInteraction'](_0x56195b['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x56195b[_0xd81b('0x69')],['ids','id'])||{});}})[_0xd81b('0x1c')](respondWithResult(_0x584698,null))[_0xd81b('0x27')](handleError(_0x584698,null));};exports['getInteractions']=function(_0x22e159,_0x3d3ee1){var _0x31e7f7={'raw':![],'where':{}};var _0x4850d8={};var _0x51c975={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0x22e159[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x3d3ee1,null))[_0xd81b('0x1c')](function(_0x525220){if(_0x525220){_0x4850d8[_0xd81b('0x46')]=_[_0xd81b('0x53')](db['ChatInteraction'][_0xd81b('0x4f')]);_0x4850d8[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x22e159['query']);_0x4850d8[_0xd81b('0x54')]=_['intersection'](_0x4850d8[_0xd81b('0x46')],_0x4850d8['query']);_0x31e7f7[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x4850d8[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x22e159[_0xd81b('0x52')][_0xd81b('0x57')]));_0x31e7f7['attributes']=_0x31e7f7['attributes'][_0xd81b('0x58')]?_0x31e7f7[_0xd81b('0x56')]:_0x4850d8[_0xd81b('0x46')];if(!_0x22e159[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x31e7f7[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x22e159['query'][_0xd81b('0x2f')]);_0x31e7f7[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x22e159[_0xd81b('0x52')]['offset']);}_0x31e7f7[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x22e159[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x31e7f7['where']=qs[_0xd81b('0x54')](_['pick'](_0x22e159['query'],_0x4850d8[_0xd81b('0x54')]));_0x31e7f7[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x525220['id'];if(_0x22e159[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x31e7f7[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x31e7f7['where'],{'$or':_[_0xd81b('0x4d')](_0x31e7f7[_0xd81b('0x56')],function(_0x16ef58){var _0x3b4240={};_0x3b4240[_0x16ef58]={'$like':'%'+_0x22e159['query'][_0xd81b('0x5f')]+'%'};return _0x3b4240;})});}_0x31e7f7=_[_0xd81b('0x60')]({},_0x31e7f7,_0x22e159['options']);return db[_0xd81b('0xc2')]['count']({'where':_0x31e7f7[_0xd81b('0x5d')]})['then'](function(_0x54062e){_0x51c975[_0xd81b('0x2e')]=_0x54062e;if(_0x22e159[_0xd81b('0x52')][_0xd81b('0x62')]){_0x31e7f7[_0xd81b('0x63')]=[{'model':db['CmContact'],'as':_0xd81b('0x109'),'required':![]},{'model':db['User'],'as':_0xd81b('0x10a'),'attributes':[_0xd81b('0x33'),_0xd81b('0x10b'),_0xd81b('0x10c')],'required':![]},{'model':db[_0xd81b('0x10d')],'as':_0xd81b('0x10e'),'attributes':['id',_0xd81b('0x33'),_0xd81b('0x10f')],'where':_0x22e159[_0xd81b('0x52')]['tag']?{'id':_0x22e159[_0xd81b('0x52')][_0xd81b('0x110')]}:undefined,'required':_0x22e159[_0xd81b('0x52')][_0xd81b('0x110')]?!![]:![]}];}return db[_0xd81b('0xc2')][_0xd81b('0x7c')](_0x31e7f7);})[_0xd81b('0x1c')](function(_0x23139c){_0x51c975[_0xd81b('0x7d')]=_0x23139c;return _0x51c975;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x3d3ee1,_0x31e7f7))['catch'](handleError(_0x3d3ee1,null));};exports[_0xd81b('0x111')]=function(_0x432b04,_0x2ff8f6){var _0x30a57a=0x0;var _0x25f776=0x0;var _0x1313da=![];var _0x115026;var _0x202316;return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x432b04[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0x9e'),'include':[{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0xb4'),'attributes':['id',_0xd81b('0xb5')]}]}]})[_0xd81b('0x1c')](handleEntityNotFound(_0x2ff8f6,null))['then'](function(_0x16ccac){if(_0x16ccac){_0x115026=_0x16ccac;return _0x16ccac['getProactiveActions']({'raw':!![]});}})[_0xd81b('0x1c')](function(_0x1c3879){if(_0x115026){if(_0x1c3879){_0x202316=_0x1c3879;}}return require(_0xd81b('0x91'))[_0xd81b('0x92')]();})[_0xd81b('0x1c')](function(_0x4e6c6d){if(_0x4e6c6d){_0x25f776=_0x4e6c6d[_0xd81b('0x112')];_0x1313da=_0x4e6c6d[_0xd81b('0x113')];}})[_0xd81b('0x1c')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xd81b('0x1c')](function(_0x366808){_0x30a57a=_0x366808;if(_0x25f776&&_0x366808>_0x25f776){return db['License'][_0xd81b('0x83')]({'where':{'id':0x1}})[_0xd81b('0x1c')](function(_0x2ac7d3){if(_0x2ac7d3){_0x2ac7d3[_0xd81b('0x114')](_0xd81b('0x115'));}});}})[_0xd81b('0x1c')](function(){var _0x203fbe=_0x115026[_0xd81b('0x9e')];var _0xf1f6f2=_0x115026[_0xd81b('0xa0')]||undefined;return _0x203fbe?_0x203fbe[_0xd81b('0xa1')](_0xf1f6f2):!![];})[_0xd81b('0x1c')](function(_0xe0b626){var _0x5a187a=fs[_0xd81b('0xe3')](path['join'](config[_0xd81b('0x90')],_0xd81b('0x116')),_0xd81b('0xe5'));var _0x4cb573=_0xd81b('0x117');var _0x53d707=![];var _0x480fab,_0x1685e6;if(_0x432b04[_0xd81b('0x118')]['referer']){_0x480fab=new URL(_0x432b04['headers'][_0xd81b('0x40')])[_0xd81b('0x119')];}else if(_0x432b04[_0xd81b('0x118')][_0xd81b('0x119')]){_0x480fab=new URL(_0x432b04[_0xd81b('0x118')]['origin'])[_0xd81b('0x119')];}else{_0x480fab=_0xd81b('0x11a');}_0x1685e6=typeof _0x115026[_0xd81b('0x6a')][_0xd81b('0x3c')](',')['find'](function(_0x549d83){return wildcardUtils[_0xd81b('0x11b')](_0x549d83,_0x480fab);})!==_0xd81b('0x2d');var _0x39eb20={'chatVersion':_0x4cb573,'chatWebsiteAddressOrigin':_0x1685e6?_0x480fab:_0x115026[_0xd81b('0x6a')],'remote':_0x115026[_0xd81b('0x11c')],'query':querystring[_0xd81b('0x22')](_['merge'](_0x115026[_0xd81b('0x70')]({'plain':!![]}),{'customerIp':_0x432b04[_0xd81b('0x118')]['x-forwarded-for']||_0x432b04[_0xd81b('0x118')][_0xd81b('0x11d')]||_0x432b04[_0xd81b('0x11e')][_0xd81b('0x11f')]||_0x432b04['ip'],'referer':_0x432b04['headers'][_0xd81b('0x40')],'openedInteractions':_0x30a57a,'maxInteractions':_0x25f776,'virtual':_0x1313da[_0xd81b('0x112')],'online':_0xe0b626,'custom':_0x1313da,'address':_0x1685e6?_0x480fab:null}))[_0xd81b('0x120')](/'/g,'\x5c\x27')};_0x2ff8f6[_0xd81b('0x34')](ejs[_0xd81b('0xe6')](Mustache[_0xd81b('0xe6')](_0x5a187a,_0x39eb20),{'proactiveActions':_0x202316,'alignment':_0x115026[_0xd81b('0x121')],'verticalAlignment':_0x115026[_0xd81b('0x122')],'div_color':_0x115026[_0xd81b('0x10f')],'labelText':_0x115026[_0xd81b('0x123')],'text_color':_0x115026[_0xd81b('0x124')],'text_button_color':_0x115026['textButtonColor'],'button_color':_0x115026[_0xd81b('0x125')],'background_color':_0x115026[_0xd81b('0x126')],'hideWhenOffline':_0x115026[_0xd81b('0x127')],'intervalId':_0x115026[_0xd81b('0x128')],'isDevelopment':_0x53d707,'chatVersion':_0x4cb573}));})[_0xd81b('0x27')](handleError(_0x2ff8f6,null));};exports[_0xd81b('0x129')]=function(_0x2eefbd,_0x2883fe){var _0x34cf85=_0x2eefbd[_0xd81b('0x64')]['id'];var _0x4eae4a=_0x2eefbd[_0xd81b('0x69')];var _0x388752=0xc8;var _0x580b1f=null;return db[_0xd81b('0xf1')][_0xd81b('0xf2')]({'isolationLevel':db[_0xd81b('0xf1')][_0xd81b('0x12a')]['ISOLATION_LEVELS'][_0xd81b('0x12b')]},function(_0x33d580){return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0x34cf85},'transaction':_0x33d580})[_0xd81b('0x1c')](function(_0x386b39){if(_0x386b39){return db[_0xd81b('0xb2')][_0xd81b('0x31')]({'where':{'ChatWebsiteId':_0x34cf85},'transaction':_0x33d580})[_0xd81b('0x1c')](function(){var _0x3c839c=_[_0xd81b('0x4d')](_0x4eae4a,function(_0x9bbfea){_0x9bbfea[_0xd81b('0x80')]=_0x34cf85;return _0x9bbfea;});return db[_0xd81b('0xb2')][_0xd81b('0xf4')](_0x3c839c,{'transaction':_0x33d580});});}else{_0x388752=0x194;_0x580b1f=[];}});})['then'](function(){if(_0x388752!==0x194){return db[_0xd81b('0xb2')][_0xd81b('0x12c')]({'where':{'ChatWebsiteId':_0x34cf85},'order':_0xd81b('0xb9')})['then'](function(_0x5ae954){_0x580b1f=_0x5ae954;});}})[_0xd81b('0x27')](function(_0x5ab098){_0x388752=0x1f4;logger[_0xd81b('0x23')](_0x5ab098['stack']);if(_0x5ab098[_0xd81b('0x33')]){delete _0x5ab098[_0xd81b('0x33')];}_0x580b1f=_0x5ab098;})[_0xd81b('0x12d')](function(){if(_0x580b1f===null){_0x2883fe[_0xd81b('0x28')](_0x388752);}else{if(_0x388752===0x1f4){_0x2883fe['status'](_0x388752)['send'](_0x580b1f);}else{_0x2883fe[_0xd81b('0x29')](_0x388752)[_0xd81b('0x2b')](_0x580b1f);}}});};exports[_0xd81b('0x12e')]=function(_0x1e841d,_0x6121cf){var _0x15ce6c={};var _0x29e6d9={};var _0x57ef3b;var _0xf7cefc;return db['ChatWebsite']['findOne']({'where':{'id':_0x1e841d[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x6121cf,null))['then'](function(_0x28e08c){if(_0x28e08c){_0x57ef3b=_0x28e08c;_0x29e6d9[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0xb2')][_0xd81b('0x4f')]);_0x29e6d9[_0xd81b('0x52')]=_['keys'](_0x1e841d['query']);_0x29e6d9[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x29e6d9['model'],_0x29e6d9['query']);_0x15ce6c[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x29e6d9['model'],qs[_0xd81b('0x57')](_0x1e841d[_0xd81b('0x52')]['fields']));_0x15ce6c[_0xd81b('0x56')]=_0x15ce6c[_0xd81b('0x56')][_0xd81b('0x58')]?_0x15ce6c['attributes']:_0x29e6d9[_0xd81b('0x46')];_0x15ce6c[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x15ce6c['where']=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x1e841d[_0xd81b('0x52')],_0x29e6d9[_0xd81b('0x54')]));if(_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x15ce6c[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x15ce6c[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x15ce6c['attributes'],function(_0x407136){var _0x3b5455={};_0x3b5455[_0x407136]={'$like':'%'+_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x3b5455;})});}_0x15ce6c=_[_0xd81b('0x60')]({},_0x15ce6c,_0x1e841d[_0xd81b('0x66')]);return _0x57ef3b[_0xd81b('0x12e')](_0x15ce6c);}})['then'](function(_0x5b1898){if(_0x5b1898){_0xf7cefc=_0x5b1898[_0xd81b('0x58')];if(!_0x1e841d[_0xd81b('0x52')][_0xd81b('0x59')]('nolimit')){_0x15ce6c[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x15ce6c[_0xd81b('0x2c')]=qs['offset'](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x57ef3b[_0xd81b('0x12e')](_0x15ce6c);}})[_0xd81b('0x1c')](function(_0x89764a){if(_0x89764a){return _0x89764a?{'count':_0xf7cefc,'rows':_0x89764a}:null;}})[_0xd81b('0x1c')](respondWithResult(_0x6121cf,null))[_0xd81b('0x27')](handleError(_0x6121cf,null));};exports['addProactiveActions']=function(_0x5a8445,_0x47a903){return db['chatProactiveAction']['find']({'where':{'id':_0x5a8445[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x47a903,null))[_0xd81b('0x1c')](function(_0x4d4feb){if(_0x4d4feb){return _0x4d4feb[_0xd81b('0x12f')](_0x5a8445['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x5a8445[_0xd81b('0x69')],['ids','id'])||{});}})[_0xd81b('0x1c')](respondWithResult(_0x47a903,null))[_0xd81b('0x27')](handleError(_0x47a903,null));};exports[_0xd81b('0x130')]=function(_0xd09d12,_0x251bf4){var _0x3682e4={};var _0x49f9d1={};var _0x5c97b9;var _0x1e4634;return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0xd09d12[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x251bf4,null))[_0xd81b('0x1c')](function(_0x4e3323){if(_0x4e3323){_0x5c97b9=_0x4e3323;_0x49f9d1[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0x131')][_0xd81b('0x4f')]);_0x49f9d1['query']=_['keys'](_0xd09d12[_0xd81b('0x52')]);_0x49f9d1[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x49f9d1[_0xd81b('0x46')],_0x49f9d1[_0xd81b('0x52')]);_0x3682e4[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x49f9d1['model'],qs[_0xd81b('0x57')](_0xd09d12['query']['fields']));_0x3682e4['attributes']=_0x3682e4[_0xd81b('0x56')][_0xd81b('0x58')]?_0x3682e4[_0xd81b('0x56')]:_0x49f9d1[_0xd81b('0x46')];_0x3682e4[_0xd81b('0x5b')]=qs['sort'](_0xd09d12[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x3682e4[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_['pick'](_0xd09d12['query'],_0x49f9d1[_0xd81b('0x54')]));if(_0xd09d12[_0xd81b('0x52')]['filter']){_0x3682e4[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x3682e4[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x3682e4[_0xd81b('0x56')],function(_0x111dd0){var _0x37301b={};_0x37301b[_0x111dd0]={'$like':'%'+_0xd09d12['query']['filter']+'%'};return _0x37301b;})});}_0x3682e4=_[_0xd81b('0x60')]({},_0x3682e4,_0xd09d12['options']);return _0x5c97b9[_0xd81b('0x130')](_0x3682e4);}})['then'](function(_0x222acd){if(_0x222acd){_0x1e4634=_0x222acd[_0xd81b('0x58')];if(!_0xd09d12[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x3682e4[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0xd09d12[_0xd81b('0x52')]['limit']);_0x3682e4[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0xd09d12[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x5c97b9[_0xd81b('0x130')](_0x3682e4);}})['then'](function(_0x3c96d4){if(_0x3c96d4){return _0x3c96d4?{'count':_0x1e4634,'rows':_0x3c96d4}:null;}})['then'](respondWithResult(_0x251bf4,null))[_0xd81b('0x27')](handleError(_0x251bf4,null));};exports[_0xd81b('0x132')]=function(_0x4387a7,_0x24fc43){var _0x498cc0=_0x4387a7[_0xd81b('0x52')][_0xd81b('0x133')]===_0xd81b('0x134')?_0xd81b('0x135'):_0xd81b('0x136');return db[_0xd81b('0x4e')]['find']({'attributes':['id',_0x498cc0],'where':{'id':_0x4387a7[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x24fc43,null))[_0xd81b('0x1c')](function(_0x597c54){if(_0x597c54){var _0x4e792e=_0x597c54[_0x498cc0];var _0x58e782=_0x4e792e&&_0x4e792e[_0xd81b('0x137')]?_0x4e792e['items']:[];_0x24fc43[_0xd81b('0x34')]({'fromKey':_[_0xd81b('0x93')](_0x4e792e['fromKey'])?undefined:_0x4e792e[_0xd81b('0x138')],'count':_0x58e782[_0xd81b('0x58')],'rows':_0x58e782});}})[_0xd81b('0x27')](handleError(_0x24fc43,null));};exports['getOfflineMessages']=function(_0x5f10b0,_0x19ff30){var _0x398e61={'raw':![],'where':{}};var _0xcb2433={};var _0x32573b={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')]['findOne']({'where':{'id':_0x5f10b0['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x19ff30,null))[_0xd81b('0x1c')](function(_0x1eea94){if(_0x1eea94){_0xcb2433[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0xe9')]['rawAttributes']);_0xcb2433['query']=_[_0xd81b('0x53')](_0x5f10b0[_0xd81b('0x52')]);_0xcb2433[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0xcb2433['model'],_0xcb2433[_0xd81b('0x52')]);_0x398e61['attributes']=_[_0xd81b('0x55')](_0xcb2433['model'],qs[_0xd81b('0x57')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x57')]));_0x398e61['attributes']=_0x398e61[_0xd81b('0x56')][_0xd81b('0x58')]?_0x398e61[_0xd81b('0x56')]:_0xcb2433[_0xd81b('0x46')];if(!_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x398e61[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x5f10b0['query'][_0xd81b('0x2f')]);_0x398e61[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x2c')]);}_0x398e61[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x398e61[_0xd81b('0x5d')]=qs['filters'](_[_0xd81b('0x5e')](_0x5f10b0[_0xd81b('0x52')],_0xcb2433[_0xd81b('0x54')]));_0x398e61[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x1eea94['id'];if(_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x398e61[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x398e61['where'],{'$or':_['map'](_0x398e61[_0xd81b('0x56')],function(_0x56f4c8){var _0xa5dd60={};_0xa5dd60[_0x56f4c8]={'$like':'%'+_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0xa5dd60;})});}_0x398e61=_[_0xd81b('0x60')]({},_0x398e61,_0x5f10b0[_0xd81b('0x66')]);return db[_0xd81b('0xe9')][_0xd81b('0x2e')]({'where':_0x398e61[_0xd81b('0x5d')]})['then'](function(_0x443a17){_0x32573b[_0xd81b('0x2e')]=_0x443a17;if(_0x5f10b0['query'][_0xd81b('0x62')]){_0x398e61[_0xd81b('0x63')]=[{'all':!![]}];}else{_0x398e61['include']=[{'model':db['CmContact'],'as':_0xd81b('0x109'),'required':![]},{'model':db[_0xd81b('0xf3')],'as':_0xd81b('0x139'),'required':![]}];}return db[_0xd81b('0xe9')][_0xd81b('0x7c')](_0x398e61);})[_0xd81b('0x1c')](function(_0x57da47){_0x32573b[_0xd81b('0x7d')]=_0x57da47;return _0x32573b;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x19ff30,_0x398e61))['catch'](handleError(_0x19ff30,null));};exports[_0xd81b('0x13a')]=function(_0x207681,_0x212f03){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x207681[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x212f03,null))[_0xd81b('0x1c')](function(_0x3ea155){if(_0x3ea155){return _0x3ea155[_0xd81b('0x13a')](_0x207681['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x207681[_0xd81b('0x69')],[_0xd81b('0x7f'),'id'])||{})[_0xd81b('0x13b')](function(_0x3b393b){for(var _0xd6d130=0x0;_0xd6d130<_0x207681['body'][_0xd81b('0x7f')][_0xd81b('0x58')];_0xd6d130+=0x1){socket[_0xd81b('0x13c')](_0xd81b('0x13d'),{'UserId':Number(_0x207681['body'][_0xd81b('0x7f')][_0xd6d130]),'ChatWebsiteId':Number(_0x207681[_0xd81b('0x64')]['id'])});}return _0x3b393b;});}})['then'](respondWithResult(_0x212f03,null))['catch'](handleError(_0x212f03,null));};exports[_0xd81b('0x13e')]=function(_0x44a9e1,_0x26d2c2){return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x44a9e1['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x26d2c2,null))[_0xd81b('0x1c')](function(_0x4c684a){if(_0x4c684a){return _0x4c684a[_0xd81b('0x13e')](_0x44a9e1['query'][_0xd81b('0x7f')])['then'](function(){if(_[_0xd81b('0x13f')](_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')])){for(var _0x56d986=0x0;_0x56d986<_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')][_0xd81b('0x58')];_0x56d986+=0x1){socket[_0xd81b('0x13c')](_0xd81b('0x140'),{'UserId':Number(_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')][_0x56d986]),'ChatWebsiteId':Number(_0x44a9e1['params']['id'])});}}else{socket[_0xd81b('0x13c')](_0xd81b('0x140'),{'UserId':Number(_0x44a9e1['query']['ids']),'ChatWebsiteId':Number(_0x44a9e1['params']['id'])});}});}})[_0xd81b('0x1c')](respondWithStatusCode(_0x26d2c2,null))[_0xd81b('0x27')](handleError(_0x26d2c2,null));};exports[_0xd81b('0x141')]=function(_0xb7102c,_0x2b1519){var _0x1c5a61={};var _0x4c1201={};var _0x1f76aa;var _0x36fa37;return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0xb7102c[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x2b1519,null))[_0xd81b('0x1c')](function(_0x4fc360){if(_0x4fc360){_0x1f76aa=_0x4fc360;_0x4c1201[_0xd81b('0x46')]=_['keys'](db[_0xd81b('0xca')]['rawAttributes']);_0x4c1201[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0xb7102c[_0xd81b('0x52')]);_0x4c1201['filters']=_[_0xd81b('0x55')](_0x4c1201[_0xd81b('0x46')],_0x4c1201[_0xd81b('0x52')]);_0x1c5a61['attributes']=_[_0xd81b('0x55')](_0x4c1201['model'],qs[_0xd81b('0x57')](_0xb7102c['query'][_0xd81b('0x57')]));_0x1c5a61[_0xd81b('0x56')]=_0x1c5a61[_0xd81b('0x56')][_0xd81b('0x58')]?_0x1c5a61[_0xd81b('0x56')]:_0x4c1201[_0xd81b('0x46')];_0x1c5a61['order']=qs[_0xd81b('0x5c')](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x1c5a61[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0xb7102c[_0xd81b('0x52')],_0x4c1201[_0xd81b('0x54')]));if(_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x1c5a61['where']=_[_0xd81b('0x60')](_0x1c5a61['where'],{'$or':_[_0xd81b('0x4d')](_0x1c5a61['attributes'],function(_0x45bf7e){var _0x29464b={};_0x29464b[_0x45bf7e]={'$like':'%'+_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x29464b;})});}_0x1c5a61=_[_0xd81b('0x60')]({},_0x1c5a61,_0xb7102c[_0xd81b('0x66')]);return _0x1f76aa[_0xd81b('0x141')](_0x1c5a61);}})['then'](function(_0xec700e){if(_0xec700e){_0x36fa37=_0xec700e[_0xd81b('0x58')];if(!_0xb7102c[_0xd81b('0x52')][_0xd81b('0x59')]('nolimit')){_0x1c5a61[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x1c5a61['offset']=qs['offset'](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x1f76aa[_0xd81b('0x141')](_0x1c5a61);}})[_0xd81b('0x1c')](function(_0x450634){if(_0x450634){return _0x450634?{'count':_0x36fa37,'rows':_0x450634}:null;}})[_0xd81b('0x1c')](respondWithResult(_0x2b1519,null))[_0xd81b('0x27')](handleError(_0x2b1519,null));}; \ No newline at end of file +var _0x44e8=['includeAll','include','rows','rawAttributes','length','find','body','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','testWildcardValidity','params','describe','ChatWebsiteId','getDispositions','findOne','Disposition','order','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','customerAvatar','addSystemAvatar','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','timezone','ifTime','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','List','Contacts','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','interaction','firstName','messageId','autoclose','push','close','ChatMessage','UserId','User','*,*,*,*','forcedOwnership','queueId','ChatQueue','unshift','queue','Start','startRouting','EventManager','notify','Sequelize','difference','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','openNewInteraction','sequelize','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','email','offlineMessageSubject','MailAccountId','subjectOffline','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','getSnippet','interval','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.13.0','origin','testWebsiteWithWildcard','address','remote','x-forwarded-for','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','color','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','mustache','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIBadRequestError','APIOutOfIntervalError','handleError','APIConflictError','url','URL','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','client','http','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','ChatWebsites','destroy','end','stack','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','model','device','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x8cc7c,_0x591379){var _0x404b40=function(_0x3d1de1){while(--_0x3d1de1){_0x8cc7c['push'](_0x8cc7c['shift']());}};_0x404b40(++_0x591379);}(_0x44e8,0xd7));var _0x844e=function(_0x57ebbb,_0x4e6823){_0x57ebbb=_0x57ebbb-0x0;var _0x4f9f78=_0x44e8[_0x57ebbb];return _0x4f9f78;};'use strict';var Mustache=require(_0x844e('0x0'));var util=require('util');var path=require('path');var ejs=require(_0x844e('0x1'));var fs=require('fs');var fs_extra=require(_0x844e('0x2'));var _=require(_0x844e('0x3'));var querystring=require(_0x844e('0x4'));var htmlToText=require('html-to-text');var Redis=require(_0x844e('0x5'));var jayson=require(_0x844e('0x6'));var qs=require(_0x844e('0x7'));var logger=require(_0x844e('0x8'))('api');var config=require(_0x844e('0x9'));var APIBadRequestError=require(_0x844e('0xa'))[_0x844e('0xb')];var APINotFoundError=require(_0x844e('0xa'))['APINotFoundError'];var APIOutOfIntervalError=require(_0x844e('0xa'))[_0x844e('0xc')];var APIHandleError=require(_0x844e('0xa'))[_0x844e('0xd')];var APIConflictError=require(_0x844e('0xa'))[_0x844e('0xe')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0x844e('0xf'))[_0x844e('0x10')];var db=require(_0x844e('0x11'))['db'];config[_0x844e('0x12')]=_[_0x844e('0x13')](config[_0x844e('0x12')],{'host':_0x844e('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x844e('0x12')]));require(_0x844e('0x15'))['register'](socket);var client=jayson[_0x844e('0x16')][_0x844e('0x17')]({'port':0x232c});var client9002=jayson['client'][_0x844e('0x17')]({'port':0x232a});var client9003=jayson[_0x844e('0x16')][_0x844e('0x17')]({'port':0x232b});var client9001=jayson['client'][_0x844e('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x465e49,_0x380eb4,_0x935134,_0x2588a3){return new Promise(function(_0x353be9,_0x2227c6){var _0x5506ef=_0x2588a3||client;return _0x5506ef['request'](_0x465e49,_0x935134)[_0x844e('0x18')](function(_0x56791b){logger[_0x844e('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x380eb4,_0x844e('0x1a'));logger['debug'](_0x844e('0x1b'),_0x380eb4,_0x844e('0x1a'),JSON[_0x844e('0x1c')](_0x56791b));if(_0x56791b[_0x844e('0x1d')]){if(_0x56791b[_0x844e('0x1d')][_0x844e('0x1e')]===0x1f4){logger[_0x844e('0x1d')](_0x844e('0x1f'),_0x380eb4,_0x56791b['error'][_0x844e('0x20')]);return _0x2227c6(_0x56791b['error']['message']);}logger[_0x844e('0x1d')](_0x844e('0x1f'),_0x380eb4,_0x56791b[_0x844e('0x1d')][_0x844e('0x20')]);return _0x353be9(_0x56791b['error'][_0x844e('0x20')]);}else{logger[_0x844e('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x380eb4,_0x844e('0x1a'));_0x353be9(_0x56791b[_0x844e('0x21')][_0x844e('0x20')]);}})[_0x844e('0x22')](function(_0x35236b){logger[_0x844e('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x380eb4,_0x35236b);_0x2227c6(_0x35236b);});});}function respondWithStatusCode(_0x399a81,_0xadf0d8){_0xadf0d8=_0xadf0d8||0xcc;return function(_0x11859a){if(_0x11859a){return _0x399a81[_0x844e('0x23')](_0xadf0d8);}return _0x399a81[_0x844e('0x24')](_0xadf0d8)['end']();};}function respondWithResult(_0x3725b2,_0x5080c1){_0x5080c1=_0x5080c1||0xc8;return function(_0x57b2ef){if(_0x57b2ef){return _0x3725b2[_0x844e('0x24')](_0x5080c1)[_0x844e('0x25')](_0x57b2ef);}};}function respondWithFilteredResult(_0x355456,_0x587613){return function(_0x489349){if(_0x489349){var _0x2d4acd=typeof _0x587613[_0x844e('0x26')]==='undefined'&&typeof _0x587613[_0x844e('0x27')]===_0x844e('0x28');var _0x2f1697=_0x489349[_0x844e('0x29')];var _0x454b68=_0x2d4acd?0x0:_0x587613[_0x844e('0x26')];var _0x30d0a2=_0x2d4acd?_0x489349[_0x844e('0x29')]:_0x587613[_0x844e('0x26')]+_0x587613[_0x844e('0x27')];var _0x550240;if(_0x30d0a2>=_0x2f1697){_0x30d0a2=_0x2f1697;_0x550240=0xc8;}else{_0x550240=0xce;}_0x355456[_0x844e('0x24')](_0x550240);return _0x355456[_0x844e('0x2a')](_0x844e('0x2b'),_0x454b68+'-'+_0x30d0a2+'/'+_0x2f1697)[_0x844e('0x25')](_0x489349);}return null;};}function saveUpdates(_0x43ae36){return function(_0x31754e){if(_0x31754e){return _0x31754e[_0x844e('0x2c')](_0x43ae36)['then'](function(_0x26d6f2){return _0x26d6f2;});}return null;};}function removeEntity(_0x34ea8b){return function(_0x294dea){if(_0x294dea){return _0x294dea['destroy']()[_0x844e('0x18')](function(){var _0x1592fb=_0x294dea['get']({'plain':!![]});var _0x1fdba9=_0x844e('0x2d');return db['UserProfileResource'][_0x844e('0x2e')]({'where':{'type':_0x1fdba9,'resourceId':_0x1592fb['id']}})[_0x844e('0x18')](function(){return _0x294dea;});})[_0x844e('0x18')](function(){_0x34ea8b[_0x844e('0x24')](0xcc)[_0x844e('0x2f')]();});}};}function handleEntityNotFound(_0x3aa8ba){return function(_0xd61d0c){if(!_0xd61d0c){_0x3aa8ba['sendStatus'](0x194);}return _0xd61d0c;};}function handleError(_0x31d896,_0x387723){_0x387723=_0x387723||0x1f4;return function(_0x29637e){logger[_0x844e('0x1d')](_0x29637e[_0x844e('0x30')]);if(_0x29637e[_0x844e('0x31')]){delete _0x29637e[_0x844e('0x31')];}_0x31d896[_0x844e('0x24')](_0x387723)[_0x844e('0x32')](_0x29637e);};}function createInteractionObject(_0x4155ad,_0x13614e,_0x5d9544,_0x5701d5){var _0x3ad6d5=require(_0x844e('0x33'));var _0xe3d034=new _0x3ad6d5();var _0xc1c669=_0xe3d034[_0x844e('0x34')](_0x5d9544[_0x844e('0x35')])[_0x844e('0x36')]();var _0x23032f=_0x13614e[_0x844e('0x37')];if(_0x5d9544['cf-connecting-ip']){_0x23032f=_0x5d9544[_0x844e('0x38')];}else if(_0x5d9544['x-forwarded-for']){_0x23032f=_[_0x844e('0x39')](_0x5d9544['x-forwarded-for'][_0x844e('0x3a')](','));}return{'ContactId':_0x5701d5['id'],'ChatWebsiteId':_0x4155ad,'from':(_0x5701d5['firstName']||'')+'\x20'+(_0x5701d5[_0x844e('0x3b')]||''),'customerIp':_0x23032f,'customerPort':_0x5d9544[_0x844e('0x3c')]?_0x5d9544[_0x844e('0x3c')]:null,'referer':_0x13614e[_0x844e('0x3d')],'browserName':_0xc1c669[_0x844e('0x3e')][_0x844e('0x31')]&&_0xc1c669[_0x844e('0x3e')][_0x844e('0x3f')]?util[_0x844e('0x40')](_0x844e('0x41'),_0xc1c669[_0x844e('0x3e')]['name'],_0xc1c669[_0x844e('0x3e')][_0x844e('0x3f')]):_0x844e('0x42'),'browserVersion':_0xc1c669['browser']['version']||_0x844e('0x42'),'osName':util[_0x844e('0x40')](_0x844e('0x41'),_0xc1c669['os']['name'],_0xc1c669['os']['version']),'osVersion':_0xc1c669['os']['version'],'deviceModel':_0xc1c669['device'][_0x844e('0x43')]&&_0xc1c669[_0x844e('0x44')][_0x844e('0x45')]?util[_0x844e('0x40')](_0x844e('0x46'),_0xc1c669['device'][_0x844e('0x43')],_0xc1c669['device']['vendor'],_0xc1c669[_0x844e('0x44')][_0x844e('0x47')]):null,'deviceVendor':_0xc1c669[_0x844e('0x44')][_0x844e('0x45')],'deviceType':_0xc1c669['device'][_0x844e('0x47')],'formData':JSON[_0x844e('0x1c')](_0x13614e)};}exports[_0x844e('0x48')]=function(_0x5ee193,_0x36ef59){var _0x1bcbda={'include':[{'model':db[_0x844e('0x49')],'as':_0x844e('0x4a')}]},_0x558f21={},_0x3c6502={'count':0x0,'rows':[]};var _0x443c7a=_[_0x844e('0x4b')](db[_0x844e('0x4c')]['rawAttributes'],function(_0x200932){return{'name':_0x200932[_0x844e('0x4d')],'type':_0x200932[_0x844e('0x47')][_0x844e('0x4e')]};});_0x558f21[_0x844e('0x43')]=_[_0x844e('0x4b')](_0x443c7a,_0x844e('0x31'));_0x558f21[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x5ee193[_0x844e('0x4f')]);_0x558f21['filters']=_[_0x844e('0x51')](_0x558f21[_0x844e('0x43')],_0x558f21[_0x844e('0x4f')]);_0x1bcbda['attributes']=_[_0x844e('0x51')](_0x558f21[_0x844e('0x43')],qs[_0x844e('0x52')](_0x5ee193[_0x844e('0x4f')][_0x844e('0x52')]));_0x1bcbda[_0x844e('0x53')]=_0x1bcbda[_0x844e('0x53')]['length']?_0x1bcbda[_0x844e('0x53')]:_0x558f21[_0x844e('0x43')];if(!_0x5ee193[_0x844e('0x4f')][_0x844e('0x54')](_0x844e('0x55'))){_0x1bcbda[_0x844e('0x27')]=qs[_0x844e('0x27')](_0x5ee193[_0x844e('0x4f')][_0x844e('0x27')]);_0x1bcbda[_0x844e('0x26')]=qs[_0x844e('0x26')](_0x5ee193[_0x844e('0x4f')][_0x844e('0x26')]);}_0x1bcbda['order']=qs[_0x844e('0x56')](_0x5ee193[_0x844e('0x4f')][_0x844e('0x56')]);_0x1bcbda[_0x844e('0x57')]=qs[_0x844e('0x58')](_[_0x844e('0x59')](_0x5ee193['query'],_0x558f21[_0x844e('0x58')]),_0x443c7a);if(_0x5ee193[_0x844e('0x4f')]['filter']){_0x1bcbda[_0x844e('0x57')]=_[_0x844e('0x5a')](_0x1bcbda[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0x443c7a,function(_0x26eec5){if(_0x26eec5[_0x844e('0x47')]!==_0x844e('0x5b')){var _0x10e5ac={};_0x10e5ac[_0x26eec5[_0x844e('0x31')]]={'$like':'%'+_0x5ee193[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x10e5ac;}})});}_0x1bcbda=_[_0x844e('0x5a')]({},_0x1bcbda,_0x5ee193[_0x844e('0x5d')]);var _0x3de2c0={'where':_0x1bcbda['where']};return db[_0x844e('0x4c')][_0x844e('0x29')](_0x3de2c0)['then'](function(_0x1aa783){_0x3c6502['count']=_0x1aa783;if(_0x5ee193[_0x844e('0x4f')][_0x844e('0x5e')]){_0x1bcbda[_0x844e('0x5f')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x1bcbda);})[_0x844e('0x18')](function(_0x4f7e9b){_0x3c6502[_0x844e('0x60')]=_0x4f7e9b;return _0x3c6502;})[_0x844e('0x18')](respondWithFilteredResult(_0x36ef59,_0x1bcbda))[_0x844e('0x22')](handleError(_0x36ef59,null));};exports['show']=function(_0x13ebe8,_0x3d66e4){var _0x4656ab={'raw':![],'where':{'id':_0x13ebe8['params']['id']},'include':[{'model':db[_0x844e('0x49')],'as':_0x844e('0x4a')}]},_0x192457={};_0x192457[_0x844e('0x43')]=_['keys'](db['ChatWebsite'][_0x844e('0x61')]);_0x192457[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x13ebe8['query']);_0x192457['filters']=_[_0x844e('0x51')](_0x192457[_0x844e('0x43')],_0x192457[_0x844e('0x4f')]);_0x4656ab['attributes']=_[_0x844e('0x51')](_0x192457[_0x844e('0x43')],qs[_0x844e('0x52')](_0x13ebe8['query'][_0x844e('0x52')]));_0x4656ab[_0x844e('0x53')]=_0x4656ab[_0x844e('0x53')][_0x844e('0x62')]?_0x4656ab['attributes']:_0x192457[_0x844e('0x43')];if(_0x13ebe8[_0x844e('0x4f')][_0x844e('0x5e')]){_0x4656ab[_0x844e('0x5f')]=[{'all':!![]}];}_0x4656ab=_[_0x844e('0x5a')]({},_0x4656ab,_0x13ebe8[_0x844e('0x5d')]);return db[_0x844e('0x4c')][_0x844e('0x63')](_0x4656ab)['then'](handleEntityNotFound(_0x3d66e4,null))['then'](respondWithResult(_0x3d66e4,null))[_0x844e('0x22')](handleError(_0x3d66e4,null));};exports['create']=function(_0x252ff9,_0x3bde32){var _0x3753cd=null;_0x252ff9[_0x844e('0x64')]['address']['split'](',')['forEach'](_0x4e4ece=>{if(_0x4e4ece['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x4e4ece[_0x844e('0x65')]())){_0x3753cd=new APIBadRequestError('\x22'+_0x4e4ece[_0x844e('0x65')]()+_0x844e('0x66'));}});if(_0x3753cd){return handleError(_0x3bde32,null)(_0x3753cd);}return db['ChatWebsite'][_0x844e('0x67')](_0x252ff9[_0x844e('0x64')],{})['then'](function(_0x19af4e){var _0x5ec1e9=_0x252ff9[_0x844e('0x68')][_0x844e('0x69')]({'plain':!![]});if(!_0x5ec1e9)throw new Error(_0x844e('0x6a'));if(_0x5ec1e9[_0x844e('0x6b')]==='user'){var _0x5554e2=_0x19af4e['get']({'plain':!![]});var _0x314586=_0x844e('0x2d');return db[_0x844e('0x6c')][_0x844e('0x63')]({'where':{'name':_0x314586,'userProfileId':_0x5ec1e9[_0x844e('0x6d')]},'raw':!![]})['then'](function(_0x566718){if(_0x566718&&_0x566718[_0x844e('0x6e')]===0x0){return db[_0x844e('0x6f')][_0x844e('0x67')]({'name':_0x5554e2[_0x844e('0x31')],'resourceId':_0x5554e2['id'],'type':_0x566718[_0x844e('0x31')],'sectionId':_0x566718['id']},{})[_0x844e('0x18')](function(){return _0x19af4e;});}else{return _0x19af4e;}})['catch'](function(_0x97d37c){logger[_0x844e('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x97d37c);throw _0x97d37c;});}return _0x19af4e;})[_0x844e('0x18')](respondWithResult(_0x3bde32,0xc9))[_0x844e('0x22')](handleError(_0x3bde32,null));};exports['update']=function(_0x5839e3,_0x240572){var _0x20cac2=null;_0x5839e3[_0x844e('0x64')]['address']['split'](',')['forEach'](_0x452073=>{if(_0x452073['trim']()!==''&&!wildcardUtils[_0x844e('0x70')](_0x452073[_0x844e('0x65')]())){_0x20cac2=new APIBadRequestError('\x22'+_0x452073[_0x844e('0x65')]()+_0x844e('0x66'));}});if(_0x20cac2){return handleError(_0x240572,null)(_0x20cac2);}if(_0x5839e3[_0x844e('0x64')]['id']){delete _0x5839e3[_0x844e('0x64')]['id'];}return db['ChatWebsite'][_0x844e('0x63')]({'where':{'id':_0x5839e3[_0x844e('0x71')]['id']},'include':[{'model':db['Pause'],'as':_0x844e('0x4a')}]})[_0x844e('0x18')](handleEntityNotFound(_0x240572,null))[_0x844e('0x18')](saveUpdates(_0x5839e3[_0x844e('0x64')],null))[_0x844e('0x18')](respondWithResult(_0x240572,null))['catch'](handleError(_0x240572,null));};exports['destroy']=function(_0x304e7b,_0x14b226){return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x304e7b[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x14b226,null))[_0x844e('0x18')](removeEntity(_0x14b226,null))['catch'](handleError(_0x14b226,null));};exports[_0x844e('0x72')]=function(_0x7c1b20,_0x484833){return db[_0x844e('0x4c')][_0x844e('0x72')]()[_0x844e('0x18')](respondWithResult(_0x484833,null))['catch'](handleError(_0x484833,null));};exports['addDisposition']=function(_0x2123e4,_0x277087){if(_0x2123e4['body']['id']){delete _0x2123e4[_0x844e('0x64')]['id'];}return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x2123e4[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x277087,null))[_0x844e('0x18')](function(_0x35d7f3){if(_0x35d7f3){_0x2123e4['body'][_0x844e('0x73')]=_0x35d7f3['id'];return db['Disposition'][_0x844e('0x67')](_0x2123e4['body']);}})[_0x844e('0x18')](respondWithResult(_0x277087,null))['catch'](handleError(_0x277087,null));};exports[_0x844e('0x74')]=function(_0x23c91b,_0x52b49a){var _0x37748e={'raw':![],'where':{}};var _0x3faf7d={};var _0xaae76d={'count':0x0,'rows':[]};return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x23c91b['params']['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x52b49a,null))[_0x844e('0x18')](function(_0x2a87e6){if(_0x2a87e6){_0x3faf7d[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0x76')][_0x844e('0x61')]);_0x3faf7d[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x23c91b[_0x844e('0x4f')]);_0x3faf7d['filters']=_[_0x844e('0x51')](_0x3faf7d[_0x844e('0x43')],_0x3faf7d[_0x844e('0x4f')]);_0x37748e[_0x844e('0x53')]=_[_0x844e('0x51')](_0x3faf7d[_0x844e('0x43')],qs[_0x844e('0x52')](_0x23c91b[_0x844e('0x4f')][_0x844e('0x52')]));_0x37748e[_0x844e('0x53')]=_0x37748e[_0x844e('0x53')][_0x844e('0x62')]?_0x37748e[_0x844e('0x53')]:_0x3faf7d[_0x844e('0x43')];if(!_0x23c91b[_0x844e('0x4f')]['hasOwnProperty'](_0x844e('0x55'))){_0x37748e['limit']=qs[_0x844e('0x27')](_0x23c91b[_0x844e('0x4f')][_0x844e('0x27')]);_0x37748e[_0x844e('0x26')]=qs[_0x844e('0x26')](_0x23c91b['query'][_0x844e('0x26')]);}_0x37748e[_0x844e('0x77')]=qs[_0x844e('0x56')](_0x23c91b['query']['sort']);_0x37748e[_0x844e('0x57')]=qs[_0x844e('0x58')](_['pick'](_0x23c91b[_0x844e('0x4f')],_0x3faf7d[_0x844e('0x58')]));_0x37748e[_0x844e('0x57')][_0x844e('0x73')]=_0x2a87e6['id'];if(_0x23c91b[_0x844e('0x4f')][_0x844e('0x5c')]){_0x37748e[_0x844e('0x57')]=_[_0x844e('0x5a')](_0x37748e[_0x844e('0x57')],{'$or':_['map'](_0x37748e[_0x844e('0x53')],function(_0x47d5e9){var _0x3c8f7b={};_0x3c8f7b[_0x47d5e9]={'$like':'%'+_0x23c91b[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x3c8f7b;})});}_0x37748e=_[_0x844e('0x5a')]({},_0x37748e,_0x23c91b[_0x844e('0x5d')]);return db['Disposition'][_0x844e('0x29')]({'where':_0x37748e[_0x844e('0x57')]})['then'](function(_0x1c1f04){_0xaae76d[_0x844e('0x29')]=_0x1c1f04;if(_0x23c91b[_0x844e('0x4f')][_0x844e('0x5e')]){_0x37748e[_0x844e('0x5f')]=[{'all':!![]}];}return db['Disposition'][_0x844e('0x78')](_0x37748e);})[_0x844e('0x18')](function(_0x510811){_0xaae76d['rows']=_0x510811;return _0xaae76d;});}})['then'](respondWithFilteredResult(_0x52b49a,_0x37748e))[_0x844e('0x22')](handleError(_0x52b49a,null));};exports[_0x844e('0x79')]=function(_0x569d9b,_0x24733b){return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x569d9b[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x24733b,null))['then'](function(_0x537ace){if(_0x537ace){return _0x537ace['removeDispositions'](_0x569d9b[_0x844e('0x4f')][_0x844e('0x7a')]);}})[_0x844e('0x18')](respondWithStatusCode(_0x24733b,null))[_0x844e('0x22')](handleError(_0x24733b,null));};exports['addAnswer']=function(_0x5d01e2,_0x475295){if(_0x5d01e2[_0x844e('0x64')]['id']){delete _0x5d01e2[_0x844e('0x64')]['id'];}return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x5d01e2['params']['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x475295,null))[_0x844e('0x18')](function(_0x5c807b){if(_0x5c807b){_0x5d01e2[_0x844e('0x64')]['ChatWebsiteId']=_0x5c807b['id'];return db[_0x844e('0x7b')][_0x844e('0x67')](_0x5d01e2[_0x844e('0x64')]);}})[_0x844e('0x18')](respondWithResult(_0x475295,null))[_0x844e('0x22')](handleError(_0x475295,null));};exports[_0x844e('0x7c')]=function(_0x2029fc,_0x7ca8d1){var _0x5abd61={'raw':![],'where':{}};var _0xad6ae6={};var _0x406886={'count':0x0,'rows':[]};return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x2029fc[_0x844e('0x71')]['id']}})['then'](handleEntityNotFound(_0x7ca8d1,null))[_0x844e('0x18')](function(_0x44d08f){if(_0x44d08f){_0xad6ae6[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0x7b')][_0x844e('0x61')]);_0xad6ae6[_0x844e('0x4f')]=_['keys'](_0x2029fc['query']);_0xad6ae6[_0x844e('0x58')]=_[_0x844e('0x51')](_0xad6ae6[_0x844e('0x43')],_0xad6ae6['query']);_0x5abd61[_0x844e('0x53')]=_[_0x844e('0x51')](_0xad6ae6[_0x844e('0x43')],qs[_0x844e('0x52')](_0x2029fc['query'][_0x844e('0x52')]));_0x5abd61[_0x844e('0x53')]=_0x5abd61[_0x844e('0x53')]['length']?_0x5abd61[_0x844e('0x53')]:_0xad6ae6[_0x844e('0x43')];if(!_0x2029fc['query'][_0x844e('0x54')](_0x844e('0x55'))){_0x5abd61[_0x844e('0x27')]=qs[_0x844e('0x27')](_0x2029fc[_0x844e('0x4f')][_0x844e('0x27')]);_0x5abd61['offset']=qs[_0x844e('0x26')](_0x2029fc[_0x844e('0x4f')][_0x844e('0x26')]);}_0x5abd61[_0x844e('0x77')]=qs[_0x844e('0x56')](_0x2029fc[_0x844e('0x4f')]['sort']);_0x5abd61[_0x844e('0x57')]=qs[_0x844e('0x58')](_[_0x844e('0x59')](_0x2029fc[_0x844e('0x4f')],_0xad6ae6[_0x844e('0x58')]));_0x5abd61[_0x844e('0x57')][_0x844e('0x73')]=_0x44d08f['id'];if(_0x2029fc['query']['filter']){_0x5abd61['where']=_[_0x844e('0x5a')](_0x5abd61[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0x5abd61[_0x844e('0x53')],function(_0x3205d8){var _0x1072f5={};_0x1072f5[_0x3205d8]={'$like':'%'+_0x2029fc[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x1072f5;})});}_0x5abd61=_[_0x844e('0x5a')]({},_0x5abd61,_0x2029fc['options']);return db['CannedAnswer'][_0x844e('0x29')]({'where':_0x5abd61['where']})[_0x844e('0x18')](function(_0x4a8ce1){_0x406886[_0x844e('0x29')]=_0x4a8ce1;if(_0x2029fc[_0x844e('0x4f')][_0x844e('0x5e')]){_0x5abd61[_0x844e('0x5f')]=[{'all':!![]}];}return db[_0x844e('0x7b')][_0x844e('0x78')](_0x5abd61);})['then'](function(_0x4ae58a){_0x406886['rows']=_0x4ae58a;return _0x406886;});}})[_0x844e('0x18')](respondWithFilteredResult(_0x7ca8d1,_0x5abd61))[_0x844e('0x22')](handleError(_0x7ca8d1,null));};exports[_0x844e('0x7d')]=function(_0x3bd5a8,_0x50890f){return db['ChatWebsite']['find']({'where':{'id':_0x3bd5a8[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x50890f,null))[_0x844e('0x18')](function(_0x34776d){if(_0x34776d){return _0x34776d[_0x844e('0x7d')](_0x3bd5a8[_0x844e('0x4f')][_0x844e('0x7a')]);}})['then'](respondWithStatusCode(_0x50890f,null))[_0x844e('0x22')](handleError(_0x50890f,null));};exports[_0x844e('0x7e')]=function(_0x85d5d6,_0x4dacb6){_0x85d5d6[_0x844e('0x64')][_0x844e('0x7f')]=_0x85d5d6[_0x844e('0x80')]['filename'];return db['ChatWebsite'][_0x844e('0x63')]({'where':{'id':_0x85d5d6['params']['id']}})['then'](handleEntityNotFound(_0x4dacb6,null))[_0x844e('0x18')](saveUpdates(_0x85d5d6[_0x844e('0x64')],null))['then'](respondWithResult(_0x4dacb6,null))[_0x844e('0x22')](handleError(_0x4dacb6,null));};exports[_0x844e('0x81')]=function(_0x25f26e,_0x5055c5){_0x25f26e[_0x844e('0x64')][_0x844e('0x82')]=_0x25f26e[_0x844e('0x80')][_0x844e('0x83')];return db['ChatWebsite'][_0x844e('0x63')]({'where':{'id':_0x25f26e[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x5055c5,null))[_0x844e('0x18')](saveUpdates(_0x25f26e['body'],null))[_0x844e('0x18')](respondWithResult(_0x5055c5,null))[_0x844e('0x22')](handleError(_0x5055c5,null));};exports['addCustomerAvatar']=function(_0x53d2fd,_0x35f43b){_0x53d2fd[_0x844e('0x64')][_0x844e('0x84')]=_0x53d2fd['file'][_0x844e('0x83')];return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x53d2fd['params']['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x35f43b,null))[_0x844e('0x18')](saveUpdates(_0x53d2fd['body'],null))[_0x844e('0x18')](respondWithResult(_0x35f43b,null))[_0x844e('0x22')](handleError(_0x35f43b,null));};exports[_0x844e('0x85')]=function(_0x52af21,_0x3bb589){_0x52af21[_0x844e('0x64')]['systemAvatar']=_0x52af21[_0x844e('0x80')][_0x844e('0x83')];return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x52af21['params']['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x3bb589,null))['then'](saveUpdates(_0x52af21[_0x844e('0x64')],null))[_0x844e('0x18')](respondWithResult(_0x3bb589,null))[_0x844e('0x22')](handleError(_0x3bb589,null));};exports['getLogo']=function(_0x43a9a7,_0x4c0140){var _0x22cc4b=path[_0x844e('0x86')](config[_0x844e('0x87')],'server/files/images/logos/default_logo.svg');var _0x1f5b23={'where':{'id':_0x43a9a7[_0x844e('0x71')]['id']},'attributes':['id',_0x844e('0x7f')],'raw':!![]};var _0x17a815=![];return require(_0x844e('0x88'))[_0x844e('0x89')]()[_0x844e('0x18')](function(_0x8fc499){if(_0x8fc499){_0x17a815=_0x8fc499[_0x844e('0x8a')];}})[_0x844e('0x18')](function(){return db[_0x844e('0x4c')][_0x844e('0x63')](_0x1f5b23);})[_0x844e('0x18')](handleEntityNotFound(_0x4c0140,null))[_0x844e('0x18')](function(_0x1e89e4){if(_0x1e89e4){if(!_[_0x844e('0x8b')](_0x1e89e4['sitepic'])){if(fs[_0x844e('0x8c')](path[_0x844e('0x86')](config[_0x844e('0x87')],'server/files/images/logos/',_0x1e89e4['sitepic']))&&_0x17a815){_0x22cc4b=path[_0x844e('0x86')](config[_0x844e('0x87')],_0x844e('0x8d'),_0x1e89e4[_0x844e('0x7f')]);}}return _0x4c0140[_0x844e('0x8e')](_0x22cc4b);}})['catch'](handleError(_0x4c0140,null));};exports[_0x844e('0x8f')]=function(_0xcfe967,_0x3fa9f7){var _0x5a77ac=path['join'](config[_0x844e('0x87')],_0x844e('0x90'));var _0x4939a9={'where':{'id':_0xcfe967['params']['id']},'attributes':['id',_0x844e('0x82')],'raw':!![]};return db[_0x844e('0x4c')][_0x844e('0x63')](_0x4939a9)['then'](handleEntityNotFound(_0x3fa9f7,null))[_0x844e('0x18')](function(_0x2259fa){if(_0x2259fa){if(!_['isNil'](_0x2259fa['agentAvatar'])){if(fs['existsSync'](path['join'](config['root'],_0x844e('0x91'),_0x2259fa[_0x844e('0x82')]))){_0x5a77ac=path[_0x844e('0x86')](config[_0x844e('0x87')],'server/files/images/avatars/',_0x2259fa['agentAvatar']);}}return _0x3fa9f7[_0x844e('0x8e')](_0x5a77ac);}})['catch'](handleError(_0x3fa9f7,null));};exports[_0x844e('0x92')]=function(_0x324938,_0xa0fdd1){var _0x2f31c1=path['join'](config['root'],_0x844e('0x93'));var _0x4a1ffc={'where':{'id':_0x324938[_0x844e('0x71')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x844e('0x4c')][_0x844e('0x63')](_0x4a1ffc)['then'](handleEntityNotFound(_0xa0fdd1,null))[_0x844e('0x18')](function(_0x548b0b){if(_0x548b0b){if(!_[_0x844e('0x8b')](_0x548b0b[_0x844e('0x84')])){if(fs[_0x844e('0x8c')](path[_0x844e('0x86')](config['root'],_0x844e('0x91'),_0x548b0b[_0x844e('0x84')]))&&_0x548b0b[_0x844e('0x94')]){_0x2f31c1=path['join'](config['root'],_0x844e('0x91'),_0x548b0b[_0x844e('0x84')]);}}return _0xa0fdd1[_0x844e('0x8e')](_0x2f31c1);}})[_0x844e('0x22')](handleError(_0xa0fdd1,null));};exports[_0x844e('0x95')]=function(_0x2bf367,_0xf4a1e1){var _0x2af775=path[_0x844e('0x86')](config['root'],_0x844e('0x96'));var _0x5715ed={'where':{'id':_0x2bf367[_0x844e('0x71')]['id']},'attributes':['id',_0x844e('0x97')],'raw':!![]};return db['ChatWebsite'][_0x844e('0x63')](_0x5715ed)[_0x844e('0x18')](handleEntityNotFound(_0xf4a1e1,null))[_0x844e('0x18')](function(_0x2dc1db){if(_0x2dc1db){if(!_['isNil'](_0x2dc1db['systemAvatar'])){if(fs[_0x844e('0x8c')](path[_0x844e('0x86')](config['root'],_0x844e('0x91'),_0x2dc1db[_0x844e('0x97')]))){_0x2af775=path['join'](config[_0x844e('0x87')],_0x844e('0x91'),_0x2dc1db['systemAvatar']);}}return _0xf4a1e1['download'](_0x2af775);}})[_0x844e('0x22')](handleError(_0xf4a1e1,null));};function checkWebsiteInterval(_0x1ccd80){var _0x109d7b=_0x1ccd80[_0x844e('0x98')];if(!_0x109d7b){return Promise['resolve'](_0x1ccd80);}var _0x402e17=_0x1ccd80[_0x844e('0x99')]||undefined;return _0x109d7b[_0x844e('0x9a')](_0x402e17)[_0x844e('0x18')](function(_0xe930df){if(!_0xe930df){throw new APIOutOfIntervalError();}return _0x1ccd80;});}exports['notify']=function(_0x5a3db3,_0x4f00cb){var _0x2354a4={'body':_0x5a3db3[_0x844e('0x64')],'channel':'chat'};var _0x3ce7eb=[];var _0x149434=[];var _0x4f6862={};var _0x5117fd=![];if(_0x5a3db3[_0x844e('0x64')]['id']){delete _0x5a3db3[_0x844e('0x64')]['id'];}if(_[_0x844e('0x8b')](_0x5a3db3[_0x844e('0x64')][_0x844e('0x9b')])){throw new APIBadRequestError(_0x844e('0x9c'));}if(_['isNil'](_0x5a3db3[_0x844e('0x64')][_0x844e('0x9d')])){throw new APIBadRequestError(_0x844e('0x9e'));}if(_[_0x844e('0x9f')](_0x5a3db3[_0x844e('0x64')][_0x844e('0x64')])){throw new APIBadRequestError(_0x844e('0xa0'));}var _0x18ddb5=_0x5a3db3[_0x844e('0x64')][_0x844e('0x37')]&&_0x5a3db3[_0x844e('0x64')][_0x844e('0x3d')];return db[_0x844e('0xa1')][_0x844e('0x72')]()['then'](function(_0x1203c6){if(!_0x1203c6){throw new Error(_0x844e('0xa2'));}_0x3ce7eb=Object[_0x844e('0x50')](_0x1203c6)[_0x844e('0x5c')](function(_0x5692ff){return![_0x844e('0xa3'),_0x844e('0xa4')][_0x844e('0xa5')](_0x5692ff);});_0x149434=Object[_0x844e('0x50')](_0x1203c6)[_0x844e('0x5c')](function(_0x5d9730){return![_0x844e('0xa3'),'updatedAt',_0x844e('0xa6'),_0x844e('0xa7')][_0x844e('0xa5')](_0x5d9730);});if(!_[_0x844e('0xa5')](_0x149434,_0x5a3db3[_0x844e('0x64')][_0x844e('0x9d')])){throw new APIBadRequestError(_0x844e('0xa8')+_0x149434[_0x844e('0x86')](',\x20'));}_0x4f6862[_0x5a3db3[_0x844e('0x64')][_0x844e('0x9d')]]=_0x5a3db3['body'][_0x844e('0x9b')];})['then'](function(){return db['ChatWebsite'][_0x844e('0x63')]({'where':{'id':_0x5a3db3['params']['id']},'include':[{'model':db[_0x844e('0xa9')],'as':'List','include':[{'model':db[_0x844e('0xa1')],'as':'Contacts','where':_0x4f6862,'limit':0x1,'order':[[_0x844e('0xa4'),'DESC']]}]},{'model':db[_0x844e('0xaa')],'as':_0x844e('0xab')},{'model':db['Interval'],'as':_0x844e('0x98'),'include':[{'model':db[_0x844e('0x98')],'as':_0x844e('0xac'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x844e('0x18')](function(_0x30caf3){if(!_0x30caf3){throw new APINotFoundError(util[_0x844e('0x40')](_0x844e('0xad'),_0x5a3db3[_0x844e('0x71')]['id']));}if(_0x18ddb5){return checkWebsiteInterval(_0x30caf3);}return _0x30caf3;})['then'](function(_0x5b4355){_0x2354a4[_0x844e('0xae')]=_0x5b4355;_0x2354a4[_0x844e('0xaf')]=_[_0x844e('0xb0')](_0x5b4355[_0x844e('0xab')],[_0x844e('0xb1')],[_0x844e('0xb2')]);if(_0x2354a4[_0x844e('0xae')][_0x844e('0xab')]){delete _0x2354a4[_0x844e('0xae')][_0x844e('0xab')];}_0x2354a4[_0x844e('0xb3')]=_0x5b4355[_0x844e('0xb4')]||{'id':_0x5b4355[_0x844e('0xa7')]};if(_0x2354a4['list']&&_0x2354a4['list'][_0x844e('0xb5')]['length']){return _0x2354a4[_0x844e('0xb3')]['Contacts'][0x0];}var _0x1d29a2=_['defaults'](_0x5a3db3[_0x844e('0x64')],{'firstName':_0x5a3db3[_0x844e('0x64')][_0x844e('0x9b')],'ListId':_0x5b4355[_0x844e('0xa7')]});_0x1d29a2[_0x5a3db3['body'][_0x844e('0x9d')]]=_0x5a3db3[_0x844e('0x64')][_0x844e('0x9b')];return db[_0x844e('0xa1')][_0x844e('0x67')](_0x1d29a2,{'fields':_0x3ce7eb,'raw':!![]});})[_0x844e('0x18')](function(_0x19a451){_0x2354a4[_0x844e('0xb6')]=_0x19a451;var _0x35bf98=createInteractionObject(_0x5a3db3[_0x844e('0x71')]['id'],_0x5a3db3[_0x844e('0x64')],_0x5a3db3[_0x844e('0xb7')],_0x19a451);var _0x184654={'ChatWebsiteId':_0x5a3db3[_0x844e('0x71')]['id']};if(_0x5a3db3[_0x844e('0x64')]['threadId']){_0x184654[_0x844e('0xb8')]=_0x5a3db3[_0x844e('0x64')][_0x844e('0xb8')];_0x184654[_0x844e('0xb9')]=![];return db[_0x844e('0xba')][_0x844e('0x63')]({'where':_0x184654})[_0x844e('0x18')](function(_0x51fd3a){var _0x11933d=_0x5a3db3[_0x844e('0x64')][_0x844e('0x37')]&&_0x5a3db3['body'][_0x844e('0x3d')];if(_0x51fd3a){_0x5117fd=!![];return _0x51fd3a;}else if(!_0x11933d&&_0x51fd3a&&_0x51fd3a[_0x844e('0xb9')]){throw new APIConflictError(_0x844e('0xbb'));}_0x35bf98[_0x844e('0xb8')]=_0x5a3db3['body'][_0x844e('0xb8')];_0x35bf98[_0x844e('0xbc')]=_0x5a3db3[_0x844e('0x64')][_0x844e('0xbc')];return db['ChatInteraction'][_0x844e('0x67')](_0x35bf98);});}_0x184654['ContactId']=_0x19a451['id'];if(_0x5a3db3[_0x844e('0x64')][_0x844e('0xbd')]&&_0x5a3db3['body'][_0x844e('0xbd')]['id']){_0x184654['id']=_0x5a3db3[_0x844e('0x64')][_0x844e('0xbd')]['id'];return db['ChatInteraction'][_0x844e('0x63')]({'where':_0x184654})[_0x844e('0x18')](function(_0x51b0a8){var _0x11e415=_0x5a3db3[_0x844e('0x64')][_0x844e('0x37')]&&_0x5a3db3[_0x844e('0x64')][_0x844e('0x3d')];if(!_0x11e415&&_0x51b0a8&&_0x51b0a8[_0x844e('0xb9')]){throw new APIConflictError(_0x844e('0xbb'));}else if(_0x51b0a8){_0x5117fd=!![];return _0x51b0a8;}else{return db['ChatInteraction'][_0x844e('0x67')](_0x35bf98);}});}return db[_0x844e('0xba')][_0x844e('0x67')](_0x35bf98);})[_0x844e('0x18')](function(_0x3a04b6){if(!_0x5117fd){return _0x3a04b6;}var _0x18c156={'from':(_0x2354a4['contact'][_0x844e('0xbe')]||'')+'\x20'+(_0x2354a4[_0x844e('0xb6')][_0x844e('0x3b')]||'')};if(_0x5a3db3[_0x844e('0x64')][_0x844e('0xb8')]&&_0x5a3db3[_0x844e('0x64')]['messageId']&&_0x5a3db3['body']['threadId']!=_0x5a3db3[_0x844e('0x64')][_0x844e('0xbf')]){_0x18c156[_0x844e('0xb8')]=_0x5a3db3[_0x844e('0x64')][_0x844e('0xbf')];}return _0x3a04b6[_0x844e('0x2c')](_0x18c156);})[_0x844e('0x18')](function(_0x346f18){_0x2354a4[_0x844e('0xbd')]=_0x346f18[_0x844e('0x69')]({'plain':!![]});_0x2354a4[_0x844e('0xbd')]['created']=!_0x5117fd;if(_0x2354a4['interaction']['created']){if(_0x2354a4[_0x844e('0xae')][_0x844e('0xc0')]){_0x2354a4['applications'][_0x844e('0xc1')]({'id':0x0,'priority':_0x2354a4['applications'][_0x844e('0x62')]+0x1,'app':_0x844e('0xc2'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x844e('0xc3')][_0x844e('0x67')]({'body':_0x5a3db3[_0x844e('0x64')]['body'],'ChatWebsiteId':_0x5a3db3[_0x844e('0x71')]['id'],'ChatInteractionId':_0x346f18['id'],'direction':'in','ContactId':_0x2354a4[_0x844e('0xb6')]['id'],'AttachmentId':_0x5a3db3[_0x844e('0x64')]['AttachmentId']});})[_0x844e('0x18')](function(_0x38eeb7){_0x2354a4['message']=_0x38eeb7;if(!_0x2354a4['interaction'][_0x844e('0xc4')]){return;}return db[_0x844e('0xc5')]['find']({'attributes':['id',_0x844e('0x31')],'where':{'id':_0x2354a4[_0x844e('0xbd')]['UserId']}});})[_0x844e('0x18')](function(_0x4a66f9){if(_0x4a66f9){_0x2354a4['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4a66f9['name']+','+(_0x2354a4['account']['waitForTheAssignedAgent']||0xa),'interval':_0x844e('0xc6')});_0x2354a4[_0x844e('0xc7')]=!![];}if(!_0x2354a4[_0x844e('0xbd')][_0x844e('0xc8')]){return;}return db[_0x844e('0xc9')][_0x844e('0x63')]({'attributes':['id',_0x844e('0x31')],'where':{'id':_0x2354a4[_0x844e('0xbd')][_0x844e('0xc8')]}});})[_0x844e('0x18')](function(_0x1d7463){if(_0x1d7463){_0x2354a4['applications'][_0x844e('0xca')]({'id':0x0,'priority':0x1,'app':_0x844e('0xcb'),'appdata':_0x1d7463[_0x844e('0x31')]+','+(_0x2354a4['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x844e('0xc6')});}return respondWithRpcPromise(_0x844e('0xcc'),_0x844e('0xcd'),_0x2354a4);})['then'](function(_0x539f14){respondWithRpcPromise(_0x844e('0xce'),_0x844e('0xce'),{'event':_0x844e('0xcf'),'message':_0x539f14},client9002);return _0x539f14;})[_0x844e('0x18')](respondWithResult(_0x4f00cb,null))[_0x844e('0x22')](APIHandleError(_0x4f00cb));};exports['offline']=function(_0x1775e8,_0x419a89){var _0x9bfa01,_0x134a28,_0x8a753b;var _0x40f5e4=[];var _0x39edd0={};var _0xee01a6=_0x1775e8['files']||[];var _0x374113=[];var _0x1dc407;return db[_0x844e('0xa1')][_0x844e('0x72')]()['then'](function(_0x680da6){if(!_0x680da6){throw new db[(_0x844e('0xd0'))]['ValidationError']('no\x20available\x20attributes');}_0x40f5e4=_[_0x844e('0xd1')](_[_0x844e('0x50')](_0x680da6),[_0x844e('0xa3'),_0x844e('0xa4'),_0x844e('0xa6'),_0x844e('0xa7')]);if(_0x1775e8[_0x844e('0x64')]['id']){delete _0x1775e8['body']['id'];}if(_[_0x844e('0x8b')](_0x1775e8[_0x844e('0x64')][_0x844e('0x9b')])){throw _0x419a89[_0x844e('0x24')](0x1f4)[_0x844e('0x32')](new db[(_0x844e('0xd0'))][(_0x844e('0xd2'))](_0x844e('0xd3')));}if(_[_0x844e('0x8b')](_0x1775e8['body'][_0x844e('0x64')])||_0x1775e8[_0x844e('0x64')][_0x844e('0x64')]===''){throw _0x419a89[_0x844e('0x24')](0x1f4)[_0x844e('0x32')](new db[(_0x844e('0xd0'))][(_0x844e('0xd2'))](_0x844e('0xd4')));}if(_[_0x844e('0x8b')](_0x1775e8['body']['mapKeyOffline'])){throw _0x419a89['status'](0x1f4)[_0x844e('0x32')](new db[(_0x844e('0xd0'))][(_0x844e('0xd2'))](_0x844e('0xd5')+_0x40f5e4));}if(!_['includes'](_0x40f5e4,_0x1775e8[_0x844e('0x64')][_0x844e('0xd6')])){throw _0x419a89[_0x844e('0x24')](0x1f4)[_0x844e('0x32')](new db['Sequelize'][(_0x844e('0xd2'))](_0x844e('0xd7')+_0x40f5e4));}_0x39edd0[_0x1775e8[_0x844e('0x64')][_0x844e('0xd6')]]=_0x1775e8[_0x844e('0x64')][_0x844e('0x9b')];})[_0x844e('0x18')](function(){return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x1775e8['params']['id']},'include':[{'model':db[_0x844e('0xa9')],'as':_0x844e('0xb4')},{'model':db[_0x844e('0xd8')],'as':_0x844e('0xd8')}]});})[_0x844e('0x18')](handleEntityNotFound(_0x419a89,null))[_0x844e('0x18')](function(_0x5a65b2){if(_0x5a65b2&&_0x5a65b2[_0x844e('0xb4')]){_0x134a28=_0x5a65b2;var _0x19c6fd=_[_0x844e('0x13')](_0x1775e8[_0x844e('0x64')],{'firstName':_0x1775e8[_0x844e('0x64')]['from'],'phone':_0x1775e8[_0x844e('0x64')][_0x844e('0x9b')],'ListId':_0x5a65b2[_0x844e('0xa7')]});_0x19c6fd[_0x1775e8[_0x844e('0x64')][_0x844e('0xd6')]]=_0x1775e8[_0x844e('0x64')]['from'];return db['CmContact']['findOrCreate']({'where':_0x39edd0,'defaults':_0x19c6fd});}})[_0x844e('0xd9')](function(_0x2e7e15){if(_0x2e7e15){_0x8a753b=_0x2e7e15;var _0x54fc71=fs[_0x844e('0xda')](path[_0x844e('0x86')](config[_0x844e('0x87')],'server/files/templates/chatOfflineMessage.ejs'),_0x844e('0xdb'));var _0x5f2970=ejs[_0x844e('0xdc')](_0x54fc71,{'body':_[_0x844e('0xdd')](_0x1775e8[_0x844e('0x64')]['body']),'bodyTitle':_0x134a28[_0x844e('0xde')]});return db[_0x844e('0xdf')]['create']({'body':_0x5f2970,'plainBody':htmlToText[_0x844e('0xe0')](_0x5f2970),'ContactId':_0x2e7e15['id'],'ChatWebsiteId':_0x134a28['id']});}})[_0x844e('0x18')](function(_0x582cf0){_0x1dc407=_0x582cf0;if(_0xee01a6[_0x844e('0x62')]){var _0x24c326=_0xee01a6['map'](function(_0x23b6ef){return{'name':_0x23b6ef[_0x844e('0xe1')],'basename':_0x23b6ef[_0x844e('0x83')],'type':_0x23b6ef[_0x844e('0xe2')],'ChatOfflineMessageId':_0x582cf0['id']};});_0x374113=_0x24c326[_0x844e('0x4b')](_0x1b9da7=>{var _0x283ec2={'filename':_0x1b9da7[_0x844e('0x31')],'path':path[_0x844e('0x86')](config[_0x844e('0x87')],_0x844e('0xe3'),_0x844e('0xe4'),_0x844e('0xe5'),_0x844e('0xe6'),_0x1b9da7['basename'])};return _0x283ec2;});if(!_0x134a28[_0x844e('0xe7')]){return db[_0x844e('0xe8')]['transaction'](function(_0x21b2e0){return db[_0x844e('0xe9')][_0x844e('0xea')](_0x24c326,{'transaction':_0x21b2e0});});}}})[_0x844e('0x18')](function(){if(_0x1dc407){_0x9bfa01=_0x1dc407;return db[_0x844e('0xd8')][_0x844e('0x75')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x844e('0xeb'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x844e('0xec'),'raw':!![]}]}]});}})[_0x844e('0x18')](function(_0x252760){if(_0x252760&&_0x252760[_0x844e('0xeb')]&&_0x134a28[_0x844e('0xed')]&&_0x134a28[_0x844e('0xee')]){var _0x28cdae=_0x252760['getSmtpOptions']();return respondWithRpcPromise(_0x844e('0xef'),'sendMail',{'account':_0x28cdae,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x252760[_0x844e('0x31')],_0x252760[_0x844e('0xf0')]||_0x252760[_0x844e('0xeb')]['user']),'to':_0x134a28[_0x844e('0xee')],'subject':_0x134a28[_0x844e('0xf1')],'html':_0x9bfa01[_0x844e('0x64')],'attachments':_0x374113}},client9003)[_0x844e('0x18')](function(){return _0x9bfa01;})[_0x844e('0x22')](function(_0x641902){logger[_0x844e('0x1d')](_0x641902);});}})['then'](function(){if(_0x134a28&&_0x134a28['openNewInteraction']&&_0x134a28[_0x844e('0xf2')]){var _0x5262d4=[];if(_0xee01a6[_0x844e('0x62')]){_0x5262d4=_0xee01a6[_0x844e('0x4b')](function(_0x4245e2){return{'name':_0x4245e2[_0x844e('0xe1')],'basename':_0x4245e2['filename'],'type':_0x4245e2[_0x844e('0xe2')],'ChatOfflineMessageId':_0x1dc407['id']};});}var _0x2204a1;if(!_[_0x844e('0x8b')](_0x134a28[_0x844e('0xf3')])){var _0x2b9a03=_[_0x844e('0x4b')](_0x1775e8['body'],function(_0x58d81c){return _0x58d81c;});var _0x21870b=_['toPairsIn'](_0x2b9a03)[0x0];var _0x112955=_['mapValues'](_0x21870b,function(_0x34873b){return _0x34873b;});_0x2204a1=_0x112955[0x1][_0x134a28[_0x844e('0xf3')]];}var _0x51cd1a={'from':_0x8a753b[_0x844e('0xf0')],'firstName':_0x8a753b[_0x844e('0xbe')],'lastName':_0x8a753b[_0x844e('0x3b')],'mapKey':_0x844e('0xf0'),'message':{'from':_0x8a753b[_0x844e('0xf0')],'to':_0x134a28[_0x844e('0xd8')]['email'],'cc':'','subject':_['isNil'](_0x2204a1)?_0x134a28['offlineMessageSubject']:_0x2204a1,'messageId':'','sentAt':new Date(),'attach':_0x5262d4['length'],'attachments':_0x5262d4,'originChannel':_0x844e('0xf4'),'ChatWebsiteId':_0x134a28['id'],'ChatOfflineMessageId':_0x9bfa01['id'],'originTo':_0x134a28[_0x844e('0xd8')][_0x844e('0xf0')]},'body':_0x9bfa01['body']};var _0x3606d4={'account':{'id':_0x134a28[_0x844e('0xf2')]},'body':_0x51cd1a,'log':_0x844e('0xf5')};return respondWithRpcPromise(_0x844e('0xf5'),'notifyMail',_0x3606d4,client9001)[_0x844e('0x18')](function(){return _0x9bfa01;})[_0x844e('0x22')](function(_0x5383ac){logger[_0x844e('0x1d')](_0x5383ac);});}return;})[_0x844e('0x18')](function(){if(_0x9bfa01){return _0x9bfa01;}})[_0x844e('0x18')](respondWithResult(_0x419a89,null))['catch'](function(){for(var _0x476be2 of _0xee01a6){var _0x14f9f5=path[_0x844e('0x86')](config['root'],_0x844e('0xe3'),'files',_0x844e('0xe5'),_0x844e('0xe6'),_0x476be2[_0x844e('0x83')]);fs_extra[_0x844e('0xf6')](_0x14f9f5)[_0x844e('0x22')](function(_0x31e571){logger[_0x844e('0x1d')](_0x844e('0xf7'),_0x14f9f5,_0x31e571);});}});};exports[_0x844e('0xf8')]=function(_0xf21b7c,_0x22c85e){return db[_0x844e('0xba')]['find']({'where':{'id':_0xf21b7c[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x22c85e,null))['then'](function(_0x1ff9b5){if(_0x1ff9b5){return _0x1ff9b5[_0x844e('0xf8')](_0xf21b7c[_0x844e('0x64')][_0x844e('0x7a')],_[_0x844e('0xf9')](_0xf21b7c[_0x844e('0x64')],[_0x844e('0x7a'),'id'])||{});}})[_0x844e('0x18')](respondWithResult(_0x22c85e,null))['catch'](handleError(_0x22c85e,null));};exports[_0x844e('0xfa')]=function(_0x55b540,_0x44157e){var _0x11cb2f={'raw':![],'where':{}};var _0x17518a={};var _0xe328bd={'count':0x0,'rows':[]};return db[_0x844e('0x4c')]['findOne']({'where':{'id':_0x55b540[_0x844e('0x71')]['id']}})['then'](handleEntityNotFound(_0x44157e,null))[_0x844e('0x18')](function(_0x1d51e1){if(_0x1d51e1){_0x17518a[_0x844e('0x43')]=_['keys'](db[_0x844e('0xba')][_0x844e('0x61')]);_0x17518a[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x55b540[_0x844e('0x4f')]);_0x17518a['filters']=_['intersection'](_0x17518a[_0x844e('0x43')],_0x17518a[_0x844e('0x4f')]);_0x11cb2f[_0x844e('0x53')]=_[_0x844e('0x51')](_0x17518a[_0x844e('0x43')],qs[_0x844e('0x52')](_0x55b540[_0x844e('0x4f')][_0x844e('0x52')]));_0x11cb2f[_0x844e('0x53')]=_0x11cb2f['attributes'][_0x844e('0x62')]?_0x11cb2f['attributes']:_0x17518a[_0x844e('0x43')];if(!_0x55b540[_0x844e('0x4f')]['hasOwnProperty'](_0x844e('0x55'))){_0x11cb2f[_0x844e('0x27')]=qs[_0x844e('0x27')](_0x55b540[_0x844e('0x4f')][_0x844e('0x27')]);_0x11cb2f['offset']=qs[_0x844e('0x26')](_0x55b540['query'][_0x844e('0x26')]);}_0x11cb2f[_0x844e('0x77')]=qs['sort'](_0x55b540['query'][_0x844e('0x56')]);_0x11cb2f[_0x844e('0x57')]=qs[_0x844e('0x58')](_[_0x844e('0x59')](_0x55b540['query'],_0x17518a[_0x844e('0x58')]));_0x11cb2f[_0x844e('0x57')][_0x844e('0x73')]=_0x1d51e1['id'];if(_0x55b540[_0x844e('0x4f')][_0x844e('0x5c')]){_0x11cb2f['where']=_[_0x844e('0x5a')](_0x11cb2f[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0x11cb2f['attributes'],function(_0x2ea280){var _0x5f225d={};_0x5f225d[_0x2ea280]={'$like':'%'+_0x55b540[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x5f225d;})});}_0x11cb2f=_[_0x844e('0x5a')]({},_0x11cb2f,_0x55b540[_0x844e('0x5d')]);return db['ChatInteraction'][_0x844e('0x29')]({'where':_0x11cb2f[_0x844e('0x57')]})[_0x844e('0x18')](function(_0x19edb8){_0xe328bd[_0x844e('0x29')]=_0x19edb8;if(_0x55b540[_0x844e('0x4f')]['includeAll']){_0x11cb2f[_0x844e('0x5f')]=[{'model':db['CmContact'],'as':_0x844e('0xfb'),'required':![]},{'model':db['User'],'as':_0x844e('0xfc'),'attributes':[_0x844e('0x31'),_0x844e('0xfd'),_0x844e('0xfe')],'required':![]},{'model':db[_0x844e('0xff')],'as':_0x844e('0x100'),'attributes':['id',_0x844e('0x31'),'color'],'where':_0x55b540[_0x844e('0x4f')]['tag']?{'id':_0x55b540[_0x844e('0x4f')]['tag']}:undefined,'required':_0x55b540[_0x844e('0x4f')][_0x844e('0x101')]?!![]:![]}];}return db[_0x844e('0xba')][_0x844e('0x78')](_0x11cb2f);})[_0x844e('0x18')](function(_0x4ccac6){_0xe328bd['rows']=_0x4ccac6;return _0xe328bd;});}})[_0x844e('0x18')](respondWithFilteredResult(_0x44157e,_0x11cb2f))['catch'](handleError(_0x44157e,null));};exports[_0x844e('0x102')]=function(_0x48d973,_0x1d6abb){var _0x454b5d=0x0;var _0x358b3e=0x0;var _0x53be53=![];var _0x2e48e3;var _0x4ec13f;return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x48d973[_0x844e('0x71')]['id']},'include':[{'model':db[_0x844e('0x98')],'as':_0x844e('0x98'),'include':[{'model':db[_0x844e('0x98')],'as':_0x844e('0xac'),'attributes':['id',_0x844e('0x103')]}]}]})[_0x844e('0x18')](handleEntityNotFound(_0x1d6abb,null))[_0x844e('0x18')](function(_0x418bd1){if(_0x418bd1){_0x2e48e3=_0x418bd1;return _0x418bd1['getProactiveActions']({'raw':!![]});}})[_0x844e('0x18')](function(_0x5132d8){if(_0x2e48e3){if(_0x5132d8){_0x4ec13f=_0x5132d8;}}return require(_0x844e('0x88'))['getLicense']();})[_0x844e('0x18')](function(_0x6fb171){if(_0x6fb171){_0x358b3e=_0x6fb171[_0x844e('0x104')];_0x53be53=_0x6fb171[_0x844e('0x8a')];}})[_0x844e('0x18')](function(){return db[_0x844e('0xba')][_0x844e('0x29')]({'where':{'closed':![]}});})['then'](function(_0x1f545e){_0x454b5d=_0x1f545e;if(_0x358b3e&&_0x1f545e>_0x358b3e){return db[_0x844e('0x105')][_0x844e('0x75')]({'where':{'id':0x1}})[_0x844e('0x18')](function(_0x1b75b8){if(_0x1b75b8){_0x1b75b8[_0x844e('0x106')](_0x844e('0x107'));}});}})[_0x844e('0x18')](function(){var _0x5222da=_0x2e48e3[_0x844e('0x98')];var _0x64f058=_0x2e48e3['timezone']||undefined;return _0x5222da?_0x5222da[_0x844e('0x9a')](_0x64f058):!![];})[_0x844e('0x18')](function(_0x3c8f88){var _0x103475=fs[_0x844e('0xda')](path['join'](config[_0x844e('0x87')],_0x844e('0x108')),_0x844e('0xdb'));var _0x1597ba=_0x844e('0x109');var _0x3a8782=![];var _0xb0d533,_0x5cb72d;if(_0x48d973[_0x844e('0xb7')][_0x844e('0x3d')]){_0xb0d533=new URL(_0x48d973['headers']['referer'])[_0x844e('0x10a')];}else if(_0x48d973['headers'][_0x844e('0x10a')]){_0xb0d533=new URL(_0x48d973['headers'][_0x844e('0x10a')])[_0x844e('0x10a')];}else{_0xb0d533='http://localhost:9000';}_0x5cb72d=typeof _0x2e48e3['address']['split'](',')[_0x844e('0x63')](function(_0x1df711){return wildcardUtils[_0x844e('0x10b')](_0x1df711,_0xb0d533);})!==_0x844e('0x28');var _0x1ea83d={'chatVersion':_0x1597ba,'chatWebsiteAddressOrigin':_0x5cb72d?_0xb0d533:_0x2e48e3[_0x844e('0x10c')],'remote':_0x2e48e3[_0x844e('0x10d')],'query':querystring[_0x844e('0x1c')](_[_0x844e('0x5a')](_0x2e48e3[_0x844e('0x69')]({'plain':!![]}),{'customerIp':_0x48d973['headers'][_0x844e('0x10e')]||_0x48d973[_0x844e('0xb7')][_0x844e('0x10f')]||_0x48d973[_0x844e('0x110')][_0x844e('0x111')]||_0x48d973['ip'],'referer':_0x48d973['headers'][_0x844e('0x3d')],'openedInteractions':_0x454b5d,'maxInteractions':_0x358b3e,'virtual':_0x53be53[_0x844e('0x104')],'online':_0x3c8f88,'custom':_0x53be53,'address':_0x5cb72d?_0xb0d533:null}))[_0x844e('0x112')](/'/g,'\x5c\x27')};_0x1d6abb[_0x844e('0x32')](ejs[_0x844e('0xdc')](Mustache[_0x844e('0xdc')](_0x103475,_0x1ea83d),{'proactiveActions':_0x4ec13f,'alignment':_0x2e48e3[_0x844e('0x113')],'verticalAlignment':_0x2e48e3[_0x844e('0x114')],'div_color':_0x2e48e3[_0x844e('0x115')],'labelText':_0x2e48e3['labelText'],'text_color':_0x2e48e3[_0x844e('0x116')],'text_button_color':_0x2e48e3[_0x844e('0x117')],'button_color':_0x2e48e3[_0x844e('0x118')],'background_color':_0x2e48e3[_0x844e('0x119')],'hideWhenOffline':_0x2e48e3[_0x844e('0x11a')],'intervalId':_0x2e48e3['IntervalId'],'isDevelopment':_0x3a8782,'chatVersion':_0x1597ba}));})['catch'](handleError(_0x1d6abb,null));};exports[_0x844e('0x11b')]=function(_0x430aa0,_0x322107){var _0x4c81e3=_0x430aa0[_0x844e('0x71')]['id'];var _0x3764ff=_0x430aa0['body'];var _0x1aeb99=0xc8;var _0x125934=null;return db[_0x844e('0xe8')][_0x844e('0x11c')]({'isolationLevel':db[_0x844e('0xe8')][_0x844e('0x11d')][_0x844e('0x11e')][_0x844e('0x11f')]},function(_0x399cbe){return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x4c81e3},'transaction':_0x399cbe})[_0x844e('0x18')](function(_0x379e7f){if(_0x379e7f){return db[_0x844e('0xaa')][_0x844e('0x2e')]({'where':{'ChatWebsiteId':_0x4c81e3},'transaction':_0x399cbe})['then'](function(){var _0x2bd40c=_[_0x844e('0x4b')](_0x3764ff,function(_0x3bb23a){_0x3bb23a[_0x844e('0x73')]=_0x4c81e3;return _0x3bb23a;});return db[_0x844e('0xaa')][_0x844e('0xea')](_0x2bd40c,{'transaction':_0x399cbe});});}else{_0x1aeb99=0x194;_0x125934=[];}});})[_0x844e('0x18')](function(){if(_0x1aeb99!==0x194){return db[_0x844e('0xaa')][_0x844e('0x120')]({'where':{'ChatWebsiteId':_0x4c81e3},'order':_0x844e('0xb1')})['then'](function(_0x43d971){_0x125934=_0x43d971;});}})[_0x844e('0x22')](function(_0x49f92a){_0x1aeb99=0x1f4;logger['error'](_0x49f92a[_0x844e('0x30')]);if(_0x49f92a[_0x844e('0x31')]){delete _0x49f92a['name'];}_0x125934=_0x49f92a;})[_0x844e('0x121')](function(){if(_0x125934===null){_0x322107[_0x844e('0x23')](_0x1aeb99);}else{if(_0x1aeb99===0x1f4){_0x322107[_0x844e('0x24')](_0x1aeb99)[_0x844e('0x32')](_0x125934);}else{_0x322107['status'](_0x1aeb99)[_0x844e('0x25')](_0x125934);}}});};exports[_0x844e('0x122')]=function(_0x365207,_0x5e5288){var _0xeae328={};var _0x1cda40={};var _0x3f5d8a;var _0x3d674e;return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x365207[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x5e5288,null))['then'](function(_0x5744ae){if(_0x5744ae){_0x3f5d8a=_0x5744ae;_0x1cda40[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0xaa')][_0x844e('0x61')]);_0x1cda40['query']=_[_0x844e('0x50')](_0x365207[_0x844e('0x4f')]);_0x1cda40[_0x844e('0x58')]=_[_0x844e('0x51')](_0x1cda40['model'],_0x1cda40[_0x844e('0x4f')]);_0xeae328[_0x844e('0x53')]=_['intersection'](_0x1cda40[_0x844e('0x43')],qs['fields'](_0x365207['query']['fields']));_0xeae328[_0x844e('0x53')]=_0xeae328['attributes'][_0x844e('0x62')]?_0xeae328[_0x844e('0x53')]:_0x1cda40[_0x844e('0x43')];_0xeae328[_0x844e('0x77')]=qs['sort'](_0x365207['query'][_0x844e('0x56')]);_0xeae328[_0x844e('0x57')]=qs[_0x844e('0x58')](_[_0x844e('0x59')](_0x365207[_0x844e('0x4f')],_0x1cda40['filters']));if(_0x365207[_0x844e('0x4f')][_0x844e('0x5c')]){_0xeae328[_0x844e('0x57')]=_[_0x844e('0x5a')](_0xeae328[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0xeae328[_0x844e('0x53')],function(_0x5d9434){var _0x424401={};_0x424401[_0x5d9434]={'$like':'%'+_0x365207[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x424401;})});}_0xeae328=_[_0x844e('0x5a')]({},_0xeae328,_0x365207[_0x844e('0x5d')]);return _0x3f5d8a[_0x844e('0x122')](_0xeae328);}})[_0x844e('0x18')](function(_0x3e4e2d){if(_0x3e4e2d){_0x3d674e=_0x3e4e2d[_0x844e('0x62')];if(!_0x365207['query'][_0x844e('0x54')]('nolimit')){_0xeae328['limit']=qs[_0x844e('0x27')](_0x365207[_0x844e('0x4f')][_0x844e('0x27')]);_0xeae328[_0x844e('0x26')]=qs['offset'](_0x365207[_0x844e('0x4f')][_0x844e('0x26')]);}return _0x3f5d8a[_0x844e('0x122')](_0xeae328);}})['then'](function(_0x4f8c2f){if(_0x4f8c2f){return _0x4f8c2f?{'count':_0x3d674e,'rows':_0x4f8c2f}:null;}})['then'](respondWithResult(_0x5e5288,null))[_0x844e('0x22')](handleError(_0x5e5288,null));};exports[_0x844e('0x123')]=function(_0x276b5f,_0x150283){return db[_0x844e('0x124')]['find']({'where':{'id':_0x276b5f[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x150283,null))[_0x844e('0x18')](function(_0x215591){if(_0x215591){return _0x215591[_0x844e('0x123')](_0x276b5f[_0x844e('0x64')][_0x844e('0x7a')],_[_0x844e('0xf9')](_0x276b5f['body'],[_0x844e('0x7a'),'id'])||{});}})[_0x844e('0x18')](respondWithResult(_0x150283,null))[_0x844e('0x22')](handleError(_0x150283,null));};exports[_0x844e('0x125')]=function(_0x170007,_0x37ab57){var _0x4ab1c2={};var _0x395f9a={};var _0x1a8bc8;var _0x44a70d;return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x170007[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x37ab57,null))['then'](function(_0x34f187){if(_0x34f187){_0x1a8bc8=_0x34f187;_0x395f9a[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0x126')][_0x844e('0x61')]);_0x395f9a[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x170007[_0x844e('0x4f')]);_0x395f9a[_0x844e('0x58')]=_[_0x844e('0x51')](_0x395f9a[_0x844e('0x43')],_0x395f9a[_0x844e('0x4f')]);_0x4ab1c2[_0x844e('0x53')]=_[_0x844e('0x51')](_0x395f9a[_0x844e('0x43')],qs['fields'](_0x170007[_0x844e('0x4f')][_0x844e('0x52')]));_0x4ab1c2[_0x844e('0x53')]=_0x4ab1c2[_0x844e('0x53')][_0x844e('0x62')]?_0x4ab1c2['attributes']:_0x395f9a['model'];_0x4ab1c2[_0x844e('0x77')]=qs[_0x844e('0x56')](_0x170007[_0x844e('0x4f')]['sort']);_0x4ab1c2[_0x844e('0x57')]=qs[_0x844e('0x58')](_['pick'](_0x170007[_0x844e('0x4f')],_0x395f9a[_0x844e('0x58')]));if(_0x170007[_0x844e('0x4f')][_0x844e('0x5c')]){_0x4ab1c2[_0x844e('0x57')]=_[_0x844e('0x5a')](_0x4ab1c2[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0x4ab1c2[_0x844e('0x53')],function(_0x404095){var _0x145b21={};_0x145b21[_0x404095]={'$like':'%'+_0x170007['query']['filter']+'%'};return _0x145b21;})});}_0x4ab1c2=_[_0x844e('0x5a')]({},_0x4ab1c2,_0x170007[_0x844e('0x5d')]);return _0x1a8bc8['getProactiveActions'](_0x4ab1c2);}})[_0x844e('0x18')](function(_0x417f5f){if(_0x417f5f){_0x44a70d=_0x417f5f[_0x844e('0x62')];if(!_0x170007['query'][_0x844e('0x54')]('nolimit')){_0x4ab1c2[_0x844e('0x27')]=qs[_0x844e('0x27')](_0x170007[_0x844e('0x4f')][_0x844e('0x27')]);_0x4ab1c2['offset']=qs[_0x844e('0x26')](_0x170007['query']['offset']);}return _0x1a8bc8[_0x844e('0x125')](_0x4ab1c2);}})[_0x844e('0x18')](function(_0x1d02fb){if(_0x1d02fb){return _0x1d02fb?{'count':_0x44a70d,'rows':_0x1d02fb}:null;}})[_0x844e('0x18')](respondWithResult(_0x37ab57,null))['catch'](handleError(_0x37ab57,null));};exports[_0x844e('0x127')]=function(_0x1bf2bb,_0x508207){var _0x426bb8=_0x1bf2bb[_0x844e('0x4f')]['online']==='false'?_0x844e('0x128'):_0x844e('0x129');return db[_0x844e('0x4c')][_0x844e('0x63')]({'attributes':['id',_0x426bb8],'where':{'id':_0x1bf2bb[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x508207,null))[_0x844e('0x18')](function(_0x582c0d){if(_0x582c0d){var _0x44a22b=_0x582c0d[_0x426bb8];var _0x55eec1=_0x44a22b&&_0x44a22b[_0x844e('0x12a')]?_0x44a22b['items']:[];_0x508207[_0x844e('0x32')]({'fromKey':_['isNil'](_0x44a22b[_0x844e('0x12b')])?undefined:_0x44a22b[_0x844e('0x12b')],'count':_0x55eec1['length'],'rows':_0x55eec1});}})[_0x844e('0x22')](handleError(_0x508207,null));};exports[_0x844e('0x12c')]=function(_0x737f9f,_0x2a5a1b){var _0x3d0557={'raw':![],'where':{}};var _0x2d4040={};var _0x165544={'count':0x0,'rows':[]};return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x737f9f[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x2a5a1b,null))[_0x844e('0x18')](function(_0xe324e0){if(_0xe324e0){_0x2d4040[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0xdf')][_0x844e('0x61')]);_0x2d4040['query']=_[_0x844e('0x50')](_0x737f9f[_0x844e('0x4f')]);_0x2d4040['filters']=_[_0x844e('0x51')](_0x2d4040[_0x844e('0x43')],_0x2d4040['query']);_0x3d0557['attributes']=_[_0x844e('0x51')](_0x2d4040[_0x844e('0x43')],qs[_0x844e('0x52')](_0x737f9f[_0x844e('0x4f')][_0x844e('0x52')]));_0x3d0557['attributes']=_0x3d0557[_0x844e('0x53')][_0x844e('0x62')]?_0x3d0557['attributes']:_0x2d4040[_0x844e('0x43')];if(!_0x737f9f[_0x844e('0x4f')][_0x844e('0x54')]('nolimit')){_0x3d0557[_0x844e('0x27')]=qs[_0x844e('0x27')](_0x737f9f[_0x844e('0x4f')][_0x844e('0x27')]);_0x3d0557[_0x844e('0x26')]=qs['offset'](_0x737f9f[_0x844e('0x4f')]['offset']);}_0x3d0557[_0x844e('0x77')]=qs[_0x844e('0x56')](_0x737f9f[_0x844e('0x4f')][_0x844e('0x56')]);_0x3d0557['where']=qs['filters'](_[_0x844e('0x59')](_0x737f9f['query'],_0x2d4040[_0x844e('0x58')]));_0x3d0557[_0x844e('0x57')][_0x844e('0x73')]=_0xe324e0['id'];if(_0x737f9f[_0x844e('0x4f')][_0x844e('0x5c')]){_0x3d0557[_0x844e('0x57')]=_['merge'](_0x3d0557[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0x3d0557[_0x844e('0x53')],function(_0x1d6167){var _0x376b4c={};_0x376b4c[_0x1d6167]={'$like':'%'+_0x737f9f['query'][_0x844e('0x5c')]+'%'};return _0x376b4c;})});}_0x3d0557=_[_0x844e('0x5a')]({},_0x3d0557,_0x737f9f[_0x844e('0x5d')]);return db[_0x844e('0xdf')]['count']({'where':_0x3d0557['where']})[_0x844e('0x18')](function(_0x3a47af){_0x165544[_0x844e('0x29')]=_0x3a47af;if(_0x737f9f['query']['includeAll']){_0x3d0557[_0x844e('0x5f')]=[{'all':!![]}];}else{_0x3d0557[_0x844e('0x5f')]=[{'model':db[_0x844e('0xa1')],'as':_0x844e('0xfb'),'required':![]},{'model':db[_0x844e('0xe9')],'as':_0x844e('0x12d'),'required':![]}];}return db[_0x844e('0xdf')]['findAll'](_0x3d0557);})[_0x844e('0x18')](function(_0x5cc157){_0x165544[_0x844e('0x60')]=_0x5cc157;return _0x165544;});}})[_0x844e('0x18')](respondWithFilteredResult(_0x2a5a1b,_0x3d0557))[_0x844e('0x22')](handleError(_0x2a5a1b,null));};exports[_0x844e('0x12e')]=function(_0x44ac12,_0x13b300){return db[_0x844e('0x4c')]['find']({'where':{'id':_0x44ac12[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x13b300,null))['then'](function(_0x2aed50){if(_0x2aed50){return _0x2aed50[_0x844e('0x12e')](_0x44ac12[_0x844e('0x64')][_0x844e('0x7a')],_[_0x844e('0xf9')](_0x44ac12[_0x844e('0x64')],[_0x844e('0x7a'),'id'])||{})[_0x844e('0xd9')](function(_0x381fb2){for(var _0x4ef040=0x0;_0x4ef040<_0x44ac12[_0x844e('0x64')][_0x844e('0x7a')]['length'];_0x4ef040+=0x1){socket['emit'](_0x844e('0x12f'),{'UserId':Number(_0x44ac12[_0x844e('0x64')]['ids'][_0x4ef040]),'ChatWebsiteId':Number(_0x44ac12['params']['id'])});}return _0x381fb2;});}})[_0x844e('0x18')](respondWithResult(_0x13b300,null))[_0x844e('0x22')](handleError(_0x13b300,null));};exports['removeAgents']=function(_0x1c01c9,_0xe72f44){return db['ChatWebsite']['find']({'where':{'id':_0x1c01c9['params']['id']}})['then'](handleEntityNotFound(_0xe72f44,null))['then'](function(_0x1f6512){if(_0x1f6512){return _0x1f6512[_0x844e('0x130')](_0x1c01c9[_0x844e('0x4f')]['ids'])[_0x844e('0x18')](function(){if(_[_0x844e('0x131')](_0x1c01c9[_0x844e('0x4f')]['ids'])){for(var _0x479b82=0x0;_0x479b82<_0x1c01c9[_0x844e('0x4f')][_0x844e('0x7a')][_0x844e('0x62')];_0x479b82+=0x1){socket[_0x844e('0x132')](_0x844e('0x133'),{'UserId':Number(_0x1c01c9[_0x844e('0x4f')][_0x844e('0x7a')][_0x479b82]),'ChatWebsiteId':Number(_0x1c01c9['params']['id'])});}}else{socket[_0x844e('0x132')](_0x844e('0x133'),{'UserId':Number(_0x1c01c9[_0x844e('0x4f')][_0x844e('0x7a')]),'ChatWebsiteId':Number(_0x1c01c9['params']['id'])});}});}})[_0x844e('0x18')](respondWithStatusCode(_0xe72f44,null))[_0x844e('0x22')](handleError(_0xe72f44,null));};exports[_0x844e('0x134')]=function(_0x1a60b0,_0x155a7a){var _0x3e2b88={};var _0x1415e6={};var _0x92f231;var _0x3601c0;return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x1a60b0[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x155a7a,null))['then'](function(_0x486ed0){if(_0x486ed0){_0x92f231=_0x486ed0;_0x1415e6[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0xc5')][_0x844e('0x61')]);_0x1415e6[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x1a60b0[_0x844e('0x4f')]);_0x1415e6['filters']=_[_0x844e('0x51')](_0x1415e6['model'],_0x1415e6[_0x844e('0x4f')]);_0x3e2b88['attributes']=_[_0x844e('0x51')](_0x1415e6[_0x844e('0x43')],qs[_0x844e('0x52')](_0x1a60b0['query'][_0x844e('0x52')]));_0x3e2b88['attributes']=_0x3e2b88['attributes'][_0x844e('0x62')]?_0x3e2b88['attributes']:_0x1415e6[_0x844e('0x43')];_0x3e2b88[_0x844e('0x77')]=qs[_0x844e('0x56')](_0x1a60b0[_0x844e('0x4f')][_0x844e('0x56')]);_0x3e2b88[_0x844e('0x57')]=qs[_0x844e('0x58')](_[_0x844e('0x59')](_0x1a60b0[_0x844e('0x4f')],_0x1415e6[_0x844e('0x58')]));if(_0x1a60b0['query'][_0x844e('0x5c')]){_0x3e2b88[_0x844e('0x57')]=_[_0x844e('0x5a')](_0x3e2b88[_0x844e('0x57')],{'$or':_['map'](_0x3e2b88['attributes'],function(_0x4b406a){var _0x5c2675={};_0x5c2675[_0x4b406a]={'$like':'%'+_0x1a60b0[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x5c2675;})});}_0x3e2b88=_[_0x844e('0x5a')]({},_0x3e2b88,_0x1a60b0[_0x844e('0x5d')]);return _0x92f231[_0x844e('0x134')](_0x3e2b88);}})['then'](function(_0x133d31){if(_0x133d31){_0x3601c0=_0x133d31[_0x844e('0x62')];if(!_0x1a60b0['query'][_0x844e('0x54')](_0x844e('0x55'))){_0x3e2b88['limit']=qs[_0x844e('0x27')](_0x1a60b0[_0x844e('0x4f')][_0x844e('0x27')]);_0x3e2b88['offset']=qs[_0x844e('0x26')](_0x1a60b0[_0x844e('0x4f')][_0x844e('0x26')]);}return _0x92f231[_0x844e('0x134')](_0x3e2b88);}})[_0x844e('0x18')](function(_0x23fec3){if(_0x23fec3){return _0x23fec3?{'count':_0x3601c0,'rows':_0x23fec3}:null;}})[_0x844e('0x18')](respondWithResult(_0x155a7a,null))[_0x844e('0x22')](handleError(_0x155a7a,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 69404f9..c3ba9c5 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 _0x4944=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x42d32d,_0xe5bac){var _0x2607b4=function(_0x2d8481){while(--_0x2d8481){_0x42d32d['push'](_0x42d32d['shift']());}};_0x2607b4(++_0xe5bac);}(_0x4944,0x6d));var _0x4494=function(_0x417d14,_0x59a971){_0x417d14=_0x417d14-0x0;var _0x5493cc=_0x4944[_0x417d14];return _0x5493cc;};'use strict';var EventEmitter=require(_0x4494('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x4494('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4494('0x2')](0x0);var events={'afterCreate':_0x4494('0x3'),'afterUpdate':_0x4494('0x4'),'afterDestroy':_0x4494('0x5')};function emitEvent(_0x5074d9){return function(_0x187098,_0x5c7492,_0x370748){ChatWebsiteEvents[_0x4494('0x6')](_0x5074d9+':'+_0x187098['id'],_0x187098);ChatWebsiteEvents[_0x4494('0x6')](_0x5074d9,_0x187098);_0x370748(null);};}for(var e in events){if(events[_0x4494('0x7')](e)){var event=events[e];ChatWebsite[_0x4494('0x8')](e,emitEvent(event));}}module[_0x4494('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xc252=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update'];(function(_0x4eacbb,_0x1bc3d1){var _0x549393=function(_0x1ebfc0){while(--_0x1ebfc0){_0x4eacbb['push'](_0x4eacbb['shift']());}};_0x549393(++_0x1bc3d1);}(_0xc252,0x118));var _0x2c25=function(_0x42ef26,_0x21a04b){_0x42ef26=_0x42ef26-0x0;var _0x4f61c2=_0xc252[_0x42ef26];return _0x4f61c2;};'use strict';var EventEmitter=require(_0x2c25('0x0'));var ChatWebsite=require(_0x2c25('0x1'))['db'][_0x2c25('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2c25('0x3')](0x0);var events={'afterCreate':_0x2c25('0x4'),'afterUpdate':_0x2c25('0x5'),'afterDestroy':_0x2c25('0x6')};function emitEvent(_0xd6718e){return function(_0x5815ad,_0x5e2a2a,_0x244f8c){ChatWebsiteEvents['emit'](_0xd6718e+':'+_0x5815ad['id'],_0x5815ad);ChatWebsiteEvents[_0x2c25('0x7')](_0xd6718e,_0x5815ad);_0x244f8c(null);};}for(var e in events){if(events[_0x2c25('0x8')](e)){var event=events[e];ChatWebsite[_0x2c25('0x9')](e,emitEvent(event));}}module[_0x2c25('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 436a58b..bb4cd64 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 _0xb3a0=['chat_websites','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0xb3a0,0x1e1));var _0x0b3a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb3a0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0b3a('0x0'));var util=require(_0x0b3a('0x1'));var logger=require(_0x0b3a('0x2'))(_0x0b3a('0x3'));var moment=require(_0x0b3a('0x4'));var BPromise=require(_0x0b3a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b3a('0x6'));var rimraf=require('rimraf');var config=require(_0x0b3a('0x7'));var attributes=require(_0x0b3a('0x8'));module[_0x0b3a('0x9')]=function(_0x695955,_0x1592eb){return _0x695955[_0x0b3a('0xa')]('ChatWebsite',attributes,{'tableName':_0x0b3a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x459e=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x459e,0x18c));var _0xe459=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x459e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe459('0x0'));var util=require(_0xe459('0x1'));var logger=require('../../config/logger')(_0xe459('0x2'));var moment=require(_0xe459('0x3'));var BPromise=require('bluebird');var rp=require(_0xe459('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe459('0x5'));var config=require(_0xe459('0x6'));var attributes=require(_0xe459('0x7'));module[_0xe459('0x8')]=function(_0x21bc20,_0x9a1631){return _0x21bc20[_0xe459('0x9')](_0xe459('0xa'),attributes,{'tableName':_0xe459('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 398001d..5480788 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 _0xd5b5=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x17c8cc,_0x5e5647){var _0x3db4eb=function(_0x2082db){while(--_0x2082db){_0x17c8cc['push'](_0x17c8cc['shift']());}};_0x3db4eb(++_0x5e5647);}(_0xd5b5,0xec));var _0x5d5b=function(_0x1c7d08,_0x46c032){_0x1c7d08=_0x1c7d08-0x0;var _0x2c6fa2=_0xd5b5[_0x1c7d08];return _0x2c6fa2;};'use strict';var _=require(_0x5d5b('0x0'));var util=require(_0x5d5b('0x1'));var moment=require(_0x5d5b('0x2'));var BPromise=require(_0x5d5b('0x3'));var rs=require(_0x5d5b('0x4'));var fs=require('fs');var Redis=require(_0x5d5b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d5b('0x6'))(_0x5d5b('0x7'));var config=require(_0x5d5b('0x8'));var jayson=require(_0x5d5b('0x9'));var client=jayson[_0x5d5b('0xa')][_0x5d5b('0xb')]({'port':0x232a});config['redis']=_[_0x5d5b('0xc')](config[_0x5d5b('0xd')],{'host':_0x5d5b('0xe'),'port':0x18eb});var socket=require(_0x5d5b('0xf'))(new Redis(config[_0x5d5b('0xd')]));require(_0x5d5b('0x10'))[_0x5d5b('0x11')](socket);function respondWithRpcPromise(_0x93ca4a,_0x3b70ee,_0x2b149c){return new BPromise(function(_0x4af2c5,_0x578132){return client['request'](_0x93ca4a,_0x2b149c)['then'](function(_0x2aa97e){logger['info'](_0x5d5b('0x12'),_0x3b70ee,_0x5d5b('0x13'));logger[_0x5d5b('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3b70ee,'request\x20sent',JSON[_0x5d5b('0x15')](_0x2aa97e));if(_0x2aa97e[_0x5d5b('0x16')]){if(_0x2aa97e[_0x5d5b('0x16')][_0x5d5b('0x17')]===0x1f4){logger[_0x5d5b('0x16')](_0x5d5b('0x12'),_0x3b70ee,_0x2aa97e[_0x5d5b('0x16')][_0x5d5b('0x18')]);return _0x578132(_0x2aa97e[_0x5d5b('0x16')][_0x5d5b('0x18')]);}logger[_0x5d5b('0x16')](_0x5d5b('0x12'),_0x3b70ee,_0x2aa97e[_0x5d5b('0x16')]['message']);return _0x4af2c5(_0x2aa97e['error']['message']);}else{logger[_0x5d5b('0x19')](_0x5d5b('0x12'),_0x3b70ee,_0x5d5b('0x13'));_0x4af2c5(_0x2aa97e['result'][_0x5d5b('0x18')]);}})[_0x5d5b('0x1a')](function(_0x372a16){logger[_0x5d5b('0x16')](_0x5d5b('0x12'),_0x3b70ee,_0x372a16);_0x578132(_0x372a16);});});} \ No newline at end of file +var _0xe6a1=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x144b2b,_0x2a0b0f){var _0x599c5a=function(_0x1da07a){while(--_0x1da07a){_0x144b2b['push'](_0x144b2b['shift']());}};_0x599c5a(++_0x2a0b0f);}(_0xe6a1,0x153));var _0x1e6a=function(_0x16171c,_0x223d97){_0x16171c=_0x16171c-0x0;var _0x3d37c0=_0xe6a1[_0x16171c];return _0x3d37c0;};'use strict';var _=require(_0x1e6a('0x0'));var util=require(_0x1e6a('0x1'));var moment=require('moment');var BPromise=require(_0x1e6a('0x2'));var rs=require(_0x1e6a('0x3'));var fs=require('fs');var Redis=require(_0x1e6a('0x4'));var db=require(_0x1e6a('0x5'))['db'];var utils=require(_0x1e6a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1e6a('0x7'));var jayson=require(_0x1e6a('0x8'));var client=jayson[_0x1e6a('0x9')][_0x1e6a('0xa')]({'port':0x232a});config[_0x1e6a('0xb')]=_[_0x1e6a('0xc')](config[_0x1e6a('0xb')],{'host':_0x1e6a('0xd'),'port':0x18eb});var socket=require(_0x1e6a('0xe'))(new Redis(config[_0x1e6a('0xb')]));require(_0x1e6a('0xf'))['register'](socket);function respondWithRpcPromise(_0x3780d2,_0x486d3f,_0x31bb19){return new BPromise(function(_0x1084ec,_0x2bc7c7){return client['request'](_0x3780d2,_0x31bb19)[_0x1e6a('0x10')](function(_0x976310){logger[_0x1e6a('0x11')](_0x1e6a('0x12'),_0x486d3f,_0x1e6a('0x13'));logger[_0x1e6a('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x486d3f,_0x1e6a('0x13'),JSON[_0x1e6a('0x15')](_0x976310));if(_0x976310[_0x1e6a('0x16')]){if(_0x976310[_0x1e6a('0x16')][_0x1e6a('0x17')]===0x1f4){logger[_0x1e6a('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x486d3f,_0x976310[_0x1e6a('0x16')][_0x1e6a('0x18')]);return _0x2bc7c7(_0x976310[_0x1e6a('0x16')][_0x1e6a('0x18')]);}logger[_0x1e6a('0x16')](_0x1e6a('0x12'),_0x486d3f,_0x976310[_0x1e6a('0x16')][_0x1e6a('0x18')]);return _0x1084ec(_0x976310['error'][_0x1e6a('0x18')]);}else{logger['info'](_0x1e6a('0x12'),_0x486d3f,'request\x20sent');_0x1084ec(_0x976310[_0x1e6a('0x19')][_0x1e6a('0x18')]);}})['catch'](function(_0x42b96a){logger[_0x1e6a('0x16')](_0x1e6a('0x12'),_0x486d3f,_0x42b96a);_0x2bc7c7(_0x42b96a);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 8738969..eccf3ad 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 _0xef7b=['remove','update','emit','removeListener','register','save'];(function(_0x4ca42c,_0x42bc1e){var _0x119e6f=function(_0x1b6822){while(--_0x1b6822){_0x4ca42c['push'](_0x4ca42c['shift']());}};_0x119e6f(++_0x42bc1e);}(_0xef7b,0xd7));var _0xbef7=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xef7b[_0x35b18a];return _0x4db1bd;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xbef7('0x0'),_0xbef7('0x1'),_0xbef7('0x2')];function createListener(_0x14aa04,_0x4ee82e){return function(_0x22fe3e){_0x4ee82e[_0xbef7('0x3')](_0x14aa04,_0x22fe3e);};}function removeListener(_0x40581f,_0x359cb6){return function(){ChatWebsiteEvents[_0xbef7('0x4')](_0x40581f,_0x359cb6);};}exports[_0xbef7('0x5')]=function(_0xed6ec7){for(var _0x50e382=0x0,_0x5c0b55=events['length'];_0x50e382<_0x5c0b55;_0x50e382++){var _0x52ad2b=events[_0x50e382];var _0x22a2b9=createListener('chatWebsite:'+_0x52ad2b,_0xed6ec7);ChatWebsiteEvents['on'](_0x52ad2b,_0x22a2b9);}}; \ No newline at end of file +var _0x1c8c=['./chatWebsite.events','save','update','emit','removeListener','chatWebsite:'];(function(_0x46a509,_0x44fa7d){var _0x23832f=function(_0x45d7b3){while(--_0x45d7b3){_0x46a509['push'](_0x46a509['shift']());}};_0x23832f(++_0x44fa7d);}(_0x1c8c,0x180));var _0xc1c8=function(_0x2f1ab5,_0x2966be){_0x2f1ab5=_0x2f1ab5-0x0;var _0x5c7e72=_0x1c8c[_0x2f1ab5];return _0x5c7e72;};'use strict';var ChatWebsiteEvents=require(_0xc1c8('0x0'));var events=[_0xc1c8('0x1'),'remove',_0xc1c8('0x2')];function createListener(_0xcdd249,_0x2f84ce){return function(_0x4eb446){_0x2f84ce[_0xc1c8('0x3')](_0xcdd249,_0x4eb446);};}function removeListener(_0x2820b1,_0x3bdb13){return function(){ChatWebsiteEvents[_0xc1c8('0x4')](_0x2820b1,_0x3bdb13);};}exports['register']=function(_0xb8c6d3){for(var _0x7d174d=0x0,_0xb13b89=events['length'];_0x7d174d<_0xb13b89;_0x7d174d++){var _0x2ec599=events[_0x7d174d];var _0x4d21a9=createListener(_0xc1c8('0x5')+_0x2ec599,_0xb8c6d3);ChatWebsiteEvents['on'](_0x2ec599,_0x4d21a9);}}; \ 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 8797727..f8eb6c8 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 _0x9672=['trim','([\x5cw]+)','localhost','exports','../../../utils/misc','escapeRegExp','URL','replace','test'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0x9672,0xee));var _0x2967=function(_0x497652,_0x27a41b){_0x497652=_0x497652-0x0;var _0x171068=_0x9672[_0x497652];return _0x171068;};var escapeRegExp=require(_0x2967('0x0'))[_0x2967('0x1')];var URL=require('url')[_0x2967('0x2')];function testWildcardValidity(_0xcaaf25){var _0x1228b8=!![];try{new URL(_0xcaaf25[_0x2967('0x3')]('*','localhost'));}catch(_0x264152){_0x1228b8=![];}return _0x1228b8&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x2967('0x4')](_0xcaaf25);}function testWebsiteWithWildcard(_0x22257d,_0x51ddb1){var _0x4baad7;var _0x24424d=escapeRegExp(_0x22257d[_0x2967('0x5')]()[_0x2967('0x3')](/\/$/,''))[_0x2967('0x3')]('\x5c*',_0x2967('0x6'));try{new URL(_0x22257d[_0x2967('0x3')]('\x5c*',_0x2967('0x7')));_0x4baad7=new RegExp(_0x24424d)[_0x2967('0x4')](_0x51ddb1);}catch(_0x4aec0f){_0x4baad7=![];}return _0x4baad7;}module[_0x2967('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x110f=['../../../utils/misc','escapeRegExp','localhost','test','replace','([\x5cw]+)'];(function(_0x293978,_0x5868cb){var _0x45b1e5=function(_0x5b6cdf){while(--_0x5b6cdf){_0x293978['push'](_0x293978['shift']());}};_0x45b1e5(++_0x5868cb);}(_0x110f,0x1e6));var _0xf110=function(_0x129bd0,_0x1f026d){_0x129bd0=_0x129bd0-0x0;var _0x5d6fcb=_0x110f[_0x129bd0];return _0x5d6fcb;};var escapeRegExp=require(_0xf110('0x0'))[_0xf110('0x1')];var URL=require('url')['URL'];function testWildcardValidity(_0x51c98c){var _0x41dd25=!![];try{new URL(_0x51c98c['replace']('*',_0xf110('0x2')));}catch(_0x3f60d0){_0x41dd25=![];}return _0x41dd25&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xf110('0x3')](_0x51c98c);}function testWebsiteWithWildcard(_0x593f50,_0x2f4a0f){var _0x3147fd;var _0xc27675=escapeRegExp(_0x593f50['trim']()[_0xf110('0x4')](/\/$/,''))[_0xf110('0x4')]('\x5c*',_0xf110('0x5'));try{new URL(_0x593f50['replace']('\x5c*',_0xf110('0x2')));_0x3147fd=new RegExp(_0xc27675)[_0xf110('0x3')](_0x2f4a0f);}catch(_0x11c28f){_0x3147fd=![];}return _0x3147fd;}module['exports']={'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 5e21108..5d1a50e 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 _0xad69=['isAuthenticated','index','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','diskStorage','/:id/avatar','file','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','any','offline','addInteraction','addApplications','/:id/proactive_actions','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get'];(function(_0x3d11be,_0x1b9a8c){var _0x4b657b=function(_0x4a96f2){while(--_0x4a96f2){_0x3d11be['push'](_0x3d11be['shift']());}};_0x4b657b(++_0x1b9a8c);}(_0xad69,0x184));var _0x9ad6=function(_0xf9414a,_0x5347ff){_0xf9414a=_0xf9414a-0x0;var _0x328e50=_0xad69[_0xf9414a];return _0x328e50;};'use strict';var multer=require(_0x9ad6('0x0'));var util=require(_0x9ad6('0x1'));var path=require(_0x9ad6('0x2'));var timeout=require(_0x9ad6('0x3'));var express=require('express');var router=express[_0x9ad6('0x4')]();var fs_extra=require(_0x9ad6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ad6('0x6'));var controller=require('./chatWebsite.controller');router[_0x9ad6('0x7')]('/',auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x9')]);router[_0x9ad6('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9ad6('0x7')](_0x9ad6('0xa'),auth[_0x9ad6('0x8')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9ad6('0xb')]);router['get'](_0x9ad6('0xc'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0xd')]);router[_0x9ad6('0x7')](_0x9ad6('0xe'),controller[_0x9ad6('0xf')]);router[_0x9ad6('0x7')]('/:id/avatar',controller[_0x9ad6('0x10')]);router[_0x9ad6('0x7')](_0x9ad6('0x11'),controller[_0x9ad6('0x12')]);router[_0x9ad6('0x7')](_0x9ad6('0x13'),controller[_0x9ad6('0x14')]);router['get'](_0x9ad6('0x15'),auth[_0x9ad6('0x8')](),controller['getInteractions']);router['get']('/:id/snippet',controller[_0x9ad6('0x16')]);router[_0x9ad6('0x7')](_0x9ad6('0x17'),auth['isAuthenticated'](),controller[_0x9ad6('0x18')]);router[_0x9ad6('0x7')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x9ad6('0x19')]);router[_0x9ad6('0x7')]('/:id/fields',controller[_0x9ad6('0x1a')]);router['get']('/:id/offline_messages',auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x1b')]);router[_0x9ad6('0x7')](_0x9ad6('0x1c'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x1d')]);router[_0x9ad6('0x1e')]('/',auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x1f')]);router[_0x9ad6('0x1e')](_0x9ad6('0x20'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x21')]);router[_0x9ad6('0x1e')](_0x9ad6('0xc'),auth[_0x9ad6('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36ef32,_0x2edcbc,_0x24e3ac){_0x24e3ac(null,path[_0x9ad6('0x22')](config[_0x9ad6('0x23')],_0x9ad6('0x24')));},'filename':function(_0x5db2f4,_0x5137a2,_0x5e9c65){_0x5e9c65(null,util[_0x9ad6('0x25')](_0x9ad6('0x26'),Date[_0x9ad6('0x27')](),_0x5137a2[_0x9ad6('0x28')]));}})});router[_0x9ad6('0x1e')](_0x9ad6('0xe'),upload[_0x9ad6('0x29')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x9ad6('0x2a')]({'destination':function(_0x18fb2c,_0x7d6df6,_0x4ccdf4){_0x4ccdf4(null,path[_0x9ad6('0x22')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x13a84,_0x11bed3,_0x2dc134){_0x2dc134(null,util['format'](_0x9ad6('0x26'),Date['now'](),_0x11bed3[_0x9ad6('0x28')]));}})});router['post'](_0x9ad6('0x2b'),upload['single'](_0x9ad6('0x2c')),controller[_0x9ad6('0x2d')]);var upload=multer({'storage':multer[_0x9ad6('0x2a')]({'destination':function(_0x44345a,_0x22671d,_0x5d4abd){_0x5d4abd(null,path[_0x9ad6('0x22')](config[_0x9ad6('0x23')],_0x9ad6('0x2e')));},'filename':function(_0x2a0dc5,_0x41704a,_0x218071){_0x218071(null,util[_0x9ad6('0x25')](_0x9ad6('0x26'),Date[_0x9ad6('0x27')](),_0x41704a[_0x9ad6('0x28')]));}})});router['post'](_0x9ad6('0x11'),upload[_0x9ad6('0x29')](_0x9ad6('0x2c')),controller[_0x9ad6('0x2f')]);var upload=multer({'storage':multer[_0x9ad6('0x2a')]({'destination':function(_0x1aa60b,_0x4ab015,_0x507b4a){_0x507b4a(null,path[_0x9ad6('0x22')](config[_0x9ad6('0x23')],_0x9ad6('0x2e')));},'filename':function(_0x209bb9,_0x33af08,_0x431eb4){_0x431eb4(null,util[_0x9ad6('0x25')](_0x9ad6('0x26'),Date[_0x9ad6('0x27')](),_0x33af08[_0x9ad6('0x28')]));}})});router[_0x9ad6('0x1e')](_0x9ad6('0x13'),upload[_0x9ad6('0x29')](_0x9ad6('0x2c')),controller[_0x9ad6('0x30')]);router[_0x9ad6('0x1e')](_0x9ad6('0x31'),controller[_0x9ad6('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0x9ad6('0x2a')]({'destination':function(_0x2af3cf,_0x3b77fa,_0x597661){const _0xf537ba=path[_0x9ad6('0x22')](config[_0x9ad6('0x23')],_0x9ad6('0x33'),'attachments',_0x9ad6('0x34'));fs_extra[_0x9ad6('0x35')](_0xf537ba,function(){_0x597661(null,_0xf537ba);});},'filename':function(_0x3acca5,_0x2917cd,_0x379f66){const _0x48b578=_0x2917cd[_0x9ad6('0x28')][_0x9ad6('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x42e6b3=path[_0x9ad6('0x37')](_0x48b578);const _0x55fb73=Date[_0x9ad6('0x27')]()+'-'+_0x48b578[_0x9ad6('0x36')](_0x42e6b3,'')+_0x42e6b3;_0x379f66(null,_0x55fb73);}})});router[_0x9ad6('0x1e')]('/:id/offline',offlineUploadMulter[_0x9ad6('0x38')](),controller[_0x9ad6('0x39')]);router['post'](_0x9ad6('0x15'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x3a')]);router['post'](_0x9ad6('0x17'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x3b')]);router['post'](_0x9ad6('0x3c'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x9ad6('0x1e')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x9ad6('0xa'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x3d')]);router[_0x9ad6('0x3e')](_0x9ad6('0xa'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x3f')]);router[_0x9ad6('0x3e')](_0x9ad6('0x20'),auth['isAuthenticated'](),controller[_0x9ad6('0x40')]);router['delete'](_0x9ad6('0xc'),auth[_0x9ad6('0x8')](),controller['removeAnswers']);router[_0x9ad6('0x3e')](_0x9ad6('0x1c'),auth[_0x9ad6('0x8')](),controller['removeAgents']);module[_0x9ad6('0x41')]=router; \ No newline at end of file +var _0x0e2b=['create','/:id/dispositions','addDisposition','post','addAnswer','diskStorage','join','root','format','originalname','single','file','addLogo','server/files/images/avatars/','%s-%s','addAvatar','now','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents'];(function(_0x665846,_0x5503d8){var _0x16c349=function(_0x2b34a9){while(--_0x2b34a9){_0x665846['push'](_0x665846['shift']());}};_0x16c349(++_0x5503d8);}(_0x0e2b,0xc4));var _0xb0e2=function(_0x201b69,_0x4a9b92){_0x201b69=_0x201b69-0x0;var _0x5a0c53=_0x0e2b[_0x201b69];return _0x5a0c53;};'use strict';var multer=require(_0xb0e2('0x0'));var util=require('util');var path=require(_0xb0e2('0x1'));var timeout=require(_0xb0e2('0x2'));var express=require(_0xb0e2('0x3'));var router=express[_0xb0e2('0x4')]();var fs_extra=require(_0xb0e2('0x5'));var auth=require(_0xb0e2('0x6'));var interaction=require(_0xb0e2('0x7'));var config=require('../../config/environment');var controller=require(_0xb0e2('0x8'));router[_0xb0e2('0x9')]('/',auth[_0xb0e2('0xa')](),controller[_0xb0e2('0xb')]);router['get'](_0xb0e2('0xc'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0xd')]);router[_0xb0e2('0x9')](_0xb0e2('0xe'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0xf')]);router[_0xb0e2('0x9')]('/:id/dispositions',auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x10')]);router[_0xb0e2('0x9')](_0xb0e2('0x11'),auth[_0xb0e2('0xa')](),controller['getAnswers']);router[_0xb0e2('0x9')](_0xb0e2('0x12'),controller[_0xb0e2('0x13')]);router[_0xb0e2('0x9')](_0xb0e2('0x14'),controller[_0xb0e2('0x15')]);router[_0xb0e2('0x9')](_0xb0e2('0x16'),controller[_0xb0e2('0x17')]);router[_0xb0e2('0x9')](_0xb0e2('0x18'),controller[_0xb0e2('0x19')]);router[_0xb0e2('0x9')](_0xb0e2('0x1a'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xb0e2('0x9')](_0xb0e2('0x1b'),controller[_0xb0e2('0x1c')]);router[_0xb0e2('0x9')]('/:id/applications',auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x1d')]);router[_0xb0e2('0x9')](_0xb0e2('0x1e'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x1f')]);router[_0xb0e2('0x9')](_0xb0e2('0x20'),controller[_0xb0e2('0x21')]);router['get'](_0xb0e2('0x22'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x23')]);router[_0xb0e2('0x9')](_0xb0e2('0x24'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x25')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb0e2('0x26')]);router['post'](_0xb0e2('0x27'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x28')]);router[_0xb0e2('0x29')](_0xb0e2('0x11'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x2a')]);var upload=multer({'storage':multer[_0xb0e2('0x2b')]({'destination':function(_0x38e4c5,_0x5a68c1,_0x1dc759){_0x1dc759(null,path[_0xb0e2('0x2c')](config[_0xb0e2('0x2d')],'server/files/images/logos/'));},'filename':function(_0x4b565c,_0x23b24f,_0x30c307){_0x30c307(null,util[_0xb0e2('0x2e')]('%s-%s',Date['now'](),_0x23b24f[_0xb0e2('0x2f')]));}})});router[_0xb0e2('0x29')](_0xb0e2('0x12'),upload[_0xb0e2('0x30')](_0xb0e2('0x31')),controller[_0xb0e2('0x32')]);var upload=multer({'storage':multer[_0xb0e2('0x2b')]({'destination':function(_0x4db140,_0x5a941a,_0x2bc536){_0x2bc536(null,path[_0xb0e2('0x2c')](config[_0xb0e2('0x2d')],_0xb0e2('0x33')));},'filename':function(_0x43ee2e,_0x3f415a,_0x93df85){_0x93df85(null,util[_0xb0e2('0x2e')](_0xb0e2('0x34'),Date['now'](),_0x3f415a['originalname']));}})});router[_0xb0e2('0x29')](_0xb0e2('0x14'),upload[_0xb0e2('0x30')](_0xb0e2('0x31')),controller[_0xb0e2('0x35')]);var upload=multer({'storage':multer[_0xb0e2('0x2b')]({'destination':function(_0x4d0ac1,_0x4a9699,_0x4b7b2c){_0x4b7b2c(null,path[_0xb0e2('0x2c')](config['root'],_0xb0e2('0x33')));},'filename':function(_0x8c1b31,_0x4469e4,_0x1db9d8){_0x1db9d8(null,util[_0xb0e2('0x2e')](_0xb0e2('0x34'),Date[_0xb0e2('0x36')](),_0x4469e4[_0xb0e2('0x2f')]));}})});router['post']('/:id/customer_avatar',upload[_0xb0e2('0x30')](_0xb0e2('0x31')),controller[_0xb0e2('0x37')]);var upload=multer({'storage':multer[_0xb0e2('0x2b')]({'destination':function(_0xe485e0,_0x175618,_0x4b1634){_0x4b1634(null,path[_0xb0e2('0x2c')](config[_0xb0e2('0x2d')],_0xb0e2('0x33')));},'filename':function(_0xf113d9,_0x3c1c66,_0x754298){_0x754298(null,util[_0xb0e2('0x2e')](_0xb0e2('0x34'),Date[_0xb0e2('0x36')](),_0x3c1c66[_0xb0e2('0x2f')]));}})});router['post'](_0xb0e2('0x18'),upload[_0xb0e2('0x30')](_0xb0e2('0x31')),controller[_0xb0e2('0x38')]);router['post'](_0xb0e2('0x39'),controller[_0xb0e2('0x3a')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x572e7e,_0x47a873,_0x2987d1){const _0x59f58c=path['join'](config['root'],_0xb0e2('0x3b'),_0xb0e2('0x3c'),_0xb0e2('0x3d'));fs_extra['ensureDir'](_0x59f58c,function(){_0x2987d1(null,_0x59f58c);});},'filename':function(_0x3ccd07,_0xd8b1d7,_0x269e47){const _0x1d4511=_0xd8b1d7['originalname'][_0xb0e2('0x3e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xdcb853=path[_0xb0e2('0x3f')](_0x1d4511);const _0x264111=Date['now']()+'-'+_0x1d4511[_0xb0e2('0x3e')](_0xdcb853,'')+_0xdcb853;_0x269e47(null,_0x264111);}})});router[_0xb0e2('0x29')](_0xb0e2('0x40'),offlineUploadMulter[_0xb0e2('0x41')](),controller[_0xb0e2('0x42')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0xb0e2('0x43')]);router[_0xb0e2('0x29')](_0xb0e2('0x44'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x45')]);router[_0xb0e2('0x29')](_0xb0e2('0x1e'),auth['isAuthenticated'](),controller[_0xb0e2('0x46')]);router[_0xb0e2('0x29')](_0xb0e2('0x24'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x47')]);router[_0xb0e2('0x48')](_0xb0e2('0xe'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x49')]);router[_0xb0e2('0x4a')](_0xb0e2('0xe'),auth['isAuthenticated'](),controller[_0xb0e2('0x4b')]);router[_0xb0e2('0x4a')](_0xb0e2('0x27'),auth['isAuthenticated'](),controller[_0xb0e2('0x4c')]);router[_0xb0e2('0x4a')](_0xb0e2('0x11'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x4d')]);router['delete'](_0xb0e2('0x24'),auth[_0xb0e2('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 4e1b399..a51f0c2 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 _0x8e60=['env','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports','express','../components/auth/service','../config/environment','Router'];(function(_0x1e097e,_0x23f56c){var _0x76d7d2=function(_0x52f510){while(--_0x52f510){_0x1e097e['push'](_0x1e097e['shift']());}};_0x76d7d2(++_0x23f56c);}(_0x8e60,0x15b));var _0x08e6=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x8e60[_0x71e493];return _0x3d40ab;};var beaverLogger=require('beaver-logger/server');var express=require(_0x08e6('0x0'));var auth=require(_0x08e6('0x1'));var config=require(_0x08e6('0x2'));var router=express[_0x08e6('0x3')]();var isProduction=config[_0x08e6('0x4')]==='production'||![];function clientSideLogs(_0x51cbc0,_0x382671,_0x57a747){var _0xe77a74=_0x51cbc0[_0x08e6('0x5')][_0x08e6('0x6')](_0x08e6('0x7'));if(!_0xe77a74){throw new Error(_0x08e6('0x8'));}return beaverLogger[_0x08e6('0x9')]({'uri':_0x08e6('0xa'),'logger':_0xe77a74,'enableCors':!isProduction})(_0x51cbc0,_0x382671,_0x57a747);}router['use'](auth[_0x08e6('0xb')](),clientSideLogs);module[_0x08e6('0xc')]=router; \ No newline at end of file +var _0x8a0a=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','beaver-logger/server','express','../components/auth/service','../config/environment','env','production','app','get'];(function(_0xee99a8,_0x1312c0){var _0x374681=function(_0x35a7c9){while(--_0x35a7c9){_0xee99a8['push'](_0xee99a8['shift']());}};_0x374681(++_0x1312c0);}(_0x8a0a,0xb3));var _0xa8a0=function(_0x27fca1,_0x40af1d){_0x27fca1=_0x27fca1-0x0;var _0x2f6dfa=_0x8a0a[_0x27fca1];return _0x2f6dfa;};var beaverLogger=require(_0xa8a0('0x0'));var express=require(_0xa8a0('0x1'));var auth=require(_0xa8a0('0x2'));var config=require(_0xa8a0('0x3'));var router=express['Router']();var isProduction=config[_0xa8a0('0x4')]===_0xa8a0('0x5')||![];function clientSideLogs(_0x12045b,_0x56a71f,_0x4e9f0e){var _0x4d3f67=_0x12045b[_0xa8a0('0x6')][_0xa8a0('0x7')]('client-side-logger');if(!_0x4d3f67){throw new Error(_0xa8a0('0x8'));}return beaverLogger[_0xa8a0('0x9')]({'uri':_0xa8a0('0xa'),'logger':_0x4d3f67,'enableCors':!isProduction})(_0x12045b,_0x56a71f,_0x4e9f0e);}router['use'](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b90a52c..9e7ef79 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 _0xa635=['ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x5b2ade,_0x4c70ef){var _0x5f24dd=function(_0x57fce5){while(--_0x57fce5){_0x5b2ade['push'](_0x5b2ade['shift']());}};_0x5f24dd(++_0x4c70ef);}(_0xa635,0xcd));var _0x5a63=function(_0x214730,_0xbfcce4){_0x214730=_0x214730-0x0;var _0x82af15=_0xa635[_0x214730];return _0x82af15;};'use strict';var Sequelize=require(_0x5a63('0x0'));module[_0x5a63('0x1')]={'name':{'type':Sequelize[_0x5a63('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5a63('0x3')]('AmazonAWS',_0x5a63('0x4'),_0x5a63('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5a63('0x3')](_0x5a63('0x6'),_0x5a63('0x7'))},'data1':{'type':Sequelize[_0x5a63('0x2')],'comment':_0x5a63('0x8')},'data2':{'type':Sequelize['STRING'],'comment':_0x5a63('0x9')},'data3':{'type':Sequelize[_0x5a63('0x2')],'comment':_0x5a63('0xa')},'data4':{'type':Sequelize[_0x5a63('0x2')],'comment':_0x5a63('0xb')},'data5':{'type':Sequelize[_0x5a63('0xc')],'comment':_0x5a63('0xd')},'data6':{'type':Sequelize[_0x5a63('0xc')],'comment':_0x5a63('0xe')},'data7':{'type':Sequelize[_0x5a63('0xc')],'comment':_0x5a63('0xf')}}; \ No newline at end of file +var _0xd1ba=['ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','Google','MicrosoftAzure'];(function(_0x4e204d,_0x7d3f57){var _0x206e69=function(_0x10056c){while(--_0x10056c){_0x4e204d['push'](_0x4e204d['shift']());}};_0x206e69(++_0x7d3f57);}(_0xd1ba,0x12f));var _0xad1b=function(_0x482c10,_0x16ea3c){_0x482c10=_0x482c10-0x0;var _0x313969=_0xd1ba[_0x482c10];return _0x313969;};'use strict';var Sequelize=require(_0xad1b('0x0'));module[_0xad1b('0x1')]={'name':{'type':Sequelize[_0xad1b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0xad1b('0x3'),_0xad1b('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xad1b('0x5')](_0xad1b('0x6'),_0xad1b('0x7'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0xad1b('0x8')},'data3':{'type':Sequelize[_0xad1b('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xad1b('0x2')],'comment':_0xad1b('0x9')},'data5':{'type':Sequelize[_0xad1b('0xa')],'comment':_0xad1b('0xb')},'data6':{'type':Sequelize[_0xad1b('0xa')],'comment':_0xad1b('0xc')},'data7':{'type':Sequelize[_0xad1b('0xa')],'comment':_0xad1b('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index fd5526a..e9cb126 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 _0xdc19=['code','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','ioredis','../../config/environment','api','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','padEnd','slice','map','CloudProvider','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','decryptString','data3','show','params','find','service','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','create','catch','oauth2MicrosoftAuthorize','findOne','oauth2MicrosoftCallback','Invalid\x20state\x20parameter','state','base64','toString','parse','isValidIdToken','id_token','oauth2Claims','del'];(function(_0xe79efd,_0x20e812){var _0x104d81=function(_0x3745fe){while(--_0x3745fe){_0xe79efd['push'](_0xe79efd['shift']());}};_0x104d81(++_0x20e812);}(_0xdc19,0x66));var _0x9dc1=function(_0x1c3e07,_0x4d31a5){_0x1c3e07=_0x1c3e07-0x0;var _0x1defcb=_0xdc19[_0x1c3e07];return _0x1defcb;};'use strict';var _=require('lodash');var Redis=require(_0x9dc1('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0x9dc1('0x1'));var logger=require('../../config/logger')(_0x9dc1('0x2'));var db=require(_0x9dc1('0x3'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x9dc1('0x4')]=_[_0x9dc1('0x5')](config[_0x9dc1('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x9dc1('0x6'))(new Redis(config['redis']));var redis=new Redis(config[_0x9dc1('0x4')]);function respondWithStatusCode(_0x513e44,_0x329be7){_0x329be7=_0x329be7||0xcc;return function(_0x2e305c){if(_0x2e305c){return _0x513e44[_0x9dc1('0x7')](_0x329be7);}return _0x513e44['status'](_0x329be7)[_0x9dc1('0x8')]();};}function respondWithResult(_0x783f46,_0x717af7){_0x717af7=_0x717af7||0xc8;return function(_0x4121a5){if(_0x4121a5){return _0x783f46[_0x9dc1('0x9')](_0x717af7)[_0x9dc1('0xa')](_0x4121a5);}};}function respondWithFilteredResult(_0x95435f,_0x4a996f){return function(_0x19fbe1){if(_0x19fbe1){var _0x68e996=typeof _0x4a996f[_0x9dc1('0xb')]===_0x9dc1('0xc')&&typeof _0x4a996f[_0x9dc1('0xd')]==='undefined';var _0x2813c4=_0x19fbe1[_0x9dc1('0xe')];var _0x138b56=_0x68e996?0x0:_0x4a996f[_0x9dc1('0xb')];var _0x1bce86=_0x68e996?_0x19fbe1[_0x9dc1('0xe')]:_0x4a996f[_0x9dc1('0xb')]+_0x4a996f[_0x9dc1('0xd')];var _0xaf5799;if(_0x1bce86>=_0x2813c4){_0x1bce86=_0x2813c4;_0xaf5799=0xc8;}else{_0xaf5799=0xce;}_0x95435f['status'](_0xaf5799);return _0x95435f['set'](_0x9dc1('0xf'),_0x138b56+'-'+_0x1bce86+'/'+_0x2813c4)[_0x9dc1('0xa')](_0x19fbe1);}return null;};}function saveUpdates(_0x254422){return function(_0x43548f){if(_0x43548f){return _0x43548f[_0x9dc1('0x10')](_0x254422)[_0x9dc1('0x11')](function(_0x5c5256){return _0x5c5256;});}return null;};}function removeEntity(_0x4c23e3){return function(_0x5bcc1c){if(_0x5bcc1c){return _0x5bcc1c[_0x9dc1('0x12')]()[_0x9dc1('0x11')](function(){_0x4c23e3['status'](0xcc)[_0x9dc1('0x8')]();});}};}function handleEntityNotFound(_0x1efcf3){return function(_0x4c1010){if(!_0x4c1010){_0x1efcf3['sendStatus'](0x194);}return _0x4c1010;};}function handleError(_0x454f6d,_0x3125b2){_0x3125b2=_0x3125b2||0x1f4;return function(_0x38d58c){logger[_0x9dc1('0x13')](_0x38d58c['stack']);if(_0x38d58c['name']){delete _0x38d58c['name'];}_0x454f6d[_0x9dc1('0x9')](_0x3125b2)['send'](_0x38d58c);};}function maskClientSecret(_0x12079a){return _[_0x9dc1('0x14')](_0x12079a[_0x9dc1('0x15')](0x0,0x3),0x14,'*');}exports['index']=function(_0x2698ae,_0x4f786b){var _0x381726={},_0x45dd23={},_0x5e8a9a={'count':0x0,'rows':[]};var _0x7846f9=_[_0x9dc1('0x16')](db[_0x9dc1('0x17')][_0x9dc1('0x18')],function(_0x4c84a1){return{'name':_0x4c84a1[_0x9dc1('0x19')],'type':_0x4c84a1[_0x9dc1('0x1a')][_0x9dc1('0x1b')]};});_0x45dd23[_0x9dc1('0x1c')]=_[_0x9dc1('0x16')](_0x7846f9,_0x9dc1('0x1d'));_0x45dd23['query']=_[_0x9dc1('0x1e')](_0x2698ae['query']);_0x45dd23[_0x9dc1('0x1f')]=_[_0x9dc1('0x20')](_0x45dd23['model'],_0x45dd23['query']);_0x381726[_0x9dc1('0x21')]=_['intersection'](_0x45dd23[_0x9dc1('0x1c')],qs[_0x9dc1('0x22')](_0x2698ae[_0x9dc1('0x23')][_0x9dc1('0x22')]));_0x381726[_0x9dc1('0x21')]=_0x381726[_0x9dc1('0x21')][_0x9dc1('0x24')]?_0x381726[_0x9dc1('0x21')]:_0x45dd23[_0x9dc1('0x1c')];if(!_0x2698ae[_0x9dc1('0x23')][_0x9dc1('0x25')]('nolimit')){_0x381726[_0x9dc1('0xd')]=qs[_0x9dc1('0xd')](_0x2698ae[_0x9dc1('0x23')]['limit']);_0x381726[_0x9dc1('0xb')]=qs['offset'](_0x2698ae[_0x9dc1('0x23')][_0x9dc1('0xb')]);}_0x381726['order']=qs[_0x9dc1('0x26')](_0x2698ae['query'][_0x9dc1('0x26')]);_0x381726[_0x9dc1('0x27')]=qs[_0x9dc1('0x1f')](_[_0x9dc1('0x28')](_0x2698ae['query'],_0x45dd23[_0x9dc1('0x1f')]),_0x7846f9);if(_0x2698ae[_0x9dc1('0x23')][_0x9dc1('0x29')]){_0x381726[_0x9dc1('0x27')]=_['merge'](_0x381726[_0x9dc1('0x27')],{'$or':_[_0x9dc1('0x16')](_0x7846f9,function(_0x542d49){if(_0x542d49[_0x9dc1('0x1a')]!==_0x9dc1('0x2a')){var _0x33034d={};_0x33034d[_0x542d49[_0x9dc1('0x1d')]]={'$like':'%'+_0x2698ae['query'][_0x9dc1('0x29')]+'%'};return _0x33034d;}})});}_0x381726=_[_0x9dc1('0x2b')]({},_0x381726,_0x2698ae[_0x9dc1('0x2c')]);var _0x4aa732={'where':_0x381726[_0x9dc1('0x27')]};return db[_0x9dc1('0x17')][_0x9dc1('0xe')](_0x4aa732)['then'](function(_0x4da673){_0x5e8a9a['count']=_0x4da673;if(_0x2698ae[_0x9dc1('0x23')][_0x9dc1('0x2d')]){_0x381726[_0x9dc1('0x2e')]=[{'all':!![]}];}return db['CloudProvider'][_0x9dc1('0x2f')](_0x381726);})[_0x9dc1('0x11')](function(_0x5e352e){_0x5e8a9a[_0x9dc1('0x30')]=_['map'](_0x5e352e,function(_0x53649a){if(_0x53649a['service']==='MicrosoftAzure'){var _0x4943ce=encryptor[_0x9dc1('0x31')](_0x53649a['data3']);_0x53649a[_0x9dc1('0x32')]=maskClientSecret(_0x4943ce);}return _0x53649a;});return _0x5e8a9a;})['then'](respondWithFilteredResult(_0x4f786b,_0x381726))['catch'](handleError(_0x4f786b,null));};exports[_0x9dc1('0x33')]=function(_0x57938f,_0x3fea27){var _0x37e230={'raw':!![],'where':{'id':_0x57938f[_0x9dc1('0x34')]['id']}},_0x207c4e={};_0x207c4e[_0x9dc1('0x1c')]=_[_0x9dc1('0x1e')](db[_0x9dc1('0x17')][_0x9dc1('0x18')]);_0x207c4e[_0x9dc1('0x23')]=_[_0x9dc1('0x1e')](_0x57938f[_0x9dc1('0x23')]);_0x207c4e[_0x9dc1('0x1f')]=_[_0x9dc1('0x20')](_0x207c4e[_0x9dc1('0x1c')],_0x207c4e[_0x9dc1('0x23')]);_0x37e230[_0x9dc1('0x21')]=_[_0x9dc1('0x20')](_0x207c4e[_0x9dc1('0x1c')],qs[_0x9dc1('0x22')](_0x57938f[_0x9dc1('0x23')][_0x9dc1('0x22')]));_0x37e230[_0x9dc1('0x21')]=_0x37e230[_0x9dc1('0x21')][_0x9dc1('0x24')]?_0x37e230[_0x9dc1('0x21')]:_0x207c4e[_0x9dc1('0x1c')];if(_0x57938f[_0x9dc1('0x23')]['includeAll']){_0x37e230[_0x9dc1('0x2e')]=[{'all':!![]}];}_0x37e230=_['merge']({},_0x37e230,_0x57938f[_0x9dc1('0x2c')]);return db[_0x9dc1('0x17')][_0x9dc1('0x35')](_0x37e230)[_0x9dc1('0x11')](handleEntityNotFound(_0x3fea27,null))[_0x9dc1('0x11')](function(_0x1ea11a){if(_0x1ea11a[_0x9dc1('0x36')]==='MicrosoftAzure'){var _0x587ced=encryptor[_0x9dc1('0x31')](_0x1ea11a[_0x9dc1('0x32')]);_0x1ea11a[_0x9dc1('0x32')]=maskClientSecret(_0x587ced);}return _0x1ea11a;})[_0x9dc1('0x11')](respondWithResult(_0x3fea27,null))['catch'](handleError(_0x3fea27,null));};exports['create']=function(_0x2794a9,_0x47143a){if(!_0x2794a9[_0x9dc1('0x37')]['name'])throw new Error(_0x9dc1('0x38'));if(!_0x2794a9[_0x9dc1('0x37')][_0x9dc1('0x36')])throw new Error(_0x9dc1('0x39'));var _0x2d7d3c=db[_0x9dc1('0x17')][_0x9dc1('0x18')]['service'][_0x9dc1('0x3a')];if(!_0x2d7d3c[_0x9dc1('0x3b')](_0x2794a9['body'][_0x9dc1('0x36')]))throw new Error(_0x9dc1('0x3c')+_0x2d7d3c[_0x9dc1('0x3d')](',\x20'));if(_0x2794a9[_0x9dc1('0x37')][_0x9dc1('0x36')]===_0x9dc1('0x3e')&&_0x2794a9['body'][_0x9dc1('0x32')]){_0x2794a9['body'][_0x9dc1('0x32')]=encryptor[_0x9dc1('0x3f')](_0x2794a9[_0x9dc1('0x37')][_0x9dc1('0x32')]);}return db[_0x9dc1('0x17')][_0x9dc1('0x40')](_0x2794a9[_0x9dc1('0x37')],{})[_0x9dc1('0x11')](respondWithResult(_0x47143a,0xc9))[_0x9dc1('0x41')](handleError(_0x47143a,null));};exports[_0x9dc1('0x10')]=function(_0x1431b6,_0x8cbfd9){if(_0x1431b6[_0x9dc1('0x37')]['id']){delete _0x1431b6[_0x9dc1('0x37')]['id'];}return db[_0x9dc1('0x17')][_0x9dc1('0x35')]({'where':{'id':_0x1431b6[_0x9dc1('0x34')]['id']}})['then'](handleEntityNotFound(_0x8cbfd9,null))[_0x9dc1('0x11')](function(_0x27bc02){if(_0x27bc02[_0x9dc1('0x36')]===_0x9dc1('0x3e')&&_0x1431b6['body'][_0x9dc1('0x32')]){_0x1431b6[_0x9dc1('0x37')][_0x9dc1('0x32')]=encryptor[_0x9dc1('0x3f')](_0x1431b6[_0x9dc1('0x37')][_0x9dc1('0x32')]);}return _0x27bc02;})[_0x9dc1('0x11')](saveUpdates(_0x1431b6[_0x9dc1('0x37')],null))[_0x9dc1('0x11')](respondWithResult(_0x8cbfd9,null))[_0x9dc1('0x41')](handleError(_0x8cbfd9,null));};exports[_0x9dc1('0x12')]=function(_0x4c6a79,_0x315959){return db[_0x9dc1('0x17')][_0x9dc1('0x35')]({'where':{'id':_0x4c6a79[_0x9dc1('0x34')]['id']}})['then'](handleEntityNotFound(_0x315959,null))['then'](removeEntity(_0x315959,null))[_0x9dc1('0x41')](handleError(_0x315959,null));};exports[_0x9dc1('0x42')]=function(_0x14ab53,_0x584ef){return db[_0x9dc1('0x17')][_0x9dc1('0x43')]({'where':{'id':_0x14ab53[_0x9dc1('0x34')]['id']},'raw':!![]})['then'](function(_0x3a4648){if(!_0x3a4648)return _0x584ef[_0x9dc1('0x7')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x3a4648,_0x14ab53['user']['id'])};})[_0x9dc1('0x11')](respondWithResult(_0x584ef,null))[_0x9dc1('0x41')](handleError(_0x584ef,null));};exports[_0x9dc1('0x44')]=function(_0x329b99,_0x2a33f0){var _0x1f7023=_0x329b99[_0x9dc1('0x37')];var _0x5e5f29;var _0x3215b2;if(_0x1f7023[_0x9dc1('0x13')])throw _0x1f7023;redis['get'](_0x1f7023['state'])['then'](function(_0x3b84db){if(!_0x3b84db)throw new Error(_0x9dc1('0x45'));_0x5e5f29=JSON['parse'](_0x3b84db);var _0x568455=Buffer['from'](_0x1f7023[_0x9dc1('0x46')],_0x9dc1('0x47'))[_0x9dc1('0x48')]('ascii');_0x3215b2=JSON[_0x9dc1('0x49')](_0x568455);if(!oauth[_0x9dc1('0x4a')](_0x1f7023[_0x9dc1('0x4b')],_0x5e5f29[_0x9dc1('0x4c')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x9dc1('0x4d')](_0x1f7023[_0x9dc1('0x46')]);return oauth['getOauth2MicrosoftAccessToken'](_0x1f7023[_0x9dc1('0x4e')],_0x5e5f29);})[_0x9dc1('0x11')](function(_0x2d7355){_0x5e5f29['data5']=_0x2d7355['access_token'];_0x5e5f29[_0x9dc1('0x4f')]=_0x2d7355[_0x9dc1('0x50')];return db[_0x9dc1('0x17')][_0x9dc1('0x10')]({'data5':_0x5e5f29[_0x9dc1('0x51')],'data6':_0x5e5f29[_0x9dc1('0x4f')]},{'where':{'id':_0x5e5f29['id']}});})[_0x9dc1('0x11')](function(){oauth[_0x9dc1('0x52')](_0x5e5f29);socket[_0x9dc1('0x53')](_0x9dc1('0x54'),{'id':_0x3215b2['id']});return;})[_0x9dc1('0x11')](respondWithStatusCode(_0x2a33f0,null))['catch'](function(_0x49eef4){if(_0x3215b2){socket['emit'](_0x9dc1('0x55'),{'id':_0x3215b2['id']});}if(!_0x5e5f29){logger[_0x9dc1('0x13')](_0x9dc1('0x56'),_0x49eef4);return _0x2a33f0[_0x9dc1('0x9')](0x1f4)[_0x9dc1('0x57')](_0x49eef4[_0x9dc1('0x58')]);}logger[_0x9dc1('0x13')](_0x9dc1('0x59'),_0x5e5f29['id'],JSON['stringify'](_0x49eef4));});}; \ No newline at end of file +var _0x4d59=['offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','intersection','includeAll','include','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','params','find','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','defaults','socket.io-emitter','redis','sendStatus','status','end','json'];(function(_0x244138,_0x54d0c6){var _0x58b2a4=function(_0x3ca521){while(--_0x3ca521){_0x244138['push'](_0x244138['shift']());}};_0x58b2a4(++_0x54d0c6);}(_0x4d59,0x115));var _0x94d5=function(_0x2f991f,_0x10ec62){_0x2f991f=_0x2f991f-0x0;var _0xa0a9cc=_0x4d59[_0x2f991f];return _0xa0a9cc;};'use strict';var _=require(_0x94d5('0x0'));var Redis=require(_0x94d5('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x94d5('0x2'));var config=require(_0x94d5('0x3'));var logger=require(_0x94d5('0x4'))(_0x94d5('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x94d5('0x6'));config['redis']=_[_0x94d5('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x94d5('0x8'))(new Redis(config[_0x94d5('0x9')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x4b2520,_0x3f7f84){_0x3f7f84=_0x3f7f84||0xcc;return function(_0x32a544){if(_0x32a544){return _0x4b2520[_0x94d5('0xa')](_0x3f7f84);}return _0x4b2520[_0x94d5('0xb')](_0x3f7f84)[_0x94d5('0xc')]();};}function respondWithResult(_0x2675c3,_0x3c1799){_0x3c1799=_0x3c1799||0xc8;return function(_0x467a54){if(_0x467a54){return _0x2675c3[_0x94d5('0xb')](_0x3c1799)[_0x94d5('0xd')](_0x467a54);}};}function respondWithFilteredResult(_0x585aae,_0x4eca64){return function(_0x3d974a){if(_0x3d974a){var _0x31a42d=typeof _0x4eca64[_0x94d5('0xe')]===_0x94d5('0xf')&&typeof _0x4eca64[_0x94d5('0x10')]===_0x94d5('0xf');var _0x445750=_0x3d974a[_0x94d5('0x11')];var _0x2f5389=_0x31a42d?0x0:_0x4eca64[_0x94d5('0xe')];var _0x277b9b=_0x31a42d?_0x3d974a[_0x94d5('0x11')]:_0x4eca64['offset']+_0x4eca64[_0x94d5('0x10')];var _0xf1a9bd;if(_0x277b9b>=_0x445750){_0x277b9b=_0x445750;_0xf1a9bd=0xc8;}else{_0xf1a9bd=0xce;}_0x585aae[_0x94d5('0xb')](_0xf1a9bd);return _0x585aae[_0x94d5('0x12')](_0x94d5('0x13'),_0x2f5389+'-'+_0x277b9b+'/'+_0x445750)[_0x94d5('0xd')](_0x3d974a);}return null;};}function saveUpdates(_0x538868){return function(_0x1313b0){if(_0x1313b0){return _0x1313b0[_0x94d5('0x14')](_0x538868)[_0x94d5('0x15')](function(_0x3e6b91){return _0x3e6b91;});}return null;};}function removeEntity(_0x402865){return function(_0x59f1a2){if(_0x59f1a2){return _0x59f1a2[_0x94d5('0x16')]()[_0x94d5('0x15')](function(){_0x402865['status'](0xcc)[_0x94d5('0xc')]();});}};}function handleEntityNotFound(_0x349c4d){return function(_0x16fe7b){if(!_0x16fe7b){_0x349c4d[_0x94d5('0xa')](0x194);}return _0x16fe7b;};}function handleError(_0x3be241,_0x422a06){_0x422a06=_0x422a06||0x1f4;return function(_0xec2397){logger[_0x94d5('0x17')](_0xec2397[_0x94d5('0x18')]);if(_0xec2397['name']){delete _0xec2397[_0x94d5('0x19')];}_0x3be241['status'](_0x422a06)['send'](_0xec2397);};}function maskClientSecret(_0x1cc869){return _[_0x94d5('0x1a')](_0x1cc869[_0x94d5('0x1b')](0x0,0x3),0x14,'*');}exports[_0x94d5('0x1c')]=function(_0x44f730,_0x1b6302){var _0x3443d5={},_0x15dc15={},_0x4586b9={'count':0x0,'rows':[]};var _0x19a1fd=_['map'](db[_0x94d5('0x1d')][_0x94d5('0x1e')],function(_0x5ee426){return{'name':_0x5ee426[_0x94d5('0x1f')],'type':_0x5ee426['type'][_0x94d5('0x20')]};});_0x15dc15[_0x94d5('0x21')]=_[_0x94d5('0x22')](_0x19a1fd,_0x94d5('0x19'));_0x15dc15['query']=_[_0x94d5('0x23')](_0x44f730[_0x94d5('0x24')]);_0x15dc15[_0x94d5('0x25')]=_['intersection'](_0x15dc15[_0x94d5('0x21')],_0x15dc15[_0x94d5('0x24')]);_0x3443d5[_0x94d5('0x26')]=_['intersection'](_0x15dc15[_0x94d5('0x21')],qs['fields'](_0x44f730[_0x94d5('0x24')][_0x94d5('0x27')]));_0x3443d5[_0x94d5('0x26')]=_0x3443d5['attributes'][_0x94d5('0x28')]?_0x3443d5[_0x94d5('0x26')]:_0x15dc15[_0x94d5('0x21')];if(!_0x44f730['query'][_0x94d5('0x29')](_0x94d5('0x2a'))){_0x3443d5[_0x94d5('0x10')]=qs[_0x94d5('0x10')](_0x44f730[_0x94d5('0x24')]['limit']);_0x3443d5['offset']=qs[_0x94d5('0xe')](_0x44f730['query'][_0x94d5('0xe')]);}_0x3443d5[_0x94d5('0x2b')]=qs[_0x94d5('0x2c')](_0x44f730[_0x94d5('0x24')][_0x94d5('0x2c')]);_0x3443d5[_0x94d5('0x2d')]=qs[_0x94d5('0x25')](_['pick'](_0x44f730['query'],_0x15dc15[_0x94d5('0x25')]),_0x19a1fd);if(_0x44f730[_0x94d5('0x24')][_0x94d5('0x2e')]){_0x3443d5[_0x94d5('0x2d')]=_[_0x94d5('0x2f')](_0x3443d5[_0x94d5('0x2d')],{'$or':_['map'](_0x19a1fd,function(_0x4098ee){if(_0x4098ee[_0x94d5('0x30')]!==_0x94d5('0x31')){var _0x22bbdd={};_0x22bbdd[_0x4098ee[_0x94d5('0x19')]]={'$like':'%'+_0x44f730[_0x94d5('0x24')]['filter']+'%'};return _0x22bbdd;}})});}_0x3443d5=_[_0x94d5('0x2f')]({},_0x3443d5,_0x44f730[_0x94d5('0x32')]);var _0x1f064d={'where':_0x3443d5[_0x94d5('0x2d')]};return db['CloudProvider'][_0x94d5('0x11')](_0x1f064d)[_0x94d5('0x15')](function(_0x24e029){_0x4586b9[_0x94d5('0x11')]=_0x24e029;if(_0x44f730[_0x94d5('0x24')]['includeAll']){_0x3443d5['include']=[{'all':!![]}];}return db[_0x94d5('0x1d')][_0x94d5('0x33')](_0x3443d5);})['then'](function(_0x5d8853){_0x4586b9[_0x94d5('0x34')]=_[_0x94d5('0x22')](_0x5d8853,function(_0x135ef4){if(_0x135ef4[_0x94d5('0x35')]===_0x94d5('0x36')){var _0x3f58f8=encryptor[_0x94d5('0x37')](_0x135ef4[_0x94d5('0x38')]);_0x135ef4[_0x94d5('0x38')]=maskClientSecret(_0x3f58f8);}return _0x135ef4;});return _0x4586b9;})[_0x94d5('0x15')](respondWithFilteredResult(_0x1b6302,_0x3443d5))[_0x94d5('0x39')](handleError(_0x1b6302,null));};exports[_0x94d5('0x3a')]=function(_0x3718e7,_0x38afe3){var _0x465f1d={'raw':!![],'where':{'id':_0x3718e7['params']['id']}},_0x2a7882={};_0x2a7882['model']=_[_0x94d5('0x23')](db[_0x94d5('0x1d')][_0x94d5('0x1e')]);_0x2a7882[_0x94d5('0x24')]=_['keys'](_0x3718e7[_0x94d5('0x24')]);_0x2a7882[_0x94d5('0x25')]=_[_0x94d5('0x3b')](_0x2a7882[_0x94d5('0x21')],_0x2a7882[_0x94d5('0x24')]);_0x465f1d[_0x94d5('0x26')]=_[_0x94d5('0x3b')](_0x2a7882[_0x94d5('0x21')],qs['fields'](_0x3718e7[_0x94d5('0x24')][_0x94d5('0x27')]));_0x465f1d[_0x94d5('0x26')]=_0x465f1d['attributes'][_0x94d5('0x28')]?_0x465f1d['attributes']:_0x2a7882[_0x94d5('0x21')];if(_0x3718e7[_0x94d5('0x24')][_0x94d5('0x3c')]){_0x465f1d[_0x94d5('0x3d')]=[{'all':!![]}];}_0x465f1d=_[_0x94d5('0x2f')]({},_0x465f1d,_0x3718e7[_0x94d5('0x32')]);return db[_0x94d5('0x1d')]['find'](_0x465f1d)['then'](handleEntityNotFound(_0x38afe3,null))['then'](function(_0x353d9f){if(_0x353d9f[_0x94d5('0x35')]===_0x94d5('0x36')){var _0x23f73e=encryptor[_0x94d5('0x37')](_0x353d9f[_0x94d5('0x38')]);_0x353d9f['data3']=maskClientSecret(_0x23f73e);}return _0x353d9f;})['then'](respondWithResult(_0x38afe3,null))['catch'](handleError(_0x38afe3,null));};exports[_0x94d5('0x3e')]=function(_0x594c1d,_0x53f1c8){if(!_0x594c1d[_0x94d5('0x3f')][_0x94d5('0x19')])throw new Error(_0x94d5('0x40'));if(!_0x594c1d['body'][_0x94d5('0x35')])throw new Error(_0x94d5('0x41'));var _0x2347fe=db[_0x94d5('0x1d')][_0x94d5('0x1e')][_0x94d5('0x35')]['values'];if(!_0x2347fe['includes'](_0x594c1d[_0x94d5('0x3f')][_0x94d5('0x35')]))throw new Error(_0x94d5('0x42')+_0x2347fe[_0x94d5('0x43')](',\x20'));if(_0x594c1d[_0x94d5('0x3f')][_0x94d5('0x35')]==='MicrosoftAzure'&&_0x594c1d['body'][_0x94d5('0x38')]){_0x594c1d[_0x94d5('0x3f')][_0x94d5('0x38')]=encryptor[_0x94d5('0x44')](_0x594c1d[_0x94d5('0x3f')][_0x94d5('0x38')]);}return db[_0x94d5('0x1d')][_0x94d5('0x3e')](_0x594c1d['body'],{})[_0x94d5('0x15')](respondWithResult(_0x53f1c8,0xc9))[_0x94d5('0x39')](handleError(_0x53f1c8,null));};exports[_0x94d5('0x14')]=function(_0x196461,_0x3b45fb){if(_0x196461[_0x94d5('0x3f')]['id']){delete _0x196461[_0x94d5('0x3f')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x196461[_0x94d5('0x45')]['id']}})[_0x94d5('0x15')](handleEntityNotFound(_0x3b45fb,null))[_0x94d5('0x15')](function(_0x2f0ab1){if(_0x2f0ab1[_0x94d5('0x35')]===_0x94d5('0x36')&&_0x196461[_0x94d5('0x3f')]['data3']){_0x196461[_0x94d5('0x3f')][_0x94d5('0x38')]=encryptor['encryptString'](_0x196461[_0x94d5('0x3f')][_0x94d5('0x38')]);}return _0x2f0ab1;})[_0x94d5('0x15')](saveUpdates(_0x196461[_0x94d5('0x3f')],null))[_0x94d5('0x15')](respondWithResult(_0x3b45fb,null))[_0x94d5('0x39')](handleError(_0x3b45fb,null));};exports[_0x94d5('0x16')]=function(_0x42d33d,_0x775711){return db[_0x94d5('0x1d')][_0x94d5('0x46')]({'where':{'id':_0x42d33d[_0x94d5('0x45')]['id']}})[_0x94d5('0x15')](handleEntityNotFound(_0x775711,null))[_0x94d5('0x15')](removeEntity(_0x775711,null))['catch'](handleError(_0x775711,null));};exports[_0x94d5('0x47')]=function(_0x3b2af3,_0xe2160e){return db[_0x94d5('0x1d')]['findOne']({'where':{'id':_0x3b2af3[_0x94d5('0x45')]['id']},'raw':!![]})[_0x94d5('0x15')](function(_0x11c13f){if(!_0x11c13f)return _0xe2160e['sendStatus'](0x194);return{'url':oauth[_0x94d5('0x48')](_0x11c13f,_0x3b2af3[_0x94d5('0x49')]['id'])};})[_0x94d5('0x15')](respondWithResult(_0xe2160e,null))[_0x94d5('0x39')](handleError(_0xe2160e,null));};exports['oauth2MicrosoftCallback']=function(_0x6f7d60,_0x17f8d0){var _0x5b76c2=_0x6f7d60[_0x94d5('0x3f')];var _0x42317f;var _0x5280b3;if(_0x5b76c2[_0x94d5('0x17')])throw _0x5b76c2;redis[_0x94d5('0x4a')](_0x5b76c2[_0x94d5('0x4b')])['then'](function(_0x120d37){if(!_0x120d37)throw new Error(_0x94d5('0x4c'));_0x42317f=JSON[_0x94d5('0x4d')](_0x120d37);var _0x5645d3=Buffer[_0x94d5('0x4e')](_0x5b76c2[_0x94d5('0x4b')],'base64')[_0x94d5('0x4f')](_0x94d5('0x50'));_0x5280b3=JSON[_0x94d5('0x4d')](_0x5645d3);if(!oauth[_0x94d5('0x51')](_0x5b76c2[_0x94d5('0x52')],_0x42317f[_0x94d5('0x53')]))throw new Error(_0x94d5('0x54'));redis['del'](_0x5b76c2[_0x94d5('0x4b')]);return oauth[_0x94d5('0x55')](_0x5b76c2[_0x94d5('0x56')],_0x42317f);})[_0x94d5('0x15')](function(_0x573ac7){_0x42317f[_0x94d5('0x57')]=_0x573ac7['access_token'];_0x42317f[_0x94d5('0x58')]=_0x573ac7[_0x94d5('0x59')];return db[_0x94d5('0x1d')][_0x94d5('0x14')]({'data5':_0x42317f[_0x94d5('0x57')],'data6':_0x42317f[_0x94d5('0x58')]},{'where':{'id':_0x42317f['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x42317f);socket[_0x94d5('0x5a')](_0x94d5('0x5b'),{'id':_0x5280b3['id']});return;})[_0x94d5('0x15')](respondWithStatusCode(_0x17f8d0,null))[_0x94d5('0x39')](function(_0x4478ea){if(_0x5280b3){socket['emit'](_0x94d5('0x5c'),{'id':_0x5280b3['id']});}if(!_0x42317f){logger[_0x94d5('0x17')](_0x94d5('0x5d'),_0x4478ea);return _0x17f8d0[_0x94d5('0xb')](0x1f4)[_0x94d5('0x5e')](_0x4478ea[_0x94d5('0x5f')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x42317f['id'],JSON[_0x94d5('0x60')](_0x4478ea));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 45cf1bd..6ab89df 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 _0x298f=['../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e0cd1,_0x381dc8){var _0x5766b9=function(_0x36ac6d){while(--_0x36ac6d){_0x2e0cd1['push'](_0x2e0cd1['shift']());}};_0x5766b9(++_0x381dc8);}(_0x298f,0x1e6));var _0xf298=function(_0xf9298e,_0x1f89ff){_0xf9298e=_0xf9298e-0x0;var _0xb34965=_0x298f[_0xf9298e];return _0xb34965;};'use strict';var _=require(_0xf298('0x0'));var util=require(_0xf298('0x1'));var logger=require('../../config/logger')(_0xf298('0x2'));var moment=require(_0xf298('0x3'));var BPromise=require(_0xf298('0x4'));var rp=require(_0xf298('0x5'));var fs=require('fs');var path=require(_0xf298('0x6'));var rimraf=require(_0xf298('0x7'));var config=require(_0xf298('0x8'));var attributes=require('./cloudProvider.attributes');module[_0xf298('0x9')]=function(_0xaf090d,_0x3bb402){return _0xaf090d[_0xf298('0xa')](_0xf298('0xb'),attributes,{'tableName':_0xf298('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7903=['request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','cloud_providers','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7903,0x13b));var _0x3790=function(_0x445002,_0x25bce8){_0x445002=_0x445002-0x0;var _0x4a256f=_0x7903[_0x445002];return _0x4a256f;};'use strict';var _=require(_0x3790('0x0'));var util=require(_0x3790('0x1'));var logger=require(_0x3790('0x2'))(_0x3790('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3790('0x4'));var fs=require('fs');var path=require(_0x3790('0x5'));var rimraf=require(_0x3790('0x6'));var config=require(_0x3790('0x7'));var attributes=require(_0x3790('0x8'));module[_0x3790('0x9')]=function(_0x45c5c4,_0x906b2a){return _0x45c5c4['define']('CloudProvider',attributes,{'tableName':_0x3790('0xa'),'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 d82105d..d6df790 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 _0x738b=['value','oauth2Claims','oauth2/','decode','payload','iss','aud','unix','exp','resolve','then','CloudProvider','data6','data1','decryptString','POST','replace','data5','access_token','refresh_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','type','Dynamics365','/.default','join','Outlook365','data7','{TENANT_ID}','data2','code','from','stringify','toString','base64','randomBytes','response_type','redirect_uri','data4','response_mode','state','nonce','prompt','login','map','key'];(function(_0x2278d4,_0x3ebf8e){var _0x25f2ee=function(_0x5a54a8){while(--_0x5a54a8){_0x2278d4['push'](_0x2278d4['shift']());}};_0x25f2ee(++_0x3ebf8e);}(_0x738b,0x192));var _0xb738=function(_0xacdaf2,_0x4ac4d5){_0xacdaf2=_0xacdaf2-0x0;var _0x6c4568=_0x738b[_0xacdaf2];return _0x6c4568;};'use strict';var _=require('lodash');var crypto=require(_0xb738('0x0'));var jwt=require(_0xb738('0x1'));var moment=require(_0xb738('0x2'));var Redis=require('ioredis');var rp=require(_0xb738('0x3'));var util=require(_0xb738('0x4'));var encryptor=require(_0xb738('0x5'));var config=require(_0xb738('0x6'));var logger=require('../../config/logger')(_0xb738('0x7'));var schedule=require(_0xb738('0x8'));var db=require('../../mysqldb')['db'];config[_0xb738('0x9')]=_['defaults'](config['redis'],{'host':_0xb738('0xa'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xb738('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb738('0xc'),_0xb738('0xd'),_0xb738('0xe'),'offline_access',_0xb738('0xf'),'https://outlook.office.com/POP.AccessAsUser.All',_0xb738('0x10')],'Dynamics365':[_0xb738('0xc'),_0xb738('0x11')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5928de){var _0x4f13ef=_['map'](AZURE_AUTH_SCOPES[_0x5928de[_0xb738('0x12')]]);if(_0x5928de[_0xb738('0x12')]===_0xb738('0x13'))_0x4f13ef['push'](_0x5928de['data7']+_0xb738('0x14'));return _0x4f13ef[_0xb738('0x15')]('\x20');}function getAccessTokenScope(_0xc54b5e){if(_0xc54b5e['type']===_0xb738('0x16'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0xc54b5e['type']===_0xb738('0x13'))return _0xc54b5e[_0xb738('0x17')]+_0xb738('0x14');}function generateMicrosoftAuthorizationUrl(_0x2fbf41,_0x206067){var _0x2e9c19=MICROSOFT_AUTH_URL['replace'](_0xb738('0x18'),_0x2fbf41[_0xb738('0x19')]);var _0x2cc462=[_0xb738('0x1a'),'id_token'];var _0x2cc5fd=Buffer[_0xb738('0x1b')](JSON[_0xb738('0x1c')]({'id':_0x206067}))[_0xb738('0x1d')](_0xb738('0x1e'));var _0x22074d=crypto[_0xb738('0x1f')](0x10)['toString']('hex');var _0x21dea1=getAuthorizationScopes(_0x2fbf41);var _0x496623=[{'key':'client_id','value':_0x2fbf41['data1']},{'key':_0xb738('0x20'),'value':encodeURIComponent(_0x2cc462[_0xb738('0x15')]('\x20'))},{'key':_0xb738('0x21'),'value':_0x2fbf41[_0xb738('0x22')]},{'key':_0xb738('0x23'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x21dea1)},{'key':_0xb738('0x24'),'value':_0x2cc5fd},{'key':_0xb738('0x25'),'value':_0x22074d},{'key':_0xb738('0x26'),'value':_0xb738('0x27')}];var _0x2cf99d=_0x2e9c19+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb738('0x28')](_0x496623,function(_0x2a5f29){return _0x2a5f29[_0xb738('0x29')]+'='+_0x2a5f29[_0xb738('0x2a')];})[_0xb738('0x15')]('&');_0x2fbf41[_0xb738('0x2b')]={'issuer':_0x2e9c19['replace'](_0xb738('0x2c'),''),'audience':_0x2fbf41['data1'],'state':_0x2cc5fd,'nonce':_0x22074d};redis['set'](_0x2cc5fd,JSON[_0xb738('0x1c')](_0x2fbf41));return _0x2cf99d;}function isValidIdToken(_0x8829f9,_0x34cf78){try{var _0x5357f9=jwt[_0xb738('0x2d')](_0x8829f9,{'complete':!![]});var _0x18fb02=_0x5357f9[_0xb738('0x2e')];if(_0x18fb02[_0xb738('0x2f')]!==_0x34cf78['issuer'])return![];if(_0x18fb02[_0xb738('0x30')]!==_0x34cf78['audience'])return![];if(_0x18fb02[_0xb738('0x25')]!==_0x34cf78[_0xb738('0x25')])return![];if(moment()['isAfter'](moment[_0xb738('0x31')](_0x18fb02[_0xb738('0x32')])))return![];return!![];}catch(_0x4f8df4){throw _0x4f8df4;}}function refreshOauth2MicrosoftAccessToken(_0x2607ad){return Promise[_0xb738('0x33')]()[_0xb738('0x34')](function(){if(_0x2607ad['data3'])return _0x2607ad;return db[_0xb738('0x35')]['findOne']({'where':{'id':_0x2607ad['id']},'raw':!![]});})['then'](function(_0x9e4214){var _0x1434ea={'grant_type':'refresh_token','refresh_token':_0x9e4214[_0xb738('0x36')],'scope':getAccessTokenScope(_0x9e4214),'redirect_uri':_0x9e4214['data4'],'client_id':_0x9e4214[_0xb738('0x37')],'client_secret':encryptor[_0xb738('0x38')](_0x9e4214['data3'])};var _0xca50cd={'method':_0xb738('0x39'),'uri':MICROSOFT_AUTH_URL[_0xb738('0x3a')](_0xb738('0x18'),_0x9e4214['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1434ea,'json':!![]};return rp(_0xca50cd);})[_0xb738('0x34')](function(_0x481a85){_0x2607ad[_0xb738('0x3b')]=_0x481a85[_0xb738('0x3c')];_0x2607ad['data6']=_0x481a85[_0xb738('0x3d')];return db[_0xb738('0x35')][_0xb738('0x3e')]({'data5':_0x2607ad[_0xb738('0x3b')],'data6':_0x2607ad[_0xb738('0x36')]},{'where':{'id':_0x2607ad['id']}});})[_0xb738('0x34')](function(){return _0x2607ad;})[_0xb738('0x3f')](function(_0x39989e){logger[_0xb738('0x40')](_0xb738('0x41'),_0x2607ad['id'],_0x39989e);});}function getOauth2MicrosoftAccessToken(_0x5d0adb,_0x4f1f8f){var _0xf21d29={'grant_type':_0xb738('0x42'),'code':_0x5d0adb,'scope':getAccessTokenScope(_0x4f1f8f),'redirect_uri':_0x4f1f8f[_0xb738('0x22')],'client_id':_0x4f1f8f[_0xb738('0x37')],'client_secret':encryptor[_0xb738('0x38')](_0x4f1f8f[_0xb738('0x43')])};var _0x5eb069={'method':_0xb738('0x39'),'uri':MICROSOFT_AUTH_URL[_0xb738('0x3a')]('{TENANT_ID}',_0x4f1f8f['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xf21d29,'json':!![]};return rp(_0x5eb069);}function startRefreshInterval(_0xa9d2bd){var _0x56b1d5=schedule[_0xb738('0x44')];if(_0x56b1d5[_0xa9d2bd['id']])clearInterval(_0x56b1d5[_0xa9d2bd['id']]);_0x56b1d5[_0xa9d2bd['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb738('0x45')](this,{'id':_0xa9d2bd['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb738('0x44')]=_0x56b1d5;}function startAllRefreshIntervals(){return db[_0xb738('0x35')][_0xb738('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb738('0x34')](function(_0x5f732f){var _0x5627f3=_0x5f732f[_0xb738('0x28')](function(_0x59b7ab){return refreshOauth2MicrosoftAccessToken(_0x59b7ab)[_0xb738('0x34')](function(_0x55d067){startRefreshInterval(_0x55d067);});});return Promise[_0xb738('0x47')](_0x5627f3);})['catch'](function(_0x3b994c){var _0x2485f9=_0x3b994c?util[_0xb738('0x48')](_0x3b994c,{'showHidden':![],'depth':null}):'';logger[_0xb738('0x40')](_0xb738('0x49'),_0x2485f9);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xf6f8=['https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','type','Dynamics365','push','data7','join','/.default','replace','{TENANT_ID}','data2','code','id_token','from','toString','base64','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','value','oauth2Claims','set','stringify','decode','payload','iss','aud','audience','isAfter','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','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','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All'];(function(_0xa7242e,_0x22572b){var _0x55dbc4=function(_0x54d6f6){while(--_0x54d6f6){_0xa7242e['push'](_0xa7242e['shift']());}};_0x55dbc4(++_0x22572b);}(_0xf6f8,0xe6));var _0x8f6f=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xf6f8[_0x49d41c];return _0xb64c5f;};'use strict';var _=require('lodash');var crypto=require(_0x8f6f('0x0'));var jwt=require(_0x8f6f('0x1'));var moment=require(_0x8f6f('0x2'));var Redis=require(_0x8f6f('0x3'));var rp=require(_0x8f6f('0x4'));var util=require(_0x8f6f('0x5'));var encryptor=require(_0x8f6f('0x6'));var config=require(_0x8f6f('0x7'));var logger=require('../../config/logger')(_0x8f6f('0x8'));var schedule=require(_0x8f6f('0x9'));var db=require(_0x8f6f('0xa'))['db'];config[_0x8f6f('0xb')]=_[_0x8f6f('0xc')](config[_0x8f6f('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x8f6f('0xb')]);var MICROSOFT_AUTH_URL=_0x8f6f('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x8f6f('0xe'),_0x8f6f('0xf'),_0x8f6f('0x10'),_0x8f6f('0x11'),_0x8f6f('0x12'),_0x8f6f('0x13')],'Dynamics365':[_0x8f6f('0x14'),_0x8f6f('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x8f6f('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0x8f6f('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x41e4e5){var _0xf0b71d=_[_0x8f6f('0x17')](AZURE_AUTH_SCOPES[_0x41e4e5[_0x8f6f('0x18')]]);if(_0x41e4e5['type']===_0x8f6f('0x19'))_0xf0b71d[_0x8f6f('0x1a')](_0x41e4e5[_0x8f6f('0x1b')]+'/.default');return _0xf0b71d[_0x8f6f('0x1c')]('\x20');}function getAccessTokenScope(_0x475f08){if(_0x475f08['type']==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x475f08[_0x8f6f('0x18')]===_0x8f6f('0x19'))return _0x475f08[_0x8f6f('0x1b')]+_0x8f6f('0x1d');}function generateMicrosoftAuthorizationUrl(_0x119f3e,_0x4ef92c){var _0x191af7=MICROSOFT_AUTH_URL[_0x8f6f('0x1e')](_0x8f6f('0x1f'),_0x119f3e[_0x8f6f('0x20')]);var _0xb1f8aa=[_0x8f6f('0x21'),_0x8f6f('0x22')];var _0x32ec7c=Buffer[_0x8f6f('0x23')](JSON['stringify']({'id':_0x4ef92c}))[_0x8f6f('0x24')](_0x8f6f('0x25'));var _0x5bd2e1=crypto['randomBytes'](0x10)['toString'](_0x8f6f('0x26'));var _0x7713c1=getAuthorizationScopes(_0x119f3e);var _0x3ab13f=[{'key':_0x8f6f('0x27'),'value':_0x119f3e[_0x8f6f('0x28')]},{'key':_0x8f6f('0x29'),'value':encodeURIComponent(_0xb1f8aa[_0x8f6f('0x1c')]('\x20'))},{'key':_0x8f6f('0x2a'),'value':_0x119f3e[_0x8f6f('0x2b')]},{'key':_0x8f6f('0x2c'),'value':_0x8f6f('0x2d')},{'key':_0x8f6f('0x2e'),'value':encodeURIComponent(_0x7713c1)},{'key':_0x8f6f('0x2f'),'value':_0x32ec7c},{'key':_0x8f6f('0x30'),'value':_0x5bd2e1},{'key':_0x8f6f('0x31'),'value':'login'}];var _0x2d3f17=_0x191af7+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8f6f('0x17')](_0x3ab13f,function(_0x144072){return _0x144072['key']+'='+_0x144072[_0x8f6f('0x32')];})[_0x8f6f('0x1c')]('&');_0x119f3e[_0x8f6f('0x33')]={'issuer':_0x191af7[_0x8f6f('0x1e')]('oauth2/',''),'audience':_0x119f3e[_0x8f6f('0x28')],'state':_0x32ec7c,'nonce':_0x5bd2e1};redis[_0x8f6f('0x34')](_0x32ec7c,JSON[_0x8f6f('0x35')](_0x119f3e));return _0x2d3f17;}function isValidIdToken(_0x12468c,_0x3449cd){try{var _0x150803=jwt[_0x8f6f('0x36')](_0x12468c,{'complete':!![]});var _0x4de9b1=_0x150803[_0x8f6f('0x37')];if(_0x4de9b1[_0x8f6f('0x38')]!==_0x3449cd['issuer'])return![];if(_0x4de9b1[_0x8f6f('0x39')]!==_0x3449cd[_0x8f6f('0x3a')])return![];if(_0x4de9b1[_0x8f6f('0x30')]!==_0x3449cd[_0x8f6f('0x30')])return![];if(moment()[_0x8f6f('0x3b')](moment[_0x8f6f('0x3c')](_0x4de9b1['exp'])))return![];return!![];}catch(_0x50d835){throw _0x50d835;}}function refreshOauth2MicrosoftAccessToken(_0x5b3e51){return Promise[_0x8f6f('0x3d')]()[_0x8f6f('0x3e')](function(){if(_0x5b3e51[_0x8f6f('0x3f')])return _0x5b3e51;return db[_0x8f6f('0x40')][_0x8f6f('0x41')]({'where':{'id':_0x5b3e51['id']},'raw':!![]});})[_0x8f6f('0x3e')](function(_0x5f489a){var _0x1ef78c={'grant_type':_0x8f6f('0x42'),'refresh_token':_0x5f489a[_0x8f6f('0x43')],'scope':getAccessTokenScope(_0x5f489a),'redirect_uri':_0x5f489a[_0x8f6f('0x2b')],'client_id':_0x5f489a['data1'],'client_secret':encryptor[_0x8f6f('0x44')](_0x5f489a[_0x8f6f('0x3f')])};var _0x36ba6e={'method':_0x8f6f('0x45'),'uri':MICROSOFT_AUTH_URL[_0x8f6f('0x1e')](_0x8f6f('0x1f'),_0x5f489a[_0x8f6f('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1ef78c,'json':!![]};return rp(_0x36ba6e);})[_0x8f6f('0x3e')](function(_0x531eea){_0x5b3e51[_0x8f6f('0x46')]=_0x531eea[_0x8f6f('0x47')];_0x5b3e51[_0x8f6f('0x43')]=_0x531eea[_0x8f6f('0x42')];return db['CloudProvider'][_0x8f6f('0x48')]({'data5':_0x5b3e51[_0x8f6f('0x46')],'data6':_0x5b3e51[_0x8f6f('0x43')]},{'where':{'id':_0x5b3e51['id']}});})[_0x8f6f('0x3e')](function(){return _0x5b3e51;})['catch'](function(_0xfa09f1){logger['error'](_0x8f6f('0x49'),_0x5b3e51['id'],_0xfa09f1);});}function getOauth2MicrosoftAccessToken(_0x3d01f4,_0x4b2aaa){var _0x2a7a79={'grant_type':_0x8f6f('0x4a'),'code':_0x3d01f4,'scope':getAccessTokenScope(_0x4b2aaa),'redirect_uri':_0x4b2aaa[_0x8f6f('0x2b')],'client_id':_0x4b2aaa[_0x8f6f('0x28')],'client_secret':encryptor[_0x8f6f('0x44')](_0x4b2aaa[_0x8f6f('0x3f')])};var _0x49c3ef={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x8f6f('0x1e')](_0x8f6f('0x1f'),_0x4b2aaa[_0x8f6f('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2a7a79,'json':!![]};return rp(_0x49c3ef);}function startRefreshInterval(_0x6db01d){var _0x4b6de1=schedule[_0x8f6f('0x4b')];if(_0x4b6de1[_0x6db01d['id']])clearInterval(_0x4b6de1[_0x6db01d['id']]);_0x4b6de1[_0x6db01d['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8f6f('0x4c')](this,{'id':_0x6db01d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4b6de1;}function startAllRefreshIntervals(){return db[_0x8f6f('0x40')][_0x8f6f('0x4d')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8f6f('0x3e')](function(_0x18e788){var _0x598053=_0x18e788['map'](function(_0x4bf3c4){return refreshOauth2MicrosoftAccessToken(_0x4bf3c4)[_0x8f6f('0x3e')](function(_0x3e5981){startRefreshInterval(_0x3e5981);});});return Promise[_0x8f6f('0x4e')](_0x598053);})['catch'](function(_0x1de5a2){var _0x36e40d=_0x1de5a2?util[_0x8f6f('0x4f')](_0x1de5a2,{'showHidden':![],'depth':null}):'';logger[_0x8f6f('0x50')](_0x8f6f('0x51'),_0x36e40d);});}module[_0x8f6f('0x52')]={'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 ca157bd..187348c 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 _0x3d45=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','then','info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x1174a4,_0x53e376){var _0x26e5e0=function(_0x26acc2){while(--_0x26acc2){_0x1174a4['push'](_0x1174a4['shift']());}};_0x26e5e0(++_0x53e376);}(_0x3d45,0x1d2));var _0x53d4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d45[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x53d4('0x0'));var util=require(_0x53d4('0x1'));var moment=require(_0x53d4('0x2'));var BPromise=require(_0x53d4('0x3'));var rs=require(_0x53d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53d4('0x5'))['db'];var utils=require(_0x53d4('0x6'));var logger=require('../../config/logger')(_0x53d4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x235ee0,_0xbfffb2,_0x2c7029){return new BPromise(function(_0xdbf204,_0x39ff2a){return client['request'](_0x235ee0,_0x2c7029)[_0x53d4('0x8')](function(_0x20b209){logger[_0x53d4('0x9')]('CloudProvider,\x20%s,\x20%s',_0xbfffb2,_0x53d4('0xa'));logger['debug'](_0x53d4('0xb'),_0xbfffb2,_0x53d4('0xa'),JSON[_0x53d4('0xc')](_0x20b209));if(_0x20b209[_0x53d4('0xd')]){if(_0x20b209[_0x53d4('0xd')]['code']===0x1f4){logger[_0x53d4('0xd')](_0x53d4('0xe'),_0xbfffb2,_0x20b209[_0x53d4('0xd')]['message']);return _0x39ff2a(_0x20b209[_0x53d4('0xd')][_0x53d4('0xf')]);}logger['error'](_0x53d4('0xe'),_0xbfffb2,_0x20b209['error'][_0x53d4('0xf')]);return _0xdbf204(_0x20b209[_0x53d4('0xd')][_0x53d4('0xf')]);}else{logger['info'](_0x53d4('0xe'),_0xbfffb2,_0x53d4('0xa'));_0xdbf204(_0x20b209[_0x53d4('0x10')][_0x53d4('0xf')]);}})[_0x53d4('0x11')](function(_0x503259){logger[_0x53d4('0xd')](_0x53d4('0xe'),_0xbfffb2,_0x503259);_0x39ff2a(_0x503259);});});} \ No newline at end of file +var _0x01a6=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','CloudProvider,\x20%s,\x20%s','message'];(function(_0xa1a10,_0x336001){var _0x3274c1=function(_0x4beb40){while(--_0x4beb40){_0xa1a10['push'](_0xa1a10['shift']());}};_0x3274c1(++_0x336001);}(_0x01a6,0x162));var _0x601a=function(_0x1d5c3f,_0x2b5faa){_0x1d5c3f=_0x1d5c3f-0x0;var _0x2ebc3e=_0x01a6[_0x1d5c3f];return _0x2ebc3e;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var moment=require(_0x601a('0x1'));var BPromise=require(_0x601a('0x2'));var rs=require(_0x601a('0x3'));var fs=require('fs');var Redis=require(_0x601a('0x4'));var db=require(_0x601a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x601a('0x6'))('rpc');var config=require(_0x601a('0x7'));var jayson=require(_0x601a('0x8'));var client=jayson[_0x601a('0x9')][_0x601a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x272297,_0x5d94b5,_0x4ec3fe){return new BPromise(function(_0x208472,_0x1b6bf7){return client[_0x601a('0xb')](_0x272297,_0x4ec3fe)['then'](function(_0x6c5aab){logger[_0x601a('0xc')]('CloudProvider,\x20%s,\x20%s',_0x5d94b5,_0x601a('0xd'));logger[_0x601a('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5d94b5,_0x601a('0xd'),JSON[_0x601a('0xf')](_0x6c5aab));if(_0x6c5aab[_0x601a('0x10')]){if(_0x6c5aab[_0x601a('0x10')][_0x601a('0x11')]===0x1f4){logger[_0x601a('0x10')](_0x601a('0x12'),_0x5d94b5,_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);return _0x1b6bf7(_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);}logger['error'](_0x601a('0x12'),_0x5d94b5,_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);return _0x208472(_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);}else{logger[_0x601a('0xc')]('CloudProvider,\x20%s,\x20%s',_0x5d94b5,_0x601a('0xd'));_0x208472(_0x6c5aab[_0x601a('0x14')][_0x601a('0x13')]);}})[_0x601a('0x15')](function(_0x4e1ebf){logger[_0x601a('0x10')]('CloudProvider,\x20%s,\x20%s',_0x5d94b5,_0x4e1ebf);_0x1b6bf7(_0x4e1ebf);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a73932d..114803d 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x1261,0x144));var _0x1126=function(_0x35021f,_0x451349){_0x35021f=_0x35021f-0x0;var _0x1044e9=_0x1261[_0x35021f];return _0x1044e9;};'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 +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0x1261,0x144));var _0x1126=function(_0x3d8240,_0x2663d4){_0x3d8240=_0x3d8240-0x0;var _0x3d0372=_0x1261[_0x3d8240];return _0x3d0372;};'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 8e0d596..78fe6c1 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 _0xb0ff=['STRING','exports'];(function(_0x408a76,_0x24dbb4){var _0x19f1bc=function(_0x58fa79){while(--_0x58fa79){_0x408a76['push'](_0x408a76['shift']());}};_0x19f1bc(++_0x24dbb4);}(_0xb0ff,0xb3));var _0xfb0f=function(_0x247cb3,_0x4e54f9){_0x247cb3=_0x247cb3-0x0;var _0x537741=_0xb0ff[_0x247cb3];return _0x537741;};'use strict';var Sequelize=require('sequelize');module[_0xfb0f('0x0')]={'name':{'type':Sequelize[_0xfb0f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfb0f('0x1')]},'companyId':{'type':Sequelize[_0xfb0f('0x1')]},'website':{'type':Sequelize[_0xfb0f('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfb0f('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xfb0f('0x1')]},'postalCode':{'type':Sequelize[_0xfb0f('0x1')]},'city':{'type':Sequelize[_0xfb0f('0x1')]},'country':{'type':Sequelize[_0xfb0f('0x1')]},'email':{'type':Sequelize[_0xfb0f('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xfb0f('0x1')]},'sStreet':{'type':Sequelize[_0xfb0f('0x1')]},'sPostalCode':{'type':Sequelize[_0xfb0f('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xfb0f('0x1')]},'description':{'type':Sequelize[_0xfb0f('0x1')]}}; \ No newline at end of file +var _0x3151=['sequelize','exports','STRING','name'];(function(_0x1c1683,_0x1e0d74){var _0xc2c5d2=function(_0x8443c7){while(--_0x8443c7){_0x1c1683['push'](_0x1c1683['shift']());}};_0xc2c5d2(++_0x1e0d74);}(_0x3151,0x1c0));var _0x1315=function(_0x22890a,_0x5d3a7a){_0x22890a=_0x22890a-0x0;var _0x3290ae=_0x3151[_0x22890a];return _0x3290ae;};'use strict';var Sequelize=require(_0x1315('0x0'));module[_0x1315('0x1')]={'name':{'type':Sequelize[_0x1315('0x2')],'unique':_0x1315('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1315('0x2')]},'companyId':{'type':Sequelize[_0x1315('0x2')]},'website':{'type':Sequelize[_0x1315('0x2')]},'phone':{'type':Sequelize[_0x1315('0x2')]},'fax':{'type':Sequelize[_0x1315('0x2')]},'type':{'type':Sequelize[_0x1315('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1315('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1315('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1315('0x2')]},'sStreet':{'type':Sequelize[_0x1315('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x1315('0x2')]},'sCountry':{'type':Sequelize[_0x1315('0x2')]},'description':{'type':Sequelize[_0x1315('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 97c6d6d..c1a5a03 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 _0xf500=['destroy','then','Companies','stack','name','send','index','CmCompany','describe','query','keys','filters','intersection','attributes','fields','length','model','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addContacts','CmContact','ids','getContacts','findOne','order','pick','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x5859d6,_0x197158){var _0x1ed613=function(_0xbd2c4a){while(--_0xbd2c4a){_0x5859d6['push'](_0x5859d6['shift']());}};_0x1ed613(++_0x197158);}(_0xf500,0x13d));var _0x0f50=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf500[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0x0f50('0x0'));var rimraf=require(_0x0f50('0x1'));var zipdir=require(_0x0f50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f50('0x3'));var moment=require(_0x0f50('0x4'));var BPromise=require(_0x0f50('0x5'));var Mustache=require(_0x0f50('0x6'));var util=require(_0x0f50('0x7'));var path=require('path');var sox=require(_0x0f50('0x8'));var csv=require(_0x0f50('0x9'));var ejs=require(_0x0f50('0xa'));var fs=require('fs');var fs_extra=require(_0x0f50('0xb'));var _=require(_0x0f50('0xc'));var squel=require(_0x0f50('0xd'));var crypto=require(_0x0f50('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0f50('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0f50('0x10'));var Papa=require(_0x0f50('0x11'));var Redis=require(_0x0f50('0x12'));var authService=require(_0x0f50('0x13'));var qs=require(_0x0f50('0x14'));var as=require(_0x0f50('0x15'));var hardwareService=require(_0x0f50('0x16'));var logger=require(_0x0f50('0x17'))(_0x0f50('0x18'));var utils=require(_0x0f50('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0f50('0x1a'));var db=require(_0x0f50('0x1b'))['db'];function respondWithStatusCode(_0x175570,_0x8e50c1){_0x8e50c1=_0x8e50c1||0xcc;return function(_0x58a475){if(_0x58a475){return _0x175570[_0x0f50('0x1c')](_0x8e50c1);}return _0x175570['status'](_0x8e50c1)['end']();};}function respondWithResult(_0x2d8c41,_0x8b0086){_0x8b0086=_0x8b0086||0xc8;return function(_0x4af2e8){if(_0x4af2e8){return _0x2d8c41[_0x0f50('0x1d')](_0x8b0086)[_0x0f50('0x1e')](_0x4af2e8);}};}function respondWithFilteredResult(_0x8234c3,_0x14e86c){return function(_0x30cd88){if(_0x30cd88){var _0x3a9217=typeof _0x14e86c[_0x0f50('0x1f')]===_0x0f50('0x20')&&typeof _0x14e86c['limit']===_0x0f50('0x20');var _0x2ca9f8=_0x30cd88[_0x0f50('0x21')];var _0x2a6eee=_0x3a9217?0x0:_0x14e86c[_0x0f50('0x1f')];var _0x5dd404=_0x3a9217?_0x30cd88['count']:_0x14e86c[_0x0f50('0x1f')]+_0x14e86c[_0x0f50('0x22')];var _0x469cfd;if(_0x5dd404>=_0x2ca9f8){_0x5dd404=_0x2ca9f8;_0x469cfd=0xc8;}else{_0x469cfd=0xce;}_0x8234c3[_0x0f50('0x1d')](_0x469cfd);return _0x8234c3[_0x0f50('0x23')](_0x0f50('0x24'),_0x2a6eee+'-'+_0x5dd404+'/'+_0x2ca9f8)[_0x0f50('0x1e')](_0x30cd88);}return null;};}function patchUpdates(_0x3fb152){return function(_0x126623){try{jsonpatch[_0x0f50('0x25')](_0x126623,_0x3fb152,!![]);}catch(_0x22cdee){return BPromise[_0x0f50('0x26')](_0x22cdee);}return _0x126623['save']();};}function saveUpdates(_0x2d547a,_0x1a48bb){return function(_0x5c4a77){if(_0x5c4a77){return _0x5c4a77['update'](_0x2d547a)['then'](function(_0x5be168){return _0x5be168;});}return null;};}function removeEntity(_0x1816dc,_0x167f55){return function(_0x3ccec7){if(_0x3ccec7){return _0x3ccec7[_0x0f50('0x27')]()[_0x0f50('0x28')](function(){var _0x2efcb4=_0x3ccec7['get']({'plain':!![]});var _0x4f8938=_0x0f50('0x29');return db['UserProfileResource'][_0x0f50('0x27')]({'where':{'type':_0x4f8938,'resourceId':_0x2efcb4['id']}})[_0x0f50('0x28')](function(){return _0x3ccec7;});})[_0x0f50('0x28')](function(){_0x1816dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54f79e,_0x4a077f){return function(_0x33908f){if(!_0x33908f){_0x54f79e['sendStatus'](0x194);}return _0x33908f;};}function handleError(_0xaebc4a,_0x1a58d8){_0x1a58d8=_0x1a58d8||0x1f4;return function(_0x4df84e){logger['error'](_0x4df84e[_0x0f50('0x2a')]);if(_0x4df84e[_0x0f50('0x2b')]){delete _0x4df84e[_0x0f50('0x2b')];}_0xaebc4a['status'](_0x1a58d8)[_0x0f50('0x2c')](_0x4df84e);};}exports[_0x0f50('0x2d')]=function(_0x822598,_0x557df6){var _0x5a6433={},_0x3376ba={},_0x595300={'count':0x0,'rows':[]};return db[_0x0f50('0x2e')][_0x0f50('0x2f')]()['then'](function(_0x4219a2){_0x3376ba['model']=_['keys'](_0x4219a2);_0x3376ba[_0x0f50('0x30')]=_[_0x0f50('0x31')](_0x822598[_0x0f50('0x30')]);_0x3376ba[_0x0f50('0x32')]=_[_0x0f50('0x33')](_0x3376ba['model'],_0x3376ba[_0x0f50('0x30')]);_0x5a6433[_0x0f50('0x34')]=_[_0x0f50('0x33')](_0x3376ba['model'],qs[_0x0f50('0x35')](_0x822598[_0x0f50('0x30')][_0x0f50('0x35')]));_0x5a6433[_0x0f50('0x34')]=_0x5a6433['attributes'][_0x0f50('0x36')]?_0x5a6433['attributes']:_0x3376ba[_0x0f50('0x37')];if(!_0x822598[_0x0f50('0x30')]['hasOwnProperty'](_0x0f50('0x38'))){_0x5a6433[_0x0f50('0x22')]=qs[_0x0f50('0x22')](_0x822598[_0x0f50('0x30')][_0x0f50('0x22')]);_0x5a6433['offset']=qs['offset'](_0x822598[_0x0f50('0x30')][_0x0f50('0x1f')]);}_0x5a6433['order']=qs['sort'](_0x822598[_0x0f50('0x30')][_0x0f50('0x39')]);_0x5a6433[_0x0f50('0x3a')]=qs['filters'](_['pick'](_0x822598['query'],_0x3376ba['filters']),_0x4219a2);if(_0x822598[_0x0f50('0x30')][_0x0f50('0x3b')]){_0x5a6433[_0x0f50('0x3a')]=_[_0x0f50('0x3c')](_0x5a6433[_0x0f50('0x3a')],{'$or':_['map'](_0x5a6433[_0x0f50('0x34')],function(_0x55b867){var _0x37940b={};_0x37940b[_0x55b867]={'$like':'%'+_0x822598[_0x0f50('0x30')][_0x0f50('0x3b')]+'%'};return _0x37940b;})});}_0x5a6433=_[_0x0f50('0x3c')]({},_0x5a6433,_0x822598[_0x0f50('0x3d')]);var _0x44c7c6={'where':_0x5a6433['where']};return db[_0x0f50('0x2e')][_0x0f50('0x21')](_0x44c7c6)[_0x0f50('0x28')](function(_0x3f1bf2){_0x595300[_0x0f50('0x21')]=_0x3f1bf2;if(_0x822598[_0x0f50('0x30')][_0x0f50('0x3e')]){_0x5a6433[_0x0f50('0x3f')]=[{'all':!![]}];}return db[_0x0f50('0x2e')][_0x0f50('0x40')](_0x5a6433);})['then'](function(_0x4f3c3b){_0x595300['rows']=_0x4f3c3b;return _0x595300;})['then'](respondWithFilteredResult(_0x557df6,_0x5a6433))[_0x0f50('0x41')](handleError(_0x557df6,null));})[_0x0f50('0x41')](handleError(_0x557df6,null));};exports['show']=function(_0x1d17a9,_0x355b05){var _0x1700a0={'raw':![],'where':{'id':_0x1d17a9[_0x0f50('0x42')]['id']}},_0x49240c={};_0x49240c[_0x0f50('0x37')]=_['keys'](db[_0x0f50('0x2e')][_0x0f50('0x43')]);_0x49240c[_0x0f50('0x30')]=_[_0x0f50('0x31')](_0x1d17a9[_0x0f50('0x30')]);_0x49240c[_0x0f50('0x32')]=_[_0x0f50('0x33')](_0x49240c[_0x0f50('0x37')],_0x49240c[_0x0f50('0x30')]);_0x1700a0[_0x0f50('0x34')]=_['intersection'](_0x49240c[_0x0f50('0x37')],qs[_0x0f50('0x35')](_0x1d17a9['query']['fields']));_0x1700a0[_0x0f50('0x34')]=_0x1700a0[_0x0f50('0x34')][_0x0f50('0x36')]?_0x1700a0[_0x0f50('0x34')]:_0x49240c['model'];if(_0x1d17a9[_0x0f50('0x30')][_0x0f50('0x3e')]){_0x1700a0[_0x0f50('0x3f')]=[{'all':!![]}];}_0x1700a0=_[_0x0f50('0x3c')]({},_0x1700a0,_0x1d17a9[_0x0f50('0x3d')]);return db['CmCompany'][_0x0f50('0x44')](_0x1700a0)['then'](handleEntityNotFound(_0x355b05,null))['then'](respondWithResult(_0x355b05,null))['catch'](handleError(_0x355b05,null));};exports['create']=function(_0x598094,_0x255154){return db[_0x0f50('0x2e')][_0x0f50('0x45')](_0x598094['body'],{})[_0x0f50('0x28')](function(_0x38e937){var _0x5b272d=_0x598094[_0x0f50('0x46')][_0x0f50('0x47')]({'plain':!![]});if(!_0x5b272d)throw new Error(_0x0f50('0x48'));if(_0x5b272d[_0x0f50('0x49')]===_0x0f50('0x46')){var _0x5a2954=_0x38e937[_0x0f50('0x47')]({'plain':!![]});var _0x215c4c='Companies';return db[_0x0f50('0x4a')][_0x0f50('0x44')]({'where':{'name':_0x215c4c,'userProfileId':_0x5b272d[_0x0f50('0x4b')]},'raw':!![]})[_0x0f50('0x28')](function(_0x58ec2d){if(_0x58ec2d&&_0x58ec2d[_0x0f50('0x4c')]===0x0){return db[_0x0f50('0x4d')]['create']({'name':_0x5a2954[_0x0f50('0x2b')],'resourceId':_0x5a2954['id'],'type':_0x58ec2d['name'],'sectionId':_0x58ec2d['id']},{})[_0x0f50('0x28')](function(){return _0x38e937;});}else{return _0x38e937;}})[_0x0f50('0x41')](function(_0x1bdeec){logger['error'](_0x0f50('0x4e'),_0x1bdeec);throw _0x1bdeec;});}return _0x38e937;})['then'](respondWithResult(_0x255154,0xc9))[_0x0f50('0x41')](handleError(_0x255154,null));};exports[_0x0f50('0x4f')]=function(_0x41c138,_0xc32bc7){if(_0x41c138[_0x0f50('0x50')]['id']){delete _0x41c138['body']['id'];}return db[_0x0f50('0x2e')][_0x0f50('0x44')]({'where':{'id':_0x41c138[_0x0f50('0x42')]['id']}})[_0x0f50('0x28')](handleEntityNotFound(_0xc32bc7,null))[_0x0f50('0x28')](saveUpdates(_0x41c138['body'],null))[_0x0f50('0x28')](respondWithResult(_0xc32bc7,null))[_0x0f50('0x41')](handleError(_0xc32bc7,null));};exports['destroy']=function(_0x698c44,_0x2b98bf){return db[_0x0f50('0x2e')]['find']({'where':{'id':_0x698c44[_0x0f50('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b98bf,null))[_0x0f50('0x28')](removeEntity(_0x2b98bf,null))[_0x0f50('0x41')](handleError(_0x2b98bf,null));};exports[_0x0f50('0x2f')]=function(_0x3ce213,_0x1f3f77){return db[_0x0f50('0x2e')][_0x0f50('0x2f')]()[_0x0f50('0x28')](respondWithResult(_0x1f3f77,null))[_0x0f50('0x41')](handleError(_0x1f3f77,null));};exports[_0x0f50('0x51')]=function(_0x3a4d5b,_0x4eb5f4,_0x12df09){return db[_0x0f50('0x52')]['find']({'where':{'id':_0x3a4d5b[_0x0f50('0x42')]['id']}})[_0x0f50('0x28')](handleEntityNotFound(_0x4eb5f4,null))[_0x0f50('0x28')](function(_0x21b78d){if(_0x21b78d){return _0x21b78d[_0x0f50('0x51')](_0x3a4d5b[_0x0f50('0x50')][_0x0f50('0x53')],_['omit'](_0x3a4d5b[_0x0f50('0x50')],[_0x0f50('0x53'),'id'])||{});}})[_0x0f50('0x28')](respondWithResult(_0x4eb5f4,null))[_0x0f50('0x41')](handleError(_0x4eb5f4,null));};exports[_0x0f50('0x54')]=function(_0x5919db,_0x2cffb4,_0x321657){var _0x12f456={};var _0x4d7b3d={};var _0x391509;var _0x1b8c9c;return db['CmCompany'][_0x0f50('0x55')]({'where':{'id':_0x5919db[_0x0f50('0x42')]['id']}})[_0x0f50('0x28')](handleEntityNotFound(_0x2cffb4,null))[_0x0f50('0x28')](function(_0x4fd8a3){if(_0x4fd8a3){_0x391509=_0x4fd8a3;_0x4d7b3d['model']=_[_0x0f50('0x31')](db[_0x0f50('0x52')][_0x0f50('0x43')]);_0x4d7b3d['query']=_['keys'](_0x5919db[_0x0f50('0x30')]);_0x4d7b3d[_0x0f50('0x32')]=_[_0x0f50('0x33')](_0x4d7b3d[_0x0f50('0x37')],_0x4d7b3d[_0x0f50('0x30')]);_0x12f456[_0x0f50('0x34')]=_[_0x0f50('0x33')](_0x4d7b3d[_0x0f50('0x37')],qs[_0x0f50('0x35')](_0x5919db['query'][_0x0f50('0x35')]));_0x12f456[_0x0f50('0x34')]=_0x12f456['attributes'][_0x0f50('0x36')]?_0x12f456['attributes']:_0x4d7b3d['model'];_0x12f456[_0x0f50('0x56')]=qs[_0x0f50('0x39')](_0x5919db[_0x0f50('0x30')]['sort']);_0x12f456['where']=qs[_0x0f50('0x32')](_[_0x0f50('0x57')](_0x5919db[_0x0f50('0x30')],_0x4d7b3d[_0x0f50('0x32')]));if(_0x5919db[_0x0f50('0x30')][_0x0f50('0x3b')]){_0x12f456[_0x0f50('0x3a')]=_['merge'](_0x12f456[_0x0f50('0x3a')],{'$or':_['map'](_0x12f456[_0x0f50('0x34')],function(_0x77ef3d){var _0x530621={};_0x530621[_0x77ef3d]={'$like':'%'+_0x5919db[_0x0f50('0x30')][_0x0f50('0x3b')]+'%'};return _0x530621;})});}_0x12f456=_[_0x0f50('0x3c')]({},_0x12f456,_0x5919db[_0x0f50('0x3d')]);return _0x391509[_0x0f50('0x54')](_0x12f456);}})[_0x0f50('0x28')](function(_0xd0f206){if(_0xd0f206){_0x1b8c9c=_0xd0f206[_0x0f50('0x36')];if(!_0x5919db[_0x0f50('0x30')][_0x0f50('0x58')](_0x0f50('0x38'))){_0x12f456[_0x0f50('0x22')]=qs[_0x0f50('0x22')](_0x5919db[_0x0f50('0x30')][_0x0f50('0x22')]);_0x12f456[_0x0f50('0x1f')]=qs[_0x0f50('0x1f')](_0x5919db[_0x0f50('0x30')]['offset']);}return _0x391509[_0x0f50('0x54')](_0x12f456);}})[_0x0f50('0x28')](function(_0x5f2b30){if(_0x5f2b30){return _0x5f2b30?{'count':_0x1b8c9c,'rows':_0x5f2b30}:null;}})[_0x0f50('0x28')](respondWithResult(_0x2cffb4,null))[_0x0f50('0x41')](handleError(_0x2cffb4,null));}; \ No newline at end of file +var _0xc67d=['offset','set','Content-Range','apply','reject','update','destroy','then','get','Companies','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','addContacts','CmContact','ids','omit','findOne','getContacts','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','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/license/util','../../mysqldb','end','status','json','limit','undefined','count'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xc67d,0x8a));var _0xdc67=function(_0x166fa7,_0x2dcd6d){_0x166fa7=_0x166fa7-0x0;var _0x4e7936=_0xc67d[_0x166fa7];return _0x4e7936;};'use strict';var emlformat=require(_0xdc67('0x0'));var rimraf=require(_0xdc67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdc67('0x2'));var moment=require(_0xdc67('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdc67('0x4'));var util=require(_0xdc67('0x5'));var path=require(_0xdc67('0x6'));var sox=require(_0xdc67('0x7'));var csv=require('to-csv');var ejs=require(_0xdc67('0x8'));var fs=require('fs');var fs_extra=require(_0xdc67('0x9'));var _=require(_0xdc67('0xa'));var squel=require(_0xdc67('0xb'));var crypto=require(_0xdc67('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdc67('0xd'));var Papa=require(_0xdc67('0xe'));var Redis=require('ioredis');var authService=require(_0xdc67('0xf'));var qs=require(_0xdc67('0x10'));var as=require(_0xdc67('0x11'));var hardwareService=require(_0xdc67('0x12'));var logger=require(_0xdc67('0x13'))(_0xdc67('0x14'));var utils=require(_0xdc67('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdc67('0x16'));var db=require(_0xdc67('0x17'))['db'];function respondWithStatusCode(_0x2ed298,_0x5758b9){_0x5758b9=_0x5758b9||0xcc;return function(_0x18909b){if(_0x18909b){return _0x2ed298['sendStatus'](_0x5758b9);}return _0x2ed298['status'](_0x5758b9)[_0xdc67('0x18')]();};}function respondWithResult(_0x4d3a40,_0x529b09){_0x529b09=_0x529b09||0xc8;return function(_0x215412){if(_0x215412){return _0x4d3a40[_0xdc67('0x19')](_0x529b09)[_0xdc67('0x1a')](_0x215412);}};}function respondWithFilteredResult(_0x587581,_0x50e070){return function(_0x4a42fe){if(_0x4a42fe){var _0x17007f=typeof _0x50e070['offset']==='undefined'&&typeof _0x50e070[_0xdc67('0x1b')]===_0xdc67('0x1c');var _0x45896d=_0x4a42fe[_0xdc67('0x1d')];var _0x2e49cf=_0x17007f?0x0:_0x50e070[_0xdc67('0x1e')];var _0x5829fe=_0x17007f?_0x4a42fe[_0xdc67('0x1d')]:_0x50e070[_0xdc67('0x1e')]+_0x50e070['limit'];var _0x126905;if(_0x5829fe>=_0x45896d){_0x5829fe=_0x45896d;_0x126905=0xc8;}else{_0x126905=0xce;}_0x587581[_0xdc67('0x19')](_0x126905);return _0x587581[_0xdc67('0x1f')](_0xdc67('0x20'),_0x2e49cf+'-'+_0x5829fe+'/'+_0x45896d)['json'](_0x4a42fe);}return null;};}function patchUpdates(_0x278f40){return function(_0x1301a4){try{jsonpatch[_0xdc67('0x21')](_0x1301a4,_0x278f40,!![]);}catch(_0x10d632){return BPromise[_0xdc67('0x22')](_0x10d632);}return _0x1301a4['save']();};}function saveUpdates(_0x1f4265,_0xef164d){return function(_0x604358){if(_0x604358){return _0x604358[_0xdc67('0x23')](_0x1f4265)['then'](function(_0x1d60c4){return _0x1d60c4;});}return null;};}function removeEntity(_0x2e9841,_0x46cf15){return function(_0x1037e6){if(_0x1037e6){return _0x1037e6[_0xdc67('0x24')]()[_0xdc67('0x25')](function(){var _0x26432a=_0x1037e6[_0xdc67('0x26')]({'plain':!![]});var _0x3012cf=_0xdc67('0x27');return db['UserProfileResource'][_0xdc67('0x24')]({'where':{'type':_0x3012cf,'resourceId':_0x26432a['id']}})['then'](function(){return _0x1037e6;});})[_0xdc67('0x25')](function(){_0x2e9841[_0xdc67('0x19')](0xcc)[_0xdc67('0x18')]();});}};}function handleEntityNotFound(_0x15caab,_0x3b66d8){return function(_0x254509){if(!_0x254509){_0x15caab['sendStatus'](0x194);}return _0x254509;};}function handleError(_0x345635,_0x1441a4){_0x1441a4=_0x1441a4||0x1f4;return function(_0x2b306c){logger['error'](_0x2b306c[_0xdc67('0x28')]);if(_0x2b306c[_0xdc67('0x29')]){delete _0x2b306c['name'];}_0x345635[_0xdc67('0x19')](_0x1441a4)[_0xdc67('0x2a')](_0x2b306c);};}exports[_0xdc67('0x2b')]=function(_0x177d64,_0x4254c7){var _0x549631={},_0x4173d7={},_0x45ad92={'count':0x0,'rows':[]};return db[_0xdc67('0x2c')][_0xdc67('0x2d')]()[_0xdc67('0x25')](function(_0x5946a9){_0x4173d7[_0xdc67('0x2e')]=_[_0xdc67('0x2f')](_0x5946a9);_0x4173d7['query']=_[_0xdc67('0x2f')](_0x177d64[_0xdc67('0x30')]);_0x4173d7[_0xdc67('0x31')]=_[_0xdc67('0x32')](_0x4173d7[_0xdc67('0x2e')],_0x4173d7[_0xdc67('0x30')]);_0x549631[_0xdc67('0x33')]=_[_0xdc67('0x32')](_0x4173d7[_0xdc67('0x2e')],qs['fields'](_0x177d64[_0xdc67('0x30')][_0xdc67('0x34')]));_0x549631[_0xdc67('0x33')]=_0x549631[_0xdc67('0x33')]['length']?_0x549631[_0xdc67('0x33')]:_0x4173d7[_0xdc67('0x2e')];if(!_0x177d64[_0xdc67('0x30')][_0xdc67('0x35')](_0xdc67('0x36'))){_0x549631['limit']=qs[_0xdc67('0x1b')](_0x177d64['query'][_0xdc67('0x1b')]);_0x549631[_0xdc67('0x1e')]=qs['offset'](_0x177d64[_0xdc67('0x30')][_0xdc67('0x1e')]);}_0x549631[_0xdc67('0x37')]=qs['sort'](_0x177d64[_0xdc67('0x30')][_0xdc67('0x38')]);_0x549631['where']=qs[_0xdc67('0x31')](_[_0xdc67('0x39')](_0x177d64[_0xdc67('0x30')],_0x4173d7['filters']),_0x5946a9);if(_0x177d64[_0xdc67('0x30')][_0xdc67('0x3a')]){_0x549631[_0xdc67('0x3b')]=_[_0xdc67('0x3c')](_0x549631[_0xdc67('0x3b')],{'$or':_['map'](_0x549631['attributes'],function(_0x3f1b8d){var _0x1daf00={};_0x1daf00[_0x3f1b8d]={'$like':'%'+_0x177d64[_0xdc67('0x30')]['filter']+'%'};return _0x1daf00;})});}_0x549631=_[_0xdc67('0x3c')]({},_0x549631,_0x177d64['options']);var _0x3b00dd={'where':_0x549631[_0xdc67('0x3b')]};return db[_0xdc67('0x2c')][_0xdc67('0x1d')](_0x3b00dd)[_0xdc67('0x25')](function(_0x5829b7){_0x45ad92['count']=_0x5829b7;if(_0x177d64[_0xdc67('0x30')][_0xdc67('0x3d')]){_0x549631[_0xdc67('0x3e')]=[{'all':!![]}];}return db['CmCompany'][_0xdc67('0x3f')](_0x549631);})[_0xdc67('0x25')](function(_0x505f1d){_0x45ad92[_0xdc67('0x40')]=_0x505f1d;return _0x45ad92;})[_0xdc67('0x25')](respondWithFilteredResult(_0x4254c7,_0x549631))[_0xdc67('0x41')](handleError(_0x4254c7,null));})[_0xdc67('0x41')](handleError(_0x4254c7,null));};exports[_0xdc67('0x42')]=function(_0x5968d3,_0x4617ea){var _0x19aa8b={'raw':![],'where':{'id':_0x5968d3[_0xdc67('0x43')]['id']}},_0x455615={};_0x455615[_0xdc67('0x2e')]=_[_0xdc67('0x2f')](db[_0xdc67('0x2c')]['rawAttributes']);_0x455615[_0xdc67('0x30')]=_[_0xdc67('0x2f')](_0x5968d3['query']);_0x455615['filters']=_[_0xdc67('0x32')](_0x455615[_0xdc67('0x2e')],_0x455615[_0xdc67('0x30')]);_0x19aa8b[_0xdc67('0x33')]=_[_0xdc67('0x32')](_0x455615[_0xdc67('0x2e')],qs['fields'](_0x5968d3[_0xdc67('0x30')][_0xdc67('0x34')]));_0x19aa8b[_0xdc67('0x33')]=_0x19aa8b['attributes'][_0xdc67('0x44')]?_0x19aa8b[_0xdc67('0x33')]:_0x455615[_0xdc67('0x2e')];if(_0x5968d3[_0xdc67('0x30')]['includeAll']){_0x19aa8b['include']=[{'all':!![]}];}_0x19aa8b=_[_0xdc67('0x3c')]({},_0x19aa8b,_0x5968d3[_0xdc67('0x45')]);return db[_0xdc67('0x2c')][_0xdc67('0x46')](_0x19aa8b)[_0xdc67('0x25')](handleEntityNotFound(_0x4617ea,null))[_0xdc67('0x25')](respondWithResult(_0x4617ea,null))['catch'](handleError(_0x4617ea,null));};exports[_0xdc67('0x47')]=function(_0x44d104,_0x4f9a41){return db[_0xdc67('0x2c')]['create'](_0x44d104[_0xdc67('0x48')],{})[_0xdc67('0x25')](function(_0x37cf12){var _0x48e9bd=_0x44d104['user'][_0xdc67('0x26')]({'plain':!![]});if(!_0x48e9bd)throw new Error(_0xdc67('0x49'));if(_0x48e9bd[_0xdc67('0x4a')]==='user'){var _0x29cdd3=_0x37cf12[_0xdc67('0x26')]({'plain':!![]});var _0x30131c=_0xdc67('0x27');return db['UserProfileSection'][_0xdc67('0x46')]({'where':{'name':_0x30131c,'userProfileId':_0x48e9bd[_0xdc67('0x4b')]},'raw':!![]})[_0xdc67('0x25')](function(_0x2362b0){if(_0x2362b0&&_0x2362b0[_0xdc67('0x4c')]===0x0){return db[_0xdc67('0x4d')][_0xdc67('0x47')]({'name':_0x29cdd3[_0xdc67('0x29')],'resourceId':_0x29cdd3['id'],'type':_0x2362b0[_0xdc67('0x29')],'sectionId':_0x2362b0['id']},{})[_0xdc67('0x25')](function(){return _0x37cf12;});}else{return _0x37cf12;}})[_0xdc67('0x41')](function(_0x3b37cf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b37cf);throw _0x3b37cf;});}return _0x37cf12;})[_0xdc67('0x25')](respondWithResult(_0x4f9a41,0xc9))[_0xdc67('0x41')](handleError(_0x4f9a41,null));};exports[_0xdc67('0x23')]=function(_0x1a5b56,_0x1eeac4){if(_0x1a5b56['body']['id']){delete _0x1a5b56['body']['id'];}return db['CmCompany'][_0xdc67('0x46')]({'where':{'id':_0x1a5b56[_0xdc67('0x43')]['id']}})[_0xdc67('0x25')](handleEntityNotFound(_0x1eeac4,null))['then'](saveUpdates(_0x1a5b56['body'],null))[_0xdc67('0x25')](respondWithResult(_0x1eeac4,null))[_0xdc67('0x41')](handleError(_0x1eeac4,null));};exports[_0xdc67('0x24')]=function(_0x368a13,_0x4fed80){return db[_0xdc67('0x2c')][_0xdc67('0x46')]({'where':{'id':_0x368a13['params']['id']}})[_0xdc67('0x25')](handleEntityNotFound(_0x4fed80,null))[_0xdc67('0x25')](removeEntity(_0x4fed80,null))[_0xdc67('0x41')](handleError(_0x4fed80,null));};exports['describe']=function(_0x1b1ca2,_0x3e41a6){return db[_0xdc67('0x2c')]['describe']()[_0xdc67('0x25')](respondWithResult(_0x3e41a6,null))[_0xdc67('0x41')](handleError(_0x3e41a6,null));};exports[_0xdc67('0x4e')]=function(_0x100fc9,_0x41eff4,_0x384863){return db[_0xdc67('0x4f')][_0xdc67('0x46')]({'where':{'id':_0x100fc9[_0xdc67('0x43')]['id']}})[_0xdc67('0x25')](handleEntityNotFound(_0x41eff4,null))['then'](function(_0x1007e3){if(_0x1007e3){return _0x1007e3[_0xdc67('0x4e')](_0x100fc9[_0xdc67('0x48')][_0xdc67('0x50')],_[_0xdc67('0x51')](_0x100fc9['body'],[_0xdc67('0x50'),'id'])||{});}})[_0xdc67('0x25')](respondWithResult(_0x41eff4,null))[_0xdc67('0x41')](handleError(_0x41eff4,null));};exports['getContacts']=function(_0x3dd744,_0x1f7cca,_0x23c046){var _0x551722={};var _0x56d078={};var _0x54f949;var _0x437066;return db[_0xdc67('0x2c')][_0xdc67('0x52')]({'where':{'id':_0x3dd744[_0xdc67('0x43')]['id']}})[_0xdc67('0x25')](handleEntityNotFound(_0x1f7cca,null))[_0xdc67('0x25')](function(_0x269866){if(_0x269866){_0x54f949=_0x269866;_0x56d078[_0xdc67('0x2e')]=_['keys'](db[_0xdc67('0x4f')]['rawAttributes']);_0x56d078[_0xdc67('0x30')]=_[_0xdc67('0x2f')](_0x3dd744['query']);_0x56d078[_0xdc67('0x31')]=_[_0xdc67('0x32')](_0x56d078[_0xdc67('0x2e')],_0x56d078[_0xdc67('0x30')]);_0x551722[_0xdc67('0x33')]=_['intersection'](_0x56d078[_0xdc67('0x2e')],qs[_0xdc67('0x34')](_0x3dd744[_0xdc67('0x30')][_0xdc67('0x34')]));_0x551722[_0xdc67('0x33')]=_0x551722['attributes'][_0xdc67('0x44')]?_0x551722[_0xdc67('0x33')]:_0x56d078[_0xdc67('0x2e')];_0x551722[_0xdc67('0x37')]=qs[_0xdc67('0x38')](_0x3dd744[_0xdc67('0x30')][_0xdc67('0x38')]);_0x551722[_0xdc67('0x3b')]=qs[_0xdc67('0x31')](_[_0xdc67('0x39')](_0x3dd744['query'],_0x56d078[_0xdc67('0x31')]));if(_0x3dd744[_0xdc67('0x30')][_0xdc67('0x3a')]){_0x551722[_0xdc67('0x3b')]=_[_0xdc67('0x3c')](_0x551722[_0xdc67('0x3b')],{'$or':_['map'](_0x551722[_0xdc67('0x33')],function(_0x4d0cfa){var _0xf29d79={};_0xf29d79[_0x4d0cfa]={'$like':'%'+_0x3dd744[_0xdc67('0x30')][_0xdc67('0x3a')]+'%'};return _0xf29d79;})});}_0x551722=_[_0xdc67('0x3c')]({},_0x551722,_0x3dd744['options']);return _0x54f949[_0xdc67('0x53')](_0x551722);}})[_0xdc67('0x25')](function(_0x1ff1ee){if(_0x1ff1ee){_0x437066=_0x1ff1ee[_0xdc67('0x44')];if(!_0x3dd744[_0xdc67('0x30')]['hasOwnProperty'](_0xdc67('0x36'))){_0x551722[_0xdc67('0x1b')]=qs['limit'](_0x3dd744[_0xdc67('0x30')][_0xdc67('0x1b')]);_0x551722['offset']=qs[_0xdc67('0x1e')](_0x3dd744[_0xdc67('0x30')][_0xdc67('0x1e')]);}return _0x54f949[_0xdc67('0x53')](_0x551722);}})[_0xdc67('0x25')](function(_0x569b12){if(_0x569b12){return _0x569b12?{'count':_0x437066,'rows':_0x569b12}:null;}})[_0xdc67('0x25')](respondWithResult(_0x1f7cca,null))['catch'](handleError(_0x1f7cca,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index f69c0a6..8ed9081 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 _0x169d=['api','request-promise','path','./cmCompany.attributes','define','cm_companies','lodash','util','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x169d,0x153));var _0xd169=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x169d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd169('0x0'));var util=require(_0xd169('0x1'));var logger=require(_0xd169('0x2'))(_0xd169('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd169('0x4'));var fs=require('fs');var path=require(_0xd169('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd169('0x6'));module['exports']=function(_0x4893e1,_0x2ff32f){return _0x4893e1[_0xd169('0x7')]('CmCompany',attributes,{'tableName':_0xd169('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd8b=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmCompany.attributes','exports','define','cm_companies'];(function(_0x56ceab,_0x3943c0){var _0x2d54af=function(_0x2b6bdb){while(--_0x2b6bdb){_0x56ceab['push'](_0x56ceab['shift']());}};_0x2d54af(++_0x3943c0);}(_0xcd8b,0x1c8));var _0xbcd8=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcd8b[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xbcd8('0x0'));var util=require(_0xbcd8('0x1'));var logger=require(_0xbcd8('0x2'))(_0xbcd8('0x3'));var moment=require(_0xbcd8('0x4'));var BPromise=require('bluebird');var rp=require(_0xbcd8('0x5'));var fs=require('fs');var path=require(_0xbcd8('0x6'));var rimraf=require(_0xbcd8('0x7'));var config=require('../../config/environment');var attributes=require(_0xbcd8('0x8'));module[_0xbcd8('0x9')]=function(_0x5523e2,_0x57628f){return _0x5523e2[_0xbcd8('0xa')]('CmCompany',attributes,{'tableName':_0xbcd8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index f4c4b93..6bc5db1 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 _0x8a7c=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','then','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x8a7c,0x1b5));var _0xc8a7=function(_0x279a1a,_0x238309){_0x279a1a=_0x279a1a-0x0;var _0x185456=_0x8a7c[_0x279a1a];return _0x185456;};'use strict';var _=require('lodash');var util=require(_0xc8a7('0x0'));var moment=require(_0xc8a7('0x1'));var BPromise=require(_0xc8a7('0x2'));var rs=require(_0xc8a7('0x3'));var fs=require('fs');var Redis=require(_0xc8a7('0x4'));var db=require(_0xc8a7('0x5'))['db'];var utils=require(_0xc8a7('0x6'));var logger=require('../../config/logger')(_0xc8a7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc8a7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4eb3ef,_0x25bcf8,_0x4780a1){return new BPromise(function(_0x27bcf8,_0x1e6f2b){return client['request'](_0x4eb3ef,_0x4780a1)[_0xc8a7('0x9')](function(_0x4f426d){logger[_0xc8a7('0xa')](_0xc8a7('0xb'),_0x25bcf8,'request\x20sent');logger['debug'](_0xc8a7('0xc'),_0x25bcf8,_0xc8a7('0xd'),JSON[_0xc8a7('0xe')](_0x4f426d));if(_0x4f426d[_0xc8a7('0xf')]){if(_0x4f426d[_0xc8a7('0xf')][_0xc8a7('0x10')]===0x1f4){logger[_0xc8a7('0xf')]('CmCompany,\x20%s,\x20%s',_0x25bcf8,_0x4f426d['error'][_0xc8a7('0x11')]);return _0x1e6f2b(_0x4f426d[_0xc8a7('0xf')]['message']);}logger['error'](_0xc8a7('0xb'),_0x25bcf8,_0x4f426d['error'][_0xc8a7('0x11')]);return _0x27bcf8(_0x4f426d[_0xc8a7('0xf')]['message']);}else{logger[_0xc8a7('0xa')](_0xc8a7('0xb'),_0x25bcf8,_0xc8a7('0xd'));_0x27bcf8(_0x4f426d[_0xc8a7('0x12')][_0xc8a7('0x11')]);}})[_0xc8a7('0x13')](function(_0xe51850){logger[_0xc8a7('0xf')](_0xc8a7('0xb'),_0x25bcf8,_0xe51850);_0x1e6f2b(_0xe51850);});});} \ No newline at end of file +var _0xa678=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x222909,_0xff8168){var _0x39496c=function(_0x5cc3ee){while(--_0x5cc3ee){_0x222909['push'](_0x222909['shift']());}};_0x39496c(++_0xff8168);}(_0xa678,0x70));var _0x8a67=function(_0x5ccdd5,_0x29f34c){_0x5ccdd5=_0x5ccdd5-0x0;var _0x4eaeaf=_0xa678[_0x5ccdd5];return _0x4eaeaf;};'use strict';var _=require(_0x8a67('0x0'));var util=require(_0x8a67('0x1'));var moment=require(_0x8a67('0x2'));var BPromise=require(_0x8a67('0x3'));var rs=require(_0x8a67('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a67('0x5'))['db'];var utils=require(_0x8a67('0x6'));var logger=require(_0x8a67('0x7'))('rpc');var config=require(_0x8a67('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8a67('0x9')][_0x8a67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a8f6e,_0x529509,_0x1d8c7b){return new BPromise(function(_0x48ac49,_0x2c2f7d){return client[_0x8a67('0xb')](_0x5a8f6e,_0x1d8c7b)['then'](function(_0x289fa1){logger[_0x8a67('0xc')](_0x8a67('0xd'),_0x529509,'request\x20sent');logger[_0x8a67('0xe')](_0x8a67('0xf'),_0x529509,_0x8a67('0x10'),JSON[_0x8a67('0x11')](_0x289fa1));if(_0x289fa1[_0x8a67('0x12')]){if(_0x289fa1[_0x8a67('0x12')][_0x8a67('0x13')]===0x1f4){logger['error'](_0x8a67('0xd'),_0x529509,_0x289fa1[_0x8a67('0x12')][_0x8a67('0x14')]);return _0x2c2f7d(_0x289fa1['error'][_0x8a67('0x14')]);}logger[_0x8a67('0x12')]('CmCompany,\x20%s,\x20%s',_0x529509,_0x289fa1[_0x8a67('0x12')]['message']);return _0x48ac49(_0x289fa1[_0x8a67('0x12')][_0x8a67('0x14')]);}else{logger[_0x8a67('0xc')](_0x8a67('0xd'),_0x529509,_0x8a67('0x10'));_0x48ac49(_0x289fa1['result']['message']);}})[_0x8a67('0x15')](function(_0x40fc2b){logger[_0x8a67('0x12')](_0x8a67('0xd'),_0x529509,_0x40fc2b);_0x2c2f7d(_0x40fc2b);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index c72a704..1ba243e 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 _0x1486=['index','/describe','describe','/:id','show','post','create','/:id/contacts','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x4f3484,_0x2a0968){var _0x612a71=function(_0x9099fd){while(--_0x9099fd){_0x4f3484['push'](_0x4f3484['shift']());}};_0x612a71(++_0x2a0968);}(_0x1486,0x160));var _0x6148=function(_0x28e757,_0x28d435){_0x28e757=_0x28e757-0x0;var _0x604fde=_0x1486[_0x28e757];return _0x604fde;};'use strict';var multer=require(_0x6148('0x0'));var util=require(_0x6148('0x1'));var path=require('path');var timeout=require(_0x6148('0x2'));var express=require(_0x6148('0x3'));var router=express['Router']();var fs_extra=require(_0x6148('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6148('0x5'));var controller=require('./cmCompany.controller');router[_0x6148('0x6')]('/',auth[_0x6148('0x7')](),controller[_0x6148('0x8')]);router[_0x6148('0x6')](_0x6148('0x9'),auth[_0x6148('0x7')](),controller[_0x6148('0xa')]);router[_0x6148('0x6')](_0x6148('0xb'),auth['isAuthenticated'](),controller[_0x6148('0xc')]);router[_0x6148('0x6')]('/:id/contacts',auth[_0x6148('0x7')](),controller['getContacts']);router[_0x6148('0xd')]('/',auth[_0x6148('0x7')](),controller[_0x6148('0xe')]);router['post'](_0x6148('0xf'),auth[_0x6148('0x7')](),controller['addContacts']);router['put'](_0x6148('0xb'),auth[_0x6148('0x7')](),controller[_0x6148('0x10')]);router[_0x6148('0x11')](_0x6148('0xb'),auth[_0x6148('0x7')](),controller[_0x6148('0x12')]);module[_0x6148('0x13')]=router; \ No newline at end of file +var _0x5f32=['describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5f32,0x12d));var _0x25f3=function(_0x401701,_0x149dce){_0x401701=_0x401701-0x0;var _0x3da178=_0x5f32[_0x401701];return _0x3da178;};'use strict';var multer=require('multer');var util=require(_0x25f3('0x0'));var path=require(_0x25f3('0x1'));var timeout=require(_0x25f3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25f3('0x3'));var auth=require(_0x25f3('0x4'));var interaction=require(_0x25f3('0x5'));var config=require(_0x25f3('0x6'));var controller=require(_0x25f3('0x7'));router[_0x25f3('0x8')]('/',auth[_0x25f3('0x9')](),controller[_0x25f3('0xa')]);router[_0x25f3('0x8')]('/describe',auth[_0x25f3('0x9')](),controller[_0x25f3('0xb')]);router[_0x25f3('0x8')](_0x25f3('0xc'),auth[_0x25f3('0x9')](),controller[_0x25f3('0xd')]);router[_0x25f3('0x8')](_0x25f3('0xe'),auth['isAuthenticated'](),controller[_0x25f3('0xf')]);router[_0x25f3('0x10')]('/',auth[_0x25f3('0x9')](),controller[_0x25f3('0x11')]);router[_0x25f3('0x10')]('/:id/contacts',auth[_0x25f3('0x9')](),controller[_0x25f3('0x12')]);router[_0x25f3('0x13')](_0x25f3('0xc'),auth[_0x25f3('0x9')](),controller[_0x25f3('0x14')]);router[_0x25f3('0x15')](_0x25f3('0xc'),auth[_0x25f3('0x9')](),controller[_0x25f3('0x16')]);module[_0x25f3('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 0debdf6..7cf2fa4 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 _0x22a7=['sequelize','exports','STRING','TEXT','INTEGER','DATE','NOW'];(function(_0x1fdd8e,_0x29c639){var _0x5122ea=function(_0x4230da){while(--_0x4230da){_0x1fdd8e['push'](_0x1fdd8e['shift']());}};_0x5122ea(++_0x29c639);}(_0x22a7,0x16c));var _0x722a=function(_0x418473,_0x2f4ef1){_0x418473=_0x418473-0x0;var _0x3e85d4=_0x22a7[_0x418473];return _0x3e85d4;};'use strict';var _=require('lodash');var Sequelize=require(_0x722a('0x0'));module[_0x722a('0x1')]={'firstName':{'type':Sequelize[_0x722a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x722a('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x722a('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x722a('0x2')]},'dateOfBirth':{'type':Sequelize[_0x722a('0x2')]},'description':{'type':Sequelize[_0x722a('0x3')]},'phone':{'type':Sequelize[_0x722a('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x722a('0x2')]},'email':{'type':Sequelize[_0x722a('0x2')]},'url':{'type':Sequelize[_0x722a('0x2')]},'facebook':{'type':Sequelize[_0x722a('0x2')]},'fb_data':{'type':Sequelize[_0x722a('0x2')]},'twitter':{'type':Sequelize[_0x722a('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x722a('0x2')]},'line':{'type':Sequelize[_0x722a('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x722a('0x2')]},'UserId':{'type':Sequelize[_0x722a('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x722a('0x2')]},'priority':{'type':Sequelize[_0x722a('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x722a('0x5')],'defaultValue':Sequelize[_0x722a('0x6')]},'dialTimezone':{'type':Sequelize[_0x722a('0x2')]},'utcOffset':{'type':Sequelize[_0x722a('0x4')]}}; \ No newline at end of file +var _0x8de0=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x2ee20d,_0x354e70){var _0xade530=function(_0x1db7cc){while(--_0x1db7cc){_0x2ee20d['push'](_0x2ee20d['shift']());}};_0xade530(++_0x354e70);}(_0x8de0,0xcd));var _0x08de=function(_0x5603ac,_0x30ad93){_0x5603ac=_0x5603ac-0x0;var _0xe30eb8=_0x8de0[_0x5603ac];return _0xe30eb8;};'use strict';var _=require(_0x08de('0x0'));var Sequelize=require(_0x08de('0x1'));module[_0x08de('0x2')]={'firstName':{'type':Sequelize[_0x08de('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x08de('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x08de('0x3')]},'city':{'type':Sequelize[_0x08de('0x3')]},'country':{'type':Sequelize[_0x08de('0x3')]},'dateOfBirth':{'type':Sequelize[_0x08de('0x3')]},'description':{'type':Sequelize[_0x08de('0x4')]},'phone':{'type':Sequelize[_0x08de('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x08de('0x3')]},'email':{'type':Sequelize[_0x08de('0x3')]},'url':{'type':Sequelize[_0x08de('0x3')]},'facebook':{'type':Sequelize[_0x08de('0x3')]},'fb_data':{'type':Sequelize[_0x08de('0x3')]},'twitter':{'type':Sequelize[_0x08de('0x3')]},'skype':{'type':Sequelize[_0x08de('0x3')]},'teams':{'type':Sequelize[_0x08de('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x08de('0x3')]},'wechat':{'type':Sequelize[_0x08de('0x3')]},'telegram':{'type':Sequelize[_0x08de('0x3')]},'UserId':{'type':Sequelize[_0x08de('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x08de('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x08de('0x7')],'defaultValue':Sequelize[_0x08de('0x8')]},'dialTimezone':{'type':Sequelize[_0x08de('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 7038f5d..64a70ed 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 _0xe9ee=['moment','util','path','lodash','squel','papaparse','ioredis','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','index','describe','findAll','query','user','catch','CmContact','find','params','tags','length','startsWith','displayName','CmCustomField','columnName','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','ChatInteraction','ChatMessage','MailInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','create','isNil','dialTimezone','timezones','utcOffset','keys','additionalPhones','bulkCreate','each','duplicates','$or','push','where','findOrCreate','contact','all','Tag','color','Phones','ContactItemType','ItemType','sequelize','Phones.OrderBy','ListId','omit','map','format','cf_%d','pickBy','cf_','setFields','id\x20=\x20?','toParam','text','getTags','findOne','model','rawAttributes','intersection','attributes','fields','order','sort','filters','pick','filter','options','setTags','setAdditionalPhones','items','item_types','ItemTypeId','description','phone','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','literal','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','nolimit','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','binding_keys','CompanyId','File\x20uploaded\x20correctly!','pid','send','createReadStream','parse','meta','import','User','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','fax','whatsapp','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','findAndCountAll','startCase','Website','closed','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','deviceModel','osName','ratingMessage','ratingType','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','slice'];(function(_0x261ae4,_0x3f10de){var _0x1790e0=function(_0x3ea9e4){while(--_0x3ea9e4){_0x261ae4['push'](_0x261ae4['shift']());}};_0x1790e0(++_0x3f10de);}(_0xe9ee,0x1f0));var _0xee9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9ee[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xee9e('0x0'));var BPromise=require('bluebird');var util=require(_0xee9e('0x1'));var path=require(_0xee9e('0x2'));var fs=require('fs');var _=require(_0xee9e('0x3'));var squel=require(_0xee9e('0x4'));var Papa=require(_0xee9e('0x5'));var Redis=require(_0xee9e('0x6'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0xee9e('0x7'))('api');var config=require(_0xee9e('0x8'));var shared=require(_0xee9e('0x9'));var db=require(_0xee9e('0xa'))['db'];config[_0xee9e('0xb')]=_[_0xee9e('0xc')](config[_0xee9e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xee9e('0xd'))(new Redis(config[_0xee9e('0xb')]));require(_0xee9e('0xe'))[_0xee9e('0xf')](socket);function respondWithResult(_0x503e9c,_0x5adebd){_0x5adebd=_0x5adebd||0xc8;return function(_0x2bb2e2){if(_0x2bb2e2){return _0x503e9c[_0xee9e('0x10')](_0x5adebd)[_0xee9e('0x11')](_0x2bb2e2);}};}function respondWithFilteredResult(_0x5aaf02,_0x559f94){return function(_0xd36ea0){if(_0xd36ea0){var _0x8ae8e0=typeof _0x559f94[_0xee9e('0x12')]===_0xee9e('0x13')&&typeof _0x559f94['limit']==='undefined';var _0x13b887=_0xd36ea0[_0xee9e('0x14')];var _0x572a3a=_0x8ae8e0?0x0:_0x559f94[_0xee9e('0x12')];var _0xee1eed=_0x8ae8e0?_0xd36ea0[_0xee9e('0x14')]:_0x559f94[_0xee9e('0x12')]+_0x559f94[_0xee9e('0x15')];var _0x269084;if(_0xee1eed>=_0x13b887){_0xee1eed=_0x13b887;_0x269084=0xc8;}else{_0x269084=0xce;}_0x5aaf02['status'](_0x269084);return _0x5aaf02[_0xee9e('0x16')](_0xee9e('0x17'),_0x572a3a+'-'+_0xee1eed+'/'+_0x13b887)[_0xee9e('0x11')](_0xd36ea0);}return null;};}function saveUpdates(_0x339cf8){return function(_0x1a4c8b){if(_0x1a4c8b){return _0x1a4c8b[_0xee9e('0x18')](_0x339cf8)[_0xee9e('0x19')](function(_0x123cf9){return _0x123cf9;});}return null;};}function removeEntity(_0x5508b5){return function(_0x59c96b){if(_0x59c96b){return _0x59c96b[_0xee9e('0x1a')]()[_0xee9e('0x19')](function(){_0x5508b5[_0xee9e('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e71f3){return function(_0x19aece){if(!_0x19aece){_0x2e71f3[_0xee9e('0x1b')](0x194);}return _0x19aece;};}function handleError(_0x2752cc,_0x40bbfa){_0x40bbfa=_0x40bbfa||0x1f4;return function(_0x4b43e2){logger[_0xee9e('0x1c')](_0x4b43e2[_0xee9e('0x1d')]);if(_0x4b43e2[_0xee9e('0x1e')]){delete _0x4b43e2['name'];}_0x2752cc[_0xee9e('0x10')](_0x40bbfa)['send'](_0x4b43e2);};}exports[_0xee9e('0x1f')]=function(_0x356a2c,_0x3613b){var _0x5f1366={};return contacts[_0xee9e('0x20')]()['then'](function(_0x3d7bed){_0x5f1366=qs['getOptions'](_0x3d7bed,_0x356a2c);return contacts[_0xee9e('0x21')](_0x356a2c[_0xee9e('0x22')],_0x356a2c[_0xee9e('0x23')],_0x5f1366,_0x3d7bed);})[_0xee9e('0x19')](respondWithFilteredResult(_0x3613b,_0x5f1366))[_0xee9e('0x24')](handleError(_0x3613b,null));};exports[_0xee9e('0x1a')]=function(_0x282ec5,_0x425162){return db[_0xee9e('0x25')][_0xee9e('0x26')]({'where':{'id':_0x282ec5[_0xee9e('0x27')]['id']}})[_0xee9e('0x19')](handleEntityNotFound(_0x425162,null))[_0xee9e('0x19')](removeEntity(_0x425162,null))['catch'](handleError(_0x425162,null));};exports[_0xee9e('0x20')]=function(_0x476049,_0x573878){return db[_0xee9e('0x25')]['describe']()['then'](function(_0x43f9c5){delete _0x43f9c5[_0xee9e('0x28')];for(var _0x342596=0x0;_0x3425960x0){return new Promise(function(_0x4ffbb6){var _0x2e7fc4=[];for(var _0x425e09=0x0;_0x425e09<_0x4d9bd6[_0xee9e('0x29')];_0x425e09++){_0x2e7fc4[_0xee9e('0x59')](insertAdditionalPhones(_0x4d9bd6[_0x425e09][_0xee9e('0x5c')],_0x4d9bd6[_0x425e09][_0xee9e('0x54')]));}Promise[_0xee9e('0x5d')](_0x2e7fc4)[_0xee9e('0x19')](function(){_0x4ffbb6(0x1);});})[_0xee9e('0x19')](function(){return{'success':_0x22522e,'failure':_0x343cc8,'duplicates':_0x43463c};});}else{return{'success':_0x22522e,'failure':_0x343cc8,'duplicates':_0x43463c};}}})[_0xee9e('0x19')](respondWithResult(_0x8755bd,0xc9))['catch'](handleError(_0x8755bd,null));};exports['show']=function(_0x57e39c,_0x4011ac){var _0x5bd0ab;return db[_0xee9e('0x25')][_0xee9e('0x20')]()[_0xee9e('0x19')](function(_0x203a3d){return db[_0xee9e('0x25')]['find']({'where':{'id':_0x57e39c[_0xee9e('0x27')]['id']},'include':[{'model':db[_0xee9e('0x5e')],'as':'Tags','attributes':['id',_0xee9e('0x1e'),_0xee9e('0x5f')],'required':_0x57e39c['query']['tag']?!![]:![]},{'model':db[_0xee9e('0x45')],'as':_0xee9e('0x60'),'where':{'CmContactId':_0x57e39c[_0xee9e('0x27')]['id']},'required':![],'include':[{'model':db[_0xee9e('0x61')],'as':_0xee9e('0x62')}]}],'order':[db[_0xee9e('0x63')]['literal'](_0xee9e('0x64'))],'attributes':_[_0xee9e('0x53')](_0x203a3d)});})[_0xee9e('0x19')](function(_0x8eb3a6){if(!_['isNil'](_0x8eb3a6)){_0x5bd0ab=_0x8eb3a6['get']({'plain':!![]});var _0x48b55e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x8eb3a6&&_0x8eb3a6[_0xee9e('0x65')]){if(_0x8eb3a6['ListId']){_0x48b55e['where']['$and']['push']({'ListId':{'$ne':_0x8eb3a6['ListId']}});}}return db['CmCustomField'][_0xee9e('0x21')](_0x48b55e);}})[_0xee9e('0x19')](function(_0x7dee1b){if(!_[_0xee9e('0x4f')](_0x7dee1b)){return _[_0xee9e('0x66')](_0x5bd0ab,_[_0xee9e('0x67')](_0x7dee1b,function(_0x4ece96){return util[_0xee9e('0x68')](_0xee9e('0x69'),_0x4ece96['id']);}));}})['then'](handleEntityNotFound(_0x4011ac,null))[_0xee9e('0x19')](respondWithResult(_0x4011ac,null))['catch'](handleError(_0x4011ac,null));};exports[_0xee9e('0x18')]=function(_0x5cd76f,_0x44914b){var _0x5c0531;if(_0x5cd76f[_0xee9e('0x36')]['id']){delete _0x5cd76f['body']['id'];}if(!_[_0xee9e('0x4f')](_0x5cd76f['body'][_0xee9e('0x50')])){var _0xd26ef4=_0x5cd76f['body'][_0xee9e('0x50')];if(!_['isNil'](shared[_0xee9e('0x51')][_0xd26ef4]))_0x5cd76f[_0xee9e('0x36')]['utcOffset']=shared[_0xee9e('0x51')][_0xd26ef4][_0xee9e('0x52')];}return db[_0xee9e('0x25')][_0xee9e('0x26')]({'where':{'id':_0x5cd76f[_0xee9e('0x27')]['id']}})['then'](handleEntityNotFound(_0x44914b,null))[_0xee9e('0x19')](saveUpdates(_0x5cd76f[_0xee9e('0x36')],null))['then'](function(_0x1832f9){_0x5c0531=_0x1832f9;var _0x1330a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1832f9&&_0x1832f9[_0xee9e('0x65')]){if(_0x1832f9['ListId']){_0x1330a5[_0xee9e('0x5a')]['$and'][_0xee9e('0x59')]({'ListId':{'$ne':_0x1832f9['ListId']}});}}return db['CmCustomField'][_0xee9e('0x21')](_0x1330a5);})[_0xee9e('0x19')](function(_0x22e9f7){if(_0x22e9f7){return _[_0xee9e('0x66')](_[_0xee9e('0x6a')](_0x5cd76f[_0xee9e('0x36')],function(_0x5ccaed,_0x3cf85e){return _[_0xee9e('0x2a')](_0x3cf85e,_0xee9e('0x6b'));}),_[_0xee9e('0x67')](_0x22e9f7,function(_0x140d54){return util[_0xee9e('0x68')](_0xee9e('0x69'),_0x140d54['id']);}));}})['then'](function(_0x89a42){if(_0x89a42&&!_['isEmpty'](_0x89a42)){var _0x39f263=squel[_0xee9e('0x18')]()['table']('cm_contacts')[_0xee9e('0x6c')](_0x89a42)[_0xee9e('0x5a')](_0xee9e('0x6d'),_0x5cd76f[_0xee9e('0x27')]['id'])[_0xee9e('0x6e')]();return db[_0xee9e('0x63')][_0xee9e('0x22')](_0x39f263[_0xee9e('0x6f')],{'replacements':_0x39f263['values']});}})[_0xee9e('0x19')](function(){if(_0x5cd76f[_0xee9e('0x36')]['phone']&&_0x5c0531){return db[_0xee9e('0x3d')][_0xee9e('0x18')]({'phone':_0x5cd76f[_0xee9e('0x36')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x5c0531['id']}});}})[_0xee9e('0x19')](function(){return _0x5c0531;})[_0xee9e('0x19')](respondWithResult(_0x44914b,null))['catch'](handleError(_0x44914b,null));};exports[_0xee9e('0x70')]=function(_0x119a64,_0x3e7235){var _0x513b7a={};var _0x25baba={};var _0x2dcf12;var _0x5840d6;return db['CmContact'][_0xee9e('0x71')]({'where':{'id':_0x119a64[_0xee9e('0x27')]['id']}})['then'](handleEntityNotFound(_0x3e7235,null))['then'](function(_0x324a26){if(_0x324a26){_0x2dcf12=_0x324a26;_0x25baba[_0xee9e('0x72')]=_[_0xee9e('0x53')](db[_0xee9e('0x5e')][_0xee9e('0x73')]);_0x25baba['query']=_[_0xee9e('0x53')](_0x119a64[_0xee9e('0x22')]);_0x25baba['filters']=_[_0xee9e('0x74')](_0x25baba[_0xee9e('0x72')],_0x25baba[_0xee9e('0x22')]);_0x513b7a[_0xee9e('0x75')]=_['intersection'](_0x25baba[_0xee9e('0x72')],qs[_0xee9e('0x76')](_0x119a64[_0xee9e('0x22')][_0xee9e('0x76')]));_0x513b7a[_0xee9e('0x75')]=_0x513b7a[_0xee9e('0x75')]['length']?_0x513b7a[_0xee9e('0x75')]:_0x25baba[_0xee9e('0x72')];_0x513b7a[_0xee9e('0x77')]=qs[_0xee9e('0x78')](_0x119a64[_0xee9e('0x22')][_0xee9e('0x78')]);_0x513b7a[_0xee9e('0x5a')]=qs[_0xee9e('0x79')](_[_0xee9e('0x7a')](_0x119a64[_0xee9e('0x22')],_0x25baba['filters']));if(_0x119a64[_0xee9e('0x22')][_0xee9e('0x7b')]){_0x513b7a[_0xee9e('0x5a')]=_[_0xee9e('0x35')](_0x513b7a['where'],{'$or':_[_0xee9e('0x67')](_0x513b7a[_0xee9e('0x75')],function(_0xeff65a){var _0x15c4de={};_0x15c4de[_0xeff65a]={'$like':'%'+_0x119a64[_0xee9e('0x22')][_0xee9e('0x7b')]+'%'};return _0x15c4de;})});}_0x513b7a=_[_0xee9e('0x35')]({},_0x513b7a,_0x119a64[_0xee9e('0x7c')]);return _0x2dcf12[_0xee9e('0x70')](_0x513b7a);}})[_0xee9e('0x19')](function(_0x31f58c){if(_0x31f58c){_0x5840d6=_0x31f58c[_0xee9e('0x29')];if(!_0x119a64[_0xee9e('0x22')][_0xee9e('0x34')]('nolimit')){_0x513b7a[_0xee9e('0x15')]=qs['limit'](_0x119a64['query'][_0xee9e('0x15')]);_0x513b7a[_0xee9e('0x12')]=qs[_0xee9e('0x12')](_0x119a64[_0xee9e('0x22')]['offset']);}return _0x2dcf12[_0xee9e('0x70')](_0x513b7a);}})[_0xee9e('0x19')](function(_0x304f6a){if(_0x304f6a){return _0x304f6a?{'count':_0x5840d6,'rows':_0x304f6a}:null;}})[_0xee9e('0x19')](respondWithResult(_0x3e7235,null))[_0xee9e('0x24')](handleError(_0x3e7235,null));};exports[_0xee9e('0x7d')]=function(_0xb73292,_0x3075d5){if(_0xb73292[_0xee9e('0x36')]['id']){delete _0xb73292[_0xee9e('0x36')]['id'];}return db[_0xee9e('0x25')]['findOne']({'where':{'id':_0xb73292[_0xee9e('0x27')]['id']}})['then'](handleEntityNotFound(_0x3075d5,null))[_0xee9e('0x19')](function(_0x2baefc){if(_0x2baefc){return _0x2baefc[_0xee9e('0x7d')](_0xb73292[_0xee9e('0x36')]['ids']||[]);}return null;})[_0xee9e('0x19')](respondWithResult(_0x3075d5,null))['catch'](handleError(_0x3075d5,null));};exports[_0xee9e('0x7e')]=function(_0x229a61,_0x217d3a){var _0x383793=[];_0x383793['push'](addAdditionalPhones(_0x229a61[_0xee9e('0x36')]));Promise[_0xee9e('0x5d')](_0x383793)[_0xee9e('0x19')](function(){_0x383793=[];_0x383793['push'](deleteCmHopperPhones(_0x229a61[_0xee9e('0x36')]['id']));_0x383793[_0xee9e('0x59')](addCmHopperPhones(_0x229a61[_0xee9e('0x36')]['id']));Promise[_0xee9e('0x5d')](_0x383793)['then'](function(){return[0x1];})[_0xee9e('0x19')](respondWithResult(_0x217d3a,null));});};function addAdditionalPhones(_0x99be1f){var _0x3c5e66;return new Promise(function(_0x15c43a){return db[_0xee9e('0x45')][_0xee9e('0x1a')]({'where':{'CmContactId':_0x99be1f['id']}})['then'](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id','OrderBy']})[_0xee9e('0x19')](function(_0x3dceb7){var _0x391490=[];for(var _0x29d4bd=0x0;_0x29d4bd<_0x99be1f[_0xee9e('0x7f')][_0xee9e('0x29')];_0x29d4bd++){var _0x3f4ec8=_0x99be1f[_0xee9e('0x80')]?_['isNil'](_0x99be1f[_0xee9e('0x80')][_0x29d4bd])?'':_0x99be1f[_0xee9e('0x80')][_0x29d4bd]:_0x99be1f[_0xee9e('0x7f')][_0x29d4bd][_0xee9e('0x81')]?_0x99be1f['items'][_0x29d4bd][_0xee9e('0x81')]:'';var _0xff0a96=_[_0xee9e('0x4f')](_0x99be1f[_0xee9e('0x7f')][_0x29d4bd]['description'])?'':_0x99be1f[_0xee9e('0x7f')][_0x29d4bd][_0xee9e('0x82')];var _0xa66d7b=_0x3f4ec8+':'+_0x99be1f[_0xee9e('0x7f')][_0x29d4bd]['phone']+'§'+_0xff0a96;if(_[_0xee9e('0x4f')](_0x3c5e66))_0x3c5e66=_0xa66d7b;else _0x3c5e66+=';'+_0xa66d7b;var _0x244f0e=null;var _0xba304e=null;if(_0x99be1f[_0xee9e('0x80')]){if(!_[_0xee9e('0x4f')](_0x99be1f[_0xee9e('0x80')][_0x29d4bd])){_0xba304e=_['find'](_0x3dceb7,function(_0x245d7e){return _0x245d7e['id']===_0x99be1f[_0xee9e('0x80')][_0x29d4bd];});if(!_[_0xee9e('0x4f')](_0xba304e)){_0x244f0e=_0xba304e['OrderBy'];}}}else{if(!_['isNil'](_0x99be1f[_0xee9e('0x7f')][_0x29d4bd])){_0xba304e=_['find'](_0x3dceb7,function(_0x551bfa){return _0x551bfa['id']===_0x99be1f[_0xee9e('0x7f')][_0x29d4bd]['ItemTypeId'];});if(!_['isNil'](_0xba304e)){_0x244f0e=_0x29d4bd;}}}if(_[_0xee9e('0x4f')](_0x244f0e)){_0x244f0e=0x64;}_0x391490['push'](addAdditionalPhone(_0x99be1f['id'],_0x99be1f[_0xee9e('0x7f')][_0x29d4bd][_0xee9e('0x83')],_0x99be1f[_0xee9e('0x80')]?_[_0xee9e('0x4f')](_0x99be1f[_0xee9e('0x80')][_0x29d4bd])?null:_0x99be1f[_0xee9e('0x80')][_0x29d4bd]:_0x99be1f['items'][_0x29d4bd][_0xee9e('0x81')]?_0x99be1f[_0xee9e('0x7f')][_0x29d4bd][_0xee9e('0x81')]:null,_0x244f0e,_0xff0a96));}Promise['all'](_0x391490)[_0xee9e('0x19')](function(){db[_0xee9e('0x25')][_0xee9e('0x18')]({'AdditionalPhones':_0x3c5e66},{'where':{'id':_0x99be1f['id']}})[_0xee9e('0x19')](function(){_0x15c43a(0x1);});});});});});}function addAdditionalPhone(_0x530e56,_0x381e56,_0x3650a6,_0x88d480,_0x2959f7){return db[_0xee9e('0x45')]['find']({'where':{'CmContactId':_0x530e56,'item':_0x381e56}})[_0xee9e('0x19')](function(_0x521677){if(_0x521677)logger[_0xee9e('0x31')](_0xee9e('0x84'),_0x521677);else{db[_0xee9e('0x45')][_0xee9e('0x4e')]({'CmContactId':_0x530e56,'item':_0x381e56,'ItemTypeId':_0x3650a6,'OrderBy':_0x88d480,'ItemClass':_0xee9e('0x85'),'description':_0x2959f7});}});}function deleteCmHopperPhones(_0x2f7c32){return new Promise(function(_0x580f60){return db[_0xee9e('0x3d')][_0xee9e('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2f7c32}})[_0xee9e('0x19')](function(_0x102689){db[_0xee9e('0x86')][_0xee9e('0x1a')]({'where':{'CmHopperId':{'$in':_['map'](_0x102689,'id')}}});})[_0xee9e('0x19')](function(){_0x580f60(0x1);});});}function addCmHopperPhones(_0x5cdc04){return new Promise(function(_0x13beda){return db[_0xee9e('0x3d')][_0xee9e('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5cdc04}})[_0xee9e('0x19')](function(_0x200384){var _0x5e37c2=[];_[_0xee9e('0x67')](_0x200384,function(_0x2e6154){_0x5e37c2[_0xee9e('0x59')](createCmHopperPhone(_0x5cdc04,_0x2e6154['id']));});Promise[_0xee9e('0x5d')](_0x5e37c2)[_0xee9e('0x19')](function(){_0x13beda(0x1);});});});}function createCmHopperPhone(_0x5a6f37,_0x46285f){return new Promise(function(_0x13228b){db['CmContactHasItem'][_0xee9e('0x21')]({'raw':!![],'attributes':[_0xee9e('0x87'),_0xee9e('0x88')],'where':{'CmContactId':_0x5a6f37,'ItemClass':_0xee9e('0x85')},'include':[{'model':db[_0xee9e('0x61')],'attributes':[_0xee9e('0x88')],'as':_0xee9e('0x62')}],'order':[_0xee9e('0x88'),db['sequelize']['literal']('`ItemType`.OrderBy')]})[_0xee9e('0x19')](function(_0x19e7f8){var _0x85df58=0x1;var _0x3ad9f2=_[_0xee9e('0x67')](_0x19e7f8,function(_0x2d4c2f){_0x2d4c2f[_0xee9e('0x89')]=_0x46285f;_0x2d4c2f['phone']=_0x2d4c2f[_0xee9e('0x87')];_0x2d4c2f['OrderBy']=_0x85df58;delete _0x2d4c2f[_0xee9e('0x8a')];_0x85df58=_0x85df58+0x1;return _0x2d4c2f;});return db['CmHopperAdditionalPhone']['bulkCreate'](_0x3ad9f2,{});})['then'](function(){_0x13228b(0x1);});});}function insertAdditionalPhones(_0x244e0c,_0x57d996){return new Promise(function(_0x3450f0){var _0x365b80=[];for(var _0x59efb4=0x0;_0x59efb4<_0x57d996[_0xee9e('0x29')];_0x59efb4++){var _0x3d98bd=_0x57d996[_0x59efb4];_0x365b80['push'](parseContactItemType(_0x3d98bd));}Promise[_0xee9e('0x5d')](_0x365b80)[_0xee9e('0x19')](function(){var _0x81e074={'id':_0x244e0c['id'],'items':_0x57d996};return addAdditionalPhones(_0x81e074)[_0xee9e('0x19')](function(){return addCmHopperPhones(_0x244e0c['id']);});})['then'](function(){_0x3450f0(_0x244e0c);});});}function parseContactItemType(_0x35dc6c){return new Promise(function(_0x13f64d){if(_0x35dc6c[_0xee9e('0x34')](_0xee9e('0x81'))){_0x13f64d(_0x35dc6c);}else{return db['ContactItemType'][_0xee9e('0x26')]({'where':{'name':_0x35dc6c['ItemType']}})['then'](function(_0x471b66){if(_[_0xee9e('0x4f')](_0x471b66))_0x35dc6c['ItemTypeId']=null;else _0x35dc6c[_0xee9e('0x81')]=_0x471b66['id'];_0x13f64d(_0x35dc6c);});}});}exports[_0xee9e('0x8b')]=function(_0x392ea2,_0x1595fc){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x392ea2[_0xee9e('0x27')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xee9e('0x61')],'as':_0xee9e('0x62')}],'order':[[_0xee9e('0x88')],[db[_0xee9e('0x63')][_0xee9e('0x8c')](_0xee9e('0x8d'))]]})[_0xee9e('0x19')](function(_0x50541e){return _0x50541e;})['then'](respondWithResult(_0x1595fc,null))[_0xee9e('0x24')](handleError(_0x1595fc,null));};exports[_0xee9e('0x8e')]=function(_0x253086,_0x48c97f){return db[_0xee9e('0x45')][_0xee9e('0x21')]({'raw':!![],'where':{'CmContactId':_0x253086[_0xee9e('0x36')][_0xee9e('0x8f')]}})[_0xee9e('0x19')](function(_0x511071){var _0x465870=_['map'](_0x511071,function(_0x5d6763){_0x5d6763[_0xee9e('0x90')]=_0x253086[_0xee9e('0x36')][_0xee9e('0x91')];return _0x5d6763;});return db[_0xee9e('0x45')][_0xee9e('0x55')](_0x465870,{});})[_0xee9e('0x19')](function(){return addCmHopperPhones(_0x253086[_0xee9e('0x36')][_0xee9e('0x91')]);})[_0xee9e('0x19')](function(){return['ok'];})['then'](respondWithResult(_0x48c97f,null))['catch'](handleError(_0x48c97f,null));};exports[_0xee9e('0x92')]=function(_0x38dfe3,_0x415d8d){var _0x37b609=[];_0x37b609[_0xee9e('0x59')](createCmHopperPhone(_0x38dfe3[_0xee9e('0x36')]['id'],_0x38dfe3[_0xee9e('0x36')]['hopperId']));Promise[_0xee9e('0x5d')](_0x37b609)[_0xee9e('0x19')](function(){return[0x1];})[_0xee9e('0x19')](respondWithResult(_0x415d8d,null));};exports[_0xee9e('0x93')]=function(_0x5f0ad7,_0x4995a6){var _0x24e2ef={'raw':![],'where':{}};var _0x297bef={};var _0x8aa5d4={'count':0x0,'rows':[]};return db['CmContact'][_0xee9e('0x71')]({'where':{'id':_0x5f0ad7['params']['id']}})[_0xee9e('0x19')](handleEntityNotFound(_0x4995a6,null))[_0xee9e('0x19')](function(_0x24278d){if(_0x24278d){_0x297bef[_0xee9e('0x72')]=_[_0xee9e('0x53')](db['CmHopper']['rawAttributes']);_0x297bef['query']=_[_0xee9e('0x53')](_0x5f0ad7[_0xee9e('0x22')]);_0x297bef[_0xee9e('0x79')]=_[_0xee9e('0x74')](_0x297bef[_0xee9e('0x72')],_0x297bef['query']);_0x24e2ef[_0xee9e('0x75')]=_['intersection'](_0x297bef['model'],qs['fields'](_0x5f0ad7['query'][_0xee9e('0x76')]));_0x24e2ef[_0xee9e('0x75')]=_0x24e2ef[_0xee9e('0x75')][_0xee9e('0x29')]?_0x24e2ef[_0xee9e('0x75')]:_0x297bef[_0xee9e('0x72')];if(!_0x5f0ad7['query'][_0xee9e('0x34')](_0xee9e('0x94'))){_0x24e2ef[_0xee9e('0x15')]=qs[_0xee9e('0x15')](_0x5f0ad7[_0xee9e('0x22')][_0xee9e('0x15')]);_0x24e2ef['offset']=qs[_0xee9e('0x12')](_0x5f0ad7[_0xee9e('0x22')]['offset']);}_0x24e2ef[_0xee9e('0x77')]=qs[_0xee9e('0x78')](_0x5f0ad7['query']['sort']);_0x24e2ef[_0xee9e('0x5a')]=qs[_0xee9e('0x79')](_[_0xee9e('0x7a')](_0x5f0ad7[_0xee9e('0x22')],_0x297bef[_0xee9e('0x79')]));_0x24e2ef[_0xee9e('0x5a')][_0xee9e('0x95')]=_0x24278d['id'];if(_0x5f0ad7[_0xee9e('0x22')][_0xee9e('0x7b')]){_0x24e2ef['where']=_[_0xee9e('0x35')](_0x24e2ef['where'],{'$or':_[_0xee9e('0x67')](_0x24e2ef['attributes'],function(_0x5b5333){var _0x498f00={};_0x498f00[_0x5b5333]={'$like':'%'+_0x5f0ad7['query'][_0xee9e('0x7b')]+'%'};return _0x498f00;})});}_0x24e2ef=_[_0xee9e('0x35')]({},_0x24e2ef,_0x5f0ad7[_0xee9e('0x7c')]);return db['CmHopper']['count']({'where':_0x24e2ef['where']})[_0xee9e('0x19')](function(_0x51c3af){_0x8aa5d4[_0xee9e('0x14')]=_0x51c3af;if(_0x5f0ad7[_0xee9e('0x22')][_0xee9e('0x96')]){_0x24e2ef[_0xee9e('0x97')]=[{'all':!![]}];}return db[_0xee9e('0x3d')][_0xee9e('0x21')](_0x24e2ef);})[_0xee9e('0x19')](function(_0x1b33df){_0x8aa5d4[_0xee9e('0x98')]=_0x1b33df;return _0x8aa5d4;});}})['then'](respondWithFilteredResult(_0x4995a6,_0x24e2ef))[_0xee9e('0x24')](handleError(_0x4995a6,null));};exports[_0xee9e('0x99')]=function(_0x3aa0d1,_0x2c3f95){var _0x234724={'raw':!![],'where':{}};var _0x422b71={};var _0x18347d={'count':0x0,'rows':[]};return db['CmContact'][_0xee9e('0x71')]({'where':{'id':_0x3aa0d1[_0xee9e('0x27')]['id']}})[_0xee9e('0x19')](handleEntityNotFound(_0x2c3f95,null))[_0xee9e('0x19')](function(_0x229709){if(_0x229709){_0x422b71[_0xee9e('0x72')]=_[_0xee9e('0x53')](db['CmHopperHistory'][_0xee9e('0x73')]);_0x422b71[_0xee9e('0x22')]=_['keys'](_0x3aa0d1[_0xee9e('0x22')]);_0x422b71[_0xee9e('0x79')]=_[_0xee9e('0x74')](_0x422b71['model'],_0x422b71['query']);_0x234724[_0xee9e('0x75')]=_['intersection'](_0x422b71[_0xee9e('0x72')],qs['fields'](_0x3aa0d1[_0xee9e('0x22')][_0xee9e('0x76')]));_0x234724['attributes']=_0x234724[_0xee9e('0x75')][_0xee9e('0x29')]?_0x234724[_0xee9e('0x75')]:_0x422b71[_0xee9e('0x72')];if(!_0x3aa0d1[_0xee9e('0x22')]['hasOwnProperty']('nolimit')){_0x234724[_0xee9e('0x15')]=qs['limit'](_0x3aa0d1['query'][_0xee9e('0x15')]);_0x234724['offset']=qs[_0xee9e('0x12')](_0x3aa0d1[_0xee9e('0x22')][_0xee9e('0x12')]);}_0x234724[_0xee9e('0x77')]=qs[_0xee9e('0x78')](_0x3aa0d1['query']['sort']);_0x234724[_0xee9e('0x5a')]=qs[_0xee9e('0x79')](_[_0xee9e('0x7a')](_0x3aa0d1[_0xee9e('0x22')],_0x422b71[_0xee9e('0x79')]));_0x234724['where']['ContactId']=_0x229709['id'];if(_0x3aa0d1[_0xee9e('0x22')][_0xee9e('0x7b')]){_0x234724['where']=_[_0xee9e('0x35')](_0x234724['where'],{'$or':_[_0xee9e('0x67')](_0x234724[_0xee9e('0x75')],function(_0x430445){var _0x551b78={};_0x551b78[_0x430445]={'$like':'%'+_0x3aa0d1[_0xee9e('0x22')][_0xee9e('0x7b')]+'%'};return _0x551b78;})});}_0x234724=_['merge']({},_0x234724,_0x3aa0d1['options']);return db[_0xee9e('0x47')][_0xee9e('0x14')]({'where':_0x234724[_0xee9e('0x5a')]})[_0xee9e('0x19')](function(_0x44ea18){_0x18347d['count']=_0x44ea18;if(_0x3aa0d1[_0xee9e('0x22')][_0xee9e('0x96')]){_0x234724['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xee9e('0x21')](_0x234724);})[_0xee9e('0x19')](function(_0x8127e4){_0x18347d['rows']=_0x8127e4;return _0x18347d;});}})[_0xee9e('0x19')](respondWithFilteredResult(_0x2c3f95,_0x234724))['catch'](handleError(_0x2c3f95,null));};exports[_0xee9e('0x9a')]=function(_0x4c91f7,_0x23559b){var _0x55b39f={'raw':!![],'where':{}};var _0x33ba3f={};var _0x38b90f={'count':0x0,'rows':[]};return db[_0xee9e('0x25')][_0xee9e('0x71')]({'where':{'id':_0x4c91f7[_0xee9e('0x27')]['id']}})['then'](handleEntityNotFound(_0x23559b,null))[_0xee9e('0x19')](function(_0x89d3b5){if(_0x89d3b5){_0x33ba3f[_0xee9e('0x72')]=_[_0xee9e('0x53')](db['CmHopperFinal'][_0xee9e('0x73')]);_0x33ba3f[_0xee9e('0x22')]=_[_0xee9e('0x53')](_0x4c91f7[_0xee9e('0x22')]);_0x33ba3f[_0xee9e('0x79')]=_[_0xee9e('0x74')](_0x33ba3f[_0xee9e('0x72')],_0x33ba3f[_0xee9e('0x22')]);_0x55b39f[_0xee9e('0x75')]=_[_0xee9e('0x74')](_0x33ba3f[_0xee9e('0x72')],qs[_0xee9e('0x76')](_0x4c91f7['query'][_0xee9e('0x76')]));_0x55b39f[_0xee9e('0x75')]=_0x55b39f[_0xee9e('0x75')]['length']?_0x55b39f['attributes']:_0x33ba3f[_0xee9e('0x72')];if(!_0x4c91f7[_0xee9e('0x22')][_0xee9e('0x34')]('nolimit')){_0x55b39f['limit']=qs[_0xee9e('0x15')](_0x4c91f7[_0xee9e('0x22')][_0xee9e('0x15')]);_0x55b39f['offset']=qs['offset'](_0x4c91f7[_0xee9e('0x22')][_0xee9e('0x12')]);}_0x55b39f[_0xee9e('0x77')]=qs['sort'](_0x4c91f7[_0xee9e('0x22')][_0xee9e('0x78')]);_0x55b39f['where']=qs['filters'](_[_0xee9e('0x7a')](_0x4c91f7[_0xee9e('0x22')],_0x33ba3f['filters']));_0x55b39f[_0xee9e('0x5a')][_0xee9e('0x95')]=_0x89d3b5['id'];if(_0x4c91f7['query']['filter']){_0x55b39f[_0xee9e('0x5a')]=_[_0xee9e('0x35')](_0x55b39f[_0xee9e('0x5a')],{'$or':_[_0xee9e('0x67')](_0x55b39f[_0xee9e('0x75')],function(_0x263809){var _0xa35635={};_0xa35635[_0x263809]={'$like':'%'+_0x4c91f7['query'][_0xee9e('0x7b')]+'%'};return _0xa35635;})});}_0x55b39f=_[_0xee9e('0x35')]({},_0x55b39f,_0x4c91f7[_0xee9e('0x7c')]);return db[_0xee9e('0x46')]['count']({'where':_0x55b39f['where']})['then'](function(_0x2519b3){_0x38b90f[_0xee9e('0x14')]=_0x2519b3;if(_0x4c91f7[_0xee9e('0x22')][_0xee9e('0x96')]){_0x55b39f[_0xee9e('0x97')]=[{'all':!![]}];}return db[_0xee9e('0x46')]['findAll'](_0x55b39f);})[_0xee9e('0x19')](function(_0x49624d){_0x38b90f['rows']=_0x49624d;return _0x38b90f;});}})[_0xee9e('0x19')](respondWithFilteredResult(_0x23559b,_0x55b39f))[_0xee9e('0x24')](handleError(_0x23559b,null));};exports['getJscriptySessions']=function(_0x384f81,_0x3103f4){var _0xdb8686={'raw':!![],'where':{}};var _0x5277c9={};var _0x16d211={'count':0x0,'rows':[]};return db[_0xee9e('0x25')][_0xee9e('0x71')]({'where':{'id':_0x384f81[_0xee9e('0x27')]['id']}})['then'](handleEntityNotFound(_0x3103f4,null))[_0xee9e('0x19')](function(_0x11820a){if(_0x11820a){_0x5277c9[_0xee9e('0x72')]=_['keys'](db[_0xee9e('0x4c')]['rawAttributes']);_0x5277c9[_0xee9e('0x22')]=_[_0xee9e('0x53')](_0x384f81[_0xee9e('0x22')]);_0x5277c9[_0xee9e('0x79')]=_['intersection'](_0x5277c9[_0xee9e('0x72')],_0x5277c9[_0xee9e('0x22')]);_0xdb8686[_0xee9e('0x75')]=_[_0xee9e('0x74')](_0x5277c9[_0xee9e('0x72')],qs[_0xee9e('0x76')](_0x384f81[_0xee9e('0x22')]['fields']));_0xdb8686[_0xee9e('0x75')]=_0xdb8686[_0xee9e('0x75')]['length']?_0xdb8686[_0xee9e('0x75')]:_0x5277c9[_0xee9e('0x72')];if(!_0x384f81[_0xee9e('0x22')][_0xee9e('0x34')]('nolimit')){_0xdb8686['limit']=qs[_0xee9e('0x15')](_0x384f81[_0xee9e('0x22')]['limit']);_0xdb8686[_0xee9e('0x12')]=qs[_0xee9e('0x12')](_0x384f81['query'][_0xee9e('0x12')]);}_0xdb8686['order']=qs[_0xee9e('0x78')](_0x384f81[_0xee9e('0x22')][_0xee9e('0x78')]);_0xdb8686[_0xee9e('0x5a')]=qs[_0xee9e('0x79')](_[_0xee9e('0x7a')](_0x384f81[_0xee9e('0x22')],_0x5277c9['filters']));_0xdb8686['where']['ContactId']=_0x11820a['id'];if(_0x384f81['query'][_0xee9e('0x7b')]){_0xdb8686[_0xee9e('0x5a')]=_[_0xee9e('0x35')](_0xdb8686[_0xee9e('0x5a')],{'$or':_[_0xee9e('0x67')](_0xdb8686[_0xee9e('0x75')],function(_0x128214){var _0x4b8538={};_0x4b8538[_0x128214]={'$like':'%'+_0x384f81['query']['filter']+'%'};return _0x4b8538;})});}_0xdb8686=_[_0xee9e('0x35')]({},_0xdb8686,_0x384f81[_0xee9e('0x7c')]);return db[_0xee9e('0x4c')]['count']({'where':_0xdb8686[_0xee9e('0x5a')]})['then'](function(_0x2b3b2c){_0x16d211['count']=_0x2b3b2c;if(_0x384f81[_0xee9e('0x22')][_0xee9e('0x96')]){_0xdb8686[_0xee9e('0x97')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xee9e('0x21')](_0xdb8686);})[_0xee9e('0x19')](function(_0x652b68){_0x16d211[_0xee9e('0x98')]=_0x652b68;return _0x16d211;});}})[_0xee9e('0x19')](respondWithFilteredResult(_0x3103f4,_0xdb8686))['catch'](handleError(_0x3103f4,null));};exports[_0xee9e('0x9b')]=function(_0x509c94,_0x19d893){try{if(!_0x509c94[_0xee9e('0x36')][_0xee9e('0x65')]){throw new Error(_0xee9e('0x9c'));}if(!_0x509c94[_0xee9e('0x36')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x509c94[_0xee9e('0x36')][_0xee9e('0x9d')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x509c94[_0xee9e('0x36')][_0xee9e('0x9e')]){throw new Error(_0xee9e('0x9f'));}var _0x322ef2=_0x509c94['body']['binding_keys'][_0xee9e('0xa0')](',');var _0x435136=_0x509c94['body'][_0xee9e('0x9d')][_0xee9e('0xa0')](',');if(!_0x322ef2[_0xee9e('0x29')]||!_0x435136[_0xee9e('0x29')]||_0x322ef2['length']!==_0x435136[_0xee9e('0x29')]){throw new Error(_0xee9e('0xa1'));}_0x509c94['body']['fields']=_[_0xee9e('0xa2')](_0x322ef2,_0x435136);if(!_0x509c94[_0xee9e('0x36')][_0xee9e('0x76')]['phone']){throw new Error(_0xee9e('0xa3'));}if(!_0x509c94[_0xee9e('0x36')][_0xee9e('0x76')][_0xee9e('0xa4')]){throw new Error(_0xee9e('0xa5'));}var _0x162c96=path[_0xee9e('0x3b')](config[_0xee9e('0xa6')],_0xee9e('0xa7'),_0x509c94[_0xee9e('0xa8')][_0xee9e('0xa9')]);fs[_0xee9e('0xaa')](_0x162c96,parseInt(_0xee9e('0xab'),0x8));var _0x14e46a=require(_0xee9e('0xac'))[_0xee9e('0xad')](path[_0xee9e('0x3b')](__dirname,_0xee9e('0xae')),[_0x162c96,_0x509c94['body'][_0xee9e('0xaf')],_0x509c94['body']['binding_values'],_0x509c94['body']['ListId'],_0x509c94[_0xee9e('0x36')][_0xee9e('0xb0')],_0x509c94['body'][_0xee9e('0x57')],_0x509c94[_0xee9e('0x36')][_0xee9e('0x9e')]]);return _0x19d893[_0xee9e('0x10')](0xc8)[_0xee9e('0x11')]({'message':_0xee9e('0xb1'),'pid':_0x14e46a[_0xee9e('0xb2')]});}catch(_0x34d514){return _0x19d893['status'](0x1f4)[_0xee9e('0xb3')](_0x34d514);}};exports['upload']=function(_0x1f3dfd,_0x519532){var _0x4b6920=fs[_0xee9e('0xb4')](_0x1f3dfd[_0xee9e('0xa8')][_0xee9e('0x2')]);Papa[_0xee9e('0xb5')](_0x4b6920,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x57126b){return _0x519532['status'](0xc8)[_0xee9e('0x11')]({'file':_0x1f3dfd['file'],'fields':_0x57126b[_0xee9e('0xb6')]['fields']});}});};exports[_0xee9e('0xb7')]=function(_0x35a2ba,_0x4654b7){return db[_0xee9e('0xb8')][_0xee9e('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xee9e('0xb9')}})[_0xee9e('0x19')](function(_0xbc0817){var _0x4bd41f=![];if(!_0x35a2ba[_0xee9e('0x36')][_0xee9e('0x65')]){throw new Error('No\x20ListId\x20specified');}if(!_0x35a2ba[_0xee9e('0x36')][_0xee9e('0xba')][_0xee9e('0x83')]){throw new Error(_0xee9e('0xa3'));}if(!_0x35a2ba[_0xee9e('0x36')][_0xee9e('0xba')]['firstName']){throw new Error(_0xee9e('0xa5'));}if(!_0x35a2ba[_0xee9e('0x36')][_0xee9e('0x9e')]){throw new Error(_0xee9e('0x9f'));}var _0x3a15a6=require(_0xee9e('0xac'))[_0xee9e('0xad')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x35a2ba[_0xee9e('0x27')]['id'],JSON['stringify'](_0x35a2ba[_0xee9e('0x36')]),JSON[_0xee9e('0xbb')](_0xbc0817)]);_0x3a15a6['on'](_0xee9e('0xbc'),function(){_0x4bd41f=!![];return _0x4654b7['status'](0xc8)['json']({'message':_0xee9e('0xbd'),'pid':_0x3a15a6[_0xee9e('0xb2')]});});_0x3a15a6['on'](_0xee9e('0xbe'),function(_0x173f6f){if(_0x173f6f&&!_0x4bd41f){return _0x4654b7[_0xee9e('0x10')](0x1f4)[_0xee9e('0x11')]({'message':_0xee9e('0xbf'),'pid':_0x3a15a6[_0xee9e('0xb2')]});}});})[_0xee9e('0x24')](handleError(_0x4654b7,null));};exports['importUpdates']=function(_0x5741b4,_0x6c45b4){return db[_0xee9e('0xb8')][_0xee9e('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xee9e('0xb9')}})[_0xee9e('0x19')](function(_0xaf442f){var _0x1e4952=![];if(!_0x5741b4[_0xee9e('0x36')][_0xee9e('0x65')]){throw new Error(_0xee9e('0x9c'));}if(!_0x5741b4[_0xee9e('0x36')][_0xee9e('0xba')]['phone']){throw new Error(_0xee9e('0xa3'));}if(!_0x5741b4[_0xee9e('0x36')]['binding'][_0xee9e('0xa4')]){throw new Error(_0xee9e('0xa5'));}if(!_0x5741b4[_0xee9e('0x36')][_0xee9e('0x9e')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x496992=require(_0xee9e('0xac'))[_0xee9e('0xad')](path[_0xee9e('0x3b')](__dirname,_0xee9e('0xc0')),[_0x5741b4[_0xee9e('0x27')]['id'],JSON[_0xee9e('0xbb')](_0x5741b4['body']),JSON[_0xee9e('0xbb')](_0xaf442f)]);_0x496992['on'](_0xee9e('0xbc'),function(){_0x1e4952=!![];return _0x6c45b4[_0xee9e('0x10')](0xc8)['json']({'message':_0xee9e('0xbd'),'pid':_0x496992[_0xee9e('0xb2')]});});_0x496992['on'](_0xee9e('0xbe'),function(_0x503d0d){if(_0x503d0d&&!_0x1e4952){return _0x6c45b4['status'](0x1f4)[_0xee9e('0x11')]({'message':_0xee9e('0xbf'),'pid':_0x496992[_0xee9e('0xb2')]});}});})[_0xee9e('0x24')](handleError(_0x6c45b4,null));};exports[_0xee9e('0xc1')]=function(_0x3f907b,_0x1b8cbe){var _0x3c7242=[_0xee9e('0xc2'),_0xee9e('0xc3'),_0xee9e('0xc4'),'openchannel',_0xee9e('0xc5'),_0xee9e('0xc6'),'voice'];var _0x3c5a68={'offset':0x0,'order':qs[_0xee9e('0x78')](_0xee9e('0xc7'))},_0xe26c32={'count':0x0,'rows':[]};Promise['resolve']()[_0xee9e('0x19')](function(){if(_0x3f907b[_0xee9e('0x22')][_0xee9e('0xc8')]){if(!_[_0xee9e('0xc9')](_0x3c7242,_0x3f907b[_0xee9e('0x22')][_0xee9e('0xc8')][_0xee9e('0xca')]())){throw new Error(_0xee9e('0xcb'));}_0x3c7242=[_0x3f907b[_0xee9e('0x22')][_0xee9e('0xc8')]['toLowerCase']()];}if(_0x3f907b['query']['range']){try{var _0x5a0adc=JSON[_0xee9e('0xb5')](_0x3f907b[_0xee9e('0x22')][_0xee9e('0xcc')]);if(!moment(_0x5a0adc[_0xee9e('0x37')])[_0xee9e('0xcd')]()){throw new Error(_0xee9e('0xce'));}if(!moment(_0x5a0adc['to'])[_0xee9e('0xcd')]()){throw new Error(_0xee9e('0xcf'));}}catch(_0x590651){throw new Error(_0xee9e('0xd0'));}}if(!_0x3f907b['query'][_0xee9e('0x34')](_0xee9e('0x94'))){_0x3c5a68[_0xee9e('0x15')]=qs[_0xee9e('0x15')](_0x3f907b[_0xee9e('0x22')][_0xee9e('0x15')]||0xa);_0x3c5a68[_0xee9e('0x12')]=qs[_0xee9e('0x12')](_0x3f907b['query'][_0xee9e('0x12')]);}var _0x3dc346=_0x3c7242[_0xee9e('0x67')](function(_0x27cbab){if(_0x27cbab===_0xee9e('0xd1')){var _0x4d9817={'attributes':['id',_0xee9e('0xd2'),_0xee9e('0x2f'),_0xee9e('0xd3'),_0xee9e('0xd4'),'callerid','starttime','endtime','duration',_0xee9e('0xd5'),_0xee9e('0xd6'),_0xee9e('0xd7'),_0xee9e('0xd8'),_0xee9e('0xd9'),_0xee9e('0xda')],'where':{'ContactId':_0x3f907b[_0xee9e('0x27')]['id']},'include':[{'model':db[_0xee9e('0xb8')],'as':_0xee9e('0xb8'),'attributes':['id',_0xee9e('0x1e'),_0xee9e('0xdb'),_0xee9e('0x2e')]}],'order':[[_0xee9e('0xd6'),_0xee9e('0xdc')]]};if(_0x3f907b['query'][_0xee9e('0xcc')]){_0x4d9817['where'][_0xee9e('0xd6')]={'$gte':_0x5a0adc[_0xee9e('0x37')],'$lte':_0x5a0adc['to']};}return db[_0xee9e('0xdd')][_0xee9e('0xde')](_0x4d9817)['then'](function(_0x320649){_0xe26c32[_0xee9e('0x14')]+=_0x320649[_0xee9e('0x14')];return _[_0xee9e('0x67')](_0x320649[_0xee9e('0x98')],function(_0x2c537d){var _0x4eb53b=_0x2c537d[_0xee9e('0x38')]({'plain':!![]});_0x4eb53b[_0xee9e('0xc8')]=_0x27cbab;if(_0x4eb53b[_0xee9e('0xb8')]){_0x4eb53b[_0xee9e('0xb8')]={'id':_0x4eb53b[_0xee9e('0xb8')]['id'],'name':_0x4eb53b['User'][_0xee9e('0x1e')],'fullname':_0x4eb53b[_0xee9e('0xb8')][_0xee9e('0xdb')],'alias':_0x4eb53b['User'][_0xee9e('0x2e')]};}return _0x4eb53b;});});}else{var _0x30f1ec=_[_0xee9e('0xdf')](_0x27cbab)+(_0x27cbab===_0xee9e('0xc3')?_0xee9e('0xe0'):'Account');var _0x356d31={'attributes':['id',_0xee9e('0xe1'),'closedAt',_0xee9e('0xd6'),_0xee9e('0xd5'),_0xee9e('0xe2'),_0xee9e('0xe3'),_0xee9e('0xe4'),_0xee9e('0xda'),_0x30f1ec+'Id'],'where':{'ContactId':_0x3f907b[_0xee9e('0x27')]['id']},'include':[{'model':db[_0x30f1ec],'as':'Account','attributes':['id',_0xee9e('0x1e'),'key']},{'model':db[_0xee9e('0xb8')],'as':_0xee9e('0xe5'),'attributes':['id',_0xee9e('0x1e'),_0xee9e('0xdb')]},{'model':db[_0xee9e('0x5e')],'as':'Tags','attributes':['id',_0xee9e('0x1e'),_0xee9e('0x5f')],'through':{'attributes':[]}}],'order':[[_0xee9e('0xd6'),_0xee9e('0xdc')]]};if(_0x3f907b['query']['range']){_0x356d31['where'][_0xee9e('0xd6')]={'$gte':_0x5a0adc[_0xee9e('0x37')],'$lte':_0x5a0adc['to']};}switch(_0x27cbab){case _0xee9e('0xc3'):_0x356d31[_0xee9e('0x75')][_0xee9e('0x59')](_0xee9e('0xe6'),_0xee9e('0xe7'),'customerPort',_0xee9e('0xe8'),_0xee9e('0xe9'),_0xee9e('0xea'),_0xee9e('0xeb'),'ratingValue',_0xee9e('0xec'));break;case'mail':_0x356d31[_0xee9e('0x75')][_0xee9e('0x59')](_0xee9e('0xed'),_0xee9e('0xee'));break;case _0xee9e('0xef'):_0x356d31['attributes'][_0xee9e('0x59')](_0xee9e('0xf0'),_0xee9e('0xf1'));break;}return db[_[_0xee9e('0xdf')](_0x27cbab)+_0xee9e('0xf2')][_0xee9e('0xde')](_0x356d31)[_0xee9e('0x19')](function(_0x3b23b6){_0xe26c32[_0xee9e('0x14')]+=_0x3b23b6[_0xee9e('0x14')];return _[_0xee9e('0x67')](_0x3b23b6[_0xee9e('0x98')],function(_0x4eea7a){var _0x2ac1=_0x4eea7a[_0xee9e('0x38')]({'plain':!![]});_0x2ac1['channel']=_0x27cbab;if(_0x2ac1[_0xee9e('0xe5')]){_0x2ac1['Owner']={'id':_0x2ac1[_0xee9e('0xe5')]['id'],'name':_0x2ac1[_0xee9e('0xe5')][_0xee9e('0x1e')],'fullname':_0x2ac1[_0xee9e('0xe5')][_0xee9e('0xdb')]};}return _0x2ac1;});});}});return Promise[_0xee9e('0x5d')](_0x3dc346);})[_0xee9e('0x19')](function(_0x45f098){return _(_0x45f098)[_0xee9e('0xf3')]()[_0xee9e('0xf4')](_0xee9e('0xd6'))[_0xee9e('0xf5')]()[_0xee9e('0xf6')]();})['then'](function(_0x51d855){_0xe26c32[_0xee9e('0x98')]=_0x3c5a68['limit']?_0x51d855[_0xee9e('0xf7')](_0x3c5a68[_0xee9e('0x12')],_0x3c5a68[_0xee9e('0x12')]+_0x3c5a68[_0xee9e('0x15')]):_0x51d855;return _0xe26c32;})['then'](respondWithFilteredResult(_0x1b8cbe,_0x3c5a68))['catch'](handleError(_0x1b8cbe,null));}; \ No newline at end of file +var _0x3a87=['filters','intersection','fields','attributes','order','sort','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','count','include','rows','CmHopperHistory','pick','ContactId','includeAll','CmHopperFinal','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','createReadStream','parse','meta','import','User','agent','binding','firstName','No\x20firstName\x20column\x20specified','socket_timestamp','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','exit','getJourney','mail','chat','sms','fax','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','destination','starttime','endtime','duration','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','createdAt','DESC','startCase','Website','Account','closedAt','secondDisposition','thirdDisposition','key','Owner','Tags','browserName','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','findAndCountAll','flatten','reverse','value','slice','moment','util','path','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','redis','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','limit','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','describe','findAll','query','user','catch','destroy','find','params','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField','alias','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','ReportAgentPreview','VoiceCallReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','CmContact','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','push','all','Tag','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','format','map','isEmpty','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes'];(function(_0x4be687,_0xe630cc){var _0x42156f=function(_0x5ae44b){while(--_0x5ae44b){_0x4be687['push'](_0x4be687['shift']());}};_0x42156f(++_0xe630cc);}(_0x3a87,0x16c));var _0x73a8=function(_0x34b5ca,_0x594010){_0x34b5ca=_0x34b5ca-0x0;var _0x2d72c0=_0x3a87[_0x34b5ca];return _0x2d72c0;};'use strict';var moment=require(_0x73a8('0x0'));var BPromise=require('bluebird');var util=require(_0x73a8('0x1'));var path=require(_0x73a8('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x73a8('0x3'));var Papa=require('papaparse');var Redis=require(_0x73a8('0x4'));var contacts=require(_0x73a8('0x5'));var qs=require(_0x73a8('0x6'));var logger=require(_0x73a8('0x7'))(_0x73a8('0x8'));var config=require(_0x73a8('0x9'));var shared=require(_0x73a8('0xa'));var db=require(_0x73a8('0xb'))['db'];config['redis']=_[_0x73a8('0xc')](config[_0x73a8('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x73a8('0xe'))(new Redis(config[_0x73a8('0xd')]));require(_0x73a8('0xf'))['register'](socket);function respondWithResult(_0x87cf7a,_0x2a3daf){_0x2a3daf=_0x2a3daf||0xc8;return function(_0x4c66bd){if(_0x4c66bd){return _0x87cf7a[_0x73a8('0x10')](_0x2a3daf)[_0x73a8('0x11')](_0x4c66bd);}};}function respondWithFilteredResult(_0x22fde5,_0xff4dc7){return function(_0x166d29){if(_0x166d29){var _0x173241=typeof _0xff4dc7[_0x73a8('0x12')]===_0x73a8('0x13')&&typeof _0xff4dc7[_0x73a8('0x14')]===_0x73a8('0x13');var _0x4e43a7=_0x166d29['count'];var _0xd7852a=_0x173241?0x0:_0xff4dc7['offset'];var _0x7e7258=_0x173241?_0x166d29['count']:_0xff4dc7[_0x73a8('0x12')]+_0xff4dc7['limit'];var _0x41674b;if(_0x7e7258>=_0x4e43a7){_0x7e7258=_0x4e43a7;_0x41674b=0xc8;}else{_0x41674b=0xce;}_0x22fde5['status'](_0x41674b);return _0x22fde5[_0x73a8('0x15')](_0x73a8('0x16'),_0xd7852a+'-'+_0x7e7258+'/'+_0x4e43a7)[_0x73a8('0x11')](_0x166d29);}return null;};}function saveUpdates(_0x3a9608){return function(_0x3b59d0){if(_0x3b59d0){return _0x3b59d0[_0x73a8('0x17')](_0x3a9608)[_0x73a8('0x18')](function(_0x5e4715){return _0x5e4715;});}return null;};}function removeEntity(_0x1685c7){return function(_0x4ef770){if(_0x4ef770){return _0x4ef770['destroy']()[_0x73a8('0x18')](function(){_0x1685c7[_0x73a8('0x10')](0xcc)[_0x73a8('0x19')]();});}};}function handleEntityNotFound(_0x1e491e){return function(_0x2f0e83){if(!_0x2f0e83){_0x1e491e[_0x73a8('0x1a')](0x194);}return _0x2f0e83;};}function handleError(_0x30ba87,_0xb17f8b){_0xb17f8b=_0xb17f8b||0x1f4;return function(_0x5289d7){logger[_0x73a8('0x1b')](_0x5289d7[_0x73a8('0x1c')]);if(_0x5289d7[_0x73a8('0x1d')]){delete _0x5289d7[_0x73a8('0x1d')];}_0x30ba87['status'](_0xb17f8b)[_0x73a8('0x1e')](_0x5289d7);};}exports['index']=function(_0x43abc5,_0x27322d){var _0x57988f={};return contacts[_0x73a8('0x1f')]()[_0x73a8('0x18')](function(_0xee4442){_0x57988f=qs['getOptions'](_0xee4442,_0x43abc5);return contacts[_0x73a8('0x20')](_0x43abc5[_0x73a8('0x21')],_0x43abc5[_0x73a8('0x22')],_0x57988f,_0xee4442);})[_0x73a8('0x18')](respondWithFilteredResult(_0x27322d,_0x57988f))[_0x73a8('0x23')](handleError(_0x27322d,null));};exports[_0x73a8('0x24')]=function(_0x2b6dc5,_0x458162){return db['CmContact'][_0x73a8('0x25')]({'where':{'id':_0x2b6dc5[_0x73a8('0x26')]['id']}})['then'](handleEntityNotFound(_0x458162,null))[_0x73a8('0x18')](removeEntity(_0x458162,null))['catch'](handleError(_0x458162,null));};exports['describe']=function(_0x32139e,_0x25c674){return db['CmContact'][_0x73a8('0x1f')]()[_0x73a8('0x18')](function(_0x4f0654){delete _0x4f0654[_0x73a8('0x27')];for(var _0x54192e=0x0;_0x54192e0x0){return new Promise(function(_0x534bc1){var _0x1733cd=[];for(var _0x4dfbfc=0x0;_0x4dfbfc<_0x14366c[_0x73a8('0x29')];_0x4dfbfc++){_0x1733cd['push'](insertAdditionalPhones(_0x14366c[_0x4dfbfc]['contact'],_0x14366c[_0x4dfbfc][_0x73a8('0x58')]));}Promise[_0x73a8('0x60')](_0x1733cd)[_0x73a8('0x18')](function(){_0x534bc1(0x1);});})[_0x73a8('0x18')](function(){return{'success':_0x3f99a0,'failure':_0x31470d,'duplicates':_0x267fd6};});}else{return{'success':_0x3f99a0,'failure':_0x31470d,'duplicates':_0x267fd6};}}})[_0x73a8('0x18')](respondWithResult(_0x58bfb9,0xc9))[_0x73a8('0x23')](handleError(_0x58bfb9,null));};exports['show']=function(_0x20b02a,_0x3746f8){var _0x204dd3;return db[_0x73a8('0x53')]['describe']()[_0x73a8('0x18')](function(_0x475ef4){return db['CmContact'][_0x73a8('0x25')]({'where':{'id':_0x20b02a[_0x73a8('0x26')]['id']},'include':[{'model':db[_0x73a8('0x61')],'as':'Tags','attributes':['id',_0x73a8('0x1d'),_0x73a8('0x62')],'required':_0x20b02a['query'][_0x73a8('0x63')]?!![]:![]},{'model':db[_0x73a8('0x4c')],'as':_0x73a8('0x64'),'where':{'CmContactId':_0x20b02a[_0x73a8('0x26')]['id']},'required':![],'include':[{'model':db[_0x73a8('0x65')],'as':_0x73a8('0x66')}]}],'order':[db[_0x73a8('0x67')][_0x73a8('0x68')](_0x73a8('0x69'))],'attributes':_[_0x73a8('0x28')](_0x475ef4)});})['then'](function(_0x529973){if(!_['isNil'](_0x529973)){_0x204dd3=_0x529973[_0x73a8('0x38')]({'plain':!![]});var _0x23d033={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x529973&&_0x529973[_0x73a8('0x5e')]){if(_0x529973['ListId']){_0x23d033['where'][_0x73a8('0x6a')][_0x73a8('0x5f')]({'ListId':{'$ne':_0x529973[_0x73a8('0x5e')]}});}}return db['CmCustomField'][_0x73a8('0x20')](_0x23d033);}})[_0x73a8('0x18')](function(_0x5c75a5){if(!_[_0x73a8('0x54')](_0x5c75a5)){return _['omit'](_0x204dd3,_['map'](_0x5c75a5,function(_0x16c561){return util[_0x73a8('0x6b')]('cf_%d',_0x16c561['id']);}));}})[_0x73a8('0x18')](handleEntityNotFound(_0x3746f8,null))[_0x73a8('0x18')](respondWithResult(_0x3746f8,null))[_0x73a8('0x23')](handleError(_0x3746f8,null));};exports[_0x73a8('0x17')]=function(_0x2b20f2,_0x54ca72){var _0x29633a;if(_0x2b20f2[_0x73a8('0x37')]['id']){delete _0x2b20f2['body']['id'];}if(!_[_0x73a8('0x54')](_0x2b20f2['body']['dialTimezone'])){var _0x168947=_0x2b20f2[_0x73a8('0x37')][_0x73a8('0x55')];if(!_[_0x73a8('0x54')](shared[_0x73a8('0x56')][_0x168947]))_0x2b20f2[_0x73a8('0x37')][_0x73a8('0x57')]=shared['timezones'][_0x168947][_0x73a8('0x57')];}return db['CmContact'][_0x73a8('0x25')]({'where':{'id':_0x2b20f2['params']['id']}})[_0x73a8('0x18')](handleEntityNotFound(_0x54ca72,null))[_0x73a8('0x18')](saveUpdates(_0x2b20f2['body'],null))[_0x73a8('0x18')](function(_0x6e9715){_0x29633a=_0x6e9715;var _0x4ab330={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x6e9715&&_0x6e9715['ListId']){if(_0x6e9715[_0x73a8('0x5e')]){_0x4ab330[_0x73a8('0x5c')][_0x73a8('0x6a')][_0x73a8('0x5f')]({'ListId':{'$ne':_0x6e9715['ListId']}});}}return db[_0x73a8('0x2f')]['findAll'](_0x4ab330);})[_0x73a8('0x18')](function(_0x5a1ff7){if(_0x5a1ff7){return _['omit'](_['pickBy'](_0x2b20f2[_0x73a8('0x37')],function(_0x29a71e,_0x3d64a2){return _[_0x73a8('0x2a')](_0x3d64a2,'cf_');}),_[_0x73a8('0x6c')](_0x5a1ff7,function(_0x3afccc){return util[_0x73a8('0x6b')]('cf_%d',_0x3afccc['id']);}));}})[_0x73a8('0x18')](function(_0x187c77){if(_0x187c77&&!_[_0x73a8('0x6d')](_0x187c77)){var _0xb72df1=squel[_0x73a8('0x17')]()['table'](_0x73a8('0x6e'))[_0x73a8('0x6f')](_0x187c77)['where'](_0x73a8('0x70'),_0x2b20f2[_0x73a8('0x26')]['id'])[_0x73a8('0x71')]();return db[_0x73a8('0x67')][_0x73a8('0x21')](_0xb72df1[_0x73a8('0x72')],{'replacements':_0xb72df1['values']});}})[_0x73a8('0x18')](function(){if(_0x2b20f2[_0x73a8('0x37')][_0x73a8('0x73')]&&_0x29633a){return db[_0x73a8('0x3f')]['update']({'phone':_0x2b20f2[_0x73a8('0x37')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x29633a['id']}});}})[_0x73a8('0x18')](function(){return _0x29633a;})[_0x73a8('0x18')](respondWithResult(_0x54ca72,null))[_0x73a8('0x23')](handleError(_0x54ca72,null));};exports[_0x73a8('0x74')]=function(_0x2da00d,_0x202b27){var _0x24e2ce={};var _0xe71ba0={};var _0x268aeb;var _0x4f7665;return db[_0x73a8('0x53')][_0x73a8('0x75')]({'where':{'id':_0x2da00d[_0x73a8('0x26')]['id']}})['then'](handleEntityNotFound(_0x202b27,null))[_0x73a8('0x18')](function(_0x36201c){if(_0x36201c){_0x268aeb=_0x36201c;_0xe71ba0[_0x73a8('0x76')]=_[_0x73a8('0x28')](db[_0x73a8('0x61')][_0x73a8('0x77')]);_0xe71ba0[_0x73a8('0x21')]=_[_0x73a8('0x28')](_0x2da00d[_0x73a8('0x21')]);_0xe71ba0[_0x73a8('0x78')]=_[_0x73a8('0x79')](_0xe71ba0[_0x73a8('0x76')],_0xe71ba0[_0x73a8('0x21')]);_0x24e2ce['attributes']=_['intersection'](_0xe71ba0[_0x73a8('0x76')],qs[_0x73a8('0x7a')](_0x2da00d['query'][_0x73a8('0x7a')]));_0x24e2ce[_0x73a8('0x7b')]=_0x24e2ce[_0x73a8('0x7b')][_0x73a8('0x29')]?_0x24e2ce[_0x73a8('0x7b')]:_0xe71ba0[_0x73a8('0x76')];_0x24e2ce[_0x73a8('0x7c')]=qs[_0x73a8('0x7d')](_0x2da00d[_0x73a8('0x21')][_0x73a8('0x7d')]);_0x24e2ce['where']=qs['filters'](_['pick'](_0x2da00d[_0x73a8('0x21')],_0xe71ba0['filters']));if(_0x2da00d[_0x73a8('0x21')][_0x73a8('0x7e')]){_0x24e2ce[_0x73a8('0x5c')]=_['merge'](_0x24e2ce[_0x73a8('0x5c')],{'$or':_[_0x73a8('0x6c')](_0x24e2ce[_0x73a8('0x7b')],function(_0x416637){var _0x92248d={};_0x92248d[_0x416637]={'$like':'%'+_0x2da00d['query']['filter']+'%'};return _0x92248d;})});}_0x24e2ce=_[_0x73a8('0x36')]({},_0x24e2ce,_0x2da00d[_0x73a8('0x7f')]);return _0x268aeb[_0x73a8('0x74')](_0x24e2ce);}})[_0x73a8('0x18')](function(_0x98f803){if(_0x98f803){_0x4f7665=_0x98f803['length'];if(!_0x2da00d[_0x73a8('0x21')]['hasOwnProperty'](_0x73a8('0x80'))){_0x24e2ce['limit']=qs['limit'](_0x2da00d[_0x73a8('0x21')][_0x73a8('0x14')]);_0x24e2ce[_0x73a8('0x12')]=qs[_0x73a8('0x12')](_0x2da00d['query'][_0x73a8('0x12')]);}return _0x268aeb[_0x73a8('0x74')](_0x24e2ce);}})[_0x73a8('0x18')](function(_0x43b72b){if(_0x43b72b){return _0x43b72b?{'count':_0x4f7665,'rows':_0x43b72b}:null;}})['then'](respondWithResult(_0x202b27,null))[_0x73a8('0x23')](handleError(_0x202b27,null));};exports[_0x73a8('0x81')]=function(_0x20d4b5,_0x165b43){if(_0x20d4b5[_0x73a8('0x37')]['id']){delete _0x20d4b5[_0x73a8('0x37')]['id'];}return db['CmContact']['findOne']({'where':{'id':_0x20d4b5[_0x73a8('0x26')]['id']}})['then'](handleEntityNotFound(_0x165b43,null))[_0x73a8('0x18')](function(_0xd0219f){if(_0xd0219f){return _0xd0219f[_0x73a8('0x81')](_0x20d4b5[_0x73a8('0x37')][_0x73a8('0x82')]||[]);}return null;})[_0x73a8('0x18')](respondWithResult(_0x165b43,null))[_0x73a8('0x23')](handleError(_0x165b43,null));};exports[_0x73a8('0x83')]=function(_0x437c68,_0x227fec){var _0x597c5f=[];_0x597c5f[_0x73a8('0x5f')](addAdditionalPhones(_0x437c68[_0x73a8('0x37')]));Promise[_0x73a8('0x60')](_0x597c5f)[_0x73a8('0x18')](function(){_0x597c5f=[];_0x597c5f[_0x73a8('0x5f')](deleteCmHopperPhones(_0x437c68[_0x73a8('0x37')]['id']));_0x597c5f[_0x73a8('0x5f')](addCmHopperPhones(_0x437c68['body']['id']));Promise[_0x73a8('0x60')](_0x597c5f)[_0x73a8('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x227fec,null));});};function addAdditionalPhones(_0x1c8c03){var _0x34766d;return new Promise(function(_0x5b496e){return db[_0x73a8('0x4c')][_0x73a8('0x24')]({'where':{'CmContactId':_0x1c8c03['id']}})[_0x73a8('0x18')](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x73a8('0x84')]})[_0x73a8('0x18')](function(_0x2dad2a){var _0x367d30=[];for(var _0x13450c=0x0;_0x13450c<_0x1c8c03[_0x73a8('0x85')][_0x73a8('0x29')];_0x13450c++){var _0x4efb5f=_0x1c8c03[_0x73a8('0x86')]?_['isNil'](_0x1c8c03[_0x73a8('0x86')][_0x13450c])?'':_0x1c8c03[_0x73a8('0x86')][_0x13450c]:_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x87')]?_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x87')]:'';var _0x4d3e9d=_['isNil'](_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x88')])?'':_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x88')];var _0x1f89a9=_0x4efb5f+':'+_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x73')]+'§'+_0x4d3e9d;if(_[_0x73a8('0x54')](_0x34766d))_0x34766d=_0x1f89a9;else _0x34766d+=';'+_0x1f89a9;var _0x22c1b8=null;var _0x3b4f58=null;if(_0x1c8c03['item_types']){if(!_[_0x73a8('0x54')](_0x1c8c03[_0x73a8('0x86')][_0x13450c])){_0x3b4f58=_[_0x73a8('0x25')](_0x2dad2a,function(_0x2b6ed8){return _0x2b6ed8['id']===_0x1c8c03[_0x73a8('0x86')][_0x13450c];});if(!_['isNil'](_0x3b4f58)){_0x22c1b8=_0x3b4f58[_0x73a8('0x84')];}}}else{if(!_[_0x73a8('0x54')](_0x1c8c03[_0x73a8('0x85')][_0x13450c])){_0x3b4f58=_[_0x73a8('0x25')](_0x2dad2a,function(_0x321f88){return _0x321f88['id']===_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x87')];});if(!_[_0x73a8('0x54')](_0x3b4f58)){_0x22c1b8=_0x13450c;}}}if(_[_0x73a8('0x54')](_0x22c1b8)){_0x22c1b8=0x64;}_0x367d30[_0x73a8('0x5f')](addAdditionalPhone(_0x1c8c03['id'],_0x1c8c03[_0x73a8('0x85')][_0x13450c]['phone'],_0x1c8c03[_0x73a8('0x86')]?_['isNil'](_0x1c8c03['item_types'][_0x13450c])?null:_0x1c8c03['item_types'][_0x13450c]:_0x1c8c03['items'][_0x13450c][_0x73a8('0x87')]?_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x87')]:null,_0x22c1b8,_0x4d3e9d));}Promise['all'](_0x367d30)['then'](function(){db[_0x73a8('0x53')][_0x73a8('0x17')]({'AdditionalPhones':_0x34766d},{'where':{'id':_0x1c8c03['id']}})[_0x73a8('0x18')](function(){_0x5b496e(0x1);});});});});});}function addAdditionalPhone(_0x55c627,_0x82acbd,_0x13feee,_0x38fec3,_0x57aac0){return db[_0x73a8('0x4c')][_0x73a8('0x25')]({'where':{'CmContactId':_0x55c627,'item':_0x82acbd}})[_0x73a8('0x18')](function(_0x3c3c14){if(_0x3c3c14)logger['info'](_0x73a8('0x89'),_0x3c3c14);else{db[_0x73a8('0x4c')]['create']({'CmContactId':_0x55c627,'item':_0x82acbd,'ItemTypeId':_0x13feee,'OrderBy':_0x38fec3,'ItemClass':_0x73a8('0x8a'),'description':_0x57aac0});}});}function deleteCmHopperPhones(_0x261a06){return new Promise(function(_0x3836ee){return db[_0x73a8('0x3f')][_0x73a8('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x261a06}})[_0x73a8('0x18')](function(_0x358119){db[_0x73a8('0x8b')][_0x73a8('0x24')]({'where':{'CmHopperId':{'$in':_[_0x73a8('0x6c')](_0x358119,'id')}}});})[_0x73a8('0x18')](function(){_0x3836ee(0x1);});});}function addCmHopperPhones(_0x27ee98){return new Promise(function(_0x13fc00){return db[_0x73a8('0x3f')][_0x73a8('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x27ee98}})[_0x73a8('0x18')](function(_0x55294e){var _0x32be57=[];_[_0x73a8('0x6c')](_0x55294e,function(_0x2031ee){_0x32be57['push'](createCmHopperPhone(_0x27ee98,_0x2031ee['id']));});Promise['all'](_0x32be57)['then'](function(){_0x13fc00(0x1);});});});}function createCmHopperPhone(_0x4d6e59,_0x4fb8c3){return new Promise(function(_0x18e737){db[_0x73a8('0x4c')]['findAll']({'raw':!![],'attributes':['item',_0x73a8('0x84')],'where':{'CmContactId':_0x4d6e59,'ItemClass':_0x73a8('0x8a')},'include':[{'model':db[_0x73a8('0x65')],'attributes':[_0x73a8('0x84')],'as':_0x73a8('0x66')}],'order':[_0x73a8('0x84'),db[_0x73a8('0x67')][_0x73a8('0x68')](_0x73a8('0x8c'))]})[_0x73a8('0x18')](function(_0x37dd92){var _0x2d4122=0x1;var _0x4f3781=_[_0x73a8('0x6c')](_0x37dd92,function(_0x3e660b){_0x3e660b[_0x73a8('0x8d')]=_0x4fb8c3;_0x3e660b[_0x73a8('0x73')]=_0x3e660b[_0x73a8('0x8e')];_0x3e660b[_0x73a8('0x84')]=_0x2d4122;delete _0x3e660b[_0x73a8('0x8f')];_0x2d4122=_0x2d4122+0x1;return _0x3e660b;});return db[_0x73a8('0x8b')][_0x73a8('0x59')](_0x4f3781,{});})[_0x73a8('0x18')](function(){_0x18e737(0x1);});});}function insertAdditionalPhones(_0x4af98a,_0x5690c3){return new Promise(function(_0x43d1e0){var _0x3584ed=[];for(var _0x271a57=0x0;_0x271a57<_0x5690c3[_0x73a8('0x29')];_0x271a57++){var _0x1a7d92=_0x5690c3[_0x271a57];_0x3584ed['push'](parseContactItemType(_0x1a7d92));}Promise[_0x73a8('0x60')](_0x3584ed)['then'](function(){var _0x53865f={'id':_0x4af98a['id'],'items':_0x5690c3};return addAdditionalPhones(_0x53865f)[_0x73a8('0x18')](function(){return addCmHopperPhones(_0x4af98a['id']);});})[_0x73a8('0x18')](function(){_0x43d1e0(_0x4af98a);});});}function parseContactItemType(_0x24eb89){return new Promise(function(_0x170e4f){if(_0x24eb89[_0x73a8('0x35')]('ItemTypeId')){_0x170e4f(_0x24eb89);}else{return db[_0x73a8('0x65')][_0x73a8('0x25')]({'where':{'name':_0x24eb89['ItemType']}})['then'](function(_0x4645d3){if(_[_0x73a8('0x54')](_0x4645d3))_0x24eb89['ItemTypeId']=null;else _0x24eb89[_0x73a8('0x87')]=_0x4645d3['id'];_0x170e4f(_0x24eb89);});}});}exports[_0x73a8('0x90')]=function(_0xecb5ae,_0x1e7343){return db[_0x73a8('0x4c')]['findAll']({'raw':!![],'where':{'CmContactId':_0xecb5ae[_0x73a8('0x26')]['id'],'ItemClass':_0x73a8('0x8a')},'include':[{'model':db[_0x73a8('0x65')],'as':_0x73a8('0x66')}],'order':[['OrderBy'],[db['sequelize'][_0x73a8('0x68')](_0x73a8('0x8c'))]]})[_0x73a8('0x18')](function(_0x2aea98){return _0x2aea98;})[_0x73a8('0x18')](respondWithResult(_0x1e7343,null))[_0x73a8('0x23')](handleError(_0x1e7343,null));};exports['duplicateAdditionalPhones']=function(_0x53a0ea,_0x586ea9){return db[_0x73a8('0x4c')][_0x73a8('0x20')]({'raw':!![],'where':{'CmContactId':_0x53a0ea['body']['fromContactId']}})[_0x73a8('0x18')](function(_0x52032d){var _0x20e71a=_['map'](_0x52032d,function(_0x295169){_0x295169['CmContactId']=_0x53a0ea[_0x73a8('0x37')]['toContactId'];return _0x295169;});return db[_0x73a8('0x4c')]['bulkCreate'](_0x20e71a,{});})[_0x73a8('0x18')](function(){return addCmHopperPhones(_0x53a0ea[_0x73a8('0x37')][_0x73a8('0x91')]);})[_0x73a8('0x18')](function(){return['ok'];})[_0x73a8('0x18')](respondWithResult(_0x586ea9,null))[_0x73a8('0x23')](handleError(_0x586ea9,null));};exports[_0x73a8('0x92')]=function(_0x13da3c,_0x25e776){var _0x52a730=[];_0x52a730[_0x73a8('0x5f')](createCmHopperPhone(_0x13da3c[_0x73a8('0x37')]['id'],_0x13da3c[_0x73a8('0x37')][_0x73a8('0x93')]));Promise[_0x73a8('0x60')](_0x52a730)[_0x73a8('0x18')](function(){return[0x1];})[_0x73a8('0x18')](respondWithResult(_0x25e776,null));};exports[_0x73a8('0x94')]=function(_0x5622fd,_0x1e4123){var _0x41696e={'raw':![],'where':{}};var _0x486a1a={};var _0x3fdca2={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x5622fd[_0x73a8('0x26')]['id']}})['then'](handleEntityNotFound(_0x1e4123,null))[_0x73a8('0x18')](function(_0x43d331){if(_0x43d331){_0x486a1a['model']=_[_0x73a8('0x28')](db[_0x73a8('0x3f')][_0x73a8('0x77')]);_0x486a1a['query']=_[_0x73a8('0x28')](_0x5622fd[_0x73a8('0x21')]);_0x486a1a['filters']=_[_0x73a8('0x79')](_0x486a1a[_0x73a8('0x76')],_0x486a1a[_0x73a8('0x21')]);_0x41696e['attributes']=_[_0x73a8('0x79')](_0x486a1a[_0x73a8('0x76')],qs['fields'](_0x5622fd[_0x73a8('0x21')][_0x73a8('0x7a')]));_0x41696e[_0x73a8('0x7b')]=_0x41696e[_0x73a8('0x7b')][_0x73a8('0x29')]?_0x41696e[_0x73a8('0x7b')]:_0x486a1a[_0x73a8('0x76')];if(!_0x5622fd['query']['hasOwnProperty'](_0x73a8('0x80'))){_0x41696e[_0x73a8('0x14')]=qs['limit'](_0x5622fd[_0x73a8('0x21')][_0x73a8('0x14')]);_0x41696e[_0x73a8('0x12')]=qs[_0x73a8('0x12')](_0x5622fd[_0x73a8('0x21')]['offset']);}_0x41696e[_0x73a8('0x7c')]=qs['sort'](_0x5622fd[_0x73a8('0x21')][_0x73a8('0x7d')]);_0x41696e[_0x73a8('0x5c')]=qs[_0x73a8('0x78')](_['pick'](_0x5622fd[_0x73a8('0x21')],_0x486a1a[_0x73a8('0x78')]));_0x41696e[_0x73a8('0x5c')]['ContactId']=_0x43d331['id'];if(_0x5622fd[_0x73a8('0x21')][_0x73a8('0x7e')]){_0x41696e[_0x73a8('0x5c')]=_['merge'](_0x41696e[_0x73a8('0x5c')],{'$or':_[_0x73a8('0x6c')](_0x41696e[_0x73a8('0x7b')],function(_0x10d029){var _0x510830={};_0x510830[_0x10d029]={'$like':'%'+_0x5622fd[_0x73a8('0x21')][_0x73a8('0x7e')]+'%'};return _0x510830;})});}_0x41696e=_[_0x73a8('0x36')]({},_0x41696e,_0x5622fd[_0x73a8('0x7f')]);return db[_0x73a8('0x3f')]['count']({'where':_0x41696e[_0x73a8('0x5c')]})[_0x73a8('0x18')](function(_0x247364){_0x3fdca2[_0x73a8('0x95')]=_0x247364;if(_0x5622fd[_0x73a8('0x21')]['includeAll']){_0x41696e[_0x73a8('0x96')]=[{'all':!![]}];}return db[_0x73a8('0x3f')]['findAll'](_0x41696e);})[_0x73a8('0x18')](function(_0x3adf15){_0x3fdca2[_0x73a8('0x97')]=_0x3adf15;return _0x3fdca2;});}})[_0x73a8('0x18')](respondWithFilteredResult(_0x1e4123,_0x41696e))[_0x73a8('0x23')](handleError(_0x1e4123,null));};exports['getHopperHistories']=function(_0x4e4573,_0x52071a){var _0x5c36df={'raw':!![],'where':{}};var _0x32bbe1={};var _0x28f826={'count':0x0,'rows':[]};return db[_0x73a8('0x53')][_0x73a8('0x75')]({'where':{'id':_0x4e4573['params']['id']}})['then'](handleEntityNotFound(_0x52071a,null))['then'](function(_0x15ecb6){if(_0x15ecb6){_0x32bbe1[_0x73a8('0x76')]=_[_0x73a8('0x28')](db[_0x73a8('0x98')]['rawAttributes']);_0x32bbe1[_0x73a8('0x21')]=_[_0x73a8('0x28')](_0x4e4573[_0x73a8('0x21')]);_0x32bbe1[_0x73a8('0x78')]=_['intersection'](_0x32bbe1[_0x73a8('0x76')],_0x32bbe1[_0x73a8('0x21')]);_0x5c36df['attributes']=_['intersection'](_0x32bbe1[_0x73a8('0x76')],qs[_0x73a8('0x7a')](_0x4e4573['query'][_0x73a8('0x7a')]));_0x5c36df[_0x73a8('0x7b')]=_0x5c36df[_0x73a8('0x7b')][_0x73a8('0x29')]?_0x5c36df['attributes']:_0x32bbe1[_0x73a8('0x76')];if(!_0x4e4573[_0x73a8('0x21')][_0x73a8('0x35')](_0x73a8('0x80'))){_0x5c36df[_0x73a8('0x14')]=qs[_0x73a8('0x14')](_0x4e4573[_0x73a8('0x21')]['limit']);_0x5c36df[_0x73a8('0x12')]=qs[_0x73a8('0x12')](_0x4e4573[_0x73a8('0x21')][_0x73a8('0x12')]);}_0x5c36df['order']=qs[_0x73a8('0x7d')](_0x4e4573[_0x73a8('0x21')][_0x73a8('0x7d')]);_0x5c36df[_0x73a8('0x5c')]=qs['filters'](_[_0x73a8('0x99')](_0x4e4573[_0x73a8('0x21')],_0x32bbe1['filters']));_0x5c36df[_0x73a8('0x5c')][_0x73a8('0x9a')]=_0x15ecb6['id'];if(_0x4e4573['query'][_0x73a8('0x7e')]){_0x5c36df[_0x73a8('0x5c')]=_[_0x73a8('0x36')](_0x5c36df[_0x73a8('0x5c')],{'$or':_['map'](_0x5c36df[_0x73a8('0x7b')],function(_0x23cfa2){var _0x3ac8e8={};_0x3ac8e8[_0x23cfa2]={'$like':'%'+_0x4e4573[_0x73a8('0x21')][_0x73a8('0x7e')]+'%'};return _0x3ac8e8;})});}_0x5c36df=_['merge']({},_0x5c36df,_0x4e4573[_0x73a8('0x7f')]);return db[_0x73a8('0x98')]['count']({'where':_0x5c36df[_0x73a8('0x5c')]})[_0x73a8('0x18')](function(_0xa4e2fa){_0x28f826[_0x73a8('0x95')]=_0xa4e2fa;if(_0x4e4573[_0x73a8('0x21')][_0x73a8('0x9b')]){_0x5c36df[_0x73a8('0x96')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x73a8('0x20')](_0x5c36df);})[_0x73a8('0x18')](function(_0x41c2de){_0x28f826[_0x73a8('0x97')]=_0x41c2de;return _0x28f826;});}})['then'](respondWithFilteredResult(_0x52071a,_0x5c36df))[_0x73a8('0x23')](handleError(_0x52071a,null));};exports['getHopperFinals']=function(_0x420daf,_0x5c1b90){var _0x3a6f29={'raw':!![],'where':{}};var _0x448ad3={};var _0x124c24={'count':0x0,'rows':[]};return db[_0x73a8('0x53')][_0x73a8('0x75')]({'where':{'id':_0x420daf[_0x73a8('0x26')]['id']}})[_0x73a8('0x18')](handleEntityNotFound(_0x5c1b90,null))[_0x73a8('0x18')](function(_0x1206e8){if(_0x1206e8){_0x448ad3[_0x73a8('0x76')]=_[_0x73a8('0x28')](db[_0x73a8('0x9c')][_0x73a8('0x77')]);_0x448ad3[_0x73a8('0x21')]=_[_0x73a8('0x28')](_0x420daf[_0x73a8('0x21')]);_0x448ad3['filters']=_[_0x73a8('0x79')](_0x448ad3[_0x73a8('0x76')],_0x448ad3['query']);_0x3a6f29[_0x73a8('0x7b')]=_[_0x73a8('0x79')](_0x448ad3[_0x73a8('0x76')],qs[_0x73a8('0x7a')](_0x420daf[_0x73a8('0x21')][_0x73a8('0x7a')]));_0x3a6f29[_0x73a8('0x7b')]=_0x3a6f29[_0x73a8('0x7b')]['length']?_0x3a6f29[_0x73a8('0x7b')]:_0x448ad3[_0x73a8('0x76')];if(!_0x420daf[_0x73a8('0x21')][_0x73a8('0x35')](_0x73a8('0x80'))){_0x3a6f29[_0x73a8('0x14')]=qs[_0x73a8('0x14')](_0x420daf['query']['limit']);_0x3a6f29['offset']=qs[_0x73a8('0x12')](_0x420daf[_0x73a8('0x21')][_0x73a8('0x12')]);}_0x3a6f29[_0x73a8('0x7c')]=qs[_0x73a8('0x7d')](_0x420daf[_0x73a8('0x21')][_0x73a8('0x7d')]);_0x3a6f29['where']=qs['filters'](_['pick'](_0x420daf['query'],_0x448ad3[_0x73a8('0x78')]));_0x3a6f29['where']['ContactId']=_0x1206e8['id'];if(_0x420daf['query'][_0x73a8('0x7e')]){_0x3a6f29[_0x73a8('0x5c')]=_[_0x73a8('0x36')](_0x3a6f29['where'],{'$or':_[_0x73a8('0x6c')](_0x3a6f29[_0x73a8('0x7b')],function(_0x5846c6){var _0x4a8025={};_0x4a8025[_0x5846c6]={'$like':'%'+_0x420daf[_0x73a8('0x21')]['filter']+'%'};return _0x4a8025;})});}_0x3a6f29=_[_0x73a8('0x36')]({},_0x3a6f29,_0x420daf[_0x73a8('0x7f')]);return db[_0x73a8('0x9c')][_0x73a8('0x95')]({'where':_0x3a6f29[_0x73a8('0x5c')]})['then'](function(_0x35caf4){_0x124c24[_0x73a8('0x95')]=_0x35caf4;if(_0x420daf[_0x73a8('0x21')][_0x73a8('0x9b')]){_0x3a6f29[_0x73a8('0x96')]=[{'all':!![]}];}return db[_0x73a8('0x9c')][_0x73a8('0x20')](_0x3a6f29);})['then'](function(_0x272836){_0x124c24[_0x73a8('0x97')]=_0x272836;return _0x124c24;});}})[_0x73a8('0x18')](respondWithFilteredResult(_0x5c1b90,_0x3a6f29))[_0x73a8('0x23')](handleError(_0x5c1b90,null));};exports['getJscriptySessions']=function(_0x4cc153,_0x32bce9){var _0x45ab45={'raw':!![],'where':{}};var _0x4879d3={};var _0x4a43a0={'count':0x0,'rows':[]};return db[_0x73a8('0x53')][_0x73a8('0x75')]({'where':{'id':_0x4cc153['params']['id']}})['then'](handleEntityNotFound(_0x32bce9,null))['then'](function(_0x42fefd){if(_0x42fefd){_0x4879d3[_0x73a8('0x76')]=_[_0x73a8('0x28')](db[_0x73a8('0x51')][_0x73a8('0x77')]);_0x4879d3[_0x73a8('0x21')]=_[_0x73a8('0x28')](_0x4cc153['query']);_0x4879d3[_0x73a8('0x78')]=_[_0x73a8('0x79')](_0x4879d3[_0x73a8('0x76')],_0x4879d3[_0x73a8('0x21')]);_0x45ab45[_0x73a8('0x7b')]=_[_0x73a8('0x79')](_0x4879d3['model'],qs[_0x73a8('0x7a')](_0x4cc153[_0x73a8('0x21')][_0x73a8('0x7a')]));_0x45ab45['attributes']=_0x45ab45[_0x73a8('0x7b')][_0x73a8('0x29')]?_0x45ab45['attributes']:_0x4879d3[_0x73a8('0x76')];if(!_0x4cc153[_0x73a8('0x21')][_0x73a8('0x35')](_0x73a8('0x80'))){_0x45ab45['limit']=qs[_0x73a8('0x14')](_0x4cc153[_0x73a8('0x21')]['limit']);_0x45ab45[_0x73a8('0x12')]=qs[_0x73a8('0x12')](_0x4cc153[_0x73a8('0x21')][_0x73a8('0x12')]);}_0x45ab45[_0x73a8('0x7c')]=qs['sort'](_0x4cc153[_0x73a8('0x21')][_0x73a8('0x7d')]);_0x45ab45[_0x73a8('0x5c')]=qs[_0x73a8('0x78')](_[_0x73a8('0x99')](_0x4cc153[_0x73a8('0x21')],_0x4879d3[_0x73a8('0x78')]));_0x45ab45[_0x73a8('0x5c')][_0x73a8('0x9a')]=_0x42fefd['id'];if(_0x4cc153[_0x73a8('0x21')][_0x73a8('0x7e')]){_0x45ab45[_0x73a8('0x5c')]=_['merge'](_0x45ab45[_0x73a8('0x5c')],{'$or':_[_0x73a8('0x6c')](_0x45ab45[_0x73a8('0x7b')],function(_0x19210c){var _0x100499={};_0x100499[_0x19210c]={'$like':'%'+_0x4cc153[_0x73a8('0x21')][_0x73a8('0x7e')]+'%'};return _0x100499;})});}_0x45ab45=_[_0x73a8('0x36')]({},_0x45ab45,_0x4cc153[_0x73a8('0x7f')]);return db['JscriptySessionReport'][_0x73a8('0x95')]({'where':_0x45ab45['where']})[_0x73a8('0x18')](function(_0x1cbc45){_0x4a43a0[_0x73a8('0x95')]=_0x1cbc45;if(_0x4cc153[_0x73a8('0x21')][_0x73a8('0x9b')]){_0x45ab45[_0x73a8('0x96')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x73a8('0x20')](_0x45ab45);})[_0x73a8('0x18')](function(_0x3d0682){_0x4a43a0['rows']=_0x3d0682;return _0x4a43a0;});}})['then'](respondWithFilteredResult(_0x32bce9,_0x45ab45))[_0x73a8('0x23')](handleError(_0x32bce9,null));};exports[_0x73a8('0x9d')]=function(_0x3dd96d,_0x195253){try{if(!_0x3dd96d[_0x73a8('0x37')][_0x73a8('0x5e')]){throw new Error(_0x73a8('0x9e'));}if(!_0x3dd96d['body'][_0x73a8('0x9f')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x3dd96d[_0x73a8('0x37')]['binding_values']){throw new Error(_0x73a8('0xa0'));}if(!_0x3dd96d['body']['socket_timestamp']){throw new Error(_0x73a8('0xa1'));}var _0x361eb7=_0x3dd96d[_0x73a8('0x37')][_0x73a8('0x9f')][_0x73a8('0xa2')](',');var _0x3ed157=_0x3dd96d['body'][_0x73a8('0xa3')][_0x73a8('0xa2')](',');if(!_0x361eb7[_0x73a8('0x29')]||!_0x3ed157[_0x73a8('0x29')]||_0x361eb7[_0x73a8('0x29')]!==_0x3ed157[_0x73a8('0x29')]){throw new Error(_0x73a8('0xa4'));}_0x3dd96d['body'][_0x73a8('0x7a')]=_[_0x73a8('0xa5')](_0x361eb7,_0x3ed157);if(!_0x3dd96d[_0x73a8('0x37')]['fields']['phone']){throw new Error(_0x73a8('0xa6'));}if(!_0x3dd96d['body'][_0x73a8('0x7a')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x2d3e6c=path[_0x73a8('0x3b')](config[_0x73a8('0xa7')],_0x73a8('0xa8'),_0x3dd96d[_0x73a8('0xa9')]['filename']);fs[_0x73a8('0xaa')](_0x2d3e6c,parseInt(_0x73a8('0xab'),0x8));var _0x2b0e92=require(_0x73a8('0xac'))[_0x73a8('0xad')](path[_0x73a8('0x3b')](__dirname,_0x73a8('0xae')),[_0x2d3e6c,_0x3dd96d[_0x73a8('0x37')][_0x73a8('0x9f')],_0x3dd96d['body'][_0x73a8('0xa3')],_0x3dd96d[_0x73a8('0x37')][_0x73a8('0x5e')],_0x3dd96d[_0x73a8('0x37')][_0x73a8('0xaf')],_0x3dd96d['body']['duplicates'],_0x3dd96d['body']['socket_timestamp']]);return _0x195253[_0x73a8('0x10')](0xc8)[_0x73a8('0x11')]({'message':'File\x20uploaded\x20correctly!','pid':_0x2b0e92[_0x73a8('0xb0')]});}catch(_0x1bae01){return _0x195253[_0x73a8('0x10')](0x1f4)[_0x73a8('0x1e')](_0x1bae01);}};exports['upload']=function(_0x333058,_0x27bb57){var _0x51eeee=fs[_0x73a8('0xb1')](_0x333058[_0x73a8('0xa9')]['path']);Papa[_0x73a8('0xb2')](_0x51eeee,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x244c4f){return _0x27bb57[_0x73a8('0x10')](0xc8)[_0x73a8('0x11')]({'file':_0x333058[_0x73a8('0xa9')],'fields':_0x244c4f[_0x73a8('0xb3')][_0x73a8('0x7a')]});}});};exports[_0x73a8('0xb4')]=function(_0xdfae1f,_0x50a603){return db[_0x73a8('0xb5')][_0x73a8('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x73a8('0xb6')}})[_0x73a8('0x18')](function(_0x1ce5a6){var _0x8bfcf0=![];if(!_0xdfae1f[_0x73a8('0x37')][_0x73a8('0x5e')]){throw new Error(_0x73a8('0x9e'));}if(!_0xdfae1f[_0x73a8('0x37')][_0x73a8('0xb7')][_0x73a8('0x73')]){throw new Error(_0x73a8('0xa6'));}if(!_0xdfae1f[_0x73a8('0x37')][_0x73a8('0xb7')][_0x73a8('0xb8')]){throw new Error(_0x73a8('0xb9'));}if(!_0xdfae1f[_0x73a8('0x37')][_0x73a8('0xba')]){throw new Error(_0x73a8('0xa1'));}var _0x1c1312=require(_0x73a8('0xac'))[_0x73a8('0xad')](path[_0x73a8('0x3b')](__dirname,_0x73a8('0xbb')),[_0xdfae1f[_0x73a8('0x26')]['id'],JSON['stringify'](_0xdfae1f[_0x73a8('0x37')]),JSON[_0x73a8('0xbc')](_0x1ce5a6)]);_0x1c1312['on'](_0x73a8('0xbd'),function(){_0x8bfcf0=!![];return _0x50a603[_0x73a8('0x10')](0xc8)[_0x73a8('0x11')]({'message':_0x73a8('0xbe'),'pid':_0x1c1312[_0x73a8('0xb0')]});});_0x1c1312['on']('exit',function(_0x4b6dcf){if(_0x4b6dcf&&!_0x8bfcf0){return _0x50a603['status'](0x1f4)[_0x73a8('0x11')]({'message':_0x73a8('0xbf'),'pid':_0x1c1312[_0x73a8('0xb0')]});}});})[_0x73a8('0x23')](handleError(_0x50a603,null));};exports['importUpdates']=function(_0x2fcab3,_0x2e8bd2){return db[_0x73a8('0xb5')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x73a8('0xb6')}})[_0x73a8('0x18')](function(_0x42eeb4){var _0x350702=![];if(!_0x2fcab3['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x2fcab3[_0x73a8('0x37')][_0x73a8('0xb7')][_0x73a8('0x73')]){throw new Error(_0x73a8('0xa6'));}if(!_0x2fcab3['body'][_0x73a8('0xb7')][_0x73a8('0xb8')]){throw new Error(_0x73a8('0xb9'));}if(!_0x2fcab3[_0x73a8('0x37')][_0x73a8('0xba')]){throw new Error(_0x73a8('0xa1'));}var _0xa7b3dd=require(_0x73a8('0xac'))[_0x73a8('0xad')](path[_0x73a8('0x3b')](__dirname,'../../components/import/cm/csvUpdates'),[_0x2fcab3[_0x73a8('0x26')]['id'],JSON['stringify'](_0x2fcab3[_0x73a8('0x37')]),JSON[_0x73a8('0xbc')](_0x42eeb4)]);_0xa7b3dd['on'](_0x73a8('0xbd'),function(){_0x350702=!![];return _0x2e8bd2['status'](0xc8)[_0x73a8('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0xa7b3dd[_0x73a8('0xb0')]});});_0xa7b3dd['on'](_0x73a8('0xc0'),function(_0x5e2352){if(_0x5e2352&&!_0x350702){return _0x2e8bd2['status'](0x1f4)[_0x73a8('0x11')]({'message':_0x73a8('0xbf'),'pid':_0xa7b3dd[_0x73a8('0xb0')]});}});})[_0x73a8('0x23')](handleError(_0x2e8bd2,null));};exports[_0x73a8('0xc1')]=function(_0x31c3f2,_0x1e321b){var _0x3135b2=[_0x73a8('0xc2'),_0x73a8('0xc3'),_0x73a8('0xc4'),'openchannel',_0x73a8('0xc5'),'whatsapp','voice'];var _0x2c181d={'offset':0x0,'order':qs['sort']('-createdAt')},_0x2e54f7={'count':0x0,'rows':[]};Promise[_0x73a8('0xc6')]()[_0x73a8('0x18')](function(){if(_0x31c3f2[_0x73a8('0x21')][_0x73a8('0xc7')]){if(!_[_0x73a8('0xc8')](_0x3135b2,_0x31c3f2[_0x73a8('0x21')][_0x73a8('0xc7')][_0x73a8('0xc9')]())){throw new Error('Invalid\x20channel');}_0x3135b2=[_0x31c3f2[_0x73a8('0x21')]['channel'][_0x73a8('0xc9')]()];}if(_0x31c3f2[_0x73a8('0x21')][_0x73a8('0xca')]){try{var _0x4f0c25=JSON[_0x73a8('0xb2')](_0x31c3f2[_0x73a8('0x21')][_0x73a8('0xca')]);if(!moment(_0x4f0c25[_0x73a8('0x3e')])[_0x73a8('0xcb')]()){throw new Error(_0x73a8('0xcc'));}if(!moment(_0x4f0c25['to'])[_0x73a8('0xcb')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x36cec6){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x31c3f2[_0x73a8('0x21')]['hasOwnProperty']('nolimit')){_0x2c181d['limit']=qs[_0x73a8('0x14')](_0x31c3f2[_0x73a8('0x21')]['limit']||0xa);_0x2c181d[_0x73a8('0x12')]=qs['offset'](_0x31c3f2[_0x73a8('0x21')]['offset']);}var _0x139647=_0x3135b2[_0x73a8('0x6c')](function(_0x55502d){if(_0x55502d==='voice'){var _0x182daa={'attributes':['id','uniqueid','type','source',_0x73a8('0xcd'),'callerid',_0x73a8('0xce'),_0x73a8('0xcf'),_0x73a8('0xd0'),'note','createdAt',_0x73a8('0xd1'),_0x73a8('0xd2'),_0x73a8('0xd3'),_0x73a8('0xd4')],'where':{'ContactId':_0x31c3f2[_0x73a8('0x26')]['id']},'include':[{'model':db['User'],'as':_0x73a8('0xb5'),'attributes':['id',_0x73a8('0x1d'),_0x73a8('0xd5'),_0x73a8('0x30')]}],'order':[[_0x73a8('0xd6'),_0x73a8('0xd7')]]};if(_0x31c3f2['query'][_0x73a8('0xca')]){_0x182daa['where'][_0x73a8('0xd6')]={'$gte':_0x4f0c25[_0x73a8('0x3e')],'$lte':_0x4f0c25['to']};}return db[_0x73a8('0x4e')]['findAndCountAll'](_0x182daa)['then'](function(_0x2da42a){_0x2e54f7[_0x73a8('0x95')]+=_0x2da42a['count'];return _[_0x73a8('0x6c')](_0x2da42a[_0x73a8('0x97')],function(_0x5c09a9){var _0x2781f6=_0x5c09a9[_0x73a8('0x38')]({'plain':!![]});_0x2781f6[_0x73a8('0xc7')]=_0x55502d;if(_0x2781f6[_0x73a8('0xb5')]){_0x2781f6[_0x73a8('0xb5')]={'id':_0x2781f6[_0x73a8('0xb5')]['id'],'name':_0x2781f6[_0x73a8('0xb5')]['name'],'fullname':_0x2781f6[_0x73a8('0xb5')][_0x73a8('0xd5')],'alias':_0x2781f6[_0x73a8('0xb5')][_0x73a8('0x30')]};}return _0x2781f6;});});}else{var _0x527e79=_[_0x73a8('0xd8')](_0x55502d)+(_0x55502d==='chat'?_0x73a8('0xd9'):_0x73a8('0xda'));var _0x2659b8={'attributes':['id','closed',_0x73a8('0xdb'),_0x73a8('0xd6'),'note','disposition',_0x73a8('0xdc'),_0x73a8('0xdd'),_0x73a8('0xd4'),_0x527e79+'Id'],'where':{'ContactId':_0x31c3f2[_0x73a8('0x26')]['id']},'include':[{'model':db[_0x527e79],'as':'Account','attributes':['id',_0x73a8('0x1d'),_0x73a8('0xde')]},{'model':db[_0x73a8('0xb5')],'as':_0x73a8('0xdf'),'attributes':['id',_0x73a8('0x1d'),_0x73a8('0xd5')]},{'model':db['Tag'],'as':_0x73a8('0xe0'),'attributes':['id',_0x73a8('0x1d'),_0x73a8('0x62')],'through':{'attributes':[]}}],'order':[[_0x73a8('0xd6'),'DESC']]};if(_0x31c3f2[_0x73a8('0x21')]['range']){_0x2659b8[_0x73a8('0x5c')][_0x73a8('0xd6')]={'$gte':_0x4f0c25[_0x73a8('0x3e')],'$lte':_0x4f0c25['to']};}switch(_0x55502d){case _0x73a8('0xc3'):_0x2659b8['attributes'][_0x73a8('0x5f')](_0x73a8('0xe1'),'customerIp','customerPort',_0x73a8('0xe2'),'osName',_0x73a8('0xe3'),_0x73a8('0xe4'),_0x73a8('0xe5'),_0x73a8('0xe6'));break;case _0x73a8('0xc2'):_0x2659b8[_0x73a8('0x7b')][_0x73a8('0x5f')](_0x73a8('0xe7'),_0x73a8('0xe8'));break;case _0x73a8('0xe9'):_0x2659b8[_0x73a8('0x7b')][_0x73a8('0x5f')](_0x73a8('0xea'),_0x73a8('0xeb'));break;}return db[_[_0x73a8('0xd8')](_0x55502d)+_0x73a8('0xec')][_0x73a8('0xed')](_0x2659b8)['then'](function(_0x19bf0b){_0x2e54f7[_0x73a8('0x95')]+=_0x19bf0b[_0x73a8('0x95')];return _[_0x73a8('0x6c')](_0x19bf0b[_0x73a8('0x97')],function(_0x14c982){var _0x84623c=_0x14c982[_0x73a8('0x38')]({'plain':!![]});_0x84623c[_0x73a8('0xc7')]=_0x55502d;if(_0x84623c[_0x73a8('0xdf')]){_0x84623c[_0x73a8('0xdf')]={'id':_0x84623c['Owner']['id'],'name':_0x84623c[_0x73a8('0xdf')][_0x73a8('0x1d')],'fullname':_0x84623c['Owner'][_0x73a8('0xd5')]};}return _0x84623c;});});}});return Promise[_0x73a8('0x60')](_0x139647);})[_0x73a8('0x18')](function(_0x3ed1f8){return _(_0x3ed1f8)[_0x73a8('0xee')]()['sortBy'](_0x73a8('0xd6'))[_0x73a8('0xef')]()[_0x73a8('0xf0')]();})[_0x73a8('0x18')](function(_0x337691){_0x2e54f7[_0x73a8('0x97')]=_0x2c181d[_0x73a8('0x14')]?_0x337691[_0x73a8('0xf1')](_0x2c181d[_0x73a8('0x12')],_0x2c181d[_0x73a8('0x12')]+_0x2c181d[_0x73a8('0x14')]):_0x337691;return _0x2e54f7;})['then'](respondWithFilteredResult(_0x1e321b,_0x2c181d))[_0x73a8('0x23')](handleError(_0x1e321b,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 740fd4a..556b75b 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 _0x499a=['exports','events','../../mysqldb','CmContact','update','remove','emit','hasOwnProperty','hook'];(function(_0x549505,_0x4749b3){var _0x37787e=function(_0x15da0e){while(--_0x15da0e){_0x549505['push'](_0x549505['shift']());}};_0x37787e(++_0x4749b3);}(_0x499a,0xc7));var _0xa499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x499a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa499('0x0'));var CmContact=require(_0xa499('0x1'))['db'][_0xa499('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa499('0x3'),'afterDestroy':_0xa499('0x4')};function emitEvent(_0x41fc19){return function(_0x5cf486,_0x414563,_0x53ad6e){CmContactEvents[_0xa499('0x5')](_0x41fc19+':'+_0x5cf486['id'],_0x5cf486);CmContactEvents[_0xa499('0x5')](_0x41fc19,_0x5cf486);_0x53ad6e(null);};}for(var e in events){if(events[_0xa499('0x6')](e)){var event=events[e];CmContact[_0xa499('0x7')](e,emitEvent(event));}}module[_0xa499('0x8')]=CmContactEvents; \ No newline at end of file +var _0x3d03=['../../mysqldb','CmContact','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x59e7a0,_0x1e34b0){var _0xaa159d=function(_0x940a54){while(--_0x940a54){_0x59e7a0['push'](_0x59e7a0['shift']());}};_0xaa159d(++_0x1e34b0);}(_0x3d03,0x178));var _0x33d0=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x3d03[_0x20589d];return _0x422de9;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x33d0('0x0'))['db'][_0x33d0('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x33d0('0x2')](0x0);var events={'afterCreate':_0x33d0('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2d8e13){return function(_0x55f5c6,_0x2c814b,_0x6eca40){CmContactEvents[_0x33d0('0x4')](_0x2d8e13+':'+_0x55f5c6['id'],_0x55f5c6);CmContactEvents[_0x33d0('0x4')](_0x2d8e13,_0x55f5c6);_0x6eca40(null);};}for(var e in events){if(events[_0x33d0('0x5')](e)){var event=events[e];CmContact[_0x33d0('0x6')](e,emitEvent(event));}}module[_0x33d0('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index a287551..d47b57c 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 _0x5ec2=['./cmContact.attributes','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','findOne','then','timezones','dialTimezone','resolve','utcOffset','add','minutes','phone','priority','callbackUniqueid','assign','CmHopper','\x20in\x20Campaign\x20with\x20id\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','dialCheckDuplicateType','onlyIfOpen','findAll','CmList','Lists','map','all','Campaign','ListId','outbound','CmHopperBlack','BlackLists','exports','define','CmContact','cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','isEmpty','destroy','ContactId','push','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment'];(function(_0x5c029a,_0x1b9150){var _0x5048b4=function(_0xb3abdb){while(--_0xb3abdb){_0x5c029a['push'](_0x5c029a['shift']());}};_0x5048b4(++_0x1b9150);}(_0x5ec2,0x13c));var _0x25ec=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0x5ec2[_0x28e74e];return _0xb45ac1;};'use strict';var _=require(_0x25ec('0x0'));var util=require(_0x25ec('0x1'));var logger=require(_0x25ec('0x2'))('api');var moment=require(_0x25ec('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0x25ec('0x4'));function getTimezoneCallbackAt(_0x5be5bf,_0x5260da,_0xa6633d,_0x2f7a4c){var _0xd1eec6=_0x2f7a4c?'Campaign':_0x25ec('0x5');var _0x548693=_0xa6633d[_0x25ec('0x6')]?_0xa6633d[_0x25ec('0x6')]:moment()[_0x25ec('0x7')](_0x25ec('0x8'));if(_[_0x25ec('0x9')](_0xa6633d['dialTimezone'])){return Promise['resolve'](_0x548693);}return _0x5be5bf[_0xd1eec6][_0x25ec('0xa')]({'where':{'id':_0x5260da}})[_0x25ec('0xb')](function(_0x5183ad){if(_['isNil'](_0x5183ad)||_[_0x25ec('0x9')](_0x5183ad['dialTimezone'])){return Promise['resolve'](_0x548693);}var _0x31ebe9=shared[_0x25ec('0xc')];var _0x381cf3=_0x31ebe9[_0x5183ad['dialTimezone']];var _0x9e595d=_0x31ebe9[_0xa6633d[_0x25ec('0xd')]];if(_['isNil'](_0x381cf3)&&_[_0x25ec('0x9')](_0x9e595d)){return Promise[_0x25ec('0xe')](_0x548693);}var _0x1ceae0=_0x381cf3[_0x25ec('0xf')]-_0x9e595d[_0x25ec('0xf')];var _0x51727f=_0xa6633d[_0x25ec('0x6')]?_0xa6633d['scheduledat']:moment();_0x548693=moment(_0x51727f)[_0x25ec('0x10')](_0x1ceae0,_0x25ec('0x11'))['format'](_0x25ec('0x8'));return Promise[_0x25ec('0xe')](_0x548693);});}function getNewHopperPayload(_0x12f9f9){return{'phone':_0x12f9f9[_0x25ec('0x12')],'ContactId':_0x12f9f9['id'],'ListId':_0x12f9f9['ListId'],'scheduledat':_0x12f9f9['scheduledat']?_0x12f9f9[_0x25ec('0x6')]:moment()[_0x25ec('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x12f9f9[_0x25ec('0x13')]?_0x12f9f9[_0x25ec('0x13')]:0x2,'callback':_0x12f9f9[_0x25ec('0x14')]?!![]:![],'callbackuniqueid':_0x12f9f9[_0x25ec('0x14')]?_0x12f9f9[_0x25ec('0x14')]:undefined,'callbackat':_0x12f9f9['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x43d072,_0x3021e5,_0x54fc6c,_0x393c93){var _0x51bf6d={'phone':_0x54fc6c[_0x25ec('0x12')]};var _0x352246={'calleridnum':_0x54fc6c[_0x25ec('0x12')]};if(_0x393c93){Object[_0x25ec('0x15')](_0x51bf6d,{'CampaignId':_0x3021e5['id']});Object[_0x25ec('0x15')](_0x352246,{'CampaignId':_0x3021e5['id']});}else{Object[_0x25ec('0x15')](_0x51bf6d,{'VoiceQueueId':_0x3021e5['id']});Object['assign'](_0x352246,{'VoiceQueueId':_0x3021e5['id']});}return _0x43d072[_0x25ec('0x16')][_0x25ec('0xa')]({'where':_0x51bf6d})[_0x25ec('0xb')](function(_0xc88ef8){if(_0xc88ef8){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x54fc6c['phone']+_0x25ec('0x17')+_0x3021e5['id']);}return _0x43d072['CmHopperFinal']['findOne']({'where':_0x352246});})[_0x25ec('0xb')](function(_0x318304){if(_0x318304){throw new Error(_0x25ec('0x18')+_0x54fc6c['phone']+_0x25ec('0x17')+_0x3021e5['id']);}var _0x20fb3d=getNewHopperPayload(_0x54fc6c);if(_0x393c93){_0x20fb3d[_0x25ec('0x19')]=_0x3021e5['id'];}else{_0x20fb3d[_0x25ec('0x1a')]=_0x3021e5['id'];}return _0x43d072[_0x25ec('0x16')]['create'](_0x20fb3d);});}function handleOnlyIfOpenCheckDuplicate(_0x26b47f,_0x49ce70,_0x5b0a8a,_0x482e92){var _0x1c3b66={'phone':_0x5b0a8a[_0x25ec('0x12')]};if(_0x482e92){Object[_0x25ec('0x15')](_0x1c3b66,{'CampaignId':_0x49ce70['id']});}else{Object['assign'](_0x1c3b66,{'VoiceQueueId':_0x49ce70['id']});}return _0x26b47f[_0x25ec('0x16')][_0x25ec('0xa')]({'where':_0x1c3b66})[_0x25ec('0xb')](function(_0x1d7c8a){if(_0x1d7c8a){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x5b0a8a[_0x25ec('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x49ce70['id']);}var _0x3b93fe=getNewHopperPayload(_0x5b0a8a);if(_0x482e92){_0x3b93fe['CampaignId']=_0x49ce70['id'];}else{_0x3b93fe['VoiceQueueId']=_0x49ce70['id'];}return _0x26b47f[_0x25ec('0x16')][_0x25ec('0x1b')](_0x3b93fe);});}function handleNeverCheckDuplicate(_0x547540,_0x5c03e5,_0x230104){var _0x503cd4=getNewHopperPayload(_0x230104);_0x503cd4['VoiceQueueId']=_0x5c03e5['id'];return _0x547540['CmHopper'][_0x25ec('0x1b')](_0x503cd4);}function handleCheckDuplicate(_0x1c95a7,_0x390adf,_0x104d10,_0x531f7a){return getTimezoneCallbackAt(_0x1c95a7,_0x390adf,_0x104d10,_0x531f7a)['then'](function(_0x514600){_0x104d10[_0x25ec('0x6')]=_0x514600;switch(_0x390adf[_0x25ec('0x1c')]){case'always':return handleAlwaysCheckDuplicate(_0x1c95a7,_0x390adf,_0x104d10,_0x531f7a);case _0x25ec('0x1d'):return handleOnlyIfOpenCheckDuplicate(_0x1c95a7,_0x390adf,_0x104d10,_0x531f7a);default:return handleNeverCheckDuplicate(_0x1c95a7,_0x390adf,_0x104d10);}});}function createHopperForVoiceQueues(_0x49edee,_0x397228){return _0x49edee['VoiceQueue'][_0x25ec('0x1e')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0x25ec('0xd')],'include':[{'model':_0x49edee[_0x25ec('0x1f')],'as':_0x25ec('0x20'),'where':{'id':_0x397228['ListId']}}],'raw':!![]})[_0x25ec('0xb')](function(_0x548224){var _0x3a4be5=_0x548224[_0x25ec('0x21')](function(_0x31ce35){return handleCheckDuplicate(_0x49edee,_0x31ce35,_0x397228,![]);});return Promise[_0x25ec('0x22')](_0x3a4be5);});}function createHopperForCampaigns(_0x5ef762,_0x403c66){return _0x5ef762[_0x25ec('0x23')][_0x25ec('0x1e')]({'attributes':['id',_0x25ec('0x1c'),_0x25ec('0xd')],'include':[{'model':_0x5ef762[_0x25ec('0x1f')],'as':_0x25ec('0x20'),'where':{'id':_0x403c66[_0x25ec('0x24')]}}],'raw':!![]})[_0x25ec('0xb')](function(_0x140f24){var _0x3f8e9c=_0x140f24[_0x25ec('0x21')](function(_0x22a397){return handleCheckDuplicate(_0x5ef762,_0x22a397,_0x403c66,!![]);});return Promise[_0x25ec('0x22')](_0x3f8e9c);});}function createHopperBlackForVoiceQueues(_0x255979,_0x1aa2a8){return _0x255979['VoiceQueue']['findAll']({'where':{'type':_0x25ec('0x25')},'attributes':['id'],'include':[{'model':_0x255979['CmList'],'as':'BlackLists','where':{'id':_0x1aa2a8[_0x25ec('0x24')]}}],'raw':!![]})[_0x25ec('0xb')](function(_0x43408c){var _0x4c488d=_0x43408c[_0x25ec('0x21')](function(_0x4a0297){return _0x255979[_0x25ec('0x26')][_0x25ec('0x1b')]({'phone':_0x1aa2a8['phone'],'ContactId':_0x1aa2a8['id'],'ListId':_0x1aa2a8['ListId'],'VoiceQueueId':_0x4a0297['id']});});return Promise[_0x25ec('0x22')](_0x4c488d);});}function createHopperBlackForCampaigns(_0xda6b07,_0x3f0a54){return _0xda6b07[_0x25ec('0x23')]['findAll']({'attributes':['id'],'include':[{'model':_0xda6b07[_0x25ec('0x1f')],'as':_0x25ec('0x27'),'where':{'id':_0x3f0a54[_0x25ec('0x24')]}}],'raw':!![]})[_0x25ec('0xb')](function(_0x4774a){var _0x15ac52=_0x4774a['map'](function(_0xbf14f5){return _0xda6b07[_0x25ec('0x26')][_0x25ec('0x1b')]({'phone':_0x3f0a54[_0x25ec('0x12')],'ContactId':_0x3f0a54['id'],'ListId':_0x3f0a54[_0x25ec('0x24')],'CampaignId':_0xbf14f5['id']});});return Promise[_0x25ec('0x22')](_0x15ac52);});}module[_0x25ec('0x28')]=function(_0x46e470){return _0x46e470[_0x25ec('0x29')](_0x25ec('0x2a'),attributes,{'tableName':_0x25ec('0x2b'),'paranoid':!![],'indexes':[{'name':_0x25ec('0x12'),'fields':['phone']},{'name':'fti_cm_contacts','fields':[_0x25ec('0x2c'),'lastName',_0x25ec('0x12'),_0x25ec('0x2d'),_0x25ec('0x2e'),_0x25ec('0x2f')],'type':_0x25ec('0x30')}],'timestamps':!![],'charset':_0x25ec('0x31'),'collate':_0x25ec('0x32'),'hooks':{'afterCreate':function(_0x11e3f8,_0xacb77f,_0x4be31b){var _0x18262b=_0x46e470[_0x25ec('0x33')];var _0x4f996f=_0x11e3f8[_0x25ec('0x34')]({'plain':!![]});if(!_0x4f996f[_0x25ec('0x24')]){logger[_0x25ec('0x35')](_0x25ec('0x36')+_0x4f996f['id']);return _0x4be31b();}if(!_0x4f996f[_0x25ec('0x12')]){return _0x4be31b();}return createHopperForVoiceQueues(_0x18262b,_0x4f996f)[_0x25ec('0xb')](function(){return createHopperBlackForVoiceQueues(_0x18262b,_0x4f996f);})['then'](function(){return createHopperForCampaigns(_0x18262b,_0x4f996f);})[_0x25ec('0xb')](function(){return createHopperBlackForCampaigns(_0x18262b,_0x4f996f);})['then'](function(){return _0x4be31b();})[_0x25ec('0x37')](function(_0x2b4cc4){logger['error'](_0x25ec('0x38'),_0x2b4cc4[_0x25ec('0x39')]);_0x4be31b();});},'afterDestroy':function(_0x41b840,_0x47c8ba,_0x5f4086){var _0x407372=_0x46e470['models'];var _0x14919b=_0x41b840['get']({'plain':!![]});return _0x407372[_0x25ec('0x16')][_0x25ec('0x1e')]({'raw':!![],'where':{'ListId':_0x14919b[_0x25ec('0x24')],'ContactId':_0x14919b['id']}})[_0x25ec('0xb')](function(_0x3fac64){if(!_[_0x25ec('0x3a')](_0x3fac64)){var _0x58cf29=[];for(var _0x118fd0=0x0;_0x118fd0<_0x3fac64['length'];_0x118fd0+=0x1){var _0x25db0e=_0x407372['CmHopper'][_0x25ec('0x3b')]({'where':{'ListId':_0x3fac64[_0x118fd0][_0x25ec('0x24')],'ContactId':_0x3fac64[_0x118fd0][_0x25ec('0x3c')],'VoiceQueueId':_0x3fac64[_0x118fd0][_0x25ec('0x1a')],'CampaignId':_0x3fac64[_0x118fd0][_0x25ec('0x19')]}});_0x58cf29[_0x25ec('0x3d')](_0x25db0e);}return Promise[_0x25ec('0x22')](_0x58cf29);}})['then'](function(_0x1260a3){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x25ec('0x3e')](_0x1260a3,{'showHidden':![],'depth':null}));_0x5f4086();})['catch'](function(_0x5da54f){logger[_0x25ec('0x35')](_0x25ec('0x3f'),util[_0x25ec('0x3e')](_0x5da54f,{'showHidden':![],'depth':null}));_0x5f4086(_0x5da54f);});}}});}; \ No newline at end of file +var _0x7877=['utf8mb4','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','isEmpty','length','destroy','ContactId','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','api','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','isNil','dialTimezone','resolve','findOne','timezones','utcOffset','add','minutes','ListId','priority','callbackUniqueid','phone','assign','CmHopper','CmHopperFinal','then','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','VoiceQueueId','create','always','onlyIfOpen','outbound','dialCheckDuplicateType','CmList','Lists','map','findAll','all','CmHopperBlack','BlackLists','exports','CmContact','cm_contacts','fti_cm_contacts','firstName','mobile','fax','FULLTEXT'];(function(_0x2776ad,_0x5e26ed){var _0x378760=function(_0x10bb9f){while(--_0x10bb9f){_0x2776ad['push'](_0x2776ad['shift']());}};_0x378760(++_0x5e26ed);}(_0x7877,0x196));var _0x7787=function(_0x17598a,_0x522cc6){_0x17598a=_0x17598a-0x0;var _0x4cd046=_0x7877[_0x17598a];return _0x4cd046;};'use strict';var _=require(_0x7787('0x0'));var util=require(_0x7787('0x1'));var logger=require('../../config/logger')(_0x7787('0x2'));var moment=require('moment');var shared=require(_0x7787('0x3'));var attributes=require(_0x7787('0x4'));function getTimezoneCallbackAt(_0x362567,_0x267703,_0x220341,_0x40a2f8){var _0x184e78=_0x40a2f8?_0x7787('0x5'):_0x7787('0x6');var _0x4e35cc=_0x220341[_0x7787('0x7')]?_0x220341[_0x7787('0x7')]:moment()[_0x7787('0x8')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x7787('0x9')](_0x220341[_0x7787('0xa')])){return Promise[_0x7787('0xb')](_0x4e35cc);}return _0x362567[_0x184e78][_0x7787('0xc')]({'where':{'id':_0x267703}})['then'](function(_0x989f76){if(_[_0x7787('0x9')](_0x989f76)||_[_0x7787('0x9')](_0x989f76[_0x7787('0xa')])){return Promise[_0x7787('0xb')](_0x4e35cc);}var _0x43dd9a=shared[_0x7787('0xd')];var _0x4ee56f=_0x43dd9a[_0x989f76['dialTimezone']];var _0x50e0ea=_0x43dd9a[_0x220341['dialTimezone']];if(_[_0x7787('0x9')](_0x4ee56f)&&_['isNil'](_0x50e0ea)){return Promise[_0x7787('0xb')](_0x4e35cc);}var _0x2a2ed5=_0x4ee56f[_0x7787('0xe')]-_0x50e0ea[_0x7787('0xe')];var _0x3f774e=_0x220341[_0x7787('0x7')]?_0x220341['scheduledat']:moment();_0x4e35cc=moment(_0x3f774e)[_0x7787('0xf')](_0x2a2ed5,_0x7787('0x10'))[_0x7787('0x8')]('YYYY-MM-DD\x20HH:mm:ss');return Promise[_0x7787('0xb')](_0x4e35cc);});}function getNewHopperPayload(_0x270ffc){return{'phone':_0x270ffc['phone'],'ContactId':_0x270ffc['id'],'ListId':_0x270ffc[_0x7787('0x11')],'scheduledat':_0x270ffc[_0x7787('0x7')]?_0x270ffc[_0x7787('0x7')]:moment()[_0x7787('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x270ffc[_0x7787('0x12')]?_0x270ffc[_0x7787('0x12')]:0x2,'callback':_0x270ffc['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x270ffc[_0x7787('0x13')]?_0x270ffc[_0x7787('0x13')]:undefined,'callbackat':_0x270ffc[_0x7787('0x13')]?moment()[_0x7787('0x8')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0xe6fa6f,_0x2e2df6,_0x1d5664,_0x167f59){var _0x2a613d={'phone':_0x1d5664[_0x7787('0x14')]};var _0x46d864={'calleridnum':_0x1d5664[_0x7787('0x14')]};if(_0x167f59){Object[_0x7787('0x15')](_0x2a613d,{'CampaignId':_0x2e2df6['id']});Object[_0x7787('0x15')](_0x46d864,{'CampaignId':_0x2e2df6['id']});}else{Object[_0x7787('0x15')](_0x2a613d,{'VoiceQueueId':_0x2e2df6['id']});Object[_0x7787('0x15')](_0x46d864,{'VoiceQueueId':_0x2e2df6['id']});}return _0xe6fa6f[_0x7787('0x16')][_0x7787('0xc')]({'where':_0x2a613d})['then'](function(_0x266564){if(_0x266564){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x1d5664[_0x7787('0x14')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x2e2df6['id']);}return _0xe6fa6f[_0x7787('0x17')][_0x7787('0xc')]({'where':_0x46d864});})[_0x7787('0x18')](function(_0x7c578e){if(_0x7c578e){throw new Error(_0x7787('0x19')+_0x1d5664[_0x7787('0x14')]+_0x7787('0x1a')+_0x2e2df6['id']);}var _0x12b531=getNewHopperPayload(_0x1d5664);if(_0x167f59){_0x12b531[_0x7787('0x1b')]=_0x2e2df6['id'];}else{_0x12b531[_0x7787('0x1c')]=_0x2e2df6['id'];}return _0xe6fa6f['CmHopper'][_0x7787('0x1d')](_0x12b531);});}function handleOnlyIfOpenCheckDuplicate(_0xa77fa,_0x5e6ef0,_0x52482d,_0x2607fd){var _0xe38b8b={'phone':_0x52482d[_0x7787('0x14')]};if(_0x2607fd){Object['assign'](_0xe38b8b,{'CampaignId':_0x5e6ef0['id']});}else{Object[_0x7787('0x15')](_0xe38b8b,{'VoiceQueueId':_0x5e6ef0['id']});}return _0xa77fa['CmHopper']['findOne']({'where':_0xe38b8b})[_0x7787('0x18')](function(_0xebab32){if(_0xebab32){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x52482d['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0x5e6ef0['id']);}var _0x401dce=getNewHopperPayload(_0x52482d);if(_0x2607fd){_0x401dce[_0x7787('0x1b')]=_0x5e6ef0['id'];}else{_0x401dce[_0x7787('0x1c')]=_0x5e6ef0['id'];}return _0xa77fa[_0x7787('0x16')]['create'](_0x401dce);});}function handleNeverCheckDuplicate(_0x5d631f,_0x29e896,_0x574015){var _0x27b4f8=getNewHopperPayload(_0x574015);_0x27b4f8['VoiceQueueId']=_0x29e896['id'];return _0x5d631f['CmHopper'][_0x7787('0x1d')](_0x27b4f8);}function handleCheckDuplicate(_0x115775,_0xf151ce,_0x2ce8c6,_0x4dc74f){return getTimezoneCallbackAt(_0x115775,_0xf151ce,_0x2ce8c6,_0x4dc74f)[_0x7787('0x18')](function(_0x52db19){_0x2ce8c6[_0x7787('0x7')]=_0x52db19;switch(_0xf151ce['dialCheckDuplicateType']){case _0x7787('0x1e'):return handleAlwaysCheckDuplicate(_0x115775,_0xf151ce,_0x2ce8c6,_0x4dc74f);case _0x7787('0x1f'):return handleOnlyIfOpenCheckDuplicate(_0x115775,_0xf151ce,_0x2ce8c6,_0x4dc74f);default:return handleNeverCheckDuplicate(_0x115775,_0xf151ce,_0x2ce8c6);}});}function createHopperForVoiceQueues(_0x488df6,_0x156028){return _0x488df6[_0x7787('0x6')]['findAll']({'where':{'type':_0x7787('0x20')},'attributes':['id',_0x7787('0x21'),_0x7787('0xa')],'include':[{'model':_0x488df6[_0x7787('0x22')],'as':_0x7787('0x23'),'where':{'id':_0x156028[_0x7787('0x11')]}}],'raw':!![]})['then'](function(_0x4b661d){var _0x2c0d24=_0x4b661d[_0x7787('0x24')](function(_0x241dd5){return handleCheckDuplicate(_0x488df6,_0x241dd5,_0x156028,![]);});return Promise['all'](_0x2c0d24);});}function createHopperForCampaigns(_0x4c564a,_0x1ceef9){return _0x4c564a[_0x7787('0x5')][_0x7787('0x25')]({'attributes':['id',_0x7787('0x21'),_0x7787('0xa')],'include':[{'model':_0x4c564a[_0x7787('0x22')],'as':_0x7787('0x23'),'where':{'id':_0x1ceef9[_0x7787('0x11')]}}],'raw':!![]})[_0x7787('0x18')](function(_0x3c541a){var _0x11935e=_0x3c541a[_0x7787('0x24')](function(_0x3bb10b){return handleCheckDuplicate(_0x4c564a,_0x3bb10b,_0x1ceef9,!![]);});return Promise[_0x7787('0x26')](_0x11935e);});}function createHopperBlackForVoiceQueues(_0x183fb4,_0x1f5100){return _0x183fb4[_0x7787('0x6')]['findAll']({'where':{'type':_0x7787('0x20')},'attributes':['id'],'include':[{'model':_0x183fb4['CmList'],'as':'BlackLists','where':{'id':_0x1f5100[_0x7787('0x11')]}}],'raw':!![]})[_0x7787('0x18')](function(_0x253428){var _0x540236=_0x253428[_0x7787('0x24')](function(_0xb89be8){return _0x183fb4[_0x7787('0x27')][_0x7787('0x1d')]({'phone':_0x1f5100['phone'],'ContactId':_0x1f5100['id'],'ListId':_0x1f5100[_0x7787('0x11')],'VoiceQueueId':_0xb89be8['id']});});return Promise['all'](_0x540236);});}function createHopperBlackForCampaigns(_0x148385,_0x37fe22){return _0x148385[_0x7787('0x5')][_0x7787('0x25')]({'attributes':['id'],'include':[{'model':_0x148385['CmList'],'as':_0x7787('0x28'),'where':{'id':_0x37fe22['ListId']}}],'raw':!![]})[_0x7787('0x18')](function(_0x15e4d5){var _0x1984e4=_0x15e4d5[_0x7787('0x24')](function(_0x2650c3){return _0x148385['CmHopperBlack'][_0x7787('0x1d')]({'phone':_0x37fe22[_0x7787('0x14')],'ContactId':_0x37fe22['id'],'ListId':_0x37fe22['ListId'],'CampaignId':_0x2650c3['id']});});return Promise['all'](_0x1984e4);});}module[_0x7787('0x29')]=function(_0x4a1f47){return _0x4a1f47['define'](_0x7787('0x2a'),attributes,{'tableName':_0x7787('0x2b'),'paranoid':!![],'indexes':[{'name':_0x7787('0x14'),'fields':[_0x7787('0x14')]},{'name':_0x7787('0x2c'),'fields':[_0x7787('0x2d'),'lastName',_0x7787('0x14'),_0x7787('0x2e'),_0x7787('0x2f'),'email'],'type':_0x7787('0x30')}],'timestamps':!![],'charset':_0x7787('0x31'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x2a3dca,_0x130592,_0xb74671){var _0x452cb8=_0x4a1f47[_0x7787('0x32')];var _0x4f1a7c=_0x2a3dca[_0x7787('0x33')]({'plain':!![]});if(!_0x4f1a7c['ListId']){logger[_0x7787('0x34')](_0x7787('0x35')+_0x4f1a7c['id']);return _0xb74671();}if(!_0x4f1a7c[_0x7787('0x14')]){return _0xb74671();}return createHopperForVoiceQueues(_0x452cb8,_0x4f1a7c)[_0x7787('0x18')](function(){return createHopperBlackForVoiceQueues(_0x452cb8,_0x4f1a7c);})['then'](function(){return createHopperForCampaigns(_0x452cb8,_0x4f1a7c);})['then'](function(){return createHopperBlackForCampaigns(_0x452cb8,_0x4f1a7c);})['then'](function(){return _0xb74671();})[_0x7787('0x36')](function(_0x48c0ee){logger['error'](_0x7787('0x37'),_0x48c0ee[_0x7787('0x38')]);_0xb74671();});},'afterDestroy':function(_0x10796c,_0x3f2589,_0x3f32e1){var _0x59729f=_0x4a1f47['models'];var _0x59c859=_0x10796c[_0x7787('0x33')]({'plain':!![]});return _0x59729f[_0x7787('0x16')][_0x7787('0x25')]({'raw':!![],'where':{'ListId':_0x59c859[_0x7787('0x11')],'ContactId':_0x59c859['id']}})['then'](function(_0x1e60af){if(!_[_0x7787('0x39')](_0x1e60af)){var _0x261653=[];for(var _0x5baf3d=0x0;_0x5baf3d<_0x1e60af[_0x7787('0x3a')];_0x5baf3d+=0x1){var _0x2efc20=_0x59729f[_0x7787('0x16')][_0x7787('0x3b')]({'where':{'ListId':_0x1e60af[_0x5baf3d][_0x7787('0x11')],'ContactId':_0x1e60af[_0x5baf3d][_0x7787('0x3c')],'VoiceQueueId':_0x1e60af[_0x5baf3d][_0x7787('0x1c')],'CampaignId':_0x1e60af[_0x5baf3d][_0x7787('0x1b')]}});_0x261653['push'](_0x2efc20);}return Promise[_0x7787('0x26')](_0x261653);}})[_0x7787('0x18')](function(_0x1df2d8){logger[_0x7787('0x3d')](_0x7787('0x3e'),util[_0x7787('0x3f')](_0x1df2d8,{'showHidden':![],'depth':null}));_0x3f32e1();})[_0x7787('0x36')](function(_0x1f7a10){logger[_0x7787('0x34')](_0x7787('0x40'),util['inspect'](_0x1f7a10,{'showHidden':![],'depth':null}));_0x3f32e1(_0x1f7a10);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 27120e7..e049b0f 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x623f89,_0x5b3caa){var _0x5adbec=function(_0xfc1493){while(--_0xfc1493){_0x623f89['push'](_0x623f89['shift']());}};_0x5adbec(++_0x5b3caa);}(_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 d0dd7d1..0bb81e3 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 _0x1bca=['PHONE','STRING','exports','INTEGER'];(function(_0x11c577,_0x3de68b){var _0x369617=function(_0x13f187){while(--_0x13f187){_0x11c577['push'](_0x11c577['shift']());}};_0x369617(++_0x3de68b);}(_0x1bca,0xb6));var _0xa1bc=function(_0x52b05a,_0x1607be){_0x52b05a=_0x52b05a-0x0;var _0x21b3cb=_0x1bca[_0x52b05a];return _0x21b3cb;};'use strict';var Sequelize=require('sequelize');module[_0xa1bc('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa1bc('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xa1bc('0x2')},'OrderBy':{'type':Sequelize[_0xa1bc('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xa1bc('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x4fdc=['exports','STRING','INTEGER'];(function(_0x1c72ac,_0x380a0e){var _0x274e46=function(_0x1bbadf){while(--_0x1bbadf){_0x1c72ac['push'](_0x1c72ac['shift']());}};_0x274e46(++_0x380a0e);}(_0x4fdc,0x84));var _0xc4fd=function(_0x4c8f60,_0xe1f0a4){_0x4c8f60=_0x4c8f60-0x0;var _0x3783b2=_0x4fdc[_0x4c8f60];return _0x3783b2;};'use strict';var Sequelize=require('sequelize');module[_0xc4fd('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xc4fd('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc4fd('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc4fd('0x1')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xc4fd('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xc4fd('0x1')],'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 b688738..fea9f72 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 _0x9e12=['hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','end','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x9e12,0x116));var _0x29e1=function(_0x5b9fc7,_0x1c2f66){_0x5b9fc7=_0x5b9fc7-0x0;var _0x38751a=_0x9e12[_0x5b9fc7];return _0x38751a;};'use strict';var emlformat=require(_0x29e1('0x0'));var rimraf=require(_0x29e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29e1('0x2'));var rp=require(_0x29e1('0x3'));var moment=require(_0x29e1('0x4'));var BPromise=require(_0x29e1('0x5'));var Mustache=require(_0x29e1('0x6'));var util=require(_0x29e1('0x7'));var path=require(_0x29e1('0x8'));var sox=require('sox');var csv=require(_0x29e1('0x9'));var ejs=require(_0x29e1('0xa'));var fs=require('fs');var fs_extra=require(_0x29e1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x29e1('0xc'));var jsforce=require(_0x29e1('0xd'));var deskjs=require(_0x29e1('0xe'));var toCsv=require(_0x29e1('0x9'));var querystring=require('querystring');var Papa=require(_0x29e1('0xf'));var Redis=require(_0x29e1('0x10'));var authService=require(_0x29e1('0x11'));var qs=require(_0x29e1('0x12'));var as=require(_0x29e1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29e1('0x14'))('api');var utils=require(_0x29e1('0x15'));var config=require(_0x29e1('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e40da,_0xc5045c){_0xc5045c=_0xc5045c||0xcc;return function(_0x16bd13){if(_0x16bd13){return _0x4e40da[_0x29e1('0x17')](_0xc5045c);}return _0x4e40da[_0x29e1('0x18')](_0xc5045c)['end']();};}function respondWithResult(_0x3ce462,_0x5ed5df){_0x5ed5df=_0x5ed5df||0xc8;return function(_0x2d41c9){if(_0x2d41c9){return _0x3ce462[_0x29e1('0x18')](_0x5ed5df)[_0x29e1('0x19')](_0x2d41c9);}};}function respondWithFilteredResult(_0x179083,_0x11ebe3){return function(_0x317f70){if(_0x317f70){var _0x3aef86=typeof _0x11ebe3[_0x29e1('0x1a')]===_0x29e1('0x1b')&&typeof _0x11ebe3['limit']===_0x29e1('0x1b');var _0x1e6086=_0x317f70[_0x29e1('0x1c')];var _0x46b696=_0x3aef86?0x0:_0x11ebe3[_0x29e1('0x1a')];var _0x8fb71d=_0x3aef86?_0x317f70[_0x29e1('0x1c')]:_0x11ebe3[_0x29e1('0x1a')]+_0x11ebe3['limit'];var _0x1163c2;if(_0x8fb71d>=_0x1e6086){_0x8fb71d=_0x1e6086;_0x1163c2=0xc8;}else{_0x1163c2=0xce;}_0x179083[_0x29e1('0x18')](_0x1163c2);return _0x179083[_0x29e1('0x1d')](_0x29e1('0x1e'),_0x46b696+'-'+_0x8fb71d+'/'+_0x1e6086)[_0x29e1('0x19')](_0x317f70);}return null;};}function patchUpdates(_0x385a06){return function(_0x254f4f){try{jsonpatch[_0x29e1('0x1f')](_0x254f4f,_0x385a06,!![]);}catch(_0x35ad7e){return BPromise[_0x29e1('0x20')](_0x35ad7e);}return _0x254f4f[_0x29e1('0x21')]();};}function saveUpdates(_0x39c541,_0x4115db){return function(_0x47fa99){if(_0x47fa99){return _0x47fa99[_0x29e1('0x22')](_0x39c541)['then'](function(_0x1bc02e){return _0x1bc02e;});}return null;};}function removeEntity(_0x3c06d4,_0x31880b){return function(_0x202e03){if(_0x202e03){return _0x202e03[_0x29e1('0x23')]()[_0x29e1('0x24')](function(){var _0x3f310f=_0x202e03[_0x29e1('0x25')]({'plain':!![]});var _0x25b3e3='CmContactHasItems';return db['UserProfileResource'][_0x29e1('0x23')]({'where':{'type':_0x25b3e3,'resourceId':_0x3f310f['id']}})[_0x29e1('0x24')](function(){return _0x202e03;});})[_0x29e1('0x24')](function(){_0x3c06d4['status'](0xcc)[_0x29e1('0x26')]();});}};}function handleEntityNotFound(_0x3c9279,_0x5ee628){return function(_0x5d03b6){if(!_0x5d03b6){_0x3c9279[_0x29e1('0x17')](0x194);}return _0x5d03b6;};}function handleError(_0x527e05,_0xee331){_0xee331=_0xee331||0x1f4;return function(_0x5dd0c5){logger['error'](_0x5dd0c5[_0x29e1('0x27')]);if(_0x5dd0c5[_0x29e1('0x28')]){delete _0x5dd0c5['name'];}_0x527e05[_0x29e1('0x18')](_0xee331)[_0x29e1('0x29')](_0x5dd0c5);};}exports['index']=function(_0xeabe37,_0x37669f){var _0x37d4f4={},_0x107dad={},_0x3da886={'count':0x0,'rows':[]};var _0x26f973=_[_0x29e1('0x2a')](db[_0x29e1('0x2b')][_0x29e1('0x2c')],function(_0x416809){return{'name':_0x416809[_0x29e1('0x2d')],'type':_0x416809[_0x29e1('0x2e')]['key']};});_0x107dad[_0x29e1('0x2f')]=_['map'](_0x26f973,_0x29e1('0x28'));_0x107dad[_0x29e1('0x30')]=_[_0x29e1('0x31')](_0xeabe37[_0x29e1('0x30')]);_0x107dad[_0x29e1('0x32')]=_['intersection'](_0x107dad[_0x29e1('0x2f')],_0x107dad['query']);_0x37d4f4[_0x29e1('0x33')]=_['intersection'](_0x107dad[_0x29e1('0x2f')],qs[_0x29e1('0x34')](_0xeabe37[_0x29e1('0x30')]['fields']));_0x37d4f4[_0x29e1('0x33')]=_0x37d4f4[_0x29e1('0x33')][_0x29e1('0x35')]?_0x37d4f4[_0x29e1('0x33')]:_0x107dad[_0x29e1('0x2f')];if(!_0xeabe37['query'][_0x29e1('0x36')](_0x29e1('0x37'))){_0x37d4f4['limit']=qs[_0x29e1('0x38')](_0xeabe37[_0x29e1('0x30')][_0x29e1('0x38')]);_0x37d4f4['offset']=qs[_0x29e1('0x1a')](_0xeabe37[_0x29e1('0x30')][_0x29e1('0x1a')]);}_0x37d4f4['order']=qs[_0x29e1('0x39')](_0xeabe37[_0x29e1('0x30')]['sort']);_0x37d4f4[_0x29e1('0x3a')]=qs[_0x29e1('0x32')](_['pick'](_0xeabe37[_0x29e1('0x30')],_0x107dad[_0x29e1('0x32')]),_0x26f973);if(_0xeabe37[_0x29e1('0x30')][_0x29e1('0x3b')]){_0x37d4f4[_0x29e1('0x3a')]=_['merge'](_0x37d4f4[_0x29e1('0x3a')],{'$or':_[_0x29e1('0x2a')](_0x26f973,function(_0x29d1ef){if(_0x29d1ef[_0x29e1('0x2e')]!==_0x29e1('0x3c')){var _0x5043f6={};_0x5043f6[_0x29d1ef[_0x29e1('0x28')]]={'$like':'%'+_0xeabe37[_0x29e1('0x30')][_0x29e1('0x3b')]+'%'};return _0x5043f6;}})});}_0x37d4f4=_[_0x29e1('0x3d')]({},_0x37d4f4,_0xeabe37[_0x29e1('0x3e')]);var _0x359e0b={'where':_0x37d4f4['where']};return db[_0x29e1('0x2b')][_0x29e1('0x1c')](_0x359e0b)[_0x29e1('0x24')](function(_0x194428){_0x3da886[_0x29e1('0x1c')]=_0x194428;if(_0xeabe37[_0x29e1('0x30')][_0x29e1('0x3f')]){_0x37d4f4[_0x29e1('0x40')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x29e1('0x41')](_0x37d4f4);})[_0x29e1('0x24')](function(_0xf586e2){_0x3da886[_0x29e1('0x42')]=_0xf586e2;return _0x3da886;})['then'](respondWithFilteredResult(_0x37669f,_0x37d4f4))[_0x29e1('0x43')](handleError(_0x37669f,null));};exports[_0x29e1('0x44')]=function(_0xc2df0f,_0x500223){var _0x412abf={'raw':!![],'where':{'id':_0xc2df0f[_0x29e1('0x45')]['id']}},_0x58be17={};_0x58be17[_0x29e1('0x2f')]=_['keys'](db['CmContactHasItem'][_0x29e1('0x2c')]);_0x58be17['query']=_[_0x29e1('0x31')](_0xc2df0f[_0x29e1('0x30')]);_0x58be17[_0x29e1('0x32')]=_[_0x29e1('0x46')](_0x58be17['model'],_0x58be17[_0x29e1('0x30')]);_0x412abf[_0x29e1('0x33')]=_[_0x29e1('0x46')](_0x58be17[_0x29e1('0x2f')],qs[_0x29e1('0x34')](_0xc2df0f['query'][_0x29e1('0x34')]));_0x412abf['attributes']=_0x412abf[_0x29e1('0x33')][_0x29e1('0x35')]?_0x412abf[_0x29e1('0x33')]:_0x58be17[_0x29e1('0x2f')];if(_0xc2df0f[_0x29e1('0x30')][_0x29e1('0x3f')]){_0x412abf[_0x29e1('0x40')]=[{'all':!![]}];}_0x412abf=_[_0x29e1('0x3d')]({},_0x412abf,_0xc2df0f[_0x29e1('0x3e')]);return db[_0x29e1('0x2b')][_0x29e1('0x47')](_0x412abf)[_0x29e1('0x24')](handleEntityNotFound(_0x500223,null))[_0x29e1('0x24')](respondWithResult(_0x500223,null))[_0x29e1('0x43')](handleError(_0x500223,null));};exports[_0x29e1('0x48')]=function(_0x12c021,_0x448de2){return db[_0x29e1('0x2b')][_0x29e1('0x48')](_0x12c021[_0x29e1('0x49')],{})[_0x29e1('0x24')](function(_0x18f9d3){var _0x5c6ab3=_0x12c021[_0x29e1('0x4a')][_0x29e1('0x25')]({'plain':!![]});if(!_0x5c6ab3)throw new Error(_0x29e1('0x4b'));if(_0x5c6ab3[_0x29e1('0x4c')]===_0x29e1('0x4a')){var _0x1ef58c=_0x18f9d3[_0x29e1('0x25')]({'plain':!![]});var _0x5076b2='CmContactHasItems';return db[_0x29e1('0x4d')][_0x29e1('0x47')]({'where':{'name':_0x5076b2,'userProfileId':_0x5c6ab3[_0x29e1('0x4e')]},'raw':!![]})[_0x29e1('0x24')](function(_0x577fd7){if(_0x577fd7&&_0x577fd7[_0x29e1('0x4f')]===0x0){return db[_0x29e1('0x50')][_0x29e1('0x48')]({'name':_0x1ef58c['name'],'resourceId':_0x1ef58c['id'],'type':_0x577fd7['name'],'sectionId':_0x577fd7['id']},{})[_0x29e1('0x24')](function(){return _0x18f9d3;});}else{return _0x18f9d3;}})[_0x29e1('0x43')](function(_0x26576c){logger[_0x29e1('0x51')](_0x29e1('0x52'),_0x26576c);throw _0x26576c;});}return _0x18f9d3;})[_0x29e1('0x24')](respondWithResult(_0x448de2,0xc9))[_0x29e1('0x43')](handleError(_0x448de2,null));};exports[_0x29e1('0x22')]=function(_0x3d07ad,_0x9bd05e){if(_0x3d07ad[_0x29e1('0x49')]['id']){delete _0x3d07ad[_0x29e1('0x49')]['id'];}return db[_0x29e1('0x2b')][_0x29e1('0x47')]({'where':{'id':_0x3d07ad[_0x29e1('0x45')]['id']}})[_0x29e1('0x24')](handleEntityNotFound(_0x9bd05e,null))[_0x29e1('0x24')](saveUpdates(_0x3d07ad['body'],null))[_0x29e1('0x24')](respondWithResult(_0x9bd05e,null))[_0x29e1('0x43')](handleError(_0x9bd05e,null));};exports['destroy']=function(_0x415ede,_0x43d364){return db[_0x29e1('0x2b')][_0x29e1('0x47')]({'where':{'id':_0x415ede[_0x29e1('0x45')]['id']}})[_0x29e1('0x24')](handleEntityNotFound(_0x43d364,null))[_0x29e1('0x24')](removeEntity(_0x43d364,null))[_0x29e1('0x43')](handleError(_0x43d364,null));}; \ No newline at end of file +var _0x3f71=['catch','show','params','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/utils','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','update','then','CmContactHasItems','UserProfileResource','destroy','end','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','rows'];(function(_0x7b02fd,_0x37b321){var _0x2e1188=function(_0x3830d3){while(--_0x3830d3){_0x7b02fd['push'](_0x7b02fd['shift']());}};_0x2e1188(++_0x37b321);}(_0x3f71,0x17c));var _0x13f7=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x3f71[_0x163040];return _0x364667;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13f7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x13f7('0x1'));var moment=require(_0x13f7('0x2'));var BPromise=require(_0x13f7('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x13f7('0x4'));var csv=require('to-csv');var ejs=require(_0x13f7('0x5'));var fs=require('fs');var fs_extra=require(_0x13f7('0x6'));var _=require(_0x13f7('0x7'));var squel=require('squel');var crypto=require(_0x13f7('0x8'));var jsforce=require(_0x13f7('0x9'));var deskjs=require(_0x13f7('0xa'));var toCsv=require(_0x13f7('0xb'));var querystring=require(_0x13f7('0xc'));var Papa=require(_0x13f7('0xd'));var Redis=require('ioredis');var authService=require(_0x13f7('0xe'));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(_0x13f7('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x437c63,_0x398a9b){_0x398a9b=_0x398a9b||0xcc;return function(_0x3be002){if(_0x3be002){return _0x437c63[_0x13f7('0x10')](_0x398a9b);}return _0x437c63['status'](_0x398a9b)['end']();};}function respondWithResult(_0x17f162,_0x5ac4ad){_0x5ac4ad=_0x5ac4ad||0xc8;return function(_0x3178d6){if(_0x3178d6){return _0x17f162['status'](_0x5ac4ad)[_0x13f7('0x11')](_0x3178d6);}};}function respondWithFilteredResult(_0x1b975f,_0x5d4309){return function(_0x5337a3){if(_0x5337a3){var _0x289406=typeof _0x5d4309['offset']===_0x13f7('0x12')&&typeof _0x5d4309[_0x13f7('0x13')]===_0x13f7('0x12');var _0x4e301c=_0x5337a3[_0x13f7('0x14')];var _0x26cbf1=_0x289406?0x0:_0x5d4309[_0x13f7('0x15')];var _0x3ddeda=_0x289406?_0x5337a3['count']:_0x5d4309[_0x13f7('0x15')]+_0x5d4309[_0x13f7('0x13')];var _0x417104;if(_0x3ddeda>=_0x4e301c){_0x3ddeda=_0x4e301c;_0x417104=0xc8;}else{_0x417104=0xce;}_0x1b975f[_0x13f7('0x16')](_0x417104);return _0x1b975f[_0x13f7('0x17')](_0x13f7('0x18'),_0x26cbf1+'-'+_0x3ddeda+'/'+_0x4e301c)['json'](_0x5337a3);}return null;};}function patchUpdates(_0x59e70e){return function(_0x244bc8){try{jsonpatch['apply'](_0x244bc8,_0x59e70e,!![]);}catch(_0x39a413){return BPromise['reject'](_0x39a413);}return _0x244bc8['save']();};}function saveUpdates(_0x32a305,_0xa6d664){return function(_0x48eeee){if(_0x48eeee){return _0x48eeee[_0x13f7('0x19')](_0x32a305)[_0x13f7('0x1a')](function(_0x478d30){return _0x478d30;});}return null;};}function removeEntity(_0x7246fc,_0x275001){return function(_0x2e8c99){if(_0x2e8c99){return _0x2e8c99['destroy']()[_0x13f7('0x1a')](function(){var _0x11a9f7=_0x2e8c99['get']({'plain':!![]});var _0x5c4154=_0x13f7('0x1b');return db[_0x13f7('0x1c')][_0x13f7('0x1d')]({'where':{'type':_0x5c4154,'resourceId':_0x11a9f7['id']}})[_0x13f7('0x1a')](function(){return _0x2e8c99;});})[_0x13f7('0x1a')](function(){_0x7246fc['status'](0xcc)[_0x13f7('0x1e')]();});}};}function handleEntityNotFound(_0x30e6e4,_0x1e5400){return function(_0x24a490){if(!_0x24a490){_0x30e6e4['sendStatus'](0x194);}return _0x24a490;};}function handleError(_0x2ad863,_0x5bf2a1){_0x5bf2a1=_0x5bf2a1||0x1f4;return function(_0x272bf3){logger[_0x13f7('0x1f')](_0x272bf3['stack']);if(_0x272bf3[_0x13f7('0x20')]){delete _0x272bf3[_0x13f7('0x20')];}_0x2ad863[_0x13f7('0x16')](_0x5bf2a1)[_0x13f7('0x21')](_0x272bf3);};}exports[_0x13f7('0x22')]=function(_0x49377c,_0x5a5ee2){var _0x4e16e9={},_0xc8f27d={},_0x3d23d3={'count':0x0,'rows':[]};var _0x1a8aef=_[_0x13f7('0x23')](db[_0x13f7('0x24')][_0x13f7('0x25')],function(_0x4c9a8d){return{'name':_0x4c9a8d[_0x13f7('0x26')],'type':_0x4c9a8d[_0x13f7('0x27')][_0x13f7('0x28')]};});_0xc8f27d[_0x13f7('0x29')]=_[_0x13f7('0x23')](_0x1a8aef,_0x13f7('0x20'));_0xc8f27d[_0x13f7('0x2a')]=_['keys'](_0x49377c[_0x13f7('0x2a')]);_0xc8f27d[_0x13f7('0x2b')]=_[_0x13f7('0x2c')](_0xc8f27d['model'],_0xc8f27d['query']);_0x4e16e9[_0x13f7('0x2d')]=_['intersection'](_0xc8f27d[_0x13f7('0x29')],qs[_0x13f7('0x2e')](_0x49377c[_0x13f7('0x2a')][_0x13f7('0x2e')]));_0x4e16e9[_0x13f7('0x2d')]=_0x4e16e9[_0x13f7('0x2d')][_0x13f7('0x2f')]?_0x4e16e9[_0x13f7('0x2d')]:_0xc8f27d[_0x13f7('0x29')];if(!_0x49377c[_0x13f7('0x2a')][_0x13f7('0x30')]('nolimit')){_0x4e16e9['limit']=qs['limit'](_0x49377c[_0x13f7('0x2a')]['limit']);_0x4e16e9['offset']=qs['offset'](_0x49377c['query'][_0x13f7('0x15')]);}_0x4e16e9[_0x13f7('0x31')]=qs[_0x13f7('0x32')](_0x49377c[_0x13f7('0x2a')]['sort']);_0x4e16e9[_0x13f7('0x33')]=qs[_0x13f7('0x2b')](_[_0x13f7('0x34')](_0x49377c[_0x13f7('0x2a')],_0xc8f27d[_0x13f7('0x2b')]),_0x1a8aef);if(_0x49377c[_0x13f7('0x2a')]['filter']){_0x4e16e9['where']=_['merge'](_0x4e16e9[_0x13f7('0x33')],{'$or':_[_0x13f7('0x23')](_0x1a8aef,function(_0x2ffa5a){if(_0x2ffa5a[_0x13f7('0x27')]!==_0x13f7('0x35')){var _0x2e7e46={};_0x2e7e46[_0x2ffa5a[_0x13f7('0x20')]]={'$like':'%'+_0x49377c[_0x13f7('0x2a')][_0x13f7('0x36')]+'%'};return _0x2e7e46;}})});}_0x4e16e9=_[_0x13f7('0x37')]({},_0x4e16e9,_0x49377c['options']);var _0x2b8b2d={'where':_0x4e16e9[_0x13f7('0x33')]};return db[_0x13f7('0x24')]['count'](_0x2b8b2d)[_0x13f7('0x1a')](function(_0x265c0b){_0x3d23d3[_0x13f7('0x14')]=_0x265c0b;if(_0x49377c['query'][_0x13f7('0x38')]){_0x4e16e9['include']=[{'all':!![]}];}return db[_0x13f7('0x24')]['findAll'](_0x4e16e9);})[_0x13f7('0x1a')](function(_0x208ad1){_0x3d23d3[_0x13f7('0x39')]=_0x208ad1;return _0x3d23d3;})[_0x13f7('0x1a')](respondWithFilteredResult(_0x5a5ee2,_0x4e16e9))[_0x13f7('0x3a')](handleError(_0x5a5ee2,null));};exports[_0x13f7('0x3b')]=function(_0x22f2bb,_0x6025a){var _0x83af86={'raw':!![],'where':{'id':_0x22f2bb[_0x13f7('0x3c')]['id']}},_0x194e0b={};_0x194e0b['model']=_['keys'](db[_0x13f7('0x24')][_0x13f7('0x25')]);_0x194e0b[_0x13f7('0x2a')]=_[_0x13f7('0x3d')](_0x22f2bb[_0x13f7('0x2a')]);_0x194e0b[_0x13f7('0x2b')]=_[_0x13f7('0x2c')](_0x194e0b[_0x13f7('0x29')],_0x194e0b[_0x13f7('0x2a')]);_0x83af86[_0x13f7('0x2d')]=_[_0x13f7('0x2c')](_0x194e0b[_0x13f7('0x29')],qs[_0x13f7('0x2e')](_0x22f2bb['query'][_0x13f7('0x2e')]));_0x83af86['attributes']=_0x83af86[_0x13f7('0x2d')][_0x13f7('0x2f')]?_0x83af86['attributes']:_0x194e0b[_0x13f7('0x29')];if(_0x22f2bb[_0x13f7('0x2a')][_0x13f7('0x38')]){_0x83af86['include']=[{'all':!![]}];}_0x83af86=_[_0x13f7('0x37')]({},_0x83af86,_0x22f2bb[_0x13f7('0x3e')]);return db['CmContactHasItem'][_0x13f7('0x3f')](_0x83af86)[_0x13f7('0x1a')](handleEntityNotFound(_0x6025a,null))[_0x13f7('0x1a')](respondWithResult(_0x6025a,null))[_0x13f7('0x3a')](handleError(_0x6025a,null));};exports[_0x13f7('0x40')]=function(_0x8c19c7,_0x5f0155){return db[_0x13f7('0x24')][_0x13f7('0x40')](_0x8c19c7[_0x13f7('0x41')],{})[_0x13f7('0x1a')](function(_0x47b494){var _0x5248fa=_0x8c19c7[_0x13f7('0x42')][_0x13f7('0x43')]({'plain':!![]});if(!_0x5248fa)throw new Error(_0x13f7('0x44'));if(_0x5248fa['role']===_0x13f7('0x42')){var _0x260817=_0x47b494[_0x13f7('0x43')]({'plain':!![]});var _0x18462e=_0x13f7('0x1b');return db[_0x13f7('0x45')][_0x13f7('0x3f')]({'where':{'name':_0x18462e,'userProfileId':_0x5248fa[_0x13f7('0x46')]},'raw':!![]})[_0x13f7('0x1a')](function(_0x5c8f0b){if(_0x5c8f0b&&_0x5c8f0b[_0x13f7('0x47')]===0x0){return db[_0x13f7('0x1c')]['create']({'name':_0x260817[_0x13f7('0x20')],'resourceId':_0x260817['id'],'type':_0x5c8f0b[_0x13f7('0x20')],'sectionId':_0x5c8f0b['id']},{})[_0x13f7('0x1a')](function(){return _0x47b494;});}else{return _0x47b494;}})[_0x13f7('0x3a')](function(_0x22f077){logger['error'](_0x13f7('0x48'),_0x22f077);throw _0x22f077;});}return _0x47b494;})[_0x13f7('0x1a')](respondWithResult(_0x5f0155,0xc9))[_0x13f7('0x3a')](handleError(_0x5f0155,null));};exports[_0x13f7('0x19')]=function(_0x26c2f6,_0xad879d){if(_0x26c2f6[_0x13f7('0x41')]['id']){delete _0x26c2f6['body']['id'];}return db[_0x13f7('0x24')][_0x13f7('0x3f')]({'where':{'id':_0x26c2f6['params']['id']}})[_0x13f7('0x1a')](handleEntityNotFound(_0xad879d,null))[_0x13f7('0x1a')](saveUpdates(_0x26c2f6[_0x13f7('0x41')],null))['then'](respondWithResult(_0xad879d,null))[_0x13f7('0x3a')](handleError(_0xad879d,null));};exports[_0x13f7('0x1d')]=function(_0x7d55d4,_0x3373ea){return db[_0x13f7('0x24')][_0x13f7('0x3f')]({'where':{'id':_0x7d55d4['params']['id']}})[_0x13f7('0x1a')](handleEntityNotFound(_0x3373ea,null))[_0x13f7('0x1a')](removeEntity(_0x3373ea,null))[_0x13f7('0x3a')](handleError(_0x3373ea,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 5765551..ac26d60 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 _0x24fd=['moment','bluebird','path','rimraf','../../config/environment','exports','define','CmContactHasItem','lodash','api'];(function(_0x18a3bd,_0x516c4d){var _0x19d11d=function(_0x560cea){while(--_0x560cea){_0x18a3bd['push'](_0x18a3bd['shift']());}};_0x19d11d(++_0x516c4d);}(_0x24fd,0xb2));var _0xd24f=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x24fd[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0xd24f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd24f('0x1'));var moment=require(_0xd24f('0x2'));var BPromise=require(_0xd24f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd24f('0x4'));var rimraf=require(_0xd24f('0x5'));var config=require(_0xd24f('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0xd24f('0x7')]=function(_0x42487f,_0x1f1356){return _0x42487f[_0xd24f('0x8')](_0xd24f('0x9'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf350=['./cmContactHasItem.attributes','define','CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xf350,0x1f1));var _0x0f35=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf350[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x0f35('0x0'));var util=require(_0x0f35('0x1'));var logger=require(_0x0f35('0x2'))(_0x0f35('0x3'));var moment=require(_0x0f35('0x4'));var BPromise=require(_0x0f35('0x5'));var rp=require(_0x0f35('0x6'));var fs=require('fs');var path=require(_0x0f35('0x7'));var rimraf=require(_0x0f35('0x8'));var config=require(_0x0f35('0x9'));var attributes=require(_0x0f35('0xa'));module['exports']=function(_0x5b4fa6,_0x1e2cec){return _0x5b4fa6[_0x0f35('0xb')](_0x0f35('0xc'),attributes,{'tableName':'cm_contact_has_items','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 ed60954..4bca172 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 _0xdac3=['jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdac3,0x1ad));var _0x3dac=function(_0xa71f02,_0x5c9690){_0xa71f02=_0xa71f02-0x0;var _0x19798a=_0xdac3[_0xa71f02];return _0x19798a;};'use strict';var _=require(_0x3dac('0x0'));var util=require(_0x3dac('0x1'));var moment=require(_0x3dac('0x2'));var BPromise=require(_0x3dac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3dac('0x5'))(_0x3dac('0x6'));var config=require(_0x3dac('0x7'));var jayson=require(_0x3dac('0x8'));var client=jayson[_0x3dac('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x195bd7,_0x51abb4,_0x3e8742){return new BPromise(function(_0x3c2283,_0x59f00d){return client[_0x3dac('0xa')](_0x195bd7,_0x3e8742)[_0x3dac('0xb')](function(_0x1cff4d){logger[_0x3dac('0xc')](_0x3dac('0xd'),_0x51abb4,_0x3dac('0xe'));logger[_0x3dac('0xf')](_0x3dac('0x10'),_0x51abb4,_0x3dac('0xe'),JSON[_0x3dac('0x11')](_0x1cff4d));if(_0x1cff4d['error']){if(_0x1cff4d[_0x3dac('0x12')][_0x3dac('0x13')]===0x1f4){logger[_0x3dac('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x51abb4,_0x1cff4d[_0x3dac('0x12')][_0x3dac('0x14')]);return _0x59f00d(_0x1cff4d[_0x3dac('0x12')]['message']);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x51abb4,_0x1cff4d[_0x3dac('0x12')][_0x3dac('0x14')]);return _0x3c2283(_0x1cff4d[_0x3dac('0x12')][_0x3dac('0x14')]);}else{logger[_0x3dac('0xc')](_0x3dac('0xd'),_0x51abb4,_0x3dac('0xe'));_0x3c2283(_0x1cff4d[_0x3dac('0x15')]['message']);}})[_0x3dac('0x16')](function(_0x559ebb){logger[_0x3dac('0x12')](_0x3dac('0xd'),_0x51abb4,_0x559ebb);_0x59f00d(_0x559ebb);});});} \ No newline at end of file +var _0x0284=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','info','message'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x0284,0x65));var _0x4028=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x0284[_0x28f32c];return _0x355402;};'use strict';var _=require(_0x4028('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4028('0x1'));var rs=require(_0x4028('0x2'));var fs=require('fs');var Redis=require(_0x4028('0x3'));var db=require(_0x4028('0x4'))['db'];var utils=require(_0x4028('0x5'));var logger=require(_0x4028('0x6'))(_0x4028('0x7'));var config=require('../../config/environment');var jayson=require(_0x4028('0x8'));var client=jayson[_0x4028('0x9')][_0x4028('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b7c11,_0x5eea6f,_0x3b2a61){return new BPromise(function(_0x5afaf8,_0x156bdc){return client['request'](_0x2b7c11,_0x3b2a61)['then'](function(_0x5818a9){logger['info'](_0x4028('0xb'),_0x5eea6f,_0x4028('0xc'));logger[_0x4028('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x5eea6f,_0x4028('0xc'),JSON[_0x4028('0xe')](_0x5818a9));if(_0x5818a9['error']){if(_0x5818a9[_0x4028('0xf')][_0x4028('0x10')]===0x1f4){logger[_0x4028('0xf')](_0x4028('0xb'),_0x5eea6f,_0x5818a9[_0x4028('0xf')]['message']);return _0x156bdc(_0x5818a9['error']['message']);}logger[_0x4028('0xf')](_0x4028('0xb'),_0x5eea6f,_0x5818a9[_0x4028('0xf')]['message']);return _0x5afaf8(_0x5818a9[_0x4028('0xf')]['message']);}else{logger[_0x4028('0x11')](_0x4028('0xb'),_0x5eea6f,_0x4028('0xc'));_0x5afaf8(_0x5818a9['result'][_0x4028('0x12')]);}})[_0x4028('0x13')](function(_0x16f629){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x5eea6f,_0x16f629);_0x156bdc(_0x16f629);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index e6deae7..99df555 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 _0x317b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra'];(function(_0x148a63,_0x3c1877){var _0x4694fa=function(_0x1a6875){while(--_0x1a6875){_0x148a63['push'](_0x148a63['shift']());}};_0x4694fa(++_0x3c1877);}(_0x317b,0x1c7));var _0xb317=function(_0x22f451,_0x4a5cb2){_0x22f451=_0x22f451-0x0;var _0x1d7bb2=_0x317b[_0x22f451];return _0x1d7bb2;};'use strict';var multer=require(_0xb317('0x0'));var util=require(_0xb317('0x1'));var path=require('path');var timeout=require(_0xb317('0x2'));var express=require(_0xb317('0x3'));var router=express['Router']();var fs_extra=require(_0xb317('0x4'));var auth=require(_0xb317('0x5'));var interaction=require(_0xb317('0x6'));var config=require(_0xb317('0x7'));var controller=require(_0xb317('0x8'));router[_0xb317('0x9')]('/',auth[_0xb317('0xa')](),controller[_0xb317('0xb')]);router[_0xb317('0x9')](_0xb317('0xc'),auth['isAuthenticated'](),controller[_0xb317('0xd')]);router[_0xb317('0xe')]('/',auth['isAuthenticated'](),controller[_0xb317('0xf')]);router[_0xb317('0x10')](_0xb317('0xc'),auth[_0xb317('0xa')](),controller[_0xb317('0x11')]);router[_0xb317('0x12')]('/:id',auth[_0xb317('0xa')](),controller[_0xb317('0x13')]);module['exports']=router; \ No newline at end of file +var _0xab97=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','exports','multer','path'];(function(_0x182073,_0x5f40d5){var _0x4df826=function(_0xcf01b0){while(--_0xcf01b0){_0x182073['push'](_0x182073['shift']());}};_0x4df826(++_0x5f40d5);}(_0xab97,0x1b1));var _0x7ab9=function(_0x12d47f,_0x267023){_0x12d47f=_0x12d47f-0x0;var _0x41f81b=_0xab97[_0x12d47f];return _0x41f81b;};'use strict';var multer=require(_0x7ab9('0x0'));var util=require('util');var path=require(_0x7ab9('0x1'));var timeout=require(_0x7ab9('0x2'));var express=require('express');var router=express[_0x7ab9('0x3')]();var fs_extra=require(_0x7ab9('0x4'));var auth=require(_0x7ab9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7ab9('0x6'));var controller=require('./cmContactHasItem.controller');router[_0x7ab9('0x7')]('/',auth[_0x7ab9('0x8')](),controller[_0x7ab9('0x9')]);router['get'](_0x7ab9('0xa'),auth[_0x7ab9('0x8')](),controller['show']);router['post']('/',auth[_0x7ab9('0x8')](),controller[_0x7ab9('0xb')]);router[_0x7ab9('0xc')]('/:id',auth[_0x7ab9('0x8')](),controller['update']);router[_0x7ab9('0xd')](_0x7ab9('0xa'),auth[_0x7ab9('0x8')](),controller['destroy']);module[_0x7ab9('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 4cc01fc..bf86128 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 _0x2b76=['setDataValue','name','long','type','select','parse','getDataValue','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','alias','STRING'];(function(_0x35095d,_0xaebfd8){var _0xbe62d8=function(_0x3a8c3e){while(--_0x3a8c3e){_0x35095d['push'](_0x35095d['shift']());}};_0xbe62d8(++_0xaebfd8);}(_0x2b76,0xcb));var _0x62b7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2b76[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x62b7('0x0'));var _=require(_0x62b7('0x1'));module[_0x62b7('0x2')]={'name':{'type':Sequelize[_0x62b7('0x3')],'get':function(_0x13baa5){return this['getDataValue'](_0x62b7('0x4'));}},'alias':{'type':Sequelize[_0x62b7('0x5')],'allowNull':![],'set':function(_0x15c3df){this[_0x62b7('0x6')](_0x62b7('0x4'),_0x15c3df?_0x15c3df:this['getDataValue'](_0x62b7('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x62b7('0x8')),'get':function(){if(this['getDataValue'](_0x62b7('0x9'))===_0x62b7('0xa')){return JSON[_0x62b7('0xb')](this[_0x62b7('0xc')](_0x62b7('0xd')));}else{return this[_0x62b7('0xc')](_0x62b7('0xd'));}},'set':function(_0x36937a){if(Array[_0x62b7('0xe')](_0x36937a)){this[_0x62b7('0x6')](_0x62b7('0xd'),JSON[_0x62b7('0xf')](_0x36937a));}else{this['setDataValue'](_0x62b7('0xd'),_0x36937a);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x62b7('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x62b7('0x11')](_0x62b7('0x12'))}}; \ No newline at end of file +var _0xffc7=['sequelize','lodash','exports','VIRTUAL','STRING','alias','name','TEXT','long','getDataValue','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffc7,0xe4));var _0x7ffc=function(_0x2f7f59,_0x43d247){_0x2f7f59=_0x2f7f59-0x0;var _0x712d81=_0xffc7[_0x2f7f59];return _0x712d81;};'use strict';var Sequelize=require(_0x7ffc('0x0'));var _=require(_0x7ffc('0x1'));module[_0x7ffc('0x2')]={'name':{'type':Sequelize[_0x7ffc('0x3')],'get':function(_0xe2f71a){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x7ffc('0x4')],'allowNull':![],'set':function(_0x256a02){this['setDataValue'](_0x7ffc('0x5'),_0x256a02?_0x256a02:this['getDataValue'](_0x7ffc('0x6')));}},'type':{'type':Sequelize[_0x7ffc('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x7ffc('0x7')](_0x7ffc('0x8')),'get':function(){if(this[_0x7ffc('0x9')]('type')===_0x7ffc('0xa')){return JSON[_0x7ffc('0xb')](this['getDataValue']('values'));}else{return this[_0x7ffc('0x9')](_0x7ffc('0xc'));}},'set':function(_0xdbaf86){if(Array[_0x7ffc('0xd')](_0xdbaf86)){this[_0x7ffc('0xe')](_0x7ffc('0xc'),JSON[_0x7ffc('0xf')](_0xdbaf86));}else{this[_0x7ffc('0xe')](_0x7ffc('0xc'),_0xdbaf86);}}},'required':{'type':Sequelize[_0x7ffc('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7ffc('0x11')](_0x7ffc('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index b0e14cb..af61f2a 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 _0x681a=['name','send','index','map','CmCustomField','fieldName','differenceBy','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','filters','pick','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x681a,0x1e3));var _0xa681=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0x681a[_0x3af6d3];return _0xf0c5a8;};'use strict';var emlformat=require(_0xa681('0x0'));var rimraf=require(_0xa681('0x1'));var zipdir=require(_0xa681('0x2'));var jsonpatch=require(_0xa681('0x3'));var rp=require(_0xa681('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa681('0x5'));var util=require(_0xa681('0x6'));var path=require(_0xa681('0x7'));var sox=require(_0xa681('0x8'));var csv=require(_0xa681('0x9'));var ejs=require(_0xa681('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa681('0xb'));var squel=require(_0xa681('0xc'));var crypto=require(_0xa681('0xd'));var jsforce=require(_0xa681('0xe'));var deskjs=require(_0xa681('0xf'));var toCsv=require(_0xa681('0x9'));var querystring=require(_0xa681('0x10'));var Papa=require(_0xa681('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa681('0x12'));var as=require(_0xa681('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa681('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa681('0x15'));var db=require(_0xa681('0x16'))['db'];function respondWithStatusCode(_0x519972,_0x368b51){_0x368b51=_0x368b51||0xcc;return function(_0x28274c){if(_0x28274c){return _0x519972[_0xa681('0x17')](_0x368b51);}return _0x519972[_0xa681('0x18')](_0x368b51)[_0xa681('0x19')]();};}function respondWithResult(_0x1888b4,_0x3be0c6){_0x3be0c6=_0x3be0c6||0xc8;return function(_0x206cc7){if(_0x206cc7){return _0x1888b4[_0xa681('0x18')](_0x3be0c6)[_0xa681('0x1a')](_0x206cc7);}};}function respondWithFilteredResult(_0x261985,_0x446d9c){return function(_0x123c7){if(_0x123c7){var _0x214b92=typeof _0x446d9c[_0xa681('0x1b')]==='undefined'&&typeof _0x446d9c[_0xa681('0x1c')]===_0xa681('0x1d');var _0x1afa87=_0x123c7[_0xa681('0x1e')];var _0x3eee0f=_0x214b92?0x0:_0x446d9c[_0xa681('0x1b')];var _0x161682=_0x214b92?_0x123c7[_0xa681('0x1e')]:_0x446d9c[_0xa681('0x1b')]+_0x446d9c[_0xa681('0x1c')];var _0x386aa2;if(_0x161682>=_0x1afa87){_0x161682=_0x1afa87;_0x386aa2=0xc8;}else{_0x386aa2=0xce;}_0x261985[_0xa681('0x18')](_0x386aa2);return _0x261985[_0xa681('0x1f')](_0xa681('0x20'),_0x3eee0f+'-'+_0x161682+'/'+_0x1afa87)[_0xa681('0x1a')](_0x123c7);}return null;};}function patchUpdates(_0x5106ac){return function(_0x1f012f){try{jsonpatch[_0xa681('0x21')](_0x1f012f,_0x5106ac,!![]);}catch(_0x3755ce){return BPromise[_0xa681('0x22')](_0x3755ce);}return _0x1f012f[_0xa681('0x23')]();};}function saveUpdates(_0x45231b,_0x5443dd){return function(_0x489c2e){if(_0x489c2e){return _0x489c2e['update'](_0x45231b)[_0xa681('0x24')](function(_0x4a4d92){return _0x4a4d92;});}return null;};}function removeEntity(_0x5e2150,_0x385403){return function(_0x586858){if(_0x586858){return _0x586858['destroy']()[_0xa681('0x24')](function(){_0x5e2150[_0xa681('0x18')](0xcc)[_0xa681('0x19')]();});}};}function handleEntityNotFound(_0x57bce6,_0x13fc3b){return function(_0x5127e5){if(!_0x5127e5){_0x57bce6[_0xa681('0x17')](0x194);}return _0x5127e5;};}function handleError(_0x2d9e05,_0x173925){_0x173925=_0x173925||0x1f4;return function(_0x517b89){logger[_0xa681('0x25')](_0x517b89[_0xa681('0x26')]);if(_0x517b89[_0xa681('0x27')]){delete _0x517b89[_0xa681('0x27')];}_0x2d9e05[_0xa681('0x18')](_0x173925)[_0xa681('0x28')](_0x517b89);};}exports[_0xa681('0x29')]=function(_0x3e7833,_0xa11894){var _0x379433={},_0x48424f={},_0x6e4622={'count':0x0,'rows':[]};var _0x57dd56=_[_0xa681('0x2a')](db[_0xa681('0x2b')]['rawAttributes'],function(_0xbebdb6){return{'name':_0xbebdb6[_0xa681('0x2c')],'type':_0xbebdb6['type']['key']};});_0x48424f['model']=_[_0xa681('0x2d')](_[_0xa681('0x2a')](_0x57dd56,_0xa681('0x27')),['name']);_0x48424f['query']=_[_0xa681('0x2e')](_0x3e7833[_0xa681('0x2f')]);_0x48424f['filters']=_[_0xa681('0x30')](_0x48424f[_0xa681('0x31')],_0x48424f['query']);_0x379433[_0xa681('0x32')]=_[_0xa681('0x30')](_0x48424f['model'],qs[_0xa681('0x33')](_0x3e7833[_0xa681('0x2f')]['fields']));_0x379433[_0xa681('0x32')]=_0x379433[_0xa681('0x32')][_0xa681('0x34')]?_0x379433[_0xa681('0x32')]:_0x48424f[_0xa681('0x31')];if(!_0x3e7833[_0xa681('0x2f')][_0xa681('0x35')]('nolimit')){_0x379433[_0xa681('0x1c')]=qs[_0xa681('0x1c')](_0x3e7833[_0xa681('0x2f')]['limit']);_0x379433['offset']=qs[_0xa681('0x1b')](_0x3e7833[_0xa681('0x2f')]['offset']);}_0x379433['order']=qs['sort'](_0x3e7833[_0xa681('0x2f')][_0xa681('0x36')]);_0x379433['where']=qs[_0xa681('0x37')](_[_0xa681('0x38')](_0x3e7833[_0xa681('0x2f')],_0x48424f[_0xa681('0x37')]),_0x57dd56);if(_0x3e7833[_0xa681('0x2f')]['filter']){_0x379433[_0xa681('0x39')]=_[_0xa681('0x3a')](_0x379433[_0xa681('0x39')],{'$or':_[_0xa681('0x2a')](_0x57dd56,function(_0x90f419){if(_0x90f419[_0xa681('0x3b')]!=='VIRTUAL'){var _0x5094c2={};_0x5094c2[_0x90f419['name']]={'$like':'%'+_0x3e7833['query'][_0xa681('0x3c')]+'%'};return _0x5094c2;}})});}_0x379433=_[_0xa681('0x3a')]({},_0x379433,_0x3e7833[_0xa681('0x3d')]);var _0x116c64={'where':_0x379433[_0xa681('0x39')]};return db[_0xa681('0x2b')][_0xa681('0x1e')](_0x116c64)[_0xa681('0x24')](function(_0x307a2e){_0x6e4622[_0xa681('0x1e')]=_0x307a2e;if(_0x3e7833[_0xa681('0x2f')][_0xa681('0x3e')]){_0x379433[_0xa681('0x3f')]=[{'all':!![]}];}return db[_0xa681('0x2b')][_0xa681('0x40')](_0x379433);})[_0xa681('0x24')](function(_0x334de1){_0x6e4622[_0xa681('0x41')]=_0x334de1;return _0x6e4622;})['then'](respondWithFilteredResult(_0xa11894,_0x379433))[_0xa681('0x42')](handleError(_0xa11894,null));};exports[_0xa681('0x43')]=function(_0x4f81a6,_0x287345){var _0x579712={'raw':!![],'where':{'id':_0x4f81a6[_0xa681('0x44')]['id']}},_0x297bc6={};_0x297bc6['model']=_[_0xa681('0x2e')](db[_0xa681('0x2b')]['rawAttributes']);_0x297bc6[_0xa681('0x2f')]=_['keys'](_0x4f81a6['query']);_0x297bc6[_0xa681('0x37')]=_[_0xa681('0x30')](_0x297bc6[_0xa681('0x31')],_0x297bc6[_0xa681('0x2f')]);_0x579712[_0xa681('0x32')]=_['intersection'](_0x297bc6[_0xa681('0x31')],qs[_0xa681('0x33')](_0x4f81a6['query']['fields']));_0x579712[_0xa681('0x32')]=_0x579712[_0xa681('0x32')][_0xa681('0x34')]?_0x579712[_0xa681('0x32')]:_0x297bc6[_0xa681('0x31')];if(_0x4f81a6['query'][_0xa681('0x3e')]){_0x579712[_0xa681('0x3f')]=[{'all':!![]}];}_0x579712=_[_0xa681('0x3a')]({},_0x579712,_0x4f81a6[_0xa681('0x3d')]);return db[_0xa681('0x2b')][_0xa681('0x45')](_0x579712)[_0xa681('0x24')](handleEntityNotFound(_0x287345,null))[_0xa681('0x24')](respondWithResult(_0x287345,null))[_0xa681('0x42')](handleError(_0x287345,null));};exports['update']=function(_0x444a8f,_0x750582){if(_0x444a8f['body']['id']){delete _0x444a8f[_0xa681('0x46')]['id'];}return db[_0xa681('0x2b')]['find']({'where':{'id':_0x444a8f[_0xa681('0x44')]['id']}})[_0xa681('0x24')](handleEntityNotFound(_0x750582,null))[_0xa681('0x24')](saveUpdates(_0x444a8f[_0xa681('0x46')],null))[_0xa681('0x24')](respondWithResult(_0x750582,null))[_0xa681('0x42')](handleError(_0x750582,null));};exports[_0xa681('0x47')]=function(_0x2265be,_0x3523e7){return db[_0xa681('0x2b')][_0xa681('0x45')]({'where':{'id':_0x2265be[_0xa681('0x44')]['id']}})[_0xa681('0x24')](handleEntityNotFound(_0x3523e7,null))[_0xa681('0x24')](removeEntity(_0x3523e7,null))[_0xa681('0x42')](handleError(_0x3523e7,null));};exports[_0xa681('0x48')]=function(_0x4f10e5,_0x2d72e3){var _0x4f2259;return db[_0xa681('0x49')][_0xa681('0x4a')](function(_0x8134c8){return db['CmCustomField']['create'](_0x4f10e5[_0xa681('0x46')],{'transaction':_0x8134c8})[_0xa681('0x24')](function(_0x2c8766){_0x4f2259=_0x2c8766;var _0x11c403={'type':db[_0xa681('0x4b')][_0xa681('0x4c')],'transaction':_0x8134c8};switch(_0x4f10e5[_0xa681('0x46')][_0xa681('0x3b')]){case _0xa681('0x4d'):_0x11c403[_0xa681('0x3b')]=db[_0xa681('0x4b')][_0xa681('0x4c')];break;case _0xa681('0x4e'):_0x11c403[_0xa681('0x3b')]=db['Sequelize']['INTEGER'];break;case _0xa681('0x4f'):_0x11c403[_0xa681('0x3b')]=db['Sequelize'][_0xa681('0x50')];_0x11c403[_0xa681('0x51')]=![];break;default:}return db[_0xa681('0x49')][_0xa681('0x52')][_0xa681('0x53')](_0xa681('0x54'),util[_0xa681('0x55')](_0xa681('0x56'),_0x4f2259['id']),_0x11c403);})[_0xa681('0x24')](function(){return _0x4f2259;});})[_0xa681('0x24')](respondWithResult(_0x2d72e3,0xc9))[_0xa681('0x42')](handleError(_0x2d72e3,null));}; \ No newline at end of file +var _0x4715=['merge','VIRTUAL','options','CmCustomField','include','rows','show','params','keys','includeAll','find','catch','body','create','transaction','text','Sequelize','INTEGER','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','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','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','count','offset','limit','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4715,0x121));var _0x5471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4715[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5471('0x0'));var rimraf=require(_0x5471('0x1'));var zipdir=require(_0x5471('0x2'));var jsonpatch=require(_0x5471('0x3'));var rp=require(_0x5471('0x4'));var moment=require(_0x5471('0x5'));var BPromise=require(_0x5471('0x6'));var Mustache=require(_0x5471('0x7'));var util=require(_0x5471('0x8'));var path=require(_0x5471('0x9'));var sox=require(_0x5471('0xa'));var csv=require(_0x5471('0xb'));var ejs=require(_0x5471('0xc'));var fs=require('fs');var fs_extra=require(_0x5471('0xd'));var _=require('lodash');var squel=require(_0x5471('0xe'));var crypto=require(_0x5471('0xf'));var jsforce=require(_0x5471('0x10'));var deskjs=require(_0x5471('0x11'));var toCsv=require(_0x5471('0xb'));var querystring=require('querystring');var Papa=require(_0x5471('0x12'));var Redis=require('ioredis');var authService=require(_0x5471('0x13'));var qs=require(_0x5471('0x14'));var as=require(_0x5471('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5471('0x16'))(_0x5471('0x17'));var utils=require(_0x5471('0x18'));var config=require(_0x5471('0x19'));var licenseUtil=require(_0x5471('0x1a'));var db=require(_0x5471('0x1b'))['db'];function respondWithStatusCode(_0x15144e,_0x3ac6a9){_0x3ac6a9=_0x3ac6a9||0xcc;return function(_0x50ca7d){if(_0x50ca7d){return _0x15144e[_0x5471('0x1c')](_0x3ac6a9);}return _0x15144e[_0x5471('0x1d')](_0x3ac6a9)[_0x5471('0x1e')]();};}function respondWithResult(_0x5b37ca,_0x2f53fe){_0x2f53fe=_0x2f53fe||0xc8;return function(_0x48b947){if(_0x48b947){return _0x5b37ca['status'](_0x2f53fe)[_0x5471('0x1f')](_0x48b947);}};}function respondWithFilteredResult(_0x35e942,_0x52b976){return function(_0x525de5){if(_0x525de5){var _0x65c07b=typeof _0x52b976['offset']===_0x5471('0x20')&&typeof _0x52b976['limit']===_0x5471('0x20');var _0x5dcf6c=_0x525de5[_0x5471('0x21')];var _0x18c9ae=_0x65c07b?0x0:_0x52b976[_0x5471('0x22')];var _0x5f01a4=_0x65c07b?_0x525de5['count']:_0x52b976[_0x5471('0x22')]+_0x52b976[_0x5471('0x23')];var _0x4d3eb6;if(_0x5f01a4>=_0x5dcf6c){_0x5f01a4=_0x5dcf6c;_0x4d3eb6=0xc8;}else{_0x4d3eb6=0xce;}_0x35e942['status'](_0x4d3eb6);return _0x35e942['set'](_0x5471('0x24'),_0x18c9ae+'-'+_0x5f01a4+'/'+_0x5dcf6c)[_0x5471('0x1f')](_0x525de5);}return null;};}function patchUpdates(_0x8690cc){return function(_0x1d6918){try{jsonpatch[_0x5471('0x25')](_0x1d6918,_0x8690cc,!![]);}catch(_0xd543){return BPromise[_0x5471('0x26')](_0xd543);}return _0x1d6918[_0x5471('0x27')]();};}function saveUpdates(_0x38479b,_0x5be490){return function(_0x186e03){if(_0x186e03){return _0x186e03['update'](_0x38479b)[_0x5471('0x28')](function(_0x173ea0){return _0x173ea0;});}return null;};}function removeEntity(_0x3dfc5c,_0x1d07fd){return function(_0x3c247c){if(_0x3c247c){return _0x3c247c[_0x5471('0x29')]()[_0x5471('0x28')](function(){_0x3dfc5c[_0x5471('0x1d')](0xcc)[_0x5471('0x1e')]();});}};}function handleEntityNotFound(_0x16c00d,_0x2beb42){return function(_0x44bcb5){if(!_0x44bcb5){_0x16c00d[_0x5471('0x1c')](0x194);}return _0x44bcb5;};}function handleError(_0x3f0f04,_0x203e3d){_0x203e3d=_0x203e3d||0x1f4;return function(_0x3d7f2b){logger['error'](_0x3d7f2b[_0x5471('0x2a')]);if(_0x3d7f2b[_0x5471('0x2b')]){delete _0x3d7f2b[_0x5471('0x2b')];}_0x3f0f04['status'](_0x203e3d)[_0x5471('0x2c')](_0x3d7f2b);};}exports['index']=function(_0x47e232,_0xd01e09){var _0x1153bd={},_0x1746e1={},_0x3aae15={'count':0x0,'rows':[]};var _0x3001fd=_[_0x5471('0x2d')](db['CmCustomField'][_0x5471('0x2e')],function(_0x3b360e){return{'name':_0x3b360e['fieldName'],'type':_0x3b360e[_0x5471('0x2f')][_0x5471('0x30')]};});_0x1746e1[_0x5471('0x31')]=_['differenceBy'](_['map'](_0x3001fd,_0x5471('0x2b')),[_0x5471('0x2b')]);_0x1746e1[_0x5471('0x32')]=_['keys'](_0x47e232['query']);_0x1746e1['filters']=_[_0x5471('0x33')](_0x1746e1['model'],_0x1746e1['query']);_0x1153bd['attributes']=_[_0x5471('0x33')](_0x1746e1['model'],qs['fields'](_0x47e232[_0x5471('0x32')][_0x5471('0x34')]));_0x1153bd[_0x5471('0x35')]=_0x1153bd[_0x5471('0x35')][_0x5471('0x36')]?_0x1153bd[_0x5471('0x35')]:_0x1746e1[_0x5471('0x31')];if(!_0x47e232[_0x5471('0x32')][_0x5471('0x37')](_0x5471('0x38'))){_0x1153bd['limit']=qs['limit'](_0x47e232[_0x5471('0x32')][_0x5471('0x23')]);_0x1153bd['offset']=qs[_0x5471('0x22')](_0x47e232[_0x5471('0x32')]['offset']);}_0x1153bd[_0x5471('0x39')]=qs[_0x5471('0x3a')](_0x47e232[_0x5471('0x32')]['sort']);_0x1153bd[_0x5471('0x3b')]=qs[_0x5471('0x3c')](_[_0x5471('0x3d')](_0x47e232[_0x5471('0x32')],_0x1746e1['filters']),_0x3001fd);if(_0x47e232[_0x5471('0x32')][_0x5471('0x3e')]){_0x1153bd[_0x5471('0x3b')]=_[_0x5471('0x3f')](_0x1153bd[_0x5471('0x3b')],{'$or':_[_0x5471('0x2d')](_0x3001fd,function(_0xa910e1){if(_0xa910e1[_0x5471('0x2f')]!==_0x5471('0x40')){var _0x25611d={};_0x25611d[_0xa910e1[_0x5471('0x2b')]]={'$like':'%'+_0x47e232[_0x5471('0x32')][_0x5471('0x3e')]+'%'};return _0x25611d;}})});}_0x1153bd=_['merge']({},_0x1153bd,_0x47e232[_0x5471('0x41')]);var _0x4459a0={'where':_0x1153bd[_0x5471('0x3b')]};return db[_0x5471('0x42')][_0x5471('0x21')](_0x4459a0)['then'](function(_0x98d483){_0x3aae15['count']=_0x98d483;if(_0x47e232[_0x5471('0x32')]['includeAll']){_0x1153bd[_0x5471('0x43')]=[{'all':!![]}];}return db[_0x5471('0x42')]['findAll'](_0x1153bd);})[_0x5471('0x28')](function(_0x599a51){_0x3aae15[_0x5471('0x44')]=_0x599a51;return _0x3aae15;})[_0x5471('0x28')](respondWithFilteredResult(_0xd01e09,_0x1153bd))['catch'](handleError(_0xd01e09,null));};exports[_0x5471('0x45')]=function(_0x4a30d0,_0x35ada4){var _0x4a79d8={'raw':!![],'where':{'id':_0x4a30d0[_0x5471('0x46')]['id']}},_0xd159eb={};_0xd159eb[_0x5471('0x31')]=_['keys'](db['CmCustomField'][_0x5471('0x2e')]);_0xd159eb[_0x5471('0x32')]=_[_0x5471('0x47')](_0x4a30d0[_0x5471('0x32')]);_0xd159eb[_0x5471('0x3c')]=_[_0x5471('0x33')](_0xd159eb[_0x5471('0x31')],_0xd159eb[_0x5471('0x32')]);_0x4a79d8[_0x5471('0x35')]=_[_0x5471('0x33')](_0xd159eb[_0x5471('0x31')],qs[_0x5471('0x34')](_0x4a30d0[_0x5471('0x32')][_0x5471('0x34')]));_0x4a79d8[_0x5471('0x35')]=_0x4a79d8[_0x5471('0x35')]['length']?_0x4a79d8[_0x5471('0x35')]:_0xd159eb[_0x5471('0x31')];if(_0x4a30d0[_0x5471('0x32')][_0x5471('0x48')]){_0x4a79d8[_0x5471('0x43')]=[{'all':!![]}];}_0x4a79d8=_[_0x5471('0x3f')]({},_0x4a79d8,_0x4a30d0[_0x5471('0x41')]);return db[_0x5471('0x42')][_0x5471('0x49')](_0x4a79d8)[_0x5471('0x28')](handleEntityNotFound(_0x35ada4,null))[_0x5471('0x28')](respondWithResult(_0x35ada4,null))[_0x5471('0x4a')](handleError(_0x35ada4,null));};exports['update']=function(_0x119436,_0x5aeaff){if(_0x119436[_0x5471('0x4b')]['id']){delete _0x119436[_0x5471('0x4b')]['id'];}return db[_0x5471('0x42')][_0x5471('0x49')]({'where':{'id':_0x119436[_0x5471('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aeaff,null))[_0x5471('0x28')](saveUpdates(_0x119436[_0x5471('0x4b')],null))[_0x5471('0x28')](respondWithResult(_0x5aeaff,null))['catch'](handleError(_0x5aeaff,null));};exports[_0x5471('0x29')]=function(_0x520627,_0x14c064){return db[_0x5471('0x42')][_0x5471('0x49')]({'where':{'id':_0x520627[_0x5471('0x46')]['id']}})[_0x5471('0x28')](handleEntityNotFound(_0x14c064,null))[_0x5471('0x28')](removeEntity(_0x14c064,null))[_0x5471('0x4a')](handleError(_0x14c064,null));};exports[_0x5471('0x4c')]=function(_0x24848b,_0x4f2583){var _0x11d4d5;return db['sequelize'][_0x5471('0x4d')](function(_0x4ae9ae){return db[_0x5471('0x42')][_0x5471('0x4c')](_0x24848b['body'],{'transaction':_0x4ae9ae})[_0x5471('0x28')](function(_0x2cdeee){_0x11d4d5=_0x2cdeee;var _0x5b8e4c={'type':db['Sequelize']['TEXT'],'transaction':_0x4ae9ae};switch(_0x24848b[_0x5471('0x4b')][_0x5471('0x2f')]){case _0x5471('0x4e'):_0x5b8e4c[_0x5471('0x2f')]=db[_0x5471('0x4f')]['TEXT'];break;case'number':_0x5b8e4c['type']=db[_0x5471('0x4f')][_0x5471('0x50')];break;case'switch':_0x5b8e4c[_0x5471('0x2f')]=db['Sequelize'][_0x5471('0x51')];_0x5b8e4c['defaultValue']=![];break;default:}return db[_0x5471('0x52')][_0x5471('0x53')][_0x5471('0x54')](_0x5471('0x55'),util[_0x5471('0x56')](_0x5471('0x57'),_0x11d4d5['id']),_0x5b8e4c);})[_0x5471('0x28')](function(){return _0x11d4d5;});})[_0x5471('0x28')](respondWithResult(_0x4f2583,0xc9))[_0x5471('0x4a')](handleError(_0x4f2583,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 017326f..1f50219 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 _0x09c8=['request-promise','path','rimraf','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5d3ed2,_0x1503be){var _0x1cf0ae=function(_0x37683d){while(--_0x37683d){_0x5d3ed2['push'](_0x5d3ed2['shift']());}};_0x1cf0ae(++_0x1503be);}(_0x09c8,0xf1));var _0x809c=function(_0x1801e6,_0x3814c2){_0x1801e6=_0x1801e6-0x0;var _0x465eaa=_0x09c8[_0x1801e6];return _0x465eaa;};'use strict';var _=require(_0x809c('0x0'));var util=require(_0x809c('0x1'));var logger=require(_0x809c('0x2'))(_0x809c('0x3'));var moment=require(_0x809c('0x4'));var BPromise=require(_0x809c('0x5'));var rp=require(_0x809c('0x6'));var fs=require('fs');var path=require(_0x809c('0x7'));var rimraf=require(_0x809c('0x8'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x809c('0x9')]=function(_0x2f0415,_0x1bda3f){return _0x2f0415[_0x809c('0xa')](_0x809c('0xb'),attributes,{'tableName':_0x809c('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa203=['path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5b176a,_0xa76b85){var _0x35e08c=function(_0x48d140){while(--_0x48d140){_0x5b176a['push'](_0x5b176a['shift']());}};_0x35e08c(++_0xa76b85);}(_0xa203,0xda));var _0x3a20=function(_0x6b91fa,_0x444ed7){_0x6b91fa=_0x6b91fa-0x0;var _0x870a9a=_0xa203[_0x6b91fa];return _0x870a9a;};'use strict';var _=require('lodash');var util=require(_0x3a20('0x0'));var logger=require(_0x3a20('0x1'))(_0x3a20('0x2'));var moment=require(_0x3a20('0x3'));var BPromise=require(_0x3a20('0x4'));var rp=require(_0x3a20('0x5'));var fs=require('fs');var path=require(_0x3a20('0x6'));var rimraf=require(_0x3a20('0x7'));var config=require(_0x3a20('0x8'));var attributes=require(_0x3a20('0x9'));module[_0x3a20('0xa')]=function(_0x5166e2,_0x18f642){return _0x5166e2[_0x3a20('0xb')](_0x3a20('0xc'),attributes,{'tableName':_0x3a20('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index ca37afd..0e52e29 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 _0xc482=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x32e939,_0x4d93b5){var _0x236a4b=function(_0x46ebb1){while(--_0x46ebb1){_0x32e939['push'](_0x32e939['shift']());}};_0x236a4b(++_0x4d93b5);}(_0xc482,0xb8));var _0x2c48=function(_0xd44856,_0x1c31af){_0xd44856=_0xd44856-0x0;var _0x48b861=_0xc482[_0xd44856];return _0x48b861;};'use strict';var _=require(_0x2c48('0x0'));var util=require(_0x2c48('0x1'));var moment=require(_0x2c48('0x2'));var BPromise=require(_0x2c48('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c48('0x4'));var db=require(_0x2c48('0x5'))['db'];var utils=require(_0x2c48('0x6'));var logger=require(_0x2c48('0x7'))(_0x2c48('0x8'));var config=require(_0x2c48('0x9'));var jayson=require(_0x2c48('0xa'));var client=jayson[_0x2c48('0xb')][_0x2c48('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1be02b,_0x2eb70a,_0x16bd26){return new BPromise(function(_0x10a86e,_0x822b17){return client[_0x2c48('0xd')](_0x1be02b,_0x16bd26)[_0x2c48('0xe')](function(_0x4e8581){logger[_0x2c48('0xf')]('CmCustomField,\x20%s,\x20%s',_0x2eb70a,'request\x20sent');logger[_0x2c48('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2eb70a,_0x2c48('0x11'),JSON['stringify'](_0x4e8581));if(_0x4e8581[_0x2c48('0x12')]){if(_0x4e8581[_0x2c48('0x12')][_0x2c48('0x13')]===0x1f4){logger[_0x2c48('0x12')](_0x2c48('0x14'),_0x2eb70a,_0x4e8581[_0x2c48('0x12')]['message']);return _0x822b17(_0x4e8581[_0x2c48('0x12')][_0x2c48('0x15')]);}logger[_0x2c48('0x12')](_0x2c48('0x14'),_0x2eb70a,_0x4e8581[_0x2c48('0x12')]['message']);return _0x10a86e(_0x4e8581['error'][_0x2c48('0x15')]);}else{logger[_0x2c48('0xf')](_0x2c48('0x14'),_0x2eb70a,'request\x20sent');_0x10a86e(_0x4e8581[_0x2c48('0x16')]['message']);}})[_0x2c48('0x17')](function(_0x255fa6){logger[_0x2c48('0x12')](_0x2c48('0x14'),_0x2eb70a,_0x255fa6);_0x822b17(_0x255fa6);});});} \ No newline at end of file +var _0x3426=['../../config/environment','client','request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x3426,0x143));var _0x6342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3426[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6342('0x0'));var util=require(_0x6342('0x1'));var moment=require('moment');var BPromise=require(_0x6342('0x2'));var rs=require(_0x6342('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6342('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6342('0x5'))(_0x6342('0x6'));var config=require(_0x6342('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6342('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21fa15,_0x262448,_0x4bb439){return new BPromise(function(_0x245fd7,_0x13d1c8){return client[_0x6342('0x9')](_0x21fa15,_0x4bb439)[_0x6342('0xa')](function(_0x4fb880){logger[_0x6342('0xb')]('CmCustomField,\x20%s,\x20%s',_0x262448,'request\x20sent');logger[_0x6342('0xc')](_0x6342('0xd'),_0x262448,_0x6342('0xe'),JSON[_0x6342('0xf')](_0x4fb880));if(_0x4fb880[_0x6342('0x10')]){if(_0x4fb880['error'][_0x6342('0x11')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x262448,_0x4fb880[_0x6342('0x10')][_0x6342('0x12')]);return _0x13d1c8(_0x4fb880[_0x6342('0x10')][_0x6342('0x12')]);}logger[_0x6342('0x10')](_0x6342('0x13'),_0x262448,_0x4fb880['error']['message']);return _0x245fd7(_0x4fb880[_0x6342('0x10')][_0x6342('0x12')]);}else{logger[_0x6342('0xb')](_0x6342('0x13'),_0x262448,_0x6342('0xe'));_0x245fd7(_0x4fb880[_0x6342('0x14')][_0x6342('0x12')]);}})[_0x6342('0x15')](function(_0x345810){logger[_0x6342('0x10')]('CmCustomField,\x20%s,\x20%s',_0x262448,_0x345810);_0x13d1c8(_0x345810);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index a01dd43..df43420 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 _0x975f=['../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2b7857,_0x490ea0){var _0x5013cd=function(_0x2a28ba){while(--_0x2a28ba){_0x2b7857['push'](_0x2b7857['shift']());}};_0x5013cd(++_0x490ea0);}(_0x975f,0x191));var _0xf975=function(_0x57966a,_0x477964){_0x57966a=_0x57966a-0x0;var _0x191765=_0x975f[_0x57966a];return _0x191765;};'use strict';var multer=require(_0xf975('0x0'));var util=require('util');var path=require(_0xf975('0x1'));var timeout=require(_0xf975('0x2'));var express=require(_0xf975('0x3'));var router=express[_0xf975('0x4')]();var fs_extra=require(_0xf975('0x5'));var auth=require(_0xf975('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf975('0x7'));var controller=require(_0xf975('0x8'));router['get']('/',auth[_0xf975('0x9')](),controller[_0xf975('0xa')]);router[_0xf975('0xb')](_0xf975('0xc'),auth[_0xf975('0x9')](),controller[_0xf975('0xd')]);router['post']('/',auth[_0xf975('0x9')](),controller['create']);router[_0xf975('0xe')]('/:id',auth[_0xf975('0x9')](),controller[_0xf975('0xf')]);router['delete'](_0xf975('0xc'),auth[_0xf975('0x9')](),controller[_0xf975('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd6d2=['../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x543c51,_0xff0084){var _0x360555=function(_0x2a0801){while(--_0x2a0801){_0x543c51['push'](_0x543c51['shift']());}};_0x360555(++_0xff0084);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x2d0121,_0x52ec42){_0x2d0121=_0x2d0121-0x0;var _0x3c82b9=_0xd6d2[_0x2d0121];return _0x3c82b9;};'use strict';var multer=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var path=require('path');var timeout=require(_0x2d6d('0x2'));var express=require(_0x2d6d('0x3'));var router=express['Router']();var fs_extra=require(_0x2d6d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2d6d('0x5'));var config=require(_0x2d6d('0x6'));var controller=require(_0x2d6d('0x7'));router['get']('/',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x9')]);router[_0x2d6d('0xa')](_0x2d6d('0xb'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0xc')]);router[_0x2d6d('0xd')]('/',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0xe')]);router[_0x2d6d('0xf')](_0x2d6d('0xb'),auth['isAuthenticated'](),controller[_0x2d6d('0x10')]);router[_0x2d6d('0x11')](_0x2d6d('0xb'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6cb3c81..270665f 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 _0x5007=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x5007,0x8b));var _0x7500=function(_0x121184,_0x4b6d59){_0x121184=_0x121184-0x0;var _0x22fe02=_0x5007[_0x121184];return _0x22fe02;};'use strict';var moment=require(_0x7500('0x0'));var Sequelize=require(_0x7500('0x1'));module[_0x7500('0x2')]={'phone':{'type':Sequelize[_0x7500('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x7500('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7500('0x5')],'defaultValue':moment()[_0x7500('0x6')](_0x7500('0x7'))},'countbusyretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7500('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7500('0x5')]},'priority':{'type':Sequelize[_0x7500('0x8')](0x2)[_0x7500('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7500('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7500('0x8')],'unique':_0x7500('0xa')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x7500('0xa')},'UserId':{'type':Sequelize[_0x7500('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x7500('0x8')],'unique':_0x7500('0xa')},'CampaignId':{'type':Sequelize[_0x7500('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x7500('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7500('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x7500('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xbe2f=['exports','STRING','DATE','INTEGER','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x126f47,_0x2199e9){var _0x49508a=function(_0x20ba36){while(--_0x20ba36){_0x126f47['push'](_0x126f47['shift']());}};_0x49508a(++_0x2199e9);}(_0xbe2f,0x13e));var _0xfbe2=function(_0x5cff53,_0x1ab67d){_0x5cff53=_0x5cff53-0x0;var _0x385c3c=_0xbe2f[_0x5cff53];return _0x385c3c;};'use strict';var moment=require(_0xfbe2('0x0'));var Sequelize=require(_0xfbe2('0x1'));module[_0xfbe2('0x2')]={'phone':{'type':Sequelize[_0xfbe2('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xfbe2('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfbe2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xfbe2('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xfbe2('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xfbe2('0x5')],'unique':_0xfbe2('0x7')},'UserId':{'type':Sequelize[_0xfbe2('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xfbe2('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xfbe2('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfbe2('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xfbe2('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 6abb6ba..e3668f5 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 _0x8d0a=['$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','map','VIRTUAL','filter','options','CmHopper','count','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','Queue','dialActive','LOCK','CmList','List','getOpenContacts','outbound','isNumber','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','set','Content-Range','json','update','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','keys','query','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains'];(function(_0x46d8b2,_0x3829c4){var _0x1a351f=function(_0x279ce5){while(--_0x279ce5){_0x46d8b2['push'](_0x46d8b2['shift']());}};_0x1a351f(++_0x3829c4);}(_0x8d0a,0x65));var _0xa8d0=function(_0x3b3750,_0x28f3b8){_0x3b3750=_0x3b3750-0x0;var _0x1b9e8b=_0x8d0a[_0x3b3750];return _0x1b9e8b;};'use strict';var moment=require(_0xa8d0('0x0'));var _=require('lodash');var qs=require(_0xa8d0('0x1'));var logger=require(_0xa8d0('0x2'))(_0xa8d0('0x3'));var shared=require(_0xa8d0('0x4'));var db=require(_0xa8d0('0x5'))['db'];function respondWithResult(_0x477190,_0x528287){_0x528287=_0x528287||0xc8;return function(_0x202833){if(_0x202833){return _0x477190[_0xa8d0('0x6')](_0x528287)['json'](_0x202833);}};}function respondWithFilteredResult(_0x1cac4f,_0x212aaf){return function(_0x1f95a7){if(_0x1f95a7){var _0x1f8b78=typeof _0x212aaf[_0xa8d0('0x7')]==='undefined'&&typeof _0x212aaf['limit']===_0xa8d0('0x8');var _0x823481=_0x1f95a7['count'];var _0x5362af=_0x1f8b78?0x0:_0x212aaf['offset'];var _0x296b54=_0x1f8b78?_0x1f95a7['count']:_0x212aaf[_0xa8d0('0x7')]+_0x212aaf[_0xa8d0('0x9')];var _0x44541e;if(_0x296b54>=_0x823481){_0x296b54=_0x823481;_0x44541e=0xc8;}else{_0x44541e=0xce;}_0x1cac4f[_0xa8d0('0x6')](_0x44541e);return _0x1cac4f[_0xa8d0('0xa')](_0xa8d0('0xb'),_0x5362af+'-'+_0x296b54+'/'+_0x823481)[_0xa8d0('0xc')](_0x1f95a7);}return null;};}function saveUpdates(_0x3bf335,_0x329583){return function(_0x1bfcb6){if(_0x1bfcb6){return _0x1bfcb6[_0xa8d0('0xd')](_0x3bf335)['then'](function(_0x757540){return _0x757540;});}return null;};}function handleEntityNotFound(_0x478f66,_0x5a9193){return function(_0x32ea3e){if(!_0x32ea3e){_0x478f66[_0xa8d0('0xe')](0x194);}return _0x32ea3e;};}function handleError(_0x523ec0,_0x31da9f){_0x31da9f=_0x31da9f||0x1f4;return function(_0x459e9d){logger[_0xa8d0('0xf')](_0x459e9d[_0xa8d0('0x10')]);if(_0x459e9d[_0xa8d0('0x11')]){delete _0x459e9d[_0xa8d0('0x11')];}_0x523ec0['status'](_0x31da9f)[_0xa8d0('0x12')](_0x459e9d);};}exports[_0xa8d0('0x13')]=function(_0x5cf619,_0x2f0b00){var _0x1e325a={},_0x53d168={},_0x32b11a={'count':0x0,'rows':[]};var _0xf9267d=_['map'](db['CmHopper'][_0xa8d0('0x14')],function(_0x25ed8d){return{'name':_0x25ed8d['fieldName'],'type':_0x25ed8d[_0xa8d0('0x15')][_0xa8d0('0x16')]};});_0x53d168[_0xa8d0('0x17')]=_['map'](_0xf9267d,_0xa8d0('0x11'));_0x53d168['query']=_[_0xa8d0('0x18')](_0x5cf619[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x53d168[_0xa8d0('0x17')],_0x53d168[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_['concat'](_0x53d168['filters'],[_0xa8d0('0x1c'),'$or',_0xa8d0('0x1d'),_0xa8d0('0x1e'),_0xa8d0('0x1f'),_0xa8d0('0x20'),_0xa8d0('0x21'),'$eq',_0xa8d0('0x22'),_0xa8d0('0x23'),_0xa8d0('0x24'),_0xa8d0('0x25'),_0xa8d0('0x26'),_0xa8d0('0x27'),_0xa8d0('0x28'),_0xa8d0('0x29'),'$notILike',_0xa8d0('0x27'),_0xa8d0('0x2a'),_0xa8d0('0x2b'),_0xa8d0('0x2c'),_0xa8d0('0x2d')]);_0x1e325a[_0xa8d0('0x2e')]=_['intersection'](_0x53d168[_0xa8d0('0x17')],qs[_0xa8d0('0x2f')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1e325a['attributes']=_0x1e325a[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1e325a['attributes']:_0x53d168['model'];if(!_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x31')](_0xa8d0('0x32'))){_0x1e325a[_0xa8d0('0x9')]=qs[_0xa8d0('0x9')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x9')]);_0x1e325a[_0xa8d0('0x7')]=qs[_0xa8d0('0x7')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x7')]);}_0x1e325a[_0xa8d0('0x33')]=qs['sort'](_0x5cf619['query'][_0xa8d0('0x34')]);_0x1e325a['where']=qs[_0xa8d0('0x1a')](_[_0xa8d0('0x35')](_0x5cf619[_0xa8d0('0x19')],_0x53d168[_0xa8d0('0x1a')]),_0xf9267d);if(_0x5cf619[_0xa8d0('0x19')]['filter']){_0x1e325a['where']=_[_0xa8d0('0x36')](_0x1e325a[_0xa8d0('0x37')],{'$or':_[_0xa8d0('0x38')](_0xf9267d,function(_0x1352ed){if(_0x1352ed[_0xa8d0('0x15')]!==_0xa8d0('0x39')){var _0x5b2d5e={};_0x5b2d5e[_0x1352ed[_0xa8d0('0x11')]]={'$like':'%'+_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3a')]+'%'};return _0x5b2d5e;}})});}_0x1e325a=_['merge']({},_0x1e325a,_0x5cf619[_0xa8d0('0x3b')]);var _0x4ac500={'where':_0x1e325a[_0xa8d0('0x37')]};return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')](_0x4ac500)[_0xa8d0('0x3e')](function(_0x27515e){_0x32b11a['count']=_0x27515e;if(_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1e325a[_0xa8d0('0x40')]=[{'all':!![]}];}return db[_0xa8d0('0x3c')][_0xa8d0('0x41')](_0x1e325a);})[_0xa8d0('0x3e')](function(_0x5dea4a){_0x32b11a[_0xa8d0('0x42')]=_0x5dea4a;return _0x32b11a;})[_0xa8d0('0x3e')](respondWithFilteredResult(_0x2f0b00,_0x1e325a))[_0xa8d0('0x43')](handleError(_0x2f0b00,null));};exports[_0xa8d0('0x44')]=function(_0xeba90c,_0x2f5186){var _0x1c1e05={'raw':!![],'where':{'id':_0xeba90c['params']['id']}},_0x10dc8b={};_0x10dc8b[_0xa8d0('0x17')]=_['keys'](db[_0xa8d0('0x3c')][_0xa8d0('0x14')]);_0x10dc8b[_0xa8d0('0x19')]=_[_0xa8d0('0x18')](_0xeba90c[_0xa8d0('0x19')]);_0x10dc8b[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],_0x10dc8b[_0xa8d0('0x19')]);_0x1c1e05[_0xa8d0('0x2e')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],qs['fields'](_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1c1e05[_0xa8d0('0x2e')]=_0x1c1e05[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1c1e05[_0xa8d0('0x2e')]:_0x10dc8b['model'];if(_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1c1e05[_0xa8d0('0x40')]=[{'all':!![]}];}_0x1c1e05=_[_0xa8d0('0x36')]({},_0x1c1e05,_0xeba90c[_0xa8d0('0x3b')]);return db[_0xa8d0('0x3c')][_0xa8d0('0x45')](_0x1c1e05)[_0xa8d0('0x3e')](handleEntityNotFound(_0x2f5186,null))['then'](respondWithResult(_0x2f5186,null))[_0xa8d0('0x43')](handleError(_0x2f5186,null));};exports['create']=function(_0x3f6760,_0x1ae68b){return db[_0xa8d0('0x3c')][_0xa8d0('0x46')](_0x3f6760['body'],{})[_0xa8d0('0x3e')](respondWithResult(_0x1ae68b,0xc9))[_0xa8d0('0x43')](handleError(_0x1ae68b,null));};exports['update']=function(_0x22be14,_0x4b0d20){if(_0x22be14[_0xa8d0('0x47')]['id']){delete _0x22be14['body']['id'];}return db['CmHopper'][_0xa8d0('0x45')]({'where':{'id':_0x22be14[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x4b0d20,null))[_0xa8d0('0x3e')](saveUpdates(_0x22be14['body'],null))[_0xa8d0('0x3e')](respondWithResult(_0x4b0d20,null))[_0xa8d0('0x43')](handleError(_0x4b0d20,null));};exports[_0xa8d0('0x49')]=function(_0x352adc,_0x2258d1){return db['CmHopper'][_0xa8d0('0x49')]()['then'](respondWithResult(_0x2258d1,null))[_0xa8d0('0x43')](handleError(_0x2258d1,null));};exports[_0xa8d0('0x4a')]=function(_0x3dd3ae,_0x5a2aef){var _0x900fd0;var _0x149d65=_0x3dd3ae[_0xa8d0('0x48')]['id'];return db[_0xa8d0('0x3c')][_0xa8d0('0x45')]({'where':{'id':_0x3dd3ae['params']['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5a2aef,null))[_0xa8d0('0x3e')](function(_0x5329d3){if(_0x5329d3){return _0x5329d3[_0xa8d0('0x4a')]()[_0xa8d0('0x3e')](function(_0x20b617){return _0x20b617;});}})[_0xa8d0('0x3e')](function(_0x2eeed7){_0x900fd0=_0x2eeed7;if(_0x2eeed7){if(_0x2eeed7[_0xa8d0('0x4b')]||_0x2eeed7[_0xa8d0('0x4c')]){return db[_0x2eeed7['VoiceQueueId']?_0xa8d0('0x4d'):'Campaign']['find']({'where':{'id':_0x2eeed7[_0xa8d0('0x4b')]?_0x2eeed7[_0xa8d0('0x4b')]:_0x2eeed7['CampaignId']},'attributes':['id',_0xa8d0('0x11')],'raw':!![]});}}})[_0xa8d0('0x3e')](function(_0x238a3f){var _0x5bc28c={};if(_0x238a3f){_[_0xa8d0('0x36')](_0x5bc28c,_['omit'](_0x900fd0[_0xa8d0('0x4e')],[_0xa8d0('0x4f'),_0xa8d0('0x50'),'id']));_0x5bc28c[_0xa8d0('0x51')]=0x15;_0x5bc28c[_0xa8d0('0x52')]=_0xa8d0('0x53');_0x5bc28c['campaign']=_0x238a3f[_0xa8d0('0x11')];_0x5bc28c[_0xa8d0('0x54')]=_0x3dd3ae[_0xa8d0('0x55')]['name'];_0x5bc28c[_0xa8d0('0x56')]=_0x3dd3ae[_0xa8d0('0x55')]['id'];_0x5bc28c[_0xa8d0('0x53')]=!![];_0x5bc28c[_0xa8d0('0x57')]=moment()[_0xa8d0('0x58')](_0xa8d0('0x59'));_0x5bc28c[_0xa8d0('0x5a')]=_0x900fd0[_0xa8d0('0x5b')];_0x5bc28c[_0xa8d0('0x5c')]=_0x900fd0[_0xa8d0('0x4b')]?_0xa8d0('0x5d'):_0xa8d0('0x5e');return db[_0xa8d0('0x5f')]['find']({'where':{'id':_0x5bc28c[_0xa8d0('0x60')]},'attributes':['firstName',_0xa8d0('0x61')]})['then'](function(_0x575301){if(!_[_0xa8d0('0x62')](_0x5a2aef)&&!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x63')])){_0x5bc28c['calleridname']=_0x575301['firstName'];if(!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x61')])){_0x5bc28c[_0xa8d0('0x64')]+='\x20'+_0x575301['lastName'];}}})[_0xa8d0('0x65')](function(){return db[_0xa8d0('0x66')][_0xa8d0('0x46')](_0x5bc28c);});}})[_0xa8d0('0x3e')](function(_0x20d3fe){return db[_0xa8d0('0x67')]['destroy']({'where':{'CmHopperId':_0x149d65}});})[_0xa8d0('0x3e')](function(){return _0x5a2aef[_0xa8d0('0x6')](0xcc)[_0xa8d0('0x68')]();})[_0xa8d0('0x43')](handleError(_0x5a2aef,null));};exports[_0xa8d0('0x69')]=function(_0x191df2,_0x3504ac){var _0x3a54a9=[];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x2e2237){_0x3a54a9=_[_0xa8d0('0x18')](_0x2e2237);return _0x191df2['user'][_0xa8d0('0x6a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id',_0xa8d0('0x6c'),_0xa8d0('0x6d')],'raw':!![]});})[_0xa8d0('0x3e')](function(_0x59e607){if(_0x59e607&&_0x59e607['length']){return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x41ebd3){var _0x4820d0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa8d0('0x58')](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_[_0xa8d0('0x38')](_0x59e607,'id')},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x203b29={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x59e607)['filter']([_0xa8d0('0x6d'),0x0])[_0xa8d0('0x38')]('id')[_0xa8d0('0x70')]()},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x5a2817={'$or':[_0x4820d0,_0x203b29]};var _0x682412=[];if(_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x71')]&&_0x191df2[_0xa8d0('0x47')]['direction']===_0xa8d0('0x72')){if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')]['hopperIds'])){_0x5a2817['id']={'$in':_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x76')],[_0xa8d0('0x77'),_0x59e607[0x0]['dialOrderByScheduledAt']===_0xa8d0('0x76')?_0xa8d0('0x78'):'ASC'],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7a')),['id',_0xa8d0('0x78')]];}else{if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')])){_0x5a2817['id']={'$notIn':_0x191df2['body'][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x78')],[_0xa8d0('0x77'),_0x59e607[0x0][_0xa8d0('0x6c')]],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7b')),['id','ASC']];}return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),_0xa8d0('0x5b'),_0xa8d0('0x7e')],'where':_0x5a2817,'order':_0x682412,'transaction':_0x41ebd3,'lock':_0x41ebd3['LOCK'][_0xa8d0('0x7f')],'include':[{'model':db[_0xa8d0('0x5f')],'as':_0xa8d0('0x80'),'attributes':_0x3a54a9,'include':[{'model':db[_0xa8d0('0x81')],'as':_0xa8d0('0x82'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name',_0xa8d0('0x84')]}]})[_0xa8d0('0x3e')](function(_0x4e373c){if(_0x4e373c){return _0x4e373c[_0xa8d0('0xd')]({'UserId':_0x191df2[_0xa8d0('0x55')]['id']},{'transaction':_0x41ebd3});}});});}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x3504ac,null))['then'](respondWithResult(_0x3504ac,null))['catch'](handleError(_0x3504ac,null));};exports['getPreviewRecall']=function(_0x2e50c5,_0x5ea683,_0x1effc3){var _0x29d2c1=[];var _0x185a62=_0x2e50c5[_0xa8d0('0x48')]['id'];var _0x5c8ce5=_0x2e50c5[_0xa8d0('0x55')]['id'];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x37cba8){_0x29d2c1=_[_0xa8d0('0x18')](_0x37cba8);return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x348529){const _0x4509c6={'id':_0x185a62};return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),'recallme'],'where':_0x4509c6,'transaction':_0x348529,'lock':_0x348529[_0xa8d0('0x85')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa8d0('0x80'),'attributes':_0x29d2c1,'include':[{'model':db[_0xa8d0('0x81')],'as':'Company','attributes':['id','name']}]},{'model':db[_0xa8d0('0x86')],'as':_0xa8d0('0x87'),'attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name','dialActive']}]})[_0xa8d0('0x3e')](function(_0x12ad99){if(_0x12ad99){return _0x12ad99['update']({'UserId':_0x5c8ce5},{'transaction':_0x348529});}});});})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5ea683,null))['then'](respondWithResult(_0x5ea683,null))[_0xa8d0('0x43')](handleError(_0x5ea683,null));};exports[_0xa8d0('0x88')]=function(_0x975558,_0x4dad88){return _0x975558['user']['getVoiceQueues']({'where':{'type':_0xa8d0('0x89'),'dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id'],'raw':!![]})[_0xa8d0('0x3e')](function(_0x1815c8){if(_0x1815c8&&_0x1815c8[_0xa8d0('0x30')]){return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_['map'](_0x1815c8,'id')},'$or':[{'UserId':null},{'UserId':_0x975558[_0xa8d0('0x55')]['id']}]}});}return 0x0;})[_0xa8d0('0x3e')](function(_0x379286){if(!_[_0xa8d0('0x62')](_0x379286)&&_[_0xa8d0('0x8a')](_0x379286)){return _0x4dad88[_0xa8d0('0x6')](0xc8)['json']({'contacts':_0x379286});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xa8d0('0x88'),0x194,_0xa8d0('0x8b'));_0x4dad88[_0xa8d0('0xe')](0x194);}})[_0xa8d0('0x43')](handleError(_0x4dad88,null));};exports[_0xa8d0('0x8c')]=function(_0x2e439b,_0xfcdf8c){var _0x543521=shared['timezones'];var _0x458af1=[];_[_0xa8d0('0x38')](_0x543521,function(_0x4eb658){_0x458af1[_0xa8d0('0x8d')]({'id':_0x4eb658['name'],'name':_0x4eb658['name'],'utcOffset':_0x4eb658[_0xa8d0('0x8e')]});});return _0xfcdf8c[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')]({'tz':_0x458af1});};exports[_0xa8d0('0x8f')]=function(_0x1d8197,_0x2be1ad){var _0x76609=shared[_0xa8d0('0x90')];var _0x4fc9fe={};if(!_[_0xa8d0('0x62')](_0x76609[_0x1d8197['body']['id']]))_0x4fc9fe=_0x76609[_0x1d8197[_0xa8d0('0x47')]['id']];return _0x2be1ad[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')](_0x4fc9fe);}; \ No newline at end of file +var _0x46ed=['catch','show','params','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','createdAt','state','statedesc','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','keys','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Company','CmList','List','Queue','dialActive','getPreviewRecall','LOCK','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','update','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','intersection','concat','$and','$gt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x110bb7,_0x56c479){var _0x1e6ac2=function(_0x27ca58){while(--_0x27ca58){_0x110bb7['push'](_0x110bb7['shift']());}};_0x1e6ac2(++_0x56c479);}(_0x46ed,0x168));var _0xd46e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x46ed[_0x25e7cb];return _0x375d92;};'use strict';var moment=require(_0xd46e('0x0'));var _=require(_0xd46e('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xd46e('0x2'))(_0xd46e('0x3'));var shared=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x2e6b84,_0x4518b8){_0x4518b8=_0x4518b8||0xc8;return function(_0x54ef98){if(_0x54ef98){return _0x2e6b84[_0xd46e('0x5')](_0x4518b8)[_0xd46e('0x6')](_0x54ef98);}};}function respondWithFilteredResult(_0x160bcf,_0x25cf78){return function(_0x45e680){if(_0x45e680){var _0x855f24=typeof _0x25cf78[_0xd46e('0x7')]===_0xd46e('0x8')&&typeof _0x25cf78[_0xd46e('0x9')]===_0xd46e('0x8');var _0x3af67d=_0x45e680['count'];var _0x7b2d69=_0x855f24?0x0:_0x25cf78[_0xd46e('0x7')];var _0x50ccd3=_0x855f24?_0x45e680[_0xd46e('0xa')]:_0x25cf78[_0xd46e('0x7')]+_0x25cf78[_0xd46e('0x9')];var _0x443000;if(_0x50ccd3>=_0x3af67d){_0x50ccd3=_0x3af67d;_0x443000=0xc8;}else{_0x443000=0xce;}_0x160bcf[_0xd46e('0x5')](_0x443000);return _0x160bcf[_0xd46e('0xb')]('Content-Range',_0x7b2d69+'-'+_0x50ccd3+'/'+_0x3af67d)[_0xd46e('0x6')](_0x45e680);}return null;};}function saveUpdates(_0x5bc1da,_0x48550b){return function(_0xf3048c){if(_0xf3048c){return _0xf3048c[_0xd46e('0xc')](_0x5bc1da)['then'](function(_0x5a3076){return _0x5a3076;});}return null;};}function handleEntityNotFound(_0xacd799,_0x4688ae){return function(_0x1e9aae){if(!_0x1e9aae){_0xacd799[_0xd46e('0xd')](0x194);}return _0x1e9aae;};}function handleError(_0x50c7c3,_0x3b6d25){_0x3b6d25=_0x3b6d25||0x1f4;return function(_0x44a620){logger[_0xd46e('0xe')](_0x44a620[_0xd46e('0xf')]);if(_0x44a620[_0xd46e('0x10')]){delete _0x44a620['name'];}_0x50c7c3[_0xd46e('0x5')](_0x3b6d25)[_0xd46e('0x11')](_0x44a620);};}exports[_0xd46e('0x12')]=function(_0x551358,_0x5ddd04){var _0x2e8f6d={},_0x1bd574={},_0x488690={'count':0x0,'rows':[]};var _0x4fd1f2=_[_0xd46e('0x13')](db[_0xd46e('0x14')][_0xd46e('0x15')],function(_0x2273c5){return{'name':_0x2273c5[_0xd46e('0x16')],'type':_0x2273c5[_0xd46e('0x17')][_0xd46e('0x18')]};});_0x1bd574[_0xd46e('0x19')]=_[_0xd46e('0x13')](_0x4fd1f2,_0xd46e('0x10'));_0x1bd574[_0xd46e('0x1a')]=_['keys'](_0x551358[_0xd46e('0x1a')]);_0x1bd574[_0xd46e('0x1b')]=_[_0xd46e('0x1c')](_0x1bd574[_0xd46e('0x19')],_0x1bd574[_0xd46e('0x1a')]);_0x1bd574[_0xd46e('0x1b')]=_[_0xd46e('0x1d')](_0x1bd574[_0xd46e('0x1b')],[_0xd46e('0x1e'),'$or',_0xd46e('0x1f'),'$gte','$lt',_0xd46e('0x20'),_0xd46e('0x21'),_0xd46e('0x22'),_0xd46e('0x23'),_0xd46e('0x24'),_0xd46e('0x25'),_0xd46e('0x26'),'$notIn',_0xd46e('0x27'),_0xd46e('0x28'),_0xd46e('0x29'),_0xd46e('0x2a'),_0xd46e('0x27'),_0xd46e('0x2b'),'$contains',_0xd46e('0x2c'),_0xd46e('0x2d')]);_0x2e8f6d[_0xd46e('0x2e')]=_[_0xd46e('0x1c')](_0x1bd574[_0xd46e('0x19')],qs[_0xd46e('0x2f')](_0x551358[_0xd46e('0x1a')][_0xd46e('0x2f')]));_0x2e8f6d[_0xd46e('0x2e')]=_0x2e8f6d[_0xd46e('0x2e')][_0xd46e('0x30')]?_0x2e8f6d[_0xd46e('0x2e')]:_0x1bd574[_0xd46e('0x19')];if(!_0x551358['query'][_0xd46e('0x31')](_0xd46e('0x32'))){_0x2e8f6d[_0xd46e('0x9')]=qs[_0xd46e('0x9')](_0x551358['query'][_0xd46e('0x9')]);_0x2e8f6d[_0xd46e('0x7')]=qs['offset'](_0x551358[_0xd46e('0x1a')][_0xd46e('0x7')]);}_0x2e8f6d['order']=qs[_0xd46e('0x33')](_0x551358[_0xd46e('0x1a')][_0xd46e('0x33')]);_0x2e8f6d['where']=qs['filters'](_[_0xd46e('0x34')](_0x551358[_0xd46e('0x1a')],_0x1bd574[_0xd46e('0x1b')]),_0x4fd1f2);if(_0x551358[_0xd46e('0x1a')][_0xd46e('0x35')]){_0x2e8f6d[_0xd46e('0x36')]=_[_0xd46e('0x37')](_0x2e8f6d[_0xd46e('0x36')],{'$or':_['map'](_0x4fd1f2,function(_0x4fb62e){if(_0x4fb62e[_0xd46e('0x17')]!==_0xd46e('0x38')){var _0x83aec1={};_0x83aec1[_0x4fb62e[_0xd46e('0x10')]]={'$like':'%'+_0x551358[_0xd46e('0x1a')][_0xd46e('0x35')]+'%'};return _0x83aec1;}})});}_0x2e8f6d=_['merge']({},_0x2e8f6d,_0x551358[_0xd46e('0x39')]);var _0x357212={'where':_0x2e8f6d['where']};return db[_0xd46e('0x14')][_0xd46e('0xa')](_0x357212)[_0xd46e('0x3a')](function(_0x3b6e67){_0x488690['count']=_0x3b6e67;if(_0x551358[_0xd46e('0x1a')][_0xd46e('0x3b')]){_0x2e8f6d[_0xd46e('0x3c')]=[{'all':!![]}];}return db[_0xd46e('0x14')][_0xd46e('0x3d')](_0x2e8f6d);})[_0xd46e('0x3a')](function(_0x220c57){_0x488690[_0xd46e('0x3e')]=_0x220c57;return _0x488690;})['then'](respondWithFilteredResult(_0x5ddd04,_0x2e8f6d))[_0xd46e('0x3f')](handleError(_0x5ddd04,null));};exports[_0xd46e('0x40')]=function(_0xc83ea1,_0x25657a){var _0x165ce8={'raw':!![],'where':{'id':_0xc83ea1[_0xd46e('0x41')]['id']}},_0x56f99c={};_0x56f99c['model']=_['keys'](db['CmHopper']['rawAttributes']);_0x56f99c[_0xd46e('0x1a')]=_['keys'](_0xc83ea1[_0xd46e('0x1a')]);_0x56f99c[_0xd46e('0x1b')]=_['intersection'](_0x56f99c[_0xd46e('0x19')],_0x56f99c[_0xd46e('0x1a')]);_0x165ce8[_0xd46e('0x2e')]=_[_0xd46e('0x1c')](_0x56f99c[_0xd46e('0x19')],qs[_0xd46e('0x2f')](_0xc83ea1[_0xd46e('0x1a')][_0xd46e('0x2f')]));_0x165ce8[_0xd46e('0x2e')]=_0x165ce8[_0xd46e('0x2e')][_0xd46e('0x30')]?_0x165ce8['attributes']:_0x56f99c['model'];if(_0xc83ea1['query'][_0xd46e('0x3b')]){_0x165ce8['include']=[{'all':!![]}];}_0x165ce8=_[_0xd46e('0x37')]({},_0x165ce8,_0xc83ea1[_0xd46e('0x39')]);return db[_0xd46e('0x14')][_0xd46e('0x42')](_0x165ce8)[_0xd46e('0x3a')](handleEntityNotFound(_0x25657a,null))[_0xd46e('0x3a')](respondWithResult(_0x25657a,null))[_0xd46e('0x3f')](handleError(_0x25657a,null));};exports[_0xd46e('0x43')]=function(_0x4cd3d0,_0x324bd0){return db['CmHopper'][_0xd46e('0x43')](_0x4cd3d0[_0xd46e('0x44')],{})[_0xd46e('0x3a')](respondWithResult(_0x324bd0,0xc9))[_0xd46e('0x3f')](handleError(_0x324bd0,null));};exports[_0xd46e('0xc')]=function(_0x5d65ca,_0x384b6e){if(_0x5d65ca[_0xd46e('0x44')]['id']){delete _0x5d65ca[_0xd46e('0x44')]['id'];}return db[_0xd46e('0x14')][_0xd46e('0x42')]({'where':{'id':_0x5d65ca['params']['id']}})[_0xd46e('0x3a')](handleEntityNotFound(_0x384b6e,null))[_0xd46e('0x3a')](saveUpdates(_0x5d65ca[_0xd46e('0x44')],null))[_0xd46e('0x3a')](respondWithResult(_0x384b6e,null))[_0xd46e('0x3f')](handleError(_0x384b6e,null));};exports['describe']=function(_0x341d9f,_0x3ea9e6){return db[_0xd46e('0x14')][_0xd46e('0x45')]()[_0xd46e('0x3a')](respondWithResult(_0x3ea9e6,null))[_0xd46e('0x3f')](handleError(_0x3ea9e6,null));};exports[_0xd46e('0x46')]=function(_0x440dcc,_0x5188f6){var _0xf9dab;var _0x71a8dc=_0x440dcc[_0xd46e('0x41')]['id'];return db[_0xd46e('0x14')][_0xd46e('0x42')]({'where':{'id':_0x440dcc['params']['id']}})['then'](handleEntityNotFound(_0x5188f6,null))[_0xd46e('0x3a')](function(_0x38f989){if(_0x38f989){return _0x38f989[_0xd46e('0x46')]()['then'](function(_0x479711){return _0x479711;});}})[_0xd46e('0x3a')](function(_0x9d8638){_0xf9dab=_0x9d8638;if(_0x9d8638){if(_0x9d8638['VoiceQueueId']||_0x9d8638[_0xd46e('0x47')]){return db[_0x9d8638[_0xd46e('0x48')]?_0xd46e('0x49'):_0xd46e('0x4a')][_0xd46e('0x42')]({'where':{'id':_0x9d8638[_0xd46e('0x48')]?_0x9d8638[_0xd46e('0x48')]:_0x9d8638[_0xd46e('0x47')]},'attributes':['id','name'],'raw':!![]});}}})[_0xd46e('0x3a')](function(_0x259a1d){var _0x1c7f92={};if(_0x259a1d){_[_0xd46e('0x37')](_0x1c7f92,_['omit'](_0xf9dab['dataValues'],[_0xd46e('0x4b'),'updatedAt','id']));_0x1c7f92[_0xd46e('0x4c')]=0x15;_0x1c7f92[_0xd46e('0x4d')]=_0xd46e('0x4e');_0x1c7f92[_0xd46e('0x4f')]=_0x259a1d[_0xd46e('0x10')];_0x1c7f92[_0xd46e('0x50')]=_0x440dcc['user'][_0xd46e('0x10')];_0x1c7f92[_0xd46e('0x51')]=_0x440dcc[_0xd46e('0x52')]['id'];_0x1c7f92['deleted']=!![];_0x1c7f92[_0xd46e('0x53')]=moment()[_0xd46e('0x54')](_0xd46e('0x55'));_0x1c7f92[_0xd46e('0x56')]=_0xf9dab[_0xd46e('0x57')];_0x1c7f92[_0xd46e('0x58')]=_0xf9dab[_0xd46e('0x48')]?_0xd46e('0x59'):_0xd46e('0x5a');return db[_0xd46e('0x5b')][_0xd46e('0x42')]({'where':{'id':_0x1c7f92[_0xd46e('0x5c')]},'attributes':[_0xd46e('0x5d'),_0xd46e('0x5e')]})['then'](function(_0x3ec709){if(!_[_0xd46e('0x5f')](_0x5188f6)&&!_[_0xd46e('0x5f')](_0x3ec709[_0xd46e('0x5d')])){_0x1c7f92['calleridname']=_0x3ec709[_0xd46e('0x5d')];if(!_[_0xd46e('0x5f')](_0x3ec709[_0xd46e('0x5e')])){_0x1c7f92[_0xd46e('0x60')]+='\x20'+_0x3ec709['lastName'];}}})[_0xd46e('0x61')](function(){return db[_0xd46e('0x62')]['create'](_0x1c7f92);});}})['then'](function(_0x45e102){return db[_0xd46e('0x63')][_0xd46e('0x46')]({'where':{'CmHopperId':_0x71a8dc}});})['then'](function(){return _0x5188f6['status'](0xcc)[_0xd46e('0x64')]();})[_0xd46e('0x3f')](handleError(_0x5188f6,null));};exports[_0xd46e('0x65')]=function(_0x263425,_0x2dacb4){var _0x2f9fcb=[];return db[_0xd46e('0x5b')][_0xd46e('0x45')]()[_0xd46e('0x3a')](function(_0x2a172c){_0x2f9fcb=_[_0xd46e('0x66')](_0x2a172c);return _0x263425[_0xd46e('0x52')][_0xd46e('0x67')]({'where':{'type':_0xd46e('0x68'),'dialActive':!![],'dialMethod':_0xd46e('0x69')},'attributes':['id',_0xd46e('0x6a'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xd46e('0x3a')](function(_0x1a3771){if(_0x1a3771&&_0x1a3771[_0xd46e('0x30')]){return db['sequelize'][_0xd46e('0x6b')](function(_0x313c7e){var _0x4dec29={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd46e('0x54')](_0xd46e('0x55'))},'VoiceQueueId':{'$in':_[_0xd46e('0x13')](_0x1a3771,'id')},'$or':[{'UserId':null},{'UserId':_0x263425['user']['id']}]};var _0x41ab84={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1a3771)[_0xd46e('0x35')]([_0xd46e('0x6c'),0x0])['map']('id')[_0xd46e('0x6d')]()},'$or':[{'UserId':null},{'UserId':_0x263425['user']['id']}]};var _0x32eed0={'$or':[_0x4dec29,_0x41ab84]};var _0x148187=[];if(_0x263425[_0xd46e('0x44')]['direction']&&_0x263425[_0xd46e('0x44')][_0xd46e('0x6e')]===_0xd46e('0x6f')){if(!_[_0xd46e('0x70')](_0x263425[_0xd46e('0x44')][_0xd46e('0x71')])){_0x32eed0['id']={'$in':_0x263425[_0xd46e('0x44')][_0xd46e('0x71')]};}_0x148187=[[_0xd46e('0x72'),_0xd46e('0x73')],[_0xd46e('0x74'),_0x1a3771[0x0][_0xd46e('0x6a')]===_0xd46e('0x73')?_0xd46e('0x75'):'ASC'],db['sequelize'][_0xd46e('0x76')](_0xd46e('0x77')),['id',_0xd46e('0x75')]];}else{if(!_[_0xd46e('0x70')](_0x263425[_0xd46e('0x44')]['hopperIds'])){_0x32eed0['id']={'$notIn':_0x263425[_0xd46e('0x44')][_0xd46e('0x71')]};}_0x148187=[[_0xd46e('0x72'),_0xd46e('0x75')],['scheduledAt',_0x1a3771[0x0][_0xd46e('0x6a')]],db[_0xd46e('0x78')]['literal'](_0xd46e('0x79')),['id',_0xd46e('0x73')]];}return db['CmHopper'][_0xd46e('0x7a')]({'attributes':['id',_0xd46e('0x7b'),'phone',_0xd46e('0x7c')],'where':_0x32eed0,'order':_0x148187,'transaction':_0x313c7e,'lock':_0x313c7e['LOCK'][_0xd46e('0x7d')],'include':[{'model':db[_0xd46e('0x5b')],'as':'Contact','attributes':_0x2f9fcb,'include':[{'model':db['CmCompany'],'as':_0xd46e('0x7e'),'attributes':['id',_0xd46e('0x10')]}]},{'model':db[_0xd46e('0x7f')],'as':_0xd46e('0x80'),'attributes':['id','name']},{'model':db[_0xd46e('0x49')],'as':_0xd46e('0x81'),'attributes':['id','name',_0xd46e('0x82')]}]})[_0xd46e('0x3a')](function(_0x2d2af0){if(_0x2d2af0){return _0x2d2af0[_0xd46e('0xc')]({'UserId':_0x263425[_0xd46e('0x52')]['id']},{'transaction':_0x313c7e});}});});}})[_0xd46e('0x3a')](handleEntityNotFound(_0x2dacb4,null))[_0xd46e('0x3a')](respondWithResult(_0x2dacb4,null))[_0xd46e('0x3f')](handleError(_0x2dacb4,null));};exports[_0xd46e('0x83')]=function(_0x556fed,_0x2bfffc,_0x1c1bae){var _0x5ce170=[];var _0x39fe4d=_0x556fed[_0xd46e('0x41')]['id'];var _0x1a28c1=_0x556fed[_0xd46e('0x52')]['id'];return db[_0xd46e('0x5b')][_0xd46e('0x45')]()['then'](function(_0x553496){_0x5ce170=_[_0xd46e('0x66')](_0x553496);return db[_0xd46e('0x78')]['transaction'](function(_0x4cb510){const _0x484805={'id':_0x39fe4d};return db[_0xd46e('0x14')][_0xd46e('0x7a')]({'attributes':['id',_0xd46e('0x7b'),'recallme'],'where':_0x484805,'transaction':_0x4cb510,'lock':_0x4cb510[_0xd46e('0x84')][_0xd46e('0x7d')],'include':[{'model':db[_0xd46e('0x5b')],'as':'Contact','attributes':_0x5ce170,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db[_0xd46e('0x7f')],'as':'List','attributes':['id',_0xd46e('0x10')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xd46e('0x10'),_0xd46e('0x82')]}]})[_0xd46e('0x3a')](function(_0x2754ff){if(_0x2754ff){return _0x2754ff[_0xd46e('0xc')]({'UserId':_0x1a28c1},{'transaction':_0x4cb510});}});});})[_0xd46e('0x3a')](handleEntityNotFound(_0x2bfffc,null))['then'](respondWithResult(_0x2bfffc,null))['catch'](handleError(_0x2bfffc,null));};exports[_0xd46e('0x85')]=function(_0x383919,_0x114f2c){return _0x383919[_0xd46e('0x52')]['getVoiceQueues']({'where':{'type':_0xd46e('0x68'),'dialActive':!![],'dialMethod':_0xd46e('0x69')},'attributes':['id'],'raw':!![]})['then'](function(_0x1309b5){if(_0x1309b5&&_0x1309b5['length']){return db[_0xd46e('0x14')][_0xd46e('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xd46e('0x13')](_0x1309b5,'id')},'$or':[{'UserId':null},{'UserId':_0x383919[_0xd46e('0x52')]['id']}]}});}return 0x0;})[_0xd46e('0x3a')](function(_0x5ef4cc){if(!_[_0xd46e('0x5f')](_0x5ef4cc)&&_[_0xd46e('0x86')](_0x5ef4cc)){return _0x114f2c[_0xd46e('0x5')](0xc8)[_0xd46e('0x6')]({'contacts':_0x5ef4cc});}else{logger[_0xd46e('0xe')](_0xd46e('0x87'),_0xd46e('0x85'),0x194,_0xd46e('0x88'));_0x114f2c[_0xd46e('0xd')](0x194);}})[_0xd46e('0x3f')](handleError(_0x114f2c,null));};exports[_0xd46e('0x89')]=function(_0xb86db,_0x3c476d){var _0x1b2a6d=shared[_0xd46e('0x8a')];var _0x1aa930=[];_[_0xd46e('0x13')](_0x1b2a6d,function(_0x1d2738){_0x1aa930['push']({'id':_0x1d2738[_0xd46e('0x10')],'name':_0x1d2738['name'],'utcOffset':_0x1d2738[_0xd46e('0x8b')]});});return _0x3c476d[_0xd46e('0x5')](0xc8)['json']({'tz':_0x1aa930});};exports[_0xd46e('0x8c')]=function(_0x21b837,_0xf22c0c){var _0x20730a=shared[_0xd46e('0x8a')];var _0x1d07a0={};if(!_[_0xd46e('0x5f')](_0x20730a[_0x21b837[_0xd46e('0x44')]['id']]))_0x1d07a0=_0x20730a[_0x21b837[_0xd46e('0x44')]['id']];return _0xf22c0c[_0xd46e('0x5')](0xc8)[_0xd46e('0x6')](_0x1d07a0);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c8fe4b6..4666ca8 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 _0x5496=['request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x276c51,_0x471517){var _0x2bf9a4=function(_0x349daf){while(--_0x349daf){_0x276c51['push'](_0x276c51['shift']());}};_0x2bf9a4(++_0x471517);}(_0x5496,0x175));var _0x6549=function(_0x4aa10e,_0x3e6e74){_0x4aa10e=_0x4aa10e-0x0;var _0x55c70f=_0x5496[_0x4aa10e];return _0x55c70f;};'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')]('CmHopper',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'phone','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x1967,0x173));var _0x7196=function(_0x4faaba,_0x474e5f){_0x4faaba=_0x4faaba-0x0;var _0x30e5f0=_0x1967[_0x4faaba];return _0x30e5f0;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['scheduledat']},{'name':_0x7196('0xe'),'fields':[_0x7196('0xe')]},{'name':_0x7196('0xf'),'fields':[_0x7196('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e52b9fe..a08e106 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 _0x4cdc=['../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','limit','include','map','model','attributes','then','debug','stringify','catch','error','message','find','raw','where','info','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','keys','User','Agent','name','voicePause','length','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','UserId','UPDATE','GetCmHopperPreview','Contact','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','CmList','List','lodash','util'];(function(_0x348eea,_0x3b1098){var _0x516b89=function(_0x173846){while(--_0x173846){_0x348eea['push'](_0x348eea['shift']());}};_0x516b89(++_0x3b1098);}(_0x4cdc,0x13a));var _0xc4cd=function(_0x362daa,_0x44dfd8){_0x362daa=_0x362daa-0x0;var _0x517271=_0x4cdc[_0x362daa];return _0x517271;};'use strict';var _=require(_0xc4cd('0x0'));var util=require(_0xc4cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require(_0xc4cd('0x2'))['db'];var logger=require(_0xc4cd('0x3'))('rpc');exports[_0xc4cd('0x4')]=function(_0x4e80e3){var _0x3fe472=this;return new Promise(function(_0x3bca24,_0xa1c2fa){return db[_0xc4cd('0x5')][_0xc4cd('0x6')]({'raw':_0x4e80e3[_0xc4cd('0x7')]?_0x4e80e3[_0xc4cd('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x4e80e3[_0xc4cd('0x7')]?_0x4e80e3[_0xc4cd('0x7')]['where']||null:null,'attributes':_0x4e80e3[_0xc4cd('0x7')]?_0x4e80e3[_0xc4cd('0x7')]['attributes']||null:null,'limit':_0x4e80e3[_0xc4cd('0x7')]?_0x4e80e3[_0xc4cd('0x7')][_0xc4cd('0x8')]||null:null,'include':_0x4e80e3[_0xc4cd('0x7')]?_0x4e80e3['options'][_0xc4cd('0x9')]?_[_0xc4cd('0xa')](_0x4e80e3['options'][_0xc4cd('0x9')],function(_0x2599f1){return{'model':db[_0x2599f1[_0xc4cd('0xb')]],'as':_0x2599f1['as'],'attributes':_0x2599f1[_0xc4cd('0xc')],'include':_0x2599f1['include']?_[_0xc4cd('0xa')](_0x2599f1[_0xc4cd('0x9')],function(_0x1590ce){return{'model':db[_0x1590ce[_0xc4cd('0xb')]],'as':_0x1590ce['as'],'attributes':_0x1590ce[_0xc4cd('0xc')],'include':_0x1590ce[_0xc4cd('0x9')]?_['map'](_0x1590ce[_0xc4cd('0x9')],function(_0x43116c){return{'model':db[_0x43116c[_0xc4cd('0xb')]],'as':_0x43116c['as'],'attributes':_0x43116c[_0xc4cd('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc4cd('0xd')](function(_0x50637d){logger['info'](_0xc4cd('0x4'),_0x4e80e3);logger[_0xc4cd('0xe')](_0xc4cd('0x4'),_0x4e80e3,JSON[_0xc4cd('0xf')](_0x50637d));_0x3bca24(_0x50637d);})[_0xc4cd('0x10')](function(_0xe20e3d){logger[_0xc4cd('0x11')]('GetCmHopper',_0xe20e3d[_0xc4cd('0x12')],_0x4e80e3);_0xa1c2fa(_0x3fe472['error'](0x1f4,_0xe20e3d[_0xc4cd('0x12')]));});});};exports['ShowCmHopper']=function(_0x4c806c){var _0x26d589=this;return new Promise(function(_0x25ce9b,_0x5e9e4d){return db['CmHopper'][_0xc4cd('0x13')]({'raw':_0x4c806c[_0xc4cd('0x7')]?_0x4c806c[_0xc4cd('0x7')][_0xc4cd('0x14')]===undefined?!![]:![]:!![],'where':_0x4c806c[_0xc4cd('0x7')]?_0x4c806c[_0xc4cd('0x7')][_0xc4cd('0x15')]||null:null,'attributes':_0x4c806c[_0xc4cd('0x7')]?_0x4c806c['options'][_0xc4cd('0xc')]||null:null,'include':_0x4c806c['options']?_0x4c806c[_0xc4cd('0x7')][_0xc4cd('0x9')]?_[_0xc4cd('0xa')](_0x4c806c[_0xc4cd('0x7')][_0xc4cd('0x9')],function(_0x5d5aeb){return{'model':db[_0x5d5aeb['model']],'as':_0x5d5aeb['as'],'attributes':_0x5d5aeb[_0xc4cd('0xc')],'include':_0x5d5aeb['include']?_[_0xc4cd('0xa')](_0x5d5aeb[_0xc4cd('0x9')],function(_0x4420e2){return{'model':db[_0x4420e2[_0xc4cd('0xb')]],'as':_0x4420e2['as'],'attributes':_0x4420e2[_0xc4cd('0xc')],'include':_0x4420e2[_0xc4cd('0x9')]?_['map'](_0x4420e2[_0xc4cd('0x9')],function(_0x1323b4){return{'model':db[_0x1323b4[_0xc4cd('0xb')]],'as':_0x1323b4['as'],'attributes':_0x1323b4[_0xc4cd('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc4cd('0xd')](function(_0x5bc3d7){logger[_0xc4cd('0x16')](_0xc4cd('0x17'),_0x4c806c);logger[_0xc4cd('0xe')](_0xc4cd('0x17'),_0x4c806c,JSON[_0xc4cd('0xf')](_0x5bc3d7));_0x25ce9b(_0x5bc3d7);})[_0xc4cd('0x10')](function(_0x591aa5){logger['error']('ShowCmHopper',_0x591aa5[_0xc4cd('0x12')],_0x4c806c);_0x5e9e4d(_0x26d589['error'](0x1f4,_0x591aa5[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x18')]=function(_0x4ffcbf){var _0x31377b=this;return new Promise(function(_0x419ac0,_0x374d59){return db['CmHopper'][_0xc4cd('0x19')](_0x4ffcbf[_0xc4cd('0x1a')],{'raw':_0x4ffcbf[_0xc4cd('0x7')]?_0x4ffcbf[_0xc4cd('0x7')][_0xc4cd('0x14')]===undefined?!![]:![]:!![]})[_0xc4cd('0xd')](function(_0x359cbf){logger[_0xc4cd('0x16')](_0xc4cd('0x18'),_0x4ffcbf);logger[_0xc4cd('0xe')]('CreateCmHopper',_0x4ffcbf,JSON[_0xc4cd('0xf')](_0x359cbf));_0x419ac0(_0x359cbf);})[_0xc4cd('0x10')](function(_0x2e46ad){logger[_0xc4cd('0x11')](_0xc4cd('0x18'),_0x2e46ad[_0xc4cd('0x12')],_0x4ffcbf);_0x374d59(_0x31377b[_0xc4cd('0x11')](0x1f4,_0x2e46ad[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x1b')]=function(_0x3ad09b){var _0x31269e=this;return new Promise(function(_0x9b8d54,_0x3dec21){return db[_0xc4cd('0x5')]['update'](_0x3ad09b[_0xc4cd('0x1a')],{'raw':_0x3ad09b[_0xc4cd('0x7')]?_0x3ad09b[_0xc4cd('0x7')][_0xc4cd('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad09b[_0xc4cd('0x7')]?_0x3ad09b[_0xc4cd('0x7')]['where']||null:null,'attributes':_0x3ad09b[_0xc4cd('0x7')]?_0x3ad09b[_0xc4cd('0x7')][_0xc4cd('0xc')]||null:null,'limit':_0x3ad09b['options']?_0x3ad09b[_0xc4cd('0x7')]['limit']||null:null})[_0xc4cd('0xd')](function(_0x14c86e){logger[_0xc4cd('0x16')](_0xc4cd('0x1b'),_0x3ad09b);logger[_0xc4cd('0x16')](_0xc4cd('0x1c'),JSON[_0xc4cd('0xf')](_0x3ad09b[_0xc4cd('0x7')]['where']),_0x3ad09b['body'][_0xc4cd('0x1d')]);logger['debug']('UpdateCmHopper',_0x3ad09b,JSON[_0xc4cd('0xf')](_0x14c86e));_0x9b8d54(_0x14c86e);})[_0xc4cd('0x10')](function(_0x46424b){logger[_0xc4cd('0x11')](_0xc4cd('0x1b'),_0x46424b[_0xc4cd('0x12')],_0x3ad09b);_0x3dec21(_0x31269e[_0xc4cd('0x11')](0x1f4,_0x46424b[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x1e')]=function(_0xc49a97){var _0x19ace6=this;return new Promise(function(_0x195401,_0x1f7a29){return db[_0xc4cd('0x5')][_0xc4cd('0x1f')]({'where':_0xc49a97['options']?_0xc49a97[_0xc4cd('0x7')][_0xc4cd('0x15')]||null:null})['then'](function(_0x255f35){logger[_0xc4cd('0x16')](_0xc4cd('0x1e'),_0xc49a97);logger[_0xc4cd('0xe')](_0xc4cd('0x1e'),_0xc49a97,JSON[_0xc4cd('0xf')](_0x255f35));_0x195401(_0x255f35);})[_0xc4cd('0x10')](function(_0xda9e9){logger[_0xc4cd('0x11')]('DestroyCmHopper',_0xda9e9['message'],_0xc49a97);_0x1f7a29(_0x19ace6[_0xc4cd('0x11')](0x1f4,_0xda9e9[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x20')]=function(_0x2065ae){var _0xc6d778=this;return new Promise(function(_0x53932a,_0xdffc00){return db[_0xc4cd('0x21')][_0xc4cd('0x22')]()[_0xc4cd('0xd')](function(_0x3a77fc){return db[_0xc4cd('0x23')][_0xc4cd('0x24')](function(_0x4041ea){return db[_0xc4cd('0x5')][_0xc4cd('0x6')]({'where':_0x2065ae[_0xc4cd('0x7')]?_0x2065ae[_0xc4cd('0x7')][_0xc4cd('0x15')]||null:null,'attributes':_0x2065ae[_0xc4cd('0x7')]?_0x2065ae[_0xc4cd('0x7')][_0xc4cd('0xc')]||null:null,'limit':_0x2065ae[_0xc4cd('0x7')]?_0x2065ae[_0xc4cd('0x7')][_0xc4cd('0x8')]||null:null,'order':_0x2065ae['options']?_0x2065ae['options'][_0xc4cd('0x25')]||null:null,'transaction':_0x4041ea,'lock':_0x4041ea[_0xc4cd('0x26')]['UPDATE'],'include':[{'model':db[_0xc4cd('0x21')],'as':'Contact','attributes':_[_0xc4cd('0x27')](_0x3a77fc)},{'model':db[_0xc4cd('0x28')],'as':_0xc4cd('0x29'),'attributes':['id',_0xc4cd('0x2a'),_0xc4cd('0x2b')]}]})[_0xc4cd('0xd')](function(_0x5ce798){var _0x54717c=[];var _0x1eb5e5=[];for(var _0x5fe9a3=0x0;_0x5fe9a3<_0x5ce798[_0xc4cd('0x2c')];_0x5fe9a3+=0x1){var _0x273a9a=_0x5ce798[_0x5fe9a3]['UserId'];if(_0x273a9a===null){_0x54717c[_0xc4cd('0x2d')](_0x5ce798[_0x5fe9a3][_0xc4cd('0x2e')](_0x2065ae[_0xc4cd('0x1a')],{'transaction':_0x4041ea}));}else if(!_0x1eb5e5[_0xc4cd('0x2f')](_0x273a9a)){_0x1eb5e5[_0xc4cd('0x2d')](_0x273a9a);_0x54717c['push'](_0x5ce798[_0x5fe9a3]['update'](_0x2065ae[_0xc4cd('0x1a')],{'transaction':_0x4041ea}));}}return BPromise[_0xc4cd('0x30')](_0x54717c);});})[_0xc4cd('0xd')](function(_0x1d32c3){logger['info'](_0xc4cd('0x20'),_0x2065ae);if(_0x1d32c3[_0xc4cd('0x2c')]>0x0){logger[_0xc4cd('0x16')](_0xc4cd('0x31'),_0x1d32c3[0x0]['dataValues']['id'],_0x1d32c3[0x0][_0xc4cd('0x32')][_0xc4cd('0x33')],_0x1d32c3[0x0][_0xc4cd('0x32')][_0xc4cd('0x1d')]);}logger[_0xc4cd('0xe')](_0xc4cd('0x20'),_0x2065ae,JSON[_0xc4cd('0xf')](_0x1d32c3));_0x53932a(_0x1d32c3);})[_0xc4cd('0x10')](function(_0x3aece4){logger[_0xc4cd('0x11')](_0xc4cd('0x20'),_0x3aece4[_0xc4cd('0x12')],_0x2065ae);_0xdffc00(_0xc6d778[_0xc4cd('0x11')](0x1f4,_0x3aece4[_0xc4cd('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x411c64){var _0x5b39a9=this;return new Promise(function(_0x46bc67,_0x2e3ebe){return db[_0xc4cd('0x23')][_0xc4cd('0x24')](function(_0x63c40e){return db[_0xc4cd('0x34')]['create'](_0x411c64[_0xc4cd('0x1a')],{'raw':_0x411c64[_0xc4cd('0x7')]?_0x411c64[_0xc4cd('0x7')][_0xc4cd('0x14')]===undefined?!![]:![]:!![],'transaction':_0x63c40e})[_0xc4cd('0xd')](function(){logger[_0xc4cd('0x16')](_0xc4cd('0x35'),JSON[_0xc4cd('0xf')](_0x411c64[_0xc4cd('0x7')][_0xc4cd('0x15')]),_0x411c64[_0xc4cd('0x7')][_0xc4cd('0x15')]['active']);return db['CmHopper'][_0xc4cd('0x1f')]({'where':_0x411c64[_0xc4cd('0x7')]?_0x411c64[_0xc4cd('0x7')][_0xc4cd('0x15')]||null:null,'transaction':_0x63c40e});});})[_0xc4cd('0xd')](function(_0x26fd4b){logger[_0xc4cd('0x16')]('MoveContactManagedDialer',_0x411c64);logger[_0xc4cd('0xe')]('MoveContactManagedDialer',_0x411c64,JSON[_0xc4cd('0xf')](_0x26fd4b));_0x46bc67(_0x26fd4b);})[_0xc4cd('0x10')](function(_0x2f18fa){logger[_0xc4cd('0x11')](_0xc4cd('0x36'),_0x2f18fa[_0xc4cd('0x12')],_0x411c64);_0x2e3ebe(_0x5b39a9[_0xc4cd('0x11')](0x1f4,_0x2f18fa[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x37')]=function(_0x5e6d18){var _0x53c275=this;return new Promise(function(_0x56804e,_0x17bdcc){return db['CmHopper'][_0xc4cd('0x6')]({'raw':_0x5e6d18[_0xc4cd('0x7')]?_0x5e6d18[_0xc4cd('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x5e6d18[_0xc4cd('0x7')]?_0x5e6d18[_0xc4cd('0x7')]['where']||null:null,'attributes':[[db[_0xc4cd('0x23')]['fn'](_0xc4cd('0x38'),db[_0xc4cd('0x23')]['fn']('IF',db[_0xc4cd('0x23')][_0xc4cd('0x39')](_0xc4cd('0x3a')+util['format'](_0xc4cd('0x3b'),moment()[_0xc4cd('0x3c')](_0xc4cd('0x3d')))+_0xc4cd('0x3e')))),'contactsRescheduled']]})[_0xc4cd('0xd')](function(_0x2a9f62){logger[_0xc4cd('0x16')](_0xc4cd('0x37'),_0x5e6d18);logger[_0xc4cd('0xe')]('CountReScheduled',_0x5e6d18,JSON['stringify'](_0x2a9f62));_0x56804e(_0x2a9f62);})[_0xc4cd('0x10')](function(_0x44b5ea){logger[_0xc4cd('0x11')]('CountReScheduled',_0x44b5ea['message'],_0x5e6d18);_0x17bdcc(_0x53c275['error'](0x1f4,_0x44b5ea[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x3f')]=function(_0x3d16d7){var _0x1f93b8=this;return new Promise(function(_0x12374c,_0xe69b6f){return db[_0xc4cd('0x21')][_0xc4cd('0x22')]()[_0xc4cd('0xd')](function(){return db['sequelize'][_0xc4cd('0x24')](function(_0x5c085a){return db['CmHopper'][_0xc4cd('0x6')]({'where':_0x3d16d7[_0xc4cd('0x7')]?_0x3d16d7['options'][_0xc4cd('0x15')]||null:null,'attributes':_0x3d16d7[_0xc4cd('0x7')]?_0x3d16d7['options']['attributes']||null:null,'limit':0x1,'order':_0x3d16d7[_0xc4cd('0x7')]?_0x3d16d7[_0xc4cd('0x7')][_0xc4cd('0x25')]||null:null,'group':db[_0xc4cd('0x5')][_0xc4cd('0x40')],'transaction':_0x5c085a,'lock':_0x5c085a[_0xc4cd('0x26')][_0xc4cd('0x41')],'include':_0x3d16d7[_0xc4cd('0x7')]?_0x3d16d7['options'][_0xc4cd('0x9')]?_[_0xc4cd('0xa')](_0x3d16d7[_0xc4cd('0x7')][_0xc4cd('0x9')],function(_0x32bdde){return{'model':db[_0x32bdde[_0xc4cd('0xb')]],'as':_0x32bdde['as'],'attributes':_0x32bdde['attributes'],'include':_0x32bdde['include']?_[_0xc4cd('0xa')](_0x32bdde['include'],function(_0x3be04b){return{'model':db[_0x3be04b[_0xc4cd('0xb')]],'as':_0x3be04b['as'],'attributes':_0x3be04b[_0xc4cd('0xc')],'include':_0x3be04b[_0xc4cd('0x9')]?_['map'](_0x3be04b[_0xc4cd('0x9')],function(_0x2dd2ae){return{'model':db[_0x2dd2ae['model']],'as':_0x2dd2ae['as'],'attributes':_0x2dd2ae[_0xc4cd('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b7a56){var _0x5163c6=[];for(var _0x4de20c=0x0;_0x4de20c<_0x1b7a56['length'];_0x4de20c+=0x1){_0x5163c6[_0xc4cd('0x2d')](_0x1b7a56[_0x4de20c][_0xc4cd('0x2e')](_0x3d16d7[_0xc4cd('0x1a')],{'transaction':_0x5c085a}));}return BPromise[_0xc4cd('0x30')](_0x5163c6);});})[_0xc4cd('0xd')](function(_0x8fd39e){logger[_0xc4cd('0x16')](_0xc4cd('0x3f'),_0x3d16d7);logger[_0xc4cd('0xe')](_0xc4cd('0x3f'),_0x3d16d7,JSON[_0xc4cd('0xf')](_0x8fd39e));_0x12374c(_0x8fd39e);})[_0xc4cd('0x10')](function(_0x1274b0){logger[_0xc4cd('0x11')](_0xc4cd('0x3f'),_0x1274b0[_0xc4cd('0x12')],_0x3d16d7);_0xe69b6f(_0x1f93b8[_0xc4cd('0x11')](0x1f4,_0x1274b0[_0xc4cd('0x12')]));});});});};exports[_0xc4cd('0x42')]=function(_0x52838f){var _0x4db59d=this;return new Promise(function(_0xb2e8fc,_0x3da491){db['CmContact'][_0xc4cd('0x22')]()[_0xc4cd('0xd')](function(_0x5cddfd){return db[_0xc4cd('0x5')]['findAll']({'raw':_0x52838f[_0xc4cd('0x7')]?_0x52838f[_0xc4cd('0x7')][_0xc4cd('0x14')]===undefined?!![]:![]:!![],'where':_0x52838f[_0xc4cd('0x7')]?_0x52838f['options'][_0xc4cd('0x15')]||null:null,'attributes':_0x52838f[_0xc4cd('0x7')]?_0x52838f[_0xc4cd('0x7')][_0xc4cd('0xc')]||null:null,'limit':_0x52838f[_0xc4cd('0x7')]?_0x52838f[_0xc4cd('0x7')][_0xc4cd('0x8')]||null:null,'include':_0x52838f[_0xc4cd('0x7')]?_0x52838f[_0xc4cd('0x7')]['include']?_[_0xc4cd('0xa')](_0x52838f[_0xc4cd('0x7')][_0xc4cd('0x9')],function(_0x28e20d){return{'model':db[_0x28e20d[_0xc4cd('0xb')]],'as':_0x28e20d['as'],'attributes':_0x28e20d['as']===_0xc4cd('0x43')?_[_0xc4cd('0x27')](_0x5cddfd):_0x28e20d[_0xc4cd('0xc')],'include':_0x28e20d[_0xc4cd('0x9')]?_[_0xc4cd('0xa')](_0x28e20d['include'],function(_0x53c19d){return{'model':db[_0x53c19d[_0xc4cd('0xb')]],'as':_0x53c19d['as'],'attributes':_0x53c19d[_0xc4cd('0xc')],'include':_0x53c19d['include']?_[_0xc4cd('0xa')](_0x53c19d['include'],function(_0x27604c){return{'model':db[_0x27604c['model']],'as':_0x27604c['as'],'attributes':_0x27604c[_0xc4cd('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc4cd('0xd')](function(_0x5c1ca9){logger[_0xc4cd('0x16')]('GetCmHopper',_0x52838f);logger[_0xc4cd('0xe')](_0xc4cd('0x4'),_0x52838f,JSON[_0xc4cd('0xf')](_0x5c1ca9));_0xb2e8fc(_0x5c1ca9);})[_0xc4cd('0x10')](function(_0x5cae5f){logger[_0xc4cd('0x11')](_0xc4cd('0x4'),_0x5cae5f['message'],_0x52838f);_0x3da491(_0x4db59d[_0xc4cd('0x11')](0x1f4,_0x5cae5f[_0xc4cd('0x12')]));});});});};exports['GetContactByPhone']=function(_0x280f3f){var _0x43600f=this;return new Promise(function(_0x4b1129,_0x194fce){return db[_0xc4cd('0x21')][_0xc4cd('0x44')]({'raw':!![],'where':{'phone':_0x280f3f[_0xc4cd('0x7')][_0xc4cd('0x15')][_0xc4cd('0x45')]},'attributes':['id','dialTimezone'],'order':[['id',_0xc4cd('0x46')]]})['then'](function(_0x3b5a9e){logger[_0xc4cd('0x16')]('getContactByPhone',_0x280f3f);logger[_0xc4cd('0xe')](_0xc4cd('0x47'),_0x280f3f,JSON[_0xc4cd('0xf')](_0x3b5a9e));_0x4b1129(_0x3b5a9e);})[_0xc4cd('0x10')](function(_0x327d15){logger[_0xc4cd('0x11')](_0xc4cd('0x47'),_0x327d15[_0xc4cd('0x12')],_0x280f3f);_0x194fce(_0x43600f[_0xc4cd('0x11')](0x1f4,_0x327d15[_0xc4cd('0x12')]));});});};exports['ResetActiveCalls']=function(_0xe6816d){var _0x30024b=this;return new Promise(function(_0x4c7d59,_0x2a57cb){return db[_0xc4cd('0x23')][_0xc4cd('0x24')](function(_0xbc9195){var _0x48079e=_0xe6816d[_0xc4cd('0x7')]&&_0xe6816d[_0xc4cd('0x7')]['where']?_0xe6816d[_0xc4cd('0x7')][_0xc4cd('0x15')]:{};return db[_0xc4cd('0x5')][_0xc4cd('0x2e')](_0xe6816d[_0xc4cd('0x1a')],{'where':_0x48079e,'transaction':_0xbc9195})['then'](function(_0x20cc91){logger[_0xc4cd('0x16')](_0xc4cd('0x48'),_0xe6816d);logger[_0xc4cd('0xe')]('ResetActiveCalls',_0xe6816d,JSON[_0xc4cd('0xf')](_0x20cc91));_0x4c7d59(_0x20cc91);})[_0xc4cd('0x10')](function(_0x223ae6){logger[_0xc4cd('0x11')](_0xc4cd('0x48'),_0x223ae6[_0xc4cd('0x12')],_0xe6816d);_0x2a57cb(_0x30024b[_0xc4cd('0x11')](0x1f4,_0x223ae6[_0xc4cd('0x12')]));});});});};exports[_0xc4cd('0x49')]=function(_0x2d6a5e){var _0x2c1253=this;var _0x3b0bc8=_0x2d6a5e[_0xc4cd('0x1a')][_0xc4cd('0x15')][_0xc4cd('0x4a')];var _0x2a8d9d=_0x2d6a5e[_0xc4cd('0x1a')][_0xc4cd('0x15')]['interval'];var _0x3f8497=_0x2d6a5e['body'][_0xc4cd('0x15')][_0xc4cd('0x4b')];return new Promise(function(_0x39814c,_0x298b8a){return db[_0xc4cd('0x5')]['findAll']({'where':{'voiceQueueId':{'$in':_0x3b0bc8},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0xc4cd('0x4c')+_0x2a8d9d+'\x20MINUTE'),'$gt':db[_0xc4cd('0x23')][_0xc4cd('0x39')]('NOW()')}},'UserId':{'$in':_0x3f8497}},'include':[{'model':db['CmContact'],'as':_0xc4cd('0x43')},{'model':db['User'],'as':_0xc4cd('0x29'),'attributes':['id','name',_0xc4cd('0x2b')]},{'model':db[_0xc4cd('0x4d')],'as':_0xc4cd('0x4e')}]})[_0xc4cd('0xd')](function(_0x232d21){if(_0x232d21[_0xc4cd('0x2c')]>0x0){return db['sequelize']['transaction'](function(_0x32f5df){return db[_0xc4cd('0x5')][_0xc4cd('0x2e')]({'recallmeNotifiedDate':db[_0xc4cd('0x23')][_0xc4cd('0x39')]('NOW()')},{'where':{'id':{'$in':_[_0xc4cd('0xa')](_0x232d21,'id')}},'transaction':_0x32f5df})[_0xc4cd('0xd')](function(){_0x39814c(_0x232d21);})[_0xc4cd('0x10')](function(_0x20b9a0){logger[_0xc4cd('0x11')](_0xc4cd('0x49'),_0x20b9a0['message'],_0x2d6a5e);_0x298b8a(_0x2c1253[_0xc4cd('0x11')](0x1f4,_0x20b9a0[_0xc4cd('0x12')]));});})['catch'](function(_0x42c308){logger[_0xc4cd('0x11')](_0xc4cd('0x49'),_0x42c308['message'],_0x2d6a5e);_0x298b8a(_0x2c1253[_0xc4cd('0x11')](0x1f4,_0x42c308[_0xc4cd('0x12')]));});}else{_0x39814c(_0x232d21);}});});}; \ No newline at end of file +var _0xc7d1=['NOW()\x20+\x20INTERVAL\x20','NOW()','name','voicePause','CmList','List','lodash','util','moment','../../config/logger','rpc','GetCmHopper','options','attributes','limit','include','map','model','then','debug','stringify','catch','error','message','ShowCmHopper','CmHopper','find','where','info','create','body','CreateCmHopper','UpdateCmHopper','update','raw','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','User','Agent','length','UserId','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','all','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds'];(function(_0xa8733d,_0x5044e4){var _0x151c6a=function(_0x597011){while(--_0x597011){_0xa8733d['push'](_0xa8733d['shift']());}};_0x151c6a(++_0x5044e4);}(_0xc7d1,0xa4));var _0x1c7d=function(_0x2150d9,_0x23c4aa){_0x2150d9=_0x2150d9-0x0;var _0x54fa94=_0xc7d1[_0x2150d9];return _0x54fa94;};'use strict';var _=require(_0x1c7d('0x0'));var util=require(_0x1c7d('0x1'));var moment=require(_0x1c7d('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x1c7d('0x3'))(_0x1c7d('0x4'));exports[_0x1c7d('0x5')]=function(_0x5c6ba5){var _0x268fdd=this;return new Promise(function(_0x43d341,_0xcdde55){return db['CmHopper']['findAll']({'raw':_0x5c6ba5[_0x1c7d('0x6')]?_0x5c6ba5[_0x1c7d('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x5c6ba5[_0x1c7d('0x6')]?_0x5c6ba5[_0x1c7d('0x6')]['where']||null:null,'attributes':_0x5c6ba5[_0x1c7d('0x6')]?_0x5c6ba5[_0x1c7d('0x6')][_0x1c7d('0x7')]||null:null,'limit':_0x5c6ba5[_0x1c7d('0x6')]?_0x5c6ba5[_0x1c7d('0x6')][_0x1c7d('0x8')]||null:null,'include':_0x5c6ba5[_0x1c7d('0x6')]?_0x5c6ba5[_0x1c7d('0x6')][_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x5c6ba5[_0x1c7d('0x6')][_0x1c7d('0x9')],function(_0x38bf0b){return{'model':db[_0x38bf0b['model']],'as':_0x38bf0b['as'],'attributes':_0x38bf0b[_0x1c7d('0x7')],'include':_0x38bf0b[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x38bf0b[_0x1c7d('0x9')],function(_0x5200d4){return{'model':db[_0x5200d4[_0x1c7d('0xb')]],'as':_0x5200d4['as'],'attributes':_0x5200d4[_0x1c7d('0x7')],'include':_0x5200d4['include']?_[_0x1c7d('0xa')](_0x5200d4[_0x1c7d('0x9')],function(_0x4e130c){return{'model':db[_0x4e130c[_0x1c7d('0xb')]],'as':_0x4e130c['as'],'attributes':_0x4e130c['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c7d('0xc')](function(_0x218de9){logger['info'](_0x1c7d('0x5'),_0x5c6ba5);logger[_0x1c7d('0xd')](_0x1c7d('0x5'),_0x5c6ba5,JSON[_0x1c7d('0xe')](_0x218de9));_0x43d341(_0x218de9);})[_0x1c7d('0xf')](function(_0x37b6fb){logger[_0x1c7d('0x10')](_0x1c7d('0x5'),_0x37b6fb[_0x1c7d('0x11')],_0x5c6ba5);_0xcdde55(_0x268fdd['error'](0x1f4,_0x37b6fb[_0x1c7d('0x11')]));});});};exports[_0x1c7d('0x12')]=function(_0x173f99){var _0x494167=this;return new Promise(function(_0x4e804f,_0x51cadf){return db[_0x1c7d('0x13')][_0x1c7d('0x14')]({'raw':_0x173f99[_0x1c7d('0x6')]?_0x173f99['options']['raw']===undefined?!![]:![]:!![],'where':_0x173f99['options']?_0x173f99[_0x1c7d('0x6')][_0x1c7d('0x15')]||null:null,'attributes':_0x173f99[_0x1c7d('0x6')]?_0x173f99['options']['attributes']||null:null,'include':_0x173f99['options']?_0x173f99['options'][_0x1c7d('0x9')]?_['map'](_0x173f99[_0x1c7d('0x6')][_0x1c7d('0x9')],function(_0x4c3f08){return{'model':db[_0x4c3f08[_0x1c7d('0xb')]],'as':_0x4c3f08['as'],'attributes':_0x4c3f08['attributes'],'include':_0x4c3f08[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x4c3f08[_0x1c7d('0x9')],function(_0x51a79f){return{'model':db[_0x51a79f['model']],'as':_0x51a79f['as'],'attributes':_0x51a79f['attributes'],'include':_0x51a79f[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x51a79f[_0x1c7d('0x9')],function(_0x1e60c3){return{'model':db[_0x1e60c3[_0x1c7d('0xb')]],'as':_0x1e60c3['as'],'attributes':_0x1e60c3[_0x1c7d('0x7')]};}):[]};}):[]};}):[]:[]})[_0x1c7d('0xc')](function(_0x1deec1){logger[_0x1c7d('0x16')](_0x1c7d('0x12'),_0x173f99);logger[_0x1c7d('0xd')](_0x1c7d('0x12'),_0x173f99,JSON[_0x1c7d('0xe')](_0x1deec1));_0x4e804f(_0x1deec1);})[_0x1c7d('0xf')](function(_0x58fb5b){logger[_0x1c7d('0x10')](_0x1c7d('0x12'),_0x58fb5b[_0x1c7d('0x11')],_0x173f99);_0x51cadf(_0x494167[_0x1c7d('0x10')](0x1f4,_0x58fb5b[_0x1c7d('0x11')]));});});};exports['CreateCmHopper']=function(_0x3214bb){var _0x352be0=this;return new Promise(function(_0x249074,_0x4785cf){return db[_0x1c7d('0x13')][_0x1c7d('0x17')](_0x3214bb[_0x1c7d('0x18')],{'raw':_0x3214bb[_0x1c7d('0x6')]?_0x3214bb[_0x1c7d('0x6')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xe657d1){logger[_0x1c7d('0x16')](_0x1c7d('0x19'),_0x3214bb);logger[_0x1c7d('0xd')](_0x1c7d('0x19'),_0x3214bb,JSON['stringify'](_0xe657d1));_0x249074(_0xe657d1);})[_0x1c7d('0xf')](function(_0x3f47d9){logger[_0x1c7d('0x10')](_0x1c7d('0x19'),_0x3f47d9[_0x1c7d('0x11')],_0x3214bb);_0x4785cf(_0x352be0['error'](0x1f4,_0x3f47d9[_0x1c7d('0x11')]));});});};exports[_0x1c7d('0x1a')]=function(_0x3eda1a){var _0x33312e=this;return new Promise(function(_0x2311ee,_0x46484e){return db['CmHopper'][_0x1c7d('0x1b')](_0x3eda1a[_0x1c7d('0x18')],{'raw':_0x3eda1a[_0x1c7d('0x6')]?_0x3eda1a['options'][_0x1c7d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3eda1a[_0x1c7d('0x6')]?_0x3eda1a['options'][_0x1c7d('0x15')]||null:null,'attributes':_0x3eda1a[_0x1c7d('0x6')]?_0x3eda1a[_0x1c7d('0x6')][_0x1c7d('0x7')]||null:null,'limit':_0x3eda1a[_0x1c7d('0x6')]?_0x3eda1a[_0x1c7d('0x6')][_0x1c7d('0x8')]||null:null})[_0x1c7d('0xc')](function(_0x34fefd){logger[_0x1c7d('0x16')]('UpdateCmHopper',_0x3eda1a);logger[_0x1c7d('0x16')](_0x1c7d('0x1d'),JSON['stringify'](_0x3eda1a[_0x1c7d('0x6')]['where']),_0x3eda1a[_0x1c7d('0x18')][_0x1c7d('0x1e')]);logger[_0x1c7d('0xd')](_0x1c7d('0x1a'),_0x3eda1a,JSON[_0x1c7d('0xe')](_0x34fefd));_0x2311ee(_0x34fefd);})[_0x1c7d('0xf')](function(_0x276196){logger[_0x1c7d('0x10')](_0x1c7d('0x1a'),_0x276196[_0x1c7d('0x11')],_0x3eda1a);_0x46484e(_0x33312e['error'](0x1f4,_0x276196[_0x1c7d('0x11')]));});});};exports[_0x1c7d('0x1f')]=function(_0x305508){var _0x4c592b=this;return new Promise(function(_0x30cec0,_0x1c43ad){return db[_0x1c7d('0x13')][_0x1c7d('0x20')]({'where':_0x305508[_0x1c7d('0x6')]?_0x305508['options'][_0x1c7d('0x15')]||null:null})[_0x1c7d('0xc')](function(_0x200f2b){logger[_0x1c7d('0x16')](_0x1c7d('0x1f'),_0x305508);logger[_0x1c7d('0xd')]('DestroyCmHopper',_0x305508,JSON[_0x1c7d('0xe')](_0x200f2b));_0x30cec0(_0x200f2b);})[_0x1c7d('0xf')](function(_0x50d5f9){logger[_0x1c7d('0x10')](_0x1c7d('0x1f'),_0x50d5f9[_0x1c7d('0x11')],_0x305508);_0x1c43ad(_0x4c592b[_0x1c7d('0x10')](0x1f4,_0x50d5f9[_0x1c7d('0x11')]));});});};exports[_0x1c7d('0x21')]=function(_0x5acf2a){var _0x354382=this;return new Promise(function(_0x3e1027,_0x1568af){return db[_0x1c7d('0x22')][_0x1c7d('0x23')]()[_0x1c7d('0xc')](function(_0x2807cc){return db[_0x1c7d('0x24')][_0x1c7d('0x25')](function(_0x577f44){return db[_0x1c7d('0x13')][_0x1c7d('0x26')]({'where':_0x5acf2a['options']?_0x5acf2a[_0x1c7d('0x6')][_0x1c7d('0x15')]||null:null,'attributes':_0x5acf2a[_0x1c7d('0x6')]?_0x5acf2a[_0x1c7d('0x6')]['attributes']||null:null,'limit':_0x5acf2a['options']?_0x5acf2a[_0x1c7d('0x6')][_0x1c7d('0x8')]||null:null,'order':_0x5acf2a[_0x1c7d('0x6')]?_0x5acf2a[_0x1c7d('0x6')][_0x1c7d('0x27')]||null:null,'transaction':_0x577f44,'lock':_0x577f44[_0x1c7d('0x28')][_0x1c7d('0x29')],'include':[{'model':db[_0x1c7d('0x22')],'as':_0x1c7d('0x2a'),'attributes':_[_0x1c7d('0x2b')](_0x2807cc)},{'model':db[_0x1c7d('0x2c')],'as':_0x1c7d('0x2d'),'attributes':['id','name','voicePause']}]})[_0x1c7d('0xc')](function(_0x236dd6){var _0x34327e=[];var _0x1e8109=[];for(var _0x151fdb=0x0;_0x151fdb<_0x236dd6[_0x1c7d('0x2e')];_0x151fdb+=0x1){var _0x1ab01f=_0x236dd6[_0x151fdb][_0x1c7d('0x2f')];if(_0x1ab01f===null){_0x34327e[_0x1c7d('0x30')](_0x236dd6[_0x151fdb][_0x1c7d('0x1b')](_0x5acf2a[_0x1c7d('0x18')],{'transaction':_0x577f44}));}else if(!_0x1e8109['includes'](_0x1ab01f)){_0x1e8109[_0x1c7d('0x30')](_0x1ab01f);_0x34327e[_0x1c7d('0x30')](_0x236dd6[_0x151fdb][_0x1c7d('0x1b')](_0x5acf2a[_0x1c7d('0x18')],{'transaction':_0x577f44}));}}return BPromise['all'](_0x34327e);});})[_0x1c7d('0xc')](function(_0x157f6d){logger[_0x1c7d('0x16')](_0x1c7d('0x21'),_0x5acf2a);if(_0x157f6d['length']>0x0){logger[_0x1c7d('0x16')](_0x1c7d('0x31'),_0x157f6d[0x0][_0x1c7d('0x32')]['id'],_0x157f6d[0x0][_0x1c7d('0x32')][_0x1c7d('0x33')],_0x157f6d[0x0][_0x1c7d('0x32')][_0x1c7d('0x1e')]);}logger[_0x1c7d('0xd')](_0x1c7d('0x21'),_0x5acf2a,JSON[_0x1c7d('0xe')](_0x157f6d));_0x3e1027(_0x157f6d);})[_0x1c7d('0xf')](function(_0x38adc8){logger[_0x1c7d('0x10')](_0x1c7d('0x21'),_0x38adc8[_0x1c7d('0x11')],_0x5acf2a);_0x1568af(_0x354382[_0x1c7d('0x10')](0x1f4,_0x38adc8[_0x1c7d('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0x573134){var _0x1d4b83=this;return new Promise(function(_0x25a2db,_0x3b9d1d){return db[_0x1c7d('0x24')][_0x1c7d('0x25')](function(_0x3d05c5){return db[_0x1c7d('0x34')][_0x1c7d('0x17')](_0x573134[_0x1c7d('0x18')],{'raw':_0x573134[_0x1c7d('0x6')]?_0x573134[_0x1c7d('0x6')][_0x1c7d('0x1c')]===undefined?!![]:![]:!![],'transaction':_0x3d05c5})['then'](function(){logger[_0x1c7d('0x16')](_0x1c7d('0x35'),JSON[_0x1c7d('0xe')](_0x573134[_0x1c7d('0x6')][_0x1c7d('0x15')]),_0x573134['options']['where']['active']);return db[_0x1c7d('0x13')][_0x1c7d('0x20')]({'where':_0x573134[_0x1c7d('0x6')]?_0x573134['options'][_0x1c7d('0x15')]||null:null,'transaction':_0x3d05c5});});})[_0x1c7d('0xc')](function(_0x26aba9){logger['info']('MoveContactManagedDialer',_0x573134);logger[_0x1c7d('0xd')]('MoveContactManagedDialer',_0x573134,JSON[_0x1c7d('0xe')](_0x26aba9));_0x25a2db(_0x26aba9);})['catch'](function(_0x3c277c){logger[_0x1c7d('0x10')](_0x1c7d('0x36'),_0x3c277c[_0x1c7d('0x11')],_0x573134);_0x3b9d1d(_0x1d4b83[_0x1c7d('0x10')](0x1f4,_0x3c277c['message']));});});};exports[_0x1c7d('0x37')]=function(_0x557b76){var _0x35588b=this;return new Promise(function(_0x32f7f5,_0x271229){return db[_0x1c7d('0x13')][_0x1c7d('0x26')]({'raw':_0x557b76[_0x1c7d('0x6')]?_0x557b76[_0x1c7d('0x6')][_0x1c7d('0x1c')]===undefined?!![]:![]:!![],'where':_0x557b76[_0x1c7d('0x6')]?_0x557b76[_0x1c7d('0x6')][_0x1c7d('0x15')]||null:null,'attributes':[[db[_0x1c7d('0x24')]['fn'](_0x1c7d('0x38'),db[_0x1c7d('0x24')]['fn']('IF',db[_0x1c7d('0x24')][_0x1c7d('0x39')](_0x1c7d('0x3a')+util[_0x1c7d('0x3b')](_0x1c7d('0x3c'),moment()[_0x1c7d('0x3b')](_0x1c7d('0x3d')))+'\x20,\x201,\x20null'))),_0x1c7d('0x3e')]]})['then'](function(_0x1aa087){logger[_0x1c7d('0x16')](_0x1c7d('0x37'),_0x557b76);logger[_0x1c7d('0xd')]('CountReScheduled',_0x557b76,JSON['stringify'](_0x1aa087));_0x32f7f5(_0x1aa087);})[_0x1c7d('0xf')](function(_0x1213f5){logger[_0x1c7d('0x10')](_0x1c7d('0x37'),_0x1213f5[_0x1c7d('0x11')],_0x557b76);_0x271229(_0x35588b[_0x1c7d('0x10')](0x1f4,_0x1213f5[_0x1c7d('0x11')]));});});};exports[_0x1c7d('0x3f')]=function(_0x33180c){var _0x40548e=this;return new Promise(function(_0x1686a4,_0x2fa15b){return db[_0x1c7d('0x22')][_0x1c7d('0x23')]()[_0x1c7d('0xc')](function(){return db[_0x1c7d('0x24')][_0x1c7d('0x25')](function(_0x29e2a0){return db['CmHopper'][_0x1c7d('0x26')]({'where':_0x33180c[_0x1c7d('0x6')]?_0x33180c['options'][_0x1c7d('0x15')]||null:null,'attributes':_0x33180c[_0x1c7d('0x6')]?_0x33180c[_0x1c7d('0x6')][_0x1c7d('0x7')]||null:null,'limit':0x1,'order':_0x33180c['options']?_0x33180c[_0x1c7d('0x6')][_0x1c7d('0x27')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x29e2a0,'lock':_0x29e2a0[_0x1c7d('0x28')][_0x1c7d('0x29')],'include':_0x33180c[_0x1c7d('0x6')]?_0x33180c['options']['include']?_[_0x1c7d('0xa')](_0x33180c[_0x1c7d('0x6')]['include'],function(_0x3129ee){return{'model':db[_0x3129ee[_0x1c7d('0xb')]],'as':_0x3129ee['as'],'attributes':_0x3129ee[_0x1c7d('0x7')],'include':_0x3129ee[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x3129ee[_0x1c7d('0x9')],function(_0x4d3b19){return{'model':db[_0x4d3b19[_0x1c7d('0xb')]],'as':_0x4d3b19['as'],'attributes':_0x4d3b19[_0x1c7d('0x7')],'include':_0x4d3b19[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x4d3b19['include'],function(_0xe8b41){return{'model':db[_0xe8b41[_0x1c7d('0xb')]],'as':_0xe8b41['as'],'attributes':_0xe8b41[_0x1c7d('0x7')]};}):[]};}):[]};}):[]:[]})[_0x1c7d('0xc')](function(_0x3a4e6e){var _0x4b3c50=[];for(var _0x2cddf8=0x0;_0x2cddf8<_0x3a4e6e['length'];_0x2cddf8+=0x1){_0x4b3c50[_0x1c7d('0x30')](_0x3a4e6e[_0x2cddf8][_0x1c7d('0x1b')](_0x33180c[_0x1c7d('0x18')],{'transaction':_0x29e2a0}));}return BPromise[_0x1c7d('0x40')](_0x4b3c50);});})[_0x1c7d('0xc')](function(_0x92942a){logger['info'](_0x1c7d('0x3f'),_0x33180c);logger['debug'](_0x1c7d('0x3f'),_0x33180c,JSON['stringify'](_0x92942a));_0x1686a4(_0x92942a);})[_0x1c7d('0xf')](function(_0x593b61){logger[_0x1c7d('0x10')](_0x1c7d('0x3f'),_0x593b61[_0x1c7d('0x11')],_0x33180c);_0x2fa15b(_0x40548e['error'](0x1f4,_0x593b61[_0x1c7d('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x12c7c3){var _0x11c879=this;return new Promise(function(_0x14a1a6,_0x1e60ad){db[_0x1c7d('0x22')][_0x1c7d('0x23')]()['then'](function(_0xb46caa){return db[_0x1c7d('0x13')][_0x1c7d('0x26')]({'raw':_0x12c7c3[_0x1c7d('0x6')]?_0x12c7c3[_0x1c7d('0x6')][_0x1c7d('0x1c')]===undefined?!![]:![]:!![],'where':_0x12c7c3[_0x1c7d('0x6')]?_0x12c7c3['options'][_0x1c7d('0x15')]||null:null,'attributes':_0x12c7c3[_0x1c7d('0x6')]?_0x12c7c3[_0x1c7d('0x6')][_0x1c7d('0x7')]||null:null,'limit':_0x12c7c3['options']?_0x12c7c3['options'][_0x1c7d('0x8')]||null:null,'include':_0x12c7c3[_0x1c7d('0x6')]?_0x12c7c3[_0x1c7d('0x6')]['include']?_[_0x1c7d('0xa')](_0x12c7c3[_0x1c7d('0x6')][_0x1c7d('0x9')],function(_0x3acade){return{'model':db[_0x3acade[_0x1c7d('0xb')]],'as':_0x3acade['as'],'attributes':_0x3acade['as']===_0x1c7d('0x2a')?_[_0x1c7d('0x2b')](_0xb46caa):_0x3acade[_0x1c7d('0x7')],'include':_0x3acade['include']?_[_0x1c7d('0xa')](_0x3acade['include'],function(_0x11ec09){return{'model':db[_0x11ec09[_0x1c7d('0xb')]],'as':_0x11ec09['as'],'attributes':_0x11ec09['attributes'],'include':_0x11ec09[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x11ec09[_0x1c7d('0x9')],function(_0xfe9793){return{'model':db[_0xfe9793[_0x1c7d('0xb')]],'as':_0xfe9793['as'],'attributes':_0xfe9793[_0x1c7d('0x7')]};}):[]};}):[]};}):[]:[]})[_0x1c7d('0xc')](function(_0x5eb30f){logger[_0x1c7d('0x16')](_0x1c7d('0x5'),_0x12c7c3);logger[_0x1c7d('0xd')]('GetCmHopper',_0x12c7c3,JSON[_0x1c7d('0xe')](_0x5eb30f));_0x14a1a6(_0x5eb30f);})[_0x1c7d('0xf')](function(_0x1c77e7){logger[_0x1c7d('0x10')](_0x1c7d('0x5'),_0x1c77e7['message'],_0x12c7c3);_0x1e60ad(_0x11c879[_0x1c7d('0x10')](0x1f4,_0x1c77e7[_0x1c7d('0x11')]));});});});};exports[_0x1c7d('0x41')]=function(_0x441f79){var _0x59df3f=this;return new Promise(function(_0x229bff,_0x511fea){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x441f79[_0x1c7d('0x6')]['where'][_0x1c7d('0x42')]},'attributes':['id',_0x1c7d('0x43')],'order':[['id',_0x1c7d('0x44')]]})[_0x1c7d('0xc')](function(_0x4ccca2){logger[_0x1c7d('0x16')](_0x1c7d('0x45'),_0x441f79);logger[_0x1c7d('0xd')](_0x1c7d('0x45'),_0x441f79,JSON[_0x1c7d('0xe')](_0x4ccca2));_0x229bff(_0x4ccca2);})['catch'](function(_0x7e0c0d){logger['error'](_0x1c7d('0x45'),_0x7e0c0d['message'],_0x441f79);_0x511fea(_0x59df3f['error'](0x1f4,_0x7e0c0d[_0x1c7d('0x11')]));});});};exports['ResetActiveCalls']=function(_0x2e4304){var _0x7d3cac=this;return new Promise(function(_0x24b321,_0x29c171){return db[_0x1c7d('0x24')][_0x1c7d('0x25')](function(_0x207b2e){var _0xb67750=_0x2e4304[_0x1c7d('0x6')]&&_0x2e4304[_0x1c7d('0x6')][_0x1c7d('0x15')]?_0x2e4304[_0x1c7d('0x6')]['where']:{};return db[_0x1c7d('0x13')][_0x1c7d('0x1b')](_0x2e4304[_0x1c7d('0x18')],{'where':_0xb67750,'transaction':_0x207b2e})[_0x1c7d('0xc')](function(_0x2502a2){logger['info']('ResetActiveCalls',_0x2e4304);logger[_0x1c7d('0xd')]('ResetActiveCalls',_0x2e4304,JSON[_0x1c7d('0xe')](_0x2502a2));_0x24b321(_0x2502a2);})['catch'](function(_0x32a4c9){logger['error']('ResetActiveCalls',_0x32a4c9['message'],_0x2e4304);_0x29c171(_0x7d3cac[_0x1c7d('0x10')](0x1f4,_0x32a4c9[_0x1c7d('0x11')]));});});});};exports[_0x1c7d('0x46')]=function(_0x285160){var _0x3c16f6=this;var _0x5aea83=_0x285160[_0x1c7d('0x18')][_0x1c7d('0x15')][_0x1c7d('0x47')];var _0x120c85=_0x285160[_0x1c7d('0x18')][_0x1c7d('0x15')]['interval'];var _0x2c1722=_0x285160[_0x1c7d('0x18')][_0x1c7d('0x15')][_0x1c7d('0x48')];return new Promise(function(_0x2a2100,_0x5bb926){return db[_0x1c7d('0x13')][_0x1c7d('0x26')]({'where':{'voiceQueueId':{'$in':_0x5aea83},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x1c7d('0x24')][_0x1c7d('0x39')](_0x1c7d('0x49')+_0x120c85+'\x20MINUTE'),'$gt':db['sequelize'][_0x1c7d('0x39')](_0x1c7d('0x4a'))}},'UserId':{'$in':_0x2c1722}},'include':[{'model':db[_0x1c7d('0x22')],'as':_0x1c7d('0x2a')},{'model':db[_0x1c7d('0x2c')],'as':_0x1c7d('0x2d'),'attributes':['id',_0x1c7d('0x4b'),_0x1c7d('0x4c')]},{'model':db[_0x1c7d('0x4d')],'as':_0x1c7d('0x4e')}]})[_0x1c7d('0xc')](function(_0x1dbc09){if(_0x1dbc09[_0x1c7d('0x2e')]>0x0){return db[_0x1c7d('0x24')][_0x1c7d('0x25')](function(_0x490c33){return db[_0x1c7d('0x13')][_0x1c7d('0x1b')]({'recallmeNotifiedDate':db[_0x1c7d('0x24')][_0x1c7d('0x39')](_0x1c7d('0x4a'))},{'where':{'id':{'$in':_['map'](_0x1dbc09,'id')}},'transaction':_0x490c33})['then'](function(){_0x2a2100(_0x1dbc09);})[_0x1c7d('0xf')](function(_0x335a3d){logger[_0x1c7d('0x10')](_0x1c7d('0x46'),_0x335a3d[_0x1c7d('0x11')],_0x285160);_0x5bb926(_0x3c16f6['error'](0x1f4,_0x335a3d[_0x1c7d('0x11')]));});})[_0x1c7d('0xf')](function(_0x3aae6c){logger[_0x1c7d('0x10')](_0x1c7d('0x46'),_0x3aae6c[_0x1c7d('0x11')],_0x285160);_0x5bb926(_0x3c16f6[_0x1c7d('0x10')](0x1f4,_0x3aae6c[_0x1c7d('0x11')]));});}else{_0x2a2100(_0x1dbc09);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index ebb9510..9bd87cf 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 _0x46ed=['destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','post','create','/preview','getPreview','/timezone','getTimezone','put','update','delete'];(function(_0x27b5a5,_0x18d015){var _0x3fc160=function(_0x3a5436){while(--_0x3a5436){_0x27b5a5['push'](_0x27b5a5['shift']());}};_0x3fc160(++_0x18d015);}(_0x46ed,0xca));var _0xd46e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x46ed[_0x5d6456];return _0x4d66c1;};'use strict';var express=require(_0xd46e('0x0'));var router=express[_0xd46e('0x1')]();var auth=require(_0xd46e('0x2'));var controller=require(_0xd46e('0x3'));router[_0xd46e('0x4')]('/',auth[_0xd46e('0x5')](),controller[_0xd46e('0x6')]);router['get'](_0xd46e('0x7'),auth[_0xd46e('0x5')](),controller['describe']);router[_0xd46e('0x4')](_0xd46e('0x8'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xd46e('0x4')](_0xd46e('0x9'),auth[_0xd46e('0x5')](),controller[_0xd46e('0xa')]);router[_0xd46e('0x4')](_0xd46e('0xb'),auth[_0xd46e('0x5')](),controller[_0xd46e('0xc')]);router[_0xd46e('0x4')](_0xd46e('0xd'),auth[_0xd46e('0x5')](),controller['getPreviewRecall']);router[_0xd46e('0xe')]('/',auth[_0xd46e('0x5')](),controller[_0xd46e('0xf')]);router[_0xd46e('0xe')](_0xd46e('0x10'),auth['isAuthenticated'](),controller[_0xd46e('0x11')]);router['post'](_0xd46e('0x12'),auth[_0xd46e('0x5')](),controller[_0xd46e('0x13')]);router[_0xd46e('0x14')]('/:id',auth[_0xd46e('0x5')](),controller[_0xd46e('0x15')]);router[_0xd46e('0x16')](_0xd46e('0xb'),auth['isAuthenticated'](),controller[_0xd46e('0x17')]);module[_0xd46e('0x18')]=router; \ No newline at end of file +var _0xf944=['Router','../../components/auth/service','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','post','create','/preview','getPreview','put','update','delete','destroy','exports'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xf944,0xb0));var _0x4f94=function(_0x668d13,_0x5e6f3b){_0x668d13=_0x668d13-0x0;var _0x25350b=_0xf944[_0x668d13];return _0x25350b;};'use strict';var express=require('express');var router=express[_0x4f94('0x0')]();var auth=require(_0x4f94('0x1'));var controller=require('./cmHopper.controller');router[_0x4f94('0x2')]('/',auth[_0x4f94('0x3')](),controller['index']);router[_0x4f94('0x2')](_0x4f94('0x4'),auth[_0x4f94('0x3')](),controller[_0x4f94('0x5')]);router[_0x4f94('0x2')](_0x4f94('0x6'),auth[_0x4f94('0x3')](),controller[_0x4f94('0x7')]);router[_0x4f94('0x2')](_0x4f94('0x8'),auth[_0x4f94('0x3')](),controller[_0x4f94('0x9')]);router[_0x4f94('0x2')](_0x4f94('0xa'),auth[_0x4f94('0x3')](),controller[_0x4f94('0xb')]);router[_0x4f94('0x2')](_0x4f94('0xc'),auth['isAuthenticated'](),controller['getPreviewRecall']);router[_0x4f94('0xd')]('/',auth[_0x4f94('0x3')](),controller[_0x4f94('0xe')]);router['post'](_0x4f94('0xf'),auth[_0x4f94('0x3')](),controller[_0x4f94('0x10')]);router[_0x4f94('0xd')]('/timezone',auth['isAuthenticated'](),controller['getTimezone']);router[_0x4f94('0x11')](_0x4f94('0xa'),auth['isAuthenticated'](),controller[_0x4f94('0x12')]);router[_0x4f94('0x13')](_0x4f94('0xa'),auth[_0x4f94('0x3')](),controller[_0x4f94('0x14')]);module[_0x4f94('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 7f55f0c..c7c677a 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 _0xb471=['format','sequelize','exports','INTEGER','DATE'];(function(_0x2e485b,_0x4f5d19){var _0x1ded8e=function(_0x552a1d){while(--_0x552a1d){_0x2e485b['push'](_0x2e485b['shift']());}};_0x1ded8e(++_0x4f5d19);}(_0xb471,0x8d));var _0x1b47=function(_0x53ce04,_0x4f1765){_0x53ce04=_0x53ce04-0x0;var _0xe959b0=_0xb471[_0x53ce04];return _0xe959b0;};'use strict';var moment=require('moment');var Sequelize=require(_0x1b47('0x0'));module[_0x1b47('0x1')]={'CmHopperId':{'type':Sequelize[_0x1b47('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x1b47('0x3')],'defaultValue':moment()[_0x1b47('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaf78=['INTEGER','STRING','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x3bdb17,_0x48e72b){var _0x554d01=function(_0x81753e){while(--_0x81753e){_0x3bdb17['push'](_0x3bdb17['shift']());}};_0x554d01(++_0x48e72b);}(_0xaf78,0xb2));var _0x8af7=function(_0x5d0cd6,_0x14207a){_0x5d0cd6=_0x5d0cd6-0x0;var _0x2ac518=_0xaf78[_0x5d0cd6];return _0x2ac518;};'use strict';var moment=require('moment');var Sequelize=require(_0x8af7('0x0'));module[_0x8af7('0x1')]={'CmHopperId':{'type':Sequelize[_0x8af7('0x2')]},'phone':{'type':Sequelize[_0x8af7('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x8af7('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8af7('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 e6e02ec..33be0a4 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 _0x7281=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','includeAll','CmHopperAdditionalPhone','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','get','end'];(function(_0x620575,_0x5517b8){var _0x4a9d19=function(_0x1aa74a){while(--_0x1aa74a){_0x620575['push'](_0x620575['shift']());}};_0x4a9d19(++_0x5517b8);}(_0x7281,0x81));var _0x1728=function(_0x471723,_0x2f478c){_0x471723=_0x471723-0x0;var _0x5f3e76=_0x7281[_0x471723];return _0x5f3e76;};'use strict';var emlformat=require(_0x1728('0x0'));var rimraf=require(_0x1728('0x1'));var zipdir=require(_0x1728('0x2'));var jsonpatch=require(_0x1728('0x3'));var rp=require('request-promise');var moment=require(_0x1728('0x4'));var BPromise=require(_0x1728('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1728('0x6'));var csv=require(_0x1728('0x7'));var ejs=require(_0x1728('0x8'));var fs=require('fs');var fs_extra=require(_0x1728('0x9'));var _=require(_0x1728('0xa'));var squel=require(_0x1728('0xb'));var crypto=require(_0x1728('0xc'));var jsforce=require(_0x1728('0xd'));var deskjs=require(_0x1728('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1728('0xf'));var Papa=require('papaparse');var Redis=require(_0x1728('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1728('0x11'));var as=require(_0x1728('0x12'));var hardwareService=require(_0x1728('0x13'));var logger=require(_0x1728('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1728('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1728('0x16'))['db'];function respondWithStatusCode(_0x512aec,_0x4eacc5){_0x4eacc5=_0x4eacc5||0xcc;return function(_0xae71c6){if(_0xae71c6){return _0x512aec[_0x1728('0x17')](_0x4eacc5);}return _0x512aec[_0x1728('0x18')](_0x4eacc5)['end']();};}function respondWithResult(_0x5ccc11,_0x4c1166){_0x4c1166=_0x4c1166||0xc8;return function(_0x115be1){if(_0x115be1){return _0x5ccc11[_0x1728('0x18')](_0x4c1166)['json'](_0x115be1);}};}function respondWithFilteredResult(_0x379150,_0x2fe4e3){return function(_0x1c5019){if(_0x1c5019){var _0x265321=typeof _0x2fe4e3[_0x1728('0x19')]===_0x1728('0x1a')&&typeof _0x2fe4e3[_0x1728('0x1b')]==='undefined';var _0x45bced=_0x1c5019[_0x1728('0x1c')];var _0x56ac52=_0x265321?0x0:_0x2fe4e3[_0x1728('0x19')];var _0x527c03=_0x265321?_0x1c5019['count']:_0x2fe4e3['offset']+_0x2fe4e3[_0x1728('0x1b')];var _0x522154;if(_0x527c03>=_0x45bced){_0x527c03=_0x45bced;_0x522154=0xc8;}else{_0x522154=0xce;}_0x379150[_0x1728('0x18')](_0x522154);return _0x379150['set'](_0x1728('0x1d'),_0x56ac52+'-'+_0x527c03+'/'+_0x45bced)[_0x1728('0x1e')](_0x1c5019);}return null;};}function patchUpdates(_0x2f0ec8){return function(_0x3f5855){try{jsonpatch[_0x1728('0x1f')](_0x3f5855,_0x2f0ec8,!![]);}catch(_0x4dc3ab){return BPromise[_0x1728('0x20')](_0x4dc3ab);}return _0x3f5855[_0x1728('0x21')]();};}function saveUpdates(_0x37f21e,_0x4e283b){return function(_0x3224fb){if(_0x3224fb){return _0x3224fb[_0x1728('0x22')](_0x37f21e)['then'](function(_0x2c97d8){return _0x2c97d8;});}return null;};}function removeEntity(_0x2ab92e,_0x1fe8d7){return function(_0x310433){if(_0x310433){return _0x310433[_0x1728('0x23')]()[_0x1728('0x24')](function(){var _0x579ec3=_0x310433[_0x1728('0x25')]({'plain':!![]});var _0x273474='CmHopperAdditionalPhones';return db['UserProfileResource'][_0x1728('0x23')]({'where':{'type':_0x273474,'resourceId':_0x579ec3['id']}})[_0x1728('0x24')](function(){return _0x310433;});})[_0x1728('0x24')](function(){_0x2ab92e['status'](0xcc)[_0x1728('0x26')]();});}};}function handleEntityNotFound(_0x2fc3b5,_0x478e07){return function(_0x3ca338){if(!_0x3ca338){_0x2fc3b5[_0x1728('0x17')](0x194);}return _0x3ca338;};}function handleError(_0x5d6f30,_0x4c808d){_0x4c808d=_0x4c808d||0x1f4;return function(_0x18a788){logger[_0x1728('0x27')](_0x18a788[_0x1728('0x28')]);if(_0x18a788[_0x1728('0x29')]){delete _0x18a788[_0x1728('0x29')];}_0x5d6f30['status'](_0x4c808d)[_0x1728('0x2a')](_0x18a788);};}exports[_0x1728('0x2b')]=function(_0x4ceb19,_0x709d8){var _0x41f54d={},_0x2b18b1={},_0x4a0586={'count':0x0,'rows':[]};var _0xf11a91=_[_0x1728('0x2c')](db['CmHopperAdditionalPhone'][_0x1728('0x2d')],function(_0x2022bf){return{'name':_0x2022bf[_0x1728('0x2e')],'type':_0x2022bf[_0x1728('0x2f')][_0x1728('0x30')]};});_0x2b18b1[_0x1728('0x31')]=_['map'](_0xf11a91,'name');_0x2b18b1[_0x1728('0x32')]=_[_0x1728('0x33')](_0x4ceb19[_0x1728('0x32')]);_0x2b18b1[_0x1728('0x34')]=_[_0x1728('0x35')](_0x2b18b1['model'],_0x2b18b1['query']);_0x41f54d[_0x1728('0x36')]=_[_0x1728('0x35')](_0x2b18b1[_0x1728('0x31')],qs[_0x1728('0x37')](_0x4ceb19[_0x1728('0x32')][_0x1728('0x37')]));_0x41f54d[_0x1728('0x36')]=_0x41f54d[_0x1728('0x36')][_0x1728('0x38')]?_0x41f54d[_0x1728('0x36')]:_0x2b18b1['model'];if(!_0x4ceb19[_0x1728('0x32')]['hasOwnProperty'](_0x1728('0x39'))){_0x41f54d[_0x1728('0x1b')]=qs[_0x1728('0x1b')](_0x4ceb19[_0x1728('0x32')][_0x1728('0x1b')]);_0x41f54d[_0x1728('0x19')]=qs[_0x1728('0x19')](_0x4ceb19[_0x1728('0x32')]['offset']);}_0x41f54d[_0x1728('0x3a')]=qs[_0x1728('0x3b')](_0x4ceb19[_0x1728('0x32')][_0x1728('0x3b')]);_0x41f54d[_0x1728('0x3c')]=qs[_0x1728('0x34')](_[_0x1728('0x3d')](_0x4ceb19[_0x1728('0x32')],_0x2b18b1[_0x1728('0x34')]),_0xf11a91);if(_0x4ceb19[_0x1728('0x32')]['filter']){_0x41f54d[_0x1728('0x3c')]=_[_0x1728('0x3e')](_0x41f54d[_0x1728('0x3c')],{'$or':_['map'](_0xf11a91,function(_0x502f53){if(_0x502f53[_0x1728('0x2f')]!=='VIRTUAL'){var _0x186276={};_0x186276[_0x502f53[_0x1728('0x29')]]={'$like':'%'+_0x4ceb19[_0x1728('0x32')][_0x1728('0x3f')]+'%'};return _0x186276;}})});}_0x41f54d=_[_0x1728('0x3e')]({},_0x41f54d,_0x4ceb19['options']);var _0x4b9980={'where':_0x41f54d['where']};return db['CmHopperAdditionalPhone']['count'](_0x4b9980)[_0x1728('0x24')](function(_0x4f2292){_0x4a0586[_0x1728('0x1c')]=_0x4f2292;if(_0x4ceb19[_0x1728('0x32')][_0x1728('0x40')]){_0x41f54d['include']=[{'all':!![]}];}return db[_0x1728('0x41')][_0x1728('0x42')](_0x41f54d);})['then'](function(_0x3028a4){_0x4a0586[_0x1728('0x43')]=_0x3028a4;return _0x4a0586;})[_0x1728('0x24')](respondWithFilteredResult(_0x709d8,_0x41f54d))[_0x1728('0x44')](handleError(_0x709d8,null));};exports[_0x1728('0x45')]=function(_0x2c1a80,_0x2d1149){var _0x137321={'raw':!![],'where':{'id':_0x2c1a80[_0x1728('0x46')]['id']}},_0xb1acc5={};_0xb1acc5[_0x1728('0x31')]=_['keys'](db[_0x1728('0x41')][_0x1728('0x2d')]);_0xb1acc5[_0x1728('0x32')]=_[_0x1728('0x33')](_0x2c1a80[_0x1728('0x32')]);_0xb1acc5[_0x1728('0x34')]=_[_0x1728('0x35')](_0xb1acc5[_0x1728('0x31')],_0xb1acc5[_0x1728('0x32')]);_0x137321[_0x1728('0x36')]=_[_0x1728('0x35')](_0xb1acc5[_0x1728('0x31')],qs[_0x1728('0x37')](_0x2c1a80['query'][_0x1728('0x37')]));_0x137321['attributes']=_0x137321[_0x1728('0x36')][_0x1728('0x38')]?_0x137321[_0x1728('0x36')]:_0xb1acc5['model'];if(_0x2c1a80[_0x1728('0x32')]['includeAll']){_0x137321[_0x1728('0x47')]=[{'all':!![]}];}_0x137321=_[_0x1728('0x3e')]({},_0x137321,_0x2c1a80['options']);return db[_0x1728('0x41')]['find'](_0x137321)[_0x1728('0x24')](handleEntityNotFound(_0x2d1149,null))[_0x1728('0x24')](respondWithResult(_0x2d1149,null))[_0x1728('0x44')](handleError(_0x2d1149,null));};exports[_0x1728('0x48')]=function(_0x255b8a,_0x3a4429){return db[_0x1728('0x41')][_0x1728('0x48')](_0x255b8a[_0x1728('0x49')],{})[_0x1728('0x24')](function(_0x3b1ea7){var _0x43c3aa=_0x255b8a[_0x1728('0x4a')][_0x1728('0x25')]({'plain':!![]});if(!_0x43c3aa)throw new Error(_0x1728('0x4b'));if(_0x43c3aa[_0x1728('0x4c')]===_0x1728('0x4a')){var _0xe7a47f=_0x3b1ea7[_0x1728('0x25')]({'plain':!![]});var _0xa3a4a6=_0x1728('0x4d');return db[_0x1728('0x4e')]['find']({'where':{'name':_0xa3a4a6,'userProfileId':_0x43c3aa[_0x1728('0x4f')]},'raw':!![]})['then'](function(_0x589d57){if(_0x589d57&&_0x589d57[_0x1728('0x50')]===0x0){return db[_0x1728('0x51')]['create']({'name':_0xe7a47f['name'],'resourceId':_0xe7a47f['id'],'type':_0x589d57[_0x1728('0x29')],'sectionId':_0x589d57['id']},{})[_0x1728('0x24')](function(){return _0x3b1ea7;});}else{return _0x3b1ea7;}})['catch'](function(_0x3b2bcd){logger[_0x1728('0x27')](_0x1728('0x52'),_0x3b2bcd);throw _0x3b2bcd;});}return _0x3b1ea7;})[_0x1728('0x24')](respondWithResult(_0x3a4429,0xc9))[_0x1728('0x44')](handleError(_0x3a4429,null));};exports[_0x1728('0x22')]=function(_0x513e55,_0x554210){if(_0x513e55[_0x1728('0x49')]['id']){delete _0x513e55[_0x1728('0x49')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x513e55['params']['id']}})[_0x1728('0x24')](handleEntityNotFound(_0x554210,null))['then'](saveUpdates(_0x513e55[_0x1728('0x49')],null))['then'](respondWithResult(_0x554210,null))[_0x1728('0x44')](handleError(_0x554210,null));};exports[_0x1728('0x23')]=function(_0x126762,_0x3403f0){return db[_0x1728('0x41')][_0x1728('0x53')]({'where':{'id':_0x126762[_0x1728('0x46')]['id']}})[_0x1728('0x24')](handleEntityNotFound(_0x3403f0,null))['then'](removeEntity(_0x3403f0,null))[_0x1728('0x44')](handleError(_0x3403f0,null));}; \ No newline at end of file +var _0xbe60=['user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create'];(function(_0x21fc96,_0x2df0fe){var _0x2e00b0=function(_0x439cde){while(--_0x439cde){_0x21fc96['push'](_0x21fc96['shift']());}};_0x2e00b0(++_0x2df0fe);}(_0xbe60,0x13e));var _0x0be6=function(_0x3ba319,_0x386603){_0x3ba319=_0x3ba319-0x0;var _0x3c0478=_0xbe60[_0x3ba319];return _0x3c0478;};'use strict';var emlformat=require(_0x0be6('0x0'));var rimraf=require(_0x0be6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0be6('0x2'));var rp=require(_0x0be6('0x3'));var moment=require(_0x0be6('0x4'));var BPromise=require(_0x0be6('0x5'));var Mustache=require(_0x0be6('0x6'));var util=require(_0x0be6('0x7'));var path=require(_0x0be6('0x8'));var sox=require(_0x0be6('0x9'));var csv=require(_0x0be6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0be6('0xb'));var _=require(_0x0be6('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0be6('0xd'));var deskjs=require(_0x0be6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0be6('0xf'));var Papa=require(_0x0be6('0x10'));var Redis=require(_0x0be6('0x11'));var authService=require(_0x0be6('0x12'));var qs=require(_0x0be6('0x13'));var as=require(_0x0be6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0be6('0x15'));var config=require(_0x0be6('0x16'));var licenseUtil=require(_0x0be6('0x17'));var db=require(_0x0be6('0x18'))['db'];function respondWithStatusCode(_0x272166,_0x362f27){_0x362f27=_0x362f27||0xcc;return function(_0x1718e9){if(_0x1718e9){return _0x272166[_0x0be6('0x19')](_0x362f27);}return _0x272166[_0x0be6('0x1a')](_0x362f27)[_0x0be6('0x1b')]();};}function respondWithResult(_0x5ca7eb,_0x27637e){_0x27637e=_0x27637e||0xc8;return function(_0xafafb4){if(_0xafafb4){return _0x5ca7eb['status'](_0x27637e)[_0x0be6('0x1c')](_0xafafb4);}};}function respondWithFilteredResult(_0x255817,_0x23d709){return function(_0x5c086f){if(_0x5c086f){var _0x29945d=typeof _0x23d709['offset']===_0x0be6('0x1d')&&typeof _0x23d709[_0x0be6('0x1e')]===_0x0be6('0x1d');var _0x2ee176=_0x5c086f[_0x0be6('0x1f')];var _0x1486a6=_0x29945d?0x0:_0x23d709[_0x0be6('0x20')];var _0xb0e7c9=_0x29945d?_0x5c086f[_0x0be6('0x1f')]:_0x23d709[_0x0be6('0x20')]+_0x23d709[_0x0be6('0x1e')];var _0x47502d;if(_0xb0e7c9>=_0x2ee176){_0xb0e7c9=_0x2ee176;_0x47502d=0xc8;}else{_0x47502d=0xce;}_0x255817[_0x0be6('0x1a')](_0x47502d);return _0x255817['set'](_0x0be6('0x21'),_0x1486a6+'-'+_0xb0e7c9+'/'+_0x2ee176)[_0x0be6('0x1c')](_0x5c086f);}return null;};}function patchUpdates(_0xbfe25b){return function(_0xc63992){try{jsonpatch['apply'](_0xc63992,_0xbfe25b,!![]);}catch(_0x46916a){return BPromise[_0x0be6('0x22')](_0x46916a);}return _0xc63992['save']();};}function saveUpdates(_0x5231f2,_0xfd3fd6){return function(_0x20203c){if(_0x20203c){return _0x20203c[_0x0be6('0x23')](_0x5231f2)[_0x0be6('0x24')](function(_0x130745){return _0x130745;});}return null;};}function removeEntity(_0x4cfeaa,_0x221004){return function(_0xde20d7){if(_0xde20d7){return _0xde20d7['destroy']()[_0x0be6('0x24')](function(){var _0x5ec1bf=_0xde20d7[_0x0be6('0x25')]({'plain':!![]});var _0x18a276=_0x0be6('0x26');return db[_0x0be6('0x27')][_0x0be6('0x28')]({'where':{'type':_0x18a276,'resourceId':_0x5ec1bf['id']}})[_0x0be6('0x24')](function(){return _0xde20d7;});})['then'](function(){_0x4cfeaa['status'](0xcc)[_0x0be6('0x1b')]();});}};}function handleEntityNotFound(_0x165937,_0x489f1a){return function(_0x373c3f){if(!_0x373c3f){_0x165937['sendStatus'](0x194);}return _0x373c3f;};}function handleError(_0x63906c,_0x2dda55){_0x2dda55=_0x2dda55||0x1f4;return function(_0x332678){logger[_0x0be6('0x29')](_0x332678[_0x0be6('0x2a')]);if(_0x332678['name']){delete _0x332678[_0x0be6('0x2b')];}_0x63906c['status'](_0x2dda55)[_0x0be6('0x2c')](_0x332678);};}exports['index']=function(_0x829414,_0x5a5d61){var _0x298ba5={},_0x107858={},_0x366b76={'count':0x0,'rows':[]};var _0x315402=_[_0x0be6('0x2d')](db[_0x0be6('0x2e')][_0x0be6('0x2f')],function(_0x4e3289){return{'name':_0x4e3289[_0x0be6('0x30')],'type':_0x4e3289[_0x0be6('0x31')]['key']};});_0x107858[_0x0be6('0x32')]=_['map'](_0x315402,_0x0be6('0x2b'));_0x107858['query']=_[_0x0be6('0x33')](_0x829414[_0x0be6('0x34')]);_0x107858[_0x0be6('0x35')]=_['intersection'](_0x107858['model'],_0x107858['query']);_0x298ba5[_0x0be6('0x36')]=_[_0x0be6('0x37')](_0x107858[_0x0be6('0x32')],qs['fields'](_0x829414[_0x0be6('0x34')][_0x0be6('0x38')]));_0x298ba5[_0x0be6('0x36')]=_0x298ba5[_0x0be6('0x36')]['length']?_0x298ba5[_0x0be6('0x36')]:_0x107858[_0x0be6('0x32')];if(!_0x829414[_0x0be6('0x34')]['hasOwnProperty'](_0x0be6('0x39'))){_0x298ba5[_0x0be6('0x1e')]=qs['limit'](_0x829414['query']['limit']);_0x298ba5[_0x0be6('0x20')]=qs[_0x0be6('0x20')](_0x829414[_0x0be6('0x34')][_0x0be6('0x20')]);}_0x298ba5[_0x0be6('0x3a')]=qs['sort'](_0x829414[_0x0be6('0x34')][_0x0be6('0x3b')]);_0x298ba5['where']=qs['filters'](_['pick'](_0x829414['query'],_0x107858['filters']),_0x315402);if(_0x829414[_0x0be6('0x34')]['filter']){_0x298ba5[_0x0be6('0x3c')]=_[_0x0be6('0x3d')](_0x298ba5['where'],{'$or':_[_0x0be6('0x2d')](_0x315402,function(_0x4ca411){if(_0x4ca411[_0x0be6('0x31')]!==_0x0be6('0x3e')){var _0x3bb4c3={};_0x3bb4c3[_0x4ca411[_0x0be6('0x2b')]]={'$like':'%'+_0x829414[_0x0be6('0x34')]['filter']+'%'};return _0x3bb4c3;}})});}_0x298ba5=_[_0x0be6('0x3d')]({},_0x298ba5,_0x829414['options']);var _0x282bd6={'where':_0x298ba5[_0x0be6('0x3c')]};return db[_0x0be6('0x2e')][_0x0be6('0x1f')](_0x282bd6)[_0x0be6('0x24')](function(_0x473cf9){_0x366b76[_0x0be6('0x1f')]=_0x473cf9;if(_0x829414['query'][_0x0be6('0x3f')]){_0x298ba5[_0x0be6('0x40')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x0be6('0x41')](_0x298ba5);})[_0x0be6('0x24')](function(_0x157d0e){_0x366b76['rows']=_0x157d0e;return _0x366b76;})[_0x0be6('0x24')](respondWithFilteredResult(_0x5a5d61,_0x298ba5))[_0x0be6('0x42')](handleError(_0x5a5d61,null));};exports[_0x0be6('0x43')]=function(_0x304f72,_0x344a81){var _0x566e35={'raw':!![],'where':{'id':_0x304f72[_0x0be6('0x44')]['id']}},_0x45e3fb={};_0x45e3fb[_0x0be6('0x32')]=_['keys'](db['CmHopperAdditionalPhone'][_0x0be6('0x2f')]);_0x45e3fb[_0x0be6('0x34')]=_[_0x0be6('0x33')](_0x304f72[_0x0be6('0x34')]);_0x45e3fb[_0x0be6('0x35')]=_[_0x0be6('0x37')](_0x45e3fb[_0x0be6('0x32')],_0x45e3fb['query']);_0x566e35['attributes']=_[_0x0be6('0x37')](_0x45e3fb[_0x0be6('0x32')],qs[_0x0be6('0x38')](_0x304f72[_0x0be6('0x34')][_0x0be6('0x38')]));_0x566e35[_0x0be6('0x36')]=_0x566e35[_0x0be6('0x36')]['length']?_0x566e35[_0x0be6('0x36')]:_0x45e3fb[_0x0be6('0x32')];if(_0x304f72[_0x0be6('0x34')][_0x0be6('0x3f')]){_0x566e35[_0x0be6('0x40')]=[{'all':!![]}];}_0x566e35=_['merge']({},_0x566e35,_0x304f72[_0x0be6('0x45')]);return db[_0x0be6('0x2e')][_0x0be6('0x46')](_0x566e35)[_0x0be6('0x24')](handleEntityNotFound(_0x344a81,null))[_0x0be6('0x24')](respondWithResult(_0x344a81,null))[_0x0be6('0x42')](handleError(_0x344a81,null));};exports[_0x0be6('0x47')]=function(_0x2dd615,_0x86d2ea){return db[_0x0be6('0x2e')][_0x0be6('0x47')](_0x2dd615['body'],{})['then'](function(_0x1390fb){var _0x342837=_0x2dd615[_0x0be6('0x48')]['get']({'plain':!![]});if(!_0x342837)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x342837[_0x0be6('0x49')]==='user'){var _0x535b8e=_0x1390fb['get']({'plain':!![]});var _0x4a2703=_0x0be6('0x26');return db['UserProfileSection'][_0x0be6('0x46')]({'where':{'name':_0x4a2703,'userProfileId':_0x342837[_0x0be6('0x4a')]},'raw':!![]})[_0x0be6('0x24')](function(_0xc09ed7){if(_0xc09ed7&&_0xc09ed7[_0x0be6('0x4b')]===0x0){return db[_0x0be6('0x27')]['create']({'name':_0x535b8e[_0x0be6('0x2b')],'resourceId':_0x535b8e['id'],'type':_0xc09ed7[_0x0be6('0x2b')],'sectionId':_0xc09ed7['id']},{})['then'](function(){return _0x1390fb;});}else{return _0x1390fb;}})[_0x0be6('0x42')](function(_0x401ded){logger[_0x0be6('0x29')](_0x0be6('0x4c'),_0x401ded);throw _0x401ded;});}return _0x1390fb;})[_0x0be6('0x24')](respondWithResult(_0x86d2ea,0xc9))['catch'](handleError(_0x86d2ea,null));};exports[_0x0be6('0x23')]=function(_0x10ddf8,_0x4e9a75){if(_0x10ddf8[_0x0be6('0x4d')]['id']){delete _0x10ddf8[_0x0be6('0x4d')]['id'];}return db[_0x0be6('0x2e')]['find']({'where':{'id':_0x10ddf8['params']['id']}})[_0x0be6('0x24')](handleEntityNotFound(_0x4e9a75,null))['then'](saveUpdates(_0x10ddf8['body'],null))[_0x0be6('0x24')](respondWithResult(_0x4e9a75,null))['catch'](handleError(_0x4e9a75,null));};exports['destroy']=function(_0x41ff17,_0x53efa7){return db[_0x0be6('0x2e')]['find']({'where':{'id':_0x41ff17[_0x0be6('0x44')]['id']}})['then'](handleEntityNotFound(_0x53efa7,null))['then'](removeEntity(_0x53efa7,null))[_0x0be6('0x42')](handleError(_0x53efa7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index b5dda39..f9f7b1b 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 _0xe66d=['./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6ef703,_0x2695d9){var _0x4a13a3=function(_0x3f14aa){while(--_0x3f14aa){_0x6ef703['push'](_0x6ef703['shift']());}};_0x4a13a3(++_0x2695d9);}(_0xe66d,0xfb));var _0xde66=function(_0x4fa622,_0x4e2fe9){_0x4fa622=_0x4fa622-0x0;var _0xc754da=_0xe66d[_0x4fa622];return _0xc754da;};'use strict';var _=require(_0xde66('0x0'));var util=require(_0xde66('0x1'));var logger=require('../../config/logger')(_0xde66('0x2'));var moment=require(_0xde66('0x3'));var BPromise=require(_0xde66('0x4'));var rp=require(_0xde66('0x5'));var fs=require('fs');var path=require(_0xde66('0x6'));var rimraf=require(_0xde66('0x7'));var config=require(_0xde66('0x8'));var attributes=require(_0xde66('0x9'));module[_0xde66('0xa')]=function(_0x4a5d0e,_0xbf1165){return _0x4a5d0e['define'](_0xde66('0xb'),attributes,{'tableName':_0xde66('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f4e=['path','rimraf','../../config/environment','CmHopperAdditionalPhone','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3886c5,_0x11e091){var _0x3c7f41=function(_0x1eb28e){while(--_0x1eb28e){_0x3886c5['push'](_0x3886c5['shift']());}};_0x3c7f41(++_0x11e091);}(_0x5f4e,0x1d8));var _0xe5f4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f4e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xe5f4('0x0'));var util=require('util');var logger=require(_0xe5f4('0x1'))(_0xe5f4('0x2'));var moment=require('moment');var BPromise=require(_0xe5f4('0x3'));var rp=require(_0xe5f4('0x4'));var fs=require('fs');var path=require(_0xe5f4('0x5'));var rimraf=require(_0xe5f4('0x6'));var config=require(_0xe5f4('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x1c9027,_0x302931){return _0x1c9027['define'](_0xe5f4('0x8'),attributes,{'tableName':'cm_hopper_additional_phones','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 e05d234..3aba5ac 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 _0x2b44=['CampaignId','CmHopperAdditionalPhone','findOne','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','catch','SwapAdditionalPhones','CmHopper','VoiceQueueId','OrderBy','duration','waitTime','isNil','scheduledat','add','minutes','phone','countmachineretry','createdAt','updatedAt','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','VerifyAdditionalPhones','body','ContactId','ListId'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0x2b44,0x14c));var _0x42b4=function(_0x3c9858,_0x59c7ce){_0x3c9858=_0x3c9858-0x0;var _0xd03af0=_0x2b44[_0x3c9858];return _0xd03af0;};'use strict';var _=require(_0x42b4('0x0'));var util=require(_0x42b4('0x1'));var moment=require(_0x42b4('0x2'));var BPromise=require(_0x42b4('0x3'));var rs=require(_0x42b4('0x4'));var fs=require('fs');var Redis=require(_0x42b4('0x5'));var db=require(_0x42b4('0x6'))['db'];var utils=require(_0x42b4('0x7'));var logger=require(_0x42b4('0x8'))(_0x42b4('0x9'));var config=require(_0x42b4('0xa'));var jayson=require(_0x42b4('0xb'));var client=jayson['client'][_0x42b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfc0874,_0x295144,_0x1a5a28){return new BPromise(function(_0x1bbe46,_0x402fcb){return client[_0x42b4('0xd')](_0xfc0874,_0x1a5a28)[_0x42b4('0xe')](function(_0x1ff90c){logger[_0x42b4('0xf')](_0x42b4('0x10'),_0x295144,'request\x20sent');logger[_0x42b4('0x11')](_0x42b4('0x12'),_0x295144,'request\x20sent',JSON[_0x42b4('0x13')](_0x1ff90c));if(_0x1ff90c[_0x42b4('0x14')]){if(_0x1ff90c['error']['code']===0x1f4){logger[_0x42b4('0x14')](_0x42b4('0x10'),_0x295144,_0x1ff90c[_0x42b4('0x14')][_0x42b4('0x15')]);return _0x402fcb(_0x1ff90c['error']['message']);}logger[_0x42b4('0x14')](_0x42b4('0x10'),_0x295144,_0x1ff90c[_0x42b4('0x14')][_0x42b4('0x15')]);return _0x1bbe46(_0x1ff90c[_0x42b4('0x14')][_0x42b4('0x15')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x295144,_0x42b4('0x16'));_0x1bbe46(_0x1ff90c[_0x42b4('0x17')][_0x42b4('0x15')]);}})['catch'](function(_0x3c8c74){logger[_0x42b4('0x14')](_0x42b4('0x10'),_0x295144,_0x3c8c74);_0x402fcb(_0x3c8c74);});});}exports[_0x42b4('0x18')]=function(_0x40b931){var _0x21d628=this;return new Promise(function(_0x1fd3ad,_0x123668){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x40b931[_0x42b4('0x19')][_0x42b4('0x1a')],'ListId':_0x40b931['body'][_0x42b4('0x1b')],'VoiceQueueId':_0x40b931['body']['VoiceQueueId']===undefined?null:_0x40b931[_0x42b4('0x19')]['VoiceQueueId'],'CampaignId':_0x40b931['body'][_0x42b4('0x1c')]===undefined?null:_0x40b931[_0x42b4('0x19')][_0x42b4('0x1c')]}})[_0x42b4('0xe')](function(_0x17ca6f){if(_0x17ca6f!=null){return db[_0x42b4('0x1d')][_0x42b4('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x17ca6f['id'],'OrderBy':{'$gt':_0x17ca6f['OrderBy']}},'order':[['OrderBy',_0x42b4('0x1f')]]})[_0x42b4('0xe')](function(_0xba40a5){var _0x5b8e92=0x0;if(_0xba40a5){if(_0xba40a5[_0x42b4('0x20')]+_0xba40a5[_0x42b4('0x21')]+_0xba40a5[_0x42b4('0x22')]+_0xba40a5[_0x42b4('0x23')]+_0xba40a5[_0x42b4('0x24')]+_0xba40a5[_0x42b4('0x25')]+_0xba40a5['countmachineretry']+_0xba40a5[_0x42b4('0x26')]<_0x40b931[_0x42b4('0x27')]['dialGlobalMaxRetry'])_0x5b8e92=0x1;_0x1fd3ad({'additional':_0x5b8e92});}else{return db[_0x42b4('0x1d')][_0x42b4('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x17ca6f['id']},'order':[['OrderBy',_0x42b4('0x1f')]]})['then'](function(_0x26f2be){var _0x167541=0x0;if(_0x26f2be){if(_0x26f2be[_0x42b4('0x20')]+_0x26f2be[_0x42b4('0x21')]+_0x26f2be[_0x42b4('0x22')]+_0x26f2be[_0x42b4('0x23')]+_0x26f2be[_0x42b4('0x24')]+_0x26f2be['countabandonedretry']+_0x26f2be['countmachineretry']+_0x26f2be[_0x42b4('0x26')]<_0x40b931[_0x42b4('0x27')][_0x42b4('0x28')])_0x167541=0x1;_0x1fd3ad({'additional':_0x167541});}else{_0x1fd3ad({'additional':0x0});}})['catch'](function(_0x1635be){logger[_0x42b4('0x14')](_0x42b4('0x18'),_0x1635be[_0x42b4('0x15')]);_0x123668(_0x21d628[_0x42b4('0x14')](0x1f4,_0x1635be['message']));});}})[_0x42b4('0x29')](function(_0xf3e5dc){logger[_0x42b4('0x14')](_0x42b4('0x18'),_0xf3e5dc[_0x42b4('0x15')]);_0x123668(_0x21d628[_0x42b4('0x14')](0x1f4,_0xf3e5dc[_0x42b4('0x15')]));});}else _0x1fd3ad({'additional':0x0});});});};exports[_0x42b4('0x2a')]=function(_0x32fa09){var _0x25008f=this;return new Promise(function(_0x2da55d,_0x23f1c1){return db[_0x42b4('0x2b')][_0x42b4('0x1e')]({'raw':!![],'where':{'ContactId':_0x32fa09[_0x42b4('0x19')][_0x42b4('0x1a')],'ListId':_0x32fa09['body']['ListId'],'VoiceQueueId':_0x32fa09[_0x42b4('0x19')]['VoiceQueueId']===undefined?null:_0x32fa09[_0x42b4('0x19')][_0x42b4('0x2c')],'CampaignId':_0x32fa09[_0x42b4('0x19')][_0x42b4('0x1c')]===undefined?null:_0x32fa09['body']['CampaignId']}})['then'](function(_0xce9113){if(_0xce9113!=null){return db[_0x42b4('0x1d')][_0x42b4('0x1e')]({'raw':!![],'where':{'CmHopperId':_0xce9113['id'],'OrderBy':{'$gte':_0xce9113['OrderBy']}},'order':[[_0x42b4('0x2d'),_0x42b4('0x1f')]]})[_0x42b4('0xe')](function(_0x157846){if(_0x157846)return activateAdditionalPhone(_0xce9113,_0x32fa09['body'],_0x157846,_0x32fa09[_0x42b4('0x2e')],_0x32fa09[_0x42b4('0x2f')])[_0x42b4('0xe')](function(_0xd333d6){_0x2da55d(_0xd333d6);});else{return db['CmHopperAdditionalPhone'][_0x42b4('0x1e')]({'raw':!![],'where':{'CmHopperId':_0xce9113['id']},'order':[['OrderBy',_0x42b4('0x1f')]]})[_0x42b4('0xe')](function(_0x4bca64){if(_0x4bca64)return activateAdditionalPhone(_0xce9113,_0x32fa09[_0x42b4('0x19')],_0x4bca64,_0x32fa09[_0x42b4('0x2e')],_0x32fa09[_0x42b4('0x2f')])[_0x42b4('0xe')](function(_0x2671c0){_0x2da55d(_0x2671c0);});else{_0x2da55d({'id':_0xce9113['id'],'phone':''});}})[_0x42b4('0x29')](function(_0x85659d){logger[_0x42b4('0x14')]('VerifyAdditionalPhones',_0x85659d[_0x42b4('0x15')]);_0x23f1c1(_0x25008f['error'](0x1f4,_0x85659d[_0x42b4('0x15')]));});}})['catch'](function(_0x5388e4){logger[_0x42b4('0x14')](_0x42b4('0x18'),_0x5388e4[_0x42b4('0x15')]);_0x23f1c1(_0x25008f[_0x42b4('0x14')](0x1f4,_0x5388e4[_0x42b4('0x15')]));});}else _0x2da55d(0x1);});});};function activateAdditionalPhone(_0x5116fd,_0x140735,_0x2fddea,_0x20fb25,_0x60c403){return new Promise(function(_0x3e2b31,_0x3968f3){var _0x12b25c;if(_[_0x42b4('0x30')](_0x2fddea['scheduledat'])){_0x2fddea['scheduledat']=moment();}if(moment()>moment(_0x2fddea[_0x42b4('0x31')])){_0x12b25c=moment()[_0x42b4('0x32')](_0x60c403||0x3,_0x42b4('0x33'));}else{if(_0x2fddea[_0x42b4('0x2d')]==0x0){_0x12b25c=moment(_0x2fddea[_0x42b4('0x31')]);}else{_0x12b25c=moment()[_0x42b4('0x32')](_0x60c403||0x3,_0x42b4('0x33'));}}if(_[_0x42b4('0x30')](_0x12b25c)){_0x12b25c=moment()[_0x42b4('0x32')](_0x60c403||0x3,_0x42b4('0x33'));}var _0x1819de={'phone':_0x5116fd[_0x42b4('0x34')],'active':0x0,'OrderBy':_[_0x42b4('0x30')](_0x5116fd[_0x42b4('0x2d')])?0x0:_0x5116fd['OrderBy'],'scheduledat':moment()[_0x42b4('0x32')](_0x20fb25||0x1,_0x42b4('0x33')),'countbusyretry':_0x140735['countbusyretry'],'countcongestionretry':_0x140735[_0x42b4('0x21')],'countnoanswerretry':_0x140735['countnoanswerretry'],'countnosuchnumberretry':_0x140735['countnosuchnumberretry'],'countdropretry':_0x140735['countdropretry'],'countabandonedretry':_0x140735[_0x42b4('0x25')],'countmachineretry':_0x140735[_0x42b4('0x35')],'countagentrejectretry':_0x140735[_0x42b4('0x26')],'createdAt':_0x140735[_0x42b4('0x36')],'updatedAt':_0x140735[_0x42b4('0x37')]};var _0x45f095={'CmHopperId':_0x5116fd['id'],'phone':_0x2fddea[_0x42b4('0x34')],'active':0x0,'OrderBy':_[_0x42b4('0x30')](_0x2fddea[_0x42b4('0x2d')])?0x0:_0x2fddea[_0x42b4('0x2d')],'scheduledat':_0x12b25c,'countbusyretry':_0x2fddea[_0x42b4('0x20')],'countcongestionretry':_0x2fddea['countcongestionretry'],'countnoanswerretry':_0x2fddea[_0x42b4('0x22')],'countnosuchnumberretry':_0x2fddea['countnosuchnumberretry'],'countdropretry':_0x2fddea[_0x42b4('0x24')],'countabandonedretry':_0x2fddea[_0x42b4('0x25')],'countmachineretry':_0x2fddea[_0x42b4('0x35')],'countagentrejectretry':_0x2fddea[_0x42b4('0x26')],'createdAt':_0x2fddea[_0x42b4('0x36')],'updatedAt':_0x2fddea['updatedAt']};return db['sequelize']['transaction'](function(_0x58b3ef){return db[_0x42b4('0x1d')][_0x42b4('0x38')](_0x1819de,{'where':{'id':_0x2fddea['id']}},{'transaction':_0x58b3ef})[_0x42b4('0xe')](function(){return db[_0x42b4('0x2b')][_0x42b4('0x38')](_0x45f095,{'where':{'id':_0x5116fd['id']}},{'transaction':_0x58b3ef});});})['then'](function(_0x240621){_0x3e2b31({'id':_0x5116fd['id'],'phone':_0x2fddea[_0x42b4('0x34')]});})[_0x42b4('0x29')](function(_0x35adcd){logger[_0x42b4('0x14')](_0x42b4('0x39'),_0x35adcd[_0x42b4('0x15')]);_0x3968f3({'error':_0x35adcd['message']});});});}exports[_0x42b4('0x3a')]=function(_0x30e570){var _0x353be4=this;return new Promise(function(_0x211160,_0x47dd11){return db[_0x42b4('0x2b')]['update'](_0x30e570[_0x42b4('0x19')][_0x42b4('0x3b')],{'where':{'id':_0x30e570['body']['id']}})[_0x42b4('0xe')](function(_0x5adb91){_0x211160(_0x5adb91);})['catch'](function(_0xa423d6){logger['error'](_0x42b4('0x3a'),_0xa423d6[_0x42b4('0x15')]);_0x47dd11(_0x353be4[_0x42b4('0x14')](0x1f4,_0xa423d6[_0x42b4('0x15')]));});});}; \ No newline at end of file +var _0xd6b6=['countmachineretry','entity','dialGlobalMaxRetry','OrderBy','catch','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','countbusyretry','countagentrejectretry','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x201c68,_0x298a28){var _0x3c9de6=function(_0x1525a7){while(--_0x1525a7){_0x201c68['push'](_0x201c68['shift']());}};_0x3c9de6(++_0x298a28);}(_0xd6b6,0x106));var _0x6d6b=function(_0x17723b,_0x59304a){_0x17723b=_0x17723b-0x0;var _0x482881=_0xd6b6[_0x17723b];return _0x482881;};'use strict';var _=require(_0x6d6b('0x0'));var util=require(_0x6d6b('0x1'));var moment=require(_0x6d6b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6b('0x3'));var db=require(_0x6d6b('0x4'))['db'];var utils=require(_0x6d6b('0x5'));var logger=require(_0x6d6b('0x6'))(_0x6d6b('0x7'));var config=require(_0x6d6b('0x8'));var jayson=require(_0x6d6b('0x9'));var client=jayson[_0x6d6b('0xa')][_0x6d6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e9f91,_0x1bdc8e,_0x1888cc){return new BPromise(function(_0x2d000e,_0x7c843d){return client[_0x6d6b('0xc')](_0x2e9f91,_0x1888cc)[_0x6d6b('0xd')](function(_0x459d7e){logger[_0x6d6b('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1bdc8e,_0x6d6b('0xf'));logger[_0x6d6b('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x1bdc8e,_0x6d6b('0xf'),JSON[_0x6d6b('0x11')](_0x459d7e));if(_0x459d7e[_0x6d6b('0x12')]){if(_0x459d7e[_0x6d6b('0x12')][_0x6d6b('0x13')]===0x1f4){logger[_0x6d6b('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1bdc8e,_0x459d7e['error']['message']);return _0x7c843d(_0x459d7e['error']['message']);}logger[_0x6d6b('0x12')](_0x6d6b('0x14'),_0x1bdc8e,_0x459d7e[_0x6d6b('0x12')][_0x6d6b('0x15')]);return _0x2d000e(_0x459d7e[_0x6d6b('0x12')][_0x6d6b('0x15')]);}else{logger['info'](_0x6d6b('0x14'),_0x1bdc8e,'request\x20sent');_0x2d000e(_0x459d7e[_0x6d6b('0x16')][_0x6d6b('0x15')]);}})['catch'](function(_0x47c5c7){logger[_0x6d6b('0x12')](_0x6d6b('0x14'),_0x1bdc8e,_0x47c5c7);_0x7c843d(_0x47c5c7);});});}exports[_0x6d6b('0x17')]=function(_0x10ea0b){var _0x4bb5e1=this;return new Promise(function(_0x380347,_0x42c17d){return db[_0x6d6b('0x18')][_0x6d6b('0x19')]({'raw':!![],'where':{'ContactId':_0x10ea0b[_0x6d6b('0x1a')][_0x6d6b('0x1b')],'ListId':_0x10ea0b['body'][_0x6d6b('0x1c')],'VoiceQueueId':_0x10ea0b['body'][_0x6d6b('0x1d')]===undefined?null:_0x10ea0b[_0x6d6b('0x1a')][_0x6d6b('0x1d')],'CampaignId':_0x10ea0b[_0x6d6b('0x1a')][_0x6d6b('0x1e')]===undefined?null:_0x10ea0b[_0x6d6b('0x1a')]['CampaignId']}})['then'](function(_0x591aba){if(_0x591aba!=null){return db[_0x6d6b('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x591aba['id'],'OrderBy':{'$gt':_0x591aba['OrderBy']}},'order':[['OrderBy',_0x6d6b('0x20')]]})[_0x6d6b('0xd')](function(_0x460e6b){var _0x5d887b=0x0;if(_0x460e6b){if(_0x460e6b['countbusyretry']+_0x460e6b[_0x6d6b('0x21')]+_0x460e6b[_0x6d6b('0x22')]+_0x460e6b[_0x6d6b('0x23')]+_0x460e6b[_0x6d6b('0x24')]+_0x460e6b[_0x6d6b('0x25')]+_0x460e6b[_0x6d6b('0x26')]+_0x460e6b['countagentrejectretry']<_0x10ea0b[_0x6d6b('0x27')][_0x6d6b('0x28')])_0x5d887b=0x1;_0x380347({'additional':_0x5d887b});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x591aba['id']},'order':[[_0x6d6b('0x29'),'ASC']]})[_0x6d6b('0xd')](function(_0xdc8e1f){var _0x4e62b0=0x0;if(_0xdc8e1f){if(_0xdc8e1f['countbusyretry']+_0xdc8e1f[_0x6d6b('0x21')]+_0xdc8e1f[_0x6d6b('0x22')]+_0xdc8e1f['countnosuchnumberretry']+_0xdc8e1f['countdropretry']+_0xdc8e1f[_0x6d6b('0x25')]+_0xdc8e1f[_0x6d6b('0x26')]+_0xdc8e1f['countagentrejectretry']<_0x10ea0b[_0x6d6b('0x27')][_0x6d6b('0x28')])_0x4e62b0=0x1;_0x380347({'additional':_0x4e62b0});}else{_0x380347({'additional':0x0});}})['catch'](function(_0x29e4ab){logger[_0x6d6b('0x12')](_0x6d6b('0x17'),_0x29e4ab[_0x6d6b('0x15')]);_0x42c17d(_0x4bb5e1[_0x6d6b('0x12')](0x1f4,_0x29e4ab[_0x6d6b('0x15')]));});}})[_0x6d6b('0x2a')](function(_0x1ca60b){logger['error'](_0x6d6b('0x17'),_0x1ca60b[_0x6d6b('0x15')]);_0x42c17d(_0x4bb5e1[_0x6d6b('0x12')](0x1f4,_0x1ca60b[_0x6d6b('0x15')]));});}else _0x380347({'additional':0x0});});});};exports[_0x6d6b('0x2b')]=function(_0x17e2c7){var _0x195f3a=this;return new Promise(function(_0x289f65,_0x240108){return db[_0x6d6b('0x18')][_0x6d6b('0x19')]({'raw':!![],'where':{'ContactId':_0x17e2c7['body'][_0x6d6b('0x1b')],'ListId':_0x17e2c7[_0x6d6b('0x1a')]['ListId'],'VoiceQueueId':_0x17e2c7[_0x6d6b('0x1a')]['VoiceQueueId']===undefined?null:_0x17e2c7['body'][_0x6d6b('0x1d')],'CampaignId':_0x17e2c7[_0x6d6b('0x1a')][_0x6d6b('0x1e')]===undefined?null:_0x17e2c7['body']['CampaignId']}})['then'](function(_0x514826){if(_0x514826!=null){return db[_0x6d6b('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x514826['id'],'OrderBy':{'$gte':_0x514826[_0x6d6b('0x29')]}},'order':[[_0x6d6b('0x29'),_0x6d6b('0x20')]]})['then'](function(_0x36d5c3){if(_0x36d5c3)return activateAdditionalPhone(_0x514826,_0x17e2c7['body'],_0x36d5c3,_0x17e2c7[_0x6d6b('0x2c')],_0x17e2c7[_0x6d6b('0x2d')])[_0x6d6b('0xd')](function(_0x311101){_0x289f65(_0x311101);});else{return db[_0x6d6b('0x1f')][_0x6d6b('0x19')]({'raw':!![],'where':{'CmHopperId':_0x514826['id']},'order':[[_0x6d6b('0x29'),'ASC']]})['then'](function(_0x40b7b1){if(_0x40b7b1)return activateAdditionalPhone(_0x514826,_0x17e2c7[_0x6d6b('0x1a')],_0x40b7b1,_0x17e2c7[_0x6d6b('0x2c')],_0x17e2c7[_0x6d6b('0x2d')])['then'](function(_0x4b3084){_0x289f65(_0x4b3084);});else{_0x289f65({'id':_0x514826['id'],'phone':''});}})[_0x6d6b('0x2a')](function(_0x44a1a2){logger[_0x6d6b('0x12')]('VerifyAdditionalPhones',_0x44a1a2['message']);_0x240108(_0x195f3a[_0x6d6b('0x12')](0x1f4,_0x44a1a2[_0x6d6b('0x15')]));});}})['catch'](function(_0x1baed3){logger[_0x6d6b('0x12')](_0x6d6b('0x17'),_0x1baed3[_0x6d6b('0x15')]);_0x240108(_0x195f3a['error'](0x1f4,_0x1baed3['message']));});}else _0x289f65(0x1);});});};function activateAdditionalPhone(_0x3f6f5f,_0x2cc70a,_0x23cfef,_0x494343,_0x859916){return new Promise(function(_0xb0f53c,_0x22bca6){var _0x3b5132;if(_['isNil'](_0x23cfef[_0x6d6b('0x2e')])){_0x23cfef[_0x6d6b('0x2e')]=moment();}if(moment()>moment(_0x23cfef['scheduledat'])){_0x3b5132=moment()[_0x6d6b('0x2f')](_0x859916||0x3,_0x6d6b('0x30'));}else{if(_0x23cfef['OrderBy']==0x0){_0x3b5132=moment(_0x23cfef[_0x6d6b('0x2e')]);}else{_0x3b5132=moment()['add'](_0x859916||0x3,_0x6d6b('0x30'));}}if(_[_0x6d6b('0x31')](_0x3b5132)){_0x3b5132=moment()['add'](_0x859916||0x3,_0x6d6b('0x30'));}var _0x42dda5={'phone':_0x3f6f5f[_0x6d6b('0x32')],'active':0x0,'OrderBy':_[_0x6d6b('0x31')](_0x3f6f5f['OrderBy'])?0x0:_0x3f6f5f[_0x6d6b('0x29')],'scheduledat':moment()['add'](_0x494343||0x1,_0x6d6b('0x30')),'countbusyretry':_0x2cc70a[_0x6d6b('0x33')],'countcongestionretry':_0x2cc70a[_0x6d6b('0x21')],'countnoanswerretry':_0x2cc70a[_0x6d6b('0x22')],'countnosuchnumberretry':_0x2cc70a[_0x6d6b('0x23')],'countdropretry':_0x2cc70a[_0x6d6b('0x24')],'countabandonedretry':_0x2cc70a[_0x6d6b('0x25')],'countmachineretry':_0x2cc70a[_0x6d6b('0x26')],'countagentrejectretry':_0x2cc70a[_0x6d6b('0x34')],'createdAt':_0x2cc70a[_0x6d6b('0x35')],'updatedAt':_0x2cc70a[_0x6d6b('0x36')]};var _0x325c15={'CmHopperId':_0x3f6f5f['id'],'phone':_0x23cfef[_0x6d6b('0x32')],'active':0x0,'OrderBy':_[_0x6d6b('0x31')](_0x23cfef[_0x6d6b('0x29')])?0x0:_0x23cfef[_0x6d6b('0x29')],'scheduledat':_0x3b5132,'countbusyretry':_0x23cfef['countbusyretry'],'countcongestionretry':_0x23cfef['countcongestionretry'],'countnoanswerretry':_0x23cfef['countnoanswerretry'],'countnosuchnumberretry':_0x23cfef[_0x6d6b('0x23')],'countdropretry':_0x23cfef[_0x6d6b('0x24')],'countabandonedretry':_0x23cfef[_0x6d6b('0x25')],'countmachineretry':_0x23cfef[_0x6d6b('0x26')],'countagentrejectretry':_0x23cfef['countagentrejectretry'],'createdAt':_0x23cfef[_0x6d6b('0x35')],'updatedAt':_0x23cfef[_0x6d6b('0x36')]};return db[_0x6d6b('0x37')][_0x6d6b('0x38')](function(_0x50d378){return db[_0x6d6b('0x1f')][_0x6d6b('0x39')](_0x42dda5,{'where':{'id':_0x23cfef['id']}},{'transaction':_0x50d378})['then'](function(){return db[_0x6d6b('0x18')][_0x6d6b('0x39')](_0x325c15,{'where':{'id':_0x3f6f5f['id']}},{'transaction':_0x50d378});});})[_0x6d6b('0xd')](function(_0x5ae574){_0xb0f53c({'id':_0x3f6f5f['id'],'phone':_0x23cfef[_0x6d6b('0x32')]});})['catch'](function(_0x274a45){logger[_0x6d6b('0x12')](_0x6d6b('0x3a'),_0x274a45[_0x6d6b('0x15')]);_0x22bca6({'error':_0x274a45[_0x6d6b('0x15')]});});});}exports[_0x6d6b('0x3b')]=function(_0xc9def0){var _0x4da368=this;return new Promise(function(_0x3d0cd3,_0x4c8700){return db['CmHopper'][_0x6d6b('0x39')](_0xc9def0['body']['field'],{'where':{'id':_0xc9def0[_0x6d6b('0x1a')]['id']}})[_0x6d6b('0xd')](function(_0xb84803){_0x3d0cd3(_0xb84803);})['catch'](function(_0x452131){logger[_0x6d6b('0x12')](_0x6d6b('0x3b'),_0x452131[_0x6d6b('0x15')]);_0x4c8700(_0x4da368['error'](0x1f4,_0x452131['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index f47581d..96484a2 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 _0xcd6a=['index','get','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x18c1ed,_0xe47487){var _0x466a25=function(_0x238824){while(--_0x238824){_0x18c1ed['push'](_0x18c1ed['shift']());}};_0x466a25(++_0xe47487);}(_0xcd6a,0xbe));var _0xacd6=function(_0x6312d,_0x51dc45){_0x6312d=_0x6312d-0x0;var _0x194f61=_0xcd6a[_0x6312d];return _0x194f61;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xacd6('0x0'));var timeout=require(_0xacd6('0x1'));var express=require(_0xacd6('0x2'));var router=express[_0xacd6('0x3')]();var fs_extra=require(_0xacd6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xacd6('0x5'));var config=require(_0xacd6('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0xacd6('0x7')](),controller[_0xacd6('0x8')]);router[_0xacd6('0x9')](_0xacd6('0xa'),auth[_0xacd6('0x7')](),controller[_0xacd6('0xb')]);router[_0xacd6('0xc')]('/',auth['isAuthenticated'](),controller[_0xacd6('0xd')]);router[_0xacd6('0xe')]('/:id',auth[_0xacd6('0x7')](),controller[_0xacd6('0xf')]);router[_0xacd6('0x10')](_0xacd6('0xa'),auth['isAuthenticated'](),controller[_0xacd6('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9091=['express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','multer','path'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x9091,0x1ed));var _0x1909=function(_0x3a514c,_0x57f149){_0x3a514c=_0x3a514c-0x0;var _0xa28d34=_0x9091[_0x3a514c];return _0xa28d34;};'use strict';var multer=require(_0x1909('0x0'));var util=require('util');var path=require(_0x1909('0x1'));var timeout=require('connect-timeout');var express=require(_0x1909('0x2'));var router=express['Router']();var fs_extra=require(_0x1909('0x3'));var auth=require(_0x1909('0x4'));var interaction=require(_0x1909('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0x1909('0x6')](),controller['index']);router[_0x1909('0x7')](_0x1909('0x8'),auth[_0x1909('0x6')](),controller[_0x1909('0x9')]);router[_0x1909('0xa')]('/',auth[_0x1909('0x6')](),controller['create']);router[_0x1909('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1909('0xc')]);router[_0x1909('0xd')]('/:id',auth[_0x1909('0x6')](),controller[_0x1909('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 83a6320..d604adc 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 _0x5419=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x3b5712,_0x4a05ba){var _0xd5f8c=function(_0x2db82a){while(--_0x2db82a){_0x3b5712['push'](_0x3b5712['shift']());}};_0xd5f8c(++_0x4a05ba);}(_0x5419,0x175));var _0x9541=function(_0xbf52f3,_0x2b2bb2){_0xbf52f3=_0xbf52f3-0x0;var _0x25edcc=_0x5419[_0xbf52f3];return _0x25edcc;};'use strict';var moment=require(_0x9541('0x0'));var Sequelize=require(_0x9541('0x1'));module[_0x9541('0x2')]={'phone':{'type':Sequelize[_0x9541('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9541('0x4')],'unique':_0x9541('0x5')},'ListId':{'type':Sequelize[_0x9541('0x4')],'unique':_0x9541('0x5')},'VoiceQueueId':{'type':Sequelize[_0x9541('0x4')],'unique':_0x9541('0x5')}}; \ No newline at end of file +var _0x56e7=['exports','INTEGER','contactListQueue','sequelize'];(function(_0x837dad,_0x1d9098){var _0x1d62d3=function(_0x40b7c1){while(--_0x40b7c1){_0x837dad['push'](_0x837dad['shift']());}};_0x1d62d3(++_0x1d9098);}(_0x56e7,0x7b));var _0x756e=function(_0x382787,_0x4175d3){_0x382787=_0x382787-0x0;var _0x58f86d=_0x56e7[_0x382787];return _0x58f86d;};'use strict';var moment=require('moment');var Sequelize=require(_0x756e('0x0'));module[_0x756e('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x756e('0x2')],'unique':_0x756e('0x3')},'ListId':{'type':Sequelize[_0x756e('0x2')],'unique':_0x756e('0x3')},'VoiceQueueId':{'type':Sequelize[_0x756e('0x2')],'unique':_0x756e('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 3a16498..94f1ecc 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 _0xefe6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','rawAttributes','key','model','map','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','CmHopperBlack','findAll','rows','catch','show','params','keys','includeAll','include','find','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','papaparse'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xefe6,0x14c));var _0x6efe=function(_0x3c06d1,_0x193d6e){_0x3c06d1=_0x3c06d1-0x0;var _0x5ee2be=_0xefe6[_0x3c06d1];return _0x5ee2be;};'use strict';var emlformat=require(_0x6efe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6efe('0x1'));var jsonpatch=require(_0x6efe('0x2'));var rp=require(_0x6efe('0x3'));var moment=require(_0x6efe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6efe('0x5'));var util=require(_0x6efe('0x6'));var path=require(_0x6efe('0x7'));var sox=require('sox');var csv=require(_0x6efe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6efe('0x9'));var _=require(_0x6efe('0xa'));var squel=require('squel');var crypto=require(_0x6efe('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6efe('0x8'));var querystring=require('querystring');var Papa=require(_0x6efe('0xc'));var Redis=require(_0x6efe('0xd'));var authService=require(_0x6efe('0xe'));var qs=require(_0x6efe('0xf'));var as=require(_0x6efe('0x10'));var hardwareService=require(_0x6efe('0x11'));var logger=require(_0x6efe('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6efe('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6efe('0x14'))['db'];function respondWithStatusCode(_0x5ab125,_0x1742f4){_0x1742f4=_0x1742f4||0xcc;return function(_0x24353c){if(_0x24353c){return _0x5ab125[_0x6efe('0x15')](_0x1742f4);}return _0x5ab125[_0x6efe('0x16')](_0x1742f4)['end']();};}function respondWithResult(_0x385a59,_0x24022f){_0x24022f=_0x24022f||0xc8;return function(_0x28fb8c){if(_0x28fb8c){return _0x385a59['status'](_0x24022f)['json'](_0x28fb8c);}};}function respondWithFilteredResult(_0x34df04,_0x3a32b8){return function(_0x54e8fa){if(_0x54e8fa){var _0x4497f4=typeof _0x3a32b8[_0x6efe('0x17')]===_0x6efe('0x18')&&typeof _0x3a32b8[_0x6efe('0x19')]==='undefined';var _0x18f4d5=_0x54e8fa[_0x6efe('0x1a')];var _0x3d8e8f=_0x4497f4?0x0:_0x3a32b8[_0x6efe('0x17')];var _0x473dd8=_0x4497f4?_0x54e8fa[_0x6efe('0x1a')]:_0x3a32b8[_0x6efe('0x17')]+_0x3a32b8['limit'];var _0x3afe78;if(_0x473dd8>=_0x18f4d5){_0x473dd8=_0x18f4d5;_0x3afe78=0xc8;}else{_0x3afe78=0xce;}_0x34df04[_0x6efe('0x16')](_0x3afe78);return _0x34df04[_0x6efe('0x1b')]('Content-Range',_0x3d8e8f+'-'+_0x473dd8+'/'+_0x18f4d5)[_0x6efe('0x1c')](_0x54e8fa);}return null;};}function patchUpdates(_0x4634e3){return function(_0x157343){try{jsonpatch[_0x6efe('0x1d')](_0x157343,_0x4634e3,!![]);}catch(_0x4423cb){return BPromise[_0x6efe('0x1e')](_0x4423cb);}return _0x157343[_0x6efe('0x1f')]();};}function saveUpdates(_0x17e205,_0x4b50bb){return function(_0x3c76b6){if(_0x3c76b6){return _0x3c76b6['update'](_0x17e205)[_0x6efe('0x20')](function(_0x195401){return _0x195401;});}return null;};}function removeEntity(_0x4a4f53,_0x159879){return function(_0x4ce461){if(_0x4ce461){return _0x4ce461[_0x6efe('0x21')]()[_0x6efe('0x20')](function(){_0x4a4f53['status'](0xcc)[_0x6efe('0x22')]();});}};}function handleEntityNotFound(_0x184ede,_0xceb3c8){return function(_0x38745f){if(!_0x38745f){_0x184ede[_0x6efe('0x15')](0x194);}return _0x38745f;};}function handleError(_0x17ae02,_0x5becdf){_0x5becdf=_0x5becdf||0x1f4;return function(_0xe04891){logger[_0x6efe('0x23')](_0xe04891[_0x6efe('0x24')]);if(_0xe04891[_0x6efe('0x25')]){delete _0xe04891[_0x6efe('0x25')];}_0x17ae02[_0x6efe('0x16')](_0x5becdf)[_0x6efe('0x26')](_0xe04891);};}exports[_0x6efe('0x27')]=function(_0x206ada,_0x50c3d7){var _0x250ef4={},_0x1c1316={},_0x7a439b={'count':0x0,'rows':[]};var _0x54b49b=_['map'](db['CmHopperBlack'][_0x6efe('0x28')],function(_0x1109a6){return{'name':_0x1109a6['fieldName'],'type':_0x1109a6['type'][_0x6efe('0x29')]};});_0x1c1316[_0x6efe('0x2a')]=_[_0x6efe('0x2b')](_0x54b49b,_0x6efe('0x25'));_0x1c1316[_0x6efe('0x2c')]=_['keys'](_0x206ada[_0x6efe('0x2c')]);_0x1c1316['filters']=_[_0x6efe('0x2d')](_0x1c1316[_0x6efe('0x2a')],_0x1c1316[_0x6efe('0x2c')]);_0x250ef4[_0x6efe('0x2e')]=_[_0x6efe('0x2d')](_0x1c1316['model'],qs[_0x6efe('0x2f')](_0x206ada['query'][_0x6efe('0x2f')]));_0x250ef4[_0x6efe('0x2e')]=_0x250ef4[_0x6efe('0x2e')][_0x6efe('0x30')]?_0x250ef4[_0x6efe('0x2e')]:_0x1c1316['model'];if(!_0x206ada[_0x6efe('0x2c')]['hasOwnProperty'](_0x6efe('0x31'))){_0x250ef4[_0x6efe('0x19')]=qs[_0x6efe('0x19')](_0x206ada['query']['limit']);_0x250ef4[_0x6efe('0x17')]=qs[_0x6efe('0x17')](_0x206ada[_0x6efe('0x2c')]['offset']);}_0x250ef4['order']=qs[_0x6efe('0x32')](_0x206ada[_0x6efe('0x2c')][_0x6efe('0x32')]);_0x250ef4['where']=qs[_0x6efe('0x33')](_[_0x6efe('0x34')](_0x206ada[_0x6efe('0x2c')],_0x1c1316[_0x6efe('0x33')]),_0x54b49b);if(_0x206ada[_0x6efe('0x2c')][_0x6efe('0x35')]){_0x250ef4[_0x6efe('0x36')]=_['merge'](_0x250ef4[_0x6efe('0x36')],{'$or':_[_0x6efe('0x2b')](_0x54b49b,function(_0x169042){if(_0x169042['type']!==_0x6efe('0x37')){var _0x3eb3ec={};_0x3eb3ec[_0x169042['name']]={'$like':'%'+_0x206ada[_0x6efe('0x2c')]['filter']+'%'};return _0x3eb3ec;}})});}_0x250ef4=_[_0x6efe('0x38')]({},_0x250ef4,_0x206ada['options']);var _0x46bf6b={'where':_0x250ef4['where']};return db[_0x6efe('0x39')]['count'](_0x46bf6b)[_0x6efe('0x20')](function(_0x5e01d6){_0x7a439b['count']=_0x5e01d6;if(_0x206ada[_0x6efe('0x2c')]['includeAll']){_0x250ef4['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x6efe('0x3a')](_0x250ef4);})[_0x6efe('0x20')](function(_0x69785b){_0x7a439b[_0x6efe('0x3b')]=_0x69785b;return _0x7a439b;})['then'](respondWithFilteredResult(_0x50c3d7,_0x250ef4))[_0x6efe('0x3c')](handleError(_0x50c3d7,null));};exports[_0x6efe('0x3d')]=function(_0x2d2007,_0x259f53){var _0x51baea={'raw':!![],'where':{'id':_0x2d2007[_0x6efe('0x3e')]['id']}},_0x42d42c={};_0x42d42c[_0x6efe('0x2a')]=_[_0x6efe('0x3f')](db[_0x6efe('0x39')]['rawAttributes']);_0x42d42c[_0x6efe('0x2c')]=_['keys'](_0x2d2007[_0x6efe('0x2c')]);_0x42d42c[_0x6efe('0x33')]=_[_0x6efe('0x2d')](_0x42d42c[_0x6efe('0x2a')],_0x42d42c[_0x6efe('0x2c')]);_0x51baea[_0x6efe('0x2e')]=_[_0x6efe('0x2d')](_0x42d42c[_0x6efe('0x2a')],qs['fields'](_0x2d2007[_0x6efe('0x2c')][_0x6efe('0x2f')]));_0x51baea[_0x6efe('0x2e')]=_0x51baea[_0x6efe('0x2e')][_0x6efe('0x30')]?_0x51baea[_0x6efe('0x2e')]:_0x42d42c[_0x6efe('0x2a')];if(_0x2d2007[_0x6efe('0x2c')][_0x6efe('0x40')]){_0x51baea[_0x6efe('0x41')]=[{'all':!![]}];}_0x51baea=_[_0x6efe('0x38')]({},_0x51baea,_0x2d2007['options']);return db[_0x6efe('0x39')][_0x6efe('0x42')](_0x51baea)['then'](handleEntityNotFound(_0x259f53,null))[_0x6efe('0x20')](respondWithResult(_0x259f53,null))[_0x6efe('0x3c')](handleError(_0x259f53,null));};exports[_0x6efe('0x43')]=function(_0x1e07a3,_0x2d0180){if(_0x1e07a3['body']['id']){delete _0x1e07a3[_0x6efe('0x44')]['id'];}return db['CmHopperBlack'][_0x6efe('0x42')]({'where':{'id':_0x1e07a3['params']['id']}})[_0x6efe('0x20')](handleEntityNotFound(_0x2d0180,null))['then'](saveUpdates(_0x1e07a3[_0x6efe('0x44')],null))[_0x6efe('0x20')](respondWithResult(_0x2d0180,null))[_0x6efe('0x3c')](handleError(_0x2d0180,null));};exports['destroy']=function(_0x2b27f2,_0x2f3fe4){return db[_0x6efe('0x39')]['find']({'where':{'id':_0x2b27f2[_0x6efe('0x3e')]['id']}})[_0x6efe('0x20')](handleEntityNotFound(_0x2f3fe4,null))[_0x6efe('0x20')](removeEntity(_0x2f3fe4,null))[_0x6efe('0x3c')](handleError(_0x2f3fe4,null));};exports['describe']=function(_0x33d5d7,_0x2b10d0){return db[_0x6efe('0x39')]['describe']()[_0x6efe('0x20')](respondWithResult(_0x2b10d0,null))['catch'](handleError(_0x2b10d0,null));}; \ No newline at end of file +var _0xd6ff=['set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x244e85,_0x9a8dd7){var _0x55b122=function(_0x26543c){while(--_0x26543c){_0x244e85['push'](_0x244e85['shift']());}};_0x55b122(++_0x9a8dd7);}(_0xd6ff,0x76));var _0xfd6f=function(_0x4ea430,_0xc3e929){_0x4ea430=_0x4ea430-0x0;var _0x4ce88e=_0xd6ff[_0x4ea430];return _0x4ce88e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd6f('0x0'));var zipdir=require(_0xfd6f('0x1'));var jsonpatch=require(_0xfd6f('0x2'));var rp=require(_0xfd6f('0x3'));var moment=require('moment');var BPromise=require(_0xfd6f('0x4'));var Mustache=require(_0xfd6f('0x5'));var util=require(_0xfd6f('0x6'));var path=require(_0xfd6f('0x7'));var sox=require(_0xfd6f('0x8'));var csv=require(_0xfd6f('0x9'));var ejs=require(_0xfd6f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd6f('0xb'));var squel=require(_0xfd6f('0xc'));var crypto=require(_0xfd6f('0xd'));var jsforce=require(_0xfd6f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfd6f('0xf'));var Papa=require(_0xfd6f('0x10'));var Redis=require('ioredis');var authService=require(_0xfd6f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfd6f('0x12'));var hardwareService=require(_0xfd6f('0x13'));var logger=require(_0xfd6f('0x14'))('api');var utils=require(_0xfd6f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfd6f('0x16'));var db=require(_0xfd6f('0x17'))['db'];function respondWithStatusCode(_0x23ba75,_0x56a14b){_0x56a14b=_0x56a14b||0xcc;return function(_0x233b85){if(_0x233b85){return _0x23ba75[_0xfd6f('0x18')](_0x56a14b);}return _0x23ba75[_0xfd6f('0x19')](_0x56a14b)[_0xfd6f('0x1a')]();};}function respondWithResult(_0x26b44c,_0x177323){_0x177323=_0x177323||0xc8;return function(_0x291f5a){if(_0x291f5a){return _0x26b44c['status'](_0x177323)[_0xfd6f('0x1b')](_0x291f5a);}};}function respondWithFilteredResult(_0x481d9c,_0x5b6f08){return function(_0x38305d){if(_0x38305d){var _0x3200c4=typeof _0x5b6f08[_0xfd6f('0x1c')]===_0xfd6f('0x1d')&&typeof _0x5b6f08[_0xfd6f('0x1e')]===_0xfd6f('0x1d');var _0x5a54ae=_0x38305d['count'];var _0x19c787=_0x3200c4?0x0:_0x5b6f08['offset'];var _0x3f896a=_0x3200c4?_0x38305d[_0xfd6f('0x1f')]:_0x5b6f08[_0xfd6f('0x1c')]+_0x5b6f08['limit'];var _0x8b0ab1;if(_0x3f896a>=_0x5a54ae){_0x3f896a=_0x5a54ae;_0x8b0ab1=0xc8;}else{_0x8b0ab1=0xce;}_0x481d9c[_0xfd6f('0x19')](_0x8b0ab1);return _0x481d9c[_0xfd6f('0x20')](_0xfd6f('0x21'),_0x19c787+'-'+_0x3f896a+'/'+_0x5a54ae)[_0xfd6f('0x1b')](_0x38305d);}return null;};}function patchUpdates(_0x5ea6c8){return function(_0x2668e8){try{jsonpatch[_0xfd6f('0x22')](_0x2668e8,_0x5ea6c8,!![]);}catch(_0xa02839){return BPromise['reject'](_0xa02839);}return _0x2668e8[_0xfd6f('0x23')]();};}function saveUpdates(_0x5c1f7a,_0xc87262){return function(_0x3849f9){if(_0x3849f9){return _0x3849f9[_0xfd6f('0x24')](_0x5c1f7a)[_0xfd6f('0x25')](function(_0x40419a){return _0x40419a;});}return null;};}function removeEntity(_0x20497b,_0x18a380){return function(_0x11984d){if(_0x11984d){return _0x11984d[_0xfd6f('0x26')]()[_0xfd6f('0x25')](function(){_0x20497b[_0xfd6f('0x19')](0xcc)[_0xfd6f('0x1a')]();});}};}function handleEntityNotFound(_0x41c385,_0x139838){return function(_0x37e6b7){if(!_0x37e6b7){_0x41c385['sendStatus'](0x194);}return _0x37e6b7;};}function handleError(_0x7d5101,_0x4c3909){_0x4c3909=_0x4c3909||0x1f4;return function(_0x1669d0){logger[_0xfd6f('0x27')](_0x1669d0[_0xfd6f('0x28')]);if(_0x1669d0[_0xfd6f('0x29')]){delete _0x1669d0[_0xfd6f('0x29')];}_0x7d5101[_0xfd6f('0x19')](_0x4c3909)[_0xfd6f('0x2a')](_0x1669d0);};}exports[_0xfd6f('0x2b')]=function(_0x530e18,_0x4d6804){var _0x486e25={},_0x3a1197={},_0x17bc8c={'count':0x0,'rows':[]};var _0x1fb28d=_[_0xfd6f('0x2c')](db[_0xfd6f('0x2d')]['rawAttributes'],function(_0x53318b){return{'name':_0x53318b[_0xfd6f('0x2e')],'type':_0x53318b[_0xfd6f('0x2f')][_0xfd6f('0x30')]};});_0x3a1197[_0xfd6f('0x31')]=_[_0xfd6f('0x2c')](_0x1fb28d,_0xfd6f('0x29'));_0x3a1197[_0xfd6f('0x32')]=_[_0xfd6f('0x33')](_0x530e18[_0xfd6f('0x32')]);_0x3a1197[_0xfd6f('0x34')]=_[_0xfd6f('0x35')](_0x3a1197[_0xfd6f('0x31')],_0x3a1197[_0xfd6f('0x32')]);_0x486e25[_0xfd6f('0x36')]=_[_0xfd6f('0x35')](_0x3a1197[_0xfd6f('0x31')],qs[_0xfd6f('0x37')](_0x530e18['query'][_0xfd6f('0x37')]));_0x486e25['attributes']=_0x486e25['attributes']['length']?_0x486e25[_0xfd6f('0x36')]:_0x3a1197['model'];if(!_0x530e18[_0xfd6f('0x32')][_0xfd6f('0x38')]('nolimit')){_0x486e25['limit']=qs[_0xfd6f('0x1e')](_0x530e18[_0xfd6f('0x32')][_0xfd6f('0x1e')]);_0x486e25[_0xfd6f('0x1c')]=qs[_0xfd6f('0x1c')](_0x530e18[_0xfd6f('0x32')][_0xfd6f('0x1c')]);}_0x486e25[_0xfd6f('0x39')]=qs[_0xfd6f('0x3a')](_0x530e18['query'][_0xfd6f('0x3a')]);_0x486e25[_0xfd6f('0x3b')]=qs[_0xfd6f('0x34')](_[_0xfd6f('0x3c')](_0x530e18[_0xfd6f('0x32')],_0x3a1197['filters']),_0x1fb28d);if(_0x530e18[_0xfd6f('0x32')][_0xfd6f('0x3d')]){_0x486e25[_0xfd6f('0x3b')]=_[_0xfd6f('0x3e')](_0x486e25[_0xfd6f('0x3b')],{'$or':_['map'](_0x1fb28d,function(_0x1f4f63){if(_0x1f4f63[_0xfd6f('0x2f')]!==_0xfd6f('0x3f')){var _0x3c7068={};_0x3c7068[_0x1f4f63[_0xfd6f('0x29')]]={'$like':'%'+_0x530e18[_0xfd6f('0x32')][_0xfd6f('0x3d')]+'%'};return _0x3c7068;}})});}_0x486e25=_[_0xfd6f('0x3e')]({},_0x486e25,_0x530e18[_0xfd6f('0x40')]);var _0x2370a4={'where':_0x486e25[_0xfd6f('0x3b')]};return db[_0xfd6f('0x2d')]['count'](_0x2370a4)['then'](function(_0x16b753){_0x17bc8c[_0xfd6f('0x1f')]=_0x16b753;if(_0x530e18['query'][_0xfd6f('0x41')]){_0x486e25[_0xfd6f('0x42')]=[{'all':!![]}];}return db[_0xfd6f('0x2d')][_0xfd6f('0x43')](_0x486e25);})['then'](function(_0x2b2f28){_0x17bc8c['rows']=_0x2b2f28;return _0x17bc8c;})[_0xfd6f('0x25')](respondWithFilteredResult(_0x4d6804,_0x486e25))[_0xfd6f('0x44')](handleError(_0x4d6804,null));};exports[_0xfd6f('0x45')]=function(_0x26dd26,_0x158ccd){var _0x22627a={'raw':!![],'where':{'id':_0x26dd26['params']['id']}},_0x542a55={};_0x542a55['model']=_[_0xfd6f('0x33')](db['CmHopperBlack'][_0xfd6f('0x46')]);_0x542a55[_0xfd6f('0x32')]=_['keys'](_0x26dd26[_0xfd6f('0x32')]);_0x542a55[_0xfd6f('0x34')]=_[_0xfd6f('0x35')](_0x542a55[_0xfd6f('0x31')],_0x542a55[_0xfd6f('0x32')]);_0x22627a[_0xfd6f('0x36')]=_[_0xfd6f('0x35')](_0x542a55[_0xfd6f('0x31')],qs['fields'](_0x26dd26['query'][_0xfd6f('0x37')]));_0x22627a[_0xfd6f('0x36')]=_0x22627a[_0xfd6f('0x36')]['length']?_0x22627a[_0xfd6f('0x36')]:_0x542a55[_0xfd6f('0x31')];if(_0x26dd26['query'][_0xfd6f('0x41')]){_0x22627a[_0xfd6f('0x42')]=[{'all':!![]}];}_0x22627a=_['merge']({},_0x22627a,_0x26dd26['options']);return db[_0xfd6f('0x2d')][_0xfd6f('0x47')](_0x22627a)['then'](handleEntityNotFound(_0x158ccd,null))[_0xfd6f('0x25')](respondWithResult(_0x158ccd,null))['catch'](handleError(_0x158ccd,null));};exports[_0xfd6f('0x24')]=function(_0x4e1d03,_0x4f96a4){if(_0x4e1d03[_0xfd6f('0x48')]['id']){delete _0x4e1d03[_0xfd6f('0x48')]['id'];}return db[_0xfd6f('0x2d')][_0xfd6f('0x47')]({'where':{'id':_0x4e1d03[_0xfd6f('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f96a4,null))[_0xfd6f('0x25')](saveUpdates(_0x4e1d03['body'],null))[_0xfd6f('0x25')](respondWithResult(_0x4f96a4,null))[_0xfd6f('0x44')](handleError(_0x4f96a4,null));};exports[_0xfd6f('0x26')]=function(_0x2caed1,_0x208848){return db[_0xfd6f('0x2d')]['find']({'where':{'id':_0x2caed1[_0xfd6f('0x49')]['id']}})[_0xfd6f('0x25')](handleEntityNotFound(_0x208848,null))['then'](removeEntity(_0x208848,null))[_0xfd6f('0x44')](handleError(_0x208848,null));};exports[_0xfd6f('0x4a')]=function(_0x542ee4,_0x3e2c84){return db[_0xfd6f('0x2d')][_0xfd6f('0x4a')]()[_0xfd6f('0x25')](respondWithResult(_0x3e2c84,null))[_0xfd6f('0x44')](handleError(_0x3e2c84,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 7a9c86b..ca9f80c 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 _0x5202=['./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x116c04,_0x4963da){var _0x9e011d=function(_0x143880){while(--_0x143880){_0x116c04['push'](_0x116c04['shift']());}};_0x9e011d(++_0x4963da);}(_0x5202,0x138));var _0x2520=function(_0x2ffff9,_0x12c0a9){_0x2ffff9=_0x2ffff9-0x0;var _0xffcecc=_0x5202[_0x2ffff9];return _0xffcecc;};'use strict';var _=require(_0x2520('0x0'));var util=require(_0x2520('0x1'));var logger=require(_0x2520('0x2'))(_0x2520('0x3'));var moment=require(_0x2520('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2520('0x5'));var config=require(_0x2520('0x6'));var attributes=require(_0x2520('0x7'));module[_0x2520('0x8')]=function(_0x1f94e3,_0x5a4c65){return _0x1f94e3[_0x2520('0x9')]('CmHopperBlack',attributes,{'tableName':_0x2520('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['../../config/logger','bluebird','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','util'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x4c60,0x6d));var _0x04c6=function(_0x30c828,_0x3124a0){_0x30c828=_0x30c828-0x0;var _0x104c2b=_0x4c60[_0x30c828];return _0x104c2b;};'use strict';var _=require('lodash');var util=require(_0x04c6('0x0'));var logger=require(_0x04c6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x04c6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04c6('0x3'));var rimraf=require(_0x04c6('0x4'));var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x1c0458,_0xc252ae){return _0x1c0458[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'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 22c8773..813c564 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 _0x0d19=['include','map','model','GetCmHopperBlack','catch','UpdateCmHopperBlack','update','CmHopperBlack','destroy','DestroyCmHopperBlack','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','raw','where','attributes','limit'];(function(_0x1b8be8,_0x10eb30){var _0x1e818b=function(_0x37ba64){while(--_0x37ba64){_0x1b8be8['push'](_0x1b8be8['shift']());}};_0x1e818b(++_0x10eb30);}(_0x0d19,0xc8));var _0x90d1=function(_0x2b7f56,_0x41bc7d){_0x2b7f56=_0x2b7f56-0x0;var _0x36896d=_0x0d19[_0x2b7f56];return _0x36896d;};'use strict';var _=require(_0x90d1('0x0'));var util=require(_0x90d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90d1('0x2'));var fs=require('fs');var Redis=require(_0x90d1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x90d1('0x4'))(_0x90d1('0x5'));var config=require(_0x90d1('0x6'));var jayson=require(_0x90d1('0x7'));var client=jayson[_0x90d1('0x8')][_0x90d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e9796,_0x458104,_0x4a4ae8){return new BPromise(function(_0x5b15ad,_0x38ec98){return client[_0x90d1('0xa')](_0x2e9796,_0x4a4ae8)[_0x90d1('0xb')](function(_0x27e7fe){logger['info'](_0x90d1('0xc'),_0x458104,_0x90d1('0xd'));logger[_0x90d1('0xe')](_0x90d1('0xf'),_0x458104,'request\x20sent',JSON[_0x90d1('0x10')](_0x27e7fe));if(_0x27e7fe[_0x90d1('0x11')]){if(_0x27e7fe['error'][_0x90d1('0x12')]===0x1f4){logger[_0x90d1('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x458104,_0x27e7fe[_0x90d1('0x11')][_0x90d1('0x13')]);return _0x38ec98(_0x27e7fe[_0x90d1('0x11')][_0x90d1('0x13')]);}logger['error'](_0x90d1('0xc'),_0x458104,_0x27e7fe[_0x90d1('0x11')][_0x90d1('0x13')]);return _0x5b15ad(_0x27e7fe[_0x90d1('0x11')][_0x90d1('0x13')]);}else{logger[_0x90d1('0x14')](_0x90d1('0xc'),_0x458104,'request\x20sent');_0x5b15ad(_0x27e7fe[_0x90d1('0x15')][_0x90d1('0x13')]);}})['catch'](function(_0x1ed5bf){logger[_0x90d1('0x11')](_0x90d1('0xc'),_0x458104,_0x1ed5bf);_0x38ec98(_0x1ed5bf);});});}exports['GetCmHopperBlack']=function(_0x28ade1){var _0x29d03f=this;return new Promise(function(_0x3f671b,_0x23d006){return db['CmHopperBlack'][_0x90d1('0x16')]({'raw':_0x28ade1[_0x90d1('0x17')]?_0x28ade1[_0x90d1('0x17')][_0x90d1('0x18')]===undefined?!![]:![]:!![],'where':_0x28ade1[_0x90d1('0x17')]?_0x28ade1[_0x90d1('0x17')][_0x90d1('0x19')]||null:null,'attributes':_0x28ade1[_0x90d1('0x17')]?_0x28ade1[_0x90d1('0x17')][_0x90d1('0x1a')]||null:null,'limit':_0x28ade1[_0x90d1('0x17')]?_0x28ade1['options'][_0x90d1('0x1b')]||null:null,'include':_0x28ade1[_0x90d1('0x17')]?_0x28ade1[_0x90d1('0x17')][_0x90d1('0x1c')]?_[_0x90d1('0x1d')](_0x28ade1[_0x90d1('0x17')][_0x90d1('0x1c')],function(_0x6fef4){return{'model':db[_0x6fef4[_0x90d1('0x1e')]],'as':_0x6fef4['as'],'attributes':_0x6fef4['attributes'],'include':_0x6fef4[_0x90d1('0x1c')]?_[_0x90d1('0x1d')](_0x6fef4[_0x90d1('0x1c')],function(_0xc29843){return{'model':db[_0xc29843[_0x90d1('0x1e')]],'as':_0xc29843['as'],'attributes':_0xc29843[_0x90d1('0x1a')],'include':_0xc29843['include']?_['map'](_0xc29843[_0x90d1('0x1c')],function(_0x1cf267){return{'model':db[_0x1cf267['model']],'as':_0x1cf267['as'],'attributes':_0x1cf267['attributes']};}):[]};}):[]};}):[]:[]})[_0x90d1('0xb')](function(_0x48b40d){logger[_0x90d1('0x14')](_0x90d1('0x1f'),_0x28ade1);logger['debug'](_0x90d1('0x1f'),_0x28ade1,JSON[_0x90d1('0x10')](_0x48b40d));_0x3f671b(_0x48b40d);})[_0x90d1('0x20')](function(_0x28ba1f){logger[_0x90d1('0x11')](_0x90d1('0x1f'),_0x28ba1f[_0x90d1('0x13')],_0x28ade1);_0x23d006(_0x29d03f[_0x90d1('0x11')](0x1f4,_0x28ba1f[_0x90d1('0x13')]));});});};exports[_0x90d1('0x21')]=function(_0x5f4412){var _0x1813f1=this;return new Promise(function(_0x7c002b,_0x5e9728){return db['CmHopperBlack'][_0x90d1('0x22')](_0x5f4412['body'],{'raw':_0x5f4412[_0x90d1('0x17')]?_0x5f4412[_0x90d1('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f4412['options']?_0x5f4412[_0x90d1('0x17')]['where']||null:null,'attributes':_0x5f4412['options']?_0x5f4412['options']['attributes']||null:null,'limit':_0x5f4412[_0x90d1('0x17')]?_0x5f4412['options']['limit']||null:null})[_0x90d1('0xb')](function(_0x2e648e){logger[_0x90d1('0x14')]('UpdateCmHopperBlack',_0x5f4412);logger['debug']('UpdateCmHopperBlack',_0x5f4412,JSON['stringify'](_0x2e648e));_0x7c002b(_0x2e648e);})['catch'](function(_0x190506){logger['error'](_0x90d1('0x21'),_0x190506[_0x90d1('0x13')],_0x5f4412);_0x5e9728(_0x1813f1[_0x90d1('0x11')](0x1f4,_0x190506[_0x90d1('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x57f799){var _0x229d00=this;return new Promise(function(_0x5c372f,_0x550593){return db[_0x90d1('0x23')][_0x90d1('0x24')]({'where':_0x57f799['options']?_0x57f799['options'][_0x90d1('0x19')]||null:null})[_0x90d1('0xb')](function(_0x1a56e2){logger[_0x90d1('0x14')](_0x90d1('0x25'),_0x57f799);logger[_0x90d1('0xe')](_0x90d1('0x25'),_0x57f799,JSON[_0x90d1('0x10')](_0x1a56e2));_0x5c372f(_0x1a56e2);})[_0x90d1('0x20')](function(_0x53b4be){logger[_0x90d1('0x11')]('DestroyCmHopperBlack',_0x53b4be[_0x90d1('0x13')],_0x57f799);_0x550593(_0x229d00[_0x90d1('0x11')](0x1f4,_0x53b4be[_0x90d1('0x13')]));});});}; \ No newline at end of file +var _0xf8a2=['attributes','limit','include','map','model','UpdateCmHopperBlack','update','raw','DestroyCmHopperBlack','destroy','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','options','where'];(function(_0x3dd807,_0x308f62){var _0x404b84=function(_0xc7d6b0){while(--_0xc7d6b0){_0x3dd807['push'](_0x3dd807['shift']());}};_0x404b84(++_0x308f62);}(_0xf8a2,0xff));var _0x2f8a=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0xf8a2[_0x18b191];return _0x43e146;};'use strict';var _=require(_0x2f8a('0x0'));var util=require(_0x2f8a('0x1'));var moment=require(_0x2f8a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f8a('0x3'))['db'];var utils=require(_0x2f8a('0x4'));var logger=require(_0x2f8a('0x5'))(_0x2f8a('0x6'));var config=require(_0x2f8a('0x7'));var jayson=require(_0x2f8a('0x8'));var client=jayson['client'][_0x2f8a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a57bd,_0x1bf126,_0x1190aa){return new BPromise(function(_0x859ed5,_0x4a9275){return client[_0x2f8a('0xa')](_0x5a57bd,_0x1190aa)[_0x2f8a('0xb')](function(_0xd86b80){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x1bf126,_0x2f8a('0xc'));logger[_0x2f8a('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x1bf126,_0x2f8a('0xc'),JSON[_0x2f8a('0xe')](_0xd86b80));if(_0xd86b80[_0x2f8a('0xf')]){if(_0xd86b80[_0x2f8a('0xf')]['code']===0x1f4){logger[_0x2f8a('0xf')](_0x2f8a('0x10'),_0x1bf126,_0xd86b80[_0x2f8a('0xf')][_0x2f8a('0x11')]);return _0x4a9275(_0xd86b80[_0x2f8a('0xf')][_0x2f8a('0x11')]);}logger[_0x2f8a('0xf')](_0x2f8a('0x10'),_0x1bf126,_0xd86b80[_0x2f8a('0xf')][_0x2f8a('0x11')]);return _0x859ed5(_0xd86b80[_0x2f8a('0xf')]['message']);}else{logger[_0x2f8a('0x12')](_0x2f8a('0x10'),_0x1bf126,'request\x20sent');_0x859ed5(_0xd86b80[_0x2f8a('0x13')][_0x2f8a('0x11')]);}})[_0x2f8a('0x14')](function(_0xd91e1f){logger[_0x2f8a('0xf')](_0x2f8a('0x10'),_0x1bf126,_0xd91e1f);_0x4a9275(_0xd91e1f);});});}exports[_0x2f8a('0x15')]=function(_0x3bd01d){var _0x17be4f=this;return new Promise(function(_0x3bed47,_0x4e2566){return db[_0x2f8a('0x16')]['findAll']({'raw':_0x3bd01d[_0x2f8a('0x17')]?_0x3bd01d[_0x2f8a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3bd01d[_0x2f8a('0x17')]?_0x3bd01d[_0x2f8a('0x17')][_0x2f8a('0x18')]||null:null,'attributes':_0x3bd01d['options']?_0x3bd01d[_0x2f8a('0x17')][_0x2f8a('0x19')]||null:null,'limit':_0x3bd01d[_0x2f8a('0x17')]?_0x3bd01d[_0x2f8a('0x17')][_0x2f8a('0x1a')]||null:null,'include':_0x3bd01d[_0x2f8a('0x17')]?_0x3bd01d[_0x2f8a('0x17')][_0x2f8a('0x1b')]?_[_0x2f8a('0x1c')](_0x3bd01d[_0x2f8a('0x17')][_0x2f8a('0x1b')],function(_0x17d26e){return{'model':db[_0x17d26e['model']],'as':_0x17d26e['as'],'attributes':_0x17d26e['attributes'],'include':_0x17d26e[_0x2f8a('0x1b')]?_['map'](_0x17d26e[_0x2f8a('0x1b')],function(_0x5e747f){return{'model':db[_0x5e747f['model']],'as':_0x5e747f['as'],'attributes':_0x5e747f['attributes'],'include':_0x5e747f[_0x2f8a('0x1b')]?_['map'](_0x5e747f[_0x2f8a('0x1b')],function(_0x28a87a){return{'model':db[_0x28a87a[_0x2f8a('0x1d')]],'as':_0x28a87a['as'],'attributes':_0x28a87a[_0x2f8a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2f8a('0xb')](function(_0x1cb6da){logger[_0x2f8a('0x12')]('GetCmHopperBlack',_0x3bd01d);logger[_0x2f8a('0xd')](_0x2f8a('0x15'),_0x3bd01d,JSON[_0x2f8a('0xe')](_0x1cb6da));_0x3bed47(_0x1cb6da);})[_0x2f8a('0x14')](function(_0x269008){logger[_0x2f8a('0xf')](_0x2f8a('0x15'),_0x269008[_0x2f8a('0x11')],_0x3bd01d);_0x4e2566(_0x17be4f[_0x2f8a('0xf')](0x1f4,_0x269008[_0x2f8a('0x11')]));});});};exports[_0x2f8a('0x1e')]=function(_0x1e9670){var _0x1e2fe6=this;return new Promise(function(_0x39cb46,_0xa25c77){return db[_0x2f8a('0x16')][_0x2f8a('0x1f')](_0x1e9670['body'],{'raw':_0x1e9670[_0x2f8a('0x17')]?_0x1e9670['options'][_0x2f8a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e9670[_0x2f8a('0x17')]?_0x1e9670['options']['where']||null:null,'attributes':_0x1e9670[_0x2f8a('0x17')]?_0x1e9670['options'][_0x2f8a('0x19')]||null:null,'limit':_0x1e9670[_0x2f8a('0x17')]?_0x1e9670[_0x2f8a('0x17')][_0x2f8a('0x1a')]||null:null})[_0x2f8a('0xb')](function(_0x3a2e48){logger[_0x2f8a('0x12')]('UpdateCmHopperBlack',_0x1e9670);logger[_0x2f8a('0xd')](_0x2f8a('0x1e'),_0x1e9670,JSON['stringify'](_0x3a2e48));_0x39cb46(_0x3a2e48);})[_0x2f8a('0x14')](function(_0x2ecf33){logger[_0x2f8a('0xf')]('UpdateCmHopperBlack',_0x2ecf33['message'],_0x1e9670);_0xa25c77(_0x1e2fe6[_0x2f8a('0xf')](0x1f4,_0x2ecf33['message']));});});};exports[_0x2f8a('0x21')]=function(_0x9b1ec0){var _0x35dbe7=this;return new Promise(function(_0x3c7c96,_0x501221){return db[_0x2f8a('0x16')][_0x2f8a('0x22')]({'where':_0x9b1ec0[_0x2f8a('0x17')]?_0x9b1ec0[_0x2f8a('0x17')][_0x2f8a('0x18')]||null:null})[_0x2f8a('0xb')](function(_0x281104){logger[_0x2f8a('0x12')](_0x2f8a('0x21'),_0x9b1ec0);logger[_0x2f8a('0xd')](_0x2f8a('0x21'),_0x9b1ec0,JSON['stringify'](_0x281104));_0x3c7c96(_0x281104);})[_0x2f8a('0x14')](function(_0xf10717){logger[_0x2f8a('0xf')](_0x2f8a('0x21'),_0xf10717[_0x2f8a('0x11')],_0x9b1ec0);_0x501221(_0x35dbe7[_0x2f8a('0xf')](0x1f4,_0xf10717['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index e8efaba..4f120d9 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 _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8ace=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','put'];(function(_0x2e95ec,_0x195a89){var _0x11eccc=function(_0x2d1de4){while(--_0x2d1de4){_0x2e95ec['push'](_0x2e95ec['shift']());}};_0x11eccc(++_0x195a89);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x3cbb14,_0x3c95a7){_0x3cbb14=_0x3cbb14-0x0;var _0x2bfb35=_0x8ace[_0x3cbb14];return _0x2bfb35;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var fs_extra=require(_0xe8ac('0x6'));var auth=require(_0xe8ac('0x7'));var interaction=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var controller=require(_0xe8ac('0xa'));router[_0xe8ac('0xb')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0xd')]);router['get'](_0xe8ac('0xe'),auth[_0xe8ac('0xc')](),controller['describe']);router['get'](_0xe8ac('0xf'),auth['isAuthenticated'](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')](_0xe8ac('0xf'),auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x12')]);router[_0xe8ac('0x13')]('/:id',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x14')]);module[_0xe8ac('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 1068353..25ded47 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 _0xdb62=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','BOOLEAN','moment'];(function(_0x2f1b7c,_0x452cc2){var _0x1414c5=function(_0x2d3caf){while(--_0x2d3caf){_0x2f1b7c['push'](_0x2f1b7c['shift']());}};_0x1414c5(++_0x452cc2);}(_0xdb62,0x196));var _0x2db6=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0xdb62[_0x5c6244];return _0x5800ce;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2db6('0x0'));module[_0x2db6('0x1')]={'state':{'type':Sequelize[_0x2db6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2db6('0x3')]},'scheduledat':{'type':Sequelize[_0x2db6('0x4')]},'countbusyretry':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x2db6('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x2db6('0x4')]},'responsetime':{'type':Sequelize[_0x2db6('0x4')]},'answertime':{'type':Sequelize[_0x2db6('0x4')]},'droptime':{'type':Sequelize[_0x2db6('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2db6('0x3')]},'campaign':{'type':Sequelize[_0x2db6('0x3')]},'campaigntype':{'type':Sequelize[_0x2db6('0x3')]},'membername':{'type':Sequelize[_0x2db6('0x3')]},'reason':{'type':Sequelize[_0x2db6('0x3')]},'disposition':{'type':Sequelize[_0x2db6('0x3')]},'secondDisposition':{'type':Sequelize[_0x2db6('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2db6('0x3')]},'dispositionat':{'type':Sequelize[_0x2db6('0x4')],'set':function(_0x2fa7dc){var _0x55e617=this[_0x2db6('0x5')](_0x2db6('0x6'));if(_0x55e617&&_0x2fa7dc){this[_0x2db6('0x7')](_0x2db6('0x8'),moment(_0x2fa7dc)['diff'](moment(_0x55e617),_0x2db6('0x9')));}}},'amd':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2db6('0x4')]},'callback':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2db6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2db6('0x4')]},'deleted':{'type':Sequelize[_0x2db6('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2db6('0x4')]},'recallme':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb49c=['setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0xc63e57,_0x5f4a47){var _0xf49907=function(_0x3b9df6){while(--_0x3b9df6){_0xc63e57['push'](_0xc63e57['shift']());}};_0xf49907(++_0x5f4a47);}(_0xb49c,0x67));var _0xcb49=function(_0x233f5a,_0x6dc40c){_0x233f5a=_0x233f5a-0x0;var _0x23531e=_0xb49c[_0x233f5a];return _0x23531e;};'use strict';var Sequelize=require(_0xcb49('0x0'));var moment=require(_0xcb49('0x1'));module['exports']={'state':{'type':Sequelize[_0xcb49('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xcb49('0x3')]},'scheduledat':{'type':Sequelize[_0xcb49('0x4')]},'countbusyretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcb49('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xcb49('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcb49('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcb49('0x4')]},'answertime':{'type':Sequelize[_0xcb49('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcb49('0x3')]},'campaign':{'type':Sequelize[_0xcb49('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xcb49('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xcb49('0x3')]},'thirdDisposition':{'type':Sequelize[_0xcb49('0x3')]},'dispositionat':{'type':Sequelize[_0xcb49('0x4')],'set':function(_0x4bcadb){var _0x2c7351=this[_0xcb49('0x5')](_0xcb49('0x6'));if(_0x2c7351&&_0x4bcadb){this[_0xcb49('0x7')](_0xcb49('0x8'),moment(_0x4bcadb)[_0xcb49('0x9')](moment(_0x2c7351),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xcb49('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xcb49('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xcb49('0x4')]},'callback':{'type':Sequelize[_0xcb49('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcb49('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcb49('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xcb49('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index ff3ad21..eee035c 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 _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0x5d17,0x114));var _0x75d1=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0x5d17[_0x2af160];return _0x439d67;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file +var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0x5d17,0x114));var _0x75d1=function(_0x3c6b20,_0x315702){_0x3c6b20=_0x3c6b20-0x0;var _0x5d6849=_0x5d17[_0x3c6b20];return _0x5d6849;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 39d1342..7a4085e 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 _0x3c02=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x1fbada,_0xe9e33c){var _0x38f519=function(_0x6c4d5c){while(--_0x6c4d5c){_0x1fbada['push'](_0x1fbada['shift']());}};_0x38f519(++_0xe9e33c);}(_0x3c02,0x75));var _0x23c0=function(_0x215902,_0x5e57a1){_0x215902=_0x215902-0x0;var _0x12f7fe=_0x3c02[_0x215902];return _0x12f7fe;};'use strict';var _=require('lodash');var util=require(_0x23c0('0x0'));var logger=require(_0x23c0('0x1'))('api');var moment=require(_0x23c0('0x2'));var BPromise=require('bluebird');var rp=require(_0x23c0('0x3'));var fs=require('fs');var path=require(_0x23c0('0x4'));var rimraf=require(_0x23c0('0x5'));var config=require(_0x23c0('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x23c0('0x7')]=function(_0x208422,_0x4af0f3){return _0x208422[_0x23c0('0x8')](_0x23c0('0x9'),attributes,{'tableName':_0x23c0('0xa'),'paranoid':![],'indexes':[{'name':_0x23c0('0xb'),'fields':[_0x23c0('0xb')]},{'name':_0x23c0('0xc'),'fields':[_0x23c0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8614=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','define'];(function(_0x178312,_0x145a1a){var _0x585238=function(_0x330c2b){while(--_0x330c2b){_0x178312['push'](_0x178312['shift']());}};_0x585238(++_0x145a1a);}(_0x8614,0x1a8));var _0x4861=function(_0x2d5302,_0x77ce73){_0x2d5302=_0x2d5302-0x0;var _0x3fff6c=_0x8614[_0x2d5302];return _0x3fff6c;};'use strict';var _=require(_0x4861('0x0'));var util=require(_0x4861('0x1'));var logger=require(_0x4861('0x2'))(_0x4861('0x3'));var moment=require(_0x4861('0x4'));var BPromise=require(_0x4861('0x5'));var rp=require(_0x4861('0x6'));var fs=require('fs');var path=require(_0x4861('0x7'));var rimraf=require('rimraf');var config=require(_0x4861('0x8'));var attributes=require(_0x4861('0x9'));module['exports']=function(_0x12f287,_0xfd2cec){return _0x12f287[_0x4861('0xa')](_0x4861('0xb'),attributes,{'tableName':_0x4861('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x4861('0xd')]},{'name':_0x4861('0xe'),'fields':[_0x4861('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 31c4ea6..6db0cf9 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3bb775,_0x8ff869){var _0x3ece0c=function(_0x1f395f){while(--_0x1f395f){_0x3bb775['push'](_0x3bb775['shift']());}};_0x3ece0c(++_0x8ff869);}(_0x7a54,0x106));var _0x47a5=function(_0x38e2d8,_0xba513b){_0x38e2d8=_0x38e2d8-0x0;var _0x110d4d=_0x7a54[_0x38e2d8];return _0x110d4d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4a2bc6,_0x1dc74d){var _0x429a25=function(_0x2ea06e){while(--_0x2ea06e){_0x4a2bc6['push'](_0x4a2bc6['shift']());}};_0x429a25(++_0x1dc74d);}(_0x7a54,0x106));var _0x47a5=function(_0x11a87d,_0x983754){_0x11a87d=_0x11a87d-0x0;var _0x2e009e=_0x7a54[_0x11a87d];return _0x2e009e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 28047b1..c59bdf0 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 _0xbd8e=['post','moveContactsIvrCampaignHopperFinal','put','update','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal'];(function(_0x444439,_0x250eaa){var _0xc5397e=function(_0x49f6ea){while(--_0x49f6ea){_0x444439['push'](_0x444439['shift']());}};_0xc5397e(++_0x250eaa);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbd8e[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xebd8('0x2'));var router=express['Router']();var fs_extra=require(_0xebd8('0x3'));var auth=require(_0xebd8('0x4'));var interaction=require(_0xebd8('0x5'));var config=require(_0xebd8('0x6'));var controller=require(_0xebd8('0x7'));router['get']('/',auth[_0xebd8('0x8')](),controller[_0xebd8('0x9')]);router[_0xebd8('0xa')](_0xebd8('0xb'),auth[_0xebd8('0x8')](),controller['describe']);router[_0xebd8('0xa')](_0xebd8('0xc'),auth[_0xebd8('0x8')](),controller[_0xebd8('0xd')]);router['get']('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0xebd8('0xe')]);router[_0xebd8('0xa')](_0xebd8('0xf'),auth[_0xebd8('0x8')](),controller[_0xebd8('0x10')]);router['post'](_0xebd8('0x11'),auth['isAuthenticated'](),controller[_0xebd8('0x12')]);router[_0xebd8('0x13')]('/voice/campaign/moveContacts/:id',auth[_0xebd8('0x8')](),controller[_0xebd8('0x14')]);router[_0xebd8('0x13')]('/checkContactHopper',auth[_0xebd8('0x8')](),controller['checkContactHopper']);router[_0xebd8('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xebd8('0x16')]);module[_0xebd8('0x17')]=router; \ No newline at end of file +var _0xedd7=['get','index','isAuthenticated','describe','/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller'];(function(_0x41b45f,_0x3d3cc2){var _0x4423c2=function(_0x21dd9c){while(--_0x21dd9c){_0x41b45f['push'](_0x41b45f['shift']());}};_0x4423c2(++_0x3d3cc2);}(_0xedd7,0x6f));var _0x7edd=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0xedd7[_0x996bc8];return _0x20b0ea;};'use strict';var multer=require('multer');var util=require(_0x7edd('0x0'));var path=require(_0x7edd('0x1'));var timeout=require(_0x7edd('0x2'));var express=require(_0x7edd('0x3'));var router=express[_0x7edd('0x4')]();var fs_extra=require(_0x7edd('0x5'));var auth=require(_0x7edd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7edd('0x7'));var controller=require(_0x7edd('0x8'));router[_0x7edd('0x9')]('/',auth['isAuthenticated'](),controller[_0x7edd('0xa')]);router[_0x7edd('0x9')]('/describe',auth[_0x7edd('0xb')](),controller[_0x7edd('0xc')]);router[_0x7edd('0x9')](_0x7edd('0xd'),auth[_0x7edd('0xb')](),controller['show']);router['get']('/voice/queue/countAttributes/:id',auth[_0x7edd('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x7edd('0x9')](_0x7edd('0xe'),auth[_0x7edd('0xb')](),controller[_0x7edd('0xf')]);router[_0x7edd('0x10')](_0x7edd('0x11'),auth[_0x7edd('0xb')](),controller[_0x7edd('0x12')]);router[_0x7edd('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x7edd('0xb')](),controller[_0x7edd('0x13')]);router[_0x7edd('0x10')](_0x7edd('0x14'),auth[_0x7edd('0xb')](),controller[_0x7edd('0x15')]);router[_0x7edd('0x16')]('/:id',auth[_0x7edd('0xb')](),controller['update']);module[_0x7edd('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 4fe4696..fd25a31 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 _0x72f6=['exports','INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x68e023,_0xd94365){var _0x26e8fd=function(_0x529245){while(--_0x529245){_0x68e023['push'](_0x68e023['shift']());}};_0x26e8fd(++_0xd94365);}(_0x72f6,0x1a9));var _0x672f=function(_0x595afb,_0x3ef3ea){_0x595afb=_0x595afb-0x0;var _0xd535a=_0x72f6[_0x595afb];return _0xd535a;};'use strict';var Sequelize=require(_0x672f('0x0'));module[_0x672f('0x1')]={'state':{'type':Sequelize[_0x672f('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x672f('0x3')]},'countbusyretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x672f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x672f('0x4')]},'originatecalleridname':{'type':Sequelize[_0x672f('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x672f('0x4')]},'starttime':{'type':Sequelize[_0x672f('0x3')]},'responsetime':{'type':Sequelize[_0x672f('0x3')]},'answertime':{'type':Sequelize[_0x672f('0x3')]},'droptime':{'type':Sequelize[_0x672f('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x672f('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x672f('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x672f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x672f('0x3')]},'recallme':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x672f('0x4')]}}; \ No newline at end of file +var _0x613e=['BOOLEAN','sequelize','exports','DATE','INTEGER','STRING'];(function(_0xd09873,_0x919e8b){var _0x243c9f=function(_0x3d6225){while(--_0x3d6225){_0xd09873['push'](_0xd09873['shift']());}};_0x243c9f(++_0x919e8b);}(_0x613e,0x1e1));var _0xe613=function(_0x150bd3,_0x200ef5){_0x150bd3=_0x150bd3-0x0;var _0x338063=_0x613e[_0x150bd3];return _0x338063;};'use strict';var Sequelize=require(_0xe613('0x0'));module[_0xe613('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe613('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe613('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xe613('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe613('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe613('0x4')]},'starttime':{'type':Sequelize[_0xe613('0x2')]},'responsetime':{'type':Sequelize[_0xe613('0x2')]},'answertime':{'type':Sequelize[_0xe613('0x2')]},'droptime':{'type':Sequelize[_0xe613('0x2')]},'endtime':{'type':Sequelize[_0xe613('0x2')]},'ringtime':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe613('0x4')]},'campaign':{'type':Sequelize[_0xe613('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe613('0x4')]},'amd':{'type':Sequelize[_0xe613('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe613('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe613('0x2')]},'recallme':{'type':Sequelize[_0xe613('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe613('0x2')]},'edited':{'type':Sequelize[_0xe613('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe613('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a5b8e02..b25b630 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 _0xb600=['rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','CmHopperHistory','includeAll','findAll','rows','catch','show','params','length','include','find','create','describe','body','uniqueid'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xb600,0x163));var _0x0b60=function(_0x60b4b5,_0x4b9f3c){_0x60b4b5=_0x60b4b5-0x0;var _0x5ce041=_0xb600[_0x60b4b5];return _0x5ce041;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b60('0x1'));var rp=require('request-promise');var moment=require(_0x0b60('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0b60('0x3'));var util=require(_0x0b60('0x4'));var path=require(_0x0b60('0x5'));var sox=require(_0x0b60('0x6'));var csv=require(_0x0b60('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b60('0x8'));var squel=require(_0x0b60('0x9'));var crypto=require(_0x0b60('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0b60('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b60('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b60('0xd'));var as=require(_0x0b60('0xe'));var hardwareService=require(_0x0b60('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0b60('0x10'));var licenseUtil=require(_0x0b60('0x11'));var db=require(_0x0b60('0x12'))['db'];function respondWithStatusCode(_0x317c0a,_0x502c69){_0x502c69=_0x502c69||0xcc;return function(_0x544969){if(_0x544969){return _0x317c0a['sendStatus'](_0x502c69);}return _0x317c0a[_0x0b60('0x13')](_0x502c69)[_0x0b60('0x14')]();};}function respondWithResult(_0x58b759,_0xb64fff){_0xb64fff=_0xb64fff||0xc8;return function(_0x575e2e){if(_0x575e2e){return _0x58b759['status'](_0xb64fff)[_0x0b60('0x15')](_0x575e2e);}};}function respondWithFilteredResult(_0x26850c,_0x56eb5e){return function(_0x14cb20){if(_0x14cb20){var _0x13eb7b=typeof _0x56eb5e['offset']===_0x0b60('0x16')&&typeof _0x56eb5e[_0x0b60('0x17')]===_0x0b60('0x16');var _0x1d342a=_0x14cb20[_0x0b60('0x18')];var _0x38c6e5=_0x13eb7b?0x0:_0x56eb5e[_0x0b60('0x19')];var _0x4cf841=_0x13eb7b?_0x14cb20[_0x0b60('0x18')]:_0x56eb5e[_0x0b60('0x19')]+_0x56eb5e['limit'];var _0x5a84ff;if(_0x4cf841>=_0x1d342a){_0x4cf841=_0x1d342a;_0x5a84ff=0xc8;}else{_0x5a84ff=0xce;}_0x26850c[_0x0b60('0x13')](_0x5a84ff);return _0x26850c[_0x0b60('0x1a')](_0x0b60('0x1b'),_0x38c6e5+'-'+_0x4cf841+'/'+_0x1d342a)[_0x0b60('0x15')](_0x14cb20);}return null;};}function patchUpdates(_0x4b029b){return function(_0x4cb00a){try{jsonpatch['apply'](_0x4cb00a,_0x4b029b,!![]);}catch(_0x425556){return BPromise[_0x0b60('0x1c')](_0x425556);}return _0x4cb00a[_0x0b60('0x1d')]();};}function saveUpdates(_0x1d8897,_0x89b228){return function(_0x26eb14){if(_0x26eb14){return _0x26eb14[_0x0b60('0x1e')](_0x1d8897)[_0x0b60('0x1f')](function(_0x2a8f96){return _0x2a8f96;});}return null;};}function removeEntity(_0x4804a3,_0x447699){return function(_0x30d33c){if(_0x30d33c){return _0x30d33c['destroy']()[_0x0b60('0x1f')](function(){_0x4804a3[_0x0b60('0x13')](0xcc)[_0x0b60('0x14')]();});}};}function handleEntityNotFound(_0x5cb1ee,_0x3e9704){return function(_0x47efe5){if(!_0x47efe5){_0x5cb1ee['sendStatus'](0x194);}return _0x47efe5;};}function handleError(_0x48761a,_0x463435){_0x463435=_0x463435||0x1f4;return function(_0x43e983){logger[_0x0b60('0x20')](_0x43e983[_0x0b60('0x21')]);if(_0x43e983[_0x0b60('0x22')]){delete _0x43e983['name'];}_0x48761a['status'](_0x463435)['send'](_0x43e983);};}exports[_0x0b60('0x23')]=function(_0x42d626,_0x387aab){var _0x48f0f4={},_0x4bf5d6={},_0x28909d={'count':0x0,'rows':[]};var _0x5b2e65=_[_0x0b60('0x24')](db['CmHopperHistory'][_0x0b60('0x25')],function(_0x3d28e9){return{'name':_0x3d28e9[_0x0b60('0x26')],'type':_0x3d28e9[_0x0b60('0x27')][_0x0b60('0x28')]};});_0x4bf5d6[_0x0b60('0x29')]=_['map'](_0x5b2e65,_0x0b60('0x22'));_0x4bf5d6[_0x0b60('0x2a')]=_[_0x0b60('0x2b')](_0x42d626[_0x0b60('0x2a')]);_0x4bf5d6[_0x0b60('0x2c')]=_[_0x0b60('0x2d')](_0x4bf5d6[_0x0b60('0x29')],_0x4bf5d6['query']);_0x48f0f4[_0x0b60('0x2e')]=_[_0x0b60('0x2d')](_0x4bf5d6[_0x0b60('0x29')],qs[_0x0b60('0x2f')](_0x42d626[_0x0b60('0x2a')][_0x0b60('0x2f')]));_0x48f0f4['attributes']=_0x48f0f4['attributes']['length']?_0x48f0f4['attributes']:_0x4bf5d6[_0x0b60('0x29')];if(!_0x42d626['query'][_0x0b60('0x30')](_0x0b60('0x31'))){_0x48f0f4[_0x0b60('0x17')]=qs[_0x0b60('0x17')](_0x42d626['query'][_0x0b60('0x17')]);_0x48f0f4[_0x0b60('0x19')]=qs[_0x0b60('0x19')](_0x42d626[_0x0b60('0x2a')]['offset']);}_0x48f0f4['order']=qs[_0x0b60('0x32')](_0x42d626[_0x0b60('0x2a')][_0x0b60('0x32')]);_0x48f0f4['where']=qs[_0x0b60('0x2c')](_[_0x0b60('0x33')](_0x42d626['query'],_0x4bf5d6[_0x0b60('0x2c')]),_0x5b2e65);if(_0x42d626['query'][_0x0b60('0x34')]){_0x48f0f4[_0x0b60('0x35')]=_[_0x0b60('0x36')](_0x48f0f4[_0x0b60('0x35')],{'$or':_[_0x0b60('0x24')](_0x5b2e65,function(_0x208b4c){if(_0x208b4c[_0x0b60('0x27')]!==_0x0b60('0x37')){var _0x123d95={};_0x123d95[_0x208b4c[_0x0b60('0x22')]]={'$like':'%'+_0x42d626['query'][_0x0b60('0x34')]+'%'};return _0x123d95;}})});}_0x48f0f4=_[_0x0b60('0x36')]({},_0x48f0f4,_0x42d626[_0x0b60('0x38')]);var _0x3237d3={'where':_0x48f0f4[_0x0b60('0x35')]};return db[_0x0b60('0x39')][_0x0b60('0x18')](_0x3237d3)['then'](function(_0x27c102){_0x28909d['count']=_0x27c102;if(_0x42d626[_0x0b60('0x2a')][_0x0b60('0x3a')]){_0x48f0f4['include']=[{'all':!![]}];}return db[_0x0b60('0x39')][_0x0b60('0x3b')](_0x48f0f4);})[_0x0b60('0x1f')](function(_0x2960f8){_0x28909d[_0x0b60('0x3c')]=_0x2960f8;return _0x28909d;})['then'](respondWithFilteredResult(_0x387aab,_0x48f0f4))[_0x0b60('0x3d')](handleError(_0x387aab,null));};exports[_0x0b60('0x3e')]=function(_0x159012,_0x41a4c1){var _0x2ca641={'raw':!![],'where':{'id':_0x159012[_0x0b60('0x3f')]['id']}},_0x6dd1b2={};_0x6dd1b2[_0x0b60('0x29')]=_[_0x0b60('0x2b')](db[_0x0b60('0x39')][_0x0b60('0x25')]);_0x6dd1b2[_0x0b60('0x2a')]=_['keys'](_0x159012[_0x0b60('0x2a')]);_0x6dd1b2[_0x0b60('0x2c')]=_[_0x0b60('0x2d')](_0x6dd1b2[_0x0b60('0x29')],_0x6dd1b2[_0x0b60('0x2a')]);_0x2ca641[_0x0b60('0x2e')]=_['intersection'](_0x6dd1b2[_0x0b60('0x29')],qs[_0x0b60('0x2f')](_0x159012[_0x0b60('0x2a')][_0x0b60('0x2f')]));_0x2ca641['attributes']=_0x2ca641[_0x0b60('0x2e')][_0x0b60('0x40')]?_0x2ca641[_0x0b60('0x2e')]:_0x6dd1b2['model'];if(_0x159012[_0x0b60('0x2a')][_0x0b60('0x3a')]){_0x2ca641[_0x0b60('0x41')]=[{'all':!![]}];}_0x2ca641=_[_0x0b60('0x36')]({},_0x2ca641,_0x159012[_0x0b60('0x38')]);return db['CmHopperHistory'][_0x0b60('0x42')](_0x2ca641)[_0x0b60('0x1f')](handleEntityNotFound(_0x41a4c1,null))[_0x0b60('0x1f')](respondWithResult(_0x41a4c1,null))[_0x0b60('0x3d')](handleError(_0x41a4c1,null));};exports[_0x0b60('0x43')]=function(_0x3095c1,_0x4ce5ac){return db[_0x0b60('0x39')][_0x0b60('0x43')](_0x3095c1['body'],{})[_0x0b60('0x1f')](respondWithResult(_0x4ce5ac,0xc9))[_0x0b60('0x3d')](handleError(_0x4ce5ac,null));};exports[_0x0b60('0x44')]=function(_0x44717e,_0x4098ef){return db[_0x0b60('0x39')]['describe']()[_0x0b60('0x1f')](respondWithResult(_0x4098ef,null))[_0x0b60('0x3d')](handleError(_0x4098ef,null));};exports[_0x0b60('0x1e')]=function(_0x4794ca,_0x5223af){if(_0x4794ca[_0x0b60('0x45')][_0x0b60('0x46')]){delete _0x4794ca[_0x0b60('0x45')][_0x0b60('0x46')];}return db[_0x0b60('0x39')][_0x0b60('0x42')]({'where':{'uniqueid':_0x4794ca[_0x0b60('0x3f')]['id']}})[_0x0b60('0x1f')](handleEntityNotFound(_0x5223af,null))[_0x0b60('0x1f')](saveUpdates(_0x4794ca[_0x0b60('0x45')],null))[_0x0b60('0x1f')](respondWithResult(_0x5223af,null))['catch'](handleError(_0x5223af,null));}; \ No newline at end of file +var _0xb4c9=['stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','describe','update','uniqueid','params','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0x242f0a,_0x30ea24){var _0x361e57=function(_0x3c8d05){while(--_0x3c8d05){_0x242f0a['push'](_0x242f0a['shift']());}};_0x361e57(++_0x30ea24);}(_0xb4c9,0xc0));var _0x9b4c=function(_0x4b6387,_0x140898){_0x4b6387=_0x4b6387-0x0;var _0x2d8b78=_0xb4c9[_0x4b6387];return _0x2d8b78;};'use strict';var emlformat=require(_0x9b4c('0x0'));var rimraf=require(_0x9b4c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b4c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9b4c('0x3'));var util=require(_0x9b4c('0x4'));var path=require(_0x9b4c('0x5'));var sox=require('sox');var csv=require(_0x9b4c('0x6'));var ejs=require(_0x9b4c('0x7'));var fs=require('fs');var fs_extra=require(_0x9b4c('0x8'));var _=require(_0x9b4c('0x9'));var squel=require(_0x9b4c('0xa'));var crypto=require(_0x9b4c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b4c('0x6'));var querystring=require(_0x9b4c('0xc'));var Papa=require(_0x9b4c('0xd'));var Redis=require('ioredis');var authService=require(_0x9b4c('0xe'));var qs=require(_0x9b4c('0xf'));var as=require(_0x9b4c('0x10'));var hardwareService=require(_0x9b4c('0x11'));var logger=require(_0x9b4c('0x12'))('api');var utils=require(_0x9b4c('0x13'));var config=require(_0x9b4c('0x14'));var licenseUtil=require(_0x9b4c('0x15'));var db=require(_0x9b4c('0x16'))['db'];function respondWithStatusCode(_0x597b23,_0x222c9c){_0x222c9c=_0x222c9c||0xcc;return function(_0x308eff){if(_0x308eff){return _0x597b23[_0x9b4c('0x17')](_0x222c9c);}return _0x597b23[_0x9b4c('0x18')](_0x222c9c)[_0x9b4c('0x19')]();};}function respondWithResult(_0x553659,_0xb7260){_0xb7260=_0xb7260||0xc8;return function(_0x40335f){if(_0x40335f){return _0x553659['status'](_0xb7260)[_0x9b4c('0x1a')](_0x40335f);}};}function respondWithFilteredResult(_0x1ddb09,_0x2b90b4){return function(_0x368646){if(_0x368646){var _0xfe69c8=typeof _0x2b90b4[_0x9b4c('0x1b')]==='undefined'&&typeof _0x2b90b4[_0x9b4c('0x1c')]===_0x9b4c('0x1d');var _0x321683=_0x368646[_0x9b4c('0x1e')];var _0x28283f=_0xfe69c8?0x0:_0x2b90b4['offset'];var _0x1fb132=_0xfe69c8?_0x368646[_0x9b4c('0x1e')]:_0x2b90b4[_0x9b4c('0x1b')]+_0x2b90b4[_0x9b4c('0x1c')];var _0x10b29d;if(_0x1fb132>=_0x321683){_0x1fb132=_0x321683;_0x10b29d=0xc8;}else{_0x10b29d=0xce;}_0x1ddb09[_0x9b4c('0x18')](_0x10b29d);return _0x1ddb09[_0x9b4c('0x1f')](_0x9b4c('0x20'),_0x28283f+'-'+_0x1fb132+'/'+_0x321683)[_0x9b4c('0x1a')](_0x368646);}return null;};}function patchUpdates(_0x5cbbfc){return function(_0x84f7da){try{jsonpatch[_0x9b4c('0x21')](_0x84f7da,_0x5cbbfc,!![]);}catch(_0x1464ac){return BPromise[_0x9b4c('0x22')](_0x1464ac);}return _0x84f7da[_0x9b4c('0x23')]();};}function saveUpdates(_0x104e31,_0x554db5){return function(_0x329a60){if(_0x329a60){return _0x329a60['update'](_0x104e31)[_0x9b4c('0x24')](function(_0x4c7e3e){return _0x4c7e3e;});}return null;};}function removeEntity(_0x2097af,_0x55de0d){return function(_0x3bf0db){if(_0x3bf0db){return _0x3bf0db[_0x9b4c('0x25')]()[_0x9b4c('0x24')](function(){_0x2097af[_0x9b4c('0x18')](0xcc)[_0x9b4c('0x19')]();});}};}function handleEntityNotFound(_0x1381ef,_0x21cd68){return function(_0x11ce7c){if(!_0x11ce7c){_0x1381ef[_0x9b4c('0x17')](0x194);}return _0x11ce7c;};}function handleError(_0x454a80,_0x5496bf){_0x5496bf=_0x5496bf||0x1f4;return function(_0x294177){logger[_0x9b4c('0x26')](_0x294177[_0x9b4c('0x27')]);if(_0x294177[_0x9b4c('0x28')]){delete _0x294177['name'];}_0x454a80[_0x9b4c('0x18')](_0x5496bf)[_0x9b4c('0x29')](_0x294177);};}exports['index']=function(_0x4d7946,_0x3c92ab){var _0x514418={},_0x45b27d={},_0x42e269={'count':0x0,'rows':[]};var _0x59d32c=_[_0x9b4c('0x2a')](db[_0x9b4c('0x2b')][_0x9b4c('0x2c')],function(_0x449b27){return{'name':_0x449b27[_0x9b4c('0x2d')],'type':_0x449b27['type']['key']};});_0x45b27d[_0x9b4c('0x2e')]=_['map'](_0x59d32c,_0x9b4c('0x28'));_0x45b27d[_0x9b4c('0x2f')]=_[_0x9b4c('0x30')](_0x4d7946[_0x9b4c('0x2f')]);_0x45b27d[_0x9b4c('0x31')]=_['intersection'](_0x45b27d[_0x9b4c('0x2e')],_0x45b27d['query']);_0x514418[_0x9b4c('0x32')]=_[_0x9b4c('0x33')](_0x45b27d[_0x9b4c('0x2e')],qs[_0x9b4c('0x34')](_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x34')]));_0x514418[_0x9b4c('0x32')]=_0x514418[_0x9b4c('0x32')][_0x9b4c('0x35')]?_0x514418[_0x9b4c('0x32')]:_0x45b27d[_0x9b4c('0x2e')];if(!_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x36')](_0x9b4c('0x37'))){_0x514418[_0x9b4c('0x1c')]=qs[_0x9b4c('0x1c')](_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x1c')]);_0x514418[_0x9b4c('0x1b')]=qs[_0x9b4c('0x1b')](_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x1b')]);}_0x514418['order']=qs[_0x9b4c('0x38')](_0x4d7946[_0x9b4c('0x2f')]['sort']);_0x514418[_0x9b4c('0x39')]=qs[_0x9b4c('0x31')](_[_0x9b4c('0x3a')](_0x4d7946['query'],_0x45b27d[_0x9b4c('0x31')]),_0x59d32c);if(_0x4d7946['query'][_0x9b4c('0x3b')]){_0x514418[_0x9b4c('0x39')]=_[_0x9b4c('0x3c')](_0x514418[_0x9b4c('0x39')],{'$or':_[_0x9b4c('0x2a')](_0x59d32c,function(_0x579b8f){if(_0x579b8f[_0x9b4c('0x3d')]!==_0x9b4c('0x3e')){var _0x157ace={};_0x157ace[_0x579b8f[_0x9b4c('0x28')]]={'$like':'%'+_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x3b')]+'%'};return _0x157ace;}})});}_0x514418=_['merge']({},_0x514418,_0x4d7946[_0x9b4c('0x3f')]);var _0x158a36={'where':_0x514418[_0x9b4c('0x39')]};return db[_0x9b4c('0x2b')][_0x9b4c('0x1e')](_0x158a36)[_0x9b4c('0x24')](function(_0x411ab4){_0x42e269[_0x9b4c('0x1e')]=_0x411ab4;if(_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x40')]){_0x514418[_0x9b4c('0x41')]=[{'all':!![]}];}return db[_0x9b4c('0x2b')][_0x9b4c('0x42')](_0x514418);})['then'](function(_0x4e7353){_0x42e269[_0x9b4c('0x43')]=_0x4e7353;return _0x42e269;})[_0x9b4c('0x24')](respondWithFilteredResult(_0x3c92ab,_0x514418))[_0x9b4c('0x44')](handleError(_0x3c92ab,null));};exports[_0x9b4c('0x45')]=function(_0x4ba01d,_0x32e433){var _0x3bb6f1={'raw':!![],'where':{'id':_0x4ba01d['params']['id']}},_0x51ebbe={};_0x51ebbe[_0x9b4c('0x2e')]=_[_0x9b4c('0x30')](db[_0x9b4c('0x2b')][_0x9b4c('0x2c')]);_0x51ebbe[_0x9b4c('0x2f')]=_[_0x9b4c('0x30')](_0x4ba01d[_0x9b4c('0x2f')]);_0x51ebbe[_0x9b4c('0x31')]=_[_0x9b4c('0x33')](_0x51ebbe[_0x9b4c('0x2e')],_0x51ebbe[_0x9b4c('0x2f')]);_0x3bb6f1[_0x9b4c('0x32')]=_[_0x9b4c('0x33')](_0x51ebbe['model'],qs[_0x9b4c('0x34')](_0x4ba01d[_0x9b4c('0x2f')][_0x9b4c('0x34')]));_0x3bb6f1[_0x9b4c('0x32')]=_0x3bb6f1[_0x9b4c('0x32')][_0x9b4c('0x35')]?_0x3bb6f1[_0x9b4c('0x32')]:_0x51ebbe['model'];if(_0x4ba01d[_0x9b4c('0x2f')][_0x9b4c('0x40')]){_0x3bb6f1[_0x9b4c('0x41')]=[{'all':!![]}];}_0x3bb6f1=_[_0x9b4c('0x3c')]({},_0x3bb6f1,_0x4ba01d[_0x9b4c('0x3f')]);return db['CmHopperHistory'][_0x9b4c('0x46')](_0x3bb6f1)[_0x9b4c('0x24')](handleEntityNotFound(_0x32e433,null))[_0x9b4c('0x24')](respondWithResult(_0x32e433,null))[_0x9b4c('0x44')](handleError(_0x32e433,null));};exports[_0x9b4c('0x47')]=function(_0x486eaf,_0x3bb94d){return db[_0x9b4c('0x2b')][_0x9b4c('0x47')](_0x486eaf[_0x9b4c('0x48')],{})[_0x9b4c('0x24')](respondWithResult(_0x3bb94d,0xc9))[_0x9b4c('0x44')](handleError(_0x3bb94d,null));};exports[_0x9b4c('0x49')]=function(_0x69b327,_0x58a22f){return db[_0x9b4c('0x2b')][_0x9b4c('0x49')]()['then'](respondWithResult(_0x58a22f,null))[_0x9b4c('0x44')](handleError(_0x58a22f,null));};exports[_0x9b4c('0x4a')]=function(_0x128bed,_0x3b840d){if(_0x128bed[_0x9b4c('0x48')]['uniqueid']){delete _0x128bed[_0x9b4c('0x48')][_0x9b4c('0x4b')];}return db[_0x9b4c('0x2b')][_0x9b4c('0x46')]({'where':{'uniqueid':_0x128bed[_0x9b4c('0x4c')]['id']}})[_0x9b4c('0x24')](handleEntityNotFound(_0x3b840d,null))[_0x9b4c('0x24')](saveUpdates(_0x128bed['body'],null))[_0x9b4c('0x24')](respondWithResult(_0x3b840d,null))[_0x9b4c('0x44')](handleError(_0x3b840d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a023553..77b176d 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 _0xa817=['bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x488f80,_0x5d2b86){var _0xf7510d=function(_0x5cf346){while(--_0x5cf346){_0x488f80['push'](_0x488f80['shift']());}};_0xf7510d(++_0x5d2b86);}(_0xa817,0x7b));var _0x7a81=function(_0x2dc6e9,_0xfc0451){_0x2dc6e9=_0x2dc6e9-0x0;var _0x51003d=_0xa817[_0x2dc6e9];return _0x51003d;};'use strict';var _=require(_0x7a81('0x0'));var util=require(_0x7a81('0x1'));var logger=require(_0x7a81('0x2'))(_0x7a81('0x3'));var moment=require(_0x7a81('0x4'));var BPromise=require(_0x7a81('0x5'));var rp=require(_0x7a81('0x6'));var fs=require('fs');var path=require(_0x7a81('0x7'));var rimraf=require(_0x7a81('0x8'));var config=require('../../config/environment');var attributes=require(_0x7a81('0x9'));module[_0x7a81('0xa')]=function(_0x5bf69b,_0x2249d1){return _0x5bf69b[_0x7a81('0xb')](_0x7a81('0xc'),attributes,{'tableName':_0x7a81('0xd'),'paranoid':![],'indexes':[{'name':_0x7a81('0xe'),'fields':[_0x7a81('0xe')]},{'name':'uniqueid','fields':[_0x7a81('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcbb=['request-promise','path','rimraf','../../config/environment','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x30d85e,_0x40dba5){var _0x182458=function(_0x3358ae){while(--_0x3358ae){_0x30d85e['push'](_0x30d85e['shift']());}};_0x182458(++_0x40dba5);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x45482d,_0x23dd67){_0x45482d=_0x45482d-0x0;var _0x6adfd6=_0xfcbb[_0x45482d];return _0x6adfd6;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var logger=require(_0xbfcb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbfcb('0x3'));var rp=require(_0xbfcb('0x4'));var fs=require('fs');var path=require(_0xbfcb('0x5'));var rimraf=require(_0xbfcb('0x6'));var config=require(_0xbfcb('0x7'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x32c2aa,_0x4990c){return _0x32c2aa[_0xbfcb('0x8')](_0xbfcb('0x9'),attributes,{'tableName':_0xbfcb('0xa'),'paranoid':![],'indexes':[{'name':_0xbfcb('0xb'),'fields':[_0xbfcb('0xb')]},{'name':'uniqueid','fields':[_0xbfcb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index f32f369..eef7504 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 _0xcc73=['predictiveIntervalAvgTalktime','then','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`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','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','raw','stringify','AvgHandleTime','findAll','options','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime'];(function(_0x46c638,_0x1193ad){var _0x24e55a=function(_0x4c129d){while(--_0x4c129d){_0x46c638['push'](_0x46c638['shift']());}};_0x24e55a(++_0x1193ad);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xcc73[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x3cc7('0x0'));var moment=require(_0x3cc7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cc7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3cc7('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x3cc7('0x4'));var jayson=require(_0x3cc7('0x5'));var client=jayson[_0x3cc7('0x6')][_0x3cc7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x127590,_0x5604df,_0x416c48){return new BPromise(function(_0x37c184,_0x3f2dd7){return client[_0x3cc7('0x8')](_0x127590,_0x416c48)['then'](function(_0x2ff7ba){logger[_0x3cc7('0x9')](_0x3cc7('0xa'),_0x5604df,_0x3cc7('0xb'));logger[_0x3cc7('0xc')](_0x3cc7('0xd'),_0x5604df,_0x3cc7('0xb'),JSON['stringify'](_0x2ff7ba));if(_0x2ff7ba['error']){if(_0x2ff7ba[_0x3cc7('0xe')]['code']===0x1f4){logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);return _0x3f2dd7(_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);}logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);return _0x37c184(_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);}else{logger[_0x3cc7('0x9')](_0x3cc7('0xa'),_0x5604df,_0x3cc7('0xb'));_0x37c184(_0x2ff7ba[_0x3cc7('0x10')][_0x3cc7('0xf')]);}})[_0x3cc7('0x11')](function(_0x386a31){logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x386a31);_0x3f2dd7(_0x386a31);});});}exports[_0x3cc7('0x12')]=function(_0x2a4ddf){var _0xff4317=this;return new Promise(function(_0x118aa0,_0x2f196a){return db[_0x3cc7('0x13')][_0x3cc7('0x14')](_0x2a4ddf[_0x3cc7('0x15')],{'raw':_0x2a4ddf['options']?_0x2a4ddf['options'][_0x3cc7('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x41c9fb){logger[_0x3cc7('0x9')](_0x3cc7('0x12'),_0x2a4ddf);logger['debug']('CreateCmHopperHistory',_0x2a4ddf,JSON[_0x3cc7('0x17')](_0x41c9fb));_0x118aa0(_0x41c9fb);})[_0x3cc7('0x11')](function(_0x4d5b7f){logger[_0x3cc7('0xe')](_0x3cc7('0x12'),_0x4d5b7f['message'],_0x2a4ddf);_0x2f196a(_0xff4317[_0x3cc7('0xe')](0x1f4,_0x4d5b7f['message']));});});};exports[_0x3cc7('0x18')]=function(_0x50a8fb){var _0x1cfcee=this;return new Promise(function(_0x3b1fe6,_0x8f8709){return db[_0x3cc7('0x13')][_0x3cc7('0x19')]({'raw':_0x50a8fb[_0x3cc7('0x1a')]?_0x50a8fb['options'][_0x3cc7('0x16')]===undefined?!![]:![]:!![],'where':_0x50a8fb[_0x3cc7('0x1a')]?_0x50a8fb[_0x3cc7('0x1a')]['where']||null:null,'attributes':[[db[_0x3cc7('0x1b')]['fn']('COUNT',db['sequelize']['col']('id')),_0x3cc7('0x1c')],[db[_0x3cc7('0x1b')]['fn']('COUNT',db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x1e')))),_0x3cc7('0x1f')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x21')))),_0x3cc7('0x22')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x3cc7('0x23'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x24')))),_0x3cc7('0x25')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x23'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3cc7('0x26')]]})[_0x3cc7('0x27')](function(_0xba3c9a){logger['info']('AvgHandleTime',_0x50a8fb);logger[_0x3cc7('0xc')](_0x3cc7('0x18'),_0x50a8fb,JSON['stringify'](_0xba3c9a));_0x3b1fe6(_0xba3c9a);})[_0x3cc7('0x11')](function(_0x4b89af){logger[_0x3cc7('0xe')](_0x3cc7('0x18'),_0x4b89af['message'],_0x50a8fb);_0x8f8709(_0x1cfcee[_0x3cc7('0xe')](0x1f4,_0x4b89af[_0x3cc7('0xf')]));});});};exports[_0x3cc7('0x28')]=function(_0x17576b){var _0x428ad2=this;return new Promise(function(_0x1638c7,_0x5771c2){return db[_0x3cc7('0x13')][_0x3cc7('0x19')]({'raw':_0x17576b['options']?_0x17576b[_0x3cc7('0x1a')][_0x3cc7('0x16')]===undefined?!![]:![]:!![],'where':_0x17576b['options']?_0x17576b[_0x3cc7('0x1a')]['where']||null:null,'attributes':[[_0x3cc7('0x29'),_0x3cc7('0x2a')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x2b')))),_0x3cc7('0x2c')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')](_0x3cc7('0x2d')))),_0x3cc7('0x2e')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x1e')))),_0x3cc7('0x2f')],[db['sequelize']['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x30')))),_0x3cc7('0x31')],[db[_0x3cc7('0x1b')]['fn']('COUNT',db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x32')))),_0x3cc7('0x33')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')](_0x3cc7('0x34')))),'outboundDropCallsDayTimeout'],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x35')))),_0x3cc7('0x36')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x37')))),_0x3cc7('0x38')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db['sequelize']['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x39')))),_0x3cc7('0x3a')],[db['sequelize']['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')](_0x3cc7('0x3b')))),_0x3cc7('0x3c')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db['sequelize']['fn']('IF',db[_0x3cc7('0x1b')]['literal'](_0x3cc7('0x3d')))),_0x3cc7('0x3e')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')](_0x3cc7('0x3f')))),_0x3cc7('0x40')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db['sequelize']['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x41')))),'outboundRejectCallsDay'],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')]['literal'](_0x3cc7('0x42')))),_0x3cc7('0x43')]],'group':[_0x3cc7('0x29')]})[_0x3cc7('0x27')](function(_0x326f92){logger[_0x3cc7('0x9')](_0x3cc7('0x28'),_0x17576b);logger[_0x3cc7('0xc')]('GetVoiceQueueHopperHistory',_0x17576b,JSON['stringify'](_0x326f92));_0x1638c7(_0x326f92);})['catch'](function(_0x15033f){logger['error'](_0x3cc7('0x28'),_0x15033f[_0x3cc7('0xf')],_0x17576b);_0x5771c2(_0x428ad2[_0x3cc7('0xe')](0x1f4,_0x15033f[_0x3cc7('0xf')]));});});};exports[_0x3cc7('0x44')]=function(_0x245ca0){var _0x21a7d0=this;return new Promise(function(_0x49bfa8,_0x1c7348){return db['CmHopperHistory']['findAll']({'raw':_0x245ca0[_0x3cc7('0x1a')]?_0x245ca0[_0x3cc7('0x1a')][_0x3cc7('0x16')]===undefined?!![]:![]:!![],'where':_0x245ca0['options']?_0x245ca0[_0x3cc7('0x1a')]['where']||null:null,'attributes':[['campaign',_0x3cc7('0x2a')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['col']('id')),_0x3cc7('0x45')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')](_0x3cc7('0x1e')))),_0x3cc7('0x46')]],'group':[_0x3cc7('0x29')]})[_0x3cc7('0x27')](function(_0x2570ae){logger['info']('GetCampaignHopperHistory',_0x245ca0);logger[_0x3cc7('0xc')]('GetCampaignHopperHistory',_0x245ca0,JSON['stringify'](_0x2570ae));_0x49bfa8(_0x2570ae);})[_0x3cc7('0x11')](function(_0x30c69f){logger[_0x3cc7('0xe')](_0x3cc7('0x44'),_0x30c69f[_0x3cc7('0xf')],_0x245ca0);_0x1c7348(_0x21a7d0[_0x3cc7('0xe')](0x1f4,_0x30c69f[_0x3cc7('0xf')]));});});}; \ No newline at end of file +var _0xd820=['../../config/logger','rpc','client','http','info','CmHopperHistory,\x20%s,\x20%s','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','debug','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundRejectCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','../../config/utils'];(function(_0x29666b,_0x41f069){var _0x15db72=function(_0x3c26cb){while(--_0x3c26cb){_0x29666b['push'](_0x29666b['shift']());}};_0x15db72(++_0x41f069);}(_0xd820,0x16f));var _0x0d82=function(_0x3017e5,_0x508dc8){_0x3017e5=_0x3017e5-0x0;var _0x11ad03=_0xd820[_0x3017e5];return _0x11ad03;};'use strict';var _=require(_0x0d82('0x0'));var util=require(_0x0d82('0x1'));var moment=require('moment');var BPromise=require(_0x0d82('0x2'));var rs=require(_0x0d82('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0d82('0x4'));var logger=require(_0x0d82('0x5'))(_0x0d82('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d82('0x7')][_0x0d82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b143e,_0x21c7a6,_0x498585){return new BPromise(function(_0x36e7b4,_0x7a3b8f){return client['request'](_0x2b143e,_0x498585)['then'](function(_0x3e8102){logger[_0x0d82('0x9')](_0x0d82('0xa'),_0x21c7a6,'request\x20sent');logger['debug'](_0x0d82('0xb'),_0x21c7a6,_0x0d82('0xc'),JSON[_0x0d82('0xd')](_0x3e8102));if(_0x3e8102[_0x0d82('0xe')]){if(_0x3e8102[_0x0d82('0xe')]['code']===0x1f4){logger['error'](_0x0d82('0xa'),_0x21c7a6,_0x3e8102[_0x0d82('0xe')][_0x0d82('0xf')]);return _0x7a3b8f(_0x3e8102['error'][_0x0d82('0xf')]);}logger[_0x0d82('0xe')](_0x0d82('0xa'),_0x21c7a6,_0x3e8102[_0x0d82('0xe')][_0x0d82('0xf')]);return _0x36e7b4(_0x3e8102[_0x0d82('0xe')][_0x0d82('0xf')]);}else{logger[_0x0d82('0x9')](_0x0d82('0xa'),_0x21c7a6,'request\x20sent');_0x36e7b4(_0x3e8102[_0x0d82('0x10')]['message']);}})[_0x0d82('0x11')](function(_0x5c4e2c){logger[_0x0d82('0xe')](_0x0d82('0xa'),_0x21c7a6,_0x5c4e2c);_0x7a3b8f(_0x5c4e2c);});});}exports[_0x0d82('0x12')]=function(_0x3383d8){var _0x2bb0da=this;return new Promise(function(_0x16f941,_0x24c091){return db[_0x0d82('0x13')][_0x0d82('0x14')](_0x3383d8[_0x0d82('0x15')],{'raw':_0x3383d8[_0x0d82('0x16')]?_0x3383d8[_0x0d82('0x16')][_0x0d82('0x17')]===undefined?!![]:![]:!![]})[_0x0d82('0x18')](function(_0x5a0e1c){logger['info'](_0x0d82('0x12'),_0x3383d8);logger[_0x0d82('0x19')](_0x0d82('0x12'),_0x3383d8,JSON['stringify'](_0x5a0e1c));_0x16f941(_0x5a0e1c);})['catch'](function(_0x2e332d){logger[_0x0d82('0xe')](_0x0d82('0x12'),_0x2e332d[_0x0d82('0xf')],_0x3383d8);_0x24c091(_0x2bb0da[_0x0d82('0xe')](0x1f4,_0x2e332d[_0x0d82('0xf')]));});});};exports['AvgHandleTime']=function(_0xb04794){var _0x22a85a=this;return new Promise(function(_0x361e9a,_0x5beeec){return db[_0x0d82('0x13')][_0x0d82('0x1a')]({'raw':_0xb04794[_0x0d82('0x16')]?_0xb04794['options'][_0x0d82('0x17')]===undefined?!![]:![]:!![],'where':_0xb04794[_0x0d82('0x16')]?_0xb04794[_0x0d82('0x16')]['where']||null:null,'attributes':[[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')][_0x0d82('0x1d')]('id')),_0x0d82('0x1e')],[db[_0x0d82('0x1b')]['fn']('COUNT',db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x20')))),'predictiveIntervalAnsweredCalls'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x21')))),_0x0d82('0x22')],[db['sequelize']['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db['sequelize'][_0x0d82('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0x0d82('0x23')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x24'),db['sequelize']['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x25')))),'predictiveIntervalAvgHoldtime'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x24'),db[_0x0d82('0x1b')]['fn']('IF',db['sequelize'][_0x0d82('0x1f')](_0x0d82('0x26')))),'predictiveIntervalAvgTalktime']]})[_0x0d82('0x18')](function(_0x5c0391){logger[_0x0d82('0x9')](_0x0d82('0x27'),_0xb04794);logger[_0x0d82('0x19')](_0x0d82('0x27'),_0xb04794,JSON[_0x0d82('0xd')](_0x5c0391));_0x361e9a(_0x5c0391);})[_0x0d82('0x11')](function(_0xf3b434){logger[_0x0d82('0xe')](_0x0d82('0x27'),_0xf3b434[_0x0d82('0xf')],_0xb04794);_0x5beeec(_0x22a85a[_0x0d82('0xe')](0x1f4,_0xf3b434[_0x0d82('0xf')]));});});};exports[_0x0d82('0x28')]=function(_0x11d0b7){var _0x6a6c85=this;return new Promise(function(_0x4612ef,_0x18d491){return db[_0x0d82('0x13')][_0x0d82('0x1a')]({'raw':_0x11d0b7[_0x0d82('0x16')]?_0x11d0b7[_0x0d82('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x11d0b7[_0x0d82('0x16')]?_0x11d0b7['options'][_0x0d82('0x29')]||null:null,'attributes':[[_0x0d82('0x2a'),_0x0d82('0x2b')],[db['sequelize']['fn']('COUNT',db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x2c')))),'outboundNoSuchCallsDay'],[db[_0x0d82('0x1b')]['fn']('COUNT',db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')]('`state`\x20=\x203,\x201,\x20null'))),_0x0d82('0x2d')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')]['literal'](_0x0d82('0x20')))),_0x0d82('0x2e')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0d82('0x1f')](_0x0d82('0x2f')))),'outboundBusyCallsDay'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db['sequelize']['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')]('`state`\x20=\x208,\x201,\x20null'))),_0x0d82('0x30')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0d82('0x31')],[db[_0x0d82('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0d82('0x1b')]['literal'](_0x0d82('0x32')))),'outboundDropCallsDayCallersExit'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db['sequelize'][_0x0d82('0x1f')](_0x0d82('0x33')))),_0x0d82('0x34')],[db[_0x0d82('0x1b')]['fn']('COUNT',db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x35')))),_0x0d82('0x36')],[db['sequelize']['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')]['literal'](_0x0d82('0x37')))),_0x0d82('0x38')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db['sequelize']['fn']('IF',db[_0x0d82('0x1b')]['literal'](_0x0d82('0x39')))),'outboundRejectCallsDay'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x0d82('0x3a')))),'outboundAnswerAgiCallsDay'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db['sequelize'][_0x0d82('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0x0d82('0x3b')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':['campaign']})[_0x0d82('0x18')](function(_0x2e32d0){logger[_0x0d82('0x9')](_0x0d82('0x28'),_0x11d0b7);logger[_0x0d82('0x19')](_0x0d82('0x28'),_0x11d0b7,JSON[_0x0d82('0xd')](_0x2e32d0));_0x4612ef(_0x2e32d0);})[_0x0d82('0x11')](function(_0x2020f6){logger[_0x0d82('0xe')](_0x0d82('0x28'),_0x2020f6[_0x0d82('0xf')],_0x11d0b7);_0x18d491(_0x6a6c85[_0x0d82('0xe')](0x1f4,_0x2020f6[_0x0d82('0xf')]));});});};exports[_0x0d82('0x3c')]=function(_0x302fc4){var _0x5de456=this;return new Promise(function(_0x3dfcfc,_0x1e2e26){return db[_0x0d82('0x13')][_0x0d82('0x1a')]({'raw':_0x302fc4[_0x0d82('0x16')]?_0x302fc4[_0x0d82('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x302fc4[_0x0d82('0x16')]?_0x302fc4[_0x0d82('0x16')][_0x0d82('0x29')]||null:null,'attributes':[[_0x0d82('0x2a'),_0x0d82('0x2b')],[db['sequelize']['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['col']('id')),'ivrTotalCallsDays'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x20')))),_0x0d82('0x3d')]],'group':[_0x0d82('0x2a')]})['then'](function(_0x204885){logger['info'](_0x0d82('0x3c'),_0x302fc4);logger[_0x0d82('0x19')](_0x0d82('0x3c'),_0x302fc4,JSON[_0x0d82('0xd')](_0x204885));_0x3dfcfc(_0x204885);})[_0x0d82('0x11')](function(_0x4fa44d){logger[_0x0d82('0xe')]('GetCampaignHopperHistory',_0x4fa44d[_0x0d82('0xf')],_0x302fc4);_0x1e2e26(_0x5de456[_0x0d82('0xe')](0x1f4,_0x4fa44d[_0x0d82('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 34ea395..806fbd6 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 _0x7aea=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5a3c30,_0x48f0db){var _0x93318e=function(_0xf4bd1a){while(--_0xf4bd1a){_0x5a3c30['push'](_0x5a3c30['shift']());}};_0x93318e(++_0x48f0db);}(_0x7aea,0x1f2));var _0xa7ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7aea[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa7ae('0x0'));var util=require(_0xa7ae('0x1'));var path=require(_0xa7ae('0x2'));var timeout=require(_0xa7ae('0x3'));var express=require(_0xa7ae('0x4'));var router=express[_0xa7ae('0x5')]();var fs_extra=require(_0xa7ae('0x6'));var auth=require(_0xa7ae('0x7'));var interaction=require(_0xa7ae('0x8'));var config=require(_0xa7ae('0x9'));var controller=require(_0xa7ae('0xa'));router[_0xa7ae('0xb')]('/',auth['isAuthenticated'](),controller[_0xa7ae('0xc')]);router[_0xa7ae('0xb')](_0xa7ae('0xd'),auth[_0xa7ae('0xe')](),controller[_0xa7ae('0xf')]);router['get'](_0xa7ae('0x10'),auth[_0xa7ae('0xe')](),controller[_0xa7ae('0x11')]);router[_0xa7ae('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa7ae('0x13')](_0xa7ae('0x10'),auth[_0xa7ae('0xe')](),controller['update']);module[_0xa7ae('0x14')]=router; \ No newline at end of file +var _0x749b=['put','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','post','create'];(function(_0x31acc7,_0x168431){var _0x10d549=function(_0x4b5412){while(--_0x4b5412){_0x31acc7['push'](_0x31acc7['shift']());}};_0x10d549(++_0x168431);}(_0x749b,0x1b2));var _0xb749=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x749b[_0xee3051];return _0x139e81;};'use strict';var multer=require(_0xb749('0x0'));var util=require(_0xb749('0x1'));var path=require(_0xb749('0x2'));var timeout=require(_0xb749('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb749('0x4'));var config=require(_0xb749('0x5'));var controller=require(_0xb749('0x6'));router[_0xb749('0x7')]('/',auth[_0xb749('0x8')](),controller[_0xb749('0x9')]);router[_0xb749('0x7')](_0xb749('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xb749('0x7')](_0xb749('0xb'),auth[_0xb749('0x8')](),controller['show']);router[_0xb749('0xc')]('/',auth[_0xb749('0x8')](),controller[_0xb749('0xd')]);router[_0xb749('0xe')]('/:id',auth[_0xb749('0x8')](),controller['update']);module[_0xb749('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 448b827..41f6f12 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 _0x6f72=['exports','STRING','name'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6f72,0xae));var _0x26f7=function(_0x2e87aa,_0x553dcb){_0x2e87aa=_0x2e87aa-0x0;var _0x4b25=_0x6f72[_0x2e87aa];return _0x4b25;};'use strict';var Sequelize=require('sequelize');module[_0x26f7('0x0')]={'name':{'type':Sequelize[_0x26f7('0x1')],'unique':_0x26f7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x26f7('0x1')]}}; \ No newline at end of file +var _0xc92f=['exports','name','STRING','sequelize'];(function(_0x31876a,_0x4e0009){var _0x382a50=function(_0x5c6744){while(--_0x5c6744){_0x31876a['push'](_0x31876a['shift']());}};_0x382a50(++_0x4e0009);}(_0xc92f,0xf3));var _0xfc92=function(_0x1f5ce2,_0x47c09a){_0x1f5ce2=_0x1f5ce2-0x0;var _0x5aaa03=_0xc92f[_0x1f5ce2];return _0x5aaa03;};'use strict';var Sequelize=require(_0xfc92('0x0'));module[_0xfc92('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfc92('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfc92('0x3')]},'dialPrefix':{'type':Sequelize[_0xfc92('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index fda4702..52c142b 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 _0x8a85=['Content-disposition','attachment;\x20filename=','format','list_%d_%s.csv','Content-type','download','/tmp/list_%d_%s.csv','sequelize','addCustomFields','TEXT','type','text','Sequelize','INTEGER','switch','BOOLEAN','queryInterface','addColumn','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','message','rimraf','fast-json-patch','moment','mustache','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','CmList','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','omit','success','push','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','each','isEmpty','now','setHeader'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8a85,0xc0));var _0x58a8=function(_0x287fae,_0x4b2676){_0x287fae=_0x287fae-0x0;var _0x469da0=_0x8a85[_0x287fae];return _0x469da0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58a8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58a8('0x1'));var rp=require('request-promise');var moment=require(_0x58a8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x58a8('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x58a8('0x4'));var ejs=require(_0x58a8('0x5'));var fs=require('fs');var fs_extra=require(_0x58a8('0x6'));var _=require('lodash');var squel=require(_0x58a8('0x7'));var crypto=require('crypto');var jsforce=require(_0x58a8('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x58a8('0x4'));var querystring=require(_0x58a8('0x9'));var Papa=require(_0x58a8('0xa'));var Redis=require(_0x58a8('0xb'));var authService=require(_0x58a8('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58a8('0xd'));var logger=require('../../config/logger')(_0x58a8('0xe'));var utils=require(_0x58a8('0xf'));var config=require(_0x58a8('0x10'));var licenseUtil=require(_0x58a8('0x11'));var db=require(_0x58a8('0x12'))['db'];var csv_results;config[_0x58a8('0x13')]=_[_0x58a8('0x14')](config[_0x58a8('0x13')],{'host':_0x58a8('0x15'),'port':0x18eb});var socket=require(_0x58a8('0x16'))(new Redis(config[_0x58a8('0x13')]));require(_0x58a8('0x17'))[_0x58a8('0x18')](socket);function respondWithStatusCode(_0x25d176,_0x4d48dc){_0x4d48dc=_0x4d48dc||0xcc;return function(_0x548d7e){if(_0x548d7e){return _0x25d176[_0x58a8('0x19')](_0x4d48dc);}return _0x25d176[_0x58a8('0x1a')](_0x4d48dc)[_0x58a8('0x1b')]();};}function respondWithResult(_0x136bc2,_0x1a796c){_0x1a796c=_0x1a796c||0xc8;return function(_0x22b786){if(_0x22b786){return _0x136bc2[_0x58a8('0x1a')](_0x1a796c)[_0x58a8('0x1c')](_0x22b786);}};}function respondWithFilteredResult(_0x25160e,_0x336397){return function(_0x29d9e5){if(_0x29d9e5){var _0x38b41d=typeof _0x336397[_0x58a8('0x1d')]===_0x58a8('0x1e')&&typeof _0x336397['limit']===_0x58a8('0x1e');var _0xc53867=_0x29d9e5[_0x58a8('0x1f')];var _0x1804b4=_0x38b41d?0x0:_0x336397['offset'];var _0x384e38=_0x38b41d?_0x29d9e5['count']:_0x336397[_0x58a8('0x1d')]+_0x336397[_0x58a8('0x20')];var _0x32dde6;if(_0x384e38>=_0xc53867){_0x384e38=_0xc53867;_0x32dde6=0xc8;}else{_0x32dde6=0xce;}_0x25160e[_0x58a8('0x1a')](_0x32dde6);return _0x25160e[_0x58a8('0x21')](_0x58a8('0x22'),_0x1804b4+'-'+_0x384e38+'/'+_0xc53867)['json'](_0x29d9e5);}return null;};}function patchUpdates(_0x25d596){return function(_0x245398){try{jsonpatch[_0x58a8('0x23')](_0x245398,_0x25d596,!![]);}catch(_0x357c18){return BPromise[_0x58a8('0x24')](_0x357c18);}return _0x245398['save']();};}function saveUpdates(_0x418fa5,_0x3cab49){return function(_0x439d8a){if(_0x439d8a){return _0x439d8a[_0x58a8('0x25')](_0x418fa5)[_0x58a8('0x26')](function(_0x3b3431){return _0x3b3431;});}return null;};}function removeEntity(_0x265e0d,_0x27b0ea){return function(_0x5302cd){if(_0x5302cd){return _0x5302cd[_0x58a8('0x27')]()[_0x58a8('0x26')](function(){var _0x5a962b=_0x5302cd[_0x58a8('0x28')]({'plain':!![]});var _0x546c87=_0x58a8('0x29');return db[_0x58a8('0x2a')][_0x58a8('0x27')]({'where':{'type':_0x546c87,'resourceId':_0x5a962b['id']}})[_0x58a8('0x26')](function(){return _0x5302cd;});})[_0x58a8('0x26')](function(){_0x265e0d['status'](0xcc)[_0x58a8('0x1b')]();});}};}function handleEntityNotFound(_0x45051e,_0x568fa2){return function(_0x2d202b){if(!_0x2d202b){_0x45051e[_0x58a8('0x19')](0x194);}return _0x2d202b;};}function handleError(_0x29ce75,_0x82a458){_0x82a458=_0x82a458||0x1f4;return function(_0x3d72bd){logger[_0x58a8('0x2b')](_0x3d72bd[_0x58a8('0x2c')]);if(_0x3d72bd['name']){delete _0x3d72bd[_0x58a8('0x2d')];}_0x29ce75['status'](_0x82a458)[_0x58a8('0x2e')](_0x3d72bd);};}exports[_0x58a8('0x2f')]=function(_0x5a06e6,_0x149361){var _0x2b40eb={},_0x848e71={},_0x33ad5a={'count':0x0,'rows':[]};var _0x379423=_['map'](db[_0x58a8('0x30')][_0x58a8('0x31')],function(_0x4f3f2e){return{'name':_0x4f3f2e[_0x58a8('0x32')],'type':_0x4f3f2e['type']['key']};});_0x848e71[_0x58a8('0x33')]=_[_0x58a8('0x34')](_0x379423,_0x58a8('0x2d'));_0x848e71['query']=_['keys'](_0x5a06e6[_0x58a8('0x35')]);_0x848e71[_0x58a8('0x36')]=_['intersection'](_0x848e71[_0x58a8('0x33')],_0x848e71[_0x58a8('0x35')]);_0x2b40eb['attributes']=_[_0x58a8('0x37')](_0x848e71[_0x58a8('0x33')],qs[_0x58a8('0x38')](_0x5a06e6[_0x58a8('0x35')][_0x58a8('0x38')]));_0x2b40eb[_0x58a8('0x39')]=_0x2b40eb['attributes'][_0x58a8('0x3a')]?_0x2b40eb['attributes']:_0x848e71[_0x58a8('0x33')];if(!_0x5a06e6['query'][_0x58a8('0x3b')](_0x58a8('0x3c'))){_0x2b40eb[_0x58a8('0x20')]=qs[_0x58a8('0x20')](_0x5a06e6[_0x58a8('0x35')][_0x58a8('0x20')]);_0x2b40eb[_0x58a8('0x1d')]=qs['offset'](_0x5a06e6[_0x58a8('0x35')]['offset']);}_0x2b40eb[_0x58a8('0x3d')]=qs[_0x58a8('0x3e')](_0x5a06e6[_0x58a8('0x35')][_0x58a8('0x3e')]);_0x2b40eb['where']=qs[_0x58a8('0x36')](_[_0x58a8('0x3f')](_0x5a06e6[_0x58a8('0x35')],_0x848e71[_0x58a8('0x36')]),_0x379423);if(_0x5a06e6[_0x58a8('0x35')][_0x58a8('0x40')]){_0x2b40eb[_0x58a8('0x41')]=_[_0x58a8('0x42')](_0x2b40eb[_0x58a8('0x41')],{'$or':_[_0x58a8('0x34')](_0x379423,function(_0xf60888){if(_0xf60888['type']!==_0x58a8('0x43')){var _0x4e26c2={};_0x4e26c2[_0xf60888[_0x58a8('0x2d')]]={'$like':'%'+_0x5a06e6[_0x58a8('0x35')]['filter']+'%'};return _0x4e26c2;}})});}_0x2b40eb=_[_0x58a8('0x42')]({},_0x2b40eb,_0x5a06e6['options']);var _0x634f98={'where':_0x2b40eb['where']};return db[_0x58a8('0x30')][_0x58a8('0x1f')](_0x634f98)[_0x58a8('0x26')](function(_0x12feac){_0x33ad5a[_0x58a8('0x1f')]=_0x12feac;if(_0x5a06e6[_0x58a8('0x35')][_0x58a8('0x44')]){_0x2b40eb[_0x58a8('0x45')]=[{'all':!![]}];}return db[_0x58a8('0x30')][_0x58a8('0x46')](_0x2b40eb);})[_0x58a8('0x26')](function(_0x5a54b4){_0x33ad5a[_0x58a8('0x47')]=_0x5a54b4;return _0x33ad5a;})['then'](respondWithFilteredResult(_0x149361,_0x2b40eb))[_0x58a8('0x48')](handleError(_0x149361,null));};exports[_0x58a8('0x49')]=function(_0x22ef34,_0x16b35c){var _0x5c1ec8={'raw':![],'where':{'id':_0x22ef34[_0x58a8('0x4a')]['id']}},_0x2dd926={};_0x2dd926[_0x58a8('0x33')]=_[_0x58a8('0x4b')](db[_0x58a8('0x30')][_0x58a8('0x31')]);_0x2dd926[_0x58a8('0x35')]=_[_0x58a8('0x4b')](_0x22ef34[_0x58a8('0x35')]);_0x2dd926[_0x58a8('0x36')]=_[_0x58a8('0x37')](_0x2dd926[_0x58a8('0x33')],_0x2dd926[_0x58a8('0x35')]);_0x5c1ec8[_0x58a8('0x39')]=_[_0x58a8('0x37')](_0x2dd926[_0x58a8('0x33')],qs[_0x58a8('0x38')](_0x22ef34[_0x58a8('0x35')][_0x58a8('0x38')]));_0x5c1ec8[_0x58a8('0x39')]=_0x5c1ec8[_0x58a8('0x39')][_0x58a8('0x3a')]?_0x5c1ec8[_0x58a8('0x39')]:_0x2dd926[_0x58a8('0x33')];if(_0x22ef34[_0x58a8('0x35')][_0x58a8('0x44')]){_0x5c1ec8[_0x58a8('0x45')]=[{'all':!![]}];}_0x5c1ec8=_[_0x58a8('0x42')]({},_0x5c1ec8,_0x22ef34[_0x58a8('0x4c')]);return db[_0x58a8('0x30')][_0x58a8('0x4d')](_0x5c1ec8)[_0x58a8('0x26')](handleEntityNotFound(_0x16b35c,null))[_0x58a8('0x26')](respondWithResult(_0x16b35c,null))[_0x58a8('0x48')](handleError(_0x16b35c,null));};exports[_0x58a8('0x4e')]=function(_0xb151c3,_0x31d843){return db['CmList']['create'](_0xb151c3['body'],{})[_0x58a8('0x26')](function(_0x5f4224){var _0x41662c=_0xb151c3[_0x58a8('0x4f')][_0x58a8('0x28')]({'plain':!![]});if(!_0x41662c)throw new Error(_0x58a8('0x50'));if(_0x41662c[_0x58a8('0x51')]===_0x58a8('0x4f')){var _0x265498=_0x5f4224[_0x58a8('0x28')]({'plain':!![]});var _0x541381=_0x58a8('0x29');return db['UserProfileSection'][_0x58a8('0x4d')]({'where':{'name':_0x541381,'userProfileId':_0x41662c[_0x58a8('0x52')]},'raw':!![]})[_0x58a8('0x26')](function(_0x46e9ee){if(_0x46e9ee&&_0x46e9ee[_0x58a8('0x53')]===0x0){return db[_0x58a8('0x2a')][_0x58a8('0x4e')]({'name':_0x265498['name'],'resourceId':_0x265498['id'],'type':_0x46e9ee[_0x58a8('0x2d')],'sectionId':_0x46e9ee['id']},{})['then'](function(){return _0x5f4224;});}else{return _0x5f4224;}})['catch'](function(_0x42705e){logger[_0x58a8('0x2b')](_0x58a8('0x54'),_0x42705e);throw _0x42705e;});}return _0x5f4224;})[_0x58a8('0x26')](respondWithResult(_0x31d843,0xc9))[_0x58a8('0x48')](handleError(_0x31d843,null));};exports[_0x58a8('0x25')]=function(_0x1eb978,_0x477dc9){if(_0x1eb978[_0x58a8('0x55')]['id']){delete _0x1eb978[_0x58a8('0x55')]['id'];}return db[_0x58a8('0x30')][_0x58a8('0x4d')]({'where':{'id':_0x1eb978[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x477dc9,null))['then'](saveUpdates(_0x1eb978['body'],null))['then'](respondWithResult(_0x477dc9,null))[_0x58a8('0x48')](handleError(_0x477dc9,null));};exports[_0x58a8('0x27')]=function(_0x528bb2,_0x17e78c){return db[_0x58a8('0x30')][_0x58a8('0x4d')]({'where':{'id':_0x528bb2[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x17e78c,null))['then'](removeEntity(_0x17e78c,null))['catch'](handleError(_0x17e78c,null));};exports[_0x58a8('0x56')]=function(_0x2c62fe,_0x1852f4){return db['CmList'][_0x58a8('0x56')]()[_0x58a8('0x26')](respondWithResult(_0x1852f4,null))[_0x58a8('0x48')](handleError(_0x1852f4,null));};exports[_0x58a8('0x57')]=function(_0x3e9961,_0xfc2f14,_0x27afd4){if(_0x3e9961[_0x58a8('0x55')]['id']){delete _0x3e9961[_0x58a8('0x55')]['id'];}return db[_0x58a8('0x30')][_0x58a8('0x4d')]({'where':{'id':_0x3e9961['params']['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0xfc2f14,null))[_0x58a8('0x26')](function(_0x11363e){if(_0x11363e){_0x3e9961[_0x58a8('0x55')]['ListId']=_0x11363e['id'];return db[_0x58a8('0x58')][_0x58a8('0x4e')](_0x3e9961[_0x58a8('0x55')]);}})['then'](respondWithResult(_0xfc2f14,null))['catch'](handleError(_0xfc2f14,null));};exports[_0x58a8('0x59')]=function(_0x3d7cde,_0x3fb2a6,_0x2b96eb){var _0x179a74={'raw':![],'where':{}};var _0x508f9c={};var _0xa8a254={'count':0x0,'rows':[]};return db[_0x58a8('0x30')][_0x58a8('0x5a')]({'where':{'id':_0x3d7cde['params']['id']}})['then'](handleEntityNotFound(_0x3fb2a6,null))[_0x58a8('0x26')](function(_0x4bf2c2){if(_0x4bf2c2){_0x508f9c[_0x58a8('0x33')]=_['keys'](db[_0x58a8('0x58')][_0x58a8('0x31')]);_0x508f9c[_0x58a8('0x35')]=_[_0x58a8('0x4b')](_0x3d7cde['query']);_0x508f9c[_0x58a8('0x36')]=_[_0x58a8('0x37')](_0x508f9c[_0x58a8('0x33')],_0x508f9c[_0x58a8('0x35')]);_0x179a74[_0x58a8('0x39')]=_[_0x58a8('0x37')](_0x508f9c[_0x58a8('0x33')],qs['fields'](_0x3d7cde[_0x58a8('0x35')]['fields']));_0x179a74[_0x58a8('0x39')]=_0x179a74[_0x58a8('0x39')]['length']?_0x179a74[_0x58a8('0x39')]:_0x508f9c[_0x58a8('0x33')];if(!_0x3d7cde[_0x58a8('0x35')][_0x58a8('0x3b')](_0x58a8('0x3c'))){_0x179a74[_0x58a8('0x20')]=qs[_0x58a8('0x20')](_0x3d7cde[_0x58a8('0x35')]['limit']);_0x179a74['offset']=qs['offset'](_0x3d7cde[_0x58a8('0x35')][_0x58a8('0x1d')]);}_0x179a74[_0x58a8('0x3d')]=qs[_0x58a8('0x3e')](_0x3d7cde[_0x58a8('0x35')][_0x58a8('0x3e')]);_0x179a74[_0x58a8('0x41')]=qs[_0x58a8('0x36')](_['pick'](_0x3d7cde[_0x58a8('0x35')],_0x508f9c['filters']));_0x179a74[_0x58a8('0x41')][_0x58a8('0x5b')]=_0x4bf2c2['id'];if(_0x3d7cde[_0x58a8('0x35')][_0x58a8('0x40')]){_0x179a74[_0x58a8('0x41')]=_[_0x58a8('0x42')](_0x179a74[_0x58a8('0x41')],{'$or':_[_0x58a8('0x34')](_0x179a74[_0x58a8('0x39')],function(_0x30b53f){var _0x3d7a59={};_0x3d7a59[_0x30b53f]={'$like':'%'+_0x3d7cde[_0x58a8('0x35')]['filter']+'%'};return _0x3d7a59;})});}_0x179a74=_['merge']({},_0x179a74,_0x3d7cde[_0x58a8('0x4c')]);return db[_0x58a8('0x58')][_0x58a8('0x1f')]({'where':_0x179a74[_0x58a8('0x41')]})[_0x58a8('0x26')](function(_0x29e527){_0xa8a254[_0x58a8('0x1f')]=_0x29e527;if(_0x3d7cde[_0x58a8('0x35')][_0x58a8('0x44')]){_0x179a74[_0x58a8('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x58a8('0x46')](_0x179a74);})[_0x58a8('0x26')](function(_0x544bfe){_0xa8a254[_0x58a8('0x47')]=_0x544bfe;return _0xa8a254;});}})[_0x58a8('0x26')](respondWithFilteredResult(_0x3fb2a6,_0x179a74))[_0x58a8('0x48')](handleError(_0x3fb2a6,null));};exports['removeDispositions']=function(_0xd6aa78,_0x11e10f,_0x5e9e76){return db['CmList'][_0x58a8('0x4d')]({'where':{'id':_0xd6aa78['params']['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x11e10f,null))[_0x58a8('0x26')](function(_0x51b80f){if(_0x51b80f){return _0x51b80f[_0x58a8('0x5c')](_0xd6aa78[_0x58a8('0x35')][_0x58a8('0x5d')]);}})[_0x58a8('0x26')](respondWithStatusCode(_0x11e10f,null))[_0x58a8('0x48')](handleError(_0x11e10f,null));};exports[_0x58a8('0x5e')]=function(_0x74d794,_0x39467e,_0xb1b536){return db['CmList'][_0x58a8('0x4d')]({'where':{'id':_0x74d794[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x39467e,null))[_0x58a8('0x26')](function(_0x475fce){if(_0x475fce){var _0x5979b0=[];var _0x4a5664={'success':[],'errors':[]};return db[_0x58a8('0x5f')][_0x58a8('0x56')]()['then'](function(_0x3b10a0){if(_0x74d794[_0x58a8('0x55')][_0x58a8('0x60')]&&_[_0x58a8('0x61')](_0x74d794[_0x58a8('0x55')][_0x58a8('0x60')])){if(_0x74d794[_0x58a8('0x55')][_0x58a8('0x60')][_0x58a8('0x3a')]){_0x74d794[_0x58a8('0x55')]['tags']=_0x74d794['body'][_0x58a8('0x60')][_0x58a8('0x62')](';')+';';}else{_0x74d794[_0x58a8('0x55')]['tags']=null;}}else{_0x74d794['body'][_0x58a8('0x60')]=null;}if(_0x74d794[_0x58a8('0x55')]&&_[_0x58a8('0x61')](_0x74d794[_0x58a8('0x55')])){for(var _0x3982a7=0x0;_0x3982a7<_0x74d794['body']['length'];_0x3982a7+=0x1){_0x74d794[_0x58a8('0x55')][_0x3982a7][_0x58a8('0x5b')]=_0x74d794[_0x58a8('0x4a')]['id'];_0x5979b0['push'](_0x74d794['body'][_0x3982a7]);}return BPromise['each'](_0x5979b0,function(_0x5c78f3){return db[_0x58a8('0x5f')][_0x58a8('0x4e')](_[_0x58a8('0x63')](_0x5c78f3,[_0x58a8('0x5d'),'id'])||{},{'fields':_[_0x58a8('0x4b')](_0x3b10a0),'raw':!![]})[_0x58a8('0x26')](function(_0x257843){_0x4a5664[_0x58a8('0x64')][_0x58a8('0x65')](_0x257843['dataValues']);})[_0x58a8('0x48')](function(_0x5e9fbb){_0x4a5664[_0x58a8('0x66')][_0x58a8('0x65')]({'data':_0x5c78f3,'error':_0x5e9fbb['message']});});})[_0x58a8('0x26')](function(_0x210af5){return _0x4a5664;})[_0x58a8('0x48')](function(_0x54c8e0){return _0x54c8e0;});}else{_0x39467e[_0x58a8('0x1a')](0x190)[_0x58a8('0x1c')]({'message':_0x58a8('0x67')});}});}})['then'](respondWithResult(_0x39467e,null))[_0x58a8('0x48')](handleError(_0x39467e,null));};exports[_0x58a8('0x68')]=function(_0x3fe5be,_0x1e6a87,_0x9423f6){var _0x4f6bce;return db[_0x58a8('0x30')][_0x58a8('0x4d')]({'where':{'id':_0x3fe5be[_0x58a8('0x4a')]['id']},'include':[{'model':db[_0x58a8('0x69')],'as':_0x58a8('0x6a')}]})['then'](handleEntityNotFound(_0x1e6a87,null))[_0x58a8('0x26')](function(_0x463e67){if(_0x463e67){_0x4f6bce=_0x463e67;return db[_0x58a8('0x5f')][_0x58a8('0x31')];}})[_0x58a8('0x26')](function(_0x58aac7){if(_0x58aac7){var _0x1be6e0={};var _0x2888bd={};_0x2888bd[_0x58a8('0x33')]=_[_0x58a8('0x6b')](_['keys'](_0x58aac7),_[_0x58a8('0x34')](_0x4f6bce[_0x58a8('0x6a')],function(_0x3d18ec){return util['format'](_0x58a8('0x6c'),_0x3d18ec['id']);}));_0x2888bd[_0x58a8('0x35')]=_[_0x58a8('0x4b')](_0x3fe5be['query']);_0x2888bd['filters']=_[_0x58a8('0x37')](_0x2888bd['model'],_0x2888bd[_0x58a8('0x35')]);_0x1be6e0[_0x58a8('0x39')]=_[_0x58a8('0x37')](_0x2888bd['model'],qs[_0x58a8('0x38')](_0x3fe5be[_0x58a8('0x35')]['fields']));_0x1be6e0[_0x58a8('0x39')]=_0x1be6e0[_0x58a8('0x39')][_0x58a8('0x3a')]?_0x1be6e0[_0x58a8('0x39')]:_0x2888bd[_0x58a8('0x33')];if(!_0x3fe5be['query'][_0x58a8('0x3b')](_0x58a8('0x3c'))){_0x1be6e0[_0x58a8('0x20')]=qs[_0x58a8('0x20')](_0x3fe5be[_0x58a8('0x35')][_0x58a8('0x20')]);_0x1be6e0[_0x58a8('0x1d')]=qs[_0x58a8('0x1d')](_0x3fe5be['query'][_0x58a8('0x1d')]);}_0x1be6e0['order']=qs[_0x58a8('0x3e')](_0x3fe5be[_0x58a8('0x35')][_0x58a8('0x3e')]);_0x1be6e0[_0x58a8('0x41')]=qs[_0x58a8('0x36')](_[_0x58a8('0x3f')](_0x3fe5be[_0x58a8('0x35')],_0x2888bd['filters']));_0x1be6e0[_0x58a8('0x6d')]=!![];if(_0x3fe5be[_0x58a8('0x35')][_0x58a8('0x40')]){_0x1be6e0['where']=_[_0x58a8('0x42')](_0x1be6e0['where'],{'$or':_[_0x58a8('0x34')](_0x1be6e0[_0x58a8('0x39')],function(_0x2dd6ea){var _0x196375={};_0x196375[_0x2dd6ea]={'$like':'%'+_0x3fe5be[_0x58a8('0x35')][_0x58a8('0x40')]+'%'};return _0x196375;})});}_0x1be6e0=_[_0x58a8('0x42')]({},_0x1be6e0,_0x3fe5be[_0x58a8('0x4c')]);return _0x4f6bce['getContacts'](_0x1be6e0);}})[_0x58a8('0x26')](respondWithResult(_0x1e6a87,null))[_0x58a8('0x48')](handleError(_0x1e6a87,null));};exports[_0x58a8('0x6e')]=function(_0x10a6d9,_0x1d7c32,_0x1637b0){var _0x5609f9;var _0x2b9817;var _0x4aaca3;var _0x7df0=_0x10a6d9[_0x58a8('0x4a')]['id'];csv_results=[];return db['ContactItemType'][_0x58a8('0x46')]({'attributes':['id',_0x58a8('0x2d')],'raw':!![],'order':[_0x58a8('0x6f')]})[_0x58a8('0x26')](function(_0xd90520){_0x5609f9=_0xd90520;var _0x587e2=_[_0x58a8('0x4b')](db['CmContact'][_0x58a8('0x31')]);return db[_0x58a8('0x69')][_0x58a8('0x46')]({'raw':!![],'attributes':['id',_0x58a8('0x70')]})[_0x58a8('0x26')](function(_0x4dc88f){_0x2b9817=_0x4dc88f;var _0x41a5bc=squel[_0x58a8('0x71')]()[_0x58a8('0x38')](_0x587e2)[_0x58a8('0x72')](_0x58a8('0x73'),'c')[_0x58a8('0x41')](_0x58a8('0x74'),_0x7df0)['where'](_0x58a8('0x75'))[_0x58a8('0x76')]();for(var _0x479089=0x0;_0x479089<_0x2b9817[_0x58a8('0x3a')];_0x479089++){_0x41a5bc[_0x58a8('0x77')](_0x58a8('0x78')+_0x2b9817[_0x479089]['id'],_0x58a8('0x79')+_0x2b9817[_0x479089][_0x58a8('0x70')]);}for(var _0x479089=0x0;_0x479089<_0x5609f9[_0x58a8('0x3a')];_0x479089++){_0x41a5bc['field'](squel['select']()[_0x58a8('0x77')]('item')[_0x58a8('0x72')]('cm_contact_has_items')[_0x58a8('0x41')](_0x58a8('0x7a'),_0x5609f9[_0x479089]['id'])['where'](_0x58a8('0x7b')),_0x58a8('0x7c')+_0x5609f9[_0x479089][_0x58a8('0x2d')]);_0x41a5bc[_0x58a8('0x77')](squel[_0x58a8('0x71')]()[_0x58a8('0x77')](_0x58a8('0x7d'))['from']('cm_contact_has_items')['where']('ItemTypeId\x20=\x20?',_0x5609f9[_0x479089]['id'])[_0x58a8('0x41')]('CmContactId\x20=\x20c.id'),_0x58a8('0x7e')+_0x5609f9[_0x479089][_0x58a8('0x2d')]);}var _0x23cd6d=[];_0x23cd6d[_0x58a8('0x65')](_0x41a5bc[_0x58a8('0x7f')]());BPromise[_0x58a8('0x80')](_0x23cd6d,handleQuery)[_0x58a8('0x26')](function(_0x3d6e1f){handleQuery(_0x41a5bc['toString']());var _0x2da963=csv_results[0x0];if(!_[_0x58a8('0x81')](_0x2da963)){var _0xe43d5=toCsv(_0x2da963);var _0x2b6885=Date[_0x58a8('0x82')]();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x7df0,_0x2b6885),_0xe43d5);_0x1d7c32[_0x58a8('0x83')](_0x58a8('0x84'),_0x58a8('0x85')+util[_0x58a8('0x86')](_0x58a8('0x87'),_0x7df0,_0x2b6885));_0x1d7c32[_0x58a8('0x83')](_0x58a8('0x88'),'text/csv');return _0x1d7c32[_0x58a8('0x89')](util[_0x58a8('0x86')](_0x58a8('0x8a'),_0x7df0,_0x2b6885));}else{return _0x1d7c32['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x310e8f,_0x1dd1c3,_0x459eae){var _0x4dce0f;delete _0x310e8f['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x310e8f[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x1dd1c3,null))[_0x58a8('0x26')](function(_0x3d9d66){if(_0x3d9d66){return db[_0x58a8('0x8b')]['transaction'](function(_0x35f523){return db[_0x58a8('0x69')][_0x58a8('0x4e')](_0x310e8f[_0x58a8('0x55')],{'transaction':_0x35f523})['then'](function(_0x2729f7){_0x4dce0f=_0x2729f7;return _0x3d9d66[_0x58a8('0x8c')](_0x2729f7,{'transaction':_0x35f523});})[_0x58a8('0x26')](function(){var _0x2137c8={'type':db['Sequelize'][_0x58a8('0x8d')],'transaction':_0x35f523};switch(_0x310e8f[_0x58a8('0x55')][_0x58a8('0x8e')]){case _0x58a8('0x8f'):_0x2137c8[_0x58a8('0x8e')]=db[_0x58a8('0x90')][_0x58a8('0x8d')];break;case'number':_0x2137c8[_0x58a8('0x8e')]=db['Sequelize'][_0x58a8('0x91')];break;case _0x58a8('0x92'):_0x2137c8[_0x58a8('0x8e')]=db[_0x58a8('0x90')][_0x58a8('0x93')];_0x2137c8['defaultValue']=![];break;default:}return db[_0x58a8('0x8b')][_0x58a8('0x94')][_0x58a8('0x95')]('cm_contacts',util[_0x58a8('0x86')]('cf_%s',_0x4dce0f['id']),_0x2137c8);})[_0x58a8('0x26')](function(){return _0x4dce0f;});});}})[_0x58a8('0x26')](respondWithResult(_0x1dd1c3,null))['catch'](handleError(_0x1dd1c3,null));};exports[_0x58a8('0x96')]=function(_0x2ae6e4,_0x176703,_0x18d3f8){var _0x320900={};var _0x3b9c50={};var _0x5890d8;var _0x5d8bcc;return db['CmList']['findOne']({'where':{'id':_0x2ae6e4[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x176703,null))[_0x58a8('0x26')](function(_0x74ef44){if(_0x74ef44){_0x5890d8=_0x74ef44;_0x3b9c50['model']=_['keys'](db['CmCustomField'][_0x58a8('0x31')]);_0x3b9c50[_0x58a8('0x35')]=_[_0x58a8('0x4b')](_0x2ae6e4['query']);_0x3b9c50[_0x58a8('0x36')]=_[_0x58a8('0x37')](_0x3b9c50['model'],_0x3b9c50[_0x58a8('0x35')]);_0x320900[_0x58a8('0x39')]=_[_0x58a8('0x37')](_0x3b9c50[_0x58a8('0x33')],qs['fields'](_0x2ae6e4[_0x58a8('0x35')][_0x58a8('0x38')]));_0x320900[_0x58a8('0x39')]=_0x320900[_0x58a8('0x39')]['length']?_0x320900[_0x58a8('0x39')]:_0x3b9c50[_0x58a8('0x33')];_0x320900[_0x58a8('0x3d')]=qs[_0x58a8('0x3e')](_0x2ae6e4['query'][_0x58a8('0x3e')]);_0x320900['where']=qs[_0x58a8('0x36')](_['pick'](_0x2ae6e4[_0x58a8('0x35')],_0x3b9c50[_0x58a8('0x36')]));_0x320900[_0x58a8('0x41')]=_[_0x58a8('0x42')](_0x320900['where'],{'$or':[{'ListId':_0x74ef44['id']},{'ListId':null}]});if(_0x2ae6e4[_0x58a8('0x35')][_0x58a8('0x40')]){_0x320900[_0x58a8('0x41')]=_[_0x58a8('0x42')](_0x320900[_0x58a8('0x41')],{'$or':_[_0x58a8('0x34')](_0x320900[_0x58a8('0x39')],function(_0x276539){var _0xc7eab4={};_0xc7eab4[_0x276539]={'$like':'%'+_0x2ae6e4[_0x58a8('0x35')][_0x58a8('0x40')]+'%'};return _0xc7eab4;})});}_0x320900=_[_0x58a8('0x42')]({},_0x320900,_0x2ae6e4[_0x58a8('0x4c')]);return db[_0x58a8('0x69')][_0x58a8('0x97')](_0x320900);}})[_0x58a8('0x26')](respondWithResult(_0x176703,null))[_0x58a8('0x48')](handleError(_0x176703,null));};exports['getGlobalCustomFields']=function(_0x281617,_0x40ef51){return db['CmCustomField'][_0x58a8('0x97')]({'where':{'ListId':null}})[_0x58a8('0x26')](handleEntityNotFound(_0x40ef51,null))['then'](function(_0xa248b6){return _0xa248b6;})[_0x58a8('0x26')](respondWithResult(_0x40ef51,null))[_0x58a8('0x48')](handleError(_0x40ef51,null));};exports[_0x58a8('0x98')]=function(_0x1ba579,_0x50fb2e,_0x28d1d3){return db[_0x58a8('0x30')][_0x58a8('0x4d')]({'where':{'id':_0x1ba579['params']['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x50fb2e,null))[_0x58a8('0x26')](function(_0x21b69b){if(_0x21b69b){return _0x21b69b['addAgents'](_0x1ba579[_0x58a8('0x55')][_0x58a8('0x5d')],_[_0x58a8('0x63')](_0x1ba579['body'],[_0x58a8('0x5d'),'id'])||{})[_0x58a8('0x99')](function(_0x540f27){for(var _0x4fe234=0x0;_0x4fe234<_0x1ba579[_0x58a8('0x55')][_0x58a8('0x5d')]['length'];_0x4fe234+=0x1){socket[_0x58a8('0x9a')](_0x58a8('0x9b'),{'UserId':Number(_0x1ba579[_0x58a8('0x55')]['ids'][_0x4fe234]),'CmListId':Number(_0x1ba579[_0x58a8('0x4a')]['id'])});}return _0x540f27;});}})['then'](respondWithResult(_0x50fb2e,null))[_0x58a8('0x48')](handleError(_0x50fb2e,null));};exports[_0x58a8('0x9c')]=function(_0x159229,_0x564c29,_0xa30ca4){return db['CmList'][_0x58a8('0x4d')]({'where':{'id':_0x159229['params']['id']}})['then'](handleEntityNotFound(_0x564c29,null))[_0x58a8('0x26')](function(_0x37a8d9){if(_0x37a8d9){return _0x37a8d9[_0x58a8('0x9c')](_0x159229[_0x58a8('0x35')][_0x58a8('0x5d')])[_0x58a8('0x26')](function(){if(_['isArray'](_0x159229[_0x58a8('0x35')][_0x58a8('0x5d')])){for(var _0x6d5dd9=0x0;_0x6d5dd9<_0x159229[_0x58a8('0x35')][_0x58a8('0x5d')][_0x58a8('0x3a')];_0x6d5dd9+=0x1){socket['emit'](_0x58a8('0x9d'),{'UserId':Number(_0x159229['query'][_0x58a8('0x5d')][_0x6d5dd9]),'CmListId':Number(_0x159229[_0x58a8('0x4a')]['id'])});}}else{socket[_0x58a8('0x9a')](_0x58a8('0x9d'),{'UserId':Number(_0x159229[_0x58a8('0x35')][_0x58a8('0x5d')]),'CmListId':Number(_0x159229[_0x58a8('0x4a')]['id'])});}});}})[_0x58a8('0x26')](respondWithStatusCode(_0x564c29,null))[_0x58a8('0x48')](handleError(_0x564c29,null));};exports[_0x58a8('0x9e')]=function(_0x16abf3,_0x25dd51,_0x4e04c6){var _0xec3bb2={};var _0x5a4233={};var _0xac0e19;var _0x39b9fe;return db['CmList'][_0x58a8('0x5a')]({'where':{'id':_0x16abf3[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x25dd51,null))[_0x58a8('0x26')](function(_0xde83c0){if(_0xde83c0){_0xac0e19=_0xde83c0;_0x5a4233[_0x58a8('0x33')]=_[_0x58a8('0x4b')](db[_0x58a8('0x9f')][_0x58a8('0x31')]);_0x5a4233[_0x58a8('0x35')]=_[_0x58a8('0x4b')](_0x16abf3['query']);_0x5a4233['filters']=_[_0x58a8('0x37')](_0x5a4233[_0x58a8('0x33')],_0x5a4233[_0x58a8('0x35')]);_0xec3bb2[_0x58a8('0x39')]=_[_0x58a8('0x37')](_0x5a4233[_0x58a8('0x33')],qs[_0x58a8('0x38')](_0x16abf3[_0x58a8('0x35')][_0x58a8('0x38')]));_0xec3bb2[_0x58a8('0x39')]=_0xec3bb2[_0x58a8('0x39')][_0x58a8('0x3a')]?_0xec3bb2[_0x58a8('0x39')]:_0x5a4233[_0x58a8('0x33')];_0xec3bb2['order']=qs[_0x58a8('0x3e')](_0x16abf3[_0x58a8('0x35')][_0x58a8('0x3e')]);_0xec3bb2[_0x58a8('0x41')]=qs['filters'](_[_0x58a8('0x3f')](_0x16abf3[_0x58a8('0x35')],_0x5a4233[_0x58a8('0x36')]));if(_0x16abf3[_0x58a8('0x35')][_0x58a8('0x40')]){_0xec3bb2[_0x58a8('0x41')]=_[_0x58a8('0x42')](_0xec3bb2[_0x58a8('0x41')],{'$or':_[_0x58a8('0x34')](_0xec3bb2[_0x58a8('0x39')],function(_0x18f2d0){var _0x1aec29={};_0x1aec29[_0x18f2d0]={'$like':'%'+_0x16abf3[_0x58a8('0x35')][_0x58a8('0x40')]+'%'};return _0x1aec29;})});}_0xec3bb2=_[_0x58a8('0x42')]({},_0xec3bb2,_0x16abf3[_0x58a8('0x4c')]);return _0xac0e19[_0x58a8('0x9e')](_0xec3bb2);}})[_0x58a8('0x26')](function(_0xb2520c){if(_0xb2520c){_0x39b9fe=_0xb2520c['length'];if(!_0x16abf3[_0x58a8('0x35')][_0x58a8('0x3b')]('nolimit')){_0xec3bb2[_0x58a8('0x20')]=qs[_0x58a8('0x20')](_0x16abf3[_0x58a8('0x35')]['limit']);_0xec3bb2[_0x58a8('0x1d')]=qs[_0x58a8('0x1d')](_0x16abf3['query'][_0x58a8('0x1d')]);}return _0xac0e19['getAgents'](_0xec3bb2);}})['then'](function(_0x3fc19d){if(_0x3fc19d){return _0x3fc19d?{'count':_0x39b9fe,'rows':_0x3fc19d}:null;}})['then'](respondWithResult(_0x25dd51,null))[_0x58a8('0x48')](handleError(_0x25dd51,null));};function handleQuery(_0x90db4b){logger[_0x58a8('0xa0')](_0x90db4b);return db[_0x58a8('0x8b')]['query'](_0x90db4b)['spread'](function(_0xbd55dd){csv_results[_0x58a8('0x65')](_0xbd55dd);})[_0x58a8('0x48')](function(_0x161781){logger[_0x58a8('0x2b')](_0x161781[_0x58a8('0xa1')]);});} \ No newline at end of file +var _0x0d08=['omit','success','dataValues','errors','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','isEmpty','now','writeFileSync','Content-disposition','setHeader','Content-type','text/csv','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','getAgents','User','info','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','limit','offset','count','set','Content-Range','save','update','destroy','get','Lists','UserProfileResource','then','error','stack','name','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','fields','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','nolimit','order','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x0d08,0x17e));var _0x80d0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0d08[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x80d0('0x0'));var rimraf=require(_0x80d0('0x1'));var zipdir=require(_0x80d0('0x2'));var jsonpatch=require(_0x80d0('0x3'));var rp=require(_0x80d0('0x4'));var moment=require(_0x80d0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x80d0('0x6'));var sox=require(_0x80d0('0x7'));var csv=require(_0x80d0('0x8'));var ejs=require(_0x80d0('0x9'));var fs=require('fs');var fs_extra=require(_0x80d0('0xa'));var _=require(_0x80d0('0xb'));var squel=require('squel');var crypto=require(_0x80d0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x80d0('0xd'));var toCsv=require(_0x80d0('0x8'));var querystring=require('querystring');var Papa=require(_0x80d0('0xe'));var Redis=require('ioredis');var authService=require(_0x80d0('0xf'));var qs=require(_0x80d0('0x10'));var as=require(_0x80d0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x80d0('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x80d0('0x13'))['db'];var csv_results;config[_0x80d0('0x14')]=_[_0x80d0('0x15')](config[_0x80d0('0x14')],{'host':_0x80d0('0x16'),'port':0x18eb});var socket=require(_0x80d0('0x17'))(new Redis(config['redis']));require(_0x80d0('0x18'))['register'](socket);function respondWithStatusCode(_0x3cbedc,_0x366323){_0x366323=_0x366323||0xcc;return function(_0x3b2252){if(_0x3b2252){return _0x3cbedc[_0x80d0('0x19')](_0x366323);}return _0x3cbedc[_0x80d0('0x1a')](_0x366323)[_0x80d0('0x1b')]();};}function respondWithResult(_0x343df2,_0x5b6f5c){_0x5b6f5c=_0x5b6f5c||0xc8;return function(_0x487e8b){if(_0x487e8b){return _0x343df2[_0x80d0('0x1a')](_0x5b6f5c)[_0x80d0('0x1c')](_0x487e8b);}};}function respondWithFilteredResult(_0x27e757,_0x4a141a){return function(_0xa1987c){if(_0xa1987c){var _0x49c49f=typeof _0x4a141a['offset']==='undefined'&&typeof _0x4a141a[_0x80d0('0x1d')]==='undefined';var _0x27a303=_0xa1987c['count'];var _0x3d32f7=_0x49c49f?0x0:_0x4a141a[_0x80d0('0x1e')];var _0x576405=_0x49c49f?_0xa1987c[_0x80d0('0x1f')]:_0x4a141a[_0x80d0('0x1e')]+_0x4a141a['limit'];var _0x593b66;if(_0x576405>=_0x27a303){_0x576405=_0x27a303;_0x593b66=0xc8;}else{_0x593b66=0xce;}_0x27e757[_0x80d0('0x1a')](_0x593b66);return _0x27e757[_0x80d0('0x20')](_0x80d0('0x21'),_0x3d32f7+'-'+_0x576405+'/'+_0x27a303)[_0x80d0('0x1c')](_0xa1987c);}return null;};}function patchUpdates(_0xcb0fc5){return function(_0x1dac24){try{jsonpatch['apply'](_0x1dac24,_0xcb0fc5,!![]);}catch(_0xe036df){return BPromise['reject'](_0xe036df);}return _0x1dac24[_0x80d0('0x22')]();};}function saveUpdates(_0x2008e5,_0x522063){return function(_0x7ff0b1){if(_0x7ff0b1){return _0x7ff0b1[_0x80d0('0x23')](_0x2008e5)['then'](function(_0x3df93c){return _0x3df93c;});}return null;};}function removeEntity(_0x8c00ed,_0x188dfd){return function(_0x110153){if(_0x110153){return _0x110153[_0x80d0('0x24')]()['then'](function(){var _0x1f882a=_0x110153[_0x80d0('0x25')]({'plain':!![]});var _0x42d1bc=_0x80d0('0x26');return db[_0x80d0('0x27')]['destroy']({'where':{'type':_0x42d1bc,'resourceId':_0x1f882a['id']}})[_0x80d0('0x28')](function(){return _0x110153;});})[_0x80d0('0x28')](function(){_0x8c00ed[_0x80d0('0x1a')](0xcc)[_0x80d0('0x1b')]();});}};}function handleEntityNotFound(_0x2297f7,_0x2962aa){return function(_0x279d08){if(!_0x279d08){_0x2297f7['sendStatus'](0x194);}return _0x279d08;};}function handleError(_0x40ad9f,_0x156f71){_0x156f71=_0x156f71||0x1f4;return function(_0x253174){logger[_0x80d0('0x29')](_0x253174[_0x80d0('0x2a')]);if(_0x253174['name']){delete _0x253174[_0x80d0('0x2b')];}_0x40ad9f[_0x80d0('0x1a')](_0x156f71)['send'](_0x253174);};}exports[_0x80d0('0x2c')]=function(_0x355f08,_0x548db1){var _0x194589={},_0x2f89b2={},_0x3aa09a={'count':0x0,'rows':[]};var _0x7b9e70=_[_0x80d0('0x2d')](db[_0x80d0('0x2e')][_0x80d0('0x2f')],function(_0x51cea0){return{'name':_0x51cea0[_0x80d0('0x30')],'type':_0x51cea0[_0x80d0('0x31')][_0x80d0('0x32')]};});_0x2f89b2[_0x80d0('0x33')]=_[_0x80d0('0x2d')](_0x7b9e70,_0x80d0('0x2b'));_0x2f89b2[_0x80d0('0x34')]=_[_0x80d0('0x35')](_0x355f08[_0x80d0('0x34')]);_0x2f89b2[_0x80d0('0x36')]=_['intersection'](_0x2f89b2['model'],_0x2f89b2[_0x80d0('0x34')]);_0x194589[_0x80d0('0x37')]=_[_0x80d0('0x38')](_0x2f89b2[_0x80d0('0x33')],qs['fields'](_0x355f08[_0x80d0('0x34')]['fields']));_0x194589['attributes']=_0x194589[_0x80d0('0x37')]['length']?_0x194589[_0x80d0('0x37')]:_0x2f89b2[_0x80d0('0x33')];if(!_0x355f08[_0x80d0('0x34')][_0x80d0('0x39')]('nolimit')){_0x194589[_0x80d0('0x1d')]=qs[_0x80d0('0x1d')](_0x355f08['query'][_0x80d0('0x1d')]);_0x194589[_0x80d0('0x1e')]=qs[_0x80d0('0x1e')](_0x355f08['query']['offset']);}_0x194589['order']=qs[_0x80d0('0x3a')](_0x355f08[_0x80d0('0x34')][_0x80d0('0x3a')]);_0x194589[_0x80d0('0x3b')]=qs[_0x80d0('0x36')](_[_0x80d0('0x3c')](_0x355f08['query'],_0x2f89b2[_0x80d0('0x36')]),_0x7b9e70);if(_0x355f08[_0x80d0('0x34')][_0x80d0('0x3d')]){_0x194589[_0x80d0('0x3b')]=_[_0x80d0('0x3e')](_0x194589[_0x80d0('0x3b')],{'$or':_[_0x80d0('0x2d')](_0x7b9e70,function(_0x30b24a){if(_0x30b24a[_0x80d0('0x31')]!==_0x80d0('0x3f')){var _0x1e1f0d={};_0x1e1f0d[_0x30b24a['name']]={'$like':'%'+_0x355f08[_0x80d0('0x34')][_0x80d0('0x3d')]+'%'};return _0x1e1f0d;}})});}_0x194589=_[_0x80d0('0x3e')]({},_0x194589,_0x355f08[_0x80d0('0x40')]);var _0x3d0978={'where':_0x194589[_0x80d0('0x3b')]};return db[_0x80d0('0x2e')][_0x80d0('0x1f')](_0x3d0978)[_0x80d0('0x28')](function(_0x4d4b94){_0x3aa09a[_0x80d0('0x1f')]=_0x4d4b94;if(_0x355f08[_0x80d0('0x34')]['includeAll']){_0x194589[_0x80d0('0x41')]=[{'all':!![]}];}return db['CmList'][_0x80d0('0x42')](_0x194589);})[_0x80d0('0x28')](function(_0x572a18){_0x3aa09a[_0x80d0('0x43')]=_0x572a18;return _0x3aa09a;})[_0x80d0('0x28')](respondWithFilteredResult(_0x548db1,_0x194589))[_0x80d0('0x44')](handleError(_0x548db1,null));};exports[_0x80d0('0x45')]=function(_0x4d67c8,_0x405b10){var _0x19e603={'raw':![],'where':{'id':_0x4d67c8['params']['id']}},_0x451aa1={};_0x451aa1[_0x80d0('0x33')]=_[_0x80d0('0x35')](db[_0x80d0('0x2e')]['rawAttributes']);_0x451aa1[_0x80d0('0x34')]=_['keys'](_0x4d67c8[_0x80d0('0x34')]);_0x451aa1[_0x80d0('0x36')]=_[_0x80d0('0x38')](_0x451aa1[_0x80d0('0x33')],_0x451aa1['query']);_0x19e603[_0x80d0('0x37')]=_[_0x80d0('0x38')](_0x451aa1[_0x80d0('0x33')],qs[_0x80d0('0x46')](_0x4d67c8[_0x80d0('0x34')][_0x80d0('0x46')]));_0x19e603[_0x80d0('0x37')]=_0x19e603[_0x80d0('0x37')][_0x80d0('0x47')]?_0x19e603[_0x80d0('0x37')]:_0x451aa1[_0x80d0('0x33')];if(_0x4d67c8['query']['includeAll']){_0x19e603[_0x80d0('0x41')]=[{'all':!![]}];}_0x19e603=_['merge']({},_0x19e603,_0x4d67c8[_0x80d0('0x40')]);return db[_0x80d0('0x2e')][_0x80d0('0x48')](_0x19e603)['then'](handleEntityNotFound(_0x405b10,null))[_0x80d0('0x28')](respondWithResult(_0x405b10,null))['catch'](handleError(_0x405b10,null));};exports[_0x80d0('0x49')]=function(_0x571501,_0x423dd8){return db['CmList'][_0x80d0('0x49')](_0x571501[_0x80d0('0x4a')],{})[_0x80d0('0x28')](function(_0x123bac){var _0x497b24=_0x571501[_0x80d0('0x4b')][_0x80d0('0x25')]({'plain':!![]});if(!_0x497b24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b24[_0x80d0('0x4c')]===_0x80d0('0x4b')){var _0x2a7d85=_0x123bac[_0x80d0('0x25')]({'plain':!![]});var _0x2e5c5f='Lists';return db[_0x80d0('0x4d')][_0x80d0('0x48')]({'where':{'name':_0x2e5c5f,'userProfileId':_0x497b24[_0x80d0('0x4e')]},'raw':!![]})[_0x80d0('0x28')](function(_0x2f933a){if(_0x2f933a&&_0x2f933a[_0x80d0('0x4f')]===0x0){return db['UserProfileResource'][_0x80d0('0x49')]({'name':_0x2a7d85[_0x80d0('0x2b')],'resourceId':_0x2a7d85['id'],'type':_0x2f933a[_0x80d0('0x2b')],'sectionId':_0x2f933a['id']},{})[_0x80d0('0x28')](function(){return _0x123bac;});}else{return _0x123bac;}})[_0x80d0('0x44')](function(_0x236ba1){logger['error'](_0x80d0('0x50'),_0x236ba1);throw _0x236ba1;});}return _0x123bac;})[_0x80d0('0x28')](respondWithResult(_0x423dd8,0xc9))['catch'](handleError(_0x423dd8,null));};exports['update']=function(_0x5c9a80,_0x5ddd86){if(_0x5c9a80['body']['id']){delete _0x5c9a80['body']['id'];}return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x5c9a80[_0x80d0('0x51')]['id']}})['then'](handleEntityNotFound(_0x5ddd86,null))[_0x80d0('0x28')](saveUpdates(_0x5c9a80[_0x80d0('0x4a')],null))[_0x80d0('0x28')](respondWithResult(_0x5ddd86,null))[_0x80d0('0x44')](handleError(_0x5ddd86,null));};exports[_0x80d0('0x24')]=function(_0x1bb1a8,_0x311c2a){return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x1bb1a8[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x311c2a,null))[_0x80d0('0x28')](removeEntity(_0x311c2a,null))[_0x80d0('0x44')](handleError(_0x311c2a,null));};exports[_0x80d0('0x52')]=function(_0x5a5fd8,_0x132461){return db[_0x80d0('0x2e')]['describe']()[_0x80d0('0x28')](respondWithResult(_0x132461,null))[_0x80d0('0x44')](handleError(_0x132461,null));};exports[_0x80d0('0x53')]=function(_0x2fab8b,_0x248fa8,_0x32cabb){if(_0x2fab8b[_0x80d0('0x4a')]['id']){delete _0x2fab8b[_0x80d0('0x4a')]['id'];}return db['CmList'][_0x80d0('0x48')]({'where':{'id':_0x2fab8b[_0x80d0('0x51')]['id']}})['then'](handleEntityNotFound(_0x248fa8,null))[_0x80d0('0x28')](function(_0x5986bc){if(_0x5986bc){_0x2fab8b[_0x80d0('0x4a')]['ListId']=_0x5986bc['id'];return db[_0x80d0('0x54')][_0x80d0('0x49')](_0x2fab8b[_0x80d0('0x4a')]);}})[_0x80d0('0x28')](respondWithResult(_0x248fa8,null))[_0x80d0('0x44')](handleError(_0x248fa8,null));};exports['getDispositions']=function(_0x3e3a8a,_0x5e0aee,_0x763229){var _0x2a25ab={'raw':![],'where':{}};var _0x2821be={};var _0xf971b4={'count':0x0,'rows':[]};return db[_0x80d0('0x2e')][_0x80d0('0x55')]({'where':{'id':_0x3e3a8a[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x5e0aee,null))['then'](function(_0x4e650a){if(_0x4e650a){_0x2821be[_0x80d0('0x33')]=_['keys'](db[_0x80d0('0x54')][_0x80d0('0x2f')]);_0x2821be[_0x80d0('0x34')]=_[_0x80d0('0x35')](_0x3e3a8a[_0x80d0('0x34')]);_0x2821be[_0x80d0('0x36')]=_[_0x80d0('0x38')](_0x2821be[_0x80d0('0x33')],_0x2821be[_0x80d0('0x34')]);_0x2a25ab['attributes']=_[_0x80d0('0x38')](_0x2821be[_0x80d0('0x33')],qs[_0x80d0('0x46')](_0x3e3a8a['query'][_0x80d0('0x46')]));_0x2a25ab[_0x80d0('0x37')]=_0x2a25ab[_0x80d0('0x37')][_0x80d0('0x47')]?_0x2a25ab[_0x80d0('0x37')]:_0x2821be[_0x80d0('0x33')];if(!_0x3e3a8a[_0x80d0('0x34')][_0x80d0('0x39')](_0x80d0('0x56'))){_0x2a25ab[_0x80d0('0x1d')]=qs['limit'](_0x3e3a8a[_0x80d0('0x34')][_0x80d0('0x1d')]);_0x2a25ab['offset']=qs[_0x80d0('0x1e')](_0x3e3a8a['query'][_0x80d0('0x1e')]);}_0x2a25ab[_0x80d0('0x57')]=qs[_0x80d0('0x3a')](_0x3e3a8a[_0x80d0('0x34')]['sort']);_0x2a25ab['where']=qs['filters'](_[_0x80d0('0x3c')](_0x3e3a8a[_0x80d0('0x34')],_0x2821be[_0x80d0('0x36')]));_0x2a25ab[_0x80d0('0x3b')][_0x80d0('0x58')]=_0x4e650a['id'];if(_0x3e3a8a[_0x80d0('0x34')][_0x80d0('0x3d')]){_0x2a25ab[_0x80d0('0x3b')]=_[_0x80d0('0x3e')](_0x2a25ab[_0x80d0('0x3b')],{'$or':_[_0x80d0('0x2d')](_0x2a25ab['attributes'],function(_0x1194eb){var _0x175a81={};_0x175a81[_0x1194eb]={'$like':'%'+_0x3e3a8a[_0x80d0('0x34')][_0x80d0('0x3d')]+'%'};return _0x175a81;})});}_0x2a25ab=_[_0x80d0('0x3e')]({},_0x2a25ab,_0x3e3a8a['options']);return db[_0x80d0('0x54')][_0x80d0('0x1f')]({'where':_0x2a25ab['where']})[_0x80d0('0x28')](function(_0x213e14){_0xf971b4[_0x80d0('0x1f')]=_0x213e14;if(_0x3e3a8a[_0x80d0('0x34')]['includeAll']){_0x2a25ab[_0x80d0('0x41')]=[{'all':!![]}];}return db[_0x80d0('0x54')][_0x80d0('0x42')](_0x2a25ab);})[_0x80d0('0x28')](function(_0x29becc){_0xf971b4['rows']=_0x29becc;return _0xf971b4;});}})[_0x80d0('0x28')](respondWithFilteredResult(_0x5e0aee,_0x2a25ab))[_0x80d0('0x44')](handleError(_0x5e0aee,null));};exports[_0x80d0('0x59')]=function(_0x560f4f,_0x3eb158,_0x14b025){return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x560f4f[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x3eb158,null))[_0x80d0('0x28')](function(_0x175ca8){if(_0x175ca8){return _0x175ca8[_0x80d0('0x59')](_0x560f4f[_0x80d0('0x34')][_0x80d0('0x5a')]);}})[_0x80d0('0x28')](respondWithStatusCode(_0x3eb158,null))[_0x80d0('0x44')](handleError(_0x3eb158,null));};exports[_0x80d0('0x5b')]=function(_0x123dde,_0xf83199,_0xd87517){return db[_0x80d0('0x2e')]['find']({'where':{'id':_0x123dde[_0x80d0('0x51')]['id']}})['then'](handleEntityNotFound(_0xf83199,null))[_0x80d0('0x28')](function(_0x33e083){if(_0x33e083){var _0x31c675=[];var _0x7ed08={'success':[],'errors':[]};return db[_0x80d0('0x5c')][_0x80d0('0x52')]()['then'](function(_0x5698df){if(_0x123dde[_0x80d0('0x4a')][_0x80d0('0x5d')]&&_[_0x80d0('0x5e')](_0x123dde['body']['tags'])){if(_0x123dde[_0x80d0('0x4a')]['tags']['length']){_0x123dde[_0x80d0('0x4a')][_0x80d0('0x5d')]=_0x123dde[_0x80d0('0x4a')][_0x80d0('0x5d')][_0x80d0('0x5f')](';')+';';}else{_0x123dde[_0x80d0('0x4a')]['tags']=null;}}else{_0x123dde[_0x80d0('0x4a')]['tags']=null;}if(_0x123dde['body']&&_[_0x80d0('0x5e')](_0x123dde['body'])){for(var _0x291782=0x0;_0x291782<_0x123dde[_0x80d0('0x4a')][_0x80d0('0x47')];_0x291782+=0x1){_0x123dde[_0x80d0('0x4a')][_0x291782][_0x80d0('0x58')]=_0x123dde[_0x80d0('0x51')]['id'];_0x31c675[_0x80d0('0x60')](_0x123dde[_0x80d0('0x4a')][_0x291782]);}return BPromise[_0x80d0('0x61')](_0x31c675,function(_0x5bf482){return db['CmContact'][_0x80d0('0x49')](_[_0x80d0('0x62')](_0x5bf482,[_0x80d0('0x5a'),'id'])||{},{'fields':_[_0x80d0('0x35')](_0x5698df),'raw':!![]})[_0x80d0('0x28')](function(_0x1c2b67){_0x7ed08[_0x80d0('0x63')][_0x80d0('0x60')](_0x1c2b67[_0x80d0('0x64')]);})[_0x80d0('0x44')](function(_0x24002d){_0x7ed08[_0x80d0('0x65')][_0x80d0('0x60')]({'data':_0x5bf482,'error':_0x24002d['message']});});})[_0x80d0('0x28')](function(_0x540746){return _0x7ed08;})[_0x80d0('0x44')](function(_0x49dc84){return _0x49dc84;});}else{_0xf83199['status'](0x190)[_0x80d0('0x1c')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x80d0('0x28')](respondWithResult(_0xf83199,null))[_0x80d0('0x44')](handleError(_0xf83199,null));};exports[_0x80d0('0x66')]=function(_0x19d4fe,_0x4476fa,_0x4ccc34){var _0x3326e6;return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x19d4fe['params']['id']},'include':[{'model':db[_0x80d0('0x67')],'as':_0x80d0('0x68')}]})[_0x80d0('0x28')](handleEntityNotFound(_0x4476fa,null))[_0x80d0('0x28')](function(_0x3e1202){if(_0x3e1202){_0x3326e6=_0x3e1202;return db[_0x80d0('0x5c')][_0x80d0('0x2f')];}})[_0x80d0('0x28')](function(_0x5934ba){if(_0x5934ba){var _0x2dea75={};var _0x40b36f={};_0x40b36f['model']=_[_0x80d0('0x69')](_[_0x80d0('0x35')](_0x5934ba),_[_0x80d0('0x2d')](_0x3326e6[_0x80d0('0x68')],function(_0x348c03){return util[_0x80d0('0x6a')](_0x80d0('0x6b'),_0x348c03['id']);}));_0x40b36f['query']=_['keys'](_0x19d4fe[_0x80d0('0x34')]);_0x40b36f[_0x80d0('0x36')]=_[_0x80d0('0x38')](_0x40b36f[_0x80d0('0x33')],_0x40b36f['query']);_0x2dea75[_0x80d0('0x37')]=_[_0x80d0('0x38')](_0x40b36f[_0x80d0('0x33')],qs[_0x80d0('0x46')](_0x19d4fe['query'][_0x80d0('0x46')]));_0x2dea75['attributes']=_0x2dea75[_0x80d0('0x37')][_0x80d0('0x47')]?_0x2dea75[_0x80d0('0x37')]:_0x40b36f[_0x80d0('0x33')];if(!_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x39')](_0x80d0('0x56'))){_0x2dea75[_0x80d0('0x1d')]=qs['limit'](_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x1d')]);_0x2dea75[_0x80d0('0x1e')]=qs[_0x80d0('0x1e')](_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x1e')]);}_0x2dea75[_0x80d0('0x57')]=qs[_0x80d0('0x3a')](_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x3a')]);_0x2dea75[_0x80d0('0x3b')]=qs[_0x80d0('0x36')](_[_0x80d0('0x3c')](_0x19d4fe[_0x80d0('0x34')],_0x40b36f[_0x80d0('0x36')]));_0x2dea75[_0x80d0('0x6c')]=!![];if(_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x3d')]){_0x2dea75[_0x80d0('0x3b')]=_[_0x80d0('0x3e')](_0x2dea75[_0x80d0('0x3b')],{'$or':_[_0x80d0('0x2d')](_0x2dea75[_0x80d0('0x37')],function(_0xa40079){var _0x3537c8={};_0x3537c8[_0xa40079]={'$like':'%'+_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x3d')]+'%'};return _0x3537c8;})});}_0x2dea75=_[_0x80d0('0x3e')]({},_0x2dea75,_0x19d4fe[_0x80d0('0x40')]);return _0x3326e6[_0x80d0('0x66')](_0x2dea75);}})[_0x80d0('0x28')](respondWithResult(_0x4476fa,null))['catch'](handleError(_0x4476fa,null));};exports[_0x80d0('0x6d')]=function(_0xbdd49f,_0x52ef7a,_0x3e5417){var _0x1e3ec9;var _0x385d91;var _0x336354;var _0x1fe962=_0xbdd49f['params']['id'];csv_results=[];return db['ContactItemType'][_0x80d0('0x42')]({'attributes':['id',_0x80d0('0x2b')],'raw':!![],'order':[_0x80d0('0x6e')]})[_0x80d0('0x28')](function(_0x137697){_0x1e3ec9=_0x137697;var _0x3b34e7=_[_0x80d0('0x35')](db[_0x80d0('0x5c')]['rawAttributes']);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x80d0('0x6f')]})[_0x80d0('0x28')](function(_0x3164a7){_0x385d91=_0x3164a7;var _0x52d4e4=squel[_0x80d0('0x70')]()[_0x80d0('0x46')](_0x3b34e7)['from'](_0x80d0('0x71'),'c')[_0x80d0('0x3b')](_0x80d0('0x72'),_0x1fe962)[_0x80d0('0x3b')](_0x80d0('0x73'))[_0x80d0('0x74')]();for(var _0x359fe4=0x0;_0x359fe4<_0x385d91[_0x80d0('0x47')];_0x359fe4++){_0x52d4e4[_0x80d0('0x75')](_0x80d0('0x76')+_0x385d91[_0x359fe4]['id'],_0x80d0('0x77')+_0x385d91[_0x359fe4][_0x80d0('0x6f')]);}for(var _0x359fe4=0x0;_0x359fe4<_0x1e3ec9[_0x80d0('0x47')];_0x359fe4++){_0x52d4e4[_0x80d0('0x75')](squel[_0x80d0('0x70')]()[_0x80d0('0x75')](_0x80d0('0x78'))[_0x80d0('0x79')](_0x80d0('0x7a'))[_0x80d0('0x3b')](_0x80d0('0x7b'),_0x1e3ec9[_0x359fe4]['id'])['where'](_0x80d0('0x7c')),_0x80d0('0x7d')+_0x1e3ec9[_0x359fe4][_0x80d0('0x2b')]);_0x52d4e4[_0x80d0('0x75')](squel[_0x80d0('0x70')]()[_0x80d0('0x75')](_0x80d0('0x7e'))[_0x80d0('0x79')](_0x80d0('0x7a'))[_0x80d0('0x3b')]('ItemTypeId\x20=\x20?',_0x1e3ec9[_0x359fe4]['id'])[_0x80d0('0x3b')]('CmContactId\x20=\x20c.id'),_0x80d0('0x7f')+_0x1e3ec9[_0x359fe4][_0x80d0('0x2b')]);}var _0x17f437=[];_0x17f437[_0x80d0('0x60')](_0x52d4e4['toString']());BPromise[_0x80d0('0x61')](_0x17f437,handleQuery)[_0x80d0('0x28')](function(_0x27501a){handleQuery(_0x52d4e4['toString']());var _0x3b35ee=csv_results[0x0];if(!_[_0x80d0('0x80')](_0x3b35ee)){var _0xeff5be=toCsv(_0x3b35ee);var _0x419f3b=Date[_0x80d0('0x81')]();fs[_0x80d0('0x82')](util[_0x80d0('0x6a')]('/tmp/list_%d_%s.csv',_0x1fe962,_0x419f3b),_0xeff5be);_0x52ef7a['setHeader'](_0x80d0('0x83'),'attachment;\x20filename='+util[_0x80d0('0x6a')]('list_%d_%s.csv',_0x1fe962,_0x419f3b));_0x52ef7a[_0x80d0('0x84')](_0x80d0('0x85'),_0x80d0('0x86'));return _0x52ef7a['download'](util[_0x80d0('0x6a')](_0x80d0('0x87'),_0x1fe962,_0x419f3b));}else{return _0x52ef7a[_0x80d0('0x19')](0xcc);}});});});};exports[_0x80d0('0x88')]=function(_0x1585a6,_0x5f8588,_0x24908b){var _0x5cf863;delete _0x1585a6[_0x80d0('0x4a')]['id'];return db[_0x80d0('0x2e')]['findOne']({'where':{'id':_0x1585a6['params']['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x5f8588,null))['then'](function(_0x1e1d80){if(_0x1e1d80){return db[_0x80d0('0x89')][_0x80d0('0x8a')](function(_0xd61eaa){return db[_0x80d0('0x67')][_0x80d0('0x49')](_0x1585a6[_0x80d0('0x4a')],{'transaction':_0xd61eaa})[_0x80d0('0x28')](function(_0x414e4e){_0x5cf863=_0x414e4e;return _0x1e1d80[_0x80d0('0x8b')](_0x414e4e,{'transaction':_0xd61eaa});})['then'](function(){var _0x720a96={'type':db[_0x80d0('0x8c')]['TEXT'],'transaction':_0xd61eaa};switch(_0x1585a6['body']['type']){case _0x80d0('0x8d'):_0x720a96[_0x80d0('0x31')]=db[_0x80d0('0x8c')]['TEXT'];break;case _0x80d0('0x8e'):_0x720a96[_0x80d0('0x31')]=db[_0x80d0('0x8c')][_0x80d0('0x8f')];break;case'switch':_0x720a96[_0x80d0('0x31')]=db['Sequelize'][_0x80d0('0x90')];_0x720a96[_0x80d0('0x91')]=![];break;default:}return db['sequelize'][_0x80d0('0x92')]['addColumn']('cm_contacts',util['format'](_0x80d0('0x93'),_0x5cf863['id']),_0x720a96);})[_0x80d0('0x28')](function(){return _0x5cf863;});});}})[_0x80d0('0x28')](respondWithResult(_0x5f8588,null))['catch'](handleError(_0x5f8588,null));};exports[_0x80d0('0x94')]=function(_0x1b460d,_0x338682,_0x3cd9a6){var _0x17b531={};var _0x631ee={};var _0x49d785;var _0x2bf9cc;return db['CmList']['findOne']({'where':{'id':_0x1b460d[_0x80d0('0x51')]['id']}})['then'](handleEntityNotFound(_0x338682,null))['then'](function(_0x5d0920){if(_0x5d0920){_0x49d785=_0x5d0920;_0x631ee['model']=_[_0x80d0('0x35')](db[_0x80d0('0x67')]['rawAttributes']);_0x631ee['query']=_['keys'](_0x1b460d[_0x80d0('0x34')]);_0x631ee['filters']=_['intersection'](_0x631ee[_0x80d0('0x33')],_0x631ee[_0x80d0('0x34')]);_0x17b531[_0x80d0('0x37')]=_[_0x80d0('0x38')](_0x631ee[_0x80d0('0x33')],qs[_0x80d0('0x46')](_0x1b460d[_0x80d0('0x34')][_0x80d0('0x46')]));_0x17b531[_0x80d0('0x37')]=_0x17b531[_0x80d0('0x37')][_0x80d0('0x47')]?_0x17b531[_0x80d0('0x37')]:_0x631ee[_0x80d0('0x33')];_0x17b531['order']=qs[_0x80d0('0x3a')](_0x1b460d[_0x80d0('0x34')][_0x80d0('0x3a')]);_0x17b531[_0x80d0('0x3b')]=qs['filters'](_[_0x80d0('0x3c')](_0x1b460d[_0x80d0('0x34')],_0x631ee[_0x80d0('0x36')]));_0x17b531[_0x80d0('0x3b')]=_[_0x80d0('0x3e')](_0x17b531[_0x80d0('0x3b')],{'$or':[{'ListId':_0x5d0920['id']},{'ListId':null}]});if(_0x1b460d[_0x80d0('0x34')][_0x80d0('0x3d')]){_0x17b531[_0x80d0('0x3b')]=_[_0x80d0('0x3e')](_0x17b531['where'],{'$or':_[_0x80d0('0x2d')](_0x17b531[_0x80d0('0x37')],function(_0x1d4133){var _0x4bdd3e={};_0x4bdd3e[_0x1d4133]={'$like':'%'+_0x1b460d[_0x80d0('0x34')][_0x80d0('0x3d')]+'%'};return _0x4bdd3e;})});}_0x17b531=_['merge']({},_0x17b531,_0x1b460d[_0x80d0('0x40')]);return db[_0x80d0('0x67')][_0x80d0('0x95')](_0x17b531);}})['then'](respondWithResult(_0x338682,null))[_0x80d0('0x44')](handleError(_0x338682,null));};exports[_0x80d0('0x96')]=function(_0x481fd1,_0x41718b){return db[_0x80d0('0x67')][_0x80d0('0x95')]({'where':{'ListId':null}})[_0x80d0('0x28')](handleEntityNotFound(_0x41718b,null))[_0x80d0('0x28')](function(_0x40de6b){return _0x40de6b;})[_0x80d0('0x28')](respondWithResult(_0x41718b,null))[_0x80d0('0x44')](handleError(_0x41718b,null));};exports[_0x80d0('0x97')]=function(_0x48851a,_0x52fbf4,_0x1edaa0){return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x48851a[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x52fbf4,null))[_0x80d0('0x28')](function(_0x5b7f15){if(_0x5b7f15){return _0x5b7f15[_0x80d0('0x97')](_0x48851a[_0x80d0('0x4a')][_0x80d0('0x5a')],_[_0x80d0('0x62')](_0x48851a[_0x80d0('0x4a')],[_0x80d0('0x5a'),'id'])||{})[_0x80d0('0x98')](function(_0x143284){for(var _0x207966=0x0;_0x207966<_0x48851a['body']['ids'][_0x80d0('0x47')];_0x207966+=0x1){socket[_0x80d0('0x99')](_0x80d0('0x9a'),{'UserId':Number(_0x48851a['body'][_0x80d0('0x5a')][_0x207966]),'CmListId':Number(_0x48851a['params']['id'])});}return _0x143284;});}})[_0x80d0('0x28')](respondWithResult(_0x52fbf4,null))[_0x80d0('0x44')](handleError(_0x52fbf4,null));};exports[_0x80d0('0x9b')]=function(_0x412c9e,_0x3ad17a,_0x561ffd){return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x412c9e[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x3ad17a,null))[_0x80d0('0x28')](function(_0x2b0fa1){if(_0x2b0fa1){return _0x2b0fa1[_0x80d0('0x9b')](_0x412c9e['query'][_0x80d0('0x5a')])[_0x80d0('0x28')](function(){if(_[_0x80d0('0x5e')](_0x412c9e[_0x80d0('0x34')][_0x80d0('0x5a')])){for(var _0x204544=0x0;_0x204544<_0x412c9e[_0x80d0('0x34')]['ids']['length'];_0x204544+=0x1){socket[_0x80d0('0x99')]('userCmList:remove',{'UserId':Number(_0x412c9e[_0x80d0('0x34')][_0x80d0('0x5a')][_0x204544]),'CmListId':Number(_0x412c9e[_0x80d0('0x51')]['id'])});}}else{socket[_0x80d0('0x99')]('userCmList:remove',{'UserId':Number(_0x412c9e[_0x80d0('0x34')][_0x80d0('0x5a')]),'CmListId':Number(_0x412c9e['params']['id'])});}});}})[_0x80d0('0x28')](respondWithStatusCode(_0x3ad17a,null))[_0x80d0('0x44')](handleError(_0x3ad17a,null));};exports[_0x80d0('0x9c')]=function(_0x4831be,_0x1bc310,_0x327cc0){var _0x23d897={};var _0x334996={};var _0x552045;var _0x1f5ac1;return db[_0x80d0('0x2e')][_0x80d0('0x55')]({'where':{'id':_0x4831be[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x1bc310,null))[_0x80d0('0x28')](function(_0x20cd94){if(_0x20cd94){_0x552045=_0x20cd94;_0x334996[_0x80d0('0x33')]=_['keys'](db[_0x80d0('0x9d')][_0x80d0('0x2f')]);_0x334996[_0x80d0('0x34')]=_['keys'](_0x4831be[_0x80d0('0x34')]);_0x334996['filters']=_['intersection'](_0x334996[_0x80d0('0x33')],_0x334996[_0x80d0('0x34')]);_0x23d897['attributes']=_[_0x80d0('0x38')](_0x334996['model'],qs['fields'](_0x4831be[_0x80d0('0x34')]['fields']));_0x23d897['attributes']=_0x23d897['attributes']['length']?_0x23d897[_0x80d0('0x37')]:_0x334996['model'];_0x23d897[_0x80d0('0x57')]=qs[_0x80d0('0x3a')](_0x4831be[_0x80d0('0x34')][_0x80d0('0x3a')]);_0x23d897[_0x80d0('0x3b')]=qs[_0x80d0('0x36')](_[_0x80d0('0x3c')](_0x4831be[_0x80d0('0x34')],_0x334996[_0x80d0('0x36')]));if(_0x4831be[_0x80d0('0x34')][_0x80d0('0x3d')]){_0x23d897[_0x80d0('0x3b')]=_['merge'](_0x23d897[_0x80d0('0x3b')],{'$or':_['map'](_0x23d897[_0x80d0('0x37')],function(_0x6892f5){var _0x2b65ba={};_0x2b65ba[_0x6892f5]={'$like':'%'+_0x4831be[_0x80d0('0x34')][_0x80d0('0x3d')]+'%'};return _0x2b65ba;})});}_0x23d897=_[_0x80d0('0x3e')]({},_0x23d897,_0x4831be[_0x80d0('0x40')]);return _0x552045[_0x80d0('0x9c')](_0x23d897);}})[_0x80d0('0x28')](function(_0x4c98f3){if(_0x4c98f3){_0x1f5ac1=_0x4c98f3[_0x80d0('0x47')];if(!_0x4831be['query']['hasOwnProperty'](_0x80d0('0x56'))){_0x23d897[_0x80d0('0x1d')]=qs[_0x80d0('0x1d')](_0x4831be['query']['limit']);_0x23d897[_0x80d0('0x1e')]=qs['offset'](_0x4831be[_0x80d0('0x34')][_0x80d0('0x1e')]);}return _0x552045['getAgents'](_0x23d897);}})[_0x80d0('0x28')](function(_0xc90838){if(_0xc90838){return _0xc90838?{'count':_0x1f5ac1,'rows':_0xc90838}:null;}})[_0x80d0('0x28')](respondWithResult(_0x1bc310,null))['catch'](handleError(_0x1bc310,null));};function handleQuery(_0x1a1887){logger[_0x80d0('0x9e')](_0x1a1887);return db['sequelize'][_0x80d0('0x34')](_0x1a1887)[_0x80d0('0x98')](function(_0xa66cca){csv_results[_0x80d0('0x60')](_0xa66cca);})[_0x80d0('0x44')](function(_0x11ede4){logger[_0x80d0('0x29')](_0x11ede4[_0x80d0('0x9f')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f5de30b..6afb207 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0xa54b4a,_0x4f4480){_0xa54b4a=_0xa54b4a-0x0;var _0x4f48b0=_0xe14b[_0xa54b4a];return _0x4f48b0;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x7217,0x19e));var _0x7721=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7217[_0x134c2e];return _0x2825db;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 73f50b1..f135ff9 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 _0xb821=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','../../config/logger','bluebird'];(function(_0x11995f,_0xded9a9){var _0x1e550a=function(_0x1bd645){while(--_0x1bd645){_0x11995f['push'](_0x11995f['shift']());}};_0x1e550a(++_0xded9a9);}(_0xb821,0xa7));var _0x1b82=function(_0x40abf4,_0x52f2c8){_0x40abf4=_0x40abf4-0x0;var _0x3c27cb=_0xb821[_0x40abf4];return _0x3c27cb;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash'];(function(_0x30cb6c,_0x1814be){var _0x42a220=function(_0x56a9de){while(--_0x56a9de){_0x30cb6c['push'](_0x30cb6c['shift']());}};_0x42a220(++_0x1814be);}(_0xaa88,0x137));var _0x8aa8=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xaa88[_0x58fc2f];return _0x3a1312;};'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 diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index f0da601..e7a1159 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 _0xae3e=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3346db,_0x58c6bf){var _0x3230d0=function(_0x4519e0){while(--_0x4519e0){_0x3346db['push'](_0x3346db['shift']());}};_0x3230d0(++_0x58c6bf);}(_0xae3e,0x71));var _0xeae3=function(_0x2f40b0,_0x40122e){_0x2f40b0=_0x2f40b0-0x0;var _0x5bc71b=_0xae3e[_0x2f40b0];return _0x5bc71b;};'use strict';var _=require(_0xeae3('0x0'));var util=require(_0xeae3('0x1'));var moment=require(_0xeae3('0x2'));var BPromise=require(_0xeae3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeae3('0x4'))['db'];var utils=require(_0xeae3('0x5'));var logger=require(_0xeae3('0x6'))(_0xeae3('0x7'));var config=require('../../config/environment');var jayson=require(_0xeae3('0x8'));var client=jayson[_0xeae3('0x9')][_0xeae3('0xa')]({'port':0x232a});config[_0xeae3('0xb')]=_[_0xeae3('0xc')](config[_0xeae3('0xb')],{'host':_0xeae3('0xd'),'port':0x18eb});var socket=require(_0xeae3('0xe'))(new Redis(config[_0xeae3('0xb')]));require('./cmList.socket')[_0xeae3('0xf')](socket);function respondWithRpcPromise(_0x651c2b,_0x14575c,_0x255bc0){return new BPromise(function(_0x9d87a0,_0x2dafb4){return client[_0xeae3('0x10')](_0x651c2b,_0x255bc0)['then'](function(_0x39e4d5){logger[_0xeae3('0x11')](_0xeae3('0x12'),_0x14575c,_0xeae3('0x13'));logger[_0xeae3('0x14')](_0xeae3('0x15'),_0x14575c,_0xeae3('0x13'),JSON[_0xeae3('0x16')](_0x39e4d5));if(_0x39e4d5['error']){if(_0x39e4d5[_0xeae3('0x17')][_0xeae3('0x18')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x14575c,_0x39e4d5[_0xeae3('0x17')][_0xeae3('0x19')]);return _0x2dafb4(_0x39e4d5[_0xeae3('0x17')][_0xeae3('0x19')]);}logger[_0xeae3('0x17')]('CmList,\x20%s,\x20%s',_0x14575c,_0x39e4d5['error'][_0xeae3('0x19')]);return _0x9d87a0(_0x39e4d5[_0xeae3('0x17')][_0xeae3('0x19')]);}else{logger[_0xeae3('0x11')]('CmList,\x20%s,\x20%s',_0x14575c,_0xeae3('0x13'));_0x9d87a0(_0x39e4d5[_0xeae3('0x1a')][_0xeae3('0x19')]);}})[_0xeae3('0x1b')](function(_0x46e7a5){logger[_0xeae3('0x17')](_0xeae3('0x12'),_0x14575c,_0x46e7a5);_0x2dafb4(_0x46e7a5);});});} \ No newline at end of file +var _0x57f3=['../../config/environment','client','redis','defaults','localhost','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','randomstring','ioredis','../../mysqldb','rpc'];(function(_0xfff0ae,_0xdb7a93){var _0x977e5f=function(_0x1c02ef){while(--_0x1c02ef){_0xfff0ae['push'](_0xfff0ae['shift']());}};_0x977e5f(++_0xdb7a93);}(_0x57f3,0x9b));var _0x357f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x57f3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x357f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x357f('0x1'));var fs=require('fs');var Redis=require(_0x357f('0x2'));var db=require(_0x357f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x357f('0x4'));var config=require(_0x357f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x357f('0x6')]['http']({'port':0x232a});config[_0x357f('0x7')]=_[_0x357f('0x8')](config[_0x357f('0x7')],{'host':_0x357f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x357f('0xa'))[_0x357f('0xb')](socket);function respondWithRpcPromise(_0x47cdd0,_0x4b0073,_0x243146){return new BPromise(function(_0x3c5444,_0x31e355){return client[_0x357f('0xc')](_0x47cdd0,_0x243146)['then'](function(_0x35dd40){logger['info'](_0x357f('0xd'),_0x4b0073,_0x357f('0xe'));logger['debug'](_0x357f('0xf'),_0x4b0073,_0x357f('0xe'),JSON[_0x357f('0x10')](_0x35dd40));if(_0x35dd40[_0x357f('0x11')]){if(_0x35dd40[_0x357f('0x11')]['code']===0x1f4){logger[_0x357f('0x11')](_0x357f('0xd'),_0x4b0073,_0x35dd40[_0x357f('0x11')][_0x357f('0x12')]);return _0x31e355(_0x35dd40['error'][_0x357f('0x12')]);}logger['error'](_0x357f('0xd'),_0x4b0073,_0x35dd40[_0x357f('0x11')][_0x357f('0x12')]);return _0x3c5444(_0x35dd40[_0x357f('0x11')]['message']);}else{logger['info']('CmList,\x20%s,\x20%s',_0x4b0073,_0x357f('0xe'));_0x3c5444(_0x35dd40[_0x357f('0x13')][_0x357f('0x12')]);}})['catch'](function(_0x50dfa5){logger[_0x357f('0x11')](_0x357f('0xd'),_0x4b0073,_0x50dfa5);_0x31e355(_0x50dfa5);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index f39529c..83dd263 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 _0x889c=['register','length','cmList:','./cmList.events','remove','update','emit','removeListener'];(function(_0x37858e,_0x59edc1){var _0x1ae8c2=function(_0x10951b){while(--_0x10951b){_0x37858e['push'](_0x37858e['shift']());}};_0x1ae8c2(++_0x59edc1);}(_0x889c,0x1cb));var _0xc889=function(_0xcf9be0,_0x2ed5b2){_0xcf9be0=_0xcf9be0-0x0;var _0x12a945=_0x889c[_0xcf9be0];return _0x12a945;};'use strict';var CmListEvents=require(_0xc889('0x0'));var events=['save',_0xc889('0x1'),_0xc889('0x2')];function createListener(_0x566521,_0x26743b){return function(_0x5b5cdc){_0x26743b[_0xc889('0x3')](_0x566521,_0x5b5cdc);};}function removeListener(_0x2a84ca,_0x3f65c8){return function(){CmListEvents[_0xc889('0x4')](_0x2a84ca,_0x3f65c8);};}exports[_0xc889('0x5')]=function(_0x50376d){for(var _0x5dac40=0x0,_0x4367b8=events[_0xc889('0x6')];_0x5dac40<_0x4367b8;_0x5dac40++){var _0x22b22e=events[_0x5dac40];var _0xca1fd2=createListener(_0xc889('0x7')+_0x22b22e,_0x50376d);CmListEvents['on'](_0x22b22e,_0xca1fd2);}}; \ No newline at end of file +var _0x9da2=['register','length','cmList:','./cmList.events','save','emit','removeListener'];(function(_0x38c0ff,_0x296d99){var _0x580963=function(_0x40a1fd){while(--_0x40a1fd){_0x38c0ff['push'](_0x38c0ff['shift']());}};_0x580963(++_0x296d99);}(_0x9da2,0x153));var _0x29da=function(_0x218360,_0x15db19){_0x218360=_0x218360-0x0;var _0x3bb157=_0x9da2[_0x218360];return _0x3bb157;};'use strict';var CmListEvents=require(_0x29da('0x0'));var events=[_0x29da('0x1'),'remove','update'];function createListener(_0x1b83d7,_0x6b3aa2){return function(_0x540f30){_0x6b3aa2[_0x29da('0x2')](_0x1b83d7,_0x540f30);};}function removeListener(_0x534417,_0x4dc607){return function(){CmListEvents[_0x29da('0x3')](_0x534417,_0x4dc607);};}exports[_0x29da('0x4')]=function(_0x51fe4b){for(var _0x18b8b0=0x0,_0x1c552a=events[_0x29da('0x5')];_0x18b8b0<_0x1c552a;_0x18b8b0++){var _0x1525b1=events[_0x18b8b0];var _0x5d52a3=createListener(_0x29da('0x6')+_0x1525b1,_0x51fe4b);CmListEvents['on'](_0x1525b1,_0x5d52a3);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9a3523a..3537def 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 _0xf7fd=['addDisposition','/:id/contacts','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create'];(function(_0x51b19b,_0x5015d2){var _0x1a3cd6=function(_0x495134){while(--_0x495134){_0x51b19b['push'](_0x51b19b['shift']());}};_0x1a3cd6(++_0x5015d2);}(_0xf7fd,0x14c));var _0xdf7f=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xf7fd[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0xdf7f('0x0'));var util=require(_0xdf7f('0x1'));var path=require(_0xdf7f('0x2'));var timeout=require(_0xdf7f('0x3'));var express=require('express');var router=express[_0xdf7f('0x4')]();var fs_extra=require(_0xdf7f('0x5'));var auth=require(_0xdf7f('0x6'));var interaction=require(_0xdf7f('0x7'));var config=require(_0xdf7f('0x8'));var controller=require('./cmList.controller');router[_0xdf7f('0x9')]('/',auth['isAuthenticated'](),controller[_0xdf7f('0xa')]);router[_0xdf7f('0x9')](_0xdf7f('0xb'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0xd')]);router[_0xdf7f('0x9')](_0xdf7f('0xe'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0xf')]);router[_0xdf7f('0x9')](_0xdf7f('0x10'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x11')]);router['get'](_0xdf7f('0x12'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x13')]);router[_0xdf7f('0x9')]('/:id/contacts',auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x14')]);router[_0xdf7f('0x9')](_0xdf7f('0x15'),auth['isAuthenticated'](),controller[_0xdf7f('0x16')]);router[_0xdf7f('0x9')](_0xdf7f('0x17'),auth['isAuthenticated'](),controller['getCustomFields']);router['get'](_0xdf7f('0x18'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x19')]);router[_0xdf7f('0x1a')]('/',auth['isAuthenticated'](),controller[_0xdf7f('0x1b')]);router[_0xdf7f('0x1a')](_0xdf7f('0x12'),auth['isAuthenticated'](),controller[_0xdf7f('0x1c')]);router['post'](_0xdf7f('0x1d'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x1e')]);router['post']('/:id/fields',auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x1f')]);router[_0xdf7f('0x1a')](_0xdf7f('0x18'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x20')]);router[_0xdf7f('0x21')]('/:id',auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x22')]);router[_0xdf7f('0x23')](_0xdf7f('0x10'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x24')]);router[_0xdf7f('0x23')](_0xdf7f('0x12'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x25')]);router[_0xdf7f('0x23')](_0xdf7f('0x18'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x26')]);module[_0xdf7f('0x27')]=router; \ No newline at end of file +var _0xfa8d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','getGlobalCustomFields','/:id','/:id/dispositions','/:id/contacts/csv','getContactsCsv','/:id/users','getAgents','post','addDisposition','/:id/contacts','/:id/fields','addCustomField','addAgents','put','update','delete','removeAgents','exports','multer','util','path'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xfa8d,0x9d));var _0xdfa8=function(_0x20c14e,_0x293d7e){_0x20c14e=_0x20c14e-0x0;var _0x41feb1=_0xfa8d[_0x20c14e];return _0x41feb1;};'use strict';var multer=require(_0xdfa8('0x0'));var util=require(_0xdfa8('0x1'));var path=require(_0xdfa8('0x2'));var timeout=require(_0xdfa8('0x3'));var express=require(_0xdfa8('0x4'));var router=express[_0xdfa8('0x5')]();var fs_extra=require(_0xdfa8('0x6'));var auth=require(_0xdfa8('0x7'));var interaction=require(_0xdfa8('0x8'));var config=require(_0xdfa8('0x9'));var controller=require(_0xdfa8('0xa'));router[_0xdfa8('0xb')]('/',auth[_0xdfa8('0xc')](),controller['index']);router[_0xdfa8('0xb')](_0xdfa8('0xd'),auth[_0xdfa8('0xc')](),controller['describe']);router[_0xdfa8('0xb')]('/global_fields',auth['isAuthenticated'](),controller[_0xdfa8('0xe')]);router[_0xdfa8('0xb')](_0xdfa8('0xf'),auth[_0xdfa8('0xc')](),controller['show']);router[_0xdfa8('0xb')](_0xdfa8('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xdfa8('0xb')]('/:id/contacts',auth[_0xdfa8('0xc')](),controller['getContacts']);router[_0xdfa8('0xb')](_0xdfa8('0x11'),auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x12')]);router[_0xdfa8('0xb')]('/:id/fields',auth[_0xdfa8('0xc')](),controller['getCustomFields']);router[_0xdfa8('0xb')](_0xdfa8('0x13'),auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x14')]);router['post']('/',auth[_0xdfa8('0xc')](),controller['create']);router[_0xdfa8('0x15')](_0xdfa8('0x10'),auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x16')]);router['post'](_0xdfa8('0x17'),auth[_0xdfa8('0xc')](),controller['addContacts']);router[_0xdfa8('0x15')](_0xdfa8('0x18'),auth['isAuthenticated'](),controller[_0xdfa8('0x19')]);router[_0xdfa8('0x15')](_0xdfa8('0x13'),auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x1a')]);router[_0xdfa8('0x1b')]('/:id',auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x1c')]);router[_0xdfa8('0x1d')](_0xdfa8('0xf'),auth[_0xdfa8('0xc')](),controller['destroy']);router[_0xdfa8('0x1d')](_0xdfa8('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xdfa8('0x1d')](_0xdfa8('0x13'),auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x1e')]);module[_0xdfa8('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 5f42c0a..e121b94 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 _0xbd37=['VIRTUAL','getDataValue','field','STRING'];(function(_0x44b8ec,_0xedf9a){var _0x27b80f=function(_0x426b86){while(--_0x426b86){_0x44b8ec['push'](_0x44b8ec['shift']());}};_0x27b80f(++_0xedf9a);}(_0xbd37,0x1b0));var _0x7bd3=function(_0x2b368d,_0x429cd4){_0x2b368d=_0x2b368d-0x0;var _0x3309e8=_0xbd37[_0x2b368d];return _0x3309e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7bd3('0x0')],'get':function(_0x2058de){return this[_0x7bd3('0x1')](_0x7bd3('0x2'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x7bd3('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x7bd3('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x9588=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0x9588,0x137));var _0x8958=function(_0x41df99,_0x39599f){_0x41df99=_0x41df99-0x0;var _0x5923e0=_0x9588[_0x41df99];return _0x5923e0;};'use strict';var Sequelize=require(_0x8958('0x0'));module[_0x8958('0x1')]={'name':{'type':Sequelize[_0x8958('0x2')],'get':function(_0x5b5b27){return this[_0x8958('0x3')](_0x8958('0x4'));}},'field':{'type':Sequelize[_0x8958('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x8958('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x8958('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 77f354e..52f8fa7 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(_0x282ef5,_0x372c25){var _0x753794=function(_0x84d70e){while(--_0x84d70e){_0x282ef5['push'](_0x282ef5['shift']());}};_0x753794(++_0x372c25);}(_0x7a54,0x106));var _0x47a5=function(_0x2941ba,_0x1800c9){_0x2941ba=_0x2941ba-0x0;var _0x4c0a6e=_0x7a54[_0x2941ba];return _0x4c0a6e;};'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 _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(_0x4f5270,_0x15c5c8){var _0x5ec489=function(_0x355b91){while(--_0x355b91){_0x4f5270['push'](_0x4f5270['shift']());}};_0x5ec489(++_0x15c5c8);}(_0x7a54,0x106));var _0x47a5=function(_0x53c493,_0x4f8748){_0x53c493=_0x53c493-0x0;var _0x4383cb=_0x7a54[_0x53c493];return _0x4383cb;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 1841a78..251d0b7 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 _0x7c28=['../../config/environment','exports','define','tools_conditions','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1bb49c,_0x510210){var _0x45db79=function(_0x3dc94c){while(--_0x3dc94c){_0x1bb49c['push'](_0x1bb49c['shift']());}};_0x45db79(++_0x510210);}(_0x7c28,0x190));var _0x87c2=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x7c28[_0x166742];return _0xb7814a;};'use strict';var _=require('lodash');var util=require(_0x87c2('0x0'));var logger=require(_0x87c2('0x1'))(_0x87c2('0x2'));var moment=require(_0x87c2('0x3'));var BPromise=require(_0x87c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87c2('0x5'));var rimraf=require(_0x87c2('0x6'));var config=require(_0x87c2('0x7'));var attributes=require('./condition.attributes');module[_0x87c2('0x8')]=function(_0x3f985a,_0x3db9ee){return _0x3f985a[_0x87c2('0x9')]('Condition',attributes,{'tableName':_0x87c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x967d=['rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x967d,0xae));var _0xd967=function(_0x80e32c,_0x45b0bf){_0x80e32c=_0x80e32c-0x0;var _0x5a31af=_0x967d[_0x80e32c];return _0x5a31af;};'use strict';var _=require('lodash');var util=require(_0xd967('0x0'));var logger=require(_0xd967('0x1'))(_0xd967('0x2'));var moment=require('moment');var BPromise=require(_0xd967('0x3'));var rp=require(_0xd967('0x4'));var fs=require('fs');var path=require(_0xd967('0x5'));var rimraf=require(_0xd967('0x6'));var config=require(_0xd967('0x7'));var attributes=require(_0xd967('0x8'));module[_0xd967('0x9')]=function(_0x5b77f7,_0x4895d9){return _0x5b77f7[_0xd967('0xa')]('Condition',attributes,{'tableName':_0xd967('0xb'),'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 9447286..5767246 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 _0x5fa4=['info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x59b48b,_0x584733){var _0x4c3f79=function(_0x3f2e94){while(--_0x3f2e94){_0x59b48b['push'](_0x59b48b['shift']());}};_0x4c3f79(++_0x584733);}(_0x5fa4,0x83));var _0x45fa=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5fa4[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x45fa('0x0'));var util=require(_0x45fa('0x1'));var moment=require(_0x45fa('0x2'));var BPromise=require(_0x45fa('0x3'));var rs=require(_0x45fa('0x4'));var fs=require('fs');var Redis=require(_0x45fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x45fa('0x6'));var logger=require('../../config/logger')(_0x45fa('0x7'));var config=require(_0x45fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x45fa('0x9')][_0x45fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b7e86,_0x4ec268,_0x481b4b){return new BPromise(function(_0x2bb127,_0x2a7a97){return client[_0x45fa('0xb')](_0x5b7e86,_0x481b4b)[_0x45fa('0xc')](function(_0x35df52){logger[_0x45fa('0xd')](_0x45fa('0xe'),_0x4ec268,_0x45fa('0xf'));logger[_0x45fa('0x10')](_0x45fa('0x11'),_0x4ec268,_0x45fa('0xf'),JSON[_0x45fa('0x12')](_0x35df52));if(_0x35df52['error']){if(_0x35df52[_0x45fa('0x13')][_0x45fa('0x14')]===0x1f4){logger[_0x45fa('0x13')](_0x45fa('0xe'),_0x4ec268,_0x35df52[_0x45fa('0x13')][_0x45fa('0x15')]);return _0x2a7a97(_0x35df52[_0x45fa('0x13')][_0x45fa('0x15')]);}logger[_0x45fa('0x13')]('Condition,\x20%s,\x20%s',_0x4ec268,_0x35df52['error']['message']);return _0x2bb127(_0x35df52['error']['message']);}else{logger[_0x45fa('0xd')](_0x45fa('0xe'),_0x4ec268,_0x45fa('0xf'));_0x2bb127(_0x35df52[_0x45fa('0x16')][_0x45fa('0x15')]);}})[_0x45fa('0x17')](function(_0x2ee2c4){logger[_0x45fa('0x13')](_0x45fa('0xe'),_0x4ec268,_0x2ee2c4);_0x2a7a97(_0x2ee2c4);});});} \ No newline at end of file +var _0xc80c=['../../config/logger','rpc','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e27a9,_0x26ecfa){var _0x117def=function(_0x3591bf){while(--_0x3591bf){_0x4e27a9['push'](_0x4e27a9['shift']());}};_0x117def(++_0x26ecfa);}(_0xc80c,0x12e));var _0xcc80=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xc80c[_0x4c440b];return _0x2d48cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcc80('0x0'));var BPromise=require(_0xcc80('0x1'));var rs=require(_0xcc80('0x2'));var fs=require('fs');var Redis=require(_0xcc80('0x3'));var db=require(_0xcc80('0x4'))['db'];var utils=require(_0xcc80('0x5'));var logger=require(_0xcc80('0x6'))(_0xcc80('0x7'));var config=require('../../config/environment');var jayson=require(_0xcc80('0x8'));var client=jayson[_0xcc80('0x9')][_0xcc80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd792c,_0x3c8377,_0x21e163){return new BPromise(function(_0x3749ac,_0x15245b){return client[_0xcc80('0xb')](_0xdd792c,_0x21e163)['then'](function(_0x174248){logger[_0xcc80('0xc')](_0xcc80('0xd'),_0x3c8377,_0xcc80('0xe'));logger[_0xcc80('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x3c8377,_0xcc80('0xe'),JSON[_0xcc80('0x10')](_0x174248));if(_0x174248[_0xcc80('0x11')]){if(_0x174248[_0xcc80('0x11')][_0xcc80('0x12')]===0x1f4){logger[_0xcc80('0x11')](_0xcc80('0xd'),_0x3c8377,_0x174248[_0xcc80('0x11')][_0xcc80('0x13')]);return _0x15245b(_0x174248['error']['message']);}logger[_0xcc80('0x11')]('Condition,\x20%s,\x20%s',_0x3c8377,_0x174248[_0xcc80('0x11')][_0xcc80('0x13')]);return _0x3749ac(_0x174248[_0xcc80('0x11')][_0xcc80('0x13')]);}else{logger[_0xcc80('0xc')]('Condition,\x20%s,\x20%s',_0x3c8377,'request\x20sent');_0x3749ac(_0x174248[_0xcc80('0x14')][_0xcc80('0x13')]);}})[_0xcc80('0x15')](function(_0xd42a62){logger['error'](_0xcc80('0xd'),_0x3c8377,_0xd42a62);_0x15245b(_0xd42a62);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 4b89b7c..20d2908 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 _0x2eeb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','delete','isAuthenticated','multer','util','connect-timeout','express'];(function(_0x1ff1d7,_0x4d8540){var _0x523750=function(_0x320dde){while(--_0x320dde){_0x1ff1d7['push'](_0x1ff1d7['shift']());}};_0x523750(++_0x4d8540);}(_0x2eeb,0x80));var _0xb2ee=function(_0x459919,_0x427e1b){_0x459919=_0x459919-0x0;var _0x1953f4=_0x2eeb[_0x459919];return _0x1953f4;};'use strict';var multer=require(_0xb2ee('0x0'));var util=require(_0xb2ee('0x1'));var path=require('path');var timeout=require(_0xb2ee('0x2'));var express=require(_0xb2ee('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2ee('0x4'));var interaction=require(_0xb2ee('0x5'));var config=require(_0xb2ee('0x6'));var controller=require(_0xb2ee('0x7'));router[_0xb2ee('0x8')](_0xb2ee('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xb2ee('0xa')](_0xb2ee('0x9'),auth[_0xb2ee('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcecb=['connect-timeout','express','fs-extra','../../config/environment','put','/:id','isAuthenticated','exports','multer','util','path'];(function(_0x50cafa,_0xe33aeb){var _0x324ba5=function(_0x51d990){while(--_0x51d990){_0x50cafa['push'](_0x50cafa['shift']());}};_0x324ba5(++_0xe33aeb);}(_0xcecb,0x131));var _0xbcec=function(_0x14eba1,_0x1d1249){_0x14eba1=_0x14eba1-0x0;var _0x37de83=_0xcecb[_0x14eba1];return _0x37de83;};'use strict';var multer=require(_0xbcec('0x0'));var util=require(_0xbcec('0x1'));var path=require(_0xbcec('0x2'));var timeout=require(_0xbcec('0x3'));var express=require(_0xbcec('0x4'));var router=express['Router']();var fs_extra=require(_0xbcec('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbcec('0x6'));var controller=require('./condition.controller');router[_0xbcec('0x7')](_0xbcec('0x8'),auth[_0xbcec('0x9')](),controller['update']);router['delete'](_0xbcec('0x8'),auth[_0xbcec('0x9')](),controller['destroy']);module[_0xbcec('0xa')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 8371ab5..8146698 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 _0xd358=['INTEGER','exports','STRING','name'];(function(_0x1e7569,_0x15bd26){var _0x4a24d4=function(_0x576813){while(--_0x576813){_0x1e7569['push'](_0x1e7569['shift']());}};_0x4a24d4(++_0x15bd26);}(_0xd358,0x1b5));var _0x8d35=function(_0xa003d1,_0xfffc7b){_0xa003d1=_0xa003d1-0x0;var _0x1b39dd=_0xd358[_0xa003d1];return _0x1b39dd;};'use strict';var Sequelize=require('sequelize');module[_0x8d35('0x0')]={'name':{'type':Sequelize[_0x8d35('0x1')],'allowNull':![],'unique':_0x8d35('0x2')},'OrderBy':{'type':Sequelize[_0x8d35('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8d35('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xef0d=['STRING','sequelize','exports','name','INTEGER'];(function(_0x4e7e47,_0x55801d){var _0x3b453c=function(_0x1c817d){while(--_0x1c817d){_0x4e7e47['push'](_0x4e7e47['shift']());}};_0x3b453c(++_0x55801d);}(_0xef0d,0x6a));var _0xdef0=function(_0x2113c2,_0x24ff71){_0x2113c2=_0x2113c2-0x0;var _0x4b7579=_0xef0d[_0x2113c2];return _0x4b7579;};'use strict';var Sequelize=require(_0xdef0('0x0'));module[_0xdef0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdef0('0x2')},'OrderBy':{'type':Sequelize[_0xdef0('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xdef0('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 2ad1759..ec34073 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 _0x1a85=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','ContactItemTypes','UserProfileResource','destroy','end','error','stack','name','index','ContactItemType','rawAttributes','type','model','map','query','keys','filters','attributes','fields','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','intersection','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','body','CmContactHasItem','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x298dd7,_0x579273){var _0x995c4a=function(_0xccbb73){while(--_0xccbb73){_0x298dd7['push'](_0x298dd7['shift']());}};_0x995c4a(++_0x579273);}(_0x1a85,0x178));var _0x51a8=function(_0x843880,_0x1516d1){_0x843880=_0x843880-0x0;var _0x49943f=_0x1a85[_0x843880];return _0x49943f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){var _0x78d3d6=_0x23d26a[_0x51a8('0x24')]({'plain':!![]});var _0x18e2f3=_0x51a8('0x25');return db[_0x51a8('0x26')][_0x51a8('0x27')]({'where':{'type':_0x18e2f3,'resourceId':_0x78d3d6['id']}})[_0x51a8('0x23')](function(){return _0x23d26a;});})['then'](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x28')]();});}};}function handleEntityNotFound(_0xca5746,_0x3da187){return function(_0x1c150d){if(!_0x1c150d){_0xca5746[_0x51a8('0x17')](0x194);}return _0x1c150d;};}function handleError(_0x1a886f,_0x2742f5){_0x2742f5=_0x2742f5||0x1f4;return function(_0xec08ae){logger[_0x51a8('0x29')](_0xec08ae[_0x51a8('0x2a')]);if(_0xec08ae[_0x51a8('0x2b')]){delete _0xec08ae['name'];}_0x1a886f[_0x51a8('0x18')](_0x2742f5)['send'](_0xec08ae);};}exports[_0x51a8('0x2c')]=function(_0x3bc19a,_0x143f46){var _0x41df56={},_0x2136b4={},_0x4ea271={'count':0x0,'rows':[]};var _0x10c19b=_['map'](db[_0x51a8('0x2d')][_0x51a8('0x2e')],function(_0x253a59){return{'name':_0x253a59['fieldName'],'type':_0x253a59[_0x51a8('0x2f')]['key']};});_0x2136b4[_0x51a8('0x30')]=_[_0x51a8('0x31')](_0x10c19b,_0x51a8('0x2b'));_0x2136b4[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x3bc19a['query']);_0x2136b4[_0x51a8('0x34')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],_0x2136b4[_0x51a8('0x32')]);_0x41df56[_0x51a8('0x35')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x36')]));_0x41df56[_0x51a8('0x35')]=_0x41df56['attributes']['length']?_0x41df56['attributes']:_0x2136b4[_0x51a8('0x30')];if(!_0x3bc19a[_0x51a8('0x32')]['hasOwnProperty'](_0x51a8('0x37'))){_0x41df56['limit']=qs[_0x51a8('0x1c')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x1c')]);_0x41df56[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0x3bc19a[_0x51a8('0x32')]['offset']);}_0x41df56['order']=qs[_0x51a8('0x38')](_0x3bc19a['query']['sort']);_0x41df56['where']=qs[_0x51a8('0x34')](_[_0x51a8('0x39')](_0x3bc19a[_0x51a8('0x32')],_0x2136b4['filters']),_0x10c19b);if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]){_0x41df56[_0x51a8('0x3b')]=_[_0x51a8('0x3c')](_0x41df56['where'],{'$or':_[_0x51a8('0x31')](_0x10c19b,function(_0xe6a86a){if(_0xe6a86a[_0x51a8('0x2f')]!=='VIRTUAL'){var _0xb96200={};_0xb96200[_0xe6a86a['name']]={'$like':'%'+_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]+'%'};return _0xb96200;}})});}_0x41df56=_[_0x51a8('0x3c')]({},_0x41df56,_0x3bc19a[_0x51a8('0x3d')]);var _0x5c44a9={'where':_0x41df56[_0x51a8('0x3b')]};return db[_0x51a8('0x2d')][_0x51a8('0x1d')](_0x5c44a9)[_0x51a8('0x23')](function(_0xa33fc){_0x4ea271[_0x51a8('0x1d')]=_0xa33fc;if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x41df56[_0x51a8('0x3f')]=[{'all':!![]}];}return db['ContactItemType'][_0x51a8('0x40')](_0x41df56);})[_0x51a8('0x23')](function(_0x4c7c67){_0x4ea271['rows']=_0x4c7c67;return _0x4ea271;})[_0x51a8('0x23')](respondWithFilteredResult(_0x143f46,_0x41df56))[_0x51a8('0x41')](handleError(_0x143f46,null));};exports[_0x51a8('0x42')]=function(_0x27b8e5,_0x311574){var _0x157a51={'raw':!![],'where':{'id':_0x27b8e5[_0x51a8('0x43')]['id']}},_0x28f5b3={};_0x28f5b3[_0x51a8('0x30')]=_[_0x51a8('0x33')](db['ContactItemType'][_0x51a8('0x2e')]);_0x28f5b3[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x27b8e5[_0x51a8('0x32')]);_0x28f5b3[_0x51a8('0x34')]=_[_0x51a8('0x44')](_0x28f5b3['model'],_0x28f5b3[_0x51a8('0x32')]);_0x157a51['attributes']=_[_0x51a8('0x44')](_0x28f5b3[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x36')]));_0x157a51['attributes']=_0x157a51['attributes'][_0x51a8('0x45')]?_0x157a51[_0x51a8('0x35')]:_0x28f5b3[_0x51a8('0x30')];if(_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x157a51['include']=[{'all':!![]}];}_0x157a51=_['merge']({},_0x157a51,_0x27b8e5[_0x51a8('0x3d')]);return db[_0x51a8('0x2d')][_0x51a8('0x46')](_0x157a51)[_0x51a8('0x23')](handleEntityNotFound(_0x311574,null))[_0x51a8('0x23')](respondWithResult(_0x311574,null))[_0x51a8('0x41')](handleError(_0x311574,null));};exports[_0x51a8('0x47')]=function(_0x1103a3,_0x301578){return db['ContactItemType']['create'](_0x1103a3['body'],{})[_0x51a8('0x23')](function(_0x279cb1){var _0x103897=_0x1103a3['user'][_0x51a8('0x24')]({'plain':!![]});if(!_0x103897)throw new Error(_0x51a8('0x48'));if(_0x103897['role']===_0x51a8('0x49')){var _0x4fb93c=_0x279cb1['get']({'plain':!![]});var _0xbf828b=_0x51a8('0x25');return db[_0x51a8('0x4a')]['find']({'where':{'name':_0xbf828b,'userProfileId':_0x103897['userProfileId']},'raw':!![]})[_0x51a8('0x23')](function(_0x5b0398){if(_0x5b0398&&_0x5b0398[_0x51a8('0x4b')]===0x0){return db[_0x51a8('0x26')][_0x51a8('0x47')]({'name':_0x4fb93c[_0x51a8('0x2b')],'resourceId':_0x4fb93c['id'],'type':_0x5b0398[_0x51a8('0x2b')],'sectionId':_0x5b0398['id']},{})[_0x51a8('0x23')](function(){return _0x279cb1;});}else{return _0x279cb1;}})[_0x51a8('0x41')](function(_0x406a87){logger[_0x51a8('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x406a87);throw _0x406a87;});}return _0x279cb1;})[_0x51a8('0x23')](respondWithResult(_0x301578,0xc9))[_0x51a8('0x41')](handleError(_0x301578,null));};exports[_0x51a8('0x22')]=function(_0xd3c4,_0x533cfa){if(_0xd3c4[_0x51a8('0x4c')]['id']){delete _0xd3c4['body']['id'];}return db[_0x51a8('0x2d')][_0x51a8('0x46')]({'where':{'id':_0xd3c4['params']['id']}})['then'](handleEntityNotFound(_0x533cfa,null))[_0x51a8('0x23')](saveUpdates(_0xd3c4[_0x51a8('0x4c')],null))[_0x51a8('0x23')](respondWithResult(_0x533cfa,null))[_0x51a8('0x41')](handleError(_0x533cfa,null));};exports[_0x51a8('0x27')]=function(_0x52f60f,_0x43b79a){return db[_0x51a8('0x2d')][_0x51a8('0x46')]({'where':{'id':_0x52f60f[_0x51a8('0x43')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x43b79a,null))['then'](db[_0x51a8('0x4d')][_0x51a8('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x52f60f[_0x51a8('0x43')]['id']}}))[_0x51a8('0x23')](removeEntity(_0x43b79a,null))[_0x51a8('0x41')](handleError(_0x43b79a,null));}; \ No newline at end of file +var _0xaebd=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','ContactItemTypes','destroy','stack','name','send','map','ContactItemType','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','keys','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation'];(function(_0x4fc6d4,_0x15db90){var _0x3212cf=function(_0x3fd5ca){while(--_0x3fd5ca){_0x4fc6d4['push'](_0x4fc6d4['shift']());}};_0x3212cf(++_0x15db90);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x28192f,_0x4a619d){_0x28192f=_0x28192f-0x0;var _0x2ac42c=_0xaebd[_0x28192f];return _0x2ac42c;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];function respondWithStatusCode(_0x5aedaa,_0x4ee3cc){_0x4ee3cc=_0x4ee3cc||0xcc;return function(_0x2673db){if(_0x2673db){return _0x5aedaa[_0xdaeb('0x15')](_0x4ee3cc);}return _0x5aedaa[_0xdaeb('0x16')](_0x4ee3cc)[_0xdaeb('0x17')]();};}function respondWithResult(_0x1f31be,_0xc6c611){_0xc6c611=_0xc6c611||0xc8;return function(_0x49ba9a){if(_0x49ba9a){return _0x1f31be['status'](_0xc6c611)[_0xdaeb('0x18')](_0x49ba9a);}};}function respondWithFilteredResult(_0x306bdb,_0x34b2fe){return function(_0x18ec4e){if(_0x18ec4e){var _0x538a25=typeof _0x34b2fe['offset']===_0xdaeb('0x19')&&typeof _0x34b2fe['limit']==='undefined';var _0x42e509=_0x18ec4e[_0xdaeb('0x1a')];var _0x1b5243=_0x538a25?0x0:_0x34b2fe[_0xdaeb('0x1b')];var _0x2d8f11=_0x538a25?_0x18ec4e[_0xdaeb('0x1a')]:_0x34b2fe['offset']+_0x34b2fe[_0xdaeb('0x1c')];var _0x5ccf66;if(_0x2d8f11>=_0x42e509){_0x2d8f11=_0x42e509;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x306bdb[_0xdaeb('0x16')](_0x5ccf66);return _0x306bdb[_0xdaeb('0x1d')](_0xdaeb('0x1e'),_0x1b5243+'-'+_0x2d8f11+'/'+_0x42e509)['json'](_0x18ec4e);}return null;};}function patchUpdates(_0x4e97e0){return function(_0x13563c){try{jsonpatch[_0xdaeb('0x1f')](_0x13563c,_0x4e97e0,!![]);}catch(_0x23fccb){return BPromise[_0xdaeb('0x20')](_0x23fccb);}return _0x13563c[_0xdaeb('0x21')]();};}function saveUpdates(_0x536aae,_0x597bb7){return function(_0x2c969d){if(_0x2c969d){return _0x2c969d[_0xdaeb('0x22')](_0x536aae)[_0xdaeb('0x23')](function(_0x1d919a){return _0x1d919a;});}return null;};}function removeEntity(_0x39dfae,_0x55c825){return function(_0x254c3b){if(_0x254c3b){return _0x254c3b['destroy']()[_0xdaeb('0x23')](function(){var _0x398616=_0x254c3b[_0xdaeb('0x24')]({'plain':!![]});var _0x3b0770=_0xdaeb('0x25');return db['UserProfileResource'][_0xdaeb('0x26')]({'where':{'type':_0x3b0770,'resourceId':_0x398616['id']}})[_0xdaeb('0x23')](function(){return _0x254c3b;});})[_0xdaeb('0x23')](function(){_0x39dfae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43095f,_0x4e7f44){return function(_0x5045f8){if(!_0x5045f8){_0x43095f[_0xdaeb('0x15')](0x194);}return _0x5045f8;};}function handleError(_0x1ff9af,_0x3e2b8c){_0x3e2b8c=_0x3e2b8c||0x1f4;return function(_0x5eb7b5){logger['error'](_0x5eb7b5[_0xdaeb('0x27')]);if(_0x5eb7b5[_0xdaeb('0x28')]){delete _0x5eb7b5[_0xdaeb('0x28')];}_0x1ff9af['status'](_0x3e2b8c)[_0xdaeb('0x29')](_0x5eb7b5);};}exports['index']=function(_0x4da82d,_0x28812c){var _0x21f6cf={},_0x2fb019={},_0x28c15c={'count':0x0,'rows':[]};var _0x3276c2=_[_0xdaeb('0x2a')](db[_0xdaeb('0x2b')]['rawAttributes'],function(_0x1c1c7c){return{'name':_0x1c1c7c[_0xdaeb('0x2c')],'type':_0x1c1c7c[_0xdaeb('0x2d')][_0xdaeb('0x2e')]};});_0x2fb019[_0xdaeb('0x2f')]=_['map'](_0x3276c2,_0xdaeb('0x28'));_0x2fb019[_0xdaeb('0x30')]=_['keys'](_0x4da82d[_0xdaeb('0x30')]);_0x2fb019[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],_0x2fb019[_0xdaeb('0x30')]);_0x21f6cf[_0xdaeb('0x33')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x4da82d[_0xdaeb('0x30')]['fields']));_0x21f6cf['attributes']=_0x21f6cf[_0xdaeb('0x33')]['length']?_0x21f6cf[_0xdaeb('0x33')]:_0x2fb019[_0xdaeb('0x2f')];if(!_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x35')](_0xdaeb('0x36'))){_0x21f6cf[_0xdaeb('0x1c')]=qs['limit'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0x21f6cf[_0xdaeb('0x1b')]=qs['offset'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1b')]);}_0x21f6cf[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x38')]);_0x21f6cf[_0xdaeb('0x39')]=qs['filters'](_[_0xdaeb('0x3a')](_0x4da82d[_0xdaeb('0x30')],_0x2fb019['filters']),_0x3276c2);if(_0x4da82d['query'][_0xdaeb('0x3b')]){_0x21f6cf[_0xdaeb('0x39')]=_['merge'](_0x21f6cf[_0xdaeb('0x39')],{'$or':_[_0xdaeb('0x2a')](_0x3276c2,function(_0x5a4de2){if(_0x5a4de2[_0xdaeb('0x2d')]!==_0xdaeb('0x3c')){var _0x4ecba7={};_0x4ecba7[_0x5a4de2['name']]={'$like':'%'+_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x4ecba7;}})});}_0x21f6cf=_[_0xdaeb('0x3d')]({},_0x21f6cf,_0x4da82d[_0xdaeb('0x3e')]);var _0x2ea883={'where':_0x21f6cf[_0xdaeb('0x39')]};return db['ContactItemType'][_0xdaeb('0x1a')](_0x2ea883)['then'](function(_0x46aa44){_0x28c15c['count']=_0x46aa44;if(_0x4da82d['query'][_0xdaeb('0x3f')]){_0x21f6cf['include']=[{'all':!![]}];}return db[_0xdaeb('0x2b')]['findAll'](_0x21f6cf);})[_0xdaeb('0x23')](function(_0x244369){_0x28c15c[_0xdaeb('0x40')]=_0x244369;return _0x28c15c;})[_0xdaeb('0x23')](respondWithFilteredResult(_0x28812c,_0x21f6cf))['catch'](handleError(_0x28812c,null));};exports[_0xdaeb('0x41')]=function(_0x5a4b41,_0x3cc6a4){var _0xfb250e={'raw':!![],'where':{'id':_0x5a4b41['params']['id']}},_0x447ef0={};_0x447ef0[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x2b')][_0xdaeb('0x43')]);_0x447ef0[_0xdaeb('0x30')]=_[_0xdaeb('0x42')](_0x5a4b41[_0xdaeb('0x30')]);_0x447ef0[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x447ef0[_0xdaeb('0x2f')],_0x447ef0[_0xdaeb('0x30')]);_0xfb250e[_0xdaeb('0x33')]=_['intersection'](_0x447ef0[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x5a4b41['query']['fields']));_0xfb250e[_0xdaeb('0x33')]=_0xfb250e[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0xfb250e['attributes']:_0x447ef0[_0xdaeb('0x2f')];if(_0x5a4b41[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0xfb250e[_0xdaeb('0x45')]=[{'all':!![]}];}_0xfb250e=_[_0xdaeb('0x3d')]({},_0xfb250e,_0x5a4b41[_0xdaeb('0x3e')]);return db[_0xdaeb('0x2b')][_0xdaeb('0x46')](_0xfb250e)['then'](handleEntityNotFound(_0x3cc6a4,null))[_0xdaeb('0x23')](respondWithResult(_0x3cc6a4,null))[_0xdaeb('0x47')](handleError(_0x3cc6a4,null));};exports['create']=function(_0x38d2ee,_0x4dd70c){return db[_0xdaeb('0x2b')][_0xdaeb('0x48')](_0x38d2ee[_0xdaeb('0x49')],{})[_0xdaeb('0x23')](function(_0x5df403){var _0x449f64=_0x38d2ee[_0xdaeb('0x4a')][_0xdaeb('0x24')]({'plain':!![]});if(!_0x449f64)throw new Error(_0xdaeb('0x4b'));if(_0x449f64['role']==='user'){var _0x1403c8=_0x5df403[_0xdaeb('0x24')]({'plain':!![]});var _0x311219=_0xdaeb('0x25');return db[_0xdaeb('0x4c')][_0xdaeb('0x46')]({'where':{'name':_0x311219,'userProfileId':_0x449f64['userProfileId']},'raw':!![]})[_0xdaeb('0x23')](function(_0x42af1a){if(_0x42af1a&&_0x42af1a[_0xdaeb('0x4d')]===0x0){return db['UserProfileResource'][_0xdaeb('0x48')]({'name':_0x1403c8['name'],'resourceId':_0x1403c8['id'],'type':_0x42af1a[_0xdaeb('0x28')],'sectionId':_0x42af1a['id']},{})[_0xdaeb('0x23')](function(){return _0x5df403;});}else{return _0x5df403;}})[_0xdaeb('0x47')](function(_0x395e2c){logger[_0xdaeb('0x4e')](_0xdaeb('0x4f'),_0x395e2c);throw _0x395e2c;});}return _0x5df403;})['then'](respondWithResult(_0x4dd70c,0xc9))['catch'](handleError(_0x4dd70c,null));};exports['update']=function(_0x2260c5,_0x10287e){if(_0x2260c5['body']['id']){delete _0x2260c5['body']['id'];}return db['ContactItemType'][_0xdaeb('0x46')]({'where':{'id':_0x2260c5[_0xdaeb('0x50')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x10287e,null))[_0xdaeb('0x23')](saveUpdates(_0x2260c5[_0xdaeb('0x49')],null))['then'](respondWithResult(_0x10287e,null))[_0xdaeb('0x47')](handleError(_0x10287e,null));};exports['destroy']=function(_0x25e58f,_0x1b87b2){return db[_0xdaeb('0x2b')][_0xdaeb('0x46')]({'where':{'id':_0x25e58f[_0xdaeb('0x50')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x1b87b2,null))['then'](db['CmContactHasItem'][_0xdaeb('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x25e58f['params']['id']}}))[_0xdaeb('0x23')](removeEntity(_0x1b87b2,null))[_0xdaeb('0x47')](handleError(_0x1b87b2,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index ea6e837..e2f06bd 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 _0xccd2=['define','ContactItemType','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports'];(function(_0x4fdf43,_0x445e7e){var _0x2f0508=function(_0x517c3b){while(--_0x517c3b){_0x4fdf43['push'](_0x4fdf43['shift']());}};_0x2f0508(++_0x445e7e);}(_0xccd2,0x1e2));var _0x2ccd=function(_0x1cb2bc,_0x1e7e11){_0x1cb2bc=_0x1cb2bc-0x0;var _0x44891c=_0xccd2[_0x1cb2bc];return _0x44891c;};'use strict';var _=require(_0x2ccd('0x0'));var util=require('util');var logger=require(_0x2ccd('0x1'))(_0x2ccd('0x2'));var moment=require(_0x2ccd('0x3'));var BPromise=require('bluebird');var rp=require(_0x2ccd('0x4'));var fs=require('fs');var path=require(_0x2ccd('0x5'));var rimraf=require(_0x2ccd('0x6'));var config=require(_0x2ccd('0x7'));var attributes=require(_0x2ccd('0x8'));module[_0x2ccd('0x9')]=function(_0x537737,_0x2c5843){return _0x537737[_0x2ccd('0xa')](_0x2ccd('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08d5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x08d5,0x10c));var _0x508d=function(_0x1a868b,_0x2bdbc2){_0x1a868b=_0x1a868b-0x0;var _0x2fe828=_0x08d5[_0x1a868b];return _0x2fe828;};'use strict';var _=require(_0x508d('0x0'));var util=require(_0x508d('0x1'));var logger=require(_0x508d('0x2'))(_0x508d('0x3'));var moment=require(_0x508d('0x4'));var BPromise=require(_0x508d('0x5'));var rp=require(_0x508d('0x6'));var fs=require('fs');var path=require(_0x508d('0x7'));var rimraf=require(_0x508d('0x8'));var config=require(_0x508d('0x9'));var attributes=require(_0x508d('0xa'));module[_0x508d('0xb')]=function(_0x24bdb7,_0x4b0011){return _0x24bdb7[_0x508d('0xc')](_0x508d('0xd'),attributes,{'tableName':_0x508d('0xe'),'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 0229fc7..b23c803 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 _0x9215=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','ContactItemType,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird'];(function(_0x32023d,_0x281593){var _0xb4a7b4=function(_0x206ffc){while(--_0x206ffc){_0x32023d['push'](_0x32023d['shift']());}};_0xb4a7b4(++_0x281593);}(_0x9215,0x13f));var _0x5921=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x9215[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x5921('0x0'));var util=require(_0x5921('0x1'));var moment=require(_0x5921('0x2'));var BPromise=require(_0x5921('0x3'));var rs=require(_0x5921('0x4'));var fs=require('fs');var Redis=require(_0x5921('0x5'));var db=require(_0x5921('0x6'))['db'];var utils=require(_0x5921('0x7'));var logger=require(_0x5921('0x8'))('rpc');var config=require(_0x5921('0x9'));var jayson=require(_0x5921('0xa'));var client=jayson[_0x5921('0xb')][_0x5921('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43a3f2,_0x5bba43,_0x55d649){return new BPromise(function(_0x2a6ef2,_0x21f477){return client['request'](_0x43a3f2,_0x55d649)['then'](function(_0x46346d){logger['info'](_0x5921('0xd'),_0x5bba43,'request\x20sent');logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x5bba43,'request\x20sent',JSON[_0x5921('0xe')](_0x46346d));if(_0x46346d['error']){if(_0x46346d[_0x5921('0xf')]['code']===0x1f4){logger[_0x5921('0xf')](_0x5921('0xd'),_0x5bba43,_0x46346d[_0x5921('0xf')]['message']);return _0x21f477(_0x46346d['error'][_0x5921('0x10')]);}logger[_0x5921('0xf')](_0x5921('0xd'),_0x5bba43,_0x46346d[_0x5921('0xf')][_0x5921('0x10')]);return _0x2a6ef2(_0x46346d[_0x5921('0xf')][_0x5921('0x10')]);}else{logger[_0x5921('0x11')]('ContactItemType,\x20%s,\x20%s',_0x5bba43,'request\x20sent');_0x2a6ef2(_0x46346d['result']['message']);}})[_0x5921('0x12')](function(_0x22d669){logger[_0x5921('0xf')](_0x5921('0xd'),_0x5bba43,_0x22d669);_0x21f477(_0x22d669);});});} \ No newline at end of file +var _0x253c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ContactItemType,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment'];(function(_0xb29dbd,_0x56f9f1){var _0x3a7edc=function(_0x2ba413){while(--_0x2ba413){_0xb29dbd['push'](_0xb29dbd['shift']());}};_0x3a7edc(++_0x56f9f1);}(_0x253c,0x13f));var _0xc253=function(_0x2acd64,_0x4e8ce8){_0x2acd64=_0x2acd64-0x0;var _0x3d3fce=_0x253c[_0x2acd64];return _0x3d3fce;};'use strict';var _=require(_0xc253('0x0'));var util=require(_0xc253('0x1'));var moment=require(_0xc253('0x2'));var BPromise=require(_0xc253('0x3'));var rs=require(_0xc253('0x4'));var fs=require('fs');var Redis=require(_0xc253('0x5'));var db=require(_0xc253('0x6'))['db'];var utils=require(_0xc253('0x7'));var logger=require(_0xc253('0x8'))(_0xc253('0x9'));var config=require(_0xc253('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc253('0xb')][_0xc253('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52b88f,_0x1e84f4,_0x3c60c8){return new BPromise(function(_0x51ba94,_0x2aab04){return client[_0xc253('0xd')](_0x52b88f,_0x3c60c8)[_0xc253('0xe')](function(_0x1b207b){logger['info'](_0xc253('0xf'),_0x1e84f4,'request\x20sent');logger[_0xc253('0x10')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1e84f4,_0xc253('0x11'),JSON[_0xc253('0x12')](_0x1b207b));if(_0x1b207b['error']){if(_0x1b207b[_0xc253('0x13')][_0xc253('0x14')]===0x1f4){logger[_0xc253('0x13')](_0xc253('0xf'),_0x1e84f4,_0x1b207b[_0xc253('0x13')][_0xc253('0x15')]);return _0x2aab04(_0x1b207b[_0xc253('0x13')][_0xc253('0x15')]);}logger[_0xc253('0x13')]('ContactItemType,\x20%s,\x20%s',_0x1e84f4,_0x1b207b[_0xc253('0x13')][_0xc253('0x15')]);return _0x51ba94(_0x1b207b[_0xc253('0x13')]['message']);}else{logger['info'](_0xc253('0xf'),_0x1e84f4,_0xc253('0x11'));_0x51ba94(_0x1b207b[_0xc253('0x16')][_0xc253('0x15')]);}})['catch'](function(_0x4ca357){logger[_0xc253('0x13')](_0xc253('0xf'),_0x1e84f4,_0x4ca357);_0x2aab04(_0x4ca357);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index f2f9960..4df649f 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 _0x3614=['post','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','get','/:id','show'];(function(_0x2de0d5,_0x410b81){var _0x5a05df=function(_0x42866a){while(--_0x42866a){_0x2de0d5['push'](_0x2de0d5['shift']());}};_0x5a05df(++_0x410b81);}(_0x3614,0x8a));var _0x4361=function(_0x5479af,_0x2d23c7){_0x5479af=_0x5479af-0x0;var _0x21f670=_0x3614[_0x5479af];return _0x21f670;};'use strict';var multer=require(_0x4361('0x0'));var util=require('util');var path=require(_0x4361('0x1'));var timeout=require(_0x4361('0x2'));var express=require(_0x4361('0x3'));var router=express[_0x4361('0x4')]();var fs_extra=require(_0x4361('0x5'));var auth=require(_0x4361('0x6'));var interaction=require(_0x4361('0x7'));var config=require(_0x4361('0x8'));var controller=require(_0x4361('0x9'));router['get']('/',auth[_0x4361('0xa')](),controller['index']);router[_0x4361('0xb')](_0x4361('0xc'),auth[_0x4361('0xa')](),controller[_0x4361('0xd')]);router[_0x4361('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4361('0xf')]);router[_0x4361('0x10')](_0x4361('0xc'),auth['isAuthenticated'](),controller[_0x4361('0x11')]);module[_0x4361('0x12')]=router; \ No newline at end of file +var _0xe86b=['isAuthenticated','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','get','index','/:id'];(function(_0x3391d1,_0x33e62a){var _0x33d764=function(_0x9f2e7d){while(--_0x9f2e7d){_0x3391d1['push'](_0x3391d1['shift']());}};_0x33d764(++_0x33e62a);}(_0xe86b,0x8e));var _0xbe86=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe86b[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xbe86('0x0'));var util=require(_0xbe86('0x1'));var path=require(_0xbe86('0x2'));var timeout=require(_0xbe86('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbe86('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0xbe86('0x5')]('/',auth['isAuthenticated'](),controller[_0xbe86('0x6')]);router[_0xbe86('0x5')](_0xbe86('0x7'),auth[_0xbe86('0x8')](),controller[_0xbe86('0x9')]);router[_0xbe86('0xa')]('/',auth[_0xbe86('0x8')](),controller['create']);router['put'](_0xbe86('0x7'),auth[_0xbe86('0x8')](),controller[_0xbe86('0xb')]);router[_0xbe86('0xc')](_0xbe86('0x7'),auth['isAuthenticated'](),controller[_0xbe86('0xd')]);module[_0xbe86('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 3b93565..8443a68 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x24d91e,_0x5f0df4){var _0x34d6f6=function(_0x43c778){while(--_0x43c778){_0x24d91e['push'](_0x24d91e['shift']());}};_0x34d6f6(++_0x5f0df4);}(_0x757a,0xde));var _0xa757=function(_0x53d02c,_0xdc9ab6){_0x53d02c=_0x53d02c-0x0;var _0x36d9a2=_0x757a[_0x53d02c];return _0x36d9a2;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b934b0d..d57f27e 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 _0x2c2d=['attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','sort','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','name','send','map','Dashboard','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','total'];(function(_0x34f0d7,_0x3a8f44){var _0x32fa12=function(_0x5cd4d0){while(--_0x5cd4d0){_0x34f0d7['push'](_0x34f0d7['shift']());}};_0x32fa12(++_0x3a8f44);}(_0x2c2d,0x96));var _0xd2c2=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x2c2d[_0x20589d];return _0x422de9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2c2('0x0'));var zipdir=require(_0xd2c2('0x1'));var jsonpatch=require(_0xd2c2('0x2'));var rp=require(_0xd2c2('0x3'));var moment=require(_0xd2c2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd2c2('0x5'));var util=require(_0xd2c2('0x6'));var path=require('path');var sox=require(_0xd2c2('0x7'));var csv=require(_0xd2c2('0x8'));var ejs=require(_0xd2c2('0x9'));var fs=require('fs');var fs_extra=require(_0xd2c2('0xa'));var _=require(_0xd2c2('0xb'));var squel=require(_0xd2c2('0xc'));var crypto=require('crypto');var jsforce=require(_0xd2c2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd2c2('0xe'));var Papa=require(_0xd2c2('0xf'));var Redis=require('ioredis');var authService=require(_0xd2c2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2c2('0x11'));var logger=require(_0xd2c2('0x12'))(_0xd2c2('0x13'));var utils=require(_0xd2c2('0x14'));var config=require(_0xd2c2('0x15'));var licenseUtil=require(_0xd2c2('0x16'));var db=require(_0xd2c2('0x17'))['db'];config[_0xd2c2('0x18')]=_[_0xd2c2('0x19')](config[_0xd2c2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd2c2('0x1a'))(new Redis(config[_0xd2c2('0x18')]));require(_0xd2c2('0x1b'))['register'](socket);function respondWithStatusCode(_0x37f093,_0x1a006c){_0x1a006c=_0x1a006c||0xcc;return function(_0x5a3105){if(_0x5a3105){return _0x37f093[_0xd2c2('0x1c')](_0x1a006c);}return _0x37f093[_0xd2c2('0x1d')](_0x1a006c)[_0xd2c2('0x1e')]();};}function respondWithResult(_0x487f00,_0x4513b6){_0x4513b6=_0x4513b6||0xc8;return function(_0xa88ad7){if(_0xa88ad7){return _0x487f00['status'](_0x4513b6)[_0xd2c2('0x1f')](_0xa88ad7);}};}function respondWithFilteredResult(_0x551bcc,_0x3f4365){return function(_0x4eb810){if(_0x4eb810){var _0x395b7b=typeof _0x3f4365['offset']===_0xd2c2('0x20')&&typeof _0x3f4365[_0xd2c2('0x21')]===_0xd2c2('0x20');var _0x12f0a9=_0x4eb810[_0xd2c2('0x22')];var _0x5e260a=_0x395b7b?0x0:_0x3f4365[_0xd2c2('0x23')];var _0x3cf0ff=_0x395b7b?_0x4eb810[_0xd2c2('0x22')]:_0x3f4365[_0xd2c2('0x23')]+_0x3f4365[_0xd2c2('0x21')];var _0xf4963f;if(_0x3cf0ff>=_0x12f0a9){_0x3cf0ff=_0x12f0a9;_0xf4963f=0xc8;}else{_0xf4963f=0xce;}_0x551bcc[_0xd2c2('0x1d')](_0xf4963f);return _0x551bcc[_0xd2c2('0x24')]('Content-Range',_0x5e260a+'-'+_0x3cf0ff+'/'+_0x12f0a9)[_0xd2c2('0x1f')](_0x4eb810);}return null;};}function patchUpdates(_0x32dd81){return function(_0xd56a9a){try{jsonpatch['apply'](_0xd56a9a,_0x32dd81,!![]);}catch(_0x115cd5){return BPromise[_0xd2c2('0x25')](_0x115cd5);}return _0xd56a9a[_0xd2c2('0x26')]();};}function saveUpdates(_0x2bf921,_0x872894){return function(_0xb6b33a){if(_0xb6b33a){return _0xb6b33a['update'](_0x2bf921)[_0xd2c2('0x27')](function(_0x3681f0){return _0x3681f0;});}return null;};}function removeEntity(_0x56f2b2,_0x456684){return function(_0x406922){if(_0x406922){return _0x406922[_0xd2c2('0x28')]()['then'](function(){var _0x433691=_0x406922[_0xd2c2('0x29')]({'plain':!![]});var _0x286c96=_0xd2c2('0x2a');return db[_0xd2c2('0x2b')]['destroy']({'where':{'type':_0x286c96,'resourceId':_0x433691['id']}})[_0xd2c2('0x27')](function(){return _0x406922;});})[_0xd2c2('0x27')](function(){_0x56f2b2[_0xd2c2('0x1d')](0xcc)[_0xd2c2('0x1e')]();});}};}function handleEntityNotFound(_0xbb9437,_0x18cadb){return function(_0x179bb4){if(!_0x179bb4){_0xbb9437[_0xd2c2('0x1c')](0x194);}return _0x179bb4;};}function handleError(_0x3b0ac0,_0x50f5f1){_0x50f5f1=_0x50f5f1||0x1f4;return function(_0x420bce){logger['error'](_0x420bce['stack']);if(_0x420bce[_0xd2c2('0x2c')]){delete _0x420bce[_0xd2c2('0x2c')];}_0x3b0ac0[_0xd2c2('0x1d')](_0x50f5f1)[_0xd2c2('0x2d')](_0x420bce);};}exports['index']=function(_0x83e724,_0x159f54){var _0x517420={},_0x191881={},_0x1064eb={'count':0x0,'rows':[]};var _0x509ac4=_[_0xd2c2('0x2e')](db[_0xd2c2('0x2f')][_0xd2c2('0x30')],function(_0x12a931){return{'name':_0x12a931[_0xd2c2('0x31')],'type':_0x12a931['type'][_0xd2c2('0x32')]};});_0x191881[_0xd2c2('0x33')]=_[_0xd2c2('0x2e')](_0x509ac4,_0xd2c2('0x2c'));_0x191881[_0xd2c2('0x34')]=_[_0xd2c2('0x35')](_0x83e724[_0xd2c2('0x34')]);_0x191881[_0xd2c2('0x36')]=_[_0xd2c2('0x37')](_0x191881[_0xd2c2('0x33')],_0x191881[_0xd2c2('0x34')]);_0x517420[_0xd2c2('0x38')]=_[_0xd2c2('0x37')](_0x191881[_0xd2c2('0x33')],qs[_0xd2c2('0x39')](_0x83e724[_0xd2c2('0x34')]['fields']));_0x517420[_0xd2c2('0x38')]=_0x517420['attributes'][_0xd2c2('0x3a')]?_0x517420[_0xd2c2('0x38')]:_0x191881[_0xd2c2('0x33')];if(!_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x3b')](_0xd2c2('0x3c'))){_0x517420['limit']=qs[_0xd2c2('0x21')](_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x21')]);_0x517420[_0xd2c2('0x23')]=qs['offset'](_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x23')]);}_0x517420[_0xd2c2('0x3d')]=qs['sort'](_0x83e724[_0xd2c2('0x34')]['sort']);_0x517420[_0xd2c2('0x3e')]=qs[_0xd2c2('0x36')](_[_0xd2c2('0x3f')](_0x83e724['query'],_0x191881[_0xd2c2('0x36')]),_0x509ac4);if(_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x40')]){_0x517420[_0xd2c2('0x3e')]=_['merge'](_0x517420['where'],{'$or':_['map'](_0x509ac4,function(_0x5a8c0e){if(_0x5a8c0e[_0xd2c2('0x41')]!==_0xd2c2('0x42')){var _0x1b98c6={};_0x1b98c6[_0x5a8c0e['name']]={'$like':'%'+_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x40')]+'%'};return _0x1b98c6;}})});}_0x517420=_[_0xd2c2('0x43')]({},_0x517420,_0x83e724[_0xd2c2('0x44')]);var _0x35f566={'where':_0x517420[_0xd2c2('0x3e')]};return db['Dashboard'][_0xd2c2('0x22')](_0x35f566)[_0xd2c2('0x27')](function(_0x87837b){_0x1064eb[_0xd2c2('0x22')]=_0x87837b;if(_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x45')]){_0x517420[_0xd2c2('0x46')]=[{'all':!![]}];}return db[_0xd2c2('0x2f')][_0xd2c2('0x47')](_0x517420);})[_0xd2c2('0x27')](function(_0x28563e){_0x1064eb[_0xd2c2('0x48')]=_0x28563e;return _0x1064eb;})[_0xd2c2('0x27')](respondWithFilteredResult(_0x159f54,_0x517420))['catch'](handleError(_0x159f54,null));};exports[_0xd2c2('0x49')]=function(_0x51740b,_0x5dc1fb){var _0x394f0a={'raw':![],'where':{'id':_0x51740b[_0xd2c2('0x4a')]['id']}},_0x2e41fa={};_0x2e41fa[_0xd2c2('0x33')]=_['keys'](db[_0xd2c2('0x2f')][_0xd2c2('0x30')]);_0x2e41fa[_0xd2c2('0x34')]=_['keys'](_0x51740b[_0xd2c2('0x34')]);_0x2e41fa[_0xd2c2('0x36')]=_[_0xd2c2('0x37')](_0x2e41fa[_0xd2c2('0x33')],_0x2e41fa[_0xd2c2('0x34')]);_0x394f0a['attributes']=_[_0xd2c2('0x37')](_0x2e41fa[_0xd2c2('0x33')],qs['fields'](_0x51740b[_0xd2c2('0x34')]['fields']));_0x394f0a[_0xd2c2('0x38')]=_0x394f0a[_0xd2c2('0x38')][_0xd2c2('0x3a')]?_0x394f0a[_0xd2c2('0x38')]:_0x2e41fa['model'];if(_0x51740b[_0xd2c2('0x34')][_0xd2c2('0x45')]){_0x394f0a['include']=[{'all':!![]}];}_0x394f0a=_['merge']({},_0x394f0a,_0x51740b['options']);return db[_0xd2c2('0x2f')][_0xd2c2('0x4b')](_0x394f0a)['then'](handleEntityNotFound(_0x5dc1fb,null))[_0xd2c2('0x27')](respondWithResult(_0x5dc1fb,null))[_0xd2c2('0x4c')](handleError(_0x5dc1fb,null));};exports[_0xd2c2('0x4d')]=function(_0x5d4e83,_0x18d1c3){return db[_0xd2c2('0x2f')][_0xd2c2('0x4d')](_0x5d4e83[_0xd2c2('0x4e')],{})[_0xd2c2('0x27')](function(_0x205434){var _0x5b641d=_0x5d4e83['user']['get']({'plain':!![]});if(!_0x5b641d)throw new Error(_0xd2c2('0x4f'));if(_0x5b641d['role']===_0xd2c2('0x50')){var _0x5f3589=_0x205434['get']({'plain':!![]});var _0x309952='CustomDashboards';return db[_0xd2c2('0x51')][_0xd2c2('0x4b')]({'where':{'name':_0x309952,'userProfileId':_0x5b641d['userProfileId']},'raw':!![]})[_0xd2c2('0x27')](function(_0x2f9324){if(_0x2f9324&&_0x2f9324[_0xd2c2('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x5f3589[_0xd2c2('0x2c')],'resourceId':_0x5f3589['id'],'type':_0x2f9324['name'],'sectionId':_0x2f9324['id']},{})[_0xd2c2('0x27')](function(){return _0x205434;});}else{return _0x205434;}})[_0xd2c2('0x4c')](function(_0x1099ed){logger[_0xd2c2('0x53')](_0xd2c2('0x54'),_0x1099ed);throw _0x1099ed;});}return _0x205434;})['then'](respondWithResult(_0x18d1c3,0xc9))['catch'](handleError(_0x18d1c3,null));};exports[_0xd2c2('0x55')]=function(_0x14590c,_0x3058e3){var _0x568e05={'where':{'id':_0x14590c[_0xd2c2('0x4a')]['id']}},_0x5e74a7={};_0x5e74a7[_0xd2c2('0x33')]=_['keys'](db[_0xd2c2('0x2f')][_0xd2c2('0x30')]);_0x568e05['attributes']=_['intersection'](_0x5e74a7['model'],qs['fields'](_0x14590c[_0xd2c2('0x34')][_0xd2c2('0x39')]));_0x568e05[_0xd2c2('0x38')]=_0x568e05[_0xd2c2('0x38')][_0xd2c2('0x3a')]?_0x568e05[_0xd2c2('0x38')]:_0x5e74a7[_0xd2c2('0x33')];if(_0x14590c['query']['includeAll']){_0x568e05[_0xd2c2('0x46')]=[{'all':!![]}];}_0x568e05=_[_0xd2c2('0x43')]({},_0x568e05,_0x14590c[_0xd2c2('0x44')]);return db[_0xd2c2('0x2f')][_0xd2c2('0x4b')](_0x568e05)['then'](handleEntityNotFound(_0x3058e3,null))[_0xd2c2('0x27')](function(_0x1bda85){if(_0x1bda85){var _0x28441b=_0x1bda85[_0xd2c2('0x29')]({'plain':!![]});_0x28441b=qs[_0xd2c2('0x56')](_0x28441b,['id',_0xd2c2('0x57'),'updatedAt']);_0x14590c[_0xd2c2('0x4e')]=_[_0xd2c2('0x56')](_0x14590c[_0xd2c2('0x4e')],['id',_0xd2c2('0x57'),_0xd2c2('0x58')]);return db[_0xd2c2('0x2f')]['create'](_['merge'](_0x28441b,_0x14590c[_0xd2c2('0x4e')]),{'include':_0x14590c[_0xd2c2('0x34')][_0xd2c2('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x1b79a5){var _0x49a4fa=_0x14590c[_0xd2c2('0x50')][_0xd2c2('0x29')]({'plain':!![]});if(!_0x49a4fa)throw new Error(_0xd2c2('0x4f'));if(_0x49a4fa[_0xd2c2('0x59')]===_0xd2c2('0x50')){var _0x2ee21c=_0x1b79a5[_0xd2c2('0x29')]({'plain':!![]});var _0x3a95ef=_0xd2c2('0x2a');return db[_0xd2c2('0x51')][_0xd2c2('0x4b')]({'where':{'name':_0x3a95ef,'userProfileId':_0x49a4fa[_0xd2c2('0x5a')]},'raw':!![]})['then'](function(_0x4f689e){if(_0x4f689e&&_0x4f689e[_0xd2c2('0x52')]===0x0){return db[_0xd2c2('0x2b')][_0xd2c2('0x4d')]({'name':_0x2ee21c[_0xd2c2('0x2c')],'resourceId':_0x2ee21c['id'],'type':_0x4f689e['name'],'sectionId':_0x4f689e['id']},{})[_0xd2c2('0x27')](function(){return _0x1b79a5;});}else{return _0x1b79a5;}})[_0xd2c2('0x4c')](function(_0x47d9e9){logger[_0xd2c2('0x53')](_0xd2c2('0x54'),_0x47d9e9);throw _0x47d9e9;});}return _0x1b79a5;});}})[_0xd2c2('0x27')](respondWithResult(_0x3058e3,0xc9))[_0xd2c2('0x4c')](handleError(_0x3058e3,null));};exports['update']=function(_0x56e072,_0x4cd297){if(_0x56e072[_0xd2c2('0x4e')]['id']){delete _0x56e072[_0xd2c2('0x4e')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x56e072[_0xd2c2('0x4a')]['id']}})[_0xd2c2('0x27')](handleEntityNotFound(_0x4cd297,null))['then'](saveUpdates(_0x56e072['body'],null))[_0xd2c2('0x27')](respondWithResult(_0x4cd297,null))['catch'](handleError(_0x4cd297,null));};exports[_0xd2c2('0x28')]=function(_0x10a387,_0x34c461){return db[_0xd2c2('0x2f')]['find']({'where':{'id':_0x10a387[_0xd2c2('0x4a')]['id']}})[_0xd2c2('0x27')](handleEntityNotFound(_0x34c461,null))[_0xd2c2('0x27')](removeEntity(_0x34c461,null))[_0xd2c2('0x4c')](handleError(_0x34c461,null));};function widgetAttributes(_0x110517){try{switch(_0x110517[_0xd2c2('0x41')]){case _0xd2c2('0x5b'):return[{'name':_0xd2c2('0x5c'),'value':_0x110517[_0xd2c2('0x5c')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517[_0xd2c2('0x5d')][0x0][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x5f')}];case _0xd2c2('0x60'):return[{'name':_0xd2c2('0x61'),'value':_0x110517[_0xd2c2('0x61')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517[_0xd2c2('0x5d')][0x0][_0xd2c2('0x5e')]:undefined)||''}];case _0xd2c2('0x62'):return[{'name':_0xd2c2('0x63'),'value':_0x110517[_0xd2c2('0x63')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517[_0xd2c2('0x5d')][0x0][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x64')},{'name':'attrTimezone','value':_0x110517['attrTimezone']||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x1]?_0x110517['attrs'][0x1][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x65')},{'name':_0xd2c2('0x66'),'value':_0x110517[_0xd2c2('0x66')]||(_0x110517['attrs']&&_0x110517[_0xd2c2('0x5d')][0x2]?_0x110517['attrs'][0x2][_0xd2c2('0x5e')]:undefined)||0xc}];case _0xd2c2('0x67'):return[{'name':_0xd2c2('0x68'),'value':_0x110517[_0xd2c2('0x68')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517['attrs'][0x0][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x69')},{'name':_0xd2c2('0x6a'),'value':_0x110517[_0xd2c2('0x6a')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x1]?_0x110517[_0xd2c2('0x5d')][0x1][_0xd2c2('0x5e')]:undefined)||[]},{'name':_0xd2c2('0x66'),'value':_0x110517[_0xd2c2('0x66')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x2]?_0x110517[_0xd2c2('0x5d')][0x2]['value']:undefined)||0x14},{'name':_0xd2c2('0x6b'),'value':_0x110517[_0xd2c2('0x6b')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x3]?_0x110517[_0xd2c2('0x5d')][0x3][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x6c')},{'name':_0xd2c2('0x6d'),'value':_0x110517[_0xd2c2('0x6d')]||(_0x110517['attrs']&&_0x110517[_0xd2c2('0x5d')][0x4]?_0x110517[_0xd2c2('0x5d')][0x4][_0xd2c2('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x110517[_0xd2c2('0x6e')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x5]?_0x110517['attrs'][0x5][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x6f'),'value':_0x110517[_0xd2c2('0x6f')]||(_0x110517['attrs']&&_0x110517[_0xd2c2('0x5d')][0x6]?_0x110517[_0xd2c2('0x5d')][0x6][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x70'),'value':_0x110517[_0xd2c2('0x70')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x7]?_0x110517[_0xd2c2('0x5d')][0x7][_0xd2c2('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x110517['attrWhatsappAccounts']||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x8]?_0x110517['attrs'][0x8][_0xd2c2('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x110517[_0xd2c2('0x71')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x9]?_0x110517[_0xd2c2('0x5d')][0x9][_0xd2c2('0x5e')]:undefined)||''}];case _0xd2c2('0x72'):case _0xd2c2('0x73'):return[{'name':_0xd2c2('0x74'),'value':_0x110517['attrSerie1']||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517['attrs'][0x0][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x69')},{'name':_0xd2c2('0x75'),'value':_0x110517[_0xd2c2('0x75')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x1]?_0x110517[_0xd2c2('0x5d')][0x1]['value']:undefined)||null},{'name':_0xd2c2('0x76'),'value':_0x110517[_0xd2c2('0x76')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x2]?_0x110517[_0xd2c2('0x5d')][0x2][_0xd2c2('0x5e')]:undefined)||null},{'name':_0xd2c2('0x6a'),'value':_0x110517['attrVoiceQueues']||(_0x110517['attrs']&&_0x110517[_0xd2c2('0x5d')][0x3]?_0x110517[_0xd2c2('0x5d')][0x3][_0xd2c2('0x5e')]:undefined)||[]},{'name':_0xd2c2('0x6b'),'value':_0x110517[_0xd2c2('0x6b')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x4]?_0x110517[_0xd2c2('0x5d')][0x4][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x6c')},{'name':'attrEmailAccounts','value':_0x110517[_0xd2c2('0x6d')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x5]?_0x110517[_0xd2c2('0x5d')][0x5][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x6e'),'value':_0x110517[_0xd2c2('0x6e')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x6]?_0x110517[_0xd2c2('0x5d')][0x6][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x6f'),'value':_0x110517[_0xd2c2('0x6f')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x7]?_0x110517['attrs'][0x7][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x70'),'value':_0x110517[_0xd2c2('0x70')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x8]?_0x110517['attrs'][0x8][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x77'),'value':_0x110517[_0xd2c2('0x77')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x9]?_0x110517[_0xd2c2('0x5d')][0x9][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x71'),'value':_0x110517[_0xd2c2('0x71')]||(_0x110517['attrs']&&_0x110517[_0xd2c2('0x5d')][0xa]?_0x110517[_0xd2c2('0x5d')][0xa][_0xd2c2('0x5e')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x110517['reportType']||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517[_0xd2c2('0x5d')][0x0][_0xd2c2('0x41')]:undefined)||null,'value':_0x110517['attrReport']||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517[_0xd2c2('0x5d')][0x0][_0xd2c2('0x5e')]:undefined)||null},{'name':_0xd2c2('0x78'),'value':_0x110517[_0xd2c2('0x78')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x1]?_0x110517[_0xd2c2('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x367bd8){logger['error'](_0xd2c2('0x79'),JSON[_0xd2c2('0x7a')](_0x367bd8));return[];}}exports[_0xd2c2('0x7b')]=function(_0x33661c,_0x2a3569,_0x2f10ea){if(_0x33661c['body']['id']){delete _0x33661c['body']['id'];}return db[_0xd2c2('0x2f')][_0xd2c2('0x4b')]({'where':{'id':_0x33661c[_0xd2c2('0x4a')]['id']}})[_0xd2c2('0x27')](handleEntityNotFound(_0x2a3569,null))['then'](function(_0x526492){if(_0x526492){_0x33661c[_0xd2c2('0x4e')]['DashboardId']=_0x526492['id'];_0x33661c[_0xd2c2('0x4e')]['attrs']=widgetAttributes(_0x33661c['body']);return db[_0xd2c2('0x7c')][_0xd2c2('0x4d')](_0x33661c['body']);}})[_0xd2c2('0x27')](respondWithResult(_0x2a3569,null))[_0xd2c2('0x4c')](handleError(_0x2a3569,null));};exports[_0xd2c2('0x7d')]=function(_0x59b659,_0x170e87,_0x4b3ce1){var _0xe3041f={};var _0x1f6f7d={};var _0x6d0179;var _0x3967d1;return db['Dashboard'][_0xd2c2('0x7e')]({'where':{'id':_0x59b659[_0xd2c2('0x4a')]['id']}})[_0xd2c2('0x27')](handleEntityNotFound(_0x170e87,null))['then'](function(_0x517aa4){if(_0x517aa4){_0x6d0179=_0x517aa4;_0x1f6f7d[_0xd2c2('0x33')]=_[_0xd2c2('0x35')](db[_0xd2c2('0x7c')][_0xd2c2('0x30')]);_0x1f6f7d[_0xd2c2('0x34')]=_[_0xd2c2('0x35')](_0x59b659['query']);_0x1f6f7d[_0xd2c2('0x36')]=_[_0xd2c2('0x37')](_0x1f6f7d[_0xd2c2('0x33')],_0x1f6f7d[_0xd2c2('0x34')]);_0xe3041f[_0xd2c2('0x38')]=_[_0xd2c2('0x37')](_0x1f6f7d[_0xd2c2('0x33')],qs[_0xd2c2('0x39')](_0x59b659[_0xd2c2('0x34')][_0xd2c2('0x39')]));_0xe3041f[_0xd2c2('0x38')]=_0xe3041f['attributes'][_0xd2c2('0x3a')]?_0xe3041f[_0xd2c2('0x38')]:_0x1f6f7d[_0xd2c2('0x33')];_0xe3041f[_0xd2c2('0x3d')]=qs[_0xd2c2('0x7f')](_0x59b659[_0xd2c2('0x34')][_0xd2c2('0x7f')]);_0xe3041f[_0xd2c2('0x3e')]=qs[_0xd2c2('0x36')](_['pick'](_0x59b659['query'],_0x1f6f7d[_0xd2c2('0x36')]));if(_0x59b659['query'][_0xd2c2('0x40')]){_0xe3041f[_0xd2c2('0x3e')]=_[_0xd2c2('0x43')](_0xe3041f[_0xd2c2('0x3e')],{'$or':_['map'](_0xe3041f[_0xd2c2('0x38')],function(_0x51a377){var _0x3fad1d={};_0x3fad1d[_0x51a377]={'$like':'%'+_0x59b659[_0xd2c2('0x34')]['filter']+'%'};return _0x3fad1d;})});}_0xe3041f=_['merge']({},_0xe3041f,_0x59b659['options']);return _0x6d0179[_0xd2c2('0x7d')](_0xe3041f);}})['then'](function(_0x6bf5d8){if(_0x6bf5d8){_0x3967d1=_0x6bf5d8[_0xd2c2('0x3a')];if(!_0x59b659[_0xd2c2('0x34')]['hasOwnProperty']('nolimit')){_0xe3041f[_0xd2c2('0x21')]=qs[_0xd2c2('0x21')](_0x59b659[_0xd2c2('0x34')][_0xd2c2('0x21')]);_0xe3041f['offset']=qs[_0xd2c2('0x23')](_0x59b659[_0xd2c2('0x34')][_0xd2c2('0x23')]);}return _0x6d0179[_0xd2c2('0x7d')](_0xe3041f);}})[_0xd2c2('0x27')](function(_0x1a28f5){if(_0x1a28f5){return _0x1a28f5?{'count':_0x3967d1,'rows':_0x1a28f5}:null;}})[_0xd2c2('0x27')](respondWithResult(_0x170e87,null))['catch'](handleError(_0x170e87,null));}; \ No newline at end of file +var _0x2533=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','role','destroy','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie3','attrOpenchannelAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','findOne','pick','getItems','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x2493a8,_0x5a240d){var _0x2b06c9=function(_0x198d3c){while(--_0x198d3c){_0x2493a8['push'](_0x2493a8['shift']());}};_0x2b06c9(++_0x5a240d);}(_0x2533,0xf9));var _0x3253=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x2533[_0x54de5d];return _0x1b349e;};'use strict';var emlformat=require(_0x3253('0x0'));var rimraf=require(_0x3253('0x1'));var zipdir=require(_0x3253('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3253('0x3'));var moment=require(_0x3253('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3253('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x3253('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3253('0x7'));var _=require(_0x3253('0x8'));var squel=require(_0x3253('0x9'));var crypto=require(_0x3253('0xa'));var jsforce=require(_0x3253('0xb'));var deskjs=require(_0x3253('0xc'));var toCsv=require(_0x3253('0x6'));var querystring=require(_0x3253('0xd'));var Papa=require(_0x3253('0xe'));var Redis=require('ioredis');var authService=require(_0x3253('0xf'));var qs=require(_0x3253('0x10'));var as=require(_0x3253('0x11'));var hardwareService=require(_0x3253('0x12'));var logger=require(_0x3253('0x13'))(_0x3253('0x14'));var utils=require(_0x3253('0x15'));var config=require(_0x3253('0x16'));var licenseUtil=require(_0x3253('0x17'));var db=require('../../mysqldb')['db'];config[_0x3253('0x18')]=_[_0x3253('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3253('0x1a'))(new Redis(config['redis']));require(_0x3253('0x1b'))['register'](socket);function respondWithStatusCode(_0x4ef5ce,_0x450ae0){_0x450ae0=_0x450ae0||0xcc;return function(_0x2fcfb0){if(_0x2fcfb0){return _0x4ef5ce[_0x3253('0x1c')](_0x450ae0);}return _0x4ef5ce[_0x3253('0x1d')](_0x450ae0)[_0x3253('0x1e')]();};}function respondWithResult(_0x308337,_0x4d4826){_0x4d4826=_0x4d4826||0xc8;return function(_0xa1271e){if(_0xa1271e){return _0x308337[_0x3253('0x1d')](_0x4d4826)[_0x3253('0x1f')](_0xa1271e);}};}function respondWithFilteredResult(_0x5ecef0,_0x1b65ed){return function(_0x293d23){if(_0x293d23){var _0x3b2618=typeof _0x1b65ed[_0x3253('0x20')]===_0x3253('0x21')&&typeof _0x1b65ed[_0x3253('0x22')]===_0x3253('0x21');var _0x33f88b=_0x293d23[_0x3253('0x23')];var _0x68d6e1=_0x3b2618?0x0:_0x1b65ed[_0x3253('0x20')];var _0x21351f=_0x3b2618?_0x293d23['count']:_0x1b65ed[_0x3253('0x20')]+_0x1b65ed['limit'];var _0x1f27f6;if(_0x21351f>=_0x33f88b){_0x21351f=_0x33f88b;_0x1f27f6=0xc8;}else{_0x1f27f6=0xce;}_0x5ecef0[_0x3253('0x1d')](_0x1f27f6);return _0x5ecef0[_0x3253('0x24')](_0x3253('0x25'),_0x68d6e1+'-'+_0x21351f+'/'+_0x33f88b)[_0x3253('0x1f')](_0x293d23);}return null;};}function patchUpdates(_0x1a0fa8){return function(_0xd08f6d){try{jsonpatch[_0x3253('0x26')](_0xd08f6d,_0x1a0fa8,!![]);}catch(_0x52a157){return BPromise[_0x3253('0x27')](_0x52a157);}return _0xd08f6d[_0x3253('0x28')]();};}function saveUpdates(_0x13cb37,_0x409536){return function(_0x15a586){if(_0x15a586){return _0x15a586[_0x3253('0x29')](_0x13cb37)[_0x3253('0x2a')](function(_0x16cd11){return _0x16cd11;});}return null;};}function removeEntity(_0x3c568e,_0x499d75){return function(_0x5d73a1){if(_0x5d73a1){return _0x5d73a1['destroy']()[_0x3253('0x2a')](function(){var _0x36eb60=_0x5d73a1[_0x3253('0x2b')]({'plain':!![]});var _0x4c9571='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x4c9571,'resourceId':_0x36eb60['id']}})[_0x3253('0x2a')](function(){return _0x5d73a1;});})['then'](function(){_0x3c568e[_0x3253('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14f6c4,_0x31a1ef){return function(_0x1efd4b){if(!_0x1efd4b){_0x14f6c4[_0x3253('0x1c')](0x194);}return _0x1efd4b;};}function handleError(_0x16fb24,_0x502550){_0x502550=_0x502550||0x1f4;return function(_0x332269){logger['error'](_0x332269[_0x3253('0x2c')]);if(_0x332269[_0x3253('0x2d')]){delete _0x332269[_0x3253('0x2d')];}_0x16fb24[_0x3253('0x1d')](_0x502550)[_0x3253('0x2e')](_0x332269);};}exports[_0x3253('0x2f')]=function(_0x8d645b,_0x28efc8){var _0x230ffc={},_0x277ba3={},_0x8ac132={'count':0x0,'rows':[]};var _0x5f4a8f=_[_0x3253('0x30')](db[_0x3253('0x31')][_0x3253('0x32')],function(_0x365d58){return{'name':_0x365d58[_0x3253('0x33')],'type':_0x365d58[_0x3253('0x34')][_0x3253('0x35')]};});_0x277ba3[_0x3253('0x36')]=_[_0x3253('0x30')](_0x5f4a8f,_0x3253('0x2d'));_0x277ba3['query']=_[_0x3253('0x37')](_0x8d645b['query']);_0x277ba3[_0x3253('0x38')]=_[_0x3253('0x39')](_0x277ba3[_0x3253('0x36')],_0x277ba3[_0x3253('0x3a')]);_0x230ffc[_0x3253('0x3b')]=_['intersection'](_0x277ba3[_0x3253('0x36')],qs[_0x3253('0x3c')](_0x8d645b[_0x3253('0x3a')][_0x3253('0x3c')]));_0x230ffc[_0x3253('0x3b')]=_0x230ffc[_0x3253('0x3b')][_0x3253('0x3d')]?_0x230ffc[_0x3253('0x3b')]:_0x277ba3[_0x3253('0x36')];if(!_0x8d645b[_0x3253('0x3a')][_0x3253('0x3e')]('nolimit')){_0x230ffc[_0x3253('0x22')]=qs['limit'](_0x8d645b[_0x3253('0x3a')][_0x3253('0x22')]);_0x230ffc['offset']=qs[_0x3253('0x20')](_0x8d645b[_0x3253('0x3a')]['offset']);}_0x230ffc[_0x3253('0x3f')]=qs['sort'](_0x8d645b[_0x3253('0x3a')][_0x3253('0x40')]);_0x230ffc[_0x3253('0x41')]=qs[_0x3253('0x38')](_['pick'](_0x8d645b[_0x3253('0x3a')],_0x277ba3[_0x3253('0x38')]),_0x5f4a8f);if(_0x8d645b['query']['filter']){_0x230ffc[_0x3253('0x41')]=_[_0x3253('0x42')](_0x230ffc[_0x3253('0x41')],{'$or':_['map'](_0x5f4a8f,function(_0x478876){if(_0x478876['type']!==_0x3253('0x43')){var _0x4a3705={};_0x4a3705[_0x478876['name']]={'$like':'%'+_0x8d645b[_0x3253('0x3a')][_0x3253('0x44')]+'%'};return _0x4a3705;}})});}_0x230ffc=_['merge']({},_0x230ffc,_0x8d645b[_0x3253('0x45')]);var _0x3ad6e6={'where':_0x230ffc['where']};return db[_0x3253('0x31')][_0x3253('0x23')](_0x3ad6e6)[_0x3253('0x2a')](function(_0x31fed8){_0x8ac132[_0x3253('0x23')]=_0x31fed8;if(_0x8d645b[_0x3253('0x3a')]['includeAll']){_0x230ffc[_0x3253('0x46')]=[{'all':!![]}];}return db[_0x3253('0x31')][_0x3253('0x47')](_0x230ffc);})['then'](function(_0x2c563e){_0x8ac132[_0x3253('0x48')]=_0x2c563e;return _0x8ac132;})['then'](respondWithFilteredResult(_0x28efc8,_0x230ffc))[_0x3253('0x49')](handleError(_0x28efc8,null));};exports[_0x3253('0x4a')]=function(_0x18e14f,_0x3d6b0d){var _0xb4fdf6={'raw':![],'where':{'id':_0x18e14f[_0x3253('0x4b')]['id']}},_0x34da0b={};_0x34da0b['model']=_['keys'](db[_0x3253('0x31')][_0x3253('0x32')]);_0x34da0b[_0x3253('0x3a')]=_[_0x3253('0x37')](_0x18e14f[_0x3253('0x3a')]);_0x34da0b[_0x3253('0x38')]=_[_0x3253('0x39')](_0x34da0b[_0x3253('0x36')],_0x34da0b[_0x3253('0x3a')]);_0xb4fdf6[_0x3253('0x3b')]=_['intersection'](_0x34da0b[_0x3253('0x36')],qs[_0x3253('0x3c')](_0x18e14f[_0x3253('0x3a')][_0x3253('0x3c')]));_0xb4fdf6[_0x3253('0x3b')]=_0xb4fdf6[_0x3253('0x3b')]['length']?_0xb4fdf6['attributes']:_0x34da0b[_0x3253('0x36')];if(_0x18e14f[_0x3253('0x3a')][_0x3253('0x4c')]){_0xb4fdf6[_0x3253('0x46')]=[{'all':!![]}];}_0xb4fdf6=_[_0x3253('0x42')]({},_0xb4fdf6,_0x18e14f[_0x3253('0x45')]);return db['Dashboard']['find'](_0xb4fdf6)[_0x3253('0x2a')](handleEntityNotFound(_0x3d6b0d,null))[_0x3253('0x2a')](respondWithResult(_0x3d6b0d,null))[_0x3253('0x49')](handleError(_0x3d6b0d,null));};exports[_0x3253('0x4d')]=function(_0x1f369a,_0x523cb7){return db[_0x3253('0x31')][_0x3253('0x4d')](_0x1f369a[_0x3253('0x4e')],{})[_0x3253('0x2a')](function(_0x4aad8e){var _0x3b85fe=_0x1f369a[_0x3253('0x4f')][_0x3253('0x2b')]({'plain':!![]});if(!_0x3b85fe)throw new Error(_0x3253('0x50'));if(_0x3b85fe['role']==='user'){var _0x302b64=_0x4aad8e[_0x3253('0x2b')]({'plain':!![]});var _0x40ac3d=_0x3253('0x51');return db['UserProfileSection'][_0x3253('0x52')]({'where':{'name':_0x40ac3d,'userProfileId':_0x3b85fe[_0x3253('0x53')]},'raw':!![]})['then'](function(_0x40b40d){if(_0x40b40d&&_0x40b40d[_0x3253('0x54')]===0x0){return db[_0x3253('0x55')][_0x3253('0x4d')]({'name':_0x302b64[_0x3253('0x2d')],'resourceId':_0x302b64['id'],'type':_0x40b40d[_0x3253('0x2d')],'sectionId':_0x40b40d['id']},{})['then'](function(){return _0x4aad8e;});}else{return _0x4aad8e;}})[_0x3253('0x49')](function(_0x3b7f1d){logger[_0x3253('0x56')](_0x3253('0x57'),_0x3b7f1d);throw _0x3b7f1d;});}return _0x4aad8e;})['then'](respondWithResult(_0x523cb7,0xc9))[_0x3253('0x49')](handleError(_0x523cb7,null));};exports[_0x3253('0x58')]=function(_0x179953,_0x2eac95){var _0x9a09d7={'where':{'id':_0x179953['params']['id']}},_0x406f87={};_0x406f87[_0x3253('0x36')]=_[_0x3253('0x37')](db[_0x3253('0x31')][_0x3253('0x32')]);_0x9a09d7[_0x3253('0x3b')]=_['intersection'](_0x406f87[_0x3253('0x36')],qs[_0x3253('0x3c')](_0x179953[_0x3253('0x3a')][_0x3253('0x3c')]));_0x9a09d7[_0x3253('0x3b')]=_0x9a09d7[_0x3253('0x3b')][_0x3253('0x3d')]?_0x9a09d7[_0x3253('0x3b')]:_0x406f87[_0x3253('0x36')];if(_0x179953[_0x3253('0x3a')][_0x3253('0x4c')]){_0x9a09d7['include']=[{'all':!![]}];}_0x9a09d7=_[_0x3253('0x42')]({},_0x9a09d7,_0x179953[_0x3253('0x45')]);return db[_0x3253('0x31')]['find'](_0x9a09d7)[_0x3253('0x2a')](handleEntityNotFound(_0x2eac95,null))[_0x3253('0x2a')](function(_0x24600e){if(_0x24600e){var _0x1cf66b=_0x24600e[_0x3253('0x2b')]({'plain':!![]});_0x1cf66b=qs[_0x3253('0x59')](_0x1cf66b,['id','createdAt',_0x3253('0x5a')]);_0x179953['body']=_['omit'](_0x179953[_0x3253('0x4e')],['id',_0x3253('0x5b'),_0x3253('0x5a')]);return db[_0x3253('0x31')][_0x3253('0x4d')](_[_0x3253('0x42')](_0x1cf66b,_0x179953['body']),{'include':_0x179953[_0x3253('0x3a')][_0x3253('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x429803){var _0x32643c=_0x179953[_0x3253('0x4f')][_0x3253('0x2b')]({'plain':!![]});if(!_0x32643c)throw new Error(_0x3253('0x50'));if(_0x32643c[_0x3253('0x5c')]==='user'){var _0x4e23f0=_0x429803[_0x3253('0x2b')]({'plain':!![]});var _0x365c02=_0x3253('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x365c02,'userProfileId':_0x32643c[_0x3253('0x53')]},'raw':!![]})['then'](function(_0x3b3698){if(_0x3b3698&&_0x3b3698[_0x3253('0x54')]===0x0){return db[_0x3253('0x55')][_0x3253('0x4d')]({'name':_0x4e23f0[_0x3253('0x2d')],'resourceId':_0x4e23f0['id'],'type':_0x3b3698[_0x3253('0x2d')],'sectionId':_0x3b3698['id']},{})[_0x3253('0x2a')](function(){return _0x429803;});}else{return _0x429803;}})[_0x3253('0x49')](function(_0x1697e8){logger[_0x3253('0x56')](_0x3253('0x57'),_0x1697e8);throw _0x1697e8;});}return _0x429803;});}})[_0x3253('0x2a')](respondWithResult(_0x2eac95,0xc9))['catch'](handleError(_0x2eac95,null));};exports[_0x3253('0x29')]=function(_0x4a41b3,_0x3b244d){if(_0x4a41b3['body']['id']){delete _0x4a41b3[_0x3253('0x4e')]['id'];}return db['Dashboard'][_0x3253('0x52')]({'where':{'id':_0x4a41b3[_0x3253('0x4b')]['id']}})[_0x3253('0x2a')](handleEntityNotFound(_0x3b244d,null))[_0x3253('0x2a')](saveUpdates(_0x4a41b3['body'],null))['then'](respondWithResult(_0x3b244d,null))[_0x3253('0x49')](handleError(_0x3b244d,null));};exports[_0x3253('0x5d')]=function(_0x370c1a,_0xcb3eab){return db[_0x3253('0x31')]['find']({'where':{'id':_0x370c1a[_0x3253('0x4b')]['id']}})[_0x3253('0x2a')](handleEntityNotFound(_0xcb3eab,null))[_0x3253('0x2a')](removeEntity(_0xcb3eab,null))[_0x3253('0x49')](handleError(_0xcb3eab,null));};function widgetAttributes(_0x3a5500){try{switch(_0x3a5500[_0x3253('0x34')]){case'iframe':return[{'name':'attrUrl','value':_0x3a5500[_0x3253('0x5e')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500['attrs'][0x0][_0x3253('0x60')]:undefined)||_0x3253('0x61')}];case _0x3253('0x62'):return[{'name':_0x3253('0x63'),'value':_0x3a5500[_0x3253('0x63')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500[_0x3253('0x5f')][0x0][_0x3253('0x60')]:undefined)||''}];case _0x3253('0x64'):return[{'name':_0x3253('0x65'),'value':_0x3a5500[_0x3253('0x65')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500['attrs'][0x0]?_0x3a5500[_0x3253('0x5f')][0x0]['value']:undefined)||_0x3253('0x66')},{'name':_0x3253('0x67'),'value':_0x3a5500['attrTimezone']||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x1]?_0x3a5500[_0x3253('0x5f')][0x1][_0x3253('0x60')]:undefined)||_0x3253('0x68')},{'name':_0x3253('0x69'),'value':_0x3a5500['attrFontSize']||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x2]?_0x3a5500['attrs'][0x2][_0x3253('0x60')]:undefined)||0xc}];case _0x3253('0x6a'):return[{'name':_0x3253('0x6b'),'value':_0x3a5500[_0x3253('0x6b')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500[_0x3253('0x5f')][0x0][_0x3253('0x60')]:undefined)||'total'},{'name':_0x3253('0x6c'),'value':_0x3a5500[_0x3253('0x6c')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x1]?_0x3a5500[_0x3253('0x5f')][0x1][_0x3253('0x60')]:undefined)||[]},{'name':_0x3253('0x69'),'value':_0x3a5500[_0x3253('0x69')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x2]?_0x3a5500['attrs'][0x2][_0x3253('0x60')]:undefined)||0x14},{'name':_0x3253('0x6d'),'value':_0x3a5500['attrChannel']||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x3]?_0x3a5500[_0x3253('0x5f')][0x3][_0x3253('0x60')]:undefined)||_0x3253('0x6e')},{'name':_0x3253('0x6f'),'value':_0x3a5500['attrEmailAccounts']||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x4]?_0x3a5500[_0x3253('0x5f')][0x4][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x70'),'value':_0x3a5500['attrFaxAccounts']||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x5]?_0x3a5500['attrs'][0x5][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x71'),'value':_0x3a5500[_0x3253('0x71')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500['attrs'][0x6]?_0x3a5500[_0x3253('0x5f')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3a5500['attrOpenchannelAccounts']||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x7]?_0x3a5500[_0x3253('0x5f')][0x7][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x72'),'value':_0x3a5500[_0x3253('0x72')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500['attrs'][0x8]?_0x3a5500[_0x3253('0x5f')][0x8][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x73'),'value':_0x3a5500[_0x3253('0x73')]||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x9]?_0x3a5500['attrs'][0x9][_0x3253('0x60')]:undefined)||''}];case _0x3253('0x74'):case _0x3253('0x75'):return[{'name':'attrSerie1','value':_0x3a5500[_0x3253('0x76')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500[_0x3253('0x5f')][0x0][_0x3253('0x60')]:undefined)||_0x3253('0x77')},{'name':'attrSerie2','value':_0x3a5500['attrSerie2']||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x1]?_0x3a5500[_0x3253('0x5f')][0x1]['value']:undefined)||null},{'name':_0x3253('0x78'),'value':_0x3a5500[_0x3253('0x78')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x2]?_0x3a5500[_0x3253('0x5f')][0x2]['value']:undefined)||null},{'name':_0x3253('0x6c'),'value':_0x3a5500[_0x3253('0x6c')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x3]?_0x3a5500[_0x3253('0x5f')][0x3][_0x3253('0x60')]:undefined)||[]},{'name':_0x3253('0x6d'),'value':_0x3a5500[_0x3253('0x6d')]||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x4]?_0x3a5500[_0x3253('0x5f')][0x4][_0x3253('0x60')]:undefined)||_0x3253('0x6e')},{'name':_0x3253('0x6f'),'value':_0x3a5500[_0x3253('0x6f')]||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x5]?_0x3a5500['attrs'][0x5][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x70'),'value':_0x3a5500[_0x3253('0x70')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x6]?_0x3a5500['attrs'][0x6][_0x3253('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3a5500[_0x3253('0x71')]||(_0x3a5500['attrs']&&_0x3a5500['attrs'][0x7]?_0x3a5500['attrs'][0x7][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x79'),'value':_0x3a5500[_0x3253('0x79')]||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x8]?_0x3a5500[_0x3253('0x5f')][0x8][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x72'),'value':_0x3a5500[_0x3253('0x72')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x9]?_0x3a5500['attrs'][0x9][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x73'),'value':_0x3a5500[_0x3253('0x73')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0xa]?_0x3a5500[_0x3253('0x5f')][0xa]['value']:undefined)||''}];case _0x3253('0x7a'):return[{'name':'attrReport','type':_0x3a5500[_0x3253('0x7b')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500[_0x3253('0x5f')][0x0][_0x3253('0x34')]:undefined)||null,'value':_0x3a5500[_0x3253('0x7c')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500['attrs'][0x0][_0x3253('0x60')]:undefined)||null},{'name':_0x3253('0x7d'),'value':_0x3a5500[_0x3253('0x7d')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x1]?_0x3a5500['attrs'][0x1][_0x3253('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x1c2fb7){logger[_0x3253('0x56')](_0x3253('0x7e'),JSON['stringify'](_0x1c2fb7));return[];}}exports[_0x3253('0x7f')]=function(_0x2df873,_0x14888e,_0x2d9910){if(_0x2df873[_0x3253('0x4e')]['id']){delete _0x2df873[_0x3253('0x4e')]['id'];}return db[_0x3253('0x31')][_0x3253('0x52')]({'where':{'id':_0x2df873[_0x3253('0x4b')]['id']}})['then'](handleEntityNotFound(_0x14888e,null))[_0x3253('0x2a')](function(_0x4bd708){if(_0x4bd708){_0x2df873['body'][_0x3253('0x80')]=_0x4bd708['id'];_0x2df873[_0x3253('0x4e')]['attrs']=widgetAttributes(_0x2df873[_0x3253('0x4e')]);return db[_0x3253('0x81')]['create'](_0x2df873[_0x3253('0x4e')]);}})['then'](respondWithResult(_0x14888e,null))[_0x3253('0x49')](handleError(_0x14888e,null));};exports['getItems']=function(_0xb858e8,_0x439fab,_0x308a2f){var _0x1c0494={};var _0x4a9dd4={};var _0xfa6094;var _0x3e3fd6;return db[_0x3253('0x31')][_0x3253('0x82')]({'where':{'id':_0xb858e8['params']['id']}})['then'](handleEntityNotFound(_0x439fab,null))[_0x3253('0x2a')](function(_0x127ff3){if(_0x127ff3){_0xfa6094=_0x127ff3;_0x4a9dd4['model']=_[_0x3253('0x37')](db[_0x3253('0x81')][_0x3253('0x32')]);_0x4a9dd4[_0x3253('0x3a')]=_[_0x3253('0x37')](_0xb858e8[_0x3253('0x3a')]);_0x4a9dd4['filters']=_['intersection'](_0x4a9dd4[_0x3253('0x36')],_0x4a9dd4['query']);_0x1c0494[_0x3253('0x3b')]=_[_0x3253('0x39')](_0x4a9dd4[_0x3253('0x36')],qs[_0x3253('0x3c')](_0xb858e8[_0x3253('0x3a')][_0x3253('0x3c')]));_0x1c0494[_0x3253('0x3b')]=_0x1c0494[_0x3253('0x3b')][_0x3253('0x3d')]?_0x1c0494[_0x3253('0x3b')]:_0x4a9dd4['model'];_0x1c0494[_0x3253('0x3f')]=qs[_0x3253('0x40')](_0xb858e8[_0x3253('0x3a')]['sort']);_0x1c0494[_0x3253('0x41')]=qs[_0x3253('0x38')](_[_0x3253('0x83')](_0xb858e8[_0x3253('0x3a')],_0x4a9dd4['filters']));if(_0xb858e8[_0x3253('0x3a')][_0x3253('0x44')]){_0x1c0494[_0x3253('0x41')]=_['merge'](_0x1c0494[_0x3253('0x41')],{'$or':_['map'](_0x1c0494[_0x3253('0x3b')],function(_0x45e1a3){var _0x5ef3ab={};_0x5ef3ab[_0x45e1a3]={'$like':'%'+_0xb858e8[_0x3253('0x3a')][_0x3253('0x44')]+'%'};return _0x5ef3ab;})});}_0x1c0494=_[_0x3253('0x42')]({},_0x1c0494,_0xb858e8[_0x3253('0x45')]);return _0xfa6094['getItems'](_0x1c0494);}})[_0x3253('0x2a')](function(_0xcc9f94){if(_0xcc9f94){_0x3e3fd6=_0xcc9f94[_0x3253('0x3d')];if(!_0xb858e8[_0x3253('0x3a')][_0x3253('0x3e')]('nolimit')){_0x1c0494[_0x3253('0x22')]=qs[_0x3253('0x22')](_0xb858e8[_0x3253('0x3a')]['limit']);_0x1c0494[_0x3253('0x20')]=qs[_0x3253('0x20')](_0xb858e8['query'][_0x3253('0x20')]);}return _0xfa6094[_0x3253('0x84')](_0x1c0494);}})[_0x3253('0x2a')](function(_0x29b192){if(_0x29b192){return _0x29b192?{'count':_0x3e3fd6,'rows':_0x29b192}:null;}})[_0x3253('0x2a')](respondWithResult(_0x439fab,null))[_0x3253('0x49')](handleError(_0x439fab,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 98761ae..329324e 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 _0xffc8=['../../mysqldb','Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffc8,0xd1));var _0x8ffc=function(_0x466d67,_0x20602b){_0x466d67=_0x466d67-0x0;var _0x2445ac=_0xffc8[_0x466d67];return _0x2445ac;};'use strict';var EventEmitter=require(_0x8ffc('0x0'));var Dashboard=require(_0x8ffc('0x1'))['db'][_0x8ffc('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8ffc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ffc('0x4'),'afterDestroy':_0x8ffc('0x5')};function emitEvent(_0x5c3de0){return function(_0x24c8d5,_0x46d2a1,_0x132a4e){DashboardEvents[_0x8ffc('0x6')](_0x5c3de0+':'+_0x24c8d5['id'],_0x24c8d5);DashboardEvents[_0x8ffc('0x6')](_0x5c3de0,_0x24c8d5);_0x132a4e(null);};}for(var e in events){if(events[_0x8ffc('0x7')](e)){var event=events[e];Dashboard[_0x8ffc('0x8')](e,emitEvent(event));}}module[_0x8ffc('0x9')]=DashboardEvents; \ No newline at end of file +var _0xe108=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x3b9004,_0x562c29){var _0x2f7489=function(_0x329d77){while(--_0x329d77){_0x3b9004['push'](_0x3b9004['shift']());}};_0x2f7489(++_0x562c29);}(_0xe108,0x6b));var _0x8e10=function(_0x2929ba,_0x506aa6){_0x2929ba=_0x2929ba-0x0;var _0x365e6e=_0xe108[_0x2929ba];return _0x365e6e;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x8e10('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8e10('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e10('0x2'),'afterDestroy':_0x8e10('0x3')};function emitEvent(_0x3ba22c){return function(_0x5bba28,_0x18df45,_0x287494){DashboardEvents['emit'](_0x3ba22c+':'+_0x5bba28['id'],_0x5bba28);DashboardEvents[_0x8e10('0x4')](_0x3ba22c,_0x5bba28);_0x287494(null);};}for(var e in events){if(events[_0x8e10('0x5')](e)){var event=events[e];Dashboard[_0x8e10('0x6')](e,emitEvent(event));}}module[_0x8e10('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 1b6d2f8..30ce298 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 _0x3079=['util','moment','request-promise','path','rimraf','define','Dashboard','dashboards','lodash'];(function(_0x4c4a89,_0xd32d3c){var _0x4d2a9c=function(_0x1de911){while(--_0x1de911){_0x4c4a89['push'](_0x4c4a89['shift']());}};_0x4d2a9c(++_0xd32d3c);}(_0x3079,0xaa));var _0x9307=function(_0x5a0d6c,_0x180ba4){_0x5a0d6c=_0x5a0d6c-0x0;var _0x1b9fc1=_0x3079[_0x5a0d6c];return _0x1b9fc1;};'use strict';var _=require(_0x9307('0x0'));var util=require(_0x9307('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9307('0x2'));var BPromise=require('bluebird');var rp=require(_0x9307('0x3'));var fs=require('fs');var path=require(_0x9307('0x4'));var rimraf=require(_0x9307('0x5'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module['exports']=function(_0x3fbfef,_0x3f8f2a){return _0x3fbfef[_0x9307('0x6')](_0x9307('0x7'),attributes,{'tableName':_0x9307('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9507=['rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0x9507,0x1a7));var _0x7950=function(_0xd506e4,_0x5c6a14){_0xd506e4=_0xd506e4-0x0;var _0xe3bad3=_0x9507[_0xd506e4];return _0xe3bad3;};'use strict';var _=require(_0x7950('0x0'));var util=require(_0x7950('0x1'));var logger=require(_0x7950('0x2'))('api');var moment=require(_0x7950('0x3'));var BPromise=require(_0x7950('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7950('0x5'));var rimraf=require(_0x7950('0x6'));var config=require(_0x7950('0x7'));var attributes=require(_0x7950('0x8'));module[_0x7950('0x9')]=function(_0x5ceb3d,_0x388acd){return _0x5ceb3d[_0x7950('0xa')](_0x7950('0xb'),attributes,{'tableName':_0x7950('0xc'),'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 e3c0017..f0a69cf 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 _0xa590=['Dashboard,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','socket.io-emitter','./dashboard.socket','request','then','info','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1e89bc,_0x59e87b){var _0x51f588=function(_0x22fd8b){while(--_0x22fd8b){_0x1e89bc['push'](_0x1e89bc['shift']());}};_0x51f588(++_0x59e87b);}(_0xa590,0x17a));var _0x0a59=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa590[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0a59('0x0'));var util=require(_0x0a59('0x1'));var moment=require(_0x0a59('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a59('0x3'));var fs=require('fs');var Redis=require(_0x0a59('0x4'));var db=require(_0x0a59('0x5'))['db'];var utils=require(_0x0a59('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0a59('0x7'));var client=jayson[_0x0a59('0x8')][_0x0a59('0x9')]({'port':0x232a});config[_0x0a59('0xa')]=_['defaults'](config[_0x0a59('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a59('0xb'))(new Redis(config['redis']));require(_0x0a59('0xc'))['register'](socket);function respondWithRpcPromise(_0xf321ff,_0x5eb322,_0x3852da){return new BPromise(function(_0x5d99b6,_0x571841){return client[_0x0a59('0xd')](_0xf321ff,_0x3852da)[_0x0a59('0xe')](function(_0x3e5a75){logger[_0x0a59('0xf')]('Dashboard,\x20%s,\x20%s',_0x5eb322,'request\x20sent');logger[_0x0a59('0x10')](_0x0a59('0x11'),_0x5eb322,_0x0a59('0x12'),JSON[_0x0a59('0x13')](_0x3e5a75));if(_0x3e5a75[_0x0a59('0x14')]){if(_0x3e5a75[_0x0a59('0x14')][_0x0a59('0x15')]===0x1f4){logger['error'](_0x0a59('0x16'),_0x5eb322,_0x3e5a75[_0x0a59('0x14')][_0x0a59('0x17')]);return _0x571841(_0x3e5a75[_0x0a59('0x14')][_0x0a59('0x17')]);}logger[_0x0a59('0x14')]('Dashboard,\x20%s,\x20%s',_0x5eb322,_0x3e5a75[_0x0a59('0x14')]['message']);return _0x5d99b6(_0x3e5a75[_0x0a59('0x14')]['message']);}else{logger[_0x0a59('0xf')]('Dashboard,\x20%s,\x20%s',_0x5eb322,_0x0a59('0x12'));_0x5d99b6(_0x3e5a75[_0x0a59('0x18')]['message']);}})['catch'](function(_0xb3eaed){logger['error'](_0x0a59('0x16'),_0x5eb322,_0xb3eaed);_0x571841(_0xb3eaed);});});} \ No newline at end of file +var _0x77a7=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x77a7,0x193));var _0x777a=function(_0x128b7e,_0x47b29e){_0x128b7e=_0x128b7e-0x0;var _0x47c36d=_0x77a7[_0x128b7e];return _0x47c36d;};'use strict';var _=require(_0x777a('0x0'));var util=require(_0x777a('0x1'));var moment=require(_0x777a('0x2'));var BPromise=require(_0x777a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x777a('0x4'));var db=require(_0x777a('0x5'))['db'];var utils=require(_0x777a('0x6'));var logger=require(_0x777a('0x7'))('rpc');var config=require(_0x777a('0x8'));var jayson=require(_0x777a('0x9'));var client=jayson[_0x777a('0xa')][_0x777a('0xb')]({'port':0x232a});config[_0x777a('0xc')]=_[_0x777a('0xd')](config['redis'],{'host':_0x777a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x777a('0xc')]));require(_0x777a('0xf'))[_0x777a('0x10')](socket);function respondWithRpcPromise(_0x3f8b9d,_0x520729,_0x3e09d8){return new BPromise(function(_0xe1e5b,_0x553857){return client[_0x777a('0x11')](_0x3f8b9d,_0x3e09d8)[_0x777a('0x12')](function(_0x2a4547){logger[_0x777a('0x13')](_0x777a('0x14'),_0x520729,_0x777a('0x15'));logger[_0x777a('0x16')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x520729,_0x777a('0x15'),JSON['stringify'](_0x2a4547));if(_0x2a4547[_0x777a('0x17')]){if(_0x2a4547[_0x777a('0x17')]['code']===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x520729,_0x2a4547[_0x777a('0x17')][_0x777a('0x18')]);return _0x553857(_0x2a4547['error'][_0x777a('0x18')]);}logger[_0x777a('0x17')](_0x777a('0x14'),_0x520729,_0x2a4547[_0x777a('0x17')][_0x777a('0x18')]);return _0xe1e5b(_0x2a4547[_0x777a('0x17')][_0x777a('0x18')]);}else{logger[_0x777a('0x13')]('Dashboard,\x20%s,\x20%s',_0x520729,_0x777a('0x15'));_0xe1e5b(_0x2a4547[_0x777a('0x19')][_0x777a('0x18')]);}})[_0x777a('0x1a')](function(_0x5dc7db){logger['error'](_0x777a('0x14'),_0x520729,_0x5dc7db);_0x553857(_0x5dc7db);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 0b58f96..9e94481 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 _0xbf7f=['removeListener','register','length','dashboard:','./dashboard.events','update','emit'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0xbf7f,0x17e));var _0xfbf7=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xbf7f[_0x55f8b4];return _0x2475f9;};'use strict';var DashboardEvents=require(_0xfbf7('0x0'));var events=['save','remove',_0xfbf7('0x1')];function createListener(_0x4eaf10,_0x789bea){return function(_0x113c07){_0x789bea[_0xfbf7('0x2')](_0x4eaf10,_0x113c07);};}function removeListener(_0x581b3e,_0x21b9f5){return function(){DashboardEvents[_0xfbf7('0x3')](_0x581b3e,_0x21b9f5);};}exports[_0xfbf7('0x4')]=function(_0x297bd3){for(var _0x396050=0x0,_0x5ccde7=events[_0xfbf7('0x5')];_0x396050<_0x5ccde7;_0x396050++){var _0x20af6b=events[_0x396050];var _0x5f511e=createListener(_0xfbf7('0x6')+_0x20af6b,_0x297bd3);DashboardEvents['on'](_0x20af6b,_0x5f511e);}}; \ No newline at end of file +var _0x3b5a=['removeListener','register','length','update'];(function(_0x2c2aae,_0x5444a5){var _0x3a7a47=function(_0x584152){while(--_0x584152){_0x2c2aae['push'](_0x2c2aae['shift']());}};_0x3a7a47(++_0x5444a5);}(_0x3b5a,0x77));var _0xa3b5=function(_0xf23ae0,_0x13041f){_0xf23ae0=_0xf23ae0-0x0;var _0x441c81=_0x3b5a[_0xf23ae0];return _0x441c81;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save','remove',_0xa3b5('0x0')];function createListener(_0x39fb30,_0x1dc868){return function(_0x54ce1a){_0x1dc868['emit'](_0x39fb30,_0x54ce1a);};}function removeListener(_0x398e87,_0x923156){return function(){DashboardEvents[_0xa3b5('0x1')](_0x398e87,_0x923156);};}exports[_0xa3b5('0x2')]=function(_0x2f16f1){for(var _0x59bc26=0x0,_0x29584d=events[_0xa3b5('0x3')];_0x59bc26<_0x29584d;_0x59bc26++){var _0x1978d2=events[_0x59bc26];var _0x2b028d=createListener('dashboard:'+_0x1978d2,_0x2f16f1);DashboardEvents['on'](_0x1978d2,_0x2b028d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 58e5362..afe3217 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 _0x875a=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','show','/:id/items','isAuthenticated','getItems','post','create','/:id/clone','clone','addItem','/:id','update','delete','destroy'];(function(_0x12c00d,_0x14f812){var _0x1b2ade=function(_0x1a4f1d){while(--_0x1a4f1d){_0x12c00d['push'](_0x12c00d['shift']());}};_0x1b2ade(++_0x14f812);}(_0x875a,0x187));var _0xa875=function(_0xc5c8ec,_0x3f9bc4){_0xc5c8ec=_0xc5c8ec-0x0;var _0x3d57b8=_0x875a[_0xc5c8ec];return _0x3d57b8;};'use strict';var multer=require(_0xa875('0x0'));var util=require(_0xa875('0x1'));var path=require('path');var timeout=require(_0xa875('0x2'));var express=require(_0xa875('0x3'));var router=express[_0xa875('0x4')]();var fs_extra=require(_0xa875('0x5'));var auth=require(_0xa875('0x6'));var interaction=require(_0xa875('0x7'));var config=require(_0xa875('0x8'));var controller=require(_0xa875('0x9'));router[_0xa875('0xa')]('/',auth['isAuthenticated'](),controller[_0xa875('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa875('0xc')]);router[_0xa875('0xa')](_0xa875('0xd'),auth[_0xa875('0xe')](),controller[_0xa875('0xf')]);router[_0xa875('0x10')]('/',auth['isAuthenticated'](),controller[_0xa875('0x11')]);router[_0xa875('0x10')](_0xa875('0x12'),auth[_0xa875('0xe')](),controller[_0xa875('0x13')]);router[_0xa875('0x10')]('/:id/items',auth['isAuthenticated'](),controller[_0xa875('0x14')]);router['put'](_0xa875('0x15'),auth[_0xa875('0xe')](),controller[_0xa875('0x16')]);router[_0xa875('0x17')](_0xa875('0x15'),auth[_0xa875('0xe')](),controller[_0xa875('0x18')]);module[_0xa875('0x19')]=router; \ No newline at end of file +var _0xee00=['../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x198f7b,_0x2acdb8){var _0x48b989=function(_0x2a2fc8){while(--_0x2a2fc8){_0x198f7b['push'](_0x198f7b['shift']());}};_0x48b989(++_0x2acdb8);}(_0xee00,0xeb));var _0x0ee0=function(_0x2f6882,_0x44ad78){_0x2f6882=_0x2f6882-0x0;var _0x5ac7ef=_0xee00[_0x2f6882];return _0x5ac7ef;};'use strict';var multer=require(_0x0ee0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0ee0('0x1'));var express=require('express');var router=express[_0x0ee0('0x2')]();var fs_extra=require(_0x0ee0('0x3'));var auth=require(_0x0ee0('0x4'));var interaction=require(_0x0ee0('0x5'));var config=require(_0x0ee0('0x6'));var controller=require(_0x0ee0('0x7'));router[_0x0ee0('0x8')]('/',auth[_0x0ee0('0x9')](),controller[_0x0ee0('0xa')]);router['get'](_0x0ee0('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0ee0('0xc'),auth[_0x0ee0('0x9')](),controller[_0x0ee0('0xd')]);router[_0x0ee0('0xe')]('/',auth[_0x0ee0('0x9')](),controller[_0x0ee0('0xf')]);router[_0x0ee0('0xe')](_0x0ee0('0x10'),auth[_0x0ee0('0x9')](),controller[_0x0ee0('0x11')]);router[_0x0ee0('0xe')]('/:id/items',auth[_0x0ee0('0x9')](),controller[_0x0ee0('0x12')]);router[_0x0ee0('0x13')]('/:id',auth[_0x0ee0('0x9')](),controller[_0x0ee0('0x14')]);router[_0x0ee0('0x15')](_0x0ee0('0xb'),auth[_0x0ee0('0x9')](),controller[_0x0ee0('0x16')]);module[_0x0ee0('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8a0597a..5ed346d 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 _0x2ef3=['parse','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','long'];(function(_0x41cef5,_0x31b170){var _0x18ee19=function(_0x15dbc3){while(--_0x15dbc3){_0x41cef5['push'](_0x41cef5['shift']());}};_0x18ee19(++_0x31b170);}(_0x2ef3,0xba));var _0x32ef=function(_0x13d042,_0x2a350b){_0x13d042=_0x13d042-0x0;var _0x357a06=_0x2ef3[_0x13d042];return _0x357a06;};'use strict';var Sequelize=require(_0x32ef('0x0'));var squel=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));module[_0x32ef('0x3')]={'title':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x32ef('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x32ef('0x5')),'get':function(){try{return JSON[_0x32ef('0x6')](this['getDataValue'](_0x32ef('0x7')));}catch(_0x37dd1d){return[];}},'set':function(_0x4c8104){try{this['setDataValue'](_0x32ef('0x7'),JSON[_0x32ef('0x8')](_0x4c8104));}catch(_0x367c39){this[_0x32ef('0x9')](_0x32ef('0x7'),JSON[_0x32ef('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x32ef('0xa')]},'col':{'type':Sequelize[_0x32ef('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![],'defaultValue':_0x32ef('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x32ef('0x4')]},'titleFontSize':{'type':Sequelize[_0x32ef('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x599fd1,_0x4386ad){var _0x457944=function(_0x2c14e5){while(--_0x2c14e5){_0x599fd1['push'](_0x599fd1['shift']());}};_0x457944(++_0x4386ad);}(_0x5fab,0x177));var _0xb5fa=function(_0x142db6,_0x5a1395){_0x142db6=_0x142db6-0x0;var _0x256363=_0x5fab[_0x142db6];return _0x256363;};'use strict';var Sequelize=require(_0xb5fa('0x0'));var squel=require(_0xb5fa('0x1'));var _=require('lodash');module[_0xb5fa('0x2')]={'title':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb5fa('0x4')](_0xb5fa('0x5')),'get':function(){try{return JSON[_0xb5fa('0x6')](this[_0xb5fa('0x7')](_0xb5fa('0x8')));}catch(_0x10361d){return[];}},'set':function(_0x44df89){try{this['setDataValue']('attrs',JSON[_0xb5fa('0x9')](_0x44df89));}catch(_0x1aec3e){this[_0xb5fa('0xa')]('attrs',JSON[_0xb5fa('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb5fa('0x3')]},'titleFontSize':{'type':Sequelize[_0xb5fa('0xb')],'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 ce4f8cc..cc7e093 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 _0x3bd7=['attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','error','widgetAttributes:\x20%s','body','create','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','params','model','keys','DashboardItem','query','filters','intersection','attributes','fields','includeAll','include','options','find','catch','iframe'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x3bd7,0x199));var _0x73bd=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x3bd7[_0x34d346];return _0x122d76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x73bd('0x0'));var jsonpatch=require(_0x73bd('0x1'));var rp=require(_0x73bd('0x2'));var moment=require('moment');var BPromise=require(_0x73bd('0x3'));var Mustache=require(_0x73bd('0x4'));var util=require(_0x73bd('0x5'));var path=require('path');var sox=require(_0x73bd('0x6'));var csv=require('to-csv');var ejs=require(_0x73bd('0x7'));var fs=require('fs');var fs_extra=require(_0x73bd('0x8'));var _=require('lodash');var squel=require(_0x73bd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x73bd('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x73bd('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x73bd('0xc'));var as=require(_0x73bd('0xd'));var hardwareService=require(_0x73bd('0xe'));var logger=require(_0x73bd('0xf'))(_0x73bd('0x10'));var utils=require(_0x73bd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x73bd('0x12'));var db=require(_0x73bd('0x13'))['db'];config[_0x73bd('0x14')]=_[_0x73bd('0x15')](config[_0x73bd('0x14')],{'host':_0x73bd('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73bd('0x14')]));require('./dashboardItem.socket')[_0x73bd('0x17')](socket);function respondWithStatusCode(_0x3eab86,_0x125ad1){_0x125ad1=_0x125ad1||0xcc;return function(_0x3d8ef6){if(_0x3d8ef6){return _0x3eab86[_0x73bd('0x18')](_0x125ad1);}return _0x3eab86['status'](_0x125ad1)[_0x73bd('0x19')]();};}function respondWithResult(_0xfdf66,_0x1c5366){_0x1c5366=_0x1c5366||0xc8;return function(_0x3e5933){if(_0x3e5933){return _0xfdf66[_0x73bd('0x1a')](_0x1c5366)[_0x73bd('0x1b')](_0x3e5933);}};}function respondWithFilteredResult(_0x10e371,_0x464aa1){return function(_0x21787b){if(_0x21787b){var _0x482009=typeof _0x464aa1[_0x73bd('0x1c')]===_0x73bd('0x1d')&&typeof _0x464aa1[_0x73bd('0x1e')]===_0x73bd('0x1d');var _0x1cb0e3=_0x21787b[_0x73bd('0x1f')];var _0x397c60=_0x482009?0x0:_0x464aa1[_0x73bd('0x1c')];var _0x444c5f=_0x482009?_0x21787b['count']:_0x464aa1[_0x73bd('0x1c')]+_0x464aa1[_0x73bd('0x1e')];var _0x292f8c;if(_0x444c5f>=_0x1cb0e3){_0x444c5f=_0x1cb0e3;_0x292f8c=0xc8;}else{_0x292f8c=0xce;}_0x10e371['status'](_0x292f8c);return _0x10e371['set']('Content-Range',_0x397c60+'-'+_0x444c5f+'/'+_0x1cb0e3)[_0x73bd('0x1b')](_0x21787b);}return null;};}function patchUpdates(_0x269e84){return function(_0x56c076){try{jsonpatch[_0x73bd('0x20')](_0x56c076,_0x269e84,!![]);}catch(_0x22574c){return BPromise[_0x73bd('0x21')](_0x22574c);}return _0x56c076[_0x73bd('0x22')]();};}function saveUpdates(_0x1e22c5,_0x7ae0a4){return function(_0x2bcd5f){if(_0x2bcd5f){return _0x2bcd5f[_0x73bd('0x23')](_0x1e22c5)[_0x73bd('0x24')](function(_0x2dd70b){return _0x2dd70b;});}return null;};}function removeEntity(_0x36f7e0,_0x840215){return function(_0x12934b){if(_0x12934b){return _0x12934b[_0x73bd('0x25')]()[_0x73bd('0x24')](function(){_0x36f7e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x191727,_0x1903a5){return function(_0x5ebf3c){if(!_0x5ebf3c){_0x191727[_0x73bd('0x18')](0x194);}return _0x5ebf3c;};}function handleError(_0x330ee3,_0x193fe1){_0x193fe1=_0x193fe1||0x1f4;return function(_0x5ada8d){logger['error'](_0x5ada8d[_0x73bd('0x26')]);if(_0x5ada8d[_0x73bd('0x27')]){delete _0x5ada8d[_0x73bd('0x27')];}_0x330ee3['status'](_0x193fe1)[_0x73bd('0x28')](_0x5ada8d);};}exports['show']=function(_0x17a64f,_0x2701da){var _0x5d914c={'raw':![],'where':{'id':_0x17a64f[_0x73bd('0x29')]['id']}},_0x4c47d4={};_0x4c47d4[_0x73bd('0x2a')]=_[_0x73bd('0x2b')](db[_0x73bd('0x2c')]['rawAttributes']);_0x4c47d4[_0x73bd('0x2d')]=_['keys'](_0x17a64f[_0x73bd('0x2d')]);_0x4c47d4[_0x73bd('0x2e')]=_[_0x73bd('0x2f')](_0x4c47d4[_0x73bd('0x2a')],_0x4c47d4['query']);_0x5d914c[_0x73bd('0x30')]=_[_0x73bd('0x2f')](_0x4c47d4[_0x73bd('0x2a')],qs[_0x73bd('0x31')](_0x17a64f[_0x73bd('0x2d')][_0x73bd('0x31')]));_0x5d914c[_0x73bd('0x30')]=_0x5d914c[_0x73bd('0x30')]['length']?_0x5d914c[_0x73bd('0x30')]:_0x4c47d4[_0x73bd('0x2a')];if(_0x17a64f['query'][_0x73bd('0x32')]){_0x5d914c[_0x73bd('0x33')]=[{'all':!![]}];}_0x5d914c=_['merge']({},_0x5d914c,_0x17a64f[_0x73bd('0x34')]);return db['DashboardItem'][_0x73bd('0x35')](_0x5d914c)['then'](handleEntityNotFound(_0x2701da,null))[_0x73bd('0x24')](respondWithResult(_0x2701da,null))[_0x73bd('0x36')](handleError(_0x2701da,null));};exports[_0x73bd('0x25')]=function(_0x1acfb0,_0x5db723){return db[_0x73bd('0x2c')][_0x73bd('0x35')]({'where':{'id':_0x1acfb0['params']['id']}})[_0x73bd('0x24')](handleEntityNotFound(_0x5db723,null))[_0x73bd('0x24')](removeEntity(_0x5db723,null))['catch'](handleError(_0x5db723,null));};function widgetAttributes(_0x17041d){try{switch(_0x17041d['type']){case _0x73bd('0x37'):return[{'name':_0x73bd('0x38'),'value':_0x17041d[_0x73bd('0x38')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d['attrs'][0x0][_0x73bd('0x3a')]:undefined)||_0x73bd('0x3b')}];case _0x73bd('0x3c'):return[{'name':'attrPath','value':_0x17041d[_0x73bd('0x3d')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d[_0x73bd('0x39')][0x0][_0x73bd('0x3a')]:undefined)||''}];case _0x73bd('0x3e'):return[{'name':_0x73bd('0x3f'),'value':_0x17041d[_0x73bd('0x3f')]||(_0x17041d['attrs']&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d[_0x73bd('0x39')][0x0][_0x73bd('0x3a')]:undefined)||_0x73bd('0x40')},{'name':_0x73bd('0x41'),'value':_0x17041d[_0x73bd('0x41')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x1]?_0x17041d[_0x73bd('0x39')][0x1][_0x73bd('0x3a')]:undefined)||_0x73bd('0x42')},{'name':_0x73bd('0x43'),'value':_0x17041d['attrFontSize']||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x2]?_0x17041d[_0x73bd('0x39')][0x2][_0x73bd('0x3a')]:undefined)||0xc}];case _0x73bd('0x44'):return[{'name':'attrMetric','value':_0x17041d[_0x73bd('0x45')]||(_0x17041d['attrs']&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d['attrs'][0x0][_0x73bd('0x3a')]:undefined)||_0x73bd('0x46')},{'name':'attrVoiceQueues','value':_0x17041d[_0x73bd('0x47')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x1]?_0x17041d[_0x73bd('0x39')][0x1][_0x73bd('0x3a')]:undefined)||[]},{'name':'attrFontSize','value':_0x17041d[_0x73bd('0x43')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x2]?_0x17041d[_0x73bd('0x39')][0x2][_0x73bd('0x3a')]:undefined)||0x14},{'name':_0x73bd('0x48'),'value':_0x17041d[_0x73bd('0x48')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x3]?_0x17041d['attrs'][0x3][_0x73bd('0x3a')]:undefined)||_0x73bd('0x49')},{'name':_0x73bd('0x4a'),'value':_0x17041d['attrEmailAccounts']||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x4]?_0x17041d[_0x73bd('0x39')][0x4][_0x73bd('0x3a')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x17041d['attrFaxAccounts']||(_0x17041d['attrs']&&_0x17041d[_0x73bd('0x39')][0x5]?_0x17041d['attrs'][0x5][_0x73bd('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x17041d[_0x73bd('0x4b')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x6]?_0x17041d[_0x73bd('0x39')][0x6]['value']:undefined)||''},{'name':_0x73bd('0x4c'),'value':_0x17041d[_0x73bd('0x4c')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x7]?_0x17041d[_0x73bd('0x39')][0x7][_0x73bd('0x3a')]:undefined)||''},{'name':_0x73bd('0x4d'),'value':_0x17041d[_0x73bd('0x4d')]||(_0x17041d['attrs']&&_0x17041d[_0x73bd('0x39')][0x8]?_0x17041d[_0x73bd('0x39')][0x8]['value']:undefined)||''},{'name':_0x73bd('0x4e'),'value':_0x17041d[_0x73bd('0x4e')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x9]?_0x17041d[_0x73bd('0x39')][0x9][_0x73bd('0x3a')]:undefined)||''}];case _0x73bd('0x4f'):case _0x73bd('0x50'):return[{'name':_0x73bd('0x51'),'value':_0x17041d['attrSerie1']||(_0x17041d['attrs']&&_0x17041d['attrs'][0x0]?_0x17041d['attrs'][0x0][_0x73bd('0x3a')]:undefined)||_0x73bd('0x46')},{'name':_0x73bd('0x52'),'value':_0x17041d[_0x73bd('0x52')]||(_0x17041d['attrs']&&_0x17041d['attrs'][0x1]?_0x17041d['attrs'][0x1][_0x73bd('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x17041d[_0x73bd('0x53')]||(_0x17041d['attrs']&&_0x17041d['attrs'][0x2]?_0x17041d['attrs'][0x2][_0x73bd('0x3a')]:undefined)||null},{'name':_0x73bd('0x47'),'value':_0x17041d[_0x73bd('0x47')]||(_0x17041d['attrs']&&_0x17041d['attrs'][0x3]?_0x17041d[_0x73bd('0x39')][0x3][_0x73bd('0x3a')]:undefined)||[]},{'name':_0x73bd('0x48'),'value':_0x17041d['attrChannel']||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x4]?_0x17041d[_0x73bd('0x39')][0x4][_0x73bd('0x3a')]:undefined)||_0x73bd('0x49')},{'name':_0x73bd('0x4a'),'value':_0x17041d[_0x73bd('0x4a')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x5]?_0x17041d[_0x73bd('0x39')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x17041d['attrFaxAccounts']||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x6]?_0x17041d['attrs'][0x6][_0x73bd('0x3a')]:undefined)||''},{'name':_0x73bd('0x4b'),'value':_0x17041d[_0x73bd('0x4b')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x7]?_0x17041d[_0x73bd('0x39')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x17041d[_0x73bd('0x4c')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x8]?_0x17041d[_0x73bd('0x39')][0x8][_0x73bd('0x3a')]:undefined)||''},{'name':_0x73bd('0x4d'),'value':_0x17041d[_0x73bd('0x4d')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x9]?_0x17041d[_0x73bd('0x39')][0x9][_0x73bd('0x3a')]:undefined)||''},{'name':_0x73bd('0x4e'),'value':_0x17041d[_0x73bd('0x4e')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0xa]?_0x17041d[_0x73bd('0x39')][0xa][_0x73bd('0x3a')]:undefined)||''}];case _0x73bd('0x54'):return[{'name':_0x73bd('0x55'),'type':_0x17041d[_0x73bd('0x56')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d['attrs'][0x0][_0x73bd('0x57')]:undefined)||null,'value':_0x17041d[_0x73bd('0x55')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d[_0x73bd('0x39')][0x0][_0x73bd('0x3a')]:undefined)||null},{'name':_0x73bd('0x58'),'value':_0x17041d[_0x73bd('0x58')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x1]?_0x17041d[_0x73bd('0x39')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x8a9134){logger[_0x73bd('0x59')](_0x73bd('0x5a'),JSON['stringify'](_0x8a9134));return[];}}exports['create']=function(_0x5ba0c8,_0x26d045){if(_0x5ba0c8[_0x73bd('0x5b')]){_0x5ba0c8[_0x73bd('0x5b')][_0x73bd('0x39')]=widgetAttributes(_0x5ba0c8[_0x73bd('0x5b')]);}return db[_0x73bd('0x2c')][_0x73bd('0x5c')](_0x5ba0c8['body'],{})[_0x73bd('0x24')](respondWithResult(_0x26d045,0xc9))[_0x73bd('0x36')](handleError(_0x26d045,null));};exports['update']=function(_0xabeb51,_0x471673){if(_0xabeb51[_0x73bd('0x5b')]['id']){delete _0xabeb51[_0x73bd('0x5b')]['id'];}_0xabeb51[_0x73bd('0x5b')]['attrs']=widgetAttributes(_0xabeb51[_0x73bd('0x5b')]);return db[_0x73bd('0x2c')]['find']({'where':{'id':_0xabeb51[_0x73bd('0x29')]['id']}})[_0x73bd('0x24')](handleEntityNotFound(_0x471673,null))[_0x73bd('0x24')](saveUpdates(_0xabeb51['body'],null))['then'](respondWithResult(_0x471673,null))[_0x73bd('0x36')](handleError(_0x471673,null));}; \ No newline at end of file +var _0x1a28=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','params','DashboardItem','query','filters','intersection','model','attributes','fields','includeAll','include','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','clock','HH:mm:ss','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x257841,_0x389b4d){var _0x1b87ed=function(_0xceb19e){while(--_0xceb19e){_0x257841['push'](_0x257841['shift']());}};_0x1b87ed(++_0x389b4d);}(_0x1a28,0x10e));var _0x81a2=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0x1a28[_0x2b9e8a];return _0x520e67;};'use strict';var emlformat=require(_0x81a2('0x0'));var rimraf=require(_0x81a2('0x1'));var zipdir=require(_0x81a2('0x2'));var jsonpatch=require(_0x81a2('0x3'));var rp=require(_0x81a2('0x4'));var moment=require(_0x81a2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x81a2('0x6'));var path=require(_0x81a2('0x7'));var sox=require(_0x81a2('0x8'));var csv=require('to-csv');var ejs=require(_0x81a2('0x9'));var fs=require('fs');var fs_extra=require(_0x81a2('0xa'));var _=require('lodash');var squel=require(_0x81a2('0xb'));var crypto=require(_0x81a2('0xc'));var jsforce=require(_0x81a2('0xd'));var deskjs=require(_0x81a2('0xe'));var toCsv=require(_0x81a2('0xf'));var querystring=require(_0x81a2('0x10'));var Papa=require(_0x81a2('0x11'));var Redis=require(_0x81a2('0x12'));var authService=require(_0x81a2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x81a2('0x14'));var hardwareService=require(_0x81a2('0x15'));var logger=require(_0x81a2('0x16'))(_0x81a2('0x17'));var utils=require(_0x81a2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x81a2('0x19'));var db=require(_0x81a2('0x1a'))['db'];config[_0x81a2('0x1b')]=_[_0x81a2('0x1c')](config[_0x81a2('0x1b')],{'host':_0x81a2('0x1d'),'port':0x18eb});var socket=require(_0x81a2('0x1e'))(new Redis(config[_0x81a2('0x1b')]));require('./dashboardItem.socket')[_0x81a2('0x1f')](socket);function respondWithStatusCode(_0x58ce36,_0x22290b){_0x22290b=_0x22290b||0xcc;return function(_0x39de7b){if(_0x39de7b){return _0x58ce36['sendStatus'](_0x22290b);}return _0x58ce36[_0x81a2('0x20')](_0x22290b)['end']();};}function respondWithResult(_0x233c0b,_0xe7bdc){_0xe7bdc=_0xe7bdc||0xc8;return function(_0xbc1d26){if(_0xbc1d26){return _0x233c0b[_0x81a2('0x20')](_0xe7bdc)[_0x81a2('0x21')](_0xbc1d26);}};}function respondWithFilteredResult(_0x3b39b2,_0x39d90e){return function(_0xcad181){if(_0xcad181){var _0x56d270=typeof _0x39d90e[_0x81a2('0x22')]===_0x81a2('0x23')&&typeof _0x39d90e[_0x81a2('0x24')]===_0x81a2('0x23');var _0x1ac02e=_0xcad181[_0x81a2('0x25')];var _0x2dde5f=_0x56d270?0x0:_0x39d90e[_0x81a2('0x22')];var _0x58ee6d=_0x56d270?_0xcad181[_0x81a2('0x25')]:_0x39d90e['offset']+_0x39d90e[_0x81a2('0x24')];var _0x547f96;if(_0x58ee6d>=_0x1ac02e){_0x58ee6d=_0x1ac02e;_0x547f96=0xc8;}else{_0x547f96=0xce;}_0x3b39b2['status'](_0x547f96);return _0x3b39b2[_0x81a2('0x26')](_0x81a2('0x27'),_0x2dde5f+'-'+_0x58ee6d+'/'+_0x1ac02e)['json'](_0xcad181);}return null;};}function patchUpdates(_0x251605){return function(_0x9a51d1){try{jsonpatch[_0x81a2('0x28')](_0x9a51d1,_0x251605,!![]);}catch(_0x1b08d8){return BPromise[_0x81a2('0x29')](_0x1b08d8);}return _0x9a51d1[_0x81a2('0x2a')]();};}function saveUpdates(_0x1e64e1,_0x268e6c){return function(_0x3abceb){if(_0x3abceb){return _0x3abceb[_0x81a2('0x2b')](_0x1e64e1)[_0x81a2('0x2c')](function(_0x51e8be){return _0x51e8be;});}return null;};}function removeEntity(_0x3378e4,_0x5ea3fe){return function(_0x223aee){if(_0x223aee){return _0x223aee[_0x81a2('0x2d')]()[_0x81a2('0x2c')](function(){_0x3378e4[_0x81a2('0x20')](0xcc)[_0x81a2('0x2e')]();});}};}function handleEntityNotFound(_0x3dc58c,_0x5b0c5b){return function(_0x6d576a){if(!_0x6d576a){_0x3dc58c['sendStatus'](0x194);}return _0x6d576a;};}function handleError(_0x4d836d,_0x43c304){_0x43c304=_0x43c304||0x1f4;return function(_0x333bb6){logger['error'](_0x333bb6[_0x81a2('0x2f')]);if(_0x333bb6['name']){delete _0x333bb6[_0x81a2('0x30')];}_0x4d836d['status'](_0x43c304)[_0x81a2('0x31')](_0x333bb6);};}exports['show']=function(_0x5b445f,_0x474312){var _0x5b9cdf={'raw':![],'where':{'id':_0x5b445f[_0x81a2('0x32')]['id']}},_0xc7212d={};_0xc7212d['model']=_['keys'](db[_0x81a2('0x33')]['rawAttributes']);_0xc7212d['query']=_['keys'](_0x5b445f[_0x81a2('0x34')]);_0xc7212d[_0x81a2('0x35')]=_[_0x81a2('0x36')](_0xc7212d[_0x81a2('0x37')],_0xc7212d[_0x81a2('0x34')]);_0x5b9cdf[_0x81a2('0x38')]=_[_0x81a2('0x36')](_0xc7212d[_0x81a2('0x37')],qs[_0x81a2('0x39')](_0x5b445f[_0x81a2('0x34')][_0x81a2('0x39')]));_0x5b9cdf[_0x81a2('0x38')]=_0x5b9cdf[_0x81a2('0x38')]['length']?_0x5b9cdf[_0x81a2('0x38')]:_0xc7212d[_0x81a2('0x37')];if(_0x5b445f[_0x81a2('0x34')][_0x81a2('0x3a')]){_0x5b9cdf[_0x81a2('0x3b')]=[{'all':!![]}];}_0x5b9cdf=_['merge']({},_0x5b9cdf,_0x5b445f[_0x81a2('0x3c')]);return db[_0x81a2('0x33')][_0x81a2('0x3d')](_0x5b9cdf)[_0x81a2('0x2c')](handleEntityNotFound(_0x474312,null))[_0x81a2('0x2c')](respondWithResult(_0x474312,null))[_0x81a2('0x3e')](handleError(_0x474312,null));};exports[_0x81a2('0x2d')]=function(_0x3ebe85,_0x485ae5){return db[_0x81a2('0x33')][_0x81a2('0x3d')]({'where':{'id':_0x3ebe85['params']['id']}})[_0x81a2('0x2c')](handleEntityNotFound(_0x485ae5,null))[_0x81a2('0x2c')](removeEntity(_0x485ae5,null))['catch'](handleError(_0x485ae5,null));};function widgetAttributes(_0x149a4e){try{switch(_0x149a4e[_0x81a2('0x3f')]){case _0x81a2('0x40'):return[{'name':'attrUrl','value':_0x149a4e[_0x81a2('0x41')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x0]?_0x149a4e[_0x81a2('0x42')][0x0][_0x81a2('0x43')]:undefined)||_0x81a2('0x44')}];case _0x81a2('0x45'):return[{'name':'attrPath','value':_0x149a4e['attrPath']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x0]?_0x149a4e[_0x81a2('0x42')][0x0]['value']:undefined)||''}];case _0x81a2('0x46'):return[{'name':'attrHourFormat','value':_0x149a4e['attrHourFormat']||(_0x149a4e['attrs']&&_0x149a4e['attrs'][0x0]?_0x149a4e[_0x81a2('0x42')][0x0]['value']:undefined)||_0x81a2('0x47')},{'name':'attrTimezone','value':_0x149a4e['attrTimezone']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x1]?_0x149a4e[_0x81a2('0x42')][0x1][_0x81a2('0x43')]:undefined)||_0x81a2('0x48')},{'name':_0x81a2('0x49'),'value':_0x149a4e[_0x81a2('0x49')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x2]?_0x149a4e[_0x81a2('0x42')][0x2][_0x81a2('0x43')]:undefined)||0xc}];case'counter':return[{'name':_0x81a2('0x4a'),'value':_0x149a4e[_0x81a2('0x4a')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x0]?_0x149a4e[_0x81a2('0x42')][0x0][_0x81a2('0x43')]:undefined)||_0x81a2('0x4b')},{'name':_0x81a2('0x4c'),'value':_0x149a4e['attrVoiceQueues']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x1]?_0x149a4e[_0x81a2('0x42')][0x1][_0x81a2('0x43')]:undefined)||[]},{'name':_0x81a2('0x49'),'value':_0x149a4e[_0x81a2('0x49')]||(_0x149a4e['attrs']&&_0x149a4e['attrs'][0x2]?_0x149a4e[_0x81a2('0x42')][0x2][_0x81a2('0x43')]:undefined)||0x14},{'name':_0x81a2('0x4d'),'value':_0x149a4e['attrChannel']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x3]?_0x149a4e[_0x81a2('0x42')][0x3][_0x81a2('0x43')]:undefined)||'voice'},{'name':_0x81a2('0x4e'),'value':_0x149a4e[_0x81a2('0x4e')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x4]?_0x149a4e[_0x81a2('0x42')][0x4][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x4f'),'value':_0x149a4e[_0x81a2('0x4f')]||(_0x149a4e['attrs']&&_0x149a4e[_0x81a2('0x42')][0x5]?_0x149a4e['attrs'][0x5][_0x81a2('0x43')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x149a4e[_0x81a2('0x50')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x6]?_0x149a4e[_0x81a2('0x42')][0x6][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x51'),'value':_0x149a4e[_0x81a2('0x51')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x7]?_0x149a4e[_0x81a2('0x42')][0x7][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x52'),'value':_0x149a4e[_0x81a2('0x52')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x8]?_0x149a4e[_0x81a2('0x42')][0x8][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x53'),'value':_0x149a4e[_0x81a2('0x53')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x9]?_0x149a4e[_0x81a2('0x42')][0x9][_0x81a2('0x43')]:undefined)||''}];case _0x81a2('0x54'):case _0x81a2('0x55'):return[{'name':_0x81a2('0x56'),'value':_0x149a4e[_0x81a2('0x56')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x0]?_0x149a4e[_0x81a2('0x42')][0x0][_0x81a2('0x43')]:undefined)||_0x81a2('0x4b')},{'name':_0x81a2('0x57'),'value':_0x149a4e['attrSerie2']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x1]?_0x149a4e[_0x81a2('0x42')][0x1][_0x81a2('0x43')]:undefined)||null},{'name':'attrSerie3','value':_0x149a4e[_0x81a2('0x58')]||(_0x149a4e['attrs']&&_0x149a4e[_0x81a2('0x42')][0x2]?_0x149a4e[_0x81a2('0x42')][0x2]['value']:undefined)||null},{'name':_0x81a2('0x4c'),'value':_0x149a4e[_0x81a2('0x4c')]||(_0x149a4e['attrs']&&_0x149a4e['attrs'][0x3]?_0x149a4e['attrs'][0x3][_0x81a2('0x43')]:undefined)||[]},{'name':'attrChannel','value':_0x149a4e[_0x81a2('0x4d')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x4]?_0x149a4e['attrs'][0x4][_0x81a2('0x43')]:undefined)||'voice'},{'name':_0x81a2('0x4e'),'value':_0x149a4e[_0x81a2('0x4e')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x5]?_0x149a4e[_0x81a2('0x42')][0x5][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x4f'),'value':_0x149a4e[_0x81a2('0x4f')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x6]?_0x149a4e[_0x81a2('0x42')][0x6][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x50'),'value':_0x149a4e[_0x81a2('0x50')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x7]?_0x149a4e[_0x81a2('0x42')][0x7]['value']:undefined)||''},{'name':_0x81a2('0x51'),'value':_0x149a4e['attrOpenchannelAccounts']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x8]?_0x149a4e['attrs'][0x8]['value']:undefined)||''},{'name':_0x81a2('0x52'),'value':_0x149a4e[_0x81a2('0x52')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x9]?_0x149a4e['attrs'][0x9][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x53'),'value':_0x149a4e[_0x81a2('0x53')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0xa]?_0x149a4e[_0x81a2('0x42')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x149a4e[_0x81a2('0x59')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x0]?_0x149a4e['attrs'][0x0][_0x81a2('0x3f')]:undefined)||null,'value':_0x149a4e[_0x81a2('0x5a')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x0]?_0x149a4e['attrs'][0x0][_0x81a2('0x43')]:undefined)||null},{'name':_0x81a2('0x5b'),'value':_0x149a4e['attrRefresh']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x1]?_0x149a4e[_0x81a2('0x42')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x42a9a2){logger[_0x81a2('0x5c')](_0x81a2('0x5d'),JSON[_0x81a2('0x5e')](_0x42a9a2));return[];}}exports['create']=function(_0x11be31,_0x5377f4){if(_0x11be31['body']){_0x11be31['body']['attrs']=widgetAttributes(_0x11be31['body']);}return db[_0x81a2('0x33')]['create'](_0x11be31[_0x81a2('0x5f')],{})['then'](respondWithResult(_0x5377f4,0xc9))[_0x81a2('0x3e')](handleError(_0x5377f4,null));};exports[_0x81a2('0x2b')]=function(_0x374d7c,_0x221381){if(_0x374d7c[_0x81a2('0x5f')]['id']){delete _0x374d7c[_0x81a2('0x5f')]['id'];}_0x374d7c['body'][_0x81a2('0x42')]=widgetAttributes(_0x374d7c[_0x81a2('0x5f')]);return db[_0x81a2('0x33')]['find']({'where':{'id':_0x374d7c[_0x81a2('0x32')]['id']}})['then'](handleEntityNotFound(_0x221381,null))[_0x81a2('0x2c')](saveUpdates(_0x374d7c[_0x81a2('0x5f')],null))[_0x81a2('0x2c')](respondWithResult(_0x221381,null))[_0x81a2('0x3e')](handleError(_0x221381,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0741e8e..eaf51cf 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 _0x1403=['hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners','remove','emit'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x1403,0xcb));var _0x3140=function(_0x5a5a32,_0x1b26e1){_0x5a5a32=_0x5a5a32-0x0;var _0x27499f=_0x1403[_0x5a5a32];return _0x27499f;};'use strict';var EventEmitter=require(_0x3140('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x3140('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x3140('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3140('0x3')};function emitEvent(_0x3062a1){return function(_0x1f6b9f,_0x2ca751,_0x4e17ad){DashboardItemEvents[_0x3140('0x4')](_0x3062a1+':'+_0x1f6b9f['id'],_0x1f6b9f);DashboardItemEvents[_0x3140('0x4')](_0x3062a1,_0x1f6b9f);_0x4e17ad(null);};}for(var e in events){if(events[_0x3140('0x5')](e)){var event=events[e];DashboardItem[_0x3140('0x6')](e,emitEvent(event));}}module[_0x3140('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x0af9=['exports','DashboardItem','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2317bf,_0x2f3750){var _0x3d1cfe=function(_0x43efcb){while(--_0x43efcb){_0x2317bf['push'](_0x2317bf['shift']());}};_0x3d1cfe(++_0x2f3750);}(_0x0af9,0x161));var _0x90af=function(_0x5af812,_0x43d252){_0x5af812=_0x5af812-0x0;var _0x1489f2=_0x0af9[_0x5af812];return _0x1489f2;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x90af('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x90af('0x1'),'afterUpdate':_0x90af('0x2'),'afterDestroy':_0x90af('0x3')};function emitEvent(_0x336199){return function(_0x408e74,_0x4ab311,_0x5a69d8){DashboardItemEvents[_0x90af('0x4')](_0x336199+':'+_0x408e74['id'],_0x408e74);DashboardItemEvents[_0x90af('0x4')](_0x336199,_0x408e74);_0x5a69d8(null);};}for(var e in events){if(events[_0x90af('0x5')](e)){var event=events[e];DashboardItem[_0x90af('0x6')](e,emitEvent(event));}}module[_0x90af('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 71a7cf5..cfd8049 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 _0xa6e6=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','dashboard_items','lodash','../../config/logger','bluebird'];(function(_0x25f686,_0x199629){var _0x54ad10=function(_0x1f9083){while(--_0x1f9083){_0x25f686['push'](_0x25f686['shift']());}};_0x54ad10(++_0x199629);}(_0xa6e6,0x183));var _0x6a6e=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xa6e6[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x6a6e('0x0'));var util=require('util');var logger=require(_0x6a6e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6a6e('0x2'));var rp=require(_0x6a6e('0x3'));var fs=require('fs');var path=require(_0x6a6e('0x4'));var rimraf=require(_0x6a6e('0x5'));var config=require(_0x6a6e('0x6'));var attributes=require(_0x6a6e('0x7'));module['exports']=function(_0xfc4153,_0x86f68c){return _0xfc4153[_0x6a6e('0x8')]('DashboardItem',attributes,{'tableName':_0x6a6e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20a9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','../../config/logger'];(function(_0x1cc597,_0x52b070){var _0x507937=function(_0x3a62b7){while(--_0x3a62b7){_0x1cc597['push'](_0x1cc597['shift']());}};_0x507937(++_0x52b070);}(_0x20a9,0x113));var _0x920a=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x20a9[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x920a('0x0'))(_0x920a('0x1'));var moment=require(_0x920a('0x2'));var BPromise=require(_0x920a('0x3'));var rp=require(_0x920a('0x4'));var fs=require('fs');var path=require(_0x920a('0x5'));var rimraf=require(_0x920a('0x6'));var config=require(_0x920a('0x7'));var attributes=require(_0x920a('0x8'));module[_0x920a('0x9')]=function(_0x21ae55,_0x58bdd5){return _0x21ae55[_0x920a('0xa')](_0x920a('0xb'),attributes,{'tableName':'dashboard_items','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 671b04b..c294dd5 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 _0x81aa=['localhost','socket.io-emitter','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x21ac57,_0x24e91b){var _0x57cdf5=function(_0x3c16d2){while(--_0x3c16d2){_0x21ac57['push'](_0x21ac57['shift']());}};_0x57cdf5(++_0x24e91b);}(_0x81aa,0x173));var _0xa81a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x81aa[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xa81a('0x0'));var util=require(_0xa81a('0x1'));var moment=require(_0xa81a('0x2'));var BPromise=require(_0xa81a('0x3'));var rs=require(_0xa81a('0x4'));var fs=require('fs');var Redis=require(_0xa81a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa81a('0x6'))(_0xa81a('0x7'));var config=require(_0xa81a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa81a('0x9')][_0xa81a('0xa')]({'port':0x232a});config['redis']=_[_0xa81a('0xb')](config[_0xa81a('0xc')],{'host':_0xa81a('0xd'),'port':0x18eb});var socket=require(_0xa81a('0xe'))(new Redis(config[_0xa81a('0xc')]));require('./dashboardItem.socket')[_0xa81a('0xf')](socket);function respondWithRpcPromise(_0x2c9a8a,_0x1d3b50,_0x2cf55f){return new BPromise(function(_0x580cd4,_0xee37d1){return client['request'](_0x2c9a8a,_0x2cf55f)[_0xa81a('0x10')](function(_0x5b0df5){logger[_0xa81a('0x11')](_0xa81a('0x12'),_0x1d3b50,_0xa81a('0x13'));logger['debug'](_0xa81a('0x14'),_0x1d3b50,_0xa81a('0x13'),JSON['stringify'](_0x5b0df5));if(_0x5b0df5[_0xa81a('0x15')]){if(_0x5b0df5[_0xa81a('0x15')]['code']===0x1f4){logger[_0xa81a('0x15')](_0xa81a('0x12'),_0x1d3b50,_0x5b0df5[_0xa81a('0x15')][_0xa81a('0x16')]);return _0xee37d1(_0x5b0df5[_0xa81a('0x15')][_0xa81a('0x16')]);}logger[_0xa81a('0x15')]('DashboardItem,\x20%s,\x20%s',_0x1d3b50,_0x5b0df5['error'][_0xa81a('0x16')]);return _0x580cd4(_0x5b0df5[_0xa81a('0x15')][_0xa81a('0x16')]);}else{logger['info'](_0xa81a('0x12'),_0x1d3b50,_0xa81a('0x13'));_0x580cd4(_0x5b0df5[_0xa81a('0x17')][_0xa81a('0x16')]);}})['catch'](function(_0x5cc312){logger[_0xa81a('0x15')](_0xa81a('0x12'),_0x1d3b50,_0x5cc312);_0xee37d1(_0x5cc312);});});} \ No newline at end of file +var _0xfc2c=['localhost','socket.io-emitter','register','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x51d1b0,_0x4ff6fd){var _0x2453bb=function(_0xed7aa8){while(--_0xed7aa8){_0x51d1b0['push'](_0x51d1b0['shift']());}};_0x2453bb(++_0x4ff6fd);}(_0xfc2c,0xf8));var _0xcfc2=function(_0x85f562,_0x9fd15b){_0x85f562=_0x85f562-0x0;var _0x2c802c=_0xfc2c[_0x85f562];return _0x2c802c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcfc2('0x0'));var BPromise=require(_0xcfc2('0x1'));var rs=require(_0xcfc2('0x2'));var fs=require('fs');var Redis=require(_0xcfc2('0x3'));var db=require(_0xcfc2('0x4'))['db'];var utils=require(_0xcfc2('0x5'));var logger=require(_0xcfc2('0x6'))(_0xcfc2('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfc2('0x8'));var client=jayson[_0xcfc2('0x9')][_0xcfc2('0xa')]({'port':0x232a});config[_0xcfc2('0xb')]=_['defaults'](config[_0xcfc2('0xb')],{'host':_0xcfc2('0xc'),'port':0x18eb});var socket=require(_0xcfc2('0xd'))(new Redis(config[_0xcfc2('0xb')]));require('./dashboardItem.socket')[_0xcfc2('0xe')](socket);function respondWithRpcPromise(_0x41b562,_0xf242c5,_0x2dfec6){return new BPromise(function(_0x274e79,_0x1cfe0a){return client['request'](_0x41b562,_0x2dfec6)['then'](function(_0x1edada){logger[_0xcfc2('0xf')]('DashboardItem,\x20%s,\x20%s',_0xf242c5,_0xcfc2('0x10'));logger[_0xcfc2('0x11')](_0xcfc2('0x12'),_0xf242c5,_0xcfc2('0x10'),JSON[_0xcfc2('0x13')](_0x1edada));if(_0x1edada[_0xcfc2('0x14')]){if(_0x1edada['error'][_0xcfc2('0x15')]===0x1f4){logger[_0xcfc2('0x14')]('DashboardItem,\x20%s,\x20%s',_0xf242c5,_0x1edada[_0xcfc2('0x14')]['message']);return _0x1cfe0a(_0x1edada[_0xcfc2('0x14')][_0xcfc2('0x16')]);}logger[_0xcfc2('0x14')](_0xcfc2('0x17'),_0xf242c5,_0x1edada[_0xcfc2('0x14')]['message']);return _0x274e79(_0x1edada['error']['message']);}else{logger[_0xcfc2('0xf')](_0xcfc2('0x17'),_0xf242c5,_0xcfc2('0x10'));_0x274e79(_0x1edada[_0xcfc2('0x18')]['message']);}})[_0xcfc2('0x19')](function(_0x1c0b5d){logger['error'](_0xcfc2('0x17'),_0xf242c5,_0x1c0b5d);_0x1cfe0a(_0x1c0b5d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index cf98ec6..b2bfa3c 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 _0x2d19=['register','length','save','remove','removeListener'];(function(_0x189478,_0x20412c){var _0x24d237=function(_0x339305){while(--_0x339305){_0x189478['push'](_0x189478['shift']());}};_0x24d237(++_0x20412c);}(_0x2d19,0x15b));var _0x92d1=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x2d19[_0xb66df];return _0x42a702;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x92d1('0x0'),_0x92d1('0x1'),'update'];function createListener(_0x4daade,_0x2ff89f){return function(_0x5383c5){_0x2ff89f['emit'](_0x4daade,_0x5383c5);};}function removeListener(_0x46f210,_0x335b4f){return function(){DashboardItemEvents[_0x92d1('0x2')](_0x46f210,_0x335b4f);};}exports[_0x92d1('0x3')]=function(_0x297a17){for(var _0x1b9fa3=0x0,_0x1639c8=events[_0x92d1('0x4')];_0x1b9fa3<_0x1639c8;_0x1b9fa3++){var _0x4ae41c=events[_0x1b9fa3];var _0xefa1ad=createListener('dashboardItem:'+_0x4ae41c,_0x297a17);DashboardItemEvents['on'](_0x4ae41c,_0xefa1ad);}}; \ No newline at end of file +var _0xfcfc=['remove','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0xfcfc,0xa6));var _0xcfcf=function(_0x9fdca,_0x364493){_0x9fdca=_0x9fdca-0x0;var _0x4037a3=_0xfcfc[_0x9fdca];return _0x4037a3;};'use strict';var DashboardItemEvents=require(_0xcfcf('0x0'));var events=[_0xcfcf('0x1'),_0xcfcf('0x2'),'update'];function createListener(_0x590371,_0x2c88b3){return function(_0x1d01e7){_0x2c88b3[_0xcfcf('0x3')](_0x590371,_0x1d01e7);};}function removeListener(_0x3f9965,_0x2bbc47){return function(){DashboardItemEvents[_0xcfcf('0x4')](_0x3f9965,_0x2bbc47);};}exports[_0xcfcf('0x5')]=function(_0x50d018){for(var _0x1daafe=0x0,_0x113442=events[_0xcfcf('0x6')];_0x1daafe<_0x113442;_0x1daafe++){var _0x318651=events[_0x1daafe];var _0x35864e=createListener(_0xcfcf('0x7')+_0x318651,_0x50d018);DashboardItemEvents['on'](_0x318651,_0x35864e);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 3038a39..3a7459c 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 _0x9631=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','create','put','update','destroy','util'];(function(_0x463b91,_0x53490e){var _0x3803a1=function(_0x37ef87){while(--_0x37ef87){_0x463b91['push'](_0x463b91['shift']());}};_0x3803a1(++_0x53490e);}(_0x9631,0xaf));var _0x1963=function(_0x25c57f,_0x30ca62){_0x25c57f=_0x25c57f-0x0;var _0x1e77d2=_0x9631[_0x25c57f];return _0x1e77d2;};'use strict';var multer=require('multer');var util=require(_0x1963('0x0'));var path=require(_0x1963('0x1'));var timeout=require('connect-timeout');var express=require(_0x1963('0x2'));var router=express[_0x1963('0x3')]();var fs_extra=require(_0x1963('0x4'));var auth=require(_0x1963('0x5'));var interaction=require(_0x1963('0x6'));var config=require(_0x1963('0x7'));var controller=require(_0x1963('0x8'));router['get'](_0x1963('0x9'),auth[_0x1963('0xa')](),controller[_0x1963('0xb')]);router['post']('/',auth[_0x1963('0xa')](),controller[_0x1963('0xc')]);router[_0x1963('0xd')](_0x1963('0x9'),auth[_0x1963('0xa')](),controller[_0x1963('0xe')]);router['delete'](_0x1963('0x9'),auth['isAuthenticated'](),controller[_0x1963('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb7da=['fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','show','post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x246226,_0x36d0c6){var _0x29b6a1=function(_0x7dcb1a){while(--_0x7dcb1a){_0x246226['push'](_0x246226['shift']());}};_0x29b6a1(++_0x36d0c6);}(_0xb7da,0xa5));var _0xab7d=function(_0x5e9d35,_0x382c91){_0x5e9d35=_0x5e9d35-0x0;var _0x3beb2e=_0xb7da[_0x5e9d35];return _0x3beb2e;};'use strict';var multer=require(_0xab7d('0x0'));var util=require(_0xab7d('0x1'));var path=require(_0xab7d('0x2'));var timeout=require(_0xab7d('0x3'));var express=require(_0xab7d('0x4'));var router=express[_0xab7d('0x5')]();var fs_extra=require(_0xab7d('0x6'));var auth=require(_0xab7d('0x7'));var interaction=require(_0xab7d('0x8'));var config=require('../../config/environment');var controller=require(_0xab7d('0x9'));router['get']('/:id',auth['isAuthenticated'](),controller[_0xab7d('0xa')]);router[_0xab7d('0xb')]('/',auth[_0xab7d('0xc')](),controller['create']);router[_0xab7d('0xd')](_0xab7d('0xe'),auth[_0xab7d('0xc')](),controller[_0xab7d('0xf')]);router[_0xab7d('0x10')](_0xab7d('0xe'),auth[_0xab7d('0xc')](),controller[_0xab7d('0x11')]);module[_0xab7d('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index db441d2..969a1d0 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 _0x05f8=['second','third','first','STRING'];(function(_0x10dc07,_0x2501ab){var _0x476f2b=function(_0x50a82c){while(--_0x50a82c){_0x10dc07['push'](_0x10dc07['shift']());}};_0x476f2b(++_0x2501ab);}(_0x05f8,0x197));var _0x805f=function(_0x266360,_0x3565e0){_0x266360=_0x266360-0x0;var _0x3a7105=_0x05f8[_0x266360];return _0x3a7105;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x805f('0x0')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0x805f('0x1'),_0x805f('0x2')),'allowNull':![],'defaultValue':_0x805f('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x56c9=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x40d730,_0x3a30c7){var _0x521552=function(_0x598727){while(--_0x598727){_0x40d730['push'](_0x40d730['shift']());}};_0x521552(++_0x3a30c7);}(_0x56c9,0x127));var _0x956c=function(_0x44b25b,_0x198875){_0x44b25b=_0x44b25b-0x0;var _0x4678d1=_0x56c9[_0x44b25b];return _0x4678d1;};'use strict';var Sequelize=require(_0x956c('0x0'));module[_0x956c('0x1')]={'name':{'type':Sequelize[_0x956c('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x956c('0x3')](_0x956c('0x4'),_0x956c('0x5'),_0x956c('0x6')),'allowNull':![],'defaultValue':_0x956c('0x4')},'description':{'type':Sequelize[_0x956c('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index c3b60be..595975d 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 _0x3649=['index','map','Disposition','rawAttributes','fieldName','type','key','model','name','keys','query','intersection','fields','attributes','length','nolimit','offset','order','sort','where','filters','pick','VIRTUAL','merge','options','include','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','Dispositions','UserProfileResource','destroy','end','sendStatus','error','stack'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x3649,0x1d1));var _0x9364=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x3649[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0x9364('0x0'));var rimraf=require(_0x9364('0x1'));var zipdir=require(_0x9364('0x2'));var jsonpatch=require(_0x9364('0x3'));var rp=require(_0x9364('0x4'));var moment=require(_0x9364('0x5'));var BPromise=require(_0x9364('0x6'));var Mustache=require(_0x9364('0x7'));var util=require(_0x9364('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9364('0x9'));var fs=require('fs');var fs_extra=require(_0x9364('0xa'));var _=require(_0x9364('0xb'));var squel=require('squel');var crypto=require(_0x9364('0xc'));var jsforce=require(_0x9364('0xd'));var deskjs=require(_0x9364('0xe'));var toCsv=require(_0x9364('0xf'));var querystring=require('querystring');var Papa=require(_0x9364('0x10'));var Redis=require(_0x9364('0x11'));var authService=require(_0x9364('0x12'));var qs=require(_0x9364('0x13'));var as=require(_0x9364('0x14'));var hardwareService=require(_0x9364('0x15'));var logger=require(_0x9364('0x16'))('api');var utils=require(_0x9364('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9364('0x18'));var db=require(_0x9364('0x19'))['db'];function respondWithStatusCode(_0x207b89,_0x58e03b){_0x58e03b=_0x58e03b||0xcc;return function(_0x566981){if(_0x566981){return _0x207b89['sendStatus'](_0x58e03b);}return _0x207b89[_0x9364('0x1a')](_0x58e03b)['end']();};}function respondWithResult(_0x4d3716,_0x2bafbb){_0x2bafbb=_0x2bafbb||0xc8;return function(_0x8c011){if(_0x8c011){return _0x4d3716[_0x9364('0x1a')](_0x2bafbb)[_0x9364('0x1b')](_0x8c011);}};}function respondWithFilteredResult(_0x59ac48,_0x515815){return function(_0x5ad5c0){if(_0x5ad5c0){var _0x559a52=typeof _0x515815['offset']===_0x9364('0x1c')&&typeof _0x515815[_0x9364('0x1d')]===_0x9364('0x1c');var _0x37c43e=_0x5ad5c0[_0x9364('0x1e')];var _0x587c39=_0x559a52?0x0:_0x515815['offset'];var _0x1a5222=_0x559a52?_0x5ad5c0[_0x9364('0x1e')]:_0x515815['offset']+_0x515815['limit'];var _0x384f01;if(_0x1a5222>=_0x37c43e){_0x1a5222=_0x37c43e;_0x384f01=0xc8;}else{_0x384f01=0xce;}_0x59ac48['status'](_0x384f01);return _0x59ac48[_0x9364('0x1f')](_0x9364('0x20'),_0x587c39+'-'+_0x1a5222+'/'+_0x37c43e)[_0x9364('0x1b')](_0x5ad5c0);}return null;};}function patchUpdates(_0x202201){return function(_0x437a99){try{jsonpatch[_0x9364('0x21')](_0x437a99,_0x202201,!![]);}catch(_0x305aeb){return BPromise[_0x9364('0x22')](_0x305aeb);}return _0x437a99[_0x9364('0x23')]();};}function saveUpdates(_0x1e49b8,_0x3de31a){return function(_0x331b72){if(_0x331b72){return _0x331b72['update'](_0x1e49b8)[_0x9364('0x24')](function(_0x73deb3){return _0x73deb3;});}return null;};}function removeEntity(_0x1dc21d,_0x3c7a4a){return function(_0xd0df40){if(_0xd0df40){return _0xd0df40['destroy']()[_0x9364('0x24')](function(){var _0x30ec36=_0xd0df40[_0x9364('0x25')]({'plain':!![]});var _0x595db9=_0x9364('0x26');return db[_0x9364('0x27')][_0x9364('0x28')]({'where':{'type':_0x595db9,'resourceId':_0x30ec36['id']}})[_0x9364('0x24')](function(){return _0xd0df40;});})['then'](function(){_0x1dc21d[_0x9364('0x1a')](0xcc)[_0x9364('0x29')]();});}};}function handleEntityNotFound(_0x44d7e9,_0x3cfe90){return function(_0x506db5){if(!_0x506db5){_0x44d7e9[_0x9364('0x2a')](0x194);}return _0x506db5;};}function handleError(_0x5277e6,_0x7d3707){_0x7d3707=_0x7d3707||0x1f4;return function(_0x1d9788){logger[_0x9364('0x2b')](_0x1d9788[_0x9364('0x2c')]);if(_0x1d9788['name']){delete _0x1d9788['name'];}_0x5277e6[_0x9364('0x1a')](_0x7d3707)['send'](_0x1d9788);};}exports[_0x9364('0x2d')]=function(_0x4e967b,_0x1dca39){var _0x25fd1b={},_0x50cd12={},_0xd297d6={'count':0x0,'rows':[]};var _0xed8ee=_[_0x9364('0x2e')](db[_0x9364('0x2f')][_0x9364('0x30')],function(_0x54d1c7){return{'name':_0x54d1c7[_0x9364('0x31')],'type':_0x54d1c7[_0x9364('0x32')][_0x9364('0x33')]};});_0x50cd12[_0x9364('0x34')]=_[_0x9364('0x2e')](_0xed8ee,_0x9364('0x35'));_0x50cd12['query']=_[_0x9364('0x36')](_0x4e967b[_0x9364('0x37')]);_0x50cd12['filters']=_[_0x9364('0x38')](_0x50cd12['model'],_0x50cd12['query']);_0x25fd1b['attributes']=_[_0x9364('0x38')](_0x50cd12['model'],qs[_0x9364('0x39')](_0x4e967b[_0x9364('0x37')][_0x9364('0x39')]));_0x25fd1b[_0x9364('0x3a')]=_0x25fd1b[_0x9364('0x3a')][_0x9364('0x3b')]?_0x25fd1b[_0x9364('0x3a')]:_0x50cd12[_0x9364('0x34')];if(!_0x4e967b[_0x9364('0x37')]['hasOwnProperty'](_0x9364('0x3c'))){_0x25fd1b[_0x9364('0x1d')]=qs['limit'](_0x4e967b['query'][_0x9364('0x1d')]);_0x25fd1b[_0x9364('0x3d')]=qs[_0x9364('0x3d')](_0x4e967b[_0x9364('0x37')][_0x9364('0x3d')]);}_0x25fd1b[_0x9364('0x3e')]=qs[_0x9364('0x3f')](_0x4e967b[_0x9364('0x37')]['sort']);_0x25fd1b[_0x9364('0x40')]=qs[_0x9364('0x41')](_[_0x9364('0x42')](_0x4e967b[_0x9364('0x37')],_0x50cd12[_0x9364('0x41')]),_0xed8ee);if(_0x4e967b[_0x9364('0x37')]['filter']){_0x25fd1b[_0x9364('0x40')]=_['merge'](_0x25fd1b[_0x9364('0x40')],{'$or':_[_0x9364('0x2e')](_0xed8ee,function(_0x32d296){if(_0x32d296['type']!==_0x9364('0x43')){var _0x54796b={};_0x54796b[_0x32d296[_0x9364('0x35')]]={'$like':'%'+_0x4e967b['query']['filter']+'%'};return _0x54796b;}})});}_0x25fd1b=_[_0x9364('0x44')]({},_0x25fd1b,_0x4e967b[_0x9364('0x45')]);var _0xa0919d={'where':_0x25fd1b[_0x9364('0x40')]};return db[_0x9364('0x2f')][_0x9364('0x1e')](_0xa0919d)[_0x9364('0x24')](function(_0x3cc912){_0xd297d6['count']=_0x3cc912;if(_0x4e967b[_0x9364('0x37')]['includeAll']){_0x25fd1b[_0x9364('0x46')]=[{'all':!![]}];}return db[_0x9364('0x2f')]['findAll'](_0x25fd1b);})['then'](function(_0x1bbafb){_0xd297d6[_0x9364('0x47')]=_0x1bbafb;return _0xd297d6;})['then'](respondWithFilteredResult(_0x1dca39,_0x25fd1b))[_0x9364('0x48')](handleError(_0x1dca39,null));};exports['show']=function(_0xe81d20,_0x4d308b){var _0x4acc65={'raw':!![],'where':{'id':_0xe81d20['params']['id']}},_0x226fd0={};_0x226fd0['model']=_[_0x9364('0x36')](db[_0x9364('0x2f')]['rawAttributes']);_0x226fd0[_0x9364('0x37')]=_[_0x9364('0x36')](_0xe81d20['query']);_0x226fd0['filters']=_[_0x9364('0x38')](_0x226fd0[_0x9364('0x34')],_0x226fd0[_0x9364('0x37')]);_0x4acc65[_0x9364('0x3a')]=_[_0x9364('0x38')](_0x226fd0[_0x9364('0x34')],qs[_0x9364('0x39')](_0xe81d20[_0x9364('0x37')][_0x9364('0x39')]));_0x4acc65[_0x9364('0x3a')]=_0x4acc65['attributes'][_0x9364('0x3b')]?_0x4acc65['attributes']:_0x226fd0['model'];if(_0xe81d20['query'][_0x9364('0x49')]){_0x4acc65[_0x9364('0x46')]=[{'all':!![]}];}_0x4acc65=_[_0x9364('0x44')]({},_0x4acc65,_0xe81d20[_0x9364('0x45')]);return db[_0x9364('0x2f')][_0x9364('0x4a')](_0x4acc65)[_0x9364('0x24')](handleEntityNotFound(_0x4d308b,null))[_0x9364('0x24')](respondWithResult(_0x4d308b,null))[_0x9364('0x48')](handleError(_0x4d308b,null));};exports[_0x9364('0x4b')]=function(_0x563603,_0x417538){return db[_0x9364('0x2f')][_0x9364('0x4b')](_0x563603[_0x9364('0x4c')],{})[_0x9364('0x24')](function(_0x11060d){var _0x2cc65b=_0x563603[_0x9364('0x4d')][_0x9364('0x25')]({'plain':!![]});if(!_0x2cc65b)throw new Error(_0x9364('0x4e'));if(_0x2cc65b[_0x9364('0x4f')]===_0x9364('0x4d')){var _0x3bd8e6=_0x11060d[_0x9364('0x25')]({'plain':!![]});var _0x595949=_0x9364('0x26');return db[_0x9364('0x50')][_0x9364('0x4a')]({'where':{'name':_0x595949,'userProfileId':_0x2cc65b[_0x9364('0x51')]},'raw':!![]})['then'](function(_0x34cba4){if(_0x34cba4&&_0x34cba4[_0x9364('0x52')]===0x0){return db['UserProfileResource'][_0x9364('0x4b')]({'name':_0x3bd8e6[_0x9364('0x35')],'resourceId':_0x3bd8e6['id'],'type':_0x34cba4['name'],'sectionId':_0x34cba4['id']},{})[_0x9364('0x24')](function(){return _0x11060d;});}else{return _0x11060d;}})[_0x9364('0x48')](function(_0x44f064){logger['error'](_0x9364('0x53'),_0x44f064);throw _0x44f064;});}return _0x11060d;})[_0x9364('0x24')](respondWithResult(_0x417538,0xc9))[_0x9364('0x48')](handleError(_0x417538,null));};exports['update']=function(_0x2ae3fd,_0x1fddda){if(_0x2ae3fd['body']['id']){delete _0x2ae3fd[_0x9364('0x4c')]['id'];}return db[_0x9364('0x2f')][_0x9364('0x4a')]({'where':{'id':_0x2ae3fd[_0x9364('0x54')]['id']}})[_0x9364('0x24')](handleEntityNotFound(_0x1fddda,null))[_0x9364('0x24')](saveUpdates(_0x2ae3fd[_0x9364('0x4c')],null))[_0x9364('0x24')](respondWithResult(_0x1fddda,null))['catch'](handleError(_0x1fddda,null));};exports['destroy']=function(_0xca29e7,_0x1d2d87){return db['Disposition'][_0x9364('0x4a')]({'where':{'id':_0xca29e7[_0x9364('0x54')]['id']}})[_0x9364('0x24')](handleEntityNotFound(_0x1d2d87,null))[_0x9364('0x24')](removeEntity(_0x1d2d87,null))[_0x9364('0x48')](handleError(_0x1d2d87,null));}; \ No newline at end of file +var _0xff2a=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject','save','destroy','then','Dispositions','UserProfileResource','end','error','name','send','index','map','Disposition','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','params','rawAttributes','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x59bcc3,_0x10abe4){var _0x26fe7a=function(_0xf7dc7){while(--_0xf7dc7){_0x59bcc3['push'](_0x59bcc3['shift']());}};_0x26fe7a(++_0x10abe4);}(_0xff2a,0x93));var _0xaff2=function(_0x1c6551,_0x3fbc2e){_0x1c6551=_0x1c6551-0x0;var _0x3f7434=_0xff2a[_0x1c6551];return _0x3f7434;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaff2('0x0'));var zipdir=require(_0xaff2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaff2('0x2'));var moment=require(_0xaff2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaff2('0x4'));var util=require('util');var path=require(_0xaff2('0x5'));var sox=require(_0xaff2('0x6'));var csv=require('to-csv');var ejs=require(_0xaff2('0x7'));var fs=require('fs');var fs_extra=require(_0xaff2('0x8'));var _=require(_0xaff2('0x9'));var squel=require(_0xaff2('0xa'));var crypto=require(_0xaff2('0xb'));var jsforce=require(_0xaff2('0xc'));var deskjs=require(_0xaff2('0xd'));var toCsv=require(_0xaff2('0xe'));var querystring=require(_0xaff2('0xf'));var Papa=require(_0xaff2('0x10'));var Redis=require('ioredis');var authService=require(_0xaff2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaff2('0x12'));var logger=require(_0xaff2('0x13'))(_0xaff2('0x14'));var utils=require(_0xaff2('0x15'));var config=require(_0xaff2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaff2('0x17'))['db'];function respondWithStatusCode(_0x175f2c,_0x18e9bf){_0x18e9bf=_0x18e9bf||0xcc;return function(_0x58930b){if(_0x58930b){return _0x175f2c[_0xaff2('0x18')](_0x18e9bf);}return _0x175f2c[_0xaff2('0x19')](_0x18e9bf)['end']();};}function respondWithResult(_0x3388d0,_0x56b2d7){_0x56b2d7=_0x56b2d7||0xc8;return function(_0x259c5d){if(_0x259c5d){return _0x3388d0['status'](_0x56b2d7)['json'](_0x259c5d);}};}function respondWithFilteredResult(_0x32ec13,_0x5186d4){return function(_0x423844){if(_0x423844){var _0x19029b=typeof _0x5186d4[_0xaff2('0x1a')]===_0xaff2('0x1b')&&typeof _0x5186d4[_0xaff2('0x1c')]==='undefined';var _0xd2adb8=_0x423844[_0xaff2('0x1d')];var _0x28b387=_0x19029b?0x0:_0x5186d4[_0xaff2('0x1a')];var _0x18591a=_0x19029b?_0x423844[_0xaff2('0x1d')]:_0x5186d4[_0xaff2('0x1a')]+_0x5186d4['limit'];var _0x2e35e8;if(_0x18591a>=_0xd2adb8){_0x18591a=_0xd2adb8;_0x2e35e8=0xc8;}else{_0x2e35e8=0xce;}_0x32ec13['status'](_0x2e35e8);return _0x32ec13[_0xaff2('0x1e')]('Content-Range',_0x28b387+'-'+_0x18591a+'/'+_0xd2adb8)['json'](_0x423844);}return null;};}function patchUpdates(_0x353ed0){return function(_0x4e1d46){try{jsonpatch['apply'](_0x4e1d46,_0x353ed0,!![]);}catch(_0x26bfc4){return BPromise[_0xaff2('0x1f')](_0x26bfc4);}return _0x4e1d46[_0xaff2('0x20')]();};}function saveUpdates(_0x2d1be8,_0x3e2e81){return function(_0x366ac5){if(_0x366ac5){return _0x366ac5['update'](_0x2d1be8)['then'](function(_0x3d0176){return _0x3d0176;});}return null;};}function removeEntity(_0x211cd7,_0x545e23){return function(_0x50d111){if(_0x50d111){return _0x50d111[_0xaff2('0x21')]()[_0xaff2('0x22')](function(){var _0x2582de=_0x50d111['get']({'plain':!![]});var _0x24ccfb=_0xaff2('0x23');return db[_0xaff2('0x24')][_0xaff2('0x21')]({'where':{'type':_0x24ccfb,'resourceId':_0x2582de['id']}})[_0xaff2('0x22')](function(){return _0x50d111;});})[_0xaff2('0x22')](function(){_0x211cd7[_0xaff2('0x19')](0xcc)[_0xaff2('0x25')]();});}};}function handleEntityNotFound(_0x173365,_0x29ad98){return function(_0x195164){if(!_0x195164){_0x173365[_0xaff2('0x18')](0x194);}return _0x195164;};}function handleError(_0x44d04a,_0x5a4592){_0x5a4592=_0x5a4592||0x1f4;return function(_0x3ccb90){logger[_0xaff2('0x26')](_0x3ccb90['stack']);if(_0x3ccb90[_0xaff2('0x27')]){delete _0x3ccb90[_0xaff2('0x27')];}_0x44d04a['status'](_0x5a4592)[_0xaff2('0x28')](_0x3ccb90);};}exports[_0xaff2('0x29')]=function(_0x3ae7cf,_0x2b6959){var _0x2b3f75={},_0x18774f={},_0x13ab61={'count':0x0,'rows':[]};var _0xde301e=_[_0xaff2('0x2a')](db[_0xaff2('0x2b')]['rawAttributes'],function(_0x552a24){return{'name':_0x552a24['fieldName'],'type':_0x552a24[_0xaff2('0x2c')][_0xaff2('0x2d')]};});_0x18774f['model']=_['map'](_0xde301e,_0xaff2('0x27'));_0x18774f[_0xaff2('0x2e')]=_[_0xaff2('0x2f')](_0x3ae7cf[_0xaff2('0x2e')]);_0x18774f[_0xaff2('0x30')]=_[_0xaff2('0x31')](_0x18774f['model'],_0x18774f[_0xaff2('0x2e')]);_0x2b3f75[_0xaff2('0x32')]=_[_0xaff2('0x31')](_0x18774f[_0xaff2('0x33')],qs[_0xaff2('0x34')](_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x34')]));_0x2b3f75[_0xaff2('0x32')]=_0x2b3f75[_0xaff2('0x32')]['length']?_0x2b3f75['attributes']:_0x18774f[_0xaff2('0x33')];if(!_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x35')](_0xaff2('0x36'))){_0x2b3f75[_0xaff2('0x1c')]=qs[_0xaff2('0x1c')](_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x1c')]);_0x2b3f75['offset']=qs[_0xaff2('0x1a')](_0x3ae7cf['query'][_0xaff2('0x1a')]);}_0x2b3f75['order']=qs['sort'](_0x3ae7cf['query'][_0xaff2('0x37')]);_0x2b3f75['where']=qs[_0xaff2('0x30')](_['pick'](_0x3ae7cf[_0xaff2('0x2e')],_0x18774f[_0xaff2('0x30')]),_0xde301e);if(_0x3ae7cf['query'][_0xaff2('0x38')]){_0x2b3f75[_0xaff2('0x39')]=_['merge'](_0x2b3f75[_0xaff2('0x39')],{'$or':_[_0xaff2('0x2a')](_0xde301e,function(_0x2979d3){if(_0x2979d3[_0xaff2('0x2c')]!==_0xaff2('0x3a')){var _0x41c1a9={};_0x41c1a9[_0x2979d3[_0xaff2('0x27')]]={'$like':'%'+_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x38')]+'%'};return _0x41c1a9;}})});}_0x2b3f75=_[_0xaff2('0x3b')]({},_0x2b3f75,_0x3ae7cf[_0xaff2('0x3c')]);var _0xe5458b={'where':_0x2b3f75['where']};return db['Disposition'][_0xaff2('0x1d')](_0xe5458b)[_0xaff2('0x22')](function(_0x4a1d6f){_0x13ab61[_0xaff2('0x1d')]=_0x4a1d6f;if(_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x3d')]){_0x2b3f75[_0xaff2('0x3e')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2b3f75);})[_0xaff2('0x22')](function(_0x303108){_0x13ab61[_0xaff2('0x3f')]=_0x303108;return _0x13ab61;})[_0xaff2('0x22')](respondWithFilteredResult(_0x2b6959,_0x2b3f75))['catch'](handleError(_0x2b6959,null));};exports['show']=function(_0x2bf3d1,_0x525362){var _0x1738f1={'raw':!![],'where':{'id':_0x2bf3d1[_0xaff2('0x40')]['id']}},_0x317659={};_0x317659['model']=_[_0xaff2('0x2f')](db[_0xaff2('0x2b')][_0xaff2('0x41')]);_0x317659['query']=_[_0xaff2('0x2f')](_0x2bf3d1[_0xaff2('0x2e')]);_0x317659[_0xaff2('0x30')]=_[_0xaff2('0x31')](_0x317659['model'],_0x317659['query']);_0x1738f1[_0xaff2('0x32')]=_[_0xaff2('0x31')](_0x317659['model'],qs[_0xaff2('0x34')](_0x2bf3d1['query']['fields']));_0x1738f1[_0xaff2('0x32')]=_0x1738f1['attributes']['length']?_0x1738f1[_0xaff2('0x32')]:_0x317659[_0xaff2('0x33')];if(_0x2bf3d1[_0xaff2('0x2e')][_0xaff2('0x3d')]){_0x1738f1[_0xaff2('0x3e')]=[{'all':!![]}];}_0x1738f1=_[_0xaff2('0x3b')]({},_0x1738f1,_0x2bf3d1['options']);return db['Disposition'][_0xaff2('0x42')](_0x1738f1)[_0xaff2('0x22')](handleEntityNotFound(_0x525362,null))[_0xaff2('0x22')](respondWithResult(_0x525362,null))[_0xaff2('0x43')](handleError(_0x525362,null));};exports['create']=function(_0xd04518,_0x38f241){return db[_0xaff2('0x2b')][_0xaff2('0x44')](_0xd04518['body'],{})[_0xaff2('0x22')](function(_0x3a76f9){var _0x40f4c3=_0xd04518[_0xaff2('0x45')][_0xaff2('0x46')]({'plain':!![]});if(!_0x40f4c3)throw new Error(_0xaff2('0x47'));if(_0x40f4c3[_0xaff2('0x48')]==='user'){var _0x3e6215=_0x3a76f9[_0xaff2('0x46')]({'plain':!![]});var _0x738157=_0xaff2('0x23');return db[_0xaff2('0x49')][_0xaff2('0x42')]({'where':{'name':_0x738157,'userProfileId':_0x40f4c3['userProfileId']},'raw':!![]})[_0xaff2('0x22')](function(_0x4bbe80){if(_0x4bbe80&&_0x4bbe80[_0xaff2('0x4a')]===0x0){return db[_0xaff2('0x24')]['create']({'name':_0x3e6215[_0xaff2('0x27')],'resourceId':_0x3e6215['id'],'type':_0x4bbe80[_0xaff2('0x27')],'sectionId':_0x4bbe80['id']},{})[_0xaff2('0x22')](function(){return _0x3a76f9;});}else{return _0x3a76f9;}})['catch'](function(_0x5a4dda){logger[_0xaff2('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a4dda);throw _0x5a4dda;});}return _0x3a76f9;})['then'](respondWithResult(_0x38f241,0xc9))[_0xaff2('0x43')](handleError(_0x38f241,null));};exports['update']=function(_0x7be36,_0x46d44f){if(_0x7be36[_0xaff2('0x4b')]['id']){delete _0x7be36[_0xaff2('0x4b')]['id'];}return db[_0xaff2('0x2b')][_0xaff2('0x42')]({'where':{'id':_0x7be36['params']['id']}})[_0xaff2('0x22')](handleEntityNotFound(_0x46d44f,null))[_0xaff2('0x22')](saveUpdates(_0x7be36['body'],null))[_0xaff2('0x22')](respondWithResult(_0x46d44f,null))[_0xaff2('0x43')](handleError(_0x46d44f,null));};exports['destroy']=function(_0x211523,_0xfc920a){return db[_0xaff2('0x2b')][_0xaff2('0x42')]({'where':{'id':_0x211523[_0xaff2('0x40')]['id']}})[_0xaff2('0x22')](handleEntityNotFound(_0xfc920a,null))['then'](removeEntity(_0xfc920a,null))['catch'](handleError(_0xfc920a,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index e468ea4..0a3bc4c 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 _0xdd01=['name_fax','OpenchannelAccountId','name_whatsapp','lodash','api','bluebird','request-promise','rimraf','../../config/environment','exports','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','MailAccountId','SmsAccountId'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdd01,0x159));var _0x1dd0=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xdd01[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x1dd0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1dd0('0x1'));var moment=require('moment');var BPromise=require(_0x1dd0('0x2'));var rp=require(_0x1dd0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1dd0('0x4'));var config=require(_0x1dd0('0x5'));var attributes=require('./disposition.attributes');module[_0x1dd0('0x6')]=function(_0x1a57d3,_0x2664aa){return _0x1a57d3['define'](_0x1dd0('0x7'),attributes,{'tableName':_0x1dd0('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x1dd0('0x9'),_0x1dd0('0xa')]},{'unique':!![],'name':_0x1dd0('0xb'),'fields':['name',_0x1dd0('0xc')]},{'unique':!![],'name':'name_mail','fields':['name',_0x1dd0('0xd')]},{'unique':!![],'name':'name_sms','fields':[_0x1dd0('0x9'),_0x1dd0('0xe')]},{'unique':!![],'name':_0x1dd0('0xf'),'fields':['name','FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x1dd0('0x9'),_0x1dd0('0x10')]},{'unique':!![],'name':_0x1dd0('0x11'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf609=['WhatsappAccountId','lodash','util','../../config/logger','api','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId'];(function(_0x3569e7,_0x163809){var _0x15c795=function(_0x105584){while(--_0x105584){_0x3569e7['push'](_0x3569e7['shift']());}};_0x15c795(++_0x163809);}(_0xf609,0x114));var _0x9f60=function(_0x4861b1,_0x3522aa){_0x4861b1=_0x4861b1-0x0;var _0x45e1ff=_0xf609[_0x4861b1];return _0x45e1ff;};'use strict';var _=require(_0x9f60('0x0'));var util=require(_0x9f60('0x1'));var logger=require(_0x9f60('0x2'))(_0x9f60('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f60('0x4'));var rimraf=require('rimraf');var config=require(_0x9f60('0x5'));var attributes=require(_0x9f60('0x6'));module[_0x9f60('0x7')]=function(_0xf64006,_0x3adeb8){return _0xf64006[_0x9f60('0x8')](_0x9f60('0x9'),attributes,{'tableName':_0x9f60('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9f60('0xb'),'fields':[_0x9f60('0xc'),_0x9f60('0xd')]},{'unique':!![],'name':_0x9f60('0xe'),'fields':['name',_0x9f60('0xf')]},{'unique':!![],'name':_0x9f60('0x10'),'fields':[_0x9f60('0xc'),_0x9f60('0x11')]},{'unique':!![],'name':_0x9f60('0x12'),'fields':[_0x9f60('0xc'),_0x9f60('0x13')]},{'unique':!![],'name':_0x9f60('0x14'),'fields':[_0x9f60('0xc'),_0x9f60('0x15')]},{'unique':!![],'name':_0x9f60('0x16'),'fields':['name',_0x9f60('0x17')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x9f60('0xc'),_0x9f60('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index abd5ff1..75050dc 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(_0x4b9270,_0x5ec53b){var _0x2fd58f=function(_0x159059){while(--_0x159059){_0x4b9270['push'](_0x4b9270['shift']());}};_0x2fd58f(++_0x5ec53b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x58b1ef,_0x3f6448){var _0xa89cf5=function(_0x4410ce){while(--_0x4410ce){_0x58b1ef['push'](_0x58b1ef['shift']());}};_0xa89cf5(++_0x3f6448);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 9a316cd..1b280ac 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 _0x4a9b=['get','isAuthenticated','index','show','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4489f2,_0x1f9128){var _0x5cc527=function(_0x44201f){while(--_0x44201f){_0x4489f2['push'](_0x4489f2['shift']());}};_0x5cc527(++_0x1f9128);}(_0x4a9b,0x1f0));var _0xb4a9=function(_0x325348,_0x26b555){_0x325348=_0x325348-0x0;var _0x3391a8=_0x4a9b[_0x325348];return _0x3391a8;};'use strict';var multer=require(_0xb4a9('0x0'));var util=require('util');var path=require(_0xb4a9('0x1'));var timeout=require(_0xb4a9('0x2'));var express=require(_0xb4a9('0x3'));var router=express[_0xb4a9('0x4')]();var fs_extra=require(_0xb4a9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb4a9('0x6'));var config=require(_0xb4a9('0x7'));var controller=require('./disposition.controller');router[_0xb4a9('0x8')]('/',auth[_0xb4a9('0x9')](),controller[_0xb4a9('0xa')]);router[_0xb4a9('0x8')]('/:id',auth[_0xb4a9('0x9')](),controller[_0xb4a9('0xb')]);router['post']('/',auth[_0xb4a9('0x9')](),controller[_0xb4a9('0xc')]);router[_0xb4a9('0xd')](_0xb4a9('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xb4a9('0xf')]('/:id',auth[_0xb4a9('0x9')](),controller[_0xb4a9('0x10')]);module[_0xb4a9('0x11')]=router; \ No newline at end of file +var _0x8cba=['isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x68f29e,_0x11d6f8){var _0x3a6a9d=function(_0x56d303){while(--_0x56d303){_0x68f29e['push'](_0x68f29e['shift']());}};_0x3a6a9d(++_0x11d6f8);}(_0x8cba,0x7a));var _0xa8cb=function(_0x478e2f,_0xcc2041){_0x478e2f=_0x478e2f-0x0;var _0x4b088d=_0x8cba[_0x478e2f];return _0x4b088d;};'use strict';var multer=require(_0xa8cb('0x0'));var util=require(_0xa8cb('0x1'));var path=require(_0xa8cb('0x2'));var timeout=require(_0xa8cb('0x3'));var express=require(_0xa8cb('0x4'));var router=express[_0xa8cb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa8cb('0x6'));var interaction=require(_0xa8cb('0x7'));var config=require(_0xa8cb('0x8'));var controller=require(_0xa8cb('0x9'));router[_0xa8cb('0xa')]('/',auth[_0xa8cb('0xb')](),controller[_0xa8cb('0xc')]);router[_0xa8cb('0xa')](_0xa8cb('0xd'),auth[_0xa8cb('0xb')](),controller['show']);router[_0xa8cb('0xe')]('/',auth[_0xa8cb('0xb')](),controller['create']);router[_0xa8cb('0xf')](_0xa8cb('0xd'),auth['isAuthenticated'](),controller[_0xa8cb('0x10')]);router[_0xa8cb('0x11')](_0xa8cb('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xa8cb('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 7136e41..7d8c12c 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 _0xc6ac=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','7200','INTEGER','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x170837,_0x4eec82){var _0x4a89d8=function(_0x2f470e){while(--_0x2f470e){_0x170837['push'](_0x170837['shift']());}};_0x4a89d8(++_0x4eec82);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1d759c,_0x1cb0cd){_0x1d759c=_0x1d759c-0x0;var _0x44f7f1=_0xc6ac[_0x1d759c];return _0x44f7f1;};'use strict';var Sequelize=require(_0xcc6a('0x0'));module[_0xcc6a('0x1')]={'name':{'type':Sequelize[_0xcc6a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcc6a('0x2')]},'ecm':{'type':Sequelize[_0xcc6a('0x3')](_0xcc6a('0x4'),'no'),'defaultValue':_0xcc6a('0x4')},'headerinfo':{'type':Sequelize[_0xcc6a('0x2')],'defaultValue':_0xcc6a('0x5')},'localstationid':{'type':Sequelize[_0xcc6a('0x2')],'unique':_0xcc6a('0x6')},'minrate':{'type':Sequelize[_0xcc6a('0x3')](_0xcc6a('0x7'),_0xcc6a('0x8'),'7200',_0xcc6a('0x9'),_0xcc6a('0xa'),_0xcc6a('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xcc6a('0x3')](_0xcc6a('0x7'),_0xcc6a('0x8'),_0xcc6a('0xc'),_0xcc6a('0x9'),'12000',_0xcc6a('0xb')),'defaultValue':_0xcc6a('0xb')},'modem':{'type':Sequelize[_0xcc6a('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xcc6a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xcc6a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xcc6a('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0xcc6a('0xe'),_0xcc6a('0xf'),_0xcc6a('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcc6a('0x11')],'defaultValue':function(){return _0xcc6a('0x12');}},'notificationSound':{'type':Sequelize[_0xcc6a('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcc6a('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcc6a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcc6a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcc6a('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcc6a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xcc6a('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xcc6a('0x13')],'defaultValue':![],'comment':_0xcc6a('0x15'),'set':function(_0x3e63d9){if(!_0x3e63d9)this[_0xcc6a('0x16')](_0xcc6a('0x17'),null);this[_0xcc6a('0x16')](_0xcc6a('0x18'),_0x3e63d9);}}}; \ No newline at end of file +var _0x5334=['SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','14400','2400','7200','9600','v17,v27,v29'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x5334,0x84));var _0x4533=function(_0x979079,_0x5e9be5){_0x979079=_0x979079-0x0;var _0x2303c2=_0x5334[_0x979079];return _0x2303c2;};'use strict';var Sequelize=require(_0x4533('0x0'));module[_0x4533('0x1')]={'name':{'type':Sequelize[_0x4533('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4533('0x2')]},'ecm':{'type':Sequelize[_0x4533('0x3')]('yes','no'),'defaultValue':_0x4533('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x4533('0x5')},'localstationid':{'type':Sequelize[_0x4533('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM']('2400',_0x4533('0x6'),'7200','9600','12000',_0x4533('0x7')),'defaultValue':_0x4533('0x6')},'maxrate':{'type':Sequelize[_0x4533('0x3')](_0x4533('0x8'),_0x4533('0x6'),_0x4533('0x9'),_0x4533('0xa'),'12000',_0x4533('0x7')),'defaultValue':_0x4533('0x7')},'modem':{'type':Sequelize[_0x4533('0x2')],'defaultValue':_0x4533('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4533('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4533('0x3')](_0x4533('0xc'),_0x4533('0xd'),_0x4533('0xe'),'KHOMP'),'defaultValue':_0x4533('0xc')},'key':{'type':Sequelize[_0x4533('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4533('0xf')],'defaultValue':function(){return _0x4533('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4533('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4533('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4533('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4533('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4533('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0x4533('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4533('0x14'),'set':function(_0x4f732e){if(!_0x4f732e)this[_0x4533('0x15')](_0x4533('0x16'),null);this['setDataValue'](_0x4533('0x17'),_0x4f732e);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index d03ee55..bda3269 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 _0x943f=['params','mandatoryDispositionPause','fields','merge','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','appdata','Answer','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','maxrate','minrate','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','CmContact','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','show'];(function(_0xa0cf3,_0x261d3f){var _0x5f4018=function(_0x4acfaa){while(--_0x4acfaa){_0xa0cf3['push'](_0xa0cf3['shift']());}};_0x5f4018(++_0x261d3f);}(_0x943f,0x13a));var _0xf943=function(_0x3a6568,_0xd3df53){_0x3a6568=_0x3a6568-0x0;var _0x12b620=_0x943f[_0x3a6568];return _0x12b620;};'use strict';var emlformat=require(_0xf943('0x0'));var rimraf=require(_0xf943('0x1'));var zipdir=require(_0xf943('0x2'));var jsonpatch=require(_0xf943('0x3'));var rp=require('request-promise');var moment=require(_0xf943('0x4'));var BPromise=require(_0xf943('0x5'));var Mustache=require('mustache');var util=require(_0xf943('0x6'));var path=require(_0xf943('0x7'));var sox=require(_0xf943('0x8'));var csv=require(_0xf943('0x9'));var ejs=require(_0xf943('0xa'));var fs=require('fs');var fs_extra=require(_0xf943('0xb'));var _=require('lodash');var squel=require(_0xf943('0xc'));var crypto=require(_0xf943('0xd'));var jsforce=require(_0xf943('0xe'));var deskjs=require(_0xf943('0xf'));var toCsv=require(_0xf943('0x9'));var querystring=require(_0xf943('0x10'));var Papa=require('papaparse');var Redis=require(_0xf943('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf943('0x12'));var as=require(_0xf943('0x13'));var hardwareService=require(_0xf943('0x14'));var logger=require(_0xf943('0x15'))('api');var utils=require(_0xf943('0x16'));var config=require(_0xf943('0x17'));var licenseUtil=require(_0xf943('0x18'));var db=require(_0xf943('0x19'))['db'];config[_0xf943('0x1a')]=_[_0xf943('0x1b')](config[_0xf943('0x1a')],{'host':_0xf943('0x1c'),'port':0x18eb});var socket=require(_0xf943('0x1d'))(new Redis(config[_0xf943('0x1a')]));require(_0xf943('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xf943('0x1f')][_0xf943('0x20')]({'port':0x232c});var client9002=jayson[_0xf943('0x1f')][_0xf943('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x137c00,_0x1c0c3b,_0x4032d6,_0x320f4f){return new BPromise(function(_0x5df8fe,_0x3457ab){var _0x1f93ba=_0x320f4f||client;return _0x1f93ba[_0xf943('0x21')](_0x137c00,_0x4032d6)[_0xf943('0x22')](function(_0x29eabb){logger['info']('FaxAccount,\x20%s,\x20%s',_0x1c0c3b,_0xf943('0x23'));logger[_0xf943('0x24')](_0xf943('0x25'),_0x1c0c3b,_0xf943('0x23'),JSON[_0xf943('0x26')](_0x29eabb));if(_0x29eabb['error']){if(_0x29eabb['error']['code']===0x1f4){logger[_0xf943('0x27')](_0xf943('0x28'),_0x1c0c3b,_0x29eabb[_0xf943('0x27')][_0xf943('0x29')]);return _0x3457ab(_0x29eabb[_0xf943('0x27')]['message']);}logger[_0xf943('0x27')](_0xf943('0x28'),_0x1c0c3b,_0x29eabb[_0xf943('0x27')][_0xf943('0x29')]);return _0x5df8fe(_0x29eabb['error'][_0xf943('0x29')]);}else{logger['info'](_0xf943('0x28'),_0x1c0c3b,_0xf943('0x23'));_0x5df8fe(_0x29eabb[_0xf943('0x2a')][_0xf943('0x29')]);}})[_0xf943('0x2b')](function(_0x7609b7){logger[_0xf943('0x27')](_0xf943('0x28'),_0x1c0c3b,_0x7609b7);_0x3457ab(_0x7609b7);});});}function respondWithStatusCode(_0x5486fc,_0x4368a4){_0x4368a4=_0x4368a4||0xcc;return function(_0x5bec47){if(_0x5bec47){return _0x5486fc[_0xf943('0x2c')](_0x4368a4);}return _0x5486fc['status'](_0x4368a4)[_0xf943('0x2d')]();};}function respondWithResult(_0x143744,_0x2871f7){_0x2871f7=_0x2871f7||0xc8;return function(_0x50b319){if(_0x50b319){return _0x143744[_0xf943('0x2e')](_0x2871f7)['json'](_0x50b319);}};}function respondWithFilteredResult(_0x2fbd4d,_0x72bce0){return function(_0x3b975c){if(_0x3b975c){var _0x16ef31=typeof _0x72bce0[_0xf943('0x2f')]===_0xf943('0x30')&&typeof _0x72bce0[_0xf943('0x31')]===_0xf943('0x30');var _0x27d410=_0x3b975c[_0xf943('0x32')];var _0x2c5ac5=_0x16ef31?0x0:_0x72bce0[_0xf943('0x2f')];var _0x4a4f8e=_0x16ef31?_0x3b975c[_0xf943('0x32')]:_0x72bce0['offset']+_0x72bce0[_0xf943('0x31')];var _0x5757f2;if(_0x4a4f8e>=_0x27d410){_0x4a4f8e=_0x27d410;_0x5757f2=0xc8;}else{_0x5757f2=0xce;}_0x2fbd4d[_0xf943('0x2e')](_0x5757f2);return _0x2fbd4d[_0xf943('0x33')]('Content-Range',_0x2c5ac5+'-'+_0x4a4f8e+'/'+_0x27d410)[_0xf943('0x34')](_0x3b975c);}return null;};}function patchUpdates(_0x6dd4fc){return function(_0x96965b){try{jsonpatch[_0xf943('0x35')](_0x96965b,_0x6dd4fc,!![]);}catch(_0x42618f){return BPromise[_0xf943('0x36')](_0x42618f);}return _0x96965b[_0xf943('0x37')]();};}function saveUpdates(_0x16efdb,_0x4aaa9e){return function(_0x5c4e38){if(_0x5c4e38){return _0x5c4e38[_0xf943('0x38')](_0x16efdb)[_0xf943('0x22')](function(_0x59ce95){return _0x59ce95;});}return null;};}function removeEntity(_0x2e5633,_0x29b377){return function(_0x488233){if(_0x488233){return _0x488233['destroy']()[_0xf943('0x22')](function(){var _0x7ad71b=_0x488233[_0xf943('0x39')]({'plain':!![]});var _0x15edf0=_0xf943('0x3a');return db[_0xf943('0x3b')][_0xf943('0x3c')]({'where':{'type':_0x15edf0,'resourceId':_0x7ad71b['id']}})[_0xf943('0x22')](function(){return _0x488233;});})['then'](function(){_0x2e5633[_0xf943('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa6fa04,_0x4d1307){return function(_0x38a4dc){if(!_0x38a4dc){_0xa6fa04[_0xf943('0x2c')](0x194);}return _0x38a4dc;};}function handleError(_0x3eda57,_0x2fb56d){_0x2fb56d=_0x2fb56d||0x1f4;return function(_0x55797b){logger[_0xf943('0x27')](_0x55797b[_0xf943('0x3d')]);if(_0x55797b[_0xf943('0x3e')]){delete _0x55797b[_0xf943('0x3e')];}_0x3eda57[_0xf943('0x2e')](_0x2fb56d)['send'](_0x55797b);};}exports[_0xf943('0x3f')]=function(_0x5040a5,_0x3ce258){var _0x403a5b={'include':[{'model':db[_0xf943('0x40')],'as':'mandatoryDispositionPause'}]},_0x3cbcb9={},_0x590b59={'count':0x0,'rows':[]};var _0x53ff4a=_[_0xf943('0x41')](db[_0xf943('0x42')][_0xf943('0x43')],function(_0x5a31f4){return{'name':_0x5a31f4[_0xf943('0x44')],'type':_0x5a31f4[_0xf943('0x45')][_0xf943('0x46')]};});_0x3cbcb9[_0xf943('0x47')]=_[_0xf943('0x41')](_0x53ff4a,'name');_0x3cbcb9[_0xf943('0x48')]=_[_0xf943('0x49')](_0x5040a5['query']);_0x3cbcb9[_0xf943('0x4a')]=_['intersection'](_0x3cbcb9[_0xf943('0x47')],_0x3cbcb9[_0xf943('0x48')]);_0x403a5b[_0xf943('0x4b')]=_[_0xf943('0x4c')](_0x3cbcb9[_0xf943('0x47')],qs['fields'](_0x5040a5[_0xf943('0x48')]['fields']));_0x403a5b[_0xf943('0x4b')]=_0x403a5b[_0xf943('0x4b')][_0xf943('0x4d')]?_0x403a5b['attributes']:_0x3cbcb9[_0xf943('0x47')];if(!_0x5040a5[_0xf943('0x48')][_0xf943('0x4e')](_0xf943('0x4f'))){_0x403a5b[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x5040a5['query']['limit']);_0x403a5b['offset']=qs['offset'](_0x5040a5[_0xf943('0x48')]['offset']);}_0x403a5b[_0xf943('0x50')]=qs[_0xf943('0x51')](_0x5040a5[_0xf943('0x48')][_0xf943('0x51')]);_0x403a5b[_0xf943('0x52')]=qs[_0xf943('0x4a')](_['pick'](_0x5040a5[_0xf943('0x48')],_0x3cbcb9['filters']),_0x53ff4a);if(_0x5040a5[_0xf943('0x48')][_0xf943('0x53')]){_0x403a5b[_0xf943('0x52')]=_['merge'](_0x403a5b['where'],{'$or':_[_0xf943('0x41')](_0x53ff4a,function(_0x368bbc){if(_0x368bbc['type']!==_0xf943('0x54')){var _0x243267={};_0x243267[_0x368bbc['name']]={'$like':'%'+_0x5040a5['query']['filter']+'%'};return _0x243267;}})});}_0x403a5b=_['merge']({},_0x403a5b,_0x5040a5[_0xf943('0x55')]);var _0x359261={'where':_0x403a5b[_0xf943('0x52')]};return db[_0xf943('0x42')][_0xf943('0x32')](_0x359261)[_0xf943('0x22')](function(_0x5b6bb8){_0x590b59[_0xf943('0x32')]=_0x5b6bb8;if(_0x5040a5[_0xf943('0x48')][_0xf943('0x56')]){_0x403a5b[_0xf943('0x57')]=[{'all':!![]}];}return db['FaxAccount'][_0xf943('0x58')](_0x403a5b);})[_0xf943('0x22')](function(_0x4133b0){_0x590b59['rows']=_0x4133b0;return _0x590b59;})['then'](respondWithFilteredResult(_0x3ce258,_0x403a5b))[_0xf943('0x2b')](handleError(_0x3ce258,null));};exports[_0xf943('0x59')]=function(_0x530060,_0x3c3c7b){var _0x595fae={'raw':![],'where':{'id':_0x530060[_0xf943('0x5a')]['id']},'include':[{'model':db[_0xf943('0x40')],'as':_0xf943('0x5b')}]},_0x4879e2={};_0x4879e2['model']=_[_0xf943('0x49')](db['FaxAccount'][_0xf943('0x43')]);_0x4879e2[_0xf943('0x48')]=_[_0xf943('0x49')](_0x530060[_0xf943('0x48')]);_0x4879e2[_0xf943('0x4a')]=_['intersection'](_0x4879e2[_0xf943('0x47')],_0x4879e2[_0xf943('0x48')]);_0x595fae['attributes']=_[_0xf943('0x4c')](_0x4879e2[_0xf943('0x47')],qs['fields'](_0x530060[_0xf943('0x48')][_0xf943('0x5c')]));_0x595fae[_0xf943('0x4b')]=_0x595fae['attributes'][_0xf943('0x4d')]?_0x595fae['attributes']:_0x4879e2['model'];if(_0x530060['query'][_0xf943('0x56')]){_0x595fae['include']=[{'all':!![]}];}_0x595fae=_[_0xf943('0x5d')]({},_0x595fae,_0x530060[_0xf943('0x55')]);return db[_0xf943('0x42')]['find'](_0x595fae)['then'](handleEntityNotFound(_0x3c3c7b,null))[_0xf943('0x22')](respondWithResult(_0x3c3c7b,null))['catch'](handleError(_0x3c3c7b,null));};exports['create']=function(_0x27c140,_0x11004a){return db['FaxAccount']['create'](_0x27c140['body'],{})[_0xf943('0x22')](function(_0x357b12){var _0x27b782=_0x27c140[_0xf943('0x5e')][_0xf943('0x39')]({'plain':!![]});if(!_0x27b782)throw new Error(_0xf943('0x5f'));if(_0x27b782[_0xf943('0x60')]===_0xf943('0x5e')){var _0x3788f7=_0x357b12[_0xf943('0x39')]({'plain':!![]});var _0x3bd53f=_0xf943('0x3a');return db['UserProfileSection'][_0xf943('0x61')]({'where':{'name':_0x3bd53f,'userProfileId':_0x27b782[_0xf943('0x62')]},'raw':!![]})[_0xf943('0x22')](function(_0x2b9d08){if(_0x2b9d08&&_0x2b9d08[_0xf943('0x63')]===0x0){return db[_0xf943('0x3b')][_0xf943('0x64')]({'name':_0x3788f7['name'],'resourceId':_0x3788f7['id'],'type':_0x2b9d08[_0xf943('0x3e')],'sectionId':_0x2b9d08['id']},{})[_0xf943('0x22')](function(){return _0x357b12;});}else{return _0x357b12;}})[_0xf943('0x2b')](function(_0x2459f9){logger[_0xf943('0x27')](_0xf943('0x65'),_0x2459f9);throw _0x2459f9;});}return _0x357b12;})[_0xf943('0x22')](respondWithResult(_0x11004a,0xc9))[_0xf943('0x2b')](handleError(_0x11004a,null));};exports['update']=function(_0x1bae77,_0x361dc3){if(_0x1bae77[_0xf943('0x66')]['id']){delete _0x1bae77[_0xf943('0x66')]['id'];}return db[_0xf943('0x42')][_0xf943('0x61')]({'where':{'id':_0x1bae77[_0xf943('0x5a')]['id']},'include':[{'model':db[_0xf943('0x40')],'as':_0xf943('0x5b')}]})[_0xf943('0x22')](handleEntityNotFound(_0x361dc3,null))[_0xf943('0x22')](saveUpdates(_0x1bae77[_0xf943('0x66')],null))[_0xf943('0x22')](respondWithResult(_0x361dc3,null))[_0xf943('0x2b')](handleError(_0x361dc3,null));};exports[_0xf943('0x3c')]=function(_0x12694c,_0x257864){return db[_0xf943('0x42')]['find']({'where':{'id':_0x12694c['params']['id']}})['then'](handleEntityNotFound(_0x257864,null))['then'](removeEntity(_0x257864,null))[_0xf943('0x2b')](handleError(_0x257864,null));};exports[_0xf943('0x67')]=function(_0x1329d9,_0x5a8cb2){return db[_0xf943('0x42')][_0xf943('0x67')]()[_0xf943('0x22')](respondWithResult(_0x5a8cb2,null))[_0xf943('0x2b')](handleError(_0x5a8cb2,null));};exports[_0xf943('0x68')]=function(_0x35a4ae,_0x1554e8,_0x16ae16){if(_0x35a4ae['body']['id']){delete _0x35a4ae[_0xf943('0x66')]['id'];}return db[_0xf943('0x42')][_0xf943('0x61')]({'where':{'id':_0x35a4ae[_0xf943('0x5a')]['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x1554e8,null))[_0xf943('0x22')](function(_0x570d64){if(_0x570d64){_0x35a4ae[_0xf943('0x66')][_0xf943('0x69')]=_0x570d64['id'];return db[_0xf943('0x6a')][_0xf943('0x64')](_0x35a4ae[_0xf943('0x66')]);}})[_0xf943('0x22')](respondWithResult(_0x1554e8,null))[_0xf943('0x2b')](handleError(_0x1554e8,null));};exports[_0xf943('0x6b')]=function(_0x292794,_0x5a8e5a,_0x3ae63a){var _0x2cdc50={'raw':![],'where':{}};var _0x3add9b={};var _0x4ba58b={'count':0x0,'rows':[]};return db[_0xf943('0x42')][_0xf943('0x6c')]({'where':{'id':_0x292794[_0xf943('0x5a')]['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x5a8e5a,null))['then'](function(_0x4b92f4){if(_0x4b92f4){_0x3add9b[_0xf943('0x47')]=_[_0xf943('0x49')](db[_0xf943('0x6a')][_0xf943('0x43')]);_0x3add9b[_0xf943('0x48')]=_[_0xf943('0x49')](_0x292794[_0xf943('0x48')]);_0x3add9b[_0xf943('0x4a')]=_[_0xf943('0x4c')](_0x3add9b[_0xf943('0x47')],_0x3add9b['query']);_0x2cdc50['attributes']=_[_0xf943('0x4c')](_0x3add9b[_0xf943('0x47')],qs[_0xf943('0x5c')](_0x292794[_0xf943('0x48')][_0xf943('0x5c')]));_0x2cdc50[_0xf943('0x4b')]=_0x2cdc50['attributes'][_0xf943('0x4d')]?_0x2cdc50['attributes']:_0x3add9b[_0xf943('0x47')];if(!_0x292794[_0xf943('0x48')][_0xf943('0x4e')](_0xf943('0x4f'))){_0x2cdc50[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x292794[_0xf943('0x48')][_0xf943('0x31')]);_0x2cdc50[_0xf943('0x2f')]=qs[_0xf943('0x2f')](_0x292794[_0xf943('0x48')]['offset']);}_0x2cdc50[_0xf943('0x50')]=qs['sort'](_0x292794[_0xf943('0x48')][_0xf943('0x51')]);_0x2cdc50[_0xf943('0x52')]=qs[_0xf943('0x4a')](_[_0xf943('0x6d')](_0x292794['query'],_0x3add9b['filters']));_0x2cdc50[_0xf943('0x52')][_0xf943('0x69')]=_0x4b92f4['id'];if(_0x292794[_0xf943('0x48')][_0xf943('0x53')]){_0x2cdc50['where']=_[_0xf943('0x5d')](_0x2cdc50['where'],{'$or':_['map'](_0x2cdc50[_0xf943('0x4b')],function(_0x3be152){var _0x866749={};_0x866749[_0x3be152]={'$like':'%'+_0x292794['query'][_0xf943('0x53')]+'%'};return _0x866749;})});}_0x2cdc50=_[_0xf943('0x5d')]({},_0x2cdc50,_0x292794[_0xf943('0x55')]);return db[_0xf943('0x6a')][_0xf943('0x32')]({'where':_0x2cdc50[_0xf943('0x52')]})['then'](function(_0x417758){_0x4ba58b['count']=_0x417758;if(_0x292794[_0xf943('0x48')][_0xf943('0x56')]){_0x2cdc50[_0xf943('0x57')]=[{'all':!![]}];}return db[_0xf943('0x6a')][_0xf943('0x58')](_0x2cdc50);})[_0xf943('0x22')](function(_0x9e41c2){_0x4ba58b[_0xf943('0x6e')]=_0x9e41c2;return _0x4ba58b;});}})[_0xf943('0x22')](respondWithFilteredResult(_0x5a8e5a,_0x2cdc50))['catch'](handleError(_0x5a8e5a,null));};exports[_0xf943('0x6f')]=function(_0x163de7,_0x157cad,_0x32668d){return db['FaxAccount'][_0xf943('0x61')]({'where':{'id':_0x163de7['params']['id']}})['then'](handleEntityNotFound(_0x157cad,null))[_0xf943('0x22')](function(_0x555948){if(_0x555948){return _0x555948[_0xf943('0x6f')](_0x163de7[_0xf943('0x48')][_0xf943('0x70')]);}})[_0xf943('0x22')](respondWithStatusCode(_0x157cad,null))[_0xf943('0x2b')](handleError(_0x157cad,null));};exports[_0xf943('0x71')]=function(_0x395eba,_0x3ce548,_0x33c420){if(_0x395eba[_0xf943('0x66')]['id']){delete _0x395eba[_0xf943('0x66')]['id'];}return db[_0xf943('0x42')]['find']({'where':{'id':_0x395eba[_0xf943('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3ce548,null))['then'](function(_0x4c086a){if(_0x4c086a){_0x395eba[_0xf943('0x66')]['FaxAccountId']=_0x4c086a['id'];return db[_0xf943('0x72')][_0xf943('0x64')](_0x395eba[_0xf943('0x66')]);}})[_0xf943('0x22')](respondWithResult(_0x3ce548,null))[_0xf943('0x2b')](handleError(_0x3ce548,null));};exports['getAnswers']=function(_0x7a105,_0x425998,_0x3ff448){var _0x11fafe={'raw':![],'where':{}};var _0x9baee4={};var _0x5a8da4={'count':0x0,'rows':[]};return db[_0xf943('0x42')][_0xf943('0x6c')]({'where':{'id':_0x7a105['params']['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x425998,null))[_0xf943('0x22')](function(_0x50162d){if(_0x50162d){_0x9baee4[_0xf943('0x47')]=_['keys'](db['CannedAnswer'][_0xf943('0x43')]);_0x9baee4['query']=_[_0xf943('0x49')](_0x7a105['query']);_0x9baee4[_0xf943('0x4a')]=_['intersection'](_0x9baee4['model'],_0x9baee4[_0xf943('0x48')]);_0x11fafe['attributes']=_[_0xf943('0x4c')](_0x9baee4[_0xf943('0x47')],qs[_0xf943('0x5c')](_0x7a105[_0xf943('0x48')][_0xf943('0x5c')]));_0x11fafe[_0xf943('0x4b')]=_0x11fafe[_0xf943('0x4b')][_0xf943('0x4d')]?_0x11fafe[_0xf943('0x4b')]:_0x9baee4[_0xf943('0x47')];if(!_0x7a105[_0xf943('0x48')]['hasOwnProperty'](_0xf943('0x4f'))){_0x11fafe['limit']=qs[_0xf943('0x31')](_0x7a105['query']['limit']);_0x11fafe[_0xf943('0x2f')]=qs[_0xf943('0x2f')](_0x7a105[_0xf943('0x48')][_0xf943('0x2f')]);}_0x11fafe[_0xf943('0x50')]=qs[_0xf943('0x51')](_0x7a105[_0xf943('0x48')][_0xf943('0x51')]);_0x11fafe['where']=qs['filters'](_[_0xf943('0x6d')](_0x7a105[_0xf943('0x48')],_0x9baee4['filters']));_0x11fafe['where'][_0xf943('0x69')]=_0x50162d['id'];if(_0x7a105['query'][_0xf943('0x53')]){_0x11fafe[_0xf943('0x52')]=_['merge'](_0x11fafe[_0xf943('0x52')],{'$or':_[_0xf943('0x41')](_0x11fafe[_0xf943('0x4b')],function(_0x53350c){var _0x246873={};_0x246873[_0x53350c]={'$like':'%'+_0x7a105[_0xf943('0x48')]['filter']+'%'};return _0x246873;})});}_0x11fafe=_['merge']({},_0x11fafe,_0x7a105['options']);return db['CannedAnswer']['count']({'where':_0x11fafe[_0xf943('0x52')]})[_0xf943('0x22')](function(_0x1fa866){_0x5a8da4['count']=_0x1fa866;if(_0x7a105[_0xf943('0x48')][_0xf943('0x56')]){_0x11fafe[_0xf943('0x57')]=[{'all':!![]}];}return db[_0xf943('0x72')][_0xf943('0x58')](_0x11fafe);})[_0xf943('0x22')](function(_0x45a7db){_0x5a8da4[_0xf943('0x6e')]=_0x45a7db;return _0x5a8da4;});}})[_0xf943('0x22')](respondWithFilteredResult(_0x425998,_0x11fafe))['catch'](handleError(_0x425998,null));};exports['removeAnswers']=function(_0x582d21,_0x495403,_0x1effeb){return db[_0xf943('0x42')]['find']({'where':{'id':_0x582d21[_0xf943('0x5a')]['id']}})['then'](handleEntityNotFound(_0x495403,null))['then'](function(_0x59cb78){if(_0x59cb78){return _0x59cb78['removeAnswers'](_0x582d21[_0xf943('0x48')][_0xf943('0x70')]);}})[_0xf943('0x22')](respondWithStatusCode(_0x495403,null))['catch'](handleError(_0x495403,null));};exports[_0xf943('0x73')]=function(_0x27b83a,_0x5c1e0a,_0x5924bb){return db[_0xf943('0x74')][_0xf943('0x61')]({'where':{'id':_0x27b83a['params']['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x5c1e0a,null))[_0xf943('0x22')](function(_0x221bf0){if(_0x221bf0){return _0x221bf0['addInteraction'](_0x27b83a[_0xf943('0x66')][_0xf943('0x70')],_[_0xf943('0x75')](_0x27b83a[_0xf943('0x66')],['ids','id'])||{});}})[_0xf943('0x22')](respondWithResult(_0x5c1e0a,null))[_0xf943('0x2b')](handleError(_0x5c1e0a,null));};exports[_0xf943('0x76')]=function(_0x50521c,_0x58687c,_0x3445e0){var _0x268d50={'raw':![],'where':{}};var _0x448d74={};var _0x12cf5f={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x50521c['params']['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x58687c,null))[_0xf943('0x22')](function(_0x2f692d){if(_0x2f692d){_0x448d74[_0xf943('0x47')]=_[_0xf943('0x49')](db[_0xf943('0x74')][_0xf943('0x43')]);_0x448d74['query']=_[_0xf943('0x49')](_0x50521c['query']);_0x448d74['filters']=_[_0xf943('0x4c')](_0x448d74[_0xf943('0x47')],_0x448d74['query']);_0x268d50[_0xf943('0x4b')]=_[_0xf943('0x4c')](_0x448d74['model'],qs[_0xf943('0x5c')](_0x50521c[_0xf943('0x48')][_0xf943('0x5c')]));_0x268d50[_0xf943('0x4b')]=_0x268d50[_0xf943('0x4b')]['length']?_0x268d50[_0xf943('0x4b')]:_0x448d74[_0xf943('0x47')];if(!_0x50521c[_0xf943('0x48')][_0xf943('0x4e')](_0xf943('0x4f'))){_0x268d50[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x50521c[_0xf943('0x48')][_0xf943('0x31')]);_0x268d50[_0xf943('0x2f')]=qs[_0xf943('0x2f')](_0x50521c['query'][_0xf943('0x2f')]);}_0x268d50[_0xf943('0x50')]=qs[_0xf943('0x51')](_0x50521c[_0xf943('0x48')]['sort']);_0x268d50[_0xf943('0x52')]=qs[_0xf943('0x4a')](_['pick'](_0x50521c[_0xf943('0x48')],_0x448d74[_0xf943('0x4a')]));_0x268d50[_0xf943('0x52')][_0xf943('0x69')]=_0x2f692d['id'];if(_0x50521c[_0xf943('0x48')][_0xf943('0x53')]){_0x268d50['where']=_[_0xf943('0x5d')](_0x268d50['where'],{'$or':_[_0xf943('0x41')](_0x268d50[_0xf943('0x4b')],function(_0x3b341a){var _0x315a53={};_0x315a53[_0x3b341a]={'$like':'%'+_0x50521c['query'][_0xf943('0x53')]+'%'};return _0x315a53;})});}_0x268d50=_['merge']({},_0x268d50,_0x50521c['options']);return db['FaxInteraction']['count']({'where':_0x268d50['where']})[_0xf943('0x22')](function(_0x22e8a2){_0x12cf5f[_0xf943('0x32')]=_0x22e8a2;if(_0x50521c[_0xf943('0x48')][_0xf943('0x56')]){_0x268d50[_0xf943('0x57')]=[{'model':db['CmContact'],'as':_0xf943('0x77'),'required':![]},{'model':db[_0xf943('0x78')],'as':_0xf943('0x79'),'attributes':[_0xf943('0x3e'),_0xf943('0x7a'),_0xf943('0x7b')],'required':![]},{'model':db['Tag'],'as':_0xf943('0x7c'),'attributes':['id',_0xf943('0x3e'),_0xf943('0x7d')],'where':_0x50521c[_0xf943('0x48')][_0xf943('0x7e')]?{'id':_0x50521c['query']['tag']}:undefined,'required':_0x50521c[_0xf943('0x48')][_0xf943('0x7e')]?!![]:![]}];}return db[_0xf943('0x74')]['findAll'](_0x268d50);})['then'](function(_0x188ab4){_0x12cf5f['rows']=_0x188ab4;return _0x12cf5f;});}})[_0xf943('0x22')](respondWithFilteredResult(_0x58687c,_0x268d50))[_0xf943('0x2b')](handleError(_0x58687c,null));};exports[_0xf943('0x7f')]=function(_0x507fcc,_0x2421d9){var _0x14529b=_0x507fcc[_0xf943('0x5a')]['id'];var _0x1cc5bf=_0x507fcc['body'];var _0x4b23a7=0xc8;var _0x242bf0=null;return db[_0xf943('0x80')][_0xf943('0x81')]({'isolationLevel':db[_0xf943('0x80')][_0xf943('0x82')][_0xf943('0x83')][_0xf943('0x84')]},function(_0xe37f2e){return db[_0xf943('0x42')]['findOne']({'where':{'id':_0x14529b},'transaction':_0xe37f2e})[_0xf943('0x22')](function(_0x568b51){if(_0x568b51){return db[_0xf943('0x85')][_0xf943('0x3c')]({'where':{'FaxAccountId':_0x14529b},'transaction':_0xe37f2e})[_0xf943('0x22')](function(){var _0x57366e=_[_0xf943('0x41')](_0x1cc5bf,function(_0x21f93a){_0x21f93a['FaxAccountId']=_0x14529b;return _0x21f93a;});return db[_0xf943('0x85')][_0xf943('0x86')](_0x57366e,{'transaction':_0xe37f2e});});}else{_0x4b23a7=0x194;_0x242bf0=[];}});})[_0xf943('0x22')](function(){if(_0x4b23a7!==0x194){return db[_0xf943('0x85')]['findAndCountAll']({'where':{'FaxAccountId':_0x14529b},'order':_0xf943('0x87')})[_0xf943('0x22')](function(_0x544185){_0x242bf0=_0x544185;});}})[_0xf943('0x2b')](function(_0x1875e1){_0x4b23a7=0x1f4;logger[_0xf943('0x27')](_0x1875e1[_0xf943('0x3d')]);if(_0x1875e1[_0xf943('0x3e')]){delete _0x1875e1[_0xf943('0x3e')];}_0x242bf0=_0x1875e1;})['finally'](function(){if(_0x242bf0===null){_0x2421d9[_0xf943('0x2c')](_0x4b23a7);}else{if(_0x4b23a7===0x1f4){_0x2421d9['status'](_0x4b23a7)['send'](_0x242bf0);}else{_0x2421d9[_0xf943('0x2e')](_0x4b23a7)[_0xf943('0x34')](_0x242bf0);}}});};exports[_0xf943('0x88')]=function(_0x1c3d38,_0x5e6121,_0x2bb701){var _0x388d35={};var _0x3ce750={};var _0x29c382;var _0x388326;return db[_0xf943('0x42')][_0xf943('0x6c')]({'where':{'id':_0x1c3d38[_0xf943('0x5a')]['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x5e6121,null))[_0xf943('0x22')](function(_0x4ab68b){if(_0x4ab68b){_0x29c382=_0x4ab68b;_0x3ce750[_0xf943('0x47')]=_[_0xf943('0x49')](db[_0xf943('0x85')]['rawAttributes']);_0x3ce750[_0xf943('0x48')]=_[_0xf943('0x49')](_0x1c3d38[_0xf943('0x48')]);_0x3ce750[_0xf943('0x4a')]=_[_0xf943('0x4c')](_0x3ce750[_0xf943('0x47')],_0x3ce750[_0xf943('0x48')]);_0x388d35[_0xf943('0x4b')]=_[_0xf943('0x4c')](_0x3ce750['model'],qs[_0xf943('0x5c')](_0x1c3d38['query'][_0xf943('0x5c')]));_0x388d35[_0xf943('0x4b')]=_0x388d35[_0xf943('0x4b')][_0xf943('0x4d')]?_0x388d35[_0xf943('0x4b')]:_0x3ce750[_0xf943('0x47')];_0x388d35[_0xf943('0x50')]=qs[_0xf943('0x51')](_0x1c3d38[_0xf943('0x48')]['sort']);_0x388d35[_0xf943('0x52')]=qs[_0xf943('0x4a')](_['pick'](_0x1c3d38['query'],_0x3ce750[_0xf943('0x4a')]));if(_0x1c3d38[_0xf943('0x48')][_0xf943('0x53')]){_0x388d35[_0xf943('0x52')]=_['merge'](_0x388d35[_0xf943('0x52')],{'$or':_[_0xf943('0x41')](_0x388d35[_0xf943('0x4b')],function(_0x229b34){var _0xb48e44={};_0xb48e44[_0x229b34]={'$like':'%'+_0x1c3d38[_0xf943('0x48')]['filter']+'%'};return _0xb48e44;})});}_0x388d35=_[_0xf943('0x5d')]({},_0x388d35,_0x1c3d38['options']);return _0x29c382[_0xf943('0x88')](_0x388d35);}})[_0xf943('0x22')](function(_0x297651){if(_0x297651){_0x388326=_0x297651[_0xf943('0x4d')];if(!_0x1c3d38['query'][_0xf943('0x4e')]('nolimit')){_0x388d35[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x1c3d38[_0xf943('0x48')]['limit']);_0x388d35[_0xf943('0x2f')]=qs[_0xf943('0x2f')](_0x1c3d38[_0xf943('0x48')][_0xf943('0x2f')]);}return _0x29c382[_0xf943('0x88')](_0x388d35);}})[_0xf943('0x22')](function(_0x1a996a){if(_0x1a996a){return _0x1a996a?{'count':_0x388326,'rows':_0x1a996a}:null;}})[_0xf943('0x22')](respondWithResult(_0x5e6121,null))[_0xf943('0x2b')](handleError(_0x5e6121,null));};function Extension(_0x2fcfbc,_0x32b6b4,_0x27b694,_0x4ea53d){this[_0xf943('0x89')]=_0xf943('0x8a');this[_0xf943('0x8b')]=_0x2fcfbc[_0xf943('0x8c')];this[_0xf943('0x8d')]=_0x4ea53d;this['type']=_0xf943('0x8e');this[_0xf943('0x8f')]='Fax\x20Extension';this[_0xf943('0x69')]=_0x2fcfbc['id'];this[_0xf943('0x87')]=_0x32b6b4;this[_0xf943('0x90')]=_0x27b694;}function createExtensionsReciveFax(_0x4852a5){var _0x278b03=0x1;var _0x4aba83=[];_0x4aba83['push'](new Extension(_0x4852a5,_0x278b03,'',_0xf943('0x91')));_0x278b03+=0x1;_0x4aba83[_0xf943('0x92')](new Extension(_0x4852a5,_0x278b03,_0xf943('0x93'),_0xf943('0x94')));_0x278b03+=0x1;for(var _0x4c47cc in _0x4852a5){if(_0x4852a5[_0xf943('0x4e')](_0x4c47cc)&&(_0x4c47cc==='ecm'||_0x4c47cc===_0xf943('0x8c')||_0x4c47cc===_0xf943('0x95')||_0x4c47cc===_0xf943('0x96')||_0x4c47cc==='headerinfo'||_0x4c47cc===_0xf943('0x97')||_0x4c47cc===_0xf943('0x98')||_0x4c47cc==='modem'||_0x4c47cc==='t38timeout')){_0x4aba83['push'](new Extension(_0x4852a5,_0x278b03,_0xf943('0x99')+_0x4c47cc+')='+_0x4852a5[_0x4c47cc],'Set'));_0x278b03+=0x1;}}_0x4aba83[_0xf943('0x92')](new Extension(_0x4852a5,_0x278b03,'6','Wait'));_0x278b03+=0x1;_0x4aba83[_0xf943('0x92')](new Extension(_0x4852a5,_0x278b03,_0xf943('0x9a'),_0xf943('0x9b')));_0x278b03=0x0;return _0x4aba83;}exports[_0xf943('0x9c')]=function(_0x19ec5b,_0x25277f,_0xb1b04d){var _0x1e5397;return db[_0xf943('0x80')][_0xf943('0x81')](function(_0x12621f){return db['FaxAccount'][_0xf943('0x64')](_0x19ec5b[_0xf943('0x66')],{'transaction':_0x12621f})[_0xf943('0x22')](function(_0x6392d5){_0x1e5397=_0x6392d5[_0xf943('0x39')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x1e5397),{'transaction':_0x12621f});});})[_0xf943('0x22')](function(){return _0x1e5397;})[_0xf943('0x22')](respondWithResult(_0x25277f,null))[_0xf943('0x2b')](handleError(_0x25277f,null));};exports[_0xf943('0x9d')]=function(_0x52851d,_0x37508a,_0x4750d8){var _0x4ff37e;return db[_0xf943('0x80')][_0xf943('0x81')](function(_0x133904){return db[_0xf943('0x42')]['update'](_0x52851d[_0xf943('0x66')],{'where':{'id':_0x52851d['body']['id']},'transaction':_0x133904})[_0xf943('0x22')](function(_0x26028c){return db[_0xf943('0x9e')][_0xf943('0x3c')]({'where':{'FaxAccountId':_0x52851d[_0xf943('0x66')]['id']},'transaction':_0x133904})[_0xf943('0x22')](function(_0x1d3b43){return db['VoiceExtension'][_0xf943('0x86')](createExtensionsReciveFax(_[_0xf943('0x75')](_0x52851d[_0xf943('0x66')],[_0xf943('0x9f'),_0xf943('0x46'),_0xf943('0xa0'),_0xf943('0xa1'),'TrunkId',_0xf943('0xa2')])),{'transaction':_0x133904});});});})[_0xf943('0x22')](function(){return db[_0xf943('0x42')][_0xf943('0xa3')](_0x52851d[_0xf943('0x66')]['id']);})[_0xf943('0x22')](respondWithResult(_0x37508a,null))['catch'](handleError(_0x37508a,null));};exports[_0xf943('0xa4')]=function(_0x41a297,_0x58e9a8,_0xf9750c){var _0x12fe86={'raw':!![],'where':{}};var _0x35f307={};var _0x457b1e={'count':0x0,'rows':[]};return db[_0xf943('0x42')]['findOne']({'where':{'id':_0x41a297[_0xf943('0x5a')]['id']}})['then'](handleEntityNotFound(_0x58e9a8,null))[_0xf943('0x22')](function(_0x2c9960){if(_0x2c9960){_0x35f307['model']=_[_0xf943('0x49')](db[_0xf943('0xa5')][_0xf943('0x43')]);_0x35f307[_0xf943('0x48')]=_['keys'](_0x41a297[_0xf943('0x48')]);_0x35f307[_0xf943('0x4a')]=_[_0xf943('0x4c')](_0x35f307[_0xf943('0x47')],_0x35f307[_0xf943('0x48')]);_0x12fe86[_0xf943('0x4b')]=_[_0xf943('0x4c')](_0x35f307['model'],qs[_0xf943('0x5c')](_0x41a297['query']['fields']));_0x12fe86['attributes']=_0x12fe86['attributes'][_0xf943('0x4d')]?_0x12fe86[_0xf943('0x4b')]:_0x35f307[_0xf943('0x47')];if(!_0x41a297[_0xf943('0x48')][_0xf943('0x4e')](_0xf943('0x4f'))){_0x12fe86[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x41a297['query']['limit']);_0x12fe86[_0xf943('0x2f')]=qs['offset'](_0x41a297[_0xf943('0x48')][_0xf943('0x2f')]);}_0x12fe86['order']=qs[_0xf943('0x51')](_0x41a297[_0xf943('0x48')][_0xf943('0x51')]);_0x12fe86['where']=qs[_0xf943('0x4a')](_['pick'](_0x41a297[_0xf943('0x48')],_0x35f307[_0xf943('0x4a')]));_0x12fe86['where']['FaxAccountId']=_0x2c9960['id'];if(_0x41a297['query'][_0xf943('0x53')]){_0x12fe86[_0xf943('0x52')]=_[_0xf943('0x5d')](_0x12fe86[_0xf943('0x52')],{'$or':_[_0xf943('0x41')](_0x12fe86[_0xf943('0x4b')],function(_0x19c518){var _0x37b4af={};_0x37b4af[_0x19c518]={'$like':'%'+_0x41a297['query'][_0xf943('0x53')]+'%'};return _0x37b4af;})});}if(_0x41a297[_0xf943('0x48')]['$gte']){var _0x3e14d7=_0x41a297[_0xf943('0x48')]['$gte'][_0xf943('0xa6')](',');var _0x1963e7={};_0x1963e7[_0x3e14d7[0x0]]={'$gte':moment(_0x3e14d7[0x1])[_0xf943('0xa7')](_0xf943('0xa8'))};_0x12fe86['where']=_[_0xf943('0x5d')](_0x12fe86[_0xf943('0x52')],_0x1963e7);}_0x12fe86=_[_0xf943('0x5d')]({},_0x12fe86,_0x41a297[_0xf943('0x55')]);return db[_0xf943('0xa5')][_0xf943('0x32')]({'where':_0x12fe86[_0xf943('0x52')]})[_0xf943('0x22')](function(_0x14414e){_0x457b1e[_0xf943('0x32')]=_0x14414e;if(_0x41a297['query'][_0xf943('0x56')]){_0x12fe86[_0xf943('0x57')]=[{'all':!![]}];}return db[_0xf943('0xa5')][_0xf943('0x58')](_0x12fe86);})[_0xf943('0x22')](function(_0x50a754){_0x457b1e[_0xf943('0x6e')]=_0x50a754;return _0x457b1e;});}})[_0xf943('0x22')](respondWithFilteredResult(_0x58e9a8,_0x12fe86))[_0xf943('0x2b')](handleError(_0x58e9a8,null));};exports[_0xf943('0xa9')]=function(_0x3ff8b7,_0x3a8e9b,_0x3142d6){var _0x1c4822,_0x46bd9d={},_0x2eee04;if(_0x3ff8b7[_0xf943('0x66')]['to']){_0x2eee04=_0x3ff8b7['body']['to'][0x0];}return db['FaxAccount'][_0xf943('0x61')]({'where':{'id':_0x3ff8b7['params']['id']},'include':[{'model':db[_0xf943('0xaa')],'as':_0xf943('0xab'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x2eee04},'limit':0x1,'order':[['updatedAt',_0xf943('0xac')]]}]}]})[_0xf943('0x22')](handleEntityNotFound(_0x3a8e9b,null))['then'](function(_0x241bcb){_0x1c4822=_0x241bcb;if(_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')]&&_0x3ff8b7[_0xf943('0x66')]['attachments'][_0xf943('0x4d')]){for(var _0x551d0e=0x0;_0x551d0e<_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')]['length'];_0x551d0e+=0x1){_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][_0x551d0e]={'filename':_0x3ff8b7['body'][_0xf943('0xad')][_0x551d0e]['name'],'id':_0x3ff8b7['body'][_0xf943('0xad')][_0x551d0e]['id'],'path':path[_0xf943('0xae')](config[_0xf943('0xaf')],_0xf943('0xb0'),_0x3ff8b7[_0xf943('0x66')]['attachments'][_0x551d0e][_0xf943('0xb1')])};}}return respondWithRpcPromise(_0xf943('0xb2'),_0xf943('0xb2'),{'FaxAccountId':_[_0xf943('0xb3')](_0x3ff8b7[_0xf943('0x5a')]['id'])?undefined:_0x3ff8b7['params']['id'],'path':_[_0xf943('0xb3')](_0x3ff8b7['body'][_0xf943('0xad')][0x0][_0xf943('0x7')])?undefined:_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0]['path'],'fax':_[_0xf943('0xb3')](_0x3ff8b7[_0xf943('0x66')]['to'][0x0])?undefined:_0x3ff8b7[_0xf943('0x66')]['to'][0x0]},client9002);})[_0xf943('0x22')](function(){if(_0x1c4822){if(_[_0xf943('0xb3')](_0x3ff8b7['body'][_0xf943('0xb4')])){_0x3ff8b7[_0xf943('0x66')]['from']=util[_0xf943('0xa7')](_0xf943('0xb5'),_0x1c4822['name'],_0x1c4822[_0xf943('0xb6')]);}if(_0x1c4822[_0xf943('0xab')]){if(_0x1c4822['List'][_0xf943('0xb7')][_0xf943('0x4d')]){return _0x1c4822['List'][_0xf943('0xb7')][0x0];}else{return db[_0xf943('0xb8')]['create'](_['defaults'](_0x3ff8b7[_0xf943('0x66')],{'firstName':_0x3ff8b7[_0xf943('0x66')]['to'][0x0],'phone':_0x3ff8b7[_0xf943('0x66')]['to'][0x0],'fax':_0x3ff8b7['body']['to'][0x0],'ListId':_0x1c4822[_0xf943('0xa2')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xf943('0xb9'));}})[_0xf943('0x22')](function(_0x5da753){if(_0x5da753){return db[_0xf943('0x74')]['find']({'where':{'ContactId':_0x5da753['id'],'closed':![],'FaxAccountId':_0x1c4822['id']}})['then'](function(_0x43d297){if(_0x43d297){return[_0x43d297,![]];}return db[_0xf943('0x74')][_0xf943('0x64')]({'UserId':_0x3ff8b7[_0xf943('0x5e')]['id'],'ContactId':_0x5da753['id'],'FaxAccountId':_0x1c4822['id'],'fax':_0x3ff8b7[_0xf943('0x66')]['to'][0x0],'firstMsgDirection':_0xf943('0xba'),'Messages':[_[_0xf943('0x5d')](_0x3ff8b7[_0xf943('0x66')],{'read':![],'body':_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0][_0xf943('0xbb')],'FaxAccountId':_0x1c4822['id'],'UserId':_0x3ff8b7[_0xf943('0x5e')]['id'],'ContactId':_0x5da753['id'],'AttachmentId':_0x3ff8b7['body'][_0xf943('0xad')][0x0]['id']})]},{'include':[{'model':db[_0xf943('0xa5')],'as':'Messages'}]})[_0xf943('0x22')](function(_0x1692ef){return[_0x1692ef,!![]];});});}else{throw new Error(_0xf943('0xbc'));}})[_0xf943('0xbd')](function(_0x2664db,_0x574386){if(_0x574386){return _0x2664db;}return db[_0xf943('0xa5')][_0xf943('0x64')]({'direction':_0xf943('0xba'),'read':![],'body':_0x3ff8b7[_0xf943('0x66')]['attachments'][0x0][_0xf943('0xbb')],'FaxAccountId':_0x1c4822['id'],'FaxInteractionId':_0x2664db['id'],'UserId':_0x3ff8b7[_0xf943('0x5e')]['id'],'ContactId':_0x2664db[_0xf943('0xbe')],'AttachmentId':_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0]['id']})[_0xf943('0x22')](function(_0x7402dd){_0x2664db[_0xf943('0xbf')]['Messages']=[];_0x2664db[_0xf943('0xbf')][_0xf943('0xc0')]['push'](_0x7402dd['dataValues']);return _0x2664db;});})[_0xf943('0x22')](function(_0x48b707){respondWithRpcPromise(_0xf943('0xc1'),_0xf943('0xc1'),{'FaxAccountId':_[_0xf943('0xb3')](_0x3ff8b7[_0xf943('0x5a')]['id'])?undefined:_0x3ff8b7[_0xf943('0x5a')]['id'],'path':_[_0xf943('0xb3')](_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0]['path'])?undefined:_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0][_0xf943('0x7')],'fax':_[_0xf943('0xb3')](_0x3ff8b7[_0xf943('0x66')]['to'][0x0])?undefined:_0x3ff8b7['body']['to'][0x0],'AttachmentId':_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0]['id']},client9002)['then'](function(_0x267f16){logger['info'](_0xf943('0xc2'),_0x267f16);})[_0xf943('0x2b')](function(_0x46de8d){logger['info'](_0xf943('0xc2'),_0x46de8d);});return _0x48b707;})[_0xf943('0x22')](respondWithResult(_0x3a8e9b,null))[_0xf943('0x2b')](handleError(_0x3a8e9b,null));};exports[_0xf943('0xc3')]=function(_0xfa548a,_0x88025a,_0xcebcb2){return db[_0xf943('0x42')][_0xf943('0x61')]({'where':{'id':_0xfa548a[_0xf943('0x5a')]['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x88025a,null))[_0xf943('0x22')](function(_0x2c3a81){if(_0x2c3a81){return _0x2c3a81[_0xf943('0xc3')](_0xfa548a[_0xf943('0x66')][_0xf943('0x70')],_[_0xf943('0x75')](_0xfa548a['body'],[_0xf943('0x70'),'id'])||{})[_0xf943('0xbd')](function(_0x5d8283){for(var _0x1bc3bd=0x0;_0x1bc3bd<_0xfa548a[_0xf943('0x66')][_0xf943('0x70')][_0xf943('0x4d')];_0x1bc3bd+=0x1){socket[_0xf943('0xc4')](_0xf943('0xc5'),{'UserId':Number(_0xfa548a[_0xf943('0x66')][_0xf943('0x70')][_0x1bc3bd]),'FaxAccountId':Number(_0xfa548a[_0xf943('0x5a')]['id'])});}return _0x5d8283;});}})['then'](respondWithResult(_0x88025a,null))[_0xf943('0x2b')](handleError(_0x88025a,null));};exports[_0xf943('0xc6')]=function(_0x4760d3,_0x36313f,_0x43e88e){return db[_0xf943('0x42')][_0xf943('0x61')]({'where':{'id':_0x4760d3['params']['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x36313f,null))[_0xf943('0x22')](function(_0x31765f){if(_0x31765f){return _0x31765f['removeAgents'](_0x4760d3[_0xf943('0x48')][_0xf943('0x70')])[_0xf943('0x22')](function(){if(_[_0xf943('0xc7')](_0x4760d3['query'][_0xf943('0x70')])){for(var _0x87ce9b=0x0;_0x87ce9b<_0x4760d3[_0xf943('0x48')]['ids']['length'];_0x87ce9b+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x4760d3[_0xf943('0x48')][_0xf943('0x70')][_0x87ce9b]),'FaxAccountId':Number(_0x4760d3['params']['id'])});}}else{socket[_0xf943('0xc4')](_0xf943('0xc8'),{'UserId':Number(_0x4760d3[_0xf943('0x48')][_0xf943('0x70')]),'FaxAccountId':Number(_0x4760d3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x36313f,null))['catch'](handleError(_0x36313f,null));};exports[_0xf943('0xc9')]=function(_0x201a88,_0x2c3eef,_0x1f253f){var _0x5b7076={};var _0x2e0196={};var _0x186322;var _0x2beb06;return db[_0xf943('0x42')][_0xf943('0x6c')]({'where':{'id':_0x201a88['params']['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x2c3eef,null))[_0xf943('0x22')](function(_0x3b04ea){if(_0x3b04ea){_0x186322=_0x3b04ea;_0x2e0196['model']=_[_0xf943('0x49')](db[_0xf943('0x78')][_0xf943('0x43')]);_0x2e0196[_0xf943('0x48')]=_[_0xf943('0x49')](_0x201a88[_0xf943('0x48')]);_0x2e0196[_0xf943('0x4a')]=_['intersection'](_0x2e0196['model'],_0x2e0196[_0xf943('0x48')]);_0x5b7076['attributes']=_[_0xf943('0x4c')](_0x2e0196[_0xf943('0x47')],qs[_0xf943('0x5c')](_0x201a88[_0xf943('0x48')]['fields']));_0x5b7076[_0xf943('0x4b')]=_0x5b7076[_0xf943('0x4b')][_0xf943('0x4d')]?_0x5b7076[_0xf943('0x4b')]:_0x2e0196['model'];_0x5b7076[_0xf943('0x50')]=qs['sort'](_0x201a88[_0xf943('0x48')]['sort']);_0x5b7076[_0xf943('0x52')]=qs[_0xf943('0x4a')](_[_0xf943('0x6d')](_0x201a88[_0xf943('0x48')],_0x2e0196[_0xf943('0x4a')]));if(_0x201a88[_0xf943('0x48')][_0xf943('0x53')]){_0x5b7076[_0xf943('0x52')]=_['merge'](_0x5b7076[_0xf943('0x52')],{'$or':_[_0xf943('0x41')](_0x5b7076[_0xf943('0x4b')],function(_0x4236f6){var _0x127d75={};_0x127d75[_0x4236f6]={'$like':'%'+_0x201a88[_0xf943('0x48')][_0xf943('0x53')]+'%'};return _0x127d75;})});}_0x5b7076=_[_0xf943('0x5d')]({},_0x5b7076,_0x201a88['options']);return _0x186322[_0xf943('0xc9')](_0x5b7076);}})[_0xf943('0x22')](function(_0x15396d){if(_0x15396d){_0x2beb06=_0x15396d[_0xf943('0x4d')];if(!_0x201a88['query']['hasOwnProperty'](_0xf943('0x4f'))){_0x5b7076[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x201a88[_0xf943('0x48')][_0xf943('0x31')]);_0x5b7076[_0xf943('0x2f')]=qs[_0xf943('0x2f')](_0x201a88[_0xf943('0x48')]['offset']);}return _0x186322[_0xf943('0xc9')](_0x5b7076);}})['then'](function(_0x3a336b){if(_0x3a336b){return _0x3a336b?{'count':_0x2beb06,'rows':_0x3a336b}:null;}})['then'](respondWithResult(_0x2c3eef,null))[_0xf943('0x2b')](handleError(_0x2c3eef,null));}; \ No newline at end of file +var _0x10dd=['debug','stringify','code','error','message','result','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','destroy','get','FaxAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','where','include','rows','show','params','includeAll','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','CannedAnswer','nolimit','removeAnswers','FaxInteraction','addInteraction','ids','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','send','getApplications','context','exten','app','system','description','Fax\x20Extension','appdata','push','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','to-csv','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','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3a1f81,_0x3caa8d){var _0x5bef88=function(_0x1024ae){while(--_0x1024ae){_0x3a1f81['push'](_0x3a1f81['shift']());}};_0x5bef88(++_0x3caa8d);}(_0x10dd,0xa2));var _0xd10d=function(_0x176ae9,_0x290de7){_0x176ae9=_0x176ae9-0x0;var _0x2e5ea5=_0x10dd[_0x176ae9];return _0x2e5ea5;};'use strict';var emlformat=require(_0xd10d('0x0'));var rimraf=require(_0xd10d('0x1'));var zipdir=require(_0xd10d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd10d('0x3'));var BPromise=require(_0xd10d('0x4'));var Mustache=require(_0xd10d('0x5'));var util=require(_0xd10d('0x6'));var path=require(_0xd10d('0x7'));var sox=require(_0xd10d('0x8'));var csv=require('to-csv');var ejs=require(_0xd10d('0x9'));var fs=require('fs');var fs_extra=require(_0xd10d('0xa'));var _=require(_0xd10d('0xb'));var squel=require('squel');var crypto=require(_0xd10d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd10d('0xd'));var querystring=require(_0xd10d('0xe'));var Papa=require(_0xd10d('0xf'));var Redis=require(_0xd10d('0x10'));var authService=require(_0xd10d('0x11'));var qs=require(_0xd10d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd10d('0x13'));var logger=require(_0xd10d('0x14'))(_0xd10d('0x15'));var utils=require('../../config/utils');var config=require(_0xd10d('0x16'));var licenseUtil=require(_0xd10d('0x17'));var db=require(_0xd10d('0x18'))['db'];config[_0xd10d('0x19')]=_[_0xd10d('0x1a')](config[_0xd10d('0x19')],{'host':_0xd10d('0x1b'),'port':0x18eb});var socket=require(_0xd10d('0x1c'))(new Redis(config[_0xd10d('0x19')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0xd10d('0x1d'));var client=jayson['client'][_0xd10d('0x1e')]({'port':0x232c});var client9002=jayson[_0xd10d('0x1f')][_0xd10d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x29d4c9,_0x49324d,_0x2ecad0,_0x2dcd5b){return new BPromise(function(_0x2f4f18,_0x22a841){var _0x6198bc=_0x2dcd5b||client;return _0x6198bc[_0xd10d('0x20')](_0x29d4c9,_0x2ecad0)[_0xd10d('0x21')](function(_0x390dc9){logger[_0xd10d('0x22')](_0xd10d('0x23'),_0x49324d,_0xd10d('0x24'));logger[_0xd10d('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x49324d,_0xd10d('0x24'),JSON[_0xd10d('0x26')](_0x390dc9));if(_0x390dc9['error']){if(_0x390dc9['error'][_0xd10d('0x27')]===0x1f4){logger[_0xd10d('0x28')](_0xd10d('0x23'),_0x49324d,_0x390dc9['error'][_0xd10d('0x29')]);return _0x22a841(_0x390dc9[_0xd10d('0x28')][_0xd10d('0x29')]);}logger[_0xd10d('0x28')](_0xd10d('0x23'),_0x49324d,_0x390dc9['error'][_0xd10d('0x29')]);return _0x2f4f18(_0x390dc9[_0xd10d('0x28')][_0xd10d('0x29')]);}else{logger[_0xd10d('0x22')](_0xd10d('0x23'),_0x49324d,_0xd10d('0x24'));_0x2f4f18(_0x390dc9[_0xd10d('0x2a')][_0xd10d('0x29')]);}})['catch'](function(_0x5f0184){logger['error'](_0xd10d('0x23'),_0x49324d,_0x5f0184);_0x22a841(_0x5f0184);});});}function respondWithStatusCode(_0x4e3074,_0x5e4c06){_0x5e4c06=_0x5e4c06||0xcc;return function(_0x8b5a4){if(_0x8b5a4){return _0x4e3074[_0xd10d('0x2b')](_0x5e4c06);}return _0x4e3074['status'](_0x5e4c06)[_0xd10d('0x2c')]();};}function respondWithResult(_0x4db554,_0x37f7cd){_0x37f7cd=_0x37f7cd||0xc8;return function(_0x4bdf02){if(_0x4bdf02){return _0x4db554[_0xd10d('0x2d')](_0x37f7cd)[_0xd10d('0x2e')](_0x4bdf02);}};}function respondWithFilteredResult(_0x319535,_0x30e0a8){return function(_0x5bf212){if(_0x5bf212){var _0x59d871=typeof _0x30e0a8[_0xd10d('0x2f')]==='undefined'&&typeof _0x30e0a8[_0xd10d('0x30')]===_0xd10d('0x31');var _0xd10443=_0x5bf212[_0xd10d('0x32')];var _0x52f28a=_0x59d871?0x0:_0x30e0a8[_0xd10d('0x2f')];var _0x4deaa9=_0x59d871?_0x5bf212['count']:_0x30e0a8['offset']+_0x30e0a8[_0xd10d('0x30')];var _0x1ff46f;if(_0x4deaa9>=_0xd10443){_0x4deaa9=_0xd10443;_0x1ff46f=0xc8;}else{_0x1ff46f=0xce;}_0x319535[_0xd10d('0x2d')](_0x1ff46f);return _0x319535[_0xd10d('0x33')](_0xd10d('0x34'),_0x52f28a+'-'+_0x4deaa9+'/'+_0xd10443)[_0xd10d('0x2e')](_0x5bf212);}return null;};}function patchUpdates(_0x42ead8){return function(_0x315c0b){try{jsonpatch['apply'](_0x315c0b,_0x42ead8,!![]);}catch(_0x23e7ce){return BPromise[_0xd10d('0x35')](_0x23e7ce);}return _0x315c0b['save']();};}function saveUpdates(_0x2b7be7,_0x32e177){return function(_0x5f04cc){if(_0x5f04cc){return _0x5f04cc['update'](_0x2b7be7)[_0xd10d('0x21')](function(_0x59269e){return _0x59269e;});}return null;};}function removeEntity(_0x32ebe4,_0x15da04){return function(_0x1ee6c2){if(_0x1ee6c2){return _0x1ee6c2[_0xd10d('0x36')]()[_0xd10d('0x21')](function(){var _0x4c37ea=_0x1ee6c2[_0xd10d('0x37')]({'plain':!![]});var _0x3ddf60=_0xd10d('0x38');return db[_0xd10d('0x39')]['destroy']({'where':{'type':_0x3ddf60,'resourceId':_0x4c37ea['id']}})['then'](function(){return _0x1ee6c2;});})['then'](function(){_0x32ebe4[_0xd10d('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x598881,_0x40deb3){return function(_0x410f02){if(!_0x410f02){_0x598881[_0xd10d('0x2b')](0x194);}return _0x410f02;};}function handleError(_0x130efb,_0x59c614){_0x59c614=_0x59c614||0x1f4;return function(_0x2f694a){logger['error'](_0x2f694a['stack']);if(_0x2f694a[_0xd10d('0x3a')]){delete _0x2f694a['name'];}_0x130efb[_0xd10d('0x2d')](_0x59c614)['send'](_0x2f694a);};}exports[_0xd10d('0x3b')]=function(_0x3b3ace,_0x2f9a06){var _0xd4b6bd={'include':[{'model':db[_0xd10d('0x3c')],'as':_0xd10d('0x3d')}]},_0x3782e4={},_0x37b926={'count':0x0,'rows':[]};var _0x30a293=_['map'](db[_0xd10d('0x3e')][_0xd10d('0x3f')],function(_0x11f18c){return{'name':_0x11f18c['fieldName'],'type':_0x11f18c[_0xd10d('0x40')][_0xd10d('0x41')]};});_0x3782e4['model']=_[_0xd10d('0x42')](_0x30a293,_0xd10d('0x3a'));_0x3782e4[_0xd10d('0x43')]=_[_0xd10d('0x44')](_0x3b3ace[_0xd10d('0x43')]);_0x3782e4[_0xd10d('0x45')]=_[_0xd10d('0x46')](_0x3782e4['model'],_0x3782e4[_0xd10d('0x43')]);_0xd4b6bd['attributes']=_[_0xd10d('0x46')](_0x3782e4[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0x3b3ace[_0xd10d('0x43')][_0xd10d('0x48')]));_0xd4b6bd[_0xd10d('0x49')]=_0xd4b6bd['attributes'][_0xd10d('0x4a')]?_0xd4b6bd[_0xd10d('0x49')]:_0x3782e4[_0xd10d('0x47')];if(!_0x3b3ace['query'][_0xd10d('0x4b')]('nolimit')){_0xd4b6bd[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x3b3ace['query'][_0xd10d('0x30')]);_0xd4b6bd[_0xd10d('0x2f')]=qs[_0xd10d('0x2f')](_0x3b3ace[_0xd10d('0x43')][_0xd10d('0x2f')]);}_0xd4b6bd[_0xd10d('0x4c')]=qs[_0xd10d('0x4d')](_0x3b3ace['query'][_0xd10d('0x4d')]);_0xd4b6bd['where']=qs['filters'](_[_0xd10d('0x4e')](_0x3b3ace[_0xd10d('0x43')],_0x3782e4[_0xd10d('0x45')]),_0x30a293);if(_0x3b3ace[_0xd10d('0x43')][_0xd10d('0x4f')]){_0xd4b6bd['where']=_[_0xd10d('0x50')](_0xd4b6bd['where'],{'$or':_[_0xd10d('0x42')](_0x30a293,function(_0x77c43c){if(_0x77c43c[_0xd10d('0x40')]!==_0xd10d('0x51')){var _0x401d2a={};_0x401d2a[_0x77c43c[_0xd10d('0x3a')]]={'$like':'%'+_0x3b3ace[_0xd10d('0x43')][_0xd10d('0x4f')]+'%'};return _0x401d2a;}})});}_0xd4b6bd=_[_0xd10d('0x50')]({},_0xd4b6bd,_0x3b3ace['options']);var _0x5aa1c0={'where':_0xd4b6bd[_0xd10d('0x52')]};return db['FaxAccount'][_0xd10d('0x32')](_0x5aa1c0)[_0xd10d('0x21')](function(_0x1ffba7){_0x37b926[_0xd10d('0x32')]=_0x1ffba7;if(_0x3b3ace[_0xd10d('0x43')]['includeAll']){_0xd4b6bd[_0xd10d('0x53')]=[{'all':!![]}];}return db[_0xd10d('0x3e')]['findAll'](_0xd4b6bd);})[_0xd10d('0x21')](function(_0x1a6340){_0x37b926[_0xd10d('0x54')]=_0x1a6340;return _0x37b926;})[_0xd10d('0x21')](respondWithFilteredResult(_0x2f9a06,_0xd4b6bd))['catch'](handleError(_0x2f9a06,null));};exports[_0xd10d('0x55')]=function(_0x330b54,_0x2de81c){var _0xf8d379={'raw':![],'where':{'id':_0x330b54[_0xd10d('0x56')]['id']},'include':[{'model':db[_0xd10d('0x3c')],'as':_0xd10d('0x3d')}]},_0x4435d4={};_0x4435d4[_0xd10d('0x47')]=_[_0xd10d('0x44')](db[_0xd10d('0x3e')][_0xd10d('0x3f')]);_0x4435d4[_0xd10d('0x43')]=_['keys'](_0x330b54[_0xd10d('0x43')]);_0x4435d4['filters']=_['intersection'](_0x4435d4[_0xd10d('0x47')],_0x4435d4[_0xd10d('0x43')]);_0xf8d379['attributes']=_[_0xd10d('0x46')](_0x4435d4[_0xd10d('0x47')],qs['fields'](_0x330b54[_0xd10d('0x43')][_0xd10d('0x48')]));_0xf8d379[_0xd10d('0x49')]=_0xf8d379[_0xd10d('0x49')][_0xd10d('0x4a')]?_0xf8d379['attributes']:_0x4435d4[_0xd10d('0x47')];if(_0x330b54[_0xd10d('0x43')][_0xd10d('0x57')]){_0xf8d379['include']=[{'all':!![]}];}_0xf8d379=_[_0xd10d('0x50')]({},_0xf8d379,_0x330b54[_0xd10d('0x58')]);return db[_0xd10d('0x3e')][_0xd10d('0x59')](_0xf8d379)[_0xd10d('0x21')](handleEntityNotFound(_0x2de81c,null))['then'](respondWithResult(_0x2de81c,null))['catch'](handleError(_0x2de81c,null));};exports['create']=function(_0x245c70,_0x252b30){return db[_0xd10d('0x3e')]['create'](_0x245c70[_0xd10d('0x5a')],{})[_0xd10d('0x21')](function(_0x5e7652){var _0x1e6901=_0x245c70[_0xd10d('0x5b')][_0xd10d('0x37')]({'plain':!![]});if(!_0x1e6901)throw new Error(_0xd10d('0x5c'));if(_0x1e6901[_0xd10d('0x5d')]===_0xd10d('0x5b')){var _0x1fd176=_0x5e7652['get']({'plain':!![]});var _0x453e4c=_0xd10d('0x38');return db[_0xd10d('0x5e')][_0xd10d('0x59')]({'where':{'name':_0x453e4c,'userProfileId':_0x1e6901[_0xd10d('0x5f')]},'raw':!![]})[_0xd10d('0x21')](function(_0x51472e){if(_0x51472e&&_0x51472e[_0xd10d('0x60')]===0x0){return db[_0xd10d('0x39')][_0xd10d('0x61')]({'name':_0x1fd176['name'],'resourceId':_0x1fd176['id'],'type':_0x51472e[_0xd10d('0x3a')],'sectionId':_0x51472e['id']},{})[_0xd10d('0x21')](function(){return _0x5e7652;});}else{return _0x5e7652;}})['catch'](function(_0x26647b){logger[_0xd10d('0x28')](_0xd10d('0x62'),_0x26647b);throw _0x26647b;});}return _0x5e7652;})[_0xd10d('0x21')](respondWithResult(_0x252b30,0xc9))[_0xd10d('0x63')](handleError(_0x252b30,null));};exports[_0xd10d('0x64')]=function(_0x2049f9,_0x3dc07e){if(_0x2049f9[_0xd10d('0x5a')]['id']){delete _0x2049f9[_0xd10d('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x2049f9[_0xd10d('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xd10d('0x3d')}]})[_0xd10d('0x21')](handleEntityNotFound(_0x3dc07e,null))['then'](saveUpdates(_0x2049f9['body'],null))[_0xd10d('0x21')](respondWithResult(_0x3dc07e,null))[_0xd10d('0x63')](handleError(_0x3dc07e,null));};exports['destroy']=function(_0x35c58d,_0x2c5e25){return db['FaxAccount'][_0xd10d('0x59')]({'where':{'id':_0x35c58d[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c5e25,null))[_0xd10d('0x21')](removeEntity(_0x2c5e25,null))['catch'](handleError(_0x2c5e25,null));};exports['describe']=function(_0x51a84e,_0x54a68c){return db[_0xd10d('0x3e')][_0xd10d('0x65')]()[_0xd10d('0x21')](respondWithResult(_0x54a68c,null))[_0xd10d('0x63')](handleError(_0x54a68c,null));};exports[_0xd10d('0x66')]=function(_0x3a3537,_0x38567c,_0x3613b6){if(_0x3a3537['body']['id']){delete _0x3a3537['body']['id'];}return db[_0xd10d('0x3e')][_0xd10d('0x59')]({'where':{'id':_0x3a3537[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x38567c,null))[_0xd10d('0x21')](function(_0x115965){if(_0x115965){_0x3a3537[_0xd10d('0x5a')][_0xd10d('0x67')]=_0x115965['id'];return db[_0xd10d('0x68')][_0xd10d('0x61')](_0x3a3537[_0xd10d('0x5a')]);}})['then'](respondWithResult(_0x38567c,null))[_0xd10d('0x63')](handleError(_0x38567c,null));};exports[_0xd10d('0x69')]=function(_0xf0d641,_0x21df5b,_0x348bb0){var _0x5c9575={'raw':![],'where':{}};var _0x4816e9={};var _0x238979={'count':0x0,'rows':[]};return db[_0xd10d('0x3e')][_0xd10d('0x6a')]({'where':{'id':_0xf0d641[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x21df5b,null))[_0xd10d('0x21')](function(_0x56584a){if(_0x56584a){_0x4816e9['model']=_[_0xd10d('0x44')](db['Disposition'][_0xd10d('0x3f')]);_0x4816e9[_0xd10d('0x43')]=_['keys'](_0xf0d641[_0xd10d('0x43')]);_0x4816e9['filters']=_[_0xd10d('0x46')](_0x4816e9[_0xd10d('0x47')],_0x4816e9[_0xd10d('0x43')]);_0x5c9575[_0xd10d('0x49')]=_[_0xd10d('0x46')](_0x4816e9[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0xf0d641[_0xd10d('0x43')][_0xd10d('0x48')]));_0x5c9575['attributes']=_0x5c9575[_0xd10d('0x49')]['length']?_0x5c9575[_0xd10d('0x49')]:_0x4816e9[_0xd10d('0x47')];if(!_0xf0d641['query'][_0xd10d('0x4b')]('nolimit')){_0x5c9575[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0xf0d641['query'][_0xd10d('0x30')]);_0x5c9575['offset']=qs[_0xd10d('0x2f')](_0xf0d641[_0xd10d('0x43')][_0xd10d('0x2f')]);}_0x5c9575['order']=qs[_0xd10d('0x4d')](_0xf0d641[_0xd10d('0x43')][_0xd10d('0x4d')]);_0x5c9575['where']=qs[_0xd10d('0x45')](_[_0xd10d('0x4e')](_0xf0d641[_0xd10d('0x43')],_0x4816e9[_0xd10d('0x45')]));_0x5c9575['where'][_0xd10d('0x67')]=_0x56584a['id'];if(_0xf0d641[_0xd10d('0x43')]['filter']){_0x5c9575[_0xd10d('0x52')]=_['merge'](_0x5c9575['where'],{'$or':_[_0xd10d('0x42')](_0x5c9575[_0xd10d('0x49')],function(_0x3ebd68){var _0x365863={};_0x365863[_0x3ebd68]={'$like':'%'+_0xf0d641[_0xd10d('0x43')][_0xd10d('0x4f')]+'%'};return _0x365863;})});}_0x5c9575=_['merge']({},_0x5c9575,_0xf0d641[_0xd10d('0x58')]);return db[_0xd10d('0x68')][_0xd10d('0x32')]({'where':_0x5c9575[_0xd10d('0x52')]})[_0xd10d('0x21')](function(_0x4a594c){_0x238979[_0xd10d('0x32')]=_0x4a594c;if(_0xf0d641[_0xd10d('0x43')]['includeAll']){_0x5c9575[_0xd10d('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xd10d('0x6b')](_0x5c9575);})[_0xd10d('0x21')](function(_0x44fdf8){_0x238979[_0xd10d('0x54')]=_0x44fdf8;return _0x238979;});}})[_0xd10d('0x21')](respondWithFilteredResult(_0x21df5b,_0x5c9575))['catch'](handleError(_0x21df5b,null));};exports['removeDispositions']=function(_0x25e5cf,_0x3474c6,_0x4d9c86){return db[_0xd10d('0x3e')][_0xd10d('0x59')]({'where':{'id':_0x25e5cf['params']['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x3474c6,null))[_0xd10d('0x21')](function(_0x253789){if(_0x253789){return _0x253789[_0xd10d('0x6c')](_0x25e5cf[_0xd10d('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x3474c6,null))[_0xd10d('0x63')](handleError(_0x3474c6,null));};exports['addAnswer']=function(_0x114f1d,_0x505d13,_0x790750){if(_0x114f1d[_0xd10d('0x5a')]['id']){delete _0x114f1d['body']['id'];}return db[_0xd10d('0x3e')][_0xd10d('0x59')]({'where':{'id':_0x114f1d[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x505d13,null))[_0xd10d('0x21')](function(_0x597e53){if(_0x597e53){_0x114f1d['body'][_0xd10d('0x67')]=_0x597e53['id'];return db[_0xd10d('0x6d')][_0xd10d('0x61')](_0x114f1d[_0xd10d('0x5a')]);}})['then'](respondWithResult(_0x505d13,null))[_0xd10d('0x63')](handleError(_0x505d13,null));};exports['getAnswers']=function(_0x38366f,_0x40bea8,_0x1ae8c0){var _0x17704a={'raw':![],'where':{}};var _0x2fe5de={};var _0x5d5355={'count':0x0,'rows':[]};return db[_0xd10d('0x3e')][_0xd10d('0x6a')]({'where':{'id':_0x38366f[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x40bea8,null))[_0xd10d('0x21')](function(_0x537a98){if(_0x537a98){_0x2fe5de[_0xd10d('0x47')]=_['keys'](db[_0xd10d('0x6d')][_0xd10d('0x3f')]);_0x2fe5de[_0xd10d('0x43')]=_[_0xd10d('0x44')](_0x38366f['query']);_0x2fe5de[_0xd10d('0x45')]=_[_0xd10d('0x46')](_0x2fe5de[_0xd10d('0x47')],_0x2fe5de[_0xd10d('0x43')]);_0x17704a['attributes']=_[_0xd10d('0x46')](_0x2fe5de[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0x38366f[_0xd10d('0x43')]['fields']));_0x17704a[_0xd10d('0x49')]=_0x17704a[_0xd10d('0x49')][_0xd10d('0x4a')]?_0x17704a['attributes']:_0x2fe5de[_0xd10d('0x47')];if(!_0x38366f[_0xd10d('0x43')][_0xd10d('0x4b')](_0xd10d('0x6e'))){_0x17704a[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x38366f[_0xd10d('0x43')][_0xd10d('0x30')]);_0x17704a[_0xd10d('0x2f')]=qs['offset'](_0x38366f['query']['offset']);}_0x17704a[_0xd10d('0x4c')]=qs['sort'](_0x38366f[_0xd10d('0x43')][_0xd10d('0x4d')]);_0x17704a[_0xd10d('0x52')]=qs[_0xd10d('0x45')](_[_0xd10d('0x4e')](_0x38366f['query'],_0x2fe5de[_0xd10d('0x45')]));_0x17704a[_0xd10d('0x52')][_0xd10d('0x67')]=_0x537a98['id'];if(_0x38366f[_0xd10d('0x43')][_0xd10d('0x4f')]){_0x17704a['where']=_[_0xd10d('0x50')](_0x17704a['where'],{'$or':_[_0xd10d('0x42')](_0x17704a[_0xd10d('0x49')],function(_0x5c16d8){var _0x36093f={};_0x36093f[_0x5c16d8]={'$like':'%'+_0x38366f[_0xd10d('0x43')][_0xd10d('0x4f')]+'%'};return _0x36093f;})});}_0x17704a=_['merge']({},_0x17704a,_0x38366f[_0xd10d('0x58')]);return db[_0xd10d('0x6d')][_0xd10d('0x32')]({'where':_0x17704a['where']})[_0xd10d('0x21')](function(_0x158b0e){_0x5d5355['count']=_0x158b0e;if(_0x38366f['query'][_0xd10d('0x57')]){_0x17704a['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xd10d('0x6b')](_0x17704a);})[_0xd10d('0x21')](function(_0x376cdd){_0x5d5355[_0xd10d('0x54')]=_0x376cdd;return _0x5d5355;});}})[_0xd10d('0x21')](respondWithFilteredResult(_0x40bea8,_0x17704a))[_0xd10d('0x63')](handleError(_0x40bea8,null));};exports[_0xd10d('0x6f')]=function(_0x3561d8,_0x8f355,_0x5bb56c){return db[_0xd10d('0x3e')][_0xd10d('0x59')]({'where':{'id':_0x3561d8['params']['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x8f355,null))[_0xd10d('0x21')](function(_0x45a2ec){if(_0x45a2ec){return _0x45a2ec[_0xd10d('0x6f')](_0x3561d8['query']['ids']);}})['then'](respondWithStatusCode(_0x8f355,null))[_0xd10d('0x63')](handleError(_0x8f355,null));};exports['addInteraction']=function(_0xfca1b7,_0x506099,_0xa218b9){return db[_0xd10d('0x70')][_0xd10d('0x59')]({'where':{'id':_0xfca1b7[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x506099,null))[_0xd10d('0x21')](function(_0x21e79b){if(_0x21e79b){return _0x21e79b[_0xd10d('0x71')](_0xfca1b7['body'][_0xd10d('0x72')],_[_0xd10d('0x73')](_0xfca1b7['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x506099,null))[_0xd10d('0x63')](handleError(_0x506099,null));};exports[_0xd10d('0x74')]=function(_0x2704c5,_0x15073b,_0x202d89){var _0x371e2f={'raw':![],'where':{}};var _0x4d5f8f={};var _0x3b04b7={'count':0x0,'rows':[]};return db[_0xd10d('0x3e')]['findOne']({'where':{'id':_0x2704c5[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x15073b,null))['then'](function(_0x1b8ca3){if(_0x1b8ca3){_0x4d5f8f['model']=_[_0xd10d('0x44')](db[_0xd10d('0x70')]['rawAttributes']);_0x4d5f8f[_0xd10d('0x43')]=_['keys'](_0x2704c5['query']);_0x4d5f8f[_0xd10d('0x45')]=_[_0xd10d('0x46')](_0x4d5f8f[_0xd10d('0x47')],_0x4d5f8f[_0xd10d('0x43')]);_0x371e2f[_0xd10d('0x49')]=_[_0xd10d('0x46')](_0x4d5f8f[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0x2704c5[_0xd10d('0x43')][_0xd10d('0x48')]));_0x371e2f['attributes']=_0x371e2f[_0xd10d('0x49')][_0xd10d('0x4a')]?_0x371e2f[_0xd10d('0x49')]:_0x4d5f8f[_0xd10d('0x47')];if(!_0x2704c5['query'][_0xd10d('0x4b')](_0xd10d('0x6e'))){_0x371e2f[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x2704c5[_0xd10d('0x43')][_0xd10d('0x30')]);_0x371e2f[_0xd10d('0x2f')]=qs[_0xd10d('0x2f')](_0x2704c5['query'][_0xd10d('0x2f')]);}_0x371e2f['order']=qs[_0xd10d('0x4d')](_0x2704c5['query'][_0xd10d('0x4d')]);_0x371e2f['where']=qs['filters'](_[_0xd10d('0x4e')](_0x2704c5['query'],_0x4d5f8f[_0xd10d('0x45')]));_0x371e2f[_0xd10d('0x52')][_0xd10d('0x67')]=_0x1b8ca3['id'];if(_0x2704c5[_0xd10d('0x43')][_0xd10d('0x4f')]){_0x371e2f['where']=_[_0xd10d('0x50')](_0x371e2f['where'],{'$or':_['map'](_0x371e2f[_0xd10d('0x49')],function(_0x275006){var _0x3acfb9={};_0x3acfb9[_0x275006]={'$like':'%'+_0x2704c5['query'][_0xd10d('0x4f')]+'%'};return _0x3acfb9;})});}_0x371e2f=_[_0xd10d('0x50')]({},_0x371e2f,_0x2704c5[_0xd10d('0x58')]);return db['FaxInteraction']['count']({'where':_0x371e2f[_0xd10d('0x52')]})[_0xd10d('0x21')](function(_0x45c3ce){_0x3b04b7[_0xd10d('0x32')]=_0x45c3ce;if(_0x2704c5[_0xd10d('0x43')]['includeAll']){_0x371e2f['include']=[{'model':db[_0xd10d('0x75')],'as':_0xd10d('0x76'),'required':![]},{'model':db['User'],'as':_0xd10d('0x77'),'attributes':['name',_0xd10d('0x78'),_0xd10d('0x79')],'required':![]},{'model':db['Tag'],'as':_0xd10d('0x7a'),'attributes':['id',_0xd10d('0x3a'),'color'],'where':_0x2704c5[_0xd10d('0x43')][_0xd10d('0x7b')]?{'id':_0x2704c5[_0xd10d('0x43')][_0xd10d('0x7b')]}:undefined,'required':_0x2704c5['query'][_0xd10d('0x7b')]?!![]:![]}];}return db['FaxInteraction'][_0xd10d('0x6b')](_0x371e2f);})['then'](function(_0x1605e6){_0x3b04b7[_0xd10d('0x54')]=_0x1605e6;return _0x3b04b7;});}})[_0xd10d('0x21')](respondWithFilteredResult(_0x15073b,_0x371e2f))[_0xd10d('0x63')](handleError(_0x15073b,null));};exports[_0xd10d('0x7c')]=function(_0x5a12d1,_0x167760){var _0x3cc0f8=_0x5a12d1[_0xd10d('0x56')]['id'];var _0x189029=_0x5a12d1[_0xd10d('0x5a')];var _0x3fd66b=0xc8;var _0x1d9bd7=null;return db[_0xd10d('0x7d')][_0xd10d('0x7e')]({'isolationLevel':db[_0xd10d('0x7d')][_0xd10d('0x7f')][_0xd10d('0x80')][_0xd10d('0x81')]},function(_0x6c64a1){return db[_0xd10d('0x3e')][_0xd10d('0x6a')]({'where':{'id':_0x3cc0f8},'transaction':_0x6c64a1})[_0xd10d('0x21')](function(_0x4d4828){if(_0x4d4828){return db[_0xd10d('0x82')]['destroy']({'where':{'FaxAccountId':_0x3cc0f8},'transaction':_0x6c64a1})[_0xd10d('0x21')](function(){var _0xac156d=_[_0xd10d('0x42')](_0x189029,function(_0x5baa57){_0x5baa57[_0xd10d('0x67')]=_0x3cc0f8;return _0x5baa57;});return db['FaxApplication'][_0xd10d('0x83')](_0xac156d,{'transaction':_0x6c64a1});});}else{_0x3fd66b=0x194;_0x1d9bd7=[];}});})[_0xd10d('0x21')](function(){if(_0x3fd66b!==0x194){return db[_0xd10d('0x82')][_0xd10d('0x84')]({'where':{'FaxAccountId':_0x3cc0f8},'order':_0xd10d('0x85')})[_0xd10d('0x21')](function(_0x382d44){_0x1d9bd7=_0x382d44;});}})['catch'](function(_0xff4ede){_0x3fd66b=0x1f4;logger[_0xd10d('0x28')](_0xff4ede[_0xd10d('0x86')]);if(_0xff4ede[_0xd10d('0x3a')]){delete _0xff4ede['name'];}_0x1d9bd7=_0xff4ede;})[_0xd10d('0x87')](function(){if(_0x1d9bd7===null){_0x167760[_0xd10d('0x2b')](_0x3fd66b);}else{if(_0x3fd66b===0x1f4){_0x167760[_0xd10d('0x2d')](_0x3fd66b)[_0xd10d('0x88')](_0x1d9bd7);}else{_0x167760['status'](_0x3fd66b)[_0xd10d('0x2e')](_0x1d9bd7);}}});};exports[_0xd10d('0x89')]=function(_0x5401c3,_0x3710e7,_0x5f8b69){var _0x5eadc2={};var _0x1581e4={};var _0x1578c5;var _0x2ebb94;return db[_0xd10d('0x3e')][_0xd10d('0x6a')]({'where':{'id':_0x5401c3[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x3710e7,null))['then'](function(_0x29e671){if(_0x29e671){_0x1578c5=_0x29e671;_0x1581e4['model']=_[_0xd10d('0x44')](db['FaxApplication'][_0xd10d('0x3f')]);_0x1581e4[_0xd10d('0x43')]=_[_0xd10d('0x44')](_0x5401c3['query']);_0x1581e4[_0xd10d('0x45')]=_[_0xd10d('0x46')](_0x1581e4[_0xd10d('0x47')],_0x1581e4[_0xd10d('0x43')]);_0x5eadc2[_0xd10d('0x49')]=_[_0xd10d('0x46')](_0x1581e4[_0xd10d('0x47')],qs['fields'](_0x5401c3[_0xd10d('0x43')][_0xd10d('0x48')]));_0x5eadc2[_0xd10d('0x49')]=_0x5eadc2[_0xd10d('0x49')][_0xd10d('0x4a')]?_0x5eadc2[_0xd10d('0x49')]:_0x1581e4[_0xd10d('0x47')];_0x5eadc2[_0xd10d('0x4c')]=qs[_0xd10d('0x4d')](_0x5401c3['query']['sort']);_0x5eadc2[_0xd10d('0x52')]=qs['filters'](_[_0xd10d('0x4e')](_0x5401c3[_0xd10d('0x43')],_0x1581e4[_0xd10d('0x45')]));if(_0x5401c3[_0xd10d('0x43')][_0xd10d('0x4f')]){_0x5eadc2[_0xd10d('0x52')]=_[_0xd10d('0x50')](_0x5eadc2['where'],{'$or':_[_0xd10d('0x42')](_0x5eadc2[_0xd10d('0x49')],function(_0x4ed9f6){var _0x440830={};_0x440830[_0x4ed9f6]={'$like':'%'+_0x5401c3[_0xd10d('0x43')][_0xd10d('0x4f')]+'%'};return _0x440830;})});}_0x5eadc2=_[_0xd10d('0x50')]({},_0x5eadc2,_0x5401c3[_0xd10d('0x58')]);return _0x1578c5[_0xd10d('0x89')](_0x5eadc2);}})[_0xd10d('0x21')](function(_0x380d9d){if(_0x380d9d){_0x2ebb94=_0x380d9d[_0xd10d('0x4a')];if(!_0x5401c3['query']['hasOwnProperty'](_0xd10d('0x6e'))){_0x5eadc2[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x5401c3[_0xd10d('0x43')]['limit']);_0x5eadc2[_0xd10d('0x2f')]=qs[_0xd10d('0x2f')](_0x5401c3[_0xd10d('0x43')][_0xd10d('0x2f')]);}return _0x1578c5[_0xd10d('0x89')](_0x5eadc2);}})[_0xd10d('0x21')](function(_0x2258bd){if(_0x2258bd){return _0x2258bd?{'count':_0x2ebb94,'rows':_0x2258bd}:null;}})['then'](respondWithResult(_0x3710e7,null))['catch'](handleError(_0x3710e7,null));};function Extension(_0x17f82e,_0x3c1cb2,_0x46294f,_0x1db1a2){this[_0xd10d('0x8a')]='from-voip-provider';this[_0xd10d('0x8b')]=_0x17f82e['localstationid'];this[_0xd10d('0x8c')]=_0x1db1a2;this[_0xd10d('0x40')]=_0xd10d('0x8d');this[_0xd10d('0x8e')]=_0xd10d('0x8f');this[_0xd10d('0x67')]=_0x17f82e['id'];this[_0xd10d('0x85')]=_0x3c1cb2;this[_0xd10d('0x90')]=_0x46294f;}function createExtensionsReciveFax(_0x242449){var _0x281894=0x1;var _0x3705fd=[];_0x3705fd['push'](new Extension(_0x242449,_0x281894,'','Answer'));_0x281894+=0x1;_0x3705fd[_0xd10d('0x91')](new Extension(_0x242449,_0x281894,'CDR(type)=inbound-fax',_0xd10d('0x92')));_0x281894+=0x1;for(var _0x14b6df in _0x242449){if(_0x242449[_0xd10d('0x4b')](_0x14b6df)&&(_0x14b6df===_0xd10d('0x93')||_0x14b6df===_0xd10d('0x94')||_0x14b6df===_0xd10d('0x95')||_0x14b6df===_0xd10d('0x96')||_0x14b6df===_0xd10d('0x97')||_0x14b6df===_0xd10d('0x98')||_0x14b6df===_0xd10d('0x99')||_0x14b6df===_0xd10d('0x9a')||_0x14b6df===_0xd10d('0x9b'))){_0x3705fd[_0xd10d('0x91')](new Extension(_0x242449,_0x281894,'FAXOPT('+_0x14b6df+')='+_0x242449[_0x14b6df],_0xd10d('0x92')));_0x281894+=0x1;}}_0x3705fd[_0xd10d('0x91')](new Extension(_0x242449,_0x281894,'6',_0xd10d('0x9c')));_0x281894+=0x1;_0x3705fd[_0xd10d('0x91')](new Extension(_0x242449,_0x281894,_0xd10d('0x9d'),_0xd10d('0x9e')));_0x281894=0x0;return _0x3705fd;}exports[_0xd10d('0x9f')]=function(_0x4645d2,_0x5ca85e,_0x4e145c){var _0x202e80;return db[_0xd10d('0x7d')][_0xd10d('0x7e')](function(_0x3ccef9){return db[_0xd10d('0x3e')]['create'](_0x4645d2[_0xd10d('0x5a')],{'transaction':_0x3ccef9})[_0xd10d('0x21')](function(_0x5a3528){_0x202e80=_0x5a3528[_0xd10d('0x37')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x202e80),{'transaction':_0x3ccef9});});})[_0xd10d('0x21')](function(){return _0x202e80;})[_0xd10d('0x21')](respondWithResult(_0x5ca85e,null))[_0xd10d('0x63')](handleError(_0x5ca85e,null));};exports['updateAccountApplications']=function(_0x4eaa05,_0x11579f,_0x238247){var _0x1bc3d4;return db['sequelize']['transaction'](function(_0x5de16f){return db[_0xd10d('0x3e')][_0xd10d('0x64')](_0x4eaa05[_0xd10d('0x5a')],{'where':{'id':_0x4eaa05[_0xd10d('0x5a')]['id']},'transaction':_0x5de16f})[_0xd10d('0x21')](function(_0x159b5a){return db[_0xd10d('0xa0')][_0xd10d('0x36')]({'where':{'FaxAccountId':_0x4eaa05[_0xd10d('0x5a')]['id']},'transaction':_0x5de16f})[_0xd10d('0x21')](function(_0x2af6ec){return db[_0xd10d('0xa0')]['bulkCreate'](createExtensionsReciveFax(_[_0xd10d('0x73')](_0x4eaa05[_0xd10d('0x5a')],[_0xd10d('0xa1'),_0xd10d('0x41'),_0xd10d('0xa2'),_0xd10d('0xa3'),_0xd10d('0xa4'),_0xd10d('0xa5')])),{'transaction':_0x5de16f});});});})[_0xd10d('0x21')](function(){return db[_0xd10d('0x3e')]['findById'](_0x4eaa05[_0xd10d('0x5a')]['id']);})[_0xd10d('0x21')](respondWithResult(_0x11579f,null))[_0xd10d('0x63')](handleError(_0x11579f,null));};exports[_0xd10d('0xa6')]=function(_0x56a27e,_0x25f757,_0xfd38ca){var _0x293eb1={'raw':!![],'where':{}};var _0x57e217={};var _0x5078a0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd10d('0x6a')]({'where':{'id':_0x56a27e[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x25f757,null))[_0xd10d('0x21')](function(_0x252c72){if(_0x252c72){_0x57e217[_0xd10d('0x47')]=_['keys'](db['FaxMessage']['rawAttributes']);_0x57e217['query']=_['keys'](_0x56a27e[_0xd10d('0x43')]);_0x57e217['filters']=_[_0xd10d('0x46')](_0x57e217[_0xd10d('0x47')],_0x57e217[_0xd10d('0x43')]);_0x293eb1[_0xd10d('0x49')]=_[_0xd10d('0x46')](_0x57e217[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0x56a27e[_0xd10d('0x43')][_0xd10d('0x48')]));_0x293eb1['attributes']=_0x293eb1[_0xd10d('0x49')]['length']?_0x293eb1['attributes']:_0x57e217[_0xd10d('0x47')];if(!_0x56a27e[_0xd10d('0x43')][_0xd10d('0x4b')](_0xd10d('0x6e'))){_0x293eb1[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x56a27e['query'][_0xd10d('0x30')]);_0x293eb1[_0xd10d('0x2f')]=qs[_0xd10d('0x2f')](_0x56a27e[_0xd10d('0x43')][_0xd10d('0x2f')]);}_0x293eb1[_0xd10d('0x4c')]=qs['sort'](_0x56a27e[_0xd10d('0x43')]['sort']);_0x293eb1[_0xd10d('0x52')]=qs[_0xd10d('0x45')](_['pick'](_0x56a27e[_0xd10d('0x43')],_0x57e217['filters']));_0x293eb1[_0xd10d('0x52')][_0xd10d('0x67')]=_0x252c72['id'];if(_0x56a27e[_0xd10d('0x43')][_0xd10d('0x4f')]){_0x293eb1[_0xd10d('0x52')]=_['merge'](_0x293eb1['where'],{'$or':_[_0xd10d('0x42')](_0x293eb1['attributes'],function(_0x5b2dfc){var _0x3948b1={};_0x3948b1[_0x5b2dfc]={'$like':'%'+_0x56a27e['query'][_0xd10d('0x4f')]+'%'};return _0x3948b1;})});}if(_0x56a27e['query'][_0xd10d('0xa7')]){var _0x282bd9=_0x56a27e[_0xd10d('0x43')][_0xd10d('0xa7')]['split'](',');var _0x1f65f1={};_0x1f65f1[_0x282bd9[0x0]]={'$gte':moment(_0x282bd9[0x1])['format'](_0xd10d('0xa8'))};_0x293eb1[_0xd10d('0x52')]=_['merge'](_0x293eb1[_0xd10d('0x52')],_0x1f65f1);}_0x293eb1=_[_0xd10d('0x50')]({},_0x293eb1,_0x56a27e['options']);return db[_0xd10d('0xa9')][_0xd10d('0x32')]({'where':_0x293eb1[_0xd10d('0x52')]})[_0xd10d('0x21')](function(_0x1375ce){_0x5078a0[_0xd10d('0x32')]=_0x1375ce;if(_0x56a27e[_0xd10d('0x43')][_0xd10d('0x57')]){_0x293eb1[_0xd10d('0x53')]=[{'all':!![]}];}return db[_0xd10d('0xa9')][_0xd10d('0x6b')](_0x293eb1);})['then'](function(_0x403209){_0x5078a0[_0xd10d('0x54')]=_0x403209;return _0x5078a0;});}})[_0xd10d('0x21')](respondWithFilteredResult(_0x25f757,_0x293eb1))['catch'](handleError(_0x25f757,null));};exports[_0xd10d('0x88')]=function(_0x344535,_0xb153ec,_0x5c2313){var _0x181e21,_0xc50728={},_0xff8fb8;if(_0x344535['body']['to']){_0xff8fb8=_0x344535[_0xd10d('0x5a')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x344535[_0xd10d('0x56')]['id']},'include':[{'model':db[_0xd10d('0xaa')],'as':_0xd10d('0xab'),'include':[{'model':db['CmContact'],'as':_0xd10d('0xac'),'where':{'fax':_0xff8fb8},'limit':0x1,'order':[[_0xd10d('0xa3'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xb153ec,null))[_0xd10d('0x21')](function(_0x3c1e0c){_0x181e21=_0x3c1e0c;if(_0x344535['body']['attachments']&&_0x344535[_0xd10d('0x5a')]['attachments'][_0xd10d('0x4a')]){for(var _0x5cf610=0x0;_0x5cf610<_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][_0xd10d('0x4a')];_0x5cf610+=0x1){_0x344535[_0xd10d('0x5a')]['attachments'][_0x5cf610]={'filename':_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][_0x5cf610]['name'],'id':_0x344535['body'][_0xd10d('0xad')][_0x5cf610]['id'],'path':path['join'](config[_0xd10d('0xae')],_0xd10d('0xaf'),_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][_0x5cf610][_0xd10d('0xb0')])};}}return respondWithRpcPromise(_0xd10d('0xb1'),_0xd10d('0xb1'),{'FaxAccountId':_[_0xd10d('0xb2')](_0x344535[_0xd10d('0x56')]['id'])?undefined:_0x344535[_0xd10d('0x56')]['id'],'path':_[_0xd10d('0xb2')](_0x344535[_0xd10d('0x5a')]['attachments'][0x0][_0xd10d('0x7')])?undefined:_0x344535['body'][_0xd10d('0xad')][0x0]['path'],'fax':_[_0xd10d('0xb2')](_0x344535['body']['to'][0x0])?undefined:_0x344535[_0xd10d('0x5a')]['to'][0x0]},client9002);})[_0xd10d('0x21')](function(){if(_0x181e21){if(_['isNil'](_0x344535[_0xd10d('0x5a')]['from'])){_0x344535[_0xd10d('0x5a')]['from']=util[_0xd10d('0xb3')](_0xd10d('0xb4'),_0x181e21[_0xd10d('0x3a')],_0x181e21[_0xd10d('0xb5')]);}if(_0x181e21['List']){if(_0x181e21[_0xd10d('0xab')]['Contacts'][_0xd10d('0x4a')]){return _0x181e21[_0xd10d('0xab')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xd10d('0x1a')](_0x344535[_0xd10d('0x5a')],{'firstName':_0x344535['body']['to'][0x0],'phone':_0x344535['body']['to'][0x0],'fax':_0x344535[_0xd10d('0x5a')]['to'][0x0],'ListId':_0x181e21[_0xd10d('0xa5')]}));}}else{throw new Error(_0xd10d('0xb6'));}}else{throw new Error(_0xd10d('0xb7'));}})['then'](function(_0xfdc49a){if(_0xfdc49a){return db[_0xd10d('0x70')][_0xd10d('0x59')]({'where':{'ContactId':_0xfdc49a['id'],'closed':![],'FaxAccountId':_0x181e21['id']}})[_0xd10d('0x21')](function(_0x327605){if(_0x327605){return[_0x327605,![]];}return db[_0xd10d('0x70')][_0xd10d('0x61')]({'UserId':_0x344535['user']['id'],'ContactId':_0xfdc49a['id'],'FaxAccountId':_0x181e21['id'],'fax':_0x344535['body']['to'][0x0],'firstMsgDirection':_0xd10d('0xb8'),'Messages':[_[_0xd10d('0x50')](_0x344535[_0xd10d('0x5a')],{'read':![],'body':_0x344535[_0xd10d('0x5a')]['attachments'][0x0][_0xd10d('0xb9')],'FaxAccountId':_0x181e21['id'],'UserId':_0x344535[_0xd10d('0x5b')]['id'],'ContactId':_0xfdc49a['id'],'AttachmentId':_0x344535[_0xd10d('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xd10d('0xba')}]})[_0xd10d('0x21')](function(_0x2a0672){return[_0x2a0672,!![]];});});}else{throw new Error(_0xd10d('0xbb'));}})[_0xd10d('0xbc')](function(_0x5006be,_0x8dd4a0){if(_0x8dd4a0){return _0x5006be;}return db[_0xd10d('0xa9')]['create']({'direction':_0xd10d('0xb8'),'read':![],'body':_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][0x0][_0xd10d('0xb9')],'FaxAccountId':_0x181e21['id'],'FaxInteractionId':_0x5006be['id'],'UserId':_0x344535[_0xd10d('0x5b')]['id'],'ContactId':_0x5006be[_0xd10d('0xbd')],'AttachmentId':_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][0x0]['id']})[_0xd10d('0x21')](function(_0x9c3d0f){_0x5006be[_0xd10d('0xbe')][_0xd10d('0xba')]=[];_0x5006be[_0xd10d('0xbe')][_0xd10d('0xba')][_0xd10d('0x91')](_0x9c3d0f[_0xd10d('0xbe')]);return _0x5006be;});})['then'](function(_0x26efcf){respondWithRpcPromise(_0xd10d('0xbf'),_0xd10d('0xbf'),{'FaxAccountId':_[_0xd10d('0xb2')](_0x344535[_0xd10d('0x56')]['id'])?undefined:_0x344535[_0xd10d('0x56')]['id'],'path':_[_0xd10d('0xb2')](_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][0x0][_0xd10d('0x7')])?undefined:_0x344535['body'][_0xd10d('0xad')][0x0]['path'],'fax':_[_0xd10d('0xb2')](_0x344535[_0xd10d('0x5a')]['to'][0x0])?undefined:_0x344535['body']['to'][0x0],'AttachmentId':_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][0x0]['id']},client9002)[_0xd10d('0x21')](function(_0xb3871e){logger[_0xd10d('0x22')]('SendFaxRpc,\x20%s',_0xb3871e);})[_0xd10d('0x63')](function(_0x21f8f1){logger[_0xd10d('0x22')]('SendFaxRpc,\x20%s',_0x21f8f1);});return _0x26efcf;})[_0xd10d('0x21')](respondWithResult(_0xb153ec,null))[_0xd10d('0x63')](handleError(_0xb153ec,null));};exports[_0xd10d('0xc0')]=function(_0x141cfd,_0x11c442,_0x5e3e82){return db['FaxAccount'][_0xd10d('0x59')]({'where':{'id':_0x141cfd[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x11c442,null))[_0xd10d('0x21')](function(_0x10dd8d){if(_0x10dd8d){return _0x10dd8d[_0xd10d('0xc0')](_0x141cfd['body']['ids'],_[_0xd10d('0x73')](_0x141cfd[_0xd10d('0x5a')],[_0xd10d('0x72'),'id'])||{})[_0xd10d('0xbc')](function(_0x40f917){for(var _0x225585=0x0;_0x225585<_0x141cfd[_0xd10d('0x5a')][_0xd10d('0x72')][_0xd10d('0x4a')];_0x225585+=0x1){socket['emit'](_0xd10d('0xc1'),{'UserId':Number(_0x141cfd[_0xd10d('0x5a')][_0xd10d('0x72')][_0x225585]),'FaxAccountId':Number(_0x141cfd['params']['id'])});}return _0x40f917;});}})[_0xd10d('0x21')](respondWithResult(_0x11c442,null))['catch'](handleError(_0x11c442,null));};exports[_0xd10d('0xc2')]=function(_0x152a34,_0x13cd41,_0x106c17){return db['FaxAccount']['find']({'where':{'id':_0x152a34[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x13cd41,null))[_0xd10d('0x21')](function(_0x13c50e){if(_0x13c50e){return _0x13c50e[_0xd10d('0xc2')](_0x152a34[_0xd10d('0x43')][_0xd10d('0x72')])['then'](function(){if(_[_0xd10d('0xc3')](_0x152a34[_0xd10d('0x43')][_0xd10d('0x72')])){for(var _0x3c0cca=0x0;_0x3c0cca<_0x152a34[_0xd10d('0x43')][_0xd10d('0x72')][_0xd10d('0x4a')];_0x3c0cca+=0x1){socket[_0xd10d('0xc4')]('userFaxAccount:remove',{'UserId':Number(_0x152a34[_0xd10d('0x43')]['ids'][_0x3c0cca]),'FaxAccountId':Number(_0x152a34[_0xd10d('0x56')]['id'])});}}else{socket[_0xd10d('0xc4')](_0xd10d('0xc5'),{'UserId':Number(_0x152a34[_0xd10d('0x43')][_0xd10d('0x72')]),'FaxAccountId':Number(_0x152a34[_0xd10d('0x56')]['id'])});}});}})[_0xd10d('0x21')](respondWithStatusCode(_0x13cd41,null))[_0xd10d('0x63')](handleError(_0x13cd41,null));};exports[_0xd10d('0xc6')]=function(_0x113fac,_0x41664e,_0x3e1800){var _0x103d36={};var _0x28030a={};var _0x2fa098;var _0x2ca114;return db[_0xd10d('0x3e')][_0xd10d('0x6a')]({'where':{'id':_0x113fac[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x41664e,null))[_0xd10d('0x21')](function(_0x42146d){if(_0x42146d){_0x2fa098=_0x42146d;_0x28030a['model']=_[_0xd10d('0x44')](db['User'][_0xd10d('0x3f')]);_0x28030a[_0xd10d('0x43')]=_[_0xd10d('0x44')](_0x113fac[_0xd10d('0x43')]);_0x28030a[_0xd10d('0x45')]=_[_0xd10d('0x46')](_0x28030a[_0xd10d('0x47')],_0x28030a['query']);_0x103d36['attributes']=_[_0xd10d('0x46')](_0x28030a[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0x113fac[_0xd10d('0x43')]['fields']));_0x103d36['attributes']=_0x103d36[_0xd10d('0x49')][_0xd10d('0x4a')]?_0x103d36[_0xd10d('0x49')]:_0x28030a[_0xd10d('0x47')];_0x103d36[_0xd10d('0x4c')]=qs['sort'](_0x113fac[_0xd10d('0x43')][_0xd10d('0x4d')]);_0x103d36[_0xd10d('0x52')]=qs['filters'](_['pick'](_0x113fac['query'],_0x28030a['filters']));if(_0x113fac[_0xd10d('0x43')][_0xd10d('0x4f')]){_0x103d36[_0xd10d('0x52')]=_[_0xd10d('0x50')](_0x103d36['where'],{'$or':_[_0xd10d('0x42')](_0x103d36[_0xd10d('0x49')],function(_0xe892e0){var _0x247a1c={};_0x247a1c[_0xe892e0]={'$like':'%'+_0x113fac['query']['filter']+'%'};return _0x247a1c;})});}_0x103d36=_[_0xd10d('0x50')]({},_0x103d36,_0x113fac[_0xd10d('0x58')]);return _0x2fa098['getAgents'](_0x103d36);}})[_0xd10d('0x21')](function(_0xd4de97){if(_0xd4de97){_0x2ca114=_0xd4de97[_0xd10d('0x4a')];if(!_0x113fac[_0xd10d('0x43')]['hasOwnProperty'](_0xd10d('0x6e'))){_0x103d36[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x113fac[_0xd10d('0x43')][_0xd10d('0x30')]);_0x103d36[_0xd10d('0x2f')]=qs[_0xd10d('0x2f')](_0x113fac[_0xd10d('0x43')]['offset']);}return _0x2fa098[_0xd10d('0xc6')](_0x103d36);}})[_0xd10d('0x21')](function(_0x1430d2){if(_0x1430d2){return _0x1430d2?{'count':_0x2ca114,'rows':_0x1430d2}:null;}})[_0xd10d('0x21')](respondWithResult(_0x41664e,null))[_0xd10d('0x63')](handleError(_0x41664e,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ea39b14..e158513 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 _0x82d6=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xc0a3d0,_0x2eb826){var _0x1c6710=function(_0x426d8a){while(--_0x426d8a){_0xc0a3d0['push'](_0xc0a3d0['shift']());}};_0x1c6710(++_0x2eb826);}(_0x82d6,0x9e));var _0x682d=function(_0x119dbc,_0x4b3654){_0x119dbc=_0x119dbc-0x0;var _0x47df85=_0x82d6[_0x119dbc];return _0x47df85;};'use strict';var EventEmitter=require(_0x682d('0x0'));var FaxAccount=require(_0x682d('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x682d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x682d('0x3')};function emitEvent(_0x385360){return function(_0x311d33,_0x258448,_0xd61910){FaxAccountEvents[_0x682d('0x4')](_0x385360+':'+_0x311d33['id'],_0x311d33);FaxAccountEvents[_0x682d('0x4')](_0x385360,_0x311d33);_0xd61910(null);};}for(var e in events){if(events[_0x682d('0x5')](e)){var event=events[e];FaxAccount[_0x682d('0x6')](e,emitEvent(event));}}module[_0x682d('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x357a=['exports','../../mysqldb','FaxAccount','update','remove','emit','hook'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x357a,0x1ac));var _0xa357=function(_0x49a301,_0x284d5e){_0x49a301=_0x49a301-0x0;var _0x5625d0=_0x357a[_0x49a301];return _0x5625d0;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xa357('0x0'))['db'][_0xa357('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa357('0x2'),'afterDestroy':_0xa357('0x3')};function emitEvent(_0x5615ac){return function(_0x432cf9,_0x2c38d3,_0xa8ae69){FaxAccountEvents[_0xa357('0x4')](_0x5615ac+':'+_0x432cf9['id'],_0x432cf9);FaxAccountEvents[_0xa357('0x4')](_0x5615ac,_0x432cf9);_0xa8ae69(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xa357('0x5')](e,emitEvent(event));}}module[_0xa357('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index bbe8868..920c506 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 _0xba97=['moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api'];(function(_0x52c363,_0x1efeca){var _0x59fd6a=function(_0x2af4bf){while(--_0x2af4bf){_0x52c363['push'](_0x52c363['shift']());}};_0x59fd6a(++_0x1efeca);}(_0xba97,0x1f4));var _0x7ba9=function(_0x2230fa,_0x3f73a5){_0x2230fa=_0x2230fa-0x0;var _0x361a67=_0xba97[_0x2230fa];return _0x361a67;};'use strict';var _=require(_0x7ba9('0x0'));var util=require(_0x7ba9('0x1'));var logger=require(_0x7ba9('0x2'))(_0x7ba9('0x3'));var moment=require(_0x7ba9('0x4'));var BPromise=require('bluebird');var rp=require(_0x7ba9('0x5'));var fs=require('fs');var path=require(_0x7ba9('0x6'));var rimraf=require(_0x7ba9('0x7'));var config=require(_0x7ba9('0x8'));var attributes=require(_0x7ba9('0x9'));module[_0x7ba9('0xa')]=function(_0x2f6c41,_0x2fcd35){return _0x2f6c41[_0x7ba9('0xb')](_0x7ba9('0xc'),attributes,{'tableName':_0x7ba9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ea=['bluebird','path','rimraf','./faxAccount.attributes','exports','FaxAccount','lodash','../../config/logger','api','moment'];(function(_0x48a921,_0x2edffb){var _0x5870ca=function(_0x3d958f){while(--_0x3d958f){_0x48a921['push'](_0x48a921['shift']());}};_0x5870ca(++_0x2edffb);}(_0x55ea,0xba));var _0xa55e=function(_0x4a771a,_0x241c0b){_0x4a771a=_0x4a771a-0x0;var _0x5ba097=_0x55ea[_0x4a771a];return _0x5ba097;};'use strict';var _=require(_0xa55e('0x0'));var util=require('util');var logger=require(_0xa55e('0x1'))(_0xa55e('0x2'));var moment=require(_0xa55e('0x3'));var BPromise=require(_0xa55e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa55e('0x5'));var rimraf=require(_0xa55e('0x6'));var config=require('../../config/environment');var attributes=require(_0xa55e('0x7'));module[_0xa55e('0x8')]=function(_0x4e49c4,_0x4e2572){return _0x4e49c4['define'](_0xa55e('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 79b7fec..41f4946 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 _0x7e5a=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFaxAccount','findAll','options','where','attributes','limit','map','include','model','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','find','CmList','List','Contacts','FaxApplication','get','account','applications','Applications','orderBy','priority','asc','length','create','contact','FaxInteraction','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','waitForTheAssignedQueue','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4f66f9,_0x2a1ba1){var _0x46b73d=function(_0x25fb51){while(--_0x25fb51){_0x4f66f9['push'](_0x4f66f9['shift']());}};_0x46b73d(++_0x2a1ba1);}(_0x7e5a,0xac));var _0xa7e5=function(_0x12a688,_0x41b876){_0x12a688=_0x12a688-0x0;var _0x286669=_0x7e5a[_0x12a688];return _0x286669;};'use strict';var _=require(_0xa7e5('0x0'));var util=require(_0xa7e5('0x1'));var moment=require(_0xa7e5('0x2'));var BPromise=require(_0xa7e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7e5('0x4'));var db=require(_0xa7e5('0x5'))['db'];var utils=require(_0xa7e5('0x6'));var logger=require(_0xa7e5('0x7'))(_0xa7e5('0x8'));var config=require(_0xa7e5('0x9'));var jayson=require(_0xa7e5('0xa'));var client=jayson[_0xa7e5('0xb')][_0xa7e5('0xc')]({'port':0x232c});config[_0xa7e5('0xd')]=_[_0xa7e5('0xe')](config[_0xa7e5('0xd')],{'host':_0xa7e5('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa7e5('0xd')]));require(_0xa7e5('0x10'))['register'](socket);function respondWithRpcPromise(_0x487c49,_0x2f7aad,_0xe40492){return new BPromise(function(_0x39083d,_0x581362){return client['request'](_0x487c49,_0xe40492)[_0xa7e5('0x11')](function(_0x1aa1b5){logger[_0xa7e5('0x12')](_0xa7e5('0x13'),_0x2f7aad,_0xa7e5('0x14'));logger[_0xa7e5('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2f7aad,_0xa7e5('0x14'),JSON[_0xa7e5('0x16')](_0x1aa1b5));if(_0x1aa1b5[_0xa7e5('0x17')]){if(_0x1aa1b5[_0xa7e5('0x17')][_0xa7e5('0x18')]===0x1f4){logger['error'](_0xa7e5('0x13'),_0x2f7aad,_0x1aa1b5[_0xa7e5('0x17')][_0xa7e5('0x19')]);return _0x581362(_0x1aa1b5['error'][_0xa7e5('0x19')]);}logger[_0xa7e5('0x17')](_0xa7e5('0x13'),_0x2f7aad,_0x1aa1b5[_0xa7e5('0x17')][_0xa7e5('0x19')]);return _0x39083d(_0x1aa1b5[_0xa7e5('0x17')][_0xa7e5('0x19')]);}else{logger[_0xa7e5('0x12')](_0xa7e5('0x13'),_0x2f7aad,'request\x20sent');_0x39083d(_0x1aa1b5['result'][_0xa7e5('0x19')]);}})[_0xa7e5('0x1a')](function(_0x1ff9ee){logger[_0xa7e5('0x17')](_0xa7e5('0x13'),_0x2f7aad,_0x1ff9ee);_0x581362(_0x1ff9ee);});});}exports[_0xa7e5('0x1b')]=function(_0x28cbdb){var _0x3a45b0=this;return new Promise(function(_0x2059c5,_0x2a59e3){return db['FaxAccount'][_0xa7e5('0x1c')]({'raw':_0x28cbdb[_0xa7e5('0x1d')]?_0x28cbdb['options']['raw']===undefined?!![]:![]:!![],'where':_0x28cbdb[_0xa7e5('0x1d')]?_0x28cbdb[_0xa7e5('0x1d')][_0xa7e5('0x1e')]||null:null,'attributes':_0x28cbdb['options']?_0x28cbdb['options'][_0xa7e5('0x1f')]||null:null,'limit':_0x28cbdb[_0xa7e5('0x1d')]?_0x28cbdb[_0xa7e5('0x1d')][_0xa7e5('0x20')]||null:null,'include':_0x28cbdb['options']?_0x28cbdb[_0xa7e5('0x1d')]['include']?_[_0xa7e5('0x21')](_0x28cbdb[_0xa7e5('0x1d')][_0xa7e5('0x22')],function(_0x29d591){return{'model':db[_0x29d591[_0xa7e5('0x23')]],'as':_0x29d591['as'],'attributes':_0x29d591['attributes'],'include':_0x29d591[_0xa7e5('0x22')]?_['map'](_0x29d591[_0xa7e5('0x22')],function(_0x273dee){return{'model':db[_0x273dee[_0xa7e5('0x23')]],'as':_0x273dee['as'],'attributes':_0x273dee[_0xa7e5('0x1f')],'include':_0x273dee['include']?_[_0xa7e5('0x21')](_0x273dee['include'],function(_0x360cc6){return{'model':db[_0x360cc6[_0xa7e5('0x23')]],'as':_0x360cc6['as'],'attributes':_0x360cc6['attributes']};}):[]};}):[]};}):[]:[]})[_0xa7e5('0x11')](function(_0x3aaa68){logger[_0xa7e5('0x12')](_0xa7e5('0x1b'),_0x28cbdb);logger[_0xa7e5('0x15')](_0xa7e5('0x1b'),_0x28cbdb,JSON[_0xa7e5('0x16')](_0x3aaa68));_0x2059c5(_0x3aaa68);})[_0xa7e5('0x1a')](function(_0xa800e7){logger[_0xa7e5('0x17')](_0xa7e5('0x1b'),_0xa800e7[_0xa7e5('0x19')],_0x28cbdb);_0x2a59e3(_0x3a45b0['error'](0x1f4,_0xa800e7[_0xa7e5('0x19')]));});});};exports[_0xa7e5('0x24')]=function(_0x12dcf0,_0x33f5d3,_0x4929a1){var _0x296ebf=this;return new Promise(function(_0xb82497,_0x336896){var _0x9cfdcd={'body':_0x12dcf0[_0xa7e5('0x25')],'channel':'fax'};var _0x171233=[];var _0x1aa415=[];var _0x19a4f2={};return db[_0xa7e5('0x26')][_0xa7e5('0x27')]()[_0xa7e5('0x11')](function(_0x301036){if(!_0x301036){throw new db[(_0xa7e5('0x28'))][(_0xa7e5('0x29'))](_0xa7e5('0x2a'));}_0x171233=_[_0xa7e5('0x2b')](_[_0xa7e5('0x2c')](_0x301036),['createdAt',_0xa7e5('0x2d')]);_0x1aa415=_['difference'](_['keys'](_0x301036),[_0xa7e5('0x2e'),_0xa7e5('0x2d'),_0xa7e5('0x2f'),_0xa7e5('0x30')]);if(_0x12dcf0['body']['id']){delete _0x12dcf0[_0xa7e5('0x25')]['id'];}if(_['isNil'](_0x12dcf0[_0xa7e5('0x25')]['from'])){throw new db['Sequelize'][(_0xa7e5('0x29'))]('from\x20is\x20mandatory');}if(_[_0xa7e5('0x31')](_0x12dcf0['body'][_0xa7e5('0x25')])||_0x12dcf0['body'][_0xa7e5('0x25')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa7e5('0x31')](_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x32')])){throw new db[(_0xa7e5('0x28'))][(_0xa7e5('0x29'))](_0xa7e5('0x33')+_0x1aa415);}if(!_[_0xa7e5('0x34')](_0x1aa415,_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x32')])){throw new db['Sequelize'][(_0xa7e5('0x29'))](_0xa7e5('0x35')+_0x1aa415);}_0x19a4f2[_0x12dcf0['body'][_0xa7e5('0x32')]]=_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x36')];})[_0xa7e5('0x11')](function(){return db[_0xa7e5('0x37')][_0xa7e5('0x38')]({'where':{'id':_0x12dcf0['account']['id']},'include':[{'model':db[_0xa7e5('0x39')],'as':_0xa7e5('0x3a'),'include':[{'model':db[_0xa7e5('0x26')],'as':_0xa7e5('0x3b'),'where':_0x19a4f2,'limit':0x1,'order':[[_0xa7e5('0x2d'),'DESC']]}]},{'model':db[_0xa7e5('0x3c')],'as':'Applications'}]});})['then'](function(_0x251ca3){if(_0x251ca3&&_0x251ca3[_0xa7e5('0x3a')]){var _0x24ca45=_0x251ca3[_0xa7e5('0x3d')]({'plain':!![]});_0x9cfdcd[_0xa7e5('0x3e')]=_0x24ca45;_0x9cfdcd[_0xa7e5('0x3f')]=_0x24ca45[_0xa7e5('0x40')];_0x9cfdcd['list']=_0x24ca45[_0xa7e5('0x3a')];_0x9cfdcd[_0xa7e5('0x3f')]=_[_0xa7e5('0x41')](_0x9cfdcd['applications'],[_0xa7e5('0x42')],[_0xa7e5('0x43')]);if(_0x9cfdcd[_0xa7e5('0x3e')][_0xa7e5('0x40')]){delete _0x9cfdcd['account'][_0xa7e5('0x40')];}if(_0x9cfdcd[_0xa7e5('0x3e')][_0xa7e5('0x3a')]&&_0x9cfdcd['account'][_0xa7e5('0x3a')][_0xa7e5('0x3b')][_0xa7e5('0x44')]){return _0x9cfdcd[_0xa7e5('0x3e')]['List'][_0xa7e5('0x3b')][0x0];}var _0x4425ec=_[_0xa7e5('0xe')](_0x12dcf0[_0xa7e5('0x25')],{'firstName':_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x36')],'ListId':_0x24ca45['ListId']});_0x4425ec[_0x12dcf0['body'][_0xa7e5('0x32')]]=_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x36')];return db[_0xa7e5('0x26')][_0xa7e5('0x45')](_0x4425ec,{'fields':_0x171233,'raw':!![]});}})[_0xa7e5('0x11')](function(_0x20c765){_0x9cfdcd[_0xa7e5('0x46')]=_0x20c765;if(_0x20c765){var _0x2c9913={'ContactId':_0x20c765['id'],'FaxAccountId':_0x12dcf0[_0xa7e5('0x3e')]['id'],'fax':_0x20c765['fax']};return db[_0xa7e5('0x47')][_0xa7e5('0x38')]({'where':{'ContactId':_0x20c765['id'],'closed':![],'FaxAccountId':_0x12dcf0[_0xa7e5('0x3e')]['id']}})[_0xa7e5('0x11')](function(_0x29e488){if(_0x29e488){return[_0x29e488,![]];}return db[_0xa7e5('0x47')][_0xa7e5('0x45')](_0x2c9913)[_0xa7e5('0x11')](function(_0x4149bd){return[_0x4149bd,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa7e5('0x48')](function(_0x1d9363,_0x367369){var _0x525678=_0x1d9363[_0xa7e5('0x3d')]({'plain':!![]});if(_0x367369){if(_0x9cfdcd['account'][_0xa7e5('0x49')]){_0x9cfdcd[_0xa7e5('0x3f')]['push']({'id':0x0,'priority':_0x9cfdcd['applications'][_0xa7e5('0x44')]+0x1,'app':_0xa7e5('0x4a'),'appdata':_0xa7e5('0x4b'),'interval':_0xa7e5('0x4c')});}_0x525678['created']=!![];}else{_0x525678[_0xa7e5('0x4d')]=![];}_0x9cfdcd[_0xa7e5('0x4e')]=_0x525678;return db[_0xa7e5('0x4f')][_0xa7e5('0x45')]({'body':_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x25')],'FaxAccountId':_0x12dcf0[_0xa7e5('0x3e')]['id'],'FaxInteractionId':_0x1d9363['id'],'direction':'in','ContactId':_0x1d9363['ContactId'],'AttachmentId':_0x12dcf0['body'][_0xa7e5('0x50')]});})['then'](function(_0x544c5f){_0x9cfdcd[_0xa7e5('0x19')]=_0x544c5f;if(!_0x9cfdcd[_0xa7e5('0x4e')][_0xa7e5('0x51')])return;return db[_0xa7e5('0x52')][_0xa7e5('0x38')]({'attributes':['id',_0xa7e5('0x53')],'where':{'id':_0x9cfdcd[_0xa7e5('0x4e')][_0xa7e5('0x51')]}});})[_0xa7e5('0x11')](function(_0x3ee9fb){if(_0x3ee9fb){_0x9cfdcd[_0xa7e5('0x3f')][_0xa7e5('0x54')]({'id':0x0,'priority':0x0,'app':_0xa7e5('0x55'),'appdata':_0x3ee9fb['name']+','+(_0x9cfdcd[_0xa7e5('0x3e')][_0xa7e5('0x56')]||0xa),'interval':'*,*,*,*'});}if(!_0x9cfdcd[_0xa7e5('0x4e')][_0xa7e5('0x57')])return;return db['FaxQueue']['find']({'attributes':['id',_0xa7e5('0x53')],'where':{'id':_0x9cfdcd[_0xa7e5('0x4e')][_0xa7e5('0x57')]}});})[_0xa7e5('0x11')](function(_0x1decbf){if(_0x1decbf){_0x9cfdcd[_0xa7e5('0x3f')][_0xa7e5('0x54')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1decbf[_0xa7e5('0x53')]+','+(_0x9cfdcd[_0xa7e5('0x3e')][_0xa7e5('0x58')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa7e5('0x59'),'startRouting',_0x9cfdcd);})[_0xa7e5('0x11')](function(_0x1d080c){_0xb82497(_0x1d080c);})[_0xa7e5('0x1a')](function(_0x4f29d7){_0x336896(_0x296ebf[_0xa7e5('0x17')](0x1f4,_0x4f29d7[_0xa7e5('0x19')]));});});}; \ No newline at end of file +var _0xbde2=['UserId','User','name','agent','waitForTheAssignedAgent','*,*,*,*','queueId','queue','waitForTheAssignedQueue','Start','startRouting','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./faxAccount.socket','register','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','then','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','Contacts','length','defaults','CmContact','contact','create','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbde2,0x1c8));var _0x2bde=function(_0x4c6ea9,_0x2ae016){_0x4c6ea9=_0x4c6ea9-0x0;var _0x4e10c2=_0xbde2[_0x4c6ea9];return _0x4e10c2;};'use strict';var _=require('lodash');var util=require(_0x2bde('0x0'));var moment=require(_0x2bde('0x1'));var BPromise=require(_0x2bde('0x2'));var rs=require(_0x2bde('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2bde('0x4'));var logger=require(_0x2bde('0x5'))(_0x2bde('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2bde('0x7')][_0x2bde('0x8')]({'port':0x232c});config[_0x2bde('0x9')]=_['defaults'](config[_0x2bde('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2bde('0xa'))(new Redis(config['redis']));require(_0x2bde('0xb'))[_0x2bde('0xc')](socket);function respondWithRpcPromise(_0x4aeea8,_0xabbcea,_0x35a557){return new BPromise(function(_0x3ddd2f,_0x4156a2){return client['request'](_0x4aeea8,_0x35a557)['then'](function(_0x259d3d){logger[_0x2bde('0xd')]('FaxAccount,\x20%s,\x20%s',_0xabbcea,_0x2bde('0xe'));logger[_0x2bde('0xf')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0xabbcea,_0x2bde('0xe'),JSON[_0x2bde('0x10')](_0x259d3d));if(_0x259d3d['error']){if(_0x259d3d[_0x2bde('0x11')][_0x2bde('0x12')]===0x1f4){logger[_0x2bde('0x11')](_0x2bde('0x13'),_0xabbcea,_0x259d3d[_0x2bde('0x11')][_0x2bde('0x14')]);return _0x4156a2(_0x259d3d['error'][_0x2bde('0x14')]);}logger[_0x2bde('0x11')](_0x2bde('0x13'),_0xabbcea,_0x259d3d[_0x2bde('0x11')][_0x2bde('0x14')]);return _0x3ddd2f(_0x259d3d[_0x2bde('0x11')]['message']);}else{logger['info'](_0x2bde('0x13'),_0xabbcea,_0x2bde('0xe'));_0x3ddd2f(_0x259d3d[_0x2bde('0x15')]['message']);}})[_0x2bde('0x16')](function(_0x3c1245){logger[_0x2bde('0x11')](_0x2bde('0x13'),_0xabbcea,_0x3c1245);_0x4156a2(_0x3c1245);});});}exports[_0x2bde('0x17')]=function(_0x2c9d60){var _0x451eeb=this;return new Promise(function(_0x5eebd8,_0x38151f){return db['FaxAccount']['findAll']({'raw':_0x2c9d60[_0x2bde('0x18')]?_0x2c9d60[_0x2bde('0x18')][_0x2bde('0x19')]===undefined?!![]:![]:!![],'where':_0x2c9d60['options']?_0x2c9d60['options']['where']||null:null,'attributes':_0x2c9d60['options']?_0x2c9d60[_0x2bde('0x18')][_0x2bde('0x1a')]||null:null,'limit':_0x2c9d60['options']?_0x2c9d60[_0x2bde('0x18')][_0x2bde('0x1b')]||null:null,'include':_0x2c9d60['options']?_0x2c9d60[_0x2bde('0x18')][_0x2bde('0x1c')]?_[_0x2bde('0x1d')](_0x2c9d60[_0x2bde('0x18')][_0x2bde('0x1c')],function(_0x323343){return{'model':db[_0x323343['model']],'as':_0x323343['as'],'attributes':_0x323343[_0x2bde('0x1a')],'include':_0x323343[_0x2bde('0x1c')]?_[_0x2bde('0x1d')](_0x323343[_0x2bde('0x1c')],function(_0x522932){return{'model':db[_0x522932[_0x2bde('0x1e')]],'as':_0x522932['as'],'attributes':_0x522932[_0x2bde('0x1a')],'include':_0x522932[_0x2bde('0x1c')]?_[_0x2bde('0x1d')](_0x522932['include'],function(_0x30fcfa){return{'model':db[_0x30fcfa[_0x2bde('0x1e')]],'as':_0x30fcfa['as'],'attributes':_0x30fcfa[_0x2bde('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x904cc2){logger[_0x2bde('0xd')]('GetFaxAccount',_0x2c9d60);logger[_0x2bde('0xf')](_0x2bde('0x17'),_0x2c9d60,JSON[_0x2bde('0x10')](_0x904cc2));_0x5eebd8(_0x904cc2);})[_0x2bde('0x16')](function(_0x1e74f8){logger[_0x2bde('0x11')](_0x2bde('0x17'),_0x1e74f8[_0x2bde('0x14')],_0x2c9d60);_0x38151f(_0x451eeb[_0x2bde('0x11')](0x1f4,_0x1e74f8['message']));});});};exports[_0x2bde('0x1f')]=function(_0x1d1bef,_0x2b2180,_0x42a8dd){var _0x408ebb=this;return new Promise(function(_0x221930,_0x376169){var _0x506027={'body':_0x1d1bef[_0x2bde('0x20')],'channel':_0x2bde('0x21')};var _0x30f564=[];var _0x300399=[];var _0x4284b0={};return db['CmContact']['describe']()[_0x2bde('0x22')](function(_0x1c3e66){if(!_0x1c3e66){throw new db[(_0x2bde('0x23'))][(_0x2bde('0x24'))](_0x2bde('0x25'));}_0x30f564=_[_0x2bde('0x26')](_['keys'](_0x1c3e66),[_0x2bde('0x27'),_0x2bde('0x28')]);_0x300399=_[_0x2bde('0x26')](_[_0x2bde('0x29')](_0x1c3e66),[_0x2bde('0x27'),_0x2bde('0x28'),_0x2bde('0x2a'),_0x2bde('0x2b')]);if(_0x1d1bef[_0x2bde('0x20')]['id']){delete _0x1d1bef['body']['id'];}if(_[_0x2bde('0x2c')](_0x1d1bef['body'][_0x2bde('0x2d')])){throw new db[(_0x2bde('0x23'))]['ValidationError'](_0x2bde('0x2e'));}if(_[_0x2bde('0x2c')](_0x1d1bef['body'][_0x2bde('0x20')])||_0x1d1bef['body'][_0x2bde('0x20')]===''){throw new db[(_0x2bde('0x23'))][(_0x2bde('0x24'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2bde('0x2c')](_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x2f')])){throw new db[(_0x2bde('0x23'))]['ValidationError'](_0x2bde('0x30')+_0x300399);}if(!_['includes'](_0x300399,_0x1d1bef[_0x2bde('0x20')]['mapKey'])){throw new db[(_0x2bde('0x23'))][(_0x2bde('0x24'))](_0x2bde('0x31')+_0x300399);}_0x4284b0[_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x2f')]]=_0x1d1bef[_0x2bde('0x20')]['from'];})[_0x2bde('0x22')](function(){return db['FaxAccount'][_0x2bde('0x32')]({'where':{'id':_0x1d1bef[_0x2bde('0x33')]['id']},'include':[{'model':db['CmList'],'as':_0x2bde('0x34'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4284b0,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x2bde('0x35')],'as':_0x2bde('0x36')}]});})[_0x2bde('0x22')](function(_0x3e228f){if(_0x3e228f&&_0x3e228f[_0x2bde('0x34')]){var _0x38c4df=_0x3e228f[_0x2bde('0x37')]({'plain':!![]});_0x506027['account']=_0x38c4df;_0x506027[_0x2bde('0x38')]=_0x38c4df[_0x2bde('0x36')];_0x506027[_0x2bde('0x39')]=_0x38c4df[_0x2bde('0x34')];_0x506027['applications']=_[_0x2bde('0x3a')](_0x506027['applications'],[_0x2bde('0x3b')],[_0x2bde('0x3c')]);if(_0x506027['account'][_0x2bde('0x36')]){delete _0x506027['account']['Applications'];}if(_0x506027[_0x2bde('0x33')]['List']&&_0x506027[_0x2bde('0x33')][_0x2bde('0x34')][_0x2bde('0x3d')][_0x2bde('0x3e')]){return _0x506027[_0x2bde('0x33')][_0x2bde('0x34')][_0x2bde('0x3d')][0x0];}var _0x146cbe=_[_0x2bde('0x3f')](_0x1d1bef[_0x2bde('0x20')],{'firstName':_0x1d1bef[_0x2bde('0x20')]['from'],'ListId':_0x38c4df[_0x2bde('0x2b')]});_0x146cbe[_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x2f')]]=_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x2d')];return db[_0x2bde('0x40')]['create'](_0x146cbe,{'fields':_0x30f564,'raw':!![]});}})[_0x2bde('0x22')](function(_0x3d4dfb){_0x506027[_0x2bde('0x41')]=_0x3d4dfb;if(_0x3d4dfb){var _0x1f5302={'ContactId':_0x3d4dfb['id'],'FaxAccountId':_0x1d1bef[_0x2bde('0x33')]['id'],'fax':_0x3d4dfb['fax']};return db['FaxInteraction'][_0x2bde('0x32')]({'where':{'ContactId':_0x3d4dfb['id'],'closed':![],'FaxAccountId':_0x1d1bef[_0x2bde('0x33')]['id']}})[_0x2bde('0x22')](function(_0x4f761a){if(_0x4f761a){return[_0x4f761a,![]];}return db['FaxInteraction'][_0x2bde('0x42')](_0x1f5302)[_0x2bde('0x22')](function(_0x3a7ecb){return[_0x3a7ecb,!![]];});});}else{throw new Error(_0x2bde('0x43'));}})[_0x2bde('0x44')](function(_0x4562b4,_0x523dcf){var _0x4a1f95=_0x4562b4[_0x2bde('0x37')]({'plain':!![]});if(_0x523dcf){if(_0x506027[_0x2bde('0x33')][_0x2bde('0x45')]){_0x506027[_0x2bde('0x38')][_0x2bde('0x46')]({'id':0x0,'priority':_0x506027['applications']['length']+0x1,'app':_0x2bde('0x47'),'appdata':_0x2bde('0x48'),'interval':'*,*,*,*'});}_0x4a1f95['created']=!![];}else{_0x4a1f95[_0x2bde('0x49')]=![];}_0x506027[_0x2bde('0x4a')]=_0x4a1f95;return db[_0x2bde('0x4b')]['create']({'body':_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x20')],'FaxAccountId':_0x1d1bef[_0x2bde('0x33')]['id'],'FaxInteractionId':_0x4562b4['id'],'direction':'in','ContactId':_0x4562b4[_0x2bde('0x4c')],'AttachmentId':_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x4d')]});})[_0x2bde('0x22')](function(_0x222108){_0x506027[_0x2bde('0x14')]=_0x222108;if(!_0x506027[_0x2bde('0x4a')][_0x2bde('0x4e')])return;return db[_0x2bde('0x4f')]['find']({'attributes':['id',_0x2bde('0x50')],'where':{'id':_0x506027[_0x2bde('0x4a')]['UserId']}});})[_0x2bde('0x22')](function(_0xb59c4e){if(_0xb59c4e){_0x506027['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x2bde('0x51'),'appdata':_0xb59c4e[_0x2bde('0x50')]+','+(_0x506027['account'][_0x2bde('0x52')]||0xa),'interval':_0x2bde('0x53')});}if(!_0x506027[_0x2bde('0x4a')][_0x2bde('0x54')])return;return db['FaxQueue'][_0x2bde('0x32')]({'attributes':['id','name'],'where':{'id':_0x506027[_0x2bde('0x4a')][_0x2bde('0x54')]}});})[_0x2bde('0x22')](function(_0x5d57d5){if(_0x5d57d5){_0x506027['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x2bde('0x55'),'appdata':_0x5d57d5[_0x2bde('0x50')]+','+(_0x506027[_0x2bde('0x33')][_0x2bde('0x56')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2bde('0x57'),_0x2bde('0x58'),_0x506027);})[_0x2bde('0x22')](function(_0x488472){_0x221930(_0x488472);})[_0x2bde('0x16')](function(_0x2b827e){_0x376169(_0x408ebb[_0x2bde('0x11')](0x1f4,_0x2b827e[_0x2bde('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1052046..9d6d60c 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 _0xe5f2=['removeListener','register','./faxAccount.events','save','remove','update','emit'];(function(_0x477bcf,_0x36dbe0){var _0x21f54b=function(_0x51b109){while(--_0x51b109){_0x477bcf['push'](_0x477bcf['shift']());}};_0x21f54b(++_0x36dbe0);}(_0xe5f2,0x12f));var _0x2e5f=function(_0x33d3b1,_0x399036){_0x33d3b1=_0x33d3b1-0x0;var _0x433c6f=_0xe5f2[_0x33d3b1];return _0x433c6f;};'use strict';var FaxAccountEvents=require(_0x2e5f('0x0'));var events=[_0x2e5f('0x1'),_0x2e5f('0x2'),_0x2e5f('0x3')];function createListener(_0x5837d3,_0x486c00){return function(_0x2c21e7){_0x486c00[_0x2e5f('0x4')](_0x5837d3,_0x2c21e7);};}function removeListener(_0x1496d2,_0x96be2f){return function(){FaxAccountEvents[_0x2e5f('0x5')](_0x1496d2,_0x96be2f);};}exports[_0x2e5f('0x6')]=function(_0x5ed401){for(var _0x1bf637=0x0,_0x159d5f=events['length'];_0x1bf637<_0x159d5f;_0x1bf637++){var _0x1f29b0=events[_0x1bf637];var _0x36f25e=createListener('faxAccount:'+_0x1f29b0,_0x5ed401);FaxAccountEvents['on'](_0x1f29b0,_0x36f25e);}}; \ No newline at end of file +var _0x4817=['faxAccount:','./faxAccount.events','remove','update','removeListener','register'];(function(_0x261038,_0x2fab28){var _0x2fd230=function(_0x429660){while(--_0x429660){_0x261038['push'](_0x261038['shift']());}};_0x2fd230(++_0x2fab28);}(_0x4817,0xaf));var _0x7481=function(_0x18b255,_0x24442d){_0x18b255=_0x18b255-0x0;var _0x363ca9=_0x4817[_0x18b255];return _0x363ca9;};'use strict';var FaxAccountEvents=require(_0x7481('0x0'));var events=['save',_0x7481('0x1'),_0x7481('0x2')];function createListener(_0x36504f,_0x4bfbeb){return function(_0x16472c){_0x4bfbeb['emit'](_0x36504f,_0x16472c);};}function removeListener(_0x4905f9,_0x4c94fe){return function(){FaxAccountEvents[_0x7481('0x3')](_0x4905f9,_0x4c94fe);};}exports[_0x7481('0x4')]=function(_0x433d3a){for(var _0x401df6=0x0,_0x2e8d36=events['length'];_0x401df6<_0x2e8d36;_0x401df6++){var _0x250990=events[_0x401df6];var _0x5c0167=createListener(_0x7481('0x5')+_0x250990,_0x433d3a);FaxAccountEvents['on'](_0x250990,_0x5c0167);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 4023800..2d335a7 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 _0xe7d0=['/:id/interactions','/:id/applications','/:id/messages','/:id/users','getAgents','post','create','addApplications','/addaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','/:id','destroy','removeAnswers','removeAgents','exports','util','path','express','Router','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x5015c6,_0x402a93){var _0x34d689=function(_0x162e6d){while(--_0x162e6d){_0x5015c6['push'](_0x5015c6['shift']());}};_0x34d689(++_0x402a93);}(_0xe7d0,0x118));var _0x0e7d=function(_0x5817f8,_0x27c8d3){_0x5817f8=_0x5817f8-0x0;var _0x253f18=_0xe7d0[_0x5817f8];return _0x253f18;};'use strict';var multer=require('multer');var util=require(_0x0e7d('0x0'));var path=require(_0x0e7d('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e7d('0x2'));var router=express[_0x0e7d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e7d('0x4'));var controller=require(_0x0e7d('0x5'));router[_0x0e7d('0x6')]('/',auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x8')]);router['get'](_0x0e7d('0x9'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0xa')]);router[_0x0e7d('0x6')]('/:id',auth[_0x0e7d('0x7')](),controller[_0x0e7d('0xb')]);router[_0x0e7d('0x6')](_0x0e7d('0xc'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0xd')]);router[_0x0e7d('0x6')](_0x0e7d('0xe'),auth['isAuthenticated'](),controller[_0x0e7d('0xf')]);router['get'](_0x0e7d('0x10'),auth[_0x0e7d('0x7')](),controller['getInteractions']);router[_0x0e7d('0x6')](_0x0e7d('0x11'),auth[_0x0e7d('0x7')](),controller['getApplications']);router[_0x0e7d('0x6')](_0x0e7d('0x12'),auth[_0x0e7d('0x7')](),controller['getMessages']);router[_0x0e7d('0x6')](_0x0e7d('0x13'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x14')]);router[_0x0e7d('0x15')]('/',auth['isAuthenticated'](),controller[_0x0e7d('0x16')]);router['post'](_0x0e7d('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x0e7d('0x15')](_0x0e7d('0xe'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x0e7d('0x10'),auth[_0x0e7d('0x7')](),controller['addInteraction']);router[_0x0e7d('0x15')](_0x0e7d('0x11'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x17')]);router[_0x0e7d('0x15')](_0x0e7d('0x18'),auth[_0x0e7d('0x7')](),controller['addAccountApplications']);router[_0x0e7d('0x15')]('/updateaccountapplications',auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x19')]);router['post'](_0x0e7d('0x1a'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x1b')]);router['post'](_0x0e7d('0x13'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x1c')]);router[_0x0e7d('0x1d')]('/:id',auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x1e')]);router[_0x0e7d('0x1f')](_0x0e7d('0x20'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x21')]);router[_0x0e7d('0x1f')](_0x0e7d('0xc'),auth[_0x0e7d('0x7')](),controller['removeDispositions']);router['delete'](_0x0e7d('0xe'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x22')]);router[_0x0e7d('0x1f')](_0x0e7d('0x13'),auth['isAuthenticated'](),controller[_0x0e7d('0x23')]);module[_0x0e7d('0x24')]=router; \ No newline at end of file +var _0xbed5=['../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','delete','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express'];(function(_0x1a1269,_0x4d8e3c){var _0xe0e23f=function(_0x24cf66){while(--_0x24cf66){_0x1a1269['push'](_0x1a1269['shift']());}};_0xe0e23f(++_0x4d8e3c);}(_0xbed5,0x16e));var _0x5bed=function(_0x1b6b20,_0x3bc526){_0x1b6b20=_0x1b6b20-0x0;var _0x132558=_0xbed5[_0x1b6b20];return _0x132558;};'use strict';var multer=require('multer');var util=require(_0x5bed('0x0'));var path=require(_0x5bed('0x1'));var timeout=require(_0x5bed('0x2'));var express=require(_0x5bed('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5bed('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5bed('0x5'));var controller=require(_0x5bed('0x6'));router[_0x5bed('0x7')]('/',auth[_0x5bed('0x8')](),controller[_0x5bed('0x9')]);router['get']('/describe',auth[_0x5bed('0x8')](),controller[_0x5bed('0xa')]);router[_0x5bed('0x7')](_0x5bed('0xb'),auth[_0x5bed('0x8')](),controller[_0x5bed('0xc')]);router[_0x5bed('0x7')](_0x5bed('0xd'),auth['isAuthenticated'](),controller[_0x5bed('0xe')]);router[_0x5bed('0x7')](_0x5bed('0xf'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x10')]);router[_0x5bed('0x7')](_0x5bed('0x11'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x12')]);router[_0x5bed('0x7')](_0x5bed('0x13'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x14')]);router[_0x5bed('0x7')](_0x5bed('0x15'),auth['isAuthenticated'](),controller[_0x5bed('0x16')]);router['get']('/:id/users',auth[_0x5bed('0x8')](),controller[_0x5bed('0x17')]);router[_0x5bed('0x18')]('/',auth[_0x5bed('0x8')](),controller['create']);router[_0x5bed('0x18')](_0x5bed('0xd'),auth[_0x5bed('0x8')](),controller['addDisposition']);router[_0x5bed('0x18')](_0x5bed('0xf'),auth[_0x5bed('0x8')](),controller['addAnswer']);router[_0x5bed('0x18')]('/:id/interactions',auth[_0x5bed('0x8')](),controller['addInteraction']);router[_0x5bed('0x18')](_0x5bed('0x13'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x19')]);router[_0x5bed('0x18')]('/addaccountapplications',auth[_0x5bed('0x8')](),controller[_0x5bed('0x1a')]);router[_0x5bed('0x18')](_0x5bed('0x1b'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x1c')]);router[_0x5bed('0x18')](_0x5bed('0x1d'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x1e')]);router[_0x5bed('0x18')](_0x5bed('0x1f'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x20')]);router['put'](_0x5bed('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5bed('0x21')]('/:id',auth[_0x5bed('0x8')](),controller['destroy']);router[_0x5bed('0x21')](_0x5bed('0xd'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x22')]);router[_0x5bed('0x21')]('/:id/canned_answers',auth[_0x5bed('0x8')](),controller[_0x5bed('0x23')]);router[_0x5bed('0x21')](_0x5bed('0x1f'),auth[_0x5bed('0x8')](),controller['removeAgents']);module[_0x5bed('0x24')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index f90c70f..8802ae2 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 _0x36db=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0xf26c80,_0x41e71a){var _0x238f0c=function(_0xe280ac){while(--_0xe280ac){_0xf26c80['push'](_0xf26c80['shift']());}};_0x238f0c(++_0x41e71a);}(_0x36db,0x151));var _0xb36d=function(_0x486be5,_0x443cb9){_0x486be5=_0x486be5-0x0;var _0x5ebcbe=_0x36db[_0x486be5];return _0x5ebcbe;};'use strict';var Sequelize=require(_0xb36d('0x0'));module[_0xb36d('0x1')]={'priority':{'type':Sequelize[_0xb36d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb36d('0x3')],'allowNull':![],'defaultValue':_0xb36d('0x4')},'appdata':{'type':Sequelize[_0xb36d('0x5')]()},'description':{'type':Sequelize[_0xb36d('0x3')]},'interval':{'type':Sequelize[_0xb36d('0x3')],'defaultValue':_0xb36d('0x6')}}; \ No newline at end of file +var _0xde82=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x2c4ab5,_0x41a982){var _0x5b8a25=function(_0x15741a){while(--_0x15741a){_0x2c4ab5['push'](_0x2c4ab5['shift']());}};_0x5b8a25(++_0x41a982);}(_0xde82,0xad));var _0x2de8=function(_0x158ea9,_0x56b2ec){_0x158ea9=_0x158ea9-0x0;var _0x52eff7=_0xde82[_0x158ea9];return _0x52eff7;};'use strict';var Sequelize=require('sequelize');module[_0x2de8('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2de8('0x1')],'allowNull':![],'defaultValue':_0x2de8('0x2')},'appdata':{'type':Sequelize[_0x2de8('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2de8('0x1')],'defaultValue':_0x2de8('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 8df47b7..f8184c1 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 _0x770f=['zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','FaxApplication','rawAttributes','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','show','include','options','find','create','body','params','eml-format'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0x770f,0xe0));var _0xf770=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x770f[_0x49a57c];return _0x4e0316;};'use strict';var emlformat=require(_0xf770('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf770('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf770('0x2'));var moment=require(_0xf770('0x3'));var BPromise=require(_0xf770('0x4'));var Mustache=require(_0xf770('0x5'));var util=require(_0xf770('0x6'));var path=require(_0xf770('0x7'));var sox=require(_0xf770('0x8'));var csv=require(_0xf770('0x9'));var ejs=require(_0xf770('0xa'));var fs=require('fs');var fs_extra=require(_0xf770('0xb'));var _=require('lodash');var squel=require(_0xf770('0xc'));var crypto=require(_0xf770('0xd'));var jsforce=require(_0xf770('0xe'));var deskjs=require(_0xf770('0xf'));var toCsv=require(_0xf770('0x9'));var querystring=require(_0xf770('0x10'));var Papa=require(_0xf770('0x11'));var Redis=require(_0xf770('0x12'));var authService=require(_0xf770('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf770('0x14'));var hardwareService=require(_0xf770('0x15'));var logger=require(_0xf770('0x16'))('api');var utils=require(_0xf770('0x17'));var config=require(_0xf770('0x18'));var licenseUtil=require(_0xf770('0x19'));var db=require(_0xf770('0x1a'))['db'];function respondWithStatusCode(_0x28ed01,_0x151c48){_0x151c48=_0x151c48||0xcc;return function(_0x5a76bc){if(_0x5a76bc){return _0x28ed01[_0xf770('0x1b')](_0x151c48);}return _0x28ed01[_0xf770('0x1c')](_0x151c48)[_0xf770('0x1d')]();};}function respondWithResult(_0xd7148e,_0x269880){_0x269880=_0x269880||0xc8;return function(_0x446498){if(_0x446498){return _0xd7148e[_0xf770('0x1c')](_0x269880)['json'](_0x446498);}};}function respondWithFilteredResult(_0x23d008,_0x12c4d6){return function(_0x3c1a0e){if(_0x3c1a0e){var _0x4d5302=typeof _0x12c4d6[_0xf770('0x1e')]===_0xf770('0x1f')&&typeof _0x12c4d6['limit']==='undefined';var _0x4dfdcd=_0x3c1a0e[_0xf770('0x20')];var _0x22abdd=_0x4d5302?0x0:_0x12c4d6['offset'];var _0x2bc62c=_0x4d5302?_0x3c1a0e[_0xf770('0x20')]:_0x12c4d6[_0xf770('0x1e')]+_0x12c4d6[_0xf770('0x21')];var _0x38b53b;if(_0x2bc62c>=_0x4dfdcd){_0x2bc62c=_0x4dfdcd;_0x38b53b=0xc8;}else{_0x38b53b=0xce;}_0x23d008[_0xf770('0x1c')](_0x38b53b);return _0x23d008[_0xf770('0x22')](_0xf770('0x23'),_0x22abdd+'-'+_0x2bc62c+'/'+_0x4dfdcd)[_0xf770('0x24')](_0x3c1a0e);}return null;};}function patchUpdates(_0x5a60bf){return function(_0x265c61){try{jsonpatch[_0xf770('0x25')](_0x265c61,_0x5a60bf,!![]);}catch(_0x2973dd){return BPromise[_0xf770('0x26')](_0x2973dd);}return _0x265c61[_0xf770('0x27')]();};}function saveUpdates(_0xd9b7c4,_0x55ab39){return function(_0x3ff01d){if(_0x3ff01d){return _0x3ff01d[_0xf770('0x28')](_0xd9b7c4)[_0xf770('0x29')](function(_0x103fea){return _0x103fea;});}return null;};}function removeEntity(_0x2c141c,_0x3f7ae9){return function(_0x4cac41){if(_0x4cac41){return _0x4cac41[_0xf770('0x2a')]()['then'](function(){_0x2c141c[_0xf770('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50695a,_0x19ceb3){return function(_0x1f56f6){if(!_0x1f56f6){_0x50695a[_0xf770('0x1b')](0x194);}return _0x1f56f6;};}function handleError(_0x1d225,_0x2fdf38){_0x2fdf38=_0x2fdf38||0x1f4;return function(_0x3929a5){logger[_0xf770('0x2b')](_0x3929a5[_0xf770('0x2c')]);if(_0x3929a5[_0xf770('0x2d')]){delete _0x3929a5[_0xf770('0x2d')];}_0x1d225[_0xf770('0x1c')](_0x2fdf38)['send'](_0x3929a5);};}exports[_0xf770('0x2e')]=function(_0x1dc449,_0x8cf592){var _0x23bb46={},_0x2a0d59={},_0x19a188={'count':0x0,'rows':[]};var _0xb183b3=_['map'](db[_0xf770('0x2f')][_0xf770('0x30')],function(_0x5b977a){return{'name':_0x5b977a['fieldName'],'type':_0x5b977a[_0xf770('0x31')]['key']};});_0x2a0d59['model']=_['map'](_0xb183b3,_0xf770('0x2d'));_0x2a0d59[_0xf770('0x32')]=_[_0xf770('0x33')](_0x1dc449[_0xf770('0x32')]);_0x2a0d59['filters']=_[_0xf770('0x34')](_0x2a0d59['model'],_0x2a0d59[_0xf770('0x32')]);_0x23bb46[_0xf770('0x35')]=_[_0xf770('0x34')](_0x2a0d59[_0xf770('0x36')],qs[_0xf770('0x37')](_0x1dc449[_0xf770('0x32')][_0xf770('0x37')]));_0x23bb46[_0xf770('0x35')]=_0x23bb46[_0xf770('0x35')][_0xf770('0x38')]?_0x23bb46[_0xf770('0x35')]:_0x2a0d59[_0xf770('0x36')];if(!_0x1dc449[_0xf770('0x32')][_0xf770('0x39')]('nolimit')){_0x23bb46[_0xf770('0x21')]=qs[_0xf770('0x21')](_0x1dc449['query']['limit']);_0x23bb46['offset']=qs[_0xf770('0x1e')](_0x1dc449[_0xf770('0x32')][_0xf770('0x1e')]);}_0x23bb46[_0xf770('0x3a')]=qs[_0xf770('0x3b')](_0x1dc449[_0xf770('0x32')]['sort']);_0x23bb46[_0xf770('0x3c')]=qs[_0xf770('0x3d')](_['pick'](_0x1dc449['query'],_0x2a0d59[_0xf770('0x3d')]),_0xb183b3);if(_0x1dc449[_0xf770('0x32')][_0xf770('0x3e')]){_0x23bb46[_0xf770('0x3c')]=_[_0xf770('0x3f')](_0x23bb46[_0xf770('0x3c')],{'$or':_['map'](_0xb183b3,function(_0x54c6b1){if(_0x54c6b1[_0xf770('0x31')]!==_0xf770('0x40')){var _0x1b0374={};_0x1b0374[_0x54c6b1[_0xf770('0x2d')]]={'$like':'%'+_0x1dc449[_0xf770('0x32')][_0xf770('0x3e')]+'%'};return _0x1b0374;}})});}_0x23bb46=_[_0xf770('0x3f')]({},_0x23bb46,_0x1dc449['options']);var _0x79c314={'where':_0x23bb46['where']};return db[_0xf770('0x2f')][_0xf770('0x20')](_0x79c314)[_0xf770('0x29')](function(_0x492237){_0x19a188['count']=_0x492237;if(_0x1dc449[_0xf770('0x32')][_0xf770('0x41')]){_0x23bb46['include']=[{'all':!![]}];}return db[_0xf770('0x2f')][_0xf770('0x42')](_0x23bb46);})['then'](function(_0x280753){_0x19a188['rows']=_0x280753;return _0x19a188;})[_0xf770('0x29')](respondWithFilteredResult(_0x8cf592,_0x23bb46))[_0xf770('0x43')](handleError(_0x8cf592,null));};exports[_0xf770('0x44')]=function(_0x18188d,_0x60f4fc){var _0x4189e5={'raw':!![],'where':{'id':_0x18188d['params']['id']}},_0x41c855={};_0x41c855['model']=_['keys'](db[_0xf770('0x2f')][_0xf770('0x30')]);_0x41c855['query']=_['keys'](_0x18188d['query']);_0x41c855[_0xf770('0x3d')]=_['intersection'](_0x41c855[_0xf770('0x36')],_0x41c855[_0xf770('0x32')]);_0x4189e5[_0xf770('0x35')]=_['intersection'](_0x41c855['model'],qs['fields'](_0x18188d[_0xf770('0x32')][_0xf770('0x37')]));_0x4189e5[_0xf770('0x35')]=_0x4189e5[_0xf770('0x35')]['length']?_0x4189e5[_0xf770('0x35')]:_0x41c855['model'];if(_0x18188d['query']['includeAll']){_0x4189e5[_0xf770('0x45')]=[{'all':!![]}];}_0x4189e5=_['merge']({},_0x4189e5,_0x18188d[_0xf770('0x46')]);return db[_0xf770('0x2f')][_0xf770('0x47')](_0x4189e5)['then'](handleEntityNotFound(_0x60f4fc,null))[_0xf770('0x29')](respondWithResult(_0x60f4fc,null))['catch'](handleError(_0x60f4fc,null));};exports[_0xf770('0x48')]=function(_0x250f75,_0x43fc1a){return db['FaxApplication'][_0xf770('0x48')](_0x250f75[_0xf770('0x49')],{})['then'](respondWithResult(_0x43fc1a,0xc9))[_0xf770('0x43')](handleError(_0x43fc1a,null));};exports[_0xf770('0x28')]=function(_0x5e7bc8,_0x3ae77e){if(_0x5e7bc8[_0xf770('0x49')]['id']){delete _0x5e7bc8[_0xf770('0x49')]['id'];}return db[_0xf770('0x2f')][_0xf770('0x47')]({'where':{'id':_0x5e7bc8['params']['id']}})[_0xf770('0x29')](handleEntityNotFound(_0x3ae77e,null))[_0xf770('0x29')](saveUpdates(_0x5e7bc8[_0xf770('0x49')],null))[_0xf770('0x29')](respondWithResult(_0x3ae77e,null))[_0xf770('0x43')](handleError(_0x3ae77e,null));};exports[_0xf770('0x2a')]=function(_0xf577f3,_0x4b7772){return db[_0xf770('0x2f')][_0xf770('0x47')]({'where':{'id':_0xf577f3[_0xf770('0x4a')]['id']}})[_0xf770('0x29')](handleEntityNotFound(_0x4b7772,null))[_0xf770('0x29')](removeEntity(_0x4b7772,null))[_0xf770('0x43')](handleError(_0x4b7772,null));}; \ No newline at end of file +var _0x7663=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','index','map','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','options','FaxApplication','include','findAll','then','show','params','rawAttributes','keys','length','merge','catch','create','body','find','eml-format','rimraf','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x57895d,_0x147d6c){var _0x41849e=function(_0x1e9bd8){while(--_0x1e9bd8){_0x57895d['push'](_0x57895d['shift']());}};_0x41849e(++_0x147d6c);}(_0x7663,0x1ef));var _0x3766=function(_0x363700,_0x1a61bd){_0x363700=_0x363700-0x0;var _0x451130=_0x7663[_0x363700];return _0x451130;};'use strict';var emlformat=require(_0x3766('0x0'));var rimraf=require(_0x3766('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3766('0x2'));var moment=require('moment');var BPromise=require(_0x3766('0x3'));var Mustache=require('mustache');var util=require(_0x3766('0x4'));var path=require('path');var sox=require(_0x3766('0x5'));var csv=require('to-csv');var ejs=require(_0x3766('0x6'));var fs=require('fs');var fs_extra=require(_0x3766('0x7'));var _=require(_0x3766('0x8'));var squel=require(_0x3766('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3766('0xa'));var toCsv=require(_0x3766('0xb'));var querystring=require(_0x3766('0xc'));var Papa=require(_0x3766('0xd'));var Redis=require(_0x3766('0xe'));var authService=require(_0x3766('0xf'));var qs=require(_0x3766('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3766('0x11'));var logger=require(_0x3766('0x12'))(_0x3766('0x13'));var utils=require(_0x3766('0x14'));var config=require(_0x3766('0x15'));var licenseUtil=require(_0x3766('0x16'));var db=require(_0x3766('0x17'))['db'];function respondWithStatusCode(_0x57bf02,_0x270633){_0x270633=_0x270633||0xcc;return function(_0x2b8a42){if(_0x2b8a42){return _0x57bf02['sendStatus'](_0x270633);}return _0x57bf02[_0x3766('0x18')](_0x270633)['end']();};}function respondWithResult(_0x51445e,_0x3d02ba){_0x3d02ba=_0x3d02ba||0xc8;return function(_0x2f56fe){if(_0x2f56fe){return _0x51445e[_0x3766('0x18')](_0x3d02ba)[_0x3766('0x19')](_0x2f56fe);}};}function respondWithFilteredResult(_0x110f4b,_0x28c07a){return function(_0x517aa9){if(_0x517aa9){var _0x3746e6=typeof _0x28c07a[_0x3766('0x1a')]==='undefined'&&typeof _0x28c07a[_0x3766('0x1b')]===_0x3766('0x1c');var _0x3aa152=_0x517aa9[_0x3766('0x1d')];var _0x1dbf20=_0x3746e6?0x0:_0x28c07a['offset'];var _0x45738f=_0x3746e6?_0x517aa9['count']:_0x28c07a[_0x3766('0x1a')]+_0x28c07a[_0x3766('0x1b')];var _0x3f9ef7;if(_0x45738f>=_0x3aa152){_0x45738f=_0x3aa152;_0x3f9ef7=0xc8;}else{_0x3f9ef7=0xce;}_0x110f4b[_0x3766('0x18')](_0x3f9ef7);return _0x110f4b[_0x3766('0x1e')](_0x3766('0x1f'),_0x1dbf20+'-'+_0x45738f+'/'+_0x3aa152)['json'](_0x517aa9);}return null;};}function patchUpdates(_0x295342){return function(_0x4c7c17){try{jsonpatch[_0x3766('0x20')](_0x4c7c17,_0x295342,!![]);}catch(_0x39be84){return BPromise[_0x3766('0x21')](_0x39be84);}return _0x4c7c17[_0x3766('0x22')]();};}function saveUpdates(_0x434b33,_0x298f88){return function(_0x5d0856){if(_0x5d0856){return _0x5d0856[_0x3766('0x23')](_0x434b33)['then'](function(_0x5d0e19){return _0x5d0e19;});}return null;};}function removeEntity(_0xddc753,_0x7b751f){return function(_0x2a90c4){if(_0x2a90c4){return _0x2a90c4[_0x3766('0x24')]()['then'](function(){_0xddc753[_0x3766('0x18')](0xcc)[_0x3766('0x25')]();});}};}function handleEntityNotFound(_0x3c868a,_0x3b36bf){return function(_0x2ee431){if(!_0x2ee431){_0x3c868a[_0x3766('0x26')](0x194);}return _0x2ee431;};}function handleError(_0x3fd61b,_0x401f81){_0x401f81=_0x401f81||0x1f4;return function(_0x74b1c0){logger['error'](_0x74b1c0[_0x3766('0x27')]);if(_0x74b1c0[_0x3766('0x28')]){delete _0x74b1c0[_0x3766('0x28')];}_0x3fd61b[_0x3766('0x18')](_0x401f81)['send'](_0x74b1c0);};}exports[_0x3766('0x29')]=function(_0x32d5b3,_0x2e61c2){var _0x4a1e68={},_0x56e37f={},_0x96c23e={'count':0x0,'rows':[]};var _0x236e97=_[_0x3766('0x2a')](db['FaxApplication']['rawAttributes'],function(_0x51fb65){return{'name':_0x51fb65['fieldName'],'type':_0x51fb65[_0x3766('0x2b')][_0x3766('0x2c')]};});_0x56e37f[_0x3766('0x2d')]=_[_0x3766('0x2a')](_0x236e97,_0x3766('0x28'));_0x56e37f[_0x3766('0x2e')]=_['keys'](_0x32d5b3['query']);_0x56e37f[_0x3766('0x2f')]=_[_0x3766('0x30')](_0x56e37f[_0x3766('0x2d')],_0x56e37f[_0x3766('0x2e')]);_0x4a1e68[_0x3766('0x31')]=_[_0x3766('0x30')](_0x56e37f[_0x3766('0x2d')],qs[_0x3766('0x32')](_0x32d5b3[_0x3766('0x2e')][_0x3766('0x32')]));_0x4a1e68[_0x3766('0x31')]=_0x4a1e68[_0x3766('0x31')]['length']?_0x4a1e68[_0x3766('0x31')]:_0x56e37f['model'];if(!_0x32d5b3['query']['hasOwnProperty'](_0x3766('0x33'))){_0x4a1e68[_0x3766('0x1b')]=qs[_0x3766('0x1b')](_0x32d5b3[_0x3766('0x2e')][_0x3766('0x1b')]);_0x4a1e68['offset']=qs[_0x3766('0x1a')](_0x32d5b3[_0x3766('0x2e')][_0x3766('0x1a')]);}_0x4a1e68[_0x3766('0x34')]=qs[_0x3766('0x35')](_0x32d5b3[_0x3766('0x2e')]['sort']);_0x4a1e68[_0x3766('0x36')]=qs[_0x3766('0x2f')](_[_0x3766('0x37')](_0x32d5b3[_0x3766('0x2e')],_0x56e37f['filters']),_0x236e97);if(_0x32d5b3['query'][_0x3766('0x38')]){_0x4a1e68[_0x3766('0x36')]=_['merge'](_0x4a1e68[_0x3766('0x36')],{'$or':_['map'](_0x236e97,function(_0x1d96d3){if(_0x1d96d3['type']!==_0x3766('0x39')){var _0x11c13b={};_0x11c13b[_0x1d96d3[_0x3766('0x28')]]={'$like':'%'+_0x32d5b3[_0x3766('0x2e')][_0x3766('0x38')]+'%'};return _0x11c13b;}})});}_0x4a1e68=_['merge']({},_0x4a1e68,_0x32d5b3[_0x3766('0x3a')]);var _0x11ac5e={'where':_0x4a1e68['where']};return db[_0x3766('0x3b')][_0x3766('0x1d')](_0x11ac5e)['then'](function(_0x4bf685){_0x96c23e['count']=_0x4bf685;if(_0x32d5b3['query']['includeAll']){_0x4a1e68[_0x3766('0x3c')]=[{'all':!![]}];}return db[_0x3766('0x3b')][_0x3766('0x3d')](_0x4a1e68);})[_0x3766('0x3e')](function(_0xa26eb6){_0x96c23e['rows']=_0xa26eb6;return _0x96c23e;})[_0x3766('0x3e')](respondWithFilteredResult(_0x2e61c2,_0x4a1e68))['catch'](handleError(_0x2e61c2,null));};exports[_0x3766('0x3f')]=function(_0x4c7570,_0x54a8eb){var _0x6179e6={'raw':!![],'where':{'id':_0x4c7570[_0x3766('0x40')]['id']}},_0x2b9f48={};_0x2b9f48['model']=_['keys'](db[_0x3766('0x3b')][_0x3766('0x41')]);_0x2b9f48['query']=_[_0x3766('0x42')](_0x4c7570['query']);_0x2b9f48[_0x3766('0x2f')]=_[_0x3766('0x30')](_0x2b9f48[_0x3766('0x2d')],_0x2b9f48['query']);_0x6179e6['attributes']=_[_0x3766('0x30')](_0x2b9f48[_0x3766('0x2d')],qs[_0x3766('0x32')](_0x4c7570[_0x3766('0x2e')][_0x3766('0x32')]));_0x6179e6[_0x3766('0x31')]=_0x6179e6[_0x3766('0x31')][_0x3766('0x43')]?_0x6179e6['attributes']:_0x2b9f48[_0x3766('0x2d')];if(_0x4c7570[_0x3766('0x2e')]['includeAll']){_0x6179e6[_0x3766('0x3c')]=[{'all':!![]}];}_0x6179e6=_[_0x3766('0x44')]({},_0x6179e6,_0x4c7570['options']);return db[_0x3766('0x3b')]['find'](_0x6179e6)['then'](handleEntityNotFound(_0x54a8eb,null))['then'](respondWithResult(_0x54a8eb,null))[_0x3766('0x45')](handleError(_0x54a8eb,null));};exports[_0x3766('0x46')]=function(_0x435230,_0x37e8d9){return db[_0x3766('0x3b')][_0x3766('0x46')](_0x435230['body'],{})['then'](respondWithResult(_0x37e8d9,0xc9))[_0x3766('0x45')](handleError(_0x37e8d9,null));};exports[_0x3766('0x23')]=function(_0x5661cf,_0x3d3a50){if(_0x5661cf[_0x3766('0x47')]['id']){delete _0x5661cf[_0x3766('0x47')]['id'];}return db[_0x3766('0x3b')][_0x3766('0x48')]({'where':{'id':_0x5661cf[_0x3766('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d3a50,null))[_0x3766('0x3e')](saveUpdates(_0x5661cf[_0x3766('0x47')],null))[_0x3766('0x3e')](respondWithResult(_0x3d3a50,null))[_0x3766('0x45')](handleError(_0x3d3a50,null));};exports[_0x3766('0x24')]=function(_0x248180,_0x120088){return db[_0x3766('0x3b')][_0x3766('0x48')]({'where':{'id':_0x248180[_0x3766('0x40')]['id']}})[_0x3766('0x3e')](handleEntityNotFound(_0x120088,null))[_0x3766('0x3e')](removeEntity(_0x120088,null))[_0x3766('0x45')](handleError(_0x120088,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 81cc1e8..6e2ecb7 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 _0x1d23=['api','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','fax_applications','utf8mb4_unicode_ci','lodash'];(function(_0x214120,_0x9b45d4){var _0x1767ba=function(_0x4cedb7){while(--_0x4cedb7){_0x214120['push'](_0x214120['shift']());}};_0x1767ba(++_0x9b45d4);}(_0x1d23,0x95));var _0x31d2=function(_0x25446b,_0x5d05aa){_0x25446b=_0x25446b-0x0;var _0x11409e=_0x1d23[_0x25446b];return _0x11409e;};'use strict';var _=require(_0x31d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x31d2('0x1'));var moment=require('moment');var BPromise=require(_0x31d2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31d2('0x3'));var rimraf=require(_0x31d2('0x4'));var config=require(_0x31d2('0x5'));var attributes=require(_0x31d2('0x6'));module[_0x31d2('0x7')]=function(_0x4acadd,_0x40e8ce){return _0x4acadd['define']('FaxApplication',attributes,{'tableName':_0x31d2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x31d2('0x9')});}; \ No newline at end of file +var _0xef98=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','lodash','util'];(function(_0x305d3d,_0x4cd35d){var _0x3ade52=function(_0x3510e7){while(--_0x3510e7){_0x305d3d['push'](_0x305d3d['shift']());}};_0x3ade52(++_0x4cd35d);}(_0xef98,0x12a));var _0x8ef9=function(_0x2f1ded,_0x5008ab){_0x2f1ded=_0x2f1ded-0x0;var _0x10e0c1=_0xef98[_0x2f1ded];return _0x10e0c1;};'use strict';var _=require(_0x8ef9('0x0'));var util=require(_0x8ef9('0x1'));var logger=require(_0x8ef9('0x2'))(_0x8ef9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8ef9('0x4'));var fs=require('fs');var path=require(_0x8ef9('0x5'));var rimraf=require(_0x8ef9('0x6'));var config=require(_0x8ef9('0x7'));var attributes=require(_0x8ef9('0x8'));module['exports']=function(_0x2d1064,_0x127d11){return _0x2d1064[_0x8ef9('0x9')](_0x8ef9('0xa'),attributes,{'tableName':_0x8ef9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index b1a1da2..b348e15 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 _0x750c=['info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x750c,0x1d2));var _0xc750=function(_0x45556c,_0x5daf3a){_0x45556c=_0x45556c-0x0;var _0xf0172f=_0x750c[_0x45556c];return _0xf0172f;};'use strict';var _=require('lodash');var util=require(_0xc750('0x0'));var moment=require(_0xc750('0x1'));var BPromise=require(_0xc750('0x2'));var rs=require(_0xc750('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc750('0x4'));var logger=require(_0xc750('0x5'))(_0xc750('0x6'));var config=require(_0xc750('0x7'));var jayson=require(_0xc750('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32ed9b,_0x21c08c,_0x520939){return new BPromise(function(_0x4d9e37,_0x589cef){return client['request'](_0x32ed9b,_0x520939)[_0xc750('0x9')](function(_0x4e6ba0){logger[_0xc750('0xa')](_0xc750('0xb'),_0x21c08c,'request\x20sent');logger[_0xc750('0xc')](_0xc750('0xd'),_0x21c08c,'request\x20sent',JSON[_0xc750('0xe')](_0x4e6ba0));if(_0x4e6ba0['error']){if(_0x4e6ba0[_0xc750('0xf')]['code']===0x1f4){logger[_0xc750('0xf')](_0xc750('0xb'),_0x21c08c,_0x4e6ba0[_0xc750('0xf')][_0xc750('0x10')]);return _0x589cef(_0x4e6ba0['error'][_0xc750('0x10')]);}logger[_0xc750('0xf')]('FaxApplication,\x20%s,\x20%s',_0x21c08c,_0x4e6ba0[_0xc750('0xf')][_0xc750('0x10')]);return _0x4d9e37(_0x4e6ba0[_0xc750('0xf')][_0xc750('0x10')]);}else{logger[_0xc750('0xa')](_0xc750('0xb'),_0x21c08c,_0xc750('0x11'));_0x4d9e37(_0x4e6ba0[_0xc750('0x12')][_0xc750('0x10')]);}})[_0xc750('0x13')](function(_0x190dc8){logger[_0xc750('0xf')](_0xc750('0xb'),_0x21c08c,_0x190dc8);_0x589cef(_0x190dc8);});});}exports[_0xc750('0x14')]=function(_0xb4bb68){var _0x44fbf7=this;return new Promise(function(_0x58666c,_0x5e0152){return db[_0xc750('0x15')]['update'](_0xb4bb68[_0xc750('0x16')],{'raw':_0xb4bb68[_0xc750('0x17')]?_0xb4bb68[_0xc750('0x17')][_0xc750('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb4bb68[_0xc750('0x17')]?_0xb4bb68[_0xc750('0x17')][_0xc750('0x19')]||null:null,'attributes':_0xb4bb68['options']?_0xb4bb68[_0xc750('0x17')][_0xc750('0x1a')]||null:null,'limit':_0xb4bb68[_0xc750('0x17')]?_0xb4bb68[_0xc750('0x17')][_0xc750('0x1b')]||null:null})[_0xc750('0x9')](function(_0x1c7c89){logger[_0xc750('0xa')](_0xc750('0x14'),_0xb4bb68);logger['debug'](_0xc750('0x14'),_0xb4bb68,JSON[_0xc750('0xe')](_0x1c7c89));_0x58666c(_0x1c7c89);})[_0xc750('0x13')](function(_0x402793){logger[_0xc750('0xf')](_0xc750('0x14'),_0x402793['message'],_0xb4bb68);_0x5e0152(_0x44fbf7[_0xc750('0xf')](0x1f4,_0x402793[_0xc750('0x10')]));});});}; \ No newline at end of file +var _0xfb8f=['update','body','options','raw','attributes','limit','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication'];(function(_0x7a0118,_0x565156){var _0x158a0a=function(_0x2829b3){while(--_0x2829b3){_0x7a0118['push'](_0x7a0118['shift']());}};_0x158a0a(++_0x565156);}(_0xfb8f,0x18c));var _0xffb8=function(_0x246605,_0x24c08a){_0x246605=_0x246605-0x0;var _0x5aab60=_0xfb8f[_0x246605];return _0x5aab60;};'use strict';var _=require('lodash');var util=require(_0xffb8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xffb8('0x1'));var fs=require('fs');var Redis=require(_0xffb8('0x2'));var db=require(_0xffb8('0x3'))['db'];var utils=require(_0xffb8('0x4'));var logger=require(_0xffb8('0x5'))('rpc');var config=require(_0xffb8('0x6'));var jayson=require(_0xffb8('0x7'));var client=jayson[_0xffb8('0x8')][_0xffb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a70ab,_0x57a38f,_0x33495b){return new BPromise(function(_0xb71c21,_0x2b892a){return client[_0xffb8('0xa')](_0x5a70ab,_0x33495b)[_0xffb8('0xb')](function(_0x487759){logger['info'](_0xffb8('0xc'),_0x57a38f,_0xffb8('0xd'));logger[_0xffb8('0xe')](_0xffb8('0xf'),_0x57a38f,_0xffb8('0xd'),JSON['stringify'](_0x487759));if(_0x487759[_0xffb8('0x10')]){if(_0x487759[_0xffb8('0x10')][_0xffb8('0x11')]===0x1f4){logger[_0xffb8('0x10')](_0xffb8('0xc'),_0x57a38f,_0x487759['error'][_0xffb8('0x12')]);return _0x2b892a(_0x487759[_0xffb8('0x10')][_0xffb8('0x12')]);}logger['error'](_0xffb8('0xc'),_0x57a38f,_0x487759['error']['message']);return _0xb71c21(_0x487759[_0xffb8('0x10')][_0xffb8('0x12')]);}else{logger[_0xffb8('0x13')](_0xffb8('0xc'),_0x57a38f,_0xffb8('0xd'));_0xb71c21(_0x487759[_0xffb8('0x14')][_0xffb8('0x12')]);}})[_0xffb8('0x15')](function(_0x1a310e){logger['error']('FaxApplication,\x20%s,\x20%s',_0x57a38f,_0x1a310e);_0x2b892a(_0x1a310e);});});}exports[_0xffb8('0x16')]=function(_0x514cba){var _0x568512=this;return new Promise(function(_0x506284,_0x50754f){return db[_0xffb8('0x17')][_0xffb8('0x18')](_0x514cba[_0xffb8('0x19')],{'raw':_0x514cba[_0xffb8('0x1a')]?_0x514cba['options'][_0xffb8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x514cba[_0xffb8('0x1a')]?_0x514cba[_0xffb8('0x1a')]['where']||null:null,'attributes':_0x514cba[_0xffb8('0x1a')]?_0x514cba['options'][_0xffb8('0x1c')]||null:null,'limit':_0x514cba[_0xffb8('0x1a')]?_0x514cba['options'][_0xffb8('0x1d')]||null:null})[_0xffb8('0xb')](function(_0x83695e){logger[_0xffb8('0x13')](_0xffb8('0x16'),_0x514cba);logger[_0xffb8('0xe')](_0xffb8('0x16'),_0x514cba,JSON['stringify'](_0x83695e));_0x506284(_0x83695e);})[_0xffb8('0x15')](function(_0x4b16de){logger[_0xffb8('0x10')](_0xffb8('0x16'),_0x4b16de['message'],_0x514cba);_0x50754f(_0x568512['error'](0x1f4,_0x4b16de[_0xffb8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 2b3e96f..e0e5c22 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(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xb688,0xcf));var _0x8b68=function(_0xd12b6f,_0x54a063){_0xd12b6f=_0xd12b6f-0x0;var _0x3337b0=_0xb688[_0xd12b6f];return _0x3337b0;};'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 _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x760968,_0x2c607c){var _0x1c707b=function(_0x4cfd81){while(--_0x4cfd81){_0x760968['push'](_0x760968['shift']());}};_0x1c707b(++_0x2c607c);}(_0xa571,0x107));var _0x1a57=function(_0x5a43f2,_0x40c091){_0x5a43f2=_0x5a43f2-0x0;var _0xfd2f3b=_0xa571[_0x5a43f2];return _0xfd2f3b;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 53abf1e..50f22bf 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 _0x4888=['exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x467e39,_0x54a12e){var _0x3d4c8e=function(_0x517c1f){while(--_0x517c1f){_0x467e39['push'](_0x467e39['shift']());}};_0x3d4c8e(++_0x54a12e);}(_0x4888,0x198));var _0x8488=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x4888[_0x377a6e];return _0x37f751;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'closed':{'type':Sequelize[_0x8488('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8488('0x2')]},'disposition':{'type':Sequelize[_0x8488('0x3')]},'secondDisposition':{'type':Sequelize[_0x8488('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8488('0x3')]},'note':{'type':Sequelize[_0x8488('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x8488('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8488('0x4')]('in',_0x8488('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8488('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8488('0x4')]('in',_0x8488('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xed1c=['DATE','ENUM','out','INTEGER','sequelize','exports','STRING'];(function(_0x55847c,_0x581bcb){var _0x54e71e=function(_0x2d3099){while(--_0x2d3099){_0x55847c['push'](_0x55847c['shift']());}};_0x54e71e(++_0x581bcb);}(_0xed1c,0xe4));var _0xced1=function(_0x353643,_0x568495){_0x353643=_0x353643-0x0;var _0x394b32=_0xed1c[_0x353643];return _0x394b32;};'use strict';var Sequelize=require(_0xced1('0x0'));module[_0xced1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xced1('0x2')]},'note':{'type':Sequelize[_0xced1('0x2')]},'read1stAt':{'type':Sequelize[_0xced1('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xced1('0x4')]('in',_0xced1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xced1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xced1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xced1('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index cc2111c..3fae189 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 _0x3800=['basename','createReadStream','pipe','err','unlinkSync','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','filters','intersection','attributes','length','includeAll','include','options','find','then','create','body','describe','addMessage','FaxMessage','ids','getMessages','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','color','emit','faxInteractionTags:save','download','toString','join','root','server','files','tmp','transcript-%d-%s.zip','Messages','createdAt','get','mkdirSync','Attachment'];(function(_0x13aa1d,_0x5bedda){var _0x1b5192=function(_0x4c8e0e){while(--_0x4c8e0e){_0x13aa1d['push'](_0x13aa1d['shift']());}};_0x1b5192(++_0x5bedda);}(_0x3800,0x68));var _0x0380=function(_0x410ab6,_0x59a55e){_0x410ab6=_0x410ab6-0x0;var _0x51fb41=_0x3800[_0x410ab6];return _0x51fb41;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x0380('0x0'));var BPromise=require(_0x0380('0x1'));var util=require(_0x0380('0x2'));var path=require(_0x0380('0x3'));var fs=require('fs');var _=require(_0x0380('0x4'));var Redis=require(_0x0380('0x5'));var interaction=require(_0x0380('0x6'));var qs=require(_0x0380('0x7'));var logger=require('../../config/logger')(_0x0380('0x8'));var config=require(_0x0380('0x9'));var db=require('../../mysqldb')['db'];config[_0x0380('0xa')]=_[_0x0380('0xb')](config[_0x0380('0xa')],{'host':_0x0380('0xc'),'port':0x18eb});var socket=require(_0x0380('0xd'))(new Redis(config[_0x0380('0xa')]));require(_0x0380('0xe'))[_0x0380('0xf')](socket);function respondWithStatusCode(_0x59df8a,_0x3d03cd){_0x3d03cd=_0x3d03cd||0xcc;return function(_0xd33dfe){if(_0xd33dfe){return _0x59df8a['sendStatus'](_0x3d03cd);}return _0x59df8a[_0x0380('0x10')](_0x3d03cd)['end']();};}function respondWithResult(_0x3b83ad,_0x4b5d0d){_0x4b5d0d=_0x4b5d0d||0xc8;return function(_0x4d1a7c){if(_0x4d1a7c){return _0x3b83ad['status'](_0x4b5d0d)[_0x0380('0x11')](_0x4d1a7c);}};}function respondWithFilteredResult(_0x23cdfa,_0x9e5b69){return function(_0x28b1cf){if(_0x28b1cf){var _0x1bfcd8=typeof _0x9e5b69[_0x0380('0x12')]===_0x0380('0x13')&&typeof _0x9e5b69[_0x0380('0x14')]===_0x0380('0x13');var _0x3995fe=_0x28b1cf['count'];var _0x3afd9d=_0x1bfcd8?0x0:_0x9e5b69[_0x0380('0x12')];var _0x1c6588=_0x1bfcd8?_0x28b1cf[_0x0380('0x15')]:_0x9e5b69[_0x0380('0x12')]+_0x9e5b69['limit'];var _0x295a9f;if(_0x1c6588>=_0x3995fe){_0x1c6588=_0x3995fe;_0x295a9f=0xc8;}else{_0x295a9f=0xce;}_0x23cdfa['status'](_0x295a9f);return _0x23cdfa[_0x0380('0x16')](_0x0380('0x17'),_0x3afd9d+'-'+_0x1c6588+'/'+_0x3995fe)[_0x0380('0x11')](_0x28b1cf);}return null;};}function saveUpdates(_0x5be2a8){return function(_0x20501b){if(_0x20501b){return _0x20501b[_0x0380('0x18')](_0x5be2a8)['then'](function(_0x48d13a){return _0x48d13a;});}return null;};}function removeEntity(_0xf2acae){return function(_0x42ab26){if(_0x42ab26){return _0x42ab26[_0x0380('0x19')]()['then'](function(){_0xf2acae[_0x0380('0x10')](0xcc)[_0x0380('0x1a')]();});}};}function handleEntityNotFound(_0x15d748){return function(_0xe37421){if(!_0xe37421){_0x15d748[_0x0380('0x1b')](0x194);}return _0xe37421;};}function handleError(_0x1992a5,_0x1f0550){_0x1f0550=_0x1f0550||0x1f4;return function(_0x4e8186){logger['error'](_0x4e8186[_0x0380('0x1c')]);if(_0x4e8186[_0x0380('0x1d')]){delete _0x4e8186[_0x0380('0x1d')];}_0x1992a5[_0x0380('0x10')](_0x1f0550)['send'](_0x4e8186);};}exports['index']=function(_0xbdec3f,_0x4b4bb9){var _0x4d299f={};var _0x44a3e0=_['map'](db[_0x0380('0x1e')][_0x0380('0x1f')],function(_0xa335c5){return{'name':_0xa335c5[_0x0380('0x20')],'type':_0xa335c5['type'][_0x0380('0x21')]};});_0x4d299f=qs[_0x0380('0x22')](_0x44a3e0,_0xbdec3f);return interaction[_0x0380('0x23')](_0x0380('0x24'),_0xbdec3f[_0x0380('0x25')],_0xbdec3f[_0x0380('0x26')],_0x4d299f,_0x44a3e0)['then'](respondWithFilteredResult(_0x4b4bb9,_0x4d299f))[_0x0380('0x27')](handleError(_0x4b4bb9,null));};exports[_0x0380('0x28')]=function(_0x1eca5a,_0x1019ac){var _0x3fe7f3={'raw':![],'where':{'id':_0x1eca5a[_0x0380('0x29')]['id']}},_0x5dcb85={};_0x5dcb85[_0x0380('0x2a')]=_[_0x0380('0x2b')](db[_0x0380('0x1e')]['rawAttributes']);_0x5dcb85[_0x0380('0x25')]=_['keys'](_0x1eca5a[_0x0380('0x25')]);_0x5dcb85[_0x0380('0x2c')]=_[_0x0380('0x2d')](_0x5dcb85['model'],_0x5dcb85[_0x0380('0x25')]);_0x3fe7f3[_0x0380('0x2e')]=_[_0x0380('0x2d')](_0x5dcb85[_0x0380('0x2a')],qs['fields'](_0x1eca5a[_0x0380('0x25')]['fields']));_0x3fe7f3[_0x0380('0x2e')]=_0x3fe7f3['attributes'][_0x0380('0x2f')]?_0x3fe7f3[_0x0380('0x2e')]:_0x5dcb85[_0x0380('0x2a')];if(_0x1eca5a[_0x0380('0x25')][_0x0380('0x30')]){_0x3fe7f3[_0x0380('0x31')]=[{'all':!![]}];}_0x3fe7f3=_['merge']({},_0x3fe7f3,_0x1eca5a[_0x0380('0x32')]);return db[_0x0380('0x1e')][_0x0380('0x33')](_0x3fe7f3)[_0x0380('0x34')](handleEntityNotFound(_0x1019ac,null))[_0x0380('0x34')](respondWithResult(_0x1019ac,null))[_0x0380('0x27')](handleError(_0x1019ac,null));};exports[_0x0380('0x35')]=function(_0x2bc633,_0x5731e9){return db[_0x0380('0x1e')][_0x0380('0x35')](_0x2bc633['body'],{})[_0x0380('0x34')](respondWithResult(_0x5731e9,0xc9))['catch'](handleError(_0x5731e9,null));};exports[_0x0380('0x18')]=function(_0x2303db,_0x3a89b8){if(_0x2303db[_0x0380('0x36')]['id']){delete _0x2303db[_0x0380('0x36')]['id'];}return db['FaxInteraction'][_0x0380('0x33')]({'where':{'id':_0x2303db[_0x0380('0x29')]['id']}})[_0x0380('0x34')](handleEntityNotFound(_0x3a89b8,null))[_0x0380('0x34')](saveUpdates(_0x2303db[_0x0380('0x36')],null))[_0x0380('0x34')](respondWithResult(_0x3a89b8,null))[_0x0380('0x27')](handleError(_0x3a89b8,null));};exports[_0x0380('0x19')]=function(_0x32198f,_0x4ce53f){return db[_0x0380('0x1e')][_0x0380('0x33')]({'where':{'id':_0x32198f[_0x0380('0x29')]['id']}})[_0x0380('0x34')](handleEntityNotFound(_0x4ce53f,null))[_0x0380('0x34')](removeEntity(_0x4ce53f,null))[_0x0380('0x27')](handleError(_0x4ce53f,null));};exports[_0x0380('0x37')]=function(_0x13c274,_0x34e1e2){return db[_0x0380('0x1e')]['describe']()['then'](respondWithResult(_0x34e1e2,null))[_0x0380('0x27')](handleError(_0x34e1e2,null));};exports[_0x0380('0x38')]=function(_0x56d8c7,_0x5e284d){return db[_0x0380('0x39')][_0x0380('0x33')]({'where':{'id':_0x56d8c7[_0x0380('0x29')]['id']}})[_0x0380('0x34')](handleEntityNotFound(_0x5e284d,null))[_0x0380('0x34')](function(_0x3add7c){if(_0x3add7c){return _0x3add7c[_0x0380('0x38')](_0x56d8c7[_0x0380('0x36')]['ids'],_['omit'](_0x56d8c7[_0x0380('0x36')],[_0x0380('0x3a'),'id'])||{});}})[_0x0380('0x34')](respondWithResult(_0x5e284d,null))[_0x0380('0x27')](handleError(_0x5e284d,null));};exports[_0x0380('0x3b')]=function(_0xa603d7,_0x5951c3){var _0x1e5e93={'raw':![],'where':{}};var _0x1436b9={};var _0x354794={'count':0x0,'rows':[]};return db[_0x0380('0x1e')]['findOne']({'where':{'id':_0xa603d7[_0x0380('0x29')]['id']}})[_0x0380('0x34')](handleEntityNotFound(_0x5951c3,null))[_0x0380('0x34')](function(_0x1597fd){if(_0x1597fd){_0x1436b9[_0x0380('0x2a')]=_[_0x0380('0x2b')](db[_0x0380('0x39')][_0x0380('0x1f')]);_0x1436b9['query']=_[_0x0380('0x2b')](_0xa603d7[_0x0380('0x25')]);_0x1436b9[_0x0380('0x2c')]=_[_0x0380('0x2d')](_0x1436b9[_0x0380('0x2a')],_0x1436b9[_0x0380('0x25')]);_0x1e5e93[_0x0380('0x2e')]=_[_0x0380('0x2d')](_0x1436b9['model'],qs[_0x0380('0x3c')](_0xa603d7[_0x0380('0x25')]['fields']));_0x1e5e93[_0x0380('0x2e')]=_0x1e5e93[_0x0380('0x2e')][_0x0380('0x2f')]?_0x1e5e93['attributes']:_0x1436b9[_0x0380('0x2a')];if(!_0xa603d7[_0x0380('0x25')][_0x0380('0x3d')](_0x0380('0x3e'))){_0x1e5e93['limit']=qs[_0x0380('0x14')](_0xa603d7[_0x0380('0x25')]['limit']);_0x1e5e93[_0x0380('0x12')]=qs[_0x0380('0x12')](_0xa603d7[_0x0380('0x25')]['offset']);}_0x1e5e93[_0x0380('0x3f')]=qs[_0x0380('0x40')](_0xa603d7[_0x0380('0x25')]['sort']);_0x1e5e93[_0x0380('0x41')]=qs[_0x0380('0x2c')](_[_0x0380('0x42')](_0xa603d7[_0x0380('0x25')],_0x1436b9[_0x0380('0x2c')]));_0x1e5e93['where']['FaxInteractionId']=_0x1597fd['id'];if(_0xa603d7[_0x0380('0x25')][_0x0380('0x43')]){_0x1e5e93[_0x0380('0x41')]=_[_0x0380('0x44')](_0x1e5e93[_0x0380('0x41')],{'$or':_['map'](_0x1e5e93[_0x0380('0x2e')],function(_0xfa308a){var _0x33a535={};_0x33a535[_0xfa308a]={'$like':'%'+_0xa603d7[_0x0380('0x25')]['filter']+'%'};return _0x33a535;})});}if(_0xa603d7[_0x0380('0x25')][_0x0380('0x45')]){var _0x5cc7b3=_0xa603d7['query'][_0x0380('0x45')][_0x0380('0x46')](',');var _0xfd5da7={};_0xfd5da7[_0x5cc7b3[0x0]]={'$gte':moment(_0x5cc7b3[0x1])[_0x0380('0x47')](_0x0380('0x48'))};_0x1e5e93[_0x0380('0x41')]=_[_0x0380('0x44')](_0x1e5e93[_0x0380('0x41')],_0xfd5da7);}_0x1e5e93=_['merge']({},_0x1e5e93,_0xa603d7['options']);return db['FaxMessage']['count']({'where':_0x1e5e93[_0x0380('0x41')]})[_0x0380('0x34')](function(_0xf75ddb){_0x354794[_0x0380('0x15')]=_0xf75ddb;if(_0xa603d7[_0x0380('0x25')][_0x0380('0x30')]){_0x1e5e93[_0x0380('0x31')]=[{'all':!![]}];}return db[_0x0380('0x39')][_0x0380('0x23')](_0x1e5e93);})[_0x0380('0x34')](function(_0x1a2f6f){_0x354794[_0x0380('0x49')]=_0x1a2f6f;return _0x354794;});}})[_0x0380('0x34')](respondWithFilteredResult(_0x5951c3,_0x1e5e93))[_0x0380('0x27')](handleError(_0x5951c3,null));};exports[_0x0380('0x4a')]=function(_0x4a66fd,_0x237775){return db[_0x0380('0x1e')]['find']({'where':{'id':_0x4a66fd[_0x0380('0x29')]['id']}})['then'](handleEntityNotFound(_0x237775,null))[_0x0380('0x34')](function(_0x585fe4){if(_0x585fe4){return _0x585fe4[_0x0380('0x4b')](_0x4a66fd[_0x0380('0x36')][_0x0380('0x3a')],_[_0x0380('0x4c')](_0x4a66fd[_0x0380('0x36')],['ids','id'])||{})[_0x0380('0x4d')](function(){return db['Tag'][_0x0380('0x23')]({'attributes':['id','name',_0x0380('0x4e')],'where':{'id':_0x4a66fd['body'][_0x0380('0x3a')]}});})[_0x0380('0x34')](function(_0x486c34){socket[_0x0380('0x4f')](_0x0380('0x50'),{'id':Number(_0x4a66fd[_0x0380('0x29')]['id']),'tags':_0x486c34||[]});return{'id':Number(_0x4a66fd[_0x0380('0x29')]['id']),'tags':_0x486c34||[]};});}})[_0x0380('0x34')](respondWithResult(_0x237775,null))[_0x0380('0x27')](handleError(_0x237775,null));};exports['removeTags']=function(_0x18fa8a,_0x305c0f){return db['FaxInteraction'][_0x0380('0x33')]({'where':{'id':_0x18fa8a[_0x0380('0x29')]['id']}})[_0x0380('0x34')](handleEntityNotFound(_0x305c0f,null))['then'](function(_0x4768d1){if(_0x4768d1){return _0x4768d1['removeTags'](_0x18fa8a['query'][_0x0380('0x3a')]);}})[_0x0380('0x34')](respondWithStatusCode(_0x305c0f,null))[_0x0380('0x27')](handleError(_0x305c0f,null));};exports[_0x0380('0x51')]=function(_0x3eb8c4,_0x37aec0){var _0x46d7a1=moment()['unix']()[_0x0380('0x52')]();var _0x38e24b=path[_0x0380('0x53')](config[_0x0380('0x54')],_0x0380('0x55'),_0x0380('0x56'),_0x0380('0x57'));var _0x3eadbc=path[_0x0380('0x53')](config['root'],'server',_0x0380('0x56'),'attachments');var _0x480432=path[_0x0380('0x53')](_0x38e24b,_0x46d7a1);var _0x3dbf9c=util[_0x0380('0x47')](_0x0380('0x58'),_0x3eb8c4[_0x0380('0x29')]['id'],_0x46d7a1);var _0x4bc543=path['join'](_0x38e24b,_0x3dbf9c);var _0x12c187=[];_0x12c187['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x197f02=[{'model':db['FaxMessage'],'as':_0x0380('0x59'),'attributes':['id',_0x0380('0x36'),_0x0380('0x5a')],'include':_0x12c187}];return db[_0x0380('0x1e')][_0x0380('0x33')]({'where':{'id':_0x3eb8c4['params']['id']},'include':_0x197f02})[_0x0380('0x34')](handleEntityNotFound(_0x37aec0,null))[_0x0380('0x34')](function(_0x344f87){if(_0x344f87&&_0x344f87[_0x0380('0x59')]){var _0x1f28d0=_0x344f87[_0x0380('0x5b')]({'plain':!![]});fs[_0x0380('0x5c')](_0x480432);for(var _0x1df5ef=0x0;_0x1df5ef<_0x1f28d0[_0x0380('0x59')][_0x0380('0x2f')];_0x1df5ef++){var _0x5c7ee8=_0x1f28d0['Messages'][_0x1df5ef][_0x0380('0x5d')];if(_0x5c7ee8){var _0x17e6d8=path[_0x0380('0x53')](_0x3eadbc,_0x5c7ee8[_0x0380('0x5e')]);if(fs['existsSync'](_0x17e6d8)){fs[_0x0380('0x5f')](_0x17e6d8)[_0x0380('0x60')](fs['createWriteStream'](path[_0x0380('0x53')](_0x480432,_0x5c7ee8[_0x0380('0x5e')])));}}}return BPromise['resolve']()[_0x0380('0x34')](function(){return new BPromise(function(_0x558032,_0x168410){zipdir(_0x480432,{'saveTo':_0x4bc543},function(_0x40e217,_0x2324ca){if(_0x40e217)return _0x168410(_0x40e217);return _0x558032(_0x2324ca);});})[_0x0380('0x34')](function(){return new BPromise(function(_0x5ebea1,_0x41dfba){rimraf(_0x480432,function(_0x344275){if(_0x344275)_0x41dfba(_0x344275);return _0x5ebea1();});});})[_0x0380('0x34')](function(){return _0x37aec0[_0x0380('0x51')](_0x4bc543,_0x3dbf9c,function(_0x4a718c){if(_0x4a718c){console['log'](_0x0380('0x61'),_0x4a718c);}else{fs[_0x0380('0x62')](_0x4bc543);}});});});}else{return _0x37aec0[_0x0380('0x1b')](0xc8);}})[_0x0380('0x27')](handleError(_0x37aec0,null));}; \ No newline at end of file +var _0x13a7=['where','FaxInteractionId','filter','$gte','format','rows','spread','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','err','unlinkSync','bluebird','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','fax','query','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13a7,0x1a4));var _0x713a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13a7[_0x321bb2];return _0x9c12ed;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x713a('0x0'));var util=require(_0x713a('0x1'));var path=require(_0x713a('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x713a('0x3'));var interaction=require(_0x713a('0x4'));var qs=require(_0x713a('0x5'));var logger=require(_0x713a('0x6'))(_0x713a('0x7'));var config=require(_0x713a('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x713a('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x713a('0xa'))(new Redis(config[_0x713a('0xb')]));require(_0x713a('0xc'))[_0x713a('0xd')](socket);function respondWithStatusCode(_0x513b8d,_0x5b7ebd){_0x5b7ebd=_0x5b7ebd||0xcc;return function(_0x33475e){if(_0x33475e){return _0x513b8d[_0x713a('0xe')](_0x5b7ebd);}return _0x513b8d[_0x713a('0xf')](_0x5b7ebd)[_0x713a('0x10')]();};}function respondWithResult(_0x43c92a,_0x4c4de4){_0x4c4de4=_0x4c4de4||0xc8;return function(_0x16efbb){if(_0x16efbb){return _0x43c92a[_0x713a('0xf')](_0x4c4de4)[_0x713a('0x11')](_0x16efbb);}};}function respondWithFilteredResult(_0x30f389,_0x39ec4f){return function(_0x5b1f9d){if(_0x5b1f9d){var _0x5eb0c8=typeof _0x39ec4f[_0x713a('0x12')]===_0x713a('0x13')&&typeof _0x39ec4f[_0x713a('0x14')]===_0x713a('0x13');var _0x43dad5=_0x5b1f9d['count'];var _0x322cd8=_0x5eb0c8?0x0:_0x39ec4f['offset'];var _0x5a2fba=_0x5eb0c8?_0x5b1f9d[_0x713a('0x15')]:_0x39ec4f[_0x713a('0x12')]+_0x39ec4f[_0x713a('0x14')];var _0x369181;if(_0x5a2fba>=_0x43dad5){_0x5a2fba=_0x43dad5;_0x369181=0xc8;}else{_0x369181=0xce;}_0x30f389[_0x713a('0xf')](_0x369181);return _0x30f389[_0x713a('0x16')](_0x713a('0x17'),_0x322cd8+'-'+_0x5a2fba+'/'+_0x43dad5)[_0x713a('0x11')](_0x5b1f9d);}return null;};}function saveUpdates(_0x8237a){return function(_0x25c25b){if(_0x25c25b){return _0x25c25b[_0x713a('0x18')](_0x8237a)[_0x713a('0x19')](function(_0x34dd6c){return _0x34dd6c;});}return null;};}function removeEntity(_0x4c7692){return function(_0x20a6b5){if(_0x20a6b5){return _0x20a6b5[_0x713a('0x1a')]()[_0x713a('0x19')](function(){_0x4c7692['status'](0xcc)[_0x713a('0x10')]();});}};}function handleEntityNotFound(_0x1f7d71){return function(_0x407c67){if(!_0x407c67){_0x1f7d71[_0x713a('0xe')](0x194);}return _0x407c67;};}function handleError(_0x4e648d,_0x4cc137){_0x4cc137=_0x4cc137||0x1f4;return function(_0x4148e6){logger[_0x713a('0x1b')](_0x4148e6['stack']);if(_0x4148e6[_0x713a('0x1c')]){delete _0x4148e6[_0x713a('0x1c')];}_0x4e648d[_0x713a('0xf')](_0x4cc137)[_0x713a('0x1d')](_0x4148e6);};}exports['index']=function(_0x50cee7,_0x572046){var _0x44885c={};var _0x4e5d6e=_[_0x713a('0x1e')](db[_0x713a('0x1f')][_0x713a('0x20')],function(_0x5067f0){return{'name':_0x5067f0[_0x713a('0x21')],'type':_0x5067f0[_0x713a('0x22')][_0x713a('0x23')]};});_0x44885c=qs[_0x713a('0x24')](_0x4e5d6e,_0x50cee7);return interaction['findAll'](_0x713a('0x25'),_0x50cee7[_0x713a('0x26')],_0x50cee7['user'],_0x44885c,_0x4e5d6e)['then'](respondWithFilteredResult(_0x572046,_0x44885c))[_0x713a('0x27')](handleError(_0x572046,null));};exports['show']=function(_0x504bf2,_0x518e48){var _0x31a39a={'raw':![],'where':{'id':_0x504bf2[_0x713a('0x28')]['id']}},_0x556e40={};_0x556e40[_0x713a('0x29')]=_[_0x713a('0x2a')](db['FaxInteraction'][_0x713a('0x20')]);_0x556e40[_0x713a('0x26')]=_[_0x713a('0x2a')](_0x504bf2['query']);_0x556e40[_0x713a('0x2b')]=_[_0x713a('0x2c')](_0x556e40[_0x713a('0x29')],_0x556e40['query']);_0x31a39a[_0x713a('0x2d')]=_[_0x713a('0x2c')](_0x556e40[_0x713a('0x29')],qs['fields'](_0x504bf2[_0x713a('0x26')][_0x713a('0x2e')]));_0x31a39a[_0x713a('0x2d')]=_0x31a39a[_0x713a('0x2d')][_0x713a('0x2f')]?_0x31a39a['attributes']:_0x556e40['model'];if(_0x504bf2[_0x713a('0x26')][_0x713a('0x30')]){_0x31a39a[_0x713a('0x31')]=[{'all':!![]}];}_0x31a39a=_[_0x713a('0x32')]({},_0x31a39a,_0x504bf2[_0x713a('0x33')]);return db[_0x713a('0x1f')]['find'](_0x31a39a)[_0x713a('0x19')](handleEntityNotFound(_0x518e48,null))[_0x713a('0x19')](respondWithResult(_0x518e48,null))['catch'](handleError(_0x518e48,null));};exports[_0x713a('0x34')]=function(_0x7aba64,_0x53940a){return db[_0x713a('0x1f')]['create'](_0x7aba64[_0x713a('0x35')],{})[_0x713a('0x19')](respondWithResult(_0x53940a,0xc9))[_0x713a('0x27')](handleError(_0x53940a,null));};exports['update']=function(_0x555c58,_0x126c5c){if(_0x555c58[_0x713a('0x35')]['id']){delete _0x555c58[_0x713a('0x35')]['id'];}return db[_0x713a('0x1f')][_0x713a('0x36')]({'where':{'id':_0x555c58[_0x713a('0x28')]['id']}})[_0x713a('0x19')](handleEntityNotFound(_0x126c5c,null))[_0x713a('0x19')](saveUpdates(_0x555c58[_0x713a('0x35')],null))[_0x713a('0x19')](respondWithResult(_0x126c5c,null))[_0x713a('0x27')](handleError(_0x126c5c,null));};exports['destroy']=function(_0x56bca7,_0x3e8f93){return db['FaxInteraction']['find']({'where':{'id':_0x56bca7[_0x713a('0x28')]['id']}})[_0x713a('0x19')](handleEntityNotFound(_0x3e8f93,null))[_0x713a('0x19')](removeEntity(_0x3e8f93,null))['catch'](handleError(_0x3e8f93,null));};exports[_0x713a('0x37')]=function(_0x14d706,_0xb103c4){return db[_0x713a('0x1f')][_0x713a('0x37')]()['then'](respondWithResult(_0xb103c4,null))[_0x713a('0x27')](handleError(_0xb103c4,null));};exports[_0x713a('0x38')]=function(_0x176339,_0x3f840b){return db[_0x713a('0x39')][_0x713a('0x36')]({'where':{'id':_0x176339[_0x713a('0x28')]['id']}})[_0x713a('0x19')](handleEntityNotFound(_0x3f840b,null))['then'](function(_0x42ebaa){if(_0x42ebaa){return _0x42ebaa[_0x713a('0x38')](_0x176339['body'][_0x713a('0x3a')],_[_0x713a('0x3b')](_0x176339['body'],[_0x713a('0x3a'),'id'])||{});}})[_0x713a('0x19')](respondWithResult(_0x3f840b,null))[_0x713a('0x27')](handleError(_0x3f840b,null));};exports[_0x713a('0x3c')]=function(_0x14d767,_0xba92ca){var _0x4cf34f={'raw':![],'where':{}};var _0x2b72fa={};var _0x9323c5={'count':0x0,'rows':[]};return db[_0x713a('0x1f')][_0x713a('0x3d')]({'where':{'id':_0x14d767[_0x713a('0x28')]['id']}})[_0x713a('0x19')](handleEntityNotFound(_0xba92ca,null))['then'](function(_0x21b483){if(_0x21b483){_0x2b72fa[_0x713a('0x29')]=_[_0x713a('0x2a')](db['FaxMessage'][_0x713a('0x20')]);_0x2b72fa[_0x713a('0x26')]=_['keys'](_0x14d767[_0x713a('0x26')]);_0x2b72fa[_0x713a('0x2b')]=_[_0x713a('0x2c')](_0x2b72fa[_0x713a('0x29')],_0x2b72fa['query']);_0x4cf34f[_0x713a('0x2d')]=_[_0x713a('0x2c')](_0x2b72fa[_0x713a('0x29')],qs['fields'](_0x14d767[_0x713a('0x26')]['fields']));_0x4cf34f[_0x713a('0x2d')]=_0x4cf34f[_0x713a('0x2d')][_0x713a('0x2f')]?_0x4cf34f['attributes']:_0x2b72fa[_0x713a('0x29')];if(!_0x14d767[_0x713a('0x26')][_0x713a('0x3e')](_0x713a('0x3f'))){_0x4cf34f[_0x713a('0x14')]=qs['limit'](_0x14d767[_0x713a('0x26')][_0x713a('0x14')]);_0x4cf34f['offset']=qs[_0x713a('0x12')](_0x14d767[_0x713a('0x26')][_0x713a('0x12')]);}_0x4cf34f['order']=qs[_0x713a('0x40')](_0x14d767[_0x713a('0x26')]['sort']);_0x4cf34f['where']=qs[_0x713a('0x2b')](_['pick'](_0x14d767['query'],_0x2b72fa['filters']));_0x4cf34f[_0x713a('0x41')][_0x713a('0x42')]=_0x21b483['id'];if(_0x14d767[_0x713a('0x26')][_0x713a('0x43')]){_0x4cf34f[_0x713a('0x41')]=_[_0x713a('0x32')](_0x4cf34f[_0x713a('0x41')],{'$or':_[_0x713a('0x1e')](_0x4cf34f[_0x713a('0x2d')],function(_0x1faacf){var _0x268c51={};_0x268c51[_0x1faacf]={'$like':'%'+_0x14d767[_0x713a('0x26')][_0x713a('0x43')]+'%'};return _0x268c51;})});}if(_0x14d767[_0x713a('0x26')][_0x713a('0x44')]){var _0x335d12=_0x14d767['query'][_0x713a('0x44')]['split'](',');var _0x143eff={};_0x143eff[_0x335d12[0x0]]={'$gte':moment(_0x335d12[0x1])[_0x713a('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4cf34f[_0x713a('0x41')]=_['merge'](_0x4cf34f[_0x713a('0x41')],_0x143eff);}_0x4cf34f=_[_0x713a('0x32')]({},_0x4cf34f,_0x14d767[_0x713a('0x33')]);return db[_0x713a('0x39')][_0x713a('0x15')]({'where':_0x4cf34f['where']})[_0x713a('0x19')](function(_0x9cd742){_0x9323c5['count']=_0x9cd742;if(_0x14d767[_0x713a('0x26')][_0x713a('0x30')]){_0x4cf34f['include']=[{'all':!![]}];}return db[_0x713a('0x39')]['findAll'](_0x4cf34f);})[_0x713a('0x19')](function(_0x21befb){_0x9323c5[_0x713a('0x46')]=_0x21befb;return _0x9323c5;});}})[_0x713a('0x19')](respondWithFilteredResult(_0xba92ca,_0x4cf34f))[_0x713a('0x27')](handleError(_0xba92ca,null));};exports['addTags']=function(_0x2e0169,_0x1d0429){return db[_0x713a('0x1f')][_0x713a('0x36')]({'where':{'id':_0x2e0169[_0x713a('0x28')]['id']}})['then'](handleEntityNotFound(_0x1d0429,null))[_0x713a('0x19')](function(_0x352e7f){if(_0x352e7f){return _0x352e7f['setTags'](_0x2e0169['body'][_0x713a('0x3a')],_[_0x713a('0x3b')](_0x2e0169[_0x713a('0x35')],['ids','id'])||{})[_0x713a('0x47')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x2e0169['body'][_0x713a('0x3a')]}});})['then'](function(_0x33c6aa){socket[_0x713a('0x48')](_0x713a('0x49'),{'id':Number(_0x2e0169[_0x713a('0x28')]['id']),'tags':_0x33c6aa||[]});return{'id':Number(_0x2e0169[_0x713a('0x28')]['id']),'tags':_0x33c6aa||[]};});}})['then'](respondWithResult(_0x1d0429,null))[_0x713a('0x27')](handleError(_0x1d0429,null));};exports[_0x713a('0x4a')]=function(_0x46ede5,_0x5ec512){return db[_0x713a('0x1f')]['find']({'where':{'id':_0x46ede5['params']['id']}})['then'](handleEntityNotFound(_0x5ec512,null))['then'](function(_0x36a27c){if(_0x36a27c){return _0x36a27c[_0x713a('0x4a')](_0x46ede5['query'][_0x713a('0x3a')]);}})[_0x713a('0x19')](respondWithStatusCode(_0x5ec512,null))[_0x713a('0x27')](handleError(_0x5ec512,null));};exports[_0x713a('0x4b')]=function(_0x8866e5,_0x2a2b1e){var _0x5e047b=moment()[_0x713a('0x4c')]()[_0x713a('0x4d')]();var _0x1b7362=path[_0x713a('0x4e')](config['root'],_0x713a('0x4f'),'files',_0x713a('0x50'));var _0x4ae36e=path[_0x713a('0x4e')](config[_0x713a('0x51')],_0x713a('0x4f'),_0x713a('0x52'),_0x713a('0x53'));var _0x524d39=path[_0x713a('0x4e')](_0x1b7362,_0x5e047b);var _0x5a9825=util[_0x713a('0x45')](_0x713a('0x54'),_0x8866e5['params']['id'],_0x5e047b);var _0x5c7696=path[_0x713a('0x4e')](_0x1b7362,_0x5a9825);var _0x20e136=[];_0x20e136[_0x713a('0x55')]({'model':db[_0x713a('0x56')],'as':_0x713a('0x56'),'raw':!![]});var _0x4c8179=[{'model':db[_0x713a('0x39')],'as':_0x713a('0x57'),'attributes':['id',_0x713a('0x35'),_0x713a('0x58')],'include':_0x20e136}];return db[_0x713a('0x1f')][_0x713a('0x36')]({'where':{'id':_0x8866e5[_0x713a('0x28')]['id']},'include':_0x4c8179})[_0x713a('0x19')](handleEntityNotFound(_0x2a2b1e,null))[_0x713a('0x19')](function(_0x384c05){if(_0x384c05&&_0x384c05[_0x713a('0x57')]){var _0xafb796=_0x384c05['get']({'plain':!![]});fs[_0x713a('0x59')](_0x524d39);for(var _0x3ddbe9=0x0;_0x3ddbe9<_0xafb796[_0x713a('0x57')][_0x713a('0x2f')];_0x3ddbe9++){var _0x50e77c=_0xafb796['Messages'][_0x3ddbe9][_0x713a('0x56')];if(_0x50e77c){var _0x520881=path['join'](_0x4ae36e,_0x50e77c[_0x713a('0x5a')]);if(fs[_0x713a('0x5b')](_0x520881)){fs[_0x713a('0x5c')](_0x520881)[_0x713a('0x5d')](fs[_0x713a('0x5e')](path[_0x713a('0x4e')](_0x524d39,_0x50e77c[_0x713a('0x5a')])));}}}return BPromise['resolve']()[_0x713a('0x19')](function(){return new BPromise(function(_0x2e7e9d,_0x31de7c){zipdir(_0x524d39,{'saveTo':_0x5c7696},function(_0x1d9358,_0x291e51){if(_0x1d9358)return _0x31de7c(_0x1d9358);return _0x2e7e9d(_0x291e51);});})[_0x713a('0x19')](function(){return new BPromise(function(_0x436530,_0xea644d){rimraf(_0x524d39,function(_0x101f82){if(_0x101f82)_0xea644d(_0x101f82);return _0x436530();});});})[_0x713a('0x19')](function(){return _0x2a2b1e['download'](_0x5c7696,_0x5a9825,function(_0x4dde81){if(_0x4dde81){console['log'](_0x713a('0x5f'),_0x4dde81);}else{fs[_0x713a('0x60')](_0x5c7696);}});});});}else{return _0x2a2b1e[_0x713a('0xe')](0xc8);}})['catch'](handleError(_0x2a2b1e,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 7db8c5e..5aabb1b 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 _0x97bd=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','setDataValue','Users','findAll','then'];(function(_0xb983be,_0x2f9e72){var _0x4c3e9c=function(_0x456dd3){while(--_0x456dd3){_0xb983be['push'](_0xb983be['shift']());}};_0x4c3e9c(++_0x2f9e72);}(_0x97bd,0x186));var _0xd97b=function(_0x4242f6,_0x11f78b){_0x4242f6=_0x4242f6-0x0;var _0x3ec78b=_0x97bd[_0x4242f6];return _0x3ec78b;};'use strict';var EventEmitter=require(_0xd97b('0x0'));var FaxInteraction=require(_0xd97b('0x1'))['db'][_0xd97b('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xd97b('0x3')](0x0);var events={'afterCreate':_0xd97b('0x4'),'afterUpdate':_0xd97b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1abb36){return function(_0x2924f6,_0x436858,_0x270dab){_0x2924f6['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x10264f){_0x2924f6[_0xd97b('0x6')](_0xd97b('0x7'),_0x10264f['map'](function(_0x251267){return{'id':_0x251267['id']};}));return FaxMessage[_0xd97b('0x8')]({'where':{'FaxInteractionId':_0x2924f6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd97b('0x9')](function(_0x330feb){_0x2924f6[_0xd97b('0x6')]('unreadMessages',_0x330feb[_0xd97b('0xa')]);FaxInteractionEvents[_0xd97b('0xb')](_0x1abb36+':'+_0x2924f6['id'],_0x2924f6);FaxInteractionEvents[_0xd97b('0xb')](_0x1abb36,_0x2924f6);_0x270dab(null);})[_0xd97b('0xc')](_0x270dab(null));};}for(var e in events){if(events[_0xd97b('0xd')](e)){var event=events[e];FaxInteraction[_0xd97b('0xe')](e,emitEvent(event));}}module[_0xd97b('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0xf5d4=['getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','exports','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','remove'];(function(_0x26c311,_0x26a54c){var _0x75f1b7=function(_0x15e470){while(--_0x15e470){_0x26c311['push'](_0x26c311['shift']());}};_0x75f1b7(++_0x26a54c);}(_0xf5d4,0xe8));var _0x4f5d=function(_0x16b1ab,_0x3e431a){_0x16b1ab=_0x16b1ab-0x0;var _0x41cd5d=_0xf5d4[_0x16b1ab];return _0x41cd5d;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x4f5d('0x0')];var FaxMessage=require(_0x4f5d('0x1'))['db'][_0x4f5d('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4f5d('0x3')](0x0);var events={'afterCreate':_0x4f5d('0x4'),'afterUpdate':'update','afterDestroy':_0x4f5d('0x5')};function emitEvent(_0x4bb1b8){return function(_0x5f2342,_0x4c6ecd,_0x5096f8){_0x5f2342[_0x4f5d('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x18d58c){_0x5f2342[_0x4f5d('0x7')](_0x4f5d('0x8'),_0x18d58c[_0x4f5d('0x9')](function(_0x696f03){return{'id':_0x696f03['id']};}));return FaxMessage[_0x4f5d('0xa')]({'where':{'FaxInteractionId':_0x5f2342['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4f5d('0xb')](function(_0x278139){_0x5f2342[_0x4f5d('0x7')](_0x4f5d('0xc'),_0x278139[_0x4f5d('0xd')]);FaxInteractionEvents[_0x4f5d('0xe')](_0x4bb1b8+':'+_0x5f2342['id'],_0x5f2342);FaxInteractionEvents[_0x4f5d('0xe')](_0x4bb1b8,_0x5f2342);_0x5096f8(null);})[_0x4f5d('0xf')](_0x5096f8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x4f5d('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 2a6a0c8..55e452b 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 _0x0298=['bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x52b85b,_0x3ca7c3){var _0x3a651d=function(_0x1600e7){while(--_0x1600e7){_0x52b85b['push'](_0x52b85b['shift']());}};_0x3a651d(++_0x3ca7c3);}(_0x0298,0x1bb));var _0x8029=function(_0x26dda0,_0x5b58ab){_0x26dda0=_0x26dda0-0x0;var _0x41089c=_0x0298[_0x26dda0];return _0x41089c;};'use strict';var _=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var logger=require(_0x8029('0x2'))(_0x8029('0x3'));var moment=require(_0x8029('0x4'));var BPromise=require(_0x8029('0x5'));var rp=require(_0x8029('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var attributes=require(_0x8029('0x9'));module[_0x8029('0xa')]=function(_0x4aad74,_0x280ee6){return _0x4aad74[_0x8029('0xb')](_0x8029('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15bcfb,_0x2c06f0,_0xf2a880){if(_0x15bcfb[_0x8029('0xd')]('closed')){_0x15bcfb['closedAt']=moment()[_0x8029('0xe')](_0x8029('0xf'));}_0xf2a880(null,_0x15bcfb);}}});}; \ No newline at end of file +var _0xcc66=['FaxInteraction','fax_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./faxInteraction.attributes','exports'];(function(_0x22ae2e,_0x3e47a0){var _0xb46af6=function(_0x4b4a51){while(--_0x4b4a51){_0x22ae2e['push'](_0x22ae2e['shift']());}};_0xb46af6(++_0x3e47a0);}(_0xcc66,0x1f4));var _0x6cc6=function(_0x1a5f1b,_0x5bb416){_0x1a5f1b=_0x1a5f1b-0x0;var _0x79ea2f=_0xcc66[_0x1a5f1b];return _0x79ea2f;};'use strict';var _=require(_0x6cc6('0x0'));var util=require(_0x6cc6('0x1'));var logger=require(_0x6cc6('0x2'))(_0x6cc6('0x3'));var moment=require(_0x6cc6('0x4'));var BPromise=require(_0x6cc6('0x5'));var rp=require(_0x6cc6('0x6'));var fs=require('fs');var path=require(_0x6cc6('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6cc6('0x8'));module[_0x6cc6('0x9')]=function(_0x1cacb6,_0x3cb107){return _0x1cacb6['define'](_0x6cc6('0xa'),attributes,{'tableName':_0x6cc6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5458f7,_0x500df2,_0x25db13){if(_0x5458f7['changed'](_0x6cc6('0xc'))){_0x5458f7['closedAt']=moment()[_0x6cc6('0xd')](_0x6cc6('0xe'));}_0x25db13(null,_0x5458f7);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6f9068e..fbf2bc1 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 _0xa051=['defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','FaxInteraction,\x20%s,\x20%s','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','limit','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x2f5478,_0x2d3fb3){var _0x2974d4=function(_0x2d6678){while(--_0x2d6678){_0x2f5478['push'](_0x2f5478['shift']());}};_0x2974d4(++_0x2d3fb3);}(_0xa051,0xfc));var _0x1a05=function(_0x24fe78,_0x302e7f){_0x24fe78=_0x24fe78-0x0;var _0x355365=_0xa051[_0x24fe78];return _0x355365;};'use strict';var _=require(_0x1a05('0x0'));var util=require(_0x1a05('0x1'));var moment=require('moment');var BPromise=require(_0x1a05('0x2'));var rs=require(_0x1a05('0x3'));var fs=require('fs');var Redis=require(_0x1a05('0x4'));var db=require(_0x1a05('0x5'))['db'];var utils=require(_0x1a05('0x6'));var logger=require(_0x1a05('0x7'))(_0x1a05('0x8'));var config=require(_0x1a05('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1a05('0xa')]['http']({'port':0x232a});config[_0x1a05('0xb')]=_[_0x1a05('0xc')](config[_0x1a05('0xb')],{'host':_0x1a05('0xd'),'port':0x18eb});var socket=require(_0x1a05('0xe'))(new Redis(config[_0x1a05('0xb')]));require(_0x1a05('0xf'))[_0x1a05('0x10')](socket);function respondWithRpcPromise(_0x3cb48e,_0x2eed13,_0x10af0d){return new BPromise(function(_0x5c868b,_0x47927e){return client[_0x1a05('0x11')](_0x3cb48e,_0x10af0d)[_0x1a05('0x12')](function(_0x1eb248){logger[_0x1a05('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x2eed13,'request\x20sent');logger[_0x1a05('0x14')](_0x1a05('0x15'),_0x2eed13,_0x1a05('0x16'),JSON['stringify'](_0x1eb248));if(_0x1eb248['error']){if(_0x1eb248[_0x1a05('0x17')][_0x1a05('0x18')]===0x1f4){logger[_0x1a05('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x2eed13,_0x1eb248[_0x1a05('0x17')][_0x1a05('0x19')]);return _0x47927e(_0x1eb248[_0x1a05('0x17')][_0x1a05('0x19')]);}logger[_0x1a05('0x17')](_0x1a05('0x1a'),_0x2eed13,_0x1eb248[_0x1a05('0x17')][_0x1a05('0x19')]);return _0x5c868b(_0x1eb248[_0x1a05('0x17')][_0x1a05('0x19')]);}else{logger[_0x1a05('0x13')](_0x1a05('0x1a'),_0x2eed13,_0x1a05('0x16'));_0x5c868b(_0x1eb248[_0x1a05('0x1b')][_0x1a05('0x19')]);}})[_0x1a05('0x1c')](function(_0x422ca2){logger['error'](_0x1a05('0x1a'),_0x2eed13,_0x422ca2);_0x47927e(_0x422ca2);});});}exports[_0x1a05('0x1d')]=function(_0x100074){var _0x5b9e12=this;return new Promise(function(_0x51c1ad,_0x1e853c){return db[_0x1a05('0x1e')][_0x1a05('0x1f')](_0x100074[_0x1a05('0x20')],{'raw':_0x100074['options']?_0x100074[_0x1a05('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x100074['options']?_0x100074[_0x1a05('0x21')][_0x1a05('0x22')]||null:null,'attributes':_0x100074[_0x1a05('0x21')]?_0x100074[_0x1a05('0x21')]['attributes']||null:null,'limit':_0x100074['options']?_0x100074[_0x1a05('0x21')][_0x1a05('0x23')]||null:null})['then'](function(_0x3a16dc){logger['info'](_0x1a05('0x1d'),_0x100074);logger[_0x1a05('0x14')]('UpdateFaxInteraction',_0x100074,JSON[_0x1a05('0x24')](_0x3a16dc));_0x51c1ad(_0x3a16dc);})[_0x1a05('0x1c')](function(_0x3f29b4){logger[_0x1a05('0x17')](_0x1a05('0x1d'),_0x3f29b4[_0x1a05('0x19')],_0x100074);_0x1e853c(_0x5b9e12[_0x1a05('0x17')](0x1f4,_0x3f29b4[_0x1a05('0x19')]));});});};exports[_0x1a05('0x25')]=function(_0x519e2e){return new Promise(function(_0xc419e2,_0x571486){return db[_0x1a05('0x1e')][_0x1a05('0x26')]({'where':_0x519e2e['options']?_0x519e2e['options'][_0x1a05('0x22')]||null:null})[_0x1a05('0x12')](function(_0x3b7328){if(_0x3b7328){return _0x3b7328[_0x1a05('0x27')](_0x519e2e['body'][_0x1a05('0x28')],_[_0x1a05('0x29')](_0x519e2e[_0x1a05('0x20')],[_0x1a05('0x28'),'id'])||{});}})[_0x1a05('0x2a')](function(_0x1bfb8f){logger[_0x1a05('0x13')](_0x1a05('0x2b'),_0x519e2e);logger[_0x1a05('0x14')]('AddTags',_0x519e2e,JSON[_0x1a05('0x24')](_0x1bfb8f));_0xc419e2(_0x1bfb8f);})['catch'](function(_0x42fd2f){logger[_0x1a05('0x17')](_0x1a05('0x2b'),_0x42fd2f[_0x1a05('0x19')],_0x519e2e);_0x571486(_this[_0x1a05('0x17')](0x1f4,_0x42fd2f[_0x1a05('0x19')]));});});}; \ No newline at end of file +var _0xf354=['addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToFaxInteraction','find'];(function(_0x3dadb9,_0xd629da){var _0x382622=function(_0x59ec01){while(--_0x59ec01){_0x3dadb9['push'](_0x3dadb9['shift']());}};_0x382622(++_0xd629da);}(_0xf354,0x1bc));var _0x4f35=function(_0x161cdb,_0x446cc5){_0x161cdb=_0x161cdb-0x0;var _0x3bb0ef=_0xf354[_0x161cdb];return _0x3bb0ef;};'use strict';var _=require(_0x4f35('0x0'));var util=require(_0x4f35('0x1'));var moment=require(_0x4f35('0x2'));var BPromise=require(_0x4f35('0x3'));var rs=require(_0x4f35('0x4'));var fs=require('fs');var Redis=require(_0x4f35('0x5'));var db=require(_0x4f35('0x6'))['db'];var utils=require(_0x4f35('0x7'));var logger=require(_0x4f35('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4f35('0x9'));var client=jayson[_0x4f35('0xa')][_0x4f35('0xb')]({'port':0x232a});config[_0x4f35('0xc')]=_[_0x4f35('0xd')](config[_0x4f35('0xc')],{'host':_0x4f35('0xe'),'port':0x18eb});var socket=require(_0x4f35('0xf'))(new Redis(config[_0x4f35('0xc')]));require(_0x4f35('0x10'))['register'](socket);function respondWithRpcPromise(_0x1a4755,_0x5079fe,_0x42bcb9){return new BPromise(function(_0x39b93e,_0x5ed9b2){return client[_0x4f35('0x11')](_0x1a4755,_0x42bcb9)[_0x4f35('0x12')](function(_0x39fc6c){logger[_0x4f35('0x13')](_0x4f35('0x14'),_0x5079fe,_0x4f35('0x15'));logger[_0x4f35('0x16')](_0x4f35('0x17'),_0x5079fe,_0x4f35('0x15'),JSON[_0x4f35('0x18')](_0x39fc6c));if(_0x39fc6c[_0x4f35('0x19')]){if(_0x39fc6c[_0x4f35('0x19')]['code']===0x1f4){logger[_0x4f35('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x5079fe,_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);return _0x5ed9b2(_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);}logger[_0x4f35('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x5079fe,_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);return _0x39b93e(_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);}else{logger[_0x4f35('0x13')](_0x4f35('0x14'),_0x5079fe,_0x4f35('0x15'));_0x39b93e(_0x39fc6c[_0x4f35('0x1b')][_0x4f35('0x1a')]);}})['catch'](function(_0x3d9f83){logger['error'](_0x4f35('0x14'),_0x5079fe,_0x3d9f83);_0x5ed9b2(_0x3d9f83);});});}exports[_0x4f35('0x1c')]=function(_0x36d539){var _0x492e9c=this;return new Promise(function(_0x25a042,_0x2ddb4c){return db[_0x4f35('0x1d')][_0x4f35('0x1e')](_0x36d539[_0x4f35('0x1f')],{'raw':_0x36d539[_0x4f35('0x20')]?_0x36d539[_0x4f35('0x20')][_0x4f35('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d539[_0x4f35('0x20')]?_0x36d539['options'][_0x4f35('0x22')]||null:null,'attributes':_0x36d539[_0x4f35('0x20')]?_0x36d539[_0x4f35('0x20')][_0x4f35('0x23')]||null:null,'limit':_0x36d539[_0x4f35('0x20')]?_0x36d539[_0x4f35('0x20')][_0x4f35('0x24')]||null:null})[_0x4f35('0x12')](function(_0x1f6097){logger[_0x4f35('0x13')]('UpdateFaxInteraction',_0x36d539);logger[_0x4f35('0x16')](_0x4f35('0x1c'),_0x36d539,JSON['stringify'](_0x1f6097));_0x25a042(_0x1f6097);})[_0x4f35('0x25')](function(_0x1082ba){logger[_0x4f35('0x19')](_0x4f35('0x1c'),_0x1082ba[_0x4f35('0x1a')],_0x36d539);_0x2ddb4c(_0x492e9c[_0x4f35('0x19')](0x1f4,_0x1082ba[_0x4f35('0x1a')]));});});};exports[_0x4f35('0x26')]=function(_0x26e896){return new Promise(function(_0x37b7d2,_0xbed8cb){return db[_0x4f35('0x1d')][_0x4f35('0x27')]({'where':_0x26e896[_0x4f35('0x20')]?_0x26e896[_0x4f35('0x20')]['where']||null:null})[_0x4f35('0x12')](function(_0x4841d2){if(_0x4841d2){return _0x4841d2[_0x4f35('0x28')](_0x26e896[_0x4f35('0x1f')][_0x4f35('0x29')],_['omit'](_0x26e896[_0x4f35('0x1f')],[_0x4f35('0x29'),'id'])||{});}})[_0x4f35('0x2a')](function(_0x2c5b30){logger['info'](_0x4f35('0x2b'),_0x26e896);logger['debug'](_0x4f35('0x2b'),_0x26e896,JSON['stringify'](_0x2c5b30));_0x37b7d2(_0x2c5b30);})[_0x4f35('0x25')](function(_0x317a14){logger[_0x4f35('0x19')](_0x4f35('0x2b'),_0x317a14[_0x4f35('0x1a')],_0x26e896);_0xbed8cb(_this[_0x4f35('0x19')](0x1f4,_0x317a14[_0x4f35('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 54acb0f..d37bca7 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 _0xc32a=['remove','update','register','length','faxInteraction:','./faxInteraction.events'];(function(_0xda863e,_0x4d7562){var _0x30acff=function(_0x4b5ea4){while(--_0x4b5ea4){_0xda863e['push'](_0xda863e['shift']());}};_0x30acff(++_0x4d7562);}(_0xc32a,0x65));var _0xac32=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0xc32a[_0x525af9];return _0x129fbf;};'use strict';var FaxInteractionEvents=require(_0xac32('0x0'));var events=['save',_0xac32('0x1'),_0xac32('0x2')];function createListener(_0x330e26,_0x2711a3){return function(_0x508bea){_0x2711a3['emit'](_0x330e26,_0x508bea);};}function removeListener(_0x37f7dd,_0x254999){return function(){FaxInteractionEvents['removeListener'](_0x37f7dd,_0x254999);};}exports[_0xac32('0x3')]=function(_0x5bb2a8){for(var _0x25d749=0x0,_0x163a6b=events[_0xac32('0x4')];_0x25d749<_0x163a6b;_0x25d749++){var _0x25f46d=events[_0x25d749];var _0x445abd=createListener(_0xac32('0x5')+_0x25f46d,_0x5bb2a8);FaxInteractionEvents['on'](_0x25f46d,_0x445abd);}}; \ No newline at end of file +var _0xc209=['emit','removeListener','length','faxInteraction:','save','remove','update'];(function(_0x2efb96,_0x40a4ce){var _0x50d38d=function(_0x22eaa9){while(--_0x22eaa9){_0x2efb96['push'](_0x2efb96['shift']());}};_0x50d38d(++_0x40a4ce);}(_0xc209,0x18c));var _0x9c20=function(_0x3b0697,_0x2e17bb){_0x3b0697=_0x3b0697-0x0;var _0xabb05=_0xc209[_0x3b0697];return _0xabb05;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x9c20('0x0'),_0x9c20('0x1'),_0x9c20('0x2')];function createListener(_0x271113,_0x3b9c7b){return function(_0x218da7){_0x3b9c7b[_0x9c20('0x3')](_0x271113,_0x218da7);};}function removeListener(_0x285a17,_0x556f78){return function(){FaxInteractionEvents[_0x9c20('0x4')](_0x285a17,_0x556f78);};}exports['register']=function(_0x1cface){for(var _0x4c5c86=0x0,_0x37ebd3=events[_0x9c20('0x5')];_0x4c5c86<_0x37ebd3;_0x4c5c86++){var _0x3bb5ec=events[_0x4c5c86];var _0x107971=createListener(_0x9c20('0x6')+_0x3bb5ec,_0x1cface);FaxInteractionEvents['on'](_0x3bb5ec,_0x107971);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b40550c..9fe3835 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 _0x06ca=['/:id/messages','getMessages','post','addMessage','tracked','faxinteraction:addtags','put','/:id','fax','update','delete','/:id/tags','multer','util','express','Router','fs-extra','../../components/auth/service','./faxInteraction.controller','get','isAuthenticated','describe','show'];(function(_0x5d4f0d,_0x524902){var _0x1fd99a=function(_0x5f0493){while(--_0x5f0493){_0x5d4f0d['push'](_0x5d4f0d['shift']());}};_0x1fd99a(++_0x524902);}(_0x06ca,0xad));var _0xa06c=function(_0x4201ee,_0x521fc2){_0x4201ee=_0x4201ee-0x0;var _0x525154=_0x06ca[_0x4201ee];return _0x525154;};'use strict';var multer=require(_0xa06c('0x0'));var util=require(_0xa06c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa06c('0x2'));var router=express[_0xa06c('0x3')]();var fs_extra=require(_0xa06c('0x4'));var auth=require(_0xa06c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa06c('0x6'));router[_0xa06c('0x7')]('/',auth[_0xa06c('0x8')](),controller['index']);router[_0xa06c('0x7')]('/describe',auth[_0xa06c('0x8')](),controller[_0xa06c('0x9')]);router[_0xa06c('0x7')]('/:id',auth[_0xa06c('0x8')](),controller[_0xa06c('0xa')]);router[_0xa06c('0x7')](_0xa06c('0xb'),auth[_0xa06c('0x8')](),controller[_0xa06c('0xc')]);router[_0xa06c('0x7')]('/:id/download',auth[_0xa06c('0x8')](),controller['download']);router[_0xa06c('0xd')]('/',auth[_0xa06c('0x8')](),controller['create']);router[_0xa06c('0xd')](_0xa06c('0xb'),auth[_0xa06c('0x8')](),controller[_0xa06c('0xe')]);router[_0xa06c('0xd')]('/:id/tags',auth[_0xa06c('0x8')](),interaction[_0xa06c('0xf')]('fax',_0xa06c('0x10')),controller['addTags']);router[_0xa06c('0x11')](_0xa06c('0x12'),auth[_0xa06c('0x8')](),interaction[_0xa06c('0xf')](_0xa06c('0x13'),'faxinteraction:update'),controller[_0xa06c('0x14')]);router[_0xa06c('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0xa06c('0xf')](_0xa06c('0x13'),'faxinteraction:destroy'),controller['destroy']);router['delete'](_0xa06c('0x16'),auth[_0xa06c('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xa3d9=['faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put'];(function(_0x1fdda9,_0x5c74bd){var _0x25e192=function(_0x33c4d6){while(--_0x33c4d6){_0x1fdda9['push'](_0x1fdda9['shift']());}};_0x25e192(++_0x5c74bd);}(_0xa3d9,0x150));var _0x9a3d=function(_0x6b4f52,_0x4a17d1){_0x6b4f52=_0x6b4f52-0x0;var _0xa387e5=_0xa3d9[_0x6b4f52];return _0xa387e5;};'use strict';var multer=require('multer');var util=require(_0x9a3d('0x0'));var path=require(_0x9a3d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9a3d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9a3d('0x3'));var interaction=require(_0x9a3d('0x4'));var config=require(_0x9a3d('0x5'));var controller=require(_0x9a3d('0x6'));router[_0x9a3d('0x7')]('/',auth[_0x9a3d('0x8')](),controller[_0x9a3d('0x9')]);router[_0x9a3d('0x7')](_0x9a3d('0xa'),auth[_0x9a3d('0x8')](),controller[_0x9a3d('0xb')]);router[_0x9a3d('0x7')](_0x9a3d('0xc'),auth[_0x9a3d('0x8')](),controller['show']);router['get']('/:id/messages',auth[_0x9a3d('0x8')](),controller[_0x9a3d('0xd')]);router[_0x9a3d('0x7')](_0x9a3d('0xe'),auth[_0x9a3d('0x8')](),controller['download']);router[_0x9a3d('0xf')]('/',auth[_0x9a3d('0x8')](),controller[_0x9a3d('0x10')]);router[_0x9a3d('0xf')](_0x9a3d('0x11'),auth[_0x9a3d('0x8')](),controller[_0x9a3d('0x12')]);router[_0x9a3d('0xf')](_0x9a3d('0x13'),auth['isAuthenticated'](),interaction[_0x9a3d('0x14')](_0x9a3d('0x15'),_0x9a3d('0x16')),controller['addTags']);router[_0x9a3d('0x17')](_0x9a3d('0xc'),auth[_0x9a3d('0x8')](),interaction[_0x9a3d('0x14')]('fax',_0x9a3d('0x18')),controller[_0x9a3d('0x19')]);router[_0x9a3d('0x1a')](_0x9a3d('0xc'),auth['isAuthenticated'](),interaction[_0x9a3d('0x14')](_0x9a3d('0x15'),_0x9a3d('0x1b')),controller[_0x9a3d('0x1c')]);router['delete']('/:id/tags',auth[_0x9a3d('0x8')](),controller[_0x9a3d('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a55ebc6..960b98c 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 _0x61a5=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x195ce8,_0x5bf2df){var _0x3446df=function(_0x1eab6b){while(--_0x1eab6b){_0x195ce8['push'](_0x195ce8['shift']());}};_0x3446df(++_0x5bf2df);}(_0x61a5,0xf0));var _0x561a=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x61a5[_0x3a2118];return _0x1d181d;};'use strict';var Sequelize=require(_0x561a('0x0'));module['exports']={'body':{'type':Sequelize[_0x561a('0x1')](_0x561a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x561a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x561a('0x4')]('in',_0x561a('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x561a('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x561a('0x6')]}}; \ No newline at end of file +var _0xb43b=['TEXT','DATE','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x565a3e,_0x5bbed3){_0x565a3e=_0x565a3e-0x0;var _0x88ec66=_0xb43b[_0x565a3e];return _0x88ec66;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbb43('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbb43('0x4')]('in','out'),'defaultValue':_0xbb43('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 4e66172..db0b8cb 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 _0x0bfd=['FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','name','send','index','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FaxMessage','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','describe','accept','sms','acceptMessage','fax','UserId','user','agent','FaxInteraction','FaxInteractionId','interaction','get','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','format','SIP/%s','channel','motionChannel','event','reject','EventManager','rejectmessage','create','CmContact','findOne','ContactId','isNil','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','Attachment','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','fax-interactions','request','then','info','request\x20sent','debug'];(function(_0x1a03e8,_0x388ffc){var _0x37fbfc=function(_0x1fb7ae){while(--_0x1fb7ae){_0x1a03e8['push'](_0x1a03e8['shift']());}};_0x37fbfc(++_0x388ffc);}(_0x0bfd,0xdf));var _0xd0bf=function(_0x4a79b8,_0x23163f){_0x4a79b8=_0x4a79b8-0x0;var _0xc03275=_0x0bfd[_0x4a79b8];return _0xc03275;};'use strict';var util=require('util');var path=require(_0xd0bf('0x0'));var _=require(_0xd0bf('0x1'));var Redis=require(_0xd0bf('0x2'));var interactionService=require(_0xd0bf('0x3'));var qs=require(_0xd0bf('0x4'));var logger=require(_0xd0bf('0x5'))('api');var config=require('../../config/environment');var db=require(_0xd0bf('0x6'))['db'];config[_0xd0bf('0x7')]=_[_0xd0bf('0x8')](config[_0xd0bf('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0bf('0x9'))(new Redis(config[_0xd0bf('0x7')]));require(_0xd0bf('0xa'))[_0xd0bf('0xb')](socket);var jayson=require(_0xd0bf('0xc'));var client=jayson[_0xd0bf('0xd')][_0xd0bf('0xe')]({'port':0x232c});var client9002=jayson[_0xd0bf('0xd')][_0xd0bf('0xe')]({'port':0x232a});var interaction_log=require(_0xd0bf('0x5'))(_0xd0bf('0xf'));function respondWithRpcPromise(_0x17fa41,_0x22aff4,_0x57584c,_0xf3b2e1){return new Promise(function(_0x346ab6,_0x541b08){var _0x2b85a4=_0xf3b2e1||client;return _0x2b85a4[_0xd0bf('0x10')](_0x17fa41,_0x57584c)[_0xd0bf('0x11')](function(_0x32dcbc){logger[_0xd0bf('0x12')]('FaxMessage,\x20%s,\x20%s',_0x22aff4,_0xd0bf('0x13'));logger[_0xd0bf('0x14')](_0xd0bf('0x15'),_0x22aff4,_0xd0bf('0x13'),JSON[_0xd0bf('0x16')](_0x32dcbc));if(_0x32dcbc[_0xd0bf('0x17')]){if(_0x32dcbc[_0xd0bf('0x17')][_0xd0bf('0x18')]===0x1f4){logger[_0xd0bf('0x17')](_0xd0bf('0x19'),_0x22aff4,_0x32dcbc['error'][_0xd0bf('0x1a')]);return _0x541b08(_0x32dcbc[_0xd0bf('0x17')][_0xd0bf('0x1a')]);}logger['error'](_0xd0bf('0x19'),_0x22aff4,_0x32dcbc[_0xd0bf('0x17')]['message']);return _0x346ab6(_0x32dcbc['error'][_0xd0bf('0x1a')]);}else{logger[_0xd0bf('0x12')](_0xd0bf('0x19'),_0x22aff4,_0xd0bf('0x13'));_0x346ab6(_0x32dcbc[_0xd0bf('0x1b')][_0xd0bf('0x1a')]);}})['catch'](function(_0x5dd4cc){logger['error'](_0xd0bf('0x19'),_0x22aff4,_0x5dd4cc);_0x541b08(_0x5dd4cc);});});}function respondWithResult(_0x292a15,_0x599d41){_0x599d41=_0x599d41||0xc8;return function(_0x17587e){if(_0x17587e){return _0x292a15[_0xd0bf('0x1c')](_0x599d41)[_0xd0bf('0x1d')](_0x17587e);}};}function respondWithFilteredResult(_0x5e4dc7,_0xa0303f){return function(_0x569ebb){if(_0x569ebb){var _0x5c73c5=typeof _0xa0303f[_0xd0bf('0x1e')]===_0xd0bf('0x1f')&&typeof _0xa0303f[_0xd0bf('0x20')]===_0xd0bf('0x1f');var _0x2b7758=_0x569ebb[_0xd0bf('0x21')];var _0xf74867=_0x5c73c5?0x0:_0xa0303f[_0xd0bf('0x1e')];var _0xb2aba1=_0x5c73c5?_0x569ebb['count']:_0xa0303f['offset']+_0xa0303f['limit'];var _0x16a232;if(_0xb2aba1>=_0x2b7758){_0xb2aba1=_0x2b7758;_0x16a232=0xc8;}else{_0x16a232=0xce;}_0x5e4dc7['status'](_0x16a232);return _0x5e4dc7[_0xd0bf('0x22')](_0xd0bf('0x23'),_0xf74867+'-'+_0xb2aba1+'/'+_0x2b7758)[_0xd0bf('0x1d')](_0x569ebb);}return null;};}function saveUpdates(_0x5518f3){return function(_0x497016){if(_0x497016){return _0x497016[_0xd0bf('0x24')](_0x5518f3)[_0xd0bf('0x11')](function(_0x47117a){return _0x47117a;});}return null;};}function removeEntity(_0x32d2dd){return function(_0x168383){if(_0x168383){return _0x168383[_0xd0bf('0x25')]()[_0xd0bf('0x11')](function(){_0x32d2dd[_0xd0bf('0x1c')](0xcc)[_0xd0bf('0x26')]();});}};}function handleEntityNotFound(_0x415957){return function(_0x26b505){if(!_0x26b505){_0x415957[_0xd0bf('0x27')](0x194);}return _0x26b505;};}function handleError(_0x24a18b,_0x3d7c29){_0x3d7c29=_0x3d7c29||0x1f4;return function(_0x592f6d){logger[_0xd0bf('0x17')](_0x592f6d['stack']);if(_0x592f6d[_0xd0bf('0x28')]){delete _0x592f6d['name'];}_0x24a18b[_0xd0bf('0x1c')](_0x3d7c29)[_0xd0bf('0x29')](_0x592f6d);};}exports[_0xd0bf('0x2a')]=function(_0x304956,_0x510d72){var _0x323da8={},_0x56ee62={},_0x29d3b8={'count':0x0,'rows':[]};var _0x138929=_[_0xd0bf('0x2b')](db['FaxMessage']['rawAttributes'],function(_0x805ce9){return{'name':_0x805ce9[_0xd0bf('0x2c')],'type':_0x805ce9[_0xd0bf('0x2d')]['key']};});_0x56ee62[_0xd0bf('0x2e')]=_[_0xd0bf('0x2b')](_0x138929,_0xd0bf('0x28'));_0x56ee62[_0xd0bf('0x2f')]=_[_0xd0bf('0x30')](_0x304956[_0xd0bf('0x2f')]);_0x56ee62[_0xd0bf('0x31')]=_['intersection'](_0x56ee62[_0xd0bf('0x2e')],_0x56ee62[_0xd0bf('0x2f')]);_0x323da8[_0xd0bf('0x32')]=_[_0xd0bf('0x33')](_0x56ee62['model'],qs[_0xd0bf('0x34')](_0x304956[_0xd0bf('0x2f')][_0xd0bf('0x34')]));_0x323da8[_0xd0bf('0x32')]=_0x323da8['attributes'][_0xd0bf('0x35')]?_0x323da8['attributes']:_0x56ee62[_0xd0bf('0x2e')];if(!_0x304956[_0xd0bf('0x2f')][_0xd0bf('0x36')](_0xd0bf('0x37'))){_0x323da8[_0xd0bf('0x20')]=qs[_0xd0bf('0x20')](_0x304956[_0xd0bf('0x2f')]['limit']);_0x323da8['offset']=qs['offset'](_0x304956['query'][_0xd0bf('0x1e')]);}_0x323da8[_0xd0bf('0x38')]=qs[_0xd0bf('0x39')](_0x304956[_0xd0bf('0x2f')][_0xd0bf('0x39')]);_0x323da8[_0xd0bf('0x3a')]=qs[_0xd0bf('0x31')](_[_0xd0bf('0x3b')](_0x304956['query'],_0x56ee62[_0xd0bf('0x31')]),_0x138929);if(_0x304956[_0xd0bf('0x2f')][_0xd0bf('0x3c')]){_0x323da8[_0xd0bf('0x3a')]=_[_0xd0bf('0x3d')](_0x323da8[_0xd0bf('0x3a')],{'$or':_[_0xd0bf('0x2b')](_0x138929,function(_0x1c8872){if(_0x1c8872[_0xd0bf('0x2d')]!=='VIRTUAL'){var _0x1860bd={};_0x1860bd[_0x1c8872['name']]={'$like':'%'+_0x304956[_0xd0bf('0x2f')]['filter']+'%'};return _0x1860bd;}})});}_0x323da8=_['merge']({},_0x323da8,_0x304956[_0xd0bf('0x3e')]);var _0x3d5b6f={'where':_0x323da8['where']};return db[_0xd0bf('0x3f')]['count'](_0x3d5b6f)['then'](function(_0x585de5){_0x29d3b8['count']=_0x585de5;if(_0x304956[_0xd0bf('0x2f')]['includeAll']){_0x323da8[_0xd0bf('0x40')]=[{'all':!![]}];}return db[_0xd0bf('0x3f')][_0xd0bf('0x41')](_0x323da8);})['then'](function(_0x27cf32){_0x29d3b8[_0xd0bf('0x42')]=_0x27cf32;return _0x29d3b8;})[_0xd0bf('0x11')](respondWithFilteredResult(_0x510d72,_0x323da8))[_0xd0bf('0x43')](handleError(_0x510d72,null));};exports[_0xd0bf('0x44')]=function(_0x30b3ef,_0x594936){var _0x4ead62={'raw':!![],'where':{'id':_0x30b3ef[_0xd0bf('0x45')]['id']}},_0x33a81e={};_0x33a81e[_0xd0bf('0x2e')]=_[_0xd0bf('0x30')](db['FaxMessage'][_0xd0bf('0x46')]);_0x33a81e[_0xd0bf('0x2f')]=_[_0xd0bf('0x30')](_0x30b3ef[_0xd0bf('0x2f')]);_0x33a81e[_0xd0bf('0x31')]=_[_0xd0bf('0x33')](_0x33a81e[_0xd0bf('0x2e')],_0x33a81e[_0xd0bf('0x2f')]);_0x4ead62[_0xd0bf('0x32')]=_[_0xd0bf('0x33')](_0x33a81e[_0xd0bf('0x2e')],qs['fields'](_0x30b3ef[_0xd0bf('0x2f')][_0xd0bf('0x34')]));_0x4ead62[_0xd0bf('0x32')]=_0x4ead62[_0xd0bf('0x32')][_0xd0bf('0x35')]?_0x4ead62['attributes']:_0x33a81e[_0xd0bf('0x2e')];if(_0x30b3ef[_0xd0bf('0x2f')][_0xd0bf('0x47')]){_0x4ead62[_0xd0bf('0x40')]=[{'all':!![]}];}_0x4ead62=_['merge']({},_0x4ead62,_0x30b3ef[_0xd0bf('0x3e')]);return db['FaxMessage'][_0xd0bf('0x48')](_0x4ead62)[_0xd0bf('0x11')](handleEntityNotFound(_0x594936,null))['then'](respondWithResult(_0x594936,null))[_0xd0bf('0x43')](handleError(_0x594936,null));};exports[_0xd0bf('0x24')]=function(_0x47aa2f,_0x21c4cd){if(_0x47aa2f[_0xd0bf('0x49')]['id']){delete _0x47aa2f[_0xd0bf('0x49')]['id'];}return db[_0xd0bf('0x3f')][_0xd0bf('0x48')]({'where':{'id':_0x47aa2f[_0xd0bf('0x45')]['id']}})[_0xd0bf('0x11')](handleEntityNotFound(_0x21c4cd,null))[_0xd0bf('0x11')](saveUpdates(_0x47aa2f[_0xd0bf('0x49')],null))[_0xd0bf('0x11')](respondWithResult(_0x21c4cd,null))[_0xd0bf('0x43')](handleError(_0x21c4cd,null));};exports['destroy']=function(_0x35456,_0x5f041a){return db[_0xd0bf('0x3f')]['find']({'where':{'id':_0x35456[_0xd0bf('0x45')]['id']}})[_0xd0bf('0x11')](handleEntityNotFound(_0x5f041a,null))[_0xd0bf('0x11')](removeEntity(_0x5f041a,null))[_0xd0bf('0x43')](handleError(_0x5f041a,null));};exports[_0xd0bf('0x4a')]=function(_0x2565f9,_0x345dfa){return db[_0xd0bf('0x3f')][_0xd0bf('0x4a')]()[_0xd0bf('0x11')](respondWithResult(_0x345dfa,null))['catch'](handleError(_0x345dfa,null));};exports[_0xd0bf('0x4b')]=function(_0x10cc3a,_0x5464f9){var _0x134548=_0xd0bf('0x4c');return interactionService[_0xd0bf('0x4d')](_0x10cc3a,_0x134548)['then'](respondWithResult(_0x5464f9,null))['catch'](handleError(_0x5464f9,null));};exports[_0xd0bf('0x4b')]=function(_0x55ad64,_0x5180dc){var _0x1ced4d='fax';return interactionService[_0xd0bf('0x4d')](_0x55ad64,_0x1ced4d)[_0xd0bf('0x11')](respondWithResult(_0x5180dc,null))[_0xd0bf('0x43')](handleError(_0x5180dc,null));};exports['reject']=function(_0xa7c049,_0x28be7e){var _0x1f7be5={'agent':{},'channel':_0xd0bf('0x4e')};if(_0xa7c049[_0xd0bf('0x49')]['id']){delete _0xa7c049['body']['id'];}_0xa7c049['body'][_0xd0bf('0x4f')]=_0xa7c049['body'][_0xd0bf('0x4f')]||_0xa7c049[_0xd0bf('0x50')]['id'];_0x1f7be5[_0xd0bf('0x51')]['id']=_0xa7c049[_0xd0bf('0x49')][_0xd0bf('0x4f')];return db[_0xd0bf('0x3f')][_0xd0bf('0x48')]({'where':{'id':_0xa7c049['params']['id'],'UserId':null}})[_0xd0bf('0x11')](handleEntityNotFound(_0x28be7e,null))[_0xd0bf('0x11')](function(_0x4554c2){if(_0x4554c2){_0x1f7be5['message']=_0x4554c2['get']({'plain':!![]});return db[_0xd0bf('0x52')]['find']({'where':{'id':_0x4554c2[_0xd0bf('0x53')]}});}return null;})[_0xd0bf('0x11')](handleEntityNotFound(_0x28be7e,null))[_0xd0bf('0x11')](function(_0x3b14f5){if(_0x3b14f5){_0x1f7be5[_0xd0bf('0x54')]=_0x3b14f5[_0xd0bf('0x55')]({'plain':!![]});interaction_log[_0xd0bf('0x12')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa7c049[_0xd0bf('0x50')]['id'],_0xa7c049[_0xd0bf('0x50')][_0xd0bf('0x28')],_0xa7c049[_0xd0bf('0x50')][_0xd0bf('0x56')],_0x1f7be5[_0xd0bf('0x54')]['id'],_0xa7c049['body']?JSON[_0xd0bf('0x16')](_0xa7c049[_0xd0bf('0x49')]):_0xd0bf('0x57'));return respondWithRpcPromise(_0xd0bf('0x58'),_0xd0bf('0x59'),_0x1f7be5);}return null;})[_0xd0bf('0x11')](function(_0x3ee873){var _0x538ef4=_0xd0bf('0x5a')+_0x3ee873[_0xd0bf('0x1a')]['ContactId'];return db[_0xd0bf('0x5b')][_0xd0bf('0x2f')](_0x538ef4,{'type':db['Sequelize'][_0xd0bf('0x5c')][_0xd0bf('0x5d')],'raw':!![]})[_0xd0bf('0x11')](function(_0x325e38){return _0x325e38;});})[_0xd0bf('0x11')](function(_0x28f9d4){if(_0x28f9d4){_0x1f7be5['message'][_0xd0bf('0x5e')]=_0x28f9d4[0x0];if(!_0xa7c049[_0xd0bf('0x49')]['UserId'])return;return db[_0xd0bf('0x5f')][_0xd0bf('0x48')]({'where':{'id':_0xa7c049['body'][_0xd0bf('0x4f')],'role':'agent'},'attributes':['id',_0xd0bf('0x28'),_0xd0bf('0x60'),_0xd0bf('0x61'),_0xd0bf('0x62')],'raw':!![]});}return null;})[_0xd0bf('0x11')](function(_0x216f3e){if(!_0x216f3e)return null;_0x1f7be5[_0xd0bf('0x1a')][_0xd0bf('0x51')]=_0x216f3e;return _0x1f7be5;})[_0xd0bf('0x11')](function(_0xfbf728){if(_0xfbf728){_0xfbf728['message']['interface']=util[_0xd0bf('0x63')](_0xd0bf('0x64'),_0xa7c049[_0xd0bf('0x50')][_0xd0bf('0x28')]);_0xfbf728[_0xd0bf('0x1a')][_0xd0bf('0x65')]=_0x1f7be5[_0xd0bf('0x65')];_0xfbf728[_0xd0bf('0x1a')][_0xd0bf('0x66')]=_0x1f7be5[_0xd0bf('0x65')];_0xfbf728[_0xd0bf('0x1a')][_0xd0bf('0x67')]=_0xd0bf('0x68');respondWithRpcPromise('EventManager',_0xd0bf('0x69'),{'event':_0xd0bf('0x6a'),'message':_0xfbf728[_0xd0bf('0x1a')]},client9002);return _0x1f7be5;}return null;})[_0xd0bf('0x11')](respondWithResult(_0x28be7e,null))[_0xd0bf('0x43')](handleError(_0x28be7e,null));};exports['create']=function(_0x1d0f0b,_0x55e6e4){var _0x5378d3;return db[_0xd0bf('0x3f')][_0xd0bf('0x6b')](_0x1d0f0b[_0xd0bf('0x49')],{})[_0xd0bf('0x11')](function(_0x215f0a){_0x5378d3=_0x215f0a;return db[_0xd0bf('0x6c')][_0xd0bf('0x6d')]({'where':{'id':_0x5378d3[_0xd0bf('0x6e')]}});})[_0xd0bf('0x11')](function(_0x54c733){if(_[_0xd0bf('0x6f')](_0x54c733)){return;}else{_0x5378d3['fax']=_0x54c733['fax'];return db['Attachment'][_0xd0bf('0x6d')]({'where':{'id':_0x5378d3[_0xd0bf('0x70')]}});}})[_0xd0bf('0x11')](function(_0x215058){return respondWithRpcPromise(_0xd0bf('0x71'),_0xd0bf('0x71'),{'FaxAccountId':_['isNil'](_0x1d0f0b[_0xd0bf('0x49')])?undefined:_0x1d0f0b[_0xd0bf('0x49')]['FaxAccountId'],'path':_[_0xd0bf('0x6f')](_0x215058)?undefined:util[_0xd0bf('0x63')](_0xd0bf('0x72'),_0x215058[_0xd0bf('0x73')]),'fax':_[_0xd0bf('0x6f')](_0x5378d3[_0xd0bf('0x4e')])?undefined:_0x5378d3[_0xd0bf('0x4e')],'AttachmentId':_0x5378d3[_0xd0bf('0x70')]},client9002);})[_0xd0bf('0x11')](respondWithResult(_0x55e6e4,0xc9))[_0xd0bf('0x43')](handleError(_0x55e6e4,null));};exports[_0xd0bf('0x74')]=function(_0xf9a9de,_0xc2fd93){var _0x791350=path[_0xd0bf('0x75')](config[_0xd0bf('0x76')],_0xd0bf('0x77'),'files',_0xd0bf('0x78'));return db[_0xd0bf('0x3f')][_0xd0bf('0x48')]({'where':{'id':_0xf9a9de[_0xd0bf('0x45')]['id']},'include':[{'model':db['Attachment'],'as':_0xd0bf('0x79')}]})[_0xd0bf('0x11')](handleEntityNotFound(_0xc2fd93,null))[_0xd0bf('0x11')](function(_0x5beb1d){if(_0x5beb1d){return _0xc2fd93[_0xd0bf('0x74')](path[_0xd0bf('0x75')](_0x791350,_0x5beb1d['Attachment'][_0xd0bf('0x73')]));}})['catch'](handleError(_0xc2fd93,null));}; \ No newline at end of file +var _0xa8c0=['Attachment','AttachmentId','SendFax','FaxAccountId','format','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','download','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','register','jayson/promise','http','client','fax-interactions','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','undefined','limit','count','offset','set','json','sendStatus','send','index','map','FaxMessage','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','update','body','destroy','describe','accept','sms','acceptMessage','fax','UserId','user','agent','get','FaxInteraction','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','CmContact','findOne','isNil'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xa8c0,0xf5));var _0x0a8c=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0xa8c0[_0x28509b];return _0x1e0b6;};'use strict';var util=require('util');var path=require(_0x0a8c('0x0'));var _=require(_0x0a8c('0x1'));var Redis=require(_0x0a8c('0x2'));var interactionService=require(_0x0a8c('0x3'));var qs=require(_0x0a8c('0x4'));var logger=require(_0x0a8c('0x5'))(_0x0a8c('0x6'));var config=require(_0x0a8c('0x7'));var db=require(_0x0a8c('0x8'))['db'];config[_0x0a8c('0x9')]=_[_0x0a8c('0xa')](config[_0x0a8c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a8c('0x9')]));require('./faxMessage.socket')[_0x0a8c('0xb')](socket);var jayson=require(_0x0a8c('0xc'));var client=jayson['client'][_0x0a8c('0xd')]({'port':0x232c});var client9002=jayson[_0x0a8c('0xe')]['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0x0a8c('0xf'));function respondWithRpcPromise(_0x30950d,_0x17be45,_0x3269f1,_0x5d6a4e){return new Promise(function(_0x46bbec,_0x1875e9){var _0x91827f=_0x5d6a4e||client;return _0x91827f['request'](_0x30950d,_0x3269f1)[_0x0a8c('0x10')](function(_0x1a8286){logger[_0x0a8c('0x11')](_0x0a8c('0x12'),_0x17be45,_0x0a8c('0x13'));logger[_0x0a8c('0x14')](_0x0a8c('0x15'),_0x17be45,_0x0a8c('0x13'),JSON[_0x0a8c('0x16')](_0x1a8286));if(_0x1a8286['error']){if(_0x1a8286['error'][_0x0a8c('0x17')]===0x1f4){logger['error'](_0x0a8c('0x12'),_0x17be45,_0x1a8286[_0x0a8c('0x18')][_0x0a8c('0x19')]);return _0x1875e9(_0x1a8286[_0x0a8c('0x18')][_0x0a8c('0x19')]);}logger['error'](_0x0a8c('0x12'),_0x17be45,_0x1a8286[_0x0a8c('0x18')][_0x0a8c('0x19')]);return _0x46bbec(_0x1a8286[_0x0a8c('0x18')][_0x0a8c('0x19')]);}else{logger[_0x0a8c('0x11')](_0x0a8c('0x12'),_0x17be45,_0x0a8c('0x13'));_0x46bbec(_0x1a8286[_0x0a8c('0x1a')][_0x0a8c('0x19')]);}})[_0x0a8c('0x1b')](function(_0x1c8e0b){logger[_0x0a8c('0x18')]('FaxMessage,\x20%s,\x20%s',_0x17be45,_0x1c8e0b);_0x1875e9(_0x1c8e0b);});});}function respondWithResult(_0x4fb179,_0x18587d){_0x18587d=_0x18587d||0xc8;return function(_0x28d3a4){if(_0x28d3a4){return _0x4fb179[_0x0a8c('0x1c')](_0x18587d)['json'](_0x28d3a4);}};}function respondWithFilteredResult(_0x51a59c,_0xd9d1cc){return function(_0x2f899e){if(_0x2f899e){var _0x26f83c=typeof _0xd9d1cc['offset']===_0x0a8c('0x1d')&&typeof _0xd9d1cc[_0x0a8c('0x1e')]==='undefined';var _0x53f44a=_0x2f899e['count'];var _0x2ee2ba=_0x26f83c?0x0:_0xd9d1cc['offset'];var _0x4c663c=_0x26f83c?_0x2f899e[_0x0a8c('0x1f')]:_0xd9d1cc[_0x0a8c('0x20')]+_0xd9d1cc[_0x0a8c('0x1e')];var _0x4ffdaa;if(_0x4c663c>=_0x53f44a){_0x4c663c=_0x53f44a;_0x4ffdaa=0xc8;}else{_0x4ffdaa=0xce;}_0x51a59c[_0x0a8c('0x1c')](_0x4ffdaa);return _0x51a59c[_0x0a8c('0x21')]('Content-Range',_0x2ee2ba+'-'+_0x4c663c+'/'+_0x53f44a)[_0x0a8c('0x22')](_0x2f899e);}return null;};}function saveUpdates(_0x5c76d0){return function(_0x535c6c){if(_0x535c6c){return _0x535c6c['update'](_0x5c76d0)[_0x0a8c('0x10')](function(_0x7c90da){return _0x7c90da;});}return null;};}function removeEntity(_0x20dd16){return function(_0x4de0b1){if(_0x4de0b1){return _0x4de0b1['destroy']()[_0x0a8c('0x10')](function(){_0x20dd16['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac27c){return function(_0x5417f3){if(!_0x5417f3){_0x4ac27c[_0x0a8c('0x23')](0x194);}return _0x5417f3;};}function handleError(_0x3e66c8,_0x4d9489){_0x4d9489=_0x4d9489||0x1f4;return function(_0x68bee7){logger['error'](_0x68bee7['stack']);if(_0x68bee7['name']){delete _0x68bee7['name'];}_0x3e66c8['status'](_0x4d9489)[_0x0a8c('0x24')](_0x68bee7);};}exports[_0x0a8c('0x25')]=function(_0x51976f,_0x48d9d6){var _0x3fcf90={},_0x90981f={},_0x1bb63c={'count':0x0,'rows':[]};var _0x52f93e=_[_0x0a8c('0x26')](db[_0x0a8c('0x27')]['rawAttributes'],function(_0x41af64){return{'name':_0x41af64[_0x0a8c('0x28')],'type':_0x41af64[_0x0a8c('0x29')][_0x0a8c('0x2a')]};});_0x90981f[_0x0a8c('0x2b')]=_[_0x0a8c('0x26')](_0x52f93e,_0x0a8c('0x2c'));_0x90981f['query']=_[_0x0a8c('0x2d')](_0x51976f['query']);_0x90981f[_0x0a8c('0x2e')]=_[_0x0a8c('0x2f')](_0x90981f[_0x0a8c('0x2b')],_0x90981f[_0x0a8c('0x30')]);_0x3fcf90[_0x0a8c('0x31')]=_[_0x0a8c('0x2f')](_0x90981f[_0x0a8c('0x2b')],qs['fields'](_0x51976f[_0x0a8c('0x30')][_0x0a8c('0x32')]));_0x3fcf90[_0x0a8c('0x31')]=_0x3fcf90[_0x0a8c('0x31')][_0x0a8c('0x33')]?_0x3fcf90[_0x0a8c('0x31')]:_0x90981f[_0x0a8c('0x2b')];if(!_0x51976f[_0x0a8c('0x30')][_0x0a8c('0x34')](_0x0a8c('0x35'))){_0x3fcf90[_0x0a8c('0x1e')]=qs[_0x0a8c('0x1e')](_0x51976f[_0x0a8c('0x30')][_0x0a8c('0x1e')]);_0x3fcf90[_0x0a8c('0x20')]=qs[_0x0a8c('0x20')](_0x51976f['query'][_0x0a8c('0x20')]);}_0x3fcf90['order']=qs[_0x0a8c('0x36')](_0x51976f[_0x0a8c('0x30')]['sort']);_0x3fcf90[_0x0a8c('0x37')]=qs[_0x0a8c('0x2e')](_[_0x0a8c('0x38')](_0x51976f[_0x0a8c('0x30')],_0x90981f['filters']),_0x52f93e);if(_0x51976f[_0x0a8c('0x30')][_0x0a8c('0x39')]){_0x3fcf90['where']=_[_0x0a8c('0x3a')](_0x3fcf90[_0x0a8c('0x37')],{'$or':_['map'](_0x52f93e,function(_0x14e9d0){if(_0x14e9d0['type']!==_0x0a8c('0x3b')){var _0x223963={};_0x223963[_0x14e9d0['name']]={'$like':'%'+_0x51976f[_0x0a8c('0x30')]['filter']+'%'};return _0x223963;}})});}_0x3fcf90=_['merge']({},_0x3fcf90,_0x51976f[_0x0a8c('0x3c')]);var _0x4bbf15={'where':_0x3fcf90['where']};return db['FaxMessage'][_0x0a8c('0x1f')](_0x4bbf15)['then'](function(_0x548c27){_0x1bb63c['count']=_0x548c27;if(_0x51976f['query'][_0x0a8c('0x3d')]){_0x3fcf90[_0x0a8c('0x3e')]=[{'all':!![]}];}return db[_0x0a8c('0x27')][_0x0a8c('0x3f')](_0x3fcf90);})['then'](function(_0x1f7dff){_0x1bb63c[_0x0a8c('0x40')]=_0x1f7dff;return _0x1bb63c;})[_0x0a8c('0x10')](respondWithFilteredResult(_0x48d9d6,_0x3fcf90))[_0x0a8c('0x1b')](handleError(_0x48d9d6,null));};exports[_0x0a8c('0x41')]=function(_0x21070e,_0x541f6c){var _0x205210={'raw':!![],'where':{'id':_0x21070e[_0x0a8c('0x42')]['id']}},_0x2e608c={};_0x2e608c[_0x0a8c('0x2b')]=_[_0x0a8c('0x2d')](db['FaxMessage']['rawAttributes']);_0x2e608c[_0x0a8c('0x30')]=_[_0x0a8c('0x2d')](_0x21070e[_0x0a8c('0x30')]);_0x2e608c['filters']=_['intersection'](_0x2e608c[_0x0a8c('0x2b')],_0x2e608c['query']);_0x205210[_0x0a8c('0x31')]=_[_0x0a8c('0x2f')](_0x2e608c[_0x0a8c('0x2b')],qs['fields'](_0x21070e[_0x0a8c('0x30')][_0x0a8c('0x32')]));_0x205210[_0x0a8c('0x31')]=_0x205210[_0x0a8c('0x31')][_0x0a8c('0x33')]?_0x205210[_0x0a8c('0x31')]:_0x2e608c[_0x0a8c('0x2b')];if(_0x21070e[_0x0a8c('0x30')][_0x0a8c('0x3d')]){_0x205210[_0x0a8c('0x3e')]=[{'all':!![]}];}_0x205210=_[_0x0a8c('0x3a')]({},_0x205210,_0x21070e[_0x0a8c('0x3c')]);return db[_0x0a8c('0x27')][_0x0a8c('0x43')](_0x205210)[_0x0a8c('0x10')](handleEntityNotFound(_0x541f6c,null))[_0x0a8c('0x10')](respondWithResult(_0x541f6c,null))[_0x0a8c('0x1b')](handleError(_0x541f6c,null));};exports[_0x0a8c('0x44')]=function(_0xa63fe7,_0x3bf97a){if(_0xa63fe7['body']['id']){delete _0xa63fe7[_0x0a8c('0x45')]['id'];}return db[_0x0a8c('0x27')]['find']({'where':{'id':_0xa63fe7['params']['id']}})[_0x0a8c('0x10')](handleEntityNotFound(_0x3bf97a,null))[_0x0a8c('0x10')](saveUpdates(_0xa63fe7[_0x0a8c('0x45')],null))[_0x0a8c('0x10')](respondWithResult(_0x3bf97a,null))[_0x0a8c('0x1b')](handleError(_0x3bf97a,null));};exports[_0x0a8c('0x46')]=function(_0x47e05f,_0x106bc8){return db[_0x0a8c('0x27')][_0x0a8c('0x43')]({'where':{'id':_0x47e05f['params']['id']}})[_0x0a8c('0x10')](handleEntityNotFound(_0x106bc8,null))[_0x0a8c('0x10')](removeEntity(_0x106bc8,null))['catch'](handleError(_0x106bc8,null));};exports[_0x0a8c('0x47')]=function(_0x11273b,_0x51215b){return db[_0x0a8c('0x27')]['describe']()[_0x0a8c('0x10')](respondWithResult(_0x51215b,null))[_0x0a8c('0x1b')](handleError(_0x51215b,null));};exports[_0x0a8c('0x48')]=function(_0x24a097,_0xfd6c0f){var _0x5b35e4=_0x0a8c('0x49');return interactionService[_0x0a8c('0x4a')](_0x24a097,_0x5b35e4)[_0x0a8c('0x10')](respondWithResult(_0xfd6c0f,null))[_0x0a8c('0x1b')](handleError(_0xfd6c0f,null));};exports[_0x0a8c('0x48')]=function(_0x3796eb,_0x3d8dbf){var _0x57a7ed=_0x0a8c('0x4b');return interactionService['acceptMessage'](_0x3796eb,_0x57a7ed)[_0x0a8c('0x10')](respondWithResult(_0x3d8dbf,null))[_0x0a8c('0x1b')](handleError(_0x3d8dbf,null));};exports['reject']=function(_0x19c437,_0x32d629){var _0x1c4e6b={'agent':{},'channel':_0x0a8c('0x4b')};if(_0x19c437[_0x0a8c('0x45')]['id']){delete _0x19c437['body']['id'];}_0x19c437['body']['UserId']=_0x19c437['body'][_0x0a8c('0x4c')]||_0x19c437[_0x0a8c('0x4d')]['id'];_0x1c4e6b[_0x0a8c('0x4e')]['id']=_0x19c437[_0x0a8c('0x45')][_0x0a8c('0x4c')];return db[_0x0a8c('0x27')][_0x0a8c('0x43')]({'where':{'id':_0x19c437[_0x0a8c('0x42')]['id'],'UserId':null}})[_0x0a8c('0x10')](handleEntityNotFound(_0x32d629,null))[_0x0a8c('0x10')](function(_0x4585a3){if(_0x4585a3){_0x1c4e6b[_0x0a8c('0x19')]=_0x4585a3[_0x0a8c('0x4f')]({'plain':!![]});return db[_0x0a8c('0x50')]['find']({'where':{'id':_0x4585a3['FaxInteractionId']}});}return null;})[_0x0a8c('0x10')](handleEntityNotFound(_0x32d629,null))['then'](function(_0x302ede){if(_0x302ede){_0x1c4e6b[_0x0a8c('0x51')]=_0x302ede['get']({'plain':!![]});interaction_log[_0x0a8c('0x11')](_0x0a8c('0x52'),_0x19c437[_0x0a8c('0x4d')]['id'],_0x19c437[_0x0a8c('0x4d')]['name'],_0x19c437[_0x0a8c('0x4d')][_0x0a8c('0x53')],_0x1c4e6b[_0x0a8c('0x51')]['id'],_0x19c437[_0x0a8c('0x45')]?JSON[_0x0a8c('0x16')](_0x19c437[_0x0a8c('0x45')]):_0x0a8c('0x54'));return respondWithRpcPromise(_0x0a8c('0x55'),'rejectMessage',_0x1c4e6b);}return null;})[_0x0a8c('0x10')](function(_0x4fc33d){var _0x42b70a=_0x0a8c('0x56')+_0x4fc33d[_0x0a8c('0x19')][_0x0a8c('0x57')];return db[_0x0a8c('0x58')][_0x0a8c('0x30')](_0x42b70a,{'type':db['Sequelize'][_0x0a8c('0x59')]['SELECT'],'raw':!![]})[_0x0a8c('0x10')](function(_0x395378){return _0x395378;});})[_0x0a8c('0x10')](function(_0x153ce1){if(_0x153ce1){_0x1c4e6b[_0x0a8c('0x19')][_0x0a8c('0x5a')]=_0x153ce1[0x0];if(!_0x19c437['body'][_0x0a8c('0x4c')])return;return db[_0x0a8c('0x5b')][_0x0a8c('0x43')]({'where':{'id':_0x19c437[_0x0a8c('0x45')][_0x0a8c('0x4c')],'role':_0x0a8c('0x4e')},'attributes':['id','name',_0x0a8c('0x5c'),_0x0a8c('0x5d'),_0x0a8c('0x5e')],'raw':!![]});}return null;})['then'](function(_0x39e67a){if(!_0x39e67a)return null;_0x1c4e6b['message'][_0x0a8c('0x4e')]=_0x39e67a;return _0x1c4e6b;})[_0x0a8c('0x10')](function(_0x2c585a){if(_0x2c585a){_0x2c585a[_0x0a8c('0x19')][_0x0a8c('0x5f')]=util['format'](_0x0a8c('0x60'),_0x19c437[_0x0a8c('0x4d')][_0x0a8c('0x2c')]);_0x2c585a[_0x0a8c('0x19')][_0x0a8c('0x61')]=_0x1c4e6b[_0x0a8c('0x61')];_0x2c585a[_0x0a8c('0x19')][_0x0a8c('0x62')]=_0x1c4e6b['channel'];_0x2c585a[_0x0a8c('0x19')][_0x0a8c('0x63')]='reject';respondWithRpcPromise('EventManager',_0x0a8c('0x64'),{'event':_0x0a8c('0x65'),'message':_0x2c585a['message']},client9002);return _0x1c4e6b;}return null;})[_0x0a8c('0x10')](respondWithResult(_0x32d629,null))[_0x0a8c('0x1b')](handleError(_0x32d629,null));};exports[_0x0a8c('0x66')]=function(_0x3e4bc0,_0x219c3c){var _0x505306;return db['FaxMessage'][_0x0a8c('0x66')](_0x3e4bc0[_0x0a8c('0x45')],{})['then'](function(_0x4f9b91){_0x505306=_0x4f9b91;return db[_0x0a8c('0x67')][_0x0a8c('0x68')]({'where':{'id':_0x505306[_0x0a8c('0x57')]}});})['then'](function(_0x93e608){if(_[_0x0a8c('0x69')](_0x93e608)){return;}else{_0x505306[_0x0a8c('0x4b')]=_0x93e608[_0x0a8c('0x4b')];return db[_0x0a8c('0x6a')][_0x0a8c('0x68')]({'where':{'id':_0x505306[_0x0a8c('0x6b')]}});}})[_0x0a8c('0x10')](function(_0x5dd301){return respondWithRpcPromise(_0x0a8c('0x6c'),_0x0a8c('0x6c'),{'FaxAccountId':_[_0x0a8c('0x69')](_0x3e4bc0[_0x0a8c('0x45')])?undefined:_0x3e4bc0[_0x0a8c('0x45')][_0x0a8c('0x6d')],'path':_[_0x0a8c('0x69')](_0x5dd301)?undefined:util[_0x0a8c('0x6e')](_0x0a8c('0x6f'),_0x5dd301[_0x0a8c('0x70')]),'fax':_[_0x0a8c('0x69')](_0x505306[_0x0a8c('0x4b')])?undefined:_0x505306[_0x0a8c('0x4b')],'AttachmentId':_0x505306[_0x0a8c('0x6b')]},client9002);})[_0x0a8c('0x10')](respondWithResult(_0x219c3c,0xc9))[_0x0a8c('0x1b')](handleError(_0x219c3c,null));};exports['download']=function(_0x2256f5,_0x387ed8){var _0x1d2881=path[_0x0a8c('0x71')](config[_0x0a8c('0x72')],_0x0a8c('0x73'),'files','attachments');return db[_0x0a8c('0x27')][_0x0a8c('0x43')]({'where':{'id':_0x2256f5[_0x0a8c('0x42')]['id']},'include':[{'model':db[_0x0a8c('0x6a')],'as':_0x0a8c('0x6a')}]})[_0x0a8c('0x10')](handleEntityNotFound(_0x387ed8,null))['then'](function(_0x16a26d){if(_0x16a26d){return _0x387ed8[_0x0a8c('0x74')](path[_0x0a8c('0x71')](_0x1d2881,_0x16a26d['Attachment']['basename']));}})[_0x0a8c('0x1b')](handleError(_0x387ed8,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e43a422..24bf7a7 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 _0xb94c=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x32c189,_0x3ffb8e){var _0x526217=function(_0xca7609){while(--_0xca7609){_0x32c189['push'](_0x32c189['shift']());}};_0x526217(++_0x3ffb8e);}(_0xb94c,0x176));var _0xcb94=function(_0x9391df,_0x101e81){_0x9391df=_0x9391df-0x0;var _0xf8d381=_0xb94c[_0x9391df];return _0xf8d381;};'use strict';var EventEmitter=require(_0xcb94('0x0'));var FaxMessage=require(_0xcb94('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xcb94('0x2')](0x0);var events={'afterCreate':_0xcb94('0x3'),'afterUpdate':'update','afterDestroy':_0xcb94('0x4')};function emitEvent(_0x544687){return function(_0x16e652,_0xbbe00c,_0x2cf8a9){FaxMessageEvents[_0xcb94('0x5')](_0x544687+':'+_0x16e652['id'],_0x16e652);FaxMessageEvents[_0xcb94('0x5')](_0x544687,_0x16e652);_0x2cf8a9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xcb94('0x6')](e,emitEvent(event));}}module[_0xcb94('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0xdb7e=['hook','exports','events','../../mysqldb','FaxMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0xdb7e,0x11a));var _0xedb7=function(_0x2b6e5d,_0x417c59){_0x2b6e5d=_0x2b6e5d-0x0;var _0x77d8c8=_0xdb7e[_0x2b6e5d];return _0x77d8c8;};'use strict';var EventEmitter=require(_0xedb7('0x0'));var FaxMessage=require(_0xedb7('0x1'))['db'][_0xedb7('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xedb7('0x3'),'afterUpdate':_0xedb7('0x4'),'afterDestroy':_0xedb7('0x5')};function emitEvent(_0x58fc55){return function(_0x16179a,_0x4130d2,_0x40f048){FaxMessageEvents[_0xedb7('0x6')](_0x58fc55+':'+_0x16179a['id'],_0x16179a);FaxMessageEvents[_0xedb7('0x6')](_0x58fc55,_0x16179a);_0x40f048(null);};}for(var e in events){if(events[_0xedb7('0x7')](e)){var event=events[e];FaxMessage[_0xedb7('0x8')](e,emitEvent(event));}}module[_0xedb7('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 7887fca..d314c0e 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 _0xc4d9=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','toLowerCase','FaxInteraction','FaxInteractionId','update','direction','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x50589f,_0x22f34d){var _0x56504e=function(_0x3eaa14){while(--_0x3eaa14){_0x50589f['push'](_0x50589f['shift']());}};_0x56504e(++_0x22f34d);}(_0xc4d9,0xfa));var _0x9c4d=function(_0x2d3652,_0xc2b0df){_0x2d3652=_0x2d3652-0x0;var _0x37a4de=_0xc4d9[_0x2d3652];return _0x37a4de;};'use strict';var _=require(_0x9c4d('0x0'));var util=require(_0x9c4d('0x1'));var logger=require(_0x9c4d('0x2'))(_0x9c4d('0x3'));var moment=require(_0x9c4d('0x4'));var BPromise=require(_0x9c4d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c4d('0x6'));var rimraf=require(_0x9c4d('0x7'));var config=require('../../config/environment');var attributes=require(_0x9c4d('0x8'));module[_0x9c4d('0x9')]=function(_0x192598,_0x232d46){return _0x192598['define'](_0x9c4d('0xa'),attributes,{'tableName':_0x9c4d('0xb'),'paranoid':![],'indexes':[{'name':_0x9c4d('0xc'),'fields':['body'],'type':_0x9c4d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33c4a2,_0x3133b0,_0x3efbf6){var _0x18188b=_0x192598[_0x9c4d('0xe')];var _0x1b4569=_0x33c4a2[_0x9c4d('0xf')]({'plain':!![]});if(_0x1b4569['direction'][_0x9c4d('0x10')]()==='in'||_0x1b4569['direction'][_0x9c4d('0x10')]()==='out'&&!_0x1b4569['secret']&&!_['isNil'](_0x1b4569['UserId'])){_0x18188b[_0x9c4d('0x11')]['findOne']({'where':{'id':_0x1b4569[_0x9c4d('0x12')]}})['then'](function(_0x3c4a5d){if(_0x3c4a5d){_0x3c4a5d[_0x9c4d('0x13')]({'lastMsgAt':_0x1b4569['createdAt'],'lastMsgDirection':_0x1b4569[_0x9c4d('0x14')][_0x9c4d('0x10')]()});}})[_0x9c4d('0x15')](function(_0x4c6783){console[_0x9c4d('0x16')](_0x4c6783);});}_0x3efbf6();}},'charset':_0x9c4d('0x17'),'collate':_0x9c4d('0x18')});}; \ No newline at end of file +var _0x3464=['out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3464,0xed));var _0x4346=function(_0x453550,_0x398ebd){_0x453550=_0x453550-0x0;var _0x16cea6=_0x3464[_0x453550];return _0x16cea6;};'use strict';var _=require(_0x4346('0x0'));var util=require(_0x4346('0x1'));var logger=require('../../config/logger')(_0x4346('0x2'));var moment=require(_0x4346('0x3'));var BPromise=require('bluebird');var rp=require(_0x4346('0x4'));var fs=require('fs');var path=require(_0x4346('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4346('0x6'));module[_0x4346('0x7')]=function(_0x178d93,_0x44aee2){return _0x178d93[_0x4346('0x8')]('FaxMessage',attributes,{'tableName':_0x4346('0x9'),'paranoid':![],'indexes':[{'name':_0x4346('0xa'),'fields':['body'],'type':_0x4346('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57fbb0,_0x1f6b23,_0x3ec35c){var _0x2cc3bc=_0x178d93['models'];var _0x80878=_0x57fbb0[_0x4346('0xc')]({'plain':!![]});if(_0x80878[_0x4346('0xd')][_0x4346('0xe')]()==='in'||_0x80878[_0x4346('0xd')][_0x4346('0xe')]()===_0x4346('0xf')&&!_0x80878[_0x4346('0x10')]&&!_[_0x4346('0x11')](_0x80878[_0x4346('0x12')])){_0x2cc3bc[_0x4346('0x13')][_0x4346('0x14')]({'where':{'id':_0x80878[_0x4346('0x15')]}})[_0x4346('0x16')](function(_0x46e5d3){if(_0x46e5d3){_0x46e5d3[_0x4346('0x17')]({'lastMsgAt':_0x80878['createdAt'],'lastMsgDirection':_0x80878['direction'][_0x4346('0xe')]()});}})[_0x4346('0x18')](function(_0x5de67d){console[_0x4346('0x19')](_0x5de67d);});}_0x3ec35c();}},'charset':_0x4346('0x1a'),'collate':_0x4346('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f8795d6..eb14432 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 _0xac9d=['then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x2068b9,_0x458ce8){var _0x1c8173=function(_0x83b817){while(--_0x83b817){_0x2068b9['push'](_0x2068b9['shift']());}};_0x1c8173(++_0x458ce8);}(_0xac9d,0x14d));var _0xdac9=function(_0x4f840d,_0x5d6218){_0x4f840d=_0x4f840d-0x0;var _0x315f81=_0xac9d[_0x4f840d];return _0x315f81;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});}exports['CreateFaxMessage']=function(_0x520369){var _0x4029fc=this;return new Promise(function(_0x20ece3,_0x2b9d91){return db[_0xdac9('0x1d')]['create'](_0x520369[_0xdac9('0x1e')],{'raw':_0x520369[_0xdac9('0x1f')]?_0x520369[_0xdac9('0x1f')][_0xdac9('0x20')]===undefined?!![]:![]:!![]})[_0xdac9('0x12')](function(_0x42317c){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x520369);logger[_0xdac9('0x15')](_0xdac9('0x21'),_0x520369,JSON['stringify'](_0x42317c));_0x20ece3(_0x42317c);})[_0xdac9('0x1c')](function(_0x11f4fd){logger[_0xdac9('0x18')](_0xdac9('0x21'),_0x11f4fd['message'],_0x520369);_0x2b9d91(_0x4029fc[_0xdac9('0x18')](0x1f4,_0x11f4fd['message']));});});};exports[_0xdac9('0x22')]=function(_0x2fce71){var _0x566d8c=this;return new Promise(function(_0x433be9,_0x5105f1){return db[_0xdac9('0x1d')][_0xdac9('0x23')](_0x2fce71[_0xdac9('0x1e')],{'raw':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')]['where']||null:null,'attributes':_0x2fce71['options']?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x24')]||null:null,'limit':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x25')]||null:null})[_0xdac9('0x12')](function(_0xed99f9){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x2fce71);logger[_0xdac9('0x15')](_0xdac9('0x22'),_0x2fce71,JSON[_0xdac9('0x26')](_0xed99f9));_0x433be9(_0xed99f9);})[_0xdac9('0x1c')](function(_0x336fd5){logger[_0xdac9('0x18')](_0xdac9('0x22'),_0x336fd5[_0xdac9('0x1a')],_0x2fce71);_0x5105f1(_0x566d8c[_0xdac9('0x18')](0x1f4,_0x336fd5[_0xdac9('0x1a')]));});});}; \ No newline at end of file +var _0xda55=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','update','where','limit','debug','UpdateFaxMessage','lodash','util'];(function(_0x117671,_0x55b297){var _0x5dc12d=function(_0x3ba977){while(--_0x3ba977){_0x117671['push'](_0x117671['shift']());}};_0x5dc12d(++_0x55b297);}(_0xda55,0x6d));var _0x5da5=function(_0x56c4b8,_0x17f78d){_0x56c4b8=_0x56c4b8-0x0;var _0x222836=_0xda55[_0x56c4b8];return _0x222836;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});config[_0x5da5('0x9')]=_[_0x5da5('0xa')](config[_0x5da5('0x9')],{'host':_0x5da5('0xb'),'port':0x18eb});var socket=require(_0x5da5('0xc'))(new Redis(config[_0x5da5('0x9')]));require(_0x5da5('0xd'))[_0x5da5('0xe')](socket);function respondWithRpcPromise(_0x5c056f,_0x3ed24c,_0x1f98a7){return new BPromise(function(_0x2731a3,_0x26fbe3){return client[_0x5da5('0xf')](_0x5c056f,_0x1f98a7)[_0x5da5('0x10')](function(_0x33313e){logger['info'](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));logger['debug'](_0x5da5('0x13'),_0x3ed24c,_0x5da5('0x12'),JSON[_0x5da5('0x14')](_0x33313e));if(_0x33313e[_0x5da5('0x15')]){if(_0x33313e[_0x5da5('0x15')][_0x5da5('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3ed24c,_0x33313e['error'][_0x5da5('0x17')]);return _0x26fbe3(_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);}logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);return _0x2731a3(_0x33313e['error'][_0x5da5('0x17')]);}else{logger[_0x5da5('0x18')](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));_0x2731a3(_0x33313e[_0x5da5('0x19')][_0x5da5('0x17')]);}})['catch'](function(_0x1920e2){logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x1920e2);_0x26fbe3(_0x1920e2);});});}exports[_0x5da5('0x1a')]=function(_0xf023af){var _0x513a34=this;return new Promise(function(_0x4393d7,_0x3372fc){return db[_0x5da5('0x1b')]['create'](_0xf023af[_0x5da5('0x1c')],{'raw':_0xf023af[_0x5da5('0x1d')]?_0xf023af[_0x5da5('0x1d')][_0x5da5('0x1e')]===undefined?!![]:![]:!![]})[_0x5da5('0x10')](function(_0x436960){logger['info'](_0x5da5('0x1a'),_0xf023af);logger['debug'](_0x5da5('0x1a'),_0xf023af,JSON[_0x5da5('0x14')](_0x436960));_0x4393d7(_0x436960);})[_0x5da5('0x1f')](function(_0x5d983c){logger[_0x5da5('0x15')](_0x5da5('0x1a'),_0x5d983c[_0x5da5('0x17')],_0xf023af);_0x3372fc(_0x513a34[_0x5da5('0x15')](0x1f4,_0x5d983c['message']));});});};exports['UpdateFaxMessage']=function(_0x50aadc){var _0x3526cf=this;return new Promise(function(_0x56d509,_0x4e8890){return db[_0x5da5('0x1b')][_0x5da5('0x20')](_0x50aadc['body'],{'raw':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x21')]||null:null,'attributes':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['attributes']||null:null,'limit':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x22')]||null:null})[_0x5da5('0x10')](function(_0x55e2bf){logger['info']('UpdateFaxMessage',_0x50aadc);logger[_0x5da5('0x23')](_0x5da5('0x24'),_0x50aadc,JSON[_0x5da5('0x14')](_0x55e2bf));_0x56d509(_0x55e2bf);})[_0x5da5('0x1f')](function(_0x51b712){logger['error'](_0x5da5('0x24'),_0x51b712['message'],_0x50aadc);_0x4e8890(_0x3526cf['error'](0x1f4,_0x51b712[_0x5da5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 0df0db8..c93507a 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 _0x1ac1=['./faxMessage.events','save','remove','emit','removeListener','register','length','faxMessage:'];(function(_0x49f2ac,_0x1bd259){var _0x490f9a=function(_0x159f8d){while(--_0x159f8d){_0x49f2ac['push'](_0x49f2ac['shift']());}};_0x490f9a(++_0x1bd259);}(_0x1ac1,0x118));var _0x11ac=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x1ac1[_0x58381c];return _0x1a7440;};'use strict';var FaxMessageEvents=require(_0x11ac('0x0'));var events=[_0x11ac('0x1'),_0x11ac('0x2'),'update'];function createListener(_0x4680e1,_0x2e4bcb){return function(_0x30e371){_0x2e4bcb[_0x11ac('0x3')](_0x4680e1,_0x30e371);};}function removeListener(_0x436156,_0x6a589e){return function(){FaxMessageEvents[_0x11ac('0x4')](_0x436156,_0x6a589e);};}exports[_0x11ac('0x5')]=function(_0x164e27){for(var _0x2c519a=0x0,_0x29c465=events[_0x11ac('0x6')];_0x2c519a<_0x29c465;_0x2c519a++){var _0x1ed679=events[_0x2c519a];var _0x117a49=createListener(_0x11ac('0x7')+_0x1ed679,_0x164e27);FaxMessageEvents['on'](_0x1ed679,_0x117a49);}}; \ No newline at end of file +var _0x5ccb=['save','remove','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x1621dd,_0x172229){var _0x3b0046=function(_0x53ab32){while(--_0x53ab32){_0x1621dd['push'](_0x1621dd['shift']());}};_0x3b0046(++_0x172229);}(_0x5ccb,0x1a6));var _0xb5cc=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0x5ccb[_0x1e5068];return _0x2230b6;};'use strict';var FaxMessageEvents=require(_0xb5cc('0x0'));var events=[_0xb5cc('0x1'),_0xb5cc('0x2'),_0xb5cc('0x3')];function createListener(_0x1f5a1f,_0x2c9a03){return function(_0x21796e){_0x2c9a03[_0xb5cc('0x4')](_0x1f5a1f,_0x21796e);};}function removeListener(_0x3c02af,_0x45d7e2){return function(){FaxMessageEvents[_0xb5cc('0x5')](_0x3c02af,_0x45d7e2);};}exports[_0xb5cc('0x6')]=function(_0x2a017f){for(var _0x5102a3=0x0,_0x384d63=events[_0xb5cc('0x7')];_0x5102a3<_0x384d63;_0x5102a3++){var _0x5170dd=events[_0x5102a3];var _0x19e066=createListener(_0xb5cc('0x8')+_0x5170dd,_0x2a017f);FaxMessageEvents['on'](_0x5170dd,_0x19e066);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 7710801..507afc9 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 _0xb821=['path','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','put','update','/:id/accept','reject','exports','util'];(function(_0x2cac01,_0x2e8b3d){var _0x2257b7=function(_0x4b386c){while(--_0x4b386c){_0x2cac01['push'](_0x2cac01['shift']());}};_0x2257b7(++_0x2e8b3d);}(_0xb821,0xa7));var _0x1b82=function(_0x4c48ec,_0x1b1db6){_0x4c48ec=_0x4c48ec-0x0;var _0x1415e6=_0xb821[_0x4c48ec];return _0x1415e6;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x6')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xc')]);router['get'](_0x1b82('0xd'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0xf')]('/',auth[_0x1b82('0x9')](),interaction[_0x1b82('0x10')](_0x1b82('0x11'),_0x1b82('0x12')),controller['create']);router[_0x1b82('0x13')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0x14')]);router['put'](_0x1b82('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0x1b82('0x13')]('/:id/reject',auth[_0x1b82('0x9')](),controller[_0x1b82('0x16')]);router['delete'](_0x1b82('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b82('0x17')]=router; \ No newline at end of file +var _0x6c76=['path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x6c76,0x184));var _0x66c7=function(_0x19acdb,_0x545136){_0x19acdb=_0x19acdb-0x0;var _0x1b4b4d=_0x6c76[_0x19acdb];return _0x1b4b4d;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./faxMessage.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0x7')](_0x66c7('0xc'),auth[_0x66c7('0x8')](),controller['download']);router[_0x66c7('0xd')]('/',auth[_0x66c7('0x8')](),interaction[_0x66c7('0xe')](_0x66c7('0xf'),_0x66c7('0x10')),controller[_0x66c7('0x11')]);router[_0x66c7('0x12')]('/:id',auth[_0x66c7('0x8')](),controller[_0x66c7('0x13')]);router[_0x66c7('0x12')](_0x66c7('0x14'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x15')]);router[_0x66c7('0x12')](_0x66c7('0x16'),auth[_0x66c7('0x8')](),controller['reject']);router[_0x66c7('0x17')]('/:id',auth[_0x66c7('0x8')](),controller[_0x66c7('0x18')]);module[_0x66c7('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index fec6f38..7ec67c6 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 _0xaa55=['rrmemory','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa55,0x9c));var _0x5aa5=function(_0x47094d,_0x1a9906){_0x47094d=_0x47094d-0x0;var _0x351450=_0xaa55[_0x47094d];return _0x351450;};'use strict';var Sequelize=require(_0x5aa5('0x0'));module[_0x5aa5('0x1')]={'name':{'type':Sequelize[_0x5aa5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5aa5('0x2')]},'timeout':{'type':Sequelize[_0x5aa5('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5aa5('0x4')](_0x5aa5('0x5'),'beepall',_0x5aa5('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5aa5('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x72e3=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','beepall'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x72e3,0x6a));var _0x372e=function(_0x53ecf2,_0x417dd2){_0x53ecf2=_0x53ecf2-0x0;var _0x1e087b=_0x72e3[_0x53ecf2];return _0x1e087b;};'use strict';var Sequelize=require(_0x372e('0x0'));module['exports']={'name':{'type':Sequelize[_0x372e('0x1')],'unique':_0x372e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x372e('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x372e('0x4')]('rrmemory',_0x372e('0x5'),_0x372e('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x372e('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 144f84e..26b95c6 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 _0x68b3=['FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','model','intersection','fields','attributes','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','User','UserId','agent','updatedAt','createdAt','%s/%s','SIP','faxPause','Team','filter','getTeams','length','ids','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','emit','userFaxQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','union','compact','isEmpty','addAgents','omit','spread','removeAgents','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index','map'];(function(_0x3058d5,_0x1b1a08){var _0x4f16f5=function(_0x3f8870){while(--_0x3f8870){_0x3058d5['push'](_0x3058d5['shift']());}};_0x4f16f5(++_0x1b1a08);}(_0x68b3,0x1d8));var _0x368b=function(_0x48a13e,_0x725b7d){_0x48a13e=_0x48a13e-0x0;var _0x5e620b=_0x68b3[_0x48a13e];return _0x5e620b;};'use strict';var BPromise=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var _=require(_0x368b('0x2'));var squel=require(_0x368b('0x3'));var Redis=require(_0x368b('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x368b('0x5'))(_0x368b('0x6'));var config=require(_0x368b('0x7'));var db=require(_0x368b('0x8'))['db'];config['redis']=_[_0x368b('0x9')](config[_0x368b('0xa')],{'host':_0x368b('0xb'),'port':0x18eb});var socket=require(_0x368b('0xc'))(new Redis(config[_0x368b('0xa')]));require(_0x368b('0xd'))[_0x368b('0xe')](socket);function respondWithStatusCode(_0x142d05,_0x23622f){_0x23622f=_0x23622f||0xcc;return function(_0x1f64d8){if(_0x1f64d8){return _0x142d05[_0x368b('0xf')](_0x23622f);}return _0x142d05['status'](_0x23622f)[_0x368b('0x10')]();};}function respondWithResult(_0xdbd344,_0x34a110){_0x34a110=_0x34a110||0xc8;return function(_0x51d513){if(_0x51d513){return _0xdbd344[_0x368b('0x11')](_0x34a110)[_0x368b('0x12')](_0x51d513);}};}function respondWithFilteredResult(_0x253e4b,_0x5924a6){return function(_0x41fbfd){if(_0x41fbfd){var _0x847dcb=typeof _0x5924a6['offset']===_0x368b('0x13')&&typeof _0x5924a6[_0x368b('0x14')]===_0x368b('0x13');var _0x4015fe=_0x41fbfd[_0x368b('0x15')];var _0x4fffe5=_0x847dcb?0x0:_0x5924a6[_0x368b('0x16')];var _0x40faa0=_0x847dcb?_0x41fbfd['count']:_0x5924a6[_0x368b('0x16')]+_0x5924a6[_0x368b('0x14')];var _0x30c245;if(_0x40faa0>=_0x4015fe){_0x40faa0=_0x4015fe;_0x30c245=0xc8;}else{_0x30c245=0xce;}_0x253e4b['status'](_0x30c245);return _0x253e4b[_0x368b('0x17')](_0x368b('0x18'),_0x4fffe5+'-'+_0x40faa0+'/'+_0x4015fe)[_0x368b('0x12')](_0x41fbfd);}return null;};}function saveUpdates(_0x4d6d9d){return function(_0x102407){if(_0x102407){return _0x102407[_0x368b('0x19')](_0x4d6d9d)[_0x368b('0x1a')](function(_0x540f57){return _0x540f57;});}return null;};}function removeEntity(_0x5d543e){return function(_0x3e2e9f){if(_0x3e2e9f){return _0x3e2e9f[_0x368b('0x1b')]()[_0x368b('0x1a')](function(){var _0x1e632a=_0x3e2e9f[_0x368b('0x1c')]({'plain':!![]});var _0x4b8fb7=_0x368b('0x1d');return db[_0x368b('0x1e')][_0x368b('0x1b')]({'where':{'type':_0x4b8fb7,'resourceId':_0x1e632a['id']}})[_0x368b('0x1a')](function(){return _0x3e2e9f;});})[_0x368b('0x1a')](function(){_0x5d543e[_0x368b('0x11')](0xcc)[_0x368b('0x10')]();});}};}function handleEntityNotFound(_0x1d8066){return function(_0x508e48){if(!_0x508e48){_0x1d8066[_0x368b('0xf')](0x194);}return _0x508e48;};}function handleError(_0x2f08d9,_0x18869a){_0x18869a=_0x18869a||0x1f4;return function(_0xc0f7af){logger[_0x368b('0x1f')](_0xc0f7af['stack']);if(_0xc0f7af[_0x368b('0x20')]){delete _0xc0f7af[_0x368b('0x20')];}_0x2f08d9[_0x368b('0x11')](_0x18869a)[_0x368b('0x21')](_0xc0f7af);};}exports[_0x368b('0x22')]=function(_0x85515f,_0x430e16){var _0x11ea2d={};var _0x3123c1={'count':0x0,'rows':[]};var _0x3f7f89=_[_0x368b('0x23')](db[_0x368b('0x24')][_0x368b('0x25')],function(_0x376e61){return{'name':_0x376e61[_0x368b('0x26')],'type':_0x376e61[_0x368b('0x27')][_0x368b('0x28')]};});_0x11ea2d=qs[_0x368b('0x29')](_0x3f7f89,_0x85515f);var _0x39ef94={'where':_0x11ea2d[_0x368b('0x2a')]};return db[_0x368b('0x24')][_0x368b('0x15')](_0x39ef94)[_0x368b('0x1a')](function(_0x3c80b5){_0x3123c1['count']=_0x3c80b5;_0x11ea2d['include']=qs[_0x368b('0x2b')](_0x85515f[_0x368b('0x2c')]);return db[_0x368b('0x24')][_0x368b('0x2d')](_0x11ea2d);})['then'](function(_0x12ae59){_0x3123c1[_0x368b('0x2e')]=_0x12ae59;return _0x3123c1;})[_0x368b('0x1a')](respondWithFilteredResult(_0x430e16,_0x11ea2d))[_0x368b('0x2f')](handleError(_0x430e16,null));};exports[_0x368b('0x30')]=function(_0x4d8410,_0x22ada9){var _0x424fab={'raw':!![],'where':{'id':_0x4d8410[_0x368b('0x31')]['id']}},_0x239536={};_0x239536['model']=_['keys'](db['FaxQueue'][_0x368b('0x25')]);_0x239536[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x4d8410[_0x368b('0x2c')]);_0x239536[_0x368b('0x33')]=_['intersection'](_0x239536[_0x368b('0x34')],_0x239536[_0x368b('0x2c')]);_0x424fab['attributes']=_[_0x368b('0x35')](_0x239536[_0x368b('0x34')],qs['fields'](_0x4d8410[_0x368b('0x2c')][_0x368b('0x36')]));_0x424fab['attributes']=_0x424fab[_0x368b('0x37')]['length']?_0x424fab['attributes']:_0x239536['model'];if(_0x4d8410[_0x368b('0x2c')][_0x368b('0x38')]){_0x424fab[_0x368b('0x2b')]=[{'all':!![]}];}_0x424fab=_[_0x368b('0x39')]({},_0x424fab,_0x4d8410[_0x368b('0x3a')]);return db[_0x368b('0x24')][_0x368b('0x3b')](_0x424fab)[_0x368b('0x1a')](handleEntityNotFound(_0x22ada9,null))[_0x368b('0x1a')](respondWithResult(_0x22ada9,null))[_0x368b('0x2f')](handleError(_0x22ada9,null));};exports['create']=function(_0x204c52,_0x1f60ea){return db['FaxQueue'][_0x368b('0x3c')](_0x204c52[_0x368b('0x3d')],{})[_0x368b('0x1a')](function(_0x231d84){var _0x248b2b=_0x204c52['user'][_0x368b('0x1c')]({'plain':!![]});if(!_0x248b2b)throw new Error(_0x368b('0x3e'));if(_0x248b2b[_0x368b('0x3f')]===_0x368b('0x40')){var _0x4e44d0=_0x231d84['get']({'plain':!![]});var _0x7ba60d=_0x368b('0x1d');return db[_0x368b('0x41')][_0x368b('0x3b')]({'where':{'name':_0x7ba60d,'userProfileId':_0x248b2b[_0x368b('0x42')]},'raw':!![]})[_0x368b('0x1a')](function(_0x1d990c){if(_0x1d990c&&_0x1d990c[_0x368b('0x43')]===0x0){return db[_0x368b('0x1e')][_0x368b('0x3c')]({'name':_0x4e44d0['name'],'resourceId':_0x4e44d0['id'],'type':_0x1d990c[_0x368b('0x20')],'sectionId':_0x1d990c['id']},{})[_0x368b('0x1a')](function(){return _0x231d84;});}else{return _0x231d84;}})['catch'](function(_0x25e713){logger[_0x368b('0x1f')](_0x368b('0x44'),_0x25e713);throw _0x25e713;});}return _0x231d84;})[_0x368b('0x1a')](respondWithResult(_0x1f60ea,0xc9))['catch'](handleError(_0x1f60ea,null));};exports[_0x368b('0x19')]=function(_0x151711,_0x4a0275){if(_0x151711[_0x368b('0x3d')]['id']){delete _0x151711[_0x368b('0x3d')]['id'];}return db[_0x368b('0x24')]['find']({'where':{'id':_0x151711[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x4a0275,null))[_0x368b('0x1a')](saveUpdates(_0x151711['body'],null))['then'](respondWithResult(_0x4a0275,null))[_0x368b('0x2f')](handleError(_0x4a0275,null));};exports[_0x368b('0x1b')]=function(_0x568ee5,_0x2bb15a){return db[_0x368b('0x24')][_0x368b('0x3b')]({'where':{'id':_0x568ee5[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x2bb15a,null))[_0x368b('0x1a')](removeEntity(_0x2bb15a,null))[_0x368b('0x2f')](handleError(_0x2bb15a,null));};exports[_0x368b('0x45')]=function(_0x5db559,_0x33914c){return db[_0x368b('0x24')][_0x368b('0x45')]()[_0x368b('0x1a')](respondWithResult(_0x33914c,null))['catch'](handleError(_0x33914c,null));};exports[_0x368b('0x46')]=function(_0x1fff8e,_0xe79f4c){var _0xf95817={'raw':!![],'where':{}},_0x2d59fe={},_0x5a827e;return db['FaxQueue'][_0x368b('0x47')]({'where':{'id':_0x1fff8e[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0xe79f4c,null))['then'](function(_0x378510){if(_0x378510){_0x5a827e=_0x378510[_0x368b('0x1c')]({'plain':!![]});_0x2d59fe[_0x368b('0x34')]=_[_0x368b('0x32')](db[_0x368b('0x48')][_0x368b('0x25')]);_0x2d59fe[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x1fff8e[_0x368b('0x2c')]);_0x2d59fe[_0x368b('0x33')]=_['intersection'](_0x2d59fe[_0x368b('0x34')],_0x2d59fe['query']);_0xf95817[_0x368b('0x37')]=_['intersection'](_0x2d59fe[_0x368b('0x34')],qs['fields'](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x36')]));_0xf95817[_0x368b('0x37')]=_0xf95817[_0x368b('0x37')]['length']?_0xf95817[_0x368b('0x37')]:_0x2d59fe[_0x368b('0x34')];if(!_0x1fff8e[_0x368b('0x2c')][_0x368b('0x49')](_0x368b('0x4a'))){_0xf95817[_0x368b('0x14')]=qs[_0x368b('0x14')](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x14')]);_0xf95817['offset']=qs[_0x368b('0x16')](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x16')]);}_0xf95817[_0x368b('0x4b')]=qs[_0x368b('0x4c')](_0x1fff8e['query'][_0x368b('0x4c')]);_0xf95817[_0x368b('0x2a')]=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x1fff8e[_0x368b('0x2c')],_0x2d59fe[_0x368b('0x33')]));_0xf95817[_0x368b('0x2a')]['FaxQueueId']=_0x378510['id'];if(_0x1fff8e['query']['filter']){_0xf95817['where']=_[_0x368b('0x39')](_0xf95817['where'],{'$or':_[_0x368b('0x23')](_0xf95817[_0x368b('0x37')],function(_0x509dd4){var _0x5711ee={};_0x5711ee[_0x509dd4]={'$like':'%'+_0x1fff8e[_0x368b('0x2c')]['filter']+'%'};return _0x5711ee;})});}_0xf95817=_[_0x368b('0x39')]({},_0xf95817,_0x1fff8e[_0x368b('0x3a')]);return db['UserFaxQueue'][_0x368b('0x2d')](_0xf95817);}})[_0x368b('0x1a')](function(_0x58eb4a){if(_0x58eb4a){return db[_0x368b('0x4e')]['findAndCountAll']({'where':{'id':_[_0x368b('0x23')](_0x58eb4a,_0x368b('0x4f')),'role':_0x368b('0x50')},'attributes':['id',_0x368b('0x20'),'faxPause',_0x368b('0x51'),_0x368b('0x52')]});}})[_0x368b('0x1a')](function(_0x14974e){if(_0x14974e){return{'count':_0x14974e['count'],'rows':_[_0x368b('0x23')](_0x14974e['rows'],function(_0xa320cc){return{'membername':_0xa320cc[_0x368b('0x20')],'UserId':_0xa320cc['id'],'queue_name':_0x5a827e['name'],'FaxQueueId':_0x5a827e['id'],'interface':util['format'](_0x368b('0x53'),_0x368b('0x54'),_0xa320cc[_0x368b('0x20')]),'penalty':0x0,'paused':_0xa320cc[_0x368b('0x55')],'createdAt':_0xa320cc[_0x368b('0x52')],'updatedAt':_0xa320cc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x368b('0x1a')](respondWithFilteredResult(_0xe79f4c,_0xf95817))[_0x368b('0x2f')](handleError(_0xe79f4c,null));};exports['getTeams']=function(_0x2e5827,_0x19d5cc){var _0x472507={};var _0x302b06={};var _0x5ef40c;var _0x3d66fe;return db[_0x368b('0x24')][_0x368b('0x47')]({'where':{'id':_0x2e5827[_0x368b('0x31')]['id']}})['then'](handleEntityNotFound(_0x19d5cc,null))['then'](function(_0x5c8438){if(_0x5c8438){_0x5ef40c=_0x5c8438;_0x302b06['model']=_[_0x368b('0x32')](db[_0x368b('0x56')]['rawAttributes']);_0x302b06['query']=_['keys'](_0x2e5827['query']);_0x302b06['filters']=_[_0x368b('0x35')](_0x302b06[_0x368b('0x34')],_0x302b06[_0x368b('0x2c')]);_0x472507['attributes']=_[_0x368b('0x35')](_0x302b06['model'],qs['fields'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x36')]));_0x472507[_0x368b('0x37')]=_0x472507[_0x368b('0x37')]['length']?_0x472507[_0x368b('0x37')]:_0x302b06[_0x368b('0x34')];_0x472507[_0x368b('0x4b')]=qs['sort'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x4c')]);_0x472507['where']=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x2e5827['query'],_0x302b06[_0x368b('0x33')]));if(_0x2e5827['query'][_0x368b('0x57')]){_0x472507[_0x368b('0x2a')]=_['merge'](_0x472507[_0x368b('0x2a')],{'$or':_[_0x368b('0x23')](_0x472507[_0x368b('0x37')],function(_0x46d394){var _0x281023={};_0x281023[_0x46d394]={'$like':'%'+_0x2e5827['query'][_0x368b('0x57')]+'%'};return _0x281023;})});}_0x472507=_[_0x368b('0x39')]({},_0x472507,_0x2e5827[_0x368b('0x3a')]);return _0x5ef40c[_0x368b('0x58')](_0x472507);}})[_0x368b('0x1a')](function(_0x1c9cce){if(_0x1c9cce){_0x3d66fe=_0x1c9cce[_0x368b('0x59')];if(!_0x2e5827[_0x368b('0x2c')]['hasOwnProperty'](_0x368b('0x4a'))){_0x472507[_0x368b('0x14')]=qs['limit'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x14')]);_0x472507[_0x368b('0x16')]=qs['offset'](_0x2e5827['query'][_0x368b('0x16')]);}return _0x5ef40c[_0x368b('0x58')](_0x472507);}})[_0x368b('0x1a')](function(_0xb7cef7){if(_0xb7cef7){return _0xb7cef7?{'count':_0x3d66fe,'rows':_0xb7cef7}:null;}})['then'](respondWithResult(_0x19d5cc,null))[_0x368b('0x2f')](handleError(_0x19d5cc,null));};exports['addTeams']=function(_0x19d3b4,_0x2af914){var _0x3eb462=_0x19d3b4['body'][_0x368b('0x5a')];return db[_0x368b('0x56')][_0x368b('0x2d')]({'where':{'id':_0x3eb462},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x368b('0x5b'),_0x368b('0x5c'),_0x368b('0x5d')],'raw':!![]}]})[_0x368b('0x1a')](function(_0x321112){if(_0x321112){var _0x5c338d=_[_0x368b('0x5e')](_0x321112,function(_0x3abf65){var _0x49e2fc=_0x3abf65[_0x368b('0x1c')]({'plain':!![]});return _0x49e2fc['Agents'];});return db['FaxQueue'][_0x368b('0x3b')]({'where':{'id':_0x19d3b4[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](function(_0x21bfb3){return db[_0x368b('0x5f')][_0x368b('0x60')](function(_0x4921b0){return _0x21bfb3[_0x368b('0x61')](_0x3eb462,{'transaction':_0x4921b0})[_0x368b('0x1a')](function(){return BPromise[_0x368b('0x62')](_0x5c338d,function(_0x5d4179){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x5d4179['id'],'FaxQueueId':_0x19d3b4['params']['id']},'transaction':_0x4921b0});});})[_0x368b('0x1a')](function(){_0x5c338d['forEach'](function(_0x5ab241){socket[_0x368b('0x63')](_0x368b('0x64'),{'UserId':_0x5ab241['id'],'FaxQueueId':_0x21bfb3['id']});});});});});}})[_0x368b('0x1a')](respondWithStatusCode(_0x2af914,null))[_0x368b('0x2f')](handleError(_0x2af914,null));};exports[_0x368b('0x65')]=function(_0xbfdde2,_0x67794e){return db[_0x368b('0x56')]['findAll']({'where':{'id':_0xbfdde2[_0x368b('0x2c')][_0x368b('0x5a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x368b('0x66'),'attributes':['id'],'raw':!![]}]})[_0x368b('0x1a')](handleEntityNotFound(_0x67794e,null))[_0x368b('0x1a')](function(_0xb49743){var _0x152962=_[_0x368b('0x23')](_0xb49743,'id');var _0x1ac79c=[];var _0x41e848=[];var _0x26013b=squel[_0x368b('0x67')]();_0x26013b[_0x368b('0x68')](_0x368b('0x69'))[_0x368b('0x6a')](_0x368b('0x6b'),'tq')['join']('user_has_teams','ut',_0x368b('0x6c'))[_0x368b('0x2a')](_0x368b('0x6d'),_0xbfdde2['params']['id']);for(var _0x208cbb=0x0;_0x208cbb<_0xb49743[_0x368b('0x59')];_0x208cbb+=0x1){let _0x2350b5=_0xb49743[_0x208cbb];for(var _0x480af7=0x0;_0x480af7<_0x2350b5[_0x368b('0x66')][_0x368b('0x59')];_0x480af7+=0x1){let _0x5053b3=_0x2350b5[_0x368b('0x66')][_0x480af7];var _0x318be2=_0x26013b[_0x368b('0x6e')]();_0x318be2['where']('ut.UserId\x20=\x20?',_0x5053b3['id']);_0x41e848[_0x368b('0x6f')](db['sequelize'][_0x368b('0x2c')](_0x318be2[_0x368b('0x70')](),{'type':db[_0x368b('0x5f')][_0x368b('0x71')]['SELECT']})[_0x368b('0x1a')](function(_0x1a35c9){if(_0x1a35c9[_0x368b('0x59')]===0x1){return _0x5053b3['id'];}else{var _0x54c95a=_[_0x368b('0x72')](_[_0x368b('0x23')](_0x1a35c9,_0x368b('0x73')),function(_0x252bbd){return _['includes'](_0x152962,_0x252bbd);});if(_0x54c95a){return _0x5053b3['id'];}}}));}}return BPromise[_0x368b('0x74')](_0x41e848)['then'](function(_0x1740a6){_0x1ac79c=_(_0x1ac79c)[_0x368b('0x75')](_0x1740a6)[_0x368b('0x76')]()['value']();return db['FaxQueue']['find']({'where':{'id':_0xbfdde2['params']['id']}})[_0x368b('0x1a')](function(_0x3146a9){return db['sequelize']['transaction'](function(_0x1bde0a){return _0x3146a9['removeTeams'](_0xbfdde2[_0x368b('0x2c')][_0x368b('0x5a')],{'transaction':_0x1bde0a})['then'](function(){if(!_[_0x368b('0x77')](_0x1ac79c)){return _0x3146a9['removeAgents'](_0x1ac79c,{'transaction':_0x1bde0a});}})[_0x368b('0x1a')](function(){_0x1ac79c['forEach'](function(_0x1dd4a7){socket[_0x368b('0x63')]('userFaxQueue:remove',{'UserId':_0x1dd4a7,'FaxQueueId':_0x3146a9['id']});});});});});});})[_0x368b('0x1a')](respondWithStatusCode(_0x67794e,null))['catch'](handleError(_0x67794e,null));};exports[_0x368b('0x78')]=function(_0x2798e1,_0x51c695){return db['FaxQueue'][_0x368b('0x3b')]({'where':{'id':_0x2798e1['params']['id']}})['then'](handleEntityNotFound(_0x51c695,null))[_0x368b('0x1a')](function(_0x54c442){if(_0x54c442){return _0x54c442['addAgents'](_0x2798e1['body']['ids'],_[_0x368b('0x79')](_0x2798e1['body'],[_0x368b('0x5a'),'id'])||{})[_0x368b('0x7a')](function(_0x4861d9){for(var _0x302d6d=0x0;_0x302d6d<_0x2798e1[_0x368b('0x3d')]['ids'][_0x368b('0x59')];_0x302d6d+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x2798e1[_0x368b('0x3d')][_0x368b('0x5a')][_0x302d6d]),'FaxQueueId':Number(_0x2798e1['params']['id'])});}return _0x4861d9;});}})[_0x368b('0x1a')](respondWithResult(_0x51c695,null))['catch'](handleError(_0x51c695,null));};exports['removeAgents']=function(_0x379dc9,_0x4d7151){return db[_0x368b('0x24')]['find']({'where':{'id':_0x379dc9['params']['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x4d7151,null))['then'](function(_0x30235b){if(_0x30235b){return _0x30235b[_0x368b('0x7b')](_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')])[_0x368b('0x1a')](function(){if(_[_0x368b('0x7c')](_0x379dc9['query'][_0x368b('0x5a')])){for(var _0x11ed4b=0x0;_0x11ed4b<_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')][_0x368b('0x59')];_0x11ed4b+=0x1){socket['emit'](_0x368b('0x7d'),{'UserId':Number(_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')][_0x11ed4b]),'FaxQueueId':Number(_0x379dc9[_0x368b('0x31')]['id'])});}}else{socket[_0x368b('0x63')](_0x368b('0x7d'),{'UserId':Number(_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')]),'FaxQueueId':Number(_0x379dc9[_0x368b('0x31')]['id'])});}});}})[_0x368b('0x1a')](respondWithStatusCode(_0x4d7151,null))[_0x368b('0x2f')](handleError(_0x4d7151,null));};exports[_0x368b('0x7e')]=function(_0x14f666,_0x509092){var _0x4136e6={};var _0x42d423={};var _0x142868;var _0x179c33;return db[_0x368b('0x24')][_0x368b('0x47')]({'where':{'id':_0x14f666[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x509092,null))[_0x368b('0x1a')](function(_0x30e6c3){if(_0x30e6c3){_0x142868=_0x30e6c3;_0x42d423[_0x368b('0x34')]=_[_0x368b('0x32')](db[_0x368b('0x4e')]['rawAttributes']);_0x42d423[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x14f666['query']);_0x42d423['filters']=_['intersection'](_0x42d423[_0x368b('0x34')],_0x42d423['query']);_0x4136e6['attributes']=_[_0x368b('0x35')](_0x42d423[_0x368b('0x34')],qs[_0x368b('0x36')](_0x14f666[_0x368b('0x2c')]['fields']));_0x4136e6[_0x368b('0x37')]=_0x4136e6[_0x368b('0x37')][_0x368b('0x59')]?_0x4136e6[_0x368b('0x37')]:_0x42d423[_0x368b('0x34')];_0x4136e6[_0x368b('0x4b')]=qs['sort'](_0x14f666[_0x368b('0x2c')][_0x368b('0x4c')]);_0x4136e6[_0x368b('0x2a')]=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x14f666['query'],_0x42d423[_0x368b('0x33')]));if(_0x14f666['query'][_0x368b('0x57')]){_0x4136e6['where']=_[_0x368b('0x39')](_0x4136e6['where'],{'$or':_[_0x368b('0x23')](_0x4136e6['attributes'],function(_0x381226){var _0x145cf5={};_0x145cf5[_0x381226]={'$like':'%'+_0x14f666['query'][_0x368b('0x57')]+'%'};return _0x145cf5;})});}_0x4136e6=_[_0x368b('0x39')]({},_0x4136e6,_0x14f666[_0x368b('0x3a')]);return _0x142868[_0x368b('0x7e')](_0x4136e6);}})[_0x368b('0x1a')](function(_0x3273ae){if(_0x3273ae){_0x179c33=_0x3273ae[_0x368b('0x59')];if(!_0x14f666[_0x368b('0x2c')][_0x368b('0x49')](_0x368b('0x4a'))){_0x4136e6[_0x368b('0x14')]=qs[_0x368b('0x14')](_0x14f666[_0x368b('0x2c')]['limit']);_0x4136e6[_0x368b('0x16')]=qs['offset'](_0x14f666[_0x368b('0x2c')]['offset']);}return _0x142868[_0x368b('0x7e')](_0x4136e6);}})[_0x368b('0x1a')](function(_0x37ecf7){if(_0x37ecf7){return _0x37ecf7?{'count':_0x179c33,'rows':_0x37ecf7}:null;}})['then'](respondWithResult(_0x509092,null))[_0x368b('0x2f')](handleError(_0x509092,null));}; \ No newline at end of file +var _0xed1c=['userFaxQueue:remove','getAgents','bluebird','util','../../config/logger','api','../../config/environment','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','json','undefined','limit','offset','count','Content-Range','update','then','destroy','get','FaxQueues','end','error','stack','name','send','map','FaxQueue','fieldName','type','key','getOptions','where','include','findAll','show','params','model','keys','rawAttributes','query','intersection','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','catch','describe','findOne','UserFaxQueue','filters','fields','hasOwnProperty','nolimit','order','sort','filter','User','findAndCountAll','UserId','agent','createdAt','rows','%s/%s','SIP','faxPause','updatedAt','Team','pick','getTeams','online','flatMap','Agents','sequelize','transaction','addTeams','forEach','emit','userFaxQueue:save','ids','select','field','from','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','includes','all','union','value','removeTeams','removeAgents','addAgents','omit','spread','isArray'];(function(_0x55c2a5,_0x3ab35b){var _0x177d1d=function(_0x130a2b){while(--_0x130a2b){_0x55c2a5['push'](_0x55c2a5['shift']());}};_0x177d1d(++_0x3ab35b);}(_0xed1c,0xe4));var _0xced1=function(_0x3afbca,_0x4a8622){_0x3afbca=_0x3afbca-0x0;var _0x48ffe2=_0xed1c[_0x3afbca];return _0x48ffe2;};'use strict';var BPromise=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xced1('0x2'))(_0xced1('0x3'));var config=require(_0xced1('0x4'));var db=require('../../mysqldb')['db'];config[_0xced1('0x5')]=_[_0xced1('0x6')](config[_0xced1('0x5')],{'host':_0xced1('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xced1('0x5')]));require(_0xced1('0x8'))[_0xced1('0x9')](socket);function respondWithStatusCode(_0x1fb40b,_0x354203){_0x354203=_0x354203||0xcc;return function(_0x3221b6){if(_0x3221b6){return _0x1fb40b[_0xced1('0xa')](_0x354203);}return _0x1fb40b[_0xced1('0xb')](_0x354203)['end']();};}function respondWithResult(_0x82c84e,_0x59c820){_0x59c820=_0x59c820||0xc8;return function(_0x3464f3){if(_0x3464f3){return _0x82c84e[_0xced1('0xb')](_0x59c820)[_0xced1('0xc')](_0x3464f3);}};}function respondWithFilteredResult(_0x18c028,_0x15f678){return function(_0x44b05c){if(_0x44b05c){var _0x3779d3=typeof _0x15f678['offset']===_0xced1('0xd')&&typeof _0x15f678[_0xced1('0xe')]===_0xced1('0xd');var _0x52d96a=_0x44b05c['count'];var _0xdaaea7=_0x3779d3?0x0:_0x15f678[_0xced1('0xf')];var _0x54cba9=_0x3779d3?_0x44b05c[_0xced1('0x10')]:_0x15f678[_0xced1('0xf')]+_0x15f678[_0xced1('0xe')];var _0x32100b;if(_0x54cba9>=_0x52d96a){_0x54cba9=_0x52d96a;_0x32100b=0xc8;}else{_0x32100b=0xce;}_0x18c028['status'](_0x32100b);return _0x18c028['set'](_0xced1('0x11'),_0xdaaea7+'-'+_0x54cba9+'/'+_0x52d96a)[_0xced1('0xc')](_0x44b05c);}return null;};}function saveUpdates(_0x236473){return function(_0x17e8ab){if(_0x17e8ab){return _0x17e8ab[_0xced1('0x12')](_0x236473)[_0xced1('0x13')](function(_0x5a563a){return _0x5a563a;});}return null;};}function removeEntity(_0x56fc50){return function(_0x2a92c8){if(_0x2a92c8){return _0x2a92c8[_0xced1('0x14')]()[_0xced1('0x13')](function(){var _0x5257e7=_0x2a92c8[_0xced1('0x15')]({'plain':!![]});var _0x25f0df=_0xced1('0x16');return db['UserProfileResource'][_0xced1('0x14')]({'where':{'type':_0x25f0df,'resourceId':_0x5257e7['id']}})[_0xced1('0x13')](function(){return _0x2a92c8;});})[_0xced1('0x13')](function(){_0x56fc50['status'](0xcc)[_0xced1('0x17')]();});}};}function handleEntityNotFound(_0x624349){return function(_0xc1bd39){if(!_0xc1bd39){_0x624349['sendStatus'](0x194);}return _0xc1bd39;};}function handleError(_0x4dab56,_0x1d3884){_0x1d3884=_0x1d3884||0x1f4;return function(_0x41ee91){logger[_0xced1('0x18')](_0x41ee91[_0xced1('0x19')]);if(_0x41ee91[_0xced1('0x1a')]){delete _0x41ee91['name'];}_0x4dab56[_0xced1('0xb')](_0x1d3884)[_0xced1('0x1b')](_0x41ee91);};}exports['index']=function(_0x5f2018,_0x38f738){var _0x258c9a={};var _0x3af9c0={'count':0x0,'rows':[]};var _0x3912fe=_[_0xced1('0x1c')](db[_0xced1('0x1d')]['rawAttributes'],function(_0x181f6e){return{'name':_0x181f6e[_0xced1('0x1e')],'type':_0x181f6e[_0xced1('0x1f')][_0xced1('0x20')]};});_0x258c9a=qs[_0xced1('0x21')](_0x3912fe,_0x5f2018);var _0x8b3ffb={'where':_0x258c9a[_0xced1('0x22')]};return db['FaxQueue'][_0xced1('0x10')](_0x8b3ffb)['then'](function(_0x45cb03){_0x3af9c0[_0xced1('0x10')]=_0x45cb03;_0x258c9a[_0xced1('0x23')]=qs[_0xced1('0x23')](_0x5f2018['query']);return db['FaxQueue'][_0xced1('0x24')](_0x258c9a);})[_0xced1('0x13')](function(_0x2bc785){_0x3af9c0['rows']=_0x2bc785;return _0x3af9c0;})['then'](respondWithFilteredResult(_0x38f738,_0x258c9a))['catch'](handleError(_0x38f738,null));};exports[_0xced1('0x25')]=function(_0x138079,_0x2a6197){var _0x3d4a17={'raw':!![],'where':{'id':_0x138079[_0xced1('0x26')]['id']}},_0x5bb1a8={};_0x5bb1a8[_0xced1('0x27')]=_[_0xced1('0x28')](db[_0xced1('0x1d')][_0xced1('0x29')]);_0x5bb1a8[_0xced1('0x2a')]=_[_0xced1('0x28')](_0x138079['query']);_0x5bb1a8['filters']=_[_0xced1('0x2b')](_0x5bb1a8[_0xced1('0x27')],_0x5bb1a8[_0xced1('0x2a')]);_0x3d4a17[_0xced1('0x2c')]=_[_0xced1('0x2b')](_0x5bb1a8[_0xced1('0x27')],qs['fields'](_0x138079['query']['fields']));_0x3d4a17['attributes']=_0x3d4a17[_0xced1('0x2c')][_0xced1('0x2d')]?_0x3d4a17[_0xced1('0x2c')]:_0x5bb1a8[_0xced1('0x27')];if(_0x138079[_0xced1('0x2a')][_0xced1('0x2e')]){_0x3d4a17[_0xced1('0x23')]=[{'all':!![]}];}_0x3d4a17=_[_0xced1('0x2f')]({},_0x3d4a17,_0x138079[_0xced1('0x30')]);return db[_0xced1('0x1d')][_0xced1('0x31')](_0x3d4a17)[_0xced1('0x13')](handleEntityNotFound(_0x2a6197,null))[_0xced1('0x13')](respondWithResult(_0x2a6197,null))['catch'](handleError(_0x2a6197,null));};exports[_0xced1('0x32')]=function(_0x23db06,_0x1116de){return db[_0xced1('0x1d')][_0xced1('0x32')](_0x23db06[_0xced1('0x33')],{})['then'](function(_0xc7afa1){var _0x3f3632=_0x23db06[_0xced1('0x34')][_0xced1('0x15')]({'plain':!![]});if(!_0x3f3632)throw new Error(_0xced1('0x35'));if(_0x3f3632[_0xced1('0x36')]===_0xced1('0x34')){var _0x31f639=_0xc7afa1[_0xced1('0x15')]({'plain':!![]});var _0x359a10=_0xced1('0x16');return db['UserProfileSection']['find']({'where':{'name':_0x359a10,'userProfileId':_0x3f3632[_0xced1('0x37')]},'raw':!![]})[_0xced1('0x13')](function(_0x1887a3){if(_0x1887a3&&_0x1887a3['autoAssociation']===0x0){return db[_0xced1('0x38')][_0xced1('0x32')]({'name':_0x31f639[_0xced1('0x1a')],'resourceId':_0x31f639['id'],'type':_0x1887a3['name'],'sectionId':_0x1887a3['id']},{})[_0xced1('0x13')](function(){return _0xc7afa1;});}else{return _0xc7afa1;}})[_0xced1('0x39')](function(_0x5a01f6){logger[_0xced1('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a01f6);throw _0x5a01f6;});}return _0xc7afa1;})[_0xced1('0x13')](respondWithResult(_0x1116de,0xc9))[_0xced1('0x39')](handleError(_0x1116de,null));};exports['update']=function(_0x1ddaea,_0x172a7e){if(_0x1ddaea[_0xced1('0x33')]['id']){delete _0x1ddaea['body']['id'];}return db[_0xced1('0x1d')][_0xced1('0x31')]({'where':{'id':_0x1ddaea['params']['id']}})[_0xced1('0x13')](handleEntityNotFound(_0x172a7e,null))['then'](saveUpdates(_0x1ddaea['body'],null))[_0xced1('0x13')](respondWithResult(_0x172a7e,null))['catch'](handleError(_0x172a7e,null));};exports[_0xced1('0x14')]=function(_0x217399,_0xb344a2){return db['FaxQueue'][_0xced1('0x31')]({'where':{'id':_0x217399['params']['id']}})[_0xced1('0x13')](handleEntityNotFound(_0xb344a2,null))[_0xced1('0x13')](removeEntity(_0xb344a2,null))[_0xced1('0x39')](handleError(_0xb344a2,null));};exports[_0xced1('0x3a')]=function(_0x5e20a5,_0x19906c){return db[_0xced1('0x1d')]['describe']()[_0xced1('0x13')](respondWithResult(_0x19906c,null))[_0xced1('0x39')](handleError(_0x19906c,null));};exports['getMembers']=function(_0x1800c8,_0x310122){var _0x1646df={'raw':!![],'where':{}},_0x59f1ba={},_0xc04f2;return db[_0xced1('0x1d')][_0xced1('0x3b')]({'where':{'id':_0x1800c8[_0xced1('0x26')]['id']}})[_0xced1('0x13')](handleEntityNotFound(_0x310122,null))['then'](function(_0x1482cc){if(_0x1482cc){_0xc04f2=_0x1482cc['get']({'plain':!![]});_0x59f1ba[_0xced1('0x27')]=_[_0xced1('0x28')](db[_0xced1('0x3c')][_0xced1('0x29')]);_0x59f1ba[_0xced1('0x2a')]=_[_0xced1('0x28')](_0x1800c8['query']);_0x59f1ba[_0xced1('0x3d')]=_[_0xced1('0x2b')](_0x59f1ba['model'],_0x59f1ba[_0xced1('0x2a')]);_0x1646df['attributes']=_['intersection'](_0x59f1ba[_0xced1('0x27')],qs[_0xced1('0x3e')](_0x1800c8[_0xced1('0x2a')][_0xced1('0x3e')]));_0x1646df['attributes']=_0x1646df[_0xced1('0x2c')][_0xced1('0x2d')]?_0x1646df[_0xced1('0x2c')]:_0x59f1ba['model'];if(!_0x1800c8['query'][_0xced1('0x3f')](_0xced1('0x40'))){_0x1646df[_0xced1('0xe')]=qs[_0xced1('0xe')](_0x1800c8['query']['limit']);_0x1646df['offset']=qs[_0xced1('0xf')](_0x1800c8[_0xced1('0x2a')][_0xced1('0xf')]);}_0x1646df[_0xced1('0x41')]=qs[_0xced1('0x42')](_0x1800c8[_0xced1('0x2a')][_0xced1('0x42')]);_0x1646df[_0xced1('0x22')]=qs[_0xced1('0x3d')](_['pick'](_0x1800c8[_0xced1('0x2a')],_0x59f1ba[_0xced1('0x3d')]));_0x1646df[_0xced1('0x22')]['FaxQueueId']=_0x1482cc['id'];if(_0x1800c8[_0xced1('0x2a')][_0xced1('0x43')]){_0x1646df[_0xced1('0x22')]=_[_0xced1('0x2f')](_0x1646df['where'],{'$or':_[_0xced1('0x1c')](_0x1646df['attributes'],function(_0x539ee2){var _0x1a2b65={};_0x1a2b65[_0x539ee2]={'$like':'%'+_0x1800c8[_0xced1('0x2a')]['filter']+'%'};return _0x1a2b65;})});}_0x1646df=_['merge']({},_0x1646df,_0x1800c8['options']);return db[_0xced1('0x3c')]['findAll'](_0x1646df);}})[_0xced1('0x13')](function(_0x33df96){if(_0x33df96){return db[_0xced1('0x44')][_0xced1('0x45')]({'where':{'id':_[_0xced1('0x1c')](_0x33df96,_0xced1('0x46')),'role':_0xced1('0x47')},'attributes':['id',_0xced1('0x1a'),'faxPause','updatedAt',_0xced1('0x48')]});}})[_0xced1('0x13')](function(_0x235651){if(_0x235651){return{'count':_0x235651[_0xced1('0x10')],'rows':_['map'](_0x235651[_0xced1('0x49')],function(_0x31df4e){return{'membername':_0x31df4e[_0xced1('0x1a')],'UserId':_0x31df4e['id'],'queue_name':_0xc04f2[_0xced1('0x1a')],'FaxQueueId':_0xc04f2['id'],'interface':util['format'](_0xced1('0x4a'),_0xced1('0x4b'),_0x31df4e[_0xced1('0x1a')]),'penalty':0x0,'paused':_0x31df4e[_0xced1('0x4c')],'createdAt':_0x31df4e[_0xced1('0x48')],'updatedAt':_0x31df4e[_0xced1('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xced1('0x13')](respondWithFilteredResult(_0x310122,_0x1646df))[_0xced1('0x39')](handleError(_0x310122,null));};exports['getTeams']=function(_0x4bebc8,_0x4cc559){var _0x440b22={};var _0x52e873={};var _0x398264;var _0x5d28cc;return db['FaxQueue'][_0xced1('0x3b')]({'where':{'id':_0x4bebc8[_0xced1('0x26')]['id']}})[_0xced1('0x13')](handleEntityNotFound(_0x4cc559,null))[_0xced1('0x13')](function(_0x58d773){if(_0x58d773){_0x398264=_0x58d773;_0x52e873[_0xced1('0x27')]=_[_0xced1('0x28')](db[_0xced1('0x4e')][_0xced1('0x29')]);_0x52e873[_0xced1('0x2a')]=_[_0xced1('0x28')](_0x4bebc8['query']);_0x52e873[_0xced1('0x3d')]=_[_0xced1('0x2b')](_0x52e873['model'],_0x52e873[_0xced1('0x2a')]);_0x440b22[_0xced1('0x2c')]=_['intersection'](_0x52e873[_0xced1('0x27')],qs[_0xced1('0x3e')](_0x4bebc8[_0xced1('0x2a')][_0xced1('0x3e')]));_0x440b22[_0xced1('0x2c')]=_0x440b22['attributes']['length']?_0x440b22['attributes']:_0x52e873[_0xced1('0x27')];_0x440b22[_0xced1('0x41')]=qs['sort'](_0x4bebc8[_0xced1('0x2a')][_0xced1('0x42')]);_0x440b22[_0xced1('0x22')]=qs['filters'](_[_0xced1('0x4f')](_0x4bebc8[_0xced1('0x2a')],_0x52e873['filters']));if(_0x4bebc8[_0xced1('0x2a')]['filter']){_0x440b22[_0xced1('0x22')]=_[_0xced1('0x2f')](_0x440b22[_0xced1('0x22')],{'$or':_[_0xced1('0x1c')](_0x440b22[_0xced1('0x2c')],function(_0x30ffcc){var _0x2459cd={};_0x2459cd[_0x30ffcc]={'$like':'%'+_0x4bebc8['query'][_0xced1('0x43')]+'%'};return _0x2459cd;})});}_0x440b22=_[_0xced1('0x2f')]({},_0x440b22,_0x4bebc8[_0xced1('0x30')]);return _0x398264['getTeams'](_0x440b22);}})['then'](function(_0x27f1f1){if(_0x27f1f1){_0x5d28cc=_0x27f1f1[_0xced1('0x2d')];if(!_0x4bebc8['query'][_0xced1('0x3f')](_0xced1('0x40'))){_0x440b22[_0xced1('0xe')]=qs['limit'](_0x4bebc8['query'][_0xced1('0xe')]);_0x440b22[_0xced1('0xf')]=qs[_0xced1('0xf')](_0x4bebc8[_0xced1('0x2a')][_0xced1('0xf')]);}return _0x398264[_0xced1('0x50')](_0x440b22);}})['then'](function(_0x3333fb){if(_0x3333fb){return _0x3333fb?{'count':_0x5d28cc,'rows':_0x3333fb}:null;}})['then'](respondWithResult(_0x4cc559,null))['catch'](handleError(_0x4cc559,null));};exports['addTeams']=function(_0x4ae2af,_0x1390a6){var _0x27d495=_0x4ae2af['body']['ids'];return db[_0xced1('0x4e')][_0xced1('0x24')]({'where':{'id':_0x27d495},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xced1('0x1a'),_0xced1('0x51'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x5ca2e7){if(_0x5ca2e7){var _0x45bc94=_[_0xced1('0x52')](_0x5ca2e7,function(_0x201974){var _0x18db35=_0x201974[_0xced1('0x15')]({'plain':!![]});return _0x18db35[_0xced1('0x53')];});return db['FaxQueue'][_0xced1('0x31')]({'where':{'id':_0x4ae2af[_0xced1('0x26')]['id']}})[_0xced1('0x13')](function(_0xe1c82c){return db[_0xced1('0x54')][_0xced1('0x55')](function(_0x4401a0){return _0xe1c82c[_0xced1('0x56')](_0x27d495,{'transaction':_0x4401a0})[_0xced1('0x13')](function(){return BPromise['each'](_0x45bc94,function(_0x4d0e16){return db[_0xced1('0x3c')]['findOrCreate']({'where':{'UserId':_0x4d0e16['id'],'FaxQueueId':_0x4ae2af[_0xced1('0x26')]['id']},'transaction':_0x4401a0});});})['then'](function(){_0x45bc94[_0xced1('0x57')](function(_0x23c2be){socket[_0xced1('0x58')](_0xced1('0x59'),{'UserId':_0x23c2be['id'],'FaxQueueId':_0xe1c82c['id']});});});});});}})[_0xced1('0x13')](respondWithStatusCode(_0x1390a6,null))[_0xced1('0x39')](handleError(_0x1390a6,null));};exports['removeTeams']=function(_0x34ed5d,_0x1a0462){return db[_0xced1('0x4e')][_0xced1('0x24')]({'where':{'id':_0x34ed5d[_0xced1('0x2a')][_0xced1('0x5a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xced1('0x13')](handleEntityNotFound(_0x1a0462,null))[_0xced1('0x13')](function(_0x40eed6){var _0x173e9a=_[_0xced1('0x1c')](_0x40eed6,'id');var _0x4f5067=[];var _0x73ba9a=[];var _0x4708e4=squel[_0xced1('0x5b')]();_0x4708e4[_0xced1('0x5c')]('tq.TeamId')[_0xced1('0x5d')](_0xced1('0x5e'),'tq')['join'](_0xced1('0x5f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xced1('0x22')](_0xced1('0x60'),_0x34ed5d[_0xced1('0x26')]['id']);for(var _0x19f15d=0x0;_0x19f15d<_0x40eed6[_0xced1('0x2d')];_0x19f15d+=0x1){let _0x841e76=_0x40eed6[_0x19f15d];for(var _0x3d42cc=0x0;_0x3d42cc<_0x841e76[_0xced1('0x53')][_0xced1('0x2d')];_0x3d42cc+=0x1){let _0x2eea98=_0x841e76['Agents'][_0x3d42cc];var _0x476bdf=_0x4708e4[_0xced1('0x61')]();_0x476bdf[_0xced1('0x22')](_0xced1('0x62'),_0x2eea98['id']);_0x73ba9a['push'](db[_0xced1('0x54')][_0xced1('0x2a')](_0x476bdf[_0xced1('0x63')](),{'type':db[_0xced1('0x54')]['QueryTypes'][_0xced1('0x64')]})[_0xced1('0x13')](function(_0x37deef){if(_0x37deef[_0xced1('0x2d')]===0x1){return _0x2eea98['id'];}else{var _0x3beefd=_['every'](_[_0xced1('0x1c')](_0x37deef,'TeamId'),function(_0x2b868d){return _[_0xced1('0x65')](_0x173e9a,_0x2b868d);});if(_0x3beefd){return _0x2eea98['id'];}}}));}}return BPromise[_0xced1('0x66')](_0x73ba9a)['then'](function(_0x41d724){_0x4f5067=_(_0x4f5067)[_0xced1('0x67')](_0x41d724)['compact']()[_0xced1('0x68')]();return db['FaxQueue'][_0xced1('0x31')]({'where':{'id':_0x34ed5d[_0xced1('0x26')]['id']}})[_0xced1('0x13')](function(_0x5aeea4){return db['sequelize'][_0xced1('0x55')](function(_0xe05467){return _0x5aeea4[_0xced1('0x69')](_0x34ed5d[_0xced1('0x2a')][_0xced1('0x5a')],{'transaction':_0xe05467})['then'](function(){if(!_['isEmpty'](_0x4f5067)){return _0x5aeea4[_0xced1('0x6a')](_0x4f5067,{'transaction':_0xe05467});}})[_0xced1('0x13')](function(){_0x4f5067[_0xced1('0x57')](function(_0x4cf606){socket[_0xced1('0x58')]('userFaxQueue:remove',{'UserId':_0x4cf606,'FaxQueueId':_0x5aeea4['id']});});});});});});})['then'](respondWithStatusCode(_0x1a0462,null))[_0xced1('0x39')](handleError(_0x1a0462,null));};exports['addAgents']=function(_0x18a6a9,_0x58345d){return db[_0xced1('0x1d')][_0xced1('0x31')]({'where':{'id':_0x18a6a9[_0xced1('0x26')]['id']}})[_0xced1('0x13')](handleEntityNotFound(_0x58345d,null))[_0xced1('0x13')](function(_0x4536df){if(_0x4536df){return _0x4536df[_0xced1('0x6b')](_0x18a6a9['body']['ids'],_[_0xced1('0x6c')](_0x18a6a9[_0xced1('0x33')],[_0xced1('0x5a'),'id'])||{})[_0xced1('0x6d')](function(_0x5dc796){for(var _0x51107f=0x0;_0x51107f<_0x18a6a9[_0xced1('0x33')]['ids'][_0xced1('0x2d')];_0x51107f+=0x1){socket[_0xced1('0x58')](_0xced1('0x59'),{'UserId':Number(_0x18a6a9['body'][_0xced1('0x5a')][_0x51107f]),'FaxQueueId':Number(_0x18a6a9[_0xced1('0x26')]['id'])});}return _0x5dc796;});}})['then'](respondWithResult(_0x58345d,null))[_0xced1('0x39')](handleError(_0x58345d,null));};exports[_0xced1('0x6a')]=function(_0x3173cc,_0x5e3a52){return db[_0xced1('0x1d')][_0xced1('0x31')]({'where':{'id':_0x3173cc[_0xced1('0x26')]['id']}})[_0xced1('0x13')](handleEntityNotFound(_0x5e3a52,null))[_0xced1('0x13')](function(_0x4725eb){if(_0x4725eb){return _0x4725eb['removeAgents'](_0x3173cc['query'][_0xced1('0x5a')])[_0xced1('0x13')](function(){if(_[_0xced1('0x6e')](_0x3173cc[_0xced1('0x2a')][_0xced1('0x5a')])){for(var _0xd997a5=0x0;_0xd997a5<_0x3173cc[_0xced1('0x2a')][_0xced1('0x5a')][_0xced1('0x2d')];_0xd997a5+=0x1){socket[_0xced1('0x58')](_0xced1('0x6f'),{'UserId':Number(_0x3173cc['query']['ids'][_0xd997a5]),'FaxQueueId':Number(_0x3173cc[_0xced1('0x26')]['id'])});}}else{socket[_0xced1('0x58')](_0xced1('0x6f'),{'UserId':Number(_0x3173cc[_0xced1('0x2a')][_0xced1('0x5a')]),'FaxQueueId':Number(_0x3173cc[_0xced1('0x26')]['id'])});}});}})[_0xced1('0x13')](respondWithStatusCode(_0x5e3a52,null))[_0xced1('0x39')](handleError(_0x5e3a52,null));};exports[_0xced1('0x70')]=function(_0x1b5aab,_0x21d10a){var _0xd39989={};var _0x615948={};var _0xe0c1bf;var _0x19069f;return db[_0xced1('0x1d')][_0xced1('0x3b')]({'where':{'id':_0x1b5aab[_0xced1('0x26')]['id']}})['then'](handleEntityNotFound(_0x21d10a,null))[_0xced1('0x13')](function(_0x4d7aab){if(_0x4d7aab){_0xe0c1bf=_0x4d7aab;_0x615948[_0xced1('0x27')]=_['keys'](db[_0xced1('0x44')][_0xced1('0x29')]);_0x615948[_0xced1('0x2a')]=_[_0xced1('0x28')](_0x1b5aab[_0xced1('0x2a')]);_0x615948[_0xced1('0x3d')]=_[_0xced1('0x2b')](_0x615948[_0xced1('0x27')],_0x615948[_0xced1('0x2a')]);_0xd39989[_0xced1('0x2c')]=_[_0xced1('0x2b')](_0x615948[_0xced1('0x27')],qs[_0xced1('0x3e')](_0x1b5aab[_0xced1('0x2a')][_0xced1('0x3e')]));_0xd39989[_0xced1('0x2c')]=_0xd39989[_0xced1('0x2c')][_0xced1('0x2d')]?_0xd39989[_0xced1('0x2c')]:_0x615948[_0xced1('0x27')];_0xd39989['order']=qs[_0xced1('0x42')](_0x1b5aab[_0xced1('0x2a')][_0xced1('0x42')]);_0xd39989[_0xced1('0x22')]=qs['filters'](_[_0xced1('0x4f')](_0x1b5aab[_0xced1('0x2a')],_0x615948[_0xced1('0x3d')]));if(_0x1b5aab[_0xced1('0x2a')][_0xced1('0x43')]){_0xd39989['where']=_[_0xced1('0x2f')](_0xd39989['where'],{'$or':_['map'](_0xd39989[_0xced1('0x2c')],function(_0x2892e0){var _0x583651={};_0x583651[_0x2892e0]={'$like':'%'+_0x1b5aab['query'][_0xced1('0x43')]+'%'};return _0x583651;})});}_0xd39989=_[_0xced1('0x2f')]({},_0xd39989,_0x1b5aab[_0xced1('0x30')]);return _0xe0c1bf[_0xced1('0x70')](_0xd39989);}})[_0xced1('0x13')](function(_0xabd57e){if(_0xabd57e){_0x19069f=_0xabd57e[_0xced1('0x2d')];if(!_0x1b5aab['query'][_0xced1('0x3f')](_0xced1('0x40'))){_0xd39989[_0xced1('0xe')]=qs[_0xced1('0xe')](_0x1b5aab[_0xced1('0x2a')][_0xced1('0xe')]);_0xd39989['offset']=qs[_0xced1('0xf')](_0x1b5aab[_0xced1('0x2a')][_0xced1('0xf')]);}return _0xe0c1bf[_0xced1('0x70')](_0xd39989);}})[_0xced1('0x13')](function(_0x202c20){if(_0x202c20){return _0x202c20?{'count':_0x19069f,'rows':_0x202c20}:null;}})['then'](respondWithResult(_0x21d10a,null))[_0xced1('0x39')](handleError(_0x21d10a,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 96f0910..e45b883 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 _0xbf4a=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x476137,_0x1ccb32){var _0x5acaf8=function(_0x32ff8d){while(--_0x32ff8d){_0x476137['push'](_0x476137['shift']());}};_0x5acaf8(++_0x1ccb32);}(_0xbf4a,0x1e1));var _0xabf4=function(_0x2fb0de,_0x1da740){_0x2fb0de=_0x2fb0de-0x0;var _0x4e01d2=_0xbf4a[_0x2fb0de];return _0x4e01d2;};'use strict';var EventEmitter=require(_0xabf4('0x0'));var FaxQueue=require(_0xabf4('0x1'))['db'][_0xabf4('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xabf4('0x3')](0x0);var events={'afterCreate':_0xabf4('0x4'),'afterUpdate':_0xabf4('0x5'),'afterDestroy':_0xabf4('0x6')};function emitEvent(_0x31d1b7){return function(_0x452176,_0x209fd2,_0x72acfd){FaxQueueEvents[_0xabf4('0x7')](_0x31d1b7+':'+_0x452176['id'],_0x452176);FaxQueueEvents[_0xabf4('0x7')](_0x31d1b7,_0x452176);_0x72acfd(null);};}for(var e in events){if(events[_0xabf4('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xabf4('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x68d6=['events','../../mysqldb','FaxQueue','save','emit','hook','exports'];(function(_0xa3fa3,_0x328285){var _0x488dd4=function(_0x1c4f57){while(--_0x1c4f57){_0xa3fa3['push'](_0xa3fa3['shift']());}};_0x488dd4(++_0x328285);}(_0x68d6,0x10a));var _0x668d=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x68d6[_0x2080a3];return _0x8d7d17;};'use strict';var EventEmitter=require(_0x668d('0x0'));var FaxQueue=require(_0x668d('0x1'))['db'][_0x668d('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x668d('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1d373d){return function(_0x2f530a,_0x43f11f,_0x118f62){FaxQueueEvents[_0x668d('0x4')](_0x1d373d+':'+_0x2f530a['id'],_0x2f530a);FaxQueueEvents[_0x668d('0x4')](_0x1d373d,_0x2f530a);_0x118f62(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x668d('0x5')](e,emitEvent(event));}}module[_0x668d('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index a6a1241..89d3607 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 _0x9b0e=['path','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','../../config/logger','moment','request-promise'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x9b0e,0xe2));var _0xe9b0=function(_0x26ea4f,_0x1b644a){_0x26ea4f=_0x26ea4f-0x0;var _0x38a160=_0x9b0e[_0x26ea4f];return _0x38a160;};'use strict';var _=require(_0xe9b0('0x0'));var util=require('util');var logger=require(_0xe9b0('0x1'))('api');var moment=require(_0xe9b0('0x2'));var BPromise=require('bluebird');var rp=require(_0xe9b0('0x3'));var fs=require('fs');var path=require(_0xe9b0('0x4'));var rimraf=require('rimraf');var config=require(_0xe9b0('0x5'));var attributes=require(_0xe9b0('0x6'));module['exports']=function(_0x3b89d7,_0x23782f){return _0x3b89d7[_0xe9b0('0x7')](_0xe9b0('0x8'),attributes,{'tableName':_0xe9b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60dd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util'];(function(_0x206b21,_0xe40b2e){var _0x322754=function(_0x4ccf73){while(--_0x4ccf73){_0x206b21['push'](_0x206b21['shift']());}};_0x322754(++_0xe40b2e);}(_0x60dd,0x116));var _0xd60d=function(_0xfc4cf8,_0x257666){_0xfc4cf8=_0xfc4cf8-0x0;var _0x40ca89=_0x60dd[_0xfc4cf8];return _0x40ca89;};'use strict';var _=require(_0xd60d('0x0'));var util=require(_0xd60d('0x1'));var logger=require('../../config/logger')(_0xd60d('0x2'));var moment=require(_0xd60d('0x3'));var BPromise=require(_0xd60d('0x4'));var rp=require(_0xd60d('0x5'));var fs=require('fs');var path=require(_0xd60d('0x6'));var rimraf=require(_0xd60d('0x7'));var config=require(_0xd60d('0x8'));var attributes=require(_0xd60d('0x9'));module[_0xd60d('0xa')]=function(_0x32975a,_0x2921a7){return _0x32975a[_0xd60d('0xb')](_0xd60d('0xc'),attributes,{'tableName':_0xd60d('0xd'),'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 c202b54..b6b3bab 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 _0x8da2=['then','debug','stringify','ShowFaxQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','FaxQueue,\x20%s,\x20%s','error','message','info','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x59c233,_0xe0627e){var _0x26e0ef=function(_0x553d84){while(--_0x553d84){_0x59c233['push'](_0x59c233['shift']());}};_0x26e0ef(++_0xe0627e);}(_0x8da2,0x124));var _0x28da=function(_0x33353a,_0x2954a0){_0x33353a=_0x33353a-0x0;var _0x197d91=_0x8da2[_0x33353a];return _0x197d91;};'use strict';var _=require(_0x28da('0x0'));var util=require(_0x28da('0x1'));var moment=require(_0x28da('0x2'));var BPromise=require(_0x28da('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x28da('0x5'));var logger=require(_0x28da('0x6'))(_0x28da('0x7'));var config=require(_0x28da('0x8'));var jayson=require(_0x28da('0x9'));var client=jayson[_0x28da('0xa')][_0x28da('0xb')]({'port':0x232a});config[_0x28da('0xc')]=_['defaults'](config[_0x28da('0xc')],{'host':_0x28da('0xd'),'port':0x18eb});var socket=require(_0x28da('0xe'))(new Redis(config[_0x28da('0xc')]));require('./faxQueue.socket')[_0x28da('0xf')](socket);function respondWithRpcPromise(_0x1337ff,_0x209613,_0x346efa){return new BPromise(function(_0x24925c,_0x2064d8){return client['request'](_0x1337ff,_0x346efa)['then'](function(_0x224b11){logger['info'](_0x28da('0x10'),_0x209613,'request\x20sent');logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x209613,'request\x20sent',JSON['stringify'](_0x224b11));if(_0x224b11['error']){if(_0x224b11[_0x28da('0x11')]['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x209613,_0x224b11[_0x28da('0x11')][_0x28da('0x12')]);return _0x2064d8(_0x224b11[_0x28da('0x11')][_0x28da('0x12')]);}logger[_0x28da('0x11')](_0x28da('0x10'),_0x209613,_0x224b11[_0x28da('0x11')][_0x28da('0x12')]);return _0x24925c(_0x224b11[_0x28da('0x11')][_0x28da('0x12')]);}else{logger[_0x28da('0x13')](_0x28da('0x10'),_0x209613,'request\x20sent');_0x24925c(_0x224b11['result'][_0x28da('0x12')]);}})[_0x28da('0x14')](function(_0x32fc51){logger[_0x28da('0x11')](_0x28da('0x10'),_0x209613,_0x32fc51);_0x2064d8(_0x32fc51);});});}exports[_0x28da('0x15')]=function(_0x18cbc2){var _0x206ec9=this;return new Promise(function(_0x27788a,_0x376dfb){return db[_0x28da('0x16')][_0x28da('0x17')]({'raw':_0x18cbc2[_0x28da('0x18')]?_0x18cbc2['options'][_0x28da('0x19')]===undefined?!![]:![]:!![],'where':_0x18cbc2[_0x28da('0x18')]?_0x18cbc2['options'][_0x28da('0x1a')]||null:null,'attributes':_0x18cbc2[_0x28da('0x18')]?_0x18cbc2[_0x28da('0x18')][_0x28da('0x1b')]||null:null,'limit':_0x18cbc2[_0x28da('0x18')]?_0x18cbc2['options'][_0x28da('0x1c')]||null:null,'include':_0x18cbc2['options']?_0x18cbc2[_0x28da('0x18')][_0x28da('0x1d')]?_[_0x28da('0x1e')](_0x18cbc2[_0x28da('0x18')][_0x28da('0x1d')],function(_0x59b623){return{'model':db[_0x59b623[_0x28da('0x1f')]],'as':_0x59b623['as'],'attributes':_0x59b623[_0x28da('0x1b')],'include':_0x59b623[_0x28da('0x1d')]?_[_0x28da('0x1e')](_0x59b623['include'],function(_0x488042){return{'model':db[_0x488042[_0x28da('0x1f')]],'as':_0x488042['as'],'attributes':_0x488042['attributes'],'include':_0x488042['include']?_[_0x28da('0x1e')](_0x488042[_0x28da('0x1d')],function(_0xcf6a8d){return{'model':db[_0xcf6a8d[_0x28da('0x1f')]],'as':_0xcf6a8d['as'],'attributes':_0xcf6a8d['attributes']};}):[]};}):[]};}):[]:[]})[_0x28da('0x20')](function(_0xbba610){logger[_0x28da('0x13')](_0x28da('0x15'),_0x18cbc2);logger[_0x28da('0x21')]('GetFaxQueue',_0x18cbc2,JSON[_0x28da('0x22')](_0xbba610));_0x27788a(_0xbba610);})[_0x28da('0x14')](function(_0x5f152a){logger['error']('GetFaxQueue',_0x5f152a[_0x28da('0x12')],_0x18cbc2);_0x376dfb(_0x206ec9['error'](0x1f4,_0x5f152a['message']));});});};exports[_0x28da('0x23')]=function(_0x5d18d8){var _0x5cf1e7=this;return new Promise(function(_0x523778,_0x31b6ee){return db[_0x28da('0x16')]['find']({'raw':_0x5d18d8['options']?_0x5d18d8[_0x28da('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5d18d8[_0x28da('0x18')]?_0x5d18d8[_0x28da('0x18')][_0x28da('0x1a')]||null:null,'attributes':_0x5d18d8[_0x28da('0x18')]?_0x5d18d8[_0x28da('0x18')][_0x28da('0x1b')]||null:null,'include':_0x5d18d8[_0x28da('0x18')]?_0x5d18d8[_0x28da('0x18')][_0x28da('0x1d')]?_[_0x28da('0x1e')](_0x5d18d8['options'][_0x28da('0x1d')],function(_0xadc13a){return{'model':db[_0xadc13a[_0x28da('0x1f')]],'as':_0xadc13a['as'],'attributes':_0xadc13a[_0x28da('0x1b')],'include':_0xadc13a[_0x28da('0x1d')]?_[_0x28da('0x1e')](_0xadc13a['include'],function(_0x15e17c){return{'model':db[_0x15e17c[_0x28da('0x1f')]],'as':_0x15e17c['as'],'attributes':_0x15e17c[_0x28da('0x1b')],'include':_0x15e17c['include']?_[_0x28da('0x1e')](_0x15e17c[_0x28da('0x1d')],function(_0x467aa0){return{'model':db[_0x467aa0[_0x28da('0x1f')]],'as':_0x467aa0['as'],'attributes':_0x467aa0[_0x28da('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x28da('0x20')](function(_0x2bcafe){logger[_0x28da('0x13')]('ShowFaxQueue',_0x5d18d8);logger['debug']('ShowFaxQueue',_0x5d18d8,JSON[_0x28da('0x22')](_0x2bcafe));_0x523778(_0x2bcafe);})['catch'](function(_0x39456b){logger[_0x28da('0x11')](_0x28da('0x23'),_0x39456b[_0x28da('0x12')],_0x5d18d8);_0x31b6ee(_0x5cf1e7['error'](0x1f4,_0x39456b['message']));});});}; \ No newline at end of file +var _0xd65b=['../../config/environment','http','redis','localhost','socket.io-emitter','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','limit','include','model','attributes','map','GetFaxQueue','ShowFaxQueue','FaxQueue','find','then','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4d3d50,_0x50f156){var _0x175e6d=function(_0x41fc26){while(--_0x41fc26){_0x4d3d50['push'](_0x4d3d50['shift']());}};_0x175e6d(++_0x50f156);}(_0xd65b,0x168));var _0xbd65=function(_0xd52600,_0xcac05e){_0xd52600=_0xd52600-0x0;var _0x186a1f=_0xd65b[_0xd52600];return _0x186a1f;};'use strict';var _=require(_0xbd65('0x0'));var util=require(_0xbd65('0x1'));var moment=require(_0xbd65('0x2'));var BPromise=require(_0xbd65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd65('0x4'));var db=require(_0xbd65('0x5'))['db'];var utils=require(_0xbd65('0x6'));var logger=require(_0xbd65('0x7'))(_0xbd65('0x8'));var config=require(_0xbd65('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbd65('0xa')]({'port':0x232a});config[_0xbd65('0xb')]=_['defaults'](config[_0xbd65('0xb')],{'host':_0xbd65('0xc'),'port':0x18eb});var socket=require(_0xbd65('0xd'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xbd65('0xe')](socket);function respondWithRpcPromise(_0x14b09b,_0x4ff5b7,_0x27686d){return new BPromise(function(_0x47fae4,_0x42aa5d){return client[_0xbd65('0xf')](_0x14b09b,_0x27686d)['then'](function(_0x4a9f83){logger[_0xbd65('0x10')](_0xbd65('0x11'),_0x4ff5b7,_0xbd65('0x12'));logger[_0xbd65('0x13')](_0xbd65('0x14'),_0x4ff5b7,_0xbd65('0x12'),JSON['stringify'](_0x4a9f83));if(_0x4a9f83[_0xbd65('0x15')]){if(_0x4a9f83['error'][_0xbd65('0x16')]===0x1f4){logger[_0xbd65('0x15')](_0xbd65('0x11'),_0x4ff5b7,_0x4a9f83['error'][_0xbd65('0x17')]);return _0x42aa5d(_0x4a9f83[_0xbd65('0x15')]['message']);}logger[_0xbd65('0x15')](_0xbd65('0x11'),_0x4ff5b7,_0x4a9f83[_0xbd65('0x15')][_0xbd65('0x17')]);return _0x47fae4(_0x4a9f83[_0xbd65('0x15')][_0xbd65('0x17')]);}else{logger['info'](_0xbd65('0x11'),_0x4ff5b7,_0xbd65('0x12'));_0x47fae4(_0x4a9f83[_0xbd65('0x18')][_0xbd65('0x17')]);}})[_0xbd65('0x19')](function(_0x34a79f){logger[_0xbd65('0x15')]('FaxQueue,\x20%s,\x20%s',_0x4ff5b7,_0x34a79f);_0x42aa5d(_0x34a79f);});});}exports['GetFaxQueue']=function(_0x4580ab){var _0x29904e=this;return new Promise(function(_0x345221,_0xa23f05){return db['FaxQueue'][_0xbd65('0x1a')]({'raw':_0x4580ab[_0xbd65('0x1b')]?_0x4580ab[_0xbd65('0x1b')][_0xbd65('0x1c')]===undefined?!![]:![]:!![],'where':_0x4580ab[_0xbd65('0x1b')]?_0x4580ab[_0xbd65('0x1b')][_0xbd65('0x1d')]||null:null,'attributes':_0x4580ab[_0xbd65('0x1b')]?_0x4580ab[_0xbd65('0x1b')]['attributes']||null:null,'limit':_0x4580ab[_0xbd65('0x1b')]?_0x4580ab['options'][_0xbd65('0x1e')]||null:null,'include':_0x4580ab['options']?_0x4580ab['options'][_0xbd65('0x1f')]?_['map'](_0x4580ab[_0xbd65('0x1b')][_0xbd65('0x1f')],function(_0x548202){return{'model':db[_0x548202[_0xbd65('0x20')]],'as':_0x548202['as'],'attributes':_0x548202['attributes'],'include':_0x548202[_0xbd65('0x1f')]?_['map'](_0x548202[_0xbd65('0x1f')],function(_0x58ae99){return{'model':db[_0x58ae99['model']],'as':_0x58ae99['as'],'attributes':_0x58ae99[_0xbd65('0x21')],'include':_0x58ae99[_0xbd65('0x1f')]?_[_0xbd65('0x22')](_0x58ae99['include'],function(_0x2a1fdb){return{'model':db[_0x2a1fdb['model']],'as':_0x2a1fdb['as'],'attributes':_0x2a1fdb[_0xbd65('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449f88){logger['info'](_0xbd65('0x23'),_0x4580ab);logger[_0xbd65('0x13')](_0xbd65('0x23'),_0x4580ab,JSON['stringify'](_0x449f88));_0x345221(_0x449f88);})[_0xbd65('0x19')](function(_0x190ecc){logger[_0xbd65('0x15')](_0xbd65('0x23'),_0x190ecc[_0xbd65('0x17')],_0x4580ab);_0xa23f05(_0x29904e[_0xbd65('0x15')](0x1f4,_0x190ecc[_0xbd65('0x17')]));});});};exports[_0xbd65('0x24')]=function(_0x4bf668){var _0x6a1aea=this;return new Promise(function(_0x51ff9b,_0x34d71c){return db[_0xbd65('0x25')][_0xbd65('0x26')]({'raw':_0x4bf668[_0xbd65('0x1b')]?_0x4bf668[_0xbd65('0x1b')][_0xbd65('0x1c')]===undefined?!![]:![]:!![],'where':_0x4bf668[_0xbd65('0x1b')]?_0x4bf668['options'][_0xbd65('0x1d')]||null:null,'attributes':_0x4bf668[_0xbd65('0x1b')]?_0x4bf668['options'][_0xbd65('0x21')]||null:null,'include':_0x4bf668[_0xbd65('0x1b')]?_0x4bf668[_0xbd65('0x1b')][_0xbd65('0x1f')]?_[_0xbd65('0x22')](_0x4bf668['options'][_0xbd65('0x1f')],function(_0x2f928a){return{'model':db[_0x2f928a[_0xbd65('0x20')]],'as':_0x2f928a['as'],'attributes':_0x2f928a['attributes'],'include':_0x2f928a[_0xbd65('0x1f')]?_[_0xbd65('0x22')](_0x2f928a[_0xbd65('0x1f')],function(_0x4fd10b){return{'model':db[_0x4fd10b[_0xbd65('0x20')]],'as':_0x4fd10b['as'],'attributes':_0x4fd10b[_0xbd65('0x21')],'include':_0x4fd10b[_0xbd65('0x1f')]?_[_0xbd65('0x22')](_0x4fd10b[_0xbd65('0x1f')],function(_0x46a9c2){return{'model':db[_0x46a9c2['model']],'as':_0x46a9c2['as'],'attributes':_0x46a9c2[_0xbd65('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbd65('0x27')](function(_0x19b090){logger['info'](_0xbd65('0x24'),_0x4bf668);logger[_0xbd65('0x13')](_0xbd65('0x24'),_0x4bf668,JSON[_0xbd65('0x28')](_0x19b090));_0x51ff9b(_0x19b090);})[_0xbd65('0x19')](function(_0x3c2eb2){logger['error']('ShowFaxQueue',_0x3c2eb2[_0xbd65('0x17')],_0x4bf668);_0x34d71c(_0x6a1aea[_0xbd65('0x15')](0x1f4,_0x3c2eb2['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 0670082..dbc56ef 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 _0xf015=['remove','emit','removeListener','register','length'];(function(_0x137947,_0x15a8e1){var _0x13a8ad=function(_0x1847e2){while(--_0x1847e2){_0x137947['push'](_0x137947['shift']());}};_0x13a8ad(++_0x15a8e1);}(_0xf015,0x13b));var _0x5f01=function(_0x59ee91,_0x1d51cb){_0x59ee91=_0x59ee91-0x0;var _0x198497=_0xf015[_0x59ee91];return _0x198497;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x5f01('0x0'),'update'];function createListener(_0x4ee3fd,_0x36cf4c){return function(_0x484077){_0x36cf4c[_0x5f01('0x1')](_0x4ee3fd,_0x484077);};}function removeListener(_0x524009,_0x33fd75){return function(){FaxQueueEvents[_0x5f01('0x2')](_0x524009,_0x33fd75);};}exports[_0x5f01('0x3')]=function(_0x454de5){for(var _0x122dd0=0x0,_0x5bc7a3=events[_0x5f01('0x4')];_0x122dd0<_0x5bc7a3;_0x122dd0++){var _0x3d35da=events[_0x122dd0];var _0xb5cfef=createListener('faxQueue:'+_0x3d35da,_0x454de5);FaxQueueEvents['on'](_0x3d35da,_0xb5cfef);}}; \ No newline at end of file +var _0xece5=['length','faxQueue:','update','emit','removeListener'];(function(_0x30c133,_0x20e3bd){var _0x38a446=function(_0x279454){while(--_0x279454){_0x30c133['push'](_0x30c133['shift']());}};_0x38a446(++_0x20e3bd);}(_0xece5,0xbb));var _0x5ece=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xece5[_0x273c39];return _0x46d6b5;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save','remove',_0x5ece('0x0')];function createListener(_0x4db1a7,_0x32c777){return function(_0x54254a){_0x32c777[_0x5ece('0x1')](_0x4db1a7,_0x54254a);};}function removeListener(_0x18e9a4,_0x528146){return function(){FaxQueueEvents[_0x5ece('0x2')](_0x18e9a4,_0x528146);};}exports['register']=function(_0x166c5d){for(var _0x33dfa6=0x0,_0x5bb478=events[_0x5ece('0x3')];_0x33dfa6<_0x5bb478;_0x33dfa6++){var _0x413731=events[_0x33dfa6];var _0x59cc69=createListener(_0x5ece('0x4')+_0x413731,_0x166c5d);FaxQueueEvents['on'](_0x413731,_0x59cc69);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 871c1d0..d11ad62 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 _0x583c=['util','path','connect-timeout','Router','fs-extra','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','/:id','delete','removeTeams','removeAgents','exports','multer'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x583c,0x12b));var _0xc583=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0x583c[_0xcfeff4];return _0xb2fadc;};'use strict';var multer=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var path=require(_0xc583('0x2'));var timeout=require(_0xc583('0x3'));var express=require('express');var router=express[_0xc583('0x4')]();var fs_extra=require(_0xc583('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc583('0x6'));var controller=require(_0xc583('0x7'));router['get']('/',auth[_0xc583('0x8')](),controller[_0xc583('0x9')]);router[_0xc583('0xa')](_0xc583('0xb'),auth['isAuthenticated'](),controller[_0xc583('0xc')]);router[_0xc583('0xa')]('/:id',auth[_0xc583('0x8')](),controller[_0xc583('0xd')]);router[_0xc583('0xa')](_0xc583('0xe'),auth[_0xc583('0x8')](),controller['getMembers']);router[_0xc583('0xa')](_0xc583('0xf'),auth['isAuthenticated'](),controller[_0xc583('0x10')]);router[_0xc583('0xa')]('/:id/users',auth[_0xc583('0x8')](),controller[_0xc583('0x11')]);router[_0xc583('0x12')]('/',auth[_0xc583('0x8')](),controller[_0xc583('0x13')]);router[_0xc583('0x12')](_0xc583('0xf'),auth[_0xc583('0x8')](),controller[_0xc583('0x14')]);router['post'](_0xc583('0x15'),auth['isAuthenticated'](),controller[_0xc583('0x16')]);router[_0xc583('0x17')]('/:id',auth[_0xc583('0x8')](),controller[_0xc583('0x18')]);router['delete'](_0xc583('0x19'),auth[_0xc583('0x8')](),controller['destroy']);router[_0xc583('0x1a')](_0xc583('0xf'),auth[_0xc583('0x8')](),controller[_0xc583('0x1b')]);router['delete'](_0xc583('0x15'),auth['isAuthenticated'](),controller[_0xc583('0x1c')]);module[_0xc583('0x1d')]=router; \ No newline at end of file +var _0x9bd9=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x3145e0,_0x3263d8){var _0x40692f=function(_0x8d437){while(--_0x8d437){_0x3145e0['push'](_0x3145e0['shift']());}};_0x40692f(++_0x3263d8);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x1a2ac5,_0x431ac7){_0x1a2ac5=_0x1a2ac5-0x0;var _0x2cedd0=_0x9bd9[_0x1a2ac5];return _0x2cedd0;};'use strict';var multer=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var path=require(_0x99bd('0x2'));var timeout=require(_0x99bd('0x3'));var express=require(_0x99bd('0x4'));var router=express[_0x99bd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x99bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99bd('0x7'));var controller=require(_0x99bd('0x8'));router['get']('/',auth[_0x99bd('0x9')](),controller[_0x99bd('0xa')]);router[_0x99bd('0xb')](_0x99bd('0xc'),auth[_0x99bd('0x9')](),controller[_0x99bd('0xd')]);router[_0x99bd('0xb')](_0x99bd('0xe'),auth[_0x99bd('0x9')](),controller[_0x99bd('0xf')]);router[_0x99bd('0xb')](_0x99bd('0x10'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x11')]);router['get'](_0x99bd('0x12'),auth['isAuthenticated'](),controller[_0x99bd('0x13')]);router['get'](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller['getAgents']);router[_0x99bd('0x15')]('/',auth['isAuthenticated'](),controller[_0x99bd('0x16')]);router['post'](_0x99bd('0x12'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x17')]);router['post'](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x18')]);router[_0x99bd('0x19')](_0x99bd('0xe'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x1a')]);router[_0x99bd('0x1b')](_0x99bd('0xe'),auth['isAuthenticated'](),controller[_0x99bd('0x1c')]);router[_0x99bd('0x1b')](_0x99bd('0x12'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x99bd('0x1b')](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x1d')]);module[_0x99bd('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 19cd4f6..7b9d986 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 _0xd38f=['STRING','DATE','sequelize'];(function(_0x1ffe13,_0x166985){var _0x464066=function(_0x3cc6cf){while(--_0x3cc6cf){_0x1ffe13['push'](_0x1ffe13['shift']());}};_0x464066(++_0x166985);}(_0xd38f,0x164));var _0xfd38=function(_0x467e6c,_0x3f597c){_0x467e6c=_0x467e6c-0x0;var _0xc9408a=_0xd38f[_0x467e6c];return _0xc9408a;};'use strict';var moment=require('moment');var Sequelize=require(_0xfd38('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xfd38('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xfd38('0x1')]},'joinAt':{'type':Sequelize[_0xfd38('0x2')]},'leaveAt':{'type':Sequelize[_0xfd38('0x2')]},'acceptAt':{'type':Sequelize[_0xfd38('0x2')]},'exitAt':{'type':Sequelize[_0xfd38('0x2')]},'reason':{'type':Sequelize[_0xfd38('0x1')]}}; \ No newline at end of file +var _0x07ba=['STRING','DATE','sequelize','exports'];(function(_0x5ae037,_0x4c6ebb){var _0x1b1281=function(_0xe0e4a9){while(--_0xe0e4a9){_0x5ae037['push'](_0x5ae037['shift']());}};_0x1b1281(++_0x4c6ebb);}(_0x07ba,0x156));var _0xa07b=function(_0x5533bc,_0x259123){_0x5533bc=_0x5533bc-0x0;var _0x5c0c0e=_0x07ba[_0x5533bc];return _0x5c0c0e;};'use strict';var moment=require('moment');var Sequelize=require(_0xa07b('0x0'));module[_0xa07b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa07b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa07b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa07b('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index c823b5b..06d13af 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 _0x04d0=['to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','params','keys','include','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0xf9b6b5,_0x2f2372){var _0x167d45=function(_0x14043e){while(--_0x14043e){_0xf9b6b5['push'](_0xf9b6b5['shift']());}};_0x167d45(++_0x2f2372);}(_0x04d0,0x10a));var _0x004d=function(_0x21fee6,_0x32d597){_0x21fee6=_0x21fee6-0x0;var _0x294269=_0x04d0[_0x21fee6];return _0x294269;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x004d('0x0'));var jsonpatch=require(_0x004d('0x1'));var rp=require(_0x004d('0x2'));var moment=require(_0x004d('0x3'));var BPromise=require(_0x004d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x004d('0x5'));var sox=require('sox');var csv=require(_0x004d('0x6'));var ejs=require(_0x004d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x004d('0x8'));var squel=require(_0x004d('0x9'));var crypto=require('crypto');var jsforce=require(_0x004d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x004d('0x6'));var querystring=require(_0x004d('0xb'));var Papa=require(_0x004d('0xc'));var Redis=require('ioredis');var authService=require(_0x004d('0xd'));var qs=require(_0x004d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x004d('0xf'));var logger=require('../../config/logger')(_0x004d('0x10'));var utils=require(_0x004d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x004d('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d2651,_0x46c972){_0x46c972=_0x46c972||0xcc;return function(_0x3ec7fb){if(_0x3ec7fb){return _0x1d2651[_0x004d('0x13')](_0x46c972);}return _0x1d2651[_0x004d('0x14')](_0x46c972)[_0x004d('0x15')]();};}function respondWithResult(_0x1af576,_0x32e867){_0x32e867=_0x32e867||0xc8;return function(_0x4f4785){if(_0x4f4785){return _0x1af576[_0x004d('0x14')](_0x32e867)[_0x004d('0x16')](_0x4f4785);}};}function respondWithFilteredResult(_0x22d22d,_0x1822f5){return function(_0x43f5fb){if(_0x43f5fb){var _0x402969=typeof _0x1822f5[_0x004d('0x17')]===_0x004d('0x18')&&typeof _0x1822f5['limit']===_0x004d('0x18');var _0x1f3482=_0x43f5fb[_0x004d('0x19')];var _0x4b3912=_0x402969?0x0:_0x1822f5[_0x004d('0x17')];var _0x583196=_0x402969?_0x43f5fb[_0x004d('0x19')]:_0x1822f5[_0x004d('0x17')]+_0x1822f5[_0x004d('0x1a')];var _0x66dd7f;if(_0x583196>=_0x1f3482){_0x583196=_0x1f3482;_0x66dd7f=0xc8;}else{_0x66dd7f=0xce;}_0x22d22d['status'](_0x66dd7f);return _0x22d22d[_0x004d('0x1b')](_0x004d('0x1c'),_0x4b3912+'-'+_0x583196+'/'+_0x1f3482)['json'](_0x43f5fb);}return null;};}function patchUpdates(_0x31ac5c){return function(_0x158339){try{jsonpatch[_0x004d('0x1d')](_0x158339,_0x31ac5c,!![]);}catch(_0x3abed3){return BPromise['reject'](_0x3abed3);}return _0x158339[_0x004d('0x1e')]();};}function saveUpdates(_0x39a02e,_0x2da052){return function(_0xb9eda8){if(_0xb9eda8){return _0xb9eda8[_0x004d('0x1f')](_0x39a02e)[_0x004d('0x20')](function(_0x21bbda){return _0x21bbda;});}return null;};}function removeEntity(_0x2150b9,_0x31a6fb){return function(_0x1cfdaa){if(_0x1cfdaa){return _0x1cfdaa[_0x004d('0x21')]()[_0x004d('0x20')](function(){_0x2150b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1263d8,_0xb07ff9){return function(_0x4a4fe1){if(!_0x4a4fe1){_0x1263d8[_0x004d('0x13')](0x194);}return _0x4a4fe1;};}function handleError(_0x1152e6,_0x61e5bc){_0x61e5bc=_0x61e5bc||0x1f4;return function(_0xd13fff){logger[_0x004d('0x22')](_0xd13fff[_0x004d('0x23')]);if(_0xd13fff[_0x004d('0x24')]){delete _0xd13fff['name'];}_0x1152e6[_0x004d('0x14')](_0x61e5bc)['send'](_0xd13fff);};}exports['index']=function(_0x2e7763,_0x38518d){var _0xe17b2d={},_0x1e13b1={},_0x58015b={'count':0x0,'rows':[]};var _0xe53b05=_[_0x004d('0x25')](db[_0x004d('0x26')][_0x004d('0x27')],function(_0xe5b960){return{'name':_0xe5b960[_0x004d('0x28')],'type':_0xe5b960['type'][_0x004d('0x29')]};});_0x1e13b1[_0x004d('0x2a')]=_[_0x004d('0x25')](_0xe53b05,_0x004d('0x24'));_0x1e13b1['query']=_['keys'](_0x2e7763[_0x004d('0x2b')]);_0x1e13b1['filters']=_[_0x004d('0x2c')](_0x1e13b1[_0x004d('0x2a')],_0x1e13b1[_0x004d('0x2b')]);_0xe17b2d[_0x004d('0x2d')]=_[_0x004d('0x2c')](_0x1e13b1[_0x004d('0x2a')],qs[_0x004d('0x2e')](_0x2e7763[_0x004d('0x2b')][_0x004d('0x2e')]));_0xe17b2d[_0x004d('0x2d')]=_0xe17b2d['attributes'][_0x004d('0x2f')]?_0xe17b2d[_0x004d('0x2d')]:_0x1e13b1[_0x004d('0x2a')];if(!_0x2e7763[_0x004d('0x2b')]['hasOwnProperty'](_0x004d('0x30'))){_0xe17b2d[_0x004d('0x1a')]=qs['limit'](_0x2e7763[_0x004d('0x2b')][_0x004d('0x1a')]);_0xe17b2d[_0x004d('0x17')]=qs[_0x004d('0x17')](_0x2e7763[_0x004d('0x2b')]['offset']);}_0xe17b2d[_0x004d('0x31')]=qs[_0x004d('0x32')](_0x2e7763[_0x004d('0x2b')][_0x004d('0x32')]);_0xe17b2d[_0x004d('0x33')]=qs[_0x004d('0x34')](_[_0x004d('0x35')](_0x2e7763[_0x004d('0x2b')],_0x1e13b1['filters']),_0xe53b05);if(_0x2e7763[_0x004d('0x2b')]['filter']){_0xe17b2d[_0x004d('0x33')]=_[_0x004d('0x36')](_0xe17b2d[_0x004d('0x33')],{'$or':_['map'](_0xe53b05,function(_0x5ab98c){if(_0x5ab98c[_0x004d('0x37')]!==_0x004d('0x38')){var _0x48be35={};_0x48be35[_0x5ab98c[_0x004d('0x24')]]={'$like':'%'+_0x2e7763['query'][_0x004d('0x39')]+'%'};return _0x48be35;}})});}_0xe17b2d=_[_0x004d('0x36')]({},_0xe17b2d,_0x2e7763[_0x004d('0x3a')]);var _0x4d2e6a={'where':_0xe17b2d[_0x004d('0x33')]};return db['FaxQueueReport']['count'](_0x4d2e6a)['then'](function(_0x3d9291){_0x58015b['count']=_0x3d9291;if(_0x2e7763['query'][_0x004d('0x3b')]){_0xe17b2d['include']=[{'all':!![]}];}return db[_0x004d('0x26')]['findAll'](_0xe17b2d);})['then'](function(_0x283a58){_0x58015b[_0x004d('0x3c')]=_0x283a58;return _0x58015b;})[_0x004d('0x20')](respondWithFilteredResult(_0x38518d,_0xe17b2d))['catch'](handleError(_0x38518d,null));};exports['show']=function(_0x2d08cd,_0x197377){var _0x162f23={'raw':!![],'where':{'id':_0x2d08cd[_0x004d('0x3d')]['id']}},_0xaa1d11={};_0xaa1d11[_0x004d('0x2a')]=_[_0x004d('0x3e')](db[_0x004d('0x26')][_0x004d('0x27')]);_0xaa1d11[_0x004d('0x2b')]=_['keys'](_0x2d08cd[_0x004d('0x2b')]);_0xaa1d11[_0x004d('0x34')]=_[_0x004d('0x2c')](_0xaa1d11[_0x004d('0x2a')],_0xaa1d11[_0x004d('0x2b')]);_0x162f23[_0x004d('0x2d')]=_['intersection'](_0xaa1d11[_0x004d('0x2a')],qs[_0x004d('0x2e')](_0x2d08cd[_0x004d('0x2b')][_0x004d('0x2e')]));_0x162f23[_0x004d('0x2d')]=_0x162f23['attributes'][_0x004d('0x2f')]?_0x162f23[_0x004d('0x2d')]:_0xaa1d11[_0x004d('0x2a')];if(_0x2d08cd['query'][_0x004d('0x3b')]){_0x162f23[_0x004d('0x3f')]=[{'all':!![]}];}_0x162f23=_[_0x004d('0x36')]({},_0x162f23,_0x2d08cd[_0x004d('0x3a')]);return db['FaxQueueReport']['find'](_0x162f23)[_0x004d('0x20')](handleEntityNotFound(_0x197377,null))[_0x004d('0x20')](respondWithResult(_0x197377,null))[_0x004d('0x40')](handleError(_0x197377,null));};exports[_0x004d('0x41')]=function(_0x5d5c39,_0x28a957){return db[_0x004d('0x26')][_0x004d('0x41')](_0x5d5c39[_0x004d('0x42')],{})['then'](respondWithResult(_0x28a957,0xc9))['catch'](handleError(_0x28a957,null));};exports[_0x004d('0x1f')]=function(_0x21fc27,_0x4cb5fa){if(_0x21fc27['body']['id']){delete _0x21fc27[_0x004d('0x42')]['id'];}return db[_0x004d('0x26')]['find']({'where':{'id':_0x21fc27['params']['id']}})['then'](handleEntityNotFound(_0x4cb5fa,null))[_0x004d('0x20')](saveUpdates(_0x21fc27['body'],null))[_0x004d('0x20')](respondWithResult(_0x4cb5fa,null))[_0x004d('0x40')](handleError(_0x4cb5fa,null));};exports['destroy']=function(_0x12bbcd,_0x5f3c6f){return db[_0x004d('0x26')]['find']({'where':{'id':_0x12bbcd[_0x004d('0x3d')]['id']}})[_0x004d('0x20')](handleEntityNotFound(_0x5f3c6f,null))[_0x004d('0x20')](removeEntity(_0x5f3c6f,null))['catch'](handleError(_0x5f3c6f,null));};exports['describe']=function(_0x11ebbe,_0x3458a1){return db['FaxQueueReport'][_0x004d('0x43')]()['then'](respondWithResult(_0x3458a1,null))[_0x004d('0x40')](handleError(_0x3458a1,null));}; \ No newline at end of file +var _0xa1fd=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x10b4aa,_0x41ffc3){var _0x4c0d22=function(_0xa53c16){while(--_0xa53c16){_0x10b4aa['push'](_0x10b4aa['shift']());}};_0x4c0d22(++_0x41ffc3);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x152aa1,_0x307718){_0x152aa1=_0x152aa1-0x0;var _0x1bc01a=_0xa1fd[_0x152aa1];return _0x1bc01a;};'use strict';var emlformat=require(_0xda1f('0x0'));var rimraf=require(_0xda1f('0x1'));var zipdir=require(_0xda1f('0x2'));var jsonpatch=require(_0xda1f('0x3'));var rp=require('request-promise');var moment=require(_0xda1f('0x4'));var BPromise=require(_0xda1f('0x5'));var Mustache=require(_0xda1f('0x6'));var util=require(_0xda1f('0x7'));var path=require(_0xda1f('0x8'));var sox=require('sox');var csv=require(_0xda1f('0x9'));var ejs=require(_0xda1f('0xa'));var fs=require('fs');var fs_extra=require(_0xda1f('0xb'));var _=require('lodash');var squel=require(_0xda1f('0xc'));var crypto=require(_0xda1f('0xd'));var jsforce=require(_0xda1f('0xe'));var deskjs=require(_0xda1f('0xf'));var toCsv=require(_0xda1f('0x9'));var querystring=require(_0xda1f('0x10'));var Papa=require(_0xda1f('0x11'));var Redis=require(_0xda1f('0x12'));var authService=require(_0xda1f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xda1f('0x14'));var hardwareService=require(_0xda1f('0x15'));var logger=require(_0xda1f('0x16'))(_0xda1f('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xda1f('0x18'));var db=require(_0xda1f('0x19'))['db'];function respondWithStatusCode(_0x3842d7,_0x347fa0){_0x347fa0=_0x347fa0||0xcc;return function(_0x1f7dc4){if(_0x1f7dc4){return _0x3842d7['sendStatus'](_0x347fa0);}return _0x3842d7[_0xda1f('0x1a')](_0x347fa0)[_0xda1f('0x1b')]();};}function respondWithResult(_0x151673,_0x306184){_0x306184=_0x306184||0xc8;return function(_0x2138d0){if(_0x2138d0){return _0x151673[_0xda1f('0x1a')](_0x306184)['json'](_0x2138d0);}};}function respondWithFilteredResult(_0x77da5b,_0x124930){return function(_0xc0346c){if(_0xc0346c){var _0x4081d0=typeof _0x124930['offset']==='undefined'&&typeof _0x124930[_0xda1f('0x1c')]==='undefined';var _0x3424a1=_0xc0346c[_0xda1f('0x1d')];var _0x1e10af=_0x4081d0?0x0:_0x124930['offset'];var _0xe81fc2=_0x4081d0?_0xc0346c[_0xda1f('0x1d')]:_0x124930['offset']+_0x124930[_0xda1f('0x1c')];var _0x31cbba;if(_0xe81fc2>=_0x3424a1){_0xe81fc2=_0x3424a1;_0x31cbba=0xc8;}else{_0x31cbba=0xce;}_0x77da5b['status'](_0x31cbba);return _0x77da5b[_0xda1f('0x1e')](_0xda1f('0x1f'),_0x1e10af+'-'+_0xe81fc2+'/'+_0x3424a1)[_0xda1f('0x20')](_0xc0346c);}return null;};}function patchUpdates(_0xe85e94){return function(_0x3955b8){try{jsonpatch[_0xda1f('0x21')](_0x3955b8,_0xe85e94,!![]);}catch(_0x1f6958){return BPromise[_0xda1f('0x22')](_0x1f6958);}return _0x3955b8[_0xda1f('0x23')]();};}function saveUpdates(_0x21e6b4,_0x1d510b){return function(_0xc76888){if(_0xc76888){return _0xc76888['update'](_0x21e6b4)[_0xda1f('0x24')](function(_0x4bcfda){return _0x4bcfda;});}return null;};}function removeEntity(_0x443fa1,_0x51e172){return function(_0x2a1b64){if(_0x2a1b64){return _0x2a1b64[_0xda1f('0x25')]()['then'](function(){_0x443fa1[_0xda1f('0x1a')](0xcc)[_0xda1f('0x1b')]();});}};}function handleEntityNotFound(_0x3231c8,_0x1cf1bc){return function(_0x1d5485){if(!_0x1d5485){_0x3231c8['sendStatus'](0x194);}return _0x1d5485;};}function handleError(_0x310d37,_0xeab7be){_0xeab7be=_0xeab7be||0x1f4;return function(_0x6619b3){logger[_0xda1f('0x26')](_0x6619b3['stack']);if(_0x6619b3[_0xda1f('0x27')]){delete _0x6619b3[_0xda1f('0x27')];}_0x310d37['status'](_0xeab7be)[_0xda1f('0x28')](_0x6619b3);};}exports['index']=function(_0x34459d,_0x4bf7cf){var _0x5ba749={},_0x2dd737={},_0x592181={'count':0x0,'rows':[]};var _0x4d5bb0=_[_0xda1f('0x29')](db[_0xda1f('0x2a')][_0xda1f('0x2b')],function(_0x55d28c){return{'name':_0x55d28c[_0xda1f('0x2c')],'type':_0x55d28c[_0xda1f('0x2d')]['key']};});_0x2dd737[_0xda1f('0x2e')]=_['map'](_0x4d5bb0,'name');_0x2dd737['query']=_[_0xda1f('0x2f')](_0x34459d[_0xda1f('0x30')]);_0x2dd737[_0xda1f('0x31')]=_['intersection'](_0x2dd737[_0xda1f('0x2e')],_0x2dd737[_0xda1f('0x30')]);_0x5ba749[_0xda1f('0x32')]=_['intersection'](_0x2dd737[_0xda1f('0x2e')],qs['fields'](_0x34459d[_0xda1f('0x30')][_0xda1f('0x33')]));_0x5ba749[_0xda1f('0x32')]=_0x5ba749[_0xda1f('0x32')][_0xda1f('0x34')]?_0x5ba749['attributes']:_0x2dd737[_0xda1f('0x2e')];if(!_0x34459d[_0xda1f('0x30')][_0xda1f('0x35')](_0xda1f('0x36'))){_0x5ba749['limit']=qs[_0xda1f('0x1c')](_0x34459d[_0xda1f('0x30')][_0xda1f('0x1c')]);_0x5ba749[_0xda1f('0x37')]=qs[_0xda1f('0x37')](_0x34459d['query'][_0xda1f('0x37')]);}_0x5ba749[_0xda1f('0x38')]=qs[_0xda1f('0x39')](_0x34459d[_0xda1f('0x30')][_0xda1f('0x39')]);_0x5ba749['where']=qs[_0xda1f('0x31')](_[_0xda1f('0x3a')](_0x34459d[_0xda1f('0x30')],_0x2dd737[_0xda1f('0x31')]),_0x4d5bb0);if(_0x34459d[_0xda1f('0x30')]['filter']){_0x5ba749[_0xda1f('0x3b')]=_[_0xda1f('0x3c')](_0x5ba749[_0xda1f('0x3b')],{'$or':_[_0xda1f('0x29')](_0x4d5bb0,function(_0x474019){if(_0x474019[_0xda1f('0x2d')]!==_0xda1f('0x3d')){var _0x396b5e={};_0x396b5e[_0x474019['name']]={'$like':'%'+_0x34459d[_0xda1f('0x30')][_0xda1f('0x3e')]+'%'};return _0x396b5e;}})});}_0x5ba749=_[_0xda1f('0x3c')]({},_0x5ba749,_0x34459d[_0xda1f('0x3f')]);var _0x3716bd={'where':_0x5ba749[_0xda1f('0x3b')]};return db[_0xda1f('0x2a')]['count'](_0x3716bd)[_0xda1f('0x24')](function(_0xd51a87){_0x592181[_0xda1f('0x1d')]=_0xd51a87;if(_0x34459d[_0xda1f('0x30')][_0xda1f('0x40')]){_0x5ba749[_0xda1f('0x41')]=[{'all':!![]}];}return db[_0xda1f('0x2a')][_0xda1f('0x42')](_0x5ba749);})[_0xda1f('0x24')](function(_0x568747){_0x592181['rows']=_0x568747;return _0x592181;})[_0xda1f('0x24')](respondWithFilteredResult(_0x4bf7cf,_0x5ba749))[_0xda1f('0x43')](handleError(_0x4bf7cf,null));};exports[_0xda1f('0x44')]=function(_0x2427ca,_0x536917){var _0x4677dc={'raw':!![],'where':{'id':_0x2427ca[_0xda1f('0x45')]['id']}},_0x3097ef={};_0x3097ef[_0xda1f('0x2e')]=_[_0xda1f('0x2f')](db[_0xda1f('0x2a')]['rawAttributes']);_0x3097ef[_0xda1f('0x30')]=_[_0xda1f('0x2f')](_0x2427ca[_0xda1f('0x30')]);_0x3097ef[_0xda1f('0x31')]=_[_0xda1f('0x46')](_0x3097ef[_0xda1f('0x2e')],_0x3097ef[_0xda1f('0x30')]);_0x4677dc[_0xda1f('0x32')]=_['intersection'](_0x3097ef[_0xda1f('0x2e')],qs['fields'](_0x2427ca[_0xda1f('0x30')][_0xda1f('0x33')]));_0x4677dc[_0xda1f('0x32')]=_0x4677dc['attributes'][_0xda1f('0x34')]?_0x4677dc[_0xda1f('0x32')]:_0x3097ef[_0xda1f('0x2e')];if(_0x2427ca[_0xda1f('0x30')]['includeAll']){_0x4677dc[_0xda1f('0x41')]=[{'all':!![]}];}_0x4677dc=_['merge']({},_0x4677dc,_0x2427ca[_0xda1f('0x3f')]);return db[_0xda1f('0x2a')][_0xda1f('0x47')](_0x4677dc)[_0xda1f('0x24')](handleEntityNotFound(_0x536917,null))[_0xda1f('0x24')](respondWithResult(_0x536917,null))[_0xda1f('0x43')](handleError(_0x536917,null));};exports[_0xda1f('0x48')]=function(_0x1a4904,_0x31175d){return db[_0xda1f('0x2a')][_0xda1f('0x48')](_0x1a4904[_0xda1f('0x49')],{})[_0xda1f('0x24')](respondWithResult(_0x31175d,0xc9))[_0xda1f('0x43')](handleError(_0x31175d,null));};exports[_0xda1f('0x4a')]=function(_0x4eccfa,_0x2267de){if(_0x4eccfa[_0xda1f('0x49')]['id']){delete _0x4eccfa[_0xda1f('0x49')]['id'];}return db[_0xda1f('0x2a')][_0xda1f('0x47')]({'where':{'id':_0x4eccfa[_0xda1f('0x45')]['id']}})['then'](handleEntityNotFound(_0x2267de,null))['then'](saveUpdates(_0x4eccfa[_0xda1f('0x49')],null))[_0xda1f('0x24')](respondWithResult(_0x2267de,null))[_0xda1f('0x43')](handleError(_0x2267de,null));};exports[_0xda1f('0x25')]=function(_0x3ce251,_0x4b71da){return db[_0xda1f('0x2a')][_0xda1f('0x47')]({'where':{'id':_0x3ce251['params']['id']}})[_0xda1f('0x24')](handleEntityNotFound(_0x4b71da,null))[_0xda1f('0x24')](removeEntity(_0x4b71da,null))['catch'](handleError(_0x4b71da,null));};exports['describe']=function(_0xee525d,_0x2a2ca3){return db[_0xda1f('0x2a')][_0xda1f('0x4b')]()[_0xda1f('0x24')](respondWithResult(_0x2a2ca3,null))['catch'](handleError(_0x2a2ca3,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3f3e0ca..a8dad75 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x5a136b,_0x5dad29){var _0x131ec9=function(_0x506ff3){while(--_0x506ff3){_0x5a136b['push'](_0x5a136b['shift']());}};_0x131ec9(++_0x5dad29);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xc7b656,_0x3983fc){_0xc7b656=_0xc7b656-0x0;var _0x45479e=_0x7fbe[_0xc7b656];return _0x45479e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x59fc55,_0x317de3){var _0x434986=function(_0x4ef68c){while(--_0x4ef68c){_0x59fc55['push'](_0x59fc55['shift']());}};_0x434986(++_0x317de3);}(_0x7a54,0x106));var _0x47a5=function(_0x1d1612,_0x373ad6){_0x1d1612=_0x1d1612-0x0;var _0x287311=_0x7a54[_0x1d1612];return _0x287311;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 2748e94..0c8eb86 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 _0x2444=['FaxQueueReport,\x20%s,\x20%s','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','then','catch','update','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2ccb92,_0x49f640){var _0x112398=function(_0x1d9dc0){while(--_0x1d9dc0){_0x2ccb92['push'](_0x2ccb92['shift']());}};_0x112398(++_0x49f640);}(_0x2444,0x7e));var _0x4244=function(_0x4e4e87,_0x380d4f){_0x4e4e87=_0x4e4e87-0x0;var _0x419912=_0x2444[_0x4e4e87];return _0x419912;};'use strict';var _=require(_0x4244('0x0'));var util=require(_0x4244('0x1'));var moment=require(_0x4244('0x2'));var BPromise=require(_0x4244('0x3'));var rs=require(_0x4244('0x4'));var fs=require('fs');var Redis=require(_0x4244('0x5'));var db=require(_0x4244('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4244('0x7'))(_0x4244('0x8'));var config=require(_0x4244('0x9'));var jayson=require(_0x4244('0xa'));var client=jayson[_0x4244('0xb')][_0x4244('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x549303,_0x56ef51,_0x1615fc){return new BPromise(function(_0x33628d,_0x283339){return client[_0x4244('0xd')](_0x549303,_0x1615fc)['then'](function(_0x1342c4){logger[_0x4244('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x56ef51,_0x4244('0xf'));logger[_0x4244('0x10')](_0x4244('0x11'),_0x56ef51,'request\x20sent',JSON[_0x4244('0x12')](_0x1342c4));if(_0x1342c4[_0x4244('0x13')]){if(_0x1342c4['error'][_0x4244('0x14')]===0x1f4){logger[_0x4244('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x56ef51,_0x1342c4['error']['message']);return _0x283339(_0x1342c4[_0x4244('0x13')][_0x4244('0x15')]);}logger['error'](_0x4244('0x16'),_0x56ef51,_0x1342c4[_0x4244('0x13')][_0x4244('0x15')]);return _0x33628d(_0x1342c4[_0x4244('0x13')][_0x4244('0x15')]);}else{logger['info'](_0x4244('0x16'),_0x56ef51,_0x4244('0xf'));_0x33628d(_0x1342c4[_0x4244('0x17')]['message']);}})['catch'](function(_0x517cc7){logger[_0x4244('0x13')](_0x4244('0x16'),_0x56ef51,_0x517cc7);_0x283339(_0x517cc7);});});}exports[_0x4244('0x18')]=function(_0x409a16){var _0x35851b=this;return new Promise(function(_0x250ce0,_0x5653e2){return db[_0x4244('0x19')][_0x4244('0x1a')](_0x409a16[_0x4244('0x1b')],{'raw':_0x409a16[_0x4244('0x1c')]?_0x409a16[_0x4244('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x4244('0x1d')](function(_0x5e16d4){logger[_0x4244('0xe')](_0x4244('0x18'),_0x409a16);logger[_0x4244('0x10')](_0x4244('0x18'),_0x409a16,JSON[_0x4244('0x12')](_0x5e16d4));_0x250ce0(_0x5e16d4);})[_0x4244('0x1e')](function(_0x466a02){logger[_0x4244('0x13')](_0x4244('0x18'),_0x466a02['message'],_0x409a16);_0x5653e2(_0x35851b[_0x4244('0x13')](0x1f4,_0x466a02[_0x4244('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x17f389){var _0x13911c=this;return new Promise(function(_0x392073,_0x215778){return db['FaxQueueReport'][_0x4244('0x1f')](_0x17f389[_0x4244('0x1b')],{'raw':_0x17f389[_0x4244('0x1c')]?_0x17f389[_0x4244('0x1c')][_0x4244('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17f389[_0x4244('0x1c')]?_0x17f389[_0x4244('0x1c')][_0x4244('0x21')]||null:null,'attributes':_0x17f389[_0x4244('0x1c')]?_0x17f389['options'][_0x4244('0x22')]||null:null,'limit':_0x17f389[_0x4244('0x1c')]?_0x17f389[_0x4244('0x1c')][_0x4244('0x23')]||null:null})['then'](function(_0x4a20f6){logger['info']('UpdateFaxQueueReport',_0x17f389);logger[_0x4244('0x10')](_0x4244('0x24'),_0x17f389,JSON['stringify'](_0x4a20f6));_0x392073(_0x4a20f6);})[_0x4244('0x1e')](function(_0x2c01ff){logger['error'](_0x4244('0x24'),_0x2c01ff[_0x4244('0x15')],_0x17f389);_0x215778(_0x13911c['error'](0x1f4,_0x2c01ff[_0x4244('0x15')]));});});}; \ No newline at end of file +var _0x5ed5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','update','where','attributes','limit','catch','UpdateFaxQueueReport','util'];(function(_0x1d38ee,_0x30fdfc){var _0x18f3bc=function(_0x40d3c7){while(--_0x40d3c7){_0x1d38ee['push'](_0x1d38ee['shift']());}};_0x18f3bc(++_0x30fdfc);}(_0x5ed5,0x83));var _0x55ed=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5ed5[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x55ed('0x0'));var moment=require('moment');var BPromise=require(_0x55ed('0x1'));var rs=require(_0x55ed('0x2'));var fs=require('fs');var Redis=require(_0x55ed('0x3'));var db=require(_0x55ed('0x4'))['db'];var utils=require(_0x55ed('0x5'));var logger=require(_0x55ed('0x6'))(_0x55ed('0x7'));var config=require('../../config/environment');var jayson=require(_0x55ed('0x8'));var client=jayson[_0x55ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ad339,_0x236503,_0x44f997){return new BPromise(function(_0x3d47c6,_0x50a277){return client[_0x55ed('0xa')](_0x3ad339,_0x44f997)[_0x55ed('0xb')](function(_0x3cad20){logger[_0x55ed('0xc')](_0x55ed('0xd'),_0x236503,_0x55ed('0xe'));logger[_0x55ed('0xf')](_0x55ed('0x10'),_0x236503,_0x55ed('0xe'),JSON[_0x55ed('0x11')](_0x3cad20));if(_0x3cad20[_0x55ed('0x12')]){if(_0x3cad20[_0x55ed('0x12')]['code']===0x1f4){logger[_0x55ed('0x12')](_0x55ed('0xd'),_0x236503,_0x3cad20['error'][_0x55ed('0x13')]);return _0x50a277(_0x3cad20['error']['message']);}logger[_0x55ed('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x236503,_0x3cad20['error'][_0x55ed('0x13')]);return _0x3d47c6(_0x3cad20[_0x55ed('0x12')]['message']);}else{logger[_0x55ed('0xc')](_0x55ed('0xd'),_0x236503,_0x55ed('0xe'));_0x3d47c6(_0x3cad20[_0x55ed('0x14')]['message']);}})['catch'](function(_0x5e4708){logger[_0x55ed('0x12')](_0x55ed('0xd'),_0x236503,_0x5e4708);_0x50a277(_0x5e4708);});});}exports[_0x55ed('0x15')]=function(_0x3a5fa2){var _0x84c6b8=this;return new Promise(function(_0x3d7fae,_0x402633){return db[_0x55ed('0x16')][_0x55ed('0x17')](_0x3a5fa2[_0x55ed('0x18')],{'raw':_0x3a5fa2['options']?_0x3a5fa2[_0x55ed('0x19')][_0x55ed('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4fceb6){logger[_0x55ed('0xc')](_0x55ed('0x15'),_0x3a5fa2);logger[_0x55ed('0xf')](_0x55ed('0x15'),_0x3a5fa2,JSON[_0x55ed('0x11')](_0x4fceb6));_0x3d7fae(_0x4fceb6);})['catch'](function(_0x1897af){logger[_0x55ed('0x12')](_0x55ed('0x15'),_0x1897af['message'],_0x3a5fa2);_0x402633(_0x84c6b8[_0x55ed('0x12')](0x1f4,_0x1897af['message']));});});};exports['UpdateFaxQueueReport']=function(_0x2ccacc){var _0x55015a=this;return new Promise(function(_0x4bce69,_0x2d9e8a){return db[_0x55ed('0x16')][_0x55ed('0x1b')](_0x2ccacc[_0x55ed('0x18')],{'raw':_0x2ccacc['options']?_0x2ccacc['options'][_0x55ed('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ccacc[_0x55ed('0x19')]?_0x2ccacc['options'][_0x55ed('0x1c')]||null:null,'attributes':_0x2ccacc['options']?_0x2ccacc[_0x55ed('0x19')][_0x55ed('0x1d')]||null:null,'limit':_0x2ccacc['options']?_0x2ccacc['options'][_0x55ed('0x1e')]||null:null})['then'](function(_0x43a361){logger[_0x55ed('0xc')]('UpdateFaxQueueReport',_0x2ccacc);logger[_0x55ed('0xf')]('UpdateFaxQueueReport',_0x2ccacc,JSON[_0x55ed('0x11')](_0x43a361));_0x4bce69(_0x43a361);})[_0x55ed('0x1f')](function(_0x2b5302){logger[_0x55ed('0x12')](_0x55ed('0x20'),_0x2b5302[_0x55ed('0x13')],_0x2ccacc);_0x2d9e8a(_0x55015a[_0x55ed('0x12')](0x1f4,_0x2b5302[_0x55ed('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b6a914f..01364d6 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 _0x4f23=['show','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5275b8,_0x51e5dd){var _0x568a9b=function(_0x583a71){while(--_0x583a71){_0x5275b8['push'](_0x5275b8['shift']());}};_0x568a9b(++_0x51e5dd);}(_0x4f23,0x16f));var _0x34f2=function(_0x5e0847,_0x4b3627){_0x5e0847=_0x5e0847-0x0;var _0x2cbf29=_0x4f23[_0x5e0847];return _0x2cbf29;};'use strict';var multer=require('multer');var util=require(_0x34f2('0x0'));var path=require(_0x34f2('0x1'));var timeout=require(_0x34f2('0x2'));var express=require(_0x34f2('0x3'));var router=express['Router']();var fs_extra=require(_0x34f2('0x4'));var auth=require(_0x34f2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x34f2('0x6'));var controller=require(_0x34f2('0x7'));router[_0x34f2('0x8')]('/',auth[_0x34f2('0x9')](),controller[_0x34f2('0xa')]);router[_0x34f2('0x8')](_0x34f2('0xb'),auth['isAuthenticated'](),controller[_0x34f2('0xc')]);router['get']('/:id',auth[_0x34f2('0x9')](),controller[_0x34f2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x34f2('0xe')](_0x34f2('0xf'),auth[_0x34f2('0x9')](),controller[_0x34f2('0x10')]);router[_0x34f2('0x11')]('/:id',auth[_0x34f2('0x9')](),controller[_0x34f2('0x12')]);module[_0x34f2('0x13')]=router; \ No newline at end of file +var _0xee59=['./faxQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0xee59,0x14d));var _0x9ee5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee59[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9ee5('0x0'));var path=require(_0x9ee5('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ee5('0x2'));var router=express[_0x9ee5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9ee5('0x4'));var interaction=require(_0x9ee5('0x5'));var config=require(_0x9ee5('0x6'));var controller=require(_0x9ee5('0x7'));router['get']('/',auth[_0x9ee5('0x8')](),controller['index']);router[_0x9ee5('0x9')](_0x9ee5('0xa'),auth['isAuthenticated'](),controller[_0x9ee5('0xb')]);router[_0x9ee5('0x9')](_0x9ee5('0xc'),auth['isAuthenticated'](),controller[_0x9ee5('0xd')]);router[_0x9ee5('0xe')]('/',auth[_0x9ee5('0x8')](),controller[_0x9ee5('0xf')]);router[_0x9ee5('0x10')](_0x9ee5('0xc'),auth[_0x9ee5('0x8')](),controller[_0x9ee5('0x11')]);router[_0x9ee5('0x12')](_0x9ee5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9ee5('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 3faa25d..2c43c80 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x149d89,_0x23defe){var _0x352be6=function(_0x2255eb){while(--_0x2255eb){_0x149d89['push'](_0x149d89['shift']());}};_0x352be6(++_0x23defe);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0xf3cd[_0x29dda1];return _0x21b0ef;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x409f7e,_0x124a5d){var _0x4b31bd=function(_0xe5cadd){while(--_0xe5cadd){_0x409f7e['push'](_0x409f7e['shift']());}};_0x4b31bd(++_0x124a5d);}(_0xe706,0xa3));var _0x6e70=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xe706[_0x4c7935];return _0x30651d;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 87118cb..fdbf090 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 _0xfe30=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0xbc8da3,_0x4449dc){var _0x4c490e=function(_0x48f628){while(--_0x48f628){_0xbc8da3['push'](_0xbc8da3['shift']());}};_0x4c490e(++_0x4449dc);}(_0xfe30,0xf6));var _0x0fe3=function(_0x5b6a86,_0x59489c){_0x5b6a86=_0x5b6a86-0x0;var _0x425888=_0xfe30[_0x5b6a86];return _0x425888;};'use strict';var emlformat=require(_0x0fe3('0x0'));var rimraf=require(_0x0fe3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fe3('0x2'));var rp=require(_0x0fe3('0x3'));var moment=require(_0x0fe3('0x4'));var BPromise=require(_0x0fe3('0x5'));var Mustache=require(_0x0fe3('0x6'));var util=require(_0x0fe3('0x7'));var path=require(_0x0fe3('0x8'));var sox=require(_0x0fe3('0x9'));var csv=require(_0x0fe3('0xa'));var ejs=require(_0x0fe3('0xb'));var fs=require('fs');var fs_extra=require(_0x0fe3('0xc'));var _=require(_0x0fe3('0xd'));var squel=require(_0x0fe3('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0fe3('0xf'));var toCsv=require(_0x0fe3('0xa'));var querystring=require('querystring');var Papa=require(_0x0fe3('0x10'));var Redis=require(_0x0fe3('0x11'));var authService=require(_0x0fe3('0x12'));var qs=require(_0x0fe3('0x13'));var as=require(_0x0fe3('0x14'));var hardwareService=require(_0x0fe3('0x15'));var logger=require(_0x0fe3('0x16'))(_0x0fe3('0x17'));var utils=require('../../config/utils');var config=require(_0x0fe3('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48e033,_0x46ee08){_0x46ee08=_0x46ee08||0xcc;return function(_0x102321){if(_0x102321){return _0x48e033[_0x0fe3('0x19')](_0x46ee08);}return _0x48e033[_0x0fe3('0x1a')](_0x46ee08)[_0x0fe3('0x1b')]();};}function respondWithResult(_0x4d1257,_0x312c6e){_0x312c6e=_0x312c6e||0xc8;return function(_0x58fbc8){if(_0x58fbc8){return _0x4d1257[_0x0fe3('0x1a')](_0x312c6e)[_0x0fe3('0x1c')](_0x58fbc8);}};}function respondWithFilteredResult(_0x291945,_0x2d815f){return function(_0x24fbd1){if(_0x24fbd1){var _0x5e09fa=typeof _0x2d815f[_0x0fe3('0x1d')]===_0x0fe3('0x1e')&&typeof _0x2d815f[_0x0fe3('0x1f')]===_0x0fe3('0x1e');var _0x2708bf=_0x24fbd1[_0x0fe3('0x20')];var _0x18bac2=_0x5e09fa?0x0:_0x2d815f[_0x0fe3('0x1d')];var _0x4d5942=_0x5e09fa?_0x24fbd1[_0x0fe3('0x20')]:_0x2d815f['offset']+_0x2d815f[_0x0fe3('0x1f')];var _0x475959;if(_0x4d5942>=_0x2708bf){_0x4d5942=_0x2708bf;_0x475959=0xc8;}else{_0x475959=0xce;}_0x291945[_0x0fe3('0x1a')](_0x475959);return _0x291945[_0x0fe3('0x21')]('Content-Range',_0x18bac2+'-'+_0x4d5942+'/'+_0x2708bf)[_0x0fe3('0x1c')](_0x24fbd1);}return null;};}function patchUpdates(_0xc3509d){return function(_0x5c9e38){try{jsonpatch[_0x0fe3('0x22')](_0x5c9e38,_0xc3509d,!![]);}catch(_0x414b11){return BPromise[_0x0fe3('0x23')](_0x414b11);}return _0x5c9e38[_0x0fe3('0x24')]();};}function saveUpdates(_0x3a8612,_0x202f57){return function(_0x18338e){if(_0x18338e){return _0x18338e[_0x0fe3('0x25')](_0x3a8612)['then'](function(_0x2d5613){return _0x2d5613;});}return null;};}function removeEntity(_0x2d9e80,_0x53778c){return function(_0x45c1a6){if(_0x45c1a6){return _0x45c1a6[_0x0fe3('0x26')]()[_0x0fe3('0x27')](function(){_0x2d9e80[_0x0fe3('0x1a')](0xcc)[_0x0fe3('0x1b')]();});}};}function handleEntityNotFound(_0x5167fa,_0x2b6f1d){return function(_0x5c6a7b){if(!_0x5c6a7b){_0x5167fa[_0x0fe3('0x19')](0x194);}return _0x5c6a7b;};}function handleError(_0x313862,_0x20f83d){_0x20f83d=_0x20f83d||0x1f4;return function(_0x461493){logger[_0x0fe3('0x28')](_0x461493[_0x0fe3('0x29')]);if(_0x461493[_0x0fe3('0x2a')]){delete _0x461493[_0x0fe3('0x2a')];}_0x313862['status'](_0x20f83d)[_0x0fe3('0x2b')](_0x461493);};}exports[_0x0fe3('0x2c')]=function(_0x5811dc,_0x59890f){var _0x4c758d={},_0x4f9b83={},_0x3bf63f={'count':0x0,'rows':[]};var _0x2f6c21=_[_0x0fe3('0x2d')](db[_0x0fe3('0x2e')]['rawAttributes'],function(_0x512035){return{'name':_0x512035[_0x0fe3('0x2f')],'type':_0x512035[_0x0fe3('0x30')][_0x0fe3('0x31')]};});_0x4f9b83['model']=_['map'](_0x2f6c21,'name');_0x4f9b83[_0x0fe3('0x32')]=_['keys'](_0x5811dc[_0x0fe3('0x32')]);_0x4f9b83[_0x0fe3('0x33')]=_[_0x0fe3('0x34')](_0x4f9b83['model'],_0x4f9b83[_0x0fe3('0x32')]);_0x4c758d['attributes']=_[_0x0fe3('0x34')](_0x4f9b83[_0x0fe3('0x35')],qs[_0x0fe3('0x36')](_0x5811dc[_0x0fe3('0x32')][_0x0fe3('0x36')]));_0x4c758d[_0x0fe3('0x37')]=_0x4c758d[_0x0fe3('0x37')][_0x0fe3('0x38')]?_0x4c758d[_0x0fe3('0x37')]:_0x4f9b83['model'];if(!_0x5811dc[_0x0fe3('0x32')][_0x0fe3('0x39')](_0x0fe3('0x3a'))){_0x4c758d[_0x0fe3('0x1f')]=qs[_0x0fe3('0x1f')](_0x5811dc[_0x0fe3('0x32')]['limit']);_0x4c758d[_0x0fe3('0x1d')]=qs[_0x0fe3('0x1d')](_0x5811dc[_0x0fe3('0x32')]['offset']);}_0x4c758d['order']=qs[_0x0fe3('0x3b')](_0x5811dc[_0x0fe3('0x32')]['sort']);_0x4c758d[_0x0fe3('0x3c')]=qs[_0x0fe3('0x33')](_[_0x0fe3('0x3d')](_0x5811dc[_0x0fe3('0x32')],_0x4f9b83[_0x0fe3('0x33')]),_0x2f6c21);if(_0x5811dc[_0x0fe3('0x32')][_0x0fe3('0x3e')]){_0x4c758d[_0x0fe3('0x3c')]=_[_0x0fe3('0x3f')](_0x4c758d[_0x0fe3('0x3c')],{'$or':_[_0x0fe3('0x2d')](_0x2f6c21,function(_0x4dd52a){if(_0x4dd52a['type']!==_0x0fe3('0x40')){var _0x166d32={};_0x166d32[_0x4dd52a['name']]={'$like':'%'+_0x5811dc[_0x0fe3('0x32')]['filter']+'%'};return _0x166d32;}})});}_0x4c758d=_[_0x0fe3('0x3f')]({},_0x4c758d,_0x5811dc[_0x0fe3('0x41')]);var _0x5d7377={'where':_0x4c758d[_0x0fe3('0x3c')]};return db['FaxTransferReport'][_0x0fe3('0x20')](_0x5d7377)['then'](function(_0xe96663){_0x3bf63f[_0x0fe3('0x20')]=_0xe96663;if(_0x5811dc['query'][_0x0fe3('0x42')]){_0x4c758d['include']=[{'all':!![]}];}return db[_0x0fe3('0x2e')][_0x0fe3('0x43')](_0x4c758d);})[_0x0fe3('0x27')](function(_0x26b8df){_0x3bf63f[_0x0fe3('0x44')]=_0x26b8df;return _0x3bf63f;})[_0x0fe3('0x27')](respondWithFilteredResult(_0x59890f,_0x4c758d))[_0x0fe3('0x45')](handleError(_0x59890f,null));};exports['show']=function(_0x575943,_0x34a17f){var _0x15edd6={'raw':!![],'where':{'id':_0x575943[_0x0fe3('0x46')]['id']}},_0x4f86a0={};_0x4f86a0[_0x0fe3('0x35')]=_['keys'](db[_0x0fe3('0x2e')]['rawAttributes']);_0x4f86a0[_0x0fe3('0x32')]=_['keys'](_0x575943[_0x0fe3('0x32')]);_0x4f86a0[_0x0fe3('0x33')]=_[_0x0fe3('0x34')](_0x4f86a0[_0x0fe3('0x35')],_0x4f86a0[_0x0fe3('0x32')]);_0x15edd6['attributes']=_[_0x0fe3('0x34')](_0x4f86a0[_0x0fe3('0x35')],qs[_0x0fe3('0x36')](_0x575943['query'][_0x0fe3('0x36')]));_0x15edd6[_0x0fe3('0x37')]=_0x15edd6[_0x0fe3('0x37')]['length']?_0x15edd6[_0x0fe3('0x37')]:_0x4f86a0[_0x0fe3('0x35')];if(_0x575943[_0x0fe3('0x32')][_0x0fe3('0x42')]){_0x15edd6[_0x0fe3('0x47')]=[{'all':!![]}];}_0x15edd6=_['merge']({},_0x15edd6,_0x575943[_0x0fe3('0x41')]);return db[_0x0fe3('0x2e')][_0x0fe3('0x48')](_0x15edd6)[_0x0fe3('0x27')](handleEntityNotFound(_0x34a17f,null))[_0x0fe3('0x27')](respondWithResult(_0x34a17f,null))[_0x0fe3('0x45')](handleError(_0x34a17f,null));};exports[_0x0fe3('0x49')]=function(_0xa9f679,_0x173cc2){return db[_0x0fe3('0x2e')][_0x0fe3('0x49')](_0xa9f679['body'],{})[_0x0fe3('0x27')](respondWithResult(_0x173cc2,0xc9))[_0x0fe3('0x45')](handleError(_0x173cc2,null));};exports[_0x0fe3('0x25')]=function(_0x4f113b,_0x2021e0){if(_0x4f113b[_0x0fe3('0x4a')]['id']){delete _0x4f113b[_0x0fe3('0x4a')]['id'];}return db[_0x0fe3('0x2e')][_0x0fe3('0x48')]({'where':{'id':_0x4f113b['params']['id']}})[_0x0fe3('0x27')](handleEntityNotFound(_0x2021e0,null))[_0x0fe3('0x27')](saveUpdates(_0x4f113b[_0x0fe3('0x4a')],null))[_0x0fe3('0x27')](respondWithResult(_0x2021e0,null))[_0x0fe3('0x45')](handleError(_0x2021e0,null));};exports[_0x0fe3('0x26')]=function(_0x50afbe,_0x28ab13){return db[_0x0fe3('0x2e')][_0x0fe3('0x48')]({'where':{'id':_0x50afbe[_0x0fe3('0x46')]['id']}})[_0x0fe3('0x27')](handleEntityNotFound(_0x28ab13,null))['then'](removeEntity(_0x28ab13,null))[_0x0fe3('0x45')](handleError(_0x28ab13,null));};exports[_0x0fe3('0x4b')]=function(_0x59d9b5,_0x4186d8){return db[_0x0fe3('0x2e')][_0x0fe3('0x4b')]()['then'](respondWithResult(_0x4186d8,null))[_0x0fe3('0x45')](handleError(_0x4186d8,null));}; \ No newline at end of file +var _0x613f=['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','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','sort','where','filters','filter','VIRTUAL','merge','FaxTransferReport','show','params','fields','includeAll','options','create','catch','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x522ff3,_0x314430){var _0x1d744e=function(_0x406c57){while(--_0x406c57){_0x522ff3['push'](_0x522ff3['shift']());}};_0x1d744e(++_0x314430);}(_0x613f,0xd2));var _0xf613=function(_0x2ed359,_0x31617b){_0x2ed359=_0x2ed359-0x0;var _0x153ae6=_0x613f[_0x2ed359];return _0x153ae6;};'use strict';var emlformat=require(_0xf613('0x0'));var rimraf=require(_0xf613('0x1'));var zipdir=require(_0xf613('0x2'));var jsonpatch=require(_0xf613('0x3'));var rp=require(_0xf613('0x4'));var moment=require(_0xf613('0x5'));var BPromise=require(_0xf613('0x6'));var Mustache=require(_0xf613('0x7'));var util=require(_0xf613('0x8'));var path=require(_0xf613('0x9'));var sox=require('sox');var csv=require(_0xf613('0xa'));var ejs=require(_0xf613('0xb'));var fs=require('fs');var fs_extra=require(_0xf613('0xc'));var _=require(_0xf613('0xd'));var squel=require(_0xf613('0xe'));var crypto=require('crypto');var jsforce=require(_0xf613('0xf'));var deskjs=require(_0xf613('0x10'));var toCsv=require(_0xf613('0xa'));var querystring=require('querystring');var Papa=require(_0xf613('0x11'));var Redis=require(_0xf613('0x12'));var authService=require(_0xf613('0x13'));var qs=require(_0xf613('0x14'));var as=require(_0xf613('0x15'));var hardwareService=require(_0xf613('0x16'));var logger=require(_0xf613('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf613('0x18'));var licenseUtil=require(_0xf613('0x19'));var db=require(_0xf613('0x1a'))['db'];function respondWithStatusCode(_0x2607a6,_0x503240){_0x503240=_0x503240||0xcc;return function(_0x5cb335){if(_0x5cb335){return _0x2607a6[_0xf613('0x1b')](_0x503240);}return _0x2607a6[_0xf613('0x1c')](_0x503240)[_0xf613('0x1d')]();};}function respondWithResult(_0xac11a6,_0xa35ba9){_0xa35ba9=_0xa35ba9||0xc8;return function(_0x5ca4db){if(_0x5ca4db){return _0xac11a6[_0xf613('0x1c')](_0xa35ba9)[_0xf613('0x1e')](_0x5ca4db);}};}function respondWithFilteredResult(_0x48c253,_0x5cdca2){return function(_0x7204fe){if(_0x7204fe){var _0x591c11=typeof _0x5cdca2[_0xf613('0x1f')]===_0xf613('0x20')&&typeof _0x5cdca2['limit']===_0xf613('0x20');var _0x45f208=_0x7204fe['count'];var _0x4b2b64=_0x591c11?0x0:_0x5cdca2[_0xf613('0x1f')];var _0xa7d9e8=_0x591c11?_0x7204fe[_0xf613('0x21')]:_0x5cdca2[_0xf613('0x1f')]+_0x5cdca2[_0xf613('0x22')];var _0x5dd27e;if(_0xa7d9e8>=_0x45f208){_0xa7d9e8=_0x45f208;_0x5dd27e=0xc8;}else{_0x5dd27e=0xce;}_0x48c253['status'](_0x5dd27e);return _0x48c253['set'](_0xf613('0x23'),_0x4b2b64+'-'+_0xa7d9e8+'/'+_0x45f208)['json'](_0x7204fe);}return null;};}function patchUpdates(_0x344cd1){return function(_0x207070){try{jsonpatch[_0xf613('0x24')](_0x207070,_0x344cd1,!![]);}catch(_0x31e49f){return BPromise[_0xf613('0x25')](_0x31e49f);}return _0x207070['save']();};}function saveUpdates(_0x3bb15f,_0x207281){return function(_0x5e2c28){if(_0x5e2c28){return _0x5e2c28['update'](_0x3bb15f)[_0xf613('0x26')](function(_0x35f434){return _0x35f434;});}return null;};}function removeEntity(_0x5203c0,_0x564c40){return function(_0x4a83d6){if(_0x4a83d6){return _0x4a83d6[_0xf613('0x27')]()[_0xf613('0x26')](function(){_0x5203c0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f5056,_0x58d8bc){return function(_0x20f1fa){if(!_0x20f1fa){_0x5f5056[_0xf613('0x1b')](0x194);}return _0x20f1fa;};}function handleError(_0x311e1d,_0x76f12){_0x76f12=_0x76f12||0x1f4;return function(_0x42c28d){logger[_0xf613('0x28')](_0x42c28d[_0xf613('0x29')]);if(_0x42c28d[_0xf613('0x2a')]){delete _0x42c28d[_0xf613('0x2a')];}_0x311e1d[_0xf613('0x1c')](_0x76f12)[_0xf613('0x2b')](_0x42c28d);};}exports[_0xf613('0x2c')]=function(_0x276609,_0x1dcba4){var _0x3e7db2={},_0x185eca={},_0x1d7eda={'count':0x0,'rows':[]};var _0x8ad756=_[_0xf613('0x2d')](db['FaxTransferReport'][_0xf613('0x2e')],function(_0xc5e826){return{'name':_0xc5e826[_0xf613('0x2f')],'type':_0xc5e826[_0xf613('0x30')][_0xf613('0x31')]};});_0x185eca[_0xf613('0x32')]=_[_0xf613('0x2d')](_0x8ad756,_0xf613('0x2a'));_0x185eca[_0xf613('0x33')]=_[_0xf613('0x34')](_0x276609['query']);_0x185eca['filters']=_[_0xf613('0x35')](_0x185eca[_0xf613('0x32')],_0x185eca[_0xf613('0x33')]);_0x3e7db2[_0xf613('0x36')]=_['intersection'](_0x185eca[_0xf613('0x32')],qs['fields'](_0x276609['query']['fields']));_0x3e7db2['attributes']=_0x3e7db2[_0xf613('0x36')][_0xf613('0x37')]?_0x3e7db2[_0xf613('0x36')]:_0x185eca['model'];if(!_0x276609[_0xf613('0x33')][_0xf613('0x38')]('nolimit')){_0x3e7db2[_0xf613('0x22')]=qs[_0xf613('0x22')](_0x276609[_0xf613('0x33')]['limit']);_0x3e7db2[_0xf613('0x1f')]=qs[_0xf613('0x1f')](_0x276609['query'][_0xf613('0x1f')]);}_0x3e7db2['order']=qs[_0xf613('0x39')](_0x276609[_0xf613('0x33')]['sort']);_0x3e7db2[_0xf613('0x3a')]=qs[_0xf613('0x3b')](_['pick'](_0x276609[_0xf613('0x33')],_0x185eca[_0xf613('0x3b')]),_0x8ad756);if(_0x276609['query'][_0xf613('0x3c')]){_0x3e7db2[_0xf613('0x3a')]=_['merge'](_0x3e7db2[_0xf613('0x3a')],{'$or':_[_0xf613('0x2d')](_0x8ad756,function(_0x4d971f){if(_0x4d971f[_0xf613('0x30')]!==_0xf613('0x3d')){var _0x5763fa={};_0x5763fa[_0x4d971f['name']]={'$like':'%'+_0x276609['query'][_0xf613('0x3c')]+'%'};return _0x5763fa;}})});}_0x3e7db2=_[_0xf613('0x3e')]({},_0x3e7db2,_0x276609['options']);var _0x39ccf0={'where':_0x3e7db2[_0xf613('0x3a')]};return db['FaxTransferReport']['count'](_0x39ccf0)[_0xf613('0x26')](function(_0x1a805d){_0x1d7eda[_0xf613('0x21')]=_0x1a805d;if(_0x276609[_0xf613('0x33')]['includeAll']){_0x3e7db2['include']=[{'all':!![]}];}return db[_0xf613('0x3f')]['findAll'](_0x3e7db2);})['then'](function(_0x2580ee){_0x1d7eda['rows']=_0x2580ee;return _0x1d7eda;})[_0xf613('0x26')](respondWithFilteredResult(_0x1dcba4,_0x3e7db2))['catch'](handleError(_0x1dcba4,null));};exports[_0xf613('0x40')]=function(_0xf750de,_0xedf3a7){var _0x23f138={'raw':!![],'where':{'id':_0xf750de[_0xf613('0x41')]['id']}},_0x2c3592={};_0x2c3592['model']=_[_0xf613('0x34')](db[_0xf613('0x3f')]['rawAttributes']);_0x2c3592['query']=_[_0xf613('0x34')](_0xf750de['query']);_0x2c3592[_0xf613('0x3b')]=_[_0xf613('0x35')](_0x2c3592[_0xf613('0x32')],_0x2c3592['query']);_0x23f138[_0xf613('0x36')]=_[_0xf613('0x35')](_0x2c3592['model'],qs[_0xf613('0x42')](_0xf750de[_0xf613('0x33')][_0xf613('0x42')]));_0x23f138[_0xf613('0x36')]=_0x23f138[_0xf613('0x36')][_0xf613('0x37')]?_0x23f138['attributes']:_0x2c3592[_0xf613('0x32')];if(_0xf750de['query'][_0xf613('0x43')]){_0x23f138['include']=[{'all':!![]}];}_0x23f138=_[_0xf613('0x3e')]({},_0x23f138,_0xf750de[_0xf613('0x44')]);return db[_0xf613('0x3f')]['find'](_0x23f138)['then'](handleEntityNotFound(_0xedf3a7,null))['then'](respondWithResult(_0xedf3a7,null))['catch'](handleError(_0xedf3a7,null));};exports['create']=function(_0x27e141,_0x1719dd){return db['FaxTransferReport'][_0xf613('0x45')](_0x27e141['body'],{})[_0xf613('0x26')](respondWithResult(_0x1719dd,0xc9))[_0xf613('0x46')](handleError(_0x1719dd,null));};exports[_0xf613('0x47')]=function(_0x4838e9,_0x24a5fa){if(_0x4838e9[_0xf613('0x48')]['id']){delete _0x4838e9[_0xf613('0x48')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x4838e9[_0xf613('0x41')]['id']}})[_0xf613('0x26')](handleEntityNotFound(_0x24a5fa,null))[_0xf613('0x26')](saveUpdates(_0x4838e9['body'],null))['then'](respondWithResult(_0x24a5fa,null))[_0xf613('0x46')](handleError(_0x24a5fa,null));};exports[_0xf613('0x27')]=function(_0x38d95f,_0x562839){return db[_0xf613('0x3f')][_0xf613('0x49')]({'where':{'id':_0x38d95f[_0xf613('0x41')]['id']}})[_0xf613('0x26')](handleEntityNotFound(_0x562839,null))[_0xf613('0x26')](removeEntity(_0x562839,null))[_0xf613('0x46')](handleError(_0x562839,null));};exports['describe']=function(_0x1b37e4,_0x4c0c8d){return db[_0xf613('0x3f')][_0xf613('0x4a')]()[_0xf613('0x26')](respondWithResult(_0x4c0c8d,null))[_0xf613('0x46')](handleError(_0x4c0c8d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 2056be0..2428447 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 _0xde1e=['../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x40d2ec,_0x4c3149){var _0x14055a=function(_0x1d223b){while(--_0x1d223b){_0x40d2ec['push'](_0x40d2ec['shift']());}};_0x14055a(++_0x4c3149);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xede1('0x0'));var util=require(_0xede1('0x1'));var logger=require(_0xede1('0x2'))(_0xede1('0x3'));var moment=require(_0xede1('0x4'));var BPromise=require(_0xede1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xede1('0x6'));var rimraf=require(_0xede1('0x7'));var config=require(_0xede1('0x8'));var attributes=require(_0xede1('0x9'));module[_0xede1('0xa')]=function(_0x3b760f,_0x4e9527){return _0x3b760f[_0xede1('0xb')](_0xede1('0xc'),attributes,{'tableName':_0xede1('0xd'),'paranoid':![],'indexes':[{'name':_0xede1('0xe'),'fields':[_0xede1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbba6=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbba6,0x1a4));var _0x6bba=function(_0x5a57d4,_0x315760){_0x5a57d4=_0x5a57d4-0x0;var _0x11f5a3=_0xbba6[_0x5a57d4];return _0x11f5a3;};'use strict';var _=require(_0x6bba('0x0'));var util=require(_0x6bba('0x1'));var logger=require(_0x6bba('0x2'))('api');var moment=require(_0x6bba('0x3'));var BPromise=require(_0x6bba('0x4'));var rp=require(_0x6bba('0x5'));var fs=require('fs');var path=require(_0x6bba('0x6'));var rimraf=require(_0x6bba('0x7'));var config=require(_0x6bba('0x8'));var attributes=require(_0x6bba('0x9'));module[_0x6bba('0xa')]=function(_0xa9f41f,_0x5d04a3){return _0xa9f41f[_0x6bba('0xb')]('FaxTransferReport',attributes,{'tableName':_0x6bba('0xc'),'paranoid':![],'indexes':[{'name':_0x6bba('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 953c379..0a85599 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 _0x92a6=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x1f31ce,_0x266e41){var _0x44de8e=function(_0x19543d){while(--_0x19543d){_0x1f31ce['push'](_0x1f31ce['shift']());}};_0x44de8e(++_0x266e41);}(_0x92a6,0x93));var _0x692a=function(_0x4cf57a,_0x145d47){_0x4cf57a=_0x4cf57a-0x0;var _0x27e457=_0x92a6[_0x4cf57a];return _0x27e457;};'use strict';var _=require('lodash');var util=require(_0x692a('0x0'));var moment=require('moment');var BPromise=require(_0x692a('0x1'));var rs=require(_0x692a('0x2'));var fs=require('fs');var Redis=require(_0x692a('0x3'));var db=require(_0x692a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x692a('0x5'))(_0x692a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x692a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15c450,_0x2d28e1,_0x1e044a){return new BPromise(function(_0x4ef572,_0x68beca){return client['request'](_0x15c450,_0x1e044a)[_0x692a('0x8')](function(_0x265d8d){logger['info'](_0x692a('0x9'),_0x2d28e1,_0x692a('0xa'));logger[_0x692a('0xb')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2d28e1,_0x692a('0xa'),JSON['stringify'](_0x265d8d));if(_0x265d8d[_0x692a('0xc')]){if(_0x265d8d[_0x692a('0xc')]['code']===0x1f4){logger['error'](_0x692a('0x9'),_0x2d28e1,_0x265d8d[_0x692a('0xc')][_0x692a('0xd')]);return _0x68beca(_0x265d8d[_0x692a('0xc')][_0x692a('0xd')]);}logger[_0x692a('0xc')](_0x692a('0x9'),_0x2d28e1,_0x265d8d[_0x692a('0xc')][_0x692a('0xd')]);return _0x4ef572(_0x265d8d['error']['message']);}else{logger['info'](_0x692a('0x9'),_0x2d28e1,_0x692a('0xa'));_0x4ef572(_0x265d8d[_0x692a('0xe')][_0x692a('0xd')]);}})[_0x692a('0xf')](function(_0x55264a){logger[_0x692a('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x2d28e1,_0x55264a);_0x68beca(_0x55264a);});});} \ No newline at end of file +var _0x1557=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x8b012e,_0x3d33bf){var _0x3b8b13=function(_0x1e2b74){while(--_0x1e2b74){_0x8b012e['push'](_0x8b012e['shift']());}};_0x3b8b13(++_0x3d33bf);}(_0x1557,0xc4));var _0x7155=function(_0x4209b4,_0x12b0ba){_0x4209b4=_0x4209b4-0x0;var _0x4eeb1a=_0x1557[_0x4209b4];return _0x4eeb1a;};'use strict';var _=require(_0x7155('0x0'));var util=require(_0x7155('0x1'));var moment=require(_0x7155('0x2'));var BPromise=require(_0x7155('0x3'));var rs=require(_0x7155('0x4'));var fs=require('fs');var Redis=require(_0x7155('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7155('0x6'));var logger=require(_0x7155('0x7'))(_0x7155('0x8'));var config=require(_0x7155('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7155('0xa')][_0x7155('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5244c4,_0xa3ea9d,_0xd80fbf){return new BPromise(function(_0x132083,_0x21c36d){return client['request'](_0x5244c4,_0xd80fbf)[_0x7155('0xc')](function(_0x5e873c){logger[_0x7155('0xd')](_0x7155('0xe'),_0xa3ea9d,_0x7155('0xf'));logger[_0x7155('0x10')](_0x7155('0x11'),_0xa3ea9d,'request\x20sent',JSON[_0x7155('0x12')](_0x5e873c));if(_0x5e873c['error']){if(_0x5e873c['error'][_0x7155('0x13')]===0x1f4){logger[_0x7155('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0xa3ea9d,_0x5e873c['error'][_0x7155('0x15')]);return _0x21c36d(_0x5e873c[_0x7155('0x14')][_0x7155('0x15')]);}logger[_0x7155('0x14')](_0x7155('0xe'),_0xa3ea9d,_0x5e873c[_0x7155('0x14')][_0x7155('0x15')]);return _0x132083(_0x5e873c[_0x7155('0x14')][_0x7155('0x15')]);}else{logger[_0x7155('0xd')](_0x7155('0xe'),_0xa3ea9d,_0x7155('0xf'));_0x132083(_0x5e873c[_0x7155('0x16')][_0x7155('0x15')]);}})[_0x7155('0x17')](function(_0x3287fb){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0xa3ea9d,_0x3287fb);_0x21c36d(_0x3287fb);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 243ca87..ba485dc 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 _0x1799=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','show','create','put','/:id','multer','util','path','connect-timeout'];(function(_0x28c870,_0x1bf349){var _0x5e4de6=function(_0x418068){while(--_0x418068){_0x28c870['push'](_0x28c870['shift']());}};_0x5e4de6(++_0x1bf349);}(_0x1799,0x172));var _0x9179=function(_0x2559bf,_0x182f9a){_0x2559bf=_0x2559bf-0x0;var _0x5808ee=_0x1799[_0x2559bf];return _0x5808ee;};'use strict';var multer=require(_0x9179('0x0'));var util=require(_0x9179('0x1'));var path=require(_0x9179('0x2'));var timeout=require(_0x9179('0x3'));var express=require('express');var router=express[_0x9179('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9179('0x5'));var interaction=require(_0x9179('0x6'));var config=require(_0x9179('0x7'));var controller=require(_0x9179('0x8'));router[_0x9179('0x9')]('/',auth[_0x9179('0xa')](),controller[_0x9179('0xb')]);router[_0x9179('0x9')](_0x9179('0xc'),auth[_0x9179('0xa')](),controller['describe']);router[_0x9179('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9179('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9179('0xe')]);router[_0x9179('0xf')](_0x9179('0x10'),auth[_0x9179('0xa')](),controller['update']);router['delete'](_0x9179('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x522d=['express','Router','fs-extra','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout'];(function(_0x12a5ac,_0x4cb0d2){var _0x282958=function(_0x3ae041){while(--_0x3ae041){_0x12a5ac['push'](_0x12a5ac['shift']());}};_0x282958(++_0x4cb0d2);}(_0x522d,0x18d));var _0xd522=function(_0x2112bf,_0x5c3711){_0x2112bf=_0x2112bf-0x0;var _0x3580c3=_0x522d[_0x2112bf];return _0x3580c3;};'use strict';var multer=require(_0xd522('0x0'));var util=require(_0xd522('0x1'));var path=require('path');var timeout=require(_0xd522('0x2'));var express=require(_0xd522('0x3'));var router=express[_0xd522('0x4')]();var fs_extra=require(_0xd522('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd522('0x6'));var controller=require(_0xd522('0x7'));router[_0xd522('0x8')]('/',auth[_0xd522('0x9')](),controller[_0xd522('0xa')]);router[_0xd522('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd522('0xb')]);router[_0xd522('0x8')]('/:id',auth[_0xd522('0x9')](),controller[_0xd522('0xc')]);router[_0xd522('0xd')]('/',auth[_0xd522('0x9')](),controller[_0xd522('0xe')]);router[_0xd522('0xf')](_0xd522('0x10'),auth[_0xd522('0x9')](),controller[_0xd522('0x11')]);router[_0xd522('0x12')](_0xd522('0x10'),auth[_0xd522('0x9')](),controller[_0xd522('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0d670f0..3b84bb5 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 _0x0f3e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x26fc81,_0x57fc19){var _0x9feece=function(_0x4344c3){while(--_0x4344c3){_0x26fc81['push'](_0x26fc81['shift']());}};_0x9feece(++_0x57fc19);}(_0x0f3e,0x1c9));var _0xe0f3=function(_0x5aa3a2,_0x3da0b4){_0x5aa3a2=_0x5aa3a2-0x0;var _0x3cde12=_0x0f3e[_0x5aa3a2];return _0x3cde12;};'use strict';var multer=require(_0xe0f3('0x0'));var util=require(_0xe0f3('0x1'));var path=require('path');var timeout=require(_0xe0f3('0x2'));var express=require('express');var router=express[_0xe0f3('0x3')]();var fs_extra=require(_0xe0f3('0x4'));var auth=require(_0xe0f3('0x5'));var interaction=require(_0xe0f3('0x6'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0xe0f3('0x7')]('/',auth[_0xe0f3('0x8')](),controller[_0xe0f3('0x9')]);router['get'](_0xe0f3('0xa'),auth[_0xe0f3('0x8')](),controller[_0xe0f3('0xb')]);router['get'](_0xe0f3('0xc'),auth[_0xe0f3('0x8')](),controller[_0xe0f3('0xd')]);router[_0xe0f3('0x7')](_0xe0f3('0xe'),auth[_0xe0f3('0x8')](),controller[_0xe0f3('0xf')]);router[_0xe0f3('0x10')]('/',auth['isAuthenticated'](),controller[_0xe0f3('0x11')]);router[_0xe0f3('0x10')](_0xe0f3('0xc'),auth[_0xe0f3('0x8')](),controller[_0xe0f3('0x12')]);router[_0xe0f3('0x13')]('/:id',auth[_0xe0f3('0x8')](),controller[_0xe0f3('0x14')]);router[_0xe0f3('0x15')](_0xe0f3('0xa'),auth['isAuthenticated'](),controller[_0xe0f3('0x16')]);module['exports']=router; \ No newline at end of file +var _0x31b4=['multer','util','path','connect-timeout','Router','../../components/auth/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x1ca726,_0x30fd0a){var _0x9d1354=function(_0x1990fb){while(--_0x1990fb){_0x1ca726['push'](_0x1ca726['shift']());}};_0x9d1354(++_0x30fd0a);}(_0x31b4,0x8a));var _0x431b=function(_0x25a420,_0x152667){_0x25a420=_0x25a420-0x0;var _0x42b1f4=_0x31b4[_0x25a420];return _0x42b1f4;};'use strict';var multer=require(_0x431b('0x0'));var util=require(_0x431b('0x1'));var path=require(_0x431b('0x2'));var timeout=require(_0x431b('0x3'));var express=require('express');var router=express[_0x431b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x431b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x431b('0x6'));router[_0x431b('0x7')]('/',auth[_0x431b('0x8')](),controller[_0x431b('0x9')]);router[_0x431b('0x7')](_0x431b('0xa'),auth[_0x431b('0x8')](),controller[_0x431b('0xb')]);router[_0x431b('0x7')](_0x431b('0xc'),auth[_0x431b('0x8')](),controller[_0x431b('0xd')]);router[_0x431b('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x431b('0xe')]);router[_0x431b('0xf')]('/',auth[_0x431b('0x8')](),controller[_0x431b('0x10')]);router[_0x431b('0xf')](_0x431b('0xc'),auth[_0x431b('0x8')](),controller[_0x431b('0x11')]);router[_0x431b('0x12')](_0x431b('0xa'),auth['isAuthenticated'](),controller[_0x431b('0x13')]);router[_0x431b('0x14')]('/:id',auth[_0x431b('0x8')](),controller[_0x431b('0x15')]);module[_0x431b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 450be99..7892826 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 _0x99cd=['ENUM','basic','integrationTab','STRING'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x99cd,0x147));var _0xd99c=function(_0x54b2b0,_0x55f332){_0x54b2b0=_0x54b2b0-0x0;var _0x1a0d6b=_0x99cd[_0x54b2b0];return _0x1a0d6b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd99c('0x0')]},'description':{'type':Sequelize[_0xd99c('0x0')]},'username':{'type':Sequelize[_0xd99c('0x0')]},'remoteUri':{'type':Sequelize[_0xd99c('0x0')]},'authType':{'type':Sequelize[_0xd99c('0x1')](_0xd99c('0x2')),'defaultValue':_0xd99c('0x2')},'password':{'type':Sequelize[_0xd99c('0x0')]},'consumerKey':{'type':Sequelize[_0xd99c('0x0')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xd99c('0x0')]},'serverUrl':{'type':Sequelize[_0xd99c('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xd99c('0x1')](_0xd99c('0x3'),'newTab'),'defaultValue':_0xd99c('0x3')}}; \ No newline at end of file +var _0x87dd=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x3e7f09,_0x1f9966){var _0x5cba40=function(_0x9c85ae){while(--_0x9c85ae){_0x3e7f09['push'](_0x3e7f09['shift']());}};_0x5cba40(++_0x1f9966);}(_0x87dd,0x6c));var _0xd87d=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x87dd[_0x2300f2];return _0x6bd508;};'use strict';var Sequelize=require(_0xd87d('0x0'));module[_0xd87d('0x1')]={'name':{'type':Sequelize[_0xd87d('0x2')]},'description':{'type':Sequelize[_0xd87d('0x2')]},'username':{'type':Sequelize[_0xd87d('0x2')]},'remoteUri':{'type':Sequelize[_0xd87d('0x2')]},'authType':{'type':Sequelize[_0xd87d('0x3')](_0xd87d('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xd87d('0x2')]},'consumerKey':{'type':Sequelize[_0xd87d('0x2')]},'consumerSecret':{'type':Sequelize[_0xd87d('0x2')]},'token':{'type':Sequelize[_0xd87d('0x2')]},'tokenSecret':{'type':Sequelize[_0xd87d('0x2')]},'serverUrl':{'type':Sequelize[_0xd87d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd87d('0x3')](_0xd87d('0x5'),_0xd87d('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index bc6bc22..fe2e52c 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 _0xca94=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','DeskAccount','findAll','catch','show','params','find','create','body','findOne','rawAttributes','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','remoteUri','username','password','consumerKey','consumerSecret','tokenSecret','slice','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','base64','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status'];(function(_0x1f34d3,_0x3e2bb7){var _0x42313a=function(_0x582bf8){while(--_0x582bf8){_0x1f34d3['push'](_0x1f34d3['shift']());}};_0x42313a(++_0x3e2bb7);}(_0xca94,0x1a7));var _0x4ca9=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xca94[_0x2cf2e9];return _0xd3670d;};'use strict';var emlformat=require(_0x4ca9('0x0'));var rimraf=require(_0x4ca9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4ca9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ca9('0x3'));var util=require('util');var path=require('path');var sox=require(_0x4ca9('0x4'));var csv=require(_0x4ca9('0x5'));var ejs=require(_0x4ca9('0x6'));var fs=require('fs');var fs_extra=require(_0x4ca9('0x7'));var _=require(_0x4ca9('0x8'));var squel=require(_0x4ca9('0x9'));var crypto=require(_0x4ca9('0xa'));var jsforce=require(_0x4ca9('0xb'));var deskjs=require(_0x4ca9('0xc'));var toCsv=require(_0x4ca9('0x5'));var querystring=require(_0x4ca9('0xd'));var Papa=require(_0x4ca9('0xe'));var Redis=require(_0x4ca9('0xf'));var authService=require(_0x4ca9('0x10'));var qs=require(_0x4ca9('0x11'));var as=require(_0x4ca9('0x12'));var hardwareService=require(_0x4ca9('0x13'));var logger=require(_0x4ca9('0x14'))(_0x4ca9('0x15'));var utils=require('../../config/utils');var config=require(_0x4ca9('0x16'));var licenseUtil=require(_0x4ca9('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x43bb2b,_0x52f827){_0x52f827=_0x52f827||0xcc;return function(_0x7bdec3){if(_0x7bdec3){return _0x43bb2b['sendStatus'](_0x52f827);}return _0x43bb2b[_0x4ca9('0x18')](_0x52f827)[_0x4ca9('0x19')]();};}function respondWithResult(_0xd215cd,_0x162732){_0x162732=_0x162732||0xc8;return function(_0x36f58a){if(_0x36f58a){return _0xd215cd[_0x4ca9('0x18')](_0x162732)[_0x4ca9('0x1a')](_0x36f58a);}};}function respondWithFilteredResult(_0xc2444d,_0x24b2e1){return function(_0x5eb80a){if(_0x5eb80a){var _0x37aade=typeof _0x24b2e1[_0x4ca9('0x1b')]===_0x4ca9('0x1c')&&typeof _0x24b2e1[_0x4ca9('0x1d')]===_0x4ca9('0x1c');var _0x18eb65=_0x5eb80a[_0x4ca9('0x1e')];var _0x2d8c1d=_0x37aade?0x0:_0x24b2e1[_0x4ca9('0x1b')];var _0x4701cc=_0x37aade?_0x5eb80a['count']:_0x24b2e1[_0x4ca9('0x1b')]+_0x24b2e1['limit'];var _0x2f495c;if(_0x4701cc>=_0x18eb65){_0x4701cc=_0x18eb65;_0x2f495c=0xc8;}else{_0x2f495c=0xce;}_0xc2444d[_0x4ca9('0x18')](_0x2f495c);return _0xc2444d[_0x4ca9('0x1f')](_0x4ca9('0x20'),_0x2d8c1d+'-'+_0x4701cc+'/'+_0x18eb65)[_0x4ca9('0x1a')](_0x5eb80a);}return null;};}function patchUpdates(_0x4e0df3){return function(_0x406a82){try{jsonpatch[_0x4ca9('0x21')](_0x406a82,_0x4e0df3,!![]);}catch(_0x39b839){return BPromise[_0x4ca9('0x22')](_0x39b839);}return _0x406a82[_0x4ca9('0x23')]();};}function saveUpdates(_0x579b36,_0x2537e4){return function(_0x51bbde){if(_0x51bbde){return _0x51bbde[_0x4ca9('0x24')](_0x579b36)[_0x4ca9('0x25')](function(_0x98498b){return _0x98498b;});}return null;};}function removeEntity(_0x1bdfb7,_0x1148bf){return function(_0x33438e){if(_0x33438e){return _0x33438e[_0x4ca9('0x26')]()[_0x4ca9('0x25')](function(){_0x1bdfb7[_0x4ca9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39ee50,_0x2024fb){return function(_0x4bfff2){if(!_0x4bfff2){_0x39ee50[_0x4ca9('0x27')](0x194);}return _0x4bfff2;};}function handleError(_0x2313bb,_0x1fd426){_0x1fd426=_0x1fd426||0x1f4;return function(_0x5b73b0){logger[_0x4ca9('0x28')](_0x5b73b0[_0x4ca9('0x29')]);if(_0x5b73b0['name']){delete _0x5b73b0[_0x4ca9('0x2a')];}_0x2313bb[_0x4ca9('0x18')](_0x1fd426)[_0x4ca9('0x2b')](_0x5b73b0);};}exports[_0x4ca9('0x2c')]=function(_0x11deb7,_0x3551b3){var _0x26653f={},_0x556a0b={},_0x18aff0={'count':0x0,'rows':[]};var _0x328e3c=_[_0x4ca9('0x2d')](db['DeskAccount']['rawAttributes'],function(_0x3aa77a){return{'name':_0x3aa77a['fieldName'],'type':_0x3aa77a[_0x4ca9('0x2e')][_0x4ca9('0x2f')]};});_0x556a0b['model']=_[_0x4ca9('0x2d')](_0x328e3c,_0x4ca9('0x2a'));_0x556a0b['query']=_[_0x4ca9('0x30')](_0x11deb7[_0x4ca9('0x31')]);_0x556a0b[_0x4ca9('0x32')]=_['intersection'](_0x556a0b[_0x4ca9('0x33')],_0x556a0b[_0x4ca9('0x31')]);_0x26653f[_0x4ca9('0x34')]=_[_0x4ca9('0x35')](_0x556a0b[_0x4ca9('0x33')],qs['fields'](_0x11deb7[_0x4ca9('0x31')][_0x4ca9('0x36')]));_0x26653f['attributes']=_0x26653f['attributes'][_0x4ca9('0x37')]?_0x26653f['attributes']:_0x556a0b[_0x4ca9('0x33')];if(!_0x11deb7['query'][_0x4ca9('0x38')](_0x4ca9('0x39'))){_0x26653f['limit']=qs['limit'](_0x11deb7['query']['limit']);_0x26653f[_0x4ca9('0x1b')]=qs[_0x4ca9('0x1b')](_0x11deb7['query']['offset']);}_0x26653f[_0x4ca9('0x3a')]=qs['sort'](_0x11deb7[_0x4ca9('0x31')][_0x4ca9('0x3b')]);_0x26653f['where']=qs[_0x4ca9('0x32')](_[_0x4ca9('0x3c')](_0x11deb7[_0x4ca9('0x31')],_0x556a0b['filters']),_0x328e3c);if(_0x11deb7[_0x4ca9('0x31')][_0x4ca9('0x3d')]){_0x26653f[_0x4ca9('0x3e')]=_[_0x4ca9('0x3f')](_0x26653f['where'],{'$or':_[_0x4ca9('0x2d')](_0x328e3c,function(_0x485da5){if(_0x485da5[_0x4ca9('0x2e')]!=='VIRTUAL'){var _0x49a3c7={};_0x49a3c7[_0x485da5[_0x4ca9('0x2a')]]={'$like':'%'+_0x11deb7[_0x4ca9('0x31')][_0x4ca9('0x3d')]+'%'};return _0x49a3c7;}})});}_0x26653f=_['merge']({},_0x26653f,_0x11deb7[_0x4ca9('0x40')]);var _0x2d74a9={'where':_0x26653f[_0x4ca9('0x3e')]};return db[_0x4ca9('0x41')][_0x4ca9('0x1e')](_0x2d74a9)[_0x4ca9('0x25')](function(_0x45d9ea){_0x18aff0[_0x4ca9('0x1e')]=_0x45d9ea;if(_0x11deb7['query']['includeAll']){_0x26653f['include']=[{'all':!![]}];}return db['DeskAccount'][_0x4ca9('0x42')](_0x26653f);})[_0x4ca9('0x25')](function(_0x5c893d){_0x18aff0['rows']=_0x5c893d;return _0x18aff0;})['then'](respondWithFilteredResult(_0x3551b3,_0x26653f))[_0x4ca9('0x43')](handleError(_0x3551b3,null));};exports[_0x4ca9('0x44')]=function(_0x351c19,_0x59ff93){var _0x2d69bf={'raw':![],'where':{'id':_0x351c19[_0x4ca9('0x45')]['id']}},_0xd41410={};_0xd41410[_0x4ca9('0x33')]=_[_0x4ca9('0x30')](db[_0x4ca9('0x41')]['rawAttributes']);_0xd41410['query']=_[_0x4ca9('0x30')](_0x351c19[_0x4ca9('0x31')]);_0xd41410[_0x4ca9('0x32')]=_[_0x4ca9('0x35')](_0xd41410[_0x4ca9('0x33')],_0xd41410[_0x4ca9('0x31')]);_0x2d69bf[_0x4ca9('0x34')]=_[_0x4ca9('0x35')](_0xd41410[_0x4ca9('0x33')],qs['fields'](_0x351c19[_0x4ca9('0x31')]['fields']));_0x2d69bf[_0x4ca9('0x34')]=_0x2d69bf[_0x4ca9('0x34')][_0x4ca9('0x37')]?_0x2d69bf[_0x4ca9('0x34')]:_0xd41410[_0x4ca9('0x33')];if(_0x351c19['query']['includeAll']){_0x2d69bf['include']=[{'all':!![]}];}_0x2d69bf=_[_0x4ca9('0x3f')]({},_0x2d69bf,_0x351c19[_0x4ca9('0x40')]);return db['DeskAccount'][_0x4ca9('0x46')](_0x2d69bf)[_0x4ca9('0x25')](handleEntityNotFound(_0x59ff93,null))[_0x4ca9('0x25')](respondWithResult(_0x59ff93,null))['catch'](handleError(_0x59ff93,null));};exports[_0x4ca9('0x47')]=function(_0x913a89,_0x7cc3e3){return db[_0x4ca9('0x41')][_0x4ca9('0x47')](_0x913a89[_0x4ca9('0x48')],{})[_0x4ca9('0x25')](respondWithResult(_0x7cc3e3,0xc9))['catch'](handleError(_0x7cc3e3,null));};exports[_0x4ca9('0x24')]=function(_0x11a971,_0x4619c2){if(_0x11a971['body']['id']){delete _0x11a971['body']['id'];}return db[_0x4ca9('0x41')]['find']({'where':{'id':_0x11a971[_0x4ca9('0x45')]['id']}})[_0x4ca9('0x25')](handleEntityNotFound(_0x4619c2,null))[_0x4ca9('0x25')](saveUpdates(_0x11a971[_0x4ca9('0x48')],null))[_0x4ca9('0x25')](respondWithResult(_0x4619c2,null))[_0x4ca9('0x43')](handleError(_0x4619c2,null));};exports[_0x4ca9('0x26')]=function(_0x376e05,_0x2cabfe){return db['DeskAccount'][_0x4ca9('0x46')]({'where':{'id':_0x376e05[_0x4ca9('0x45')]['id']}})[_0x4ca9('0x25')](handleEntityNotFound(_0x2cabfe,null))['then'](removeEntity(_0x2cabfe,null))[_0x4ca9('0x43')](handleError(_0x2cabfe,null));};exports['getConfigurations']=function(_0x371af0,_0x15ee5c,_0x11aae5){var _0x4127bb={};var _0x1e9bf1={};var _0x17b992;var _0x58745c;return db['DeskAccount'][_0x4ca9('0x49')]({'where':{'id':_0x371af0[_0x4ca9('0x45')]['id']}})['then'](handleEntityNotFound(_0x15ee5c,null))[_0x4ca9('0x25')](function(_0x53cc7f){if(_0x53cc7f){_0x17b992=_0x53cc7f;_0x1e9bf1[_0x4ca9('0x33')]=_['keys'](db['DeskConfiguration'][_0x4ca9('0x4a')]);_0x1e9bf1['query']=_[_0x4ca9('0x30')](_0x371af0['query']);_0x1e9bf1['filters']=_[_0x4ca9('0x35')](_0x1e9bf1[_0x4ca9('0x33')],_0x1e9bf1[_0x4ca9('0x31')]);_0x4127bb[_0x4ca9('0x34')]=_[_0x4ca9('0x35')](_0x1e9bf1[_0x4ca9('0x33')],qs[_0x4ca9('0x36')](_0x371af0[_0x4ca9('0x31')][_0x4ca9('0x36')]));_0x4127bb[_0x4ca9('0x34')]=_0x4127bb[_0x4ca9('0x34')]['length']?_0x4127bb['attributes']:_0x1e9bf1[_0x4ca9('0x33')];_0x4127bb[_0x4ca9('0x3a')]=qs[_0x4ca9('0x3b')](_0x371af0[_0x4ca9('0x31')]['sort']);_0x4127bb[_0x4ca9('0x3e')]=qs[_0x4ca9('0x32')](_['pick'](_0x371af0[_0x4ca9('0x31')],_0x1e9bf1[_0x4ca9('0x32')]));if(_0x371af0['query'][_0x4ca9('0x3d')]){_0x4127bb[_0x4ca9('0x3e')]=_['merge'](_0x4127bb[_0x4ca9('0x3e')],{'$or':_[_0x4ca9('0x2d')](_0x4127bb[_0x4ca9('0x34')],function(_0x43f783){var _0x29f24d={};_0x29f24d[_0x43f783]={'$like':'%'+_0x371af0[_0x4ca9('0x31')][_0x4ca9('0x3d')]+'%'};return _0x29f24d;})});}_0x4127bb=_[_0x4ca9('0x3f')]({},_0x4127bb,_0x371af0[_0x4ca9('0x40')]);return _0x17b992[_0x4ca9('0x4b')](_0x4127bb);}})[_0x4ca9('0x25')](function(_0x29e375){if(_0x29e375){_0x58745c=_0x29e375['length'];if(!_0x371af0[_0x4ca9('0x31')][_0x4ca9('0x38')]('nolimit')){_0x4127bb[_0x4ca9('0x1d')]=qs[_0x4ca9('0x1d')](_0x371af0[_0x4ca9('0x31')][_0x4ca9('0x1d')]);_0x4127bb[_0x4ca9('0x1b')]=qs[_0x4ca9('0x1b')](_0x371af0[_0x4ca9('0x31')]['offset']);}return _0x17b992[_0x4ca9('0x4b')](_0x4127bb);}})[_0x4ca9('0x25')](function(_0x3d8e12){if(_0x3d8e12){return _0x3d8e12?{'count':_0x58745c,'rows':_0x3d8e12}:null;}})[_0x4ca9('0x25')](respondWithResult(_0x15ee5c,null))[_0x4ca9('0x43')](handleError(_0x15ee5c,null));};exports[_0x4ca9('0x4c')]=function(_0x2e900f,_0x4303e7,_0x2e0d36){if(_0x2e900f[_0x4ca9('0x48')]['id']){delete _0x2e900f[_0x4ca9('0x48')]['id'];}return db[_0x4ca9('0x41')]['findOne']({'where':{'id':_0x2e900f[_0x4ca9('0x45')]['id']}})[_0x4ca9('0x25')](handleEntityNotFound(_0x4303e7,null))[_0x4ca9('0x25')](function(_0xfa873e){if(_0xfa873e){_0x2e900f['body'][_0x4ca9('0x4d')]=_0xfa873e['id'];_0x2e900f[_0x4ca9('0x48')][_0x4ca9('0x4e')]=integrations[_0x4ca9('0x4f')](_0x2e900f[_0x4ca9('0x48')][_0x4ca9('0x50')],_0x2e900f[_0x4ca9('0x48')]['type']);_0x2e900f[_0x4ca9('0x48')][_0x4ca9('0x51')]=integrations[_0x4ca9('0x52')](_0x2e900f[_0x4ca9('0x48')]['channel'],_0x2e900f['body'][_0x4ca9('0x2e')]);return db[_0x4ca9('0x53')][_0x4ca9('0x47')](_0x2e900f['body'],{'include':[{'model':db[_0x4ca9('0x54')],'as':_0x4ca9('0x4e')},{'model':db['DeskField'],'as':_0x4ca9('0x51')}]});}return null;})[_0x4ca9('0x25')](respondWithResult(_0x4303e7,null))[_0x4ca9('0x43')](handleError(_0x4303e7,null));};exports['getFields']=function(_0x5b607f,_0x1c5b09,_0x25de46){var _0x417946=[{'name':'priority','label':_0x4ca9('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x580911='';return db['DeskAccount'][_0x4ca9('0x49')]({'where':{'id':_0x5b607f[_0x4ca9('0x45')]['id']},'attributes':['id',_0x4ca9('0x56'),'authType',_0x4ca9('0x57'),_0x4ca9('0x58'),_0x4ca9('0x59'),_0x4ca9('0x5a'),'token',_0x4ca9('0x5b')]})[_0x4ca9('0x25')](handleEntityNotFound(_0x1c5b09,null))[_0x4ca9('0x25')](function(_0x1d9ab7){if(_0x1d9ab7){_0x580911=_0x1d9ab7[_0x4ca9('0x56')];var _0xc442ef=_0x580911[_0x4ca9('0x5c')](-0x1);if(_0xc442ef==='/'){_0x580911=_0x580911['substring'](0x0,_0x580911[_0x4ca9('0x5d')](_0xc442ef));}var _0x35a2ae={'method':_0x4ca9('0x5e'),'uri':util[_0x4ca9('0x5f')]('%s/custom_fields',_0x580911),'headers':{'Content-Type':_0x4ca9('0x60'),'Accept':_0x4ca9('0x60')},'json':!![]};if(_0x1d9ab7['authType']===_0x4ca9('0x61')){_0x35a2ae[_0x4ca9('0x62')][_0x4ca9('0x63')]=util['format'](_0x4ca9('0x64'),new Buffer(util[_0x4ca9('0x5f')]('%s:%s',_0x1d9ab7['username'],_0x1d9ab7[_0x4ca9('0x58')]))['toString'](_0x4ca9('0x65')));}return rp(_0x35a2ae)[_0x4ca9('0x25')](function(_0x528d96){return _0x417946[_0x4ca9('0x66')](_[_0x4ca9('0x2d')](_0x528d96[_0x4ca9('0x67')]['entries'],function(_0x54d9ee){return{'id':_0x54d9ee[_0x4ca9('0x2a')],'name':_0x54d9ee['name'],'type':_0x54d9ee[_0x4ca9('0x2e')],'active':_0x54d9ee[_0x4ca9('0x68')],'label':_0x54d9ee[_0x4ca9('0x69')],'custom':!![]};}));});}})[_0x4ca9('0x25')](function(_0x5a498d){return{'count':_0x5a498d[_0x4ca9('0x37')],'rows':_0x5a498d};})[_0x4ca9('0x25')](respondWithResult(_0x1c5b09,null))[_0x4ca9('0x43')](function(_0x104dca){var _0x1fbd30=_0x5b607f[_0x4ca9('0x31')][_0x4ca9('0x6a')]?0x1f4:_0x104dca[_0x4ca9('0x6b')]||0x1f4;logger[_0x4ca9('0x28')](_0x4ca9('0x6c'),_0x4ca9('0x6d'),_0x1fbd30,JSON[_0x4ca9('0x6e')](_0x104dca));delete _0x104dca[_0x4ca9('0x2a')];if(_0x1fbd30===0x191){_0x1fbd30=0x190;}_0x1c5b09[_0x4ca9('0x18')](_0x1fbd30)[_0x4ca9('0x2b')](_0x5b607f[_0x4ca9('0x31')][_0x4ca9('0x6a')]?{'message':_0x4ca9('0x6f'),'statusCode':_0x104dca[_0x4ca9('0x6b')]}:_0x104dca);});}; \ No newline at end of file +var _0x272f=['where','VIRTUAL','DeskAccount','count','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','order','options','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','basic','headers','Authorization','toString','base64','_embedded','entries','active','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','then','destroy','stack','name','send','index','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge'];(function(_0x52bc6a,_0x185105){var _0x1c2562=function(_0x1c6a0a){while(--_0x1c6a0a){_0x52bc6a['push'](_0x52bc6a['shift']());}};_0x1c2562(++_0x185105);}(_0x272f,0x119));var _0xf272=function(_0x4b31e3,_0x17fd2e){_0x4b31e3=_0x4b31e3-0x0;var _0x3672e8=_0x272f[_0x4b31e3];return _0x3672e8;};'use strict';var emlformat=require(_0xf272('0x0'));var rimraf=require(_0xf272('0x1'));var zipdir=require(_0xf272('0x2'));var jsonpatch=require(_0xf272('0x3'));var rp=require(_0xf272('0x4'));var moment=require(_0xf272('0x5'));var BPromise=require(_0xf272('0x6'));var Mustache=require(_0xf272('0x7'));var util=require(_0xf272('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf272('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf272('0xa'));var crypto=require(_0xf272('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf272('0xc'));var Papa=require(_0xf272('0xd'));var Redis=require(_0xf272('0xe'));var authService=require(_0xf272('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf272('0x10'));var hardwareService=require(_0xf272('0x11'));var logger=require(_0xf272('0x12'))('api');var utils=require(_0xf272('0x13'));var config=require(_0xf272('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf272('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1a3fe0,_0x4fdfb1){_0x4fdfb1=_0x4fdfb1||0xcc;return function(_0x568b71){if(_0x568b71){return _0x1a3fe0[_0xf272('0x16')](_0x4fdfb1);}return _0x1a3fe0[_0xf272('0x17')](_0x4fdfb1)[_0xf272('0x18')]();};}function respondWithResult(_0x2a4d74,_0x5582a6){_0x5582a6=_0x5582a6||0xc8;return function(_0x207401){if(_0x207401){return _0x2a4d74['status'](_0x5582a6)[_0xf272('0x19')](_0x207401);}};}function respondWithFilteredResult(_0x3a27a0,_0x1cf4d4){return function(_0x783ebb){if(_0x783ebb){var _0x1fc7f3=typeof _0x1cf4d4[_0xf272('0x1a')]===_0xf272('0x1b')&&typeof _0x1cf4d4[_0xf272('0x1c')]===_0xf272('0x1b');var _0x509685=_0x783ebb['count'];var _0x7662fc=_0x1fc7f3?0x0:_0x1cf4d4[_0xf272('0x1a')];var _0x4a2547=_0x1fc7f3?_0x783ebb['count']:_0x1cf4d4['offset']+_0x1cf4d4[_0xf272('0x1c')];var _0x410e25;if(_0x4a2547>=_0x509685){_0x4a2547=_0x509685;_0x410e25=0xc8;}else{_0x410e25=0xce;}_0x3a27a0['status'](_0x410e25);return _0x3a27a0[_0xf272('0x1d')]('Content-Range',_0x7662fc+'-'+_0x4a2547+'/'+_0x509685)['json'](_0x783ebb);}return null;};}function patchUpdates(_0x4bda34){return function(_0x206455){try{jsonpatch[_0xf272('0x1e')](_0x206455,_0x4bda34,!![]);}catch(_0x448afd){return BPromise['reject'](_0x448afd);}return _0x206455[_0xf272('0x1f')]();};}function saveUpdates(_0x31cc88,_0x4aa384){return function(_0x5a5309){if(_0x5a5309){return _0x5a5309[_0xf272('0x20')](_0x31cc88)[_0xf272('0x21')](function(_0x2a7546){return _0x2a7546;});}return null;};}function removeEntity(_0x2100fe,_0x549a90){return function(_0x343ed0){if(_0x343ed0){return _0x343ed0[_0xf272('0x22')]()[_0xf272('0x21')](function(){_0x2100fe[_0xf272('0x17')](0xcc)[_0xf272('0x18')]();});}};}function handleEntityNotFound(_0x1a5c7a,_0x5da0a7){return function(_0x2c8864){if(!_0x2c8864){_0x1a5c7a[_0xf272('0x16')](0x194);}return _0x2c8864;};}function handleError(_0xc8baee,_0x285858){_0x285858=_0x285858||0x1f4;return function(_0xf74be4){logger['error'](_0xf74be4[_0xf272('0x23')]);if(_0xf74be4[_0xf272('0x24')]){delete _0xf74be4[_0xf272('0x24')];}_0xc8baee[_0xf272('0x17')](_0x285858)[_0xf272('0x25')](_0xf74be4);};}exports[_0xf272('0x26')]=function(_0x4a046c,_0x223455){var _0x3a4fab={},_0x57903c={},_0x12cb69={'count':0x0,'rows':[]};var _0x30851e=_['map'](db['DeskAccount']['rawAttributes'],function(_0x5dd878){return{'name':_0x5dd878[_0xf272('0x27')],'type':_0x5dd878[_0xf272('0x28')]['key']};});_0x57903c[_0xf272('0x29')]=_[_0xf272('0x2a')](_0x30851e,_0xf272('0x24'));_0x57903c['query']=_[_0xf272('0x2b')](_0x4a046c[_0xf272('0x2c')]);_0x57903c[_0xf272('0x2d')]=_[_0xf272('0x2e')](_0x57903c['model'],_0x57903c[_0xf272('0x2c')]);_0x3a4fab[_0xf272('0x2f')]=_['intersection'](_0x57903c[_0xf272('0x29')],qs[_0xf272('0x30')](_0x4a046c[_0xf272('0x2c')][_0xf272('0x30')]));_0x3a4fab[_0xf272('0x2f')]=_0x3a4fab[_0xf272('0x2f')][_0xf272('0x31')]?_0x3a4fab[_0xf272('0x2f')]:_0x57903c['model'];if(!_0x4a046c['query']['hasOwnProperty'](_0xf272('0x32'))){_0x3a4fab['limit']=qs[_0xf272('0x1c')](_0x4a046c[_0xf272('0x2c')]['limit']);_0x3a4fab[_0xf272('0x1a')]=qs[_0xf272('0x1a')](_0x4a046c['query'][_0xf272('0x1a')]);}_0x3a4fab['order']=qs[_0xf272('0x33')](_0x4a046c[_0xf272('0x2c')][_0xf272('0x33')]);_0x3a4fab['where']=qs[_0xf272('0x2d')](_[_0xf272('0x34')](_0x4a046c['query'],_0x57903c[_0xf272('0x2d')]),_0x30851e);if(_0x4a046c[_0xf272('0x2c')][_0xf272('0x35')]){_0x3a4fab['where']=_[_0xf272('0x36')](_0x3a4fab[_0xf272('0x37')],{'$or':_[_0xf272('0x2a')](_0x30851e,function(_0x3f8861){if(_0x3f8861[_0xf272('0x28')]!==_0xf272('0x38')){var _0x18e36b={};_0x18e36b[_0x3f8861[_0xf272('0x24')]]={'$like':'%'+_0x4a046c[_0xf272('0x2c')][_0xf272('0x35')]+'%'};return _0x18e36b;}})});}_0x3a4fab=_[_0xf272('0x36')]({},_0x3a4fab,_0x4a046c['options']);var _0x4d887b={'where':_0x3a4fab[_0xf272('0x37')]};return db[_0xf272('0x39')]['count'](_0x4d887b)[_0xf272('0x21')](function(_0x37d6a5){_0x12cb69[_0xf272('0x3a')]=_0x37d6a5;if(_0x4a046c[_0xf272('0x2c')][_0xf272('0x3b')]){_0x3a4fab[_0xf272('0x3c')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x3a4fab);})[_0xf272('0x21')](function(_0x8e011e){_0x12cb69[_0xf272('0x3d')]=_0x8e011e;return _0x12cb69;})[_0xf272('0x21')](respondWithFilteredResult(_0x223455,_0x3a4fab))['catch'](handleError(_0x223455,null));};exports[_0xf272('0x3e')]=function(_0x44a24e,_0x47d190){var _0x51e67d={'raw':![],'where':{'id':_0x44a24e[_0xf272('0x3f')]['id']}},_0x21f4ff={};_0x21f4ff[_0xf272('0x29')]=_[_0xf272('0x2b')](db[_0xf272('0x39')][_0xf272('0x40')]);_0x21f4ff[_0xf272('0x2c')]=_[_0xf272('0x2b')](_0x44a24e['query']);_0x21f4ff[_0xf272('0x2d')]=_['intersection'](_0x21f4ff[_0xf272('0x29')],_0x21f4ff[_0xf272('0x2c')]);_0x51e67d[_0xf272('0x2f')]=_['intersection'](_0x21f4ff[_0xf272('0x29')],qs[_0xf272('0x30')](_0x44a24e['query'][_0xf272('0x30')]));_0x51e67d[_0xf272('0x2f')]=_0x51e67d[_0xf272('0x2f')][_0xf272('0x31')]?_0x51e67d[_0xf272('0x2f')]:_0x21f4ff[_0xf272('0x29')];if(_0x44a24e['query']['includeAll']){_0x51e67d[_0xf272('0x3c')]=[{'all':!![]}];}_0x51e67d=_[_0xf272('0x36')]({},_0x51e67d,_0x44a24e['options']);return db[_0xf272('0x39')][_0xf272('0x41')](_0x51e67d)[_0xf272('0x21')](handleEntityNotFound(_0x47d190,null))[_0xf272('0x21')](respondWithResult(_0x47d190,null))[_0xf272('0x42')](handleError(_0x47d190,null));};exports[_0xf272('0x43')]=function(_0x21f3c4,_0x1ff3e7){return db[_0xf272('0x39')]['create'](_0x21f3c4[_0xf272('0x44')],{})[_0xf272('0x21')](respondWithResult(_0x1ff3e7,0xc9))[_0xf272('0x42')](handleError(_0x1ff3e7,null));};exports[_0xf272('0x20')]=function(_0x479c7b,_0xdc2f4a){if(_0x479c7b[_0xf272('0x44')]['id']){delete _0x479c7b[_0xf272('0x44')]['id'];}return db[_0xf272('0x39')][_0xf272('0x41')]({'where':{'id':_0x479c7b[_0xf272('0x3f')]['id']}})[_0xf272('0x21')](handleEntityNotFound(_0xdc2f4a,null))[_0xf272('0x21')](saveUpdates(_0x479c7b[_0xf272('0x44')],null))[_0xf272('0x21')](respondWithResult(_0xdc2f4a,null))[_0xf272('0x42')](handleError(_0xdc2f4a,null));};exports[_0xf272('0x22')]=function(_0x1497f4,_0x5bb5e2){return db[_0xf272('0x39')][_0xf272('0x41')]({'where':{'id':_0x1497f4[_0xf272('0x3f')]['id']}})[_0xf272('0x21')](handleEntityNotFound(_0x5bb5e2,null))[_0xf272('0x21')](removeEntity(_0x5bb5e2,null))[_0xf272('0x42')](handleError(_0x5bb5e2,null));};exports[_0xf272('0x45')]=function(_0x3fc3e9,_0x1b42b6,_0x42bdb0){var _0x544a5e={};var _0x5ef7d8={};var _0x21c4dd;var _0xf78fcc;return db['DeskAccount'][_0xf272('0x46')]({'where':{'id':_0x3fc3e9['params']['id']}})[_0xf272('0x21')](handleEntityNotFound(_0x1b42b6,null))[_0xf272('0x21')](function(_0x344b21){if(_0x344b21){_0x21c4dd=_0x344b21;_0x5ef7d8[_0xf272('0x29')]=_['keys'](db[_0xf272('0x47')][_0xf272('0x40')]);_0x5ef7d8['query']=_['keys'](_0x3fc3e9['query']);_0x5ef7d8['filters']=_[_0xf272('0x2e')](_0x5ef7d8[_0xf272('0x29')],_0x5ef7d8[_0xf272('0x2c')]);_0x544a5e[_0xf272('0x2f')]=_[_0xf272('0x2e')](_0x5ef7d8[_0xf272('0x29')],qs[_0xf272('0x30')](_0x3fc3e9['query'][_0xf272('0x30')]));_0x544a5e[_0xf272('0x2f')]=_0x544a5e[_0xf272('0x2f')]['length']?_0x544a5e['attributes']:_0x5ef7d8['model'];_0x544a5e[_0xf272('0x48')]=qs[_0xf272('0x33')](_0x3fc3e9[_0xf272('0x2c')][_0xf272('0x33')]);_0x544a5e[_0xf272('0x37')]=qs['filters'](_[_0xf272('0x34')](_0x3fc3e9[_0xf272('0x2c')],_0x5ef7d8['filters']));if(_0x3fc3e9[_0xf272('0x2c')]['filter']){_0x544a5e['where']=_[_0xf272('0x36')](_0x544a5e[_0xf272('0x37')],{'$or':_[_0xf272('0x2a')](_0x544a5e[_0xf272('0x2f')],function(_0x186cc0){var _0xb03080={};_0xb03080[_0x186cc0]={'$like':'%'+_0x3fc3e9[_0xf272('0x2c')][_0xf272('0x35')]+'%'};return _0xb03080;})});}_0x544a5e=_['merge']({},_0x544a5e,_0x3fc3e9[_0xf272('0x49')]);return _0x21c4dd['getConfigurations'](_0x544a5e);}})[_0xf272('0x21')](function(_0x4221f2){if(_0x4221f2){_0xf78fcc=_0x4221f2['length'];if(!_0x3fc3e9[_0xf272('0x2c')][_0xf272('0x4a')]('nolimit')){_0x544a5e[_0xf272('0x1c')]=qs['limit'](_0x3fc3e9[_0xf272('0x2c')][_0xf272('0x1c')]);_0x544a5e['offset']=qs[_0xf272('0x1a')](_0x3fc3e9['query'][_0xf272('0x1a')]);}return _0x21c4dd[_0xf272('0x45')](_0x544a5e);}})[_0xf272('0x21')](function(_0x27ab5c){if(_0x27ab5c){return _0x27ab5c?{'count':_0xf78fcc,'rows':_0x27ab5c}:null;}})[_0xf272('0x21')](respondWithResult(_0x1b42b6,null))[_0xf272('0x42')](handleError(_0x1b42b6,null));};exports[_0xf272('0x4b')]=function(_0x50c1d9,_0x1d4680,_0x19b282){if(_0x50c1d9[_0xf272('0x44')]['id']){delete _0x50c1d9[_0xf272('0x44')]['id'];}return db['DeskAccount'][_0xf272('0x46')]({'where':{'id':_0x50c1d9[_0xf272('0x3f')]['id']}})[_0xf272('0x21')](handleEntityNotFound(_0x1d4680,null))[_0xf272('0x21')](function(_0x2560ad){if(_0x2560ad){_0x50c1d9['body'][_0xf272('0x4c')]=_0x2560ad['id'];_0x50c1d9[_0xf272('0x44')]['Subjects']=integrations[_0xf272('0x4d')](_0x50c1d9[_0xf272('0x44')][_0xf272('0x4e')],_0x50c1d9[_0xf272('0x44')][_0xf272('0x28')]);_0x50c1d9[_0xf272('0x44')][_0xf272('0x4f')]=integrations[_0xf272('0x50')](_0x50c1d9[_0xf272('0x44')][_0xf272('0x4e')],_0x50c1d9[_0xf272('0x44')][_0xf272('0x28')]);return db[_0xf272('0x47')][_0xf272('0x43')](_0x50c1d9[_0xf272('0x44')],{'include':[{'model':db['DeskField'],'as':_0xf272('0x51')},{'model':db['DeskField'],'as':_0xf272('0x4f')}]});}return null;})[_0xf272('0x21')](respondWithResult(_0x1d4680,null))[_0xf272('0x42')](handleError(_0x1d4680,null));};exports[_0xf272('0x52')]=function(_0x23c38f,_0x4c503e,_0x4e189a){var _0x4e3446=[{'name':'priority','label':_0xf272('0x53'),'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 _0x70fcf4='';return db['DeskAccount'][_0xf272('0x46')]({'where':{'id':_0x23c38f[_0xf272('0x3f')]['id']},'attributes':['id',_0xf272('0x54'),_0xf272('0x55'),_0xf272('0x56'),_0xf272('0x57'),_0xf272('0x58'),_0xf272('0x59'),_0xf272('0x5a'),_0xf272('0x5b')]})[_0xf272('0x21')](handleEntityNotFound(_0x4c503e,null))['then'](function(_0x286d92){if(_0x286d92){_0x70fcf4=_0x286d92[_0xf272('0x54')];var _0x69aa4a=_0x70fcf4[_0xf272('0x5c')](-0x1);if(_0x69aa4a==='/'){_0x70fcf4=_0x70fcf4[_0xf272('0x5d')](0x0,_0x70fcf4[_0xf272('0x5e')](_0x69aa4a));}var _0x4eec6d={'method':_0xf272('0x5f'),'uri':util[_0xf272('0x60')](_0xf272('0x61'),_0x70fcf4),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x286d92['authType']===_0xf272('0x62')){_0x4eec6d[_0xf272('0x63')][_0xf272('0x64')]=util[_0xf272('0x60')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x286d92[_0xf272('0x56')],_0x286d92[_0xf272('0x57')]))[_0xf272('0x65')](_0xf272('0x66')));}return rp(_0x4eec6d)[_0xf272('0x21')](function(_0x15e8ab){return _0x4e3446['concat'](_[_0xf272('0x2a')](_0x15e8ab[_0xf272('0x67')][_0xf272('0x68')],function(_0x5b9c27){return{'id':_0x5b9c27[_0xf272('0x24')],'name':_0x5b9c27[_0xf272('0x24')],'type':_0x5b9c27[_0xf272('0x28')],'active':_0x5b9c27[_0xf272('0x69')],'label':_0x5b9c27['label'],'custom':!![]};}));});}})[_0xf272('0x21')](function(_0x31cdda){return{'count':_0x31cdda[_0xf272('0x31')],'rows':_0x31cdda};})[_0xf272('0x21')](respondWithResult(_0x4c503e,null))[_0xf272('0x42')](function(_0x12ce39){var _0x166b34=_0x23c38f[_0xf272('0x2c')][_0xf272('0x6a')]?0x1f4:_0x12ce39['statusCode']||0x1f4;logger[_0xf272('0x6b')](_0xf272('0x6c'),_0xf272('0x52'),_0x166b34,JSON[_0xf272('0x6d')](_0x12ce39));delete _0x12ce39['name'];if(_0x166b34===0x191){_0x166b34=0x190;}_0x4c503e[_0xf272('0x17')](_0x166b34)[_0xf272('0x25')](_0x23c38f[_0xf272('0x2c')][_0xf272('0x6a')]?{'message':_0xf272('0x6e'),'statusCode':_0x12ce39[_0xf272('0x6f')]}:_0x12ce39);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3bc76e3..f21128f 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 _0xbd70=['path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0xbd70,0x111));var _0x0bd7=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xbd70[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x0bd7('0x0'));var util=require(_0x0bd7('0x1'));var logger=require(_0x0bd7('0x2'))(_0x0bd7('0x3'));var moment=require(_0x0bd7('0x4'));var BPromise=require(_0x0bd7('0x5'));var rp=require(_0x0bd7('0x6'));var fs=require('fs');var path=require(_0x0bd7('0x7'));var rimraf=require('rimraf');var config=require(_0x0bd7('0x8'));var attributes=require(_0x0bd7('0x9'));var integrations=require(_0x0bd7('0xa'));module[_0x0bd7('0xb')]=function(_0x1ac76d,_0x1145b3){return _0x1ac76d[_0x0bd7('0xc')](_0x0bd7('0xd'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4083=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts'];(function(_0xc263fd,_0x3e0ad1){var _0x2d09f7=function(_0x333bc4){while(--_0x333bc4){_0xc263fd['push'](_0xc263fd['shift']());}};_0x2d09f7(++_0x3e0ad1);}(_0x4083,0x1ad));var _0x3408=function(_0x4aca2e,_0x416ca1){_0x4aca2e=_0x4aca2e-0x0;var _0x199541=_0x4083[_0x4aca2e];return _0x199541;};'use strict';var _=require(_0x3408('0x0'));var util=require(_0x3408('0x1'));var logger=require('../../config/logger')(_0x3408('0x2'));var moment=require(_0x3408('0x3'));var BPromise=require(_0x3408('0x4'));var rp=require(_0x3408('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3408('0x6'));var config=require(_0x3408('0x7'));var attributes=require(_0x3408('0x8'));var integrations=require(_0x3408('0x9'));module['exports']=function(_0x629b24,_0x5e0556){return _0x629b24[_0x3408('0xa')](_0x3408('0xb'),attributes,{'tableName':_0x3408('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 e6045c8..ac2e073 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 _0x1f04=['limit','map','model','include','find','ShowDeskAccount','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes'];(function(_0x23b980,_0x57697f){var _0x475354=function(_0x3ee3fb){while(--_0x3ee3fb){_0x23b980['push'](_0x23b980['shift']());}};_0x475354(++_0x57697f);}(_0x1f04,0x171));var _0x41f0=function(_0x211e15,_0x395d76){_0x211e15=_0x211e15-0x0;var _0x563752=_0x1f04[_0x211e15];return _0x563752;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x41f0('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41f0('0x1'));var db=require(_0x41f0('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x41f0('0x3'))(_0x41f0('0x4'));var config=require(_0x41f0('0x5'));var jayson=require(_0x41f0('0x6'));var client=jayson[_0x41f0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc0f168,_0x37dc8e,_0x514b92){return new BPromise(function(_0x3f8bcc,_0x517a28){return client['request'](_0xc0f168,_0x514b92)[_0x41f0('0x8')](function(_0x57af0c){logger['info'](_0x41f0('0x9'),_0x37dc8e,_0x41f0('0xa'));logger[_0x41f0('0xb')](_0x41f0('0xc'),_0x37dc8e,_0x41f0('0xa'),JSON[_0x41f0('0xd')](_0x57af0c));if(_0x57af0c[_0x41f0('0xe')]){if(_0x57af0c[_0x41f0('0xe')][_0x41f0('0xf')]===0x1f4){logger[_0x41f0('0xe')](_0x41f0('0x9'),_0x37dc8e,_0x57af0c['error']['message']);return _0x517a28(_0x57af0c['error'][_0x41f0('0x10')]);}logger[_0x41f0('0xe')](_0x41f0('0x9'),_0x37dc8e,_0x57af0c[_0x41f0('0xe')]['message']);return _0x3f8bcc(_0x57af0c[_0x41f0('0xe')][_0x41f0('0x10')]);}else{logger[_0x41f0('0x11')](_0x41f0('0x9'),_0x37dc8e,'request\x20sent');_0x3f8bcc(_0x57af0c[_0x41f0('0x12')][_0x41f0('0x10')]);}})[_0x41f0('0x13')](function(_0x176582){logger[_0x41f0('0xe')]('DeskAccount,\x20%s,\x20%s',_0x37dc8e,_0x176582);_0x517a28(_0x176582);});});}exports[_0x41f0('0x14')]=function(_0x111f13){var _0x334778=this;return new Promise(function(_0xf35551,_0x29e118){return db[_0x41f0('0x15')][_0x41f0('0x16')]({'raw':_0x111f13[_0x41f0('0x17')]?_0x111f13[_0x41f0('0x17')][_0x41f0('0x18')]===undefined?!![]:![]:!![],'where':_0x111f13['options']?_0x111f13[_0x41f0('0x17')][_0x41f0('0x19')]||null:null,'attributes':_0x111f13[_0x41f0('0x17')]?_0x111f13[_0x41f0('0x17')][_0x41f0('0x1a')]||null:null,'limit':_0x111f13[_0x41f0('0x17')]?_0x111f13[_0x41f0('0x17')][_0x41f0('0x1b')]||null:null,'include':_0x111f13[_0x41f0('0x17')]?_0x111f13[_0x41f0('0x17')]['include']?_[_0x41f0('0x1c')](_0x111f13[_0x41f0('0x17')]['include'],function(_0xbe2ef8){return{'model':db[_0xbe2ef8[_0x41f0('0x1d')]],'as':_0xbe2ef8['as'],'attributes':_0xbe2ef8['attributes'],'include':_0xbe2ef8[_0x41f0('0x1e')]?_[_0x41f0('0x1c')](_0xbe2ef8[_0x41f0('0x1e')],function(_0x5be92e){return{'model':db[_0x5be92e['model']],'as':_0x5be92e['as'],'attributes':_0x5be92e[_0x41f0('0x1a')],'include':_0x5be92e[_0x41f0('0x1e')]?_['map'](_0x5be92e[_0x41f0('0x1e')],function(_0x1242b9){return{'model':db[_0x1242b9[_0x41f0('0x1d')]],'as':_0x1242b9['as'],'attributes':_0x1242b9[_0x41f0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x41f0('0x8')](function(_0x195490){logger[_0x41f0('0x11')](_0x41f0('0x14'),_0x111f13);logger[_0x41f0('0xb')](_0x41f0('0x14'),_0x111f13,JSON[_0x41f0('0xd')](_0x195490));_0xf35551(_0x195490);})[_0x41f0('0x13')](function(_0x1fbc5a){logger[_0x41f0('0xe')](_0x41f0('0x14'),_0x1fbc5a[_0x41f0('0x10')],_0x111f13);_0x29e118(_0x334778[_0x41f0('0xe')](0x1f4,_0x1fbc5a[_0x41f0('0x10')]));});});};exports['ShowDeskAccount']=function(_0x5cb3e3){var _0x4ec93e=this;return new Promise(function(_0x5c61ec,_0xcea0a7){return db[_0x41f0('0x15')][_0x41f0('0x1f')]({'raw':_0x5cb3e3[_0x41f0('0x17')]?_0x5cb3e3[_0x41f0('0x17')][_0x41f0('0x18')]===undefined?!![]:![]:!![],'where':_0x5cb3e3[_0x41f0('0x17')]?_0x5cb3e3['options']['where']||null:null,'attributes':_0x5cb3e3[_0x41f0('0x17')]?_0x5cb3e3[_0x41f0('0x17')][_0x41f0('0x1a')]||null:null,'include':_0x5cb3e3[_0x41f0('0x17')]?_0x5cb3e3['options']['include']?_[_0x41f0('0x1c')](_0x5cb3e3[_0x41f0('0x17')][_0x41f0('0x1e')],function(_0x3a854c){return{'model':db[_0x3a854c[_0x41f0('0x1d')]],'as':_0x3a854c['as'],'attributes':_0x3a854c[_0x41f0('0x1a')],'include':_0x3a854c['include']?_[_0x41f0('0x1c')](_0x3a854c[_0x41f0('0x1e')],function(_0xe49746){return{'model':db[_0xe49746['model']],'as':_0xe49746['as'],'attributes':_0xe49746[_0x41f0('0x1a')],'include':_0xe49746['include']?_['map'](_0xe49746[_0x41f0('0x1e')],function(_0xb8c3f2){return{'model':db[_0xb8c3f2[_0x41f0('0x1d')]],'as':_0xb8c3f2['as'],'attributes':_0xb8c3f2[_0x41f0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a6fed){logger[_0x41f0('0x11')](_0x41f0('0x20'),_0x5cb3e3);logger[_0x41f0('0xb')](_0x41f0('0x20'),_0x5cb3e3,JSON[_0x41f0('0xd')](_0x1a6fed));_0x5c61ec(_0x1a6fed);})[_0x41f0('0x13')](function(_0x373e14){logger['error'](_0x41f0('0x20'),_0x373e14[_0x41f0('0x10')],_0x5cb3e3);_0xcea0a7(_0x4ec93e[_0x41f0('0xe')](0x1f4,_0x373e14[_0x41f0('0x10')]));});});}; \ No newline at end of file +var _0x6930=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','DeskAccount,\x20%s,\x20%s','message','result','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','GetDeskAccount','catch','ShowDeskAccount','find','map','stringify','lodash'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x6930,0x65));var _0x0693=function(_0x36748e,_0x5259a5){_0x36748e=_0x36748e-0x0;var _0x1b027e=_0x6930[_0x36748e];return _0x1b027e;};'use strict';var _=require(_0x0693('0x0'));var util=require(_0x0693('0x1'));var moment=require(_0x0693('0x2'));var BPromise=require(_0x0693('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0693('0x4'))['db'];var utils=require(_0x0693('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0693('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0693('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x97d78,_0x16509c,_0x85da2b){return new BPromise(function(_0x5bc464,_0x251a71){return client[_0x0693('0x8')](_0x97d78,_0x85da2b)[_0x0693('0x9')](function(_0x17e66d){logger[_0x0693('0xa')]('DeskAccount,\x20%s,\x20%s',_0x16509c,'request\x20sent');logger[_0x0693('0xb')](_0x0693('0xc'),_0x16509c,_0x0693('0xd'),JSON['stringify'](_0x17e66d));if(_0x17e66d[_0x0693('0xe')]){if(_0x17e66d['error'][_0x0693('0xf')]===0x1f4){logger['error'](_0x0693('0x10'),_0x16509c,_0x17e66d[_0x0693('0xe')][_0x0693('0x11')]);return _0x251a71(_0x17e66d[_0x0693('0xe')][_0x0693('0x11')]);}logger[_0x0693('0xe')](_0x0693('0x10'),_0x16509c,_0x17e66d[_0x0693('0xe')][_0x0693('0x11')]);return _0x5bc464(_0x17e66d[_0x0693('0xe')][_0x0693('0x11')]);}else{logger[_0x0693('0xa')](_0x0693('0x10'),_0x16509c,_0x0693('0xd'));_0x5bc464(_0x17e66d[_0x0693('0x12')]['message']);}})['catch'](function(_0x22ab23){logger['error'](_0x0693('0x10'),_0x16509c,_0x22ab23);_0x251a71(_0x22ab23);});});}exports['GetDeskAccount']=function(_0x21a1d9){var _0xd6802c=this;return new Promise(function(_0x2f90be,_0xf86695){return db[_0x0693('0x13')][_0x0693('0x14')]({'raw':_0x21a1d9['options']?_0x21a1d9[_0x0693('0x15')][_0x0693('0x16')]===undefined?!![]:![]:!![],'where':_0x21a1d9[_0x0693('0x15')]?_0x21a1d9['options'][_0x0693('0x17')]||null:null,'attributes':_0x21a1d9['options']?_0x21a1d9['options'][_0x0693('0x18')]||null:null,'limit':_0x21a1d9[_0x0693('0x15')]?_0x21a1d9[_0x0693('0x15')][_0x0693('0x19')]||null:null,'include':_0x21a1d9[_0x0693('0x15')]?_0x21a1d9[_0x0693('0x15')][_0x0693('0x1a')]?_['map'](_0x21a1d9['options'][_0x0693('0x1a')],function(_0x272a23){return{'model':db[_0x272a23[_0x0693('0x1b')]],'as':_0x272a23['as'],'attributes':_0x272a23['attributes'],'include':_0x272a23[_0x0693('0x1a')]?_['map'](_0x272a23['include'],function(_0xc979e7){return{'model':db[_0xc979e7[_0x0693('0x1b')]],'as':_0xc979e7['as'],'attributes':_0xc979e7[_0x0693('0x18')],'include':_0xc979e7[_0x0693('0x1a')]?_['map'](_0xc979e7[_0x0693('0x1a')],function(_0x20312c){return{'model':db[_0x20312c[_0x0693('0x1b')]],'as':_0x20312c['as'],'attributes':_0x20312c[_0x0693('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0693('0x9')](function(_0x5480a4){logger[_0x0693('0xa')](_0x0693('0x1c'),_0x21a1d9);logger[_0x0693('0xb')](_0x0693('0x1c'),_0x21a1d9,JSON['stringify'](_0x5480a4));_0x2f90be(_0x5480a4);})[_0x0693('0x1d')](function(_0x456f03){logger['error'](_0x0693('0x1c'),_0x456f03[_0x0693('0x11')],_0x21a1d9);_0xf86695(_0xd6802c['error'](0x1f4,_0x456f03[_0x0693('0x11')]));});});};exports[_0x0693('0x1e')]=function(_0x5a75a5){var _0x4d50df=this;return new Promise(function(_0x2e099f,_0x65b5c5){return db['DeskAccount'][_0x0693('0x1f')]({'raw':_0x5a75a5[_0x0693('0x15')]?_0x5a75a5[_0x0693('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a75a5[_0x0693('0x15')]?_0x5a75a5[_0x0693('0x15')][_0x0693('0x17')]||null:null,'attributes':_0x5a75a5[_0x0693('0x15')]?_0x5a75a5[_0x0693('0x15')][_0x0693('0x18')]||null:null,'include':_0x5a75a5[_0x0693('0x15')]?_0x5a75a5[_0x0693('0x15')][_0x0693('0x1a')]?_[_0x0693('0x20')](_0x5a75a5[_0x0693('0x15')][_0x0693('0x1a')],function(_0x87f4b6){return{'model':db[_0x87f4b6['model']],'as':_0x87f4b6['as'],'attributes':_0x87f4b6[_0x0693('0x18')],'include':_0x87f4b6[_0x0693('0x1a')]?_[_0x0693('0x20')](_0x87f4b6['include'],function(_0x285737){return{'model':db[_0x285737['model']],'as':_0x285737['as'],'attributes':_0x285737[_0x0693('0x18')],'include':_0x285737[_0x0693('0x1a')]?_[_0x0693('0x20')](_0x285737[_0x0693('0x1a')],function(_0x2e1a64){return{'model':db[_0x2e1a64['model']],'as':_0x2e1a64['as'],'attributes':_0x2e1a64[_0x0693('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0693('0x9')](function(_0x578667){logger[_0x0693('0xa')](_0x0693('0x1e'),_0x5a75a5);logger[_0x0693('0xb')](_0x0693('0x1e'),_0x5a75a5,JSON[_0x0693('0x21')](_0x578667));_0x2e099f(_0x578667);})['catch'](function(_0x5d3235){logger['error']('ShowDeskAccount',_0x5d3235['message'],_0x5a75a5);_0x65b5c5(_0x4d50df[_0x0693('0xe')](0x1f4,_0x5d3235['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 85555ef..1fa0458 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1c08cf,_0x24547f){var _0x5acfda=function(_0x5163ae){while(--_0x5163ae){_0x1c08cf['push'](_0x1c08cf['shift']());}};_0x5acfda(++_0x24547f);}(_0x008c,0x188));var _0xc008=function(_0x6aa32f,_0x3820f7){_0x6aa32f=_0x6aa32f-0x0;var _0x52bfee=_0x008c[_0x6aa32f];return _0x52bfee;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0xd9e171,_0x1bae23){var _0x304c10=function(_0x3f300f){while(--_0x3f300f){_0xd9e171['push'](_0xd9e171['shift']());}};_0x304c10(++_0x1bae23);}(_0x3e74,0x175));var _0x43e7=function(_0x25d163,_0x32cb7f){_0x25d163=_0x25d163-0x0;var _0x251c8d=_0x3e74[_0x25d163];return _0x251c8d;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index c1a4d0d..e3ae2dd 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 _0xe89f=['sequelize','STRING'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xe89f,0x12e));var _0xfe89=function(_0x49a250,_0x2d1236){_0x49a250=_0x49a250-0x0;var _0x1199b8=_0xe89f[_0x49a250];return _0x1199b8;};'use strict';var Sequelize=require(_0xfe89('0x0'));module['exports']={'name':{'type':Sequelize[_0xfe89('0x1')]},'description':{'type':Sequelize[_0xfe89('0x1')]}}; \ No newline at end of file +var _0xaa42=['STRING','exports'];(function(_0x14ee65,_0x31e180){var _0x28e513=function(_0x51cbd5){while(--_0x51cbd5){_0x14ee65['push'](_0x14ee65['shift']());}};_0x28e513(++_0x31e180);}(_0xaa42,0x105));var _0x2aa4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xaa42[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0x2aa4('0x0')]={'name':{'type':Sequelize[_0x2aa4('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index efab5e0..168b2e1 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 _0x7b26=['where','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','findOne','DeskField','getFields','length','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','DeskConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7b26,0xc2));var _0x67b2=function(_0x4d544a,_0x3aa5cd){_0x4d544a=_0x4d544a-0x0;var _0x21b3f6=_0x7b26[_0x4d544a];return _0x21b3f6;};'use strict';var emlformat=require(_0x67b2('0x0'));var rimraf=require(_0x67b2('0x1'));var zipdir=require(_0x67b2('0x2'));var jsonpatch=require(_0x67b2('0x3'));var rp=require('request-promise');var moment=require(_0x67b2('0x4'));var BPromise=require(_0x67b2('0x5'));var Mustache=require(_0x67b2('0x6'));var util=require(_0x67b2('0x7'));var path=require(_0x67b2('0x8'));var sox=require('sox');var csv=require(_0x67b2('0x9'));var ejs=require(_0x67b2('0xa'));var fs=require('fs');var fs_extra=require(_0x67b2('0xb'));var _=require(_0x67b2('0xc'));var squel=require(_0x67b2('0xd'));var crypto=require('crypto');var jsforce=require(_0x67b2('0xe'));var deskjs=require(_0x67b2('0xf'));var toCsv=require(_0x67b2('0x9'));var querystring=require(_0x67b2('0x10'));var Papa=require(_0x67b2('0x11'));var Redis=require(_0x67b2('0x12'));var authService=require(_0x67b2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x67b2('0x14'));var utils=require(_0x67b2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x67b2('0x16'));var db=require(_0x67b2('0x17'))['db'];function respondWithStatusCode(_0x492ff6,_0x47cba2){_0x47cba2=_0x47cba2||0xcc;return function(_0x3f1b10){if(_0x3f1b10){return _0x492ff6['sendStatus'](_0x47cba2);}return _0x492ff6[_0x67b2('0x18')](_0x47cba2)[_0x67b2('0x19')]();};}function respondWithResult(_0x2f541e,_0x332553){_0x332553=_0x332553||0xc8;return function(_0x251f0c){if(_0x251f0c){return _0x2f541e['status'](_0x332553)[_0x67b2('0x1a')](_0x251f0c);}};}function respondWithFilteredResult(_0x532e58,_0x3cf7c6){return function(_0x3f8eb2){if(_0x3f8eb2){var _0x133394=typeof _0x3cf7c6[_0x67b2('0x1b')]===_0x67b2('0x1c')&&typeof _0x3cf7c6['limit']===_0x67b2('0x1c');var _0x4ec476=_0x3f8eb2[_0x67b2('0x1d')];var _0x4896aa=_0x133394?0x0:_0x3cf7c6[_0x67b2('0x1b')];var _0x50e983=_0x133394?_0x3f8eb2[_0x67b2('0x1d')]:_0x3cf7c6[_0x67b2('0x1b')]+_0x3cf7c6[_0x67b2('0x1e')];var _0x8bfefb;if(_0x50e983>=_0x4ec476){_0x50e983=_0x4ec476;_0x8bfefb=0xc8;}else{_0x8bfefb=0xce;}_0x532e58[_0x67b2('0x18')](_0x8bfefb);return _0x532e58[_0x67b2('0x1f')](_0x67b2('0x20'),_0x4896aa+'-'+_0x50e983+'/'+_0x4ec476)[_0x67b2('0x1a')](_0x3f8eb2);}return null;};}function patchUpdates(_0x226a84){return function(_0x4382ec){try{jsonpatch[_0x67b2('0x21')](_0x4382ec,_0x226a84,!![]);}catch(_0x49d9a2){return BPromise[_0x67b2('0x22')](_0x49d9a2);}return _0x4382ec[_0x67b2('0x23')]();};}function saveUpdates(_0x1e5307,_0x3cb818){return function(_0x1beeef){if(_0x1beeef){return _0x1beeef[_0x67b2('0x24')](_0x1e5307)[_0x67b2('0x25')](function(_0x959f9f){return _0x959f9f;});}return null;};}function removeEntity(_0x3b4fcd,_0x5038d3){return function(_0x430009){if(_0x430009){return _0x430009[_0x67b2('0x26')]()[_0x67b2('0x25')](function(){_0x3b4fcd[_0x67b2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55dfa6,_0x17415c){return function(_0x4f851c){if(!_0x4f851c){_0x55dfa6[_0x67b2('0x27')](0x194);}return _0x4f851c;};}function handleError(_0x5f5c4f,_0x3d4bd0){_0x3d4bd0=_0x3d4bd0||0x1f4;return function(_0xb4021c){logger[_0x67b2('0x28')](_0xb4021c[_0x67b2('0x29')]);if(_0xb4021c[_0x67b2('0x2a')]){delete _0xb4021c[_0x67b2('0x2a')];}_0x5f5c4f[_0x67b2('0x18')](_0x3d4bd0)['send'](_0xb4021c);};}exports[_0x67b2('0x2b')]=function(_0x23aed3,_0x5c2c65){var _0x84dc7c={},_0x612e6e={},_0x59284e={'count':0x0,'rows':[]};var _0x2cb673=_['map'](db[_0x67b2('0x2c')][_0x67b2('0x2d')],function(_0x183cf2){return{'name':_0x183cf2[_0x67b2('0x2e')],'type':_0x183cf2[_0x67b2('0x2f')][_0x67b2('0x30')]};});_0x612e6e['model']=_[_0x67b2('0x31')](_0x2cb673,'name');_0x612e6e[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x23aed3[_0x67b2('0x32')]);_0x612e6e[_0x67b2('0x34')]=_[_0x67b2('0x35')](_0x612e6e['model'],_0x612e6e['query']);_0x84dc7c[_0x67b2('0x36')]=_[_0x67b2('0x35')](_0x612e6e[_0x67b2('0x37')],qs[_0x67b2('0x38')](_0x23aed3[_0x67b2('0x32')][_0x67b2('0x38')]));_0x84dc7c[_0x67b2('0x36')]=_0x84dc7c['attributes']['length']?_0x84dc7c[_0x67b2('0x36')]:_0x612e6e[_0x67b2('0x37')];if(!_0x23aed3['query'][_0x67b2('0x39')](_0x67b2('0x3a'))){_0x84dc7c[_0x67b2('0x1e')]=qs[_0x67b2('0x1e')](_0x23aed3['query'][_0x67b2('0x1e')]);_0x84dc7c['offset']=qs['offset'](_0x23aed3['query'][_0x67b2('0x1b')]);}_0x84dc7c[_0x67b2('0x3b')]=qs[_0x67b2('0x3c')](_0x23aed3['query'][_0x67b2('0x3c')]);_0x84dc7c['where']=qs[_0x67b2('0x34')](_[_0x67b2('0x3d')](_0x23aed3[_0x67b2('0x32')],_0x612e6e[_0x67b2('0x34')]),_0x2cb673);if(_0x23aed3[_0x67b2('0x32')][_0x67b2('0x3e')]){_0x84dc7c['where']=_[_0x67b2('0x3f')](_0x84dc7c[_0x67b2('0x40')],{'$or':_[_0x67b2('0x31')](_0x2cb673,function(_0x2f6ddd){if(_0x2f6ddd[_0x67b2('0x2f')]!==_0x67b2('0x41')){var _0x3fdfcc={};_0x3fdfcc[_0x2f6ddd[_0x67b2('0x2a')]]={'$like':'%'+_0x23aed3[_0x67b2('0x32')]['filter']+'%'};return _0x3fdfcc;}})});}_0x84dc7c=_[_0x67b2('0x3f')]({},_0x84dc7c,_0x23aed3[_0x67b2('0x42')]);var _0x467fc4={'where':_0x84dc7c[_0x67b2('0x40')]};return db[_0x67b2('0x2c')]['count'](_0x467fc4)[_0x67b2('0x25')](function(_0x560fd3){_0x59284e[_0x67b2('0x1d')]=_0x560fd3;if(_0x23aed3[_0x67b2('0x32')][_0x67b2('0x43')]){_0x84dc7c['include']=[{'all':!![]}];}return db[_0x67b2('0x2c')]['findAll'](_0x84dc7c);})['then'](function(_0x11a9fa){_0x59284e[_0x67b2('0x44')]=_0x11a9fa;return _0x59284e;})['then'](respondWithFilteredResult(_0x5c2c65,_0x84dc7c))[_0x67b2('0x45')](handleError(_0x5c2c65,null));};exports[_0x67b2('0x46')]=function(_0x2d32c3,_0x369e94){var _0x47d8c8={'raw':![],'where':{'id':_0x2d32c3[_0x67b2('0x47')]['id']}},_0x38d229={};_0x38d229[_0x67b2('0x37')]=_[_0x67b2('0x33')](db[_0x67b2('0x2c')][_0x67b2('0x2d')]);_0x38d229[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x2d32c3[_0x67b2('0x32')]);_0x38d229['filters']=_['intersection'](_0x38d229[_0x67b2('0x37')],_0x38d229[_0x67b2('0x32')]);_0x47d8c8[_0x67b2('0x36')]=_[_0x67b2('0x35')](_0x38d229[_0x67b2('0x37')],qs[_0x67b2('0x38')](_0x2d32c3[_0x67b2('0x32')][_0x67b2('0x38')]));_0x47d8c8[_0x67b2('0x36')]=_0x47d8c8['attributes']['length']?_0x47d8c8[_0x67b2('0x36')]:_0x38d229['model'];if(_0x2d32c3[_0x67b2('0x32')][_0x67b2('0x43')]){_0x47d8c8[_0x67b2('0x48')]=[{'all':!![]}];}_0x47d8c8=_['merge']({},_0x47d8c8,_0x2d32c3[_0x67b2('0x42')]);return db[_0x67b2('0x2c')][_0x67b2('0x49')](_0x47d8c8)[_0x67b2('0x25')](handleEntityNotFound(_0x369e94,null))[_0x67b2('0x25')](respondWithResult(_0x369e94,null))[_0x67b2('0x45')](handleError(_0x369e94,null));};exports[_0x67b2('0x4a')]=function(_0x43e679,_0x55473f){return db['DeskConfiguration'][_0x67b2('0x4a')](_0x43e679[_0x67b2('0x4b')],{})[_0x67b2('0x25')](respondWithResult(_0x55473f,0xc9))['catch'](handleError(_0x55473f,null));};exports[_0x67b2('0x24')]=function(_0x49385e,_0x578234){if(_0x49385e['body']['id']){delete _0x49385e[_0x67b2('0x4b')]['id'];}return db[_0x67b2('0x2c')][_0x67b2('0x49')]({'where':{'id':_0x49385e[_0x67b2('0x47')]['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x578234,null))[_0x67b2('0x25')](saveUpdates(_0x49385e['body'],null))[_0x67b2('0x25')](respondWithResult(_0x578234,null))[_0x67b2('0x45')](handleError(_0x578234,null));};exports[_0x67b2('0x26')]=function(_0x3e969b,_0x54cd15){return db[_0x67b2('0x2c')][_0x67b2('0x49')]({'where':{'id':_0x3e969b['params']['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x54cd15,null))[_0x67b2('0x25')](removeEntity(_0x54cd15,null))[_0x67b2('0x45')](handleError(_0x54cd15,null));};exports['getFields']=function(_0x532095,_0x19039d,_0x254803){var _0x55dbc7={};var _0x3374fa={};var _0x35b47c;var _0x119cc3;return db[_0x67b2('0x2c')][_0x67b2('0x4c')]({'where':{'id':_0x532095['params']['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x19039d,null))[_0x67b2('0x25')](function(_0x34c412){if(_0x34c412){_0x35b47c=_0x34c412;_0x3374fa[_0x67b2('0x37')]=_[_0x67b2('0x33')](db[_0x67b2('0x4d')]['rawAttributes']);_0x3374fa[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x532095[_0x67b2('0x32')]);_0x3374fa['filters']=_[_0x67b2('0x35')](_0x3374fa['model'],_0x3374fa[_0x67b2('0x32')]);_0x55dbc7['attributes']=_[_0x67b2('0x35')](_0x3374fa[_0x67b2('0x37')],qs[_0x67b2('0x38')](_0x532095['query'][_0x67b2('0x38')]));_0x55dbc7[_0x67b2('0x36')]=_0x55dbc7[_0x67b2('0x36')]['length']?_0x55dbc7[_0x67b2('0x36')]:_0x3374fa[_0x67b2('0x37')];_0x55dbc7['order']=qs[_0x67b2('0x3c')](_0x532095['query'][_0x67b2('0x3c')]);_0x55dbc7[_0x67b2('0x40')]=qs['filters'](_['pick'](_0x532095[_0x67b2('0x32')],_0x3374fa[_0x67b2('0x34')]));if(_0x532095[_0x67b2('0x32')][_0x67b2('0x3e')]){_0x55dbc7['where']=_[_0x67b2('0x3f')](_0x55dbc7['where'],{'$or':_[_0x67b2('0x31')](_0x55dbc7[_0x67b2('0x36')],function(_0x53b42f){var _0x4371da={};_0x4371da[_0x53b42f]={'$like':'%'+_0x532095[_0x67b2('0x32')][_0x67b2('0x3e')]+'%'};return _0x4371da;})});}_0x55dbc7=_[_0x67b2('0x3f')]({},_0x55dbc7,_0x532095[_0x67b2('0x42')]);return _0x35b47c[_0x67b2('0x4e')](_0x55dbc7);}})[_0x67b2('0x25')](function(_0x111b56){if(_0x111b56){_0x119cc3=_0x111b56[_0x67b2('0x4f')];if(!_0x532095[_0x67b2('0x32')][_0x67b2('0x39')]('nolimit')){_0x55dbc7['limit']=qs[_0x67b2('0x1e')](_0x532095['query']['limit']);_0x55dbc7[_0x67b2('0x1b')]=qs[_0x67b2('0x1b')](_0x532095[_0x67b2('0x32')][_0x67b2('0x1b')]);}return _0x35b47c['getFields'](_0x55dbc7);}})['then'](function(_0x4cd00a){if(_0x4cd00a){return _0x4cd00a?{'count':_0x119cc3,'rows':_0x4cd00a}:null;}})[_0x67b2('0x25')](respondWithResult(_0x19039d,null))[_0x67b2('0x45')](handleError(_0x19039d,null));};exports[_0x67b2('0x50')]=function(_0x4afd70,_0x4f9c25,_0x373f11){var _0x4cd340={};var _0x336e39={};var _0xc7bcf0;var _0x87b708;return db['DeskConfiguration'][_0x67b2('0x4c')]({'where':{'id':_0x4afd70['params']['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x4f9c25,null))['then'](function(_0x8ada4d){if(_0x8ada4d){_0xc7bcf0=_0x8ada4d;_0x336e39['model']=_[_0x67b2('0x33')](db['DeskField'][_0x67b2('0x2d')]);_0x336e39[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x4afd70[_0x67b2('0x32')]);_0x336e39[_0x67b2('0x34')]=_[_0x67b2('0x35')](_0x336e39[_0x67b2('0x37')],_0x336e39[_0x67b2('0x32')]);_0x4cd340[_0x67b2('0x36')]=_[_0x67b2('0x35')](_0x336e39['model'],qs[_0x67b2('0x38')](_0x4afd70[_0x67b2('0x32')][_0x67b2('0x38')]));_0x4cd340[_0x67b2('0x36')]=_0x4cd340[_0x67b2('0x36')][_0x67b2('0x4f')]?_0x4cd340[_0x67b2('0x36')]:_0x336e39['model'];_0x4cd340[_0x67b2('0x3b')]=qs[_0x67b2('0x3c')](_0x4afd70[_0x67b2('0x32')]['sort']);_0x4cd340['where']=qs['filters'](_[_0x67b2('0x3d')](_0x4afd70[_0x67b2('0x32')],_0x336e39[_0x67b2('0x34')]));if(_0x4afd70[_0x67b2('0x32')][_0x67b2('0x3e')]){_0x4cd340['where']=_[_0x67b2('0x3f')](_0x4cd340['where'],{'$or':_[_0x67b2('0x31')](_0x4cd340[_0x67b2('0x36')],function(_0x5c10ba){var _0x4a3a59={};_0x4a3a59[_0x5c10ba]={'$like':'%'+_0x4afd70[_0x67b2('0x32')][_0x67b2('0x3e')]+'%'};return _0x4a3a59;})});}_0x4cd340=_[_0x67b2('0x3f')]({},_0x4cd340,_0x4afd70[_0x67b2('0x42')]);return _0xc7bcf0['getSubjects'](_0x4cd340);}})['then'](function(_0x33efaf){if(_0x33efaf){_0x87b708=_0x33efaf[_0x67b2('0x4f')];if(!_0x4afd70[_0x67b2('0x32')][_0x67b2('0x39')](_0x67b2('0x3a'))){_0x4cd340[_0x67b2('0x1e')]=qs[_0x67b2('0x1e')](_0x4afd70[_0x67b2('0x32')]['limit']);_0x4cd340['offset']=qs[_0x67b2('0x1b')](_0x4afd70[_0x67b2('0x32')][_0x67b2('0x1b')]);}return _0xc7bcf0[_0x67b2('0x50')](_0x4cd340);}})[_0x67b2('0x25')](function(_0x739f3d){if(_0x739f3d){return _0x739f3d?{'count':_0x87b708,'rows':_0x739f3d}:null;}})[_0x67b2('0x25')](respondWithResult(_0x4f9c25,null))[_0x67b2('0x45')](handleError(_0x4f9c25,null));};exports[_0x67b2('0x51')]=function(_0x1db0e3,_0x310c9c,_0x30725b){var _0x3449b9={};var _0x43013f={};var _0x3d3058;var _0xd7aa7a;return db['DeskConfiguration'][_0x67b2('0x4c')]({'where':{'id':_0x1db0e3[_0x67b2('0x47')]['id']}})['then'](handleEntityNotFound(_0x310c9c,null))[_0x67b2('0x25')](function(_0x4c3bb7){if(_0x4c3bb7){_0x3d3058=_0x4c3bb7;_0x43013f[_0x67b2('0x37')]=_['keys'](db[_0x67b2('0x4d')][_0x67b2('0x2d')]);_0x43013f[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x1db0e3['query']);_0x43013f[_0x67b2('0x34')]=_[_0x67b2('0x35')](_0x43013f[_0x67b2('0x37')],_0x43013f[_0x67b2('0x32')]);_0x3449b9[_0x67b2('0x36')]=_[_0x67b2('0x35')](_0x43013f[_0x67b2('0x37')],qs['fields'](_0x1db0e3[_0x67b2('0x32')]['fields']));_0x3449b9[_0x67b2('0x36')]=_0x3449b9[_0x67b2('0x36')][_0x67b2('0x4f')]?_0x3449b9['attributes']:_0x43013f['model'];_0x3449b9[_0x67b2('0x3b')]=qs['sort'](_0x1db0e3[_0x67b2('0x32')][_0x67b2('0x3c')]);_0x3449b9[_0x67b2('0x40')]=qs[_0x67b2('0x34')](_[_0x67b2('0x3d')](_0x1db0e3[_0x67b2('0x32')],_0x43013f[_0x67b2('0x34')]));if(_0x1db0e3['query'][_0x67b2('0x3e')]){_0x3449b9[_0x67b2('0x40')]=_[_0x67b2('0x3f')](_0x3449b9[_0x67b2('0x40')],{'$or':_[_0x67b2('0x31')](_0x3449b9[_0x67b2('0x36')],function(_0x5e3f52){var _0x10d886={};_0x10d886[_0x5e3f52]={'$like':'%'+_0x1db0e3[_0x67b2('0x32')][_0x67b2('0x3e')]+'%'};return _0x10d886;})});}_0x3449b9=_[_0x67b2('0x3f')]({},_0x3449b9,_0x1db0e3[_0x67b2('0x42')]);return _0x3d3058['getDescriptions'](_0x3449b9);}})['then'](function(_0x3d755e){if(_0x3d755e){_0xd7aa7a=_0x3d755e['length'];if(!_0x1db0e3[_0x67b2('0x32')]['hasOwnProperty']('nolimit')){_0x3449b9[_0x67b2('0x1e')]=qs['limit'](_0x1db0e3[_0x67b2('0x32')][_0x67b2('0x1e')]);_0x3449b9[_0x67b2('0x1b')]=qs[_0x67b2('0x1b')](_0x1db0e3[_0x67b2('0x32')][_0x67b2('0x1b')]);}return _0x3d3058[_0x67b2('0x51')](_0x3449b9);}})['then'](function(_0x10fddb){if(_0x10fddb){return _0x10fddb?{'count':_0xd7aa7a,'rows':_0x10fddb}:null;}})[_0x67b2('0x25')](respondWithResult(_0x310c9c,null))[_0x67b2('0x45')](handleError(_0x310c9c,null));};exports['getTags']=function(_0x3e3ac2,_0x576869,_0x418a10){var _0x2726e7={};var _0x202ba0={};var _0x216f77;var _0x46f627;return db[_0x67b2('0x2c')]['findOne']({'where':{'id':_0x3e3ac2['params']['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x576869,null))[_0x67b2('0x25')](function(_0x1b5b75){if(_0x1b5b75){_0x216f77=_0x1b5b75;_0x202ba0[_0x67b2('0x37')]=_[_0x67b2('0x33')](db[_0x67b2('0x52')][_0x67b2('0x2d')]);_0x202ba0[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x3e3ac2[_0x67b2('0x32')]);_0x202ba0[_0x67b2('0x34')]=_[_0x67b2('0x35')](_0x202ba0['model'],_0x202ba0['query']);_0x2726e7[_0x67b2('0x36')]=_['intersection'](_0x202ba0[_0x67b2('0x37')],qs[_0x67b2('0x38')](_0x3e3ac2[_0x67b2('0x32')][_0x67b2('0x38')]));_0x2726e7[_0x67b2('0x36')]=_0x2726e7[_0x67b2('0x36')][_0x67b2('0x4f')]?_0x2726e7[_0x67b2('0x36')]:_0x202ba0[_0x67b2('0x37')];_0x2726e7[_0x67b2('0x3b')]=qs[_0x67b2('0x3c')](_0x3e3ac2['query'][_0x67b2('0x3c')]);_0x2726e7['where']=qs[_0x67b2('0x34')](_['pick'](_0x3e3ac2[_0x67b2('0x32')],_0x202ba0[_0x67b2('0x34')]));if(_0x3e3ac2[_0x67b2('0x32')][_0x67b2('0x3e')]){_0x2726e7[_0x67b2('0x40')]=_[_0x67b2('0x3f')](_0x2726e7['where'],{'$or':_[_0x67b2('0x31')](_0x2726e7[_0x67b2('0x36')],function(_0x584302){var _0x4e6303={};_0x4e6303[_0x584302]={'$like':'%'+_0x3e3ac2['query']['filter']+'%'};return _0x4e6303;})});}_0x2726e7=_[_0x67b2('0x3f')]({},_0x2726e7,_0x3e3ac2[_0x67b2('0x42')]);return _0x216f77[_0x67b2('0x53')](_0x2726e7);}})[_0x67b2('0x25')](function(_0x3e606d){if(_0x3e606d){_0x46f627=_0x3e606d['length'];if(!_0x3e3ac2['query'][_0x67b2('0x39')]('nolimit')){_0x2726e7[_0x67b2('0x1e')]=qs[_0x67b2('0x1e')](_0x3e3ac2[_0x67b2('0x32')][_0x67b2('0x1e')]);_0x2726e7['offset']=qs[_0x67b2('0x1b')](_0x3e3ac2[_0x67b2('0x32')][_0x67b2('0x1b')]);}return _0x216f77[_0x67b2('0x53')](_0x2726e7);}})[_0x67b2('0x25')](function(_0x2a189f){if(_0x2a189f){return _0x2a189f?{'count':_0x46f627,'rows':_0x2a189f}:null;}})['then'](respondWithResult(_0x576869,null))[_0x67b2('0x45')](handleError(_0x576869,null));};exports[_0x67b2('0x54')]=function(_0x316281,_0x51c690,_0x47b906){if(_0x316281[_0x67b2('0x4b')]['id']){delete _0x316281['body']['id'];}return db[_0x67b2('0x2c')][_0x67b2('0x4c')]({'where':{'id':_0x316281[_0x67b2('0x47')]['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x51c690,null))[_0x67b2('0x25')](function(_0x4ae78a){if(_0x4ae78a){return _0x4ae78a[_0x67b2('0x54')](_0x316281['body'][_0x67b2('0x55')]||[]);}return null;})[_0x67b2('0x25')](respondWithResult(_0x51c690,null))[_0x67b2('0x45')](handleError(_0x51c690,null));}; \ No newline at end of file +var _0xa05b=['index','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name'];(function(_0x25b92e,_0x59e7d2){var _0x493b10=function(_0xca2749){while(--_0xca2749){_0x25b92e['push'](_0x25b92e['shift']());}};_0x493b10(++_0x59e7d2);}(_0xa05b,0x120));var _0xba05=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0xa05b[_0x1aa3fe];return _0x163cee;};'use strict';var emlformat=require(_0xba05('0x0'));var rimraf=require(_0xba05('0x1'));var zipdir=require(_0xba05('0x2'));var jsonpatch=require(_0xba05('0x3'));var rp=require(_0xba05('0x4'));var moment=require('moment');var BPromise=require(_0xba05('0x5'));var Mustache=require(_0xba05('0x6'));var util=require(_0xba05('0x7'));var path=require(_0xba05('0x8'));var sox=require(_0xba05('0x9'));var csv=require(_0xba05('0xa'));var ejs=require(_0xba05('0xb'));var fs=require('fs');var fs_extra=require(_0xba05('0xc'));var _=require(_0xba05('0xd'));var squel=require(_0xba05('0xe'));var crypto=require(_0xba05('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xba05('0x10'));var toCsv=require(_0xba05('0xa'));var querystring=require(_0xba05('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xba05('0x12'));var as=require(_0xba05('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba05('0x14'))(_0xba05('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2adb34,_0x566d36){_0x566d36=_0x566d36||0xcc;return function(_0x4ba793){if(_0x4ba793){return _0x2adb34[_0xba05('0x16')](_0x566d36);}return _0x2adb34[_0xba05('0x17')](_0x566d36)[_0xba05('0x18')]();};}function respondWithResult(_0x4e8ea8,_0x327ebd){_0x327ebd=_0x327ebd||0xc8;return function(_0x485d7f){if(_0x485d7f){return _0x4e8ea8[_0xba05('0x17')](_0x327ebd)['json'](_0x485d7f);}};}function respondWithFilteredResult(_0x1c3e60,_0x85344){return function(_0x9ad30b){if(_0x9ad30b){var _0x4a160e=typeof _0x85344[_0xba05('0x19')]===_0xba05('0x1a')&&typeof _0x85344[_0xba05('0x1b')]===_0xba05('0x1a');var _0x5e4ecf=_0x9ad30b[_0xba05('0x1c')];var _0x282c8b=_0x4a160e?0x0:_0x85344['offset'];var _0x33191=_0x4a160e?_0x9ad30b[_0xba05('0x1c')]:_0x85344[_0xba05('0x19')]+_0x85344[_0xba05('0x1b')];var _0x54eeb4;if(_0x33191>=_0x5e4ecf){_0x33191=_0x5e4ecf;_0x54eeb4=0xc8;}else{_0x54eeb4=0xce;}_0x1c3e60['status'](_0x54eeb4);return _0x1c3e60[_0xba05('0x1d')](_0xba05('0x1e'),_0x282c8b+'-'+_0x33191+'/'+_0x5e4ecf)[_0xba05('0x1f')](_0x9ad30b);}return null;};}function patchUpdates(_0x330a23){return function(_0x3f0973){try{jsonpatch[_0xba05('0x20')](_0x3f0973,_0x330a23,!![]);}catch(_0x59ed3f){return BPromise[_0xba05('0x21')](_0x59ed3f);}return _0x3f0973['save']();};}function saveUpdates(_0x2d8fe7,_0xa8948c){return function(_0x637c60){if(_0x637c60){return _0x637c60[_0xba05('0x22')](_0x2d8fe7)['then'](function(_0x3dc237){return _0x3dc237;});}return null;};}function removeEntity(_0xa5d848,_0x2ed71a){return function(_0x1ec29a){if(_0x1ec29a){return _0x1ec29a[_0xba05('0x23')]()[_0xba05('0x24')](function(){_0xa5d848['status'](0xcc)[_0xba05('0x18')]();});}};}function handleEntityNotFound(_0x52bd7b,_0x4772d6){return function(_0x11bc1b){if(!_0x11bc1b){_0x52bd7b[_0xba05('0x16')](0x194);}return _0x11bc1b;};}function handleError(_0x16ae14,_0x1f8056){_0x1f8056=_0x1f8056||0x1f4;return function(_0x8b4ad4){logger[_0xba05('0x25')](_0x8b4ad4[_0xba05('0x26')]);if(_0x8b4ad4['name']){delete _0x8b4ad4[_0xba05('0x27')];}_0x16ae14[_0xba05('0x17')](_0x1f8056)['send'](_0x8b4ad4);};}exports[_0xba05('0x28')]=function(_0x478e17,_0x4a93cd){var _0x3ccc02={},_0x2c3cc2={},_0x3a7c42={'count':0x0,'rows':[]};var _0x578b11=_[_0xba05('0x29')](db[_0xba05('0x2a')][_0xba05('0x2b')],function(_0x56ab95){return{'name':_0x56ab95[_0xba05('0x2c')],'type':_0x56ab95['type'][_0xba05('0x2d')]};});_0x2c3cc2[_0xba05('0x2e')]=_['map'](_0x578b11,_0xba05('0x27'));_0x2c3cc2[_0xba05('0x2f')]=_[_0xba05('0x30')](_0x478e17['query']);_0x2c3cc2[_0xba05('0x31')]=_[_0xba05('0x32')](_0x2c3cc2[_0xba05('0x2e')],_0x2c3cc2[_0xba05('0x2f')]);_0x3ccc02['attributes']=_['intersection'](_0x2c3cc2[_0xba05('0x2e')],qs['fields'](_0x478e17[_0xba05('0x2f')][_0xba05('0x33')]));_0x3ccc02[_0xba05('0x34')]=_0x3ccc02[_0xba05('0x34')]['length']?_0x3ccc02['attributes']:_0x2c3cc2['model'];if(!_0x478e17[_0xba05('0x2f')][_0xba05('0x35')]('nolimit')){_0x3ccc02['limit']=qs[_0xba05('0x1b')](_0x478e17[_0xba05('0x2f')][_0xba05('0x1b')]);_0x3ccc02[_0xba05('0x19')]=qs[_0xba05('0x19')](_0x478e17[_0xba05('0x2f')][_0xba05('0x19')]);}_0x3ccc02[_0xba05('0x36')]=qs[_0xba05('0x37')](_0x478e17[_0xba05('0x2f')][_0xba05('0x37')]);_0x3ccc02['where']=qs['filters'](_[_0xba05('0x38')](_0x478e17[_0xba05('0x2f')],_0x2c3cc2[_0xba05('0x31')]),_0x578b11);if(_0x478e17[_0xba05('0x2f')][_0xba05('0x39')]){_0x3ccc02[_0xba05('0x3a')]=_[_0xba05('0x3b')](_0x3ccc02[_0xba05('0x3a')],{'$or':_[_0xba05('0x29')](_0x578b11,function(_0x1d421b){if(_0x1d421b[_0xba05('0x3c')]!=='VIRTUAL'){var _0x1819e9={};_0x1819e9[_0x1d421b[_0xba05('0x27')]]={'$like':'%'+_0x478e17[_0xba05('0x2f')][_0xba05('0x39')]+'%'};return _0x1819e9;}})});}_0x3ccc02=_[_0xba05('0x3b')]({},_0x3ccc02,_0x478e17[_0xba05('0x3d')]);var _0x171f8e={'where':_0x3ccc02[_0xba05('0x3a')]};return db[_0xba05('0x2a')]['count'](_0x171f8e)[_0xba05('0x24')](function(_0x1e1979){_0x3a7c42[_0xba05('0x1c')]=_0x1e1979;if(_0x478e17[_0xba05('0x2f')][_0xba05('0x3e')]){_0x3ccc02[_0xba05('0x3f')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xba05('0x40')](_0x3ccc02);})[_0xba05('0x24')](function(_0xa8d28e){_0x3a7c42[_0xba05('0x41')]=_0xa8d28e;return _0x3a7c42;})[_0xba05('0x24')](respondWithFilteredResult(_0x4a93cd,_0x3ccc02))[_0xba05('0x42')](handleError(_0x4a93cd,null));};exports[_0xba05('0x43')]=function(_0x505b1e,_0x90e023){var _0x1247c8={'raw':![],'where':{'id':_0x505b1e[_0xba05('0x44')]['id']}},_0x3b3111={};_0x3b3111[_0xba05('0x2e')]=_[_0xba05('0x30')](db['DeskConfiguration'][_0xba05('0x2b')]);_0x3b3111['query']=_[_0xba05('0x30')](_0x505b1e[_0xba05('0x2f')]);_0x3b3111[_0xba05('0x31')]=_[_0xba05('0x32')](_0x3b3111[_0xba05('0x2e')],_0x3b3111[_0xba05('0x2f')]);_0x1247c8[_0xba05('0x34')]=_[_0xba05('0x32')](_0x3b3111[_0xba05('0x2e')],qs[_0xba05('0x33')](_0x505b1e[_0xba05('0x2f')][_0xba05('0x33')]));_0x1247c8[_0xba05('0x34')]=_0x1247c8[_0xba05('0x34')][_0xba05('0x45')]?_0x1247c8['attributes']:_0x3b3111[_0xba05('0x2e')];if(_0x505b1e['query'][_0xba05('0x3e')]){_0x1247c8[_0xba05('0x3f')]=[{'all':!![]}];}_0x1247c8=_[_0xba05('0x3b')]({},_0x1247c8,_0x505b1e[_0xba05('0x3d')]);return db[_0xba05('0x2a')][_0xba05('0x46')](_0x1247c8)[_0xba05('0x24')](handleEntityNotFound(_0x90e023,null))[_0xba05('0x24')](respondWithResult(_0x90e023,null))['catch'](handleError(_0x90e023,null));};exports[_0xba05('0x47')]=function(_0x10e48d,_0x3286a8){return db[_0xba05('0x2a')][_0xba05('0x47')](_0x10e48d[_0xba05('0x48')],{})[_0xba05('0x24')](respondWithResult(_0x3286a8,0xc9))[_0xba05('0x42')](handleError(_0x3286a8,null));};exports[_0xba05('0x22')]=function(_0x20d364,_0xf234a){if(_0x20d364[_0xba05('0x48')]['id']){delete _0x20d364['body']['id'];}return db[_0xba05('0x2a')][_0xba05('0x46')]({'where':{'id':_0x20d364[_0xba05('0x44')]['id']}})[_0xba05('0x24')](handleEntityNotFound(_0xf234a,null))['then'](saveUpdates(_0x20d364[_0xba05('0x48')],null))[_0xba05('0x24')](respondWithResult(_0xf234a,null))[_0xba05('0x42')](handleError(_0xf234a,null));};exports['destroy']=function(_0x5dfe48,_0x144bf1){return db[_0xba05('0x2a')][_0xba05('0x46')]({'where':{'id':_0x5dfe48['params']['id']}})['then'](handleEntityNotFound(_0x144bf1,null))[_0xba05('0x24')](removeEntity(_0x144bf1,null))['catch'](handleError(_0x144bf1,null));};exports[_0xba05('0x49')]=function(_0x8564b,_0x51b473,_0x48063a){var _0x4715e9={};var _0x108d53={};var _0x11322b;var _0x326990;return db[_0xba05('0x2a')][_0xba05('0x4a')]({'where':{'id':_0x8564b[_0xba05('0x44')]['id']}})['then'](handleEntityNotFound(_0x51b473,null))[_0xba05('0x24')](function(_0x11e415){if(_0x11e415){_0x11322b=_0x11e415;_0x108d53[_0xba05('0x2e')]=_[_0xba05('0x30')](db[_0xba05('0x4b')]['rawAttributes']);_0x108d53[_0xba05('0x2f')]=_['keys'](_0x8564b[_0xba05('0x2f')]);_0x108d53[_0xba05('0x31')]=_[_0xba05('0x32')](_0x108d53[_0xba05('0x2e')],_0x108d53[_0xba05('0x2f')]);_0x4715e9[_0xba05('0x34')]=_[_0xba05('0x32')](_0x108d53[_0xba05('0x2e')],qs[_0xba05('0x33')](_0x8564b[_0xba05('0x2f')][_0xba05('0x33')]));_0x4715e9['attributes']=_0x4715e9[_0xba05('0x34')][_0xba05('0x45')]?_0x4715e9['attributes']:_0x108d53[_0xba05('0x2e')];_0x4715e9[_0xba05('0x36')]=qs[_0xba05('0x37')](_0x8564b['query']['sort']);_0x4715e9[_0xba05('0x3a')]=qs[_0xba05('0x31')](_[_0xba05('0x38')](_0x8564b[_0xba05('0x2f')],_0x108d53[_0xba05('0x31')]));if(_0x8564b['query'][_0xba05('0x39')]){_0x4715e9[_0xba05('0x3a')]=_[_0xba05('0x3b')](_0x4715e9['where'],{'$or':_[_0xba05('0x29')](_0x4715e9['attributes'],function(_0x5afeb){var _0x4e52f6={};_0x4e52f6[_0x5afeb]={'$like':'%'+_0x8564b[_0xba05('0x2f')][_0xba05('0x39')]+'%'};return _0x4e52f6;})});}_0x4715e9=_[_0xba05('0x3b')]({},_0x4715e9,_0x8564b['options']);return _0x11322b[_0xba05('0x49')](_0x4715e9);}})[_0xba05('0x24')](function(_0x13902a){if(_0x13902a){_0x326990=_0x13902a['length'];if(!_0x8564b[_0xba05('0x2f')][_0xba05('0x35')](_0xba05('0x4c'))){_0x4715e9[_0xba05('0x1b')]=qs['limit'](_0x8564b[_0xba05('0x2f')][_0xba05('0x1b')]);_0x4715e9[_0xba05('0x19')]=qs[_0xba05('0x19')](_0x8564b['query'][_0xba05('0x19')]);}return _0x11322b[_0xba05('0x49')](_0x4715e9);}})[_0xba05('0x24')](function(_0x4aab3c){if(_0x4aab3c){return _0x4aab3c?{'count':_0x326990,'rows':_0x4aab3c}:null;}})[_0xba05('0x24')](respondWithResult(_0x51b473,null))[_0xba05('0x42')](handleError(_0x51b473,null));};exports[_0xba05('0x4d')]=function(_0x30cc09,_0x4cbca3,_0x51076c){var _0x41826f={};var _0x1078b8={};var _0x5cb842;var _0x11ef4e;return db[_0xba05('0x2a')][_0xba05('0x4a')]({'where':{'id':_0x30cc09[_0xba05('0x44')]['id']}})[_0xba05('0x24')](handleEntityNotFound(_0x4cbca3,null))[_0xba05('0x24')](function(_0x3dc9b9){if(_0x3dc9b9){_0x5cb842=_0x3dc9b9;_0x1078b8[_0xba05('0x2e')]=_[_0xba05('0x30')](db[_0xba05('0x4b')][_0xba05('0x2b')]);_0x1078b8[_0xba05('0x2f')]=_[_0xba05('0x30')](_0x30cc09[_0xba05('0x2f')]);_0x1078b8[_0xba05('0x31')]=_[_0xba05('0x32')](_0x1078b8[_0xba05('0x2e')],_0x1078b8[_0xba05('0x2f')]);_0x41826f[_0xba05('0x34')]=_[_0xba05('0x32')](_0x1078b8[_0xba05('0x2e')],qs['fields'](_0x30cc09[_0xba05('0x2f')][_0xba05('0x33')]));_0x41826f[_0xba05('0x34')]=_0x41826f['attributes'][_0xba05('0x45')]?_0x41826f['attributes']:_0x1078b8[_0xba05('0x2e')];_0x41826f[_0xba05('0x36')]=qs[_0xba05('0x37')](_0x30cc09[_0xba05('0x2f')][_0xba05('0x37')]);_0x41826f[_0xba05('0x3a')]=qs['filters'](_[_0xba05('0x38')](_0x30cc09['query'],_0x1078b8[_0xba05('0x31')]));if(_0x30cc09[_0xba05('0x2f')][_0xba05('0x39')]){_0x41826f[_0xba05('0x3a')]=_[_0xba05('0x3b')](_0x41826f['where'],{'$or':_[_0xba05('0x29')](_0x41826f[_0xba05('0x34')],function(_0x58f805){var _0x107f54={};_0x107f54[_0x58f805]={'$like':'%'+_0x30cc09[_0xba05('0x2f')][_0xba05('0x39')]+'%'};return _0x107f54;})});}_0x41826f=_['merge']({},_0x41826f,_0x30cc09[_0xba05('0x3d')]);return _0x5cb842['getSubjects'](_0x41826f);}})[_0xba05('0x24')](function(_0x19ae1f){if(_0x19ae1f){_0x11ef4e=_0x19ae1f['length'];if(!_0x30cc09[_0xba05('0x2f')][_0xba05('0x35')](_0xba05('0x4c'))){_0x41826f[_0xba05('0x1b')]=qs[_0xba05('0x1b')](_0x30cc09[_0xba05('0x2f')][_0xba05('0x1b')]);_0x41826f['offset']=qs[_0xba05('0x19')](_0x30cc09[_0xba05('0x2f')][_0xba05('0x19')]);}return _0x5cb842[_0xba05('0x4d')](_0x41826f);}})[_0xba05('0x24')](function(_0x150be3){if(_0x150be3){return _0x150be3?{'count':_0x11ef4e,'rows':_0x150be3}:null;}})[_0xba05('0x24')](respondWithResult(_0x4cbca3,null))['catch'](handleError(_0x4cbca3,null));};exports['getDescriptions']=function(_0x8c6462,_0x424394,_0x3f90b2){var _0x2ce5cd={};var _0x5d2254={};var _0x2ccaf7;var _0x2892f8;return db[_0xba05('0x2a')]['findOne']({'where':{'id':_0x8c6462['params']['id']}})['then'](handleEntityNotFound(_0x424394,null))[_0xba05('0x24')](function(_0x1703f5){if(_0x1703f5){_0x2ccaf7=_0x1703f5;_0x5d2254['model']=_[_0xba05('0x30')](db[_0xba05('0x4b')][_0xba05('0x2b')]);_0x5d2254[_0xba05('0x2f')]=_['keys'](_0x8c6462['query']);_0x5d2254['filters']=_[_0xba05('0x32')](_0x5d2254[_0xba05('0x2e')],_0x5d2254['query']);_0x2ce5cd[_0xba05('0x34')]=_[_0xba05('0x32')](_0x5d2254[_0xba05('0x2e')],qs[_0xba05('0x33')](_0x8c6462[_0xba05('0x2f')][_0xba05('0x33')]));_0x2ce5cd['attributes']=_0x2ce5cd[_0xba05('0x34')][_0xba05('0x45')]?_0x2ce5cd[_0xba05('0x34')]:_0x5d2254['model'];_0x2ce5cd[_0xba05('0x36')]=qs[_0xba05('0x37')](_0x8c6462['query'][_0xba05('0x37')]);_0x2ce5cd[_0xba05('0x3a')]=qs[_0xba05('0x31')](_[_0xba05('0x38')](_0x8c6462[_0xba05('0x2f')],_0x5d2254[_0xba05('0x31')]));if(_0x8c6462[_0xba05('0x2f')][_0xba05('0x39')]){_0x2ce5cd[_0xba05('0x3a')]=_[_0xba05('0x3b')](_0x2ce5cd[_0xba05('0x3a')],{'$or':_[_0xba05('0x29')](_0x2ce5cd[_0xba05('0x34')],function(_0x66343d){var _0x515386={};_0x515386[_0x66343d]={'$like':'%'+_0x8c6462['query']['filter']+'%'};return _0x515386;})});}_0x2ce5cd=_[_0xba05('0x3b')]({},_0x2ce5cd,_0x8c6462['options']);return _0x2ccaf7[_0xba05('0x4e')](_0x2ce5cd);}})[_0xba05('0x24')](function(_0x2d59b0){if(_0x2d59b0){_0x2892f8=_0x2d59b0['length'];if(!_0x8c6462['query']['hasOwnProperty'](_0xba05('0x4c'))){_0x2ce5cd[_0xba05('0x1b')]=qs[_0xba05('0x1b')](_0x8c6462[_0xba05('0x2f')][_0xba05('0x1b')]);_0x2ce5cd['offset']=qs['offset'](_0x8c6462[_0xba05('0x2f')][_0xba05('0x19')]);}return _0x2ccaf7['getDescriptions'](_0x2ce5cd);}})[_0xba05('0x24')](function(_0x2b963d){if(_0x2b963d){return _0x2b963d?{'count':_0x2892f8,'rows':_0x2b963d}:null;}})[_0xba05('0x24')](respondWithResult(_0x424394,null))[_0xba05('0x42')](handleError(_0x424394,null));};exports[_0xba05('0x4f')]=function(_0x3b5ae4,_0x11ef4d,_0x178ff3){var _0x394b1a={};var _0x96c076={};var _0xc1ce5d;var _0x5de210;return db[_0xba05('0x2a')]['findOne']({'where':{'id':_0x3b5ae4['params']['id']}})[_0xba05('0x24')](handleEntityNotFound(_0x11ef4d,null))[_0xba05('0x24')](function(_0x289fe9){if(_0x289fe9){_0xc1ce5d=_0x289fe9;_0x96c076[_0xba05('0x2e')]=_['keys'](db[_0xba05('0x50')]['rawAttributes']);_0x96c076[_0xba05('0x2f')]=_['keys'](_0x3b5ae4[_0xba05('0x2f')]);_0x96c076['filters']=_[_0xba05('0x32')](_0x96c076[_0xba05('0x2e')],_0x96c076['query']);_0x394b1a[_0xba05('0x34')]=_[_0xba05('0x32')](_0x96c076[_0xba05('0x2e')],qs['fields'](_0x3b5ae4['query'][_0xba05('0x33')]));_0x394b1a[_0xba05('0x34')]=_0x394b1a['attributes'][_0xba05('0x45')]?_0x394b1a[_0xba05('0x34')]:_0x96c076[_0xba05('0x2e')];_0x394b1a[_0xba05('0x36')]=qs['sort'](_0x3b5ae4[_0xba05('0x2f')][_0xba05('0x37')]);_0x394b1a['where']=qs['filters'](_['pick'](_0x3b5ae4[_0xba05('0x2f')],_0x96c076[_0xba05('0x31')]));if(_0x3b5ae4[_0xba05('0x2f')][_0xba05('0x39')]){_0x394b1a['where']=_[_0xba05('0x3b')](_0x394b1a[_0xba05('0x3a')],{'$or':_[_0xba05('0x29')](_0x394b1a['attributes'],function(_0x3eaea4){var _0x42ca98={};_0x42ca98[_0x3eaea4]={'$like':'%'+_0x3b5ae4[_0xba05('0x2f')][_0xba05('0x39')]+'%'};return _0x42ca98;})});}_0x394b1a=_[_0xba05('0x3b')]({},_0x394b1a,_0x3b5ae4[_0xba05('0x3d')]);return _0xc1ce5d[_0xba05('0x4f')](_0x394b1a);}})[_0xba05('0x24')](function(_0x5a0249){if(_0x5a0249){_0x5de210=_0x5a0249[_0xba05('0x45')];if(!_0x3b5ae4[_0xba05('0x2f')][_0xba05('0x35')]('nolimit')){_0x394b1a[_0xba05('0x1b')]=qs[_0xba05('0x1b')](_0x3b5ae4['query']['limit']);_0x394b1a[_0xba05('0x19')]=qs[_0xba05('0x19')](_0x3b5ae4['query'][_0xba05('0x19')]);}return _0xc1ce5d[_0xba05('0x4f')](_0x394b1a);}})[_0xba05('0x24')](function(_0x118243){if(_0x118243){return _0x118243?{'count':_0x5de210,'rows':_0x118243}:null;}})[_0xba05('0x24')](respondWithResult(_0x11ef4d,null))[_0xba05('0x42')](handleError(_0x11ef4d,null));};exports[_0xba05('0x51')]=function(_0x32f175,_0x53b539,_0xe1d309){if(_0x32f175[_0xba05('0x48')]['id']){delete _0x32f175[_0xba05('0x48')]['id'];}return db[_0xba05('0x2a')]['findOne']({'where':{'id':_0x32f175['params']['id']}})[_0xba05('0x24')](handleEntityNotFound(_0x53b539,null))['then'](function(_0x353ab1){if(_0x353ab1){return _0x353ab1[_0xba05('0x51')](_0x32f175['body']['ids']||[]);}return null;})[_0xba05('0x24')](respondWithResult(_0x53b539,null))['catch'](handleError(_0x53b539,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index bba1b7a..9e99320 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 _0xc400=['int_desk_configurations','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration'];(function(_0x40cacf,_0x10ad06){var _0x436437=function(_0x32ae0a){while(--_0x32ae0a){_0x40cacf['push'](_0x40cacf['shift']());}};_0x436437(++_0x10ad06);}(_0xc400,0x105));var _0x0c40=function(_0x128aa0,_0x3e5df8){_0x128aa0=_0x128aa0-0x0;var _0x197ddc=_0xc400[_0x128aa0];return _0x197ddc;};'use strict';var _=require(_0x0c40('0x0'));var util=require('util');var logger=require(_0x0c40('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0c40('0x2'));var rp=require(_0x0c40('0x3'));var fs=require('fs');var path=require(_0x0c40('0x4'));var rimraf=require(_0x0c40('0x5'));var config=require(_0x0c40('0x6'));var attributes=require(_0x0c40('0x7'));module['exports']=function(_0x3497eb,_0x5d898a){return _0x3497eb['define'](_0x0c40('0x8'),attributes,{'tableName':_0x0c40('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3da7=['request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','int_desk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5c380e,_0xa74c25){var _0xb0f44=function(_0x5a1a76){while(--_0x5a1a76){_0x5c380e['push'](_0x5c380e['shift']());}};_0xb0f44(++_0xa74c25);}(_0x3da7,0xe2));var _0x73da=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x3da7[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0x73da('0x0'));var util=require('util');var logger=require(_0x73da('0x1'))(_0x73da('0x2'));var moment=require(_0x73da('0x3'));var BPromise=require(_0x73da('0x4'));var rp=require(_0x73da('0x5'));var fs=require('fs');var path=require(_0x73da('0x6'));var rimraf=require('rimraf');var config=require(_0x73da('0x7'));var attributes=require(_0x73da('0x8'));module[_0x73da('0x9')]=function(_0xbb84d6,_0x1f61af){return _0xbb84d6['define']('DeskConfiguration',attributes,{'tableName':_0x73da('0xa'),'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 8d8e6f5..f475ac5 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 _0x969e=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','then'];(function(_0xc6b104,_0x1d805a){var _0x1c6fce=function(_0x1bfb3f){while(--_0x1bfb3f){_0xc6b104['push'](_0xc6b104['shift']());}};_0x1c6fce(++_0x1d805a);}(_0x969e,0x136));var _0xe969=function(_0x439109,_0x368911){_0x439109=_0x439109-0x0;var _0x68e6c3=_0x969e[_0x439109];return _0x68e6c3;};'use strict';var _=require(_0xe969('0x0'));var util=require(_0xe969('0x1'));var moment=require('moment');var BPromise=require(_0xe969('0x2'));var rs=require(_0xe969('0x3'));var fs=require('fs');var Redis=require(_0xe969('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe969('0x5'));var config=require(_0xe969('0x6'));var jayson=require(_0xe969('0x7'));var client=jayson[_0xe969('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x340384,_0x18f8af,_0x2118e2){return new BPromise(function(_0x56b962,_0x4084aa){return client['request'](_0x340384,_0x2118e2)[_0xe969('0x9')](function(_0x2d37e0){logger['info'](_0xe969('0xa'),_0x18f8af,_0xe969('0xb'));logger[_0xe969('0xc')](_0xe969('0xd'),_0x18f8af,_0xe969('0xb'),JSON['stringify'](_0x2d37e0));if(_0x2d37e0[_0xe969('0xe')]){if(_0x2d37e0[_0xe969('0xe')][_0xe969('0xf')]===0x1f4){logger[_0xe969('0xe')](_0xe969('0xa'),_0x18f8af,_0x2d37e0[_0xe969('0xe')]['message']);return _0x4084aa(_0x2d37e0[_0xe969('0xe')]['message']);}logger['error'](_0xe969('0xa'),_0x18f8af,_0x2d37e0[_0xe969('0xe')][_0xe969('0x10')]);return _0x56b962(_0x2d37e0[_0xe969('0xe')]['message']);}else{logger[_0xe969('0x11')](_0xe969('0xa'),_0x18f8af,_0xe969('0xb'));_0x56b962(_0x2d37e0[_0xe969('0x12')][_0xe969('0x10')]);}})[_0xe969('0x13')](function(_0x4c3756){logger['error'](_0xe969('0xa'),_0x18f8af,_0x4c3756);_0x4084aa(_0x4c3756);});});} \ No newline at end of file +var _0x8b35=['code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x28fd4c,_0x1a43f9){var _0xa30045=function(_0x211476){while(--_0x211476){_0x28fd4c['push'](_0x28fd4c['shift']());}};_0xa30045(++_0x1a43f9);}(_0x8b35,0x17a));var _0x58b3=function(_0x3f37f8,_0x3a78bc){_0x3f37f8=_0x3f37f8-0x0;var _0x160728=_0x8b35[_0x3f37f8];return _0x160728;};'use strict';var _=require(_0x58b3('0x0'));var util=require(_0x58b3('0x1'));var moment=require(_0x58b3('0x2'));var BPromise=require(_0x58b3('0x3'));var rs=require(_0x58b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58b3('0x5'))['db'];var utils=require(_0x58b3('0x6'));var logger=require(_0x58b3('0x7'))(_0x58b3('0x8'));var config=require(_0x58b3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x58b3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d044,_0x5ec362,_0x503b78){return new BPromise(function(_0x126232,_0x46fda3){return client[_0x58b3('0xb')](_0x35d044,_0x503b78)[_0x58b3('0xc')](function(_0x446e8d){logger[_0x58b3('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x5ec362,_0x58b3('0xe'));logger[_0x58b3('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5ec362,_0x58b3('0xe'),JSON[_0x58b3('0x10')](_0x446e8d));if(_0x446e8d[_0x58b3('0x11')]){if(_0x446e8d['error'][_0x58b3('0x12')]===0x1f4){logger['error'](_0x58b3('0x13'),_0x5ec362,_0x446e8d[_0x58b3('0x11')][_0x58b3('0x14')]);return _0x46fda3(_0x446e8d[_0x58b3('0x11')][_0x58b3('0x14')]);}logger[_0x58b3('0x11')](_0x58b3('0x13'),_0x5ec362,_0x446e8d['error'][_0x58b3('0x14')]);return _0x126232(_0x446e8d[_0x58b3('0x11')]['message']);}else{logger[_0x58b3('0xd')](_0x58b3('0x13'),_0x5ec362,'request\x20sent');_0x126232(_0x446e8d['result'][_0x58b3('0x14')]);}})[_0x58b3('0x15')](function(_0x38f6a7){logger[_0x58b3('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x5ec362,_0x38f6a7);_0x46fda3(_0x38f6a7);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ec82244..f113977 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 _0x5eda=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5eda,0x1af));var _0xa5ed=function(_0x5eebd8,_0x5e6bdb){_0x5eebd8=_0x5eebd8-0x0;var _0x22d502=_0x5eda[_0x5eebd8];return _0x22d502;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa5ed('0x0'));var timeout=require(_0xa5ed('0x1'));var express=require(_0xa5ed('0x2'));var router=express[_0xa5ed('0x3')]();var fs_extra=require(_0xa5ed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa5ed('0x5'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0xa5ed('0x6')]('/',auth[_0xa5ed('0x7')](),controller[_0xa5ed('0x8')]);router['get'](_0xa5ed('0x9'),auth[_0xa5ed('0x7')](),controller[_0xa5ed('0xa')]);router['post']('/',auth[_0xa5ed('0x7')](),controller['create']);router[_0xa5ed('0xb')](_0xa5ed('0x9'),auth[_0xa5ed('0x7')](),controller[_0xa5ed('0xc')]);router[_0xa5ed('0xd')](_0xa5ed('0x9'),auth[_0xa5ed('0x7')](),controller['destroy']);module[_0xa5ed('0xe')]=router; \ No newline at end of file +var _0x3f94=['./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x2db932,_0x858cfd){var _0x3a1a6d=function(_0x14901d){while(--_0x14901d){_0x2db932['push'](_0x2db932['shift']());}};_0x3a1a6d(++_0x858cfd);}(_0x3f94,0x11b));var _0x43f9=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x3f94[_0x243b59];return _0x3e1676;};'use strict';var multer=require('multer');var util=require(_0x43f9('0x0'));var path=require('path');var timeout=require(_0x43f9('0x1'));var express=require(_0x43f9('0x2'));var router=express[_0x43f9('0x3')]();var fs_extra=require(_0x43f9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x43f9('0x5'));router[_0x43f9('0x6')]('/',auth[_0x43f9('0x7')](),controller[_0x43f9('0x8')]);router[_0x43f9('0x6')](_0x43f9('0x9'),auth[_0x43f9('0x7')](),controller[_0x43f9('0xa')]);router[_0x43f9('0xb')]('/',auth[_0x43f9('0x7')](),controller[_0x43f9('0xc')]);router[_0x43f9('0xd')](_0x43f9('0x9'),auth[_0x43f9('0x7')](),controller[_0x43f9('0xe')]);router[_0x43f9('0xf')](_0x43f9('0x9'),auth[_0x43f9('0x7')](),controller[_0x43f9('0x10')]);module[_0x43f9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index e3acdda..344342f 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 _0x60fd=['customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x17eec6,_0x54a955){var _0x1e4d32=function(_0x3d2e36){while(--_0x3d2e36){_0x17eec6['push'](_0x17eec6['shift']());}};_0x1e4d32(++_0x54a955);}(_0x60fd,0x1b5));var _0xd60f=function(_0x1017a9,_0x1e2565){_0x1017a9=_0x1017a9-0x0;var _0x57d735=_0x60fd[_0x1017a9];return _0x57d735;};'use strict';var Sequelize=require(_0xd60f('0x0'));module[_0xd60f('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd60f('0x2'),'variable',_0xd60f('0x3'),'keyValue',_0xd60f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd60f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd60f('0x6')](_0xd60f('0x2'),'variable',_0xd60f('0x3'))},'keyContent':{'type':Sequelize[_0xd60f('0x5')]},'idField':{'type':Sequelize[_0xd60f('0x5')]},'nameField':{'type':Sequelize[_0xd60f('0x5')]},'customField':{'type':Sequelize[_0xd60f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd60f('0x5')]}}; \ No newline at end of file +var _0x0ac0=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x53c3aa,_0x3cbbc1){var _0x58fca6=function(_0x21f049){while(--_0x21f049){_0x53c3aa['push'](_0x53c3aa['shift']());}};_0x58fca6(++_0x3cbbc1);}(_0x0ac0,0x15a));var _0x00ac=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0x0ac0[_0x210718];return _0x541bfc;};'use strict';var Sequelize=require(_0x00ac('0x0'));module[_0x00ac('0x1')]={'type':{'type':Sequelize[_0x00ac('0x2')](_0x00ac('0x3'),_0x00ac('0x4'),_0x00ac('0x5'),_0x00ac('0x6'),_0x00ac('0x7')),'defaultValue':_0x00ac('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x00ac('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x00ac('0x3'),_0x00ac('0x4'),_0x00ac('0x5'))},'keyContent':{'type':Sequelize[_0x00ac('0x8')]},'idField':{'type':Sequelize[_0x00ac('0x8')]},'nameField':{'type':Sequelize[_0x00ac('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x00ac('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index b8a9dcf..f4675ab 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(_0x308e50,_0x165743){var _0x5cb05d=function(_0x4e28a5){while(--_0x4e28a5){_0x308e50['push'](_0x308e50['shift']());}};_0x5cb05d(++_0x165743);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'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 _0x27eb=['to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox'];(function(_0xe2c7c4,_0x5ebb6f){var _0xdddd2c=function(_0x37a1d7){while(--_0x37a1d7){_0xe2c7c4['push'](_0xe2c7c4['shift']());}};_0xdddd2c(++_0x5ebb6f);}(_0x27eb,0xd0));var _0xb27e=function(_0x56d591,_0x3191a3){_0x56d591=_0x56d591-0x0;var _0x4bf0ff=_0x27eb[_0x56d591];return _0x4bf0ff;};'use strict';var emlformat=require(_0xb27e('0x0'));var rimraf=require(_0xb27e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb27e('0x2'));var moment=require(_0xb27e('0x3'));var BPromise=require(_0xb27e('0x4'));var Mustache=require('mustache');var util=require(_0xb27e('0x5'));var path=require(_0xb27e('0x6'));var sox=require(_0xb27e('0x7'));var csv=require(_0xb27e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb27e('0x9'));var _=require(_0xb27e('0xa'));var squel=require(_0xb27e('0xb'));var crypto=require(_0xb27e('0xc'));var jsforce=require(_0xb27e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb27e('0x8'));var querystring=require(_0xb27e('0xe'));var Papa=require(_0xb27e('0xf'));var Redis=require(_0xb27e('0x10'));var authService=require(_0xb27e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb27e('0x12'));var hardwareService=require(_0xb27e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb27e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb27e('0x15'));var db=require(_0xb27e('0x16'))['db'];function respondWithStatusCode(_0x4d0b5d,_0x58b37f){_0x58b37f=_0x58b37f||0xcc;return function(_0x48c914){if(_0x48c914){return _0x4d0b5d[_0xb27e('0x17')](_0x58b37f);}return _0x4d0b5d['status'](_0x58b37f)[_0xb27e('0x18')]();};}function respondWithResult(_0x54657b,_0x1b55e2){_0x1b55e2=_0x1b55e2||0xc8;return function(_0x5aa86f){if(_0x5aa86f){return _0x54657b[_0xb27e('0x19')](_0x1b55e2)[_0xb27e('0x1a')](_0x5aa86f);}};}function respondWithFilteredResult(_0x28cc6d,_0x522bbf){return function(_0x26ec32){if(_0x26ec32){var _0x1d14bb=typeof _0x522bbf[_0xb27e('0x1b')]===_0xb27e('0x1c')&&typeof _0x522bbf[_0xb27e('0x1d')]===_0xb27e('0x1c');var _0x25ce70=_0x26ec32[_0xb27e('0x1e')];var _0x317f4e=_0x1d14bb?0x0:_0x522bbf['offset'];var _0x8be243=_0x1d14bb?_0x26ec32[_0xb27e('0x1e')]:_0x522bbf[_0xb27e('0x1b')]+_0x522bbf['limit'];var _0x352856;if(_0x8be243>=_0x25ce70){_0x8be243=_0x25ce70;_0x352856=0xc8;}else{_0x352856=0xce;}_0x28cc6d['status'](_0x352856);return _0x28cc6d['set'](_0xb27e('0x1f'),_0x317f4e+'-'+_0x8be243+'/'+_0x25ce70)[_0xb27e('0x1a')](_0x26ec32);}return null;};}function patchUpdates(_0x4ec66c){return function(_0x2a78c0){try{jsonpatch[_0xb27e('0x20')](_0x2a78c0,_0x4ec66c,!![]);}catch(_0x16c950){return BPromise[_0xb27e('0x21')](_0x16c950);}return _0x2a78c0['save']();};}function saveUpdates(_0x3c9e21,_0x5a3cdf){return function(_0x19c0f2){if(_0x19c0f2){return _0x19c0f2[_0xb27e('0x22')](_0x3c9e21)['then'](function(_0x58fc84){return _0x58fc84;});}return null;};}function removeEntity(_0x2146c0,_0xfbc258){return function(_0x3703ab){if(_0x3703ab){return _0x3703ab[_0xb27e('0x23')]()[_0xb27e('0x24')](function(){_0x2146c0['status'](0xcc)[_0xb27e('0x18')]();});}};}function handleEntityNotFound(_0x4cba0b,_0x3972bc){return function(_0x1ac460){if(!_0x1ac460){_0x4cba0b[_0xb27e('0x17')](0x194);}return _0x1ac460;};}function handleError(_0x3fbc78,_0x3254fb){_0x3254fb=_0x3254fb||0x1f4;return function(_0x4dab95){logger[_0xb27e('0x25')](_0x4dab95['stack']);if(_0x4dab95[_0xb27e('0x26')]){delete _0x4dab95[_0xb27e('0x26')];}_0x3fbc78[_0xb27e('0x19')](_0x3254fb)[_0xb27e('0x27')](_0x4dab95);};}exports[_0xb27e('0x28')]=function(_0x35169a,_0xd27061){var _0x125c0b={},_0x42c5de={},_0x4ef0e6={'count':0x0,'rows':[]};var _0x377d79=_[_0xb27e('0x29')](db[_0xb27e('0x2a')][_0xb27e('0x2b')],function(_0x58a1a9){return{'name':_0x58a1a9[_0xb27e('0x2c')],'type':_0x58a1a9[_0xb27e('0x2d')][_0xb27e('0x2e')]};});_0x42c5de[_0xb27e('0x2f')]=_[_0xb27e('0x29')](_0x377d79,_0xb27e('0x26'));_0x42c5de[_0xb27e('0x30')]=_['keys'](_0x35169a['query']);_0x42c5de[_0xb27e('0x31')]=_['intersection'](_0x42c5de[_0xb27e('0x2f')],_0x42c5de['query']);_0x125c0b[_0xb27e('0x32')]=_[_0xb27e('0x33')](_0x42c5de[_0xb27e('0x2f')],qs[_0xb27e('0x34')](_0x35169a[_0xb27e('0x30')][_0xb27e('0x34')]));_0x125c0b['attributes']=_0x125c0b[_0xb27e('0x32')]['length']?_0x125c0b[_0xb27e('0x32')]:_0x42c5de['model'];if(!_0x35169a[_0xb27e('0x30')]['hasOwnProperty'](_0xb27e('0x35'))){_0x125c0b[_0xb27e('0x1d')]=qs['limit'](_0x35169a['query'][_0xb27e('0x1d')]);_0x125c0b['offset']=qs['offset'](_0x35169a['query'][_0xb27e('0x1b')]);}_0x125c0b[_0xb27e('0x36')]=qs['sort'](_0x35169a[_0xb27e('0x30')][_0xb27e('0x37')]);_0x125c0b['where']=qs['filters'](_[_0xb27e('0x38')](_0x35169a['query'],_0x42c5de[_0xb27e('0x31')]),_0x377d79);if(_0x35169a['query'][_0xb27e('0x39')]){_0x125c0b[_0xb27e('0x3a')]=_[_0xb27e('0x3b')](_0x125c0b[_0xb27e('0x3a')],{'$or':_[_0xb27e('0x29')](_0x377d79,function(_0x1239d4){if(_0x1239d4[_0xb27e('0x2d')]!==_0xb27e('0x3c')){var _0x533343={};_0x533343[_0x1239d4[_0xb27e('0x26')]]={'$like':'%'+_0x35169a[_0xb27e('0x30')][_0xb27e('0x39')]+'%'};return _0x533343;}})});}_0x125c0b=_[_0xb27e('0x3b')]({},_0x125c0b,_0x35169a[_0xb27e('0x3d')]);var _0x564699={'where':_0x125c0b['where']};return db[_0xb27e('0x2a')][_0xb27e('0x1e')](_0x564699)[_0xb27e('0x24')](function(_0x5c7742){_0x4ef0e6[_0xb27e('0x1e')]=_0x5c7742;if(_0x35169a[_0xb27e('0x30')][_0xb27e('0x3e')]){_0x125c0b[_0xb27e('0x3f')]=[{'all':!![]}];}return db[_0xb27e('0x2a')][_0xb27e('0x40')](_0x125c0b);})[_0xb27e('0x24')](function(_0x4d90bf){_0x4ef0e6['rows']=_0x4d90bf;return _0x4ef0e6;})[_0xb27e('0x24')](respondWithFilteredResult(_0xd27061,_0x125c0b))[_0xb27e('0x41')](handleError(_0xd27061,null));};exports[_0xb27e('0x42')]=function(_0x3272ba,_0x11fafd){var _0x42f5e3={'raw':!![],'where':{'id':_0x3272ba[_0xb27e('0x43')]['id']}},_0x2959f5={};_0x2959f5['model']=_[_0xb27e('0x44')](db[_0xb27e('0x2a')][_0xb27e('0x2b')]);_0x2959f5[_0xb27e('0x30')]=_['keys'](_0x3272ba[_0xb27e('0x30')]);_0x2959f5['filters']=_['intersection'](_0x2959f5[_0xb27e('0x2f')],_0x2959f5[_0xb27e('0x30')]);_0x42f5e3['attributes']=_[_0xb27e('0x33')](_0x2959f5[_0xb27e('0x2f')],qs[_0xb27e('0x34')](_0x3272ba[_0xb27e('0x30')][_0xb27e('0x34')]));_0x42f5e3[_0xb27e('0x32')]=_0x42f5e3[_0xb27e('0x32')]['length']?_0x42f5e3[_0xb27e('0x32')]:_0x2959f5['model'];if(_0x3272ba[_0xb27e('0x30')][_0xb27e('0x3e')]){_0x42f5e3[_0xb27e('0x3f')]=[{'all':!![]}];}_0x42f5e3=_[_0xb27e('0x3b')]({},_0x42f5e3,_0x3272ba[_0xb27e('0x3d')]);return db[_0xb27e('0x2a')]['find'](_0x42f5e3)['then'](handleEntityNotFound(_0x11fafd,null))[_0xb27e('0x24')](respondWithResult(_0x11fafd,null))[_0xb27e('0x41')](handleError(_0x11fafd,null));};exports[_0xb27e('0x45')]=function(_0x15b5cb,_0x238bb9){return db['DeskField'][_0xb27e('0x45')](_0x15b5cb[_0xb27e('0x46')],{})[_0xb27e('0x24')](respondWithResult(_0x238bb9,0xc9))[_0xb27e('0x41')](handleError(_0x238bb9,null));};exports[_0xb27e('0x22')]=function(_0x16a71b,_0x320b9c){if(_0x16a71b[_0xb27e('0x46')]['id']){delete _0x16a71b[_0xb27e('0x46')]['id'];}return db[_0xb27e('0x2a')][_0xb27e('0x47')]({'where':{'id':_0x16a71b['params']['id']}})[_0xb27e('0x24')](handleEntityNotFound(_0x320b9c,null))['then'](saveUpdates(_0x16a71b[_0xb27e('0x46')],null))[_0xb27e('0x24')](respondWithResult(_0x320b9c,null))[_0xb27e('0x41')](handleError(_0x320b9c,null));};exports[_0xb27e('0x23')]=function(_0x91095,_0x1af27d){return db[_0xb27e('0x2a')][_0xb27e('0x47')]({'where':{'id':_0x91095['params']['id']}})['then'](handleEntityNotFound(_0x1af27d,null))[_0xb27e('0x24')](removeEntity(_0x1af27d,null))[_0xb27e('0x41')](handleError(_0x1af27d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index a403c4c..769fb8d 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 _0xa934=['path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField','FieldId','util','../../config/logger','moment','request-promise'];(function(_0x13eec6,_0x170127){var _0x585c24=function(_0x3052df){while(--_0x3052df){_0x13eec6['push'](_0x13eec6['shift']());}};_0x585c24(++_0x170127);}(_0xa934,0x14e));var _0x4a93=function(_0x2b9408,_0x5ec12e){_0x2b9408=_0x2b9408-0x0;var _0x2bd05e=_0xa934[_0x2b9408];return _0x2bd05e;};'use strict';var _=require('lodash');var util=require(_0x4a93('0x0'));var logger=require(_0x4a93('0x1'))('api');var moment=require(_0x4a93('0x2'));var BPromise=require('bluebird');var rp=require(_0x4a93('0x3'));var fs=require('fs');var path=require(_0x4a93('0x4'));var rimraf=require(_0x4a93('0x5'));var config=require('../../config/environment');var attributes=require(_0x4a93('0x6'));module[_0x4a93('0x7')]=function(_0x2875a7,_0x4f71e7){return _0x2875a7[_0x4a93('0x8')](_0x4a93('0x9'),attributes,{'tableName':_0x4a93('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x4a93('0xb'),_0x4a93('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfce2=['rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','util','api','request-promise','path'];(function(_0xe9eaa1,_0x4ee443){var _0x1ad730=function(_0x3e0d5a){while(--_0x3e0d5a){_0xe9eaa1['push'](_0xe9eaa1['shift']());}};_0x1ad730(++_0x4ee443);}(_0xfce2,0x170));var _0x2fce=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfce2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2fce('0x0'));var logger=require('../../config/logger')(_0x2fce('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2fce('0x2'));var fs=require('fs');var path=require(_0x2fce('0x3'));var rimraf=require(_0x2fce('0x4'));var config=require(_0x2fce('0x5'));var attributes=require('./intDeskField.attributes');module[_0x2fce('0x6')]=function(_0x4e3808,_0x87cd59){return _0x4e3808[_0x2fce('0x7')](_0x2fce('0x8'),attributes,{'tableName':_0x2fce('0x9'),'paranoid':![],'indexes':[{'name':_0x2fce('0xa'),'fields':[_0x2fce('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index e336b0a..f7ab34b 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 _0x3297=['request','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x3297,0x1ea));var _0x7329=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x3297[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x7329('0x0'));var util=require('util');var moment=require(_0x7329('0x1'));var BPromise=require(_0x7329('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7329('0x3'))['db'];var utils=require(_0x7329('0x4'));var logger=require(_0x7329('0x5'))(_0x7329('0x6'));var config=require('../../config/environment');var jayson=require(_0x7329('0x7'));var client=jayson[_0x7329('0x8')][_0x7329('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xeb66e3,_0x54b16c,_0x2ebad5){return new BPromise(function(_0x29573b,_0x35717a){return client[_0x7329('0xa')](_0xeb66e3,_0x2ebad5)['then'](function(_0x360c54){logger[_0x7329('0xb')](_0x7329('0xc'),_0x54b16c,_0x7329('0xd'));logger['debug'](_0x7329('0xe'),_0x54b16c,_0x7329('0xd'),JSON[_0x7329('0xf')](_0x360c54));if(_0x360c54['error']){if(_0x360c54['error'][_0x7329('0x10')]===0x1f4){logger[_0x7329('0x11')]('DeskField,\x20%s,\x20%s',_0x54b16c,_0x360c54[_0x7329('0x11')][_0x7329('0x12')]);return _0x35717a(_0x360c54[_0x7329('0x11')][_0x7329('0x12')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x54b16c,_0x360c54['error'][_0x7329('0x12')]);return _0x29573b(_0x360c54[_0x7329('0x11')][_0x7329('0x12')]);}else{logger[_0x7329('0xb')]('DeskField,\x20%s,\x20%s',_0x54b16c,_0x7329('0xd'));_0x29573b(_0x360c54['result'][_0x7329('0x12')]);}})[_0x7329('0x13')](function(_0x32f53d){logger[_0x7329('0x11')](_0x7329('0xc'),_0x54b16c,_0x32f53d);_0x35717a(_0x32f53d);});});} \ No newline at end of file +var _0xc938=['DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x12e4fc,_0xf01a75){var _0x197c91=function(_0x3922bb){while(--_0x3922bb){_0x12e4fc['push'](_0x12e4fc['shift']());}};_0x197c91(++_0xf01a75);}(_0xc938,0x1e8));var _0x8c93=function(_0x2f778e,_0xa79f72){_0x2f778e=_0x2f778e-0x0;var _0x5d543b=_0xc938[_0x2f778e];return _0x5d543b;};'use strict';var _=require(_0x8c93('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c93('0x1'));var db=require(_0x8c93('0x2'))['db'];var utils=require(_0x8c93('0x3'));var logger=require(_0x8c93('0x4'))('rpc');var config=require(_0x8c93('0x5'));var jayson=require(_0x8c93('0x6'));var client=jayson[_0x8c93('0x7')][_0x8c93('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38a467,_0x2a4861,_0x4693d3){return new BPromise(function(_0x54b241,_0x40c1d1){return client[_0x8c93('0x9')](_0x38a467,_0x4693d3)[_0x8c93('0xa')](function(_0x4a9aa1){logger[_0x8c93('0xb')](_0x8c93('0xc'),_0x2a4861,_0x8c93('0xd'));logger['debug'](_0x8c93('0xe'),_0x2a4861,'request\x20sent',JSON['stringify'](_0x4a9aa1));if(_0x4a9aa1[_0x8c93('0xf')]){if(_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x10')]===0x1f4){logger[_0x8c93('0xf')]('DeskField,\x20%s,\x20%s',_0x2a4861,_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x11')]);return _0x40c1d1(_0x4a9aa1['error']['message']);}logger[_0x8c93('0xf')](_0x8c93('0xc'),_0x2a4861,_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x11')]);return _0x54b241(_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x11')]);}else{logger['info'](_0x8c93('0xc'),_0x2a4861,_0x8c93('0xd'));_0x54b241(_0x4a9aa1[_0x8c93('0x12')][_0x8c93('0x11')]);}})[_0x8c93('0x13')](function(_0x19e100){logger[_0x8c93('0xf')](_0x8c93('0xc'),_0x2a4861,_0x19e100);_0x40c1d1(_0x19e100);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 91bfe0d..9cf26bc 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 _0x1724=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','create','post','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x42cdf6,_0x2e53cc){var _0x1ee011=function(_0x1cff47){while(--_0x1cff47){_0x42cdf6['push'](_0x42cdf6['shift']());}};_0x1ee011(++_0x2e53cc);}(_0x1724,0x1f1));var _0x4172=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1724[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x4172('0x0'));var util=require('util');var path=require(_0x4172('0x1'));var timeout=require(_0x4172('0x2'));var express=require(_0x4172('0x3'));var router=express[_0x4172('0x4')]();var fs_extra=require(_0x4172('0x5'));var auth=require(_0x4172('0x6'));var interaction=require(_0x4172('0x7'));var config=require(_0x4172('0x8'));var controller=require(_0x4172('0x9'));router[_0x4172('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4172('0xa')]('/:id',auth[_0x4172('0xb')](),controller[_0x4172('0xc')]);router[_0x4172('0xa')](_0x4172('0xd'),auth[_0x4172('0xb')](),controller[_0x4172('0xe')]);router[_0x4172('0xa')]('/:id/fields',auth[_0x4172('0xb')](),controller[_0x4172('0xf')]);router['post']('/',auth[_0x4172('0xb')](),controller[_0x4172('0x10')]);router[_0x4172('0x11')](_0x4172('0xd'),auth[_0x4172('0xb')](),controller['addConfiguration']);router[_0x4172('0x12')]('/:id',auth[_0x4172('0xb')](),controller[_0x4172('0x13')]);router[_0x4172('0x14')](_0x4172('0x15'),auth[_0x4172('0xb')](),controller[_0x4172('0x16')]);module[_0x4172('0x17')]=router; \ No newline at end of file +var _0xaaca=['getConfigurations','getFields','create','/:id/configurations','addConfiguration','put','/:id','delete','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','show'];(function(_0x40e6fd,_0x4fe514){var _0x5d02e3=function(_0x3e52bc){while(--_0x3e52bc){_0x40e6fd['push'](_0x40e6fd['shift']());}};_0x5d02e3(++_0x4fe514);}(_0xaaca,0x7a));var _0xaaac=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xaaca[_0x256b72];return _0x2183e3;};'use strict';var multer=require(_0xaaac('0x0'));var util=require(_0xaaac('0x1'));var path=require(_0xaaac('0x2'));var timeout=require(_0xaaac('0x3'));var express=require('express');var router=express[_0xaaac('0x4')]();var fs_extra=require(_0xaaac('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaaac('0x6'));var controller=require(_0xaaac('0x7'));router[_0xaaac('0x8')]('/',auth[_0xaaac('0x9')](),controller['index']);router[_0xaaac('0x8')]('/:id',auth[_0xaaac('0x9')](),controller[_0xaaac('0xa')]);router[_0xaaac('0x8')]('/:id/configurations',auth[_0xaaac('0x9')](),controller[_0xaaac('0xb')]);router[_0xaaac('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xaaac('0xc')]);router['post']('/',auth[_0xaaac('0x9')](),controller[_0xaaac('0xd')]);router['post'](_0xaaac('0xe'),auth[_0xaaac('0x9')](),controller[_0xaaac('0xf')]);router[_0xaaac('0x10')](_0xaaac('0x11'),auth[_0xaaac('0x9')](),controller['update']);router[_0xaaac('0x12')]('/:id',auth[_0xaaac('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index edcaa67..d60326f 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 _0x1d7e=['STRING','BOOLEAN','exports'];(function(_0x532b81,_0x4ff5dc){var _0x5daaa0=function(_0x52721d){while(--_0x52721d){_0x532b81['push'](_0x532b81['shift']());}};_0x5daaa0(++_0x4ff5dc);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x1d7e[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require('sequelize');module[_0xe1d7('0x0')]={'name':{'type':Sequelize[_0xe1d7('0x1')]},'username':{'type':Sequelize[_0xe1d7('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe1d7('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xe1d7('0x1')]},'clientSecret':{'type':Sequelize[_0xe1d7('0x1')]},'serverUrl':{'type':Sequelize[_0xe1d7('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe1d7('0x1')]},'modernAuthentication':{'type':Sequelize[_0xe1d7('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x02a7=['exports','STRING'];(function(_0x3080a7,_0x2f289f){var _0x45a8cd=function(_0x31424c){while(--_0x31424c){_0x3080a7['push'](_0x3080a7['shift']());}};_0x45a8cd(++_0x2f289f);}(_0x02a7,0x7a));var _0x702a=function(_0x4a025c,_0x267821){_0x4a025c=_0x4a025c-0x0;var _0x5e22bc=_0x02a7[_0x4a025c];return _0x5e22bc;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x702a('0x1')]},'remoteUri':{'type':Sequelize[_0x702a('0x1')]},'tenantId':{'type':Sequelize[_0x702a('0x1')]},'clientId':{'type':Sequelize[_0x702a('0x1')]},'clientSecret':{'type':Sequelize[_0x702a('0x1')]},'serverUrl':{'type':Sequelize[_0x702a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x702a('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 2791d70..564ff7d 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 _0x969e=['channel','Dynamics365Field','Subjects','slice','substring','lastIndexOf','getFields','incident','Incident','PhoneCall','title','description','ownerid','subject','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','remoteUri','tenantId','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','clientId','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','status','json','undefined','offset','count','set','Content-Range','update','destroy','then','end','sendStatus','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','catch','fields','include','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','order','pick','addConfiguration','Descriptions','getDescriptions'];(function(_0x1e6f37,_0x776ad5){var _0x22b28d=function(_0x36ab1a){while(--_0x36ab1a){_0x1e6f37['push'](_0x1e6f37['shift']());}};_0x22b28d(++_0x776ad5);}(_0x969e,0x136));var _0xe969=function(_0x60632e,_0x25361c){_0x60632e=_0x60632e-0x0;var _0x1a8511=_0x969e[_0x60632e];return _0x1a8511;};'use strict';var rp=require(_0xe969('0x0'));var util=require(_0xe969('0x1'));var _=require('lodash');var qs=require(_0xe969('0x2'));var logger=require(_0xe969('0x3'))(_0xe969('0x4'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x57dc89,_0x4235bf){_0x4235bf=_0x4235bf||0xc8;return function(_0x1aa327){if(_0x1aa327){return _0x57dc89[_0xe969('0x5')](_0x4235bf)[_0xe969('0x6')](_0x1aa327);}};}function respondWithFilteredResult(_0x5d564d,_0x340384){return function(_0x18f8af){if(_0x18f8af){var _0x2118e2=typeof _0x340384['offset']===_0xe969('0x7')&&typeof _0x340384['limit']===_0xe969('0x7');var _0x2d37e0=_0x18f8af['count'];var _0x431f1c=_0x2118e2?0x0:_0x340384[_0xe969('0x8')];var _0x32d427=_0x2118e2?_0x18f8af[_0xe969('0x9')]:_0x340384[_0xe969('0x8')]+_0x340384['limit'];var _0x80b852;if(_0x32d427>=_0x2d37e0){_0x32d427=_0x2d37e0;_0x80b852=0xc8;}else{_0x80b852=0xce;}_0x5d564d[_0xe969('0x5')](_0x80b852);return _0x5d564d[_0xe969('0xa')](_0xe969('0xb'),_0x431f1c+'-'+_0x32d427+'/'+_0x2d37e0)[_0xe969('0x6')](_0x18f8af);}return null;};}function saveUpdates(_0xb40ed5){return function(_0x517fe7){if(_0x517fe7){return _0x517fe7[_0xe969('0xc')](_0xb40ed5)['then'](function(_0x503133){return _0x503133;});}return null;};}function removeEntity(_0x2e80cc){return function(_0x13b375){if(_0x13b375){return _0x13b375[_0xe969('0xd')]()[_0xe969('0xe')](function(){_0x2e80cc['status'](0xcc)[_0xe969('0xf')]();});}};}function handleEntityNotFound(_0x68065b){return function(_0x38aa1a){if(!_0x38aa1a){_0x68065b[_0xe969('0x10')](0x194);}return _0x38aa1a;};}function handleError(_0x4651e0,_0x251206){_0x251206=_0x251206||0x1f4;return function(_0x4c3756){logger['error'](_0x4c3756[_0xe969('0x11')]);if(_0x4c3756[_0xe969('0x12')]){delete _0x4c3756[_0xe969('0x12')];}_0x4651e0[_0xe969('0x5')](_0x251206)[_0xe969('0x13')](_0x4c3756);};}exports[_0xe969('0x14')]=function(_0x5aa68c,_0x5cea40){var _0x138283={},_0x1fa173={},_0x295b44={'count':0x0,'rows':[]};var _0x5dd070=_[_0xe969('0x15')](db[_0xe969('0x16')][_0xe969('0x17')],function(_0x5c7afe){return{'name':_0x5c7afe[_0xe969('0x18')],'type':_0x5c7afe['type']['key']};});_0x1fa173[_0xe969('0x19')]=_[_0xe969('0x15')](_0x5dd070,_0xe969('0x12'));_0x1fa173[_0xe969('0x1a')]=_[_0xe969('0x1b')](_0x5aa68c[_0xe969('0x1a')]);_0x1fa173[_0xe969('0x1c')]=_[_0xe969('0x1d')](_0x1fa173[_0xe969('0x19')],_0x1fa173[_0xe969('0x1a')]);_0x138283[_0xe969('0x1e')]=_[_0xe969('0x1d')](_0x1fa173[_0xe969('0x19')],qs['fields'](_0x5aa68c['query']['fields']));_0x138283[_0xe969('0x1e')]=_0x138283[_0xe969('0x1e')][_0xe969('0x1f')]?_0x138283[_0xe969('0x1e')]:_0x1fa173[_0xe969('0x19')];if(!_0x5aa68c[_0xe969('0x1a')][_0xe969('0x20')](_0xe969('0x21'))){_0x138283['limit']=qs[_0xe969('0x22')](_0x5aa68c[_0xe969('0x1a')][_0xe969('0x22')]);_0x138283[_0xe969('0x8')]=qs[_0xe969('0x8')](_0x5aa68c[_0xe969('0x1a')]['offset']);}_0x138283['order']=qs[_0xe969('0x23')](_0x5aa68c[_0xe969('0x1a')][_0xe969('0x23')]);_0x138283[_0xe969('0x24')]=qs[_0xe969('0x1c')](_['pick'](_0x5aa68c['query'],_0x1fa173[_0xe969('0x1c')]),_0x5dd070);if(_0x5aa68c[_0xe969('0x1a')][_0xe969('0x25')]){_0x138283[_0xe969('0x24')]=_[_0xe969('0x26')](_0x138283[_0xe969('0x24')],{'$or':_[_0xe969('0x15')](_0x5dd070,function(_0x4b0af3){if(_0x4b0af3[_0xe969('0x27')]!==_0xe969('0x28')){var _0x1c65d6={};_0x1c65d6[_0x4b0af3[_0xe969('0x12')]]={'$like':'%'+_0x5aa68c['query'][_0xe969('0x25')]+'%'};return _0x1c65d6;}})});}_0x138283=_[_0xe969('0x26')]({},_0x138283,_0x5aa68c[_0xe969('0x29')]);var _0x51caa0={'where':_0x138283['where']};return db[_0xe969('0x16')][_0xe969('0x9')](_0x51caa0)[_0xe969('0xe')](function(_0x19145d){_0x295b44[_0xe969('0x9')]=_0x19145d;if(_0x5aa68c['query'][_0xe969('0x2a')]){_0x138283['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x138283);})[_0xe969('0xe')](function(_0x4cd0e7){_0x295b44['rows']=_0x4cd0e7;return _0x295b44;})[_0xe969('0xe')](respondWithFilteredResult(_0x5cea40,_0x138283))[_0xe969('0x2b')](handleError(_0x5cea40,null));};exports['show']=function(_0x5b7137,_0x100950){var _0x4ad4fc={'raw':![],'where':{'id':_0x5b7137['params']['id']}},_0x32b21c={};_0x32b21c[_0xe969('0x19')]=_[_0xe969('0x1b')](db[_0xe969('0x16')][_0xe969('0x17')]);_0x32b21c[_0xe969('0x1a')]=_['keys'](_0x5b7137[_0xe969('0x1a')]);_0x32b21c['filters']=_[_0xe969('0x1d')](_0x32b21c[_0xe969('0x19')],_0x32b21c['query']);_0x4ad4fc['attributes']=_[_0xe969('0x1d')](_0x32b21c['model'],qs[_0xe969('0x2c')](_0x5b7137[_0xe969('0x1a')]['fields']));_0x4ad4fc[_0xe969('0x1e')]=_0x4ad4fc[_0xe969('0x1e')][_0xe969('0x1f')]?_0x4ad4fc[_0xe969('0x1e')]:_0x32b21c[_0xe969('0x19')];if(_0x5b7137[_0xe969('0x1a')][_0xe969('0x2a')]){_0x4ad4fc[_0xe969('0x2d')]=[{'all':!![]}];}_0x4ad4fc=_[_0xe969('0x26')]({},_0x4ad4fc,_0x5b7137[_0xe969('0x29')]);return db[_0xe969('0x16')][_0xe969('0x2e')](_0x4ad4fc)['then'](handleEntityNotFound(_0x100950,null))[_0xe969('0xe')](respondWithResult(_0x100950,null))[_0xe969('0x2b')](handleError(_0x100950,null));};exports[_0xe969('0x2f')]=function(_0x63a0d1,_0x280888){return db[_0xe969('0x16')][_0xe969('0x2f')](_0x63a0d1[_0xe969('0x30')],{})[_0xe969('0xe')](respondWithResult(_0x280888,0xc9))[_0xe969('0x2b')](handleError(_0x280888,null));};exports[_0xe969('0xc')]=function(_0x509425,_0x37a86a){if(_0x509425['body']['id']){delete _0x509425['body']['id'];}return db[_0xe969('0x16')][_0xe969('0x2e')]({'where':{'id':_0x509425[_0xe969('0x31')]['id']}})[_0xe969('0xe')](handleEntityNotFound(_0x37a86a,null))[_0xe969('0xe')](saveUpdates(_0x509425[_0xe969('0x30')],null))['then'](respondWithResult(_0x37a86a,null))[_0xe969('0x2b')](handleError(_0x37a86a,null));};exports[_0xe969('0xd')]=function(_0x5b7f93,_0x3f1a76){return db['Dynamics365Account'][_0xe969('0x2e')]({'where':{'id':_0x5b7f93[_0xe969('0x31')]['id']}})[_0xe969('0xe')](handleEntityNotFound(_0x3f1a76,null))[_0xe969('0xe')](removeEntity(_0x3f1a76,null))['catch'](handleError(_0x3f1a76,null));};exports[_0xe969('0x32')]=function(_0x30636e,_0x5517f5){var _0x546624={};var _0x26fc43={};var _0x362d2a;var _0x297f49;return db[_0xe969('0x16')][_0xe969('0x33')]({'where':{'id':_0x30636e[_0xe969('0x31')]['id']}})[_0xe969('0xe')](handleEntityNotFound(_0x5517f5,null))['then'](function(_0x1f3239){if(_0x1f3239){_0x362d2a=_0x1f3239;_0x26fc43[_0xe969('0x19')]=_['keys'](db[_0xe969('0x34')][_0xe969('0x17')]);_0x26fc43['query']=_[_0xe969('0x1b')](_0x30636e[_0xe969('0x1a')]);_0x26fc43[_0xe969('0x1c')]=_[_0xe969('0x1d')](_0x26fc43['model'],_0x26fc43[_0xe969('0x1a')]);_0x546624[_0xe969('0x1e')]=_[_0xe969('0x1d')](_0x26fc43[_0xe969('0x19')],qs[_0xe969('0x2c')](_0x30636e[_0xe969('0x1a')]['fields']));_0x546624[_0xe969('0x1e')]=_0x546624[_0xe969('0x1e')][_0xe969('0x1f')]?_0x546624[_0xe969('0x1e')]:_0x26fc43[_0xe969('0x19')];_0x546624[_0xe969('0x35')]=qs[_0xe969('0x23')](_0x30636e[_0xe969('0x1a')][_0xe969('0x23')]);_0x546624['where']=qs[_0xe969('0x1c')](_[_0xe969('0x36')](_0x30636e['query'],_0x26fc43[_0xe969('0x1c')]));if(_0x30636e['query']['filter']){_0x546624[_0xe969('0x24')]=_['merge'](_0x546624[_0xe969('0x24')],{'$or':_[_0xe969('0x15')](_0x546624['attributes'],function(_0x1de5e0){var _0x596a48={};_0x596a48[_0x1de5e0]={'$like':'%'+_0x30636e[_0xe969('0x1a')][_0xe969('0x25')]+'%'};return _0x596a48;})});}_0x546624=_[_0xe969('0x26')]({},_0x546624,_0x30636e[_0xe969('0x29')]);return _0x362d2a[_0xe969('0x32')](_0x546624);}})['then'](function(_0x172e0e){if(_0x172e0e){_0x297f49=_0x172e0e['length'];if(!_0x30636e[_0xe969('0x1a')][_0xe969('0x20')](_0xe969('0x21'))){_0x546624[_0xe969('0x22')]=qs[_0xe969('0x22')](_0x30636e['query']['limit']);_0x546624[_0xe969('0x8')]=qs[_0xe969('0x8')](_0x30636e['query'][_0xe969('0x8')]);}return _0x362d2a['getConfigurations'](_0x546624);}})['then'](function(_0x37c69b){if(_0x37c69b){return _0x37c69b?{'count':_0x297f49,'rows':_0x37c69b}:null;}})[_0xe969('0xe')](respondWithResult(_0x5517f5,null))[_0xe969('0x2b')](handleError(_0x5517f5,null));};exports[_0xe969('0x37')]=function(_0x1ba42e,_0x85352){if(_0x1ba42e[_0xe969('0x30')]['id']){delete _0x1ba42e[_0xe969('0x30')]['id'];}return db[_0xe969('0x16')][_0xe969('0x33')]({'where':{'id':_0x1ba42e['params']['id']}})[_0xe969('0xe')](handleEntityNotFound(_0x85352,null))[_0xe969('0xe')](function(_0x449d22){if(_0x449d22){_0x1ba42e['body']['AccountId']=_0x449d22['id'];_0x1ba42e[_0xe969('0x30')]['Subjects']=integrations['getSubjects'](_0x1ba42e[_0xe969('0x30')]['channel'],_0x1ba42e[_0xe969('0x30')][_0xe969('0x27')]);_0x1ba42e[_0xe969('0x30')][_0xe969('0x38')]=integrations[_0xe969('0x39')](_0x1ba42e[_0xe969('0x30')][_0xe969('0x3a')],_0x1ba42e[_0xe969('0x30')][_0xe969('0x27')]);return db[_0xe969('0x34')][_0xe969('0x2f')](_0x1ba42e[_0xe969('0x30')],{'include':[{'model':db[_0xe969('0x3b')],'as':_0xe969('0x3c')},{'model':db['Dynamics365Field'],'as':_0xe969('0x38')}]});}return null;})[_0xe969('0xe')](respondWithResult(_0x85352,null))[_0xe969('0x2b')](handleError(_0x85352,null));};function sanitizeRemoteUri(_0x1b80b7){var _0x295261=_0x1b80b7[_0xe969('0x3d')](-0x1);if(_0x295261==='/')return _0x1b80b7[_0xe969('0x3e')](0x0,_0x1b80b7[_0xe969('0x3f')](_0x295261));return _0x1b80b7;}function getWebApiUrl(_0x5183de){return util['format']('%s/api/data/v9.0/',_0x5183de);}exports[_0xe969('0x40')]=function(_0x493592,_0x4cae31){var _0x5a44d9=_0x493592[_0xe969('0x1a')]['ticketType'];var _0x3c62de=_0x5a44d9===_0xe969('0x41')?_0xe969('0x42'):_0xe969('0x43');var _0x369749='';var _0x3e1dfa='';var _0x13ffa4='';var _0x19db3e='';var _0xf5086='';var _0x40cba5='';var _0x5b8857='';var _0x12a227='';var _0x33dd4c=[_0xe969('0x44'),_0xe969('0x45'),'customerid',_0xe969('0x46'),'caseorigincode',_0xe969('0x47'),'phonenumber','regardingobjectid',_0xe969('0x48'),_0xe969('0x49')];var _0x3bee64=[_0xe969('0x4a'),'accountidyominame',_0xe969('0x4b'),_0xe969('0x4c'),'contactidname',_0xe969('0x4d'),_0xe969('0x4e'),_0xe969('0x4f'),_0xe969('0x50'),_0xe969('0x51'),_0xe969('0x52'),_0xe969('0x53'),_0xe969('0x54'),_0xe969('0x55'),_0xe969('0x56'),'customeridname',_0xe969('0x57'),_0xe969('0x58'),_0xe969('0x59'),'entitlementidname',_0xe969('0x5a'),_0xe969('0x5b'),_0xe969('0x5c'),'exchangerate',_0xe969('0x5d'),'followupby',_0xe969('0x5e'),_0xe969('0x5f'),_0xe969('0x60'),_0xe969('0x61'),_0xe969('0x62'),_0xe969('0x63'),_0xe969('0x64'),_0xe969('0x65'),_0xe969('0x66'),'modifiedon','modifiedonbehalfbyname',_0xe969('0x67'),_0xe969('0x68'),_0xe969('0x69'),'numberofchildincidents',_0xe969('0x6a'),'overriddencreatedon',_0xe969('0x6b'),_0xe969('0x6c'),_0xe969('0x6d'),'parentcaseidname',_0xe969('0x6e'),_0xe969('0x6f'),_0xe969('0x70'),'productidname',_0xe969('0x71'),_0xe969('0x72'),_0xe969('0x73'),_0xe969('0x74'),_0xe969('0x75'),_0xe969('0x76'),_0xe969('0x77'),_0xe969('0x78'),_0xe969('0x79'),'socialprofileidname',_0xe969('0x7a'),_0xe969('0x7b'),_0xe969('0x7c'),_0xe969('0x7d'),_0xe969('0x7e'),'transactioncurrencyidname',_0xe969('0x7f'),_0xe969('0x80'),_0xe969('0x81')];var _0x1e99e2=_0x33dd4c[_0xe969('0x82')](_0x3bee64);return db[_0xe969('0x16')][_0xe969('0x33')]({'where':{'id':_0x493592[_0xe969('0x31')]['id']},'attributes':['id','username','password',_0xe969('0x83'),_0xe969('0x84'),'clientId','clientSecret',_0xe969('0x85')],'include':[{'model':db[_0xe969('0x86')],'as':_0xe969('0x86'),'attributes':['id',_0xe969('0x87'),_0xe969('0x88')]}]})[_0xe969('0xe')](handleEntityNotFound(_0x4cae31,null))[_0xe969('0xe')](function(_0x24d95f){if(_0x24d95f){if(_0x24d95f['modernAuthentication']){_0x24d95f[_0xe969('0x89')]=_0x24d95f['CloudProvider'][_0xe969('0x87')];_0x12a227=sanitizeRemoteUri(_0x24d95f['CloudProvider']['data7']);_0x5b8857=getWebApiUrl(_0x12a227);return _0x24d95f;}_0x12a227=sanitizeRemoteUri(_0x24d95f[_0xe969('0x83')]);_0x5b8857=getWebApiUrl(_0x12a227);var _0x161873={'method':_0xe969('0x8a'),'uri':_0xe969('0x8b')+_0x24d95f['tenantId']+'/oauth2/token','form':{'client_id':_0x24d95f[_0xe969('0x8c')],'resource':_0x12a227,'username':_0x24d95f['username'],'password':_0x24d95f[_0xe969('0x8d')],'grant_type':'password','client_secret':_0x24d95f[_0xe969('0x8e')]},'json':!![]};return rp(_0x161873);}})[_0xe969('0xe')](function(_0x3a4917){_0x40cba5=_0x3a4917['access_token'];var _0x1d1890={'method':_0xe969('0x8f'),'uri':encodeURI(_0x5b8857+_0xe969('0x90')+_0x3c62de+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x40cba5,'If-None-Match':null,'OData-Version':_0xe969('0x91')},'json':!![]};return rp(_0x1d1890);})[_0xe969('0xe')](function(_0x19c141){var _0x2be289=_0x19c141[_0xe969('0x92')][0x0];var _0x1dc5ff=_0x2be289[_0xe969('0x93')];var _0x516636={'method':'GET','uri':_0x5b8857+_0xe969('0x94')+_0x1dc5ff+_0xe969('0x95'),'headers':{'Authorization':_0xe969('0x96')+_0x40cba5,'If-None-Match':null,'OData-Version':_0xe969('0x91')},'json':!![]};return rp(_0x516636);})[_0xe969('0xe')](function(_0x28969f){_0x369749=_0x28969f;_0x3e1dfa=_0x369749[_0xe969('0x97')];_0x3e1dfa=_[_0xe969('0x98')](_0x3e1dfa,function(_0x31a976){return!_0x1e99e2['includes'](_0x31a976[_0xe969('0x99')]);});var _0x3c7880=[];var _0xac20d4=[];_0x3e1dfa[_0xe969('0x9a')](function(_0x55c6a1){if(_0x55c6a1[_0xe969('0x9b')]){var _0x2b0d98=_0x55c6a1[_0xe969('0x9b')][_0xe969('0x3e')](_0x55c6a1[_0xe969('0x9b')][_0xe969('0x3f')]('.')+0x1);if(_0x2b0d98===_0xe969('0x9c')){_0x3c7880[_0xe969('0x9d')](getSelectList(_0x5b8857,_0x5a44d9,_0xac20d4,_0x369749[_0xe969('0x93')],_0x55c6a1[_0xe969('0x93')],_0x40cba5));}}});return Promise['all'](_0x3c7880);})[_0xe969('0xe')](function(_0x1a799a){_0x13ffa4=_0x1a799a[0x0];var _0x5f57f2=[];var _0x16ee70=[];_0x3e1dfa['forEach'](function(_0x2d1c92){if(!_[_0xe969('0x9e')](_0x2d1c92[_0xe969('0x9b')])){var _0x19a7bc=_0x2d1c92['@odata.type']['substring'](_0x2d1c92[_0xe969('0x9b')][_0xe969('0x3f')]('.')+0x1);if(_0x19a7bc==='BooleanAttributeMetadata'){_0x5f57f2[_0xe969('0x9d')](getBooleanList(_0x5b8857,_0x5a44d9,_0x16ee70,_0x369749[_0xe969('0x93')],_0x2d1c92[_0xe969('0x93')],_0x40cba5));}}});return Promise[_0xe969('0x9f')](_0x5f57f2);})['then'](function(_0x132b27){_0x19db3e=_0x132b27[0x0];var _0x41a23c=[];var _0x2d4c18=[];_0x3e1dfa[_0xe969('0x9a')](function(_0x192d80){if(_0x192d80['@odata.type']){var _0x4ff59d=_0x192d80['@odata.type']['substring'](_0x192d80[_0xe969('0x9b')][_0xe969('0x3f')]('.')+0x1);if(_0x4ff59d===_0xe969('0xa0')||_0x4ff59d===_0xe969('0xa1')||_0x4ff59d===_0xe969('0xa2')||_0x4ff59d==='IntegerAttributeMetadata'||_0x4ff59d===_0xe969('0xa3')||_0x4ff59d===_0xe969('0xa4')||_0x4ff59d===_0xe969('0xa5')||_0x4ff59d==='EntityNameAttributeMetadata'||_0x4ff59d==='StateAttributeMetadata'||_0x4ff59d===_0xe969('0xa6')){_0x41a23c[_0xe969('0x9d')](getInputList(_0x5b8857,_0x5a44d9,_0x4ff59d,_0x2d4c18,_0x369749[_0xe969('0x93')],_0x192d80[_0xe969('0x93')],_0x40cba5));}}});return Promise['all'](_0x41a23c);})[_0xe969('0xe')](function(_0x192e8a){_0xf5086=_0x192e8a[0x0];var _0x41c642=_0x13ffa4[_0xe969('0x82')](_0x19db3e)[_0xe969('0x82')](_0xf5086);var _0x10124a={'count':_0x41c642[_0xe969('0x1f')],'rows':_0x41c642};return _0x10124a;})[_0xe969('0xe')](respondWithResult(_0x4cae31,null))[_0xe969('0x2b')](function(_0x45c26e){var _0x48d5dc=_0x493592[_0xe969('0x1a')][_0xe969('0xa7')]?0x1f4:_0x45c26e[_0xe969('0xa8')]||0x1f4;logger[_0xe969('0xa9')](_0x45c26e[_0xe969('0x11')]);delete _0x45c26e['name'];if(_0x48d5dc===0x191){_0x48d5dc=0x190;}_0x4cae31['status'](_0x48d5dc)['send'](_0x493592['query']['test']?{'message':_0xe969('0xaa'),'statusCode':_0x45c26e[_0xe969('0xa8')]}:_0x45c26e);});};function getSelectList(_0x58bdc4,_0x2c937b,_0x3f4edf,_0x5e7abf,_0x5a2b25,_0xd32e56){var _0xf1f34b={'method':_0xe969('0x8f'),'uri':_0x58bdc4+_0xe969('0x94')+_0x5e7abf+')/Attributes('+_0x5a2b25+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xe969('0xab'),'headers':{'Authorization':_0xe969('0x96')+_0xd32e56,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xf1f34b)[_0xe969('0xe')](function(_0x527b25){var _0x580085=[];var _0x54aec9=_0x527b25[_0xe969('0xac')]['Options'];_0x54aec9[_0xe969('0x9a')](function(_0x2e0a38){_0x580085['push']({'name':_0x2e0a38[_0xe969('0xad')][_0xe969('0xae')]['Label'],'value':String(_0x2e0a38[_0xe969('0xaf')])});});var _0x39a4c4={'id':_0x2c937b+'_'+_0x527b25[_0xe969('0x99')],'name':_0x527b25[_0xe969('0xb0')]['UserLocalizedLabel'][_0xe969('0xad')],'custom':![],'options':_0x580085};_0x3f4edf[_0xe969('0x9d')](_0x39a4c4);return _0x3f4edf;});}function getBooleanList(_0x2f1121,_0x50a046,_0x112bcf,_0x5ef54f,_0x5230b5,_0x22f4dc){var _0x4588b8={'method':_0xe969('0x8f'),'uri':_0x2f1121+_0xe969('0x94')+_0x5ef54f+')/Attributes('+_0x5230b5+_0xe969('0xb1'),'headers':{'Authorization':_0xe969('0x96')+_0x22f4dc,'If-None-Match':null,'OData-Version':_0xe969('0x91')},'json':!![]};return rp(_0x4588b8)[_0xe969('0xe')](function(_0x18ac84){var _0xd83e18=[];_0xd83e18['push']({'name':_0x18ac84[_0xe969('0xac')][_0xe969('0xb2')][_0xe969('0xad')]['UserLocalizedLabel']['Label'],'value':_0xe969('0xb3')},{'name':_0x18ac84[_0xe969('0xac')][_0xe969('0xb4')][_0xe969('0xad')][_0xe969('0xae')][_0xe969('0xad')],'value':_0xe969('0xb5')});var _0x62d15c={'id':_0x50a046+'_'+_0x18ac84['LogicalName'],'name':_0x18ac84[_0xe969('0xb0')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0xd83e18};_0x112bcf['push'](_0x62d15c);return _0x112bcf;});}function getInputList(_0x7f08de,_0x32329e,_0x19c17c,_0xd81647,_0x237310,_0x447b35,_0x8b4402){var _0x2a9956={'method':_0xe969('0x8f'),'uri':_0x7f08de+_0xe969('0x94')+_0x237310+')/Attributes('+_0x447b35+_0xe969('0xb6')+_0x19c17c+_0xe969('0xb7'),'headers':{'Authorization':_0xe969('0x96')+_0x8b4402,'If-None-Match':null,'OData-Version':_0xe969('0x91')},'json':!![]};return rp(_0x2a9956)[_0xe969('0xe')](function(_0x2c1a9f){var _0x4f3e02={'id':_0x32329e+'_'+_0x2c1a9f['LogicalName'],'name':_0x2c1a9f[_0xe969('0xb0')][_0xe969('0xae')]?_0x2c1a9f[_0xe969('0xb0')][_0xe969('0xae')][_0xe969('0xad')]:_0x2c1a9f[_0xe969('0x99')],'custom':![],'options':[]};_0xd81647[_0xe969('0x9d')](_0x4f3e02);return _0xd81647;});} \ No newline at end of file +var _0x9605=['LogicalName','@odata.type','push','forEach','isNil','lastIndexOf','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','all','stack','test','statusCode','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','offset','undefined','limit','count','set','Content-Range','update','then','destroy','status','end','sendStatus','error','name','send','index','map','Dynamics365Account','rawAttributes','type','model','keys','query','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','catch','show','params','attributes','length','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','Dynamics365Field','Descriptions','slice','substring','%s/api/data/v9.0/','getFields','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','clientId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove'];(function(_0x2c204a,_0x119aa9){var _0xf68ab1=function(_0x1a577b){while(--_0x1a577b){_0x2c204a['push'](_0x2c204a['shift']());}};_0xf68ab1(++_0x119aa9);}(_0x9605,0xde));var _0x5960=function(_0x51cad1,_0xc442a9){_0x51cad1=_0x51cad1-0x0;var _0xc15112=_0x9605[_0x51cad1];return _0xc15112;};'use strict';var rp=require(_0x5960('0x0'));var util=require('util');var _=require(_0x5960('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x5960('0x2'))(_0x5960('0x3'));var db=require(_0x5960('0x4'))['db'];var integrations=require(_0x5960('0x5'));function respondWithResult(_0x286106,_0x1c3190){_0x1c3190=_0x1c3190||0xc8;return function(_0x2fdc45){if(_0x2fdc45){return _0x286106['status'](_0x1c3190)['json'](_0x2fdc45);}};}function respondWithFilteredResult(_0x1e4248,_0x32486a){return function(_0x1bf847){if(_0x1bf847){var _0x490020=typeof _0x32486a[_0x5960('0x6')]===_0x5960('0x7')&&typeof _0x32486a[_0x5960('0x8')]===_0x5960('0x7');var _0x5eaba4=_0x1bf847['count'];var _0x31707d=_0x490020?0x0:_0x32486a[_0x5960('0x6')];var _0x3c7721=_0x490020?_0x1bf847[_0x5960('0x9')]:_0x32486a[_0x5960('0x6')]+_0x32486a[_0x5960('0x8')];var _0x1ce678;if(_0x3c7721>=_0x5eaba4){_0x3c7721=_0x5eaba4;_0x1ce678=0xc8;}else{_0x1ce678=0xce;}_0x1e4248['status'](_0x1ce678);return _0x1e4248[_0x5960('0xa')](_0x5960('0xb'),_0x31707d+'-'+_0x3c7721+'/'+_0x5eaba4)['json'](_0x1bf847);}return null;};}function saveUpdates(_0x38ea99){return function(_0x5dcd23){if(_0x5dcd23){return _0x5dcd23[_0x5960('0xc')](_0x38ea99)[_0x5960('0xd')](function(_0x1ae76a){return _0x1ae76a;});}return null;};}function removeEntity(_0x178e72){return function(_0x2c35e9){if(_0x2c35e9){return _0x2c35e9[_0x5960('0xe')]()['then'](function(){_0x178e72[_0x5960('0xf')](0xcc)[_0x5960('0x10')]();});}};}function handleEntityNotFound(_0x561a6a){return function(_0x1b2241){if(!_0x1b2241){_0x561a6a[_0x5960('0x11')](0x194);}return _0x1b2241;};}function handleError(_0x502d53,_0x39fa32){_0x39fa32=_0x39fa32||0x1f4;return function(_0x2e161d){logger[_0x5960('0x12')](_0x2e161d['stack']);if(_0x2e161d[_0x5960('0x13')]){delete _0x2e161d[_0x5960('0x13')];}_0x502d53[_0x5960('0xf')](_0x39fa32)[_0x5960('0x14')](_0x2e161d);};}exports[_0x5960('0x15')]=function(_0x281cf7,_0x21aca6){var _0x866af1={},_0x570114={},_0x4f3215={'count':0x0,'rows':[]};var _0xf76b0b=_[_0x5960('0x16')](db[_0x5960('0x17')][_0x5960('0x18')],function(_0x33a6df){return{'name':_0x33a6df['fieldName'],'type':_0x33a6df[_0x5960('0x19')]['key']};});_0x570114[_0x5960('0x1a')]=_['map'](_0xf76b0b,'name');_0x570114['query']=_[_0x5960('0x1b')](_0x281cf7[_0x5960('0x1c')]);_0x570114[_0x5960('0x1d')]=_[_0x5960('0x1e')](_0x570114['model'],_0x570114[_0x5960('0x1c')]);_0x866af1['attributes']=_[_0x5960('0x1e')](_0x570114['model'],qs[_0x5960('0x1f')](_0x281cf7[_0x5960('0x1c')][_0x5960('0x1f')]));_0x866af1['attributes']=_0x866af1['attributes']['length']?_0x866af1['attributes']:_0x570114[_0x5960('0x1a')];if(!_0x281cf7[_0x5960('0x1c')][_0x5960('0x20')](_0x5960('0x21'))){_0x866af1[_0x5960('0x8')]=qs[_0x5960('0x8')](_0x281cf7['query']['limit']);_0x866af1[_0x5960('0x6')]=qs['offset'](_0x281cf7[_0x5960('0x1c')][_0x5960('0x6')]);}_0x866af1[_0x5960('0x22')]=qs[_0x5960('0x23')](_0x281cf7[_0x5960('0x1c')][_0x5960('0x23')]);_0x866af1[_0x5960('0x24')]=qs['filters'](_[_0x5960('0x25')](_0x281cf7[_0x5960('0x1c')],_0x570114[_0x5960('0x1d')]),_0xf76b0b);if(_0x281cf7[_0x5960('0x1c')]['filter']){_0x866af1[_0x5960('0x24')]=_[_0x5960('0x26')](_0x866af1[_0x5960('0x24')],{'$or':_[_0x5960('0x16')](_0xf76b0b,function(_0x45bba0){if(_0x45bba0[_0x5960('0x19')]!=='VIRTUAL'){var _0x448b2a={};_0x448b2a[_0x45bba0['name']]={'$like':'%'+_0x281cf7[_0x5960('0x1c')][_0x5960('0x27')]+'%'};return _0x448b2a;}})});}_0x866af1=_[_0x5960('0x26')]({},_0x866af1,_0x281cf7[_0x5960('0x28')]);var _0x488880={'where':_0x866af1[_0x5960('0x24')]};return db['Dynamics365Account']['count'](_0x488880)[_0x5960('0xd')](function(_0x5ac8a){_0x4f3215['count']=_0x5ac8a;if(_0x281cf7['query'][_0x5960('0x29')]){_0x866af1['include']=[{'all':!![]}];}return db[_0x5960('0x17')]['findAll'](_0x866af1);})[_0x5960('0xd')](function(_0x44b32d){_0x4f3215['rows']=_0x44b32d;return _0x4f3215;})[_0x5960('0xd')](respondWithFilteredResult(_0x21aca6,_0x866af1))[_0x5960('0x2a')](handleError(_0x21aca6,null));};exports[_0x5960('0x2b')]=function(_0xf61eda,_0x51e00e){var _0x27f291={'raw':![],'where':{'id':_0xf61eda[_0x5960('0x2c')]['id']}},_0x3d257d={};_0x3d257d['model']=_[_0x5960('0x1b')](db[_0x5960('0x17')][_0x5960('0x18')]);_0x3d257d[_0x5960('0x1c')]=_[_0x5960('0x1b')](_0xf61eda[_0x5960('0x1c')]);_0x3d257d[_0x5960('0x1d')]=_[_0x5960('0x1e')](_0x3d257d['model'],_0x3d257d['query']);_0x27f291['attributes']=_[_0x5960('0x1e')](_0x3d257d[_0x5960('0x1a')],qs[_0x5960('0x1f')](_0xf61eda[_0x5960('0x1c')]['fields']));_0x27f291[_0x5960('0x2d')]=_0x27f291['attributes'][_0x5960('0x2e')]?_0x27f291[_0x5960('0x2d')]:_0x3d257d['model'];if(_0xf61eda['query'][_0x5960('0x29')]){_0x27f291[_0x5960('0x2f')]=[{'all':!![]}];}_0x27f291=_[_0x5960('0x26')]({},_0x27f291,_0xf61eda[_0x5960('0x28')]);return db[_0x5960('0x17')][_0x5960('0x30')](_0x27f291)['then'](handleEntityNotFound(_0x51e00e,null))[_0x5960('0xd')](respondWithResult(_0x51e00e,null))[_0x5960('0x2a')](handleError(_0x51e00e,null));};exports[_0x5960('0x31')]=function(_0x5e07e0,_0x19748a){return db[_0x5960('0x17')][_0x5960('0x31')](_0x5e07e0[_0x5960('0x32')],{})[_0x5960('0xd')](respondWithResult(_0x19748a,0xc9))[_0x5960('0x2a')](handleError(_0x19748a,null));};exports[_0x5960('0xc')]=function(_0x2523da,_0x47e650){if(_0x2523da[_0x5960('0x32')]['id']){delete _0x2523da['body']['id'];}return db[_0x5960('0x17')][_0x5960('0x30')]({'where':{'id':_0x2523da[_0x5960('0x2c')]['id']}})[_0x5960('0xd')](handleEntityNotFound(_0x47e650,null))['then'](saveUpdates(_0x2523da[_0x5960('0x32')],null))['then'](respondWithResult(_0x47e650,null))['catch'](handleError(_0x47e650,null));};exports['destroy']=function(_0x4cc277,_0x275532){return db[_0x5960('0x17')]['find']({'where':{'id':_0x4cc277[_0x5960('0x2c')]['id']}})[_0x5960('0xd')](handleEntityNotFound(_0x275532,null))[_0x5960('0xd')](removeEntity(_0x275532,null))['catch'](handleError(_0x275532,null));};exports[_0x5960('0x33')]=function(_0x3daeab,_0x296a04){var _0x265882={};var _0xf6015e={};var _0x2a76d3;var _0x46941b;return db[_0x5960('0x17')][_0x5960('0x34')]({'where':{'id':_0x3daeab[_0x5960('0x2c')]['id']}})[_0x5960('0xd')](handleEntityNotFound(_0x296a04,null))[_0x5960('0xd')](function(_0x174428){if(_0x174428){_0x2a76d3=_0x174428;_0xf6015e['model']=_[_0x5960('0x1b')](db[_0x5960('0x35')][_0x5960('0x18')]);_0xf6015e['query']=_['keys'](_0x3daeab[_0x5960('0x1c')]);_0xf6015e[_0x5960('0x1d')]=_['intersection'](_0xf6015e[_0x5960('0x1a')],_0xf6015e[_0x5960('0x1c')]);_0x265882['attributes']=_[_0x5960('0x1e')](_0xf6015e[_0x5960('0x1a')],qs['fields'](_0x3daeab[_0x5960('0x1c')][_0x5960('0x1f')]));_0x265882['attributes']=_0x265882[_0x5960('0x2d')][_0x5960('0x2e')]?_0x265882['attributes']:_0xf6015e['model'];_0x265882[_0x5960('0x22')]=qs[_0x5960('0x23')](_0x3daeab[_0x5960('0x1c')][_0x5960('0x23')]);_0x265882['where']=qs[_0x5960('0x1d')](_['pick'](_0x3daeab[_0x5960('0x1c')],_0xf6015e[_0x5960('0x1d')]));if(_0x3daeab['query'][_0x5960('0x27')]){_0x265882[_0x5960('0x24')]=_[_0x5960('0x26')](_0x265882[_0x5960('0x24')],{'$or':_[_0x5960('0x16')](_0x265882[_0x5960('0x2d')],function(_0x4afd2e){var _0x41b96a={};_0x41b96a[_0x4afd2e]={'$like':'%'+_0x3daeab[_0x5960('0x1c')]['filter']+'%'};return _0x41b96a;})});}_0x265882=_[_0x5960('0x26')]({},_0x265882,_0x3daeab[_0x5960('0x28')]);return _0x2a76d3[_0x5960('0x33')](_0x265882);}})[_0x5960('0xd')](function(_0x57473f){if(_0x57473f){_0x46941b=_0x57473f[_0x5960('0x2e')];if(!_0x3daeab[_0x5960('0x1c')]['hasOwnProperty'](_0x5960('0x21'))){_0x265882[_0x5960('0x8')]=qs[_0x5960('0x8')](_0x3daeab[_0x5960('0x1c')][_0x5960('0x8')]);_0x265882[_0x5960('0x6')]=qs['offset'](_0x3daeab[_0x5960('0x1c')][_0x5960('0x6')]);}return _0x2a76d3['getConfigurations'](_0x265882);}})[_0x5960('0xd')](function(_0x2ebbe2){if(_0x2ebbe2){return _0x2ebbe2?{'count':_0x46941b,'rows':_0x2ebbe2}:null;}})[_0x5960('0xd')](respondWithResult(_0x296a04,null))[_0x5960('0x2a')](handleError(_0x296a04,null));};exports[_0x5960('0x36')]=function(_0x2061e9,_0x3b69a9){if(_0x2061e9[_0x5960('0x32')]['id']){delete _0x2061e9[_0x5960('0x32')]['id'];}return db['Dynamics365Account'][_0x5960('0x34')]({'where':{'id':_0x2061e9[_0x5960('0x2c')]['id']}})[_0x5960('0xd')](handleEntityNotFound(_0x3b69a9,null))[_0x5960('0xd')](function(_0x3dc632){if(_0x3dc632){_0x2061e9[_0x5960('0x32')][_0x5960('0x37')]=_0x3dc632['id'];_0x2061e9[_0x5960('0x32')][_0x5960('0x38')]=integrations[_0x5960('0x39')](_0x2061e9[_0x5960('0x32')]['channel'],_0x2061e9[_0x5960('0x32')]['type']);_0x2061e9[_0x5960('0x32')]['Descriptions']=integrations[_0x5960('0x3a')](_0x2061e9[_0x5960('0x32')][_0x5960('0x3b')],_0x2061e9[_0x5960('0x32')][_0x5960('0x19')]);return db['Dynamics365Configuration'][_0x5960('0x31')](_0x2061e9['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x5960('0x38')},{'model':db[_0x5960('0x3c')],'as':_0x5960('0x3d')}]});}return null;})['then'](respondWithResult(_0x3b69a9,null))[_0x5960('0x2a')](handleError(_0x3b69a9,null));};function sanitizeRemoteUri(_0x43fb16){var _0xf4622c=_0x43fb16[_0x5960('0x3e')](-0x1);if(_0xf4622c==='/')return _0x43fb16[_0x5960('0x3f')](0x0,_0x43fb16['lastIndexOf'](_0xf4622c));return _0x43fb16;}function getWebApiUrl(_0x2816d1){return util['format'](_0x5960('0x40'),_0x2816d1);}exports[_0x5960('0x41')]=function(_0x4cd523,_0x39b9d9){var _0x5b158f=_0x4cd523['query']['ticketType'];var _0x4938c9=_0x5b158f==='incident'?_0x5960('0x42'):_0x5960('0x43');var _0x6940fa='';var _0x4c8268='';var _0x313cb9='';var _0x1bc10b='';var _0x492101='';var _0x25d7b9='';var _0x2613ba='';var _0x25d3e9='';var _0x15bd0b=[_0x5960('0x44'),_0x5960('0x45'),_0x5960('0x46'),_0x5960('0x47'),_0x5960('0x48'),'subject',_0x5960('0x49'),_0x5960('0x4a'),_0x5960('0x4b'),'phonecall_activity_parties'];var _0x2d8825=[_0x5960('0x4c'),_0x5960('0x4d'),_0x5960('0x4e'),'billedserviceunits',_0x5960('0x4f'),_0x5960('0x50'),_0x5960('0x51'),_0x5960('0x52'),'createdbyexternalpartyname',_0x5960('0x53'),'createdbyname',_0x5960('0x54'),'createdon',_0x5960('0x55'),_0x5960('0x56'),_0x5960('0x57'),_0x5960('0x58'),_0x5960('0x59'),_0x5960('0x5a'),_0x5960('0x5b'),_0x5960('0x5c'),'entityimage_url',_0x5960('0x5d'),_0x5960('0x5e'),_0x5960('0x5f'),_0x5960('0x60'),_0x5960('0x61'),_0x5960('0x62'),_0x5960('0x63'),'lastonholdtime',_0x5960('0x64'),_0x5960('0x65'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x5960('0x66'),_0x5960('0x67'),_0x5960('0x68'),_0x5960('0x69'),_0x5960('0x6a'),_0x5960('0x6b'),_0x5960('0x6c'),'onholdtime',_0x5960('0x6d'),_0x5960('0x6e'),_0x5960('0x6f'),_0x5960('0x70'),'parentcaseidname','primarycontactidname','primarycontactidyominame',_0x5960('0x71'),_0x5960('0x72'),'productserialnumber','resolveby',_0x5960('0x73'),_0x5960('0x74'),_0x5960('0x75'),_0x5960('0x76'),'sentimentvalue',_0x5960('0x77'),_0x5960('0x78'),_0x5960('0x79'),'statecode',_0x5960('0x7a'),_0x5960('0x7b'),_0x5960('0x7c'),_0x5960('0x7d'),_0x5960('0x7e'),_0x5960('0x7f'),_0x5960('0x80'),_0x5960('0x81')];var _0x3da819=_0x15bd0b[_0x5960('0x82')](_0x2d8825);return db[_0x5960('0x17')][_0x5960('0x34')]({'where':{'id':_0x4cd523[_0x5960('0x2c')]['id']},'attributes':['id',_0x5960('0x83'),_0x5960('0x84'),_0x5960('0x85'),_0x5960('0x86'),'clientId',_0x5960('0x87'),_0x5960('0x88')],'include':[{'model':db[_0x5960('0x89')],'as':_0x5960('0x89'),'attributes':['id',_0x5960('0x8a'),_0x5960('0x8b')]}]})[_0x5960('0xd')](handleEntityNotFound(_0x39b9d9,null))[_0x5960('0xd')](function(_0x3202a7){if(_0x3202a7){if(_0x3202a7[_0x5960('0x88')]){_0x3202a7[_0x5960('0x8c')]=_0x3202a7['CloudProvider'][_0x5960('0x8a')];_0x25d3e9=sanitizeRemoteUri(_0x3202a7[_0x5960('0x89')][_0x5960('0x8b')]);_0x2613ba=getWebApiUrl(_0x25d3e9);return _0x3202a7;}_0x25d3e9=sanitizeRemoteUri(_0x3202a7[_0x5960('0x85')]);_0x2613ba=getWebApiUrl(_0x25d3e9);var _0x403048={'method':_0x5960('0x8d'),'uri':_0x5960('0x8e')+_0x3202a7[_0x5960('0x86')]+'/oauth2/token','form':{'client_id':_0x3202a7[_0x5960('0x8f')],'resource':_0x25d3e9,'username':_0x3202a7[_0x5960('0x83')],'password':_0x3202a7['password'],'grant_type':'password','client_secret':_0x3202a7[_0x5960('0x87')]},'json':!![]};return rp(_0x403048);}})[_0x5960('0xd')](function(_0x3ff2b6){_0x25d7b9=_0x3ff2b6['access_token'];var _0x29feea={'method':'GET','uri':encodeURI(_0x2613ba+_0x5960('0x90')+_0x4938c9+'\x27'),'headers':{'Authorization':_0x5960('0x91')+_0x25d7b9,'If-None-Match':null,'OData-Version':_0x5960('0x92')},'json':!![]};return rp(_0x29feea);})[_0x5960('0xd')](function(_0x4f241b){var _0x20f38a=_0x4f241b['value'][0x0];var _0x4e935f=_0x20f38a[_0x5960('0x93')];var _0x3a8641={'method':_0x5960('0x94'),'uri':_0x2613ba+'EntityDefinitions('+_0x4e935f+_0x5960('0x95'),'headers':{'Authorization':_0x5960('0x91')+_0x25d7b9,'If-None-Match':null,'OData-Version':_0x5960('0x92')},'json':!![]};return rp(_0x3a8641);})[_0x5960('0xd')](function(_0x46e201){_0x6940fa=_0x46e201;_0x4c8268=_0x6940fa[_0x5960('0x96')];_0x4c8268=_[_0x5960('0x97')](_0x4c8268,function(_0x19be07){return!_0x3da819['includes'](_0x19be07[_0x5960('0x98')]);});var _0x27b0ab=[];var _0x3b5748=[];_0x4c8268['forEach'](function(_0x2cbd02){if(_0x2cbd02['@odata.type']){var _0x2eee73=_0x2cbd02[_0x5960('0x99')]['substring'](_0x2cbd02['@odata.type']['lastIndexOf']('.')+0x1);if(_0x2eee73==='PicklistAttributeMetadata'){_0x27b0ab[_0x5960('0x9a')](getSelectList(_0x2613ba,_0x5b158f,_0x3b5748,_0x6940fa[_0x5960('0x93')],_0x2cbd02['MetadataId'],_0x25d7b9));}}});return Promise['all'](_0x27b0ab);})[_0x5960('0xd')](function(_0x1c7108){_0x313cb9=_0x1c7108[0x0];var _0x1dacf2=[];var _0x21ed91=[];_0x4c8268[_0x5960('0x9b')](function(_0x4d6a27){if(!_[_0x5960('0x9c')](_0x4d6a27[_0x5960('0x99')])){var _0x4bd75c=_0x4d6a27['@odata.type'][_0x5960('0x3f')](_0x4d6a27[_0x5960('0x99')][_0x5960('0x9d')]('.')+0x1);if(_0x4bd75c===_0x5960('0x9e')){_0x1dacf2[_0x5960('0x9a')](getBooleanList(_0x2613ba,_0x5b158f,_0x21ed91,_0x6940fa['MetadataId'],_0x4d6a27[_0x5960('0x93')],_0x25d7b9));}}});return Promise['all'](_0x1dacf2);})['then'](function(_0x44cdf8){_0x1bc10b=_0x44cdf8[0x0];var _0x505ac2=[];var _0x537867=[];_0x4c8268[_0x5960('0x9b')](function(_0x3297fa){if(_0x3297fa[_0x5960('0x99')]){var _0x22536c=_0x3297fa[_0x5960('0x99')]['substring'](_0x3297fa[_0x5960('0x99')][_0x5960('0x9d')]('.')+0x1);if(_0x22536c===_0x5960('0x9f')||_0x22536c===_0x5960('0xa0')||_0x22536c===_0x5960('0xa1')||_0x22536c===_0x5960('0xa2')||_0x22536c===_0x5960('0xa3')||_0x22536c===_0x5960('0xa4')||_0x22536c===_0x5960('0xa5')||_0x22536c===_0x5960('0xa6')||_0x22536c==='StateAttributeMetadata'||_0x22536c===_0x5960('0xa7')){_0x505ac2[_0x5960('0x9a')](getInputList(_0x2613ba,_0x5b158f,_0x22536c,_0x537867,_0x6940fa['MetadataId'],_0x3297fa['MetadataId'],_0x25d7b9));}}});return Promise[_0x5960('0xa8')](_0x505ac2);})[_0x5960('0xd')](function(_0xa19a7){_0x492101=_0xa19a7[0x0];var _0x15f14c=_0x313cb9[_0x5960('0x82')](_0x1bc10b)[_0x5960('0x82')](_0x492101);var _0x52c10d={'count':_0x15f14c[_0x5960('0x2e')],'rows':_0x15f14c};return _0x52c10d;})[_0x5960('0xd')](respondWithResult(_0x39b9d9,null))[_0x5960('0x2a')](function(_0x42dde8){var _0x1e2f70=_0x4cd523[_0x5960('0x1c')]['test']?0x1f4:_0x42dde8['statusCode']||0x1f4;logger[_0x5960('0x12')](_0x42dde8[_0x5960('0xa9')]);delete _0x42dde8[_0x5960('0x13')];if(_0x1e2f70===0x191){_0x1e2f70=0x190;}_0x39b9d9[_0x5960('0xf')](_0x1e2f70)[_0x5960('0x14')](_0x4cd523[_0x5960('0x1c')][_0x5960('0xaa')]?{'message':'Wrong\x20credentials','statusCode':_0x42dde8[_0x5960('0xab')]}:_0x42dde8);});};function getSelectList(_0x5e109c,_0x539dec,_0x15d4be,_0x1c4dd4,_0x1d0b9d,_0x24ec45){var _0x36441c={'method':_0x5960('0x94'),'uri':_0x5e109c+_0x5960('0xac')+_0x1c4dd4+')/Attributes('+_0x1d0b9d+_0x5960('0xad')+_0x5960('0xae'),'headers':{'Authorization':_0x5960('0x91')+_0x24ec45,'If-None-Match':null,'OData-Version':_0x5960('0x92')},'json':!![]};return rp(_0x36441c)[_0x5960('0xd')](function(_0x489802){var _0x511b17=[];var _0x1ce1a7=_0x489802[_0x5960('0xaf')]['Options'];_0x1ce1a7[_0x5960('0x9b')](function(_0x49507b){_0x511b17[_0x5960('0x9a')]({'name':_0x49507b['Label']['UserLocalizedLabel'][_0x5960('0xb0')],'value':String(_0x49507b[_0x5960('0xb1')])});});var _0x12f907={'id':_0x539dec+'_'+_0x489802[_0x5960('0x98')],'name':_0x489802[_0x5960('0xb2')][_0x5960('0xb3')][_0x5960('0xb0')],'custom':![],'options':_0x511b17};_0x15d4be[_0x5960('0x9a')](_0x12f907);return _0x15d4be;});}function getBooleanList(_0x1f7005,_0x500fe3,_0x4edf14,_0x21346a,_0x13a3a6,_0x3b4ec6){var _0x4d4f25={'method':_0x5960('0x94'),'uri':_0x1f7005+_0x5960('0xac')+_0x21346a+_0x5960('0xb4')+_0x13a3a6+_0x5960('0xb5'),'headers':{'Authorization':_0x5960('0x91')+_0x3b4ec6,'If-None-Match':null,'OData-Version':_0x5960('0x92')},'json':!![]};return rp(_0x4d4f25)['then'](function(_0x2e7b4f){var _0x240158=[];_0x240158[_0x5960('0x9a')]({'name':_0x2e7b4f['OptionSet'][_0x5960('0xb6')][_0x5960('0xb0')][_0x5960('0xb3')]['Label'],'value':_0x5960('0xb7')},{'name':_0x2e7b4f[_0x5960('0xaf')][_0x5960('0xb8')]['Label'][_0x5960('0xb3')]['Label'],'value':'false'});var _0x722dcd={'id':_0x500fe3+'_'+_0x2e7b4f[_0x5960('0x98')],'name':_0x2e7b4f['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x240158};_0x4edf14['push'](_0x722dcd);return _0x4edf14;});}function getInputList(_0xff5086,_0x4f8ec0,_0x33822d,_0x3738e8,_0x215624,_0xdc7e45,_0x3d43ec){var _0x179a62={'method':_0x5960('0x94'),'uri':_0xff5086+_0x5960('0xac')+_0x215624+_0x5960('0xb4')+_0xdc7e45+_0x5960('0xb9')+_0x33822d+_0x5960('0xba'),'headers':{'Authorization':_0x5960('0x91')+_0x3d43ec,'If-None-Match':null,'OData-Version':_0x5960('0x92')},'json':!![]};return rp(_0x179a62)[_0x5960('0xd')](function(_0x266b83){var _0x46af30={'id':_0x4f8ec0+'_'+_0x266b83['LogicalName'],'name':_0x266b83['DisplayName'][_0x5960('0xb3')]?_0x266b83[_0x5960('0xb2')]['UserLocalizedLabel'][_0x5960('0xb0')]:_0x266b83[_0x5960('0x98')],'custom':![],'options':[]};_0x3738e8[_0x5960('0x9a')](_0x46af30);return _0x3738e8;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index ca6e337..7501077 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x1b91c7,_0x539acd){var _0xbbe014=function(_0x57ff15){while(--_0x57ff15){_0x1b91c7['push'](_0x1b91c7['shift']());}};_0xbbe014(++_0x539acd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x1bf76c,_0x4136e7){var _0x58ca52=function(_0x587bd7){while(--_0x587bd7){_0x1bf76c['push'](_0x1bf76c['shift']());}};_0x58ca52(++_0x4136e7);}(_0xe706,0xa3));var _0x6e70=function(_0x235884,_0x1c4355){_0x235884=_0x235884-0x0;var _0x211158=_0xe706[_0x235884];return _0x211158;};'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'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'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 b68dde2..441bd4e 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 _0x91f1=['Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowDynamics365Account','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetDynamics365Account'];(function(_0x38fb8b,_0x70dd0a){var _0x1ec681=function(_0x58f130){while(--_0x58f130){_0x38fb8b['push'](_0x38fb8b['shift']());}};_0x1ec681(++_0x70dd0a);}(_0x91f1,0x9d));var _0x191f=function(_0x350813,_0x8c6e93){_0x350813=_0x350813-0x0;var _0xa86385=_0x91f1[_0x350813];return _0xa86385;};'use strict';var _=require(_0x191f('0x0'));var util=require(_0x191f('0x1'));var moment=require(_0x191f('0x2'));var BPromise=require(_0x191f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x191f('0x4'));var db=require(_0x191f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x191f('0x6'))('rpc');var config=require(_0x191f('0x7'));var jayson=require(_0x191f('0x8'));var client=jayson['client'][_0x191f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36d3df,_0x2d4887,_0x346a88){return new BPromise(function(_0x2ceca0,_0x26720d){return client[_0x191f('0xa')](_0x36d3df,_0x346a88)[_0x191f('0xb')](function(_0x527632){logger[_0x191f('0xc')](_0x191f('0xd'),_0x2d4887,_0x191f('0xe'));logger[_0x191f('0xf')](_0x191f('0x10'),_0x2d4887,'request\x20sent',JSON['stringify'](_0x527632));if(_0x527632['error']){if(_0x527632['error'][_0x191f('0x11')]===0x1f4){logger[_0x191f('0x12')](_0x191f('0xd'),_0x2d4887,_0x527632[_0x191f('0x12')]['message']);return _0x26720d(_0x527632[_0x191f('0x12')][_0x191f('0x13')]);}logger['error'](_0x191f('0xd'),_0x2d4887,_0x527632['error'][_0x191f('0x13')]);return _0x2ceca0(_0x527632[_0x191f('0x12')][_0x191f('0x13')]);}else{logger['info'](_0x191f('0xd'),_0x2d4887,_0x191f('0xe'));_0x2ceca0(_0x527632[_0x191f('0x14')][_0x191f('0x13')]);}})[_0x191f('0x15')](function(_0x1d7878){logger[_0x191f('0x12')](_0x191f('0xd'),_0x2d4887,_0x1d7878);_0x26720d(_0x1d7878);});});}exports[_0x191f('0x16')]=function(_0x438a1b){var _0x262741=this;return new Promise(function(_0x4240b9,_0x2126c8){return db[_0x191f('0x17')][_0x191f('0x18')]({'raw':_0x438a1b[_0x191f('0x19')]?_0x438a1b[_0x191f('0x19')][_0x191f('0x1a')]===undefined?!![]:![]:!![],'where':_0x438a1b['options']?_0x438a1b[_0x191f('0x19')][_0x191f('0x1b')]||null:null,'attributes':_0x438a1b[_0x191f('0x19')]?_0x438a1b[_0x191f('0x19')][_0x191f('0x1c')]||null:null,'limit':_0x438a1b['options']?_0x438a1b[_0x191f('0x19')][_0x191f('0x1d')]||null:null,'include':_0x438a1b['options']?_0x438a1b['options'][_0x191f('0x1e')]?_[_0x191f('0x1f')](_0x438a1b[_0x191f('0x19')]['include'],function(_0x5a962d){return{'model':db[_0x5a962d[_0x191f('0x20')]],'as':_0x5a962d['as'],'attributes':_0x5a962d[_0x191f('0x1c')],'include':_0x5a962d[_0x191f('0x1e')]?_[_0x191f('0x1f')](_0x5a962d[_0x191f('0x1e')],function(_0x46aa53){return{'model':db[_0x46aa53['model']],'as':_0x46aa53['as'],'attributes':_0x46aa53[_0x191f('0x1c')],'include':_0x46aa53[_0x191f('0x1e')]?_[_0x191f('0x1f')](_0x46aa53[_0x191f('0x1e')],function(_0x185e6f){return{'model':db[_0x185e6f['model']],'as':_0x185e6f['as'],'attributes':_0x185e6f[_0x191f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x191f('0xb')](function(_0x41b4a3){logger[_0x191f('0xc')](_0x191f('0x16'),_0x438a1b);logger['debug']('GetDynamics365Account',_0x438a1b,JSON[_0x191f('0x21')](_0x41b4a3));_0x4240b9(_0x41b4a3);})[_0x191f('0x15')](function(_0x17e95b){logger[_0x191f('0x12')](_0x191f('0x16'),_0x17e95b['message'],_0x438a1b);_0x2126c8(_0x262741[_0x191f('0x12')](0x1f4,_0x17e95b[_0x191f('0x13')]));});});};exports['ShowDynamics365Account']=function(_0xfc56fd){var _0x3774e8=this;return new Promise(function(_0x73ce0b,_0x3b8e24){return db['Dynamics365Account'][_0x191f('0x22')]({'raw':_0xfc56fd[_0x191f('0x19')]?_0xfc56fd[_0x191f('0x19')][_0x191f('0x1a')]===undefined?!![]:![]:!![],'where':_0xfc56fd[_0x191f('0x19')]?_0xfc56fd['options']['where']||null:null,'attributes':_0xfc56fd[_0x191f('0x19')]?_0xfc56fd[_0x191f('0x19')][_0x191f('0x1c')]||null:null,'include':_0xfc56fd['options']?_0xfc56fd[_0x191f('0x19')]['include']?_['map'](_0xfc56fd[_0x191f('0x19')][_0x191f('0x1e')],function(_0x25f9ed){return{'model':db[_0x25f9ed[_0x191f('0x20')]],'as':_0x25f9ed['as'],'attributes':_0x25f9ed['attributes'],'include':_0x25f9ed[_0x191f('0x1e')]?_[_0x191f('0x1f')](_0x25f9ed[_0x191f('0x1e')],function(_0x3462f8){return{'model':db[_0x3462f8[_0x191f('0x20')]],'as':_0x3462f8['as'],'attributes':_0x3462f8[_0x191f('0x1c')],'include':_0x3462f8[_0x191f('0x1e')]?_['map'](_0x3462f8[_0x191f('0x1e')],function(_0xc29d96){return{'model':db[_0xc29d96['model']],'as':_0xc29d96['as'],'attributes':_0xc29d96[_0x191f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x191f('0xb')](function(_0x3a98ee){logger[_0x191f('0xc')](_0x191f('0x23'),_0xfc56fd);logger[_0x191f('0xf')](_0x191f('0x23'),_0xfc56fd,JSON[_0x191f('0x21')](_0x3a98ee));_0x73ce0b(_0x3a98ee);})[_0x191f('0x15')](function(_0x206cd6){logger['error']('ShowDynamics365Account',_0x206cd6[_0x191f('0x13')],_0xfc56fd);_0x3b8e24(_0x3774e8['error'](0x1f4,_0x206cd6[_0x191f('0x13')]));});});}; \ No newline at end of file +var _0x3ae4=['../../config/utils','../../config/logger','jayson/promise','client','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDynamics365Account','options','attributes','limit','include','map','model','Dynamics365Account','find','raw','where','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x37a8fc,_0x335ee8){var _0xa3f428=function(_0x260332){while(--_0x260332){_0x37a8fc['push'](_0x37a8fc['shift']());}};_0xa3f428(++_0x335ee8);}(_0x3ae4,0x12b));var _0x43ae=function(_0x5731c4,_0x168de0){_0x5731c4=_0x5731c4-0x0;var _0x1767bf=_0x3ae4[_0x5731c4];return _0x1767bf;};'use strict';var _=require(_0x43ae('0x0'));var util=require(_0x43ae('0x1'));var moment=require(_0x43ae('0x2'));var BPromise=require(_0x43ae('0x3'));var rs=require(_0x43ae('0x4'));var fs=require('fs');var Redis=require(_0x43ae('0x5'));var db=require(_0x43ae('0x6'))['db'];var utils=require(_0x43ae('0x7'));var logger=require(_0x43ae('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x43ae('0x9'));var client=jayson[_0x43ae('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa2de41,_0xccf989,_0x11df6e){return new BPromise(function(_0x34aa3c,_0x302633){return client['request'](_0xa2de41,_0x11df6e)[_0x43ae('0xb')](function(_0x4d0584){logger[_0x43ae('0xc')](_0x43ae('0xd'),_0xccf989,_0x43ae('0xe'));logger[_0x43ae('0xf')](_0x43ae('0x10'),_0xccf989,'request\x20sent',JSON[_0x43ae('0x11')](_0x4d0584));if(_0x4d0584[_0x43ae('0x12')]){if(_0x4d0584[_0x43ae('0x12')]['code']===0x1f4){logger['error'](_0x43ae('0xd'),_0xccf989,_0x4d0584[_0x43ae('0x12')][_0x43ae('0x13')]);return _0x302633(_0x4d0584['error'][_0x43ae('0x13')]);}logger[_0x43ae('0x12')](_0x43ae('0xd'),_0xccf989,_0x4d0584[_0x43ae('0x12')][_0x43ae('0x13')]);return _0x34aa3c(_0x4d0584['error'][_0x43ae('0x13')]);}else{logger[_0x43ae('0xc')](_0x43ae('0xd'),_0xccf989,_0x43ae('0xe'));_0x34aa3c(_0x4d0584[_0x43ae('0x14')][_0x43ae('0x13')]);}})[_0x43ae('0x15')](function(_0x4ddf1c){logger[_0x43ae('0x12')](_0x43ae('0xd'),_0xccf989,_0x4ddf1c);_0x302633(_0x4ddf1c);});});}exports[_0x43ae('0x16')]=function(_0x169ae1){var _0x4e6ea3=this;return new Promise(function(_0x2e4b01,_0x42ded0){return db['Dynamics365Account']['findAll']({'raw':_0x169ae1[_0x43ae('0x17')]?_0x169ae1[_0x43ae('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x169ae1[_0x43ae('0x17')]?_0x169ae1[_0x43ae('0x17')]['where']||null:null,'attributes':_0x169ae1[_0x43ae('0x17')]?_0x169ae1[_0x43ae('0x17')][_0x43ae('0x18')]||null:null,'limit':_0x169ae1['options']?_0x169ae1[_0x43ae('0x17')][_0x43ae('0x19')]||null:null,'include':_0x169ae1[_0x43ae('0x17')]?_0x169ae1[_0x43ae('0x17')][_0x43ae('0x1a')]?_[_0x43ae('0x1b')](_0x169ae1[_0x43ae('0x17')][_0x43ae('0x1a')],function(_0x22d2b5){return{'model':db[_0x22d2b5['model']],'as':_0x22d2b5['as'],'attributes':_0x22d2b5[_0x43ae('0x18')],'include':_0x22d2b5['include']?_[_0x43ae('0x1b')](_0x22d2b5[_0x43ae('0x1a')],function(_0x49dc23){return{'model':db[_0x49dc23[_0x43ae('0x1c')]],'as':_0x49dc23['as'],'attributes':_0x49dc23[_0x43ae('0x18')],'include':_0x49dc23[_0x43ae('0x1a')]?_['map'](_0x49dc23[_0x43ae('0x1a')],function(_0x2aec7a){return{'model':db[_0x2aec7a[_0x43ae('0x1c')]],'as':_0x2aec7a['as'],'attributes':_0x2aec7a[_0x43ae('0x18')]};}):[]};}):[]};}):[]:[]})[_0x43ae('0xb')](function(_0x24bd98){logger[_0x43ae('0xc')](_0x43ae('0x16'),_0x169ae1);logger[_0x43ae('0xf')](_0x43ae('0x16'),_0x169ae1,JSON[_0x43ae('0x11')](_0x24bd98));_0x2e4b01(_0x24bd98);})[_0x43ae('0x15')](function(_0x5599e3){logger[_0x43ae('0x12')](_0x43ae('0x16'),_0x5599e3[_0x43ae('0x13')],_0x169ae1);_0x42ded0(_0x4e6ea3[_0x43ae('0x12')](0x1f4,_0x5599e3[_0x43ae('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x5806df){var _0x2e9538=this;return new Promise(function(_0x561743,_0x288e4e){return db[_0x43ae('0x1d')][_0x43ae('0x1e')]({'raw':_0x5806df[_0x43ae('0x17')]?_0x5806df['options'][_0x43ae('0x1f')]===undefined?!![]:![]:!![],'where':_0x5806df[_0x43ae('0x17')]?_0x5806df['options'][_0x43ae('0x20')]||null:null,'attributes':_0x5806df[_0x43ae('0x17')]?_0x5806df[_0x43ae('0x17')]['attributes']||null:null,'include':_0x5806df['options']?_0x5806df[_0x43ae('0x17')]['include']?_[_0x43ae('0x1b')](_0x5806df[_0x43ae('0x17')]['include'],function(_0x56cfe3){return{'model':db[_0x56cfe3['model']],'as':_0x56cfe3['as'],'attributes':_0x56cfe3[_0x43ae('0x18')],'include':_0x56cfe3['include']?_['map'](_0x56cfe3[_0x43ae('0x1a')],function(_0x6e2492){return{'model':db[_0x6e2492[_0x43ae('0x1c')]],'as':_0x6e2492['as'],'attributes':_0x6e2492['attributes'],'include':_0x6e2492[_0x43ae('0x1a')]?_['map'](_0x6e2492[_0x43ae('0x1a')],function(_0x43f70a){return{'model':db[_0x43f70a[_0x43ae('0x1c')]],'as':_0x43f70a['as'],'attributes':_0x43f70a[_0x43ae('0x18')]};}):[]};}):[]};}):[]:[]})[_0x43ae('0xb')](function(_0x5e64e2){logger[_0x43ae('0xc')](_0x43ae('0x21'),_0x5806df);logger[_0x43ae('0xf')]('ShowDynamics365Account',_0x5806df,JSON['stringify'](_0x5e64e2));_0x561743(_0x5e64e2);})[_0x43ae('0x15')](function(_0x2dbfdc){logger[_0x43ae('0x12')](_0x43ae('0x21'),_0x2dbfdc[_0x43ae('0x13')],_0x5806df);_0x288e4e(_0x2e9538[_0x43ae('0x12')](0x1f4,_0x2dbfdc[_0x43ae('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index d7a4dc6..287fca3 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 _0x50d1=['/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x2ba67d,_0x342b60){var _0x3b34d3=function(_0x4a404c){while(--_0x4a404c){_0x2ba67d['push'](_0x2ba67d['shift']());}};_0x3b34d3(++_0x342b60);}(_0x50d1,0xf3));var _0x150d=function(_0xdda9e2,_0xc4426b){_0xdda9e2=_0xdda9e2-0x0;var _0x51a688=_0x50d1[_0xdda9e2];return _0x51a688;};'use strict';var multer=require('multer');var util=require(_0x150d('0x0'));var path=require(_0x150d('0x1'));var timeout=require(_0x150d('0x2'));var express=require('express');var router=express[_0x150d('0x3')]();var fs_extra=require(_0x150d('0x4'));var auth=require(_0x150d('0x5'));var interaction=require(_0x150d('0x6'));var config=require(_0x150d('0x7'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x150d('0x8')](),controller[_0x150d('0x9')]);router[_0x150d('0xa')](_0x150d('0xb'),auth[_0x150d('0x8')](),controller[_0x150d('0xc')]);router[_0x150d('0xa')](_0x150d('0xd'),auth[_0x150d('0x8')](),controller[_0x150d('0xe')]);router['get'](_0x150d('0xf'),auth['isAuthenticated'](),controller[_0x150d('0x10')]);router[_0x150d('0xa')](_0x150d('0x11'),auth[_0x150d('0x8')](),controller[_0x150d('0x12')]);router[_0x150d('0x13')]('/',auth['isAuthenticated'](),controller[_0x150d('0x14')]);router[_0x150d('0x15')](_0x150d('0xb'),auth[_0x150d('0x8')](),controller[_0x150d('0x16')]);router[_0x150d('0x17')]('/:id',auth[_0x150d('0x8')](),controller[_0x150d('0x18')]);module[_0x150d('0x19')]=router; \ No newline at end of file +var _0x17a5=['/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x7c333d,_0x1bc242){var _0x1861ca=function(_0x13ec69){while(--_0x13ec69){_0x7c333d['push'](_0x7c333d['shift']());}};_0x1861ca(++_0x1bc242);}(_0x17a5,0x1d5));var _0x517a=function(_0x4bf658,_0x4f9c09){_0x4bf658=_0x4bf658-0x0;var _0x3852ab=_0x17a5[_0x4bf658];return _0x3852ab;};'use strict';var multer=require('multer');var util=require(_0x517a('0x0'));var path=require(_0x517a('0x1'));var timeout=require('connect-timeout');var express=require(_0x517a('0x2'));var router=express['Router']();var fs_extra=require(_0x517a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x517a('0x4'));var config=require('../../config/environment');var controller=require(_0x517a('0x5'));router[_0x517a('0x6')]('/',auth[_0x517a('0x7')](),controller['index']);router[_0x517a('0x6')](_0x517a('0x8'),auth[_0x517a('0x7')](),controller[_0x517a('0x9')]);router[_0x517a('0x6')](_0x517a('0xa'),auth[_0x517a('0x7')](),controller[_0x517a('0xb')]);router[_0x517a('0x6')](_0x517a('0xc'),auth[_0x517a('0x7')](),controller[_0x517a('0xd')]);router[_0x517a('0x6')](_0x517a('0xe'),auth['isAuthenticated'](),controller[_0x517a('0xf')]);router[_0x517a('0x10')]('/',auth['isAuthenticated'](),controller[_0x517a('0x11')]);router[_0x517a('0x12')](_0x517a('0x8'),auth[_0x517a('0x7')](),controller[_0x517a('0x13')]);router[_0x517a('0x14')]('/:id',auth[_0x517a('0x7')](),controller[_0x517a('0x15')]);module[_0x517a('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 58733a2..35f58f2 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 _0x8655=['ENUM','phonecall','incident','contact','nothing','sequelize','exports','STRING'];(function(_0xca8f32,_0xe6ba73){var _0x4c23f8=function(_0x469c16){while(--_0x469c16){_0xca8f32['push'](_0xca8f32['shift']());}};_0x4c23f8(++_0xe6ba73);}(_0x8655,0xf5));var _0x5865=function(_0x1b975e,_0x290b08){_0x1b975e=_0x1b975e-0x0;var _0x5ae183=_0x8655[_0x1b975e];return _0x5ae183;};'use strict';var Sequelize=require(_0x5865('0x0'));module[_0x5865('0x1')]={'name':{'type':Sequelize[_0x5865('0x2')]},'description':{'type':Sequelize[_0x5865('0x2')]},'ticketType':{'type':Sequelize[_0x5865('0x3')]('incident',_0x5865('0x4')),'defaultValue':_0x5865('0x5')},'moduleCreate':{'type':Sequelize[_0x5865('0x3')](_0x5865('0x6'),_0x5865('0x7')),'defaultValue':_0x5865('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5865('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xf623=['exports','STRING','ENUM','incident','phonecall','nothing','BOOLEAN','sequelize'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xf623,0x1bf));var _0x3f62=function(_0x5a50e1,_0x23facf){_0x5a50e1=_0x5a50e1-0x0;var _0x25ba7f=_0xf623[_0x5a50e1];return _0x25ba7f;};'use strict';var Sequelize=require(_0x3f62('0x0'));module[_0x3f62('0x1')]={'name':{'type':Sequelize[_0x3f62('0x2')]},'description':{'type':Sequelize[_0x3f62('0x2')]},'ticketType':{'type':Sequelize[_0x3f62('0x3')](_0x3f62('0x4'),_0x3f62('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x3f62('0x3')]('contact',_0x3f62('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x3f62('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 d49baa5..ea608c7 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 _0xd0c2=['key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','findOne','Dynamics365Field','sort','hasOwnProperty','getFields','getSubjects','rawAttributes','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','then','destroy','error','name','index','map','fieldName','type'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xd0c2,0x1c4));var _0x2d0c=function(_0x5e761b,_0x355e38){_0x5e761b=_0x5e761b-0x0;var _0x98502c=_0xd0c2[_0x5e761b];return _0x98502c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d0c('0x0'));var zipdir=require(_0x2d0c('0x1'));var jsonpatch=require(_0x2d0c('0x2'));var rp=require(_0x2d0c('0x3'));var moment=require('moment');var BPromise=require(_0x2d0c('0x4'));var Mustache=require(_0x2d0c('0x5'));var util=require(_0x2d0c('0x6'));var path=require(_0x2d0c('0x7'));var sox=require(_0x2d0c('0x8'));var csv=require(_0x2d0c('0x9'));var ejs=require(_0x2d0c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d0c('0xb'));var squel=require(_0x2d0c('0xc'));var crypto=require(_0x2d0c('0xd'));var jsforce=require(_0x2d0c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2d0c('0x9'));var querystring=require(_0x2d0c('0xf'));var Papa=require(_0x2d0c('0x10'));var Redis=require(_0x2d0c('0x11'));var authService=require(_0x2d0c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2d0c('0x13'));var hardwareService=require(_0x2d0c('0x14'));var logger=require(_0x2d0c('0x15'))(_0x2d0c('0x16'));var utils=require(_0x2d0c('0x17'));var config=require(_0x2d0c('0x18'));var licenseUtil=require(_0x2d0c('0x19'));var db=require(_0x2d0c('0x1a'))['db'];function respondWithStatusCode(_0x4eee42,_0x4d135f){_0x4d135f=_0x4d135f||0xcc;return function(_0x2b668a){if(_0x2b668a){return _0x4eee42[_0x2d0c('0x1b')](_0x4d135f);}return _0x4eee42['status'](_0x4d135f)[_0x2d0c('0x1c')]();};}function respondWithResult(_0x15f78c,_0x21b475){_0x21b475=_0x21b475||0xc8;return function(_0x3135fb){if(_0x3135fb){return _0x15f78c['status'](_0x21b475)[_0x2d0c('0x1d')](_0x3135fb);}};}function respondWithFilteredResult(_0x578c22,_0x23494b){return function(_0x161205){if(_0x161205){var _0x368972=typeof _0x23494b[_0x2d0c('0x1e')]===_0x2d0c('0x1f')&&typeof _0x23494b['limit']===_0x2d0c('0x1f');var _0xf403df=_0x161205['count'];var _0x962e70=_0x368972?0x0:_0x23494b['offset'];var _0x163ead=_0x368972?_0x161205[_0x2d0c('0x20')]:_0x23494b['offset']+_0x23494b[_0x2d0c('0x21')];var _0x148430;if(_0x163ead>=_0xf403df){_0x163ead=_0xf403df;_0x148430=0xc8;}else{_0x148430=0xce;}_0x578c22[_0x2d0c('0x22')](_0x148430);return _0x578c22[_0x2d0c('0x23')](_0x2d0c('0x24'),_0x962e70+'-'+_0x163ead+'/'+_0xf403df)[_0x2d0c('0x1d')](_0x161205);}return null;};}function patchUpdates(_0x38966f){return function(_0x120cf4){try{jsonpatch[_0x2d0c('0x25')](_0x120cf4,_0x38966f,!![]);}catch(_0x5cb9e2){return BPromise['reject'](_0x5cb9e2);}return _0x120cf4['save']();};}function saveUpdates(_0x19bd20,_0x2839ad){return function(_0x299f35){if(_0x299f35){return _0x299f35['update'](_0x19bd20)[_0x2d0c('0x26')](function(_0x569ae4){return _0x569ae4;});}return null;};}function removeEntity(_0x4b6e4a,_0x270155){return function(_0x21014a){if(_0x21014a){return _0x21014a[_0x2d0c('0x27')]()[_0x2d0c('0x26')](function(){_0x4b6e4a[_0x2d0c('0x22')](0xcc)[_0x2d0c('0x1c')]();});}};}function handleEntityNotFound(_0x443322,_0x528eb6){return function(_0x4c988d){if(!_0x4c988d){_0x443322['sendStatus'](0x194);}return _0x4c988d;};}function handleError(_0x76adf6,_0x17ef9f){_0x17ef9f=_0x17ef9f||0x1f4;return function(_0x3376d1){logger[_0x2d0c('0x28')](_0x3376d1['stack']);if(_0x3376d1['name']){delete _0x3376d1[_0x2d0c('0x29')];}_0x76adf6[_0x2d0c('0x22')](_0x17ef9f)['send'](_0x3376d1);};}exports[_0x2d0c('0x2a')]=function(_0x4b8957,_0xcf1d7c){var _0xb0a585={},_0x3abc3f={},_0x28faa7={'count':0x0,'rows':[]};var _0x29c58d=_[_0x2d0c('0x2b')](db['Dynamics365Configuration']['rawAttributes'],function(_0x1a13bd){return{'name':_0x1a13bd[_0x2d0c('0x2c')],'type':_0x1a13bd[_0x2d0c('0x2d')][_0x2d0c('0x2e')]};});_0x3abc3f[_0x2d0c('0x2f')]=_[_0x2d0c('0x2b')](_0x29c58d,_0x2d0c('0x29'));_0x3abc3f['query']=_[_0x2d0c('0x30')](_0x4b8957[_0x2d0c('0x31')]);_0x3abc3f[_0x2d0c('0x32')]=_[_0x2d0c('0x33')](_0x3abc3f[_0x2d0c('0x2f')],_0x3abc3f['query']);_0xb0a585[_0x2d0c('0x34')]=_['intersection'](_0x3abc3f[_0x2d0c('0x2f')],qs[_0x2d0c('0x35')](_0x4b8957[_0x2d0c('0x31')][_0x2d0c('0x35')]));_0xb0a585['attributes']=_0xb0a585[_0x2d0c('0x34')][_0x2d0c('0x36')]?_0xb0a585[_0x2d0c('0x34')]:_0x3abc3f[_0x2d0c('0x2f')];if(!_0x4b8957[_0x2d0c('0x31')]['hasOwnProperty'](_0x2d0c('0x37'))){_0xb0a585[_0x2d0c('0x21')]=qs[_0x2d0c('0x21')](_0x4b8957[_0x2d0c('0x31')][_0x2d0c('0x21')]);_0xb0a585[_0x2d0c('0x1e')]=qs[_0x2d0c('0x1e')](_0x4b8957[_0x2d0c('0x31')][_0x2d0c('0x1e')]);}_0xb0a585[_0x2d0c('0x38')]=qs['sort'](_0x4b8957[_0x2d0c('0x31')]['sort']);_0xb0a585['where']=qs[_0x2d0c('0x32')](_[_0x2d0c('0x39')](_0x4b8957[_0x2d0c('0x31')],_0x3abc3f[_0x2d0c('0x32')]),_0x29c58d);if(_0x4b8957[_0x2d0c('0x31')][_0x2d0c('0x3a')]){_0xb0a585[_0x2d0c('0x3b')]=_['merge'](_0xb0a585[_0x2d0c('0x3b')],{'$or':_['map'](_0x29c58d,function(_0x2fb1cf){if(_0x2fb1cf['type']!==_0x2d0c('0x3c')){var _0x7abc2={};_0x7abc2[_0x2fb1cf[_0x2d0c('0x29')]]={'$like':'%'+_0x4b8957[_0x2d0c('0x31')]['filter']+'%'};return _0x7abc2;}})});}_0xb0a585=_[_0x2d0c('0x3d')]({},_0xb0a585,_0x4b8957[_0x2d0c('0x3e')]);var _0x39d6f5={'where':_0xb0a585[_0x2d0c('0x3b')]};return db[_0x2d0c('0x3f')][_0x2d0c('0x20')](_0x39d6f5)[_0x2d0c('0x26')](function(_0x2ad5cd){_0x28faa7[_0x2d0c('0x20')]=_0x2ad5cd;if(_0x4b8957[_0x2d0c('0x31')][_0x2d0c('0x40')]){_0xb0a585[_0x2d0c('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x2d0c('0x42')](_0xb0a585);})[_0x2d0c('0x26')](function(_0x445dfb){_0x28faa7[_0x2d0c('0x43')]=_0x445dfb;return _0x28faa7;})[_0x2d0c('0x26')](respondWithFilteredResult(_0xcf1d7c,_0xb0a585))[_0x2d0c('0x44')](handleError(_0xcf1d7c,null));};exports[_0x2d0c('0x45')]=function(_0x193230,_0x3bfa94){var _0x44ed2e={'raw':![],'where':{'id':_0x193230[_0x2d0c('0x46')]['id']}},_0x3a359a={};_0x3a359a[_0x2d0c('0x2f')]=_[_0x2d0c('0x30')](db[_0x2d0c('0x3f')]['rawAttributes']);_0x3a359a[_0x2d0c('0x31')]=_[_0x2d0c('0x30')](_0x193230[_0x2d0c('0x31')]);_0x3a359a[_0x2d0c('0x32')]=_['intersection'](_0x3a359a[_0x2d0c('0x2f')],_0x3a359a[_0x2d0c('0x31')]);_0x44ed2e[_0x2d0c('0x34')]=_[_0x2d0c('0x33')](_0x3a359a['model'],qs[_0x2d0c('0x35')](_0x193230[_0x2d0c('0x31')][_0x2d0c('0x35')]));_0x44ed2e[_0x2d0c('0x34')]=_0x44ed2e[_0x2d0c('0x34')][_0x2d0c('0x36')]?_0x44ed2e[_0x2d0c('0x34')]:_0x3a359a['model'];if(_0x193230['query']['includeAll']){_0x44ed2e[_0x2d0c('0x41')]=[{'all':!![]}];}_0x44ed2e=_[_0x2d0c('0x3d')]({},_0x44ed2e,_0x193230[_0x2d0c('0x3e')]);return db[_0x2d0c('0x3f')]['find'](_0x44ed2e)[_0x2d0c('0x26')](handleEntityNotFound(_0x3bfa94,null))[_0x2d0c('0x26')](respondWithResult(_0x3bfa94,null))['catch'](handleError(_0x3bfa94,null));};exports[_0x2d0c('0x47')]=function(_0x4012ca,_0x826e60){return db['Dynamics365Configuration'][_0x2d0c('0x47')](_0x4012ca[_0x2d0c('0x48')],{})['then'](respondWithResult(_0x826e60,0xc9))[_0x2d0c('0x44')](handleError(_0x826e60,null));};exports[_0x2d0c('0x49')]=function(_0x4fc65c,_0x14eb5f){if(_0x4fc65c['body']['id']){delete _0x4fc65c[_0x2d0c('0x48')]['id'];}return db['Dynamics365Configuration'][_0x2d0c('0x4a')]({'where':{'id':_0x4fc65c[_0x2d0c('0x46')]['id']}})['then'](handleEntityNotFound(_0x14eb5f,null))[_0x2d0c('0x26')](saveUpdates(_0x4fc65c[_0x2d0c('0x48')],null))['then'](respondWithResult(_0x14eb5f,null))[_0x2d0c('0x44')](handleError(_0x14eb5f,null));};exports[_0x2d0c('0x27')]=function(_0x258cf6,_0x501234){return db['Dynamics365Configuration'][_0x2d0c('0x4a')]({'where':{'id':_0x258cf6[_0x2d0c('0x46')]['id']}})['then'](handleEntityNotFound(_0x501234,null))[_0x2d0c('0x26')](removeEntity(_0x501234,null))[_0x2d0c('0x44')](handleError(_0x501234,null));};exports['getFields']=function(_0x534702,_0x144d8c,_0x180fbf){var _0x37c403={};var _0x2aac20={};var _0x1fbf8e;var _0x4e52e5;return db['Dynamics365Configuration'][_0x2d0c('0x4b')]({'where':{'id':_0x534702[_0x2d0c('0x46')]['id']}})[_0x2d0c('0x26')](handleEntityNotFound(_0x144d8c,null))[_0x2d0c('0x26')](function(_0x342fb5){if(_0x342fb5){_0x1fbf8e=_0x342fb5;_0x2aac20[_0x2d0c('0x2f')]=_[_0x2d0c('0x30')](db[_0x2d0c('0x4c')]['rawAttributes']);_0x2aac20['query']=_[_0x2d0c('0x30')](_0x534702[_0x2d0c('0x31')]);_0x2aac20[_0x2d0c('0x32')]=_['intersection'](_0x2aac20[_0x2d0c('0x2f')],_0x2aac20[_0x2d0c('0x31')]);_0x37c403[_0x2d0c('0x34')]=_[_0x2d0c('0x33')](_0x2aac20[_0x2d0c('0x2f')],qs['fields'](_0x534702[_0x2d0c('0x31')][_0x2d0c('0x35')]));_0x37c403[_0x2d0c('0x34')]=_0x37c403['attributes'][_0x2d0c('0x36')]?_0x37c403[_0x2d0c('0x34')]:_0x2aac20[_0x2d0c('0x2f')];_0x37c403['order']=qs[_0x2d0c('0x4d')](_0x534702[_0x2d0c('0x31')][_0x2d0c('0x4d')]);_0x37c403['where']=qs[_0x2d0c('0x32')](_['pick'](_0x534702[_0x2d0c('0x31')],_0x2aac20[_0x2d0c('0x32')]));if(_0x534702[_0x2d0c('0x31')]['filter']){_0x37c403[_0x2d0c('0x3b')]=_[_0x2d0c('0x3d')](_0x37c403[_0x2d0c('0x3b')],{'$or':_[_0x2d0c('0x2b')](_0x37c403[_0x2d0c('0x34')],function(_0x4cd5c4){var _0x2804ed={};_0x2804ed[_0x4cd5c4]={'$like':'%'+_0x534702[_0x2d0c('0x31')]['filter']+'%'};return _0x2804ed;})});}_0x37c403=_[_0x2d0c('0x3d')]({},_0x37c403,_0x534702[_0x2d0c('0x3e')]);return _0x1fbf8e['getFields'](_0x37c403);}})[_0x2d0c('0x26')](function(_0x306a5e){if(_0x306a5e){_0x4e52e5=_0x306a5e['length'];if(!_0x534702[_0x2d0c('0x31')][_0x2d0c('0x4e')]('nolimit')){_0x37c403[_0x2d0c('0x21')]=qs[_0x2d0c('0x21')](_0x534702['query'][_0x2d0c('0x21')]);_0x37c403['offset']=qs['offset'](_0x534702[_0x2d0c('0x31')]['offset']);}return _0x1fbf8e[_0x2d0c('0x4f')](_0x37c403);}})[_0x2d0c('0x26')](function(_0x18cacd){if(_0x18cacd){return _0x18cacd?{'count':_0x4e52e5,'rows':_0x18cacd}:null;}})['then'](respondWithResult(_0x144d8c,null))[_0x2d0c('0x44')](handleError(_0x144d8c,null));};exports[_0x2d0c('0x50')]=function(_0x496dd6,_0x2335cd,_0x406040){var _0x38aa00={};var _0x3f4a39={};var _0x15663f;var _0x41a964;return db[_0x2d0c('0x3f')]['findOne']({'where':{'id':_0x496dd6[_0x2d0c('0x46')]['id']}})['then'](handleEntityNotFound(_0x2335cd,null))['then'](function(_0xbaf027){if(_0xbaf027){_0x15663f=_0xbaf027;_0x3f4a39[_0x2d0c('0x2f')]=_['keys'](db[_0x2d0c('0x4c')][_0x2d0c('0x51')]);_0x3f4a39[_0x2d0c('0x31')]=_[_0x2d0c('0x30')](_0x496dd6['query']);_0x3f4a39[_0x2d0c('0x32')]=_[_0x2d0c('0x33')](_0x3f4a39['model'],_0x3f4a39[_0x2d0c('0x31')]);_0x38aa00[_0x2d0c('0x34')]=_[_0x2d0c('0x33')](_0x3f4a39[_0x2d0c('0x2f')],qs[_0x2d0c('0x35')](_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x35')]));_0x38aa00['attributes']=_0x38aa00[_0x2d0c('0x34')]['length']?_0x38aa00[_0x2d0c('0x34')]:_0x3f4a39['model'];_0x38aa00[_0x2d0c('0x38')]=qs[_0x2d0c('0x4d')](_0x496dd6['query'][_0x2d0c('0x4d')]);_0x38aa00['where']=qs['filters'](_['pick'](_0x496dd6[_0x2d0c('0x31')],_0x3f4a39[_0x2d0c('0x32')]));if(_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x3a')]){_0x38aa00[_0x2d0c('0x3b')]=_['merge'](_0x38aa00['where'],{'$or':_[_0x2d0c('0x2b')](_0x38aa00[_0x2d0c('0x34')],function(_0x46c8fa){var _0x50e75c={};_0x50e75c[_0x46c8fa]={'$like':'%'+_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x3a')]+'%'};return _0x50e75c;})});}_0x38aa00=_['merge']({},_0x38aa00,_0x496dd6[_0x2d0c('0x3e')]);return _0x15663f['getSubjects'](_0x38aa00);}})[_0x2d0c('0x26')](function(_0x2ce966){if(_0x2ce966){_0x41a964=_0x2ce966[_0x2d0c('0x36')];if(!_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x4e')](_0x2d0c('0x37'))){_0x38aa00['limit']=qs[_0x2d0c('0x21')](_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x21')]);_0x38aa00[_0x2d0c('0x1e')]=qs['offset'](_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x1e')]);}return _0x15663f[_0x2d0c('0x50')](_0x38aa00);}})['then'](function(_0x2fa1f8){if(_0x2fa1f8){return _0x2fa1f8?{'count':_0x41a964,'rows':_0x2fa1f8}:null;}})['then'](respondWithResult(_0x2335cd,null))[_0x2d0c('0x44')](handleError(_0x2335cd,null));};exports[_0x2d0c('0x52')]=function(_0x5854fd,_0x177142,_0x33be3a){var _0x25bb6e={};var _0x58311f={};var _0x566fc5;var _0x27b093;return db[_0x2d0c('0x3f')][_0x2d0c('0x4b')]({'where':{'id':_0x5854fd[_0x2d0c('0x46')]['id']}})[_0x2d0c('0x26')](handleEntityNotFound(_0x177142,null))[_0x2d0c('0x26')](function(_0xb27af3){if(_0xb27af3){_0x566fc5=_0xb27af3;_0x58311f[_0x2d0c('0x2f')]=_[_0x2d0c('0x30')](db['Dynamics365Field'][_0x2d0c('0x51')]);_0x58311f[_0x2d0c('0x31')]=_[_0x2d0c('0x30')](_0x5854fd[_0x2d0c('0x31')]);_0x58311f['filters']=_[_0x2d0c('0x33')](_0x58311f[_0x2d0c('0x2f')],_0x58311f[_0x2d0c('0x31')]);_0x25bb6e[_0x2d0c('0x34')]=_[_0x2d0c('0x33')](_0x58311f[_0x2d0c('0x2f')],qs[_0x2d0c('0x35')](_0x5854fd[_0x2d0c('0x31')][_0x2d0c('0x35')]));_0x25bb6e[_0x2d0c('0x34')]=_0x25bb6e[_0x2d0c('0x34')][_0x2d0c('0x36')]?_0x25bb6e[_0x2d0c('0x34')]:_0x58311f[_0x2d0c('0x2f')];_0x25bb6e[_0x2d0c('0x38')]=qs['sort'](_0x5854fd[_0x2d0c('0x31')][_0x2d0c('0x4d')]);_0x25bb6e['where']=qs[_0x2d0c('0x32')](_[_0x2d0c('0x39')](_0x5854fd[_0x2d0c('0x31')],_0x58311f[_0x2d0c('0x32')]));if(_0x5854fd['query'][_0x2d0c('0x3a')]){_0x25bb6e[_0x2d0c('0x3b')]=_['merge'](_0x25bb6e['where'],{'$or':_[_0x2d0c('0x2b')](_0x25bb6e[_0x2d0c('0x34')],function(_0x294852){var _0x17bd98={};_0x17bd98[_0x294852]={'$like':'%'+_0x5854fd['query'][_0x2d0c('0x3a')]+'%'};return _0x17bd98;})});}_0x25bb6e=_[_0x2d0c('0x3d')]({},_0x25bb6e,_0x5854fd['options']);return _0x566fc5[_0x2d0c('0x52')](_0x25bb6e);}})['then'](function(_0x93d2ab){if(_0x93d2ab){_0x27b093=_0x93d2ab[_0x2d0c('0x36')];if(!_0x5854fd[_0x2d0c('0x31')]['hasOwnProperty'](_0x2d0c('0x37'))){_0x25bb6e[_0x2d0c('0x21')]=qs[_0x2d0c('0x21')](_0x5854fd[_0x2d0c('0x31')][_0x2d0c('0x21')]);_0x25bb6e[_0x2d0c('0x1e')]=qs['offset'](_0x5854fd['query']['offset']);}return _0x566fc5[_0x2d0c('0x52')](_0x25bb6e);}})['then'](function(_0x17d6ee){if(_0x17d6ee){return _0x17d6ee?{'count':_0x27b093,'rows':_0x17d6ee}:null;}})['then'](respondWithResult(_0x177142,null))[_0x2d0c('0x44')](handleError(_0x177142,null));}; \ No newline at end of file +var _0x7a53=['error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','getFields','Dynamics365Field','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x596053,_0x1a9efd){var _0x1fb180=function(_0x14ccdf){while(--_0x14ccdf){_0x596053['push'](_0x596053['shift']());}};_0x1fb180(++_0x1a9efd);}(_0x7a53,0x1c9));var _0x37a5=function(_0x9887fa,_0x44e0ca){_0x9887fa=_0x9887fa-0x0;var _0x2f8d7a=_0x7a53[_0x9887fa];return _0x2f8d7a;};'use strict';var emlformat=require(_0x37a5('0x0'));var rimraf=require(_0x37a5('0x1'));var zipdir=require(_0x37a5('0x2'));var jsonpatch=require(_0x37a5('0x3'));var rp=require(_0x37a5('0x4'));var moment=require(_0x37a5('0x5'));var BPromise=require(_0x37a5('0x6'));var Mustache=require(_0x37a5('0x7'));var util=require(_0x37a5('0x8'));var path=require(_0x37a5('0x9'));var sox=require('sox');var csv=require(_0x37a5('0xa'));var ejs=require(_0x37a5('0xb'));var fs=require('fs');var fs_extra=require(_0x37a5('0xc'));var _=require(_0x37a5('0xd'));var squel=require(_0x37a5('0xe'));var crypto=require(_0x37a5('0xf'));var jsforce=require(_0x37a5('0x10'));var deskjs=require(_0x37a5('0x11'));var toCsv=require(_0x37a5('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37a5('0x12'));var qs=require(_0x37a5('0x13'));var as=require(_0x37a5('0x14'));var hardwareService=require(_0x37a5('0x15'));var logger=require(_0x37a5('0x16'))(_0x37a5('0x17'));var utils=require(_0x37a5('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x37a5('0x19'))['db'];function respondWithStatusCode(_0x49ef32,_0x4b4827){_0x4b4827=_0x4b4827||0xcc;return function(_0x2141a0){if(_0x2141a0){return _0x49ef32['sendStatus'](_0x4b4827);}return _0x49ef32[_0x37a5('0x1a')](_0x4b4827)[_0x37a5('0x1b')]();};}function respondWithResult(_0x548a71,_0x5bb322){_0x5bb322=_0x5bb322||0xc8;return function(_0x524704){if(_0x524704){return _0x548a71[_0x37a5('0x1a')](_0x5bb322)[_0x37a5('0x1c')](_0x524704);}};}function respondWithFilteredResult(_0x3ab4bc,_0x1e1d6a){return function(_0x271944){if(_0x271944){var _0x14ebc9=typeof _0x1e1d6a[_0x37a5('0x1d')]===_0x37a5('0x1e')&&typeof _0x1e1d6a['limit']===_0x37a5('0x1e');var _0x298771=_0x271944[_0x37a5('0x1f')];var _0x5445c1=_0x14ebc9?0x0:_0x1e1d6a[_0x37a5('0x1d')];var _0x2d70f9=_0x14ebc9?_0x271944[_0x37a5('0x1f')]:_0x1e1d6a[_0x37a5('0x1d')]+_0x1e1d6a[_0x37a5('0x20')];var _0x78e07a;if(_0x2d70f9>=_0x298771){_0x2d70f9=_0x298771;_0x78e07a=0xc8;}else{_0x78e07a=0xce;}_0x3ab4bc[_0x37a5('0x1a')](_0x78e07a);return _0x3ab4bc[_0x37a5('0x21')]('Content-Range',_0x5445c1+'-'+_0x2d70f9+'/'+_0x298771)[_0x37a5('0x1c')](_0x271944);}return null;};}function patchUpdates(_0x337092){return function(_0x23088c){try{jsonpatch[_0x37a5('0x22')](_0x23088c,_0x337092,!![]);}catch(_0x436cc6){return BPromise[_0x37a5('0x23')](_0x436cc6);}return _0x23088c[_0x37a5('0x24')]();};}function saveUpdates(_0x22fd19,_0x107c36){return function(_0xfe33ea){if(_0xfe33ea){return _0xfe33ea[_0x37a5('0x25')](_0x22fd19)[_0x37a5('0x26')](function(_0x51ec36){return _0x51ec36;});}return null;};}function removeEntity(_0x52c0de,_0x2c4f1c){return function(_0x4dd21e){if(_0x4dd21e){return _0x4dd21e[_0x37a5('0x27')]()['then'](function(){_0x52c0de[_0x37a5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x196ab7,_0x208a0e){return function(_0x54daa5){if(!_0x54daa5){_0x196ab7[_0x37a5('0x28')](0x194);}return _0x54daa5;};}function handleError(_0xfd1f5,_0x10a4b6){_0x10a4b6=_0x10a4b6||0x1f4;return function(_0x4703f2){logger[_0x37a5('0x29')](_0x4703f2[_0x37a5('0x2a')]);if(_0x4703f2[_0x37a5('0x2b')]){delete _0x4703f2[_0x37a5('0x2b')];}_0xfd1f5['status'](_0x10a4b6)[_0x37a5('0x2c')](_0x4703f2);};}exports[_0x37a5('0x2d')]=function(_0x166c96,_0x4f520e){var _0x49efd8={},_0xcc7d92={},_0x57491c={'count':0x0,'rows':[]};var _0xb6f7a1=_['map'](db[_0x37a5('0x2e')][_0x37a5('0x2f')],function(_0x127287){return{'name':_0x127287[_0x37a5('0x30')],'type':_0x127287['type']['key']};});_0xcc7d92[_0x37a5('0x31')]=_[_0x37a5('0x32')](_0xb6f7a1,_0x37a5('0x2b'));_0xcc7d92[_0x37a5('0x33')]=_[_0x37a5('0x34')](_0x166c96[_0x37a5('0x33')]);_0xcc7d92[_0x37a5('0x35')]=_[_0x37a5('0x36')](_0xcc7d92[_0x37a5('0x31')],_0xcc7d92['query']);_0x49efd8[_0x37a5('0x37')]=_[_0x37a5('0x36')](_0xcc7d92[_0x37a5('0x31')],qs[_0x37a5('0x38')](_0x166c96[_0x37a5('0x33')][_0x37a5('0x38')]));_0x49efd8[_0x37a5('0x37')]=_0x49efd8[_0x37a5('0x37')]['length']?_0x49efd8[_0x37a5('0x37')]:_0xcc7d92['model'];if(!_0x166c96[_0x37a5('0x33')][_0x37a5('0x39')]('nolimit')){_0x49efd8[_0x37a5('0x20')]=qs[_0x37a5('0x20')](_0x166c96[_0x37a5('0x33')]['limit']);_0x49efd8['offset']=qs[_0x37a5('0x1d')](_0x166c96['query'][_0x37a5('0x1d')]);}_0x49efd8[_0x37a5('0x3a')]=qs[_0x37a5('0x3b')](_0x166c96[_0x37a5('0x33')][_0x37a5('0x3b')]);_0x49efd8[_0x37a5('0x3c')]=qs[_0x37a5('0x35')](_[_0x37a5('0x3d')](_0x166c96[_0x37a5('0x33')],_0xcc7d92[_0x37a5('0x35')]),_0xb6f7a1);if(_0x166c96['query'][_0x37a5('0x3e')]){_0x49efd8['where']=_[_0x37a5('0x3f')](_0x49efd8['where'],{'$or':_[_0x37a5('0x32')](_0xb6f7a1,function(_0x2a95b9){if(_0x2a95b9['type']!==_0x37a5('0x40')){var _0x11eba1={};_0x11eba1[_0x2a95b9[_0x37a5('0x2b')]]={'$like':'%'+_0x166c96[_0x37a5('0x33')][_0x37a5('0x3e')]+'%'};return _0x11eba1;}})});}_0x49efd8=_['merge']({},_0x49efd8,_0x166c96[_0x37a5('0x41')]);var _0xe46da9={'where':_0x49efd8[_0x37a5('0x3c')]};return db[_0x37a5('0x2e')]['count'](_0xe46da9)[_0x37a5('0x26')](function(_0x5dfaf2){_0x57491c['count']=_0x5dfaf2;if(_0x166c96[_0x37a5('0x33')][_0x37a5('0x42')]){_0x49efd8['include']=[{'all':!![]}];}return db[_0x37a5('0x2e')][_0x37a5('0x43')](_0x49efd8);})['then'](function(_0x228d5d){_0x57491c[_0x37a5('0x44')]=_0x228d5d;return _0x57491c;})[_0x37a5('0x26')](respondWithFilteredResult(_0x4f520e,_0x49efd8))[_0x37a5('0x45')](handleError(_0x4f520e,null));};exports[_0x37a5('0x46')]=function(_0x348c75,_0x1486ba){var _0xa20a72={'raw':![],'where':{'id':_0x348c75[_0x37a5('0x47')]['id']}},_0x197322={};_0x197322[_0x37a5('0x31')]=_[_0x37a5('0x34')](db[_0x37a5('0x2e')][_0x37a5('0x2f')]);_0x197322[_0x37a5('0x33')]=_[_0x37a5('0x34')](_0x348c75['query']);_0x197322[_0x37a5('0x35')]=_[_0x37a5('0x36')](_0x197322[_0x37a5('0x31')],_0x197322[_0x37a5('0x33')]);_0xa20a72[_0x37a5('0x37')]=_[_0x37a5('0x36')](_0x197322['model'],qs[_0x37a5('0x38')](_0x348c75[_0x37a5('0x33')][_0x37a5('0x38')]));_0xa20a72[_0x37a5('0x37')]=_0xa20a72[_0x37a5('0x37')][_0x37a5('0x48')]?_0xa20a72[_0x37a5('0x37')]:_0x197322['model'];if(_0x348c75[_0x37a5('0x33')][_0x37a5('0x42')]){_0xa20a72[_0x37a5('0x49')]=[{'all':!![]}];}_0xa20a72=_[_0x37a5('0x3f')]({},_0xa20a72,_0x348c75[_0x37a5('0x41')]);return db[_0x37a5('0x2e')][_0x37a5('0x4a')](_0xa20a72)['then'](handleEntityNotFound(_0x1486ba,null))[_0x37a5('0x26')](respondWithResult(_0x1486ba,null))[_0x37a5('0x45')](handleError(_0x1486ba,null));};exports[_0x37a5('0x4b')]=function(_0x309a17,_0x1894ce){return db[_0x37a5('0x2e')][_0x37a5('0x4b')](_0x309a17[_0x37a5('0x4c')],{})['then'](respondWithResult(_0x1894ce,0xc9))['catch'](handleError(_0x1894ce,null));};exports[_0x37a5('0x25')]=function(_0x5eca5b,_0x4fd508){if(_0x5eca5b['body']['id']){delete _0x5eca5b[_0x37a5('0x4c')]['id'];}return db[_0x37a5('0x2e')]['find']({'where':{'id':_0x5eca5b[_0x37a5('0x47')]['id']}})[_0x37a5('0x26')](handleEntityNotFound(_0x4fd508,null))[_0x37a5('0x26')](saveUpdates(_0x5eca5b[_0x37a5('0x4c')],null))[_0x37a5('0x26')](respondWithResult(_0x4fd508,null))[_0x37a5('0x45')](handleError(_0x4fd508,null));};exports['destroy']=function(_0xe79a07,_0x2f7c44){return db[_0x37a5('0x2e')][_0x37a5('0x4a')]({'where':{'id':_0xe79a07[_0x37a5('0x47')]['id']}})[_0x37a5('0x26')](handleEntityNotFound(_0x2f7c44,null))[_0x37a5('0x26')](removeEntity(_0x2f7c44,null))[_0x37a5('0x45')](handleError(_0x2f7c44,null));};exports[_0x37a5('0x4d')]=function(_0x205568,_0x2ce5c5,_0x17e282){var _0x35e31b={};var _0x4d34be={};var _0x5f5639;var _0x518828;return db[_0x37a5('0x2e')]['findOne']({'where':{'id':_0x205568[_0x37a5('0x47')]['id']}})[_0x37a5('0x26')](handleEntityNotFound(_0x2ce5c5,null))[_0x37a5('0x26')](function(_0x4668a0){if(_0x4668a0){_0x5f5639=_0x4668a0;_0x4d34be[_0x37a5('0x31')]=_[_0x37a5('0x34')](db[_0x37a5('0x4e')][_0x37a5('0x2f')]);_0x4d34be[_0x37a5('0x33')]=_[_0x37a5('0x34')](_0x205568['query']);_0x4d34be[_0x37a5('0x35')]=_[_0x37a5('0x36')](_0x4d34be['model'],_0x4d34be[_0x37a5('0x33')]);_0x35e31b[_0x37a5('0x37')]=_[_0x37a5('0x36')](_0x4d34be[_0x37a5('0x31')],qs[_0x37a5('0x38')](_0x205568[_0x37a5('0x33')][_0x37a5('0x38')]));_0x35e31b[_0x37a5('0x37')]=_0x35e31b['attributes'][_0x37a5('0x48')]?_0x35e31b[_0x37a5('0x37')]:_0x4d34be[_0x37a5('0x31')];_0x35e31b[_0x37a5('0x3a')]=qs[_0x37a5('0x3b')](_0x205568[_0x37a5('0x33')]['sort']);_0x35e31b[_0x37a5('0x3c')]=qs[_0x37a5('0x35')](_['pick'](_0x205568[_0x37a5('0x33')],_0x4d34be['filters']));if(_0x205568[_0x37a5('0x33')][_0x37a5('0x3e')]){_0x35e31b[_0x37a5('0x3c')]=_[_0x37a5('0x3f')](_0x35e31b[_0x37a5('0x3c')],{'$or':_['map'](_0x35e31b[_0x37a5('0x37')],function(_0xf0c65){var _0x8caa5b={};_0x8caa5b[_0xf0c65]={'$like':'%'+_0x205568[_0x37a5('0x33')]['filter']+'%'};return _0x8caa5b;})});}_0x35e31b=_['merge']({},_0x35e31b,_0x205568[_0x37a5('0x41')]);return _0x5f5639[_0x37a5('0x4d')](_0x35e31b);}})[_0x37a5('0x26')](function(_0x5e3a26){if(_0x5e3a26){_0x518828=_0x5e3a26[_0x37a5('0x48')];if(!_0x205568[_0x37a5('0x33')][_0x37a5('0x39')](_0x37a5('0x4f'))){_0x35e31b[_0x37a5('0x20')]=qs['limit'](_0x205568[_0x37a5('0x33')][_0x37a5('0x20')]);_0x35e31b[_0x37a5('0x1d')]=qs[_0x37a5('0x1d')](_0x205568[_0x37a5('0x33')]['offset']);}return _0x5f5639['getFields'](_0x35e31b);}})[_0x37a5('0x26')](function(_0x136f1d){if(_0x136f1d){return _0x136f1d?{'count':_0x518828,'rows':_0x136f1d}:null;}})[_0x37a5('0x26')](respondWithResult(_0x2ce5c5,null))[_0x37a5('0x45')](handleError(_0x2ce5c5,null));};exports[_0x37a5('0x50')]=function(_0x44bb78,_0x41d257,_0x4ad28d){var _0x2510ea={};var _0x1fe3e5={};var _0x5d2d61;var _0x1dbcf8;return db['Dynamics365Configuration'][_0x37a5('0x51')]({'where':{'id':_0x44bb78[_0x37a5('0x47')]['id']}})[_0x37a5('0x26')](handleEntityNotFound(_0x41d257,null))[_0x37a5('0x26')](function(_0x4d2345){if(_0x4d2345){_0x5d2d61=_0x4d2345;_0x1fe3e5['model']=_['keys'](db[_0x37a5('0x4e')][_0x37a5('0x2f')]);_0x1fe3e5[_0x37a5('0x33')]=_[_0x37a5('0x34')](_0x44bb78[_0x37a5('0x33')]);_0x1fe3e5['filters']=_[_0x37a5('0x36')](_0x1fe3e5[_0x37a5('0x31')],_0x1fe3e5[_0x37a5('0x33')]);_0x2510ea[_0x37a5('0x37')]=_['intersection'](_0x1fe3e5['model'],qs['fields'](_0x44bb78[_0x37a5('0x33')][_0x37a5('0x38')]));_0x2510ea[_0x37a5('0x37')]=_0x2510ea[_0x37a5('0x37')][_0x37a5('0x48')]?_0x2510ea[_0x37a5('0x37')]:_0x1fe3e5[_0x37a5('0x31')];_0x2510ea[_0x37a5('0x3a')]=qs[_0x37a5('0x3b')](_0x44bb78[_0x37a5('0x33')][_0x37a5('0x3b')]);_0x2510ea[_0x37a5('0x3c')]=qs[_0x37a5('0x35')](_[_0x37a5('0x3d')](_0x44bb78[_0x37a5('0x33')],_0x1fe3e5[_0x37a5('0x35')]));if(_0x44bb78[_0x37a5('0x33')]['filter']){_0x2510ea[_0x37a5('0x3c')]=_[_0x37a5('0x3f')](_0x2510ea[_0x37a5('0x3c')],{'$or':_['map'](_0x2510ea['attributes'],function(_0x47f2d1){var _0x273112={};_0x273112[_0x47f2d1]={'$like':'%'+_0x44bb78['query'][_0x37a5('0x3e')]+'%'};return _0x273112;})});}_0x2510ea=_[_0x37a5('0x3f')]({},_0x2510ea,_0x44bb78[_0x37a5('0x41')]);return _0x5d2d61[_0x37a5('0x50')](_0x2510ea);}})['then'](function(_0x2e3eca){if(_0x2e3eca){_0x1dbcf8=_0x2e3eca[_0x37a5('0x48')];if(!_0x44bb78[_0x37a5('0x33')][_0x37a5('0x39')](_0x37a5('0x4f'))){_0x2510ea[_0x37a5('0x20')]=qs['limit'](_0x44bb78['query']['limit']);_0x2510ea[_0x37a5('0x1d')]=qs[_0x37a5('0x1d')](_0x44bb78[_0x37a5('0x33')][_0x37a5('0x1d')]);}return _0x5d2d61[_0x37a5('0x50')](_0x2510ea);}})[_0x37a5('0x26')](function(_0x4a6e25){if(_0x4a6e25){return _0x4a6e25?{'count':_0x1dbcf8,'rows':_0x4a6e25}:null;}})['then'](respondWithResult(_0x41d257,null))[_0x37a5('0x45')](handleError(_0x41d257,null));};exports[_0x37a5('0x52')]=function(_0x2f3242,_0x2d6e53,_0x34d398){var _0x4d8bfc={};var _0x987a15={};var _0xed8595;var _0x52a371;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x2f3242[_0x37a5('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d6e53,null))[_0x37a5('0x26')](function(_0x183d76){if(_0x183d76){_0xed8595=_0x183d76;_0x987a15[_0x37a5('0x31')]=_['keys'](db['Dynamics365Field'][_0x37a5('0x2f')]);_0x987a15[_0x37a5('0x33')]=_['keys'](_0x2f3242[_0x37a5('0x33')]);_0x987a15['filters']=_[_0x37a5('0x36')](_0x987a15[_0x37a5('0x31')],_0x987a15['query']);_0x4d8bfc[_0x37a5('0x37')]=_[_0x37a5('0x36')](_0x987a15[_0x37a5('0x31')],qs[_0x37a5('0x38')](_0x2f3242[_0x37a5('0x33')][_0x37a5('0x38')]));_0x4d8bfc[_0x37a5('0x37')]=_0x4d8bfc['attributes']['length']?_0x4d8bfc[_0x37a5('0x37')]:_0x987a15[_0x37a5('0x31')];_0x4d8bfc[_0x37a5('0x3a')]=qs[_0x37a5('0x3b')](_0x2f3242[_0x37a5('0x33')]['sort']);_0x4d8bfc['where']=qs[_0x37a5('0x35')](_[_0x37a5('0x3d')](_0x2f3242[_0x37a5('0x33')],_0x987a15[_0x37a5('0x35')]));if(_0x2f3242[_0x37a5('0x33')]['filter']){_0x4d8bfc['where']=_[_0x37a5('0x3f')](_0x4d8bfc[_0x37a5('0x3c')],{'$or':_[_0x37a5('0x32')](_0x4d8bfc[_0x37a5('0x37')],function(_0x13ba14){var _0x4b4596={};_0x4b4596[_0x13ba14]={'$like':'%'+_0x2f3242['query'][_0x37a5('0x3e')]+'%'};return _0x4b4596;})});}_0x4d8bfc=_[_0x37a5('0x3f')]({},_0x4d8bfc,_0x2f3242[_0x37a5('0x41')]);return _0xed8595['getDescriptions'](_0x4d8bfc);}})[_0x37a5('0x26')](function(_0x27b621){if(_0x27b621){_0x52a371=_0x27b621[_0x37a5('0x48')];if(!_0x2f3242[_0x37a5('0x33')][_0x37a5('0x39')](_0x37a5('0x4f'))){_0x4d8bfc['limit']=qs[_0x37a5('0x20')](_0x2f3242['query'][_0x37a5('0x20')]);_0x4d8bfc[_0x37a5('0x1d')]=qs[_0x37a5('0x1d')](_0x2f3242['query'][_0x37a5('0x1d')]);}return _0xed8595[_0x37a5('0x52')](_0x4d8bfc);}})[_0x37a5('0x26')](function(_0x25f0da){if(_0x25f0da){return _0x25f0da?{'count':_0x52a371,'rows':_0x25f0da}:null;}})['then'](respondWithResult(_0x2d6e53,null))[_0x37a5('0x45')](handleError(_0x2d6e53,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e7ce46f..4726133 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 _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x37a669,_0x3a0430){var _0x323c24=function(_0x561635){while(--_0x561635){_0x37a669['push'](_0x37a669['shift']());}};_0x323c24(++_0x3a0430);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x12a9b3,_0x536e5a){var _0x5ad239=function(_0xb13216){while(--_0xb13216){_0x12a9b3['push'](_0x12a9b3['shift']());}};_0x5ad239(++_0x536e5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 5b83c06..29774f9 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 _0x1397=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x20a791,_0x49718f){var _0xe0f198=function(_0x26e103){while(--_0x26e103){_0x20a791['push'](_0x20a791['shift']());}};_0xe0f198(++_0x49718f);}(_0x1397,0x1e2));var _0x7139=function(_0x5ccdd0,_0x23a0ba){_0x5ccdd0=_0x5ccdd0-0x0;var _0x4788ea=_0x1397[_0x5ccdd0];return _0x4788ea;};'use strict';var _=require('lodash');var util=require(_0x7139('0x0'));var moment=require(_0x7139('0x1'));var BPromise=require(_0x7139('0x2'));var rs=require(_0x7139('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7139('0x4'))['db'];var utils=require(_0x7139('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7139('0x6'));var jayson=require(_0x7139('0x7'));var client=jayson[_0x7139('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a5fb8,_0x25a474,_0x124992){return new BPromise(function(_0x2ff928,_0x44eadf){return client[_0x7139('0x9')](_0x1a5fb8,_0x124992)[_0x7139('0xa')](function(_0x9ef7d9){logger[_0x7139('0xb')](_0x7139('0xc'),_0x25a474,_0x7139('0xd'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x25a474,'request\x20sent',JSON[_0x7139('0xe')](_0x9ef7d9));if(_0x9ef7d9[_0x7139('0xf')]){if(_0x9ef7d9['error'][_0x7139('0x10')]===0x1f4){logger[_0x7139('0xf')](_0x7139('0xc'),_0x25a474,_0x9ef7d9[_0x7139('0xf')][_0x7139('0x11')]);return _0x44eadf(_0x9ef7d9['error'][_0x7139('0x11')]);}logger[_0x7139('0xf')](_0x7139('0xc'),_0x25a474,_0x9ef7d9['error'][_0x7139('0x11')]);return _0x2ff928(_0x9ef7d9[_0x7139('0xf')]['message']);}else{logger[_0x7139('0xb')](_0x7139('0xc'),_0x25a474,_0x7139('0xd'));_0x2ff928(_0x9ef7d9[_0x7139('0x12')][_0x7139('0x11')]);}})['catch'](function(_0x33422b){logger[_0x7139('0xf')](_0x7139('0xc'),_0x25a474,_0x33422b);_0x44eadf(_0x33422b);});});} \ No newline at end of file +var _0x55e6=['stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x55e6,0x13d));var _0x655e=function(_0x2f6165,_0x1cfce3){_0x2f6165=_0x2f6165-0x0;var _0x1ab548=_0x55e6[_0x2f6165];return _0x1ab548;};'use strict';var _=require(_0x655e('0x0'));var util=require(_0x655e('0x1'));var moment=require(_0x655e('0x2'));var BPromise=require('bluebird');var rs=require(_0x655e('0x3'));var fs=require('fs');var Redis=require(_0x655e('0x4'));var db=require(_0x655e('0x5'))['db'];var utils=require(_0x655e('0x6'));var logger=require(_0x655e('0x7'))(_0x655e('0x8'));var config=require(_0x655e('0x9'));var jayson=require(_0x655e('0xa'));var client=jayson[_0x655e('0xb')][_0x655e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7ee7fd,_0x45d2b1,_0xc574a4){return new BPromise(function(_0x39ba59,_0x52ed03){return client[_0x655e('0xd')](_0x7ee7fd,_0xc574a4)[_0x655e('0xe')](function(_0x3f3bc5){logger[_0x655e('0xf')](_0x655e('0x10'),_0x45d2b1,_0x655e('0x11'));logger['debug'](_0x655e('0x12'),_0x45d2b1,_0x655e('0x11'),JSON[_0x655e('0x13')](_0x3f3bc5));if(_0x3f3bc5['error']){if(_0x3f3bc5['error'][_0x655e('0x14')]===0x1f4){logger[_0x655e('0x15')](_0x655e('0x10'),_0x45d2b1,_0x3f3bc5[_0x655e('0x15')][_0x655e('0x16')]);return _0x52ed03(_0x3f3bc5[_0x655e('0x15')][_0x655e('0x16')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x45d2b1,_0x3f3bc5[_0x655e('0x15')]['message']);return _0x39ba59(_0x3f3bc5[_0x655e('0x15')]['message']);}else{logger[_0x655e('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x45d2b1,_0x655e('0x11'));_0x39ba59(_0x3f3bc5['result'][_0x655e('0x16')]);}})[_0x655e('0x17')](function(_0x2a9376){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x45d2b1,_0x2a9376);_0x52ed03(_0x2a9376);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 0784905..8fcbf20 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 _0xc7ca=['show','post','create','put','update','delete','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xc7ca,0x1ec));var _0xac7c=function(_0x4470d2,_0x38cff8){_0x4470d2=_0x4470d2-0x0;var _0x5b06c9=_0xc7ca[_0x4470d2];return _0x5b06c9;};'use strict';var multer=require(_0xac7c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xac7c('0x1'));var express=require(_0xac7c('0x2'));var router=express['Router']();var fs_extra=require(_0xac7c('0x3'));var auth=require(_0xac7c('0x4'));var interaction=require(_0xac7c('0x5'));var config=require(_0xac7c('0x6'));var controller=require(_0xac7c('0x7'));router[_0xac7c('0x8')]('/',auth[_0xac7c('0x9')](),controller[_0xac7c('0xa')]);router[_0xac7c('0x8')](_0xac7c('0xb'),auth[_0xac7c('0x9')](),controller[_0xac7c('0xc')]);router[_0xac7c('0xd')]('/',auth[_0xac7c('0x9')](),controller[_0xac7c('0xe')]);router[_0xac7c('0xf')](_0xac7c('0xb'),auth[_0xac7c('0x9')](),controller[_0xac7c('0x10')]);router[_0xac7c('0x11')]('/:id',auth[_0xac7c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb897=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer'];(function(_0xf50ef1,_0x181c47){var _0x52a06b=function(_0x57df28){while(--_0x57df28){_0xf50ef1['push'](_0xf50ef1['shift']());}};_0x52a06b(++_0x181c47);}(_0xb897,0x98));var _0x7b89=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb897[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x7b89('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7b89('0x1'));var express=require(_0x7b89('0x2'));var router=express[_0x7b89('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7b89('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7b89('0x5'));var controller=require(_0x7b89('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b89('0x7')]);router['get'](_0x7b89('0x8'),auth[_0x7b89('0x9')](),controller[_0x7b89('0xa')]);router[_0x7b89('0xb')]('/',auth[_0x7b89('0x9')](),controller[_0x7b89('0xc')]);router[_0x7b89('0xd')](_0x7b89('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x7b89('0xe')](_0x7b89('0x8'),auth[_0x7b89('0x9')](),controller[_0x7b89('0xf')]);module[_0x7b89('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ed01b04..598927d 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 _0x9903=['keyValue','STRING','customVariable','BOOLEAN','exports','ENUM','string','variable'];(function(_0x19d509,_0x3be46f){var _0x3379d5=function(_0x111dd5){while(--_0x111dd5){_0x19d509['push'](_0x19d509['shift']());}};_0x3379d5(++_0x3be46f);}(_0x9903,0x174));var _0x3990=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9903[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3990('0x0')]={'type':{'type':Sequelize[_0x3990('0x1')](_0x3990('0x2'),_0x3990('0x3'),'customVariable',_0x3990('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3990('0x5')]},'key':{'type':Sequelize[_0x3990('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x3990('0x2'),'variable',_0x3990('0x6'))},'keyContent':{'type':Sequelize[_0x3990('0x5')]},'idField':{'type':Sequelize[_0x3990('0x5')]},'nameField':{'type':Sequelize[_0x3990('0x5')]},'customField':{'type':Sequelize[_0x3990('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3990('0x5')]}}; \ No newline at end of file +var _0xe5c9=['picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x517ad3,_0x6181f5){var _0x4dbff4=function(_0x10f378){while(--_0x10f378){_0x517ad3['push'](_0x517ad3['shift']());}};_0x4dbff4(++_0x6181f5);}(_0xe5c9,0x9a));var _0x9e5c=function(_0x3cd21f,_0x201261){_0x3cd21f=_0x3cd21f-0x0;var _0x50d4fd=_0xe5c9[_0x3cd21f];return _0x50d4fd;};'use strict';var Sequelize=require(_0x9e5c('0x0'));module[_0x9e5c('0x1')]={'type':{'type':Sequelize[_0x9e5c('0x2')](_0x9e5c('0x3'),'variable',_0x9e5c('0x4'),_0x9e5c('0x5'),_0x9e5c('0x6')),'defaultValue':_0x9e5c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9e5c('0x7')]},'keyType':{'type':Sequelize[_0x9e5c('0x2')](_0x9e5c('0x3'),_0x9e5c('0x8'),_0x9e5c('0x4'))},'keyContent':{'type':Sequelize[_0x9e5c('0x7')]},'idField':{'type':Sequelize[_0x9e5c('0x7')]},'nameField':{'type':Sequelize[_0x9e5c('0x7')]},'customField':{'type':Sequelize[_0x9e5c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9e5c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index f5d88d3..5feb430 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 _0x08f4=['fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','find','create','body','catch','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x1dd8ab,_0x3747ad){var _0x5852f7=function(_0x4ca04e){while(--_0x4ca04e){_0x1dd8ab['push'](_0x1dd8ab['shift']());}};_0x5852f7(++_0x3747ad);}(_0x08f4,0x187));var _0x408f=function(_0xf69fc9,_0x2a4b7d){_0xf69fc9=_0xf69fc9-0x0;var _0x588691=_0x08f4[_0xf69fc9];return _0x588691;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x408f('0x0'));var zipdir=require(_0x408f('0x1'));var jsonpatch=require(_0x408f('0x2'));var rp=require(_0x408f('0x3'));var moment=require(_0x408f('0x4'));var BPromise=require(_0x408f('0x5'));var Mustache=require(_0x408f('0x6'));var util=require(_0x408f('0x7'));var path=require(_0x408f('0x8'));var sox=require('sox');var csv=require(_0x408f('0x9'));var ejs=require(_0x408f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x408f('0xb'));var crypto=require(_0x408f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x408f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x408f('0xe'));var Papa=require('papaparse');var Redis=require(_0x408f('0xf'));var authService=require(_0x408f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x408f('0x11'));var hardwareService=require(_0x408f('0x12'));var logger=require(_0x408f('0x13'))(_0x408f('0x14'));var utils=require('../../config/utils');var config=require(_0x408f('0x15'));var licenseUtil=require(_0x408f('0x16'));var db=require(_0x408f('0x17'))['db'];function respondWithStatusCode(_0x1019e1,_0x2cd389){_0x2cd389=_0x2cd389||0xcc;return function(_0x34ab12){if(_0x34ab12){return _0x1019e1[_0x408f('0x18')](_0x2cd389);}return _0x1019e1[_0x408f('0x19')](_0x2cd389)[_0x408f('0x1a')]();};}function respondWithResult(_0x22f298,_0xc85a00){_0xc85a00=_0xc85a00||0xc8;return function(_0xa8749b){if(_0xa8749b){return _0x22f298[_0x408f('0x19')](_0xc85a00)[_0x408f('0x1b')](_0xa8749b);}};}function respondWithFilteredResult(_0x227fd7,_0x5f241f){return function(_0x3d6386){if(_0x3d6386){var _0x18b8c7=typeof _0x5f241f[_0x408f('0x1c')]===_0x408f('0x1d')&&typeof _0x5f241f[_0x408f('0x1e')]===_0x408f('0x1d');var _0x51843f=_0x3d6386[_0x408f('0x1f')];var _0x130896=_0x18b8c7?0x0:_0x5f241f['offset'];var _0x48cb30=_0x18b8c7?_0x3d6386['count']:_0x5f241f[_0x408f('0x1c')]+_0x5f241f[_0x408f('0x1e')];var _0x195619;if(_0x48cb30>=_0x51843f){_0x48cb30=_0x51843f;_0x195619=0xc8;}else{_0x195619=0xce;}_0x227fd7['status'](_0x195619);return _0x227fd7[_0x408f('0x20')](_0x408f('0x21'),_0x130896+'-'+_0x48cb30+'/'+_0x51843f)[_0x408f('0x1b')](_0x3d6386);}return null;};}function patchUpdates(_0x35081c){return function(_0x50953a){try{jsonpatch[_0x408f('0x22')](_0x50953a,_0x35081c,!![]);}catch(_0x845a45){return BPromise[_0x408f('0x23')](_0x845a45);}return _0x50953a['save']();};}function saveUpdates(_0x301e4c,_0x4b4cca){return function(_0x3933f1){if(_0x3933f1){return _0x3933f1[_0x408f('0x24')](_0x301e4c)[_0x408f('0x25')](function(_0xa7a61){return _0xa7a61;});}return null;};}function removeEntity(_0x331bb4,_0x217ea5){return function(_0x294145){if(_0x294145){return _0x294145['destroy']()[_0x408f('0x25')](function(){_0x331bb4[_0x408f('0x19')](0xcc)[_0x408f('0x1a')]();});}};}function handleEntityNotFound(_0x43437f,_0x46cd8e){return function(_0x2ff130){if(!_0x2ff130){_0x43437f[_0x408f('0x18')](0x194);}return _0x2ff130;};}function handleError(_0x2b0ef7,_0x11b947){_0x11b947=_0x11b947||0x1f4;return function(_0x25cf6f){logger[_0x408f('0x26')](_0x25cf6f[_0x408f('0x27')]);if(_0x25cf6f[_0x408f('0x28')]){delete _0x25cf6f['name'];}_0x2b0ef7[_0x408f('0x19')](_0x11b947)['send'](_0x25cf6f);};}exports[_0x408f('0x29')]=function(_0x4c1da4,_0x4c9e94){var _0x49d3b5={},_0x249598={},_0x35521a={'count':0x0,'rows':[]};var _0x2d2374=_[_0x408f('0x2a')](db[_0x408f('0x2b')][_0x408f('0x2c')],function(_0x5bf5a4){return{'name':_0x5bf5a4[_0x408f('0x2d')],'type':_0x5bf5a4[_0x408f('0x2e')][_0x408f('0x2f')]};});_0x249598[_0x408f('0x30')]=_[_0x408f('0x2a')](_0x2d2374,_0x408f('0x28'));_0x249598['query']=_[_0x408f('0x31')](_0x4c1da4[_0x408f('0x32')]);_0x249598[_0x408f('0x33')]=_['intersection'](_0x249598[_0x408f('0x30')],_0x249598[_0x408f('0x32')]);_0x49d3b5['attributes']=_[_0x408f('0x34')](_0x249598[_0x408f('0x30')],qs[_0x408f('0x35')](_0x4c1da4['query'][_0x408f('0x35')]));_0x49d3b5[_0x408f('0x36')]=_0x49d3b5[_0x408f('0x36')][_0x408f('0x37')]?_0x49d3b5[_0x408f('0x36')]:_0x249598[_0x408f('0x30')];if(!_0x4c1da4['query'][_0x408f('0x38')]('nolimit')){_0x49d3b5[_0x408f('0x1e')]=qs[_0x408f('0x1e')](_0x4c1da4[_0x408f('0x32')]['limit']);_0x49d3b5[_0x408f('0x1c')]=qs['offset'](_0x4c1da4[_0x408f('0x32')][_0x408f('0x1c')]);}_0x49d3b5[_0x408f('0x39')]=qs[_0x408f('0x3a')](_0x4c1da4['query']['sort']);_0x49d3b5[_0x408f('0x3b')]=qs[_0x408f('0x33')](_[_0x408f('0x3c')](_0x4c1da4[_0x408f('0x32')],_0x249598[_0x408f('0x33')]),_0x2d2374);if(_0x4c1da4[_0x408f('0x32')]['filter']){_0x49d3b5[_0x408f('0x3b')]=_[_0x408f('0x3d')](_0x49d3b5[_0x408f('0x3b')],{'$or':_[_0x408f('0x2a')](_0x2d2374,function(_0x145b8c){if(_0x145b8c[_0x408f('0x2e')]!==_0x408f('0x3e')){var _0x514c8d={};_0x514c8d[_0x145b8c[_0x408f('0x28')]]={'$like':'%'+_0x4c1da4[_0x408f('0x32')][_0x408f('0x3f')]+'%'};return _0x514c8d;}})});}_0x49d3b5=_['merge']({},_0x49d3b5,_0x4c1da4[_0x408f('0x40')]);var _0x37c1a1={'where':_0x49d3b5[_0x408f('0x3b')]};return db['Dynamics365Field'][_0x408f('0x1f')](_0x37c1a1)[_0x408f('0x25')](function(_0x29c7cc){_0x35521a[_0x408f('0x1f')]=_0x29c7cc;if(_0x4c1da4[_0x408f('0x32')][_0x408f('0x41')]){_0x49d3b5[_0x408f('0x42')]=[{'all':!![]}];}return db[_0x408f('0x2b')][_0x408f('0x43')](_0x49d3b5);})[_0x408f('0x25')](function(_0x387dcf){_0x35521a[_0x408f('0x44')]=_0x387dcf;return _0x35521a;})[_0x408f('0x25')](respondWithFilteredResult(_0x4c9e94,_0x49d3b5))['catch'](handleError(_0x4c9e94,null));};exports['show']=function(_0x59ec74,_0x1f37b0){var _0x166c68={'raw':!![],'where':{'id':_0x59ec74['params']['id']}},_0x3ee9ac={};_0x3ee9ac['model']=_['keys'](db['Dynamics365Field'][_0x408f('0x2c')]);_0x3ee9ac['query']=_[_0x408f('0x31')](_0x59ec74[_0x408f('0x32')]);_0x3ee9ac['filters']=_[_0x408f('0x34')](_0x3ee9ac['model'],_0x3ee9ac[_0x408f('0x32')]);_0x166c68[_0x408f('0x36')]=_[_0x408f('0x34')](_0x3ee9ac[_0x408f('0x30')],qs[_0x408f('0x35')](_0x59ec74[_0x408f('0x32')]['fields']));_0x166c68[_0x408f('0x36')]=_0x166c68[_0x408f('0x36')]['length']?_0x166c68['attributes']:_0x3ee9ac[_0x408f('0x30')];if(_0x59ec74[_0x408f('0x32')][_0x408f('0x41')]){_0x166c68[_0x408f('0x42')]=[{'all':!![]}];}_0x166c68=_[_0x408f('0x3d')]({},_0x166c68,_0x59ec74['options']);return db['Dynamics365Field'][_0x408f('0x45')](_0x166c68)[_0x408f('0x25')](handleEntityNotFound(_0x1f37b0,null))[_0x408f('0x25')](respondWithResult(_0x1f37b0,null))['catch'](handleError(_0x1f37b0,null));};exports[_0x408f('0x46')]=function(_0x37751f,_0xac9265){return db[_0x408f('0x2b')][_0x408f('0x46')](_0x37751f[_0x408f('0x47')],{})[_0x408f('0x25')](respondWithResult(_0xac9265,0xc9))[_0x408f('0x48')](handleError(_0xac9265,null));};exports['update']=function(_0xd180a1,_0x26e41b){if(_0xd180a1['body']['id']){delete _0xd180a1[_0x408f('0x47')]['id'];}return db[_0x408f('0x2b')][_0x408f('0x45')]({'where':{'id':_0xd180a1[_0x408f('0x49')]['id']}})[_0x408f('0x25')](handleEntityNotFound(_0x26e41b,null))['then'](saveUpdates(_0xd180a1['body'],null))[_0x408f('0x25')](respondWithResult(_0x26e41b,null))[_0x408f('0x48')](handleError(_0x26e41b,null));};exports['destroy']=function(_0x2c6ea8,_0x10ef9a){return db[_0x408f('0x2b')][_0x408f('0x45')]({'where':{'id':_0x2c6ea8['params']['id']}})[_0x408f('0x25')](handleEntityNotFound(_0x10ef9a,null))[_0x408f('0x25')](removeEntity(_0x10ef9a,null))[_0x408f('0x48')](handleError(_0x10ef9a,null));}; \ No newline at end of file +var _0x0285=['filters','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','include','findAll','catch','show','find','create','body','destroy','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','error','stack','name','send','map','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x10773a,_0x12abf1){var _0x20731f=function(_0x561fdb){while(--_0x561fdb){_0x10773a['push'](_0x10773a['shift']());}};_0x20731f(++_0x12abf1);}(_0x0285,0x1e6));var _0x5028=function(_0x4c0d2b,_0x2ff906){_0x4c0d2b=_0x4c0d2b-0x0;var _0x58c4fe=_0x0285[_0x4c0d2b];return _0x58c4fe;};'use strict';var emlformat=require(_0x5028('0x0'));var rimraf=require(_0x5028('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5028('0x2'));var rp=require(_0x5028('0x3'));var moment=require(_0x5028('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5028('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5028('0x6'));var csv=require(_0x5028('0x7'));var ejs=require(_0x5028('0x8'));var fs=require('fs');var fs_extra=require(_0x5028('0x9'));var _=require(_0x5028('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5028('0xb'));var toCsv=require(_0x5028('0x7'));var querystring=require(_0x5028('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5028('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5028('0xe'));var logger=require(_0x5028('0xf'))('api');var utils=require(_0x5028('0x10'));var config=require(_0x5028('0x11'));var licenseUtil=require(_0x5028('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4af926,_0x483891){_0x483891=_0x483891||0xcc;return function(_0x2c94e8){if(_0x2c94e8){return _0x4af926[_0x5028('0x13')](_0x483891);}return _0x4af926[_0x5028('0x14')](_0x483891)[_0x5028('0x15')]();};}function respondWithResult(_0x4cb21f,_0x4437c6){_0x4437c6=_0x4437c6||0xc8;return function(_0x478969){if(_0x478969){return _0x4cb21f[_0x5028('0x14')](_0x4437c6)['json'](_0x478969);}};}function respondWithFilteredResult(_0x3d6772,_0x32ee70){return function(_0x3a19ff){if(_0x3a19ff){var _0xdae385=typeof _0x32ee70[_0x5028('0x16')]===_0x5028('0x17')&&typeof _0x32ee70[_0x5028('0x18')]===_0x5028('0x17');var _0x37e44b=_0x3a19ff[_0x5028('0x19')];var _0x159fed=_0xdae385?0x0:_0x32ee70[_0x5028('0x16')];var _0x4d0970=_0xdae385?_0x3a19ff['count']:_0x32ee70[_0x5028('0x16')]+_0x32ee70[_0x5028('0x18')];var _0x54de0a;if(_0x4d0970>=_0x37e44b){_0x4d0970=_0x37e44b;_0x54de0a=0xc8;}else{_0x54de0a=0xce;}_0x3d6772[_0x5028('0x14')](_0x54de0a);return _0x3d6772['set'](_0x5028('0x1a'),_0x159fed+'-'+_0x4d0970+'/'+_0x37e44b)[_0x5028('0x1b')](_0x3a19ff);}return null;};}function patchUpdates(_0x35fd1a){return function(_0x4175d6){try{jsonpatch['apply'](_0x4175d6,_0x35fd1a,!![]);}catch(_0x38cd70){return BPromise[_0x5028('0x1c')](_0x38cd70);}return _0x4175d6[_0x5028('0x1d')]();};}function saveUpdates(_0x7cc96f,_0x34cfea){return function(_0x55912e){if(_0x55912e){return _0x55912e[_0x5028('0x1e')](_0x7cc96f)[_0x5028('0x1f')](function(_0x3fcd1e){return _0x3fcd1e;});}return null;};}function removeEntity(_0x30c57f,_0x58a202){return function(_0x43e156){if(_0x43e156){return _0x43e156['destroy']()[_0x5028('0x1f')](function(){_0x30c57f['status'](0xcc)[_0x5028('0x15')]();});}};}function handleEntityNotFound(_0x5c4fd9,_0x4deb0d){return function(_0x9e8ff7){if(!_0x9e8ff7){_0x5c4fd9[_0x5028('0x13')](0x194);}return _0x9e8ff7;};}function handleError(_0x1ce540,_0x3e4d1c){_0x3e4d1c=_0x3e4d1c||0x1f4;return function(_0x4eb775){logger[_0x5028('0x20')](_0x4eb775[_0x5028('0x21')]);if(_0x4eb775[_0x5028('0x22')]){delete _0x4eb775['name'];}_0x1ce540[_0x5028('0x14')](_0x3e4d1c)[_0x5028('0x23')](_0x4eb775);};}exports['index']=function(_0x18eb2c,_0x85321c){var _0x106b88={},_0x3b63e3={},_0x5608c4={'count':0x0,'rows':[]};var _0x379010=_[_0x5028('0x24')](db['Dynamics365Field']['rawAttributes'],function(_0x4d12ef){return{'name':_0x4d12ef[_0x5028('0x25')],'type':_0x4d12ef['type'][_0x5028('0x26')]};});_0x3b63e3[_0x5028('0x27')]=_[_0x5028('0x24')](_0x379010,_0x5028('0x22'));_0x3b63e3[_0x5028('0x28')]=_[_0x5028('0x29')](_0x18eb2c['query']);_0x3b63e3['filters']=_[_0x5028('0x2a')](_0x3b63e3[_0x5028('0x27')],_0x3b63e3[_0x5028('0x28')]);_0x106b88['attributes']=_[_0x5028('0x2a')](_0x3b63e3[_0x5028('0x27')],qs[_0x5028('0x2b')](_0x18eb2c[_0x5028('0x28')]['fields']));_0x106b88[_0x5028('0x2c')]=_0x106b88[_0x5028('0x2c')][_0x5028('0x2d')]?_0x106b88[_0x5028('0x2c')]:_0x3b63e3[_0x5028('0x27')];if(!_0x18eb2c[_0x5028('0x28')][_0x5028('0x2e')]('nolimit')){_0x106b88['limit']=qs['limit'](_0x18eb2c[_0x5028('0x28')][_0x5028('0x18')]);_0x106b88['offset']=qs[_0x5028('0x16')](_0x18eb2c[_0x5028('0x28')][_0x5028('0x16')]);}_0x106b88[_0x5028('0x2f')]=qs['sort'](_0x18eb2c['query'][_0x5028('0x30')]);_0x106b88[_0x5028('0x31')]=qs[_0x5028('0x32')](_[_0x5028('0x33')](_0x18eb2c[_0x5028('0x28')],_0x3b63e3['filters']),_0x379010);if(_0x18eb2c[_0x5028('0x28')][_0x5028('0x34')]){_0x106b88[_0x5028('0x31')]=_[_0x5028('0x35')](_0x106b88['where'],{'$or':_[_0x5028('0x24')](_0x379010,function(_0x3e8d7e){if(_0x3e8d7e['type']!==_0x5028('0x36')){var _0x2c1233={};_0x2c1233[_0x3e8d7e[_0x5028('0x22')]]={'$like':'%'+_0x18eb2c[_0x5028('0x28')]['filter']+'%'};return _0x2c1233;}})});}_0x106b88=_[_0x5028('0x35')]({},_0x106b88,_0x18eb2c[_0x5028('0x37')]);var _0x3fef14={'where':_0x106b88[_0x5028('0x31')]};return db[_0x5028('0x38')]['count'](_0x3fef14)[_0x5028('0x1f')](function(_0xa59f97){_0x5608c4['count']=_0xa59f97;if(_0x18eb2c[_0x5028('0x28')][_0x5028('0x39')]){_0x106b88[_0x5028('0x3a')]=[{'all':!![]}];}return db[_0x5028('0x38')][_0x5028('0x3b')](_0x106b88);})[_0x5028('0x1f')](function(_0x369fbe){_0x5608c4['rows']=_0x369fbe;return _0x5608c4;})[_0x5028('0x1f')](respondWithFilteredResult(_0x85321c,_0x106b88))[_0x5028('0x3c')](handleError(_0x85321c,null));};exports[_0x5028('0x3d')]=function(_0x360a18,_0x58e801){var _0x50df6e={'raw':!![],'where':{'id':_0x360a18['params']['id']}},_0xf5c4de={};_0xf5c4de[_0x5028('0x27')]=_[_0x5028('0x29')](db[_0x5028('0x38')]['rawAttributes']);_0xf5c4de[_0x5028('0x28')]=_[_0x5028('0x29')](_0x360a18[_0x5028('0x28')]);_0xf5c4de[_0x5028('0x32')]=_[_0x5028('0x2a')](_0xf5c4de[_0x5028('0x27')],_0xf5c4de['query']);_0x50df6e[_0x5028('0x2c')]=_[_0x5028('0x2a')](_0xf5c4de[_0x5028('0x27')],qs['fields'](_0x360a18[_0x5028('0x28')][_0x5028('0x2b')]));_0x50df6e['attributes']=_0x50df6e[_0x5028('0x2c')][_0x5028('0x2d')]?_0x50df6e[_0x5028('0x2c')]:_0xf5c4de[_0x5028('0x27')];if(_0x360a18[_0x5028('0x28')][_0x5028('0x39')]){_0x50df6e[_0x5028('0x3a')]=[{'all':!![]}];}_0x50df6e=_[_0x5028('0x35')]({},_0x50df6e,_0x360a18[_0x5028('0x37')]);return db[_0x5028('0x38')][_0x5028('0x3e')](_0x50df6e)[_0x5028('0x1f')](handleEntityNotFound(_0x58e801,null))[_0x5028('0x1f')](respondWithResult(_0x58e801,null))['catch'](handleError(_0x58e801,null));};exports['create']=function(_0x5e09fc,_0x50a151){return db[_0x5028('0x38')][_0x5028('0x3f')](_0x5e09fc[_0x5028('0x40')],{})[_0x5028('0x1f')](respondWithResult(_0x50a151,0xc9))[_0x5028('0x3c')](handleError(_0x50a151,null));};exports[_0x5028('0x1e')]=function(_0x4b804c,_0x531522){if(_0x4b804c['body']['id']){delete _0x4b804c['body']['id'];}return db[_0x5028('0x38')][_0x5028('0x3e')]({'where':{'id':_0x4b804c['params']['id']}})[_0x5028('0x1f')](handleEntityNotFound(_0x531522,null))[_0x5028('0x1f')](saveUpdates(_0x4b804c[_0x5028('0x40')],null))[_0x5028('0x1f')](respondWithResult(_0x531522,null))[_0x5028('0x3c')](handleError(_0x531522,null));};exports[_0x5028('0x41')]=function(_0x412959,_0x484084){return db[_0x5028('0x38')][_0x5028('0x3e')]({'where':{'id':_0x412959[_0x5028('0x42')]['id']}})[_0x5028('0x1f')](handleEntityNotFound(_0x484084,null))['then'](removeEntity(_0x484084,null))[_0x5028('0x3c')](handleError(_0x484084,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 4ac0e85..97f75e5 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 _0x8275=['idField','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','dynamics365_unique_index'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x8275,0x15d));var _0x5827=function(_0x10a2ae,_0x17a308){_0x10a2ae=_0x10a2ae-0x0;var _0x428ee7=_0x8275[_0x10a2ae];return _0x428ee7;};'use strict';var _=require(_0x5827('0x0'));var util=require('util');var logger=require(_0x5827('0x1'))(_0x5827('0x2'));var moment=require('moment');var BPromise=require(_0x5827('0x3'));var rp=require(_0x5827('0x4'));var fs=require('fs');var path=require(_0x5827('0x5'));var rimraf=require('rimraf');var config=require(_0x5827('0x6'));var attributes=require(_0x5827('0x7'));module[_0x5827('0x8')]=function(_0x294b90,_0x5727cc){return _0x294b90['define'](_0x5827('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x5827('0xa'),'fields':[_0x5827('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2274=['exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x490441,_0x38a1c3){var _0x4e459d=function(_0x2b72a4){while(--_0x2b72a4){_0x490441['push'](_0x490441['shift']());}};_0x4e459d(++_0x38a1c3);}(_0x2274,0x164));var _0x4227=function(_0x1cb519,_0x40249b){_0x1cb519=_0x1cb519-0x0;var _0x3a453b=_0x2274[_0x1cb519];return _0x3a453b;};'use strict';var _=require(_0x4227('0x0'));var util=require(_0x4227('0x1'));var logger=require(_0x4227('0x2'))(_0x4227('0x3'));var moment=require(_0x4227('0x4'));var BPromise=require(_0x4227('0x5'));var rp=require(_0x4227('0x6'));var fs=require('fs');var path=require(_0x4227('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x4227('0x8')]=function(_0x27fabf,_0x2f6e0f){return _0x27fabf[_0x4227('0x9')](_0x4227('0xa'),attributes,{'tableName':_0x4227('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x4227('0xc'),_0x4227('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index c420c55..0fc9096 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 _0x1cfa=['then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x15cf93,_0x5b1029){var _0x2afb0a=function(_0x5413ed){while(--_0x5413ed){_0x15cf93['push'](_0x15cf93['shift']());}};_0x2afb0a(++_0x5b1029);}(_0x1cfa,0xfb));var _0xa1cf=function(_0x3b1a32,_0x5d92b4){_0x3b1a32=_0x3b1a32-0x0;var _0x24f36a=_0x1cfa[_0x3b1a32];return _0x24f36a;};'use strict';var _=require(_0xa1cf('0x0'));var util=require(_0xa1cf('0x1'));var moment=require(_0xa1cf('0x2'));var BPromise=require(_0xa1cf('0x3'));var rs=require(_0xa1cf('0x4'));var fs=require('fs');var Redis=require(_0xa1cf('0x5'));var db=require(_0xa1cf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1cf('0x7'))(_0xa1cf('0x8'));var config=require(_0xa1cf('0x9'));var jayson=require(_0xa1cf('0xa'));var client=jayson['client'][_0xa1cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48f220,_0x3ad9a1,_0x2eb686){return new BPromise(function(_0x25b1b2,_0x54eb62){return client[_0xa1cf('0xc')](_0x48f220,_0x2eb686)[_0xa1cf('0xd')](function(_0x3c17ed){logger[_0xa1cf('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3ad9a1,_0xa1cf('0xf'));logger[_0xa1cf('0x10')](_0xa1cf('0x11'),_0x3ad9a1,_0xa1cf('0xf'),JSON[_0xa1cf('0x12')](_0x3c17ed));if(_0x3c17ed[_0xa1cf('0x13')]){if(_0x3c17ed['error'][_0xa1cf('0x14')]===0x1f4){logger[_0xa1cf('0x13')](_0xa1cf('0x15'),_0x3ad9a1,_0x3c17ed['error'][_0xa1cf('0x16')]);return _0x54eb62(_0x3c17ed[_0xa1cf('0x13')][_0xa1cf('0x16')]);}logger[_0xa1cf('0x13')](_0xa1cf('0x15'),_0x3ad9a1,_0x3c17ed['error'][_0xa1cf('0x16')]);return _0x25b1b2(_0x3c17ed[_0xa1cf('0x13')][_0xa1cf('0x16')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x3ad9a1,'request\x20sent');_0x25b1b2(_0x3c17ed['result']['message']);}})[_0xa1cf('0x17')](function(_0x4c81d5){logger['error'](_0xa1cf('0x15'),_0x3ad9a1,_0x4c81d5);_0x54eb62(_0x4c81d5);});});} \ No newline at end of file +var _0x8f32=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x8f32,0x76));var _0x28f3=function(_0x3a1261,_0x12c1e3){_0x3a1261=_0x3a1261-0x0;var _0x562186=_0x8f32[_0x3a1261];return _0x562186;};'use strict';var _=require(_0x28f3('0x0'));var util=require(_0x28f3('0x1'));var moment=require('moment');var BPromise=require(_0x28f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28f3('0x3'));var db=require(_0x28f3('0x4'))['db'];var utils=require(_0x28f3('0x5'));var logger=require(_0x28f3('0x6'))(_0x28f3('0x7'));var config=require(_0x28f3('0x8'));var jayson=require(_0x28f3('0x9'));var client=jayson[_0x28f3('0xa')][_0x28f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d9d43,_0x45fb47,_0x3381ce){return new BPromise(function(_0x5ae7ca,_0xdbde7f){return client[_0x28f3('0xc')](_0x2d9d43,_0x3381ce)[_0x28f3('0xd')](function(_0x4ab156){logger[_0x28f3('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x45fb47,_0x28f3('0xf'));logger['debug'](_0x28f3('0x10'),_0x45fb47,_0x28f3('0xf'),JSON[_0x28f3('0x11')](_0x4ab156));if(_0x4ab156['error']){if(_0x4ab156[_0x28f3('0x12')]['code']===0x1f4){logger['error'](_0x28f3('0x13'),_0x45fb47,_0x4ab156['error'][_0x28f3('0x14')]);return _0xdbde7f(_0x4ab156['error'][_0x28f3('0x14')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x45fb47,_0x4ab156[_0x28f3('0x12')][_0x28f3('0x14')]);return _0x5ae7ca(_0x4ab156[_0x28f3('0x12')][_0x28f3('0x14')]);}else{logger[_0x28f3('0xe')](_0x28f3('0x13'),_0x45fb47,_0x28f3('0xf'));_0x5ae7ca(_0x4ab156[_0x28f3('0x15')]['message']);}})[_0x28f3('0x16')](function(_0x295bb6){logger[_0x28f3('0x12')](_0x28f3('0x13'),_0x45fb47,_0x295bb6);_0xdbde7f(_0x295bb6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ff7e852..a042049 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 _0x9c3e=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0x378a49,_0x44ce2d){var _0x11615f=function(_0x4e8c61){while(--_0x4e8c61){_0x378a49['push'](_0x378a49['shift']());}};_0x11615f(++_0x44ce2d);}(_0x9c3e,0x6c));var _0xe9c3=function(_0x22c226,_0xe47ec7){_0x22c226=_0x22c226-0x0;var _0x48e1aa=_0x9c3e[_0x22c226];return _0x48e1aa;};'use strict';var multer=require(_0xe9c3('0x0'));var util=require(_0xe9c3('0x1'));var path=require(_0xe9c3('0x2'));var timeout=require(_0xe9c3('0x3'));var express=require(_0xe9c3('0x4'));var router=express[_0xe9c3('0x5')]();var fs_extra=require(_0xe9c3('0x6'));var auth=require(_0xe9c3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe9c3('0x8'));var controller=require(_0xe9c3('0x9'));router[_0xe9c3('0xa')]('/',auth[_0xe9c3('0xb')](),controller[_0xe9c3('0xc')]);router[_0xe9c3('0xa')](_0xe9c3('0xd'),auth['isAuthenticated'](),controller[_0xe9c3('0xe')]);router[_0xe9c3('0xa')](_0xe9c3('0xf'),auth[_0xe9c3('0xb')](),controller[_0xe9c3('0x10')]);router['get'](_0xe9c3('0x11'),auth['isAuthenticated'](),controller[_0xe9c3('0x12')]);router[_0xe9c3('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xe9c3('0x14')]);router[_0xe9c3('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xe9c3('0x16')]);router[_0xe9c3('0x17')](_0xe9c3('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4317=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id/configurations','getConfigurations','post','create','addConfiguration','put','/:id','update','delete','multer','util'];(function(_0x3c9b43,_0x716e3c){var _0x2776e7=function(_0x363edd){while(--_0x363edd){_0x3c9b43['push'](_0x3c9b43['shift']());}};_0x2776e7(++_0x716e3c);}(_0x4317,0x6c));var _0x7431=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4317[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x7431('0x0'));var util=require(_0x7431('0x1'));var path=require('path');var timeout=require(_0x7431('0x2'));var express=require(_0x7431('0x3'));var router=express[_0x7431('0x4')]();var fs_extra=require(_0x7431('0x5'));var auth=require(_0x7431('0x6'));var interaction=require(_0x7431('0x7'));var config=require(_0x7431('0x8'));var controller=require(_0x7431('0x9'));router['get']('/',auth[_0x7431('0xa')](),controller[_0x7431('0xb')]);router[_0x7431('0xc')]('/:id',auth[_0x7431('0xa')](),controller['show']);router['get'](_0x7431('0xd'),auth['isAuthenticated'](),controller[_0x7431('0xe')]);router['get']('/:id/fields',auth[_0x7431('0xa')](),controller['getFields']);router[_0x7431('0xf')]('/',auth[_0x7431('0xa')](),controller[_0x7431('0x10')]);router[_0x7431('0xf')](_0x7431('0xd'),auth[_0x7431('0xa')](),controller[_0x7431('0x11')]);router[_0x7431('0x12')](_0x7431('0x13'),auth[_0x7431('0xa')](),controller[_0x7431('0x14')]);router[_0x7431('0x15')](_0x7431('0x13'),auth[_0x7431('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index c8f2e6f..895942b 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 _0xaebd=['remoteUri','sequelize','STRING','username'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x433c79,_0x21331c){_0x433c79=_0x433c79-0x0;var _0xc781d2=_0xaebd[_0x433c79];return _0xc781d2;};'use strict';var Sequelize=require(_0xdaeb('0x0'));module['exports']={'name':{'type':Sequelize[_0xdaeb('0x1')]},'description':{'type':Sequelize[_0xdaeb('0x1')]},'username':{'type':Sequelize[_0xdaeb('0x1')],'unique':_0xdaeb('0x2')},'apiKey':{'type':Sequelize[_0xdaeb('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xdaeb('0x3')},'serverUrl':{'type':Sequelize[_0xdaeb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4325=['exports','STRING','username','remoteUri','sequelize'];(function(_0x41f122,_0x552a41){var _0x34c036=function(_0x23b35d){while(--_0x23b35d){_0x41f122['push'](_0x41f122['shift']());}};_0x34c036(++_0x552a41);}(_0x4325,0x1da));var _0x5432=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4325[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5432('0x2')]},'username':{'type':Sequelize[_0x5432('0x2')],'unique':_0x5432('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5432('0x4')},'serverUrl':{'type':Sequelize[_0x5432('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 e440a9d..b18fe03 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 _0x0efe=['find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','remoteUri','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','apiKey','toString','base64','requester','agent','priority','group','source','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','send','index','FreshdeskAccount','rawAttributes','type','key','map','name','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include'];(function(_0x408bb6,_0x51ec4a){var _0x830d87=function(_0x2a0ccd){while(--_0x2a0ccd){_0x408bb6['push'](_0x408bb6['shift']());}};_0x830d87(++_0x51ec4a);}(_0x0efe,0x110));var _0xe0ef=function(_0x53aa7d,_0x597ba8){_0x53aa7d=_0x53aa7d-0x0;var _0x3217d3=_0x0efe[_0x53aa7d];return _0x3217d3;};'use strict';var emlformat=require(_0xe0ef('0x0'));var rimraf=require(_0xe0ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0ef('0x2'));var rp=require(_0xe0ef('0x3'));var moment=require(_0xe0ef('0x4'));var BPromise=require(_0xe0ef('0x5'));var Mustache=require(_0xe0ef('0x6'));var util=require(_0xe0ef('0x7'));var path=require(_0xe0ef('0x8'));var sox=require(_0xe0ef('0x9'));var csv=require(_0xe0ef('0xa'));var ejs=require(_0xe0ef('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe0ef('0xc'));var crypto=require(_0xe0ef('0xd'));var jsforce=require(_0xe0ef('0xe'));var deskjs=require(_0xe0ef('0xf'));var toCsv=require(_0xe0ef('0xa'));var querystring=require(_0xe0ef('0x10'));var Papa=require(_0xe0ef('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe0ef('0x12'));var as=require(_0xe0ef('0x13'));var hardwareService=require(_0xe0ef('0x14'));var logger=require('../../config/logger')(_0xe0ef('0x15'));var utils=require(_0xe0ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe0ef('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe0ef('0x18'));function respondWithStatusCode(_0x90c232,_0x3cce82){_0x3cce82=_0x3cce82||0xcc;return function(_0x4fbb4d){if(_0x4fbb4d){return _0x90c232['sendStatus'](_0x3cce82);}return _0x90c232[_0xe0ef('0x19')](_0x3cce82)[_0xe0ef('0x1a')]();};}function respondWithResult(_0x1afbbc,_0x1fbfd0){_0x1fbfd0=_0x1fbfd0||0xc8;return function(_0x3576ba){if(_0x3576ba){return _0x1afbbc[_0xe0ef('0x19')](_0x1fbfd0)[_0xe0ef('0x1b')](_0x3576ba);}};}function respondWithFilteredResult(_0x1177d2,_0x5d845d){return function(_0x401f4a){if(_0x401f4a){var _0x134b4e=typeof _0x5d845d[_0xe0ef('0x1c')]===_0xe0ef('0x1d')&&typeof _0x5d845d[_0xe0ef('0x1e')]==='undefined';var _0x183d67=_0x401f4a[_0xe0ef('0x1f')];var _0x1d6ff4=_0x134b4e?0x0:_0x5d845d[_0xe0ef('0x1c')];var _0x2a2f6f=_0x134b4e?_0x401f4a[_0xe0ef('0x1f')]:_0x5d845d[_0xe0ef('0x1c')]+_0x5d845d[_0xe0ef('0x1e')];var _0x3e507c;if(_0x2a2f6f>=_0x183d67){_0x2a2f6f=_0x183d67;_0x3e507c=0xc8;}else{_0x3e507c=0xce;}_0x1177d2[_0xe0ef('0x19')](_0x3e507c);return _0x1177d2[_0xe0ef('0x20')](_0xe0ef('0x21'),_0x1d6ff4+'-'+_0x2a2f6f+'/'+_0x183d67)[_0xe0ef('0x1b')](_0x401f4a);}return null;};}function patchUpdates(_0x50c044){return function(_0x3d8b86){try{jsonpatch[_0xe0ef('0x22')](_0x3d8b86,_0x50c044,!![]);}catch(_0x457d67){return BPromise[_0xe0ef('0x23')](_0x457d67);}return _0x3d8b86['save']();};}function saveUpdates(_0x140f42,_0x115cb3){return function(_0x169667){if(_0x169667){return _0x169667[_0xe0ef('0x24')](_0x140f42)[_0xe0ef('0x25')](function(_0x1c8270){return _0x1c8270;});}return null;};}function removeEntity(_0x255b55,_0x59b64c){return function(_0x375ed7){if(_0x375ed7){return _0x375ed7[_0xe0ef('0x26')]()['then'](function(){_0x255b55[_0xe0ef('0x19')](0xcc)[_0xe0ef('0x1a')]();});}};}function handleEntityNotFound(_0x5bc53a,_0x576082){return function(_0x521a14){if(!_0x521a14){_0x5bc53a[_0xe0ef('0x27')](0x194);}return _0x521a14;};}function handleError(_0x4ee2c1,_0x3f4e80){_0x3f4e80=_0x3f4e80||0x1f4;return function(_0x1b40f5){logger[_0xe0ef('0x28')](_0x1b40f5['stack']);if(_0x1b40f5['name']){delete _0x1b40f5['name'];}_0x4ee2c1[_0xe0ef('0x19')](_0x3f4e80)[_0xe0ef('0x29')](_0x1b40f5);};}exports[_0xe0ef('0x2a')]=function(_0x31e576,_0x2d1674){var _0x2b0d3c={},_0x567460={},_0x568da7={'count':0x0,'rows':[]};var _0x3e5abd=_['map'](db[_0xe0ef('0x2b')][_0xe0ef('0x2c')],function(_0x51feca){return{'name':_0x51feca['fieldName'],'type':_0x51feca[_0xe0ef('0x2d')][_0xe0ef('0x2e')]};});_0x567460['model']=_[_0xe0ef('0x2f')](_0x3e5abd,_0xe0ef('0x30'));_0x567460[_0xe0ef('0x31')]=_['keys'](_0x31e576['query']);_0x567460['filters']=_[_0xe0ef('0x32')](_0x567460['model'],_0x567460[_0xe0ef('0x31')]);_0x2b0d3c[_0xe0ef('0x33')]=_['intersection'](_0x567460[_0xe0ef('0x34')],qs[_0xe0ef('0x35')](_0x31e576['query'][_0xe0ef('0x35')]));_0x2b0d3c[_0xe0ef('0x33')]=_0x2b0d3c[_0xe0ef('0x33')][_0xe0ef('0x36')]?_0x2b0d3c['attributes']:_0x567460[_0xe0ef('0x34')];if(!_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x37')](_0xe0ef('0x38'))){_0x2b0d3c['limit']=qs[_0xe0ef('0x1e')](_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x1e')]);_0x2b0d3c[_0xe0ef('0x1c')]=qs[_0xe0ef('0x1c')](_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x1c')]);}_0x2b0d3c[_0xe0ef('0x39')]=qs[_0xe0ef('0x3a')](_0x31e576['query'][_0xe0ef('0x3a')]);_0x2b0d3c[_0xe0ef('0x3b')]=qs[_0xe0ef('0x3c')](_[_0xe0ef('0x3d')](_0x31e576[_0xe0ef('0x31')],_0x567460[_0xe0ef('0x3c')]),_0x3e5abd);if(_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x3e')]){_0x2b0d3c[_0xe0ef('0x3b')]=_[_0xe0ef('0x3f')](_0x2b0d3c[_0xe0ef('0x3b')],{'$or':_[_0xe0ef('0x2f')](_0x3e5abd,function(_0x38243e){if(_0x38243e['type']!=='VIRTUAL'){var _0x1cde8f={};_0x1cde8f[_0x38243e[_0xe0ef('0x30')]]={'$like':'%'+_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x3e')]+'%'};return _0x1cde8f;}})});}_0x2b0d3c=_['merge']({},_0x2b0d3c,_0x31e576[_0xe0ef('0x40')]);var _0x398e41={'where':_0x2b0d3c['where']};return db[_0xe0ef('0x2b')]['count'](_0x398e41)['then'](function(_0x1c0f3f){_0x568da7[_0xe0ef('0x1f')]=_0x1c0f3f;if(_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x41')]){_0x2b0d3c['include']=[{'all':!![]}];}return db[_0xe0ef('0x2b')][_0xe0ef('0x42')](_0x2b0d3c);})['then'](function(_0x454c93){_0x568da7[_0xe0ef('0x43')]=_0x454c93;return _0x568da7;})[_0xe0ef('0x25')](respondWithFilteredResult(_0x2d1674,_0x2b0d3c))[_0xe0ef('0x44')](handleError(_0x2d1674,null));};exports[_0xe0ef('0x45')]=function(_0x1876b6,_0x1eecda){var _0xb25bc={'raw':![],'where':{'id':_0x1876b6[_0xe0ef('0x46')]['id']}},_0x39755b={};_0x39755b['model']=_[_0xe0ef('0x47')](db['FreshdeskAccount'][_0xe0ef('0x2c')]);_0x39755b['query']=_[_0xe0ef('0x47')](_0x1876b6[_0xe0ef('0x31')]);_0x39755b[_0xe0ef('0x3c')]=_['intersection'](_0x39755b['model'],_0x39755b[_0xe0ef('0x31')]);_0xb25bc['attributes']=_[_0xe0ef('0x32')](_0x39755b['model'],qs[_0xe0ef('0x35')](_0x1876b6[_0xe0ef('0x31')][_0xe0ef('0x35')]));_0xb25bc[_0xe0ef('0x33')]=_0xb25bc[_0xe0ef('0x33')][_0xe0ef('0x36')]?_0xb25bc[_0xe0ef('0x33')]:_0x39755b['model'];if(_0x1876b6[_0xe0ef('0x31')][_0xe0ef('0x41')]){_0xb25bc[_0xe0ef('0x48')]=[{'all':!![]}];}_0xb25bc=_['merge']({},_0xb25bc,_0x1876b6[_0xe0ef('0x40')]);return db[_0xe0ef('0x2b')][_0xe0ef('0x49')](_0xb25bc)['then'](handleEntityNotFound(_0x1eecda,null))[_0xe0ef('0x25')](respondWithResult(_0x1eecda,null))[_0xe0ef('0x44')](handleError(_0x1eecda,null));};exports[_0xe0ef('0x4a')]=function(_0x469173,_0x49b71b){return db[_0xe0ef('0x2b')][_0xe0ef('0x4a')](_0x469173[_0xe0ef('0x4b')],{})[_0xe0ef('0x25')](respondWithResult(_0x49b71b,0xc9))['catch'](handleError(_0x49b71b,null));};exports[_0xe0ef('0x24')]=function(_0xb8e656,_0xd11dbb){if(_0xb8e656[_0xe0ef('0x4b')]['id']){delete _0xb8e656[_0xe0ef('0x4b')]['id'];}return db[_0xe0ef('0x2b')][_0xe0ef('0x49')]({'where':{'id':_0xb8e656[_0xe0ef('0x46')]['id']}})[_0xe0ef('0x25')](handleEntityNotFound(_0xd11dbb,null))[_0xe0ef('0x25')](saveUpdates(_0xb8e656[_0xe0ef('0x4b')],null))[_0xe0ef('0x25')](respondWithResult(_0xd11dbb,null))[_0xe0ef('0x44')](handleError(_0xd11dbb,null));};exports[_0xe0ef('0x26')]=function(_0x13135d,_0x5e0bb9){return db['FreshdeskAccount'][_0xe0ef('0x49')]({'where':{'id':_0x13135d[_0xe0ef('0x46')]['id']}})[_0xe0ef('0x25')](handleEntityNotFound(_0x5e0bb9,null))[_0xe0ef('0x25')](removeEntity(_0x5e0bb9,null))[_0xe0ef('0x44')](handleError(_0x5e0bb9,null));};exports[_0xe0ef('0x4c')]=function(_0x4bf78f,_0x4772b7,_0x2807bd){var _0x2f9251={};var _0x690b34={};var _0x1a7b5d;var _0x53fcdb;return db[_0xe0ef('0x2b')]['findOne']({'where':{'id':_0x4bf78f[_0xe0ef('0x46')]['id']}})[_0xe0ef('0x25')](handleEntityNotFound(_0x4772b7,null))[_0xe0ef('0x25')](function(_0x577b62){if(_0x577b62){_0x1a7b5d=_0x577b62;_0x690b34['model']=_[_0xe0ef('0x47')](db[_0xe0ef('0x4d')][_0xe0ef('0x2c')]);_0x690b34[_0xe0ef('0x31')]=_[_0xe0ef('0x47')](_0x4bf78f[_0xe0ef('0x31')]);_0x690b34['filters']=_[_0xe0ef('0x32')](_0x690b34[_0xe0ef('0x34')],_0x690b34[_0xe0ef('0x31')]);_0x2f9251['attributes']=_[_0xe0ef('0x32')](_0x690b34['model'],qs[_0xe0ef('0x35')](_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x35')]));_0x2f9251[_0xe0ef('0x33')]=_0x2f9251['attributes']['length']?_0x2f9251[_0xe0ef('0x33')]:_0x690b34[_0xe0ef('0x34')];_0x2f9251[_0xe0ef('0x39')]=qs[_0xe0ef('0x3a')](_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x3a')]);_0x2f9251[_0xe0ef('0x3b')]=qs[_0xe0ef('0x3c')](_['pick'](_0x4bf78f[_0xe0ef('0x31')],_0x690b34[_0xe0ef('0x3c')]));if(_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x3e')]){_0x2f9251[_0xe0ef('0x3b')]=_[_0xe0ef('0x3f')](_0x2f9251['where'],{'$or':_[_0xe0ef('0x2f')](_0x2f9251[_0xe0ef('0x33')],function(_0x5e596a){var _0x539498={};_0x539498[_0x5e596a]={'$like':'%'+_0x4bf78f[_0xe0ef('0x31')]['filter']+'%'};return _0x539498;})});}_0x2f9251=_[_0xe0ef('0x3f')]({},_0x2f9251,_0x4bf78f[_0xe0ef('0x40')]);return _0x1a7b5d[_0xe0ef('0x4c')](_0x2f9251);}})[_0xe0ef('0x25')](function(_0x52b06c){if(_0x52b06c){_0x53fcdb=_0x52b06c[_0xe0ef('0x36')];if(!_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x37')](_0xe0ef('0x38'))){_0x2f9251[_0xe0ef('0x1e')]=qs[_0xe0ef('0x1e')](_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x1e')]);_0x2f9251['offset']=qs['offset'](_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x1c')]);}return _0x1a7b5d['getConfigurations'](_0x2f9251);}})[_0xe0ef('0x25')](function(_0x4d63d0){if(_0x4d63d0){return _0x4d63d0?{'count':_0x53fcdb,'rows':_0x4d63d0}:null;}})[_0xe0ef('0x25')](respondWithResult(_0x4772b7,null))['catch'](handleError(_0x4772b7,null));};exports[_0xe0ef('0x4e')]=function(_0x45373d,_0x1b2ebe,_0x24a31d){if(_0x45373d[_0xe0ef('0x4b')]['id']){delete _0x45373d[_0xe0ef('0x4b')]['id'];}return db[_0xe0ef('0x2b')][_0xe0ef('0x4f')]({'where':{'id':_0x45373d[_0xe0ef('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b2ebe,null))[_0xe0ef('0x25')](function(_0x8ab738){if(_0x8ab738){_0x45373d[_0xe0ef('0x4b')][_0xe0ef('0x50')]=_0x8ab738['id'];_0x45373d[_0xe0ef('0x4b')]['Subjects']=integrations[_0xe0ef('0x51')](_0x45373d['body'][_0xe0ef('0x52')],_0x45373d[_0xe0ef('0x4b')][_0xe0ef('0x2d')]);_0x45373d[_0xe0ef('0x4b')][_0xe0ef('0x53')]=integrations[_0xe0ef('0x54')](_0x45373d['body'][_0xe0ef('0x52')],_0x45373d['body']['type']);return db[_0xe0ef('0x4d')][_0xe0ef('0x4a')](_0x45373d[_0xe0ef('0x4b')],{'include':[{'model':db[_0xe0ef('0x55')],'as':_0xe0ef('0x56')},{'model':db[_0xe0ef('0x55')],'as':_0xe0ef('0x53')}]});}return null;})[_0xe0ef('0x25')](respondWithResult(_0x1b2ebe,null))[_0xe0ef('0x44')](handleError(_0x1b2ebe,null));};exports['getFields']=function(_0x3c8204,_0xbf1138,_0x355c5b){var _0x2e7a0e='';return db[_0xe0ef('0x2b')][_0xe0ef('0x4f')]({'where':{'id':_0x3c8204[_0xe0ef('0x46')]['id']},'attributes':['id','remoteUri','apiKey']})[_0xe0ef('0x25')](handleEntityNotFound(_0xbf1138,null))[_0xe0ef('0x25')](function(_0x2479b0){if(_0x2479b0){_0x2e7a0e=_0x2479b0[_0xe0ef('0x57')];var _0x5ccf3d=_0x2e7a0e['slice'](-0x1);if(_0x5ccf3d==='/'){_0x2e7a0e=_0x2e7a0e[_0xe0ef('0x58')](0x0,_0x2e7a0e[_0xe0ef('0x59')](_0x5ccf3d));}return rp({'method':'GET','uri':util[_0xe0ef('0x5a')](_0xe0ef('0x5b'),_0x2e7a0e,_0xe0ef('0x5c')),'headers':{'Authorization':util[_0xe0ef('0x5a')](_0xe0ef('0x5d'),new Buffer(util[_0xe0ef('0x5a')]('%s:X',_0x2479b0[_0xe0ef('0x5e')]))[_0xe0ef('0x5f')](_0xe0ef('0x60')))},'json':!![]});}})[_0xe0ef('0x25')](function(_0x4fe4e2){if(_0x4fe4e2){var _0x5e54db=[_0xe0ef('0x61'),'subject',_0xe0ef('0x62'),'description',_0xe0ef('0x19'),_0xe0ef('0x63'),_0xe0ef('0x64'),_0xe0ef('0x65'),'ticket_type',_0xe0ef('0x64'),_0xe0ef('0x66')];_[_0xe0ef('0x67')](_0x4fe4e2,function(_0x53bfbf){return _0x5e54db[_0xe0ef('0x68')](_0x53bfbf[_0xe0ef('0x30')])||!_0x53bfbf[_0xe0ef('0x69')]&&_0x53bfbf[_0xe0ef('0x2d')]!==_0xe0ef('0x6a')&&_0x53bfbf[_0xe0ef('0x2d')]!==_0xe0ef('0x6b');});return{'count':_0x4fe4e2[_0xe0ef('0x36')],'rows':_['map'](_0x4fe4e2,function(_0x328f91){return{'id':_0x328f91[_0xe0ef('0x30')],'name':_0x328f91['label'],'custom':!_0x328f91[_0xe0ef('0x69')],'options':_0x328f91[_0xe0ef('0x6c')]?_['map'](_0x328f91['choices'],function(_0x5a0e39){return{'name':_[_0xe0ef('0x6d')](_0x5a0e39),'value':_0x5a0e39};}):[]};})};}})[_0xe0ef('0x25')](respondWithResult(_0xbf1138,null))[_0xe0ef('0x44')](function(_0x515f4f){var _0x3578e7=_0x3c8204[_0xe0ef('0x31')][_0xe0ef('0x6e')]?0x1f4:_0x515f4f[_0xe0ef('0x6f')]||0x1f4;logger[_0xe0ef('0x28')](_0xe0ef('0x70'),_0xe0ef('0x71'),_0x3578e7,JSON['stringify'](_0x515f4f));delete _0x515f4f[_0xe0ef('0x30')];if(_0x3578e7===0x191){_0x3578e7=0x190;}_0xbf1138[_0xe0ef('0x19')](_0x3578e7)[_0xe0ef('0x29')](_0x3c8204[_0xe0ef('0x31')][_0xe0ef('0x6e')]?{'message':_0xe0ef('0x72'),'statusCode':_0x515f4f['statusCode']}:_0x515f4f);});}; \ No newline at end of file +var _0x1ca7=['includes','default','custom_dropdown','label','choices','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','rows','catch','show','find','create','body','params','findOne','FreshdeskConfiguration','rawAttributes','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','remoteUri','slice','lastIndexOf','format','api/v2/ticket_fields','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','group','source','remove'];(function(_0x3003fc,_0x5ac5de){var _0x22cb43=function(_0x478661){while(--_0x478661){_0x3003fc['push'](_0x3003fc['shift']());}};_0x22cb43(++_0x5ac5de);}(_0x1ca7,0x157));var _0x71ca=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1ca7[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x71ca('0x0'));var rimraf=require(_0x71ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x71ca('0x2'));var BPromise=require(_0x71ca('0x3'));var Mustache=require(_0x71ca('0x4'));var util=require('util');var path=require(_0x71ca('0x5'));var sox=require(_0x71ca('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71ca('0x7'));var _=require(_0x71ca('0x8'));var squel=require(_0x71ca('0x9'));var crypto=require(_0x71ca('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x71ca('0xb'));var toCsv=require(_0x71ca('0xc'));var querystring=require('querystring');var Papa=require(_0x71ca('0xd'));var Redis=require(_0x71ca('0xe'));var authService=require(_0x71ca('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x71ca('0x10'));var hardwareService=require(_0x71ca('0x11'));var logger=require(_0x71ca('0x12'))(_0x71ca('0x13'));var utils=require(_0x71ca('0x14'));var config=require(_0x71ca('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x71ca('0x16'))['db'];var integrations=require(_0x71ca('0x17'));function respondWithStatusCode(_0x4da234,_0x230345){_0x230345=_0x230345||0xcc;return function(_0x42ad77){if(_0x42ad77){return _0x4da234[_0x71ca('0x18')](_0x230345);}return _0x4da234[_0x71ca('0x19')](_0x230345)[_0x71ca('0x1a')]();};}function respondWithResult(_0x393db8,_0x2a38af){_0x2a38af=_0x2a38af||0xc8;return function(_0x3cbe45){if(_0x3cbe45){return _0x393db8[_0x71ca('0x19')](_0x2a38af)[_0x71ca('0x1b')](_0x3cbe45);}};}function respondWithFilteredResult(_0x505f8e,_0x4b65de){return function(_0x3f206d){if(_0x3f206d){var _0x5c6b85=typeof _0x4b65de[_0x71ca('0x1c')]===_0x71ca('0x1d')&&typeof _0x4b65de['limit']==='undefined';var _0x470470=_0x3f206d['count'];var _0x2c4310=_0x5c6b85?0x0:_0x4b65de[_0x71ca('0x1c')];var _0x302d9b=_0x5c6b85?_0x3f206d[_0x71ca('0x1e')]:_0x4b65de['offset']+_0x4b65de['limit'];var _0x5a4076;if(_0x302d9b>=_0x470470){_0x302d9b=_0x470470;_0x5a4076=0xc8;}else{_0x5a4076=0xce;}_0x505f8e[_0x71ca('0x19')](_0x5a4076);return _0x505f8e[_0x71ca('0x1f')](_0x71ca('0x20'),_0x2c4310+'-'+_0x302d9b+'/'+_0x470470)[_0x71ca('0x1b')](_0x3f206d);}return null;};}function patchUpdates(_0x363fb5){return function(_0xc37e2c){try{jsonpatch[_0x71ca('0x21')](_0xc37e2c,_0x363fb5,!![]);}catch(_0x259bc5){return BPromise[_0x71ca('0x22')](_0x259bc5);}return _0xc37e2c[_0x71ca('0x23')]();};}function saveUpdates(_0x5a501f,_0x48692c){return function(_0x4a7820){if(_0x4a7820){return _0x4a7820[_0x71ca('0x24')](_0x5a501f)['then'](function(_0x4fa46e){return _0x4fa46e;});}return null;};}function removeEntity(_0x1015c0,_0x2e2e22){return function(_0x458d4a){if(_0x458d4a){return _0x458d4a[_0x71ca('0x25')]()[_0x71ca('0x26')](function(){_0x1015c0[_0x71ca('0x19')](0xcc)[_0x71ca('0x1a')]();});}};}function handleEntityNotFound(_0x106f65,_0x35f577){return function(_0x4bfe19){if(!_0x4bfe19){_0x106f65[_0x71ca('0x18')](0x194);}return _0x4bfe19;};}function handleError(_0xddd38a,_0x35c857){_0x35c857=_0x35c857||0x1f4;return function(_0xd6ac43){logger['error'](_0xd6ac43[_0x71ca('0x27')]);if(_0xd6ac43[_0x71ca('0x28')]){delete _0xd6ac43[_0x71ca('0x28')];}_0xddd38a[_0x71ca('0x19')](_0x35c857)[_0x71ca('0x29')](_0xd6ac43);};}exports[_0x71ca('0x2a')]=function(_0x991bc,_0x5f2367){var _0x53562d={},_0xabe6e7={},_0x220584={'count':0x0,'rows':[]};var _0x7feccd=_['map'](db['FreshdeskAccount']['rawAttributes'],function(_0x1bcccb){return{'name':_0x1bcccb['fieldName'],'type':_0x1bcccb['type'][_0x71ca('0x2b')]};});_0xabe6e7['model']=_[_0x71ca('0x2c')](_0x7feccd,_0x71ca('0x28'));_0xabe6e7[_0x71ca('0x2d')]=_['keys'](_0x991bc[_0x71ca('0x2d')]);_0xabe6e7[_0x71ca('0x2e')]=_[_0x71ca('0x2f')](_0xabe6e7[_0x71ca('0x30')],_0xabe6e7[_0x71ca('0x2d')]);_0x53562d['attributes']=_[_0x71ca('0x2f')](_0xabe6e7[_0x71ca('0x30')],qs[_0x71ca('0x31')](_0x991bc[_0x71ca('0x2d')][_0x71ca('0x31')]));_0x53562d[_0x71ca('0x32')]=_0x53562d[_0x71ca('0x32')][_0x71ca('0x33')]?_0x53562d['attributes']:_0xabe6e7['model'];if(!_0x991bc[_0x71ca('0x2d')][_0x71ca('0x34')](_0x71ca('0x35'))){_0x53562d[_0x71ca('0x36')]=qs[_0x71ca('0x36')](_0x991bc[_0x71ca('0x2d')][_0x71ca('0x36')]);_0x53562d[_0x71ca('0x1c')]=qs['offset'](_0x991bc[_0x71ca('0x2d')]['offset']);}_0x53562d[_0x71ca('0x37')]=qs[_0x71ca('0x38')](_0x991bc[_0x71ca('0x2d')][_0x71ca('0x38')]);_0x53562d[_0x71ca('0x39')]=qs[_0x71ca('0x2e')](_[_0x71ca('0x3a')](_0x991bc[_0x71ca('0x2d')],_0xabe6e7[_0x71ca('0x2e')]),_0x7feccd);if(_0x991bc[_0x71ca('0x2d')][_0x71ca('0x3b')]){_0x53562d['where']=_[_0x71ca('0x3c')](_0x53562d[_0x71ca('0x39')],{'$or':_[_0x71ca('0x2c')](_0x7feccd,function(_0x53bb16){if(_0x53bb16[_0x71ca('0x3d')]!==_0x71ca('0x3e')){var _0x1dfc57={};_0x1dfc57[_0x53bb16[_0x71ca('0x28')]]={'$like':'%'+_0x991bc[_0x71ca('0x2d')]['filter']+'%'};return _0x1dfc57;}})});}_0x53562d=_['merge']({},_0x53562d,_0x991bc[_0x71ca('0x3f')]);var _0x9a7046={'where':_0x53562d[_0x71ca('0x39')]};return db[_0x71ca('0x40')][_0x71ca('0x1e')](_0x9a7046)[_0x71ca('0x26')](function(_0x5b567b){_0x220584['count']=_0x5b567b;if(_0x991bc[_0x71ca('0x2d')][_0x71ca('0x41')]){_0x53562d[_0x71ca('0x42')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x71ca('0x43')](_0x53562d);})[_0x71ca('0x26')](function(_0xd53d29){_0x220584[_0x71ca('0x44')]=_0xd53d29;return _0x220584;})[_0x71ca('0x26')](respondWithFilteredResult(_0x5f2367,_0x53562d))[_0x71ca('0x45')](handleError(_0x5f2367,null));};exports[_0x71ca('0x46')]=function(_0x3b6d51,_0x37e83a){var _0x223aa5={'raw':![],'where':{'id':_0x3b6d51['params']['id']}},_0x550d50={};_0x550d50[_0x71ca('0x30')]=_['keys'](db['FreshdeskAccount']['rawAttributes']);_0x550d50['query']=_['keys'](_0x3b6d51[_0x71ca('0x2d')]);_0x550d50[_0x71ca('0x2e')]=_[_0x71ca('0x2f')](_0x550d50[_0x71ca('0x30')],_0x550d50[_0x71ca('0x2d')]);_0x223aa5['attributes']=_['intersection'](_0x550d50[_0x71ca('0x30')],qs[_0x71ca('0x31')](_0x3b6d51[_0x71ca('0x2d')][_0x71ca('0x31')]));_0x223aa5[_0x71ca('0x32')]=_0x223aa5[_0x71ca('0x32')]['length']?_0x223aa5[_0x71ca('0x32')]:_0x550d50[_0x71ca('0x30')];if(_0x3b6d51[_0x71ca('0x2d')][_0x71ca('0x41')]){_0x223aa5['include']=[{'all':!![]}];}_0x223aa5=_[_0x71ca('0x3c')]({},_0x223aa5,_0x3b6d51['options']);return db[_0x71ca('0x40')][_0x71ca('0x47')](_0x223aa5)[_0x71ca('0x26')](handleEntityNotFound(_0x37e83a,null))[_0x71ca('0x26')](respondWithResult(_0x37e83a,null))[_0x71ca('0x45')](handleError(_0x37e83a,null));};exports[_0x71ca('0x48')]=function(_0x2441e4,_0x5a2ae2){return db[_0x71ca('0x40')][_0x71ca('0x48')](_0x2441e4[_0x71ca('0x49')],{})[_0x71ca('0x26')](respondWithResult(_0x5a2ae2,0xc9))[_0x71ca('0x45')](handleError(_0x5a2ae2,null));};exports[_0x71ca('0x24')]=function(_0x18bf0d,_0x546ff0){if(_0x18bf0d[_0x71ca('0x49')]['id']){delete _0x18bf0d['body']['id'];}return db[_0x71ca('0x40')][_0x71ca('0x47')]({'where':{'id':_0x18bf0d[_0x71ca('0x4a')]['id']}})['then'](handleEntityNotFound(_0x546ff0,null))[_0x71ca('0x26')](saveUpdates(_0x18bf0d['body'],null))[_0x71ca('0x26')](respondWithResult(_0x546ff0,null))['catch'](handleError(_0x546ff0,null));};exports[_0x71ca('0x25')]=function(_0x14f264,_0x14b83d){return db['FreshdeskAccount'][_0x71ca('0x47')]({'where':{'id':_0x14f264[_0x71ca('0x4a')]['id']}})[_0x71ca('0x26')](handleEntityNotFound(_0x14b83d,null))[_0x71ca('0x26')](removeEntity(_0x14b83d,null))['catch'](handleError(_0x14b83d,null));};exports['getConfigurations']=function(_0x1c9a4e,_0x2a2680,_0x4abd78){var _0x3364b4={};var _0x35471a={};var _0x4f133f;var _0xf11ba3;return db['FreshdeskAccount'][_0x71ca('0x4b')]({'where':{'id':_0x1c9a4e[_0x71ca('0x4a')]['id']}})[_0x71ca('0x26')](handleEntityNotFound(_0x2a2680,null))[_0x71ca('0x26')](function(_0x171be3){if(_0x171be3){_0x4f133f=_0x171be3;_0x35471a['model']=_['keys'](db[_0x71ca('0x4c')][_0x71ca('0x4d')]);_0x35471a[_0x71ca('0x2d')]=_['keys'](_0x1c9a4e[_0x71ca('0x2d')]);_0x35471a[_0x71ca('0x2e')]=_[_0x71ca('0x2f')](_0x35471a[_0x71ca('0x30')],_0x35471a[_0x71ca('0x2d')]);_0x3364b4[_0x71ca('0x32')]=_[_0x71ca('0x2f')](_0x35471a[_0x71ca('0x30')],qs[_0x71ca('0x31')](_0x1c9a4e[_0x71ca('0x2d')]['fields']));_0x3364b4['attributes']=_0x3364b4[_0x71ca('0x32')][_0x71ca('0x33')]?_0x3364b4['attributes']:_0x35471a[_0x71ca('0x30')];_0x3364b4[_0x71ca('0x37')]=qs['sort'](_0x1c9a4e[_0x71ca('0x2d')]['sort']);_0x3364b4[_0x71ca('0x39')]=qs[_0x71ca('0x2e')](_[_0x71ca('0x3a')](_0x1c9a4e[_0x71ca('0x2d')],_0x35471a[_0x71ca('0x2e')]));if(_0x1c9a4e['query'][_0x71ca('0x3b')]){_0x3364b4['where']=_['merge'](_0x3364b4[_0x71ca('0x39')],{'$or':_['map'](_0x3364b4[_0x71ca('0x32')],function(_0x1625ce){var _0x160c25={};_0x160c25[_0x1625ce]={'$like':'%'+_0x1c9a4e[_0x71ca('0x2d')][_0x71ca('0x3b')]+'%'};return _0x160c25;})});}_0x3364b4=_['merge']({},_0x3364b4,_0x1c9a4e[_0x71ca('0x3f')]);return _0x4f133f['getConfigurations'](_0x3364b4);}})['then'](function(_0x15fe12){if(_0x15fe12){_0xf11ba3=_0x15fe12[_0x71ca('0x33')];if(!_0x1c9a4e['query'][_0x71ca('0x34')]('nolimit')){_0x3364b4['limit']=qs[_0x71ca('0x36')](_0x1c9a4e[_0x71ca('0x2d')]['limit']);_0x3364b4[_0x71ca('0x1c')]=qs[_0x71ca('0x1c')](_0x1c9a4e[_0x71ca('0x2d')][_0x71ca('0x1c')]);}return _0x4f133f['getConfigurations'](_0x3364b4);}})[_0x71ca('0x26')](function(_0x5bd8fb){if(_0x5bd8fb){return _0x5bd8fb?{'count':_0xf11ba3,'rows':_0x5bd8fb}:null;}})[_0x71ca('0x26')](respondWithResult(_0x2a2680,null))[_0x71ca('0x45')](handleError(_0x2a2680,null));};exports['addConfiguration']=function(_0x398345,_0x5881b8,_0x53460f){if(_0x398345[_0x71ca('0x49')]['id']){delete _0x398345[_0x71ca('0x49')]['id'];}return db['FreshdeskAccount'][_0x71ca('0x4b')]({'where':{'id':_0x398345['params']['id']}})[_0x71ca('0x26')](handleEntityNotFound(_0x5881b8,null))[_0x71ca('0x26')](function(_0x1ebbe8){if(_0x1ebbe8){_0x398345[_0x71ca('0x49')][_0x71ca('0x4e')]=_0x1ebbe8['id'];_0x398345['body'][_0x71ca('0x4f')]=integrations[_0x71ca('0x50')](_0x398345['body'][_0x71ca('0x51')],_0x398345[_0x71ca('0x49')][_0x71ca('0x3d')]);_0x398345[_0x71ca('0x49')]['Descriptions']=integrations['getDescriptions'](_0x398345[_0x71ca('0x49')]['channel'],_0x398345[_0x71ca('0x49')][_0x71ca('0x3d')]);return db['FreshdeskConfiguration']['create'](_0x398345['body'],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x71ca('0x52')}]});}return null;})[_0x71ca('0x26')](respondWithResult(_0x5881b8,null))[_0x71ca('0x45')](handleError(_0x5881b8,null));};exports[_0x71ca('0x53')]=function(_0x2b2c05,_0x3c1714,_0x133fd4){var _0x30d863='';return db[_0x71ca('0x40')][_0x71ca('0x4b')]({'where':{'id':_0x2b2c05[_0x71ca('0x4a')]['id']},'attributes':['id',_0x71ca('0x54'),'apiKey']})[_0x71ca('0x26')](handleEntityNotFound(_0x3c1714,null))[_0x71ca('0x26')](function(_0x2e80c3){if(_0x2e80c3){_0x30d863=_0x2e80c3[_0x71ca('0x54')];var _0x2a2ffc=_0x30d863[_0x71ca('0x55')](-0x1);if(_0x2a2ffc==='/'){_0x30d863=_0x30d863['substring'](0x0,_0x30d863[_0x71ca('0x56')](_0x2a2ffc));}return rp({'method':'GET','uri':util[_0x71ca('0x57')]('%s/%s',_0x30d863,_0x71ca('0x58')),'headers':{'Authorization':util[_0x71ca('0x57')]('Basic\x20%s',new Buffer(util[_0x71ca('0x57')](_0x71ca('0x59'),_0x2e80c3[_0x71ca('0x5a')]))[_0x71ca('0x5b')](_0x71ca('0x5c')))},'json':!![]});}})[_0x71ca('0x26')](function(_0x6e5094){if(_0x6e5094){var _0x56e953=[_0x71ca('0x5d'),_0x71ca('0x5e'),_0x71ca('0x5f'),_0x71ca('0x60'),_0x71ca('0x19'),_0x71ca('0x61'),_0x71ca('0x62'),_0x71ca('0x63'),'ticket_type',_0x71ca('0x62'),'company'];_[_0x71ca('0x64')](_0x6e5094,function(_0x1e37a8){return _0x56e953[_0x71ca('0x65')](_0x1e37a8[_0x71ca('0x28')])||!_0x1e37a8[_0x71ca('0x66')]&&_0x1e37a8[_0x71ca('0x3d')]!=='custom_text'&&_0x1e37a8[_0x71ca('0x3d')]!==_0x71ca('0x67');});return{'count':_0x6e5094[_0x71ca('0x33')],'rows':_[_0x71ca('0x2c')](_0x6e5094,function(_0x2d7c4c){return{'id':_0x2d7c4c[_0x71ca('0x28')],'name':_0x2d7c4c[_0x71ca('0x68')],'custom':!_0x2d7c4c['default'],'options':_0x2d7c4c[_0x71ca('0x69')]?_[_0x71ca('0x2c')](_0x2d7c4c[_0x71ca('0x69')],function(_0x370ba0){return{'name':_['capitalize'](_0x370ba0),'value':_0x370ba0};}):[]};})};}})[_0x71ca('0x26')](respondWithResult(_0x3c1714,null))[_0x71ca('0x45')](function(_0x1c6b5b){var _0x4a716a=_0x2b2c05[_0x71ca('0x2d')][_0x71ca('0x6a')]?0x1f4:_0x1c6b5b[_0x71ca('0x6b')]||0x1f4;logger[_0x71ca('0x6c')](_0x71ca('0x6d'),'getFields',_0x4a716a,JSON[_0x71ca('0x6e')](_0x1c6b5b));delete _0x1c6b5b[_0x71ca('0x28')];if(_0x4a716a===0x191){_0x4a716a=0x190;}_0x3c1714[_0x71ca('0x19')](_0x4a716a)[_0x71ca('0x29')](_0x2b2c05[_0x71ca('0x2d')][_0x71ca('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x1c6b5b[_0x71ca('0x6b')]}:_0x1c6b5b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index eb21044..10b9b76 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 _0x8fbe=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0x8fbe,0x1db));var _0xe8fb=function(_0x97d399,_0x218d12){_0x97d399=_0x97d399-0x0;var _0x46d733=_0x8fbe[_0x97d399];return _0x46d733;};'use strict';var _=require('lodash');var util=require(_0xe8fb('0x0'));var logger=require(_0xe8fb('0x1'))(_0xe8fb('0x2'));var moment=require(_0xe8fb('0x3'));var BPromise=require(_0xe8fb('0x4'));var rp=require(_0xe8fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe8fb('0x6'));var attributes=require(_0xe8fb('0x7'));var integrations=require(_0xe8fb('0x8'));module[_0xe8fb('0x9')]=function(_0x1a51e1,_0x2e73c9){return _0x1a51e1[_0xe8fb('0xa')](_0xe8fb('0xb'),attributes,{'tableName':_0xe8fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96d4=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x96d4,0x16c));var _0x496d=function(_0x14e7f2,_0x4bdd32){_0x14e7f2=_0x14e7f2-0x0;var _0x4979a0=_0x96d4[_0x14e7f2];return _0x4979a0;};'use strict';var _=require(_0x496d('0x0'));var util=require(_0x496d('0x1'));var logger=require(_0x496d('0x2'))('api');var moment=require(_0x496d('0x3'));var BPromise=require(_0x496d('0x4'));var rp=require(_0x496d('0x5'));var fs=require('fs');var path=require(_0x496d('0x6'));var rimraf=require(_0x496d('0x7'));var config=require(_0x496d('0x8'));var attributes=require(_0x496d('0x9'));var integrations=require(_0x496d('0xa'));module['exports']=function(_0x41a001,_0x59fae1){return _0x41a001[_0x496d('0xb')](_0x496d('0xc'),attributes,{'tableName':_0x496d('0xd'),'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 adc8e3a..767c714 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 _0xc6d7=['map','include','model','attributes','then','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','http','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','findAll','options','raw','where','limit'];(function(_0x511577,_0x2ec0cf){var _0x1b9201=function(_0x334aac){while(--_0x334aac){_0x511577['push'](_0x511577['shift']());}};_0x1b9201(++_0x2ec0cf);}(_0xc6d7,0x174));var _0x7c6d=function(_0x2def5e,_0x55e435){_0x2def5e=_0x2def5e-0x0;var _0x592d35=_0xc6d7[_0x2def5e];return _0x592d35;};'use strict';var _=require(_0x7c6d('0x0'));var util=require('util');var moment=require(_0x7c6d('0x1'));var BPromise=require(_0x7c6d('0x2'));var rs=require(_0x7c6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7c6d('0x5'));var config=require(_0x7c6d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c6d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30a90c,_0xbe91a9,_0x44277d){return new BPromise(function(_0x2b8ea2,_0x107d2c){return client['request'](_0x30a90c,_0x44277d)['then'](function(_0x252daa){logger['info'](_0x7c6d('0x8'),_0xbe91a9,_0x7c6d('0x9'));logger[_0x7c6d('0xa')](_0x7c6d('0xb'),_0xbe91a9,'request\x20sent',JSON[_0x7c6d('0xc')](_0x252daa));if(_0x252daa['error']){if(_0x252daa['error'][_0x7c6d('0xd')]===0x1f4){logger[_0x7c6d('0xe')](_0x7c6d('0x8'),_0xbe91a9,_0x252daa['error']['message']);return _0x107d2c(_0x252daa[_0x7c6d('0xe')][_0x7c6d('0xf')]);}logger['error'](_0x7c6d('0x8'),_0xbe91a9,_0x252daa[_0x7c6d('0xe')][_0x7c6d('0xf')]);return _0x2b8ea2(_0x252daa[_0x7c6d('0xe')][_0x7c6d('0xf')]);}else{logger[_0x7c6d('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0xbe91a9,_0x7c6d('0x9'));_0x2b8ea2(_0x252daa[_0x7c6d('0x11')][_0x7c6d('0xf')]);}})[_0x7c6d('0x12')](function(_0x2bd9d3){logger['error'](_0x7c6d('0x8'),_0xbe91a9,_0x2bd9d3);_0x107d2c(_0x2bd9d3);});});}exports['GetFreshdeskAccount']=function(_0x855d7a){var _0x3c9951=this;return new Promise(function(_0x5990c7,_0x48a606){return db['FreshdeskAccount'][_0x7c6d('0x13')]({'raw':_0x855d7a['options']?_0x855d7a[_0x7c6d('0x14')][_0x7c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x855d7a[_0x7c6d('0x14')]?_0x855d7a[_0x7c6d('0x14')][_0x7c6d('0x16')]||null:null,'attributes':_0x855d7a[_0x7c6d('0x14')]?_0x855d7a['options']['attributes']||null:null,'limit':_0x855d7a[_0x7c6d('0x14')]?_0x855d7a[_0x7c6d('0x14')][_0x7c6d('0x17')]||null:null,'include':_0x855d7a[_0x7c6d('0x14')]?_0x855d7a[_0x7c6d('0x14')]['include']?_[_0x7c6d('0x18')](_0x855d7a['options'][_0x7c6d('0x19')],function(_0x4c0f46){return{'model':db[_0x4c0f46[_0x7c6d('0x1a')]],'as':_0x4c0f46['as'],'attributes':_0x4c0f46['attributes'],'include':_0x4c0f46[_0x7c6d('0x19')]?_[_0x7c6d('0x18')](_0x4c0f46['include'],function(_0x40b7b1){return{'model':db[_0x40b7b1['model']],'as':_0x40b7b1['as'],'attributes':_0x40b7b1[_0x7c6d('0x1b')],'include':_0x40b7b1[_0x7c6d('0x19')]?_['map'](_0x40b7b1[_0x7c6d('0x19')],function(_0x494f8){return{'model':db[_0x494f8['model']],'as':_0x494f8['as'],'attributes':_0x494f8['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c6d('0x1c')](function(_0x1506c3){logger[_0x7c6d('0x10')](_0x7c6d('0x1d'),_0x855d7a);logger[_0x7c6d('0xa')](_0x7c6d('0x1d'),_0x855d7a,JSON[_0x7c6d('0xc')](_0x1506c3));_0x5990c7(_0x1506c3);})[_0x7c6d('0x12')](function(_0x3801a5){logger[_0x7c6d('0xe')](_0x7c6d('0x1d'),_0x3801a5['message'],_0x855d7a);_0x48a606(_0x3c9951[_0x7c6d('0xe')](0x1f4,_0x3801a5['message']));});});};exports[_0x7c6d('0x1e')]=function(_0x18feb7){var _0x5ea41f=this;return new Promise(function(_0x175b65,_0x58302d){return db[_0x7c6d('0x1f')][_0x7c6d('0x20')]({'raw':_0x18feb7['options']?_0x18feb7['options'][_0x7c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x18feb7['options']?_0x18feb7[_0x7c6d('0x14')][_0x7c6d('0x16')]||null:null,'attributes':_0x18feb7[_0x7c6d('0x14')]?_0x18feb7[_0x7c6d('0x14')][_0x7c6d('0x1b')]||null:null,'include':_0x18feb7[_0x7c6d('0x14')]?_0x18feb7[_0x7c6d('0x14')][_0x7c6d('0x19')]?_[_0x7c6d('0x18')](_0x18feb7[_0x7c6d('0x14')][_0x7c6d('0x19')],function(_0x2e4c86){return{'model':db[_0x2e4c86[_0x7c6d('0x1a')]],'as':_0x2e4c86['as'],'attributes':_0x2e4c86['attributes'],'include':_0x2e4c86['include']?_['map'](_0x2e4c86['include'],function(_0x56a3a6){return{'model':db[_0x56a3a6[_0x7c6d('0x1a')]],'as':_0x56a3a6['as'],'attributes':_0x56a3a6[_0x7c6d('0x1b')],'include':_0x56a3a6[_0x7c6d('0x19')]?_[_0x7c6d('0x18')](_0x56a3a6[_0x7c6d('0x19')],function(_0x1e0104){return{'model':db[_0x1e0104[_0x7c6d('0x1a')]],'as':_0x1e0104['as'],'attributes':_0x1e0104[_0x7c6d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7c6d('0x1c')](function(_0x28c93a){logger['info'](_0x7c6d('0x1e'),_0x18feb7);logger[_0x7c6d('0xa')](_0x7c6d('0x1e'),_0x18feb7,JSON['stringify'](_0x28c93a));_0x175b65(_0x28c93a);})[_0x7c6d('0x12')](function(_0x14f3bd){logger[_0x7c6d('0xe')](_0x7c6d('0x1e'),_0x14f3bd[_0x7c6d('0xf')],_0x18feb7);_0x58302d(_0x5ea41f[_0x7c6d('0xe')](0x1f4,_0x14f3bd['message']));});});}; \ No newline at end of file +var _0x1cc2=['jayson/promise','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','then','debug','stringify','ShowFreshdeskAccount','FreshdeskAccount','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0x1cc2,0x139));var _0x21cc=function(_0x1fc151,_0x881f9c){_0x1fc151=_0x1fc151-0x0;var _0x4ce42d=_0x1cc2[_0x1fc151];return _0x4ce42d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x21cc('0x0'));var BPromise=require(_0x21cc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21cc('0x2'));var db=require(_0x21cc('0x3'))['db'];var utils=require(_0x21cc('0x4'));var logger=require(_0x21cc('0x5'))(_0x21cc('0x6'));var config=require('../../config/environment');var jayson=require(_0x21cc('0x7'));var client=jayson['client'][_0x21cc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5142fc,_0x57dea1,_0x1482d4){return new BPromise(function(_0x4bea2c,_0xd2e890){return client['request'](_0x5142fc,_0x1482d4)['then'](function(_0x4d7323){logger[_0x21cc('0x9')](_0x21cc('0xa'),_0x57dea1,_0x21cc('0xb'));logger['debug'](_0x21cc('0xc'),_0x57dea1,_0x21cc('0xb'),JSON['stringify'](_0x4d7323));if(_0x4d7323[_0x21cc('0xd')]){if(_0x4d7323[_0x21cc('0xd')][_0x21cc('0xe')]===0x1f4){logger[_0x21cc('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x57dea1,_0x4d7323[_0x21cc('0xd')]['message']);return _0xd2e890(_0x4d7323['error']['message']);}logger['error'](_0x21cc('0xa'),_0x57dea1,_0x4d7323[_0x21cc('0xd')][_0x21cc('0xf')]);return _0x4bea2c(_0x4d7323[_0x21cc('0xd')]['message']);}else{logger[_0x21cc('0x9')](_0x21cc('0xa'),_0x57dea1,_0x21cc('0xb'));_0x4bea2c(_0x4d7323['result'][_0x21cc('0xf')]);}})[_0x21cc('0x10')](function(_0x221733){logger[_0x21cc('0xd')](_0x21cc('0xa'),_0x57dea1,_0x221733);_0xd2e890(_0x221733);});});}exports[_0x21cc('0x11')]=function(_0xa6a64d){var _0xbbd6b7=this;return new Promise(function(_0x149fee,_0x592919){return db['FreshdeskAccount'][_0x21cc('0x12')]({'raw':_0xa6a64d[_0x21cc('0x13')]?_0xa6a64d[_0x21cc('0x13')][_0x21cc('0x14')]===undefined?!![]:![]:!![],'where':_0xa6a64d[_0x21cc('0x13')]?_0xa6a64d['options']['where']||null:null,'attributes':_0xa6a64d[_0x21cc('0x13')]?_0xa6a64d[_0x21cc('0x13')][_0x21cc('0x15')]||null:null,'limit':_0xa6a64d['options']?_0xa6a64d['options'][_0x21cc('0x16')]||null:null,'include':_0xa6a64d['options']?_0xa6a64d['options'][_0x21cc('0x17')]?_[_0x21cc('0x18')](_0xa6a64d[_0x21cc('0x13')]['include'],function(_0x486d76){return{'model':db[_0x486d76[_0x21cc('0x19')]],'as':_0x486d76['as'],'attributes':_0x486d76[_0x21cc('0x15')],'include':_0x486d76[_0x21cc('0x17')]?_[_0x21cc('0x18')](_0x486d76[_0x21cc('0x17')],function(_0x4b9d6a){return{'model':db[_0x4b9d6a[_0x21cc('0x19')]],'as':_0x4b9d6a['as'],'attributes':_0x4b9d6a[_0x21cc('0x15')],'include':_0x4b9d6a['include']?_[_0x21cc('0x18')](_0x4b9d6a[_0x21cc('0x17')],function(_0x3c87b7){return{'model':db[_0x3c87b7[_0x21cc('0x19')]],'as':_0x3c87b7['as'],'attributes':_0x3c87b7[_0x21cc('0x15')]};}):[]};}):[]};}):[]:[]})[_0x21cc('0x1a')](function(_0x1bb939){logger[_0x21cc('0x9')](_0x21cc('0x11'),_0xa6a64d);logger[_0x21cc('0x1b')](_0x21cc('0x11'),_0xa6a64d,JSON[_0x21cc('0x1c')](_0x1bb939));_0x149fee(_0x1bb939);})['catch'](function(_0xe95122){logger[_0x21cc('0xd')](_0x21cc('0x11'),_0xe95122[_0x21cc('0xf')],_0xa6a64d);_0x592919(_0xbbd6b7[_0x21cc('0xd')](0x1f4,_0xe95122[_0x21cc('0xf')]));});});};exports[_0x21cc('0x1d')]=function(_0x2f2b5a){var _0x11f1e4=this;return new Promise(function(_0x3286c7,_0x6c189b){return db[_0x21cc('0x1e')][_0x21cc('0x1f')]({'raw':_0x2f2b5a[_0x21cc('0x13')]?_0x2f2b5a[_0x21cc('0x13')][_0x21cc('0x14')]===undefined?!![]:![]:!![],'where':_0x2f2b5a['options']?_0x2f2b5a[_0x21cc('0x13')]['where']||null:null,'attributes':_0x2f2b5a[_0x21cc('0x13')]?_0x2f2b5a[_0x21cc('0x13')][_0x21cc('0x15')]||null:null,'include':_0x2f2b5a[_0x21cc('0x13')]?_0x2f2b5a[_0x21cc('0x13')][_0x21cc('0x17')]?_[_0x21cc('0x18')](_0x2f2b5a['options'][_0x21cc('0x17')],function(_0x278c8e){return{'model':db[_0x278c8e[_0x21cc('0x19')]],'as':_0x278c8e['as'],'attributes':_0x278c8e[_0x21cc('0x15')],'include':_0x278c8e[_0x21cc('0x17')]?_[_0x21cc('0x18')](_0x278c8e[_0x21cc('0x17')],function(_0x9449ee){return{'model':db[_0x9449ee[_0x21cc('0x19')]],'as':_0x9449ee['as'],'attributes':_0x9449ee[_0x21cc('0x15')],'include':_0x9449ee[_0x21cc('0x17')]?_[_0x21cc('0x18')](_0x9449ee[_0x21cc('0x17')],function(_0x395b0e){return{'model':db[_0x395b0e[_0x21cc('0x19')]],'as':_0x395b0e['as'],'attributes':_0x395b0e[_0x21cc('0x15')]};}):[]};}):[]};}):[]:[]})[_0x21cc('0x1a')](function(_0x51b802){logger['info'](_0x21cc('0x1d'),_0x2f2b5a);logger[_0x21cc('0x1b')](_0x21cc('0x1d'),_0x2f2b5a,JSON[_0x21cc('0x1c')](_0x51b802));_0x3286c7(_0x51b802);})['catch'](function(_0x4f6824){logger[_0x21cc('0xd')](_0x21cc('0x1d'),_0x4f6824[_0x21cc('0xf')],_0x2f2b5a);_0x6c189b(_0x11f1e4[_0x21cc('0xd')](0x1f4,_0x4f6824['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 269d618..0cf8e84 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 _0x79bc=['/:id/descriptions','/:id/tags','create','post','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x79bc,0xa0));var _0xc79b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x79bc[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require(_0xc79b('0x0'));var path=require('path');var timeout=require(_0xc79b('0x1'));var express=require(_0xc79b('0x2'));var router=express[_0xc79b('0x3')]();var fs_extra=require(_0xc79b('0x4'));var auth=require(_0xc79b('0x5'));var interaction=require(_0xc79b('0x6'));var config=require(_0xc79b('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xc79b('0x8')](),controller[_0xc79b('0x9')]);router[_0xc79b('0xa')](_0xc79b('0xb'),auth[_0xc79b('0x8')](),controller[_0xc79b('0xc')]);router[_0xc79b('0xa')](_0xc79b('0xd'),auth[_0xc79b('0x8')](),controller[_0xc79b('0xe')]);router['get'](_0xc79b('0xf'),auth[_0xc79b('0x8')](),controller['getSubjects']);router[_0xc79b('0xa')](_0xc79b('0x10'),auth[_0xc79b('0x8')](),controller['getDescriptions']);router['get'](_0xc79b('0x11'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0xc79b('0x8')](),controller[_0xc79b('0x12')]);router[_0xc79b('0x13')]('/:id/tags',auth[_0xc79b('0x8')](),controller['setTags']);router['put'](_0xc79b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc79b('0x14')](_0xc79b('0xb'),auth[_0xc79b('0x8')](),controller[_0xc79b('0x15')]);module['exports']=router; \ No newline at end of file +var _0xaf08=['/:id/tags','create','post','setTags','put','update','delete','destroy','exports','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5c7718,_0x1a3d7a){var _0x4fb733=function(_0x286736){while(--_0x286736){_0x5c7718['push'](_0x5c7718['shift']());}};_0x4fb733(++_0x1a3d7a);}(_0xaf08,0x1b2));var _0x8af0=function(_0x4f3242,_0x391954){_0x4f3242=_0x4f3242-0x0;var _0x49844f=_0xaf08[_0x4f3242];return _0x49844f;};'use strict';var multer=require('multer');var util=require(_0x8af0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8af0('0x1'));var auth=require(_0x8af0('0x2'));var interaction=require(_0x8af0('0x3'));var config=require(_0x8af0('0x4'));var controller=require(_0x8af0('0x5'));router[_0x8af0('0x6')]('/',auth[_0x8af0('0x7')](),controller[_0x8af0('0x8')]);router[_0x8af0('0x6')](_0x8af0('0x9'),auth[_0x8af0('0x7')](),controller[_0x8af0('0xa')]);router['get'](_0x8af0('0xb'),auth['isAuthenticated'](),controller[_0x8af0('0xc')]);router['get']('/:id/subjects',auth[_0x8af0('0x7')](),controller[_0x8af0('0xd')]);router[_0x8af0('0x6')](_0x8af0('0xe'),auth[_0x8af0('0x7')](),controller[_0x8af0('0xf')]);router['get'](_0x8af0('0x10'),auth[_0x8af0('0x7')](),controller['getTags']);router['post']('/',auth[_0x8af0('0x7')](),controller[_0x8af0('0x11')]);router[_0x8af0('0x12')](_0x8af0('0x10'),auth[_0x8af0('0x7')](),controller[_0x8af0('0x13')]);router[_0x8af0('0x14')](_0x8af0('0x9'),auth[_0x8af0('0x7')](),controller[_0x8af0('0x15')]);router[_0x8af0('0x16')](_0x8af0('0x9'),auth[_0x8af0('0x7')](),controller[_0x8af0('0x17')]);module[_0x8af0('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 ebab6ca..b7d6c97 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 _0x976e=['STRING'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x976e,0x1da));var _0xe976=function(_0x5da2d1,_0x4bd038){_0x5da2d1=_0x5da2d1-0x0;var _0x19654c=_0x976e[_0x5da2d1];return _0x19654c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe976('0x0')]},'description':{'type':Sequelize[_0xe976('0x0')]}}; \ No newline at end of file +var _0x2b02=['exports','STRING','sequelize'];(function(_0x1fb7d1,_0x108781){var _0x2480d8=function(_0x9bc3d9){while(--_0x9bc3d9){_0x1fb7d1['push'](_0x1fb7d1['shift']());}};_0x2480d8(++_0x108781);}(_0x2b02,0x17c));var _0x22b0=function(_0x538883,_0x20ca6b){_0x538883=_0x538883-0x0;var _0x2313f5=_0x2b02[_0x538883];return _0x2313f5;};'use strict';var Sequelize=require(_0x22b0('0x0'));module[_0x22b0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x22b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 008a3f5..9b5521a 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 _0xc5c8=['reject','save','update','then','sendStatus','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','destroy','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x3fe2ef,_0x211196){var _0x1fa60b=function(_0x55602e){while(--_0x55602e){_0x3fe2ef['push'](_0x3fe2ef['shift']());}};_0x1fa60b(++_0x211196);}(_0xc5c8,0x134));var _0x8c5c=function(_0x4841db,_0x32a27b){_0x4841db=_0x4841db-0x0;var _0x5183be=_0xc5c8[_0x4841db];return _0x5183be;};'use strict';var emlformat=require(_0x8c5c('0x0'));var rimraf=require(_0x8c5c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c5c('0x2'));var rp=require(_0x8c5c('0x3'));var moment=require(_0x8c5c('0x4'));var BPromise=require(_0x8c5c('0x5'));var Mustache=require(_0x8c5c('0x6'));var util=require(_0x8c5c('0x7'));var path=require(_0x8c5c('0x8'));var sox=require(_0x8c5c('0x9'));var csv=require('to-csv');var ejs=require(_0x8c5c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8c5c('0xb'));var crypto=require(_0x8c5c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8c5c('0xd'));var toCsv=require(_0x8c5c('0xe'));var querystring=require(_0x8c5c('0xf'));var Papa=require(_0x8c5c('0x10'));var Redis=require(_0x8c5c('0x11'));var authService=require(_0x8c5c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8c5c('0x13'));var hardwareService=require(_0x8c5c('0x14'));var logger=require('../../config/logger')(_0x8c5c('0x15'));var utils=require(_0x8c5c('0x16'));var config=require(_0x8c5c('0x17'));var licenseUtil=require(_0x8c5c('0x18'));var db=require(_0x8c5c('0x19'))['db'];function respondWithStatusCode(_0x3dfb07,_0x2b0dd9){_0x2b0dd9=_0x2b0dd9||0xcc;return function(_0x22ce6d){if(_0x22ce6d){return _0x3dfb07['sendStatus'](_0x2b0dd9);}return _0x3dfb07[_0x8c5c('0x1a')](_0x2b0dd9)[_0x8c5c('0x1b')]();};}function respondWithResult(_0x287471,_0x14375d){_0x14375d=_0x14375d||0xc8;return function(_0x179656){if(_0x179656){return _0x287471['status'](_0x14375d)[_0x8c5c('0x1c')](_0x179656);}};}function respondWithFilteredResult(_0x36ae47,_0x40028f){return function(_0x620ca7){if(_0x620ca7){var _0x5827ef=typeof _0x40028f[_0x8c5c('0x1d')]===_0x8c5c('0x1e')&&typeof _0x40028f['limit']===_0x8c5c('0x1e');var _0x2e7734=_0x620ca7['count'];var _0x3a8d0c=_0x5827ef?0x0:_0x40028f[_0x8c5c('0x1d')];var _0x64488=_0x5827ef?_0x620ca7['count']:_0x40028f[_0x8c5c('0x1d')]+_0x40028f[_0x8c5c('0x1f')];var _0x279fc5;if(_0x64488>=_0x2e7734){_0x64488=_0x2e7734;_0x279fc5=0xc8;}else{_0x279fc5=0xce;}_0x36ae47['status'](_0x279fc5);return _0x36ae47['set']('Content-Range',_0x3a8d0c+'-'+_0x64488+'/'+_0x2e7734)[_0x8c5c('0x1c')](_0x620ca7);}return null;};}function patchUpdates(_0x269699){return function(_0x5c906a){try{jsonpatch['apply'](_0x5c906a,_0x269699,!![]);}catch(_0x27d5d2){return BPromise[_0x8c5c('0x20')](_0x27d5d2);}return _0x5c906a[_0x8c5c('0x21')]();};}function saveUpdates(_0x265322,_0x33886){return function(_0x4081fd){if(_0x4081fd){return _0x4081fd[_0x8c5c('0x22')](_0x265322)[_0x8c5c('0x23')](function(_0x8f297f){return _0x8f297f;});}return null;};}function removeEntity(_0x4f0bec,_0x491e5b){return function(_0x23937e){if(_0x23937e){return _0x23937e['destroy']()[_0x8c5c('0x23')](function(){_0x4f0bec[_0x8c5c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1167ce,_0x350396){return function(_0x4834c2){if(!_0x4834c2){_0x1167ce[_0x8c5c('0x24')](0x194);}return _0x4834c2;};}function handleError(_0x53345a,_0x4f1190){_0x4f1190=_0x4f1190||0x1f4;return function(_0x43331a){logger[_0x8c5c('0x25')](_0x43331a[_0x8c5c('0x26')]);if(_0x43331a[_0x8c5c('0x27')]){delete _0x43331a[_0x8c5c('0x27')];}_0x53345a['status'](_0x4f1190)[_0x8c5c('0x28')](_0x43331a);};}exports['index']=function(_0x320d6f,_0x49dbb7){var _0x1faf14={},_0x8a27e8={},_0xe940aa={'count':0x0,'rows':[]};var _0x4632d2=_[_0x8c5c('0x29')](db[_0x8c5c('0x2a')][_0x8c5c('0x2b')],function(_0x392317){return{'name':_0x392317['fieldName'],'type':_0x392317[_0x8c5c('0x2c')][_0x8c5c('0x2d')]};});_0x8a27e8['model']=_[_0x8c5c('0x29')](_0x4632d2,'name');_0x8a27e8[_0x8c5c('0x2e')]=_[_0x8c5c('0x2f')](_0x320d6f[_0x8c5c('0x2e')]);_0x8a27e8[_0x8c5c('0x30')]=_[_0x8c5c('0x31')](_0x8a27e8[_0x8c5c('0x32')],_0x8a27e8[_0x8c5c('0x2e')]);_0x1faf14['attributes']=_[_0x8c5c('0x31')](_0x8a27e8[_0x8c5c('0x32')],qs[_0x8c5c('0x33')](_0x320d6f[_0x8c5c('0x2e')][_0x8c5c('0x33')]));_0x1faf14[_0x8c5c('0x34')]=_0x1faf14[_0x8c5c('0x34')]['length']?_0x1faf14['attributes']:_0x8a27e8[_0x8c5c('0x32')];if(!_0x320d6f['query'][_0x8c5c('0x35')]('nolimit')){_0x1faf14[_0x8c5c('0x1f')]=qs[_0x8c5c('0x1f')](_0x320d6f[_0x8c5c('0x2e')][_0x8c5c('0x1f')]);_0x1faf14[_0x8c5c('0x1d')]=qs[_0x8c5c('0x1d')](_0x320d6f[_0x8c5c('0x2e')][_0x8c5c('0x1d')]);}_0x1faf14[_0x8c5c('0x36')]=qs['sort'](_0x320d6f[_0x8c5c('0x2e')][_0x8c5c('0x37')]);_0x1faf14[_0x8c5c('0x38')]=qs['filters'](_[_0x8c5c('0x39')](_0x320d6f[_0x8c5c('0x2e')],_0x8a27e8[_0x8c5c('0x30')]),_0x4632d2);if(_0x320d6f[_0x8c5c('0x2e')]['filter']){_0x1faf14[_0x8c5c('0x38')]=_[_0x8c5c('0x3a')](_0x1faf14[_0x8c5c('0x38')],{'$or':_[_0x8c5c('0x29')](_0x4632d2,function(_0x42f89a){if(_0x42f89a[_0x8c5c('0x2c')]!==_0x8c5c('0x3b')){var _0x5be020={};_0x5be020[_0x42f89a['name']]={'$like':'%'+_0x320d6f[_0x8c5c('0x2e')][_0x8c5c('0x3c')]+'%'};return _0x5be020;}})});}_0x1faf14=_[_0x8c5c('0x3a')]({},_0x1faf14,_0x320d6f[_0x8c5c('0x3d')]);var _0x595e01={'where':_0x1faf14[_0x8c5c('0x38')]};return db[_0x8c5c('0x2a')][_0x8c5c('0x3e')](_0x595e01)['then'](function(_0x1f2383){_0xe940aa[_0x8c5c('0x3e')]=_0x1f2383;if(_0x320d6f['query']['includeAll']){_0x1faf14[_0x8c5c('0x3f')]=[{'all':!![]}];}return db[_0x8c5c('0x2a')][_0x8c5c('0x40')](_0x1faf14);})[_0x8c5c('0x23')](function(_0x567e19){_0xe940aa[_0x8c5c('0x41')]=_0x567e19;return _0xe940aa;})[_0x8c5c('0x23')](respondWithFilteredResult(_0x49dbb7,_0x1faf14))['catch'](handleError(_0x49dbb7,null));};exports[_0x8c5c('0x42')]=function(_0x18e86e,_0x560c4d){var _0x349235={'raw':![],'where':{'id':_0x18e86e[_0x8c5c('0x43')]['id']}},_0x3470ec={};_0x3470ec[_0x8c5c('0x32')]=_['keys'](db[_0x8c5c('0x2a')][_0x8c5c('0x2b')]);_0x3470ec['query']=_[_0x8c5c('0x2f')](_0x18e86e[_0x8c5c('0x2e')]);_0x3470ec[_0x8c5c('0x30')]=_[_0x8c5c('0x31')](_0x3470ec[_0x8c5c('0x32')],_0x3470ec[_0x8c5c('0x2e')]);_0x349235['attributes']=_[_0x8c5c('0x31')](_0x3470ec[_0x8c5c('0x32')],qs[_0x8c5c('0x33')](_0x18e86e[_0x8c5c('0x2e')]['fields']));_0x349235[_0x8c5c('0x34')]=_0x349235[_0x8c5c('0x34')][_0x8c5c('0x44')]?_0x349235[_0x8c5c('0x34')]:_0x3470ec['model'];if(_0x18e86e[_0x8c5c('0x2e')][_0x8c5c('0x45')]){_0x349235[_0x8c5c('0x3f')]=[{'all':!![]}];}_0x349235=_[_0x8c5c('0x3a')]({},_0x349235,_0x18e86e[_0x8c5c('0x3d')]);return db[_0x8c5c('0x2a')][_0x8c5c('0x46')](_0x349235)[_0x8c5c('0x23')](handleEntityNotFound(_0x560c4d,null))[_0x8c5c('0x23')](respondWithResult(_0x560c4d,null))[_0x8c5c('0x47')](handleError(_0x560c4d,null));};exports[_0x8c5c('0x48')]=function(_0x2b3973,_0x3bea73){return db[_0x8c5c('0x2a')][_0x8c5c('0x48')](_0x2b3973['body'],{})[_0x8c5c('0x23')](respondWithResult(_0x3bea73,0xc9))[_0x8c5c('0x47')](handleError(_0x3bea73,null));};exports[_0x8c5c('0x22')]=function(_0x4bbc78,_0x44a6d7){if(_0x4bbc78[_0x8c5c('0x49')]['id']){delete _0x4bbc78[_0x8c5c('0x49')]['id'];}return db[_0x8c5c('0x2a')]['find']({'where':{'id':_0x4bbc78[_0x8c5c('0x43')]['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0x44a6d7,null))[_0x8c5c('0x23')](saveUpdates(_0x4bbc78[_0x8c5c('0x49')],null))['then'](respondWithResult(_0x44a6d7,null))['catch'](handleError(_0x44a6d7,null));};exports[_0x8c5c('0x4a')]=function(_0x1f4d6b,_0xb46152){return db[_0x8c5c('0x2a')]['find']({'where':{'id':_0x1f4d6b[_0x8c5c('0x43')]['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0xb46152,null))[_0x8c5c('0x23')](removeEntity(_0xb46152,null))[_0x8c5c('0x47')](handleError(_0xb46152,null));};exports[_0x8c5c('0x4b')]=function(_0x5c17d0,_0x5f29f9,_0x4be38a){var _0x5643c7={};var _0x56b9f5={};var _0x738f65;var _0x1f1716;return db['FreshdeskConfiguration'][_0x8c5c('0x4c')]({'where':{'id':_0x5c17d0[_0x8c5c('0x43')]['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0x5f29f9,null))[_0x8c5c('0x23')](function(_0xd497ff){if(_0xd497ff){_0x738f65=_0xd497ff;_0x56b9f5[_0x8c5c('0x32')]=_['keys'](db[_0x8c5c('0x4d')][_0x8c5c('0x2b')]);_0x56b9f5[_0x8c5c('0x2e')]=_[_0x8c5c('0x2f')](_0x5c17d0[_0x8c5c('0x2e')]);_0x56b9f5[_0x8c5c('0x30')]=_['intersection'](_0x56b9f5[_0x8c5c('0x32')],_0x56b9f5[_0x8c5c('0x2e')]);_0x5643c7[_0x8c5c('0x34')]=_[_0x8c5c('0x31')](_0x56b9f5[_0x8c5c('0x32')],qs[_0x8c5c('0x33')](_0x5c17d0['query'][_0x8c5c('0x33')]));_0x5643c7[_0x8c5c('0x34')]=_0x5643c7[_0x8c5c('0x34')][_0x8c5c('0x44')]?_0x5643c7['attributes']:_0x56b9f5[_0x8c5c('0x32')];_0x5643c7[_0x8c5c('0x36')]=qs[_0x8c5c('0x37')](_0x5c17d0['query']['sort']);_0x5643c7[_0x8c5c('0x38')]=qs[_0x8c5c('0x30')](_[_0x8c5c('0x39')](_0x5c17d0['query'],_0x56b9f5[_0x8c5c('0x30')]));if(_0x5c17d0[_0x8c5c('0x2e')][_0x8c5c('0x3c')]){_0x5643c7[_0x8c5c('0x38')]=_[_0x8c5c('0x3a')](_0x5643c7['where'],{'$or':_[_0x8c5c('0x29')](_0x5643c7[_0x8c5c('0x34')],function(_0x3aa1f5){var _0x8f0a24={};_0x8f0a24[_0x3aa1f5]={'$like':'%'+_0x5c17d0[_0x8c5c('0x2e')][_0x8c5c('0x3c')]+'%'};return _0x8f0a24;})});}_0x5643c7=_['merge']({},_0x5643c7,_0x5c17d0[_0x8c5c('0x3d')]);return _0x738f65[_0x8c5c('0x4b')](_0x5643c7);}})[_0x8c5c('0x23')](function(_0x3525f9){if(_0x3525f9){_0x1f1716=_0x3525f9[_0x8c5c('0x44')];if(!_0x5c17d0['query']['hasOwnProperty'](_0x8c5c('0x4e'))){_0x5643c7[_0x8c5c('0x1f')]=qs['limit'](_0x5c17d0[_0x8c5c('0x2e')][_0x8c5c('0x1f')]);_0x5643c7['offset']=qs[_0x8c5c('0x1d')](_0x5c17d0['query'][_0x8c5c('0x1d')]);}return _0x738f65[_0x8c5c('0x4b')](_0x5643c7);}})[_0x8c5c('0x23')](function(_0x386392){if(_0x386392){return _0x386392?{'count':_0x1f1716,'rows':_0x386392}:null;}})[_0x8c5c('0x23')](respondWithResult(_0x5f29f9,null))[_0x8c5c('0x47')](handleError(_0x5f29f9,null));};exports[_0x8c5c('0x4f')]=function(_0x24c417,_0x2eadaf,_0x501a8c){var _0x4a84a9={};var _0x308ac3={};var _0x42c1d6;var _0x374d20;return db[_0x8c5c('0x2a')]['findOne']({'where':{'id':_0x24c417[_0x8c5c('0x43')]['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0x2eadaf,null))[_0x8c5c('0x23')](function(_0x3e3722){if(_0x3e3722){_0x42c1d6=_0x3e3722;_0x308ac3[_0x8c5c('0x32')]=_[_0x8c5c('0x2f')](db[_0x8c5c('0x4d')]['rawAttributes']);_0x308ac3['query']=_['keys'](_0x24c417[_0x8c5c('0x2e')]);_0x308ac3[_0x8c5c('0x30')]=_[_0x8c5c('0x31')](_0x308ac3[_0x8c5c('0x32')],_0x308ac3[_0x8c5c('0x2e')]);_0x4a84a9['attributes']=_[_0x8c5c('0x31')](_0x308ac3[_0x8c5c('0x32')],qs[_0x8c5c('0x33')](_0x24c417['query']['fields']));_0x4a84a9[_0x8c5c('0x34')]=_0x4a84a9[_0x8c5c('0x34')][_0x8c5c('0x44')]?_0x4a84a9[_0x8c5c('0x34')]:_0x308ac3['model'];_0x4a84a9[_0x8c5c('0x36')]=qs[_0x8c5c('0x37')](_0x24c417[_0x8c5c('0x2e')][_0x8c5c('0x37')]);_0x4a84a9[_0x8c5c('0x38')]=qs[_0x8c5c('0x30')](_[_0x8c5c('0x39')](_0x24c417[_0x8c5c('0x2e')],_0x308ac3[_0x8c5c('0x30')]));if(_0x24c417[_0x8c5c('0x2e')]['filter']){_0x4a84a9[_0x8c5c('0x38')]=_[_0x8c5c('0x3a')](_0x4a84a9[_0x8c5c('0x38')],{'$or':_[_0x8c5c('0x29')](_0x4a84a9['attributes'],function(_0xa9175f){var _0x21b510={};_0x21b510[_0xa9175f]={'$like':'%'+_0x24c417[_0x8c5c('0x2e')]['filter']+'%'};return _0x21b510;})});}_0x4a84a9=_['merge']({},_0x4a84a9,_0x24c417['options']);return _0x42c1d6['getSubjects'](_0x4a84a9);}})[_0x8c5c('0x23')](function(_0x15a83d){if(_0x15a83d){_0x374d20=_0x15a83d[_0x8c5c('0x44')];if(!_0x24c417[_0x8c5c('0x2e')]['hasOwnProperty'](_0x8c5c('0x4e'))){_0x4a84a9[_0x8c5c('0x1f')]=qs['limit'](_0x24c417[_0x8c5c('0x2e')][_0x8c5c('0x1f')]);_0x4a84a9[_0x8c5c('0x1d')]=qs[_0x8c5c('0x1d')](_0x24c417[_0x8c5c('0x2e')][_0x8c5c('0x1d')]);}return _0x42c1d6[_0x8c5c('0x4f')](_0x4a84a9);}})['then'](function(_0x280547){if(_0x280547){return _0x280547?{'count':_0x374d20,'rows':_0x280547}:null;}})['then'](respondWithResult(_0x2eadaf,null))[_0x8c5c('0x47')](handleError(_0x2eadaf,null));};exports['getDescriptions']=function(_0x31e9a1,_0x3e6b1b,_0x12e723){var _0x3c8b0d={};var _0x557958={};var _0x379e84;var _0x583b70;return db[_0x8c5c('0x2a')]['findOne']({'where':{'id':_0x31e9a1[_0x8c5c('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e6b1b,null))[_0x8c5c('0x23')](function(_0x245223){if(_0x245223){_0x379e84=_0x245223;_0x557958[_0x8c5c('0x32')]=_[_0x8c5c('0x2f')](db[_0x8c5c('0x4d')][_0x8c5c('0x2b')]);_0x557958['query']=_['keys'](_0x31e9a1['query']);_0x557958[_0x8c5c('0x30')]=_[_0x8c5c('0x31')](_0x557958[_0x8c5c('0x32')],_0x557958['query']);_0x3c8b0d[_0x8c5c('0x34')]=_[_0x8c5c('0x31')](_0x557958[_0x8c5c('0x32')],qs['fields'](_0x31e9a1[_0x8c5c('0x2e')][_0x8c5c('0x33')]));_0x3c8b0d[_0x8c5c('0x34')]=_0x3c8b0d[_0x8c5c('0x34')][_0x8c5c('0x44')]?_0x3c8b0d[_0x8c5c('0x34')]:_0x557958[_0x8c5c('0x32')];_0x3c8b0d[_0x8c5c('0x36')]=qs['sort'](_0x31e9a1[_0x8c5c('0x2e')][_0x8c5c('0x37')]);_0x3c8b0d['where']=qs[_0x8c5c('0x30')](_[_0x8c5c('0x39')](_0x31e9a1[_0x8c5c('0x2e')],_0x557958[_0x8c5c('0x30')]));if(_0x31e9a1[_0x8c5c('0x2e')][_0x8c5c('0x3c')]){_0x3c8b0d[_0x8c5c('0x38')]=_[_0x8c5c('0x3a')](_0x3c8b0d['where'],{'$or':_[_0x8c5c('0x29')](_0x3c8b0d[_0x8c5c('0x34')],function(_0x58a96a){var _0x39375c={};_0x39375c[_0x58a96a]={'$like':'%'+_0x31e9a1[_0x8c5c('0x2e')][_0x8c5c('0x3c')]+'%'};return _0x39375c;})});}_0x3c8b0d=_['merge']({},_0x3c8b0d,_0x31e9a1[_0x8c5c('0x3d')]);return _0x379e84[_0x8c5c('0x50')](_0x3c8b0d);}})['then'](function(_0x54843b){if(_0x54843b){_0x583b70=_0x54843b[_0x8c5c('0x44')];if(!_0x31e9a1[_0x8c5c('0x2e')]['hasOwnProperty'](_0x8c5c('0x4e'))){_0x3c8b0d[_0x8c5c('0x1f')]=qs[_0x8c5c('0x1f')](_0x31e9a1[_0x8c5c('0x2e')][_0x8c5c('0x1f')]);_0x3c8b0d['offset']=qs['offset'](_0x31e9a1['query'][_0x8c5c('0x1d')]);}return _0x379e84[_0x8c5c('0x50')](_0x3c8b0d);}})[_0x8c5c('0x23')](function(_0x19ad39){if(_0x19ad39){return _0x19ad39?{'count':_0x583b70,'rows':_0x19ad39}:null;}})['then'](respondWithResult(_0x3e6b1b,null))[_0x8c5c('0x47')](handleError(_0x3e6b1b,null));};exports[_0x8c5c('0x51')]=function(_0x5c4413,_0x241755,_0x172386){var _0x478a19={};var _0x62395a={};var _0xf533b8;var _0x290555;return db[_0x8c5c('0x2a')]['findOne']({'where':{'id':_0x5c4413[_0x8c5c('0x43')]['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0x241755,null))[_0x8c5c('0x23')](function(_0x446541){if(_0x446541){_0xf533b8=_0x446541;_0x62395a['model']=_[_0x8c5c('0x2f')](db[_0x8c5c('0x52')][_0x8c5c('0x2b')]);_0x62395a['query']=_[_0x8c5c('0x2f')](_0x5c4413[_0x8c5c('0x2e')]);_0x62395a[_0x8c5c('0x30')]=_['intersection'](_0x62395a[_0x8c5c('0x32')],_0x62395a[_0x8c5c('0x2e')]);_0x478a19[_0x8c5c('0x34')]=_[_0x8c5c('0x31')](_0x62395a[_0x8c5c('0x32')],qs['fields'](_0x5c4413[_0x8c5c('0x2e')]['fields']));_0x478a19[_0x8c5c('0x34')]=_0x478a19['attributes'][_0x8c5c('0x44')]?_0x478a19[_0x8c5c('0x34')]:_0x62395a[_0x8c5c('0x32')];_0x478a19[_0x8c5c('0x36')]=qs[_0x8c5c('0x37')](_0x5c4413[_0x8c5c('0x2e')][_0x8c5c('0x37')]);_0x478a19[_0x8c5c('0x38')]=qs['filters'](_[_0x8c5c('0x39')](_0x5c4413[_0x8c5c('0x2e')],_0x62395a[_0x8c5c('0x30')]));if(_0x5c4413[_0x8c5c('0x2e')]['filter']){_0x478a19['where']=_[_0x8c5c('0x3a')](_0x478a19[_0x8c5c('0x38')],{'$or':_[_0x8c5c('0x29')](_0x478a19[_0x8c5c('0x34')],function(_0x2e1015){var _0x1a6d82={};_0x1a6d82[_0x2e1015]={'$like':'%'+_0x5c4413[_0x8c5c('0x2e')][_0x8c5c('0x3c')]+'%'};return _0x1a6d82;})});}_0x478a19=_['merge']({},_0x478a19,_0x5c4413[_0x8c5c('0x3d')]);return _0xf533b8[_0x8c5c('0x51')](_0x478a19);}})['then'](function(_0x48694f){if(_0x48694f){_0x290555=_0x48694f['length'];if(!_0x5c4413[_0x8c5c('0x2e')][_0x8c5c('0x35')](_0x8c5c('0x4e'))){_0x478a19[_0x8c5c('0x1f')]=qs[_0x8c5c('0x1f')](_0x5c4413[_0x8c5c('0x2e')][_0x8c5c('0x1f')]);_0x478a19[_0x8c5c('0x1d')]=qs[_0x8c5c('0x1d')](_0x5c4413['query'][_0x8c5c('0x1d')]);}return _0xf533b8['getTags'](_0x478a19);}})[_0x8c5c('0x23')](function(_0x187c1){if(_0x187c1){return _0x187c1?{'count':_0x290555,'rows':_0x187c1}:null;}})['then'](respondWithResult(_0x241755,null))[_0x8c5c('0x47')](handleError(_0x241755,null));};exports[_0x8c5c('0x53')]=function(_0x3b7f7d,_0x3af460,_0x4d63f5){if(_0x3b7f7d[_0x8c5c('0x49')]['id']){delete _0x3b7f7d[_0x8c5c('0x49')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3b7f7d['params']['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0x3af460,null))[_0x8c5c('0x23')](function(_0x208b0c){if(_0x208b0c){return _0x208b0c[_0x8c5c('0x53')](_0x3b7f7d['body'][_0x8c5c('0x54')]||[]);}return null;})['then'](respondWithResult(_0x3af460,null))[_0x8c5c('0x47')](handleError(_0x3af460,null));}; \ No newline at end of file +var _0xe0dc=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','model','query','keys','intersection','attributes','nolimit','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','fields','order','hasOwnProperty','pick','getSubjects','getDescriptions','FreshdeskField','getTags','Tag','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe0dc,0x190));var _0xce0d=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0xe0dc[_0xf34b0a];return _0x5021e1;};'use strict';var emlformat=require(_0xce0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce0d('0x1'));var jsonpatch=require(_0xce0d('0x2'));var rp=require('request-promise');var moment=require(_0xce0d('0x3'));var BPromise=require(_0xce0d('0x4'));var Mustache=require(_0xce0d('0x5'));var util=require(_0xce0d('0x6'));var path=require('path');var sox=require(_0xce0d('0x7'));var csv=require('to-csv');var ejs=require(_0xce0d('0x8'));var fs=require('fs');var fs_extra=require(_0xce0d('0x9'));var _=require(_0xce0d('0xa'));var squel=require(_0xce0d('0xb'));var crypto=require(_0xce0d('0xc'));var jsforce=require(_0xce0d('0xd'));var deskjs=require(_0xce0d('0xe'));var toCsv=require(_0xce0d('0xf'));var querystring=require(_0xce0d('0x10'));var Papa=require(_0xce0d('0x11'));var Redis=require(_0xce0d('0x12'));var authService=require(_0xce0d('0x13'));var qs=require(_0xce0d('0x14'));var as=require(_0xce0d('0x15'));var hardwareService=require(_0xce0d('0x16'));var logger=require(_0xce0d('0x17'))(_0xce0d('0x18'));var utils=require(_0xce0d('0x19'));var config=require(_0xce0d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xce0d('0x1b'))['db'];function respondWithStatusCode(_0x419b8a,_0x2a802c){_0x2a802c=_0x2a802c||0xcc;return function(_0x29a87c){if(_0x29a87c){return _0x419b8a[_0xce0d('0x1c')](_0x2a802c);}return _0x419b8a[_0xce0d('0x1d')](_0x2a802c)[_0xce0d('0x1e')]();};}function respondWithResult(_0x178400,_0x18a96e){_0x18a96e=_0x18a96e||0xc8;return function(_0xfba354){if(_0xfba354){return _0x178400[_0xce0d('0x1d')](_0x18a96e)[_0xce0d('0x1f')](_0xfba354);}};}function respondWithFilteredResult(_0x2a2f69,_0x3bedc2){return function(_0xef9e5f){if(_0xef9e5f){var _0x176c81=typeof _0x3bedc2[_0xce0d('0x20')]===_0xce0d('0x21')&&typeof _0x3bedc2[_0xce0d('0x22')]===_0xce0d('0x21');var _0x2044df=_0xef9e5f[_0xce0d('0x23')];var _0x1dc8aa=_0x176c81?0x0:_0x3bedc2[_0xce0d('0x20')];var _0x3378f2=_0x176c81?_0xef9e5f[_0xce0d('0x23')]:_0x3bedc2[_0xce0d('0x20')]+_0x3bedc2[_0xce0d('0x22')];var _0x37aae8;if(_0x3378f2>=_0x2044df){_0x3378f2=_0x2044df;_0x37aae8=0xc8;}else{_0x37aae8=0xce;}_0x2a2f69[_0xce0d('0x1d')](_0x37aae8);return _0x2a2f69[_0xce0d('0x24')](_0xce0d('0x25'),_0x1dc8aa+'-'+_0x3378f2+'/'+_0x2044df)[_0xce0d('0x1f')](_0xef9e5f);}return null;};}function patchUpdates(_0x1fb46d){return function(_0x8388e3){try{jsonpatch[_0xce0d('0x26')](_0x8388e3,_0x1fb46d,!![]);}catch(_0x16788f){return BPromise['reject'](_0x16788f);}return _0x8388e3['save']();};}function saveUpdates(_0xa0277a,_0x4da3f6){return function(_0x2727c2){if(_0x2727c2){return _0x2727c2[_0xce0d('0x27')](_0xa0277a)[_0xce0d('0x28')](function(_0x58d7c5){return _0x58d7c5;});}return null;};}function removeEntity(_0x1ff817,_0x542d3d){return function(_0x298f3e){if(_0x298f3e){return _0x298f3e['destroy']()[_0xce0d('0x28')](function(){_0x1ff817[_0xce0d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x516609,_0x31300f){return function(_0x201167){if(!_0x201167){_0x516609[_0xce0d('0x1c')](0x194);}return _0x201167;};}function handleError(_0x41b228,_0xdab05c){_0xdab05c=_0xdab05c||0x1f4;return function(_0x4cbaf4){logger[_0xce0d('0x29')](_0x4cbaf4[_0xce0d('0x2a')]);if(_0x4cbaf4[_0xce0d('0x2b')]){delete _0x4cbaf4['name'];}_0x41b228[_0xce0d('0x1d')](_0xdab05c)['send'](_0x4cbaf4);};}exports[_0xce0d('0x2c')]=function(_0x1eb234,_0x328842){var _0x435fd2={},_0x1a7f8c={},_0x3c4ec8={'count':0x0,'rows':[]};var _0x2c9c1b=_[_0xce0d('0x2d')](db[_0xce0d('0x2e')][_0xce0d('0x2f')],function(_0x4171cb){return{'name':_0x4171cb[_0xce0d('0x30')],'type':_0x4171cb['type']['key']};});_0x1a7f8c[_0xce0d('0x31')]=_[_0xce0d('0x2d')](_0x2c9c1b,_0xce0d('0x2b'));_0x1a7f8c[_0xce0d('0x32')]=_[_0xce0d('0x33')](_0x1eb234['query']);_0x1a7f8c['filters']=_[_0xce0d('0x34')](_0x1a7f8c[_0xce0d('0x31')],_0x1a7f8c['query']);_0x435fd2['attributes']=_['intersection'](_0x1a7f8c[_0xce0d('0x31')],qs['fields'](_0x1eb234['query']['fields']));_0x435fd2[_0xce0d('0x35')]=_0x435fd2['attributes']['length']?_0x435fd2['attributes']:_0x1a7f8c['model'];if(!_0x1eb234['query']['hasOwnProperty'](_0xce0d('0x36'))){_0x435fd2[_0xce0d('0x22')]=qs[_0xce0d('0x22')](_0x1eb234[_0xce0d('0x32')][_0xce0d('0x22')]);_0x435fd2[_0xce0d('0x20')]=qs[_0xce0d('0x20')](_0x1eb234[_0xce0d('0x32')][_0xce0d('0x20')]);}_0x435fd2['order']=qs[_0xce0d('0x37')](_0x1eb234[_0xce0d('0x32')]['sort']);_0x435fd2[_0xce0d('0x38')]=qs[_0xce0d('0x39')](_['pick'](_0x1eb234['query'],_0x1a7f8c[_0xce0d('0x39')]),_0x2c9c1b);if(_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3a')]){_0x435fd2[_0xce0d('0x38')]=_[_0xce0d('0x3b')](_0x435fd2['where'],{'$or':_['map'](_0x2c9c1b,function(_0x27d599){if(_0x27d599[_0xce0d('0x3c')]!=='VIRTUAL'){var _0x4d4297={};_0x4d4297[_0x27d599[_0xce0d('0x2b')]]={'$like':'%'+_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3a')]+'%'};return _0x4d4297;}})});}_0x435fd2=_[_0xce0d('0x3b')]({},_0x435fd2,_0x1eb234[_0xce0d('0x3d')]);var _0x1cfa6c={'where':_0x435fd2['where']};return db[_0xce0d('0x2e')][_0xce0d('0x23')](_0x1cfa6c)[_0xce0d('0x28')](function(_0x18a56f){_0x3c4ec8[_0xce0d('0x23')]=_0x18a56f;if(_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3e')]){_0x435fd2[_0xce0d('0x3f')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xce0d('0x40')](_0x435fd2);})['then'](function(_0x6352f9){_0x3c4ec8[_0xce0d('0x41')]=_0x6352f9;return _0x3c4ec8;})[_0xce0d('0x28')](respondWithFilteredResult(_0x328842,_0x435fd2))[_0xce0d('0x42')](handleError(_0x328842,null));};exports[_0xce0d('0x43')]=function(_0x4abd42,_0x118d68){var _0x1d19ed={'raw':![],'where':{'id':_0x4abd42[_0xce0d('0x44')]['id']}},_0x5457d8={};_0x5457d8['model']=_[_0xce0d('0x33')](db[_0xce0d('0x2e')][_0xce0d('0x2f')]);_0x5457d8['query']=_[_0xce0d('0x33')](_0x4abd42[_0xce0d('0x32')]);_0x5457d8['filters']=_['intersection'](_0x5457d8[_0xce0d('0x31')],_0x5457d8[_0xce0d('0x32')]);_0x1d19ed[_0xce0d('0x35')]=_[_0xce0d('0x34')](_0x5457d8[_0xce0d('0x31')],qs['fields'](_0x4abd42['query']['fields']));_0x1d19ed[_0xce0d('0x35')]=_0x1d19ed[_0xce0d('0x35')][_0xce0d('0x45')]?_0x1d19ed[_0xce0d('0x35')]:_0x5457d8[_0xce0d('0x31')];if(_0x4abd42[_0xce0d('0x32')][_0xce0d('0x3e')]){_0x1d19ed['include']=[{'all':!![]}];}_0x1d19ed=_['merge']({},_0x1d19ed,_0x4abd42[_0xce0d('0x3d')]);return db[_0xce0d('0x2e')][_0xce0d('0x46')](_0x1d19ed)[_0xce0d('0x28')](handleEntityNotFound(_0x118d68,null))[_0xce0d('0x28')](respondWithResult(_0x118d68,null))[_0xce0d('0x42')](handleError(_0x118d68,null));};exports[_0xce0d('0x47')]=function(_0x47daa0,_0x362827){return db['FreshdeskConfiguration']['create'](_0x47daa0[_0xce0d('0x48')],{})[_0xce0d('0x28')](respondWithResult(_0x362827,0xc9))[_0xce0d('0x42')](handleError(_0x362827,null));};exports['update']=function(_0x641547,_0x36f502){if(_0x641547['body']['id']){delete _0x641547[_0xce0d('0x48')]['id'];}return db[_0xce0d('0x2e')][_0xce0d('0x46')]({'where':{'id':_0x641547[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x36f502,null))[_0xce0d('0x28')](saveUpdates(_0x641547[_0xce0d('0x48')],null))[_0xce0d('0x28')](respondWithResult(_0x36f502,null))[_0xce0d('0x42')](handleError(_0x36f502,null));};exports['destroy']=function(_0x327487,_0x4438e3){return db[_0xce0d('0x2e')][_0xce0d('0x46')]({'where':{'id':_0x327487['params']['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x4438e3,null))[_0xce0d('0x28')](removeEntity(_0x4438e3,null))['catch'](handleError(_0x4438e3,null));};exports[_0xce0d('0x49')]=function(_0x546126,_0x15a49b,_0x5dbdd7){var _0x5a2653={};var _0x37c636={};var _0x4632a1;var _0x3d9c12;return db[_0xce0d('0x2e')][_0xce0d('0x4a')]({'where':{'id':_0x546126[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x15a49b,null))[_0xce0d('0x28')](function(_0x18fb01){if(_0x18fb01){_0x4632a1=_0x18fb01;_0x37c636[_0xce0d('0x31')]=_['keys'](db['FreshdeskField'][_0xce0d('0x2f')]);_0x37c636[_0xce0d('0x32')]=_[_0xce0d('0x33')](_0x546126[_0xce0d('0x32')]);_0x37c636[_0xce0d('0x39')]=_[_0xce0d('0x34')](_0x37c636[_0xce0d('0x31')],_0x37c636[_0xce0d('0x32')]);_0x5a2653['attributes']=_[_0xce0d('0x34')](_0x37c636[_0xce0d('0x31')],qs[_0xce0d('0x4b')](_0x546126[_0xce0d('0x32')][_0xce0d('0x4b')]));_0x5a2653[_0xce0d('0x35')]=_0x5a2653['attributes']['length']?_0x5a2653['attributes']:_0x37c636['model'];_0x5a2653[_0xce0d('0x4c')]=qs['sort'](_0x546126[_0xce0d('0x32')][_0xce0d('0x37')]);_0x5a2653[_0xce0d('0x38')]=qs['filters'](_['pick'](_0x546126[_0xce0d('0x32')],_0x37c636[_0xce0d('0x39')]));if(_0x546126[_0xce0d('0x32')]['filter']){_0x5a2653[_0xce0d('0x38')]=_['merge'](_0x5a2653[_0xce0d('0x38')],{'$or':_['map'](_0x5a2653[_0xce0d('0x35')],function(_0x3430a9){var _0x298868={};_0x298868[_0x3430a9]={'$like':'%'+_0x546126[_0xce0d('0x32')]['filter']+'%'};return _0x298868;})});}_0x5a2653=_[_0xce0d('0x3b')]({},_0x5a2653,_0x546126[_0xce0d('0x3d')]);return _0x4632a1[_0xce0d('0x49')](_0x5a2653);}})['then'](function(_0x414d0b){if(_0x414d0b){_0x3d9c12=_0x414d0b[_0xce0d('0x45')];if(!_0x546126[_0xce0d('0x32')][_0xce0d('0x4d')]('nolimit')){_0x5a2653['limit']=qs['limit'](_0x546126[_0xce0d('0x32')][_0xce0d('0x22')]);_0x5a2653[_0xce0d('0x20')]=qs['offset'](_0x546126[_0xce0d('0x32')][_0xce0d('0x20')]);}return _0x4632a1['getFields'](_0x5a2653);}})[_0xce0d('0x28')](function(_0x18f240){if(_0x18f240){return _0x18f240?{'count':_0x3d9c12,'rows':_0x18f240}:null;}})[_0xce0d('0x28')](respondWithResult(_0x15a49b,null))[_0xce0d('0x42')](handleError(_0x15a49b,null));};exports['getSubjects']=function(_0x102da1,_0x52abba,_0x500b0b){var _0x15382d={};var _0x313d3a={};var _0x119204;var _0x3b6624;return db['FreshdeskConfiguration'][_0xce0d('0x4a')]({'where':{'id':_0x102da1[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x52abba,null))[_0xce0d('0x28')](function(_0x130ac4){if(_0x130ac4){_0x119204=_0x130ac4;_0x313d3a['model']=_[_0xce0d('0x33')](db['FreshdeskField'][_0xce0d('0x2f')]);_0x313d3a['query']=_[_0xce0d('0x33')](_0x102da1[_0xce0d('0x32')]);_0x313d3a[_0xce0d('0x39')]=_[_0xce0d('0x34')](_0x313d3a['model'],_0x313d3a[_0xce0d('0x32')]);_0x15382d[_0xce0d('0x35')]=_[_0xce0d('0x34')](_0x313d3a[_0xce0d('0x31')],qs[_0xce0d('0x4b')](_0x102da1[_0xce0d('0x32')][_0xce0d('0x4b')]));_0x15382d['attributes']=_0x15382d['attributes']['length']?_0x15382d['attributes']:_0x313d3a[_0xce0d('0x31')];_0x15382d[_0xce0d('0x4c')]=qs[_0xce0d('0x37')](_0x102da1[_0xce0d('0x32')][_0xce0d('0x37')]);_0x15382d[_0xce0d('0x38')]=qs['filters'](_[_0xce0d('0x4e')](_0x102da1[_0xce0d('0x32')],_0x313d3a[_0xce0d('0x39')]));if(_0x102da1[_0xce0d('0x32')][_0xce0d('0x3a')]){_0x15382d['where']=_[_0xce0d('0x3b')](_0x15382d[_0xce0d('0x38')],{'$or':_[_0xce0d('0x2d')](_0x15382d[_0xce0d('0x35')],function(_0x1f002a){var _0x11d6a1={};_0x11d6a1[_0x1f002a]={'$like':'%'+_0x102da1['query'][_0xce0d('0x3a')]+'%'};return _0x11d6a1;})});}_0x15382d=_[_0xce0d('0x3b')]({},_0x15382d,_0x102da1['options']);return _0x119204['getSubjects'](_0x15382d);}})[_0xce0d('0x28')](function(_0x507f74){if(_0x507f74){_0x3b6624=_0x507f74[_0xce0d('0x45')];if(!_0x102da1['query'][_0xce0d('0x4d')](_0xce0d('0x36'))){_0x15382d['limit']=qs[_0xce0d('0x22')](_0x102da1['query'][_0xce0d('0x22')]);_0x15382d['offset']=qs[_0xce0d('0x20')](_0x102da1[_0xce0d('0x32')]['offset']);}return _0x119204[_0xce0d('0x4f')](_0x15382d);}})[_0xce0d('0x28')](function(_0xa05091){if(_0xa05091){return _0xa05091?{'count':_0x3b6624,'rows':_0xa05091}:null;}})['then'](respondWithResult(_0x52abba,null))[_0xce0d('0x42')](handleError(_0x52abba,null));};exports[_0xce0d('0x50')]=function(_0x3e87af,_0x42fe3b,_0xc4278){var _0x836090={};var _0x34e54d={};var _0x250f55;var _0x5266e1;return db[_0xce0d('0x2e')][_0xce0d('0x4a')]({'where':{'id':_0x3e87af[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x42fe3b,null))[_0xce0d('0x28')](function(_0x444fd0){if(_0x444fd0){_0x250f55=_0x444fd0;_0x34e54d[_0xce0d('0x31')]=_[_0xce0d('0x33')](db[_0xce0d('0x51')]['rawAttributes']);_0x34e54d[_0xce0d('0x32')]=_[_0xce0d('0x33')](_0x3e87af[_0xce0d('0x32')]);_0x34e54d[_0xce0d('0x39')]=_[_0xce0d('0x34')](_0x34e54d[_0xce0d('0x31')],_0x34e54d[_0xce0d('0x32')]);_0x836090['attributes']=_[_0xce0d('0x34')](_0x34e54d[_0xce0d('0x31')],qs[_0xce0d('0x4b')](_0x3e87af['query'][_0xce0d('0x4b')]));_0x836090[_0xce0d('0x35')]=_0x836090[_0xce0d('0x35')][_0xce0d('0x45')]?_0x836090[_0xce0d('0x35')]:_0x34e54d[_0xce0d('0x31')];_0x836090[_0xce0d('0x4c')]=qs[_0xce0d('0x37')](_0x3e87af[_0xce0d('0x32')][_0xce0d('0x37')]);_0x836090[_0xce0d('0x38')]=qs[_0xce0d('0x39')](_[_0xce0d('0x4e')](_0x3e87af[_0xce0d('0x32')],_0x34e54d[_0xce0d('0x39')]));if(_0x3e87af[_0xce0d('0x32')][_0xce0d('0x3a')]){_0x836090[_0xce0d('0x38')]=_[_0xce0d('0x3b')](_0x836090[_0xce0d('0x38')],{'$or':_[_0xce0d('0x2d')](_0x836090[_0xce0d('0x35')],function(_0x8059af){var _0x3e4d91={};_0x3e4d91[_0x8059af]={'$like':'%'+_0x3e87af[_0xce0d('0x32')]['filter']+'%'};return _0x3e4d91;})});}_0x836090=_[_0xce0d('0x3b')]({},_0x836090,_0x3e87af[_0xce0d('0x3d')]);return _0x250f55['getDescriptions'](_0x836090);}})[_0xce0d('0x28')](function(_0x58fd87){if(_0x58fd87){_0x5266e1=_0x58fd87[_0xce0d('0x45')];if(!_0x3e87af['query'][_0xce0d('0x4d')](_0xce0d('0x36'))){_0x836090['limit']=qs['limit'](_0x3e87af[_0xce0d('0x32')]['limit']);_0x836090[_0xce0d('0x20')]=qs['offset'](_0x3e87af[_0xce0d('0x32')]['offset']);}return _0x250f55[_0xce0d('0x50')](_0x836090);}})['then'](function(_0x2a3800){if(_0x2a3800){return _0x2a3800?{'count':_0x5266e1,'rows':_0x2a3800}:null;}})[_0xce0d('0x28')](respondWithResult(_0x42fe3b,null))[_0xce0d('0x42')](handleError(_0x42fe3b,null));};exports[_0xce0d('0x52')]=function(_0x8f36bb,_0x208679,_0x53d32e){var _0x2573de={};var _0x55ea8d={};var _0xbd36af;var _0x5ad7b5;return db['FreshdeskConfiguration'][_0xce0d('0x4a')]({'where':{'id':_0x8f36bb[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x208679,null))[_0xce0d('0x28')](function(_0x41ba80){if(_0x41ba80){_0xbd36af=_0x41ba80;_0x55ea8d[_0xce0d('0x31')]=_['keys'](db[_0xce0d('0x53')][_0xce0d('0x2f')]);_0x55ea8d[_0xce0d('0x32')]=_[_0xce0d('0x33')](_0x8f36bb[_0xce0d('0x32')]);_0x55ea8d[_0xce0d('0x39')]=_[_0xce0d('0x34')](_0x55ea8d[_0xce0d('0x31')],_0x55ea8d[_0xce0d('0x32')]);_0x2573de[_0xce0d('0x35')]=_['intersection'](_0x55ea8d[_0xce0d('0x31')],qs[_0xce0d('0x4b')](_0x8f36bb['query'][_0xce0d('0x4b')]));_0x2573de[_0xce0d('0x35')]=_0x2573de[_0xce0d('0x35')][_0xce0d('0x45')]?_0x2573de[_0xce0d('0x35')]:_0x55ea8d[_0xce0d('0x31')];_0x2573de[_0xce0d('0x4c')]=qs[_0xce0d('0x37')](_0x8f36bb[_0xce0d('0x32')][_0xce0d('0x37')]);_0x2573de[_0xce0d('0x38')]=qs['filters'](_[_0xce0d('0x4e')](_0x8f36bb['query'],_0x55ea8d[_0xce0d('0x39')]));if(_0x8f36bb[_0xce0d('0x32')][_0xce0d('0x3a')]){_0x2573de[_0xce0d('0x38')]=_['merge'](_0x2573de[_0xce0d('0x38')],{'$or':_['map'](_0x2573de['attributes'],function(_0x426c0f){var _0x1ae7c4={};_0x1ae7c4[_0x426c0f]={'$like':'%'+_0x8f36bb[_0xce0d('0x32')]['filter']+'%'};return _0x1ae7c4;})});}_0x2573de=_[_0xce0d('0x3b')]({},_0x2573de,_0x8f36bb['options']);return _0xbd36af[_0xce0d('0x52')](_0x2573de);}})[_0xce0d('0x28')](function(_0x575d6a){if(_0x575d6a){_0x5ad7b5=_0x575d6a[_0xce0d('0x45')];if(!_0x8f36bb['query']['hasOwnProperty'](_0xce0d('0x36'))){_0x2573de[_0xce0d('0x22')]=qs[_0xce0d('0x22')](_0x8f36bb[_0xce0d('0x32')][_0xce0d('0x22')]);_0x2573de[_0xce0d('0x20')]=qs[_0xce0d('0x20')](_0x8f36bb[_0xce0d('0x32')][_0xce0d('0x20')]);}return _0xbd36af[_0xce0d('0x52')](_0x2573de);}})[_0xce0d('0x28')](function(_0x1b8983){if(_0x1b8983){return _0x1b8983?{'count':_0x5ad7b5,'rows':_0x1b8983}:null;}})[_0xce0d('0x28')](respondWithResult(_0x208679,null))['catch'](handleError(_0x208679,null));};exports['setTags']=function(_0x24802a,_0x3e06a2,_0x2f2531){if(_0x24802a[_0xce0d('0x48')]['id']){delete _0x24802a[_0xce0d('0x48')]['id'];}return db[_0xce0d('0x2e')]['findOne']({'where':{'id':_0x24802a[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x3e06a2,null))[_0xce0d('0x28')](function(_0x1fa275){if(_0x1fa275){return _0x1fa275['setTags'](_0x24802a[_0xce0d('0x48')][_0xce0d('0x54')]||[]);}return null;})[_0xce0d('0x28')](respondWithResult(_0x3e06a2,null))[_0xce0d('0x42')](handleError(_0x3e06a2,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index e43e04a..cf403af 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 _0xa367=['request-promise','path','rimraf','../../config/environment','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x3951ab,_0xa5f502){var _0x2b19f7=function(_0x505727){while(--_0x505727){_0x3951ab['push'](_0x3951ab['shift']());}};_0x2b19f7(++_0xa5f502);}(_0xa367,0x19d));var _0x7a36=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa367[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x7a36('0x0'));var util=require(_0x7a36('0x1'));var logger=require(_0x7a36('0x2'))(_0x7a36('0x3'));var moment=require('moment');var BPromise=require(_0x7a36('0x4'));var rp=require(_0x7a36('0x5'));var fs=require('fs');var path=require(_0x7a36('0x6'));var rimraf=require(_0x7a36('0x7'));var config=require(_0x7a36('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x4e5bc4,_0xd355e8){return _0x4e5bc4['define'](_0x7a36('0x9'),attributes,{'tableName':_0x7a36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd033=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x31c1b6,_0x18ccb5){var _0x549c7f=function(_0x217e56){while(--_0x217e56){_0x31c1b6['push'](_0x31c1b6['shift']());}};_0x549c7f(++_0x18ccb5);}(_0xd033,0xc2));var _0x3d03=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xd033[_0x533e4e];return _0x1f14bb;};'use strict';var _=require(_0x3d03('0x0'));var util=require(_0x3d03('0x1'));var logger=require('../../config/logger')(_0x3d03('0x2'));var moment=require(_0x3d03('0x3'));var BPromise=require(_0x3d03('0x4'));var rp=require(_0x3d03('0x5'));var fs=require('fs');var path=require(_0x3d03('0x6'));var rimraf=require(_0x3d03('0x7'));var config=require(_0x3d03('0x8'));var attributes=require(_0x3d03('0x9'));module[_0x3d03('0xa')]=function(_0x5db176,_0x5a83e7){return _0x5db176[_0x3d03('0xb')](_0x3d03('0xc'),attributes,{'tableName':_0x3d03('0xd'),'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 e8218e3..2f58274 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 _0xc569=['result','catch','FreshdeskConfiguration,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x2b34d8,_0x312d3b){var _0x21e488=function(_0x24acfa){while(--_0x24acfa){_0x2b34d8['push'](_0x2b34d8['shift']());}};_0x21e488(++_0x312d3b);}(_0xc569,0x19b));var _0x9c56=function(_0x5d6448,_0x55e965){_0x5d6448=_0x5d6448-0x0;var _0x3d0fb5=_0xc569[_0x5d6448];return _0x3d0fb5;};'use strict';var _=require(_0x9c56('0x0'));var util=require(_0x9c56('0x1'));var moment=require('moment');var BPromise=require(_0x9c56('0x2'));var rs=require(_0x9c56('0x3'));var fs=require('fs');var Redis=require(_0x9c56('0x4'));var db=require(_0x9c56('0x5'))['db'];var utils=require(_0x9c56('0x6'));var logger=require(_0x9c56('0x7'))(_0x9c56('0x8'));var config=require(_0x9c56('0x9'));var jayson=require(_0x9c56('0xa'));var client=jayson[_0x9c56('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x454af2,_0x323cb4,_0x5e7a16){return new BPromise(function(_0x2b0736,_0x3bafbb){return client[_0x9c56('0xc')](_0x454af2,_0x5e7a16)[_0x9c56('0xd')](function(_0x12656f){logger[_0x9c56('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x323cb4,_0x9c56('0xf'));logger[_0x9c56('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x323cb4,'request\x20sent',JSON[_0x9c56('0x11')](_0x12656f));if(_0x12656f[_0x9c56('0x12')]){if(_0x12656f[_0x9c56('0x12')][_0x9c56('0x13')]===0x1f4){logger[_0x9c56('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x323cb4,_0x12656f['error'][_0x9c56('0x14')]);return _0x3bafbb(_0x12656f[_0x9c56('0x12')][_0x9c56('0x14')]);}logger[_0x9c56('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x323cb4,_0x12656f['error'][_0x9c56('0x14')]);return _0x2b0736(_0x12656f[_0x9c56('0x12')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x323cb4,_0x9c56('0xf'));_0x2b0736(_0x12656f[_0x9c56('0x15')][_0x9c56('0x14')]);}})[_0x9c56('0x16')](function(_0x587dd1){logger[_0x9c56('0x12')](_0x9c56('0x17'),_0x323cb4,_0x587dd1);_0x3bafbb(_0x587dd1);});});} \ No newline at end of file +var _0x3dda=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x3dda,0x180));var _0xa3dd=function(_0x279a91,_0x2c6dbf){_0x279a91=_0x279a91-0x0;var _0x5c7d99=_0x3dda[_0x279a91];return _0x5c7d99;};'use strict';var _=require(_0xa3dd('0x0'));var util=require(_0xa3dd('0x1'));var moment=require(_0xa3dd('0x2'));var BPromise=require(_0xa3dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3dd('0x4'));var db=require(_0xa3dd('0x5'))['db'];var utils=require(_0xa3dd('0x6'));var logger=require('../../config/logger')(_0xa3dd('0x7'));var config=require('../../config/environment');var jayson=require(_0xa3dd('0x8'));var client=jayson[_0xa3dd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x181745,_0x48e702,_0x1ad110){return new BPromise(function(_0x5535be,_0x15889f){return client[_0xa3dd('0xa')](_0x181745,_0x1ad110)['then'](function(_0x1b7e2b){logger[_0xa3dd('0xb')](_0xa3dd('0xc'),_0x48e702,_0xa3dd('0xd'));logger[_0xa3dd('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x48e702,_0xa3dd('0xd'),JSON[_0xa3dd('0xf')](_0x1b7e2b));if(_0x1b7e2b['error']){if(_0x1b7e2b[_0xa3dd('0x10')][_0xa3dd('0x11')]===0x1f4){logger[_0xa3dd('0x10')](_0xa3dd('0xc'),_0x48e702,_0x1b7e2b[_0xa3dd('0x10')][_0xa3dd('0x12')]);return _0x15889f(_0x1b7e2b[_0xa3dd('0x10')][_0xa3dd('0x12')]);}logger['error'](_0xa3dd('0xc'),_0x48e702,_0x1b7e2b[_0xa3dd('0x10')][_0xa3dd('0x12')]);return _0x5535be(_0x1b7e2b[_0xa3dd('0x10')][_0xa3dd('0x12')]);}else{logger['info'](_0xa3dd('0xc'),_0x48e702,_0xa3dd('0xd'));_0x5535be(_0x1b7e2b[_0xa3dd('0x13')][_0xa3dd('0x12')]);}})[_0xa3dd('0x14')](function(_0x5021b0){logger[_0xa3dd('0x10')](_0xa3dd('0xc'),_0x48e702,_0x5021b0);_0x15889f(_0x5021b0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 29540a9..bff6451 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 _0x1d77=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show'];(function(_0x1a16f4,_0x433a8f){var _0x3ebad0=function(_0x1db8b4){while(--_0x1db8b4){_0x1a16f4['push'](_0x1a16f4['shift']());}};_0x3ebad0(++_0x433a8f);}(_0x1d77,0x183));var _0x71d7=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x1d77[_0x3e8cae];return _0x45c4d6;};'use strict';var multer=require(_0x71d7('0x0'));var util=require(_0x71d7('0x1'));var path=require('path');var timeout=require(_0x71d7('0x2'));var express=require(_0x71d7('0x3'));var router=express[_0x71d7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x71d7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x71d7('0x6'));var controller=require(_0x71d7('0x7'));router['get']('/',auth[_0x71d7('0x8')](),controller[_0x71d7('0x9')]);router[_0x71d7('0xa')](_0x71d7('0xb'),auth[_0x71d7('0x8')](),controller[_0x71d7('0xc')]);router[_0x71d7('0xd')]('/',auth['isAuthenticated'](),controller[_0x71d7('0xe')]);router[_0x71d7('0xf')](_0x71d7('0xb'),auth[_0x71d7('0x8')](),controller[_0x71d7('0x10')]);router[_0x71d7('0x11')](_0x71d7('0xb'),auth[_0x71d7('0x8')](),controller[_0x71d7('0x12')]);module[_0x71d7('0x13')]=router; \ No newline at end of file +var _0x1eb9=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer'];(function(_0x23e05c,_0x102ee1){var _0x7a4446=function(_0x127c5d){while(--_0x127c5d){_0x23e05c['push'](_0x23e05c['shift']());}};_0x7a4446(++_0x102ee1);}(_0x1eb9,0x1db));var _0x91eb=function(_0x204243,_0x38b7b0){_0x204243=_0x204243-0x0;var _0x51c3a7=_0x1eb9[_0x204243];return _0x51c3a7;};'use strict';var multer=require(_0x91eb('0x0'));var util=require(_0x91eb('0x1'));var path=require('path');var timeout=require(_0x91eb('0x2'));var express=require(_0x91eb('0x3'));var router=express[_0x91eb('0x4')]();var fs_extra=require(_0x91eb('0x5'));var auth=require(_0x91eb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x91eb('0x7')]('/',auth[_0x91eb('0x8')](),controller[_0x91eb('0x9')]);router[_0x91eb('0x7')](_0x91eb('0xa'),auth[_0x91eb('0x8')](),controller[_0x91eb('0xb')]);router[_0x91eb('0xc')]('/',auth[_0x91eb('0x8')](),controller[_0x91eb('0xd')]);router[_0x91eb('0xe')](_0x91eb('0xa'),auth[_0x91eb('0x8')](),controller[_0x91eb('0xf')]);router[_0x91eb('0x10')](_0x91eb('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 5c6ef8f..05d7923 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 _0xae7f=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0xae7f,0x124));var _0xfae7=function(_0x302670,_0x483f29){_0x302670=_0x302670-0x0;var _0x15bbb0=_0xae7f[_0x302670];return _0x15bbb0;};'use strict';var Sequelize=require(_0xfae7('0x0'));module[_0xfae7('0x1')]={'type':{'type':Sequelize[_0xfae7('0x2')](_0xfae7('0x3'),_0xfae7('0x4'),_0xfae7('0x5'),_0xfae7('0x6'),_0xfae7('0x7')),'defaultValue':_0xfae7('0x3')},'content':{'type':Sequelize[_0xfae7('0x8')]},'key':{'type':Sequelize[_0xfae7('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xfae7('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xfae7('0x8')]},'idField':{'type':Sequelize[_0xfae7('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfae7('0x8')]}}; \ No newline at end of file +var _0x7caf=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x7caf,0x153));var _0xf7ca=function(_0x45416a,_0x50d3ec){_0x45416a=_0x45416a-0x0;var _0x5c24f3=_0x7caf[_0x45416a];return _0x5c24f3;};'use strict';var Sequelize=require(_0xf7ca('0x0'));module[_0xf7ca('0x1')]={'type':{'type':Sequelize[_0xf7ca('0x2')]('string',_0xf7ca('0x3'),_0xf7ca('0x4'),_0xf7ca('0x5'),_0xf7ca('0x6')),'defaultValue':_0xf7ca('0x7')},'content':{'type':Sequelize[_0xf7ca('0x8')]},'key':{'type':Sequelize[_0xf7ca('0x8')]},'keyType':{'type':Sequelize[_0xf7ca('0x2')](_0xf7ca('0x7'),_0xf7ca('0x3'),_0xf7ca('0x4'))},'keyContent':{'type':Sequelize[_0xf7ca('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf7ca('0x8')]},'customField':{'type':Sequelize[_0xf7ca('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf7ca('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 1d4db7a..8a747e4 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 _0xaaa2=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','type','key'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xaaa2,0xac));var _0x2aaa=function(_0x854c84,_0x3edd0e){_0x854c84=_0x854c84-0x0;var _0xad7eab=_0xaaa2[_0x854c84];return _0xad7eab;};'use strict';var emlformat=require(_0x2aaa('0x0'));var rimraf=require(_0x2aaa('0x1'));var zipdir=require(_0x2aaa('0x2'));var jsonpatch=require(_0x2aaa('0x3'));var rp=require(_0x2aaa('0x4'));var moment=require(_0x2aaa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2aaa('0x6'));var util=require('util');var path=require(_0x2aaa('0x7'));var sox=require(_0x2aaa('0x8'));var csv=require(_0x2aaa('0x9'));var ejs=require(_0x2aaa('0xa'));var fs=require('fs');var fs_extra=require(_0x2aaa('0xb'));var _=require(_0x2aaa('0xc'));var squel=require('squel');var crypto=require(_0x2aaa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2aaa('0x9'));var querystring=require('querystring');var Papa=require(_0x2aaa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2aaa('0xf'));var as=require(_0x2aaa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aaa('0x11'))(_0x2aaa('0x12'));var utils=require(_0x2aaa('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2aaa('0x14'));var db=require(_0x2aaa('0x15'))['db'];function respondWithStatusCode(_0x8a5be3,_0x2b51f0){_0x2b51f0=_0x2b51f0||0xcc;return function(_0xd38d6d){if(_0xd38d6d){return _0x8a5be3[_0x2aaa('0x16')](_0x2b51f0);}return _0x8a5be3[_0x2aaa('0x17')](_0x2b51f0)[_0x2aaa('0x18')]();};}function respondWithResult(_0x32dfbf,_0xe22151){_0xe22151=_0xe22151||0xc8;return function(_0x314366){if(_0x314366){return _0x32dfbf[_0x2aaa('0x17')](_0xe22151)['json'](_0x314366);}};}function respondWithFilteredResult(_0x166321,_0x4df56b){return function(_0x35fbc1){if(_0x35fbc1){var _0x1a5573=typeof _0x4df56b['offset']==='undefined'&&typeof _0x4df56b['limit']===_0x2aaa('0x19');var _0x1dc0ba=_0x35fbc1[_0x2aaa('0x1a')];var _0x3b94bf=_0x1a5573?0x0:_0x4df56b[_0x2aaa('0x1b')];var _0xdaa445=_0x1a5573?_0x35fbc1[_0x2aaa('0x1a')]:_0x4df56b['offset']+_0x4df56b[_0x2aaa('0x1c')];var _0x30951c;if(_0xdaa445>=_0x1dc0ba){_0xdaa445=_0x1dc0ba;_0x30951c=0xc8;}else{_0x30951c=0xce;}_0x166321['status'](_0x30951c);return _0x166321[_0x2aaa('0x1d')]('Content-Range',_0x3b94bf+'-'+_0xdaa445+'/'+_0x1dc0ba)['json'](_0x35fbc1);}return null;};}function patchUpdates(_0x1ec32e){return function(_0x5052eb){try{jsonpatch[_0x2aaa('0x1e')](_0x5052eb,_0x1ec32e,!![]);}catch(_0x3e7649){return BPromise[_0x2aaa('0x1f')](_0x3e7649);}return _0x5052eb[_0x2aaa('0x20')]();};}function saveUpdates(_0x2c255f,_0x24da1e){return function(_0x4f581f){if(_0x4f581f){return _0x4f581f[_0x2aaa('0x21')](_0x2c255f)[_0x2aaa('0x22')](function(_0x4836b2){return _0x4836b2;});}return null;};}function removeEntity(_0x4d35aa,_0x19153e){return function(_0x4d7151){if(_0x4d7151){return _0x4d7151[_0x2aaa('0x23')]()[_0x2aaa('0x22')](function(){_0x4d35aa['status'](0xcc)[_0x2aaa('0x18')]();});}};}function handleEntityNotFound(_0x3b99d8,_0x4e1c0f){return function(_0x2ab888){if(!_0x2ab888){_0x3b99d8[_0x2aaa('0x16')](0x194);}return _0x2ab888;};}function handleError(_0x41253c,_0x5371cd){_0x5371cd=_0x5371cd||0x1f4;return function(_0x1f626b){logger[_0x2aaa('0x24')](_0x1f626b['stack']);if(_0x1f626b['name']){delete _0x1f626b[_0x2aaa('0x25')];}_0x41253c[_0x2aaa('0x17')](_0x5371cd)[_0x2aaa('0x26')](_0x1f626b);};}exports[_0x2aaa('0x27')]=function(_0x3a6a63,_0x292297){var _0x2f8305={},_0x166dc0={},_0x12cd47={'count':0x0,'rows':[]};var _0x19472b=_[_0x2aaa('0x28')](db[_0x2aaa('0x29')]['rawAttributes'],function(_0x101b6e){return{'name':_0x101b6e['fieldName'],'type':_0x101b6e[_0x2aaa('0x2a')][_0x2aaa('0x2b')]};});_0x166dc0[_0x2aaa('0x2c')]=_[_0x2aaa('0x28')](_0x19472b,_0x2aaa('0x25'));_0x166dc0[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x3a6a63[_0x2aaa('0x2d')]);_0x166dc0[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x166dc0['model'],_0x166dc0['query']);_0x2f8305['attributes']=_['intersection'](_0x166dc0['model'],qs[_0x2aaa('0x31')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x31')]));_0x2f8305[_0x2aaa('0x32')]=_0x2f8305[_0x2aaa('0x32')][_0x2aaa('0x33')]?_0x2f8305[_0x2aaa('0x32')]:_0x166dc0[_0x2aaa('0x2c')];if(!_0x3a6a63['query'][_0x2aaa('0x34')](_0x2aaa('0x35'))){_0x2f8305['limit']=qs[_0x2aaa('0x1c')](_0x3a6a63[_0x2aaa('0x2d')]['limit']);_0x2f8305[_0x2aaa('0x1b')]=qs[_0x2aaa('0x1b')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x1b')]);}_0x2f8305[_0x2aaa('0x36')]=qs[_0x2aaa('0x37')](_0x3a6a63[_0x2aaa('0x2d')]['sort']);_0x2f8305['where']=qs[_0x2aaa('0x2f')](_['pick'](_0x3a6a63[_0x2aaa('0x2d')],_0x166dc0[_0x2aaa('0x2f')]),_0x19472b);if(_0x3a6a63['query'][_0x2aaa('0x38')]){_0x2f8305[_0x2aaa('0x39')]=_[_0x2aaa('0x3a')](_0x2f8305['where'],{'$or':_[_0x2aaa('0x28')](_0x19472b,function(_0x337ae8){if(_0x337ae8[_0x2aaa('0x2a')]!==_0x2aaa('0x3b')){var _0x5023d2={};_0x5023d2[_0x337ae8[_0x2aaa('0x25')]]={'$like':'%'+_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x38')]+'%'};return _0x5023d2;}})});}_0x2f8305=_[_0x2aaa('0x3a')]({},_0x2f8305,_0x3a6a63[_0x2aaa('0x3c')]);var _0x362060={'where':_0x2f8305[_0x2aaa('0x39')]};return db[_0x2aaa('0x29')][_0x2aaa('0x1a')](_0x362060)[_0x2aaa('0x22')](function(_0x127f7e){_0x12cd47[_0x2aaa('0x1a')]=_0x127f7e;if(_0x3a6a63[_0x2aaa('0x2d')]['includeAll']){_0x2f8305[_0x2aaa('0x3d')]=[{'all':!![]}];}return db[_0x2aaa('0x29')][_0x2aaa('0x3e')](_0x2f8305);})['then'](function(_0x17042f){_0x12cd47[_0x2aaa('0x3f')]=_0x17042f;return _0x12cd47;})[_0x2aaa('0x22')](respondWithFilteredResult(_0x292297,_0x2f8305))['catch'](handleError(_0x292297,null));};exports[_0x2aaa('0x40')]=function(_0x1bb225,_0x25b932){var _0x4ad537={'raw':!![],'where':{'id':_0x1bb225[_0x2aaa('0x41')]['id']}},_0x57554e={};_0x57554e[_0x2aaa('0x2c')]=_[_0x2aaa('0x2e')](db['FreshdeskField'][_0x2aaa('0x42')]);_0x57554e[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x1bb225[_0x2aaa('0x2d')]);_0x57554e[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x57554e[_0x2aaa('0x2c')],_0x57554e[_0x2aaa('0x2d')]);_0x4ad537['attributes']=_['intersection'](_0x57554e[_0x2aaa('0x2c')],qs['fields'](_0x1bb225[_0x2aaa('0x2d')]['fields']));_0x4ad537['attributes']=_0x4ad537['attributes'][_0x2aaa('0x33')]?_0x4ad537[_0x2aaa('0x32')]:_0x57554e['model'];if(_0x1bb225[_0x2aaa('0x2d')][_0x2aaa('0x43')]){_0x4ad537['include']=[{'all':!![]}];}_0x4ad537=_[_0x2aaa('0x3a')]({},_0x4ad537,_0x1bb225['options']);return db[_0x2aaa('0x29')][_0x2aaa('0x44')](_0x4ad537)['then'](handleEntityNotFound(_0x25b932,null))[_0x2aaa('0x22')](respondWithResult(_0x25b932,null))[_0x2aaa('0x45')](handleError(_0x25b932,null));};exports[_0x2aaa('0x46')]=function(_0x367a63,_0x745414){return db['FreshdeskField']['create'](_0x367a63['body'],{})[_0x2aaa('0x22')](respondWithResult(_0x745414,0xc9))[_0x2aaa('0x45')](handleError(_0x745414,null));};exports[_0x2aaa('0x21')]=function(_0x393073,_0x23290d){if(_0x393073[_0x2aaa('0x47')]['id']){delete _0x393073[_0x2aaa('0x47')]['id'];}return db[_0x2aaa('0x29')][_0x2aaa('0x44')]({'where':{'id':_0x393073['params']['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x23290d,null))[_0x2aaa('0x22')](saveUpdates(_0x393073[_0x2aaa('0x47')],null))[_0x2aaa('0x22')](respondWithResult(_0x23290d,null))['catch'](handleError(_0x23290d,null));};exports[_0x2aaa('0x23')]=function(_0xe935c3,_0x3906f8){return db['FreshdeskField']['find']({'where':{'id':_0xe935c3[_0x2aaa('0x41')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x3906f8,null))[_0x2aaa('0x22')](removeEntity(_0x3906f8,null))[_0x2aaa('0x45')](handleError(_0x3906f8,null));}; \ No newline at end of file +var _0x153f=['count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x56eb56,_0x2652f1){var _0x153525=function(_0xa2afc5){while(--_0xa2afc5){_0x56eb56['push'](_0x56eb56['shift']());}};_0x153525(++_0x2652f1);}(_0x153f,0x15b));var _0xf153=function(_0x2a4c79,_0x396ba2){_0x2a4c79=_0x2a4c79-0x0;var _0x1a6b3a=_0x153f[_0x2a4c79];return _0x1a6b3a;};'use strict';var emlformat=require(_0xf153('0x0'));var rimraf=require(_0xf153('0x1'));var zipdir=require(_0xf153('0x2'));var jsonpatch=require(_0xf153('0x3'));var rp=require(_0xf153('0x4'));var moment=require(_0xf153('0x5'));var BPromise=require(_0xf153('0x6'));var Mustache=require('mustache');var util=require(_0xf153('0x7'));var path=require('path');var sox=require(_0xf153('0x8'));var csv=require(_0xf153('0x9'));var ejs=require(_0xf153('0xa'));var fs=require('fs');var fs_extra=require(_0xf153('0xb'));var _=require(_0xf153('0xc'));var squel=require('squel');var crypto=require(_0xf153('0xd'));var jsforce=require(_0xf153('0xe'));var deskjs=require(_0xf153('0xf'));var toCsv=require(_0xf153('0x9'));var querystring=require(_0xf153('0x10'));var Papa=require(_0xf153('0x11'));var Redis=require(_0xf153('0x12'));var authService=require(_0xf153('0x13'));var qs=require(_0xf153('0x14'));var as=require(_0xf153('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf153('0x16'))(_0xf153('0x17'));var utils=require(_0xf153('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf153('0x19'));var db=require(_0xf153('0x1a'))['db'];function respondWithStatusCode(_0x65756d,_0x1cc666){_0x1cc666=_0x1cc666||0xcc;return function(_0x256b7d){if(_0x256b7d){return _0x65756d[_0xf153('0x1b')](_0x1cc666);}return _0x65756d[_0xf153('0x1c')](_0x1cc666)[_0xf153('0x1d')]();};}function respondWithResult(_0x3e34fb,_0x4c5283){_0x4c5283=_0x4c5283||0xc8;return function(_0x18be7e){if(_0x18be7e){return _0x3e34fb[_0xf153('0x1c')](_0x4c5283)[_0xf153('0x1e')](_0x18be7e);}};}function respondWithFilteredResult(_0x406e6f,_0x3afea2){return function(_0x68f436){if(_0x68f436){var _0x273a90=typeof _0x3afea2[_0xf153('0x1f')]==='undefined'&&typeof _0x3afea2[_0xf153('0x20')]==='undefined';var _0x37093a=_0x68f436[_0xf153('0x21')];var _0x138dbe=_0x273a90?0x0:_0x3afea2[_0xf153('0x1f')];var _0x4e790d=_0x273a90?_0x68f436[_0xf153('0x21')]:_0x3afea2[_0xf153('0x1f')]+_0x3afea2[_0xf153('0x20')];var _0x14b83f;if(_0x4e790d>=_0x37093a){_0x4e790d=_0x37093a;_0x14b83f=0xc8;}else{_0x14b83f=0xce;}_0x406e6f[_0xf153('0x1c')](_0x14b83f);return _0x406e6f[_0xf153('0x22')](_0xf153('0x23'),_0x138dbe+'-'+_0x4e790d+'/'+_0x37093a)[_0xf153('0x1e')](_0x68f436);}return null;};}function patchUpdates(_0x3735a7){return function(_0x1dd340){try{jsonpatch[_0xf153('0x24')](_0x1dd340,_0x3735a7,!![]);}catch(_0x3665a2){return BPromise['reject'](_0x3665a2);}return _0x1dd340[_0xf153('0x25')]();};}function saveUpdates(_0x395f28,_0x3d3e41){return function(_0x32e759){if(_0x32e759){return _0x32e759[_0xf153('0x26')](_0x395f28)[_0xf153('0x27')](function(_0x465d88){return _0x465d88;});}return null;};}function removeEntity(_0x4376f7,_0xf67cde){return function(_0x38190c){if(_0x38190c){return _0x38190c[_0xf153('0x28')]()[_0xf153('0x27')](function(){_0x4376f7[_0xf153('0x1c')](0xcc)[_0xf153('0x1d')]();});}};}function handleEntityNotFound(_0xe490f8,_0x35f9da){return function(_0x141ef4){if(!_0x141ef4){_0xe490f8[_0xf153('0x1b')](0x194);}return _0x141ef4;};}function handleError(_0x23acc3,_0x17f7a4){_0x17f7a4=_0x17f7a4||0x1f4;return function(_0x48ebdc){logger[_0xf153('0x29')](_0x48ebdc[_0xf153('0x2a')]);if(_0x48ebdc['name']){delete _0x48ebdc[_0xf153('0x2b')];}_0x23acc3[_0xf153('0x1c')](_0x17f7a4)['send'](_0x48ebdc);};}exports[_0xf153('0x2c')]=function(_0x10295e,_0x261ac0){var _0x2b9a9c={},_0x339e96={},_0x258976={'count':0x0,'rows':[]};var _0x441436=_[_0xf153('0x2d')](db[_0xf153('0x2e')][_0xf153('0x2f')],function(_0x13b541){return{'name':_0x13b541[_0xf153('0x30')],'type':_0x13b541['type'][_0xf153('0x31')]};});_0x339e96[_0xf153('0x32')]=_[_0xf153('0x2d')](_0x441436,_0xf153('0x2b'));_0x339e96['query']=_['keys'](_0x10295e[_0xf153('0x33')]);_0x339e96['filters']=_['intersection'](_0x339e96[_0xf153('0x32')],_0x339e96['query']);_0x2b9a9c[_0xf153('0x34')]=_['intersection'](_0x339e96[_0xf153('0x32')],qs[_0xf153('0x35')](_0x10295e['query'][_0xf153('0x35')]));_0x2b9a9c[_0xf153('0x34')]=_0x2b9a9c[_0xf153('0x34')][_0xf153('0x36')]?_0x2b9a9c[_0xf153('0x34')]:_0x339e96[_0xf153('0x32')];if(!_0x10295e['query'][_0xf153('0x37')]('nolimit')){_0x2b9a9c[_0xf153('0x20')]=qs[_0xf153('0x20')](_0x10295e[_0xf153('0x33')][_0xf153('0x20')]);_0x2b9a9c[_0xf153('0x1f')]=qs[_0xf153('0x1f')](_0x10295e['query'][_0xf153('0x1f')]);}_0x2b9a9c[_0xf153('0x38')]=qs[_0xf153('0x39')](_0x10295e['query'][_0xf153('0x39')]);_0x2b9a9c[_0xf153('0x3a')]=qs[_0xf153('0x3b')](_[_0xf153('0x3c')](_0x10295e[_0xf153('0x33')],_0x339e96[_0xf153('0x3b')]),_0x441436);if(_0x10295e['query'][_0xf153('0x3d')]){_0x2b9a9c[_0xf153('0x3a')]=_['merge'](_0x2b9a9c[_0xf153('0x3a')],{'$or':_[_0xf153('0x2d')](_0x441436,function(_0x357666){if(_0x357666[_0xf153('0x3e')]!==_0xf153('0x3f')){var _0x42360a={};_0x42360a[_0x357666[_0xf153('0x2b')]]={'$like':'%'+_0x10295e['query'][_0xf153('0x3d')]+'%'};return _0x42360a;}})});}_0x2b9a9c=_[_0xf153('0x40')]({},_0x2b9a9c,_0x10295e[_0xf153('0x41')]);var _0x352e7c={'where':_0x2b9a9c[_0xf153('0x3a')]};return db[_0xf153('0x2e')]['count'](_0x352e7c)['then'](function(_0xa3922b){_0x258976['count']=_0xa3922b;if(_0x10295e[_0xf153('0x33')][_0xf153('0x42')]){_0x2b9a9c[_0xf153('0x43')]=[{'all':!![]}];}return db[_0xf153('0x2e')][_0xf153('0x44')](_0x2b9a9c);})[_0xf153('0x27')](function(_0x5599e5){_0x258976['rows']=_0x5599e5;return _0x258976;})[_0xf153('0x27')](respondWithFilteredResult(_0x261ac0,_0x2b9a9c))[_0xf153('0x45')](handleError(_0x261ac0,null));};exports['show']=function(_0x21529a,_0x1c77a6){var _0x1edf65={'raw':!![],'where':{'id':_0x21529a[_0xf153('0x46')]['id']}},_0x3a9cb2={};_0x3a9cb2[_0xf153('0x32')]=_[_0xf153('0x47')](db[_0xf153('0x2e')][_0xf153('0x2f')]);_0x3a9cb2[_0xf153('0x33')]=_[_0xf153('0x47')](_0x21529a[_0xf153('0x33')]);_0x3a9cb2['filters']=_[_0xf153('0x48')](_0x3a9cb2[_0xf153('0x32')],_0x3a9cb2[_0xf153('0x33')]);_0x1edf65['attributes']=_[_0xf153('0x48')](_0x3a9cb2[_0xf153('0x32')],qs['fields'](_0x21529a[_0xf153('0x33')]['fields']));_0x1edf65[_0xf153('0x34')]=_0x1edf65[_0xf153('0x34')][_0xf153('0x36')]?_0x1edf65['attributes']:_0x3a9cb2[_0xf153('0x32')];if(_0x21529a[_0xf153('0x33')][_0xf153('0x42')]){_0x1edf65[_0xf153('0x43')]=[{'all':!![]}];}_0x1edf65=_[_0xf153('0x40')]({},_0x1edf65,_0x21529a['options']);return db[_0xf153('0x2e')][_0xf153('0x49')](_0x1edf65)['then'](handleEntityNotFound(_0x1c77a6,null))[_0xf153('0x27')](respondWithResult(_0x1c77a6,null))[_0xf153('0x45')](handleError(_0x1c77a6,null));};exports[_0xf153('0x4a')]=function(_0x5599a6,_0x657403){return db[_0xf153('0x2e')][_0xf153('0x4a')](_0x5599a6[_0xf153('0x4b')],{})[_0xf153('0x27')](respondWithResult(_0x657403,0xc9))[_0xf153('0x45')](handleError(_0x657403,null));};exports[_0xf153('0x26')]=function(_0x33e48,_0x3b91ed){if(_0x33e48['body']['id']){delete _0x33e48[_0xf153('0x4b')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x33e48['params']['id']}})[_0xf153('0x27')](handleEntityNotFound(_0x3b91ed,null))[_0xf153('0x27')](saveUpdates(_0x33e48['body'],null))[_0xf153('0x27')](respondWithResult(_0x3b91ed,null))[_0xf153('0x45')](handleError(_0x3b91ed,null));};exports['destroy']=function(_0x3f1ecb,_0xe6e023){return db[_0xf153('0x2e')][_0xf153('0x49')]({'where':{'id':_0x3f1ecb[_0xf153('0x46')]['id']}})[_0xf153('0x27')](handleEntityNotFound(_0xe6e023,null))['then'](removeEntity(_0xe6e023,null))[_0xf153('0x45')](handleError(_0xe6e023,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f45aa6d..490f064 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 _0x5636=['define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x1e5a1c,_0x4c0a7a){var _0x3b3a43=function(_0x48cbbc){while(--_0x48cbbc){_0x1e5a1c['push'](_0x1e5a1c['shift']());}};_0x3b3a43(++_0x4c0a7a);}(_0x5636,0x102));var _0x6563=function(_0x480019,_0x44f1cf){_0x480019=_0x480019-0x0;var _0x44405d=_0x5636[_0x480019];return _0x44405d;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6563('0x2'));var rp=require(_0x6563('0x3'));var fs=require('fs');var path=require(_0x6563('0x4'));var rimraf=require('rimraf');var config=require(_0x6563('0x5'));var attributes=require(_0x6563('0x6'));module[_0x6563('0x7')]=function(_0x39792f,_0x29f687){return _0x39792f[_0x6563('0x8')](_0x6563('0x9'),attributes,{'tableName':_0x6563('0xa'),'paranoid':![],'indexes':[{'name':_0x6563('0xb'),'fields':[_0x6563('0xc'),_0x6563('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x07bd=['rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2e116c,_0x443ea8){var _0x9790b=function(_0x4a4cfc){while(--_0x4a4cfc){_0x2e116c['push'](_0x2e116c['shift']());}};_0x9790b(++_0x443ea8);}(_0x07bd,0xea));var _0xd07b=function(_0x139411,_0x3d0752){_0x139411=_0x139411-0x0;var _0x66dced=_0x07bd[_0x139411];return _0x66dced;};'use strict';var _=require(_0xd07b('0x0'));var util=require(_0xd07b('0x1'));var logger=require(_0xd07b('0x2'))(_0xd07b('0x3'));var moment=require(_0xd07b('0x4'));var BPromise=require('bluebird');var rp=require(_0xd07b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd07b('0x6'));var config=require('../../config/environment');var attributes=require(_0xd07b('0x7'));module[_0xd07b('0x8')]=function(_0x242abf,_0x188caa){return _0x242abf[_0xd07b('0x9')](_0xd07b('0xa'),attributes,{'tableName':_0xd07b('0xb'),'paranoid':![],'indexes':[{'name':_0xd07b('0xc'),'fields':[_0xd07b('0xd'),_0xd07b('0xe')],'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 588d71b..e303dd1 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 _0x5e33=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2ea0e2,_0x24ec0f){var _0x2a27c6=function(_0xfd22bc){while(--_0xfd22bc){_0x2ea0e2['push'](_0x2ea0e2['shift']());}};_0x2a27c6(++_0x24ec0f);}(_0x5e33,0x85));var _0x35e3=function(_0x26b3bc,_0x34d1bc){_0x26b3bc=_0x26b3bc-0x0;var _0x4ca5a1=_0x5e33[_0x26b3bc];return _0x4ca5a1;};'use strict';var _=require('lodash');var util=require(_0x35e3('0x0'));var moment=require('moment');var BPromise=require(_0x35e3('0x1'));var rs=require(_0x35e3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35e3('0x3'))['db'];var utils=require(_0x35e3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x35e3('0x5'));var jayson=require(_0x35e3('0x6'));var client=jayson[_0x35e3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c946e,_0x56e3ea,_0x5c9949){return new BPromise(function(_0x45cd6e,_0x4cccfe){return client[_0x35e3('0x8')](_0x1c946e,_0x5c9949)['then'](function(_0x21825b){logger[_0x35e3('0x9')]('FreshdeskField,\x20%s,\x20%s',_0x56e3ea,_0x35e3('0xa'));logger[_0x35e3('0xb')](_0x35e3('0xc'),_0x56e3ea,_0x35e3('0xa'),JSON[_0x35e3('0xd')](_0x21825b));if(_0x21825b['error']){if(_0x21825b[_0x35e3('0xe')][_0x35e3('0xf')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x56e3ea,_0x21825b['error'][_0x35e3('0x10')]);return _0x4cccfe(_0x21825b[_0x35e3('0xe')][_0x35e3('0x10')]);}logger[_0x35e3('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x56e3ea,_0x21825b[_0x35e3('0xe')][_0x35e3('0x10')]);return _0x45cd6e(_0x21825b[_0x35e3('0xe')]['message']);}else{logger[_0x35e3('0x9')]('FreshdeskField,\x20%s,\x20%s',_0x56e3ea,_0x35e3('0xa'));_0x45cd6e(_0x21825b[_0x35e3('0x11')][_0x35e3('0x10')]);}})[_0x35e3('0x12')](function(_0x2dbdfc){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x56e3ea,_0x2dbdfc);_0x4cccfe(_0x2dbdfc);});});} \ No newline at end of file +var _0x74d1=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x74d1,0x123));var _0x174d=function(_0x55811e,_0x27744c){_0x55811e=_0x55811e-0x0;var _0x57bb7d=_0x74d1[_0x55811e];return _0x57bb7d;};'use strict';var _=require(_0x174d('0x0'));var util=require(_0x174d('0x1'));var moment=require(_0x174d('0x2'));var BPromise=require(_0x174d('0x3'));var rs=require(_0x174d('0x4'));var fs=require('fs');var Redis=require(_0x174d('0x5'));var db=require(_0x174d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x174d('0x7'))(_0x174d('0x8'));var config=require('../../config/environment');var jayson=require(_0x174d('0x9'));var client=jayson[_0x174d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55800e,_0x16953f,_0x154d49){return new BPromise(function(_0x7da7c,_0x16241a){return client['request'](_0x55800e,_0x154d49)['then'](function(_0x24c673){logger[_0x174d('0xb')](_0x174d('0xc'),_0x16953f,'request\x20sent');logger[_0x174d('0xd')](_0x174d('0xe'),_0x16953f,'request\x20sent',JSON['stringify'](_0x24c673));if(_0x24c673['error']){if(_0x24c673['error']['code']===0x1f4){logger[_0x174d('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x16953f,_0x24c673[_0x174d('0xf')]['message']);return _0x16241a(_0x24c673[_0x174d('0xf')]['message']);}logger[_0x174d('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x16953f,_0x24c673[_0x174d('0xf')][_0x174d('0x10')]);return _0x7da7c(_0x24c673[_0x174d('0xf')][_0x174d('0x10')]);}else{logger[_0x174d('0xb')](_0x174d('0xc'),_0x16953f,'request\x20sent');_0x7da7c(_0x24c673[_0x174d('0x11')][_0x174d('0x10')]);}})['catch'](function(_0x47a9a7){logger[_0x174d('0xf')](_0x174d('0xc'),_0x16953f,_0x47a9a7);_0x16241a(_0x47a9a7);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 4a01e5d..31ef495 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 _0xf45e=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','destroy'];(function(_0x4a4b47,_0xce9c6e){var _0x5f2f2b=function(_0x4caaaa){while(--_0x4caaaa){_0x4a4b47['push'](_0x4a4b47['shift']());}};_0x5f2f2b(++_0xce9c6e);}(_0xf45e,0x115));var _0xef45=function(_0x38f879,_0xea1f1c){_0x38f879=_0x38f879-0x0;var _0x2faa08=_0xf45e[_0x38f879];return _0x2faa08;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var fs_extra=require(_0xef45('0x4'));var auth=require(_0xef45('0x5'));var interaction=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));var controller=require(_0xef45('0x8'));router[_0xef45('0x9')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0xb')]);router[_0xef45('0x9')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller[_0xef45('0xd')]);router[_0xef45('0x9')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0xf')]);router[_0xef45('0x9')]('/:id/fields',auth[_0xef45('0xa')](),controller[_0xef45('0x10')]);router[_0xef45('0x11')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0x12')]);router[_0xef45('0x11')]('/:id/configurations',auth[_0xef45('0xa')](),controller[_0xef45('0x13')]);router[_0xef45('0x14')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller['update']);router['delete'](_0xef45('0xc'),auth['isAuthenticated'](),controller[_0xef45('0x15')]);module[_0xef45('0x16')]=router; \ No newline at end of file +var _0x373d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','create','post','/:id/configurations','update','destroy','exports','multer'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x373d,0x1e2));var _0xd373=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x373d[_0x17406a];return _0x1501ff;};'use strict';var multer=require(_0xd373('0x0'));var util=require('util');var path=require(_0xd373('0x1'));var timeout=require(_0xd373('0x2'));var express=require(_0xd373('0x3'));var router=express[_0xd373('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd373('0x5'));var interaction=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0xd373('0x8')](),controller[_0xd373('0x9')]);router[_0xd373('0xa')](_0xd373('0xb'),auth['isAuthenticated'](),controller[_0xd373('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xd373('0xd')]);router[_0xd373('0xa')]('/:id/fields',auth[_0xd373('0x8')](),controller[_0xd373('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd373('0xf')]);router[_0xd373('0x10')](_0xd373('0x11'),auth[_0xd373('0x8')](),controller['addConfiguration']);router['put']('/:id',auth[_0xd373('0x8')](),controller[_0xd373('0x12')]);router['delete'](_0xd373('0xb'),auth[_0xd373('0x8')](),controller[_0xd373('0x13')]);module[_0xd373('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ee96ea4..c7b77b7 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 _0x955f=['exports','STRING','sequelize'];(function(_0x2b017e,_0xb71d01){var _0x3d5665=function(_0x46e8a0){while(--_0x46e8a0){_0x2b017e['push'](_0x2b017e['shift']());}};_0x3d5665(++_0xb71d01);}(_0x955f,0x1eb));var _0xf955=function(_0x2ce307,_0x3e9b0f){_0x2ce307=_0x2ce307-0x0;var _0x47a112=_0x955f[_0x2ce307];return _0x47a112;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')]},'description':{'type':Sequelize[_0xf955('0x2')]},'username':{'type':Sequelize[_0xf955('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xf955('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5204=['exports','STRING','username','sequelize'];(function(_0x246e9d,_0xd18ef6){var _0x9c3ab9=function(_0x5a440b){while(--_0x5a440b){_0x246e9d['push'](_0x246e9d['shift']());}};_0x9c3ab9(++_0xd18ef6);}(_0x5204,0xdf));var _0x4520=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x5204[_0x671369];return _0x33f2b4;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4520('0x2')]},'username':{'type':Sequelize[_0x4520('0x2')],'unique':_0x4520('0x3')},'apiKey':{'type':Sequelize[_0x4520('0x2')]},'remoteUri':{'type':Sequelize[_0x4520('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4520('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 3db0260..2b35bbd 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 _0xec3a=['lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','status','offset','undefined','limit','count','set','json','apply','save','then','end','error','stack','name','index','map','FreshsalesAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','catch','params','length','find','create','body','update','destroy','getConfigurations','findOne','FreshsalesConfiguration','rawAttributes','order','nolimit','addConfiguration','AccountId','channel','getDescriptions','FreshsalesField','Subjects','Descriptions','getFields','username','remoteUri','apiKey','substring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xec3a,0x1ec));var _0xaec3=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xec3a[_0x2aa0e7];return _0x1472c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaec3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaec3('0x1'));var rp=require(_0xaec3('0x2'));var moment=require(_0xaec3('0x3'));var BPromise=require(_0xaec3('0x4'));var Mustache=require(_0xaec3('0x5'));var util=require(_0xaec3('0x6'));var path=require('path');var sox=require(_0xaec3('0x7'));var csv=require(_0xaec3('0x8'));var ejs=require(_0xaec3('0x9'));var fs=require('fs');var fs_extra=require(_0xaec3('0xa'));var _=require(_0xaec3('0xb'));var squel=require('squel');var crypto=require(_0xaec3('0xc'));var jsforce=require(_0xaec3('0xd'));var deskjs=require(_0xaec3('0xe'));var toCsv=require(_0xaec3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaec3('0xf'));var authService=require(_0xaec3('0x10'));var qs=require(_0xaec3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaec3('0x12'));var logger=require('../../config/logger')(_0xaec3('0x13'));var utils=require(_0xaec3('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b95ec,_0x26401a){_0x26401a=_0x26401a||0xcc;return function(_0x409ea4){if(_0x409ea4){return _0x5b95ec['sendStatus'](_0x26401a);}return _0x5b95ec[_0xaec3('0x15')](_0x26401a)['end']();};}function respondWithResult(_0x1f5d67,_0x3a7ec4){_0x3a7ec4=_0x3a7ec4||0xc8;return function(_0x5dc285){if(_0x5dc285){return _0x1f5d67[_0xaec3('0x15')](_0x3a7ec4)['json'](_0x5dc285);}};}function respondWithFilteredResult(_0x540713,_0x3299c4){return function(_0x2c752a){if(_0x2c752a){var _0x5a33e3=typeof _0x3299c4[_0xaec3('0x16')]===_0xaec3('0x17')&&typeof _0x3299c4[_0xaec3('0x18')]==='undefined';var _0x2b6461=_0x2c752a['count'];var _0x167f12=_0x5a33e3?0x0:_0x3299c4[_0xaec3('0x16')];var _0x309d7b=_0x5a33e3?_0x2c752a[_0xaec3('0x19')]:_0x3299c4[_0xaec3('0x16')]+_0x3299c4[_0xaec3('0x18')];var _0x2cadc8;if(_0x309d7b>=_0x2b6461){_0x309d7b=_0x2b6461;_0x2cadc8=0xc8;}else{_0x2cadc8=0xce;}_0x540713['status'](_0x2cadc8);return _0x540713[_0xaec3('0x1a')]('Content-Range',_0x167f12+'-'+_0x309d7b+'/'+_0x2b6461)[_0xaec3('0x1b')](_0x2c752a);}return null;};}function patchUpdates(_0x205861){return function(_0x22c708){try{jsonpatch[_0xaec3('0x1c')](_0x22c708,_0x205861,!![]);}catch(_0x2cdea8){return BPromise['reject'](_0x2cdea8);}return _0x22c708[_0xaec3('0x1d')]();};}function saveUpdates(_0x1e8ad2,_0x24ee25){return function(_0xf8174a){if(_0xf8174a){return _0xf8174a['update'](_0x1e8ad2)[_0xaec3('0x1e')](function(_0xeab123){return _0xeab123;});}return null;};}function removeEntity(_0x404da4,_0x3af4a3){return function(_0x247f62){if(_0x247f62){return _0x247f62['destroy']()[_0xaec3('0x1e')](function(){_0x404da4['status'](0xcc)[_0xaec3('0x1f')]();});}};}function handleEntityNotFound(_0x2ecb93,_0x2e7584){return function(_0x50b7ca){if(!_0x50b7ca){_0x2ecb93['sendStatus'](0x194);}return _0x50b7ca;};}function handleError(_0x34a562,_0x591d99){_0x591d99=_0x591d99||0x1f4;return function(_0x24aff0){logger[_0xaec3('0x20')](_0x24aff0[_0xaec3('0x21')]);if(_0x24aff0[_0xaec3('0x22')]){delete _0x24aff0[_0xaec3('0x22')];}_0x34a562[_0xaec3('0x15')](_0x591d99)['send'](_0x24aff0);};}exports[_0xaec3('0x23')]=function(_0x352bd6,_0x456807){var _0xc86a36={},_0x22ecdb={},_0x1ac08f={'count':0x0,'rows':[]};var _0x18d937=_[_0xaec3('0x24')](db[_0xaec3('0x25')]['rawAttributes'],function(_0x3620ad){return{'name':_0x3620ad[_0xaec3('0x26')],'type':_0x3620ad['type'][_0xaec3('0x27')]};});_0x22ecdb[_0xaec3('0x28')]=_[_0xaec3('0x24')](_0x18d937,_0xaec3('0x22'));_0x22ecdb[_0xaec3('0x29')]=_[_0xaec3('0x2a')](_0x352bd6['query']);_0x22ecdb[_0xaec3('0x2b')]=_['intersection'](_0x22ecdb['model'],_0x22ecdb[_0xaec3('0x29')]);_0xc86a36['attributes']=_[_0xaec3('0x2c')](_0x22ecdb[_0xaec3('0x28')],qs[_0xaec3('0x2d')](_0x352bd6[_0xaec3('0x29')]['fields']));_0xc86a36[_0xaec3('0x2e')]=_0xc86a36[_0xaec3('0x2e')]['length']?_0xc86a36[_0xaec3('0x2e')]:_0x22ecdb[_0xaec3('0x28')];if(!_0x352bd6[_0xaec3('0x29')][_0xaec3('0x2f')]('nolimit')){_0xc86a36['limit']=qs[_0xaec3('0x18')](_0x352bd6[_0xaec3('0x29')][_0xaec3('0x18')]);_0xc86a36[_0xaec3('0x16')]=qs[_0xaec3('0x16')](_0x352bd6['query'][_0xaec3('0x16')]);}_0xc86a36['order']=qs[_0xaec3('0x30')](_0x352bd6[_0xaec3('0x29')][_0xaec3('0x30')]);_0xc86a36[_0xaec3('0x31')]=qs[_0xaec3('0x2b')](_[_0xaec3('0x32')](_0x352bd6[_0xaec3('0x29')],_0x22ecdb['filters']),_0x18d937);if(_0x352bd6['query'][_0xaec3('0x33')]){_0xc86a36[_0xaec3('0x31')]=_['merge'](_0xc86a36[_0xaec3('0x31')],{'$or':_['map'](_0x18d937,function(_0x5c3b76){if(_0x5c3b76[_0xaec3('0x34')]!==_0xaec3('0x35')){var _0x4355e6={};_0x4355e6[_0x5c3b76['name']]={'$like':'%'+_0x352bd6[_0xaec3('0x29')]['filter']+'%'};return _0x4355e6;}})});}_0xc86a36=_[_0xaec3('0x36')]({},_0xc86a36,_0x352bd6[_0xaec3('0x37')]);var _0x3bf1ab={'where':_0xc86a36[_0xaec3('0x31')]};return db[_0xaec3('0x25')][_0xaec3('0x19')](_0x3bf1ab)[_0xaec3('0x1e')](function(_0x274ba6){_0x1ac08f['count']=_0x274ba6;if(_0x352bd6[_0xaec3('0x29')][_0xaec3('0x38')]){_0xc86a36[_0xaec3('0x39')]=[{'all':!![]}];}return db[_0xaec3('0x25')]['findAll'](_0xc86a36);})[_0xaec3('0x1e')](function(_0xef5946){_0x1ac08f['rows']=_0xef5946;return _0x1ac08f;})[_0xaec3('0x1e')](respondWithFilteredResult(_0x456807,_0xc86a36))[_0xaec3('0x3a')](handleError(_0x456807,null));};exports['show']=function(_0x152654,_0x36162e){var _0x3022fd={'raw':![],'where':{'id':_0x152654[_0xaec3('0x3b')]['id']}},_0x10fba6={};_0x10fba6[_0xaec3('0x28')]=_['keys'](db[_0xaec3('0x25')]['rawAttributes']);_0x10fba6[_0xaec3('0x29')]=_[_0xaec3('0x2a')](_0x152654[_0xaec3('0x29')]);_0x10fba6[_0xaec3('0x2b')]=_[_0xaec3('0x2c')](_0x10fba6[_0xaec3('0x28')],_0x10fba6['query']);_0x3022fd[_0xaec3('0x2e')]=_['intersection'](_0x10fba6[_0xaec3('0x28')],qs[_0xaec3('0x2d')](_0x152654[_0xaec3('0x29')][_0xaec3('0x2d')]));_0x3022fd[_0xaec3('0x2e')]=_0x3022fd[_0xaec3('0x2e')][_0xaec3('0x3c')]?_0x3022fd[_0xaec3('0x2e')]:_0x10fba6['model'];if(_0x152654[_0xaec3('0x29')][_0xaec3('0x38')]){_0x3022fd[_0xaec3('0x39')]=[{'all':!![]}];}_0x3022fd=_[_0xaec3('0x36')]({},_0x3022fd,_0x152654[_0xaec3('0x37')]);return db[_0xaec3('0x25')][_0xaec3('0x3d')](_0x3022fd)[_0xaec3('0x1e')](handleEntityNotFound(_0x36162e,null))[_0xaec3('0x1e')](respondWithResult(_0x36162e,null))[_0xaec3('0x3a')](handleError(_0x36162e,null));};exports[_0xaec3('0x3e')]=function(_0x1d9f26,_0x24d0f8){return db[_0xaec3('0x25')][_0xaec3('0x3e')](_0x1d9f26[_0xaec3('0x3f')],{})[_0xaec3('0x1e')](respondWithResult(_0x24d0f8,0xc9))[_0xaec3('0x3a')](handleError(_0x24d0f8,null));};exports[_0xaec3('0x40')]=function(_0x3e5bb2,_0x1aa91e){if(_0x3e5bb2[_0xaec3('0x3f')]['id']){delete _0x3e5bb2[_0xaec3('0x3f')]['id'];}return db[_0xaec3('0x25')][_0xaec3('0x3d')]({'where':{'id':_0x3e5bb2[_0xaec3('0x3b')]['id']}})[_0xaec3('0x1e')](handleEntityNotFound(_0x1aa91e,null))[_0xaec3('0x1e')](saveUpdates(_0x3e5bb2['body'],null))['then'](respondWithResult(_0x1aa91e,null))['catch'](handleError(_0x1aa91e,null));};exports[_0xaec3('0x41')]=function(_0x17584d,_0x1aca90){return db[_0xaec3('0x25')][_0xaec3('0x3d')]({'where':{'id':_0x17584d['params']['id']}})['then'](handleEntityNotFound(_0x1aca90,null))['then'](removeEntity(_0x1aca90,null))[_0xaec3('0x3a')](handleError(_0x1aca90,null));};exports[_0xaec3('0x42')]=function(_0x57f72c,_0x566747,_0x56e128){var _0x267526={};var _0x6cbe0f={};var _0xb783fb;var _0x432d17;return db[_0xaec3('0x25')][_0xaec3('0x43')]({'where':{'id':_0x57f72c['params']['id']}})[_0xaec3('0x1e')](handleEntityNotFound(_0x566747,null))[_0xaec3('0x1e')](function(_0x1c966b){if(_0x1c966b){_0xb783fb=_0x1c966b;_0x6cbe0f[_0xaec3('0x28')]=_[_0xaec3('0x2a')](db[_0xaec3('0x44')][_0xaec3('0x45')]);_0x6cbe0f[_0xaec3('0x29')]=_[_0xaec3('0x2a')](_0x57f72c[_0xaec3('0x29')]);_0x6cbe0f['filters']=_[_0xaec3('0x2c')](_0x6cbe0f[_0xaec3('0x28')],_0x6cbe0f[_0xaec3('0x29')]);_0x267526[_0xaec3('0x2e')]=_[_0xaec3('0x2c')](_0x6cbe0f[_0xaec3('0x28')],qs['fields'](_0x57f72c[_0xaec3('0x29')][_0xaec3('0x2d')]));_0x267526[_0xaec3('0x2e')]=_0x267526[_0xaec3('0x2e')][_0xaec3('0x3c')]?_0x267526[_0xaec3('0x2e')]:_0x6cbe0f[_0xaec3('0x28')];_0x267526[_0xaec3('0x46')]=qs[_0xaec3('0x30')](_0x57f72c[_0xaec3('0x29')]['sort']);_0x267526[_0xaec3('0x31')]=qs[_0xaec3('0x2b')](_['pick'](_0x57f72c['query'],_0x6cbe0f[_0xaec3('0x2b')]));if(_0x57f72c[_0xaec3('0x29')][_0xaec3('0x33')]){_0x267526[_0xaec3('0x31')]=_[_0xaec3('0x36')](_0x267526[_0xaec3('0x31')],{'$or':_['map'](_0x267526[_0xaec3('0x2e')],function(_0x21b2e8){var _0x5d003d={};_0x5d003d[_0x21b2e8]={'$like':'%'+_0x57f72c['query'][_0xaec3('0x33')]+'%'};return _0x5d003d;})});}_0x267526=_[_0xaec3('0x36')]({},_0x267526,_0x57f72c['options']);return _0xb783fb[_0xaec3('0x42')](_0x267526);}})[_0xaec3('0x1e')](function(_0x1679fc){if(_0x1679fc){_0x432d17=_0x1679fc['length'];if(!_0x57f72c['query']['hasOwnProperty'](_0xaec3('0x47'))){_0x267526[_0xaec3('0x18')]=qs[_0xaec3('0x18')](_0x57f72c['query'][_0xaec3('0x18')]);_0x267526[_0xaec3('0x16')]=qs[_0xaec3('0x16')](_0x57f72c['query']['offset']);}return _0xb783fb[_0xaec3('0x42')](_0x267526);}})[_0xaec3('0x1e')](function(_0x10571e){if(_0x10571e){return _0x10571e?{'count':_0x432d17,'rows':_0x10571e}:null;}})[_0xaec3('0x1e')](respondWithResult(_0x566747,null))[_0xaec3('0x3a')](handleError(_0x566747,null));};exports[_0xaec3('0x48')]=function(_0x1e561a,_0xfb6a57,_0x57750f){if(_0x1e561a[_0xaec3('0x3f')]['id']){delete _0x1e561a['body']['id'];}return db['FreshsalesAccount'][_0xaec3('0x43')]({'where':{'id':_0x1e561a['params']['id']}})['then'](handleEntityNotFound(_0xfb6a57,null))['then'](function(_0x3c8bed){if(_0x3c8bed){_0x1e561a[_0xaec3('0x3f')][_0xaec3('0x49')]=_0x3c8bed['id'];_0x1e561a[_0xaec3('0x3f')]['Subjects']=integrations['getSubjects'](_0x1e561a[_0xaec3('0x3f')][_0xaec3('0x4a')],_0x1e561a[_0xaec3('0x3f')][_0xaec3('0x34')]);_0x1e561a[_0xaec3('0x3f')]['Descriptions']=integrations[_0xaec3('0x4b')](_0x1e561a[_0xaec3('0x3f')][_0xaec3('0x4a')],_0x1e561a[_0xaec3('0x3f')][_0xaec3('0x34')]);return db[_0xaec3('0x44')][_0xaec3('0x3e')](_0x1e561a['body'],{'include':[{'model':db[_0xaec3('0x4c')],'as':_0xaec3('0x4d')},{'model':db[_0xaec3('0x4c')],'as':_0xaec3('0x4e')}]});}return null;})[_0xaec3('0x1e')](respondWithResult(_0xfb6a57,null))[_0xaec3('0x3a')](handleError(_0xfb6a57,null));};exports[_0xaec3('0x4f')]=function(_0x2e5602,_0x10a119,_0x24cc6e){var _0x20ccff='';var _0x40fd73='';return db[_0xaec3('0x25')][_0xaec3('0x43')]({'where':{'id':_0x2e5602['params']['id']},'attributes':['id',_0xaec3('0x50'),_0xaec3('0x51'),_0xaec3('0x52')]})[_0xaec3('0x1e')](handleEntityNotFound(_0x10a119,null))[_0xaec3('0x1e')](function(_0x5a57fb){if(_0x5a57fb){_0x40fd73=_0x5a57fb[_0xaec3('0x50')];_0x20ccff=_0x5a57fb['remoteUri'];var _0x248bd6=_0x5a57fb[_0xaec3('0x51')]['slice'](-0x1);if(_0x248bd6==='/'){_0x20ccff=_0x20ccff[_0xaec3('0x53')](0x0,_0x20ccff[_0xaec3('0x54')](_0x248bd6));}return rp({'method':_0xaec3('0x55'),'uri':util[_0xaec3('0x56')](_0xaec3('0x57'),_0x20ccff,_0xaec3('0x58')),'headers':{'Authorization':_0xaec3('0x59')+_0x5a57fb[_0xaec3('0x52')]},'json':!![]});}})['then'](function(_0x201082){if(_0x201082){var _0x30e218=_0x201082['users'];var _0x6e55f3=![];var _0x262522=null;for(_0x262522=0x0;_0x262522<_0x30e218[_0xaec3('0x3c')];_0x262522++){if(_0x30e218[_0x262522][_0xaec3('0x5a')]===_0x40fd73){_0x6e55f3=!![];}}if(_0x6e55f3){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xaec3('0x1e')](respondWithResult(_0x10a119,null))['catch'](function(_0x5e87c8){var _0x3dfe7a=_0x2e5602['query'][_0xaec3('0x5b')]?0x1f4:_0x5e87c8[_0xaec3('0x5c')]||0x1f4;logger['error'](_0xaec3('0x5d'),_0xaec3('0x4f'),_0x3dfe7a,JSON[_0xaec3('0x5e')](_0x5e87c8));delete _0x5e87c8['name'];if(_0x3dfe7a===0x191){_0x3dfe7a=0x190;}_0x10a119[_0xaec3('0x15')](_0x3dfe7a)[_0xaec3('0x5f')](_0x2e5602['query'][_0xaec3('0x5b')]?{'message':'Wrong\x20credentials','statusCode':_0x5e87c8[_0xaec3('0x5c')]}:_0x5e87c8);});}; \ No newline at end of file +var _0xf015=['set','Content-Range','reject','save','destroy','then','error','stack','name','map','FreshsalesAccount','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','merge','find','create','body','findOne','rawAttributes','filter','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x3f582b,_0xebfae6){var _0x2290db=function(_0x289f7f){while(--_0x289f7f){_0x3f582b['push'](_0x3f582b['shift']());}};_0x2290db(++_0xebfae6);}(_0xf015,0xaa));var _0x5f01=function(_0x372cea,_0x5e5b27){_0x372cea=_0x372cea-0x0;var _0x5b870f=_0xf015[_0x372cea];return _0x5b870f;};'use strict';var emlformat=require(_0x5f01('0x0'));var rimraf=require(_0x5f01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f01('0x2'));var rp=require(_0x5f01('0x3'));var moment=require('moment');var BPromise=require(_0x5f01('0x4'));var Mustache=require(_0x5f01('0x5'));var util=require(_0x5f01('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5f01('0x7'));var fs=require('fs');var fs_extra=require(_0x5f01('0x8'));var _=require('lodash');var squel=require(_0x5f01('0x9'));var crypto=require(_0x5f01('0xa'));var jsforce=require(_0x5f01('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5f01('0xc'));var querystring=require(_0x5f01('0xd'));var Papa=require('papaparse');var Redis=require(_0x5f01('0xe'));var authService=require(_0x5f01('0xf'));var qs=require(_0x5f01('0x10'));var as=require(_0x5f01('0x11'));var hardwareService=require(_0x5f01('0x12'));var logger=require('../../config/logger')(_0x5f01('0x13'));var utils=require(_0x5f01('0x14'));var config=require(_0x5f01('0x15'));var licenseUtil=require(_0x5f01('0x16'));var db=require(_0x5f01('0x17'))['db'];var integrations=require(_0x5f01('0x18'));function respondWithStatusCode(_0x5489c,_0x29e6cc){_0x29e6cc=_0x29e6cc||0xcc;return function(_0x2048ac){if(_0x2048ac){return _0x5489c[_0x5f01('0x19')](_0x29e6cc);}return _0x5489c[_0x5f01('0x1a')](_0x29e6cc)['end']();};}function respondWithResult(_0x221f08,_0xc3092){_0xc3092=_0xc3092||0xc8;return function(_0x3ba891){if(_0x3ba891){return _0x221f08[_0x5f01('0x1a')](_0xc3092)[_0x5f01('0x1b')](_0x3ba891);}};}function respondWithFilteredResult(_0xea183d,_0x265dcc){return function(_0xd7bbf7){if(_0xd7bbf7){var _0x2ebea7=typeof _0x265dcc[_0x5f01('0x1c')]===_0x5f01('0x1d')&&typeof _0x265dcc[_0x5f01('0x1e')]===_0x5f01('0x1d');var _0x7d4a3=_0xd7bbf7['count'];var _0x8e458b=_0x2ebea7?0x0:_0x265dcc['offset'];var _0x46b857=_0x2ebea7?_0xd7bbf7[_0x5f01('0x1f')]:_0x265dcc[_0x5f01('0x1c')]+_0x265dcc['limit'];var _0x5a65c9;if(_0x46b857>=_0x7d4a3){_0x46b857=_0x7d4a3;_0x5a65c9=0xc8;}else{_0x5a65c9=0xce;}_0xea183d[_0x5f01('0x1a')](_0x5a65c9);return _0xea183d[_0x5f01('0x20')](_0x5f01('0x21'),_0x8e458b+'-'+_0x46b857+'/'+_0x7d4a3)[_0x5f01('0x1b')](_0xd7bbf7);}return null;};}function patchUpdates(_0x25bdbb){return function(_0x34e490){try{jsonpatch['apply'](_0x34e490,_0x25bdbb,!![]);}catch(_0xce4283){return BPromise[_0x5f01('0x22')](_0xce4283);}return _0x34e490[_0x5f01('0x23')]();};}function saveUpdates(_0x94b3da,_0x210f4b){return function(_0x2ca3b4){if(_0x2ca3b4){return _0x2ca3b4['update'](_0x94b3da)['then'](function(_0x1f2dc2){return _0x1f2dc2;});}return null;};}function removeEntity(_0x514ecf,_0x539d69){return function(_0x17cb5c){if(_0x17cb5c){return _0x17cb5c[_0x5f01('0x24')]()[_0x5f01('0x25')](function(){_0x514ecf[_0x5f01('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x327297,_0x326f89){return function(_0x3e76e1){if(!_0x3e76e1){_0x327297[_0x5f01('0x19')](0x194);}return _0x3e76e1;};}function handleError(_0x2df2b4,_0x47a1d2){_0x47a1d2=_0x47a1d2||0x1f4;return function(_0x1faa74){logger[_0x5f01('0x26')](_0x1faa74[_0x5f01('0x27')]);if(_0x1faa74[_0x5f01('0x28')]){delete _0x1faa74[_0x5f01('0x28')];}_0x2df2b4[_0x5f01('0x1a')](_0x47a1d2)['send'](_0x1faa74);};}exports['index']=function(_0x32fab5,_0x38689f){var _0x50c0f8={},_0x3e69db={},_0x4095a9={'count':0x0,'rows':[]};var _0x1a76e5=_[_0x5f01('0x29')](db[_0x5f01('0x2a')]['rawAttributes'],function(_0x544f71){return{'name':_0x544f71['fieldName'],'type':_0x544f71[_0x5f01('0x2b')][_0x5f01('0x2c')]};});_0x3e69db[_0x5f01('0x2d')]=_[_0x5f01('0x29')](_0x1a76e5,_0x5f01('0x28'));_0x3e69db[_0x5f01('0x2e')]=_[_0x5f01('0x2f')](_0x32fab5[_0x5f01('0x2e')]);_0x3e69db[_0x5f01('0x30')]=_['intersection'](_0x3e69db[_0x5f01('0x2d')],_0x3e69db[_0x5f01('0x2e')]);_0x50c0f8[_0x5f01('0x31')]=_['intersection'](_0x3e69db[_0x5f01('0x2d')],qs[_0x5f01('0x32')](_0x32fab5['query'][_0x5f01('0x32')]));_0x50c0f8[_0x5f01('0x31')]=_0x50c0f8[_0x5f01('0x31')][_0x5f01('0x33')]?_0x50c0f8[_0x5f01('0x31')]:_0x3e69db[_0x5f01('0x2d')];if(!_0x32fab5[_0x5f01('0x2e')]['hasOwnProperty'](_0x5f01('0x34'))){_0x50c0f8[_0x5f01('0x1e')]=qs[_0x5f01('0x1e')](_0x32fab5[_0x5f01('0x2e')]['limit']);_0x50c0f8[_0x5f01('0x1c')]=qs[_0x5f01('0x1c')](_0x32fab5[_0x5f01('0x2e')]['offset']);}_0x50c0f8[_0x5f01('0x35')]=qs[_0x5f01('0x36')](_0x32fab5[_0x5f01('0x2e')][_0x5f01('0x36')]);_0x50c0f8[_0x5f01('0x37')]=qs['filters'](_[_0x5f01('0x38')](_0x32fab5[_0x5f01('0x2e')],_0x3e69db[_0x5f01('0x30')]),_0x1a76e5);if(_0x32fab5[_0x5f01('0x2e')]['filter']){_0x50c0f8[_0x5f01('0x37')]=_['merge'](_0x50c0f8[_0x5f01('0x37')],{'$or':_[_0x5f01('0x29')](_0x1a76e5,function(_0x2a1642){if(_0x2a1642[_0x5f01('0x2b')]!==_0x5f01('0x39')){var _0x147602={};_0x147602[_0x2a1642[_0x5f01('0x28')]]={'$like':'%'+_0x32fab5[_0x5f01('0x2e')]['filter']+'%'};return _0x147602;}})});}_0x50c0f8=_['merge']({},_0x50c0f8,_0x32fab5[_0x5f01('0x3a')]);var _0xb9d84b={'where':_0x50c0f8[_0x5f01('0x37')]};return db[_0x5f01('0x2a')]['count'](_0xb9d84b)[_0x5f01('0x25')](function(_0x3f4a51){_0x4095a9['count']=_0x3f4a51;if(_0x32fab5[_0x5f01('0x2e')]['includeAll']){_0x50c0f8[_0x5f01('0x3b')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x5f01('0x3c')](_0x50c0f8);})['then'](function(_0x28af0a){_0x4095a9['rows']=_0x28af0a;return _0x4095a9;})['then'](respondWithFilteredResult(_0x38689f,_0x50c0f8))[_0x5f01('0x3d')](handleError(_0x38689f,null));};exports[_0x5f01('0x3e')]=function(_0x1d95cb,_0x1c0d2c){var _0x31ca2b={'raw':![],'where':{'id':_0x1d95cb[_0x5f01('0x3f')]['id']}},_0x136a79={};_0x136a79[_0x5f01('0x2d')]=_[_0x5f01('0x2f')](db['FreshsalesAccount']['rawAttributes']);_0x136a79['query']=_[_0x5f01('0x2f')](_0x1d95cb[_0x5f01('0x2e')]);_0x136a79[_0x5f01('0x30')]=_[_0x5f01('0x40')](_0x136a79[_0x5f01('0x2d')],_0x136a79[_0x5f01('0x2e')]);_0x31ca2b[_0x5f01('0x31')]=_[_0x5f01('0x40')](_0x136a79[_0x5f01('0x2d')],qs[_0x5f01('0x32')](_0x1d95cb[_0x5f01('0x2e')][_0x5f01('0x32')]));_0x31ca2b[_0x5f01('0x31')]=_0x31ca2b['attributes']['length']?_0x31ca2b[_0x5f01('0x31')]:_0x136a79[_0x5f01('0x2d')];if(_0x1d95cb[_0x5f01('0x2e')][_0x5f01('0x41')]){_0x31ca2b[_0x5f01('0x3b')]=[{'all':!![]}];}_0x31ca2b=_[_0x5f01('0x42')]({},_0x31ca2b,_0x1d95cb[_0x5f01('0x3a')]);return db[_0x5f01('0x2a')][_0x5f01('0x43')](_0x31ca2b)[_0x5f01('0x25')](handleEntityNotFound(_0x1c0d2c,null))[_0x5f01('0x25')](respondWithResult(_0x1c0d2c,null))['catch'](handleError(_0x1c0d2c,null));};exports[_0x5f01('0x44')]=function(_0x449594,_0x5f29c7){return db[_0x5f01('0x2a')]['create'](_0x449594[_0x5f01('0x45')],{})[_0x5f01('0x25')](respondWithResult(_0x5f29c7,0xc9))['catch'](handleError(_0x5f29c7,null));};exports['update']=function(_0x111646,_0x3723db){if(_0x111646[_0x5f01('0x45')]['id']){delete _0x111646[_0x5f01('0x45')]['id'];}return db['FreshsalesAccount'][_0x5f01('0x43')]({'where':{'id':_0x111646['params']['id']}})[_0x5f01('0x25')](handleEntityNotFound(_0x3723db,null))[_0x5f01('0x25')](saveUpdates(_0x111646[_0x5f01('0x45')],null))[_0x5f01('0x25')](respondWithResult(_0x3723db,null))[_0x5f01('0x3d')](handleError(_0x3723db,null));};exports[_0x5f01('0x24')]=function(_0x4cbdab,_0x24febc){return db[_0x5f01('0x2a')][_0x5f01('0x43')]({'where':{'id':_0x4cbdab[_0x5f01('0x3f')]['id']}})[_0x5f01('0x25')](handleEntityNotFound(_0x24febc,null))[_0x5f01('0x25')](removeEntity(_0x24febc,null))[_0x5f01('0x3d')](handleError(_0x24febc,null));};exports['getConfigurations']=function(_0x46a1d7,_0xcd18be,_0x4adef4){var _0xc1fced={};var _0x3417b7={};var _0x20e62b;var _0x27be3b;return db[_0x5f01('0x2a')][_0x5f01('0x46')]({'where':{'id':_0x46a1d7[_0x5f01('0x3f')]['id']}})[_0x5f01('0x25')](handleEntityNotFound(_0xcd18be,null))['then'](function(_0x1fd9d4){if(_0x1fd9d4){_0x20e62b=_0x1fd9d4;_0x3417b7[_0x5f01('0x2d')]=_[_0x5f01('0x2f')](db['FreshsalesConfiguration'][_0x5f01('0x47')]);_0x3417b7[_0x5f01('0x2e')]=_[_0x5f01('0x2f')](_0x46a1d7[_0x5f01('0x2e')]);_0x3417b7[_0x5f01('0x30')]=_['intersection'](_0x3417b7[_0x5f01('0x2d')],_0x3417b7[_0x5f01('0x2e')]);_0xc1fced[_0x5f01('0x31')]=_[_0x5f01('0x40')](_0x3417b7[_0x5f01('0x2d')],qs[_0x5f01('0x32')](_0x46a1d7[_0x5f01('0x2e')]['fields']));_0xc1fced['attributes']=_0xc1fced[_0x5f01('0x31')][_0x5f01('0x33')]?_0xc1fced['attributes']:_0x3417b7[_0x5f01('0x2d')];_0xc1fced[_0x5f01('0x35')]=qs[_0x5f01('0x36')](_0x46a1d7['query'][_0x5f01('0x36')]);_0xc1fced['where']=qs[_0x5f01('0x30')](_[_0x5f01('0x38')](_0x46a1d7['query'],_0x3417b7[_0x5f01('0x30')]));if(_0x46a1d7[_0x5f01('0x2e')][_0x5f01('0x48')]){_0xc1fced[_0x5f01('0x37')]=_['merge'](_0xc1fced[_0x5f01('0x37')],{'$or':_[_0x5f01('0x29')](_0xc1fced[_0x5f01('0x31')],function(_0x22afbd){var _0x475f12={};_0x475f12[_0x22afbd]={'$like':'%'+_0x46a1d7[_0x5f01('0x2e')][_0x5f01('0x48')]+'%'};return _0x475f12;})});}_0xc1fced=_[_0x5f01('0x42')]({},_0xc1fced,_0x46a1d7[_0x5f01('0x3a')]);return _0x20e62b[_0x5f01('0x49')](_0xc1fced);}})[_0x5f01('0x25')](function(_0x150452){if(_0x150452){_0x27be3b=_0x150452[_0x5f01('0x33')];if(!_0x46a1d7['query'][_0x5f01('0x4a')](_0x5f01('0x34'))){_0xc1fced[_0x5f01('0x1e')]=qs['limit'](_0x46a1d7[_0x5f01('0x2e')][_0x5f01('0x1e')]);_0xc1fced[_0x5f01('0x1c')]=qs[_0x5f01('0x1c')](_0x46a1d7[_0x5f01('0x2e')][_0x5f01('0x1c')]);}return _0x20e62b[_0x5f01('0x49')](_0xc1fced);}})['then'](function(_0x2ff2fc){if(_0x2ff2fc){return _0x2ff2fc?{'count':_0x27be3b,'rows':_0x2ff2fc}:null;}})[_0x5f01('0x25')](respondWithResult(_0xcd18be,null))['catch'](handleError(_0xcd18be,null));};exports['addConfiguration']=function(_0x152b05,_0x705942,_0x49960e){if(_0x152b05['body']['id']){delete _0x152b05[_0x5f01('0x45')]['id'];}return db[_0x5f01('0x2a')][_0x5f01('0x46')]({'where':{'id':_0x152b05[_0x5f01('0x3f')]['id']}})[_0x5f01('0x25')](handleEntityNotFound(_0x705942,null))[_0x5f01('0x25')](function(_0x136df5){if(_0x136df5){_0x152b05[_0x5f01('0x45')][_0x5f01('0x4b')]=_0x136df5['id'];_0x152b05['body'][_0x5f01('0x4c')]=integrations[_0x5f01('0x4d')](_0x152b05[_0x5f01('0x45')][_0x5f01('0x4e')],_0x152b05['body']['type']);_0x152b05[_0x5f01('0x45')][_0x5f01('0x4f')]=integrations[_0x5f01('0x50')](_0x152b05[_0x5f01('0x45')]['channel'],_0x152b05[_0x5f01('0x45')][_0x5f01('0x2b')]);return db['FreshsalesConfiguration'][_0x5f01('0x44')](_0x152b05[_0x5f01('0x45')],{'include':[{'model':db[_0x5f01('0x51')],'as':_0x5f01('0x4c')},{'model':db[_0x5f01('0x51')],'as':_0x5f01('0x4f')}]});}return null;})[_0x5f01('0x25')](respondWithResult(_0x705942,null))['catch'](handleError(_0x705942,null));};exports['getFields']=function(_0x5bf8d7,_0x7f9ab6,_0x433ab4){var _0x178a6f='';var _0x512325='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x5bf8d7['params']['id']},'attributes':['id',_0x5f01('0x52'),'remoteUri',_0x5f01('0x53')]})[_0x5f01('0x25')](handleEntityNotFound(_0x7f9ab6,null))[_0x5f01('0x25')](function(_0x57ebb9){if(_0x57ebb9){_0x512325=_0x57ebb9['username'];_0x178a6f=_0x57ebb9[_0x5f01('0x54')];var _0x1097e7=_0x57ebb9['remoteUri'][_0x5f01('0x55')](-0x1);if(_0x1097e7==='/'){_0x178a6f=_0x178a6f[_0x5f01('0x56')](0x0,_0x178a6f[_0x5f01('0x57')](_0x1097e7));}return rp({'method':_0x5f01('0x58'),'uri':util[_0x5f01('0x59')](_0x5f01('0x5a'),_0x178a6f,_0x5f01('0x5b')),'headers':{'Authorization':_0x5f01('0x5c')+_0x57ebb9[_0x5f01('0x53')]},'json':!![]});}})[_0x5f01('0x25')](function(_0x11aa49){if(_0x11aa49){var _0x5b0f9c=_0x11aa49[_0x5f01('0x5d')];var _0x2f9601=![];var _0x13e259=null;for(_0x13e259=0x0;_0x13e259<_0x5b0f9c['length'];_0x13e259++){if(_0x5b0f9c[_0x13e259][_0x5f01('0x5e')]===_0x512325){_0x2f9601=!![];}}if(_0x2f9601){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5f01('0x5f')});}}})[_0x5f01('0x25')](respondWithResult(_0x7f9ab6,null))[_0x5f01('0x3d')](function(_0x4b2b69){var _0x3b1198=_0x5bf8d7[_0x5f01('0x2e')]['test']?0x1f4:_0x4b2b69[_0x5f01('0x60')]||0x1f4;logger[_0x5f01('0x26')](_0x5f01('0x61'),_0x5f01('0x62'),_0x3b1198,JSON['stringify'](_0x4b2b69));delete _0x4b2b69[_0x5f01('0x28')];if(_0x3b1198===0x191){_0x3b1198=0x190;}_0x7f9ab6[_0x5f01('0x1a')](_0x3b1198)[_0x5f01('0x63')](_0x5bf8d7[_0x5f01('0x2e')][_0x5f01('0x64')]?{'message':'Wrong\x20credentials','statusCode':_0x4b2b69[_0x5f01('0x60')]}:_0x4b2b69);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index a56c1a2..fd1ab92 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 _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','exports','int_freshsales_accounts'];(function(_0x82def4,_0x4ac110){var _0x4117fc=function(_0x1b398b){while(--_0x1b398b){_0x82def4['push'](_0x82def4['shift']());}};_0x4117fc(++_0x4ac110);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x74745d,_0x177606){_0x74745d=_0x74745d-0x0;var _0x174ab3=_0xfdbd[_0x74745d];return _0x174ab3;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xdfdb('0xa')]=function(_0x41bd5e,_0x489f19){return _0x41bd5e['define']('FreshsalesAccount',attributes,{'tableName':_0xdfdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x627e=['path','rimraf','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x57fa6a,_0x5ebc35){var _0x10777b=function(_0x3fb795){while(--_0x3fb795){_0x57fa6a['push'](_0x57fa6a['shift']());}};_0x10777b(++_0x5ebc35);}(_0x627e,0x14a));var _0xe627=function(_0x38cf13,_0x5f31af){_0x38cf13=_0x38cf13-0x0;var _0x3fbf11=_0x627e[_0x38cf13];return _0x3fbf11;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var moment=require(_0xe627('0x4'));var BPromise=require('bluebird');var rp=require(_0xe627('0x5'));var fs=require('fs');var path=require(_0xe627('0x6'));var rimraf=require(_0xe627('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe627('0x8')]=function(_0x3f2791,_0x45e49a){return _0x3f2791[_0xe627('0x9')](_0xe627('0xa'),attributes,{'tableName':_0xe627('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index cced0e2..180cf0a 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 _0x81c6=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','ShowFreshsalesAccount','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x3fd49f,_0x2986e5){var _0x1aae93=function(_0x456ea4){while(--_0x456ea4){_0x3fd49f['push'](_0x3fd49f['shift']());}};_0x1aae93(++_0x2986e5);}(_0x81c6,0x1d5));var _0x681c=function(_0x15cae3,_0x458cb9){_0x15cae3=_0x15cae3-0x0;var _0x20596f=_0x81c6[_0x15cae3];return _0x20596f;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});}exports[_0x681c('0x15')]=function(_0x42f506){var _0x4a9192=this;return new Promise(function(_0x42304f,_0x5b03fd){return db[_0x681c('0x16')][_0x681c('0x17')]({'raw':_0x42f506['options']?_0x42f506[_0x681c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')]['attributes']||null:null,'limit':_0x42f506['options']?_0x42f506['options'][_0x681c('0x1a')]||null:null,'include':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x42f506[_0x681c('0x18')][_0x681c('0x1b')],function(_0x3d0297){return{'model':db[_0x3d0297[_0x681c('0x1d')]],'as':_0x3d0297['as'],'attributes':_0x3d0297[_0x681c('0x1e')],'include':_0x3d0297[_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x3d0297[_0x681c('0x1b')],function(_0x218410){return{'model':db[_0x218410[_0x681c('0x1d')]],'as':_0x218410['as'],'attributes':_0x218410[_0x681c('0x1e')],'include':_0x218410['include']?_[_0x681c('0x1c')](_0x218410['include'],function(_0x5f8d64){return{'model':db[_0x5f8d64['model']],'as':_0x5f8d64['as'],'attributes':_0x5f8d64['attributes']};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x17ea7c){logger[_0x681c('0x12')](_0x681c('0x15'),_0x42f506);logger['debug'](_0x681c('0x15'),_0x42f506,JSON[_0x681c('0xe')](_0x17ea7c));_0x42304f(_0x17ea7c);})[_0x681c('0x14')](function(_0x936fce){logger[_0x681c('0x10')](_0x681c('0x15'),_0x936fce[_0x681c('0x11')],_0x42f506);_0x5b03fd(_0x4a9192['error'](0x1f4,_0x936fce[_0x681c('0x11')]));});});};exports[_0x681c('0x1f')]=function(_0x2e783d){var _0x4af6aa=this;return new Promise(function(_0x385b14,_0x2179cd){return db[_0x681c('0x16')]['find']({'raw':_0x2e783d[_0x681c('0x18')]?_0x2e783d['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e783d[_0x681c('0x18')]?_0x2e783d[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x2e783d['options']?_0x2e783d[_0x681c('0x18')]['attributes']||null:null,'include':_0x2e783d[_0x681c('0x18')]?_0x2e783d['options']['include']?_['map'](_0x2e783d[_0x681c('0x18')][_0x681c('0x1b')],function(_0x5a349a){return{'model':db[_0x5a349a[_0x681c('0x1d')]],'as':_0x5a349a['as'],'attributes':_0x5a349a['attributes'],'include':_0x5a349a['include']?_[_0x681c('0x1c')](_0x5a349a['include'],function(_0x35991d){return{'model':db[_0x35991d[_0x681c('0x1d')]],'as':_0x35991d['as'],'attributes':_0x35991d[_0x681c('0x1e')],'include':_0x35991d['include']?_['map'](_0x35991d[_0x681c('0x1b')],function(_0x4545ff){return{'model':db[_0x4545ff['model']],'as':_0x4545ff['as'],'attributes':_0x4545ff[_0x681c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x302dab){logger['info'](_0x681c('0x1f'),_0x2e783d);logger[_0x681c('0xb')]('ShowFreshsalesAccount',_0x2e783d,JSON[_0x681c('0xe')](_0x302dab));_0x385b14(_0x302dab);})[_0x681c('0x14')](function(_0x83953c){logger[_0x681c('0x10')](_0x681c('0x1f'),_0x83953c['message'],_0x2e783d);_0x2179cd(_0x4af6aa['error'](0x1f4,_0x83953c[_0x681c('0x11')]));});});}; \ No newline at end of file +var _0x7ee1=['attributes','limit','include','map','model','info','ShowFreshsalesAccount','find','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x1ac77b,_0x10ee7a){var _0x161584=function(_0x5a810d){while(--_0x5a810d){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x161584(++_0x10ee7a);}(_0x7ee1,0x8d));var _0x17ee=function(_0x5ce173,_0x522a95){_0x5ce173=_0x5ce173-0x0;var _0x13d857=_0x7ee1[_0x5ce173];return _0x13d857;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b9eb,_0x54b4f6,_0x3f61af){return new BPromise(function(_0x57e1d1,_0x3d767b){return client[_0x17ee('0x9')](_0x29b9eb,_0x3f61af)[_0x17ee('0xa')](function(_0x4af369){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,_0x17ee('0xb'));logger['debug'](_0x17ee('0xc'),_0x54b4f6,_0x17ee('0xb'),JSON[_0x17ee('0xd')](_0x4af369));if(_0x4af369[_0x17ee('0xe')]){if(_0x4af369['error'][_0x17ee('0xf')]===0x1f4){logger['error'](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x3d767b(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x57e1d1(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,'request\x20sent');_0x57e1d1(_0x4af369['result'][_0x17ee('0x11')]);}})[_0x17ee('0x12')](function(_0x1b87c3){logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x1b87c3);_0x3d767b(_0x1b87c3);});});}exports[_0x17ee('0x13')]=function(_0x63d27f){var _0x587ca7=this;return new Promise(function(_0x44fe58,_0x1118a3){return db[_0x17ee('0x14')][_0x17ee('0x15')]({'raw':_0x63d27f[_0x17ee('0x16')]?_0x63d27f['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x63d27f['options']?_0x63d27f[_0x17ee('0x16')]['where']||null:null,'attributes':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'limit':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x19')]||null:null,'include':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x63d27f[_0x17ee('0x16')]['include'],function(_0x4b7bfe){return{'model':db[_0x4b7bfe[_0x17ee('0x1c')]],'as':_0x4b7bfe['as'],'attributes':_0x4b7bfe[_0x17ee('0x18')],'include':_0x4b7bfe[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x4b7bfe[_0x17ee('0x1a')],function(_0xea358f){return{'model':db[_0xea358f[_0x17ee('0x1c')]],'as':_0xea358f['as'],'attributes':_0xea358f[_0x17ee('0x18')],'include':_0xea358f[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0xea358f[_0x17ee('0x1a')],function(_0x2a332f){return{'model':db[_0x2a332f['model']],'as':_0x2a332f['as'],'attributes':_0x2a332f[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x11ce7e){logger[_0x17ee('0x1d')](_0x17ee('0x13'),_0x63d27f);logger['debug'](_0x17ee('0x13'),_0x63d27f,JSON[_0x17ee('0xd')](_0x11ce7e));_0x44fe58(_0x11ce7e);})[_0x17ee('0x12')](function(_0x4c461b){logger[_0x17ee('0xe')](_0x17ee('0x13'),_0x4c461b['message'],_0x63d27f);_0x1118a3(_0x587ca7[_0x17ee('0xe')](0x1f4,_0x4c461b['message']));});});};exports[_0x17ee('0x1e')]=function(_0x5a44c4){var _0x141ac9=this;return new Promise(function(_0x23ca2e,_0x373c20){return db['FreshsalesAccount'][_0x17ee('0x1f')]({'raw':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['where']||null:null,'attributes':_0x5a44c4['options']?_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'include':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['include']?_['map'](_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x1a')],function(_0x23578a){return{'model':db[_0x23578a[_0x17ee('0x1c')]],'as':_0x23578a['as'],'attributes':_0x23578a[_0x17ee('0x18')],'include':_0x23578a[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x23578a['include'],function(_0x4a6bc9){return{'model':db[_0x4a6bc9['model']],'as':_0x4a6bc9['as'],'attributes':_0x4a6bc9[_0x17ee('0x18')],'include':_0x4a6bc9['include']?_[_0x17ee('0x1b')](_0x4a6bc9[_0x17ee('0x1a')],function(_0xed7e8a){return{'model':db[_0xed7e8a['model']],'as':_0xed7e8a['as'],'attributes':_0xed7e8a[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x590d27){logger['info'](_0x17ee('0x1e'),_0x5a44c4);logger[_0x17ee('0x20')](_0x17ee('0x1e'),_0x5a44c4,JSON[_0x17ee('0xd')](_0x590d27));_0x23ca2e(_0x590d27);})[_0x17ee('0x12')](function(_0x5a2c08){logger['error'](_0x17ee('0x1e'),_0x5a2c08[_0x17ee('0x11')],_0x5a44c4);_0x373c20(_0x141ac9[_0x17ee('0xe')](0x1f4,_0x5a2c08[_0x17ee('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 5d8b55f..59f0796 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 _0x72df=['show','getSubjects','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x579099,_0x227462){var _0x32effb=function(_0x14d0d9){while(--_0x14d0d9){_0x579099['push'](_0x579099['shift']());}};_0x32effb(++_0x227462);}(_0x72df,0x170));var _0xf72d=function(_0x5c2aeb,_0x4198f2){_0x5c2aeb=_0x5c2aeb-0x0;var _0x184716=_0x72df[_0x5c2aeb];return _0x184716;};'use strict';var multer=require(_0xf72d('0x0'));var util=require(_0xf72d('0x1'));var path=require('path');var timeout=require(_0xf72d('0x2'));var express=require(_0xf72d('0x3'));var router=express[_0xf72d('0x4')]();var fs_extra=require(_0xf72d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf72d('0x6'));var controller=require(_0xf72d('0x7'));router['get']('/',auth[_0xf72d('0x8')](),controller[_0xf72d('0x9')]);router[_0xf72d('0xa')](_0xf72d('0xb'),auth[_0xf72d('0x8')](),controller[_0xf72d('0xc')]);router['get']('/:id/subjects',auth[_0xf72d('0x8')](),controller[_0xf72d('0xd')]);router[_0xf72d('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xf72d('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xf72d('0xe')]('/',auth[_0xf72d('0x8')](),controller[_0xf72d('0xf')]);router[_0xf72d('0x10')](_0xf72d('0xb'),auth[_0xf72d('0x8')](),controller[_0xf72d('0x11')]);router[_0xf72d('0x12')](_0xf72d('0xb'),auth[_0xf72d('0x8')](),controller['destroy']);module[_0xf72d('0x13')]=router; \ No newline at end of file +var _0x4d67=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d67,0x16f));var _0x74d6=function(_0x161084,_0x207564){_0x161084=_0x161084-0x0;var _0x395240=_0x4d67[_0x161084];return _0x395240;};'use strict';var multer=require(_0x74d6('0x0'));var util=require(_0x74d6('0x1'));var path=require('path');var timeout=require(_0x74d6('0x2'));var express=require(_0x74d6('0x3'));var router=express[_0x74d6('0x4')]();var fs_extra=require(_0x74d6('0x5'));var auth=require(_0x74d6('0x6'));var interaction=require(_0x74d6('0x7'));var config=require(_0x74d6('0x8'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x74d6('0x9')](),controller[_0x74d6('0xa')]);router[_0x74d6('0xb')](_0x74d6('0xc'),auth[_0x74d6('0x9')](),controller[_0x74d6('0xd')]);router[_0x74d6('0xb')]('/:id/subjects',auth[_0x74d6('0x9')](),controller[_0x74d6('0xe')]);router[_0x74d6('0xb')](_0x74d6('0xf'),auth[_0x74d6('0x9')](),controller[_0x74d6('0x10')]);router[_0x74d6('0xb')](_0x74d6('0x11'),auth[_0x74d6('0x9')](),controller[_0x74d6('0x12')]);router[_0x74d6('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x74d6('0x14')](_0x74d6('0xc'),auth[_0x74d6('0x9')](),controller['update']);router[_0x74d6('0x15')](_0x74d6('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a1cba4f..e41d539 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 _0x3bc3=['STRING'];(function(_0x22bc06,_0x27f48a){var _0x2e4b8b=function(_0x37307d){while(--_0x37307d){_0x22bc06['push'](_0x22bc06['shift']());}};_0x2e4b8b(++_0x27f48a);}(_0x3bc3,0x15f));var _0x33bc=function(_0x228876,_0x2873f8){_0x228876=_0x228876-0x0;var _0x35a696=_0x3bc3[_0x228876];return _0x35a696;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x33bc('0x0')]}}; \ No newline at end of file +var _0xea78=['sequelize','exports','STRING'];(function(_0x5a1314,_0x1df1f1){var _0xbbcabc=function(_0x2511f2){while(--_0x2511f2){_0x5a1314['push'](_0x5a1314['shift']());}};_0xbbcabc(++_0x1df1f1);}(_0xea78,0xc6));var _0x8ea7=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xea78[_0x18f64a];return _0x44687f;};'use strict';var Sequelize=require(_0x8ea7('0x0'));module[_0x8ea7('0x1')]={'name':{'type':Sequelize[_0x8ea7('0x2')]},'description':{'type':Sequelize[_0x8ea7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 6f2bf7d..9508fc1 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 _0xda41=['order','sort','where','filter','merge','includeAll','include','rows','catch','show','options','find','create','body','update','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x14db15,_0x5110b2){var _0x5e550c=function(_0x2c1333){while(--_0x2c1333){_0x14db15['push'](_0x14db15['shift']());}};_0x5e550c(++_0x5110b2);}(_0xda41,0x1af));var _0x1da4=function(_0x5efda1,_0x171f5c){_0x5efda1=_0x5efda1-0x0;var _0x503665=_0xda41[_0x5efda1];return _0x503665;};'use strict';var emlformat=require(_0x1da4('0x0'));var rimraf=require(_0x1da4('0x1'));var zipdir=require(_0x1da4('0x2'));var jsonpatch=require(_0x1da4('0x3'));var rp=require('request-promise');var moment=require(_0x1da4('0x4'));var BPromise=require(_0x1da4('0x5'));var Mustache=require(_0x1da4('0x6'));var util=require(_0x1da4('0x7'));var path=require(_0x1da4('0x8'));var sox=require('sox');var csv=require(_0x1da4('0x9'));var ejs=require(_0x1da4('0xa'));var fs=require('fs');var fs_extra=require(_0x1da4('0xb'));var _=require('lodash');var squel=require(_0x1da4('0xc'));var crypto=require(_0x1da4('0xd'));var jsforce=require(_0x1da4('0xe'));var deskjs=require(_0x1da4('0xf'));var toCsv=require(_0x1da4('0x9'));var querystring=require(_0x1da4('0x10'));var Papa=require(_0x1da4('0x11'));var Redis=require(_0x1da4('0x12'));var authService=require(_0x1da4('0x13'));var qs=require(_0x1da4('0x14'));var as=require(_0x1da4('0x15'));var hardwareService=require(_0x1da4('0x16'));var logger=require(_0x1da4('0x17'))(_0x1da4('0x18'));var utils=require(_0x1da4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1da4('0x1a'));var db=require(_0x1da4('0x1b'))['db'];function respondWithStatusCode(_0x53dd55,_0x351a23){_0x351a23=_0x351a23||0xcc;return function(_0x2291a4){if(_0x2291a4){return _0x53dd55[_0x1da4('0x1c')](_0x351a23);}return _0x53dd55['status'](_0x351a23)['end']();};}function respondWithResult(_0x48f629,_0x40ce60){_0x40ce60=_0x40ce60||0xc8;return function(_0x128e89){if(_0x128e89){return _0x48f629[_0x1da4('0x1d')](_0x40ce60)[_0x1da4('0x1e')](_0x128e89);}};}function respondWithFilteredResult(_0x4a1b0c,_0x44636f){return function(_0x1846af){if(_0x1846af){var _0x1c6747=typeof _0x44636f[_0x1da4('0x1f')]===_0x1da4('0x20')&&typeof _0x44636f[_0x1da4('0x21')]===_0x1da4('0x20');var _0xbef3df=_0x1846af[_0x1da4('0x22')];var _0x1dd440=_0x1c6747?0x0:_0x44636f[_0x1da4('0x1f')];var _0x559c5a=_0x1c6747?_0x1846af[_0x1da4('0x22')]:_0x44636f[_0x1da4('0x1f')]+_0x44636f[_0x1da4('0x21')];var _0x2b4c0d;if(_0x559c5a>=_0xbef3df){_0x559c5a=_0xbef3df;_0x2b4c0d=0xc8;}else{_0x2b4c0d=0xce;}_0x4a1b0c['status'](_0x2b4c0d);return _0x4a1b0c['set'](_0x1da4('0x23'),_0x1dd440+'-'+_0x559c5a+'/'+_0xbef3df)[_0x1da4('0x1e')](_0x1846af);}return null;};}function patchUpdates(_0x2bfe34){return function(_0x3c0d0f){try{jsonpatch[_0x1da4('0x24')](_0x3c0d0f,_0x2bfe34,!![]);}catch(_0x21d725){return BPromise['reject'](_0x21d725);}return _0x3c0d0f[_0x1da4('0x25')]();};}function saveUpdates(_0x5f1582,_0x1b0c59){return function(_0x4be5be){if(_0x4be5be){return _0x4be5be['update'](_0x5f1582)[_0x1da4('0x26')](function(_0xdf4418){return _0xdf4418;});}return null;};}function removeEntity(_0x437985,_0x3977d2){return function(_0x5a85cf){if(_0x5a85cf){return _0x5a85cf[_0x1da4('0x27')]()[_0x1da4('0x26')](function(){_0x437985[_0x1da4('0x1d')](0xcc)[_0x1da4('0x28')]();});}};}function handleEntityNotFound(_0x41dac5,_0x45e419){return function(_0xfd2f8d){if(!_0xfd2f8d){_0x41dac5['sendStatus'](0x194);}return _0xfd2f8d;};}function handleError(_0x32d9f7,_0x2f7e94){_0x2f7e94=_0x2f7e94||0x1f4;return function(_0x4e96d5){logger[_0x1da4('0x29')](_0x4e96d5[_0x1da4('0x2a')]);if(_0x4e96d5[_0x1da4('0x2b')]){delete _0x4e96d5[_0x1da4('0x2b')];}_0x32d9f7['status'](_0x2f7e94)[_0x1da4('0x2c')](_0x4e96d5);};}exports[_0x1da4('0x2d')]=function(_0x3a4814,_0x21364e){var _0x1db400={},_0x4442d9={},_0x1dc50b={'count':0x0,'rows':[]};var _0xd8f105=_[_0x1da4('0x2e')](db[_0x1da4('0x2f')][_0x1da4('0x30')],function(_0x39687f){return{'name':_0x39687f['fieldName'],'type':_0x39687f[_0x1da4('0x31')][_0x1da4('0x32')]};});_0x4442d9[_0x1da4('0x33')]=_['map'](_0xd8f105,_0x1da4('0x2b'));_0x4442d9[_0x1da4('0x34')]=_[_0x1da4('0x35')](_0x3a4814[_0x1da4('0x34')]);_0x4442d9[_0x1da4('0x36')]=_[_0x1da4('0x37')](_0x4442d9[_0x1da4('0x33')],_0x4442d9['query']);_0x1db400[_0x1da4('0x38')]=_[_0x1da4('0x37')](_0x4442d9['model'],qs[_0x1da4('0x39')](_0x3a4814[_0x1da4('0x34')][_0x1da4('0x39')]));_0x1db400[_0x1da4('0x38')]=_0x1db400[_0x1da4('0x38')][_0x1da4('0x3a')]?_0x1db400[_0x1da4('0x38')]:_0x4442d9['model'];if(!_0x3a4814[_0x1da4('0x34')][_0x1da4('0x3b')](_0x1da4('0x3c'))){_0x1db400[_0x1da4('0x21')]=qs[_0x1da4('0x21')](_0x3a4814[_0x1da4('0x34')][_0x1da4('0x21')]);_0x1db400[_0x1da4('0x1f')]=qs[_0x1da4('0x1f')](_0x3a4814[_0x1da4('0x34')][_0x1da4('0x1f')]);}_0x1db400[_0x1da4('0x3d')]=qs[_0x1da4('0x3e')](_0x3a4814[_0x1da4('0x34')][_0x1da4('0x3e')]);_0x1db400[_0x1da4('0x3f')]=qs[_0x1da4('0x36')](_['pick'](_0x3a4814[_0x1da4('0x34')],_0x4442d9[_0x1da4('0x36')]),_0xd8f105);if(_0x3a4814[_0x1da4('0x34')][_0x1da4('0x40')]){_0x1db400[_0x1da4('0x3f')]=_[_0x1da4('0x41')](_0x1db400[_0x1da4('0x3f')],{'$or':_[_0x1da4('0x2e')](_0xd8f105,function(_0x1bd9e6){if(_0x1bd9e6[_0x1da4('0x31')]!=='VIRTUAL'){var _0xb57f76={};_0xb57f76[_0x1bd9e6[_0x1da4('0x2b')]]={'$like':'%'+_0x3a4814[_0x1da4('0x34')][_0x1da4('0x40')]+'%'};return _0xb57f76;}})});}_0x1db400=_[_0x1da4('0x41')]({},_0x1db400,_0x3a4814['options']);var _0x2f0f02={'where':_0x1db400[_0x1da4('0x3f')]};return db[_0x1da4('0x2f')][_0x1da4('0x22')](_0x2f0f02)[_0x1da4('0x26')](function(_0x361365){_0x1dc50b[_0x1da4('0x22')]=_0x361365;if(_0x3a4814[_0x1da4('0x34')][_0x1da4('0x42')]){_0x1db400[_0x1da4('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1db400);})[_0x1da4('0x26')](function(_0x20a61e){_0x1dc50b[_0x1da4('0x44')]=_0x20a61e;return _0x1dc50b;})['then'](respondWithFilteredResult(_0x21364e,_0x1db400))[_0x1da4('0x45')](handleError(_0x21364e,null));};exports[_0x1da4('0x46')]=function(_0xd1a038,_0x3bec7a){var _0x4c5f9c={'raw':![],'where':{'id':_0xd1a038['params']['id']}},_0x2ce02f={};_0x2ce02f[_0x1da4('0x33')]=_[_0x1da4('0x35')](db[_0x1da4('0x2f')][_0x1da4('0x30')]);_0x2ce02f[_0x1da4('0x34')]=_[_0x1da4('0x35')](_0xd1a038[_0x1da4('0x34')]);_0x2ce02f[_0x1da4('0x36')]=_[_0x1da4('0x37')](_0x2ce02f[_0x1da4('0x33')],_0x2ce02f[_0x1da4('0x34')]);_0x4c5f9c['attributes']=_[_0x1da4('0x37')](_0x2ce02f['model'],qs[_0x1da4('0x39')](_0xd1a038[_0x1da4('0x34')][_0x1da4('0x39')]));_0x4c5f9c[_0x1da4('0x38')]=_0x4c5f9c[_0x1da4('0x38')]['length']?_0x4c5f9c['attributes']:_0x2ce02f[_0x1da4('0x33')];if(_0xd1a038[_0x1da4('0x34')][_0x1da4('0x42')]){_0x4c5f9c[_0x1da4('0x43')]=[{'all':!![]}];}_0x4c5f9c=_[_0x1da4('0x41')]({},_0x4c5f9c,_0xd1a038[_0x1da4('0x47')]);return db['FreshsalesConfiguration'][_0x1da4('0x48')](_0x4c5f9c)[_0x1da4('0x26')](handleEntityNotFound(_0x3bec7a,null))[_0x1da4('0x26')](respondWithResult(_0x3bec7a,null))['catch'](handleError(_0x3bec7a,null));};exports[_0x1da4('0x49')]=function(_0x507162,_0x570c1f){return db[_0x1da4('0x2f')]['create'](_0x507162[_0x1da4('0x4a')],{})['then'](respondWithResult(_0x570c1f,0xc9))[_0x1da4('0x45')](handleError(_0x570c1f,null));};exports[_0x1da4('0x4b')]=function(_0x329681,_0x1ea9c8){if(_0x329681[_0x1da4('0x4a')]['id']){delete _0x329681[_0x1da4('0x4a')]['id'];}return db[_0x1da4('0x2f')][_0x1da4('0x48')]({'where':{'id':_0x329681[_0x1da4('0x4c')]['id']}})[_0x1da4('0x26')](handleEntityNotFound(_0x1ea9c8,null))[_0x1da4('0x26')](saveUpdates(_0x329681['body'],null))[_0x1da4('0x26')](respondWithResult(_0x1ea9c8,null))[_0x1da4('0x45')](handleError(_0x1ea9c8,null));};exports['destroy']=function(_0x485d2b,_0x5e4eb5){return db[_0x1da4('0x2f')]['find']({'where':{'id':_0x485d2b[_0x1da4('0x4c')]['id']}})[_0x1da4('0x26')](handleEntityNotFound(_0x5e4eb5,null))[_0x1da4('0x26')](removeEntity(_0x5e4eb5,null))[_0x1da4('0x45')](handleError(_0x5e4eb5,null));};exports[_0x1da4('0x4d')]=function(_0x13290e,_0x18d190,_0x489095){var _0x3d7013={};var _0x1dcd22={};var _0x5a028b;var _0x3ff41e;return db[_0x1da4('0x2f')][_0x1da4('0x4e')]({'where':{'id':_0x13290e[_0x1da4('0x4c')]['id']}})[_0x1da4('0x26')](handleEntityNotFound(_0x18d190,null))[_0x1da4('0x26')](function(_0x3e801){if(_0x3e801){_0x5a028b=_0x3e801;_0x1dcd22[_0x1da4('0x33')]=_[_0x1da4('0x35')](db[_0x1da4('0x4f')][_0x1da4('0x30')]);_0x1dcd22[_0x1da4('0x34')]=_[_0x1da4('0x35')](_0x13290e[_0x1da4('0x34')]);_0x1dcd22[_0x1da4('0x36')]=_[_0x1da4('0x37')](_0x1dcd22[_0x1da4('0x33')],_0x1dcd22[_0x1da4('0x34')]);_0x3d7013['attributes']=_[_0x1da4('0x37')](_0x1dcd22[_0x1da4('0x33')],qs[_0x1da4('0x39')](_0x13290e['query']['fields']));_0x3d7013[_0x1da4('0x38')]=_0x3d7013[_0x1da4('0x38')][_0x1da4('0x3a')]?_0x3d7013[_0x1da4('0x38')]:_0x1dcd22[_0x1da4('0x33')];_0x3d7013['order']=qs[_0x1da4('0x3e')](_0x13290e[_0x1da4('0x34')]['sort']);_0x3d7013[_0x1da4('0x3f')]=qs[_0x1da4('0x36')](_[_0x1da4('0x50')](_0x13290e['query'],_0x1dcd22[_0x1da4('0x36')]));if(_0x13290e[_0x1da4('0x34')][_0x1da4('0x40')]){_0x3d7013['where']=_['merge'](_0x3d7013[_0x1da4('0x3f')],{'$or':_[_0x1da4('0x2e')](_0x3d7013['attributes'],function(_0x3695ad){var _0x5f1532={};_0x5f1532[_0x3695ad]={'$like':'%'+_0x13290e[_0x1da4('0x34')]['filter']+'%'};return _0x5f1532;})});}_0x3d7013=_[_0x1da4('0x41')]({},_0x3d7013,_0x13290e[_0x1da4('0x47')]);return _0x5a028b[_0x1da4('0x4d')](_0x3d7013);}})[_0x1da4('0x26')](function(_0x300f9){if(_0x300f9){_0x3ff41e=_0x300f9[_0x1da4('0x3a')];if(!_0x13290e[_0x1da4('0x34')][_0x1da4('0x3b')](_0x1da4('0x3c'))){_0x3d7013[_0x1da4('0x21')]=qs[_0x1da4('0x21')](_0x13290e[_0x1da4('0x34')]['limit']);_0x3d7013['offset']=qs[_0x1da4('0x1f')](_0x13290e[_0x1da4('0x34')][_0x1da4('0x1f')]);}return _0x5a028b['getSubjects'](_0x3d7013);}})['then'](function(_0x5f5525){if(_0x5f5525){return _0x5f5525?{'count':_0x3ff41e,'rows':_0x5f5525}:null;}})[_0x1da4('0x26')](respondWithResult(_0x18d190,null))['catch'](handleError(_0x18d190,null));};exports[_0x1da4('0x51')]=function(_0x4f79c6,_0x46d494,_0x11ba32){var _0xb7d641={};var _0x51d21c={};var _0x39e5e7;var _0x4e4898;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4f79c6[_0x1da4('0x4c')]['id']}})[_0x1da4('0x26')](handleEntityNotFound(_0x46d494,null))[_0x1da4('0x26')](function(_0x1cd515){if(_0x1cd515){_0x39e5e7=_0x1cd515;_0x51d21c[_0x1da4('0x33')]=_[_0x1da4('0x35')](db['FreshsalesField'][_0x1da4('0x30')]);_0x51d21c[_0x1da4('0x34')]=_['keys'](_0x4f79c6[_0x1da4('0x34')]);_0x51d21c['filters']=_[_0x1da4('0x37')](_0x51d21c[_0x1da4('0x33')],_0x51d21c[_0x1da4('0x34')]);_0xb7d641['attributes']=_['intersection'](_0x51d21c['model'],qs[_0x1da4('0x39')](_0x4f79c6['query'][_0x1da4('0x39')]));_0xb7d641[_0x1da4('0x38')]=_0xb7d641[_0x1da4('0x38')]['length']?_0xb7d641[_0x1da4('0x38')]:_0x51d21c[_0x1da4('0x33')];_0xb7d641[_0x1da4('0x3d')]=qs[_0x1da4('0x3e')](_0x4f79c6[_0x1da4('0x34')]['sort']);_0xb7d641[_0x1da4('0x3f')]=qs['filters'](_[_0x1da4('0x50')](_0x4f79c6[_0x1da4('0x34')],_0x51d21c[_0x1da4('0x36')]));if(_0x4f79c6['query']['filter']){_0xb7d641[_0x1da4('0x3f')]=_[_0x1da4('0x41')](_0xb7d641['where'],{'$or':_[_0x1da4('0x2e')](_0xb7d641[_0x1da4('0x38')],function(_0x392690){var _0x174775={};_0x174775[_0x392690]={'$like':'%'+_0x4f79c6['query'][_0x1da4('0x40')]+'%'};return _0x174775;})});}_0xb7d641=_[_0x1da4('0x41')]({},_0xb7d641,_0x4f79c6[_0x1da4('0x47')]);return _0x39e5e7[_0x1da4('0x51')](_0xb7d641);}})['then'](function(_0x4ee487){if(_0x4ee487){_0x4e4898=_0x4ee487[_0x1da4('0x3a')];if(!_0x4f79c6[_0x1da4('0x34')][_0x1da4('0x3b')](_0x1da4('0x3c'))){_0xb7d641[_0x1da4('0x21')]=qs['limit'](_0x4f79c6[_0x1da4('0x34')][_0x1da4('0x21')]);_0xb7d641[_0x1da4('0x1f')]=qs[_0x1da4('0x1f')](_0x4f79c6['query'][_0x1da4('0x1f')]);}return _0x39e5e7[_0x1da4('0x51')](_0xb7d641);}})[_0x1da4('0x26')](function(_0x211a28){if(_0x211a28){return _0x211a28?{'count':_0x4e4898,'rows':_0x211a28}:null;}})[_0x1da4('0x26')](respondWithResult(_0x46d494,null))[_0x1da4('0x45')](handleError(_0x46d494,null));};exports['getFields']=function(_0x2a7302,_0x3822b3,_0x3447e7){var _0x6585fc={};var _0x19e2a4={};var _0x204e0e;var _0x443a01;return db['FreshsalesConfiguration'][_0x1da4('0x4e')]({'where':{'id':_0x2a7302[_0x1da4('0x4c')]['id']}})[_0x1da4('0x26')](handleEntityNotFound(_0x3822b3,null))[_0x1da4('0x26')](function(_0x30b5c5){if(_0x30b5c5){_0x204e0e=_0x30b5c5;_0x19e2a4[_0x1da4('0x33')]=_[_0x1da4('0x35')](db[_0x1da4('0x4f')]['rawAttributes']);_0x19e2a4[_0x1da4('0x34')]=_[_0x1da4('0x35')](_0x2a7302[_0x1da4('0x34')]);_0x19e2a4[_0x1da4('0x36')]=_[_0x1da4('0x37')](_0x19e2a4[_0x1da4('0x33')],_0x19e2a4[_0x1da4('0x34')]);_0x6585fc['attributes']=_[_0x1da4('0x37')](_0x19e2a4['model'],qs[_0x1da4('0x39')](_0x2a7302[_0x1da4('0x34')][_0x1da4('0x39')]));_0x6585fc[_0x1da4('0x38')]=_0x6585fc['attributes']['length']?_0x6585fc[_0x1da4('0x38')]:_0x19e2a4[_0x1da4('0x33')];_0x6585fc['order']=qs[_0x1da4('0x3e')](_0x2a7302[_0x1da4('0x34')][_0x1da4('0x3e')]);_0x6585fc['where']=qs[_0x1da4('0x36')](_[_0x1da4('0x50')](_0x2a7302[_0x1da4('0x34')],_0x19e2a4[_0x1da4('0x36')]));if(_0x2a7302[_0x1da4('0x34')][_0x1da4('0x40')]){_0x6585fc[_0x1da4('0x3f')]=_['merge'](_0x6585fc['where'],{'$or':_[_0x1da4('0x2e')](_0x6585fc[_0x1da4('0x38')],function(_0x214fb2){var _0x3dd983={};_0x3dd983[_0x214fb2]={'$like':'%'+_0x2a7302['query']['filter']+'%'};return _0x3dd983;})});}_0x6585fc=_[_0x1da4('0x41')]({},_0x6585fc,_0x2a7302[_0x1da4('0x47')]);return _0x204e0e['getFields'](_0x6585fc);}})['then'](function(_0x18d466){if(_0x18d466){_0x443a01=_0x18d466['length'];if(!_0x2a7302[_0x1da4('0x34')][_0x1da4('0x3b')](_0x1da4('0x3c'))){_0x6585fc[_0x1da4('0x21')]=qs[_0x1da4('0x21')](_0x2a7302['query'][_0x1da4('0x21')]);_0x6585fc[_0x1da4('0x1f')]=qs[_0x1da4('0x1f')](_0x2a7302[_0x1da4('0x34')][_0x1da4('0x1f')]);}return _0x204e0e['getFields'](_0x6585fc);}})[_0x1da4('0x26')](function(_0x2e9285){if(_0x2e9285){return _0x2e9285?{'count':_0x443a01,'rows':_0x2e9285}:null;}})['then'](respondWithResult(_0x3822b3,null))[_0x1da4('0x45')](handleError(_0x3822b3,null));}; \ No newline at end of file +var _0xec90=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','catch','create','body','find','getSubjects','FreshsalesField','getDescriptions','pick','getFields','findOne','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xec90,0x1d4));var _0x0ec9=function(_0x38be46,_0x524fe1){_0x38be46=_0x38be46-0x0;var _0x192474=_0xec90[_0x38be46];return _0x192474;};'use strict';var emlformat=require(_0x0ec9('0x0'));var rimraf=require(_0x0ec9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ec9('0x2'));var rp=require('request-promise');var moment=require(_0x0ec9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0ec9('0x4'));var path=require(_0x0ec9('0x5'));var sox=require(_0x0ec9('0x6'));var csv=require(_0x0ec9('0x7'));var ejs=require(_0x0ec9('0x8'));var fs=require('fs');var fs_extra=require(_0x0ec9('0x9'));var _=require(_0x0ec9('0xa'));var squel=require(_0x0ec9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0ec9('0xc'));var toCsv=require(_0x0ec9('0x7'));var querystring=require('querystring');var Papa=require(_0x0ec9('0xd'));var Redis=require(_0x0ec9('0xe'));var authService=require(_0x0ec9('0xf'));var qs=require(_0x0ec9('0x10'));var as=require(_0x0ec9('0x11'));var hardwareService=require(_0x0ec9('0x12'));var logger=require(_0x0ec9('0x13'))(_0x0ec9('0x14'));var utils=require(_0x0ec9('0x15'));var config=require(_0x0ec9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ec9('0x17'))['db'];function respondWithStatusCode(_0x3f4873,_0x5d921b){_0x5d921b=_0x5d921b||0xcc;return function(_0x11ae7d){if(_0x11ae7d){return _0x3f4873['sendStatus'](_0x5d921b);}return _0x3f4873[_0x0ec9('0x18')](_0x5d921b)[_0x0ec9('0x19')]();};}function respondWithResult(_0x114169,_0x46b248){_0x46b248=_0x46b248||0xc8;return function(_0xf9923c){if(_0xf9923c){return _0x114169['status'](_0x46b248)['json'](_0xf9923c);}};}function respondWithFilteredResult(_0x4ae2ac,_0x54246e){return function(_0x541dd8){if(_0x541dd8){var _0x4a0f7f=typeof _0x54246e[_0x0ec9('0x1a')]===_0x0ec9('0x1b')&&typeof _0x54246e[_0x0ec9('0x1c')]===_0x0ec9('0x1b');var _0x6aec6e=_0x541dd8[_0x0ec9('0x1d')];var _0x395621=_0x4a0f7f?0x0:_0x54246e['offset'];var _0xcd9613=_0x4a0f7f?_0x541dd8[_0x0ec9('0x1d')]:_0x54246e[_0x0ec9('0x1a')]+_0x54246e['limit'];var _0x5b404e;if(_0xcd9613>=_0x6aec6e){_0xcd9613=_0x6aec6e;_0x5b404e=0xc8;}else{_0x5b404e=0xce;}_0x4ae2ac[_0x0ec9('0x18')](_0x5b404e);return _0x4ae2ac[_0x0ec9('0x1e')](_0x0ec9('0x1f'),_0x395621+'-'+_0xcd9613+'/'+_0x6aec6e)[_0x0ec9('0x20')](_0x541dd8);}return null;};}function patchUpdates(_0x32d4a6){return function(_0x53e0ad){try{jsonpatch['apply'](_0x53e0ad,_0x32d4a6,!![]);}catch(_0x217eb2){return BPromise[_0x0ec9('0x21')](_0x217eb2);}return _0x53e0ad[_0x0ec9('0x22')]();};}function saveUpdates(_0x410104,_0x330b0b){return function(_0x494650){if(_0x494650){return _0x494650[_0x0ec9('0x23')](_0x410104)[_0x0ec9('0x24')](function(_0x465a0e){return _0x465a0e;});}return null;};}function removeEntity(_0x3102e2,_0x3cd40d){return function(_0x4536b3){if(_0x4536b3){return _0x4536b3[_0x0ec9('0x25')]()[_0x0ec9('0x24')](function(){_0x3102e2['status'](0xcc)[_0x0ec9('0x19')]();});}};}function handleEntityNotFound(_0x17a6b0,_0x19270a){return function(_0x54705b){if(!_0x54705b){_0x17a6b0['sendStatus'](0x194);}return _0x54705b;};}function handleError(_0x4239b3,_0x158012){_0x158012=_0x158012||0x1f4;return function(_0x2869f0){logger[_0x0ec9('0x26')](_0x2869f0[_0x0ec9('0x27')]);if(_0x2869f0[_0x0ec9('0x28')]){delete _0x2869f0[_0x0ec9('0x28')];}_0x4239b3[_0x0ec9('0x18')](_0x158012)[_0x0ec9('0x29')](_0x2869f0);};}exports[_0x0ec9('0x2a')]=function(_0x4b3795,_0x30b179){var _0x3001e9={},_0x25b90a={},_0x5aa29f={'count':0x0,'rows':[]};var _0x266641=_[_0x0ec9('0x2b')](db[_0x0ec9('0x2c')][_0x0ec9('0x2d')],function(_0x282ea4){return{'name':_0x282ea4['fieldName'],'type':_0x282ea4[_0x0ec9('0x2e')][_0x0ec9('0x2f')]};});_0x25b90a[_0x0ec9('0x30')]=_['map'](_0x266641,_0x0ec9('0x28'));_0x25b90a[_0x0ec9('0x31')]=_[_0x0ec9('0x32')](_0x4b3795[_0x0ec9('0x31')]);_0x25b90a[_0x0ec9('0x33')]=_['intersection'](_0x25b90a['model'],_0x25b90a[_0x0ec9('0x31')]);_0x3001e9['attributes']=_[_0x0ec9('0x34')](_0x25b90a[_0x0ec9('0x30')],qs[_0x0ec9('0x35')](_0x4b3795['query'][_0x0ec9('0x35')]));_0x3001e9[_0x0ec9('0x36')]=_0x3001e9[_0x0ec9('0x36')][_0x0ec9('0x37')]?_0x3001e9['attributes']:_0x25b90a[_0x0ec9('0x30')];if(!_0x4b3795[_0x0ec9('0x31')][_0x0ec9('0x38')](_0x0ec9('0x39'))){_0x3001e9[_0x0ec9('0x1c')]=qs['limit'](_0x4b3795[_0x0ec9('0x31')][_0x0ec9('0x1c')]);_0x3001e9[_0x0ec9('0x1a')]=qs['offset'](_0x4b3795[_0x0ec9('0x31')][_0x0ec9('0x1a')]);}_0x3001e9[_0x0ec9('0x3a')]=qs[_0x0ec9('0x3b')](_0x4b3795[_0x0ec9('0x31')][_0x0ec9('0x3b')]);_0x3001e9[_0x0ec9('0x3c')]=qs[_0x0ec9('0x33')](_['pick'](_0x4b3795[_0x0ec9('0x31')],_0x25b90a[_0x0ec9('0x33')]),_0x266641);if(_0x4b3795['query'][_0x0ec9('0x3d')]){_0x3001e9['where']=_['merge'](_0x3001e9[_0x0ec9('0x3c')],{'$or':_['map'](_0x266641,function(_0x3330bd){if(_0x3330bd[_0x0ec9('0x2e')]!==_0x0ec9('0x3e')){var _0x31cfd4={};_0x31cfd4[_0x3330bd[_0x0ec9('0x28')]]={'$like':'%'+_0x4b3795['query'][_0x0ec9('0x3d')]+'%'};return _0x31cfd4;}})});}_0x3001e9=_[_0x0ec9('0x3f')]({},_0x3001e9,_0x4b3795[_0x0ec9('0x40')]);var _0x4d565c={'where':_0x3001e9[_0x0ec9('0x3c')]};return db[_0x0ec9('0x2c')][_0x0ec9('0x1d')](_0x4d565c)[_0x0ec9('0x24')](function(_0x5653ff){_0x5aa29f[_0x0ec9('0x1d')]=_0x5653ff;if(_0x4b3795[_0x0ec9('0x31')][_0x0ec9('0x41')]){_0x3001e9[_0x0ec9('0x42')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x3001e9);})[_0x0ec9('0x24')](function(_0x573a87){_0x5aa29f[_0x0ec9('0x43')]=_0x573a87;return _0x5aa29f;})['then'](respondWithFilteredResult(_0x30b179,_0x3001e9))['catch'](handleError(_0x30b179,null));};exports[_0x0ec9('0x44')]=function(_0x187730,_0x2a7121){var _0x45d725={'raw':![],'where':{'id':_0x187730[_0x0ec9('0x45')]['id']}},_0x518002={};_0x518002[_0x0ec9('0x30')]=_[_0x0ec9('0x32')](db[_0x0ec9('0x2c')][_0x0ec9('0x2d')]);_0x518002[_0x0ec9('0x31')]=_['keys'](_0x187730[_0x0ec9('0x31')]);_0x518002['filters']=_[_0x0ec9('0x34')](_0x518002['model'],_0x518002['query']);_0x45d725[_0x0ec9('0x36')]=_['intersection'](_0x518002[_0x0ec9('0x30')],qs[_0x0ec9('0x35')](_0x187730[_0x0ec9('0x31')]['fields']));_0x45d725[_0x0ec9('0x36')]=_0x45d725[_0x0ec9('0x36')][_0x0ec9('0x37')]?_0x45d725['attributes']:_0x518002[_0x0ec9('0x30')];if(_0x187730[_0x0ec9('0x31')]['includeAll']){_0x45d725[_0x0ec9('0x42')]=[{'all':!![]}];}_0x45d725=_[_0x0ec9('0x3f')]({},_0x45d725,_0x187730[_0x0ec9('0x40')]);return db[_0x0ec9('0x2c')]['find'](_0x45d725)['then'](handleEntityNotFound(_0x2a7121,null))[_0x0ec9('0x24')](respondWithResult(_0x2a7121,null))[_0x0ec9('0x46')](handleError(_0x2a7121,null));};exports[_0x0ec9('0x47')]=function(_0x36f78e,_0x1ecce8){return db[_0x0ec9('0x2c')]['create'](_0x36f78e[_0x0ec9('0x48')],{})[_0x0ec9('0x24')](respondWithResult(_0x1ecce8,0xc9))[_0x0ec9('0x46')](handleError(_0x1ecce8,null));};exports[_0x0ec9('0x23')]=function(_0x37f171,_0x472efe){if(_0x37f171['body']['id']){delete _0x37f171['body']['id'];}return db['FreshsalesConfiguration'][_0x0ec9('0x49')]({'where':{'id':_0x37f171[_0x0ec9('0x45')]['id']}})['then'](handleEntityNotFound(_0x472efe,null))['then'](saveUpdates(_0x37f171['body'],null))[_0x0ec9('0x24')](respondWithResult(_0x472efe,null))[_0x0ec9('0x46')](handleError(_0x472efe,null));};exports[_0x0ec9('0x25')]=function(_0x4b8667,_0x20fe9a){return db[_0x0ec9('0x2c')][_0x0ec9('0x49')]({'where':{'id':_0x4b8667[_0x0ec9('0x45')]['id']}})['then'](handleEntityNotFound(_0x20fe9a,null))['then'](removeEntity(_0x20fe9a,null))[_0x0ec9('0x46')](handleError(_0x20fe9a,null));};exports[_0x0ec9('0x4a')]=function(_0x29166f,_0x4f2e20,_0xac8b8e){var _0xbad4fa={};var _0x182153={};var _0x50dbf3;var _0x318ce5;return db[_0x0ec9('0x2c')]['findOne']({'where':{'id':_0x29166f['params']['id']}})[_0x0ec9('0x24')](handleEntityNotFound(_0x4f2e20,null))['then'](function(_0x3c34bb){if(_0x3c34bb){_0x50dbf3=_0x3c34bb;_0x182153[_0x0ec9('0x30')]=_[_0x0ec9('0x32')](db[_0x0ec9('0x4b')][_0x0ec9('0x2d')]);_0x182153['query']=_[_0x0ec9('0x32')](_0x29166f[_0x0ec9('0x31')]);_0x182153[_0x0ec9('0x33')]=_[_0x0ec9('0x34')](_0x182153['model'],_0x182153[_0x0ec9('0x31')]);_0xbad4fa[_0x0ec9('0x36')]=_[_0x0ec9('0x34')](_0x182153[_0x0ec9('0x30')],qs[_0x0ec9('0x35')](_0x29166f[_0x0ec9('0x31')][_0x0ec9('0x35')]));_0xbad4fa[_0x0ec9('0x36')]=_0xbad4fa[_0x0ec9('0x36')]['length']?_0xbad4fa[_0x0ec9('0x36')]:_0x182153['model'];_0xbad4fa[_0x0ec9('0x3a')]=qs[_0x0ec9('0x3b')](_0x29166f['query'][_0x0ec9('0x3b')]);_0xbad4fa[_0x0ec9('0x3c')]=qs[_0x0ec9('0x33')](_['pick'](_0x29166f[_0x0ec9('0x31')],_0x182153[_0x0ec9('0x33')]));if(_0x29166f[_0x0ec9('0x31')][_0x0ec9('0x3d')]){_0xbad4fa['where']=_[_0x0ec9('0x3f')](_0xbad4fa[_0x0ec9('0x3c')],{'$or':_[_0x0ec9('0x2b')](_0xbad4fa[_0x0ec9('0x36')],function(_0x59a667){var _0x2db33a={};_0x2db33a[_0x59a667]={'$like':'%'+_0x29166f[_0x0ec9('0x31')][_0x0ec9('0x3d')]+'%'};return _0x2db33a;})});}_0xbad4fa=_[_0x0ec9('0x3f')]({},_0xbad4fa,_0x29166f['options']);return _0x50dbf3[_0x0ec9('0x4a')](_0xbad4fa);}})[_0x0ec9('0x24')](function(_0x110643){if(_0x110643){_0x318ce5=_0x110643[_0x0ec9('0x37')];if(!_0x29166f['query'][_0x0ec9('0x38')](_0x0ec9('0x39'))){_0xbad4fa[_0x0ec9('0x1c')]=qs['limit'](_0x29166f['query']['limit']);_0xbad4fa[_0x0ec9('0x1a')]=qs[_0x0ec9('0x1a')](_0x29166f['query'][_0x0ec9('0x1a')]);}return _0x50dbf3['getSubjects'](_0xbad4fa);}})['then'](function(_0x4e588e){if(_0x4e588e){return _0x4e588e?{'count':_0x318ce5,'rows':_0x4e588e}:null;}})[_0x0ec9('0x24')](respondWithResult(_0x4f2e20,null))['catch'](handleError(_0x4f2e20,null));};exports[_0x0ec9('0x4c')]=function(_0xf4486d,_0x512a06,_0x3310f7){var _0x508abd={};var _0x3349a9={};var _0x3538c3;var _0x3f0618;return db[_0x0ec9('0x2c')]['findOne']({'where':{'id':_0xf4486d['params']['id']}})[_0x0ec9('0x24')](handleEntityNotFound(_0x512a06,null))['then'](function(_0x1ba47a){if(_0x1ba47a){_0x3538c3=_0x1ba47a;_0x3349a9['model']=_[_0x0ec9('0x32')](db[_0x0ec9('0x4b')][_0x0ec9('0x2d')]);_0x3349a9[_0x0ec9('0x31')]=_['keys'](_0xf4486d[_0x0ec9('0x31')]);_0x3349a9[_0x0ec9('0x33')]=_[_0x0ec9('0x34')](_0x3349a9['model'],_0x3349a9[_0x0ec9('0x31')]);_0x508abd[_0x0ec9('0x36')]=_[_0x0ec9('0x34')](_0x3349a9[_0x0ec9('0x30')],qs[_0x0ec9('0x35')](_0xf4486d['query'][_0x0ec9('0x35')]));_0x508abd['attributes']=_0x508abd[_0x0ec9('0x36')]['length']?_0x508abd[_0x0ec9('0x36')]:_0x3349a9[_0x0ec9('0x30')];_0x508abd[_0x0ec9('0x3a')]=qs[_0x0ec9('0x3b')](_0xf4486d[_0x0ec9('0x31')][_0x0ec9('0x3b')]);_0x508abd['where']=qs[_0x0ec9('0x33')](_[_0x0ec9('0x4d')](_0xf4486d[_0x0ec9('0x31')],_0x3349a9[_0x0ec9('0x33')]));if(_0xf4486d[_0x0ec9('0x31')][_0x0ec9('0x3d')]){_0x508abd[_0x0ec9('0x3c')]=_[_0x0ec9('0x3f')](_0x508abd['where'],{'$or':_['map'](_0x508abd[_0x0ec9('0x36')],function(_0x42f291){var _0xd3ead2={};_0xd3ead2[_0x42f291]={'$like':'%'+_0xf4486d[_0x0ec9('0x31')]['filter']+'%'};return _0xd3ead2;})});}_0x508abd=_[_0x0ec9('0x3f')]({},_0x508abd,_0xf4486d[_0x0ec9('0x40')]);return _0x3538c3[_0x0ec9('0x4c')](_0x508abd);}})[_0x0ec9('0x24')](function(_0x1e53fa){if(_0x1e53fa){_0x3f0618=_0x1e53fa[_0x0ec9('0x37')];if(!_0xf4486d[_0x0ec9('0x31')][_0x0ec9('0x38')](_0x0ec9('0x39'))){_0x508abd[_0x0ec9('0x1c')]=qs[_0x0ec9('0x1c')](_0xf4486d[_0x0ec9('0x31')][_0x0ec9('0x1c')]);_0x508abd['offset']=qs[_0x0ec9('0x1a')](_0xf4486d[_0x0ec9('0x31')]['offset']);}return _0x3538c3[_0x0ec9('0x4c')](_0x508abd);}})[_0x0ec9('0x24')](function(_0xf2093c){if(_0xf2093c){return _0xf2093c?{'count':_0x3f0618,'rows':_0xf2093c}:null;}})[_0x0ec9('0x24')](respondWithResult(_0x512a06,null))[_0x0ec9('0x46')](handleError(_0x512a06,null));};exports[_0x0ec9('0x4e')]=function(_0x358433,_0x5efaea,_0x12fedf){var _0x1e67b9={};var _0x5de64e={};var _0x269e03;var _0x26c0b7;return db[_0x0ec9('0x2c')][_0x0ec9('0x4f')]({'where':{'id':_0x358433[_0x0ec9('0x45')]['id']}})[_0x0ec9('0x24')](handleEntityNotFound(_0x5efaea,null))[_0x0ec9('0x24')](function(_0xdafe8e){if(_0xdafe8e){_0x269e03=_0xdafe8e;_0x5de64e[_0x0ec9('0x30')]=_[_0x0ec9('0x32')](db[_0x0ec9('0x4b')][_0x0ec9('0x2d')]);_0x5de64e['query']=_[_0x0ec9('0x32')](_0x358433[_0x0ec9('0x31')]);_0x5de64e[_0x0ec9('0x33')]=_[_0x0ec9('0x34')](_0x5de64e['model'],_0x5de64e['query']);_0x1e67b9[_0x0ec9('0x36')]=_[_0x0ec9('0x34')](_0x5de64e['model'],qs['fields'](_0x358433[_0x0ec9('0x31')][_0x0ec9('0x35')]));_0x1e67b9[_0x0ec9('0x36')]=_0x1e67b9['attributes']['length']?_0x1e67b9[_0x0ec9('0x36')]:_0x5de64e[_0x0ec9('0x30')];_0x1e67b9[_0x0ec9('0x3a')]=qs[_0x0ec9('0x3b')](_0x358433[_0x0ec9('0x31')][_0x0ec9('0x3b')]);_0x1e67b9['where']=qs[_0x0ec9('0x33')](_['pick'](_0x358433['query'],_0x5de64e[_0x0ec9('0x33')]));if(_0x358433[_0x0ec9('0x31')]['filter']){_0x1e67b9[_0x0ec9('0x3c')]=_[_0x0ec9('0x3f')](_0x1e67b9['where'],{'$or':_[_0x0ec9('0x2b')](_0x1e67b9[_0x0ec9('0x36')],function(_0x4df257){var _0x27afa8={};_0x27afa8[_0x4df257]={'$like':'%'+_0x358433['query'][_0x0ec9('0x3d')]+'%'};return _0x27afa8;})});}_0x1e67b9=_[_0x0ec9('0x3f')]({},_0x1e67b9,_0x358433['options']);return _0x269e03[_0x0ec9('0x4e')](_0x1e67b9);}})[_0x0ec9('0x24')](function(_0x2b0c20){if(_0x2b0c20){_0x26c0b7=_0x2b0c20[_0x0ec9('0x37')];if(!_0x358433[_0x0ec9('0x31')][_0x0ec9('0x38')](_0x0ec9('0x39'))){_0x1e67b9[_0x0ec9('0x1c')]=qs[_0x0ec9('0x1c')](_0x358433['query']['limit']);_0x1e67b9['offset']=qs[_0x0ec9('0x1a')](_0x358433[_0x0ec9('0x31')][_0x0ec9('0x1a')]);}return _0x269e03[_0x0ec9('0x4e')](_0x1e67b9);}})['then'](function(_0xb4a7bb){if(_0xb4a7bb){return _0xb4a7bb?{'count':_0x26c0b7,'rows':_0xb4a7bb}:null;}})[_0x0ec9('0x24')](respondWithResult(_0x5efaea,null))['catch'](handleError(_0x5efaea,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9f17c1b..2f0e8f4 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 _0x943e=['request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x158aef,_0x1286d8){var _0x5951b5=function(_0x38ec01){while(--_0x38ec01){_0x158aef['push'](_0x158aef['shift']());}};_0x5951b5(++_0x1286d8);}(_0x943e,0x1e9));var _0xe943=function(_0x171e46,_0xc36ce0){_0x171e46=_0x171e46-0x0;var _0x18fe9d=_0x943e[_0x171e46];return _0x18fe9d;};'use strict';var _=require(_0xe943('0x0'));var util=require(_0xe943('0x1'));var logger=require(_0xe943('0x2'))(_0xe943('0x3'));var moment=require(_0xe943('0x4'));var BPromise=require(_0xe943('0x5'));var rp=require(_0xe943('0x6'));var fs=require('fs');var path=require(_0xe943('0x7'));var rimraf=require(_0xe943('0x8'));var config=require(_0xe943('0x9'));var attributes=require(_0xe943('0xa'));module[_0xe943('0xb')]=function(_0x44d435,_0x2eb4b7){return _0x44d435[_0xe943('0xc')](_0xe943('0xd'),attributes,{'tableName':_0xe943('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x673d=['util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x2df91c,_0xf6b383){var _0xef633f=function(_0x4149d0){while(--_0x4149d0){_0x2df91c['push'](_0x2df91c['shift']());}};_0xef633f(++_0xf6b383);}(_0x673d,0x12c));var _0xd673=function(_0x1bf89a,_0x2a2949){_0x1bf89a=_0x1bf89a-0x0;var _0x198910=_0x673d[_0x1bf89a];return _0x198910;};'use strict';var _=require('lodash');var util=require(_0xd673('0x0'));var logger=require(_0xd673('0x1'))(_0xd673('0x2'));var moment=require(_0xd673('0x3'));var BPromise=require(_0xd673('0x4'));var rp=require(_0xd673('0x5'));var fs=require('fs');var path=require(_0xd673('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd673('0x7'));module[_0xd673('0x8')]=function(_0x1e69dd,_0x3c9974){return _0x1e69dd[_0xd673('0x9')](_0xd673('0xa'),attributes,{'tableName':_0xd673('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 94675aa..6d521c9 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 _0x828a=['error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x58e4a4,_0xfc0742){var _0x580654=function(_0x1238be){while(--_0x1238be){_0x58e4a4['push'](_0x58e4a4['shift']());}};_0x580654(++_0xfc0742);}(_0x828a,0x1be));var _0xa828=function(_0x54f8dd,_0x426c3c){_0x54f8dd=_0x54f8dd-0x0;var _0xfb25c6=_0x828a[_0x54f8dd];return _0xfb25c6;};'use strict';var _=require(_0xa828('0x0'));var util=require(_0xa828('0x1'));var moment=require(_0xa828('0x2'));var BPromise=require('bluebird');var rs=require(_0xa828('0x3'));var fs=require('fs');var Redis=require(_0xa828('0x4'));var db=require(_0xa828('0x5'))['db'];var utils=require(_0xa828('0x6'));var logger=require(_0xa828('0x7'))(_0xa828('0x8'));var config=require('../../config/environment');var jayson=require(_0xa828('0x9'));var client=jayson['client'][_0xa828('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eef9c,_0x3aa670,_0x42f26c){return new BPromise(function(_0x546e18,_0x3f48eb){return client['request'](_0x4eef9c,_0x42f26c)[_0xa828('0xb')](function(_0x173fbb){logger['info'](_0xa828('0xc'),_0x3aa670,_0xa828('0xd'));logger[_0xa828('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3aa670,_0xa828('0xd'),JSON[_0xa828('0xf')](_0x173fbb));if(_0x173fbb[_0xa828('0x10')]){if(_0x173fbb[_0xa828('0x10')][_0xa828('0x11')]===0x1f4){logger[_0xa828('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3aa670,_0x173fbb[_0xa828('0x10')][_0xa828('0x12')]);return _0x3f48eb(_0x173fbb['error'][_0xa828('0x12')]);}logger[_0xa828('0x10')](_0xa828('0xc'),_0x3aa670,_0x173fbb[_0xa828('0x10')][_0xa828('0x12')]);return _0x546e18(_0x173fbb['error'][_0xa828('0x12')]);}else{logger[_0xa828('0x13')](_0xa828('0xc'),_0x3aa670,'request\x20sent');_0x546e18(_0x173fbb['result']['message']);}})[_0xa828('0x14')](function(_0x3d7506){logger[_0xa828('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3aa670,_0x3d7506);_0x3f48eb(_0x3d7506);});});} \ No newline at end of file +var _0x5223=['FreshsalesConfiguration,\x20%s,\x20%s','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x448f82,_0x4fb566){var _0x51bd20=function(_0x19d3a6){while(--_0x19d3a6){_0x448f82['push'](_0x448f82['shift']());}};_0x51bd20(++_0x4fb566);}(_0x5223,0x11f));var _0x3522=function(_0x253f19,_0x23f267){_0x253f19=_0x253f19-0x0;var _0x486b95=_0x5223[_0x253f19];return _0x486b95;};'use strict';var _=require('lodash');var util=require(_0x3522('0x0'));var moment=require(_0x3522('0x1'));var BPromise=require(_0x3522('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3522('0x3'));var db=require(_0x3522('0x4'))['db'];var utils=require(_0x3522('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3522('0x6'));var jayson=require(_0x3522('0x7'));var client=jayson[_0x3522('0x8')][_0x3522('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52e55f,_0x5e5ec1,_0x385d37){return new BPromise(function(_0x45cce3,_0x410733){return client[_0x3522('0xa')](_0x52e55f,_0x385d37)['then'](function(_0x269c41){logger[_0x3522('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5e5ec1,_0x3522('0xc'));logger['debug'](_0x3522('0xd'),_0x5e5ec1,_0x3522('0xc'),JSON[_0x3522('0xe')](_0x269c41));if(_0x269c41[_0x3522('0xf')]){if(_0x269c41['error'][_0x3522('0x10')]===0x1f4){logger[_0x3522('0xf')](_0x3522('0x11'),_0x5e5ec1,_0x269c41[_0x3522('0xf')][_0x3522('0x12')]);return _0x410733(_0x269c41[_0x3522('0xf')][_0x3522('0x12')]);}logger[_0x3522('0xf')](_0x3522('0x11'),_0x5e5ec1,_0x269c41[_0x3522('0xf')][_0x3522('0x12')]);return _0x45cce3(_0x269c41['error']['message']);}else{logger[_0x3522('0xb')](_0x3522('0x11'),_0x5e5ec1,_0x3522('0xc'));_0x45cce3(_0x269c41['result'][_0x3522('0x12')]);}})['catch'](function(_0x1d2bf1){logger[_0x3522('0xf')](_0x3522('0x11'),_0x5e5ec1,_0x1d2bf1);_0x410733(_0x1d2bf1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 95ccd19..160d1f7 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 _0x6308=['put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post'];(function(_0x31c246,_0x18aa37){var _0x37c12d=function(_0x419f16){while(--_0x419f16){_0x31c246['push'](_0x31c246['shift']());}};_0x37c12d(++_0x18aa37);}(_0x6308,0x1f2));var _0x8630=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x6308[_0x4a7631];return _0x1a5a6f;};'use strict';var multer=require(_0x8630('0x0'));var util=require('util');var path=require(_0x8630('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8630('0x2')]();var fs_extra=require(_0x8630('0x3'));var auth=require(_0x8630('0x4'));var interaction=require(_0x8630('0x5'));var config=require(_0x8630('0x6'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x8630('0x7')](),controller['index']);router[_0x8630('0x8')](_0x8630('0x9'),auth[_0x8630('0x7')](),controller[_0x8630('0xa')]);router[_0x8630('0xb')]('/',auth[_0x8630('0x7')](),controller['create']);router[_0x8630('0xc')]('/:id',auth[_0x8630('0x7')](),controller[_0x8630('0xd')]);router[_0x8630('0xe')]('/:id',auth[_0x8630('0x7')](),controller[_0x8630('0xf')]);module[_0x8630('0x10')]=router; \ No newline at end of file +var _0xb31a=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x3d391b,_0x139db6){var _0x34adb6=function(_0x464b1e){while(--_0x464b1e){_0x3d391b['push'](_0x3d391b['shift']());}};_0x34adb6(++_0x139db6);}(_0xb31a,0xd4));var _0xab31=function(_0x4ad896,_0x5cd4b9){_0x4ad896=_0x4ad896-0x0;var _0x53e943=_0xb31a[_0x4ad896];return _0x53e943;};'use strict';var multer=require(_0xab31('0x0'));var util=require(_0xab31('0x1'));var path=require(_0xab31('0x2'));var timeout=require(_0xab31('0x3'));var express=require(_0xab31('0x4'));var router=express[_0xab31('0x5')]();var fs_extra=require(_0xab31('0x6'));var auth=require(_0xab31('0x7'));var interaction=require(_0xab31('0x8'));var config=require(_0xab31('0x9'));var controller=require(_0xab31('0xa'));router[_0xab31('0xb')]('/',auth[_0xab31('0xc')](),controller[_0xab31('0xd')]);router[_0xab31('0xb')]('/:id',auth[_0xab31('0xc')](),controller[_0xab31('0xe')]);router[_0xab31('0xf')]('/',auth[_0xab31('0xc')](),controller[_0xab31('0x10')]);router[_0xab31('0x11')](_0xab31('0x12'),auth[_0xab31('0xc')](),controller[_0xab31('0x13')]);router['delete']('/:id',auth[_0xab31('0xc')](),controller[_0xab31('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index a894c4b..e7385b1 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 _0x2711=['customVariable','picklist','string','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x27b059,_0x275671){var _0x982b2a=function(_0x1e7d71){while(--_0x1e7d71){_0x27b059['push'](_0x27b059['shift']());}};_0x982b2a(++_0x275671);}(_0x2711,0x1ad));var _0x1271=function(_0x4a3456,_0x1afb7e){_0x4a3456=_0x4a3456-0x0;var _0x4f43d9=_0x2711[_0x4a3456];return _0x4f43d9;};'use strict';var Sequelize=require(_0x1271('0x0'));module[_0x1271('0x1')]={'type':{'type':Sequelize[_0x1271('0x2')]('string','variable',_0x1271('0x3'),'keyValue',_0x1271('0x4')),'defaultValue':_0x1271('0x5')},'content':{'type':Sequelize[_0x1271('0x6')]},'key':{'type':Sequelize[_0x1271('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x1271('0x5'),_0x1271('0x7'),_0x1271('0x3'))},'keyContent':{'type':Sequelize[_0x1271('0x6')]},'idField':{'type':Sequelize[_0x1271('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1271('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb8b3=['BOOLEAN','sequelize','string','customVariable','keyValue','picklist','STRING','ENUM','variable'];(function(_0x3da312,_0x391ccd){var _0x28fb08=function(_0x1792bf){while(--_0x1792bf){_0x3da312['push'](_0x3da312['shift']());}};_0x28fb08(++_0x391ccd);}(_0xb8b3,0x1e7));var _0x3b8b=function(_0x3ab928,_0x2b990b){_0x3ab928=_0x3ab928-0x0;var _0xf47692=_0xb8b3[_0x3ab928];return _0xf47692;};'use strict';var Sequelize=require(_0x3b8b('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x3b8b('0x1'),'variable',_0x3b8b('0x2'),_0x3b8b('0x3'),_0x3b8b('0x4')),'defaultValue':_0x3b8b('0x1')},'content':{'type':Sequelize[_0x3b8b('0x5')]},'key':{'type':Sequelize[_0x3b8b('0x5')]},'keyType':{'type':Sequelize[_0x3b8b('0x6')](_0x3b8b('0x1'),_0x3b8b('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x3b8b('0x5')]},'idField':{'type':Sequelize[_0x3b8b('0x5')]},'nameField':{'type':Sequelize[_0x3b8b('0x5')]},'customField':{'type':Sequelize[_0x3b8b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3b8b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index c67fcdf..0cfa18d 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 _0xcfce=['filter','merge','VIRTUAL','FreshsalesField','includeAll','include','catch','show','params','rawAttributes','options','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick'];(function(_0xb5eeda,_0x1a12ce){var _0x191d16=function(_0x2b2327){while(--_0x2b2327){_0xb5eeda['push'](_0xb5eeda['shift']());}};_0x191d16(++_0x1a12ce);}(_0xcfce,0x1c4));var _0xecfc=function(_0x22b95b,_0x2c695e){_0x22b95b=_0x22b95b-0x0;var _0x32728b=_0xcfce[_0x22b95b];return _0x32728b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xecfc('0x0'));var zipdir=require(_0xecfc('0x1'));var jsonpatch=require(_0xecfc('0x2'));var rp=require(_0xecfc('0x3'));var moment=require(_0xecfc('0x4'));var BPromise=require(_0xecfc('0x5'));var Mustache=require(_0xecfc('0x6'));var util=require(_0xecfc('0x7'));var path=require('path');var sox=require(_0xecfc('0x8'));var csv=require(_0xecfc('0x9'));var ejs=require(_0xecfc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xecfc('0xb'));var crypto=require(_0xecfc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xecfc('0xd'));var toCsv=require(_0xecfc('0x9'));var querystring=require(_0xecfc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xecfc('0xf'));var as=require(_0xecfc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xecfc('0x11'))(_0xecfc('0x12'));var utils=require(_0xecfc('0x13'));var config=require(_0xecfc('0x14'));var licenseUtil=require(_0xecfc('0x15'));var db=require(_0xecfc('0x16'))['db'];function respondWithStatusCode(_0x21e0bf,_0x1f0d38){_0x1f0d38=_0x1f0d38||0xcc;return function(_0xf53947){if(_0xf53947){return _0x21e0bf[_0xecfc('0x17')](_0x1f0d38);}return _0x21e0bf['status'](_0x1f0d38)['end']();};}function respondWithResult(_0x21165a,_0x10de79){_0x10de79=_0x10de79||0xc8;return function(_0xf20b7e){if(_0xf20b7e){return _0x21165a[_0xecfc('0x18')](_0x10de79)[_0xecfc('0x19')](_0xf20b7e);}};}function respondWithFilteredResult(_0x43fba,_0x31ed7f){return function(_0x401928){if(_0x401928){var _0x49fff4=typeof _0x31ed7f[_0xecfc('0x1a')]===_0xecfc('0x1b')&&typeof _0x31ed7f[_0xecfc('0x1c')]===_0xecfc('0x1b');var _0x1b367a=_0x401928[_0xecfc('0x1d')];var _0x593468=_0x49fff4?0x0:_0x31ed7f['offset'];var _0x457b52=_0x49fff4?_0x401928[_0xecfc('0x1d')]:_0x31ed7f[_0xecfc('0x1a')]+_0x31ed7f[_0xecfc('0x1c')];var _0x4fd5c7;if(_0x457b52>=_0x1b367a){_0x457b52=_0x1b367a;_0x4fd5c7=0xc8;}else{_0x4fd5c7=0xce;}_0x43fba[_0xecfc('0x18')](_0x4fd5c7);return _0x43fba[_0xecfc('0x1e')](_0xecfc('0x1f'),_0x593468+'-'+_0x457b52+'/'+_0x1b367a)[_0xecfc('0x19')](_0x401928);}return null;};}function patchUpdates(_0x196577){return function(_0x526c38){try{jsonpatch[_0xecfc('0x20')](_0x526c38,_0x196577,!![]);}catch(_0x4bc4f6){return BPromise[_0xecfc('0x21')](_0x4bc4f6);}return _0x526c38[_0xecfc('0x22')]();};}function saveUpdates(_0x123f8a,_0x5e2d4e){return function(_0xe12034){if(_0xe12034){return _0xe12034[_0xecfc('0x23')](_0x123f8a)[_0xecfc('0x24')](function(_0xb4d868){return _0xb4d868;});}return null;};}function removeEntity(_0x163123,_0x223b82){return function(_0x42b1e7){if(_0x42b1e7){return _0x42b1e7[_0xecfc('0x25')]()[_0xecfc('0x24')](function(){_0x163123[_0xecfc('0x18')](0xcc)[_0xecfc('0x26')]();});}};}function handleEntityNotFound(_0x4ba0f1,_0x2191fc){return function(_0x29909b){if(!_0x29909b){_0x4ba0f1[_0xecfc('0x17')](0x194);}return _0x29909b;};}function handleError(_0x307541,_0x30c4ad){_0x30c4ad=_0x30c4ad||0x1f4;return function(_0x23119c){logger['error'](_0x23119c[_0xecfc('0x27')]);if(_0x23119c[_0xecfc('0x28')]){delete _0x23119c[_0xecfc('0x28')];}_0x307541[_0xecfc('0x18')](_0x30c4ad)[_0xecfc('0x29')](_0x23119c);};}exports[_0xecfc('0x2a')]=function(_0x45b28a,_0x38ed92){var _0x3e1253={},_0x517a0f={},_0x456557={'count':0x0,'rows':[]};var _0x164c36=_[_0xecfc('0x2b')](db['FreshsalesField']['rawAttributes'],function(_0x5b8112){return{'name':_0x5b8112[_0xecfc('0x2c')],'type':_0x5b8112[_0xecfc('0x2d')][_0xecfc('0x2e')]};});_0x517a0f['model']=_[_0xecfc('0x2b')](_0x164c36,_0xecfc('0x28'));_0x517a0f[_0xecfc('0x2f')]=_[_0xecfc('0x30')](_0x45b28a[_0xecfc('0x2f')]);_0x517a0f[_0xecfc('0x31')]=_[_0xecfc('0x32')](_0x517a0f[_0xecfc('0x33')],_0x517a0f[_0xecfc('0x2f')]);_0x3e1253[_0xecfc('0x34')]=_[_0xecfc('0x32')](_0x517a0f['model'],qs['fields'](_0x45b28a[_0xecfc('0x2f')][_0xecfc('0x35')]));_0x3e1253[_0xecfc('0x34')]=_0x3e1253[_0xecfc('0x34')][_0xecfc('0x36')]?_0x3e1253[_0xecfc('0x34')]:_0x517a0f[_0xecfc('0x33')];if(!_0x45b28a[_0xecfc('0x2f')]['hasOwnProperty']('nolimit')){_0x3e1253[_0xecfc('0x1c')]=qs[_0xecfc('0x1c')](_0x45b28a['query'][_0xecfc('0x1c')]);_0x3e1253[_0xecfc('0x1a')]=qs['offset'](_0x45b28a[_0xecfc('0x2f')][_0xecfc('0x1a')]);}_0x3e1253[_0xecfc('0x37')]=qs[_0xecfc('0x38')](_0x45b28a[_0xecfc('0x2f')][_0xecfc('0x38')]);_0x3e1253[_0xecfc('0x39')]=qs[_0xecfc('0x31')](_[_0xecfc('0x3a')](_0x45b28a[_0xecfc('0x2f')],_0x517a0f[_0xecfc('0x31')]),_0x164c36);if(_0x45b28a[_0xecfc('0x2f')][_0xecfc('0x3b')]){_0x3e1253['where']=_[_0xecfc('0x3c')](_0x3e1253[_0xecfc('0x39')],{'$or':_[_0xecfc('0x2b')](_0x164c36,function(_0x214bc3){if(_0x214bc3[_0xecfc('0x2d')]!==_0xecfc('0x3d')){var _0x24ab2a={};_0x24ab2a[_0x214bc3[_0xecfc('0x28')]]={'$like':'%'+_0x45b28a['query'][_0xecfc('0x3b')]+'%'};return _0x24ab2a;}})});}_0x3e1253=_[_0xecfc('0x3c')]({},_0x3e1253,_0x45b28a['options']);var _0x3e7daa={'where':_0x3e1253[_0xecfc('0x39')]};return db[_0xecfc('0x3e')][_0xecfc('0x1d')](_0x3e7daa)[_0xecfc('0x24')](function(_0x5f4554){_0x456557[_0xecfc('0x1d')]=_0x5f4554;if(_0x45b28a[_0xecfc('0x2f')][_0xecfc('0x3f')]){_0x3e1253[_0xecfc('0x40')]=[{'all':!![]}];}return db[_0xecfc('0x3e')]['findAll'](_0x3e1253);})[_0xecfc('0x24')](function(_0x1578b2){_0x456557['rows']=_0x1578b2;return _0x456557;})[_0xecfc('0x24')](respondWithFilteredResult(_0x38ed92,_0x3e1253))[_0xecfc('0x41')](handleError(_0x38ed92,null));};exports[_0xecfc('0x42')]=function(_0x260f1e,_0x38d62e){var _0xcb5d04={'raw':!![],'where':{'id':_0x260f1e[_0xecfc('0x43')]['id']}},_0x232957={};_0x232957[_0xecfc('0x33')]=_['keys'](db[_0xecfc('0x3e')][_0xecfc('0x44')]);_0x232957[_0xecfc('0x2f')]=_['keys'](_0x260f1e[_0xecfc('0x2f')]);_0x232957['filters']=_[_0xecfc('0x32')](_0x232957['model'],_0x232957[_0xecfc('0x2f')]);_0xcb5d04[_0xecfc('0x34')]=_[_0xecfc('0x32')](_0x232957[_0xecfc('0x33')],qs[_0xecfc('0x35')](_0x260f1e['query'][_0xecfc('0x35')]));_0xcb5d04['attributes']=_0xcb5d04[_0xecfc('0x34')][_0xecfc('0x36')]?_0xcb5d04[_0xecfc('0x34')]:_0x232957[_0xecfc('0x33')];if(_0x260f1e[_0xecfc('0x2f')][_0xecfc('0x3f')]){_0xcb5d04[_0xecfc('0x40')]=[{'all':!![]}];}_0xcb5d04=_[_0xecfc('0x3c')]({},_0xcb5d04,_0x260f1e[_0xecfc('0x45')]);return db[_0xecfc('0x3e')]['find'](_0xcb5d04)['then'](handleEntityNotFound(_0x38d62e,null))[_0xecfc('0x24')](respondWithResult(_0x38d62e,null))[_0xecfc('0x41')](handleError(_0x38d62e,null));};exports[_0xecfc('0x46')]=function(_0x5ebe4d,_0x71cb18){return db[_0xecfc('0x3e')][_0xecfc('0x46')](_0x5ebe4d[_0xecfc('0x47')],{})[_0xecfc('0x24')](respondWithResult(_0x71cb18,0xc9))[_0xecfc('0x41')](handleError(_0x71cb18,null));};exports[_0xecfc('0x23')]=function(_0x384067,_0x1b3fb7){if(_0x384067[_0xecfc('0x47')]['id']){delete _0x384067['body']['id'];}return db['FreshsalesField'][_0xecfc('0x48')]({'where':{'id':_0x384067[_0xecfc('0x43')]['id']}})[_0xecfc('0x24')](handleEntityNotFound(_0x1b3fb7,null))[_0xecfc('0x24')](saveUpdates(_0x384067['body'],null))[_0xecfc('0x24')](respondWithResult(_0x1b3fb7,null))[_0xecfc('0x41')](handleError(_0x1b3fb7,null));};exports[_0xecfc('0x25')]=function(_0x25e1b9,_0x41e344){return db[_0xecfc('0x3e')]['find']({'where':{'id':_0x25e1b9['params']['id']}})[_0xecfc('0x24')](handleEntityNotFound(_0x41e344,null))[_0xecfc('0x24')](removeEntity(_0x41e344,null))[_0xecfc('0x41')](handleError(_0x41e344,null));}; \ No newline at end of file +var _0x72d2=['order','where','type','VIRTUAL','filter','merge','options','FreshsalesField','includeAll','include','findAll','catch','show','params','create','body','find','destroy','eml-format','moment','mustache','path','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','name','index','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x560fdb,_0xe678c1){var _0x18ef38=function(_0x1c7361){while(--_0x1c7361){_0x560fdb['push'](_0x560fdb['shift']());}};_0x18ef38(++_0xe678c1);}(_0x72d2,0xcf));var _0x272d=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x72d2[_0x126fb9];return _0xc8a3b1;};'use strict';var emlformat=require(_0x272d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x272d('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x272d('0x2'));var util=require('util');var path=require(_0x272d('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x272d('0x4'));var _=require(_0x272d('0x5'));var squel=require(_0x272d('0x6'));var crypto=require(_0x272d('0x7'));var jsforce=require(_0x272d('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x272d('0x9'));var Redis=require('ioredis');var authService=require(_0x272d('0xa'));var qs=require(_0x272d('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x272d('0xc'))('api');var utils=require(_0x272d('0xd'));var config=require(_0x272d('0xe'));var licenseUtil=require(_0x272d('0xf'));var db=require(_0x272d('0x10'))['db'];function respondWithStatusCode(_0x18921b,_0x1f1a82){_0x1f1a82=_0x1f1a82||0xcc;return function(_0x1e7e1d){if(_0x1e7e1d){return _0x18921b[_0x272d('0x11')](_0x1f1a82);}return _0x18921b[_0x272d('0x12')](_0x1f1a82)[_0x272d('0x13')]();};}function respondWithResult(_0x2334ce,_0x57e6ef){_0x57e6ef=_0x57e6ef||0xc8;return function(_0x333b59){if(_0x333b59){return _0x2334ce[_0x272d('0x12')](_0x57e6ef)[_0x272d('0x14')](_0x333b59);}};}function respondWithFilteredResult(_0x3cc5e8,_0x223f46){return function(_0x35aa31){if(_0x35aa31){var _0x2be872=typeof _0x223f46[_0x272d('0x15')]===_0x272d('0x16')&&typeof _0x223f46[_0x272d('0x17')]===_0x272d('0x16');var _0x24a29c=_0x35aa31[_0x272d('0x18')];var _0x10660b=_0x2be872?0x0:_0x223f46[_0x272d('0x15')];var _0x23c15=_0x2be872?_0x35aa31[_0x272d('0x18')]:_0x223f46[_0x272d('0x15')]+_0x223f46[_0x272d('0x17')];var _0x3370eb;if(_0x23c15>=_0x24a29c){_0x23c15=_0x24a29c;_0x3370eb=0xc8;}else{_0x3370eb=0xce;}_0x3cc5e8[_0x272d('0x12')](_0x3370eb);return _0x3cc5e8[_0x272d('0x19')]('Content-Range',_0x10660b+'-'+_0x23c15+'/'+_0x24a29c)[_0x272d('0x14')](_0x35aa31);}return null;};}function patchUpdates(_0x2ff92d){return function(_0x2d3e78){try{jsonpatch[_0x272d('0x1a')](_0x2d3e78,_0x2ff92d,!![]);}catch(_0x4fe644){return BPromise[_0x272d('0x1b')](_0x4fe644);}return _0x2d3e78[_0x272d('0x1c')]();};}function saveUpdates(_0x23dc71,_0x7688e8){return function(_0x355cc0){if(_0x355cc0){return _0x355cc0[_0x272d('0x1d')](_0x23dc71)[_0x272d('0x1e')](function(_0x4dcec9){return _0x4dcec9;});}return null;};}function removeEntity(_0x23f039,_0x1bb43d){return function(_0x1ff675){if(_0x1ff675){return _0x1ff675['destroy']()[_0x272d('0x1e')](function(){_0x23f039[_0x272d('0x12')](0xcc)[_0x272d('0x13')]();});}};}function handleEntityNotFound(_0x3eca14,_0x313c42){return function(_0x2bca3c){if(!_0x2bca3c){_0x3eca14[_0x272d('0x11')](0x194);}return _0x2bca3c;};}function handleError(_0x432314,_0x4d8267){_0x4d8267=_0x4d8267||0x1f4;return function(_0x47d9c4){logger[_0x272d('0x1f')](_0x47d9c4['stack']);if(_0x47d9c4[_0x272d('0x20')]){delete _0x47d9c4[_0x272d('0x20')];}_0x432314['status'](_0x4d8267)['send'](_0x47d9c4);};}exports[_0x272d('0x21')]=function(_0x39636b,_0x9b494d){var _0x6ec6fe={},_0x166c7c={},_0x52eac9={'count':0x0,'rows':[]};var _0x5b1b3f=_['map'](db['FreshsalesField']['rawAttributes'],function(_0x5dc8bf){return{'name':_0x5dc8bf['fieldName'],'type':_0x5dc8bf['type']['key']};});_0x166c7c[_0x272d('0x22')]=_[_0x272d('0x23')](_0x5b1b3f,'name');_0x166c7c[_0x272d('0x24')]=_[_0x272d('0x25')](_0x39636b[_0x272d('0x24')]);_0x166c7c[_0x272d('0x26')]=_[_0x272d('0x27')](_0x166c7c[_0x272d('0x22')],_0x166c7c[_0x272d('0x24')]);_0x6ec6fe[_0x272d('0x28')]=_['intersection'](_0x166c7c['model'],qs[_0x272d('0x29')](_0x39636b[_0x272d('0x24')][_0x272d('0x29')]));_0x6ec6fe[_0x272d('0x28')]=_0x6ec6fe[_0x272d('0x28')][_0x272d('0x2a')]?_0x6ec6fe[_0x272d('0x28')]:_0x166c7c[_0x272d('0x22')];if(!_0x39636b[_0x272d('0x24')][_0x272d('0x2b')](_0x272d('0x2c'))){_0x6ec6fe[_0x272d('0x17')]=qs['limit'](_0x39636b['query'][_0x272d('0x17')]);_0x6ec6fe[_0x272d('0x15')]=qs[_0x272d('0x15')](_0x39636b[_0x272d('0x24')][_0x272d('0x15')]);}_0x6ec6fe[_0x272d('0x2d')]=qs['sort'](_0x39636b[_0x272d('0x24')]['sort']);_0x6ec6fe[_0x272d('0x2e')]=qs[_0x272d('0x26')](_['pick'](_0x39636b[_0x272d('0x24')],_0x166c7c[_0x272d('0x26')]),_0x5b1b3f);if(_0x39636b['query']['filter']){_0x6ec6fe[_0x272d('0x2e')]=_['merge'](_0x6ec6fe['where'],{'$or':_['map'](_0x5b1b3f,function(_0x3957f6){if(_0x3957f6[_0x272d('0x2f')]!==_0x272d('0x30')){var _0x3edb08={};_0x3edb08[_0x3957f6['name']]={'$like':'%'+_0x39636b['query'][_0x272d('0x31')]+'%'};return _0x3edb08;}})});}_0x6ec6fe=_[_0x272d('0x32')]({},_0x6ec6fe,_0x39636b[_0x272d('0x33')]);var _0x4e0a2c={'where':_0x6ec6fe[_0x272d('0x2e')]};return db[_0x272d('0x34')][_0x272d('0x18')](_0x4e0a2c)['then'](function(_0x1ef890){_0x52eac9['count']=_0x1ef890;if(_0x39636b[_0x272d('0x24')][_0x272d('0x35')]){_0x6ec6fe[_0x272d('0x36')]=[{'all':!![]}];}return db['FreshsalesField'][_0x272d('0x37')](_0x6ec6fe);})['then'](function(_0x525e76){_0x52eac9['rows']=_0x525e76;return _0x52eac9;})[_0x272d('0x1e')](respondWithFilteredResult(_0x9b494d,_0x6ec6fe))[_0x272d('0x38')](handleError(_0x9b494d,null));};exports[_0x272d('0x39')]=function(_0x39d7d5,_0x5ed508){var _0x5af5d8={'raw':!![],'where':{'id':_0x39d7d5[_0x272d('0x3a')]['id']}},_0x3dbaf7={};_0x3dbaf7['model']=_[_0x272d('0x25')](db[_0x272d('0x34')]['rawAttributes']);_0x3dbaf7['query']=_[_0x272d('0x25')](_0x39d7d5[_0x272d('0x24')]);_0x3dbaf7[_0x272d('0x26')]=_[_0x272d('0x27')](_0x3dbaf7[_0x272d('0x22')],_0x3dbaf7[_0x272d('0x24')]);_0x5af5d8[_0x272d('0x28')]=_['intersection'](_0x3dbaf7['model'],qs[_0x272d('0x29')](_0x39d7d5[_0x272d('0x24')][_0x272d('0x29')]));_0x5af5d8[_0x272d('0x28')]=_0x5af5d8[_0x272d('0x28')][_0x272d('0x2a')]?_0x5af5d8[_0x272d('0x28')]:_0x3dbaf7[_0x272d('0x22')];if(_0x39d7d5[_0x272d('0x24')]['includeAll']){_0x5af5d8[_0x272d('0x36')]=[{'all':!![]}];}_0x5af5d8=_['merge']({},_0x5af5d8,_0x39d7d5[_0x272d('0x33')]);return db[_0x272d('0x34')]['find'](_0x5af5d8)[_0x272d('0x1e')](handleEntityNotFound(_0x5ed508,null))['then'](respondWithResult(_0x5ed508,null))[_0x272d('0x38')](handleError(_0x5ed508,null));};exports[_0x272d('0x3b')]=function(_0x4ea7ea,_0x4b7314){return db['FreshsalesField'][_0x272d('0x3b')](_0x4ea7ea['body'],{})['then'](respondWithResult(_0x4b7314,0xc9))['catch'](handleError(_0x4b7314,null));};exports['update']=function(_0x26eb3d,_0x24d061){if(_0x26eb3d[_0x272d('0x3c')]['id']){delete _0x26eb3d[_0x272d('0x3c')]['id'];}return db[_0x272d('0x34')][_0x272d('0x3d')]({'where':{'id':_0x26eb3d[_0x272d('0x3a')]['id']}})[_0x272d('0x1e')](handleEntityNotFound(_0x24d061,null))['then'](saveUpdates(_0x26eb3d[_0x272d('0x3c')],null))[_0x272d('0x1e')](respondWithResult(_0x24d061,null))[_0x272d('0x38')](handleError(_0x24d061,null));};exports[_0x272d('0x3e')]=function(_0x53fe14,_0x26ee85){return db[_0x272d('0x34')][_0x272d('0x3d')]({'where':{'id':_0x53fe14[_0x272d('0x3a')]['id']}})['then'](handleEntityNotFound(_0x26ee85,null))[_0x272d('0x1e')](removeEntity(_0x26ee85,null))[_0x272d('0x38')](handleError(_0x26ee85,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 067581c..963c5aa 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 _0xac35=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','freshsales_unique_index','idField'];(function(_0x3c17d5,_0x122680){var _0x303871=function(_0x5a5b77){while(--_0x5a5b77){_0x3c17d5['push'](_0x3c17d5['shift']());}};_0x303871(++_0x122680);}(_0xac35,0x141));var _0x5ac3=function(_0x50ac81,_0x12fdd3){_0x50ac81=_0x50ac81-0x0;var _0x3cccdd=_0xac35[_0x50ac81];return _0x3cccdd;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var logger=require(_0x5ac3('0x2'))(_0x5ac3('0x3'));var moment=require(_0x5ac3('0x4'));var BPromise=require(_0x5ac3('0x5'));var rp=require(_0x5ac3('0x6'));var fs=require('fs');var path=require(_0x5ac3('0x7'));var rimraf=require(_0x5ac3('0x8'));var config=require(_0x5ac3('0x9'));var attributes=require(_0x5ac3('0xa'));module[_0x5ac3('0xb')]=function(_0x33a8f2,_0x13d4fb){return _0x33a8f2['define'](_0x5ac3('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x5ac3('0xd'),'fields':[_0x5ac3('0xe'),_0x5ac3('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ba3=['path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0xdcfa3,_0x426d85){var _0x64a7f1=function(_0x2dd0f6){while(--_0x2dd0f6){_0xdcfa3['push'](_0xdcfa3['shift']());}};_0x64a7f1(++_0x426d85);}(_0x5ba3,0x140));var _0x35ba=function(_0x5c943b,_0x8cdcd1){_0x5c943b=_0x5c943b-0x0;var _0x284cdc=_0x5ba3[_0x5c943b];return _0x284cdc;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var logger=require(_0x35ba('0x1'))(_0x35ba('0x2'));var moment=require('moment');var BPromise=require(_0x35ba('0x3'));var rp=require(_0x35ba('0x4'));var fs=require('fs');var path=require(_0x35ba('0x5'));var rimraf=require('rimraf');var config=require(_0x35ba('0x6'));var attributes=require(_0x35ba('0x7'));module[_0x35ba('0x8')]=function(_0x596785,_0x54c722){return _0x596785[_0x35ba('0x9')](_0x35ba('0xa'),attributes,{'tableName':_0x35ba('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x35ba('0xc'),'FieldId'],'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 2284eb8..d1766ac 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(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0x687b,0x14a));var _0xb687=function(_0x3fb166,_0x4eb985){_0x3fb166=_0x3fb166-0x0;var _0x5e91be=_0x687b[_0x3fb166];return _0x5e91be;};'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 _0x90b1=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x50dd2b,_0x20a9ce){var _0x14ec89=function(_0x4abea0){while(--_0x4abea0){_0x50dd2b['push'](_0x50dd2b['shift']());}};_0x14ec89(++_0x20a9ce);}(_0x90b1,0x1bb));var _0x190b=function(_0x293e7a,_0x1792a2){_0x293e7a=_0x293e7a-0x0;var _0xb78342=_0x90b1[_0x293e7a];return _0xb78342;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index cda582a..48ac55c 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x44e69d,_0x458cbf){var _0x3fe73c=function(_0x4cbfab){while(--_0x4cbfab){_0x44e69d['push'](_0x44e69d['shift']());}};_0x3fe73c(++_0x458cbf);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x17b70f,_0x3aa576){var _0x2ac1bb=function(_0x99b256){while(--_0x99b256){_0x17b70f['push'](_0x17b70f['shift']());}};_0x2ac1bb(++_0x3aa576);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index b70cf9d..55540ff 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 _0x63a6=['exports','STRING','username','newTab','integrationTab'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63a6,0x1c7));var _0x663a=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x63a6[_0x186376];return _0x2dbdd9;};'use strict';var Sequelize=require('sequelize');module[_0x663a('0x0')]={'name':{'type':Sequelize[_0x663a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x663a('0x1')],'unique':_0x663a('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x663a('0x1')]},'clientId':{'type':Sequelize[_0x663a('0x1')]},'clientSecret':{'type':Sequelize[_0x663a('0x1')]},'securityToken':{'type':Sequelize[_0x663a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x663a('0x3')),'defaultValue':_0x663a('0x4')}}; \ No newline at end of file +var _0x77a9=['STRING','username','ENUM','integrationTab','sequelize'];(function(_0x432e07,_0x21da57){var _0x719ed1=function(_0x2ede75){while(--_0x2ede75){_0x432e07['push'](_0x432e07['shift']());}};_0x719ed1(++_0x21da57);}(_0x77a9,0x19e));var _0x977a=function(_0x281180,_0x4a7cda){_0x281180=_0x281180-0x0;var _0x183311=_0x77a9[_0x281180];return _0x183311;};'use strict';var Sequelize=require(_0x977a('0x0'));module['exports']={'name':{'type':Sequelize[_0x977a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x977a('0x1')],'unique':_0x977a('0x2')},'remoteUri':{'type':Sequelize[_0x977a('0x1')]},'password':{'type':Sequelize[_0x977a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x977a('0x1')]},'securityToken':{'type':Sequelize[_0x977a('0x1')]},'serverUrl':{'type':Sequelize[_0x977a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x977a('0x3')](_0x977a('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 68901e1..3a7e3aa 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 _0xa14c=['body','getConfigurations','SalesforceConfiguration','order','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','substring','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','boolean','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','stack','name','index','map','SalesforceAccount','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','include','rows','show','params','rawAttributes','length','includeAll','options','find','catch','create'];(function(_0x3c72a1,_0x445c80){var _0xe72556=function(_0x52a0c1){while(--_0x52a0c1){_0x3c72a1['push'](_0x3c72a1['shift']());}};_0xe72556(++_0x445c80);}(_0xa14c,0xae));var _0xca14=function(_0x3fc097,_0x22d7a2){_0x3fc097=_0x3fc097-0x0;var _0x13e81a=_0xa14c[_0x3fc097];return _0x13e81a;};'use strict';var emlformat=require(_0xca14('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca14('0x1'));var jsonpatch=require(_0xca14('0x2'));var rp=require(_0xca14('0x3'));var moment=require(_0xca14('0x4'));var BPromise=require(_0xca14('0x5'));var Mustache=require(_0xca14('0x6'));var util=require('util');var path=require(_0xca14('0x7'));var sox=require(_0xca14('0x8'));var csv=require(_0xca14('0x9'));var ejs=require(_0xca14('0xa'));var fs=require('fs');var fs_extra=require(_0xca14('0xb'));var _=require(_0xca14('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xca14('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xca14('0x9'));var querystring=require(_0xca14('0xe'));var Papa=require(_0xca14('0xf'));var Redis=require('ioredis');var authService=require(_0xca14('0x10'));var qs=require(_0xca14('0x11'));var as=require(_0xca14('0x12'));var hardwareService=require(_0xca14('0x13'));var logger=require(_0xca14('0x14'))(_0xca14('0x15'));var utils=require(_0xca14('0x16'));var config=require(_0xca14('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xca14('0x18'))['db'];var integrations=require(_0xca14('0x19'));function respondWithStatusCode(_0x58fc77,_0x1b7b05){_0x1b7b05=_0x1b7b05||0xcc;return function(_0x55b5fc){if(_0x55b5fc){return _0x58fc77[_0xca14('0x1a')](_0x1b7b05);}return _0x58fc77[_0xca14('0x1b')](_0x1b7b05)[_0xca14('0x1c')]();};}function respondWithResult(_0x1e63c7,_0x4e006e){_0x4e006e=_0x4e006e||0xc8;return function(_0x1fdf7f){if(_0x1fdf7f){return _0x1e63c7['status'](_0x4e006e)[_0xca14('0x1d')](_0x1fdf7f);}};}function respondWithFilteredResult(_0x8f1b1f,_0x386e24){return function(_0x205e63){if(_0x205e63){var _0x89d8b3=typeof _0x386e24[_0xca14('0x1e')]===_0xca14('0x1f')&&typeof _0x386e24[_0xca14('0x20')]===_0xca14('0x1f');var _0x3a5411=_0x205e63[_0xca14('0x21')];var _0x73e831=_0x89d8b3?0x0:_0x386e24[_0xca14('0x1e')];var _0x26458b=_0x89d8b3?_0x205e63[_0xca14('0x21')]:_0x386e24[_0xca14('0x1e')]+_0x386e24[_0xca14('0x20')];var _0x27aabe;if(_0x26458b>=_0x3a5411){_0x26458b=_0x3a5411;_0x27aabe=0xc8;}else{_0x27aabe=0xce;}_0x8f1b1f[_0xca14('0x1b')](_0x27aabe);return _0x8f1b1f[_0xca14('0x22')](_0xca14('0x23'),_0x73e831+'-'+_0x26458b+'/'+_0x3a5411)[_0xca14('0x1d')](_0x205e63);}return null;};}function patchUpdates(_0x96dadf){return function(_0x55dcf1){try{jsonpatch['apply'](_0x55dcf1,_0x96dadf,!![]);}catch(_0x292a08){return BPromise['reject'](_0x292a08);}return _0x55dcf1[_0xca14('0x24')]();};}function saveUpdates(_0x16aba9,_0x11886b){return function(_0x2a6893){if(_0x2a6893){return _0x2a6893[_0xca14('0x25')](_0x16aba9)[_0xca14('0x26')](function(_0x5e7e42){return _0x5e7e42;});}return null;};}function removeEntity(_0x3d7520,_0x176943){return function(_0x352ea6){if(_0x352ea6){return _0x352ea6[_0xca14('0x27')]()['then'](function(){_0x3d7520[_0xca14('0x1b')](0xcc)[_0xca14('0x1c')]();});}};}function handleEntityNotFound(_0x2702aa,_0x1e095a){return function(_0x25b612){if(!_0x25b612){_0x2702aa['sendStatus'](0x194);}return _0x25b612;};}function handleError(_0x1651d1,_0x1cfd9a){_0x1cfd9a=_0x1cfd9a||0x1f4;return function(_0x1c5dfa){logger['error'](_0x1c5dfa[_0xca14('0x28')]);if(_0x1c5dfa[_0xca14('0x29')]){delete _0x1c5dfa[_0xca14('0x29')];}_0x1651d1[_0xca14('0x1b')](_0x1cfd9a)['send'](_0x1c5dfa);};}exports[_0xca14('0x2a')]=function(_0x28b3c1,_0x2a075d){var _0x52bf2d={},_0x4e7e4b={},_0x5a919c={'count':0x0,'rows':[]};var _0x397476=_[_0xca14('0x2b')](db[_0xca14('0x2c')]['rawAttributes'],function(_0x163fdb){return{'name':_0x163fdb['fieldName'],'type':_0x163fdb[_0xca14('0x2d')]['key']};});_0x4e7e4b[_0xca14('0x2e')]=_[_0xca14('0x2b')](_0x397476,_0xca14('0x29'));_0x4e7e4b[_0xca14('0x2f')]=_[_0xca14('0x30')](_0x28b3c1['query']);_0x4e7e4b[_0xca14('0x31')]=_[_0xca14('0x32')](_0x4e7e4b[_0xca14('0x2e')],_0x4e7e4b['query']);_0x52bf2d[_0xca14('0x33')]=_[_0xca14('0x32')](_0x4e7e4b[_0xca14('0x2e')],qs[_0xca14('0x34')](_0x28b3c1[_0xca14('0x2f')][_0xca14('0x34')]));_0x52bf2d[_0xca14('0x33')]=_0x52bf2d[_0xca14('0x33')]['length']?_0x52bf2d[_0xca14('0x33')]:_0x4e7e4b[_0xca14('0x2e')];if(!_0x28b3c1['query'][_0xca14('0x35')](_0xca14('0x36'))){_0x52bf2d[_0xca14('0x20')]=qs[_0xca14('0x20')](_0x28b3c1[_0xca14('0x2f')][_0xca14('0x20')]);_0x52bf2d[_0xca14('0x1e')]=qs[_0xca14('0x1e')](_0x28b3c1[_0xca14('0x2f')][_0xca14('0x1e')]);}_0x52bf2d['order']=qs[_0xca14('0x37')](_0x28b3c1['query']['sort']);_0x52bf2d['where']=qs[_0xca14('0x31')](_[_0xca14('0x38')](_0x28b3c1[_0xca14('0x2f')],_0x4e7e4b[_0xca14('0x31')]),_0x397476);if(_0x28b3c1['query'][_0xca14('0x39')]){_0x52bf2d[_0xca14('0x3a')]=_[_0xca14('0x3b')](_0x52bf2d[_0xca14('0x3a')],{'$or':_[_0xca14('0x2b')](_0x397476,function(_0x2ca917){if(_0x2ca917[_0xca14('0x2d')]!==_0xca14('0x3c')){var _0x3a6f5c={};_0x3a6f5c[_0x2ca917[_0xca14('0x29')]]={'$like':'%'+_0x28b3c1['query'][_0xca14('0x39')]+'%'};return _0x3a6f5c;}})});}_0x52bf2d=_[_0xca14('0x3b')]({},_0x52bf2d,_0x28b3c1['options']);var _0x53357d={'where':_0x52bf2d[_0xca14('0x3a')]};return db['SalesforceAccount']['count'](_0x53357d)[_0xca14('0x26')](function(_0x2c0c97){_0x5a919c[_0xca14('0x21')]=_0x2c0c97;if(_0x28b3c1['query']['includeAll']){_0x52bf2d[_0xca14('0x3d')]=[{'all':!![]}];}return db[_0xca14('0x2c')]['findAll'](_0x52bf2d);})[_0xca14('0x26')](function(_0x519a5b){_0x5a919c[_0xca14('0x3e')]=_0x519a5b;return _0x5a919c;})[_0xca14('0x26')](respondWithFilteredResult(_0x2a075d,_0x52bf2d))['catch'](handleError(_0x2a075d,null));};exports[_0xca14('0x3f')]=function(_0x2b5304,_0x3d7605){var _0x46e1b6={'raw':![],'where':{'id':_0x2b5304[_0xca14('0x40')]['id']}},_0x48af29={};_0x48af29[_0xca14('0x2e')]=_[_0xca14('0x30')](db['SalesforceAccount'][_0xca14('0x41')]);_0x48af29['query']=_[_0xca14('0x30')](_0x2b5304[_0xca14('0x2f')]);_0x48af29[_0xca14('0x31')]=_[_0xca14('0x32')](_0x48af29[_0xca14('0x2e')],_0x48af29[_0xca14('0x2f')]);_0x46e1b6[_0xca14('0x33')]=_[_0xca14('0x32')](_0x48af29[_0xca14('0x2e')],qs[_0xca14('0x34')](_0x2b5304[_0xca14('0x2f')][_0xca14('0x34')]));_0x46e1b6[_0xca14('0x33')]=_0x46e1b6[_0xca14('0x33')][_0xca14('0x42')]?_0x46e1b6['attributes']:_0x48af29[_0xca14('0x2e')];if(_0x2b5304['query'][_0xca14('0x43')]){_0x46e1b6[_0xca14('0x3d')]=[{'all':!![]}];}_0x46e1b6=_['merge']({},_0x46e1b6,_0x2b5304[_0xca14('0x44')]);return db[_0xca14('0x2c')][_0xca14('0x45')](_0x46e1b6)[_0xca14('0x26')](handleEntityNotFound(_0x3d7605,null))[_0xca14('0x26')](respondWithResult(_0x3d7605,null))[_0xca14('0x46')](handleError(_0x3d7605,null));};exports['create']=function(_0x1101b8,_0x6a5bb4){return db[_0xca14('0x2c')][_0xca14('0x47')](_0x1101b8[_0xca14('0x48')],{})[_0xca14('0x26')](respondWithResult(_0x6a5bb4,0xc9))[_0xca14('0x46')](handleError(_0x6a5bb4,null));};exports[_0xca14('0x25')]=function(_0x1d1aff,_0x281010){if(_0x1d1aff[_0xca14('0x48')]['id']){delete _0x1d1aff[_0xca14('0x48')]['id'];}return db[_0xca14('0x2c')][_0xca14('0x45')]({'where':{'id':_0x1d1aff[_0xca14('0x40')]['id']}})[_0xca14('0x26')](handleEntityNotFound(_0x281010,null))[_0xca14('0x26')](saveUpdates(_0x1d1aff['body'],null))[_0xca14('0x26')](respondWithResult(_0x281010,null))[_0xca14('0x46')](handleError(_0x281010,null));};exports[_0xca14('0x27')]=function(_0x17d9d7,_0x5db264){return db['SalesforceAccount'][_0xca14('0x45')]({'where':{'id':_0x17d9d7[_0xca14('0x40')]['id']}})[_0xca14('0x26')](handleEntityNotFound(_0x5db264,null))[_0xca14('0x26')](removeEntity(_0x5db264,null))[_0xca14('0x46')](handleError(_0x5db264,null));};exports[_0xca14('0x49')]=function(_0xecda0e,_0x25637c,_0x45cac7){var _0x37cb1a={};var _0x29e7d0={};var _0x5d2de5;var _0x1ebe39;return db['SalesforceAccount']['findOne']({'where':{'id':_0xecda0e[_0xca14('0x40')]['id']}})['then'](handleEntityNotFound(_0x25637c,null))[_0xca14('0x26')](function(_0x52fe23){if(_0x52fe23){_0x5d2de5=_0x52fe23;_0x29e7d0['model']=_[_0xca14('0x30')](db[_0xca14('0x4a')][_0xca14('0x41')]);_0x29e7d0[_0xca14('0x2f')]=_[_0xca14('0x30')](_0xecda0e['query']);_0x29e7d0[_0xca14('0x31')]=_[_0xca14('0x32')](_0x29e7d0['model'],_0x29e7d0['query']);_0x37cb1a[_0xca14('0x33')]=_[_0xca14('0x32')](_0x29e7d0[_0xca14('0x2e')],qs[_0xca14('0x34')](_0xecda0e[_0xca14('0x2f')][_0xca14('0x34')]));_0x37cb1a[_0xca14('0x33')]=_0x37cb1a[_0xca14('0x33')][_0xca14('0x42')]?_0x37cb1a[_0xca14('0x33')]:_0x29e7d0[_0xca14('0x2e')];_0x37cb1a[_0xca14('0x4b')]=qs[_0xca14('0x37')](_0xecda0e['query'][_0xca14('0x37')]);_0x37cb1a[_0xca14('0x3a')]=qs['filters'](_['pick'](_0xecda0e['query'],_0x29e7d0[_0xca14('0x31')]));if(_0xecda0e['query'][_0xca14('0x39')]){_0x37cb1a['where']=_['merge'](_0x37cb1a['where'],{'$or':_['map'](_0x37cb1a[_0xca14('0x33')],function(_0x51a95b){var _0x56b638={};_0x56b638[_0x51a95b]={'$like':'%'+_0xecda0e[_0xca14('0x2f')][_0xca14('0x39')]+'%'};return _0x56b638;})});}_0x37cb1a=_[_0xca14('0x3b')]({},_0x37cb1a,_0xecda0e[_0xca14('0x44')]);return _0x5d2de5[_0xca14('0x49')](_0x37cb1a);}})[_0xca14('0x26')](function(_0x1c0280){if(_0x1c0280){_0x1ebe39=_0x1c0280[_0xca14('0x42')];if(!_0xecda0e[_0xca14('0x2f')][_0xca14('0x35')](_0xca14('0x36'))){_0x37cb1a[_0xca14('0x20')]=qs[_0xca14('0x20')](_0xecda0e[_0xca14('0x2f')][_0xca14('0x20')]);_0x37cb1a[_0xca14('0x1e')]=qs[_0xca14('0x1e')](_0xecda0e[_0xca14('0x2f')][_0xca14('0x1e')]);}return _0x5d2de5[_0xca14('0x49')](_0x37cb1a);}})[_0xca14('0x26')](function(_0x33a685){if(_0x33a685){return _0x33a685?{'count':_0x1ebe39,'rows':_0x33a685}:null;}})[_0xca14('0x26')](respondWithResult(_0x25637c,null))[_0xca14('0x46')](handleError(_0x25637c,null));};exports['addConfiguration']=function(_0xf9f8b4,_0x1c4eea,_0x4b38e7){if(_0xf9f8b4[_0xca14('0x48')]['id']){delete _0xf9f8b4[_0xca14('0x48')]['id'];}return db[_0xca14('0x2c')][_0xca14('0x4c')]({'where':{'id':_0xf9f8b4[_0xca14('0x40')]['id']}})[_0xca14('0x26')](handleEntityNotFound(_0x1c4eea,null))[_0xca14('0x26')](function(_0x190f70){if(_0x190f70){_0xf9f8b4[_0xca14('0x48')][_0xca14('0x4d')]=_0x190f70['id'];_0xf9f8b4[_0xca14('0x48')]['Subjects']=integrations[_0xca14('0x4e')](_0xf9f8b4[_0xca14('0x48')][_0xca14('0x4f')],_0xf9f8b4[_0xca14('0x48')][_0xca14('0x2d')]);_0xf9f8b4['body'][_0xca14('0x50')]=integrations[_0xca14('0x51')](_0xf9f8b4[_0xca14('0x48')][_0xca14('0x4f')],_0xf9f8b4['body'][_0xca14('0x2d')]);return db['SalesforceConfiguration'][_0xca14('0x47')](_0xf9f8b4['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xca14('0x52')],'as':_0xca14('0x50')}]});}return null;})[_0xca14('0x26')](respondWithResult(_0x1c4eea,null))[_0xca14('0x46')](handleError(_0x1c4eea,null));};exports[_0xca14('0x53')]=function(_0x34e892,_0x130396,_0x29d41a){var _0x14890b;var _0x3f448d='';var _0x507592=_0xca14('0x54');return db[_0xca14('0x2c')][_0xca14('0x4c')]({'where':{'id':_0x34e892[_0xca14('0x40')]['id']},'attributes':['id',_0xca14('0x55'),'clientId',_0xca14('0x56'),_0xca14('0x57'),_0xca14('0x58'),_0xca14('0x59')]})[_0xca14('0x26')](handleEntityNotFound(_0x130396,null))[_0xca14('0x26')](function(_0x29dde9){if(_0x29dde9){_0x3f448d=_0x29dde9[_0xca14('0x55')];var _0x3b756c=_0x3f448d['slice'](-0x1);if(_0x3b756c==='/'){_0x3f448d=_0x3f448d[_0xca14('0x5a')](0x0,_0x3f448d['lastIndexOf'](_0x3b756c));}_0x14890b=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3f448d,'clientId':_0x29dde9['clientId'],'clientSecret':_0x29dde9[_0xca14('0x56')]}});return _0x14890b[_0xca14('0x5b')](_0x29dde9[_0xca14('0x57')],_0x29dde9[_0xca14('0x58')][_0xca14('0x5c')](_0x29dde9['securityToken']));}})['then'](function(_0x5b7a4e){if(_0x5b7a4e){if(!_[_0xca14('0x5d')](_0x34e892[_0xca14('0x2f')][_0xca14('0x5e')])){_0x507592=_0x34e892[_0xca14('0x2f')]['ticketType'];}return _0x14890b[_0xca14('0x5f')](_0x507592)[_0xca14('0x60')]();}})[_0xca14('0x26')](function(_0x59157b){var _0x42082e=[_0xca14('0x61'),_0xca14('0x62'),_0xca14('0x63'),'IsRecurrence',_0xca14('0x64'),_0xca14('0x65')];var _0x345700=[_0xca14('0x66'),_0xca14('0x67'),'picklist',_0xca14('0x68'),'email','textarea',_0xca14('0x69')];if(_0x59157b){_[_0xca14('0x6a')](_0x59157b[_0xca14('0x34')],function(_0x115809){return _0x42082e[_0xca14('0x6b')](_0x115809[_0xca14('0x29')])||!_0x345700[_0xca14('0x6b')](_0x115809[_0xca14('0x2d')]);});return{'count':_0x59157b[_0xca14('0x34')][_0xca14('0x42')],'rows':_[_0xca14('0x2b')](_0x59157b[_0xca14('0x34')],function(_0x273085){return{'id':_0x273085[_0xca14('0x29')],'name':_0x273085[_0xca14('0x6c')],'custom':_0x273085[_0xca14('0x6d')],'options':_0x273085['picklistValues'][_0xca14('0x42')]>0x0?_[_0xca14('0x2b')](_0x273085[_0xca14('0x6e')],function(_0xbba19f){return{'name':_0xbba19f['label'],'value':_0xbba19f[_0xca14('0x6f')]};}):_0x273085[_0xca14('0x2d')]==_0xca14('0x68')?[{'name':_0xca14('0x70'),'value':_0xca14('0x71')},{'name':_0xca14('0x72'),'value':_0xca14('0x73')}]:[]};})};}})[_0xca14('0x26')](respondWithResult(_0x130396,null))[_0xca14('0x46')](function(_0x2751b5){var _0x1c59b6=_0x34e892[_0xca14('0x2f')][_0xca14('0x74')]?0x1f4:_0x2751b5[_0xca14('0x75')]||0x1f4;logger[_0xca14('0x76')](_0xca14('0x77'),_0xca14('0x53'),_0x1c59b6,JSON[_0xca14('0x78')](_0x2751b5));delete _0x2751b5[_0xca14('0x29')];if(_0x1c59b6===0x191){_0x1c59b6=0x190;}_0x130396[_0xca14('0x1b')](_0x1c59b6)[_0xca14('0x79')](_0x34e892['query'][_0xca14('0x74')]?{'message':_0xca14('0x7a'),'statusCode':_0x2751b5[_0xca14('0x75')]}:_0x2751b5);});}; \ No newline at end of file +var _0x180d=['bluebird','util','path','sox','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','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','offset','count','set','apply','save','then','destroy','sendStatus','error','name','send','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','params','keys','includeAll','find','catch','create','body','update','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','securityToken','slice','substring','lastIndexOf','login','username','password','isNil','ticketType','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','email','textarea','phone','remove','includes','label','value','boolean','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1efb4a,_0x46acc8){var _0x30c4b9=function(_0x28f547){while(--_0x28f547){_0x1efb4a['push'](_0x1efb4a['shift']());}};_0x30c4b9(++_0x46acc8);}(_0x180d,0x167));var _0xd180=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x180d[_0x243b59];return _0x3e1676;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd180('0x0'));var zipdir=require(_0xd180('0x1'));var jsonpatch=require(_0xd180('0x2'));var rp=require(_0xd180('0x3'));var moment=require('moment');var BPromise=require(_0xd180('0x4'));var Mustache=require('mustache');var util=require(_0xd180('0x5'));var path=require(_0xd180('0x6'));var sox=require(_0xd180('0x7'));var csv=require(_0xd180('0x8'));var ejs=require(_0xd180('0x9'));var fs=require('fs');var fs_extra=require(_0xd180('0xa'));var _=require(_0xd180('0xb'));var squel=require(_0xd180('0xc'));var crypto=require('crypto');var jsforce=require(_0xd180('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd180('0xe'));var Papa=require(_0xd180('0xf'));var Redis=require(_0xd180('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd180('0x11'));var as=require(_0xd180('0x12'));var hardwareService=require(_0xd180('0x13'));var logger=require(_0xd180('0x14'))(_0xd180('0x15'));var utils=require(_0xd180('0x16'));var config=require(_0xd180('0x17'));var licenseUtil=require(_0xd180('0x18'));var db=require(_0xd180('0x19'))['db'];var integrations=require(_0xd180('0x1a'));function respondWithStatusCode(_0x346c59,_0xa93179){_0xa93179=_0xa93179||0xcc;return function(_0x35b7f3){if(_0x35b7f3){return _0x346c59['sendStatus'](_0xa93179);}return _0x346c59['status'](_0xa93179)['end']();};}function respondWithResult(_0x35227f,_0x1fc0ec){_0x1fc0ec=_0x1fc0ec||0xc8;return function(_0xcf7431){if(_0xcf7431){return _0x35227f[_0xd180('0x1b')](_0x1fc0ec)[_0xd180('0x1c')](_0xcf7431);}};}function respondWithFilteredResult(_0x5535dc,_0xaa8900){return function(_0x1e701a){if(_0x1e701a){var _0x45f8b9=typeof _0xaa8900['offset']===_0xd180('0x1d')&&typeof _0xaa8900[_0xd180('0x1e')]==='undefined';var _0x51e3ba=_0x1e701a['count'];var _0x457a26=_0x45f8b9?0x0:_0xaa8900[_0xd180('0x1f')];var _0x349c66=_0x45f8b9?_0x1e701a[_0xd180('0x20')]:_0xaa8900[_0xd180('0x1f')]+_0xaa8900['limit'];var _0xc30ae6;if(_0x349c66>=_0x51e3ba){_0x349c66=_0x51e3ba;_0xc30ae6=0xc8;}else{_0xc30ae6=0xce;}_0x5535dc[_0xd180('0x1b')](_0xc30ae6);return _0x5535dc[_0xd180('0x21')]('Content-Range',_0x457a26+'-'+_0x349c66+'/'+_0x51e3ba)['json'](_0x1e701a);}return null;};}function patchUpdates(_0x55fd3b){return function(_0x67e259){try{jsonpatch[_0xd180('0x22')](_0x67e259,_0x55fd3b,!![]);}catch(_0x4cab8c){return BPromise['reject'](_0x4cab8c);}return _0x67e259[_0xd180('0x23')]();};}function saveUpdates(_0x37831f,_0x1a2aa8){return function(_0x5628c2){if(_0x5628c2){return _0x5628c2['update'](_0x37831f)[_0xd180('0x24')](function(_0x1f4495){return _0x1f4495;});}return null;};}function removeEntity(_0x36dd13,_0x8faa70){return function(_0x48d142){if(_0x48d142){return _0x48d142[_0xd180('0x25')]()[_0xd180('0x24')](function(){_0x36dd13[_0xd180('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59efc1,_0xc99ffd){return function(_0xc2fee8){if(!_0xc2fee8){_0x59efc1[_0xd180('0x26')](0x194);}return _0xc2fee8;};}function handleError(_0x5a24ef,_0x3a2f52){_0x3a2f52=_0x3a2f52||0x1f4;return function(_0x47c538){logger[_0xd180('0x27')](_0x47c538['stack']);if(_0x47c538[_0xd180('0x28')]){delete _0x47c538[_0xd180('0x28')];}_0x5a24ef['status'](_0x3a2f52)[_0xd180('0x29')](_0x47c538);};}exports['index']=function(_0x28754a,_0x598904){var _0x1c5432={},_0x1dd46b={},_0xbc8dc1={'count':0x0,'rows':[]};var _0x1804aa=_['map'](db[_0xd180('0x2a')][_0xd180('0x2b')],function(_0x431721){return{'name':_0x431721[_0xd180('0x2c')],'type':_0x431721[_0xd180('0x2d')][_0xd180('0x2e')]};});_0x1dd46b[_0xd180('0x2f')]=_[_0xd180('0x30')](_0x1804aa,_0xd180('0x28'));_0x1dd46b[_0xd180('0x31')]=_['keys'](_0x28754a[_0xd180('0x31')]);_0x1dd46b[_0xd180('0x32')]=_[_0xd180('0x33')](_0x1dd46b[_0xd180('0x2f')],_0x1dd46b['query']);_0x1c5432[_0xd180('0x34')]=_['intersection'](_0x1dd46b[_0xd180('0x2f')],qs['fields'](_0x28754a[_0xd180('0x31')][_0xd180('0x35')]));_0x1c5432[_0xd180('0x34')]=_0x1c5432[_0xd180('0x34')][_0xd180('0x36')]?_0x1c5432[_0xd180('0x34')]:_0x1dd46b[_0xd180('0x2f')];if(!_0x28754a[_0xd180('0x31')][_0xd180('0x37')](_0xd180('0x38'))){_0x1c5432[_0xd180('0x1e')]=qs[_0xd180('0x1e')](_0x28754a[_0xd180('0x31')][_0xd180('0x1e')]);_0x1c5432[_0xd180('0x1f')]=qs[_0xd180('0x1f')](_0x28754a[_0xd180('0x31')][_0xd180('0x1f')]);}_0x1c5432[_0xd180('0x39')]=qs['sort'](_0x28754a[_0xd180('0x31')][_0xd180('0x3a')]);_0x1c5432[_0xd180('0x3b')]=qs[_0xd180('0x32')](_[_0xd180('0x3c')](_0x28754a['query'],_0x1dd46b[_0xd180('0x32')]),_0x1804aa);if(_0x28754a['query']['filter']){_0x1c5432[_0xd180('0x3b')]=_[_0xd180('0x3d')](_0x1c5432[_0xd180('0x3b')],{'$or':_[_0xd180('0x30')](_0x1804aa,function(_0x4d95a2){if(_0x4d95a2['type']!=='VIRTUAL'){var _0xa144d6={};_0xa144d6[_0x4d95a2['name']]={'$like':'%'+_0x28754a['query'][_0xd180('0x3e')]+'%'};return _0xa144d6;}})});}_0x1c5432=_[_0xd180('0x3d')]({},_0x1c5432,_0x28754a[_0xd180('0x3f')]);var _0x45b78b={'where':_0x1c5432[_0xd180('0x3b')]};return db[_0xd180('0x2a')][_0xd180('0x20')](_0x45b78b)[_0xd180('0x24')](function(_0x29e411){_0xbc8dc1['count']=_0x29e411;if(_0x28754a['query']['includeAll']){_0x1c5432[_0xd180('0x40')]=[{'all':!![]}];}return db[_0xd180('0x2a')]['findAll'](_0x1c5432);})[_0xd180('0x24')](function(_0x1b1078){_0xbc8dc1['rows']=_0x1b1078;return _0xbc8dc1;})['then'](respondWithFilteredResult(_0x598904,_0x1c5432))['catch'](handleError(_0x598904,null));};exports['show']=function(_0x513511,_0x2cb57b){var _0x2e9870={'raw':![],'where':{'id':_0x513511[_0xd180('0x41')]['id']}},_0x357d5b={};_0x357d5b[_0xd180('0x2f')]=_[_0xd180('0x42')](db[_0xd180('0x2a')][_0xd180('0x2b')]);_0x357d5b[_0xd180('0x31')]=_['keys'](_0x513511[_0xd180('0x31')]);_0x357d5b[_0xd180('0x32')]=_[_0xd180('0x33')](_0x357d5b[_0xd180('0x2f')],_0x357d5b[_0xd180('0x31')]);_0x2e9870[_0xd180('0x34')]=_['intersection'](_0x357d5b[_0xd180('0x2f')],qs[_0xd180('0x35')](_0x513511[_0xd180('0x31')][_0xd180('0x35')]));_0x2e9870['attributes']=_0x2e9870[_0xd180('0x34')]['length']?_0x2e9870[_0xd180('0x34')]:_0x357d5b[_0xd180('0x2f')];if(_0x513511['query'][_0xd180('0x43')]){_0x2e9870['include']=[{'all':!![]}];}_0x2e9870=_[_0xd180('0x3d')]({},_0x2e9870,_0x513511[_0xd180('0x3f')]);return db['SalesforceAccount'][_0xd180('0x44')](_0x2e9870)['then'](handleEntityNotFound(_0x2cb57b,null))['then'](respondWithResult(_0x2cb57b,null))[_0xd180('0x45')](handleError(_0x2cb57b,null));};exports['create']=function(_0x587c44,_0x117aba){return db[_0xd180('0x2a')][_0xd180('0x46')](_0x587c44[_0xd180('0x47')],{})['then'](respondWithResult(_0x117aba,0xc9))[_0xd180('0x45')](handleError(_0x117aba,null));};exports[_0xd180('0x48')]=function(_0x14885f,_0x262a6f){if(_0x14885f[_0xd180('0x47')]['id']){delete _0x14885f[_0xd180('0x47')]['id'];}return db[_0xd180('0x2a')][_0xd180('0x44')]({'where':{'id':_0x14885f[_0xd180('0x41')]['id']}})[_0xd180('0x24')](handleEntityNotFound(_0x262a6f,null))['then'](saveUpdates(_0x14885f[_0xd180('0x47')],null))[_0xd180('0x24')](respondWithResult(_0x262a6f,null))[_0xd180('0x45')](handleError(_0x262a6f,null));};exports[_0xd180('0x25')]=function(_0x557ee3,_0x544c55){return db[_0xd180('0x2a')][_0xd180('0x44')]({'where':{'id':_0x557ee3['params']['id']}})[_0xd180('0x24')](handleEntityNotFound(_0x544c55,null))[_0xd180('0x24')](removeEntity(_0x544c55,null))[_0xd180('0x45')](handleError(_0x544c55,null));};exports['getConfigurations']=function(_0x2ab172,_0x466e65,_0x191f00){var _0x2286e2={};var _0x1255c2={};var _0xc2e618;var _0x5556f3;return db[_0xd180('0x2a')]['findOne']({'where':{'id':_0x2ab172[_0xd180('0x41')]['id']}})[_0xd180('0x24')](handleEntityNotFound(_0x466e65,null))[_0xd180('0x24')](function(_0x5424de){if(_0x5424de){_0xc2e618=_0x5424de;_0x1255c2[_0xd180('0x2f')]=_[_0xd180('0x42')](db['SalesforceConfiguration'][_0xd180('0x2b')]);_0x1255c2[_0xd180('0x31')]=_['keys'](_0x2ab172[_0xd180('0x31')]);_0x1255c2[_0xd180('0x32')]=_[_0xd180('0x33')](_0x1255c2[_0xd180('0x2f')],_0x1255c2[_0xd180('0x31')]);_0x2286e2['attributes']=_['intersection'](_0x1255c2[_0xd180('0x2f')],qs[_0xd180('0x35')](_0x2ab172[_0xd180('0x31')]['fields']));_0x2286e2[_0xd180('0x34')]=_0x2286e2[_0xd180('0x34')]['length']?_0x2286e2[_0xd180('0x34')]:_0x1255c2[_0xd180('0x2f')];_0x2286e2[_0xd180('0x39')]=qs[_0xd180('0x3a')](_0x2ab172['query'][_0xd180('0x3a')]);_0x2286e2['where']=qs[_0xd180('0x32')](_['pick'](_0x2ab172[_0xd180('0x31')],_0x1255c2[_0xd180('0x32')]));if(_0x2ab172['query'][_0xd180('0x3e')]){_0x2286e2[_0xd180('0x3b')]=_[_0xd180('0x3d')](_0x2286e2['where'],{'$or':_[_0xd180('0x30')](_0x2286e2[_0xd180('0x34')],function(_0x4a9a5e){var _0x41178f={};_0x41178f[_0x4a9a5e]={'$like':'%'+_0x2ab172[_0xd180('0x31')]['filter']+'%'};return _0x41178f;})});}_0x2286e2=_[_0xd180('0x3d')]({},_0x2286e2,_0x2ab172['options']);return _0xc2e618[_0xd180('0x49')](_0x2286e2);}})[_0xd180('0x24')](function(_0x4573bc){if(_0x4573bc){_0x5556f3=_0x4573bc[_0xd180('0x36')];if(!_0x2ab172['query']['hasOwnProperty'](_0xd180('0x38'))){_0x2286e2[_0xd180('0x1e')]=qs[_0xd180('0x1e')](_0x2ab172[_0xd180('0x31')]['limit']);_0x2286e2['offset']=qs['offset'](_0x2ab172[_0xd180('0x31')][_0xd180('0x1f')]);}return _0xc2e618[_0xd180('0x49')](_0x2286e2);}})[_0xd180('0x24')](function(_0x2c540c){if(_0x2c540c){return _0x2c540c?{'count':_0x5556f3,'rows':_0x2c540c}:null;}})[_0xd180('0x24')](respondWithResult(_0x466e65,null))['catch'](handleError(_0x466e65,null));};exports[_0xd180('0x4a')]=function(_0xe51c4a,_0x1026bb,_0x26817d){if(_0xe51c4a['body']['id']){delete _0xe51c4a[_0xd180('0x47')]['id'];}return db[_0xd180('0x2a')][_0xd180('0x4b')]({'where':{'id':_0xe51c4a[_0xd180('0x41')]['id']}})['then'](handleEntityNotFound(_0x1026bb,null))['then'](function(_0x41038b){if(_0x41038b){_0xe51c4a[_0xd180('0x47')][_0xd180('0x4c')]=_0x41038b['id'];_0xe51c4a[_0xd180('0x47')]['Subjects']=integrations[_0xd180('0x4d')](_0xe51c4a['body'][_0xd180('0x4e')],_0xe51c4a[_0xd180('0x47')][_0xd180('0x2d')]);_0xe51c4a[_0xd180('0x47')][_0xd180('0x4f')]=integrations[_0xd180('0x50')](_0xe51c4a[_0xd180('0x47')][_0xd180('0x4e')],_0xe51c4a[_0xd180('0x47')][_0xd180('0x2d')]);return db[_0xd180('0x51')]['create'](_0xe51c4a[_0xd180('0x47')],{'include':[{'model':db[_0xd180('0x52')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0xd180('0x4f')}]});}return null;})[_0xd180('0x24')](respondWithResult(_0x1026bb,null))[_0xd180('0x45')](handleError(_0x1026bb,null));};exports[_0xd180('0x53')]=function(_0x39414e,_0x387107,_0x39fff3){var _0x1b1a71;var _0x44460f='';var _0x20150f=_0xd180('0x54');return db[_0xd180('0x2a')][_0xd180('0x4b')]({'where':{'id':_0x39414e[_0xd180('0x41')]['id']},'attributes':['id',_0xd180('0x55'),_0xd180('0x56'),_0xd180('0x57'),'username','password',_0xd180('0x58')]})['then'](handleEntityNotFound(_0x387107,null))['then'](function(_0x1c33a8){if(_0x1c33a8){_0x44460f=_0x1c33a8[_0xd180('0x55')];var _0x41d625=_0x44460f[_0xd180('0x59')](-0x1);if(_0x41d625==='/'){_0x44460f=_0x44460f[_0xd180('0x5a')](0x0,_0x44460f[_0xd180('0x5b')](_0x41d625));}_0x1b1a71=new jsforce['Connection']({'oauth2':{'loginUrl':_0x44460f,'clientId':_0x1c33a8[_0xd180('0x56')],'clientSecret':_0x1c33a8[_0xd180('0x57')]}});return _0x1b1a71[_0xd180('0x5c')](_0x1c33a8[_0xd180('0x5d')],_0x1c33a8[_0xd180('0x5e')]['concat'](_0x1c33a8['securityToken']));}})[_0xd180('0x24')](function(_0x390ced){if(_0x390ced){if(!_[_0xd180('0x5f')](_0x39414e['query'][_0xd180('0x60')])){_0x20150f=_0x39414e[_0xd180('0x31')][_0xd180('0x60')];}return _0x1b1a71['sobject'](_0x20150f)['describe']();}})[_0xd180('0x24')](function(_0x3978ac){var _0x2676ce=[_0xd180('0x61'),_0xd180('0x62'),_0xd180('0x63'),_0xd180('0x64'),_0xd180('0x65'),_0xd180('0x66')];var _0x23de5=['string',_0xd180('0x67'),_0xd180('0x68'),'boolean',_0xd180('0x69'),_0xd180('0x6a'),_0xd180('0x6b')];if(_0x3978ac){_[_0xd180('0x6c')](_0x3978ac[_0xd180('0x35')],function(_0x4696c9){return _0x2676ce['includes'](_0x4696c9[_0xd180('0x28')])||!_0x23de5[_0xd180('0x6d')](_0x4696c9[_0xd180('0x2d')]);});return{'count':_0x3978ac['fields'][_0xd180('0x36')],'rows':_[_0xd180('0x30')](_0x3978ac[_0xd180('0x35')],function(_0x53af40){return{'id':_0x53af40['name'],'name':_0x53af40['label'],'custom':_0x53af40['custom'],'options':_0x53af40['picklistValues'][_0xd180('0x36')]>0x0?_[_0xd180('0x30')](_0x53af40['picklistValues'],function(_0x14ddb6){return{'name':_0x14ddb6[_0xd180('0x6e')],'value':_0x14ddb6[_0xd180('0x6f')]};}):_0x53af40['type']==_0xd180('0x70')?[{'name':_0xd180('0x71'),'value':_0xd180('0x72')},{'name':_0xd180('0x73'),'value':'false'}]:[]};})};}})[_0xd180('0x24')](respondWithResult(_0x387107,null))[_0xd180('0x45')](function(_0x357e9a){var _0x4bf62f=_0x39414e[_0xd180('0x31')][_0xd180('0x74')]?0x1f4:_0x357e9a[_0xd180('0x75')]||0x1f4;logger[_0xd180('0x27')](_0xd180('0x76'),'getFields',_0x4bf62f,JSON[_0xd180('0x77')](_0x357e9a));delete _0x357e9a[_0xd180('0x28')];if(_0x4bf62f===0x191){_0x4bf62f=0x190;}_0x387107[_0xd180('0x1b')](_0x4bf62f)[_0xd180('0x29')](_0x39414e[_0xd180('0x31')]['test']?{'message':_0xd180('0x78'),'statusCode':_0x357e9a[_0xd180('0x75')]}:_0x357e9a);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index f0d9996..f50988e 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','util','api','bluebird'];(function(_0x449941,_0x5b7094){var _0x316d93=function(_0x537431){while(--_0x537431){_0x449941['push'](_0x449941['shift']());}};_0x316d93(++_0x5b7094);}(_0x9bde,0xe1));var _0xe9bd=function(_0x551047,_0x583496){_0x551047=_0x551047-0x0;var _0x119ecb=_0x9bde[_0x551047];return _0x119ecb;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));var integrations=require(_0xe9bd('0x8'));module['exports']=function(_0x4763e9,_0x5f18fe){return _0x4763e9[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b78=['rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x546443,_0x1a7e36){var _0x166459=function(_0x5b8963){while(--_0x5b8963){_0x546443['push'](_0x546443['shift']());}};_0x166459(++_0x1a7e36);}(_0x9b78,0xe8));var _0x89b7=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x9b78[_0x31a576];return _0x30b1d3;};'use strict';var _=require(_0x89b7('0x0'));var util=require(_0x89b7('0x1'));var logger=require(_0x89b7('0x2'))(_0x89b7('0x3'));var moment=require(_0x89b7('0x4'));var BPromise=require(_0x89b7('0x5'));var rp=require(_0x89b7('0x6'));var fs=require('fs');var path=require(_0x89b7('0x7'));var rimraf=require(_0x89b7('0x8'));var config=require(_0x89b7('0x9'));var attributes=require(_0x89b7('0xa'));var integrations=require(_0x89b7('0xb'));module[_0x89b7('0xc')]=function(_0x350eae,_0x2b2b72){return _0x350eae[_0x89b7('0xd')](_0x89b7('0xe'),attributes,{'tableName':_0x89b7('0xf'),'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 e92d998..97cc688 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 _0xef0d=['SalesforceAccount','find','where','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount','options','raw','attributes','include','map','model','catch','ShowSalesforceAccount'];(function(_0x182979,_0x3c2030){var _0x249fff=function(_0x782d52){while(--_0x782d52){_0x182979['push'](_0x182979['shift']());}};_0x249fff(++_0x3c2030);}(_0xef0d,0xdc));var _0xdef0=function(_0x555363,_0x4a7cca){_0x555363=_0x555363-0x0;var _0x23c402=_0xef0d[_0x555363];return _0x23c402;};'use strict';var _=require(_0xdef0('0x0'));var util=require('util');var moment=require(_0xdef0('0x1'));var BPromise=require(_0xdef0('0x2'));var rs=require(_0xdef0('0x3'));var fs=require('fs');var Redis=require(_0xdef0('0x4'));var db=require(_0xdef0('0x5'))['db'];var utils=require(_0xdef0('0x6'));var logger=require(_0xdef0('0x7'))(_0xdef0('0x8'));var config=require(_0xdef0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdef0('0xa')][_0xdef0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b4c00,_0x246435,_0x8227dd){return new BPromise(function(_0x2ff6e5,_0x26b271){return client[_0xdef0('0xc')](_0x2b4c00,_0x8227dd)['then'](function(_0x10b1bf){logger[_0xdef0('0xd')](_0xdef0('0xe'),_0x246435,_0xdef0('0xf'));logger[_0xdef0('0x10')](_0xdef0('0x11'),_0x246435,'request\x20sent',JSON[_0xdef0('0x12')](_0x10b1bf));if(_0x10b1bf[_0xdef0('0x13')]){if(_0x10b1bf['error'][_0xdef0('0x14')]===0x1f4){logger[_0xdef0('0x13')](_0xdef0('0xe'),_0x246435,_0x10b1bf['error'][_0xdef0('0x15')]);return _0x26b271(_0x10b1bf[_0xdef0('0x13')][_0xdef0('0x15')]);}logger[_0xdef0('0x13')](_0xdef0('0xe'),_0x246435,_0x10b1bf[_0xdef0('0x13')][_0xdef0('0x15')]);return _0x2ff6e5(_0x10b1bf['error'][_0xdef0('0x15')]);}else{logger[_0xdef0('0xd')](_0xdef0('0xe'),_0x246435,_0xdef0('0xf'));_0x2ff6e5(_0x10b1bf[_0xdef0('0x16')]['message']);}})['catch'](function(_0x1a2ce3){logger['error'](_0xdef0('0xe'),_0x246435,_0x1a2ce3);_0x26b271(_0x1a2ce3);});});}exports[_0xdef0('0x17')]=function(_0x254a8c){var _0x1ea829=this;return new Promise(function(_0x5961fa,_0x31faf7){return db['SalesforceAccount']['findAll']({'raw':_0x254a8c[_0xdef0('0x18')]?_0x254a8c[_0xdef0('0x18')][_0xdef0('0x19')]===undefined?!![]:![]:!![],'where':_0x254a8c[_0xdef0('0x18')]?_0x254a8c['options']['where']||null:null,'attributes':_0x254a8c[_0xdef0('0x18')]?_0x254a8c[_0xdef0('0x18')][_0xdef0('0x1a')]||null:null,'limit':_0x254a8c[_0xdef0('0x18')]?_0x254a8c[_0xdef0('0x18')]['limit']||null:null,'include':_0x254a8c['options']?_0x254a8c[_0xdef0('0x18')][_0xdef0('0x1b')]?_[_0xdef0('0x1c')](_0x254a8c['options'][_0xdef0('0x1b')],function(_0x4bde65){return{'model':db[_0x4bde65[_0xdef0('0x1d')]],'as':_0x4bde65['as'],'attributes':_0x4bde65[_0xdef0('0x1a')],'include':_0x4bde65['include']?_[_0xdef0('0x1c')](_0x4bde65[_0xdef0('0x1b')],function(_0x3be142){return{'model':db[_0x3be142['model']],'as':_0x3be142['as'],'attributes':_0x3be142[_0xdef0('0x1a')],'include':_0x3be142['include']?_[_0xdef0('0x1c')](_0x3be142[_0xdef0('0x1b')],function(_0xbea465){return{'model':db[_0xbea465[_0xdef0('0x1d')]],'as':_0xbea465['as'],'attributes':_0xbea465[_0xdef0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x521a79){logger[_0xdef0('0xd')]('GetSalesforceAccount',_0x254a8c);logger[_0xdef0('0x10')](_0xdef0('0x17'),_0x254a8c,JSON[_0xdef0('0x12')](_0x521a79));_0x5961fa(_0x521a79);})[_0xdef0('0x1e')](function(_0x19bf8b){logger[_0xdef0('0x13')](_0xdef0('0x17'),_0x19bf8b[_0xdef0('0x15')],_0x254a8c);_0x31faf7(_0x1ea829[_0xdef0('0x13')](0x1f4,_0x19bf8b[_0xdef0('0x15')]));});});};exports[_0xdef0('0x1f')]=function(_0x21c7b6){var _0x496bdd=this;return new Promise(function(_0x41a3b2,_0x1cd2b6){return db[_0xdef0('0x20')][_0xdef0('0x21')]({'raw':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')][_0xdef0('0x19')]===undefined?!![]:![]:!![],'where':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')][_0xdef0('0x22')]||null:null,'attributes':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')]['attributes']||null:null,'include':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')][_0xdef0('0x1b')]?_['map'](_0x21c7b6[_0xdef0('0x18')]['include'],function(_0x319c1d){return{'model':db[_0x319c1d[_0xdef0('0x1d')]],'as':_0x319c1d['as'],'attributes':_0x319c1d[_0xdef0('0x1a')],'include':_0x319c1d[_0xdef0('0x1b')]?_[_0xdef0('0x1c')](_0x319c1d[_0xdef0('0x1b')],function(_0x7fd792){return{'model':db[_0x7fd792[_0xdef0('0x1d')]],'as':_0x7fd792['as'],'attributes':_0x7fd792[_0xdef0('0x1a')],'include':_0x7fd792['include']?_['map'](_0x7fd792['include'],function(_0x2ee65a){return{'model':db[_0x2ee65a[_0xdef0('0x1d')]],'as':_0x2ee65a['as'],'attributes':_0x2ee65a['attributes']};}):[]};}):[]};}):[]:[]})[_0xdef0('0x23')](function(_0x3824aa){logger[_0xdef0('0xd')](_0xdef0('0x1f'),_0x21c7b6);logger[_0xdef0('0x10')]('ShowSalesforceAccount',_0x21c7b6,JSON['stringify'](_0x3824aa));_0x41a3b2(_0x3824aa);})[_0xdef0('0x1e')](function(_0xcf025e){logger['error']('ShowSalesforceAccount',_0xcf025e[_0xdef0('0x15')],_0x21c7b6);_0x1cd2b6(_0x496bdd['error'](0x1f4,_0xcf025e[_0xdef0('0x15')]));});});}; \ No newline at end of file +var _0xbdc1=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetSalesforceAccount','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowSalesforceAccount','SalesforceAccount','lodash','moment','bluebird'];(function(_0x3d23c5,_0x284b53){var _0x1ab027=function(_0x46796d){while(--_0x46796d){_0x3d23c5['push'](_0x3d23c5['shift']());}};_0x1ab027(++_0x284b53);}(_0xbdc1,0x147));var _0x1bdc=function(_0x194188,_0x3bb539){_0x194188=_0x194188-0x0;var _0xecb780=_0xbdc1[_0x194188];return _0xecb780;};'use strict';var _=require(_0x1bdc('0x0'));var util=require('util');var moment=require(_0x1bdc('0x1'));var BPromise=require(_0x1bdc('0x2'));var rs=require(_0x1bdc('0x3'));var fs=require('fs');var Redis=require(_0x1bdc('0x4'));var db=require(_0x1bdc('0x5'))['db'];var utils=require(_0x1bdc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1bdc('0x7'));var jayson=require(_0x1bdc('0x8'));var client=jayson['client'][_0x1bdc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x410396,_0x26fe74,_0x172324){return new BPromise(function(_0x15cd8e,_0x3f852d){return client[_0x1bdc('0xa')](_0x410396,_0x172324)[_0x1bdc('0xb')](function(_0x47675b){logger[_0x1bdc('0xc')](_0x1bdc('0xd'),_0x26fe74,_0x1bdc('0xe'));logger[_0x1bdc('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x26fe74,_0x1bdc('0xe'),JSON[_0x1bdc('0x10')](_0x47675b));if(_0x47675b[_0x1bdc('0x11')]){if(_0x47675b[_0x1bdc('0x11')][_0x1bdc('0x12')]===0x1f4){logger[_0x1bdc('0x11')](_0x1bdc('0xd'),_0x26fe74,_0x47675b['error'][_0x1bdc('0x13')]);return _0x3f852d(_0x47675b[_0x1bdc('0x11')][_0x1bdc('0x13')]);}logger['error'](_0x1bdc('0xd'),_0x26fe74,_0x47675b['error'][_0x1bdc('0x13')]);return _0x15cd8e(_0x47675b[_0x1bdc('0x11')][_0x1bdc('0x13')]);}else{logger[_0x1bdc('0xc')](_0x1bdc('0xd'),_0x26fe74,_0x1bdc('0xe'));_0x15cd8e(_0x47675b['result'][_0x1bdc('0x13')]);}})['catch'](function(_0x3dc6ec){logger[_0x1bdc('0x11')](_0x1bdc('0xd'),_0x26fe74,_0x3dc6ec);_0x3f852d(_0x3dc6ec);});});}exports[_0x1bdc('0x14')]=function(_0x160a90){var _0x27567f=this;return new Promise(function(_0x26fff5,_0x2f528b){return db['SalesforceAccount'][_0x1bdc('0x15')]({'raw':_0x160a90[_0x1bdc('0x16')]?_0x160a90[_0x1bdc('0x16')][_0x1bdc('0x17')]===undefined?!![]:![]:!![],'where':_0x160a90[_0x1bdc('0x16')]?_0x160a90[_0x1bdc('0x16')][_0x1bdc('0x18')]||null:null,'attributes':_0x160a90[_0x1bdc('0x16')]?_0x160a90[_0x1bdc('0x16')]['attributes']||null:null,'limit':_0x160a90['options']?_0x160a90['options'][_0x1bdc('0x19')]||null:null,'include':_0x160a90[_0x1bdc('0x16')]?_0x160a90[_0x1bdc('0x16')][_0x1bdc('0x1a')]?_[_0x1bdc('0x1b')](_0x160a90[_0x1bdc('0x16')]['include'],function(_0x3b4ff4){return{'model':db[_0x3b4ff4[_0x1bdc('0x1c')]],'as':_0x3b4ff4['as'],'attributes':_0x3b4ff4['attributes'],'include':_0x3b4ff4['include']?_['map'](_0x3b4ff4[_0x1bdc('0x1a')],function(_0xd9004c){return{'model':db[_0xd9004c[_0x1bdc('0x1c')]],'as':_0xd9004c['as'],'attributes':_0xd9004c[_0x1bdc('0x1d')],'include':_0xd9004c[_0x1bdc('0x1a')]?_[_0x1bdc('0x1b')](_0xd9004c[_0x1bdc('0x1a')],function(_0x53300a){return{'model':db[_0x53300a[_0x1bdc('0x1c')]],'as':_0x53300a['as'],'attributes':_0x53300a[_0x1bdc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1bdc('0xb')](function(_0x3a8860){logger['info'](_0x1bdc('0x14'),_0x160a90);logger[_0x1bdc('0xf')](_0x1bdc('0x14'),_0x160a90,JSON[_0x1bdc('0x10')](_0x3a8860));_0x26fff5(_0x3a8860);})[_0x1bdc('0x1e')](function(_0x49a2f4){logger[_0x1bdc('0x11')](_0x1bdc('0x14'),_0x49a2f4['message'],_0x160a90);_0x2f528b(_0x27567f['error'](0x1f4,_0x49a2f4[_0x1bdc('0x13')]));});});};exports[_0x1bdc('0x1f')]=function(_0x3346a5){var _0x19ea4e=this;return new Promise(function(_0x4b03c8,_0x4199f4){return db[_0x1bdc('0x20')]['find']({'raw':_0x3346a5[_0x1bdc('0x16')]?_0x3346a5[_0x1bdc('0x16')][_0x1bdc('0x17')]===undefined?!![]:![]:!![],'where':_0x3346a5[_0x1bdc('0x16')]?_0x3346a5[_0x1bdc('0x16')][_0x1bdc('0x18')]||null:null,'attributes':_0x3346a5[_0x1bdc('0x16')]?_0x3346a5[_0x1bdc('0x16')][_0x1bdc('0x1d')]||null:null,'include':_0x3346a5['options']?_0x3346a5[_0x1bdc('0x16')][_0x1bdc('0x1a')]?_[_0x1bdc('0x1b')](_0x3346a5[_0x1bdc('0x16')][_0x1bdc('0x1a')],function(_0x9a471a){return{'model':db[_0x9a471a['model']],'as':_0x9a471a['as'],'attributes':_0x9a471a['attributes'],'include':_0x9a471a[_0x1bdc('0x1a')]?_[_0x1bdc('0x1b')](_0x9a471a[_0x1bdc('0x1a')],function(_0x2999d9){return{'model':db[_0x2999d9[_0x1bdc('0x1c')]],'as':_0x2999d9['as'],'attributes':_0x2999d9[_0x1bdc('0x1d')],'include':_0x2999d9[_0x1bdc('0x1a')]?_[_0x1bdc('0x1b')](_0x2999d9[_0x1bdc('0x1a')],function(_0x37667a){return{'model':db[_0x37667a[_0x1bdc('0x1c')]],'as':_0x37667a['as'],'attributes':_0x37667a[_0x1bdc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1bdc('0xb')](function(_0x1746d4){logger[_0x1bdc('0xc')]('ShowSalesforceAccount',_0x3346a5);logger[_0x1bdc('0xf')]('ShowSalesforceAccount',_0x3346a5,JSON[_0x1bdc('0x10')](_0x1746d4));_0x4b03c8(_0x1746d4);})[_0x1bdc('0x1e')](function(_0x112c3a){logger[_0x1bdc('0x11')](_0x1bdc('0x1f'),_0x112c3a[_0x1bdc('0x13')],_0x3346a5);_0x4199f4(_0x19ea4e[_0x1bdc('0x11')](0x1f4,_0x112c3a[_0x1bdc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 92c4f1b..710b0e1 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x405219,_0xa5be00){var _0x7da1a9=function(_0x40e852){while(--_0x40e852){_0x405219['push'](_0x405219['shift']());}};_0x7da1a9(++_0xa5be00);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x5239b7,_0x46f4a7){var _0x2bd70d=function(_0x248b2d){while(--_0x248b2d){_0x5239b7['push'](_0x5239b7['shift']());}};_0x2bd70d(++_0x46f4a7);}(_0x2ef3,0xba));var _0x32ef=function(_0x38a2e6,_0x55a185){_0x38a2e6=_0x38a2e6-0x0;var _0x2ed339=_0x2ef3[_0x38a2e6];return _0x2ed339;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 02c7056..454b9d9 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 _0x5f60=['Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','exports','STRING'];(function(_0x2bdb06,_0x294973){var _0x36058=function(_0x14f151){while(--_0x14f151){_0x2bdb06['push'](_0x2bdb06['shift']());}};_0x36058(++_0x294973);}(_0x5f60,0x134));var _0x05f6=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0x5f60[_0x13187a];return _0x65b85f;};'use strict';var Sequelize=require('sequelize');module[_0x05f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x05f6('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x05f6('0x2'),_0x05f6('0x3')),'defaultValue':_0x05f6('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x05f6('0x4'),_0x05f6('0x5'),_0x05f6('0x6'),_0x05f6('0x7'),_0x05f6('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x05f6('0x9'),_0x05f6('0x5'),_0x05f6('0x6'),_0x05f6('0x8')),'defaultValue':_0x05f6('0x6')},'leadId':{'type':Sequelize[_0x05f6('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x05f6('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaf1c=['contact','account_contact_lead','account','nothing','lead','exports','STRING','ENUM','Task','Case','contact_lead'];(function(_0x1a58d9,_0x1ac054){var _0xfba178=function(_0x1dd221){while(--_0x1dd221){_0x1a58d9['push'](_0x1a58d9['shift']());}};_0xfba178(++_0x1ac054);}(_0xaf1c,0x1de));var _0xcaf1=function(_0x3f21e0,_0x3e3f3d){_0x3f21e0=_0x3f21e0-0x0;var _0x19b54d=_0xaf1c[_0x3f21e0];return _0x19b54d;};'use strict';var Sequelize=require('sequelize');module[_0xcaf1('0x0')]={'name':{'type':Sequelize[_0xcaf1('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xcaf1('0x2')](_0xcaf1('0x3'),_0xcaf1('0x4')),'defaultValue':_0xcaf1('0x3')},'moduleSearch':{'type':Sequelize[_0xcaf1('0x2')](_0xcaf1('0x5'),_0xcaf1('0x6'),'lead',_0xcaf1('0x7'),_0xcaf1('0x8')),'defaultValue':_0xcaf1('0x5')},'moduleCreate':{'type':Sequelize[_0xcaf1('0x2')](_0xcaf1('0x9'),_0xcaf1('0x6'),_0xcaf1('0xa'),_0xcaf1('0x8')),'defaultValue':_0xcaf1('0xa')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xcaf1('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xcaf1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index bb8fd0c..feb3cf6 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 _0x4d54=['keys','length','options','create','body','find','getFields','SalesforceField','sort','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4d54,0xf5));var _0x44d5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4d54[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x44d5('0x0'));var rimraf=require(_0x44d5('0x1'));var zipdir=require(_0x44d5('0x2'));var jsonpatch=require(_0x44d5('0x3'));var rp=require(_0x44d5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44d5('0x5'));var util=require(_0x44d5('0x6'));var path=require('path');var sox=require(_0x44d5('0x7'));var csv=require(_0x44d5('0x8'));var ejs=require(_0x44d5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x44d5('0xa'));var squel=require(_0x44d5('0xb'));var crypto=require(_0x44d5('0xc'));var jsforce=require(_0x44d5('0xd'));var deskjs=require(_0x44d5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x44d5('0xf'));var Papa=require('papaparse');var Redis=require(_0x44d5('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x44d5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44d5('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x44d5('0x13'));var licenseUtil=require(_0x44d5('0x14'));var db=require(_0x44d5('0x15'))['db'];function respondWithStatusCode(_0x495885,_0xfd193f){_0xfd193f=_0xfd193f||0xcc;return function(_0x176757){if(_0x176757){return _0x495885[_0x44d5('0x16')](_0xfd193f);}return _0x495885[_0x44d5('0x17')](_0xfd193f)[_0x44d5('0x18')]();};}function respondWithResult(_0xe2dc93,_0x1f8137){_0x1f8137=_0x1f8137||0xc8;return function(_0x52c43a){if(_0x52c43a){return _0xe2dc93['status'](_0x1f8137)[_0x44d5('0x19')](_0x52c43a);}};}function respondWithFilteredResult(_0x4fc84b,_0x20f791){return function(_0x1ce08a){if(_0x1ce08a){var _0x4b8758=typeof _0x20f791[_0x44d5('0x1a')]==='undefined'&&typeof _0x20f791[_0x44d5('0x1b')]===_0x44d5('0x1c');var _0x318f42=_0x1ce08a[_0x44d5('0x1d')];var _0x5a8ba7=_0x4b8758?0x0:_0x20f791['offset'];var _0x43eeb0=_0x4b8758?_0x1ce08a['count']:_0x20f791[_0x44d5('0x1a')]+_0x20f791['limit'];var _0x560c19;if(_0x43eeb0>=_0x318f42){_0x43eeb0=_0x318f42;_0x560c19=0xc8;}else{_0x560c19=0xce;}_0x4fc84b[_0x44d5('0x17')](_0x560c19);return _0x4fc84b[_0x44d5('0x1e')](_0x44d5('0x1f'),_0x5a8ba7+'-'+_0x43eeb0+'/'+_0x318f42)[_0x44d5('0x19')](_0x1ce08a);}return null;};}function patchUpdates(_0x523211){return function(_0x45b8f1){try{jsonpatch[_0x44d5('0x20')](_0x45b8f1,_0x523211,!![]);}catch(_0x4d23d4){return BPromise[_0x44d5('0x21')](_0x4d23d4);}return _0x45b8f1[_0x44d5('0x22')]();};}function saveUpdates(_0x5cd9d6,_0x1b5dd2){return function(_0x342a56){if(_0x342a56){return _0x342a56[_0x44d5('0x23')](_0x5cd9d6)[_0x44d5('0x24')](function(_0x2ba278){return _0x2ba278;});}return null;};}function removeEntity(_0x3e2cf2,_0x3d9d4e){return function(_0x1bef29){if(_0x1bef29){return _0x1bef29[_0x44d5('0x25')]()[_0x44d5('0x24')](function(){_0x3e2cf2[_0x44d5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5046d2,_0x53b5ce){return function(_0x151171){if(!_0x151171){_0x5046d2['sendStatus'](0x194);}return _0x151171;};}function handleError(_0x3597bc,_0x5c3de9){_0x5c3de9=_0x5c3de9||0x1f4;return function(_0x2a2e6c){logger[_0x44d5('0x26')](_0x2a2e6c[_0x44d5('0x27')]);if(_0x2a2e6c['name']){delete _0x2a2e6c[_0x44d5('0x28')];}_0x3597bc[_0x44d5('0x17')](_0x5c3de9)['send'](_0x2a2e6c);};}exports['index']=function(_0x1ca2d1,_0x545ac4){var _0x188432={},_0x178573={},_0x2a73db={'count':0x0,'rows':[]};var _0x3d4a82=_[_0x44d5('0x29')](db[_0x44d5('0x2a')][_0x44d5('0x2b')],function(_0x338fa7){return{'name':_0x338fa7[_0x44d5('0x2c')],'type':_0x338fa7['type'][_0x44d5('0x2d')]};});_0x178573['model']=_['map'](_0x3d4a82,'name');_0x178573[_0x44d5('0x2e')]=_['keys'](_0x1ca2d1[_0x44d5('0x2e')]);_0x178573[_0x44d5('0x2f')]=_['intersection'](_0x178573[_0x44d5('0x30')],_0x178573[_0x44d5('0x2e')]);_0x188432[_0x44d5('0x31')]=_[_0x44d5('0x32')](_0x178573[_0x44d5('0x30')],qs[_0x44d5('0x33')](_0x1ca2d1[_0x44d5('0x2e')]['fields']));_0x188432[_0x44d5('0x31')]=_0x188432[_0x44d5('0x31')]['length']?_0x188432[_0x44d5('0x31')]:_0x178573[_0x44d5('0x30')];if(!_0x1ca2d1[_0x44d5('0x2e')][_0x44d5('0x34')](_0x44d5('0x35'))){_0x188432['limit']=qs['limit'](_0x1ca2d1[_0x44d5('0x2e')]['limit']);_0x188432[_0x44d5('0x1a')]=qs['offset'](_0x1ca2d1[_0x44d5('0x2e')][_0x44d5('0x1a')]);}_0x188432[_0x44d5('0x36')]=qs['sort'](_0x1ca2d1[_0x44d5('0x2e')]['sort']);_0x188432[_0x44d5('0x37')]=qs['filters'](_[_0x44d5('0x38')](_0x1ca2d1[_0x44d5('0x2e')],_0x178573[_0x44d5('0x2f')]),_0x3d4a82);if(_0x1ca2d1['query'][_0x44d5('0x39')]){_0x188432[_0x44d5('0x37')]=_[_0x44d5('0x3a')](_0x188432[_0x44d5('0x37')],{'$or':_[_0x44d5('0x29')](_0x3d4a82,function(_0x36f1d9){if(_0x36f1d9[_0x44d5('0x3b')]!==_0x44d5('0x3c')){var _0x18c9b7={};_0x18c9b7[_0x36f1d9[_0x44d5('0x28')]]={'$like':'%'+_0x1ca2d1['query']['filter']+'%'};return _0x18c9b7;}})});}_0x188432=_[_0x44d5('0x3a')]({},_0x188432,_0x1ca2d1['options']);var _0x48a3c9={'where':_0x188432[_0x44d5('0x37')]};return db[_0x44d5('0x2a')][_0x44d5('0x1d')](_0x48a3c9)['then'](function(_0x4b65dd){_0x2a73db[_0x44d5('0x1d')]=_0x4b65dd;if(_0x1ca2d1[_0x44d5('0x2e')][_0x44d5('0x3d')]){_0x188432[_0x44d5('0x3e')]=[{'all':!![]}];}return db[_0x44d5('0x2a')][_0x44d5('0x3f')](_0x188432);})[_0x44d5('0x24')](function(_0x5ea92f){_0x2a73db[_0x44d5('0x40')]=_0x5ea92f;return _0x2a73db;})['then'](respondWithFilteredResult(_0x545ac4,_0x188432))[_0x44d5('0x41')](handleError(_0x545ac4,null));};exports['show']=function(_0xf485d0,_0x2b4f93){var _0xb47cb0={'raw':![],'where':{'id':_0xf485d0[_0x44d5('0x42')]['id']}},_0x5f2451={};_0x5f2451[_0x44d5('0x30')]=_[_0x44d5('0x43')](db[_0x44d5('0x2a')][_0x44d5('0x2b')]);_0x5f2451['query']=_[_0x44d5('0x43')](_0xf485d0['query']);_0x5f2451[_0x44d5('0x2f')]=_[_0x44d5('0x32')](_0x5f2451[_0x44d5('0x30')],_0x5f2451['query']);_0xb47cb0[_0x44d5('0x31')]=_[_0x44d5('0x32')](_0x5f2451[_0x44d5('0x30')],qs[_0x44d5('0x33')](_0xf485d0[_0x44d5('0x2e')][_0x44d5('0x33')]));_0xb47cb0[_0x44d5('0x31')]=_0xb47cb0['attributes'][_0x44d5('0x44')]?_0xb47cb0[_0x44d5('0x31')]:_0x5f2451[_0x44d5('0x30')];if(_0xf485d0[_0x44d5('0x2e')]['includeAll']){_0xb47cb0['include']=[{'all':!![]}];}_0xb47cb0=_[_0x44d5('0x3a')]({},_0xb47cb0,_0xf485d0[_0x44d5('0x45')]);return db[_0x44d5('0x2a')]['find'](_0xb47cb0)[_0x44d5('0x24')](handleEntityNotFound(_0x2b4f93,null))[_0x44d5('0x24')](respondWithResult(_0x2b4f93,null))[_0x44d5('0x41')](handleError(_0x2b4f93,null));};exports[_0x44d5('0x46')]=function(_0x22493f,_0x3e4af6){return db[_0x44d5('0x2a')]['create'](_0x22493f[_0x44d5('0x47')],{})[_0x44d5('0x24')](respondWithResult(_0x3e4af6,0xc9))['catch'](handleError(_0x3e4af6,null));};exports[_0x44d5('0x23')]=function(_0x375722,_0x8bcfc6){if(_0x375722[_0x44d5('0x47')]['id']){delete _0x375722[_0x44d5('0x47')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x375722[_0x44d5('0x42')]['id']}})[_0x44d5('0x24')](handleEntityNotFound(_0x8bcfc6,null))[_0x44d5('0x24')](saveUpdates(_0x375722[_0x44d5('0x47')],null))[_0x44d5('0x24')](respondWithResult(_0x8bcfc6,null))[_0x44d5('0x41')](handleError(_0x8bcfc6,null));};exports['destroy']=function(_0x4239c1,_0x20a5fc){return db['SalesforceConfiguration'][_0x44d5('0x48')]({'where':{'id':_0x4239c1['params']['id']}})[_0x44d5('0x24')](handleEntityNotFound(_0x20a5fc,null))[_0x44d5('0x24')](removeEntity(_0x20a5fc,null))['catch'](handleError(_0x20a5fc,null));};exports[_0x44d5('0x49')]=function(_0x5f3eb6,_0x483687,_0x42e3ed){var _0x56365b={};var _0x413d9e={};var _0x5579e8;var _0x27fde9;return db[_0x44d5('0x2a')]['findOne']({'where':{'id':_0x5f3eb6[_0x44d5('0x42')]['id']}})[_0x44d5('0x24')](handleEntityNotFound(_0x483687,null))[_0x44d5('0x24')](function(_0x14c53d){if(_0x14c53d){_0x5579e8=_0x14c53d;_0x413d9e[_0x44d5('0x30')]=_['keys'](db[_0x44d5('0x4a')][_0x44d5('0x2b')]);_0x413d9e['query']=_[_0x44d5('0x43')](_0x5f3eb6[_0x44d5('0x2e')]);_0x413d9e[_0x44d5('0x2f')]=_[_0x44d5('0x32')](_0x413d9e[_0x44d5('0x30')],_0x413d9e[_0x44d5('0x2e')]);_0x56365b[_0x44d5('0x31')]=_['intersection'](_0x413d9e[_0x44d5('0x30')],qs[_0x44d5('0x33')](_0x5f3eb6[_0x44d5('0x2e')][_0x44d5('0x33')]));_0x56365b[_0x44d5('0x31')]=_0x56365b[_0x44d5('0x31')][_0x44d5('0x44')]?_0x56365b['attributes']:_0x413d9e['model'];_0x56365b[_0x44d5('0x36')]=qs[_0x44d5('0x4b')](_0x5f3eb6[_0x44d5('0x2e')][_0x44d5('0x4b')]);_0x56365b[_0x44d5('0x37')]=qs[_0x44d5('0x2f')](_[_0x44d5('0x38')](_0x5f3eb6[_0x44d5('0x2e')],_0x413d9e[_0x44d5('0x2f')]));if(_0x5f3eb6[_0x44d5('0x2e')][_0x44d5('0x39')]){_0x56365b[_0x44d5('0x37')]=_[_0x44d5('0x3a')](_0x56365b[_0x44d5('0x37')],{'$or':_[_0x44d5('0x29')](_0x56365b['attributes'],function(_0x76c5be){var _0x4a9528={};_0x4a9528[_0x76c5be]={'$like':'%'+_0x5f3eb6[_0x44d5('0x2e')]['filter']+'%'};return _0x4a9528;})});}_0x56365b=_[_0x44d5('0x3a')]({},_0x56365b,_0x5f3eb6[_0x44d5('0x45')]);return _0x5579e8[_0x44d5('0x49')](_0x56365b);}})[_0x44d5('0x24')](function(_0x25613f){if(_0x25613f){_0x27fde9=_0x25613f[_0x44d5('0x44')];if(!_0x5f3eb6[_0x44d5('0x2e')][_0x44d5('0x34')](_0x44d5('0x35'))){_0x56365b[_0x44d5('0x1b')]=qs['limit'](_0x5f3eb6['query'][_0x44d5('0x1b')]);_0x56365b[_0x44d5('0x1a')]=qs[_0x44d5('0x1a')](_0x5f3eb6[_0x44d5('0x2e')][_0x44d5('0x1a')]);}return _0x5579e8[_0x44d5('0x49')](_0x56365b);}})[_0x44d5('0x24')](function(_0x357cbf){if(_0x357cbf){return _0x357cbf?{'count':_0x27fde9,'rows':_0x357cbf}:null;}})[_0x44d5('0x24')](respondWithResult(_0x483687,null))[_0x44d5('0x41')](handleError(_0x483687,null));};exports[_0x44d5('0x4c')]=function(_0x180990,_0x474a28,_0x5aeccc){var _0x5c5c94={};var _0x5e09d1={};var _0x33b52e;var _0x4fc4c0;return db[_0x44d5('0x2a')]['findOne']({'where':{'id':_0x180990['params']['id']}})[_0x44d5('0x24')](handleEntityNotFound(_0x474a28,null))[_0x44d5('0x24')](function(_0x16e28f){if(_0x16e28f){_0x33b52e=_0x16e28f;_0x5e09d1[_0x44d5('0x30')]=_['keys'](db['SalesforceField'][_0x44d5('0x2b')]);_0x5e09d1[_0x44d5('0x2e')]=_['keys'](_0x180990[_0x44d5('0x2e')]);_0x5e09d1[_0x44d5('0x2f')]=_[_0x44d5('0x32')](_0x5e09d1[_0x44d5('0x30')],_0x5e09d1[_0x44d5('0x2e')]);_0x5c5c94['attributes']=_[_0x44d5('0x32')](_0x5e09d1[_0x44d5('0x30')],qs[_0x44d5('0x33')](_0x180990[_0x44d5('0x2e')][_0x44d5('0x33')]));_0x5c5c94[_0x44d5('0x31')]=_0x5c5c94['attributes']['length']?_0x5c5c94[_0x44d5('0x31')]:_0x5e09d1[_0x44d5('0x30')];_0x5c5c94[_0x44d5('0x36')]=qs[_0x44d5('0x4b')](_0x180990[_0x44d5('0x2e')][_0x44d5('0x4b')]);_0x5c5c94[_0x44d5('0x37')]=qs[_0x44d5('0x2f')](_[_0x44d5('0x38')](_0x180990['query'],_0x5e09d1[_0x44d5('0x2f')]));if(_0x180990['query'][_0x44d5('0x39')]){_0x5c5c94[_0x44d5('0x37')]=_['merge'](_0x5c5c94[_0x44d5('0x37')],{'$or':_['map'](_0x5c5c94[_0x44d5('0x31')],function(_0x3d7e25){var _0x323aba={};_0x323aba[_0x3d7e25]={'$like':'%'+_0x180990[_0x44d5('0x2e')][_0x44d5('0x39')]+'%'};return _0x323aba;})});}_0x5c5c94=_[_0x44d5('0x3a')]({},_0x5c5c94,_0x180990[_0x44d5('0x45')]);return _0x33b52e[_0x44d5('0x4c')](_0x5c5c94);}})[_0x44d5('0x24')](function(_0x1d6bb0){if(_0x1d6bb0){_0x4fc4c0=_0x1d6bb0[_0x44d5('0x44')];if(!_0x180990[_0x44d5('0x2e')][_0x44d5('0x34')](_0x44d5('0x35'))){_0x5c5c94[_0x44d5('0x1b')]=qs[_0x44d5('0x1b')](_0x180990[_0x44d5('0x2e')]['limit']);_0x5c5c94[_0x44d5('0x1a')]=qs[_0x44d5('0x1a')](_0x180990[_0x44d5('0x2e')]['offset']);}return _0x33b52e[_0x44d5('0x4c')](_0x5c5c94);}})[_0x44d5('0x24')](function(_0x1ea782){if(_0x1ea782){return _0x1ea782?{'count':_0x4fc4c0,'rows':_0x1ea782}:null;}})[_0x44d5('0x24')](respondWithResult(_0x474a28,null))[_0x44d5('0x41')](handleError(_0x474a28,null));};exports[_0x44d5('0x4d')]=function(_0x4a9244,_0x7d72cb,_0x44c616){var _0x444312={};var _0x2927da={};var _0x4e4e86;var _0x1d055d;return db[_0x44d5('0x2a')]['findOne']({'where':{'id':_0x4a9244[_0x44d5('0x42')]['id']}})[_0x44d5('0x24')](handleEntityNotFound(_0x7d72cb,null))['then'](function(_0x599972){if(_0x599972){_0x4e4e86=_0x599972;_0x2927da[_0x44d5('0x30')]=_[_0x44d5('0x43')](db[_0x44d5('0x4a')][_0x44d5('0x2b')]);_0x2927da[_0x44d5('0x2e')]=_['keys'](_0x4a9244[_0x44d5('0x2e')]);_0x2927da[_0x44d5('0x2f')]=_[_0x44d5('0x32')](_0x2927da[_0x44d5('0x30')],_0x2927da['query']);_0x444312[_0x44d5('0x31')]=_[_0x44d5('0x32')](_0x2927da['model'],qs[_0x44d5('0x33')](_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x33')]));_0x444312[_0x44d5('0x31')]=_0x444312[_0x44d5('0x31')][_0x44d5('0x44')]?_0x444312[_0x44d5('0x31')]:_0x2927da[_0x44d5('0x30')];_0x444312[_0x44d5('0x36')]=qs[_0x44d5('0x4b')](_0x4a9244['query']['sort']);_0x444312[_0x44d5('0x37')]=qs[_0x44d5('0x2f')](_[_0x44d5('0x38')](_0x4a9244[_0x44d5('0x2e')],_0x2927da['filters']));if(_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x39')]){_0x444312['where']=_[_0x44d5('0x3a')](_0x444312[_0x44d5('0x37')],{'$or':_[_0x44d5('0x29')](_0x444312[_0x44d5('0x31')],function(_0x325d7c){var _0x2e32b5={};_0x2e32b5[_0x325d7c]={'$like':'%'+_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x39')]+'%'};return _0x2e32b5;})});}_0x444312=_[_0x44d5('0x3a')]({},_0x444312,_0x4a9244[_0x44d5('0x45')]);return _0x4e4e86[_0x44d5('0x4d')](_0x444312);}})[_0x44d5('0x24')](function(_0x5a6d63){if(_0x5a6d63){_0x1d055d=_0x5a6d63['length'];if(!_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x34')](_0x44d5('0x35'))){_0x444312[_0x44d5('0x1b')]=qs['limit'](_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x1b')]);_0x444312[_0x44d5('0x1a')]=qs[_0x44d5('0x1a')](_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x1a')]);}return _0x4e4e86[_0x44d5('0x4d')](_0x444312);}})['then'](function(_0x178b3a){if(_0x178b3a){return _0x178b3a?{'count':_0x1d055d,'rows':_0x178b3a}:null;}})[_0x44d5('0x24')](respondWithResult(_0x7d72cb,null))[_0x44d5('0x41')](handleError(_0x7d72cb,null));}; \ No newline at end of file +var _0x2bd7=['querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','SalesforceConfiguration','includeAll','findAll','catch','show','params','keys','include','find','create','body','update','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x475f77,_0x5bda26){var _0x202100=function(_0x2f6ea2){while(--_0x2f6ea2){_0x475f77['push'](_0x475f77['shift']());}};_0x202100(++_0x5bda26);}(_0x2bd7,0x1d0));var _0x72bd=function(_0x25247b,_0x360847){_0x25247b=_0x25247b-0x0;var _0x5bfbc9=_0x2bd7[_0x25247b];return _0x5bfbc9;};'use strict';var emlformat=require(_0x72bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72bd('0x1'));var jsonpatch=require(_0x72bd('0x2'));var rp=require(_0x72bd('0x3'));var moment=require(_0x72bd('0x4'));var BPromise=require(_0x72bd('0x5'));var Mustache=require(_0x72bd('0x6'));var util=require(_0x72bd('0x7'));var path=require(_0x72bd('0x8'));var sox=require('sox');var csv=require(_0x72bd('0x9'));var ejs=require(_0x72bd('0xa'));var fs=require('fs');var fs_extra=require(_0x72bd('0xb'));var _=require(_0x72bd('0xc'));var squel=require(_0x72bd('0xd'));var crypto=require(_0x72bd('0xe'));var jsforce=require(_0x72bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x72bd('0x9'));var querystring=require(_0x72bd('0x10'));var Papa=require(_0x72bd('0x11'));var Redis=require(_0x72bd('0x12'));var authService=require(_0x72bd('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x72bd('0x14'))(_0x72bd('0x15'));var utils=require(_0x72bd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x72bd('0x17'));var db=require(_0x72bd('0x18'))['db'];function respondWithStatusCode(_0x2e46da,_0x1c8770){_0x1c8770=_0x1c8770||0xcc;return function(_0x25971d){if(_0x25971d){return _0x2e46da[_0x72bd('0x19')](_0x1c8770);}return _0x2e46da[_0x72bd('0x1a')](_0x1c8770)[_0x72bd('0x1b')]();};}function respondWithResult(_0x5e5c04,_0x77b5e2){_0x77b5e2=_0x77b5e2||0xc8;return function(_0x2e41fb){if(_0x2e41fb){return _0x5e5c04[_0x72bd('0x1a')](_0x77b5e2)[_0x72bd('0x1c')](_0x2e41fb);}};}function respondWithFilteredResult(_0x12bf7e,_0x3c82bc){return function(_0x2cb387){if(_0x2cb387){var _0x4c4eb6=typeof _0x3c82bc[_0x72bd('0x1d')]===_0x72bd('0x1e')&&typeof _0x3c82bc[_0x72bd('0x1f')]===_0x72bd('0x1e');var _0x27a403=_0x2cb387[_0x72bd('0x20')];var _0x1bc0d7=_0x4c4eb6?0x0:_0x3c82bc['offset'];var _0x44b6b2=_0x4c4eb6?_0x2cb387[_0x72bd('0x20')]:_0x3c82bc[_0x72bd('0x1d')]+_0x3c82bc['limit'];var _0x3783a0;if(_0x44b6b2>=_0x27a403){_0x44b6b2=_0x27a403;_0x3783a0=0xc8;}else{_0x3783a0=0xce;}_0x12bf7e[_0x72bd('0x1a')](_0x3783a0);return _0x12bf7e[_0x72bd('0x21')](_0x72bd('0x22'),_0x1bc0d7+'-'+_0x44b6b2+'/'+_0x27a403)[_0x72bd('0x1c')](_0x2cb387);}return null;};}function patchUpdates(_0x5c61f6){return function(_0x2d426a){try{jsonpatch[_0x72bd('0x23')](_0x2d426a,_0x5c61f6,!![]);}catch(_0x29ce47){return BPromise['reject'](_0x29ce47);}return _0x2d426a[_0x72bd('0x24')]();};}function saveUpdates(_0x2c1514,_0x3cba90){return function(_0x1dfe30){if(_0x1dfe30){return _0x1dfe30['update'](_0x2c1514)[_0x72bd('0x25')](function(_0x1c673c){return _0x1c673c;});}return null;};}function removeEntity(_0x5c76d3,_0x6b205e){return function(_0x389e61){if(_0x389e61){return _0x389e61[_0x72bd('0x26')]()['then'](function(){_0x5c76d3['status'](0xcc)[_0x72bd('0x1b')]();});}};}function handleEntityNotFound(_0x34bb3a,_0x471e17){return function(_0x5f768){if(!_0x5f768){_0x34bb3a['sendStatus'](0x194);}return _0x5f768;};}function handleError(_0x1c775a,_0x3e9a3d){_0x3e9a3d=_0x3e9a3d||0x1f4;return function(_0x3e76e4){logger[_0x72bd('0x27')](_0x3e76e4[_0x72bd('0x28')]);if(_0x3e76e4['name']){delete _0x3e76e4[_0x72bd('0x29')];}_0x1c775a[_0x72bd('0x1a')](_0x3e9a3d)[_0x72bd('0x2a')](_0x3e76e4);};}exports[_0x72bd('0x2b')]=function(_0x2c733c,_0x7b278a){var _0x2bcf6b={},_0x582756={},_0x4008ef={'count':0x0,'rows':[]};var _0x35a0e2=_[_0x72bd('0x2c')](db['SalesforceConfiguration'][_0x72bd('0x2d')],function(_0x133606){return{'name':_0x133606[_0x72bd('0x2e')],'type':_0x133606[_0x72bd('0x2f')]['key']};});_0x582756[_0x72bd('0x30')]=_[_0x72bd('0x2c')](_0x35a0e2,_0x72bd('0x29'));_0x582756[_0x72bd('0x31')]=_['keys'](_0x2c733c[_0x72bd('0x31')]);_0x582756[_0x72bd('0x32')]=_['intersection'](_0x582756[_0x72bd('0x30')],_0x582756[_0x72bd('0x31')]);_0x2bcf6b[_0x72bd('0x33')]=_[_0x72bd('0x34')](_0x582756[_0x72bd('0x30')],qs['fields'](_0x2c733c[_0x72bd('0x31')][_0x72bd('0x35')]));_0x2bcf6b[_0x72bd('0x33')]=_0x2bcf6b[_0x72bd('0x33')][_0x72bd('0x36')]?_0x2bcf6b[_0x72bd('0x33')]:_0x582756[_0x72bd('0x30')];if(!_0x2c733c[_0x72bd('0x31')][_0x72bd('0x37')](_0x72bd('0x38'))){_0x2bcf6b[_0x72bd('0x1f')]=qs[_0x72bd('0x1f')](_0x2c733c[_0x72bd('0x31')][_0x72bd('0x1f')]);_0x2bcf6b['offset']=qs['offset'](_0x2c733c['query'][_0x72bd('0x1d')]);}_0x2bcf6b[_0x72bd('0x39')]=qs[_0x72bd('0x3a')](_0x2c733c[_0x72bd('0x31')]['sort']);_0x2bcf6b['where']=qs[_0x72bd('0x32')](_[_0x72bd('0x3b')](_0x2c733c[_0x72bd('0x31')],_0x582756[_0x72bd('0x32')]),_0x35a0e2);if(_0x2c733c[_0x72bd('0x31')][_0x72bd('0x3c')]){_0x2bcf6b[_0x72bd('0x3d')]=_[_0x72bd('0x3e')](_0x2bcf6b[_0x72bd('0x3d')],{'$or':_[_0x72bd('0x2c')](_0x35a0e2,function(_0x16aeb6){if(_0x16aeb6[_0x72bd('0x2f')]!=='VIRTUAL'){var _0x473e4e={};_0x473e4e[_0x16aeb6['name']]={'$like':'%'+_0x2c733c[_0x72bd('0x31')]['filter']+'%'};return _0x473e4e;}})});}_0x2bcf6b=_[_0x72bd('0x3e')]({},_0x2bcf6b,_0x2c733c[_0x72bd('0x3f')]);var _0x2ee7de={'where':_0x2bcf6b[_0x72bd('0x3d')]};return db[_0x72bd('0x40')][_0x72bd('0x20')](_0x2ee7de)['then'](function(_0x43faa7){_0x4008ef['count']=_0x43faa7;if(_0x2c733c['query'][_0x72bd('0x41')]){_0x2bcf6b['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x72bd('0x42')](_0x2bcf6b);})[_0x72bd('0x25')](function(_0x24a9a9){_0x4008ef['rows']=_0x24a9a9;return _0x4008ef;})[_0x72bd('0x25')](respondWithFilteredResult(_0x7b278a,_0x2bcf6b))[_0x72bd('0x43')](handleError(_0x7b278a,null));};exports[_0x72bd('0x44')]=function(_0x2827c1,_0x153538){var _0x5adcdf={'raw':![],'where':{'id':_0x2827c1[_0x72bd('0x45')]['id']}},_0x360650={};_0x360650[_0x72bd('0x30')]=_['keys'](db[_0x72bd('0x40')][_0x72bd('0x2d')]);_0x360650[_0x72bd('0x31')]=_[_0x72bd('0x46')](_0x2827c1[_0x72bd('0x31')]);_0x360650[_0x72bd('0x32')]=_[_0x72bd('0x34')](_0x360650[_0x72bd('0x30')],_0x360650[_0x72bd('0x31')]);_0x5adcdf[_0x72bd('0x33')]=_[_0x72bd('0x34')](_0x360650[_0x72bd('0x30')],qs[_0x72bd('0x35')](_0x2827c1[_0x72bd('0x31')]['fields']));_0x5adcdf[_0x72bd('0x33')]=_0x5adcdf[_0x72bd('0x33')][_0x72bd('0x36')]?_0x5adcdf[_0x72bd('0x33')]:_0x360650['model'];if(_0x2827c1[_0x72bd('0x31')][_0x72bd('0x41')]){_0x5adcdf[_0x72bd('0x47')]=[{'all':!![]}];}_0x5adcdf=_['merge']({},_0x5adcdf,_0x2827c1[_0x72bd('0x3f')]);return db[_0x72bd('0x40')][_0x72bd('0x48')](_0x5adcdf)[_0x72bd('0x25')](handleEntityNotFound(_0x153538,null))[_0x72bd('0x25')](respondWithResult(_0x153538,null))['catch'](handleError(_0x153538,null));};exports[_0x72bd('0x49')]=function(_0x11e7bc,_0x2d2c3e){return db[_0x72bd('0x40')][_0x72bd('0x49')](_0x11e7bc[_0x72bd('0x4a')],{})[_0x72bd('0x25')](respondWithResult(_0x2d2c3e,0xc9))[_0x72bd('0x43')](handleError(_0x2d2c3e,null));};exports[_0x72bd('0x4b')]=function(_0x404fc8,_0x447fe1){if(_0x404fc8[_0x72bd('0x4a')]['id']){delete _0x404fc8['body']['id'];}return db[_0x72bd('0x40')][_0x72bd('0x48')]({'where':{'id':_0x404fc8[_0x72bd('0x45')]['id']}})[_0x72bd('0x25')](handleEntityNotFound(_0x447fe1,null))['then'](saveUpdates(_0x404fc8[_0x72bd('0x4a')],null))['then'](respondWithResult(_0x447fe1,null))['catch'](handleError(_0x447fe1,null));};exports[_0x72bd('0x26')]=function(_0x4c9991,_0x49c652){return db[_0x72bd('0x40')][_0x72bd('0x48')]({'where':{'id':_0x4c9991['params']['id']}})[_0x72bd('0x25')](handleEntityNotFound(_0x49c652,null))['then'](removeEntity(_0x49c652,null))[_0x72bd('0x43')](handleError(_0x49c652,null));};exports['getFields']=function(_0x287494,_0x52c3b0,_0x13f4d5){var _0x113f4a={};var _0x2bd679={};var _0x4a48a4;var _0x42bbf2;return db[_0x72bd('0x40')][_0x72bd('0x4c')]({'where':{'id':_0x287494[_0x72bd('0x45')]['id']}})[_0x72bd('0x25')](handleEntityNotFound(_0x52c3b0,null))['then'](function(_0x39146a){if(_0x39146a){_0x4a48a4=_0x39146a;_0x2bd679[_0x72bd('0x30')]=_[_0x72bd('0x46')](db[_0x72bd('0x4d')][_0x72bd('0x2d')]);_0x2bd679[_0x72bd('0x31')]=_[_0x72bd('0x46')](_0x287494['query']);_0x2bd679['filters']=_['intersection'](_0x2bd679[_0x72bd('0x30')],_0x2bd679[_0x72bd('0x31')]);_0x113f4a[_0x72bd('0x33')]=_[_0x72bd('0x34')](_0x2bd679[_0x72bd('0x30')],qs[_0x72bd('0x35')](_0x287494[_0x72bd('0x31')][_0x72bd('0x35')]));_0x113f4a['attributes']=_0x113f4a[_0x72bd('0x33')][_0x72bd('0x36')]?_0x113f4a[_0x72bd('0x33')]:_0x2bd679['model'];_0x113f4a[_0x72bd('0x39')]=qs[_0x72bd('0x3a')](_0x287494['query']['sort']);_0x113f4a[_0x72bd('0x3d')]=qs['filters'](_[_0x72bd('0x3b')](_0x287494[_0x72bd('0x31')],_0x2bd679[_0x72bd('0x32')]));if(_0x287494[_0x72bd('0x31')][_0x72bd('0x3c')]){_0x113f4a[_0x72bd('0x3d')]=_[_0x72bd('0x3e')](_0x113f4a[_0x72bd('0x3d')],{'$or':_['map'](_0x113f4a[_0x72bd('0x33')],function(_0x22501c){var _0x551b14={};_0x551b14[_0x22501c]={'$like':'%'+_0x287494[_0x72bd('0x31')][_0x72bd('0x3c')]+'%'};return _0x551b14;})});}_0x113f4a=_[_0x72bd('0x3e')]({},_0x113f4a,_0x287494[_0x72bd('0x3f')]);return _0x4a48a4['getFields'](_0x113f4a);}})[_0x72bd('0x25')](function(_0xaa9aa4){if(_0xaa9aa4){_0x42bbf2=_0xaa9aa4['length'];if(!_0x287494[_0x72bd('0x31')]['hasOwnProperty'](_0x72bd('0x38'))){_0x113f4a[_0x72bd('0x1f')]=qs[_0x72bd('0x1f')](_0x287494[_0x72bd('0x31')][_0x72bd('0x1f')]);_0x113f4a[_0x72bd('0x1d')]=qs['offset'](_0x287494['query'][_0x72bd('0x1d')]);}return _0x4a48a4['getFields'](_0x113f4a);}})[_0x72bd('0x25')](function(_0x2deaf7){if(_0x2deaf7){return _0x2deaf7?{'count':_0x42bbf2,'rows':_0x2deaf7}:null;}})['then'](respondWithResult(_0x52c3b0,null))['catch'](handleError(_0x52c3b0,null));};exports[_0x72bd('0x4e')]=function(_0x107fc4,_0x35e94b,_0x58a8b5){var _0x33e0b7={};var _0x2fe626={};var _0x4a9a53;var _0x4356e9;return db[_0x72bd('0x40')][_0x72bd('0x4c')]({'where':{'id':_0x107fc4[_0x72bd('0x45')]['id']}})['then'](handleEntityNotFound(_0x35e94b,null))['then'](function(_0x5c42d0){if(_0x5c42d0){_0x4a9a53=_0x5c42d0;_0x2fe626[_0x72bd('0x30')]=_[_0x72bd('0x46')](db[_0x72bd('0x4d')][_0x72bd('0x2d')]);_0x2fe626[_0x72bd('0x31')]=_[_0x72bd('0x46')](_0x107fc4[_0x72bd('0x31')]);_0x2fe626['filters']=_[_0x72bd('0x34')](_0x2fe626[_0x72bd('0x30')],_0x2fe626[_0x72bd('0x31')]);_0x33e0b7['attributes']=_[_0x72bd('0x34')](_0x2fe626[_0x72bd('0x30')],qs[_0x72bd('0x35')](_0x107fc4[_0x72bd('0x31')][_0x72bd('0x35')]));_0x33e0b7[_0x72bd('0x33')]=_0x33e0b7[_0x72bd('0x33')][_0x72bd('0x36')]?_0x33e0b7[_0x72bd('0x33')]:_0x2fe626['model'];_0x33e0b7['order']=qs[_0x72bd('0x3a')](_0x107fc4['query'][_0x72bd('0x3a')]);_0x33e0b7[_0x72bd('0x3d')]=qs['filters'](_['pick'](_0x107fc4[_0x72bd('0x31')],_0x2fe626[_0x72bd('0x32')]));if(_0x107fc4['query'][_0x72bd('0x3c')]){_0x33e0b7['where']=_[_0x72bd('0x3e')](_0x33e0b7[_0x72bd('0x3d')],{'$or':_['map'](_0x33e0b7[_0x72bd('0x33')],function(_0x2e3ead){var _0xa87277={};_0xa87277[_0x2e3ead]={'$like':'%'+_0x107fc4['query'][_0x72bd('0x3c')]+'%'};return _0xa87277;})});}_0x33e0b7=_[_0x72bd('0x3e')]({},_0x33e0b7,_0x107fc4[_0x72bd('0x3f')]);return _0x4a9a53[_0x72bd('0x4e')](_0x33e0b7);}})[_0x72bd('0x25')](function(_0x53b27c){if(_0x53b27c){_0x4356e9=_0x53b27c['length'];if(!_0x107fc4[_0x72bd('0x31')][_0x72bd('0x37')](_0x72bd('0x38'))){_0x33e0b7[_0x72bd('0x1f')]=qs['limit'](_0x107fc4[_0x72bd('0x31')]['limit']);_0x33e0b7['offset']=qs[_0x72bd('0x1d')](_0x107fc4[_0x72bd('0x31')]['offset']);}return _0x4a9a53['getSubjects'](_0x33e0b7);}})[_0x72bd('0x25')](function(_0x55b1d5){if(_0x55b1d5){return _0x55b1d5?{'count':_0x4356e9,'rows':_0x55b1d5}:null;}})['then'](respondWithResult(_0x35e94b,null))[_0x72bd('0x43')](handleError(_0x35e94b,null));};exports[_0x72bd('0x4f')]=function(_0x4b5353,_0x3e04c6,_0x366367){var _0x150bfb={};var _0x2ec50c={};var _0x474847;var _0x2300f6;return db['SalesforceConfiguration'][_0x72bd('0x4c')]({'where':{'id':_0x4b5353[_0x72bd('0x45')]['id']}})[_0x72bd('0x25')](handleEntityNotFound(_0x3e04c6,null))[_0x72bd('0x25')](function(_0x290fa3){if(_0x290fa3){_0x474847=_0x290fa3;_0x2ec50c[_0x72bd('0x30')]=_[_0x72bd('0x46')](db[_0x72bd('0x4d')][_0x72bd('0x2d')]);_0x2ec50c[_0x72bd('0x31')]=_['keys'](_0x4b5353[_0x72bd('0x31')]);_0x2ec50c[_0x72bd('0x32')]=_['intersection'](_0x2ec50c[_0x72bd('0x30')],_0x2ec50c[_0x72bd('0x31')]);_0x150bfb[_0x72bd('0x33')]=_['intersection'](_0x2ec50c[_0x72bd('0x30')],qs[_0x72bd('0x35')](_0x4b5353[_0x72bd('0x31')][_0x72bd('0x35')]));_0x150bfb[_0x72bd('0x33')]=_0x150bfb[_0x72bd('0x33')]['length']?_0x150bfb[_0x72bd('0x33')]:_0x2ec50c[_0x72bd('0x30')];_0x150bfb[_0x72bd('0x39')]=qs[_0x72bd('0x3a')](_0x4b5353['query'][_0x72bd('0x3a')]);_0x150bfb[_0x72bd('0x3d')]=qs[_0x72bd('0x32')](_[_0x72bd('0x3b')](_0x4b5353[_0x72bd('0x31')],_0x2ec50c[_0x72bd('0x32')]));if(_0x4b5353['query'][_0x72bd('0x3c')]){_0x150bfb[_0x72bd('0x3d')]=_[_0x72bd('0x3e')](_0x150bfb['where'],{'$or':_['map'](_0x150bfb['attributes'],function(_0x313534){var _0x2b51d5={};_0x2b51d5[_0x313534]={'$like':'%'+_0x4b5353[_0x72bd('0x31')][_0x72bd('0x3c')]+'%'};return _0x2b51d5;})});}_0x150bfb=_[_0x72bd('0x3e')]({},_0x150bfb,_0x4b5353['options']);return _0x474847[_0x72bd('0x4f')](_0x150bfb);}})[_0x72bd('0x25')](function(_0x80fccf){if(_0x80fccf){_0x2300f6=_0x80fccf[_0x72bd('0x36')];if(!_0x4b5353[_0x72bd('0x31')][_0x72bd('0x37')](_0x72bd('0x38'))){_0x150bfb[_0x72bd('0x1f')]=qs[_0x72bd('0x1f')](_0x4b5353[_0x72bd('0x31')][_0x72bd('0x1f')]);_0x150bfb[_0x72bd('0x1d')]=qs[_0x72bd('0x1d')](_0x4b5353[_0x72bd('0x31')][_0x72bd('0x1d')]);}return _0x474847['getDescriptions'](_0x150bfb);}})[_0x72bd('0x25')](function(_0x331408){if(_0x331408){return _0x331408?{'count':_0x2300f6,'rows':_0x331408}:null;}})[_0x72bd('0x25')](respondWithResult(_0x3e04c6,null))[_0x72bd('0x43')](handleError(_0x3e04c6,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 002ea7d..e55526e 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 _0x02df=['request-promise','rimraf','./intSalesforceConfiguration.attributes','define','lodash','moment'];(function(_0x49b8ab,_0x3a24a4){var _0x23998b=function(_0x36cc80){while(--_0x36cc80){_0x49b8ab['push'](_0x49b8ab['shift']());}};_0x23998b(++_0x3a24a4);}(_0x02df,0x112));var _0xf02d=function(_0x571e16,_0x313f07){_0x571e16=_0x571e16-0x0;var _0x84cef5=_0x02df[_0x571e16];return _0x84cef5;};'use strict';var _=require(_0xf02d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf02d('0x1'));var BPromise=require('bluebird');var rp=require(_0xf02d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf02d('0x3'));var config=require('../../config/environment');var attributes=require(_0xf02d('0x4'));module['exports']=function(_0x3a2915,_0x5e899d){return _0x3a2915[_0xf02d('0x5')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fe0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger'];(function(_0x2537f0,_0x55477c){var _0x4eeee=function(_0x1e6a76){while(--_0x1e6a76){_0x2537f0['push'](_0x2537f0['shift']());}};_0x4eeee(++_0x55477c);}(_0x4fe0,0x7c));var _0x04fe=function(_0x4cc58f,_0x464afc){_0x4cc58f=_0x4cc58f-0x0;var _0x224a0c=_0x4fe0[_0x4cc58f];return _0x224a0c;};'use strict';var _=require('lodash');var util=require(_0x04fe('0x0'));var logger=require(_0x04fe('0x1'))(_0x04fe('0x2'));var moment=require(_0x04fe('0x3'));var BPromise=require(_0x04fe('0x4'));var rp=require(_0x04fe('0x5'));var fs=require('fs');var path=require(_0x04fe('0x6'));var rimraf=require(_0x04fe('0x7'));var config=require(_0x04fe('0x8'));var attributes=require(_0x04fe('0x9'));module[_0x04fe('0xa')]=function(_0x1824fa,_0x319d23){return _0x1824fa[_0x04fe('0xb')](_0x04fe('0xc'),attributes,{'tableName':_0x04fe('0xd'),'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 23e6b02..0f4ad3a 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 _0xa61d=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0xe59e1,_0x1a9346){var _0x18fa79=function(_0x2b3a04){while(--_0x2b3a04){_0xe59e1['push'](_0xe59e1['shift']());}};_0x18fa79(++_0x1a9346);}(_0xa61d,0x9b));var _0xda61=function(_0x265cf6,_0x26f1d8){_0x265cf6=_0x265cf6-0x0;var _0x3f2737=_0xa61d[_0x265cf6];return _0x3f2737;};'use strict';var _=require(_0xda61('0x0'));var util=require(_0xda61('0x1'));var moment=require(_0xda61('0x2'));var BPromise=require(_0xda61('0x3'));var rs=require(_0xda61('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda61('0x5'))['db'];var utils=require(_0xda61('0x6'));var logger=require(_0xda61('0x7'))(_0xda61('0x8'));var config=require('../../config/environment');var jayson=require(_0xda61('0x9'));var client=jayson[_0xda61('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe529,_0x5b8a23,_0x3283c6){return new BPromise(function(_0x4a2599,_0x40ca83){return client[_0xda61('0xb')](_0x4fe529,_0x3283c6)[_0xda61('0xc')](function(_0x4e62f2){logger[_0xda61('0xd')](_0xda61('0xe'),_0x5b8a23,_0xda61('0xf'));logger[_0xda61('0x10')](_0xda61('0x11'),_0x5b8a23,_0xda61('0xf'),JSON[_0xda61('0x12')](_0x4e62f2));if(_0x4e62f2[_0xda61('0x13')]){if(_0x4e62f2[_0xda61('0x13')]['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5b8a23,_0x4e62f2[_0xda61('0x13')][_0xda61('0x14')]);return _0x40ca83(_0x4e62f2[_0xda61('0x13')][_0xda61('0x14')]);}logger[_0xda61('0x13')](_0xda61('0xe'),_0x5b8a23,_0x4e62f2[_0xda61('0x13')]['message']);return _0x4a2599(_0x4e62f2[_0xda61('0x13')]['message']);}else{logger[_0xda61('0xd')](_0xda61('0xe'),_0x5b8a23,_0xda61('0xf'));_0x4a2599(_0x4e62f2[_0xda61('0x15')][_0xda61('0x14')]);}})[_0xda61('0x16')](function(_0x4836be){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5b8a23,_0x4836be);_0x40ca83(_0x4836be);});});} \ No newline at end of file +var _0xdef3=['util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x539043,_0x28159a){var _0x561898=function(_0x406611){while(--_0x406611){_0x539043['push'](_0x539043['shift']());}};_0x561898(++_0x28159a);}(_0xdef3,0x164));var _0x3def=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xdef3[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x3def('0x0'));var util=require(_0x3def('0x1'));var moment=require('moment');var BPromise=require(_0x3def('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3def('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3def('0x4'))(_0x3def('0x5'));var config=require(_0x3def('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3def('0x7')][_0x3def('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x569339,_0x48c0a7,_0x91d543){return new BPromise(function(_0x1583e1,_0x423e3a){return client['request'](_0x569339,_0x91d543)[_0x3def('0x9')](function(_0x4ae236){logger[_0x3def('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x48c0a7,_0x3def('0xb'));logger[_0x3def('0xc')](_0x3def('0xd'),_0x48c0a7,_0x3def('0xb'),JSON[_0x3def('0xe')](_0x4ae236));if(_0x4ae236[_0x3def('0xf')]){if(_0x4ae236[_0x3def('0xf')][_0x3def('0x10')]===0x1f4){logger['error'](_0x3def('0x11'),_0x48c0a7,_0x4ae236[_0x3def('0xf')][_0x3def('0x12')]);return _0x423e3a(_0x4ae236[_0x3def('0xf')][_0x3def('0x12')]);}logger[_0x3def('0xf')](_0x3def('0x11'),_0x48c0a7,_0x4ae236['error'][_0x3def('0x12')]);return _0x1583e1(_0x4ae236[_0x3def('0xf')][_0x3def('0x12')]);}else{logger['info'](_0x3def('0x11'),_0x48c0a7,_0x3def('0xb'));_0x1583e1(_0x4ae236[_0x3def('0x13')][_0x3def('0x12')]);}})[_0x3def('0x14')](function(_0x5e9aff){logger[_0x3def('0xf')](_0x3def('0x11'),_0x48c0a7,_0x5e9aff);_0x423e3a(_0x5e9aff);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index bc5ab80..dd68fe3 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 _0x2228=['get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x5b841c,_0x2114b8){var _0x1c2c5c=function(_0x4ae38c){while(--_0x4ae38c){_0x5b841c['push'](_0x5b841c['shift']());}};_0x1c2c5c(++_0x2114b8);}(_0x2228,0x136));var _0x8222=function(_0x424515,_0x45464b){_0x424515=_0x424515-0x0;var _0x164c98=_0x2228[_0x424515];return _0x164c98;};'use strict';var multer=require(_0x8222('0x0'));var util=require(_0x8222('0x1'));var path=require(_0x8222('0x2'));var timeout=require('connect-timeout');var express=require(_0x8222('0x3'));var router=express[_0x8222('0x4')]();var fs_extra=require(_0x8222('0x5'));var auth=require(_0x8222('0x6'));var interaction=require(_0x8222('0x7'));var config=require(_0x8222('0x8'));var controller=require(_0x8222('0x9'));router[_0x8222('0xa')]('/',auth[_0x8222('0xb')](),controller['index']);router[_0x8222('0xa')](_0x8222('0xc'),auth['isAuthenticated'](),controller[_0x8222('0xd')]);router[_0x8222('0xe')]('/',auth[_0x8222('0xb')](),controller['create']);router[_0x8222('0xf')](_0x8222('0xc'),auth[_0x8222('0xb')](),controller[_0x8222('0x10')]);router[_0x8222('0x11')](_0x8222('0xc'),auth['isAuthenticated'](),controller[_0x8222('0x12')]);module[_0x8222('0x13')]=router; \ No newline at end of file +var _0x578c=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x516e60,_0x4e6f44){var _0x450e47=function(_0x4ab3c7){while(--_0x4ab3c7){_0x516e60['push'](_0x516e60['shift']());}};_0x450e47(++_0x4e6f44);}(_0x578c,0x183));var _0xc578=function(_0x69b5ba,_0x19712d){_0x69b5ba=_0x69b5ba-0x0;var _0x7a0e6f=_0x578c[_0x69b5ba];return _0x7a0e6f;};'use strict';var multer=require('multer');var util=require(_0xc578('0x0'));var path=require(_0xc578('0x1'));var timeout=require('connect-timeout');var express=require(_0xc578('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc578('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc578('0x4'));var controller=require(_0xc578('0x5'));router[_0xc578('0x6')]('/',auth[_0xc578('0x7')](),controller[_0xc578('0x8')]);router[_0xc578('0x6')](_0xc578('0x9'),auth[_0xc578('0x7')](),controller[_0xc578('0xa')]);router[_0xc578('0xb')]('/',auth[_0xc578('0x7')](),controller[_0xc578('0xc')]);router[_0xc578('0xd')](_0xc578('0x9'),auth['isAuthenticated'](),controller[_0xc578('0xe')]);router[_0xc578('0xf')](_0xc578('0x9'),auth[_0xc578('0x7')](),controller[_0xc578('0x10')]);module[_0xc578('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b229f29..07ab8a2 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 _0x4cb8=['customVariable','ENUM','variable','keyValue','string','STRING'];(function(_0x3072b9,_0x42b978){var _0x192782=function(_0x424c7f){while(--_0x424c7f){_0x3072b9['push'](_0x3072b9['shift']());}};_0x192782(++_0x42b978);}(_0x4cb8,0x103));var _0x84cb=function(_0x346a7d,_0x5976cf){_0x346a7d=_0x346a7d-0x0;var _0x11f527=_0x4cb8[_0x346a7d];return _0x11f527;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x84cb('0x0')]('string',_0x84cb('0x1'),'customVariable',_0x84cb('0x2'),'picklist'),'defaultValue':_0x84cb('0x3')},'content':{'type':Sequelize[_0x84cb('0x4')]},'key':{'type':Sequelize[_0x84cb('0x4')]},'keyType':{'type':Sequelize[_0x84cb('0x0')](_0x84cb('0x3'),'variable',_0x84cb('0x5'))},'keyContent':{'type':Sequelize[_0x84cb('0x4')]},'idField':{'type':Sequelize[_0x84cb('0x4')]},'variableName':{'type':Sequelize[_0x84cb('0x4')]}}; \ No newline at end of file +var _0xdf25=['STRING','variable','sequelize','exports','ENUM','customVariable','keyValue','picklist','string'];(function(_0x181e0b,_0x275513){var _0x1e6477=function(_0x347a7f){while(--_0x347a7f){_0x181e0b['push'](_0x181e0b['shift']());}};_0x1e6477(++_0x275513);}(_0xdf25,0x89));var _0x5df2=function(_0x17841f,_0x4b0096){_0x17841f=_0x17841f-0x0;var _0xb4cb65=_0xdf25[_0x17841f];return _0xb4cb65;};'use strict';var Sequelize=require(_0x5df2('0x0'));module[_0x5df2('0x1')]={'type':{'type':Sequelize[_0x5df2('0x2')]('string','variable',_0x5df2('0x3'),_0x5df2('0x4'),_0x5df2('0x5')),'defaultValue':_0x5df2('0x6')},'content':{'type':Sequelize[_0x5df2('0x7')]},'key':{'type':Sequelize[_0x5df2('0x7')]},'keyType':{'type':Sequelize[_0x5df2('0x2')](_0x5df2('0x6'),_0x5df2('0x8'),_0x5df2('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5df2('0x7')]},'variableName':{'type':Sequelize[_0x5df2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index edc9e34..3e9549e 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 _0xe4e6=['merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','intersection','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','name','send','index','SalesforceField','rawAttributes','type','model','map','keys','query','filters','attributes','hasOwnProperty','nolimit','sort','where','filter'];(function(_0x1ac039,_0xfd648){var _0x52e541=function(_0x43e963){while(--_0x43e963){_0x1ac039['push'](_0x1ac039['shift']());}};_0x52e541(++_0xfd648);}(_0xe4e6,0xa6));var _0x6e4e=function(_0x1667ad,_0x1e803d){_0x1667ad=_0x1667ad-0x0;var _0x27eafa=_0xe4e6[_0x1667ad];return _0x27eafa;};'use strict';var emlformat=require(_0x6e4e('0x0'));var rimraf=require(_0x6e4e('0x1'));var zipdir=require(_0x6e4e('0x2'));var jsonpatch=require(_0x6e4e('0x3'));var rp=require(_0x6e4e('0x4'));var moment=require(_0x6e4e('0x5'));var BPromise=require(_0x6e4e('0x6'));var Mustache=require('mustache');var util=require(_0x6e4e('0x7'));var path=require('path');var sox=require(_0x6e4e('0x8'));var csv=require('to-csv');var ejs=require(_0x6e4e('0x9'));var fs=require('fs');var fs_extra=require(_0x6e4e('0xa'));var _=require('lodash');var squel=require(_0x6e4e('0xb'));var crypto=require('crypto');var jsforce=require(_0x6e4e('0xc'));var deskjs=require(_0x6e4e('0xd'));var toCsv=require(_0x6e4e('0xe'));var querystring=require(_0x6e4e('0xf'));var Papa=require('papaparse');var Redis=require(_0x6e4e('0x10'));var authService=require(_0x6e4e('0x11'));var qs=require(_0x6e4e('0x12'));var as=require(_0x6e4e('0x13'));var hardwareService=require(_0x6e4e('0x14'));var logger=require(_0x6e4e('0x15'))(_0x6e4e('0x16'));var utils=require(_0x6e4e('0x17'));var config=require(_0x6e4e('0x18'));var licenseUtil=require(_0x6e4e('0x19'));var db=require(_0x6e4e('0x1a'))['db'];function respondWithStatusCode(_0x56de56,_0x1ca47b){_0x1ca47b=_0x1ca47b||0xcc;return function(_0x3b829a){if(_0x3b829a){return _0x56de56[_0x6e4e('0x1b')](_0x1ca47b);}return _0x56de56[_0x6e4e('0x1c')](_0x1ca47b)[_0x6e4e('0x1d')]();};}function respondWithResult(_0x1eb463,_0x48b766){_0x48b766=_0x48b766||0xc8;return function(_0x26ee17){if(_0x26ee17){return _0x1eb463[_0x6e4e('0x1c')](_0x48b766)[_0x6e4e('0x1e')](_0x26ee17);}};}function respondWithFilteredResult(_0x47a2a5,_0x438d59){return function(_0x599bad){if(_0x599bad){var _0x41fc25=typeof _0x438d59[_0x6e4e('0x1f')]===_0x6e4e('0x20')&&typeof _0x438d59[_0x6e4e('0x21')]===_0x6e4e('0x20');var _0x38090b=_0x599bad[_0x6e4e('0x22')];var _0x3abcd7=_0x41fc25?0x0:_0x438d59[_0x6e4e('0x1f')];var _0x1c9d59=_0x41fc25?_0x599bad[_0x6e4e('0x22')]:_0x438d59[_0x6e4e('0x1f')]+_0x438d59[_0x6e4e('0x21')];var _0x26068a;if(_0x1c9d59>=_0x38090b){_0x1c9d59=_0x38090b;_0x26068a=0xc8;}else{_0x26068a=0xce;}_0x47a2a5[_0x6e4e('0x1c')](_0x26068a);return _0x47a2a5[_0x6e4e('0x23')](_0x6e4e('0x24'),_0x3abcd7+'-'+_0x1c9d59+'/'+_0x38090b)['json'](_0x599bad);}return null;};}function patchUpdates(_0x537291){return function(_0x3437e0){try{jsonpatch[_0x6e4e('0x25')](_0x3437e0,_0x537291,!![]);}catch(_0x4bba2a){return BPromise['reject'](_0x4bba2a);}return _0x3437e0[_0x6e4e('0x26')]();};}function saveUpdates(_0x17298e,_0x1a74c6){return function(_0x326397){if(_0x326397){return _0x326397[_0x6e4e('0x27')](_0x17298e)['then'](function(_0x3ac7b9){return _0x3ac7b9;});}return null;};}function removeEntity(_0x44413c,_0xc13497){return function(_0x2069a5){if(_0x2069a5){return _0x2069a5[_0x6e4e('0x28')]()['then'](function(){_0x44413c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1970e7,_0x45ec8f){return function(_0x151c38){if(!_0x151c38){_0x1970e7['sendStatus'](0x194);}return _0x151c38;};}function handleError(_0x4d486d,_0x5e1e97){_0x5e1e97=_0x5e1e97||0x1f4;return function(_0x554800){logger[_0x6e4e('0x29')](_0x554800['stack']);if(_0x554800[_0x6e4e('0x2a')]){delete _0x554800['name'];}_0x4d486d[_0x6e4e('0x1c')](_0x5e1e97)[_0x6e4e('0x2b')](_0x554800);};}exports[_0x6e4e('0x2c')]=function(_0x27178c,_0x3e369e){var _0x3bd5c3={},_0x428551={},_0x51e17a={'count':0x0,'rows':[]};var _0x47d4c7=_['map'](db[_0x6e4e('0x2d')][_0x6e4e('0x2e')],function(_0x221996){return{'name':_0x221996['fieldName'],'type':_0x221996[_0x6e4e('0x2f')]['key']};});_0x428551[_0x6e4e('0x30')]=_[_0x6e4e('0x31')](_0x47d4c7,_0x6e4e('0x2a'));_0x428551['query']=_[_0x6e4e('0x32')](_0x27178c[_0x6e4e('0x33')]);_0x428551[_0x6e4e('0x34')]=_['intersection'](_0x428551[_0x6e4e('0x30')],_0x428551['query']);_0x3bd5c3['attributes']=_['intersection'](_0x428551[_0x6e4e('0x30')],qs['fields'](_0x27178c[_0x6e4e('0x33')]['fields']));_0x3bd5c3[_0x6e4e('0x35')]=_0x3bd5c3[_0x6e4e('0x35')]['length']?_0x3bd5c3[_0x6e4e('0x35')]:_0x428551['model'];if(!_0x27178c['query'][_0x6e4e('0x36')](_0x6e4e('0x37'))){_0x3bd5c3[_0x6e4e('0x21')]=qs[_0x6e4e('0x21')](_0x27178c['query'][_0x6e4e('0x21')]);_0x3bd5c3[_0x6e4e('0x1f')]=qs[_0x6e4e('0x1f')](_0x27178c[_0x6e4e('0x33')][_0x6e4e('0x1f')]);}_0x3bd5c3['order']=qs[_0x6e4e('0x38')](_0x27178c[_0x6e4e('0x33')][_0x6e4e('0x38')]);_0x3bd5c3[_0x6e4e('0x39')]=qs[_0x6e4e('0x34')](_['pick'](_0x27178c[_0x6e4e('0x33')],_0x428551[_0x6e4e('0x34')]),_0x47d4c7);if(_0x27178c[_0x6e4e('0x33')][_0x6e4e('0x3a')]){_0x3bd5c3[_0x6e4e('0x39')]=_[_0x6e4e('0x3b')](_0x3bd5c3[_0x6e4e('0x39')],{'$or':_[_0x6e4e('0x31')](_0x47d4c7,function(_0x5cdcb1){if(_0x5cdcb1[_0x6e4e('0x2f')]!==_0x6e4e('0x3c')){var _0x217c81={};_0x217c81[_0x5cdcb1[_0x6e4e('0x2a')]]={'$like':'%'+_0x27178c[_0x6e4e('0x33')]['filter']+'%'};return _0x217c81;}})});}_0x3bd5c3=_[_0x6e4e('0x3b')]({},_0x3bd5c3,_0x27178c[_0x6e4e('0x3d')]);var _0x3cfc0c={'where':_0x3bd5c3['where']};return db['SalesforceField'][_0x6e4e('0x22')](_0x3cfc0c)[_0x6e4e('0x3e')](function(_0xe48c6e){_0x51e17a[_0x6e4e('0x22')]=_0xe48c6e;if(_0x27178c[_0x6e4e('0x33')][_0x6e4e('0x3f')]){_0x3bd5c3[_0x6e4e('0x40')]=[{'all':!![]}];}return db[_0x6e4e('0x2d')][_0x6e4e('0x41')](_0x3bd5c3);})['then'](function(_0x153e77){_0x51e17a[_0x6e4e('0x42')]=_0x153e77;return _0x51e17a;})['then'](respondWithFilteredResult(_0x3e369e,_0x3bd5c3))[_0x6e4e('0x43')](handleError(_0x3e369e,null));};exports[_0x6e4e('0x44')]=function(_0x5bcec9,_0xd955d7){var _0x389f60={'raw':!![],'where':{'id':_0x5bcec9[_0x6e4e('0x45')]['id']}},_0x4b9ff0={};_0x4b9ff0[_0x6e4e('0x30')]=_[_0x6e4e('0x32')](db[_0x6e4e('0x2d')][_0x6e4e('0x2e')]);_0x4b9ff0[_0x6e4e('0x33')]=_[_0x6e4e('0x32')](_0x5bcec9[_0x6e4e('0x33')]);_0x4b9ff0['filters']=_[_0x6e4e('0x46')](_0x4b9ff0[_0x6e4e('0x30')],_0x4b9ff0[_0x6e4e('0x33')]);_0x389f60[_0x6e4e('0x35')]=_[_0x6e4e('0x46')](_0x4b9ff0[_0x6e4e('0x30')],qs[_0x6e4e('0x47')](_0x5bcec9['query'][_0x6e4e('0x47')]));_0x389f60[_0x6e4e('0x35')]=_0x389f60['attributes']['length']?_0x389f60[_0x6e4e('0x35')]:_0x4b9ff0[_0x6e4e('0x30')];if(_0x5bcec9[_0x6e4e('0x33')][_0x6e4e('0x3f')]){_0x389f60['include']=[{'all':!![]}];}_0x389f60=_[_0x6e4e('0x3b')]({},_0x389f60,_0x5bcec9[_0x6e4e('0x3d')]);return db[_0x6e4e('0x2d')][_0x6e4e('0x48')](_0x389f60)['then'](handleEntityNotFound(_0xd955d7,null))[_0x6e4e('0x3e')](respondWithResult(_0xd955d7,null))[_0x6e4e('0x43')](handleError(_0xd955d7,null));};exports[_0x6e4e('0x49')]=function(_0x37cb58,_0x42dc4d){return db['SalesforceField'][_0x6e4e('0x49')](_0x37cb58['body'],{})[_0x6e4e('0x3e')](respondWithResult(_0x42dc4d,0xc9))['catch'](handleError(_0x42dc4d,null));};exports[_0x6e4e('0x27')]=function(_0x5beb81,_0x45f650){if(_0x5beb81[_0x6e4e('0x4a')]['id']){delete _0x5beb81[_0x6e4e('0x4a')]['id'];}return db[_0x6e4e('0x2d')][_0x6e4e('0x48')]({'where':{'id':_0x5beb81[_0x6e4e('0x45')]['id']}})[_0x6e4e('0x3e')](handleEntityNotFound(_0x45f650,null))[_0x6e4e('0x3e')](saveUpdates(_0x5beb81[_0x6e4e('0x4a')],null))[_0x6e4e('0x3e')](respondWithResult(_0x45f650,null))[_0x6e4e('0x43')](handleError(_0x45f650,null));};exports[_0x6e4e('0x28')]=function(_0x4dc704,_0x1ee0a1){return db[_0x6e4e('0x2d')][_0x6e4e('0x48')]({'where':{'id':_0x4dc704['params']['id']}})[_0x6e4e('0x3e')](handleEntityNotFound(_0x1ee0a1,null))[_0x6e4e('0x3e')](removeEntity(_0x1ee0a1,null))[_0x6e4e('0x43')](handleError(_0x1ee0a1,null));}; \ No newline at end of file +var _0x1459=['to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','offset','undefined','count','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','map','SalesforceField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','includeAll','include','rows','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','squel','crypto','jsforce'];(function(_0x3179aa,_0x401bb9){var _0x1ec310=function(_0x5442f6){while(--_0x5442f6){_0x3179aa['push'](_0x3179aa['shift']());}};_0x1ec310(++_0x401bb9);}(_0x1459,0xfc));var _0x9145=function(_0x1a3009,_0x193595){_0x1a3009=_0x1a3009-0x0;var _0xe92722=_0x1459[_0x1a3009];return _0xe92722;};'use strict';var emlformat=require(_0x9145('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9145('0x1'));var jsonpatch=require(_0x9145('0x2'));var rp=require(_0x9145('0x3'));var moment=require(_0x9145('0x4'));var BPromise=require(_0x9145('0x5'));var Mustache=require(_0x9145('0x6'));var util=require('util');var path=require(_0x9145('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9145('0x8'));var _=require('lodash');var squel=require(_0x9145('0x9'));var crypto=require(_0x9145('0xa'));var jsforce=require(_0x9145('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9145('0xc'));var querystring=require(_0x9145('0xd'));var Papa=require(_0x9145('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9145('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9145('0x10'));var logger=require(_0x9145('0x11'))(_0x9145('0x12'));var utils=require(_0x9145('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9145('0x14'));var db=require(_0x9145('0x15'))['db'];function respondWithStatusCode(_0x3c5003,_0x2d9603){_0x2d9603=_0x2d9603||0xcc;return function(_0x29a845){if(_0x29a845){return _0x3c5003['sendStatus'](_0x2d9603);}return _0x3c5003['status'](_0x2d9603)['end']();};}function respondWithResult(_0x48b4dd,_0x884528){_0x884528=_0x884528||0xc8;return function(_0x19b473){if(_0x19b473){return _0x48b4dd['status'](_0x884528)['json'](_0x19b473);}};}function respondWithFilteredResult(_0x44e2e3,_0x113f07){return function(_0x1cdae5){if(_0x1cdae5){var _0x5a58f1=typeof _0x113f07[_0x9145('0x16')]===_0x9145('0x17')&&typeof _0x113f07['limit']===_0x9145('0x17');var _0x55e445=_0x1cdae5[_0x9145('0x18')];var _0x20eb1b=_0x5a58f1?0x0:_0x113f07[_0x9145('0x16')];var _0x5b2f79=_0x5a58f1?_0x1cdae5[_0x9145('0x18')]:_0x113f07[_0x9145('0x16')]+_0x113f07[_0x9145('0x19')];var _0x8968d3;if(_0x5b2f79>=_0x55e445){_0x5b2f79=_0x55e445;_0x8968d3=0xc8;}else{_0x8968d3=0xce;}_0x44e2e3[_0x9145('0x1a')](_0x8968d3);return _0x44e2e3[_0x9145('0x1b')](_0x9145('0x1c'),_0x20eb1b+'-'+_0x5b2f79+'/'+_0x55e445)['json'](_0x1cdae5);}return null;};}function patchUpdates(_0x21bddc){return function(_0x37f830){try{jsonpatch[_0x9145('0x1d')](_0x37f830,_0x21bddc,!![]);}catch(_0x2a9241){return BPromise[_0x9145('0x1e')](_0x2a9241);}return _0x37f830['save']();};}function saveUpdates(_0xfad1eb,_0x36cab8){return function(_0x251124){if(_0x251124){return _0x251124[_0x9145('0x1f')](_0xfad1eb)[_0x9145('0x20')](function(_0x1b4f33){return _0x1b4f33;});}return null;};}function removeEntity(_0x5cefc0,_0x306cf8){return function(_0x4275ae){if(_0x4275ae){return _0x4275ae[_0x9145('0x21')]()[_0x9145('0x20')](function(){_0x5cefc0[_0x9145('0x1a')](0xcc)[_0x9145('0x22')]();});}};}function handleEntityNotFound(_0x19ee08,_0x2b2950){return function(_0x374540){if(!_0x374540){_0x19ee08[_0x9145('0x23')](0x194);}return _0x374540;};}function handleError(_0x45e04f,_0xce8fb7){_0xce8fb7=_0xce8fb7||0x1f4;return function(_0x4a355d){logger[_0x9145('0x24')](_0x4a355d['stack']);if(_0x4a355d[_0x9145('0x25')]){delete _0x4a355d[_0x9145('0x25')];}_0x45e04f['status'](_0xce8fb7)[_0x9145('0x26')](_0x4a355d);};}exports['index']=function(_0x1c76c4,_0x2331c0){var _0x2cb8ae={},_0x3b49a9={},_0x14bc4c={'count':0x0,'rows':[]};var _0x1dcb89=_[_0x9145('0x27')](db[_0x9145('0x28')][_0x9145('0x29')],function(_0x3b537c){return{'name':_0x3b537c['fieldName'],'type':_0x3b537c[_0x9145('0x2a')][_0x9145('0x2b')]};});_0x3b49a9[_0x9145('0x2c')]=_['map'](_0x1dcb89,'name');_0x3b49a9[_0x9145('0x2d')]=_[_0x9145('0x2e')](_0x1c76c4['query']);_0x3b49a9[_0x9145('0x2f')]=_[_0x9145('0x30')](_0x3b49a9[_0x9145('0x2c')],_0x3b49a9[_0x9145('0x2d')]);_0x2cb8ae[_0x9145('0x31')]=_[_0x9145('0x30')](_0x3b49a9[_0x9145('0x2c')],qs['fields'](_0x1c76c4['query'][_0x9145('0x32')]));_0x2cb8ae[_0x9145('0x31')]=_0x2cb8ae[_0x9145('0x31')][_0x9145('0x33')]?_0x2cb8ae[_0x9145('0x31')]:_0x3b49a9[_0x9145('0x2c')];if(!_0x1c76c4[_0x9145('0x2d')]['hasOwnProperty']('nolimit')){_0x2cb8ae[_0x9145('0x19')]=qs[_0x9145('0x19')](_0x1c76c4[_0x9145('0x2d')]['limit']);_0x2cb8ae[_0x9145('0x16')]=qs['offset'](_0x1c76c4[_0x9145('0x2d')][_0x9145('0x16')]);}_0x2cb8ae[_0x9145('0x34')]=qs[_0x9145('0x35')](_0x1c76c4[_0x9145('0x2d')][_0x9145('0x35')]);_0x2cb8ae[_0x9145('0x36')]=qs[_0x9145('0x2f')](_['pick'](_0x1c76c4['query'],_0x3b49a9['filters']),_0x1dcb89);if(_0x1c76c4[_0x9145('0x2d')][_0x9145('0x37')]){_0x2cb8ae['where']=_['merge'](_0x2cb8ae['where'],{'$or':_['map'](_0x1dcb89,function(_0x29dc11){if(_0x29dc11['type']!=='VIRTUAL'){var _0x27009d={};_0x27009d[_0x29dc11['name']]={'$like':'%'+_0x1c76c4[_0x9145('0x2d')]['filter']+'%'};return _0x27009d;}})});}_0x2cb8ae=_[_0x9145('0x38')]({},_0x2cb8ae,_0x1c76c4[_0x9145('0x39')]);var _0x3dc577={'where':_0x2cb8ae[_0x9145('0x36')]};return db[_0x9145('0x28')][_0x9145('0x18')](_0x3dc577)[_0x9145('0x20')](function(_0x460812){_0x14bc4c['count']=_0x460812;if(_0x1c76c4[_0x9145('0x2d')][_0x9145('0x3a')]){_0x2cb8ae[_0x9145('0x3b')]=[{'all':!![]}];}return db[_0x9145('0x28')]['findAll'](_0x2cb8ae);})[_0x9145('0x20')](function(_0x476b9a){_0x14bc4c[_0x9145('0x3c')]=_0x476b9a;return _0x14bc4c;})['then'](respondWithFilteredResult(_0x2331c0,_0x2cb8ae))['catch'](handleError(_0x2331c0,null));};exports['show']=function(_0x500f98,_0x2e326e){var _0x534fd6={'raw':!![],'where':{'id':_0x500f98['params']['id']}},_0x39e853={};_0x39e853[_0x9145('0x2c')]=_[_0x9145('0x2e')](db['SalesforceField'][_0x9145('0x29')]);_0x39e853[_0x9145('0x2d')]=_['keys'](_0x500f98[_0x9145('0x2d')]);_0x39e853[_0x9145('0x2f')]=_[_0x9145('0x30')](_0x39e853[_0x9145('0x2c')],_0x39e853['query']);_0x534fd6['attributes']=_[_0x9145('0x30')](_0x39e853[_0x9145('0x2c')],qs['fields'](_0x500f98[_0x9145('0x2d')][_0x9145('0x32')]));_0x534fd6[_0x9145('0x31')]=_0x534fd6[_0x9145('0x31')][_0x9145('0x33')]?_0x534fd6[_0x9145('0x31')]:_0x39e853[_0x9145('0x2c')];if(_0x500f98[_0x9145('0x2d')][_0x9145('0x3a')]){_0x534fd6[_0x9145('0x3b')]=[{'all':!![]}];}_0x534fd6=_[_0x9145('0x38')]({},_0x534fd6,_0x500f98[_0x9145('0x39')]);return db['SalesforceField'][_0x9145('0x3d')](_0x534fd6)[_0x9145('0x20')](handleEntityNotFound(_0x2e326e,null))[_0x9145('0x20')](respondWithResult(_0x2e326e,null))[_0x9145('0x3e')](handleError(_0x2e326e,null));};exports[_0x9145('0x3f')]=function(_0x433caa,_0x2a9972){return db['SalesforceField'][_0x9145('0x3f')](_0x433caa['body'],{})[_0x9145('0x20')](respondWithResult(_0x2a9972,0xc9))[_0x9145('0x3e')](handleError(_0x2a9972,null));};exports['update']=function(_0x1f46db,_0x4b9846){if(_0x1f46db['body']['id']){delete _0x1f46db[_0x9145('0x40')]['id'];}return db[_0x9145('0x28')][_0x9145('0x3d')]({'where':{'id':_0x1f46db[_0x9145('0x41')]['id']}})[_0x9145('0x20')](handleEntityNotFound(_0x4b9846,null))[_0x9145('0x20')](saveUpdates(_0x1f46db[_0x9145('0x40')],null))['then'](respondWithResult(_0x4b9846,null))['catch'](handleError(_0x4b9846,null));};exports[_0x9145('0x21')]=function(_0x10c2d7,_0x23e4f2){return db[_0x9145('0x28')][_0x9145('0x3d')]({'where':{'id':_0x10c2d7[_0x9145('0x41')]['id']}})[_0x9145('0x20')](handleEntityNotFound(_0x23e4f2,null))[_0x9145('0x20')](removeEntity(_0x23e4f2,null))[_0x9145('0x3e')](handleError(_0x23e4f2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index db8eee2..0da352a 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 _0x6d34=['moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x290334,_0xfdc527){var _0x22e33=function(_0x519bac){while(--_0x519bac){_0x290334['push'](_0x290334['shift']());}};_0x22e33(++_0xfdc527);}(_0x6d34,0x15a));var _0x46d3=function(_0x7aa661,_0x3c423a){_0x7aa661=_0x7aa661-0x0;var _0x1350bd=_0x6d34[_0x7aa661];return _0x1350bd;};'use strict';var _=require(_0x46d3('0x0'));var util=require(_0x46d3('0x1'));var logger=require(_0x46d3('0x2'))(_0x46d3('0x3'));var moment=require(_0x46d3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x46d3('0x5'));var rimraf=require(_0x46d3('0x6'));var config=require(_0x46d3('0x7'));var attributes=require(_0x46d3('0x8'));module[_0x46d3('0x9')]=function(_0x132374,_0x2fd6e7){return _0x132374[_0x46d3('0xa')](_0x46d3('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x46d3('0xc'),'fields':[_0x46d3('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d3f=['SalesforceField','salesforce_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x6d3f,0x92));var _0xf6d3=function(_0x1340ea,_0x46584b){_0x1340ea=_0x1340ea-0x0;var _0x5dfb88=_0x6d3f[_0x1340ea];return _0x5dfb88;};'use strict';var _=require(_0xf6d3('0x0'));var util=require('util');var logger=require(_0xf6d3('0x1'))(_0xf6d3('0x2'));var moment=require(_0xf6d3('0x3'));var BPromise=require(_0xf6d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6d3('0x5'));var rimraf=require(_0xf6d3('0x6'));var config=require(_0xf6d3('0x7'));var attributes=require(_0xf6d3('0x8'));module[_0xf6d3('0x9')]=function(_0x805d47,_0x2e3790){return _0x805d47['define'](_0xf6d3('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xf6d3('0xb'),'fields':[_0xf6d3('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 7716012..cf135cc 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 _0xcdf4=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x337e2b,_0x222806){var _0x31a150=function(_0x5ac4dd){while(--_0x5ac4dd){_0x337e2b['push'](_0x337e2b['shift']());}};_0x31a150(++_0x222806);}(_0xcdf4,0x1cf));var _0x4cdf=function(_0x4844ba,_0x73b99d){_0x4844ba=_0x4844ba-0x0;var _0x529a9f=_0xcdf4[_0x4844ba];return _0x529a9f;};'use strict';var _=require(_0x4cdf('0x0'));var util=require('util');var moment=require(_0x4cdf('0x1'));var BPromise=require(_0x4cdf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cdf('0x3'));var db=require(_0x4cdf('0x4'))['db'];var utils=require(_0x4cdf('0x5'));var logger=require('../../config/logger')(_0x4cdf('0x6'));var config=require('../../config/environment');var jayson=require(_0x4cdf('0x7'));var client=jayson[_0x4cdf('0x8')][_0x4cdf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33ac6c,_0x2ca8b9,_0x1c0661){return new BPromise(function(_0x341aec,_0xce24d1){return client[_0x4cdf('0xa')](_0x33ac6c,_0x1c0661)['then'](function(_0x57e4af){logger[_0x4cdf('0xb')](_0x4cdf('0xc'),_0x2ca8b9,_0x4cdf('0xd'));logger[_0x4cdf('0xe')](_0x4cdf('0xf'),_0x2ca8b9,'request\x20sent',JSON[_0x4cdf('0x10')](_0x57e4af));if(_0x57e4af[_0x4cdf('0x11')]){if(_0x57e4af[_0x4cdf('0x11')][_0x4cdf('0x12')]===0x1f4){logger[_0x4cdf('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2ca8b9,_0x57e4af[_0x4cdf('0x11')][_0x4cdf('0x13')]);return _0xce24d1(_0x57e4af[_0x4cdf('0x11')]['message']);}logger[_0x4cdf('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2ca8b9,_0x57e4af[_0x4cdf('0x11')]['message']);return _0x341aec(_0x57e4af[_0x4cdf('0x11')]['message']);}else{logger[_0x4cdf('0xb')](_0x4cdf('0xc'),_0x2ca8b9,_0x4cdf('0xd'));_0x341aec(_0x57e4af[_0x4cdf('0x14')][_0x4cdf('0x13')]);}})[_0x4cdf('0x15')](function(_0x46e6bd){logger[_0x4cdf('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2ca8b9,_0x46e6bd);_0xce24d1(_0x46e6bd);});});} \ No newline at end of file +var _0x6df8=['../../config/logger','rpc','jayson/promise','client','then','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','result','lodash','../../mysqldb','../../config/utils'];(function(_0x1ff527,_0x54b6d2){var _0x51cc75=function(_0x4168e5){while(--_0x4168e5){_0x1ff527['push'](_0x1ff527['shift']());}};_0x51cc75(++_0x54b6d2);}(_0x6df8,0x1bf));var _0x86df=function(_0x5dea03,_0x5edc15){_0x5dea03=_0x5dea03-0x0;var _0x18a82d=_0x6df8[_0x5dea03];return _0x18a82d;};'use strict';var _=require(_0x86df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86df('0x1'))['db'];var utils=require(_0x86df('0x2'));var logger=require(_0x86df('0x3'))(_0x86df('0x4'));var config=require('../../config/environment');var jayson=require(_0x86df('0x5'));var client=jayson[_0x86df('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e56da,_0x157d10,_0x43b444){return new BPromise(function(_0x440d57,_0x5f308c){return client['request'](_0x1e56da,_0x43b444)[_0x86df('0x7')](function(_0x18b2cf){logger['info']('SalesforceField,\x20%s,\x20%s',_0x157d10,_0x86df('0x8'));logger[_0x86df('0x9')](_0x86df('0xa'),_0x157d10,_0x86df('0x8'),JSON[_0x86df('0xb')](_0x18b2cf));if(_0x18b2cf[_0x86df('0xc')]){if(_0x18b2cf[_0x86df('0xc')][_0x86df('0xd')]===0x1f4){logger[_0x86df('0xc')](_0x86df('0xe'),_0x157d10,_0x18b2cf['error']['message']);return _0x5f308c(_0x18b2cf[_0x86df('0xc')][_0x86df('0xf')]);}logger[_0x86df('0xc')](_0x86df('0xe'),_0x157d10,_0x18b2cf['error'][_0x86df('0xf')]);return _0x440d57(_0x18b2cf[_0x86df('0xc')][_0x86df('0xf')]);}else{logger[_0x86df('0x10')]('SalesforceField,\x20%s,\x20%s',_0x157d10,_0x86df('0x8'));_0x440d57(_0x18b2cf[_0x86df('0x11')][_0x86df('0xf')]);}})['catch'](function(_0x1f4eda){logger['error'](_0x86df('0xe'),_0x157d10,_0x1f4eda);_0x5f308c(_0x1f4eda);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index cebd5e9..bb9023d 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 _0xacc5=['/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations'];(function(_0x3d70e9,_0x272b11){var _0x208dc9=function(_0x37e614){while(--_0x37e614){_0x3d70e9['push'](_0x3d70e9['shift']());}};_0x208dc9(++_0x272b11);}(_0xacc5,0x104));var _0x5acc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xacc5[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x5acc('0x0'));var util=require(_0x5acc('0x1'));var path=require(_0x5acc('0x2'));var timeout=require(_0x5acc('0x3'));var express=require('express');var router=express[_0x5acc('0x4')]();var fs_extra=require(_0x5acc('0x5'));var auth=require(_0x5acc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x5acc('0x7')](),controller['index']);router[_0x5acc('0x8')](_0x5acc('0x9'),auth['isAuthenticated'](),controller[_0x5acc('0xa')]);router['get'](_0x5acc('0xb'),auth['isAuthenticated'](),controller[_0x5acc('0xc')]);router[_0x5acc('0x8')](_0x5acc('0xd'),auth[_0x5acc('0x7')](),controller[_0x5acc('0xe')]);router[_0x5acc('0xf')]('/',auth[_0x5acc('0x7')](),controller[_0x5acc('0x10')]);router[_0x5acc('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5acc('0x11')]);router[_0x5acc('0x12')](_0x5acc('0x9'),auth['isAuthenticated'](),controller[_0x5acc('0x13')]);router[_0x5acc('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa79e=['post','create','/:id/configurations','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields'];(function(_0x5ed0d9,_0x3f1752){var _0x523f89=function(_0x32a3c8){while(--_0x32a3c8){_0x5ed0d9['push'](_0x5ed0d9['shift']());}};_0x523f89(++_0x3f1752);}(_0xa79e,0xf7));var _0xea79=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0xa79e[_0x26b8b5];return _0x2150a9;};'use strict';var multer=require(_0xea79('0x0'));var util=require('util');var path=require(_0xea79('0x1'));var timeout=require(_0xea79('0x2'));var express=require(_0xea79('0x3'));var router=express[_0xea79('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xea79('0x5'));var config=require(_0xea79('0x6'));var controller=require('./intServicenowAccount.controller');router[_0xea79('0x7')]('/',auth[_0xea79('0x8')](),controller['index']);router[_0xea79('0x7')](_0xea79('0x9'),auth[_0xea79('0x8')](),controller['show']);router['get']('/:id/configurations',auth[_0xea79('0x8')](),controller[_0xea79('0xa')]);router['get'](_0xea79('0xb'),auth[_0xea79('0x8')](),controller[_0xea79('0xc')]);router[_0xea79('0xd')]('/',auth['isAuthenticated'](),controller[_0xea79('0xe')]);router[_0xea79('0xd')](_0xea79('0xf'),auth[_0xea79('0x8')](),controller['addConfiguration']);router[_0xea79('0x10')]('/:id',auth[_0xea79('0x8')](),controller[_0xea79('0x11')]);router[_0xea79('0x12')]('/:id',auth[_0xea79('0x8')](),controller[_0xea79('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 2c47591..73b95af 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 _0xda41=['remoteUri','sequelize','exports','STRING'];(function(_0x2a8762,_0x1acc08){var _0x1d4181=function(_0x3902ed){while(--_0x3902ed){_0x2a8762['push'](_0x2a8762['shift']());}};_0x1d4181(++_0x1acc08);}(_0xda41,0x191));var _0x1da4=function(_0x5da82e,_0x2cf875){_0x5da82e=_0x5da82e-0x0;var _0x49a714=_0xda41[_0x5da82e];return _0x49a714;};'use strict';var Sequelize=require(_0x1da4('0x0'));module[_0x1da4('0x1')]={'name':{'type':Sequelize[_0x1da4('0x2')]},'description':{'type':Sequelize[_0x1da4('0x2')]},'username':{'type':Sequelize[_0x1da4('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x1da4('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1da4('0x2')],'unique':_0x1da4('0x3')},'serverUrl':{'type':Sequelize[_0x1da4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc007=['username','exports','STRING'];(function(_0xf2736d,_0x570d6f){var _0x469510=function(_0x39e99e){while(--_0x39e99e){_0xf2736d['push'](_0xf2736d['shift']());}};_0x469510(++_0x570d6f);}(_0xc007,0x148));var _0x7c00=function(_0x365560,_0x270c22){_0x365560=_0x365560-0x0;var _0x188071=_0xc007[_0x365560];return _0x188071;};'use strict';var Sequelize=require('sequelize');module[_0x7c00('0x0')]={'name':{'type':Sequelize[_0x7c00('0x1')]},'description':{'type':Sequelize[_0x7c00('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x7c00('0x2')},'password':{'type':Sequelize[_0x7c00('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7c00('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index c068318..eea02ce 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 _0x9991=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','reject','save','destroy','then','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','ServicenowConfiguration','sort','pick','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','close_code','notify','incident_state','severity','category','caused_by','upon_reject','sys_updated_on','child_incidents','hold_reason','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','caller_id','approval_set','subcategory','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','password','email','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','username','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','internalType','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','label','concat','ServiceNow\x20error:\x20','test','statusCode','error','stack','boolean','True','true','false','zip-dir','fast-json-patch','request-promise'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x9991,0xb2));var _0x1999=function(_0x1e2c40,_0x1a71eb){_0x1e2c40=_0x1e2c40-0x0;var _0x39dd69=_0x9991[_0x1e2c40];return _0x39dd69;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1999('0x0'));var jsonpatch=require(_0x1999('0x1'));var rp=require(_0x1999('0x2'));var moment=require('moment');var BPromise=require(_0x1999('0x3'));var Mustache=require(_0x1999('0x4'));var util=require(_0x1999('0x5'));var path=require(_0x1999('0x6'));var sox=require(_0x1999('0x7'));var csv=require(_0x1999('0x8'));var ejs=require(_0x1999('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1999('0xa'));var squel=require('squel');var crypto=require(_0x1999('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1999('0xc'));var toCsv=require(_0x1999('0x8'));var querystring=require(_0x1999('0xd'));var Papa=require('papaparse');var Redis=require(_0x1999('0xe'));var authService=require(_0x1999('0xf'));var qs=require(_0x1999('0x10'));var as=require(_0x1999('0x11'));var hardwareService=require(_0x1999('0x12'));var logger=require('../../config/logger')(_0x1999('0x13'));var utils=require('../../config/utils');var config=require(_0x1999('0x14'));var licenseUtil=require(_0x1999('0x15'));var db=require(_0x1999('0x16'))['db'];var integrations=require(_0x1999('0x17'));function respondWithStatusCode(_0x2199c8,_0x445a9e){_0x445a9e=_0x445a9e||0xcc;return function(_0x9157da){if(_0x9157da){return _0x2199c8[_0x1999('0x18')](_0x445a9e);}return _0x2199c8[_0x1999('0x19')](_0x445a9e)[_0x1999('0x1a')]();};}function respondWithResult(_0xa500b7,_0x20a702){_0x20a702=_0x20a702||0xc8;return function(_0x12803a){if(_0x12803a){return _0xa500b7[_0x1999('0x19')](_0x20a702)[_0x1999('0x1b')](_0x12803a);}};}function respondWithFilteredResult(_0x58f9b1,_0x49e712){return function(_0x69cee2){if(_0x69cee2){var _0x25c9d4=typeof _0x49e712[_0x1999('0x1c')]===_0x1999('0x1d')&&typeof _0x49e712['limit']===_0x1999('0x1d');var _0x1561f0=_0x69cee2[_0x1999('0x1e')];var _0x2e9df2=_0x25c9d4?0x0:_0x49e712[_0x1999('0x1c')];var _0x557871=_0x25c9d4?_0x69cee2[_0x1999('0x1e')]:_0x49e712['offset']+_0x49e712['limit'];var _0x57123f;if(_0x557871>=_0x1561f0){_0x557871=_0x1561f0;_0x57123f=0xc8;}else{_0x57123f=0xce;}_0x58f9b1[_0x1999('0x19')](_0x57123f);return _0x58f9b1[_0x1999('0x1f')]('Content-Range',_0x2e9df2+'-'+_0x557871+'/'+_0x1561f0)[_0x1999('0x1b')](_0x69cee2);}return null;};}function patchUpdates(_0x13bae2){return function(_0x4ae1f7){try{jsonpatch['apply'](_0x4ae1f7,_0x13bae2,!![]);}catch(_0x38db8f){return BPromise[_0x1999('0x20')](_0x38db8f);}return _0x4ae1f7[_0x1999('0x21')]();};}function saveUpdates(_0x32dfa6,_0x57adc8){return function(_0x2c8275){if(_0x2c8275){return _0x2c8275['update'](_0x32dfa6)['then'](function(_0x12890d){return _0x12890d;});}return null;};}function removeEntity(_0x1c4d0d,_0x33000a){return function(_0x3bb849){if(_0x3bb849){return _0x3bb849[_0x1999('0x22')]()[_0x1999('0x23')](function(){_0x1c4d0d['status'](0xcc)[_0x1999('0x1a')]();});}};}function handleEntityNotFound(_0x1a4f3f,_0x18f409){return function(_0x5f08e8){if(!_0x5f08e8){_0x1a4f3f['sendStatus'](0x194);}return _0x5f08e8;};}function handleError(_0x3b5dd4,_0xe8b1ef){_0xe8b1ef=_0xe8b1ef||0x1f4;return function(_0x30d3c9){logger['error'](_0x30d3c9['stack']);if(_0x30d3c9[_0x1999('0x24')]){delete _0x30d3c9[_0x1999('0x24')];}_0x3b5dd4[_0x1999('0x19')](_0xe8b1ef)[_0x1999('0x25')](_0x30d3c9);};}exports[_0x1999('0x26')]=function(_0x4ba1d7,_0x55b259){var _0x2e5e56={},_0x5f183f={},_0x231b4b={'count':0x0,'rows':[]};var _0x43a1ba=_[_0x1999('0x27')](db[_0x1999('0x28')][_0x1999('0x29')],function(_0x22bf87){return{'name':_0x22bf87[_0x1999('0x2a')],'type':_0x22bf87[_0x1999('0x2b')][_0x1999('0x2c')]};});_0x5f183f['model']=_[_0x1999('0x27')](_0x43a1ba,_0x1999('0x24'));_0x5f183f['query']=_[_0x1999('0x2d')](_0x4ba1d7[_0x1999('0x2e')]);_0x5f183f[_0x1999('0x2f')]=_[_0x1999('0x30')](_0x5f183f[_0x1999('0x31')],_0x5f183f[_0x1999('0x2e')]);_0x2e5e56[_0x1999('0x32')]=_['intersection'](_0x5f183f[_0x1999('0x31')],qs['fields'](_0x4ba1d7[_0x1999('0x2e')][_0x1999('0x33')]));_0x2e5e56[_0x1999('0x32')]=_0x2e5e56['attributes'][_0x1999('0x34')]?_0x2e5e56['attributes']:_0x5f183f[_0x1999('0x31')];if(!_0x4ba1d7[_0x1999('0x2e')][_0x1999('0x35')](_0x1999('0x36'))){_0x2e5e56['limit']=qs[_0x1999('0x37')](_0x4ba1d7[_0x1999('0x2e')][_0x1999('0x37')]);_0x2e5e56[_0x1999('0x1c')]=qs[_0x1999('0x1c')](_0x4ba1d7[_0x1999('0x2e')][_0x1999('0x1c')]);}_0x2e5e56[_0x1999('0x38')]=qs['sort'](_0x4ba1d7['query']['sort']);_0x2e5e56[_0x1999('0x39')]=qs[_0x1999('0x2f')](_['pick'](_0x4ba1d7[_0x1999('0x2e')],_0x5f183f[_0x1999('0x2f')]),_0x43a1ba);if(_0x4ba1d7[_0x1999('0x2e')][_0x1999('0x3a')]){_0x2e5e56['where']=_[_0x1999('0x3b')](_0x2e5e56[_0x1999('0x39')],{'$or':_[_0x1999('0x27')](_0x43a1ba,function(_0x592bc6){if(_0x592bc6['type']!=='VIRTUAL'){var _0x2ab3ec={};_0x2ab3ec[_0x592bc6['name']]={'$like':'%'+_0x4ba1d7[_0x1999('0x2e')]['filter']+'%'};return _0x2ab3ec;}})});}_0x2e5e56=_[_0x1999('0x3b')]({},_0x2e5e56,_0x4ba1d7[_0x1999('0x3c')]);var _0x17ebad={'where':_0x2e5e56[_0x1999('0x39')]};return db[_0x1999('0x28')]['count'](_0x17ebad)['then'](function(_0x491c03){_0x231b4b[_0x1999('0x1e')]=_0x491c03;if(_0x4ba1d7['query'][_0x1999('0x3d')]){_0x2e5e56[_0x1999('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x2e5e56);})[_0x1999('0x23')](function(_0x5757f2){_0x231b4b[_0x1999('0x3f')]=_0x5757f2;return _0x231b4b;})[_0x1999('0x23')](respondWithFilteredResult(_0x55b259,_0x2e5e56))[_0x1999('0x40')](handleError(_0x55b259,null));};exports[_0x1999('0x41')]=function(_0x370d6c,_0x3fb84a){var _0x3eb11c={'raw':![],'where':{'id':_0x370d6c[_0x1999('0x42')]['id']}},_0x2cb6d9={};_0x2cb6d9[_0x1999('0x31')]=_['keys'](db[_0x1999('0x28')][_0x1999('0x29')]);_0x2cb6d9[_0x1999('0x2e')]=_[_0x1999('0x2d')](_0x370d6c[_0x1999('0x2e')]);_0x2cb6d9[_0x1999('0x2f')]=_['intersection'](_0x2cb6d9[_0x1999('0x31')],_0x2cb6d9['query']);_0x3eb11c['attributes']=_[_0x1999('0x30')](_0x2cb6d9['model'],qs[_0x1999('0x33')](_0x370d6c[_0x1999('0x2e')][_0x1999('0x33')]));_0x3eb11c[_0x1999('0x32')]=_0x3eb11c[_0x1999('0x32')][_0x1999('0x34')]?_0x3eb11c[_0x1999('0x32')]:_0x2cb6d9[_0x1999('0x31')];if(_0x370d6c[_0x1999('0x2e')][_0x1999('0x3d')]){_0x3eb11c[_0x1999('0x3e')]=[{'all':!![]}];}_0x3eb11c=_[_0x1999('0x3b')]({},_0x3eb11c,_0x370d6c[_0x1999('0x3c')]);return db['ServicenowAccount']['find'](_0x3eb11c)[_0x1999('0x23')](handleEntityNotFound(_0x3fb84a,null))[_0x1999('0x23')](respondWithResult(_0x3fb84a,null))[_0x1999('0x40')](handleError(_0x3fb84a,null));};exports['create']=function(_0x5f3eb7,_0x539e2e){return db[_0x1999('0x28')][_0x1999('0x43')](_0x5f3eb7[_0x1999('0x44')],{})['then'](respondWithResult(_0x539e2e,0xc9))[_0x1999('0x40')](handleError(_0x539e2e,null));};exports['update']=function(_0x5e8dcf,_0x2a541b){if(_0x5e8dcf[_0x1999('0x44')]['id']){delete _0x5e8dcf[_0x1999('0x44')]['id'];}return db[_0x1999('0x28')][_0x1999('0x45')]({'where':{'id':_0x5e8dcf['params']['id']}})[_0x1999('0x23')](handleEntityNotFound(_0x2a541b,null))[_0x1999('0x23')](saveUpdates(_0x5e8dcf['body'],null))[_0x1999('0x23')](respondWithResult(_0x2a541b,null))[_0x1999('0x40')](handleError(_0x2a541b,null));};exports[_0x1999('0x22')]=function(_0x4873b7,_0x58dd21){return db[_0x1999('0x28')][_0x1999('0x45')]({'where':{'id':_0x4873b7['params']['id']}})[_0x1999('0x23')](handleEntityNotFound(_0x58dd21,null))['then'](removeEntity(_0x58dd21,null))[_0x1999('0x40')](handleError(_0x58dd21,null));};exports['getConfigurations']=function(_0x4e63c9,_0x6415ef,_0x827312){var _0x5d6d64={};var _0x5f1031={};var _0x5bb0c6;var _0x11820b;return db[_0x1999('0x28')]['findOne']({'where':{'id':_0x4e63c9[_0x1999('0x42')]['id']}})['then'](handleEntityNotFound(_0x6415ef,null))[_0x1999('0x23')](function(_0x15fe16){if(_0x15fe16){_0x5bb0c6=_0x15fe16;_0x5f1031[_0x1999('0x31')]=_['keys'](db[_0x1999('0x46')]['rawAttributes']);_0x5f1031['query']=_[_0x1999('0x2d')](_0x4e63c9['query']);_0x5f1031[_0x1999('0x2f')]=_[_0x1999('0x30')](_0x5f1031[_0x1999('0x31')],_0x5f1031[_0x1999('0x2e')]);_0x5d6d64[_0x1999('0x32')]=_[_0x1999('0x30')](_0x5f1031[_0x1999('0x31')],qs['fields'](_0x4e63c9[_0x1999('0x2e')][_0x1999('0x33')]));_0x5d6d64[_0x1999('0x32')]=_0x5d6d64['attributes']['length']?_0x5d6d64[_0x1999('0x32')]:_0x5f1031['model'];_0x5d6d64[_0x1999('0x38')]=qs[_0x1999('0x47')](_0x4e63c9['query'][_0x1999('0x47')]);_0x5d6d64[_0x1999('0x39')]=qs['filters'](_[_0x1999('0x48')](_0x4e63c9[_0x1999('0x2e')],_0x5f1031[_0x1999('0x2f')]));if(_0x4e63c9[_0x1999('0x2e')][_0x1999('0x3a')]){_0x5d6d64[_0x1999('0x39')]=_[_0x1999('0x3b')](_0x5d6d64[_0x1999('0x39')],{'$or':_[_0x1999('0x27')](_0x5d6d64[_0x1999('0x32')],function(_0x445193){var _0x3516de={};_0x3516de[_0x445193]={'$like':'%'+_0x4e63c9[_0x1999('0x2e')][_0x1999('0x3a')]+'%'};return _0x3516de;})});}_0x5d6d64=_['merge']({},_0x5d6d64,_0x4e63c9[_0x1999('0x3c')]);return _0x5bb0c6[_0x1999('0x49')](_0x5d6d64);}})[_0x1999('0x23')](function(_0x572a2d){if(_0x572a2d){_0x11820b=_0x572a2d[_0x1999('0x34')];if(!_0x4e63c9[_0x1999('0x2e')][_0x1999('0x35')]('nolimit')){_0x5d6d64[_0x1999('0x37')]=qs[_0x1999('0x37')](_0x4e63c9[_0x1999('0x2e')]['limit']);_0x5d6d64[_0x1999('0x1c')]=qs[_0x1999('0x1c')](_0x4e63c9[_0x1999('0x2e')][_0x1999('0x1c')]);}return _0x5bb0c6['getConfigurations'](_0x5d6d64);}})[_0x1999('0x23')](function(_0x3dbcd8){if(_0x3dbcd8){return _0x3dbcd8?{'count':_0x11820b,'rows':_0x3dbcd8}:null;}})['then'](respondWithResult(_0x6415ef,null))[_0x1999('0x40')](handleError(_0x6415ef,null));};exports[_0x1999('0x4a')]=function(_0x52d68f,_0x34a7ec,_0x41b791){if(_0x52d68f[_0x1999('0x44')]['id']){delete _0x52d68f[_0x1999('0x44')]['id'];}return db[_0x1999('0x28')][_0x1999('0x4b')]({'where':{'id':_0x52d68f[_0x1999('0x42')]['id']}})[_0x1999('0x23')](handleEntityNotFound(_0x34a7ec,null))[_0x1999('0x23')](function(_0x4e2897){if(_0x4e2897){_0x52d68f[_0x1999('0x44')][_0x1999('0x4c')]=_0x4e2897['id'];_0x52d68f['body'][_0x1999('0x4d')]=integrations[_0x1999('0x4e')](_0x52d68f[_0x1999('0x44')]['channel'],_0x52d68f[_0x1999('0x44')][_0x1999('0x2b')]);_0x52d68f['body'][_0x1999('0x4f')]=integrations[_0x1999('0x50')](_0x52d68f[_0x1999('0x44')]['channel'],_0x52d68f[_0x1999('0x44')][_0x1999('0x2b')]);return db[_0x1999('0x46')][_0x1999('0x43')](_0x52d68f[_0x1999('0x44')],{'include':[{'model':db[_0x1999('0x51')],'as':_0x1999('0x4d')},{'model':db['ServicenowField'],'as':_0x1999('0x4f')}]});}return null;})[_0x1999('0x23')](respondWithResult(_0x34a7ec,null))[_0x1999('0x40')](handleError(_0x34a7ec,null));};exports[_0x1999('0x52')]=function(_0x1fb2fd,_0x184446,_0x235fd9){var _0x2a422e=[_0x1999('0x53'),'hold_reason',_0x1999('0x54'),'subcategory',_0x1999('0x55'),_0x1999('0x56'),_0x1999('0x57'),_0x1999('0x58'),_0x1999('0x59')];var _0x16ea35=['parent',_0x1999('0x53'),_0x1999('0x5a'),'watch_list',_0x1999('0x5b'),_0x1999('0x5c'),_0x1999('0x5d'),_0x1999('0x5e'),'approval_history',_0x1999('0x5f'),'resolved_by',_0x1999('0x60'),_0x1999('0x61'),_0x1999('0x62'),_0x1999('0x63'),_0x1999('0x64'),_0x1999('0x65'),_0x1999('0x66'),_0x1999('0x54'),_0x1999('0x38'),'calendar_stc',_0x1999('0x67'),_0x1999('0x68'),_0x1999('0x69'),'impact',_0x1999('0x6a'),'work_notes_list',_0x1999('0x6b'),_0x1999('0x6c'),_0x1999('0x6d'),_0x1999('0x6e'),_0x1999('0x6f'),_0x1999('0x70'),_0x1999('0x71'),_0x1999('0x72'),_0x1999('0x73'),'work_end',_0x1999('0x74'),'resolved_at',_0x1999('0x75'),_0x1999('0x76'),_0x1999('0x77'),'work_notes',_0x1999('0x78'),_0x1999('0x55'),'correlation_display',_0x1999('0x79'),'work_start',_0x1999('0x7a'),_0x1999('0x7b'),_0x1999('0x7c'),_0x1999('0x7d'),_0x1999('0x7e'),_0x1999('0x56'),'sys_class_name',_0x1999('0x7f'),_0x1999('0x80'),_0x1999('0x81'),_0x1999('0x82'),_0x1999('0x83'),_0x1999('0x84'),_0x1999('0x85'),'incident_state',_0x1999('0x86'),_0x1999('0x87'),_0x1999('0x88'),_0x1999('0x89'),_0x1999('0x8a'),'assigned_to',_0x1999('0x58'),_0x1999('0x8b'),_0x1999('0x8c'),_0x1999('0x8d'),_0x1999('0x8e'),_0x1999('0x8f'),_0x1999('0x90'),_0x1999('0x91'),'sys_tags',_0x1999('0x92'),_0x1999('0x93'),_0x1999('0x94'),_0x1999('0x95'),'category'];var _0x516ede='';var _0x357eb3='';var _0x54f7b1=[];var _0x413aa8='';var _0x3e4ef9='';var _0x268326=[];var _0x45a0c4='';var _0x5eac26='';var _0x3a636a={};var _0x41ff60='';return db[_0x1999('0x28')][_0x1999('0x4b')]({'where':{'id':_0x1fb2fd[_0x1999('0x42')]['id']},'attributes':['id','username',_0x1999('0x96'),_0x1999('0x97'),_0x1999('0x98'),'serverUrl']})['then'](handleEntityNotFound(_0x184446,null))[_0x1999('0x23')](function(_0x5404ac){if(_0x5404ac){_0x41ff60=_0x5404ac[_0x1999('0x98')];var _0x109292=_0x41ff60[_0x1999('0x99')](-0x1);if(_0x109292==='/'){_0x41ff60=_0x41ff60['substring'](0x0,_0x41ff60[_0x1999('0x9a')](_0x109292));}_0x5eac26=util[_0x1999('0x9b')](_0x1999('0x9c'),_0x41ff60);_0x45a0c4=util[_0x1999('0x9b')]('%s/api/now/table/',_0x41ff60);_0x3a636a={'user':_0x5404ac[_0x1999('0x9d')],'pass':_0x5404ac[_0x1999('0x96')]};var _0x575b08={'method':_0x1999('0x9e'),'uri':_0x5eac26+_0x1999('0x9f'),'auth':_0x3a636a,'json':!![]};return rp(_0x575b08);}})[_0x1999('0x23')](function(_0x5d4292){if(_0x5d4292[_0x1999('0xa0')][_0x1999('0x34')]>0x0){_0x516ede=_0x5d4292[_0x1999('0xa0')];}console[_0x1999('0xa1')]('incident\x20table\x20objects',_0x516ede);_0x268326=[];_0x357eb3=Object[_0x1999('0xa2')]([],_0x516ede);_[_0x1999('0xa3')](_0x357eb3,function(_0x9c131){return!_0x2a422e[_0x1999('0xa4')](_0x9c131[_0x1999('0x24')]);});_0x357eb3['forEach'](function(_0x54a6c5){var _0x88f66=createFieldObject(_0x45a0c4,_0x3a636a,_0x54a6c5[_0x1999('0xa5')],_0x54a6c5[_0x1999('0x24')],_0x54a6c5['label'],![]);_0x268326[_0x1999('0xa6')](_0x88f66);});return Promise[_0x1999('0xa7')](_0x268326);})[_0x1999('0x23')](function(_0x25ab1f){_0x54f7b1=_0x25ab1f;_0x413aa8=Object[_0x1999('0xa2')]([],_0x516ede);console[_0x1999('0xa1')]('TCL:\x20_object',_0x516ede);_['remove'](_0x413aa8,function(_0xc19807){return _0x16ea35[_0x1999('0xa4')](_0xc19807['name']);});console[_0x1999('0xa1')](_0x1999('0xa8'),_0x413aa8);_0x268326=[];_0x413aa8[_0x1999('0xa9')](function(_0x384fed){var _0x383c38=createFieldObject(_0x45a0c4,_0x3a636a,_0x384fed[_0x1999('0xa5')],_0x384fed[_0x1999('0x24')],_0x384fed[_0x1999('0xaa')],!![]);_0x268326[_0x1999('0xa6')](_0x383c38);});return Promise[_0x1999('0xa7')](_0x268326);})[_0x1999('0x23')](function(_0x5a3433){_0x3e4ef9=_0x5a3433;var _0x357165=_0x54f7b1[_0x1999('0xab')](_0x3e4ef9);return{'count':_0x357165['length'],'rows':_0x357165};})['then'](respondWithResult(_0x184446,null))[_0x1999('0x40')](function(_0x4caa1f){console[_0x1999('0xa1')](_0x1999('0xac')+_0x4caa1f);var _0x317de3=_0x1fb2fd['query'][_0x1999('0xad')]?0x1f4:_0x4caa1f[_0x1999('0xae')]||0x1f4;logger[_0x1999('0xaf')](_0x4caa1f[_0x1999('0xb0')]);delete _0x4caa1f[_0x1999('0x24')];if(_0x317de3===0x191){_0x317de3=0x190;}_0x184446['status'](_0x317de3)[_0x1999('0x25')](_0x1fb2fd[_0x1999('0x2e')][_0x1999('0xad')]?{'message':'Wrong\x20credentials','statusCode':_0x4caa1f['statusCode']}:_0x4caa1f);});};function createFieldObject(_0x24bf5b,_0x4b11c1,_0x257395,_0x278c52,_0x3f507e,_0x466851){return new Promise(function(_0x5ab2c1,_0x4ab33b){var _0x3e0da9={'id':_0x278c52,'name':_0x3f507e,'custom':_0x466851};if(_0x257395===_0x1999('0xb1')){_0x3e0da9[_0x1999('0x3c')]=[{'name':_0x1999('0xb2'),'value':_0x1999('0xb3')},{'name':'False','value':_0x1999('0xb4')}];_0x5ab2c1(_0x3e0da9);}else{var _0x925a23={'method':_0x1999('0x9e'),'uri':_0x24bf5b+'sys_choice?sysparm_query=name=incident^element='+_0x278c52,'auth':_0x4b11c1,'json':!![]};return rp(_0x925a23)[_0x1999('0x23')](function(_0x46fb12){var _0x4b9af1=[];if(_0x46fb12[_0x1999('0xa0')][_0x1999('0x34')]>0x0){_0x46fb12['result'][_0x1999('0xa9')](function(_0x1f20fc){if(_0x1f20fc['inactive']===_0x1999('0xb4')){var _0x17ac1a={'name':_0x1f20fc[_0x1999('0xaa')],'value':_0x1f20fc['value']};_0x4b9af1[_0x1999('0xa6')](_0x17ac1a);}});}_0x3e0da9[_0x1999('0x3c')]=_0x4b9af1;if(_0x3e0da9['options'][_0x1999('0x34')]>0x0){_0x5ab2c1(_0x3e0da9);}else{if(_0x466851==![]){_0x5ab2c1();}else{_0x5ab2c1(_0x3e0da9);}}});}});} \ No newline at end of file +var _0x0d98=['AccountId','Subjects','channel','Descriptions','ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','sys_class_name','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','username','password','result','log','incident\x20table\x20objects','remove','forEach','internalType','label','push','all','assign','TCL:\x20_object','includes','concat','ServiceNow\x20error:\x20','test','stack','Wrong\x20credentials','statusCode','boolean','true','sys_choice?sysparm_query=name=incident^element=','value','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../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','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','findOne','ServicenowConfiguration','pick','filter','getConfigurations','hasOwnProperty','addConfiguration'];(function(_0x347d91,_0x5c6a2d){var _0x2048d5=function(_0x2b8299){while(--_0x2b8299){_0x347d91['push'](_0x347d91['shift']());}};_0x2048d5(++_0x5c6a2d);}(_0x0d98,0x1e1));var _0x80d9=function(_0x46f599,_0x559556){_0x46f599=_0x46f599-0x0;var _0x1af1c0=_0x0d98[_0x46f599];return _0x1af1c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80d9('0x0'));var zipdir=require(_0x80d9('0x1'));var jsonpatch=require(_0x80d9('0x2'));var rp=require('request-promise');var moment=require(_0x80d9('0x3'));var BPromise=require(_0x80d9('0x4'));var Mustache=require(_0x80d9('0x5'));var util=require(_0x80d9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x80d9('0x7'));var ejs=require(_0x80d9('0x8'));var fs=require('fs');var fs_extra=require(_0x80d9('0x9'));var _=require(_0x80d9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x80d9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x80d9('0x7'));var querystring=require(_0x80d9('0xc'));var Papa=require(_0x80d9('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x80d9('0xe'));var as=require(_0x80d9('0xf'));var hardwareService=require(_0x80d9('0x10'));var logger=require(_0x80d9('0x11'))(_0x80d9('0x12'));var utils=require(_0x80d9('0x13'));var config=require(_0x80d9('0x14'));var licenseUtil=require(_0x80d9('0x15'));var db=require(_0x80d9('0x16'))['db'];var integrations=require(_0x80d9('0x17'));function respondWithStatusCode(_0xf5fb77,_0x269f45){_0x269f45=_0x269f45||0xcc;return function(_0x2dc5cf){if(_0x2dc5cf){return _0xf5fb77[_0x80d9('0x18')](_0x269f45);}return _0xf5fb77[_0x80d9('0x19')](_0x269f45)[_0x80d9('0x1a')]();};}function respondWithResult(_0x542e45,_0x50c2fc){_0x50c2fc=_0x50c2fc||0xc8;return function(_0x6883a6){if(_0x6883a6){return _0x542e45['status'](_0x50c2fc)[_0x80d9('0x1b')](_0x6883a6);}};}function respondWithFilteredResult(_0x38c5bf,_0x17713b){return function(_0x5759a9){if(_0x5759a9){var _0x40708d=typeof _0x17713b['offset']===_0x80d9('0x1c')&&typeof _0x17713b['limit']==='undefined';var _0x49f9bb=_0x5759a9[_0x80d9('0x1d')];var _0x1d3fb9=_0x40708d?0x0:_0x17713b[_0x80d9('0x1e')];var _0x3d9677=_0x40708d?_0x5759a9[_0x80d9('0x1d')]:_0x17713b[_0x80d9('0x1e')]+_0x17713b[_0x80d9('0x1f')];var _0x1ebfc5;if(_0x3d9677>=_0x49f9bb){_0x3d9677=_0x49f9bb;_0x1ebfc5=0xc8;}else{_0x1ebfc5=0xce;}_0x38c5bf['status'](_0x1ebfc5);return _0x38c5bf[_0x80d9('0x20')](_0x80d9('0x21'),_0x1d3fb9+'-'+_0x3d9677+'/'+_0x49f9bb)[_0x80d9('0x1b')](_0x5759a9);}return null;};}function patchUpdates(_0x30ed82){return function(_0x56f149){try{jsonpatch['apply'](_0x56f149,_0x30ed82,!![]);}catch(_0x4620d9){return BPromise[_0x80d9('0x22')](_0x4620d9);}return _0x56f149[_0x80d9('0x23')]();};}function saveUpdates(_0x477e5e,_0x596390){return function(_0x5aabff){if(_0x5aabff){return _0x5aabff[_0x80d9('0x24')](_0x477e5e)[_0x80d9('0x25')](function(_0x510253){return _0x510253;});}return null;};}function removeEntity(_0x1c0316,_0x1cddc8){return function(_0x3e6595){if(_0x3e6595){return _0x3e6595[_0x80d9('0x26')]()[_0x80d9('0x25')](function(){_0x1c0316[_0x80d9('0x19')](0xcc)[_0x80d9('0x1a')]();});}};}function handleEntityNotFound(_0x1a4e9e,_0x232ec7){return function(_0x35f1eb){if(!_0x35f1eb){_0x1a4e9e['sendStatus'](0x194);}return _0x35f1eb;};}function handleError(_0x247188,_0x4e3518){_0x4e3518=_0x4e3518||0x1f4;return function(_0x5320a5){logger[_0x80d9('0x27')](_0x5320a5['stack']);if(_0x5320a5[_0x80d9('0x28')]){delete _0x5320a5['name'];}_0x247188['status'](_0x4e3518)[_0x80d9('0x29')](_0x5320a5);};}exports['index']=function(_0x213a76,_0x46ee3b){var _0x52db01={},_0x3e2321={},_0x62fc73={'count':0x0,'rows':[]};var _0x1dc72f=_[_0x80d9('0x2a')](db[_0x80d9('0x2b')][_0x80d9('0x2c')],function(_0x214e26){return{'name':_0x214e26[_0x80d9('0x2d')],'type':_0x214e26[_0x80d9('0x2e')][_0x80d9('0x2f')]};});_0x3e2321[_0x80d9('0x30')]=_[_0x80d9('0x2a')](_0x1dc72f,'name');_0x3e2321[_0x80d9('0x31')]=_[_0x80d9('0x32')](_0x213a76['query']);_0x3e2321[_0x80d9('0x33')]=_['intersection'](_0x3e2321[_0x80d9('0x30')],_0x3e2321[_0x80d9('0x31')]);_0x52db01[_0x80d9('0x34')]=_[_0x80d9('0x35')](_0x3e2321[_0x80d9('0x30')],qs[_0x80d9('0x36')](_0x213a76[_0x80d9('0x31')][_0x80d9('0x36')]));_0x52db01[_0x80d9('0x34')]=_0x52db01[_0x80d9('0x34')][_0x80d9('0x37')]?_0x52db01['attributes']:_0x3e2321['model'];if(!_0x213a76[_0x80d9('0x31')]['hasOwnProperty'](_0x80d9('0x38'))){_0x52db01[_0x80d9('0x1f')]=qs['limit'](_0x213a76[_0x80d9('0x31')][_0x80d9('0x1f')]);_0x52db01[_0x80d9('0x1e')]=qs[_0x80d9('0x1e')](_0x213a76[_0x80d9('0x31')][_0x80d9('0x1e')]);}_0x52db01[_0x80d9('0x39')]=qs[_0x80d9('0x3a')](_0x213a76['query'][_0x80d9('0x3a')]);_0x52db01['where']=qs['filters'](_['pick'](_0x213a76[_0x80d9('0x31')],_0x3e2321[_0x80d9('0x33')]),_0x1dc72f);if(_0x213a76[_0x80d9('0x31')]['filter']){_0x52db01[_0x80d9('0x3b')]=_[_0x80d9('0x3c')](_0x52db01['where'],{'$or':_[_0x80d9('0x2a')](_0x1dc72f,function(_0x397451){if(_0x397451['type']!==_0x80d9('0x3d')){var _0x3d3610={};_0x3d3610[_0x397451[_0x80d9('0x28')]]={'$like':'%'+_0x213a76[_0x80d9('0x31')]['filter']+'%'};return _0x3d3610;}})});}_0x52db01=_[_0x80d9('0x3c')]({},_0x52db01,_0x213a76[_0x80d9('0x3e')]);var _0x234cd1={'where':_0x52db01[_0x80d9('0x3b')]};return db['ServicenowAccount'][_0x80d9('0x1d')](_0x234cd1)['then'](function(_0x3c630d){_0x62fc73[_0x80d9('0x1d')]=_0x3c630d;if(_0x213a76[_0x80d9('0x31')][_0x80d9('0x3f')]){_0x52db01[_0x80d9('0x40')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x80d9('0x41')](_0x52db01);})[_0x80d9('0x25')](function(_0x277e89){_0x62fc73[_0x80d9('0x42')]=_0x277e89;return _0x62fc73;})[_0x80d9('0x25')](respondWithFilteredResult(_0x46ee3b,_0x52db01))['catch'](handleError(_0x46ee3b,null));};exports[_0x80d9('0x43')]=function(_0x45fc48,_0x2d18e5){var _0x13fb04={'raw':![],'where':{'id':_0x45fc48[_0x80d9('0x44')]['id']}},_0x2a8ba3={};_0x2a8ba3['model']=_['keys'](db['ServicenowAccount'][_0x80d9('0x2c')]);_0x2a8ba3[_0x80d9('0x31')]=_['keys'](_0x45fc48[_0x80d9('0x31')]);_0x2a8ba3[_0x80d9('0x33')]=_[_0x80d9('0x35')](_0x2a8ba3[_0x80d9('0x30')],_0x2a8ba3[_0x80d9('0x31')]);_0x13fb04[_0x80d9('0x34')]=_[_0x80d9('0x35')](_0x2a8ba3[_0x80d9('0x30')],qs[_0x80d9('0x36')](_0x45fc48[_0x80d9('0x31')]['fields']));_0x13fb04[_0x80d9('0x34')]=_0x13fb04[_0x80d9('0x34')][_0x80d9('0x37')]?_0x13fb04[_0x80d9('0x34')]:_0x2a8ba3[_0x80d9('0x30')];if(_0x45fc48[_0x80d9('0x31')][_0x80d9('0x3f')]){_0x13fb04[_0x80d9('0x40')]=[{'all':!![]}];}_0x13fb04=_[_0x80d9('0x3c')]({},_0x13fb04,_0x45fc48[_0x80d9('0x3e')]);return db[_0x80d9('0x2b')][_0x80d9('0x45')](_0x13fb04)[_0x80d9('0x25')](handleEntityNotFound(_0x2d18e5,null))[_0x80d9('0x25')](respondWithResult(_0x2d18e5,null))[_0x80d9('0x46')](handleError(_0x2d18e5,null));};exports[_0x80d9('0x47')]=function(_0x59cd1d,_0x3f4eea){return db[_0x80d9('0x2b')][_0x80d9('0x47')](_0x59cd1d[_0x80d9('0x48')],{})['then'](respondWithResult(_0x3f4eea,0xc9))[_0x80d9('0x46')](handleError(_0x3f4eea,null));};exports['update']=function(_0x505b57,_0x53595a){if(_0x505b57[_0x80d9('0x48')]['id']){delete _0x505b57['body']['id'];}return db[_0x80d9('0x2b')][_0x80d9('0x45')]({'where':{'id':_0x505b57['params']['id']}})['then'](handleEntityNotFound(_0x53595a,null))['then'](saveUpdates(_0x505b57[_0x80d9('0x48')],null))['then'](respondWithResult(_0x53595a,null))['catch'](handleError(_0x53595a,null));};exports[_0x80d9('0x26')]=function(_0x42bc59,_0xf72b9e){return db['ServicenowAccount'][_0x80d9('0x45')]({'where':{'id':_0x42bc59[_0x80d9('0x44')]['id']}})[_0x80d9('0x25')](handleEntityNotFound(_0xf72b9e,null))['then'](removeEntity(_0xf72b9e,null))['catch'](handleError(_0xf72b9e,null));};exports['getConfigurations']=function(_0x8344b1,_0x1e46e0,_0x4a5fbe){var _0x2e0fbb={};var _0x2d8a25={};var _0x24d7a5;var _0x1cdad9;return db[_0x80d9('0x2b')][_0x80d9('0x49')]({'where':{'id':_0x8344b1['params']['id']}})[_0x80d9('0x25')](handleEntityNotFound(_0x1e46e0,null))[_0x80d9('0x25')](function(_0x1e517a){if(_0x1e517a){_0x24d7a5=_0x1e517a;_0x2d8a25['model']=_[_0x80d9('0x32')](db[_0x80d9('0x4a')][_0x80d9('0x2c')]);_0x2d8a25[_0x80d9('0x31')]=_[_0x80d9('0x32')](_0x8344b1[_0x80d9('0x31')]);_0x2d8a25[_0x80d9('0x33')]=_[_0x80d9('0x35')](_0x2d8a25['model'],_0x2d8a25[_0x80d9('0x31')]);_0x2e0fbb[_0x80d9('0x34')]=_[_0x80d9('0x35')](_0x2d8a25['model'],qs[_0x80d9('0x36')](_0x8344b1['query']['fields']));_0x2e0fbb[_0x80d9('0x34')]=_0x2e0fbb[_0x80d9('0x34')][_0x80d9('0x37')]?_0x2e0fbb['attributes']:_0x2d8a25['model'];_0x2e0fbb['order']=qs[_0x80d9('0x3a')](_0x8344b1[_0x80d9('0x31')][_0x80d9('0x3a')]);_0x2e0fbb[_0x80d9('0x3b')]=qs[_0x80d9('0x33')](_[_0x80d9('0x4b')](_0x8344b1[_0x80d9('0x31')],_0x2d8a25[_0x80d9('0x33')]));if(_0x8344b1[_0x80d9('0x31')][_0x80d9('0x4c')]){_0x2e0fbb[_0x80d9('0x3b')]=_[_0x80d9('0x3c')](_0x2e0fbb[_0x80d9('0x3b')],{'$or':_[_0x80d9('0x2a')](_0x2e0fbb[_0x80d9('0x34')],function(_0x51814b){var _0x3ddb15={};_0x3ddb15[_0x51814b]={'$like':'%'+_0x8344b1['query'][_0x80d9('0x4c')]+'%'};return _0x3ddb15;})});}_0x2e0fbb=_['merge']({},_0x2e0fbb,_0x8344b1[_0x80d9('0x3e')]);return _0x24d7a5[_0x80d9('0x4d')](_0x2e0fbb);}})[_0x80d9('0x25')](function(_0x43629f){if(_0x43629f){_0x1cdad9=_0x43629f[_0x80d9('0x37')];if(!_0x8344b1[_0x80d9('0x31')][_0x80d9('0x4e')]('nolimit')){_0x2e0fbb[_0x80d9('0x1f')]=qs[_0x80d9('0x1f')](_0x8344b1['query'][_0x80d9('0x1f')]);_0x2e0fbb[_0x80d9('0x1e')]=qs[_0x80d9('0x1e')](_0x8344b1['query'][_0x80d9('0x1e')]);}return _0x24d7a5[_0x80d9('0x4d')](_0x2e0fbb);}})['then'](function(_0x44d7e6){if(_0x44d7e6){return _0x44d7e6?{'count':_0x1cdad9,'rows':_0x44d7e6}:null;}})[_0x80d9('0x25')](respondWithResult(_0x1e46e0,null))[_0x80d9('0x46')](handleError(_0x1e46e0,null));};exports[_0x80d9('0x4f')]=function(_0x2c6cbc,_0x3645cd,_0x40190c){if(_0x2c6cbc['body']['id']){delete _0x2c6cbc[_0x80d9('0x48')]['id'];}return db[_0x80d9('0x2b')][_0x80d9('0x49')]({'where':{'id':_0x2c6cbc[_0x80d9('0x44')]['id']}})[_0x80d9('0x25')](handleEntityNotFound(_0x3645cd,null))[_0x80d9('0x25')](function(_0x2963cb){if(_0x2963cb){_0x2c6cbc[_0x80d9('0x48')][_0x80d9('0x50')]=_0x2963cb['id'];_0x2c6cbc[_0x80d9('0x48')][_0x80d9('0x51')]=integrations['getSubjects'](_0x2c6cbc[_0x80d9('0x48')][_0x80d9('0x52')],_0x2c6cbc[_0x80d9('0x48')][_0x80d9('0x2e')]);_0x2c6cbc[_0x80d9('0x48')][_0x80d9('0x53')]=integrations['getDescriptions'](_0x2c6cbc[_0x80d9('0x48')]['channel'],_0x2c6cbc['body']['type']);return db[_0x80d9('0x4a')][_0x80d9('0x47')](_0x2c6cbc[_0x80d9('0x48')],{'include':[{'model':db[_0x80d9('0x54')],'as':_0x80d9('0x51')},{'model':db[_0x80d9('0x54')],'as':'Descriptions'}]});}return null;})[_0x80d9('0x25')](respondWithResult(_0x3645cd,null))[_0x80d9('0x46')](handleError(_0x3645cd,null));};exports[_0x80d9('0x55')]=function(_0xb07123,_0xe434e0,_0x3f5082){var _0x1e97af=[_0x80d9('0x56'),'hold_reason',_0x80d9('0x57'),_0x80d9('0x58'),_0x80d9('0x59'),_0x80d9('0x5a'),_0x80d9('0x5b'),'severity',_0x80d9('0x5c')];var _0x3647f7=[_0x80d9('0x5d'),_0x80d9('0x56'),_0x80d9('0x5e'),_0x80d9('0x5f'),_0x80d9('0x60'),_0x80d9('0x61'),'child_incidents','hold_reason',_0x80d9('0x62'),_0x80d9('0x63'),_0x80d9('0x64'),_0x80d9('0x65'),_0x80d9('0x66'),_0x80d9('0x67'),_0x80d9('0x68'),'sys_domain',_0x80d9('0x69'),_0x80d9('0x6a'),_0x80d9('0x57'),_0x80d9('0x39'),_0x80d9('0x6b'),_0x80d9('0x6c'),_0x80d9('0x6d'),_0x80d9('0x6e'),'impact',_0x80d9('0x6f'),_0x80d9('0x70'),_0x80d9('0x71'),_0x80d9('0x72'),_0x80d9('0x73'),_0x80d9('0x74'),_0x80d9('0x75'),_0x80d9('0x76'),_0x80d9('0x77'),_0x80d9('0x78'),_0x80d9('0x79'),_0x80d9('0x7a'),_0x80d9('0x7b'),_0x80d9('0x7c'),_0x80d9('0x7d'),_0x80d9('0x7e'),_0x80d9('0x58'),_0x80d9('0x7f'),'short_description',_0x80d9('0x59'),_0x80d9('0x80'),_0x80d9('0x81'),_0x80d9('0x82'),'assignment_group',_0x80d9('0x83'),_0x80d9('0x84'),_0x80d9('0x85'),'calendar_duration',_0x80d9('0x5a'),_0x80d9('0x86'),'close_notes','closed_by',_0x80d9('0x87'),_0x80d9('0x88'),'sys_id',_0x80d9('0x89'),_0x80d9('0x8a'),_0x80d9('0x5b'),_0x80d9('0x8b'),_0x80d9('0x8c'),_0x80d9('0x8d'),_0x80d9('0x8e'),_0x80d9('0x8f'),_0x80d9('0x90'),_0x80d9('0x91'),_0x80d9('0x92'),_0x80d9('0x93'),'approval',_0x80d9('0x94'),'due_date',_0x80d9('0x95'),_0x80d9('0x96'),_0x80d9('0x97'),_0x80d9('0x98'),'upon_approval',_0x80d9('0x99'),_0x80d9('0x9a'),_0x80d9('0x5c')];var _0x3472c2='';var _0x4718b8='';var _0x56ae7d=[];var _0x107373='';var _0x3e3f67='';var _0x2605bc=[];var _0x35e409='';var _0x31c924='';var _0x5cb87b={};var _0xcdf6e='';return db[_0x80d9('0x2b')][_0x80d9('0x49')]({'where':{'id':_0xb07123['params']['id']},'attributes':['id','username','password',_0x80d9('0x9b'),_0x80d9('0x9c'),_0x80d9('0x9d')]})[_0x80d9('0x25')](handleEntityNotFound(_0xe434e0,null))['then'](function(_0x5866e2){if(_0x5866e2){_0xcdf6e=_0x5866e2[_0x80d9('0x9c')];var _0x107d99=_0xcdf6e[_0x80d9('0x9e')](-0x1);if(_0x107d99==='/'){_0xcdf6e=_0xcdf6e[_0x80d9('0x9f')](0x0,_0xcdf6e[_0x80d9('0xa0')](_0x107d99));}_0x31c924=util[_0x80d9('0xa1')]('%s/api/now/doc/table/schema/',_0xcdf6e);_0x35e409=util[_0x80d9('0xa1')](_0x80d9('0xa2'),_0xcdf6e);_0x5cb87b={'user':_0x5866e2[_0x80d9('0xa3')],'pass':_0x5866e2[_0x80d9('0xa4')]};var _0x1809ea={'method':'GET','uri':_0x31c924+'incident?sysparm_display_value=all','auth':_0x5cb87b,'json':!![]};return rp(_0x1809ea);}})[_0x80d9('0x25')](function(_0x4f67f8){if(_0x4f67f8['result'][_0x80d9('0x37')]>0x0){_0x3472c2=_0x4f67f8[_0x80d9('0xa5')];}console[_0x80d9('0xa6')](_0x80d9('0xa7'),_0x3472c2);_0x2605bc=[];_0x4718b8=Object['assign']([],_0x3472c2);_[_0x80d9('0xa8')](_0x4718b8,function(_0x17c4e0){return!_0x1e97af['includes'](_0x17c4e0[_0x80d9('0x28')]);});_0x4718b8[_0x80d9('0xa9')](function(_0x422833){var _0x38dfed=createFieldObject(_0x35e409,_0x5cb87b,_0x422833[_0x80d9('0xaa')],_0x422833[_0x80d9('0x28')],_0x422833[_0x80d9('0xab')],![]);_0x2605bc[_0x80d9('0xac')](_0x38dfed);});return Promise[_0x80d9('0xad')](_0x2605bc);})[_0x80d9('0x25')](function(_0x313783){_0x56ae7d=_0x313783;_0x107373=Object[_0x80d9('0xae')]([],_0x3472c2);console[_0x80d9('0xa6')](_0x80d9('0xaf'),_0x3472c2);_[_0x80d9('0xa8')](_0x107373,function(_0x4d27af){return _0x3647f7[_0x80d9('0xb0')](_0x4d27af['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x107373);_0x2605bc=[];_0x107373['forEach'](function(_0x75b4c1){var _0x505d7d=createFieldObject(_0x35e409,_0x5cb87b,_0x75b4c1[_0x80d9('0xaa')],_0x75b4c1[_0x80d9('0x28')],_0x75b4c1[_0x80d9('0xab')],!![]);_0x2605bc[_0x80d9('0xac')](_0x505d7d);});return Promise[_0x80d9('0xad')](_0x2605bc);})['then'](function(_0x4c3059){_0x3e3f67=_0x4c3059;var _0x5e3928=_0x56ae7d[_0x80d9('0xb1')](_0x3e3f67);return{'count':_0x5e3928[_0x80d9('0x37')],'rows':_0x5e3928};})[_0x80d9('0x25')](respondWithResult(_0xe434e0,null))[_0x80d9('0x46')](function(_0x3f00b9){console['log'](_0x80d9('0xb2')+_0x3f00b9);var _0x1e4e27=_0xb07123['query'][_0x80d9('0xb3')]?0x1f4:_0x3f00b9['statusCode']||0x1f4;logger[_0x80d9('0x27')](_0x3f00b9[_0x80d9('0xb4')]);delete _0x3f00b9[_0x80d9('0x28')];if(_0x1e4e27===0x191){_0x1e4e27=0x190;}_0xe434e0[_0x80d9('0x19')](_0x1e4e27)[_0x80d9('0x29')](_0xb07123[_0x80d9('0x31')]['test']?{'message':_0x80d9('0xb5'),'statusCode':_0x3f00b9[_0x80d9('0xb6')]}:_0x3f00b9);});};function createFieldObject(_0x4c91b0,_0x3ac0fd,_0x56366,_0x38701b,_0x13a48d,_0x52d494){return new Promise(function(_0xd2f452,_0x40e1f3){var _0x1e7884={'id':_0x38701b,'name':_0x13a48d,'custom':_0x52d494};if(_0x56366===_0x80d9('0xb7')){_0x1e7884[_0x80d9('0x3e')]=[{'name':'True','value':_0x80d9('0xb8')},{'name':'False','value':'false'}];_0xd2f452(_0x1e7884);}else{var _0x4a1168={'method':'GET','uri':_0x4c91b0+_0x80d9('0xb9')+_0x38701b,'auth':_0x3ac0fd,'json':!![]};return rp(_0x4a1168)[_0x80d9('0x25')](function(_0x224f03){var _0x742d95=[];if(_0x224f03['result'][_0x80d9('0x37')]>0x0){_0x224f03['result'][_0x80d9('0xa9')](function(_0x311558){if(_0x311558['inactive']==='false'){var _0x3205ff={'name':_0x311558[_0x80d9('0xab')],'value':_0x311558[_0x80d9('0xba')]};_0x742d95[_0x80d9('0xac')](_0x3205ff);}});}_0x1e7884[_0x80d9('0x3e')]=_0x742d95;if(_0x1e7884[_0x80d9('0x3e')][_0x80d9('0x37')]>0x0){_0xd2f452(_0x1e7884);}else{if(_0x52d494==![]){_0xd2f452();}else{_0xd2f452(_0x1e7884);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 474b6ea..d737aac 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 _0x3f8a=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x3f8a[_0x1a89a1];return _0x3d5b46;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x34e840,_0x6a4626){var _0x40c465=function(_0x3eeb1c){while(--_0x3eeb1c){_0x34e840['push'](_0x34e840['shift']());}};_0x40c465(++_0x6a4626);}(_0x687b,0x14a));var _0xb687=function(_0x7ba1c3,_0x3dd545){_0x7ba1c3=_0x7ba1c3-0x0;var _0x82b393=_0x687b[_0x7ba1c3];return _0x82b393;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 639ceb1..053e758 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 _0x4a02=['moment','bluebird','randomstring','../../mysqldb','rpc','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetServicenowAccount','findAll','options','raw','where','limit','include','attributes','map','model','ShowServicenowAccount','ServicenowAccount','catch','lodash','util'];(function(_0x131d9a,_0x13d47f){var _0x3ab1db=function(_0x1ca1c8){while(--_0x1ca1c8){_0x131d9a['push'](_0x131d9a['shift']());}};_0x3ab1db(++_0x13d47f);}(_0x4a02,0x1cc));var _0x24a0=function(_0x460491,_0x6a9730){_0x460491=_0x460491-0x0;var _0x2d3ce9=_0x4a02[_0x460491];return _0x2d3ce9;};'use strict';var _=require(_0x24a0('0x0'));var util=require(_0x24a0('0x1'));var moment=require(_0x24a0('0x2'));var BPromise=require(_0x24a0('0x3'));var rs=require(_0x24a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x24a0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x24a0('0x7')][_0x24a0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19b442,_0x2d636d,_0x4e81b4){return new BPromise(function(_0x2bd82a,_0x2cd520){return client[_0x24a0('0x9')](_0x19b442,_0x4e81b4)[_0x24a0('0xa')](function(_0x536b6e){logger[_0x24a0('0xb')](_0x24a0('0xc'),_0x2d636d,_0x24a0('0xd'));logger[_0x24a0('0xe')](_0x24a0('0xf'),_0x2d636d,_0x24a0('0xd'),JSON[_0x24a0('0x10')](_0x536b6e));if(_0x536b6e[_0x24a0('0x11')]){if(_0x536b6e[_0x24a0('0x11')]['code']===0x1f4){logger[_0x24a0('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2d636d,_0x536b6e[_0x24a0('0x11')][_0x24a0('0x12')]);return _0x2cd520(_0x536b6e['error']['message']);}logger[_0x24a0('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2d636d,_0x536b6e[_0x24a0('0x11')]['message']);return _0x2bd82a(_0x536b6e['error'][_0x24a0('0x12')]);}else{logger[_0x24a0('0xb')](_0x24a0('0xc'),_0x2d636d,_0x24a0('0xd'));_0x2bd82a(_0x536b6e[_0x24a0('0x13')][_0x24a0('0x12')]);}})['catch'](function(_0x354ffa){logger[_0x24a0('0x11')](_0x24a0('0xc'),_0x2d636d,_0x354ffa);_0x2cd520(_0x354ffa);});});}exports[_0x24a0('0x14')]=function(_0x1a44d2){var _0x350860=this;return new Promise(function(_0x290aae,_0x1dae42){return db['ServicenowAccount'][_0x24a0('0x15')]({'raw':_0x1a44d2[_0x24a0('0x16')]?_0x1a44d2[_0x24a0('0x16')][_0x24a0('0x17')]===undefined?!![]:![]:!![],'where':_0x1a44d2[_0x24a0('0x16')]?_0x1a44d2[_0x24a0('0x16')][_0x24a0('0x18')]||null:null,'attributes':_0x1a44d2[_0x24a0('0x16')]?_0x1a44d2[_0x24a0('0x16')]['attributes']||null:null,'limit':_0x1a44d2[_0x24a0('0x16')]?_0x1a44d2[_0x24a0('0x16')][_0x24a0('0x19')]||null:null,'include':_0x1a44d2[_0x24a0('0x16')]?_0x1a44d2['options'][_0x24a0('0x1a')]?_['map'](_0x1a44d2['options'][_0x24a0('0x1a')],function(_0x4fc78a){return{'model':db[_0x4fc78a['model']],'as':_0x4fc78a['as'],'attributes':_0x4fc78a[_0x24a0('0x1b')],'include':_0x4fc78a[_0x24a0('0x1a')]?_[_0x24a0('0x1c')](_0x4fc78a[_0x24a0('0x1a')],function(_0x2eaf21){return{'model':db[_0x2eaf21[_0x24a0('0x1d')]],'as':_0x2eaf21['as'],'attributes':_0x2eaf21[_0x24a0('0x1b')],'include':_0x2eaf21[_0x24a0('0x1a')]?_[_0x24a0('0x1c')](_0x2eaf21[_0x24a0('0x1a')],function(_0x2f14d4){return{'model':db[_0x2f14d4[_0x24a0('0x1d')]],'as':_0x2f14d4['as'],'attributes':_0x2f14d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x24a0('0xa')](function(_0x4346fe){logger[_0x24a0('0xb')](_0x24a0('0x14'),_0x1a44d2);logger['debug'](_0x24a0('0x14'),_0x1a44d2,JSON['stringify'](_0x4346fe));_0x290aae(_0x4346fe);})['catch'](function(_0x462af2){logger[_0x24a0('0x11')](_0x24a0('0x14'),_0x462af2[_0x24a0('0x12')],_0x1a44d2);_0x1dae42(_0x350860['error'](0x1f4,_0x462af2[_0x24a0('0x12')]));});});};exports[_0x24a0('0x1e')]=function(_0x1aae7f){var _0x28dc30=this;return new Promise(function(_0x15da41,_0x32007e){return db[_0x24a0('0x1f')]['find']({'raw':_0x1aae7f['options']?_0x1aae7f[_0x24a0('0x16')][_0x24a0('0x17')]===undefined?!![]:![]:!![],'where':_0x1aae7f[_0x24a0('0x16')]?_0x1aae7f['options'][_0x24a0('0x18')]||null:null,'attributes':_0x1aae7f['options']?_0x1aae7f[_0x24a0('0x16')][_0x24a0('0x1b')]||null:null,'include':_0x1aae7f[_0x24a0('0x16')]?_0x1aae7f[_0x24a0('0x16')][_0x24a0('0x1a')]?_[_0x24a0('0x1c')](_0x1aae7f[_0x24a0('0x16')]['include'],function(_0x565b3e){return{'model':db[_0x565b3e['model']],'as':_0x565b3e['as'],'attributes':_0x565b3e[_0x24a0('0x1b')],'include':_0x565b3e[_0x24a0('0x1a')]?_[_0x24a0('0x1c')](_0x565b3e[_0x24a0('0x1a')],function(_0x2f4fa4){return{'model':db[_0x2f4fa4[_0x24a0('0x1d')]],'as':_0x2f4fa4['as'],'attributes':_0x2f4fa4[_0x24a0('0x1b')],'include':_0x2f4fa4[_0x24a0('0x1a')]?_[_0x24a0('0x1c')](_0x2f4fa4[_0x24a0('0x1a')],function(_0x27f686){return{'model':db[_0x27f686[_0x24a0('0x1d')]],'as':_0x27f686['as'],'attributes':_0x27f686['attributes']};}):[]};}):[]};}):[]:[]})[_0x24a0('0xa')](function(_0x24c00d){logger[_0x24a0('0xb')]('ShowServicenowAccount',_0x1aae7f);logger['debug']('ShowServicenowAccount',_0x1aae7f,JSON[_0x24a0('0x10')](_0x24c00d));_0x15da41(_0x24c00d);})[_0x24a0('0x20')](function(_0x44b378){logger[_0x24a0('0x11')](_0x24a0('0x1e'),_0x44b378['message'],_0x1aae7f);_0x32007e(_0x28dc30['error'](0x1f4,_0x44b378[_0x24a0('0x12')]));});});}; \ No newline at end of file +var _0xc270=['catch','ShowServicenowAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model'];(function(_0x17cded,_0xa51b6b){var _0x41b11f=function(_0xa647a){while(--_0xa647a){_0x17cded['push'](_0x17cded['shift']());}};_0x41b11f(++_0xa51b6b);}(_0xc270,0x1e4));var _0x0c27=function(_0x147796,_0x3df473){_0x147796=_0x147796-0x0;var _0x55b105=_0xc270[_0x147796];return _0x55b105;};'use strict';var _=require(_0x0c27('0x0'));var util=require('util');var moment=require(_0x0c27('0x1'));var BPromise=require(_0x0c27('0x2'));var rs=require(_0x0c27('0x3'));var fs=require('fs');var Redis=require(_0x0c27('0x4'));var db=require(_0x0c27('0x5'))['db'];var utils=require(_0x0c27('0x6'));var logger=require('../../config/logger')(_0x0c27('0x7'));var config=require(_0x0c27('0x8'));var jayson=require(_0x0c27('0x9'));var client=jayson[_0x0c27('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3796f3,_0x87b3c8,_0x5ecc0a){return new BPromise(function(_0x518399,_0xb0828){return client[_0x0c27('0xb')](_0x3796f3,_0x5ecc0a)[_0x0c27('0xc')](function(_0x79829c){logger[_0x0c27('0xd')](_0x0c27('0xe'),_0x87b3c8,_0x0c27('0xf'));logger[_0x0c27('0x10')](_0x0c27('0x11'),_0x87b3c8,_0x0c27('0xf'),JSON[_0x0c27('0x12')](_0x79829c));if(_0x79829c[_0x0c27('0x13')]){if(_0x79829c[_0x0c27('0x13')][_0x0c27('0x14')]===0x1f4){logger[_0x0c27('0x13')](_0x0c27('0xe'),_0x87b3c8,_0x79829c[_0x0c27('0x13')][_0x0c27('0x15')]);return _0xb0828(_0x79829c[_0x0c27('0x13')][_0x0c27('0x15')]);}logger[_0x0c27('0x13')](_0x0c27('0xe'),_0x87b3c8,_0x79829c[_0x0c27('0x13')]['message']);return _0x518399(_0x79829c[_0x0c27('0x13')]['message']);}else{logger['info'](_0x0c27('0xe'),_0x87b3c8,_0x0c27('0xf'));_0x518399(_0x79829c[_0x0c27('0x16')][_0x0c27('0x15')]);}})['catch'](function(_0x1307b2){logger[_0x0c27('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x87b3c8,_0x1307b2);_0xb0828(_0x1307b2);});});}exports[_0x0c27('0x17')]=function(_0xc14271){var _0x4b1d2a=this;return new Promise(function(_0x2b07de,_0x534357){return db[_0x0c27('0x18')][_0x0c27('0x19')]({'raw':_0xc14271[_0x0c27('0x1a')]?_0xc14271[_0x0c27('0x1a')][_0x0c27('0x1b')]===undefined?!![]:![]:!![],'where':_0xc14271[_0x0c27('0x1a')]?_0xc14271[_0x0c27('0x1a')][_0x0c27('0x1c')]||null:null,'attributes':_0xc14271[_0x0c27('0x1a')]?_0xc14271[_0x0c27('0x1a')][_0x0c27('0x1d')]||null:null,'limit':_0xc14271[_0x0c27('0x1a')]?_0xc14271[_0x0c27('0x1a')][_0x0c27('0x1e')]||null:null,'include':_0xc14271[_0x0c27('0x1a')]?_0xc14271[_0x0c27('0x1a')]['include']?_[_0x0c27('0x1f')](_0xc14271[_0x0c27('0x1a')][_0x0c27('0x20')],function(_0x44b945){return{'model':db[_0x44b945[_0x0c27('0x21')]],'as':_0x44b945['as'],'attributes':_0x44b945['attributes'],'include':_0x44b945['include']?_[_0x0c27('0x1f')](_0x44b945[_0x0c27('0x20')],function(_0x34d85b){return{'model':db[_0x34d85b[_0x0c27('0x21')]],'as':_0x34d85b['as'],'attributes':_0x34d85b[_0x0c27('0x1d')],'include':_0x34d85b['include']?_[_0x0c27('0x1f')](_0x34d85b[_0x0c27('0x20')],function(_0x632fd1){return{'model':db[_0x632fd1['model']],'as':_0x632fd1['as'],'attributes':_0x632fd1[_0x0c27('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0c27('0xc')](function(_0x509d8c){logger[_0x0c27('0xd')]('GetServicenowAccount',_0xc14271);logger['debug'](_0x0c27('0x17'),_0xc14271,JSON[_0x0c27('0x12')](_0x509d8c));_0x2b07de(_0x509d8c);})[_0x0c27('0x22')](function(_0x1b756e){logger[_0x0c27('0x13')](_0x0c27('0x17'),_0x1b756e[_0x0c27('0x15')],_0xc14271);_0x534357(_0x4b1d2a[_0x0c27('0x13')](0x1f4,_0x1b756e['message']));});});};exports[_0x0c27('0x23')]=function(_0x8ce58b){var _0x47450f=this;return new Promise(function(_0xf6e653,_0xdd4b17){return db[_0x0c27('0x18')][_0x0c27('0x24')]({'raw':_0x8ce58b[_0x0c27('0x1a')]?_0x8ce58b['options'][_0x0c27('0x1b')]===undefined?!![]:![]:!![],'where':_0x8ce58b[_0x0c27('0x1a')]?_0x8ce58b[_0x0c27('0x1a')]['where']||null:null,'attributes':_0x8ce58b[_0x0c27('0x1a')]?_0x8ce58b[_0x0c27('0x1a')]['attributes']||null:null,'include':_0x8ce58b[_0x0c27('0x1a')]?_0x8ce58b['options'][_0x0c27('0x20')]?_[_0x0c27('0x1f')](_0x8ce58b['options']['include'],function(_0x5b5144){return{'model':db[_0x5b5144[_0x0c27('0x21')]],'as':_0x5b5144['as'],'attributes':_0x5b5144['attributes'],'include':_0x5b5144['include']?_[_0x0c27('0x1f')](_0x5b5144[_0x0c27('0x20')],function(_0x4550d5){return{'model':db[_0x4550d5[_0x0c27('0x21')]],'as':_0x4550d5['as'],'attributes':_0x4550d5[_0x0c27('0x1d')],'include':_0x4550d5[_0x0c27('0x20')]?_[_0x0c27('0x1f')](_0x4550d5[_0x0c27('0x20')],function(_0x3d96ce){return{'model':db[_0x3d96ce[_0x0c27('0x21')]],'as':_0x3d96ce['as'],'attributes':_0x3d96ce['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c27('0xc')](function(_0x42c069){logger[_0x0c27('0xd')](_0x0c27('0x23'),_0x8ce58b);logger[_0x0c27('0x10')](_0x0c27('0x23'),_0x8ce58b,JSON[_0x0c27('0x12')](_0x42c069));_0xf6e653(_0x42c069);})[_0x0c27('0x22')](function(_0x27f844){logger[_0x0c27('0x13')]('ShowServicenowAccount',_0x27f844[_0x0c27('0x15')],_0x8ce58b);_0xdd4b17(_0x47450f[_0x0c27('0x13')](0x1f4,_0x27f844[_0x0c27('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 26e512e..54a88a1 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 _0x9a48=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x6f5598,_0xabeb74){var _0x1e1325=function(_0x1da246){while(--_0x1da246){_0x6f5598['push'](_0x6f5598['shift']());}};_0x1e1325(++_0xabeb74);}(_0x9a48,0x1ca));var _0x89a4=function(_0xb8d9cf,_0x455825){_0xb8d9cf=_0xb8d9cf-0x0;var _0x5a2d3b=_0x9a48[_0xb8d9cf];return _0x5a2d3b;};'use strict';var multer=require(_0x89a4('0x0'));var util=require(_0x89a4('0x1'));var path=require('path');var timeout=require(_0x89a4('0x2'));var express=require(_0x89a4('0x3'));var router=express[_0x89a4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x89a4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x89a4('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x89a4('0x7')]('/',auth[_0x89a4('0x8')](),controller['index']);router['get'](_0x89a4('0x9'),auth[_0x89a4('0x8')](),controller[_0x89a4('0xa')]);router['get'](_0x89a4('0xb'),auth[_0x89a4('0x8')](),controller['getFields']);router[_0x89a4('0x7')](_0x89a4('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x89a4('0x7')](_0x89a4('0xd'),auth[_0x89a4('0x8')](),controller[_0x89a4('0xe')]);router[_0x89a4('0xf')]('/',auth[_0x89a4('0x8')](),controller[_0x89a4('0x10')]);router[_0x89a4('0x11')](_0x89a4('0x9'),auth[_0x89a4('0x8')](),controller[_0x89a4('0x12')]);router[_0x89a4('0x13')](_0x89a4('0x9'),auth['isAuthenticated'](),controller[_0x89a4('0x14')]);module[_0x89a4('0x15')]=router; \ No newline at end of file +var _0xf726=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','exports'];(function(_0x5b0c7d,_0x4ad3e2){var _0x42aab8=function(_0x5dce29){while(--_0x5dce29){_0x5b0c7d['push'](_0x5b0c7d['shift']());}};_0x42aab8(++_0x4ad3e2);}(_0xf726,0x198));var _0x6f72=function(_0x36d54e,_0x1096fd){_0x36d54e=_0x36d54e-0x0;var _0x42bc4e=_0xf726[_0x36d54e];return _0x42bc4e;};'use strict';var multer=require(_0x6f72('0x0'));var util=require(_0x6f72('0x1'));var path=require(_0x6f72('0x2'));var timeout=require(_0x6f72('0x3'));var express=require(_0x6f72('0x4'));var router=express[_0x6f72('0x5')]();var fs_extra=require(_0x6f72('0x6'));var auth=require(_0x6f72('0x7'));var interaction=require(_0x6f72('0x8'));var config=require('../../config/environment');var controller=require(_0x6f72('0x9'));router[_0x6f72('0xa')]('/',auth[_0x6f72('0xb')](),controller[_0x6f72('0xc')]);router[_0x6f72('0xa')](_0x6f72('0xd'),auth[_0x6f72('0xb')](),controller[_0x6f72('0xe')]);router[_0x6f72('0xa')](_0x6f72('0xf'),auth[_0x6f72('0xb')](),controller['getFields']);router[_0x6f72('0xa')](_0x6f72('0x10'),auth['isAuthenticated'](),controller[_0x6f72('0x11')]);router[_0x6f72('0xa')](_0x6f72('0x12'),auth['isAuthenticated'](),controller[_0x6f72('0x13')]);router[_0x6f72('0x14')]('/',auth[_0x6f72('0xb')](),controller['create']);router[_0x6f72('0x15')](_0x6f72('0xd'),auth[_0x6f72('0xb')](),controller['update']);router[_0x6f72('0x16')](_0x6f72('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x6f72('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index d7f252c..98d0919 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 _0x0be0=['STRING'];(function(_0x4f01a9,_0x4a0d3a){var _0x5f5ade=function(_0xbd7ca6){while(--_0xbd7ca6){_0x4f01a9['push'](_0x4f01a9['shift']());}};_0x5f5ade(++_0x4a0d3a);}(_0x0be0,0x19c));var _0x00be=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x0be0[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x00be('0x0')]},'description':{'type':Sequelize[_0x00be('0x0')]}}; \ No newline at end of file +var _0x4ccb=['STRING','sequelize'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x4ccb,0x89));var _0xb4cc=function(_0x39a8b2,_0x2b6b3f){_0x39a8b2=_0x39a8b2-0x0;var _0x2b1277=_0x4ccb[_0x39a8b2];return _0x2b1277;};'use strict';var Sequelize=require(_0xb4cc('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb4cc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 41c33b6..8df12a2 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 _0x1596=['order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','getFields','findOne','getSubjects','ServicenowField','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','undefined','count','limit','set','json','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x1596,0x1e7));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('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6159('0x3'));var BPromise=require(_0x6159('0x4'));var Mustache=require('mustache');var util=require(_0x6159('0x5'));var path=require(_0x6159('0x6'));var sox=require(_0x6159('0x7'));var csv=require(_0x6159('0x8'));var ejs=require(_0x6159('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6159('0xa'));var squel=require('squel');var crypto=require(_0x6159('0xb'));var jsforce=require(_0x6159('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6159('0x8'));var querystring=require('querystring');var Papa=require(_0x6159('0xd'));var Redis=require('ioredis');var authService=require(_0x6159('0xe'));var qs=require(_0x6159('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6159('0x10'))(_0x6159('0x11'));var utils=require(_0x6159('0x12'));var config=require(_0x6159('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a4a47,_0x4dc188){_0x4dc188=_0x4dc188||0xcc;return function(_0x56595c){if(_0x56595c){return _0x5a4a47['sendStatus'](_0x4dc188);}return _0x5a4a47[_0x6159('0x14')](_0x4dc188)[_0x6159('0x15')]();};}function respondWithResult(_0x4844d9,_0x234cb6){_0x234cb6=_0x234cb6||0xc8;return function(_0x22ea9b){if(_0x22ea9b){return _0x4844d9[_0x6159('0x14')](_0x234cb6)['json'](_0x22ea9b);}};}function respondWithFilteredResult(_0x4ea7a9,_0x2c13e5){return function(_0x2fc24b){if(_0x2fc24b){var _0x2e9817=typeof _0x2c13e5[_0x6159('0x16')]===_0x6159('0x17')&&typeof _0x2c13e5['limit']===_0x6159('0x17');var _0x215973=_0x2fc24b['count'];var _0x2cfdc0=_0x2e9817?0x0:_0x2c13e5['offset'];var _0x3d3a42=_0x2e9817?_0x2fc24b[_0x6159('0x18')]:_0x2c13e5[_0x6159('0x16')]+_0x2c13e5[_0x6159('0x19')];var _0x54cd96;if(_0x3d3a42>=_0x215973){_0x3d3a42=_0x215973;_0x54cd96=0xc8;}else{_0x54cd96=0xce;}_0x4ea7a9[_0x6159('0x14')](_0x54cd96);return _0x4ea7a9[_0x6159('0x1a')]('Content-Range',_0x2cfdc0+'-'+_0x3d3a42+'/'+_0x215973)[_0x6159('0x1b')](_0x2fc24b);}return null;};}function patchUpdates(_0x5728a0){return function(_0x193684){try{jsonpatch['apply'](_0x193684,_0x5728a0,!![]);}catch(_0x6fe539){return BPromise[_0x6159('0x1c')](_0x6fe539);}return _0x193684[_0x6159('0x1d')]();};}function saveUpdates(_0xa1d343,_0x592aef){return function(_0x36fe8f){if(_0x36fe8f){return _0x36fe8f[_0x6159('0x1e')](_0xa1d343)[_0x6159('0x1f')](function(_0x2af684){return _0x2af684;});}return null;};}function removeEntity(_0x5355a9,_0x4b60f2){return function(_0x2cc030){if(_0x2cc030){return _0x2cc030[_0x6159('0x20')]()[_0x6159('0x1f')](function(){_0x5355a9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e22a9,_0xffae56){return function(_0x534ba2){if(!_0x534ba2){_0x5e22a9[_0x6159('0x21')](0x194);}return _0x534ba2;};}function handleError(_0x57f1c8,_0x390cdc){_0x390cdc=_0x390cdc||0x1f4;return function(_0x24a2a2){logger[_0x6159('0x22')](_0x24a2a2[_0x6159('0x23')]);if(_0x24a2a2[_0x6159('0x24')]){delete _0x24a2a2[_0x6159('0x24')];}_0x57f1c8[_0x6159('0x14')](_0x390cdc)['send'](_0x24a2a2);};}exports[_0x6159('0x25')]=function(_0x4f6f37,_0x3dc54b){var _0x192805={},_0x531d49={},_0x46e42c={'count':0x0,'rows':[]};var _0x176089=_[_0x6159('0x26')](db[_0x6159('0x27')][_0x6159('0x28')],function(_0xca93d9){return{'name':_0xca93d9[_0x6159('0x29')],'type':_0xca93d9[_0x6159('0x2a')][_0x6159('0x2b')]};});_0x531d49['model']=_[_0x6159('0x26')](_0x176089,_0x6159('0x24'));_0x531d49[_0x6159('0x2c')]=_['keys'](_0x4f6f37['query']);_0x531d49[_0x6159('0x2d')]=_[_0x6159('0x2e')](_0x531d49[_0x6159('0x2f')],_0x531d49['query']);_0x192805[_0x6159('0x30')]=_[_0x6159('0x2e')](_0x531d49[_0x6159('0x2f')],qs[_0x6159('0x31')](_0x4f6f37[_0x6159('0x2c')][_0x6159('0x31')]));_0x192805['attributes']=_0x192805[_0x6159('0x30')][_0x6159('0x32')]?_0x192805[_0x6159('0x30')]:_0x531d49[_0x6159('0x2f')];if(!_0x4f6f37[_0x6159('0x2c')]['hasOwnProperty'](_0x6159('0x33'))){_0x192805[_0x6159('0x19')]=qs[_0x6159('0x19')](_0x4f6f37['query'][_0x6159('0x19')]);_0x192805[_0x6159('0x16')]=qs[_0x6159('0x16')](_0x4f6f37[_0x6159('0x2c')][_0x6159('0x16')]);}_0x192805[_0x6159('0x34')]=qs[_0x6159('0x35')](_0x4f6f37['query']['sort']);_0x192805[_0x6159('0x36')]=qs[_0x6159('0x2d')](_[_0x6159('0x37')](_0x4f6f37[_0x6159('0x2c')],_0x531d49[_0x6159('0x2d')]),_0x176089);if(_0x4f6f37[_0x6159('0x2c')][_0x6159('0x38')]){_0x192805[_0x6159('0x36')]=_[_0x6159('0x39')](_0x192805['where'],{'$or':_[_0x6159('0x26')](_0x176089,function(_0xcafc32){if(_0xcafc32[_0x6159('0x2a')]!==_0x6159('0x3a')){var _0x3891d4={};_0x3891d4[_0xcafc32['name']]={'$like':'%'+_0x4f6f37['query']['filter']+'%'};return _0x3891d4;}})});}_0x192805=_[_0x6159('0x39')]({},_0x192805,_0x4f6f37['options']);var _0x3b54c5={'where':_0x192805[_0x6159('0x36')]};return db[_0x6159('0x27')][_0x6159('0x18')](_0x3b54c5)[_0x6159('0x1f')](function(_0xc492e2){_0x46e42c[_0x6159('0x18')]=_0xc492e2;if(_0x4f6f37[_0x6159('0x2c')][_0x6159('0x3b')]){_0x192805[_0x6159('0x3c')]=[{'all':!![]}];}return db[_0x6159('0x27')][_0x6159('0x3d')](_0x192805);})[_0x6159('0x1f')](function(_0x139bb3){_0x46e42c[_0x6159('0x3e')]=_0x139bb3;return _0x46e42c;})[_0x6159('0x1f')](respondWithFilteredResult(_0x3dc54b,_0x192805))[_0x6159('0x3f')](handleError(_0x3dc54b,null));};exports[_0x6159('0x40')]=function(_0x3a7791,_0x5e0a10){var _0x148ab5={'raw':![],'where':{'id':_0x3a7791[_0x6159('0x41')]['id']}},_0x386bb9={};_0x386bb9['model']=_['keys'](db[_0x6159('0x27')]['rawAttributes']);_0x386bb9['query']=_[_0x6159('0x42')](_0x3a7791['query']);_0x386bb9['filters']=_[_0x6159('0x2e')](_0x386bb9[_0x6159('0x2f')],_0x386bb9[_0x6159('0x2c')]);_0x148ab5[_0x6159('0x30')]=_[_0x6159('0x2e')](_0x386bb9[_0x6159('0x2f')],qs[_0x6159('0x31')](_0x3a7791['query'][_0x6159('0x31')]));_0x148ab5[_0x6159('0x30')]=_0x148ab5[_0x6159('0x30')][_0x6159('0x32')]?_0x148ab5[_0x6159('0x30')]:_0x386bb9[_0x6159('0x2f')];if(_0x3a7791['query'][_0x6159('0x3b')]){_0x148ab5['include']=[{'all':!![]}];}_0x148ab5=_[_0x6159('0x39')]({},_0x148ab5,_0x3a7791[_0x6159('0x43')]);return db[_0x6159('0x27')][_0x6159('0x44')](_0x148ab5)['then'](handleEntityNotFound(_0x5e0a10,null))[_0x6159('0x1f')](respondWithResult(_0x5e0a10,null))[_0x6159('0x3f')](handleError(_0x5e0a10,null));};exports[_0x6159('0x45')]=function(_0x16ef32,_0x231664){return db[_0x6159('0x27')]['create'](_0x16ef32[_0x6159('0x46')],{})[_0x6159('0x1f')](respondWithResult(_0x231664,0xc9))[_0x6159('0x3f')](handleError(_0x231664,null));};exports[_0x6159('0x1e')]=function(_0x350901,_0x583260){if(_0x350901[_0x6159('0x46')]['id']){delete _0x350901['body']['id'];}return db['ServicenowConfiguration'][_0x6159('0x44')]({'where':{'id':_0x350901[_0x6159('0x41')]['id']}})[_0x6159('0x1f')](handleEntityNotFound(_0x583260,null))[_0x6159('0x1f')](saveUpdates(_0x350901[_0x6159('0x46')],null))[_0x6159('0x1f')](respondWithResult(_0x583260,null))[_0x6159('0x3f')](handleError(_0x583260,null));};exports['destroy']=function(_0xac72bf,_0x3e4000){return db['ServicenowConfiguration'][_0x6159('0x44')]({'where':{'id':_0xac72bf[_0x6159('0x41')]['id']}})[_0x6159('0x1f')](handleEntityNotFound(_0x3e4000,null))['then'](removeEntity(_0x3e4000,null))[_0x6159('0x3f')](handleError(_0x3e4000,null));};exports[_0x6159('0x47')]=function(_0x24fb8d,_0x3d944a,_0x4123a5){var _0x3478e0={};var _0x5e3e2b={};var _0x48c91b;var _0x29ebe7;return db['ServicenowConfiguration'][_0x6159('0x48')]({'where':{'id':_0x24fb8d[_0x6159('0x41')]['id']}})[_0x6159('0x1f')](handleEntityNotFound(_0x3d944a,null))[_0x6159('0x1f')](function(_0x151aa8){if(_0x151aa8){_0x48c91b=_0x151aa8;_0x5e3e2b[_0x6159('0x2f')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x5e3e2b[_0x6159('0x2c')]=_['keys'](_0x24fb8d[_0x6159('0x2c')]);_0x5e3e2b['filters']=_[_0x6159('0x2e')](_0x5e3e2b[_0x6159('0x2f')],_0x5e3e2b[_0x6159('0x2c')]);_0x3478e0['attributes']=_[_0x6159('0x2e')](_0x5e3e2b[_0x6159('0x2f')],qs[_0x6159('0x31')](_0x24fb8d[_0x6159('0x2c')][_0x6159('0x31')]));_0x3478e0[_0x6159('0x30')]=_0x3478e0[_0x6159('0x30')]['length']?_0x3478e0[_0x6159('0x30')]:_0x5e3e2b[_0x6159('0x2f')];_0x3478e0[_0x6159('0x34')]=qs['sort'](_0x24fb8d['query'][_0x6159('0x35')]);_0x3478e0[_0x6159('0x36')]=qs[_0x6159('0x2d')](_[_0x6159('0x37')](_0x24fb8d[_0x6159('0x2c')],_0x5e3e2b[_0x6159('0x2d')]));if(_0x24fb8d['query'][_0x6159('0x38')]){_0x3478e0[_0x6159('0x36')]=_[_0x6159('0x39')](_0x3478e0[_0x6159('0x36')],{'$or':_['map'](_0x3478e0[_0x6159('0x30')],function(_0x40da0a){var _0xa34777={};_0xa34777[_0x40da0a]={'$like':'%'+_0x24fb8d[_0x6159('0x2c')][_0x6159('0x38')]+'%'};return _0xa34777;})});}_0x3478e0=_['merge']({},_0x3478e0,_0x24fb8d[_0x6159('0x43')]);return _0x48c91b[_0x6159('0x47')](_0x3478e0);}})['then'](function(_0x283c92){if(_0x283c92){_0x29ebe7=_0x283c92[_0x6159('0x32')];if(!_0x24fb8d['query']['hasOwnProperty'](_0x6159('0x33'))){_0x3478e0[_0x6159('0x19')]=qs['limit'](_0x24fb8d[_0x6159('0x2c')][_0x6159('0x19')]);_0x3478e0['offset']=qs[_0x6159('0x16')](_0x24fb8d['query']['offset']);}return _0x48c91b[_0x6159('0x47')](_0x3478e0);}})[_0x6159('0x1f')](function(_0x292f70){if(_0x292f70){return _0x292f70?{'count':_0x29ebe7,'rows':_0x292f70}:null;}})['then'](respondWithResult(_0x3d944a,null))[_0x6159('0x3f')](handleError(_0x3d944a,null));};exports[_0x6159('0x49')]=function(_0x19ab64,_0x21cd19,_0x2d7785){var _0x25848b={};var _0x223087={};var _0x30b9f6;var _0x239c0a;return db[_0x6159('0x27')]['findOne']({'where':{'id':_0x19ab64['params']['id']}})[_0x6159('0x1f')](handleEntityNotFound(_0x21cd19,null))[_0x6159('0x1f')](function(_0x351c2f){if(_0x351c2f){_0x30b9f6=_0x351c2f;_0x223087[_0x6159('0x2f')]=_[_0x6159('0x42')](db[_0x6159('0x4a')][_0x6159('0x28')]);_0x223087[_0x6159('0x2c')]=_[_0x6159('0x42')](_0x19ab64[_0x6159('0x2c')]);_0x223087[_0x6159('0x2d')]=_[_0x6159('0x2e')](_0x223087[_0x6159('0x2f')],_0x223087[_0x6159('0x2c')]);_0x25848b[_0x6159('0x30')]=_[_0x6159('0x2e')](_0x223087[_0x6159('0x2f')],qs['fields'](_0x19ab64['query'][_0x6159('0x31')]));_0x25848b[_0x6159('0x30')]=_0x25848b[_0x6159('0x30')][_0x6159('0x32')]?_0x25848b['attributes']:_0x223087[_0x6159('0x2f')];_0x25848b['order']=qs[_0x6159('0x35')](_0x19ab64[_0x6159('0x2c')][_0x6159('0x35')]);_0x25848b['where']=qs['filters'](_[_0x6159('0x37')](_0x19ab64[_0x6159('0x2c')],_0x223087['filters']));if(_0x19ab64[_0x6159('0x2c')][_0x6159('0x38')]){_0x25848b[_0x6159('0x36')]=_[_0x6159('0x39')](_0x25848b[_0x6159('0x36')],{'$or':_[_0x6159('0x26')](_0x25848b['attributes'],function(_0x4ae4ec){var _0x5745a6={};_0x5745a6[_0x4ae4ec]={'$like':'%'+_0x19ab64['query'][_0x6159('0x38')]+'%'};return _0x5745a6;})});}_0x25848b=_[_0x6159('0x39')]({},_0x25848b,_0x19ab64[_0x6159('0x43')]);return _0x30b9f6[_0x6159('0x49')](_0x25848b);}})['then'](function(_0x4814c4){if(_0x4814c4){_0x239c0a=_0x4814c4[_0x6159('0x32')];if(!_0x19ab64[_0x6159('0x2c')]['hasOwnProperty'](_0x6159('0x33'))){_0x25848b[_0x6159('0x19')]=qs['limit'](_0x19ab64['query']['limit']);_0x25848b[_0x6159('0x16')]=qs['offset'](_0x19ab64[_0x6159('0x2c')][_0x6159('0x16')]);}return _0x30b9f6['getSubjects'](_0x25848b);}})[_0x6159('0x1f')](function(_0x333000){if(_0x333000){return _0x333000?{'count':_0x239c0a,'rows':_0x333000}:null;}})['then'](respondWithResult(_0x21cd19,null))[_0x6159('0x3f')](handleError(_0x21cd19,null));};exports[_0x6159('0x4b')]=function(_0x221178,_0x4248ee,_0x132a24){var _0x1264bb={};var _0x8be27d={};var _0x213b27;var _0x43cfb1;return db[_0x6159('0x27')]['findOne']({'where':{'id':_0x221178[_0x6159('0x41')]['id']}})[_0x6159('0x1f')](handleEntityNotFound(_0x4248ee,null))[_0x6159('0x1f')](function(_0x329db2){if(_0x329db2){_0x213b27=_0x329db2;_0x8be27d[_0x6159('0x2f')]=_['keys'](db[_0x6159('0x4a')]['rawAttributes']);_0x8be27d[_0x6159('0x2c')]=_[_0x6159('0x42')](_0x221178[_0x6159('0x2c')]);_0x8be27d[_0x6159('0x2d')]=_['intersection'](_0x8be27d[_0x6159('0x2f')],_0x8be27d[_0x6159('0x2c')]);_0x1264bb[_0x6159('0x30')]=_['intersection'](_0x8be27d[_0x6159('0x2f')],qs['fields'](_0x221178[_0x6159('0x2c')][_0x6159('0x31')]));_0x1264bb[_0x6159('0x30')]=_0x1264bb[_0x6159('0x30')][_0x6159('0x32')]?_0x1264bb[_0x6159('0x30')]:_0x8be27d[_0x6159('0x2f')];_0x1264bb[_0x6159('0x34')]=qs[_0x6159('0x35')](_0x221178[_0x6159('0x2c')][_0x6159('0x35')]);_0x1264bb[_0x6159('0x36')]=qs['filters'](_[_0x6159('0x37')](_0x221178['query'],_0x8be27d[_0x6159('0x2d')]));if(_0x221178[_0x6159('0x2c')]['filter']){_0x1264bb[_0x6159('0x36')]=_['merge'](_0x1264bb[_0x6159('0x36')],{'$or':_[_0x6159('0x26')](_0x1264bb[_0x6159('0x30')],function(_0x2c9dae){var _0x5635e9={};_0x5635e9[_0x2c9dae]={'$like':'%'+_0x221178['query'][_0x6159('0x38')]+'%'};return _0x5635e9;})});}_0x1264bb=_['merge']({},_0x1264bb,_0x221178[_0x6159('0x43')]);return _0x213b27['getDescriptions'](_0x1264bb);}})[_0x6159('0x1f')](function(_0x9256af){if(_0x9256af){_0x43cfb1=_0x9256af[_0x6159('0x32')];if(!_0x221178[_0x6159('0x2c')][_0x6159('0x4c')]('nolimit')){_0x1264bb[_0x6159('0x19')]=qs['limit'](_0x221178[_0x6159('0x2c')][_0x6159('0x19')]);_0x1264bb[_0x6159('0x16')]=qs['offset'](_0x221178[_0x6159('0x2c')][_0x6159('0x16')]);}return _0x213b27[_0x6159('0x4b')](_0x1264bb);}})[_0x6159('0x1f')](function(_0x59e42b){if(_0x59e42b){return _0x59e42b?{'count':_0x43cfb1,'rows':_0x59e42b}:null;}})['then'](respondWithResult(_0x4248ee,null))[_0x6159('0x3f')](handleError(_0x4248ee,null));}; \ No newline at end of file +var _0xe130=['count','set','apply','save','update','destroy','then','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','options','nolimit','findOne','getSubjects','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit'];(function(_0x2d0c78,_0x1d75bc){var _0x5510d7=function(_0x2025a4){while(--_0x2025a4){_0x2d0c78['push'](_0x2d0c78['shift']());}};_0x5510d7(++_0x1d75bc);}(_0xe130,0x1ac));var _0x0e13=function(_0x4562e4,_0x6e7fbd){_0x4562e4=_0x4562e4-0x0;var _0x75e43e=_0xe130[_0x4562e4];return _0x75e43e;};'use strict';var emlformat=require(_0x0e13('0x0'));var rimraf=require(_0x0e13('0x1'));var zipdir=require(_0x0e13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e13('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0e13('0x4'));var util=require(_0x0e13('0x5'));var path=require(_0x0e13('0x6'));var sox=require(_0x0e13('0x7'));var csv=require(_0x0e13('0x8'));var ejs=require(_0x0e13('0x9'));var fs=require('fs');var fs_extra=require(_0x0e13('0xa'));var _=require('lodash');var squel=require(_0x0e13('0xb'));var crypto=require(_0x0e13('0xc'));var jsforce=require(_0x0e13('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0e13('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e13('0xf'));var qs=require(_0x0e13('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0e13('0x11'));var utils=require(_0x0e13('0x12'));var config=require(_0x0e13('0x13'));var licenseUtil=require(_0x0e13('0x14'));var db=require(_0x0e13('0x15'))['db'];function respondWithStatusCode(_0x10a662,_0x387473){_0x387473=_0x387473||0xcc;return function(_0x42763a){if(_0x42763a){return _0x10a662[_0x0e13('0x16')](_0x387473);}return _0x10a662[_0x0e13('0x17')](_0x387473)[_0x0e13('0x18')]();};}function respondWithResult(_0x1f8c58,_0x26fc22){_0x26fc22=_0x26fc22||0xc8;return function(_0x324b81){if(_0x324b81){return _0x1f8c58[_0x0e13('0x17')](_0x26fc22)['json'](_0x324b81);}};}function respondWithFilteredResult(_0xba3df2,_0x127f66){return function(_0x518c10){if(_0x518c10){var _0x3b31f0=typeof _0x127f66[_0x0e13('0x19')]===_0x0e13('0x1a')&&typeof _0x127f66[_0x0e13('0x1b')]===_0x0e13('0x1a');var _0x5582ff=_0x518c10[_0x0e13('0x1c')];var _0x3efa0b=_0x3b31f0?0x0:_0x127f66[_0x0e13('0x19')];var _0x38cd85=_0x3b31f0?_0x518c10[_0x0e13('0x1c')]:_0x127f66[_0x0e13('0x19')]+_0x127f66[_0x0e13('0x1b')];var _0x552d49;if(_0x38cd85>=_0x5582ff){_0x38cd85=_0x5582ff;_0x552d49=0xc8;}else{_0x552d49=0xce;}_0xba3df2[_0x0e13('0x17')](_0x552d49);return _0xba3df2[_0x0e13('0x1d')]('Content-Range',_0x3efa0b+'-'+_0x38cd85+'/'+_0x5582ff)['json'](_0x518c10);}return null;};}function patchUpdates(_0x1146a8){return function(_0x24bba9){try{jsonpatch[_0x0e13('0x1e')](_0x24bba9,_0x1146a8,!![]);}catch(_0x3348a7){return BPromise['reject'](_0x3348a7);}return _0x24bba9[_0x0e13('0x1f')]();};}function saveUpdates(_0x20fac4,_0x1475f1){return function(_0x515a76){if(_0x515a76){return _0x515a76[_0x0e13('0x20')](_0x20fac4)['then'](function(_0x623025){return _0x623025;});}return null;};}function removeEntity(_0x49cb52,_0x497a24){return function(_0x36fb76){if(_0x36fb76){return _0x36fb76[_0x0e13('0x21')]()[_0x0e13('0x22')](function(){_0x49cb52[_0x0e13('0x17')](0xcc)[_0x0e13('0x18')]();});}};}function handleEntityNotFound(_0x47925b,_0x1530cf){return function(_0x5d3473){if(!_0x5d3473){_0x47925b[_0x0e13('0x16')](0x194);}return _0x5d3473;};}function handleError(_0x3169b5,_0x12a6fe){_0x12a6fe=_0x12a6fe||0x1f4;return function(_0x5c3da6){logger[_0x0e13('0x23')](_0x5c3da6[_0x0e13('0x24')]);if(_0x5c3da6[_0x0e13('0x25')]){delete _0x5c3da6[_0x0e13('0x25')];}_0x3169b5['status'](_0x12a6fe)[_0x0e13('0x26')](_0x5c3da6);};}exports[_0x0e13('0x27')]=function(_0x107fc7,_0x5e7b06){var _0x18f893={},_0x479ff1={},_0x56d6b0={'count':0x0,'rows':[]};var _0x8d4ece=_['map'](db[_0x0e13('0x28')][_0x0e13('0x29')],function(_0xdab273){return{'name':_0xdab273[_0x0e13('0x2a')],'type':_0xdab273[_0x0e13('0x2b')][_0x0e13('0x2c')]};});_0x479ff1[_0x0e13('0x2d')]=_[_0x0e13('0x2e')](_0x8d4ece,_0x0e13('0x25'));_0x479ff1[_0x0e13('0x2f')]=_[_0x0e13('0x30')](_0x107fc7['query']);_0x479ff1[_0x0e13('0x31')]=_[_0x0e13('0x32')](_0x479ff1['model'],_0x479ff1[_0x0e13('0x2f')]);_0x18f893[_0x0e13('0x33')]=_[_0x0e13('0x32')](_0x479ff1[_0x0e13('0x2d')],qs[_0x0e13('0x34')](_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x34')]));_0x18f893['attributes']=_0x18f893[_0x0e13('0x33')][_0x0e13('0x35')]?_0x18f893[_0x0e13('0x33')]:_0x479ff1['model'];if(!_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x36')]('nolimit')){_0x18f893[_0x0e13('0x1b')]=qs[_0x0e13('0x1b')](_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x1b')]);_0x18f893[_0x0e13('0x19')]=qs[_0x0e13('0x19')](_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x19')]);}_0x18f893[_0x0e13('0x37')]=qs[_0x0e13('0x38')](_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x38')]);_0x18f893[_0x0e13('0x39')]=qs['filters'](_[_0x0e13('0x3a')](_0x107fc7[_0x0e13('0x2f')],_0x479ff1[_0x0e13('0x31')]),_0x8d4ece);if(_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x3b')]){_0x18f893[_0x0e13('0x39')]=_['merge'](_0x18f893[_0x0e13('0x39')],{'$or':_[_0x0e13('0x2e')](_0x8d4ece,function(_0x3c45a7){if(_0x3c45a7[_0x0e13('0x2b')]!==_0x0e13('0x3c')){var _0x411918={};_0x411918[_0x3c45a7[_0x0e13('0x25')]]={'$like':'%'+_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x3b')]+'%'};return _0x411918;}})});}_0x18f893=_[_0x0e13('0x3d')]({},_0x18f893,_0x107fc7['options']);var _0x497bd1={'where':_0x18f893[_0x0e13('0x39')]};return db['ServicenowConfiguration'][_0x0e13('0x1c')](_0x497bd1)[_0x0e13('0x22')](function(_0xe65650){_0x56d6b0[_0x0e13('0x1c')]=_0xe65650;if(_0x107fc7['query'][_0x0e13('0x3e')]){_0x18f893[_0x0e13('0x3f')]=[{'all':!![]}];}return db[_0x0e13('0x28')][_0x0e13('0x40')](_0x18f893);})[_0x0e13('0x22')](function(_0x52606c){_0x56d6b0[_0x0e13('0x41')]=_0x52606c;return _0x56d6b0;})['then'](respondWithFilteredResult(_0x5e7b06,_0x18f893))[_0x0e13('0x42')](handleError(_0x5e7b06,null));};exports['show']=function(_0x5c374c,_0x3ee5cd){var _0x2ad7ff={'raw':![],'where':{'id':_0x5c374c[_0x0e13('0x43')]['id']}},_0x50c2e9={};_0x50c2e9[_0x0e13('0x2d')]=_[_0x0e13('0x30')](db[_0x0e13('0x28')]['rawAttributes']);_0x50c2e9[_0x0e13('0x2f')]=_[_0x0e13('0x30')](_0x5c374c[_0x0e13('0x2f')]);_0x50c2e9[_0x0e13('0x31')]=_[_0x0e13('0x32')](_0x50c2e9[_0x0e13('0x2d')],_0x50c2e9[_0x0e13('0x2f')]);_0x2ad7ff[_0x0e13('0x33')]=_['intersection'](_0x50c2e9['model'],qs[_0x0e13('0x34')](_0x5c374c[_0x0e13('0x2f')]['fields']));_0x2ad7ff['attributes']=_0x2ad7ff[_0x0e13('0x33')]['length']?_0x2ad7ff[_0x0e13('0x33')]:_0x50c2e9['model'];if(_0x5c374c[_0x0e13('0x2f')][_0x0e13('0x3e')]){_0x2ad7ff[_0x0e13('0x3f')]=[{'all':!![]}];}_0x2ad7ff=_['merge']({},_0x2ad7ff,_0x5c374c['options']);return db[_0x0e13('0x28')][_0x0e13('0x44')](_0x2ad7ff)[_0x0e13('0x22')](handleEntityNotFound(_0x3ee5cd,null))[_0x0e13('0x22')](respondWithResult(_0x3ee5cd,null))[_0x0e13('0x42')](handleError(_0x3ee5cd,null));};exports[_0x0e13('0x45')]=function(_0x349f02,_0x5ad450){return db[_0x0e13('0x28')]['create'](_0x349f02[_0x0e13('0x46')],{})[_0x0e13('0x22')](respondWithResult(_0x5ad450,0xc9))[_0x0e13('0x42')](handleError(_0x5ad450,null));};exports[_0x0e13('0x20')]=function(_0x3bd729,_0x365297){if(_0x3bd729['body']['id']){delete _0x3bd729[_0x0e13('0x46')]['id'];}return db[_0x0e13('0x28')][_0x0e13('0x44')]({'where':{'id':_0x3bd729[_0x0e13('0x43')]['id']}})[_0x0e13('0x22')](handleEntityNotFound(_0x365297,null))['then'](saveUpdates(_0x3bd729[_0x0e13('0x46')],null))[_0x0e13('0x22')](respondWithResult(_0x365297,null))['catch'](handleError(_0x365297,null));};exports['destroy']=function(_0x5c90ed,_0x22b36d){return db[_0x0e13('0x28')][_0x0e13('0x44')]({'where':{'id':_0x5c90ed[_0x0e13('0x43')]['id']}})[_0x0e13('0x22')](handleEntityNotFound(_0x22b36d,null))[_0x0e13('0x22')](removeEntity(_0x22b36d,null))['catch'](handleError(_0x22b36d,null));};exports[_0x0e13('0x47')]=function(_0x3f4fb8,_0x44a5ca,_0x498d06){var _0x223c01={};var _0x1b29ba={};var _0x2b71ab;var _0x3e7dad;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x3f4fb8[_0x0e13('0x43')]['id']}})[_0x0e13('0x22')](handleEntityNotFound(_0x44a5ca,null))[_0x0e13('0x22')](function(_0x5e747f){if(_0x5e747f){_0x2b71ab=_0x5e747f;_0x1b29ba['model']=_[_0x0e13('0x30')](db['ServicenowField'][_0x0e13('0x29')]);_0x1b29ba['query']=_[_0x0e13('0x30')](_0x3f4fb8[_0x0e13('0x2f')]);_0x1b29ba[_0x0e13('0x31')]=_[_0x0e13('0x32')](_0x1b29ba[_0x0e13('0x2d')],_0x1b29ba[_0x0e13('0x2f')]);_0x223c01[_0x0e13('0x33')]=_[_0x0e13('0x32')](_0x1b29ba['model'],qs[_0x0e13('0x34')](_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x34')]));_0x223c01[_0x0e13('0x33')]=_0x223c01[_0x0e13('0x33')][_0x0e13('0x35')]?_0x223c01['attributes']:_0x1b29ba['model'];_0x223c01[_0x0e13('0x37')]=qs['sort'](_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x38')]);_0x223c01[_0x0e13('0x39')]=qs['filters'](_['pick'](_0x3f4fb8[_0x0e13('0x2f')],_0x1b29ba['filters']));if(_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x3b')]){_0x223c01[_0x0e13('0x39')]=_[_0x0e13('0x3d')](_0x223c01[_0x0e13('0x39')],{'$or':_['map'](_0x223c01[_0x0e13('0x33')],function(_0x104932){var _0x1943dd={};_0x1943dd[_0x104932]={'$like':'%'+_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x3b')]+'%'};return _0x1943dd;})});}_0x223c01=_[_0x0e13('0x3d')]({},_0x223c01,_0x3f4fb8[_0x0e13('0x48')]);return _0x2b71ab[_0x0e13('0x47')](_0x223c01);}})[_0x0e13('0x22')](function(_0x1706e8){if(_0x1706e8){_0x3e7dad=_0x1706e8[_0x0e13('0x35')];if(!_0x3f4fb8['query'][_0x0e13('0x36')](_0x0e13('0x49'))){_0x223c01[_0x0e13('0x1b')]=qs[_0x0e13('0x1b')](_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x1b')]);_0x223c01[_0x0e13('0x19')]=qs[_0x0e13('0x19')](_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x19')]);}return _0x2b71ab[_0x0e13('0x47')](_0x223c01);}})[_0x0e13('0x22')](function(_0x141435){if(_0x141435){return _0x141435?{'count':_0x3e7dad,'rows':_0x141435}:null;}})['then'](respondWithResult(_0x44a5ca,null))[_0x0e13('0x42')](handleError(_0x44a5ca,null));};exports['getSubjects']=function(_0x823e0b,_0x1f41f8,_0x25c256){var _0x345be2={};var _0x2642ab={};var _0x9a3563;var _0x5333dd;return db[_0x0e13('0x28')][_0x0e13('0x4a')]({'where':{'id':_0x823e0b[_0x0e13('0x43')]['id']}})[_0x0e13('0x22')](handleEntityNotFound(_0x1f41f8,null))[_0x0e13('0x22')](function(_0x372f0d){if(_0x372f0d){_0x9a3563=_0x372f0d;_0x2642ab[_0x0e13('0x2d')]=_[_0x0e13('0x30')](db['ServicenowField'][_0x0e13('0x29')]);_0x2642ab[_0x0e13('0x2f')]=_['keys'](_0x823e0b[_0x0e13('0x2f')]);_0x2642ab[_0x0e13('0x31')]=_['intersection'](_0x2642ab['model'],_0x2642ab[_0x0e13('0x2f')]);_0x345be2['attributes']=_[_0x0e13('0x32')](_0x2642ab[_0x0e13('0x2d')],qs[_0x0e13('0x34')](_0x823e0b['query'][_0x0e13('0x34')]));_0x345be2['attributes']=_0x345be2['attributes'][_0x0e13('0x35')]?_0x345be2[_0x0e13('0x33')]:_0x2642ab[_0x0e13('0x2d')];_0x345be2[_0x0e13('0x37')]=qs['sort'](_0x823e0b[_0x0e13('0x2f')][_0x0e13('0x38')]);_0x345be2[_0x0e13('0x39')]=qs[_0x0e13('0x31')](_[_0x0e13('0x3a')](_0x823e0b['query'],_0x2642ab[_0x0e13('0x31')]));if(_0x823e0b[_0x0e13('0x2f')][_0x0e13('0x3b')]){_0x345be2['where']=_[_0x0e13('0x3d')](_0x345be2[_0x0e13('0x39')],{'$or':_[_0x0e13('0x2e')](_0x345be2[_0x0e13('0x33')],function(_0x4938ea){var _0x5a903e={};_0x5a903e[_0x4938ea]={'$like':'%'+_0x823e0b['query']['filter']+'%'};return _0x5a903e;})});}_0x345be2=_[_0x0e13('0x3d')]({},_0x345be2,_0x823e0b[_0x0e13('0x48')]);return _0x9a3563[_0x0e13('0x4b')](_0x345be2);}})[_0x0e13('0x22')](function(_0x1370a2){if(_0x1370a2){_0x5333dd=_0x1370a2[_0x0e13('0x35')];if(!_0x823e0b[_0x0e13('0x2f')][_0x0e13('0x36')](_0x0e13('0x49'))){_0x345be2[_0x0e13('0x1b')]=qs['limit'](_0x823e0b[_0x0e13('0x2f')]['limit']);_0x345be2[_0x0e13('0x19')]=qs[_0x0e13('0x19')](_0x823e0b['query']['offset']);}return _0x9a3563[_0x0e13('0x4b')](_0x345be2);}})[_0x0e13('0x22')](function(_0x41d9ec){if(_0x41d9ec){return _0x41d9ec?{'count':_0x5333dd,'rows':_0x41d9ec}:null;}})[_0x0e13('0x22')](respondWithResult(_0x1f41f8,null))[_0x0e13('0x42')](handleError(_0x1f41f8,null));};exports['getDescriptions']=function(_0x35ba0f,_0x1055c8,_0x7aa688){var _0x3d672c={};var _0x5e768f={};var _0x2fbb52;var _0x2d13c7;return db[_0x0e13('0x28')][_0x0e13('0x4a')]({'where':{'id':_0x35ba0f[_0x0e13('0x43')]['id']}})['then'](handleEntityNotFound(_0x1055c8,null))[_0x0e13('0x22')](function(_0x5b4fab){if(_0x5b4fab){_0x2fbb52=_0x5b4fab;_0x5e768f[_0x0e13('0x2d')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x5e768f[_0x0e13('0x2f')]=_[_0x0e13('0x30')](_0x35ba0f[_0x0e13('0x2f')]);_0x5e768f[_0x0e13('0x31')]=_[_0x0e13('0x32')](_0x5e768f['model'],_0x5e768f[_0x0e13('0x2f')]);_0x3d672c['attributes']=_[_0x0e13('0x32')](_0x5e768f[_0x0e13('0x2d')],qs[_0x0e13('0x34')](_0x35ba0f[_0x0e13('0x2f')]['fields']));_0x3d672c['attributes']=_0x3d672c[_0x0e13('0x33')][_0x0e13('0x35')]?_0x3d672c[_0x0e13('0x33')]:_0x5e768f[_0x0e13('0x2d')];_0x3d672c[_0x0e13('0x37')]=qs['sort'](_0x35ba0f[_0x0e13('0x2f')][_0x0e13('0x38')]);_0x3d672c[_0x0e13('0x39')]=qs['filters'](_[_0x0e13('0x3a')](_0x35ba0f[_0x0e13('0x2f')],_0x5e768f[_0x0e13('0x31')]));if(_0x35ba0f[_0x0e13('0x2f')][_0x0e13('0x3b')]){_0x3d672c[_0x0e13('0x39')]=_[_0x0e13('0x3d')](_0x3d672c[_0x0e13('0x39')],{'$or':_[_0x0e13('0x2e')](_0x3d672c[_0x0e13('0x33')],function(_0x3f3361){var _0x3e29ac={};_0x3e29ac[_0x3f3361]={'$like':'%'+_0x35ba0f[_0x0e13('0x2f')][_0x0e13('0x3b')]+'%'};return _0x3e29ac;})});}_0x3d672c=_[_0x0e13('0x3d')]({},_0x3d672c,_0x35ba0f['options']);return _0x2fbb52['getDescriptions'](_0x3d672c);}})[_0x0e13('0x22')](function(_0x3c99f8){if(_0x3c99f8){_0x2d13c7=_0x3c99f8['length'];if(!_0x35ba0f[_0x0e13('0x2f')]['hasOwnProperty'](_0x0e13('0x49'))){_0x3d672c[_0x0e13('0x1b')]=qs[_0x0e13('0x1b')](_0x35ba0f['query'][_0x0e13('0x1b')]);_0x3d672c[_0x0e13('0x19')]=qs[_0x0e13('0x19')](_0x35ba0f[_0x0e13('0x2f')][_0x0e13('0x19')]);}return _0x2fbb52['getDescriptions'](_0x3d672c);}})[_0x0e13('0x22')](function(_0x5137e4){if(_0x5137e4){return _0x5137e4?{'count':_0x2d13c7,'rows':_0x5137e4}:null;}})[_0x0e13('0x22')](respondWithResult(_0x1055c8,null))[_0x0e13('0x42')](handleError(_0x1055c8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c3edae9..e0d6674 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 _0x3611=['../../config/environment','exports','define','int_servicenow_configurations','lodash','api','request-promise','path','rimraf'];(function(_0x95a2c1,_0x1bd27f){var _0x7c5338=function(_0x274a65){while(--_0x274a65){_0x95a2c1['push'](_0x95a2c1['shift']());}};_0x7c5338(++_0x1bd27f);}(_0x3611,0x136));var _0x1361=function(_0x3af514,_0x24242c){_0x3af514=_0x3af514-0x0;var _0x5ee9e0=_0x3611[_0x3af514];return _0x5ee9e0;};'use strict';var _=require(_0x1361('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1361('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1361('0x2'));var fs=require('fs');var path=require(_0x1361('0x3'));var rimraf=require(_0x1361('0x4'));var config=require(_0x1361('0x5'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x1361('0x6')]=function(_0x304832,_0x5aa5dc){return _0x304832[_0x1361('0x7')]('ServicenowConfiguration',attributes,{'tableName':_0x1361('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f8c=['exports','define','ServicenowConfiguration','int_servicenow_configurations','../../config/logger','api','moment','bluebird'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x3f8c,0x104));var _0xc3f8=function(_0x1b992f,_0x31667d){_0x1b992f=_0x1b992f-0x0;var _0x8d8762=_0x3f8c[_0x1b992f];return _0x8d8762;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3f8('0x0'))(_0xc3f8('0x1'));var moment=require(_0xc3f8('0x2'));var BPromise=require(_0xc3f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xc3f8('0x4')]=function(_0x1a6976,_0x3a4e2f){return _0x1a6976[_0xc3f8('0x5')](_0xc3f8('0x6'),attributes,{'tableName':_0xc3f8('0x7'),'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 fe41b60..44324fa 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 _0xc0a4=['stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0xc0a4,0xc6));var _0x4c0a=function(_0x3621f7,_0x4c2185){_0x3621f7=_0x3621f7-0x0;var _0x426a17=_0xc0a4[_0x3621f7];return _0x426a17;};'use strict';var _=require(_0x4c0a('0x0'));var util=require(_0x4c0a('0x1'));var moment=require('moment');var BPromise=require(_0x4c0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c0a('0x3'));var db=require(_0x4c0a('0x4'))['db'];var utils=require(_0x4c0a('0x5'));var logger=require(_0x4c0a('0x6'))(_0x4c0a('0x7'));var config=require(_0x4c0a('0x8'));var jayson=require(_0x4c0a('0x9'));var client=jayson[_0x4c0a('0xa')][_0x4c0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1515ef,_0x53e005,_0x33fc7d){return new BPromise(function(_0x45b174,_0x50aa90){return client[_0x4c0a('0xc')](_0x1515ef,_0x33fc7d)[_0x4c0a('0xd')](function(_0x493120){logger[_0x4c0a('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x53e005,_0x4c0a('0xf'));logger[_0x4c0a('0x10')](_0x4c0a('0x11'),_0x53e005,_0x4c0a('0xf'),JSON[_0x4c0a('0x12')](_0x493120));if(_0x493120[_0x4c0a('0x13')]){if(_0x493120[_0x4c0a('0x13')]['code']===0x1f4){logger[_0x4c0a('0x13')](_0x4c0a('0x14'),_0x53e005,_0x493120['error'][_0x4c0a('0x15')]);return _0x50aa90(_0x493120['error']['message']);}logger['error'](_0x4c0a('0x14'),_0x53e005,_0x493120[_0x4c0a('0x13')][_0x4c0a('0x15')]);return _0x45b174(_0x493120[_0x4c0a('0x13')]['message']);}else{logger[_0x4c0a('0xe')](_0x4c0a('0x14'),_0x53e005,'request\x20sent');_0x45b174(_0x493120[_0x4c0a('0x16')]['message']);}})[_0x4c0a('0x17')](function(_0x60e374){logger['error'](_0x4c0a('0x14'),_0x53e005,_0x60e374);_0x50aa90(_0x60e374);});});} \ No newline at end of file +var _0x95bf=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x95bf,0x1b3));var _0xf95b=function(_0x468782,_0x417d8a){_0x468782=_0x468782-0x0;var _0x11cf0e=_0x95bf[_0x468782];return _0x11cf0e;};'use strict';var _=require(_0xf95b('0x0'));var util=require(_0xf95b('0x1'));var moment=require(_0xf95b('0x2'));var BPromise=require(_0xf95b('0x3'));var rs=require(_0xf95b('0x4'));var fs=require('fs');var Redis=require(_0xf95b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf95b('0x6'))(_0xf95b('0x7'));var config=require(_0xf95b('0x8'));var jayson=require(_0xf95b('0x9'));var client=jayson[_0xf95b('0xa')][_0xf95b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x269359,_0x39078a,_0x45a3a4){return new BPromise(function(_0x31081d,_0x2377da){return client['request'](_0x269359,_0x45a3a4)[_0xf95b('0xc')](function(_0x1a3fc6){logger[_0xf95b('0xd')](_0xf95b('0xe'),_0x39078a,'request\x20sent');logger[_0xf95b('0xf')](_0xf95b('0x10'),_0x39078a,_0xf95b('0x11'),JSON[_0xf95b('0x12')](_0x1a3fc6));if(_0x1a3fc6[_0xf95b('0x13')]){if(_0x1a3fc6['error'][_0xf95b('0x14')]===0x1f4){logger[_0xf95b('0x13')](_0xf95b('0xe'),_0x39078a,_0x1a3fc6[_0xf95b('0x13')]['message']);return _0x2377da(_0x1a3fc6[_0xf95b('0x13')][_0xf95b('0x15')]);}logger[_0xf95b('0x13')](_0xf95b('0xe'),_0x39078a,_0x1a3fc6[_0xf95b('0x13')][_0xf95b('0x15')]);return _0x31081d(_0x1a3fc6[_0xf95b('0x13')][_0xf95b('0x15')]);}else{logger[_0xf95b('0xd')](_0xf95b('0xe'),_0x39078a,_0xf95b('0x11'));_0x31081d(_0x1a3fc6[_0xf95b('0x16')]['message']);}})[_0xf95b('0x17')](function(_0x485deb){logger[_0xf95b('0x13')](_0xf95b('0xe'),_0x39078a,_0x485deb);_0x2377da(_0x485deb);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 074d33a..863b87f 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 _0x28e1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','update','delete','destroy','multer','util'];(function(_0x2bae02,_0x29d62b){var _0x5b4f8b=function(_0x20cbf7){while(--_0x20cbf7){_0x2bae02['push'](_0x2bae02['shift']());}};_0x5b4f8b(++_0x29d62b);}(_0x28e1,0xc2));var _0x128e=function(_0x276a71,_0x1d9d52){_0x276a71=_0x276a71-0x0;var _0x205159=_0x28e1[_0x276a71];return _0x205159;};'use strict';var multer=require(_0x128e('0x0'));var util=require(_0x128e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x128e('0x2'));var auth=require(_0x128e('0x3'));var interaction=require(_0x128e('0x4'));var config=require(_0x128e('0x5'));var controller=require('./intServicenowField.controller');router[_0x128e('0x6')]('/',auth[_0x128e('0x7')](),controller['index']);router[_0x128e('0x6')](_0x128e('0x8'),auth[_0x128e('0x7')](),controller[_0x128e('0x9')]);router[_0x128e('0xa')]('/',auth[_0x128e('0x7')](),controller['create']);router['put'](_0x128e('0x8'),auth[_0x128e('0x7')](),controller[_0x128e('0xb')]);router[_0x128e('0xc')](_0x128e('0x8'),auth[_0x128e('0x7')](),controller[_0x128e('0xd')]);module['exports']=router; \ No newline at end of file +var _0x374b=['isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id'];(function(_0x17298f,_0x1ec3fc){var _0x192ce1=function(_0x569014){while(--_0x569014){_0x17298f['push'](_0x17298f['shift']());}};_0x192ce1(++_0x1ec3fc);}(_0x374b,0x171));var _0xb374=function(_0x4fcd48,_0x3919d0){_0x4fcd48=_0x4fcd48-0x0;var _0x3aa601=_0x374b[_0x4fcd48];return _0x3aa601;};'use strict';var multer=require(_0xb374('0x0'));var util=require(_0xb374('0x1'));var path=require(_0xb374('0x2'));var timeout=require('connect-timeout');var express=require(_0xb374('0x3'));var router=express[_0xb374('0x4')]();var fs_extra=require(_0xb374('0x5'));var auth=require(_0xb374('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb374('0x7'));var controller=require('./intServicenowField.controller');router[_0xb374('0x8')]('/',auth['isAuthenticated'](),controller[_0xb374('0x9')]);router['get'](_0xb374('0xa'),auth[_0xb374('0xb')](),controller['show']);router[_0xb374('0xc')]('/',auth[_0xb374('0xb')](),controller[_0xb374('0xd')]);router[_0xb374('0xe')]('/:id',auth[_0xb374('0xb')](),controller[_0xb374('0xf')]);router[_0xb374('0x10')](_0xb374('0xa'),auth[_0xb374('0xb')](),controller[_0xb374('0x11')]);module[_0xb374('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 1b23c71..f282d76 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 _0x8891=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','sequelize'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x8891,0x194));var _0x1889=function(_0x35640f,_0x3351bb){_0x35640f=_0x35640f-0x0;var _0x508de1=_0x8891[_0x35640f];return _0x508de1;};'use strict';var Sequelize=require(_0x1889('0x0'));module[_0x1889('0x1')]={'type':{'type':Sequelize[_0x1889('0x2')]('string',_0x1889('0x3'),_0x1889('0x4'),_0x1889('0x5'),_0x1889('0x6')),'defaultValue':_0x1889('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1889('0x8')]},'keyType':{'type':Sequelize[_0x1889('0x2')](_0x1889('0x7'),_0x1889('0x3'),_0x1889('0x4'))},'keyContent':{'type':Sequelize[_0x1889('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1889('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4782=['variable','picklist','STRING','customVariable','exports','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4782,0x1e0));var _0x2478=function(_0x23dba1,_0x1da069){_0x23dba1=_0x23dba1-0x0;var _0x240079=_0x4782[_0x23dba1];return _0x240079;};'use strict';var Sequelize=require('sequelize');module[_0x2478('0x0')]={'type':{'type':Sequelize[_0x2478('0x1')](_0x2478('0x2'),_0x2478('0x3'),'customVariable','keyValue',_0x2478('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2478('0x5')]},'key':{'type':Sequelize[_0x2478('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x2478('0x3'),_0x2478('0x6'))},'keyContent':{'type':Sequelize[_0x2478('0x5')]},'idField':{'type':Sequelize[_0x2478('0x5')]},'nameField':{'type':Sequelize[_0x2478('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2478('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index bc14cec..c917c59 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 _0xb322=['count','set','reject','save','update','destroy','name','send','ServicenowField','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','then','rows','show','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x588dcc,_0xc8e736){var _0x2a825c=function(_0x335d1d){while(--_0x335d1d){_0x588dcc['push'](_0x588dcc['shift']());}};_0x2a825c(++_0xc8e736);}(_0xb322,0xba));var _0x2b32=function(_0x3f3a55,_0x4ecf1c){_0x3f3a55=_0x3f3a55-0x0;var _0x101dd7=_0xb322[_0x3f3a55];return _0x101dd7;};'use strict';var emlformat=require(_0x2b32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b32('0x1'));var jsonpatch=require(_0x2b32('0x2'));var rp=require(_0x2b32('0x3'));var moment=require(_0x2b32('0x4'));var BPromise=require(_0x2b32('0x5'));var Mustache=require(_0x2b32('0x6'));var util=require(_0x2b32('0x7'));var path=require(_0x2b32('0x8'));var sox=require(_0x2b32('0x9'));var csv=require(_0x2b32('0xa'));var ejs=require(_0x2b32('0xb'));var fs=require('fs');var fs_extra=require(_0x2b32('0xc'));var _=require('lodash');var squel=require(_0x2b32('0xd'));var crypto=require('crypto');var jsforce=require(_0x2b32('0xe'));var deskjs=require(_0x2b32('0xf'));var toCsv=require(_0x2b32('0xa'));var querystring=require(_0x2b32('0x10'));var Papa=require(_0x2b32('0x11'));var Redis=require(_0x2b32('0x12'));var authService=require(_0x2b32('0x13'));var qs=require(_0x2b32('0x14'));var as=require(_0x2b32('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b32('0x16'))(_0x2b32('0x17'));var utils=require(_0x2b32('0x18'));var config=require(_0x2b32('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b32('0x1a'))['db'];function respondWithStatusCode(_0xd1586,_0x28cd7){_0x28cd7=_0x28cd7||0xcc;return function(_0x4c5d27){if(_0x4c5d27){return _0xd1586['sendStatus'](_0x28cd7);}return _0xd1586[_0x2b32('0x1b')](_0x28cd7)[_0x2b32('0x1c')]();};}function respondWithResult(_0x27918f,_0x2d0f47){_0x2d0f47=_0x2d0f47||0xc8;return function(_0x2fac1d){if(_0x2fac1d){return _0x27918f['status'](_0x2d0f47)[_0x2b32('0x1d')](_0x2fac1d);}};}function respondWithFilteredResult(_0x10f29d,_0x47acb7){return function(_0x3d3754){if(_0x3d3754){var _0x4f12cb=typeof _0x47acb7[_0x2b32('0x1e')]===_0x2b32('0x1f')&&typeof _0x47acb7[_0x2b32('0x20')]===_0x2b32('0x1f');var _0x21749a=_0x3d3754[_0x2b32('0x21')];var _0x1990cf=_0x4f12cb?0x0:_0x47acb7['offset'];var _0x2c366f=_0x4f12cb?_0x3d3754[_0x2b32('0x21')]:_0x47acb7[_0x2b32('0x1e')]+_0x47acb7[_0x2b32('0x20')];var _0x2429d4;if(_0x2c366f>=_0x21749a){_0x2c366f=_0x21749a;_0x2429d4=0xc8;}else{_0x2429d4=0xce;}_0x10f29d[_0x2b32('0x1b')](_0x2429d4);return _0x10f29d[_0x2b32('0x22')]('Content-Range',_0x1990cf+'-'+_0x2c366f+'/'+_0x21749a)[_0x2b32('0x1d')](_0x3d3754);}return null;};}function patchUpdates(_0x1086d0){return function(_0x1ae54f){try{jsonpatch['apply'](_0x1ae54f,_0x1086d0,!![]);}catch(_0x79abb5){return BPromise[_0x2b32('0x23')](_0x79abb5);}return _0x1ae54f[_0x2b32('0x24')]();};}function saveUpdates(_0x2a61f6,_0x536b08){return function(_0x136779){if(_0x136779){return _0x136779[_0x2b32('0x25')](_0x2a61f6)['then'](function(_0x5961a1){return _0x5961a1;});}return null;};}function removeEntity(_0x2f46ba,_0x19ab46){return function(_0x10b0d3){if(_0x10b0d3){return _0x10b0d3[_0x2b32('0x26')]()['then'](function(){_0x2f46ba['status'](0xcc)[_0x2b32('0x1c')]();});}};}function handleEntityNotFound(_0x59fda0,_0x123c70){return function(_0x50c111){if(!_0x50c111){_0x59fda0['sendStatus'](0x194);}return _0x50c111;};}function handleError(_0xa7328a,_0x170184){_0x170184=_0x170184||0x1f4;return function(_0x4c0d1d){logger['error'](_0x4c0d1d['stack']);if(_0x4c0d1d[_0x2b32('0x27')]){delete _0x4c0d1d[_0x2b32('0x27')];}_0xa7328a['status'](_0x170184)[_0x2b32('0x28')](_0x4c0d1d);};}exports['index']=function(_0x761b21,_0x470658){var _0x3fecaa={},_0x3461c1={},_0x3bc296={'count':0x0,'rows':[]};var _0x1d7f2a=_['map'](db[_0x2b32('0x29')][_0x2b32('0x2a')],function(_0x4d74f5){return{'name':_0x4d74f5['fieldName'],'type':_0x4d74f5['type']['key']};});_0x3461c1[_0x2b32('0x2b')]=_['map'](_0x1d7f2a,_0x2b32('0x27'));_0x3461c1[_0x2b32('0x2c')]=_[_0x2b32('0x2d')](_0x761b21['query']);_0x3461c1[_0x2b32('0x2e')]=_[_0x2b32('0x2f')](_0x3461c1[_0x2b32('0x2b')],_0x3461c1[_0x2b32('0x2c')]);_0x3fecaa['attributes']=_[_0x2b32('0x2f')](_0x3461c1[_0x2b32('0x2b')],qs[_0x2b32('0x30')](_0x761b21[_0x2b32('0x2c')][_0x2b32('0x30')]));_0x3fecaa[_0x2b32('0x31')]=_0x3fecaa[_0x2b32('0x31')][_0x2b32('0x32')]?_0x3fecaa['attributes']:_0x3461c1[_0x2b32('0x2b')];if(!_0x761b21[_0x2b32('0x2c')][_0x2b32('0x33')](_0x2b32('0x34'))){_0x3fecaa[_0x2b32('0x20')]=qs[_0x2b32('0x20')](_0x761b21[_0x2b32('0x2c')]['limit']);_0x3fecaa[_0x2b32('0x1e')]=qs['offset'](_0x761b21['query'][_0x2b32('0x1e')]);}_0x3fecaa[_0x2b32('0x35')]=qs[_0x2b32('0x36')](_0x761b21[_0x2b32('0x2c')][_0x2b32('0x36')]);_0x3fecaa[_0x2b32('0x37')]=qs[_0x2b32('0x2e')](_[_0x2b32('0x38')](_0x761b21[_0x2b32('0x2c')],_0x3461c1[_0x2b32('0x2e')]),_0x1d7f2a);if(_0x761b21[_0x2b32('0x2c')][_0x2b32('0x39')]){_0x3fecaa[_0x2b32('0x37')]=_['merge'](_0x3fecaa['where'],{'$or':_[_0x2b32('0x3a')](_0x1d7f2a,function(_0x4e1475){if(_0x4e1475[_0x2b32('0x3b')]!==_0x2b32('0x3c')){var _0x75d338={};_0x75d338[_0x4e1475[_0x2b32('0x27')]]={'$like':'%'+_0x761b21['query'][_0x2b32('0x39')]+'%'};return _0x75d338;}})});}_0x3fecaa=_[_0x2b32('0x3d')]({},_0x3fecaa,_0x761b21[_0x2b32('0x3e')]);var _0x306fac={'where':_0x3fecaa['where']};return db[_0x2b32('0x29')][_0x2b32('0x21')](_0x306fac)['then'](function(_0x23a1ec){_0x3bc296[_0x2b32('0x21')]=_0x23a1ec;if(_0x761b21['query'][_0x2b32('0x3f')]){_0x3fecaa[_0x2b32('0x40')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x3fecaa);})[_0x2b32('0x41')](function(_0x289b89){_0x3bc296[_0x2b32('0x42')]=_0x289b89;return _0x3bc296;})[_0x2b32('0x41')](respondWithFilteredResult(_0x470658,_0x3fecaa))['catch'](handleError(_0x470658,null));};exports[_0x2b32('0x43')]=function(_0x1cd045,_0x187279){var _0x3182d9={'raw':!![],'where':{'id':_0x1cd045['params']['id']}},_0x3269a9={};_0x3269a9[_0x2b32('0x2b')]=_['keys'](db['ServicenowField'][_0x2b32('0x2a')]);_0x3269a9[_0x2b32('0x2c')]=_[_0x2b32('0x2d')](_0x1cd045['query']);_0x3269a9[_0x2b32('0x2e')]=_[_0x2b32('0x2f')](_0x3269a9[_0x2b32('0x2b')],_0x3269a9[_0x2b32('0x2c')]);_0x3182d9['attributes']=_[_0x2b32('0x2f')](_0x3269a9['model'],qs[_0x2b32('0x30')](_0x1cd045[_0x2b32('0x2c')][_0x2b32('0x30')]));_0x3182d9[_0x2b32('0x31')]=_0x3182d9[_0x2b32('0x31')][_0x2b32('0x32')]?_0x3182d9['attributes']:_0x3269a9['model'];if(_0x1cd045[_0x2b32('0x2c')][_0x2b32('0x3f')]){_0x3182d9[_0x2b32('0x40')]=[{'all':!![]}];}_0x3182d9=_[_0x2b32('0x3d')]({},_0x3182d9,_0x1cd045[_0x2b32('0x3e')]);return db[_0x2b32('0x29')][_0x2b32('0x44')](_0x3182d9)[_0x2b32('0x41')](handleEntityNotFound(_0x187279,null))['then'](respondWithResult(_0x187279,null))[_0x2b32('0x45')](handleError(_0x187279,null));};exports['create']=function(_0x14223f,_0x35a877){return db[_0x2b32('0x29')][_0x2b32('0x46')](_0x14223f['body'],{})['then'](respondWithResult(_0x35a877,0xc9))['catch'](handleError(_0x35a877,null));};exports[_0x2b32('0x25')]=function(_0x3f73f8,_0x382acb){if(_0x3f73f8[_0x2b32('0x47')]['id']){delete _0x3f73f8[_0x2b32('0x47')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x3f73f8[_0x2b32('0x48')]['id']}})[_0x2b32('0x41')](handleEntityNotFound(_0x382acb,null))[_0x2b32('0x41')](saveUpdates(_0x3f73f8[_0x2b32('0x47')],null))[_0x2b32('0x41')](respondWithResult(_0x382acb,null))[_0x2b32('0x45')](handleError(_0x382acb,null));};exports[_0x2b32('0x26')]=function(_0x544fe9,_0x45abaf){return db['ServicenowField'][_0x2b32('0x44')]({'where':{'id':_0x544fe9[_0x2b32('0x48')]['id']}})['then'](handleEntityNotFound(_0x45abaf,null))[_0x2b32('0x41')](removeEntity(_0x45abaf,null))[_0x2b32('0x45')](handleError(_0x45abaf,null));}; \ No newline at end of file +var _0x4ba4=['hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','ServicenowField','includeAll','include','findAll','then','show','params','catch','create','body','find','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','status','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4ba4,0xe6));var _0x44ba=function(_0x18acf6,_0x3f096b){_0x18acf6=_0x18acf6-0x0;var _0x293a2e=_0x4ba4[_0x18acf6];return _0x293a2e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44ba('0x0'));var rp=require(_0x44ba('0x1'));var moment=require(_0x44ba('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x44ba('0x3'));var path=require('path');var sox=require(_0x44ba('0x4'));var csv=require('to-csv');var ejs=require(_0x44ba('0x5'));var fs=require('fs');var fs_extra=require(_0x44ba('0x6'));var _=require(_0x44ba('0x7'));var squel=require('squel');var crypto=require(_0x44ba('0x8'));var jsforce=require(_0x44ba('0x9'));var deskjs=require(_0x44ba('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x44ba('0xb'));var Redis=require(_0x44ba('0xc'));var authService=require(_0x44ba('0xd'));var qs=require(_0x44ba('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x44ba('0xf'))(_0x44ba('0x10'));var utils=require('../../config/utils');var config=require(_0x44ba('0x11'));var licenseUtil=require(_0x44ba('0x12'));var db=require(_0x44ba('0x13'))['db'];function respondWithStatusCode(_0x512222,_0x593149){_0x593149=_0x593149||0xcc;return function(_0x437bc0){if(_0x437bc0){return _0x512222[_0x44ba('0x14')](_0x593149);}return _0x512222['status'](_0x593149)['end']();};}function respondWithResult(_0x2a9851,_0x4ebb83){_0x4ebb83=_0x4ebb83||0xc8;return function(_0x2138e2){if(_0x2138e2){return _0x2a9851['status'](_0x4ebb83)[_0x44ba('0x15')](_0x2138e2);}};}function respondWithFilteredResult(_0x4bd65d,_0x5882d6){return function(_0x3e09b9){if(_0x3e09b9){var _0x2dfc03=typeof _0x5882d6['offset']===_0x44ba('0x16')&&typeof _0x5882d6[_0x44ba('0x17')]===_0x44ba('0x16');var _0x348bb1=_0x3e09b9[_0x44ba('0x18')];var _0x3e0acb=_0x2dfc03?0x0:_0x5882d6[_0x44ba('0x19')];var _0x4c3f6e=_0x2dfc03?_0x3e09b9[_0x44ba('0x18')]:_0x5882d6[_0x44ba('0x19')]+_0x5882d6[_0x44ba('0x17')];var _0x1503bc;if(_0x4c3f6e>=_0x348bb1){_0x4c3f6e=_0x348bb1;_0x1503bc=0xc8;}else{_0x1503bc=0xce;}_0x4bd65d['status'](_0x1503bc);return _0x4bd65d[_0x44ba('0x1a')](_0x44ba('0x1b'),_0x3e0acb+'-'+_0x4c3f6e+'/'+_0x348bb1)[_0x44ba('0x15')](_0x3e09b9);}return null;};}function patchUpdates(_0x33810c){return function(_0x272c12){try{jsonpatch[_0x44ba('0x1c')](_0x272c12,_0x33810c,!![]);}catch(_0x286cc3){return BPromise['reject'](_0x286cc3);}return _0x272c12[_0x44ba('0x1d')]();};}function saveUpdates(_0x8b82a9,_0x29b322){return function(_0x4f0a9f){if(_0x4f0a9f){return _0x4f0a9f[_0x44ba('0x1e')](_0x8b82a9)['then'](function(_0x1468d8){return _0x1468d8;});}return null;};}function removeEntity(_0x450a1e,_0xec60fb){return function(_0x52c2d1){if(_0x52c2d1){return _0x52c2d1[_0x44ba('0x1f')]()['then'](function(){_0x450a1e[_0x44ba('0x20')](0xcc)[_0x44ba('0x21')]();});}};}function handleEntityNotFound(_0x41f46d,_0x2d61fb){return function(_0xca1fc6){if(!_0xca1fc6){_0x41f46d['sendStatus'](0x194);}return _0xca1fc6;};}function handleError(_0x24f7f2,_0x49ac60){_0x49ac60=_0x49ac60||0x1f4;return function(_0x248f68){logger['error'](_0x248f68[_0x44ba('0x22')]);if(_0x248f68[_0x44ba('0x23')]){delete _0x248f68[_0x44ba('0x23')];}_0x24f7f2['status'](_0x49ac60)[_0x44ba('0x24')](_0x248f68);};}exports[_0x44ba('0x25')]=function(_0x25408b,_0x3fa24c){var _0x1e850d={},_0x1b9176={},_0x7da549={'count':0x0,'rows':[]};var _0x1f2825=_[_0x44ba('0x26')](db['ServicenowField'][_0x44ba('0x27')],function(_0x376bac){return{'name':_0x376bac[_0x44ba('0x28')],'type':_0x376bac[_0x44ba('0x29')]['key']};});_0x1b9176[_0x44ba('0x2a')]=_[_0x44ba('0x26')](_0x1f2825,_0x44ba('0x23'));_0x1b9176[_0x44ba('0x2b')]=_[_0x44ba('0x2c')](_0x25408b[_0x44ba('0x2b')]);_0x1b9176[_0x44ba('0x2d')]=_[_0x44ba('0x2e')](_0x1b9176[_0x44ba('0x2a')],_0x1b9176[_0x44ba('0x2b')]);_0x1e850d[_0x44ba('0x2f')]=_[_0x44ba('0x2e')](_0x1b9176[_0x44ba('0x2a')],qs[_0x44ba('0x30')](_0x25408b[_0x44ba('0x2b')][_0x44ba('0x30')]));_0x1e850d[_0x44ba('0x2f')]=_0x1e850d['attributes'][_0x44ba('0x31')]?_0x1e850d[_0x44ba('0x2f')]:_0x1b9176['model'];if(!_0x25408b[_0x44ba('0x2b')][_0x44ba('0x32')]('nolimit')){_0x1e850d['limit']=qs[_0x44ba('0x17')](_0x25408b[_0x44ba('0x2b')][_0x44ba('0x17')]);_0x1e850d[_0x44ba('0x19')]=qs[_0x44ba('0x19')](_0x25408b[_0x44ba('0x2b')]['offset']);}_0x1e850d[_0x44ba('0x33')]=qs[_0x44ba('0x34')](_0x25408b[_0x44ba('0x2b')][_0x44ba('0x34')]);_0x1e850d[_0x44ba('0x35')]=qs['filters'](_[_0x44ba('0x36')](_0x25408b['query'],_0x1b9176[_0x44ba('0x2d')]),_0x1f2825);if(_0x25408b[_0x44ba('0x2b')]['filter']){_0x1e850d['where']=_['merge'](_0x1e850d['where'],{'$or':_[_0x44ba('0x26')](_0x1f2825,function(_0x433049){if(_0x433049[_0x44ba('0x29')]!==_0x44ba('0x37')){var _0x1d8589={};_0x1d8589[_0x433049[_0x44ba('0x23')]]={'$like':'%'+_0x25408b[_0x44ba('0x2b')][_0x44ba('0x38')]+'%'};return _0x1d8589;}})});}_0x1e850d=_[_0x44ba('0x39')]({},_0x1e850d,_0x25408b[_0x44ba('0x3a')]);var _0x4a5a67={'where':_0x1e850d[_0x44ba('0x35')]};return db[_0x44ba('0x3b')][_0x44ba('0x18')](_0x4a5a67)['then'](function(_0x556491){_0x7da549[_0x44ba('0x18')]=_0x556491;if(_0x25408b[_0x44ba('0x2b')][_0x44ba('0x3c')]){_0x1e850d[_0x44ba('0x3d')]=[{'all':!![]}];}return db['ServicenowField'][_0x44ba('0x3e')](_0x1e850d);})[_0x44ba('0x3f')](function(_0x1dfb82){_0x7da549['rows']=_0x1dfb82;return _0x7da549;})['then'](respondWithFilteredResult(_0x3fa24c,_0x1e850d))['catch'](handleError(_0x3fa24c,null));};exports[_0x44ba('0x40')]=function(_0x281244,_0x91e52a){var _0x40ad81={'raw':!![],'where':{'id':_0x281244[_0x44ba('0x41')]['id']}},_0x3afe31={};_0x3afe31[_0x44ba('0x2a')]=_['keys'](db[_0x44ba('0x3b')][_0x44ba('0x27')]);_0x3afe31['query']=_[_0x44ba('0x2c')](_0x281244[_0x44ba('0x2b')]);_0x3afe31[_0x44ba('0x2d')]=_[_0x44ba('0x2e')](_0x3afe31[_0x44ba('0x2a')],_0x3afe31[_0x44ba('0x2b')]);_0x40ad81[_0x44ba('0x2f')]=_[_0x44ba('0x2e')](_0x3afe31['model'],qs[_0x44ba('0x30')](_0x281244[_0x44ba('0x2b')]['fields']));_0x40ad81[_0x44ba('0x2f')]=_0x40ad81[_0x44ba('0x2f')][_0x44ba('0x31')]?_0x40ad81[_0x44ba('0x2f')]:_0x3afe31[_0x44ba('0x2a')];if(_0x281244[_0x44ba('0x2b')][_0x44ba('0x3c')]){_0x40ad81[_0x44ba('0x3d')]=[{'all':!![]}];}_0x40ad81=_['merge']({},_0x40ad81,_0x281244[_0x44ba('0x3a')]);return db[_0x44ba('0x3b')]['find'](_0x40ad81)[_0x44ba('0x3f')](handleEntityNotFound(_0x91e52a,null))['then'](respondWithResult(_0x91e52a,null))[_0x44ba('0x42')](handleError(_0x91e52a,null));};exports[_0x44ba('0x43')]=function(_0x279536,_0x1f027e){return db[_0x44ba('0x3b')][_0x44ba('0x43')](_0x279536[_0x44ba('0x44')],{})[_0x44ba('0x3f')](respondWithResult(_0x1f027e,0xc9))[_0x44ba('0x42')](handleError(_0x1f027e,null));};exports['update']=function(_0x4766bc,_0x1fcd49){if(_0x4766bc[_0x44ba('0x44')]['id']){delete _0x4766bc[_0x44ba('0x44')]['id'];}return db['ServicenowField'][_0x44ba('0x45')]({'where':{'id':_0x4766bc[_0x44ba('0x41')]['id']}})[_0x44ba('0x3f')](handleEntityNotFound(_0x1fcd49,null))[_0x44ba('0x3f')](saveUpdates(_0x4766bc[_0x44ba('0x44')],null))[_0x44ba('0x3f')](respondWithResult(_0x1fcd49,null))[_0x44ba('0x42')](handleError(_0x1fcd49,null));};exports['destroy']=function(_0x4c43bb,_0x3d22dc){return db[_0x44ba('0x3b')]['find']({'where':{'id':_0x4c43bb[_0x44ba('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d22dc,null))[_0x44ba('0x3f')](removeEntity(_0x3d22dc,null))['catch'](handleError(_0x3d22dc,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c71c1ec..c655c10 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 _0x7602=['servicenow_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x13c714,_0x234884){var _0x5604c0=function(_0x234cdf){while(--_0x234cdf){_0x13c714['push'](_0x13c714['shift']());}};_0x5604c0(++_0x234884);}(_0x7602,0x8e));var _0x2760=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x7602[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x2760('0x0'));var util=require(_0x2760('0x1'));var logger=require(_0x2760('0x2'))('api');var moment=require(_0x2760('0x3'));var BPromise=require(_0x2760('0x4'));var rp=require(_0x2760('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2760('0x6'));var config=require(_0x2760('0x7'));var attributes=require(_0x2760('0x8'));module[_0x2760('0x9')]=function(_0x5988b0,_0x52ac27){return _0x5988b0[_0x2760('0xa')](_0x2760('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x2760('0xc'),'fields':[_0x2760('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ec5=['bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','moment'];(function(_0x132990,_0x1370c9){var _0x2aa89d=function(_0x31ae05){while(--_0x31ae05){_0x132990['push'](_0x132990['shift']());}};_0x2aa89d(++_0x1370c9);}(_0x6ec5,0x176));var _0x56ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ec5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x56ec('0x0'));var util=require(_0x56ec('0x1'));var logger=require(_0x56ec('0x2'))('api');var moment=require(_0x56ec('0x3'));var BPromise=require(_0x56ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56ec('0x5'));var rimraf=require(_0x56ec('0x6'));var config=require(_0x56ec('0x7'));var attributes=require(_0x56ec('0x8'));module[_0x56ec('0x9')]=function(_0x39d691,_0x2c02b2){return _0x39d691['define'](_0x56ec('0xa'),attributes,{'tableName':_0x56ec('0xb'),'paranoid':![],'indexes':[{'name':_0x56ec('0xc'),'fields':['idField',_0x56ec('0xd')],'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 763d1e6..e454744 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0xf521c5,_0x286757){var _0x4b2928=function(_0x1ffc19){while(--_0x1ffc19){_0xf521c5['push'](_0xf521c5['shift']());}};_0x4b2928(++_0x286757);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb7e7[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0xda3f,0xec));var _0xfda3=function(_0x262b63,_0x1c3e68){_0x262b63=_0x262b63-0x0;var _0x1b7344=_0xda3f[_0x262b63];return _0x1b7344;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 10f9e70..50a4eb7 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(_0x4252d8,_0x53e5f1){var _0xf1747a=function(_0x20a87c){while(--_0x20a87c){_0x4252d8['push'](_0x4252d8['shift']());}};_0xf1747a(++_0x53e5f1);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0xccf844,_0x5d777c){var _0x179059=function(_0x15741a){while(--_0x15741a){_0xccf844['push'](_0xccf844['shift']());}};_0x179059(++_0x5d777c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 138d40b..8a3eafd 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(_0xb48b3e,_0x3b295f){var _0x2b19f8=function(_0xbeacbe){while(--_0xbeacbe){_0xb48b3e['push'](_0xb48b3e['shift']());}};_0x2b19f8(++_0x3b295f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x23c88c,_0x551202){var _0x4c9232=function(_0x2ed99e){while(--_0x2ed99e){_0x23c88c['push'](_0x23c88c['shift']());}};_0x4c9232(++_0x551202);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 3623dc3..5b7c684 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 _0x619d=['set','Content-Range','apply','reject','save','update','then','error','stack','name','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','map','VIRTUAL','merge','options','SugarcrmAccount','includeAll','include','catch','show','params','length','find','create','body','destroy','getConfigurations','findOne','AccountId','getSubjects','channel','Descriptions','SugarcrmConfiguration','SugarcrmField','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','label','endsWith','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset'];(function(_0x48e6ec,_0x5bb7f4){var _0x62289c=function(_0x8a4e56){while(--_0x8a4e56){_0x48e6ec['push'](_0x48e6ec['shift']());}};_0x62289c(++_0x5bb7f4);}(_0x619d,0x13d));var _0xd619=function(_0x13bf9c,_0x3ca949){_0x13bf9c=_0x13bf9c-0x0;var _0x1c52e2=_0x619d[_0x13bf9c];return _0x1c52e2;};'use strict';var emlformat=require(_0xd619('0x0'));var rimraf=require(_0xd619('0x1'));var zipdir=require(_0xd619('0x2'));var jsonpatch=require(_0xd619('0x3'));var rp=require(_0xd619('0x4'));var moment=require(_0xd619('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd619('0x6'));var path=require(_0xd619('0x7'));var sox=require(_0xd619('0x8'));var csv=require(_0xd619('0x9'));var ejs=require(_0xd619('0xa'));var fs=require('fs');var fs_extra=require(_0xd619('0xb'));var _=require(_0xd619('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd619('0xd'));var deskjs=require(_0xd619('0xe'));var toCsv=require(_0xd619('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd619('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd619('0x10'));var hardwareService=require(_0xd619('0x11'));var logger=require('../../config/logger')(_0xd619('0x12'));var utils=require('../../config/utils');var config=require(_0xd619('0x13'));var licenseUtil=require(_0xd619('0x14'));var db=require(_0xd619('0x15'))['db'];var integrations=require(_0xd619('0x16'));function respondWithStatusCode(_0x525f59,_0x33d6fa){_0x33d6fa=_0x33d6fa||0xcc;return function(_0x1c39ac){if(_0x1c39ac){return _0x525f59[_0xd619('0x17')](_0x33d6fa);}return _0x525f59['status'](_0x33d6fa)[_0xd619('0x18')]();};}function respondWithResult(_0xfa3eb5,_0x54a667){_0x54a667=_0x54a667||0xc8;return function(_0x783387){if(_0x783387){return _0xfa3eb5[_0xd619('0x19')](_0x54a667)[_0xd619('0x1a')](_0x783387);}};}function respondWithFilteredResult(_0x3d44d1,_0x2d8788){return function(_0x3fde37){if(_0x3fde37){var _0x110fd1=typeof _0x2d8788['offset']===_0xd619('0x1b')&&typeof _0x2d8788[_0xd619('0x1c')]===_0xd619('0x1b');var _0x38ed74=_0x3fde37[_0xd619('0x1d')];var _0x3bcd94=_0x110fd1?0x0:_0x2d8788[_0xd619('0x1e')];var _0x595fff=_0x110fd1?_0x3fde37['count']:_0x2d8788[_0xd619('0x1e')]+_0x2d8788[_0xd619('0x1c')];var _0x114b2a;if(_0x595fff>=_0x38ed74){_0x595fff=_0x38ed74;_0x114b2a=0xc8;}else{_0x114b2a=0xce;}_0x3d44d1[_0xd619('0x19')](_0x114b2a);return _0x3d44d1[_0xd619('0x1f')](_0xd619('0x20'),_0x3bcd94+'-'+_0x595fff+'/'+_0x38ed74)[_0xd619('0x1a')](_0x3fde37);}return null;};}function patchUpdates(_0x325a7e){return function(_0x462187){try{jsonpatch[_0xd619('0x21')](_0x462187,_0x325a7e,!![]);}catch(_0x17e74d){return BPromise[_0xd619('0x22')](_0x17e74d);}return _0x462187[_0xd619('0x23')]();};}function saveUpdates(_0x1a3198,_0x89dfb0){return function(_0x254b65){if(_0x254b65){return _0x254b65[_0xd619('0x24')](_0x1a3198)[_0xd619('0x25')](function(_0x18acaf){return _0x18acaf;});}return null;};}function removeEntity(_0x197d8c,_0x46c6cf){return function(_0x26ef36){if(_0x26ef36){return _0x26ef36['destroy']()[_0xd619('0x25')](function(){_0x197d8c[_0xd619('0x19')](0xcc)[_0xd619('0x18')]();});}};}function handleEntityNotFound(_0x214531,_0x2b0d6e){return function(_0x59298a){if(!_0x59298a){_0x214531[_0xd619('0x17')](0x194);}return _0x59298a;};}function handleError(_0x16aae5,_0x3d471d){_0x3d471d=_0x3d471d||0x1f4;return function(_0x4947ca){logger[_0xd619('0x26')](_0x4947ca[_0xd619('0x27')]);if(_0x4947ca[_0xd619('0x28')]){delete _0x4947ca[_0xd619('0x28')];}_0x16aae5[_0xd619('0x19')](_0x3d471d)['send'](_0x4947ca);};}exports['index']=function(_0x25b1ad,_0x2ac0ce){var _0x25b095={},_0x339e01={},_0x16fde1={'count':0x0,'rows':[]};var _0x570576=_['map'](db['SugarcrmAccount'][_0xd619('0x29')],function(_0x145c97){return{'name':_0x145c97[_0xd619('0x2a')],'type':_0x145c97[_0xd619('0x2b')]['key']};});_0x339e01[_0xd619('0x2c')]=_['map'](_0x570576,_0xd619('0x28'));_0x339e01['query']=_[_0xd619('0x2d')](_0x25b1ad[_0xd619('0x2e')]);_0x339e01[_0xd619('0x2f')]=_[_0xd619('0x30')](_0x339e01[_0xd619('0x2c')],_0x339e01[_0xd619('0x2e')]);_0x25b095['attributes']=_[_0xd619('0x30')](_0x339e01[_0xd619('0x2c')],qs[_0xd619('0x31')](_0x25b1ad[_0xd619('0x2e')]['fields']));_0x25b095[_0xd619('0x32')]=_0x25b095['attributes']['length']?_0x25b095[_0xd619('0x32')]:_0x339e01[_0xd619('0x2c')];if(!_0x25b1ad[_0xd619('0x2e')][_0xd619('0x33')](_0xd619('0x34'))){_0x25b095[_0xd619('0x1c')]=qs[_0xd619('0x1c')](_0x25b1ad[_0xd619('0x2e')][_0xd619('0x1c')]);_0x25b095[_0xd619('0x1e')]=qs[_0xd619('0x1e')](_0x25b1ad[_0xd619('0x2e')]['offset']);}_0x25b095['order']=qs[_0xd619('0x35')](_0x25b1ad[_0xd619('0x2e')][_0xd619('0x35')]);_0x25b095['where']=qs[_0xd619('0x2f')](_[_0xd619('0x36')](_0x25b1ad[_0xd619('0x2e')],_0x339e01['filters']),_0x570576);if(_0x25b1ad[_0xd619('0x2e')][_0xd619('0x37')]){_0x25b095[_0xd619('0x38')]=_['merge'](_0x25b095[_0xd619('0x38')],{'$or':_[_0xd619('0x39')](_0x570576,function(_0x32896f){if(_0x32896f[_0xd619('0x2b')]!==_0xd619('0x3a')){var _0x927ad3={};_0x927ad3[_0x32896f[_0xd619('0x28')]]={'$like':'%'+_0x25b1ad[_0xd619('0x2e')][_0xd619('0x37')]+'%'};return _0x927ad3;}})});}_0x25b095=_[_0xd619('0x3b')]({},_0x25b095,_0x25b1ad[_0xd619('0x3c')]);var _0x1fffc6={'where':_0x25b095[_0xd619('0x38')]};return db[_0xd619('0x3d')][_0xd619('0x1d')](_0x1fffc6)['then'](function(_0x555136){_0x16fde1[_0xd619('0x1d')]=_0x555136;if(_0x25b1ad[_0xd619('0x2e')][_0xd619('0x3e')]){_0x25b095[_0xd619('0x3f')]=[{'all':!![]}];}return db[_0xd619('0x3d')]['findAll'](_0x25b095);})['then'](function(_0x450a6f){_0x16fde1['rows']=_0x450a6f;return _0x16fde1;})[_0xd619('0x25')](respondWithFilteredResult(_0x2ac0ce,_0x25b095))[_0xd619('0x40')](handleError(_0x2ac0ce,null));};exports[_0xd619('0x41')]=function(_0x26e7a3,_0x75a850){var _0x2b0cc2={'raw':![],'where':{'id':_0x26e7a3[_0xd619('0x42')]['id']}},_0x73d3f1={};_0x73d3f1[_0xd619('0x2c')]=_['keys'](db[_0xd619('0x3d')]['rawAttributes']);_0x73d3f1['query']=_[_0xd619('0x2d')](_0x26e7a3[_0xd619('0x2e')]);_0x73d3f1[_0xd619('0x2f')]=_[_0xd619('0x30')](_0x73d3f1[_0xd619('0x2c')],_0x73d3f1[_0xd619('0x2e')]);_0x2b0cc2[_0xd619('0x32')]=_['intersection'](_0x73d3f1[_0xd619('0x2c')],qs[_0xd619('0x31')](_0x26e7a3[_0xd619('0x2e')][_0xd619('0x31')]));_0x2b0cc2[_0xd619('0x32')]=_0x2b0cc2[_0xd619('0x32')][_0xd619('0x43')]?_0x2b0cc2[_0xd619('0x32')]:_0x73d3f1['model'];if(_0x26e7a3[_0xd619('0x2e')][_0xd619('0x3e')]){_0x2b0cc2[_0xd619('0x3f')]=[{'all':!![]}];}_0x2b0cc2=_[_0xd619('0x3b')]({},_0x2b0cc2,_0x26e7a3['options']);return db[_0xd619('0x3d')][_0xd619('0x44')](_0x2b0cc2)[_0xd619('0x25')](handleEntityNotFound(_0x75a850,null))[_0xd619('0x25')](respondWithResult(_0x75a850,null))[_0xd619('0x40')](handleError(_0x75a850,null));};exports[_0xd619('0x45')]=function(_0xed0793,_0x593713){return db[_0xd619('0x3d')][_0xd619('0x45')](_0xed0793[_0xd619('0x46')],{})[_0xd619('0x25')](respondWithResult(_0x593713,0xc9))[_0xd619('0x40')](handleError(_0x593713,null));};exports[_0xd619('0x24')]=function(_0x531dd2,_0xb8250c){if(_0x531dd2[_0xd619('0x46')]['id']){delete _0x531dd2[_0xd619('0x46')]['id'];}return db[_0xd619('0x3d')][_0xd619('0x44')]({'where':{'id':_0x531dd2['params']['id']}})[_0xd619('0x25')](handleEntityNotFound(_0xb8250c,null))[_0xd619('0x25')](saveUpdates(_0x531dd2['body'],null))[_0xd619('0x25')](respondWithResult(_0xb8250c,null))[_0xd619('0x40')](handleError(_0xb8250c,null));};exports[_0xd619('0x47')]=function(_0x52d920,_0x13eae2){return db[_0xd619('0x3d')][_0xd619('0x44')]({'where':{'id':_0x52d920[_0xd619('0x42')]['id']}})[_0xd619('0x25')](handleEntityNotFound(_0x13eae2,null))[_0xd619('0x25')](removeEntity(_0x13eae2,null))[_0xd619('0x40')](handleError(_0x13eae2,null));};exports[_0xd619('0x48')]=function(_0x5ca106,_0x44cfc3,_0x285e24){var _0x528cf2={};var _0x343fc9={};var _0x226c3c;var _0x590023;return db[_0xd619('0x3d')][_0xd619('0x49')]({'where':{'id':_0x5ca106[_0xd619('0x42')]['id']}})[_0xd619('0x25')](handleEntityNotFound(_0x44cfc3,null))[_0xd619('0x25')](function(_0x15494c){if(_0x15494c){_0x226c3c=_0x15494c;_0x343fc9['model']=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x343fc9[_0xd619('0x2e')]=_[_0xd619('0x2d')](_0x5ca106[_0xd619('0x2e')]);_0x343fc9[_0xd619('0x2f')]=_[_0xd619('0x30')](_0x343fc9[_0xd619('0x2c')],_0x343fc9[_0xd619('0x2e')]);_0x528cf2[_0xd619('0x32')]=_[_0xd619('0x30')](_0x343fc9[_0xd619('0x2c')],qs[_0xd619('0x31')](_0x5ca106[_0xd619('0x2e')][_0xd619('0x31')]));_0x528cf2[_0xd619('0x32')]=_0x528cf2[_0xd619('0x32')][_0xd619('0x43')]?_0x528cf2[_0xd619('0x32')]:_0x343fc9[_0xd619('0x2c')];_0x528cf2['order']=qs[_0xd619('0x35')](_0x5ca106[_0xd619('0x2e')]['sort']);_0x528cf2[_0xd619('0x38')]=qs[_0xd619('0x2f')](_['pick'](_0x5ca106['query'],_0x343fc9[_0xd619('0x2f')]));if(_0x5ca106[_0xd619('0x2e')]['filter']){_0x528cf2[_0xd619('0x38')]=_[_0xd619('0x3b')](_0x528cf2[_0xd619('0x38')],{'$or':_[_0xd619('0x39')](_0x528cf2[_0xd619('0x32')],function(_0x5c07ad){var _0x356fc6={};_0x356fc6[_0x5c07ad]={'$like':'%'+_0x5ca106['query'][_0xd619('0x37')]+'%'};return _0x356fc6;})});}_0x528cf2=_[_0xd619('0x3b')]({},_0x528cf2,_0x5ca106['options']);return _0x226c3c[_0xd619('0x48')](_0x528cf2);}})[_0xd619('0x25')](function(_0x360914){if(_0x360914){_0x590023=_0x360914[_0xd619('0x43')];if(!_0x5ca106[_0xd619('0x2e')][_0xd619('0x33')](_0xd619('0x34'))){_0x528cf2['limit']=qs[_0xd619('0x1c')](_0x5ca106[_0xd619('0x2e')][_0xd619('0x1c')]);_0x528cf2[_0xd619('0x1e')]=qs[_0xd619('0x1e')](_0x5ca106['query']['offset']);}return _0x226c3c['getConfigurations'](_0x528cf2);}})[_0xd619('0x25')](function(_0x16d610){if(_0x16d610){return _0x16d610?{'count':_0x590023,'rows':_0x16d610}:null;}})[_0xd619('0x25')](respondWithResult(_0x44cfc3,null))[_0xd619('0x40')](handleError(_0x44cfc3,null));};exports['addConfiguration']=function(_0x417bd8,_0x200e7e,_0x42262f){if(_0x417bd8[_0xd619('0x46')]['id']){delete _0x417bd8[_0xd619('0x46')]['id'];}return db[_0xd619('0x3d')]['findOne']({'where':{'id':_0x417bd8['params']['id']}})[_0xd619('0x25')](handleEntityNotFound(_0x200e7e,null))[_0xd619('0x25')](function(_0x37dac0){if(_0x37dac0){_0x417bd8['body'][_0xd619('0x4a')]=_0x37dac0['id'];_0x417bd8[_0xd619('0x46')]['Subjects']=integrations[_0xd619('0x4b')](_0x417bd8[_0xd619('0x46')][_0xd619('0x4c')],_0x417bd8[_0xd619('0x46')][_0xd619('0x2b')]);_0x417bd8[_0xd619('0x46')][_0xd619('0x4d')]=integrations['getDescriptions'](_0x417bd8['body'][_0xd619('0x4c')],_0x417bd8['body'][_0xd619('0x2b')]);return db[_0xd619('0x4e')][_0xd619('0x45')](_0x417bd8['body'],{'include':[{'model':db[_0xd619('0x4f')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xd619('0x25')](respondWithResult(_0x200e7e,null))[_0xd619('0x40')](handleError(_0x200e7e,null));};exports['getFields']=function(_0x558e80,_0x1fe9b3,_0x5a9799){var _0x5f8367='';var _0x7aae0=['id',_0xd619('0x28'),_0xd619('0x50'),'created_by',_0xd619('0x51'),_0xd619('0x52'),_0xd619('0x53'),_0xd619('0x54'),_0xd619('0x55'),_0xd619('0x56'),_0xd619('0x57'),_0xd619('0x58')];return db['SugarcrmAccount'][_0xd619('0x49')]({'where':{'id':_0x558e80['params']['id']},'attributes':['id','username',_0xd619('0x59'),_0xd619('0x5a')]})[_0xd619('0x25')](handleEntityNotFound(_0x1fe9b3,null))[_0xd619('0x25')](function(_0x3a5b6f){if(_0x3a5b6f){_0x5f8367=_0x3a5b6f[_0xd619('0x5a')];var _0x11ba92=_0x5f8367[_0xd619('0x5b')](-0x1);if(_0x11ba92==='/'){_0x5f8367=_0x5f8367[_0xd619('0x5c')](0x0,_0x5f8367['lastIndexOf'](_0x11ba92));}return rp({'method':_0xd619('0x5d'),'uri':util[_0xd619('0x5e')](_0xd619('0x5f'),_0x5f8367,_0xd619('0x60')),'json':!![],'form':{'method':_0xd619('0x61'),'input_type':_0xd619('0x62'),'response_type':'JSON','rest_data':JSON[_0xd619('0x63')]({'user_auth':{'user_name':_0x3a5b6f[_0xd619('0x64')],'password':_0x3a5b6f['password'],'encryption':_0xd619('0x65')},'application':_0xd619('0x66')})}});}})['then'](function(_0x5aed35){if(_0x5aed35&&_0x5aed35[_0xd619('0x28')]!==_0xd619('0x67')&&_0x5aed35[_0xd619('0x28')]!==_0xd619('0x68')){return rp({'method':_0xd619('0x5d'),'uri':util[_0xd619('0x5e')]('%s%s',_0x5f8367,_0xd619('0x60')),'json':!![],'form':{'method':_0xd619('0x69'),'input_type':_0xd619('0x62'),'response_type':_0xd619('0x62'),'rest_data':JSON[_0xd619('0x63')]({'session':_0x5aed35['id'],'module_name':_0xd619('0x6a')})}})[_0xd619('0x25')](function(_0x188da2){if(_0x188da2){var _0x316a1f=_[_0xd619('0x6b')](_0x188da2[_0xd619('0x6c')]);_['remove'](_0x316a1f,function(_0x56377a){return _0x7aae0['includes'](_0x56377a[_0xd619('0x28')]);});return{'count':_0x316a1f['length'],'rows':_[_0xd619('0x39')](_0x316a1f,function(_0x376be8){return{'id':_0x376be8[_0xd619('0x28')],'name':_0x376be8[_0xd619('0x6d')],'custom':_[_0xd619('0x6e')](_0x376be8['name'],'_c')?!![]:![],'options':_0x376be8[_0xd619('0x3c')]?_[_0xd619('0x39')](_[_0xd619('0x6b')](_0x376be8[_0xd619('0x3c')]),function(_0x4ff5ec){return{'name':_0x4ff5ec['value'],'value':_0x4ff5ec[_0xd619('0x28')]};}):[]};})};}})[_0xd619('0x25')](respondWithResult(_0x1fe9b3,null))[_0xd619('0x40')](function(_0x15aab4){var _0x1a73a4=_0x558e80[_0xd619('0x2e')]['test']?0x1f4:_0x15aab4['statusCode']||0x1f4;logger[_0xd619('0x26')](_0xd619('0x6f'),_0xd619('0x70'),_0x1a73a4,JSON[_0xd619('0x63')](_0x15aab4));delete _0x15aab4['name'];if(_0x1a73a4===0x191){_0x1a73a4=0x190;}_0x1fe9b3[_0xd619('0x19')](_0x1a73a4)[_0xd619('0x71')](_0x558e80[_0xd619('0x2e')][_0xd619('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x15aab4[_0xd619('0x73')]}:_0x15aab4);});}else{var _0x377abe=0x1f4;_0x1fe9b3[_0xd619('0x19')](_0x377abe)[_0xd619('0x71')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xeda6=['sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','SugarcrmAccount','keys','find','create','body','update','params','getConfigurations','findOne','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','JSON','module_fields','remove','label','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration'];(function(_0x5d6b41,_0x3d1c8f){var _0x1c2dd6=function(_0x48d601){while(--_0x48d601){_0x5d6b41['push'](_0x5d6b41['shift']());}};_0x1c2dd6(++_0x3d1c8f);}(_0xeda6,0x157));var _0x6eda=function(_0xa3053b,_0x4fd758){_0xa3053b=_0xa3053b-0x0;var _0x1b71fe=_0xeda6[_0xa3053b];return _0x1b71fe;};'use strict';var emlformat=require(_0x6eda('0x0'));var rimraf=require(_0x6eda('0x1'));var zipdir=require(_0x6eda('0x2'));var jsonpatch=require(_0x6eda('0x3'));var rp=require(_0x6eda('0x4'));var moment=require(_0x6eda('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6eda('0x6'));var util=require(_0x6eda('0x7'));var path=require('path');var sox=require(_0x6eda('0x8'));var csv=require('to-csv');var ejs=require(_0x6eda('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6eda('0xa'));var squel=require(_0x6eda('0xb'));var crypto=require(_0x6eda('0xc'));var jsforce=require(_0x6eda('0xd'));var deskjs=require(_0x6eda('0xe'));var toCsv=require(_0x6eda('0xf'));var querystring=require(_0x6eda('0x10'));var Papa=require(_0x6eda('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6eda('0x12'));var as=require(_0x6eda('0x13'));var hardwareService=require(_0x6eda('0x14'));var logger=require(_0x6eda('0x15'))(_0x6eda('0x16'));var utils=require(_0x6eda('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6eda('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6eda('0x19'));function respondWithStatusCode(_0x23e152,_0xace04d){_0xace04d=_0xace04d||0xcc;return function(_0x2d94b5){if(_0x2d94b5){return _0x23e152[_0x6eda('0x1a')](_0xace04d);}return _0x23e152['status'](_0xace04d)[_0x6eda('0x1b')]();};}function respondWithResult(_0x1bf24c,_0x4c1f0a){_0x4c1f0a=_0x4c1f0a||0xc8;return function(_0x367cfd){if(_0x367cfd){return _0x1bf24c[_0x6eda('0x1c')](_0x4c1f0a)['json'](_0x367cfd);}};}function respondWithFilteredResult(_0x50fc07,_0x54e3de){return function(_0x4d0d32){if(_0x4d0d32){var _0x309b79=typeof _0x54e3de['offset']==='undefined'&&typeof _0x54e3de[_0x6eda('0x1d')]===_0x6eda('0x1e');var _0x4d89a8=_0x4d0d32[_0x6eda('0x1f')];var _0x4b2dd0=_0x309b79?0x0:_0x54e3de[_0x6eda('0x20')];var _0x279016=_0x309b79?_0x4d0d32[_0x6eda('0x1f')]:_0x54e3de[_0x6eda('0x20')]+_0x54e3de[_0x6eda('0x1d')];var _0xa9860b;if(_0x279016>=_0x4d89a8){_0x279016=_0x4d89a8;_0xa9860b=0xc8;}else{_0xa9860b=0xce;}_0x50fc07[_0x6eda('0x1c')](_0xa9860b);return _0x50fc07[_0x6eda('0x21')](_0x6eda('0x22'),_0x4b2dd0+'-'+_0x279016+'/'+_0x4d89a8)[_0x6eda('0x23')](_0x4d0d32);}return null;};}function patchUpdates(_0x505a1b){return function(_0x1f3f1d){try{jsonpatch[_0x6eda('0x24')](_0x1f3f1d,_0x505a1b,!![]);}catch(_0x274fda){return BPromise[_0x6eda('0x25')](_0x274fda);}return _0x1f3f1d[_0x6eda('0x26')]();};}function saveUpdates(_0x51ea35,_0x1881e1){return function(_0x4a3f23){if(_0x4a3f23){return _0x4a3f23['update'](_0x51ea35)[_0x6eda('0x27')](function(_0x56f87f){return _0x56f87f;});}return null;};}function removeEntity(_0x1e6c65,_0x5b629b){return function(_0x52de87){if(_0x52de87){return _0x52de87[_0x6eda('0x28')]()['then'](function(){_0x1e6c65[_0x6eda('0x1c')](0xcc)[_0x6eda('0x1b')]();});}};}function handleEntityNotFound(_0x2134e0,_0x1b7c80){return function(_0x38de78){if(!_0x38de78){_0x2134e0[_0x6eda('0x1a')](0x194);}return _0x38de78;};}function handleError(_0x5a899e,_0x3d7e4d){_0x3d7e4d=_0x3d7e4d||0x1f4;return function(_0x4d1df9){logger[_0x6eda('0x29')](_0x4d1df9[_0x6eda('0x2a')]);if(_0x4d1df9[_0x6eda('0x2b')]){delete _0x4d1df9[_0x6eda('0x2b')];}_0x5a899e[_0x6eda('0x1c')](_0x3d7e4d)['send'](_0x4d1df9);};}exports[_0x6eda('0x2c')]=function(_0x2832c8,_0x56f32a){var _0x4985e9={},_0x4f5428={},_0x5ed781={'count':0x0,'rows':[]};var _0x1e2b04=_[_0x6eda('0x2d')](db['SugarcrmAccount'][_0x6eda('0x2e')],function(_0x383838){return{'name':_0x383838[_0x6eda('0x2f')],'type':_0x383838[_0x6eda('0x30')][_0x6eda('0x31')]};});_0x4f5428[_0x6eda('0x32')]=_[_0x6eda('0x2d')](_0x1e2b04,_0x6eda('0x2b'));_0x4f5428['query']=_['keys'](_0x2832c8[_0x6eda('0x33')]);_0x4f5428[_0x6eda('0x34')]=_[_0x6eda('0x35')](_0x4f5428['model'],_0x4f5428[_0x6eda('0x33')]);_0x4985e9['attributes']=_[_0x6eda('0x35')](_0x4f5428[_0x6eda('0x32')],qs[_0x6eda('0x36')](_0x2832c8[_0x6eda('0x33')]['fields']));_0x4985e9[_0x6eda('0x37')]=_0x4985e9[_0x6eda('0x37')][_0x6eda('0x38')]?_0x4985e9[_0x6eda('0x37')]:_0x4f5428[_0x6eda('0x32')];if(!_0x2832c8[_0x6eda('0x33')][_0x6eda('0x39')](_0x6eda('0x3a'))){_0x4985e9[_0x6eda('0x1d')]=qs[_0x6eda('0x1d')](_0x2832c8['query']['limit']);_0x4985e9['offset']=qs[_0x6eda('0x20')](_0x2832c8[_0x6eda('0x33')][_0x6eda('0x20')]);}_0x4985e9[_0x6eda('0x3b')]=qs['sort'](_0x2832c8[_0x6eda('0x33')][_0x6eda('0x3c')]);_0x4985e9[_0x6eda('0x3d')]=qs[_0x6eda('0x34')](_[_0x6eda('0x3e')](_0x2832c8[_0x6eda('0x33')],_0x4f5428['filters']),_0x1e2b04);if(_0x2832c8[_0x6eda('0x33')]['filter']){_0x4985e9[_0x6eda('0x3d')]=_['merge'](_0x4985e9[_0x6eda('0x3d')],{'$or':_['map'](_0x1e2b04,function(_0xc9cf43){if(_0xc9cf43[_0x6eda('0x30')]!=='VIRTUAL'){var _0x235b04={};_0x235b04[_0xc9cf43[_0x6eda('0x2b')]]={'$like':'%'+_0x2832c8[_0x6eda('0x33')][_0x6eda('0x3f')]+'%'};return _0x235b04;}})});}_0x4985e9=_[_0x6eda('0x40')]({},_0x4985e9,_0x2832c8[_0x6eda('0x41')]);var _0x3e4143={'where':_0x4985e9[_0x6eda('0x3d')]};return db['SugarcrmAccount']['count'](_0x3e4143)[_0x6eda('0x27')](function(_0x10a6f9){_0x5ed781[_0x6eda('0x1f')]=_0x10a6f9;if(_0x2832c8['query'][_0x6eda('0x42')]){_0x4985e9[_0x6eda('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x6eda('0x44')](_0x4985e9);})['then'](function(_0x2f1b08){_0x5ed781[_0x6eda('0x45')]=_0x2f1b08;return _0x5ed781;})['then'](respondWithFilteredResult(_0x56f32a,_0x4985e9))[_0x6eda('0x46')](handleError(_0x56f32a,null));};exports[_0x6eda('0x47')]=function(_0x3dc4b5,_0x1d2767){var _0x4f3101={'raw':![],'where':{'id':_0x3dc4b5['params']['id']}},_0x3aa95f={};_0x3aa95f[_0x6eda('0x32')]=_['keys'](db[_0x6eda('0x48')][_0x6eda('0x2e')]);_0x3aa95f[_0x6eda('0x33')]=_[_0x6eda('0x49')](_0x3dc4b5[_0x6eda('0x33')]);_0x3aa95f['filters']=_[_0x6eda('0x35')](_0x3aa95f[_0x6eda('0x32')],_0x3aa95f[_0x6eda('0x33')]);_0x4f3101[_0x6eda('0x37')]=_['intersection'](_0x3aa95f[_0x6eda('0x32')],qs[_0x6eda('0x36')](_0x3dc4b5[_0x6eda('0x33')][_0x6eda('0x36')]));_0x4f3101[_0x6eda('0x37')]=_0x4f3101[_0x6eda('0x37')]['length']?_0x4f3101['attributes']:_0x3aa95f[_0x6eda('0x32')];if(_0x3dc4b5[_0x6eda('0x33')][_0x6eda('0x42')]){_0x4f3101[_0x6eda('0x43')]=[{'all':!![]}];}_0x4f3101=_[_0x6eda('0x40')]({},_0x4f3101,_0x3dc4b5[_0x6eda('0x41')]);return db[_0x6eda('0x48')][_0x6eda('0x4a')](_0x4f3101)[_0x6eda('0x27')](handleEntityNotFound(_0x1d2767,null))[_0x6eda('0x27')](respondWithResult(_0x1d2767,null))[_0x6eda('0x46')](handleError(_0x1d2767,null));};exports[_0x6eda('0x4b')]=function(_0x1a5450,_0x1cba99){return db['SugarcrmAccount'][_0x6eda('0x4b')](_0x1a5450[_0x6eda('0x4c')],{})[_0x6eda('0x27')](respondWithResult(_0x1cba99,0xc9))['catch'](handleError(_0x1cba99,null));};exports[_0x6eda('0x4d')]=function(_0x521e9d,_0x488038){if(_0x521e9d['body']['id']){delete _0x521e9d[_0x6eda('0x4c')]['id'];}return db[_0x6eda('0x48')][_0x6eda('0x4a')]({'where':{'id':_0x521e9d[_0x6eda('0x4e')]['id']}})[_0x6eda('0x27')](handleEntityNotFound(_0x488038,null))['then'](saveUpdates(_0x521e9d[_0x6eda('0x4c')],null))['then'](respondWithResult(_0x488038,null))[_0x6eda('0x46')](handleError(_0x488038,null));};exports[_0x6eda('0x28')]=function(_0x546e7f,_0x29c88d){return db[_0x6eda('0x48')][_0x6eda('0x4a')]({'where':{'id':_0x546e7f[_0x6eda('0x4e')]['id']}})[_0x6eda('0x27')](handleEntityNotFound(_0x29c88d,null))[_0x6eda('0x27')](removeEntity(_0x29c88d,null))[_0x6eda('0x46')](handleError(_0x29c88d,null));};exports[_0x6eda('0x4f')]=function(_0x2c9a26,_0x52bfdd,_0x1307c5){var _0x20a69f={};var _0x10acec={};var _0x34f82e;var _0x5d1dc2;return db[_0x6eda('0x48')][_0x6eda('0x50')]({'where':{'id':_0x2c9a26[_0x6eda('0x4e')]['id']}})[_0x6eda('0x27')](handleEntityNotFound(_0x52bfdd,null))[_0x6eda('0x27')](function(_0x5db554){if(_0x5db554){_0x34f82e=_0x5db554;_0x10acec['model']=_[_0x6eda('0x49')](db['SugarcrmConfiguration'][_0x6eda('0x2e')]);_0x10acec[_0x6eda('0x33')]=_['keys'](_0x2c9a26[_0x6eda('0x33')]);_0x10acec['filters']=_[_0x6eda('0x35')](_0x10acec[_0x6eda('0x32')],_0x10acec[_0x6eda('0x33')]);_0x20a69f[_0x6eda('0x37')]=_[_0x6eda('0x35')](_0x10acec[_0x6eda('0x32')],qs[_0x6eda('0x36')](_0x2c9a26[_0x6eda('0x33')]['fields']));_0x20a69f[_0x6eda('0x37')]=_0x20a69f[_0x6eda('0x37')][_0x6eda('0x38')]?_0x20a69f['attributes']:_0x10acec['model'];_0x20a69f[_0x6eda('0x3b')]=qs[_0x6eda('0x3c')](_0x2c9a26[_0x6eda('0x33')][_0x6eda('0x3c')]);_0x20a69f[_0x6eda('0x3d')]=qs[_0x6eda('0x34')](_['pick'](_0x2c9a26[_0x6eda('0x33')],_0x10acec['filters']));if(_0x2c9a26[_0x6eda('0x33')][_0x6eda('0x3f')]){_0x20a69f[_0x6eda('0x3d')]=_[_0x6eda('0x40')](_0x20a69f[_0x6eda('0x3d')],{'$or':_[_0x6eda('0x2d')](_0x20a69f[_0x6eda('0x37')],function(_0x221b3a){var _0x39feca={};_0x39feca[_0x221b3a]={'$like':'%'+_0x2c9a26[_0x6eda('0x33')][_0x6eda('0x3f')]+'%'};return _0x39feca;})});}_0x20a69f=_[_0x6eda('0x40')]({},_0x20a69f,_0x2c9a26[_0x6eda('0x41')]);return _0x34f82e['getConfigurations'](_0x20a69f);}})[_0x6eda('0x27')](function(_0x20c756){if(_0x20c756){_0x5d1dc2=_0x20c756[_0x6eda('0x38')];if(!_0x2c9a26['query'][_0x6eda('0x39')](_0x6eda('0x3a'))){_0x20a69f[_0x6eda('0x1d')]=qs['limit'](_0x2c9a26[_0x6eda('0x33')][_0x6eda('0x1d')]);_0x20a69f[_0x6eda('0x20')]=qs[_0x6eda('0x20')](_0x2c9a26[_0x6eda('0x33')][_0x6eda('0x20')]);}return _0x34f82e['getConfigurations'](_0x20a69f);}})[_0x6eda('0x27')](function(_0x4d14f5){if(_0x4d14f5){return _0x4d14f5?{'count':_0x5d1dc2,'rows':_0x4d14f5}:null;}})[_0x6eda('0x27')](respondWithResult(_0x52bfdd,null))[_0x6eda('0x46')](handleError(_0x52bfdd,null));};exports[_0x6eda('0x51')]=function(_0x22f5de,_0x1aaa85,_0x5e926d){if(_0x22f5de['body']['id']){delete _0x22f5de[_0x6eda('0x4c')]['id'];}return db[_0x6eda('0x48')]['findOne']({'where':{'id':_0x22f5de[_0x6eda('0x4e')]['id']}})[_0x6eda('0x27')](handleEntityNotFound(_0x1aaa85,null))[_0x6eda('0x27')](function(_0x4350ce){if(_0x4350ce){_0x22f5de[_0x6eda('0x4c')]['AccountId']=_0x4350ce['id'];_0x22f5de[_0x6eda('0x4c')]['Subjects']=integrations[_0x6eda('0x52')](_0x22f5de[_0x6eda('0x4c')][_0x6eda('0x53')],_0x22f5de[_0x6eda('0x4c')][_0x6eda('0x30')]);_0x22f5de['body'][_0x6eda('0x54')]=integrations[_0x6eda('0x55')](_0x22f5de[_0x6eda('0x4c')][_0x6eda('0x53')],_0x22f5de[_0x6eda('0x4c')][_0x6eda('0x30')]);return db['SugarcrmConfiguration'][_0x6eda('0x4b')](_0x22f5de[_0x6eda('0x4c')],{'include':[{'model':db[_0x6eda('0x56')],'as':_0x6eda('0x57')},{'model':db['SugarcrmField'],'as':_0x6eda('0x54')}]});}return null;})[_0x6eda('0x27')](respondWithResult(_0x1aaa85,null))[_0x6eda('0x46')](handleError(_0x1aaa85,null));};exports[_0x6eda('0x58')]=function(_0xb01a11,_0xe5d30c,_0x2413e9){var _0x21417e='';var _0x4a06a6=['id',_0x6eda('0x2b'),_0x6eda('0x59'),_0x6eda('0x5a'),_0x6eda('0x5b'),_0x6eda('0x5c'),_0x6eda('0x5d'),'duration_minutes',_0x6eda('0x5e'),'parent_type',_0x6eda('0x5f'),_0x6eda('0x60')];return db['SugarcrmAccount'][_0x6eda('0x50')]({'where':{'id':_0xb01a11[_0x6eda('0x4e')]['id']},'attributes':['id',_0x6eda('0x61'),_0x6eda('0x62'),_0x6eda('0x63')]})[_0x6eda('0x27')](handleEntityNotFound(_0xe5d30c,null))['then'](function(_0x4052d8){if(_0x4052d8){_0x21417e=_0x4052d8[_0x6eda('0x63')];var _0x58dce3=_0x21417e[_0x6eda('0x64')](-0x1);if(_0x58dce3==='/'){_0x21417e=_0x21417e[_0x6eda('0x65')](0x0,_0x21417e[_0x6eda('0x66')](_0x58dce3));}return rp({'method':_0x6eda('0x67'),'uri':util[_0x6eda('0x68')]('%s%s',_0x21417e,_0x6eda('0x69')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x6eda('0x6a')]({'user_auth':{'user_name':_0x4052d8[_0x6eda('0x61')],'password':_0x4052d8['password'],'encryption':_0x6eda('0x6b')},'application':_0x6eda('0x6c')})}});}})[_0x6eda('0x27')](function(_0x1900a6){if(_0x1900a6&&_0x1900a6[_0x6eda('0x2b')]!==_0x6eda('0x6d')&&_0x1900a6[_0x6eda('0x2b')]!==_0x6eda('0x6e')){return rp({'method':_0x6eda('0x67'),'uri':util[_0x6eda('0x68')]('%s%s',_0x21417e,_0x6eda('0x69')),'json':!![],'form':{'method':_0x6eda('0x6f'),'input_type':_0x6eda('0x70'),'response_type':'JSON','rest_data':JSON[_0x6eda('0x6a')]({'session':_0x1900a6['id'],'module_name':'Calls'})}})[_0x6eda('0x27')](function(_0x4cb4a9){if(_0x4cb4a9){var _0x1dec2c=_['values'](_0x4cb4a9[_0x6eda('0x71')]);_[_0x6eda('0x72')](_0x1dec2c,function(_0x5670cb){return _0x4a06a6['includes'](_0x5670cb[_0x6eda('0x2b')]);});return{'count':_0x1dec2c['length'],'rows':_[_0x6eda('0x2d')](_0x1dec2c,function(_0xb16a69){return{'id':_0xb16a69[_0x6eda('0x2b')],'name':_0xb16a69[_0x6eda('0x73')],'custom':_['endsWith'](_0xb16a69[_0x6eda('0x2b')],'_c')?!![]:![],'options':_0xb16a69[_0x6eda('0x41')]?_[_0x6eda('0x2d')](_[_0x6eda('0x74')](_0xb16a69[_0x6eda('0x41')]),function(_0x2241e4){return{'name':_0x2241e4[_0x6eda('0x75')],'value':_0x2241e4[_0x6eda('0x2b')]};}):[]};})};}})[_0x6eda('0x27')](respondWithResult(_0xe5d30c,null))[_0x6eda('0x46')](function(_0x5517b4){var _0xc700f7=_0xb01a11[_0x6eda('0x33')]['test']?0x1f4:_0x5517b4[_0x6eda('0x76')]||0x1f4;logger['error'](_0x6eda('0x77'),_0x6eda('0x58'),_0xc700f7,JSON[_0x6eda('0x6a')](_0x5517b4));delete _0x5517b4[_0x6eda('0x2b')];if(_0xc700f7===0x191){_0xc700f7=0x190;}_0xe5d30c[_0x6eda('0x1c')](_0xc700f7)[_0x6eda('0x78')](_0xb01a11[_0x6eda('0x33')][_0x6eda('0x79')]?{'message':_0x6eda('0x7a'),'statusCode':_0x5517b4[_0x6eda('0x76')]}:_0x5517b4);});}else{var _0x4fa613=0x1f4;_0xe5d30c[_0x6eda('0x1c')](_0x4fa613)[_0x6eda('0x78')]({'message':_0x6eda('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index b224d43..a113c1e 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 _0x4bcf=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','api','bluebird','request-promise'];(function(_0x5ca965,_0x494dba){var _0x2361b6=function(_0x29f6ba){while(--_0x29f6ba){_0x5ca965['push'](_0x5ca965['shift']());}};_0x2361b6(++_0x494dba);}(_0x4bcf,0x177));var _0xf4bc=function(_0xf38ca5,_0x31986f){_0xf38ca5=_0xf38ca5-0x0;var _0x2c07c7=_0x4bcf[_0xf38ca5];return _0x2c07c7;};'use strict';var _=require(_0xf4bc('0x0'));var util=require(_0xf4bc('0x1'));var logger=require('../../config/logger')(_0xf4bc('0x2'));var moment=require('moment');var BPromise=require(_0xf4bc('0x3'));var rp=require(_0xf4bc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf4bc('0x5'));var integrations=require(_0xf4bc('0x6'));module[_0xf4bc('0x7')]=function(_0x220411,_0x2f871f){return _0x220411[_0xf4bc('0x8')]('SugarcrmAccount',attributes,{'tableName':_0xf4bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1ee=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3be4b5,_0x50104f){var _0xd54c23=function(_0x24c7a8){while(--_0x24c7a8){_0x3be4b5['push'](_0x3be4b5['shift']());}};_0xd54c23(++_0x50104f);}(_0xb1ee,0x11e));var _0xeb1e=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xb1ee[_0x154192];return _0x3c2792;};'use strict';var _=require(_0xeb1e('0x0'));var util=require(_0xeb1e('0x1'));var logger=require(_0xeb1e('0x2'))(_0xeb1e('0x3'));var moment=require(_0xeb1e('0x4'));var BPromise=require(_0xeb1e('0x5'));var rp=require(_0xeb1e('0x6'));var fs=require('fs');var path=require(_0xeb1e('0x7'));var rimraf=require(_0xeb1e('0x8'));var config=require(_0xeb1e('0x9'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xeb1e('0xa'));module[_0xeb1e('0xb')]=function(_0x4ada2d,_0x1d5d7f){return _0x4ada2d[_0xeb1e('0xc')]('SugarcrmAccount',attributes,{'tableName':_0xeb1e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index d7dd37c..7b3bc09 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 _0x51f7=['info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowSugarcrmAccount','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x51f7,0x180));var _0x751f=function(_0x2638d0,_0x52f653){_0x2638d0=_0x2638d0-0x0;var _0x411a60=_0x51f7[_0x2638d0];return _0x411a60;};'use strict';var _=require(_0x751f('0x0'));var util=require(_0x751f('0x1'));var moment=require(_0x751f('0x2'));var BPromise=require(_0x751f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x751f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x751f('0x5'))(_0x751f('0x6'));var config=require(_0x751f('0x7'));var jayson=require(_0x751f('0x8'));var client=jayson[_0x751f('0x9')][_0x751f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11b52a,_0x4acf0b,_0x475a97){return new BPromise(function(_0x53bd1f,_0x486db1){return client[_0x751f('0xb')](_0x11b52a,_0x475a97)['then'](function(_0x16af49){logger[_0x751f('0xc')](_0x751f('0xd'),_0x4acf0b,_0x751f('0xe'));logger[_0x751f('0xf')](_0x751f('0x10'),_0x4acf0b,_0x751f('0xe'),JSON[_0x751f('0x11')](_0x16af49));if(_0x16af49[_0x751f('0x12')]){if(_0x16af49[_0x751f('0x12')][_0x751f('0x13')]===0x1f4){logger[_0x751f('0x12')](_0x751f('0xd'),_0x4acf0b,_0x16af49[_0x751f('0x12')]['message']);return _0x486db1(_0x16af49[_0x751f('0x12')][_0x751f('0x14')]);}logger[_0x751f('0x12')](_0x751f('0xd'),_0x4acf0b,_0x16af49[_0x751f('0x12')][_0x751f('0x14')]);return _0x53bd1f(_0x16af49[_0x751f('0x12')][_0x751f('0x14')]);}else{logger[_0x751f('0xc')](_0x751f('0xd'),_0x4acf0b,_0x751f('0xe'));_0x53bd1f(_0x16af49[_0x751f('0x15')][_0x751f('0x14')]);}})[_0x751f('0x16')](function(_0x55ee10){logger[_0x751f('0x12')](_0x751f('0xd'),_0x4acf0b,_0x55ee10);_0x486db1(_0x55ee10);});});}exports[_0x751f('0x17')]=function(_0x173167){var _0x5d27c7=this;return new Promise(function(_0x15348d,_0x3fa842){return db[_0x751f('0x18')][_0x751f('0x19')]({'raw':_0x173167[_0x751f('0x1a')]?_0x173167[_0x751f('0x1a')][_0x751f('0x1b')]===undefined?!![]:![]:!![],'where':_0x173167['options']?_0x173167[_0x751f('0x1a')][_0x751f('0x1c')]||null:null,'attributes':_0x173167['options']?_0x173167['options'][_0x751f('0x1d')]||null:null,'limit':_0x173167[_0x751f('0x1a')]?_0x173167[_0x751f('0x1a')][_0x751f('0x1e')]||null:null,'include':_0x173167['options']?_0x173167['options']['include']?_[_0x751f('0x1f')](_0x173167[_0x751f('0x1a')][_0x751f('0x20')],function(_0x331f88){return{'model':db[_0x331f88['model']],'as':_0x331f88['as'],'attributes':_0x331f88[_0x751f('0x1d')],'include':_0x331f88[_0x751f('0x20')]?_[_0x751f('0x1f')](_0x331f88[_0x751f('0x20')],function(_0x523915){return{'model':db[_0x523915[_0x751f('0x21')]],'as':_0x523915['as'],'attributes':_0x523915[_0x751f('0x1d')],'include':_0x523915[_0x751f('0x20')]?_['map'](_0x523915['include'],function(_0x2ecc9f){return{'model':db[_0x2ecc9f[_0x751f('0x21')]],'as':_0x2ecc9f['as'],'attributes':_0x2ecc9f[_0x751f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x751f('0x22')](function(_0x4c78a0){logger[_0x751f('0xc')]('GetSugarcrmAccount',_0x173167);logger[_0x751f('0xf')](_0x751f('0x17'),_0x173167,JSON['stringify'](_0x4c78a0));_0x15348d(_0x4c78a0);})[_0x751f('0x16')](function(_0x1b62eb){logger[_0x751f('0x12')](_0x751f('0x17'),_0x1b62eb['message'],_0x173167);_0x3fa842(_0x5d27c7[_0x751f('0x12')](0x1f4,_0x1b62eb[_0x751f('0x14')]));});});};exports[_0x751f('0x23')]=function(_0x2ae972){var _0x587c2b=this;return new Promise(function(_0x37979c,_0x267711){return db['SugarcrmAccount']['find']({'raw':_0x2ae972[_0x751f('0x1a')]?_0x2ae972[_0x751f('0x1a')][_0x751f('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ae972[_0x751f('0x1a')]?_0x2ae972[_0x751f('0x1a')][_0x751f('0x1c')]||null:null,'attributes':_0x2ae972[_0x751f('0x1a')]?_0x2ae972[_0x751f('0x1a')][_0x751f('0x1d')]||null:null,'include':_0x2ae972[_0x751f('0x1a')]?_0x2ae972[_0x751f('0x1a')][_0x751f('0x20')]?_[_0x751f('0x1f')](_0x2ae972[_0x751f('0x1a')]['include'],function(_0x58b928){return{'model':db[_0x58b928[_0x751f('0x21')]],'as':_0x58b928['as'],'attributes':_0x58b928[_0x751f('0x1d')],'include':_0x58b928[_0x751f('0x20')]?_[_0x751f('0x1f')](_0x58b928[_0x751f('0x20')],function(_0x589aac){return{'model':db[_0x589aac[_0x751f('0x21')]],'as':_0x589aac['as'],'attributes':_0x589aac[_0x751f('0x1d')],'include':_0x589aac[_0x751f('0x20')]?_[_0x751f('0x1f')](_0x589aac[_0x751f('0x20')],function(_0x398c08){return{'model':db[_0x398c08['model']],'as':_0x398c08['as'],'attributes':_0x398c08[_0x751f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427bae){logger[_0x751f('0xc')](_0x751f('0x23'),_0x2ae972);logger[_0x751f('0xf')]('ShowSugarcrmAccount',_0x2ae972,JSON[_0x751f('0x11')](_0x427bae));_0x37979c(_0x427bae);})[_0x751f('0x16')](function(_0x403b19){logger[_0x751f('0x12')](_0x751f('0x23'),_0x403b19[_0x751f('0x14')],_0x2ae972);_0x267711(_0x587c2b['error'](0x1f4,_0x403b19['message']));});});}; \ No newline at end of file +var _0x5b18=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetSugarcrmAccount','options','raw','include','map','model','attributes','ShowSugarcrmAccount','SugarcrmAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x41f023,_0x256f0c){var _0x3d8bd5=function(_0x5bb741){while(--_0x5bb741){_0x41f023['push'](_0x41f023['shift']());}};_0x3d8bd5(++_0x256f0c);}(_0x5b18,0xae));var _0x85b1=function(_0x2b8a92,_0x192f64){_0x2b8a92=_0x2b8a92-0x0;var _0x31f0da=_0x5b18[_0x2b8a92];return _0x31f0da;};'use strict';var _=require('lodash');var util=require(_0x85b1('0x0'));var moment=require('moment');var BPromise=require(_0x85b1('0x1'));var rs=require(_0x85b1('0x2'));var fs=require('fs');var Redis=require(_0x85b1('0x3'));var db=require(_0x85b1('0x4'))['db'];var utils=require(_0x85b1('0x5'));var logger=require(_0x85b1('0x6'))(_0x85b1('0x7'));var config=require(_0x85b1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x85b1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3730a9,_0x34f571,_0x525ccf){return new BPromise(function(_0x1f22f4,_0x4d9d8e){return client[_0x85b1('0xa')](_0x3730a9,_0x525ccf)[_0x85b1('0xb')](function(_0x1498e8){logger['info'](_0x85b1('0xc'),_0x34f571,_0x85b1('0xd'));logger[_0x85b1('0xe')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x34f571,_0x85b1('0xd'),JSON[_0x85b1('0xf')](_0x1498e8));if(_0x1498e8['error']){if(_0x1498e8[_0x85b1('0x10')][_0x85b1('0x11')]===0x1f4){logger[_0x85b1('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x34f571,_0x1498e8[_0x85b1('0x10')][_0x85b1('0x12')]);return _0x4d9d8e(_0x1498e8['error'][_0x85b1('0x12')]);}logger[_0x85b1('0x10')](_0x85b1('0xc'),_0x34f571,_0x1498e8[_0x85b1('0x10')]['message']);return _0x1f22f4(_0x1498e8[_0x85b1('0x10')][_0x85b1('0x12')]);}else{logger[_0x85b1('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x34f571,_0x85b1('0xd'));_0x1f22f4(_0x1498e8[_0x85b1('0x14')][_0x85b1('0x12')]);}})[_0x85b1('0x15')](function(_0x44c08d){logger[_0x85b1('0x10')](_0x85b1('0xc'),_0x34f571,_0x44c08d);_0x4d9d8e(_0x44c08d);});});}exports[_0x85b1('0x16')]=function(_0x297f00){var _0x4d0150=this;return new Promise(function(_0x3a8af3,_0x51ce82){return db['SugarcrmAccount']['findAll']({'raw':_0x297f00[_0x85b1('0x17')]?_0x297f00[_0x85b1('0x17')][_0x85b1('0x18')]===undefined?!![]:![]:!![],'where':_0x297f00[_0x85b1('0x17')]?_0x297f00[_0x85b1('0x17')]['where']||null:null,'attributes':_0x297f00[_0x85b1('0x17')]?_0x297f00['options']['attributes']||null:null,'limit':_0x297f00['options']?_0x297f00[_0x85b1('0x17')]['limit']||null:null,'include':_0x297f00[_0x85b1('0x17')]?_0x297f00[_0x85b1('0x17')][_0x85b1('0x19')]?_[_0x85b1('0x1a')](_0x297f00['options']['include'],function(_0x3504df){return{'model':db[_0x3504df[_0x85b1('0x1b')]],'as':_0x3504df['as'],'attributes':_0x3504df[_0x85b1('0x1c')],'include':_0x3504df[_0x85b1('0x19')]?_['map'](_0x3504df[_0x85b1('0x19')],function(_0x36ac55){return{'model':db[_0x36ac55[_0x85b1('0x1b')]],'as':_0x36ac55['as'],'attributes':_0x36ac55[_0x85b1('0x1c')],'include':_0x36ac55[_0x85b1('0x19')]?_[_0x85b1('0x1a')](_0x36ac55[_0x85b1('0x19')],function(_0x5840df){return{'model':db[_0x5840df[_0x85b1('0x1b')]],'as':_0x5840df['as'],'attributes':_0x5840df['attributes']};}):[]};}):[]};}):[]:[]})[_0x85b1('0xb')](function(_0x4b518c){logger['info'](_0x85b1('0x16'),_0x297f00);logger[_0x85b1('0xe')](_0x85b1('0x16'),_0x297f00,JSON[_0x85b1('0xf')](_0x4b518c));_0x3a8af3(_0x4b518c);})[_0x85b1('0x15')](function(_0x4bf7fa){logger[_0x85b1('0x10')](_0x85b1('0x16'),_0x4bf7fa[_0x85b1('0x12')],_0x297f00);_0x51ce82(_0x4d0150[_0x85b1('0x10')](0x1f4,_0x4bf7fa[_0x85b1('0x12')]));});});};exports[_0x85b1('0x1d')]=function(_0x3f7bf3){var _0xc159bc=this;return new Promise(function(_0x593353,_0xdc280e){return db[_0x85b1('0x1e')]['find']({'raw':_0x3f7bf3['options']?_0x3f7bf3[_0x85b1('0x17')][_0x85b1('0x18')]===undefined?!![]:![]:!![],'where':_0x3f7bf3[_0x85b1('0x17')]?_0x3f7bf3[_0x85b1('0x17')]['where']||null:null,'attributes':_0x3f7bf3[_0x85b1('0x17')]?_0x3f7bf3[_0x85b1('0x17')][_0x85b1('0x1c')]||null:null,'include':_0x3f7bf3[_0x85b1('0x17')]?_0x3f7bf3[_0x85b1('0x17')][_0x85b1('0x19')]?_[_0x85b1('0x1a')](_0x3f7bf3[_0x85b1('0x17')][_0x85b1('0x19')],function(_0x2c9722){return{'model':db[_0x2c9722['model']],'as':_0x2c9722['as'],'attributes':_0x2c9722['attributes'],'include':_0x2c9722[_0x85b1('0x19')]?_[_0x85b1('0x1a')](_0x2c9722[_0x85b1('0x19')],function(_0xe2ac){return{'model':db[_0xe2ac[_0x85b1('0x1b')]],'as':_0xe2ac['as'],'attributes':_0xe2ac[_0x85b1('0x1c')],'include':_0xe2ac['include']?_['map'](_0xe2ac[_0x85b1('0x19')],function(_0xc964b2){return{'model':db[_0xc964b2['model']],'as':_0xc964b2['as'],'attributes':_0xc964b2[_0x85b1('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x541e00){logger[_0x85b1('0x13')](_0x85b1('0x1d'),_0x3f7bf3);logger['debug'](_0x85b1('0x1d'),_0x3f7bf3,JSON['stringify'](_0x541e00));_0x593353(_0x541e00);})[_0x85b1('0x15')](function(_0x81425e){logger[_0x85b1('0x10')]('ShowSugarcrmAccount',_0x81425e[_0x85b1('0x12')],_0x3f7bf3);_0xdc280e(_0xc159bc[_0x85b1('0x10')](0x1f4,_0x81425e[_0x85b1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 9d4a224..93d1fa6 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 _0xc2a1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer'];(function(_0xc05ec0,_0x451305){var _0x14d077=function(_0x490ff0){while(--_0x490ff0){_0xc05ec0['push'](_0xc05ec0['shift']());}};_0x14d077(++_0x451305);}(_0xc2a1,0x176));var _0x1c2a=function(_0x173f79,_0x3b2224){_0x173f79=_0x173f79-0x0;var _0x59ce8c=_0xc2a1[_0x173f79];return _0x59ce8c;};'use strict';var multer=require(_0x1c2a('0x0'));var util=require(_0x1c2a('0x1'));var path=require(_0x1c2a('0x2'));var timeout=require(_0x1c2a('0x3'));var express=require(_0x1c2a('0x4'));var router=express[_0x1c2a('0x5')]();var fs_extra=require(_0x1c2a('0x6'));var auth=require(_0x1c2a('0x7'));var interaction=require(_0x1c2a('0x8'));var config=require(_0x1c2a('0x9'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x1c2a('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1c2a('0xa')](_0x1c2a('0xb'),auth[_0x1c2a('0xc')](),controller[_0x1c2a('0xd')]);router[_0x1c2a('0xa')]('/:id/fields',auth[_0x1c2a('0xc')](),controller[_0x1c2a('0xe')]);router[_0x1c2a('0xa')]('/:id/subjects',auth[_0x1c2a('0xc')](),controller[_0x1c2a('0xf')]);router[_0x1c2a('0xa')](_0x1c2a('0x10'),auth['isAuthenticated'](),controller[_0x1c2a('0x11')]);router[_0x1c2a('0x12')]('/',auth[_0x1c2a('0xc')](),controller[_0x1c2a('0x13')]);router[_0x1c2a('0x14')](_0x1c2a('0xb'),auth[_0x1c2a('0xc')](),controller[_0x1c2a('0x15')]);router[_0x1c2a('0x16')]('/:id',auth[_0x1c2a('0xc')](),controller[_0x1c2a('0x17')]);module[_0x1c2a('0x18')]=router; \ No newline at end of file +var _0xcad5=['get','/:id','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0xea0aa9,_0x9ab95d){var _0x521e76=function(_0x14e30a){while(--_0x14e30a){_0xea0aa9['push'](_0xea0aa9['shift']());}};_0x521e76(++_0x9ab95d);}(_0xcad5,0xd0));var _0x5cad=function(_0x47a3ef,_0x3e140d){_0x47a3ef=_0x47a3ef-0x0;var _0x18913c=_0xcad5[_0x47a3ef];return _0x18913c;};'use strict';var multer=require(_0x5cad('0x0'));var util=require('util');var path=require(_0x5cad('0x1'));var timeout=require(_0x5cad('0x2'));var express=require(_0x5cad('0x3'));var router=express['Router']();var fs_extra=require(_0x5cad('0x4'));var auth=require(_0x5cad('0x5'));var interaction=require(_0x5cad('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0x5cad('0x7')](),controller['index']);router[_0x5cad('0x8')](_0x5cad('0x9'),auth[_0x5cad('0x7')](),controller['show']);router[_0x5cad('0x8')]('/:id/fields',auth[_0x5cad('0x7')](),controller['getFields']);router[_0x5cad('0x8')](_0x5cad('0xa'),auth[_0x5cad('0x7')](),controller[_0x5cad('0xb')]);router[_0x5cad('0x8')](_0x5cad('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x5cad('0xd')]('/',auth[_0x5cad('0x7')](),controller['create']);router[_0x5cad('0xe')](_0x5cad('0x9'),auth['isAuthenticated'](),controller[_0x5cad('0xf')]);router[_0x5cad('0x10')](_0x5cad('0x9'),auth[_0x5cad('0x7')](),controller['destroy']);module[_0x5cad('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index cc3ab90..e81a58a 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 _0x54a3=['exports','STRING','sequelize'];(function(_0x4717c3,_0x34306b){var _0x27312a=function(_0x26c447){while(--_0x26c447){_0x4717c3['push'](_0x4717c3['shift']());}};_0x27312a(++_0x34306b);}(_0x54a3,0xd7));var _0x354a=function(_0x2a4b52,_0x443be8){_0x2a4b52=_0x2a4b52-0x0;var _0x2fd21b=_0x54a3[_0x2a4b52];return _0x2fd21b;};'use strict';var Sequelize=require(_0x354a('0x0'));module[_0x354a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x354a('0x2')]}}; \ No newline at end of file +var _0x1849=['sequelize','STRING'];(function(_0x13a11a,_0x42e711){var _0x27eb84=function(_0x104f14){while(--_0x104f14){_0x13a11a['push'](_0x13a11a['shift']());}};_0x27eb84(++_0x42e711);}(_0x1849,0xb4));var _0x9184=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1849[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x9184('0x0'));module['exports']={'name':{'type':Sequelize[_0x9184('0x1')]},'description':{'type':Sequelize[_0x9184('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 18bb1cb..83409cc 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 _0x6039=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','send','index','map','SugarcrmConfiguration','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','nolimit','getSubjects','SugarcrmField','pick','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x3ab687,_0x2f3a18){var _0x512596=function(_0x981ef2){while(--_0x981ef2){_0x3ab687['push'](_0x3ab687['shift']());}};_0x512596(++_0x2f3a18);}(_0x6039,0x8c));var _0x9603=function(_0xf1ce3b,_0x4b1c98){_0xf1ce3b=_0xf1ce3b-0x0;var _0x2403f0=_0x6039[_0xf1ce3b];return _0x2403f0;};'use strict';var emlformat=require(_0x9603('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9603('0x1'));var jsonpatch=require(_0x9603('0x2'));var rp=require('request-promise');var moment=require(_0x9603('0x3'));var BPromise=require(_0x9603('0x4'));var Mustache=require(_0x9603('0x5'));var util=require(_0x9603('0x6'));var path=require(_0x9603('0x7'));var sox=require(_0x9603('0x8'));var csv=require(_0x9603('0x9'));var ejs=require(_0x9603('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9603('0xb'));var squel=require(_0x9603('0xc'));var crypto=require(_0x9603('0xd'));var jsforce=require(_0x9603('0xe'));var deskjs=require(_0x9603('0xf'));var toCsv=require(_0x9603('0x9'));var querystring=require(_0x9603('0x10'));var Papa=require(_0x9603('0x11'));var Redis=require(_0x9603('0x12'));var authService=require(_0x9603('0x13'));var qs=require(_0x9603('0x14'));var as=require(_0x9603('0x15'));var hardwareService=require(_0x9603('0x16'));var logger=require('../../config/logger')(_0x9603('0x17'));var utils=require(_0x9603('0x18'));var config=require(_0x9603('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9603('0x1a'))['db'];function respondWithStatusCode(_0x179c01,_0x1d2a84){_0x1d2a84=_0x1d2a84||0xcc;return function(_0x855e5c){if(_0x855e5c){return _0x179c01[_0x9603('0x1b')](_0x1d2a84);}return _0x179c01['status'](_0x1d2a84)['end']();};}function respondWithResult(_0x5d44a5,_0x1edaa1){_0x1edaa1=_0x1edaa1||0xc8;return function(_0x184996){if(_0x184996){return _0x5d44a5[_0x9603('0x1c')](_0x1edaa1)[_0x9603('0x1d')](_0x184996);}};}function respondWithFilteredResult(_0x13ba5a,_0x1aa78a){return function(_0x2efc92){if(_0x2efc92){var _0x384004=typeof _0x1aa78a[_0x9603('0x1e')]===_0x9603('0x1f')&&typeof _0x1aa78a[_0x9603('0x20')]==='undefined';var _0x4ad44b=_0x2efc92[_0x9603('0x21')];var _0x3fc604=_0x384004?0x0:_0x1aa78a['offset'];var _0x4e9450=_0x384004?_0x2efc92['count']:_0x1aa78a[_0x9603('0x1e')]+_0x1aa78a[_0x9603('0x20')];var _0x4a879e;if(_0x4e9450>=_0x4ad44b){_0x4e9450=_0x4ad44b;_0x4a879e=0xc8;}else{_0x4a879e=0xce;}_0x13ba5a[_0x9603('0x1c')](_0x4a879e);return _0x13ba5a[_0x9603('0x22')]('Content-Range',_0x3fc604+'-'+_0x4e9450+'/'+_0x4ad44b)['json'](_0x2efc92);}return null;};}function patchUpdates(_0x3e2a2c){return function(_0x393d25){try{jsonpatch[_0x9603('0x23')](_0x393d25,_0x3e2a2c,!![]);}catch(_0x3d6393){return BPromise[_0x9603('0x24')](_0x3d6393);}return _0x393d25[_0x9603('0x25')]();};}function saveUpdates(_0x2fa367,_0x11e6ce){return function(_0x3562af){if(_0x3562af){return _0x3562af[_0x9603('0x26')](_0x2fa367)[_0x9603('0x27')](function(_0x23c3f2){return _0x23c3f2;});}return null;};}function removeEntity(_0x209c07,_0x59a338){return function(_0x2368e5){if(_0x2368e5){return _0x2368e5[_0x9603('0x28')]()[_0x9603('0x27')](function(){_0x209c07[_0x9603('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e5c97,_0x220568){return function(_0x23ad11){if(!_0x23ad11){_0x1e5c97[_0x9603('0x1b')](0x194);}return _0x23ad11;};}function handleError(_0x1d3ca0,_0x11c4ed){_0x11c4ed=_0x11c4ed||0x1f4;return function(_0x5405f3){logger['error'](_0x5405f3[_0x9603('0x29')]);if(_0x5405f3['name']){delete _0x5405f3['name'];}_0x1d3ca0[_0x9603('0x1c')](_0x11c4ed)[_0x9603('0x2a')](_0x5405f3);};}exports[_0x9603('0x2b')]=function(_0x122b41,_0x105014){var _0x27fa76={},_0x331b04={},_0x3c9b3b={'count':0x0,'rows':[]};var _0x10f054=_[_0x9603('0x2c')](db[_0x9603('0x2d')]['rawAttributes'],function(_0x2c83e8){return{'name':_0x2c83e8[_0x9603('0x2e')],'type':_0x2c83e8['type'][_0x9603('0x2f')]};});_0x331b04['model']=_[_0x9603('0x2c')](_0x10f054,'name');_0x331b04[_0x9603('0x30')]=_[_0x9603('0x31')](_0x122b41[_0x9603('0x30')]);_0x331b04[_0x9603('0x32')]=_[_0x9603('0x33')](_0x331b04['model'],_0x331b04['query']);_0x27fa76[_0x9603('0x34')]=_['intersection'](_0x331b04[_0x9603('0x35')],qs[_0x9603('0x36')](_0x122b41[_0x9603('0x30')]['fields']));_0x27fa76[_0x9603('0x34')]=_0x27fa76[_0x9603('0x34')][_0x9603('0x37')]?_0x27fa76['attributes']:_0x331b04[_0x9603('0x35')];if(!_0x122b41[_0x9603('0x30')][_0x9603('0x38')]('nolimit')){_0x27fa76[_0x9603('0x20')]=qs['limit'](_0x122b41[_0x9603('0x30')][_0x9603('0x20')]);_0x27fa76[_0x9603('0x1e')]=qs[_0x9603('0x1e')](_0x122b41[_0x9603('0x30')][_0x9603('0x1e')]);}_0x27fa76[_0x9603('0x39')]=qs[_0x9603('0x3a')](_0x122b41[_0x9603('0x30')][_0x9603('0x3a')]);_0x27fa76[_0x9603('0x3b')]=qs[_0x9603('0x32')](_['pick'](_0x122b41[_0x9603('0x30')],_0x331b04[_0x9603('0x32')]),_0x10f054);if(_0x122b41[_0x9603('0x30')][_0x9603('0x3c')]){_0x27fa76[_0x9603('0x3b')]=_[_0x9603('0x3d')](_0x27fa76['where'],{'$or':_[_0x9603('0x2c')](_0x10f054,function(_0x4b7524){if(_0x4b7524[_0x9603('0x3e')]!==_0x9603('0x3f')){var _0x536c05={};_0x536c05[_0x4b7524[_0x9603('0x40')]]={'$like':'%'+_0x122b41[_0x9603('0x30')]['filter']+'%'};return _0x536c05;}})});}_0x27fa76=_[_0x9603('0x3d')]({},_0x27fa76,_0x122b41[_0x9603('0x41')]);var _0x1525c6={'where':_0x27fa76['where']};return db[_0x9603('0x2d')][_0x9603('0x21')](_0x1525c6)[_0x9603('0x27')](function(_0x13275d){_0x3c9b3b[_0x9603('0x21')]=_0x13275d;if(_0x122b41[_0x9603('0x30')][_0x9603('0x42')]){_0x27fa76[_0x9603('0x43')]=[{'all':!![]}];}return db[_0x9603('0x2d')]['findAll'](_0x27fa76);})['then'](function(_0x29fec8){_0x3c9b3b[_0x9603('0x44')]=_0x29fec8;return _0x3c9b3b;})['then'](respondWithFilteredResult(_0x105014,_0x27fa76))[_0x9603('0x45')](handleError(_0x105014,null));};exports[_0x9603('0x46')]=function(_0x4d3767,_0x255290){var _0x48bf95={'raw':![],'where':{'id':_0x4d3767[_0x9603('0x47')]['id']}},_0x5b96b8={};_0x5b96b8[_0x9603('0x35')]=_[_0x9603('0x31')](db[_0x9603('0x2d')][_0x9603('0x48')]);_0x5b96b8[_0x9603('0x30')]=_[_0x9603('0x31')](_0x4d3767[_0x9603('0x30')]);_0x5b96b8['filters']=_[_0x9603('0x33')](_0x5b96b8['model'],_0x5b96b8['query']);_0x48bf95[_0x9603('0x34')]=_[_0x9603('0x33')](_0x5b96b8[_0x9603('0x35')],qs[_0x9603('0x36')](_0x4d3767[_0x9603('0x30')][_0x9603('0x36')]));_0x48bf95['attributes']=_0x48bf95[_0x9603('0x34')][_0x9603('0x37')]?_0x48bf95[_0x9603('0x34')]:_0x5b96b8['model'];if(_0x4d3767['query'][_0x9603('0x42')]){_0x48bf95[_0x9603('0x43')]=[{'all':!![]}];}_0x48bf95=_[_0x9603('0x3d')]({},_0x48bf95,_0x4d3767[_0x9603('0x41')]);return db[_0x9603('0x2d')][_0x9603('0x49')](_0x48bf95)[_0x9603('0x27')](handleEntityNotFound(_0x255290,null))[_0x9603('0x27')](respondWithResult(_0x255290,null))[_0x9603('0x45')](handleError(_0x255290,null));};exports[_0x9603('0x4a')]=function(_0x2a793b,_0x32f9b1){return db[_0x9603('0x2d')]['create'](_0x2a793b['body'],{})['then'](respondWithResult(_0x32f9b1,0xc9))[_0x9603('0x45')](handleError(_0x32f9b1,null));};exports[_0x9603('0x26')]=function(_0x3d4a47,_0xcbeb26){if(_0x3d4a47[_0x9603('0x4b')]['id']){delete _0x3d4a47[_0x9603('0x4b')]['id'];}return db[_0x9603('0x2d')]['find']({'where':{'id':_0x3d4a47[_0x9603('0x47')]['id']}})[_0x9603('0x27')](handleEntityNotFound(_0xcbeb26,null))[_0x9603('0x27')](saveUpdates(_0x3d4a47[_0x9603('0x4b')],null))[_0x9603('0x27')](respondWithResult(_0xcbeb26,null))['catch'](handleError(_0xcbeb26,null));};exports[_0x9603('0x28')]=function(_0x551eae,_0x272c50){return db[_0x9603('0x2d')][_0x9603('0x49')]({'where':{'id':_0x551eae[_0x9603('0x47')]['id']}})[_0x9603('0x27')](handleEntityNotFound(_0x272c50,null))['then'](removeEntity(_0x272c50,null))[_0x9603('0x45')](handleError(_0x272c50,null));};exports[_0x9603('0x4c')]=function(_0x4b139b,_0x3cfcf9,_0x2552a0){var _0x4ec65b={};var _0x484211={};var _0xb29285;var _0x59e47f;return db['SugarcrmConfiguration'][_0x9603('0x4d')]({'where':{'id':_0x4b139b[_0x9603('0x47')]['id']}})['then'](handleEntityNotFound(_0x3cfcf9,null))[_0x9603('0x27')](function(_0x10a6cb){if(_0x10a6cb){_0xb29285=_0x10a6cb;_0x484211[_0x9603('0x35')]=_['keys'](db['SugarcrmField'][_0x9603('0x48')]);_0x484211[_0x9603('0x30')]=_[_0x9603('0x31')](_0x4b139b[_0x9603('0x30')]);_0x484211['filters']=_[_0x9603('0x33')](_0x484211[_0x9603('0x35')],_0x484211[_0x9603('0x30')]);_0x4ec65b['attributes']=_['intersection'](_0x484211['model'],qs[_0x9603('0x36')](_0x4b139b[_0x9603('0x30')]['fields']));_0x4ec65b['attributes']=_0x4ec65b[_0x9603('0x34')][_0x9603('0x37')]?_0x4ec65b[_0x9603('0x34')]:_0x484211[_0x9603('0x35')];_0x4ec65b[_0x9603('0x39')]=qs['sort'](_0x4b139b[_0x9603('0x30')][_0x9603('0x3a')]);_0x4ec65b['where']=qs[_0x9603('0x32')](_['pick'](_0x4b139b[_0x9603('0x30')],_0x484211[_0x9603('0x32')]));if(_0x4b139b['query'][_0x9603('0x3c')]){_0x4ec65b['where']=_[_0x9603('0x3d')](_0x4ec65b[_0x9603('0x3b')],{'$or':_[_0x9603('0x2c')](_0x4ec65b[_0x9603('0x34')],function(_0x7ab9d1){var _0x3d87ad={};_0x3d87ad[_0x7ab9d1]={'$like':'%'+_0x4b139b[_0x9603('0x30')]['filter']+'%'};return _0x3d87ad;})});}_0x4ec65b=_[_0x9603('0x3d')]({},_0x4ec65b,_0x4b139b[_0x9603('0x41')]);return _0xb29285['getFields'](_0x4ec65b);}})[_0x9603('0x27')](function(_0x49c916){if(_0x49c916){_0x59e47f=_0x49c916[_0x9603('0x37')];if(!_0x4b139b[_0x9603('0x30')][_0x9603('0x38')](_0x9603('0x4e'))){_0x4ec65b[_0x9603('0x20')]=qs[_0x9603('0x20')](_0x4b139b[_0x9603('0x30')]['limit']);_0x4ec65b[_0x9603('0x1e')]=qs['offset'](_0x4b139b[_0x9603('0x30')][_0x9603('0x1e')]);}return _0xb29285['getFields'](_0x4ec65b);}})[_0x9603('0x27')](function(_0x1cd3ca){if(_0x1cd3ca){return _0x1cd3ca?{'count':_0x59e47f,'rows':_0x1cd3ca}:null;}})[_0x9603('0x27')](respondWithResult(_0x3cfcf9,null))[_0x9603('0x45')](handleError(_0x3cfcf9,null));};exports[_0x9603('0x4f')]=function(_0x5adc3f,_0x45d9e5,_0x6b9d14){var _0x1a025b={};var _0x8911d5={};var _0x14a648;var _0x38d556;return db[_0x9603('0x2d')][_0x9603('0x4d')]({'where':{'id':_0x5adc3f[_0x9603('0x47')]['id']}})[_0x9603('0x27')](handleEntityNotFound(_0x45d9e5,null))[_0x9603('0x27')](function(_0x1133fd){if(_0x1133fd){_0x14a648=_0x1133fd;_0x8911d5[_0x9603('0x35')]=_[_0x9603('0x31')](db[_0x9603('0x50')][_0x9603('0x48')]);_0x8911d5[_0x9603('0x30')]=_[_0x9603('0x31')](_0x5adc3f[_0x9603('0x30')]);_0x8911d5[_0x9603('0x32')]=_[_0x9603('0x33')](_0x8911d5['model'],_0x8911d5['query']);_0x1a025b[_0x9603('0x34')]=_[_0x9603('0x33')](_0x8911d5[_0x9603('0x35')],qs['fields'](_0x5adc3f[_0x9603('0x30')][_0x9603('0x36')]));_0x1a025b['attributes']=_0x1a025b[_0x9603('0x34')][_0x9603('0x37')]?_0x1a025b[_0x9603('0x34')]:_0x8911d5[_0x9603('0x35')];_0x1a025b[_0x9603('0x39')]=qs[_0x9603('0x3a')](_0x5adc3f[_0x9603('0x30')][_0x9603('0x3a')]);_0x1a025b[_0x9603('0x3b')]=qs[_0x9603('0x32')](_[_0x9603('0x51')](_0x5adc3f['query'],_0x8911d5[_0x9603('0x32')]));if(_0x5adc3f[_0x9603('0x30')][_0x9603('0x3c')]){_0x1a025b[_0x9603('0x3b')]=_[_0x9603('0x3d')](_0x1a025b[_0x9603('0x3b')],{'$or':_[_0x9603('0x2c')](_0x1a025b['attributes'],function(_0x5f3911){var _0x289ecd={};_0x289ecd[_0x5f3911]={'$like':'%'+_0x5adc3f[_0x9603('0x30')][_0x9603('0x3c')]+'%'};return _0x289ecd;})});}_0x1a025b=_[_0x9603('0x3d')]({},_0x1a025b,_0x5adc3f[_0x9603('0x41')]);return _0x14a648[_0x9603('0x4f')](_0x1a025b);}})[_0x9603('0x27')](function(_0xdfca9d){if(_0xdfca9d){_0x38d556=_0xdfca9d[_0x9603('0x37')];if(!_0x5adc3f[_0x9603('0x30')][_0x9603('0x38')]('nolimit')){_0x1a025b['limit']=qs[_0x9603('0x20')](_0x5adc3f[_0x9603('0x30')][_0x9603('0x20')]);_0x1a025b['offset']=qs[_0x9603('0x1e')](_0x5adc3f['query'][_0x9603('0x1e')]);}return _0x14a648[_0x9603('0x4f')](_0x1a025b);}})[_0x9603('0x27')](function(_0x4163aa){if(_0x4163aa){return _0x4163aa?{'count':_0x38d556,'rows':_0x4163aa}:null;}})['then'](respondWithResult(_0x45d9e5,null))[_0x9603('0x45')](handleError(_0x45d9e5,null));};exports[_0x9603('0x52')]=function(_0x360f51,_0xb0f9d3,_0x173199){var _0x5bee57={};var _0x4f4945={};var _0x4a5208;var _0x560c8e;return db[_0x9603('0x2d')]['findOne']({'where':{'id':_0x360f51[_0x9603('0x47')]['id']}})[_0x9603('0x27')](handleEntityNotFound(_0xb0f9d3,null))[_0x9603('0x27')](function(_0x4c7a57){if(_0x4c7a57){_0x4a5208=_0x4c7a57;_0x4f4945[_0x9603('0x35')]=_[_0x9603('0x31')](db['SugarcrmField'][_0x9603('0x48')]);_0x4f4945[_0x9603('0x30')]=_['keys'](_0x360f51[_0x9603('0x30')]);_0x4f4945[_0x9603('0x32')]=_[_0x9603('0x33')](_0x4f4945[_0x9603('0x35')],_0x4f4945[_0x9603('0x30')]);_0x5bee57[_0x9603('0x34')]=_[_0x9603('0x33')](_0x4f4945[_0x9603('0x35')],qs['fields'](_0x360f51[_0x9603('0x30')][_0x9603('0x36')]));_0x5bee57[_0x9603('0x34')]=_0x5bee57['attributes'][_0x9603('0x37')]?_0x5bee57['attributes']:_0x4f4945[_0x9603('0x35')];_0x5bee57['order']=qs['sort'](_0x360f51[_0x9603('0x30')][_0x9603('0x3a')]);_0x5bee57[_0x9603('0x3b')]=qs[_0x9603('0x32')](_[_0x9603('0x51')](_0x360f51[_0x9603('0x30')],_0x4f4945[_0x9603('0x32')]));if(_0x360f51['query'][_0x9603('0x3c')]){_0x5bee57['where']=_[_0x9603('0x3d')](_0x5bee57['where'],{'$or':_[_0x9603('0x2c')](_0x5bee57['attributes'],function(_0x6d5b18){var _0x204267={};_0x204267[_0x6d5b18]={'$like':'%'+_0x360f51['query']['filter']+'%'};return _0x204267;})});}_0x5bee57=_['merge']({},_0x5bee57,_0x360f51[_0x9603('0x41')]);return _0x4a5208[_0x9603('0x52')](_0x5bee57);}})['then'](function(_0x24da1c){if(_0x24da1c){_0x560c8e=_0x24da1c[_0x9603('0x37')];if(!_0x360f51[_0x9603('0x30')]['hasOwnProperty'](_0x9603('0x4e'))){_0x5bee57[_0x9603('0x20')]=qs[_0x9603('0x20')](_0x360f51[_0x9603('0x30')][_0x9603('0x20')]);_0x5bee57['offset']=qs[_0x9603('0x1e')](_0x360f51[_0x9603('0x30')][_0x9603('0x1e')]);}return _0x4a5208['getDescriptions'](_0x5bee57);}})[_0x9603('0x27')](function(_0x38b0b6){if(_0x38b0b6){return _0x38b0b6?{'count':_0x560c8e,'rows':_0x38b0b6}:null;}})[_0x9603('0x27')](respondWithResult(_0xb0f9d3,null))[_0x9603('0x45')](handleError(_0xb0f9d3,null));}; \ No newline at end of file +var _0x12b3=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x47e5d1,_0x162daa){var _0x879f78=function(_0xc15a64){while(--_0xc15a64){_0x47e5d1['push'](_0x47e5d1['shift']());}};_0x879f78(++_0x162daa);}(_0x12b3,0x87));var _0x312b=function(_0x1e82c7,_0x4468be){_0x1e82c7=_0x1e82c7-0x0;var _0x59eecf=_0x12b3[_0x1e82c7];return _0x59eecf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x312b('0x0'));var zipdir=require(_0x312b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x312b('0x2'));var moment=require(_0x312b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x312b('0x4'));var util=require(_0x312b('0x5'));var path=require(_0x312b('0x6'));var sox=require(_0x312b('0x7'));var csv=require('to-csv');var ejs=require(_0x312b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x312b('0x9'));var squel=require(_0x312b('0xa'));var crypto=require(_0x312b('0xb'));var jsforce=require(_0x312b('0xc'));var deskjs=require(_0x312b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x312b('0xe'));var Papa=require(_0x312b('0xf'));var Redis=require(_0x312b('0x10'));var authService=require(_0x312b('0x11'));var qs=require(_0x312b('0x12'));var as=require(_0x312b('0x13'));var hardwareService=require(_0x312b('0x14'));var logger=require(_0x312b('0x15'))(_0x312b('0x16'));var utils=require(_0x312b('0x17'));var config=require(_0x312b('0x18'));var licenseUtil=require(_0x312b('0x19'));var db=require(_0x312b('0x1a'))['db'];function respondWithStatusCode(_0x4bfcc1,_0x1af96d){_0x1af96d=_0x1af96d||0xcc;return function(_0x2e7341){if(_0x2e7341){return _0x4bfcc1[_0x312b('0x1b')](_0x1af96d);}return _0x4bfcc1[_0x312b('0x1c')](_0x1af96d)['end']();};}function respondWithResult(_0x55cb47,_0x255cb3){_0x255cb3=_0x255cb3||0xc8;return function(_0x5b0722){if(_0x5b0722){return _0x55cb47['status'](_0x255cb3)[_0x312b('0x1d')](_0x5b0722);}};}function respondWithFilteredResult(_0x46bd53,_0x2cd0c7){return function(_0x41080e){if(_0x41080e){var _0x1ddb82=typeof _0x2cd0c7[_0x312b('0x1e')]===_0x312b('0x1f')&&typeof _0x2cd0c7[_0x312b('0x20')]===_0x312b('0x1f');var _0x5eb11b=_0x41080e[_0x312b('0x21')];var _0x51df45=_0x1ddb82?0x0:_0x2cd0c7[_0x312b('0x1e')];var _0x2aee86=_0x1ddb82?_0x41080e['count']:_0x2cd0c7[_0x312b('0x1e')]+_0x2cd0c7[_0x312b('0x20')];var _0x253e6b;if(_0x2aee86>=_0x5eb11b){_0x2aee86=_0x5eb11b;_0x253e6b=0xc8;}else{_0x253e6b=0xce;}_0x46bd53[_0x312b('0x1c')](_0x253e6b);return _0x46bd53['set'](_0x312b('0x22'),_0x51df45+'-'+_0x2aee86+'/'+_0x5eb11b)[_0x312b('0x1d')](_0x41080e);}return null;};}function patchUpdates(_0xe8f837){return function(_0xd3db51){try{jsonpatch[_0x312b('0x23')](_0xd3db51,_0xe8f837,!![]);}catch(_0x536cfe){return BPromise[_0x312b('0x24')](_0x536cfe);}return _0xd3db51[_0x312b('0x25')]();};}function saveUpdates(_0x491531,_0x559b5d){return function(_0x2b6573){if(_0x2b6573){return _0x2b6573[_0x312b('0x26')](_0x491531)[_0x312b('0x27')](function(_0x4c7a17){return _0x4c7a17;});}return null;};}function removeEntity(_0x45f24d,_0x3167d8){return function(_0xd9ea96){if(_0xd9ea96){return _0xd9ea96[_0x312b('0x28')]()[_0x312b('0x27')](function(){_0x45f24d[_0x312b('0x1c')](0xcc)[_0x312b('0x29')]();});}};}function handleEntityNotFound(_0x2a61e4,_0x548c17){return function(_0x42f886){if(!_0x42f886){_0x2a61e4['sendStatus'](0x194);}return _0x42f886;};}function handleError(_0x275432,_0x5f1451){_0x5f1451=_0x5f1451||0x1f4;return function(_0xbe56a1){logger[_0x312b('0x2a')](_0xbe56a1[_0x312b('0x2b')]);if(_0xbe56a1[_0x312b('0x2c')]){delete _0xbe56a1[_0x312b('0x2c')];}_0x275432[_0x312b('0x1c')](_0x5f1451)[_0x312b('0x2d')](_0xbe56a1);};}exports['index']=function(_0x5148bd,_0x3eb363){var _0x56a5d0={},_0x2761c4={},_0x1f619e={'count':0x0,'rows':[]};var _0x17ea86=_[_0x312b('0x2e')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x250745){return{'name':_0x250745[_0x312b('0x2f')],'type':_0x250745['type']['key']};});_0x2761c4[_0x312b('0x30')]=_[_0x312b('0x2e')](_0x17ea86,_0x312b('0x2c'));_0x2761c4[_0x312b('0x31')]=_[_0x312b('0x32')](_0x5148bd[_0x312b('0x31')]);_0x2761c4['filters']=_[_0x312b('0x33')](_0x2761c4['model'],_0x2761c4[_0x312b('0x31')]);_0x56a5d0[_0x312b('0x34')]=_[_0x312b('0x33')](_0x2761c4[_0x312b('0x30')],qs[_0x312b('0x35')](_0x5148bd[_0x312b('0x31')][_0x312b('0x35')]));_0x56a5d0['attributes']=_0x56a5d0[_0x312b('0x34')][_0x312b('0x36')]?_0x56a5d0['attributes']:_0x2761c4[_0x312b('0x30')];if(!_0x5148bd[_0x312b('0x31')][_0x312b('0x37')](_0x312b('0x38'))){_0x56a5d0[_0x312b('0x20')]=qs['limit'](_0x5148bd['query'][_0x312b('0x20')]);_0x56a5d0[_0x312b('0x1e')]=qs['offset'](_0x5148bd[_0x312b('0x31')][_0x312b('0x1e')]);}_0x56a5d0[_0x312b('0x39')]=qs[_0x312b('0x3a')](_0x5148bd[_0x312b('0x31')][_0x312b('0x3a')]);_0x56a5d0[_0x312b('0x3b')]=qs['filters'](_[_0x312b('0x3c')](_0x5148bd[_0x312b('0x31')],_0x2761c4[_0x312b('0x3d')]),_0x17ea86);if(_0x5148bd['query'][_0x312b('0x3e')]){_0x56a5d0['where']=_[_0x312b('0x3f')](_0x56a5d0[_0x312b('0x3b')],{'$or':_[_0x312b('0x2e')](_0x17ea86,function(_0x5d23e6){if(_0x5d23e6[_0x312b('0x40')]!=='VIRTUAL'){var _0x289524={};_0x289524[_0x5d23e6[_0x312b('0x2c')]]={'$like':'%'+_0x5148bd[_0x312b('0x31')][_0x312b('0x3e')]+'%'};return _0x289524;}})});}_0x56a5d0=_[_0x312b('0x3f')]({},_0x56a5d0,_0x5148bd[_0x312b('0x41')]);var _0xe4dfc0={'where':_0x56a5d0[_0x312b('0x3b')]};return db[_0x312b('0x42')][_0x312b('0x21')](_0xe4dfc0)[_0x312b('0x27')](function(_0x506cb4){_0x1f619e['count']=_0x506cb4;if(_0x5148bd[_0x312b('0x31')][_0x312b('0x43')]){_0x56a5d0[_0x312b('0x44')]=[{'all':!![]}];}return db[_0x312b('0x42')][_0x312b('0x45')](_0x56a5d0);})['then'](function(_0x2f43e7){_0x1f619e[_0x312b('0x46')]=_0x2f43e7;return _0x1f619e;})[_0x312b('0x27')](respondWithFilteredResult(_0x3eb363,_0x56a5d0))[_0x312b('0x47')](handleError(_0x3eb363,null));};exports[_0x312b('0x48')]=function(_0x56b522,_0x102551){var _0xe077a0={'raw':![],'where':{'id':_0x56b522[_0x312b('0x49')]['id']}},_0x46fb28={};_0x46fb28['model']=_[_0x312b('0x32')](db[_0x312b('0x42')][_0x312b('0x4a')]);_0x46fb28['query']=_[_0x312b('0x32')](_0x56b522[_0x312b('0x31')]);_0x46fb28[_0x312b('0x3d')]=_[_0x312b('0x33')](_0x46fb28[_0x312b('0x30')],_0x46fb28[_0x312b('0x31')]);_0xe077a0[_0x312b('0x34')]=_[_0x312b('0x33')](_0x46fb28[_0x312b('0x30')],qs[_0x312b('0x35')](_0x56b522[_0x312b('0x31')][_0x312b('0x35')]));_0xe077a0[_0x312b('0x34')]=_0xe077a0['attributes'][_0x312b('0x36')]?_0xe077a0['attributes']:_0x46fb28['model'];if(_0x56b522[_0x312b('0x31')][_0x312b('0x43')]){_0xe077a0[_0x312b('0x44')]=[{'all':!![]}];}_0xe077a0=_[_0x312b('0x3f')]({},_0xe077a0,_0x56b522['options']);return db[_0x312b('0x42')][_0x312b('0x4b')](_0xe077a0)[_0x312b('0x27')](handleEntityNotFound(_0x102551,null))['then'](respondWithResult(_0x102551,null))[_0x312b('0x47')](handleError(_0x102551,null));};exports['create']=function(_0x5c48e1,_0x579b75){return db[_0x312b('0x42')][_0x312b('0x4c')](_0x5c48e1[_0x312b('0x4d')],{})['then'](respondWithResult(_0x579b75,0xc9))[_0x312b('0x47')](handleError(_0x579b75,null));};exports[_0x312b('0x26')]=function(_0x5199b9,_0x12230d){if(_0x5199b9[_0x312b('0x4d')]['id']){delete _0x5199b9[_0x312b('0x4d')]['id'];}return db[_0x312b('0x42')]['find']({'where':{'id':_0x5199b9[_0x312b('0x49')]['id']}})[_0x312b('0x27')](handleEntityNotFound(_0x12230d,null))[_0x312b('0x27')](saveUpdates(_0x5199b9[_0x312b('0x4d')],null))[_0x312b('0x27')](respondWithResult(_0x12230d,null))[_0x312b('0x47')](handleError(_0x12230d,null));};exports[_0x312b('0x28')]=function(_0x3fc0c7,_0x25f8ea){return db[_0x312b('0x42')][_0x312b('0x4b')]({'where':{'id':_0x3fc0c7[_0x312b('0x49')]['id']}})[_0x312b('0x27')](handleEntityNotFound(_0x25f8ea,null))['then'](removeEntity(_0x25f8ea,null))['catch'](handleError(_0x25f8ea,null));};exports[_0x312b('0x4e')]=function(_0x40ac98,_0x3e20c7,_0x5dbc19){var _0x3d758b={};var _0x75b539={};var _0x378311;var _0x417533;return db[_0x312b('0x42')][_0x312b('0x4f')]({'where':{'id':_0x40ac98[_0x312b('0x49')]['id']}})[_0x312b('0x27')](handleEntityNotFound(_0x3e20c7,null))[_0x312b('0x27')](function(_0x4f7f1a){if(_0x4f7f1a){_0x378311=_0x4f7f1a;_0x75b539[_0x312b('0x30')]=_[_0x312b('0x32')](db[_0x312b('0x50')][_0x312b('0x4a')]);_0x75b539[_0x312b('0x31')]=_[_0x312b('0x32')](_0x40ac98[_0x312b('0x31')]);_0x75b539[_0x312b('0x3d')]=_[_0x312b('0x33')](_0x75b539[_0x312b('0x30')],_0x75b539[_0x312b('0x31')]);_0x3d758b[_0x312b('0x34')]=_[_0x312b('0x33')](_0x75b539['model'],qs[_0x312b('0x35')](_0x40ac98[_0x312b('0x31')]['fields']));_0x3d758b[_0x312b('0x34')]=_0x3d758b['attributes']['length']?_0x3d758b[_0x312b('0x34')]:_0x75b539[_0x312b('0x30')];_0x3d758b[_0x312b('0x39')]=qs[_0x312b('0x3a')](_0x40ac98[_0x312b('0x31')][_0x312b('0x3a')]);_0x3d758b[_0x312b('0x3b')]=qs['filters'](_[_0x312b('0x3c')](_0x40ac98[_0x312b('0x31')],_0x75b539['filters']));if(_0x40ac98[_0x312b('0x31')][_0x312b('0x3e')]){_0x3d758b[_0x312b('0x3b')]=_[_0x312b('0x3f')](_0x3d758b['where'],{'$or':_[_0x312b('0x2e')](_0x3d758b[_0x312b('0x34')],function(_0x4611c6){var _0x4d4fa9={};_0x4d4fa9[_0x4611c6]={'$like':'%'+_0x40ac98['query'][_0x312b('0x3e')]+'%'};return _0x4d4fa9;})});}_0x3d758b=_[_0x312b('0x3f')]({},_0x3d758b,_0x40ac98['options']);return _0x378311['getFields'](_0x3d758b);}})[_0x312b('0x27')](function(_0x5ba24d){if(_0x5ba24d){_0x417533=_0x5ba24d['length'];if(!_0x40ac98[_0x312b('0x31')][_0x312b('0x37')](_0x312b('0x38'))){_0x3d758b[_0x312b('0x20')]=qs[_0x312b('0x20')](_0x40ac98['query'][_0x312b('0x20')]);_0x3d758b[_0x312b('0x1e')]=qs[_0x312b('0x1e')](_0x40ac98[_0x312b('0x31')][_0x312b('0x1e')]);}return _0x378311['getFields'](_0x3d758b);}})[_0x312b('0x27')](function(_0x7bbbb){if(_0x7bbbb){return _0x7bbbb?{'count':_0x417533,'rows':_0x7bbbb}:null;}})[_0x312b('0x27')](respondWithResult(_0x3e20c7,null))['catch'](handleError(_0x3e20c7,null));};exports[_0x312b('0x51')]=function(_0x5dd1d6,_0x268016,_0x3ac9bc){var _0x10e5dc={};var _0x2e6e96={};var _0x4df80e;var _0x51d72e;return db['SugarcrmConfiguration'][_0x312b('0x4f')]({'where':{'id':_0x5dd1d6[_0x312b('0x49')]['id']}})[_0x312b('0x27')](handleEntityNotFound(_0x268016,null))['then'](function(_0xe2137a){if(_0xe2137a){_0x4df80e=_0xe2137a;_0x2e6e96[_0x312b('0x30')]=_['keys'](db[_0x312b('0x50')][_0x312b('0x4a')]);_0x2e6e96[_0x312b('0x31')]=_[_0x312b('0x32')](_0x5dd1d6[_0x312b('0x31')]);_0x2e6e96[_0x312b('0x3d')]=_[_0x312b('0x33')](_0x2e6e96['model'],_0x2e6e96[_0x312b('0x31')]);_0x10e5dc[_0x312b('0x34')]=_[_0x312b('0x33')](_0x2e6e96[_0x312b('0x30')],qs['fields'](_0x5dd1d6[_0x312b('0x31')][_0x312b('0x35')]));_0x10e5dc[_0x312b('0x34')]=_0x10e5dc[_0x312b('0x34')][_0x312b('0x36')]?_0x10e5dc['attributes']:_0x2e6e96[_0x312b('0x30')];_0x10e5dc[_0x312b('0x39')]=qs[_0x312b('0x3a')](_0x5dd1d6[_0x312b('0x31')]['sort']);_0x10e5dc['where']=qs[_0x312b('0x3d')](_[_0x312b('0x3c')](_0x5dd1d6[_0x312b('0x31')],_0x2e6e96[_0x312b('0x3d')]));if(_0x5dd1d6['query'][_0x312b('0x3e')]){_0x10e5dc[_0x312b('0x3b')]=_['merge'](_0x10e5dc[_0x312b('0x3b')],{'$or':_[_0x312b('0x2e')](_0x10e5dc[_0x312b('0x34')],function(_0x1ecad1){var _0x3360c1={};_0x3360c1[_0x1ecad1]={'$like':'%'+_0x5dd1d6['query'][_0x312b('0x3e')]+'%'};return _0x3360c1;})});}_0x10e5dc=_['merge']({},_0x10e5dc,_0x5dd1d6[_0x312b('0x41')]);return _0x4df80e[_0x312b('0x51')](_0x10e5dc);}})[_0x312b('0x27')](function(_0x3ef022){if(_0x3ef022){_0x51d72e=_0x3ef022[_0x312b('0x36')];if(!_0x5dd1d6[_0x312b('0x31')]['hasOwnProperty'](_0x312b('0x38'))){_0x10e5dc[_0x312b('0x20')]=qs[_0x312b('0x20')](_0x5dd1d6[_0x312b('0x31')][_0x312b('0x20')]);_0x10e5dc['offset']=qs[_0x312b('0x1e')](_0x5dd1d6[_0x312b('0x31')][_0x312b('0x1e')]);}return _0x4df80e[_0x312b('0x51')](_0x10e5dc);}})[_0x312b('0x27')](function(_0x56d51b){if(_0x56d51b){return _0x56d51b?{'count':_0x51d72e,'rows':_0x56d51b}:null;}})['then'](respondWithResult(_0x268016,null))[_0x312b('0x47')](handleError(_0x268016,null));};exports[_0x312b('0x52')]=function(_0x4e7325,_0x3e5ebc,_0x3fd794){var _0x1e8558={};var _0x26db4b={};var _0x1567d6;var _0x3ee588;return db[_0x312b('0x42')][_0x312b('0x4f')]({'where':{'id':_0x4e7325[_0x312b('0x49')]['id']}})[_0x312b('0x27')](handleEntityNotFound(_0x3e5ebc,null))['then'](function(_0x5f544d){if(_0x5f544d){_0x1567d6=_0x5f544d;_0x26db4b['model']=_[_0x312b('0x32')](db[_0x312b('0x50')]['rawAttributes']);_0x26db4b['query']=_[_0x312b('0x32')](_0x4e7325[_0x312b('0x31')]);_0x26db4b[_0x312b('0x3d')]=_[_0x312b('0x33')](_0x26db4b['model'],_0x26db4b['query']);_0x1e8558[_0x312b('0x34')]=_[_0x312b('0x33')](_0x26db4b[_0x312b('0x30')],qs[_0x312b('0x35')](_0x4e7325[_0x312b('0x31')]['fields']));_0x1e8558['attributes']=_0x1e8558[_0x312b('0x34')][_0x312b('0x36')]?_0x1e8558[_0x312b('0x34')]:_0x26db4b[_0x312b('0x30')];_0x1e8558[_0x312b('0x39')]=qs[_0x312b('0x3a')](_0x4e7325[_0x312b('0x31')]['sort']);_0x1e8558[_0x312b('0x3b')]=qs[_0x312b('0x3d')](_[_0x312b('0x3c')](_0x4e7325[_0x312b('0x31')],_0x26db4b['filters']));if(_0x4e7325[_0x312b('0x31')][_0x312b('0x3e')]){_0x1e8558[_0x312b('0x3b')]=_['merge'](_0x1e8558[_0x312b('0x3b')],{'$or':_[_0x312b('0x2e')](_0x1e8558[_0x312b('0x34')],function(_0x3886e4){var _0x36aaac={};_0x36aaac[_0x3886e4]={'$like':'%'+_0x4e7325['query'][_0x312b('0x3e')]+'%'};return _0x36aaac;})});}_0x1e8558=_[_0x312b('0x3f')]({},_0x1e8558,_0x4e7325[_0x312b('0x41')]);return _0x1567d6[_0x312b('0x52')](_0x1e8558);}})[_0x312b('0x27')](function(_0x298407){if(_0x298407){_0x3ee588=_0x298407['length'];if(!_0x4e7325['query'][_0x312b('0x37')](_0x312b('0x38'))){_0x1e8558[_0x312b('0x20')]=qs['limit'](_0x4e7325['query'][_0x312b('0x20')]);_0x1e8558[_0x312b('0x1e')]=qs[_0x312b('0x1e')](_0x4e7325[_0x312b('0x31')][_0x312b('0x1e')]);}return _0x1567d6[_0x312b('0x52')](_0x1e8558);}})[_0x312b('0x27')](function(_0x4fc363){if(_0x4fc363){return _0x4fc363?{'count':_0x3ee588,'rows':_0x4fc363}:null;}})[_0x312b('0x27')](respondWithResult(_0x3e5ebc,null))['catch'](handleError(_0x3e5ebc,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 1703b5a..9bf07ec 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 _0x0653=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x0653,0x197));var _0x3065=function(_0x3b21d9,_0x4dcedb){_0x3b21d9=_0x3b21d9-0x0;var _0x284c79=_0x0653[_0x3b21d9];return _0x284c79;};'use strict';var _=require(_0x3065('0x0'));var util=require(_0x3065('0x1'));var logger=require(_0x3065('0x2'))(_0x3065('0x3'));var moment=require(_0x3065('0x4'));var BPromise=require(_0x3065('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3065('0x6'));var config=require(_0x3065('0x7'));var attributes=require(_0x3065('0x8'));module['exports']=function(_0x171e95,_0x431d78){return _0x171e95[_0x3065('0x9')](_0x3065('0xa'),attributes,{'tableName':_0x3065('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf928=['rimraf','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','bluebird','request-promise'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0xf928,0x85));var _0x8f92=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf928[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8f92('0x0'))('api');var moment=require('moment');var BPromise=require(_0x8f92('0x1'));var rp=require(_0x8f92('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f92('0x3'));var config=require('../../config/environment');var attributes=require(_0x8f92('0x4'));module['exports']=function(_0x1d61f1,_0x33a984){return _0x1d61f1[_0x8f92('0x5')](_0x8f92('0x6'),attributes,{'tableName':_0x8f92('0x7'),'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 e19a542..985910f 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 _0xbeb5=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x16e5a2,_0xd6d0df){var _0x41b8d9=function(_0x4f8f2d){while(--_0x4f8f2d){_0x16e5a2['push'](_0x16e5a2['shift']());}};_0x41b8d9(++_0xd6d0df);}(_0xbeb5,0x161));var _0x5beb=function(_0x34bb0b,_0x4f62a3){_0x34bb0b=_0x34bb0b-0x0;var _0x366c92=_0xbeb5[_0x34bb0b];return _0x366c92;};'use strict';var _=require(_0x5beb('0x0'));var util=require(_0x5beb('0x1'));var moment=require('moment');var BPromise=require(_0x5beb('0x2'));var rs=require(_0x5beb('0x3'));var fs=require('fs');var Redis=require(_0x5beb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5beb('0x5'));var logger=require(_0x5beb('0x6'))(_0x5beb('0x7'));var config=require(_0x5beb('0x8'));var jayson=require(_0x5beb('0x9'));var client=jayson[_0x5beb('0xa')][_0x5beb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa9df1f,_0x13cebd,_0x3f8c77){return new BPromise(function(_0x5cd4e2,_0x3e521c){return client[_0x5beb('0xc')](_0xa9df1f,_0x3f8c77)['then'](function(_0x2fc357){logger[_0x5beb('0xd')](_0x5beb('0xe'),_0x13cebd,'request\x20sent');logger[_0x5beb('0xf')](_0x5beb('0x10'),_0x13cebd,_0x5beb('0x11'),JSON[_0x5beb('0x12')](_0x2fc357));if(_0x2fc357[_0x5beb('0x13')]){if(_0x2fc357['error'][_0x5beb('0x14')]===0x1f4){logger[_0x5beb('0x13')](_0x5beb('0xe'),_0x13cebd,_0x2fc357['error'][_0x5beb('0x15')]);return _0x3e521c(_0x2fc357[_0x5beb('0x13')][_0x5beb('0x15')]);}logger[_0x5beb('0x13')](_0x5beb('0xe'),_0x13cebd,_0x2fc357[_0x5beb('0x13')][_0x5beb('0x15')]);return _0x5cd4e2(_0x2fc357[_0x5beb('0x13')]['message']);}else{logger['info'](_0x5beb('0xe'),_0x13cebd,_0x5beb('0x11'));_0x5cd4e2(_0x2fc357['result']['message']);}})[_0x5beb('0x16')](function(_0x28dce2){logger[_0x5beb('0x13')](_0x5beb('0xe'),_0x13cebd,_0x28dce2);_0x3e521c(_0x28dce2);});});} \ No newline at end of file +var _0xad07=['../../config/utils','../../config/logger','jayson/promise','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x42b902,_0x3c49fd){var _0x2d9d68=function(_0x2175bf){while(--_0x2175bf){_0x42b902['push'](_0x42b902['shift']());}};_0x2d9d68(++_0x3c49fd);}(_0xad07,0xa2));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var moment=require(_0x7ad0('0x2'));var BPromise=require(_0x7ad0('0x3'));var rs=require(_0x7ad0('0x4'));var fs=require('fs');var Redis=require(_0x7ad0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ad0('0x6'));var logger=require(_0x7ad0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7ad0('0x8'));var client=jayson[_0x7ad0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8a913f,_0x1946e2,_0x56982d){return new BPromise(function(_0x364c5d,_0x4e5523){return client[_0x7ad0('0xa')](_0x8a913f,_0x56982d)['then'](function(_0x4daf93){logger[_0x7ad0('0xb')](_0x7ad0('0xc'),_0x1946e2,_0x7ad0('0xd'));logger[_0x7ad0('0xe')](_0x7ad0('0xf'),_0x1946e2,_0x7ad0('0xd'),JSON[_0x7ad0('0x10')](_0x4daf93));if(_0x4daf93['error']){if(_0x4daf93[_0x7ad0('0x11')]['code']===0x1f4){logger[_0x7ad0('0x11')](_0x7ad0('0xc'),_0x1946e2,_0x4daf93[_0x7ad0('0x11')][_0x7ad0('0x12')]);return _0x4e5523(_0x4daf93[_0x7ad0('0x11')][_0x7ad0('0x12')]);}logger[_0x7ad0('0x11')](_0x7ad0('0xc'),_0x1946e2,_0x4daf93['error'][_0x7ad0('0x12')]);return _0x364c5d(_0x4daf93[_0x7ad0('0x11')][_0x7ad0('0x12')]);}else{logger[_0x7ad0('0xb')](_0x7ad0('0xc'),_0x1946e2,_0x7ad0('0xd'));_0x364c5d(_0x4daf93[_0x7ad0('0x13')][_0x7ad0('0x12')]);}})[_0x7ad0('0x14')](function(_0x42f44c){logger[_0x7ad0('0x11')](_0x7ad0('0xc'),_0x1946e2,_0x42f44c);_0x4e5523(_0x42f44c);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index d75d08d..3dccfed 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 _0xb53e=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb53e,0xd7));var _0xeb53=function(_0xb7cac8,_0x31ea6c){_0xb7cac8=_0xb7cac8-0x0;var _0x214788=_0xb53e[_0xb7cac8];return _0x214788;};'use strict';var multer=require(_0xeb53('0x0'));var util=require(_0xeb53('0x1'));var path=require('path');var timeout=require(_0xeb53('0x2'));var express=require(_0xeb53('0x3'));var router=express[_0xeb53('0x4')]();var fs_extra=require(_0xeb53('0x5'));var auth=require(_0xeb53('0x6'));var interaction=require(_0xeb53('0x7'));var config=require(_0xeb53('0x8'));var controller=require(_0xeb53('0x9'));router[_0xeb53('0xa')]('/',auth[_0xeb53('0xb')](),controller[_0xeb53('0xc')]);router[_0xeb53('0xa')](_0xeb53('0xd'),auth[_0xeb53('0xb')](),controller[_0xeb53('0xe')]);router[_0xeb53('0xf')]('/',auth[_0xeb53('0xb')](),controller['create']);router[_0xeb53('0x10')]('/:id',auth[_0xeb53('0xb')](),controller[_0xeb53('0x11')]);router[_0xeb53('0x12')](_0xeb53('0xd'),auth[_0xeb53('0xb')](),controller[_0xeb53('0x13')]);module[_0xeb53('0x14')]=router; \ No newline at end of file +var _0x651b=['fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index','get','/:id','post','isAuthenticated','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0x651b,0xc2));var _0xb651=function(_0x501b9d,_0x221cfc){_0x501b9d=_0x501b9d-0x0;var _0xa2f34e=_0x651b[_0x501b9d];return _0xa2f34e;};'use strict';var multer=require(_0xb651('0x0'));var util=require(_0xb651('0x1'));var path=require(_0xb651('0x2'));var timeout=require(_0xb651('0x3'));var express=require(_0xb651('0x4'));var router=express[_0xb651('0x5')]();var fs_extra=require(_0xb651('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb651('0x7'));var config=require(_0xb651('0x8'));var controller=require(_0xb651('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb651('0xa')]);router[_0xb651('0xb')](_0xb651('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb651('0xd')]('/',auth[_0xb651('0xe')](),controller[_0xb651('0xf')]);router[_0xb651('0x10')](_0xb651('0xc'),auth[_0xb651('0xe')](),controller[_0xb651('0x11')]);router[_0xb651('0x12')](_0xb651('0xc'),auth[_0xb651('0xe')](),controller['destroy']);module[_0xb651('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index fb8419d..88b62f5 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 _0x2b67=['customVariable','keyValue','STRING','string','BOOLEAN','sequelize','exports','variable'];(function(_0x4f9ef1,_0x3cead7){var _0x3d3573=function(_0x188b68){while(--_0x188b68){_0x4f9ef1['push'](_0x4f9ef1['shift']());}};_0x3d3573(++_0x3cead7);}(_0x2b67,0x9d));var _0x72b6=function(_0x44ee22,_0x5c370b){_0x44ee22=_0x44ee22-0x0;var _0x7b3321=_0x2b67[_0x44ee22];return _0x7b3321;};'use strict';var Sequelize=require(_0x72b6('0x0'));module[_0x72b6('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x72b6('0x2'),_0x72b6('0x3'),_0x72b6('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x72b6('0x5')]},'key':{'type':Sequelize[_0x72b6('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x72b6('0x6'),_0x72b6('0x2'),_0x72b6('0x3'))},'keyContent':{'type':Sequelize[_0x72b6('0x5')]},'idField':{'type':Sequelize[_0x72b6('0x5')]},'nameField':{'type':Sequelize[_0x72b6('0x5')]},'customField':{'type':Sequelize[_0x72b6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x72b6('0x5')]}}; \ No newline at end of file +var _0x324f=['keyValue','picklist','STRING','ENUM','sequelize','exports','string','variable'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x324f,0x184));var _0xf324=function(_0x2c1767,_0x540dd9){_0x2c1767=_0x2c1767-0x0;var _0x923631=_0x324f[_0x2c1767];return _0x923631;};'use strict';var Sequelize=require(_0xf324('0x0'));module[_0xf324('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf324('0x2'),_0xf324('0x3'),'customVariable',_0xf324('0x4'),_0xf324('0x5')),'defaultValue':_0xf324('0x2')},'content':{'type':Sequelize[_0xf324('0x6')]},'key':{'type':Sequelize[_0xf324('0x6')]},'keyType':{'type':Sequelize[_0xf324('0x7')](_0xf324('0x2'),_0xf324('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf324('0x6')]},'nameField':{'type':Sequelize[_0xf324('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'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 eb7feb5..4f009bc 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 _0x1c5c=['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','undefined','limit','count','offset','set','json','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','rows','catch','params','intersection','find','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3557d0,_0x39f204){var _0x38d56c=function(_0x5a582e){while(--_0x5a582e){_0x3557d0['push'](_0x3557d0['shift']());}};_0x38d56c(++_0x39f204);}(_0x1c5c,0x124));var _0xc1c5=function(_0x24e242,_0x313cf9){_0x24e242=_0x24e242-0x0;var _0xd6e537=_0x1c5c[_0x24e242];return _0xd6e537;};'use strict';var emlformat=require(_0xc1c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1c5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c5('0x2'));var moment=require(_0xc1c5('0x3'));var BPromise=require(_0xc1c5('0x4'));var Mustache=require('mustache');var util=require(_0xc1c5('0x5'));var path=require(_0xc1c5('0x6'));var sox=require(_0xc1c5('0x7'));var csv=require(_0xc1c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1c5('0x9'));var _=require(_0xc1c5('0xa'));var squel=require(_0xc1c5('0xb'));var crypto=require(_0xc1c5('0xc'));var jsforce=require(_0xc1c5('0xd'));var deskjs=require(_0xc1c5('0xe'));var toCsv=require(_0xc1c5('0x8'));var querystring=require(_0xc1c5('0xf'));var Papa=require(_0xc1c5('0x10'));var Redis=require(_0xc1c5('0x11'));var authService=require(_0xc1c5('0x12'));var qs=require(_0xc1c5('0x13'));var as=require(_0xc1c5('0x14'));var hardwareService=require(_0xc1c5('0x15'));var logger=require(_0xc1c5('0x16'))(_0xc1c5('0x17'));var utils=require(_0xc1c5('0x18'));var config=require(_0xc1c5('0x19'));var licenseUtil=require(_0xc1c5('0x1a'));var db=require(_0xc1c5('0x1b'))['db'];function respondWithStatusCode(_0x5d3757,_0x4dfa28){_0x4dfa28=_0x4dfa28||0xcc;return function(_0x4ce8c3){if(_0x4ce8c3){return _0x5d3757[_0xc1c5('0x1c')](_0x4dfa28);}return _0x5d3757['status'](_0x4dfa28)[_0xc1c5('0x1d')]();};}function respondWithResult(_0x42a352,_0x199131){_0x199131=_0x199131||0xc8;return function(_0xc3e371){if(_0xc3e371){return _0x42a352[_0xc1c5('0x1e')](_0x199131)['json'](_0xc3e371);}};}function respondWithFilteredResult(_0x2fa8a7,_0x8f0321){return function(_0x5c41ed){if(_0x5c41ed){var _0xf38f35=typeof _0x8f0321['offset']===_0xc1c5('0x1f')&&typeof _0x8f0321[_0xc1c5('0x20')]==='undefined';var _0x36dea5=_0x5c41ed[_0xc1c5('0x21')];var _0x629e9=_0xf38f35?0x0:_0x8f0321[_0xc1c5('0x22')];var _0x5939dc=_0xf38f35?_0x5c41ed['count']:_0x8f0321[_0xc1c5('0x22')]+_0x8f0321[_0xc1c5('0x20')];var _0x2685be;if(_0x5939dc>=_0x36dea5){_0x5939dc=_0x36dea5;_0x2685be=0xc8;}else{_0x2685be=0xce;}_0x2fa8a7[_0xc1c5('0x1e')](_0x2685be);return _0x2fa8a7[_0xc1c5('0x23')]('Content-Range',_0x629e9+'-'+_0x5939dc+'/'+_0x36dea5)[_0xc1c5('0x24')](_0x5c41ed);}return null;};}function patchUpdates(_0xb02a48){return function(_0xa3bb){try{jsonpatch[_0xc1c5('0x25')](_0xa3bb,_0xb02a48,!![]);}catch(_0x1c780c){return BPromise[_0xc1c5('0x26')](_0x1c780c);}return _0xa3bb[_0xc1c5('0x27')]();};}function saveUpdates(_0x32c69f,_0x2b59e2){return function(_0x2c4337){if(_0x2c4337){return _0x2c4337[_0xc1c5('0x28')](_0x32c69f)[_0xc1c5('0x29')](function(_0xa1a18){return _0xa1a18;});}return null;};}function removeEntity(_0x4e410a,_0x2a7715){return function(_0x41cec3){if(_0x41cec3){return _0x41cec3['destroy']()[_0xc1c5('0x29')](function(){_0x4e410a[_0xc1c5('0x1e')](0xcc)[_0xc1c5('0x1d')]();});}};}function handleEntityNotFound(_0x43c196,_0x306d50){return function(_0x30e5ad){if(!_0x30e5ad){_0x43c196[_0xc1c5('0x1c')](0x194);}return _0x30e5ad;};}function handleError(_0x52e2d5,_0x61fe37){_0x61fe37=_0x61fe37||0x1f4;return function(_0x1613d5){logger[_0xc1c5('0x2a')](_0x1613d5[_0xc1c5('0x2b')]);if(_0x1613d5[_0xc1c5('0x2c')]){delete _0x1613d5[_0xc1c5('0x2c')];}_0x52e2d5[_0xc1c5('0x1e')](_0x61fe37)['send'](_0x1613d5);};}exports[_0xc1c5('0x2d')]=function(_0x4c3904,_0x4f38d0){var _0x29e41b={},_0x408c17={},_0x34b8a8={'count':0x0,'rows':[]};var _0x20d008=_[_0xc1c5('0x2e')](db['SugarcrmField'][_0xc1c5('0x2f')],function(_0x3c2273){return{'name':_0x3c2273[_0xc1c5('0x30')],'type':_0x3c2273[_0xc1c5('0x31')][_0xc1c5('0x32')]};});_0x408c17['model']=_[_0xc1c5('0x2e')](_0x20d008,_0xc1c5('0x2c'));_0x408c17[_0xc1c5('0x33')]=_[_0xc1c5('0x34')](_0x4c3904['query']);_0x408c17[_0xc1c5('0x35')]=_['intersection'](_0x408c17[_0xc1c5('0x36')],_0x408c17[_0xc1c5('0x33')]);_0x29e41b['attributes']=_['intersection'](_0x408c17[_0xc1c5('0x36')],qs['fields'](_0x4c3904['query'][_0xc1c5('0x37')]));_0x29e41b[_0xc1c5('0x38')]=_0x29e41b[_0xc1c5('0x38')][_0xc1c5('0x39')]?_0x29e41b['attributes']:_0x408c17[_0xc1c5('0x36')];if(!_0x4c3904[_0xc1c5('0x33')][_0xc1c5('0x3a')](_0xc1c5('0x3b'))){_0x29e41b['limit']=qs[_0xc1c5('0x20')](_0x4c3904[_0xc1c5('0x33')][_0xc1c5('0x20')]);_0x29e41b[_0xc1c5('0x22')]=qs[_0xc1c5('0x22')](_0x4c3904[_0xc1c5('0x33')][_0xc1c5('0x22')]);}_0x29e41b[_0xc1c5('0x3c')]=qs[_0xc1c5('0x3d')](_0x4c3904[_0xc1c5('0x33')][_0xc1c5('0x3d')]);_0x29e41b[_0xc1c5('0x3e')]=qs[_0xc1c5('0x35')](_[_0xc1c5('0x3f')](_0x4c3904[_0xc1c5('0x33')],_0x408c17[_0xc1c5('0x35')]),_0x20d008);if(_0x4c3904[_0xc1c5('0x33')]['filter']){_0x29e41b[_0xc1c5('0x3e')]=_[_0xc1c5('0x40')](_0x29e41b[_0xc1c5('0x3e')],{'$or':_['map'](_0x20d008,function(_0x522066){if(_0x522066['type']!==_0xc1c5('0x41')){var _0x18111d={};_0x18111d[_0x522066[_0xc1c5('0x2c')]]={'$like':'%'+_0x4c3904[_0xc1c5('0x33')]['filter']+'%'};return _0x18111d;}})});}_0x29e41b=_[_0xc1c5('0x40')]({},_0x29e41b,_0x4c3904[_0xc1c5('0x42')]);var _0x35dd6d={'where':_0x29e41b[_0xc1c5('0x3e')]};return db[_0xc1c5('0x43')][_0xc1c5('0x21')](_0x35dd6d)[_0xc1c5('0x29')](function(_0x31b07a){_0x34b8a8[_0xc1c5('0x21')]=_0x31b07a;if(_0x4c3904[_0xc1c5('0x33')][_0xc1c5('0x44')]){_0x29e41b[_0xc1c5('0x45')]=[{'all':!![]}];}return db[_0xc1c5('0x43')][_0xc1c5('0x46')](_0x29e41b);})[_0xc1c5('0x29')](function(_0x7ab98c){_0x34b8a8[_0xc1c5('0x47')]=_0x7ab98c;return _0x34b8a8;})['then'](respondWithFilteredResult(_0x4f38d0,_0x29e41b))[_0xc1c5('0x48')](handleError(_0x4f38d0,null));};exports['show']=function(_0x56cac,_0x520f31){var _0x672abd={'raw':!![],'where':{'id':_0x56cac[_0xc1c5('0x49')]['id']}},_0x1da74f={};_0x1da74f['model']=_[_0xc1c5('0x34')](db[_0xc1c5('0x43')][_0xc1c5('0x2f')]);_0x1da74f[_0xc1c5('0x33')]=_['keys'](_0x56cac[_0xc1c5('0x33')]);_0x1da74f['filters']=_['intersection'](_0x1da74f['model'],_0x1da74f[_0xc1c5('0x33')]);_0x672abd['attributes']=_[_0xc1c5('0x4a')](_0x1da74f['model'],qs[_0xc1c5('0x37')](_0x56cac[_0xc1c5('0x33')]['fields']));_0x672abd[_0xc1c5('0x38')]=_0x672abd[_0xc1c5('0x38')]['length']?_0x672abd[_0xc1c5('0x38')]:_0x1da74f['model'];if(_0x56cac[_0xc1c5('0x33')][_0xc1c5('0x44')]){_0x672abd[_0xc1c5('0x45')]=[{'all':!![]}];}_0x672abd=_[_0xc1c5('0x40')]({},_0x672abd,_0x56cac['options']);return db[_0xc1c5('0x43')][_0xc1c5('0x4b')](_0x672abd)[_0xc1c5('0x29')](handleEntityNotFound(_0x520f31,null))[_0xc1c5('0x29')](respondWithResult(_0x520f31,null))[_0xc1c5('0x48')](handleError(_0x520f31,null));};exports['create']=function(_0x28f043,_0x4de28c){return db[_0xc1c5('0x43')]['create'](_0x28f043[_0xc1c5('0x4c')],{})['then'](respondWithResult(_0x4de28c,0xc9))[_0xc1c5('0x48')](handleError(_0x4de28c,null));};exports[_0xc1c5('0x28')]=function(_0x5ec8b1,_0x3a40e4){if(_0x5ec8b1[_0xc1c5('0x4c')]['id']){delete _0x5ec8b1['body']['id'];}return db[_0xc1c5('0x43')][_0xc1c5('0x4b')]({'where':{'id':_0x5ec8b1['params']['id']}})['then'](handleEntityNotFound(_0x3a40e4,null))[_0xc1c5('0x29')](saveUpdates(_0x5ec8b1['body'],null))[_0xc1c5('0x29')](respondWithResult(_0x3a40e4,null))['catch'](handleError(_0x3a40e4,null));};exports['destroy']=function(_0x2e8046,_0x297f08){return db[_0xc1c5('0x43')]['find']({'where':{'id':_0x2e8046[_0xc1c5('0x49')]['id']}})[_0xc1c5('0x29')](handleEntityNotFound(_0x297f08,null))[_0xc1c5('0x29')](removeEntity(_0x297f08,null))[_0xc1c5('0x48')](handleError(_0x297f08,null));}; \ No newline at end of file +var _0xcf60=['end','error','stack','name','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rows','show','params','create','body','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy'];(function(_0xcc9097,_0x5f58ae){var _0x28aa54=function(_0x33aa3c){while(--_0x33aa3c){_0xcc9097['push'](_0xcc9097['shift']());}};_0x28aa54(++_0x5f58ae);}(_0xcf60,0xb8));var _0x0cf6=function(_0x1be5c6,_0x3c61e6){_0x1be5c6=_0x1be5c6-0x0;var _0x397c0c=_0xcf60[_0x1be5c6];return _0x397c0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0cf6('0x0'));var zipdir=require(_0x0cf6('0x1'));var jsonpatch=require(_0x0cf6('0x2'));var rp=require('request-promise');var moment=require(_0x0cf6('0x3'));var BPromise=require(_0x0cf6('0x4'));var Mustache=require('mustache');var util=require(_0x0cf6('0x5'));var path=require(_0x0cf6('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0cf6('0x7'));var fs=require('fs');var fs_extra=require(_0x0cf6('0x8'));var _=require(_0x0cf6('0x9'));var squel=require(_0x0cf6('0xa'));var crypto=require(_0x0cf6('0xb'));var jsforce=require(_0x0cf6('0xc'));var deskjs=require(_0x0cf6('0xd'));var toCsv=require(_0x0cf6('0xe'));var querystring=require('querystring');var Papa=require(_0x0cf6('0xf'));var Redis=require(_0x0cf6('0x10'));var authService=require(_0x0cf6('0x11'));var qs=require(_0x0cf6('0x12'));var as=require(_0x0cf6('0x13'));var hardwareService=require(_0x0cf6('0x14'));var logger=require(_0x0cf6('0x15'))(_0x0cf6('0x16'));var utils=require(_0x0cf6('0x17'));var config=require(_0x0cf6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cf6('0x19'))['db'];function respondWithStatusCode(_0x52e748,_0x5e4a82){_0x5e4a82=_0x5e4a82||0xcc;return function(_0x4aa5c5){if(_0x4aa5c5){return _0x52e748[_0x0cf6('0x1a')](_0x5e4a82);}return _0x52e748[_0x0cf6('0x1b')](_0x5e4a82)['end']();};}function respondWithResult(_0x4be34e,_0x10e48f){_0x10e48f=_0x10e48f||0xc8;return function(_0x28dc1a){if(_0x28dc1a){return _0x4be34e[_0x0cf6('0x1b')](_0x10e48f)[_0x0cf6('0x1c')](_0x28dc1a);}};}function respondWithFilteredResult(_0x318a1c,_0x387a52){return function(_0x64ea94){if(_0x64ea94){var _0x702e92=typeof _0x387a52[_0x0cf6('0x1d')]===_0x0cf6('0x1e')&&typeof _0x387a52[_0x0cf6('0x1f')]===_0x0cf6('0x1e');var _0x13f224=_0x64ea94[_0x0cf6('0x20')];var _0x431df9=_0x702e92?0x0:_0x387a52[_0x0cf6('0x1d')];var _0x272d1a=_0x702e92?_0x64ea94[_0x0cf6('0x20')]:_0x387a52[_0x0cf6('0x1d')]+_0x387a52[_0x0cf6('0x1f')];var _0x669565;if(_0x272d1a>=_0x13f224){_0x272d1a=_0x13f224;_0x669565=0xc8;}else{_0x669565=0xce;}_0x318a1c[_0x0cf6('0x1b')](_0x669565);return _0x318a1c['set']('Content-Range',_0x431df9+'-'+_0x272d1a+'/'+_0x13f224)['json'](_0x64ea94);}return null;};}function patchUpdates(_0x34bbd0){return function(_0x1f77b5){try{jsonpatch[_0x0cf6('0x21')](_0x1f77b5,_0x34bbd0,!![]);}catch(_0x32a502){return BPromise[_0x0cf6('0x22')](_0x32a502);}return _0x1f77b5[_0x0cf6('0x23')]();};}function saveUpdates(_0x4b1e38,_0x4abe06){return function(_0xb2bd0){if(_0xb2bd0){return _0xb2bd0[_0x0cf6('0x24')](_0x4b1e38)['then'](function(_0x5c72f5){return _0x5c72f5;});}return null;};}function removeEntity(_0x1dc71f,_0x48a1d3){return function(_0x2cb341){if(_0x2cb341){return _0x2cb341[_0x0cf6('0x25')]()['then'](function(){_0x1dc71f[_0x0cf6('0x1b')](0xcc)[_0x0cf6('0x26')]();});}};}function handleEntityNotFound(_0x457449,_0x275c81){return function(_0x38f8fd){if(!_0x38f8fd){_0x457449[_0x0cf6('0x1a')](0x194);}return _0x38f8fd;};}function handleError(_0x2c6538,_0xb3710){_0xb3710=_0xb3710||0x1f4;return function(_0xbba9ea){logger[_0x0cf6('0x27')](_0xbba9ea[_0x0cf6('0x28')]);if(_0xbba9ea['name']){delete _0xbba9ea[_0x0cf6('0x29')];}_0x2c6538[_0x0cf6('0x1b')](_0xb3710)['send'](_0xbba9ea);};}exports['index']=function(_0x21404c,_0x3d4790){var _0x4f4a27={},_0x1f7d78={},_0x392c3a={'count':0x0,'rows':[]};var _0x2265c7=_[_0x0cf6('0x2a')](db[_0x0cf6('0x2b')][_0x0cf6('0x2c')],function(_0x281838){return{'name':_0x281838[_0x0cf6('0x2d')],'type':_0x281838[_0x0cf6('0x2e')][_0x0cf6('0x2f')]};});_0x1f7d78[_0x0cf6('0x30')]=_[_0x0cf6('0x2a')](_0x2265c7,'name');_0x1f7d78[_0x0cf6('0x31')]=_[_0x0cf6('0x32')](_0x21404c[_0x0cf6('0x31')]);_0x1f7d78[_0x0cf6('0x33')]=_['intersection'](_0x1f7d78[_0x0cf6('0x30')],_0x1f7d78['query']);_0x4f4a27[_0x0cf6('0x34')]=_[_0x0cf6('0x35')](_0x1f7d78[_0x0cf6('0x30')],qs['fields'](_0x21404c['query'][_0x0cf6('0x36')]));_0x4f4a27[_0x0cf6('0x34')]=_0x4f4a27[_0x0cf6('0x34')][_0x0cf6('0x37')]?_0x4f4a27[_0x0cf6('0x34')]:_0x1f7d78[_0x0cf6('0x30')];if(!_0x21404c[_0x0cf6('0x31')][_0x0cf6('0x38')]('nolimit')){_0x4f4a27['limit']=qs['limit'](_0x21404c['query'][_0x0cf6('0x1f')]);_0x4f4a27[_0x0cf6('0x1d')]=qs['offset'](_0x21404c[_0x0cf6('0x31')]['offset']);}_0x4f4a27[_0x0cf6('0x39')]=qs[_0x0cf6('0x3a')](_0x21404c[_0x0cf6('0x31')]['sort']);_0x4f4a27[_0x0cf6('0x3b')]=qs['filters'](_[_0x0cf6('0x3c')](_0x21404c[_0x0cf6('0x31')],_0x1f7d78[_0x0cf6('0x33')]),_0x2265c7);if(_0x21404c['query'][_0x0cf6('0x3d')]){_0x4f4a27[_0x0cf6('0x3b')]=_[_0x0cf6('0x3e')](_0x4f4a27[_0x0cf6('0x3b')],{'$or':_[_0x0cf6('0x2a')](_0x2265c7,function(_0x45f02d){if(_0x45f02d[_0x0cf6('0x2e')]!==_0x0cf6('0x3f')){var _0x263c12={};_0x263c12[_0x45f02d[_0x0cf6('0x29')]]={'$like':'%'+_0x21404c[_0x0cf6('0x31')]['filter']+'%'};return _0x263c12;}})});}_0x4f4a27=_['merge']({},_0x4f4a27,_0x21404c[_0x0cf6('0x40')]);var _0x2673cc={'where':_0x4f4a27['where']};return db[_0x0cf6('0x2b')][_0x0cf6('0x20')](_0x2673cc)[_0x0cf6('0x41')](function(_0x4f98c1){_0x392c3a[_0x0cf6('0x20')]=_0x4f98c1;if(_0x21404c[_0x0cf6('0x31')][_0x0cf6('0x42')]){_0x4f4a27[_0x0cf6('0x43')]=[{'all':!![]}];}return db[_0x0cf6('0x2b')]['findAll'](_0x4f4a27);})['then'](function(_0x3cb6ba){_0x392c3a[_0x0cf6('0x44')]=_0x3cb6ba;return _0x392c3a;})['then'](respondWithFilteredResult(_0x3d4790,_0x4f4a27))['catch'](handleError(_0x3d4790,null));};exports[_0x0cf6('0x45')]=function(_0x3ceec5,_0x515815){var _0x233211={'raw':!![],'where':{'id':_0x3ceec5[_0x0cf6('0x46')]['id']}},_0x2a9bd4={};_0x2a9bd4[_0x0cf6('0x30')]=_['keys'](db[_0x0cf6('0x2b')][_0x0cf6('0x2c')]);_0x2a9bd4[_0x0cf6('0x31')]=_[_0x0cf6('0x32')](_0x3ceec5[_0x0cf6('0x31')]);_0x2a9bd4[_0x0cf6('0x33')]=_['intersection'](_0x2a9bd4[_0x0cf6('0x30')],_0x2a9bd4[_0x0cf6('0x31')]);_0x233211['attributes']=_['intersection'](_0x2a9bd4[_0x0cf6('0x30')],qs[_0x0cf6('0x36')](_0x3ceec5[_0x0cf6('0x31')][_0x0cf6('0x36')]));_0x233211[_0x0cf6('0x34')]=_0x233211['attributes'][_0x0cf6('0x37')]?_0x233211[_0x0cf6('0x34')]:_0x2a9bd4[_0x0cf6('0x30')];if(_0x3ceec5['query'][_0x0cf6('0x42')]){_0x233211['include']=[{'all':!![]}];}_0x233211=_[_0x0cf6('0x3e')]({},_0x233211,_0x3ceec5[_0x0cf6('0x40')]);return db[_0x0cf6('0x2b')]['find'](_0x233211)[_0x0cf6('0x41')](handleEntityNotFound(_0x515815,null))[_0x0cf6('0x41')](respondWithResult(_0x515815,null))['catch'](handleError(_0x515815,null));};exports[_0x0cf6('0x47')]=function(_0x40f799,_0x4cbc79){return db[_0x0cf6('0x2b')][_0x0cf6('0x47')](_0x40f799[_0x0cf6('0x48')],{})[_0x0cf6('0x41')](respondWithResult(_0x4cbc79,0xc9))['catch'](handleError(_0x4cbc79,null));};exports[_0x0cf6('0x24')]=function(_0x1f2f11,_0x1be6f8){if(_0x1f2f11[_0x0cf6('0x48')]['id']){delete _0x1f2f11[_0x0cf6('0x48')]['id'];}return db[_0x0cf6('0x2b')]['find']({'where':{'id':_0x1f2f11[_0x0cf6('0x46')]['id']}})[_0x0cf6('0x41')](handleEntityNotFound(_0x1be6f8,null))[_0x0cf6('0x41')](saveUpdates(_0x1f2f11[_0x0cf6('0x48')],null))['then'](respondWithResult(_0x1be6f8,null))[_0x0cf6('0x49')](handleError(_0x1be6f8,null));};exports['destroy']=function(_0x1a79ea,_0x561cc9){return db[_0x0cf6('0x2b')]['find']({'where':{'id':_0x1a79ea[_0x0cf6('0x46')]['id']}})[_0x0cf6('0x41')](handleEntityNotFound(_0x561cc9,null))[_0x0cf6('0x41')](removeEntity(_0x561cc9,null))[_0x0cf6('0x49')](handleError(_0x561cc9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 8db2392..dc0d404 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 _0x4f0b=['define','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x2d775e,_0x4c0165){var _0x47e959=function(_0x558ee4){while(--_0x558ee4){_0x2d775e['push'](_0x2d775e['shift']());}};_0x47e959(++_0x4c0165);}(_0x4f0b,0x124));var _0xb4f0=function(_0x2470d2,_0x6b5ff1){_0x2470d2=_0x2470d2-0x0;var _0x1dfb0c=_0x4f0b[_0x2470d2];return _0x1dfb0c;};'use strict';var _=require(_0xb4f0('0x0'));var util=require(_0xb4f0('0x1'));var logger=require(_0xb4f0('0x2'))(_0xb4f0('0x3'));var moment=require(_0xb4f0('0x4'));var BPromise=require(_0xb4f0('0x5'));var rp=require(_0xb4f0('0x6'));var fs=require('fs');var path=require(_0xb4f0('0x7'));var rimraf=require(_0xb4f0('0x8'));var config=require(_0xb4f0('0x9'));var attributes=require(_0xb4f0('0xa'));module[_0xb4f0('0xb')]=function(_0x58d257,_0x19ad05){return _0x58d257[_0xb4f0('0xc')]('SugarcrmField',attributes,{'tableName':_0xb4f0('0xd'),'paranoid':![],'indexes':[{'name':_0xb4f0('0xe'),'fields':[_0xb4f0('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c27=['idField','FieldId','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','int_sugarcrm_fields'];(function(_0x35c5cf,_0x27795e){var _0x549b4b=function(_0x21b6e1){while(--_0x21b6e1){_0x35c5cf['push'](_0x35c5cf['shift']());}};_0x549b4b(++_0x27795e);}(_0x9c27,0x12e));var _0x79c2=function(_0x168120,_0x4e19de){_0x168120=_0x168120-0x0;var _0x5c827e=_0x9c27[_0x168120];return _0x5c827e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x79c2('0x0'))(_0x79c2('0x1'));var moment=require('moment');var BPromise=require(_0x79c2('0x2'));var rp=require(_0x79c2('0x3'));var fs=require('fs');var path=require(_0x79c2('0x4'));var rimraf=require(_0x79c2('0x5'));var config=require(_0x79c2('0x6'));var attributes=require(_0x79c2('0x7'));module[_0x79c2('0x8')]=function(_0x5a2e9a,_0x33e690){return _0x5a2e9a['define']('SugarcrmField',attributes,{'tableName':_0x79c2('0x9'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x79c2('0xa'),_0x79c2('0xb')],'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 8668bf6..6030e81 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 _0x8898=['../../config/logger','../../config/environment','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1cc8b5,_0x304d71){var _0x2b2c7a=function(_0x2211d2){while(--_0x2211d2){_0x1cc8b5['push'](_0x1cc8b5['shift']());}};_0x2b2c7a(++_0x304d71);}(_0x8898,0x163));var _0x8889=function(_0x472579,_0x3cef12){_0x472579=_0x472579-0x0;var _0x5148a7=_0x8898[_0x472579];return _0x5148a7;};'use strict';var _=require(_0x8889('0x0'));var util=require('util');var moment=require(_0x8889('0x1'));var BPromise=require(_0x8889('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8889('0x3'));var db=require(_0x8889('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8889('0x5'))('rpc');var config=require(_0x8889('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8889('0x7')][_0x8889('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xefbbdd,_0x205df5,_0x127d5e){return new BPromise(function(_0x1c8ee1,_0x553384){return client[_0x8889('0x9')](_0xefbbdd,_0x127d5e)[_0x8889('0xa')](function(_0x3477ed){logger['info'](_0x8889('0xb'),_0x205df5,_0x8889('0xc'));logger[_0x8889('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x205df5,'request\x20sent',JSON['stringify'](_0x3477ed));if(_0x3477ed['error']){if(_0x3477ed[_0x8889('0xe')]['code']===0x1f4){logger[_0x8889('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x205df5,_0x3477ed[_0x8889('0xe')][_0x8889('0xf')]);return _0x553384(_0x3477ed[_0x8889('0xe')][_0x8889('0xf')]);}logger[_0x8889('0xe')](_0x8889('0xb'),_0x205df5,_0x3477ed['error']['message']);return _0x1c8ee1(_0x3477ed[_0x8889('0xe')][_0x8889('0xf')]);}else{logger['info'](_0x8889('0xb'),_0x205df5,_0x8889('0xc'));_0x1c8ee1(_0x3477ed[_0x8889('0x10')][_0x8889('0xf')]);}})[_0x8889('0x11')](function(_0xd1d103){logger[_0x8889('0xe')](_0x8889('0xb'),_0x205df5,_0xd1d103);_0x553384(_0xd1d103);});});} \ No newline at end of file +var _0x0540=['jayson/promise','client','http','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0540,0xff));var _0x0054=function(_0x36e61b,_0x5a6ec0){_0x36e61b=_0x36e61b-0x0;var _0x4de96b=_0x0540[_0x36e61b];return _0x4de96b;};'use strict';var _=require(_0x0054('0x0'));var util=require(_0x0054('0x1'));var moment=require(_0x0054('0x2'));var BPromise=require(_0x0054('0x3'));var rs=require(_0x0054('0x4'));var fs=require('fs');var Redis=require(_0x0054('0x5'));var db=require(_0x0054('0x6'))['db'];var utils=require(_0x0054('0x7'));var logger=require('../../config/logger')(_0x0054('0x8'));var config=require('../../config/environment');var jayson=require(_0x0054('0x9'));var client=jayson[_0x0054('0xa')][_0x0054('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x314d21,_0x14d156,_0x230d70){return new BPromise(function(_0x2f6b43,_0x51ba49){return client['request'](_0x314d21,_0x230d70)[_0x0054('0xc')](function(_0x2eaa9e){logger[_0x0054('0xd')](_0x0054('0xe'),_0x14d156,'request\x20sent');logger[_0x0054('0xf')](_0x0054('0x10'),_0x14d156,'request\x20sent',JSON[_0x0054('0x11')](_0x2eaa9e));if(_0x2eaa9e['error']){if(_0x2eaa9e[_0x0054('0x12')][_0x0054('0x13')]===0x1f4){logger[_0x0054('0x12')](_0x0054('0xe'),_0x14d156,_0x2eaa9e[_0x0054('0x12')][_0x0054('0x14')]);return _0x51ba49(_0x2eaa9e[_0x0054('0x12')][_0x0054('0x14')]);}logger[_0x0054('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x14d156,_0x2eaa9e['error'][_0x0054('0x14')]);return _0x2f6b43(_0x2eaa9e[_0x0054('0x12')]['message']);}else{logger[_0x0054('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x14d156,_0x0054('0x15'));_0x2f6b43(_0x2eaa9e['result'][_0x0054('0x14')]);}})['catch'](function(_0x1457ab){logger[_0x0054('0x12')](_0x0054('0xe'),_0x14d156,_0x1457ab);_0x51ba49(_0x1457ab);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 2ee1ba0..15ef51d 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 _0x7b5b=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x523122,_0x467f48){var _0x1250e2=function(_0x37d837){while(--_0x37d837){_0x523122['push'](_0x523122['shift']());}};_0x1250e2(++_0x467f48);}(_0x7b5b,0x14a));var _0xb7b5=function(_0x18bcd9,_0x1a586d){_0x18bcd9=_0x18bcd9-0x0;var _0x239579=_0x7b5b[_0x18bcd9];return _0x239579;};'use strict';var multer=require('multer');var util=require(_0xb7b5('0x0'));var path=require(_0xb7b5('0x1'));var timeout=require(_0xb7b5('0x2'));var express=require(_0xb7b5('0x3'));var router=express[_0xb7b5('0x4')]();var fs_extra=require(_0xb7b5('0x5'));var auth=require(_0xb7b5('0x6'));var interaction=require(_0xb7b5('0x7'));var config=require(_0xb7b5('0x8'));var controller=require(_0xb7b5('0x9'));router[_0xb7b5('0xa')]('/',auth[_0xb7b5('0xb')](),controller[_0xb7b5('0xc')]);router[_0xb7b5('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb7b5('0xd')]);router[_0xb7b5('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xb7b5('0xe')]);router[_0xb7b5('0xa')]('/:id/fields',auth[_0xb7b5('0xb')](),controller[_0xb7b5('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb7b5('0x10')]);router[_0xb7b5('0x11')](_0xb7b5('0x12'),auth['isAuthenticated'](),controller[_0xb7b5('0x13')]);router[_0xb7b5('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb7b5('0x15')]);router[_0xb7b5('0x16')](_0xb7b5('0x17'),auth[_0xb7b5('0xb')](),controller[_0xb7b5('0x18')]);module[_0xb7b5('0x19')]=router; \ No newline at end of file +var _0xf53f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','post','/:id/configurations','put','/:id','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x26bfb4,_0x1673ed){var _0x53579a=function(_0x256635){while(--_0x256635){_0x26bfb4['push'](_0x26bfb4['shift']());}};_0x53579a(++_0x1673ed);}(_0xf53f,0x8d));var _0xff53=function(_0x2fff4b,_0x3d6736){_0x2fff4b=_0x2fff4b-0x0;var _0x32f63b=_0xf53f[_0x2fff4b];return _0x32f63b;};'use strict';var multer=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var path=require(_0xff53('0x2'));var timeout=require(_0xff53('0x3'));var express=require(_0xff53('0x4'));var router=express[_0xff53('0x5')]();var fs_extra=require(_0xff53('0x6'));var auth=require(_0xff53('0x7'));var interaction=require(_0xff53('0x8'));var config=require(_0xff53('0x9'));var controller=require(_0xff53('0xa'));router[_0xff53('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xff53('0xb')]('/:id',auth[_0xff53('0xc')](),controller[_0xff53('0xd')]);router[_0xff53('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xff53('0xe')]);router['get'](_0xff53('0xf'),auth[_0xff53('0xc')](),controller['getFields']);router[_0xff53('0x10')]('/',auth[_0xff53('0xc')](),controller['create']);router[_0xff53('0x10')](_0xff53('0x11'),auth[_0xff53('0xc')](),controller['addConfiguration']);router[_0xff53('0x12')](_0xff53('0x13'),auth[_0xff53('0xc')](),controller['update']);router[_0xff53('0x14')](_0xff53('0x13'),auth['isAuthenticated'](),controller['destroy']);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 c998664..287b025 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 _0x5f39=['STRING'];(function(_0x77f62f,_0x78b5d0){var _0x22030c=function(_0x60ab73){while(--_0x60ab73){_0x77f62f['push'](_0x77f62f['shift']());}};_0x22030c(++_0x78b5d0);}(_0x5f39,0x111));var _0x95f3=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5f39[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x95f3('0x0')]},'username':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x0e66=['HelpDesk','exports','STRING'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x0e66,0xdf));var _0x60e6=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0x0e66[_0x53c256];return _0x25feb6;};'use strict';var Sequelize=require('sequelize');module[_0x60e6('0x0')]={'name':{'type':Sequelize[_0x60e6('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x60e6('0x1')],'allowNull':![],'defaultValue':_0x60e6('0x2')},'remoteUri':{'type':Sequelize[_0x60e6('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x60e6('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x60e6('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 8bfa7e1..ec02f81 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 _0x3e52=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','GET','getchallenge','success','POST','result','describe','sessionName','owner','remove','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','key','model','keys','query','filters','attributes'];(function(_0x353b58,_0x2eeb20){var _0x40cba8=function(_0x137bf3){while(--_0x137bf3){_0x353b58['push'](_0x353b58['shift']());}};_0x40cba8(++_0x2eeb20);}(_0x3e52,0xb5));var _0x23e5=function(_0xbfe63f,_0x415287){_0xbfe63f=_0xbfe63f-0x0;var _0x2b3708=_0x3e52[_0xbfe63f];return _0x2b3708;};'use strict';var emlformat=require(_0x23e5('0x0'));var rimraf=require(_0x23e5('0x1'));var zipdir=require(_0x23e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23e5('0x3'));var moment=require(_0x23e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x23e5('0x5'));var util=require(_0x23e5('0x6'));var path=require(_0x23e5('0x7'));var sox=require(_0x23e5('0x8'));var csv=require(_0x23e5('0x9'));var ejs=require(_0x23e5('0xa'));var fs=require('fs');var fs_extra=require(_0x23e5('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x23e5('0xc'));var jsforce=require(_0x23e5('0xd'));var deskjs=require(_0x23e5('0xe'));var toCsv=require(_0x23e5('0x9'));var querystring=require(_0x23e5('0xf'));var Papa=require('papaparse');var Redis=require(_0x23e5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x23e5('0x11'));var as=require(_0x23e5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x23e5('0x13'))(_0x23e5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x23e5('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xed5b4c,_0x2b3f91){_0x2b3f91=_0x2b3f91||0xcc;return function(_0x476022){if(_0x476022){return _0xed5b4c[_0x23e5('0x16')](_0x2b3f91);}return _0xed5b4c[_0x23e5('0x17')](_0x2b3f91)[_0x23e5('0x18')]();};}function respondWithResult(_0x2f68e1,_0x3d6f94){_0x3d6f94=_0x3d6f94||0xc8;return function(_0x2ee063){if(_0x2ee063){return _0x2f68e1[_0x23e5('0x17')](_0x3d6f94)['json'](_0x2ee063);}};}function respondWithFilteredResult(_0x1b4aff,_0x5bf327){return function(_0x384d77){if(_0x384d77){var _0x568739=typeof _0x5bf327[_0x23e5('0x19')]===_0x23e5('0x1a')&&typeof _0x5bf327[_0x23e5('0x1b')]===_0x23e5('0x1a');var _0x318c9b=_0x384d77[_0x23e5('0x1c')];var _0x4124c7=_0x568739?0x0:_0x5bf327[_0x23e5('0x19')];var _0x521a7c=_0x568739?_0x384d77[_0x23e5('0x1c')]:_0x5bf327[_0x23e5('0x19')]+_0x5bf327[_0x23e5('0x1b')];var _0x5ac1d0;if(_0x521a7c>=_0x318c9b){_0x521a7c=_0x318c9b;_0x5ac1d0=0xc8;}else{_0x5ac1d0=0xce;}_0x1b4aff[_0x23e5('0x17')](_0x5ac1d0);return _0x1b4aff[_0x23e5('0x1d')]('Content-Range',_0x4124c7+'-'+_0x521a7c+'/'+_0x318c9b)[_0x23e5('0x1e')](_0x384d77);}return null;};}function patchUpdates(_0x32e0b9){return function(_0x1ce7ac){try{jsonpatch[_0x23e5('0x1f')](_0x1ce7ac,_0x32e0b9,!![]);}catch(_0x475f34){return BPromise[_0x23e5('0x20')](_0x475f34);}return _0x1ce7ac[_0x23e5('0x21')]();};}function saveUpdates(_0x4afa0a,_0x1b2376){return function(_0x1e8e84){if(_0x1e8e84){return _0x1e8e84[_0x23e5('0x22')](_0x4afa0a)[_0x23e5('0x23')](function(_0x4a92d3){return _0x4a92d3;});}return null;};}function removeEntity(_0x5deaed,_0x42a3ca){return function(_0x345ddc){if(_0x345ddc){return _0x345ddc[_0x23e5('0x24')]()[_0x23e5('0x23')](function(){_0x5deaed['status'](0xcc)[_0x23e5('0x18')]();});}};}function handleEntityNotFound(_0x38fdf5,_0x1ee95a){return function(_0x402d48){if(!_0x402d48){_0x38fdf5[_0x23e5('0x16')](0x194);}return _0x402d48;};}function handleError(_0x5d4489,_0x430c32){_0x430c32=_0x430c32||0x1f4;return function(_0x5328f4){logger[_0x23e5('0x25')](_0x5328f4[_0x23e5('0x26')]);if(_0x5328f4[_0x23e5('0x27')]){delete _0x5328f4[_0x23e5('0x27')];}_0x5d4489['status'](_0x430c32)['send'](_0x5328f4);};}exports[_0x23e5('0x28')]=function(_0x385111,_0x3ebcfc){var _0x2db2c1={},_0x3be5d5={},_0x2dbf26={'count':0x0,'rows':[]};var _0x5aeabe=_[_0x23e5('0x29')](db[_0x23e5('0x2a')][_0x23e5('0x2b')],function(_0x44f24b){return{'name':_0x44f24b[_0x23e5('0x2c')],'type':_0x44f24b['type'][_0x23e5('0x2d')]};});_0x3be5d5[_0x23e5('0x2e')]=_[_0x23e5('0x29')](_0x5aeabe,'name');_0x3be5d5['query']=_[_0x23e5('0x2f')](_0x385111[_0x23e5('0x30')]);_0x3be5d5[_0x23e5('0x31')]=_['intersection'](_0x3be5d5[_0x23e5('0x2e')],_0x3be5d5[_0x23e5('0x30')]);_0x2db2c1[_0x23e5('0x32')]=_[_0x23e5('0x33')](_0x3be5d5[_0x23e5('0x2e')],qs[_0x23e5('0x34')](_0x385111[_0x23e5('0x30')][_0x23e5('0x34')]));_0x2db2c1[_0x23e5('0x32')]=_0x2db2c1[_0x23e5('0x32')][_0x23e5('0x35')]?_0x2db2c1[_0x23e5('0x32')]:_0x3be5d5[_0x23e5('0x2e')];if(!_0x385111[_0x23e5('0x30')][_0x23e5('0x36')](_0x23e5('0x37'))){_0x2db2c1['limit']=qs[_0x23e5('0x1b')](_0x385111['query'][_0x23e5('0x1b')]);_0x2db2c1[_0x23e5('0x19')]=qs['offset'](_0x385111[_0x23e5('0x30')][_0x23e5('0x19')]);}_0x2db2c1[_0x23e5('0x38')]=qs[_0x23e5('0x39')](_0x385111['query'][_0x23e5('0x39')]);_0x2db2c1[_0x23e5('0x3a')]=qs['filters'](_[_0x23e5('0x3b')](_0x385111[_0x23e5('0x30')],_0x3be5d5[_0x23e5('0x31')]),_0x5aeabe);if(_0x385111[_0x23e5('0x30')]['filter']){_0x2db2c1[_0x23e5('0x3a')]=_[_0x23e5('0x3c')](_0x2db2c1['where'],{'$or':_[_0x23e5('0x29')](_0x5aeabe,function(_0x453b27){if(_0x453b27[_0x23e5('0x3d')]!==_0x23e5('0x3e')){var _0x14368b={};_0x14368b[_0x453b27[_0x23e5('0x27')]]={'$like':'%'+_0x385111[_0x23e5('0x30')][_0x23e5('0x3f')]+'%'};return _0x14368b;}})});}_0x2db2c1=_[_0x23e5('0x3c')]({},_0x2db2c1,_0x385111[_0x23e5('0x40')]);var _0x50f172={'where':_0x2db2c1[_0x23e5('0x3a')]};return db['VtigerAccount']['count'](_0x50f172)[_0x23e5('0x23')](function(_0x2cff5b){_0x2dbf26[_0x23e5('0x1c')]=_0x2cff5b;if(_0x385111['query']['includeAll']){_0x2db2c1[_0x23e5('0x41')]=[{'all':!![]}];}return db[_0x23e5('0x2a')][_0x23e5('0x42')](_0x2db2c1);})[_0x23e5('0x23')](function(_0x487857){_0x2dbf26[_0x23e5('0x43')]=_0x487857;return _0x2dbf26;})[_0x23e5('0x23')](respondWithFilteredResult(_0x3ebcfc,_0x2db2c1))[_0x23e5('0x44')](handleError(_0x3ebcfc,null));};exports[_0x23e5('0x45')]=function(_0x7c5246,_0x413493){var _0x114e33={'raw':![],'where':{'id':_0x7c5246[_0x23e5('0x46')]['id']}},_0x3d936d={};_0x3d936d[_0x23e5('0x2e')]=_[_0x23e5('0x2f')](db[_0x23e5('0x2a')][_0x23e5('0x2b')]);_0x3d936d[_0x23e5('0x30')]=_[_0x23e5('0x2f')](_0x7c5246['query']);_0x3d936d[_0x23e5('0x31')]=_[_0x23e5('0x33')](_0x3d936d['model'],_0x3d936d['query']);_0x114e33['attributes']=_[_0x23e5('0x33')](_0x3d936d['model'],qs['fields'](_0x7c5246[_0x23e5('0x30')][_0x23e5('0x34')]));_0x114e33[_0x23e5('0x32')]=_0x114e33[_0x23e5('0x32')][_0x23e5('0x35')]?_0x114e33[_0x23e5('0x32')]:_0x3d936d[_0x23e5('0x2e')];if(_0x7c5246['query'][_0x23e5('0x47')]){_0x114e33[_0x23e5('0x41')]=[{'all':!![]}];}_0x114e33=_[_0x23e5('0x3c')]({},_0x114e33,_0x7c5246['options']);return db[_0x23e5('0x2a')][_0x23e5('0x48')](_0x114e33)[_0x23e5('0x23')](handleEntityNotFound(_0x413493,null))[_0x23e5('0x23')](respondWithResult(_0x413493,null))[_0x23e5('0x44')](handleError(_0x413493,null));};exports[_0x23e5('0x49')]=function(_0x3047af,_0x365bd9){return db[_0x23e5('0x2a')][_0x23e5('0x49')](_0x3047af[_0x23e5('0x4a')],{})['then'](respondWithResult(_0x365bd9,0xc9))[_0x23e5('0x44')](handleError(_0x365bd9,null));};exports[_0x23e5('0x22')]=function(_0xdd99e4,_0x316432){if(_0xdd99e4[_0x23e5('0x4a')]['id']){delete _0xdd99e4[_0x23e5('0x4a')]['id'];}return db[_0x23e5('0x2a')][_0x23e5('0x48')]({'where':{'id':_0xdd99e4[_0x23e5('0x46')]['id']}})[_0x23e5('0x23')](handleEntityNotFound(_0x316432,null))[_0x23e5('0x23')](saveUpdates(_0xdd99e4[_0x23e5('0x4a')],null))[_0x23e5('0x23')](respondWithResult(_0x316432,null))[_0x23e5('0x44')](handleError(_0x316432,null));};exports[_0x23e5('0x24')]=function(_0x11c398,_0x218e3f){return db[_0x23e5('0x2a')][_0x23e5('0x48')]({'where':{'id':_0x11c398[_0x23e5('0x46')]['id']}})[_0x23e5('0x23')](handleEntityNotFound(_0x218e3f,null))[_0x23e5('0x23')](removeEntity(_0x218e3f,null))[_0x23e5('0x44')](handleError(_0x218e3f,null));};exports['getConfigurations']=function(_0x4f7b41,_0x14baa3,_0x34427c){var _0x498e3f={};var _0x268603={};var _0x460de1;var _0x4e6195;return db['VtigerAccount'][_0x23e5('0x4b')]({'where':{'id':_0x4f7b41['params']['id']}})[_0x23e5('0x23')](handleEntityNotFound(_0x14baa3,null))[_0x23e5('0x23')](function(_0x31cb55){if(_0x31cb55){_0x460de1=_0x31cb55;_0x268603['model']=_[_0x23e5('0x2f')](db[_0x23e5('0x4c')][_0x23e5('0x2b')]);_0x268603[_0x23e5('0x30')]=_[_0x23e5('0x2f')](_0x4f7b41['query']);_0x268603[_0x23e5('0x31')]=_[_0x23e5('0x33')](_0x268603[_0x23e5('0x2e')],_0x268603['query']);_0x498e3f['attributes']=_[_0x23e5('0x33')](_0x268603['model'],qs[_0x23e5('0x34')](_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x34')]));_0x498e3f[_0x23e5('0x32')]=_0x498e3f['attributes'][_0x23e5('0x35')]?_0x498e3f[_0x23e5('0x32')]:_0x268603[_0x23e5('0x2e')];_0x498e3f[_0x23e5('0x38')]=qs[_0x23e5('0x39')](_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x39')]);_0x498e3f[_0x23e5('0x3a')]=qs[_0x23e5('0x31')](_['pick'](_0x4f7b41[_0x23e5('0x30')],_0x268603[_0x23e5('0x31')]));if(_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x3f')]){_0x498e3f[_0x23e5('0x3a')]=_[_0x23e5('0x3c')](_0x498e3f[_0x23e5('0x3a')],{'$or':_[_0x23e5('0x29')](_0x498e3f[_0x23e5('0x32')],function(_0x576104){var _0x35b950={};_0x35b950[_0x576104]={'$like':'%'+_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x3f')]+'%'};return _0x35b950;})});}_0x498e3f=_[_0x23e5('0x3c')]({},_0x498e3f,_0x4f7b41[_0x23e5('0x40')]);return _0x460de1[_0x23e5('0x4d')](_0x498e3f);}})[_0x23e5('0x23')](function(_0x3a97ea){if(_0x3a97ea){_0x4e6195=_0x3a97ea['length'];if(!_0x4f7b41['query']['hasOwnProperty']('nolimit')){_0x498e3f[_0x23e5('0x1b')]=qs[_0x23e5('0x1b')](_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x1b')]);_0x498e3f[_0x23e5('0x19')]=qs[_0x23e5('0x19')](_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x19')]);}return _0x460de1['getConfigurations'](_0x498e3f);}})[_0x23e5('0x23')](function(_0x1753c3){if(_0x1753c3){return _0x1753c3?{'count':_0x4e6195,'rows':_0x1753c3}:null;}})[_0x23e5('0x23')](respondWithResult(_0x14baa3,null))[_0x23e5('0x44')](handleError(_0x14baa3,null));};exports[_0x23e5('0x4e')]=function(_0xa5f476,_0x8a4065,_0x58d68d){if(_0xa5f476[_0x23e5('0x4a')]['id']){delete _0xa5f476['body']['id'];}return db[_0x23e5('0x2a')][_0x23e5('0x4b')]({'where':{'id':_0xa5f476[_0x23e5('0x46')]['id']}})[_0x23e5('0x23')](handleEntityNotFound(_0x8a4065,null))['then'](function(_0x760714){if(_0x760714){_0xa5f476['body'][_0x23e5('0x4f')]=_0x760714['id'];_0xa5f476['body']['Subjects']=integrations[_0x23e5('0x50')](_0xa5f476[_0x23e5('0x4a')][_0x23e5('0x51')],_0xa5f476[_0x23e5('0x4a')][_0x23e5('0x3d')]);_0xa5f476[_0x23e5('0x4a')][_0x23e5('0x52')]=integrations['getDescriptions'](_0xa5f476['body']['channel'],_0xa5f476[_0x23e5('0x4a')][_0x23e5('0x3d')]);return db[_0x23e5('0x4c')][_0x23e5('0x49')](_0xa5f476[_0x23e5('0x4a')],{'include':[{'model':db[_0x23e5('0x53')],'as':'Subjects'},{'model':db[_0x23e5('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x8a4065,null))['catch'](handleError(_0x8a4065,null));};var md5=require(_0x23e5('0x54'));exports[_0x23e5('0x55')]=function(_0x4ec31e,_0xc1e6c1,_0x2a6c52){var _0xc4c55c=null;var _0x559fe3=null;var _0x5019d0=null;var _0x5ae120=null;var _0x5c63aa='';return db[_0x23e5('0x2a')][_0x23e5('0x4b')]({'where':{'id':_0x4ec31e['params']['id']},'attributes':['id',_0x23e5('0x27'),_0x23e5('0x56'),_0x23e5('0x57'),_0x23e5('0x58'),'remoteUri',_0x23e5('0x59'),_0x23e5('0x5a')]})['then'](handleEntityNotFound(_0xc1e6c1,null))[_0x23e5('0x23')](function(_0x12db34){if(_0x12db34){_0xc4c55c=_0x12db34[_0x23e5('0x56')];_0x559fe3=_0x12db34[_0x23e5('0x5a')];_0x5019d0=_0x12db34[_0x23e5('0x58')];_0x5c63aa=_0x12db34[_0x23e5('0x5b')];var _0x4adc37=_0x5c63aa[_0x23e5('0x5c')](-0x1);if(_0x4adc37==='/'){_0x5c63aa=_0x5c63aa[_0x23e5('0x5d')](0x0,_0x5c63aa[_0x23e5('0x5e')](_0x4adc37));}_0x5ae120=util[_0x23e5('0x5f')]('%s/webservice.php',_0x5c63aa);var _0x1007f3={'method':_0x23e5('0x60'),'uri':_0x5ae120,'qs':{'operation':_0x23e5('0x61'),'username':_0x12db34[_0x23e5('0x56')]},'json':!![]};return rp(_0x1007f3);}})[_0x23e5('0x23')](function(_0x2a8396){if(_0x2a8396[_0x23e5('0x62')]){var _0x55963b={'method':_0x23e5('0x63'),'uri':_0x5ae120,'form':{'operation':'login','username':_0xc4c55c,'accessKey':md5(_0x2a8396[_0x23e5('0x64')]['token']+_0x559fe3)},'json':!![]};return rp(_0x55963b);}})[_0x23e5('0x23')](function(_0x4c56ae){if(_0x4c56ae[_0x23e5('0x62')]){var _0x114f33={'method':'GET','uri':_0x5ae120,'qs':{'operation':_0x23e5('0x65'),'username':_0xc4c55c,'sessionName':_0x4c56ae[_0x23e5('0x64')][_0x23e5('0x66')],'elementType':_0x5019d0},'json':!![]};return rp(_0x114f33);}})[_0x23e5('0x23')](function(_0x39f1ab){if(_0x39f1ab[_0x23e5('0x62')]){var _0x1cb36=['autogenerated','reference',_0x23e5('0x67')];_[_0x23e5('0x68')](_0x39f1ab[_0x23e5('0x64')]['fields'],function(_0x52e279){return _0x1cb36['includes'](_0x52e279[_0x23e5('0x3d')]['name']);});_[_0x23e5('0x68')](_0x39f1ab[_0x23e5('0x64')][_0x23e5('0x34')],function(_0x5de02c){return _0x5de02c['editable']===_0x23e5('0x69');});return{'count':_0x39f1ab[_0x23e5('0x64')][_0x23e5('0x34')]['length'],'rows':_[_0x23e5('0x29')](_0x39f1ab[_0x23e5('0x64')]['fields'],function(_0x18345e){return{'id':_0x18345e[_0x23e5('0x27')],'name':_0x18345e[_0x23e5('0x6a')],'custom':_[_0x23e5('0x6b')](_0x18345e['name'],'cf_')?!![]:![],'options':_0x18345e[_0x23e5('0x3d')][_0x23e5('0x27')]===_0x23e5('0x6c')&&_0x18345e[_0x23e5('0x3d')][_0x23e5('0x6d')][_0x23e5('0x35')]>0x0?_[_0x23e5('0x29')](_0x18345e[_0x23e5('0x3d')][_0x23e5('0x6d')],function(_0x3df049){return{'name':_0x3df049['label'],'value':_0x3df049[_0x23e5('0x6e')]};}):[]};})};}})['then'](respondWithResult(_0xc1e6c1,null))[_0x23e5('0x44')](function(_0x4dce00){console[_0x23e5('0x6f')](_0x23e5('0x70')+_0x4dce00);var _0x5ca5b9=_0x4ec31e['query'][_0x23e5('0x71')]?0x1f4:_0x4dce00[_0x23e5('0x72')]||0x1f4;logger[_0x23e5('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x23e5('0x55'),_0x5ca5b9,JSON[_0x23e5('0x73')](_0x4dce00));delete _0x4dce00[_0x23e5('0x27')];if(_0x5ca5b9===0x191){_0x5ca5b9=0x190;}_0xc1e6c1[_0x23e5('0x17')](_0x5ca5b9)['send'](_0x4ec31e[_0x23e5('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4dce00[_0x23e5('0x72')]}:_0x4dce00);});}; \ No newline at end of file +var _0x874b=['label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','name','send','map','VtigerAccount','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','rawAttributes','find','create','body','update','findOne','VtigerConfiguration','order','sort','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','token','GET','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false'];(function(_0x29733c,_0x2da30b){var _0x49e72f=function(_0x405c92){while(--_0x405c92){_0x29733c['push'](_0x29733c['shift']());}};_0x49e72f(++_0x2da30b);}(_0x874b,0x185));var _0xb874=function(_0xe64c79,_0x3f1a4a){_0xe64c79=_0xe64c79-0x0;var _0x4d15cf=_0x874b[_0xe64c79];return _0x4d15cf;};'use strict';var emlformat=require(_0xb874('0x0'));var rimraf=require(_0xb874('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb874('0x2'));var BPromise=require(_0xb874('0x3'));var Mustache=require(_0xb874('0x4'));var util=require(_0xb874('0x5'));var path=require(_0xb874('0x6'));var sox=require(_0xb874('0x7'));var csv=require('to-csv');var ejs=require(_0xb874('0x8'));var fs=require('fs');var fs_extra=require(_0xb874('0x9'));var _=require(_0xb874('0xa'));var squel=require(_0xb874('0xb'));var crypto=require(_0xb874('0xc'));var jsforce=require(_0xb874('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb874('0xe'));var Papa=require(_0xb874('0xf'));var Redis=require(_0xb874('0x10'));var authService=require(_0xb874('0x11'));var qs=require(_0xb874('0x12'));var as=require(_0xb874('0x13'));var hardwareService=require(_0xb874('0x14'));var logger=require('../../config/logger')(_0xb874('0x15'));var utils=require('../../config/utils');var config=require(_0xb874('0x16'));var licenseUtil=require(_0xb874('0x17'));var db=require(_0xb874('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x7b0d11,_0x3025e1){_0x3025e1=_0x3025e1||0xcc;return function(_0x422d59){if(_0x422d59){return _0x7b0d11[_0xb874('0x19')](_0x3025e1);}return _0x7b0d11[_0xb874('0x1a')](_0x3025e1)[_0xb874('0x1b')]();};}function respondWithResult(_0x3c5b6e,_0x4348a3){_0x4348a3=_0x4348a3||0xc8;return function(_0x34dce6){if(_0x34dce6){return _0x3c5b6e['status'](_0x4348a3)[_0xb874('0x1c')](_0x34dce6);}};}function respondWithFilteredResult(_0x599ee2,_0x15cd87){return function(_0x197c9b){if(_0x197c9b){var _0x557e18=typeof _0x15cd87['offset']===_0xb874('0x1d')&&typeof _0x15cd87[_0xb874('0x1e')]==='undefined';var _0x59e6cb=_0x197c9b[_0xb874('0x1f')];var _0x5635fa=_0x557e18?0x0:_0x15cd87[_0xb874('0x20')];var _0x351e55=_0x557e18?_0x197c9b[_0xb874('0x1f')]:_0x15cd87['offset']+_0x15cd87[_0xb874('0x1e')];var _0x590f1e;if(_0x351e55>=_0x59e6cb){_0x351e55=_0x59e6cb;_0x590f1e=0xc8;}else{_0x590f1e=0xce;}_0x599ee2[_0xb874('0x1a')](_0x590f1e);return _0x599ee2[_0xb874('0x21')](_0xb874('0x22'),_0x5635fa+'-'+_0x351e55+'/'+_0x59e6cb)['json'](_0x197c9b);}return null;};}function patchUpdates(_0x2dde63){return function(_0x535dee){try{jsonpatch[_0xb874('0x23')](_0x535dee,_0x2dde63,!![]);}catch(_0x3a1370){return BPromise['reject'](_0x3a1370);}return _0x535dee[_0xb874('0x24')]();};}function saveUpdates(_0x13e6ec,_0x59f3d8){return function(_0x22aaaa){if(_0x22aaaa){return _0x22aaaa['update'](_0x13e6ec)['then'](function(_0x454a96){return _0x454a96;});}return null;};}function removeEntity(_0x283bd4,_0x49f9bb){return function(_0x443d3c){if(_0x443d3c){return _0x443d3c[_0xb874('0x25')]()['then'](function(){_0x283bd4[_0xb874('0x1a')](0xcc)[_0xb874('0x1b')]();});}};}function handleEntityNotFound(_0x178bd4,_0x2207bc){return function(_0x2e720c){if(!_0x2e720c){_0x178bd4[_0xb874('0x19')](0x194);}return _0x2e720c;};}function handleError(_0x58a963,_0x2378a8){_0x2378a8=_0x2378a8||0x1f4;return function(_0x5d8d7c){logger['error'](_0x5d8d7c['stack']);if(_0x5d8d7c['name']){delete _0x5d8d7c[_0xb874('0x26')];}_0x58a963[_0xb874('0x1a')](_0x2378a8)[_0xb874('0x27')](_0x5d8d7c);};}exports['index']=function(_0x45ef20,_0x19fd87){var _0x17e74b={},_0x35489e={},_0x381027={'count':0x0,'rows':[]};var _0x426a81=_[_0xb874('0x28')](db[_0xb874('0x29')]['rawAttributes'],function(_0x3c68ae){return{'name':_0x3c68ae['fieldName'],'type':_0x3c68ae[_0xb874('0x2a')][_0xb874('0x2b')]};});_0x35489e[_0xb874('0x2c')]=_['map'](_0x426a81,_0xb874('0x26'));_0x35489e[_0xb874('0x2d')]=_[_0xb874('0x2e')](_0x45ef20[_0xb874('0x2d')]);_0x35489e['filters']=_[_0xb874('0x2f')](_0x35489e['model'],_0x35489e['query']);_0x17e74b[_0xb874('0x30')]=_[_0xb874('0x2f')](_0x35489e[_0xb874('0x2c')],qs[_0xb874('0x31')](_0x45ef20[_0xb874('0x2d')][_0xb874('0x31')]));_0x17e74b['attributes']=_0x17e74b['attributes'][_0xb874('0x32')]?_0x17e74b['attributes']:_0x35489e[_0xb874('0x2c')];if(!_0x45ef20[_0xb874('0x2d')]['hasOwnProperty'](_0xb874('0x33'))){_0x17e74b[_0xb874('0x1e')]=qs['limit'](_0x45ef20['query']['limit']);_0x17e74b['offset']=qs['offset'](_0x45ef20['query'][_0xb874('0x20')]);}_0x17e74b['order']=qs['sort'](_0x45ef20['query']['sort']);_0x17e74b[_0xb874('0x34')]=qs[_0xb874('0x35')](_[_0xb874('0x36')](_0x45ef20[_0xb874('0x2d')],_0x35489e['filters']),_0x426a81);if(_0x45ef20[_0xb874('0x2d')][_0xb874('0x37')]){_0x17e74b[_0xb874('0x34')]=_[_0xb874('0x38')](_0x17e74b[_0xb874('0x34')],{'$or':_[_0xb874('0x28')](_0x426a81,function(_0x55f796){if(_0x55f796[_0xb874('0x2a')]!==_0xb874('0x39')){var _0x14b6ee={};_0x14b6ee[_0x55f796[_0xb874('0x26')]]={'$like':'%'+_0x45ef20[_0xb874('0x2d')]['filter']+'%'};return _0x14b6ee;}})});}_0x17e74b=_[_0xb874('0x38')]({},_0x17e74b,_0x45ef20[_0xb874('0x3a')]);var _0x21309f={'where':_0x17e74b['where']};return db[_0xb874('0x29')]['count'](_0x21309f)['then'](function(_0x41787f){_0x381027[_0xb874('0x1f')]=_0x41787f;if(_0x45ef20['query']['includeAll']){_0x17e74b[_0xb874('0x3b')]=[{'all':!![]}];}return db[_0xb874('0x29')][_0xb874('0x3c')](_0x17e74b);})[_0xb874('0x3d')](function(_0x2f81c1){_0x381027[_0xb874('0x3e')]=_0x2f81c1;return _0x381027;})[_0xb874('0x3d')](respondWithFilteredResult(_0x19fd87,_0x17e74b))[_0xb874('0x3f')](handleError(_0x19fd87,null));};exports[_0xb874('0x40')]=function(_0x3d094d,_0xe93910){var _0x22a500={'raw':![],'where':{'id':_0x3d094d[_0xb874('0x41')]['id']}},_0x57f4b8={};_0x57f4b8[_0xb874('0x2c')]=_[_0xb874('0x2e')](db['VtigerAccount'][_0xb874('0x42')]);_0x57f4b8['query']=_[_0xb874('0x2e')](_0x3d094d[_0xb874('0x2d')]);_0x57f4b8['filters']=_[_0xb874('0x2f')](_0x57f4b8[_0xb874('0x2c')],_0x57f4b8[_0xb874('0x2d')]);_0x22a500['attributes']=_[_0xb874('0x2f')](_0x57f4b8[_0xb874('0x2c')],qs[_0xb874('0x31')](_0x3d094d[_0xb874('0x2d')][_0xb874('0x31')]));_0x22a500[_0xb874('0x30')]=_0x22a500[_0xb874('0x30')][_0xb874('0x32')]?_0x22a500[_0xb874('0x30')]:_0x57f4b8[_0xb874('0x2c')];if(_0x3d094d['query']['includeAll']){_0x22a500[_0xb874('0x3b')]=[{'all':!![]}];}_0x22a500=_['merge']({},_0x22a500,_0x3d094d['options']);return db['VtigerAccount'][_0xb874('0x43')](_0x22a500)[_0xb874('0x3d')](handleEntityNotFound(_0xe93910,null))[_0xb874('0x3d')](respondWithResult(_0xe93910,null))[_0xb874('0x3f')](handleError(_0xe93910,null));};exports[_0xb874('0x44')]=function(_0x251b0c,_0x457aff){return db[_0xb874('0x29')][_0xb874('0x44')](_0x251b0c[_0xb874('0x45')],{})['then'](respondWithResult(_0x457aff,0xc9))[_0xb874('0x3f')](handleError(_0x457aff,null));};exports[_0xb874('0x46')]=function(_0x54a0b8,_0x57a94d){if(_0x54a0b8[_0xb874('0x45')]['id']){delete _0x54a0b8['body']['id'];}return db[_0xb874('0x29')]['find']({'where':{'id':_0x54a0b8[_0xb874('0x41')]['id']}})[_0xb874('0x3d')](handleEntityNotFound(_0x57a94d,null))[_0xb874('0x3d')](saveUpdates(_0x54a0b8[_0xb874('0x45')],null))[_0xb874('0x3d')](respondWithResult(_0x57a94d,null))[_0xb874('0x3f')](handleError(_0x57a94d,null));};exports[_0xb874('0x25')]=function(_0x4f4d26,_0xf333a5){return db[_0xb874('0x29')][_0xb874('0x43')]({'where':{'id':_0x4f4d26['params']['id']}})[_0xb874('0x3d')](handleEntityNotFound(_0xf333a5,null))[_0xb874('0x3d')](removeEntity(_0xf333a5,null))['catch'](handleError(_0xf333a5,null));};exports['getConfigurations']=function(_0x113461,_0x15294c,_0x212505){var _0x1bacd9={};var _0x404981={};var _0xfbcec7;var _0x4dc364;return db[_0xb874('0x29')][_0xb874('0x47')]({'where':{'id':_0x113461['params']['id']}})[_0xb874('0x3d')](handleEntityNotFound(_0x15294c,null))[_0xb874('0x3d')](function(_0x2773e9){if(_0x2773e9){_0xfbcec7=_0x2773e9;_0x404981[_0xb874('0x2c')]=_['keys'](db[_0xb874('0x48')][_0xb874('0x42')]);_0x404981[_0xb874('0x2d')]=_['keys'](_0x113461[_0xb874('0x2d')]);_0x404981['filters']=_[_0xb874('0x2f')](_0x404981[_0xb874('0x2c')],_0x404981[_0xb874('0x2d')]);_0x1bacd9[_0xb874('0x30')]=_[_0xb874('0x2f')](_0x404981[_0xb874('0x2c')],qs['fields'](_0x113461['query'][_0xb874('0x31')]));_0x1bacd9['attributes']=_0x1bacd9[_0xb874('0x30')][_0xb874('0x32')]?_0x1bacd9[_0xb874('0x30')]:_0x404981[_0xb874('0x2c')];_0x1bacd9[_0xb874('0x49')]=qs[_0xb874('0x4a')](_0x113461[_0xb874('0x2d')]['sort']);_0x1bacd9[_0xb874('0x34')]=qs[_0xb874('0x35')](_[_0xb874('0x36')](_0x113461[_0xb874('0x2d')],_0x404981[_0xb874('0x35')]));if(_0x113461[_0xb874('0x2d')][_0xb874('0x37')]){_0x1bacd9['where']=_[_0xb874('0x38')](_0x1bacd9[_0xb874('0x34')],{'$or':_[_0xb874('0x28')](_0x1bacd9[_0xb874('0x30')],function(_0x54fce1){var _0x14c851={};_0x14c851[_0x54fce1]={'$like':'%'+_0x113461['query'][_0xb874('0x37')]+'%'};return _0x14c851;})});}_0x1bacd9=_[_0xb874('0x38')]({},_0x1bacd9,_0x113461[_0xb874('0x3a')]);return _0xfbcec7['getConfigurations'](_0x1bacd9);}})[_0xb874('0x3d')](function(_0x11330d){if(_0x11330d){_0x4dc364=_0x11330d[_0xb874('0x32')];if(!_0x113461['query'][_0xb874('0x4b')]('nolimit')){_0x1bacd9[_0xb874('0x1e')]=qs['limit'](_0x113461[_0xb874('0x2d')]['limit']);_0x1bacd9[_0xb874('0x20')]=qs[_0xb874('0x20')](_0x113461[_0xb874('0x2d')][_0xb874('0x20')]);}return _0xfbcec7['getConfigurations'](_0x1bacd9);}})[_0xb874('0x3d')](function(_0x1a2ebb){if(_0x1a2ebb){return _0x1a2ebb?{'count':_0x4dc364,'rows':_0x1a2ebb}:null;}})[_0xb874('0x3d')](respondWithResult(_0x15294c,null))[_0xb874('0x3f')](handleError(_0x15294c,null));};exports[_0xb874('0x4c')]=function(_0x3bb793,_0x1a5f7f,_0x2f7680){if(_0x3bb793[_0xb874('0x45')]['id']){delete _0x3bb793[_0xb874('0x45')]['id'];}return db[_0xb874('0x29')][_0xb874('0x47')]({'where':{'id':_0x3bb793[_0xb874('0x41')]['id']}})[_0xb874('0x3d')](handleEntityNotFound(_0x1a5f7f,null))[_0xb874('0x3d')](function(_0x1631ff){if(_0x1631ff){_0x3bb793[_0xb874('0x45')][_0xb874('0x4d')]=_0x1631ff['id'];_0x3bb793['body'][_0xb874('0x4e')]=integrations[_0xb874('0x4f')](_0x3bb793[_0xb874('0x45')][_0xb874('0x50')],_0x3bb793[_0xb874('0x45')][_0xb874('0x2a')]);_0x3bb793[_0xb874('0x45')][_0xb874('0x51')]=integrations[_0xb874('0x52')](_0x3bb793[_0xb874('0x45')][_0xb874('0x50')],_0x3bb793[_0xb874('0x45')][_0xb874('0x2a')]);return db[_0xb874('0x48')][_0xb874('0x44')](_0x3bb793[_0xb874('0x45')],{'include':[{'model':db['VtigerField'],'as':_0xb874('0x4e')},{'model':db['VtigerField'],'as':_0xb874('0x51')}]});}return null;})[_0xb874('0x3d')](respondWithResult(_0x1a5f7f,null))[_0xb874('0x3f')](handleError(_0x1a5f7f,null));};var md5=require('md5');exports[_0xb874('0x53')]=function(_0x557c7d,_0xebd78a,_0x279ee8){var _0x3e5290=null;var _0x4de7dd=null;var _0x50e205=null;var _0x22b9b9=null;var _0x3ac06e='';return db[_0xb874('0x29')]['findOne']({'where':{'id':_0x557c7d[_0xb874('0x41')]['id']},'attributes':['id',_0xb874('0x26'),_0xb874('0x54'),_0xb874('0x55'),_0xb874('0x56'),_0xb874('0x57'),_0xb874('0x58'),'accessKey']})[_0xb874('0x3d')](handleEntityNotFound(_0xebd78a,null))[_0xb874('0x3d')](function(_0x4bb119){if(_0x4bb119){_0x3e5290=_0x4bb119[_0xb874('0x54')];_0x4de7dd=_0x4bb119[_0xb874('0x59')];_0x50e205=_0x4bb119[_0xb874('0x56')];_0x3ac06e=_0x4bb119['remoteUri'];var _0x3706f9=_0x3ac06e[_0xb874('0x5a')](-0x1);if(_0x3706f9==='/'){_0x3ac06e=_0x3ac06e[_0xb874('0x5b')](0x0,_0x3ac06e[_0xb874('0x5c')](_0x3706f9));}_0x22b9b9=util[_0xb874('0x5d')](_0xb874('0x5e'),_0x3ac06e);var _0x3b0629={'method':'GET','uri':_0x22b9b9,'qs':{'operation':_0xb874('0x5f'),'username':_0x4bb119[_0xb874('0x54')]},'json':!![]};return rp(_0x3b0629);}})[_0xb874('0x3d')](function(_0x2802df){if(_0x2802df[_0xb874('0x60')]){var _0x34801f={'method':_0xb874('0x61'),'uri':_0x22b9b9,'form':{'operation':_0xb874('0x62'),'username':_0x3e5290,'accessKey':md5(_0x2802df[_0xb874('0x63')][_0xb874('0x64')]+_0x4de7dd)},'json':!![]};return rp(_0x34801f);}})['then'](function(_0x3939cd){if(_0x3939cd['success']){var _0x5cd7b9={'method':_0xb874('0x65'),'uri':_0x22b9b9,'qs':{'operation':_0xb874('0x66'),'username':_0x3e5290,'sessionName':_0x3939cd[_0xb874('0x63')][_0xb874('0x67')],'elementType':_0x50e205},'json':!![]};return rp(_0x5cd7b9);}})[_0xb874('0x3d')](function(_0x169dc8){if(_0x169dc8[_0xb874('0x60')]){var _0x5df1e6=[_0xb874('0x68'),_0xb874('0x69'),_0xb874('0x6a')];_[_0xb874('0x6b')](_0x169dc8[_0xb874('0x63')][_0xb874('0x31')],function(_0x2dd025){return _0x5df1e6[_0xb874('0x6c')](_0x2dd025['type'][_0xb874('0x26')]);});_[_0xb874('0x6b')](_0x169dc8[_0xb874('0x63')]['fields'],function(_0x492263){return _0x492263[_0xb874('0x6d')]===_0xb874('0x6e');});return{'count':_0x169dc8[_0xb874('0x63')]['fields']['length'],'rows':_[_0xb874('0x28')](_0x169dc8[_0xb874('0x63')][_0xb874('0x31')],function(_0x203cbc){return{'id':_0x203cbc[_0xb874('0x26')],'name':_0x203cbc[_0xb874('0x6f')],'custom':_[_0xb874('0x70')](_0x203cbc[_0xb874('0x26')],_0xb874('0x71'))?!![]:![],'options':_0x203cbc[_0xb874('0x2a')][_0xb874('0x26')]===_0xb874('0x72')&&_0x203cbc[_0xb874('0x2a')][_0xb874('0x73')]['length']>0x0?_[_0xb874('0x28')](_0x203cbc[_0xb874('0x2a')]['picklistValues'],function(_0x983c39){return{'name':_0x983c39[_0xb874('0x6f')],'value':_0x983c39[_0xb874('0x74')]};}):[]};})};}})['then'](respondWithResult(_0xebd78a,null))[_0xb874('0x3f')](function(_0x1f015b){console[_0xb874('0x75')](_0xb874('0x76')+_0x1f015b);var _0x1ce3cc=_0x557c7d[_0xb874('0x2d')][_0xb874('0x77')]?0x1f4:_0x1f015b[_0xb874('0x78')]||0x1f4;logger[_0xb874('0x79')](_0xb874('0x7a'),_0xb874('0x53'),_0x1ce3cc,JSON[_0xb874('0x7b')](_0x1f015b));delete _0x1f015b['name'];if(_0x1ce3cc===0x191){_0x1ce3cc=0x190;}_0xebd78a[_0xb874('0x1a')](_0x1ce3cc)['send'](_0x557c7d[_0xb874('0x2d')][_0xb874('0x77')]?{'message':_0xb874('0x7c'),'statusCode':_0x1f015b[_0xb874('0x78')]}:_0x1f015b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 85dd786..3f56f1d 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 _0x026c=['../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f8a86,_0x577523){var _0x588de8=function(_0x19cfc7){while(--_0x19cfc7){_0x2f8a86['push'](_0x2f8a86['shift']());}};_0x588de8(++_0x577523);}(_0x026c,0x70));var _0xc026=function(_0x2dce9f,_0x1d1880){_0x2dce9f=_0x2dce9f-0x0;var _0x1cd454=_0x026c[_0x2dce9f];return _0x1cd454;};'use strict';var _=require(_0xc026('0x0'));var util=require(_0xc026('0x1'));var logger=require(_0xc026('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc026('0x3'));var rp=require(_0xc026('0x4'));var fs=require('fs');var path=require(_0xc026('0x5'));var rimraf=require(_0xc026('0x6'));var config=require(_0xc026('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xc026('0x8'));module[_0xc026('0x9')]=function(_0x5e38d0,_0x1a140b){return _0x5e38d0[_0xc026('0xa')](_0xc026('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7268=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7268,0x1d4));var _0x8726=function(_0x529a29,_0x55c8a5){_0x529a29=_0x529a29-0x0;var _0x5ba288=_0x7268[_0x529a29];return _0x5ba288;};'use strict';var _=require(_0x8726('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8726('0x1'));var moment=require(_0x8726('0x2'));var BPromise=require(_0x8726('0x3'));var rp=require(_0x8726('0x4'));var fs=require('fs');var path=require(_0x8726('0x5'));var rimraf=require(_0x8726('0x6'));var config=require(_0x8726('0x7'));var attributes=require(_0x8726('0x8'));var integrations=require(_0x8726('0x9'));module[_0x8726('0xa')]=function(_0x282feb,_0x5c127d){return _0x282feb[_0x8726('0xb')](_0x8726('0xc'),attributes,{'tableName':_0x8726('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 faab27c..fdab3bc 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 _0x13f6=['debug','stringify','error','code','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','limit','include','map','model','attributes','ShowVtigerAccount','find','raw','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5826da,_0x4ffb7f){var _0x127236=function(_0x5c2f74){while(--_0x5c2f74){_0x5826da['push'](_0x5826da['shift']());}};_0x127236(++_0x4ffb7f);}(_0x13f6,0x124));var _0x613f=function(_0x2ba34b,_0xd4bbf3){_0x2ba34b=_0x2ba34b-0x0;var _0x2e807e=_0x13f6[_0x2ba34b];return _0x2e807e;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});}exports[_0x613f('0x15')]=function(_0x4f9dae){var _0x62ebfe=this;return new Promise(function(_0x1e5a11,_0x431266){return db[_0x613f('0x16')][_0x613f('0x17')]({'raw':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae['options']['where']||null:null,'attributes':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae[_0x613f('0x18')]['attributes']||null:null,'limit':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae[_0x613f('0x18')][_0x613f('0x19')]||null:null,'include':_0x4f9dae['options']?_0x4f9dae['options'][_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x4f9dae[_0x613f('0x18')]['include'],function(_0x41104e){return{'model':db[_0x41104e[_0x613f('0x1c')]],'as':_0x41104e['as'],'attributes':_0x41104e[_0x613f('0x1d')],'include':_0x41104e[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x41104e['include'],function(_0x30fb15){return{'model':db[_0x30fb15[_0x613f('0x1c')]],'as':_0x30fb15['as'],'attributes':_0x30fb15['attributes'],'include':_0x30fb15[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x30fb15[_0x613f('0x1a')],function(_0x4a878d){return{'model':db[_0x4a878d['model']],'as':_0x4a878d['as'],'attributes':_0x4a878d['attributes']};}):[]};}):[]};}):[]:[]})[_0x613f('0xb')](function(_0x594c28){logger[_0x613f('0x13')](_0x613f('0x15'),_0x4f9dae);logger['debug'](_0x613f('0x15'),_0x4f9dae,JSON[_0x613f('0xf')](_0x594c28));_0x1e5a11(_0x594c28);})['catch'](function(_0x4cff5d){logger['error'](_0x613f('0x15'),_0x4cff5d[_0x613f('0x12')],_0x4f9dae);_0x431266(_0x62ebfe[_0x613f('0x10')](0x1f4,_0x4cff5d['message']));});});};exports[_0x613f('0x1e')]=function(_0x439478){var _0xd335a6=this;return new Promise(function(_0x19bb8f,_0x4f8500){return db[_0x613f('0x16')][_0x613f('0x1f')]({'raw':_0x439478[_0x613f('0x18')]?_0x439478[_0x613f('0x18')][_0x613f('0x20')]===undefined?!![]:![]:!![],'where':_0x439478[_0x613f('0x18')]?_0x439478['options'][_0x613f('0x21')]||null:null,'attributes':_0x439478[_0x613f('0x18')]?_0x439478[_0x613f('0x18')]['attributes']||null:null,'include':_0x439478[_0x613f('0x18')]?_0x439478['options'][_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x439478[_0x613f('0x18')][_0x613f('0x1a')],function(_0x2bceaa){return{'model':db[_0x2bceaa[_0x613f('0x1c')]],'as':_0x2bceaa['as'],'attributes':_0x2bceaa['attributes'],'include':_0x2bceaa[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x2bceaa[_0x613f('0x1a')],function(_0x25b2e4){return{'model':db[_0x25b2e4[_0x613f('0x1c')]],'as':_0x25b2e4['as'],'attributes':_0x25b2e4['attributes'],'include':_0x25b2e4['include']?_['map'](_0x25b2e4[_0x613f('0x1a')],function(_0x72c804){return{'model':db[_0x72c804[_0x613f('0x1c')]],'as':_0x72c804['as'],'attributes':_0x72c804[_0x613f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fc02e){logger[_0x613f('0x13')]('ShowVtigerAccount',_0x439478);logger[_0x613f('0xe')]('ShowVtigerAccount',_0x439478,JSON[_0x613f('0xf')](_0x2fc02e));_0x19bb8f(_0x2fc02e);})['catch'](function(_0x36dfd4){logger['error'](_0x613f('0x1e'),_0x36dfd4[_0x613f('0x12')],_0x439478);_0x4f8500(_0xd335a6[_0x613f('0x10')](0x1f4,_0x36dfd4['message']));});});}; \ No newline at end of file +var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowVtigerAccount','VtigerAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','findAll'];(function(_0xb007e7,_0x229847){var _0x22de13=function(_0x25487c){while(--_0x25487c){_0xb007e7['push'](_0xb007e7['shift']());}};_0x22de13(++_0x229847);}(_0xe706,0xa3));var _0x6e70=function(_0x28fe94,_0x120b9b){_0x28fe94=_0x28fe94-0x0;var _0x3560da=_0xe706[_0x28fe94];return _0x3560da;};'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']('VtigerAccount,\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']('VtigerAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['VtigerAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetVtigerAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 5418630..7ef9142 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 _0xbc0d=['../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x47717f,_0x7b777f){var _0x37a524=function(_0x356c94){while(--_0x356c94){_0x47717f['push'](_0x47717f['shift']());}};_0x37a524(++_0x7b777f);}(_0xbc0d,0x1c9));var _0xdbc0=function(_0x1d5ba8,_0x412a52){_0x1d5ba8=_0x1d5ba8-0x0;var _0x1022a2=_0xbc0d[_0x1d5ba8];return _0x1022a2;};'use strict';var multer=require(_0xdbc0('0x0'));var util=require(_0xdbc0('0x1'));var path=require('path');var timeout=require(_0xdbc0('0x2'));var express=require('express');var router=express[_0xdbc0('0x3')]();var fs_extra=require(_0xdbc0('0x4'));var auth=require(_0xdbc0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdbc0('0x6'));var controller=require(_0xdbc0('0x7'));router[_0xdbc0('0x8')]('/',auth[_0xdbc0('0x9')](),controller[_0xdbc0('0xa')]);router['get'](_0xdbc0('0xb'),auth[_0xdbc0('0x9')](),controller['show']);router[_0xdbc0('0x8')](_0xdbc0('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xdbc0('0x8')](_0xdbc0('0xd'),auth['isAuthenticated'](),controller[_0xdbc0('0xe')]);router['get'](_0xdbc0('0xf'),auth[_0xdbc0('0x9')](),controller[_0xdbc0('0x10')]);router[_0xdbc0('0x11')]('/',auth[_0xdbc0('0x9')](),controller[_0xdbc0('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdbc0('0x13')](_0xdbc0('0xb'),auth[_0xdbc0('0x9')](),controller[_0xdbc0('0x14')]);module[_0xdbc0('0x15')]=router; \ No newline at end of file +var _0x1022=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','getSubjects','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x8bddc7,_0xd736ef){var _0x415028=function(_0x130a33){while(--_0x130a33){_0x8bddc7['push'](_0x8bddc7['shift']());}};_0x415028(++_0xd736ef);}(_0x1022,0x6a));var _0x2102=function(_0x132aed,_0x2eaf18){_0x132aed=_0x132aed-0x0;var _0x5ece16=_0x1022[_0x132aed];return _0x5ece16;};'use strict';var multer=require(_0x2102('0x0'));var util=require('util');var path=require(_0x2102('0x1'));var timeout=require(_0x2102('0x2'));var express=require(_0x2102('0x3'));var router=express['Router']();var fs_extra=require(_0x2102('0x4'));var auth=require(_0x2102('0x5'));var interaction=require(_0x2102('0x6'));var config=require(_0x2102('0x7'));var controller=require(_0x2102('0x8'));router[_0x2102('0x9')]('/',auth[_0x2102('0xa')](),controller[_0x2102('0xb')]);router[_0x2102('0x9')]('/:id',auth[_0x2102('0xa')](),controller['show']);router[_0x2102('0x9')](_0x2102('0xc'),auth[_0x2102('0xa')](),controller[_0x2102('0xd')]);router[_0x2102('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x2102('0xe')]);router['get']('/:id/descriptions',auth[_0x2102('0xa')](),controller['getDescriptions']);router[_0x2102('0xf')]('/',auth[_0x2102('0xa')](),controller['create']);router[_0x2102('0x10')](_0x2102('0x11'),auth[_0x2102('0xa')](),controller[_0x2102('0x12')]);router[_0x2102('0x13')](_0x2102('0x11'),auth[_0x2102('0xa')](),controller[_0x2102('0x14')]);module[_0x2102('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index de77b62..4ad4790 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 _0x61cc=['exports','STRING','sequelize'];(function(_0x36fc68,_0x27e7b4){var _0x2e718a=function(_0x3eaa08){while(--_0x3eaa08){_0x36fc68['push'](_0x36fc68['shift']());}};_0x2e718a(++_0x27e7b4);}(_0x61cc,0x1dc));var _0xc61c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x61cc[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xc61c('0x0'));module[_0xc61c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc61c('0x2')]}}; \ No newline at end of file +var _0x412e=['STRING','sequelize','exports'];(function(_0x1b2a94,_0x3715d8){var _0x44d47d=function(_0x4aefe2){while(--_0x4aefe2){_0x1b2a94['push'](_0x1b2a94['shift']());}};_0x44d47d(++_0x3715d8);}(_0x412e,0x67));var _0xe412=function(_0x470b4d,_0x5b797d){_0x470b4d=_0x470b4d-0x0;var _0xa6664e=_0x412e[_0x470b4d];return _0xa6664e;};'use strict';var Sequelize=require(_0xe412('0x0'));module[_0xe412('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe412('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d9fdb4e..0b53e34 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 _0xba47=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','reject','then','destroy','sendStatus','name','send','index','map','VtigerConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','params','rawAttributes','create','update','body','find','getFields','VtigerField','length','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2bd2a2,_0x556fd2){var _0x3c9069=function(_0x35e520){while(--_0x35e520){_0x2bd2a2['push'](_0x2bd2a2['shift']());}};_0x3c9069(++_0x556fd2);}(_0xba47,0x1ac));var _0x7ba4=function(_0x1475ba,_0x555aae){_0x1475ba=_0x1475ba-0x0;var _0x4efcf7=_0xba47[_0x1475ba];return _0x4efcf7;};'use strict';var emlformat=require(_0x7ba4('0x0'));var rimraf=require(_0x7ba4('0x1'));var zipdir=require(_0x7ba4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ba4('0x3'));var moment=require(_0x7ba4('0x4'));var BPromise=require(_0x7ba4('0x5'));var Mustache=require(_0x7ba4('0x6'));var util=require('util');var path=require(_0x7ba4('0x7'));var sox=require(_0x7ba4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ba4('0x9'));var _=require(_0x7ba4('0xa'));var squel=require(_0x7ba4('0xb'));var crypto=require(_0x7ba4('0xc'));var jsforce=require(_0x7ba4('0xd'));var deskjs=require(_0x7ba4('0xe'));var toCsv=require(_0x7ba4('0xf'));var querystring=require(_0x7ba4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7ba4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7ba4('0x12'));var hardwareService=require(_0x7ba4('0x13'));var logger=require(_0x7ba4('0x14'))(_0x7ba4('0x15'));var utils=require('../../config/utils');var config=require(_0x7ba4('0x16'));var licenseUtil=require(_0x7ba4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x83d2c,_0x266be2){_0x266be2=_0x266be2||0xcc;return function(_0x2fdee0){if(_0x2fdee0){return _0x83d2c['sendStatus'](_0x266be2);}return _0x83d2c[_0x7ba4('0x18')](_0x266be2)[_0x7ba4('0x19')]();};}function respondWithResult(_0x26da9d,_0x471e93){_0x471e93=_0x471e93||0xc8;return function(_0xcf45f6){if(_0xcf45f6){return _0x26da9d[_0x7ba4('0x18')](_0x471e93)[_0x7ba4('0x1a')](_0xcf45f6);}};}function respondWithFilteredResult(_0x1e16c5,_0x3197d9){return function(_0x480e0b){if(_0x480e0b){var _0x4b0fb7=typeof _0x3197d9[_0x7ba4('0x1b')]===_0x7ba4('0x1c')&&typeof _0x3197d9['limit']===_0x7ba4('0x1c');var _0xbc6330=_0x480e0b[_0x7ba4('0x1d')];var _0xd5bdde=_0x4b0fb7?0x0:_0x3197d9[_0x7ba4('0x1b')];var _0x988f2f=_0x4b0fb7?_0x480e0b[_0x7ba4('0x1d')]:_0x3197d9[_0x7ba4('0x1b')]+_0x3197d9['limit'];var _0x5d14ba;if(_0x988f2f>=_0xbc6330){_0x988f2f=_0xbc6330;_0x5d14ba=0xc8;}else{_0x5d14ba=0xce;}_0x1e16c5[_0x7ba4('0x18')](_0x5d14ba);return _0x1e16c5[_0x7ba4('0x1e')]('Content-Range',_0xd5bdde+'-'+_0x988f2f+'/'+_0xbc6330)[_0x7ba4('0x1a')](_0x480e0b);}return null;};}function patchUpdates(_0x14a214){return function(_0x3601ba){try{jsonpatch['apply'](_0x3601ba,_0x14a214,!![]);}catch(_0x5b1dde){return BPromise[_0x7ba4('0x1f')](_0x5b1dde);}return _0x3601ba['save']();};}function saveUpdates(_0x4bd364,_0x225b6a){return function(_0x4dffd7){if(_0x4dffd7){return _0x4dffd7['update'](_0x4bd364)[_0x7ba4('0x20')](function(_0x246943){return _0x246943;});}return null;};}function removeEntity(_0x3a3c67,_0x413a67){return function(_0x2afc11){if(_0x2afc11){return _0x2afc11[_0x7ba4('0x21')]()[_0x7ba4('0x20')](function(){_0x3a3c67['status'](0xcc)[_0x7ba4('0x19')]();});}};}function handleEntityNotFound(_0x34ee62,_0x10508e){return function(_0x3c679c){if(!_0x3c679c){_0x34ee62[_0x7ba4('0x22')](0x194);}return _0x3c679c;};}function handleError(_0x28c51c,_0x4f0ce5){_0x4f0ce5=_0x4f0ce5||0x1f4;return function(_0x901837){logger['error'](_0x901837['stack']);if(_0x901837['name']){delete _0x901837[_0x7ba4('0x23')];}_0x28c51c[_0x7ba4('0x18')](_0x4f0ce5)[_0x7ba4('0x24')](_0x901837);};}exports[_0x7ba4('0x25')]=function(_0x37d8cd,_0x494754){var _0x315cdb={},_0x45be5c={},_0xfb47a5={'count':0x0,'rows':[]};var _0x40a6fb=_[_0x7ba4('0x26')](db[_0x7ba4('0x27')]['rawAttributes'],function(_0x4fdbc7){return{'name':_0x4fdbc7[_0x7ba4('0x28')],'type':_0x4fdbc7[_0x7ba4('0x29')][_0x7ba4('0x2a')]};});_0x45be5c[_0x7ba4('0x2b')]=_[_0x7ba4('0x26')](_0x40a6fb,_0x7ba4('0x23'));_0x45be5c[_0x7ba4('0x2c')]=_[_0x7ba4('0x2d')](_0x37d8cd[_0x7ba4('0x2c')]);_0x45be5c[_0x7ba4('0x2e')]=_['intersection'](_0x45be5c[_0x7ba4('0x2b')],_0x45be5c[_0x7ba4('0x2c')]);_0x315cdb['attributes']=_[_0x7ba4('0x2f')](_0x45be5c[_0x7ba4('0x2b')],qs['fields'](_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x30')]));_0x315cdb['attributes']=_0x315cdb[_0x7ba4('0x31')]['length']?_0x315cdb['attributes']:_0x45be5c[_0x7ba4('0x2b')];if(!_0x37d8cd['query'][_0x7ba4('0x32')](_0x7ba4('0x33'))){_0x315cdb[_0x7ba4('0x34')]=qs[_0x7ba4('0x34')](_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x34')]);_0x315cdb['offset']=qs[_0x7ba4('0x1b')](_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x1b')]);}_0x315cdb[_0x7ba4('0x35')]=qs['sort'](_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x36')]);_0x315cdb[_0x7ba4('0x37')]=qs[_0x7ba4('0x2e')](_[_0x7ba4('0x38')](_0x37d8cd['query'],_0x45be5c[_0x7ba4('0x2e')]),_0x40a6fb);if(_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x39')]){_0x315cdb['where']=_[_0x7ba4('0x3a')](_0x315cdb[_0x7ba4('0x37')],{'$or':_[_0x7ba4('0x26')](_0x40a6fb,function(_0x498520){if(_0x498520[_0x7ba4('0x29')]!=='VIRTUAL'){var _0x21c7f8={};_0x21c7f8[_0x498520['name']]={'$like':'%'+_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x39')]+'%'};return _0x21c7f8;}})});}_0x315cdb=_[_0x7ba4('0x3a')]({},_0x315cdb,_0x37d8cd[_0x7ba4('0x3b')]);var _0x2307ef={'where':_0x315cdb[_0x7ba4('0x37')]};return db[_0x7ba4('0x27')][_0x7ba4('0x1d')](_0x2307ef)[_0x7ba4('0x20')](function(_0x234182){_0xfb47a5['count']=_0x234182;if(_0x37d8cd['query']['includeAll']){_0x315cdb[_0x7ba4('0x3c')]=[{'all':!![]}];}return db[_0x7ba4('0x27')]['findAll'](_0x315cdb);})[_0x7ba4('0x20')](function(_0x3daf6f){_0xfb47a5[_0x7ba4('0x3d')]=_0x3daf6f;return _0xfb47a5;})['then'](respondWithFilteredResult(_0x494754,_0x315cdb))[_0x7ba4('0x3e')](handleError(_0x494754,null));};exports['show']=function(_0x21338c,_0x242b7e){var _0x306e4e={'raw':![],'where':{'id':_0x21338c[_0x7ba4('0x3f')]['id']}},_0x35b21a={};_0x35b21a['model']=_['keys'](db[_0x7ba4('0x27')][_0x7ba4('0x40')]);_0x35b21a[_0x7ba4('0x2c')]=_['keys'](_0x21338c[_0x7ba4('0x2c')]);_0x35b21a['filters']=_[_0x7ba4('0x2f')](_0x35b21a[_0x7ba4('0x2b')],_0x35b21a['query']);_0x306e4e[_0x7ba4('0x31')]=_[_0x7ba4('0x2f')](_0x35b21a[_0x7ba4('0x2b')],qs[_0x7ba4('0x30')](_0x21338c[_0x7ba4('0x2c')][_0x7ba4('0x30')]));_0x306e4e[_0x7ba4('0x31')]=_0x306e4e[_0x7ba4('0x31')]['length']?_0x306e4e[_0x7ba4('0x31')]:_0x35b21a[_0x7ba4('0x2b')];if(_0x21338c[_0x7ba4('0x2c')]['includeAll']){_0x306e4e[_0x7ba4('0x3c')]=[{'all':!![]}];}_0x306e4e=_['merge']({},_0x306e4e,_0x21338c[_0x7ba4('0x3b')]);return db[_0x7ba4('0x27')]['find'](_0x306e4e)[_0x7ba4('0x20')](handleEntityNotFound(_0x242b7e,null))[_0x7ba4('0x20')](respondWithResult(_0x242b7e,null))[_0x7ba4('0x3e')](handleError(_0x242b7e,null));};exports['create']=function(_0x2ce0c0,_0x3000cf){return db['VtigerConfiguration'][_0x7ba4('0x41')](_0x2ce0c0['body'],{})[_0x7ba4('0x20')](respondWithResult(_0x3000cf,0xc9))[_0x7ba4('0x3e')](handleError(_0x3000cf,null));};exports[_0x7ba4('0x42')]=function(_0x4e62d6,_0x448cb5){if(_0x4e62d6[_0x7ba4('0x43')]['id']){delete _0x4e62d6[_0x7ba4('0x43')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x4e62d6[_0x7ba4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x448cb5,null))[_0x7ba4('0x20')](saveUpdates(_0x4e62d6['body'],null))[_0x7ba4('0x20')](respondWithResult(_0x448cb5,null))['catch'](handleError(_0x448cb5,null));};exports[_0x7ba4('0x21')]=function(_0x7044cc,_0x4946ae){return db[_0x7ba4('0x27')][_0x7ba4('0x44')]({'where':{'id':_0x7044cc[_0x7ba4('0x3f')]['id']}})[_0x7ba4('0x20')](handleEntityNotFound(_0x4946ae,null))[_0x7ba4('0x20')](removeEntity(_0x4946ae,null))['catch'](handleError(_0x4946ae,null));};exports[_0x7ba4('0x45')]=function(_0x1dfa4b,_0xd6d1da,_0xed34b2){var _0x5645f3={};var _0x104690={};var _0x26a000;var _0x18609d;return db[_0x7ba4('0x27')]['findOne']({'where':{'id':_0x1dfa4b[_0x7ba4('0x3f')]['id']}})[_0x7ba4('0x20')](handleEntityNotFound(_0xd6d1da,null))[_0x7ba4('0x20')](function(_0x3ffc1d){if(_0x3ffc1d){_0x26a000=_0x3ffc1d;_0x104690[_0x7ba4('0x2b')]=_[_0x7ba4('0x2d')](db[_0x7ba4('0x46')]['rawAttributes']);_0x104690['query']=_[_0x7ba4('0x2d')](_0x1dfa4b[_0x7ba4('0x2c')]);_0x104690[_0x7ba4('0x2e')]=_[_0x7ba4('0x2f')](_0x104690[_0x7ba4('0x2b')],_0x104690['query']);_0x5645f3['attributes']=_['intersection'](_0x104690['model'],qs[_0x7ba4('0x30')](_0x1dfa4b[_0x7ba4('0x2c')][_0x7ba4('0x30')]));_0x5645f3['attributes']=_0x5645f3[_0x7ba4('0x31')]['length']?_0x5645f3[_0x7ba4('0x31')]:_0x104690[_0x7ba4('0x2b')];_0x5645f3[_0x7ba4('0x35')]=qs[_0x7ba4('0x36')](_0x1dfa4b[_0x7ba4('0x2c')][_0x7ba4('0x36')]);_0x5645f3[_0x7ba4('0x37')]=qs[_0x7ba4('0x2e')](_[_0x7ba4('0x38')](_0x1dfa4b[_0x7ba4('0x2c')],_0x104690['filters']));if(_0x1dfa4b[_0x7ba4('0x2c')]['filter']){_0x5645f3['where']=_[_0x7ba4('0x3a')](_0x5645f3['where'],{'$or':_[_0x7ba4('0x26')](_0x5645f3[_0x7ba4('0x31')],function(_0x347cec){var _0x1a0436={};_0x1a0436[_0x347cec]={'$like':'%'+_0x1dfa4b[_0x7ba4('0x2c')][_0x7ba4('0x39')]+'%'};return _0x1a0436;})});}_0x5645f3=_[_0x7ba4('0x3a')]({},_0x5645f3,_0x1dfa4b[_0x7ba4('0x3b')]);return _0x26a000['getFields'](_0x5645f3);}})['then'](function(_0x10f248){if(_0x10f248){_0x18609d=_0x10f248[_0x7ba4('0x47')];if(!_0x1dfa4b[_0x7ba4('0x2c')]['hasOwnProperty'](_0x7ba4('0x33'))){_0x5645f3[_0x7ba4('0x34')]=qs[_0x7ba4('0x34')](_0x1dfa4b[_0x7ba4('0x2c')]['limit']);_0x5645f3['offset']=qs[_0x7ba4('0x1b')](_0x1dfa4b[_0x7ba4('0x2c')]['offset']);}return _0x26a000[_0x7ba4('0x45')](_0x5645f3);}})['then'](function(_0x3f5a1c){if(_0x3f5a1c){return _0x3f5a1c?{'count':_0x18609d,'rows':_0x3f5a1c}:null;}})[_0x7ba4('0x20')](respondWithResult(_0xd6d1da,null))[_0x7ba4('0x3e')](handleError(_0xd6d1da,null));};exports[_0x7ba4('0x48')]=function(_0x197137,_0x281511,_0x480cb4){var _0x5c0c62={};var _0x556ac5={};var _0x1f1c6e;var _0x1d0ad6;return db[_0x7ba4('0x27')][_0x7ba4('0x49')]({'where':{'id':_0x197137['params']['id']}})[_0x7ba4('0x20')](handleEntityNotFound(_0x281511,null))['then'](function(_0x3bf8c0){if(_0x3bf8c0){_0x1f1c6e=_0x3bf8c0;_0x556ac5['model']=_[_0x7ba4('0x2d')](db[_0x7ba4('0x46')]['rawAttributes']);_0x556ac5[_0x7ba4('0x2c')]=_[_0x7ba4('0x2d')](_0x197137[_0x7ba4('0x2c')]);_0x556ac5['filters']=_[_0x7ba4('0x2f')](_0x556ac5[_0x7ba4('0x2b')],_0x556ac5['query']);_0x5c0c62[_0x7ba4('0x31')]=_['intersection'](_0x556ac5[_0x7ba4('0x2b')],qs[_0x7ba4('0x30')](_0x197137[_0x7ba4('0x2c')][_0x7ba4('0x30')]));_0x5c0c62[_0x7ba4('0x31')]=_0x5c0c62[_0x7ba4('0x31')][_0x7ba4('0x47')]?_0x5c0c62[_0x7ba4('0x31')]:_0x556ac5[_0x7ba4('0x2b')];_0x5c0c62[_0x7ba4('0x35')]=qs['sort'](_0x197137[_0x7ba4('0x2c')]['sort']);_0x5c0c62[_0x7ba4('0x37')]=qs[_0x7ba4('0x2e')](_['pick'](_0x197137[_0x7ba4('0x2c')],_0x556ac5[_0x7ba4('0x2e')]));if(_0x197137[_0x7ba4('0x2c')][_0x7ba4('0x39')]){_0x5c0c62[_0x7ba4('0x37')]=_[_0x7ba4('0x3a')](_0x5c0c62['where'],{'$or':_['map'](_0x5c0c62[_0x7ba4('0x31')],function(_0x4c6569){var _0x5e88cd={};_0x5e88cd[_0x4c6569]={'$like':'%'+_0x197137['query']['filter']+'%'};return _0x5e88cd;})});}_0x5c0c62=_[_0x7ba4('0x3a')]({},_0x5c0c62,_0x197137[_0x7ba4('0x3b')]);return _0x1f1c6e[_0x7ba4('0x48')](_0x5c0c62);}})[_0x7ba4('0x20')](function(_0x149ec7){if(_0x149ec7){_0x1d0ad6=_0x149ec7[_0x7ba4('0x47')];if(!_0x197137[_0x7ba4('0x2c')][_0x7ba4('0x32')](_0x7ba4('0x33'))){_0x5c0c62[_0x7ba4('0x34')]=qs['limit'](_0x197137[_0x7ba4('0x2c')][_0x7ba4('0x34')]);_0x5c0c62[_0x7ba4('0x1b')]=qs[_0x7ba4('0x1b')](_0x197137['query']['offset']);}return _0x1f1c6e[_0x7ba4('0x48')](_0x5c0c62);}})[_0x7ba4('0x20')](function(_0x2bd5a8){if(_0x2bd5a8){return _0x2bd5a8?{'count':_0x1d0ad6,'rows':_0x2bd5a8}:null;}})[_0x7ba4('0x20')](respondWithResult(_0x281511,null))[_0x7ba4('0x3e')](handleError(_0x281511,null));};exports['getDescriptions']=function(_0x35404d,_0x54b139,_0x1ce2a1){var _0x56dca0={};var _0x48b87d={};var _0x23fe4b;var _0x436de8;return db[_0x7ba4('0x27')]['findOne']({'where':{'id':_0x35404d[_0x7ba4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x54b139,null))[_0x7ba4('0x20')](function(_0x1a36b5){if(_0x1a36b5){_0x23fe4b=_0x1a36b5;_0x48b87d[_0x7ba4('0x2b')]=_[_0x7ba4('0x2d')](db[_0x7ba4('0x46')][_0x7ba4('0x40')]);_0x48b87d[_0x7ba4('0x2c')]=_[_0x7ba4('0x2d')](_0x35404d['query']);_0x48b87d[_0x7ba4('0x2e')]=_[_0x7ba4('0x2f')](_0x48b87d[_0x7ba4('0x2b')],_0x48b87d[_0x7ba4('0x2c')]);_0x56dca0[_0x7ba4('0x31')]=_['intersection'](_0x48b87d[_0x7ba4('0x2b')],qs['fields'](_0x35404d[_0x7ba4('0x2c')]['fields']));_0x56dca0[_0x7ba4('0x31')]=_0x56dca0['attributes'][_0x7ba4('0x47')]?_0x56dca0[_0x7ba4('0x31')]:_0x48b87d[_0x7ba4('0x2b')];_0x56dca0[_0x7ba4('0x35')]=qs[_0x7ba4('0x36')](_0x35404d[_0x7ba4('0x2c')][_0x7ba4('0x36')]);_0x56dca0[_0x7ba4('0x37')]=qs[_0x7ba4('0x2e')](_[_0x7ba4('0x38')](_0x35404d[_0x7ba4('0x2c')],_0x48b87d[_0x7ba4('0x2e')]));if(_0x35404d['query'][_0x7ba4('0x39')]){_0x56dca0[_0x7ba4('0x37')]=_[_0x7ba4('0x3a')](_0x56dca0['where'],{'$or':_[_0x7ba4('0x26')](_0x56dca0['attributes'],function(_0x168705){var _0x1c297c={};_0x1c297c[_0x168705]={'$like':'%'+_0x35404d[_0x7ba4('0x2c')][_0x7ba4('0x39')]+'%'};return _0x1c297c;})});}_0x56dca0=_[_0x7ba4('0x3a')]({},_0x56dca0,_0x35404d['options']);return _0x23fe4b[_0x7ba4('0x4a')](_0x56dca0);}})[_0x7ba4('0x20')](function(_0x9f9d87){if(_0x9f9d87){_0x436de8=_0x9f9d87[_0x7ba4('0x47')];if(!_0x35404d[_0x7ba4('0x2c')]['hasOwnProperty'](_0x7ba4('0x33'))){_0x56dca0[_0x7ba4('0x34')]=qs['limit'](_0x35404d[_0x7ba4('0x2c')][_0x7ba4('0x34')]);_0x56dca0[_0x7ba4('0x1b')]=qs[_0x7ba4('0x1b')](_0x35404d[_0x7ba4('0x2c')][_0x7ba4('0x1b')]);}return _0x23fe4b[_0x7ba4('0x4a')](_0x56dca0);}})[_0x7ba4('0x20')](function(_0x53665d){if(_0x53665d){return _0x53665d?{'count':_0x436de8,'rows':_0x53665d}:null;}})[_0x7ba4('0x20')](respondWithResult(_0x54b139,null))['catch'](handleError(_0x54b139,null));}; \ No newline at end of file +var _0xfc02=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','find','create','findOne','VtigerField','getFields','hasOwnProperty','getSubjects','rawAttributes','order','getDescriptions','eml-format','fast-json-patch','moment','bluebird','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','VtigerConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort'];(function(_0x44a859,_0xa67ac3){var _0x359d91=function(_0x173de9){while(--_0x173de9){_0x44a859['push'](_0x44a859['shift']());}};_0x359d91(++_0xa67ac3);}(_0xfc02,0x1da));var _0x2fc0=function(_0x2c763e,_0x4654de){_0x2c763e=_0x2c763e-0x0;var _0x53b5b8=_0xfc02[_0x2c763e];return _0x53b5b8;};'use strict';var emlformat=require(_0x2fc0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2fc0('0x1'));var rp=require('request-promise');var moment=require(_0x2fc0('0x2'));var BPromise=require(_0x2fc0('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2fc0('0x4'));var csv=require(_0x2fc0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fc0('0x6'));var _=require(_0x2fc0('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2fc0('0x8'));var toCsv=require('to-csv');var querystring=require(_0x2fc0('0x9'));var Papa=require(_0x2fc0('0xa'));var Redis=require(_0x2fc0('0xb'));var authService=require(_0x2fc0('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x2fc0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2fc0('0xe'));var utils=require(_0x2fc0('0xf'));var config=require(_0x2fc0('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fc0('0x11'))['db'];function respondWithStatusCode(_0x528013,_0x2eb2dd){_0x2eb2dd=_0x2eb2dd||0xcc;return function(_0x1957eb){if(_0x1957eb){return _0x528013[_0x2fc0('0x12')](_0x2eb2dd);}return _0x528013['status'](_0x2eb2dd)['end']();};}function respondWithResult(_0x378a72,_0x1d7b06){_0x1d7b06=_0x1d7b06||0xc8;return function(_0x1f5e7b){if(_0x1f5e7b){return _0x378a72[_0x2fc0('0x13')](_0x1d7b06)[_0x2fc0('0x14')](_0x1f5e7b);}};}function respondWithFilteredResult(_0x37aaea,_0x548ce9){return function(_0x4e5ce4){if(_0x4e5ce4){var _0x23f8f6=typeof _0x548ce9[_0x2fc0('0x15')]===_0x2fc0('0x16')&&typeof _0x548ce9['limit']==='undefined';var _0x4c4595=_0x4e5ce4[_0x2fc0('0x17')];var _0x3b43f4=_0x23f8f6?0x0:_0x548ce9[_0x2fc0('0x15')];var _0x4a6ef4=_0x23f8f6?_0x4e5ce4[_0x2fc0('0x17')]:_0x548ce9['offset']+_0x548ce9['limit'];var _0x4ce223;if(_0x4a6ef4>=_0x4c4595){_0x4a6ef4=_0x4c4595;_0x4ce223=0xc8;}else{_0x4ce223=0xce;}_0x37aaea[_0x2fc0('0x13')](_0x4ce223);return _0x37aaea[_0x2fc0('0x18')]('Content-Range',_0x3b43f4+'-'+_0x4a6ef4+'/'+_0x4c4595)[_0x2fc0('0x14')](_0x4e5ce4);}return null;};}function patchUpdates(_0x46fc4a){return function(_0x3e6059){try{jsonpatch[_0x2fc0('0x19')](_0x3e6059,_0x46fc4a,!![]);}catch(_0x3cc6ea){return BPromise[_0x2fc0('0x1a')](_0x3cc6ea);}return _0x3e6059[_0x2fc0('0x1b')]();};}function saveUpdates(_0x270c97,_0x35e22f){return function(_0x2bf22c){if(_0x2bf22c){return _0x2bf22c[_0x2fc0('0x1c')](_0x270c97)['then'](function(_0x5d64c0){return _0x5d64c0;});}return null;};}function removeEntity(_0x239bec,_0x2fa9fb){return function(_0x1ff736){if(_0x1ff736){return _0x1ff736[_0x2fc0('0x1d')]()['then'](function(){_0x239bec['status'](0xcc)[_0x2fc0('0x1e')]();});}};}function handleEntityNotFound(_0x89afbe,_0x158b44){return function(_0x346b08){if(!_0x346b08){_0x89afbe[_0x2fc0('0x12')](0x194);}return _0x346b08;};}function handleError(_0x38f468,_0x26aa49){_0x26aa49=_0x26aa49||0x1f4;return function(_0x5667f9){logger['error'](_0x5667f9[_0x2fc0('0x1f')]);if(_0x5667f9[_0x2fc0('0x20')]){delete _0x5667f9[_0x2fc0('0x20')];}_0x38f468[_0x2fc0('0x13')](_0x26aa49)[_0x2fc0('0x21')](_0x5667f9);};}exports[_0x2fc0('0x22')]=function(_0x1245ee,_0x4d0f60){var _0x3e0585={},_0x5d0d75={},_0x1f67c9={'count':0x0,'rows':[]};var _0x21a022=_[_0x2fc0('0x23')](db[_0x2fc0('0x24')]['rawAttributes'],function(_0x1c9436){return{'name':_0x1c9436[_0x2fc0('0x25')],'type':_0x1c9436[_0x2fc0('0x26')][_0x2fc0('0x27')]};});_0x5d0d75[_0x2fc0('0x28')]=_[_0x2fc0('0x23')](_0x21a022,_0x2fc0('0x20'));_0x5d0d75[_0x2fc0('0x29')]=_[_0x2fc0('0x2a')](_0x1245ee[_0x2fc0('0x29')]);_0x5d0d75[_0x2fc0('0x2b')]=_[_0x2fc0('0x2c')](_0x5d0d75[_0x2fc0('0x28')],_0x5d0d75[_0x2fc0('0x29')]);_0x3e0585[_0x2fc0('0x2d')]=_[_0x2fc0('0x2c')](_0x5d0d75[_0x2fc0('0x28')],qs[_0x2fc0('0x2e')](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x2e')]));_0x3e0585[_0x2fc0('0x2d')]=_0x3e0585[_0x2fc0('0x2d')][_0x2fc0('0x2f')]?_0x3e0585[_0x2fc0('0x2d')]:_0x5d0d75[_0x2fc0('0x28')];if(!_0x1245ee[_0x2fc0('0x29')]['hasOwnProperty'](_0x2fc0('0x30'))){_0x3e0585[_0x2fc0('0x31')]=qs['limit'](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x31')]);_0x3e0585['offset']=qs[_0x2fc0('0x15')](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x15')]);}_0x3e0585['order']=qs['sort'](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x32')]);_0x3e0585['where']=qs[_0x2fc0('0x2b')](_[_0x2fc0('0x33')](_0x1245ee[_0x2fc0('0x29')],_0x5d0d75[_0x2fc0('0x2b')]),_0x21a022);if(_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x34')]){_0x3e0585[_0x2fc0('0x35')]=_[_0x2fc0('0x36')](_0x3e0585[_0x2fc0('0x35')],{'$or':_[_0x2fc0('0x23')](_0x21a022,function(_0x3711d3){if(_0x3711d3['type']!==_0x2fc0('0x37')){var _0x2f4893={};_0x2f4893[_0x3711d3['name']]={'$like':'%'+_0x1245ee[_0x2fc0('0x29')]['filter']+'%'};return _0x2f4893;}})});}_0x3e0585=_[_0x2fc0('0x36')]({},_0x3e0585,_0x1245ee[_0x2fc0('0x38')]);var _0x27e4d1={'where':_0x3e0585[_0x2fc0('0x35')]};return db[_0x2fc0('0x24')][_0x2fc0('0x17')](_0x27e4d1)['then'](function(_0x191a1e){_0x1f67c9['count']=_0x191a1e;if(_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x39')]){_0x3e0585[_0x2fc0('0x3a')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x2fc0('0x3b')](_0x3e0585);})[_0x2fc0('0x3c')](function(_0x5b4a43){_0x1f67c9[_0x2fc0('0x3d')]=_0x5b4a43;return _0x1f67c9;})[_0x2fc0('0x3c')](respondWithFilteredResult(_0x4d0f60,_0x3e0585))[_0x2fc0('0x3e')](handleError(_0x4d0f60,null));};exports[_0x2fc0('0x3f')]=function(_0x3533cc,_0x115878){var _0x58323a={'raw':![],'where':{'id':_0x3533cc[_0x2fc0('0x40')]['id']}},_0x512c3b={};_0x512c3b['model']=_['keys'](db[_0x2fc0('0x24')]['rawAttributes']);_0x512c3b[_0x2fc0('0x29')]=_[_0x2fc0('0x2a')](_0x3533cc[_0x2fc0('0x29')]);_0x512c3b['filters']=_[_0x2fc0('0x2c')](_0x512c3b[_0x2fc0('0x28')],_0x512c3b[_0x2fc0('0x29')]);_0x58323a[_0x2fc0('0x2d')]=_[_0x2fc0('0x2c')](_0x512c3b['model'],qs['fields'](_0x3533cc['query']['fields']));_0x58323a[_0x2fc0('0x2d')]=_0x58323a[_0x2fc0('0x2d')]['length']?_0x58323a[_0x2fc0('0x2d')]:_0x512c3b['model'];if(_0x3533cc[_0x2fc0('0x29')][_0x2fc0('0x39')]){_0x58323a[_0x2fc0('0x3a')]=[{'all':!![]}];}_0x58323a=_[_0x2fc0('0x36')]({},_0x58323a,_0x3533cc[_0x2fc0('0x38')]);return db['VtigerConfiguration'][_0x2fc0('0x41')](_0x58323a)['then'](handleEntityNotFound(_0x115878,null))[_0x2fc0('0x3c')](respondWithResult(_0x115878,null))[_0x2fc0('0x3e')](handleError(_0x115878,null));};exports[_0x2fc0('0x42')]=function(_0x3eb932,_0x465341){return db[_0x2fc0('0x24')][_0x2fc0('0x42')](_0x3eb932['body'],{})[_0x2fc0('0x3c')](respondWithResult(_0x465341,0xc9))[_0x2fc0('0x3e')](handleError(_0x465341,null));};exports[_0x2fc0('0x1c')]=function(_0x3c1040,_0xbc991c){if(_0x3c1040['body']['id']){delete _0x3c1040['body']['id'];}return db[_0x2fc0('0x24')][_0x2fc0('0x41')]({'where':{'id':_0x3c1040[_0x2fc0('0x40')]['id']}})['then'](handleEntityNotFound(_0xbc991c,null))[_0x2fc0('0x3c')](saveUpdates(_0x3c1040['body'],null))['then'](respondWithResult(_0xbc991c,null))['catch'](handleError(_0xbc991c,null));};exports[_0x2fc0('0x1d')]=function(_0x5eac1d,_0x264a1a){return db[_0x2fc0('0x24')]['find']({'where':{'id':_0x5eac1d[_0x2fc0('0x40')]['id']}})['then'](handleEntityNotFound(_0x264a1a,null))['then'](removeEntity(_0x264a1a,null))[_0x2fc0('0x3e')](handleError(_0x264a1a,null));};exports['getFields']=function(_0x443d73,_0x25637c,_0x4c700e){var _0x4f13a9={};var _0x3e0cd0={};var _0x56bb86;var _0x39edfe;return db[_0x2fc0('0x24')][_0x2fc0('0x43')]({'where':{'id':_0x443d73[_0x2fc0('0x40')]['id']}})['then'](handleEntityNotFound(_0x25637c,null))['then'](function(_0x2598fd){if(_0x2598fd){_0x56bb86=_0x2598fd;_0x3e0cd0[_0x2fc0('0x28')]=_['keys'](db[_0x2fc0('0x44')]['rawAttributes']);_0x3e0cd0[_0x2fc0('0x29')]=_[_0x2fc0('0x2a')](_0x443d73[_0x2fc0('0x29')]);_0x3e0cd0[_0x2fc0('0x2b')]=_[_0x2fc0('0x2c')](_0x3e0cd0[_0x2fc0('0x28')],_0x3e0cd0[_0x2fc0('0x29')]);_0x4f13a9[_0x2fc0('0x2d')]=_['intersection'](_0x3e0cd0['model'],qs[_0x2fc0('0x2e')](_0x443d73[_0x2fc0('0x29')][_0x2fc0('0x2e')]));_0x4f13a9[_0x2fc0('0x2d')]=_0x4f13a9['attributes'][_0x2fc0('0x2f')]?_0x4f13a9[_0x2fc0('0x2d')]:_0x3e0cd0[_0x2fc0('0x28')];_0x4f13a9['order']=qs[_0x2fc0('0x32')](_0x443d73['query'][_0x2fc0('0x32')]);_0x4f13a9['where']=qs[_0x2fc0('0x2b')](_[_0x2fc0('0x33')](_0x443d73['query'],_0x3e0cd0[_0x2fc0('0x2b')]));if(_0x443d73[_0x2fc0('0x29')][_0x2fc0('0x34')]){_0x4f13a9[_0x2fc0('0x35')]=_[_0x2fc0('0x36')](_0x4f13a9[_0x2fc0('0x35')],{'$or':_[_0x2fc0('0x23')](_0x4f13a9[_0x2fc0('0x2d')],function(_0x2a178b){var _0x3e1bf6={};_0x3e1bf6[_0x2a178b]={'$like':'%'+_0x443d73[_0x2fc0('0x29')][_0x2fc0('0x34')]+'%'};return _0x3e1bf6;})});}_0x4f13a9=_[_0x2fc0('0x36')]({},_0x4f13a9,_0x443d73[_0x2fc0('0x38')]);return _0x56bb86[_0x2fc0('0x45')](_0x4f13a9);}})[_0x2fc0('0x3c')](function(_0x471d08){if(_0x471d08){_0x39edfe=_0x471d08[_0x2fc0('0x2f')];if(!_0x443d73[_0x2fc0('0x29')][_0x2fc0('0x46')](_0x2fc0('0x30'))){_0x4f13a9[_0x2fc0('0x31')]=qs['limit'](_0x443d73[_0x2fc0('0x29')][_0x2fc0('0x31')]);_0x4f13a9[_0x2fc0('0x15')]=qs['offset'](_0x443d73[_0x2fc0('0x29')]['offset']);}return _0x56bb86[_0x2fc0('0x45')](_0x4f13a9);}})[_0x2fc0('0x3c')](function(_0x255afa){if(_0x255afa){return _0x255afa?{'count':_0x39edfe,'rows':_0x255afa}:null;}})[_0x2fc0('0x3c')](respondWithResult(_0x25637c,null))[_0x2fc0('0x3e')](handleError(_0x25637c,null));};exports[_0x2fc0('0x47')]=function(_0x54f8a7,_0x1ef2cd,_0x3914b6){var _0xbd6744={};var _0x59ac4b={};var _0x21eff0;var _0x3ea30a;return db[_0x2fc0('0x24')][_0x2fc0('0x43')]({'where':{'id':_0x54f8a7[_0x2fc0('0x40')]['id']}})[_0x2fc0('0x3c')](handleEntityNotFound(_0x1ef2cd,null))['then'](function(_0x461508){if(_0x461508){_0x21eff0=_0x461508;_0x59ac4b[_0x2fc0('0x28')]=_[_0x2fc0('0x2a')](db[_0x2fc0('0x44')][_0x2fc0('0x48')]);_0x59ac4b[_0x2fc0('0x29')]=_[_0x2fc0('0x2a')](_0x54f8a7['query']);_0x59ac4b[_0x2fc0('0x2b')]=_['intersection'](_0x59ac4b[_0x2fc0('0x28')],_0x59ac4b['query']);_0xbd6744[_0x2fc0('0x2d')]=_[_0x2fc0('0x2c')](_0x59ac4b[_0x2fc0('0x28')],qs[_0x2fc0('0x2e')](_0x54f8a7[_0x2fc0('0x29')]['fields']));_0xbd6744['attributes']=_0xbd6744['attributes'][_0x2fc0('0x2f')]?_0xbd6744[_0x2fc0('0x2d')]:_0x59ac4b[_0x2fc0('0x28')];_0xbd6744[_0x2fc0('0x49')]=qs[_0x2fc0('0x32')](_0x54f8a7['query'][_0x2fc0('0x32')]);_0xbd6744[_0x2fc0('0x35')]=qs['filters'](_[_0x2fc0('0x33')](_0x54f8a7[_0x2fc0('0x29')],_0x59ac4b[_0x2fc0('0x2b')]));if(_0x54f8a7[_0x2fc0('0x29')][_0x2fc0('0x34')]){_0xbd6744[_0x2fc0('0x35')]=_['merge'](_0xbd6744['where'],{'$or':_['map'](_0xbd6744['attributes'],function(_0x1c43af){var _0x34ff7a={};_0x34ff7a[_0x1c43af]={'$like':'%'+_0x54f8a7[_0x2fc0('0x29')][_0x2fc0('0x34')]+'%'};return _0x34ff7a;})});}_0xbd6744=_[_0x2fc0('0x36')]({},_0xbd6744,_0x54f8a7['options']);return _0x21eff0['getSubjects'](_0xbd6744);}})[_0x2fc0('0x3c')](function(_0x7d5901){if(_0x7d5901){_0x3ea30a=_0x7d5901[_0x2fc0('0x2f')];if(!_0x54f8a7[_0x2fc0('0x29')][_0x2fc0('0x46')](_0x2fc0('0x30'))){_0xbd6744['limit']=qs['limit'](_0x54f8a7[_0x2fc0('0x29')][_0x2fc0('0x31')]);_0xbd6744[_0x2fc0('0x15')]=qs['offset'](_0x54f8a7[_0x2fc0('0x29')]['offset']);}return _0x21eff0[_0x2fc0('0x47')](_0xbd6744);}})[_0x2fc0('0x3c')](function(_0x341bf0){if(_0x341bf0){return _0x341bf0?{'count':_0x3ea30a,'rows':_0x341bf0}:null;}})[_0x2fc0('0x3c')](respondWithResult(_0x1ef2cd,null))[_0x2fc0('0x3e')](handleError(_0x1ef2cd,null));};exports['getDescriptions']=function(_0x8b87a7,_0x2dbc56,_0x592edf){var _0x8ba151={};var _0x12a4af={};var _0x25b104;var _0x4d3909;return db[_0x2fc0('0x24')]['findOne']({'where':{'id':_0x8b87a7['params']['id']}})[_0x2fc0('0x3c')](handleEntityNotFound(_0x2dbc56,null))[_0x2fc0('0x3c')](function(_0x2fc3d4){if(_0x2fc3d4){_0x25b104=_0x2fc3d4;_0x12a4af[_0x2fc0('0x28')]=_[_0x2fc0('0x2a')](db[_0x2fc0('0x44')]['rawAttributes']);_0x12a4af['query']=_['keys'](_0x8b87a7[_0x2fc0('0x29')]);_0x12a4af['filters']=_[_0x2fc0('0x2c')](_0x12a4af['model'],_0x12a4af['query']);_0x8ba151['attributes']=_['intersection'](_0x12a4af[_0x2fc0('0x28')],qs['fields'](_0x8b87a7['query'][_0x2fc0('0x2e')]));_0x8ba151[_0x2fc0('0x2d')]=_0x8ba151['attributes'][_0x2fc0('0x2f')]?_0x8ba151['attributes']:_0x12a4af[_0x2fc0('0x28')];_0x8ba151[_0x2fc0('0x49')]=qs[_0x2fc0('0x32')](_0x8b87a7[_0x2fc0('0x29')][_0x2fc0('0x32')]);_0x8ba151[_0x2fc0('0x35')]=qs['filters'](_[_0x2fc0('0x33')](_0x8b87a7[_0x2fc0('0x29')],_0x12a4af['filters']));if(_0x8b87a7['query'][_0x2fc0('0x34')]){_0x8ba151[_0x2fc0('0x35')]=_[_0x2fc0('0x36')](_0x8ba151[_0x2fc0('0x35')],{'$or':_[_0x2fc0('0x23')](_0x8ba151['attributes'],function(_0x41fff6){var _0x570c06={};_0x570c06[_0x41fff6]={'$like':'%'+_0x8b87a7[_0x2fc0('0x29')][_0x2fc0('0x34')]+'%'};return _0x570c06;})});}_0x8ba151=_[_0x2fc0('0x36')]({},_0x8ba151,_0x8b87a7[_0x2fc0('0x38')]);return _0x25b104[_0x2fc0('0x4a')](_0x8ba151);}})[_0x2fc0('0x3c')](function(_0x134eb7){if(_0x134eb7){_0x4d3909=_0x134eb7[_0x2fc0('0x2f')];if(!_0x8b87a7[_0x2fc0('0x29')]['hasOwnProperty'](_0x2fc0('0x30'))){_0x8ba151[_0x2fc0('0x31')]=qs[_0x2fc0('0x31')](_0x8b87a7[_0x2fc0('0x29')][_0x2fc0('0x31')]);_0x8ba151[_0x2fc0('0x15')]=qs[_0x2fc0('0x15')](_0x8b87a7['query'][_0x2fc0('0x15')]);}return _0x25b104['getDescriptions'](_0x8ba151);}})['then'](function(_0x13f33f){if(_0x13f33f){return _0x13f33f?{'count':_0x4d3909,'rows':_0x13f33f}:null;}})['then'](respondWithResult(_0x2dbc56,null))[_0x2fc0('0x3e')](handleError(_0x2dbc56,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 20675d2..14ad7c6 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 _0x810b=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','util','../../config/logger'];(function(_0x55c541,_0x5c9e26){var _0x26b890=function(_0x21ac3c){while(--_0x21ac3c){_0x55c541['push'](_0x55c541['shift']());}};_0x26b890(++_0x5c9e26);}(_0x810b,0x15a));var _0xb810=function(_0x16dfa7,_0x1a92df){_0x16dfa7=_0x16dfa7-0x0;var _0x1734c0=_0x810b[_0x16dfa7];return _0x1734c0;};'use strict';var _=require('lodash');var util=require(_0xb810('0x0'));var logger=require(_0xb810('0x1'))(_0xb810('0x2'));var moment=require(_0xb810('0x3'));var BPromise=require(_0xb810('0x4'));var rp=require(_0xb810('0x5'));var fs=require('fs');var path=require(_0xb810('0x6'));var rimraf=require('rimraf');var config=require(_0xb810('0x7'));var attributes=require(_0xb810('0x8'));module[_0xb810('0x9')]=function(_0x108498,_0x1a2ab2){return _0x108498[_0xb810('0xa')]('VtigerConfiguration',attributes,{'tableName':_0xb810('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40c7=['api','moment','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x40c7,0x15e));var _0x740c=function(_0x2d72ab,_0x5a97f5){_0x2d72ab=_0x2d72ab-0x0;var _0x256423=_0x40c7[_0x2d72ab];return _0x256423;};'use strict';var _=require(_0x740c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x740c('0x1'));var moment=require(_0x740c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x740c('0x3'));var config=require(_0x740c('0x4'));var attributes=require(_0x740c('0x5'));module['exports']=function(_0x3e519e,_0x4340f8){return _0x3e519e[_0x740c('0x6')](_0x740c('0x7'),attributes,{'tableName':_0x740c('0x8'),'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 1ae3b8a..0cdf421 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 _0x141a=['request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x4a8829,_0x51568a){var _0x9c0248=function(_0x1d9742){while(--_0x1d9742){_0x4a8829['push'](_0x4a8829['shift']());}};_0x9c0248(++_0x51568a);}(_0x141a,0x110));var _0xa141=function(_0x45a64c,_0x45857c){_0x45a64c=_0x45a64c-0x0;var _0x553de9=_0x141a[_0x45a64c];return _0x553de9;};'use strict';var _=require('lodash');var util=require(_0xa141('0x0'));var moment=require(_0xa141('0x1'));var BPromise=require(_0xa141('0x2'));var rs=require(_0xa141('0x3'));var fs=require('fs');var Redis=require(_0xa141('0x4'));var db=require(_0xa141('0x5'))['db'];var utils=require(_0xa141('0x6'));var logger=require(_0xa141('0x7'))(_0xa141('0x8'));var config=require('../../config/environment');var jayson=require(_0xa141('0x9'));var client=jayson['client'][_0xa141('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4272f1,_0x4ba18d,_0x9601db){return new BPromise(function(_0x46e9e1,_0x3d2e26){return client[_0xa141('0xb')](_0x4272f1,_0x9601db)[_0xa141('0xc')](function(_0x330439){logger[_0xa141('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x4ba18d,_0xa141('0xe'));logger['debug'](_0xa141('0xf'),_0x4ba18d,_0xa141('0xe'),JSON[_0xa141('0x10')](_0x330439));if(_0x330439[_0xa141('0x11')]){if(_0x330439['error']['code']===0x1f4){logger[_0xa141('0x11')](_0xa141('0x12'),_0x4ba18d,_0x330439[_0xa141('0x11')][_0xa141('0x13')]);return _0x3d2e26(_0x330439[_0xa141('0x11')]['message']);}logger['error'](_0xa141('0x12'),_0x4ba18d,_0x330439[_0xa141('0x11')]['message']);return _0x46e9e1(_0x330439['error']['message']);}else{logger[_0xa141('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x4ba18d,_0xa141('0xe'));_0x46e9e1(_0x330439[_0xa141('0x14')][_0xa141('0x13')]);}})[_0xa141('0x15')](function(_0x56dcae){logger['error'](_0xa141('0x12'),_0x4ba18d,_0x56dcae);_0x3d2e26(_0x56dcae);});});} \ No newline at end of file +var _0xcafb=['message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2be34f,_0x1a71f8){var _0x450234=function(_0x492824){while(--_0x492824){_0x2be34f['push'](_0x2be34f['shift']());}};_0x450234(++_0x1a71f8);}(_0xcafb,0x179));var _0xbcaf=function(_0x5b947d,_0x4979f8){_0x5b947d=_0x5b947d-0x0;var _0xdd537c=_0xcafb[_0x5b947d];return _0xdd537c;};'use strict';var _=require(_0xbcaf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbcaf('0x1'));var rs=require(_0xbcaf('0x2'));var fs=require('fs');var Redis=require(_0xbcaf('0x3'));var db=require(_0xbcaf('0x4'))['db'];var utils=require(_0xbcaf('0x5'));var logger=require(_0xbcaf('0x6'))(_0xbcaf('0x7'));var config=require(_0xbcaf('0x8'));var jayson=require(_0xbcaf('0x9'));var client=jayson[_0xbcaf('0xa')][_0xbcaf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x270940,_0x43949e,_0x19581c){return new BPromise(function(_0x327c6c,_0xc380de){return client['request'](_0x270940,_0x19581c)['then'](function(_0x423ebe){logger[_0xbcaf('0xc')](_0xbcaf('0xd'),_0x43949e,_0xbcaf('0xe'));logger[_0xbcaf('0xf')](_0xbcaf('0x10'),_0x43949e,_0xbcaf('0xe'),JSON[_0xbcaf('0x11')](_0x423ebe));if(_0x423ebe[_0xbcaf('0x12')]){if(_0x423ebe[_0xbcaf('0x12')]['code']===0x1f4){logger['error'](_0xbcaf('0xd'),_0x43949e,_0x423ebe['error'][_0xbcaf('0x13')]);return _0xc380de(_0x423ebe[_0xbcaf('0x12')][_0xbcaf('0x13')]);}logger['error'](_0xbcaf('0xd'),_0x43949e,_0x423ebe[_0xbcaf('0x12')]['message']);return _0x327c6c(_0x423ebe[_0xbcaf('0x12')]['message']);}else{logger[_0xbcaf('0xc')](_0xbcaf('0xd'),_0x43949e,'request\x20sent');_0x327c6c(_0x423ebe[_0xbcaf('0x14')][_0xbcaf('0x13')]);}})[_0xbcaf('0x15')](function(_0x354cd7){logger[_0xbcaf('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x43949e,_0x354cd7);_0xc380de(_0x354cd7);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 97e17bd..4aaa85b 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 _0xb914=['./intVtigerField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x242023,_0x2d5ede){var _0x19375d=function(_0x1456e7){while(--_0x1456e7){_0x242023['push'](_0x242023['shift']());}};_0x19375d(++_0x2d5ede);}(_0xb914,0x8b));var _0x4b91=function(_0x38d8f5,_0x547e60){_0x38d8f5=_0x38d8f5-0x0;var _0x1db685=_0xb914[_0x38d8f5];return _0x1db685;};'use strict';var multer=require(_0x4b91('0x0'));var util=require(_0x4b91('0x1'));var path=require('path');var timeout=require(_0x4b91('0x2'));var express=require('express');var router=express[_0x4b91('0x3')]();var fs_extra=require(_0x4b91('0x4'));var auth=require(_0x4b91('0x5'));var interaction=require(_0x4b91('0x6'));var config=require(_0x4b91('0x7'));var controller=require(_0x4b91('0x8'));router[_0x4b91('0x9')]('/',auth['isAuthenticated'](),controller[_0x4b91('0xa')]);router['get'](_0x4b91('0xb'),auth[_0x4b91('0xc')](),controller[_0x4b91('0xd')]);router[_0x4b91('0xe')]('/',auth[_0x4b91('0xc')](),controller[_0x4b91('0xf')]);router[_0x4b91('0x10')](_0x4b91('0xb'),auth[_0x4b91('0xc')](),controller[_0x4b91('0x11')]);router[_0x4b91('0x12')]('/:id',auth[_0x4b91('0xc')](),controller[_0x4b91('0x13')]);module[_0x4b91('0x14')]=router; \ No newline at end of file +var _0x6dc5=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x2c4cc7,_0x3da9ef){var _0x425f72=function(_0x26f3f1){while(--_0x26f3f1){_0x2c4cc7['push'](_0x2c4cc7['shift']());}};_0x425f72(++_0x3da9ef);}(_0x6dc5,0x1f4));var _0x56dc=function(_0x2017b9,_0x3dbeda){_0x2017b9=_0x2017b9-0x0;var _0x4e7cec=_0x6dc5[_0x2017b9];return _0x4e7cec;};'use strict';var multer=require(_0x56dc('0x0'));var util=require(_0x56dc('0x1'));var path=require(_0x56dc('0x2'));var timeout=require(_0x56dc('0x3'));var express=require(_0x56dc('0x4'));var router=express[_0x56dc('0x5')]();var fs_extra=require(_0x56dc('0x6'));var auth=require(_0x56dc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x56dc('0x8'));var controller=require(_0x56dc('0x9'));router[_0x56dc('0xa')]('/',auth[_0x56dc('0xb')](),controller['index']);router[_0x56dc('0xa')](_0x56dc('0xc'),auth['isAuthenticated'](),controller[_0x56dc('0xd')]);router[_0x56dc('0xe')]('/',auth['isAuthenticated'](),controller[_0x56dc('0xf')]);router['put'](_0x56dc('0xc'),auth[_0x56dc('0xb')](),controller[_0x56dc('0x10')]);router[_0x56dc('0x11')](_0x56dc('0xc'),auth['isAuthenticated'](),controller[_0x56dc('0x12')]);module[_0x56dc('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 cf8e69e..a2dd37f 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 _0xe77a=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x57d2e6,_0x331cc5){var _0x14d40c=function(_0x353fc8){while(--_0x353fc8){_0x57d2e6['push'](_0x57d2e6['shift']());}};_0x14d40c(++_0x331cc5);}(_0xe77a,0xf2));var _0xae77=function(_0x320f9f,_0x2d1cbe){_0x320f9f=_0x320f9f-0x0;var _0x7e9ba4=_0xe77a[_0x320f9f];return _0x7e9ba4;};'use strict';var Sequelize=require(_0xae77('0x0'));module[_0xae77('0x1')]={'type':{'type':Sequelize[_0xae77('0x2')](_0xae77('0x3'),_0xae77('0x4'),_0xae77('0x5'),_0xae77('0x6'),_0xae77('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xae77('0x8')]},'key':{'type':Sequelize[_0xae77('0x8')]},'keyType':{'type':Sequelize[_0xae77('0x2')](_0xae77('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xae77('0x8')]},'idField':{'type':Sequelize[_0xae77('0x8')]},'nameField':{'type':Sequelize[_0xae77('0x8')]},'customField':{'type':Sequelize[_0xae77('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae77('0x8')]}}; \ No newline at end of file +var _0x3beb=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x128552,_0x5e7e4e){var _0x31ddb5=function(_0x1bb571){while(--_0x1bb571){_0x128552['push'](_0x128552['shift']());}};_0x31ddb5(++_0x5e7e4e);}(_0x3beb,0x160));var _0xb3be=function(_0x21839a,_0x5a5e2d){_0x21839a=_0x21839a-0x0;var _0x31dfa5=_0x3beb[_0x21839a];return _0x31dfa5;};'use strict';var Sequelize=require(_0xb3be('0x0'));module[_0xb3be('0x1')]={'type':{'type':Sequelize[_0xb3be('0x2')](_0xb3be('0x3'),_0xb3be('0x4'),_0xb3be('0x5'),_0xb3be('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xb3be('0x7')]},'key':{'type':Sequelize[_0xb3be('0x7')]},'keyType':{'type':Sequelize[_0xb3be('0x2')](_0xb3be('0x3'),_0xb3be('0x4'),_0xb3be('0x5'))},'keyContent':{'type':Sequelize[_0xb3be('0x7')]},'idField':{'type':Sequelize[_0xb3be('0x7')]},'nameField':{'type':Sequelize[_0xb3be('0x7')]},'customField':{'type':Sequelize[_0xb3be('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 52413af..f7ceabf 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 _0x7de0=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x158bd4,_0xd6bd64){var _0x34f2f4=function(_0x20dab4){while(--_0x20dab4){_0x158bd4['push'](_0x158bd4['shift']());}};_0x34f2f4(++_0xd6bd64);}(_0x7de0,0x9b));var _0x07de=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7de0[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0x07de('0x0'));var rimraf=require(_0x07de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x07de('0x2'));var rp=require('request-promise');var moment=require(_0x07de('0x3'));var BPromise=require(_0x07de('0x4'));var Mustache=require(_0x07de('0x5'));var util=require(_0x07de('0x6'));var path=require('path');var sox=require(_0x07de('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x07de('0x8'));var crypto=require(_0x07de('0x9'));var jsforce=require(_0x07de('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x07de('0xb'));var Redis=require('ioredis');var authService=require(_0x07de('0xc'));var qs=require(_0x07de('0xd'));var as=require(_0x07de('0xe'));var hardwareService=require(_0x07de('0xf'));var logger=require(_0x07de('0x10'))(_0x07de('0x11'));var utils=require('../../config/utils');var config=require(_0x07de('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x07de('0x13'))['db'];function respondWithStatusCode(_0x39ed25,_0x4a5cbf){_0x4a5cbf=_0x4a5cbf||0xcc;return function(_0x4789c9){if(_0x4789c9){return _0x39ed25[_0x07de('0x14')](_0x4a5cbf);}return _0x39ed25[_0x07de('0x15')](_0x4a5cbf)[_0x07de('0x16')]();};}function respondWithResult(_0x4e39d9,_0x5819cc){_0x5819cc=_0x5819cc||0xc8;return function(_0x13640b){if(_0x13640b){return _0x4e39d9['status'](_0x5819cc)[_0x07de('0x17')](_0x13640b);}};}function respondWithFilteredResult(_0x4f0cc8,_0x1bb899){return function(_0x56267a){if(_0x56267a){var _0xf8422=typeof _0x1bb899['offset']===_0x07de('0x18')&&typeof _0x1bb899[_0x07de('0x19')]===_0x07de('0x18');var _0x21fc53=_0x56267a[_0x07de('0x1a')];var _0x375ba7=_0xf8422?0x0:_0x1bb899[_0x07de('0x1b')];var _0x25a94a=_0xf8422?_0x56267a[_0x07de('0x1a')]:_0x1bb899[_0x07de('0x1b')]+_0x1bb899[_0x07de('0x19')];var _0x5ee841;if(_0x25a94a>=_0x21fc53){_0x25a94a=_0x21fc53;_0x5ee841=0xc8;}else{_0x5ee841=0xce;}_0x4f0cc8[_0x07de('0x15')](_0x5ee841);return _0x4f0cc8[_0x07de('0x1c')](_0x07de('0x1d'),_0x375ba7+'-'+_0x25a94a+'/'+_0x21fc53)[_0x07de('0x17')](_0x56267a);}return null;};}function patchUpdates(_0x5bcc53){return function(_0x5e3064){try{jsonpatch[_0x07de('0x1e')](_0x5e3064,_0x5bcc53,!![]);}catch(_0x2b1f54){return BPromise[_0x07de('0x1f')](_0x2b1f54);}return _0x5e3064[_0x07de('0x20')]();};}function saveUpdates(_0x450b13,_0xefcd3){return function(_0x1b7d35){if(_0x1b7d35){return _0x1b7d35[_0x07de('0x21')](_0x450b13)[_0x07de('0x22')](function(_0x3129eb){return _0x3129eb;});}return null;};}function removeEntity(_0x1f940d,_0x33c143){return function(_0x11240e){if(_0x11240e){return _0x11240e[_0x07de('0x23')]()[_0x07de('0x22')](function(){_0x1f940d['status'](0xcc)[_0x07de('0x16')]();});}};}function handleEntityNotFound(_0x1099ee,_0x553523){return function(_0x29b467){if(!_0x29b467){_0x1099ee[_0x07de('0x14')](0x194);}return _0x29b467;};}function handleError(_0x3d8eed,_0x279782){_0x279782=_0x279782||0x1f4;return function(_0x3231cd){logger[_0x07de('0x24')](_0x3231cd[_0x07de('0x25')]);if(_0x3231cd[_0x07de('0x26')]){delete _0x3231cd[_0x07de('0x26')];}_0x3d8eed['status'](_0x279782)[_0x07de('0x27')](_0x3231cd);};}exports[_0x07de('0x28')]=function(_0x16ec62,_0x5d0366){var _0x42a1f9={},_0x46b4f4={},_0x2936a1={'count':0x0,'rows':[]};var _0x157062=_[_0x07de('0x29')](db[_0x07de('0x2a')][_0x07de('0x2b')],function(_0x4ec765){return{'name':_0x4ec765[_0x07de('0x2c')],'type':_0x4ec765[_0x07de('0x2d')]['key']};});_0x46b4f4[_0x07de('0x2e')]=_[_0x07de('0x29')](_0x157062,_0x07de('0x26'));_0x46b4f4['query']=_[_0x07de('0x2f')](_0x16ec62[_0x07de('0x30')]);_0x46b4f4[_0x07de('0x31')]=_[_0x07de('0x32')](_0x46b4f4[_0x07de('0x2e')],_0x46b4f4[_0x07de('0x30')]);_0x42a1f9[_0x07de('0x33')]=_[_0x07de('0x32')](_0x46b4f4['model'],qs[_0x07de('0x34')](_0x16ec62['query']['fields']));_0x42a1f9[_0x07de('0x33')]=_0x42a1f9['attributes'][_0x07de('0x35')]?_0x42a1f9[_0x07de('0x33')]:_0x46b4f4[_0x07de('0x2e')];if(!_0x16ec62[_0x07de('0x30')]['hasOwnProperty'](_0x07de('0x36'))){_0x42a1f9[_0x07de('0x19')]=qs[_0x07de('0x19')](_0x16ec62[_0x07de('0x30')][_0x07de('0x19')]);_0x42a1f9[_0x07de('0x1b')]=qs[_0x07de('0x1b')](_0x16ec62[_0x07de('0x30')][_0x07de('0x1b')]);}_0x42a1f9[_0x07de('0x37')]=qs[_0x07de('0x38')](_0x16ec62[_0x07de('0x30')]['sort']);_0x42a1f9[_0x07de('0x39')]=qs[_0x07de('0x31')](_[_0x07de('0x3a')](_0x16ec62[_0x07de('0x30')],_0x46b4f4['filters']),_0x157062);if(_0x16ec62['query'][_0x07de('0x3b')]){_0x42a1f9['where']=_[_0x07de('0x3c')](_0x42a1f9[_0x07de('0x39')],{'$or':_[_0x07de('0x29')](_0x157062,function(_0x42d95c){if(_0x42d95c['type']!==_0x07de('0x3d')){var _0x28b668={};_0x28b668[_0x42d95c['name']]={'$like':'%'+_0x16ec62[_0x07de('0x30')][_0x07de('0x3b')]+'%'};return _0x28b668;}})});}_0x42a1f9=_[_0x07de('0x3c')]({},_0x42a1f9,_0x16ec62[_0x07de('0x3e')]);var _0x51a3da={'where':_0x42a1f9[_0x07de('0x39')]};return db[_0x07de('0x2a')][_0x07de('0x1a')](_0x51a3da)[_0x07de('0x22')](function(_0x59f0bd){_0x2936a1['count']=_0x59f0bd;if(_0x16ec62[_0x07de('0x30')][_0x07de('0x3f')]){_0x42a1f9['include']=[{'all':!![]}];}return db['VtigerField'][_0x07de('0x40')](_0x42a1f9);})[_0x07de('0x22')](function(_0x7a9a88){_0x2936a1['rows']=_0x7a9a88;return _0x2936a1;})[_0x07de('0x22')](respondWithFilteredResult(_0x5d0366,_0x42a1f9))['catch'](handleError(_0x5d0366,null));};exports[_0x07de('0x41')]=function(_0x1a62c6,_0xbf6058){var _0x2682e6={'raw':!![],'where':{'id':_0x1a62c6['params']['id']}},_0xbabc97={};_0xbabc97[_0x07de('0x2e')]=_[_0x07de('0x2f')](db[_0x07de('0x2a')][_0x07de('0x2b')]);_0xbabc97[_0x07de('0x30')]=_['keys'](_0x1a62c6[_0x07de('0x30')]);_0xbabc97[_0x07de('0x31')]=_[_0x07de('0x32')](_0xbabc97[_0x07de('0x2e')],_0xbabc97[_0x07de('0x30')]);_0x2682e6[_0x07de('0x33')]=_[_0x07de('0x32')](_0xbabc97[_0x07de('0x2e')],qs[_0x07de('0x34')](_0x1a62c6[_0x07de('0x30')][_0x07de('0x34')]));_0x2682e6[_0x07de('0x33')]=_0x2682e6[_0x07de('0x33')][_0x07de('0x35')]?_0x2682e6[_0x07de('0x33')]:_0xbabc97[_0x07de('0x2e')];if(_0x1a62c6['query'][_0x07de('0x3f')]){_0x2682e6['include']=[{'all':!![]}];}_0x2682e6=_[_0x07de('0x3c')]({},_0x2682e6,_0x1a62c6['options']);return db[_0x07de('0x2a')][_0x07de('0x42')](_0x2682e6)[_0x07de('0x22')](handleEntityNotFound(_0xbf6058,null))['then'](respondWithResult(_0xbf6058,null))[_0x07de('0x43')](handleError(_0xbf6058,null));};exports[_0x07de('0x44')]=function(_0x4326c1,_0x4e4dd4){return db[_0x07de('0x2a')][_0x07de('0x44')](_0x4326c1[_0x07de('0x45')],{})[_0x07de('0x22')](respondWithResult(_0x4e4dd4,0xc9))[_0x07de('0x43')](handleError(_0x4e4dd4,null));};exports[_0x07de('0x21')]=function(_0x27615e,_0x279e6d){if(_0x27615e[_0x07de('0x45')]['id']){delete _0x27615e['body']['id'];}return db[_0x07de('0x2a')][_0x07de('0x42')]({'where':{'id':_0x27615e[_0x07de('0x46')]['id']}})[_0x07de('0x22')](handleEntityNotFound(_0x279e6d,null))[_0x07de('0x22')](saveUpdates(_0x27615e['body'],null))[_0x07de('0x22')](respondWithResult(_0x279e6d,null))[_0x07de('0x43')](handleError(_0x279e6d,null));};exports[_0x07de('0x23')]=function(_0xbbc433,_0x5abd4a){return db[_0x07de('0x2a')][_0x07de('0x42')]({'where':{'id':_0xbbc433[_0x07de('0x46')]['id']}})['then'](handleEntityNotFound(_0x5abd4a,null))[_0x07de('0x22')](removeEntity(_0x5abd4a,null))[_0x07de('0x43')](handleError(_0x5abd4a,null));}; \ No newline at end of file +var _0x870a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x870a,0x8a));var _0xa870=function(_0x6be798,_0x1675b6){_0x6be798=_0x6be798-0x0;var _0x1407e1=_0x870a[_0x6be798];return _0x1407e1;};'use strict';var emlformat=require(_0xa870('0x0'));var rimraf=require(_0xa870('0x1'));var zipdir=require(_0xa870('0x2'));var jsonpatch=require(_0xa870('0x3'));var rp=require(_0xa870('0x4'));var moment=require(_0xa870('0x5'));var BPromise=require(_0xa870('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa870('0x7'));var sox=require(_0xa870('0x8'));var csv=require('to-csv');var ejs=require(_0xa870('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa870('0xa'));var squel=require(_0xa870('0xb'));var crypto=require(_0xa870('0xc'));var jsforce=require(_0xa870('0xd'));var deskjs=require(_0xa870('0xe'));var toCsv=require(_0xa870('0xf'));var querystring=require(_0xa870('0x10'));var Papa=require(_0xa870('0x11'));var Redis=require(_0xa870('0x12'));var authService=require(_0xa870('0x13'));var qs=require(_0xa870('0x14'));var as=require(_0xa870('0x15'));var hardwareService=require(_0xa870('0x16'));var logger=require('../../config/logger')(_0xa870('0x17'));var utils=require(_0xa870('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa870('0x19'));var db=require(_0xa870('0x1a'))['db'];function respondWithStatusCode(_0xdd8164,_0x222d3f){_0x222d3f=_0x222d3f||0xcc;return function(_0x5db917){if(_0x5db917){return _0xdd8164[_0xa870('0x1b')](_0x222d3f);}return _0xdd8164[_0xa870('0x1c')](_0x222d3f)[_0xa870('0x1d')]();};}function respondWithResult(_0x1db5a5,_0x38b9fd){_0x38b9fd=_0x38b9fd||0xc8;return function(_0x1ead02){if(_0x1ead02){return _0x1db5a5[_0xa870('0x1c')](_0x38b9fd)[_0xa870('0x1e')](_0x1ead02);}};}function respondWithFilteredResult(_0x453590,_0x18d53d){return function(_0x5e921a){if(_0x5e921a){var _0x3fd83f=typeof _0x18d53d[_0xa870('0x1f')]===_0xa870('0x20')&&typeof _0x18d53d['limit']==='undefined';var _0x37e758=_0x5e921a[_0xa870('0x21')];var _0x35f4de=_0x3fd83f?0x0:_0x18d53d['offset'];var _0x7379e7=_0x3fd83f?_0x5e921a[_0xa870('0x21')]:_0x18d53d[_0xa870('0x1f')]+_0x18d53d[_0xa870('0x22')];var _0x19dd25;if(_0x7379e7>=_0x37e758){_0x7379e7=_0x37e758;_0x19dd25=0xc8;}else{_0x19dd25=0xce;}_0x453590[_0xa870('0x1c')](_0x19dd25);return _0x453590[_0xa870('0x23')](_0xa870('0x24'),_0x35f4de+'-'+_0x7379e7+'/'+_0x37e758)[_0xa870('0x1e')](_0x5e921a);}return null;};}function patchUpdates(_0x92c00f){return function(_0x35072e){try{jsonpatch[_0xa870('0x25')](_0x35072e,_0x92c00f,!![]);}catch(_0x21c4b1){return BPromise['reject'](_0x21c4b1);}return _0x35072e[_0xa870('0x26')]();};}function saveUpdates(_0x3437b8,_0x4baf65){return function(_0x522032){if(_0x522032){return _0x522032[_0xa870('0x27')](_0x3437b8)[_0xa870('0x28')](function(_0x5d8056){return _0x5d8056;});}return null;};}function removeEntity(_0x158a30,_0x8d3492){return function(_0x1e0792){if(_0x1e0792){return _0x1e0792[_0xa870('0x29')]()['then'](function(){_0x158a30[_0xa870('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ea08c,_0x272737){return function(_0x143226){if(!_0x143226){_0x1ea08c['sendStatus'](0x194);}return _0x143226;};}function handleError(_0x572600,_0xa67345){_0xa67345=_0xa67345||0x1f4;return function(_0x1a33d6){logger[_0xa870('0x2a')](_0x1a33d6[_0xa870('0x2b')]);if(_0x1a33d6[_0xa870('0x2c')]){delete _0x1a33d6[_0xa870('0x2c')];}_0x572600[_0xa870('0x1c')](_0xa67345)[_0xa870('0x2d')](_0x1a33d6);};}exports[_0xa870('0x2e')]=function(_0x1692cc,_0x5c053c){var _0x1a8374={},_0x5d8425={},_0x142127={'count':0x0,'rows':[]};var _0x3c11a6=_[_0xa870('0x2f')](db[_0xa870('0x30')][_0xa870('0x31')],function(_0x159977){return{'name':_0x159977[_0xa870('0x32')],'type':_0x159977['type']['key']};});_0x5d8425[_0xa870('0x33')]=_[_0xa870('0x2f')](_0x3c11a6,_0xa870('0x2c'));_0x5d8425[_0xa870('0x34')]=_[_0xa870('0x35')](_0x1692cc[_0xa870('0x34')]);_0x5d8425[_0xa870('0x36')]=_['intersection'](_0x5d8425[_0xa870('0x33')],_0x5d8425[_0xa870('0x34')]);_0x1a8374[_0xa870('0x37')]=_[_0xa870('0x38')](_0x5d8425['model'],qs['fields'](_0x1692cc['query'][_0xa870('0x39')]));_0x1a8374[_0xa870('0x37')]=_0x1a8374[_0xa870('0x37')][_0xa870('0x3a')]?_0x1a8374['attributes']:_0x5d8425[_0xa870('0x33')];if(!_0x1692cc[_0xa870('0x34')]['hasOwnProperty'](_0xa870('0x3b'))){_0x1a8374['limit']=qs[_0xa870('0x22')](_0x1692cc['query'][_0xa870('0x22')]);_0x1a8374[_0xa870('0x1f')]=qs[_0xa870('0x1f')](_0x1692cc[_0xa870('0x34')][_0xa870('0x1f')]);}_0x1a8374[_0xa870('0x3c')]=qs[_0xa870('0x3d')](_0x1692cc[_0xa870('0x34')]['sort']);_0x1a8374[_0xa870('0x3e')]=qs[_0xa870('0x36')](_[_0xa870('0x3f')](_0x1692cc[_0xa870('0x34')],_0x5d8425['filters']),_0x3c11a6);if(_0x1692cc[_0xa870('0x34')][_0xa870('0x40')]){_0x1a8374[_0xa870('0x3e')]=_[_0xa870('0x41')](_0x1a8374[_0xa870('0x3e')],{'$or':_['map'](_0x3c11a6,function(_0x1d14f8){if(_0x1d14f8[_0xa870('0x42')]!=='VIRTUAL'){var _0x1c5233={};_0x1c5233[_0x1d14f8['name']]={'$like':'%'+_0x1692cc[_0xa870('0x34')][_0xa870('0x40')]+'%'};return _0x1c5233;}})});}_0x1a8374=_[_0xa870('0x41')]({},_0x1a8374,_0x1692cc['options']);var _0x1fc01f={'where':_0x1a8374[_0xa870('0x3e')]};return db[_0xa870('0x30')]['count'](_0x1fc01f)[_0xa870('0x28')](function(_0x3a794f){_0x142127[_0xa870('0x21')]=_0x3a794f;if(_0x1692cc[_0xa870('0x34')][_0xa870('0x43')]){_0x1a8374[_0xa870('0x44')]=[{'all':!![]}];}return db[_0xa870('0x30')][_0xa870('0x45')](_0x1a8374);})[_0xa870('0x28')](function(_0xa1b8ff){_0x142127['rows']=_0xa1b8ff;return _0x142127;})[_0xa870('0x28')](respondWithFilteredResult(_0x5c053c,_0x1a8374))[_0xa870('0x46')](handleError(_0x5c053c,null));};exports[_0xa870('0x47')]=function(_0x2354a2,_0x170d53){var _0x226353={'raw':!![],'where':{'id':_0x2354a2[_0xa870('0x48')]['id']}},_0x12aa25={};_0x12aa25[_0xa870('0x33')]=_['keys'](db[_0xa870('0x30')][_0xa870('0x31')]);_0x12aa25[_0xa870('0x34')]=_[_0xa870('0x35')](_0x2354a2[_0xa870('0x34')]);_0x12aa25['filters']=_[_0xa870('0x38')](_0x12aa25[_0xa870('0x33')],_0x12aa25[_0xa870('0x34')]);_0x226353[_0xa870('0x37')]=_[_0xa870('0x38')](_0x12aa25[_0xa870('0x33')],qs['fields'](_0x2354a2['query'][_0xa870('0x39')]));_0x226353[_0xa870('0x37')]=_0x226353['attributes']['length']?_0x226353[_0xa870('0x37')]:_0x12aa25[_0xa870('0x33')];if(_0x2354a2[_0xa870('0x34')][_0xa870('0x43')]){_0x226353[_0xa870('0x44')]=[{'all':!![]}];}_0x226353=_[_0xa870('0x41')]({},_0x226353,_0x2354a2[_0xa870('0x49')]);return db[_0xa870('0x30')][_0xa870('0x4a')](_0x226353)[_0xa870('0x28')](handleEntityNotFound(_0x170d53,null))[_0xa870('0x28')](respondWithResult(_0x170d53,null))[_0xa870('0x46')](handleError(_0x170d53,null));};exports[_0xa870('0x4b')]=function(_0x1cfb02,_0x3e3087){return db[_0xa870('0x30')][_0xa870('0x4b')](_0x1cfb02[_0xa870('0x4c')],{})[_0xa870('0x28')](respondWithResult(_0x3e3087,0xc9))[_0xa870('0x46')](handleError(_0x3e3087,null));};exports[_0xa870('0x27')]=function(_0x53021c,_0x388119){if(_0x53021c[_0xa870('0x4c')]['id']){delete _0x53021c['body']['id'];}return db['VtigerField'][_0xa870('0x4a')]({'where':{'id':_0x53021c[_0xa870('0x48')]['id']}})[_0xa870('0x28')](handleEntityNotFound(_0x388119,null))[_0xa870('0x28')](saveUpdates(_0x53021c[_0xa870('0x4c')],null))['then'](respondWithResult(_0x388119,null))['catch'](handleError(_0x388119,null));};exports[_0xa870('0x29')]=function(_0x3df4bd,_0x3cdfaf){return db[_0xa870('0x30')][_0xa870('0x4a')]({'where':{'id':_0x3df4bd['params']['id']}})[_0xa870('0x28')](handleEntityNotFound(_0x3cdfaf,null))[_0xa870('0x28')](removeEntity(_0x3cdfaf,null))[_0xa870('0x46')](handleError(_0x3cdfaf,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ba8e0d3..e5a9389 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 _0x1e6c=['../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1e6c,0x69));var _0xc1e6=function(_0x18bac5,_0x2e54fc){_0x18bac5=_0x18bac5-0x0;var _0xdc6c44=_0x1e6c[_0x18bac5];return _0xdc6c44;};'use strict';var _=require(_0xc1e6('0x0'));var util=require(_0xc1e6('0x1'));var logger=require(_0xc1e6('0x2'))(_0xc1e6('0x3'));var moment=require(_0xc1e6('0x4'));var BPromise=require('bluebird');var rp=require(_0xc1e6('0x5'));var fs=require('fs');var path=require(_0xc1e6('0x6'));var rimraf=require('rimraf');var config=require(_0xc1e6('0x7'));var attributes=require(_0xc1e6('0x8'));module[_0xc1e6('0x9')]=function(_0x2b21f2,_0x240764){return _0x2b21f2['define'](_0xc1e6('0xa'),attributes,{'tableName':_0xc1e6('0xb'),'paranoid':![],'indexes':[{'name':_0xc1e6('0xc'),'fields':['idField',_0xc1e6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc05e=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','idField','lodash','util','../../config/logger','bluebird'];(function(_0x424b2b,_0x5b2dae){var _0x1b193e=function(_0x53a3d4){while(--_0x53a3d4){_0x424b2b['push'](_0x424b2b['shift']());}};_0x1b193e(++_0x5b2dae);}(_0xc05e,0x1b4));var _0xec05=function(_0x3eb556,_0x19f80d){_0x3eb556=_0x3eb556-0x0;var _0x24ec02=_0xc05e[_0x3eb556];return _0x24ec02;};'use strict';var _=require(_0xec05('0x0'));var util=require(_0xec05('0x1'));var logger=require(_0xec05('0x2'))('api');var moment=require('moment');var BPromise=require(_0xec05('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xec05('0x4'));var config=require('../../config/environment');var attributes=require(_0xec05('0x5'));module[_0xec05('0x6')]=function(_0x1f2978,_0x12654a){return _0x1f2978[_0xec05('0x7')](_0xec05('0x8'),attributes,{'tableName':_0xec05('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xec05('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index b9bde95..17eb26d 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 _0xeba1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0xeba1,0xd8));var _0x1eba=function(_0x48100b,_0x22674a){_0x48100b=_0x48100b-0x0;var _0x35dd0b=_0xeba1[_0x48100b];return _0x35dd0b;};'use strict';var _=require(_0x1eba('0x0'));var util=require(_0x1eba('0x1'));var moment=require(_0x1eba('0x2'));var BPromise=require(_0x1eba('0x3'));var rs=require(_0x1eba('0x4'));var fs=require('fs');var Redis=require(_0x1eba('0x5'));var db=require(_0x1eba('0x6'))['db'];var utils=require(_0x1eba('0x7'));var logger=require(_0x1eba('0x8'))(_0x1eba('0x9'));var config=require(_0x1eba('0xa'));var jayson=require(_0x1eba('0xb'));var client=jayson[_0x1eba('0xc')][_0x1eba('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e5908,_0x4b6f72,_0x2fb418){return new BPromise(function(_0x10235b,_0x5b7d27){return client[_0x1eba('0xe')](_0x4e5908,_0x2fb418)['then'](function(_0x30c626){logger['info'](_0x1eba('0xf'),_0x4b6f72,_0x1eba('0x10'));logger[_0x1eba('0x11')](_0x1eba('0x12'),_0x4b6f72,_0x1eba('0x10'),JSON[_0x1eba('0x13')](_0x30c626));if(_0x30c626[_0x1eba('0x14')]){if(_0x30c626[_0x1eba('0x14')][_0x1eba('0x15')]===0x1f4){logger[_0x1eba('0x14')]('VtigerField,\x20%s,\x20%s',_0x4b6f72,_0x30c626[_0x1eba('0x14')]['message']);return _0x5b7d27(_0x30c626[_0x1eba('0x14')][_0x1eba('0x16')]);}logger[_0x1eba('0x14')](_0x1eba('0xf'),_0x4b6f72,_0x30c626[_0x1eba('0x14')][_0x1eba('0x16')]);return _0x10235b(_0x30c626[_0x1eba('0x14')][_0x1eba('0x16')]);}else{logger['info'](_0x1eba('0xf'),_0x4b6f72,_0x1eba('0x10'));_0x10235b(_0x30c626[_0x1eba('0x17')][_0x1eba('0x16')]);}})['catch'](function(_0x192e52){logger[_0x1eba('0x14')](_0x1eba('0xf'),_0x4b6f72,_0x192e52);_0x5b7d27(_0x192e52);});});} \ No newline at end of file +var _0xd099=['VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug'];(function(_0x467f51,_0x284171){var _0x15dcf2=function(_0x18306b){while(--_0x18306b){_0x467f51['push'](_0x467f51['shift']());}};_0x15dcf2(++_0x284171);}(_0xd099,0x68));var _0x9d09=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0xd099[_0x5216e0];return _0x5b3f40;};'use strict';var _=require(_0x9d09('0x0'));var util=require(_0x9d09('0x1'));var moment=require(_0x9d09('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d09('0x3'));var fs=require('fs');var Redis=require(_0x9d09('0x4'));var db=require(_0x9d09('0x5'))['db'];var utils=require(_0x9d09('0x6'));var logger=require(_0x9d09('0x7'))(_0x9d09('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9d09('0x9')][_0x9d09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4be0e1,_0x3d1c39,_0x42bc40){return new BPromise(function(_0x44b436,_0x31a305){return client[_0x9d09('0xb')](_0x4be0e1,_0x42bc40)[_0x9d09('0xc')](function(_0x385b21){logger[_0x9d09('0xd')](_0x9d09('0xe'),_0x3d1c39,'request\x20sent');logger[_0x9d09('0xf')](_0x9d09('0x10'),_0x3d1c39,_0x9d09('0x11'),JSON[_0x9d09('0x12')](_0x385b21));if(_0x385b21['error']){if(_0x385b21[_0x9d09('0x13')][_0x9d09('0x14')]===0x1f4){logger[_0x9d09('0x13')]('VtigerField,\x20%s,\x20%s',_0x3d1c39,_0x385b21['error']['message']);return _0x31a305(_0x385b21['error']['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x3d1c39,_0x385b21[_0x9d09('0x13')][_0x9d09('0x15')]);return _0x44b436(_0x385b21[_0x9d09('0x13')]['message']);}else{logger[_0x9d09('0xd')](_0x9d09('0xe'),_0x3d1c39,_0x9d09('0x11'));_0x44b436(_0x385b21[_0x9d09('0x16')]['message']);}})[_0x9d09('0x17')](function(_0x5af809){logger[_0x9d09('0x13')](_0x9d09('0xe'),_0x3d1c39,_0x5af809);_0x31a305(_0x5af809);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 85ec976..d4cdc61 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 _0xdf39=['update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intZendeskAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put'];(function(_0xd60cb,_0x25496e){var _0x47eecd=function(_0x19c183){while(--_0x19c183){_0xd60cb['push'](_0xd60cb['shift']());}};_0x47eecd(++_0x25496e);}(_0xdf39,0x1bb));var _0x9df3=function(_0x33f1fb,_0x3ab074){_0x33f1fb=_0x33f1fb-0x0;var _0x40c575=_0xdf39[_0x33f1fb];return _0x40c575;};'use strict';var multer=require(_0x9df3('0x0'));var util=require(_0x9df3('0x1'));var path=require('path');var timeout=require(_0x9df3('0x2'));var express=require(_0x9df3('0x3'));var router=express[_0x9df3('0x4')]();var fs_extra=require(_0x9df3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9df3('0x6'));var controller=require(_0x9df3('0x7'));router['get']('/',auth[_0x9df3('0x8')](),controller['index']);router[_0x9df3('0x9')](_0x9df3('0xa'),auth[_0x9df3('0x8')](),controller[_0x9df3('0xb')]);router[_0x9df3('0x9')](_0x9df3('0xc'),auth[_0x9df3('0x8')](),controller[_0x9df3('0xd')]);router[_0x9df3('0x9')]('/:id/fields',auth[_0x9df3('0x8')](),controller[_0x9df3('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9df3('0xf')]);router[_0x9df3('0x10')]('/:id/configurations',auth[_0x9df3('0x8')](),controller[_0x9df3('0x11')]);router[_0x9df3('0x12')](_0x9df3('0xa'),auth[_0x9df3('0x8')](),controller[_0x9df3('0x13')]);router['delete'](_0x9df3('0xa'),auth[_0x9df3('0x8')](),controller[_0x9df3('0x14')]);module[_0x9df3('0x15')]=router; \ No newline at end of file +var _0xa635=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','/:id','show','isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy'];(function(_0x40f6a3,_0x52c0b7){var _0x4f3511=function(_0x166649){while(--_0x166649){_0x40f6a3['push'](_0x40f6a3['shift']());}};_0x4f3511(++_0x52c0b7);}(_0xa635,0x73));var _0x5a63=function(_0x39b710,_0x195461){_0x39b710=_0x39b710-0x0;var _0x1bbfe9=_0xa635[_0x39b710];return _0x1bbfe9;};'use strict';var multer=require(_0x5a63('0x0'));var util=require(_0x5a63('0x1'));var path=require(_0x5a63('0x2'));var timeout=require(_0x5a63('0x3'));var express=require(_0x5a63('0x4'));var router=express[_0x5a63('0x5')]();var fs_extra=require(_0x5a63('0x6'));var auth=require(_0x5a63('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5a63('0x8'));var controller=require(_0x5a63('0x9'));router[_0x5a63('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5a63('0xa')](_0x5a63('0xb'),auth['isAuthenticated'](),controller[_0x5a63('0xc')]);router['get']('/:id/configurations',auth[_0x5a63('0xd')](),controller['getConfigurations']);router[_0x5a63('0xa')](_0x5a63('0xe'),auth[_0x5a63('0xd')](),controller[_0x5a63('0xf')]);router[_0x5a63('0x10')]('/',auth[_0x5a63('0xd')](),controller[_0x5a63('0x11')]);router[_0x5a63('0x10')](_0x5a63('0x12'),auth[_0x5a63('0xd')](),controller[_0x5a63('0x13')]);router[_0x5a63('0x14')](_0x5a63('0xb'),auth[_0x5a63('0xd')](),controller['update']);router[_0x5a63('0x15')](_0x5a63('0xb'),auth['isAuthenticated'](),controller[_0x5a63('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 248a615..b745ba6 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 _0xd991=['remoteUri','ENUM','password','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x29ee0a,_0x2e019b){var _0x54efbf=function(_0x3c2377){while(--_0x3c2377){_0x29ee0a['push'](_0x29ee0a['shift']());}};_0x54efbf(++_0x2e019b);}(_0xd991,0x115));var _0x1d99=function(_0x44a233,_0x1b133f){_0x44a233=_0x44a233-0x0;var _0x272ff3=_0xd991[_0x44a233];return _0x272ff3;};'use strict';var Sequelize=require(_0x1d99('0x0'));module[_0x1d99('0x1')]={'name':{'type':Sequelize[_0x1d99('0x2')]},'description':{'type':Sequelize[_0x1d99('0x2')]},'username':{'type':Sequelize[_0x1d99('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x1d99('0x2')]},'token':{'type':Sequelize[_0x1d99('0x2')]},'remoteUri':{'type':Sequelize[_0x1d99('0x2')],'unique':_0x1d99('0x3')},'authType':{'type':Sequelize[_0x1d99('0x4')](_0x1d99('0x5'),'token'),'defaultValue':_0x1d99('0x5')},'serverUrl':{'type':Sequelize[_0x1d99('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1d99('0x6'),_0x1d99('0x7')),'defaultValue':_0x1d99('0x6')}}; \ No newline at end of file +var _0x90b1=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username','password'];(function(_0x5e3291,_0x360223){var _0x32072b=function(_0x25b36a){while(--_0x25b36a){_0x5e3291['push'](_0x5e3291['shift']());}};_0x32072b(++_0x360223);}(_0x90b1,0x1bb));var _0x190b=function(_0x53f122,_0x2cdeca){_0x53f122=_0x53f122-0x0;var _0x59a134=_0x90b1[_0x53f122];return _0x59a134;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'name':{'type':Sequelize[_0x190b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x190b('0x3')},'password':{'type':Sequelize[_0x190b('0x2')]},'token':{'type':Sequelize[_0x190b('0x2')]},'remoteUri':{'type':Sequelize[_0x190b('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password','token'),'defaultValue':_0x190b('0x4')},'serverUrl':{'type':Sequelize[_0x190b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x190b('0x5')](_0x190b('0x6'),_0x190b('0x7')),'defaultValue':_0x190b('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index aa6f8fd..2c8a983 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 _0x04b8=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','catch','keys','include','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x468abd,_0x11b6dd){var _0x833467=function(_0xfedf03){while(--_0xfedf03){_0x468abd['push'](_0x468abd['shift']());}};_0x833467(++_0x11b6dd);}(_0x04b8,0x159));var _0x804b=function(_0x5a3c3c,_0x2740df){_0x5a3c3c=_0x5a3c3c-0x0;var _0x29a9ac=_0x04b8[_0x5a3c3c];return _0x29a9ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x804b('0x18'));function respondWithStatusCode(_0x5303cc,_0x23ee57){_0x23ee57=_0x23ee57||0xcc;return function(_0x3a2702){if(_0x3a2702){return _0x5303cc[_0x804b('0x19')](_0x23ee57);}return _0x5303cc[_0x804b('0x1a')](_0x23ee57)['end']();};}function respondWithResult(_0x215825,_0x1b01a7){_0x1b01a7=_0x1b01a7||0xc8;return function(_0x274bb8){if(_0x274bb8){return _0x215825[_0x804b('0x1a')](_0x1b01a7)['json'](_0x274bb8);}};}function respondWithFilteredResult(_0x2fd593,_0x8ccbe0){return function(_0x5e1cfe){if(_0x5e1cfe){var _0x3c5986=typeof _0x8ccbe0['offset']===_0x804b('0x1b')&&typeof _0x8ccbe0[_0x804b('0x1c')]===_0x804b('0x1b');var _0x1760f8=_0x5e1cfe[_0x804b('0x1d')];var _0x5a0a82=_0x3c5986?0x0:_0x8ccbe0[_0x804b('0x1e')];var _0x50b4fe=_0x3c5986?_0x5e1cfe[_0x804b('0x1d')]:_0x8ccbe0[_0x804b('0x1e')]+_0x8ccbe0[_0x804b('0x1c')];var _0x469251;if(_0x50b4fe>=_0x1760f8){_0x50b4fe=_0x1760f8;_0x469251=0xc8;}else{_0x469251=0xce;}_0x2fd593['status'](_0x469251);return _0x2fd593[_0x804b('0x1f')](_0x804b('0x20'),_0x5a0a82+'-'+_0x50b4fe+'/'+_0x1760f8)[_0x804b('0x21')](_0x5e1cfe);}return null;};}function patchUpdates(_0x11eaf6){return function(_0x27844b){try{jsonpatch[_0x804b('0x22')](_0x27844b,_0x11eaf6,!![]);}catch(_0x3241a0){return BPromise[_0x804b('0x23')](_0x3241a0);}return _0x27844b[_0x804b('0x24')]();};}function saveUpdates(_0x2b7271,_0x1acc48){return function(_0x5a968b){if(_0x5a968b){return _0x5a968b[_0x804b('0x25')](_0x2b7271)[_0x804b('0x26')](function(_0x5585f8){return _0x5585f8;});}return null;};}function removeEntity(_0x44a921,_0x367024){return function(_0x115b8f){if(_0x115b8f){return _0x115b8f[_0x804b('0x27')]()[_0x804b('0x26')](function(){_0x44a921['status'](0xcc)[_0x804b('0x28')]();});}};}function handleEntityNotFound(_0x7d9c33,_0x4e7266){return function(_0x12b6a6){if(!_0x12b6a6){_0x7d9c33[_0x804b('0x19')](0x194);}return _0x12b6a6;};}function handleError(_0x1117a5,_0x27d5ec){_0x27d5ec=_0x27d5ec||0x1f4;return function(_0x2d88da){logger['error'](_0x2d88da[_0x804b('0x29')]);if(_0x2d88da[_0x804b('0x2a')]){delete _0x2d88da[_0x804b('0x2a')];}_0x1117a5[_0x804b('0x1a')](_0x27d5ec)[_0x804b('0x2b')](_0x2d88da);};}exports['index']=function(_0x3eb531,_0x2931ff){var _0x410871={},_0x5c7026={},_0x3dbd41={'count':0x0,'rows':[]};var _0x407357=_[_0x804b('0x2c')](db['ZendeskAccount'][_0x804b('0x2d')],function(_0x471c04){return{'name':_0x471c04['fieldName'],'type':_0x471c04[_0x804b('0x2e')][_0x804b('0x2f')]};});_0x5c7026[_0x804b('0x30')]=_[_0x804b('0x2c')](_0x407357,_0x804b('0x2a'));_0x5c7026[_0x804b('0x31')]=_['keys'](_0x3eb531[_0x804b('0x31')]);_0x5c7026[_0x804b('0x32')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],_0x5c7026[_0x804b('0x31')]);_0x410871[_0x804b('0x34')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],qs[_0x804b('0x35')](_0x3eb531[_0x804b('0x31')][_0x804b('0x35')]));_0x410871[_0x804b('0x34')]=_0x410871[_0x804b('0x34')][_0x804b('0x36')]?_0x410871[_0x804b('0x34')]:_0x5c7026[_0x804b('0x30')];if(!_0x3eb531[_0x804b('0x31')][_0x804b('0x37')](_0x804b('0x38'))){_0x410871[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3eb531[_0x804b('0x31')][_0x804b('0x1c')]);_0x410871[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3eb531['query']['offset']);}_0x410871['order']=qs[_0x804b('0x39')](_0x3eb531[_0x804b('0x31')][_0x804b('0x39')]);_0x410871['where']=qs['filters'](_['pick'](_0x3eb531[_0x804b('0x31')],_0x5c7026[_0x804b('0x32')]),_0x407357);if(_0x3eb531[_0x804b('0x31')][_0x804b('0x3a')]){_0x410871[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x410871[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x407357,function(_0x27ba88){if(_0x27ba88[_0x804b('0x2e')]!==_0x804b('0x3d')){var _0x22a3fa={};_0x22a3fa[_0x27ba88[_0x804b('0x2a')]]={'$like':'%'+_0x3eb531['query'][_0x804b('0x3a')]+'%'};return _0x22a3fa;}})});}_0x410871=_[_0x804b('0x3c')]({},_0x410871,_0x3eb531[_0x804b('0x3e')]);var _0x3d6d8a={'where':_0x410871[_0x804b('0x3b')]};return db['ZendeskAccount']['count'](_0x3d6d8a)[_0x804b('0x26')](function(_0x2afafd){_0x3dbd41[_0x804b('0x1d')]=_0x2afafd;if(_0x3eb531['query'][_0x804b('0x3f')]){_0x410871['include']=[{'all':!![]}];}return db[_0x804b('0x40')][_0x804b('0x41')](_0x410871);})[_0x804b('0x26')](function(_0x304710){_0x3dbd41[_0x804b('0x42')]=_0x304710;return _0x3dbd41;})[_0x804b('0x26')](respondWithFilteredResult(_0x2931ff,_0x410871))[_0x804b('0x43')](handleError(_0x2931ff,null));};exports['show']=function(_0x17972a,_0x1c0363){var _0x1dcec8={'raw':![],'where':{'id':_0x17972a['params']['id']}},_0x1d25f6={};_0x1d25f6[_0x804b('0x30')]=_[_0x804b('0x44')](db[_0x804b('0x40')][_0x804b('0x2d')]);_0x1d25f6[_0x804b('0x31')]=_[_0x804b('0x44')](_0x17972a[_0x804b('0x31')]);_0x1d25f6[_0x804b('0x32')]=_['intersection'](_0x1d25f6[_0x804b('0x30')],_0x1d25f6['query']);_0x1dcec8['attributes']=_['intersection'](_0x1d25f6[_0x804b('0x30')],qs['fields'](_0x17972a[_0x804b('0x31')][_0x804b('0x35')]));_0x1dcec8[_0x804b('0x34')]=_0x1dcec8[_0x804b('0x34')]['length']?_0x1dcec8[_0x804b('0x34')]:_0x1d25f6[_0x804b('0x30')];if(_0x17972a[_0x804b('0x31')]['includeAll']){_0x1dcec8[_0x804b('0x45')]=[{'all':!![]}];}_0x1dcec8=_[_0x804b('0x3c')]({},_0x1dcec8,_0x17972a[_0x804b('0x3e')]);return db['ZendeskAccount'][_0x804b('0x46')](_0x1dcec8)[_0x804b('0x26')](handleEntityNotFound(_0x1c0363,null))[_0x804b('0x26')](respondWithResult(_0x1c0363,null))[_0x804b('0x43')](handleError(_0x1c0363,null));};exports[_0x804b('0x47')]=function(_0x3a39f5,_0x392bc0){return db[_0x804b('0x40')][_0x804b('0x47')](_0x3a39f5[_0x804b('0x48')],{})[_0x804b('0x26')](respondWithResult(_0x392bc0,0xc9))[_0x804b('0x43')](handleError(_0x392bc0,null));};exports[_0x804b('0x25')]=function(_0x2c1796,_0x578e92){if(_0x2c1796['body']['id']){delete _0x2c1796[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x46')]({'where':{'id':_0x2c1796[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x578e92,null))['then'](saveUpdates(_0x2c1796[_0x804b('0x48')],null))[_0x804b('0x26')](respondWithResult(_0x578e92,null))[_0x804b('0x43')](handleError(_0x578e92,null));};exports[_0x804b('0x27')]=function(_0x47247c,_0x111e3f){return db['ZendeskAccount']['find']({'where':{'id':_0x47247c[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x111e3f,null))['then'](removeEntity(_0x111e3f,null))['catch'](handleError(_0x111e3f,null));};exports[_0x804b('0x4a')]=function(_0x3d56bb,_0x4a5068,_0x4efe2a){var _0x164c5d={};var _0x38c2c0={};var _0x54cc99;var _0x2756de;return db['ZendeskAccount'][_0x804b('0x4b')]({'where':{'id':_0x3d56bb['params']['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4a5068,null))[_0x804b('0x26')](function(_0x47c835){if(_0x47c835){_0x54cc99=_0x47c835;_0x38c2c0[_0x804b('0x30')]=_['keys'](db[_0x804b('0x4c')][_0x804b('0x2d')]);_0x38c2c0[_0x804b('0x31')]=_[_0x804b('0x44')](_0x3d56bb[_0x804b('0x31')]);_0x38c2c0[_0x804b('0x32')]=_[_0x804b('0x33')](_0x38c2c0[_0x804b('0x30')],_0x38c2c0[_0x804b('0x31')]);_0x164c5d[_0x804b('0x34')]=_['intersection'](_0x38c2c0['model'],qs[_0x804b('0x35')](_0x3d56bb['query']['fields']));_0x164c5d[_0x804b('0x34')]=_0x164c5d[_0x804b('0x34')][_0x804b('0x36')]?_0x164c5d[_0x804b('0x34')]:_0x38c2c0['model'];_0x164c5d['order']=qs[_0x804b('0x39')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x39')]);_0x164c5d[_0x804b('0x3b')]=qs[_0x804b('0x32')](_[_0x804b('0x4d')](_0x3d56bb[_0x804b('0x31')],_0x38c2c0[_0x804b('0x32')]));if(_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]){_0x164c5d[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x164c5d[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x164c5d[_0x804b('0x34')],function(_0x3d98a2){var _0x524291={};_0x524291[_0x3d98a2]={'$like':'%'+_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]+'%'};return _0x524291;})});}_0x164c5d=_['merge']({},_0x164c5d,_0x3d56bb[_0x804b('0x3e')]);return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})[_0x804b('0x26')](function(_0x2576a4){if(_0x2576a4){_0x2756de=_0x2576a4['length'];if(!_0x3d56bb[_0x804b('0x31')][_0x804b('0x37')]('nolimit')){_0x164c5d[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3d56bb[_0x804b('0x31')]['limit']);_0x164c5d[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x1e')]);}return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})['then'](function(_0xb08c4e){if(_0xb08c4e){return _0xb08c4e?{'count':_0x2756de,'rows':_0xb08c4e}:null;}})[_0x804b('0x26')](respondWithResult(_0x4a5068,null))[_0x804b('0x43')](handleError(_0x4a5068,null));};exports[_0x804b('0x4e')]=function(_0x5dcc63,_0x4f8a81,_0x183796){if(_0x5dcc63['body']['id']){delete _0x5dcc63[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x4b')]({'where':{'id':_0x5dcc63[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4f8a81,null))['then'](function(_0x27f06c){if(_0x27f06c){_0x5dcc63[_0x804b('0x48')][_0x804b('0x4f')]=_0x27f06c['id'];_0x5dcc63['body'][_0x804b('0x50')]=integrations[_0x804b('0x51')](_0x5dcc63['body'][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);_0x5dcc63[_0x804b('0x48')]['Descriptions']=integrations[_0x804b('0x53')](_0x5dcc63[_0x804b('0x48')][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);return db['ZendeskConfiguration'][_0x804b('0x47')](_0x5dcc63[_0x804b('0x48')],{'include':[{'model':db[_0x804b('0x54')],'as':_0x804b('0x50')},{'model':db['ZendeskField'],'as':_0x804b('0x55')}]});}return null;})[_0x804b('0x26')](respondWithResult(_0x4f8a81,null))[_0x804b('0x43')](handleError(_0x4f8a81,null));};exports[_0x804b('0x56')]=function(_0x17e21c,_0x1bb4ec,_0x5b3b79){var _0x39ed3c='';return db[_0x804b('0x40')]['findOne']({'where':{'id':_0x17e21c[_0x804b('0x49')]['id']},'attributes':['id',_0x804b('0x57'),_0x804b('0x58'),_0x804b('0x59'),'authType',_0x804b('0x5a')]})[_0x804b('0x26')](handleEntityNotFound(_0x1bb4ec,null))['then'](function(_0x2541cd){if(_0x2541cd){_0x39ed3c=_0x2541cd[_0x804b('0x5a')];var _0x549504=_0x39ed3c[_0x804b('0x5b')](-0x1);if(_0x549504==='/'){_0x39ed3c=_0x39ed3c['substring'](0x0,_0x39ed3c[_0x804b('0x5c')](_0x549504));}var _0x3e2813={'method':_0x804b('0x5d'),'uri':util[_0x804b('0x5e')](_0x804b('0x5f'),_0x39ed3c,_0x804b('0x60')),'json':!![]};switch(_0x2541cd[_0x804b('0x61')]){case'password':_0x3e2813[_0x804b('0x62')]={'Authorization':util['format'](_0x804b('0x63'),new Buffer(util[_0x804b('0x5e')](_0x804b('0x64'),_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x58')]))[_0x804b('0x65')](_0x804b('0x66')))};break;case _0x804b('0x59'):_0x3e2813[_0x804b('0x62')]={'Authorization':util[_0x804b('0x5e')](_0x804b('0x63'),new Buffer(util['format']('%s/token:%s',_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x59')]))[_0x804b('0x65')](_0x804b('0x66')))};break;default:throw new db['Sequelize'][(_0x804b('0x67'))](_0x804b('0x68'));}return rp(_0x3e2813);}})[_0x804b('0x26')](function(_0x3dda89){if(_0x3dda89){var _0x260419=[_0x804b('0x69'),_0x804b('0x6a'),_0x804b('0x6b'),_0x804b('0x6c')];_[_0x804b('0x6d')](_0x3dda89['ticket_fields'],function(_0x5a6661){return _0x260419[_0x804b('0x6e')](_0x5a6661[_0x804b('0x2e')]);});return{'count':_0x3dda89['ticket_fields'][_0x804b('0x36')],'rows':_[_0x804b('0x2c')](_0x3dda89['ticket_fields'],function(_0x345bf7){return{'id':_0x345bf7['id'],'name':_0x345bf7['position']>0x7?_0x345bf7['title']:_0x345bf7[_0x804b('0x2e')],'custom':_0x345bf7[_0x804b('0x6f')]>0x7?!![]:![],'options':_0x345bf7['system_field_options']?_0x345bf7['system_field_options']:_0x345bf7[_0x804b('0x70')]?_0x345bf7[_0x804b('0x70')]:[]};})};}})['then'](respondWithResult(_0x1bb4ec,null))[_0x804b('0x43')](function(_0x5e2756){var _0x42dfc3=_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?0x1f4:_0x5e2756['statusCode']||0x1f4;logger[_0x804b('0x72')](_0x804b('0x73'),_0x804b('0x56'),_0x42dfc3,JSON[_0x804b('0x74')](_0x5e2756));delete _0x5e2756[_0x804b('0x2a')];if(_0x42dfc3===0x191){_0x42dfc3=0x190;}_0x1bb4ec[_0x804b('0x1a')](_0x42dfc3)[_0x804b('0x2b')](_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?{'message':_0x804b('0x75'),'statusCode':_0x5e2756['statusCode']}:_0x5e2756);});}; \ No newline at end of file +var _0x80ed=['rawAttributes','sort','pick','filter','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','authType','remoteUri','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','toString','%s/token:%s','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes','position','system_field_options','custom_field_options','test','statusCode','error','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','sendStatus','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','ZendeskAccount','findAll','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne'];(function(_0x3175e6,_0x126421){var _0x321dc5=function(_0x15ccc1){while(--_0x15ccc1){_0x3175e6['push'](_0x3175e6['shift']());}};_0x321dc5(++_0x126421);}(_0x80ed,0x11c));var _0xd80e=function(_0x2fc1ec,_0x4b96e7){_0x2fc1ec=_0x2fc1ec-0x0;var _0x11a7fa=_0x80ed[_0x2fc1ec];return _0x11a7fa;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];var integrations=require(_0xd80e('0x1b'));function respondWithStatusCode(_0x1d3fcf,_0x4fb01c){_0x4fb01c=_0x4fb01c||0xcc;return function(_0x5691a1){if(_0x5691a1){return _0x1d3fcf['sendStatus'](_0x4fb01c);}return _0x1d3fcf['status'](_0x4fb01c)[_0xd80e('0x1c')]();};}function respondWithResult(_0x3d233b,_0x3096ae){_0x3096ae=_0x3096ae||0xc8;return function(_0x1e8b63){if(_0x1e8b63){return _0x3d233b[_0xd80e('0x1d')](_0x3096ae)['json'](_0x1e8b63);}};}function respondWithFilteredResult(_0x595683,_0x2c8c61){return function(_0x3124e8){if(_0x3124e8){var _0x3b48ae=typeof _0x2c8c61[_0xd80e('0x1e')]===_0xd80e('0x1f')&&typeof _0x2c8c61[_0xd80e('0x20')]===_0xd80e('0x1f');var _0x49e3e5=_0x3124e8[_0xd80e('0x21')];var _0x1cc576=_0x3b48ae?0x0:_0x2c8c61[_0xd80e('0x1e')];var _0x34e239=_0x3b48ae?_0x3124e8['count']:_0x2c8c61[_0xd80e('0x1e')]+_0x2c8c61[_0xd80e('0x20')];var _0xecfe74;if(_0x34e239>=_0x49e3e5){_0x34e239=_0x49e3e5;_0xecfe74=0xc8;}else{_0xecfe74=0xce;}_0x595683['status'](_0xecfe74);return _0x595683[_0xd80e('0x22')](_0xd80e('0x23'),_0x1cc576+'-'+_0x34e239+'/'+_0x49e3e5)[_0xd80e('0x24')](_0x3124e8);}return null;};}function patchUpdates(_0x147134){return function(_0x46b6eb){try{jsonpatch['apply'](_0x46b6eb,_0x147134,!![]);}catch(_0x4b6b8a){return BPromise[_0xd80e('0x25')](_0x4b6b8a);}return _0x46b6eb[_0xd80e('0x26')]();};}function saveUpdates(_0x3b39bf,_0x2d46e7){return function(_0x3eb3ca){if(_0x3eb3ca){return _0x3eb3ca[_0xd80e('0x27')](_0x3b39bf)[_0xd80e('0x28')](function(_0x5430b6){return _0x5430b6;});}return null;};}function removeEntity(_0x1fbf8a,_0x57d70){return function(_0x170109){if(_0x170109){return _0x170109['destroy']()[_0xd80e('0x28')](function(){_0x1fbf8a[_0xd80e('0x1d')](0xcc)[_0xd80e('0x1c')]();});}};}function handleEntityNotFound(_0x482779,_0x521aa4){return function(_0x5420e7){if(!_0x5420e7){_0x482779[_0xd80e('0x29')](0x194);}return _0x5420e7;};}function handleError(_0x4b8291,_0x9f9287){_0x9f9287=_0x9f9287||0x1f4;return function(_0x1044cc){logger['error'](_0x1044cc[_0xd80e('0x2a')]);if(_0x1044cc[_0xd80e('0x2b')]){delete _0x1044cc[_0xd80e('0x2b')];}_0x4b8291[_0xd80e('0x1d')](_0x9f9287)['send'](_0x1044cc);};}exports[_0xd80e('0x2c')]=function(_0x1ad3bc,_0x845451){var _0x39088b={},_0x2b1aaf={},_0x361946={'count':0x0,'rows':[]};var _0x289685=_[_0xd80e('0x2d')](db['ZendeskAccount']['rawAttributes'],function(_0x30f9bd){return{'name':_0x30f9bd[_0xd80e('0x2e')],'type':_0x30f9bd[_0xd80e('0x2f')][_0xd80e('0x30')]};});_0x2b1aaf[_0xd80e('0x31')]=_[_0xd80e('0x2d')](_0x289685,'name');_0x2b1aaf['query']=_[_0xd80e('0x32')](_0x1ad3bc[_0xd80e('0x33')]);_0x2b1aaf[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x2b1aaf[_0xd80e('0x31')],_0x2b1aaf[_0xd80e('0x33')]);_0x39088b[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2b1aaf['model'],qs['fields'](_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x37')]));_0x39088b[_0xd80e('0x36')]=_0x39088b[_0xd80e('0x36')][_0xd80e('0x38')]?_0x39088b[_0xd80e('0x36')]:_0x2b1aaf[_0xd80e('0x31')];if(!_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x39088b['limit']=qs[_0xd80e('0x20')](_0x1ad3bc['query'][_0xd80e('0x20')]);_0x39088b[_0xd80e('0x1e')]=qs[_0xd80e('0x1e')](_0x1ad3bc[_0xd80e('0x33')]['offset']);}_0x39088b[_0xd80e('0x3b')]=qs['sort'](_0x1ad3bc[_0xd80e('0x33')]['sort']);_0x39088b[_0xd80e('0x3c')]=qs[_0xd80e('0x34')](_['pick'](_0x1ad3bc[_0xd80e('0x33')],_0x2b1aaf[_0xd80e('0x34')]),_0x289685);if(_0x1ad3bc[_0xd80e('0x33')]['filter']){_0x39088b[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x39088b[_0xd80e('0x3c')],{'$or':_[_0xd80e('0x2d')](_0x289685,function(_0x3c6f5f){if(_0x3c6f5f[_0xd80e('0x2f')]!==_0xd80e('0x3e')){var _0x137552={};_0x137552[_0x3c6f5f[_0xd80e('0x2b')]]={'$like':'%'+_0x1ad3bc['query']['filter']+'%'};return _0x137552;}})});}_0x39088b=_['merge']({},_0x39088b,_0x1ad3bc[_0xd80e('0x3f')]);var _0x3ff4b4={'where':_0x39088b['where']};return db[_0xd80e('0x40')]['count'](_0x3ff4b4)[_0xd80e('0x28')](function(_0x5ade19){_0x361946[_0xd80e('0x21')]=_0x5ade19;if(_0x1ad3bc[_0xd80e('0x33')]['includeAll']){_0x39088b['include']=[{'all':!![]}];}return db[_0xd80e('0x40')][_0xd80e('0x41')](_0x39088b);})[_0xd80e('0x28')](function(_0x3e65a7){_0x361946[_0xd80e('0x42')]=_0x3e65a7;return _0x361946;})[_0xd80e('0x28')](respondWithFilteredResult(_0x845451,_0x39088b))[_0xd80e('0x43')](handleError(_0x845451,null));};exports[_0xd80e('0x44')]=function(_0x91c6ed,_0x2da5f5){var _0x1bbb36={'raw':![],'where':{'id':_0x91c6ed[_0xd80e('0x45')]['id']}},_0x2e257e={};_0x2e257e[_0xd80e('0x31')]=_[_0xd80e('0x32')](db[_0xd80e('0x40')]['rawAttributes']);_0x2e257e['query']=_['keys'](_0x91c6ed[_0xd80e('0x33')]);_0x2e257e['filters']=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],_0x2e257e[_0xd80e('0x33')]);_0x1bbb36[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],qs['fields'](_0x91c6ed['query']['fields']));_0x1bbb36[_0xd80e('0x36')]=_0x1bbb36['attributes'][_0xd80e('0x38')]?_0x1bbb36[_0xd80e('0x36')]:_0x2e257e[_0xd80e('0x31')];if(_0x91c6ed[_0xd80e('0x33')][_0xd80e('0x46')]){_0x1bbb36['include']=[{'all':!![]}];}_0x1bbb36=_[_0xd80e('0x3d')]({},_0x1bbb36,_0x91c6ed[_0xd80e('0x3f')]);return db[_0xd80e('0x40')]['find'](_0x1bbb36)[_0xd80e('0x28')](handleEntityNotFound(_0x2da5f5,null))[_0xd80e('0x28')](respondWithResult(_0x2da5f5,null))[_0xd80e('0x43')](handleError(_0x2da5f5,null));};exports['create']=function(_0x8d5cb8,_0x29aaa0){return db[_0xd80e('0x40')][_0xd80e('0x47')](_0x8d5cb8[_0xd80e('0x48')],{})[_0xd80e('0x28')](respondWithResult(_0x29aaa0,0xc9))['catch'](handleError(_0x29aaa0,null));};exports['update']=function(_0x275985,_0x27134e){if(_0x275985[_0xd80e('0x48')]['id']){delete _0x275985['body']['id'];}return db['ZendeskAccount'][_0xd80e('0x49')]({'where':{'id':_0x275985[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x27134e,null))[_0xd80e('0x28')](saveUpdates(_0x275985[_0xd80e('0x48')],null))['then'](respondWithResult(_0x27134e,null))[_0xd80e('0x43')](handleError(_0x27134e,null));};exports['destroy']=function(_0x46c781,_0x31107b){return db['ZendeskAccount'][_0xd80e('0x49')]({'where':{'id':_0x46c781[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x31107b,null))[_0xd80e('0x28')](removeEntity(_0x31107b,null))[_0xd80e('0x43')](handleError(_0x31107b,null));};exports[_0xd80e('0x4a')]=function(_0x18dbb0,_0x50be26,_0x178c51){var _0x377e68={};var _0x419df7={};var _0x4a66ca;var _0x52ab04;return db[_0xd80e('0x40')][_0xd80e('0x4b')]({'where':{'id':_0x18dbb0[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x50be26,null))[_0xd80e('0x28')](function(_0x8b7a70){if(_0x8b7a70){_0x4a66ca=_0x8b7a70;_0x419df7[_0xd80e('0x31')]=_[_0xd80e('0x32')](db['ZendeskConfiguration'][_0xd80e('0x4c')]);_0x419df7['query']=_[_0xd80e('0x32')](_0x18dbb0[_0xd80e('0x33')]);_0x419df7[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x419df7[_0xd80e('0x31')],_0x419df7[_0xd80e('0x33')]);_0x377e68['attributes']=_[_0xd80e('0x35')](_0x419df7['model'],qs[_0xd80e('0x37')](_0x18dbb0[_0xd80e('0x33')]['fields']));_0x377e68['attributes']=_0x377e68[_0xd80e('0x36')][_0xd80e('0x38')]?_0x377e68[_0xd80e('0x36')]:_0x419df7['model'];_0x377e68['order']=qs[_0xd80e('0x4d')](_0x18dbb0[_0xd80e('0x33')]['sort']);_0x377e68[_0xd80e('0x3c')]=qs[_0xd80e('0x34')](_[_0xd80e('0x4e')](_0x18dbb0['query'],_0x419df7[_0xd80e('0x34')]));if(_0x18dbb0['query'][_0xd80e('0x4f')]){_0x377e68[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x377e68[_0xd80e('0x3c')],{'$or':_['map'](_0x377e68[_0xd80e('0x36')],function(_0x564475){var _0x53b784={};_0x53b784[_0x564475]={'$like':'%'+_0x18dbb0['query'][_0xd80e('0x4f')]+'%'};return _0x53b784;})});}_0x377e68=_[_0xd80e('0x3d')]({},_0x377e68,_0x18dbb0[_0xd80e('0x3f')]);return _0x4a66ca[_0xd80e('0x4a')](_0x377e68);}})['then'](function(_0x1738ff){if(_0x1738ff){_0x52ab04=_0x1738ff[_0xd80e('0x38')];if(!_0x18dbb0['query'][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x377e68[_0xd80e('0x20')]=qs[_0xd80e('0x20')](_0x18dbb0['query'][_0xd80e('0x20')]);_0x377e68[_0xd80e('0x1e')]=qs['offset'](_0x18dbb0[_0xd80e('0x33')][_0xd80e('0x1e')]);}return _0x4a66ca[_0xd80e('0x4a')](_0x377e68);}})['then'](function(_0x562ed7){if(_0x562ed7){return _0x562ed7?{'count':_0x52ab04,'rows':_0x562ed7}:null;}})['then'](respondWithResult(_0x50be26,null))['catch'](handleError(_0x50be26,null));};exports[_0xd80e('0x50')]=function(_0x4f283c,_0x3c8ad1,_0x1b0ad4){if(_0x4f283c[_0xd80e('0x48')]['id']){delete _0x4f283c['body']['id'];}return db[_0xd80e('0x40')][_0xd80e('0x4b')]({'where':{'id':_0x4f283c[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x3c8ad1,null))[_0xd80e('0x28')](function(_0x2a34cd){if(_0x2a34cd){_0x4f283c[_0xd80e('0x48')][_0xd80e('0x51')]=_0x2a34cd['id'];_0x4f283c[_0xd80e('0x48')]['Subjects']=integrations['getSubjects'](_0x4f283c[_0xd80e('0x48')][_0xd80e('0x52')],_0x4f283c[_0xd80e('0x48')][_0xd80e('0x2f')]);_0x4f283c['body'][_0xd80e('0x53')]=integrations[_0xd80e('0x54')](_0x4f283c[_0xd80e('0x48')][_0xd80e('0x52')],_0x4f283c[_0xd80e('0x48')]['type']);return db[_0xd80e('0x55')][_0xd80e('0x47')](_0x4f283c[_0xd80e('0x48')],{'include':[{'model':db[_0xd80e('0x56')],'as':'Subjects'},{'model':db[_0xd80e('0x56')],'as':_0xd80e('0x53')}]});}return null;})[_0xd80e('0x28')](respondWithResult(_0x3c8ad1,null))[_0xd80e('0x43')](handleError(_0x3c8ad1,null));};exports[_0xd80e('0x57')]=function(_0x1edcf4,_0x5cb11c,_0x3e3176){var _0x393fb6='';return db['ZendeskAccount'][_0xd80e('0x4b')]({'where':{'id':_0x1edcf4[_0xd80e('0x45')]['id']},'attributes':['id',_0xd80e('0x58'),_0xd80e('0x59'),'token',_0xd80e('0x5a'),'remoteUri']})[_0xd80e('0x28')](handleEntityNotFound(_0x5cb11c,null))[_0xd80e('0x28')](function(_0x194743){if(_0x194743){_0x393fb6=_0x194743[_0xd80e('0x5b')];var _0x4186bd=_0x393fb6['slice'](-0x1);if(_0x4186bd==='/'){_0x393fb6=_0x393fb6[_0xd80e('0x5c')](0x0,_0x393fb6[_0xd80e('0x5d')](_0x4186bd));}var _0x25e86d={'method':_0xd80e('0x5e'),'uri':util['format'](_0xd80e('0x5f'),_0x393fb6,_0xd80e('0x60')),'json':!![]};switch(_0x194743['authType']){case _0xd80e('0x59'):_0x25e86d[_0xd80e('0x61')]={'Authorization':util[_0xd80e('0x62')](_0xd80e('0x63'),new Buffer(util[_0xd80e('0x62')](_0xd80e('0x64'),_0x194743['username'],_0x194743['password']))[_0xd80e('0x65')]('base64'))};break;case'token':_0x25e86d[_0xd80e('0x61')]={'Authorization':util[_0xd80e('0x62')](_0xd80e('0x63'),new Buffer(util[_0xd80e('0x62')](_0xd80e('0x66'),_0x194743[_0xd80e('0x58')],_0x194743[_0xd80e('0x67')]))[_0xd80e('0x65')]('base64'))};break;default:throw new db[(_0xd80e('0x68'))][(_0xd80e('0x69'))](_0xd80e('0x6a'));}return rp(_0x25e86d);}})[_0xd80e('0x28')](function(_0x575bf6){if(_0x575bf6){var _0x192178=[_0xd80e('0x6b'),'description',_0xd80e('0x6c'),_0xd80e('0x6d')];_['remove'](_0x575bf6[_0xd80e('0x60')],function(_0x160dc4){return _0x192178[_0xd80e('0x6e')](_0x160dc4[_0xd80e('0x2f')]);});return{'count':_0x575bf6[_0xd80e('0x60')][_0xd80e('0x38')],'rows':_[_0xd80e('0x2d')](_0x575bf6[_0xd80e('0x60')],function(_0x392a8b){return{'id':_0x392a8b['id'],'name':_0x392a8b[_0xd80e('0x6f')]>0x7?_0x392a8b['title']:_0x392a8b[_0xd80e('0x2f')],'custom':_0x392a8b[_0xd80e('0x6f')]>0x7?!![]:![],'options':_0x392a8b['system_field_options']?_0x392a8b[_0xd80e('0x70')]:_0x392a8b[_0xd80e('0x71')]?_0x392a8b[_0xd80e('0x71')]:[]};})};}})['then'](respondWithResult(_0x5cb11c,null))[_0xd80e('0x43')](function(_0x5277a2){var _0x30fc66=_0x1edcf4[_0xd80e('0x33')][_0xd80e('0x72')]?0x1f4:_0x5277a2[_0xd80e('0x73')]||0x1f4;logger[_0xd80e('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0xd80e('0x57'),_0x30fc66,JSON[_0xd80e('0x75')](_0x5277a2));delete _0x5277a2[_0xd80e('0x2b')];if(_0x30fc66===0x191){_0x30fc66=0x190;}_0x5cb11c[_0xd80e('0x1d')](_0x30fc66)[_0xd80e('0x76')](_0x1edcf4[_0xd80e('0x33')][_0xd80e('0x72')]?{'message':_0xd80e('0x77'),'statusCode':_0x5277a2[_0xd80e('0x73')]}:_0x5277a2);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 53d6124..1fe4ea9 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 _0x80f9=['bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','api'];(function(_0x1ed3d9,_0x5c42c4){var _0x12c1d2=function(_0x415fd3){while(--_0x415fd3){_0x1ed3d9['push'](_0x1ed3d9['shift']());}};_0x12c1d2(++_0x5c42c4);}(_0x80f9,0xd4));var _0x980f=function(_0x1e48d6,_0x5736ea){_0x1e48d6=_0x1e48d6-0x0;var _0xc45691=_0x80f9[_0x1e48d6];return _0xc45691;};'use strict';var _=require(_0x980f('0x0'));var util=require(_0x980f('0x1'));var logger=require(_0x980f('0x2'))(_0x980f('0x3'));var moment=require('moment');var BPromise=require(_0x980f('0x4'));var rp=require(_0x980f('0x5'));var fs=require('fs');var path=require(_0x980f('0x6'));var rimraf=require(_0x980f('0x7'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x980f('0x8'));module[_0x980f('0x9')]=function(_0x5cf2fe,_0x2da235){return _0x5cf2fe[_0x980f('0xa')](_0x980f('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd97=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x488b4d,_0x233540){var _0x51ee8f=function(_0x166556){while(--_0x166556){_0x488b4d['push'](_0x488b4d['shift']());}};_0x51ee8f(++_0x233540);}(_0xcd97,0x86));var _0x7cd9=function(_0x533ffd,_0x547e7b){_0x533ffd=_0x533ffd-0x0;var _0x1069f5=_0xcd97[_0x533ffd];return _0x1069f5;};'use strict';var _=require(_0x7cd9('0x0'));var util=require(_0x7cd9('0x1'));var logger=require(_0x7cd9('0x2'))(_0x7cd9('0x3'));var moment=require(_0x7cd9('0x4'));var BPromise=require('bluebird');var rp=require(_0x7cd9('0x5'));var fs=require('fs');var path=require(_0x7cd9('0x6'));var rimraf=require(_0x7cd9('0x7'));var config=require(_0x7cd9('0x8'));var attributes=require(_0x7cd9('0x9'));var integrations=require(_0x7cd9('0xa'));module[_0x7cd9('0xb')]=function(_0x546e8d,_0x5e554d){return _0x546e8d[_0x7cd9('0xc')](_0x7cd9('0xd'),attributes,{'tableName':_0x7cd9('0xe'),'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 67f1000..a490ecd 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 _0x0c9d=['catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x24cd7e,_0x11d3e6){var _0x29be41=function(_0x174d26){while(--_0x174d26){_0x24cd7e['push'](_0x24cd7e['shift']());}};_0x29be41(++_0x11d3e6);}(_0x0c9d,0x1ad));var _0xd0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd0c9('0x0'));var util=require('util');var moment=require(_0xd0c9('0x1'));var BPromise=require(_0xd0c9('0x2'));var rs=require(_0xd0c9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd0c9('0x4'));var logger=require(_0xd0c9('0x5'))(_0xd0c9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0c9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46f6f9,_0x2743c5,_0x5bc6c5){return new BPromise(function(_0x203310,_0x5b74d8){return client['request'](_0x46f6f9,_0x5bc6c5)[_0xd0c9('0x8')](function(_0x2390a3){logger[_0xd0c9('0x9')](_0xd0c9('0xa'),_0x2743c5,_0xd0c9('0xb'));logger[_0xd0c9('0xc')](_0xd0c9('0xd'),_0x2743c5,_0xd0c9('0xb'),JSON[_0xd0c9('0xe')](_0x2390a3));if(_0x2390a3[_0xd0c9('0xf')]){if(_0x2390a3[_0xd0c9('0xf')][_0xd0c9('0x10')]===0x1f4){logger[_0xd0c9('0xf')](_0xd0c9('0xa'),_0x2743c5,_0x2390a3['error'][_0xd0c9('0x11')]);return _0x5b74d8(_0x2390a3[_0xd0c9('0xf')][_0xd0c9('0x11')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2743c5,_0x2390a3[_0xd0c9('0xf')][_0xd0c9('0x11')]);return _0x203310(_0x2390a3[_0xd0c9('0xf')]['message']);}else{logger[_0xd0c9('0x9')](_0xd0c9('0xa'),_0x2743c5,_0xd0c9('0xb'));_0x203310(_0x2390a3[_0xd0c9('0x12')]['message']);}})[_0xd0c9('0x13')](function(_0x10b492){logger[_0xd0c9('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x2743c5,_0x10b492);_0x5b74d8(_0x10b492);});});}exports[_0xd0c9('0x14')]=function(_0xe06cbe){var _0x5ee7d1=this;return new Promise(function(_0x12b21e,_0x5ba486){return db[_0xd0c9('0x15')][_0xd0c9('0x16')]({'raw':_0xe06cbe[_0xd0c9('0x17')]?_0xe06cbe[_0xd0c9('0x17')][_0xd0c9('0x18')]===undefined?!![]:![]:!![],'where':_0xe06cbe[_0xd0c9('0x17')]?_0xe06cbe[_0xd0c9('0x17')][_0xd0c9('0x19')]||null:null,'attributes':_0xe06cbe[_0xd0c9('0x17')]?_0xe06cbe[_0xd0c9('0x17')][_0xd0c9('0x1a')]||null:null,'limit':_0xe06cbe[_0xd0c9('0x17')]?_0xe06cbe[_0xd0c9('0x17')]['limit']||null:null,'include':_0xe06cbe['options']?_0xe06cbe['options'][_0xd0c9('0x1b')]?_[_0xd0c9('0x1c')](_0xe06cbe[_0xd0c9('0x17')]['include'],function(_0x2dbf34){return{'model':db[_0x2dbf34[_0xd0c9('0x1d')]],'as':_0x2dbf34['as'],'attributes':_0x2dbf34[_0xd0c9('0x1a')],'include':_0x2dbf34[_0xd0c9('0x1b')]?_[_0xd0c9('0x1c')](_0x2dbf34[_0xd0c9('0x1b')],function(_0xba9c3d){return{'model':db[_0xba9c3d[_0xd0c9('0x1d')]],'as':_0xba9c3d['as'],'attributes':_0xba9c3d['attributes'],'include':_0xba9c3d[_0xd0c9('0x1b')]?_[_0xd0c9('0x1c')](_0xba9c3d[_0xd0c9('0x1b')],function(_0x1e6de4){return{'model':db[_0x1e6de4[_0xd0c9('0x1d')]],'as':_0x1e6de4['as'],'attributes':_0x1e6de4[_0xd0c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd0c9('0x8')](function(_0x2f0691){logger[_0xd0c9('0x9')](_0xd0c9('0x14'),_0xe06cbe);logger[_0xd0c9('0xc')](_0xd0c9('0x14'),_0xe06cbe,JSON[_0xd0c9('0xe')](_0x2f0691));_0x12b21e(_0x2f0691);})[_0xd0c9('0x13')](function(_0x27b03d){logger[_0xd0c9('0xf')](_0xd0c9('0x14'),_0x27b03d[_0xd0c9('0x11')],_0xe06cbe);_0x5ba486(_0x5ee7d1[_0xd0c9('0xf')](0x1f4,_0x27b03d[_0xd0c9('0x11')]));});});};exports[_0xd0c9('0x1e')]=function(_0x2795c8){var _0x2c217a=this;return new Promise(function(_0x32c8f1,_0x27a987){return db['ZendeskAccount'][_0xd0c9('0x1f')]({'raw':_0x2795c8[_0xd0c9('0x17')]?_0x2795c8[_0xd0c9('0x17')][_0xd0c9('0x18')]===undefined?!![]:![]:!![],'where':_0x2795c8['options']?_0x2795c8['options'][_0xd0c9('0x19')]||null:null,'attributes':_0x2795c8[_0xd0c9('0x17')]?_0x2795c8[_0xd0c9('0x17')][_0xd0c9('0x1a')]||null:null,'include':_0x2795c8[_0xd0c9('0x17')]?_0x2795c8[_0xd0c9('0x17')]['include']?_[_0xd0c9('0x1c')](_0x2795c8[_0xd0c9('0x17')][_0xd0c9('0x1b')],function(_0x1083e4){return{'model':db[_0x1083e4[_0xd0c9('0x1d')]],'as':_0x1083e4['as'],'attributes':_0x1083e4[_0xd0c9('0x1a')],'include':_0x1083e4[_0xd0c9('0x1b')]?_[_0xd0c9('0x1c')](_0x1083e4[_0xd0c9('0x1b')],function(_0x56548a){return{'model':db[_0x56548a[_0xd0c9('0x1d')]],'as':_0x56548a['as'],'attributes':_0x56548a[_0xd0c9('0x1a')],'include':_0x56548a[_0xd0c9('0x1b')]?_[_0xd0c9('0x1c')](_0x56548a[_0xd0c9('0x1b')],function(_0x50bfe1){return{'model':db[_0x50bfe1[_0xd0c9('0x1d')]],'as':_0x50bfe1['as'],'attributes':_0x50bfe1[_0xd0c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd0c9('0x8')](function(_0x2644f5){logger[_0xd0c9('0x9')](_0xd0c9('0x1e'),_0x2795c8);logger[_0xd0c9('0xc')](_0xd0c9('0x1e'),_0x2795c8,JSON[_0xd0c9('0xe')](_0x2644f5));_0x32c8f1(_0x2644f5);})[_0xd0c9('0x13')](function(_0x308082){logger[_0xd0c9('0xf')](_0xd0c9('0x1e'),_0x308082[_0xd0c9('0x11')],_0x2795c8);_0x27a987(_0x2c217a[_0xd0c9('0xf')](0x1f4,_0x308082[_0xd0c9('0x11')]));});});}; \ No newline at end of file +var _0x8d0a=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','model','map','ShowZendeskAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x241d9b,_0x45d294){var _0x4e5a52=function(_0x35b39d){while(--_0x35b39d){_0x241d9b['push'](_0x241d9b['shift']());}};_0x4e5a52(++_0x45d294);}(_0x8d0a,0x172));var _0xa8d0=function(_0x36ae62,_0x2d10ce){_0x36ae62=_0x36ae62-0x0;var _0x4d70b3=_0x8d0a[_0x36ae62];return _0x4d70b3;};'use strict';var _=require(_0xa8d0('0x0'));var util=require(_0xa8d0('0x1'));var moment=require(_0xa8d0('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8d0('0x3'));var fs=require('fs');var Redis=require(_0xa8d0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8d0('0x5'));var logger=require(_0xa8d0('0x6'))(_0xa8d0('0x7'));var config=require('../../config/environment');var jayson=require(_0xa8d0('0x8'));var client=jayson[_0xa8d0('0x9')][_0xa8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40c0b3,_0xeef6d9,_0x1032ed){return new BPromise(function(_0x14b0a0,_0x3d6cce){return client[_0xa8d0('0xb')](_0x40c0b3,_0x1032ed)[_0xa8d0('0xc')](function(_0x4550cf){logger[_0xa8d0('0xd')](_0xa8d0('0xe'),_0xeef6d9,_0xa8d0('0xf'));logger[_0xa8d0('0x10')](_0xa8d0('0x11'),_0xeef6d9,_0xa8d0('0xf'),JSON[_0xa8d0('0x12')](_0x4550cf));if(_0x4550cf[_0xa8d0('0x13')]){if(_0x4550cf[_0xa8d0('0x13')]['code']===0x1f4){logger['error'](_0xa8d0('0xe'),_0xeef6d9,_0x4550cf[_0xa8d0('0x13')]['message']);return _0x3d6cce(_0x4550cf['error'][_0xa8d0('0x14')]);}logger[_0xa8d0('0x13')](_0xa8d0('0xe'),_0xeef6d9,_0x4550cf[_0xa8d0('0x13')][_0xa8d0('0x14')]);return _0x14b0a0(_0x4550cf[_0xa8d0('0x13')][_0xa8d0('0x14')]);}else{logger[_0xa8d0('0xd')](_0xa8d0('0xe'),_0xeef6d9,_0xa8d0('0xf'));_0x14b0a0(_0x4550cf[_0xa8d0('0x15')]['message']);}})[_0xa8d0('0x16')](function(_0x3a3528){logger['error'](_0xa8d0('0xe'),_0xeef6d9,_0x3a3528);_0x3d6cce(_0x3a3528);});});}exports[_0xa8d0('0x17')]=function(_0x2899fb){var _0x434ad5=this;return new Promise(function(_0x34ce5d,_0x48e8c5){return db[_0xa8d0('0x18')][_0xa8d0('0x19')]({'raw':_0x2899fb[_0xa8d0('0x1a')]?_0x2899fb[_0xa8d0('0x1a')][_0xa8d0('0x1b')]===undefined?!![]:![]:!![],'where':_0x2899fb[_0xa8d0('0x1a')]?_0x2899fb[_0xa8d0('0x1a')]['where']||null:null,'attributes':_0x2899fb[_0xa8d0('0x1a')]?_0x2899fb[_0xa8d0('0x1a')][_0xa8d0('0x1c')]||null:null,'limit':_0x2899fb[_0xa8d0('0x1a')]?_0x2899fb['options'][_0xa8d0('0x1d')]||null:null,'include':_0x2899fb[_0xa8d0('0x1a')]?_0x2899fb[_0xa8d0('0x1a')][_0xa8d0('0x1e')]?_['map'](_0x2899fb[_0xa8d0('0x1a')][_0xa8d0('0x1e')],function(_0x20ae2c){return{'model':db[_0x20ae2c[_0xa8d0('0x1f')]],'as':_0x20ae2c['as'],'attributes':_0x20ae2c['attributes'],'include':_0x20ae2c[_0xa8d0('0x1e')]?_[_0xa8d0('0x20')](_0x20ae2c[_0xa8d0('0x1e')],function(_0x507d18){return{'model':db[_0x507d18[_0xa8d0('0x1f')]],'as':_0x507d18['as'],'attributes':_0x507d18['attributes'],'include':_0x507d18[_0xa8d0('0x1e')]?_[_0xa8d0('0x20')](_0x507d18['include'],function(_0x5d7292){return{'model':db[_0x5d7292[_0xa8d0('0x1f')]],'as':_0x5d7292['as'],'attributes':_0x5d7292['attributes']};}):[]};}):[]};}):[]:[]})[_0xa8d0('0xc')](function(_0x327673){logger[_0xa8d0('0xd')](_0xa8d0('0x17'),_0x2899fb);logger[_0xa8d0('0x10')]('GetZendeskAccount',_0x2899fb,JSON[_0xa8d0('0x12')](_0x327673));_0x34ce5d(_0x327673);})[_0xa8d0('0x16')](function(_0x13de71){logger['error']('GetZendeskAccount',_0x13de71['message'],_0x2899fb);_0x48e8c5(_0x434ad5[_0xa8d0('0x13')](0x1f4,_0x13de71[_0xa8d0('0x14')]));});});};exports[_0xa8d0('0x21')]=function(_0x1ae23f){var _0x2c9ff2=this;return new Promise(function(_0x3bc7b5,_0x3f6fb9){return db['ZendeskAccount'][_0xa8d0('0x22')]({'raw':_0x1ae23f['options']?_0x1ae23f[_0xa8d0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1ae23f['options']?_0x1ae23f['options']['where']||null:null,'attributes':_0x1ae23f[_0xa8d0('0x1a')]?_0x1ae23f[_0xa8d0('0x1a')]['attributes']||null:null,'include':_0x1ae23f['options']?_0x1ae23f[_0xa8d0('0x1a')][_0xa8d0('0x1e')]?_[_0xa8d0('0x20')](_0x1ae23f[_0xa8d0('0x1a')][_0xa8d0('0x1e')],function(_0x4d7f6d){return{'model':db[_0x4d7f6d['model']],'as':_0x4d7f6d['as'],'attributes':_0x4d7f6d[_0xa8d0('0x1c')],'include':_0x4d7f6d[_0xa8d0('0x1e')]?_[_0xa8d0('0x20')](_0x4d7f6d[_0xa8d0('0x1e')],function(_0x40ccb6){return{'model':db[_0x40ccb6[_0xa8d0('0x1f')]],'as':_0x40ccb6['as'],'attributes':_0x40ccb6['attributes'],'include':_0x40ccb6[_0xa8d0('0x1e')]?_[_0xa8d0('0x20')](_0x40ccb6[_0xa8d0('0x1e')],function(_0x48a087){return{'model':db[_0x48a087[_0xa8d0('0x1f')]],'as':_0x48a087['as'],'attributes':_0x48a087[_0xa8d0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa8d0('0xc')](function(_0x424a1d){logger[_0xa8d0('0xd')](_0xa8d0('0x21'),_0x1ae23f);logger[_0xa8d0('0x10')](_0xa8d0('0x21'),_0x1ae23f,JSON[_0xa8d0('0x12')](_0x424a1d));_0x3bc7b5(_0x424a1d);})[_0xa8d0('0x16')](function(_0x3563a9){logger['error'](_0xa8d0('0x21'),_0x3563a9['message'],_0x1ae23f);_0x3f6fb9(_0x2c9ff2[_0xa8d0('0x13')](0x1f4,_0x3563a9[_0xa8d0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8cddda3..c8b4076 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 _0x4483=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x40b0b9,_0x59cd60){var _0x28e0e2=function(_0x2b75c6){while(--_0x2b75c6){_0x40b0b9['push'](_0x40b0b9['shift']());}};_0x28e0e2(++_0x59cd60);}(_0x4483,0x1a3));var _0x3448=function(_0x23fd7b,_0x394165){_0x23fd7b=_0x23fd7b-0x0;var _0x4a4402=_0x4483[_0x23fd7b];return _0x4a4402;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/fields',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3448('0x13')]);router[_0x3448('0x14')]('/',auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x14')](_0x3448('0x16'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);router[_0x3448('0x18')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file +var _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x1068ff,_0x3dd4f0){var _0x2040ac=function(_0x4bb635){while(--_0x4bb635){_0x1068ff['push'](_0x1068ff['shift']());}};_0x2040ac(++_0x3dd4f0);}(_0x0bb5,0x148));var _0x50bb=function(_0x51cf8b,_0x447bff){_0x51cf8b=_0x51cf8b-0x0;var _0x5c2756=_0x0bb5[_0x51cf8b];return _0x5c2756;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 9c30e26..b3acfae 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 _0x3273=['STRING','sequelize','exports'];(function(_0x44e695,_0x129bbf){var _0x5b48d7=function(_0x273f1d){while(--_0x273f1d){_0x44e695['push'](_0x44e695['shift']());}};_0x5b48d7(++_0x129bbf);}(_0x3273,0xfa));var _0x3327=function(_0x2ce9d,_0x4ff962){_0x2ce9d=_0x2ce9d-0x0;var _0x578428=_0x3273[_0x2ce9d];return _0x578428;};'use strict';var Sequelize=require(_0x3327('0x0'));module[_0x3327('0x1')]={'name':{'type':Sequelize[_0x3327('0x2')]},'description':{'type':Sequelize[_0x3327('0x2')]}}; \ No newline at end of file +var _0x14c2=['STRING','exports'];(function(_0x43798a,_0x914329){var _0x42aae3=function(_0x27d88f){while(--_0x27d88f){_0x43798a['push'](_0x43798a['shift']());}};_0x42aae3(++_0x914329);}(_0x14c2,0xaf));var _0x214c=function(_0x29aa33,_0x1e69f4){_0x29aa33=_0x29aa33-0x0;var _0x522564=_0x14c2[_0x29aa33];return _0x522564;};'use strict';var Sequelize=require('sequelize');module[_0x214c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x214c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index af62507..6c5a7c2 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 _0x3d24=['params','find','create','body','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x28938f,_0x38e41c){var _0x2a3414=function(_0x23e500){while(--_0x23e500){_0x28938f['push'](_0x28938f['shift']());}};_0x2a3414(++_0x38e41c);}(_0x3d24,0x152));var _0x43d2=function(_0x33303f,_0x589962){_0x33303f=_0x33303f-0x0;var _0x455949=_0x3d24[_0x33303f];return _0x455949;};'use strict';var emlformat=require(_0x43d2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x43d2('0x1'));var rp=require(_0x43d2('0x2'));var moment=require(_0x43d2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x43d2('0x4'));var util=require(_0x43d2('0x5'));var path=require(_0x43d2('0x6'));var sox=require(_0x43d2('0x7'));var csv=require(_0x43d2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43d2('0x9'));var squel=require(_0x43d2('0xa'));var crypto=require(_0x43d2('0xb'));var jsforce=require(_0x43d2('0xc'));var deskjs=require(_0x43d2('0xd'));var toCsv=require(_0x43d2('0x8'));var querystring=require(_0x43d2('0xe'));var Papa=require('papaparse');var Redis=require(_0x43d2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x43d2('0x10'));var hardwareService=require(_0x43d2('0x11'));var logger=require('../../config/logger')(_0x43d2('0x12'));var utils=require(_0x43d2('0x13'));var config=require(_0x43d2('0x14'));var licenseUtil=require(_0x43d2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x567191,_0x46f844){_0x46f844=_0x46f844||0xcc;return function(_0x21b15a){if(_0x21b15a){return _0x567191[_0x43d2('0x16')](_0x46f844);}return _0x567191[_0x43d2('0x17')](_0x46f844)[_0x43d2('0x18')]();};}function respondWithResult(_0x121bef,_0x136636){_0x136636=_0x136636||0xc8;return function(_0x7a1f3f){if(_0x7a1f3f){return _0x121bef[_0x43d2('0x17')](_0x136636)[_0x43d2('0x19')](_0x7a1f3f);}};}function respondWithFilteredResult(_0x8c0802,_0x457153){return function(_0x32bdce){if(_0x32bdce){var _0x1167f3=typeof _0x457153[_0x43d2('0x1a')]===_0x43d2('0x1b')&&typeof _0x457153[_0x43d2('0x1c')]==='undefined';var _0x16a1b2=_0x32bdce[_0x43d2('0x1d')];var _0x138c9a=_0x1167f3?0x0:_0x457153[_0x43d2('0x1a')];var _0x6d300b=_0x1167f3?_0x32bdce[_0x43d2('0x1d')]:_0x457153[_0x43d2('0x1a')]+_0x457153[_0x43d2('0x1c')];var _0x33f355;if(_0x6d300b>=_0x16a1b2){_0x6d300b=_0x16a1b2;_0x33f355=0xc8;}else{_0x33f355=0xce;}_0x8c0802[_0x43d2('0x17')](_0x33f355);return _0x8c0802[_0x43d2('0x1e')](_0x43d2('0x1f'),_0x138c9a+'-'+_0x6d300b+'/'+_0x16a1b2)[_0x43d2('0x19')](_0x32bdce);}return null;};}function patchUpdates(_0x38906b){return function(_0x3b0172){try{jsonpatch[_0x43d2('0x20')](_0x3b0172,_0x38906b,!![]);}catch(_0x401625){return BPromise[_0x43d2('0x21')](_0x401625);}return _0x3b0172[_0x43d2('0x22')]();};}function saveUpdates(_0x394f09,_0x154036){return function(_0x4a9dbe){if(_0x4a9dbe){return _0x4a9dbe[_0x43d2('0x23')](_0x394f09)['then'](function(_0x41f4e1){return _0x41f4e1;});}return null;};}function removeEntity(_0x5e929c,_0x4ab46d){return function(_0x5d3548){if(_0x5d3548){return _0x5d3548[_0x43d2('0x24')]()[_0x43d2('0x25')](function(){_0x5e929c[_0x43d2('0x17')](0xcc)[_0x43d2('0x18')]();});}};}function handleEntityNotFound(_0xb3be37,_0xbd4d2a){return function(_0x56e939){if(!_0x56e939){_0xb3be37[_0x43d2('0x16')](0x194);}return _0x56e939;};}function handleError(_0x184ba4,_0x13b0cc){_0x13b0cc=_0x13b0cc||0x1f4;return function(_0x140e56){logger['error'](_0x140e56[_0x43d2('0x26')]);if(_0x140e56[_0x43d2('0x27')]){delete _0x140e56[_0x43d2('0x27')];}_0x184ba4[_0x43d2('0x17')](_0x13b0cc)['send'](_0x140e56);};}exports['index']=function(_0x583138,_0x40ae12){var _0x1316af={},_0xd0ff2={},_0xedf92a={'count':0x0,'rows':[]};var _0x557851=_[_0x43d2('0x28')](db[_0x43d2('0x29')][_0x43d2('0x2a')],function(_0x107a5d){return{'name':_0x107a5d[_0x43d2('0x2b')],'type':_0x107a5d[_0x43d2('0x2c')]['key']};});_0xd0ff2[_0x43d2('0x2d')]=_['map'](_0x557851,_0x43d2('0x27'));_0xd0ff2[_0x43d2('0x2e')]=_[_0x43d2('0x2f')](_0x583138[_0x43d2('0x2e')]);_0xd0ff2[_0x43d2('0x30')]=_[_0x43d2('0x31')](_0xd0ff2[_0x43d2('0x2d')],_0xd0ff2[_0x43d2('0x2e')]);_0x1316af[_0x43d2('0x32')]=_[_0x43d2('0x31')](_0xd0ff2['model'],qs[_0x43d2('0x33')](_0x583138[_0x43d2('0x2e')][_0x43d2('0x33')]));_0x1316af[_0x43d2('0x32')]=_0x1316af['attributes'][_0x43d2('0x34')]?_0x1316af['attributes']:_0xd0ff2['model'];if(!_0x583138['query'][_0x43d2('0x35')]('nolimit')){_0x1316af[_0x43d2('0x1c')]=qs[_0x43d2('0x1c')](_0x583138['query'][_0x43d2('0x1c')]);_0x1316af[_0x43d2('0x1a')]=qs['offset'](_0x583138[_0x43d2('0x2e')]['offset']);}_0x1316af[_0x43d2('0x36')]=qs[_0x43d2('0x37')](_0x583138[_0x43d2('0x2e')][_0x43d2('0x37')]);_0x1316af[_0x43d2('0x38')]=qs['filters'](_[_0x43d2('0x39')](_0x583138['query'],_0xd0ff2[_0x43d2('0x30')]),_0x557851);if(_0x583138[_0x43d2('0x2e')][_0x43d2('0x3a')]){_0x1316af[_0x43d2('0x38')]=_[_0x43d2('0x3b')](_0x1316af['where'],{'$or':_[_0x43d2('0x28')](_0x557851,function(_0x3c3bf6){if(_0x3c3bf6[_0x43d2('0x2c')]!==_0x43d2('0x3c')){var _0x47a89f={};_0x47a89f[_0x3c3bf6['name']]={'$like':'%'+_0x583138[_0x43d2('0x2e')][_0x43d2('0x3a')]+'%'};return _0x47a89f;}})});}_0x1316af=_[_0x43d2('0x3b')]({},_0x1316af,_0x583138[_0x43d2('0x3d')]);var _0x8473aa={'where':_0x1316af[_0x43d2('0x38')]};return db[_0x43d2('0x29')][_0x43d2('0x1d')](_0x8473aa)[_0x43d2('0x25')](function(_0x2f07cc){_0xedf92a['count']=_0x2f07cc;if(_0x583138['query'][_0x43d2('0x3e')]){_0x1316af[_0x43d2('0x3f')]=[{'all':!![]}];}return db[_0x43d2('0x29')][_0x43d2('0x40')](_0x1316af);})[_0x43d2('0x25')](function(_0x54188a){_0xedf92a[_0x43d2('0x41')]=_0x54188a;return _0xedf92a;})[_0x43d2('0x25')](respondWithFilteredResult(_0x40ae12,_0x1316af))[_0x43d2('0x42')](handleError(_0x40ae12,null));};exports['show']=function(_0x31b35c,_0x2a331c){var _0x56093b={'raw':![],'where':{'id':_0x31b35c[_0x43d2('0x43')]['id']}},_0x1d47b6={};_0x1d47b6[_0x43d2('0x2d')]=_[_0x43d2('0x2f')](db[_0x43d2('0x29')][_0x43d2('0x2a')]);_0x1d47b6[_0x43d2('0x2e')]=_[_0x43d2('0x2f')](_0x31b35c[_0x43d2('0x2e')]);_0x1d47b6[_0x43d2('0x30')]=_[_0x43d2('0x31')](_0x1d47b6['model'],_0x1d47b6[_0x43d2('0x2e')]);_0x56093b[_0x43d2('0x32')]=_[_0x43d2('0x31')](_0x1d47b6[_0x43d2('0x2d')],qs[_0x43d2('0x33')](_0x31b35c[_0x43d2('0x2e')]['fields']));_0x56093b[_0x43d2('0x32')]=_0x56093b[_0x43d2('0x32')][_0x43d2('0x34')]?_0x56093b[_0x43d2('0x32')]:_0x1d47b6['model'];if(_0x31b35c[_0x43d2('0x2e')][_0x43d2('0x3e')]){_0x56093b[_0x43d2('0x3f')]=[{'all':!![]}];}_0x56093b=_[_0x43d2('0x3b')]({},_0x56093b,_0x31b35c[_0x43d2('0x3d')]);return db[_0x43d2('0x29')][_0x43d2('0x44')](_0x56093b)[_0x43d2('0x25')](handleEntityNotFound(_0x2a331c,null))[_0x43d2('0x25')](respondWithResult(_0x2a331c,null))[_0x43d2('0x42')](handleError(_0x2a331c,null));};exports['create']=function(_0x4c2d05,_0x41d307){return db[_0x43d2('0x29')][_0x43d2('0x45')](_0x4c2d05['body'],{})[_0x43d2('0x25')](respondWithResult(_0x41d307,0xc9))['catch'](handleError(_0x41d307,null));};exports[_0x43d2('0x23')]=function(_0x1e6598,_0x17f44d){if(_0x1e6598[_0x43d2('0x46')]['id']){delete _0x1e6598[_0x43d2('0x46')]['id'];}return db[_0x43d2('0x29')][_0x43d2('0x44')]({'where':{'id':_0x1e6598[_0x43d2('0x43')]['id']}})[_0x43d2('0x25')](handleEntityNotFound(_0x17f44d,null))[_0x43d2('0x25')](saveUpdates(_0x1e6598[_0x43d2('0x46')],null))[_0x43d2('0x25')](respondWithResult(_0x17f44d,null))[_0x43d2('0x42')](handleError(_0x17f44d,null));};exports[_0x43d2('0x24')]=function(_0x15bc62,_0x1c3081){return db[_0x43d2('0x29')]['find']({'where':{'id':_0x15bc62[_0x43d2('0x43')]['id']}})[_0x43d2('0x25')](handleEntityNotFound(_0x1c3081,null))[_0x43d2('0x25')](removeEntity(_0x1c3081,null))['catch'](handleError(_0x1c3081,null));};exports[_0x43d2('0x47')]=function(_0x306e86,_0x6ef10a,_0x159f16){var _0x43631f={};var _0xebaa55={};var _0x216c24;var _0xf53dee;return db[_0x43d2('0x29')][_0x43d2('0x48')]({'where':{'id':_0x306e86[_0x43d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x6ef10a,null))[_0x43d2('0x25')](function(_0x51a2a3){if(_0x51a2a3){_0x216c24=_0x51a2a3;_0xebaa55[_0x43d2('0x2d')]=_[_0x43d2('0x2f')](db[_0x43d2('0x49')][_0x43d2('0x2a')]);_0xebaa55[_0x43d2('0x2e')]=_[_0x43d2('0x2f')](_0x306e86[_0x43d2('0x2e')]);_0xebaa55[_0x43d2('0x30')]=_['intersection'](_0xebaa55['model'],_0xebaa55[_0x43d2('0x2e')]);_0x43631f[_0x43d2('0x32')]=_[_0x43d2('0x31')](_0xebaa55[_0x43d2('0x2d')],qs[_0x43d2('0x33')](_0x306e86['query'][_0x43d2('0x33')]));_0x43631f[_0x43d2('0x32')]=_0x43631f[_0x43d2('0x32')]['length']?_0x43631f[_0x43d2('0x32')]:_0xebaa55[_0x43d2('0x2d')];_0x43631f[_0x43d2('0x36')]=qs[_0x43d2('0x37')](_0x306e86['query'][_0x43d2('0x37')]);_0x43631f['where']=qs[_0x43d2('0x30')](_[_0x43d2('0x39')](_0x306e86[_0x43d2('0x2e')],_0xebaa55[_0x43d2('0x30')]));if(_0x306e86[_0x43d2('0x2e')][_0x43d2('0x3a')]){_0x43631f['where']=_['merge'](_0x43631f[_0x43d2('0x38')],{'$or':_[_0x43d2('0x28')](_0x43631f[_0x43d2('0x32')],function(_0x442a2f){var _0x46cbeb={};_0x46cbeb[_0x442a2f]={'$like':'%'+_0x306e86['query'][_0x43d2('0x3a')]+'%'};return _0x46cbeb;})});}_0x43631f=_[_0x43d2('0x3b')]({},_0x43631f,_0x306e86[_0x43d2('0x3d')]);return _0x216c24[_0x43d2('0x47')](_0x43631f);}})['then'](function(_0x5b0a01){if(_0x5b0a01){_0xf53dee=_0x5b0a01[_0x43d2('0x34')];if(!_0x306e86[_0x43d2('0x2e')][_0x43d2('0x35')](_0x43d2('0x4a'))){_0x43631f[_0x43d2('0x1c')]=qs[_0x43d2('0x1c')](_0x306e86[_0x43d2('0x2e')][_0x43d2('0x1c')]);_0x43631f[_0x43d2('0x1a')]=qs[_0x43d2('0x1a')](_0x306e86['query'][_0x43d2('0x1a')]);}return _0x216c24[_0x43d2('0x47')](_0x43631f);}})[_0x43d2('0x25')](function(_0x54074f){if(_0x54074f){return _0x54074f?{'count':_0xf53dee,'rows':_0x54074f}:null;}})[_0x43d2('0x25')](respondWithResult(_0x6ef10a,null))[_0x43d2('0x42')](handleError(_0x6ef10a,null));};exports['getSubjects']=function(_0x14fdf3,_0x2dacc9,_0x219b58){var _0x2ef0e0={};var _0x12fb91={};var _0x56d380;var _0x16ad9f;return db[_0x43d2('0x29')][_0x43d2('0x48')]({'where':{'id':_0x14fdf3[_0x43d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x2dacc9,null))['then'](function(_0x5e8b60){if(_0x5e8b60){_0x56d380=_0x5e8b60;_0x12fb91['model']=_[_0x43d2('0x2f')](db[_0x43d2('0x49')][_0x43d2('0x2a')]);_0x12fb91['query']=_[_0x43d2('0x2f')](_0x14fdf3['query']);_0x12fb91[_0x43d2('0x30')]=_[_0x43d2('0x31')](_0x12fb91[_0x43d2('0x2d')],_0x12fb91[_0x43d2('0x2e')]);_0x2ef0e0[_0x43d2('0x32')]=_[_0x43d2('0x31')](_0x12fb91[_0x43d2('0x2d')],qs[_0x43d2('0x33')](_0x14fdf3[_0x43d2('0x2e')][_0x43d2('0x33')]));_0x2ef0e0[_0x43d2('0x32')]=_0x2ef0e0[_0x43d2('0x32')][_0x43d2('0x34')]?_0x2ef0e0['attributes']:_0x12fb91[_0x43d2('0x2d')];_0x2ef0e0['order']=qs[_0x43d2('0x37')](_0x14fdf3[_0x43d2('0x2e')][_0x43d2('0x37')]);_0x2ef0e0['where']=qs[_0x43d2('0x30')](_[_0x43d2('0x39')](_0x14fdf3[_0x43d2('0x2e')],_0x12fb91[_0x43d2('0x30')]));if(_0x14fdf3[_0x43d2('0x2e')][_0x43d2('0x3a')]){_0x2ef0e0[_0x43d2('0x38')]=_[_0x43d2('0x3b')](_0x2ef0e0[_0x43d2('0x38')],{'$or':_[_0x43d2('0x28')](_0x2ef0e0[_0x43d2('0x32')],function(_0x222416){var _0x471358={};_0x471358[_0x222416]={'$like':'%'+_0x14fdf3['query'][_0x43d2('0x3a')]+'%'};return _0x471358;})});}_0x2ef0e0=_[_0x43d2('0x3b')]({},_0x2ef0e0,_0x14fdf3['options']);return _0x56d380[_0x43d2('0x4b')](_0x2ef0e0);}})[_0x43d2('0x25')](function(_0x112124){if(_0x112124){_0x16ad9f=_0x112124[_0x43d2('0x34')];if(!_0x14fdf3[_0x43d2('0x2e')]['hasOwnProperty']('nolimit')){_0x2ef0e0[_0x43d2('0x1c')]=qs[_0x43d2('0x1c')](_0x14fdf3['query']['limit']);_0x2ef0e0[_0x43d2('0x1a')]=qs[_0x43d2('0x1a')](_0x14fdf3[_0x43d2('0x2e')][_0x43d2('0x1a')]);}return _0x56d380[_0x43d2('0x4b')](_0x2ef0e0);}})[_0x43d2('0x25')](function(_0x567f9f){if(_0x567f9f){return _0x567f9f?{'count':_0x16ad9f,'rows':_0x567f9f}:null;}})[_0x43d2('0x25')](respondWithResult(_0x2dacc9,null))['catch'](handleError(_0x2dacc9,null));};exports[_0x43d2('0x4c')]=function(_0x448687,_0x589b73,_0x523129){var _0x4aa570={};var _0x56513a={};var _0x13f082;var _0x3ae59e;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x448687['params']['id']}})[_0x43d2('0x25')](handleEntityNotFound(_0x589b73,null))['then'](function(_0x23334f){if(_0x23334f){_0x13f082=_0x23334f;_0x56513a[_0x43d2('0x2d')]=_['keys'](db[_0x43d2('0x49')][_0x43d2('0x2a')]);_0x56513a[_0x43d2('0x2e')]=_['keys'](_0x448687['query']);_0x56513a[_0x43d2('0x30')]=_[_0x43d2('0x31')](_0x56513a[_0x43d2('0x2d')],_0x56513a[_0x43d2('0x2e')]);_0x4aa570['attributes']=_[_0x43d2('0x31')](_0x56513a['model'],qs[_0x43d2('0x33')](_0x448687[_0x43d2('0x2e')][_0x43d2('0x33')]));_0x4aa570[_0x43d2('0x32')]=_0x4aa570[_0x43d2('0x32')]['length']?_0x4aa570['attributes']:_0x56513a[_0x43d2('0x2d')];_0x4aa570[_0x43d2('0x36')]=qs[_0x43d2('0x37')](_0x448687[_0x43d2('0x2e')]['sort']);_0x4aa570[_0x43d2('0x38')]=qs[_0x43d2('0x30')](_[_0x43d2('0x39')](_0x448687[_0x43d2('0x2e')],_0x56513a[_0x43d2('0x30')]));if(_0x448687[_0x43d2('0x2e')][_0x43d2('0x3a')]){_0x4aa570['where']=_[_0x43d2('0x3b')](_0x4aa570['where'],{'$or':_[_0x43d2('0x28')](_0x4aa570[_0x43d2('0x32')],function(_0x11125a){var _0x2627af={};_0x2627af[_0x11125a]={'$like':'%'+_0x448687[_0x43d2('0x2e')]['filter']+'%'};return _0x2627af;})});}_0x4aa570=_[_0x43d2('0x3b')]({},_0x4aa570,_0x448687[_0x43d2('0x3d')]);return _0x13f082['getDescriptions'](_0x4aa570);}})[_0x43d2('0x25')](function(_0x42cfc3){if(_0x42cfc3){_0x3ae59e=_0x42cfc3[_0x43d2('0x34')];if(!_0x448687[_0x43d2('0x2e')]['hasOwnProperty'](_0x43d2('0x4a'))){_0x4aa570[_0x43d2('0x1c')]=qs['limit'](_0x448687[_0x43d2('0x2e')][_0x43d2('0x1c')]);_0x4aa570[_0x43d2('0x1a')]=qs[_0x43d2('0x1a')](_0x448687['query']['offset']);}return _0x13f082[_0x43d2('0x4c')](_0x4aa570);}})[_0x43d2('0x25')](function(_0x1e769e){if(_0x1e769e){return _0x1e769e?{'count':_0x3ae59e,'rows':_0x1e769e}:null;}})[_0x43d2('0x25')](respondWithResult(_0x589b73,null))[_0x43d2('0x42')](handleError(_0x589b73,null));};exports['getTags']=function(_0x2430e7,_0x50c8bd,_0xde5d41){var _0xc495ed={};var _0x31ed8c={};var _0x1589b2;var _0x1be3d6;return db['ZendeskConfiguration'][_0x43d2('0x48')]({'where':{'id':_0x2430e7[_0x43d2('0x43')]['id']}})[_0x43d2('0x25')](handleEntityNotFound(_0x50c8bd,null))['then'](function(_0x377e85){if(_0x377e85){_0x1589b2=_0x377e85;_0x31ed8c['model']=_[_0x43d2('0x2f')](db[_0x43d2('0x4d')][_0x43d2('0x2a')]);_0x31ed8c[_0x43d2('0x2e')]=_['keys'](_0x2430e7[_0x43d2('0x2e')]);_0x31ed8c[_0x43d2('0x30')]=_[_0x43d2('0x31')](_0x31ed8c[_0x43d2('0x2d')],_0x31ed8c['query']);_0xc495ed[_0x43d2('0x32')]=_[_0x43d2('0x31')](_0x31ed8c[_0x43d2('0x2d')],qs['fields'](_0x2430e7['query'][_0x43d2('0x33')]));_0xc495ed[_0x43d2('0x32')]=_0xc495ed[_0x43d2('0x32')][_0x43d2('0x34')]?_0xc495ed[_0x43d2('0x32')]:_0x31ed8c['model'];_0xc495ed[_0x43d2('0x36')]=qs['sort'](_0x2430e7[_0x43d2('0x2e')][_0x43d2('0x37')]);_0xc495ed[_0x43d2('0x38')]=qs[_0x43d2('0x30')](_['pick'](_0x2430e7[_0x43d2('0x2e')],_0x31ed8c[_0x43d2('0x30')]));if(_0x2430e7['query'][_0x43d2('0x3a')]){_0xc495ed[_0x43d2('0x38')]=_[_0x43d2('0x3b')](_0xc495ed['where'],{'$or':_[_0x43d2('0x28')](_0xc495ed['attributes'],function(_0x363997){var _0x46253d={};_0x46253d[_0x363997]={'$like':'%'+_0x2430e7[_0x43d2('0x2e')][_0x43d2('0x3a')]+'%'};return _0x46253d;})});}_0xc495ed=_[_0x43d2('0x3b')]({},_0xc495ed,_0x2430e7[_0x43d2('0x3d')]);return _0x1589b2[_0x43d2('0x4e')](_0xc495ed);}})[_0x43d2('0x25')](function(_0x52dbcf){if(_0x52dbcf){_0x1be3d6=_0x52dbcf[_0x43d2('0x34')];if(!_0x2430e7['query'][_0x43d2('0x35')](_0x43d2('0x4a'))){_0xc495ed[_0x43d2('0x1c')]=qs[_0x43d2('0x1c')](_0x2430e7['query'][_0x43d2('0x1c')]);_0xc495ed[_0x43d2('0x1a')]=qs[_0x43d2('0x1a')](_0x2430e7[_0x43d2('0x2e')][_0x43d2('0x1a')]);}return _0x1589b2[_0x43d2('0x4e')](_0xc495ed);}})['then'](function(_0xc03455){if(_0xc03455){return _0xc03455?{'count':_0x1be3d6,'rows':_0xc03455}:null;}})['then'](respondWithResult(_0x50c8bd,null))[_0x43d2('0x42')](handleError(_0x50c8bd,null));};exports[_0x43d2('0x4f')]=function(_0x1e048b,_0x2106df,_0x4b52a3){if(_0x1e048b['body']['id']){delete _0x1e048b[_0x43d2('0x46')]['id'];}return db[_0x43d2('0x29')]['findOne']({'where':{'id':_0x1e048b[_0x43d2('0x43')]['id']}})[_0x43d2('0x25')](handleEntityNotFound(_0x2106df,null))[_0x43d2('0x25')](function(_0x2c52d6){if(_0x2c52d6){return _0x2c52d6[_0x43d2('0x4f')](_0x1e048b[_0x43d2('0x46')][_0x43d2('0x50')]||[]);}return null;})[_0x43d2('0x25')](respondWithResult(_0x2106df,null))[_0x43d2('0x42')](handleError(_0x2106df,null));}; \ No newline at end of file +var _0xbff5=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbff5,0x1ec));var _0x5bff=function(_0x4a205f,_0x524b57){_0x4a205f=_0x4a205f-0x0;var _0x1348f2=_0xbff5[_0x4a205f];return _0x1348f2;};'use strict';var emlformat=require(_0x5bff('0x0'));var rimraf=require(_0x5bff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bff('0x2'));var rp=require(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var Mustache=require(_0x5bff('0x6'));var util=require(_0x5bff('0x7'));var path=require(_0x5bff('0x8'));var sox=require('sox');var csv=require(_0x5bff('0x9'));var ejs=require('ejs');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('0x9'));var querystring=require(_0x5bff('0x10'));var Papa=require(_0x5bff('0x11'));var Redis=require('ioredis');var authService=require(_0x5bff('0x12'));var qs=require(_0x5bff('0x13'));var as=require(_0x5bff('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5bff('0x15'));var utils=require('../../config/utils');var config=require(_0x5bff('0x16'));var licenseUtil=require(_0x5bff('0x17'));var db=require(_0x5bff('0x18'))['db'];function respondWithStatusCode(_0x5ef67d,_0x40447d){_0x40447d=_0x40447d||0xcc;return function(_0x105cf8){if(_0x105cf8){return _0x5ef67d[_0x5bff('0x19')](_0x40447d);}return _0x5ef67d[_0x5bff('0x1a')](_0x40447d)[_0x5bff('0x1b')]();};}function respondWithResult(_0x2a8901,_0x56bc0a){_0x56bc0a=_0x56bc0a||0xc8;return function(_0xe90802){if(_0xe90802){return _0x2a8901['status'](_0x56bc0a)[_0x5bff('0x1c')](_0xe90802);}};}function respondWithFilteredResult(_0x3e6103,_0x57c601){return function(_0x499f7b){if(_0x499f7b){var _0x3b0f6d=typeof _0x57c601[_0x5bff('0x1d')]===_0x5bff('0x1e')&&typeof _0x57c601['limit']==='undefined';var _0xb0199a=_0x499f7b[_0x5bff('0x1f')];var _0x38c4ce=_0x3b0f6d?0x0:_0x57c601['offset'];var _0x449308=_0x3b0f6d?_0x499f7b[_0x5bff('0x1f')]:_0x57c601[_0x5bff('0x1d')]+_0x57c601['limit'];var _0x282016;if(_0x449308>=_0xb0199a){_0x449308=_0xb0199a;_0x282016=0xc8;}else{_0x282016=0xce;}_0x3e6103[_0x5bff('0x1a')](_0x282016);return _0x3e6103[_0x5bff('0x20')]('Content-Range',_0x38c4ce+'-'+_0x449308+'/'+_0xb0199a)[_0x5bff('0x1c')](_0x499f7b);}return null;};}function patchUpdates(_0x4e9017){return function(_0x4e4657){try{jsonpatch[_0x5bff('0x21')](_0x4e4657,_0x4e9017,!![]);}catch(_0x199601){return BPromise[_0x5bff('0x22')](_0x199601);}return _0x4e4657[_0x5bff('0x23')]();};}function saveUpdates(_0x4b5087,_0xedbbd){return function(_0x574d17){if(_0x574d17){return _0x574d17[_0x5bff('0x24')](_0x4b5087)[_0x5bff('0x25')](function(_0x17833d){return _0x17833d;});}return null;};}function removeEntity(_0x4d707e,_0x50f410){return function(_0x3a9cb4){if(_0x3a9cb4){return _0x3a9cb4[_0x5bff('0x26')]()[_0x5bff('0x25')](function(){_0x4d707e[_0x5bff('0x1a')](0xcc)[_0x5bff('0x1b')]();});}};}function handleEntityNotFound(_0x3ae722,_0x753867){return function(_0x227b10){if(!_0x227b10){_0x3ae722[_0x5bff('0x19')](0x194);}return _0x227b10;};}function handleError(_0x24bf97,_0x410f94){_0x410f94=_0x410f94||0x1f4;return function(_0x259a60){logger[_0x5bff('0x27')](_0x259a60['stack']);if(_0x259a60['name']){delete _0x259a60[_0x5bff('0x28')];}_0x24bf97[_0x5bff('0x1a')](_0x410f94)[_0x5bff('0x29')](_0x259a60);};}exports[_0x5bff('0x2a')]=function(_0x465e29,_0x129cf7){var _0x1b0d7a={},_0x21a00c={},_0x4cad3f={'count':0x0,'rows':[]};var _0x206128=_['map'](db[_0x5bff('0x2b')][_0x5bff('0x2c')],function(_0x8bebfb){return{'name':_0x8bebfb[_0x5bff('0x2d')],'type':_0x8bebfb[_0x5bff('0x2e')]['key']};});_0x21a00c[_0x5bff('0x2f')]=_[_0x5bff('0x30')](_0x206128,_0x5bff('0x28'));_0x21a00c[_0x5bff('0x31')]=_['keys'](_0x465e29[_0x5bff('0x31')]);_0x21a00c[_0x5bff('0x32')]=_['intersection'](_0x21a00c[_0x5bff('0x2f')],_0x21a00c[_0x5bff('0x31')]);_0x1b0d7a[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x21a00c[_0x5bff('0x2f')],qs[_0x5bff('0x35')](_0x465e29[_0x5bff('0x31')][_0x5bff('0x35')]));_0x1b0d7a[_0x5bff('0x33')]=_0x1b0d7a[_0x5bff('0x33')][_0x5bff('0x36')]?_0x1b0d7a['attributes']:_0x21a00c[_0x5bff('0x2f')];if(!_0x465e29[_0x5bff('0x31')][_0x5bff('0x37')](_0x5bff('0x38'))){_0x1b0d7a[_0x5bff('0x39')]=qs['limit'](_0x465e29[_0x5bff('0x31')][_0x5bff('0x39')]);_0x1b0d7a[_0x5bff('0x1d')]=qs[_0x5bff('0x1d')](_0x465e29['query'][_0x5bff('0x1d')]);}_0x1b0d7a[_0x5bff('0x3a')]=qs[_0x5bff('0x3b')](_0x465e29[_0x5bff('0x31')][_0x5bff('0x3b')]);_0x1b0d7a[_0x5bff('0x3c')]=qs[_0x5bff('0x32')](_['pick'](_0x465e29[_0x5bff('0x31')],_0x21a00c[_0x5bff('0x32')]),_0x206128);if(_0x465e29['query'][_0x5bff('0x3d')]){_0x1b0d7a[_0x5bff('0x3c')]=_[_0x5bff('0x3e')](_0x1b0d7a[_0x5bff('0x3c')],{'$or':_['map'](_0x206128,function(_0x1a23b1){if(_0x1a23b1['type']!==_0x5bff('0x3f')){var _0x3a01d0={};_0x3a01d0[_0x1a23b1[_0x5bff('0x28')]]={'$like':'%'+_0x465e29['query'][_0x5bff('0x3d')]+'%'};return _0x3a01d0;}})});}_0x1b0d7a=_[_0x5bff('0x3e')]({},_0x1b0d7a,_0x465e29[_0x5bff('0x40')]);var _0x21a420={'where':_0x1b0d7a[_0x5bff('0x3c')]};return db[_0x5bff('0x2b')]['count'](_0x21a420)[_0x5bff('0x25')](function(_0xff8960){_0x4cad3f[_0x5bff('0x1f')]=_0xff8960;if(_0x465e29[_0x5bff('0x31')][_0x5bff('0x41')]){_0x1b0d7a['include']=[{'all':!![]}];}return db[_0x5bff('0x2b')][_0x5bff('0x42')](_0x1b0d7a);})[_0x5bff('0x25')](function(_0x3543c0){_0x4cad3f[_0x5bff('0x43')]=_0x3543c0;return _0x4cad3f;})[_0x5bff('0x25')](respondWithFilteredResult(_0x129cf7,_0x1b0d7a))[_0x5bff('0x44')](handleError(_0x129cf7,null));};exports[_0x5bff('0x45')]=function(_0x1c52d5,_0x4f71e8){var _0x4a1ef4={'raw':![],'where':{'id':_0x1c52d5['params']['id']}},_0xa78029={};_0xa78029[_0x5bff('0x2f')]=_[_0x5bff('0x46')](db[_0x5bff('0x2b')][_0x5bff('0x2c')]);_0xa78029[_0x5bff('0x31')]=_[_0x5bff('0x46')](_0x1c52d5[_0x5bff('0x31')]);_0xa78029['filters']=_['intersection'](_0xa78029[_0x5bff('0x2f')],_0xa78029[_0x5bff('0x31')]);_0x4a1ef4[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0xa78029[_0x5bff('0x2f')],qs['fields'](_0x1c52d5['query'][_0x5bff('0x35')]));_0x4a1ef4['attributes']=_0x4a1ef4[_0x5bff('0x33')][_0x5bff('0x36')]?_0x4a1ef4[_0x5bff('0x33')]:_0xa78029['model'];if(_0x1c52d5['query'][_0x5bff('0x41')]){_0x4a1ef4[_0x5bff('0x47')]=[{'all':!![]}];}_0x4a1ef4=_[_0x5bff('0x3e')]({},_0x4a1ef4,_0x1c52d5['options']);return db[_0x5bff('0x2b')][_0x5bff('0x48')](_0x4a1ef4)['then'](handleEntityNotFound(_0x4f71e8,null))['then'](respondWithResult(_0x4f71e8,null))[_0x5bff('0x44')](handleError(_0x4f71e8,null));};exports[_0x5bff('0x49')]=function(_0x378210,_0x5a0d39){return db[_0x5bff('0x2b')][_0x5bff('0x49')](_0x378210[_0x5bff('0x4a')],{})[_0x5bff('0x25')](respondWithResult(_0x5a0d39,0xc9))[_0x5bff('0x44')](handleError(_0x5a0d39,null));};exports['update']=function(_0x5cdc49,_0x178781){if(_0x5cdc49[_0x5bff('0x4a')]['id']){delete _0x5cdc49[_0x5bff('0x4a')]['id'];}return db['ZendeskConfiguration'][_0x5bff('0x48')]({'where':{'id':_0x5cdc49[_0x5bff('0x4b')]['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0x178781,null))[_0x5bff('0x25')](saveUpdates(_0x5cdc49[_0x5bff('0x4a')],null))[_0x5bff('0x25')](respondWithResult(_0x178781,null))[_0x5bff('0x44')](handleError(_0x178781,null));};exports['destroy']=function(_0x2d2cc2,_0x4cec54){return db[_0x5bff('0x2b')][_0x5bff('0x48')]({'where':{'id':_0x2d2cc2['params']['id']}})['then'](handleEntityNotFound(_0x4cec54,null))[_0x5bff('0x25')](removeEntity(_0x4cec54,null))['catch'](handleError(_0x4cec54,null));};exports[_0x5bff('0x4c')]=function(_0x5cac86,_0x59507e,_0x5f37d6){var _0x7e60dd={};var _0x1e6cac={};var _0x104f45;var _0x330ec4;return db[_0x5bff('0x2b')][_0x5bff('0x4d')]({'where':{'id':_0x5cac86[_0x5bff('0x4b')]['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0x59507e,null))[_0x5bff('0x25')](function(_0x4694e5){if(_0x4694e5){_0x104f45=_0x4694e5;_0x1e6cac[_0x5bff('0x2f')]=_['keys'](db[_0x5bff('0x4e')]['rawAttributes']);_0x1e6cac[_0x5bff('0x31')]=_[_0x5bff('0x46')](_0x5cac86[_0x5bff('0x31')]);_0x1e6cac['filters']=_[_0x5bff('0x34')](_0x1e6cac[_0x5bff('0x2f')],_0x1e6cac[_0x5bff('0x31')]);_0x7e60dd[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x1e6cac[_0x5bff('0x2f')],qs[_0x5bff('0x35')](_0x5cac86[_0x5bff('0x31')][_0x5bff('0x35')]));_0x7e60dd['attributes']=_0x7e60dd['attributes'][_0x5bff('0x36')]?_0x7e60dd[_0x5bff('0x33')]:_0x1e6cac[_0x5bff('0x2f')];_0x7e60dd[_0x5bff('0x3a')]=qs[_0x5bff('0x3b')](_0x5cac86[_0x5bff('0x31')][_0x5bff('0x3b')]);_0x7e60dd[_0x5bff('0x3c')]=qs[_0x5bff('0x32')](_[_0x5bff('0x4f')](_0x5cac86[_0x5bff('0x31')],_0x1e6cac[_0x5bff('0x32')]));if(_0x5cac86[_0x5bff('0x31')][_0x5bff('0x3d')]){_0x7e60dd[_0x5bff('0x3c')]=_[_0x5bff('0x3e')](_0x7e60dd[_0x5bff('0x3c')],{'$or':_[_0x5bff('0x30')](_0x7e60dd['attributes'],function(_0x3512c3){var _0xd77598={};_0xd77598[_0x3512c3]={'$like':'%'+_0x5cac86[_0x5bff('0x31')][_0x5bff('0x3d')]+'%'};return _0xd77598;})});}_0x7e60dd=_['merge']({},_0x7e60dd,_0x5cac86[_0x5bff('0x40')]);return _0x104f45[_0x5bff('0x4c')](_0x7e60dd);}})['then'](function(_0x3e4ef5){if(_0x3e4ef5){_0x330ec4=_0x3e4ef5[_0x5bff('0x36')];if(!_0x5cac86[_0x5bff('0x31')][_0x5bff('0x37')](_0x5bff('0x38'))){_0x7e60dd[_0x5bff('0x39')]=qs['limit'](_0x5cac86[_0x5bff('0x31')][_0x5bff('0x39')]);_0x7e60dd[_0x5bff('0x1d')]=qs[_0x5bff('0x1d')](_0x5cac86[_0x5bff('0x31')][_0x5bff('0x1d')]);}return _0x104f45[_0x5bff('0x4c')](_0x7e60dd);}})[_0x5bff('0x25')](function(_0x955885){if(_0x955885){return _0x955885?{'count':_0x330ec4,'rows':_0x955885}:null;}})[_0x5bff('0x25')](respondWithResult(_0x59507e,null))[_0x5bff('0x44')](handleError(_0x59507e,null));};exports['getSubjects']=function(_0x2de2cf,_0xe5cbc9,_0x5ce1c4){var _0x34feac={};var _0x5a5157={};var _0x4d48f4;var _0x390a3b;return db[_0x5bff('0x2b')]['findOne']({'where':{'id':_0x2de2cf['params']['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0xe5cbc9,null))[_0x5bff('0x25')](function(_0x5b7df5){if(_0x5b7df5){_0x4d48f4=_0x5b7df5;_0x5a5157[_0x5bff('0x2f')]=_[_0x5bff('0x46')](db['ZendeskField'][_0x5bff('0x2c')]);_0x5a5157['query']=_[_0x5bff('0x46')](_0x2de2cf[_0x5bff('0x31')]);_0x5a5157[_0x5bff('0x32')]=_[_0x5bff('0x34')](_0x5a5157[_0x5bff('0x2f')],_0x5a5157[_0x5bff('0x31')]);_0x34feac[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x5a5157[_0x5bff('0x2f')],qs['fields'](_0x2de2cf[_0x5bff('0x31')][_0x5bff('0x35')]));_0x34feac['attributes']=_0x34feac[_0x5bff('0x33')]['length']?_0x34feac[_0x5bff('0x33')]:_0x5a5157[_0x5bff('0x2f')];_0x34feac[_0x5bff('0x3a')]=qs[_0x5bff('0x3b')](_0x2de2cf[_0x5bff('0x31')]['sort']);_0x34feac[_0x5bff('0x3c')]=qs[_0x5bff('0x32')](_[_0x5bff('0x4f')](_0x2de2cf[_0x5bff('0x31')],_0x5a5157['filters']));if(_0x2de2cf[_0x5bff('0x31')][_0x5bff('0x3d')]){_0x34feac[_0x5bff('0x3c')]=_[_0x5bff('0x3e')](_0x34feac[_0x5bff('0x3c')],{'$or':_[_0x5bff('0x30')](_0x34feac['attributes'],function(_0x40689f){var _0x200217={};_0x200217[_0x40689f]={'$like':'%'+_0x2de2cf[_0x5bff('0x31')][_0x5bff('0x3d')]+'%'};return _0x200217;})});}_0x34feac=_[_0x5bff('0x3e')]({},_0x34feac,_0x2de2cf[_0x5bff('0x40')]);return _0x4d48f4[_0x5bff('0x50')](_0x34feac);}})['then'](function(_0x23011e){if(_0x23011e){_0x390a3b=_0x23011e['length'];if(!_0x2de2cf['query']['hasOwnProperty'](_0x5bff('0x38'))){_0x34feac['limit']=qs[_0x5bff('0x39')](_0x2de2cf['query'][_0x5bff('0x39')]);_0x34feac[_0x5bff('0x1d')]=qs['offset'](_0x2de2cf[_0x5bff('0x31')][_0x5bff('0x1d')]);}return _0x4d48f4[_0x5bff('0x50')](_0x34feac);}})['then'](function(_0x40f399){if(_0x40f399){return _0x40f399?{'count':_0x390a3b,'rows':_0x40f399}:null;}})[_0x5bff('0x25')](respondWithResult(_0xe5cbc9,null))[_0x5bff('0x44')](handleError(_0xe5cbc9,null));};exports[_0x5bff('0x51')]=function(_0x400196,_0x245246,_0x59643f){var _0x4798ef={};var _0x16e427={};var _0x103f0c;var _0x42f21b;return db[_0x5bff('0x2b')][_0x5bff('0x4d')]({'where':{'id':_0x400196['params']['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0x245246,null))[_0x5bff('0x25')](function(_0x23efbb){if(_0x23efbb){_0x103f0c=_0x23efbb;_0x16e427['model']=_[_0x5bff('0x46')](db[_0x5bff('0x4e')][_0x5bff('0x2c')]);_0x16e427[_0x5bff('0x31')]=_[_0x5bff('0x46')](_0x400196[_0x5bff('0x31')]);_0x16e427[_0x5bff('0x32')]=_['intersection'](_0x16e427[_0x5bff('0x2f')],_0x16e427[_0x5bff('0x31')]);_0x4798ef['attributes']=_[_0x5bff('0x34')](_0x16e427['model'],qs[_0x5bff('0x35')](_0x400196[_0x5bff('0x31')][_0x5bff('0x35')]));_0x4798ef['attributes']=_0x4798ef[_0x5bff('0x33')][_0x5bff('0x36')]?_0x4798ef['attributes']:_0x16e427[_0x5bff('0x2f')];_0x4798ef[_0x5bff('0x3a')]=qs[_0x5bff('0x3b')](_0x400196[_0x5bff('0x31')][_0x5bff('0x3b')]);_0x4798ef[_0x5bff('0x3c')]=qs[_0x5bff('0x32')](_['pick'](_0x400196[_0x5bff('0x31')],_0x16e427[_0x5bff('0x32')]));if(_0x400196['query']['filter']){_0x4798ef['where']=_[_0x5bff('0x3e')](_0x4798ef[_0x5bff('0x3c')],{'$or':_[_0x5bff('0x30')](_0x4798ef['attributes'],function(_0xcab5c){var _0x41aa82={};_0x41aa82[_0xcab5c]={'$like':'%'+_0x400196[_0x5bff('0x31')]['filter']+'%'};return _0x41aa82;})});}_0x4798ef=_[_0x5bff('0x3e')]({},_0x4798ef,_0x400196['options']);return _0x103f0c[_0x5bff('0x51')](_0x4798ef);}})[_0x5bff('0x25')](function(_0x22838d){if(_0x22838d){_0x42f21b=_0x22838d[_0x5bff('0x36')];if(!_0x400196[_0x5bff('0x31')][_0x5bff('0x37')](_0x5bff('0x38'))){_0x4798ef[_0x5bff('0x39')]=qs['limit'](_0x400196[_0x5bff('0x31')][_0x5bff('0x39')]);_0x4798ef[_0x5bff('0x1d')]=qs['offset'](_0x400196[_0x5bff('0x31')][_0x5bff('0x1d')]);}return _0x103f0c['getDescriptions'](_0x4798ef);}})[_0x5bff('0x25')](function(_0x19570a){if(_0x19570a){return _0x19570a?{'count':_0x42f21b,'rows':_0x19570a}:null;}})['then'](respondWithResult(_0x245246,null))['catch'](handleError(_0x245246,null));};exports[_0x5bff('0x52')]=function(_0x56690b,_0x401d89,_0x21590b){var _0x1f4037={};var _0x4d8354={};var _0x38a29b;var _0x3b85b3;return db[_0x5bff('0x2b')][_0x5bff('0x4d')]({'where':{'id':_0x56690b[_0x5bff('0x4b')]['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0x401d89,null))[_0x5bff('0x25')](function(_0x3fed2d){if(_0x3fed2d){_0x38a29b=_0x3fed2d;_0x4d8354[_0x5bff('0x2f')]=_[_0x5bff('0x46')](db[_0x5bff('0x53')][_0x5bff('0x2c')]);_0x4d8354[_0x5bff('0x31')]=_[_0x5bff('0x46')](_0x56690b[_0x5bff('0x31')]);_0x4d8354[_0x5bff('0x32')]=_['intersection'](_0x4d8354['model'],_0x4d8354['query']);_0x1f4037[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x4d8354[_0x5bff('0x2f')],qs[_0x5bff('0x35')](_0x56690b[_0x5bff('0x31')]['fields']));_0x1f4037[_0x5bff('0x33')]=_0x1f4037[_0x5bff('0x33')]['length']?_0x1f4037['attributes']:_0x4d8354[_0x5bff('0x2f')];_0x1f4037[_0x5bff('0x3a')]=qs[_0x5bff('0x3b')](_0x56690b['query']['sort']);_0x1f4037[_0x5bff('0x3c')]=qs['filters'](_[_0x5bff('0x4f')](_0x56690b[_0x5bff('0x31')],_0x4d8354['filters']));if(_0x56690b[_0x5bff('0x31')]['filter']){_0x1f4037[_0x5bff('0x3c')]=_[_0x5bff('0x3e')](_0x1f4037[_0x5bff('0x3c')],{'$or':_[_0x5bff('0x30')](_0x1f4037[_0x5bff('0x33')],function(_0x2c0a95){var _0x317552={};_0x317552[_0x2c0a95]={'$like':'%'+_0x56690b['query'][_0x5bff('0x3d')]+'%'};return _0x317552;})});}_0x1f4037=_[_0x5bff('0x3e')]({},_0x1f4037,_0x56690b['options']);return _0x38a29b['getTags'](_0x1f4037);}})[_0x5bff('0x25')](function(_0x2db620){if(_0x2db620){_0x3b85b3=_0x2db620[_0x5bff('0x36')];if(!_0x56690b[_0x5bff('0x31')][_0x5bff('0x37')]('nolimit')){_0x1f4037[_0x5bff('0x39')]=qs[_0x5bff('0x39')](_0x56690b['query'][_0x5bff('0x39')]);_0x1f4037[_0x5bff('0x1d')]=qs['offset'](_0x56690b['query']['offset']);}return _0x38a29b[_0x5bff('0x52')](_0x1f4037);}})[_0x5bff('0x25')](function(_0x5eaf1a){if(_0x5eaf1a){return _0x5eaf1a?{'count':_0x3b85b3,'rows':_0x5eaf1a}:null;}})[_0x5bff('0x25')](respondWithResult(_0x401d89,null))['catch'](handleError(_0x401d89,null));};exports[_0x5bff('0x54')]=function(_0x25f939,_0x34a5c5,_0x1b6c6f){if(_0x25f939[_0x5bff('0x4a')]['id']){delete _0x25f939['body']['id'];}return db[_0x5bff('0x2b')][_0x5bff('0x4d')]({'where':{'id':_0x25f939[_0x5bff('0x4b')]['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0x34a5c5,null))[_0x5bff('0x25')](function(_0x35c863){if(_0x35c863){return _0x35c863[_0x5bff('0x54')](_0x25f939[_0x5bff('0x4a')][_0x5bff('0x55')]||[]);}return null;})['then'](respondWithResult(_0x34a5c5,null))[_0x5bff('0x44')](handleError(_0x34a5c5,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index e9cecd6..2dbdf6a 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 _0x896e=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3528d8,_0x2e900c){var _0x61c45b=function(_0x3d5a37){while(--_0x3d5a37){_0x3528d8['push'](_0x3528d8['shift']());}};_0x61c45b(++_0x2e900c);}(_0x896e,0x1e9));var _0xe896=function(_0x232157,_0x4e7827){_0x232157=_0x232157-0x0;var _0x33eaa7=_0x896e[_0x232157];return _0x33eaa7;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb44a=['../../config/logger','moment','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x58728c,_0x10bf0b){var _0x60fe60=function(_0x1e94ce){while(--_0x1e94ce){_0x58728c['push'](_0x58728c['shift']());}};_0x60fe60(++_0x10bf0b);}(_0xb44a,0x1c2));var _0xab44=function(_0x1f047e,_0x23b312){_0x1f047e=_0x1f047e-0x0;var _0x206db5=_0xb44a[_0x1f047e];return _0x206db5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));module[_0xab44('0x5')]=function(_0x28681a,_0x2f3948){return _0x28681a[_0xab44('0x6')](_0xab44('0x7'),attributes,{'tableName':_0xab44('0x8'),'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 69c4bc0..96d1fa1 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 _0xc7a1=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xc7a1,0xa1));var _0x1c7a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc7a1[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x1c7a('0x0'));var util=require(_0x1c7a('0x1'));var moment=require(_0x1c7a('0x2'));var BPromise=require(_0x1c7a('0x3'));var rs=require(_0x1c7a('0x4'));var fs=require('fs');var Redis=require(_0x1c7a('0x5'));var db=require(_0x1c7a('0x6'))['db'];var utils=require(_0x1c7a('0x7'));var logger=require('../../config/logger')(_0x1c7a('0x8'));var config=require(_0x1c7a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1c7a('0xa')][_0x1c7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f4474,_0x54c121,_0x2e57d1){return new BPromise(function(_0x352964,_0x39f2ed){return client[_0x1c7a('0xc')](_0x3f4474,_0x2e57d1)[_0x1c7a('0xd')](function(_0x3d6857){logger[_0x1c7a('0xe')](_0x1c7a('0xf'),_0x54c121,'request\x20sent');logger[_0x1c7a('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x54c121,_0x1c7a('0x11'),JSON[_0x1c7a('0x12')](_0x3d6857));if(_0x3d6857[_0x1c7a('0x13')]){if(_0x3d6857[_0x1c7a('0x13')][_0x1c7a('0x14')]===0x1f4){logger[_0x1c7a('0x13')](_0x1c7a('0xf'),_0x54c121,_0x3d6857[_0x1c7a('0x13')][_0x1c7a('0x15')]);return _0x39f2ed(_0x3d6857[_0x1c7a('0x13')][_0x1c7a('0x15')]);}logger[_0x1c7a('0x13')](_0x1c7a('0xf'),_0x54c121,_0x3d6857['error'][_0x1c7a('0x15')]);return _0x352964(_0x3d6857['error'][_0x1c7a('0x15')]);}else{logger[_0x1c7a('0xe')](_0x1c7a('0xf'),_0x54c121,_0x1c7a('0x11'));_0x352964(_0x3d6857[_0x1c7a('0x16')]['message']);}})[_0x1c7a('0x17')](function(_0x49449c){logger[_0x1c7a('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x54c121,_0x49449c);_0x39f2ed(_0x49449c);});});} \ No newline at end of file +var _0x5c91=['../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x5a0889,_0xa382e1){var _0xaada03=function(_0x110bd3){while(--_0x110bd3){_0x5a0889['push'](_0x5a0889['shift']());}};_0xaada03(++_0xa382e1);}(_0x5c91,0x1f4));var _0x15c9=function(_0x4b4dd5,_0x2a3ba9){_0x4b4dd5=_0x4b4dd5-0x0;var _0x22f23a=_0x5c91[_0x4b4dd5];return _0x22f23a;};'use strict';var _=require('lodash');var util=require(_0x15c9('0x0'));var moment=require(_0x15c9('0x1'));var BPromise=require(_0x15c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15c9('0x3'));var db=require(_0x15c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x15c9('0x5'));var config=require(_0x15c9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x15c9('0x7')][_0x15c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fc53e,_0x3ab365,_0x1773ae){return new BPromise(function(_0x2aebef,_0x183a74){return client[_0x15c9('0x9')](_0x2fc53e,_0x1773ae)[_0x15c9('0xa')](function(_0x10f91c){logger[_0x15c9('0xb')](_0x15c9('0xc'),_0x3ab365,'request\x20sent');logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x3ab365,_0x15c9('0xf'),JSON[_0x15c9('0x10')](_0x10f91c));if(_0x10f91c[_0x15c9('0x11')]){if(_0x10f91c['error'][_0x15c9('0x12')]===0x1f4){logger['error'](_0x15c9('0xc'),_0x3ab365,_0x10f91c[_0x15c9('0x11')]['message']);return _0x183a74(_0x10f91c[_0x15c9('0x11')][_0x15c9('0x13')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x3ab365,_0x10f91c['error']['message']);return _0x2aebef(_0x10f91c[_0x15c9('0x11')][_0x15c9('0x13')]);}else{logger[_0x15c9('0xb')](_0x15c9('0xc'),_0x3ab365,_0x15c9('0xf'));_0x2aebef(_0x10f91c[_0x15c9('0x14')]['message']);}})[_0x15c9('0x15')](function(_0x3179d2){logger[_0x15c9('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3ab365,_0x3179d2);_0x183a74(_0x3179d2);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8d03a48..f47725a 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 _0x89c3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x1a9e6e,_0x1cd59f){var _0x3751fb=function(_0x58211d){while(--_0x58211d){_0x1a9e6e['push'](_0x1a9e6e['shift']());}};_0x3751fb(++_0x1cd59f);}(_0x89c3,0x94));var _0x389c=function(_0x260fc0,_0x4c242e){_0x260fc0=_0x260fc0-0x0;var _0x3a72bc=_0x89c3[_0x260fc0];return _0x3a72bc;};'use strict';var multer=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var path=require(_0x389c('0x2'));var timeout=require(_0x389c('0x3'));var express=require(_0x389c('0x4'));var router=express[_0x389c('0x5')]();var fs_extra=require(_0x389c('0x6'));var auth=require(_0x389c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x389c('0x8'));var controller=require('./intZendeskField.controller');router[_0x389c('0x9')]('/',auth['isAuthenticated'](),controller[_0x389c('0xa')]);router['get'](_0x389c('0xb'),auth[_0x389c('0xc')](),controller[_0x389c('0xd')]);router[_0x389c('0xe')]('/',auth['isAuthenticated'](),controller[_0x389c('0xf')]);router[_0x389c('0x10')]('/:id',auth[_0x389c('0xc')](),controller[_0x389c('0x11')]);router['delete']('/:id',auth[_0x389c('0xc')](),controller[_0x389c('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa23d=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x4517b2,_0x440bee){var _0x126463=function(_0x31d055){while(--_0x31d055){_0x4517b2['push'](_0x4517b2['shift']());}};_0x126463(++_0x440bee);}(_0xa23d,0x134));var _0xda23=function(_0x4ba905,_0x25891c){_0x4ba905=_0x4ba905-0x0;var _0x29ff5c=_0xa23d[_0x4ba905];return _0x29ff5c;};'use strict';var multer=require(_0xda23('0x0'));var util=require(_0xda23('0x1'));var path=require('path');var timeout=require(_0xda23('0x2'));var express=require(_0xda23('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xda23('0x4'));var interaction=require(_0xda23('0x5'));var config=require(_0xda23('0x6'));var controller=require('./intZendeskField.controller');router[_0xda23('0x7')]('/',auth[_0xda23('0x8')](),controller[_0xda23('0x9')]);router['get'](_0xda23('0xa'),auth[_0xda23('0x8')](),controller[_0xda23('0xb')]);router[_0xda23('0xc')]('/',auth['isAuthenticated'](),controller[_0xda23('0xd')]);router[_0xda23('0xe')](_0xda23('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xda23('0xa'),auth[_0xda23('0x8')](),controller[_0xda23('0xf')]);module[_0xda23('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index bee590e..c8bccd8 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 _0x0d3e=['BOOLEAN','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x43bfaf,_0x18aac8){var _0x495f56=function(_0x1cbf61){while(--_0x1cbf61){_0x43bfaf['push'](_0x43bfaf['shift']());}};_0x495f56(++_0x18aac8);}(_0x0d3e,0x12e));var _0xe0d3=function(_0x3e659f,_0x17abb3){_0x3e659f=_0x3e659f-0x0;var _0x32bc81=_0x0d3e[_0x3e659f];return _0x32bc81;};'use strict';var Sequelize=require('sequelize');module[_0xe0d3('0x0')]={'type':{'type':Sequelize[_0xe0d3('0x1')](_0xe0d3('0x2'),_0xe0d3('0x3'),_0xe0d3('0x4'),'keyValue','picklist'),'defaultValue':_0xe0d3('0x2')},'content':{'type':Sequelize[_0xe0d3('0x5')]},'key':{'type':Sequelize[_0xe0d3('0x5')]},'keyType':{'type':Sequelize[_0xe0d3('0x1')]('string','variable',_0xe0d3('0x4'))},'keyContent':{'type':Sequelize[_0xe0d3('0x5')]},'idField':{'type':Sequelize[_0xe0d3('0x5')]},'nameField':{'type':Sequelize[_0xe0d3('0x5')]},'customField':{'type':Sequelize[_0xe0d3('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe0d3('0x5')]}}; \ No newline at end of file +var _0xa0c2=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x2a2f51,_0x2c76cf){var _0x53d7c4=function(_0x3309b3){while(--_0x3309b3){_0x2a2f51['push'](_0x2a2f51['shift']());}};_0x53d7c4(++_0x2c76cf);}(_0xa0c2,0x12e));var _0x2a0c=function(_0x573577,_0x23ef1f){_0x573577=_0x573577-0x0;var _0x453a8e=_0xa0c2[_0x573577];return _0x453a8e;};'use strict';var Sequelize=require(_0x2a0c('0x0'));module[_0x2a0c('0x1')]={'type':{'type':Sequelize[_0x2a0c('0x2')]('string',_0x2a0c('0x3'),_0x2a0c('0x4'),_0x2a0c('0x5'),_0x2a0c('0x6')),'defaultValue':_0x2a0c('0x7')},'content':{'type':Sequelize[_0x2a0c('0x8')]},'key':{'type':Sequelize[_0x2a0c('0x8')]},'keyType':{'type':Sequelize[_0x2a0c('0x2')](_0x2a0c('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x2a0c('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2a0c('0x8')]},'customField':{'type':Sequelize[_0x2a0c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a0c('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8d60035..448078b 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 _0xb720=['end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZendeskField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','sendStatus','status'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0xb720,0x191));var _0x0b72=function(_0x5dc8c3,_0x22eee9){_0x5dc8c3=_0x5dc8c3-0x0;var _0x456a93=_0xb720[_0x5dc8c3];return _0x456a93;};'use strict';var emlformat=require(_0x0b72('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b72('0x1'));var jsonpatch=require(_0x0b72('0x2'));var rp=require(_0x0b72('0x3'));var moment=require(_0x0b72('0x4'));var BPromise=require(_0x0b72('0x5'));var Mustache=require(_0x0b72('0x6'));var util=require(_0x0b72('0x7'));var path=require(_0x0b72('0x8'));var sox=require(_0x0b72('0x9'));var csv=require('to-csv');var ejs=require(_0x0b72('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b72('0xb'));var squel=require(_0x0b72('0xc'));var crypto=require(_0x0b72('0xd'));var jsforce=require(_0x0b72('0xe'));var deskjs=require(_0x0b72('0xf'));var toCsv=require(_0x0b72('0x10'));var querystring=require(_0x0b72('0x11'));var Papa=require(_0x0b72('0x12'));var Redis=require(_0x0b72('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0b72('0x14'));var as=require(_0x0b72('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0b72('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x356034,_0x1fa33c){_0x1fa33c=_0x1fa33c||0xcc;return function(_0x2d4f3f){if(_0x2d4f3f){return _0x356034[_0x0b72('0x17')](_0x1fa33c);}return _0x356034[_0x0b72('0x18')](_0x1fa33c)[_0x0b72('0x19')]();};}function respondWithResult(_0x2083dc,_0x5e31ca){_0x5e31ca=_0x5e31ca||0xc8;return function(_0x3174c5){if(_0x3174c5){return _0x2083dc['status'](_0x5e31ca)[_0x0b72('0x1a')](_0x3174c5);}};}function respondWithFilteredResult(_0x405317,_0x3da564){return function(_0x192bc7){if(_0x192bc7){var _0x181244=typeof _0x3da564[_0x0b72('0x1b')]==='undefined'&&typeof _0x3da564[_0x0b72('0x1c')]===_0x0b72('0x1d');var _0x1a3243=_0x192bc7['count'];var _0x3713aa=_0x181244?0x0:_0x3da564['offset'];var _0xfe7a75=_0x181244?_0x192bc7[_0x0b72('0x1e')]:_0x3da564['offset']+_0x3da564[_0x0b72('0x1c')];var _0x1ff36b;if(_0xfe7a75>=_0x1a3243){_0xfe7a75=_0x1a3243;_0x1ff36b=0xc8;}else{_0x1ff36b=0xce;}_0x405317[_0x0b72('0x18')](_0x1ff36b);return _0x405317[_0x0b72('0x1f')](_0x0b72('0x20'),_0x3713aa+'-'+_0xfe7a75+'/'+_0x1a3243)['json'](_0x192bc7);}return null;};}function patchUpdates(_0x1e793d){return function(_0x202b58){try{jsonpatch[_0x0b72('0x21')](_0x202b58,_0x1e793d,!![]);}catch(_0x538480){return BPromise['reject'](_0x538480);}return _0x202b58[_0x0b72('0x22')]();};}function saveUpdates(_0x1b310c,_0x73bc5f){return function(_0x56e12d){if(_0x56e12d){return _0x56e12d[_0x0b72('0x23')](_0x1b310c)[_0x0b72('0x24')](function(_0x420d53){return _0x420d53;});}return null;};}function removeEntity(_0x274bfe,_0x553b33){return function(_0x2cca65){if(_0x2cca65){return _0x2cca65[_0x0b72('0x25')]()[_0x0b72('0x24')](function(){_0x274bfe[_0x0b72('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x120c8e,_0x407f1c){return function(_0x3f8d55){if(!_0x3f8d55){_0x120c8e['sendStatus'](0x194);}return _0x3f8d55;};}function handleError(_0x4fda85,_0x522857){_0x522857=_0x522857||0x1f4;return function(_0x44dc5c){logger['error'](_0x44dc5c['stack']);if(_0x44dc5c[_0x0b72('0x26')]){delete _0x44dc5c[_0x0b72('0x26')];}_0x4fda85['status'](_0x522857)[_0x0b72('0x27')](_0x44dc5c);};}exports[_0x0b72('0x28')]=function(_0x4a1b0c,_0x21175d){var _0x1ab879={},_0x57fe31={},_0x29841b={'count':0x0,'rows':[]};var _0x5dc221=_[_0x0b72('0x29')](db['ZendeskField'][_0x0b72('0x2a')],function(_0x5ade4d){return{'name':_0x5ade4d[_0x0b72('0x2b')],'type':_0x5ade4d[_0x0b72('0x2c')][_0x0b72('0x2d')]};});_0x57fe31['model']=_[_0x0b72('0x29')](_0x5dc221,'name');_0x57fe31[_0x0b72('0x2e')]=_[_0x0b72('0x2f')](_0x4a1b0c[_0x0b72('0x2e')]);_0x57fe31[_0x0b72('0x30')]=_[_0x0b72('0x31')](_0x57fe31[_0x0b72('0x32')],_0x57fe31[_0x0b72('0x2e')]);_0x1ab879[_0x0b72('0x33')]=_[_0x0b72('0x31')](_0x57fe31[_0x0b72('0x32')],qs[_0x0b72('0x34')](_0x4a1b0c[_0x0b72('0x2e')]['fields']));_0x1ab879[_0x0b72('0x33')]=_0x1ab879[_0x0b72('0x33')]['length']?_0x1ab879[_0x0b72('0x33')]:_0x57fe31['model'];if(!_0x4a1b0c[_0x0b72('0x2e')][_0x0b72('0x35')](_0x0b72('0x36'))){_0x1ab879[_0x0b72('0x1c')]=qs['limit'](_0x4a1b0c[_0x0b72('0x2e')][_0x0b72('0x1c')]);_0x1ab879['offset']=qs[_0x0b72('0x1b')](_0x4a1b0c['query'][_0x0b72('0x1b')]);}_0x1ab879['order']=qs[_0x0b72('0x37')](_0x4a1b0c[_0x0b72('0x2e')][_0x0b72('0x37')]);_0x1ab879[_0x0b72('0x38')]=qs[_0x0b72('0x30')](_[_0x0b72('0x39')](_0x4a1b0c['query'],_0x57fe31[_0x0b72('0x30')]),_0x5dc221);if(_0x4a1b0c['query'][_0x0b72('0x3a')]){_0x1ab879[_0x0b72('0x38')]=_[_0x0b72('0x3b')](_0x1ab879[_0x0b72('0x38')],{'$or':_['map'](_0x5dc221,function(_0x492530){if(_0x492530[_0x0b72('0x2c')]!=='VIRTUAL'){var _0x3f5723={};_0x3f5723[_0x492530['name']]={'$like':'%'+_0x4a1b0c['query'][_0x0b72('0x3a')]+'%'};return _0x3f5723;}})});}_0x1ab879=_[_0x0b72('0x3b')]({},_0x1ab879,_0x4a1b0c[_0x0b72('0x3c')]);var _0x46e1b0={'where':_0x1ab879['where']};return db[_0x0b72('0x3d')][_0x0b72('0x1e')](_0x46e1b0)[_0x0b72('0x24')](function(_0x36c5d9){_0x29841b[_0x0b72('0x1e')]=_0x36c5d9;if(_0x4a1b0c[_0x0b72('0x2e')][_0x0b72('0x3e')]){_0x1ab879[_0x0b72('0x3f')]=[{'all':!![]}];}return db[_0x0b72('0x3d')]['findAll'](_0x1ab879);})[_0x0b72('0x24')](function(_0xabd7dc){_0x29841b[_0x0b72('0x40')]=_0xabd7dc;return _0x29841b;})['then'](respondWithFilteredResult(_0x21175d,_0x1ab879))[_0x0b72('0x41')](handleError(_0x21175d,null));};exports[_0x0b72('0x42')]=function(_0x46dacf,_0x38f157){var _0x4151ca={'raw':!![],'where':{'id':_0x46dacf[_0x0b72('0x43')]['id']}},_0x386da8={};_0x386da8[_0x0b72('0x32')]=_[_0x0b72('0x2f')](db[_0x0b72('0x3d')][_0x0b72('0x2a')]);_0x386da8[_0x0b72('0x2e')]=_['keys'](_0x46dacf[_0x0b72('0x2e')]);_0x386da8[_0x0b72('0x30')]=_[_0x0b72('0x31')](_0x386da8[_0x0b72('0x32')],_0x386da8[_0x0b72('0x2e')]);_0x4151ca['attributes']=_[_0x0b72('0x31')](_0x386da8[_0x0b72('0x32')],qs['fields'](_0x46dacf[_0x0b72('0x2e')][_0x0b72('0x34')]));_0x4151ca[_0x0b72('0x33')]=_0x4151ca[_0x0b72('0x33')]['length']?_0x4151ca[_0x0b72('0x33')]:_0x386da8['model'];if(_0x46dacf[_0x0b72('0x2e')]['includeAll']){_0x4151ca[_0x0b72('0x3f')]=[{'all':!![]}];}_0x4151ca=_['merge']({},_0x4151ca,_0x46dacf[_0x0b72('0x3c')]);return db['ZendeskField'][_0x0b72('0x44')](_0x4151ca)[_0x0b72('0x24')](handleEntityNotFound(_0x38f157,null))[_0x0b72('0x24')](respondWithResult(_0x38f157,null))[_0x0b72('0x41')](handleError(_0x38f157,null));};exports[_0x0b72('0x45')]=function(_0x4dd125,_0x5731f3){return db[_0x0b72('0x3d')][_0x0b72('0x45')](_0x4dd125[_0x0b72('0x46')],{})[_0x0b72('0x24')](respondWithResult(_0x5731f3,0xc9))['catch'](handleError(_0x5731f3,null));};exports[_0x0b72('0x23')]=function(_0x41f8b6,_0x1674b3){if(_0x41f8b6[_0x0b72('0x46')]['id']){delete _0x41f8b6['body']['id'];}return db[_0x0b72('0x3d')]['find']({'where':{'id':_0x41f8b6['params']['id']}})[_0x0b72('0x24')](handleEntityNotFound(_0x1674b3,null))[_0x0b72('0x24')](saveUpdates(_0x41f8b6[_0x0b72('0x46')],null))[_0x0b72('0x24')](respondWithResult(_0x1674b3,null))['catch'](handleError(_0x1674b3,null));};exports[_0x0b72('0x25')]=function(_0x4084d6,_0x4a2ff3){return db[_0x0b72('0x3d')][_0x0b72('0x44')]({'where':{'id':_0x4084d6[_0x0b72('0x43')]['id']}})[_0x0b72('0x24')](handleEntityNotFound(_0x4a2ff3,null))[_0x0b72('0x24')](removeEntity(_0x4a2ff3,null))['catch'](handleError(_0x4a2ff3,null));}; \ No newline at end of file +var _0xbdb7=['sort','where','filters','pick','merge','then','findAll','rows','catch','params','rawAttributes','length','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','error','stack','name','send','index','map','ZendeskField','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order'];(function(_0x3bd1d9,_0x3950a5){var _0x4bd72f=function(_0x175da7){while(--_0x175da7){_0x3bd1d9['push'](_0x3bd1d9['shift']());}};_0x4bd72f(++_0x3950a5);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1c3fee,_0x26b5ac){_0x1c3fee=_0x1c3fee-0x0;var _0x112788=_0xbdb7[_0x1c3fee];return _0x112788;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={},_0xd2d7be={},_0x25a1fe={'count':0x0,'rows':[]};var _0x365c02=_[_0x7bdb('0x28')](db[_0x7bdb('0x29')]['rawAttributes'],function(_0x388a45){return{'name':_0x388a45[_0x7bdb('0x2a')],'type':_0x388a45[_0x7bdb('0x2b')][_0x7bdb('0x2c')]};});_0xd2d7be[_0x7bdb('0x2d')]=_['map'](_0x365c02,_0x7bdb('0x25'));_0xd2d7be[_0x7bdb('0x2e')]=_[_0x7bdb('0x2f')](_0x371e8a[_0x7bdb('0x2e')]);_0xd2d7be['filters']=_['intersection'](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2e')]);_0x1e9996['attributes']=_[_0x7bdb('0x30')](_0xd2d7be['model'],qs[_0x7bdb('0x31')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x31')]));_0x1e9996['attributes']=_0x1e9996[_0x7bdb('0x32')]['length']?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x2d')];if(!_0x371e8a['query'][_0x7bdb('0x33')]('nolimit')){_0x1e9996['limit']=qs[_0x7bdb('0x1b')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x1b')]);_0x1e9996[_0x7bdb('0x19')]=qs[_0x7bdb('0x19')](_0x371e8a[_0x7bdb('0x2e')]['offset']);}_0x1e9996[_0x7bdb('0x34')]=qs[_0x7bdb('0x35')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x35')]);_0x1e9996[_0x7bdb('0x36')]=qs[_0x7bdb('0x37')](_[_0x7bdb('0x38')](_0x371e8a[_0x7bdb('0x2e')],_0xd2d7be[_0x7bdb('0x37')]),_0x365c02);if(_0x371e8a['query']['filter']){_0x1e9996[_0x7bdb('0x36')]=_[_0x7bdb('0x39')](_0x1e9996[_0x7bdb('0x36')],{'$or':_[_0x7bdb('0x28')](_0x365c02,function(_0x3732b2){if(_0x3732b2['type']!=='VIRTUAL'){var _0x27164f={};_0x27164f[_0x3732b2['name']]={'$like':'%'+_0x371e8a[_0x7bdb('0x2e')]['filter']+'%'};return _0x27164f;}})});}_0x1e9996=_[_0x7bdb('0x39')]({},_0x1e9996,_0x371e8a['options']);var _0x4cf3fa={'where':_0x1e9996[_0x7bdb('0x36')]};return db[_0x7bdb('0x29')][_0x7bdb('0x1c')](_0x4cf3fa)[_0x7bdb('0x3a')](function(_0x43c7d3){_0x25a1fe[_0x7bdb('0x1c')]=_0x43c7d3;if(_0x371e8a[_0x7bdb('0x2e')]['includeAll']){_0x1e9996['include']=[{'all':!![]}];}return db[_0x7bdb('0x29')][_0x7bdb('0x3b')](_0x1e9996);})[_0x7bdb('0x3a')](function(_0x3509e4){_0x25a1fe[_0x7bdb('0x3c')]=_0x3509e4;return _0x25a1fe;})[_0x7bdb('0x3a')](respondWithFilteredResult(_0x2e8e65,_0x1e9996))[_0x7bdb('0x3d')](handleError(_0x2e8e65,null));};exports['show']=function(_0x4a2ebc,_0x1bcbcd){var _0x8e893e={'raw':!![],'where':{'id':_0x4a2ebc[_0x7bdb('0x3e')]['id']}},_0x4636f8={};_0x4636f8['model']=_[_0x7bdb('0x2f')](db['ZendeskField'][_0x7bdb('0x3f')]);_0x4636f8[_0x7bdb('0x2e')]=_[_0x7bdb('0x2f')](_0x4a2ebc[_0x7bdb('0x2e')]);_0x4636f8[_0x7bdb('0x37')]=_[_0x7bdb('0x30')](_0x4636f8[_0x7bdb('0x2d')],_0x4636f8[_0x7bdb('0x2e')]);_0x8e893e[_0x7bdb('0x32')]=_['intersection'](_0x4636f8[_0x7bdb('0x2d')],qs[_0x7bdb('0x31')](_0x4a2ebc['query'][_0x7bdb('0x31')]));_0x8e893e['attributes']=_0x8e893e[_0x7bdb('0x32')][_0x7bdb('0x40')]?_0x8e893e[_0x7bdb('0x32')]:_0x4636f8[_0x7bdb('0x2d')];if(_0x4a2ebc[_0x7bdb('0x2e')]['includeAll']){_0x8e893e[_0x7bdb('0x41')]=[{'all':!![]}];}_0x8e893e=_[_0x7bdb('0x39')]({},_0x8e893e,_0x4a2ebc[_0x7bdb('0x42')]);return db[_0x7bdb('0x29')][_0x7bdb('0x43')](_0x8e893e)['then'](handleEntityNotFound(_0x1bcbcd,null))[_0x7bdb('0x3a')](respondWithResult(_0x1bcbcd,null))[_0x7bdb('0x3d')](handleError(_0x1bcbcd,null));};exports[_0x7bdb('0x44')]=function(_0xb26a9,_0x259007){return db[_0x7bdb('0x29')][_0x7bdb('0x44')](_0xb26a9[_0x7bdb('0x45')],{})[_0x7bdb('0x3a')](respondWithResult(_0x259007,0xc9))[_0x7bdb('0x3d')](handleError(_0x259007,null));};exports['update']=function(_0x189cf8,_0x58c4bc){if(_0x189cf8['body']['id']){delete _0x189cf8[_0x7bdb('0x45')]['id'];}return db[_0x7bdb('0x29')]['find']({'where':{'id':_0x189cf8[_0x7bdb('0x3e')]['id']}})[_0x7bdb('0x3a')](handleEntityNotFound(_0x58c4bc,null))['then'](saveUpdates(_0x189cf8['body'],null))['then'](respondWithResult(_0x58c4bc,null))[_0x7bdb('0x3d')](handleError(_0x58c4bc,null));};exports[_0x7bdb('0x46')]=function(_0x2fab74,_0x46410c){return db[_0x7bdb('0x29')][_0x7bdb('0x43')]({'where':{'id':_0x2fab74[_0x7bdb('0x3e')]['id']}})[_0x7bdb('0x3a')](handleEntityNotFound(_0x46410c,null))[_0x7bdb('0x3a')](removeEntity(_0x46410c,null))[_0x7bdb('0x3d')](handleError(_0x46410c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 995523c..af458b2 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 _0xf515=['rimraf','../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','idField','lodash','api','request-promise'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0xf515,0xd5));var _0x5f51=function(_0xc1a81c,_0x89afe8){_0xc1a81c=_0xc1a81c-0x0;var _0x1c2c6a=_0xf515[_0xc1a81c];return _0x1c2c6a;};'use strict';var _=require(_0x5f51('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f51('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5f51('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f51('0x3'));var config=require(_0x5f51('0x4'));var attributes=require(_0x5f51('0x5'));module[_0x5f51('0x6')]=function(_0x9b64e3,_0x2c788b){return _0x9b64e3['define']('ZendeskField',attributes,{'tableName':_0x5f51('0x7'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x5f51('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ebe=['../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','moment','rimraf'];(function(_0x22405a,_0x4c9fa1){var _0x702303=function(_0x4d0397){while(--_0x4d0397){_0x22405a['push'](_0x22405a['shift']());}};_0x702303(++_0x4c9fa1);}(_0x1ebe,0xbf));var _0xe1eb=function(_0x467f29,_0x345a65){_0x467f29=_0x467f29-0x0;var _0x5e46b9=_0x1ebe[_0x467f29];return _0x5e46b9;};'use strict';var _=require(_0xe1eb('0x0'));var util=require('util');var logger=require(_0xe1eb('0x1'))('api');var moment=require(_0xe1eb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe1eb('0x3'));var config=require(_0xe1eb('0x4'));var attributes=require(_0xe1eb('0x5'));module[_0xe1eb('0x6')]=function(_0x4f3688,_0x3b3629){return _0x4f3688[_0xe1eb('0x7')](_0xe1eb('0x8'),attributes,{'tableName':_0xe1eb('0x9'),'paranoid':![],'indexes':[{'name':_0xe1eb('0xa'),'fields':[_0xe1eb('0xb'),_0xe1eb('0xc')],'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 463b98f..facb64f 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 _0xc76a=['util','moment','ioredis','../../config/logger','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x1e4f2b,_0x2f3071){var _0x358004=function(_0x32586c){while(--_0x32586c){_0x1e4f2b['push'](_0x1e4f2b['shift']());}};_0x358004(++_0x2f3071);}(_0xc76a,0xe4));var _0xac76=function(_0xc51f05,_0x31cf8b){_0xc51f05=_0xc51f05-0x0;var _0x57ea49=_0xc76a[_0xc51f05];return _0x57ea49;};'use strict';var _=require('lodash');var util=require(_0xac76('0x0'));var moment=require(_0xac76('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac76('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xac76('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xac76('0x4')][_0xac76('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1adef7,_0x5d55db,_0xfb49bc){return new BPromise(function(_0x17f63c,_0x2a5a66){return client[_0xac76('0x6')](_0x1adef7,_0xfb49bc)[_0xac76('0x7')](function(_0x1ba15d){logger['info'](_0xac76('0x8'),_0x5d55db,_0xac76('0x9'));logger[_0xac76('0xa')](_0xac76('0xb'),_0x5d55db,'request\x20sent',JSON[_0xac76('0xc')](_0x1ba15d));if(_0x1ba15d['error']){if(_0x1ba15d[_0xac76('0xd')][_0xac76('0xe')]===0x1f4){logger[_0xac76('0xd')]('ZendeskField,\x20%s,\x20%s',_0x5d55db,_0x1ba15d[_0xac76('0xd')]['message']);return _0x2a5a66(_0x1ba15d[_0xac76('0xd')][_0xac76('0xf')]);}logger['error'](_0xac76('0x8'),_0x5d55db,_0x1ba15d[_0xac76('0xd')]['message']);return _0x17f63c(_0x1ba15d[_0xac76('0xd')][_0xac76('0xf')]);}else{logger[_0xac76('0x10')]('ZendeskField,\x20%s,\x20%s',_0x5d55db,_0xac76('0x9'));_0x17f63c(_0x1ba15d[_0xac76('0x11')][_0xac76('0xf')]);}})[_0xac76('0x12')](function(_0x5554a2){logger['error'](_0xac76('0x8'),_0x5d55db,_0x5554a2);_0x2a5a66(_0x5554a2);});});} \ No newline at end of file +var _0x4d27=['jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','../../mysqldb','rpc','../../config/environment'];(function(_0x3e2936,_0x1d57a9){var _0x35d87a=function(_0x19dd6a){while(--_0x19dd6a){_0x3e2936['push'](_0x3e2936['shift']());}};_0x35d87a(++_0x1d57a9);}(_0x4d27,0x83));var _0x74d2=function(_0x44b186,_0x31f3ad){_0x44b186=_0x44b186-0x0;var _0x12efd7=_0x4d27[_0x44b186];return _0x12efd7;};'use strict';var _=require(_0x74d2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x74d2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74d2('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x74d2('0x3'));var config=require(_0x74d2('0x4'));var jayson=require(_0x74d2('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1891a8,_0x12665a,_0x2cca94){return new BPromise(function(_0x225a6a,_0x1a5606){return client[_0x74d2('0x6')](_0x1891a8,_0x2cca94)[_0x74d2('0x7')](function(_0x369648){logger[_0x74d2('0x8')](_0x74d2('0x9'),_0x12665a,_0x74d2('0xa'));logger['debug'](_0x74d2('0xb'),_0x12665a,'request\x20sent',JSON[_0x74d2('0xc')](_0x369648));if(_0x369648[_0x74d2('0xd')]){if(_0x369648['error'][_0x74d2('0xe')]===0x1f4){logger[_0x74d2('0xd')](_0x74d2('0x9'),_0x12665a,_0x369648[_0x74d2('0xd')]['message']);return _0x1a5606(_0x369648[_0x74d2('0xd')][_0x74d2('0xf')]);}logger[_0x74d2('0xd')]('ZendeskField,\x20%s,\x20%s',_0x12665a,_0x369648[_0x74d2('0xd')][_0x74d2('0xf')]);return _0x225a6a(_0x369648[_0x74d2('0xd')]['message']);}else{logger[_0x74d2('0x8')](_0x74d2('0x9'),_0x12665a,'request\x20sent');_0x225a6a(_0x369648['result']['message']);}})[_0x74d2('0x10')](function(_0x5a83a2){logger[_0x74d2('0xd')]('ZendeskField,\x20%s,\x20%s',_0x12665a,_0x5a83a2);_0x1a5606(_0x5a83a2);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index cbf670b..fcba6aa 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 _0x6e7e=['delete','/:id','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/fields','post','create','/:id/configurations','put'];(function(_0x561487,_0x30b000){var _0x581388=function(_0x2db25a){while(--_0x2db25a){_0x561487['push'](_0x561487['shift']());}};_0x581388(++_0x30b000);}(_0x6e7e,0x123));var _0xe6e7=function(_0x287253,_0x380a6f){_0x287253=_0x287253-0x0;var _0x57c547=_0x6e7e[_0x287253];return _0x57c547;};'use strict';var multer=require(_0xe6e7('0x0'));var util=require(_0xe6e7('0x1'));var path=require(_0xe6e7('0x2'));var timeout=require(_0xe6e7('0x3'));var express=require(_0xe6e7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe6e7('0x5'));var interaction=require(_0xe6e7('0x6'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xe6e7('0x7')]('/',auth[_0xe6e7('0x8')](),controller[_0xe6e7('0x9')]);router[_0xe6e7('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe6e7('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xe6e7('0x7')](_0xe6e7('0xa'),auth[_0xe6e7('0x8')](),controller['getFields']);router[_0xe6e7('0xb')]('/',auth[_0xe6e7('0x8')](),controller[_0xe6e7('0xc')]);router[_0xe6e7('0xb')](_0xe6e7('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe6e7('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe6e7('0xf')](_0xe6e7('0x10'),auth[_0xe6e7('0x8')](),controller[_0xe6e7('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb19a=['isAuthenticated','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x1a3a4c,_0x50e07b){var _0x8054c0=function(_0x504e18){while(--_0x504e18){_0x1a3a4c['push'](_0x1a3a4c['shift']());}};_0x8054c0(++_0x50e07b);}(_0xb19a,0x1d7));var _0xab19=function(_0x30b505,_0x52f82a){_0x30b505=_0x30b505-0x0;var _0xd39523=_0xb19a[_0x30b505];return _0xd39523;};'use strict';var multer=require(_0xab19('0x0'));var util=require(_0xab19('0x1'));var path=require(_0xab19('0x2'));var timeout=require(_0xab19('0x3'));var express=require(_0xab19('0x4'));var router=express[_0xab19('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xab19('0x6'));var interaction=require(_0xab19('0x7'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xab19('0x8')]('/',auth[_0xab19('0x9')](),controller['index']);router[_0xab19('0x8')]('/:id',auth[_0xab19('0x9')](),controller['show']);router[_0xab19('0x8')](_0xab19('0xa'),auth[_0xab19('0x9')](),controller[_0xab19('0xb')]);router[_0xab19('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xab19('0xc')]);router[_0xab19('0xd')]('/',auth[_0xab19('0x9')](),controller[_0xab19('0xe')]);router[_0xab19('0xd')](_0xab19('0xa'),auth['isAuthenticated'](),controller[_0xab19('0xf')]);router['put'](_0xab19('0x10'),auth[_0xab19('0x9')](),controller[_0xab19('0x11')]);router['delete'](_0xab19('0x10'),auth['isAuthenticated'](),controller[_0xab19('0x12')]);module[_0xab19('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 929de50..ac8c058 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 _0x17ba=['sequelize','exports','STRING'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x17ba,0xab));var _0xa17b=function(_0x2afae4,_0x929553){_0x2afae4=_0x2afae4-0x0;var _0x3ba2bc=_0x17ba[_0x2afae4];return _0x3ba2bc;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa17b('0x2')]},'host':{'type':Sequelize[_0xa17b('0x2')]},'zone':{'type':Sequelize[_0xa17b('0x2')]},'clientId':{'type':Sequelize[_0xa17b('0x2')]},'clientSecret':{'type':Sequelize[_0xa17b('0x2')]},'serverUrl':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa17b('0x2')]},'refreshToken':{'type':Sequelize[_0xa17b('0x2')]}}; \ No newline at end of file +var _0x5c12=['exports','STRING'];(function(_0x59d691,_0x1c958c){var _0x18650b=function(_0x188d22){while(--_0x188d22){_0x59d691['push'](_0x59d691['shift']());}};_0x18650b(++_0x1c958c);}(_0x5c12,0x188));var _0x25c1=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0x5c12[_0x5d5bcb];return _0x4ea5eb;};'use strict';var Sequelize=require('sequelize');module[_0x25c1('0x0')]={'name':{'type':Sequelize[_0x25c1('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x25c1('0x1')]},'zone':{'type':Sequelize[_0x25c1('0x1')]},'clientId':{'type':Sequelize[_0x25c1('0x1')]},'clientSecret':{'type':Sequelize[_0x25c1('0x1')]},'serverUrl':{'type':Sequelize[_0x25c1('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x25c1('0x1')]},'refreshToken':{'type':Sequelize[_0x25c1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 1ea5906..b818ea6 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 _0x5fe1=['refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','message','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','api_name','system_mandatory','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','order','sort','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientId','clientSecret','access_token','getFields','host','code','com','serverUrl','substring','lastIndexOf'];(function(_0x5d4390,_0x21b7d8){var _0x4f3e01=function(_0x42372f){while(--_0x42372f){_0x5d4390['push'](_0x5d4390['shift']());}};_0x4f3e01(++_0x21b7d8);}(_0x5fe1,0x8e));var _0x15fe=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x5fe1[_0x369151];return _0x4292d5;};'use strict';var emlformat=require(_0x15fe('0x0'));var rimraf=require(_0x15fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15fe('0x2'));var rp=require(_0x15fe('0x3'));var moment=require('moment');var BPromise=require(_0x15fe('0x4'));var Mustache=require(_0x15fe('0x5'));var util=require('util');var path=require(_0x15fe('0x6'));var sox=require(_0x15fe('0x7'));var csv=require(_0x15fe('0x8'));var ejs=require(_0x15fe('0x9'));var fs=require('fs');var fs_extra=require(_0x15fe('0xa'));var _=require('lodash');var squel=require(_0x15fe('0xb'));var crypto=require(_0x15fe('0xc'));var jsforce=require(_0x15fe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x15fe('0x8'));var querystring=require(_0x15fe('0xe'));var Papa=require(_0x15fe('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x15fe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15fe('0x11'));var logger=require(_0x15fe('0x12'))('api');var utils=require(_0x15fe('0x13'));var config=require(_0x15fe('0x14'));var licenseUtil=require(_0x15fe('0x15'));var db=require(_0x15fe('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x586648,_0x3320ea){_0x3320ea=_0x3320ea||0xcc;return function(_0x1b4775){if(_0x1b4775){return _0x586648[_0x15fe('0x17')](_0x3320ea);}return _0x586648[_0x15fe('0x18')](_0x3320ea)[_0x15fe('0x19')]();};}function respondWithResult(_0x36da81,_0xf007a4){_0xf007a4=_0xf007a4||0xc8;return function(_0x4ad142){if(_0x4ad142){return _0x36da81[_0x15fe('0x18')](_0xf007a4)[_0x15fe('0x1a')](_0x4ad142);}};}function respondWithFilteredResult(_0x27f738,_0x201e89){return function(_0x45fb5c){if(_0x45fb5c){var _0x5aca3b=typeof _0x201e89[_0x15fe('0x1b')]==='undefined'&&typeof _0x201e89[_0x15fe('0x1c')]===_0x15fe('0x1d');var _0x39f1f3=_0x45fb5c[_0x15fe('0x1e')];var _0x3458dc=_0x5aca3b?0x0:_0x201e89[_0x15fe('0x1b')];var _0x28106f=_0x5aca3b?_0x45fb5c[_0x15fe('0x1e')]:_0x201e89[_0x15fe('0x1b')]+_0x201e89[_0x15fe('0x1c')];var _0x500f25;if(_0x28106f>=_0x39f1f3){_0x28106f=_0x39f1f3;_0x500f25=0xc8;}else{_0x500f25=0xce;}_0x27f738[_0x15fe('0x18')](_0x500f25);return _0x27f738['set'](_0x15fe('0x1f'),_0x3458dc+'-'+_0x28106f+'/'+_0x39f1f3)[_0x15fe('0x1a')](_0x45fb5c);}return null;};}function patchUpdates(_0x14ef63){return function(_0x1328c9){try{jsonpatch['apply'](_0x1328c9,_0x14ef63,!![]);}catch(_0xe3ed6d){return BPromise[_0x15fe('0x20')](_0xe3ed6d);}return _0x1328c9['save']();};}function saveUpdates(_0x2212e7,_0x16cc9e){return function(_0x453e26){if(_0x453e26){return _0x453e26[_0x15fe('0x21')](_0x2212e7)[_0x15fe('0x22')](function(_0x515ffb){return _0x515ffb;});}return null;};}function removeEntity(_0x6e9e59,_0x317038){return function(_0x3912cc){if(_0x3912cc){return _0x3912cc[_0x15fe('0x23')]()[_0x15fe('0x22')](function(){_0x6e9e59[_0x15fe('0x18')](0xcc)[_0x15fe('0x19')]();});}};}function handleEntityNotFound(_0x86a791,_0x4d950b){return function(_0x482548){if(!_0x482548){_0x86a791[_0x15fe('0x17')](0x194);}return _0x482548;};}function handleError(_0x1ed5d8,_0x3f457d){_0x3f457d=_0x3f457d||0x1f4;return function(_0x1752b6){logger[_0x15fe('0x24')](_0x1752b6[_0x15fe('0x25')]);if(_0x1752b6[_0x15fe('0x26')]){delete _0x1752b6[_0x15fe('0x26')];}_0x1ed5d8[_0x15fe('0x18')](_0x3f457d)[_0x15fe('0x27')](_0x1752b6);};}exports[_0x15fe('0x28')]=function(_0x2efb62,_0x137276){var _0x5a27ec={},_0x499b30={},_0x834863={'count':0x0,'rows':[]};var _0xb50a21=_[_0x15fe('0x29')](db[_0x15fe('0x2a')][_0x15fe('0x2b')],function(_0x20dbba){return{'name':_0x20dbba['fieldName'],'type':_0x20dbba[_0x15fe('0x2c')][_0x15fe('0x2d')]};});_0x499b30[_0x15fe('0x2e')]=_['map'](_0xb50a21,_0x15fe('0x26'));_0x499b30[_0x15fe('0x2f')]=_[_0x15fe('0x30')](_0x2efb62[_0x15fe('0x2f')]);_0x499b30[_0x15fe('0x31')]=_['intersection'](_0x499b30[_0x15fe('0x2e')],_0x499b30[_0x15fe('0x2f')]);_0x5a27ec[_0x15fe('0x32')]=_[_0x15fe('0x33')](_0x499b30['model'],qs[_0x15fe('0x34')](_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x34')]));_0x5a27ec[_0x15fe('0x32')]=_0x5a27ec[_0x15fe('0x32')]['length']?_0x5a27ec['attributes']:_0x499b30[_0x15fe('0x2e')];if(!_0x2efb62['query'][_0x15fe('0x35')](_0x15fe('0x36'))){_0x5a27ec[_0x15fe('0x1c')]=qs[_0x15fe('0x1c')](_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x1c')]);_0x5a27ec[_0x15fe('0x1b')]=qs['offset'](_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x1b')]);}_0x5a27ec['order']=qs['sort'](_0x2efb62[_0x15fe('0x2f')]['sort']);_0x5a27ec[_0x15fe('0x37')]=qs[_0x15fe('0x31')](_[_0x15fe('0x38')](_0x2efb62[_0x15fe('0x2f')],_0x499b30['filters']),_0xb50a21);if(_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x39')]){_0x5a27ec[_0x15fe('0x37')]=_[_0x15fe('0x3a')](_0x5a27ec[_0x15fe('0x37')],{'$or':_[_0x15fe('0x29')](_0xb50a21,function(_0x4e40e4){if(_0x4e40e4[_0x15fe('0x2c')]!=='VIRTUAL'){var _0x1d4150={};_0x1d4150[_0x4e40e4[_0x15fe('0x26')]]={'$like':'%'+_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x39')]+'%'};return _0x1d4150;}})});}_0x5a27ec=_['merge']({},_0x5a27ec,_0x2efb62[_0x15fe('0x3b')]);var _0x2debe3={'where':_0x5a27ec[_0x15fe('0x37')]};return db['ZohoAccount'][_0x15fe('0x1e')](_0x2debe3)['then'](function(_0x458fd4){_0x834863['count']=_0x458fd4;if(_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x3c')]){_0x5a27ec[_0x15fe('0x3d')]=[{'all':!![]}];}return db[_0x15fe('0x2a')]['findAll'](_0x5a27ec);})[_0x15fe('0x22')](function(_0x454200){_0x834863[_0x15fe('0x3e')]=_0x454200;return _0x834863;})[_0x15fe('0x22')](respondWithFilteredResult(_0x137276,_0x5a27ec))[_0x15fe('0x3f')](handleError(_0x137276,null));};exports[_0x15fe('0x40')]=function(_0x147702,_0x11a4e8){var _0x42c873={'raw':![],'where':{'id':_0x147702[_0x15fe('0x41')]['id']}},_0x2808a8={};_0x2808a8[_0x15fe('0x2e')]=_[_0x15fe('0x30')](db['ZohoAccount'][_0x15fe('0x2b')]);_0x2808a8[_0x15fe('0x2f')]=_['keys'](_0x147702[_0x15fe('0x2f')]);_0x2808a8['filters']=_[_0x15fe('0x33')](_0x2808a8[_0x15fe('0x2e')],_0x2808a8[_0x15fe('0x2f')]);_0x42c873[_0x15fe('0x32')]=_[_0x15fe('0x33')](_0x2808a8[_0x15fe('0x2e')],qs[_0x15fe('0x34')](_0x147702[_0x15fe('0x2f')][_0x15fe('0x34')]));_0x42c873[_0x15fe('0x32')]=_0x42c873['attributes'][_0x15fe('0x42')]?_0x42c873[_0x15fe('0x32')]:_0x2808a8[_0x15fe('0x2e')];if(_0x147702[_0x15fe('0x2f')][_0x15fe('0x3c')]){_0x42c873['include']=[{'all':!![]}];}_0x42c873=_[_0x15fe('0x3a')]({},_0x42c873,_0x147702[_0x15fe('0x3b')]);return db[_0x15fe('0x2a')][_0x15fe('0x43')](_0x42c873)[_0x15fe('0x22')](handleEntityNotFound(_0x11a4e8,null))[_0x15fe('0x22')](respondWithResult(_0x11a4e8,null))[_0x15fe('0x3f')](handleError(_0x11a4e8,null));};exports[_0x15fe('0x44')]=function(_0x2a1c0f,_0x5c1fea){return db[_0x15fe('0x2a')][_0x15fe('0x44')](_0x2a1c0f[_0x15fe('0x45')],{})[_0x15fe('0x22')](respondWithResult(_0x5c1fea,0xc9))[_0x15fe('0x3f')](handleError(_0x5c1fea,null));};exports[_0x15fe('0x21')]=function(_0x365ffc,_0x15a1cd){if(_0x365ffc['body']['id']){delete _0x365ffc[_0x15fe('0x45')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x365ffc[_0x15fe('0x41')]['id']}})[_0x15fe('0x22')](handleEntityNotFound(_0x15a1cd,null))['then'](saveUpdates(_0x365ffc[_0x15fe('0x45')],null))['then'](respondWithResult(_0x15a1cd,null))[_0x15fe('0x3f')](handleError(_0x15a1cd,null));};exports['destroy']=function(_0x454a76,_0x17a5be){return db[_0x15fe('0x2a')][_0x15fe('0x43')]({'where':{'id':_0x454a76[_0x15fe('0x41')]['id']}})['then'](handleEntityNotFound(_0x17a5be,null))[_0x15fe('0x22')](removeEntity(_0x17a5be,null))[_0x15fe('0x3f')](handleError(_0x17a5be,null));};exports[_0x15fe('0x46')]=function(_0x347e00,_0x2c85fd,_0x4b12c0){var _0x5d576e={};var _0x100205={};var _0x296ebf;var _0x29893c;return db['ZohoAccount'][_0x15fe('0x47')]({'where':{'id':_0x347e00[_0x15fe('0x41')]['id']}})['then'](handleEntityNotFound(_0x2c85fd,null))[_0x15fe('0x22')](function(_0x35487c){if(_0x35487c){_0x296ebf=_0x35487c;_0x100205[_0x15fe('0x2e')]=_[_0x15fe('0x30')](db['ZohoConfiguration']['rawAttributes']);_0x100205[_0x15fe('0x2f')]=_[_0x15fe('0x30')](_0x347e00[_0x15fe('0x2f')]);_0x100205[_0x15fe('0x31')]=_[_0x15fe('0x33')](_0x100205[_0x15fe('0x2e')],_0x100205[_0x15fe('0x2f')]);_0x5d576e[_0x15fe('0x32')]=_[_0x15fe('0x33')](_0x100205[_0x15fe('0x2e')],qs['fields'](_0x347e00[_0x15fe('0x2f')][_0x15fe('0x34')]));_0x5d576e['attributes']=_0x5d576e['attributes'][_0x15fe('0x42')]?_0x5d576e['attributes']:_0x100205[_0x15fe('0x2e')];_0x5d576e[_0x15fe('0x48')]=qs[_0x15fe('0x49')](_0x347e00[_0x15fe('0x2f')][_0x15fe('0x49')]);_0x5d576e[_0x15fe('0x37')]=qs[_0x15fe('0x31')](_[_0x15fe('0x38')](_0x347e00[_0x15fe('0x2f')],_0x100205[_0x15fe('0x31')]));if(_0x347e00['query']['filter']){_0x5d576e['where']=_[_0x15fe('0x3a')](_0x5d576e[_0x15fe('0x37')],{'$or':_[_0x15fe('0x29')](_0x5d576e['attributes'],function(_0x3c8aec){var _0x16bc88={};_0x16bc88[_0x3c8aec]={'$like':'%'+_0x347e00[_0x15fe('0x2f')][_0x15fe('0x39')]+'%'};return _0x16bc88;})});}_0x5d576e=_['merge']({},_0x5d576e,_0x347e00[_0x15fe('0x3b')]);return _0x296ebf[_0x15fe('0x46')](_0x5d576e);}})[_0x15fe('0x22')](function(_0x570df5){if(_0x570df5){_0x29893c=_0x570df5[_0x15fe('0x42')];if(!_0x347e00[_0x15fe('0x2f')][_0x15fe('0x35')](_0x15fe('0x36'))){_0x5d576e[_0x15fe('0x1c')]=qs[_0x15fe('0x1c')](_0x347e00[_0x15fe('0x2f')]['limit']);_0x5d576e[_0x15fe('0x1b')]=qs['offset'](_0x347e00[_0x15fe('0x2f')]['offset']);}return _0x296ebf['getConfigurations'](_0x5d576e);}})['then'](function(_0x3e70bd){if(_0x3e70bd){return _0x3e70bd?{'count':_0x29893c,'rows':_0x3e70bd}:null;}})[_0x15fe('0x22')](respondWithResult(_0x2c85fd,null))[_0x15fe('0x3f')](handleError(_0x2c85fd,null));};exports[_0x15fe('0x4a')]=function(_0x32d899,_0x2374c1,_0x163b35){if(_0x32d899[_0x15fe('0x45')]['id']){delete _0x32d899[_0x15fe('0x45')]['id'];}return db[_0x15fe('0x2a')]['findOne']({'where':{'id':_0x32d899['params']['id']}})[_0x15fe('0x22')](handleEntityNotFound(_0x2374c1,null))['then'](function(_0x4f6b7a){if(_0x4f6b7a){_0x32d899['body'][_0x15fe('0x4b')]=_0x4f6b7a['id'];_0x32d899['body']['Subjects']=integrations[_0x15fe('0x4c')](_0x32d899[_0x15fe('0x45')]['channel'],_0x32d899[_0x15fe('0x45')][_0x15fe('0x2c')]);_0x32d899[_0x15fe('0x45')][_0x15fe('0x4d')]=integrations[_0x15fe('0x4e')](_0x32d899[_0x15fe('0x45')][_0x15fe('0x4f')],_0x32d899['body'][_0x15fe('0x2c')]);return db[_0x15fe('0x50')][_0x15fe('0x44')](_0x32d899[_0x15fe('0x45')],{'include':[{'model':db[_0x15fe('0x51')],'as':'Subjects'},{'model':db[_0x15fe('0x51')],'as':_0x15fe('0x4d')}]});}return null;})[_0x15fe('0x22')](respondWithResult(_0x2374c1,null))[_0x15fe('0x3f')](handleError(_0x2374c1,null));};function getAccessToken(_0x972594){return new Promise(function(_0x270bbf,_0x224db0){var _0x136bf0;switch(_0x972594[_0x15fe('0x52')]){case'US':_0x136bf0='https://accounts.zoho.com';break;case'AU':_0x136bf0=_0x15fe('0x53');break;case'EU':_0x136bf0='https://accounts.zoho.eu';break;case'IN':_0x136bf0=_0x15fe('0x54');break;case'CN':_0x136bf0=_0x15fe('0x55');break;default:_0x136bf0=_0x15fe('0x56');break;}var _0x38b2ec={'method':_0x15fe('0x57'),'uri':_0x136bf0+'/oauth/v2/token','qs':{'refresh_token':_0x972594['refreshToken'],'client_id':_0x972594[_0x15fe('0x58')],'client_secret':_0x972594[_0x15fe('0x59')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x38b2ec)[_0x15fe('0x22')](function(_0x25f9cf){if(_0x25f9cf[_0x15fe('0x5a')]){_0x270bbf(_0x25f9cf[_0x15fe('0x5a')]);}else{_0x224db0('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x15fe('0x3f')](function(_0xfaa69f){_0x224db0(_0xfaa69f);});});}exports[_0x15fe('0x5b')]=function(_0x3b5a18,_0xfb1555,_0x459ed4){var _0x1f7c4e,_0x2cb99a,_0x563b57,_0x4592f4,_0x5d8cb6;return db['ZohoAccount']['findOne']({'where':{'id':_0x3b5a18['params']['id']},'attributes':['id',_0x15fe('0x5c'),_0x15fe('0x52'),_0x15fe('0x58'),'clientSecret','serverUrl',_0x15fe('0x5d'),'refreshToken']})[_0x15fe('0x22')](handleEntityNotFound(_0xfb1555,null))[_0x15fe('0x22')](function(_0x5af529){_0x5d8cb6=_0x5af529;_0x1f7c4e=_0x5d8cb6[_0x15fe('0x5c')];_0x2cb99a=_0x1f7c4e==='zoho.eu'?'eu':_0x15fe('0x5e');_0x563b57=_0x5d8cb6[_0x15fe('0x5f')];var _0x1a1e82=_0x563b57['slice'](-0x1);if(_0x1a1e82==='/'||_0x1a1e82==='\x5c'||_0x1a1e82===':'){_0x563b57=_0x563b57[_0x15fe('0x60')](0x0,_0x563b57[_0x15fe('0x61')](_0x1a1e82));}if(!_0x5d8cb6[_0x15fe('0x62')]){throw new Error(_0x15fe('0x63'));}return getAccessToken(_0x5d8cb6);})['then'](function(_0x33b05c){if(_0x33b05c){return rp({'method':_0x15fe('0x64'),'uri':util[_0x15fe('0x65')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2cb99a),'qs':{'module':_0x15fe('0x66')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x33b05c},'json':!![]});}})[_0x15fe('0x22')](function(_0x576642){if(_0x576642){if(_0x576642['response']&&_0x576642[_0x15fe('0x67')][_0x15fe('0x24')]){throw new Error(_0x576642['response'][_0x15fe('0x24')][_0x15fe('0x68')]);}var _0x1446ec=[];var _0x5ba2de=[];var _0x340b10=['Owner','Subject',_0x15fe('0x69'),_0x15fe('0x6a'),'Call_Duration',_0x15fe('0x6b'),_0x15fe('0x6c'),_0x15fe('0x6d')];_0x5ba2de=_['remove'](_0x576642[_0x15fe('0x34')],function(_0x525b98){return _0x340b10['includes'](_0x525b98[_0x15fe('0x6e')]);});for(var _0x557fbe=0x0;_0x557fbe<_0x5ba2de[_0x15fe('0x42')];_0x557fbe++){if(_0x5ba2de[_0x557fbe][_0x15fe('0x6f')]===![]){_0x1446ec['push']({'id':_0x5ba2de[_0x557fbe]['id'],'name':_0x5ba2de[_0x557fbe][_0x15fe('0x70')],'custom':_0x5ba2de[_0x557fbe][_0x15fe('0x71')],'options':_0x5ba2de[_0x557fbe]['data_type']===_0x15fe('0x72')&&_0x5ba2de[_0x557fbe][_0x15fe('0x73')][_0x15fe('0x42')]>-0x1?_[_0x15fe('0x29')](_0x5ba2de[_0x557fbe][_0x15fe('0x73')],function(_0x346c98){return{'name':_0x346c98,'value':_0x346c98};}):[]});}}return{'count':_0x1446ec[_0x15fe('0x42')],'rows':_0x1446ec};}else{return{'count':0x0,'rows':[]};}})[_0x15fe('0x22')](respondWithResult(_0xfb1555,null))[_0x15fe('0x3f')](function(_0xab437d){var _0x47129c=_0x3b5a18['query'][_0x15fe('0x74')]?0x1f4:_0xab437d[_0x15fe('0x75')]||0x1f4;logger[_0x15fe('0x24')](_0x15fe('0x76'),'getFields',_0x47129c,JSON[_0x15fe('0x77')](_0xab437d));delete _0xab437d[_0x15fe('0x26')];if(_0x47129c===0x191){_0x47129c=0x190;}_0xfb1555['status'](_0x47129c)['send'](_0x3b5a18[_0x15fe('0x2f')][_0x15fe('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0xab437d[_0x15fe('0x75')]}:_0xab437d);});}; \ No newline at end of file +var _0xeaa1=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','then','destroy','error','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','merge','where','includeAll','include','findAll','catch','show','params','options','find','create','body','update','getConfigurations','filter','AccountId','channel','ZohoConfiguration','ZohoField','Subjects','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','getFields','findOne','host','serverUrl','code','refreshToken','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','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','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x108af6,_0x3f1249){var _0x65d03d=function(_0x272689){while(--_0x272689){_0x108af6['push'](_0x108af6['shift']());}};_0x65d03d(++_0x3f1249);}(_0xeaa1,0xee));var _0x1eaa=function(_0x21af22,_0x213566){_0x21af22=_0x21af22-0x0;var _0x5731b2=_0xeaa1[_0x21af22];return _0x5731b2;};'use strict';var emlformat=require(_0x1eaa('0x0'));var rimraf=require(_0x1eaa('0x1'));var zipdir=require(_0x1eaa('0x2'));var jsonpatch=require(_0x1eaa('0x3'));var rp=require(_0x1eaa('0x4'));var moment=require(_0x1eaa('0x5'));var BPromise=require(_0x1eaa('0x6'));var Mustache=require(_0x1eaa('0x7'));var util=require(_0x1eaa('0x8'));var path=require(_0x1eaa('0x9'));var sox=require('sox');var csv=require(_0x1eaa('0xa'));var ejs=require(_0x1eaa('0xb'));var fs=require('fs');var fs_extra=require(_0x1eaa('0xc'));var _=require('lodash');var squel=require(_0x1eaa('0xd'));var crypto=require(_0x1eaa('0xe'));var jsforce=require(_0x1eaa('0xf'));var deskjs=require(_0x1eaa('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1eaa('0x11'));var Redis=require(_0x1eaa('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1eaa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1eaa('0x14'));var logger=require(_0x1eaa('0x15'))(_0x1eaa('0x16'));var utils=require(_0x1eaa('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x1eaa('0x18'));function respondWithStatusCode(_0x48e020,_0x10b9e7){_0x10b9e7=_0x10b9e7||0xcc;return function(_0x1bd9af){if(_0x1bd9af){return _0x48e020[_0x1eaa('0x19')](_0x10b9e7);}return _0x48e020[_0x1eaa('0x1a')](_0x10b9e7)[_0x1eaa('0x1b')]();};}function respondWithResult(_0x262b29,_0x500f49){_0x500f49=_0x500f49||0xc8;return function(_0x12807a){if(_0x12807a){return _0x262b29[_0x1eaa('0x1a')](_0x500f49)['json'](_0x12807a);}};}function respondWithFilteredResult(_0x26337c,_0x501f26){return function(_0xe315de){if(_0xe315de){var _0x47fae2=typeof _0x501f26[_0x1eaa('0x1c')]===_0x1eaa('0x1d')&&typeof _0x501f26['limit']==='undefined';var _0x33a7a7=_0xe315de[_0x1eaa('0x1e')];var _0x46d814=_0x47fae2?0x0:_0x501f26[_0x1eaa('0x1c')];var _0x113734=_0x47fae2?_0xe315de[_0x1eaa('0x1e')]:_0x501f26[_0x1eaa('0x1c')]+_0x501f26['limit'];var _0x1f1a34;if(_0x113734>=_0x33a7a7){_0x113734=_0x33a7a7;_0x1f1a34=0xc8;}else{_0x1f1a34=0xce;}_0x26337c['status'](_0x1f1a34);return _0x26337c[_0x1eaa('0x1f')]('Content-Range',_0x46d814+'-'+_0x113734+'/'+_0x33a7a7)[_0x1eaa('0x20')](_0xe315de);}return null;};}function patchUpdates(_0x1e19c5){return function(_0x2fccfc){try{jsonpatch[_0x1eaa('0x21')](_0x2fccfc,_0x1e19c5,!![]);}catch(_0x3fba12){return BPromise[_0x1eaa('0x22')](_0x3fba12);}return _0x2fccfc['save']();};}function saveUpdates(_0x49010d,_0x3056e0){return function(_0x65124c){if(_0x65124c){return _0x65124c['update'](_0x49010d)[_0x1eaa('0x23')](function(_0x294a40){return _0x294a40;});}return null;};}function removeEntity(_0x140ccf,_0x6af3e9){return function(_0x47bbc2){if(_0x47bbc2){return _0x47bbc2[_0x1eaa('0x24')]()[_0x1eaa('0x23')](function(){_0x140ccf[_0x1eaa('0x1a')](0xcc)[_0x1eaa('0x1b')]();});}};}function handleEntityNotFound(_0x3e7c5c,_0x5880e6){return function(_0x296867){if(!_0x296867){_0x3e7c5c[_0x1eaa('0x19')](0x194);}return _0x296867;};}function handleError(_0x2cdc00,_0x4b6057){_0x4b6057=_0x4b6057||0x1f4;return function(_0x5cb7bc){logger[_0x1eaa('0x25')](_0x5cb7bc['stack']);if(_0x5cb7bc['name']){delete _0x5cb7bc[_0x1eaa('0x26')];}_0x2cdc00['status'](_0x4b6057)[_0x1eaa('0x27')](_0x5cb7bc);};}exports[_0x1eaa('0x28')]=function(_0x91b921,_0xfef345){var _0x9553e7={},_0xa4cae4={},_0x297927={'count':0x0,'rows':[]};var _0x46ed77=_[_0x1eaa('0x29')](db[_0x1eaa('0x2a')][_0x1eaa('0x2b')],function(_0x40c0e6){return{'name':_0x40c0e6[_0x1eaa('0x2c')],'type':_0x40c0e6[_0x1eaa('0x2d')][_0x1eaa('0x2e')]};});_0xa4cae4['model']=_[_0x1eaa('0x29')](_0x46ed77,_0x1eaa('0x26'));_0xa4cae4[_0x1eaa('0x2f')]=_[_0x1eaa('0x30')](_0x91b921[_0x1eaa('0x2f')]);_0xa4cae4[_0x1eaa('0x31')]=_[_0x1eaa('0x32')](_0xa4cae4[_0x1eaa('0x33')],_0xa4cae4['query']);_0x9553e7[_0x1eaa('0x34')]=_[_0x1eaa('0x32')](_0xa4cae4[_0x1eaa('0x33')],qs[_0x1eaa('0x35')](_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x35')]));_0x9553e7[_0x1eaa('0x34')]=_0x9553e7[_0x1eaa('0x34')][_0x1eaa('0x36')]?_0x9553e7['attributes']:_0xa4cae4[_0x1eaa('0x33')];if(!_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x37')](_0x1eaa('0x38'))){_0x9553e7[_0x1eaa('0x39')]=qs[_0x1eaa('0x39')](_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x39')]);_0x9553e7['offset']=qs[_0x1eaa('0x1c')](_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x1c')]);}_0x9553e7[_0x1eaa('0x3a')]=qs[_0x1eaa('0x3b')](_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x3b')]);_0x9553e7['where']=qs[_0x1eaa('0x31')](_[_0x1eaa('0x3c')](_0x91b921[_0x1eaa('0x2f')],_0xa4cae4['filters']),_0x46ed77);if(_0x91b921[_0x1eaa('0x2f')]['filter']){_0x9553e7['where']=_[_0x1eaa('0x3d')](_0x9553e7[_0x1eaa('0x3e')],{'$or':_[_0x1eaa('0x29')](_0x46ed77,function(_0x46f87b){if(_0x46f87b['type']!=='VIRTUAL'){var _0x215805={};_0x215805[_0x46f87b[_0x1eaa('0x26')]]={'$like':'%'+_0x91b921[_0x1eaa('0x2f')]['filter']+'%'};return _0x215805;}})});}_0x9553e7=_[_0x1eaa('0x3d')]({},_0x9553e7,_0x91b921['options']);var _0x3a390c={'where':_0x9553e7['where']};return db[_0x1eaa('0x2a')]['count'](_0x3a390c)['then'](function(_0x23212c){_0x297927[_0x1eaa('0x1e')]=_0x23212c;if(_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x3f')]){_0x9553e7[_0x1eaa('0x40')]=[{'all':!![]}];}return db[_0x1eaa('0x2a')][_0x1eaa('0x41')](_0x9553e7);})['then'](function(_0x2cc011){_0x297927['rows']=_0x2cc011;return _0x297927;})['then'](respondWithFilteredResult(_0xfef345,_0x9553e7))[_0x1eaa('0x42')](handleError(_0xfef345,null));};exports[_0x1eaa('0x43')]=function(_0x4c4a41,_0x42cb49){var _0x4da428={'raw':![],'where':{'id':_0x4c4a41[_0x1eaa('0x44')]['id']}},_0x559e46={};_0x559e46[_0x1eaa('0x33')]=_[_0x1eaa('0x30')](db['ZohoAccount'][_0x1eaa('0x2b')]);_0x559e46[_0x1eaa('0x2f')]=_[_0x1eaa('0x30')](_0x4c4a41['query']);_0x559e46[_0x1eaa('0x31')]=_['intersection'](_0x559e46[_0x1eaa('0x33')],_0x559e46[_0x1eaa('0x2f')]);_0x4da428[_0x1eaa('0x34')]=_['intersection'](_0x559e46[_0x1eaa('0x33')],qs[_0x1eaa('0x35')](_0x4c4a41[_0x1eaa('0x2f')][_0x1eaa('0x35')]));_0x4da428['attributes']=_0x4da428['attributes'][_0x1eaa('0x36')]?_0x4da428[_0x1eaa('0x34')]:_0x559e46['model'];if(_0x4c4a41[_0x1eaa('0x2f')][_0x1eaa('0x3f')]){_0x4da428[_0x1eaa('0x40')]=[{'all':!![]}];}_0x4da428=_[_0x1eaa('0x3d')]({},_0x4da428,_0x4c4a41[_0x1eaa('0x45')]);return db[_0x1eaa('0x2a')][_0x1eaa('0x46')](_0x4da428)[_0x1eaa('0x23')](handleEntityNotFound(_0x42cb49,null))[_0x1eaa('0x23')](respondWithResult(_0x42cb49,null))['catch'](handleError(_0x42cb49,null));};exports['create']=function(_0x333d74,_0x8c584){return db[_0x1eaa('0x2a')][_0x1eaa('0x47')](_0x333d74[_0x1eaa('0x48')],{})[_0x1eaa('0x23')](respondWithResult(_0x8c584,0xc9))[_0x1eaa('0x42')](handleError(_0x8c584,null));};exports[_0x1eaa('0x49')]=function(_0x29d24d,_0x3ce1a5){if(_0x29d24d['body']['id']){delete _0x29d24d[_0x1eaa('0x48')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x29d24d['params']['id']}})['then'](handleEntityNotFound(_0x3ce1a5,null))['then'](saveUpdates(_0x29d24d[_0x1eaa('0x48')],null))[_0x1eaa('0x23')](respondWithResult(_0x3ce1a5,null))[_0x1eaa('0x42')](handleError(_0x3ce1a5,null));};exports[_0x1eaa('0x24')]=function(_0x22e9f6,_0x8d901a){return db[_0x1eaa('0x2a')]['find']({'where':{'id':_0x22e9f6[_0x1eaa('0x44')]['id']}})[_0x1eaa('0x23')](handleEntityNotFound(_0x8d901a,null))['then'](removeEntity(_0x8d901a,null))['catch'](handleError(_0x8d901a,null));};exports[_0x1eaa('0x4a')]=function(_0x5ef20d,_0x405226,_0x202304){var _0x97adde={};var _0xbceb79={};var _0x41b461;var _0x4bb0f8;return db[_0x1eaa('0x2a')]['findOne']({'where':{'id':_0x5ef20d[_0x1eaa('0x44')]['id']}})[_0x1eaa('0x23')](handleEntityNotFound(_0x405226,null))[_0x1eaa('0x23')](function(_0xe0d313){if(_0xe0d313){_0x41b461=_0xe0d313;_0xbceb79[_0x1eaa('0x33')]=_[_0x1eaa('0x30')](db['ZohoConfiguration'][_0x1eaa('0x2b')]);_0xbceb79[_0x1eaa('0x2f')]=_[_0x1eaa('0x30')](_0x5ef20d['query']);_0xbceb79['filters']=_[_0x1eaa('0x32')](_0xbceb79[_0x1eaa('0x33')],_0xbceb79[_0x1eaa('0x2f')]);_0x97adde[_0x1eaa('0x34')]=_['intersection'](_0xbceb79['model'],qs['fields'](_0x5ef20d[_0x1eaa('0x2f')][_0x1eaa('0x35')]));_0x97adde['attributes']=_0x97adde[_0x1eaa('0x34')][_0x1eaa('0x36')]?_0x97adde[_0x1eaa('0x34')]:_0xbceb79[_0x1eaa('0x33')];_0x97adde['order']=qs['sort'](_0x5ef20d[_0x1eaa('0x2f')][_0x1eaa('0x3b')]);_0x97adde['where']=qs[_0x1eaa('0x31')](_['pick'](_0x5ef20d[_0x1eaa('0x2f')],_0xbceb79[_0x1eaa('0x31')]));if(_0x5ef20d['query']['filter']){_0x97adde[_0x1eaa('0x3e')]=_['merge'](_0x97adde['where'],{'$or':_[_0x1eaa('0x29')](_0x97adde['attributes'],function(_0x11811b){var _0x3dbabf={};_0x3dbabf[_0x11811b]={'$like':'%'+_0x5ef20d['query'][_0x1eaa('0x4b')]+'%'};return _0x3dbabf;})});}_0x97adde=_['merge']({},_0x97adde,_0x5ef20d['options']);return _0x41b461[_0x1eaa('0x4a')](_0x97adde);}})[_0x1eaa('0x23')](function(_0x5c9cbb){if(_0x5c9cbb){_0x4bb0f8=_0x5c9cbb['length'];if(!_0x5ef20d[_0x1eaa('0x2f')][_0x1eaa('0x37')](_0x1eaa('0x38'))){_0x97adde[_0x1eaa('0x39')]=qs['limit'](_0x5ef20d['query'][_0x1eaa('0x39')]);_0x97adde[_0x1eaa('0x1c')]=qs['offset'](_0x5ef20d[_0x1eaa('0x2f')][_0x1eaa('0x1c')]);}return _0x41b461[_0x1eaa('0x4a')](_0x97adde);}})[_0x1eaa('0x23')](function(_0x5eb2bc){if(_0x5eb2bc){return _0x5eb2bc?{'count':_0x4bb0f8,'rows':_0x5eb2bc}:null;}})[_0x1eaa('0x23')](respondWithResult(_0x405226,null))[_0x1eaa('0x42')](handleError(_0x405226,null));};exports['addConfiguration']=function(_0x16b285,_0x4a89e8,_0x392549){if(_0x16b285[_0x1eaa('0x48')]['id']){delete _0x16b285[_0x1eaa('0x48')]['id'];}return db[_0x1eaa('0x2a')]['findOne']({'where':{'id':_0x16b285['params']['id']}})[_0x1eaa('0x23')](handleEntityNotFound(_0x4a89e8,null))['then'](function(_0x2afc38){if(_0x2afc38){_0x16b285[_0x1eaa('0x48')][_0x1eaa('0x4c')]=_0x2afc38['id'];_0x16b285[_0x1eaa('0x48')]['Subjects']=integrations['getSubjects'](_0x16b285[_0x1eaa('0x48')][_0x1eaa('0x4d')],_0x16b285[_0x1eaa('0x48')]['type']);_0x16b285[_0x1eaa('0x48')]['Descriptions']=integrations['getDescriptions'](_0x16b285[_0x1eaa('0x48')][_0x1eaa('0x4d')],_0x16b285['body'][_0x1eaa('0x2d')]);return db[_0x1eaa('0x4e')]['create'](_0x16b285['body'],{'include':[{'model':db[_0x1eaa('0x4f')],'as':_0x1eaa('0x50')},{'model':db[_0x1eaa('0x4f')],'as':_0x1eaa('0x51')}]});}return null;})[_0x1eaa('0x23')](respondWithResult(_0x4a89e8,null))['catch'](handleError(_0x4a89e8,null));};function getAccessToken(_0x3466f4){return new Promise(function(_0x445915,_0x49d602){var _0x3ed43f;switch(_0x3466f4[_0x1eaa('0x52')]){case'US':_0x3ed43f=_0x1eaa('0x53');break;case'AU':_0x3ed43f=_0x1eaa('0x54');break;case'EU':_0x3ed43f='https://accounts.zoho.eu';break;case'IN':_0x3ed43f=_0x1eaa('0x55');break;case'CN':_0x3ed43f=_0x1eaa('0x56');break;default:_0x3ed43f=_0x1eaa('0x57');break;}var _0x59a707={'method':'POST','uri':_0x3ed43f+_0x1eaa('0x58'),'qs':{'refresh_token':_0x3466f4['refreshToken'],'client_id':_0x3466f4[_0x1eaa('0x59')],'client_secret':_0x3466f4[_0x1eaa('0x5a')],'grant_type':_0x1eaa('0x5b')},'json':!![]};return rp(_0x59a707)[_0x1eaa('0x23')](function(_0x4fc838){if(_0x4fc838[_0x1eaa('0x5c')]){_0x445915(_0x4fc838[_0x1eaa('0x5c')]);}else{_0x49d602('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x1eaa('0x42')](function(_0xb5cda9){_0x49d602(_0xb5cda9);});});}exports[_0x1eaa('0x5d')]=function(_0x31206a,_0x4ac828,_0x512557){var _0x39af7f,_0x174c1d,_0x23c685,_0x202726,_0x232f66;return db[_0x1eaa('0x2a')][_0x1eaa('0x5e')]({'where':{'id':_0x31206a[_0x1eaa('0x44')]['id']},'attributes':['id',_0x1eaa('0x5f'),_0x1eaa('0x52'),_0x1eaa('0x59'),_0x1eaa('0x5a'),_0x1eaa('0x60'),_0x1eaa('0x61'),_0x1eaa('0x62')]})['then'](handleEntityNotFound(_0x4ac828,null))[_0x1eaa('0x23')](function(_0x202282){_0x232f66=_0x202282;_0x39af7f=_0x232f66[_0x1eaa('0x5f')];_0x174c1d=_0x39af7f===_0x1eaa('0x63')?'eu':'com';_0x23c685=_0x232f66['serverUrl'];var _0x59a4bf=_0x23c685[_0x1eaa('0x64')](-0x1);if(_0x59a4bf==='/'||_0x59a4bf==='\x5c'||_0x59a4bf===':'){_0x23c685=_0x23c685[_0x1eaa('0x65')](0x0,_0x23c685[_0x1eaa('0x66')](_0x59a4bf));}if(!_0x232f66[_0x1eaa('0x62')]){throw new Error(_0x1eaa('0x67'));}return getAccessToken(_0x232f66);})['then'](function(_0x32688e){if(_0x32688e){return rp({'method':_0x1eaa('0x68'),'uri':util['format'](_0x1eaa('0x69'),_0x174c1d),'qs':{'module':_0x1eaa('0x6a')},'headers':{'Authorization':_0x1eaa('0x6b')+_0x32688e},'json':!![]});}})['then'](function(_0xc5fb9f){if(_0xc5fb9f){if(_0xc5fb9f[_0x1eaa('0x6c')]&&_0xc5fb9f[_0x1eaa('0x6c')]['error']){throw new Error(_0xc5fb9f[_0x1eaa('0x6c')][_0x1eaa('0x25')][_0x1eaa('0x6d')]);}var _0x5951c1=[];var _0x53f2f4=[];var _0x5f3b9f=[_0x1eaa('0x6e'),_0x1eaa('0x6f'),_0x1eaa('0x70'),_0x1eaa('0x71'),'Call_Duration',_0x1eaa('0x72'),'Call_Start_Time',_0x1eaa('0x73')];_0x53f2f4=_[_0x1eaa('0x74')](_0xc5fb9f[_0x1eaa('0x35')],function(_0x48be44){return _0x5f3b9f['includes'](_0x48be44[_0x1eaa('0x75')]);});for(var _0x530c40=0x0;_0x530c40<_0x53f2f4[_0x1eaa('0x36')];_0x530c40++){if(_0x53f2f4[_0x530c40][_0x1eaa('0x76')]===![]){_0x5951c1[_0x1eaa('0x77')]({'id':_0x53f2f4[_0x530c40]['id'],'name':_0x53f2f4[_0x530c40][_0x1eaa('0x78')],'custom':_0x53f2f4[_0x530c40][_0x1eaa('0x79')],'options':_0x53f2f4[_0x530c40]['data_type']===_0x1eaa('0x7a')&&_0x53f2f4[_0x530c40][_0x1eaa('0x7b')][_0x1eaa('0x36')]>-0x1?_[_0x1eaa('0x29')](_0x53f2f4[_0x530c40]['pick_list_values'],function(_0x3b6764){return{'name':_0x3b6764,'value':_0x3b6764};}):[]});}}return{'count':_0x5951c1[_0x1eaa('0x36')],'rows':_0x5951c1};}else{return{'count':0x0,'rows':[]};}})[_0x1eaa('0x23')](respondWithResult(_0x4ac828,null))['catch'](function(_0x216ec5){var _0x1df7ac=_0x31206a['query'][_0x1eaa('0x7c')]?0x1f4:_0x216ec5[_0x1eaa('0x7d')]||0x1f4;logger[_0x1eaa('0x25')](_0x1eaa('0x7e'),_0x1eaa('0x5d'),_0x1df7ac,JSON['stringify'](_0x216ec5));delete _0x216ec5['name'];if(_0x1df7ac===0x191){_0x1df7ac=0x190;}_0x4ac828[_0x1eaa('0x1a')](_0x1df7ac)[_0x1eaa('0x27')](_0x31206a[_0x1eaa('0x2f')]['test']?{'message':_0x1eaa('0x7f'),'statusCode':_0x216ec5[_0x1eaa('0x7d')]}:_0x216ec5);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index a84f4f1..361ee7e 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 _0x33a8=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','slice','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','parse','refreshToken','lodash'];(function(_0x3c0d41,_0x188e31){var _0x52a980=function(_0x8ea686){while(--_0x8ea686){_0x3c0d41['push'](_0x3c0d41['shift']());}};_0x52a980(++_0x188e31);}(_0x33a8,0xe5));var _0x833a=function(_0xadbf08,_0x4546c8){_0xadbf08=_0xadbf08-0x0;var _0x297ca7=_0x33a8[_0xadbf08];return _0x297ca7;};'use strict';var _=require(_0x833a('0x0'));var util=require(_0x833a('0x1'));var logger=require(_0x833a('0x2'))(_0x833a('0x3'));var moment=require(_0x833a('0x4'));var BPromise=require(_0x833a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x833a('0x6'));var rimraf=require(_0x833a('0x7'));var config=require(_0x833a('0x8'));var attributes=require(_0x833a('0x9'));var integrations=require(_0x833a('0xa'));module[_0x833a('0xb')]=function(_0x541358,_0xd9558){return _0x541358[_0x833a('0xc')](_0x833a('0xd'),attributes,{'tableName':_0x833a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31c83b,_0x5d86bf,_0x551e41){if(_0x31c83b[_0x833a('0xf')](_0x833a('0x10'))||_0x31c83b[_0x833a('0xf')](_0x833a('0x11'))||_0x31c83b['changed'](_0x833a('0x12'))||_0x31c83b[_0x833a('0xf')](_0x833a('0x13'))||_0x31c83b['changed'](_0x833a('0x14'))||_0x31c83b[_0x833a('0xf')](_0x833a('0x15'))){var _0x17739c,_0x18ccc1;_0x17739c=_0x31c83b[_0x833a('0x11')];var _0x1cd3fa=_0x17739c['slice'](-0x1);if(_0x1cd3fa==='/'||_0x1cd3fa==='\x5c'||_0x1cd3fa===':'){_0x17739c=_0x17739c[_0x833a('0x16')](0x0,_0x17739c[_0x833a('0x17')](_0x1cd3fa));}switch(_0x31c83b[_0x833a('0x10')]){case'US':_0x18ccc1='https://accounts.zoho.com';break;case'AU':_0x18ccc1=_0x833a('0x18');break;case'IN':_0x18ccc1='https://accounts.zoho.in';break;case'CN':_0x18ccc1='https://accounts.zoho.com.cn';break;default:_0x18ccc1=_0x833a('0x19');break;}var _0x278276={'method':_0x833a('0x1a'),'uri':_0x18ccc1+_0x833a('0x1b'),'form':{'grant_type':_0x833a('0x1c'),'client_id':_0x31c83b['clientId'],'client_secret':_0x31c83b['clientSecret'],'redirect_uri':_0x31c83b[_0x833a('0x11')],'code':_0x31c83b[_0x833a('0x14')]},'headers':{'Content-Type':_0x833a('0x1d')}};return rp(_0x278276)[_0x833a('0x1e')](function(_0x17ef7e){var _0x262aed=JSON['parse'](_0x17ef7e);if(_0x262aed[_0x833a('0x1f')]){_0x31c83b['refreshToken']=_0x262aed[_0x833a('0x1f')];logger[_0x833a('0x20')](util[_0x833a('0x21')](_0x833a('0x22'),_0x31c83b[_0x833a('0x23')],_0x31c83b['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31c83b[_0x833a('0x23')],_0x31c83b['id']),util[_0x833a('0x24')](_0x262aed,{'showHidden':![],'depth':null}));}return _0x551e41(null,_0x5d86bf);})[_0x833a('0x25')](function(_0x41cf7f){logger[_0x833a('0x26')](util[_0x833a('0x21')](_0x833a('0x27'),_0x31c83b[_0x833a('0x23')],_0x31c83b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x551e41(_0x41cf7f);});}else{return _0x551e41(null,_0x5d86bf);}},'beforeUpdate':function(_0x5804d8,_0x3b15fc,_0x137a79){if(_0x5804d8['changed'](_0x833a('0x10'))||_0x5804d8[_0x833a('0xf')]('serverUrl')||_0x5804d8[_0x833a('0xf')](_0x833a('0x12'))||_0x5804d8[_0x833a('0xf')]('clientSecret')||_0x5804d8[_0x833a('0xf')]('code')||_0x5804d8[_0x833a('0xf')]('host')){var _0xb80485,_0x3657bb;_0xb80485=_0x5804d8[_0x833a('0x11')];var _0x27f400=_0xb80485[_0x833a('0x28')](-0x1);if(_0x27f400==='/'||_0x27f400==='\x5c'||_0x27f400===':'){_0xb80485=_0xb80485['substring'](0x0,_0xb80485[_0x833a('0x17')](_0x27f400));}switch(_0x5804d8[_0x833a('0x10')]){case'US':_0x3657bb=_0x833a('0x29');break;case'AU':_0x3657bb=_0x833a('0x18');break;case'IN':_0x3657bb=_0x833a('0x2a');break;case'CN':_0x3657bb=_0x833a('0x2b');break;default:_0x3657bb=_0x833a('0x19');break;}var _0x176a10={'method':_0x833a('0x1a'),'uri':_0x3657bb+_0x833a('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x5804d8[_0x833a('0x12')],'client_secret':_0x5804d8[_0x833a('0x13')],'redirect_uri':_0x5804d8[_0x833a('0x11')],'code':_0x5804d8[_0x833a('0x14')]},'headers':{'Content-Type':_0x833a('0x1d')}};return rp(_0x176a10)['then'](function(_0x5eb6cb){var _0x56bcd1=JSON[_0x833a('0x2c')](_0x5eb6cb);if(_0x56bcd1[_0x833a('0x1f')]){_0x5804d8[_0x833a('0x2d')]=_0x56bcd1[_0x833a('0x1f')];logger[_0x833a('0x20')](util['format'](_0x833a('0x22'),_0x5804d8[_0x833a('0x23')],_0x5804d8['id']));}else{logger[_0x833a('0x26')](util[_0x833a('0x21')](_0x833a('0x27'),_0x5804d8[_0x833a('0x23')],_0x5804d8['id']),util['inspect'](_0x56bcd1,{'showHidden':![],'depth':null}));}return _0x137a79(null,_0x3b15fc);})[_0x833a('0x25')](function(_0x3cfc1c){logger[_0x833a('0x26')](util[_0x833a('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5804d8[_0x833a('0x23')],_0x5804d8['id']),util[_0x833a('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x137a79(_0x3cfc1c);});}else{return _0x137a79(null,_0x3b15fc);}}}});}; \ No newline at end of file +var _0x3420=['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','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','https://accounts.zoho.com.cn','authorization_code','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token'];(function(_0x9caaf7,_0x28d693){var _0x5ab53f=function(_0xa974de){while(--_0xa974de){_0x9caaf7['push'](_0x9caaf7['shift']());}};_0x5ab53f(++_0x28d693);}(_0x3420,0x117));var _0x0342=function(_0x308f9b,_0x4ccd27){_0x308f9b=_0x308f9b-0x0;var _0x37847a=_0x3420[_0x308f9b];return _0x37847a;};'use strict';var _=require(_0x0342('0x0'));var util=require(_0x0342('0x1'));var logger=require(_0x0342('0x2'))(_0x0342('0x3'));var moment=require(_0x0342('0x4'));var BPromise=require(_0x0342('0x5'));var rp=require(_0x0342('0x6'));var fs=require('fs');var path=require(_0x0342('0x7'));var rimraf=require('rimraf');var config=require(_0x0342('0x8'));var attributes=require(_0x0342('0x9'));var integrations=require(_0x0342('0xa'));module['exports']=function(_0x4d6496,_0x28e6ca){return _0x4d6496[_0x0342('0xb')]('ZohoAccount',attributes,{'tableName':_0x0342('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d1fef,_0x17e2e6,_0x57a3e9){if(_0x5d1fef[_0x0342('0xd')](_0x0342('0xe'))||_0x5d1fef['changed'](_0x0342('0xf'))||_0x5d1fef[_0x0342('0xd')](_0x0342('0x10'))||_0x5d1fef[_0x0342('0xd')](_0x0342('0x11'))||_0x5d1fef[_0x0342('0xd')](_0x0342('0x12'))||_0x5d1fef[_0x0342('0xd')](_0x0342('0x13'))){var _0xafda06,_0x5cde04;_0xafda06=_0x5d1fef['serverUrl'];var _0x5c2acf=_0xafda06[_0x0342('0x14')](-0x1);if(_0x5c2acf==='/'||_0x5c2acf==='\x5c'||_0x5c2acf===':'){_0xafda06=_0xafda06[_0x0342('0x15')](0x0,_0xafda06[_0x0342('0x16')](_0x5c2acf));}switch(_0x5d1fef[_0x0342('0xe')]){case'US':_0x5cde04=_0x0342('0x17');break;case'AU':_0x5cde04=_0x0342('0x18');break;case'IN':_0x5cde04=_0x0342('0x19');break;case'CN':_0x5cde04='https://accounts.zoho.com.cn';break;default:_0x5cde04=_0x0342('0x1a');break;}var _0x503ea4={'method':_0x0342('0x1b'),'uri':_0x5cde04+_0x0342('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x5d1fef['clientId'],'client_secret':_0x5d1fef[_0x0342('0x11')],'redirect_uri':_0x5d1fef[_0x0342('0xf')],'code':_0x5d1fef['code']},'headers':{'Content-Type':_0x0342('0x1d')}};return rp(_0x503ea4)[_0x0342('0x1e')](function(_0xa3a49f){var _0x246775=JSON[_0x0342('0x1f')](_0xa3a49f);if(_0x246775[_0x0342('0x20')]){_0x5d1fef[_0x0342('0x21')]=_0x246775[_0x0342('0x20')];logger[_0x0342('0x22')](util[_0x0342('0x23')](_0x0342('0x24'),_0x5d1fef[_0x0342('0x25')],_0x5d1fef['id']));}else{logger['error'](util[_0x0342('0x23')](_0x0342('0x26'),_0x5d1fef[_0x0342('0x25')],_0x5d1fef['id']),util[_0x0342('0x27')](_0x246775,{'showHidden':![],'depth':null}));}return _0x57a3e9(null,_0x17e2e6);})[_0x0342('0x28')](function(_0x4c7e4b){logger[_0x0342('0x29')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5d1fef[_0x0342('0x25')],_0x5d1fef['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x57a3e9(_0x4c7e4b);});}else{return _0x57a3e9(null,_0x17e2e6);}},'beforeUpdate':function(_0x163b81,_0x56a117,_0xf0778){if(_0x163b81[_0x0342('0xd')](_0x0342('0xe'))||_0x163b81[_0x0342('0xd')](_0x0342('0xf'))||_0x163b81[_0x0342('0xd')]('clientId')||_0x163b81['changed']('clientSecret')||_0x163b81[_0x0342('0xd')]('code')||_0x163b81['changed'](_0x0342('0x13'))){var _0x539e0d,_0x30edff;_0x539e0d=_0x163b81[_0x0342('0xf')];var _0x2e269a=_0x539e0d[_0x0342('0x14')](-0x1);if(_0x2e269a==='/'||_0x2e269a==='\x5c'||_0x2e269a===':'){_0x539e0d=_0x539e0d['substring'](0x0,_0x539e0d[_0x0342('0x16')](_0x2e269a));}switch(_0x163b81[_0x0342('0xe')]){case'US':_0x30edff=_0x0342('0x17');break;case'AU':_0x30edff=_0x0342('0x18');break;case'IN':_0x30edff=_0x0342('0x19');break;case'CN':_0x30edff=_0x0342('0x2a');break;default:_0x30edff='https://accounts.zoho.eu';break;}var _0x4ccbac={'method':_0x0342('0x1b'),'uri':_0x30edff+'/oauth/v2/token','form':{'grant_type':_0x0342('0x2b'),'client_id':_0x163b81[_0x0342('0x10')],'client_secret':_0x163b81[_0x0342('0x11')],'redirect_uri':_0x163b81[_0x0342('0xf')],'code':_0x163b81['code']},'headers':{'Content-Type':_0x0342('0x1d')}};return rp(_0x4ccbac)[_0x0342('0x1e')](function(_0x130637){var _0x1935f9=JSON['parse'](_0x130637);if(_0x1935f9[_0x0342('0x20')]){_0x163b81[_0x0342('0x21')]=_0x1935f9[_0x0342('0x20')];logger[_0x0342('0x22')](util[_0x0342('0x23')](_0x0342('0x24'),_0x163b81[_0x0342('0x25')],_0x163b81['id']));}else{logger['error'](util[_0x0342('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x163b81[_0x0342('0x25')],_0x163b81['id']),util['inspect'](_0x1935f9,{'showHidden':![],'depth':null}));}return _0xf0778(null,_0x56a117);})['catch'](function(_0x5714b6){logger[_0x0342('0x29')](util[_0x0342('0x23')](_0x0342('0x26'),_0x163b81[_0x0342('0x25')],_0x163b81['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xf0778(_0x5714b6);});}else{return _0xf0778(null,_0x56a117);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 821a973..83dbd6c 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 _0x10ad=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZohoAccount','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1ed8b8,_0x5255fb){var _0x4e01d3=function(_0x2b1aec){while(--_0x2b1aec){_0x1ed8b8['push'](_0x1ed8b8['shift']());}};_0x4e01d3(++_0x5255fb);}(_0x10ad,0xf4));var _0xd10a=function(_0x99b617,_0x331413){_0x99b617=_0x99b617-0x0;var _0x4d9f42=_0x10ad[_0x99b617];return _0x4d9f42;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd10a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd10a('0x1'));var db=require(_0xd10a('0x2'))['db'];var utils=require(_0xd10a('0x3'));var logger=require(_0xd10a('0x4'))('rpc');var config=require(_0xd10a('0x5'));var jayson=require(_0xd10a('0x6'));var client=jayson[_0xd10a('0x7')][_0xd10a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x429316,_0xdae354,_0x217329){return new BPromise(function(_0x194a4a,_0x5be3da){return client['request'](_0x429316,_0x217329)[_0xd10a('0x9')](function(_0x4d8613){logger[_0xd10a('0xa')](_0xd10a('0xb'),_0xdae354,_0xd10a('0xc'));logger[_0xd10a('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xdae354,_0xd10a('0xc'),JSON[_0xd10a('0xe')](_0x4d8613));if(_0x4d8613[_0xd10a('0xf')]){if(_0x4d8613['error'][_0xd10a('0x10')]===0x1f4){logger[_0xd10a('0xf')](_0xd10a('0xb'),_0xdae354,_0x4d8613[_0xd10a('0xf')][_0xd10a('0x11')]);return _0x5be3da(_0x4d8613[_0xd10a('0xf')]['message']);}logger['error'](_0xd10a('0xb'),_0xdae354,_0x4d8613[_0xd10a('0xf')][_0xd10a('0x11')]);return _0x194a4a(_0x4d8613[_0xd10a('0xf')]['message']);}else{logger['info'](_0xd10a('0xb'),_0xdae354,_0xd10a('0xc'));_0x194a4a(_0x4d8613[_0xd10a('0x12')][_0xd10a('0x11')]);}})[_0xd10a('0x13')](function(_0x33bb89){logger[_0xd10a('0xf')](_0xd10a('0xb'),_0xdae354,_0x33bb89);_0x5be3da(_0x33bb89);});});}exports[_0xd10a('0x14')]=function(_0x48a07b){var _0x589fb3=this;return new Promise(function(_0x40dd9f,_0x27d1a7){return db['ZohoAccount']['findAll']({'raw':_0x48a07b['options']?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x16')]===undefined?!![]:![]:!![],'where':_0x48a07b['options']?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x17')]||null:null,'attributes':_0x48a07b['options']?_0x48a07b['options'][_0xd10a('0x18')]||null:null,'limit':_0x48a07b['options']?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x19')]||null:null,'include':_0x48a07b[_0xd10a('0x15')]?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x1a')]?_[_0xd10a('0x1b')](_0x48a07b['options'][_0xd10a('0x1a')],function(_0x13eefe){return{'model':db[_0x13eefe[_0xd10a('0x1c')]],'as':_0x13eefe['as'],'attributes':_0x13eefe[_0xd10a('0x18')],'include':_0x13eefe[_0xd10a('0x1a')]?_[_0xd10a('0x1b')](_0x13eefe[_0xd10a('0x1a')],function(_0x3715fe){return{'model':db[_0x3715fe['model']],'as':_0x3715fe['as'],'attributes':_0x3715fe['attributes'],'include':_0x3715fe['include']?_[_0xd10a('0x1b')](_0x3715fe[_0xd10a('0x1a')],function(_0x58f500){return{'model':db[_0x58f500[_0xd10a('0x1c')]],'as':_0x58f500['as'],'attributes':_0x58f500[_0xd10a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd10a('0x9')](function(_0x152bd5){logger[_0xd10a('0xa')]('GetZohoAccount',_0x48a07b);logger[_0xd10a('0xd')](_0xd10a('0x14'),_0x48a07b,JSON[_0xd10a('0xe')](_0x152bd5));_0x40dd9f(_0x152bd5);})[_0xd10a('0x13')](function(_0x41e582){logger[_0xd10a('0xf')](_0xd10a('0x14'),_0x41e582[_0xd10a('0x11')],_0x48a07b);_0x27d1a7(_0x589fb3[_0xd10a('0xf')](0x1f4,_0x41e582[_0xd10a('0x11')]));});});};exports[_0xd10a('0x1d')]=function(_0x45e9fd){var _0x12ab07=this;return new Promise(function(_0xd7741,_0x4ad3d4){return db['ZohoAccount'][_0xd10a('0x1e')]({'raw':_0x45e9fd[_0xd10a('0x15')]?_0x45e9fd[_0xd10a('0x15')][_0xd10a('0x16')]===undefined?!![]:![]:!![],'where':_0x45e9fd[_0xd10a('0x15')]?_0x45e9fd[_0xd10a('0x15')]['where']||null:null,'attributes':_0x45e9fd[_0xd10a('0x15')]?_0x45e9fd[_0xd10a('0x15')]['attributes']||null:null,'include':_0x45e9fd['options']?_0x45e9fd[_0xd10a('0x15')][_0xd10a('0x1a')]?_[_0xd10a('0x1b')](_0x45e9fd[_0xd10a('0x15')]['include'],function(_0xa6aeeb){return{'model':db[_0xa6aeeb['model']],'as':_0xa6aeeb['as'],'attributes':_0xa6aeeb[_0xd10a('0x18')],'include':_0xa6aeeb['include']?_['map'](_0xa6aeeb[_0xd10a('0x1a')],function(_0x1bce2b){return{'model':db[_0x1bce2b[_0xd10a('0x1c')]],'as':_0x1bce2b['as'],'attributes':_0x1bce2b['attributes'],'include':_0x1bce2b[_0xd10a('0x1a')]?_['map'](_0x1bce2b[_0xd10a('0x1a')],function(_0x1ab0a2){return{'model':db[_0x1ab0a2[_0xd10a('0x1c')]],'as':_0x1ab0a2['as'],'attributes':_0x1ab0a2[_0xd10a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd10a('0x9')](function(_0x22ee6e){logger[_0xd10a('0xa')]('ShowZohoAccount',_0x45e9fd);logger[_0xd10a('0xd')](_0xd10a('0x1d'),_0x45e9fd,JSON[_0xd10a('0xe')](_0x22ee6e));_0xd7741(_0x22ee6e);})[_0xd10a('0x13')](function(_0x4997b0){logger[_0xd10a('0xf')](_0xd10a('0x1d'),_0x4997b0[_0xd10a('0x11')],_0x45e9fd);_0x4ad3d4(_0x12ab07['error'](0x1f4,_0x4997b0['message']));});});}; \ No newline at end of file +var _0xab54=['where','attributes','limit','include','map','model','then','GetZohoAccount','debug','stringify','ShowZohoAccount','ZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','findAll','raw','options'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0xab54,0x115));var _0x4ab5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab54[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4ab5('0x0'));var moment=require(_0x4ab5('0x1'));var BPromise=require(_0x4ab5('0x2'));var rs=require(_0x4ab5('0x3'));var fs=require('fs');var Redis=require(_0x4ab5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ab5('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4ab5('0x6'));var client=jayson[_0x4ab5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c39fe,_0x5c8c61,_0x467942){return new BPromise(function(_0x600112,_0xd57886){return client[_0x4ab5('0x8')](_0x2c39fe,_0x467942)['then'](function(_0x58e6a7){logger['info'](_0x4ab5('0x9'),_0x5c8c61,_0x4ab5('0xa'));logger['debug'](_0x4ab5('0xb'),_0x5c8c61,_0x4ab5('0xa'),JSON['stringify'](_0x58e6a7));if(_0x58e6a7[_0x4ab5('0xc')]){if(_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xd')]===0x1f4){logger[_0x4ab5('0xc')](_0x4ab5('0x9'),_0x5c8c61,_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xe')]);return _0xd57886(_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xe')]);}logger[_0x4ab5('0xc')](_0x4ab5('0x9'),_0x5c8c61,_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xe')]);return _0x600112(_0x58e6a7[_0x4ab5('0xc')]['message']);}else{logger[_0x4ab5('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x5c8c61,_0x4ab5('0xa'));_0x600112(_0x58e6a7['result']['message']);}})[_0x4ab5('0x10')](function(_0x1b1ca5){logger[_0x4ab5('0xc')](_0x4ab5('0x9'),_0x5c8c61,_0x1b1ca5);_0xd57886(_0x1b1ca5);});});}exports['GetZohoAccount']=function(_0x151ec6){var _0x3f46c1=this;return new Promise(function(_0x4b60c1,_0x4acebb){return db['ZohoAccount'][_0x4ab5('0x11')]({'raw':_0x151ec6['options']?_0x151ec6['options'][_0x4ab5('0x12')]===undefined?!![]:![]:!![],'where':_0x151ec6[_0x4ab5('0x13')]?_0x151ec6[_0x4ab5('0x13')][_0x4ab5('0x14')]||null:null,'attributes':_0x151ec6[_0x4ab5('0x13')]?_0x151ec6[_0x4ab5('0x13')][_0x4ab5('0x15')]||null:null,'limit':_0x151ec6['options']?_0x151ec6[_0x4ab5('0x13')][_0x4ab5('0x16')]||null:null,'include':_0x151ec6[_0x4ab5('0x13')]?_0x151ec6[_0x4ab5('0x13')][_0x4ab5('0x17')]?_[_0x4ab5('0x18')](_0x151ec6['options'][_0x4ab5('0x17')],function(_0x5af3df){return{'model':db[_0x5af3df[_0x4ab5('0x19')]],'as':_0x5af3df['as'],'attributes':_0x5af3df[_0x4ab5('0x15')],'include':_0x5af3df[_0x4ab5('0x17')]?_[_0x4ab5('0x18')](_0x5af3df[_0x4ab5('0x17')],function(_0x231945){return{'model':db[_0x231945[_0x4ab5('0x19')]],'as':_0x231945['as'],'attributes':_0x231945[_0x4ab5('0x15')],'include':_0x231945[_0x4ab5('0x17')]?_[_0x4ab5('0x18')](_0x231945['include'],function(_0x1a5b9c){return{'model':db[_0x1a5b9c[_0x4ab5('0x19')]],'as':_0x1a5b9c['as'],'attributes':_0x1a5b9c[_0x4ab5('0x15')]};}):[]};}):[]};}):[]:[]})[_0x4ab5('0x1a')](function(_0x1c3a2e){logger[_0x4ab5('0xf')](_0x4ab5('0x1b'),_0x151ec6);logger[_0x4ab5('0x1c')](_0x4ab5('0x1b'),_0x151ec6,JSON[_0x4ab5('0x1d')](_0x1c3a2e));_0x4b60c1(_0x1c3a2e);})[_0x4ab5('0x10')](function(_0x19a1f8){logger[_0x4ab5('0xc')](_0x4ab5('0x1b'),_0x19a1f8['message'],_0x151ec6);_0x4acebb(_0x3f46c1[_0x4ab5('0xc')](0x1f4,_0x19a1f8[_0x4ab5('0xe')]));});});};exports[_0x4ab5('0x1e')]=function(_0x513a4f){var _0x5568e9=this;return new Promise(function(_0x3c0b72,_0xb507a7){return db[_0x4ab5('0x1f')][_0x4ab5('0x20')]({'raw':_0x513a4f['options']?_0x513a4f[_0x4ab5('0x13')][_0x4ab5('0x12')]===undefined?!![]:![]:!![],'where':_0x513a4f['options']?_0x513a4f[_0x4ab5('0x13')][_0x4ab5('0x14')]||null:null,'attributes':_0x513a4f[_0x4ab5('0x13')]?_0x513a4f['options'][_0x4ab5('0x15')]||null:null,'include':_0x513a4f[_0x4ab5('0x13')]?_0x513a4f[_0x4ab5('0x13')]['include']?_[_0x4ab5('0x18')](_0x513a4f['options'][_0x4ab5('0x17')],function(_0x4da284){return{'model':db[_0x4da284[_0x4ab5('0x19')]],'as':_0x4da284['as'],'attributes':_0x4da284[_0x4ab5('0x15')],'include':_0x4da284[_0x4ab5('0x17')]?_[_0x4ab5('0x18')](_0x4da284['include'],function(_0x2ddd58){return{'model':db[_0x2ddd58[_0x4ab5('0x19')]],'as':_0x2ddd58['as'],'attributes':_0x2ddd58['attributes'],'include':_0x2ddd58[_0x4ab5('0x17')]?_[_0x4ab5('0x18')](_0x2ddd58[_0x4ab5('0x17')],function(_0x1172e5){return{'model':db[_0x1172e5[_0x4ab5('0x19')]],'as':_0x1172e5['as'],'attributes':_0x1172e5[_0x4ab5('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8d74a){logger[_0x4ab5('0xf')](_0x4ab5('0x1e'),_0x513a4f);logger['debug'](_0x4ab5('0x1e'),_0x513a4f,JSON[_0x4ab5('0x1d')](_0x8d74a));_0x3c0b72(_0x8d74a);})[_0x4ab5('0x10')](function(_0x411c9f){logger[_0x4ab5('0xc')](_0x4ab5('0x1e'),_0x411c9f[_0x4ab5('0xe')],_0x513a4f);_0xb507a7(_0x5568e9[_0x4ab5('0xc')](0x1f4,_0x411c9f['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index aa251c7..9526194 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 _0xade3=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update'];(function(_0x282ba9,_0x25f397){var _0x135504=function(_0x8d5282){while(--_0x8d5282){_0x282ba9['push'](_0x282ba9['shift']());}};_0x135504(++_0x25f397);}(_0xade3,0xd1));var _0x3ade=function(_0x59eedc,_0x542c7d){_0x59eedc=_0x59eedc-0x0;var _0x5808b3=_0xade3[_0x59eedc];return _0x5808b3;};'use strict';var multer=require(_0x3ade('0x0'));var util=require(_0x3ade('0x1'));var path=require('path');var timeout=require(_0x3ade('0x2'));var express=require(_0x3ade('0x3'));var router=express[_0x3ade('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3ade('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3ade('0x6'));var controller=require(_0x3ade('0x7'));router[_0x3ade('0x8')]('/',auth[_0x3ade('0x9')](),controller[_0x3ade('0xa')]);router[_0x3ade('0x8')](_0x3ade('0xb'),auth['isAuthenticated'](),controller[_0x3ade('0xc')]);router[_0x3ade('0x8')](_0x3ade('0xd'),auth[_0x3ade('0x9')](),controller[_0x3ade('0xe')]);router[_0x3ade('0x8')](_0x3ade('0xf'),auth[_0x3ade('0x9')](),controller[_0x3ade('0x10')]);router[_0x3ade('0x8')](_0x3ade('0x11'),auth[_0x3ade('0x9')](),controller['getDescriptions']);router[_0x3ade('0x12')]('/',auth[_0x3ade('0x9')](),controller[_0x3ade('0x13')]);router['put'](_0x3ade('0xb'),auth['isAuthenticated'](),controller[_0x3ade('0x14')]);router['delete'](_0x3ade('0xb'),auth['isAuthenticated'](),controller[_0x3ade('0x15')]);module[_0x3ade('0x16')]=router; \ No newline at end of file +var _0x5ddb=['post','create','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x42ab33,_0x49fee9){var _0x216734=function(_0x5abe20){while(--_0x5abe20){_0x42ab33['push'](_0x42ab33['shift']());}};_0x216734(++_0x49fee9);}(_0x5ddb,0xf7));var _0xb5dd=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x5ddb[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require('multer');var util=require(_0xb5dd('0x0'));var path=require('path');var timeout=require(_0xb5dd('0x1'));var express=require(_0xb5dd('0x2'));var router=express[_0xb5dd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb5dd('0x4'));var interaction=require(_0xb5dd('0x5'));var config=require(_0xb5dd('0x6'));var controller=require(_0xb5dd('0x7'));router[_0xb5dd('0x8')]('/',auth['isAuthenticated'](),controller[_0xb5dd('0x9')]);router['get'](_0xb5dd('0xa'),auth[_0xb5dd('0xb')](),controller[_0xb5dd('0xc')]);router[_0xb5dd('0x8')]('/:id/fields',auth[_0xb5dd('0xb')](),controller[_0xb5dd('0xd')]);router[_0xb5dd('0x8')](_0xb5dd('0xe'),auth[_0xb5dd('0xb')](),controller[_0xb5dd('0xf')]);router[_0xb5dd('0x8')]('/:id/descriptions',auth[_0xb5dd('0xb')](),controller[_0xb5dd('0x10')]);router[_0xb5dd('0x11')]('/',auth['isAuthenticated'](),controller[_0xb5dd('0x12')]);router['put']('/:id',auth[_0xb5dd('0xb')](),controller[_0xb5dd('0x13')]);router['delete'](_0xb5dd('0xa'),auth[_0xb5dd('0xb')](),controller[_0xb5dd('0x14')]);module[_0xb5dd('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 9e08f6d..64714d3 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 _0x407d=['exports','lead','contact','nothing','contact_lead','sequelize'];(function(_0x57cb7d,_0x2b1081){var _0x58907c=function(_0x32efe7){while(--_0x32efe7){_0x57cb7d['push'](_0x57cb7d['shift']());}};_0x58907c(++_0x2b1081);}(_0x407d,0x19d));var _0xd407=function(_0x405174,_0x4f3131){_0x405174=_0x405174-0x0;var _0x20fec3=_0x407d[_0x405174];return _0x20fec3;};'use strict';var Sequelize=require(_0xd407('0x0'));module[_0xd407('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0xd407('0x2'),_0xd407('0x3'),_0xd407('0x4')),'defaultValue':_0xd407('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0xd407('0x2')),'defaultValue':_0xd407('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x30cb=['ENUM','lead','contact','nothing','sequelize','exports','STRING'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x30cb,0x1c4));var _0xb30c=function(_0xffa1cd,_0x533c8c){_0xffa1cd=_0xffa1cd-0x0;var _0x231e13=_0x30cb[_0xffa1cd];return _0x231e13;};'use strict';var Sequelize=require(_0xb30c('0x0'));module[_0xb30c('0x1')]={'name':{'type':Sequelize[_0xb30c('0x2')]},'moduleCreate':{'type':Sequelize[_0xb30c('0x3')](_0xb30c('0x4'),_0xb30c('0x5'),_0xb30c('0x6')),'defaultValue':_0xb30c('0x4')},'moduleSearch':{'type':Sequelize[_0xb30c('0x3')]('contact_lead','contact',_0xb30c('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xb30c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 76dc9d4..4487a1d 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 _0x60b1=['squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','send','map','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ZohoConfiguration','rows','show','find','catch','create','body','params','getFields','findOne','ZohoField','sort','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5ae319,_0x62bcf2){var _0x3b0ab1=function(_0x23c9d6){while(--_0x23c9d6){_0x5ae319['push'](_0x5ae319['shift']());}};_0x3b0ab1(++_0x62bcf2);}(_0x60b1,0x91));var _0x160b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x60b1[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x160b('0x0'));var zipdir=require(_0x160b('0x1'));var jsonpatch=require(_0x160b('0x2'));var rp=require(_0x160b('0x3'));var moment=require(_0x160b('0x4'));var BPromise=require(_0x160b('0x5'));var Mustache=require(_0x160b('0x6'));var util=require('util');var path=require(_0x160b('0x7'));var sox=require(_0x160b('0x8'));var csv=require(_0x160b('0x9'));var ejs=require(_0x160b('0xa'));var fs=require('fs');var fs_extra=require(_0x160b('0xb'));var _=require(_0x160b('0xc'));var squel=require(_0x160b('0xd'));var crypto=require('crypto');var jsforce=require(_0x160b('0xe'));var deskjs=require(_0x160b('0xf'));var toCsv=require(_0x160b('0x9'));var querystring=require(_0x160b('0x10'));var Papa=require('papaparse');var Redis=require(_0x160b('0x11'));var authService=require(_0x160b('0x12'));var qs=require(_0x160b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x160b('0x14'));var logger=require(_0x160b('0x15'))(_0x160b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x160b('0x17'));var db=require(_0x160b('0x18'))['db'];function respondWithStatusCode(_0x46448a,_0x421745){_0x421745=_0x421745||0xcc;return function(_0x176983){if(_0x176983){return _0x46448a[_0x160b('0x19')](_0x421745);}return _0x46448a[_0x160b('0x1a')](_0x421745)[_0x160b('0x1b')]();};}function respondWithResult(_0x15c19d,_0x4f6ec3){_0x4f6ec3=_0x4f6ec3||0xc8;return function(_0x1407a6){if(_0x1407a6){return _0x15c19d[_0x160b('0x1a')](_0x4f6ec3)[_0x160b('0x1c')](_0x1407a6);}};}function respondWithFilteredResult(_0x17bf7e,_0xbc778e){return function(_0x5e85a6){if(_0x5e85a6){var _0x3e1610=typeof _0xbc778e['offset']===_0x160b('0x1d')&&typeof _0xbc778e['limit']===_0x160b('0x1d');var _0x323bc0=_0x5e85a6[_0x160b('0x1e')];var _0x213030=_0x3e1610?0x0:_0xbc778e[_0x160b('0x1f')];var _0x13b013=_0x3e1610?_0x5e85a6[_0x160b('0x1e')]:_0xbc778e['offset']+_0xbc778e['limit'];var _0x563177;if(_0x13b013>=_0x323bc0){_0x13b013=_0x323bc0;_0x563177=0xc8;}else{_0x563177=0xce;}_0x17bf7e[_0x160b('0x1a')](_0x563177);return _0x17bf7e['set'](_0x160b('0x20'),_0x213030+'-'+_0x13b013+'/'+_0x323bc0)[_0x160b('0x1c')](_0x5e85a6);}return null;};}function patchUpdates(_0x5d9371){return function(_0x4c927e){try{jsonpatch[_0x160b('0x21')](_0x4c927e,_0x5d9371,!![]);}catch(_0x2c0eaa){return BPromise[_0x160b('0x22')](_0x2c0eaa);}return _0x4c927e[_0x160b('0x23')]();};}function saveUpdates(_0x4a4feb,_0x15d136){return function(_0xb54ee4){if(_0xb54ee4){return _0xb54ee4[_0x160b('0x24')](_0x4a4feb)[_0x160b('0x25')](function(_0x3bc291){return _0x3bc291;});}return null;};}function removeEntity(_0x559166,_0x170dff){return function(_0x4c6d38){if(_0x4c6d38){return _0x4c6d38[_0x160b('0x26')]()['then'](function(){_0x559166[_0x160b('0x1a')](0xcc)[_0x160b('0x1b')]();});}};}function handleEntityNotFound(_0x30dc10,_0x24c22f){return function(_0x4d65db){if(!_0x4d65db){_0x30dc10[_0x160b('0x19')](0x194);}return _0x4d65db;};}function handleError(_0x2f663c,_0x4689b8){_0x4689b8=_0x4689b8||0x1f4;return function(_0x3dd90b){logger[_0x160b('0x27')](_0x3dd90b['stack']);if(_0x3dd90b['name']){delete _0x3dd90b['name'];}_0x2f663c['status'](_0x4689b8)[_0x160b('0x28')](_0x3dd90b);};}exports['index']=function(_0x414548,_0x2c06c0){var _0x184ea0={},_0x1aafb6={},_0x9fdac={'count':0x0,'rows':[]};var _0x32e058=_[_0x160b('0x29')](db['ZohoConfiguration'][_0x160b('0x2a')],function(_0x55b9ea){return{'name':_0x55b9ea['fieldName'],'type':_0x55b9ea[_0x160b('0x2b')]['key']};});_0x1aafb6[_0x160b('0x2c')]=_[_0x160b('0x29')](_0x32e058,_0x160b('0x2d'));_0x1aafb6[_0x160b('0x2e')]=_[_0x160b('0x2f')](_0x414548['query']);_0x1aafb6[_0x160b('0x30')]=_[_0x160b('0x31')](_0x1aafb6[_0x160b('0x2c')],_0x1aafb6[_0x160b('0x2e')]);_0x184ea0[_0x160b('0x32')]=_[_0x160b('0x31')](_0x1aafb6[_0x160b('0x2c')],qs[_0x160b('0x33')](_0x414548['query'][_0x160b('0x33')]));_0x184ea0['attributes']=_0x184ea0['attributes'][_0x160b('0x34')]?_0x184ea0[_0x160b('0x32')]:_0x1aafb6[_0x160b('0x2c')];if(!_0x414548[_0x160b('0x2e')][_0x160b('0x35')](_0x160b('0x36'))){_0x184ea0[_0x160b('0x37')]=qs[_0x160b('0x37')](_0x414548[_0x160b('0x2e')]['limit']);_0x184ea0[_0x160b('0x1f')]=qs[_0x160b('0x1f')](_0x414548[_0x160b('0x2e')][_0x160b('0x1f')]);}_0x184ea0[_0x160b('0x38')]=qs['sort'](_0x414548['query']['sort']);_0x184ea0[_0x160b('0x39')]=qs[_0x160b('0x30')](_[_0x160b('0x3a')](_0x414548[_0x160b('0x2e')],_0x1aafb6['filters']),_0x32e058);if(_0x414548['query'][_0x160b('0x3b')]){_0x184ea0[_0x160b('0x39')]=_[_0x160b('0x3c')](_0x184ea0['where'],{'$or':_[_0x160b('0x29')](_0x32e058,function(_0x2e135c){if(_0x2e135c[_0x160b('0x2b')]!==_0x160b('0x3d')){var _0x4865b7={};_0x4865b7[_0x2e135c[_0x160b('0x2d')]]={'$like':'%'+_0x414548['query'][_0x160b('0x3b')]+'%'};return _0x4865b7;}})});}_0x184ea0=_[_0x160b('0x3c')]({},_0x184ea0,_0x414548[_0x160b('0x3e')]);var _0x407f6a={'where':_0x184ea0[_0x160b('0x39')]};return db['ZohoConfiguration'][_0x160b('0x1e')](_0x407f6a)[_0x160b('0x25')](function(_0x27e279){_0x9fdac['count']=_0x27e279;if(_0x414548[_0x160b('0x2e')][_0x160b('0x3f')]){_0x184ea0[_0x160b('0x40')]=[{'all':!![]}];}return db[_0x160b('0x41')]['findAll'](_0x184ea0);})[_0x160b('0x25')](function(_0xacccab){_0x9fdac[_0x160b('0x42')]=_0xacccab;return _0x9fdac;})[_0x160b('0x25')](respondWithFilteredResult(_0x2c06c0,_0x184ea0))['catch'](handleError(_0x2c06c0,null));};exports[_0x160b('0x43')]=function(_0x4a851f,_0x51e351){var _0x3953b1={'raw':![],'where':{'id':_0x4a851f['params']['id']}},_0x33c2af={};_0x33c2af['model']=_['keys'](db[_0x160b('0x41')][_0x160b('0x2a')]);_0x33c2af['query']=_[_0x160b('0x2f')](_0x4a851f['query']);_0x33c2af[_0x160b('0x30')]=_[_0x160b('0x31')](_0x33c2af[_0x160b('0x2c')],_0x33c2af[_0x160b('0x2e')]);_0x3953b1[_0x160b('0x32')]=_['intersection'](_0x33c2af[_0x160b('0x2c')],qs[_0x160b('0x33')](_0x4a851f[_0x160b('0x2e')][_0x160b('0x33')]));_0x3953b1[_0x160b('0x32')]=_0x3953b1[_0x160b('0x32')][_0x160b('0x34')]?_0x3953b1['attributes']:_0x33c2af[_0x160b('0x2c')];if(_0x4a851f[_0x160b('0x2e')][_0x160b('0x3f')]){_0x3953b1['include']=[{'all':!![]}];}_0x3953b1=_[_0x160b('0x3c')]({},_0x3953b1,_0x4a851f['options']);return db[_0x160b('0x41')][_0x160b('0x44')](_0x3953b1)[_0x160b('0x25')](handleEntityNotFound(_0x51e351,null))[_0x160b('0x25')](respondWithResult(_0x51e351,null))[_0x160b('0x45')](handleError(_0x51e351,null));};exports[_0x160b('0x46')]=function(_0x449b40,_0x45ccb7){return db[_0x160b('0x41')][_0x160b('0x46')](_0x449b40['body'],{})[_0x160b('0x25')](respondWithResult(_0x45ccb7,0xc9))[_0x160b('0x45')](handleError(_0x45ccb7,null));};exports[_0x160b('0x24')]=function(_0x44a34b,_0x564869){if(_0x44a34b['body']['id']){delete _0x44a34b[_0x160b('0x47')]['id'];}return db[_0x160b('0x41')][_0x160b('0x44')]({'where':{'id':_0x44a34b[_0x160b('0x48')]['id']}})[_0x160b('0x25')](handleEntityNotFound(_0x564869,null))[_0x160b('0x25')](saveUpdates(_0x44a34b['body'],null))[_0x160b('0x25')](respondWithResult(_0x564869,null))[_0x160b('0x45')](handleError(_0x564869,null));};exports[_0x160b('0x26')]=function(_0x104efb,_0x44ecfc){return db[_0x160b('0x41')]['find']({'where':{'id':_0x104efb['params']['id']}})[_0x160b('0x25')](handleEntityNotFound(_0x44ecfc,null))[_0x160b('0x25')](removeEntity(_0x44ecfc,null))['catch'](handleError(_0x44ecfc,null));};exports[_0x160b('0x49')]=function(_0x345f7b,_0x5113d3,_0x5f018b){var _0x280d86={};var _0x1bf5c9={};var _0x50c1c3;var _0x497c88;return db[_0x160b('0x41')][_0x160b('0x4a')]({'where':{'id':_0x345f7b[_0x160b('0x48')]['id']}})['then'](handleEntityNotFound(_0x5113d3,null))[_0x160b('0x25')](function(_0x14d89a){if(_0x14d89a){_0x50c1c3=_0x14d89a;_0x1bf5c9['model']=_[_0x160b('0x2f')](db[_0x160b('0x4b')][_0x160b('0x2a')]);_0x1bf5c9[_0x160b('0x2e')]=_['keys'](_0x345f7b[_0x160b('0x2e')]);_0x1bf5c9['filters']=_[_0x160b('0x31')](_0x1bf5c9[_0x160b('0x2c')],_0x1bf5c9[_0x160b('0x2e')]);_0x280d86[_0x160b('0x32')]=_[_0x160b('0x31')](_0x1bf5c9[_0x160b('0x2c')],qs[_0x160b('0x33')](_0x345f7b[_0x160b('0x2e')][_0x160b('0x33')]));_0x280d86['attributes']=_0x280d86[_0x160b('0x32')][_0x160b('0x34')]?_0x280d86[_0x160b('0x32')]:_0x1bf5c9[_0x160b('0x2c')];_0x280d86['order']=qs[_0x160b('0x4c')](_0x345f7b['query'][_0x160b('0x4c')]);_0x280d86[_0x160b('0x39')]=qs[_0x160b('0x30')](_[_0x160b('0x3a')](_0x345f7b[_0x160b('0x2e')],_0x1bf5c9[_0x160b('0x30')]));if(_0x345f7b[_0x160b('0x2e')][_0x160b('0x3b')]){_0x280d86[_0x160b('0x39')]=_[_0x160b('0x3c')](_0x280d86['where'],{'$or':_[_0x160b('0x29')](_0x280d86['attributes'],function(_0x516fec){var _0x226016={};_0x226016[_0x516fec]={'$like':'%'+_0x345f7b[_0x160b('0x2e')][_0x160b('0x3b')]+'%'};return _0x226016;})});}_0x280d86=_[_0x160b('0x3c')]({},_0x280d86,_0x345f7b[_0x160b('0x3e')]);return _0x50c1c3[_0x160b('0x49')](_0x280d86);}})['then'](function(_0x314f55){if(_0x314f55){_0x497c88=_0x314f55[_0x160b('0x34')];if(!_0x345f7b[_0x160b('0x2e')][_0x160b('0x35')]('nolimit')){_0x280d86[_0x160b('0x37')]=qs[_0x160b('0x37')](_0x345f7b[_0x160b('0x2e')][_0x160b('0x37')]);_0x280d86[_0x160b('0x1f')]=qs[_0x160b('0x1f')](_0x345f7b[_0x160b('0x2e')][_0x160b('0x1f')]);}return _0x50c1c3[_0x160b('0x49')](_0x280d86);}})[_0x160b('0x25')](function(_0x53c027){if(_0x53c027){return _0x53c027?{'count':_0x497c88,'rows':_0x53c027}:null;}})['then'](respondWithResult(_0x5113d3,null))[_0x160b('0x45')](handleError(_0x5113d3,null));};exports[_0x160b('0x4d')]=function(_0x5926eb,_0xdd9897,_0x38e7bc){var _0x579fd5={};var _0x29350d={};var _0x39298a;var _0x2469e8;return db[_0x160b('0x41')][_0x160b('0x4a')]({'where':{'id':_0x5926eb[_0x160b('0x48')]['id']}})[_0x160b('0x25')](handleEntityNotFound(_0xdd9897,null))[_0x160b('0x25')](function(_0x306beb){if(_0x306beb){_0x39298a=_0x306beb;_0x29350d[_0x160b('0x2c')]=_[_0x160b('0x2f')](db[_0x160b('0x4b')][_0x160b('0x2a')]);_0x29350d['query']=_[_0x160b('0x2f')](_0x5926eb[_0x160b('0x2e')]);_0x29350d[_0x160b('0x30')]=_[_0x160b('0x31')](_0x29350d[_0x160b('0x2c')],_0x29350d[_0x160b('0x2e')]);_0x579fd5[_0x160b('0x32')]=_[_0x160b('0x31')](_0x29350d['model'],qs[_0x160b('0x33')](_0x5926eb[_0x160b('0x2e')][_0x160b('0x33')]));_0x579fd5[_0x160b('0x32')]=_0x579fd5[_0x160b('0x32')]['length']?_0x579fd5[_0x160b('0x32')]:_0x29350d[_0x160b('0x2c')];_0x579fd5[_0x160b('0x38')]=qs[_0x160b('0x4c')](_0x5926eb[_0x160b('0x2e')]['sort']);_0x579fd5[_0x160b('0x39')]=qs[_0x160b('0x30')](_[_0x160b('0x3a')](_0x5926eb[_0x160b('0x2e')],_0x29350d[_0x160b('0x30')]));if(_0x5926eb[_0x160b('0x2e')]['filter']){_0x579fd5[_0x160b('0x39')]=_['merge'](_0x579fd5[_0x160b('0x39')],{'$or':_[_0x160b('0x29')](_0x579fd5[_0x160b('0x32')],function(_0x59e06b){var _0x19ee3d={};_0x19ee3d[_0x59e06b]={'$like':'%'+_0x5926eb['query'][_0x160b('0x3b')]+'%'};return _0x19ee3d;})});}_0x579fd5=_[_0x160b('0x3c')]({},_0x579fd5,_0x5926eb[_0x160b('0x3e')]);return _0x39298a[_0x160b('0x4d')](_0x579fd5);}})[_0x160b('0x25')](function(_0x46e784){if(_0x46e784){_0x2469e8=_0x46e784[_0x160b('0x34')];if(!_0x5926eb['query'][_0x160b('0x35')](_0x160b('0x36'))){_0x579fd5['limit']=qs[_0x160b('0x37')](_0x5926eb[_0x160b('0x2e')][_0x160b('0x37')]);_0x579fd5[_0x160b('0x1f')]=qs[_0x160b('0x1f')](_0x5926eb[_0x160b('0x2e')][_0x160b('0x1f')]);}return _0x39298a[_0x160b('0x4d')](_0x579fd5);}})[_0x160b('0x25')](function(_0x5141a6){if(_0x5141a6){return _0x5141a6?{'count':_0x2469e8,'rows':_0x5141a6}:null;}})['then'](respondWithResult(_0xdd9897,null))['catch'](handleError(_0xdd9897,null));};exports[_0x160b('0x4e')]=function(_0x32e64a,_0xf5bd5a,_0x20c5b1){var _0xe4eb3e={};var _0x3535d1={};var _0x4dfd21;var _0x183366;return db[_0x160b('0x41')][_0x160b('0x4a')]({'where':{'id':_0x32e64a[_0x160b('0x48')]['id']}})[_0x160b('0x25')](handleEntityNotFound(_0xf5bd5a,null))[_0x160b('0x25')](function(_0x33fda0){if(_0x33fda0){_0x4dfd21=_0x33fda0;_0x3535d1['model']=_['keys'](db[_0x160b('0x4b')]['rawAttributes']);_0x3535d1[_0x160b('0x2e')]=_[_0x160b('0x2f')](_0x32e64a[_0x160b('0x2e')]);_0x3535d1[_0x160b('0x30')]=_[_0x160b('0x31')](_0x3535d1[_0x160b('0x2c')],_0x3535d1[_0x160b('0x2e')]);_0xe4eb3e[_0x160b('0x32')]=_[_0x160b('0x31')](_0x3535d1[_0x160b('0x2c')],qs[_0x160b('0x33')](_0x32e64a['query'][_0x160b('0x33')]));_0xe4eb3e[_0x160b('0x32')]=_0xe4eb3e[_0x160b('0x32')][_0x160b('0x34')]?_0xe4eb3e[_0x160b('0x32')]:_0x3535d1[_0x160b('0x2c')];_0xe4eb3e[_0x160b('0x38')]=qs[_0x160b('0x4c')](_0x32e64a[_0x160b('0x2e')]['sort']);_0xe4eb3e['where']=qs[_0x160b('0x30')](_['pick'](_0x32e64a[_0x160b('0x2e')],_0x3535d1[_0x160b('0x30')]));if(_0x32e64a[_0x160b('0x2e')][_0x160b('0x3b')]){_0xe4eb3e[_0x160b('0x39')]=_['merge'](_0xe4eb3e['where'],{'$or':_[_0x160b('0x29')](_0xe4eb3e[_0x160b('0x32')],function(_0x4824c7){var _0x42c6df={};_0x42c6df[_0x4824c7]={'$like':'%'+_0x32e64a[_0x160b('0x2e')][_0x160b('0x3b')]+'%'};return _0x42c6df;})});}_0xe4eb3e=_[_0x160b('0x3c')]({},_0xe4eb3e,_0x32e64a[_0x160b('0x3e')]);return _0x4dfd21[_0x160b('0x4e')](_0xe4eb3e);}})['then'](function(_0x33615f){if(_0x33615f){_0x183366=_0x33615f[_0x160b('0x34')];if(!_0x32e64a[_0x160b('0x2e')][_0x160b('0x35')](_0x160b('0x36'))){_0xe4eb3e[_0x160b('0x37')]=qs[_0x160b('0x37')](_0x32e64a['query'][_0x160b('0x37')]);_0xe4eb3e[_0x160b('0x1f')]=qs[_0x160b('0x1f')](_0x32e64a['query'][_0x160b('0x1f')]);}return _0x4dfd21[_0x160b('0x4e')](_0xe4eb3e);}})[_0x160b('0x25')](function(_0x1de6b3){if(_0x1de6b3){return _0x1de6b3?{'count':_0x183366,'rows':_0x1de6b3}:null;}})['then'](respondWithResult(_0xf5bd5a,null))[_0x160b('0x45')](handleError(_0xf5bd5a,null));}; \ No newline at end of file +var _0xebfc=['catch','show','keys','options','find','create','body','params','destroy','getFields','findOne','ZohoField','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','includeAll','include','findAll'];(function(_0x11b3d4,_0x2da6c0){var _0xa1789=function(_0x5f5788){while(--_0x5f5788){_0x11b3d4['push'](_0x11b3d4['shift']());}};_0xa1789(++_0x2da6c0);}(_0xebfc,0x160));var _0xcebf=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xebfc[_0x58e469];return _0x4c01c5;};'use strict';var emlformat=require(_0xcebf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcebf('0x1'));var jsonpatch=require(_0xcebf('0x2'));var rp=require('request-promise');var moment=require(_0xcebf('0x3'));var BPromise=require(_0xcebf('0x4'));var Mustache=require(_0xcebf('0x5'));var util=require(_0xcebf('0x6'));var path=require(_0xcebf('0x7'));var sox=require(_0xcebf('0x8'));var csv=require(_0xcebf('0x9'));var ejs=require(_0xcebf('0xa'));var fs=require('fs');var fs_extra=require(_0xcebf('0xb'));var _=require(_0xcebf('0xc'));var squel=require(_0xcebf('0xd'));var crypto=require(_0xcebf('0xe'));var jsforce=require(_0xcebf('0xf'));var deskjs=require(_0xcebf('0x10'));var toCsv=require(_0xcebf('0x9'));var querystring=require(_0xcebf('0x11'));var Papa=require(_0xcebf('0x12'));var Redis=require(_0xcebf('0x13'));var authService=require(_0xcebf('0x14'));var qs=require(_0xcebf('0x15'));var as=require(_0xcebf('0x16'));var hardwareService=require(_0xcebf('0x17'));var logger=require('../../config/logger')(_0xcebf('0x18'));var utils=require(_0xcebf('0x19'));var config=require(_0xcebf('0x1a'));var licenseUtil=require(_0xcebf('0x1b'));var db=require(_0xcebf('0x1c'))['db'];function respondWithStatusCode(_0x1c83c0,_0x413b04){_0x413b04=_0x413b04||0xcc;return function(_0x26da30){if(_0x26da30){return _0x1c83c0['sendStatus'](_0x413b04);}return _0x1c83c0[_0xcebf('0x1d')](_0x413b04)[_0xcebf('0x1e')]();};}function respondWithResult(_0x525a2a,_0x155dc8){_0x155dc8=_0x155dc8||0xc8;return function(_0x16f02f){if(_0x16f02f){return _0x525a2a[_0xcebf('0x1d')](_0x155dc8)[_0xcebf('0x1f')](_0x16f02f);}};}function respondWithFilteredResult(_0x2242d5,_0x8a0fc9){return function(_0x212a69){if(_0x212a69){var _0x29b00f=typeof _0x8a0fc9['offset']===_0xcebf('0x20')&&typeof _0x8a0fc9[_0xcebf('0x21')]===_0xcebf('0x20');var _0x537da6=_0x212a69['count'];var _0x4256b3=_0x29b00f?0x0:_0x8a0fc9['offset'];var _0x1761f7=_0x29b00f?_0x212a69[_0xcebf('0x22')]:_0x8a0fc9[_0xcebf('0x23')]+_0x8a0fc9[_0xcebf('0x21')];var _0x3ee79c;if(_0x1761f7>=_0x537da6){_0x1761f7=_0x537da6;_0x3ee79c=0xc8;}else{_0x3ee79c=0xce;}_0x2242d5['status'](_0x3ee79c);return _0x2242d5[_0xcebf('0x24')](_0xcebf('0x25'),_0x4256b3+'-'+_0x1761f7+'/'+_0x537da6)[_0xcebf('0x1f')](_0x212a69);}return null;};}function patchUpdates(_0x537a1f){return function(_0x1030d5){try{jsonpatch['apply'](_0x1030d5,_0x537a1f,!![]);}catch(_0x2ae8a7){return BPromise[_0xcebf('0x26')](_0x2ae8a7);}return _0x1030d5[_0xcebf('0x27')]();};}function saveUpdates(_0x24b474,_0x31b88c){return function(_0xd052e){if(_0xd052e){return _0xd052e[_0xcebf('0x28')](_0x24b474)[_0xcebf('0x29')](function(_0xcc593b){return _0xcc593b;});}return null;};}function removeEntity(_0x790837,_0x437582){return function(_0x34c086){if(_0x34c086){return _0x34c086['destroy']()[_0xcebf('0x29')](function(){_0x790837['status'](0xcc)[_0xcebf('0x1e')]();});}};}function handleEntityNotFound(_0x2e2ce3,_0xdb1bd){return function(_0x1766ec){if(!_0x1766ec){_0x2e2ce3['sendStatus'](0x194);}return _0x1766ec;};}function handleError(_0x10efd3,_0x2efa01){_0x2efa01=_0x2efa01||0x1f4;return function(_0x5ee935){logger[_0xcebf('0x2a')](_0x5ee935[_0xcebf('0x2b')]);if(_0x5ee935[_0xcebf('0x2c')]){delete _0x5ee935['name'];}_0x10efd3['status'](_0x2efa01)[_0xcebf('0x2d')](_0x5ee935);};}exports[_0xcebf('0x2e')]=function(_0x34bbcc,_0x8f2077){var _0x514974={},_0x34faa9={},_0x22302c={'count':0x0,'rows':[]};var _0x366a86=_[_0xcebf('0x2f')](db[_0xcebf('0x30')][_0xcebf('0x31')],function(_0x348d0f){return{'name':_0x348d0f[_0xcebf('0x32')],'type':_0x348d0f[_0xcebf('0x33')]['key']};});_0x34faa9['model']=_[_0xcebf('0x2f')](_0x366a86,_0xcebf('0x2c'));_0x34faa9['query']=_['keys'](_0x34bbcc[_0xcebf('0x34')]);_0x34faa9['filters']=_[_0xcebf('0x35')](_0x34faa9[_0xcebf('0x36')],_0x34faa9['query']);_0x514974[_0xcebf('0x37')]=_[_0xcebf('0x35')](_0x34faa9[_0xcebf('0x36')],qs[_0xcebf('0x38')](_0x34bbcc[_0xcebf('0x34')][_0xcebf('0x38')]));_0x514974[_0xcebf('0x37')]=_0x514974[_0xcebf('0x37')][_0xcebf('0x39')]?_0x514974[_0xcebf('0x37')]:_0x34faa9[_0xcebf('0x36')];if(!_0x34bbcc[_0xcebf('0x34')]['hasOwnProperty'](_0xcebf('0x3a'))){_0x514974[_0xcebf('0x21')]=qs[_0xcebf('0x21')](_0x34bbcc[_0xcebf('0x34')]['limit']);_0x514974['offset']=qs[_0xcebf('0x23')](_0x34bbcc[_0xcebf('0x34')]['offset']);}_0x514974['order']=qs[_0xcebf('0x3b')](_0x34bbcc[_0xcebf('0x34')][_0xcebf('0x3b')]);_0x514974[_0xcebf('0x3c')]=qs['filters'](_[_0xcebf('0x3d')](_0x34bbcc[_0xcebf('0x34')],_0x34faa9[_0xcebf('0x3e')]),_0x366a86);if(_0x34bbcc['query'][_0xcebf('0x3f')]){_0x514974[_0xcebf('0x3c')]=_[_0xcebf('0x40')](_0x514974[_0xcebf('0x3c')],{'$or':_[_0xcebf('0x2f')](_0x366a86,function(_0x2986ff){if(_0x2986ff[_0xcebf('0x33')]!=='VIRTUAL'){var _0x5b3983={};_0x5b3983[_0x2986ff['name']]={'$like':'%'+_0x34bbcc['query']['filter']+'%'};return _0x5b3983;}})});}_0x514974=_[_0xcebf('0x40')]({},_0x514974,_0x34bbcc['options']);var _0x3fb101={'where':_0x514974[_0xcebf('0x3c')]};return db['ZohoConfiguration'][_0xcebf('0x22')](_0x3fb101)[_0xcebf('0x29')](function(_0x27f04e){_0x22302c['count']=_0x27f04e;if(_0x34bbcc[_0xcebf('0x34')][_0xcebf('0x41')]){_0x514974[_0xcebf('0x42')]=[{'all':!![]}];}return db[_0xcebf('0x30')][_0xcebf('0x43')](_0x514974);})[_0xcebf('0x29')](function(_0x181731){_0x22302c['rows']=_0x181731;return _0x22302c;})[_0xcebf('0x29')](respondWithFilteredResult(_0x8f2077,_0x514974))[_0xcebf('0x44')](handleError(_0x8f2077,null));};exports[_0xcebf('0x45')]=function(_0x520a89,_0x1a49ec){var _0x1e7659={'raw':![],'where':{'id':_0x520a89['params']['id']}},_0xfd684={};_0xfd684[_0xcebf('0x36')]=_[_0xcebf('0x46')](db[_0xcebf('0x30')][_0xcebf('0x31')]);_0xfd684[_0xcebf('0x34')]=_[_0xcebf('0x46')](_0x520a89[_0xcebf('0x34')]);_0xfd684[_0xcebf('0x3e')]=_['intersection'](_0xfd684[_0xcebf('0x36')],_0xfd684[_0xcebf('0x34')]);_0x1e7659[_0xcebf('0x37')]=_[_0xcebf('0x35')](_0xfd684[_0xcebf('0x36')],qs['fields'](_0x520a89[_0xcebf('0x34')][_0xcebf('0x38')]));_0x1e7659[_0xcebf('0x37')]=_0x1e7659[_0xcebf('0x37')]['length']?_0x1e7659[_0xcebf('0x37')]:_0xfd684[_0xcebf('0x36')];if(_0x520a89['query'][_0xcebf('0x41')]){_0x1e7659[_0xcebf('0x42')]=[{'all':!![]}];}_0x1e7659=_[_0xcebf('0x40')]({},_0x1e7659,_0x520a89[_0xcebf('0x47')]);return db[_0xcebf('0x30')][_0xcebf('0x48')](_0x1e7659)[_0xcebf('0x29')](handleEntityNotFound(_0x1a49ec,null))['then'](respondWithResult(_0x1a49ec,null))[_0xcebf('0x44')](handleError(_0x1a49ec,null));};exports[_0xcebf('0x49')]=function(_0x573268,_0x57b38e){return db[_0xcebf('0x30')][_0xcebf('0x49')](_0x573268['body'],{})[_0xcebf('0x29')](respondWithResult(_0x57b38e,0xc9))['catch'](handleError(_0x57b38e,null));};exports[_0xcebf('0x28')]=function(_0x28c501,_0x3257d7){if(_0x28c501[_0xcebf('0x4a')]['id']){delete _0x28c501['body']['id'];}return db[_0xcebf('0x30')][_0xcebf('0x48')]({'where':{'id':_0x28c501[_0xcebf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3257d7,null))[_0xcebf('0x29')](saveUpdates(_0x28c501[_0xcebf('0x4a')],null))[_0xcebf('0x29')](respondWithResult(_0x3257d7,null))[_0xcebf('0x44')](handleError(_0x3257d7,null));};exports[_0xcebf('0x4c')]=function(_0x3a125d,_0x300b72){return db[_0xcebf('0x30')][_0xcebf('0x48')]({'where':{'id':_0x3a125d[_0xcebf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x300b72,null))[_0xcebf('0x29')](removeEntity(_0x300b72,null))['catch'](handleError(_0x300b72,null));};exports[_0xcebf('0x4d')]=function(_0x365988,_0x400fa9,_0x529911){var _0x5909ae={};var _0x176940={};var _0x4dd315;var _0x3d1fff;return db[_0xcebf('0x30')][_0xcebf('0x4e')]({'where':{'id':_0x365988[_0xcebf('0x4b')]['id']}})[_0xcebf('0x29')](handleEntityNotFound(_0x400fa9,null))[_0xcebf('0x29')](function(_0x35e387){if(_0x35e387){_0x4dd315=_0x35e387;_0x176940[_0xcebf('0x36')]=_[_0xcebf('0x46')](db[_0xcebf('0x4f')][_0xcebf('0x31')]);_0x176940['query']=_[_0xcebf('0x46')](_0x365988['query']);_0x176940['filters']=_[_0xcebf('0x35')](_0x176940[_0xcebf('0x36')],_0x176940[_0xcebf('0x34')]);_0x5909ae['attributes']=_[_0xcebf('0x35')](_0x176940[_0xcebf('0x36')],qs[_0xcebf('0x38')](_0x365988['query'][_0xcebf('0x38')]));_0x5909ae[_0xcebf('0x37')]=_0x5909ae[_0xcebf('0x37')][_0xcebf('0x39')]?_0x5909ae[_0xcebf('0x37')]:_0x176940[_0xcebf('0x36')];_0x5909ae[_0xcebf('0x50')]=qs[_0xcebf('0x3b')](_0x365988[_0xcebf('0x34')]['sort']);_0x5909ae['where']=qs[_0xcebf('0x3e')](_[_0xcebf('0x3d')](_0x365988[_0xcebf('0x34')],_0x176940['filters']));if(_0x365988[_0xcebf('0x34')][_0xcebf('0x3f')]){_0x5909ae[_0xcebf('0x3c')]=_[_0xcebf('0x40')](_0x5909ae[_0xcebf('0x3c')],{'$or':_[_0xcebf('0x2f')](_0x5909ae[_0xcebf('0x37')],function(_0x5e542a){var _0x6ef62a={};_0x6ef62a[_0x5e542a]={'$like':'%'+_0x365988['query'][_0xcebf('0x3f')]+'%'};return _0x6ef62a;})});}_0x5909ae=_[_0xcebf('0x40')]({},_0x5909ae,_0x365988[_0xcebf('0x47')]);return _0x4dd315['getFields'](_0x5909ae);}})[_0xcebf('0x29')](function(_0x1c831c){if(_0x1c831c){_0x3d1fff=_0x1c831c[_0xcebf('0x39')];if(!_0x365988[_0xcebf('0x34')][_0xcebf('0x51')](_0xcebf('0x3a'))){_0x5909ae[_0xcebf('0x21')]=qs[_0xcebf('0x21')](_0x365988[_0xcebf('0x34')][_0xcebf('0x21')]);_0x5909ae[_0xcebf('0x23')]=qs[_0xcebf('0x23')](_0x365988['query'][_0xcebf('0x23')]);}return _0x4dd315[_0xcebf('0x4d')](_0x5909ae);}})[_0xcebf('0x29')](function(_0x3db4f4){if(_0x3db4f4){return _0x3db4f4?{'count':_0x3d1fff,'rows':_0x3db4f4}:null;}})[_0xcebf('0x29')](respondWithResult(_0x400fa9,null))[_0xcebf('0x44')](handleError(_0x400fa9,null));};exports[_0xcebf('0x52')]=function(_0x467b89,_0x3c7a30,_0x5e52cb){var _0x419da7={};var _0x2b1c65={};var _0x1fde0a;var _0x10d12d;return db[_0xcebf('0x30')]['findOne']({'where':{'id':_0x467b89['params']['id']}})[_0xcebf('0x29')](handleEntityNotFound(_0x3c7a30,null))['then'](function(_0x5a1c5b){if(_0x5a1c5b){_0x1fde0a=_0x5a1c5b;_0x2b1c65[_0xcebf('0x36')]=_[_0xcebf('0x46')](db[_0xcebf('0x4f')][_0xcebf('0x31')]);_0x2b1c65[_0xcebf('0x34')]=_['keys'](_0x467b89['query']);_0x2b1c65['filters']=_['intersection'](_0x2b1c65['model'],_0x2b1c65[_0xcebf('0x34')]);_0x419da7['attributes']=_[_0xcebf('0x35')](_0x2b1c65[_0xcebf('0x36')],qs['fields'](_0x467b89['query'][_0xcebf('0x38')]));_0x419da7[_0xcebf('0x37')]=_0x419da7[_0xcebf('0x37')][_0xcebf('0x39')]?_0x419da7[_0xcebf('0x37')]:_0x2b1c65['model'];_0x419da7[_0xcebf('0x50')]=qs[_0xcebf('0x3b')](_0x467b89[_0xcebf('0x34')][_0xcebf('0x3b')]);_0x419da7[_0xcebf('0x3c')]=qs['filters'](_[_0xcebf('0x3d')](_0x467b89['query'],_0x2b1c65[_0xcebf('0x3e')]));if(_0x467b89['query']['filter']){_0x419da7['where']=_[_0xcebf('0x40')](_0x419da7[_0xcebf('0x3c')],{'$or':_[_0xcebf('0x2f')](_0x419da7['attributes'],function(_0x2a3cfc){var _0x42e114={};_0x42e114[_0x2a3cfc]={'$like':'%'+_0x467b89[_0xcebf('0x34')]['filter']+'%'};return _0x42e114;})});}_0x419da7=_[_0xcebf('0x40')]({},_0x419da7,_0x467b89['options']);return _0x1fde0a['getSubjects'](_0x419da7);}})['then'](function(_0x6ab983){if(_0x6ab983){_0x10d12d=_0x6ab983['length'];if(!_0x467b89[_0xcebf('0x34')][_0xcebf('0x51')](_0xcebf('0x3a'))){_0x419da7['limit']=qs[_0xcebf('0x21')](_0x467b89[_0xcebf('0x34')][_0xcebf('0x21')]);_0x419da7['offset']=qs[_0xcebf('0x23')](_0x467b89[_0xcebf('0x34')][_0xcebf('0x23')]);}return _0x1fde0a[_0xcebf('0x52')](_0x419da7);}})[_0xcebf('0x29')](function(_0x56f793){if(_0x56f793){return _0x56f793?{'count':_0x10d12d,'rows':_0x56f793}:null;}})[_0xcebf('0x29')](respondWithResult(_0x3c7a30,null))[_0xcebf('0x44')](handleError(_0x3c7a30,null));};exports[_0xcebf('0x53')]=function(_0x2c1490,_0x441754,_0x30dac6){var _0x49224d={};var _0xff3b92={};var _0x4e19d2;var _0x136052;return db['ZohoConfiguration'][_0xcebf('0x4e')]({'where':{'id':_0x2c1490[_0xcebf('0x4b')]['id']}})[_0xcebf('0x29')](handleEntityNotFound(_0x441754,null))['then'](function(_0x1f8925){if(_0x1f8925){_0x4e19d2=_0x1f8925;_0xff3b92[_0xcebf('0x36')]=_[_0xcebf('0x46')](db[_0xcebf('0x4f')][_0xcebf('0x31')]);_0xff3b92['query']=_['keys'](_0x2c1490[_0xcebf('0x34')]);_0xff3b92[_0xcebf('0x3e')]=_[_0xcebf('0x35')](_0xff3b92[_0xcebf('0x36')],_0xff3b92[_0xcebf('0x34')]);_0x49224d['attributes']=_[_0xcebf('0x35')](_0xff3b92[_0xcebf('0x36')],qs[_0xcebf('0x38')](_0x2c1490[_0xcebf('0x34')][_0xcebf('0x38')]));_0x49224d[_0xcebf('0x37')]=_0x49224d['attributes']['length']?_0x49224d[_0xcebf('0x37')]:_0xff3b92[_0xcebf('0x36')];_0x49224d['order']=qs[_0xcebf('0x3b')](_0x2c1490[_0xcebf('0x34')][_0xcebf('0x3b')]);_0x49224d[_0xcebf('0x3c')]=qs[_0xcebf('0x3e')](_['pick'](_0x2c1490[_0xcebf('0x34')],_0xff3b92['filters']));if(_0x2c1490[_0xcebf('0x34')][_0xcebf('0x3f')]){_0x49224d[_0xcebf('0x3c')]=_['merge'](_0x49224d[_0xcebf('0x3c')],{'$or':_[_0xcebf('0x2f')](_0x49224d['attributes'],function(_0x3235a3){var _0x238328={};_0x238328[_0x3235a3]={'$like':'%'+_0x2c1490[_0xcebf('0x34')][_0xcebf('0x3f')]+'%'};return _0x238328;})});}_0x49224d=_[_0xcebf('0x40')]({},_0x49224d,_0x2c1490[_0xcebf('0x47')]);return _0x4e19d2[_0xcebf('0x53')](_0x49224d);}})[_0xcebf('0x29')](function(_0x22e3e5){if(_0x22e3e5){_0x136052=_0x22e3e5[_0xcebf('0x39')];if(!_0x2c1490['query'][_0xcebf('0x51')](_0xcebf('0x3a'))){_0x49224d['limit']=qs[_0xcebf('0x21')](_0x2c1490[_0xcebf('0x34')][_0xcebf('0x21')]);_0x49224d['offset']=qs['offset'](_0x2c1490[_0xcebf('0x34')][_0xcebf('0x23')]);}return _0x4e19d2[_0xcebf('0x53')](_0x49224d);}})['then'](function(_0x43f530){if(_0x43f530){return _0x43f530?{'count':_0x136052,'rows':_0x43f530}:null;}})[_0xcebf('0x29')](respondWithResult(_0x441754,null))['catch'](handleError(_0x441754,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 15d7b13..ffc0767 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 _0x7971=['bluebird','request-promise','rimraf','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x1e1ecf,_0x175529){var _0x52be90=function(_0x2da012){while(--_0x2da012){_0x1e1ecf['push'](_0x1e1ecf['shift']());}};_0x52be90(++_0x175529);}(_0x7971,0x19f));var _0x1797=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7971[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x1797('0x0'));var util=require(_0x1797('0x1'));var logger=require(_0x1797('0x2'))(_0x1797('0x3'));var moment=require(_0x1797('0x4'));var BPromise=require(_0x1797('0x5'));var rp=require(_0x1797('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1797('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x1797('0x8')]=function(_0x148e8c,_0x549dc3){return _0x148e8c[_0x1797('0x9')](_0x1797('0xa'),attributes,{'tableName':_0x1797('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1184=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','moment','path','rimraf','../../config/environment'];(function(_0x1c3c87,_0x1c0788){var _0xccf1bf=function(_0x3fcd7f){while(--_0x3fcd7f){_0x1c3c87['push'](_0x1c3c87['shift']());}};_0xccf1bf(++_0x1c0788);}(_0x1184,0x1b3));var _0x4118=function(_0x1e24d3,_0x48bba4){_0x1e24d3=_0x1e24d3-0x0;var _0x136f73=_0x1184[_0x1e24d3];return _0x136f73;};'use strict';var _=require(_0x4118('0x0'));var util=require(_0x4118('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4118('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4118('0x3'));var rimraf=require(_0x4118('0x4'));var config=require(_0x4118('0x5'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x126421,_0x253ab5){return _0x126421[_0x4118('0x6')](_0x4118('0x7'),attributes,{'tableName':_0x4118('0x8'),'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 c4454ee..b88cb8e 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 _0x3add=['info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','request\x20sent','stringify','code','error','ZohoConfiguration,\x20%s,\x20%s','message'];(function(_0x322e7f,_0x3bb5ca){var _0x4d06c3=function(_0x519a3f){while(--_0x519a3f){_0x322e7f['push'](_0x322e7f['shift']());}};_0x4d06c3(++_0x3bb5ca);}(_0x3add,0x1a6));var _0xd3ad=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0x3add[_0x272638];return _0x19d027;};'use strict';var _=require('lodash');var util=require(_0xd3ad('0x0'));var moment=require(_0xd3ad('0x1'));var BPromise=require(_0xd3ad('0x2'));var rs=require(_0xd3ad('0x3'));var fs=require('fs');var Redis=require(_0xd3ad('0x4'));var db=require(_0xd3ad('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3ad('0x6'))(_0xd3ad('0x7'));var config=require(_0xd3ad('0x8'));var jayson=require(_0xd3ad('0x9'));var client=jayson['client'][_0xd3ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5833be,_0x4efa5a,_0x447f96){return new BPromise(function(_0x386565,_0x5864cf){return client['request'](_0x5833be,_0x447f96)[_0xd3ad('0xb')](function(_0x3cb5fb){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x4efa5a,'request\x20sent');logger[_0xd3ad('0xc')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4efa5a,_0xd3ad('0xd'),JSON[_0xd3ad('0xe')](_0x3cb5fb));if(_0x3cb5fb['error']){if(_0x3cb5fb['error'][_0xd3ad('0xf')]===0x1f4){logger[_0xd3ad('0x10')](_0xd3ad('0x11'),_0x4efa5a,_0x3cb5fb[_0xd3ad('0x10')][_0xd3ad('0x12')]);return _0x5864cf(_0x3cb5fb[_0xd3ad('0x10')][_0xd3ad('0x12')]);}logger[_0xd3ad('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x4efa5a,_0x3cb5fb['error'][_0xd3ad('0x12')]);return _0x386565(_0x3cb5fb[_0xd3ad('0x10')][_0xd3ad('0x12')]);}else{logger[_0xd3ad('0x13')](_0xd3ad('0x11'),_0x4efa5a,_0xd3ad('0xd'));_0x386565(_0x3cb5fb['result'][_0xd3ad('0x12')]);}})[_0xd3ad('0x14')](function(_0x47672a){logger[_0xd3ad('0x10')](_0xd3ad('0x11'),_0x4efa5a,_0x47672a);_0x5864cf(_0x47672a);});});} \ No newline at end of file +var _0x1844=['client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x468d1e,_0x259d64){var _0x368e2d=function(_0x2fb327){while(--_0x2fb327){_0x468d1e['push'](_0x468d1e['shift']());}};_0x368e2d(++_0x259d64);}(_0x1844,0xff));var _0x4184=function(_0x2ea356,_0x4c373b){_0x2ea356=_0x2ea356-0x0;var _0x1439d5=_0x1844[_0x2ea356];return _0x1439d5;};'use strict';var _=require(_0x4184('0x0'));var util=require('util');var moment=require(_0x4184('0x1'));var BPromise=require(_0x4184('0x2'));var rs=require(_0x4184('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4184('0x4'))['db'];var utils=require(_0x4184('0x5'));var logger=require(_0x4184('0x6'))(_0x4184('0x7'));var config=require(_0x4184('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4184('0x9')][_0x4184('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x346dc4,_0x38ccb7,_0x5bdecf){return new BPromise(function(_0x3a7dc4,_0x2e2394){return client[_0x4184('0xb')](_0x346dc4,_0x5bdecf)[_0x4184('0xc')](function(_0x235bed){logger[_0x4184('0xd')](_0x4184('0xe'),_0x38ccb7,_0x4184('0xf'));logger[_0x4184('0x10')](_0x4184('0x11'),_0x38ccb7,_0x4184('0xf'),JSON[_0x4184('0x12')](_0x235bed));if(_0x235bed['error']){if(_0x235bed['error'][_0x4184('0x13')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x38ccb7,_0x235bed[_0x4184('0x14')]['message']);return _0x2e2394(_0x235bed['error']['message']);}logger[_0x4184('0x14')](_0x4184('0xe'),_0x38ccb7,_0x235bed['error'][_0x4184('0x15')]);return _0x3a7dc4(_0x235bed[_0x4184('0x14')][_0x4184('0x15')]);}else{logger[_0x4184('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x38ccb7,_0x4184('0xf'));_0x3a7dc4(_0x235bed[_0x4184('0x16')][_0x4184('0x15')]);}})[_0x4184('0x17')](function(_0x4e72e7){logger[_0x4184('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x38ccb7,_0x4e72e7);_0x2e2394(_0x4e72e7);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 18a48cf..4f30c2b 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 _0x8aca=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2c49bf,_0x41be3c){var _0x59cbc1=function(_0x358e4d){while(--_0x358e4d){_0x2c49bf['push'](_0x2c49bf['shift']());}};_0x59cbc1(++_0x41be3c);}(_0x8aca,0xbd));var _0xa8ac=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x8aca[_0x193e28];return _0x20ef59;};'use strict';var multer=require(_0xa8ac('0x0'));var util=require(_0xa8ac('0x1'));var path=require(_0xa8ac('0x2'));var timeout=require('connect-timeout');var express=require(_0xa8ac('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa8ac('0x4'));var interaction=require(_0xa8ac('0x5'));var config=require(_0xa8ac('0x6'));var controller=require(_0xa8ac('0x7'));router['get']('/',auth[_0xa8ac('0x8')](),controller['index']);router['get']('/:id',auth[_0xa8ac('0x8')](),controller['show']);router[_0xa8ac('0x9')]('/',auth[_0xa8ac('0x8')](),controller[_0xa8ac('0xa')]);router[_0xa8ac('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa8ac('0xc')]);router[_0xa8ac('0xd')]('/:id',auth[_0xa8ac('0x8')](),controller[_0xa8ac('0xe')]);module[_0xa8ac('0xf')]=router; \ No newline at end of file +var _0x51c3=['put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0x5a30cb,_0x28264b){var _0x3bfaf1=function(_0x280089){while(--_0x280089){_0x5a30cb['push'](_0x5a30cb['shift']());}};_0x3bfaf1(++_0x28264b);}(_0x51c3,0x10d));var _0x351c=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x51c3[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x351c('0x0'));var util=require(_0x351c('0x1'));var path=require(_0x351c('0x2'));var timeout=require(_0x351c('0x3'));var express=require(_0x351c('0x4'));var router=express[_0x351c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x351c('0x6'));var interaction=require(_0x351c('0x7'));var config=require(_0x351c('0x8'));var controller=require(_0x351c('0x9'));router['get']('/',auth[_0x351c('0xa')](),controller[_0x351c('0xb')]);router[_0x351c('0xc')](_0x351c('0xd'),auth['isAuthenticated'](),controller[_0x351c('0xe')]);router['post']('/',auth[_0x351c('0xa')](),controller[_0x351c('0xf')]);router[_0x351c('0x10')](_0x351c('0xd'),auth[_0x351c('0xa')](),controller['update']);router[_0x351c('0x11')](_0x351c('0xd'),auth[_0x351c('0xa')](),controller['destroy']);module[_0x351c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index d5f0ade..07e035d 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 _0x30cf=['keyValue','picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x3e95ec,_0x1977c9){var _0x456abf=function(_0x5ec0c3){while(--_0x5ec0c3){_0x3e95ec['push'](_0x3e95ec['shift']());}};_0x456abf(++_0x1977c9);}(_0x30cf,0x88));var _0xf30c=function(_0x240f93,_0x3f19d7){_0x240f93=_0x240f93-0x0;var _0x305452=_0x30cf[_0x240f93];return _0x305452;};'use strict';var Sequelize=require(_0xf30c('0x0'));module[_0xf30c('0x1')]={'type':{'type':Sequelize[_0xf30c('0x2')]('string',_0xf30c('0x3'),'customVariable',_0xf30c('0x4'),_0xf30c('0x5')),'defaultValue':_0xf30c('0x6')},'content':{'type':Sequelize[_0xf30c('0x7')]},'key':{'type':Sequelize[_0xf30c('0x7')]},'keyType':{'type':Sequelize[_0xf30c('0x2')](_0xf30c('0x6'),_0xf30c('0x3'),_0xf30c('0x8'))},'keyContent':{'type':Sequelize[_0xf30c('0x7')]},'idField':{'type':Sequelize[_0xf30c('0x7')]},'nameField':{'type':Sequelize[_0xf30c('0x7')]},'customField':{'type':Sequelize[_0xf30c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf30c('0x7')]}}; \ No newline at end of file +var _0xd496=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','STRING'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xd496,0x1cd));var _0x6d49=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xd496[_0x166d93];return _0xba708;};'use strict';var Sequelize=require(_0x6d49('0x0'));module[_0x6d49('0x1')]={'type':{'type':Sequelize[_0x6d49('0x2')](_0x6d49('0x3'),'variable',_0x6d49('0x4'),_0x6d49('0x5'),'picklist'),'defaultValue':_0x6d49('0x3')},'content':{'type':Sequelize[_0x6d49('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6d49('0x3'),_0x6d49('0x7'),_0x6d49('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6d49('0x6')]},'nameField':{'type':Sequelize[_0x6d49('0x6')]},'customField':{'type':Sequelize[_0x6d49('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index d8e1798..7940da4 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 _0x225b=['name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','destroy','then','end','error','stack'];(function(_0x185369,_0x46be46){var _0x4b98ba=function(_0x40bbb4){while(--_0x40bbb4){_0x185369['push'](_0x185369['shift']());}};_0x4b98ba(++_0x46be46);}(_0x225b,0xb1));var _0xb225=function(_0x222e82,_0x476db9){_0x222e82=_0x222e82-0x0;var _0x4ea340=_0x225b[_0x222e82];return _0x4ea340;};'use strict';var emlformat=require(_0xb225('0x0'));var rimraf=require(_0xb225('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb225('0x2'));var rp=require(_0xb225('0x3'));var moment=require('moment');var BPromise=require(_0xb225('0x4'));var Mustache=require('mustache');var util=require(_0xb225('0x5'));var path=require('path');var sox=require(_0xb225('0x6'));var csv=require(_0xb225('0x7'));var ejs=require(_0xb225('0x8'));var fs=require('fs');var fs_extra=require(_0xb225('0x9'));var _=require(_0xb225('0xa'));var squel=require(_0xb225('0xb'));var crypto=require(_0xb225('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb225('0xd'));var toCsv=require(_0xb225('0x7'));var querystring=require(_0xb225('0xe'));var Papa=require(_0xb225('0xf'));var Redis=require('ioredis');var authService=require(_0xb225('0x10'));var qs=require(_0xb225('0x11'));var as=require(_0xb225('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb225('0x13'))(_0xb225('0x14'));var utils=require(_0xb225('0x15'));var config=require(_0xb225('0x16'));var licenseUtil=require(_0xb225('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2916e5,_0xd09413){_0xd09413=_0xd09413||0xcc;return function(_0x396c4e){if(_0x396c4e){return _0x2916e5[_0xb225('0x18')](_0xd09413);}return _0x2916e5[_0xb225('0x19')](_0xd09413)['end']();};}function respondWithResult(_0x53624f,_0x28f330){_0x28f330=_0x28f330||0xc8;return function(_0x897e1c){if(_0x897e1c){return _0x53624f[_0xb225('0x19')](_0x28f330)[_0xb225('0x1a')](_0x897e1c);}};}function respondWithFilteredResult(_0x2b5202,_0x3a640b){return function(_0x44d32d){if(_0x44d32d){var _0x2be9b4=typeof _0x3a640b[_0xb225('0x1b')]===_0xb225('0x1c')&&typeof _0x3a640b[_0xb225('0x1d')]===_0xb225('0x1c');var _0x5ccb06=_0x44d32d[_0xb225('0x1e')];var _0x5bd9e8=_0x2be9b4?0x0:_0x3a640b[_0xb225('0x1b')];var _0x10a0b6=_0x2be9b4?_0x44d32d[_0xb225('0x1e')]:_0x3a640b[_0xb225('0x1b')]+_0x3a640b[_0xb225('0x1d')];var _0x212aea;if(_0x10a0b6>=_0x5ccb06){_0x10a0b6=_0x5ccb06;_0x212aea=0xc8;}else{_0x212aea=0xce;}_0x2b5202[_0xb225('0x19')](_0x212aea);return _0x2b5202['set']('Content-Range',_0x5bd9e8+'-'+_0x10a0b6+'/'+_0x5ccb06)[_0xb225('0x1a')](_0x44d32d);}return null;};}function patchUpdates(_0x1ec7ae){return function(_0x24c854){try{jsonpatch['apply'](_0x24c854,_0x1ec7ae,!![]);}catch(_0x4d40cf){return BPromise[_0xb225('0x1f')](_0x4d40cf);}return _0x24c854[_0xb225('0x20')]();};}function saveUpdates(_0x34ec68,_0x12f00a){return function(_0x8e76be){if(_0x8e76be){return _0x8e76be[_0xb225('0x21')](_0x34ec68)['then'](function(_0x3c6029){return _0x3c6029;});}return null;};}function removeEntity(_0x556ebf,_0x535522){return function(_0x3c323b){if(_0x3c323b){return _0x3c323b[_0xb225('0x22')]()[_0xb225('0x23')](function(){_0x556ebf[_0xb225('0x19')](0xcc)[_0xb225('0x24')]();});}};}function handleEntityNotFound(_0x420330,_0xf90a8b){return function(_0x5d11ff){if(!_0x5d11ff){_0x420330['sendStatus'](0x194);}return _0x5d11ff;};}function handleError(_0x5c8195,_0x26ae38){_0x26ae38=_0x26ae38||0x1f4;return function(_0x12e2b9){logger[_0xb225('0x25')](_0x12e2b9[_0xb225('0x26')]);if(_0x12e2b9[_0xb225('0x27')]){delete _0x12e2b9['name'];}_0x5c8195[_0xb225('0x19')](_0x26ae38)[_0xb225('0x28')](_0x12e2b9);};}exports[_0xb225('0x29')]=function(_0x41bf0d,_0x4200f9){var _0x2b69cb={},_0x5a6eff={},_0x3ac1b4={'count':0x0,'rows':[]};var _0x7ffb03=_[_0xb225('0x2a')](db[_0xb225('0x2b')][_0xb225('0x2c')],function(_0x378724){return{'name':_0x378724[_0xb225('0x2d')],'type':_0x378724[_0xb225('0x2e')][_0xb225('0x2f')]};});_0x5a6eff[_0xb225('0x30')]=_[_0xb225('0x2a')](_0x7ffb03,'name');_0x5a6eff[_0xb225('0x31')]=_[_0xb225('0x32')](_0x41bf0d['query']);_0x5a6eff[_0xb225('0x33')]=_['intersection'](_0x5a6eff[_0xb225('0x30')],_0x5a6eff[_0xb225('0x31')]);_0x2b69cb[_0xb225('0x34')]=_[_0xb225('0x35')](_0x5a6eff[_0xb225('0x30')],qs[_0xb225('0x36')](_0x41bf0d[_0xb225('0x31')][_0xb225('0x36')]));_0x2b69cb[_0xb225('0x34')]=_0x2b69cb['attributes'][_0xb225('0x37')]?_0x2b69cb['attributes']:_0x5a6eff[_0xb225('0x30')];if(!_0x41bf0d['query']['hasOwnProperty'](_0xb225('0x38'))){_0x2b69cb[_0xb225('0x1d')]=qs[_0xb225('0x1d')](_0x41bf0d[_0xb225('0x31')]['limit']);_0x2b69cb[_0xb225('0x1b')]=qs[_0xb225('0x1b')](_0x41bf0d[_0xb225('0x31')][_0xb225('0x1b')]);}_0x2b69cb[_0xb225('0x39')]=qs[_0xb225('0x3a')](_0x41bf0d[_0xb225('0x31')][_0xb225('0x3a')]);_0x2b69cb['where']=qs['filters'](_[_0xb225('0x3b')](_0x41bf0d['query'],_0x5a6eff[_0xb225('0x33')]),_0x7ffb03);if(_0x41bf0d[_0xb225('0x31')]['filter']){_0x2b69cb[_0xb225('0x3c')]=_[_0xb225('0x3d')](_0x2b69cb['where'],{'$or':_[_0xb225('0x2a')](_0x7ffb03,function(_0x257cdb){if(_0x257cdb[_0xb225('0x2e')]!==_0xb225('0x3e')){var _0x1a1253={};_0x1a1253[_0x257cdb['name']]={'$like':'%'+_0x41bf0d[_0xb225('0x31')][_0xb225('0x3f')]+'%'};return _0x1a1253;}})});}_0x2b69cb=_['merge']({},_0x2b69cb,_0x41bf0d[_0xb225('0x40')]);var _0x26078a={'where':_0x2b69cb[_0xb225('0x3c')]};return db['ZohoField']['count'](_0x26078a)['then'](function(_0x5e4cad){_0x3ac1b4[_0xb225('0x1e')]=_0x5e4cad;if(_0x41bf0d[_0xb225('0x31')]['includeAll']){_0x2b69cb['include']=[{'all':!![]}];}return db[_0xb225('0x2b')]['findAll'](_0x2b69cb);})[_0xb225('0x23')](function(_0x152eb3){_0x3ac1b4[_0xb225('0x41')]=_0x152eb3;return _0x3ac1b4;})['then'](respondWithFilteredResult(_0x4200f9,_0x2b69cb))[_0xb225('0x42')](handleError(_0x4200f9,null));};exports['show']=function(_0x416f36,_0x1a6784){var _0x3b5f98={'raw':!![],'where':{'id':_0x416f36[_0xb225('0x43')]['id']}},_0x276a8c={};_0x276a8c[_0xb225('0x30')]=_[_0xb225('0x32')](db[_0xb225('0x2b')]['rawAttributes']);_0x276a8c[_0xb225('0x31')]=_[_0xb225('0x32')](_0x416f36[_0xb225('0x31')]);_0x276a8c[_0xb225('0x33')]=_[_0xb225('0x35')](_0x276a8c['model'],_0x276a8c[_0xb225('0x31')]);_0x3b5f98[_0xb225('0x34')]=_[_0xb225('0x35')](_0x276a8c[_0xb225('0x30')],qs[_0xb225('0x36')](_0x416f36[_0xb225('0x31')]['fields']));_0x3b5f98[_0xb225('0x34')]=_0x3b5f98[_0xb225('0x34')][_0xb225('0x37')]?_0x3b5f98[_0xb225('0x34')]:_0x276a8c['model'];if(_0x416f36[_0xb225('0x31')][_0xb225('0x44')]){_0x3b5f98['include']=[{'all':!![]}];}_0x3b5f98=_[_0xb225('0x3d')]({},_0x3b5f98,_0x416f36[_0xb225('0x40')]);return db[_0xb225('0x2b')][_0xb225('0x45')](_0x3b5f98)['then'](handleEntityNotFound(_0x1a6784,null))['then'](respondWithResult(_0x1a6784,null))['catch'](handleError(_0x1a6784,null));};exports[_0xb225('0x46')]=function(_0x29c9e0,_0x20bde5){return db['ZohoField'][_0xb225('0x46')](_0x29c9e0['body'],{})[_0xb225('0x23')](respondWithResult(_0x20bde5,0xc9))[_0xb225('0x42')](handleError(_0x20bde5,null));};exports[_0xb225('0x21')]=function(_0x4f23fb,_0x512c7e){if(_0x4f23fb[_0xb225('0x47')]['id']){delete _0x4f23fb[_0xb225('0x47')]['id'];}return db[_0xb225('0x2b')][_0xb225('0x45')]({'where':{'id':_0x4f23fb[_0xb225('0x43')]['id']}})['then'](handleEntityNotFound(_0x512c7e,null))[_0xb225('0x23')](saveUpdates(_0x4f23fb['body'],null))['then'](respondWithResult(_0x512c7e,null))[_0xb225('0x42')](handleError(_0x512c7e,null));};exports[_0xb225('0x22')]=function(_0x59ea13,_0x54cd0e){return db[_0xb225('0x2b')]['find']({'where':{'id':_0x59ea13[_0xb225('0x43')]['id']}})[_0xb225('0x23')](handleEntityNotFound(_0x54cd0e,null))[_0xb225('0x23')](removeEntity(_0x54cd0e,null))[_0xb225('0x42')](handleError(_0x54cd0e,null));}; \ No newline at end of file +var _0x6946=['sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','ZohoField','includeAll','findAll','catch','show','params','rawAttributes','include','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x531615,_0x4a3f87){var _0x2bc611=function(_0x1ea05f){while(--_0x1ea05f){_0x531615['push'](_0x531615['shift']());}};_0x2bc611(++_0x4a3f87);}(_0x6946,0x1b3));var _0x6694=function(_0x50889e,_0xeb0acf){_0x50889e=_0x50889e-0x0;var _0x4d59db=_0x6946[_0x50889e];return _0x4d59db;};'use strict';var emlformat=require(_0x6694('0x0'));var rimraf=require(_0x6694('0x1'));var zipdir=require(_0x6694('0x2'));var jsonpatch=require(_0x6694('0x3'));var rp=require(_0x6694('0x4'));var moment=require(_0x6694('0x5'));var BPromise=require(_0x6694('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6694('0x7'));var sox=require(_0x6694('0x8'));var csv=require(_0x6694('0x9'));var ejs=require(_0x6694('0xa'));var fs=require('fs');var fs_extra=require(_0x6694('0xb'));var _=require(_0x6694('0xc'));var squel=require(_0x6694('0xd'));var crypto=require(_0x6694('0xe'));var jsforce=require(_0x6694('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6694('0x10'));var Papa=require(_0x6694('0x11'));var Redis=require(_0x6694('0x12'));var authService=require(_0x6694('0x13'));var qs=require(_0x6694('0x14'));var as=require(_0x6694('0x15'));var hardwareService=require(_0x6694('0x16'));var logger=require('../../config/logger')(_0x6694('0x17'));var utils=require(_0x6694('0x18'));var config=require(_0x6694('0x19'));var licenseUtil=require(_0x6694('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a0c8a,_0x10d5bb){_0x10d5bb=_0x10d5bb||0xcc;return function(_0x23b640){if(_0x23b640){return _0x3a0c8a[_0x6694('0x1b')](_0x10d5bb);}return _0x3a0c8a[_0x6694('0x1c')](_0x10d5bb)[_0x6694('0x1d')]();};}function respondWithResult(_0x2b22a4,_0x505c3c){_0x505c3c=_0x505c3c||0xc8;return function(_0x1ea340){if(_0x1ea340){return _0x2b22a4[_0x6694('0x1c')](_0x505c3c)[_0x6694('0x1e')](_0x1ea340);}};}function respondWithFilteredResult(_0xc4a4f4,_0x347b0d){return function(_0xbc0b6){if(_0xbc0b6){var _0x413a38=typeof _0x347b0d['offset']===_0x6694('0x1f')&&typeof _0x347b0d['limit']===_0x6694('0x1f');var _0x4b3cdf=_0xbc0b6[_0x6694('0x20')];var _0x4286ad=_0x413a38?0x0:_0x347b0d[_0x6694('0x21')];var _0x394f29=_0x413a38?_0xbc0b6[_0x6694('0x20')]:_0x347b0d[_0x6694('0x21')]+_0x347b0d[_0x6694('0x22')];var _0x53185a;if(_0x394f29>=_0x4b3cdf){_0x394f29=_0x4b3cdf;_0x53185a=0xc8;}else{_0x53185a=0xce;}_0xc4a4f4['status'](_0x53185a);return _0xc4a4f4[_0x6694('0x23')]('Content-Range',_0x4286ad+'-'+_0x394f29+'/'+_0x4b3cdf)[_0x6694('0x1e')](_0xbc0b6);}return null;};}function patchUpdates(_0xab1d7e){return function(_0x516dda){try{jsonpatch['apply'](_0x516dda,_0xab1d7e,!![]);}catch(_0x336883){return BPromise[_0x6694('0x24')](_0x336883);}return _0x516dda[_0x6694('0x25')]();};}function saveUpdates(_0x411009,_0x436a7e){return function(_0x49dfeb){if(_0x49dfeb){return _0x49dfeb[_0x6694('0x26')](_0x411009)[_0x6694('0x27')](function(_0xd65993){return _0xd65993;});}return null;};}function removeEntity(_0x9b6ff9,_0x192a9f){return function(_0x2cb470){if(_0x2cb470){return _0x2cb470[_0x6694('0x28')]()[_0x6694('0x27')](function(){_0x9b6ff9[_0x6694('0x1c')](0xcc)[_0x6694('0x1d')]();});}};}function handleEntityNotFound(_0x569f3d,_0x94b5b2){return function(_0x5f56e6){if(!_0x5f56e6){_0x569f3d[_0x6694('0x1b')](0x194);}return _0x5f56e6;};}function handleError(_0x156765,_0x5542ff){_0x5542ff=_0x5542ff||0x1f4;return function(_0x462ef1){logger[_0x6694('0x29')](_0x462ef1[_0x6694('0x2a')]);if(_0x462ef1[_0x6694('0x2b')]){delete _0x462ef1['name'];}_0x156765[_0x6694('0x1c')](_0x5542ff)[_0x6694('0x2c')](_0x462ef1);};}exports[_0x6694('0x2d')]=function(_0x47ee35,_0x305ab6){var _0x39a067={},_0xf2991d={},_0x1172c7={'count':0x0,'rows':[]};var _0x4e2536=_['map'](db['ZohoField']['rawAttributes'],function(_0x4f8f0b){return{'name':_0x4f8f0b[_0x6694('0x2e')],'type':_0x4f8f0b[_0x6694('0x2f')][_0x6694('0x30')]};});_0xf2991d[_0x6694('0x31')]=_['map'](_0x4e2536,_0x6694('0x2b'));_0xf2991d[_0x6694('0x32')]=_[_0x6694('0x33')](_0x47ee35['query']);_0xf2991d['filters']=_[_0x6694('0x34')](_0xf2991d['model'],_0xf2991d['query']);_0x39a067[_0x6694('0x35')]=_[_0x6694('0x34')](_0xf2991d['model'],qs['fields'](_0x47ee35[_0x6694('0x32')][_0x6694('0x36')]));_0x39a067[_0x6694('0x35')]=_0x39a067[_0x6694('0x35')][_0x6694('0x37')]?_0x39a067['attributes']:_0xf2991d[_0x6694('0x31')];if(!_0x47ee35[_0x6694('0x32')][_0x6694('0x38')](_0x6694('0x39'))){_0x39a067[_0x6694('0x22')]=qs[_0x6694('0x22')](_0x47ee35['query'][_0x6694('0x22')]);_0x39a067[_0x6694('0x21')]=qs[_0x6694('0x21')](_0x47ee35[_0x6694('0x32')]['offset']);}_0x39a067[_0x6694('0x3a')]=qs[_0x6694('0x3b')](_0x47ee35[_0x6694('0x32')]['sort']);_0x39a067[_0x6694('0x3c')]=qs[_0x6694('0x3d')](_[_0x6694('0x3e')](_0x47ee35[_0x6694('0x32')],_0xf2991d[_0x6694('0x3d')]),_0x4e2536);if(_0x47ee35[_0x6694('0x32')]['filter']){_0x39a067[_0x6694('0x3c')]=_[_0x6694('0x3f')](_0x39a067[_0x6694('0x3c')],{'$or':_['map'](_0x4e2536,function(_0x396651){if(_0x396651[_0x6694('0x2f')]!==_0x6694('0x40')){var _0x4a6a52={};_0x4a6a52[_0x396651[_0x6694('0x2b')]]={'$like':'%'+_0x47ee35[_0x6694('0x32')]['filter']+'%'};return _0x4a6a52;}})});}_0x39a067=_[_0x6694('0x3f')]({},_0x39a067,_0x47ee35['options']);var _0x999a71={'where':_0x39a067['where']};return db[_0x6694('0x41')][_0x6694('0x20')](_0x999a71)[_0x6694('0x27')](function(_0x5244ad){_0x1172c7[_0x6694('0x20')]=_0x5244ad;if(_0x47ee35[_0x6694('0x32')][_0x6694('0x42')]){_0x39a067['include']=[{'all':!![]}];}return db[_0x6694('0x41')][_0x6694('0x43')](_0x39a067);})[_0x6694('0x27')](function(_0x309522){_0x1172c7['rows']=_0x309522;return _0x1172c7;})['then'](respondWithFilteredResult(_0x305ab6,_0x39a067))[_0x6694('0x44')](handleError(_0x305ab6,null));};exports[_0x6694('0x45')]=function(_0x2abeb6,_0x26b838){var _0x289e3d={'raw':!![],'where':{'id':_0x2abeb6[_0x6694('0x46')]['id']}},_0x41728f={};_0x41728f['model']=_[_0x6694('0x33')](db[_0x6694('0x41')][_0x6694('0x47')]);_0x41728f['query']=_[_0x6694('0x33')](_0x2abeb6[_0x6694('0x32')]);_0x41728f[_0x6694('0x3d')]=_['intersection'](_0x41728f[_0x6694('0x31')],_0x41728f[_0x6694('0x32')]);_0x289e3d['attributes']=_[_0x6694('0x34')](_0x41728f[_0x6694('0x31')],qs[_0x6694('0x36')](_0x2abeb6[_0x6694('0x32')][_0x6694('0x36')]));_0x289e3d[_0x6694('0x35')]=_0x289e3d[_0x6694('0x35')][_0x6694('0x37')]?_0x289e3d[_0x6694('0x35')]:_0x41728f[_0x6694('0x31')];if(_0x2abeb6[_0x6694('0x32')][_0x6694('0x42')]){_0x289e3d[_0x6694('0x48')]=[{'all':!![]}];}_0x289e3d=_[_0x6694('0x3f')]({},_0x289e3d,_0x2abeb6[_0x6694('0x49')]);return db[_0x6694('0x41')]['find'](_0x289e3d)[_0x6694('0x27')](handleEntityNotFound(_0x26b838,null))[_0x6694('0x27')](respondWithResult(_0x26b838,null))[_0x6694('0x44')](handleError(_0x26b838,null));};exports['create']=function(_0x394dba,_0x4a3103){return db[_0x6694('0x41')][_0x6694('0x4a')](_0x394dba['body'],{})['then'](respondWithResult(_0x4a3103,0xc9))[_0x6694('0x44')](handleError(_0x4a3103,null));};exports[_0x6694('0x26')]=function(_0x107ae3,_0x158599){if(_0x107ae3[_0x6694('0x4b')]['id']){delete _0x107ae3['body']['id'];}return db[_0x6694('0x41')][_0x6694('0x4c')]({'where':{'id':_0x107ae3[_0x6694('0x46')]['id']}})['then'](handleEntityNotFound(_0x158599,null))[_0x6694('0x27')](saveUpdates(_0x107ae3['body'],null))[_0x6694('0x27')](respondWithResult(_0x158599,null))['catch'](handleError(_0x158599,null));};exports['destroy']=function(_0x52ac90,_0x1900f9){return db[_0x6694('0x41')][_0x6694('0x4c')]({'where':{'id':_0x52ac90['params']['id']}})[_0x6694('0x27')](handleEntityNotFound(_0x1900f9,null))['then'](removeEntity(_0x1900f9,null))[_0x6694('0x44')](handleError(_0x1900f9,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index db0769a..b6a329b 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 _0xfb11=['bluebird','path','../../config/environment','./intZohoField.attributes','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x137ade,_0xae42be){var _0x5303db=function(_0x517f01){while(--_0x517f01){_0x137ade['push'](_0x137ade['shift']());}};_0x5303db(++_0xae42be);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xfb11[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var logger=require(_0x1fb1('0x1'))(_0x1fb1('0x2'));var moment=require('moment');var BPromise=require(_0x1fb1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb1('0x4'));var rimraf=require('rimraf');var config=require(_0x1fb1('0x5'));var attributes=require(_0x1fb1('0x6'));module['exports']=function(_0x25d44f,_0x133727){return _0x25d44f['define'](_0x1fb1('0x7'),attributes,{'tableName':_0x1fb1('0x8'),'paranoid':![],'indexes':[{'name':_0x1fb1('0x9'),'fields':[_0x1fb1('0xa'),_0x1fb1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6455=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','FieldId','lodash','../../config/logger','api'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x6455,0x97));var _0x5645=function(_0x1ae447,_0x587a9b){_0x1ae447=_0x1ae447-0x0;var _0x18e1cb=_0x6455[_0x1ae447];return _0x18e1cb;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x9400a8,_0x3a635d){return _0x9400a8[_0x5645('0xa')](_0x5645('0xb'),attributes,{'tableName':_0x5645('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x5645('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 2246608..766767d 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 _0xa884=['client','http','request','then','info','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2278e8,_0x21f45d){var _0xf31b76=function(_0x36715f){while(--_0x36715f){_0x2278e8['push'](_0x2278e8['shift']());}};_0xf31b76(++_0x21f45d);}(_0xa884,0x15e));var _0x4a88=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0xa884[_0x650e11];return _0x1a9b47;};'use strict';var _=require(_0x4a88('0x0'));var util=require(_0x4a88('0x1'));var moment=require(_0x4a88('0x2'));var BPromise=require(_0x4a88('0x3'));var rs=require(_0x4a88('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a88('0x5'));var logger=require(_0x4a88('0x6'))(_0x4a88('0x7'));var config=require(_0x4a88('0x8'));var jayson=require(_0x4a88('0x9'));var client=jayson[_0x4a88('0xa')][_0x4a88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6d09,_0x1bbd40,_0x57392d){return new BPromise(function(_0x42b069,_0x5e7d69){return client[_0x4a88('0xc')](_0x4c6d09,_0x57392d)[_0x4a88('0xd')](function(_0x2b3731){logger[_0x4a88('0xe')]('ZohoField,\x20%s,\x20%s',_0x1bbd40,_0x4a88('0xf'));logger['debug'](_0x4a88('0x10'),_0x1bbd40,_0x4a88('0xf'),JSON[_0x4a88('0x11')](_0x2b3731));if(_0x2b3731['error']){if(_0x2b3731[_0x4a88('0x12')][_0x4a88('0x13')]===0x1f4){logger[_0x4a88('0x12')](_0x4a88('0x14'),_0x1bbd40,_0x2b3731[_0x4a88('0x12')][_0x4a88('0x15')]);return _0x5e7d69(_0x2b3731[_0x4a88('0x12')][_0x4a88('0x15')]);}logger[_0x4a88('0x12')](_0x4a88('0x14'),_0x1bbd40,_0x2b3731[_0x4a88('0x12')][_0x4a88('0x15')]);return _0x42b069(_0x2b3731[_0x4a88('0x12')][_0x4a88('0x15')]);}else{logger['info'](_0x4a88('0x14'),_0x1bbd40,'request\x20sent');_0x42b069(_0x2b3731[_0x4a88('0x16')]['message']);}})[_0x4a88('0x17')](function(_0x865847){logger[_0x4a88('0x12')](_0x4a88('0x14'),_0x1bbd40,_0x865847);_0x5e7d69(_0x865847);});});} \ No newline at end of file +var _0x380b=['error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5300ce,_0x33c8e9){var _0x466ff9=function(_0x406d6f){while(--_0x406d6f){_0x5300ce['push'](_0x5300ce['shift']());}};_0x466ff9(++_0x33c8e9);}(_0x380b,0x15d));var _0xb380=function(_0x10cd9e,_0x230bec){_0x10cd9e=_0x10cd9e-0x0;var _0x1ffb46=_0x380b[_0x10cd9e];return _0x1ffb46;};'use strict';var _=require('lodash');var util=require(_0xb380('0x0'));var moment=require(_0xb380('0x1'));var BPromise=require(_0xb380('0x2'));var rs=require(_0xb380('0x3'));var fs=require('fs');var Redis=require(_0xb380('0x4'));var db=require(_0xb380('0x5'))['db'];var utils=require(_0xb380('0x6'));var logger=require(_0xb380('0x7'))('rpc');var config=require(_0xb380('0x8'));var jayson=require(_0xb380('0x9'));var client=jayson[_0xb380('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e6528,_0x844bdf,_0x2f1456){return new BPromise(function(_0x194082,_0x504ef7){return client[_0xb380('0xb')](_0x4e6528,_0x2f1456)[_0xb380('0xc')](function(_0x3bcab5){logger[_0xb380('0xd')](_0xb380('0xe'),_0x844bdf,_0xb380('0xf'));logger[_0xb380('0x10')](_0xb380('0x11'),_0x844bdf,_0xb380('0xf'),JSON[_0xb380('0x12')](_0x3bcab5));if(_0x3bcab5['error']){if(_0x3bcab5[_0xb380('0x13')][_0xb380('0x14')]===0x1f4){logger[_0xb380('0x13')]('ZohoField,\x20%s,\x20%s',_0x844bdf,_0x3bcab5[_0xb380('0x13')]['message']);return _0x504ef7(_0x3bcab5[_0xb380('0x13')][_0xb380('0x15')]);}logger[_0xb380('0x13')]('ZohoField,\x20%s,\x20%s',_0x844bdf,_0x3bcab5[_0xb380('0x13')]['message']);return _0x194082(_0x3bcab5[_0xb380('0x13')][_0xb380('0x15')]);}else{logger[_0xb380('0xd')](_0xb380('0xe'),_0x844bdf,'request\x20sent');_0x194082(_0x3bcab5[_0xb380('0x16')]['message']);}})['catch'](function(_0x4892c5){logger['error'](_0xb380('0xe'),_0x844bdf,_0x4892c5);_0x504ef7(_0x4892c5);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 3429b6b..c44b39a 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3c1f7d,_0x11949c){var _0x40cad6=function(_0x177409){while(--_0x177409){_0x3c1f7d['push'](_0x3c1f7d['shift']());}};_0x40cad6(++_0x11949c);}(_0xe706,0xa3));var _0x6e70=function(_0xbed58e,_0x3a1272){_0xbed58e=_0xbed58e-0x0;var _0x295e44=_0xe706[_0xbed58e];return _0x295e44;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x379b0f,_0x1c3fd3){var _0x1175d0=function(_0x1ec81b){while(--_0x1ec81b){_0x379b0f['push'](_0x379b0f['shift']());}};_0x1175d0(++_0x1c3fd3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 725f249..43fb13d 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 _0x1601=['STRING','exports','unique_name_and_version'];(function(_0x4e1ffa,_0x1b85fe){var _0x172c8a=function(_0x414ecd){while(--_0x414ecd){_0x4e1ffa['push'](_0x4e1ffa['shift']());}};_0x172c8a(++_0x1b85fe);}(_0x1601,0x151));var _0x1160=function(_0x197043,_0x3ebf47){_0x197043=_0x197043-0x0;var _0x233e33=_0x1601[_0x197043];return _0x233e33;};'use strict';var Sequelize=require('sequelize');module[_0x1160('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1160('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1160('0x1')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x1160('0x2')]},'path':{'type':Sequelize[_0x1160('0x2')]},'type':{'type':Sequelize[_0x1160('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x1160('0x2')]},'logo':{'type':Sequelize[_0x1160('0x2')]},'state':{'type':Sequelize[_0x1160('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x1160('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1160('0x2')]},'link':{'type':Sequelize[_0x1160('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x01a2=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','sequelize'];(function(_0x198ce4,_0x16c396){var _0x26e065=function(_0xc9875){while(--_0xc9875){_0x198ce4['push'](_0x198ce4['shift']());}};_0x26e065(++_0x16c396);}(_0x01a2,0x68));var _0x201a=function(_0x496945,_0x4da389){_0x496945=_0x496945-0x0;var _0xec62b6=_0x01a2[_0x496945];return _0xec62b6;};'use strict';var Sequelize=require(_0x201a('0x0'));module[_0x201a('0x1')]={'name':{'type':Sequelize[_0x201a('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x201a('0x2')],'allowNull':![],'unique':_0x201a('0x3')},'main':{'type':Sequelize[_0x201a('0x2')],'defaultValue':_0x201a('0x4')},'filename':{'type':Sequelize[_0x201a('0x2')]},'path':{'type':Sequelize[_0x201a('0x2')]},'type':{'type':Sequelize[_0x201a('0x2')]},'size':{'type':Sequelize[_0x201a('0x5')]},'active':{'type':Sequelize[_0x201a('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x201a('0x2')]},'logo':{'type':Sequelize[_0x201a('0x2')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x201a('0x2')]},'title':{'type':Sequelize[_0x201a('0x2')]},'remoteUri':{'type':Sequelize[_0x201a('0x2')]},'link':{'type':Sequelize[_0x201a('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 7453897..ad91da0 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 _0xe3da=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x124614,_0x5392b){var _0x301b96=function(_0x237ab5){while(--_0x237ab5){_0x124614['push'](_0x124614['shift']());}};_0x301b96(++_0x5392b);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));}; \ No newline at end of file +var _0xfdbd=['findAll','rows','show','length','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','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','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x458c7f,_0x25e2fc){var _0x5c6f28=function(_0x3d7d2d){while(--_0x3d7d2d){_0x458c7f['push'](_0x458c7f['shift']());}};_0x5c6f28(++_0x25e2fc);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0xfdbd[_0xca1f0e];return _0x35e4ef;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['Integration'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['Integration']['create'](_0x1c08fb[_0xdfdb('0x4b')],{})[_0xdfdb('0x26')](respondWithResult(_0x273477,0xc9))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports['update']=function(_0x36149e,_0x4d4c90){if(_0x36149e[_0xdfdb('0x4b')]['id']){delete _0x36149e[_0xdfdb('0x4b')]['id'];}return db['Integration'][_0xdfdb('0x48')]({'where':{'id':_0x36149e[_0xdfdb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d4c90,null))[_0xdfdb('0x26')](saveUpdates(_0x36149e[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x4d4c90,null))[_0xdfdb('0x49')](handleError(_0x4d4c90,null));};exports[_0xdfdb('0x25')]=function(_0x10b490,_0x17dfdb){return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'id':_0x10b490['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x17dfdb,null))['then'](removeEntity(_0x17dfdb,null))[_0xdfdb('0x49')](handleError(_0x17dfdb,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6d4f37b..208f0c0 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 _0x124f=['moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','define','integrations','lodash'];(function(_0x798d5a,_0x4fab9c){var _0x1d23ef=function(_0x2a2e7a){while(--_0x2a2e7a){_0x798d5a['push'](_0x798d5a['shift']());}};_0x1d23ef(++_0x4fab9c);}(_0x124f,0x8f));var _0xf124=function(_0x1867ee,_0x5ccefc){_0x1867ee=_0x1867ee-0x0;var _0x49345c=_0x124f[_0x1867ee];return _0x49345c;};'use strict';var _=require(_0xf124('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf124('0x1'));var BPromise=require(_0xf124('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf124('0x3'));var rimraf=require(_0xf124('0x4'));var config=require(_0xf124('0x5'));var attributes=require(_0xf124('0x6'));module['exports']=function(_0x5cde65,_0x57b0d8){return _0x5cde65[_0xf124('0x7')]('Integration',attributes,{'tableName':_0xf124('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6439=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','Integration','lodash','../../config/logger','api'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x6439,0x159));var _0x9643=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x6439[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x9643('0x0'));var util=require('util');var logger=require(_0x9643('0x1'))(_0x9643('0x2'));var moment=require(_0x9643('0x3'));var BPromise=require(_0x9643('0x4'));var rp=require(_0x9643('0x5'));var fs=require('fs');var path=require(_0x9643('0x6'));var rimraf=require(_0x9643('0x7'));var config=require(_0x9643('0x8'));var attributes=require(_0x9643('0x9'));module['exports']=function(_0x4b4a86,_0x423208){return _0x4b4a86[_0x9643('0xa')](_0x9643('0xb'),attributes,{'tableName':'integrations','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 539ab15..b2e20e8 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1a1f82,_0x16e88b){var _0x152427=function(_0xcddcba){while(--_0xcddcba){_0x1a1f82['push'](_0x1a1f82['shift']());}};_0x152427(++_0x16e88b);}(_0xadb5,0xad));var _0x5adb=function(_0x1e4088,_0x4870ef){_0x1e4088=_0x1e4088-0x0;var _0x525141=_0xadb5[_0x1e4088];return _0x525141;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x524e,0x15e));var _0xe524=function(_0x1bd3bd,_0x474b5a){_0x1bd3bd=_0x1bd3bd-0x0;var _0x854163=_0x524e[_0x1bd3bd];return _0x854163;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index ae9dc73..0d8faf5 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x6e57fc,_0x484568){_0x6e57fc=_0x6e57fc-0x0;var _0x309bea=_0x5f2f[_0x6e57fc];return _0x309bea;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','destroy','exports','util'];(function(_0x4ae879,_0xc32498){var _0x5b65f0=function(_0x19852a){while(--_0x19852a){_0x4ae879['push'](_0x4ae879['shift']());}};_0x5b65f0(++_0xc32498);}(_0x6d38,0x1ef));var _0x86d3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6d38[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xb'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 14f3f36..20dfe65 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 _0x1e94=['sequelize','STRING','DATE','INTEGER','BOOLEAN','TEXT','SENT','SENDING','FAILED'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x1e94,0x87));var _0x41e9=function(_0x32dc49,_0x112ae2){_0x32dc49=_0x32dc49-0x0;var _0x169742=_0x1e94[_0x32dc49];return _0x169742;};'use strict';var Sequelize=require(_0x41e9('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x41e9('0x1')]},'exitStatus':{'type':Sequelize[_0x41e9('0x1')]},'ticketId':{'type':Sequelize[_0x41e9('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x41e9('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x41e9('0x1')]},'interface':{'type':Sequelize[_0x41e9('0x1')]},'membername':{'type':Sequelize[_0x41e9('0x1')]},'agentcalledAt':{'type':Sequelize[_0x41e9('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x41e9('0x3')]},'agentcomplete':{'type':Sequelize[_0x41e9('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x41e9('0x2')]},'talktime':{'type':Sequelize[_0x41e9('0x3')]},'agentacw':{'type':Sequelize[_0x41e9('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x41e9('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x41e9('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x41e9('0x2')]},'agentdump':{'type':Sequelize[_0x41e9('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x41e9('0x2')]},'lastevent':{'type':Sequelize[_0x41e9('0x1')]},'channel':{'type':Sequelize[_0x41e9('0x1')]},'channelstate':{'type':Sequelize[_0x41e9('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x41e9('0x1')]},'exten':{'type':Sequelize[_0x41e9('0x1')]},'priority':{'type':Sequelize[_0x41e9('0x1')]},'destchannel':{'type':Sequelize[_0x41e9('0x1')]},'destchannelstate':{'type':Sequelize[_0x41e9('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x41e9('0x1')]},'destcalleridname':{'type':Sequelize[_0x41e9('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x41e9('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x41e9('0x1')]},'destlanguage':{'type':Sequelize[_0x41e9('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x41e9('0x1')]},'destexten':{'type':Sequelize[_0x41e9('0x1')]},'destpriority':{'type':Sequelize[_0x41e9('0x1')]},'destuniqueid':{'type':Sequelize[_0x41e9('0x1')]},'messageId':{'type':Sequelize[_0x41e9('0x1')]},'inReplyTo':{'type':Sequelize[_0x41e9('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x41e9('0x1')]},'to':{'type':Sequelize[_0x41e9('0x1')]},'cc':{'type':Sequelize[_0x41e9('0x1')]},'attachment':{'type':Sequelize[_0x41e9('0x5')]},'html':{'type':Sequelize[_0x41e9('0x5')]},'text':{'type':Sequelize[_0x41e9('0x5')]},'status':{'type':Sequelize['ENUM'](_0x41e9('0x6'),_0x41e9('0x7'),'RECEIVED',_0x41e9('0x8'))},'url':{'type':Sequelize[_0x41e9('0x1')]},'app':{'type':Sequelize[_0x41e9('0x1')]},'appdata':{'type':Sequelize[_0x41e9('0x1')]},'projectId':{'type':Sequelize[_0x41e9('0x3')]}}; \ No newline at end of file +var _0xe703=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe703,0x180));var _0x3e70=function(_0x41b3d6,_0x21daa8){_0x41b3d6=_0x41b3d6-0x0;var _0x3e60ca=_0xe703[_0x41b3d6];return _0x3e60ca;};'use strict';var Sequelize=require('sequelize');module[_0x3e70('0x0')]={'integration':{'type':Sequelize[_0x3e70('0x1')]},'eventChannel':{'type':Sequelize[_0x3e70('0x1')]},'exitStatus':{'type':Sequelize[_0x3e70('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x3e70('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3e70('0x1')]},'calleridnum':{'type':Sequelize[_0x3e70('0x1')]},'calleridname':{'type':Sequelize[_0x3e70('0x1')]},'queue':{'type':Sequelize[_0x3e70('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3e70('0x1')]},'agentcalledAt':{'type':Sequelize[_0x3e70('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x3e70('0x2')]},'agentcomplete':{'type':Sequelize[_0x3e70('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3e70('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x3e70('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3e70('0x2')]},'reason':{'type':Sequelize[_0x3e70('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x3e70('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3e70('0x3')]},'agentdump':{'type':Sequelize[_0x3e70('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3e70('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3e70('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3e70('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e70('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e70('0x1')]},'language':{'type':Sequelize[_0x3e70('0x1')]},'accountcode':{'type':Sequelize[_0x3e70('0x1')]},'context':{'type':Sequelize[_0x3e70('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3e70('0x1')]},'destchannel':{'type':Sequelize[_0x3e70('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e70('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x3e70('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x3e70('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e70('0x1')]},'destlanguage':{'type':Sequelize[_0x3e70('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e70('0x1')]},'destcontext':{'type':Sequelize[_0x3e70('0x1')]},'destexten':{'type':Sequelize[_0x3e70('0x1')]},'destpriority':{'type':Sequelize[_0x3e70('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x3e70('0x1')]},'subject':{'type':Sequelize[_0x3e70('0x1')]},'from':{'type':Sequelize[_0x3e70('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x3e70('0x5')]},'html':{'type':Sequelize[_0x3e70('0x5')]},'text':{'type':Sequelize[_0x3e70('0x5')]},'status':{'type':Sequelize[_0x3e70('0x6')](_0x3e70('0x7'),_0x3e70('0x8'),_0x3e70('0x9'),_0x3e70('0xa'))},'url':{'type':Sequelize[_0x3e70('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x3e70('0x1')]},'projectId':{'type':Sequelize[_0x3e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index a39d0e6..59f5010 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 _0xbaf4=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','then','catch','show','fields','find','create','body','params','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0xcc482,_0x492b02){var _0x396a7c=function(_0x432b11){while(--_0x432b11){_0xcc482['push'](_0xcc482['shift']());}};_0x396a7c(++_0x492b02);}(_0xbaf4,0xdc));var _0x4baf=function(_0x2eba59,_0x36f016){_0x2eba59=_0x2eba59-0x0;var _0x104b43=_0xbaf4[_0x2eba59];return _0x104b43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4baf('0x0'));var zipdir=require(_0x4baf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4baf('0x2'));var BPromise=require(_0x4baf('0x3'));var Mustache=require(_0x4baf('0x4'));var util=require(_0x4baf('0x5'));var path=require(_0x4baf('0x6'));var sox=require(_0x4baf('0x7'));var csv=require(_0x4baf('0x8'));var ejs=require(_0x4baf('0x9'));var fs=require('fs');var fs_extra=require(_0x4baf('0xa'));var _=require('lodash');var squel=require(_0x4baf('0xb'));var crypto=require(_0x4baf('0xc'));var jsforce=require(_0x4baf('0xd'));var deskjs=require(_0x4baf('0xe'));var toCsv=require(_0x4baf('0x8'));var querystring=require(_0x4baf('0xf'));var Papa=require(_0x4baf('0x10'));var Redis=require(_0x4baf('0x11'));var authService=require(_0x4baf('0x12'));var qs=require(_0x4baf('0x13'));var as=require(_0x4baf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4baf('0x15'))(_0x4baf('0x16'));var utils=require(_0x4baf('0x17'));var config=require(_0x4baf('0x18'));var licenseUtil=require(_0x4baf('0x19'));var db=require(_0x4baf('0x1a'))['db'];function respondWithStatusCode(_0xc7e205,_0x5a0907){_0x5a0907=_0x5a0907||0xcc;return function(_0x20068f){if(_0x20068f){return _0xc7e205[_0x4baf('0x1b')](_0x5a0907);}return _0xc7e205[_0x4baf('0x1c')](_0x5a0907)[_0x4baf('0x1d')]();};}function respondWithResult(_0x3c47e0,_0x406621){_0x406621=_0x406621||0xc8;return function(_0x2c1a84){if(_0x2c1a84){return _0x3c47e0[_0x4baf('0x1c')](_0x406621)[_0x4baf('0x1e')](_0x2c1a84);}};}function respondWithFilteredResult(_0x2fb938,_0x1bc5f8){return function(_0x382fb4){if(_0x382fb4){var _0x366028=typeof _0x1bc5f8[_0x4baf('0x1f')]===_0x4baf('0x20')&&typeof _0x1bc5f8[_0x4baf('0x21')]===_0x4baf('0x20');var _0x70774=_0x382fb4[_0x4baf('0x22')];var _0x592234=_0x366028?0x0:_0x1bc5f8[_0x4baf('0x1f')];var _0x509a26=_0x366028?_0x382fb4[_0x4baf('0x22')]:_0x1bc5f8[_0x4baf('0x1f')]+_0x1bc5f8[_0x4baf('0x21')];var _0x404aa7;if(_0x509a26>=_0x70774){_0x509a26=_0x70774;_0x404aa7=0xc8;}else{_0x404aa7=0xce;}_0x2fb938[_0x4baf('0x1c')](_0x404aa7);return _0x2fb938[_0x4baf('0x23')](_0x4baf('0x24'),_0x592234+'-'+_0x509a26+'/'+_0x70774)['json'](_0x382fb4);}return null;};}function patchUpdates(_0x3b1644){return function(_0x3b6d33){try{jsonpatch[_0x4baf('0x25')](_0x3b6d33,_0x3b1644,!![]);}catch(_0x3c7ba5){return BPromise[_0x4baf('0x26')](_0x3c7ba5);}return _0x3b6d33[_0x4baf('0x27')]();};}function saveUpdates(_0x5eda9a,_0x4faecd){return function(_0x445119){if(_0x445119){return _0x445119[_0x4baf('0x28')](_0x5eda9a)['then'](function(_0x44d9d1){return _0x44d9d1;});}return null;};}function removeEntity(_0x3df288,_0x589ccc){return function(_0x3af974){if(_0x3af974){return _0x3af974[_0x4baf('0x29')]()['then'](function(){_0x3df288[_0x4baf('0x1c')](0xcc)[_0x4baf('0x1d')]();});}};}function handleEntityNotFound(_0x44f5e0,_0x13af8e){return function(_0x4f1c33){if(!_0x4f1c33){_0x44f5e0[_0x4baf('0x1b')](0x194);}return _0x4f1c33;};}function handleError(_0x300a33,_0xf6ddb6){_0xf6ddb6=_0xf6ddb6||0x1f4;return function(_0x2cd1b2){logger[_0x4baf('0x2a')](_0x2cd1b2[_0x4baf('0x2b')]);if(_0x2cd1b2[_0x4baf('0x2c')]){delete _0x2cd1b2['name'];}_0x300a33[_0x4baf('0x1c')](_0xf6ddb6)[_0x4baf('0x2d')](_0x2cd1b2);};}exports[_0x4baf('0x2e')]=function(_0x245ed4,_0x1e76a1){var _0x2288ff={},_0x1713c8={},_0x57c17d={'count':0x0,'rows':[]};var _0x443b1a=_[_0x4baf('0x2f')](db[_0x4baf('0x30')][_0x4baf('0x31')],function(_0x1b80ca){return{'name':_0x1b80ca['fieldName'],'type':_0x1b80ca['type'][_0x4baf('0x32')]};});_0x1713c8[_0x4baf('0x33')]=_[_0x4baf('0x2f')](_0x443b1a,_0x4baf('0x2c'));_0x1713c8['query']=_[_0x4baf('0x34')](_0x245ed4[_0x4baf('0x35')]);_0x1713c8[_0x4baf('0x36')]=_[_0x4baf('0x37')](_0x1713c8['model'],_0x1713c8['query']);_0x2288ff[_0x4baf('0x38')]=_[_0x4baf('0x37')](_0x1713c8[_0x4baf('0x33')],qs['fields'](_0x245ed4[_0x4baf('0x35')]['fields']));_0x2288ff[_0x4baf('0x38')]=_0x2288ff[_0x4baf('0x38')][_0x4baf('0x39')]?_0x2288ff['attributes']:_0x1713c8[_0x4baf('0x33')];if(!_0x245ed4[_0x4baf('0x35')][_0x4baf('0x3a')](_0x4baf('0x3b'))){_0x2288ff[_0x4baf('0x21')]=qs['limit'](_0x245ed4['query'][_0x4baf('0x21')]);_0x2288ff[_0x4baf('0x1f')]=qs[_0x4baf('0x1f')](_0x245ed4['query'][_0x4baf('0x1f')]);}_0x2288ff[_0x4baf('0x3c')]=qs[_0x4baf('0x3d')](_0x245ed4[_0x4baf('0x35')]['sort']);_0x2288ff['where']=qs[_0x4baf('0x36')](_['pick'](_0x245ed4[_0x4baf('0x35')],_0x1713c8[_0x4baf('0x36')]),_0x443b1a);if(_0x245ed4[_0x4baf('0x35')][_0x4baf('0x3e')]){_0x2288ff[_0x4baf('0x3f')]=_[_0x4baf('0x40')](_0x2288ff[_0x4baf('0x3f')],{'$or':_[_0x4baf('0x2f')](_0x443b1a,function(_0xcd5cf8){if(_0xcd5cf8['type']!==_0x4baf('0x41')){var _0x43fda6={};_0x43fda6[_0xcd5cf8[_0x4baf('0x2c')]]={'$like':'%'+_0x245ed4[_0x4baf('0x35')][_0x4baf('0x3e')]+'%'};return _0x43fda6;}})});}_0x2288ff=_[_0x4baf('0x40')]({},_0x2288ff,_0x245ed4[_0x4baf('0x42')]);var _0x5147b4={'where':_0x2288ff[_0x4baf('0x3f')]};return db[_0x4baf('0x30')][_0x4baf('0x22')](_0x5147b4)['then'](function(_0xfce2bb){_0x57c17d[_0x4baf('0x22')]=_0xfce2bb;if(_0x245ed4[_0x4baf('0x35')][_0x4baf('0x43')]){_0x2288ff[_0x4baf('0x44')]=[{'all':!![]}];}return db[_0x4baf('0x30')]['findAll'](_0x2288ff);})[_0x4baf('0x45')](function(_0x1c34e0){_0x57c17d['rows']=_0x1c34e0;return _0x57c17d;})[_0x4baf('0x45')](respondWithFilteredResult(_0x1e76a1,_0x2288ff))[_0x4baf('0x46')](handleError(_0x1e76a1,null));};exports[_0x4baf('0x47')]=function(_0x270e6e,_0x421f72){var _0x13e77a={'raw':![],'where':{'id':_0x270e6e['params']['id']}},_0x57bc57={};_0x57bc57[_0x4baf('0x33')]=_[_0x4baf('0x34')](db[_0x4baf('0x30')]['rawAttributes']);_0x57bc57['query']=_[_0x4baf('0x34')](_0x270e6e[_0x4baf('0x35')]);_0x57bc57[_0x4baf('0x36')]=_[_0x4baf('0x37')](_0x57bc57[_0x4baf('0x33')],_0x57bc57['query']);_0x13e77a[_0x4baf('0x38')]=_['intersection'](_0x57bc57[_0x4baf('0x33')],qs[_0x4baf('0x48')](_0x270e6e[_0x4baf('0x35')][_0x4baf('0x48')]));_0x13e77a['attributes']=_0x13e77a[_0x4baf('0x38')][_0x4baf('0x39')]?_0x13e77a[_0x4baf('0x38')]:_0x57bc57[_0x4baf('0x33')];if(_0x270e6e[_0x4baf('0x35')][_0x4baf('0x43')]){_0x13e77a[_0x4baf('0x44')]=[{'all':!![]}];}_0x13e77a=_[_0x4baf('0x40')]({},_0x13e77a,_0x270e6e[_0x4baf('0x42')]);return db[_0x4baf('0x30')][_0x4baf('0x49')](_0x13e77a)[_0x4baf('0x45')](handleEntityNotFound(_0x421f72,null))['then'](respondWithResult(_0x421f72,null))[_0x4baf('0x46')](handleError(_0x421f72,null));};exports['create']=function(_0x4096c3,_0x4b129b){return db[_0x4baf('0x30')][_0x4baf('0x4a')](_0x4096c3['body'],{})[_0x4baf('0x45')](respondWithResult(_0x4b129b,0xc9))[_0x4baf('0x46')](handleError(_0x4b129b,null));};exports[_0x4baf('0x28')]=function(_0x1c7224,_0x340bdf){if(_0x1c7224[_0x4baf('0x4b')]['id']){delete _0x1c7224[_0x4baf('0x4b')]['id'];}return db[_0x4baf('0x30')][_0x4baf('0x49')]({'where':{'id':_0x1c7224[_0x4baf('0x4c')]['id']}})['then'](handleEntityNotFound(_0x340bdf,null))[_0x4baf('0x45')](saveUpdates(_0x1c7224[_0x4baf('0x4b')],null))[_0x4baf('0x45')](respondWithResult(_0x340bdf,null))[_0x4baf('0x46')](handleError(_0x340bdf,null));};exports[_0x4baf('0x29')]=function(_0x1ecebf,_0x232810){return db[_0x4baf('0x30')][_0x4baf('0x49')]({'where':{'id':_0x1ecebf[_0x4baf('0x4c')]['id']}})['then'](handleEntityNotFound(_0x232810,null))['then'](removeEntity(_0x232810,null))['catch'](handleError(_0x232810,null));};exports[_0x4baf('0x4d')]=function(_0x39a906,_0x325d5c){return db[_0x4baf('0x30')][_0x4baf('0x4d')]()['then'](respondWithResult(_0x325d5c,null))[_0x4baf('0x46')](handleError(_0x325d5c,null));}; \ No newline at end of file +var _0x330b=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','name','index','map','IntegrationReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','params','describe','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x19745e,_0x3d468d){var _0x28e2c2=function(_0x947367){while(--_0x947367){_0x19745e['push'](_0x19745e['shift']());}};_0x28e2c2(++_0x3d468d);}(_0x330b,0x81));var _0xb330=function(_0xf2d1bf,_0x19c53a){_0xf2d1bf=_0xf2d1bf-0x0;var _0x388d2c=_0x330b[_0xf2d1bf];return _0x388d2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb330('0x0'));var zipdir=require(_0xb330('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb330('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb330('0x3'));var util=require(_0xb330('0x4'));var path=require(_0xb330('0x5'));var sox=require(_0xb330('0x6'));var csv=require('to-csv');var ejs=require(_0xb330('0x7'));var fs=require('fs');var fs_extra=require(_0xb330('0x8'));var _=require(_0xb330('0x9'));var squel=require('squel');var crypto=require(_0xb330('0xa'));var jsforce=require(_0xb330('0xb'));var deskjs=require(_0xb330('0xc'));var toCsv=require(_0xb330('0xd'));var querystring=require(_0xb330('0xe'));var Papa=require(_0xb330('0xf'));var Redis=require(_0xb330('0x10'));var authService=require(_0xb330('0x11'));var qs=require(_0xb330('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb330('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb330('0x14'))['db'];function respondWithStatusCode(_0x5316df,_0xbd5a1a){_0xbd5a1a=_0xbd5a1a||0xcc;return function(_0x22ae9b){if(_0x22ae9b){return _0x5316df[_0xb330('0x15')](_0xbd5a1a);}return _0x5316df['status'](_0xbd5a1a)[_0xb330('0x16')]();};}function respondWithResult(_0x1de312,_0x825f81){_0x825f81=_0x825f81||0xc8;return function(_0x4ec08c){if(_0x4ec08c){return _0x1de312[_0xb330('0x17')](_0x825f81)[_0xb330('0x18')](_0x4ec08c);}};}function respondWithFilteredResult(_0x4ccbf5,_0x26c759){return function(_0x429ea1){if(_0x429ea1){var _0x3727df=typeof _0x26c759[_0xb330('0x19')]===_0xb330('0x1a')&&typeof _0x26c759[_0xb330('0x1b')]===_0xb330('0x1a');var _0x22e2c2=_0x429ea1[_0xb330('0x1c')];var _0x25ce96=_0x3727df?0x0:_0x26c759[_0xb330('0x19')];var _0x2112c6=_0x3727df?_0x429ea1[_0xb330('0x1c')]:_0x26c759[_0xb330('0x19')]+_0x26c759['limit'];var _0x628225;if(_0x2112c6>=_0x22e2c2){_0x2112c6=_0x22e2c2;_0x628225=0xc8;}else{_0x628225=0xce;}_0x4ccbf5[_0xb330('0x17')](_0x628225);return _0x4ccbf5[_0xb330('0x1d')](_0xb330('0x1e'),_0x25ce96+'-'+_0x2112c6+'/'+_0x22e2c2)[_0xb330('0x18')](_0x429ea1);}return null;};}function patchUpdates(_0x495964){return function(_0x25d2bd){try{jsonpatch[_0xb330('0x1f')](_0x25d2bd,_0x495964,!![]);}catch(_0x499e62){return BPromise['reject'](_0x499e62);}return _0x25d2bd['save']();};}function saveUpdates(_0x50c9f2,_0x502973){return function(_0x45587f){if(_0x45587f){return _0x45587f[_0xb330('0x20')](_0x50c9f2)[_0xb330('0x21')](function(_0x4dec6b){return _0x4dec6b;});}return null;};}function removeEntity(_0x211958,_0x328dfe){return function(_0x726c1a){if(_0x726c1a){return _0x726c1a[_0xb330('0x22')]()['then'](function(){_0x211958[_0xb330('0x17')](0xcc)[_0xb330('0x16')]();});}};}function handleEntityNotFound(_0x3c1992,_0x35fbe5){return function(_0x5f51f6){if(!_0x5f51f6){_0x3c1992[_0xb330('0x15')](0x194);}return _0x5f51f6;};}function handleError(_0x5364bb,_0x53bcd8){_0x53bcd8=_0x53bcd8||0x1f4;return function(_0x2f78ec){logger['error'](_0x2f78ec['stack']);if(_0x2f78ec[_0xb330('0x23')]){delete _0x2f78ec[_0xb330('0x23')];}_0x5364bb[_0xb330('0x17')](_0x53bcd8)['send'](_0x2f78ec);};}exports[_0xb330('0x24')]=function(_0x46c250,_0x33af76){var _0x43f9e7={},_0x428f65={},_0x590218={'count':0x0,'rows':[]};var _0x1aa1f=_[_0xb330('0x25')](db[_0xb330('0x26')][_0xb330('0x27')],function(_0x204304){return{'name':_0x204304[_0xb330('0x28')],'type':_0x204304['type'][_0xb330('0x29')]};});_0x428f65['model']=_['map'](_0x1aa1f,_0xb330('0x23'));_0x428f65['query']=_[_0xb330('0x2a')](_0x46c250[_0xb330('0x2b')]);_0x428f65[_0xb330('0x2c')]=_[_0xb330('0x2d')](_0x428f65[_0xb330('0x2e')],_0x428f65[_0xb330('0x2b')]);_0x43f9e7['attributes']=_['intersection'](_0x428f65[_0xb330('0x2e')],qs['fields'](_0x46c250[_0xb330('0x2b')][_0xb330('0x2f')]));_0x43f9e7['attributes']=_0x43f9e7['attributes'][_0xb330('0x30')]?_0x43f9e7[_0xb330('0x31')]:_0x428f65[_0xb330('0x2e')];if(!_0x46c250[_0xb330('0x2b')][_0xb330('0x32')](_0xb330('0x33'))){_0x43f9e7[_0xb330('0x1b')]=qs['limit'](_0x46c250[_0xb330('0x2b')][_0xb330('0x1b')]);_0x43f9e7[_0xb330('0x19')]=qs[_0xb330('0x19')](_0x46c250[_0xb330('0x2b')][_0xb330('0x19')]);}_0x43f9e7[_0xb330('0x34')]=qs[_0xb330('0x35')](_0x46c250[_0xb330('0x2b')][_0xb330('0x35')]);_0x43f9e7[_0xb330('0x36')]=qs[_0xb330('0x2c')](_[_0xb330('0x37')](_0x46c250[_0xb330('0x2b')],_0x428f65[_0xb330('0x2c')]),_0x1aa1f);if(_0x46c250['query'][_0xb330('0x38')]){_0x43f9e7[_0xb330('0x36')]=_[_0xb330('0x39')](_0x43f9e7[_0xb330('0x36')],{'$or':_[_0xb330('0x25')](_0x1aa1f,function(_0x5c4346){if(_0x5c4346[_0xb330('0x3a')]!==_0xb330('0x3b')){var _0x591266={};_0x591266[_0x5c4346[_0xb330('0x23')]]={'$like':'%'+_0x46c250[_0xb330('0x2b')][_0xb330('0x38')]+'%'};return _0x591266;}})});}_0x43f9e7=_[_0xb330('0x39')]({},_0x43f9e7,_0x46c250['options']);var _0x19dace={'where':_0x43f9e7[_0xb330('0x36')]};return db[_0xb330('0x26')][_0xb330('0x1c')](_0x19dace)['then'](function(_0x47943e){_0x590218['count']=_0x47943e;if(_0x46c250['query'][_0xb330('0x3c')]){_0x43f9e7[_0xb330('0x3d')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x43f9e7);})[_0xb330('0x21')](function(_0x4551e1){_0x590218[_0xb330('0x3e')]=_0x4551e1;return _0x590218;})['then'](respondWithFilteredResult(_0x33af76,_0x43f9e7))[_0xb330('0x3f')](handleError(_0x33af76,null));};exports[_0xb330('0x40')]=function(_0xc6d76c,_0x645e97){var _0x3fab7d={'raw':![],'where':{'id':_0xc6d76c['params']['id']}},_0x11ee9a={};_0x11ee9a['model']=_[_0xb330('0x2a')](db[_0xb330('0x26')][_0xb330('0x27')]);_0x11ee9a[_0xb330('0x2b')]=_['keys'](_0xc6d76c['query']);_0x11ee9a[_0xb330('0x2c')]=_['intersection'](_0x11ee9a[_0xb330('0x2e')],_0x11ee9a[_0xb330('0x2b')]);_0x3fab7d[_0xb330('0x31')]=_[_0xb330('0x2d')](_0x11ee9a[_0xb330('0x2e')],qs[_0xb330('0x2f')](_0xc6d76c[_0xb330('0x2b')][_0xb330('0x2f')]));_0x3fab7d[_0xb330('0x31')]=_0x3fab7d[_0xb330('0x31')][_0xb330('0x30')]?_0x3fab7d[_0xb330('0x31')]:_0x11ee9a[_0xb330('0x2e')];if(_0xc6d76c[_0xb330('0x2b')]['includeAll']){_0x3fab7d[_0xb330('0x3d')]=[{'all':!![]}];}_0x3fab7d=_['merge']({},_0x3fab7d,_0xc6d76c[_0xb330('0x41')]);return db[_0xb330('0x26')][_0xb330('0x42')](_0x3fab7d)[_0xb330('0x21')](handleEntityNotFound(_0x645e97,null))[_0xb330('0x21')](respondWithResult(_0x645e97,null))[_0xb330('0x3f')](handleError(_0x645e97,null));};exports[_0xb330('0x43')]=function(_0x46f302,_0x5cb53f){return db[_0xb330('0x26')][_0xb330('0x43')](_0x46f302['body'],{})['then'](respondWithResult(_0x5cb53f,0xc9))[_0xb330('0x3f')](handleError(_0x5cb53f,null));};exports[_0xb330('0x20')]=function(_0x35d906,_0x321ee5){if(_0x35d906['body']['id']){delete _0x35d906[_0xb330('0x44')]['id'];}return db[_0xb330('0x26')][_0xb330('0x42')]({'where':{'id':_0x35d906[_0xb330('0x45')]['id']}})[_0xb330('0x21')](handleEntityNotFound(_0x321ee5,null))[_0xb330('0x21')](saveUpdates(_0x35d906[_0xb330('0x44')],null))[_0xb330('0x21')](respondWithResult(_0x321ee5,null))[_0xb330('0x3f')](handleError(_0x321ee5,null));};exports[_0xb330('0x22')]=function(_0x4c3d3a,_0xdd9b43){return db['IntegrationReport'][_0xb330('0x42')]({'where':{'id':_0x4c3d3a[_0xb330('0x45')]['id']}})['then'](handleEntityNotFound(_0xdd9b43,null))['then'](removeEntity(_0xdd9b43,null))[_0xb330('0x3f')](handleError(_0xdd9b43,null));};exports[_0xb330('0x46')]=function(_0xaffb44,_0x4758a4){return db[_0xb330('0x26')][_0xb330('0x46')]()['then'](respondWithResult(_0x4758a4,null))[_0xb330('0x3f')](handleError(_0x4758a4,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 9251367..ec9a454 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 _0xb23b=['./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1780e6,_0x4da461){var _0x5dadb1=function(_0x19c427){while(--_0x19c427){_0x1780e6['push'](_0x1780e6['shift']());}};_0x5dadb1(++_0x4da461);}(_0xb23b,0x1b4));var _0xbb23=function(_0xf97eb0,_0x1578b7){_0xf97eb0=_0xf97eb0-0x0;var _0xea70f4=_0xb23b[_0xf97eb0];return _0xea70f4;};'use strict';var _=require(_0xbb23('0x0'));var util=require('util');var logger=require(_0xbb23('0x1'))(_0xbb23('0x2'));var moment=require(_0xbb23('0x3'));var BPromise=require(_0xbb23('0x4'));var rp=require(_0xbb23('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb23('0x6'));var config=require(_0xbb23('0x7'));var attributes=require(_0xbb23('0x8'));module['exports']=function(_0x1d9b55,_0x15e7d5){return _0x1d9b55[_0xbb23('0x9')](_0xbb23('0xa'),attributes,{'tableName':_0xbb23('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9a3=['util','../../config/logger','api','bluebird','request-promise','path','exports','define','lodash'];(function(_0x4e3ee6,_0x1cac16){var _0x3a1887=function(_0x1d4b44){while(--_0x1d4b44){_0x4e3ee6['push'](_0x4e3ee6['shift']());}};_0x3a1887(++_0x1cac16);}(_0xf9a3,0x1e5));var _0x3f9a=function(_0x23fd7b,_0x414482){_0x23fd7b=_0x23fd7b-0x0;var _0x3d439d=_0xf9a3[_0x23fd7b];return _0x3d439d;};'use strict';var _=require(_0x3f9a('0x0'));var util=require(_0x3f9a('0x1'));var logger=require(_0x3f9a('0x2'))(_0x3f9a('0x3'));var moment=require('moment');var BPromise=require(_0x3f9a('0x4'));var rp=require(_0x3f9a('0x5'));var fs=require('fs');var path=require(_0x3f9a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x3f9a('0x7')]=function(_0x3166fc,_0x3bb18c){return _0x3166fc[_0x3f9a('0x8')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 458f388..624f2e8 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x53ec,0x192));var _0xc53e=function(_0x3f7101,_0x3af08b){_0x3f7101=_0x3f7101-0x0;var _0x1a30a0=_0x53ec[_0x3f7101];return _0x1a30a0;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x1baef8,_0x5f256c){var _0x9eb2eb=function(_0x4a0d4d){while(--_0x4a0d4d){_0x1baef8['push'](_0x1baef8['shift']());}};_0x9eb2eb(++_0x5f256c);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index e010a0b..7321d04 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 _0xeac1=['../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x5c04bc,_0x355148){var _0x49f5d2=function(_0x569898){while(--_0x569898){_0x5c04bc['push'](_0x5c04bc['shift']());}};_0x49f5d2(++_0x355148);}(_0xeac1,0x146));var _0x1eac=function(_0x149206,_0xe1f4e1){_0x149206=_0x149206-0x0;var _0x46f46c=_0xeac1[_0x149206];return _0x46f46c;};'use strict';var multer=require('multer');var util=require(_0x1eac('0x0'));var path=require(_0x1eac('0x1'));var timeout=require(_0x1eac('0x2'));var express=require('express');var router=express[_0x1eac('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1eac('0x4'));var config=require(_0x1eac('0x5'));var controller=require(_0x1eac('0x6'));router[_0x1eac('0x7')]('/',auth[_0x1eac('0x8')](),controller[_0x1eac('0x9')]);router[_0x1eac('0x7')](_0x1eac('0xa'),auth[_0x1eac('0x8')](),controller['show']);router[_0x1eac('0x7')]('/:id/sub_intervals',auth[_0x1eac('0x8')](),controller[_0x1eac('0xb')]);router[_0x1eac('0xc')]('/',auth[_0x1eac('0x8')](),controller[_0x1eac('0xd')]);router[_0x1eac('0xc')](_0x1eac('0xe'),auth[_0x1eac('0x8')](),controller[_0x1eac('0xf')]);router[_0x1eac('0xc')](_0x1eac('0x10'),auth[_0x1eac('0x8')](),controller['addIntervals']);router[_0x1eac('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1eac('0x12')]);router[_0x1eac('0x13')](_0x1eac('0xa'),auth[_0x1eac('0x8')](),controller[_0x1eac('0x14')]);module[_0x1eac('0x15')]=router; \ No newline at end of file +var _0xdedc=['create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','index','isAuthenticated','/:id/sub_intervals','post'];(function(_0xdf3126,_0x2b9835){var _0x45d4b5=function(_0x24e108){while(--_0x24e108){_0xdf3126['push'](_0xdf3126['shift']());}};_0x45d4b5(++_0x2b9835);}(_0xdedc,0xb8));var _0xcded=function(_0x4dd15b,_0x1d880a){_0x4dd15b=_0x4dd15b-0x0;var _0x2445f2=_0xdedc[_0x4dd15b];return _0x2445f2;};'use strict';var multer=require(_0xcded('0x0'));var util=require(_0xcded('0x1'));var path=require(_0xcded('0x2'));var timeout=require(_0xcded('0x3'));var express=require(_0xcded('0x4'));var router=express['Router']();var fs_extra=require(_0xcded('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcded('0x6'));var config=require(_0xcded('0x7'));var controller=require(_0xcded('0x8'));router[_0xcded('0x9')]('/',auth['isAuthenticated'](),controller[_0xcded('0xa')]);router[_0xcded('0x9')]('/:id',auth[_0xcded('0xb')](),controller['show']);router['get'](_0xcded('0xc'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xcded('0xd')]('/',auth[_0xcded('0xb')](),controller[_0xcded('0xe')]);router['post'](_0xcded('0xc'),auth[_0xcded('0xb')](),controller[_0xcded('0xf')]);router[_0xcded('0xd')](_0xcded('0x10'),auth['isAuthenticated'](),controller[_0xcded('0x11')]);router[_0xcded('0x12')](_0xcded('0x13'),auth[_0xcded('0xb')](),controller['update']);router[_0xcded('0x14')](_0xcded('0x13'),auth[_0xcded('0xb')](),controller['destroy']);module[_0xcded('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index a11790e..b73fe90 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 _0xcc97=['exports','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcc97,0x186));var _0x7cc9=function(_0x530083,_0x537dc8){_0x530083=_0x530083-0x0;var _0x22c236=_0xcc97[_0x530083];return _0x22c236;};'use strict';var Sequelize=require('sequelize');module[_0x7cc9('0x0')]={'name':{'type':Sequelize[_0x7cc9('0x1')]},'description':{'type':Sequelize[_0x7cc9('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xcf72=['exports','STRING'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xcf72,0x92));var _0x2cf7=function(_0xc89257,_0x5a5801){_0xc89257=_0xc89257-0x0;var _0x164ae3=_0xcf72[_0xc89257];return _0x164ae3;};'use strict';var Sequelize=require('sequelize');module[_0x2cf7('0x0')]={'name':{'type':Sequelize[_0x2cf7('0x1')]},'description':{'type':Sequelize[_0x2cf7('0x1')]},'interval':{'type':Sequelize[_0x2cf7('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 27ffda6..9c116ea 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 _0x9131=['attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Interval','findAll','rows','catch','params','fields','find','create','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','getIntervals','hasOwnProperty','addIntervals','findOne','sequelize','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x9131,0x133));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1913('0x0'));var rimraf=require(_0x1913('0x1'));var zipdir=require(_0x1913('0x2'));var jsonpatch=require(_0x1913('0x3'));var rp=require(_0x1913('0x4'));var moment=require('moment');var BPromise=require(_0x1913('0x5'));var Mustache=require(_0x1913('0x6'));var util=require(_0x1913('0x7'));var path=require(_0x1913('0x8'));var sox=require(_0x1913('0x9'));var csv=require(_0x1913('0xa'));var ejs=require(_0x1913('0xb'));var fs=require('fs');var fs_extra=require(_0x1913('0xc'));var _=require(_0x1913('0xd'));var squel=require(_0x1913('0xe'));var crypto=require(_0x1913('0xf'));var jsforce=require(_0x1913('0x10'));var deskjs=require(_0x1913('0x11'));var toCsv=require(_0x1913('0xa'));var querystring=require(_0x1913('0x12'));var Papa=require(_0x1913('0x13'));var Redis=require(_0x1913('0x14'));var authService=require(_0x1913('0x15'));var qs=require(_0x1913('0x16'));var as=require(_0x1913('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1913('0x18'))(_0x1913('0x19'));var utils=require(_0x1913('0x1a'));var config=require(_0x1913('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x1913('0x1c'))['db'];var extensions=require(_0x1913('0x1d'));function respondWithStatusCode(_0x57da64,_0x2d8159){_0x2d8159=_0x2d8159||0xcc;return function(_0x1ff68d){if(_0x1ff68d){return _0x57da64[_0x1913('0x1e')](_0x2d8159);}return _0x57da64[_0x1913('0x1f')](_0x2d8159)['end']();};}function respondWithResult(_0x4e9728,_0x1daa43){_0x1daa43=_0x1daa43||0xc8;return function(_0x423000){if(_0x423000){return _0x4e9728[_0x1913('0x1f')](_0x1daa43)['json'](_0x423000);}};}function respondWithFilteredResult(_0x394d61,_0x3be623){return function(_0x2c024b){if(_0x2c024b){var _0x1eed96=typeof _0x3be623[_0x1913('0x20')]==='undefined'&&typeof _0x3be623[_0x1913('0x21')]==='undefined';var _0x3cd0d6=_0x2c024b[_0x1913('0x22')];var _0x41504a=_0x1eed96?0x0:_0x3be623[_0x1913('0x20')];var _0x1f09af=_0x1eed96?_0x2c024b[_0x1913('0x22')]:_0x3be623[_0x1913('0x20')]+_0x3be623[_0x1913('0x21')];var _0x33b12a;if(_0x1f09af>=_0x3cd0d6){_0x1f09af=_0x3cd0d6;_0x33b12a=0xc8;}else{_0x33b12a=0xce;}_0x394d61[_0x1913('0x1f')](_0x33b12a);return _0x394d61[_0x1913('0x23')](_0x1913('0x24'),_0x41504a+'-'+_0x1f09af+'/'+_0x3cd0d6)['json'](_0x2c024b);}return null;};}function patchUpdates(_0x3533e4){return function(_0x4fceb5){try{jsonpatch[_0x1913('0x25')](_0x4fceb5,_0x3533e4,!![]);}catch(_0x1a2073){return BPromise[_0x1913('0x26')](_0x1a2073);}return _0x4fceb5[_0x1913('0x27')]();};}function saveUpdates(_0x32f917,_0x126a47){return function(_0x21131e){if(_0x21131e){return _0x21131e[_0x1913('0x28')](_0x32f917)[_0x1913('0x29')](function(_0x27c46e){return _0x27c46e;});}return null;};}function removeEntity(_0x1fe4fa,_0x34184f){return function(_0x352906){if(_0x352906){return _0x352906[_0x1913('0x2a')]()['then'](function(){var _0x4f23e7=_0x352906[_0x1913('0x2b')]({'plain':!![]});var _0x1e6873=_0x1913('0x2c');return db[_0x1913('0x2d')][_0x1913('0x2a')]({'where':{'type':_0x1e6873,'resourceId':_0x4f23e7['id']}})['then'](function(){return _0x352906;});})['then'](function(){_0x1fe4fa[_0x1913('0x1f')](0xcc)[_0x1913('0x2e')]();});}};}function handleEntityNotFound(_0x5ed2f5,_0x295af5){return function(_0x537207){if(!_0x537207){_0x5ed2f5[_0x1913('0x1e')](0x194);}return _0x537207;};}function handleError(_0x1039b9,_0x597bc7){_0x597bc7=_0x597bc7||0x1f4;return function(_0x4e240f){logger[_0x1913('0x2f')](_0x4e240f[_0x1913('0x30')]);if(_0x4e240f['name']){delete _0x4e240f[_0x1913('0x31')];}_0x1039b9[_0x1913('0x1f')](_0x597bc7)[_0x1913('0x32')](_0x4e240f);};}exports[_0x1913('0x33')]=function(_0x4eed54,_0x136419){var _0x46e73d={},_0x4b5f72={},_0x3d1bd4={'count':0x0,'rows':[]};var _0x38f449=_[_0x1913('0x34')](db['Interval'][_0x1913('0x35')],function(_0x3a1b53){return{'name':_0x3a1b53[_0x1913('0x36')],'type':_0x3a1b53[_0x1913('0x37')]['key']};});_0x4b5f72['model']=_[_0x1913('0x34')](_0x38f449,_0x1913('0x31'));_0x4b5f72[_0x1913('0x38')]=_[_0x1913('0x39')](_0x4eed54[_0x1913('0x38')]);_0x4b5f72[_0x1913('0x3a')]=_[_0x1913('0x3b')](_0x4b5f72[_0x1913('0x3c')],_0x4b5f72[_0x1913('0x38')]);_0x46e73d['attributes']=_[_0x1913('0x3b')](_0x4b5f72['model'],qs['fields'](_0x4eed54[_0x1913('0x38')]['fields']));_0x46e73d[_0x1913('0x3d')]=_0x46e73d[_0x1913('0x3d')][_0x1913('0x3e')]?_0x46e73d['attributes']:_0x4b5f72[_0x1913('0x3c')];if(!_0x4eed54[_0x1913('0x38')]['hasOwnProperty'](_0x1913('0x3f'))){_0x46e73d[_0x1913('0x21')]=qs[_0x1913('0x21')](_0x4eed54[_0x1913('0x38')][_0x1913('0x21')]);_0x46e73d['offset']=qs[_0x1913('0x20')](_0x4eed54['query'][_0x1913('0x20')]);}_0x46e73d[_0x1913('0x40')]=qs['sort'](_0x4eed54['query'][_0x1913('0x41')]);_0x46e73d[_0x1913('0x42')]=qs[_0x1913('0x3a')](_[_0x1913('0x43')](_0x4eed54[_0x1913('0x38')],_0x4b5f72[_0x1913('0x3a')]),_0x38f449);if(_0x4eed54[_0x1913('0x38')][_0x1913('0x44')]){_0x46e73d[_0x1913('0x42')]=_[_0x1913('0x45')](_0x46e73d[_0x1913('0x42')],{'$or':_[_0x1913('0x34')](_0x38f449,function(_0x2b1907){if(_0x2b1907[_0x1913('0x37')]!==_0x1913('0x46')){var _0x528c81={};_0x528c81[_0x2b1907[_0x1913('0x31')]]={'$like':'%'+_0x4eed54[_0x1913('0x38')][_0x1913('0x44')]+'%'};return _0x528c81;}})});}_0x46e73d=_[_0x1913('0x45')]({},_0x46e73d,_0x4eed54[_0x1913('0x47')]);var _0x3d4fa4={'where':_0x46e73d[_0x1913('0x42')]};return db['Interval']['count'](_0x3d4fa4)[_0x1913('0x29')](function(_0x3049f6){_0x3d1bd4[_0x1913('0x22')]=_0x3049f6;if(_0x4eed54[_0x1913('0x38')][_0x1913('0x48')]){_0x46e73d[_0x1913('0x49')]=[{'all':!![]}];}return db[_0x1913('0x4a')][_0x1913('0x4b')](_0x46e73d);})[_0x1913('0x29')](function(_0x40dc1f){_0x3d1bd4[_0x1913('0x4c')]=_0x40dc1f;return _0x3d1bd4;})[_0x1913('0x29')](respondWithFilteredResult(_0x136419,_0x46e73d))[_0x1913('0x4d')](handleError(_0x136419,null));};exports['show']=function(_0x1dcf97,_0x3ad46d){var _0x22ada8={'raw':!![],'where':{'id':_0x1dcf97[_0x1913('0x4e')]['id']}},_0x3e0036={};_0x3e0036[_0x1913('0x3c')]=_[_0x1913('0x39')](db[_0x1913('0x4a')]['rawAttributes']);_0x3e0036[_0x1913('0x38')]=_[_0x1913('0x39')](_0x1dcf97[_0x1913('0x38')]);_0x3e0036[_0x1913('0x3a')]=_[_0x1913('0x3b')](_0x3e0036[_0x1913('0x3c')],_0x3e0036[_0x1913('0x38')]);_0x22ada8['attributes']=_['intersection'](_0x3e0036['model'],qs[_0x1913('0x4f')](_0x1dcf97[_0x1913('0x38')][_0x1913('0x4f')]));_0x22ada8[_0x1913('0x3d')]=_0x22ada8[_0x1913('0x3d')][_0x1913('0x3e')]?_0x22ada8[_0x1913('0x3d')]:_0x3e0036['model'];if(_0x1dcf97[_0x1913('0x38')][_0x1913('0x48')]){_0x22ada8['include']=[{'all':!![]}];}_0x22ada8=_['merge']({},_0x22ada8,_0x1dcf97[_0x1913('0x47')]);return db[_0x1913('0x4a')][_0x1913('0x50')](_0x22ada8)[_0x1913('0x29')](handleEntityNotFound(_0x3ad46d,null))[_0x1913('0x29')](respondWithResult(_0x3ad46d,null))[_0x1913('0x4d')](handleError(_0x3ad46d,null));};exports[_0x1913('0x51')]=function(_0x4fe44f,_0x108409){return db[_0x1913('0x4a')]['create'](_0x4fe44f['body'],{})[_0x1913('0x29')](function(_0x4df480){var _0x3318b5=_0x4fe44f['user'][_0x1913('0x2b')]({'plain':!![]});if(!_0x3318b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3318b5[_0x1913('0x52')]===_0x1913('0x53')){var _0x254be2=_0x4df480['get']({'plain':!![]});var _0x28d1d0='Intervals';return db['UserProfileSection'][_0x1913('0x50')]({'where':{'name':_0x28d1d0,'userProfileId':_0x3318b5['userProfileId']},'raw':!![]})[_0x1913('0x29')](function(_0x1270fa){if(_0x1270fa&&_0x1270fa['autoAssociation']===0x0){return db[_0x1913('0x2d')][_0x1913('0x51')]({'name':_0x254be2[_0x1913('0x31')],'resourceId':_0x254be2['id'],'type':_0x1270fa[_0x1913('0x31')],'sectionId':_0x1270fa['id']},{})[_0x1913('0x29')](function(){return _0x4df480;});}else{return _0x4df480;}})[_0x1913('0x4d')](function(_0x26a1be){logger[_0x1913('0x2f')](_0x1913('0x54'),_0x26a1be);throw _0x26a1be;});}return _0x4df480;})[_0x1913('0x29')](respondWithResult(_0x108409,0xc9))['catch'](handleError(_0x108409,null));};exports[_0x1913('0x28')]=function(_0x50dfa2,_0x45a503){if(_0x50dfa2[_0x1913('0x55')]['id']){delete _0x50dfa2[_0x1913('0x55')]['id'];}return db[_0x1913('0x4a')][_0x1913('0x50')]({'where':{'id':_0x50dfa2[_0x1913('0x4e')]['id']}})[_0x1913('0x29')](handleEntityNotFound(_0x45a503,null))[_0x1913('0x29')](saveUpdates(_0x50dfa2[_0x1913('0x55')],null))[_0x1913('0x29')](respondWithResult(_0x45a503,null))[_0x1913('0x4d')](handleError(_0x45a503,null));};exports['destroy']=function(_0x312fc1,_0x561c6b){return db[_0x1913('0x4a')]['find']({'where':{'id':_0x312fc1['params']['id']}})[_0x1913('0x29')](handleEntityNotFound(_0x561c6b,null))[_0x1913('0x29')](removeEntity(_0x561c6b,null))[_0x1913('0x4d')](handleError(_0x561c6b,null));};exports[_0x1913('0x56')]=function(_0x15b078,_0x26ee34,_0x1448f3){if(_0x15b078['body']['id']){delete _0x15b078[_0x1913('0x55')]['id'];}return db[_0x1913('0x4a')][_0x1913('0x50')]({'where':{'id':_0x15b078[_0x1913('0x4e')]['id']}})[_0x1913('0x29')](handleEntityNotFound(_0x26ee34,null))[_0x1913('0x29')](function(_0x4bed86){if(_0x4bed86){_0x15b078[_0x1913('0x55')]['IntervalId']=_0x4bed86['id'];return db[_0x1913('0x4a')][_0x1913('0x51')](_0x15b078[_0x1913('0x55')]);}})[_0x1913('0x29')](respondWithResult(_0x26ee34,null))[_0x1913('0x4d')](handleError(_0x26ee34,null));};exports['getIntervals']=function(_0x170fb7,_0x5c7d94,_0xb698eb){var _0x4c3f6b={};var _0x1982a3={};var _0x57f13e;var _0x33bccd;return db[_0x1913('0x4a')]['findOne']({'where':{'id':_0x170fb7[_0x1913('0x4e')]['id']}})[_0x1913('0x29')](handleEntityNotFound(_0x5c7d94,null))[_0x1913('0x29')](function(_0x48a9e8){if(_0x48a9e8){_0x57f13e=_0x48a9e8;_0x1982a3[_0x1913('0x3c')]=_['keys'](db[_0x1913('0x4a')][_0x1913('0x35')]);_0x1982a3['query']=_[_0x1913('0x39')](_0x170fb7['query']);_0x1982a3[_0x1913('0x3a')]=_[_0x1913('0x3b')](_0x1982a3[_0x1913('0x3c')],_0x1982a3['query']);_0x4c3f6b[_0x1913('0x3d')]=_[_0x1913('0x3b')](_0x1982a3[_0x1913('0x3c')],qs[_0x1913('0x4f')](_0x170fb7[_0x1913('0x38')]['fields']));_0x4c3f6b['attributes']=_0x4c3f6b[_0x1913('0x3d')][_0x1913('0x3e')]?_0x4c3f6b['attributes']:_0x1982a3[_0x1913('0x3c')];_0x4c3f6b[_0x1913('0x40')]=qs[_0x1913('0x41')](_0x170fb7[_0x1913('0x38')][_0x1913('0x41')]);_0x4c3f6b[_0x1913('0x42')]=qs[_0x1913('0x3a')](_[_0x1913('0x43')](_0x170fb7[_0x1913('0x38')],_0x1982a3['filters']));if(_0x170fb7[_0x1913('0x38')][_0x1913('0x44')]){_0x4c3f6b[_0x1913('0x42')]=_[_0x1913('0x45')](_0x4c3f6b[_0x1913('0x42')],{'$or':_[_0x1913('0x34')](_0x4c3f6b['attributes'],function(_0x55a807){var _0x3f6ce4={};_0x3f6ce4[_0x55a807]={'$like':'%'+_0x170fb7['query']['filter']+'%'};return _0x3f6ce4;})});}_0x4c3f6b=_[_0x1913('0x45')]({},_0x4c3f6b,_0x170fb7[_0x1913('0x47')]);return _0x57f13e[_0x1913('0x57')](_0x4c3f6b);}})[_0x1913('0x29')](function(_0x304928){if(_0x304928){_0x33bccd=_0x304928[_0x1913('0x3e')];if(!_0x170fb7['query'][_0x1913('0x58')]('nolimit')){_0x4c3f6b[_0x1913('0x21')]=qs[_0x1913('0x21')](_0x170fb7[_0x1913('0x38')][_0x1913('0x21')]);_0x4c3f6b['offset']=qs['offset'](_0x170fb7[_0x1913('0x38')][_0x1913('0x20')]);}return _0x57f13e['getIntervals'](_0x4c3f6b);}})['then'](function(_0x104b20){if(_0x104b20){return _0x104b20?{'count':_0x33bccd,'rows':_0x104b20}:null;}})[_0x1913('0x29')](respondWithResult(_0x5c7d94,null))[_0x1913('0x4d')](handleError(_0x5c7d94,null));};exports[_0x1913('0x59')]=function(_0x35d555,_0x4828e2,_0x530bf3){return db[_0x1913('0x4a')][_0x1913('0x5a')]({'where':{'id':_0x35d555['params']['id']}})['then'](handleEntityNotFound(_0x4828e2,null))[_0x1913('0x29')](function(_0x3af290){if(_0x3af290){return db[_0x1913('0x5b')]['transaction'](function(_0x1cf19e){return db['Interval']['destroy']({'where':{'IntervalId':_0x35d555['params']['id']},'transaction':_0x1cf19e})[_0x1913('0x29')](function(_0x15fadb){var _0x49419b=_[_0x1913('0x34')](_0x35d555[_0x1913('0x55')],function(_0x4163cc){delete _0x4163cc['id'];_0x4163cc['IntervalId']=_0x35d555['params']['id'];return _0x4163cc;});return db[_0x1913('0x4a')]['bulkCreate'](_0x49419b,{'transaction':_0x1cf19e});});})[_0x1913('0x29')](function(){return db['Interval'][_0x1913('0x4b')]({'where':{'IntervalId':_0x35d555['params']['id']}});});}})[_0x1913('0x29')](respondWithResult(_0x4828e2,null))[_0x1913('0x4d')](handleError(_0x4828e2,null));}; \ No newline at end of file +var _0x6c3e=['rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','end','error','send','index','map','Interval','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','rawAttributes','addIntervals','sequelize','transaction','eml-format'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6c3e,0x1c6));var _0xe6c3=function(_0x345338,_0x1542a3){_0x345338=_0x345338-0x0;var _0x280312=_0x6c3e[_0x345338];return _0x280312;};'use strict';var emlformat=require(_0xe6c3('0x0'));var rimraf=require(_0xe6c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe6c3('0x2'));var rp=require('request-promise');var moment=require(_0xe6c3('0x3'));var BPromise=require(_0xe6c3('0x4'));var Mustache=require('mustache');var util=require(_0xe6c3('0x5'));var path=require(_0xe6c3('0x6'));var sox=require(_0xe6c3('0x7'));var csv=require('to-csv');var ejs=require(_0xe6c3('0x8'));var fs=require('fs');var fs_extra=require(_0xe6c3('0x9'));var _=require(_0xe6c3('0xa'));var squel=require('squel');var crypto=require(_0xe6c3('0xb'));var jsforce=require(_0xe6c3('0xc'));var deskjs=require(_0xe6c3('0xd'));var toCsv=require(_0xe6c3('0xe'));var querystring=require('querystring');var Papa=require(_0xe6c3('0xf'));var Redis=require(_0xe6c3('0x10'));var authService=require(_0xe6c3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe6c3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6c3('0x13'))(_0xe6c3('0x14'));var utils=require(_0xe6c3('0x15'));var config=require(_0xe6c3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6c3('0x17'))['db'];var extensions=require(_0xe6c3('0x18'));function respondWithStatusCode(_0x1e635a,_0x6a3cb3){_0x6a3cb3=_0x6a3cb3||0xcc;return function(_0x9c28c3){if(_0x9c28c3){return _0x1e635a[_0xe6c3('0x19')](_0x6a3cb3);}return _0x1e635a['status'](_0x6a3cb3)['end']();};}function respondWithResult(_0x26589e,_0xfc1cd0){_0xfc1cd0=_0xfc1cd0||0xc8;return function(_0x22d2b0){if(_0x22d2b0){return _0x26589e[_0xe6c3('0x1a')](_0xfc1cd0)[_0xe6c3('0x1b')](_0x22d2b0);}};}function respondWithFilteredResult(_0x33783f,_0x210202){return function(_0x430ab6){if(_0x430ab6){var _0x15dd6f=typeof _0x210202[_0xe6c3('0x1c')]==='undefined'&&typeof _0x210202['limit']===_0xe6c3('0x1d');var _0x13015b=_0x430ab6['count'];var _0x6cb8dd=_0x15dd6f?0x0:_0x210202['offset'];var _0x522b0e=_0x15dd6f?_0x430ab6[_0xe6c3('0x1e')]:_0x210202[_0xe6c3('0x1c')]+_0x210202['limit'];var _0x83d30e;if(_0x522b0e>=_0x13015b){_0x522b0e=_0x13015b;_0x83d30e=0xc8;}else{_0x83d30e=0xce;}_0x33783f[_0xe6c3('0x1a')](_0x83d30e);return _0x33783f[_0xe6c3('0x1f')](_0xe6c3('0x20'),_0x6cb8dd+'-'+_0x522b0e+'/'+_0x13015b)[_0xe6c3('0x1b')](_0x430ab6);}return null;};}function patchUpdates(_0x1fdeb2){return function(_0x1eff35){try{jsonpatch[_0xe6c3('0x21')](_0x1eff35,_0x1fdeb2,!![]);}catch(_0x1d90b1){return BPromise[_0xe6c3('0x22')](_0x1d90b1);}return _0x1eff35[_0xe6c3('0x23')]();};}function saveUpdates(_0x39756a,_0x5976c4){return function(_0x22ca8f){if(_0x22ca8f){return _0x22ca8f[_0xe6c3('0x24')](_0x39756a)[_0xe6c3('0x25')](function(_0x2afdd2){return _0x2afdd2;});}return null;};}function removeEntity(_0x5cb509,_0x538481){return function(_0x396e62){if(_0x396e62){return _0x396e62[_0xe6c3('0x26')]()['then'](function(){var _0x422e08=_0x396e62[_0xe6c3('0x27')]({'plain':!![]});var _0x24c481=_0xe6c3('0x28');return db['UserProfileResource'][_0xe6c3('0x26')]({'where':{'type':_0x24c481,'resourceId':_0x422e08['id']}})[_0xe6c3('0x25')](function(){return _0x396e62;});})[_0xe6c3('0x25')](function(){_0x5cb509['status'](0xcc)[_0xe6c3('0x29')]();});}};}function handleEntityNotFound(_0x5a7e89,_0x541a37){return function(_0x225961){if(!_0x225961){_0x5a7e89['sendStatus'](0x194);}return _0x225961;};}function handleError(_0x3991b6,_0x783c41){_0x783c41=_0x783c41||0x1f4;return function(_0x42ce72){logger[_0xe6c3('0x2a')](_0x42ce72['stack']);if(_0x42ce72['name']){delete _0x42ce72['name'];}_0x3991b6[_0xe6c3('0x1a')](_0x783c41)[_0xe6c3('0x2b')](_0x42ce72);};}exports[_0xe6c3('0x2c')]=function(_0x3df1cb,_0x18a2a4){var _0x58a621={},_0x3affbe={},_0x3e26c1={'count':0x0,'rows':[]};var _0x124604=_[_0xe6c3('0x2d')](db[_0xe6c3('0x2e')]['rawAttributes'],function(_0x1ce4cf){return{'name':_0x1ce4cf['fieldName'],'type':_0x1ce4cf[_0xe6c3('0x2f')][_0xe6c3('0x30')]};});_0x3affbe[_0xe6c3('0x31')]=_[_0xe6c3('0x2d')](_0x124604,_0xe6c3('0x32'));_0x3affbe['query']=_[_0xe6c3('0x33')](_0x3df1cb[_0xe6c3('0x34')]);_0x3affbe[_0xe6c3('0x35')]=_[_0xe6c3('0x36')](_0x3affbe['model'],_0x3affbe[_0xe6c3('0x34')]);_0x58a621[_0xe6c3('0x37')]=_[_0xe6c3('0x36')](_0x3affbe[_0xe6c3('0x31')],qs['fields'](_0x3df1cb[_0xe6c3('0x34')][_0xe6c3('0x38')]));_0x58a621['attributes']=_0x58a621[_0xe6c3('0x37')][_0xe6c3('0x39')]?_0x58a621[_0xe6c3('0x37')]:_0x3affbe[_0xe6c3('0x31')];if(!_0x3df1cb[_0xe6c3('0x34')][_0xe6c3('0x3a')](_0xe6c3('0x3b'))){_0x58a621['limit']=qs[_0xe6c3('0x3c')](_0x3df1cb[_0xe6c3('0x34')]['limit']);_0x58a621[_0xe6c3('0x1c')]=qs[_0xe6c3('0x1c')](_0x3df1cb[_0xe6c3('0x34')][_0xe6c3('0x1c')]);}_0x58a621[_0xe6c3('0x3d')]=qs[_0xe6c3('0x3e')](_0x3df1cb['query'][_0xe6c3('0x3e')]);_0x58a621[_0xe6c3('0x3f')]=qs[_0xe6c3('0x35')](_[_0xe6c3('0x40')](_0x3df1cb[_0xe6c3('0x34')],_0x3affbe['filters']),_0x124604);if(_0x3df1cb[_0xe6c3('0x34')][_0xe6c3('0x41')]){_0x58a621[_0xe6c3('0x3f')]=_['merge'](_0x58a621[_0xe6c3('0x3f')],{'$or':_[_0xe6c3('0x2d')](_0x124604,function(_0x2c9a35){if(_0x2c9a35[_0xe6c3('0x2f')]!==_0xe6c3('0x42')){var _0x10ddd4={};_0x10ddd4[_0x2c9a35[_0xe6c3('0x32')]]={'$like':'%'+_0x3df1cb['query'][_0xe6c3('0x41')]+'%'};return _0x10ddd4;}})});}_0x58a621=_[_0xe6c3('0x43')]({},_0x58a621,_0x3df1cb[_0xe6c3('0x44')]);var _0x4db62f={'where':_0x58a621[_0xe6c3('0x3f')]};return db[_0xe6c3('0x2e')]['count'](_0x4db62f)['then'](function(_0x19e3ad){_0x3e26c1[_0xe6c3('0x1e')]=_0x19e3ad;if(_0x3df1cb[_0xe6c3('0x34')][_0xe6c3('0x45')]){_0x58a621[_0xe6c3('0x46')]=[{'all':!![]}];}return db['Interval'][_0xe6c3('0x47')](_0x58a621);})[_0xe6c3('0x25')](function(_0x42e7fe){_0x3e26c1[_0xe6c3('0x48')]=_0x42e7fe;return _0x3e26c1;})[_0xe6c3('0x25')](respondWithFilteredResult(_0x18a2a4,_0x58a621))[_0xe6c3('0x49')](handleError(_0x18a2a4,null));};exports[_0xe6c3('0x4a')]=function(_0x8038be,_0x47e711){var _0x31eb77={'raw':!![],'where':{'id':_0x8038be[_0xe6c3('0x4b')]['id']}},_0x408e09={};_0x408e09[_0xe6c3('0x31')]=_[_0xe6c3('0x33')](db[_0xe6c3('0x2e')]['rawAttributes']);_0x408e09['query']=_[_0xe6c3('0x33')](_0x8038be[_0xe6c3('0x34')]);_0x408e09[_0xe6c3('0x35')]=_[_0xe6c3('0x36')](_0x408e09[_0xe6c3('0x31')],_0x408e09[_0xe6c3('0x34')]);_0x31eb77[_0xe6c3('0x37')]=_['intersection'](_0x408e09[_0xe6c3('0x31')],qs['fields'](_0x8038be[_0xe6c3('0x34')][_0xe6c3('0x38')]));_0x31eb77['attributes']=_0x31eb77['attributes']['length']?_0x31eb77[_0xe6c3('0x37')]:_0x408e09[_0xe6c3('0x31')];if(_0x8038be[_0xe6c3('0x34')]['includeAll']){_0x31eb77['include']=[{'all':!![]}];}_0x31eb77=_[_0xe6c3('0x43')]({},_0x31eb77,_0x8038be[_0xe6c3('0x44')]);return db[_0xe6c3('0x2e')][_0xe6c3('0x4c')](_0x31eb77)['then'](handleEntityNotFound(_0x47e711,null))[_0xe6c3('0x25')](respondWithResult(_0x47e711,null))[_0xe6c3('0x49')](handleError(_0x47e711,null));};exports[_0xe6c3('0x4d')]=function(_0x396906,_0xe5a557){return db[_0xe6c3('0x2e')][_0xe6c3('0x4d')](_0x396906[_0xe6c3('0x4e')],{})[_0xe6c3('0x25')](function(_0x5aad18){var _0x3f3a8f=_0x396906['user'][_0xe6c3('0x27')]({'plain':!![]});if(!_0x3f3a8f)throw new Error(_0xe6c3('0x4f'));if(_0x3f3a8f[_0xe6c3('0x50')]==='user'){var _0x1f393b=_0x5aad18[_0xe6c3('0x27')]({'plain':!![]});var _0x923583=_0xe6c3('0x28');return db[_0xe6c3('0x51')][_0xe6c3('0x4c')]({'where':{'name':_0x923583,'userProfileId':_0x3f3a8f[_0xe6c3('0x52')]},'raw':!![]})[_0xe6c3('0x25')](function(_0x2cbac8){if(_0x2cbac8&&_0x2cbac8['autoAssociation']===0x0){return db['UserProfileResource'][_0xe6c3('0x4d')]({'name':_0x1f393b[_0xe6c3('0x32')],'resourceId':_0x1f393b['id'],'type':_0x2cbac8[_0xe6c3('0x32')],'sectionId':_0x2cbac8['id']},{})['then'](function(){return _0x5aad18;});}else{return _0x5aad18;}})[_0xe6c3('0x49')](function(_0x5d92e2){logger['error'](_0xe6c3('0x53'),_0x5d92e2);throw _0x5d92e2;});}return _0x5aad18;})[_0xe6c3('0x25')](respondWithResult(_0xe5a557,0xc9))[_0xe6c3('0x49')](handleError(_0xe5a557,null));};exports['update']=function(_0x165ad5,_0x93c655){if(_0x165ad5[_0xe6c3('0x4e')]['id']){delete _0x165ad5['body']['id'];}return db[_0xe6c3('0x2e')][_0xe6c3('0x4c')]({'where':{'id':_0x165ad5[_0xe6c3('0x4b')]['id']}})[_0xe6c3('0x25')](handleEntityNotFound(_0x93c655,null))[_0xe6c3('0x25')](saveUpdates(_0x165ad5[_0xe6c3('0x4e')],null))[_0xe6c3('0x25')](respondWithResult(_0x93c655,null))[_0xe6c3('0x49')](handleError(_0x93c655,null));};exports[_0xe6c3('0x26')]=function(_0x4152dc,_0x3ad262){return db[_0xe6c3('0x2e')][_0xe6c3('0x4c')]({'where':{'id':_0x4152dc[_0xe6c3('0x4b')]['id']}})[_0xe6c3('0x25')](handleEntityNotFound(_0x3ad262,null))[_0xe6c3('0x25')](removeEntity(_0x3ad262,null))[_0xe6c3('0x49')](handleError(_0x3ad262,null));};exports[_0xe6c3('0x54')]=function(_0x1b60f0,_0x48a0b9,_0x3390b6){if(_0x1b60f0[_0xe6c3('0x4e')]['id']){delete _0x1b60f0[_0xe6c3('0x4e')]['id'];}return db[_0xe6c3('0x2e')][_0xe6c3('0x4c')]({'where':{'id':_0x1b60f0[_0xe6c3('0x4b')]['id']}})[_0xe6c3('0x25')](handleEntityNotFound(_0x48a0b9,null))[_0xe6c3('0x25')](function(_0x6f6856){if(_0x6f6856){_0x1b60f0['body'][_0xe6c3('0x55')]=_0x6f6856['id'];return db['Interval'][_0xe6c3('0x4d')](_0x1b60f0[_0xe6c3('0x4e')]);}})['then'](respondWithResult(_0x48a0b9,null))[_0xe6c3('0x49')](handleError(_0x48a0b9,null));};exports[_0xe6c3('0x56')]=function(_0x1d77de,_0x14b20b,_0x3f3ff2){var _0x4e2983={};var _0x58433c={};var _0x413f9b;var _0x23731f;return db[_0xe6c3('0x2e')]['findOne']({'where':{'id':_0x1d77de[_0xe6c3('0x4b')]['id']}})[_0xe6c3('0x25')](handleEntityNotFound(_0x14b20b,null))[_0xe6c3('0x25')](function(_0x2fb4f5){if(_0x2fb4f5){_0x413f9b=_0x2fb4f5;_0x58433c['model']=_[_0xe6c3('0x33')](db[_0xe6c3('0x2e')][_0xe6c3('0x57')]);_0x58433c['query']=_[_0xe6c3('0x33')](_0x1d77de[_0xe6c3('0x34')]);_0x58433c[_0xe6c3('0x35')]=_[_0xe6c3('0x36')](_0x58433c[_0xe6c3('0x31')],_0x58433c['query']);_0x4e2983[_0xe6c3('0x37')]=_[_0xe6c3('0x36')](_0x58433c[_0xe6c3('0x31')],qs[_0xe6c3('0x38')](_0x1d77de['query'][_0xe6c3('0x38')]));_0x4e2983[_0xe6c3('0x37')]=_0x4e2983[_0xe6c3('0x37')][_0xe6c3('0x39')]?_0x4e2983['attributes']:_0x58433c[_0xe6c3('0x31')];_0x4e2983[_0xe6c3('0x3d')]=qs[_0xe6c3('0x3e')](_0x1d77de[_0xe6c3('0x34')][_0xe6c3('0x3e')]);_0x4e2983[_0xe6c3('0x3f')]=qs[_0xe6c3('0x35')](_[_0xe6c3('0x40')](_0x1d77de[_0xe6c3('0x34')],_0x58433c[_0xe6c3('0x35')]));if(_0x1d77de[_0xe6c3('0x34')]['filter']){_0x4e2983[_0xe6c3('0x3f')]=_[_0xe6c3('0x43')](_0x4e2983['where'],{'$or':_[_0xe6c3('0x2d')](_0x4e2983[_0xe6c3('0x37')],function(_0x19dffb){var _0x2cad41={};_0x2cad41[_0x19dffb]={'$like':'%'+_0x1d77de[_0xe6c3('0x34')]['filter']+'%'};return _0x2cad41;})});}_0x4e2983=_[_0xe6c3('0x43')]({},_0x4e2983,_0x1d77de[_0xe6c3('0x44')]);return _0x413f9b['getIntervals'](_0x4e2983);}})[_0xe6c3('0x25')](function(_0x22f931){if(_0x22f931){_0x23731f=_0x22f931['length'];if(!_0x1d77de[_0xe6c3('0x34')]['hasOwnProperty']('nolimit')){_0x4e2983[_0xe6c3('0x3c')]=qs[_0xe6c3('0x3c')](_0x1d77de[_0xe6c3('0x34')][_0xe6c3('0x3c')]);_0x4e2983[_0xe6c3('0x1c')]=qs[_0xe6c3('0x1c')](_0x1d77de[_0xe6c3('0x34')][_0xe6c3('0x1c')]);}return _0x413f9b[_0xe6c3('0x56')](_0x4e2983);}})[_0xe6c3('0x25')](function(_0x1fc3f3){if(_0x1fc3f3){return _0x1fc3f3?{'count':_0x23731f,'rows':_0x1fc3f3}:null;}})[_0xe6c3('0x25')](respondWithResult(_0x14b20b,null))[_0xe6c3('0x49')](handleError(_0x14b20b,null));};exports[_0xe6c3('0x58')]=function(_0x268796,_0x2eb516,_0x591818){return db[_0xe6c3('0x2e')]['findOne']({'where':{'id':_0x268796[_0xe6c3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2eb516,null))['then'](function(_0x330a20){if(_0x330a20){return db[_0xe6c3('0x59')][_0xe6c3('0x5a')](function(_0x5350b4){return db['Interval'][_0xe6c3('0x26')]({'where':{'IntervalId':_0x268796['params']['id']},'transaction':_0x5350b4})[_0xe6c3('0x25')](function(_0x103505){var _0x1c0b1f=_[_0xe6c3('0x2d')](_0x268796[_0xe6c3('0x4e')],function(_0x41a2aa){delete _0x41a2aa['id'];_0x41a2aa[_0xe6c3('0x55')]=_0x268796[_0xe6c3('0x4b')]['id'];return _0x41a2aa;});return db[_0xe6c3('0x2e')]['bulkCreate'](_0x1c0b1f,{'transaction':_0x5350b4});});})['then'](function(){return db[_0xe6c3('0x2e')][_0xe6c3('0x47')]({'where':{'IntervalId':_0x268796[_0xe6c3('0x4b')]['id']}});});}})['then'](respondWithResult(_0x2eb516,null))[_0xe6c3('0x49')](handleError(_0x2eb516,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 181c92c..4dcc9ef 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 _0xa799=['ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','rewrite','string','getIntervals','then','all'];(function(_0x1f8494,_0x38f6a1){var _0x28c057=function(_0x2dd8db){while(--_0x2dd8db){_0x1f8494['push'](_0x1f8494['shift']());}};_0x28c057(++_0x38f6a1);}(_0xa799,0x1a2));var _0x9a79=function(_0x1139b6,_0x32a3e1){_0x1139b6=_0x1139b6-0x0;var _0x4d1abf=_0xa799[_0x1139b6];return _0x4d1abf;};'use strict';var attributes=require(_0x9a79('0x0'));var extensions=require(_0x9a79('0x1'));var iftime=require(_0x9a79('0x2'))['iftime'];module[_0x9a79('0x3')]=function(_0x91f369){return _0x91f369[_0x9a79('0x4')](_0x9a79('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x17a143){extensions[_0x9a79('0x6')](_0x91f369,_0x17a143);},'afterBulkCreate':function(_0x587a9d,_0x5f4815,_0x35a908){_0x35a908();extensions['rewrite'](_0x91f369,_0x587a9d[0x0]);},'afterUpdate':function(_0xa1c6d4){extensions['rewrite'](_0x91f369,_0xa1c6d4);},'afterDestroy':function(_0x4f68fa){extensions[_0x9a79('0x6')](_0x91f369,_0x4f68fa);}},'instanceMethods':{'ifTime':function(_0x4fd798=undefined,_0x573ea3=new Date()){if(typeof this['interval']===_0x9a79('0x7')){return iftime(this['interval'],_0x4fd798,_0x573ea3);}else{return this[_0x9a79('0x8')]()[_0x9a79('0x9')](function(_0x5be3e1){return Promise[_0x9a79('0xa')](_0x5be3e1['map'](function(_0x3f689c){return _0x3f689c[_0x9a79('0xb')](_0x4fd798,_0x573ea3);}));})[_0x9a79('0x9')](function(_0x524917){return _0x524917[_0x9a79('0xc')](function(_0x1d0abd,_0x2f29ee){return _0x1d0abd||_0x2f29ee;},![]);});}}}});}; \ No newline at end of file +var _0xd8e2=['then','all','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','string','getIntervals'];(function(_0x44753d,_0x5653ca){var _0x5b97b7=function(_0x20b1a5){while(--_0x20b1a5){_0x44753d['push'](_0x44753d['shift']());}};_0x5b97b7(++_0x5653ca);}(_0xd8e2,0x74));var _0x2d8e=function(_0x31f733,_0x1e8d99){_0x31f733=_0x31f733-0x0;var _0x1544d8=_0xd8e2[_0x31f733];return _0x1544d8;};'use strict';var attributes=require(_0x2d8e('0x0'));var extensions=require(_0x2d8e('0x1'));var iftime=require(_0x2d8e('0x2'))[_0x2d8e('0x3')];module[_0x2d8e('0x4')]=function(_0x319b53){return _0x319b53[_0x2d8e('0x5')]('Interval',attributes,{'tableName':_0x2d8e('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4672a2){extensions[_0x2d8e('0x7')](_0x319b53,_0x4672a2);},'afterBulkCreate':function(_0x1f58e8,_0x22e68a,_0xb03db0){_0xb03db0();extensions[_0x2d8e('0x7')](_0x319b53,_0x1f58e8[0x0]);},'afterUpdate':function(_0x1da4c9){extensions[_0x2d8e('0x7')](_0x319b53,_0x1da4c9);},'afterDestroy':function(_0x2ccc06){extensions[_0x2d8e('0x7')](_0x319b53,_0x2ccc06);}},'instanceMethods':{'ifTime':function(_0x26f806=undefined,_0x532ab3=new Date()){if(typeof this['interval']===_0x2d8e('0x8')){return iftime(this['interval'],_0x26f806,_0x532ab3);}else{return this[_0x2d8e('0x9')]()[_0x2d8e('0xa')](function(_0x2992bc){return Promise[_0x2d8e('0xb')](_0x2992bc['map'](function(_0x11c2ca){return _0x11c2ca[_0x2d8e('0xc')](_0x26f806,_0x532ab3);}));})[_0x2d8e('0xa')](function(_0x39972a){return _0x39972a[_0x2d8e('0xd')](function(_0xb73896,_0x235894){return _0xb73896||_0x235894;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 0e33a1b..8c4b033 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 _0x594b=['stringify','catch','message','find','then','ShowInterval','debug','error','Interval','ifTime','reduce','name','join','findById','format','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','findAll','options','raw','where','attributes','limit','include','model','map','info'];(function(_0x191f9d,_0x21976f){var _0x58e60d=function(_0x598c0d){while(--_0x598c0d){_0x191f9d['push'](_0x191f9d['shift']());}};_0x58e60d(++_0x21976f);}(_0x594b,0x147));var _0xb594=function(_0x3bc18f,_0x5ee407){_0x3bc18f=_0x3bc18f-0x0;var _0xc8fb12=_0x594b[_0x3bc18f];return _0xc8fb12;};'use strict';var _=require(_0xb594('0x0'));var util=require(_0xb594('0x1'));var db=require(_0xb594('0x2'))['db'];var iftime=require(_0xb594('0x3'))[_0xb594('0x4')];var logger=require('../../config/logger')(_0xb594('0x5'));exports[_0xb594('0x6')]=function(_0x101993){var _0x10dceb=this;return new Promise(function(_0x42e8b,_0x25532a){return db['Interval'][_0xb594('0x7')]({'raw':_0x101993[_0xb594('0x8')]?_0x101993[_0xb594('0x8')][_0xb594('0x9')]===undefined?!![]:![]:!![],'where':_0x101993[_0xb594('0x8')]?_0x101993[_0xb594('0x8')][_0xb594('0xa')]||null:null,'attributes':_0x101993[_0xb594('0x8')]?_0x101993[_0xb594('0x8')][_0xb594('0xb')]||null:null,'limit':_0x101993[_0xb594('0x8')]?_0x101993[_0xb594('0x8')][_0xb594('0xc')]||null:null,'include':_0x101993[_0xb594('0x8')]?_0x101993[_0xb594('0x8')][_0xb594('0xd')]?_['map'](_0x101993[_0xb594('0x8')][_0xb594('0xd')],function(_0x4d66da){return{'model':db[_0x4d66da[_0xb594('0xe')]],'as':_0x4d66da['as'],'attributes':_0x4d66da['attributes'],'include':_0x4d66da[_0xb594('0xd')]?_[_0xb594('0xf')](_0x4d66da['include'],function(_0x2cbdaa){return{'model':db[_0x2cbdaa[_0xb594('0xe')]],'as':_0x2cbdaa['as'],'attributes':_0x2cbdaa['attributes'],'include':_0x2cbdaa[_0xb594('0xd')]?_[_0xb594('0xf')](_0x2cbdaa[_0xb594('0xd')],function(_0x51058e){return{'model':db[_0x51058e[_0xb594('0xe')]],'as':_0x51058e['as'],'attributes':_0x51058e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5de023){logger[_0xb594('0x10')](_0xb594('0x6'),_0x101993);logger['debug'](_0xb594('0x6'),_0x101993,JSON[_0xb594('0x11')](_0x5de023));_0x42e8b(_0x5de023);})[_0xb594('0x12')](function(_0x3b4718){logger['error'](_0xb594('0x6'),_0x3b4718[_0xb594('0x13')],_0x101993);_0x25532a(_0x10dceb['error'](0x1f4,_0x3b4718[_0xb594('0x13')]));});});};exports['ShowInterval']=function(_0x8e9cb0){var _0x4b0e58=this;return new Promise(function(_0x4407cc,_0x106cd6){return db['Interval'][_0xb594('0x14')]({'raw':_0x8e9cb0[_0xb594('0x8')]?_0x8e9cb0[_0xb594('0x8')][_0xb594('0x9')]===undefined?!![]:![]:!![],'where':_0x8e9cb0[_0xb594('0x8')]?_0x8e9cb0[_0xb594('0x8')][_0xb594('0xa')]||null:null,'attributes':_0x8e9cb0['options']?_0x8e9cb0[_0xb594('0x8')]['attributes']||null:null,'include':_0x8e9cb0['options']?_0x8e9cb0[_0xb594('0x8')][_0xb594('0xd')]?_['map'](_0x8e9cb0['options'][_0xb594('0xd')],function(_0x299d26){return{'model':db[_0x299d26[_0xb594('0xe')]],'as':_0x299d26['as'],'attributes':_0x299d26[_0xb594('0xb')],'include':_0x299d26[_0xb594('0xd')]?_['map'](_0x299d26[_0xb594('0xd')],function(_0x5038ee){return{'model':db[_0x5038ee[_0xb594('0xe')]],'as':_0x5038ee['as'],'attributes':_0x5038ee[_0xb594('0xb')],'include':_0x5038ee['include']?_[_0xb594('0xf')](_0x5038ee['include'],function(_0x28a5e5){return{'model':db[_0x28a5e5[_0xb594('0xe')]],'as':_0x28a5e5['as'],'attributes':_0x28a5e5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb594('0x15')](function(_0x255ba1){logger[_0xb594('0x10')](_0xb594('0x16'),_0x8e9cb0);logger[_0xb594('0x17')](_0xb594('0x16'),_0x8e9cb0,JSON[_0xb594('0x11')](_0x255ba1));_0x4407cc(_0x255ba1);})[_0xb594('0x12')](function(_0x192464){logger['error'](_0xb594('0x16'),_0x192464['message'],_0x8e9cb0);_0x106cd6(_0x4b0e58[_0xb594('0x18')](0x1f4,_0x192464[_0xb594('0x13')]));});});};function checkArrayOfIntervals(_0x3f02d9,_0x239982){var _0x52b51f=[];return db[_0xb594('0x19')][_0xb594('0x7')]({'where':{'id':_0x3f02d9}})[_0xb594('0x15')](function(_0x2a7261){_0x52b51f=_0x2a7261;return Promise['all'](_0x52b51f[_0xb594('0xf')](function(_0x5050a8){return _0x5050a8[_0xb594('0x1a')](_0x239982);}));})[_0xb594('0x15')](function(_0x2dcd1d){var _0x2fdd94=_0x2dcd1d[_0xb594('0x1b')](function(_0x21e234,_0x30b081){return _0x21e234||_0x30b081;},![]);logger[_0xb594('0x10')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x52b51f[_0xb594('0xf')](function(_0x574e91){return _0x574e91[_0xb594('0x1c')];})[_0xb594('0x1d')](',\x20'),_0x52b51f[_0xb594('0xf')](function(_0x14035e){return _0x14035e['id'];})[_0xb594('0x1d')](',\x20')));return _0x2fdd94;});}function checkSingleInterval(_0x1db808,_0x49df12){return db[_0xb594('0x19')][_0xb594('0x1e')](_0x1db808)[_0xb594('0x15')](function(_0x5b168c){if(_0x5b168c){logger[_0xb594('0x10')](util[_0xb594('0x1f')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x5b168c['name'],_0x5b168c['id']));return _0x5b168c[_0xb594('0x1a')](_0x49df12);}});}exports[_0xb594('0x20')]=function(_0xbbbb66){var _0x5a45c2=_0xbbbb66[_0xb594('0x21')];var _0x399770=Array[_0xb594('0x22')](_0xbbbb66[_0xb594('0x23')])?_0xbbbb66['intervals']:typeof _0xbbbb66[_0xb594('0x23')]===_0xb594('0x24')?[_0xbbbb66[_0xb594('0x23')]]:[];var _0x3e2e27=_0xbbbb66[_0xb594('0x25')]||undefined;var _0x488b74=![];if(_0x399770[_0xb594('0x26')]){logger[_0xb594('0x10')](util[_0xb594('0x1f')](_0xb594('0x27'),_0x399770[_0xb594('0x1d')](';\x20')));}if(_0x3e2e27){logger['info'](util[_0xb594('0x1f')](_0xb594('0x28'),_0x3e2e27));}logger['debug'](_0xb594('0x29'),_0x488b74);logger['silly'](_0xb594('0x20'),_0xbbbb66);return Promise[_0xb594('0x2a')]()[_0xb594('0x15')](function(){if(Array[_0xb594('0x22')](_0x5a45c2)){return checkArrayOfIntervals(_0x5a45c2,_0x3e2e27);}else if(_0x5a45c2){return checkSingleInterval(_0x5a45c2,_0x3e2e27);}})[_0xb594('0x15')](function(_0x18b27f){var _0x300ddb=_0x399770[_0xb594('0x1b')](function(_0x1df002,_0x127c95){return _0x1df002||iftime(_0x127c95,_0x3e2e27);},![]);_0x488b74=_0x18b27f||_0x300ddb;return _0x488b74;})[_0xb594('0x12')](function(_0x209e67){logger['error']('IntervalIftime',_0xbbbb66,_0x209e67);throw this[_0xb594('0x18')](0x1f4,_0x209e67['message']);});}; \ No newline at end of file +var _0xc926=['../../mysqldb','iftime','../../config/logger','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','stringify','error','message','Interval','find','debug','ShowInterval','catch','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0xc926,0xae));var _0x6c92=function(_0x227973,_0x29caeb){_0x227973=_0x227973-0x0;var _0x3eab52=_0xc926[_0x227973];return _0x3eab52;};'use strict';var _=require(_0x6c92('0x0'));var util=require(_0x6c92('0x1'));var db=require(_0x6c92('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x6c92('0x3')];var logger=require(_0x6c92('0x4'))('rpc');exports[_0x6c92('0x5')]=function(_0xe06b57){var _0x2f847b=this;return new Promise(function(_0x1f3400,_0x491296){return db['Interval'][_0x6c92('0x6')]({'raw':_0xe06b57[_0x6c92('0x7')]?_0xe06b57[_0x6c92('0x7')][_0x6c92('0x8')]===undefined?!![]:![]:!![],'where':_0xe06b57[_0x6c92('0x7')]?_0xe06b57[_0x6c92('0x7')][_0x6c92('0x9')]||null:null,'attributes':_0xe06b57[_0x6c92('0x7')]?_0xe06b57['options'][_0x6c92('0xa')]||null:null,'limit':_0xe06b57[_0x6c92('0x7')]?_0xe06b57[_0x6c92('0x7')][_0x6c92('0xb')]||null:null,'include':_0xe06b57['options']?_0xe06b57[_0x6c92('0x7')][_0x6c92('0xc')]?_[_0x6c92('0xd')](_0xe06b57[_0x6c92('0x7')]['include'],function(_0x59a78e){return{'model':db[_0x59a78e[_0x6c92('0xe')]],'as':_0x59a78e['as'],'attributes':_0x59a78e[_0x6c92('0xa')],'include':_0x59a78e['include']?_[_0x6c92('0xd')](_0x59a78e[_0x6c92('0xc')],function(_0x1688f6){return{'model':db[_0x1688f6[_0x6c92('0xe')]],'as':_0x1688f6['as'],'attributes':_0x1688f6[_0x6c92('0xa')],'include':_0x1688f6[_0x6c92('0xc')]?_[_0x6c92('0xd')](_0x1688f6[_0x6c92('0xc')],function(_0x7bfe6){return{'model':db[_0x7bfe6['model']],'as':_0x7bfe6['as'],'attributes':_0x7bfe6[_0x6c92('0xa')]};}):[]};}):[]};}):[]:[]})[_0x6c92('0xf')](function(_0x11e511){logger[_0x6c92('0x10')](_0x6c92('0x5'),_0xe06b57);logger['debug'](_0x6c92('0x5'),_0xe06b57,JSON[_0x6c92('0x11')](_0x11e511));_0x1f3400(_0x11e511);})['catch'](function(_0x1d2eb9){logger[_0x6c92('0x12')](_0x6c92('0x5'),_0x1d2eb9[_0x6c92('0x13')],_0xe06b57);_0x491296(_0x2f847b[_0x6c92('0x12')](0x1f4,_0x1d2eb9[_0x6c92('0x13')]));});});};exports['ShowInterval']=function(_0x25aa1b){var _0x5e204c=this;return new Promise(function(_0x2f4f51,_0x7d82a9){return db[_0x6c92('0x14')][_0x6c92('0x15')]({'raw':_0x25aa1b[_0x6c92('0x7')]?_0x25aa1b['options'][_0x6c92('0x8')]===undefined?!![]:![]:!![],'where':_0x25aa1b['options']?_0x25aa1b[_0x6c92('0x7')][_0x6c92('0x9')]||null:null,'attributes':_0x25aa1b[_0x6c92('0x7')]?_0x25aa1b[_0x6c92('0x7')]['attributes']||null:null,'include':_0x25aa1b[_0x6c92('0x7')]?_0x25aa1b[_0x6c92('0x7')][_0x6c92('0xc')]?_['map'](_0x25aa1b[_0x6c92('0x7')][_0x6c92('0xc')],function(_0x1dc9ae){return{'model':db[_0x1dc9ae['model']],'as':_0x1dc9ae['as'],'attributes':_0x1dc9ae[_0x6c92('0xa')],'include':_0x1dc9ae[_0x6c92('0xc')]?_[_0x6c92('0xd')](_0x1dc9ae['include'],function(_0xe9e5b5){return{'model':db[_0xe9e5b5['model']],'as':_0xe9e5b5['as'],'attributes':_0xe9e5b5[_0x6c92('0xa')],'include':_0xe9e5b5[_0x6c92('0xc')]?_[_0x6c92('0xd')](_0xe9e5b5[_0x6c92('0xc')],function(_0x11560c){return{'model':db[_0x11560c[_0x6c92('0xe')]],'as':_0x11560c['as'],'attributes':_0x11560c[_0x6c92('0xa')]};}):[]};}):[]};}):[]:[]})[_0x6c92('0xf')](function(_0x553df1){logger[_0x6c92('0x10')]('ShowInterval',_0x25aa1b);logger[_0x6c92('0x16')](_0x6c92('0x17'),_0x25aa1b,JSON[_0x6c92('0x11')](_0x553df1));_0x2f4f51(_0x553df1);})[_0x6c92('0x18')](function(_0x4a5c31){logger['error'](_0x6c92('0x17'),_0x4a5c31[_0x6c92('0x13')],_0x25aa1b);_0x7d82a9(_0x5e204c[_0x6c92('0x12')](0x1f4,_0x4a5c31[_0x6c92('0x13')]));});});};function checkArrayOfIntervals(_0x54f55f,_0x12f38b){var _0x1ead27=[];return db[_0x6c92('0x14')][_0x6c92('0x6')]({'where':{'id':_0x54f55f}})[_0x6c92('0xf')](function(_0x5cbdf0){_0x1ead27=_0x5cbdf0;return Promise[_0x6c92('0x19')](_0x1ead27[_0x6c92('0xd')](function(_0x2aaec1){return _0x2aaec1[_0x6c92('0x1a')](_0x12f38b);}));})[_0x6c92('0xf')](function(_0x1d2910){var _0x3fdd16=_0x1d2910[_0x6c92('0x1b')](function(_0x17852f,_0x1eac98){return _0x17852f||_0x1eac98;},![]);logger[_0x6c92('0x10')](util[_0x6c92('0x1c')](_0x6c92('0x1d'),_0x1ead27['map'](function(_0x16d1be){return _0x16d1be[_0x6c92('0x1e')];})[_0x6c92('0x1f')](',\x20'),_0x1ead27[_0x6c92('0xd')](function(_0x2a8bb1){return _0x2a8bb1['id'];})[_0x6c92('0x1f')](',\x20')));return _0x3fdd16;});}function checkSingleInterval(_0x3fa385,_0x259551){return db[_0x6c92('0x14')]['findById'](_0x3fa385)[_0x6c92('0xf')](function(_0x59ea98){if(_0x59ea98){logger['info'](util[_0x6c92('0x1c')](_0x6c92('0x20'),_0x59ea98[_0x6c92('0x1e')],_0x59ea98['id']));return _0x59ea98[_0x6c92('0x1a')](_0x259551);}});}exports[_0x6c92('0x21')]=function(_0x39cd14){var _0x12c462=_0x39cd14[_0x6c92('0x22')];var _0x591e16=Array[_0x6c92('0x23')](_0x39cd14[_0x6c92('0x24')])?_0x39cd14['intervals']:typeof _0x39cd14['intervals']===_0x6c92('0x25')?[_0x39cd14[_0x6c92('0x24')]]:[];var _0x865ba6=_0x39cd14['timezone']||undefined;var _0x3cf382=![];if(_0x591e16[_0x6c92('0x26')]){logger[_0x6c92('0x10')](util['format'](_0x6c92('0x27'),_0x591e16[_0x6c92('0x1f')](';\x20')));}if(_0x865ba6){logger[_0x6c92('0x10')](util['format'](_0x6c92('0x28'),_0x865ba6));}logger[_0x6c92('0x16')](_0x6c92('0x29'),_0x3cf382);logger[_0x6c92('0x2a')](_0x6c92('0x21'),_0x39cd14);return Promise[_0x6c92('0x2b')]()[_0x6c92('0xf')](function(){if(Array['isArray'](_0x12c462)){return checkArrayOfIntervals(_0x12c462,_0x865ba6);}else if(_0x12c462){return checkSingleInterval(_0x12c462,_0x865ba6);}})[_0x6c92('0xf')](function(_0x126be7){var _0x62728b=_0x591e16[_0x6c92('0x1b')](function(_0x1d809f,_0x37b746){return _0x1d809f||iftime(_0x37b746,_0x865ba6);},![]);_0x3cf382=_0x126be7||_0x62728b;return _0x3cf382;})['catch'](function(_0x3b21c0){logger[_0x6c92('0x12')](_0x6c92('0x21'),_0x39cd14,_0x3b21c0);throw this[_0x6c92('0x12')](0x1f4,_0x3b21c0[_0x6c92('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 1221467..8e65f1c 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x13c312,_0xfe3386){var _0x7c3fe5=function(_0xe79163){while(--_0xe79163){_0x13c312['push'](_0x13c312['shift']());}};_0x7c3fe5(++_0xfe3386);}(_0xdb28,0x106));var _0x8db2=function(_0x1c08cc,_0x53bc4b){_0x1c08cc=_0x1c08cc-0x0;var _0x41d7af=_0xdb28[_0x1c08cc];return _0x41d7af;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index c578948..df6f8cb 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 _0x3129=['\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary'];(function(_0x53a9fa,_0x3e5667){var _0x32c5dd=function(_0x4a29e5){while(--_0x4a29e5){_0x53a9fa['push'](_0x53a9fa['shift']());}};_0x32c5dd(++_0x3e5667);}(_0x3129,0xec));var _0x9312=function(_0x587b79,_0x1f31fd){_0x587b79=_0x587b79-0x0;var _0x5eb875=_0x3129[_0x587b79];return _0x5eb875;};'use strict';var BPromise=require(_0x9312('0x0'));var https=require(_0x9312('0x1'));var logger=require(_0x9312('0x2'))(_0x9312('0x3'));var USERNAME=_0x9312('0x4');var PASSWORD=_0x9312('0x5');function openIssue(_0x1e126d,_0x116c05){var _0x3a6528={'fields':{'project':{'key':_0x1e126d[_0x9312('0x6')]||_0x9312('0x7')},'summary':(_0x1e126d[_0x9312('0x8')]||'Report')+_0x9312('0x9')+_0x1e126d['ip'],'description':_0x1e126d['description']||JSON[_0x9312('0xa')](_0x1e126d),'issuetype':{'name':_0x1e126d[_0x9312('0xb')]||_0x9312('0xc')}}};_0x3a6528[_0x9312('0xd')][_0x9312('0xe')]=_0x1e126d[_0x9312('0xf')];_0x3a6528[_0x9312('0xd')][_0x9312('0x10')]=_0x1e126d['oldToken'];_0x3a6528[_0x9312('0xd')][_0x9312('0x11')]=_0x1e126d[_0x9312('0x12')];_0x3a6528['fields'][_0x9312('0x13')]=_0x1e126d[_0x9312('0x14')];_0x3a6528['fields'][_0x9312('0x15')]=_0x1e126d[_0x9312('0x16')];_0x3a6528[_0x9312('0xd')][_0x9312('0x17')]=_0x1e126d['ip'];var _0x565332={'host':_0x9312('0x18'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x9312('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x9312('0x1a'),'Authorization':_0x9312('0x1b')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x9312('0x1c'))}};var _0x1c7c10=JSON[_0x9312('0xa')](_0x3a6528);var _0x1c809a=https[_0x9312('0x1d')](_0x565332,function(_0x26bb83){_0x26bb83[_0x9312('0x1e')](_0x9312('0x1f'));var _0x2771c0='';_0x26bb83['on'](_0x9312('0x20'),function(_0x2d7f33){_0x2771c0+=_0x2d7f33;});_0x26bb83['on'](_0x9312('0x21'),function(){if(_0x116c05){return _0x116c05[_0x9312('0x22')](_0x26bb83[_0x9312('0x23')])[_0x9312('0x24')](JSON[_0x9312('0x25')](_0x2771c0));}});});_0x1c809a['on'](_0x9312('0x26'),function(_0x5e67b6){if(_0x116c05){return _0x116c05[_0x9312('0x22')](0x1f4)[_0x9312('0x24')]({'errors':[{'message':_0x9312('0x27'),'type':_0x9312('0x28')}]});}});_0x1c809a[_0x9312('0x29')](_0x1c7c10);_0x1c809a[_0x9312('0x21')]();}exports[_0x9312('0x2a')]=openIssue;exports['send']=function(_0x3c2ede,_0x46aa44){_0x3c2ede['body']['ip']=_0x3c2ede[_0x9312('0x2b')][_0x9312('0x2c')]||_0x3c2ede[_0x9312('0x2d')][_0x9312('0x2e')]||_0x3c2ede[_0x9312('0x2f')][_0x9312('0x2e')]||_0x3c2ede[_0x9312('0x2d')][_0x9312('0x2f')]['remoteAddress'];return openIssue(_0x3c2ede[_0x9312('0x30')],_0x46aa44);}; \ No newline at end of file +var _0x05e2=['../../config/logger','api','support','3eAmWpBVP0','key','summary','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','parse','error','json','api.jira','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x05e2,0xe4));var _0x205e=function(_0x2384f6,_0x167775){_0x2384f6=_0x2384f6-0x0;var _0x370294=_0x05e2[_0x2384f6];return _0x370294;};'use strict';var BPromise=require(_0x205e('0x0'));var https=require(_0x205e('0x1'));var logger=require(_0x205e('0x2'))(_0x205e('0x3'));var USERNAME=_0x205e('0x4');var PASSWORD=_0x205e('0x5');function openIssue(_0x19eab8,_0x27c1f7){var _0xf94b9a={'fields':{'project':{'key':_0x19eab8[_0x205e('0x6')]||'MOTGUI'},'summary':(_0x19eab8[_0x205e('0x7')]||'Report')+_0x205e('0x8')+_0x19eab8['ip'],'description':_0x19eab8['description']||JSON[_0x205e('0x9')](_0x19eab8),'issuetype':{'name':_0x19eab8[_0x205e('0xa')]||_0x205e('0xb')}}};_0xf94b9a[_0x205e('0xc')][_0x205e('0xd')]=_0x19eab8['email'];_0xf94b9a['fields']['customfield_11501']=_0x19eab8['oldToken'];_0xf94b9a[_0x205e('0xc')][_0x205e('0xe')]=_0x19eab8[_0x205e('0xf')];_0xf94b9a[_0x205e('0xc')][_0x205e('0x10')]=_0x19eab8[_0x205e('0x11')];_0xf94b9a['fields'][_0x205e('0x12')]=_0x19eab8[_0x205e('0x13')];_0xf94b9a[_0x205e('0xc')][_0x205e('0x14')]=_0x19eab8['ip'];var _0x4edb18={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x205e('0x15'),'method':_0x205e('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x205e('0x17'),'Authorization':_0x205e('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x205e('0x19')](_0x205e('0x1a'))}};var _0x483977=JSON[_0x205e('0x9')](_0xf94b9a);var _0x1b8cca=https[_0x205e('0x1b')](_0x4edb18,function(_0x5728fa){_0x5728fa[_0x205e('0x1c')](_0x205e('0x1d'));var _0x1b4d4a='';_0x5728fa['on'](_0x205e('0x1e'),function(_0x246c2a){_0x1b4d4a+=_0x246c2a;});_0x5728fa['on'](_0x205e('0x1f'),function(){if(_0x27c1f7){return _0x27c1f7[_0x205e('0x20')](_0x5728fa[_0x205e('0x21')])['json'](JSON[_0x205e('0x22')](_0x1b4d4a));}});});_0x1b8cca['on'](_0x205e('0x23'),function(_0x1657a2){if(_0x27c1f7){return _0x27c1f7['status'](0x1f4)[_0x205e('0x24')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x205e('0x25')}]});}});_0x1b8cca['write'](_0x483977);_0x1b8cca['end']();}exports[_0x205e('0x26')]=openIssue;exports[_0x205e('0x27')]=function(_0x301094,_0xa2ab60){_0x301094[_0x205e('0x28')]['ip']=_0x301094[_0x205e('0x29')][_0x205e('0x2a')]||_0x301094[_0x205e('0x2b')][_0x205e('0x2c')]||_0x301094[_0x205e('0x2d')][_0x205e('0x2c')]||_0x301094['connection']['socket'][_0x205e('0x2c')];return openIssue(_0x301094[_0x205e('0x28')],_0xa2ab60);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e127663..9cb2a17 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 _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','destroy','util','connect-timeout','express'];(function(_0x7bdda5,_0x3358f5){var _0x45be29=function(_0x7b64ff){while(--_0x7b64ff){_0x7bdda5['push'](_0x7bdda5['shift']());}};_0x45be29(++_0x3358f5);}(_0x0a9a,0x183));var _0xa0a9=function(_0x2a2ff5,_0x4588f6){_0x2a2ff5=_0x2a2ff5-0x0;var _0xa9a91f=_0x0a9a[_0x2a2ff5];return _0xa9a91f;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/describe',auth[_0xa0a9('0x8')](),controller['describe']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router['put']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file +var _0x70e0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','describe','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x44ed01,_0x464796){var _0x561ab4=function(_0x487161){while(--_0x487161){_0x44ed01['push'](_0x44ed01['shift']());}};_0x561ab4(++_0x464796);}(_0x70e0,0x17b));var _0x070e=function(_0x5f4003,_0x2f5dda){_0x5f4003=_0x5f4003-0x0;var _0x1c7878=_0x70e0[_0x5f4003];return _0x1c7878;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x070e('0xe')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x11')]);module[_0x070e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 03dab91..01956a2 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x1e8f9f,_0x4fe148){_0x1e8f9f=_0x1e8f9f-0x0;var _0x739ac=_0x7a54[_0x1e8f9f];return _0x739ac;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x46050f,_0x3f3992){_0x46050f=_0x46050f-0x0;var _0x240ae6=_0x7a54[_0x46050f];return _0x240ae6;};'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 aab3d3d..6325f82 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 _0x4813=['offset','limit','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','show','params','keys','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4813,0x14e));var _0x3481=function(_0x1eb573,_0x333af3){_0x1eb573=_0x1eb573-0x0;var _0x226e69=_0x4813[_0x1eb573];return _0x226e69;};'use strict';var emlformat=require(_0x3481('0x0'));var rimraf=require(_0x3481('0x1'));var zipdir=require(_0x3481('0x2'));var jsonpatch=require(_0x3481('0x3'));var rp=require(_0x3481('0x4'));var moment=require(_0x3481('0x5'));var BPromise=require(_0x3481('0x6'));var Mustache=require('mustache');var util=require(_0x3481('0x7'));var path=require(_0x3481('0x8'));var sox=require(_0x3481('0x9'));var csv=require(_0x3481('0xa'));var ejs=require(_0x3481('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3481('0xc'));var crypto=require('crypto');var jsforce=require(_0x3481('0xd'));var deskjs=require(_0x3481('0xe'));var toCsv=require(_0x3481('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3481('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3481('0x10'));var logger=require(_0x3481('0x11'))(_0x3481('0x12'));var utils=require(_0x3481('0x13'));var config=require(_0x3481('0x14'));var licenseUtil=require(_0x3481('0x15'));var db=require(_0x3481('0x16'))['db'];function respondWithStatusCode(_0x3f1376,_0x37cc2b){_0x37cc2b=_0x37cc2b||0xcc;return function(_0x22b89b){if(_0x22b89b){return _0x3f1376[_0x3481('0x17')](_0x37cc2b);}return _0x3f1376[_0x3481('0x18')](_0x37cc2b)['end']();};}function respondWithResult(_0x16358e,_0xb77c75){_0xb77c75=_0xb77c75||0xc8;return function(_0x1bcfad){if(_0x1bcfad){return _0x16358e[_0x3481('0x18')](_0xb77c75)[_0x3481('0x19')](_0x1bcfad);}};}function respondWithFilteredResult(_0x39e581,_0x4a1d09){return function(_0x1bb126){if(_0x1bb126){var _0x41c2aa=typeof _0x4a1d09['offset']==='undefined'&&typeof _0x4a1d09['limit']==='undefined';var _0x4f5d1b=_0x1bb126['count'];var _0x32a315=_0x41c2aa?0x0:_0x4a1d09[_0x3481('0x1a')];var _0x5a8e65=_0x41c2aa?_0x1bb126['count']:_0x4a1d09[_0x3481('0x1a')]+_0x4a1d09[_0x3481('0x1b')];var _0x3b43dc;if(_0x5a8e65>=_0x4f5d1b){_0x5a8e65=_0x4f5d1b;_0x3b43dc=0xc8;}else{_0x3b43dc=0xce;}_0x39e581['status'](_0x3b43dc);return _0x39e581['set'](_0x3481('0x1c'),_0x32a315+'-'+_0x5a8e65+'/'+_0x4f5d1b)[_0x3481('0x19')](_0x1bb126);}return null;};}function patchUpdates(_0x1e0aa0){return function(_0x1ba743){try{jsonpatch[_0x3481('0x1d')](_0x1ba743,_0x1e0aa0,!![]);}catch(_0x4469d4){return BPromise['reject'](_0x4469d4);}return _0x1ba743[_0x3481('0x1e')]();};}function saveUpdates(_0x3cdb98,_0x162305){return function(_0xea1072){if(_0xea1072){return _0xea1072['update'](_0x3cdb98)[_0x3481('0x1f')](function(_0x48eb64){return _0x48eb64;});}return null;};}function removeEntity(_0x2185ba,_0x33c6fa){return function(_0x418a7d){if(_0x418a7d){return _0x418a7d[_0x3481('0x20')]()['then'](function(){_0x2185ba['status'](0xcc)[_0x3481('0x21')]();});}};}function handleEntityNotFound(_0x3e5963,_0x249754){return function(_0x405816){if(!_0x405816){_0x3e5963['sendStatus'](0x194);}return _0x405816;};}function handleError(_0x2e837a,_0x6ce3f3){_0x6ce3f3=_0x6ce3f3||0x1f4;return function(_0x1181e1){logger[_0x3481('0x22')](_0x1181e1[_0x3481('0x23')]);if(_0x1181e1[_0x3481('0x24')]){delete _0x1181e1[_0x3481('0x24')];}_0x2e837a[_0x3481('0x18')](_0x6ce3f3)[_0x3481('0x25')](_0x1181e1);};}exports[_0x3481('0x26')]=function(_0x4a20d5,_0x131363){var _0x4a8492={},_0xdcacba={},_0x1f079a={'count':0x0,'rows':[]};var _0x2864f1=_['map'](db[_0x3481('0x27')][_0x3481('0x28')],function(_0x2df894){return{'name':_0x2df894[_0x3481('0x29')],'type':_0x2df894[_0x3481('0x2a')]['key']};});_0xdcacba[_0x3481('0x2b')]=_[_0x3481('0x2c')](_0x2864f1,_0x3481('0x24'));_0xdcacba[_0x3481('0x2d')]=_['keys'](_0x4a20d5[_0x3481('0x2d')]);_0xdcacba[_0x3481('0x2e')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],_0xdcacba[_0x3481('0x2d')]);_0x4a8492[_0x3481('0x30')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],qs['fields'](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x31')]));_0x4a8492[_0x3481('0x30')]=_0x4a8492['attributes'][_0x3481('0x32')]?_0x4a8492['attributes']:_0xdcacba[_0x3481('0x2b')];if(!_0x4a20d5['query'][_0x3481('0x33')]('nolimit')){_0x4a8492[_0x3481('0x1b')]=qs[_0x3481('0x1b')](_0x4a20d5[_0x3481('0x2d')]['limit']);_0x4a8492[_0x3481('0x1a')]=qs['offset'](_0x4a20d5[_0x3481('0x2d')]['offset']);}_0x4a8492[_0x3481('0x34')]=qs[_0x3481('0x35')](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x35')]);_0x4a8492[_0x3481('0x36')]=qs[_0x3481('0x2e')](_[_0x3481('0x37')](_0x4a20d5[_0x3481('0x2d')],_0xdcacba[_0x3481('0x2e')]),_0x2864f1);if(_0x4a20d5['query'][_0x3481('0x38')]){_0x4a8492['where']=_[_0x3481('0x39')](_0x4a8492[_0x3481('0x36')],{'$or':_[_0x3481('0x2c')](_0x2864f1,function(_0x40fd6f){if(_0x40fd6f['type']!=='VIRTUAL'){var _0x2207fb={};_0x2207fb[_0x40fd6f[_0x3481('0x24')]]={'$like':'%'+_0x4a20d5[_0x3481('0x2d')][_0x3481('0x38')]+'%'};return _0x2207fb;}})});}_0x4a8492=_['merge']({},_0x4a8492,_0x4a20d5[_0x3481('0x3a')]);var _0x3c7874={'where':_0x4a8492[_0x3481('0x36')]};return db[_0x3481('0x27')][_0x3481('0x3b')](_0x3c7874)[_0x3481('0x1f')](function(_0x33c33f){_0x1f079a['count']=_0x33c33f;if(_0x4a20d5[_0x3481('0x2d')][_0x3481('0x3c')]){_0x4a8492[_0x3481('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4a8492);})[_0x3481('0x1f')](function(_0x420b8c){_0x1f079a[_0x3481('0x3e')]=_0x420b8c;return _0x1f079a;})['then'](respondWithFilteredResult(_0x131363,_0x4a8492))['catch'](handleError(_0x131363,null));};exports[_0x3481('0x3f')]=function(_0x335292,_0x3fc0e7){var _0xbccc9e={'raw':!![],'where':{'id':_0x335292[_0x3481('0x40')]['id']}},_0x5c4928={};_0x5c4928['model']=_[_0x3481('0x41')](db[_0x3481('0x27')][_0x3481('0x28')]);_0x5c4928[_0x3481('0x2d')]=_['keys'](_0x335292['query']);_0x5c4928['filters']=_['intersection'](_0x5c4928[_0x3481('0x2b')],_0x5c4928[_0x3481('0x2d')]);_0xbccc9e[_0x3481('0x30')]=_[_0x3481('0x2f')](_0x5c4928[_0x3481('0x2b')],qs[_0x3481('0x31')](_0x335292[_0x3481('0x2d')][_0x3481('0x31')]));_0xbccc9e[_0x3481('0x30')]=_0xbccc9e[_0x3481('0x30')][_0x3481('0x32')]?_0xbccc9e['attributes']:_0x5c4928['model'];if(_0x335292[_0x3481('0x2d')][_0x3481('0x3c')]){_0xbccc9e[_0x3481('0x3d')]=[{'all':!![]}];}_0xbccc9e=_[_0x3481('0x39')]({},_0xbccc9e,_0x335292['options']);return db[_0x3481('0x27')]['find'](_0xbccc9e)[_0x3481('0x1f')](handleEntityNotFound(_0x3fc0e7,null))[_0x3481('0x1f')](respondWithResult(_0x3fc0e7,null))[_0x3481('0x42')](handleError(_0x3fc0e7,null));};exports[_0x3481('0x43')]=function(_0x30f54e,_0x50dd72){return db[_0x3481('0x27')]['create'](_0x30f54e[_0x3481('0x44')],{})[_0x3481('0x1f')](respondWithResult(_0x50dd72,0xc9))['catch'](handleError(_0x50dd72,null));};exports[_0x3481('0x45')]=function(_0x54ec34,_0x27e106){if(_0x54ec34[_0x3481('0x44')]['id']){delete _0x54ec34[_0x3481('0x44')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x54ec34[_0x3481('0x40')]['id']}})[_0x3481('0x1f')](handleEntityNotFound(_0x27e106,null))[_0x3481('0x1f')](saveUpdates(_0x54ec34[_0x3481('0x44')],null))['then'](respondWithResult(_0x27e106,null))[_0x3481('0x42')](handleError(_0x27e106,null));};exports[_0x3481('0x20')]=function(_0xdd5422,_0x4b7598){return db['JscriptyAnswerReport'][_0x3481('0x46')]({'where':{'id':_0xdd5422[_0x3481('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b7598,null))[_0x3481('0x1f')](removeEntity(_0x4b7598,null))[_0x3481('0x42')](handleError(_0x4b7598,null));};exports[_0x3481('0x47')]=function(_0x222b83,_0x403ba9){return db['JscriptyAnswerReport'][_0x3481('0x47')]()[_0x3481('0x1f')](respondWithResult(_0x403ba9,null))[_0x3481('0x42')](handleError(_0x403ba9,null));}; \ No newline at end of file +var _0x8d0a=['undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','intersection','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8d0a,0x172));var _0xa8d0=function(_0x15ec5b,_0x43b0ad){_0x15ec5b=_0x15ec5b-0x0;var _0x108593=_0x8d0a[_0x15ec5b];return _0x108593;};'use strict';var emlformat=require(_0xa8d0('0x0'));var rimraf=require(_0xa8d0('0x1'));var zipdir=require(_0xa8d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8d0('0x3'));var moment=require(_0xa8d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8d0('0x5'));var util=require(_0xa8d0('0x6'));var path=require(_0xa8d0('0x7'));var sox=require('sox');var csv=require(_0xa8d0('0x8'));var ejs=require(_0xa8d0('0x9'));var fs=require('fs');var fs_extra=require(_0xa8d0('0xa'));var _=require(_0xa8d0('0xb'));var squel=require(_0xa8d0('0xc'));var crypto=require(_0xa8d0('0xd'));var jsforce=require(_0xa8d0('0xe'));var deskjs=require(_0xa8d0('0xf'));var toCsv=require(_0xa8d0('0x8'));var querystring=require(_0xa8d0('0x10'));var Papa=require(_0xa8d0('0x11'));var Redis=require(_0xa8d0('0x12'));var authService=require(_0xa8d0('0x13'));var qs=require(_0xa8d0('0x14'));var as=require(_0xa8d0('0x15'));var hardwareService=require(_0xa8d0('0x16'));var logger=require(_0xa8d0('0x17'))(_0xa8d0('0x18'));var utils=require(_0xa8d0('0x19'));var config=require(_0xa8d0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x318fb1,_0x23b588){_0x23b588=_0x23b588||0xcc;return function(_0x572d64){if(_0x572d64){return _0x318fb1['sendStatus'](_0x23b588);}return _0x318fb1[_0xa8d0('0x1b')](_0x23b588)[_0xa8d0('0x1c')]();};}function respondWithResult(_0x3ecc36,_0xbdc234){_0xbdc234=_0xbdc234||0xc8;return function(_0x2ebddf){if(_0x2ebddf){return _0x3ecc36[_0xa8d0('0x1b')](_0xbdc234)[_0xa8d0('0x1d')](_0x2ebddf);}};}function respondWithFilteredResult(_0x1daf70,_0x2871cb){return function(_0x238e85){if(_0x238e85){var _0xfa19ee=typeof _0x2871cb['offset']===_0xa8d0('0x1e')&&typeof _0x2871cb[_0xa8d0('0x1f')]==='undefined';var _0x3e1dc6=_0x238e85[_0xa8d0('0x20')];var _0x2899fb=_0xfa19ee?0x0:_0x2871cb[_0xa8d0('0x21')];var _0x34ce5d=_0xfa19ee?_0x238e85['count']:_0x2871cb[_0xa8d0('0x21')]+_0x2871cb[_0xa8d0('0x1f')];var _0x213de2;if(_0x34ce5d>=_0x3e1dc6){_0x34ce5d=_0x3e1dc6;_0x213de2=0xc8;}else{_0x213de2=0xce;}_0x1daf70[_0xa8d0('0x1b')](_0x213de2);return _0x1daf70[_0xa8d0('0x22')](_0xa8d0('0x23'),_0x2899fb+'-'+_0x34ce5d+'/'+_0x3e1dc6)[_0xa8d0('0x1d')](_0x238e85);}return null;};}function patchUpdates(_0x595452){return function(_0x1a3345){try{jsonpatch[_0xa8d0('0x24')](_0x1a3345,_0x595452,!![]);}catch(_0x3c8843){return BPromise[_0xa8d0('0x25')](_0x3c8843);}return _0x1a3345['save']();};}function saveUpdates(_0x31cf4f,_0x31216e){return function(_0x3212a3){if(_0x3212a3){return _0x3212a3[_0xa8d0('0x26')](_0x31cf4f)['then'](function(_0x150080){return _0x150080;});}return null;};}function removeEntity(_0x30a566,_0x20ae2c){return function(_0x1e9c3e){if(_0x1e9c3e){return _0x1e9c3e['destroy']()[_0xa8d0('0x27')](function(){_0x30a566[_0xa8d0('0x1b')](0xcc)[_0xa8d0('0x1c')]();});}};}function handleEntityNotFound(_0x507d18,_0x34c0bf){return function(_0x5f5dfb){if(!_0x5f5dfb){_0x507d18[_0xa8d0('0x28')](0x194);}return _0x5f5dfb;};}function handleError(_0x291e8e,_0x548076){_0x548076=_0x548076||0x1f4;return function(_0x5d7292){logger[_0xa8d0('0x29')](_0x5d7292['stack']);if(_0x5d7292[_0xa8d0('0x2a')]){delete _0x5d7292[_0xa8d0('0x2a')];}_0x291e8e[_0xa8d0('0x1b')](_0x548076)[_0xa8d0('0x2b')](_0x5d7292);};}exports[_0xa8d0('0x2c')]=function(_0x5a5079,_0x221c6e){var _0x356892={},_0x13de71={},_0x500cec={'count':0x0,'rows':[]};var _0x48c682=_['map'](db[_0xa8d0('0x2d')][_0xa8d0('0x2e')],function(_0x2a8e98){return{'name':_0x2a8e98[_0xa8d0('0x2f')],'type':_0x2a8e98[_0xa8d0('0x30')][_0xa8d0('0x31')]};});_0x13de71[_0xa8d0('0x32')]=_['map'](_0x48c682,_0xa8d0('0x2a'));_0x13de71['query']=_[_0xa8d0('0x33')](_0x5a5079['query']);_0x13de71['filters']=_['intersection'](_0x13de71['model'],_0x13de71[_0xa8d0('0x34')]);_0x356892[_0xa8d0('0x35')]=_['intersection'](_0x13de71['model'],qs[_0xa8d0('0x36')](_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x36')]));_0x356892[_0xa8d0('0x35')]=_0x356892[_0xa8d0('0x35')]['length']?_0x356892['attributes']:_0x13de71[_0xa8d0('0x32')];if(!_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x37')](_0xa8d0('0x38'))){_0x356892[_0xa8d0('0x1f')]=qs[_0xa8d0('0x1f')](_0x5a5079['query'][_0xa8d0('0x1f')]);_0x356892[_0xa8d0('0x21')]=qs[_0xa8d0('0x21')](_0x5a5079['query'][_0xa8d0('0x21')]);}_0x356892[_0xa8d0('0x39')]=qs[_0xa8d0('0x3a')](_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x3a')]);_0x356892[_0xa8d0('0x3b')]=qs[_0xa8d0('0x3c')](_[_0xa8d0('0x3d')](_0x5a5079[_0xa8d0('0x34')],_0x13de71[_0xa8d0('0x3c')]),_0x48c682);if(_0x5a5079[_0xa8d0('0x34')]['filter']){_0x356892[_0xa8d0('0x3b')]=_['merge'](_0x356892[_0xa8d0('0x3b')],{'$or':_[_0xa8d0('0x3e')](_0x48c682,function(_0xd181d1){if(_0xd181d1['type']!==_0xa8d0('0x3f')){var _0x172b6a={};_0x172b6a[_0xd181d1[_0xa8d0('0x2a')]]={'$like':'%'+_0x5a5079['query'][_0xa8d0('0x40')]+'%'};return _0x172b6a;}})});}_0x356892=_[_0xa8d0('0x41')]({},_0x356892,_0x5a5079[_0xa8d0('0x42')]);var _0x3c3080={'where':_0x356892[_0xa8d0('0x3b')]};return db[_0xa8d0('0x2d')][_0xa8d0('0x20')](_0x3c3080)[_0xa8d0('0x27')](function(_0x2e2778){_0x500cec['count']=_0x2e2778;if(_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x43')]){_0x356892[_0xa8d0('0x44')]=[{'all':!![]}];}return db[_0xa8d0('0x2d')][_0xa8d0('0x45')](_0x356892);})[_0xa8d0('0x27')](function(_0x3438b7){_0x500cec[_0xa8d0('0x46')]=_0x3438b7;return _0x500cec;})[_0xa8d0('0x27')](respondWithFilteredResult(_0x221c6e,_0x356892))['catch'](handleError(_0x221c6e,null));};exports[_0xa8d0('0x47')]=function(_0x588e17,_0x21c0e2){var _0x8bbb72={'raw':!![],'where':{'id':_0x588e17[_0xa8d0('0x48')]['id']}},_0x58ec61={};_0x58ec61['model']=_[_0xa8d0('0x33')](db[_0xa8d0('0x2d')][_0xa8d0('0x2e')]);_0x58ec61['query']=_['keys'](_0x588e17[_0xa8d0('0x34')]);_0x58ec61[_0xa8d0('0x3c')]=_[_0xa8d0('0x49')](_0x58ec61[_0xa8d0('0x32')],_0x58ec61[_0xa8d0('0x34')]);_0x8bbb72[_0xa8d0('0x35')]=_[_0xa8d0('0x49')](_0x58ec61[_0xa8d0('0x32')],qs['fields'](_0x588e17[_0xa8d0('0x34')]['fields']));_0x8bbb72[_0xa8d0('0x35')]=_0x8bbb72['attributes'][_0xa8d0('0x4a')]?_0x8bbb72[_0xa8d0('0x35')]:_0x58ec61[_0xa8d0('0x32')];if(_0x588e17['query'][_0xa8d0('0x43')]){_0x8bbb72[_0xa8d0('0x44')]=[{'all':!![]}];}_0x8bbb72=_[_0xa8d0('0x41')]({},_0x8bbb72,_0x588e17[_0xa8d0('0x42')]);return db[_0xa8d0('0x2d')][_0xa8d0('0x4b')](_0x8bbb72)[_0xa8d0('0x27')](handleEntityNotFound(_0x21c0e2,null))[_0xa8d0('0x27')](respondWithResult(_0x21c0e2,null))[_0xa8d0('0x4c')](handleError(_0x21c0e2,null));};exports[_0xa8d0('0x4d')]=function(_0x39f402,_0x3187){return db[_0xa8d0('0x2d')][_0xa8d0('0x4d')](_0x39f402[_0xa8d0('0x4e')],{})['then'](respondWithResult(_0x3187,0xc9))['catch'](handleError(_0x3187,null));};exports[_0xa8d0('0x26')]=function(_0x15f801,_0x3ddebe){if(_0x15f801[_0xa8d0('0x4e')]['id']){delete _0x15f801[_0xa8d0('0x4e')]['id'];}return db[_0xa8d0('0x2d')][_0xa8d0('0x4b')]({'where':{'id':_0x15f801[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x27')](handleEntityNotFound(_0x3ddebe,null))[_0xa8d0('0x27')](saveUpdates(_0x15f801[_0xa8d0('0x4e')],null))[_0xa8d0('0x27')](respondWithResult(_0x3ddebe,null))[_0xa8d0('0x4c')](handleError(_0x3ddebe,null));};exports['destroy']=function(_0x2afc73,_0x31e586){return db[_0xa8d0('0x2d')]['find']({'where':{'id':_0x2afc73[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x27')](handleEntityNotFound(_0x31e586,null))[_0xa8d0('0x27')](removeEntity(_0x31e586,null))[_0xa8d0('0x4c')](handleError(_0x31e586,null));};exports[_0xa8d0('0x4f')]=function(_0x5680c1,_0x54f9e6){return db[_0xa8d0('0x2d')][_0xa8d0('0x4f')]()[_0xa8d0('0x27')](respondWithResult(_0x54f9e6,null))[_0xa8d0('0x4c')](handleError(_0x54f9e6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ec3470f..ca394a8 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 _0xfbd3=['exports','define','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x3e079f,_0x189e15){var _0x296a34=function(_0xa31a0a){while(--_0xa31a0a){_0x3e079f['push'](_0x3e079f['shift']());}};_0x296a34(++_0x189e15);}(_0xfbd3,0x141));var _0x3fbd=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xfbd3[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x3fbd('0x0'));var util=require(_0x3fbd('0x1'));var logger=require(_0x3fbd('0x2'))(_0x3fbd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3fbd('0x4'));var fs=require('fs');var path=require(_0x3fbd('0x5'));var rimraf=require(_0x3fbd('0x6'));var config=require(_0x3fbd('0x7'));var attributes=require(_0x3fbd('0x8'));module[_0x3fbd('0x9')]=function(_0x521146,_0x31358a){return _0x521146[_0x3fbd('0xa')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5150=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3403ec,_0xc73699){var _0x1ca50f=function(_0x1af6c1){while(--_0x1af6c1){_0x3403ec['push'](_0x3403ec['shift']());}};_0x1ca50f(++_0xc73699);}(_0x5150,0xd7));var _0x0515=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x5150[_0x36bff5];return _0x80ade5;};'use strict';var _=require(_0x0515('0x0'));var util=require(_0x0515('0x1'));var logger=require(_0x0515('0x2'))(_0x0515('0x3'));var moment=require('moment');var BPromise=require(_0x0515('0x4'));var rp=require(_0x0515('0x5'));var fs=require('fs');var path=require(_0x0515('0x6'));var rimraf=require(_0x0515('0x7'));var config=require(_0x0515('0x8'));var attributes=require(_0x0515('0x9'));module[_0x0515('0xa')]=function(_0x42b157,_0x26ee19){return _0x42b157['define'](_0x0515('0xb'),attributes,{'tableName':_0x0515('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index a5775b9..0e48aeb 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 _0xb3f3=['util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash'];(function(_0x589eb4,_0xaa2019){var _0xf50816=function(_0x572fc5){while(--_0x572fc5){_0x589eb4['push'](_0x589eb4['shift']());}};_0xf50816(++_0xaa2019);}(_0xb3f3,0x1cb));var _0x3b3f=function(_0x5d0f97,_0x25009f){_0x5d0f97=_0x5d0f97-0x0;var _0xc7236=_0xb3f3[_0x5d0f97];return _0xc7236;};'use strict';var _=require(_0x3b3f('0x0'));var util=require(_0x3b3f('0x1'));var moment=require(_0x3b3f('0x2'));var BPromise=require(_0x3b3f('0x3'));var rs=require(_0x3b3f('0x4'));var fs=require('fs');var Redis=require(_0x3b3f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3b3f('0x6'))('rpc');var config=require(_0x3b3f('0x7'));var jayson=require(_0x3b3f('0x8'));var client=jayson[_0x3b3f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b987,_0x3796be,_0x26cd52){return new BPromise(function(_0x3b8d7d,_0x406174){return client[_0x3b3f('0xa')](_0x27b987,_0x26cd52)['then'](function(_0x56fe67){logger[_0x3b3f('0xb')](_0x3b3f('0xc'),_0x3796be,_0x3b3f('0xd'));logger[_0x3b3f('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x3796be,_0x3b3f('0xd'),JSON[_0x3b3f('0xf')](_0x56fe67));if(_0x56fe67['error']){if(_0x56fe67['error'][_0x3b3f('0x10')]===0x1f4){logger[_0x3b3f('0x11')](_0x3b3f('0xc'),_0x3796be,_0x56fe67['error'][_0x3b3f('0x12')]);return _0x406174(_0x56fe67[_0x3b3f('0x11')][_0x3b3f('0x12')]);}logger['error'](_0x3b3f('0xc'),_0x3796be,_0x56fe67[_0x3b3f('0x11')][_0x3b3f('0x12')]);return _0x3b8d7d(_0x56fe67[_0x3b3f('0x11')]['message']);}else{logger[_0x3b3f('0xb')](_0x3b3f('0xc'),_0x3796be,_0x3b3f('0xd'));_0x3b8d7d(_0x56fe67[_0x3b3f('0x13')][_0x3b3f('0x12')]);}})['catch'](function(_0x299101){logger['error'](_0x3b3f('0xc'),_0x3796be,_0x299101);_0x406174(_0x299101);});});} \ No newline at end of file +var _0x0022=['http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x449823,_0x1f8463){var _0x384b4f=function(_0x29ab73){while(--_0x29ab73){_0x449823['push'](_0x449823['shift']());}};_0x384b4f(++_0x1f8463);}(_0x0022,0x8b));var _0x2002=function(_0x51235c,_0x310731){_0x51235c=_0x51235c-0x0;var _0x43d852=_0x0022[_0x51235c];return _0x43d852;};'use strict';var _=require(_0x2002('0x0'));var util=require(_0x2002('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2002('0x2'));var db=require(_0x2002('0x3'))['db'];var utils=require(_0x2002('0x4'));var logger=require('../../config/logger')(_0x2002('0x5'));var config=require(_0x2002('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2002('0x7')][_0x2002('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x108c98,_0x1461ef,_0x4fa1af){return new BPromise(function(_0x3d0b57,_0x2a7949){return client[_0x2002('0x9')](_0x108c98,_0x4fa1af)[_0x2002('0xa')](function(_0xc31e62){logger[_0x2002('0xb')](_0x2002('0xc'),_0x1461ef,_0x2002('0xd'));logger[_0x2002('0xe')](_0x2002('0xf'),_0x1461ef,_0x2002('0xd'),JSON['stringify'](_0xc31e62));if(_0xc31e62[_0x2002('0x10')]){if(_0xc31e62[_0x2002('0x10')][_0x2002('0x11')]===0x1f4){logger['error'](_0x2002('0xc'),_0x1461ef,_0xc31e62[_0x2002('0x10')][_0x2002('0x12')]);return _0x2a7949(_0xc31e62[_0x2002('0x10')][_0x2002('0x12')]);}logger[_0x2002('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1461ef,_0xc31e62[_0x2002('0x10')][_0x2002('0x12')]);return _0x3d0b57(_0xc31e62[_0x2002('0x10')][_0x2002('0x12')]);}else{logger[_0x2002('0xb')](_0x2002('0xc'),_0x1461ef,'request\x20sent');_0x3d0b57(_0xc31e62[_0x2002('0x13')][_0x2002('0x12')]);}})[_0x2002('0x14')](function(_0x2735d0){logger[_0x2002('0x10')](_0x2002('0xc'),_0x1461ef,_0x2735d0);_0x2a7949(_0x2735d0);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index f5da6fd..e8deaf0 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 _0x76a2=['show','/:id/sessions','isAuthenticated','/:id/answers','/:id/summary','getSummary','post','/:id/clone','clone','/:id','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x76a2,0x1f0));var _0x276a=function(_0x26ed29,_0x2288f1){_0x26ed29=_0x26ed29-0x0;var _0x26182c=_0x76a2[_0x26ed29];return _0x26182c;};'use strict';var multer=require(_0x276a('0x0'));var util=require('util');var path=require(_0x276a('0x1'));var timeout=require('connect-timeout');var express=require(_0x276a('0x2'));var router=express[_0x276a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x276a('0x4'));var interaction=require(_0x276a('0x5'));var config=require(_0x276a('0x6'));var controller=require(_0x276a('0x7'));router[_0x276a('0x8')]('/',auth['isAuthenticated'](),controller[_0x276a('0x9')]);router[_0x276a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x276a('0xa')]);router[_0x276a('0x8')](_0x276a('0xb'),auth[_0x276a('0xc')](),controller['getSessions']);router[_0x276a('0x8')](_0x276a('0xd'),auth[_0x276a('0xc')](),controller['getAnswers']);router['get'](_0x276a('0xe'),auth[_0x276a('0xc')](),timeout('30s'),controller[_0x276a('0xf')]);router[_0x276a('0x10')]('/',auth[_0x276a('0xc')](),controller['create']);router['post'](_0x276a('0x11'),auth[_0x276a('0xc')](),controller[_0x276a('0x12')]);router['put'](_0x276a('0x13'),auth[_0x276a('0xc')](),controller['update']);router[_0x276a('0x14')](_0x276a('0x13'),auth[_0x276a('0xc')](),controller[_0x276a('0x15')]);module[_0x276a('0x16')]=router; \ No newline at end of file +var _0x7cb6=['post','create','/:id/clone','clone','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','getSessions','getAnswers','/:id/summary','getSummary'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x7cb6,0x14d));var _0x67cb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7cb6[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x67cb('0x0'));var util=require(_0x67cb('0x1'));var path=require(_0x67cb('0x2'));var timeout=require(_0x67cb('0x3'));var express=require(_0x67cb('0x4'));var router=express[_0x67cb('0x5')]();var fs_extra=require(_0x67cb('0x6'));var auth=require(_0x67cb('0x7'));var interaction=require(_0x67cb('0x8'));var config=require(_0x67cb('0x9'));var controller=require(_0x67cb('0xa'));router[_0x67cb('0xb')]('/',auth[_0x67cb('0xc')](),controller['index']);router[_0x67cb('0xb')]('/:id',auth[_0x67cb('0xc')](),controller['show']);router[_0x67cb('0xb')]('/:id/sessions',auth[_0x67cb('0xc')](),controller[_0x67cb('0xd')]);router[_0x67cb('0xb')]('/:id/answers',auth['isAuthenticated'](),controller[_0x67cb('0xe')]);router[_0x67cb('0xb')](_0x67cb('0xf'),auth[_0x67cb('0xc')](),timeout('30s'),controller[_0x67cb('0x10')]);router[_0x67cb('0x11')]('/',auth[_0x67cb('0xc')](),controller[_0x67cb('0x12')]);router[_0x67cb('0x11')](_0x67cb('0x13'),auth[_0x67cb('0xc')](),controller[_0x67cb('0x14')]);router['put'](_0x67cb('0x15'),auth['isAuthenticated'](),controller[_0x67cb('0x16')]);router[_0x67cb('0x17')](_0x67cb('0x15'),auth[_0x67cb('0xc')](),controller['destroy']);module[_0x67cb('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 6d04c31..010c771 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 _0xa78b=['setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name'];(function(_0x42cb01,_0x1c9d22){var _0x498fa8=function(_0x361334){while(--_0x361334){_0x42cb01['push'](_0x42cb01['shift']());}};_0x498fa8(++_0x1c9d22);}(_0xa78b,0x1f3));var _0xba78=function(_0x4ebc8f,_0x71255){_0x4ebc8f=_0x4ebc8f-0x0;var _0x1b94a8=_0xa78b[_0x4ebc8f];return _0x1b94a8;};'use strict';var Sequelize=require(_0xba78('0x0'));var _=require('lodash');var util=require(_0xba78('0x1'));module[_0xba78('0x2')]={'name':{'type':Sequelize[_0xba78('0x3')],'unique':_0xba78('0x4')},'description':{'type':Sequelize[_0xba78('0x3')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x1a1eaf){if(_['isObjectLike'](_0x1a1eaf)){this[_0xba78('0x5')]('formData',JSON[_0xba78('0x6')](_0x1a1eaf));}else if(_[_0xba78('0x7')](_0x1a1eaf)){this['setDataValue']('formData',_0x1a1eaf);}else{this[_0xba78('0x5')](_0xba78('0x8'),util[_0xba78('0x9')](_0xba78('0xa'),this['getDataValue']('name')||'',this[_0xba78('0xb')](_0xba78('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xba78('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc7ed=['getDataValue','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','isObjectLike','isString','formData','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x2d6dcd,_0x3e7330){var _0x25e5bc=function(_0x56b2db){while(--_0x56b2db){_0x2d6dcd['push'](_0x2d6dcd['shift']());}};_0x25e5bc(++_0x3e7330);}(_0xc7ed,0xb8));var _0xdc7e=function(_0x1119c8,_0x87303e){_0x1119c8=_0x1119c8-0x0;var _0x3f3071=_0xc7ed[_0x1119c8];return _0x3f3071;};'use strict';var Sequelize=require(_0xdc7e('0x0'));var _=require(_0xdc7e('0x1'));var util=require(_0xdc7e('0x2'));module['exports']={'name':{'type':Sequelize[_0xdc7e('0x3')],'unique':_0xdc7e('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xdc7e('0x5')]('long'),'set':function(_0x414bb3){if(_[_0xdc7e('0x6')](_0x414bb3)){this['setDataValue']('formData',JSON['stringify'](_0x414bb3));}else if(_[_0xdc7e('0x7')](_0x414bb3)){this['setDataValue'](_0xdc7e('0x8'),_0x414bb3);}else{this[_0xdc7e('0x9')](_0xdc7e('0x8'),util[_0xdc7e('0xa')](_0xdc7e('0xb'),this['getDataValue']('name')||'',this[_0xdc7e('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xdc7e('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xdc7e('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 4a3a5af..c725051 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 _0x18a9=['getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','startTime','starttime','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','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','status','end','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','JscriptyProject','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport','pick','ProjectId'];(function(_0x12991a,_0x5c7263){var _0x247c48=function(_0x431efd){while(--_0x431efd){_0x12991a['push'](_0x12991a['shift']());}};_0x247c48(++_0x5c7263);}(_0x18a9,0x17e));var _0x918a=function(_0x25e881,_0xe7d421){_0x25e881=_0x25e881-0x0;var _0x26d60a=_0x18a9[_0x25e881];return _0x26d60a;};'use strict';var emlformat=require(_0x918a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x918a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x918a('0x2'));var moment=require(_0x918a('0x3'));var BPromise=require(_0x918a('0x4'));var Mustache=require(_0x918a('0x5'));var util=require(_0x918a('0x6'));var path=require(_0x918a('0x7'));var sox=require(_0x918a('0x8'));var csv=require(_0x918a('0x9'));var ejs=require(_0x918a('0xa'));var fs=require('fs');var fs_extra=require(_0x918a('0xb'));var _=require('lodash');var squel=require(_0x918a('0xc'));var crypto=require('crypto');var jsforce=require(_0x918a('0xd'));var deskjs=require(_0x918a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x918a('0xf'));var Papa=require('papaparse');var Redis=require(_0x918a('0x10'));var authService=require(_0x918a('0x11'));var qs=require(_0x918a('0x12'));var as=require(_0x918a('0x13'));var hardwareService=require(_0x918a('0x14'));var logger=require('../../config/logger')(_0x918a('0x15'));var utils=require(_0x918a('0x16'));var config=require(_0x918a('0x17'));var licenseUtil=require(_0x918a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b8a42,_0x3f02af){_0x3f02af=_0x3f02af||0xcc;return function(_0x316b36){if(_0x316b36){return _0x1b8a42['sendStatus'](_0x3f02af);}return _0x1b8a42[_0x918a('0x19')](_0x3f02af)[_0x918a('0x1a')]();};}function respondWithResult(_0xb72115,_0x53f115){_0x53f115=_0x53f115||0xc8;return function(_0x41e8b0){if(_0x41e8b0){return _0xb72115[_0x918a('0x19')](_0x53f115)['json'](_0x41e8b0);}};}function respondWithFilteredResult(_0x543a84,_0x149566){return function(_0xf6ef2b){if(_0xf6ef2b){var _0x3ec709=typeof _0x149566['offset']===_0x918a('0x1b')&&typeof _0x149566[_0x918a('0x1c')]==='undefined';var _0x3912bc=_0xf6ef2b[_0x918a('0x1d')];var _0x3b5f4b=_0x3ec709?0x0:_0x149566['offset'];var _0x124804=_0x3ec709?_0xf6ef2b[_0x918a('0x1d')]:_0x149566['offset']+_0x149566[_0x918a('0x1c')];var _0x4b7458;if(_0x124804>=_0x3912bc){_0x124804=_0x3912bc;_0x4b7458=0xc8;}else{_0x4b7458=0xce;}_0x543a84['status'](_0x4b7458);return _0x543a84['set'](_0x918a('0x1e'),_0x3b5f4b+'-'+_0x124804+'/'+_0x3912bc)[_0x918a('0x1f')](_0xf6ef2b);}return null;};}function patchUpdates(_0x5e2cb0){return function(_0x1cc225){try{jsonpatch[_0x918a('0x20')](_0x1cc225,_0x5e2cb0,!![]);}catch(_0x34f0c2){return BPromise[_0x918a('0x21')](_0x34f0c2);}return _0x1cc225[_0x918a('0x22')]();};}function saveUpdates(_0xa9110d,_0x1c5f9b){return function(_0x18bdac){if(_0x18bdac){return _0x18bdac[_0x918a('0x23')](_0xa9110d)[_0x918a('0x24')](function(_0x3d090c){return _0x3d090c;});}return null;};}function removeEntity(_0x5a4d87,_0x186fb5){return function(_0x4e4399){if(_0x4e4399){return _0x4e4399[_0x918a('0x25')]()[_0x918a('0x24')](function(){var _0x55256a=_0x4e4399[_0x918a('0x26')]({'plain':!![]});var _0x2ac566=_0x918a('0x27');return db[_0x918a('0x28')]['destroy']({'where':{'type':_0x2ac566,'resourceId':_0x55256a['id']}})[_0x918a('0x24')](function(){return _0x4e4399;});})[_0x918a('0x24')](function(){_0x5a4d87['status'](0xcc)[_0x918a('0x1a')]();});}};}function handleEntityNotFound(_0x1604fd,_0x4cd551){return function(_0x2fe4e7){if(!_0x2fe4e7){_0x1604fd[_0x918a('0x29')](0x194);}return _0x2fe4e7;};}function handleError(_0x24e49c,_0x52a57b){_0x52a57b=_0x52a57b||0x1f4;return function(_0x3a2fe2){logger[_0x918a('0x2a')](_0x3a2fe2[_0x918a('0x2b')]);if(_0x3a2fe2['name']){delete _0x3a2fe2[_0x918a('0x2c')];}_0x24e49c['status'](_0x52a57b)[_0x918a('0x2d')](_0x3a2fe2);};}exports[_0x918a('0x2e')]=function(_0x52969e,_0xd21ff3){var _0x3e02c0={},_0x2b9d34={},_0x9d9a98={'count':0x0,'rows':[]};var _0x1c2e2f=_['map'](db[_0x918a('0x2f')][_0x918a('0x30')],function(_0x41aa2f){return{'name':_0x41aa2f['fieldName'],'type':_0x41aa2f[_0x918a('0x31')][_0x918a('0x32')]};});_0x2b9d34[_0x918a('0x33')]=_[_0x918a('0x34')](_0x1c2e2f,_0x918a('0x2c'));_0x2b9d34[_0x918a('0x35')]=_[_0x918a('0x36')](_0x52969e['query']);_0x2b9d34[_0x918a('0x37')]=_[_0x918a('0x38')](_0x2b9d34[_0x918a('0x33')],_0x2b9d34[_0x918a('0x35')]);_0x3e02c0[_0x918a('0x39')]=_[_0x918a('0x38')](_0x2b9d34[_0x918a('0x33')],qs[_0x918a('0x3a')](_0x52969e[_0x918a('0x35')][_0x918a('0x3a')]));_0x3e02c0[_0x918a('0x39')]=_0x3e02c0['attributes'][_0x918a('0x3b')]?_0x3e02c0['attributes']:_0x2b9d34[_0x918a('0x33')];if(!_0x52969e[_0x918a('0x35')][_0x918a('0x3c')](_0x918a('0x3d'))){_0x3e02c0[_0x918a('0x1c')]=qs[_0x918a('0x1c')](_0x52969e['query'][_0x918a('0x1c')]);_0x3e02c0[_0x918a('0x3e')]=qs['offset'](_0x52969e[_0x918a('0x35')][_0x918a('0x3e')]);}_0x3e02c0[_0x918a('0x3f')]=qs[_0x918a('0x40')](_0x52969e[_0x918a('0x35')][_0x918a('0x40')]);_0x3e02c0[_0x918a('0x41')]=qs[_0x918a('0x37')](_['pick'](_0x52969e[_0x918a('0x35')],_0x2b9d34['filters']),_0x1c2e2f);if(_0x52969e[_0x918a('0x35')][_0x918a('0x42')]){_0x3e02c0['where']=_[_0x918a('0x43')](_0x3e02c0[_0x918a('0x41')],{'$or':_[_0x918a('0x34')](_0x1c2e2f,function(_0x138a6c){if(_0x138a6c[_0x918a('0x31')]!==_0x918a('0x44')){var _0x4b3c5a={};_0x4b3c5a[_0x138a6c[_0x918a('0x2c')]]={'$like':'%'+_0x52969e['query'][_0x918a('0x42')]+'%'};return _0x4b3c5a;}})});}_0x3e02c0=_[_0x918a('0x43')]({},_0x3e02c0,_0x52969e[_0x918a('0x45')]);var _0x30e7b3={'where':_0x3e02c0[_0x918a('0x41')]};return db[_0x918a('0x2f')]['count'](_0x30e7b3)[_0x918a('0x24')](function(_0xf91204){_0x9d9a98['count']=_0xf91204;if(_0x52969e[_0x918a('0x35')]['includeAll']){_0x3e02c0[_0x918a('0x46')]=[{'all':!![]}];}return db['JscriptyProject'][_0x918a('0x47')](_0x3e02c0);})[_0x918a('0x24')](function(_0x463fa0){_0x9d9a98[_0x918a('0x48')]=_0x463fa0;return _0x9d9a98;})[_0x918a('0x24')](respondWithFilteredResult(_0xd21ff3,_0x3e02c0))[_0x918a('0x49')](handleError(_0xd21ff3,null));};exports[_0x918a('0x4a')]=function(_0x53913d,_0x53de1c){var _0x58af7e={'raw':![],'where':{'id':_0x53913d[_0x918a('0x4b')]['id']}},_0x1b8298={};_0x1b8298['model']=_[_0x918a('0x36')](db[_0x918a('0x2f')]['rawAttributes']);_0x1b8298[_0x918a('0x35')]=_[_0x918a('0x36')](_0x53913d['query']);_0x1b8298['filters']=_[_0x918a('0x38')](_0x1b8298[_0x918a('0x33')],_0x1b8298['query']);_0x58af7e[_0x918a('0x39')]=_[_0x918a('0x38')](_0x1b8298['model'],qs[_0x918a('0x3a')](_0x53913d[_0x918a('0x35')][_0x918a('0x3a')]));_0x58af7e[_0x918a('0x39')]=_0x58af7e['attributes'][_0x918a('0x3b')]?_0x58af7e[_0x918a('0x39')]:_0x1b8298[_0x918a('0x33')];if(_0x53913d[_0x918a('0x35')][_0x918a('0x4c')]){_0x58af7e['include']=[{'all':!![]}];}_0x58af7e=_[_0x918a('0x43')]({},_0x58af7e,_0x53913d[_0x918a('0x45')]);return db[_0x918a('0x2f')][_0x918a('0x4d')](_0x58af7e)['then'](handleEntityNotFound(_0x53de1c,null))['then'](respondWithResult(_0x53de1c,null))[_0x918a('0x49')](handleError(_0x53de1c,null));};exports[_0x918a('0x4e')]=function(_0xb991d1,_0x248313){return db['JscriptyProject'][_0x918a('0x4e')](_0xb991d1['body'],{})['then'](function(_0x49fde2){var _0x51d3c6=_0xb991d1[_0x918a('0x4f')][_0x918a('0x26')]({'plain':!![]});if(!_0x51d3c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51d3c6[_0x918a('0x50')]===_0x918a('0x4f')){var _0x13f1fa=_0x49fde2['get']({'plain':!![]});var _0x4360cc='Projects';return db[_0x918a('0x51')][_0x918a('0x4d')]({'where':{'name':_0x4360cc,'userProfileId':_0x51d3c6[_0x918a('0x52')]},'raw':!![]})[_0x918a('0x24')](function(_0x496c45){if(_0x496c45&&_0x496c45[_0x918a('0x53')]===0x0){return db[_0x918a('0x28')]['create']({'name':_0x13f1fa[_0x918a('0x2c')],'resourceId':_0x13f1fa['id'],'type':_0x496c45[_0x918a('0x2c')],'sectionId':_0x496c45['id']},{})[_0x918a('0x24')](function(){return _0x49fde2;});}else{return _0x49fde2;}})[_0x918a('0x49')](function(_0x19a8cb){logger[_0x918a('0x2a')](_0x918a('0x54'),_0x19a8cb);throw _0x19a8cb;});}return _0x49fde2;})[_0x918a('0x24')](respondWithResult(_0x248313,0xc9))['catch'](handleError(_0x248313,null));};exports['clone']=function(_0x14e64d,_0x298998){var _0x1047e5={'where':{'id':_0x14e64d[_0x918a('0x4b')]['id']}},_0x4cb14e={};_0x4cb14e[_0x918a('0x33')]=_[_0x918a('0x36')](db[_0x918a('0x2f')][_0x918a('0x30')]);_0x1047e5[_0x918a('0x39')]=_[_0x918a('0x38')](_0x4cb14e[_0x918a('0x33')],qs[_0x918a('0x3a')](_0x14e64d['query'][_0x918a('0x3a')]));_0x1047e5['attributes']=_0x1047e5[_0x918a('0x39')][_0x918a('0x3b')]?_0x1047e5[_0x918a('0x39')]:_0x4cb14e[_0x918a('0x33')];if(_0x14e64d[_0x918a('0x35')]['includeAll']){_0x1047e5['include']=[{'all':!![]}];}_0x1047e5=_[_0x918a('0x43')]({},_0x1047e5,_0x14e64d[_0x918a('0x45')]);return db[_0x918a('0x2f')][_0x918a('0x4d')](_0x1047e5)[_0x918a('0x24')](handleEntityNotFound(_0x298998,null))[_0x918a('0x24')](function(_0x9e1378){if(_0x9e1378){var _0x4c36a1=_0x9e1378[_0x918a('0x26')]({'plain':!![]});_0x4c36a1=qs[_0x918a('0x55')](_0x4c36a1,['id','createdAt',_0x918a('0x56')]);_0x14e64d[_0x918a('0x57')]=_['omit'](_0x14e64d[_0x918a('0x57')],['id','createdAt',_0x918a('0x56')]);return db[_0x918a('0x2f')]['create'](_[_0x918a('0x43')](_0x4c36a1,_0x14e64d[_0x918a('0x57')]),{'include':_0x14e64d[_0x918a('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2be04c){var _0x4a8523=_0x14e64d[_0x918a('0x4f')][_0x918a('0x26')]({'plain':!![]});if(!_0x4a8523)throw new Error(_0x918a('0x58'));if(_0x4a8523[_0x918a('0x50')]===_0x918a('0x4f')){var _0x5d0a98=_0x2be04c[_0x918a('0x26')]({'plain':!![]});var _0x3676e0=_0x918a('0x27');return db[_0x918a('0x51')][_0x918a('0x4d')]({'where':{'name':_0x3676e0,'userProfileId':_0x4a8523[_0x918a('0x52')]},'raw':!![]})['then'](function(_0x20ea01){if(_0x20ea01&&_0x20ea01[_0x918a('0x53')]===0x0){return db[_0x918a('0x28')][_0x918a('0x4e')]({'name':_0x5d0a98[_0x918a('0x2c')],'resourceId':_0x5d0a98['id'],'type':_0x20ea01[_0x918a('0x2c')],'sectionId':_0x20ea01['id']},{})[_0x918a('0x24')](function(){return _0x2be04c;});}else{return _0x2be04c;}})[_0x918a('0x49')](function(_0x4a28a0){logger[_0x918a('0x2a')](_0x918a('0x54'),_0x4a28a0);throw _0x4a28a0;});}return _0x2be04c;});}})['then'](respondWithResult(_0x298998,0xc9))[_0x918a('0x49')](handleError(_0x298998,null));};exports['update']=function(_0x50f24f,_0x13c541){if(_0x50f24f[_0x918a('0x57')]['id']){delete _0x50f24f[_0x918a('0x57')]['id'];}return db['JscriptyProject'][_0x918a('0x4d')]({'where':{'id':_0x50f24f[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x13c541,null))[_0x918a('0x24')](saveUpdates(_0x50f24f[_0x918a('0x57')],null))[_0x918a('0x24')](respondWithResult(_0x13c541,null))[_0x918a('0x49')](handleError(_0x13c541,null));};exports[_0x918a('0x25')]=function(_0x316857,_0x2c7b66){return db[_0x918a('0x2f')][_0x918a('0x4d')]({'where':{'id':_0x316857[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x2c7b66,null))[_0x918a('0x24')](removeEntity(_0x2c7b66,null))['catch'](handleError(_0x2c7b66,null));};exports[_0x918a('0x59')]=function(_0xaeb91d,_0x5984cc,_0x3fdd9b){var _0x4a7c9c={'raw':!![],'where':{}};var _0x2871ff={};var _0x50a108={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x918a('0x5a')]({'where':{'id':_0xaeb91d['params']['id']}})['then'](handleEntityNotFound(_0x5984cc,null))['then'](function(_0x53a938){if(_0x53a938){_0x2871ff[_0x918a('0x33')]=_['keys'](db[_0x918a('0x5b')]['rawAttributes']);_0x2871ff[_0x918a('0x35')]=_[_0x918a('0x36')](_0xaeb91d['query']);_0x2871ff[_0x918a('0x37')]=_[_0x918a('0x38')](_0x2871ff['model'],_0x2871ff[_0x918a('0x35')]);_0x4a7c9c[_0x918a('0x39')]=_[_0x918a('0x38')](_0x2871ff['model'],qs[_0x918a('0x3a')](_0xaeb91d['query'][_0x918a('0x3a')]));_0x4a7c9c[_0x918a('0x39')]=_0x4a7c9c['attributes'][_0x918a('0x3b')]?_0x4a7c9c[_0x918a('0x39')]:_0x2871ff[_0x918a('0x33')];if(!_0xaeb91d[_0x918a('0x35')][_0x918a('0x3c')]('nolimit')){_0x4a7c9c[_0x918a('0x1c')]=qs[_0x918a('0x1c')](_0xaeb91d[_0x918a('0x35')][_0x918a('0x1c')]);_0x4a7c9c[_0x918a('0x3e')]=qs[_0x918a('0x3e')](_0xaeb91d[_0x918a('0x35')][_0x918a('0x3e')]);}_0x4a7c9c[_0x918a('0x3f')]=qs['sort'](_0xaeb91d['query'][_0x918a('0x40')]);_0x4a7c9c[_0x918a('0x41')]=qs[_0x918a('0x37')](_[_0x918a('0x5c')](_0xaeb91d[_0x918a('0x35')],_0x2871ff[_0x918a('0x37')]));_0x4a7c9c[_0x918a('0x41')][_0x918a('0x5d')]=_0x53a938['id'];if(_0xaeb91d[_0x918a('0x35')][_0x918a('0x42')]){_0x4a7c9c[_0x918a('0x41')]=_[_0x918a('0x43')](_0x4a7c9c[_0x918a('0x41')],{'$or':_['map'](_0x4a7c9c['attributes'],function(_0x1737d6){var _0x987a4a={};_0x987a4a[_0x1737d6]={'$like':'%'+_0xaeb91d['query'][_0x918a('0x42')]+'%'};return _0x987a4a;})});}_0x4a7c9c=_[_0x918a('0x43')]({},_0x4a7c9c,_0xaeb91d[_0x918a('0x45')]);return db['JscriptySessionReport'][_0x918a('0x1d')]({'where':_0x4a7c9c[_0x918a('0x41')]})[_0x918a('0x24')](function(_0x3afd72){_0x50a108[_0x918a('0x1d')]=_0x3afd72;if(_0xaeb91d[_0x918a('0x35')][_0x918a('0x4c')]){_0x4a7c9c[_0x918a('0x46')]=[{'all':!![]}];}return db[_0x918a('0x5b')][_0x918a('0x47')](_0x4a7c9c);})[_0x918a('0x24')](function(_0x53e2c1){_0x50a108['rows']=_0x53e2c1;return _0x50a108;});}})[_0x918a('0x24')](respondWithFilteredResult(_0x5984cc,_0x4a7c9c))[_0x918a('0x49')](handleError(_0x5984cc,null));};exports[_0x918a('0x5e')]=function(_0xcdb8d6,_0x55ffb5,_0x4eafa6){var _0x1639d={'raw':!![],'where':{}};var _0x2698ef={};var _0x323d94={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0xcdb8d6['params']['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x55ffb5,null))[_0x918a('0x24')](function(_0x5d0965){if(_0x5d0965){_0x2698ef[_0x918a('0x33')]=_['keys'](db[_0x918a('0x5f')][_0x918a('0x30')]);_0x2698ef['query']=_['keys'](_0xcdb8d6[_0x918a('0x35')]);_0x2698ef['filters']=_['intersection'](_0x2698ef['model'],_0x2698ef[_0x918a('0x35')]);_0x1639d[_0x918a('0x39')]=_[_0x918a('0x38')](_0x2698ef[_0x918a('0x33')],qs[_0x918a('0x3a')](_0xcdb8d6[_0x918a('0x35')][_0x918a('0x3a')]));_0x1639d[_0x918a('0x39')]=_0x1639d[_0x918a('0x39')][_0x918a('0x3b')]?_0x1639d[_0x918a('0x39')]:_0x2698ef[_0x918a('0x33')];if(!_0xcdb8d6['query'][_0x918a('0x3c')](_0x918a('0x3d'))){_0x1639d['limit']=qs['limit'](_0xcdb8d6[_0x918a('0x35')][_0x918a('0x1c')]);_0x1639d['offset']=qs['offset'](_0xcdb8d6[_0x918a('0x35')][_0x918a('0x3e')]);}_0x1639d['order']=qs[_0x918a('0x40')](_0xcdb8d6['query'][_0x918a('0x40')]);_0x1639d[_0x918a('0x41')]=qs[_0x918a('0x37')](_['pick'](_0xcdb8d6[_0x918a('0x35')],_0x2698ef[_0x918a('0x37')]));_0x1639d[_0x918a('0x41')][_0x918a('0x5d')]=_0x5d0965['id'];if(_0xcdb8d6[_0x918a('0x35')][_0x918a('0x42')]){_0x1639d[_0x918a('0x41')]=_['merge'](_0x1639d[_0x918a('0x41')],{'$or':_[_0x918a('0x34')](_0x1639d[_0x918a('0x39')],function(_0xb47646){var _0x5722d0={};_0x5722d0[_0xb47646]={'$like':'%'+_0xcdb8d6[_0x918a('0x35')][_0x918a('0x42')]+'%'};return _0x5722d0;})});}_0x1639d=_[_0x918a('0x43')]({},_0x1639d,_0xcdb8d6['options']);return db[_0x918a('0x5f')]['count']({'where':_0x1639d[_0x918a('0x41')]})[_0x918a('0x24')](function(_0x420a76){_0x323d94[_0x918a('0x1d')]=_0x420a76;if(_0xcdb8d6[_0x918a('0x35')]['includeAll']){_0x1639d[_0x918a('0x46')]=[{'all':!![]}];}return db[_0x918a('0x5f')][_0x918a('0x47')](_0x1639d);})[_0x918a('0x24')](function(_0x495dee){_0x323d94[_0x918a('0x48')]=_0x495dee;return _0x323d94;});}})[_0x918a('0x24')](respondWithFilteredResult(_0x55ffb5,_0x1639d))['catch'](handleError(_0x55ffb5,null));};function char(_0x37fa14){return _0x918a('0x60')===typeof _0x37fa14?String[_0x918a('0x61')][_0x918a('0x20')](null,arguments):_0x37fa14;}function needsEncapsulation(_0x17fad2){return!!_0x17fad2&&(_0x17fad2[_0x918a('0x62')]()[_0x918a('0x63')](char(0xd))>=0x0||_0x17fad2['toString']()[_0x918a('0x63')](char(0xa))>=0x0||_0x17fad2[_0x918a('0x62')]()[_0x918a('0x63')](char(0x2c))>=0x0||_0x17fad2['toString']()[_0x918a('0x63')](char(0x22))>=0x0);}function encapsulate(_0x5250a1){var _0x24471f=char(0x22),_0x171787='\x5c'+char(0x22),_0x204653=_0x5250a1[_0x918a('0x62')]()['replace'](new RegExp(_0x24471f,'g'),_0x171787);return _0x24471f+_0x204653+_0x24471f;}exports['getSummary']=function(_0x3f6e9b,_0x52313a,_0xb20cf3){var _0x1cb4d1,_0x230af1;var _0x59e4cd={'where':{'ProjectId':_0x3f6e9b[_0x918a('0x4b')]['id']}};if(_0x3f6e9b['query'][_0x918a('0x64')]){_0x59e4cd['where'][_0x918a('0x65')]=JSON['parse'](_0x3f6e9b[_0x918a('0x35')][_0x918a('0x64')]);}return db[_0x918a('0x5b')][_0x918a('0x47')](_0x59e4cd)[_0x918a('0x24')](handleEntityNotFound(_0x52313a,null))[_0x918a('0x24')](function(_0x16587c){if(_0x16587c){_0x1cb4d1=_0x16587c;return db['JscriptyQuestionReport'][_0x918a('0x47')]({'where':{'SessionId':{'$in':_[_0x918a('0x34')](_0x1cb4d1,'id')},'ProjectId':_0x3f6e9b[_0x918a('0x4b')]['id']},'order':_0x918a('0x66')});}})[_0x918a('0x24')](handleEntityNotFound(_0x52313a,null))[_0x918a('0x24')](function(_0x31fe86){if(_0x31fe86){_0x230af1=_0x31fe86;var _0x338ec1={};for(var _0x2d0bae=0x0,_0x1ef186=_0x230af1[_0x918a('0x3b')];_0x2d0bae<_0x1ef186;_0x2d0bae++){if(!_0x338ec1[_0x918a('0x3c')](_0x230af1[_0x2d0bae][_0x918a('0x67')])){_0x338ec1[_0x230af1[_0x2d0bae][_0x918a('0x67')]]=needsEncapsulation(_0x230af1[_0x2d0bae][_0x918a('0x68')])?encapsulate(_0x230af1[_0x2d0bae][_0x918a('0x68')]):_0x230af1[_0x2d0bae]['question'];}}var _0x27d4b5=[],_0x132a1e={};for(var _0x392ea0=0x0,_0xad0680=_0x1cb4d1[_0x918a('0x3b')];_0x392ea0<_0xad0680;_0x392ea0++){_0x132a1e={'ProjectId':_0x3f6e9b[_0x918a('0x4b')]['id'],'SessionId':_0x1cb4d1[_0x392ea0]['id'],'StartTime':moment(_0x1cb4d1[_0x392ea0]['starttime'])['format'](_0x918a('0x69'))};for(var _0x30187f=0x0,_0x2ff6b3=_0x230af1[_0x918a('0x3b')];_0x30187f<_0x2ff6b3;_0x30187f++){if(_0x230af1[_0x30187f][_0x918a('0x6a')]==_0x1cb4d1[_0x392ea0]['id']&&_0x338ec1[_0x918a('0x3c')](_0x230af1[_0x30187f][_0x918a('0x67')])){_0x132a1e[_0x338ec1[_0x230af1[_0x30187f][_0x918a('0x67')]]]=_0x230af1[_0x30187f][_0x918a('0x6b')];}}for(var _0x18e9f8 in _0x338ec1){if(!_0x132a1e[_0x918a('0x3c')](_0x338ec1[_0x18e9f8])){_0x132a1e[_0x338ec1[_0x18e9f8]]=null;}}_0x27d4b5[_0x918a('0x6c')](_0x132a1e);}return _0x27d4b5;}})['then'](function(_0x17d090){if(!_[_0x918a('0x6d')](_0x17d090)){var _0x43c3a7=toCsv(_0x17d090);var _0x4740b9=Date[_0x918a('0x6e')]();fs[_0x918a('0x6f')](util[_0x918a('0x70')](_0x918a('0x71'),_0x3f6e9b['params']['id'],_0x4740b9),_0x43c3a7);_0x52313a['setHeader'](_0x918a('0x72'),_0x918a('0x73')+util['format'](_0x918a('0x74'),_0x3f6e9b['params']['id'],_0x4740b9));_0x52313a['setHeader']('Content-type',_0x918a('0x75'));return _0x52313a[_0x918a('0x76')](util[_0x918a('0x70')](_0x918a('0x71'),_0x3f6e9b[_0x918a('0x4b')]['id'],_0x4740b9));}else{return _0x52313a[_0x918a('0x29')](0xcc);}})[_0x918a('0x49')](handleError(_0x52313a,null));}; \ No newline at end of file +var _0x49f5=['json','offset','undefined','limit','set','reject','Projects','UserProfileResource','destroy','then','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','include','findAll','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','update','getSessions','findOne','JscriptySessionReport','JscriptyAnswerReport','nolimit','ProjectId','rows','number','fromCharCode','apply','toString','indexOf','replace','getSummary','parse','JscriptyQuestionReport','-createdAt','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','text/csv','download','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x1ac6af,_0x9ee48f){var _0x21f6ef=function(_0x27c5a2){while(--_0x27c5a2){_0x1ac6af['push'](_0x1ac6af['shift']());}};_0x21f6ef(++_0x9ee48f);}(_0x49f5,0xd0));var _0x549f=function(_0x46665f,_0xf02237){_0x46665f=_0x46665f-0x0;var _0x250f85=_0x49f5[_0x46665f];return _0x250f85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x549f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x549f('0x1'));var rp=require('request-promise');var moment=require(_0x549f('0x2'));var BPromise=require(_0x549f('0x3'));var Mustache=require(_0x549f('0x4'));var util=require(_0x549f('0x5'));var path=require(_0x549f('0x6'));var sox=require(_0x549f('0x7'));var csv=require('to-csv');var ejs=require(_0x549f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x549f('0x9'));var squel=require(_0x549f('0xa'));var crypto=require(_0x549f('0xb'));var jsforce=require(_0x549f('0xc'));var deskjs=require(_0x549f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x549f('0xe'));var Papa=require(_0x549f('0xf'));var Redis=require(_0x549f('0x10'));var authService=require(_0x549f('0x11'));var qs=require(_0x549f('0x12'));var as=require(_0x549f('0x13'));var hardwareService=require(_0x549f('0x14'));var logger=require(_0x549f('0x15'))(_0x549f('0x16'));var utils=require(_0x549f('0x17'));var config=require(_0x549f('0x18'));var licenseUtil=require(_0x549f('0x19'));var db=require(_0x549f('0x1a'))['db'];function respondWithStatusCode(_0x3cfe6f,_0x430320){_0x430320=_0x430320||0xcc;return function(_0x4f3f30){if(_0x4f3f30){return _0x3cfe6f[_0x549f('0x1b')](_0x430320);}return _0x3cfe6f[_0x549f('0x1c')](_0x430320)[_0x549f('0x1d')]();};}function respondWithResult(_0xac2a75,_0x4a8cbd){_0x4a8cbd=_0x4a8cbd||0xc8;return function(_0x580b39){if(_0x580b39){return _0xac2a75[_0x549f('0x1c')](_0x4a8cbd)[_0x549f('0x1e')](_0x580b39);}};}function respondWithFilteredResult(_0x3a9a85,_0x87b802){return function(_0x228b64){if(_0x228b64){var _0x291a5e=typeof _0x87b802[_0x549f('0x1f')]===_0x549f('0x20')&&typeof _0x87b802[_0x549f('0x21')]===_0x549f('0x20');var _0x2fb05c=_0x228b64['count'];var _0xf6d1f5=_0x291a5e?0x0:_0x87b802[_0x549f('0x1f')];var _0xba167f=_0x291a5e?_0x228b64['count']:_0x87b802[_0x549f('0x1f')]+_0x87b802['limit'];var _0x5ae46b;if(_0xba167f>=_0x2fb05c){_0xba167f=_0x2fb05c;_0x5ae46b=0xc8;}else{_0x5ae46b=0xce;}_0x3a9a85[_0x549f('0x1c')](_0x5ae46b);return _0x3a9a85[_0x549f('0x22')]('Content-Range',_0xf6d1f5+'-'+_0xba167f+'/'+_0x2fb05c)[_0x549f('0x1e')](_0x228b64);}return null;};}function patchUpdates(_0x39353b){return function(_0x5f56d3){try{jsonpatch['apply'](_0x5f56d3,_0x39353b,!![]);}catch(_0x50915b){return BPromise[_0x549f('0x23')](_0x50915b);}return _0x5f56d3['save']();};}function saveUpdates(_0x38e17a,_0x44701c){return function(_0x100e24){if(_0x100e24){return _0x100e24['update'](_0x38e17a)['then'](function(_0xef7f58){return _0xef7f58;});}return null;};}function removeEntity(_0x45b2a1,_0x5c08e0){return function(_0xa50b3f){if(_0xa50b3f){return _0xa50b3f['destroy']()['then'](function(){var _0x2f4bf9=_0xa50b3f['get']({'plain':!![]});var _0x6a8592=_0x549f('0x24');return db[_0x549f('0x25')][_0x549f('0x26')]({'where':{'type':_0x6a8592,'resourceId':_0x2f4bf9['id']}})[_0x549f('0x27')](function(){return _0xa50b3f;});})[_0x549f('0x27')](function(){_0x45b2a1[_0x549f('0x1c')](0xcc)[_0x549f('0x1d')]();});}};}function handleEntityNotFound(_0x4f8ae9,_0x212b2a){return function(_0x2f6ddc){if(!_0x2f6ddc){_0x4f8ae9['sendStatus'](0x194);}return _0x2f6ddc;};}function handleError(_0x148d73,_0x5833ce){_0x5833ce=_0x5833ce||0x1f4;return function(_0x4a4240){logger[_0x549f('0x28')](_0x4a4240[_0x549f('0x29')]);if(_0x4a4240[_0x549f('0x2a')]){delete _0x4a4240[_0x549f('0x2a')];}_0x148d73[_0x549f('0x1c')](_0x5833ce)[_0x549f('0x2b')](_0x4a4240);};}exports[_0x549f('0x2c')]=function(_0xee9db6,_0x32576d){var _0x5ef543={},_0x5cf18e={},_0x31b090={'count':0x0,'rows':[]};var _0x3cf8f3=_[_0x549f('0x2d')](db[_0x549f('0x2e')][_0x549f('0x2f')],function(_0x3f1dd4){return{'name':_0x3f1dd4['fieldName'],'type':_0x3f1dd4[_0x549f('0x30')][_0x549f('0x31')]};});_0x5cf18e['model']=_[_0x549f('0x2d')](_0x3cf8f3,'name');_0x5cf18e[_0x549f('0x32')]=_[_0x549f('0x33')](_0xee9db6[_0x549f('0x32')]);_0x5cf18e[_0x549f('0x34')]=_[_0x549f('0x35')](_0x5cf18e[_0x549f('0x36')],_0x5cf18e[_0x549f('0x32')]);_0x5ef543[_0x549f('0x37')]=_[_0x549f('0x35')](_0x5cf18e[_0x549f('0x36')],qs[_0x549f('0x38')](_0xee9db6['query'][_0x549f('0x38')]));_0x5ef543['attributes']=_0x5ef543[_0x549f('0x37')][_0x549f('0x39')]?_0x5ef543['attributes']:_0x5cf18e[_0x549f('0x36')];if(!_0xee9db6['query'][_0x549f('0x3a')]('nolimit')){_0x5ef543[_0x549f('0x21')]=qs[_0x549f('0x21')](_0xee9db6[_0x549f('0x32')]['limit']);_0x5ef543[_0x549f('0x1f')]=qs[_0x549f('0x1f')](_0xee9db6[_0x549f('0x32')][_0x549f('0x1f')]);}_0x5ef543[_0x549f('0x3b')]=qs[_0x549f('0x3c')](_0xee9db6[_0x549f('0x32')]['sort']);_0x5ef543[_0x549f('0x3d')]=qs[_0x549f('0x34')](_[_0x549f('0x3e')](_0xee9db6[_0x549f('0x32')],_0x5cf18e['filters']),_0x3cf8f3);if(_0xee9db6[_0x549f('0x32')][_0x549f('0x3f')]){_0x5ef543[_0x549f('0x3d')]=_[_0x549f('0x40')](_0x5ef543['where'],{'$or':_[_0x549f('0x2d')](_0x3cf8f3,function(_0x2ceab7){if(_0x2ceab7['type']!=='VIRTUAL'){var _0xd79808={};_0xd79808[_0x2ceab7[_0x549f('0x2a')]]={'$like':'%'+_0xee9db6[_0x549f('0x32')]['filter']+'%'};return _0xd79808;}})});}_0x5ef543=_[_0x549f('0x40')]({},_0x5ef543,_0xee9db6[_0x549f('0x41')]);var _0x12fe1d={'where':_0x5ef543[_0x549f('0x3d')]};return db[_0x549f('0x2e')][_0x549f('0x42')](_0x12fe1d)['then'](function(_0x1d0a04){_0x31b090['count']=_0x1d0a04;if(_0xee9db6[_0x549f('0x32')]['includeAll']){_0x5ef543[_0x549f('0x43')]=[{'all':!![]}];}return db[_0x549f('0x2e')][_0x549f('0x44')](_0x5ef543);})['then'](function(_0x1be97f){_0x31b090['rows']=_0x1be97f;return _0x31b090;})['then'](respondWithFilteredResult(_0x32576d,_0x5ef543))[_0x549f('0x45')](handleError(_0x32576d,null));};exports['show']=function(_0x55d164,_0xaee39c){var _0x5a8968={'raw':![],'where':{'id':_0x55d164[_0x549f('0x46')]['id']}},_0x5d2640={};_0x5d2640[_0x549f('0x36')]=_['keys'](db[_0x549f('0x2e')]['rawAttributes']);_0x5d2640[_0x549f('0x32')]=_['keys'](_0x55d164[_0x549f('0x32')]);_0x5d2640['filters']=_[_0x549f('0x35')](_0x5d2640['model'],_0x5d2640[_0x549f('0x32')]);_0x5a8968[_0x549f('0x37')]=_['intersection'](_0x5d2640[_0x549f('0x36')],qs[_0x549f('0x38')](_0x55d164[_0x549f('0x32')][_0x549f('0x38')]));_0x5a8968['attributes']=_0x5a8968[_0x549f('0x37')][_0x549f('0x39')]?_0x5a8968[_0x549f('0x37')]:_0x5d2640['model'];if(_0x55d164['query'][_0x549f('0x47')]){_0x5a8968[_0x549f('0x43')]=[{'all':!![]}];}_0x5a8968=_[_0x549f('0x40')]({},_0x5a8968,_0x55d164[_0x549f('0x41')]);return db['JscriptyProject']['find'](_0x5a8968)['then'](handleEntityNotFound(_0xaee39c,null))[_0x549f('0x27')](respondWithResult(_0xaee39c,null))[_0x549f('0x45')](handleError(_0xaee39c,null));};exports[_0x549f('0x48')]=function(_0x3068f1,_0x49a08f){return db['JscriptyProject'][_0x549f('0x48')](_0x3068f1[_0x549f('0x49')],{})[_0x549f('0x27')](function(_0x221961){var _0x99d3fa=_0x3068f1[_0x549f('0x4a')]['get']({'plain':!![]});if(!_0x99d3fa)throw new Error(_0x549f('0x4b'));if(_0x99d3fa[_0x549f('0x4c')]===_0x549f('0x4a')){var _0x4d30d9=_0x221961[_0x549f('0x4d')]({'plain':!![]});var _0x46b54f='Projects';return db[_0x549f('0x4e')][_0x549f('0x4f')]({'where':{'name':_0x46b54f,'userProfileId':_0x99d3fa[_0x549f('0x50')]},'raw':!![]})[_0x549f('0x27')](function(_0x3b652e){if(_0x3b652e&&_0x3b652e[_0x549f('0x51')]===0x0){return db[_0x549f('0x25')]['create']({'name':_0x4d30d9[_0x549f('0x2a')],'resourceId':_0x4d30d9['id'],'type':_0x3b652e[_0x549f('0x2a')],'sectionId':_0x3b652e['id']},{})['then'](function(){return _0x221961;});}else{return _0x221961;}})[_0x549f('0x45')](function(_0x385b64){logger[_0x549f('0x28')](_0x549f('0x52'),_0x385b64);throw _0x385b64;});}return _0x221961;})[_0x549f('0x27')](respondWithResult(_0x49a08f,0xc9))[_0x549f('0x45')](handleError(_0x49a08f,null));};exports['clone']=function(_0x420c47,_0x1ace44){var _0x5cb14b={'where':{'id':_0x420c47[_0x549f('0x46')]['id']}},_0x2c58b9={};_0x2c58b9[_0x549f('0x36')]=_[_0x549f('0x33')](db[_0x549f('0x2e')][_0x549f('0x2f')]);_0x5cb14b[_0x549f('0x37')]=_[_0x549f('0x35')](_0x2c58b9[_0x549f('0x36')],qs[_0x549f('0x38')](_0x420c47['query']['fields']));_0x5cb14b[_0x549f('0x37')]=_0x5cb14b[_0x549f('0x37')][_0x549f('0x39')]?_0x5cb14b[_0x549f('0x37')]:_0x2c58b9[_0x549f('0x36')];if(_0x420c47[_0x549f('0x32')]['includeAll']){_0x5cb14b[_0x549f('0x43')]=[{'all':!![]}];}_0x5cb14b=_[_0x549f('0x40')]({},_0x5cb14b,_0x420c47['options']);return db[_0x549f('0x2e')][_0x549f('0x4f')](_0x5cb14b)[_0x549f('0x27')](handleEntityNotFound(_0x1ace44,null))[_0x549f('0x27')](function(_0x478129){if(_0x478129){var _0x3e5bad=_0x478129['get']({'plain':!![]});_0x3e5bad=qs[_0x549f('0x53')](_0x3e5bad,['id',_0x549f('0x54'),_0x549f('0x55')]);_0x420c47[_0x549f('0x49')]=_['omit'](_0x420c47[_0x549f('0x49')],['id',_0x549f('0x54'),_0x549f('0x55')]);return db[_0x549f('0x2e')][_0x549f('0x48')](_[_0x549f('0x40')](_0x3e5bad,_0x420c47[_0x549f('0x49')]),{'include':_0x420c47[_0x549f('0x32')][_0x549f('0x47')]?[{'all':!![]}]:undefined})[_0x549f('0x27')](function(_0x976aa4){var _0xa1f621=_0x420c47[_0x549f('0x4a')][_0x549f('0x4d')]({'plain':!![]});if(!_0xa1f621)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa1f621[_0x549f('0x4c')]===_0x549f('0x4a')){var _0x15d3f2=_0x976aa4[_0x549f('0x4d')]({'plain':!![]});var _0x5611a6=_0x549f('0x24');return db['UserProfileSection'][_0x549f('0x4f')]({'where':{'name':_0x5611a6,'userProfileId':_0xa1f621[_0x549f('0x50')]},'raw':!![]})[_0x549f('0x27')](function(_0x443a5e){if(_0x443a5e&&_0x443a5e[_0x549f('0x51')]===0x0){return db[_0x549f('0x25')][_0x549f('0x48')]({'name':_0x15d3f2['name'],'resourceId':_0x15d3f2['id'],'type':_0x443a5e['name'],'sectionId':_0x443a5e['id']},{})['then'](function(){return _0x976aa4;});}else{return _0x976aa4;}})[_0x549f('0x45')](function(_0x3ead2a){logger[_0x549f('0x28')](_0x549f('0x52'),_0x3ead2a);throw _0x3ead2a;});}return _0x976aa4;});}})['then'](respondWithResult(_0x1ace44,0xc9))[_0x549f('0x45')](handleError(_0x1ace44,null));};exports[_0x549f('0x56')]=function(_0xfb0c8f,_0x3c8ccb){if(_0xfb0c8f[_0x549f('0x49')]['id']){delete _0xfb0c8f[_0x549f('0x49')]['id'];}return db['JscriptyProject'][_0x549f('0x4f')]({'where':{'id':_0xfb0c8f['params']['id']}})['then'](handleEntityNotFound(_0x3c8ccb,null))[_0x549f('0x27')](saveUpdates(_0xfb0c8f['body'],null))[_0x549f('0x27')](respondWithResult(_0x3c8ccb,null))[_0x549f('0x45')](handleError(_0x3c8ccb,null));};exports[_0x549f('0x26')]=function(_0x3f08e6,_0x18c346){return db[_0x549f('0x2e')][_0x549f('0x4f')]({'where':{'id':_0x3f08e6[_0x549f('0x46')]['id']}})[_0x549f('0x27')](handleEntityNotFound(_0x18c346,null))['then'](removeEntity(_0x18c346,null))[_0x549f('0x45')](handleError(_0x18c346,null));};exports[_0x549f('0x57')]=function(_0x1d464e,_0xb06e3,_0x20f707){var _0x37f3b5={'raw':!![],'where':{}};var _0x436f24={};var _0x531bd0={'count':0x0,'rows':[]};return db[_0x549f('0x2e')][_0x549f('0x58')]({'where':{'id':_0x1d464e[_0x549f('0x46')]['id']}})[_0x549f('0x27')](handleEntityNotFound(_0xb06e3,null))[_0x549f('0x27')](function(_0x316243){if(_0x316243){_0x436f24[_0x549f('0x36')]=_[_0x549f('0x33')](db[_0x549f('0x59')][_0x549f('0x2f')]);_0x436f24[_0x549f('0x32')]=_['keys'](_0x1d464e['query']);_0x436f24['filters']=_[_0x549f('0x35')](_0x436f24[_0x549f('0x36')],_0x436f24[_0x549f('0x32')]);_0x37f3b5[_0x549f('0x37')]=_[_0x549f('0x35')](_0x436f24['model'],qs[_0x549f('0x38')](_0x1d464e[_0x549f('0x32')]['fields']));_0x37f3b5[_0x549f('0x37')]=_0x37f3b5['attributes'][_0x549f('0x39')]?_0x37f3b5[_0x549f('0x37')]:_0x436f24[_0x549f('0x36')];if(!_0x1d464e[_0x549f('0x32')][_0x549f('0x3a')]('nolimit')){_0x37f3b5[_0x549f('0x21')]=qs[_0x549f('0x21')](_0x1d464e[_0x549f('0x32')][_0x549f('0x21')]);_0x37f3b5[_0x549f('0x1f')]=qs[_0x549f('0x1f')](_0x1d464e['query'][_0x549f('0x1f')]);}_0x37f3b5[_0x549f('0x3b')]=qs[_0x549f('0x3c')](_0x1d464e[_0x549f('0x32')][_0x549f('0x3c')]);_0x37f3b5[_0x549f('0x3d')]=qs[_0x549f('0x34')](_['pick'](_0x1d464e[_0x549f('0x32')],_0x436f24[_0x549f('0x34')]));_0x37f3b5[_0x549f('0x3d')]['ProjectId']=_0x316243['id'];if(_0x1d464e['query'][_0x549f('0x3f')]){_0x37f3b5[_0x549f('0x3d')]=_['merge'](_0x37f3b5['where'],{'$or':_[_0x549f('0x2d')](_0x37f3b5[_0x549f('0x37')],function(_0x147f04){var _0x28a4cd={};_0x28a4cd[_0x147f04]={'$like':'%'+_0x1d464e[_0x549f('0x32')]['filter']+'%'};return _0x28a4cd;})});}_0x37f3b5=_[_0x549f('0x40')]({},_0x37f3b5,_0x1d464e[_0x549f('0x41')]);return db[_0x549f('0x59')][_0x549f('0x42')]({'where':_0x37f3b5[_0x549f('0x3d')]})[_0x549f('0x27')](function(_0x452662){_0x531bd0[_0x549f('0x42')]=_0x452662;if(_0x1d464e[_0x549f('0x32')][_0x549f('0x47')]){_0x37f3b5['include']=[{'all':!![]}];}return db[_0x549f('0x59')]['findAll'](_0x37f3b5);})[_0x549f('0x27')](function(_0x5a558e){_0x531bd0['rows']=_0x5a558e;return _0x531bd0;});}})[_0x549f('0x27')](respondWithFilteredResult(_0xb06e3,_0x37f3b5))[_0x549f('0x45')](handleError(_0xb06e3,null));};exports['getAnswers']=function(_0x10a14c,_0x5ac10c,_0x2691c6){var _0xd50313={'raw':!![],'where':{}};var _0x4280f9={};var _0x2525e0={'count':0x0,'rows':[]};return db[_0x549f('0x2e')]['findOne']({'where':{'id':_0x10a14c[_0x549f('0x46')]['id']}})[_0x549f('0x27')](handleEntityNotFound(_0x5ac10c,null))[_0x549f('0x27')](function(_0x197954){if(_0x197954){_0x4280f9[_0x549f('0x36')]=_[_0x549f('0x33')](db[_0x549f('0x5a')][_0x549f('0x2f')]);_0x4280f9[_0x549f('0x32')]=_[_0x549f('0x33')](_0x10a14c['query']);_0x4280f9[_0x549f('0x34')]=_[_0x549f('0x35')](_0x4280f9[_0x549f('0x36')],_0x4280f9[_0x549f('0x32')]);_0xd50313[_0x549f('0x37')]=_[_0x549f('0x35')](_0x4280f9[_0x549f('0x36')],qs[_0x549f('0x38')](_0x10a14c[_0x549f('0x32')][_0x549f('0x38')]));_0xd50313['attributes']=_0xd50313['attributes'][_0x549f('0x39')]?_0xd50313[_0x549f('0x37')]:_0x4280f9[_0x549f('0x36')];if(!_0x10a14c[_0x549f('0x32')][_0x549f('0x3a')](_0x549f('0x5b'))){_0xd50313[_0x549f('0x21')]=qs[_0x549f('0x21')](_0x10a14c[_0x549f('0x32')][_0x549f('0x21')]);_0xd50313[_0x549f('0x1f')]=qs[_0x549f('0x1f')](_0x10a14c[_0x549f('0x32')][_0x549f('0x1f')]);}_0xd50313['order']=qs[_0x549f('0x3c')](_0x10a14c[_0x549f('0x32')][_0x549f('0x3c')]);_0xd50313[_0x549f('0x3d')]=qs[_0x549f('0x34')](_[_0x549f('0x3e')](_0x10a14c[_0x549f('0x32')],_0x4280f9[_0x549f('0x34')]));_0xd50313[_0x549f('0x3d')][_0x549f('0x5c')]=_0x197954['id'];if(_0x10a14c[_0x549f('0x32')][_0x549f('0x3f')]){_0xd50313['where']=_['merge'](_0xd50313[_0x549f('0x3d')],{'$or':_[_0x549f('0x2d')](_0xd50313[_0x549f('0x37')],function(_0x3891c0){var _0x4d744d={};_0x4d744d[_0x3891c0]={'$like':'%'+_0x10a14c[_0x549f('0x32')]['filter']+'%'};return _0x4d744d;})});}_0xd50313=_[_0x549f('0x40')]({},_0xd50313,_0x10a14c['options']);return db['JscriptyAnswerReport'][_0x549f('0x42')]({'where':_0xd50313['where']})[_0x549f('0x27')](function(_0x4359d4){_0x2525e0['count']=_0x4359d4;if(_0x10a14c[_0x549f('0x32')][_0x549f('0x47')]){_0xd50313[_0x549f('0x43')]=[{'all':!![]}];}return db[_0x549f('0x5a')][_0x549f('0x44')](_0xd50313);})[_0x549f('0x27')](function(_0x4e6c2e){_0x2525e0[_0x549f('0x5d')]=_0x4e6c2e;return _0x2525e0;});}})[_0x549f('0x27')](respondWithFilteredResult(_0x5ac10c,_0xd50313))['catch'](handleError(_0x5ac10c,null));};function char(_0x21aba7){return _0x549f('0x5e')===typeof _0x21aba7?String[_0x549f('0x5f')][_0x549f('0x60')](null,arguments):_0x21aba7;}function needsEncapsulation(_0x3d66aa){return!!_0x3d66aa&&(_0x3d66aa[_0x549f('0x61')]()[_0x549f('0x62')](char(0xd))>=0x0||_0x3d66aa[_0x549f('0x61')]()[_0x549f('0x62')](char(0xa))>=0x0||_0x3d66aa[_0x549f('0x61')]()[_0x549f('0x62')](char(0x2c))>=0x0||_0x3d66aa[_0x549f('0x61')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x433eb4){var _0x4ca368=char(0x22),_0x1277fa='\x5c'+char(0x22),_0x481ae2=_0x433eb4[_0x549f('0x61')]()[_0x549f('0x63')](new RegExp(_0x4ca368,'g'),_0x1277fa);return _0x4ca368+_0x481ae2+_0x4ca368;}exports[_0x549f('0x64')]=function(_0x487015,_0x335a42,_0x26300f){var _0x233bef,_0x517e1f;var _0x37a13d={'where':{'ProjectId':_0x487015[_0x549f('0x46')]['id']}};if(_0x487015[_0x549f('0x32')]['startTime']){_0x37a13d['where']['starttime']=JSON[_0x549f('0x65')](_0x487015[_0x549f('0x32')]['startTime']);}return db[_0x549f('0x59')]['findAll'](_0x37a13d)[_0x549f('0x27')](handleEntityNotFound(_0x335a42,null))['then'](function(_0x10f72f){if(_0x10f72f){_0x233bef=_0x10f72f;return db[_0x549f('0x66')][_0x549f('0x44')]({'where':{'SessionId':{'$in':_[_0x549f('0x2d')](_0x233bef,'id')},'ProjectId':_0x487015[_0x549f('0x46')]['id']},'order':_0x549f('0x67')});}})['then'](handleEntityNotFound(_0x335a42,null))[_0x549f('0x27')](function(_0x3f4683){if(_0x3f4683){_0x517e1f=_0x3f4683;var _0x391216={};for(var _0x401609=0x0,_0x9d9789=_0x517e1f[_0x549f('0x39')];_0x401609<_0x9d9789;_0x401609++){if(!_0x391216['hasOwnProperty'](_0x517e1f[_0x401609]['questionId'])){_0x391216[_0x517e1f[_0x401609]['questionId']]=needsEncapsulation(_0x517e1f[_0x401609][_0x549f('0x68')])?encapsulate(_0x517e1f[_0x401609]['question']):_0x517e1f[_0x401609][_0x549f('0x68')];}}var _0x3d29c4=[],_0x57532b={};for(var _0x414a84=0x0,_0x1a3702=_0x233bef[_0x549f('0x39')];_0x414a84<_0x1a3702;_0x414a84++){_0x57532b={'ProjectId':_0x487015[_0x549f('0x46')]['id'],'SessionId':_0x233bef[_0x414a84]['id'],'StartTime':moment(_0x233bef[_0x414a84][_0x549f('0x69')])[_0x549f('0x6a')](_0x549f('0x6b'))};for(var _0x8f12b0=0x0,_0x1b10cc=_0x517e1f[_0x549f('0x39')];_0x8f12b0<_0x1b10cc;_0x8f12b0++){if(_0x517e1f[_0x8f12b0][_0x549f('0x6c')]==_0x233bef[_0x414a84]['id']&&_0x391216['hasOwnProperty'](_0x517e1f[_0x8f12b0][_0x549f('0x6d')])){_0x57532b[_0x391216[_0x517e1f[_0x8f12b0][_0x549f('0x6d')]]]=_0x517e1f[_0x8f12b0][_0x549f('0x6e')];}}for(var _0x47aa9a in _0x391216){if(!_0x57532b[_0x549f('0x3a')](_0x391216[_0x47aa9a])){_0x57532b[_0x391216[_0x47aa9a]]=null;}}_0x3d29c4[_0x549f('0x6f')](_0x57532b);}return _0x3d29c4;}})['then'](function(_0x5b37ad){if(!_[_0x549f('0x70')](_0x5b37ad)){var _0x899339=toCsv(_0x5b37ad);var _0x3f8e21=Date[_0x549f('0x71')]();fs['writeFileSync'](util[_0x549f('0x6a')](_0x549f('0x72'),_0x487015[_0x549f('0x46')]['id'],_0x3f8e21),_0x899339);_0x335a42[_0x549f('0x73')](_0x549f('0x74'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x487015[_0x549f('0x46')]['id'],_0x3f8e21));_0x335a42[_0x549f('0x73')]('Content-type',_0x549f('0x75'));return _0x335a42[_0x549f('0x76')](util['format'](_0x549f('0x72'),_0x487015[_0x549f('0x46')]['id'],_0x3f8e21));}else{return _0x335a42[_0x549f('0x1b')](0xcc);}})[_0x549f('0x45')](handleError(_0x335a42,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 92e254f..412c5d2 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 _0x56e7=['define','JscriptyProject','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x3b9a7c,_0x2e1e73){var _0xcb9f69=function(_0xbd1e6d){while(--_0xbd1e6d){_0x3b9a7c['push'](_0x3b9a7c['shift']());}};_0xcb9f69(++_0x2e1e73);}(_0x56e7,0x7b));var _0x756e=function(_0x211cad,_0x393dde){_0x211cad=_0x211cad-0x0;var _0x351ca4=_0x56e7[_0x211cad];return _0x351ca4;};'use strict';var _=require('lodash');var util=require(_0x756e('0x0'));var logger=require(_0x756e('0x1'))('api');var moment=require(_0x756e('0x2'));var BPromise=require(_0x756e('0x3'));var rp=require(_0x756e('0x4'));var fs=require('fs');var path=require(_0x756e('0x5'));var rimraf=require(_0x756e('0x6'));var config=require(_0x756e('0x7'));var attributes=require(_0x756e('0x8'));module['exports']=function(_0x3b3b8f,_0x404189){return _0x3b3b8f[_0x756e('0x9')](_0x756e('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb91a=['./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dc103,_0x48a943){var _0x319cbd=function(_0x5263a){while(--_0x5263a){_0x3dc103['push'](_0x3dc103['shift']());}};_0x319cbd(++_0x48a943);}(_0xb91a,0xf4));var _0xab91=function(_0x1d40b4,_0x4a2ffd){_0x1d40b4=_0x1d40b4-0x0;var _0x49b1f6=_0xb91a[_0x1d40b4];return _0x49b1f6;};'use strict';var _=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var logger=require(_0xab91('0x2'))('api');var moment=require('moment');var BPromise=require(_0xab91('0x3'));var rp=require(_0xab91('0x4'));var fs=require('fs');var path=require(_0xab91('0x5'));var rimraf=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var attributes=require(_0xab91('0x8'));module[_0xab91('0x9')]=function(_0x429933,_0x290af9){return _0x429933[_0xab91('0xa')]('JscriptyProject',attributes,{'tableName':_0xab91('0xb'),'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 f8bf004..7d20e9b 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x146375,_0x38b30d){var _0x24a6aa=function(_0x1386e5){while(--_0x1386e5){_0x146375['push'](_0x146375['shift']());}};_0x24a6aa(++_0x38b30d);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4af98e,_0x2065bc){var _0x252a91=function(_0x3ea87a){while(--_0x3ea87a){_0x4af98e['push'](_0x4af98e['shift']());}};_0x252a91(++_0x2065bc);}(_0xb43b,0x1b2));var _0xbb43=function(_0x43f022,_0x4f2c05){_0x43f022=_0x43f022-0x0;var _0x22f6b9=_0xb43b[_0x43f022];return _0x22f6b9;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b07f060..4c9dafc 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 _0xd57a=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xd57a,0xdf));var _0xad57=function(_0x172cd4,_0x2108fb){_0x172cd4=_0x172cd4-0x0;var _0x38a8f3=_0xd57a[_0x172cd4];return _0x38a8f3;};'use strict';var multer=require(_0xad57('0x0'));var util=require(_0xad57('0x1'));var path=require(_0xad57('0x2'));var timeout=require('connect-timeout');var express=require(_0xad57('0x3'));var router=express[_0xad57('0x4')]();var fs_extra=require(_0xad57('0x5'));var auth=require(_0xad57('0x6'));var interaction=require(_0xad57('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xad57('0x8')]('/',auth[_0xad57('0x9')](),controller[_0xad57('0xa')]);router[_0xad57('0x8')](_0xad57('0xb'),auth[_0xad57('0x9')](),controller[_0xad57('0xc')]);router['get'](_0xad57('0xd'),auth[_0xad57('0x9')](),controller[_0xad57('0xe')]);router[_0xad57('0xf')]('/',auth[_0xad57('0x9')](),controller[_0xad57('0x10')]);router[_0xad57('0x11')](_0xad57('0xd'),auth['isAuthenticated'](),controller[_0xad57('0x12')]);router[_0xad57('0x13')](_0xad57('0xd'),auth[_0xad57('0x9')](),controller[_0xad57('0x14')]);module[_0xad57('0x15')]=router; \ No newline at end of file +var _0xd7e4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','express','Router'];(function(_0x18088f,_0x39942d){var _0x1c26e7=function(_0x786dd0){while(--_0x786dd0){_0x18088f['push'](_0x18088f['shift']());}};_0x1c26e7(++_0x39942d);}(_0xd7e4,0xe2));var _0x4d7e=function(_0x3fa765,_0x378ef3){_0x3fa765=_0x3fa765-0x0;var _0x68bf93=_0xd7e4[_0x3fa765];return _0x68bf93;};'use strict';var multer=require(_0x4d7e('0x0'));var util=require('util');var path=require(_0x4d7e('0x1'));var timeout=require(_0x4d7e('0x2'));var express=require(_0x4d7e('0x3'));var router=express[_0x4d7e('0x4')]();var fs_extra=require(_0x4d7e('0x5'));var auth=require(_0x4d7e('0x6'));var interaction=require(_0x4d7e('0x7'));var config=require(_0x4d7e('0x8'));var controller=require(_0x4d7e('0x9'));router[_0x4d7e('0xa')]('/',auth[_0x4d7e('0xb')](),controller[_0x4d7e('0xc')]);router[_0x4d7e('0xa')]('/describe',auth[_0x4d7e('0xb')](),controller[_0x4d7e('0xd')]);router[_0x4d7e('0xa')](_0x4d7e('0xe'),auth['isAuthenticated'](),controller[_0x4d7e('0xf')]);router[_0x4d7e('0x10')]('/',auth[_0x4d7e('0xb')](),controller[_0x4d7e('0x11')]);router[_0x4d7e('0x12')](_0x4d7e('0xe'),auth['isAuthenticated'](),controller[_0x4d7e('0x13')]);router['delete'](_0x4d7e('0xe'),auth[_0x4d7e('0xb')](),controller[_0x4d7e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 797c081..56460bd 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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x39b5d3,_0x26aadb){_0x39b5d3=_0x39b5d3-0x0;var _0x35a173=_0x7a54[_0x39b5d3];return _0x35a173;};'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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x2f4217,_0x178100){_0x2f4217=_0x2f4217-0x0;var _0x390456=_0x7a54[_0x2f4217];return _0x390456;};'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 02baf8e..67d2336 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 _0x23c2=['findAll','rows','catch','show','find','create','body','params','destroy','describe','eml-format','zip-dir','moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x430b95,_0x104f01){var _0x16adb4=function(_0x906d5a){while(--_0x906d5a){_0x430b95['push'](_0x430b95['shift']());}};_0x16adb4(++_0x104f01);}(_0x23c2,0x177));var _0x223c=function(_0x3e0191,_0x1d4b20){_0x3e0191=_0x3e0191-0x0;var _0xf2ae83=_0x23c2[_0x3e0191];return _0xf2ae83;};'use strict';var emlformat=require(_0x223c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x223c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x223c('0x2'));var BPromise=require(_0x223c('0x3'));var Mustache=require('mustache');var util=require(_0x223c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x223c('0x5'));var ejs=require(_0x223c('0x6'));var fs=require('fs');var fs_extra=require(_0x223c('0x7'));var _=require('lodash');var squel=require(_0x223c('0x8'));var crypto=require(_0x223c('0x9'));var jsforce=require(_0x223c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x223c('0x5'));var querystring=require(_0x223c('0xb'));var Papa=require('papaparse');var Redis=require(_0x223c('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x223c('0xd'));var as=require(_0x223c('0xe'));var hardwareService=require(_0x223c('0xf'));var logger=require('../../config/logger')(_0x223c('0x10'));var utils=require(_0x223c('0x11'));var config=require(_0x223c('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x223c('0x13'))['db'];function respondWithStatusCode(_0x309949,_0x70baab){_0x70baab=_0x70baab||0xcc;return function(_0x35d129){if(_0x35d129){return _0x309949[_0x223c('0x14')](_0x70baab);}return _0x309949['status'](_0x70baab)[_0x223c('0x15')]();};}function respondWithResult(_0x24e1a8,_0x2ec414){_0x2ec414=_0x2ec414||0xc8;return function(_0x25457d){if(_0x25457d){return _0x24e1a8[_0x223c('0x16')](_0x2ec414)['json'](_0x25457d);}};}function respondWithFilteredResult(_0x55c5a3,_0x54e2fd){return function(_0x581cc8){if(_0x581cc8){var _0x39a960=typeof _0x54e2fd[_0x223c('0x17')]==='undefined'&&typeof _0x54e2fd[_0x223c('0x18')]==='undefined';var _0x1128c9=_0x581cc8[_0x223c('0x19')];var _0x3ecba9=_0x39a960?0x0:_0x54e2fd[_0x223c('0x17')];var _0x579bea=_0x39a960?_0x581cc8[_0x223c('0x19')]:_0x54e2fd[_0x223c('0x17')]+_0x54e2fd[_0x223c('0x18')];var _0x3f43f8;if(_0x579bea>=_0x1128c9){_0x579bea=_0x1128c9;_0x3f43f8=0xc8;}else{_0x3f43f8=0xce;}_0x55c5a3[_0x223c('0x16')](_0x3f43f8);return _0x55c5a3[_0x223c('0x1a')](_0x223c('0x1b'),_0x3ecba9+'-'+_0x579bea+'/'+_0x1128c9)[_0x223c('0x1c')](_0x581cc8);}return null;};}function patchUpdates(_0x59b7e5){return function(_0x3cfc71){try{jsonpatch[_0x223c('0x1d')](_0x3cfc71,_0x59b7e5,!![]);}catch(_0x1a703b){return BPromise[_0x223c('0x1e')](_0x1a703b);}return _0x3cfc71[_0x223c('0x1f')]();};}function saveUpdates(_0x9a217b,_0x3fe74d){return function(_0x274a6b){if(_0x274a6b){return _0x274a6b[_0x223c('0x20')](_0x9a217b)[_0x223c('0x21')](function(_0x32fcc1){return _0x32fcc1;});}return null;};}function removeEntity(_0x2dd6ac,_0x845bf9){return function(_0x1fd25a){if(_0x1fd25a){return _0x1fd25a['destroy']()[_0x223c('0x21')](function(){_0x2dd6ac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a866a,_0x297270){return function(_0x5950d4){if(!_0x5950d4){_0x1a866a['sendStatus'](0x194);}return _0x5950d4;};}function handleError(_0x3399b1,_0x32aa06){_0x32aa06=_0x32aa06||0x1f4;return function(_0x5a8c38){logger[_0x223c('0x22')](_0x5a8c38[_0x223c('0x23')]);if(_0x5a8c38[_0x223c('0x24')]){delete _0x5a8c38['name'];}_0x3399b1[_0x223c('0x16')](_0x32aa06)[_0x223c('0x25')](_0x5a8c38);};}exports[_0x223c('0x26')]=function(_0x5c9e14,_0x1c9491){var _0x828efc={},_0x4e5435={},_0x397b53={'count':0x0,'rows':[]};var _0x5a7cf2=_[_0x223c('0x27')](db[_0x223c('0x28')][_0x223c('0x29')],function(_0x44fb8f){return{'name':_0x44fb8f[_0x223c('0x2a')],'type':_0x44fb8f[_0x223c('0x2b')]['key']};});_0x4e5435[_0x223c('0x2c')]=_[_0x223c('0x27')](_0x5a7cf2,_0x223c('0x24'));_0x4e5435['query']=_[_0x223c('0x2d')](_0x5c9e14[_0x223c('0x2e')]);_0x4e5435[_0x223c('0x2f')]=_['intersection'](_0x4e5435[_0x223c('0x2c')],_0x4e5435[_0x223c('0x2e')]);_0x828efc[_0x223c('0x30')]=_[_0x223c('0x31')](_0x4e5435['model'],qs['fields'](_0x5c9e14[_0x223c('0x2e')][_0x223c('0x32')]));_0x828efc[_0x223c('0x30')]=_0x828efc[_0x223c('0x30')][_0x223c('0x33')]?_0x828efc[_0x223c('0x30')]:_0x4e5435['model'];if(!_0x5c9e14['query'][_0x223c('0x34')]('nolimit')){_0x828efc['limit']=qs[_0x223c('0x18')](_0x5c9e14[_0x223c('0x2e')][_0x223c('0x18')]);_0x828efc['offset']=qs[_0x223c('0x17')](_0x5c9e14[_0x223c('0x2e')][_0x223c('0x17')]);}_0x828efc[_0x223c('0x35')]=qs[_0x223c('0x36')](_0x5c9e14[_0x223c('0x2e')][_0x223c('0x36')]);_0x828efc[_0x223c('0x37')]=qs[_0x223c('0x2f')](_[_0x223c('0x38')](_0x5c9e14[_0x223c('0x2e')],_0x4e5435[_0x223c('0x2f')]),_0x5a7cf2);if(_0x5c9e14[_0x223c('0x2e')][_0x223c('0x39')]){_0x828efc[_0x223c('0x37')]=_[_0x223c('0x3a')](_0x828efc['where'],{'$or':_[_0x223c('0x27')](_0x5a7cf2,function(_0x147ac8){if(_0x147ac8[_0x223c('0x2b')]!==_0x223c('0x3b')){var _0x5b75eb={};_0x5b75eb[_0x147ac8['name']]={'$like':'%'+_0x5c9e14[_0x223c('0x2e')][_0x223c('0x39')]+'%'};return _0x5b75eb;}})});}_0x828efc=_[_0x223c('0x3a')]({},_0x828efc,_0x5c9e14[_0x223c('0x3c')]);var _0xb15f22={'where':_0x828efc[_0x223c('0x37')]};return db[_0x223c('0x28')][_0x223c('0x19')](_0xb15f22)[_0x223c('0x21')](function(_0x45877f){_0x397b53['count']=_0x45877f;if(_0x5c9e14[_0x223c('0x2e')][_0x223c('0x3d')]){_0x828efc[_0x223c('0x3e')]=[{'all':!![]}];}return db[_0x223c('0x28')][_0x223c('0x3f')](_0x828efc);})[_0x223c('0x21')](function(_0x1b039d){_0x397b53[_0x223c('0x40')]=_0x1b039d;return _0x397b53;})['then'](respondWithFilteredResult(_0x1c9491,_0x828efc))[_0x223c('0x41')](handleError(_0x1c9491,null));};exports[_0x223c('0x42')]=function(_0x47707a,_0x24e4dd){var _0x320c81={'raw':!![],'where':{'id':_0x47707a['params']['id']}},_0x19692a={};_0x19692a['model']=_[_0x223c('0x2d')](db['JscriptyQuestionReport'][_0x223c('0x29')]);_0x19692a[_0x223c('0x2e')]=_[_0x223c('0x2d')](_0x47707a[_0x223c('0x2e')]);_0x19692a[_0x223c('0x2f')]=_[_0x223c('0x31')](_0x19692a['model'],_0x19692a['query']);_0x320c81[_0x223c('0x30')]=_['intersection'](_0x19692a[_0x223c('0x2c')],qs['fields'](_0x47707a[_0x223c('0x2e')][_0x223c('0x32')]));_0x320c81[_0x223c('0x30')]=_0x320c81[_0x223c('0x30')][_0x223c('0x33')]?_0x320c81[_0x223c('0x30')]:_0x19692a[_0x223c('0x2c')];if(_0x47707a[_0x223c('0x2e')][_0x223c('0x3d')]){_0x320c81[_0x223c('0x3e')]=[{'all':!![]}];}_0x320c81=_[_0x223c('0x3a')]({},_0x320c81,_0x47707a['options']);return db['JscriptyQuestionReport'][_0x223c('0x43')](_0x320c81)[_0x223c('0x21')](handleEntityNotFound(_0x24e4dd,null))['then'](respondWithResult(_0x24e4dd,null))[_0x223c('0x41')](handleError(_0x24e4dd,null));};exports[_0x223c('0x44')]=function(_0x555ff5,_0x849e0d){return db[_0x223c('0x28')][_0x223c('0x44')](_0x555ff5['body'],{})[_0x223c('0x21')](respondWithResult(_0x849e0d,0xc9))[_0x223c('0x41')](handleError(_0x849e0d,null));};exports[_0x223c('0x20')]=function(_0x1b5945,_0x1a6d84){if(_0x1b5945[_0x223c('0x45')]['id']){delete _0x1b5945['body']['id'];}return db[_0x223c('0x28')][_0x223c('0x43')]({'where':{'id':_0x1b5945[_0x223c('0x46')]['id']}})[_0x223c('0x21')](handleEntityNotFound(_0x1a6d84,null))['then'](saveUpdates(_0x1b5945[_0x223c('0x45')],null))[_0x223c('0x21')](respondWithResult(_0x1a6d84,null))[_0x223c('0x41')](handleError(_0x1a6d84,null));};exports[_0x223c('0x47')]=function(_0x1262f9,_0x3fcc81){return db[_0x223c('0x28')][_0x223c('0x43')]({'where':{'id':_0x1262f9['params']['id']}})[_0x223c('0x21')](handleEntityNotFound(_0x3fcc81,null))['then'](removeEntity(_0x3fcc81,null))[_0x223c('0x41')](handleError(_0x3fcc81,null));};exports[_0x223c('0x48')]=function(_0x90e476,_0x2d0d0a){return db[_0x223c('0x28')][_0x223c('0x48')]()[_0x223c('0x21')](respondWithResult(_0x2d0d0a,null))['catch'](handleError(_0x2d0d0a,null));}; \ No newline at end of file +var _0xe424=['then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','JscriptyQuestionReport','include','rows','catch','show','params','includeAll','find','create','body','describe','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update'];(function(_0x5a6bdc,_0x46d896){var _0x1218d8=function(_0x111dac){while(--_0x111dac){_0x5a6bdc['push'](_0x5a6bdc['shift']());}};_0x1218d8(++_0x46d896);}(_0xe424,0xf8));var _0x4e42=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xe424[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4e42('0x0'));var rp=require(_0x4e42('0x1'));var moment=require(_0x4e42('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4e42('0x3'));var path=require('path');var sox=require(_0x4e42('0x4'));var csv=require(_0x4e42('0x5'));var ejs=require(_0x4e42('0x6'));var fs=require('fs');var fs_extra=require(_0x4e42('0x7'));var _=require(_0x4e42('0x8'));var squel=require(_0x4e42('0x9'));var crypto=require('crypto');var jsforce=require(_0x4e42('0xa'));var deskjs=require(_0x4e42('0xb'));var toCsv=require(_0x4e42('0x5'));var querystring=require('querystring');var Papa=require(_0x4e42('0xc'));var Redis=require(_0x4e42('0xd'));var authService=require(_0x4e42('0xe'));var qs=require(_0x4e42('0xf'));var as=require(_0x4e42('0x10'));var hardwareService=require(_0x4e42('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x4e42('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4e42('0x13'))['db'];function respondWithStatusCode(_0x285427,_0x46dc80){_0x46dc80=_0x46dc80||0xcc;return function(_0x5b8822){if(_0x5b8822){return _0x285427['sendStatus'](_0x46dc80);}return _0x285427[_0x4e42('0x14')](_0x46dc80)[_0x4e42('0x15')]();};}function respondWithResult(_0x8728a7,_0x2c9b14){_0x2c9b14=_0x2c9b14||0xc8;return function(_0x491be7){if(_0x491be7){return _0x8728a7[_0x4e42('0x14')](_0x2c9b14)[_0x4e42('0x16')](_0x491be7);}};}function respondWithFilteredResult(_0x2bae4b,_0x306cbc){return function(_0x4941ca){if(_0x4941ca){var _0x32fd45=typeof _0x306cbc['offset']===_0x4e42('0x17')&&typeof _0x306cbc['limit']==='undefined';var _0x4336de=_0x4941ca[_0x4e42('0x18')];var _0x1a9287=_0x32fd45?0x0:_0x306cbc[_0x4e42('0x19')];var _0x5ddf18=_0x32fd45?_0x4941ca['count']:_0x306cbc['offset']+_0x306cbc[_0x4e42('0x1a')];var _0x258c65;if(_0x5ddf18>=_0x4336de){_0x5ddf18=_0x4336de;_0x258c65=0xc8;}else{_0x258c65=0xce;}_0x2bae4b[_0x4e42('0x14')](_0x258c65);return _0x2bae4b['set'](_0x4e42('0x1b'),_0x1a9287+'-'+_0x5ddf18+'/'+_0x4336de)[_0x4e42('0x16')](_0x4941ca);}return null;};}function patchUpdates(_0x926a5a){return function(_0x5ddd69){try{jsonpatch[_0x4e42('0x1c')](_0x5ddd69,_0x926a5a,!![]);}catch(_0x36b724){return BPromise[_0x4e42('0x1d')](_0x36b724);}return _0x5ddd69[_0x4e42('0x1e')]();};}function saveUpdates(_0x45ab5c,_0x103cb9){return function(_0xe2505a){if(_0xe2505a){return _0xe2505a[_0x4e42('0x1f')](_0x45ab5c)[_0x4e42('0x20')](function(_0x5ce48f){return _0x5ce48f;});}return null;};}function removeEntity(_0xc25dfd,_0x2aa961){return function(_0x454aa6){if(_0x454aa6){return _0x454aa6[_0x4e42('0x21')]()[_0x4e42('0x20')](function(){_0xc25dfd[_0x4e42('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d249f,_0x58d70c){return function(_0x383fd8){if(!_0x383fd8){_0x3d249f[_0x4e42('0x22')](0x194);}return _0x383fd8;};}function handleError(_0x4e56a1,_0x1a7a3d){_0x1a7a3d=_0x1a7a3d||0x1f4;return function(_0x2bbe69){logger[_0x4e42('0x23')](_0x2bbe69[_0x4e42('0x24')]);if(_0x2bbe69[_0x4e42('0x25')]){delete _0x2bbe69['name'];}_0x4e56a1[_0x4e42('0x14')](_0x1a7a3d)[_0x4e42('0x26')](_0x2bbe69);};}exports[_0x4e42('0x27')]=function(_0x41cbf7,_0x52f75f){var _0x1b482a={},_0x4091bd={},_0x15f080={'count':0x0,'rows':[]};var _0x1b09e2=_[_0x4e42('0x28')](db['JscriptyQuestionReport'][_0x4e42('0x29')],function(_0x4dca15){return{'name':_0x4dca15['fieldName'],'type':_0x4dca15[_0x4e42('0x2a')]['key']};});_0x4091bd['model']=_[_0x4e42('0x28')](_0x1b09e2,'name');_0x4091bd[_0x4e42('0x2b')]=_[_0x4e42('0x2c')](_0x41cbf7['query']);_0x4091bd[_0x4e42('0x2d')]=_[_0x4e42('0x2e')](_0x4091bd[_0x4e42('0x2f')],_0x4091bd[_0x4e42('0x2b')]);_0x1b482a[_0x4e42('0x30')]=_[_0x4e42('0x2e')](_0x4091bd[_0x4e42('0x2f')],qs[_0x4e42('0x31')](_0x41cbf7['query'][_0x4e42('0x31')]));_0x1b482a['attributes']=_0x1b482a['attributes'][_0x4e42('0x32')]?_0x1b482a[_0x4e42('0x30')]:_0x4091bd[_0x4e42('0x2f')];if(!_0x41cbf7[_0x4e42('0x2b')][_0x4e42('0x33')](_0x4e42('0x34'))){_0x1b482a[_0x4e42('0x1a')]=qs[_0x4e42('0x1a')](_0x41cbf7[_0x4e42('0x2b')][_0x4e42('0x1a')]);_0x1b482a[_0x4e42('0x19')]=qs[_0x4e42('0x19')](_0x41cbf7['query'][_0x4e42('0x19')]);}_0x1b482a[_0x4e42('0x35')]=qs['sort'](_0x41cbf7[_0x4e42('0x2b')][_0x4e42('0x36')]);_0x1b482a[_0x4e42('0x37')]=qs['filters'](_['pick'](_0x41cbf7[_0x4e42('0x2b')],_0x4091bd[_0x4e42('0x2d')]),_0x1b09e2);if(_0x41cbf7[_0x4e42('0x2b')][_0x4e42('0x38')]){_0x1b482a[_0x4e42('0x37')]=_[_0x4e42('0x39')](_0x1b482a[_0x4e42('0x37')],{'$or':_[_0x4e42('0x28')](_0x1b09e2,function(_0x7ea1c7){if(_0x7ea1c7['type']!=='VIRTUAL'){var _0x10f8b6={};_0x10f8b6[_0x7ea1c7[_0x4e42('0x25')]]={'$like':'%'+_0x41cbf7[_0x4e42('0x2b')][_0x4e42('0x38')]+'%'};return _0x10f8b6;}})});}_0x1b482a=_[_0x4e42('0x39')]({},_0x1b482a,_0x41cbf7[_0x4e42('0x3a')]);var _0x4fdfd2={'where':_0x1b482a[_0x4e42('0x37')]};return db[_0x4e42('0x3b')][_0x4e42('0x18')](_0x4fdfd2)[_0x4e42('0x20')](function(_0xb55833){_0x15f080['count']=_0xb55833;if(_0x41cbf7[_0x4e42('0x2b')]['includeAll']){_0x1b482a[_0x4e42('0x3c')]=[{'all':!![]}];}return db[_0x4e42('0x3b')]['findAll'](_0x1b482a);})['then'](function(_0x3fb90b){_0x15f080[_0x4e42('0x3d')]=_0x3fb90b;return _0x15f080;})[_0x4e42('0x20')](respondWithFilteredResult(_0x52f75f,_0x1b482a))[_0x4e42('0x3e')](handleError(_0x52f75f,null));};exports[_0x4e42('0x3f')]=function(_0xda3d77,_0x314935){var _0x18b57a={'raw':!![],'where':{'id':_0xda3d77[_0x4e42('0x40')]['id']}},_0x19af6b={};_0x19af6b[_0x4e42('0x2f')]=_[_0x4e42('0x2c')](db[_0x4e42('0x3b')]['rawAttributes']);_0x19af6b[_0x4e42('0x2b')]=_[_0x4e42('0x2c')](_0xda3d77['query']);_0x19af6b[_0x4e42('0x2d')]=_[_0x4e42('0x2e')](_0x19af6b[_0x4e42('0x2f')],_0x19af6b[_0x4e42('0x2b')]);_0x18b57a[_0x4e42('0x30')]=_[_0x4e42('0x2e')](_0x19af6b['model'],qs['fields'](_0xda3d77[_0x4e42('0x2b')][_0x4e42('0x31')]));_0x18b57a['attributes']=_0x18b57a[_0x4e42('0x30')]['length']?_0x18b57a[_0x4e42('0x30')]:_0x19af6b[_0x4e42('0x2f')];if(_0xda3d77['query'][_0x4e42('0x41')]){_0x18b57a[_0x4e42('0x3c')]=[{'all':!![]}];}_0x18b57a=_[_0x4e42('0x39')]({},_0x18b57a,_0xda3d77[_0x4e42('0x3a')]);return db[_0x4e42('0x3b')][_0x4e42('0x42')](_0x18b57a)[_0x4e42('0x20')](handleEntityNotFound(_0x314935,null))['then'](respondWithResult(_0x314935,null))[_0x4e42('0x3e')](handleError(_0x314935,null));};exports[_0x4e42('0x43')]=function(_0x487d67,_0x38bebc){return db[_0x4e42('0x3b')][_0x4e42('0x43')](_0x487d67[_0x4e42('0x44')],{})[_0x4e42('0x20')](respondWithResult(_0x38bebc,0xc9))[_0x4e42('0x3e')](handleError(_0x38bebc,null));};exports['update']=function(_0x3e89e4,_0x2d1e2d){if(_0x3e89e4[_0x4e42('0x44')]['id']){delete _0x3e89e4[_0x4e42('0x44')]['id'];}return db[_0x4e42('0x3b')][_0x4e42('0x42')]({'where':{'id':_0x3e89e4[_0x4e42('0x40')]['id']}})[_0x4e42('0x20')](handleEntityNotFound(_0x2d1e2d,null))['then'](saveUpdates(_0x3e89e4[_0x4e42('0x44')],null))[_0x4e42('0x20')](respondWithResult(_0x2d1e2d,null))[_0x4e42('0x3e')](handleError(_0x2d1e2d,null));};exports[_0x4e42('0x21')]=function(_0x47d2c,_0x796d50){return db[_0x4e42('0x3b')][_0x4e42('0x42')]({'where':{'id':_0x47d2c['params']['id']}})[_0x4e42('0x20')](handleEntityNotFound(_0x796d50,null))[_0x4e42('0x20')](removeEntity(_0x796d50,null))[_0x4e42('0x3e')](handleError(_0x796d50,null));};exports['describe']=function(_0x3f6d79,_0x25f5b1){return db[_0x4e42('0x3b')][_0x4e42('0x45')]()[_0x4e42('0x20')](respondWithResult(_0x25f5b1,null))[_0x4e42('0x3e')](handleError(_0x25f5b1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index f04a190..4ffbede 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 _0x4c8e=['report_jscripty_questions','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c8e,0x17d));var _0xe4c8=function(_0x262baa,_0x283058){_0x262baa=_0x262baa-0x0;var _0x4f2257=_0x4c8e[_0x262baa];return _0x4f2257;};'use strict';var _=require(_0xe4c8('0x0'));var util=require(_0xe4c8('0x1'));var logger=require(_0xe4c8('0x2'))(_0xe4c8('0x3'));var moment=require('moment');var BPromise=require(_0xe4c8('0x4'));var rp=require(_0xe4c8('0x5'));var fs=require('fs');var path=require(_0xe4c8('0x6'));var rimraf=require('rimraf');var config=require(_0xe4c8('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xe4c8('0x8')]=function(_0x15eb21,_0x4ec27c){return _0x15eb21['define']('JscriptyQuestionReport',attributes,{'tableName':_0xe4c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x719d=['../../config/environment','./jscriptyQuestionReport.attributes','exports','report_jscripty_questions','util','../../config/logger','api','bluebird','rimraf'];(function(_0x428c50,_0x49dc7a){var _0x3779b6=function(_0x2f1274){while(--_0x2f1274){_0x428c50['push'](_0x428c50['shift']());}};_0x3779b6(++_0x49dc7a);}(_0x719d,0xca));var _0xd719=function(_0x9fea2a,_0x57100d){_0x9fea2a=_0x9fea2a-0x0;var _0x379db0=_0x719d[_0x9fea2a];return _0x379db0;};'use strict';var _=require('lodash');var util=require(_0xd719('0x0'));var logger=require(_0xd719('0x1'))(_0xd719('0x2'));var moment=require('moment');var BPromise=require(_0xd719('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd719('0x4'));var config=require(_0xd719('0x5'));var attributes=require(_0xd719('0x6'));module[_0xd719('0x7')]=function(_0x515bfc,_0x5c28d1){return _0x515bfc['define']('JscriptyQuestionReport',attributes,{'tableName':_0xd719('0x8'),'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 ffa019c..cf5aed5 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 _0x9eca=['info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2d661e,_0x4bfe70){var _0x4c1d7e=function(_0x550322){while(--_0x550322){_0x2d661e['push'](_0x2d661e['shift']());}};_0x4c1d7e(++_0x4bfe70);}(_0x9eca,0x66));var _0xa9ec=function(_0x5d1f9a,_0x3c75fd){_0x5d1f9a=_0x5d1f9a-0x0;var _0x864ff7=_0x9eca[_0x5d1f9a];return _0x864ff7;};'use strict';var _=require(_0xa9ec('0x0'));var util=require('util');var moment=require(_0xa9ec('0x1'));var BPromise=require(_0xa9ec('0x2'));var rs=require(_0xa9ec('0x3'));var fs=require('fs');var Redis=require(_0xa9ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9ec('0x5'));var logger=require(_0xa9ec('0x6'))(_0xa9ec('0x7'));var config=require(_0xa9ec('0x8'));var jayson=require(_0xa9ec('0x9'));var client=jayson['client'][_0xa9ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18a2a8,_0x49a32c,_0x507f9e){return new BPromise(function(_0x4499d9,_0x275576){return client[_0xa9ec('0xb')](_0x18a2a8,_0x507f9e)[_0xa9ec('0xc')](function(_0x3fe28c){logger[_0xa9ec('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x49a32c,_0xa9ec('0xe'));logger[_0xa9ec('0xf')](_0xa9ec('0x10'),_0x49a32c,_0xa9ec('0xe'),JSON[_0xa9ec('0x11')](_0x3fe28c));if(_0x3fe28c[_0xa9ec('0x12')]){if(_0x3fe28c[_0xa9ec('0x12')][_0xa9ec('0x13')]===0x1f4){logger['error'](_0xa9ec('0x14'),_0x49a32c,_0x3fe28c[_0xa9ec('0x12')][_0xa9ec('0x15')]);return _0x275576(_0x3fe28c['error'][_0xa9ec('0x15')]);}logger['error'](_0xa9ec('0x14'),_0x49a32c,_0x3fe28c[_0xa9ec('0x12')]['message']);return _0x4499d9(_0x3fe28c[_0xa9ec('0x12')][_0xa9ec('0x15')]);}else{logger[_0xa9ec('0xd')](_0xa9ec('0x14'),_0x49a32c,'request\x20sent');_0x4499d9(_0x3fe28c['result']['message']);}})[_0xa9ec('0x16')](function(_0x2a947b){logger[_0xa9ec('0x12')](_0xa9ec('0x14'),_0x49a32c,_0x2a947b);_0x275576(_0x2a947b);});});} \ No newline at end of file +var _0x43f6=['message','error','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x515a50,_0x51e170){var _0x592a66=function(_0x3f78aa){while(--_0x3f78aa){_0x515a50['push'](_0x515a50['shift']());}};_0x592a66(++_0x51e170);}(_0x43f6,0x12a));var _0x643f=function(_0x5c918d,_0x1ca4a7){_0x5c918d=_0x5c918d-0x0;var _0x3c4d98=_0x43f6[_0x5c918d];return _0x3c4d98;};'use strict';var _=require(_0x643f('0x0'));var util=require(_0x643f('0x1'));var moment=require(_0x643f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x643f('0x3'));var db=require(_0x643f('0x4'))['db'];var utils=require(_0x643f('0x5'));var logger=require(_0x643f('0x6'))(_0x643f('0x7'));var config=require(_0x643f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x643f('0x9')][_0x643f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cca27,_0x4d51af,_0x46b542){return new BPromise(function(_0x36414e,_0x78ce6c){return client[_0x643f('0xb')](_0x2cca27,_0x46b542)[_0x643f('0xc')](function(_0x36cf42){logger[_0x643f('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4d51af,_0x643f('0xe'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x4d51af,'request\x20sent',JSON[_0x643f('0xf')](_0x36cf42));if(_0x36cf42['error']){if(_0x36cf42['error']['code']===0x1f4){logger['error'](_0x643f('0x10'),_0x4d51af,_0x36cf42['error'][_0x643f('0x11')]);return _0x78ce6c(_0x36cf42[_0x643f('0x12')][_0x643f('0x11')]);}logger['error'](_0x643f('0x10'),_0x4d51af,_0x36cf42[_0x643f('0x12')][_0x643f('0x11')]);return _0x36414e(_0x36cf42[_0x643f('0x12')][_0x643f('0x11')]);}else{logger[_0x643f('0xd')](_0x643f('0x10'),_0x4d51af,_0x643f('0xe'));_0x36414e(_0x36cf42[_0x643f('0x13')]['message']);}})[_0x643f('0x14')](function(_0x1ab388){logger[_0x643f('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4d51af,_0x1ab388);_0x78ce6c(_0x1ab388);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4eca33c..dab9b48 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 _0x0b1a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','show','/:id/questions','getQuestions','post','put','/:id','delete','destroy','exports','multer','util','connect-timeout'];(function(_0xcb285b,_0xd0c94a){var _0xf4af46=function(_0x187add){while(--_0x187add){_0xcb285b['push'](_0xcb285b['shift']());}};_0xf4af46(++_0xd0c94a);}(_0x0b1a,0xfa));var _0xa0b1=function(_0x2ee94f,_0x2066e9){_0x2ee94f=_0x2ee94f-0x0;var _0x5845db=_0x0b1a[_0x2ee94f];return _0x5845db;};'use strict';var multer=require(_0xa0b1('0x0'));var util=require(_0xa0b1('0x1'));var path=require('path');var timeout=require(_0xa0b1('0x2'));var express=require(_0xa0b1('0x3'));var router=express[_0xa0b1('0x4')]();var fs_extra=require(_0xa0b1('0x5'));var auth=require(_0xa0b1('0x6'));var interaction=require(_0xa0b1('0x7'));var config=require(_0xa0b1('0x8'));var controller=require(_0xa0b1('0x9'));router[_0xa0b1('0xa')]('/',auth[_0xa0b1('0xb')](),controller[_0xa0b1('0xc')]);router[_0xa0b1('0xa')]('/describe',auth[_0xa0b1('0xb')](),controller[_0xa0b1('0xd')]);router['get']('/:id',auth[_0xa0b1('0xb')](),controller[_0xa0b1('0xe')]);router[_0xa0b1('0xa')](_0xa0b1('0xf'),auth[_0xa0b1('0xb')](),controller[_0xa0b1('0x10')]);router[_0xa0b1('0x11')]('/',auth[_0xa0b1('0xb')](),controller['create']);router[_0xa0b1('0x12')](_0xa0b1('0x13'),auth[_0xa0b1('0xb')](),controller['update']);router[_0xa0b1('0x14')](_0xa0b1('0x13'),auth[_0xa0b1('0xb')](),controller[_0xa0b1('0x15')]);module[_0xa0b1('0x16')]=router; \ No newline at end of file +var _0x2e8e=['/:id/questions','getQuestions','post','create','put','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2e8e,0x181));var _0xe2e8=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0x2e8e[_0x12aaee];return _0x37c350;};'use strict';var multer=require('multer');var util=require(_0xe2e8('0x0'));var path=require('path');var timeout=require(_0xe2e8('0x1'));var express=require(_0xe2e8('0x2'));var router=express[_0xe2e8('0x3')]();var fs_extra=require(_0xe2e8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe2e8('0x5'));var config=require(_0xe2e8('0x6'));var controller=require(_0xe2e8('0x7'));router[_0xe2e8('0x8')]('/',auth[_0xe2e8('0x9')](),controller[_0xe2e8('0xa')]);router[_0xe2e8('0x8')](_0xe2e8('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe2e8('0x8')](_0xe2e8('0xc'),auth['isAuthenticated'](),controller[_0xe2e8('0xd')]);router['get'](_0xe2e8('0xe'),auth['isAuthenticated'](),controller[_0xe2e8('0xf')]);router[_0xe2e8('0x10')]('/',auth['isAuthenticated'](),controller[_0xe2e8('0x11')]);router[_0xe2e8('0x12')](_0xe2e8('0xc'),auth[_0xe2e8('0x9')](),controller[_0xe2e8('0x13')]);router['delete'](_0xe2e8('0xc'),auth[_0xe2e8('0x9')](),controller['destroy']);module[_0xe2e8('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 462ea61..89cdc4c 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 _0xfa63=['DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xfa63,0xf0));var _0x3fa6=function(_0x59f355,_0x488cc0){_0x59f355=_0x59f355-0x0;var _0x15498f=_0xfa63[_0x59f355];return _0x15498f;};'use strict';var moment=require(_0x3fa6('0x0'));var Sequelize=require(_0x3fa6('0x1'));module[_0x3fa6('0x2')]={'starttime':{'type':Sequelize[_0x3fa6('0x3')],'set':function(_0x59acc5){this[_0x3fa6('0x4')]('starttime',_0x59acc5);this['setDataValue'](_0x3fa6('0x5'),moment()['format'](_0x3fa6('0x6')));}},'endtime':{'type':Sequelize[_0x3fa6('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x3fa6('0x7')]},'queue':{'type':Sequelize[_0x3fa6('0x7')]},'uniqueid':{'type':Sequelize[_0x3fa6('0x7')]},'calleridname':{'type':Sequelize[_0x3fa6('0x7')]},'calleridnum':{'type':Sequelize[_0x3fa6('0x7')]},'completed':{'type':Sequelize[_0x3fa6('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xb8cd=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','starttime','setDataValue','format'];(function(_0x31ea5d,_0x19ecdd){var _0x2d9985=function(_0xa90f2d){while(--_0xa90f2d){_0x31ea5d['push'](_0x31ea5d['shift']());}};_0x2d9985(++_0x19ecdd);}(_0xb8cd,0x1d9));var _0xdb8c=function(_0x303dbc,_0x23de7c){_0x303dbc=_0x303dbc-0x0;var _0x262078=_0xb8cd[_0x303dbc];return _0x262078;};'use strict';var moment=require(_0xdb8c('0x0'));var Sequelize=require(_0xdb8c('0x1'));module[_0xdb8c('0x2')]={'starttime':{'type':Sequelize[_0xdb8c('0x3')],'set':function(_0x10354b){this['setDataValue'](_0xdb8c('0x4'),_0x10354b);this[_0xdb8c('0x5')]('endtime',moment()[_0xdb8c('0x6')](_0xdb8c('0x7')));}},'endtime':{'type':Sequelize[_0xdb8c('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xdb8c('0x8')]},'queue':{'type':Sequelize[_0xdb8c('0x8')]},'uniqueid':{'type':Sequelize[_0xdb8c('0x8')]},'calleridname':{'type':Sequelize[_0xdb8c('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xdb8c('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 24c8bfb..6e5c236 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 _0xf47c=['util','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','map','JscriptySessionReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','options','count','include','findAll','rows','catch','show','params','create','body','update','find','describe','getQuestions','JscriptyQuestionReport','hasOwnProperty','SessionId','includeAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0xf47c,0x176));var _0xcf47=function(_0x40df80,_0x19d0a6){_0x40df80=_0x40df80-0x0;var _0x5e14e0=_0xf47c[_0x40df80];return _0x5e14e0;};'use strict';var emlformat=require(_0xcf47('0x0'));var rimraf=require(_0xcf47('0x1'));var zipdir=require(_0xcf47('0x2'));var jsonpatch=require(_0xcf47('0x3'));var rp=require(_0xcf47('0x4'));var moment=require('moment');var BPromise=require(_0xcf47('0x5'));var Mustache=require('mustache');var util=require(_0xcf47('0x6'));var path=require(_0xcf47('0x7'));var sox=require(_0xcf47('0x8'));var csv=require(_0xcf47('0x9'));var ejs=require(_0xcf47('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf47('0xb'));var squel=require('squel');var crypto=require(_0xcf47('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcf47('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcf47('0xe'));var authService=require(_0xcf47('0xf'));var qs=require(_0xcf47('0x10'));var as=require(_0xcf47('0x11'));var hardwareService=require(_0xcf47('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xcf47('0x13'));var licenseUtil=require(_0xcf47('0x14'));var db=require(_0xcf47('0x15'))['db'];function respondWithStatusCode(_0x3e04a2,_0x20e9a0){_0x20e9a0=_0x20e9a0||0xcc;return function(_0x56616e){if(_0x56616e){return _0x3e04a2[_0xcf47('0x16')](_0x20e9a0);}return _0x3e04a2[_0xcf47('0x17')](_0x20e9a0)[_0xcf47('0x18')]();};}function respondWithResult(_0x55792b,_0x758baf){_0x758baf=_0x758baf||0xc8;return function(_0x204826){if(_0x204826){return _0x55792b[_0xcf47('0x17')](_0x758baf)['json'](_0x204826);}};}function respondWithFilteredResult(_0x11238d,_0x411456){return function(_0x13a432){if(_0x13a432){var _0x2efd6e=typeof _0x411456[_0xcf47('0x19')]==='undefined'&&typeof _0x411456['limit']===_0xcf47('0x1a');var _0x1a9a52=_0x13a432['count'];var _0x11c194=_0x2efd6e?0x0:_0x411456['offset'];var _0x3a2e4b=_0x2efd6e?_0x13a432['count']:_0x411456[_0xcf47('0x19')]+_0x411456['limit'];var _0x1d33ef;if(_0x3a2e4b>=_0x1a9a52){_0x3a2e4b=_0x1a9a52;_0x1d33ef=0xc8;}else{_0x1d33ef=0xce;}_0x11238d[_0xcf47('0x17')](_0x1d33ef);return _0x11238d[_0xcf47('0x1b')](_0xcf47('0x1c'),_0x11c194+'-'+_0x3a2e4b+'/'+_0x1a9a52)[_0xcf47('0x1d')](_0x13a432);}return null;};}function patchUpdates(_0x16a1fa){return function(_0x10992b){try{jsonpatch['apply'](_0x10992b,_0x16a1fa,!![]);}catch(_0x11d9ac){return BPromise[_0xcf47('0x1e')](_0x11d9ac);}return _0x10992b[_0xcf47('0x1f')]();};}function saveUpdates(_0x34c741,_0x29a6ac){return function(_0x855e2c){if(_0x855e2c){return _0x855e2c['update'](_0x34c741)[_0xcf47('0x20')](function(_0x45755b){return _0x45755b;});}return null;};}function removeEntity(_0x1fdf6f,_0x25794a){return function(_0x5da4a2){if(_0x5da4a2){return _0x5da4a2[_0xcf47('0x21')]()['then'](function(){_0x1fdf6f[_0xcf47('0x17')](0xcc)[_0xcf47('0x18')]();});}};}function handleEntityNotFound(_0x34825b,_0x1f7a61){return function(_0x113b61){if(!_0x113b61){_0x34825b[_0xcf47('0x16')](0x194);}return _0x113b61;};}function handleError(_0x2eca69,_0x5160ca){_0x5160ca=_0x5160ca||0x1f4;return function(_0x24c4ff){logger[_0xcf47('0x22')](_0x24c4ff[_0xcf47('0x23')]);if(_0x24c4ff[_0xcf47('0x24')]){delete _0x24c4ff['name'];}_0x2eca69[_0xcf47('0x17')](_0x5160ca)[_0xcf47('0x25')](_0x24c4ff);};}exports['index']=function(_0xaab606,_0x42b2a9){var _0x10bde2={},_0x2a8bc9={},_0x13e141={'count':0x0,'rows':[]};var _0x20e65c=_[_0xcf47('0x26')](db[_0xcf47('0x27')][_0xcf47('0x28')],function(_0x393b8d){return{'name':_0x393b8d['fieldName'],'type':_0x393b8d[_0xcf47('0x29')]['key']};});_0x2a8bc9[_0xcf47('0x2a')]=_[_0xcf47('0x26')](_0x20e65c,_0xcf47('0x24'));_0x2a8bc9['query']=_[_0xcf47('0x2b')](_0xaab606[_0xcf47('0x2c')]);_0x2a8bc9[_0xcf47('0x2d')]=_[_0xcf47('0x2e')](_0x2a8bc9['model'],_0x2a8bc9['query']);_0x10bde2[_0xcf47('0x2f')]=_['intersection'](_0x2a8bc9[_0xcf47('0x2a')],qs[_0xcf47('0x30')](_0xaab606[_0xcf47('0x2c')]['fields']));_0x10bde2[_0xcf47('0x2f')]=_0x10bde2[_0xcf47('0x2f')][_0xcf47('0x31')]?_0x10bde2['attributes']:_0x2a8bc9[_0xcf47('0x2a')];if(!_0xaab606['query']['hasOwnProperty'](_0xcf47('0x32'))){_0x10bde2[_0xcf47('0x33')]=qs[_0xcf47('0x33')](_0xaab606[_0xcf47('0x2c')][_0xcf47('0x33')]);_0x10bde2[_0xcf47('0x19')]=qs[_0xcf47('0x19')](_0xaab606[_0xcf47('0x2c')][_0xcf47('0x19')]);}_0x10bde2[_0xcf47('0x34')]=qs[_0xcf47('0x35')](_0xaab606[_0xcf47('0x2c')][_0xcf47('0x35')]);_0x10bde2['where']=qs[_0xcf47('0x2d')](_[_0xcf47('0x36')](_0xaab606['query'],_0x2a8bc9[_0xcf47('0x2d')]),_0x20e65c);if(_0xaab606['query'][_0xcf47('0x37')]){_0x10bde2[_0xcf47('0x38')]=_[_0xcf47('0x39')](_0x10bde2[_0xcf47('0x38')],{'$or':_[_0xcf47('0x26')](_0x20e65c,function(_0x59f032){if(_0x59f032[_0xcf47('0x29')]!=='VIRTUAL'){var _0x45485d={};_0x45485d[_0x59f032['name']]={'$like':'%'+_0xaab606[_0xcf47('0x2c')]['filter']+'%'};return _0x45485d;}})});}_0x10bde2=_[_0xcf47('0x39')]({},_0x10bde2,_0xaab606[_0xcf47('0x3a')]);var _0x20021e={'where':_0x10bde2[_0xcf47('0x38')]};return db[_0xcf47('0x27')][_0xcf47('0x3b')](_0x20021e)[_0xcf47('0x20')](function(_0x36f466){_0x13e141[_0xcf47('0x3b')]=_0x36f466;if(_0xaab606['query']['includeAll']){_0x10bde2[_0xcf47('0x3c')]=[{'all':!![]}];}return db[_0xcf47('0x27')][_0xcf47('0x3d')](_0x10bde2);})[_0xcf47('0x20')](function(_0x2ec22d){_0x13e141[_0xcf47('0x3e')]=_0x2ec22d;return _0x13e141;})[_0xcf47('0x20')](respondWithFilteredResult(_0x42b2a9,_0x10bde2))[_0xcf47('0x3f')](handleError(_0x42b2a9,null));};exports[_0xcf47('0x40')]=function(_0x30b1c4,_0x157396){var _0x203c9d={'raw':!![],'where':{'id':_0x30b1c4[_0xcf47('0x41')]['id']}},_0x53ad29={};_0x53ad29[_0xcf47('0x2a')]=_[_0xcf47('0x2b')](db[_0xcf47('0x27')][_0xcf47('0x28')]);_0x53ad29[_0xcf47('0x2c')]=_[_0xcf47('0x2b')](_0x30b1c4[_0xcf47('0x2c')]);_0x53ad29[_0xcf47('0x2d')]=_['intersection'](_0x53ad29['model'],_0x53ad29[_0xcf47('0x2c')]);_0x203c9d[_0xcf47('0x2f')]=_[_0xcf47('0x2e')](_0x53ad29[_0xcf47('0x2a')],qs[_0xcf47('0x30')](_0x30b1c4[_0xcf47('0x2c')][_0xcf47('0x30')]));_0x203c9d[_0xcf47('0x2f')]=_0x203c9d[_0xcf47('0x2f')][_0xcf47('0x31')]?_0x203c9d['attributes']:_0x53ad29[_0xcf47('0x2a')];if(_0x30b1c4[_0xcf47('0x2c')]['includeAll']){_0x203c9d[_0xcf47('0x3c')]=[{'all':!![]}];}_0x203c9d=_['merge']({},_0x203c9d,_0x30b1c4['options']);return db[_0xcf47('0x27')]['find'](_0x203c9d)[_0xcf47('0x20')](handleEntityNotFound(_0x157396,null))[_0xcf47('0x20')](respondWithResult(_0x157396,null))[_0xcf47('0x3f')](handleError(_0x157396,null));};exports['create']=function(_0x55f845,_0x3d0cb2){return db[_0xcf47('0x27')][_0xcf47('0x42')](_0x55f845[_0xcf47('0x43')],{})[_0xcf47('0x20')](respondWithResult(_0x3d0cb2,0xc9))[_0xcf47('0x3f')](handleError(_0x3d0cb2,null));};exports[_0xcf47('0x44')]=function(_0x50dca0,_0x5368b7){if(_0x50dca0[_0xcf47('0x43')]['id']){delete _0x50dca0[_0xcf47('0x43')]['id'];}return db['JscriptySessionReport'][_0xcf47('0x45')]({'where':{'id':_0x50dca0[_0xcf47('0x41')]['id']}})[_0xcf47('0x20')](handleEntityNotFound(_0x5368b7,null))[_0xcf47('0x20')](saveUpdates(_0x50dca0[_0xcf47('0x43')],null))['then'](respondWithResult(_0x5368b7,null))[_0xcf47('0x3f')](handleError(_0x5368b7,null));};exports['destroy']=function(_0x1ace13,_0x9a9557){return db[_0xcf47('0x27')][_0xcf47('0x45')]({'where':{'id':_0x1ace13[_0xcf47('0x41')]['id']}})[_0xcf47('0x20')](handleEntityNotFound(_0x9a9557,null))[_0xcf47('0x20')](removeEntity(_0x9a9557,null))[_0xcf47('0x3f')](handleError(_0x9a9557,null));};exports['describe']=function(_0x249e0f,_0x418a61){return db[_0xcf47('0x27')][_0xcf47('0x46')]()[_0xcf47('0x20')](respondWithResult(_0x418a61,null))[_0xcf47('0x3f')](handleError(_0x418a61,null));};exports[_0xcf47('0x47')]=function(_0x46c8be,_0x57fa18,_0x4b087b){var _0x32b5e0={'raw':!![],'where':{}};var _0x2f513b={};var _0x34fb9e={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x46c8be[_0xcf47('0x41')]['id']}})[_0xcf47('0x20')](handleEntityNotFound(_0x57fa18,null))[_0xcf47('0x20')](function(_0x5efdd5){if(_0x5efdd5){_0x2f513b['model']=_[_0xcf47('0x2b')](db[_0xcf47('0x48')][_0xcf47('0x28')]);_0x2f513b[_0xcf47('0x2c')]=_[_0xcf47('0x2b')](_0x46c8be[_0xcf47('0x2c')]);_0x2f513b['filters']=_[_0xcf47('0x2e')](_0x2f513b[_0xcf47('0x2a')],_0x2f513b[_0xcf47('0x2c')]);_0x32b5e0['attributes']=_['intersection'](_0x2f513b['model'],qs[_0xcf47('0x30')](_0x46c8be['query'][_0xcf47('0x30')]));_0x32b5e0[_0xcf47('0x2f')]=_0x32b5e0[_0xcf47('0x2f')][_0xcf47('0x31')]?_0x32b5e0[_0xcf47('0x2f')]:_0x2f513b[_0xcf47('0x2a')];if(!_0x46c8be[_0xcf47('0x2c')][_0xcf47('0x49')](_0xcf47('0x32'))){_0x32b5e0[_0xcf47('0x33')]=qs[_0xcf47('0x33')](_0x46c8be[_0xcf47('0x2c')]['limit']);_0x32b5e0[_0xcf47('0x19')]=qs[_0xcf47('0x19')](_0x46c8be['query'][_0xcf47('0x19')]);}_0x32b5e0[_0xcf47('0x34')]=qs['sort'](_0x46c8be[_0xcf47('0x2c')][_0xcf47('0x35')]);_0x32b5e0[_0xcf47('0x38')]=qs[_0xcf47('0x2d')](_[_0xcf47('0x36')](_0x46c8be[_0xcf47('0x2c')],_0x2f513b[_0xcf47('0x2d')]));_0x32b5e0[_0xcf47('0x38')][_0xcf47('0x4a')]=_0x5efdd5['id'];if(_0x46c8be[_0xcf47('0x2c')]['filter']){_0x32b5e0[_0xcf47('0x38')]=_['merge'](_0x32b5e0[_0xcf47('0x38')],{'$or':_['map'](_0x32b5e0[_0xcf47('0x2f')],function(_0x4b1bca){var _0x26a596={};_0x26a596[_0x4b1bca]={'$like':'%'+_0x46c8be[_0xcf47('0x2c')][_0xcf47('0x37')]+'%'};return _0x26a596;})});}_0x32b5e0=_['merge']({},_0x32b5e0,_0x46c8be[_0xcf47('0x3a')]);return db[_0xcf47('0x48')][_0xcf47('0x3b')]({'where':_0x32b5e0[_0xcf47('0x38')]})['then'](function(_0x37fccc){_0x34fb9e['count']=_0x37fccc;if(_0x46c8be['query'][_0xcf47('0x4b')]){_0x32b5e0['include']=[{'all':!![]}];}return db[_0xcf47('0x48')][_0xcf47('0x3d')](_0x32b5e0);})[_0xcf47('0x20')](function(_0x36db94){_0x34fb9e[_0xcf47('0x3e')]=_0x36db94;return _0x34fb9e;});}})[_0xcf47('0x20')](respondWithFilteredResult(_0x57fa18,_0x32b5e0))[_0xcf47('0x3f')](handleError(_0x57fa18,null));}; \ No newline at end of file +var _0x183c=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','nolimit','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x34537f,_0x213a48){var _0x4bc478=function(_0x22690e){while(--_0x22690e){_0x34537f['push'](_0x34537f['shift']());}};_0x4bc478(++_0x213a48);}(_0x183c,0x94));var _0xc183=function(_0x476859,_0x298703){_0x476859=_0x476859-0x0;var _0x5c9af3=_0x183c[_0x476859];return _0x5c9af3;};'use strict';var emlformat=require(_0xc183('0x0'));var rimraf=require(_0xc183('0x1'));var zipdir=require(_0xc183('0x2'));var jsonpatch=require(_0xc183('0x3'));var rp=require(_0xc183('0x4'));var moment=require('moment');var BPromise=require(_0xc183('0x5'));var Mustache=require(_0xc183('0x6'));var util=require(_0xc183('0x7'));var path=require('path');var sox=require(_0xc183('0x8'));var csv=require(_0xc183('0x9'));var ejs=require(_0xc183('0xa'));var fs=require('fs');var fs_extra=require(_0xc183('0xb'));var _=require(_0xc183('0xc'));var squel=require(_0xc183('0xd'));var crypto=require(_0xc183('0xe'));var jsforce=require(_0xc183('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc183('0x10'));var Papa=require(_0xc183('0x11'));var Redis=require(_0xc183('0x12'));var authService=require(_0xc183('0x13'));var qs=require(_0xc183('0x14'));var as=require(_0xc183('0x15'));var hardwareService=require(_0xc183('0x16'));var logger=require(_0xc183('0x17'))('api');var utils=require(_0xc183('0x18'));var config=require(_0xc183('0x19'));var licenseUtil=require(_0xc183('0x1a'));var db=require(_0xc183('0x1b'))['db'];function respondWithStatusCode(_0x3da77a,_0x3b2a42){_0x3b2a42=_0x3b2a42||0xcc;return function(_0x39f7e8){if(_0x39f7e8){return _0x3da77a[_0xc183('0x1c')](_0x3b2a42);}return _0x3da77a[_0xc183('0x1d')](_0x3b2a42)[_0xc183('0x1e')]();};}function respondWithResult(_0x5e5fd1,_0x50ac15){_0x50ac15=_0x50ac15||0xc8;return function(_0x1a7eb7){if(_0x1a7eb7){return _0x5e5fd1['status'](_0x50ac15)[_0xc183('0x1f')](_0x1a7eb7);}};}function respondWithFilteredResult(_0x2615ff,_0x41802f){return function(_0x302816){if(_0x302816){var _0x97a23=typeof _0x41802f[_0xc183('0x20')]===_0xc183('0x21')&&typeof _0x41802f[_0xc183('0x22')]===_0xc183('0x21');var _0xd214c0=_0x302816['count'];var _0x350701=_0x97a23?0x0:_0x41802f['offset'];var _0x555ee9=_0x97a23?_0x302816[_0xc183('0x23')]:_0x41802f[_0xc183('0x20')]+_0x41802f['limit'];var _0x1201a1;if(_0x555ee9>=_0xd214c0){_0x555ee9=_0xd214c0;_0x1201a1=0xc8;}else{_0x1201a1=0xce;}_0x2615ff[_0xc183('0x1d')](_0x1201a1);return _0x2615ff[_0xc183('0x24')](_0xc183('0x25'),_0x350701+'-'+_0x555ee9+'/'+_0xd214c0)[_0xc183('0x1f')](_0x302816);}return null;};}function patchUpdates(_0x1eda84){return function(_0x3277e2){try{jsonpatch[_0xc183('0x26')](_0x3277e2,_0x1eda84,!![]);}catch(_0x88b777){return BPromise['reject'](_0x88b777);}return _0x3277e2[_0xc183('0x27')]();};}function saveUpdates(_0x14e5e4,_0x1db6ea){return function(_0x143eb3){if(_0x143eb3){return _0x143eb3[_0xc183('0x28')](_0x14e5e4)[_0xc183('0x29')](function(_0x33c7b5){return _0x33c7b5;});}return null;};}function removeEntity(_0x493d80,_0x2e240c){return function(_0x4a870e){if(_0x4a870e){return _0x4a870e['destroy']()['then'](function(){_0x493d80['status'](0xcc)[_0xc183('0x1e')]();});}};}function handleEntityNotFound(_0x457c5e,_0x4684e1){return function(_0x1e4f29){if(!_0x1e4f29){_0x457c5e[_0xc183('0x1c')](0x194);}return _0x1e4f29;};}function handleError(_0x4e44ff,_0x2f9e5a){_0x2f9e5a=_0x2f9e5a||0x1f4;return function(_0x3fbed1){logger[_0xc183('0x2a')](_0x3fbed1[_0xc183('0x2b')]);if(_0x3fbed1[_0xc183('0x2c')]){delete _0x3fbed1[_0xc183('0x2c')];}_0x4e44ff[_0xc183('0x1d')](_0x2f9e5a)['send'](_0x3fbed1);};}exports['index']=function(_0x4f4a2e,_0x3fcf8c){var _0x9b68f5={},_0x1e095e={},_0x198a10={'count':0x0,'rows':[]};var _0x447ed4=_['map'](db['JscriptySessionReport']['rawAttributes'],function(_0x5d2730){return{'name':_0x5d2730[_0xc183('0x2d')],'type':_0x5d2730[_0xc183('0x2e')][_0xc183('0x2f')]};});_0x1e095e[_0xc183('0x30')]=_[_0xc183('0x31')](_0x447ed4,'name');_0x1e095e[_0xc183('0x32')]=_[_0xc183('0x33')](_0x4f4a2e['query']);_0x1e095e[_0xc183('0x34')]=_['intersection'](_0x1e095e[_0xc183('0x30')],_0x1e095e['query']);_0x9b68f5[_0xc183('0x35')]=_[_0xc183('0x36')](_0x1e095e['model'],qs[_0xc183('0x37')](_0x4f4a2e[_0xc183('0x32')][_0xc183('0x37')]));_0x9b68f5[_0xc183('0x35')]=_0x9b68f5[_0xc183('0x35')][_0xc183('0x38')]?_0x9b68f5[_0xc183('0x35')]:_0x1e095e[_0xc183('0x30')];if(!_0x4f4a2e[_0xc183('0x32')][_0xc183('0x39')]('nolimit')){_0x9b68f5[_0xc183('0x22')]=qs[_0xc183('0x22')](_0x4f4a2e[_0xc183('0x32')][_0xc183('0x22')]);_0x9b68f5[_0xc183('0x20')]=qs[_0xc183('0x20')](_0x4f4a2e['query'][_0xc183('0x20')]);}_0x9b68f5[_0xc183('0x3a')]=qs['sort'](_0x4f4a2e[_0xc183('0x32')]['sort']);_0x9b68f5[_0xc183('0x3b')]=qs['filters'](_['pick'](_0x4f4a2e[_0xc183('0x32')],_0x1e095e[_0xc183('0x34')]),_0x447ed4);if(_0x4f4a2e['query'][_0xc183('0x3c')]){_0x9b68f5[_0xc183('0x3b')]=_['merge'](_0x9b68f5[_0xc183('0x3b')],{'$or':_['map'](_0x447ed4,function(_0x16ad55){if(_0x16ad55[_0xc183('0x2e')]!==_0xc183('0x3d')){var _0x5812c0={};_0x5812c0[_0x16ad55[_0xc183('0x2c')]]={'$like':'%'+_0x4f4a2e['query'][_0xc183('0x3c')]+'%'};return _0x5812c0;}})});}_0x9b68f5=_[_0xc183('0x3e')]({},_0x9b68f5,_0x4f4a2e[_0xc183('0x3f')]);var _0x2492e3={'where':_0x9b68f5[_0xc183('0x3b')]};return db[_0xc183('0x40')]['count'](_0x2492e3)[_0xc183('0x29')](function(_0x2d2cb3){_0x198a10['count']=_0x2d2cb3;if(_0x4f4a2e[_0xc183('0x32')][_0xc183('0x41')]){_0x9b68f5[_0xc183('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc183('0x43')](_0x9b68f5);})[_0xc183('0x29')](function(_0x362527){_0x198a10[_0xc183('0x44')]=_0x362527;return _0x198a10;})[_0xc183('0x29')](respondWithFilteredResult(_0x3fcf8c,_0x9b68f5))[_0xc183('0x45')](handleError(_0x3fcf8c,null));};exports[_0xc183('0x46')]=function(_0x552ea5,_0x2fb49d){var _0x5eab2d={'raw':!![],'where':{'id':_0x552ea5[_0xc183('0x47')]['id']}},_0x11d1c0={};_0x11d1c0[_0xc183('0x30')]=_[_0xc183('0x33')](db[_0xc183('0x40')]['rawAttributes']);_0x11d1c0[_0xc183('0x32')]=_[_0xc183('0x33')](_0x552ea5['query']);_0x11d1c0[_0xc183('0x34')]=_[_0xc183('0x36')](_0x11d1c0[_0xc183('0x30')],_0x11d1c0['query']);_0x5eab2d['attributes']=_[_0xc183('0x36')](_0x11d1c0['model'],qs[_0xc183('0x37')](_0x552ea5[_0xc183('0x32')][_0xc183('0x37')]));_0x5eab2d[_0xc183('0x35')]=_0x5eab2d[_0xc183('0x35')][_0xc183('0x38')]?_0x5eab2d['attributes']:_0x11d1c0[_0xc183('0x30')];if(_0x552ea5['query'][_0xc183('0x41')]){_0x5eab2d[_0xc183('0x42')]=[{'all':!![]}];}_0x5eab2d=_[_0xc183('0x3e')]({},_0x5eab2d,_0x552ea5['options']);return db[_0xc183('0x40')][_0xc183('0x48')](_0x5eab2d)['then'](handleEntityNotFound(_0x2fb49d,null))[_0xc183('0x29')](respondWithResult(_0x2fb49d,null))[_0xc183('0x45')](handleError(_0x2fb49d,null));};exports[_0xc183('0x49')]=function(_0x5ea719,_0x56176a){return db[_0xc183('0x40')]['create'](_0x5ea719[_0xc183('0x4a')],{})['then'](respondWithResult(_0x56176a,0xc9))['catch'](handleError(_0x56176a,null));};exports[_0xc183('0x28')]=function(_0xe6d433,_0x292b8d){if(_0xe6d433[_0xc183('0x4a')]['id']){delete _0xe6d433[_0xc183('0x4a')]['id'];}return db[_0xc183('0x40')][_0xc183('0x48')]({'where':{'id':_0xe6d433[_0xc183('0x47')]['id']}})[_0xc183('0x29')](handleEntityNotFound(_0x292b8d,null))[_0xc183('0x29')](saveUpdates(_0xe6d433[_0xc183('0x4a')],null))[_0xc183('0x29')](respondWithResult(_0x292b8d,null))[_0xc183('0x45')](handleError(_0x292b8d,null));};exports[_0xc183('0x4b')]=function(_0x14fda8,_0x3d50d6){return db['JscriptySessionReport'][_0xc183('0x48')]({'where':{'id':_0x14fda8['params']['id']}})['then'](handleEntityNotFound(_0x3d50d6,null))[_0xc183('0x29')](removeEntity(_0x3d50d6,null))[_0xc183('0x45')](handleError(_0x3d50d6,null));};exports[_0xc183('0x4c')]=function(_0x27a3cf,_0x526e73){return db[_0xc183('0x40')][_0xc183('0x4c')]()[_0xc183('0x29')](respondWithResult(_0x526e73,null))[_0xc183('0x45')](handleError(_0x526e73,null));};exports[_0xc183('0x4d')]=function(_0x33844a,_0x49f3e1,_0x1c5f45){var _0x441950={'raw':!![],'where':{}};var _0x405e43={};var _0x28dcd6={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xc183('0x4e')]({'where':{'id':_0x33844a[_0xc183('0x47')]['id']}})[_0xc183('0x29')](handleEntityNotFound(_0x49f3e1,null))['then'](function(_0x539ccd){if(_0x539ccd){_0x405e43['model']=_[_0xc183('0x33')](db[_0xc183('0x4f')][_0xc183('0x50')]);_0x405e43[_0xc183('0x32')]=_['keys'](_0x33844a[_0xc183('0x32')]);_0x405e43['filters']=_[_0xc183('0x36')](_0x405e43[_0xc183('0x30')],_0x405e43['query']);_0x441950[_0xc183('0x35')]=_[_0xc183('0x36')](_0x405e43['model'],qs['fields'](_0x33844a[_0xc183('0x32')][_0xc183('0x37')]));_0x441950['attributes']=_0x441950['attributes'][_0xc183('0x38')]?_0x441950[_0xc183('0x35')]:_0x405e43[_0xc183('0x30')];if(!_0x33844a[_0xc183('0x32')][_0xc183('0x39')](_0xc183('0x51'))){_0x441950[_0xc183('0x22')]=qs['limit'](_0x33844a['query'][_0xc183('0x22')]);_0x441950[_0xc183('0x20')]=qs[_0xc183('0x20')](_0x33844a['query'][_0xc183('0x20')]);}_0x441950['order']=qs[_0xc183('0x52')](_0x33844a[_0xc183('0x32')][_0xc183('0x52')]);_0x441950[_0xc183('0x3b')]=qs['filters'](_['pick'](_0x33844a[_0xc183('0x32')],_0x405e43[_0xc183('0x34')]));_0x441950['where']['SessionId']=_0x539ccd['id'];if(_0x33844a[_0xc183('0x32')]['filter']){_0x441950['where']=_[_0xc183('0x3e')](_0x441950['where'],{'$or':_[_0xc183('0x31')](_0x441950['attributes'],function(_0x452662){var _0x23b912={};_0x23b912[_0x452662]={'$like':'%'+_0x33844a['query'][_0xc183('0x3c')]+'%'};return _0x23b912;})});}_0x441950=_[_0xc183('0x3e')]({},_0x441950,_0x33844a[_0xc183('0x3f')]);return db[_0xc183('0x4f')][_0xc183('0x23')]({'where':_0x441950[_0xc183('0x3b')]})[_0xc183('0x29')](function(_0x4b1921){_0x28dcd6['count']=_0x4b1921;if(_0x33844a['query']['includeAll']){_0x441950[_0xc183('0x42')]=[{'all':!![]}];}return db[_0xc183('0x4f')][_0xc183('0x43')](_0x441950);})[_0xc183('0x29')](function(_0x34681d){_0x28dcd6['rows']=_0x34681d;return _0x28dcd6;});}})[_0xc183('0x29')](respondWithFilteredResult(_0x49f3e1,_0x441950))[_0xc183('0x45')](handleError(_0x49f3e1,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8224e70..19b0d91 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 _0x31f0=['./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2662b4,_0x18e014){var _0x412f50=function(_0x5cac28){while(--_0x5cac28){_0x2662b4['push'](_0x2662b4['shift']());}};_0x412f50(++_0x18e014);}(_0x31f0,0xb7));var _0x031f=function(_0x8e5a7e,_0x59b461){_0x8e5a7e=_0x8e5a7e-0x0;var _0xa9bd1=_0x31f0[_0x8e5a7e];return _0xa9bd1;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2046ed,_0x54ac19){var _0x437fe4=function(_0x526959){while(--_0x526959){_0x2046ed['push'](_0x2046ed['shift']());}};_0x437fe4(++_0x54ac19);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4104df,_0x33eaa7){_0x4104df=_0x4104df-0x0;var _0x2ca8a4=_0x1cb9[_0x4104df];return _0x2ca8a4;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_jscripty_sessions','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 c16b255..eea237f 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 _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4de3c8,_0x997416){var _0x394335=function(_0x4d15b1){while(--_0x4d15b1){_0x4de3c8['push'](_0x4de3c8['shift']());}};_0x394335(++_0x997416);}(_0x7880,0x1f4));var _0x0788=function(_0x407844,_0x47eedc){_0x407844=_0x407844-0x0;var _0x36f5df=_0x7880[_0x407844];return _0x36f5df;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file +var _0x4888=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf3a8e,_0x332fc9){var _0x36c459=function(_0x2a24fb){while(--_0x2a24fb){_0xf3a8e['push'](_0xf3a8e['shift']());}};_0x36c459(++_0x332fc9);}(_0x4888,0x198));var _0x8488=function(_0x9171e0,_0x2ee1b3){_0x9171e0=_0x9171e0-0x0;var _0x2659fb=_0x4888[_0x9171e0];return _0x2659fb;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 5b66ba5..37f51f4 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 _0x302a=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile'];(function(_0x440372,_0x1ec6d1){var _0x381be4=function(_0x389a35){while(--_0x389a35){_0x440372['push'](_0x440372['shift']());}};_0x381be4(++_0x1ec6d1);}(_0x302a,0x80));var _0xa302=function(_0x4de3cd,_0x48cec0){_0x4de3cd=_0x4de3cd-0x0;var _0x3ea74f=_0x302a[_0x4de3cd];return _0x3ea74f;};'use strict';var multer=require(_0xa302('0x0'));var util=require('util');var path=require(_0xa302('0x1'));var timeout=require(_0xa302('0x2'));var express=require(_0xa302('0x3'));var router=express[_0xa302('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa302('0x5'));var config=require(_0xa302('0x6'));var controller=require(_0xa302('0x7'));router[_0xa302('0x8')]('/',controller[_0xa302('0x9')]);router[_0xa302('0xa')](_0xa302('0xb'),auth[_0xa302('0xc')](),controller[_0xa302('0xd')]);router[_0xa302('0x8')](_0xa302('0xe'),auth[_0xa302('0xc')](),controller[_0xa302('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4c7f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','/download_log_file','downloadLogFile','exports','multer','util','path','express','Router','fs-extra'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x4c7f,0x82));var _0xf4c7=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4c7f[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0xf4c7('0x0'));var util=require(_0xf4c7('0x1'));var path=require(_0xf4c7('0x2'));var timeout=require('connect-timeout');var express=require(_0xf4c7('0x3'));var router=express[_0xf4c7('0x4')]();var fs_extra=require(_0xf4c7('0x5'));var auth=require(_0xf4c7('0x6'));var interaction=require(_0xf4c7('0x7'));var config=require(_0xf4c7('0x8'));var controller=require(_0xf4c7('0x9'));router[_0xf4c7('0xa')]('/',controller[_0xf4c7('0xb')]);router['put'](_0xf4c7('0xc'),auth[_0xf4c7('0xd')](),controller['update']);router['get'](_0xf4c7('0xe'),auth[_0xf4c7('0xd')](),controller[_0xf4c7('0xf')]);module[_0xf4c7('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index e2db9a5..16058af 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 _0x6b2f=['sequelize','exports','STRING','INTEGER'];(function(_0x5a66c0,_0x482c3){var _0x4cc30d=function(_0x47f2e9){while(--_0x47f2e9){_0x5a66c0['push'](_0x5a66c0['shift']());}};_0x4cc30d(++_0x482c3);}(_0x6b2f,0x144));var _0xf6b2=function(_0x2c8784,_0x46db8a){_0x2c8784=_0x2c8784-0x0;var _0x5490e2=_0x6b2f[_0x2c8784];return _0x5490e2;};'use strict';var Sequelize=require(_0xf6b2('0x0'));module[_0xf6b2('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xf6b2('0x2')]},'data2':{'type':Sequelize[_0xf6b2('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xf6b2('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x12f4=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x7eeee3,_0x17bd80){var _0x67e198=function(_0x42d3bd){while(--_0x42d3bd){_0x7eeee3['push'](_0x7eeee3['shift']());}};_0x67e198(++_0x17bd80);}(_0x12f4,0x1b2));var _0x412f=function(_0x4b9323,_0xd1772b){_0x4b9323=_0x4b9323-0x0;var _0x355e95=_0x12f4[_0x4b9323];return _0x355e95;};'use strict';var Sequelize=require(_0x412f('0x0'));module[_0x412f('0x1')]={'license':{'type':Sequelize[_0x412f('0x2')]},'data1':{'type':Sequelize[_0x412f('0x3')]},'data2':{'type':Sequelize[_0x412f('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x412f('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index bbbd184..a06ec94 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 _0x0980=['catch','downloadLogFile','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','set','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','length','merge','options','getLicense','body','find','params','get','checkLicense','key','demo'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0980,0x97));var _0x0098=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0980[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x0098('0x0'));var rimraf=require(_0x0098('0x1'));var zipdir=require(_0x0098('0x2'));var jsonpatch=require(_0x0098('0x3'));var rp=require('request-promise');var moment=require(_0x0098('0x4'));var BPromise=require(_0x0098('0x5'));var Mustache=require(_0x0098('0x6'));var util=require('util');var path=require(_0x0098('0x7'));var sox=require(_0x0098('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0098('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0098('0xa'));var deskjs=require(_0x0098('0xb'));var toCsv=require(_0x0098('0xc'));var querystring=require('querystring');var Papa=require(_0x0098('0xd'));var Redis=require(_0x0098('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0098('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0098('0x10'))('api');var utils=require(_0x0098('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x0098('0x12'));var db=require(_0x0098('0x13'))['db'];function respondWithStatusCode(_0x4cd044,_0x4e708a){_0x4e708a=_0x4e708a||0xcc;return function(_0x3a9e38){if(_0x3a9e38){return _0x4cd044[_0x0098('0x14')](_0x4e708a);}return _0x4cd044[_0x0098('0x15')](_0x4e708a)[_0x0098('0x16')]();};}function respondWithResult(_0x17c96e,_0xe316c6){_0xe316c6=_0xe316c6||0xc8;return function(_0x4f207d){if(_0x4f207d){return _0x17c96e[_0x0098('0x15')](_0xe316c6)[_0x0098('0x17')](_0x4f207d);}};}function respondWithFilteredResult(_0x293c75,_0x347100){return function(_0x59cc5f){if(_0x59cc5f){var _0x44233d=typeof _0x347100[_0x0098('0x18')]===_0x0098('0x19')&&typeof _0x347100[_0x0098('0x1a')]===_0x0098('0x19');var _0x52beac=_0x59cc5f['count'];var _0x7a088f=_0x44233d?0x0:_0x347100[_0x0098('0x18')];var _0x20918a=_0x44233d?_0x59cc5f[_0x0098('0x1b')]:_0x347100[_0x0098('0x18')]+_0x347100[_0x0098('0x1a')];var _0x228572;if(_0x20918a>=_0x52beac){_0x20918a=_0x52beac;_0x228572=0xc8;}else{_0x228572=0xce;}_0x293c75[_0x0098('0x15')](_0x228572);return _0x293c75['set'](_0x0098('0x1c'),_0x7a088f+'-'+_0x20918a+'/'+_0x52beac)[_0x0098('0x17')](_0x59cc5f);}return null;};}function patchUpdates(_0x518c55){return function(_0x58e46d){try{jsonpatch[_0x0098('0x1d')](_0x58e46d,_0x518c55,!![]);}catch(_0x11ec46){return BPromise[_0x0098('0x1e')](_0x11ec46);}return _0x58e46d[_0x0098('0x1f')]();};}function saveUpdates(_0x527a0d,_0x44c9fc){return function(_0x4a64b7){if(_0x4a64b7){return _0x4a64b7[_0x0098('0x20')](_0x527a0d)[_0x0098('0x21')](function(_0x2c09fd){return _0x2c09fd;});}return null;};}function removeEntity(_0x23fc30,_0x229e84){return function(_0x2ba455){if(_0x2ba455){return _0x2ba455[_0x0098('0x22')]()[_0x0098('0x21')](function(){_0x23fc30[_0x0098('0x15')](0xcc)[_0x0098('0x16')]();});}};}function handleEntityNotFound(_0x1d4637,_0x38eedc){return function(_0x22fd51){if(!_0x22fd51){_0x1d4637[_0x0098('0x14')](0x194);}return _0x22fd51;};}function handleError(_0xf4fcc6,_0x193691){_0x193691=_0x193691||0x1f4;return function(_0x3a829a){logger[_0x0098('0x23')](_0x3a829a[_0x0098('0x24')]);if(_0x3a829a[_0x0098('0x25')]){delete _0x3a829a[_0x0098('0x25')];}_0xf4fcc6[_0x0098('0x15')](_0x193691)[_0x0098('0x26')](_0x3a829a);};}var utilLicense=require(_0x0098('0x12'));exports[_0x0098('0x27')]=function(_0x526b03,_0x1605de){var _0x444cec={'raw':!![],'where':{'id':0x1}},_0x220fe3={};_0x220fe3['model']=_[_0x0098('0x28')](db[_0x0098('0x29')][_0x0098('0x2a')]);_0x220fe3['query']=_[_0x0098('0x28')](_0x526b03[_0x0098('0x2b')]);_0x220fe3[_0x0098('0x2c')]=_[_0x0098('0x2d')](_0x220fe3[_0x0098('0x2e')],_0x220fe3[_0x0098('0x2b')]);_0x444cec[_0x0098('0x2f')]=_[_0x0098('0x2d')](_0x220fe3[_0x0098('0x2e')],qs['fields'](_0x526b03[_0x0098('0x2b')]['fields']));_0x444cec[_0x0098('0x2f')]=_0x444cec[_0x0098('0x2f')][_0x0098('0x30')]?_0x444cec[_0x0098('0x2f')]:_0x220fe3[_0x0098('0x2e')];_0x444cec=_[_0x0098('0x31')]({},_0x444cec,_0x526b03[_0x0098('0x32')]);return utilLicense[_0x0098('0x33')](_0x444cec)['then'](respondWithResult(_0x1605de,null))['catch'](handleError(_0x1605de,null));};exports[_0x0098('0x20')]=function(_0x16c57d,_0x4bb54f){if(_0x16c57d['body']['id']){delete _0x16c57d[_0x0098('0x34')]['id'];}return db[_0x0098('0x29')][_0x0098('0x35')]({'where':{'id':_0x16c57d[_0x0098('0x36')]['id']}})['then'](handleEntityNotFound(_0x4bb54f,null))[_0x0098('0x21')](function(_0x2215a3){var _0x49f255=_0x2215a3[_0x0098('0x37')]({'plain':!![]});return utilLicense[_0x0098('0x38')](_0x49f255,_0x16c57d[_0x0098('0x34')][_0x0098('0x39')]);})[_0x0098('0x21')](function(_0x663790){if(!_0x663790[_0x0098('0x3a')]){return saveUpdates(_0x16c57d[_0x0098('0x34')],null);}return _0x663790;})[_0x0098('0x21')](respondWithResult(_0x4bb54f,null))[_0x0098('0x3b')](handleError(_0x4bb54f,null));};exports[_0x0098('0x3c')]=function(_0x9a5a04,_0x3ae946){var _0xcb9f45='license-info.log';var _0x5b5a33=path[_0x0098('0x3d')](_0x0098('0x3e'),_0x0098('0x3f'),_0x0098('0x40'),_0xcb9f45);_0x3ae946['setHeader'](_0x0098('0x41'),_0x0098('0x42')+_0xcb9f45);_0x3ae946[_0x0098('0x43')]('Content-Type',_0x0098('0x44'));_0x3ae946[_0x0098('0x45')](_0x5b5a33);}; \ No newline at end of file +var _0x3438=['length','options','getLicense','catch','body','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','../../config/license/util','index','model','keys','License','query','filters','attributes','fields'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x3438,0x141));var _0x8343=function(_0x217203,_0x3c6629){_0x217203=_0x217203-0x0;var _0x5581d3=_0x3438[_0x217203];return _0x5581d3;};'use strict';var emlformat=require(_0x8343('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8343('0x1'));var jsonpatch=require(_0x8343('0x2'));var rp=require(_0x8343('0x3'));var moment=require('moment');var BPromise=require(_0x8343('0x4'));var Mustache=require(_0x8343('0x5'));var util=require(_0x8343('0x6'));var path=require(_0x8343('0x7'));var sox=require(_0x8343('0x8'));var csv=require(_0x8343('0x9'));var ejs=require(_0x8343('0xa'));var fs=require('fs');var fs_extra=require(_0x8343('0xb'));var _=require(_0x8343('0xc'));var squel=require(_0x8343('0xd'));var crypto=require(_0x8343('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8343('0xf'));var toCsv=require(_0x8343('0x9'));var querystring=require('querystring');var Papa=require(_0x8343('0x10'));var Redis=require(_0x8343('0x11'));var authService=require(_0x8343('0x12'));var qs=require(_0x8343('0x13'));var as=require(_0x8343('0x14'));var hardwareService=require(_0x8343('0x15'));var logger=require(_0x8343('0x16'))(_0x8343('0x17'));var utils=require(_0x8343('0x18'));var config=require(_0x8343('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8343('0x1a'))['db'];function respondWithStatusCode(_0x2dfd33,_0x40bf42){_0x40bf42=_0x40bf42||0xcc;return function(_0x16422d){if(_0x16422d){return _0x2dfd33['sendStatus'](_0x40bf42);}return _0x2dfd33['status'](_0x40bf42)['end']();};}function respondWithResult(_0x9ddfd0,_0xc1b19c){_0xc1b19c=_0xc1b19c||0xc8;return function(_0x1c10fe){if(_0x1c10fe){return _0x9ddfd0[_0x8343('0x1b')](_0xc1b19c)[_0x8343('0x1c')](_0x1c10fe);}};}function respondWithFilteredResult(_0x45aca8,_0x505cb7){return function(_0x415b00){if(_0x415b00){var _0x3ade21=typeof _0x505cb7[_0x8343('0x1d')]===_0x8343('0x1e')&&typeof _0x505cb7['limit']===_0x8343('0x1e');var _0x38b963=_0x415b00[_0x8343('0x1f')];var _0x47fc71=_0x3ade21?0x0:_0x505cb7[_0x8343('0x1d')];var _0x4e488f=_0x3ade21?_0x415b00[_0x8343('0x1f')]:_0x505cb7['offset']+_0x505cb7[_0x8343('0x20')];var _0x4d3cba;if(_0x4e488f>=_0x38b963){_0x4e488f=_0x38b963;_0x4d3cba=0xc8;}else{_0x4d3cba=0xce;}_0x45aca8[_0x8343('0x1b')](_0x4d3cba);return _0x45aca8[_0x8343('0x21')](_0x8343('0x22'),_0x47fc71+'-'+_0x4e488f+'/'+_0x38b963)['json'](_0x415b00);}return null;};}function patchUpdates(_0x5ae491){return function(_0x1b412f){try{jsonpatch[_0x8343('0x23')](_0x1b412f,_0x5ae491,!![]);}catch(_0x33bf19){return BPromise['reject'](_0x33bf19);}return _0x1b412f[_0x8343('0x24')]();};}function saveUpdates(_0xe13101,_0x1bf576){return function(_0x4d6dd7){if(_0x4d6dd7){return _0x4d6dd7[_0x8343('0x25')](_0xe13101)[_0x8343('0x26')](function(_0x13bba2){return _0x13bba2;});}return null;};}function removeEntity(_0xd00066,_0x3e6df0){return function(_0xe1865e){if(_0xe1865e){return _0xe1865e[_0x8343('0x27')]()['then'](function(){_0xd00066['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0bd7,_0x130879){return function(_0x33028a){if(!_0x33028a){_0x5a0bd7[_0x8343('0x28')](0x194);}return _0x33028a;};}function handleError(_0x1fa58a,_0xc9bc8b){_0xc9bc8b=_0xc9bc8b||0x1f4;return function(_0x54f19e){logger[_0x8343('0x29')](_0x54f19e[_0x8343('0x2a')]);if(_0x54f19e['name']){delete _0x54f19e[_0x8343('0x2b')];}_0x1fa58a['status'](_0xc9bc8b)[_0x8343('0x2c')](_0x54f19e);};}var utilLicense=require(_0x8343('0x2d'));exports[_0x8343('0x2e')]=function(_0x23487c,_0x2ac20a){var _0x4cbd5a={'raw':!![],'where':{'id':0x1}},_0x4ddd84={};_0x4ddd84[_0x8343('0x2f')]=_[_0x8343('0x30')](db[_0x8343('0x31')]['rawAttributes']);_0x4ddd84['query']=_[_0x8343('0x30')](_0x23487c[_0x8343('0x32')]);_0x4ddd84[_0x8343('0x33')]=_['intersection'](_0x4ddd84[_0x8343('0x2f')],_0x4ddd84[_0x8343('0x32')]);_0x4cbd5a[_0x8343('0x34')]=_['intersection'](_0x4ddd84[_0x8343('0x2f')],qs[_0x8343('0x35')](_0x23487c['query'][_0x8343('0x35')]));_0x4cbd5a[_0x8343('0x34')]=_0x4cbd5a[_0x8343('0x34')][_0x8343('0x36')]?_0x4cbd5a['attributes']:_0x4ddd84['model'];_0x4cbd5a=_['merge']({},_0x4cbd5a,_0x23487c[_0x8343('0x37')]);return utilLicense[_0x8343('0x38')](_0x4cbd5a)['then'](respondWithResult(_0x2ac20a,null))[_0x8343('0x39')](handleError(_0x2ac20a,null));};exports[_0x8343('0x25')]=function(_0x40b283,_0x39bfdc){if(_0x40b283[_0x8343('0x3a')]['id']){delete _0x40b283['body']['id'];}return db[_0x8343('0x31')]['find']({'where':{'id':_0x40b283[_0x8343('0x3b')]['id']}})[_0x8343('0x26')](handleEntityNotFound(_0x39bfdc,null))[_0x8343('0x26')](function(_0x37956b){var _0x4501dd=_0x37956b[_0x8343('0x3c')]({'plain':!![]});return utilLicense[_0x8343('0x3d')](_0x4501dd,_0x40b283[_0x8343('0x3a')][_0x8343('0x3e')]);})[_0x8343('0x26')](function(_0x584a36){if(!_0x584a36[_0x8343('0x3f')]){return saveUpdates(_0x40b283['body'],null);}return _0x584a36;})[_0x8343('0x26')](respondWithResult(_0x39bfdc,null))['catch'](handleError(_0x39bfdc,null));};exports[_0x8343('0x40')]=function(_0x6451c8,_0x16cdd7){var _0x5ad365=_0x8343('0x41');var _0x3dc7ce=path[_0x8343('0x42')](_0x8343('0x43'),'log',_0x8343('0x44'),_0x5ad365);_0x16cdd7[_0x8343('0x45')](_0x8343('0x46'),_0x8343('0x47')+_0x5ad365);_0x16cdd7[_0x8343('0x21')](_0x8343('0x48'),_0x8343('0x49'));_0x16cdd7[_0x8343('0x4a')](_0x3dc7ce);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index aa92b79..03d3d10 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 _0x5834=['bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','License','lodash','util','../../config/logger','moment'];(function(_0x4eeb93,_0x27bbb9){var _0x22092c=function(_0x278ebb){while(--_0x278ebb){_0x4eeb93['push'](_0x4eeb93['shift']());}};_0x22092c(++_0x27bbb9);}(_0x5834,0xec));var _0x4583=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x5834[_0x26b80e];return _0x84a8a8;};'use strict';var _=require(_0x4583('0x0'));var util=require(_0x4583('0x1'));var logger=require(_0x4583('0x2'))('api');var moment=require(_0x4583('0x3'));var BPromise=require(_0x4583('0x4'));var rp=require(_0x4583('0x5'));var fs=require('fs');var path=require(_0x4583('0x6'));var rimraf=require('rimraf');var config=require(_0x4583('0x7'));var attributes=require(_0x4583('0x8'));module[_0x4583('0x9')]=function(_0x499786,_0x398421){return _0x499786[_0x4583('0xa')](_0x4583('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4db=['lodash','util','api','moment','bluebird','request-promise','path','./license.attributes','exports','define','License','license'];(function(_0x3e2f39,_0x52276d){var _0x1f915c=function(_0x2bbf27){while(--_0x2bbf27){_0x3e2f39['push'](_0x3e2f39['shift']());}};_0x1f915c(++_0x52276d);}(_0xa4db,0x144));var _0xba4d=function(_0x14bd92,_0x19d392){_0x14bd92=_0x14bd92-0x0;var _0xea44cc=_0xa4db[_0x14bd92];return _0xea44cc;};'use strict';var _=require(_0xba4d('0x0'));var util=require(_0xba4d('0x1'));var logger=require('../../config/logger')(_0xba4d('0x2'));var moment=require(_0xba4d('0x3'));var BPromise=require(_0xba4d('0x4'));var rp=require(_0xba4d('0x5'));var fs=require('fs');var path=require(_0xba4d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba4d('0x7'));module[_0xba4d('0x8')]=function(_0x4a699a,_0x58bef8){return _0x4a699a[_0xba4d('0x9')](_0xba4d('0xa'),attributes,{'tableName':_0xba4d('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 3efe414..23eec8e 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 _0x173b=['License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x58fd33,_0x40dc7){var _0x18f594=function(_0x1b6e43){while(--_0x1b6e43){_0x58fd33['push'](_0x58fd33['shift']());}};_0x18f594(++_0x40dc7);}(_0x173b,0x14a));var _0xb173=function(_0x4ecedb,_0x2dffa3){_0x4ecedb=_0x4ecedb-0x0;var _0x3544cc=_0x173b[_0x4ecedb];return _0x3544cc;};'use strict';var _=require(_0xb173('0x0'));var util=require(_0xb173('0x1'));var moment=require(_0xb173('0x2'));var BPromise=require(_0xb173('0x3'));var rs=require(_0xb173('0x4'));var fs=require('fs');var Redis=require(_0xb173('0x5'));var db=require(_0xb173('0x6'))['db'];var utils=require(_0xb173('0x7'));var logger=require(_0xb173('0x8'))('rpc');var config=require(_0xb173('0x9'));var jayson=require(_0xb173('0xa'));var client=jayson[_0xb173('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0471,_0xc114eb,_0x31a920){return new BPromise(function(_0x17318a,_0xcc38e4){return client[_0xb173('0xc')](_0x3a0471,_0x31a920)[_0xb173('0xd')](function(_0x561323){logger[_0xb173('0xe')](_0xb173('0xf'),_0xc114eb,'request\x20sent');logger['debug'](_0xb173('0x10'),_0xc114eb,'request\x20sent',JSON[_0xb173('0x11')](_0x561323));if(_0x561323[_0xb173('0x12')]){if(_0x561323[_0xb173('0x12')][_0xb173('0x13')]===0x1f4){logger[_0xb173('0x12')](_0xb173('0xf'),_0xc114eb,_0x561323[_0xb173('0x12')][_0xb173('0x14')]);return _0xcc38e4(_0x561323[_0xb173('0x12')][_0xb173('0x14')]);}logger[_0xb173('0x12')](_0xb173('0xf'),_0xc114eb,_0x561323['error']['message']);return _0x17318a(_0x561323[_0xb173('0x12')][_0xb173('0x14')]);}else{logger['info'](_0xb173('0xf'),_0xc114eb,_0xb173('0x15'));_0x17318a(_0x561323['result'][_0xb173('0x14')]);}})[_0xb173('0x16')](function(_0x57a17d){logger[_0xb173('0x12')](_0xb173('0xf'),_0xc114eb,_0x57a17d);_0xcc38e4(_0x57a17d);});});} \ No newline at end of file +var _0x0645=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s'];(function(_0x4d515d,_0x108c96){var _0x58fe07=function(_0x2e18bf){while(--_0x2e18bf){_0x4d515d['push'](_0x4d515d['shift']());}};_0x58fe07(++_0x108c96);}(_0x0645,0x110));var _0x5064=function(_0x40be20,_0x37422f){_0x40be20=_0x40be20-0x0;var _0x27be68=_0x0645[_0x40be20];return _0x27be68;};'use strict';var _=require('lodash');var util=require(_0x5064('0x0'));var moment=require(_0x5064('0x1'));var BPromise=require(_0x5064('0x2'));var rs=require(_0x5064('0x3'));var fs=require('fs');var Redis=require(_0x5064('0x4'));var db=require(_0x5064('0x5'))['db'];var utils=require(_0x5064('0x6'));var logger=require(_0x5064('0x7'))(_0x5064('0x8'));var config=require(_0x5064('0x9'));var jayson=require(_0x5064('0xa'));var client=jayson[_0x5064('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2398b0,_0x56036b,_0x33e7e1){return new BPromise(function(_0x3fac8d,_0x1f8bf5){return client[_0x5064('0xc')](_0x2398b0,_0x33e7e1)[_0x5064('0xd')](function(_0x4960bc){logger[_0x5064('0xe')](_0x5064('0xf'),_0x56036b,_0x5064('0x10'));logger[_0x5064('0x11')](_0x5064('0x12'),_0x56036b,_0x5064('0x10'),JSON['stringify'](_0x4960bc));if(_0x4960bc['error']){if(_0x4960bc[_0x5064('0x13')][_0x5064('0x14')]===0x1f4){logger[_0x5064('0x13')](_0x5064('0xf'),_0x56036b,_0x4960bc[_0x5064('0x13')][_0x5064('0x15')]);return _0x1f8bf5(_0x4960bc[_0x5064('0x13')]['message']);}logger[_0x5064('0x13')](_0x5064('0xf'),_0x56036b,_0x4960bc['error'][_0x5064('0x15')]);return _0x3fac8d(_0x4960bc[_0x5064('0x13')]['message']);}else{logger['info']('License,\x20%s,\x20%s',_0x56036b,_0x5064('0x10'));_0x3fac8d(_0x4960bc[_0x5064('0x16')]['message']);}})[_0x5064('0x17')](function(_0x4ce282){logger['error'](_0x5064('0xf'),_0x56036b,_0x4ce282);_0x1f8bf5(_0x4ce282);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 360b3ba..150fad9 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 _0x0e02=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','addDisposition','addAnswer','post','addSmtp','/:id/interactions','addApplications','/:id/send','send','addAgents','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeImap','removeSmtp','exports'];(function(_0x2405de,_0x201c05){var _0x2e3ecb=function(_0x2ccef8){while(--_0x2ccef8){_0x2405de['push'](_0x2405de['shift']());}};_0x2e3ecb(++_0x201c05);}(_0x0e02,0xe6));var _0x20e0=function(_0x16df5e,_0x48ae27){_0x16df5e=_0x16df5e-0x0;var _0x366ee4=_0x0e02[_0x16df5e];return _0x366ee4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x20e0('0x0'));var timeout=require(_0x20e0('0x1'));var express=require(_0x20e0('0x2'));var router=express[_0x20e0('0x3')]();var fs_extra=require(_0x20e0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x20e0('0x5'));var config=require(_0x20e0('0x6'));var controller=require(_0x20e0('0x7'));router[_0x20e0('0x8')]('/',auth[_0x20e0('0x9')](),controller[_0x20e0('0xa')]);router['get'](_0x20e0('0xb'),auth[_0x20e0('0x9')](),controller[_0x20e0('0xc')]);router[_0x20e0('0x8')](_0x20e0('0xd'),auth[_0x20e0('0x9')](),controller[_0x20e0('0xe')]);router[_0x20e0('0x8')]('/:id/dispositions',auth[_0x20e0('0x9')](),controller[_0x20e0('0xf')]);router[_0x20e0('0x8')](_0x20e0('0x10'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x11')]);router[_0x20e0('0x8')](_0x20e0('0x12'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x13')]);router['get'](_0x20e0('0x14'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x15')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x20e0('0x8')](_0x20e0('0x16'),auth['isAuthenticated'](),controller[_0x20e0('0x17')]);router[_0x20e0('0x8')](_0x20e0('0x18'),auth['isAuthenticated'](),controller[_0x20e0('0x19')]);router[_0x20e0('0x8')](_0x20e0('0x1a'),auth['isAuthenticated'](),controller[_0x20e0('0x1b')]);router[_0x20e0('0x8')](_0x20e0('0x1c'),auth[_0x20e0('0x9')](),controller['getAgents']);router['post']('/:id/dispositions',auth[_0x20e0('0x9')](),controller[_0x20e0('0x1d')]);router['post'](_0x20e0('0x10'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x1e')]);router[_0x20e0('0x1f')]('/',auth[_0x20e0('0x9')](),controller['create']);router[_0x20e0('0x1f')](_0x20e0('0x12'),auth[_0x20e0('0x9')](),controller['addImap']);router[_0x20e0('0x1f')](_0x20e0('0x14'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x20')]);router[_0x20e0('0x1f')](_0x20e0('0x21'),auth[_0x20e0('0x9')](),controller['addInteraction']);router['post'](_0x20e0('0x16'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x22')]);router['post'](_0x20e0('0x23'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x24')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x20e0('0x25')]);router['put'](_0x20e0('0xd'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x26')]);router[_0x20e0('0x27')](_0x20e0('0x28'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x29')]);router['delete']('/:id/canned_answers',auth[_0x20e0('0x9')](),controller[_0x20e0('0x2a')]);router['delete'](_0x20e0('0x12'),auth['isAuthenticated'](),controller[_0x20e0('0x2b')]);router[_0x20e0('0x27')](_0x20e0('0x14'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x2c')]);router[_0x20e0('0x27')](_0x20e0('0xd'),auth[_0x20e0('0x9')](),controller['destroy']);router['delete'](_0x20e0('0x1c'),auth[_0x20e0('0x9')](),controller['removeAgents']);module[_0x20e0('0x2d')]=router; \ No newline at end of file +var _0x5876=['destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeImap'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5876,0x18b));var _0x6587=function(_0x2dd628,_0x3c22e4){_0x2dd628=_0x2dd628-0x0;var _0x2e138c=_0x5876[_0x2dd628];return _0x2e138c;};'use strict';var multer=require(_0x6587('0x0'));var util=require(_0x6587('0x1'));var path=require(_0x6587('0x2'));var timeout=require(_0x6587('0x3'));var express=require(_0x6587('0x4'));var router=express[_0x6587('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6587('0x6'));var config=require(_0x6587('0x7'));var controller=require(_0x6587('0x8'));router[_0x6587('0x9')]('/',auth[_0x6587('0xa')](),controller[_0x6587('0xb')]);router[_0x6587('0x9')](_0x6587('0xc'),auth[_0x6587('0xa')](),controller[_0x6587('0xd')]);router[_0x6587('0x9')](_0x6587('0xe'),auth[_0x6587('0xa')](),controller[_0x6587('0xf')]);router['get'](_0x6587('0x10'),auth[_0x6587('0xa')](),controller[_0x6587('0x11')]);router[_0x6587('0x9')](_0x6587('0x12'),auth[_0x6587('0xa')](),controller[_0x6587('0x13')]);router['get'](_0x6587('0x14'),auth[_0x6587('0xa')](),controller[_0x6587('0x15')]);router[_0x6587('0x9')]('/:id/out_servers',auth[_0x6587('0xa')](),controller[_0x6587('0x16')]);router[_0x6587('0x9')]('/:id/interactions',auth[_0x6587('0xa')](),controller[_0x6587('0x17')]);router[_0x6587('0x9')](_0x6587('0x18'),auth[_0x6587('0xa')](),controller['getApplications']);router['get'](_0x6587('0x19'),auth[_0x6587('0xa')](),controller[_0x6587('0x1a')]);router[_0x6587('0x9')](_0x6587('0x1b'),auth[_0x6587('0xa')](),controller[_0x6587('0x1c')]);router[_0x6587('0x9')](_0x6587('0x1d'),auth[_0x6587('0xa')](),controller[_0x6587('0x1e')]);router[_0x6587('0x1f')]('/:id/dispositions',auth[_0x6587('0xa')](),controller[_0x6587('0x20')]);router[_0x6587('0x1f')](_0x6587('0x12'),auth[_0x6587('0xa')](),controller[_0x6587('0x21')]);router['post']('/',auth[_0x6587('0xa')](),controller['create']);router['post']('/:id/in_servers',auth[_0x6587('0xa')](),controller[_0x6587('0x22')]);router[_0x6587('0x1f')](_0x6587('0x23'),auth['isAuthenticated'](),controller[_0x6587('0x24')]);router[_0x6587('0x1f')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x6587('0x25')]);router[_0x6587('0x1f')](_0x6587('0x18'),auth['isAuthenticated'](),controller['addApplications']);router[_0x6587('0x1f')](_0x6587('0x26'),auth[_0x6587('0xa')](),controller[_0x6587('0x27')]);router['post']('/:id/users',auth[_0x6587('0xa')](),controller['addAgents']);router[_0x6587('0x28')](_0x6587('0xe'),auth[_0x6587('0xa')](),controller[_0x6587('0x29')]);router[_0x6587('0x2a')](_0x6587('0x10'),auth[_0x6587('0xa')](),controller[_0x6587('0x2b')]);router['delete'](_0x6587('0x12'),auth[_0x6587('0xa')](),controller[_0x6587('0x2c')]);router[_0x6587('0x2a')]('/:id/in_servers',auth[_0x6587('0xa')](),controller[_0x6587('0x2d')]);router[_0x6587('0x2a')](_0x6587('0x23'),auth[_0x6587('0xa')](),controller['removeSmtp']);router[_0x6587('0x2a')](_0x6587('0xe'),auth[_0x6587('0xa')](),controller[_0x6587('0x2e')]);router[_0x6587('0x2a')](_0x6587('0x1d'),auth[_0x6587('0xa')](),controller[_0x6587('0x2f')]);module[_0x6587('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 733944e..1974ee7 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 _0x4036=['getDataValue','provider','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','outlook365'];(function(_0x34ded7,_0x5752df){var _0x39e7ce=function(_0x5bfc6c){while(--_0x5bfc6c){_0x34ded7['push'](_0x34ded7['shift']());}};_0x39e7ce(++_0x5752df);}(_0x4036,0x172));var _0x6403=function(_0x5183a2,_0x28354d){_0x5183a2=_0x5183a2-0x0;var _0x13db01=_0x4036[_0x5183a2];return _0x13db01;};'use strict';var Sequelize=require(_0x6403('0x0'));module[_0x6403('0x1')]={'description':{'type':Sequelize[_0x6403('0x2')]},'name':{'type':Sequelize[_0x6403('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x6403('0x4')]},'markAsUnread':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6403('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x6403('0x5')](0x2)[_0x6403('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6403('0x4')],'defaultValue':function(){return _0x6403('0x7');}},'notificationSound':{'type':Sequelize[_0x6403('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6403('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6403('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6403('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6403('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6403('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x50a85c){if(!_0x50a85c)this[_0x6403('0x8')](_0x6403('0x9'),null);this[_0x6403('0x8')]('mandatoryDisposition',_0x50a85c);}},'provider':{'type':Sequelize[_0x6403('0xa')](_0x6403('0xb'),_0x6403('0xc'),'yahoo',_0x6403('0xd')),'defaultValue':null,'get':function(){var _0x3e8f29=this[_0x6403('0xe')](_0x6403('0xf'));return _0x3e8f29||'custom';},'set':function(_0x163360){if(_0x163360==='custom'){_0x163360=null;}return this[_0x6403('0x8')](_0x6403('0xf'),_0x163360);}}}; \ No newline at end of file +var _0xee69=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','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'];(function(_0x55e631,_0x4e9bdb){var _0x1a0670=function(_0x3b53b1){while(--_0x3b53b1){_0x55e631['push'](_0x55e631['shift']());}};_0x1a0670(++_0x4e9bdb);}(_0xee69,0x171));var _0x9ee6=function(_0x15fcac,_0x3391f2){_0x15fcac=_0x15fcac-0x0;var _0x34ab36=_0xee69[_0x15fcac];return _0x34ab36;};'use strict';var Sequelize=require(_0x9ee6('0x0'));module[_0x9ee6('0x1')]={'description':{'type':Sequelize[_0x9ee6('0x2')]},'name':{'type':Sequelize[_0x9ee6('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x9ee6('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9ee6('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x9ee6('0x4')]},'markAsUnread':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9ee6('0x2')],'allowNull':![],'defaultValue':_0x9ee6('0x5')},'fontSize':{'type':Sequelize[_0x9ee6('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9ee6('0x4')],'defaultValue':function(){return _0x9ee6('0x7');}},'notificationSound':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9ee6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9ee6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9ee6('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1cf9ee){if(!_0x1cf9ee)this[_0x9ee6('0x9')](_0x9ee6('0xa'),null);this[_0x9ee6('0x9')](_0x9ee6('0xb'),_0x1cf9ee);}},'provider':{'type':Sequelize['ENUM'](_0x9ee6('0xc'),_0x9ee6('0xd'),'yahoo',_0x9ee6('0xe')),'defaultValue':null,'get':function(){var _0x4e92ec=this[_0x9ee6('0xf')](_0x9ee6('0x10'));return _0x4e92ec||'custom';},'set':function(_0x53e7e3){if(_0x53e7e3===_0x9ee6('0x11')){_0x53e7e3=null;}return this['setDataValue'](_0x9ee6('0x10'),_0x53e7e3);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4e2a832..c0d5214 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 _0x3757=['getDispositions','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','sort','removeAnswers','ListId','isNil','active','description','get','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','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','juice','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','destroy','sendStatus','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','MailAccount','include','findAll','params','Pause','includeAll','find','update','body','provider','custom','mandatoryDispositionPause','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create'];(function(_0x1fafdc,_0x55e96c){var _0x3f8801=function(_0x4f7a0f){while(--_0x4f7a0f){_0x1fafdc['push'](_0x1fafdc['shift']());}};_0x3f8801(++_0x55e96c);}(_0x3757,0x1ee));var _0x7375=function(_0x4814c5,_0x6f3000){_0x4814c5=_0x4814c5-0x0;var _0x5d8029=_0x3757[_0x4814c5];return _0x5d8029;};'use strict';var moment=require(_0x7375('0x0'));var BPromise=require(_0x7375('0x1'));var util=require(_0x7375('0x2'));var path=require('path');var _=require('lodash');var juice=require(_0x7375('0x3'));var Redis=require(_0x7375('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x7375('0x5'))(_0x7375('0x6'));var config=require('../../config/environment');var db=require(_0x7375('0x7'))['db'];config[_0x7375('0x8')]=_[_0x7375('0x9')](config[_0x7375('0x8')],{'host':_0x7375('0xa'),'port':0x18eb});var socket=require(_0x7375('0xb'))(new Redis(config[_0x7375('0x8')]));require(_0x7375('0xc'))[_0x7375('0xd')](socket);var jayson=require(_0x7375('0xe'));var client=jayson[_0x7375('0xf')][_0x7375('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x3eb425,_0x123d1f,_0x51c4ae,_0x59e114){return new BPromise(function(_0x57313a,_0x5d408d){var _0x4a4558=_0x59e114||client;return _0x4a4558[_0x7375('0x11')](_0x3eb425,_0x51c4ae)[_0x7375('0x12')](function(_0x4c3721){logger[_0x7375('0x13')](_0x7375('0x14'),_0x123d1f,_0x7375('0x15'));logger[_0x7375('0x16')](_0x7375('0x17'),_0x123d1f,'request\x20sent',JSON[_0x7375('0x18')](_0x4c3721));if(_0x4c3721[_0x7375('0x19')]){if(_0x4c3721[_0x7375('0x19')][_0x7375('0x1a')]===0x1f4){logger[_0x7375('0x19')](_0x7375('0x14'),_0x123d1f,_0x4c3721['error'][_0x7375('0x1b')]);return _0x5d408d(_0x4c3721[_0x7375('0x19')][_0x7375('0x1b')]);}logger[_0x7375('0x19')]('MailAccount,\x20%s,\x20%s',_0x123d1f,_0x4c3721['error'][_0x7375('0x1b')]);return _0x57313a(_0x4c3721[_0x7375('0x19')][_0x7375('0x1b')]);}else{logger[_0x7375('0x13')]('MailAccount,\x20%s,\x20%s',_0x123d1f,_0x7375('0x15'));_0x57313a(_0x4c3721['result'][_0x7375('0x1b')]);}})[_0x7375('0x1c')](function(_0x598123){logger[_0x7375('0x19')](_0x7375('0x14'),_0x123d1f,_0x598123);_0x5d408d(_0x598123);});});}function respondWithStatusCode(_0x6c68fa,_0x59b5c2){_0x59b5c2=_0x59b5c2||0xcc;return function(_0x4f6d01){if(_0x4f6d01){return _0x6c68fa['sendStatus'](_0x59b5c2);}return _0x6c68fa['status'](_0x59b5c2)[_0x7375('0x1d')]();};}function respondWithResult(_0x28f745,_0x3e73cb){_0x3e73cb=_0x3e73cb||0xc8;return function(_0x45033e){if(_0x45033e){return _0x28f745[_0x7375('0x1e')](_0x3e73cb)[_0x7375('0x1f')](_0x45033e);}};}function respondWithFilteredResult(_0x5035a5,_0x399ed1){return function(_0xd04d48){if(_0xd04d48){var _0x2bb1c7=typeof _0x399ed1[_0x7375('0x20')]===_0x7375('0x21')&&typeof _0x399ed1[_0x7375('0x22')]===_0x7375('0x21');var _0x4eaf00=_0xd04d48[_0x7375('0x23')];var _0x36b0ab=_0x2bb1c7?0x0:_0x399ed1[_0x7375('0x20')];var _0x4fd0e8=_0x2bb1c7?_0xd04d48[_0x7375('0x23')]:_0x399ed1['offset']+_0x399ed1['limit'];var _0x554d25;if(_0x4fd0e8>=_0x4eaf00){_0x4fd0e8=_0x4eaf00;_0x554d25=0xc8;}else{_0x554d25=0xce;}_0x5035a5['status'](_0x554d25);return _0x5035a5[_0x7375('0x24')](_0x7375('0x25'),_0x36b0ab+'-'+_0x4fd0e8+'/'+_0x4eaf00)['json'](_0xd04d48);}return null;};}function saveUpdates(_0x502320){return function(_0xfcd4c0){if(_0xfcd4c0){return _0xfcd4c0['update'](_0x502320)[_0x7375('0x12')](function(_0x39f99c){return _0x39f99c;});}return null;};}function removeEntity(_0x34b06b){return function(_0x30e0b7){if(_0x30e0b7){return _0x30e0b7[_0x7375('0x26')]()[_0x7375('0x12')](function(){var _0x412786=_0x30e0b7['get']({'plain':!![]});var _0x155856='MailAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x155856,'resourceId':_0x412786['id']}})[_0x7375('0x12')](function(){return _0x30e0b7;});})[_0x7375('0x12')](function(){_0x34b06b['status'](0xcc)[_0x7375('0x1d')]();});}};}function handleEntityNotFound(_0x2520de){return function(_0x486a7a){if(!_0x486a7a){_0x2520de[_0x7375('0x27')](0x194);}return _0x486a7a;};}function handleError(_0x4abb1b,_0x537e85){_0x537e85=_0x537e85||0x1f4;return function(_0x1bfb03){logger[_0x7375('0x19')](_0x1bfb03[_0x7375('0x28')]);if(_0x1bfb03[_0x7375('0x29')]){delete _0x1bfb03[_0x7375('0x29')];}_0x4abb1b[_0x7375('0x1e')](_0x537e85)[_0x7375('0x2a')](_0x1bfb03);};}function getImapHost(_0xdc6566){switch(_0xdc6566){case _0x7375('0x2b'):return'imap.gmail.com';case _0x7375('0x2c'):return _0x7375('0x2d');case _0x7375('0x2e'):return _0x7375('0x2f');case _0x7375('0x30'):return _0x7375('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0xdc6566);}function getSmtpHost(_0xebd9d7){switch(_0xebd9d7){case _0x7375('0x2b'):return _0x7375('0x32');case _0x7375('0x2c'):return _0x7375('0x33');case _0x7375('0x2e'):return _0x7375('0x34');case _0x7375('0x30'):return _0x7375('0x35');}throw new Error(_0x7375('0x36'),_0xebd9d7);}function getAuthenticationOptions(_0x2c7bea,_0x4ad25b){var _0x2a2435={};var _0x52633b={};if(_0x2c7bea){_0x2a2435[_0x7375('0x37')]=_0x52633b['user']=_0x4ad25b[_0x7375('0x38')];_0x2a2435[_0x7375('0x39')]=_0x52633b[_0x7375('0x3a')]=_0x4ad25b[_0x7375('0x39')];if(_0x4ad25b['modernAuthentication']){_0x2a2435[_0x7375('0x3b')]=_0x52633b['modernAuthentication']=!![];_0x2a2435[_0x7375('0x3c')]=_0x52633b[_0x7375('0x3c')]=_0x4ad25b[_0x7375('0x3c')];_0x2a2435[_0x7375('0x39')]=_0x52633b[_0x7375('0x3a')]=null;}else{_0x2a2435['CloudProviderId']=_0x52633b[_0x7375('0x3c')]=null;}_0x2a2435[_0x7375('0x3d')]=getImapHost(_0x2c7bea);_0x2a2435[_0x7375('0x3e')]=0x3e1;_0x52633b[_0x7375('0x3d')]=getSmtpHost(_0x2c7bea);_0x52633b[_0x7375('0x3e')]=0x24b;_0x52633b[_0x7375('0x3f')]=![];_0x2a2435[_0x7375('0x40')]=_0x52633b[_0x7375('0x40')]=null;}else{if(_0x4ad25b[_0x7375('0x41')]){_0x2a2435[_0x7375('0x37')]=_0x52633b[_0x7375('0x37')]=_0x4ad25b[_0x7375('0x38')];_0x2a2435[_0x7375('0x39')]=_0x52633b[_0x7375('0x3a')]=_0x4ad25b[_0x7375('0x39')];}else{_0x2a2435[_0x7375('0x41')]=_0x52633b[_0x7375('0x41')]=![];_0x2a2435['user']=_0x52633b['user']=null;_0x2a2435[_0x7375('0x39')]=_0x52633b['pass']=null;}_0x2a2435[_0x7375('0x3d')]=_0x4ad25b[_0x7375('0x42')]['host'];_0x2a2435['port']=_0x4ad25b[_0x7375('0x42')]['port'];_0x52633b[_0x7375('0x3d')]=_0x4ad25b[_0x7375('0x43')]['host'];_0x52633b['port']=_0x4ad25b[_0x7375('0x43')]['port'];}return{'Imap':_0x2a2435,'Smtp':_0x52633b};}exports[_0x7375('0x44')]=function(_0x340fdd,_0xc0636){var _0x5e9576={'include':[{'model':db[_0x7375('0x45')],'as':_0x7375('0x42')},{'model':db[_0x7375('0x46')],'as':_0x7375('0x43')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x38151c={},_0x55784d={'count':0x0,'rows':[]};var _0x30e6d4=_[_0x7375('0x47')](db['MailAccount'][_0x7375('0x48')],function(_0x15b5e3){return{'name':_0x15b5e3[_0x7375('0x49')],'type':_0x15b5e3[_0x7375('0x4a')][_0x7375('0x4b')]};});_0x38151c['model']=_[_0x7375('0x47')](_0x30e6d4,_0x7375('0x29'));_0x38151c['query']=_[_0x7375('0x4c')](_0x340fdd[_0x7375('0x4d')]);_0x38151c['filters']=_[_0x7375('0x4e')](_0x38151c[_0x7375('0x4f')],_0x38151c[_0x7375('0x4d')]);_0x5e9576[_0x7375('0x50')]=_[_0x7375('0x4e')](_0x38151c[_0x7375('0x4f')],qs[_0x7375('0x51')](_0x340fdd[_0x7375('0x4d')][_0x7375('0x51')]));_0x5e9576['attributes']=_0x5e9576[_0x7375('0x50')][_0x7375('0x52')]?_0x5e9576['attributes']:_0x38151c[_0x7375('0x4f')];if(!_0x340fdd[_0x7375('0x4d')][_0x7375('0x53')](_0x7375('0x54'))){_0x5e9576[_0x7375('0x22')]=qs['limit'](_0x340fdd[_0x7375('0x4d')]['limit']);_0x5e9576[_0x7375('0x20')]=qs[_0x7375('0x20')](_0x340fdd[_0x7375('0x4d')][_0x7375('0x20')]);}_0x5e9576['order']=qs['sort'](_0x340fdd[_0x7375('0x4d')]['sort']);_0x5e9576[_0x7375('0x55')]=qs[_0x7375('0x56')](_[_0x7375('0x57')](_0x340fdd[_0x7375('0x4d')],_0x38151c['filters']),_0x30e6d4);if(_0x340fdd[_0x7375('0x4d')][_0x7375('0x58')]){_0x5e9576['where']=_[_0x7375('0x59')](_0x5e9576['where'],{'$or':_['map'](_0x30e6d4,function(_0x174b3b){if(_0x174b3b['type']!==_0x7375('0x5a')){var _0x2846f0={};_0x2846f0[_0x174b3b[_0x7375('0x29')]]={'$like':'%'+_0x340fdd['query'][_0x7375('0x58')]+'%'};return _0x2846f0;}})});}_0x5e9576=_['merge']({},_0x5e9576,_0x340fdd[_0x7375('0x5b')]);var _0x591d90={'where':_0x5e9576[_0x7375('0x55')]};return db[_0x7375('0x5c')][_0x7375('0x23')](_0x591d90)[_0x7375('0x12')](function(_0x2061c9){_0x55784d[_0x7375('0x23')]=_0x2061c9;if(_0x340fdd[_0x7375('0x4d')]['includeAll']){_0x5e9576[_0x7375('0x5d')]=[{'all':!![]}];}return db[_0x7375('0x5c')][_0x7375('0x5e')](_0x5e9576);})[_0x7375('0x12')](function(_0x5dad5d){_0x55784d['rows']=_0x5dad5d;return _0x55784d;})[_0x7375('0x12')](respondWithFilteredResult(_0xc0636,_0x5e9576))['catch'](handleError(_0xc0636,null));};exports['show']=function(_0x2adf89,_0x133800){var _0xd751c0={'raw':![],'where':{'id':_0x2adf89[_0x7375('0x5f')]['id']},'include':[{'model':db[_0x7375('0x45')],'as':_0x7375('0x42')},{'model':db['MailServerOut'],'as':_0x7375('0x43')},{'model':db[_0x7375('0x60')],'as':'mandatoryDispositionPause'}]},_0x2db014={};_0x2db014[_0x7375('0x4f')]=_[_0x7375('0x4c')](db[_0x7375('0x5c')][_0x7375('0x48')]);_0x2db014[_0x7375('0x4d')]=_['keys'](_0x2adf89[_0x7375('0x4d')]);_0x2db014[_0x7375('0x56')]=_[_0x7375('0x4e')](_0x2db014['model'],_0x2db014[_0x7375('0x4d')]);_0xd751c0[_0x7375('0x50')]=_[_0x7375('0x4e')](_0x2db014['model'],qs['fields'](_0x2adf89[_0x7375('0x4d')][_0x7375('0x51')]));_0xd751c0[_0x7375('0x50')]=_0xd751c0['attributes']['length']?_0xd751c0[_0x7375('0x50')]:_0x2db014[_0x7375('0x4f')];if(_0x2adf89[_0x7375('0x4d')][_0x7375('0x61')]){_0xd751c0[_0x7375('0x5d')]=[{'all':!![]}];}_0xd751c0=_[_0x7375('0x59')]({},_0xd751c0,_0x2adf89[_0x7375('0x5b')]);return db['MailAccount'][_0x7375('0x62')](_0xd751c0)[_0x7375('0x12')](handleEntityNotFound(_0x133800,null))['then'](respondWithResult(_0x133800,null))[_0x7375('0x1c')](handleError(_0x133800,null));};exports[_0x7375('0x63')]=function(_0x272ef4,_0xa96d03){if(_0x272ef4[_0x7375('0x64')]['id']){delete _0x272ef4[_0x7375('0x64')]['id'];}var _0x4f8d6f=_0x272ef4[_0x7375('0x64')][_0x7375('0x65')]===_0x7375('0x66')?null:_0x272ef4['body'][_0x7375('0x65')];var _0x292a3e=_0x272ef4[_0x7375('0x64')][_0x7375('0x42')]||{};var _0x240a4c=_0x272ef4[_0x7375('0x64')][_0x7375('0x43')]||{};if(_0x4f8d6f){_0x292a3e['host']=getImapHost(_0x4f8d6f);_0x292a3e[_0x7375('0x3e')]=0x3e1;_0x240a4c[_0x7375('0x3d')]=getSmtpHost(_0x4f8d6f);_0x240a4c[_0x7375('0x3e')]=0x24b;_0x240a4c['secure']=![];}if(_0x240a4c['modernAuthentication']){_0x240a4c['secure']=![];}else{_0x240a4c[_0x7375('0x3c')]=null;}if(!_0x292a3e['modernAuthentication'])_0x292a3e['CloudProviderId']=null;_0x272ef4[_0x7375('0x64')][_0x7375('0x42')]=_0x292a3e;_0x272ef4['body'][_0x7375('0x43')]=_0x240a4c;return db[_0x7375('0x5c')]['find']({'where':{'id':_0x272ef4[_0x7375('0x5f')]['id']},'include':[{'model':db[_0x7375('0x45')],'as':_0x7375('0x42')},{'model':db[_0x7375('0x46')],'as':_0x7375('0x43')},{'model':db[_0x7375('0x60')],'as':_0x7375('0x67')}]})['then'](handleEntityNotFound(_0xa96d03,null))[_0x7375('0x12')](function(_0x38c17e){if(!_0x38c17e)throw new Error(_0x7375('0x68'));if(_0x38c17e[_0x7375('0x40')])delete _0x272ef4['body'][_0x7375('0x42')];return _0x38c17e;})['then'](saveUpdates(_0x272ef4['body'],null))[_0x7375('0x12')](function(_0x5af360){if(!_0x272ef4['body'][_0x7375('0x42')])return _0x5af360;return db[_0x7375('0x45')][_0x7375('0x63')](_0x272ef4[_0x7375('0x64')]['Imap'],{'where':{'MailAccountId':_0x5af360['id']}})[_0x7375('0x12')](function(){return _0x5af360;});})[_0x7375('0x12')](function(_0x14ad64){if(!_0x272ef4['body']['Smtp'])return _0x14ad64;return db[_0x7375('0x46')][_0x7375('0x63')](_0x272ef4[_0x7375('0x64')][_0x7375('0x43')],{'where':{'MailAccountId':_0x14ad64['id']}})[_0x7375('0x12')](function(){return _0x14ad64;});})[_0x7375('0x12')](respondWithResult(_0xa96d03,null))[_0x7375('0x1c')](handleError(_0xa96d03,null));};exports[_0x7375('0x69')]=function(_0x37ed5b,_0x2671cd){return db['MailAccount']['describe']()[_0x7375('0x12')](respondWithResult(_0x2671cd,null))[_0x7375('0x1c')](handleError(_0x2671cd,null));};exports['addDisposition']=function(_0x4d64b9,_0x522d17){if(_0x4d64b9[_0x7375('0x64')]['id']){delete _0x4d64b9[_0x7375('0x64')]['id'];}return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x4d64b9['params']['id']}})['then'](handleEntityNotFound(_0x522d17,null))['then'](function(_0x5a26de){if(_0x5a26de){_0x4d64b9['body'][_0x7375('0x6a')]=_0x5a26de['id'];return db[_0x7375('0x6b')][_0x7375('0x6c')](_0x4d64b9['body']);}})[_0x7375('0x12')](respondWithResult(_0x522d17,null))[_0x7375('0x1c')](handleError(_0x522d17,null));};exports[_0x7375('0x6d')]=function(_0x126fd9,_0x29edbf){var _0x4e403b={'raw':![],'where':{}};var _0x332e27={};var _0x2b9ff6={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x126fd9[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x29edbf,null))[_0x7375('0x12')](function(_0x46e6c0){if(_0x46e6c0){_0x332e27[_0x7375('0x4f')]=_[_0x7375('0x4c')](db[_0x7375('0x6b')][_0x7375('0x48')]);_0x332e27[_0x7375('0x4d')]=_[_0x7375('0x4c')](_0x126fd9[_0x7375('0x4d')]);_0x332e27['filters']=_[_0x7375('0x4e')](_0x332e27[_0x7375('0x4f')],_0x332e27[_0x7375('0x4d')]);_0x4e403b['attributes']=_[_0x7375('0x4e')](_0x332e27[_0x7375('0x4f')],qs['fields'](_0x126fd9[_0x7375('0x4d')][_0x7375('0x51')]));_0x4e403b['attributes']=_0x4e403b['attributes'][_0x7375('0x52')]?_0x4e403b[_0x7375('0x50')]:_0x332e27[_0x7375('0x4f')];if(!_0x126fd9[_0x7375('0x4d')]['hasOwnProperty'](_0x7375('0x54'))){_0x4e403b[_0x7375('0x22')]=qs[_0x7375('0x22')](_0x126fd9[_0x7375('0x4d')][_0x7375('0x22')]);_0x4e403b[_0x7375('0x20')]=qs[_0x7375('0x20')](_0x126fd9[_0x7375('0x4d')][_0x7375('0x20')]);}_0x4e403b[_0x7375('0x6e')]=qs['sort'](_0x126fd9[_0x7375('0x4d')]['sort']);_0x4e403b[_0x7375('0x55')]=qs[_0x7375('0x56')](_[_0x7375('0x57')](_0x126fd9['query'],_0x332e27[_0x7375('0x56')]));_0x4e403b[_0x7375('0x55')][_0x7375('0x6a')]=_0x46e6c0['id'];if(_0x126fd9[_0x7375('0x4d')]['filter']){_0x4e403b[_0x7375('0x55')]=_[_0x7375('0x59')](_0x4e403b[_0x7375('0x55')],{'$or':_[_0x7375('0x47')](_0x4e403b[_0x7375('0x50')],function(_0x3a0cfd){var _0x2502fe={};_0x2502fe[_0x3a0cfd]={'$like':'%'+_0x126fd9['query']['filter']+'%'};return _0x2502fe;})});}_0x4e403b=_['merge']({},_0x4e403b,_0x126fd9[_0x7375('0x5b')]);return db[_0x7375('0x6b')][_0x7375('0x23')]({'where':_0x4e403b['where']})['then'](function(_0x4dd124){_0x2b9ff6['count']=_0x4dd124;if(_0x126fd9[_0x7375('0x4d')]['includeAll']){_0x4e403b['include']=[{'all':!![]}];}return db[_0x7375('0x6b')][_0x7375('0x5e')](_0x4e403b);})[_0x7375('0x12')](function(_0x317cf7){_0x2b9ff6[_0x7375('0x6f')]=_0x317cf7;return _0x2b9ff6;});}})[_0x7375('0x12')](respondWithFilteredResult(_0x29edbf,_0x4e403b))[_0x7375('0x1c')](handleError(_0x29edbf,null));};exports[_0x7375('0x70')]=function(_0x59dc25,_0x2e1ee8){return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x59dc25['params']['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x2e1ee8,null))[_0x7375('0x12')](function(_0x26c5d6){if(_0x26c5d6){return _0x26c5d6[_0x7375('0x70')](_0x59dc25[_0x7375('0x4d')][_0x7375('0x71')]);}})[_0x7375('0x12')](respondWithStatusCode(_0x2e1ee8,null))[_0x7375('0x1c')](handleError(_0x2e1ee8,null));};exports[_0x7375('0x72')]=function(_0x2f8910,_0x27414e){if(_0x2f8910[_0x7375('0x64')]['id']){delete _0x2f8910[_0x7375('0x64')]['id'];}return db['MailAccount'][_0x7375('0x62')]({'where':{'id':_0x2f8910['params']['id']}})['then'](handleEntityNotFound(_0x27414e,null))['then'](function(_0x27c0e9){if(_0x27c0e9){_0x2f8910[_0x7375('0x64')][_0x7375('0x6a')]=_0x27c0e9['id'];return db[_0x7375('0x73')][_0x7375('0x6c')](_0x2f8910['body']);}})[_0x7375('0x12')](respondWithResult(_0x27414e,null))['catch'](handleError(_0x27414e,null));};exports[_0x7375('0x74')]=function(_0x54f9f7,_0x313176){var _0x40aa55={'raw':![],'where':{}};var _0x58746e={};var _0x19765e={'count':0x0,'rows':[]};return db['MailAccount'][_0x7375('0x75')]({'where':{'id':_0x54f9f7[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x313176,null))[_0x7375('0x12')](function(_0x84ce3e){if(_0x84ce3e){_0x58746e[_0x7375('0x4f')]=_[_0x7375('0x4c')](db[_0x7375('0x73')][_0x7375('0x48')]);_0x58746e[_0x7375('0x4d')]=_[_0x7375('0x4c')](_0x54f9f7['query']);_0x58746e[_0x7375('0x56')]=_[_0x7375('0x4e')](_0x58746e[_0x7375('0x4f')],_0x58746e['query']);_0x40aa55[_0x7375('0x50')]=_['intersection'](_0x58746e[_0x7375('0x4f')],qs['fields'](_0x54f9f7[_0x7375('0x4d')]['fields']));_0x40aa55[_0x7375('0x50')]=_0x40aa55[_0x7375('0x50')][_0x7375('0x52')]?_0x40aa55['attributes']:_0x58746e['model'];if(!_0x54f9f7['query']['hasOwnProperty'](_0x7375('0x54'))){_0x40aa55[_0x7375('0x22')]=qs[_0x7375('0x22')](_0x54f9f7[_0x7375('0x4d')][_0x7375('0x22')]);_0x40aa55['offset']=qs[_0x7375('0x20')](_0x54f9f7['query']['offset']);}_0x40aa55['order']=qs[_0x7375('0x76')](_0x54f9f7[_0x7375('0x4d')][_0x7375('0x76')]);_0x40aa55['where']=qs[_0x7375('0x56')](_[_0x7375('0x57')](_0x54f9f7[_0x7375('0x4d')],_0x58746e[_0x7375('0x56')]));_0x40aa55[_0x7375('0x55')][_0x7375('0x6a')]=_0x84ce3e['id'];if(_0x54f9f7[_0x7375('0x4d')][_0x7375('0x58')]){_0x40aa55[_0x7375('0x55')]=_['merge'](_0x40aa55[_0x7375('0x55')],{'$or':_[_0x7375('0x47')](_0x40aa55[_0x7375('0x50')],function(_0x2bdd2f){var _0x227b2c={};_0x227b2c[_0x2bdd2f]={'$like':'%'+_0x54f9f7['query']['filter']+'%'};return _0x227b2c;})});}_0x40aa55=_[_0x7375('0x59')]({},_0x40aa55,_0x54f9f7['options']);return db[_0x7375('0x73')]['count']({'where':_0x40aa55[_0x7375('0x55')]})[_0x7375('0x12')](function(_0x5f4381){_0x19765e[_0x7375('0x23')]=_0x5f4381;if(_0x54f9f7['query'][_0x7375('0x61')]){_0x40aa55['include']=[{'all':!![]}];}return db[_0x7375('0x73')][_0x7375('0x5e')](_0x40aa55);})['then'](function(_0x5376ba){_0x19765e[_0x7375('0x6f')]=_0x5376ba;return _0x19765e;});}})[_0x7375('0x12')](respondWithFilteredResult(_0x313176,_0x40aa55))[_0x7375('0x1c')](handleError(_0x313176,null));};exports[_0x7375('0x77')]=function(_0x185db3,_0x23477d){return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x185db3[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x23477d,null))[_0x7375('0x12')](function(_0x3284fc){if(_0x3284fc){return _0x3284fc[_0x7375('0x77')](_0x185db3['query'][_0x7375('0x71')]);}})['then'](respondWithStatusCode(_0x23477d,null))['catch'](handleError(_0x23477d,null));};exports['create']=function(_0x4a2aec,_0xd4a87d){var _0x32864a={'name':_0x4a2aec[_0x7375('0x64')][_0x7375('0x29')],'key':_0x4a2aec['body'][_0x7375('0x4b')],'provider':_0x4a2aec[_0x7375('0x64')]['provider']===_0x7375('0x66')?null:_0x4a2aec[_0x7375('0x64')][_0x7375('0x65')],'email':_0x4a2aec[_0x7375('0x64')]['email'],'ListId':_0x4a2aec[_0x7375('0x64')][_0x7375('0x78')],'active':!_[_0x7375('0x79')](_0x4a2aec[_0x7375('0x64')][_0x7375('0x7a')])?_0x4a2aec['body'][_0x7375('0x7a')]:!![],'description':_0x4a2aec[_0x7375('0x64')][_0x7375('0x7b')]||null};var _0x3b3c9b=getAuthenticationOptions(_0x32864a[_0x7375('0x65')],_0x4a2aec[_0x7375('0x64')]);_0x32864a[_0x7375('0x42')]=_0x3b3c9b[_0x7375('0x42')];_0x32864a[_0x7375('0x43')]=_0x3b3c9b[_0x7375('0x43')];return db[_0x7375('0x5c')]['create'](_0x32864a,{'include':[{'model':db['MailServerOut'],'as':_0x7375('0x43')},{'model':db['MailServerIn'],'as':_0x7375('0x42')}]})['then'](function(_0x242844){var _0x4f0ffc=_0x4a2aec[_0x7375('0x37')][_0x7375('0x7c')]({'plain':!![]});if(!_0x4f0ffc)throw new Error(_0x7375('0x7d'));if(_0x4f0ffc[_0x7375('0x7e')]==='user'){var _0x30adcb=_0x242844[_0x7375('0x7c')]({'plain':!![]});return db[_0x7375('0x7f')][_0x7375('0x62')]({'where':{'name':'MailAccounts','userProfileId':_0x4f0ffc[_0x7375('0x80')]},'raw':!![]})[_0x7375('0x12')](function(_0x322bda){if(_0x322bda&&_0x322bda[_0x7375('0x81')]===0x0){return db[_0x7375('0x82')][_0x7375('0x6c')]({'name':_0x30adcb['name'],'resourceId':_0x30adcb['id'],'type':_0x322bda[_0x7375('0x29')],'sectionId':_0x322bda['id']},{})[_0x7375('0x12')](function(){return _0x242844;});}else{return _0x242844;}})['catch'](function(_0x1ef8a4){logger['error'](_0x7375('0x83'),_0x1ef8a4);throw _0x1ef8a4;});}return _0x242844;})[_0x7375('0x12')](respondWithResult(_0xd4a87d,0xc9))['catch'](handleError(_0xd4a87d,null));};exports[_0x7375('0x84')]=function(_0x2cddc7,_0x8e594e){return db[_0x7375('0x5c')][_0x7375('0x75')]({'where':{'id':_0x2cddc7[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x8e594e,null))['then'](function(_0x585274){if(_0x585274){return _0x585274[_0x7375('0x84')]();}return null;})[_0x7375('0x12')](respondWithResult(_0x8e594e,null))[_0x7375('0x1c')](handleError(_0x8e594e,null));};exports[_0x7375('0x85')]=function(_0x9507a1,_0x167e34){if(_0x9507a1[_0x7375('0x64')]['id']){delete _0x9507a1[_0x7375('0x64')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x9507a1[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x167e34,null))['then'](function(_0x135164){if(_0x135164){_0x9507a1[_0x7375('0x64')][_0x7375('0x6a')]=_0x135164['id'];return db[_0x7375('0x45')]['create'](_0x9507a1[_0x7375('0x64')]);}})['then'](respondWithResult(_0x167e34,null))['catch'](handleError(_0x167e34,null));};exports[_0x7375('0x86')]=function(_0x80a032,_0x4f5b66){return db[_0x7375('0x5c')][_0x7375('0x75')]({'where':{'id':_0x80a032[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x4f5b66,null))[_0x7375('0x12')](function(_0x577df7){if(_0x577df7){return _0x577df7[_0x7375('0x87')](null);}return null;})[_0x7375('0x12')](respondWithStatusCode(_0x4f5b66,null))[_0x7375('0x1c')](handleError(_0x4f5b66,null));};exports[_0x7375('0x88')]=function(_0x2681f9,_0x5ba409){return db[_0x7375('0x5c')][_0x7375('0x75')]({'where':{'id':_0x2681f9['params']['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x5ba409,null))[_0x7375('0x12')](function(_0xbd12e9){if(_0xbd12e9){return _0xbd12e9['getSmtp']();}return null;})[_0x7375('0x12')](respondWithResult(_0x5ba409,null))['catch'](handleError(_0x5ba409,null));};exports[_0x7375('0x89')]=function(_0x55eab8,_0x28b688){if(_0x55eab8[_0x7375('0x64')]['id']){delete _0x55eab8['body']['id'];}return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x55eab8[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x28b688,null))['then'](function(_0x573426){if(_0x573426){_0x55eab8[_0x7375('0x64')][_0x7375('0x6a')]=_0x573426['id'];return db[_0x7375('0x46')]['create'](_0x55eab8['body']);}})[_0x7375('0x12')](respondWithResult(_0x28b688,null))[_0x7375('0x1c')](handleError(_0x28b688,null));};exports[_0x7375('0x8a')]=function(_0x185f49,_0x3bf5b5){return db[_0x7375('0x5c')]['findOne']({'where':{'id':_0x185f49['params']['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x3bf5b5,null))[_0x7375('0x12')](function(_0x447204){if(_0x447204){return _0x447204[_0x7375('0x8b')](null);}return null;})[_0x7375('0x12')](respondWithStatusCode(_0x3bf5b5,null))[_0x7375('0x1c')](handleError(_0x3bf5b5,null));};exports[_0x7375('0x8c')]=function(_0x4e2b0e,_0x32baca){return db[_0x7375('0x8d')]['find']({'where':{'id':_0x4e2b0e[_0x7375('0x5f')]['id']}})['then'](handleEntityNotFound(_0x32baca,null))[_0x7375('0x12')](function(_0x16f13e){if(_0x16f13e){return _0x16f13e[_0x7375('0x8c')](_0x4e2b0e[_0x7375('0x64')]['ids'],_[_0x7375('0x8e')](_0x4e2b0e[_0x7375('0x64')],[_0x7375('0x71'),'id'])||{});}})['then'](respondWithResult(_0x32baca,null))['catch'](handleError(_0x32baca,null));};exports[_0x7375('0x8f')]=function(_0x2edff8,_0x1b9824){var _0x423962={'raw':![],'where':{}};var _0x52e013={};var _0x57ee53={'count':0x0,'rows':[]};return db[_0x7375('0x5c')]['findOne']({'where':{'id':_0x2edff8['params']['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x1b9824,null))[_0x7375('0x12')](function(_0x1a698a){if(_0x1a698a){_0x52e013[_0x7375('0x4f')]=_[_0x7375('0x4c')](db[_0x7375('0x8d')][_0x7375('0x48')]);_0x52e013[_0x7375('0x4d')]=_[_0x7375('0x4c')](_0x2edff8[_0x7375('0x4d')]);_0x52e013['filters']=_[_0x7375('0x4e')](_0x52e013[_0x7375('0x4f')],_0x52e013[_0x7375('0x4d')]);_0x423962[_0x7375('0x50')]=_[_0x7375('0x4e')](_0x52e013[_0x7375('0x4f')],qs[_0x7375('0x51')](_0x2edff8[_0x7375('0x4d')][_0x7375('0x51')]));_0x423962[_0x7375('0x50')]=_0x423962[_0x7375('0x50')][_0x7375('0x52')]?_0x423962[_0x7375('0x50')]:_0x52e013['model'];if(!_0x2edff8[_0x7375('0x4d')][_0x7375('0x53')](_0x7375('0x54'))){_0x423962[_0x7375('0x22')]=qs['limit'](_0x2edff8['query'][_0x7375('0x22')]);_0x423962[_0x7375('0x20')]=qs[_0x7375('0x20')](_0x2edff8[_0x7375('0x4d')][_0x7375('0x20')]);}_0x423962['order']=qs[_0x7375('0x76')](_0x2edff8[_0x7375('0x4d')][_0x7375('0x76')]);_0x423962['where']=qs[_0x7375('0x56')](_[_0x7375('0x57')](_0x2edff8[_0x7375('0x4d')],_0x52e013[_0x7375('0x56')]));_0x423962[_0x7375('0x55')][_0x7375('0x6a')]=_0x1a698a['id'];if(_0x2edff8[_0x7375('0x4d')][_0x7375('0x58')]){_0x423962[_0x7375('0x55')]=_['merge'](_0x423962[_0x7375('0x55')],{'$or':_[_0x7375('0x47')](_0x423962[_0x7375('0x50')],function(_0x539164){var _0x579c8a={};_0x579c8a[_0x539164]={'$like':'%'+_0x2edff8[_0x7375('0x4d')][_0x7375('0x58')]+'%'};return _0x579c8a;})});}_0x423962=_[_0x7375('0x59')]({},_0x423962,_0x2edff8[_0x7375('0x5b')]);return db[_0x7375('0x8d')]['count']({'where':_0x423962['where']})[_0x7375('0x12')](function(_0x3049c0){_0x57ee53[_0x7375('0x23')]=_0x3049c0;if(_0x2edff8[_0x7375('0x4d')][_0x7375('0x61')]){_0x423962[_0x7375('0x5d')]=[{'model':db[_0x7375('0x90')],'as':_0x7375('0x91'),'required':![]},{'model':db[_0x7375('0x92')],'as':_0x7375('0x93'),'attributes':['name','fullname',_0x7375('0x94')],'required':![]},{'model':db[_0x7375('0x95')],'as':_0x7375('0x96'),'attributes':['id',_0x7375('0x29'),_0x7375('0x97')],'where':_0x2edff8[_0x7375('0x4d')][_0x7375('0x98')]?{'id':_0x2edff8[_0x7375('0x4d')][_0x7375('0x98')]}:undefined,'required':_0x2edff8[_0x7375('0x4d')][_0x7375('0x98')]?!![]:![]}];}return db['MailInteraction'][_0x7375('0x5e')](_0x423962);})[_0x7375('0x12')](function(_0x2c445f){_0x57ee53[_0x7375('0x6f')]=_0x2c445f;return _0x57ee53;});}})[_0x7375('0x12')](respondWithFilteredResult(_0x1b9824,_0x423962))[_0x7375('0x1c')](handleError(_0x1b9824,null));};exports['addApplications']=function addApplications(_0x5a09af,_0x596a7e){var _0x3d2191=_0x5a09af[_0x7375('0x5f')]['id'];var _0x3f2972=_0x5a09af[_0x7375('0x64')];var _0x1bbd9c=0xc8;var _0x97cd9d=null;return db[_0x7375('0x99')][_0x7375('0x9a')]({'isolationLevel':db[_0x7375('0x99')][_0x7375('0x9b')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3cd599){return db[_0x7375('0x5c')][_0x7375('0x75')]({'where':{'id':_0x3d2191},'transaction':_0x3cd599})[_0x7375('0x12')](function(_0x3e02b8){if(_0x3e02b8){return db[_0x7375('0x9c')]['destroy']({'where':{'MailAccountId':_0x3d2191},'transaction':_0x3cd599})[_0x7375('0x12')](function(){var _0x2002a0=_['map'](_0x3f2972,function(_0x50220e){_0x50220e[_0x7375('0x6a')]=_0x3d2191;return _0x50220e;});return db[_0x7375('0x9c')]['bulkCreate'](_0x2002a0,{'transaction':_0x3cd599});});}else{_0x1bbd9c=0x194;_0x97cd9d=[];}});})[_0x7375('0x12')](function(){if(_0x1bbd9c!==0x194){return db[_0x7375('0x9c')][_0x7375('0x9d')]({'where':{'MailAccountId':_0x3d2191},'order':_0x7375('0x9e')})[_0x7375('0x12')](function(_0x1dd37f){_0x97cd9d=_0x1dd37f;});}})['catch'](function(_0x392d31){_0x1bbd9c=0x1f4;logger[_0x7375('0x19')](_0x392d31[_0x7375('0x28')]);if(_0x392d31[_0x7375('0x29')]){delete _0x392d31[_0x7375('0x29')];}_0x97cd9d=_0x392d31;})[_0x7375('0x9f')](function(){if(_0x97cd9d===null){_0x596a7e['sendStatus'](_0x1bbd9c);}else{if(_0x1bbd9c===0x1f4){_0x596a7e['status'](_0x1bbd9c)[_0x7375('0x2a')](_0x97cd9d);}else{_0x596a7e[_0x7375('0x1e')](_0x1bbd9c)[_0x7375('0x1f')](_0x97cd9d);}}});};exports[_0x7375('0xa0')]=function(_0x32d75d,_0x55b9e3){var _0x15ea38={};var _0x44cce6={};var _0x5867c2;var _0x446a54;return db[_0x7375('0x5c')]['findOne']({'where':{'id':_0x32d75d[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x55b9e3,null))[_0x7375('0x12')](function(_0x2dcc75){if(_0x2dcc75){_0x5867c2=_0x2dcc75;_0x44cce6[_0x7375('0x4f')]=_[_0x7375('0x4c')](db[_0x7375('0x9c')][_0x7375('0x48')]);_0x44cce6[_0x7375('0x4d')]=_['keys'](_0x32d75d['query']);_0x44cce6['filters']=_[_0x7375('0x4e')](_0x44cce6[_0x7375('0x4f')],_0x44cce6['query']);_0x15ea38[_0x7375('0x50')]=_['intersection'](_0x44cce6[_0x7375('0x4f')],qs[_0x7375('0x51')](_0x32d75d[_0x7375('0x4d')][_0x7375('0x51')]));_0x15ea38[_0x7375('0x50')]=_0x15ea38[_0x7375('0x50')][_0x7375('0x52')]?_0x15ea38[_0x7375('0x50')]:_0x44cce6[_0x7375('0x4f')];_0x15ea38[_0x7375('0x6e')]=qs[_0x7375('0x76')](_0x32d75d[_0x7375('0x4d')][_0x7375('0x76')]);_0x15ea38[_0x7375('0x55')]=qs[_0x7375('0x56')](_['pick'](_0x32d75d['query'],_0x44cce6[_0x7375('0x56')]));if(_0x32d75d['query'][_0x7375('0x58')]){_0x15ea38['where']=_[_0x7375('0x59')](_0x15ea38['where'],{'$or':_['map'](_0x15ea38[_0x7375('0x50')],function(_0x1c17b0){var _0x321113={};_0x321113[_0x1c17b0]={'$like':'%'+_0x32d75d['query'][_0x7375('0x58')]+'%'};return _0x321113;})});}_0x15ea38=_['merge']({},_0x15ea38,_0x32d75d[_0x7375('0x5b')]);return _0x5867c2[_0x7375('0xa0')](_0x15ea38);}})[_0x7375('0x12')](function(_0x4beb93){if(_0x4beb93){_0x446a54=_0x4beb93[_0x7375('0x52')];if(!_0x32d75d['query'][_0x7375('0x53')](_0x7375('0x54'))){_0x15ea38[_0x7375('0x22')]=qs[_0x7375('0x22')](_0x32d75d[_0x7375('0x4d')][_0x7375('0x22')]);_0x15ea38[_0x7375('0x20')]=qs[_0x7375('0x20')](_0x32d75d[_0x7375('0x4d')][_0x7375('0x20')]);}return _0x5867c2[_0x7375('0xa0')](_0x15ea38);}})['then'](function(_0x4dfd83){if(_0x4dfd83){return _0x4dfd83?{'count':_0x446a54,'rows':_0x4dfd83}:null;}})[_0x7375('0x12')](respondWithResult(_0x55b9e3,null))[_0x7375('0x1c')](handleError(_0x55b9e3,null));};exports[_0x7375('0xa1')]=function(_0xb046f2,_0x1355ae){var _0x1be238={'raw':!![],'where':{}};var _0x73425f={};var _0x218038={'count':0x0,'rows':[]};return db['MailAccount'][_0x7375('0x75')]({'where':{'id':_0xb046f2[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x1355ae,null))[_0x7375('0x12')](function(_0x3f62f6){if(_0x3f62f6){_0x73425f[_0x7375('0x4f')]=_['keys'](db[_0x7375('0xa2')][_0x7375('0x48')]);_0x73425f[_0x7375('0x4d')]=_['keys'](_0xb046f2[_0x7375('0x4d')]);_0x73425f[_0x7375('0x56')]=_[_0x7375('0x4e')](_0x73425f[_0x7375('0x4f')],_0x73425f[_0x7375('0x4d')]);_0x1be238[_0x7375('0x50')]=_[_0x7375('0x4e')](_0x73425f['model'],qs[_0x7375('0x51')](_0xb046f2[_0x7375('0x4d')][_0x7375('0x51')]));_0x1be238[_0x7375('0x50')]=_0x1be238['attributes']['length']?_0x1be238['attributes']:_0x73425f['model'];if(!_0xb046f2[_0x7375('0x4d')][_0x7375('0x53')](_0x7375('0x54'))){_0x1be238[_0x7375('0x22')]=qs['limit'](_0xb046f2['query'][_0x7375('0x22')]);_0x1be238[_0x7375('0x20')]=qs[_0x7375('0x20')](_0xb046f2['query']['offset']);}_0x1be238[_0x7375('0x6e')]=qs[_0x7375('0x76')](_0xb046f2['query']['sort']);_0x1be238[_0x7375('0x55')]=qs[_0x7375('0x56')](_[_0x7375('0x57')](_0xb046f2[_0x7375('0x4d')],_0x73425f['filters']));_0x1be238[_0x7375('0x55')][_0x7375('0x6a')]=_0x3f62f6['id'];if(_0xb046f2[_0x7375('0x4d')]['filter']){_0x1be238['where']=_[_0x7375('0x59')](_0x1be238[_0x7375('0x55')],{'$or':_['map'](_0x1be238[_0x7375('0x50')],function(_0x4815f6){var _0x1121fc={};_0x1121fc[_0x4815f6]={'$like':'%'+_0xb046f2[_0x7375('0x4d')]['filter']+'%'};return _0x1121fc;})});}if(_0xb046f2[_0x7375('0x4d')]['$gte']){var _0x426f3a=_0xb046f2[_0x7375('0x4d')]['$gte'][_0x7375('0xa3')](',');var _0x42af65={};_0x42af65[_0x426f3a[0x0]]={'$gte':moment(_0x426f3a[0x1])['format'](_0x7375('0xa4'))};_0x1be238[_0x7375('0x55')]=_[_0x7375('0x59')](_0x1be238[_0x7375('0x55')],_0x42af65);}_0x1be238=_[_0x7375('0x59')]({},_0x1be238,_0xb046f2['options']);return db['MailMessage'][_0x7375('0x23')]({'where':_0x1be238[_0x7375('0x55')]})[_0x7375('0x12')](function(_0x34b082){_0x218038[_0x7375('0x23')]=_0x34b082;if(_0xb046f2['query'][_0x7375('0x61')]){_0x1be238[_0x7375('0x5d')]=[{'all':!![]}];}return db[_0x7375('0xa2')][_0x7375('0x5e')](_0x1be238);})[_0x7375('0x12')](function(_0x3b9bd9){if(_0xb046f2[_0x7375('0x4d')][_0x7375('0xa5')]===_0x7375('0xa6')){for(var _0x30703e=0x0;_0x30703e<_0x3b9bd9[_0x7375('0x52')];_0x30703e++){_0x3b9bd9[_0x30703e][_0x7375('0x64')]=juice(_0x3b9bd9[_0x30703e]['body']);}}_0x218038['rows']=_0x3b9bd9;return _0x218038;});}})['then'](respondWithFilteredResult(_0x1355ae,_0x1be238))[_0x7375('0x1c')](handleError(_0x1355ae,null));};exports[_0x7375('0x2a')]=function(_0x462397,_0x38b19f){var _0xa26944,_0x59ad0a={},_0x559635;if(_0x462397[_0x7375('0x64')]['to']){_0x559635=_0x462397['body']['to'][_0x7375('0xa3')](',')[0x0];}return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x462397[_0x7375('0x5f')]['id']},'include':[{'model':db[_0x7375('0xa7')],'as':_0x7375('0xa8'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x559635},'limit':0x1,'order':[['updatedAt',_0x7375('0xa9')]]}]},{'model':db['MailServerOut'],'as':_0x7375('0x43'),'raw':!![],'include':[{'model':db[_0x7375('0xaa')],'as':'CloudProvider','raw':!![]}]}]})[_0x7375('0x12')](handleEntityNotFound(_0x38b19f,null))['then'](function(_0x3a23ff){if(!_0x3a23ff)return;_0xa26944=_0x3a23ff;if(!_0x3a23ff[_0x7375('0x43')])throw new Error(_0x7375('0xab'));if(_['isNil'](_0x462397['body'][_0x7375('0xac')])){_0x462397[_0x7375('0x64')][_0x7375('0xac')]=util[_0x7375('0xad')](_0x7375('0xae'),_0x3a23ff['name'],_0x3a23ff['email']||_0x3a23ff['Smtp'][_0x7375('0x37')]);}if(_0x462397[_0x7375('0x64')]['attachments']&&_0x462397['body'][_0x7375('0xaf')]['length']){for(var _0xa8e00a=0x0;_0xa8e00a<_0x462397['body'][_0x7375('0xaf')][_0x7375('0x52')];_0xa8e00a+=0x1){_0x462397[_0x7375('0x64')]['attachments'][_0xa8e00a]={'filename':_0x462397['body'][_0x7375('0xaf')][_0xa8e00a][_0x7375('0x29')],'path':path[_0x7375('0xb0')](config[_0x7375('0xb1')],_0x7375('0xb2'),_0x462397[_0x7375('0x64')][_0x7375('0xaf')][_0xa8e00a][_0x7375('0xb3')])};}}var _0x3f7546=_0x3a23ff[_0x7375('0xb4')]();return respondWithRpcPromise(_0x7375('0xb5'),'sendMail',{'account':_0x3f7546,'message':_0x462397[_0x7375('0x64')]});})['then'](function(_0x5a75bd){if(!_0x5a75bd)return;_0x59ad0a=_0x5a75bd;if(!_0xa26944['List'])throw new Error(_0x7375('0xb6'));if(_0xa26944['List'][_0x7375('0xb7')]['length'])return _0xa26944[_0x7375('0xa8')][_0x7375('0xb7')][0x0];return db[_0x7375('0x90')]['create'](_['defaults'](_0x462397[_0x7375('0x64')],{'firstName':_0x462397[_0x7375('0x64')]['to'],'email':_0x462397[_0x7375('0x64')]['to'],'phone':_0x462397['body']['to'],'ListId':_0xa26944[_0x7375('0x78')]}));})[_0x7375('0x12')](function(_0x3317a1){if(!_0x3317a1)return;var _0x57d53d={'UserId':_0x462397[_0x7375('0x37')]['id'],'ContactId':_0x3317a1['id'],'MailAccountId':_0xa26944['id'],'inReplyTo':_0x59ad0a[_0x7375('0xb8')],'to':_0x462397['body']['from'],'cc':_0x462397[_0x7375('0x64')]['cc'],'subject':_0x462397[_0x7375('0x64')][_0x7375('0xb9')],'attach':_0x462397['body'][_0x7375('0xba')],'firstMsgDirection':_0x7375('0xbb'),'lastMsgAt':moment()[_0x7375('0xad')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x7375('0xbb'),'Messages':[_['merge'](_0x462397[_0x7375('0x64')],{'messageId':_0x59ad0a['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0xa26944['id'],'UserId':_0x462397['user']['id'],'ContactId':_0x3317a1['id']})]};if(_0x462397[_0x7375('0x64')][_0x7375('0xbc')]){_0x57d53d=_[_0x7375('0x59')](_0x57d53d,_0x462397[_0x7375('0x64')]['Interaction']);}return db[_0x7375('0x8d')][_0x7375('0x6c')](_0x57d53d,{'include':[{'model':db[_0x7375('0xa2')],'as':_0x7375('0xbd')}]});})[_0x7375('0x12')](respondWithResult(_0x38b19f,null))['catch'](handleError(_0x38b19f,null));};exports[_0x7375('0xbe')]=function(_0x3cfbe8,_0x3fe8be){return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x3cfbe8[_0x7375('0x5f')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x7375('0xaa')],'as':_0x7375('0xaa'),'raw':!![]}]}]})[_0x7375('0x12')](handleEntityNotFound(_0x3fe8be,null))['then'](function(_0x6985c9){if(!_0x6985c9[_0x7375('0x43')])return;var _0x84d7a=_0x6985c9[_0x7375('0xb4')]();return respondWithRpcPromise(_0x7375('0xbf'),_0x7375('0xbe'),{'account':_0x84d7a});})[_0x7375('0x12')](respondWithResult(_0x3fe8be,null))['catch'](handleError(_0x3fe8be,null));};exports[_0x7375('0x26')]=function(_0x14cbb7,_0x16cf1a){return db[_0x7375('0x5c')]['find']({'where':{'id':_0x14cbb7[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x16cf1a,null))[_0x7375('0x12')](function(_0x2baef3){if(_0x2baef3&&_0x2baef3['service']){throw new db[(_0x7375('0xc0'))][(_0x7375('0xc1'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2baef3;})[_0x7375('0x12')](removeEntity(_0x16cf1a,null))[_0x7375('0x1c')](handleError(_0x16cf1a,null));};exports[_0x7375('0xc2')]=function(_0x491912,_0x54a857){return db['MailAccount']['find']({'where':{'id':_0x491912[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x54a857,null))[_0x7375('0x12')](function(_0x151b6d){if(_0x151b6d){return _0x151b6d[_0x7375('0xc2')](_0x491912[_0x7375('0x64')][_0x7375('0x71')],_[_0x7375('0x8e')](_0x491912['body'],[_0x7375('0x71'),'id'])||{})[_0x7375('0xc3')](function(_0x446b0e){for(var _0x5eb51c=0x0;_0x5eb51c<_0x491912[_0x7375('0x64')][_0x7375('0x71')][_0x7375('0x52')];_0x5eb51c+=0x1){socket[_0x7375('0xc4')](_0x7375('0xc5'),{'UserId':Number(_0x491912['body'][_0x7375('0x71')][_0x5eb51c]),'MailAccountId':Number(_0x491912[_0x7375('0x5f')]['id'])});}return _0x446b0e;});}})[_0x7375('0x12')](respondWithResult(_0x54a857,null))[_0x7375('0x1c')](handleError(_0x54a857,null));};exports['removeAgents']=function(_0x5410a0,_0x24b0fc){return db[_0x7375('0x5c')]['find']({'where':{'id':_0x5410a0['params']['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x24b0fc,null))[_0x7375('0x12')](function(_0x533556){if(_0x533556){return _0x533556['removeAgents'](_0x5410a0['query'][_0x7375('0x71')])['then'](function(){if(_[_0x7375('0xc6')](_0x5410a0[_0x7375('0x4d')][_0x7375('0x71')])){for(var _0x2c4640=0x0;_0x2c4640<_0x5410a0[_0x7375('0x4d')][_0x7375('0x71')]['length'];_0x2c4640+=0x1){socket[_0x7375('0xc4')](_0x7375('0xc7'),{'UserId':Number(_0x5410a0[_0x7375('0x4d')]['ids'][_0x2c4640]),'MailAccountId':Number(_0x5410a0[_0x7375('0x5f')]['id'])});}}else{socket['emit'](_0x7375('0xc7'),{'UserId':Number(_0x5410a0[_0x7375('0x4d')][_0x7375('0x71')]),'MailAccountId':Number(_0x5410a0[_0x7375('0x5f')]['id'])});}});}})[_0x7375('0x12')](respondWithStatusCode(_0x24b0fc,null))[_0x7375('0x1c')](handleError(_0x24b0fc,null));};exports[_0x7375('0xc8')]=function(_0x446564,_0x3ca6ac){var _0x107a48={};var _0x24e597={};var _0x3e37a4;var _0x555c8f;return db[_0x7375('0x5c')]['findOne']({'where':{'id':_0x446564['params']['id']}})['then'](handleEntityNotFound(_0x3ca6ac,null))['then'](function(_0x401762){if(_0x401762){_0x3e37a4=_0x401762;_0x24e597[_0x7375('0x4f')]=_['keys'](db[_0x7375('0x92')]['rawAttributes']);_0x24e597[_0x7375('0x4d')]=_[_0x7375('0x4c')](_0x446564['query']);_0x24e597[_0x7375('0x56')]=_[_0x7375('0x4e')](_0x24e597[_0x7375('0x4f')],_0x24e597[_0x7375('0x4d')]);_0x107a48[_0x7375('0x50')]=_[_0x7375('0x4e')](_0x24e597[_0x7375('0x4f')],qs[_0x7375('0x51')](_0x446564[_0x7375('0x4d')][_0x7375('0x51')]));_0x107a48[_0x7375('0x50')]=_0x107a48[_0x7375('0x50')][_0x7375('0x52')]?_0x107a48[_0x7375('0x50')]:_0x24e597['model'];_0x107a48[_0x7375('0x6e')]=qs['sort'](_0x446564[_0x7375('0x4d')][_0x7375('0x76')]);_0x107a48[_0x7375('0x55')]=qs[_0x7375('0x56')](_['pick'](_0x446564[_0x7375('0x4d')],_0x24e597[_0x7375('0x56')]));if(_0x446564[_0x7375('0x4d')][_0x7375('0x58')]){_0x107a48['where']=_[_0x7375('0x59')](_0x107a48[_0x7375('0x55')],{'$or':_[_0x7375('0x47')](_0x107a48[_0x7375('0x50')],function(_0x10f73e){var _0x45d830={};_0x45d830[_0x10f73e]={'$like':'%'+_0x446564['query']['filter']+'%'};return _0x45d830;})});}_0x107a48=_['merge']({},_0x107a48,_0x446564['options']);return _0x3e37a4['getAgents'](_0x107a48);}})[_0x7375('0x12')](function(_0x5234f1){if(_0x5234f1){_0x555c8f=_0x5234f1[_0x7375('0x52')];if(!_0x446564[_0x7375('0x4d')][_0x7375('0x53')](_0x7375('0x54'))){_0x107a48[_0x7375('0x22')]=qs[_0x7375('0x22')](_0x446564[_0x7375('0x4d')]['limit']);_0x107a48[_0x7375('0x20')]=qs[_0x7375('0x20')](_0x446564[_0x7375('0x4d')][_0x7375('0x20')]);}return _0x3e37a4[_0x7375('0xc8')](_0x107a48);}})['then'](function(_0x377a06){if(_0x377a06){return _0x377a06?{'count':_0x555c8f,'rows':_0x377a06}:null;}})[_0x7375('0x12')](respondWithResult(_0x3ca6ac,null))[_0x7375('0x1c')](handleError(_0x3ca6ac,null));}; \ No newline at end of file +var _0x6010=['Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','user','username','password','pass','modernAuthentication','CloudProviderId','port','secure','service','authentication','host','Imap','Smtp','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','name','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','MailAccount','include','show','params','find','catch','body','provider','custom','MailServerIn','MailServerOut','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','pick','MailAccountId','filter','includeAll','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','ListId','attach','out','messageId','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com'];(function(_0x4c725c,_0x3921b8){var _0x43c07d=function(_0x47165a){while(--_0x47165a){_0x4c725c['push'](_0x4c725c['shift']());}};_0x43c07d(++_0x3921b8);}(_0x6010,0x91));var _0x0601=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x6010[_0x264b9b];return _0x4c7a0e;};'use strict';var moment=require('moment');var BPromise=require(_0x0601('0x0'));var util=require(_0x0601('0x1'));var path=require(_0x0601('0x2'));var _=require(_0x0601('0x3'));var juice=require(_0x0601('0x4'));var Redis=require(_0x0601('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x0601('0x6'))('api');var config=require(_0x0601('0x7'));var db=require(_0x0601('0x8'))['db'];config['redis']=_[_0x0601('0x9')](config[_0x0601('0xa')],{'host':_0x0601('0xb'),'port':0x18eb});var socket=require(_0x0601('0xc'))(new Redis(config[_0x0601('0xa')]));require(_0x0601('0xd'))[_0x0601('0xe')](socket);var jayson=require(_0x0601('0xf'));var client=jayson['client'][_0x0601('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x25701e,_0x90d24c,_0x1c81b5,_0xcaa3de){return new BPromise(function(_0x4f09ae,_0x13cc0b){var _0x6c177d=_0xcaa3de||client;return _0x6c177d[_0x0601('0x11')](_0x25701e,_0x1c81b5)[_0x0601('0x12')](function(_0x51b2d7){logger['info']('MailAccount,\x20%s,\x20%s',_0x90d24c,'request\x20sent');logger[_0x0601('0x13')](_0x0601('0x14'),_0x90d24c,'request\x20sent',JSON[_0x0601('0x15')](_0x51b2d7));if(_0x51b2d7[_0x0601('0x16')]){if(_0x51b2d7[_0x0601('0x16')][_0x0601('0x17')]===0x1f4){logger['error'](_0x0601('0x18'),_0x90d24c,_0x51b2d7['error'][_0x0601('0x19')]);return _0x13cc0b(_0x51b2d7[_0x0601('0x16')][_0x0601('0x19')]);}logger['error'](_0x0601('0x18'),_0x90d24c,_0x51b2d7[_0x0601('0x16')][_0x0601('0x19')]);return _0x4f09ae(_0x51b2d7['error'][_0x0601('0x19')]);}else{logger['info'](_0x0601('0x18'),_0x90d24c,'request\x20sent');_0x4f09ae(_0x51b2d7[_0x0601('0x1a')][_0x0601('0x19')]);}})['catch'](function(_0x4757c7){logger[_0x0601('0x16')](_0x0601('0x18'),_0x90d24c,_0x4757c7);_0x13cc0b(_0x4757c7);});});}function respondWithStatusCode(_0x10882f,_0xe2840e){_0xe2840e=_0xe2840e||0xcc;return function(_0x111439){if(_0x111439){return _0x10882f[_0x0601('0x1b')](_0xe2840e);}return _0x10882f[_0x0601('0x1c')](_0xe2840e)[_0x0601('0x1d')]();};}function respondWithResult(_0x51efdd,_0x324b42){_0x324b42=_0x324b42||0xc8;return function(_0x2cf7a4){if(_0x2cf7a4){return _0x51efdd[_0x0601('0x1c')](_0x324b42)[_0x0601('0x1e')](_0x2cf7a4);}};}function respondWithFilteredResult(_0x36743f,_0x1250f4){return function(_0x242ab1){if(_0x242ab1){var _0x27e35e=typeof _0x1250f4[_0x0601('0x1f')]===_0x0601('0x20')&&typeof _0x1250f4[_0x0601('0x21')]===_0x0601('0x20');var _0x3556a2=_0x242ab1[_0x0601('0x22')];var _0x75d72d=_0x27e35e?0x0:_0x1250f4[_0x0601('0x1f')];var _0x11d403=_0x27e35e?_0x242ab1[_0x0601('0x22')]:_0x1250f4[_0x0601('0x1f')]+_0x1250f4['limit'];var _0x412696;if(_0x11d403>=_0x3556a2){_0x11d403=_0x3556a2;_0x412696=0xc8;}else{_0x412696=0xce;}_0x36743f[_0x0601('0x1c')](_0x412696);return _0x36743f['set'](_0x0601('0x23'),_0x75d72d+'-'+_0x11d403+'/'+_0x3556a2)[_0x0601('0x1e')](_0x242ab1);}return null;};}function saveUpdates(_0x4c76b3){return function(_0x51a459){if(_0x51a459){return _0x51a459[_0x0601('0x24')](_0x4c76b3)[_0x0601('0x12')](function(_0x5a244e){return _0x5a244e;});}return null;};}function removeEntity(_0x27363c){return function(_0x3afbab){if(_0x3afbab){return _0x3afbab[_0x0601('0x25')]()[_0x0601('0x12')](function(){var _0xd9377f=_0x3afbab[_0x0601('0x26')]({'plain':!![]});var _0x596d86=_0x0601('0x27');return db[_0x0601('0x28')][_0x0601('0x25')]({'where':{'type':_0x596d86,'resourceId':_0xd9377f['id']}})[_0x0601('0x12')](function(){return _0x3afbab;});})['then'](function(){_0x27363c[_0x0601('0x1c')](0xcc)[_0x0601('0x1d')]();});}};}function handleEntityNotFound(_0x48b6bb){return function(_0x454965){if(!_0x454965){_0x48b6bb[_0x0601('0x1b')](0x194);}return _0x454965;};}function handleError(_0x12e0bb,_0x52a820){_0x52a820=_0x52a820||0x1f4;return function(_0x4cc284){logger[_0x0601('0x16')](_0x4cc284[_0x0601('0x29')]);if(_0x4cc284['name']){delete _0x4cc284['name'];}_0x12e0bb[_0x0601('0x1c')](_0x52a820)[_0x0601('0x2a')](_0x4cc284);};}function getImapHost(_0x452f54){switch(_0x452f54){case _0x0601('0x2b'):return'imap.gmail.com';case _0x0601('0x2c'):return _0x0601('0x2d');case _0x0601('0x2e'):return _0x0601('0x2f');case'outlook365':return _0x0601('0x30');}throw new Error(_0x0601('0x31'),_0x452f54);}function getSmtpHost(_0x4d2c38){switch(_0x4d2c38){case _0x0601('0x2b'):return _0x0601('0x32');case'yahoo':return _0x0601('0x33');case _0x0601('0x2e'):return _0x0601('0x34');case _0x0601('0x35'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x4d2c38);}function getAuthenticationOptions(_0x3704b3,_0xe06892){var _0x1c72a4={};var _0x375d02={};if(_0x3704b3){_0x1c72a4[_0x0601('0x36')]=_0x375d02[_0x0601('0x36')]=_0xe06892[_0x0601('0x37')];_0x1c72a4[_0x0601('0x38')]=_0x375d02[_0x0601('0x39')]=_0xe06892[_0x0601('0x38')];if(_0xe06892[_0x0601('0x3a')]){_0x1c72a4[_0x0601('0x3a')]=_0x375d02['modernAuthentication']=!![];_0x1c72a4['CloudProviderId']=_0x375d02[_0x0601('0x3b')]=_0xe06892[_0x0601('0x3b')];_0x1c72a4[_0x0601('0x38')]=_0x375d02[_0x0601('0x39')]=null;}else{_0x1c72a4['CloudProviderId']=_0x375d02['CloudProviderId']=null;}_0x1c72a4['host']=getImapHost(_0x3704b3);_0x1c72a4['port']=0x3e1;_0x375d02['host']=getSmtpHost(_0x3704b3);_0x375d02[_0x0601('0x3c')]=0x24b;_0x375d02[_0x0601('0x3d')]=![];_0x1c72a4[_0x0601('0x3e')]=_0x375d02['service']=null;}else{if(_0xe06892[_0x0601('0x3f')]){_0x1c72a4[_0x0601('0x36')]=_0x375d02[_0x0601('0x36')]=_0xe06892['username'];_0x1c72a4['password']=_0x375d02[_0x0601('0x39')]=_0xe06892[_0x0601('0x38')];}else{_0x1c72a4[_0x0601('0x3f')]=_0x375d02['authentication']=![];_0x1c72a4[_0x0601('0x36')]=_0x375d02[_0x0601('0x36')]=null;_0x1c72a4[_0x0601('0x38')]=_0x375d02[_0x0601('0x39')]=null;}_0x1c72a4[_0x0601('0x40')]=_0xe06892[_0x0601('0x41')][_0x0601('0x40')];_0x1c72a4['port']=_0xe06892[_0x0601('0x41')]['port'];_0x375d02[_0x0601('0x40')]=_0xe06892[_0x0601('0x42')][_0x0601('0x40')];_0x375d02[_0x0601('0x3c')]=_0xe06892[_0x0601('0x42')][_0x0601('0x3c')];}return{'Imap':_0x1c72a4,'Smtp':_0x375d02};}exports[_0x0601('0x43')]=function(_0x385098,_0x181840){var _0x3d9571={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x0601('0x42')},{'model':db[_0x0601('0x44')],'as':_0x0601('0x45')}]},_0x1fc4bb={},_0x266951={'count':0x0,'rows':[]};var _0x200751=_[_0x0601('0x46')](db['MailAccount'][_0x0601('0x47')],function(_0x5d2ac9){return{'name':_0x5d2ac9['fieldName'],'type':_0x5d2ac9[_0x0601('0x48')][_0x0601('0x49')]};});_0x1fc4bb['model']=_['map'](_0x200751,_0x0601('0x4a'));_0x1fc4bb['query']=_[_0x0601('0x4b')](_0x385098['query']);_0x1fc4bb[_0x0601('0x4c')]=_['intersection'](_0x1fc4bb[_0x0601('0x4d')],_0x1fc4bb[_0x0601('0x4e')]);_0x3d9571[_0x0601('0x4f')]=_[_0x0601('0x50')](_0x1fc4bb[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x385098[_0x0601('0x4e')][_0x0601('0x51')]));_0x3d9571[_0x0601('0x4f')]=_0x3d9571[_0x0601('0x4f')][_0x0601('0x52')]?_0x3d9571['attributes']:_0x1fc4bb[_0x0601('0x4d')];if(!_0x385098['query'][_0x0601('0x53')](_0x0601('0x54'))){_0x3d9571[_0x0601('0x21')]=qs[_0x0601('0x21')](_0x385098['query'][_0x0601('0x21')]);_0x3d9571[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x385098[_0x0601('0x4e')][_0x0601('0x1f')]);}_0x3d9571[_0x0601('0x55')]=qs[_0x0601('0x56')](_0x385098['query'][_0x0601('0x56')]);_0x3d9571[_0x0601('0x57')]=qs[_0x0601('0x4c')](_['pick'](_0x385098[_0x0601('0x4e')],_0x1fc4bb[_0x0601('0x4c')]),_0x200751);if(_0x385098[_0x0601('0x4e')]['filter']){_0x3d9571[_0x0601('0x57')]=_[_0x0601('0x58')](_0x3d9571[_0x0601('0x57')],{'$or':_['map'](_0x200751,function(_0x6fd607){if(_0x6fd607[_0x0601('0x48')]!=='VIRTUAL'){var _0x4e0ba0={};_0x4e0ba0[_0x6fd607[_0x0601('0x4a')]]={'$like':'%'+_0x385098[_0x0601('0x4e')]['filter']+'%'};return _0x4e0ba0;}})});}_0x3d9571=_[_0x0601('0x58')]({},_0x3d9571,_0x385098[_0x0601('0x59')]);var _0x41403b={'where':_0x3d9571['where']};return db[_0x0601('0x5a')][_0x0601('0x22')](_0x41403b)[_0x0601('0x12')](function(_0x3feda9){_0x266951[_0x0601('0x22')]=_0x3feda9;if(_0x385098[_0x0601('0x4e')]['includeAll']){_0x3d9571[_0x0601('0x5b')]=[{'all':!![]}];}return db[_0x0601('0x5a')]['findAll'](_0x3d9571);})[_0x0601('0x12')](function(_0x41bc9b){_0x266951['rows']=_0x41bc9b;return _0x266951;})[_0x0601('0x12')](respondWithFilteredResult(_0x181840,_0x3d9571))['catch'](handleError(_0x181840,null));};exports[_0x0601('0x5c')]=function(_0x231226,_0x2bb1e7){var _0x379d9f={'raw':![],'where':{'id':_0x231226[_0x0601('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x0601('0x41')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0x0601('0x45')}]},_0x4cbba1={};_0x4cbba1[_0x0601('0x4d')]=_[_0x0601('0x4b')](db[_0x0601('0x5a')][_0x0601('0x47')]);_0x4cbba1[_0x0601('0x4e')]=_['keys'](_0x231226[_0x0601('0x4e')]);_0x4cbba1[_0x0601('0x4c')]=_['intersection'](_0x4cbba1[_0x0601('0x4d')],_0x4cbba1[_0x0601('0x4e')]);_0x379d9f['attributes']=_['intersection'](_0x4cbba1[_0x0601('0x4d')],qs['fields'](_0x231226['query'][_0x0601('0x51')]));_0x379d9f['attributes']=_0x379d9f['attributes'][_0x0601('0x52')]?_0x379d9f[_0x0601('0x4f')]:_0x4cbba1[_0x0601('0x4d')];if(_0x231226['query']['includeAll']){_0x379d9f[_0x0601('0x5b')]=[{'all':!![]}];}_0x379d9f=_['merge']({},_0x379d9f,_0x231226[_0x0601('0x59')]);return db[_0x0601('0x5a')][_0x0601('0x5e')](_0x379d9f)[_0x0601('0x12')](handleEntityNotFound(_0x2bb1e7,null))[_0x0601('0x12')](respondWithResult(_0x2bb1e7,null))[_0x0601('0x5f')](handleError(_0x2bb1e7,null));};exports[_0x0601('0x24')]=function(_0x20e402,_0x4425e4){if(_0x20e402[_0x0601('0x60')]['id']){delete _0x20e402['body']['id'];}var _0x51bd7b=_0x20e402[_0x0601('0x60')][_0x0601('0x61')]===_0x0601('0x62')?null:_0x20e402['body'][_0x0601('0x61')];var _0x1e430d=_0x20e402[_0x0601('0x60')][_0x0601('0x41')]||{};var _0x620bb1=_0x20e402[_0x0601('0x60')][_0x0601('0x42')]||{};if(_0x51bd7b){_0x1e430d[_0x0601('0x40')]=getImapHost(_0x51bd7b);_0x1e430d[_0x0601('0x3c')]=0x3e1;_0x620bb1[_0x0601('0x40')]=getSmtpHost(_0x51bd7b);_0x620bb1[_0x0601('0x3c')]=0x24b;_0x620bb1[_0x0601('0x3d')]=![];}if(_0x620bb1[_0x0601('0x3a')]){_0x620bb1[_0x0601('0x3d')]=![];}else{_0x620bb1['CloudProviderId']=null;}if(!_0x1e430d[_0x0601('0x3a')])_0x1e430d[_0x0601('0x3b')]=null;_0x20e402[_0x0601('0x60')][_0x0601('0x41')]=_0x1e430d;_0x20e402[_0x0601('0x60')][_0x0601('0x42')]=_0x620bb1;return db['MailAccount'][_0x0601('0x5e')]({'where':{'id':_0x20e402[_0x0601('0x5d')]['id']},'include':[{'model':db[_0x0601('0x63')],'as':_0x0601('0x41')},{'model':db[_0x0601('0x64')],'as':'Smtp'},{'model':db[_0x0601('0x44')],'as':_0x0601('0x45')}]})[_0x0601('0x12')](handleEntityNotFound(_0x4425e4,null))[_0x0601('0x12')](function(_0x12c559){if(!_0x12c559)throw new Error(_0x0601('0x65'));if(_0x12c559['service'])delete _0x20e402[_0x0601('0x60')][_0x0601('0x41')];return _0x12c559;})[_0x0601('0x12')](saveUpdates(_0x20e402[_0x0601('0x60')],null))[_0x0601('0x12')](function(_0x3d5760){if(!_0x20e402[_0x0601('0x60')][_0x0601('0x41')])return _0x3d5760;return db[_0x0601('0x63')]['update'](_0x20e402['body'][_0x0601('0x41')],{'where':{'MailAccountId':_0x3d5760['id']}})['then'](function(){return _0x3d5760;});})['then'](function(_0x447c7e){if(!_0x20e402[_0x0601('0x60')][_0x0601('0x42')])return _0x447c7e;return db[_0x0601('0x64')][_0x0601('0x24')](_0x20e402[_0x0601('0x60')][_0x0601('0x42')],{'where':{'MailAccountId':_0x447c7e['id']}})[_0x0601('0x12')](function(){return _0x447c7e;});})['then'](respondWithResult(_0x4425e4,null))[_0x0601('0x5f')](handleError(_0x4425e4,null));};exports[_0x0601('0x66')]=function(_0x58bea5,_0x4498c0){return db[_0x0601('0x5a')][_0x0601('0x66')]()[_0x0601('0x12')](respondWithResult(_0x4498c0,null))['catch'](handleError(_0x4498c0,null));};exports[_0x0601('0x67')]=function(_0x1a2349,_0x244aea){if(_0x1a2349[_0x0601('0x60')]['id']){delete _0x1a2349['body']['id'];}return db['MailAccount'][_0x0601('0x5e')]({'where':{'id':_0x1a2349[_0x0601('0x5d')]['id']}})['then'](handleEntityNotFound(_0x244aea,null))[_0x0601('0x12')](function(_0x1b3d7d){if(_0x1b3d7d){_0x1a2349[_0x0601('0x60')]['MailAccountId']=_0x1b3d7d['id'];return db[_0x0601('0x68')][_0x0601('0x69')](_0x1a2349['body']);}})[_0x0601('0x12')](respondWithResult(_0x244aea,null))[_0x0601('0x5f')](handleError(_0x244aea,null));};exports[_0x0601('0x6a')]=function(_0x82586c,_0x2c77bc){var _0x41ac47={'raw':![],'where':{}};var _0x49f30b={};var _0x1ce44a={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x82586c['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x2c77bc,null))[_0x0601('0x12')](function(_0x526dc1){if(_0x526dc1){_0x49f30b[_0x0601('0x4d')]=_[_0x0601('0x4b')](db['Disposition'][_0x0601('0x47')]);_0x49f30b[_0x0601('0x4e')]=_[_0x0601('0x4b')](_0x82586c[_0x0601('0x4e')]);_0x49f30b['filters']=_[_0x0601('0x50')](_0x49f30b['model'],_0x49f30b[_0x0601('0x4e')]);_0x41ac47['attributes']=_[_0x0601('0x50')](_0x49f30b[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x82586c[_0x0601('0x4e')][_0x0601('0x51')]));_0x41ac47[_0x0601('0x4f')]=_0x41ac47[_0x0601('0x4f')][_0x0601('0x52')]?_0x41ac47[_0x0601('0x4f')]:_0x49f30b[_0x0601('0x4d')];if(!_0x82586c['query']['hasOwnProperty']('nolimit')){_0x41ac47[_0x0601('0x21')]=qs[_0x0601('0x21')](_0x82586c[_0x0601('0x4e')][_0x0601('0x21')]);_0x41ac47[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x82586c[_0x0601('0x4e')][_0x0601('0x1f')]);}_0x41ac47[_0x0601('0x55')]=qs[_0x0601('0x56')](_0x82586c[_0x0601('0x4e')][_0x0601('0x56')]);_0x41ac47[_0x0601('0x57')]=qs['filters'](_[_0x0601('0x6b')](_0x82586c[_0x0601('0x4e')],_0x49f30b['filters']));_0x41ac47[_0x0601('0x57')][_0x0601('0x6c')]=_0x526dc1['id'];if(_0x82586c[_0x0601('0x4e')][_0x0601('0x6d')]){_0x41ac47[_0x0601('0x57')]=_[_0x0601('0x58')](_0x41ac47[_0x0601('0x57')],{'$or':_[_0x0601('0x46')](_0x41ac47[_0x0601('0x4f')],function(_0x4e2189){var _0x42bca0={};_0x42bca0[_0x4e2189]={'$like':'%'+_0x82586c[_0x0601('0x4e')][_0x0601('0x6d')]+'%'};return _0x42bca0;})});}_0x41ac47=_['merge']({},_0x41ac47,_0x82586c[_0x0601('0x59')]);return db[_0x0601('0x68')]['count']({'where':_0x41ac47[_0x0601('0x57')]})[_0x0601('0x12')](function(_0x501ff8){_0x1ce44a[_0x0601('0x22')]=_0x501ff8;if(_0x82586c[_0x0601('0x4e')][_0x0601('0x6e')]){_0x41ac47[_0x0601('0x5b')]=[{'all':!![]}];}return db[_0x0601('0x68')][_0x0601('0x6f')](_0x41ac47);})[_0x0601('0x12')](function(_0x23b685){_0x1ce44a[_0x0601('0x70')]=_0x23b685;return _0x1ce44a;});}})[_0x0601('0x12')](respondWithFilteredResult(_0x2c77bc,_0x41ac47))[_0x0601('0x5f')](handleError(_0x2c77bc,null));};exports[_0x0601('0x71')]=function(_0x21a75a,_0x125304){return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x21a75a[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x125304,null))[_0x0601('0x12')](function(_0x5efacb){if(_0x5efacb){return _0x5efacb['removeDispositions'](_0x21a75a[_0x0601('0x4e')][_0x0601('0x72')]);}})[_0x0601('0x12')](respondWithStatusCode(_0x125304,null))[_0x0601('0x5f')](handleError(_0x125304,null));};exports[_0x0601('0x73')]=function(_0x480779,_0x35eee8){if(_0x480779[_0x0601('0x60')]['id']){delete _0x480779[_0x0601('0x60')]['id'];}return db['MailAccount'][_0x0601('0x5e')]({'where':{'id':_0x480779[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x35eee8,null))[_0x0601('0x12')](function(_0x5c5d21){if(_0x5c5d21){_0x480779['body'][_0x0601('0x6c')]=_0x5c5d21['id'];return db[_0x0601('0x74')][_0x0601('0x69')](_0x480779['body']);}})[_0x0601('0x12')](respondWithResult(_0x35eee8,null))['catch'](handleError(_0x35eee8,null));};exports[_0x0601('0x75')]=function(_0x1baa4a,_0x4063c5){var _0x3e094b={'raw':![],'where':{}};var _0x58a73d={};var _0x9e834d={'count':0x0,'rows':[]};return db['MailAccount'][_0x0601('0x76')]({'where':{'id':_0x1baa4a['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x4063c5,null))[_0x0601('0x12')](function(_0xffdd79){if(_0xffdd79){_0x58a73d[_0x0601('0x4d')]=_[_0x0601('0x4b')](db[_0x0601('0x74')][_0x0601('0x47')]);_0x58a73d[_0x0601('0x4e')]=_[_0x0601('0x4b')](_0x1baa4a['query']);_0x58a73d[_0x0601('0x4c')]=_[_0x0601('0x50')](_0x58a73d[_0x0601('0x4d')],_0x58a73d['query']);_0x3e094b[_0x0601('0x4f')]=_[_0x0601('0x50')](_0x58a73d[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x1baa4a[_0x0601('0x4e')][_0x0601('0x51')]));_0x3e094b[_0x0601('0x4f')]=_0x3e094b[_0x0601('0x4f')][_0x0601('0x52')]?_0x3e094b[_0x0601('0x4f')]:_0x58a73d[_0x0601('0x4d')];if(!_0x1baa4a[_0x0601('0x4e')][_0x0601('0x53')]('nolimit')){_0x3e094b[_0x0601('0x21')]=qs[_0x0601('0x21')](_0x1baa4a[_0x0601('0x4e')][_0x0601('0x21')]);_0x3e094b[_0x0601('0x1f')]=qs['offset'](_0x1baa4a['query'][_0x0601('0x1f')]);}_0x3e094b[_0x0601('0x55')]=qs[_0x0601('0x56')](_0x1baa4a[_0x0601('0x4e')][_0x0601('0x56')]);_0x3e094b['where']=qs[_0x0601('0x4c')](_['pick'](_0x1baa4a['query'],_0x58a73d['filters']));_0x3e094b[_0x0601('0x57')]['MailAccountId']=_0xffdd79['id'];if(_0x1baa4a[_0x0601('0x4e')][_0x0601('0x6d')]){_0x3e094b['where']=_['merge'](_0x3e094b[_0x0601('0x57')],{'$or':_[_0x0601('0x46')](_0x3e094b[_0x0601('0x4f')],function(_0x80a65){var _0x38262b={};_0x38262b[_0x80a65]={'$like':'%'+_0x1baa4a[_0x0601('0x4e')][_0x0601('0x6d')]+'%'};return _0x38262b;})});}_0x3e094b=_[_0x0601('0x58')]({},_0x3e094b,_0x1baa4a[_0x0601('0x59')]);return db['CannedAnswer'][_0x0601('0x22')]({'where':_0x3e094b['where']})[_0x0601('0x12')](function(_0x221e1f){_0x9e834d[_0x0601('0x22')]=_0x221e1f;if(_0x1baa4a[_0x0601('0x4e')][_0x0601('0x6e')]){_0x3e094b[_0x0601('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0601('0x6f')](_0x3e094b);})['then'](function(_0x4f39e3){_0x9e834d[_0x0601('0x70')]=_0x4f39e3;return _0x9e834d;});}})[_0x0601('0x12')](respondWithFilteredResult(_0x4063c5,_0x3e094b))['catch'](handleError(_0x4063c5,null));};exports[_0x0601('0x77')]=function(_0x9507f,_0x233752){return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x9507f['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x233752,null))['then'](function(_0x466622){if(_0x466622){return _0x466622[_0x0601('0x77')](_0x9507f['query'][_0x0601('0x72')]);}})[_0x0601('0x12')](respondWithStatusCode(_0x233752,null))[_0x0601('0x5f')](handleError(_0x233752,null));};exports['create']=function(_0x224a0f,_0x5477db){var _0x14dfd3={'name':_0x224a0f[_0x0601('0x60')][_0x0601('0x4a')],'key':_0x224a0f[_0x0601('0x60')][_0x0601('0x49')],'provider':_0x224a0f['body'][_0x0601('0x61')]===_0x0601('0x62')?null:_0x224a0f[_0x0601('0x60')][_0x0601('0x61')],'email':_0x224a0f[_0x0601('0x60')][_0x0601('0x78')],'ListId':_0x224a0f[_0x0601('0x60')]['ListId'],'active':!_[_0x0601('0x79')](_0x224a0f['body']['active'])?_0x224a0f[_0x0601('0x60')][_0x0601('0x7a')]:!![],'description':_0x224a0f[_0x0601('0x60')][_0x0601('0x7b')]||null};var _0xda7ab0=getAuthenticationOptions(_0x14dfd3[_0x0601('0x61')],_0x224a0f[_0x0601('0x60')]);_0x14dfd3[_0x0601('0x41')]=_0xda7ab0[_0x0601('0x41')];_0x14dfd3['Smtp']=_0xda7ab0[_0x0601('0x42')];return db[_0x0601('0x5a')]['create'](_0x14dfd3,{'include':[{'model':db[_0x0601('0x64')],'as':_0x0601('0x42')},{'model':db[_0x0601('0x63')],'as':_0x0601('0x41')}]})[_0x0601('0x12')](function(_0x4affff){var _0x341d24=_0x224a0f[_0x0601('0x36')][_0x0601('0x26')]({'plain':!![]});if(!_0x341d24)throw new Error(_0x0601('0x7c'));if(_0x341d24[_0x0601('0x7d')]===_0x0601('0x36')){var _0xec6e50=_0x4affff[_0x0601('0x26')]({'plain':!![]});return db[_0x0601('0x7e')][_0x0601('0x5e')]({'where':{'name':_0x0601('0x27'),'userProfileId':_0x341d24[_0x0601('0x7f')]},'raw':!![]})[_0x0601('0x12')](function(_0x5a67d0){if(_0x5a67d0&&_0x5a67d0[_0x0601('0x80')]===0x0){return db['UserProfileResource']['create']({'name':_0xec6e50[_0x0601('0x4a')],'resourceId':_0xec6e50['id'],'type':_0x5a67d0[_0x0601('0x4a')],'sectionId':_0x5a67d0['id']},{})[_0x0601('0x12')](function(){return _0x4affff;});}else{return _0x4affff;}})[_0x0601('0x5f')](function(_0x2177a6){logger[_0x0601('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2177a6);throw _0x2177a6;});}return _0x4affff;})[_0x0601('0x12')](respondWithResult(_0x5477db,0xc9))[_0x0601('0x5f')](handleError(_0x5477db,null));};exports[_0x0601('0x81')]=function(_0x47a71d,_0x2196df){return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x47a71d[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x2196df,null))[_0x0601('0x12')](function(_0x5b0dc0){if(_0x5b0dc0){return _0x5b0dc0[_0x0601('0x81')]();}return null;})[_0x0601('0x12')](respondWithResult(_0x2196df,null))[_0x0601('0x5f')](handleError(_0x2196df,null));};exports['addImap']=function(_0x59483e,_0x32ddfc){if(_0x59483e[_0x0601('0x60')]['id']){delete _0x59483e[_0x0601('0x60')]['id'];}return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x59483e[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x32ddfc,null))['then'](function(_0x44f3ef){if(_0x44f3ef){_0x59483e['body']['MailAccountId']=_0x44f3ef['id'];return db['MailServerIn'][_0x0601('0x69')](_0x59483e[_0x0601('0x60')]);}})[_0x0601('0x12')](respondWithResult(_0x32ddfc,null))['catch'](handleError(_0x32ddfc,null));};exports['removeImap']=function(_0x4b90f9,_0x1ce3f5){return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x4b90f9['params']['id']}})['then'](handleEntityNotFound(_0x1ce3f5,null))['then'](function(_0x10121d){if(_0x10121d){return _0x10121d['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x1ce3f5,null))[_0x0601('0x5f')](handleError(_0x1ce3f5,null));};exports[_0x0601('0x82')]=function(_0x5983df,_0x3b5844){return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x5983df['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x3b5844,null))[_0x0601('0x12')](function(_0x3a007a){if(_0x3a007a){return _0x3a007a[_0x0601('0x82')]();}return null;})[_0x0601('0x12')](respondWithResult(_0x3b5844,null))['catch'](handleError(_0x3b5844,null));};exports['addSmtp']=function(_0x584945,_0x390741){if(_0x584945[_0x0601('0x60')]['id']){delete _0x584945['body']['id'];}return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x584945['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x390741,null))[_0x0601('0x12')](function(_0x177505){if(_0x177505){_0x584945['body'][_0x0601('0x6c')]=_0x177505['id'];return db['MailServerOut'][_0x0601('0x69')](_0x584945[_0x0601('0x60')]);}})['then'](respondWithResult(_0x390741,null))[_0x0601('0x5f')](handleError(_0x390741,null));};exports['removeSmtp']=function(_0x45e970,_0x31649b){return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x45e970['params']['id']}})['then'](handleEntityNotFound(_0x31649b,null))[_0x0601('0x12')](function(_0x1445d9){if(_0x1445d9){return _0x1445d9[_0x0601('0x83')](null);}return null;})[_0x0601('0x12')](respondWithStatusCode(_0x31649b,null))[_0x0601('0x5f')](handleError(_0x31649b,null));};exports[_0x0601('0x84')]=function(_0xcc11d8,_0x2524eb){return db[_0x0601('0x85')][_0x0601('0x5e')]({'where':{'id':_0xcc11d8['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x2524eb,null))[_0x0601('0x12')](function(_0x2c594a){if(_0x2c594a){return _0x2c594a[_0x0601('0x84')](_0xcc11d8[_0x0601('0x60')][_0x0601('0x72')],_[_0x0601('0x86')](_0xcc11d8[_0x0601('0x60')],[_0x0601('0x72'),'id'])||{});}})['then'](respondWithResult(_0x2524eb,null))[_0x0601('0x5f')](handleError(_0x2524eb,null));};exports[_0x0601('0x87')]=function(_0x1025a9,_0x5ba9b2){var _0x1255d3={'raw':![],'where':{}};var _0x3f0acc={};var _0x227f0f={'count':0x0,'rows':[]};return db[_0x0601('0x5a')]['findOne']({'where':{'id':_0x1025a9[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x5ba9b2,null))[_0x0601('0x12')](function(_0x4ff440){if(_0x4ff440){_0x3f0acc[_0x0601('0x4d')]=_[_0x0601('0x4b')](db[_0x0601('0x85')][_0x0601('0x47')]);_0x3f0acc['query']=_['keys'](_0x1025a9[_0x0601('0x4e')]);_0x3f0acc[_0x0601('0x4c')]=_['intersection'](_0x3f0acc[_0x0601('0x4d')],_0x3f0acc[_0x0601('0x4e')]);_0x1255d3[_0x0601('0x4f')]=_[_0x0601('0x50')](_0x3f0acc[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x1025a9[_0x0601('0x4e')][_0x0601('0x51')]));_0x1255d3['attributes']=_0x1255d3[_0x0601('0x4f')][_0x0601('0x52')]?_0x1255d3[_0x0601('0x4f')]:_0x3f0acc['model'];if(!_0x1025a9[_0x0601('0x4e')][_0x0601('0x53')]('nolimit')){_0x1255d3[_0x0601('0x21')]=qs[_0x0601('0x21')](_0x1025a9[_0x0601('0x4e')][_0x0601('0x21')]);_0x1255d3[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x1025a9['query']['offset']);}_0x1255d3['order']=qs[_0x0601('0x56')](_0x1025a9[_0x0601('0x4e')]['sort']);_0x1255d3[_0x0601('0x57')]=qs[_0x0601('0x4c')](_[_0x0601('0x6b')](_0x1025a9['query'],_0x3f0acc[_0x0601('0x4c')]));_0x1255d3[_0x0601('0x57')][_0x0601('0x6c')]=_0x4ff440['id'];if(_0x1025a9['query'][_0x0601('0x6d')]){_0x1255d3['where']=_[_0x0601('0x58')](_0x1255d3[_0x0601('0x57')],{'$or':_[_0x0601('0x46')](_0x1255d3[_0x0601('0x4f')],function(_0x44506f){var _0x3e9fc9={};_0x3e9fc9[_0x44506f]={'$like':'%'+_0x1025a9[_0x0601('0x4e')][_0x0601('0x6d')]+'%'};return _0x3e9fc9;})});}_0x1255d3=_['merge']({},_0x1255d3,_0x1025a9[_0x0601('0x59')]);return db[_0x0601('0x85')][_0x0601('0x22')]({'where':_0x1255d3['where']})['then'](function(_0x391002){_0x227f0f[_0x0601('0x22')]=_0x391002;if(_0x1025a9[_0x0601('0x4e')][_0x0601('0x6e')]){_0x1255d3[_0x0601('0x5b')]=[{'model':db[_0x0601('0x88')],'as':_0x0601('0x89'),'required':![]},{'model':db[_0x0601('0x8a')],'as':'Owner','attributes':['name','fullname',_0x0601('0x8b')],'required':![]},{'model':db[_0x0601('0x8c')],'as':_0x0601('0x8d'),'attributes':['id',_0x0601('0x4a'),_0x0601('0x8e')],'where':_0x1025a9[_0x0601('0x4e')][_0x0601('0x8f')]?{'id':_0x1025a9[_0x0601('0x4e')][_0x0601('0x8f')]}:undefined,'required':_0x1025a9[_0x0601('0x4e')][_0x0601('0x8f')]?!![]:![]}];}return db[_0x0601('0x85')][_0x0601('0x6f')](_0x1255d3);})[_0x0601('0x12')](function(_0x1f9461){_0x227f0f[_0x0601('0x70')]=_0x1f9461;return _0x227f0f;});}})['then'](respondWithFilteredResult(_0x5ba9b2,_0x1255d3))[_0x0601('0x5f')](handleError(_0x5ba9b2,null));};exports[_0x0601('0x90')]=function addApplications(_0x2808fe,_0xa68064){var _0xa90d7a=_0x2808fe['params']['id'];var _0x96d703=_0x2808fe[_0x0601('0x60')];var _0x28af1a=0xc8;var _0x33c0f5=null;return db[_0x0601('0x91')][_0x0601('0x92')]({'isolationLevel':db[_0x0601('0x91')][_0x0601('0x93')]['ISOLATION_LEVELS'][_0x0601('0x94')]},function(_0x510029){return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0xa90d7a},'transaction':_0x510029})[_0x0601('0x12')](function(_0x51222e){if(_0x51222e){return db[_0x0601('0x95')][_0x0601('0x25')]({'where':{'MailAccountId':_0xa90d7a},'transaction':_0x510029})[_0x0601('0x12')](function(){var _0x2d5a35=_[_0x0601('0x46')](_0x96d703,function(_0x195acd){_0x195acd['MailAccountId']=_0xa90d7a;return _0x195acd;});return db['MailApplication'][_0x0601('0x96')](_0x2d5a35,{'transaction':_0x510029});});}else{_0x28af1a=0x194;_0x33c0f5=[];}});})[_0x0601('0x12')](function(){if(_0x28af1a!==0x194){return db['MailApplication'][_0x0601('0x97')]({'where':{'MailAccountId':_0xa90d7a},'order':_0x0601('0x98')})[_0x0601('0x12')](function(_0x4bb550){_0x33c0f5=_0x4bb550;});}})[_0x0601('0x5f')](function(_0x51712b){_0x28af1a=0x1f4;logger[_0x0601('0x16')](_0x51712b[_0x0601('0x29')]);if(_0x51712b['name']){delete _0x51712b[_0x0601('0x4a')];}_0x33c0f5=_0x51712b;})['finally'](function(){if(_0x33c0f5===null){_0xa68064[_0x0601('0x1b')](_0x28af1a);}else{if(_0x28af1a===0x1f4){_0xa68064['status'](_0x28af1a)[_0x0601('0x2a')](_0x33c0f5);}else{_0xa68064[_0x0601('0x1c')](_0x28af1a)[_0x0601('0x1e')](_0x33c0f5);}}});};exports[_0x0601('0x99')]=function(_0x24e9b9,_0xa243e3){var _0x5ae89e={};var _0x328c52={};var _0x2c276b;var _0x2a8a0c;return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x24e9b9['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0xa243e3,null))['then'](function(_0x2fa292){if(_0x2fa292){_0x2c276b=_0x2fa292;_0x328c52[_0x0601('0x4d')]=_[_0x0601('0x4b')](db[_0x0601('0x95')][_0x0601('0x47')]);_0x328c52['query']=_['keys'](_0x24e9b9[_0x0601('0x4e')]);_0x328c52['filters']=_[_0x0601('0x50')](_0x328c52['model'],_0x328c52[_0x0601('0x4e')]);_0x5ae89e[_0x0601('0x4f')]=_[_0x0601('0x50')](_0x328c52[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x24e9b9['query'][_0x0601('0x51')]));_0x5ae89e[_0x0601('0x4f')]=_0x5ae89e['attributes'][_0x0601('0x52')]?_0x5ae89e[_0x0601('0x4f')]:_0x328c52[_0x0601('0x4d')];_0x5ae89e[_0x0601('0x55')]=qs['sort'](_0x24e9b9[_0x0601('0x4e')][_0x0601('0x56')]);_0x5ae89e[_0x0601('0x57')]=qs[_0x0601('0x4c')](_[_0x0601('0x6b')](_0x24e9b9[_0x0601('0x4e')],_0x328c52[_0x0601('0x4c')]));if(_0x24e9b9[_0x0601('0x4e')][_0x0601('0x6d')]){_0x5ae89e['where']=_['merge'](_0x5ae89e[_0x0601('0x57')],{'$or':_['map'](_0x5ae89e[_0x0601('0x4f')],function(_0x5c1c4a){var _0x1130ff={};_0x1130ff[_0x5c1c4a]={'$like':'%'+_0x24e9b9['query'][_0x0601('0x6d')]+'%'};return _0x1130ff;})});}_0x5ae89e=_[_0x0601('0x58')]({},_0x5ae89e,_0x24e9b9[_0x0601('0x59')]);return _0x2c276b[_0x0601('0x99')](_0x5ae89e);}})[_0x0601('0x12')](function(_0x42964f){if(_0x42964f){_0x2a8a0c=_0x42964f[_0x0601('0x52')];if(!_0x24e9b9[_0x0601('0x4e')][_0x0601('0x53')](_0x0601('0x54'))){_0x5ae89e['limit']=qs[_0x0601('0x21')](_0x24e9b9[_0x0601('0x4e')][_0x0601('0x21')]);_0x5ae89e[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x24e9b9[_0x0601('0x4e')][_0x0601('0x1f')]);}return _0x2c276b[_0x0601('0x99')](_0x5ae89e);}})[_0x0601('0x12')](function(_0x5ef669){if(_0x5ef669){return _0x5ef669?{'count':_0x2a8a0c,'rows':_0x5ef669}:null;}})[_0x0601('0x12')](respondWithResult(_0xa243e3,null))[_0x0601('0x5f')](handleError(_0xa243e3,null));};exports['getMessages']=function(_0x4a4ce5,_0x32f32a){var _0x4bbff0={'raw':!![],'where':{}};var _0x518039={};var _0xa7099a={'count':0x0,'rows':[]};return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x4a4ce5['params']['id']}})['then'](handleEntityNotFound(_0x32f32a,null))[_0x0601('0x12')](function(_0x3488da){if(_0x3488da){_0x518039[_0x0601('0x4d')]=_[_0x0601('0x4b')](db[_0x0601('0x9a')]['rawAttributes']);_0x518039[_0x0601('0x4e')]=_[_0x0601('0x4b')](_0x4a4ce5[_0x0601('0x4e')]);_0x518039[_0x0601('0x4c')]=_[_0x0601('0x50')](_0x518039['model'],_0x518039[_0x0601('0x4e')]);_0x4bbff0[_0x0601('0x4f')]=_['intersection'](_0x518039[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x51')]));_0x4bbff0[_0x0601('0x4f')]=_0x4bbff0['attributes'][_0x0601('0x52')]?_0x4bbff0['attributes']:_0x518039['model'];if(!_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x53')](_0x0601('0x54'))){_0x4bbff0['limit']=qs['limit'](_0x4a4ce5['query'][_0x0601('0x21')]);_0x4bbff0[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x1f')]);}_0x4bbff0[_0x0601('0x55')]=qs[_0x0601('0x56')](_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x56')]);_0x4bbff0[_0x0601('0x57')]=qs[_0x0601('0x4c')](_[_0x0601('0x6b')](_0x4a4ce5[_0x0601('0x4e')],_0x518039[_0x0601('0x4c')]));_0x4bbff0['where'][_0x0601('0x6c')]=_0x3488da['id'];if(_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x6d')]){_0x4bbff0[_0x0601('0x57')]=_['merge'](_0x4bbff0[_0x0601('0x57')],{'$or':_['map'](_0x4bbff0[_0x0601('0x4f')],function(_0x1e66a1){var _0x3f5afd={};_0x3f5afd[_0x1e66a1]={'$like':'%'+_0x4a4ce5['query']['filter']+'%'};return _0x3f5afd;})});}if(_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x9b')]){var _0xb93286=_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x9b')][_0x0601('0x9c')](',');var _0x2fc4d3={};_0x2fc4d3[_0xb93286[0x0]]={'$gte':moment(_0xb93286[0x1])[_0x0601('0x9d')](_0x0601('0x9e'))};_0x4bbff0['where']=_[_0x0601('0x58')](_0x4bbff0[_0x0601('0x57')],_0x2fc4d3);}_0x4bbff0=_[_0x0601('0x58')]({},_0x4bbff0,_0x4a4ce5[_0x0601('0x59')]);return db[_0x0601('0x9a')]['count']({'where':_0x4bbff0['where']})[_0x0601('0x12')](function(_0x2f88a1){_0xa7099a[_0x0601('0x22')]=_0x2f88a1;if(_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x6e')]){_0x4bbff0['include']=[{'all':!![]}];}return db[_0x0601('0x9a')][_0x0601('0x6f')](_0x4bbff0);})['then'](function(_0x49a2b4){if(_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x9f')]===_0x0601('0xa0')){for(var _0x47fd71=0x0;_0x47fd71<_0x49a2b4['length'];_0x47fd71++){_0x49a2b4[_0x47fd71]['body']=juice(_0x49a2b4[_0x47fd71][_0x0601('0x60')]);}}_0xa7099a[_0x0601('0x70')]=_0x49a2b4;return _0xa7099a;});}})[_0x0601('0x12')](respondWithFilteredResult(_0x32f32a,_0x4bbff0))[_0x0601('0x5f')](handleError(_0x32f32a,null));};exports['send']=function(_0x1e0e19,_0x257a92){var _0x4c6199,_0x4977c0={},_0x68ab58;if(_0x1e0e19['body']['to']){_0x68ab58=_0x1e0e19[_0x0601('0x60')]['to'][_0x0601('0x9c')](',')[0x0];}return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x1e0e19[_0x0601('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x0601('0x88')],'as':_0x0601('0xa1'),'where':{'email':_0x68ab58},'limit':0x1,'order':[[_0x0601('0xa2'),_0x0601('0xa3')]]}]},{'model':db[_0x0601('0x64')],'as':_0x0601('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0601('0xa4'),'raw':!![]}]}]})[_0x0601('0x12')](handleEntityNotFound(_0x257a92,null))['then'](function(_0x252abc){if(!_0x252abc)return;_0x4c6199=_0x252abc;if(!_0x252abc[_0x0601('0x42')])throw new Error(_0x0601('0xa5'));if(_[_0x0601('0x79')](_0x1e0e19[_0x0601('0x60')][_0x0601('0xa6')])){_0x1e0e19['body'][_0x0601('0xa6')]=util[_0x0601('0x9d')](_0x0601('0xa7'),_0x252abc['name'],_0x252abc[_0x0601('0x78')]||_0x252abc['Smtp'][_0x0601('0x36')]);}if(_0x1e0e19[_0x0601('0x60')][_0x0601('0xa8')]&&_0x1e0e19[_0x0601('0x60')][_0x0601('0xa8')]['length']){for(var _0x11f286=0x0;_0x11f286<_0x1e0e19['body'][_0x0601('0xa8')][_0x0601('0x52')];_0x11f286+=0x1){_0x1e0e19['body']['attachments'][_0x11f286]={'filename':_0x1e0e19[_0x0601('0x60')][_0x0601('0xa8')][_0x11f286][_0x0601('0x4a')],'path':path[_0x0601('0xa9')](config[_0x0601('0xaa')],_0x0601('0xab'),_0x1e0e19[_0x0601('0x60')][_0x0601('0xa8')][_0x11f286][_0x0601('0xac')])};}}var _0x37fa26=_0x252abc[_0x0601('0xad')]();return respondWithRpcPromise(_0x0601('0xae'),_0x0601('0xaf'),{'account':_0x37fa26,'message':_0x1e0e19[_0x0601('0x60')]});})[_0x0601('0x12')](function(_0x2aa3bb){if(!_0x2aa3bb)return;_0x4977c0=_0x2aa3bb;if(!_0x4c6199[_0x0601('0xb0')])throw new Error(_0x0601('0xb1'));if(_0x4c6199['List']['Contacts']['length'])return _0x4c6199[_0x0601('0xb0')][_0x0601('0xa1')][0x0];return db[_0x0601('0x88')][_0x0601('0x69')](_[_0x0601('0x9')](_0x1e0e19[_0x0601('0x60')],{'firstName':_0x1e0e19['body']['to'],'email':_0x1e0e19['body']['to'],'phone':_0x1e0e19[_0x0601('0x60')]['to'],'ListId':_0x4c6199[_0x0601('0xb2')]}));})[_0x0601('0x12')](function(_0x2b4795){if(!_0x2b4795)return;var _0x5f3f90={'UserId':_0x1e0e19[_0x0601('0x36')]['id'],'ContactId':_0x2b4795['id'],'MailAccountId':_0x4c6199['id'],'inReplyTo':_0x4977c0['messageId'],'to':_0x1e0e19['body'][_0x0601('0xa6')],'cc':_0x1e0e19[_0x0601('0x60')]['cc'],'subject':_0x1e0e19[_0x0601('0x60')]['subject'],'attach':_0x1e0e19[_0x0601('0x60')][_0x0601('0xb3')],'firstMsgDirection':_0x0601('0xb4'),'lastMsgAt':moment()[_0x0601('0x9d')](_0x0601('0x9e')),'lastMsgDirection':_0x0601('0xb4'),'Messages':[_[_0x0601('0x58')](_0x1e0e19['body'],{'messageId':_0x4977c0[_0x0601('0xb5')],'sentAt':moment()[_0x0601('0x9d')](_0x0601('0x9e')),'read':!![],'MailAccountId':_0x4c6199['id'],'UserId':_0x1e0e19[_0x0601('0x36')]['id'],'ContactId':_0x2b4795['id']})]};if(_0x1e0e19[_0x0601('0x60')]['Interaction']){_0x5f3f90=_[_0x0601('0x58')](_0x5f3f90,_0x1e0e19[_0x0601('0x60')]['Interaction']);}return db[_0x0601('0x85')][_0x0601('0x69')](_0x5f3f90,{'include':[{'model':db[_0x0601('0x9a')],'as':'Messages'}]});})[_0x0601('0x12')](respondWithResult(_0x257a92,null))[_0x0601('0x5f')](handleError(_0x257a92,null));};exports['verifySmtp']=function(_0x27ed32,_0x160461){return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x27ed32[_0x0601('0x5d')]['id']},'include':[{'model':db[_0x0601('0x64')],'as':_0x0601('0x42'),'raw':!![],'include':[{'model':db[_0x0601('0xa4')],'as':_0x0601('0xa4'),'raw':!![]}]}]})[_0x0601('0x12')](handleEntityNotFound(_0x160461,null))['then'](function(_0x485d0b){if(!_0x485d0b['Smtp'])return;var _0xebc46e=_0x485d0b[_0x0601('0xad')]();return respondWithRpcPromise(_0x0601('0xb6'),_0x0601('0xb7'),{'account':_0xebc46e});})[_0x0601('0x12')](respondWithResult(_0x160461,null))[_0x0601('0x5f')](handleError(_0x160461,null));};exports[_0x0601('0x25')]=function(_0x22be14,_0x390ec4){return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x22be14[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x390ec4,null))[_0x0601('0x12')](function(_0x34ca7b){if(_0x34ca7b&&_0x34ca7b[_0x0601('0x3e')]){throw new db[(_0x0601('0xb8'))][(_0x0601('0xb9'))](_0x0601('0xba'));}return _0x34ca7b;})['then'](removeEntity(_0x390ec4,null))[_0x0601('0x5f')](handleError(_0x390ec4,null));};exports[_0x0601('0xbb')]=function(_0x117f9c,_0x1e50b3){return db['MailAccount']['find']({'where':{'id':_0x117f9c[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x1e50b3,null))[_0x0601('0x12')](function(_0x1539db){if(_0x1539db){return _0x1539db['addAgents'](_0x117f9c['body'][_0x0601('0x72')],_[_0x0601('0x86')](_0x117f9c[_0x0601('0x60')],[_0x0601('0x72'),'id'])||{})[_0x0601('0xbc')](function(_0x29f4db){for(var _0x3e011f=0x0;_0x3e011f<_0x117f9c['body'][_0x0601('0x72')]['length'];_0x3e011f+=0x1){socket[_0x0601('0xbd')](_0x0601('0xbe'),{'UserId':Number(_0x117f9c[_0x0601('0x60')][_0x0601('0x72')][_0x3e011f]),'MailAccountId':Number(_0x117f9c[_0x0601('0x5d')]['id'])});}return _0x29f4db;});}})[_0x0601('0x12')](respondWithResult(_0x1e50b3,null))['catch'](handleError(_0x1e50b3,null));};exports[_0x0601('0xbf')]=function(_0x59f684,_0xb3cf2b){return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x59f684[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0xb3cf2b,null))[_0x0601('0x12')](function(_0x298486){if(_0x298486){return _0x298486[_0x0601('0xbf')](_0x59f684[_0x0601('0x4e')]['ids'])['then'](function(){if(_['isArray'](_0x59f684[_0x0601('0x4e')][_0x0601('0x72')])){for(var _0x2a530c=0x0;_0x2a530c<_0x59f684[_0x0601('0x4e')]['ids']['length'];_0x2a530c+=0x1){socket[_0x0601('0xbd')](_0x0601('0xc0'),{'UserId':Number(_0x59f684[_0x0601('0x4e')][_0x0601('0x72')][_0x2a530c]),'MailAccountId':Number(_0x59f684[_0x0601('0x5d')]['id'])});}}else{socket[_0x0601('0xbd')](_0x0601('0xc0'),{'UserId':Number(_0x59f684[_0x0601('0x4e')][_0x0601('0x72')]),'MailAccountId':Number(_0x59f684['params']['id'])});}});}})[_0x0601('0x12')](respondWithStatusCode(_0xb3cf2b,null))[_0x0601('0x5f')](handleError(_0xb3cf2b,null));};exports[_0x0601('0xc1')]=function(_0x17fd6f,_0x41408b){var _0x463fa9={};var _0x2c9f96={};var _0x4708ac;var _0x3277c7;return db[_0x0601('0x5a')]['findOne']({'where':{'id':_0x17fd6f['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x41408b,null))['then'](function(_0x3019ee){if(_0x3019ee){_0x4708ac=_0x3019ee;_0x2c9f96['model']=_['keys'](db[_0x0601('0x8a')][_0x0601('0x47')]);_0x2c9f96[_0x0601('0x4e')]=_[_0x0601('0x4b')](_0x17fd6f['query']);_0x2c9f96['filters']=_[_0x0601('0x50')](_0x2c9f96['model'],_0x2c9f96['query']);_0x463fa9['attributes']=_['intersection'](_0x2c9f96['model'],qs[_0x0601('0x51')](_0x17fd6f[_0x0601('0x4e')][_0x0601('0x51')]));_0x463fa9['attributes']=_0x463fa9[_0x0601('0x4f')][_0x0601('0x52')]?_0x463fa9[_0x0601('0x4f')]:_0x2c9f96['model'];_0x463fa9['order']=qs[_0x0601('0x56')](_0x17fd6f[_0x0601('0x4e')]['sort']);_0x463fa9[_0x0601('0x57')]=qs[_0x0601('0x4c')](_[_0x0601('0x6b')](_0x17fd6f[_0x0601('0x4e')],_0x2c9f96[_0x0601('0x4c')]));if(_0x17fd6f[_0x0601('0x4e')][_0x0601('0x6d')]){_0x463fa9[_0x0601('0x57')]=_[_0x0601('0x58')](_0x463fa9[_0x0601('0x57')],{'$or':_['map'](_0x463fa9[_0x0601('0x4f')],function(_0x4824c1){var _0x5cfebe={};_0x5cfebe[_0x4824c1]={'$like':'%'+_0x17fd6f[_0x0601('0x4e')][_0x0601('0x6d')]+'%'};return _0x5cfebe;})});}_0x463fa9=_[_0x0601('0x58')]({},_0x463fa9,_0x17fd6f['options']);return _0x4708ac[_0x0601('0xc1')](_0x463fa9);}})[_0x0601('0x12')](function(_0x1e660b){if(_0x1e660b){_0x3277c7=_0x1e660b[_0x0601('0x52')];if(!_0x17fd6f[_0x0601('0x4e')][_0x0601('0x53')]('nolimit')){_0x463fa9['limit']=qs['limit'](_0x17fd6f[_0x0601('0x4e')][_0x0601('0x21')]);_0x463fa9[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x17fd6f[_0x0601('0x4e')][_0x0601('0x1f')]);}return _0x4708ac[_0x0601('0xc1')](_0x463fa9);}})['then'](function(_0x5ea8c7){if(_0x5ea8c7){return _0x5ea8c7?{'count':_0x3277c7,'rows':_0x5ea8c7}:null;}})[_0x0601('0x12')](respondWithResult(_0x41408b,null))[_0x0601('0x5f')](handleError(_0x41408b,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 82d528e..db5e4e7 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 _0x4219=['events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3ba619,_0x4a0e97){var _0x121e45=function(_0x1e3245){while(--_0x1e3245){_0x3ba619['push'](_0x3ba619['shift']());}};_0x121e45(++_0x4a0e97);}(_0x4219,0xdc));var _0x9421=function(_0x2bbf32,_0x4e63f4){_0x2bbf32=_0x2bbf32-0x0;var _0x2b9814=_0x4219[_0x2bbf32];return _0x2b9814;};'use strict';var EventEmitter=require(_0x9421('0x0'));var MailAccount=require(_0x9421('0x1'))['db'][_0x9421('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9421('0x3')](0x0);var events={'afterCreate':_0x9421('0x4'),'afterUpdate':_0x9421('0x5'),'afterDestroy':_0x9421('0x6')};function emitEvent(_0x2a80e0){return function(_0x1187f3,_0x1e344c,_0xb6c5cf){MailAccountEvents[_0x9421('0x7')](_0x2a80e0+':'+_0x1187f3['id'],_0x1187f3);MailAccountEvents[_0x9421('0x7')](_0x2a80e0,_0x1187f3);_0xb6c5cf(null);};}for(var e in events){if(events[_0x9421('0x8')](e)){var event=events[e];MailAccount[_0x9421('0x9')](e,emitEvent(event));}}module[_0x9421('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x0295=['remove','emit','hasOwnProperty','hook','events','setMaxListeners'];(function(_0x343dfe,_0x5be28e){var _0x59d1a8=function(_0x50c679){while(--_0x50c679){_0x343dfe['push'](_0x343dfe['shift']());}};_0x59d1a8(++_0x5be28e);}(_0x0295,0x1f0));var _0x5029=function(_0x4941c6,_0x3ca9f8){_0x4941c6=_0x4941c6-0x0;var _0x4d3654=_0x0295[_0x4941c6];return _0x4d3654;};'use strict';var EventEmitter=require(_0x5029('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5029('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5029('0x2')};function emitEvent(_0x36335d){return function(_0x157a4f,_0x3d0af1,_0x170504){MailAccountEvents[_0x5029('0x3')](_0x36335d+':'+_0x157a4f['id'],_0x157a4f);MailAccountEvents[_0x5029('0x3')](_0x36335d,_0x157a4f);_0x170504(null);};}for(var e in events){if(events[_0x5029('0x4')](e)){var event=events[e];MailAccount[_0x5029('0x5')](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 464b4c4..57cc4d4 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 _0x511a=['provider','custom','service','host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass','exports','define','MailAccount','mail_accounts'];(function(_0x5a5970,_0x467c50){var _0x493182=function(_0x3e85cd){while(--_0x3e85cd){_0x5a5970['push'](_0x5a5970['shift']());}};_0x493182(++_0x467c50);}(_0x511a,0x94));var _0xa511=function(_0x167db3,_0x43d0ee){_0x167db3=_0x167db3-0x0;var _0x4811dc=_0x511a[_0x167db3];return _0x4811dc;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xa511('0x0')]=function(_0x6a439d){return _0x6a439d[_0xa511('0x1')](_0xa511('0x2'),attributes,{'tableName':_0xa511('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x58f537=this;var _0x4afeb0={'id':_0x58f537['id'],'tls':{'rejectUnauthorized':![]}};if(_0x58f537[_0xa511('0x4')]!==_0xa511('0x5')){_0x4afeb0[_0xa511('0x6')]=_0x58f537[_0xa511('0x4')];}else{_0x4afeb0[_0xa511('0x7')]=_0x58f537[_0xa511('0x8')]['host'];_0x4afeb0[_0xa511('0x9')]=_0x58f537[_0xa511('0x8')]['port'];_0x4afeb0['secure']=_0x58f537[_0xa511('0x8')][_0xa511('0xa')];}if(_0x58f537['Smtp']['authentication']){if(_0x58f537[_0xa511('0x8')][_0xa511('0xb')]){if(!_0x58f537[_0xa511('0x8')][_0xa511('0xc')])throw new Error(_0xa511('0xd'));_0x4afeb0['auth']={'type':_0xa511('0xe'),'user':_0x58f537[_0xa511('0x8')][_0xa511('0xf')],'accessToken':_0x58f537['Smtp'][_0xa511('0xc')][_0xa511('0x10')]};}else{_0x4afeb0[_0xa511('0x11')]={'user':_0x58f537['Smtp']['user'],'pass':_0x58f537[_0xa511('0x8')][_0xa511('0x12')]};}}return _0x4afeb0;}}});}; \ No newline at end of file +var _0xac2d=['exports','define','mail_accounts','provider','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5','pass'];(function(_0x37dc1d,_0xbf91ef){var _0x4ac931=function(_0x1a45dd){while(--_0x1a45dd){_0x37dc1d['push'](_0x37dc1d['shift']());}};_0x4ac931(++_0xbf91ef);}(_0xac2d,0xee));var _0xdac2=function(_0x15801d,_0x398156){_0x15801d=_0x15801d-0x0;var _0x1944a4=_0xac2d[_0x15801d];return _0x1944a4;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xdac2('0x0')]=function(_0x742941){return _0x742941[_0xdac2('0x1')]('MailAccount',attributes,{'tableName':_0xdac2('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x48a549=this;var _0x247ba4={'id':_0x48a549['id'],'tls':{'rejectUnauthorized':![]}};if(_0x48a549[_0xdac2('0x3')]!=='custom'){_0x247ba4[_0xdac2('0x4')]=_0x48a549['provider'];}else{_0x247ba4[_0xdac2('0x5')]=_0x48a549[_0xdac2('0x6')][_0xdac2('0x5')];_0x247ba4[_0xdac2('0x7')]=_0x48a549['Smtp'][_0xdac2('0x7')];_0x247ba4[_0xdac2('0x8')]=_0x48a549[_0xdac2('0x6')][_0xdac2('0x8')];}if(_0x48a549[_0xdac2('0x6')][_0xdac2('0x9')]){if(_0x48a549[_0xdac2('0x6')][_0xdac2('0xa')]){if(!_0x48a549[_0xdac2('0x6')][_0xdac2('0xb')])throw new Error(_0xdac2('0xc'));_0x247ba4[_0xdac2('0xd')]={'type':_0xdac2('0xe'),'user':_0x48a549['Smtp']['user'],'accessToken':_0x48a549[_0xdac2('0x6')][_0xdac2('0xb')][_0xdac2('0xf')]};}else{_0x247ba4[_0xdac2('0xd')]={'user':_0x48a549['Smtp']['user'],'pass':_0x48a549[_0xdac2('0x6')][_0xdac2('0x10')]};}}return _0x247ba4;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 6e75890..35ab5e1 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 _0xc21e=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','raw','options','attributes','limit','include','map','model','then','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','rawAttributes','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','orderBy','applications','priority','asc','autoclose','push','length','close','*,*,*,*','CmContact','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','spread','update','subject','interaction','created','MailMessage','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x74a1cd,_0x21a830){var _0x312fd5=function(_0x3dbe4a){while(--_0x3dbe4a){_0x74a1cd['push'](_0x74a1cd['shift']());}};_0x312fd5(++_0x21a830);}(_0xc21e,0x1ca));var _0xec21=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc21e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0xec21('0x0'));var BPromise=require(_0xec21('0x1'));var rs=require(_0xec21('0x2'));var Redis=require(_0xec21('0x3'));var db=require(_0xec21('0x4'))['db'];var logger=require(_0xec21('0x5'))('rpc');var config=require(_0xec21('0x6'));var jayson=require(_0xec21('0x7'));var client=jayson[_0xec21('0x8')][_0xec21('0x9')]({'port':0x232c});config[_0xec21('0xa')]=_[_0xec21('0xb')](config[_0xec21('0xa')],{'host':_0xec21('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec21('0xa')]));require(_0xec21('0xd'))[_0xec21('0xe')](socket);function respondWithRpcPromise(_0xfbab77,_0x4d478,_0x569559){return new BPromise(function(_0x110420,_0x1d5e4b){return client[_0xec21('0xf')](_0xfbab77,_0x569559)['then'](function(_0x5f059d){logger[_0xec21('0x10')](_0xec21('0x11'),_0x4d478,'request\x20sent');logger[_0xec21('0x12')](_0xec21('0x13'),_0x4d478,_0xec21('0x14'),JSON[_0xec21('0x15')](_0x5f059d));if(_0x5f059d[_0xec21('0x16')]){if(_0x5f059d['error'][_0xec21('0x17')]===0x1f4){logger['error'](_0xec21('0x11'),_0x4d478,_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);return _0x1d5e4b(_0x5f059d['error'][_0xec21('0x18')]);}logger[_0xec21('0x16')](_0xec21('0x11'),_0x4d478,_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);return _0x110420(_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);}else{logger[_0xec21('0x10')]('MailAccount,\x20%s,\x20%s',_0x4d478,_0xec21('0x14'));_0x110420(_0x5f059d[_0xec21('0x19')][_0xec21('0x18')]);}})[_0xec21('0x1a')](function(_0x3ab226){logger[_0xec21('0x16')](_0xec21('0x11'),_0x4d478,_0x3ab226);_0x1d5e4b(_0x3ab226);});});}exports[_0xec21('0x1b')]=function(_0x3c790e){var _0x350443=this;return new Promise(function(_0x4f4b12,_0x4c244b){return db[_0xec21('0x1c')][_0xec21('0x1d')]({'raw':_0x3c790e['options']?_0x3c790e['options'][_0xec21('0x1e')]===undefined?!![]:![]:!![],'where':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')]['where']||null:null,'attributes':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')][_0xec21('0x20')]||null:null,'limit':_0x3c790e['options']?_0x3c790e[_0xec21('0x1f')][_0xec21('0x21')]||null:null,'include':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')][_0xec21('0x22')]?_[_0xec21('0x23')](_0x3c790e['options'][_0xec21('0x22')],function(_0x26cdae){return{'model':db[_0x26cdae['model']],'as':_0x26cdae['as'],'attributes':_0x26cdae[_0xec21('0x20')],'include':_0x26cdae['include']?_[_0xec21('0x23')](_0x26cdae['include'],function(_0x4ef840){return{'model':db[_0x4ef840[_0xec21('0x24')]],'as':_0x4ef840['as'],'attributes':_0x4ef840[_0xec21('0x20')],'include':_0x4ef840[_0xec21('0x22')]?_[_0xec21('0x23')](_0x4ef840[_0xec21('0x22')],function(_0x5521e3){return{'model':db[_0x5521e3[_0xec21('0x24')]],'as':_0x5521e3['as'],'attributes':_0x5521e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xec21('0x25')](function(_0x233bf9){logger[_0xec21('0x10')](_0xec21('0x1b'),_0x3c790e);logger['debug'](_0xec21('0x1b'),_0x3c790e,JSON[_0xec21('0x15')](_0x233bf9));_0x4f4b12(_0x233bf9);})[_0xec21('0x1a')](function(_0x233231){logger[_0xec21('0x16')](_0xec21('0x1b'),_0x233231[_0xec21('0x18')],_0x3c790e);_0x4c244b(_0x350443[_0xec21('0x16')](0x1f4,_0x233231[_0xec21('0x18')]));});});};exports[_0xec21('0x26')]=function(_0x43a2de){var _0x57e004=this;return new Promise(function(_0x31f861,_0x2a14aa){return db[_0xec21('0x1c')][_0xec21('0x27')]({'raw':_0x43a2de[_0xec21('0x1f')]?_0x43a2de['options'][_0xec21('0x1e')]===undefined?!![]:![]:!![],'where':_0x43a2de['options']?_0x43a2de['options']['where']||null:null,'attributes':_0x43a2de[_0xec21('0x1f')]?_0x43a2de[_0xec21('0x1f')][_0xec21('0x20')]||null:null,'include':_0x43a2de[_0xec21('0x1f')]?_0x43a2de[_0xec21('0x1f')][_0xec21('0x22')]?_[_0xec21('0x23')](_0x43a2de[_0xec21('0x1f')][_0xec21('0x22')],function(_0x1a7586){return{'model':db[_0x1a7586[_0xec21('0x24')]],'as':_0x1a7586['as'],'attributes':_0x1a7586[_0xec21('0x20')],'include':_0x1a7586['include']?_[_0xec21('0x23')](_0x1a7586[_0xec21('0x22')],function(_0x4a91a8){return{'model':db[_0x4a91a8[_0xec21('0x24')]],'as':_0x4a91a8['as'],'attributes':_0x4a91a8['attributes'],'include':_0x4a91a8['include']?_[_0xec21('0x23')](_0x4a91a8['include'],function(_0x4556c2){return{'model':db[_0x4556c2['model']],'as':_0x4556c2['as'],'attributes':_0x4556c2[_0xec21('0x20')]};}):[]};}):[]};}):[]:[]})[_0xec21('0x25')](function(_0x54b3a6){if(_0x43a2de[_0xec21('0x1f')][_0xec21('0x28')]===!![])_0x54b3a6[_0xec21('0x29')]('smtpOptions',_0x54b3a6[_0xec21('0x2a')]());logger[_0xec21('0x10')](_0xec21('0x26'),_0x43a2de);logger['debug'](_0xec21('0x26'),_0x43a2de,JSON[_0xec21('0x15')](_0x54b3a6));_0x31f861(_0x54b3a6);})[_0xec21('0x1a')](function(_0x154b8b){logger[_0xec21('0x16')]('ShowMailAccount',_0x154b8b[_0xec21('0x18')],_0x43a2de);_0x2a14aa(_0x57e004[_0xec21('0x16')](0x1f4,_0x154b8b['message']));});});};exports[_0xec21('0x2b')]=function(_0x54e642){var _0x1f0916=this;return new Promise(function(_0x18e20d,_0xf13561){var _0x49f90a={'body':_0x54e642[_0xec21('0x2c')],'channel':_0xec21('0x2d')};var _0x1093f6=_[_0xec21('0x2e')](_['keys'](db['CmContact'][_0xec21('0x2f')]),['createdAt',_0xec21('0x30'),'CompanyId',_0xec21('0x31')]);var _0x52e024=![];if(_0x54e642[_0xec21('0x2c')]['id']){delete _0x54e642[_0xec21('0x2c')]['id'];}if(_['isNil'](_0x54e642[_0xec21('0x2c')][_0xec21('0x32')])){return _0xf13561(_0x1f0916['error'](0x1f4,_0xec21('0x33')));}if(_[_0xec21('0x34')](_0x54e642[_0xec21('0x2c')][_0xec21('0x2c')])||_0x54e642[_0xec21('0x2c')][_0xec21('0x2c')]===''){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x35')));}if(_[_0xec21('0x34')](_0x54e642['body']['mapKey'])){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x36')+_0x1093f6));}if(!_[_0xec21('0x37')](_0x1093f6,_0x54e642['body'][_0xec21('0x38')])){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x39')+_0x1093f6));}var _0x555d95={};_0x555d95[_0x54e642['body']['mapKey']]=_0x54e642[_0xec21('0x2c')][_0xec21('0x32')];return db[_0xec21('0x1c')][_0xec21('0x27')]({'where':{'id':_0x54e642[_0xec21('0x3a')]['id']},'include':[{'model':db[_0xec21('0x3b')],'as':_0xec21('0x3c'),'include':[{'model':db['CmContact'],'as':_0xec21('0x3d'),'where':_0x555d95,'limit':0x1,'order':[[_0xec21('0x30'),_0xec21('0x3e')]]}]},{'model':db[_0xec21('0x3f')],'as':_0xec21('0x40')},{'model':db[_0xec21('0x41')],'as':_0xec21('0x42'),'include':[{'model':db[_0xec21('0x43')],'as':'CloudProvider'}]}]})[_0xec21('0x25')](function(_0x21e67f){if(_0x21e67f&&_0x21e67f[_0xec21('0x3c')]){var _0x58e490=_0x21e67f['get']({'plain':!![]});_0x49f90a['account']=_[_0xec21('0x44')](_0x58e490,[_0xec21('0x40'),'List']);_0x49f90a[_0xec21('0x3a')][_0xec21('0x45')]=_0x21e67f[_0xec21('0x2a')]();_0x49f90a['applications']=_0x58e490[_0xec21('0x40')];_0x49f90a['list']=_0x58e490[_0xec21('0x3c')];_0x49f90a['applications']=_[_0xec21('0x46')](_0x49f90a[_0xec21('0x47')],[_0xec21('0x48')],[_0xec21('0x49')]);if(_0x49f90a[_0xec21('0x3a')]&&_0x49f90a['account'][_0xec21('0x4a')]){_0x49f90a['applications'][_0xec21('0x4b')]({'id':0x0,'priority':_0x49f90a['applications'][_0xec21('0x4c')]+0x1,'app':_0xec21('0x4d'),'appdata':_0xec21('0x4a'),'interval':_0xec21('0x4e')});}if(_0x49f90a[_0xec21('0x3a')][_0xec21('0x40')]){delete _0x49f90a['account'][_0xec21('0x40')];}if(_0x49f90a[_0xec21('0x3a')][_0xec21('0x3c')]){delete _0x49f90a[_0xec21('0x3a')]['List'];}if(_0x58e490[_0xec21('0x3c')][_0xec21('0x3d')][_0xec21('0x4c')]){return _0x58e490['List']['Contacts'][0x0];}var _0x674ba7=_['defaults'](_0x54e642[_0xec21('0x2c')],{'firstName':_0x54e642[_0xec21('0x2c')]['from'],'ListId':_0x58e490['ListId']});_0x674ba7[_0x54e642[_0xec21('0x2c')][_0xec21('0x38')]]=_0x54e642[_0xec21('0x2c')][_0xec21('0x32')];return db[_0xec21('0x4f')][_0xec21('0x50')](_0x674ba7);}else{throw new Error(_0xec21('0x51'));}})[_0xec21('0x25')](function(_0x4a5351){_0x49f90a[_0xec21('0x52')]=_0x4a5351;if(_0x4a5351){if(!_0x54e642['body'][_0xec21('0x18')]['messageId']){_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x53')]=rs[_0xec21('0x54')]()+'\x20'+_0x54e642[_0xec21('0x2c')]['message']['from'];}var _0x49cd02={'ContactId':_0x4a5351['id'],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id'],'inReplyTo':_0x54e642['body'][_0xec21('0x18')][_0xec21('0x53')],'to':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x32')],'cc':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['cc'],'subject':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['subject'],'attach':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x55')],'lastMsgAt':moment()[_0xec21('0x56')](_0xec21('0x57')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0xec21('0x53')],'where':{'messageId':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['inReplyTo']}}]})[_0xec21('0x25')](function(_0x43848f){if(_0x43848f){return[_0x43848f,![]];}return db[_0xec21('0x58')][_0xec21('0x50')](_0x49cd02)[_0xec21('0x25')](function(_0x2ae987){return[_0x2ae987,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xec21('0x59')](function(_0x1cb2b1,_0x3a4bd6){if(_0x1cb2b1){_0x52e024=_0x3a4bd6;if(!_0x3a4bd6){return _0x1cb2b1[_0xec21('0x5a')]({'inReplyTo':_0x54e642['body']['message']['messageId'],'to':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x32')],'cc':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['cc'],'subject':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x5b')],'attach':_0x1cb2b1[_0xec21('0x55')]?_0x1cb2b1[_0xec21('0x55')]:_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x55')],'substatus':null,'substatusAt':moment()[_0xec21('0x56')](_0xec21('0x57')),'lastMsgAt':moment()['format'](_0xec21('0x57')),'lastMsgDirection':'in'});}else{return _0x1cb2b1;}}})[_0xec21('0x25')](function(_0x11d9e7){_0x49f90a[_0xec21('0x5c')]=_0x11d9e7['get']({'plain':!![]});_0x49f90a['interaction'][_0xec21('0x5d')]=_0x52e024;return db[_0xec21('0x5e')][_0xec21('0x50')]({'body':_0x54e642[_0xec21('0x2c')]['body'],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id'],'MailInteractionId':_0x11d9e7['id'],'direction':'in','ContactId':_0x49f90a['contact']['id'],'messageId':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x53')],'from':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['from'],'to':_0x54e642['body'][_0xec21('0x18')]['to'],'cc':_0x54e642[_0xec21('0x2c')]['message']['cc'],'subject':_0x54e642['body'][_0xec21('0x18')][_0xec21('0x5b')],'attach':_0x54e642['body']['message'][_0xec21('0x55')],'Attachments':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x5f')],'originTo':_0x54e642['body']['message'][_0xec21('0x60')],'originCc':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x61')],'bcc':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x62')],'ChatWebsiteId':_0x54e642['body']['message'][_0xec21('0x63')]||null,'originChannel':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x64')]||_0xec21('0x65'),'ChatOfflineMessageId':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x66')]||null},{'include':[{'model':db[_0xec21('0x67')],'as':'Attachments'}]});})[_0xec21('0x25')](function(_0x194287){_0x49f90a['message']=_0x194287;if(!_0x49f90a['interaction'][_0xec21('0x68')]){return;}return db[_0xec21('0x69')][_0xec21('0x27')]({'attributes':['id',_0xec21('0x6a')],'where':{'id':_0x49f90a[_0xec21('0x5c')][_0xec21('0x68')]}});})['then'](function(_0x2cb4d6){if(_0x2cb4d6){_0x49f90a[_0xec21('0x47')][_0xec21('0x6b')]({'id':0x0,'priority':0x0,'app':_0xec21('0x6c'),'appdata':_0x2cb4d6[_0xec21('0x6a')]+','+(_0x49f90a[_0xec21('0x3a')][_0xec21('0x6d')]||0xa),'interval':_0xec21('0x4e')});}if(!_0x49f90a[_0xec21('0x5c')][_0xec21('0x6e')]){return;}return db[_0xec21('0x6f')][_0xec21('0x27')]({'attributes':['id',_0xec21('0x6a')],'where':{'id':_0x49f90a[_0xec21('0x5c')]['queueId']}});})[_0xec21('0x25')](function(_0x502fb8){if(_0x502fb8){_0x49f90a[_0xec21('0x47')][_0xec21('0x6b')]({'id':0x0,'priority':0x1,'app':_0xec21('0x70'),'appdata':_0x502fb8[_0xec21('0x6a')]+','+(_0x49f90a[_0xec21('0x3a')][_0xec21('0x71')]||0x12c),'interval':_0xec21('0x4e')});}return respondWithRpcPromise(_0xec21('0x72'),_0xec21('0x73'),_0x49f90a);})['then'](function(_0x44077f){_0x18e20d(_0x44077f);})[_0xec21('0x1a')](function(_0x5def11){_0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0x5def11[_0xec21('0x18')]));});});}; \ No newline at end of file +var _0x7579=['error','message','result','catch','GetMailAccount','options','raw','attributes','map','model','include','ShowMailAccount','MailAccount','find','smtp','setDataValue','NotifyMailAccount','body','mail','difference','keys','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','MailApplication','Applications','Smtp','CloudProvider','get','account','omit','applications','orderBy','autoclose','push','length','close','*,*,*,*','Contacts','create','contact','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','subject','format','interaction','created','MailMessage','attachments','originTo','originCc','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e4022,_0x2ce85a){var _0x51c0c2=function(_0x12431f){while(--_0x12431f){_0x1e4022['push'](_0x1e4022['shift']());}};_0x51c0c2(++_0x2ce85a);}(_0x7579,0x1e2));var _0x9757=function(_0x22b664,_0x1e1951){_0x22b664=_0x22b664-0x0;var _0x2d2109=_0x7579[_0x22b664];return _0x2d2109;};'use strict';var _=require(_0x9757('0x0'));var moment=require(_0x9757('0x1'));var BPromise=require(_0x9757('0x2'));var rs=require(_0x9757('0x3'));var Redis=require(_0x9757('0x4'));var db=require(_0x9757('0x5'))['db'];var logger=require('../../config/logger')(_0x9757('0x6'));var config=require(_0x9757('0x7'));var jayson=require(_0x9757('0x8'));var client=jayson[_0x9757('0x9')]['http']({'port':0x232c});config[_0x9757('0xa')]=_[_0x9757('0xb')](config[_0x9757('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9757('0xc'))(new Redis(config['redis']));require(_0x9757('0xd'))[_0x9757('0xe')](socket);function respondWithRpcPromise(_0x1b4bf0,_0x5b5749,_0x375d91){return new BPromise(function(_0x13f01a,_0x271207){return client[_0x9757('0xf')](_0x1b4bf0,_0x375d91)[_0x9757('0x10')](function(_0x399cca){logger[_0x9757('0x11')](_0x9757('0x12'),_0x5b5749,_0x9757('0x13'));logger[_0x9757('0x14')](_0x9757('0x15'),_0x5b5749,'request\x20sent',JSON[_0x9757('0x16')](_0x399cca));if(_0x399cca[_0x9757('0x17')]){if(_0x399cca[_0x9757('0x17')]['code']===0x1f4){logger[_0x9757('0x17')](_0x9757('0x12'),_0x5b5749,_0x399cca[_0x9757('0x17')][_0x9757('0x18')]);return _0x271207(_0x399cca[_0x9757('0x17')][_0x9757('0x18')]);}logger[_0x9757('0x17')]('MailAccount,\x20%s,\x20%s',_0x5b5749,_0x399cca[_0x9757('0x17')]['message']);return _0x13f01a(_0x399cca[_0x9757('0x17')][_0x9757('0x18')]);}else{logger[_0x9757('0x11')](_0x9757('0x12'),_0x5b5749,_0x9757('0x13'));_0x13f01a(_0x399cca[_0x9757('0x19')]['message']);}})[_0x9757('0x1a')](function(_0x2aa360){logger[_0x9757('0x17')](_0x9757('0x12'),_0x5b5749,_0x2aa360);_0x271207(_0x2aa360);});});}exports[_0x9757('0x1b')]=function(_0xd2306b){var _0x376e03=this;return new Promise(function(_0x593e43,_0x185506){return db['MailAccount']['findAll']({'raw':_0xd2306b[_0x9757('0x1c')]?_0xd2306b[_0x9757('0x1c')][_0x9757('0x1d')]===undefined?!![]:![]:!![],'where':_0xd2306b[_0x9757('0x1c')]?_0xd2306b['options']['where']||null:null,'attributes':_0xd2306b['options']?_0xd2306b[_0x9757('0x1c')][_0x9757('0x1e')]||null:null,'limit':_0xd2306b[_0x9757('0x1c')]?_0xd2306b[_0x9757('0x1c')]['limit']||null:null,'include':_0xd2306b[_0x9757('0x1c')]?_0xd2306b[_0x9757('0x1c')]['include']?_[_0x9757('0x1f')](_0xd2306b[_0x9757('0x1c')]['include'],function(_0x2b6915){return{'model':db[_0x2b6915[_0x9757('0x20')]],'as':_0x2b6915['as'],'attributes':_0x2b6915[_0x9757('0x1e')],'include':_0x2b6915[_0x9757('0x21')]?_[_0x9757('0x1f')](_0x2b6915[_0x9757('0x21')],function(_0x4e6b86){return{'model':db[_0x4e6b86[_0x9757('0x20')]],'as':_0x4e6b86['as'],'attributes':_0x4e6b86['attributes'],'include':_0x4e6b86[_0x9757('0x21')]?_[_0x9757('0x1f')](_0x4e6b86['include'],function(_0x490e10){return{'model':db[_0x490e10[_0x9757('0x20')]],'as':_0x490e10['as'],'attributes':_0x490e10[_0x9757('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9757('0x10')](function(_0x3aae8b){logger['info'](_0x9757('0x1b'),_0xd2306b);logger[_0x9757('0x14')](_0x9757('0x1b'),_0xd2306b,JSON[_0x9757('0x16')](_0x3aae8b));_0x593e43(_0x3aae8b);})[_0x9757('0x1a')](function(_0xa471a9){logger['error'](_0x9757('0x1b'),_0xa471a9[_0x9757('0x18')],_0xd2306b);_0x185506(_0x376e03[_0x9757('0x17')](0x1f4,_0xa471a9[_0x9757('0x18')]));});});};exports[_0x9757('0x22')]=function(_0x328c9e){var _0x115d93=this;return new Promise(function(_0x586e71,_0x335212){return db[_0x9757('0x23')][_0x9757('0x24')]({'raw':_0x328c9e[_0x9757('0x1c')]?_0x328c9e[_0x9757('0x1c')][_0x9757('0x1d')]===undefined?!![]:![]:!![],'where':_0x328c9e[_0x9757('0x1c')]?_0x328c9e[_0x9757('0x1c')]['where']||null:null,'attributes':_0x328c9e[_0x9757('0x1c')]?_0x328c9e['options'][_0x9757('0x1e')]||null:null,'include':_0x328c9e[_0x9757('0x1c')]?_0x328c9e['options'][_0x9757('0x21')]?_[_0x9757('0x1f')](_0x328c9e[_0x9757('0x1c')][_0x9757('0x21')],function(_0x459bcc){return{'model':db[_0x459bcc[_0x9757('0x20')]],'as':_0x459bcc['as'],'attributes':_0x459bcc[_0x9757('0x1e')],'include':_0x459bcc[_0x9757('0x21')]?_[_0x9757('0x1f')](_0x459bcc[_0x9757('0x21')],function(_0x594c50){return{'model':db[_0x594c50[_0x9757('0x20')]],'as':_0x594c50['as'],'attributes':_0x594c50[_0x9757('0x1e')],'include':_0x594c50[_0x9757('0x21')]?_['map'](_0x594c50[_0x9757('0x21')],function(_0x2c2e5f){return{'model':db[_0x2c2e5f[_0x9757('0x20')]],'as':_0x2c2e5f['as'],'attributes':_0x2c2e5f[_0x9757('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9757('0x10')](function(_0x959db3){if(_0x328c9e[_0x9757('0x1c')][_0x9757('0x25')]===!![])_0x959db3[_0x9757('0x26')]('smtpOptions',_0x959db3['getSmtpOptions']());logger[_0x9757('0x11')](_0x9757('0x22'),_0x328c9e);logger[_0x9757('0x14')](_0x9757('0x22'),_0x328c9e,JSON['stringify'](_0x959db3));_0x586e71(_0x959db3);})[_0x9757('0x1a')](function(_0x4dfa93){logger[_0x9757('0x17')](_0x9757('0x22'),_0x4dfa93[_0x9757('0x18')],_0x328c9e);_0x335212(_0x115d93['error'](0x1f4,_0x4dfa93[_0x9757('0x18')]));});});};exports[_0x9757('0x27')]=function(_0x3d98c8){var _0x5d143b=this;return new Promise(function(_0x37b223,_0x5eea8b){var _0x50f0e4={'body':_0x3d98c8[_0x9757('0x28')],'channel':_0x9757('0x29')};var _0x3765e7=_[_0x9757('0x2a')](_[_0x9757('0x2b')](db['CmContact']['rawAttributes']),['createdAt',_0x9757('0x2c'),_0x9757('0x2d'),_0x9757('0x2e')]);var _0x596d57=![];if(_0x3d98c8[_0x9757('0x28')]['id']){delete _0x3d98c8[_0x9757('0x28')]['id'];}if(_['isNil'](_0x3d98c8[_0x9757('0x28')][_0x9757('0x2f')])){return _0x5eea8b(_0x5d143b[_0x9757('0x17')](0x1f4,_0x9757('0x30')));}if(_['isNil'](_0x3d98c8[_0x9757('0x28')][_0x9757('0x28')])||_0x3d98c8[_0x9757('0x28')][_0x9757('0x28')]===''){return _0x5eea8b(_0x5d143b[_0x9757('0x17')](0x1f4,_0x9757('0x31')));}if(_[_0x9757('0x32')](_0x3d98c8[_0x9757('0x28')][_0x9757('0x33')])){return _0x5eea8b(_0x5d143b['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3765e7));}if(!_[_0x9757('0x34')](_0x3765e7,_0x3d98c8[_0x9757('0x28')][_0x9757('0x33')])){return _0x5eea8b(_0x5d143b['error'](0x1f4,_0x9757('0x35')+_0x3765e7));}var _0x20413a={};_0x20413a[_0x3d98c8[_0x9757('0x28')]['mapKey']]=_0x3d98c8[_0x9757('0x28')][_0x9757('0x2f')];return db['MailAccount']['find']({'where':{'id':_0x3d98c8['account']['id']},'include':[{'model':db[_0x9757('0x36')],'as':_0x9757('0x37'),'include':[{'model':db[_0x9757('0x38')],'as':'Contacts','where':_0x20413a,'limit':0x1,'order':[[_0x9757('0x2c'),'DESC']]}]},{'model':db[_0x9757('0x39')],'as':_0x9757('0x3a')},{'model':db['MailServerOut'],'as':_0x9757('0x3b'),'include':[{'model':db[_0x9757('0x3c')],'as':_0x9757('0x3c')}]}]})[_0x9757('0x10')](function(_0x118d02){if(_0x118d02&&_0x118d02['List']){var _0x820ace=_0x118d02[_0x9757('0x3d')]({'plain':!![]});_0x50f0e4[_0x9757('0x3e')]=_[_0x9757('0x3f')](_0x820ace,[_0x9757('0x3a'),_0x9757('0x37')]);_0x50f0e4[_0x9757('0x3e')]['smtpOptions']=_0x118d02['getSmtpOptions']();_0x50f0e4[_0x9757('0x40')]=_0x820ace['Applications'];_0x50f0e4['list']=_0x820ace[_0x9757('0x37')];_0x50f0e4['applications']=_[_0x9757('0x41')](_0x50f0e4[_0x9757('0x40')],['priority'],['asc']);if(_0x50f0e4[_0x9757('0x3e')]&&_0x50f0e4['account'][_0x9757('0x42')]){_0x50f0e4['applications'][_0x9757('0x43')]({'id':0x0,'priority':_0x50f0e4['applications'][_0x9757('0x44')]+0x1,'app':_0x9757('0x45'),'appdata':_0x9757('0x42'),'interval':_0x9757('0x46')});}if(_0x50f0e4[_0x9757('0x3e')][_0x9757('0x3a')]){delete _0x50f0e4[_0x9757('0x3e')][_0x9757('0x3a')];}if(_0x50f0e4['account'][_0x9757('0x37')]){delete _0x50f0e4[_0x9757('0x3e')][_0x9757('0x37')];}if(_0x820ace[_0x9757('0x37')][_0x9757('0x47')][_0x9757('0x44')]){return _0x820ace[_0x9757('0x37')][_0x9757('0x47')][0x0];}var _0x296333=_[_0x9757('0xb')](_0x3d98c8[_0x9757('0x28')],{'firstName':_0x3d98c8[_0x9757('0x28')][_0x9757('0x2f')],'ListId':_0x820ace['ListId']});_0x296333[_0x3d98c8['body'][_0x9757('0x33')]]=_0x3d98c8['body'][_0x9757('0x2f')];return db[_0x9757('0x38')][_0x9757('0x48')](_0x296333);}else{throw new Error('List\x20not\x20found');}})[_0x9757('0x10')](function(_0x338370){_0x50f0e4[_0x9757('0x49')]=_0x338370;if(_0x338370){if(!_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4a')]){_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4a')]=rs[_0x9757('0x4b')]()+'\x20'+_0x3d98c8[_0x9757('0x28')]['message'][_0x9757('0x2f')];}var _0x3bc9f5={'ContactId':_0x338370['id'],'MailAccountId':_0x3d98c8[_0x9757('0x3e')]['id'],'inReplyTo':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4a')],'to':_0x3d98c8[_0x9757('0x28')]['message'][_0x9757('0x2f')],'cc':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')]['cc'],'subject':_0x3d98c8['body']['message']['subject'],'attach':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4c')],'lastMsgAt':moment()['format'](_0x9757('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x9757('0x24')]({'where':{'closed':![],'MailAccountId':_0x3d98c8['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x9757('0x4e'),'attributes':[_0x9757('0x4a')],'where':{'messageId':_0x3d98c8[_0x9757('0x28')]['message'][_0x9757('0x4f')]}}]})[_0x9757('0x10')](function(_0x38caa3){if(_0x38caa3){return[_0x38caa3,![]];}return db[_0x9757('0x50')][_0x9757('0x48')](_0x3bc9f5)[_0x9757('0x10')](function(_0x3e2119){return[_0x3e2119,!![]];});});}else{throw new Error(_0x9757('0x51'));}})['spread'](function(_0x4df00e,_0x5b6c80){if(_0x4df00e){_0x596d57=_0x5b6c80;if(!_0x5b6c80){return _0x4df00e['update']({'inReplyTo':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4a')],'to':_0x3d98c8[_0x9757('0x28')]['message']['from'],'cc':_0x3d98c8[_0x9757('0x28')]['message']['cc'],'subject':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x52')],'attach':_0x4df00e[_0x9757('0x4c')]?_0x4df00e[_0x9757('0x4c')]:_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4c')],'substatus':null,'substatusAt':moment()[_0x9757('0x53')](_0x9757('0x4d')),'lastMsgAt':moment()[_0x9757('0x53')](_0x9757('0x4d')),'lastMsgDirection':'in'});}else{return _0x4df00e;}}})[_0x9757('0x10')](function(_0x104fbb){_0x50f0e4['interaction']=_0x104fbb[_0x9757('0x3d')]({'plain':!![]});_0x50f0e4[_0x9757('0x54')][_0x9757('0x55')]=_0x596d57;return db[_0x9757('0x56')][_0x9757('0x48')]({'body':_0x3d98c8[_0x9757('0x28')][_0x9757('0x28')],'MailAccountId':_0x3d98c8['account']['id'],'MailInteractionId':_0x104fbb['id'],'direction':'in','ContactId':_0x50f0e4[_0x9757('0x49')]['id'],'messageId':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')]['messageId'],'from':_0x3d98c8['body'][_0x9757('0x18')]['from'],'to':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')]['to'],'cc':_0x3d98c8[_0x9757('0x28')]['message']['cc'],'subject':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x52')],'attach':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4c')],'Attachments':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x57')],'originTo':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x58')],'originCc':_0x3d98c8['body']['message'][_0x9757('0x59')],'bcc':_0x3d98c8[_0x9757('0x28')]['message']['bcc'],'ChatWebsiteId':_0x3d98c8[_0x9757('0x28')]['message']['ChatWebsiteId']||null,'originChannel':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')]['originChannel']||'Email','ChatOfflineMessageId':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x9757('0x5a')],'as':_0x9757('0x5b')}]});})[_0x9757('0x10')](function(_0x2fe5c5){_0x50f0e4['message']=_0x2fe5c5;if(!_0x50f0e4[_0x9757('0x54')][_0x9757('0x5c')]){return;}return db[_0x9757('0x5d')][_0x9757('0x24')]({'attributes':['id',_0x9757('0x5e')],'where':{'id':_0x50f0e4[_0x9757('0x54')][_0x9757('0x5c')]}});})['then'](function(_0x3fe6c7){if(_0x3fe6c7){_0x50f0e4[_0x9757('0x40')][_0x9757('0x5f')]({'id':0x0,'priority':0x0,'app':_0x9757('0x60'),'appdata':_0x3fe6c7[_0x9757('0x5e')]+','+(_0x50f0e4['account'][_0x9757('0x61')]||0xa),'interval':_0x9757('0x46')});}if(!_0x50f0e4[_0x9757('0x54')][_0x9757('0x62')]){return;}return db[_0x9757('0x63')][_0x9757('0x24')]({'attributes':['id',_0x9757('0x5e')],'where':{'id':_0x50f0e4['interaction']['queueId']}});})[_0x9757('0x10')](function(_0x48f208){if(_0x48f208){_0x50f0e4[_0x9757('0x40')]['unshift']({'id':0x0,'priority':0x1,'app':_0x9757('0x64'),'appdata':_0x48f208[_0x9757('0x5e')]+','+(_0x50f0e4[_0x9757('0x3e')]['waitForTheAssignedQueue']||0x12c),'interval':_0x9757('0x46')});}return respondWithRpcPromise('Start','startRouting',_0x50f0e4);})[_0x9757('0x10')](function(_0x179f48){_0x37b223(_0x179f48);})[_0x9757('0x1a')](function(_0x212c5d){_0x5eea8b(_0x5d143b[_0x9757('0x17')](0x1f4,_0x212c5d[_0x9757('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index ede4bc7..033567e 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 _0xc15c=['remove','update','mailAccount:'];(function(_0x379095,_0x475602){var _0x253cf9=function(_0xa743a7){while(--_0xa743a7){_0x379095['push'](_0x379095['shift']());}};_0x253cf9(++_0x475602);}(_0xc15c,0xae));var _0xcc15=function(_0x35e81a,_0x50fa10){_0x35e81a=_0x35e81a-0x0;var _0x363d00=_0xc15c[_0x35e81a];return _0x363d00;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0xcc15('0x0'),_0xcc15('0x1')];function createListener(_0x3df035,_0x507afc){return function(_0x1dd99c){_0x507afc['emit'](_0x3df035,_0x1dd99c);};}function removeListener(_0x571abf,_0x1d3a5f){return function(){MailAccountEvents['removeListener'](_0x571abf,_0x1d3a5f);};}exports['register']=function(_0x11ae7e){for(var _0x15135d=0x0,_0x597a7e=events['length'];_0x15135d<_0x597a7e;_0x15135d++){var _0x5de043=events[_0x15135d];var _0x25fee6=createListener(_0xcc15('0x2')+_0x5de043,_0x11ae7e);MailAccountEvents['on'](_0x5de043,_0x25fee6);}}; \ No newline at end of file +var _0xc808=['emit','removeListener','register','mailAccount:','./mailAccount.events','save','remove'];(function(_0x3d6e22,_0x4a2205){var _0x2d2580=function(_0x1330d5){while(--_0x1330d5){_0x3d6e22['push'](_0x3d6e22['shift']());}};_0x2d2580(++_0x4a2205);}(_0xc808,0x97));var _0x8c80=function(_0x4d3187,_0x267c51){_0x4d3187=_0x4d3187-0x0;var _0x107906=_0xc808[_0x4d3187];return _0x107906;};'use strict';var MailAccountEvents=require(_0x8c80('0x0'));var events=[_0x8c80('0x1'),_0x8c80('0x2'),'update'];function createListener(_0xbd6121,_0x1dd73c){return function(_0x139a4e){_0x1dd73c[_0x8c80('0x3')](_0xbd6121,_0x139a4e);};}function removeListener(_0x27f9f5,_0x3e6da3){return function(){MailAccountEvents[_0x8c80('0x4')](_0x27f9f5,_0x3e6da3);};}exports[_0x8c80('0x5')]=function(_0x198d66){for(var _0x44d226=0x0,_0x532fd8=events['length'];_0x44d226<_0x532fd8;_0x44d226++){var _0xf929ab=events[_0x44d226];var _0x5468a3=createListener(_0x8c80('0x6')+_0xf929ab,_0x198d66);MailAccountEvents['on'](_0xf929ab,_0x5468a3);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 83971b0..cd99090 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 _0x8293=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x17707b,_0x2744f0){var _0xb7df61=function(_0x4c8dd4){while(--_0x4c8dd4){_0x17707b['push'](_0x17707b['shift']());}};_0xb7df61(++_0x2744f0);}(_0x8293,0xfb));var _0x3829=function(_0x2569d0,_0x4e2953){_0x2569d0=_0x2569d0-0x0;var _0x4c5555=_0x8293[_0x2569d0];return _0x4c5555;};'use strict';var multer=require(_0x3829('0x0'));var util=require(_0x3829('0x1'));var path=require(_0x3829('0x2'));var timeout=require(_0x3829('0x3'));var express=require(_0x3829('0x4'));var router=express[_0x3829('0x5')]();var fs_extra=require(_0x3829('0x6'));var auth=require(_0x3829('0x7'));var interaction=require(_0x3829('0x8'));var config=require('../../config/environment');var controller=require(_0x3829('0x9'));router[_0x3829('0xa')](_0x3829('0xb'),auth[_0x3829('0xc')](),controller[_0x3829('0xd')]);router[_0x3829('0xe')](_0x3829('0xb'),auth[_0x3829('0xc')](),controller[_0x3829('0xf')]);router[_0x3829('0x10')](_0x3829('0xb'),auth[_0x3829('0xc')](),controller[_0x3829('0x11')]);module[_0x3829('0x12')]=router; \ No newline at end of file +var _0xad4b=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','put','isAuthenticated'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xad4b,0x1e2));var _0xbad4=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xad4b[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0xbad4('0x0'));var util=require(_0xbad4('0x1'));var path=require(_0xbad4('0x2'));var timeout=require(_0xbad4('0x3'));var express=require(_0xbad4('0x4'));var router=express[_0xbad4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbad4('0x6'));var interaction=require(_0xbad4('0x7'));var config=require('../../config/environment');var controller=require(_0xbad4('0x8'));router[_0xbad4('0x9')](_0xbad4('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xbad4('0xb')](_0xbad4('0xa'),auth[_0xbad4('0xc')](),controller[_0xbad4('0xd')]);router['delete'](_0xbad4('0xa'),auth[_0xbad4('0xc')](),controller['destroy']);module[_0xbad4('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b1125e2..0069e0d 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 _0x0deb=['sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x5bac21,_0x1561ea){var _0x3c33c6=function(_0x171a39){while(--_0x171a39){_0x5bac21['push'](_0x5bac21['shift']());}};_0x3c33c6(++_0x1561ea);}(_0x0deb,0x1d1));var _0xb0de=function(_0x355f52,_0x1321ca){_0x355f52=_0x355f52-0x0;var _0x199cc6=_0x0deb[_0x355f52];return _0x199cc6;};'use strict';var Sequelize=require(_0xb0de('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb0de('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb0de('0x2')],'allowNull':![],'defaultValue':_0xb0de('0x3')},'appdata':{'type':Sequelize[_0xb0de('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb0de('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xc28e=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x4847db,_0x2065fe){var _0x49793f=function(_0x39c632){while(--_0x39c632){_0x4847db['push'](_0x4847db['shift']());}};_0x49793f(++_0x2065fe);}(_0xc28e,0xef));var _0xec28=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xc28e[_0x1db251];return _0x56685a;};'use strict';var Sequelize=require(_0xec28('0x0'));module[_0xec28('0x1')]={'priority':{'type':Sequelize[_0xec28('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xec28('0x3')],'allowNull':![],'defaultValue':_0xec28('0x4')},'appdata':{'type':Sequelize[_0xec28('0x5')]()},'description':{'type':Sequelize[_0xec28('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7645fa0..dd5f3de 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 _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x190dde,_0x5bb90f){var _0x2a3638=function(_0x242516){while(--_0x242516){_0x190dde['push'](_0x190dde['shift']());}};_0x2a3638(++_0x5bb90f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x22464a,_0x535278){_0x22464a=_0x22464a-0x0;var _0x293737=_0x9bde[_0x22464a];return _0x293737;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file +var _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x5d2db0,_0x5de79c){var _0x42e33e=function(_0x3ceef0){while(--_0x3ceef0){_0x5d2db0['push'](_0x5d2db0['shift']());}};_0x42e33e(++_0x5de79c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x50b543,_0x3fbafa){_0x50b543=_0x50b543-0x0;var _0x1fecf5=_0xb43b[_0x50b543];return _0x1fecf5;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 35e757e..248202d 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 _0x30f3=['exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x27c980,_0x547830){var _0x27ecc0=function(_0x19479a){while(--_0x19479a){_0x27c980['push'](_0x27c980['shift']());}};_0x27ecc0(++_0x547830);}(_0x30f3,0x87));var _0x330f=function(_0x3ba2d6,_0x4910cb){_0x3ba2d6=_0x3ba2d6-0x0;var _0x6f362a=_0x30f3[_0x3ba2d6];return _0x6f362a;};'use strict';var _=require(_0x330f('0x0'));var util=require(_0x330f('0x1'));var logger=require(_0x330f('0x2'))(_0x330f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x330f('0x4'));var rimraf=require(_0x330f('0x5'));var config=require(_0x330f('0x6'));var attributes=require(_0x330f('0x7'));module[_0x330f('0x8')]=function(_0x43141d,_0x278abf){return _0x43141d[_0x330f('0x9')](_0x330f('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x330f('0xb'),'collate':_0x330f('0xc')});}; \ No newline at end of file +var _0x271e=['bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x1be3c1,_0x5a123e){var _0x2165b2=function(_0x3c5a79){while(--_0x3c5a79){_0x1be3c1['push'](_0x1be3c1['shift']());}};_0x2165b2(++_0x5a123e);}(_0x271e,0xab));var _0xe271=function(_0xa872f0,_0x281875){_0xa872f0=_0xa872f0-0x0;var _0x36be10=_0x271e[_0xa872f0];return _0x36be10;};'use strict';var _=require(_0xe271('0x0'));var util=require(_0xe271('0x1'));var logger=require(_0xe271('0x2'))(_0xe271('0x3'));var moment=require(_0xe271('0x4'));var BPromise=require(_0xe271('0x5'));var rp=require(_0xe271('0x6'));var fs=require('fs');var path=require(_0xe271('0x7'));var rimraf=require(_0xe271('0x8'));var config=require(_0xe271('0x9'));var attributes=require(_0xe271('0xa'));module[_0xe271('0xb')]=function(_0x5d803a,_0xd98688){return _0x5d803a[_0xe271('0xc')](_0xe271('0xd'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe271('0xe'),'collate':_0xe271('0xf')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index da3b90d..fe004ca 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 _0x0f74=['request','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','info','catch','options','raw','where','attributes','limit','then','UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x411dc3,_0x447538){var _0x3265f2=function(_0x3ecb17){while(--_0x3ecb17){_0x411dc3['push'](_0x411dc3['shift']());}};_0x3265f2(++_0x447538);}(_0x0f74,0x13b));var _0x40f7=function(_0x44b78d,_0x126ee1){_0x44b78d=_0x44b78d-0x0;var _0x499fe=_0x0f74[_0x44b78d];return _0x499fe;};'use strict';var _=require(_0x40f7('0x0'));var util=require(_0x40f7('0x1'));var moment=require(_0x40f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x40f7('0x3'));var fs=require('fs');var Redis=require(_0x40f7('0x4'));var db=require(_0x40f7('0x5'))['db'];var utils=require(_0x40f7('0x6'));var logger=require(_0x40f7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x40f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f2564,_0x24f382,_0x2bdbb5){return new BPromise(function(_0x9a71e0,_0x32a2a4){return client[_0x40f7('0x9')](_0x2f2564,_0x2bdbb5)['then'](function(_0x13b1ee){logger['info']('MailApplication,\x20%s,\x20%s',_0x24f382,_0x40f7('0xa'));logger[_0x40f7('0xb')](_0x40f7('0xc'),_0x24f382,'request\x20sent',JSON[_0x40f7('0xd')](_0x13b1ee));if(_0x13b1ee[_0x40f7('0xe')]){if(_0x13b1ee[_0x40f7('0xe')][_0x40f7('0xf')]===0x1f4){logger[_0x40f7('0xe')](_0x40f7('0x10'),_0x24f382,_0x13b1ee['error'][_0x40f7('0x11')]);return _0x32a2a4(_0x13b1ee[_0x40f7('0xe')][_0x40f7('0x11')]);}logger[_0x40f7('0xe')](_0x40f7('0x10'),_0x24f382,_0x13b1ee['error'][_0x40f7('0x11')]);return _0x9a71e0(_0x13b1ee[_0x40f7('0xe')]['message']);}else{logger[_0x40f7('0x12')](_0x40f7('0x10'),_0x24f382,'request\x20sent');_0x9a71e0(_0x13b1ee['result'][_0x40f7('0x11')]);}})[_0x40f7('0x13')](function(_0x41fbb9){logger['error']('MailApplication,\x20%s,\x20%s',_0x24f382,_0x41fbb9);_0x32a2a4(_0x41fbb9);});});}exports['UpdateMailApplication']=function(_0x397a8e){var _0x4731ff=this;return new Promise(function(_0x53f738,_0x49a2d5){return db['MailApplication']['update'](_0x397a8e['body'],{'raw':_0x397a8e[_0x40f7('0x14')]?_0x397a8e['options'][_0x40f7('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x397a8e[_0x40f7('0x14')]?_0x397a8e['options'][_0x40f7('0x16')]||null:null,'attributes':_0x397a8e[_0x40f7('0x14')]?_0x397a8e[_0x40f7('0x14')][_0x40f7('0x17')]||null:null,'limit':_0x397a8e['options']?_0x397a8e[_0x40f7('0x14')][_0x40f7('0x18')]||null:null})[_0x40f7('0x19')](function(_0x289783){logger[_0x40f7('0x12')](_0x40f7('0x1a'),_0x397a8e);logger[_0x40f7('0xb')](_0x40f7('0x1a'),_0x397a8e,JSON[_0x40f7('0xd')](_0x289783));_0x53f738(_0x289783);})[_0x40f7('0x13')](function(_0x47c95b){logger['error']('UpdateMailApplication',_0x47c95b[_0x40f7('0x11')],_0x397a8e);_0x49a2d5(_0x4731ff[_0x40f7('0xe')](0x1f4,_0x47c95b[_0x40f7('0x11')]));});});}; \ No newline at end of file +var _0x58ff=['result','catch','UpdateMailApplication','MailApplication','options','raw','where','attributes','limit','then','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailApplication,\x20%s,\x20%s','message'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x58ff,0x180));var _0xf58f=function(_0x2ab66e,_0x99cf8b){_0x2ab66e=_0x2ab66e-0x0;var _0x5034ed=_0x58ff[_0x2ab66e];return _0x5034ed;};'use strict';var _=require(_0xf58f('0x0'));var util=require(_0xf58f('0x1'));var moment=require(_0xf58f('0x2'));var BPromise=require(_0xf58f('0x3'));var rs=require(_0xf58f('0x4'));var fs=require('fs');var Redis=require(_0xf58f('0x5'));var db=require(_0xf58f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf58f('0x7'))('rpc');var config=require(_0xf58f('0x8'));var jayson=require(_0xf58f('0x9'));var client=jayson[_0xf58f('0xa')][_0xf58f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d7d2d,_0x2f1d48,_0x36a21d){return new BPromise(function(_0x2abd25,_0x320bea){return client['request'](_0x2d7d2d,_0x36a21d)['then'](function(_0x18adcb){logger[_0xf58f('0xc')]('MailApplication,\x20%s,\x20%s',_0x2f1d48,'request\x20sent');logger['debug'](_0xf58f('0xd'),_0x2f1d48,_0xf58f('0xe'),JSON['stringify'](_0x18adcb));if(_0x18adcb[_0xf58f('0xf')]){if(_0x18adcb['error'][_0xf58f('0x10')]===0x1f4){logger[_0xf58f('0xf')](_0xf58f('0x11'),_0x2f1d48,_0x18adcb['error'][_0xf58f('0x12')]);return _0x320bea(_0x18adcb[_0xf58f('0xf')]['message']);}logger[_0xf58f('0xf')]('MailApplication,\x20%s,\x20%s',_0x2f1d48,_0x18adcb[_0xf58f('0xf')][_0xf58f('0x12')]);return _0x2abd25(_0x18adcb['error']['message']);}else{logger[_0xf58f('0xc')](_0xf58f('0x11'),_0x2f1d48,_0xf58f('0xe'));_0x2abd25(_0x18adcb[_0xf58f('0x13')][_0xf58f('0x12')]);}})[_0xf58f('0x14')](function(_0xcf06a9){logger[_0xf58f('0xf')](_0xf58f('0x11'),_0x2f1d48,_0xcf06a9);_0x320bea(_0xcf06a9);});});}exports[_0xf58f('0x15')]=function(_0x4608e8){var _0x2d6f50=this;return new Promise(function(_0x517c19,_0x2dee87){return db[_0xf58f('0x16')]['update'](_0x4608e8['body'],{'raw':_0x4608e8[_0xf58f('0x17')]?_0x4608e8[_0xf58f('0x17')][_0xf58f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4608e8[_0xf58f('0x17')]?_0x4608e8[_0xf58f('0x17')][_0xf58f('0x19')]||null:null,'attributes':_0x4608e8['options']?_0x4608e8['options'][_0xf58f('0x1a')]||null:null,'limit':_0x4608e8[_0xf58f('0x17')]?_0x4608e8[_0xf58f('0x17')][_0xf58f('0x1b')]||null:null})[_0xf58f('0x1c')](function(_0x7fb7cf){logger['info'](_0xf58f('0x15'),_0x4608e8);logger[_0xf58f('0x1d')](_0xf58f('0x15'),_0x4608e8,JSON[_0xf58f('0x1e')](_0x7fb7cf));_0x517c19(_0x7fb7cf);})[_0xf58f('0x14')](function(_0x30c27f){logger[_0xf58f('0xf')](_0xf58f('0x15'),_0x30c27f['message'],_0x4608e8);_0x2dee87(_0x2d6f50[_0xf58f('0xf')](0x1f4,_0x30c27f[_0xf58f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 9144852..5863e58 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 _0xd593=['addTags','update','delete','mailinteraction:destroy','destroy','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags'];(function(_0x20bcea,_0x3bd892){var _0x5eaaca=function(_0x81aa0c){while(--_0x81aa0c){_0x20bcea['push'](_0x20bcea['shift']());}};_0x5eaaca(++_0x3bd892);}(_0xd593,0x1a6));var _0x3d59=function(_0xa767af,_0x3799ca){_0xa767af=_0xa767af-0x0;var _0x3fe4b6=_0xd593[_0xa767af];return _0x3fe4b6;};'use strict';var express=require(_0x3d59('0x0'));var router=express[_0x3d59('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x3d59('0x2'));var controller=require(_0x3d59('0x3'));router[_0x3d59('0x4')]('/',auth[_0x3d59('0x5')](),controller[_0x3d59('0x6')]);router[_0x3d59('0x4')]('/describe',auth[_0x3d59('0x5')](),controller[_0x3d59('0x7')]);router[_0x3d59('0x4')](_0x3d59('0x8'),auth[_0x3d59('0x5')](),controller[_0x3d59('0x9')]);router[_0x3d59('0x4')](_0x3d59('0xa'),auth[_0x3d59('0x5')](),controller[_0x3d59('0xb')]);router[_0x3d59('0x4')](_0x3d59('0xc'),auth['isAuthenticated'](),controller[_0x3d59('0xd')]);router[_0x3d59('0xe')]('/',auth[_0x3d59('0x5')](),controller['create']);router['post'](_0x3d59('0xa'),auth[_0x3d59('0x5')](),controller[_0x3d59('0xf')]);router[_0x3d59('0xe')](_0x3d59('0x10'),auth[_0x3d59('0x5')](),interaction[_0x3d59('0x11')](_0x3d59('0x12'),_0x3d59('0x13')),controller[_0x3d59('0x14')]);router['put'](_0x3d59('0x8'),auth[_0x3d59('0x5')](),interaction[_0x3d59('0x11')](_0x3d59('0x12'),'mailinteraction:update'),controller[_0x3d59('0x15')]);router[_0x3d59('0x16')](_0x3d59('0x8'),auth['isAuthenticated'](),interaction[_0x3d59('0x11')](_0x3d59('0x12'),_0x3d59('0x17')),controller[_0x3d59('0x18')]);router[_0x3d59('0x16')]('/:id/tags',auth[_0x3d59('0x5')](),controller['removeTags']);module[_0x3d59('0x19')]=router; \ No newline at end of file +var _0xacf4=['create','post','/:id/messages','addMessage','/:id/tags','tracked','addTags','mail','mailinteraction:update','update','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','getMessages','/:id/download'];(function(_0x502630,_0x55d533){var _0x3b4819=function(_0x6618cf){while(--_0x6618cf){_0x502630['push'](_0x502630['shift']());}};_0x3b4819(++_0x55d533);}(_0xacf4,0x9d));var _0x4acf=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0xacf4[_0x45c48f];return _0xaf5037;};'use strict';var express=require(_0x4acf('0x0'));var router=express[_0x4acf('0x1')]();var auth=require(_0x4acf('0x2'));var interaction=require(_0x4acf('0x3'));var controller=require('./mailInteraction.controller');router[_0x4acf('0x4')]('/',auth[_0x4acf('0x5')](),controller['index']);router['get'](_0x4acf('0x6'),auth[_0x4acf('0x5')](),controller[_0x4acf('0x7')]);router[_0x4acf('0x4')](_0x4acf('0x8'),auth[_0x4acf('0x5')](),controller['show']);router['get']('/:id/messages',auth[_0x4acf('0x5')](),controller[_0x4acf('0x9')]);router[_0x4acf('0x4')](_0x4acf('0xa'),auth[_0x4acf('0x5')](),controller['download']);router['post']('/',auth[_0x4acf('0x5')](),controller[_0x4acf('0xb')]);router[_0x4acf('0xc')](_0x4acf('0xd'),auth[_0x4acf('0x5')](),controller[_0x4acf('0xe')]);router[_0x4acf('0xc')](_0x4acf('0xf'),auth[_0x4acf('0x5')](),interaction[_0x4acf('0x10')]('mail','mailinteraction:addtags'),controller[_0x4acf('0x11')]);router['put'](_0x4acf('0x8'),auth[_0x4acf('0x5')](),interaction['tracked'](_0x4acf('0x12'),_0x4acf('0x13')),controller[_0x4acf('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked']('mail',_0x4acf('0x15')),controller[_0x4acf('0x16')]);router['delete'](_0x4acf('0xf'),auth[_0x4acf('0x5')](),controller['removeTags']);module[_0x4acf('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 86ddd2f..357eeb8 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 _0x3a75=['INTEGER','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','ENUM','out'];(function(_0x254d2a,_0x47cfe4){var _0x352f1f=function(_0x24805e){while(--_0x24805e){_0x254d2a['push'](_0x254d2a['shift']());}};_0x352f1f(++_0x47cfe4);}(_0x3a75,0xb5));var _0x53a7=function(_0x387604,_0x2ada22){_0x387604=_0x387604-0x0;var _0x1da0be=_0x3a75[_0x387604];return _0x1da0be;};'use strict';var Sequelize=require(_0x53a7('0x0'));var iconv=require(_0x53a7('0x1'));module['exports']={'closed':{'type':Sequelize[_0x53a7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x53a7('0x3')]},'disposition':{'type':Sequelize[_0x53a7('0x4')]},'secondDisposition':{'type':Sequelize[_0x53a7('0x4')]},'thirdDisposition':{'type':Sequelize[_0x53a7('0x4')]},'note':{'type':Sequelize[_0x53a7('0x4')]},'inReplyTo':{'type':Sequelize[_0x53a7('0x4')](0x1fe)},'to':{'type':Sequelize[_0x53a7('0x4')]},'cc':{'type':Sequelize[_0x53a7('0x5')]('long')},'subject':{'type':Sequelize[_0x53a7('0x5')]()},'attach':{'type':Sequelize[_0x53a7('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x53a7('0x3')]},'substatus':{'type':Sequelize[_0x53a7('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x53a7('0x6')]('in',_0x53a7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x53a7('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x53a7('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x53a7('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x53a7('0x8')]}}; \ No newline at end of file +var _0x4c37=['out','INTEGER','iconv','exports','DATE','STRING','TEXT','long','BOOLEAN','ENUM'];(function(_0x536bf2,_0x45f6db){var _0x85c61f=function(_0x29ad0f){while(--_0x29ad0f){_0x536bf2['push'](_0x536bf2['shift']());}};_0x85c61f(++_0x45f6db);}(_0x4c37,0x8e));var _0x74c3=function(_0x265c9e,_0x3ccce3){_0x265c9e=_0x265c9e-0x0;var _0x735c3e=_0x4c37[_0x265c9e];return _0x735c3e;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x74c3('0x0'));module[_0x74c3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x74c3('0x2')]},'disposition':{'type':Sequelize[_0x74c3('0x3')]},'secondDisposition':{'type':Sequelize[_0x74c3('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x74c3('0x3')]},'inReplyTo':{'type':Sequelize[_0x74c3('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x74c3('0x4')](_0x74c3('0x5'))},'subject':{'type':Sequelize[_0x74c3('0x4')]()},'attach':{'type':Sequelize[_0x74c3('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x74c3('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x74c3('0x7')]('in',_0x74c3('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x74c3('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x74c3('0x7')]('in',_0x74c3('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x74c3('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x74c3('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e9e6b03..1697ec3 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 _0xd6a6=['lodash','juice','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','offset','limit','count','status','Content-Range','json','update','end','error','stack','name','send','index','rawAttributes','type','getOptions','findAll','mail','query','then','show','params','model','keys','filters','fields','attributes','length','includeAll','merge','MailInteraction','create','body','catch','find','destroy','describe','addMessage','ids','omit','getMessages','findOne','intersection','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','map','$gte','split','MailMessage','true','rows','addTags','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Attachments','from','subject','createdAt','Messages','get','mkdirSync','each','missing.recipient@your.company.com','headers','bcc','Bcc','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','util'];(function(_0x432af8,_0x477b3d){var _0x228f4f=function(_0x2110c0){while(--_0x2110c0){_0x432af8['push'](_0x432af8['shift']());}};_0x228f4f(++_0x477b3d);}(_0xd6a6,0x1b7));var _0x6d6a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6a6[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x6d6a('0x0'));var rimraf=require(_0x6d6a('0x1'));var zipdir=require(_0x6d6a('0x2'));var moment=require(_0x6d6a('0x3'));var BPromise=require('bluebird');var util=require(_0x6d6a('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x6d6a('0x5'));var juice=require(_0x6d6a('0x6'));var Redis=require(_0x6d6a('0x7'));var interaction=require(_0x6d6a('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0x6d6a('0x9'))(_0x6d6a('0xa'));var config=require(_0x6d6a('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x6d6a('0xc')]=_[_0x6d6a('0xd')](config[_0x6d6a('0xc')],{'host':_0x6d6a('0xe'),'port':0x18eb});var socket=require(_0x6d6a('0xf'))(new Redis(config[_0x6d6a('0xc')]));require('./mailInteraction.socket')[_0x6d6a('0x10')](socket);function respondWithStatusCode(_0xe9ecd0,_0x40003d){_0x40003d=_0x40003d||0xcc;return function(_0x509c57){if(_0x509c57){return _0xe9ecd0[_0x6d6a('0x11')](_0x40003d);}return _0xe9ecd0['status'](_0x40003d)['end']();};}function respondWithResult(_0x27e557,_0x43d789){_0x43d789=_0x43d789||0xc8;return function(_0x3ad91e){if(_0x3ad91e){return _0x27e557['status'](_0x43d789)['json'](_0x3ad91e);}};}function respondWithFilteredResult(_0x1a4dfb,_0x4ec2c3){return function(_0x5a49da){if(_0x5a49da){var _0x389b3f=typeof _0x4ec2c3[_0x6d6a('0x12')]==='undefined'&&typeof _0x4ec2c3[_0x6d6a('0x13')]==='undefined';var _0x2d88c4=_0x5a49da['count'];var _0x4bfbe0=_0x389b3f?0x0:_0x4ec2c3[_0x6d6a('0x12')];var _0x5c19eb=_0x389b3f?_0x5a49da[_0x6d6a('0x14')]:_0x4ec2c3[_0x6d6a('0x12')]+_0x4ec2c3[_0x6d6a('0x13')];var _0x53264f;if(_0x5c19eb>=_0x2d88c4){_0x5c19eb=_0x2d88c4;_0x53264f=0xc8;}else{_0x53264f=0xce;}_0x1a4dfb[_0x6d6a('0x15')](_0x53264f);return _0x1a4dfb['set'](_0x6d6a('0x16'),_0x4bfbe0+'-'+_0x5c19eb+'/'+_0x2d88c4)[_0x6d6a('0x17')](_0x5a49da);}return null;};}function saveUpdates(_0xb0cc82){return function(_0x35bb9d){if(_0x35bb9d){return _0x35bb9d[_0x6d6a('0x18')](_0xb0cc82)['then'](function(_0x56a2a2){return _0x56a2a2;});}return null;};}function removeEntity(_0xd2b02c){return function(_0x536519){if(_0x536519){return _0x536519['destroy']()['then'](function(){_0xd2b02c['status'](0xcc)[_0x6d6a('0x19')]();});}};}function handleEntityNotFound(_0x3b162b){return function(_0x1009d8){if(!_0x1009d8){_0x3b162b[_0x6d6a('0x11')](0x194);}return _0x1009d8;};}function handleError(_0x20544a,_0x36b2c3){_0x36b2c3=_0x36b2c3||0x1f4;return function(_0x43b4f9){logger[_0x6d6a('0x1a')](_0x43b4f9[_0x6d6a('0x1b')]);if(_0x43b4f9[_0x6d6a('0x1c')]){delete _0x43b4f9[_0x6d6a('0x1c')];}_0x20544a[_0x6d6a('0x15')](_0x36b2c3)[_0x6d6a('0x1d')](_0x43b4f9);};}exports[_0x6d6a('0x1e')]=function(_0x9b3e2a,_0x44bafc){var _0x23ab52={};var _0x32f6ee=_['map'](db['MailInteraction'][_0x6d6a('0x1f')],function(_0x47e395){return{'name':_0x47e395['fieldName'],'type':_0x47e395[_0x6d6a('0x20')]['key']};});_0x23ab52=qs[_0x6d6a('0x21')](_0x32f6ee,_0x9b3e2a);return interaction[_0x6d6a('0x22')](_0x6d6a('0x23'),_0x9b3e2a[_0x6d6a('0x24')],_0x9b3e2a['user'],_0x23ab52,_0x32f6ee)[_0x6d6a('0x25')](respondWithFilteredResult(_0x44bafc,_0x23ab52))['catch'](handleError(_0x44bafc,null));};exports[_0x6d6a('0x26')]=function(_0x34a0a1,_0x200648){var _0x494bd9={'raw':![],'where':{'id':_0x34a0a1[_0x6d6a('0x27')]['id']}},_0x3d5065={};_0x3d5065[_0x6d6a('0x28')]=_[_0x6d6a('0x29')](db['MailInteraction'][_0x6d6a('0x1f')]);_0x3d5065['query']=_['keys'](_0x34a0a1[_0x6d6a('0x24')]);_0x3d5065[_0x6d6a('0x2a')]=_['intersection'](_0x3d5065['model'],_0x3d5065[_0x6d6a('0x24')]);_0x494bd9['attributes']=_['intersection'](_0x3d5065['model'],qs[_0x6d6a('0x2b')](_0x34a0a1[_0x6d6a('0x24')][_0x6d6a('0x2b')]));_0x494bd9['attributes']=_0x494bd9[_0x6d6a('0x2c')][_0x6d6a('0x2d')]?_0x494bd9['attributes']:_0x3d5065[_0x6d6a('0x28')];if(_0x34a0a1[_0x6d6a('0x24')][_0x6d6a('0x2e')]){_0x494bd9['include']=[{'all':!![]}];}_0x494bd9=_[_0x6d6a('0x2f')]({},_0x494bd9,_0x34a0a1['options']);return db[_0x6d6a('0x30')]['find'](_0x494bd9)[_0x6d6a('0x25')](handleEntityNotFound(_0x200648,null))[_0x6d6a('0x25')](respondWithResult(_0x200648,null))['catch'](handleError(_0x200648,null));};exports[_0x6d6a('0x31')]=function(_0x1d261f,_0x143b7d){return db['MailInteraction'][_0x6d6a('0x31')](_0x1d261f[_0x6d6a('0x32')],{})[_0x6d6a('0x25')](respondWithResult(_0x143b7d,0xc9))[_0x6d6a('0x33')](handleError(_0x143b7d,null));};exports[_0x6d6a('0x18')]=function(_0x121fd1,_0x46a377){if(_0x121fd1[_0x6d6a('0x32')]['id']){delete _0x121fd1[_0x6d6a('0x32')]['id'];}return db[_0x6d6a('0x30')][_0x6d6a('0x34')]({'where':{'id':_0x121fd1[_0x6d6a('0x27')]['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x46a377,null))[_0x6d6a('0x25')](saveUpdates(_0x121fd1['body'],null))[_0x6d6a('0x25')](respondWithResult(_0x46a377,null))[_0x6d6a('0x33')](handleError(_0x46a377,null));};exports[_0x6d6a('0x35')]=function(_0x57f82a,_0x26f69f){return db['MailInteraction']['find']({'where':{'id':_0x57f82a[_0x6d6a('0x27')]['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x26f69f,null))[_0x6d6a('0x25')](removeEntity(_0x26f69f,null))['catch'](handleError(_0x26f69f,null));};exports[_0x6d6a('0x36')]=function(_0x4027db,_0x283b18){return db[_0x6d6a('0x30')][_0x6d6a('0x36')]()['then'](respondWithResult(_0x283b18,null))['catch'](handleError(_0x283b18,null));};exports[_0x6d6a('0x37')]=function(_0x8875c6,_0x2e020c){return db['MailMessage']['find']({'where':{'id':_0x8875c6[_0x6d6a('0x27')]['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x2e020c,null))['then'](function(_0x137e9d){if(_0x137e9d){return _0x137e9d[_0x6d6a('0x37')](_0x8875c6['body'][_0x6d6a('0x38')],_[_0x6d6a('0x39')](_0x8875c6[_0x6d6a('0x32')],[_0x6d6a('0x38'),'id'])||{});}})[_0x6d6a('0x25')](respondWithResult(_0x2e020c,null))[_0x6d6a('0x33')](handleError(_0x2e020c,null));};exports[_0x6d6a('0x3a')]=function(_0x3f8118,_0x545fd5){var _0x5b6466={'raw':![],'where':{}};var _0x21871f={};var _0x21e990={'count':0x0,'rows':[]};return db[_0x6d6a('0x30')][_0x6d6a('0x3b')]({'where':{'id':_0x3f8118['params']['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x545fd5,null))[_0x6d6a('0x25')](function(_0x4b6753){if(_0x4b6753){_0x21871f[_0x6d6a('0x28')]=_['keys'](db['MailMessage'][_0x6d6a('0x1f')]);_0x21871f['query']=_[_0x6d6a('0x29')](_0x3f8118[_0x6d6a('0x24')]);_0x21871f[_0x6d6a('0x2a')]=_[_0x6d6a('0x3c')](_0x21871f[_0x6d6a('0x28')],_0x21871f[_0x6d6a('0x24')]);_0x5b6466[_0x6d6a('0x2c')]=_[_0x6d6a('0x3c')](_0x21871f[_0x6d6a('0x28')],qs[_0x6d6a('0x2b')](_0x3f8118['query'][_0x6d6a('0x2b')]));_0x5b6466[_0x6d6a('0x2c')]=_0x5b6466[_0x6d6a('0x2c')]['length']?_0x5b6466[_0x6d6a('0x2c')]:_0x21871f[_0x6d6a('0x28')];if(!_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x3d')](_0x6d6a('0x3e'))){_0x5b6466[_0x6d6a('0x13')]=qs['limit'](_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x13')]);_0x5b6466[_0x6d6a('0x12')]=qs[_0x6d6a('0x12')](_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x12')]);}_0x5b6466[_0x6d6a('0x3f')]=qs[_0x6d6a('0x40')](_0x3f8118[_0x6d6a('0x24')]['sort']);_0x5b6466[_0x6d6a('0x41')]=qs[_0x6d6a('0x2a')](_['pick'](_0x3f8118[_0x6d6a('0x24')],_0x21871f[_0x6d6a('0x2a')]));_0x5b6466[_0x6d6a('0x41')][_0x6d6a('0x42')]=_0x4b6753['id'];if(_0x3f8118['query'][_0x6d6a('0x43')]){_0x5b6466['where']=_[_0x6d6a('0x2f')](_0x5b6466[_0x6d6a('0x41')],{'$or':_[_0x6d6a('0x44')](_0x5b6466['attributes'],function(_0x358ecf){var _0x427322={};_0x427322[_0x358ecf]={'$like':'%'+_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x43')]+'%'};return _0x427322;})});}if(_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x45')]){var _0x513afe=_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x45')][_0x6d6a('0x46')](',');var _0xe5cf85={};_0xe5cf85[_0x513afe[0x0]]={'$gte':moment(_0x513afe[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5b6466[_0x6d6a('0x41')]=_[_0x6d6a('0x2f')](_0x5b6466[_0x6d6a('0x41')],_0xe5cf85);}_0x5b6466=_[_0x6d6a('0x2f')]({},_0x5b6466,_0x3f8118['options']);return db[_0x6d6a('0x47')][_0x6d6a('0x14')]({'where':_0x5b6466[_0x6d6a('0x41')]})['then'](function(_0x3e17b7){_0x21e990['count']=_0x3e17b7;if(_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x2e')]){_0x5b6466['include']=[{'all':!![]}];}return db['MailMessage'][_0x6d6a('0x22')](_0x5b6466);})[_0x6d6a('0x25')](function(_0x45e5fd){if(_0x3f8118[_0x6d6a('0x24')]['inlineCss']===_0x6d6a('0x48')){for(var _0x3a7473=0x0;_0x3a7473<_0x45e5fd[_0x6d6a('0x2d')];_0x3a7473++){_0x45e5fd[_0x3a7473]['body']=juice(_0x45e5fd[_0x3a7473][_0x6d6a('0x32')]);}}_0x21e990[_0x6d6a('0x49')]=_0x45e5fd;return _0x21e990;});}})['then'](respondWithFilteredResult(_0x545fd5,_0x5b6466))['catch'](handleError(_0x545fd5,null));};exports[_0x6d6a('0x4a')]=function(_0x588752,_0x3ea1af){return db['MailInteraction'][_0x6d6a('0x34')]({'where':{'id':_0x588752['params']['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x3ea1af,null))[_0x6d6a('0x25')](function(_0x46626a){if(_0x46626a){return _0x46626a[_0x6d6a('0x4b')](_0x588752[_0x6d6a('0x32')][_0x6d6a('0x38')],_[_0x6d6a('0x39')](_0x588752[_0x6d6a('0x32')],[_0x6d6a('0x38'),'id'])||{})['spread'](function(){return db[_0x6d6a('0x4c')][_0x6d6a('0x22')]({'attributes':['id',_0x6d6a('0x1c'),_0x6d6a('0x4d')],'where':{'id':_0x588752['body'][_0x6d6a('0x38')]}});})[_0x6d6a('0x25')](function(_0x3b7086){socket[_0x6d6a('0x4e')](_0x6d6a('0x4f'),{'id':Number(_0x588752[_0x6d6a('0x27')]['id']),'tags':_0x3b7086||[]});return{'id':Number(_0x588752[_0x6d6a('0x27')]['id']),'tags':_0x3b7086||[]};});}})['then'](respondWithResult(_0x3ea1af,null))[_0x6d6a('0x33')](handleError(_0x3ea1af,null));};exports[_0x6d6a('0x50')]=function(_0x636cfd,_0x449752){return db[_0x6d6a('0x30')][_0x6d6a('0x34')]({'where':{'id':_0x636cfd[_0x6d6a('0x27')]['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x449752,null))['then'](function(_0x3d72cf){if(_0x3d72cf){return _0x3d72cf[_0x6d6a('0x50')](_0x636cfd[_0x6d6a('0x24')]['ids']);}})[_0x6d6a('0x25')](respondWithStatusCode(_0x449752,null))[_0x6d6a('0x33')](handleError(_0x449752,null));};exports['download']=function(_0x3c49f3,_0x18107f){var _0x26ca80=moment()[_0x6d6a('0x51')]()['toString']();var _0x3e0851=path[_0x6d6a('0x52')](config[_0x6d6a('0x53')],_0x6d6a('0x54'),_0x6d6a('0x55'),_0x6d6a('0x56'));var _0x45ee2a=path[_0x6d6a('0x52')](config[_0x6d6a('0x53')],_0x6d6a('0x54'),_0x6d6a('0x55'),_0x6d6a('0x57'));var _0x25e27a=path[_0x6d6a('0x52')](_0x3e0851,_0x26ca80);var _0x413a7b=util[_0x6d6a('0x58')](_0x6d6a('0x59'),_0x3c49f3[_0x6d6a('0x27')]['id'],_0x26ca80);var _0x3de2b2=path['join'](_0x3e0851,_0x413a7b);var _0x3237ea=[];if(_0x3c49f3[_0x6d6a('0x24')]['attachments']){_0x3237ea[_0x6d6a('0x5a')]({'model':db[_0x6d6a('0x5b')],'as':_0x6d6a('0x5c'),'raw':!![]});}var _0x267f4a=[{'model':db[_0x6d6a('0x47')],'as':'Messages','attributes':['id',_0x6d6a('0x32'),_0x6d6a('0x5d'),'to','cc','bcc',_0x6d6a('0x5e'),_0x6d6a('0x5f')],'where':{'secret':![]},'order':qs[_0x6d6a('0x40')]('id'),'include':_0x3237ea}];return db[_0x6d6a('0x30')][_0x6d6a('0x34')]({'where':{'id':_0x3c49f3[_0x6d6a('0x27')]['id']},'include':_0x267f4a})[_0x6d6a('0x25')](handleEntityNotFound(_0x18107f,null))[_0x6d6a('0x25')](function(_0x2fbada){if(_0x2fbada&&_0x2fbada[_0x6d6a('0x60')]){var _0x411607=_0x2fbada[_0x6d6a('0x61')]({'plain':!![]});fs[_0x6d6a('0x62')](_0x25e27a);return BPromise[_0x6d6a('0x63')](_0x411607['Messages'],function(_0x4a7d4b,_0x53d890){var _0xd38dab={'from':_0x4a7d4b[_0x6d6a('0x5d')],'to':_0x4a7d4b['to']||_0x6d6a('0x64'),'subject':_0x4a7d4b[_0x6d6a('0x5e')],'html':htmlEntities['decode'](_0x4a7d4b['body']),'headers':{'Date':moment(_0x4a7d4b[_0x6d6a('0x5f')])[_0x6d6a('0x58')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4a7d4b['cc']){_0xd38dab[_0x6d6a('0x65')]['Cc']=_0x4a7d4b['cc'];}if(_0x4a7d4b[_0x6d6a('0x66')]){_0xd38dab['headers'][_0x6d6a('0x67')]=_0x4a7d4b[_0x6d6a('0x66')];}return new BPromise(function(_0x774bb,_0x183527){if(_0x4a7d4b[_0x6d6a('0x5c')]){for(var _0x3aa2b1=0x0;_0x3aa2b1<_0x4a7d4b[_0x6d6a('0x5c')][_0x6d6a('0x2d')];_0x3aa2b1++){var _0x117a69=_0x4a7d4b['Attachments'][_0x3aa2b1];var _0xdb64c0=path['join'](_0x45ee2a,_0x117a69['basename']);if(fs[_0x6d6a('0x68')](_0xdb64c0)){_0xd38dab[_0x6d6a('0x57')]['push']({'name':_0x117a69[_0x6d6a('0x1c')],'contentType':_0x117a69[_0x6d6a('0x20')],'data':fs[_0x6d6a('0x69')](_0xdb64c0)});}}}emlformat[_0x6d6a('0x6a')](_0xd38dab,function(_0x4559b8,_0x4e4c54){if(_0x4559b8)return _0x183527(_0x4559b8);fs[_0x6d6a('0x6b')](path[_0x6d6a('0x52')](_0x25e27a,util[_0x6d6a('0x58')](_0x6d6a('0x6c'),_0x53d890)),_0x4e4c54);return _0x774bb(_0x4e4c54);});});})[_0x6d6a('0x25')](function(){return new BPromise(function(_0xd21095,_0x5a6aee){zipdir(_0x25e27a,{'saveTo':_0x3de2b2},function(_0x43bbe2,_0x28af83){if(_0x43bbe2)return _0x5a6aee(_0x43bbe2);return _0xd21095(_0x28af83);});})['then'](function(){return new BPromise(function(_0x422e9d,_0x5612b7){rimraf(_0x25e27a,function(_0x5cc31e){if(_0x5cc31e)_0x5612b7(_0x5cc31e);return _0x422e9d();});});})[_0x6d6a('0x25')](function(){return _0x18107f[_0x6d6a('0x6d')](_0x3de2b2,_0x413a7b,function(_0x16ed4f){if(!_0x16ed4f)fs[_0x6d6a('0x6e')](_0x3de2b2);});});});}else{return _0x18107f[_0x6d6a('0x11')](0xc8);}})[_0x6d6a('0x33')](handleError(_0x18107f,null));}; \ No newline at end of file +var _0x559c=['index','map','rawAttributes','key','getOptions','findAll','user','catch','show','params','model','MailInteraction','keys','intersection','query','fields','attributes','length','include','merge','options','find','create','body','update','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','nolimit','order','sort','where','filters','MailInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','missing.recipient@your.company.com','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','html-entities','redis','defaults','localhost','./mailInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','then','end','error','stack','name','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x559c,0x19a));var _0xc559=function(_0x5c5f3b,_0x5b9190){_0x5c5f3b=_0x5c5f3b-0x0;var _0x8a59e4=_0x559c[_0x5c5f3b];return _0x8a59e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc559('0x0'));var zipdir=require(_0xc559('0x1'));var moment=require(_0xc559('0x2'));var BPromise=require(_0xc559('0x3'));var util=require('util');var path=require(_0xc559('0x4'));var fs=require('fs');var _=require(_0xc559('0x5'));var juice=require(_0xc559('0x6'));var Redis=require('ioredis');var interaction=require(_0xc559('0x7'));var qs=require(_0xc559('0x8'));var logger=require(_0xc559('0x9'))('api');var config=require(_0xc559('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xc559('0xb'));config[_0xc559('0xc')]=_[_0xc559('0xd')](config['redis'],{'host':_0xc559('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc559('0xc')]));require(_0xc559('0xf'))['register'](socket);function respondWithStatusCode(_0x4a547b,_0x271ee3){_0x271ee3=_0x271ee3||0xcc;return function(_0x150f3d){if(_0x150f3d){return _0x4a547b[_0xc559('0x10')](_0x271ee3);}return _0x4a547b[_0xc559('0x11')](_0x271ee3)['end']();};}function respondWithResult(_0x656eb9,_0x5002b1){_0x5002b1=_0x5002b1||0xc8;return function(_0x151d7f){if(_0x151d7f){return _0x656eb9[_0xc559('0x11')](_0x5002b1)[_0xc559('0x12')](_0x151d7f);}};}function respondWithFilteredResult(_0x39fee6,_0x3797eb){return function(_0x49c424){if(_0x49c424){var _0x334c39=typeof _0x3797eb[_0xc559('0x13')]===_0xc559('0x14')&&typeof _0x3797eb[_0xc559('0x15')]===_0xc559('0x14');var _0x22f4d8=_0x49c424[_0xc559('0x16')];var _0x32be87=_0x334c39?0x0:_0x3797eb[_0xc559('0x13')];var _0x3740b9=_0x334c39?_0x49c424['count']:_0x3797eb[_0xc559('0x13')]+_0x3797eb[_0xc559('0x15')];var _0x1a4ab3;if(_0x3740b9>=_0x22f4d8){_0x3740b9=_0x22f4d8;_0x1a4ab3=0xc8;}else{_0x1a4ab3=0xce;}_0x39fee6[_0xc559('0x11')](_0x1a4ab3);return _0x39fee6[_0xc559('0x17')]('Content-Range',_0x32be87+'-'+_0x3740b9+'/'+_0x22f4d8)[_0xc559('0x12')](_0x49c424);}return null;};}function saveUpdates(_0x1900c0){return function(_0x50e855){if(_0x50e855){return _0x50e855['update'](_0x1900c0)[_0xc559('0x18')](function(_0x4c5ead){return _0x4c5ead;});}return null;};}function removeEntity(_0x4ad4bc){return function(_0x3d18de){if(_0x3d18de){return _0x3d18de['destroy']()['then'](function(){_0x4ad4bc['status'](0xcc)[_0xc559('0x19')]();});}};}function handleEntityNotFound(_0x1e98ec){return function(_0x4df096){if(!_0x4df096){_0x1e98ec[_0xc559('0x10')](0x194);}return _0x4df096;};}function handleError(_0x5e630d,_0xacd2fd){_0xacd2fd=_0xacd2fd||0x1f4;return function(_0x1bbe93){logger[_0xc559('0x1a')](_0x1bbe93[_0xc559('0x1b')]);if(_0x1bbe93[_0xc559('0x1c')]){delete _0x1bbe93[_0xc559('0x1c')];}_0x5e630d['status'](_0xacd2fd)[_0xc559('0x1d')](_0x1bbe93);};}exports[_0xc559('0x1e')]=function(_0x1c8ed1,_0x1b7dac){var _0x47ae8f={};var _0x346c87=_[_0xc559('0x1f')](db['MailInteraction'][_0xc559('0x20')],function(_0x2729c3){return{'name':_0x2729c3['fieldName'],'type':_0x2729c3['type'][_0xc559('0x21')]};});_0x47ae8f=qs[_0xc559('0x22')](_0x346c87,_0x1c8ed1);return interaction[_0xc559('0x23')]('mail',_0x1c8ed1['query'],_0x1c8ed1[_0xc559('0x24')],_0x47ae8f,_0x346c87)['then'](respondWithFilteredResult(_0x1b7dac,_0x47ae8f))[_0xc559('0x25')](handleError(_0x1b7dac,null));};exports[_0xc559('0x26')]=function(_0x41e944,_0x5a20c0){var _0x2eb03f={'raw':![],'where':{'id':_0x41e944[_0xc559('0x27')]['id']}},_0x56cb6c={};_0x56cb6c[_0xc559('0x28')]=_['keys'](db[_0xc559('0x29')][_0xc559('0x20')]);_0x56cb6c['query']=_[_0xc559('0x2a')](_0x41e944['query']);_0x56cb6c['filters']=_[_0xc559('0x2b')](_0x56cb6c[_0xc559('0x28')],_0x56cb6c[_0xc559('0x2c')]);_0x2eb03f['attributes']=_[_0xc559('0x2b')](_0x56cb6c['model'],qs[_0xc559('0x2d')](_0x41e944[_0xc559('0x2c')]['fields']));_0x2eb03f[_0xc559('0x2e')]=_0x2eb03f[_0xc559('0x2e')][_0xc559('0x2f')]?_0x2eb03f[_0xc559('0x2e')]:_0x56cb6c[_0xc559('0x28')];if(_0x41e944['query']['includeAll']){_0x2eb03f[_0xc559('0x30')]=[{'all':!![]}];}_0x2eb03f=_[_0xc559('0x31')]({},_0x2eb03f,_0x41e944[_0xc559('0x32')]);return db[_0xc559('0x29')][_0xc559('0x33')](_0x2eb03f)[_0xc559('0x18')](handleEntityNotFound(_0x5a20c0,null))[_0xc559('0x18')](respondWithResult(_0x5a20c0,null))[_0xc559('0x25')](handleError(_0x5a20c0,null));};exports[_0xc559('0x34')]=function(_0x33b6b8,_0x293721){return db[_0xc559('0x29')]['create'](_0x33b6b8[_0xc559('0x35')],{})[_0xc559('0x18')](respondWithResult(_0x293721,0xc9))[_0xc559('0x25')](handleError(_0x293721,null));};exports[_0xc559('0x36')]=function(_0x5cf86a,_0x115139){if(_0x5cf86a[_0xc559('0x35')]['id']){delete _0x5cf86a[_0xc559('0x35')]['id'];}return db[_0xc559('0x29')][_0xc559('0x33')]({'where':{'id':_0x5cf86a['params']['id']}})[_0xc559('0x18')](handleEntityNotFound(_0x115139,null))['then'](saveUpdates(_0x5cf86a[_0xc559('0x35')],null))['then'](respondWithResult(_0x115139,null))[_0xc559('0x25')](handleError(_0x115139,null));};exports['destroy']=function(_0x1cd75b,_0x4a1251){return db[_0xc559('0x29')][_0xc559('0x33')]({'where':{'id':_0x1cd75b[_0xc559('0x27')]['id']}})[_0xc559('0x18')](handleEntityNotFound(_0x4a1251,null))[_0xc559('0x18')](removeEntity(_0x4a1251,null))[_0xc559('0x25')](handleError(_0x4a1251,null));};exports[_0xc559('0x37')]=function(_0x451346,_0x298e59){return db[_0xc559('0x29')][_0xc559('0x37')]()['then'](respondWithResult(_0x298e59,null))['catch'](handleError(_0x298e59,null));};exports[_0xc559('0x38')]=function(_0x44aa29,_0x7c4f8d){return db['MailMessage']['find']({'where':{'id':_0x44aa29[_0xc559('0x27')]['id']}})['then'](handleEntityNotFound(_0x7c4f8d,null))[_0xc559('0x18')](function(_0x507b75){if(_0x507b75){return _0x507b75['addMessage'](_0x44aa29[_0xc559('0x35')][_0xc559('0x39')],_[_0xc559('0x3a')](_0x44aa29[_0xc559('0x35')],[_0xc559('0x39'),'id'])||{});}})[_0xc559('0x18')](respondWithResult(_0x7c4f8d,null))[_0xc559('0x25')](handleError(_0x7c4f8d,null));};exports[_0xc559('0x3b')]=function(_0x1c742d,_0x53f904){var _0x3b5280={'raw':![],'where':{}};var _0x21c9e8={};var _0x44e8e9={'count':0x0,'rows':[]};return db[_0xc559('0x29')][_0xc559('0x3c')]({'where':{'id':_0x1c742d[_0xc559('0x27')]['id']}})['then'](handleEntityNotFound(_0x53f904,null))[_0xc559('0x18')](function(_0x1604b3){if(_0x1604b3){_0x21c9e8[_0xc559('0x28')]=_[_0xc559('0x2a')](db[_0xc559('0x3d')][_0xc559('0x20')]);_0x21c9e8[_0xc559('0x2c')]=_['keys'](_0x1c742d[_0xc559('0x2c')]);_0x21c9e8['filters']=_[_0xc559('0x2b')](_0x21c9e8[_0xc559('0x28')],_0x21c9e8[_0xc559('0x2c')]);_0x3b5280[_0xc559('0x2e')]=_[_0xc559('0x2b')](_0x21c9e8[_0xc559('0x28')],qs['fields'](_0x1c742d[_0xc559('0x2c')][_0xc559('0x2d')]));_0x3b5280['attributes']=_0x3b5280[_0xc559('0x2e')]['length']?_0x3b5280[_0xc559('0x2e')]:_0x21c9e8[_0xc559('0x28')];if(!_0x1c742d[_0xc559('0x2c')]['hasOwnProperty'](_0xc559('0x3e'))){_0x3b5280[_0xc559('0x15')]=qs['limit'](_0x1c742d[_0xc559('0x2c')]['limit']);_0x3b5280[_0xc559('0x13')]=qs[_0xc559('0x13')](_0x1c742d[_0xc559('0x2c')][_0xc559('0x13')]);}_0x3b5280[_0xc559('0x3f')]=qs[_0xc559('0x40')](_0x1c742d['query'][_0xc559('0x40')]);_0x3b5280[_0xc559('0x41')]=qs[_0xc559('0x42')](_['pick'](_0x1c742d[_0xc559('0x2c')],_0x21c9e8[_0xc559('0x42')]));_0x3b5280['where'][_0xc559('0x43')]=_0x1604b3['id'];if(_0x1c742d['query']['filter']){_0x3b5280[_0xc559('0x41')]=_[_0xc559('0x31')](_0x3b5280[_0xc559('0x41')],{'$or':_['map'](_0x3b5280[_0xc559('0x2e')],function(_0x3eb732){var _0x52e4f5={};_0x52e4f5[_0x3eb732]={'$like':'%'+_0x1c742d[_0xc559('0x2c')]['filter']+'%'};return _0x52e4f5;})});}if(_0x1c742d[_0xc559('0x2c')][_0xc559('0x44')]){var _0x41ef26=_0x1c742d[_0xc559('0x2c')][_0xc559('0x44')][_0xc559('0x45')](',');var _0x35f653={};_0x35f653[_0x41ef26[0x0]]={'$gte':moment(_0x41ef26[0x1])['format'](_0xc559('0x46'))};_0x3b5280[_0xc559('0x41')]=_[_0xc559('0x31')](_0x3b5280[_0xc559('0x41')],_0x35f653);}_0x3b5280=_['merge']({},_0x3b5280,_0x1c742d[_0xc559('0x32')]);return db[_0xc559('0x3d')][_0xc559('0x16')]({'where':_0x3b5280[_0xc559('0x41')]})['then'](function(_0x3ec9df){_0x44e8e9['count']=_0x3ec9df;if(_0x1c742d[_0xc559('0x2c')]['includeAll']){_0x3b5280[_0xc559('0x30')]=[{'all':!![]}];}return db['MailMessage'][_0xc559('0x23')](_0x3b5280);})[_0xc559('0x18')](function(_0x17da1b){if(_0x1c742d['query'][_0xc559('0x47')]===_0xc559('0x48')){for(var _0x169c94=0x0;_0x169c94<_0x17da1b[_0xc559('0x2f')];_0x169c94++){_0x17da1b[_0x169c94]['body']=juice(_0x17da1b[_0x169c94][_0xc559('0x35')]);}}_0x44e8e9[_0xc559('0x49')]=_0x17da1b;return _0x44e8e9;});}})[_0xc559('0x18')](respondWithFilteredResult(_0x53f904,_0x3b5280))[_0xc559('0x25')](handleError(_0x53f904,null));};exports['addTags']=function(_0x48d09f,_0x4ca80e){return db[_0xc559('0x29')][_0xc559('0x33')]({'where':{'id':_0x48d09f[_0xc559('0x27')]['id']}})[_0xc559('0x18')](handleEntityNotFound(_0x4ca80e,null))[_0xc559('0x18')](function(_0x23e9f2){if(_0x23e9f2){return _0x23e9f2[_0xc559('0x4a')](_0x48d09f[_0xc559('0x35')][_0xc559('0x39')],_[_0xc559('0x3a')](_0x48d09f[_0xc559('0x35')],[_0xc559('0x39'),'id'])||{})['spread'](function(){return db[_0xc559('0x4b')][_0xc559('0x23')]({'attributes':['id',_0xc559('0x1c'),_0xc559('0x4c')],'where':{'id':_0x48d09f[_0xc559('0x35')][_0xc559('0x39')]}});})['then'](function(_0x840b36){socket[_0xc559('0x4d')](_0xc559('0x4e'),{'id':Number(_0x48d09f[_0xc559('0x27')]['id']),'tags':_0x840b36||[]});return{'id':Number(_0x48d09f[_0xc559('0x27')]['id']),'tags':_0x840b36||[]};});}})['then'](respondWithResult(_0x4ca80e,null))[_0xc559('0x25')](handleError(_0x4ca80e,null));};exports[_0xc559('0x4f')]=function(_0x4d1d18,_0x4ea6d3){return db['MailInteraction']['find']({'where':{'id':_0x4d1d18[_0xc559('0x27')]['id']}})[_0xc559('0x18')](handleEntityNotFound(_0x4ea6d3,null))[_0xc559('0x18')](function(_0x193d96){if(_0x193d96){return _0x193d96[_0xc559('0x4f')](_0x4d1d18[_0xc559('0x2c')][_0xc559('0x39')]);}})['then'](respondWithStatusCode(_0x4ea6d3,null))[_0xc559('0x25')](handleError(_0x4ea6d3,null));};exports['download']=function(_0x574062,_0x59b3fe){var _0x2406cf=moment()[_0xc559('0x50')]()['toString']();var _0x274098=path['join'](config[_0xc559('0x51')],_0xc559('0x52'),_0xc559('0x53'),_0xc559('0x54'));var _0x4ee97a=path[_0xc559('0x55')](config['root'],_0xc559('0x52'),_0xc559('0x53'),_0xc559('0x56'));var _0x542648=path['join'](_0x274098,_0x2406cf);var _0x393209=util['format'](_0xc559('0x57'),_0x574062['params']['id'],_0x2406cf);var _0x39abe2=path[_0xc559('0x55')](_0x274098,_0x393209);var _0x342046=[];if(_0x574062[_0xc559('0x2c')][_0xc559('0x56')]){_0x342046[_0xc559('0x58')]({'model':db[_0xc559('0x59')],'as':_0xc559('0x5a'),'raw':!![]});}var _0x4fa169=[{'model':db[_0xc559('0x3d')],'as':_0xc559('0x5b'),'attributes':['id',_0xc559('0x35'),_0xc559('0x5c'),'to','cc',_0xc559('0x5d'),_0xc559('0x5e'),_0xc559('0x5f')],'where':{'secret':![]},'order':qs[_0xc559('0x40')]('id'),'include':_0x342046}];return db['MailInteraction'][_0xc559('0x33')]({'where':{'id':_0x574062[_0xc559('0x27')]['id']},'include':_0x4fa169})[_0xc559('0x18')](handleEntityNotFound(_0x59b3fe,null))[_0xc559('0x18')](function(_0x4aa24b){if(_0x4aa24b&&_0x4aa24b[_0xc559('0x5b')]){var _0x2913aa=_0x4aa24b[_0xc559('0x60')]({'plain':!![]});fs[_0xc559('0x61')](_0x542648);return BPromise['each'](_0x2913aa[_0xc559('0x5b')],function(_0x904717,_0x466555){var _0x4bea7b={'from':_0x904717[_0xc559('0x5c')],'to':_0x904717['to']||_0xc559('0x62'),'subject':_0x904717['subject'],'html':htmlEntities['decode'](_0x904717[_0xc559('0x35')]),'headers':{'Date':moment(_0x904717[_0xc559('0x5f')])[_0xc559('0x63')](_0xc559('0x64'))},'attachments':[]};if(_0x904717['cc']){_0x4bea7b[_0xc559('0x65')]['Cc']=_0x904717['cc'];}if(_0x904717[_0xc559('0x5d')]){_0x4bea7b[_0xc559('0x65')][_0xc559('0x66')]=_0x904717[_0xc559('0x5d')];}return new BPromise(function(_0x2d3f8c,_0x1ba0fd){if(_0x904717['Attachments']){for(var _0x204fc6=0x0;_0x204fc6<_0x904717[_0xc559('0x5a')][_0xc559('0x2f')];_0x204fc6++){var _0x1e6cc9=_0x904717['Attachments'][_0x204fc6];var _0x2f0f9d=path['join'](_0x4ee97a,_0x1e6cc9['basename']);if(fs[_0xc559('0x67')](_0x2f0f9d)){_0x4bea7b[_0xc559('0x56')][_0xc559('0x58')]({'name':_0x1e6cc9[_0xc559('0x1c')],'contentType':_0x1e6cc9['type'],'data':fs[_0xc559('0x68')](_0x2f0f9d)});}}}emlformat[_0xc559('0x69')](_0x4bea7b,function(_0x90b4b4,_0x4f16c3){if(_0x90b4b4)return _0x1ba0fd(_0x90b4b4);fs[_0xc559('0x6a')](path[_0xc559('0x55')](_0x542648,util[_0xc559('0x63')](_0xc559('0x6b'),_0x466555)),_0x4f16c3);return _0x2d3f8c(_0x4f16c3);});});})['then'](function(){return new BPromise(function(_0x3566de,_0x570855){zipdir(_0x542648,{'saveTo':_0x39abe2},function(_0x13f749,_0x1508fa){if(_0x13f749)return _0x570855(_0x13f749);return _0x3566de(_0x1508fa);});})[_0xc559('0x18')](function(){return new BPromise(function(_0x449b74,_0x45ca45){rimraf(_0x542648,function(_0x465dde){if(_0x465dde)_0x45ca45(_0x465dde);return _0x449b74();});});})[_0xc559('0x18')](function(){return _0x59b3fe[_0xc559('0x6c')](_0x39abe2,_0x393209,function(_0x48f58e){if(!_0x48f58e)fs[_0xc559('0x6d')](_0x39abe2);});});});}else{return _0x59b3fe['sendStatus'](0xc8);}})[_0xc559('0x25')](handleError(_0x59b3fe,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a6bca09..5b5b270 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 _0x9345=['save','remove','getUsers','then','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x9345,0x6c));var _0x5934=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0x9345[_0x5ef55a];return _0x20ae40;};'use strict';var EventEmitter=require(_0x5934('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x5934('0x1')];var MailMessage=require(_0x5934('0x2'))['db'][_0x5934('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5934('0x4'),'afterUpdate':'update','afterDestroy':_0x5934('0x5')};function emitEvent(_0xee1ad6){return function(_0x47d21b,_0x2ebd79,_0x593360){_0x47d21b[_0x5934('0x6')]({'attributes':['id'],'raw':!![]})[_0x5934('0x7')](function(_0xa1a450){_0x47d21b['setDataValue'](_0x5934('0x8'),_0xa1a450['map'](function(_0x49a872){return{'id':_0x49a872['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x47d21b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2bfebd){_0x47d21b['setDataValue'](_0x5934('0x9'),_0x2bfebd[_0x5934('0xa')]);MailInteractionEvents[_0x5934('0xb')](_0xee1ad6+':'+_0x47d21b['id'],_0x47d21b);MailInteractionEvents['emit'](_0xee1ad6,_0x47d21b);_0x593360(null);})[_0x5934('0xc')](_0x593360(null));};}for(var e in events){if(events[_0x5934('0xd')](e)){var event=events[e];MailInteraction[_0x5934('0xe')](e,emitEvent(event));}}module[_0x5934('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x4c88=['MailMessage','setMaxListeners','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x593dd4,_0x111835){var _0x4b0e4b=function(_0x594bad){while(--_0x594bad){_0x593dd4['push'](_0x593dd4['shift']());}};_0x4b0e4b(++_0x111835);}(_0x4c88,0x1c6));var _0x84c8=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4c88[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x84c8('0x0'));var MailInteraction=require(_0x84c8('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x84c8('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x84c8('0x3')](0x0);var events={'afterCreate':_0x84c8('0x4'),'afterUpdate':_0x84c8('0x5'),'afterDestroy':_0x84c8('0x6')};function emitEvent(_0xb96aca){return function(_0x51931a,_0x1a60be,_0x1d0174){_0x51931a[_0x84c8('0x7')]({'attributes':['id'],'raw':!![]})[_0x84c8('0x8')](function(_0x1d6c41){_0x51931a['setDataValue'](_0x84c8('0x9'),_0x1d6c41['map'](function(_0x13c48b){return{'id':_0x13c48b['id']};}));return MailMessage[_0x84c8('0xa')]({'where':{'MailInteractionId':_0x51931a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x84c8('0x8')](function(_0x402a89){_0x51931a[_0x84c8('0xb')](_0x84c8('0xc'),_0x402a89[_0x84c8('0xd')]);MailInteractionEvents[_0x84c8('0xe')](_0xb96aca+':'+_0x51931a['id'],_0x51931a);MailInteractionEvents[_0x84c8('0xe')](_0xb96aca,_0x51931a);_0x1d0174(null);})[_0x84c8('0xf')](_0x1d0174(null));};}for(var e in events){if(events[_0x84c8('0x10')](e)){var event=events[e];MailInteraction[_0x84c8('0x11')](e,emitEvent(event));}}module[_0x84c8('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 7c1a32f..23ded27 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 _0x8a89=['substatus','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed'];(function(_0x502f76,_0x27cad9){var _0x4fc00e=function(_0x19ea0){while(--_0x19ea0){_0x502f76['push'](_0x502f76['shift']());}};_0x4fc00e(++_0x27cad9);}(_0x8a89,0x1db));var _0x98a8=function(_0x4c70c4,_0x963969){_0x4c70c4=_0x4c70c4-0x0;var _0x437865=_0x8a89[_0x4c70c4];return _0x437865;};'use strict';var _=require(_0x98a8('0x0'));var util=require('util');var logger=require(_0x98a8('0x1'))(_0x98a8('0x2'));var moment=require('moment');var BPromise=require(_0x98a8('0x3'));var rp=require(_0x98a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x98a8('0x5'));var config=require(_0x98a8('0x6'));var attributes=require(_0x98a8('0x7'));module[_0x98a8('0x8')]=function(_0x11e1f6,_0x2184e3){return _0x11e1f6[_0x98a8('0x9')]('MailInteraction',attributes,{'tableName':_0x98a8('0xa'),'paranoid':![],'indexes':[{'name':_0x98a8('0xb'),'fields':[_0x98a8('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24004d,_0x2a16f8,_0x48368b){if(_0x24004d['substatus']){_0x24004d[_0x98a8('0xd')]=moment()[_0x98a8('0xe')](_0x98a8('0xf'));}if(_0x24004d[_0x98a8('0x10')]){_0x24004d[_0x98a8('0x11')]=moment()[_0x98a8('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x48368b(null,_0x2a16f8);},'beforeUpdate':function(_0x1ff1f0,_0x2cd5ce,_0x4e6c22){if(_0x1ff1f0[_0x98a8('0x12')](_0x98a8('0x13'))){_0x1ff1f0[_0x98a8('0xd')]=_0x1ff1f0[_0x98a8('0x13')]?moment()[_0x98a8('0xe')](_0x98a8('0xf')):null;}if(_0x1ff1f0[_0x98a8('0x12')](_0x98a8('0x10'))){_0x1ff1f0['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1ff1f0[_0x98a8('0x13')]=null;_0x1ff1f0['substatusAt']=null;}_0x4e6c22(null,_0x1ff1f0);},'afterUpdate':function(_0x32985e,_0x415b3d,_0x43da5d){var _0x3294f3=_0x11e1f6['models'];var _0x27d573=_0x32985e[_0x98a8('0x14')]({'plain':!![]});if(_0x27d573[_0x98a8('0x10')]){return _0x3294f3['MailMessage'][_0x98a8('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x27d573['id']}})[_0x98a8('0x16')](function(){_0x43da5d();})[_0x98a8('0x17')](function(_0x376ff0){_0x43da5d(_0x376ff0);});}else{_0x43da5d();}}},'charset':_0x98a8('0x18'),'collate':_0x98a8('0x19')});}; \ No newline at end of file +var _0x76a6=['exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','get','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes'];(function(_0x276f6d,_0x10a50e){var _0xda31b5=function(_0x5cfb89){while(--_0x5cfb89){_0x276f6d['push'](_0x276f6d['shift']());}};_0xda31b5(++_0x10a50e);}(_0x76a6,0xb5));var _0x676a=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x76a6[_0x422ac3];return _0x53c0d4;};'use strict';var _=require(_0x676a('0x0'));var util=require(_0x676a('0x1'));var logger=require(_0x676a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x676a('0x3'));var rp=require(_0x676a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x676a('0x5'));var config=require(_0x676a('0x6'));var attributes=require(_0x676a('0x7'));module[_0x676a('0x8')]=function(_0x4ec939,_0x449e2f){return _0x4ec939[_0x676a('0x9')]('MailInteraction',attributes,{'tableName':_0x676a('0xa'),'paranoid':![],'indexes':[{'name':_0x676a('0xb'),'fields':[_0x676a('0xc'),'to'],'type':_0x676a('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x34defd,_0x32a568,_0x4df681){if(_0x34defd[_0x676a('0xe')]){_0x34defd['substatusAt']=moment()[_0x676a('0xf')](_0x676a('0x10'));}if(_0x34defd[_0x676a('0x11')]){_0x34defd[_0x676a('0x12')]=moment()[_0x676a('0xf')](_0x676a('0x10'));}_0x4df681(null,_0x32a568);},'beforeUpdate':function(_0x231403,_0x4218ad,_0x368ed9){if(_0x231403[_0x676a('0x13')]('substatus')){_0x231403['substatusAt']=_0x231403[_0x676a('0xe')]?moment()[_0x676a('0xf')](_0x676a('0x10')):null;}if(_0x231403['changed'](_0x676a('0x11'))){_0x231403[_0x676a('0x12')]=moment()[_0x676a('0xf')](_0x676a('0x10'));_0x231403[_0x676a('0xe')]=null;_0x231403[_0x676a('0x14')]=null;}_0x368ed9(null,_0x231403);},'afterUpdate':function(_0x1a781c,_0x42391d,_0x598445){var _0x4c4d0f=_0x4ec939[_0x676a('0x15')];var _0xb77f97=_0x1a781c[_0x676a('0x16')]({'plain':!![]});if(_0xb77f97['closed']){return _0x4c4d0f[_0x676a('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0xb77f97['id']}})[_0x676a('0x18')](function(){_0x598445();})['catch'](function(_0x5b55d7){_0x598445(_0x5b55d7);});}else{_0x598445();}}},'charset':_0x676a('0x19'),'collate':_0x676a('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b1232ea..c9be063 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 _0x6f44=['message','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToMailInteraction','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x89a5fa,_0x354d3c){var _0x332590=function(_0x55e7f7){while(--_0x55e7f7){_0x89a5fa['push'](_0x89a5fa['shift']());}};_0x332590(++_0x354d3c);}(_0x6f44,0x1ea));var _0x46f4=function(_0x4e22d4,_0x2a7a57){_0x4e22d4=_0x4e22d4-0x0;var _0x4a6c13=_0x6f44[_0x4e22d4];return _0x4a6c13;};'use strict';var _=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var moment=require('moment');var BPromise=require(_0x46f4('0x2'));var rs=require(_0x46f4('0x3'));var fs=require('fs');var Redis=require(_0x46f4('0x4'));var db=require(_0x46f4('0x5'))['db'];var utils=require(_0x46f4('0x6'));var logger=require(_0x46f4('0x7'))(_0x46f4('0x8'));var config=require(_0x46f4('0x9'));var jayson=require(_0x46f4('0xa'));var client=jayson['client'][_0x46f4('0xb')]({'port':0x232a});config[_0x46f4('0xc')]=_[_0x46f4('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x46f4('0xe'))(new Redis(config[_0x46f4('0xc')]));require('./mailInteraction.socket')[_0x46f4('0xf')](socket);function respondWithRpcPromise(_0x5662a3,_0x2064fd,_0x487ef8){return new BPromise(function(_0x14cc75,_0x1fe1a5){return client[_0x46f4('0x10')](_0x5662a3,_0x487ef8)[_0x46f4('0x11')](function(_0xbc1148){logger[_0x46f4('0x12')](_0x46f4('0x13'),_0x2064fd,_0x46f4('0x14'));logger[_0x46f4('0x15')](_0x46f4('0x16'),_0x2064fd,_0x46f4('0x14'),JSON[_0x46f4('0x17')](_0xbc1148));if(_0xbc1148['error']){if(_0xbc1148[_0x46f4('0x18')][_0x46f4('0x19')]===0x1f4){logger['error'](_0x46f4('0x13'),_0x2064fd,_0xbc1148[_0x46f4('0x18')][_0x46f4('0x1a')]);return _0x1fe1a5(_0xbc1148['error'][_0x46f4('0x1a')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x2064fd,_0xbc1148[_0x46f4('0x18')][_0x46f4('0x1a')]);return _0x14cc75(_0xbc1148[_0x46f4('0x18')]['message']);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x2064fd,'request\x20sent');_0x14cc75(_0xbc1148[_0x46f4('0x1b')][_0x46f4('0x1a')]);}})['catch'](function(_0x22209b){logger[_0x46f4('0x18')](_0x46f4('0x13'),_0x2064fd,_0x22209b);_0x1fe1a5(_0x22209b);});});}exports[_0x46f4('0x1c')]=function(_0x4b0650){var _0x1af169=this;return new Promise(function(_0x390137,_0x1627db){return db[_0x46f4('0x1d')][_0x46f4('0x1e')](_0x4b0650[_0x46f4('0x1f')],{'raw':_0x4b0650['options']?_0x4b0650[_0x46f4('0x20')][_0x46f4('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b0650[_0x46f4('0x20')]?_0x4b0650['options'][_0x46f4('0x22')]||null:null,'attributes':_0x4b0650[_0x46f4('0x20')]?_0x4b0650[_0x46f4('0x20')][_0x46f4('0x23')]||null:null,'limit':_0x4b0650[_0x46f4('0x20')]?_0x4b0650[_0x46f4('0x20')][_0x46f4('0x24')]||null:null})[_0x46f4('0x11')](function(_0x39eb2f){logger[_0x46f4('0x12')](_0x46f4('0x1c'),_0x4b0650);logger[_0x46f4('0x15')](_0x46f4('0x1c'),_0x4b0650,JSON['stringify'](_0x39eb2f));_0x390137(_0x39eb2f);})[_0x46f4('0x25')](function(_0x30d4fc){logger[_0x46f4('0x18')](_0x46f4('0x1c'),_0x30d4fc[_0x46f4('0x1a')],_0x4b0650);_0x1627db(_0x1af169[_0x46f4('0x18')](0x1f4,_0x30d4fc['message']));});});};exports[_0x46f4('0x26')]=function(_0x552ab0){return new Promise(function(_0x546d2b,_0x53ac21){return db[_0x46f4('0x1d')]['find']({'where':_0x552ab0[_0x46f4('0x20')]?_0x552ab0[_0x46f4('0x20')][_0x46f4('0x22')]||null:null})[_0x46f4('0x11')](function(_0x375da1){if(_0x375da1){return _0x375da1['addTags'](_0x552ab0[_0x46f4('0x1f')][_0x46f4('0x27')],_[_0x46f4('0x28')](_0x552ab0['body'],[_0x46f4('0x27'),'id'])||{});}})[_0x46f4('0x29')](function(_0x450d3f){logger['info']('AddTags',_0x552ab0);logger[_0x46f4('0x15')](_0x46f4('0x2a'),_0x552ab0,JSON[_0x46f4('0x17')](_0x450d3f));_0x546d2b(_0x450d3f);})['catch'](function(_0x2bb1e3){logger[_0x46f4('0x18')]('AddTags',_0x2bb1e3[_0x46f4('0x1a')],_0x552ab0);_0x53ac21(_this['error'](0x1f4,_0x2bb1e3[_0x46f4('0x1a')]));});});}; \ No newline at end of file +var _0x4c8f=['socket.io-emitter','register','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','options','raw','attributes','limit','debug','UpdateMailInteraction','AddTagsToMailInteraction','find','where','addTags','body','ids','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x2446ef,_0x5b42d5){var _0x53e0a9=function(_0xd9637b){while(--_0xd9637b){_0x2446ef['push'](_0x2446ef['shift']());}};_0x53e0a9(++_0x5b42d5);}(_0x4c8f,0x10b));var _0xf4c8=function(_0x447148,_0x33379b){_0x447148=_0x447148-0x0;var _0x3ee5df=_0x4c8f[_0x447148];return _0x3ee5df;};'use strict';var _=require(_0xf4c8('0x0'));var util=require(_0xf4c8('0x1'));var moment=require('moment');var BPromise=require(_0xf4c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4c8('0x3'));var db=require(_0xf4c8('0x4'))['db'];var utils=require(_0xf4c8('0x5'));var logger=require(_0xf4c8('0x6'))(_0xf4c8('0x7'));var config=require(_0xf4c8('0x8'));var jayson=require(_0xf4c8('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xf4c8('0xa')]=_[_0xf4c8('0xb')](config[_0xf4c8('0xa')],{'host':_0xf4c8('0xc'),'port':0x18eb});var socket=require(_0xf4c8('0xd'))(new Redis(config[_0xf4c8('0xa')]));require('./mailInteraction.socket')[_0xf4c8('0xe')](socket);function respondWithRpcPromise(_0x5978a6,_0x45fb7a,_0x1981fc){return new BPromise(function(_0xb07b04,_0x124bf3){return client['request'](_0x5978a6,_0x1981fc)[_0xf4c8('0xf')](function(_0x2798f8){logger[_0xf4c8('0x10')]('MailInteraction,\x20%s,\x20%s',_0x45fb7a,_0xf4c8('0x11'));logger['debug'](_0xf4c8('0x12'),_0x45fb7a,'request\x20sent',JSON[_0xf4c8('0x13')](_0x2798f8));if(_0x2798f8[_0xf4c8('0x14')]){if(_0x2798f8[_0xf4c8('0x14')][_0xf4c8('0x15')]===0x1f4){logger['error'](_0xf4c8('0x16'),_0x45fb7a,_0x2798f8[_0xf4c8('0x14')]['message']);return _0x124bf3(_0x2798f8['error'][_0xf4c8('0x17')]);}logger[_0xf4c8('0x14')](_0xf4c8('0x16'),_0x45fb7a,_0x2798f8[_0xf4c8('0x14')][_0xf4c8('0x17')]);return _0xb07b04(_0x2798f8[_0xf4c8('0x14')][_0xf4c8('0x17')]);}else{logger['info'](_0xf4c8('0x16'),_0x45fb7a,_0xf4c8('0x11'));_0xb07b04(_0x2798f8[_0xf4c8('0x18')][_0xf4c8('0x17')]);}})[_0xf4c8('0x19')](function(_0x19a0bf){logger[_0xf4c8('0x14')](_0xf4c8('0x16'),_0x45fb7a,_0x19a0bf);_0x124bf3(_0x19a0bf);});});}exports['UpdateMailInteraction']=function(_0x3d2786){var _0xe1734b=this;return new Promise(function(_0xb3b00b,_0x340889){return db[_0xf4c8('0x1a')]['update'](_0x3d2786['body'],{'raw':_0x3d2786[_0xf4c8('0x1b')]?_0x3d2786['options'][_0xf4c8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d2786['options']?_0x3d2786['options']['where']||null:null,'attributes':_0x3d2786[_0xf4c8('0x1b')]?_0x3d2786[_0xf4c8('0x1b')][_0xf4c8('0x1d')]||null:null,'limit':_0x3d2786[_0xf4c8('0x1b')]?_0x3d2786[_0xf4c8('0x1b')][_0xf4c8('0x1e')]||null:null})[_0xf4c8('0xf')](function(_0x3ac8d3){logger['info']('UpdateMailInteraction',_0x3d2786);logger[_0xf4c8('0x1f')]('UpdateMailInteraction',_0x3d2786,JSON[_0xf4c8('0x13')](_0x3ac8d3));_0xb3b00b(_0x3ac8d3);})[_0xf4c8('0x19')](function(_0xb624d0){logger['error'](_0xf4c8('0x20'),_0xb624d0['message'],_0x3d2786);_0x340889(_0xe1734b[_0xf4c8('0x14')](0x1f4,_0xb624d0[_0xf4c8('0x17')]));});});};exports[_0xf4c8('0x21')]=function(_0x21d94e){return new Promise(function(_0x4fdaeb,_0x21dcb9){return db[_0xf4c8('0x1a')][_0xf4c8('0x22')]({'where':_0x21d94e['options']?_0x21d94e[_0xf4c8('0x1b')][_0xf4c8('0x23')]||null:null})[_0xf4c8('0xf')](function(_0x1c8ee8){if(_0x1c8ee8){return _0x1c8ee8[_0xf4c8('0x24')](_0x21d94e[_0xf4c8('0x25')][_0xf4c8('0x26')],_['omit'](_0x21d94e[_0xf4c8('0x25')],[_0xf4c8('0x26'),'id'])||{});}})['spread'](function(_0x2380ff){logger[_0xf4c8('0x10')](_0xf4c8('0x27'),_0x21d94e);logger[_0xf4c8('0x1f')](_0xf4c8('0x27'),_0x21d94e,JSON['stringify'](_0x2380ff));_0x4fdaeb(_0x2380ff);})['catch'](function(_0x368f33){logger[_0xf4c8('0x14')](_0xf4c8('0x27'),_0x368f33[_0xf4c8('0x17')],_0x21d94e);_0x21dcb9(_this[_0xf4c8('0x14')](0x1f4,_0x368f33[_0xf4c8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1bf9247..aa7d1be 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 _0xbd64=['length','mailInteraction:','save','remove','update','removeListener','register'];(function(_0x3939ba,_0x438370){var _0x3a20b5=function(_0x15c94b){while(--_0x15c94b){_0x3939ba['push'](_0x3939ba['shift']());}};_0x3a20b5(++_0x438370);}(_0xbd64,0xb1));var _0x4bd6=function(_0x4f1e86,_0x585e4a){_0x4f1e86=_0x4f1e86-0x0;var _0x5aed86=_0xbd64[_0x4f1e86];return _0x5aed86;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x4bd6('0x0'),_0x4bd6('0x1'),_0x4bd6('0x2')];function createListener(_0x531b24,_0x5c5378){return function(_0x23e89e){_0x5c5378['emit'](_0x531b24,_0x23e89e);};}function removeListener(_0x19c1aa,_0x8f1bd3){return function(){MailInteractionEvents[_0x4bd6('0x3')](_0x19c1aa,_0x8f1bd3);};}exports[_0x4bd6('0x4')]=function(_0x55beeb){for(var _0x2cbc11=0x0,_0x117150=events[_0x4bd6('0x5')];_0x2cbc11<_0x117150;_0x2cbc11++){var _0x356675=events[_0x2cbc11];var _0x34cf9c=createListener(_0x4bd6('0x6')+_0x356675,_0x55beeb);MailInteractionEvents['on'](_0x356675,_0x34cf9c);}}; \ No newline at end of file +var _0xf093=['removeListener','register','./mailInteraction.events','save','remove','emit'];(function(_0x26ce63,_0x21ead2){var _0x48ce1=function(_0x4fc8aa){while(--_0x4fc8aa){_0x26ce63['push'](_0x26ce63['shift']());}};_0x48ce1(++_0x21ead2);}(_0xf093,0xaa));var _0x3f09=function(_0x3e57d0,_0x3a586b){_0x3e57d0=_0x3e57d0-0x0;var _0x14f87e=_0xf093[_0x3e57d0];return _0x14f87e;};'use strict';var MailInteractionEvents=require(_0x3f09('0x0'));var events=[_0x3f09('0x1'),_0x3f09('0x2'),'update'];function createListener(_0x3ca55e,_0x516f35){return function(_0x1f1c9e){_0x516f35[_0x3f09('0x3')](_0x3ca55e,_0x1f1c9e);};}function removeListener(_0x59483c,_0x1299b5){return function(){MailInteractionEvents[_0x3f09('0x4')](_0x59483c,_0x1299b5);};}exports[_0x3f09('0x5')]=function(_0x28e5b6){for(var _0x2fae31=0x0,_0x112b23=events['length'];_0x2fae31<_0x112b23;_0x2fae31++){var _0xd70095=events[_0x2fae31];var _0x3174fc=createListener('mailInteraction:'+_0xd70095,_0x28e5b6);MailInteractionEvents['on'](_0xd70095,_0x3174fc);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 22a195a..49b456b 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 _0x5d17=['express','Router','get','/describe','isAuthenticated','exports'];(function(_0x5f410a,_0x15e991){var _0x33f1be=function(_0x2a788d){while(--_0x2a788d){_0x5f410a['push'](_0x5f410a['shift']());}};_0x33f1be(++_0x15e991);}(_0x5d17,0x114));var _0x75d1=function(_0x15449d,_0x537b1d){_0x15449d=_0x15449d-0x0;var _0x55cf8c=_0x5d17[_0x15449d];return _0x55cf8c;};'use strict';var express=require(_0x75d1('0x0'));var router=express[_0x75d1('0x1')]();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router[_0x75d1('0x2')](_0x75d1('0x3'),auth[_0x75d1('0x4')](),controller['describe']);module[_0x75d1('0x5')]=router; \ No newline at end of file +var _0xe861=['/describe','isAuthenticated','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get'];(function(_0x37135e,_0x1879ac){var _0x3ab8f9=function(_0x28089f){while(--_0x28089f){_0x37135e['push'](_0x37135e['shift']());}};_0x3ab8f9(++_0x1879ac);}(_0xe861,0xb3));var _0x1e86=function(_0x503921,_0x40ffe2){_0x503921=_0x503921-0x0;var _0x307628=_0xe861[_0x503921];return _0x307628;};'use strict';var express=require(_0x1e86('0x0'));var router=express[_0x1e86('0x1')]();var auth=require(_0x1e86('0x2'));var controller=require(_0x1e86('0x3'));router[_0x1e86('0x4')](_0x1e86('0x5'),auth[_0x1e86('0x6')](),controller['describe']);module[_0x1e86('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 4451685..9d70f2a 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(_0x486876,_0x5d5ddb){var _0x2506bd=function(_0x2646bc){while(--_0x2646bc){_0x486876['push'](_0x486876['shift']());}};_0x2506bd(++_0x5d5ddb);}(_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 +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x100488,_0x4f9422){var _0x464ce5=function(_0x42cbaa){while(--_0x42cbaa){_0x100488['push'](_0x100488['shift']());}};_0x464ce5(++_0x4f9422);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 4353c3a..ac6de4e 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 _0xb4ed=['INTEGER','sequelize','exports'];(function(_0x4365b5,_0x31cbaf){var _0x3602a5=function(_0x4d0295){while(--_0x4d0295){_0x4365b5['push'](_0x4365b5['shift']());}};_0x3602a5(++_0x31cbaf);}(_0xb4ed,0x18a));var _0xdb4e=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0xb4ed[_0x322522];return _0x293bcf;};'use strict';var Sequelize=require(_0xdb4e('0x0'));module[_0xdb4e('0x1')]={'MailInteractionId':{'type':Sequelize[_0xdb4e('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xdb4e('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x8ebd=['INTEGER','sequelize'];(function(_0x24d06d,_0x392e7b){var _0xaf5708=function(_0x219b1e){while(--_0x219b1e){_0x24d06d['push'](_0x24d06d['shift']());}};_0xaf5708(++_0x392e7b);}(_0x8ebd,0x109));var _0xd8eb=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8ebd[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0xd8eb('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0xd8eb('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xd8eb('0x1')],'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 e23fe07..6156bbf 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 _0x8508=['./mailInteractionHasTag','exports','define','mail_interaction_has_tags'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0x8508,0x120));var _0x8850=function(_0x1c7b8c,_0x427cdf){_0x1c7b8c=_0x1c7b8c-0x0;var _0x4fd5e9=_0x8508[_0x1c7b8c];return _0x4fd5e9;};'use strict';var attributes=require(_0x8850('0x0'));module[_0x8850('0x1')]=function(_0x31adcd){return _0x31adcd[_0x8850('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0x8850('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1fa=['define','mail_interaction_has_tags','exports'];(function(_0x4ac8ef,_0x5c2c6e){var _0x3a9239=function(_0x3d004e){while(--_0x3d004e){_0x4ac8ef['push'](_0x4ac8ef['shift']());}};_0x3a9239(++_0x5c2c6e);}(_0xd1fa,0xc5));var _0xad1f=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xd1fa[_0x8de54f];return _0x14cba4;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0xad1f('0x0')]=function(_0x1dd601){return _0x1dd601[_0xad1f('0x1')]('MailInteractionHasTag',attributes,{'tableName':_0xad1f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 844b740..f897357 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 _0x0cfa=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','show','download','tracked','mail','mailmessage:create','put','/:id','update','/:id/accept','/:id/reject'];(function(_0x21eb60,_0x25cfdb){var _0xf3a77b=function(_0x30a8d4){while(--_0x30a8d4){_0x21eb60['push'](_0x21eb60['shift']());}};_0xf3a77b(++_0x25cfdb);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x141af9,_0x2d080f){_0x141af9=_0x141af9-0x0;var _0x1568d6=_0x0cfa[_0x141af9];return _0x1568d6;};'use strict';var multer=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var path=require(_0xa0cf('0x2'));var timeout=require(_0xa0cf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa0cf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0cf('0x5'));var controller=require(_0xa0cf('0x6'));router[_0xa0cf('0x7')]('/',auth[_0xa0cf('0x8')](),controller['index']);router[_0xa0cf('0x7')]('/describe',auth[_0xa0cf('0x8')](),controller['describe']);router[_0xa0cf('0x7')]('/:id',auth[_0xa0cf('0x8')](),controller[_0xa0cf('0x9')]);router[_0xa0cf('0x7')]('/:id/download',auth[_0xa0cf('0x8')](),controller[_0xa0cf('0xa')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xa0cf('0xb')](_0xa0cf('0xc'),_0xa0cf('0xd')),controller['create']);router[_0xa0cf('0xe')](_0xa0cf('0xf'),auth[_0xa0cf('0x8')](),controller[_0xa0cf('0x10')]);router[_0xa0cf('0xe')](_0xa0cf('0x11'),auth[_0xa0cf('0x8')](),controller['accept']);router[_0xa0cf('0xe')](_0xa0cf('0x12'),auth[_0xa0cf('0x8')](),controller['reject']);router[_0xa0cf('0x13')](_0xa0cf('0xf'),auth[_0xa0cf('0x8')](),controller[_0xa0cf('0x14')]);module[_0xa0cf('0x15')]=router; \ No newline at end of file +var _0x58a4=['reject','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','tracked','mail','create','put','update','/:id/reject'];(function(_0x4df1f5,_0x39c6d2){var _0x56585b=function(_0x287b6e){while(--_0x287b6e){_0x4df1f5['push'](_0x4df1f5['shift']());}};_0x56585b(++_0x39c6d2);}(_0x58a4,0xbf));var _0x458a=function(_0x3198fd,_0x3729d8){_0x3198fd=_0x3198fd-0x0;var _0x2dd0b=_0x58a4[_0x3198fd];return _0x2dd0b;};'use strict';var multer=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var path=require(_0x458a('0x2'));var timeout=require(_0x458a('0x3'));var express=require(_0x458a('0x4'));var router=express[_0x458a('0x5')]();var fs_extra=require(_0x458a('0x6'));var auth=require(_0x458a('0x7'));var interaction=require(_0x458a('0x8'));var config=require(_0x458a('0x9'));var controller=require(_0x458a('0xa'));router[_0x458a('0xb')]('/',auth[_0x458a('0xc')](),controller['index']);router['get'](_0x458a('0xd'),auth[_0x458a('0xc')](),controller[_0x458a('0xe')]);router[_0x458a('0xb')](_0x458a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x458a('0xb')](_0x458a('0x10'),auth[_0x458a('0xc')](),controller[_0x458a('0x11')]);router[_0x458a('0x12')]('/',auth['isAuthenticated'](),interaction[_0x458a('0x13')](_0x458a('0x14'),'mailmessage:create'),controller[_0x458a('0x15')]);router[_0x458a('0x16')](_0x458a('0xf'),auth[_0x458a('0xc')](),controller[_0x458a('0x17')]);router['put']('/:id/accept',auth[_0x458a('0xc')](),controller['accept']);router[_0x458a('0x16')](_0x458a('0x18'),auth[_0x458a('0xc')](),controller[_0x458a('0x19')]);router[_0x458a('0x1a')](_0x458a('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 8186c54..f686ea8 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 _0x21ad=['Email','Chat','sequelize','lodash','exports','TEXT','medium','ENUM','STRING','long','DATE','INTEGER','BOOLEAN'];(function(_0x1dd8a3,_0x109a7d){var _0x402f8e=function(_0x2a6e2b){while(--_0x2a6e2b){_0x1dd8a3['push'](_0x1dd8a3['shift']());}};_0x402f8e(++_0x109a7d);}(_0x21ad,0x161));var _0xd21a=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x21ad[_0x31cb5f];return _0x586042;};'use strict';var Sequelize=require(_0xd21a('0x0'));var _=require(_0xd21a('0x1'));module[_0xd21a('0x2')]={'body':{'type':Sequelize[_0xd21a('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xd21a('0x3')](_0xd21a('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd21a('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd21a('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xd21a('0x3')](_0xd21a('0x7'))},'cc':{'type':Sequelize[_0xd21a('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xd21a('0x7'))},'subject':{'type':Sequelize[_0xd21a('0x3')]},'sentAt':{'type':Sequelize[_0xd21a('0x8')]},'attach':{'type':Sequelize[_0xd21a('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xd21a('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xd21a('0x8')]},'originTo':{'type':Sequelize[_0xd21a('0x3')]('long')},'originCc':{'type':Sequelize[_0xd21a('0x3')](_0xd21a('0x7'))},'originChannel':{'type':Sequelize[_0xd21a('0x5')](_0xd21a('0xb'),_0xd21a('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xe139=['long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','exports','TEXT'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0xe139,0x1eb));var _0x9e13=function(_0x5edf2d,_0x1018a2){_0x5edf2d=_0x5edf2d-0x0;var _0x59433f=_0xe139[_0x5edf2d];return _0x59433f;};'use strict';var Sequelize=require(_0x9e13('0x0'));var _=require('lodash');module[_0x9e13('0x1')]={'body':{'type':Sequelize[_0x9e13('0x2')](_0x9e13('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x9e13('0x4'))},'read':{'type':Sequelize[_0x9e13('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e13('0x6')]('in',_0x9e13('0x7')),'defaultValue':_0x9e13('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x9e13('0x8')]},'to':{'type':Sequelize[_0x9e13('0x2')](_0x9e13('0x3'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x9e13('0x2')](_0x9e13('0x3'))},'subject':{'type':Sequelize[_0x9e13('0x2')]},'sentAt':{'type':Sequelize[_0x9e13('0x9')]},'attach':{'type':Sequelize[_0x9e13('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9e13('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9e13('0x9')]},'originTo':{'type':Sequelize[_0x9e13('0x2')](_0x9e13('0x3'))},'originCc':{'type':Sequelize[_0x9e13('0x2')](_0x9e13('0x3'))},'originChannel':{'type':Sequelize[_0x9e13('0x6')](_0x9e13('0xb'),_0x9e13('0xc')),'defaultValue':_0x9e13('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 83489f2..fabdea4 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 _0xa78f=['Contacts','updatedAt','DESC','MailServerOut','Smtp','attachments','join','root','server/files/attachments','basename','defaults','ListId','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','reject','UserId','user','agent','get','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','fullname','email','internal','interface','channel','event','fromString','EventManager','rejectmessage','download','unix','toString','server','files','tmp','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','util','path','ioredis','../../components/interaction/service','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','html-entities','./mailMessage.socket','register','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','offset','undefined','limit','set','update','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','MailMessage','count','include','show','params','includeAll','options','body','find','destroy','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact'];(function(_0x3f323a,_0x1a6f41){var _0x144ed7=function(_0x1d5872){while(--_0x1d5872){_0x3f323a['push'](_0x3f323a['shift']());}};_0x144ed7(++_0x1a6f41);}(_0xa78f,0xcd));var _0xfa78=function(_0x1b8f87,_0x149cb4){_0x1b8f87=_0x1b8f87-0x0;var _0x35642a=_0xa78f[_0x1b8f87];return _0x35642a;};'use strict';var emlformat=require(_0xfa78('0x0'));var moment=require(_0xfa78('0x1'));var util=require(_0xfa78('0x2'));var path=require(_0xfa78('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xfa78('0x4'));var htmlToText=require('html-to-text');var interactionService=require(_0xfa78('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xfa78('0x6'))('api');var interaction_log=require(_0xfa78('0x6'))(_0xfa78('0x7'));var config=require(_0xfa78('0x8'));var db=require(_0xfa78('0x9'))['db'];config[_0xfa78('0xa')]=_['defaults'](config[_0xfa78('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa78('0xb'))(new Redis(config['redis']));var htmlEntities=require(_0xfa78('0xc'));require(_0xfa78('0xd'))[_0xfa78('0xe')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client'][_0xfa78('0xf')]({'port':0x232b});var client9002=jayson[_0xfa78('0x10')][_0xfa78('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x45efc7,_0x2d08af,_0x5956f1,_0x16eacd){return new Promise(function(_0x3855b5,_0x53735c){var _0x187761=_0x16eacd||client;return _0x187761[_0xfa78('0x11')](_0x45efc7,_0x5956f1)[_0xfa78('0x12')](function(_0xc99d5){logger[_0xfa78('0x13')](_0xfa78('0x14'),_0x2d08af,_0xfa78('0x15'));logger[_0xfa78('0x16')](_0xfa78('0x17'),_0x2d08af,_0xfa78('0x15'),JSON['stringify'](_0xc99d5));if(_0xc99d5[_0xfa78('0x18')]){if(_0xc99d5[_0xfa78('0x18')][_0xfa78('0x19')]===0x1f4){logger[_0xfa78('0x18')](_0xfa78('0x14'),_0x2d08af,_0xc99d5[_0xfa78('0x18')][_0xfa78('0x1a')]);return _0x53735c(_0xc99d5[_0xfa78('0x18')][_0xfa78('0x1a')]);}logger[_0xfa78('0x18')](_0xfa78('0x14'),_0x2d08af,_0xc99d5[_0xfa78('0x18')]['message']);return _0x3855b5(_0xc99d5[_0xfa78('0x18')][_0xfa78('0x1a')]);}else{logger[_0xfa78('0x13')](_0xfa78('0x14'),_0x2d08af,_0xfa78('0x15'));_0x3855b5(_0xc99d5['result'][_0xfa78('0x1a')]);}})[_0xfa78('0x1b')](function(_0x5ee11c){logger['error'](_0xfa78('0x14'),_0x2d08af,_0x5ee11c);_0x53735c(_0x5ee11c);});});}function respondWithResult(_0x2c6a57,_0x48ccb7){_0x48ccb7=_0x48ccb7||0xc8;return function(_0x10bd90){if(_0x10bd90){return _0x2c6a57[_0xfa78('0x1c')](_0x48ccb7)[_0xfa78('0x1d')](_0x10bd90);}};}function respondWithFilteredResult(_0x37a8a7,_0x1ba356){return function(_0xf47c2e){if(_0xf47c2e){var _0x36b2ae=typeof _0x1ba356[_0xfa78('0x1e')]===_0xfa78('0x1f')&&typeof _0x1ba356[_0xfa78('0x20')]==='undefined';var _0x3fc831=_0xf47c2e['count'];var _0xa89ec1=_0x36b2ae?0x0:_0x1ba356[_0xfa78('0x1e')];var _0x3e664d=_0x36b2ae?_0xf47c2e['count']:_0x1ba356[_0xfa78('0x1e')]+_0x1ba356[_0xfa78('0x20')];var _0x50c795;if(_0x3e664d>=_0x3fc831){_0x3e664d=_0x3fc831;_0x50c795=0xc8;}else{_0x50c795=0xce;}_0x37a8a7['status'](_0x50c795);return _0x37a8a7[_0xfa78('0x21')]('Content-Range',_0xa89ec1+'-'+_0x3e664d+'/'+_0x3fc831)[_0xfa78('0x1d')](_0xf47c2e);}return null;};}function saveUpdates(_0x3f4b10){return function(_0x230a94){if(_0x230a94){return _0x230a94[_0xfa78('0x22')](_0x3f4b10)[_0xfa78('0x12')](function(_0x3ebae0){return _0x3ebae0;});}return null;};}function removeEntity(_0x24c75c){return function(_0x27968b){if(_0x27968b){return _0x27968b['destroy']()['then'](function(){_0x24c75c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aa4d0){return function(_0x4d54b5){if(!_0x4d54b5){_0x4aa4d0['sendStatus'](0x194);}return _0x4d54b5;};}function handleError(_0x244858,_0x20576c){_0x20576c=_0x20576c||0x1f4;return function(_0x1c9d01){logger['error'](_0x1c9d01[_0xfa78('0x23')]);if(_0x1c9d01[_0xfa78('0x24')]){delete _0x1c9d01[_0xfa78('0x24')];}_0x244858[_0xfa78('0x1c')](_0x20576c)[_0xfa78('0x25')](_0x1c9d01);};}exports[_0xfa78('0x26')]=function(_0x1409b2,_0x40634a){var _0x3cea19={},_0x54abc0={},_0x51e4de={'count':0x0,'rows':[]};var _0x456967=_[_0xfa78('0x27')](db['MailMessage'][_0xfa78('0x28')],function(_0x43ee51){return{'name':_0x43ee51[_0xfa78('0x29')],'type':_0x43ee51['type'][_0xfa78('0x2a')]};});_0x54abc0[_0xfa78('0x2b')]=_[_0xfa78('0x27')](_0x456967,'name');_0x54abc0[_0xfa78('0x2c')]=_[_0xfa78('0x2d')](_0x1409b2['query']);_0x54abc0[_0xfa78('0x2e')]=_[_0xfa78('0x2f')](_0x54abc0[_0xfa78('0x2b')],_0x54abc0['query']);_0x3cea19[_0xfa78('0x30')]=_[_0xfa78('0x2f')](_0x54abc0['model'],qs[_0xfa78('0x31')](_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x31')]));_0x3cea19[_0xfa78('0x30')]=_0x3cea19['attributes'][_0xfa78('0x32')]?_0x3cea19[_0xfa78('0x30')]:_0x54abc0['model'];if(!_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x33')]('nolimit')){_0x3cea19[_0xfa78('0x20')]=qs[_0xfa78('0x20')](_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x20')]);_0x3cea19[_0xfa78('0x1e')]=qs['offset'](_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x1e')]);}_0x3cea19[_0xfa78('0x34')]=qs['sort'](_0x1409b2['query'][_0xfa78('0x35')]);_0x3cea19[_0xfa78('0x36')]=qs['filters'](_['pick'](_0x1409b2[_0xfa78('0x2c')],_0x54abc0[_0xfa78('0x2e')]),_0x456967);if(_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x37')]){_0x3cea19['where']=_[_0xfa78('0x38')](_0x3cea19['where'],{'$or':_[_0xfa78('0x27')](_0x456967,function(_0x8853d4){if(_0x8853d4[_0xfa78('0x39')]!=='VIRTUAL'){var _0x37118e={};_0x37118e[_0x8853d4[_0xfa78('0x24')]]={'$like':'%'+_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x37')]+'%'};return _0x37118e;}})});}_0x3cea19=_[_0xfa78('0x38')]({},_0x3cea19,_0x1409b2['options']);var _0xc22055={'where':_0x3cea19[_0xfa78('0x36')]};return db[_0xfa78('0x3a')][_0xfa78('0x3b')](_0xc22055)[_0xfa78('0x12')](function(_0x3aabfb){_0x51e4de['count']=_0x3aabfb;if(_0x1409b2[_0xfa78('0x2c')]['includeAll']){_0x3cea19[_0xfa78('0x3c')]=[{'all':!![]}];}return db[_0xfa78('0x3a')]['findAll'](_0x3cea19);})[_0xfa78('0x12')](function(_0x1b8cda){_0x51e4de['rows']=_0x1b8cda;return _0x51e4de;})[_0xfa78('0x12')](respondWithFilteredResult(_0x40634a,_0x3cea19))[_0xfa78('0x1b')](handleError(_0x40634a,null));};exports[_0xfa78('0x3d')]=function(_0x13f144,_0x13df95){var _0x450f82={'raw':!![],'where':{'id':_0x13f144[_0xfa78('0x3e')]['id']}},_0x437e8e={};_0x437e8e['model']=_[_0xfa78('0x2d')](db[_0xfa78('0x3a')][_0xfa78('0x28')]);_0x437e8e[_0xfa78('0x2c')]=_[_0xfa78('0x2d')](_0x13f144[_0xfa78('0x2c')]);_0x437e8e['filters']=_[_0xfa78('0x2f')](_0x437e8e[_0xfa78('0x2b')],_0x437e8e[_0xfa78('0x2c')]);_0x450f82[_0xfa78('0x30')]=_[_0xfa78('0x2f')](_0x437e8e[_0xfa78('0x2b')],qs['fields'](_0x13f144[_0xfa78('0x2c')][_0xfa78('0x31')]));_0x450f82['attributes']=_0x450f82[_0xfa78('0x30')][_0xfa78('0x32')]?_0x450f82[_0xfa78('0x30')]:_0x437e8e[_0xfa78('0x2b')];if(_0x13f144[_0xfa78('0x2c')][_0xfa78('0x3f')]){_0x450f82[_0xfa78('0x3c')]=[{'all':!![]}];}_0x450f82=_[_0xfa78('0x38')]({},_0x450f82,_0x13f144[_0xfa78('0x40')]);return db['MailMessage']['find'](_0x450f82)[_0xfa78('0x12')](handleEntityNotFound(_0x13df95,null))[_0xfa78('0x12')](respondWithResult(_0x13df95,null))[_0xfa78('0x1b')](handleError(_0x13df95,null));};exports[_0xfa78('0x22')]=function(_0x3c70cd,_0x2828ed){if(_0x3c70cd[_0xfa78('0x41')]['id']){delete _0x3c70cd[_0xfa78('0x41')]['id'];}return db['MailMessage'][_0xfa78('0x42')]({'where':{'id':_0x3c70cd[_0xfa78('0x3e')]['id']}})[_0xfa78('0x12')](handleEntityNotFound(_0x2828ed,null))['then'](saveUpdates(_0x3c70cd['body'],null))[_0xfa78('0x12')](respondWithResult(_0x2828ed,null))[_0xfa78('0x1b')](handleError(_0x2828ed,null));};exports[_0xfa78('0x43')]=function(_0x3ab901,_0x4f5cd1){return db[_0xfa78('0x3a')][_0xfa78('0x42')]({'where':{'id':_0x3ab901['params']['id']}})[_0xfa78('0x12')](handleEntityNotFound(_0x4f5cd1,null))['then'](removeEntity(_0x4f5cd1,null))['catch'](handleError(_0x4f5cd1,null));};exports['describe']=function(_0x29c1ed,_0xe715cc){return db['MailMessage'][_0xfa78('0x44')]()[_0xfa78('0x12')](respondWithResult(_0xe715cc,null))[_0xfa78('0x1b')](handleError(_0xe715cc,null));};exports[_0xfa78('0x45')]=function(_0x1901fe,_0x3816a1){return db['MailMessage'][_0xfa78('0x45')](_0x1901fe[_0xfa78('0x41')])[_0xfa78('0x12')](function(_0xd6292){if(_0xd6292){if(_0xd6292[_0xfa78('0x46')]===_0xfa78('0x47')&&!_0xd6292[_0xfa78('0x48')]){var _0x3b98e7,_0x5181d3,_0x48b698;if(_0x1901fe[_0xfa78('0x41')]['to']){_0x5181d3=_0x1901fe[_0xfa78('0x41')]['to'][_0xfa78('0x49')](',')[0x0];}return db[_0xfa78('0x4a')]['findOne']({'where':{'id':_0xd6292[_0xfa78('0x4b')]},'include':[{'model':db[_0xfa78('0x4c')],'as':_0xfa78('0x4d'),'include':[{'model':db[_0xfa78('0x4e')],'as':_0xfa78('0x4f'),'where':{'email':_0x5181d3},'limit':0x1,'order':[[_0xfa78('0x50'),_0xfa78('0x51')]]}]},{'model':db[_0xfa78('0x52')],'as':_0xfa78('0x53'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x56e20f){_0x3b98e7=_0x56e20f;if(!_0x3b98e7||!_0x3b98e7[_0xfa78('0x53')])return;var _0x12449b=_0x3b98e7['getSmtpOptions']();if(_0x1901fe[_0xfa78('0x41')][_0xfa78('0x54')]&&_0x1901fe[_0xfa78('0x41')][_0xfa78('0x54')][_0xfa78('0x32')]){for(var _0x3536f2=0x0;_0x3536f2<_0x1901fe[_0xfa78('0x41')]['attachments'][_0xfa78('0x32')];_0x3536f2+=0x1){_0x1901fe[_0xfa78('0x41')][_0xfa78('0x54')][_0x3536f2]={'filename':_0x1901fe['body'][_0xfa78('0x54')][_0x3536f2][_0xfa78('0x24')],'path':path[_0xfa78('0x55')](config[_0xfa78('0x56')],_0xfa78('0x57'),_0x1901fe[_0xfa78('0x41')][_0xfa78('0x54')][_0x3536f2][_0xfa78('0x58')])};}}_0x48b698={'account':_0x12449b,'message':_0x1901fe[_0xfa78('0x41')]};return;})[_0xfa78('0x12')](function(){if(_0x3b98e7['List']){if(_0x3b98e7[_0xfa78('0x4d')][_0xfa78('0x4f')][_0xfa78('0x32')]){return _0x3b98e7[_0xfa78('0x4d')]['Contacts'][0x0];}else{return db[_0xfa78('0x4e')][_0xfa78('0x45')](_[_0xfa78('0x59')](_0x1901fe[_0xfa78('0x41')],{'firstName':_0x1901fe[_0xfa78('0x41')]['to'],'email':_0x1901fe[_0xfa78('0x41')]['to'],'phone':_0x1901fe[_0xfa78('0x41')]['to'],'ListId':_0x3b98e7[_0xfa78('0x5a')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xfa78('0x12')](function(){if(_0x48b698){return respondWithRpcPromise(_0xfa78('0x5b'),_0xfa78('0x5c'),_0x48b698,client9003)['then'](function(_0x4f2b90){return _0xd6292[_0xfa78('0x22')]({'read':!![],'messageId':_0x4f2b90['messageId'],'sentAt':moment()[_0xfa78('0x5d')](_0xfa78('0x5e'))});})['catch'](function(_0x18cdb){logger[_0xfa78('0x18')]('%s',JSON['stringify'](_0x18cdb));return _0xd6292;});}return _0xd6292;});}return _0xd6292;}})[_0xfa78('0x12')](respondWithResult(_0x3816a1,0xc9))[_0xfa78('0x1b')](handleError(_0x3816a1,null));};exports[_0xfa78('0x5f')]=function(_0x5f00a6,_0x3bdbfd){var _0x39ca27=_0xfa78('0x60');return interactionService[_0xfa78('0x61')](_0x5f00a6,_0x39ca27)[_0xfa78('0x12')](respondWithResult(_0x3bdbfd,null))[_0xfa78('0x1b')](handleError(_0x3bdbfd,null));};exports[_0xfa78('0x62')]=function(_0x31f03f,_0x25c4b7){var _0xf486ca={'agent':{},'channel':_0xfa78('0x60')};if(_0x31f03f[_0xfa78('0x41')]['id']){delete _0x31f03f['body']['id'];}_0x31f03f[_0xfa78('0x41')]['UserId']=_0x31f03f[_0xfa78('0x41')][_0xfa78('0x63')]||_0x31f03f[_0xfa78('0x64')]['id'];_0xf486ca[_0xfa78('0x65')]['id']=_0x31f03f[_0xfa78('0x41')]['UserId'];return db[_0xfa78('0x3a')][_0xfa78('0x42')]({'where':{'id':_0x31f03f[_0xfa78('0x3e')]['id'],'UserId':null}})[_0xfa78('0x12')](handleEntityNotFound(_0x25c4b7,null))[_0xfa78('0x12')](function(_0x416d56){if(_0x416d56){_0xf486ca['message']=_0x416d56[_0xfa78('0x66')]({'plain':!![]});return db['MailInteraction'][_0xfa78('0x42')]({'where':{'id':_0x416d56[_0xfa78('0x67')]}});}return null;})[_0xfa78('0x12')](handleEntityNotFound(_0x25c4b7,null))[_0xfa78('0x12')](function(_0x2ac86c){if(_0x2ac86c){_0xf486ca['interaction']=_0x2ac86c[_0xfa78('0x66')]({'plain':!![]});interaction_log[_0xfa78('0x13')](_0xfa78('0x68'),_0x31f03f[_0xfa78('0x64')]['id'],_0x31f03f['user'][_0xfa78('0x24')],_0x31f03f[_0xfa78('0x64')][_0xfa78('0x69')],_0xf486ca[_0xfa78('0x6a')]['id'],_0x31f03f[_0xfa78('0x41')]?JSON[_0xfa78('0x6b')](_0x31f03f[_0xfa78('0x41')]):'null');return respondWithRpcPromise('RejectMessage',_0xfa78('0x6c'),_0xf486ca);}return null;})['then'](function(_0x1ed7d7){var _0x2f1074=_0xfa78('0x6d')+_0x1ed7d7[_0xfa78('0x1a')][_0xfa78('0x6e')];return db[_0xfa78('0x6f')]['query'](_0x2f1074,{'type':db[_0xfa78('0x70')]['QueryTypes'][_0xfa78('0x71')],'raw':!![]})[_0xfa78('0x12')](function(_0x207030){return _0x207030;});})[_0xfa78('0x12')](function(_0x54bdee){if(_0x54bdee){_0xf486ca['message']['contact']=_0x54bdee[0x0];if(!_0x31f03f[_0xfa78('0x41')][_0xfa78('0x63')])return;return db['User'][_0xfa78('0x42')]({'where':{'id':_0x31f03f[_0xfa78('0x41')][_0xfa78('0x63')],'role':_0xfa78('0x65')},'attributes':['id','name',_0xfa78('0x72'),_0xfa78('0x73'),_0xfa78('0x74')],'raw':!![]});}return null;})[_0xfa78('0x12')](function(_0x26cc7a){if(!_0x26cc7a)return null;_0xf486ca[_0xfa78('0x1a')][_0xfa78('0x65')]=_0x26cc7a;return _0xf486ca;})[_0xfa78('0x12')](function(_0x57589f){if(_0x57589f){_0x57589f[_0xfa78('0x1a')][_0xfa78('0x75')]=util[_0xfa78('0x5d')]('SIP/%s',_0x31f03f[_0xfa78('0x64')][_0xfa78('0x24')]);_0x57589f['message']['channel']=_0xf486ca[_0xfa78('0x76')];_0x57589f[_0xfa78('0x1a')]['motionChannel']=_0xf486ca[_0xfa78('0x76')];_0x57589f[_0xfa78('0x1a')][_0xfa78('0x77')]=_0xfa78('0x62');_0x57589f[_0xfa78('0x1a')][_0xfa78('0x41')]=htmlToText[_0xfa78('0x78')](_0xf486ca[_0xfa78('0x1a')][_0xfa78('0x41')]);respondWithRpcPromise(_0xfa78('0x79'),'EventManager',{'event':_0xfa78('0x7a'),'message':_0x57589f[_0xfa78('0x1a')]},client9002);return _0xf486ca;}return null;})[_0xfa78('0x12')](respondWithResult(_0x25c4b7,null))[_0xfa78('0x1b')](handleError(_0x25c4b7,null));};exports[_0xfa78('0x7b')]=function(_0x3ff3d9,_0x4bdf7a){var _0x42a2c7=moment()[_0xfa78('0x7c')]()[_0xfa78('0x7d')]();var _0x5b02ae=path[_0xfa78('0x55')](config[_0xfa78('0x56')],_0xfa78('0x7e'),_0xfa78('0x7f'),_0xfa78('0x80'));var _0x3264fb=path[_0xfa78('0x55')](config[_0xfa78('0x56')],_0xfa78('0x7e'),_0xfa78('0x7f'),_0xfa78('0x54'));var _0x1c120a=util[_0xfa78('0x5d')]('message-%s.eml',_0x42a2c7);return db['MailMessage']['find']({'where':{'id':_0x3ff3d9['params']['id']},'attributes':['id',_0xfa78('0x41'),_0xfa78('0x81'),'to','cc',_0xfa78('0x82'),_0xfa78('0x83'),_0xfa78('0x84')],'include':_0x3ff3d9[_0xfa78('0x2c')]['attachments']?[{'model':db[_0xfa78('0x85')],'as':_0xfa78('0x86')}]:undefined})[_0xfa78('0x12')](handleEntityNotFound(_0x4bdf7a,null))['then'](function(_0x1bc068){if(_0x1bc068){var _0x2776db=_0x1bc068;var _0x2084ae={'from':_0x2776db[_0xfa78('0x81')],'to':_0x2776db['to'],'subject':_0x2776db['subject'],'html':htmlEntities[_0xfa78('0x87')](_0x2776db['body']),'headers':{'Date':moment(_0x2776db[_0xfa78('0x84')])[_0xfa78('0x5d')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1bc068['cc']){_0x2084ae[_0xfa78('0x88')]['Cc']=_0x1bc068['cc'];}if(_0x1bc068[_0xfa78('0x82')]){_0x2084ae[_0xfa78('0x88')]['Bcc']=_0x1bc068['bcc'];}return new Promise(function(_0x49f38c,_0x3138d2){if(_0x1bc068['Attachments']){for(var _0x454e09=0x0;_0x454e09<_0x1bc068[_0xfa78('0x86')][_0xfa78('0x32')];_0x454e09++){var _0x453d7c=_0x1bc068[_0xfa78('0x86')][_0x454e09];var _0x4d2d82=path[_0xfa78('0x55')](_0x3264fb,_0x453d7c[_0xfa78('0x58')]);if(fs[_0xfa78('0x89')](_0x4d2d82)){_0x2084ae[_0xfa78('0x54')][_0xfa78('0x8a')]({'name':_0x453d7c['name'],'contentType':_0x453d7c['type'],'data':fs[_0xfa78('0x8b')](_0x4d2d82)});}}}emlformat['build'](_0x2084ae,function(_0x3c64f4,_0x1788b3){if(_0x3c64f4)return _0x3138d2(_0x3c64f4);fs[_0xfa78('0x8c')](path['join'](_0x5b02ae,_0x1c120a),_0x1788b3);return _0x49f38c(_0x1788b3);});});}})[_0xfa78('0x12')](function(_0x442f4d){if(_0x442f4d){return _0x4bdf7a['download'](path[_0xfa78('0x55')](_0x5b02ae,_0x1c120a),_0x1c120a,function(_0x47d51b){if(!_0x47d51b)fs[_0xfa78('0x8d')](path[_0xfa78('0x55')](_0x5b02ae,_0x1c120a));});}})['catch'](handleError(_0x4bdf7a,null));}; \ No newline at end of file +var _0x9d27=['subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','build','unlinkSync','eml-format','moment','util','../../components/interaction/service','api','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus','name','status','index','map','MailMessage','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','params','keys','rawAttributes','includeAll','options','find','body','destroy','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','messageId','format','accept','mail','acceptMessage','reject','UserId','agent','get','MailInteractionId','interaction','user','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','bcc'];(function(_0x40d0a3,_0x2977d0){var _0x546309=function(_0x43383f){while(--_0x43383f){_0x40d0a3['push'](_0x40d0a3['shift']());}};_0x546309(++_0x2977d0);}(_0x9d27,0x9c));var _0x79d2=function(_0x43bd62,_0x107420){_0x43bd62=_0x43bd62-0x0;var _0x22321c=_0x9d27[_0x43bd62];return _0x22321c;};'use strict';var emlformat=require(_0x79d2('0x0'));var moment=require(_0x79d2('0x1'));var util=require(_0x79d2('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require('html-to-text');var interactionService=require(_0x79d2('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x79d2('0x4'));var interaction_log=require(_0x79d2('0x5'))('mail-interactions');var config=require('../../config/environment');var db=require(_0x79d2('0x6'))['db'];config[_0x79d2('0x7')]=_[_0x79d2('0x8')](config['redis'],{'host':_0x79d2('0x9'),'port':0x18eb});var socket=require(_0x79d2('0xa'))(new Redis(config[_0x79d2('0x7')]));var htmlEntities=require(_0x79d2('0xb'));require('./mailMessage.socket')[_0x79d2('0xc')](socket);var jayson=require(_0x79d2('0xd'));var client=jayson[_0x79d2('0xe')][_0x79d2('0xf')]({'port':0x232c});var client9003=jayson['client'][_0x79d2('0xf')]({'port':0x232b});var client9002=jayson[_0x79d2('0xe')][_0x79d2('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x14c0b0,_0x185996,_0x3cf47b,_0x12b2ee){return new Promise(function(_0xbc24c3,_0x186bd6){var _0x2cfac0=_0x12b2ee||client;return _0x2cfac0[_0x79d2('0x10')](_0x14c0b0,_0x3cf47b)[_0x79d2('0x11')](function(_0x2cf106){logger[_0x79d2('0x12')]('MailMessage,\x20%s,\x20%s',_0x185996,_0x79d2('0x13'));logger[_0x79d2('0x14')](_0x79d2('0x15'),_0x185996,'request\x20sent',JSON[_0x79d2('0x16')](_0x2cf106));if(_0x2cf106[_0x79d2('0x17')]){if(_0x2cf106[_0x79d2('0x17')][_0x79d2('0x18')]===0x1f4){logger[_0x79d2('0x17')](_0x79d2('0x19'),_0x185996,_0x2cf106[_0x79d2('0x17')][_0x79d2('0x1a')]);return _0x186bd6(_0x2cf106[_0x79d2('0x17')][_0x79d2('0x1a')]);}logger[_0x79d2('0x17')](_0x79d2('0x19'),_0x185996,_0x2cf106[_0x79d2('0x17')][_0x79d2('0x1a')]);return _0xbc24c3(_0x2cf106['error'][_0x79d2('0x1a')]);}else{logger['info'](_0x79d2('0x19'),_0x185996,'request\x20sent');_0xbc24c3(_0x2cf106[_0x79d2('0x1b')][_0x79d2('0x1a')]);}})[_0x79d2('0x1c')](function(_0x1c7b22){logger[_0x79d2('0x17')]('MailMessage,\x20%s,\x20%s',_0x185996,_0x1c7b22);_0x186bd6(_0x1c7b22);});});}function respondWithResult(_0x30539a,_0x2f2f60){_0x2f2f60=_0x2f2f60||0xc8;return function(_0x5bdb29){if(_0x5bdb29){return _0x30539a['status'](_0x2f2f60)['json'](_0x5bdb29);}};}function respondWithFilteredResult(_0x41c9ab,_0x4e8d26){return function(_0x4437eb){if(_0x4437eb){var _0x176e68=typeof _0x4e8d26[_0x79d2('0x1d')]===_0x79d2('0x1e')&&typeof _0x4e8d26[_0x79d2('0x1f')]===_0x79d2('0x1e');var _0x5a15d4=_0x4437eb[_0x79d2('0x20')];var _0x338e43=_0x176e68?0x0:_0x4e8d26[_0x79d2('0x1d')];var _0x1f8b8d=_0x176e68?_0x4437eb[_0x79d2('0x20')]:_0x4e8d26[_0x79d2('0x1d')]+_0x4e8d26[_0x79d2('0x1f')];var _0x1af8ec;if(_0x1f8b8d>=_0x5a15d4){_0x1f8b8d=_0x5a15d4;_0x1af8ec=0xc8;}else{_0x1af8ec=0xce;}_0x41c9ab['status'](_0x1af8ec);return _0x41c9ab[_0x79d2('0x21')](_0x79d2('0x22'),_0x338e43+'-'+_0x1f8b8d+'/'+_0x5a15d4)['json'](_0x4437eb);}return null;};}function saveUpdates(_0x253bf2){return function(_0x509750){if(_0x509750){return _0x509750[_0x79d2('0x23')](_0x253bf2)['then'](function(_0x3cf2fe){return _0x3cf2fe;});}return null;};}function removeEntity(_0x1d9f6c){return function(_0x34f80c){if(_0x34f80c){return _0x34f80c['destroy']()[_0x79d2('0x11')](function(){_0x1d9f6c['status'](0xcc)[_0x79d2('0x24')]();});}};}function handleEntityNotFound(_0x1ad9cf){return function(_0x4fcb78){if(!_0x4fcb78){_0x1ad9cf[_0x79d2('0x25')](0x194);}return _0x4fcb78;};}function handleError(_0x464ace,_0x3d8136){_0x3d8136=_0x3d8136||0x1f4;return function(_0x40fa15){logger[_0x79d2('0x17')](_0x40fa15['stack']);if(_0x40fa15[_0x79d2('0x26')]){delete _0x40fa15['name'];}_0x464ace[_0x79d2('0x27')](_0x3d8136)['send'](_0x40fa15);};}exports[_0x79d2('0x28')]=function(_0x64491d,_0x3e1796){var _0x4bfff7={},_0x732d9d={},_0x675198={'count':0x0,'rows':[]};var _0x5e5095=_[_0x79d2('0x29')](db[_0x79d2('0x2a')]['rawAttributes'],function(_0x157e24){return{'name':_0x157e24[_0x79d2('0x2b')],'type':_0x157e24[_0x79d2('0x2c')][_0x79d2('0x2d')]};});_0x732d9d[_0x79d2('0x2e')]=_[_0x79d2('0x29')](_0x5e5095,_0x79d2('0x26'));_0x732d9d[_0x79d2('0x2f')]=_['keys'](_0x64491d[_0x79d2('0x2f')]);_0x732d9d[_0x79d2('0x30')]=_[_0x79d2('0x31')](_0x732d9d[_0x79d2('0x2e')],_0x732d9d[_0x79d2('0x2f')]);_0x4bfff7['attributes']=_[_0x79d2('0x31')](_0x732d9d['model'],qs['fields'](_0x64491d[_0x79d2('0x2f')][_0x79d2('0x32')]));_0x4bfff7['attributes']=_0x4bfff7[_0x79d2('0x33')][_0x79d2('0x34')]?_0x4bfff7[_0x79d2('0x33')]:_0x732d9d[_0x79d2('0x2e')];if(!_0x64491d['query'][_0x79d2('0x35')](_0x79d2('0x36'))){_0x4bfff7[_0x79d2('0x1f')]=qs[_0x79d2('0x1f')](_0x64491d[_0x79d2('0x2f')][_0x79d2('0x1f')]);_0x4bfff7['offset']=qs[_0x79d2('0x1d')](_0x64491d[_0x79d2('0x2f')]['offset']);}_0x4bfff7[_0x79d2('0x37')]=qs[_0x79d2('0x38')](_0x64491d[_0x79d2('0x2f')][_0x79d2('0x38')]);_0x4bfff7['where']=qs[_0x79d2('0x30')](_[_0x79d2('0x39')](_0x64491d[_0x79d2('0x2f')],_0x732d9d['filters']),_0x5e5095);if(_0x64491d[_0x79d2('0x2f')][_0x79d2('0x3a')]){_0x4bfff7[_0x79d2('0x3b')]=_[_0x79d2('0x3c')](_0x4bfff7[_0x79d2('0x3b')],{'$or':_[_0x79d2('0x29')](_0x5e5095,function(_0x5453d8){if(_0x5453d8['type']!=='VIRTUAL'){var _0x475fec={};_0x475fec[_0x5453d8[_0x79d2('0x26')]]={'$like':'%'+_0x64491d[_0x79d2('0x2f')][_0x79d2('0x3a')]+'%'};return _0x475fec;}})});}_0x4bfff7=_[_0x79d2('0x3c')]({},_0x4bfff7,_0x64491d['options']);var _0x515412={'where':_0x4bfff7['where']};return db[_0x79d2('0x2a')][_0x79d2('0x20')](_0x515412)['then'](function(_0xfa891b){_0x675198[_0x79d2('0x20')]=_0xfa891b;if(_0x64491d[_0x79d2('0x2f')]['includeAll']){_0x4bfff7[_0x79d2('0x3d')]=[{'all':!![]}];}return db[_0x79d2('0x2a')][_0x79d2('0x3e')](_0x4bfff7);})[_0x79d2('0x11')](function(_0x196930){_0x675198[_0x79d2('0x3f')]=_0x196930;return _0x675198;})['then'](respondWithFilteredResult(_0x3e1796,_0x4bfff7))['catch'](handleError(_0x3e1796,null));};exports['show']=function(_0x3a4afa,_0xe34997){var _0x24d507={'raw':!![],'where':{'id':_0x3a4afa[_0x79d2('0x40')]['id']}},_0x552ae5={};_0x552ae5[_0x79d2('0x2e')]=_[_0x79d2('0x41')](db[_0x79d2('0x2a')][_0x79d2('0x42')]);_0x552ae5['query']=_[_0x79d2('0x41')](_0x3a4afa[_0x79d2('0x2f')]);_0x552ae5['filters']=_['intersection'](_0x552ae5[_0x79d2('0x2e')],_0x552ae5[_0x79d2('0x2f')]);_0x24d507[_0x79d2('0x33')]=_[_0x79d2('0x31')](_0x552ae5[_0x79d2('0x2e')],qs[_0x79d2('0x32')](_0x3a4afa[_0x79d2('0x2f')][_0x79d2('0x32')]));_0x24d507[_0x79d2('0x33')]=_0x24d507[_0x79d2('0x33')]['length']?_0x24d507['attributes']:_0x552ae5[_0x79d2('0x2e')];if(_0x3a4afa[_0x79d2('0x2f')][_0x79d2('0x43')]){_0x24d507[_0x79d2('0x3d')]=[{'all':!![]}];}_0x24d507=_[_0x79d2('0x3c')]({},_0x24d507,_0x3a4afa[_0x79d2('0x44')]);return db[_0x79d2('0x2a')][_0x79d2('0x45')](_0x24d507)[_0x79d2('0x11')](handleEntityNotFound(_0xe34997,null))[_0x79d2('0x11')](respondWithResult(_0xe34997,null))[_0x79d2('0x1c')](handleError(_0xe34997,null));};exports[_0x79d2('0x23')]=function(_0x2a6385,_0x22ec88){if(_0x2a6385[_0x79d2('0x46')]['id']){delete _0x2a6385[_0x79d2('0x46')]['id'];}return db[_0x79d2('0x2a')]['find']({'where':{'id':_0x2a6385[_0x79d2('0x40')]['id']}})[_0x79d2('0x11')](handleEntityNotFound(_0x22ec88,null))[_0x79d2('0x11')](saveUpdates(_0x2a6385[_0x79d2('0x46')],null))[_0x79d2('0x11')](respondWithResult(_0x22ec88,null))['catch'](handleError(_0x22ec88,null));};exports[_0x79d2('0x47')]=function(_0x265031,_0x3d80ae){return db[_0x79d2('0x2a')][_0x79d2('0x45')]({'where':{'id':_0x265031[_0x79d2('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d80ae,null))[_0x79d2('0x11')](removeEntity(_0x3d80ae,null))[_0x79d2('0x1c')](handleError(_0x3d80ae,null));};exports[_0x79d2('0x48')]=function(_0x4ccdd1,_0x1a8e20){return db[_0x79d2('0x2a')][_0x79d2('0x48')]()['then'](respondWithResult(_0x1a8e20,null))[_0x79d2('0x1c')](handleError(_0x1a8e20,null));};exports[_0x79d2('0x49')]=function(_0x1152d3,_0x10186){return db[_0x79d2('0x2a')][_0x79d2('0x49')](_0x1152d3[_0x79d2('0x46')])[_0x79d2('0x11')](function(_0xdaf4e6){if(_0xdaf4e6){if(_0xdaf4e6[_0x79d2('0x4a')]==='out'&&!_0xdaf4e6[_0x79d2('0x4b')]){var _0x3881ee,_0x5ac246,_0x473745;if(_0x1152d3[_0x79d2('0x46')]['to']){_0x5ac246=_0x1152d3[_0x79d2('0x46')]['to'][_0x79d2('0x4c')](',')[0x0];}return db[_0x79d2('0x4d')][_0x79d2('0x4e')]({'where':{'id':_0xdaf4e6[_0x79d2('0x4f')]},'include':[{'model':db['CmList'],'as':_0x79d2('0x50'),'include':[{'model':db[_0x79d2('0x51')],'as':_0x79d2('0x52'),'where':{'email':_0x5ac246},'limit':0x1,'order':[[_0x79d2('0x53'),_0x79d2('0x54')]]}]},{'model':db[_0x79d2('0x55')],'as':_0x79d2('0x56'),'raw':!![],'include':[{'model':db[_0x79d2('0x57')],'as':_0x79d2('0x57'),'raw':!![]}]}]})['then'](function(_0x47145a){_0x3881ee=_0x47145a;if(!_0x3881ee||!_0x3881ee[_0x79d2('0x56')])return;var _0x38ffe9=_0x3881ee[_0x79d2('0x58')]();if(_0x1152d3['body'][_0x79d2('0x59')]&&_0x1152d3['body']['attachments'][_0x79d2('0x34')]){for(var _0x385553=0x0;_0x385553<_0x1152d3['body'][_0x79d2('0x59')][_0x79d2('0x34')];_0x385553+=0x1){_0x1152d3['body'][_0x79d2('0x59')][_0x385553]={'filename':_0x1152d3['body']['attachments'][_0x385553][_0x79d2('0x26')],'path':path[_0x79d2('0x5a')](config[_0x79d2('0x5b')],_0x79d2('0x5c'),_0x1152d3[_0x79d2('0x46')][_0x79d2('0x59')][_0x385553][_0x79d2('0x5d')])};}}_0x473745={'account':_0x38ffe9,'message':_0x1152d3['body']};return;})[_0x79d2('0x11')](function(){if(_0x3881ee[_0x79d2('0x50')]){if(_0x3881ee[_0x79d2('0x50')][_0x79d2('0x52')][_0x79d2('0x34')]){return _0x3881ee[_0x79d2('0x50')][_0x79d2('0x52')][0x0];}else{return db['CmContact']['create'](_[_0x79d2('0x8')](_0x1152d3['body'],{'firstName':_0x1152d3[_0x79d2('0x46')]['to'],'email':_0x1152d3[_0x79d2('0x46')]['to'],'phone':_0x1152d3[_0x79d2('0x46')]['to'],'ListId':_0x3881ee[_0x79d2('0x5e')]}));}}else{throw new Error(_0x79d2('0x5f'));}})['then'](function(){if(_0x473745){return respondWithRpcPromise('SendMail',_0x79d2('0x60'),_0x473745,client9003)[_0x79d2('0x11')](function(_0x362a9f){return _0xdaf4e6['update']({'read':!![],'messageId':_0x362a9f[_0x79d2('0x61')],'sentAt':moment()[_0x79d2('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x79d2('0x1c')](function(_0x19c764){logger[_0x79d2('0x17')]('%s',JSON[_0x79d2('0x16')](_0x19c764));return _0xdaf4e6;});}return _0xdaf4e6;});}return _0xdaf4e6;}})[_0x79d2('0x11')](respondWithResult(_0x10186,0xc9))[_0x79d2('0x1c')](handleError(_0x10186,null));};exports[_0x79d2('0x63')]=function(_0x1272a8,_0x53c92e){var _0x3ff86d=_0x79d2('0x64');return interactionService[_0x79d2('0x65')](_0x1272a8,_0x3ff86d)[_0x79d2('0x11')](respondWithResult(_0x53c92e,null))[_0x79d2('0x1c')](handleError(_0x53c92e,null));};exports[_0x79d2('0x66')]=function(_0x3bedbe,_0x12489b){var _0x277e59={'agent':{},'channel':_0x79d2('0x64')};if(_0x3bedbe[_0x79d2('0x46')]['id']){delete _0x3bedbe[_0x79d2('0x46')]['id'];}_0x3bedbe[_0x79d2('0x46')][_0x79d2('0x67')]=_0x3bedbe['body']['UserId']||_0x3bedbe['user']['id'];_0x277e59[_0x79d2('0x68')]['id']=_0x3bedbe['body'][_0x79d2('0x67')];return db[_0x79d2('0x2a')][_0x79d2('0x45')]({'where':{'id':_0x3bedbe['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x12489b,null))[_0x79d2('0x11')](function(_0x42e313){if(_0x42e313){_0x277e59[_0x79d2('0x1a')]=_0x42e313[_0x79d2('0x69')]({'plain':!![]});return db['MailInteraction'][_0x79d2('0x45')]({'where':{'id':_0x42e313[_0x79d2('0x6a')]}});}return null;})[_0x79d2('0x11')](handleEntityNotFound(_0x12489b,null))['then'](function(_0x30ee7e){if(_0x30ee7e){_0x277e59[_0x79d2('0x6b')]=_0x30ee7e[_0x79d2('0x69')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3bedbe[_0x79d2('0x6c')]['id'],_0x3bedbe['user']['name'],_0x3bedbe['user']['role'],_0x277e59[_0x79d2('0x6b')]['id'],_0x3bedbe[_0x79d2('0x46')]?JSON[_0x79d2('0x16')](_0x3bedbe[_0x79d2('0x46')]):_0x79d2('0x6d'));return respondWithRpcPromise(_0x79d2('0x6e'),_0x79d2('0x6f'),_0x277e59);}return null;})[_0x79d2('0x11')](function(_0x25ea5d){var _0x38c95e=_0x79d2('0x70')+_0x25ea5d[_0x79d2('0x1a')][_0x79d2('0x71')];return db[_0x79d2('0x72')][_0x79d2('0x2f')](_0x38c95e,{'type':db[_0x79d2('0x73')][_0x79d2('0x74')][_0x79d2('0x75')],'raw':!![]})[_0x79d2('0x11')](function(_0x72f53c){return _0x72f53c;});})[_0x79d2('0x11')](function(_0x3ba39a){if(_0x3ba39a){_0x277e59['message']['contact']=_0x3ba39a[0x0];if(!_0x3bedbe[_0x79d2('0x46')][_0x79d2('0x67')])return;return db[_0x79d2('0x76')][_0x79d2('0x45')]({'where':{'id':_0x3bedbe[_0x79d2('0x46')][_0x79d2('0x67')],'role':_0x79d2('0x68')},'attributes':['id',_0x79d2('0x26'),'fullname',_0x79d2('0x77'),_0x79d2('0x78')],'raw':!![]});}return null;})[_0x79d2('0x11')](function(_0x567046){if(!_0x567046)return null;_0x277e59['message'][_0x79d2('0x68')]=_0x567046;return _0x277e59;})[_0x79d2('0x11')](function(_0x22e5b4){if(_0x22e5b4){_0x22e5b4[_0x79d2('0x1a')][_0x79d2('0x79')]=util[_0x79d2('0x62')](_0x79d2('0x7a'),_0x3bedbe[_0x79d2('0x6c')][_0x79d2('0x26')]);_0x22e5b4[_0x79d2('0x1a')][_0x79d2('0x7b')]=_0x277e59['channel'];_0x22e5b4[_0x79d2('0x1a')][_0x79d2('0x7c')]=_0x277e59[_0x79d2('0x7b')];_0x22e5b4['message'][_0x79d2('0x7d')]=_0x79d2('0x66');_0x22e5b4[_0x79d2('0x1a')][_0x79d2('0x46')]=htmlToText['fromString'](_0x277e59[_0x79d2('0x1a')][_0x79d2('0x46')]);respondWithRpcPromise(_0x79d2('0x7e'),_0x79d2('0x7e'),{'event':_0x79d2('0x7f'),'message':_0x22e5b4[_0x79d2('0x1a')]},client9002);return _0x277e59;}return null;})[_0x79d2('0x11')](respondWithResult(_0x12489b,null))[_0x79d2('0x1c')](handleError(_0x12489b,null));};exports[_0x79d2('0x80')]=function(_0x24f31c,_0x4ae241){var _0x2b54ce=moment()[_0x79d2('0x81')]()[_0x79d2('0x82')]();var _0x5bb067=path[_0x79d2('0x5a')](config[_0x79d2('0x5b')],_0x79d2('0x83'),_0x79d2('0x84'),_0x79d2('0x85'));var _0x41f84d=path['join'](config['root'],_0x79d2('0x83'),_0x79d2('0x84'),_0x79d2('0x59'));var _0x47a6e5=util['format'](_0x79d2('0x86'),_0x2b54ce);return db[_0x79d2('0x2a')]['find']({'where':{'id':_0x24f31c[_0x79d2('0x40')]['id']},'attributes':['id',_0x79d2('0x46'),'from','to','cc',_0x79d2('0x87'),_0x79d2('0x88'),_0x79d2('0x89')],'include':_0x24f31c[_0x79d2('0x2f')][_0x79d2('0x59')]?[{'model':db[_0x79d2('0x8a')],'as':_0x79d2('0x8b')}]:undefined})[_0x79d2('0x11')](handleEntityNotFound(_0x4ae241,null))[_0x79d2('0x11')](function(_0x131dd4){if(_0x131dd4){var _0x240808=_0x131dd4;var _0x4e6b2a={'from':_0x240808['from'],'to':_0x240808['to'],'subject':_0x240808[_0x79d2('0x88')],'html':htmlEntities[_0x79d2('0x8c')](_0x240808[_0x79d2('0x46')]),'headers':{'Date':moment(_0x240808[_0x79d2('0x89')])[_0x79d2('0x62')](_0x79d2('0x8d'))},'attachments':[]};if(_0x131dd4['cc']){_0x4e6b2a[_0x79d2('0x8e')]['Cc']=_0x131dd4['cc'];}if(_0x131dd4['bcc']){_0x4e6b2a['headers']['Bcc']=_0x131dd4['bcc'];}return new Promise(function(_0x33967b,_0x3a5199){if(_0x131dd4['Attachments']){for(var _0x91363e=0x0;_0x91363e<_0x131dd4['Attachments'][_0x79d2('0x34')];_0x91363e++){var _0x42e482=_0x131dd4[_0x79d2('0x8b')][_0x91363e];var _0x418295=path[_0x79d2('0x5a')](_0x41f84d,_0x42e482[_0x79d2('0x5d')]);if(fs[_0x79d2('0x8f')](_0x418295)){_0x4e6b2a[_0x79d2('0x59')]['push']({'name':_0x42e482['name'],'contentType':_0x42e482[_0x79d2('0x2c')],'data':fs['readFileSync'](_0x418295)});}}}emlformat[_0x79d2('0x90')](_0x4e6b2a,function(_0x46cc0a,_0x971fb9){if(_0x46cc0a)return _0x3a5199(_0x46cc0a);fs['writeFileSync'](path[_0x79d2('0x5a')](_0x5bb067,_0x47a6e5),_0x971fb9);return _0x33967b(_0x971fb9);});});}})[_0x79d2('0x11')](function(_0x234b45){if(_0x234b45){return _0x4ae241[_0x79d2('0x80')](path['join'](_0x5bb067,_0x47a6e5),_0x47a6e5,function(_0x14f4e1){if(!_0x14f4e1)fs[_0x79d2('0x91')](path[_0x79d2('0x5a')](_0x5bb067,_0x47a6e5));});}})['catch'](handleError(_0x4ae241,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 7ba9c4b..a79c6e9 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 _0x11af=['remove','emit','hook','events','../../mysqldb','MailMessage','save','update'];(function(_0x5b2ee4,_0x18131a){var _0xbc34f2=function(_0x36e443){while(--_0x36e443){_0x5b2ee4['push'](_0x5b2ee4['shift']());}};_0xbc34f2(++_0x18131a);}(_0x11af,0x173));var _0xf11a=function(_0x35be5b,_0x43dd6d){_0x35be5b=_0x35be5b-0x0;var _0x95761a=_0x11af[_0x35be5b];return _0x95761a;};'use strict';var EventEmitter=require(_0xf11a('0x0'));var MailMessage=require(_0xf11a('0x1'))['db'][_0xf11a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf11a('0x3'),'afterUpdate':_0xf11a('0x4'),'afterDestroy':_0xf11a('0x5')};function emitEvent(_0x27bfc6){return function(_0x5b86c7,_0x55631b,_0x18a982){MailMessageEvents['emit'](_0x27bfc6+':'+_0x5b86c7['id'],_0x5b86c7);MailMessageEvents[_0xf11a('0x6')](_0x27bfc6,_0x5b86c7);_0x18a982(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xf11a('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x971b=['MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x15beeb,_0x32bd4f){var _0x5b681a=function(_0x2f9b5c){while(--_0x2f9b5c){_0x15beeb['push'](_0x15beeb['shift']());}};_0x5b681a(++_0x32bd4f);}(_0x971b,0x1ae));var _0xb971=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0x971b[_0x34232c];return _0x4d4f4e;};'use strict';var EventEmitter=require(_0xb971('0x0'));var MailMessage=require(_0xb971('0x1'))['db'][_0xb971('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb971('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb971('0x4'),'afterDestroy':_0xb971('0x5')};function emitEvent(_0x2e2237){return function(_0x284f4f,_0x17a342,_0x1cfddc){MailMessageEvents[_0xb971('0x6')](_0x2e2237+':'+_0x284f4f['id'],_0x284f4f);MailMessageEvents[_0xb971('0x6')](_0x2e2237,_0x284f4f);_0x1cfddc(null);};}for(var e in events){if(events[_0xb971('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xb971('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 44d824e..40be2fd 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 _0x350d=['out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','define','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','get','direction','toLowerCase'];(function(_0x1483be,_0x327606){var _0x26e12b=function(_0x445b06){while(--_0x445b06){_0x1483be['push'](_0x1483be['shift']());}};_0x26e12b(++_0x327606);}(_0x350d,0x198));var _0xd350=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x350d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd350('0x0'));var logger=require(_0xd350('0x1'))(_0xd350('0x2'));var moment=require('moment');var BPromise=require(_0xd350('0x3'));var rp=require(_0xd350('0x4'));var htmlToText=require(_0xd350('0x5'));var fs=require('fs');var path=require(_0xd350('0x6'));var rimraf=require(_0xd350('0x7'));var config=require(_0xd350('0x8'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x2c27e7,_0x12a70d){return _0x2c27e7[_0xd350('0x9')](_0xd350('0xa'),attributes,{'tableName':_0xd350('0xb'),'paranoid':![],'indexes':[{'name':_0xd350('0xc'),'fields':[_0xd350('0xc')]},{'name':_0xd350('0xd'),'fields':['plainBody','subject'],'type':_0xd350('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x164128,_0xe82816,_0x1ef7a8){if(_0x164128[_0xd350('0xf')]){_0x164128[_0xd350('0x10')]=htmlToText[_0xd350('0x11')](_0x164128[_0xd350('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1ef7a8(null,_0xe82816);},'afterCreate':function(_0x16fea6,_0x898e19,_0x4cf753){var _0x3a7ba5=_0x2c27e7['models'];var _0x43d030=_0x16fea6[_0xd350('0x12')]({'plain':!![]});if(_0x43d030[_0xd350('0x13')][_0xd350('0x14')]()==='in'||_0x43d030[_0xd350('0x13')][_0xd350('0x14')]()===_0xd350('0x15')&&!_0x43d030[_0xd350('0x16')]&&!_['isNil'](_0x43d030[_0xd350('0x17')])){_0x3a7ba5[_0xd350('0x18')][_0xd350('0x19')]({'where':{'id':_0x43d030[_0xd350('0x1a')]}})[_0xd350('0x1b')](function(_0x3faa2f){if(_0x3faa2f){_0x3faa2f['update']({'lastMsgAt':_0x43d030[_0xd350('0x1c')],'lastMsgDirection':_0x43d030['direction'][_0xd350('0x14')]()});}})[_0xd350('0x1d')](function(_0xa5478){console[_0xd350('0x1e')](_0xa5478);});}_0x4cf753();}},'charset':_0xd350('0x1f'),'collate':_0xd350('0x20')});}; \ No newline at end of file +var _0x44a1=['exports','define','MailMessage','mail_messages','messageId','plainBody','subject','body','models','get','toLowerCase','direction','out','secret','MailInteraction','findOne','then','createdAt','catch','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x44a1,0xf5));var _0x144a=function(_0x43725a,_0x198380){_0x43725a=_0x43725a-0x0;var _0x4024cd=_0x44a1[_0x43725a];return _0x4024cd;};'use strict';var _=require(_0x144a('0x0'));var util=require(_0x144a('0x1'));var logger=require('../../config/logger')(_0x144a('0x2'));var moment=require(_0x144a('0x3'));var BPromise=require(_0x144a('0x4'));var rp=require(_0x144a('0x5'));var htmlToText=require(_0x144a('0x6'));var fs=require('fs');var path=require(_0x144a('0x7'));var rimraf=require(_0x144a('0x8'));var config=require(_0x144a('0x9'));var attributes=require(_0x144a('0xa'));module[_0x144a('0xb')]=function(_0x2a92fb,_0xaf9232){return _0x2a92fb[_0x144a('0xc')](_0x144a('0xd'),attributes,{'tableName':_0x144a('0xe'),'paranoid':![],'indexes':[{'name':_0x144a('0xf'),'fields':[_0x144a('0xf')]},{'name':'fti_mail_messages','fields':[_0x144a('0x10'),_0x144a('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45ee7b,_0x35828e,_0x1f4e94){if(_0x45ee7b[_0x144a('0x12')]){_0x45ee7b['plainBody']=htmlToText['fromString'](_0x45ee7b[_0x144a('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1f4e94(null,_0x35828e);},'afterCreate':function(_0x46414f,_0x30a031,_0x1461a6){var _0x4ac246=_0x2a92fb[_0x144a('0x13')];var _0x1d509f=_0x46414f[_0x144a('0x14')]({'plain':!![]});if(_0x1d509f['direction'][_0x144a('0x15')]()==='in'||_0x1d509f[_0x144a('0x16')][_0x144a('0x15')]()===_0x144a('0x17')&&!_0x1d509f[_0x144a('0x18')]&&!_['isNil'](_0x1d509f['UserId'])){_0x4ac246[_0x144a('0x19')][_0x144a('0x1a')]({'where':{'id':_0x1d509f['MailInteractionId']}})[_0x144a('0x1b')](function(_0x13d224){if(_0x13d224){_0x13d224['update']({'lastMsgAt':_0x1d509f[_0x144a('0x1c')],'lastMsgDirection':_0x1d509f[_0x144a('0x16')]['toLowerCase']()});}})[_0x144a('0x1d')](function(_0x2d54c5){console[_0x144a('0x1e')](_0x2d54c5);});}_0x1461a6();}},'charset':_0x144a('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 60daafb..3b5c6e0 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 _0x1399=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateMailMessage','MailMessage','create','body','options','raw','debug','stringify'];(function(_0x50e001,_0x45aa55){var _0x3fe4a2=function(_0x42dd11){while(--_0x42dd11){_0x50e001['push'](_0x50e001['shift']());}};_0x3fe4a2(++_0x45aa55);}(_0x1399,0x16c));var _0x9139=function(_0x7de746,_0x1ce1fc){_0x7de746=_0x7de746-0x0;var _0x538066=_0x1399[_0x7de746];return _0x538066;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});config[_0x9139('0xa')]=_[_0x9139('0xb')](config['redis'],{'host':_0x9139('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9139('0xd'))[_0x9139('0xe')](socket);function respondWithRpcPromise(_0x4830cd,_0x315de8,_0x1bfa6b){return new BPromise(function(_0x5c90eb,_0x4f7f3a){return client[_0x9139('0xf')](_0x4830cd,_0x1bfa6b)[_0x9139('0x10')](function(_0x23357c){logger[_0x9139('0x11')](_0x9139('0x12'),_0x315de8,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'),JSON['stringify'](_0x23357c));if(_0x23357c[_0x9139('0x14')]){if(_0x23357c[_0x9139('0x14')][_0x9139('0x15')]===0x1f4){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x23357c[_0x9139('0x14')]['message']);return _0x4f7f3a(_0x23357c['error']['message']);}logger[_0x9139('0x14')](_0x9139('0x12'),_0x315de8,_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);return _0x5c90eb(_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'));_0x5c90eb(_0x23357c[_0x9139('0x17')]['message']);}})['catch'](function(_0x30a363){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x30a363);_0x4f7f3a(_0x30a363);});});}exports[_0x9139('0x18')]=function(_0x1ef57b){var _0x1a592e=this;return new Promise(function(_0x3c8296,_0xd2eb33){return db[_0x9139('0x19')][_0x9139('0x1a')](_0x1ef57b[_0x9139('0x1b')],{'raw':_0x1ef57b[_0x9139('0x1c')]?_0x1ef57b[_0x9139('0x1c')][_0x9139('0x1d')]===undefined?!![]:![]:!![]})[_0x9139('0x10')](function(_0x5a3e2e){logger[_0x9139('0x11')](_0x9139('0x18'),_0x1ef57b);logger[_0x9139('0x1e')](_0x9139('0x18'),_0x1ef57b,JSON[_0x9139('0x1f')](_0x5a3e2e));_0x3c8296(_0x5a3e2e);})[_0x9139('0x20')](function(_0x4b7fe0){logger[_0x9139('0x14')](_0x9139('0x18'),_0x4b7fe0['message'],_0x1ef57b);_0xd2eb33(_0x1a592e[_0x9139('0x14')](0x1f4,_0x4b7fe0[_0x9139('0x16')]));});});}; \ No newline at end of file +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(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xea28,0x13a));var _0x8ea2=function(_0x2f5411,_0x2b8059){_0x2f5411=_0x2f5411-0x0;var _0x5ea8e0=_0xea28[_0x2f5411];return _0x5ea8e0;};'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 diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index c5f051d..36bfd9d 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 _0x18db=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','remove'];(function(_0x4f3242,_0x391954){var _0x49844f=function(_0x5ee033){while(--_0x5ee033){_0x4f3242['push'](_0x4f3242['shift']());}};_0x49844f(++_0x391954);}(_0x18db,0x6e));var _0xb18d=function(_0x2dbe73,_0x185cf9){_0x2dbe73=_0x2dbe73-0x0;var _0x2ac241=_0x18db[_0x2dbe73];return _0x2ac241;};'use strict';var MailMessageEvents=require(_0xb18d('0x0'));var events=['save',_0xb18d('0x1'),'update'];function createListener(_0x4ed245,_0x1dc087){return function(_0x1e24bd){_0x1dc087[_0xb18d('0x2')](_0x4ed245,_0x1e24bd);};}function removeListener(_0x14b8ec,_0x9767c9){return function(){MailMessageEvents[_0xb18d('0x3')](_0x14b8ec,_0x9767c9);};}exports[_0xb18d('0x4')]=function(_0x2fe76b){for(var _0x912558=0x0,_0x4b210d=events[_0xb18d('0x5')];_0x912558<_0x4b210d;_0x912558++){var _0x5e4f93=events[_0x912558];var _0x2cd62f=createListener(_0xb18d('0x6')+_0x5e4f93,_0x2fe76b);MailMessageEvents['on'](_0x5e4f93,_0x2cd62f);}}; \ No newline at end of file +var _0x209f=['mailMessage:','./mailMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x4ae2fb,_0x1c1c67){var _0x4f5268=function(_0x11236b){while(--_0x11236b){_0x4ae2fb['push'](_0x4ae2fb['shift']());}};_0x4f5268(++_0x1c1c67);}(_0x209f,0x199));var _0xf209=function(_0x138014,_0x4ae22b){_0x138014=_0x138014-0x0;var _0x3941e3=_0x209f[_0x138014];return _0x3941e3;};'use strict';var MailMessageEvents=require(_0xf209('0x0'));var events=['save',_0xf209('0x1'),_0xf209('0x2')];function createListener(_0x5e4952,_0x39ff77){return function(_0x3878ac){_0x39ff77[_0xf209('0x3')](_0x5e4952,_0x3878ac);};}function removeListener(_0x5c9f66,_0x3e0100){return function(){MailMessageEvents[_0xf209('0x4')](_0x5c9f66,_0x3e0100);};}exports[_0xf209('0x5')]=function(_0x24b4e2){for(var _0x46c481=0x0,_0x5ba6df=events[_0xf209('0x6')];_0x46c481<_0x5ba6df;_0x46c481++){var _0x644a7b=events[_0x46c481];var _0x453721=createListener(_0xf209('0x7')+_0x644a7b,_0x24b4e2);MailMessageEvents['on'](_0x644a7b,_0x453721);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e774aa9..b07d721 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 _0xbfc3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path'];(function(_0x1c4958,_0x3357ff){var _0x1cd861=function(_0x11c36e){while(--_0x11c36e){_0x1c4958['push'](_0x1c4958['shift']());}};_0x1cd861(++_0x3357ff);}(_0xbfc3,0x189));var _0x3bfc=function(_0x5bff95,_0x5c39b9){_0x5bff95=_0x5bff95-0x0;var _0x49c147=_0xbfc3[_0x5bff95];return _0x49c147;};'use strict';var multer=require(_0x3bfc('0x0'));var util=require(_0x3bfc('0x1'));var path=require(_0x3bfc('0x2'));var timeout=require(_0x3bfc('0x3'));var express=require(_0x3bfc('0x4'));var router=express[_0x3bfc('0x5')]();var fs_extra=require(_0x3bfc('0x6'));var auth=require(_0x3bfc('0x7'));var interaction=require(_0x3bfc('0x8'));var config=require(_0x3bfc('0x9'));var controller=require(_0x3bfc('0xa'));router['get']('/',auth[_0x3bfc('0xb')](),controller[_0x3bfc('0xc')]);router['get'](_0x3bfc('0xd'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0xe')]);router[_0x3bfc('0xf')](_0x3bfc('0x10'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x11')]);router[_0x3bfc('0xf')](_0x3bfc('0x12'),auth[_0x3bfc('0xb')](),controller['getMembers']);router[_0x3bfc('0xf')]('/:id/teams',auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x13')]);router[_0x3bfc('0xf')](_0x3bfc('0x14'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x15')]);router[_0x3bfc('0x16')]('/',auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x17')]);router[_0x3bfc('0x16')](_0x3bfc('0x18'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x19')]);router[_0x3bfc('0x16')](_0x3bfc('0x14'),auth[_0x3bfc('0xb')](),controller['addAgents']);router[_0x3bfc('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x3bfc('0x1b')]);router[_0x3bfc('0x1c')](_0x3bfc('0x10'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x1d')]);router[_0x3bfc('0x1c')]('/:id/teams',auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x1e')]);router[_0x3bfc('0x1c')](_0x3bfc('0x14'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x1f')]);module[_0x3bfc('0x20')]=router; \ No newline at end of file +var _0x7dfd=['get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller'];(function(_0x254973,_0x296153){var _0x25008e=function(_0x2080e9){while(--_0x2080e9){_0x254973['push'](_0x254973['shift']());}};_0x25008e(++_0x296153);}(_0x7dfd,0x1e6));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd7df('0x6'));var interaction=require(_0xd7df('0x7'));var config=require(_0xd7df('0x8'));var controller=require(_0xd7df('0x9'));router[_0xd7df('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd7df('0xb'),auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xa')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller[_0xd7df('0xf')]);router['get'](_0xd7df('0x10'),auth[_0xd7df('0xc')](),controller['getMembers']);router[_0xd7df('0xa')]('/:id/teams',auth[_0xd7df('0xc')](),controller[_0xd7df('0x11')]);router[_0xd7df('0xa')](_0xd7df('0x12'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x13')]);router[_0xd7df('0x14')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0x15')]);router[_0xd7df('0x14')](_0xd7df('0x16'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x17')]);router[_0xd7df('0x14')](_0xd7df('0x12'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x18')]);router[_0xd7df('0x19')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['update']);router[_0xd7df('0x1a')]('/:id',auth[_0xd7df('0xc')](),controller[_0xd7df('0x1b')]);router['delete']('/:id/teams',auth[_0xd7df('0xc')](),controller[_0xd7df('0x1c')]);router[_0xd7df('0x1a')](_0xd7df('0x12'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x1d')]);module[_0xd7df('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 7b2992c..d0af94c 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 _0xe95b=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe95b,0x1b4));var _0xbe95=function(_0x2844fd,_0x1ed0b4){_0x2844fd=_0x2844fd-0x0;var _0x5a62b8=_0xe95b[_0x2844fd];return _0x5a62b8;};'use strict';var Sequelize=require(_0xbe95('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe95('0x1')],'unique':_0xbe95('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbe95('0x1')]},'timeout':{'type':Sequelize[_0xbe95('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbe95('0x4')](_0xbe95('0x5'),_0xbe95('0x6'),_0xbe95('0x7'))}}; \ No newline at end of file +var _0x26a8=['sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2f3c64,_0x2427d3){var _0x1137e9=function(_0x1664cf){while(--_0x1664cf){_0x2f3c64['push'](_0x2f3c64['shift']());}};_0x1137e9(++_0x2427d3);}(_0x26a8,0x1e0));var _0x826a=function(_0x51993e,_0x582b97){_0x51993e=_0x51993e-0x0;var _0x356c4e=_0x26a8[_0x51993e];return _0x356c4e;};'use strict';var Sequelize=require(_0x826a('0x0'));module['exports']={'name':{'type':Sequelize[_0x826a('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x826a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x826a('0x3')](_0x826a('0x4'),_0x826a('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a60be83..c4144df 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 _0xb5e4=['model','keys','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','hasOwnProperty','nolimit','order','sort','where','pick','MailQueueId','merge','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','filter','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','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','every','TeamId','includes','all','union','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','include','query','MailQueue','findAll','catch','params'];(function(_0x238049,_0x43e7f7){var _0x5a942c=function(_0x4fcdad){while(--_0x4fcdad){_0x238049['push'](_0x238049['shift']());}};_0x5a942c(++_0x43e7f7);}(_0xb5e4,0x149));var _0x4b5e=function(_0x5c9ced,_0x48c7c2){_0x5c9ced=_0x5c9ced-0x0;var _0xf9758f=_0xb5e4[_0x5c9ced];return _0xf9758f;};'use strict';var BPromise=require(_0x4b5e('0x0'));var util=require(_0x4b5e('0x1'));var _=require(_0x4b5e('0x2'));var squel=require(_0x4b5e('0x3'));var Redis=require(_0x4b5e('0x4'));var qs=require(_0x4b5e('0x5'));var logger=require(_0x4b5e('0x6'))('api');var config=require(_0x4b5e('0x7'));var db=require(_0x4b5e('0x8'))['db'];config[_0x4b5e('0x9')]=_[_0x4b5e('0xa')](config[_0x4b5e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b5e('0xb'))(new Redis(config['redis']));require(_0x4b5e('0xc'))[_0x4b5e('0xd')](socket);function respondWithStatusCode(_0x3d2ef6,_0x63ab7d){_0x63ab7d=_0x63ab7d||0xcc;return function(_0x4eeb21){if(_0x4eeb21){return _0x3d2ef6['sendStatus'](_0x63ab7d);}return _0x3d2ef6[_0x4b5e('0xe')](_0x63ab7d)[_0x4b5e('0xf')]();};}function respondWithResult(_0x430958,_0x4e273c){_0x4e273c=_0x4e273c||0xc8;return function(_0x4cbcbc){if(_0x4cbcbc){return _0x430958['status'](_0x4e273c)[_0x4b5e('0x10')](_0x4cbcbc);}};}function respondWithFilteredResult(_0x11c0de,_0x542fe5){return function(_0x213fd3){if(_0x213fd3){var _0x4dcd47=typeof _0x542fe5[_0x4b5e('0x11')]===_0x4b5e('0x12')&&typeof _0x542fe5[_0x4b5e('0x13')]===_0x4b5e('0x12');var _0x2d232e=_0x213fd3[_0x4b5e('0x14')];var _0x3fb224=_0x4dcd47?0x0:_0x542fe5[_0x4b5e('0x11')];var _0x47d634=_0x4dcd47?_0x213fd3[_0x4b5e('0x14')]:_0x542fe5[_0x4b5e('0x11')]+_0x542fe5[_0x4b5e('0x13')];var _0x5245f8;if(_0x47d634>=_0x2d232e){_0x47d634=_0x2d232e;_0x5245f8=0xc8;}else{_0x5245f8=0xce;}_0x11c0de['status'](_0x5245f8);return _0x11c0de[_0x4b5e('0x15')](_0x4b5e('0x16'),_0x3fb224+'-'+_0x47d634+'/'+_0x2d232e)['json'](_0x213fd3);}return null;};}function saveUpdates(_0x437811){return function(_0x9d44f7){if(_0x9d44f7){return _0x9d44f7[_0x4b5e('0x17')](_0x437811)[_0x4b5e('0x18')](function(_0x552be6){return _0x552be6;});}return null;};}function removeEntity(_0x481464){return function(_0x54de43){if(_0x54de43){return _0x54de43[_0x4b5e('0x19')]()['then'](function(){var _0x41b239=_0x54de43[_0x4b5e('0x1a')]({'plain':!![]});var _0x3f6a43='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x3f6a43,'resourceId':_0x41b239['id']}})['then'](function(){return _0x54de43;});})[_0x4b5e('0x18')](function(){_0x481464[_0x4b5e('0xe')](0xcc)[_0x4b5e('0xf')]();});}};}function handleEntityNotFound(_0x441eaf){return function(_0x41f319){if(!_0x41f319){_0x441eaf[_0x4b5e('0x1b')](0x194);}return _0x41f319;};}function handleError(_0x120753,_0x42e5fa){_0x42e5fa=_0x42e5fa||0x1f4;return function(_0x48f592){logger[_0x4b5e('0x1c')](_0x48f592['stack']);if(_0x48f592['name']){delete _0x48f592[_0x4b5e('0x1d')];}_0x120753[_0x4b5e('0xe')](_0x42e5fa)[_0x4b5e('0x1e')](_0x48f592);};}exports[_0x4b5e('0x1f')]=function(_0x1bde7e,_0xe8bd44){var _0x54dde3={};var _0x40bf95={'count':0x0,'rows':[]};var _0x44499c=_[_0x4b5e('0x20')](db['MailQueue'][_0x4b5e('0x21')],function(_0x112439){return{'name':_0x112439[_0x4b5e('0x22')],'type':_0x112439[_0x4b5e('0x23')][_0x4b5e('0x24')]};});_0x54dde3=qs['getOptions'](_0x44499c,_0x1bde7e);var _0x4adeda={'where':_0x54dde3['where']};return db['MailQueue']['count'](_0x4adeda)['then'](function(_0x1104b1){_0x40bf95[_0x4b5e('0x14')]=_0x1104b1;_0x54dde3[_0x4b5e('0x25')]=qs[_0x4b5e('0x25')](_0x1bde7e[_0x4b5e('0x26')]);return db[_0x4b5e('0x27')][_0x4b5e('0x28')](_0x54dde3);})[_0x4b5e('0x18')](function(_0x44c286){_0x40bf95['rows']=_0x44c286;return _0x40bf95;})[_0x4b5e('0x18')](respondWithFilteredResult(_0xe8bd44,_0x54dde3))[_0x4b5e('0x29')](handleError(_0xe8bd44,null));};exports['show']=function(_0x292607,_0x484311){var _0x49ca76={'raw':!![],'where':{'id':_0x292607[_0x4b5e('0x2a')]['id']}},_0x375015={};_0x375015[_0x4b5e('0x2b')]=_[_0x4b5e('0x2c')](db['MailQueue'][_0x4b5e('0x21')]);_0x375015[_0x4b5e('0x26')]=_['keys'](_0x292607[_0x4b5e('0x26')]);_0x375015[_0x4b5e('0x2d')]=_[_0x4b5e('0x2e')](_0x375015['model'],_0x375015[_0x4b5e('0x26')]);_0x49ca76[_0x4b5e('0x2f')]=_['intersection'](_0x375015[_0x4b5e('0x2b')],qs[_0x4b5e('0x30')](_0x292607[_0x4b5e('0x26')][_0x4b5e('0x30')]));_0x49ca76['attributes']=_0x49ca76['attributes'][_0x4b5e('0x31')]?_0x49ca76[_0x4b5e('0x2f')]:_0x375015[_0x4b5e('0x2b')];if(_0x292607[_0x4b5e('0x26')][_0x4b5e('0x32')]){_0x49ca76[_0x4b5e('0x25')]=[{'all':!![]}];}_0x49ca76=_['merge']({},_0x49ca76,_0x292607[_0x4b5e('0x33')]);return db['MailQueue'][_0x4b5e('0x34')](_0x49ca76)[_0x4b5e('0x18')](handleEntityNotFound(_0x484311,null))[_0x4b5e('0x18')](respondWithResult(_0x484311,null))['catch'](handleError(_0x484311,null));};exports[_0x4b5e('0x35')]=function(_0x389fd8,_0x2dfdce){return db[_0x4b5e('0x27')]['create'](_0x389fd8[_0x4b5e('0x36')],{})[_0x4b5e('0x18')](function(_0xb00d3){var _0x8b51db=_0x389fd8[_0x4b5e('0x37')][_0x4b5e('0x1a')]({'plain':!![]});if(!_0x8b51db)throw new Error(_0x4b5e('0x38'));if(_0x8b51db[_0x4b5e('0x39')]===_0x4b5e('0x37')){var _0x1af978=_0xb00d3[_0x4b5e('0x1a')]({'plain':!![]});var _0x1f45eb=_0x4b5e('0x3a');return db[_0x4b5e('0x3b')]['find']({'where':{'name':_0x1f45eb,'userProfileId':_0x8b51db['userProfileId']},'raw':!![]})[_0x4b5e('0x18')](function(_0x35be1b){if(_0x35be1b&&_0x35be1b[_0x4b5e('0x3c')]===0x0){return db['UserProfileResource'][_0x4b5e('0x35')]({'name':_0x1af978[_0x4b5e('0x1d')],'resourceId':_0x1af978['id'],'type':_0x35be1b[_0x4b5e('0x1d')],'sectionId':_0x35be1b['id']},{})[_0x4b5e('0x18')](function(){return _0xb00d3;});}else{return _0xb00d3;}})[_0x4b5e('0x29')](function(_0x1407b3){logger[_0x4b5e('0x1c')](_0x4b5e('0x3d'),_0x1407b3);throw _0x1407b3;});}return _0xb00d3;})[_0x4b5e('0x18')](respondWithResult(_0x2dfdce,0xc9))[_0x4b5e('0x29')](handleError(_0x2dfdce,null));};exports[_0x4b5e('0x17')]=function(_0x4b6d28,_0x22d6d7){if(_0x4b6d28[_0x4b5e('0x36')]['id']){delete _0x4b6d28['body']['id'];}return db['MailQueue'][_0x4b5e('0x34')]({'where':{'id':_0x4b6d28[_0x4b5e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x22d6d7,null))['then'](saveUpdates(_0x4b6d28[_0x4b5e('0x36')],null))[_0x4b5e('0x18')](respondWithResult(_0x22d6d7,null))[_0x4b5e('0x29')](handleError(_0x22d6d7,null));};exports['destroy']=function(_0x194d8f,_0x2731ad){return db['MailQueue']['find']({'where':{'id':_0x194d8f[_0x4b5e('0x2a')]['id']}})[_0x4b5e('0x18')](handleEntityNotFound(_0x2731ad,null))[_0x4b5e('0x18')](removeEntity(_0x2731ad,null))[_0x4b5e('0x29')](handleError(_0x2731ad,null));};exports[_0x4b5e('0x3e')]=function(_0x387d4f,_0x258993){return db[_0x4b5e('0x27')][_0x4b5e('0x3e')]()['then'](respondWithResult(_0x258993,null))[_0x4b5e('0x29')](handleError(_0x258993,null));};exports[_0x4b5e('0x3f')]=function(_0x255978,_0x33d947){var _0x15e3d6={'raw':!![],'where':{}},_0x3cefd8={},_0x38cf89;return db[_0x4b5e('0x27')]['findOne']({'where':{'id':_0x255978['params']['id']}})[_0x4b5e('0x18')](handleEntityNotFound(_0x33d947,null))[_0x4b5e('0x18')](function(_0x266638){if(_0x266638){_0x38cf89=_0x266638['get']({'plain':!![]});_0x3cefd8[_0x4b5e('0x2b')]=_[_0x4b5e('0x2c')](db[_0x4b5e('0x40')][_0x4b5e('0x21')]);_0x3cefd8[_0x4b5e('0x26')]=_['keys'](_0x255978['query']);_0x3cefd8[_0x4b5e('0x2d')]=_['intersection'](_0x3cefd8[_0x4b5e('0x2b')],_0x3cefd8[_0x4b5e('0x26')]);_0x15e3d6[_0x4b5e('0x2f')]=_[_0x4b5e('0x2e')](_0x3cefd8['model'],qs[_0x4b5e('0x30')](_0x255978[_0x4b5e('0x26')][_0x4b5e('0x30')]));_0x15e3d6[_0x4b5e('0x2f')]=_0x15e3d6['attributes']['length']?_0x15e3d6[_0x4b5e('0x2f')]:_0x3cefd8[_0x4b5e('0x2b')];if(!_0x255978[_0x4b5e('0x26')][_0x4b5e('0x41')](_0x4b5e('0x42'))){_0x15e3d6[_0x4b5e('0x13')]=qs[_0x4b5e('0x13')](_0x255978[_0x4b5e('0x26')][_0x4b5e('0x13')]);_0x15e3d6[_0x4b5e('0x11')]=qs['offset'](_0x255978['query'][_0x4b5e('0x11')]);}_0x15e3d6[_0x4b5e('0x43')]=qs[_0x4b5e('0x44')](_0x255978['query'][_0x4b5e('0x44')]);_0x15e3d6[_0x4b5e('0x45')]=qs[_0x4b5e('0x2d')](_[_0x4b5e('0x46')](_0x255978[_0x4b5e('0x26')],_0x3cefd8[_0x4b5e('0x2d')]));_0x15e3d6[_0x4b5e('0x45')][_0x4b5e('0x47')]=_0x266638['id'];if(_0x255978[_0x4b5e('0x26')]['filter']){_0x15e3d6[_0x4b5e('0x45')]=_[_0x4b5e('0x48')](_0x15e3d6[_0x4b5e('0x45')],{'$or':_[_0x4b5e('0x20')](_0x15e3d6[_0x4b5e('0x2f')],function(_0x1d5dd7){var _0x4df3e7={};_0x4df3e7[_0x1d5dd7]={'$like':'%'+_0x255978['query']['filter']+'%'};return _0x4df3e7;})});}_0x15e3d6=_[_0x4b5e('0x48')]({},_0x15e3d6,_0x255978['options']);return db['UserMailQueue']['findAll'](_0x15e3d6);}})[_0x4b5e('0x18')](function(_0x49e5e8){if(_0x49e5e8){return db[_0x4b5e('0x49')][_0x4b5e('0x4a')]({'where':{'id':_[_0x4b5e('0x20')](_0x49e5e8,'UserId'),'role':_0x4b5e('0x4b')},'attributes':['id','name',_0x4b5e('0x4c'),_0x4b5e('0x4d'),_0x4b5e('0x4e')]});}})['then'](function(_0x228c3f){if(_0x228c3f){return{'count':_0x228c3f[_0x4b5e('0x14')],'rows':_['map'](_0x228c3f[_0x4b5e('0x4f')],function(_0x4e8d4c){return{'membername':_0x4e8d4c[_0x4b5e('0x1d')],'UserId':_0x4e8d4c['id'],'queue_name':_0x38cf89[_0x4b5e('0x1d')],'MailQueueId':_0x38cf89['id'],'interface':util[_0x4b5e('0x50')](_0x4b5e('0x51'),_0x4b5e('0x52'),_0x4e8d4c[_0x4b5e('0x1d')]),'penalty':0x0,'paused':_0x4e8d4c[_0x4b5e('0x4c')],'createdAt':_0x4e8d4c['createdAt'],'updatedAt':_0x4e8d4c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b5e('0x18')](respondWithFilteredResult(_0x33d947,_0x15e3d6))[_0x4b5e('0x29')](handleError(_0x33d947,null));};exports[_0x4b5e('0x53')]=function(_0x108b4a,_0x22ae3e){var _0x2ae67f={};var _0x3f5b37={};var _0x32f25a;var _0xa0bc28;return db[_0x4b5e('0x27')]['findOne']({'where':{'id':_0x108b4a['params']['id']}})[_0x4b5e('0x18')](handleEntityNotFound(_0x22ae3e,null))['then'](function(_0x21c7bf){if(_0x21c7bf){_0x32f25a=_0x21c7bf;_0x3f5b37[_0x4b5e('0x2b')]=_[_0x4b5e('0x2c')](db[_0x4b5e('0x54')][_0x4b5e('0x21')]);_0x3f5b37['query']=_[_0x4b5e('0x2c')](_0x108b4a['query']);_0x3f5b37[_0x4b5e('0x2d')]=_[_0x4b5e('0x2e')](_0x3f5b37[_0x4b5e('0x2b')],_0x3f5b37[_0x4b5e('0x26')]);_0x2ae67f[_0x4b5e('0x2f')]=_[_0x4b5e('0x2e')](_0x3f5b37[_0x4b5e('0x2b')],qs['fields'](_0x108b4a[_0x4b5e('0x26')]['fields']));_0x2ae67f[_0x4b5e('0x2f')]=_0x2ae67f[_0x4b5e('0x2f')][_0x4b5e('0x31')]?_0x2ae67f[_0x4b5e('0x2f')]:_0x3f5b37[_0x4b5e('0x2b')];_0x2ae67f[_0x4b5e('0x43')]=qs[_0x4b5e('0x44')](_0x108b4a[_0x4b5e('0x26')]['sort']);_0x2ae67f['where']=qs[_0x4b5e('0x2d')](_[_0x4b5e('0x46')](_0x108b4a[_0x4b5e('0x26')],_0x3f5b37[_0x4b5e('0x2d')]));if(_0x108b4a['query'][_0x4b5e('0x55')]){_0x2ae67f[_0x4b5e('0x45')]=_[_0x4b5e('0x48')](_0x2ae67f[_0x4b5e('0x45')],{'$or':_['map'](_0x2ae67f[_0x4b5e('0x2f')],function(_0x1f50c2){var _0x4803df={};_0x4803df[_0x1f50c2]={'$like':'%'+_0x108b4a[_0x4b5e('0x26')][_0x4b5e('0x55')]+'%'};return _0x4803df;})});}_0x2ae67f=_[_0x4b5e('0x48')]({},_0x2ae67f,_0x108b4a[_0x4b5e('0x33')]);return _0x32f25a[_0x4b5e('0x53')](_0x2ae67f);}})[_0x4b5e('0x18')](function(_0x20cac6){if(_0x20cac6){_0xa0bc28=_0x20cac6[_0x4b5e('0x31')];if(!_0x108b4a[_0x4b5e('0x26')][_0x4b5e('0x41')](_0x4b5e('0x42'))){_0x2ae67f[_0x4b5e('0x13')]=qs['limit'](_0x108b4a['query'][_0x4b5e('0x13')]);_0x2ae67f['offset']=qs['offset'](_0x108b4a[_0x4b5e('0x26')][_0x4b5e('0x11')]);}return _0x32f25a['getTeams'](_0x2ae67f);}})[_0x4b5e('0x18')](function(_0x258ce7){if(_0x258ce7){return _0x258ce7?{'count':_0xa0bc28,'rows':_0x258ce7}:null;}})[_0x4b5e('0x18')](respondWithResult(_0x22ae3e,null))[_0x4b5e('0x29')](handleError(_0x22ae3e,null));};exports[_0x4b5e('0x56')]=function(_0x274913,_0x4c3b3a){var _0x293c4a=_0x274913[_0x4b5e('0x36')][_0x4b5e('0x57')];return db[_0x4b5e('0x54')]['findAll']({'where':{'id':_0x293c4a},'attributes':['id'],'include':[{'model':db[_0x4b5e('0x49')],'as':_0x4b5e('0x58'),'attributes':['id',_0x4b5e('0x1d'),'online',_0x4b5e('0x59'),_0x4b5e('0x5a')],'raw':!![]}]})[_0x4b5e('0x18')](function(_0x4af759){if(_0x4af759){var _0x2fb115=_[_0x4b5e('0x5b')](_0x4af759,function(_0x2f60ad){var _0x379f39=_0x2f60ad[_0x4b5e('0x1a')]({'plain':!![]});return _0x379f39['Agents'];});return db[_0x4b5e('0x27')][_0x4b5e('0x34')]({'where':{'id':_0x274913[_0x4b5e('0x2a')]['id']}})[_0x4b5e('0x18')](function(_0x4a9d1b){return db[_0x4b5e('0x5c')][_0x4b5e('0x5d')](function(_0x23bf76){return _0x4a9d1b[_0x4b5e('0x56')](_0x293c4a,{'transaction':_0x23bf76})[_0x4b5e('0x18')](function(){return BPromise[_0x4b5e('0x5e')](_0x2fb115,function(_0x470d21){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x470d21['id'],'MailQueueId':_0x274913[_0x4b5e('0x2a')]['id']},'transaction':_0x23bf76});});})[_0x4b5e('0x18')](function(){_0x2fb115[_0x4b5e('0x5f')](function(_0x45da2){socket[_0x4b5e('0x60')](_0x4b5e('0x61'),{'UserId':_0x45da2['id'],'MailQueueId':_0x4a9d1b['id']});});});});});}})[_0x4b5e('0x18')](respondWithStatusCode(_0x4c3b3a,null))[_0x4b5e('0x29')](handleError(_0x4c3b3a,null));};exports[_0x4b5e('0x62')]=function(_0x25a00f,_0x1ced22){return db['Team'][_0x4b5e('0x28')]({'where':{'id':_0x25a00f[_0x4b5e('0x26')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1ced22,null))[_0x4b5e('0x18')](function(_0x2eb879){var _0x49e036=_[_0x4b5e('0x20')](_0x2eb879,'id');var _0x583467=[];var _0x5b16ad=[];var _0x4d3e27=squel[_0x4b5e('0x63')]();_0x4d3e27[_0x4b5e('0x64')](_0x4b5e('0x65'))['from'](_0x4b5e('0x66'),'tq')[_0x4b5e('0x67')](_0x4b5e('0x68'),'ut',_0x4b5e('0x69'))[_0x4b5e('0x45')](_0x4b5e('0x6a'),_0x25a00f[_0x4b5e('0x2a')]['id']);for(var _0x6ac0f3=0x0;_0x6ac0f3<_0x2eb879['length'];_0x6ac0f3+=0x1){let _0x957d4=_0x2eb879[_0x6ac0f3];for(var _0x1a40be=0x0;_0x1a40be<_0x957d4[_0x4b5e('0x58')][_0x4b5e('0x31')];_0x1a40be+=0x1){let _0x2d1acb=_0x957d4['Agents'][_0x1a40be];var _0xc8da7a=_0x4d3e27[_0x4b5e('0x6b')]();_0xc8da7a['where'](_0x4b5e('0x6c'),_0x2d1acb['id']);_0x5b16ad[_0x4b5e('0x6d')](db['sequelize'][_0x4b5e('0x26')](_0xc8da7a[_0x4b5e('0x6e')](),{'type':db[_0x4b5e('0x5c')][_0x4b5e('0x6f')]['SELECT']})[_0x4b5e('0x18')](function(_0x332279){if(_0x332279['length']===0x1){return _0x2d1acb['id'];}else{var _0x403bbf=_[_0x4b5e('0x70')](_['map'](_0x332279,_0x4b5e('0x71')),function(_0x5489a4){return _[_0x4b5e('0x72')](_0x49e036,_0x5489a4);});if(_0x403bbf){return _0x2d1acb['id'];}}}));}}return BPromise[_0x4b5e('0x73')](_0x5b16ad)[_0x4b5e('0x18')](function(_0x58ad7e){_0x583467=_(_0x583467)[_0x4b5e('0x74')](_0x58ad7e)['compact']()['value']();return db['MailQueue']['find']({'where':{'id':_0x25a00f[_0x4b5e('0x2a')]['id']}})[_0x4b5e('0x18')](function(_0x38618e){return db[_0x4b5e('0x5c')][_0x4b5e('0x5d')](function(_0x4842c1){return _0x38618e[_0x4b5e('0x62')](_0x25a00f[_0x4b5e('0x26')]['ids'],{'transaction':_0x4842c1})[_0x4b5e('0x18')](function(){if(!_['isEmpty'](_0x583467)){return _0x38618e[_0x4b5e('0x75')](_0x583467,{'transaction':_0x4842c1});}})[_0x4b5e('0x18')](function(){_0x583467['forEach'](function(_0x306bb7){socket['emit'](_0x4b5e('0x76'),{'UserId':_0x306bb7,'MailQueueId':_0x38618e['id']});});});});});});})[_0x4b5e('0x18')](respondWithStatusCode(_0x1ced22,null))[_0x4b5e('0x29')](handleError(_0x1ced22,null));};exports[_0x4b5e('0x77')]=function(_0x5808b8,_0x555821){return db['MailQueue'][_0x4b5e('0x34')]({'where':{'id':_0x5808b8[_0x4b5e('0x2a')]['id']}})[_0x4b5e('0x18')](handleEntityNotFound(_0x555821,null))['then'](function(_0xc9c137){if(_0xc9c137){return _0xc9c137['addAgents'](_0x5808b8[_0x4b5e('0x36')][_0x4b5e('0x57')],_[_0x4b5e('0x78')](_0x5808b8[_0x4b5e('0x36')],[_0x4b5e('0x57'),'id'])||{})[_0x4b5e('0x79')](function(_0x357ad6){for(var _0x153961=0x0;_0x153961<_0x5808b8['body'][_0x4b5e('0x57')][_0x4b5e('0x31')];_0x153961+=0x1){socket[_0x4b5e('0x60')]('userMailQueue:save',{'UserId':Number(_0x5808b8[_0x4b5e('0x36')]['ids'][_0x153961]),'MailQueueId':Number(_0x5808b8[_0x4b5e('0x2a')]['id'])});}return _0x357ad6;});}})[_0x4b5e('0x18')](respondWithResult(_0x555821,null))[_0x4b5e('0x29')](handleError(_0x555821,null));};exports[_0x4b5e('0x75')]=function(_0x56163f,_0x1193e7){return db['MailQueue']['find']({'where':{'id':_0x56163f['params']['id']}})['then'](handleEntityNotFound(_0x1193e7,null))[_0x4b5e('0x18')](function(_0x54ef31){if(_0x54ef31){return _0x54ef31[_0x4b5e('0x75')](_0x56163f[_0x4b5e('0x26')][_0x4b5e('0x57')])[_0x4b5e('0x18')](function(){if(_[_0x4b5e('0x7a')](_0x56163f['query'][_0x4b5e('0x57')])){for(var _0x1d1ddf=0x0;_0x1d1ddf<_0x56163f[_0x4b5e('0x26')][_0x4b5e('0x57')][_0x4b5e('0x31')];_0x1d1ddf+=0x1){socket['emit'](_0x4b5e('0x76'),{'UserId':Number(_0x56163f[_0x4b5e('0x26')][_0x4b5e('0x57')][_0x1d1ddf]),'MailQueueId':Number(_0x56163f[_0x4b5e('0x2a')]['id'])});}}else{socket['emit'](_0x4b5e('0x76'),{'UserId':Number(_0x56163f['query'][_0x4b5e('0x57')]),'MailQueueId':Number(_0x56163f[_0x4b5e('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x1193e7,null))[_0x4b5e('0x29')](handleError(_0x1193e7,null));};exports[_0x4b5e('0x7b')]=function(_0x9f9cfb,_0x3757b4){var _0x2da512={};var _0x33d72c={};var _0x5b5df7;var _0xf1cfe7;return db[_0x4b5e('0x27')]['findOne']({'where':{'id':_0x9f9cfb[_0x4b5e('0x2a')]['id']}})[_0x4b5e('0x18')](handleEntityNotFound(_0x3757b4,null))['then'](function(_0x511f4d){if(_0x511f4d){_0x5b5df7=_0x511f4d;_0x33d72c['model']=_['keys'](db[_0x4b5e('0x49')][_0x4b5e('0x21')]);_0x33d72c[_0x4b5e('0x26')]=_['keys'](_0x9f9cfb['query']);_0x33d72c['filters']=_[_0x4b5e('0x2e')](_0x33d72c[_0x4b5e('0x2b')],_0x33d72c[_0x4b5e('0x26')]);_0x2da512[_0x4b5e('0x2f')]=_['intersection'](_0x33d72c[_0x4b5e('0x2b')],qs[_0x4b5e('0x30')](_0x9f9cfb[_0x4b5e('0x26')][_0x4b5e('0x30')]));_0x2da512[_0x4b5e('0x2f')]=_0x2da512[_0x4b5e('0x2f')][_0x4b5e('0x31')]?_0x2da512[_0x4b5e('0x2f')]:_0x33d72c[_0x4b5e('0x2b')];_0x2da512['order']=qs['sort'](_0x9f9cfb[_0x4b5e('0x26')][_0x4b5e('0x44')]);_0x2da512[_0x4b5e('0x45')]=qs[_0x4b5e('0x2d')](_[_0x4b5e('0x46')](_0x9f9cfb[_0x4b5e('0x26')],_0x33d72c[_0x4b5e('0x2d')]));if(_0x9f9cfb[_0x4b5e('0x26')][_0x4b5e('0x55')]){_0x2da512[_0x4b5e('0x45')]=_['merge'](_0x2da512[_0x4b5e('0x45')],{'$or':_[_0x4b5e('0x20')](_0x2da512[_0x4b5e('0x2f')],function(_0x5825b6){var _0x56646b={};_0x56646b[_0x5825b6]={'$like':'%'+_0x9f9cfb['query'][_0x4b5e('0x55')]+'%'};return _0x56646b;})});}_0x2da512=_['merge']({},_0x2da512,_0x9f9cfb[_0x4b5e('0x33')]);return _0x5b5df7[_0x4b5e('0x7b')](_0x2da512);}})[_0x4b5e('0x18')](function(_0x1b94d2){if(_0x1b94d2){_0xf1cfe7=_0x1b94d2[_0x4b5e('0x31')];if(!_0x9f9cfb[_0x4b5e('0x26')]['hasOwnProperty']('nolimit')){_0x2da512[_0x4b5e('0x13')]=qs[_0x4b5e('0x13')](_0x9f9cfb[_0x4b5e('0x26')][_0x4b5e('0x13')]);_0x2da512[_0x4b5e('0x11')]=qs[_0x4b5e('0x11')](_0x9f9cfb['query']['offset']);}return _0x5b5df7[_0x4b5e('0x7b')](_0x2da512);}})[_0x4b5e('0x18')](function(_0x178d9f){if(_0x178d9f){return _0x178d9f?{'count':_0xf1cfe7,'rows':_0x178d9f}:null;}})[_0x4b5e('0x18')](respondWithResult(_0x3757b4,null))[_0x4b5e('0x29')](handleError(_0x3757b4,null));}; \ No newline at end of file +var _0x95f6=['get','MailQueues','UserProfileResource','error','stack','name','index','MailQueue','fieldName','type','key','getOptions','where','include','findAll','rows','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','body','describe','getMembers','findOne','hasOwnProperty','order','pick','filter','map','UserMailQueue','findAndCountAll','UserId','agent','format','SIP','mailPause','createdAt','updatedAt','getTeams','sort','Team','User','online','voicePause','flatMap','Agents','sequelize','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','removeAgents','omit','spread','isArray','userMailQueue:remove','getAgents','nolimit','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy'];(function(_0x7deec6,_0x4a071a){var _0x5e538f=function(_0x30fded){while(--_0x30fded){_0x7deec6['push'](_0x7deec6['shift']());}};_0x5e538f(++_0x4a071a);}(_0x95f6,0x1d9));var _0x695f=function(_0x47761d,_0x3f8494){_0x47761d=_0x47761d-0x0;var _0x3d1c05=_0x95f6[_0x47761d];return _0x3d1c05;};'use strict';var BPromise=require(_0x695f('0x0'));var util=require(_0x695f('0x1'));var _=require(_0x695f('0x2'));var squel=require(_0x695f('0x3'));var Redis=require(_0x695f('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x695f('0x5'))(_0x695f('0x6'));var config=require(_0x695f('0x7'));var db=require(_0x695f('0x8'))['db'];config[_0x695f('0x9')]=_[_0x695f('0xa')](config[_0x695f('0x9')],{'host':_0x695f('0xb'),'port':0x18eb});var socket=require(_0x695f('0xc'))(new Redis(config[_0x695f('0x9')]));require(_0x695f('0xd'))[_0x695f('0xe')](socket);function respondWithStatusCode(_0x22d7c9,_0x1b6910){_0x1b6910=_0x1b6910||0xcc;return function(_0x2862d8){if(_0x2862d8){return _0x22d7c9[_0x695f('0xf')](_0x1b6910);}return _0x22d7c9['status'](_0x1b6910)[_0x695f('0x10')]();};}function respondWithResult(_0x52d29c,_0x110628){_0x110628=_0x110628||0xc8;return function(_0xeda05c){if(_0xeda05c){return _0x52d29c[_0x695f('0x11')](_0x110628)['json'](_0xeda05c);}};}function respondWithFilteredResult(_0x2baaa0,_0xb0f750){return function(_0x155e32){if(_0x155e32){var _0x588aac=typeof _0xb0f750[_0x695f('0x12')]===_0x695f('0x13')&&typeof _0xb0f750[_0x695f('0x14')]===_0x695f('0x13');var _0x13e0f2=_0x155e32[_0x695f('0x15')];var _0x9a4f01=_0x588aac?0x0:_0xb0f750[_0x695f('0x12')];var _0x307845=_0x588aac?_0x155e32[_0x695f('0x15')]:_0xb0f750[_0x695f('0x12')]+_0xb0f750[_0x695f('0x14')];var _0x3f2b08;if(_0x307845>=_0x13e0f2){_0x307845=_0x13e0f2;_0x3f2b08=0xc8;}else{_0x3f2b08=0xce;}_0x2baaa0[_0x695f('0x11')](_0x3f2b08);return _0x2baaa0['set'](_0x695f('0x16'),_0x9a4f01+'-'+_0x307845+'/'+_0x13e0f2)[_0x695f('0x17')](_0x155e32);}return null;};}function saveUpdates(_0x29ed03){return function(_0x13bc0a){if(_0x13bc0a){return _0x13bc0a[_0x695f('0x18')](_0x29ed03)[_0x695f('0x19')](function(_0x630f9b){return _0x630f9b;});}return null;};}function removeEntity(_0x459f4d){return function(_0x1a544b){if(_0x1a544b){return _0x1a544b[_0x695f('0x1a')]()[_0x695f('0x19')](function(){var _0x26b207=_0x1a544b[_0x695f('0x1b')]({'plain':!![]});var _0x39aaef=_0x695f('0x1c');return db[_0x695f('0x1d')]['destroy']({'where':{'type':_0x39aaef,'resourceId':_0x26b207['id']}})[_0x695f('0x19')](function(){return _0x1a544b;});})[_0x695f('0x19')](function(){_0x459f4d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59dbbb){return function(_0x12b117){if(!_0x12b117){_0x59dbbb[_0x695f('0xf')](0x194);}return _0x12b117;};}function handleError(_0x596f46,_0x53cec9){_0x53cec9=_0x53cec9||0x1f4;return function(_0x47976c){logger[_0x695f('0x1e')](_0x47976c[_0x695f('0x1f')]);if(_0x47976c['name']){delete _0x47976c[_0x695f('0x20')];}_0x596f46[_0x695f('0x11')](_0x53cec9)['send'](_0x47976c);};}exports[_0x695f('0x21')]=function(_0x1724ef,_0x1e24ac){var _0x23fad9={};var _0x3f7b38={'count':0x0,'rows':[]};var _0x31add0=_['map'](db[_0x695f('0x22')]['rawAttributes'],function(_0x42dc3f){return{'name':_0x42dc3f[_0x695f('0x23')],'type':_0x42dc3f[_0x695f('0x24')][_0x695f('0x25')]};});_0x23fad9=qs[_0x695f('0x26')](_0x31add0,_0x1724ef);var _0x426764={'where':_0x23fad9[_0x695f('0x27')]};return db[_0x695f('0x22')][_0x695f('0x15')](_0x426764)[_0x695f('0x19')](function(_0x41df5d){_0x3f7b38[_0x695f('0x15')]=_0x41df5d;_0x23fad9['include']=qs[_0x695f('0x28')](_0x1724ef['query']);return db[_0x695f('0x22')][_0x695f('0x29')](_0x23fad9);})[_0x695f('0x19')](function(_0x2c6451){_0x3f7b38[_0x695f('0x2a')]=_0x2c6451;return _0x3f7b38;})['then'](respondWithFilteredResult(_0x1e24ac,_0x23fad9))['catch'](handleError(_0x1e24ac,null));};exports[_0x695f('0x2b')]=function(_0xf2b3e,_0x2ba8cd){var _0xbc6cd6={'raw':!![],'where':{'id':_0xf2b3e[_0x695f('0x2c')]['id']}},_0x414562={};_0x414562['model']=_[_0x695f('0x2d')](db[_0x695f('0x22')][_0x695f('0x2e')]);_0x414562[_0x695f('0x2f')]=_['keys'](_0xf2b3e[_0x695f('0x2f')]);_0x414562[_0x695f('0x30')]=_[_0x695f('0x31')](_0x414562[_0x695f('0x32')],_0x414562[_0x695f('0x2f')]);_0xbc6cd6[_0x695f('0x33')]=_[_0x695f('0x31')](_0x414562[_0x695f('0x32')],qs[_0x695f('0x34')](_0xf2b3e[_0x695f('0x2f')][_0x695f('0x34')]));_0xbc6cd6[_0x695f('0x33')]=_0xbc6cd6[_0x695f('0x33')][_0x695f('0x35')]?_0xbc6cd6['attributes']:_0x414562[_0x695f('0x32')];if(_0xf2b3e['query'][_0x695f('0x36')]){_0xbc6cd6[_0x695f('0x28')]=[{'all':!![]}];}_0xbc6cd6=_[_0x695f('0x37')]({},_0xbc6cd6,_0xf2b3e[_0x695f('0x38')]);return db[_0x695f('0x22')]['find'](_0xbc6cd6)['then'](handleEntityNotFound(_0x2ba8cd,null))['then'](respondWithResult(_0x2ba8cd,null))[_0x695f('0x39')](handleError(_0x2ba8cd,null));};exports[_0x695f('0x3a')]=function(_0x200790,_0x1f710c){return db[_0x695f('0x22')][_0x695f('0x3a')](_0x200790['body'],{})[_0x695f('0x19')](function(_0x1b981e){var _0x671f9e=_0x200790[_0x695f('0x3b')][_0x695f('0x1b')]({'plain':!![]});if(!_0x671f9e)throw new Error(_0x695f('0x3c'));if(_0x671f9e['role']===_0x695f('0x3b')){var _0x54d9fb=_0x1b981e[_0x695f('0x1b')]({'plain':!![]});var _0x25dd3e=_0x695f('0x1c');return db[_0x695f('0x3d')][_0x695f('0x3e')]({'where':{'name':_0x25dd3e,'userProfileId':_0x671f9e['userProfileId']},'raw':!![]})['then'](function(_0x212e03){if(_0x212e03&&_0x212e03[_0x695f('0x3f')]===0x0){return db[_0x695f('0x1d')][_0x695f('0x3a')]({'name':_0x54d9fb[_0x695f('0x20')],'resourceId':_0x54d9fb['id'],'type':_0x212e03[_0x695f('0x20')],'sectionId':_0x212e03['id']},{})[_0x695f('0x19')](function(){return _0x1b981e;});}else{return _0x1b981e;}})[_0x695f('0x39')](function(_0x5d5862){logger[_0x695f('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d5862);throw _0x5d5862;});}return _0x1b981e;})[_0x695f('0x19')](respondWithResult(_0x1f710c,0xc9))['catch'](handleError(_0x1f710c,null));};exports[_0x695f('0x18')]=function(_0x22ecc4,_0x454f29){if(_0x22ecc4[_0x695f('0x40')]['id']){delete _0x22ecc4[_0x695f('0x40')]['id'];}return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x22ecc4[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](handleEntityNotFound(_0x454f29,null))['then'](saveUpdates(_0x22ecc4[_0x695f('0x40')],null))[_0x695f('0x19')](respondWithResult(_0x454f29,null))['catch'](handleError(_0x454f29,null));};exports[_0x695f('0x1a')]=function(_0x187564,_0x29c2a5){return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x187564['params']['id']}})['then'](handleEntityNotFound(_0x29c2a5,null))[_0x695f('0x19')](removeEntity(_0x29c2a5,null))[_0x695f('0x39')](handleError(_0x29c2a5,null));};exports[_0x695f('0x41')]=function(_0x403b06,_0x362346){return db[_0x695f('0x22')][_0x695f('0x41')]()[_0x695f('0x19')](respondWithResult(_0x362346,null))['catch'](handleError(_0x362346,null));};exports[_0x695f('0x42')]=function(_0x38d7b4,_0x29cf31){var _0x30387d={'raw':!![],'where':{}},_0x1ea066={},_0x4bb670;return db[_0x695f('0x22')][_0x695f('0x43')]({'where':{'id':_0x38d7b4['params']['id']}})['then'](handleEntityNotFound(_0x29cf31,null))[_0x695f('0x19')](function(_0xec0748){if(_0xec0748){_0x4bb670=_0xec0748[_0x695f('0x1b')]({'plain':!![]});_0x1ea066['model']=_['keys'](db['UserMailQueue'][_0x695f('0x2e')]);_0x1ea066[_0x695f('0x2f')]=_['keys'](_0x38d7b4[_0x695f('0x2f')]);_0x1ea066[_0x695f('0x30')]=_['intersection'](_0x1ea066[_0x695f('0x32')],_0x1ea066[_0x695f('0x2f')]);_0x30387d[_0x695f('0x33')]=_['intersection'](_0x1ea066[_0x695f('0x32')],qs[_0x695f('0x34')](_0x38d7b4[_0x695f('0x2f')][_0x695f('0x34')]));_0x30387d[_0x695f('0x33')]=_0x30387d['attributes']['length']?_0x30387d[_0x695f('0x33')]:_0x1ea066[_0x695f('0x32')];if(!_0x38d7b4[_0x695f('0x2f')][_0x695f('0x44')]('nolimit')){_0x30387d[_0x695f('0x14')]=qs['limit'](_0x38d7b4['query'][_0x695f('0x14')]);_0x30387d[_0x695f('0x12')]=qs['offset'](_0x38d7b4[_0x695f('0x2f')]['offset']);}_0x30387d[_0x695f('0x45')]=qs['sort'](_0x38d7b4[_0x695f('0x2f')]['sort']);_0x30387d[_0x695f('0x27')]=qs['filters'](_[_0x695f('0x46')](_0x38d7b4['query'],_0x1ea066[_0x695f('0x30')]));_0x30387d[_0x695f('0x27')]['MailQueueId']=_0xec0748['id'];if(_0x38d7b4['query'][_0x695f('0x47')]){_0x30387d[_0x695f('0x27')]=_[_0x695f('0x37')](_0x30387d[_0x695f('0x27')],{'$or':_[_0x695f('0x48')](_0x30387d[_0x695f('0x33')],function(_0x5599a0){var _0x5bae62={};_0x5bae62[_0x5599a0]={'$like':'%'+_0x38d7b4[_0x695f('0x2f')][_0x695f('0x47')]+'%'};return _0x5bae62;})});}_0x30387d=_['merge']({},_0x30387d,_0x38d7b4[_0x695f('0x38')]);return db[_0x695f('0x49')][_0x695f('0x29')](_0x30387d);}})[_0x695f('0x19')](function(_0x2c1eaa){if(_0x2c1eaa){return db['User'][_0x695f('0x4a')]({'where':{'id':_[_0x695f('0x48')](_0x2c1eaa,_0x695f('0x4b')),'role':_0x695f('0x4c')},'attributes':['id',_0x695f('0x20'),'mailPause','updatedAt','createdAt']});}})[_0x695f('0x19')](function(_0x2700ae){if(_0x2700ae){return{'count':_0x2700ae['count'],'rows':_[_0x695f('0x48')](_0x2700ae[_0x695f('0x2a')],function(_0x42957f){return{'membername':_0x42957f['name'],'UserId':_0x42957f['id'],'queue_name':_0x4bb670[_0x695f('0x20')],'MailQueueId':_0x4bb670['id'],'interface':util[_0x695f('0x4d')]('%s/%s',_0x695f('0x4e'),_0x42957f[_0x695f('0x20')]),'penalty':0x0,'paused':_0x42957f[_0x695f('0x4f')],'createdAt':_0x42957f[_0x695f('0x50')],'updatedAt':_0x42957f[_0x695f('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x695f('0x19')](respondWithFilteredResult(_0x29cf31,_0x30387d))['catch'](handleError(_0x29cf31,null));};exports[_0x695f('0x52')]=function(_0x223afc,_0x474cbd){var _0x68abdd={};var _0x500a7b={};var _0x23bf64;var _0x1f8626;return db[_0x695f('0x22')]['findOne']({'where':{'id':_0x223afc[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](handleEntityNotFound(_0x474cbd,null))[_0x695f('0x19')](function(_0x355f01){if(_0x355f01){_0x23bf64=_0x355f01;_0x500a7b[_0x695f('0x32')]=_[_0x695f('0x2d')](db['Team'][_0x695f('0x2e')]);_0x500a7b[_0x695f('0x2f')]=_[_0x695f('0x2d')](_0x223afc[_0x695f('0x2f')]);_0x500a7b[_0x695f('0x30')]=_[_0x695f('0x31')](_0x500a7b[_0x695f('0x32')],_0x500a7b[_0x695f('0x2f')]);_0x68abdd[_0x695f('0x33')]=_[_0x695f('0x31')](_0x500a7b[_0x695f('0x32')],qs[_0x695f('0x34')](_0x223afc[_0x695f('0x2f')]['fields']));_0x68abdd[_0x695f('0x33')]=_0x68abdd[_0x695f('0x33')][_0x695f('0x35')]?_0x68abdd['attributes']:_0x500a7b[_0x695f('0x32')];_0x68abdd['order']=qs['sort'](_0x223afc[_0x695f('0x2f')][_0x695f('0x53')]);_0x68abdd['where']=qs['filters'](_[_0x695f('0x46')](_0x223afc[_0x695f('0x2f')],_0x500a7b[_0x695f('0x30')]));if(_0x223afc[_0x695f('0x2f')]['filter']){_0x68abdd['where']=_[_0x695f('0x37')](_0x68abdd[_0x695f('0x27')],{'$or':_['map'](_0x68abdd[_0x695f('0x33')],function(_0xe5b4cc){var _0x1768dd={};_0x1768dd[_0xe5b4cc]={'$like':'%'+_0x223afc[_0x695f('0x2f')]['filter']+'%'};return _0x1768dd;})});}_0x68abdd=_[_0x695f('0x37')]({},_0x68abdd,_0x223afc[_0x695f('0x38')]);return _0x23bf64[_0x695f('0x52')](_0x68abdd);}})[_0x695f('0x19')](function(_0x5b39c0){if(_0x5b39c0){_0x1f8626=_0x5b39c0[_0x695f('0x35')];if(!_0x223afc[_0x695f('0x2f')][_0x695f('0x44')]('nolimit')){_0x68abdd[_0x695f('0x14')]=qs['limit'](_0x223afc[_0x695f('0x2f')][_0x695f('0x14')]);_0x68abdd[_0x695f('0x12')]=qs['offset'](_0x223afc[_0x695f('0x2f')]['offset']);}return _0x23bf64[_0x695f('0x52')](_0x68abdd);}})[_0x695f('0x19')](function(_0x18d16b){if(_0x18d16b){return _0x18d16b?{'count':_0x1f8626,'rows':_0x18d16b}:null;}})[_0x695f('0x19')](respondWithResult(_0x474cbd,null))[_0x695f('0x39')](handleError(_0x474cbd,null));};exports['addTeams']=function(_0x527f68,_0x9a18fd){var _0x49b9c0=_0x527f68[_0x695f('0x40')]['ids'];return db[_0x695f('0x54')][_0x695f('0x29')]({'where':{'id':_0x49b9c0},'attributes':['id'],'include':[{'model':db[_0x695f('0x55')],'as':'Agents','attributes':['id','name',_0x695f('0x56'),_0x695f('0x57'),'interface'],'raw':!![]}]})['then'](function(_0x7ab569){if(_0x7ab569){var _0x3d74de=_[_0x695f('0x58')](_0x7ab569,function(_0x2df425){var _0x3f4d73=_0x2df425[_0x695f('0x1b')]({'plain':!![]});return _0x3f4d73[_0x695f('0x59')];});return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x527f68[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](function(_0x5d62fc){return db[_0x695f('0x5a')]['transaction'](function(_0x28d962){return _0x5d62fc[_0x695f('0x5b')](_0x49b9c0,{'transaction':_0x28d962})[_0x695f('0x19')](function(){return BPromise[_0x695f('0x5c')](_0x3d74de,function(_0x10358b){return db[_0x695f('0x49')][_0x695f('0x5d')]({'where':{'UserId':_0x10358b['id'],'MailQueueId':_0x527f68['params']['id']},'transaction':_0x28d962});});})[_0x695f('0x19')](function(){_0x3d74de[_0x695f('0x5e')](function(_0x54fe9b){socket[_0x695f('0x5f')](_0x695f('0x60'),{'UserId':_0x54fe9b['id'],'MailQueueId':_0x5d62fc['id']});});});});});}})[_0x695f('0x19')](respondWithStatusCode(_0x9a18fd,null))[_0x695f('0x39')](handleError(_0x9a18fd,null));};exports[_0x695f('0x61')]=function(_0x4ac87e,_0x1d8b84){return db['Team']['findAll']({'where':{'id':_0x4ac87e[_0x695f('0x2f')][_0x695f('0x62')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x695f('0x59'),'attributes':['id'],'raw':!![]}]})[_0x695f('0x19')](handleEntityNotFound(_0x1d8b84,null))[_0x695f('0x19')](function(_0x457f01){var _0x3bd0ea=_[_0x695f('0x48')](_0x457f01,'id');var _0x3055b2=[];var _0x16c5ca=[];var _0xac68dd=squel[_0x695f('0x63')]();_0xac68dd[_0x695f('0x64')](_0x695f('0x65'))[_0x695f('0x66')]('team_has_mail_queues','tq')['join'](_0x695f('0x67'),'ut',_0x695f('0x68'))[_0x695f('0x27')](_0x695f('0x69'),_0x4ac87e[_0x695f('0x2c')]['id']);for(var _0x5865bf=0x0;_0x5865bf<_0x457f01[_0x695f('0x35')];_0x5865bf+=0x1){let _0x4b2af0=_0x457f01[_0x5865bf];for(var _0x11afdb=0x0;_0x11afdb<_0x4b2af0[_0x695f('0x59')][_0x695f('0x35')];_0x11afdb+=0x1){let _0x3421fc=_0x4b2af0[_0x695f('0x59')][_0x11afdb];var _0x3311a8=_0xac68dd[_0x695f('0x6a')]();_0x3311a8['where'](_0x695f('0x6b'),_0x3421fc['id']);_0x16c5ca['push'](db[_0x695f('0x5a')][_0x695f('0x2f')](_0x3311a8[_0x695f('0x6c')](),{'type':db['sequelize'][_0x695f('0x6d')][_0x695f('0x6e')]})[_0x695f('0x19')](function(_0x3c447f){if(_0x3c447f['length']===0x1){return _0x3421fc['id'];}else{var _0x2cef49=_[_0x695f('0x6f')](_[_0x695f('0x48')](_0x3c447f,_0x695f('0x70')),function(_0x56f64a){return _[_0x695f('0x71')](_0x3bd0ea,_0x56f64a);});if(_0x2cef49){return _0x3421fc['id'];}}}));}}return BPromise[_0x695f('0x72')](_0x16c5ca)[_0x695f('0x19')](function(_0x18c18c){_0x3055b2=_(_0x3055b2)[_0x695f('0x73')](_0x18c18c)['compact']()[_0x695f('0x74')]();return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x4ac87e['params']['id']}})[_0x695f('0x19')](function(_0x401866){return db[_0x695f('0x5a')][_0x695f('0x75')](function(_0xfd97e1){return _0x401866['removeTeams'](_0x4ac87e['query'][_0x695f('0x62')],{'transaction':_0xfd97e1})[_0x695f('0x19')](function(){if(!_['isEmpty'](_0x3055b2)){return _0x401866[_0x695f('0x76')](_0x3055b2,{'transaction':_0xfd97e1});}})[_0x695f('0x19')](function(){_0x3055b2[_0x695f('0x5e')](function(_0x36c43f){socket['emit']('userMailQueue:remove',{'UserId':_0x36c43f,'MailQueueId':_0x401866['id']});});});});});});})[_0x695f('0x19')](respondWithStatusCode(_0x1d8b84,null))[_0x695f('0x39')](handleError(_0x1d8b84,null));};exports['addAgents']=function(_0x2c505a,_0x36f5bc){return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x2c505a[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](handleEntityNotFound(_0x36f5bc,null))['then'](function(_0x156d9b){if(_0x156d9b){return _0x156d9b['addAgents'](_0x2c505a[_0x695f('0x40')][_0x695f('0x62')],_[_0x695f('0x77')](_0x2c505a['body'],[_0x695f('0x62'),'id'])||{})[_0x695f('0x78')](function(_0x34f707){for(var _0x38ef0e=0x0;_0x38ef0e<_0x2c505a[_0x695f('0x40')][_0x695f('0x62')][_0x695f('0x35')];_0x38ef0e+=0x1){socket['emit'](_0x695f('0x60'),{'UserId':Number(_0x2c505a[_0x695f('0x40')][_0x695f('0x62')][_0x38ef0e]),'MailQueueId':Number(_0x2c505a[_0x695f('0x2c')]['id'])});}return _0x34f707;});}})['then'](respondWithResult(_0x36f5bc,null))[_0x695f('0x39')](handleError(_0x36f5bc,null));};exports[_0x695f('0x76')]=function(_0x1f17e7,_0x32c23a){return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x1f17e7[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](handleEntityNotFound(_0x32c23a,null))[_0x695f('0x19')](function(_0x417f02){if(_0x417f02){return _0x417f02['removeAgents'](_0x1f17e7[_0x695f('0x2f')][_0x695f('0x62')])[_0x695f('0x19')](function(){if(_[_0x695f('0x79')](_0x1f17e7[_0x695f('0x2f')][_0x695f('0x62')])){for(var _0xf55fb5=0x0;_0xf55fb5<_0x1f17e7[_0x695f('0x2f')][_0x695f('0x62')][_0x695f('0x35')];_0xf55fb5+=0x1){socket[_0x695f('0x5f')]('userMailQueue:remove',{'UserId':Number(_0x1f17e7['query']['ids'][_0xf55fb5]),'MailQueueId':Number(_0x1f17e7['params']['id'])});}}else{socket[_0x695f('0x5f')](_0x695f('0x7a'),{'UserId':Number(_0x1f17e7[_0x695f('0x2f')][_0x695f('0x62')]),'MailQueueId':Number(_0x1f17e7[_0x695f('0x2c')]['id'])});}});}})[_0x695f('0x19')](respondWithStatusCode(_0x32c23a,null))['catch'](handleError(_0x32c23a,null));};exports['getAgents']=function(_0x52f99f,_0x1ab042){var _0x6ce95c={};var _0x51220b={};var _0x47d711;var _0x56545c;return db[_0x695f('0x22')]['findOne']({'where':{'id':_0x52f99f[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](handleEntityNotFound(_0x1ab042,null))[_0x695f('0x19')](function(_0x4654ad){if(_0x4654ad){_0x47d711=_0x4654ad;_0x51220b[_0x695f('0x32')]=_['keys'](db['User'][_0x695f('0x2e')]);_0x51220b[_0x695f('0x2f')]=_['keys'](_0x52f99f[_0x695f('0x2f')]);_0x51220b[_0x695f('0x30')]=_[_0x695f('0x31')](_0x51220b['model'],_0x51220b['query']);_0x6ce95c[_0x695f('0x33')]=_['intersection'](_0x51220b[_0x695f('0x32')],qs[_0x695f('0x34')](_0x52f99f[_0x695f('0x2f')][_0x695f('0x34')]));_0x6ce95c[_0x695f('0x33')]=_0x6ce95c[_0x695f('0x33')][_0x695f('0x35')]?_0x6ce95c[_0x695f('0x33')]:_0x51220b[_0x695f('0x32')];_0x6ce95c[_0x695f('0x45')]=qs['sort'](_0x52f99f[_0x695f('0x2f')]['sort']);_0x6ce95c[_0x695f('0x27')]=qs[_0x695f('0x30')](_[_0x695f('0x46')](_0x52f99f['query'],_0x51220b[_0x695f('0x30')]));if(_0x52f99f[_0x695f('0x2f')][_0x695f('0x47')]){_0x6ce95c[_0x695f('0x27')]=_[_0x695f('0x37')](_0x6ce95c[_0x695f('0x27')],{'$or':_[_0x695f('0x48')](_0x6ce95c[_0x695f('0x33')],function(_0x5b4327){var _0x44f05d={};_0x44f05d[_0x5b4327]={'$like':'%'+_0x52f99f[_0x695f('0x2f')][_0x695f('0x47')]+'%'};return _0x44f05d;})});}_0x6ce95c=_[_0x695f('0x37')]({},_0x6ce95c,_0x52f99f[_0x695f('0x38')]);return _0x47d711[_0x695f('0x7b')](_0x6ce95c);}})[_0x695f('0x19')](function(_0x56a525){if(_0x56a525){_0x56545c=_0x56a525[_0x695f('0x35')];if(!_0x52f99f[_0x695f('0x2f')][_0x695f('0x44')](_0x695f('0x7c'))){_0x6ce95c[_0x695f('0x14')]=qs[_0x695f('0x14')](_0x52f99f[_0x695f('0x2f')][_0x695f('0x14')]);_0x6ce95c[_0x695f('0x12')]=qs[_0x695f('0x12')](_0x52f99f[_0x695f('0x2f')][_0x695f('0x12')]);}return _0x47d711[_0x695f('0x7b')](_0x6ce95c);}})[_0x695f('0x19')](function(_0x5ee93a){if(_0x5ee93a){return _0x5ee93a?{'count':_0x56545c,'rows':_0x5ee93a}:null;}})[_0x695f('0x19')](respondWithResult(_0x1ab042,null))[_0x695f('0x39')](handleError(_0x1ab042,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c6c50b0..ffdfb6e 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 _0x3d2a=['hook','exports','events','save','update','remove','emit','hasOwnProperty'];(function(_0x1bee5e,_0x841de6){var _0x1955cd=function(_0x292282){while(--_0x292282){_0x1bee5e['push'](_0x1bee5e['shift']());}};_0x1955cd(++_0x841de6);}(_0x3d2a,0x11a));var _0xa3d2=function(_0x1937c8,_0x5a1f28){_0x1937c8=_0x1937c8-0x0;var _0x48bedf=_0x3d2a[_0x1937c8];return _0x48bedf;};'use strict';var EventEmitter=require(_0xa3d2('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa3d2('0x1'),'afterUpdate':_0xa3d2('0x2'),'afterDestroy':_0xa3d2('0x3')};function emitEvent(_0x2f5c02){return function(_0x190819,_0x209820,_0x4852ea){MailQueueEvents[_0xa3d2('0x4')](_0x2f5c02+':'+_0x190819['id'],_0x190819);MailQueueEvents[_0xa3d2('0x4')](_0x2f5c02,_0x190819);_0x4852ea(null);};}for(var e in events){if(events[_0xa3d2('0x5')](e)){var event=events[e];MailQueue[_0xa3d2('0x6')](e,emitEvent(event));}}module[_0xa3d2('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x1c13=['MailQueue','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1c13,0x1c9));var _0x31c1=function(_0x34da88,_0x5f2281){_0x34da88=_0x34da88-0x0;var _0x1fe876=_0x1c13[_0x34da88];return _0x1fe876;};'use strict';var EventEmitter=require(_0x31c1('0x0'));var MailQueue=require(_0x31c1('0x1'))['db'][_0x31c1('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x31c1('0x3'),'afterUpdate':_0x31c1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3d5d53){return function(_0x231fa1,_0x18f6a4,_0x3b7013){MailQueueEvents[_0x31c1('0x5')](_0x3d5d53+':'+_0x231fa1['id'],_0x231fa1);MailQueueEvents[_0x31c1('0x5')](_0x3d5d53,_0x231fa1);_0x3b7013(null);};}for(var e in events){if(events[_0x31c1('0x6')](e)){var event=events[e];MailQueue[_0x31c1('0x7')](e,emitEvent(event));}}module[_0x31c1('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index b9932e1..c866d38 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 _0x106c=['MailQueue','mail_queues','util','../../config/logger','api','moment','../../config/environment','./mailQueue.attributes','exports'];(function(_0x3e52dc,_0x24306f){var _0x6061fa=function(_0x2ce6d9){while(--_0x2ce6d9){_0x3e52dc['push'](_0x3e52dc['shift']());}};_0x6061fa(++_0x24306f);}(_0x106c,0x1d6));var _0xc106=function(_0x50b433,_0x45a76a){_0x50b433=_0x50b433-0x0;var _0x569230=_0x106c[_0x50b433];return _0x569230;};'use strict';var _=require('lodash');var util=require(_0xc106('0x0'));var logger=require(_0xc106('0x1'))(_0xc106('0x2'));var moment=require(_0xc106('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(_0xc106('0x4'));var attributes=require(_0xc106('0x5'));module[_0xc106('0x6')]=function(_0x1f1c41,_0x2bc799){return _0x1f1c41['define'](_0xc106('0x7'),attributes,{'tableName':_0xc106('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9115=['path','../../config/environment','exports','define','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9115,0x1c1));var _0x5911=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x9115[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x5911('0x0'));var util=require(_0x5911('0x1'));var logger=require(_0x5911('0x2'))(_0x5911('0x3'));var moment=require(_0x5911('0x4'));var BPromise=require(_0x5911('0x5'));var rp=require(_0x5911('0x6'));var fs=require('fs');var path=require(_0x5911('0x7'));var rimraf=require('rimraf');var config=require(_0x5911('0x8'));var attributes=require('./mailQueue.attributes');module[_0x5911('0x9')]=function(_0x221d02,_0x19f782){return _0x221d02[_0x5911('0xa')]('MailQueue',attributes,{'tableName':_0x5911('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index c0f2337..55e4b23 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 _0x1374=['debug','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','MailQueue','findAll','options','where','attributes','limit','map','model','include','GetMailQueue','ShowMailQueue','find','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request\x20sent'];(function(_0x7e5fed,_0x2d0a98){var _0x294bc7=function(_0x12d1d0){while(--_0x12d1d0){_0x7e5fed['push'](_0x7e5fed['shift']());}};_0x294bc7(++_0x2d0a98);}(_0x1374,0xba));var _0x4137=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x1374[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x4137('0x0'));var util=require(_0x4137('0x1'));var moment=require(_0x4137('0x2'));var BPromise=require(_0x4137('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4137('0x4'));var db=require(_0x4137('0x5'))['db'];var utils=require(_0x4137('0x6'));var logger=require(_0x4137('0x7'))(_0x4137('0x8'));var config=require(_0x4137('0x9'));var jayson=require(_0x4137('0xa'));var client=jayson['client'][_0x4137('0xb')]({'port':0x232a});config[_0x4137('0xc')]=_[_0x4137('0xd')](config[_0x4137('0xc')],{'host':_0x4137('0xe'),'port':0x18eb});var socket=require(_0x4137('0xf'))(new Redis(config[_0x4137('0xc')]));require(_0x4137('0x10'))[_0x4137('0x11')](socket);function respondWithRpcPromise(_0x1b15ad,_0x868b54,_0x7d0fb9){return new BPromise(function(_0x40cfb3,_0x92bb79){return client['request'](_0x1b15ad,_0x7d0fb9)['then'](function(_0x1bf914){logger['info']('MailQueue,\x20%s,\x20%s',_0x868b54,_0x4137('0x12'));logger[_0x4137('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x868b54,'request\x20sent',JSON[_0x4137('0x14')](_0x1bf914));if(_0x1bf914[_0x4137('0x15')]){if(_0x1bf914[_0x4137('0x15')][_0x4137('0x16')]===0x1f4){logger[_0x4137('0x15')](_0x4137('0x17'),_0x868b54,_0x1bf914['error'][_0x4137('0x18')]);return _0x92bb79(_0x1bf914[_0x4137('0x15')][_0x4137('0x18')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x868b54,_0x1bf914[_0x4137('0x15')]['message']);return _0x40cfb3(_0x1bf914['error']['message']);}else{logger[_0x4137('0x19')]('MailQueue,\x20%s,\x20%s',_0x868b54,_0x4137('0x12'));_0x40cfb3(_0x1bf914[_0x4137('0x1a')]['message']);}})[_0x4137('0x1b')](function(_0x4d8ffa){logger[_0x4137('0x15')](_0x4137('0x17'),_0x868b54,_0x4d8ffa);_0x92bb79(_0x4d8ffa);});});}exports['GetMailQueue']=function(_0x1b9390){var _0x25bca0=this;return new Promise(function(_0xd368f,_0x27ac3c){return db[_0x4137('0x1c')][_0x4137('0x1d')]({'raw':_0x1b9390['options']?_0x1b9390[_0x4137('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1b9390[_0x4137('0x1e')]?_0x1b9390[_0x4137('0x1e')][_0x4137('0x1f')]||null:null,'attributes':_0x1b9390[_0x4137('0x1e')]?_0x1b9390['options'][_0x4137('0x20')]||null:null,'limit':_0x1b9390[_0x4137('0x1e')]?_0x1b9390['options'][_0x4137('0x21')]||null:null,'include':_0x1b9390['options']?_0x1b9390[_0x4137('0x1e')]['include']?_[_0x4137('0x22')](_0x1b9390[_0x4137('0x1e')]['include'],function(_0x211ce6){return{'model':db[_0x211ce6[_0x4137('0x23')]],'as':_0x211ce6['as'],'attributes':_0x211ce6[_0x4137('0x20')],'include':_0x211ce6[_0x4137('0x24')]?_[_0x4137('0x22')](_0x211ce6[_0x4137('0x24')],function(_0x91e970){return{'model':db[_0x91e970[_0x4137('0x23')]],'as':_0x91e970['as'],'attributes':_0x91e970[_0x4137('0x20')],'include':_0x91e970[_0x4137('0x24')]?_[_0x4137('0x22')](_0x91e970[_0x4137('0x24')],function(_0x20a8bc){return{'model':db[_0x20a8bc[_0x4137('0x23')]],'as':_0x20a8bc['as'],'attributes':_0x20a8bc[_0x4137('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31e490){logger[_0x4137('0x19')]('GetMailQueue',_0x1b9390);logger[_0x4137('0x13')](_0x4137('0x25'),_0x1b9390,JSON[_0x4137('0x14')](_0x31e490));_0xd368f(_0x31e490);})[_0x4137('0x1b')](function(_0x1a711e){logger[_0x4137('0x15')](_0x4137('0x25'),_0x1a711e[_0x4137('0x18')],_0x1b9390);_0x27ac3c(_0x25bca0['error'](0x1f4,_0x1a711e[_0x4137('0x18')]));});});};exports[_0x4137('0x26')]=function(_0xa3fdb3){var _0x2e785b=this;return new Promise(function(_0x597194,_0x1be3c4){return db[_0x4137('0x1c')][_0x4137('0x27')]({'raw':_0xa3fdb3[_0x4137('0x1e')]?_0xa3fdb3[_0x4137('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xa3fdb3[_0x4137('0x1e')]?_0xa3fdb3[_0x4137('0x1e')]['where']||null:null,'attributes':_0xa3fdb3['options']?_0xa3fdb3[_0x4137('0x1e')][_0x4137('0x20')]||null:null,'include':_0xa3fdb3[_0x4137('0x1e')]?_0xa3fdb3[_0x4137('0x1e')][_0x4137('0x24')]?_['map'](_0xa3fdb3[_0x4137('0x1e')][_0x4137('0x24')],function(_0x401e89){return{'model':db[_0x401e89[_0x4137('0x23')]],'as':_0x401e89['as'],'attributes':_0x401e89[_0x4137('0x20')],'include':_0x401e89['include']?_[_0x4137('0x22')](_0x401e89[_0x4137('0x24')],function(_0x452dbe){return{'model':db[_0x452dbe['model']],'as':_0x452dbe['as'],'attributes':_0x452dbe['attributes'],'include':_0x452dbe[_0x4137('0x24')]?_[_0x4137('0x22')](_0x452dbe['include'],function(_0xc8e72){return{'model':db[_0xc8e72[_0x4137('0x23')]],'as':_0xc8e72['as'],'attributes':_0xc8e72[_0x4137('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4137('0x28')](function(_0x5afc9e){logger[_0x4137('0x19')]('ShowMailQueue',_0xa3fdb3);logger[_0x4137('0x13')](_0x4137('0x26'),_0xa3fdb3,JSON[_0x4137('0x14')](_0x5afc9e));_0x597194(_0x5afc9e);})['catch'](function(_0x571ac1){logger['error']('ShowMailQueue',_0x571ac1[_0x4137('0x18')],_0xa3fdb3);_0x1be3c4(_0x2e785b[_0x4137('0x15')](0x1f4,_0x571ac1[_0x4137('0x18')]));});});}; \ No newline at end of file +var _0x1202=['model','GetMailQueue','debug','catch','ShowMailQueue','MailQueue','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x1202,0x11c));var _0x2120=function(_0x15a6c2,_0x1553f8){_0x15a6c2=_0x15a6c2-0x0;var _0x35fadc=_0x1202[_0x15a6c2];return _0x35fadc;};'use strict';var _=require(_0x2120('0x0'));var util=require(_0x2120('0x1'));var moment=require(_0x2120('0x2'));var BPromise=require(_0x2120('0x3'));var rs=require(_0x2120('0x4'));var fs=require('fs');var Redis=require(_0x2120('0x5'));var db=require(_0x2120('0x6'))['db'];var utils=require(_0x2120('0x7'));var logger=require(_0x2120('0x8'))(_0x2120('0x9'));var config=require(_0x2120('0xa'));var jayson=require(_0x2120('0xb'));var client=jayson[_0x2120('0xc')][_0x2120('0xd')]({'port':0x232a});config[_0x2120('0xe')]=_[_0x2120('0xf')](config[_0x2120('0xe')],{'host':_0x2120('0x10'),'port':0x18eb});var socket=require(_0x2120('0x11'))(new Redis(config['redis']));require(_0x2120('0x12'))[_0x2120('0x13')](socket);function respondWithRpcPromise(_0x333c54,_0x204fbd,_0x31986f){return new BPromise(function(_0x5c89f5,_0x43c3d0){return client[_0x2120('0x14')](_0x333c54,_0x31986f)[_0x2120('0x15')](function(_0x3cd502){logger[_0x2120('0x16')](_0x2120('0x17'),_0x204fbd,'request\x20sent');logger['debug'](_0x2120('0x18'),_0x204fbd,_0x2120('0x19'),JSON['stringify'](_0x3cd502));if(_0x3cd502[_0x2120('0x1a')]){if(_0x3cd502[_0x2120('0x1a')][_0x2120('0x1b')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x204fbd,_0x3cd502[_0x2120('0x1a')]['message']);return _0x43c3d0(_0x3cd502[_0x2120('0x1a')][_0x2120('0x1c')]);}logger[_0x2120('0x1a')](_0x2120('0x17'),_0x204fbd,_0x3cd502['error'][_0x2120('0x1c')]);return _0x5c89f5(_0x3cd502[_0x2120('0x1a')][_0x2120('0x1c')]);}else{logger[_0x2120('0x16')](_0x2120('0x17'),_0x204fbd,_0x2120('0x19'));_0x5c89f5(_0x3cd502[_0x2120('0x1d')][_0x2120('0x1c')]);}})['catch'](function(_0x11d93b){logger[_0x2120('0x1a')](_0x2120('0x17'),_0x204fbd,_0x11d93b);_0x43c3d0(_0x11d93b);});});}exports['GetMailQueue']=function(_0x1b8d86){var _0x40eadc=this;return new Promise(function(_0x562734,_0x15bab7){return db['MailQueue'][_0x2120('0x1e')]({'raw':_0x1b8d86[_0x2120('0x1f')]?_0x1b8d86[_0x2120('0x1f')][_0x2120('0x20')]===undefined?!![]:![]:!![],'where':_0x1b8d86[_0x2120('0x1f')]?_0x1b8d86[_0x2120('0x1f')][_0x2120('0x21')]||null:null,'attributes':_0x1b8d86[_0x2120('0x1f')]?_0x1b8d86[_0x2120('0x1f')][_0x2120('0x22')]||null:null,'limit':_0x1b8d86[_0x2120('0x1f')]?_0x1b8d86[_0x2120('0x1f')][_0x2120('0x23')]||null:null,'include':_0x1b8d86[_0x2120('0x1f')]?_0x1b8d86['options'][_0x2120('0x24')]?_[_0x2120('0x25')](_0x1b8d86[_0x2120('0x1f')][_0x2120('0x24')],function(_0x38a90a){return{'model':db[_0x38a90a[_0x2120('0x26')]],'as':_0x38a90a['as'],'attributes':_0x38a90a['attributes'],'include':_0x38a90a['include']?_[_0x2120('0x25')](_0x38a90a[_0x2120('0x24')],function(_0x4d3c1c){return{'model':db[_0x4d3c1c['model']],'as':_0x4d3c1c['as'],'attributes':_0x4d3c1c[_0x2120('0x22')],'include':_0x4d3c1c[_0x2120('0x24')]?_[_0x2120('0x25')](_0x4d3c1c[_0x2120('0x24')],function(_0x2d4a58){return{'model':db[_0x2d4a58[_0x2120('0x26')]],'as':_0x2d4a58['as'],'attributes':_0x2d4a58['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x36657b){logger['info'](_0x2120('0x27'),_0x1b8d86);logger[_0x2120('0x28')](_0x2120('0x27'),_0x1b8d86,JSON['stringify'](_0x36657b));_0x562734(_0x36657b);})[_0x2120('0x29')](function(_0x17efa8){logger[_0x2120('0x1a')](_0x2120('0x27'),_0x17efa8['message'],_0x1b8d86);_0x15bab7(_0x40eadc[_0x2120('0x1a')](0x1f4,_0x17efa8[_0x2120('0x1c')]));});});};exports[_0x2120('0x2a')]=function(_0x1a9761){var _0x3f83f1=this;return new Promise(function(_0x2a7e47,_0x306021){return db[_0x2120('0x2b')][_0x2120('0x2c')]({'raw':_0x1a9761[_0x2120('0x1f')]?_0x1a9761[_0x2120('0x1f')][_0x2120('0x20')]===undefined?!![]:![]:!![],'where':_0x1a9761[_0x2120('0x1f')]?_0x1a9761[_0x2120('0x1f')][_0x2120('0x21')]||null:null,'attributes':_0x1a9761[_0x2120('0x1f')]?_0x1a9761[_0x2120('0x1f')][_0x2120('0x22')]||null:null,'include':_0x1a9761['options']?_0x1a9761[_0x2120('0x1f')][_0x2120('0x24')]?_[_0x2120('0x25')](_0x1a9761['options'][_0x2120('0x24')],function(_0x5a7674){return{'model':db[_0x5a7674[_0x2120('0x26')]],'as':_0x5a7674['as'],'attributes':_0x5a7674[_0x2120('0x22')],'include':_0x5a7674[_0x2120('0x24')]?_[_0x2120('0x25')](_0x5a7674['include'],function(_0x33edeb){return{'model':db[_0x33edeb[_0x2120('0x26')]],'as':_0x33edeb['as'],'attributes':_0x33edeb['attributes'],'include':_0x33edeb[_0x2120('0x24')]?_['map'](_0x33edeb['include'],function(_0x1e244c){return{'model':db[_0x1e244c[_0x2120('0x26')]],'as':_0x1e244c['as'],'attributes':_0x1e244c[_0x2120('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2120('0x15')](function(_0x52d1aa){logger[_0x2120('0x16')](_0x2120('0x2a'),_0x1a9761);logger['debug']('ShowMailQueue',_0x1a9761,JSON[_0x2120('0x2d')](_0x52d1aa));_0x2a7e47(_0x52d1aa);})[_0x2120('0x29')](function(_0x34fe62){logger[_0x2120('0x1a')](_0x2120('0x2a'),_0x34fe62[_0x2120('0x1c')],_0x1a9761);_0x306021(_0x3f83f1[_0x2120('0x1a')](0x1f4,_0x34fe62['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4610451..d396a1e 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 _0x4b1b=['remove','update','emit','length','mailQueue:','./mailQueue.events','save'];(function(_0x108ecc,_0x4a8994){var _0x30e54e=function(_0x2d2612){while(--_0x2d2612){_0x108ecc['push'](_0x108ecc['shift']());}};_0x30e54e(++_0x4a8994);}(_0x4b1b,0x17f));var _0xb4b1=function(_0xe99116,_0x2d6f73){_0xe99116=_0xe99116-0x0;var _0x184b95=_0x4b1b[_0xe99116];return _0x184b95;};'use strict';var MailQueueEvents=require(_0xb4b1('0x0'));var events=[_0xb4b1('0x1'),_0xb4b1('0x2'),_0xb4b1('0x3')];function createListener(_0x3710bb,_0x14d327){return function(_0x198c8c){_0x14d327[_0xb4b1('0x4')](_0x3710bb,_0x198c8c);};}function removeListener(_0x88fd21,_0x5a1435){return function(){MailQueueEvents['removeListener'](_0x88fd21,_0x5a1435);};}exports['register']=function(_0x49ddcd){for(var _0x2b28b4=0x0,_0x7d6283=events[_0xb4b1('0x5')];_0x2b28b4<_0x7d6283;_0x2b28b4++){var _0xfeb13a=events[_0x2b28b4];var _0x2903d3=createListener(_0xb4b1('0x6')+_0xfeb13a,_0x49ddcd);MailQueueEvents['on'](_0xfeb13a,_0x2903d3);}}; \ No newline at end of file +var _0x1ad2=['register','length','mailQueue:','./mailQueue.events','save','remove','emit','removeListener'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1ad2,0x19b));var _0x21ad=function(_0x1e89c1,_0x3ef6e1){_0x1e89c1=_0x1e89c1-0x0;var _0xffbc2=_0x1ad2[_0x1e89c1];return _0xffbc2;};'use strict';var MailQueueEvents=require(_0x21ad('0x0'));var events=[_0x21ad('0x1'),_0x21ad('0x2'),'update'];function createListener(_0x5aa815,_0x4b5ebe){return function(_0x5a166a){_0x4b5ebe[_0x21ad('0x3')](_0x5aa815,_0x5a166a);};}function removeListener(_0x3fd6e6,_0xd26d0e){return function(){MailQueueEvents[_0x21ad('0x4')](_0x3fd6e6,_0xd26d0e);};}exports[_0x21ad('0x5')]=function(_0x3816a9){for(var _0x5a70f5=0x0,_0x375aec=events[_0x21ad('0x6')];_0x5a70f5<_0x375aec;_0x5a70f5++){var _0x3aca19=events[_0x5a70f5];var _0x4bba32=createListener(_0x21ad('0x7')+_0x3aca19,_0x3816a9);MailQueueEvents['on'](_0x3aca19,_0x4bba32);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 0e5ebab..17d0a88 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 _0xc687=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','get','isAuthenticated','describe','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1a7118,_0xf21148){var _0xf8eff4=function(_0x21d3d8){while(--_0x21d3d8){_0x1a7118['push'](_0x1a7118['shift']());}};_0xf8eff4(++_0xf21148);}(_0xc687,0x1b2));var _0x7c68=function(_0x3f10d0,_0x2f7826){_0x3f10d0=_0x3f10d0-0x0;var _0x2bbcb1=_0xc687[_0x3f10d0];return _0x2bbcb1;};'use strict';var multer=require(_0x7c68('0x0'));var util=require(_0x7c68('0x1'));var path=require(_0x7c68('0x2'));var timeout=require(_0x7c68('0x3'));var express=require(_0x7c68('0x4'));var router=express[_0x7c68('0x5')]();var fs_extra=require(_0x7c68('0x6'));var auth=require(_0x7c68('0x7'));var interaction=require(_0x7c68('0x8'));var config=require(_0x7c68('0x9'));var controller=require(_0x7c68('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x7c68('0xb')]);router[_0x7c68('0xc')]('/describe',auth[_0x7c68('0xd')](),controller[_0x7c68('0xe')]);router[_0x7c68('0xc')]('/:id',auth[_0x7c68('0xd')](),controller['show']);router['post']('/',auth[_0x7c68('0xd')](),controller[_0x7c68('0xf')]);router['put'](_0x7c68('0x10'),auth[_0x7c68('0xd')](),controller[_0x7c68('0x11')]);router['delete'](_0x7c68('0x10'),auth[_0x7c68('0xd')](),controller[_0x7c68('0x12')]);module[_0x7c68('0x13')]=router; \ No newline at end of file +var _0xa6d2=['create','put','update','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x163c25,_0x1952a6){var _0x2cf45f=function(_0x58e936){while(--_0x58e936){_0x163c25['push'](_0x163c25['shift']());}};_0x2cf45f(++_0x1952a6);}(_0xa6d2,0x131));var _0x2a6d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa6d2[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x2a6d('0x0'));var util=require('util');var path=require(_0x2a6d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2a6d('0x2'));var auth=require(_0x2a6d('0x3'));var interaction=require(_0x2a6d('0x4'));var config=require(_0x2a6d('0x5'));var controller=require(_0x2a6d('0x6'));router[_0x2a6d('0x7')]('/',auth[_0x2a6d('0x8')](),controller[_0x2a6d('0x9')]);router[_0x2a6d('0x7')](_0x2a6d('0xa'),auth[_0x2a6d('0x8')](),controller[_0x2a6d('0xb')]);router[_0x2a6d('0x7')](_0x2a6d('0xc'),auth[_0x2a6d('0x8')](),controller[_0x2a6d('0xd')]);router[_0x2a6d('0xe')]('/',auth[_0x2a6d('0x8')](),controller[_0x2a6d('0xf')]);router[_0x2a6d('0x10')]('/:id',auth[_0x2a6d('0x8')](),controller[_0x2a6d('0x11')]);router['delete'](_0x2a6d('0xc'),auth[_0x2a6d('0x8')](),controller[_0x2a6d('0x12')]);module[_0x2a6d('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index b7278b0..9487a15 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 _0xd9e5=['exports','STRING','DATE','moment','sequelize'];(function(_0x7f14eb,_0x293155){var _0x554bff=function(_0x43ed25){while(--_0x43ed25){_0x7f14eb['push'](_0x7f14eb['shift']());}};_0x554bff(++_0x293155);}(_0xd9e5,0x19d));var _0x5d9e=function(_0x51b94b,_0x38fa2e){_0x51b94b=_0x51b94b-0x0;var _0x1900b5=_0xd9e5[_0x51b94b];return _0x1900b5;};'use strict';var moment=require(_0x5d9e('0x0'));var Sequelize=require(_0x5d9e('0x1'));module[_0x5d9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5d9e('0x3')]},'joinAt':{'type':Sequelize[_0x5d9e('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5d9e('0x4')]},'exitAt':{'type':Sequelize[_0x5d9e('0x4')]},'reason':{'type':Sequelize[_0x5d9e('0x3')]}}; \ No newline at end of file +var _0xf2a5=['sequelize','exports','DATE','STRING'];(function(_0x1d6a26,_0x1de4f2){var _0x27527c=function(_0x7ab7c6){while(--_0x7ab7c6){_0x1d6a26['push'](_0x1d6a26['shift']());}};_0x27527c(++_0x1de4f2);}(_0xf2a5,0xc8));var _0x5f2a=function(_0x906657,_0x415967){_0x906657=_0x906657-0x0;var _0x28535e=_0xf2a5[_0x906657];return _0x28535e;};'use strict';var moment=require('moment');var Sequelize=require(_0x5f2a('0x0'));module[_0x5f2a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5f2a('0x2')]},'exitAt':{'type':Sequelize[_0x5f2a('0x2')]},'reason':{'type':Sequelize[_0x5f2a('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 98774fb..6ab7c7f 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 _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','MailQueueReport','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x11bfb5,_0x3e8e81){var _0x3aca7f=function(_0x5336e7){while(--_0x5336e7){_0x11bfb5['push'](_0x11bfb5['shift']());}};_0x3aca7f(++_0x3e8e81);}(_0x4975,0x86));var _0x5497=function(_0x4fb3d7,_0x1fdb34){_0x4fb3d7=_0x4fb3d7-0x0;var _0x26a6d2=_0x4975[_0x4fb3d7];return _0x26a6d2;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['MailQueueReport']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['MailQueueReport'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['MailQueueReport'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file +var _0x7bd0=['model','name','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','MailQueueReport','findAll','rows','show','keys','length','includeAll','find','catch','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','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x24f0b0,_0x4c9360){var _0x30a697=function(_0x1e1f24){while(--_0x1e1f24){_0x24f0b0['push'](_0x24f0b0['shift']());}};_0x30a697(++_0x4c9360);}(_0x7bd0,0x111));var _0x07bd=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x7bd0[_0x20cf8a];return _0x54e165;};'use strict';var emlformat=require(_0x07bd('0x0'));var rimraf=require(_0x07bd('0x1'));var zipdir=require(_0x07bd('0x2'));var jsonpatch=require(_0x07bd('0x3'));var rp=require(_0x07bd('0x4'));var moment=require(_0x07bd('0x5'));var BPromise=require(_0x07bd('0x6'));var Mustache=require(_0x07bd('0x7'));var util=require('util');var path=require(_0x07bd('0x8'));var sox=require(_0x07bd('0x9'));var csv=require(_0x07bd('0xa'));var ejs=require(_0x07bd('0xb'));var fs=require('fs');var fs_extra=require(_0x07bd('0xc'));var _=require(_0x07bd('0xd'));var squel=require(_0x07bd('0xe'));var crypto=require('crypto');var jsforce=require(_0x07bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07bd('0xa'));var querystring=require(_0x07bd('0x10'));var Papa=require(_0x07bd('0x11'));var Redis=require('ioredis');var authService=require(_0x07bd('0x12'));var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require(_0x07bd('0x15'));var logger=require('../../config/logger')(_0x07bd('0x16'));var utils=require(_0x07bd('0x17'));var config=require(_0x07bd('0x18'));var licenseUtil=require(_0x07bd('0x19'));var db=require(_0x07bd('0x1a'))['db'];function respondWithStatusCode(_0x1eff6c,_0x10aa2e){_0x10aa2e=_0x10aa2e||0xcc;return function(_0x2b8409){if(_0x2b8409){return _0x1eff6c['sendStatus'](_0x10aa2e);}return _0x1eff6c['status'](_0x10aa2e)[_0x07bd('0x1b')]();};}function respondWithResult(_0x3fe523,_0x1c59c2){_0x1c59c2=_0x1c59c2||0xc8;return function(_0x247f3f){if(_0x247f3f){return _0x3fe523[_0x07bd('0x1c')](_0x1c59c2)[_0x07bd('0x1d')](_0x247f3f);}};}function respondWithFilteredResult(_0x2c9166,_0x49d962){return function(_0x418444){if(_0x418444){var _0x505839=typeof _0x49d962[_0x07bd('0x1e')]===_0x07bd('0x1f')&&typeof _0x49d962[_0x07bd('0x20')]===_0x07bd('0x1f');var _0x8aa645=_0x418444['count'];var _0x3f9f0b=_0x505839?0x0:_0x49d962[_0x07bd('0x1e')];var _0x4948f4=_0x505839?_0x418444[_0x07bd('0x21')]:_0x49d962[_0x07bd('0x1e')]+_0x49d962[_0x07bd('0x20')];var _0x2fcc59;if(_0x4948f4>=_0x8aa645){_0x4948f4=_0x8aa645;_0x2fcc59=0xc8;}else{_0x2fcc59=0xce;}_0x2c9166[_0x07bd('0x1c')](_0x2fcc59);return _0x2c9166[_0x07bd('0x22')](_0x07bd('0x23'),_0x3f9f0b+'-'+_0x4948f4+'/'+_0x8aa645)[_0x07bd('0x1d')](_0x418444);}return null;};}function patchUpdates(_0x29a52e){return function(_0x50109f){try{jsonpatch[_0x07bd('0x24')](_0x50109f,_0x29a52e,!![]);}catch(_0x227807){return BPromise[_0x07bd('0x25')](_0x227807);}return _0x50109f[_0x07bd('0x26')]();};}function saveUpdates(_0x16d0e6,_0x47bd50){return function(_0x4c673a){if(_0x4c673a){return _0x4c673a[_0x07bd('0x27')](_0x16d0e6)['then'](function(_0x2b0dee){return _0x2b0dee;});}return null;};}function removeEntity(_0x480c9c,_0x50bd12){return function(_0x4165bc){if(_0x4165bc){return _0x4165bc[_0x07bd('0x28')]()[_0x07bd('0x29')](function(){_0x480c9c[_0x07bd('0x1c')](0xcc)[_0x07bd('0x1b')]();});}};}function handleEntityNotFound(_0x43cbc8,_0x557042){return function(_0x180b43){if(!_0x180b43){_0x43cbc8[_0x07bd('0x2a')](0x194);}return _0x180b43;};}function handleError(_0x3db9d0,_0x2a7202){_0x2a7202=_0x2a7202||0x1f4;return function(_0x12ce26){logger[_0x07bd('0x2b')](_0x12ce26['stack']);if(_0x12ce26['name']){delete _0x12ce26['name'];}_0x3db9d0[_0x07bd('0x1c')](_0x2a7202)[_0x07bd('0x2c')](_0x12ce26);};}exports[_0x07bd('0x2d')]=function(_0x51efa8,_0x1a3aa9){var _0x400cc0={},_0x253dc0={},_0x46ed12={'count':0x0,'rows':[]};var _0x3f9424=_[_0x07bd('0x2e')](db['MailQueueReport'][_0x07bd('0x2f')],function(_0x20cc94){return{'name':_0x20cc94[_0x07bd('0x30')],'type':_0x20cc94[_0x07bd('0x31')][_0x07bd('0x32')]};});_0x253dc0[_0x07bd('0x33')]=_[_0x07bd('0x2e')](_0x3f9424,_0x07bd('0x34'));_0x253dc0['query']=_['keys'](_0x51efa8[_0x07bd('0x35')]);_0x253dc0[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x253dc0['model'],_0x253dc0[_0x07bd('0x35')]);_0x400cc0[_0x07bd('0x38')]=_[_0x07bd('0x37')](_0x253dc0['model'],qs['fields'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x39')]));_0x400cc0[_0x07bd('0x38')]=_0x400cc0[_0x07bd('0x38')]['length']?_0x400cc0[_0x07bd('0x38')]:_0x253dc0[_0x07bd('0x33')];if(!_0x51efa8[_0x07bd('0x35')]['hasOwnProperty'](_0x07bd('0x3a'))){_0x400cc0[_0x07bd('0x20')]=qs['limit'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x20')]);_0x400cc0[_0x07bd('0x1e')]=qs[_0x07bd('0x1e')](_0x51efa8['query']['offset']);}_0x400cc0[_0x07bd('0x3b')]=qs['sort'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3c')]);_0x400cc0[_0x07bd('0x3d')]=qs[_0x07bd('0x36')](_[_0x07bd('0x3e')](_0x51efa8[_0x07bd('0x35')],_0x253dc0[_0x07bd('0x36')]),_0x3f9424);if(_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3f')]){_0x400cc0[_0x07bd('0x3d')]=_[_0x07bd('0x40')](_0x400cc0[_0x07bd('0x3d')],{'$or':_[_0x07bd('0x2e')](_0x3f9424,function(_0x51e8e2){if(_0x51e8e2[_0x07bd('0x31')]!==_0x07bd('0x41')){var _0x220a8e={};_0x220a8e[_0x51e8e2[_0x07bd('0x34')]]={'$like':'%'+_0x51efa8['query'][_0x07bd('0x3f')]+'%'};return _0x220a8e;}})});}_0x400cc0=_[_0x07bd('0x40')]({},_0x400cc0,_0x51efa8[_0x07bd('0x42')]);var _0x408a0a={'where':_0x400cc0[_0x07bd('0x3d')]};return db['MailQueueReport']['count'](_0x408a0a)[_0x07bd('0x29')](function(_0x88e174){_0x46ed12[_0x07bd('0x21')]=_0x88e174;if(_0x51efa8[_0x07bd('0x35')]['includeAll']){_0x400cc0[_0x07bd('0x43')]=[{'all':!![]}];}return db[_0x07bd('0x44')][_0x07bd('0x45')](_0x400cc0);})[_0x07bd('0x29')](function(_0x318b7c){_0x46ed12[_0x07bd('0x46')]=_0x318b7c;return _0x46ed12;})[_0x07bd('0x29')](respondWithFilteredResult(_0x1a3aa9,_0x400cc0))['catch'](handleError(_0x1a3aa9,null));};exports[_0x07bd('0x47')]=function(_0x7b1042,_0x33389b){var _0x3a5827={'raw':!![],'where':{'id':_0x7b1042['params']['id']}},_0x418f26={};_0x418f26[_0x07bd('0x33')]=_[_0x07bd('0x48')](db[_0x07bd('0x44')][_0x07bd('0x2f')]);_0x418f26[_0x07bd('0x35')]=_['keys'](_0x7b1042[_0x07bd('0x35')]);_0x418f26[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],_0x418f26['query']);_0x3a5827['attributes']=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],qs[_0x07bd('0x39')](_0x7b1042[_0x07bd('0x35')][_0x07bd('0x39')]));_0x3a5827[_0x07bd('0x38')]=_0x3a5827[_0x07bd('0x38')][_0x07bd('0x49')]?_0x3a5827[_0x07bd('0x38')]:_0x418f26['model'];if(_0x7b1042['query'][_0x07bd('0x4a')]){_0x3a5827[_0x07bd('0x43')]=[{'all':!![]}];}_0x3a5827=_[_0x07bd('0x40')]({},_0x3a5827,_0x7b1042[_0x07bd('0x42')]);return db[_0x07bd('0x44')][_0x07bd('0x4b')](_0x3a5827)['then'](handleEntityNotFound(_0x33389b,null))[_0x07bd('0x29')](respondWithResult(_0x33389b,null))[_0x07bd('0x4c')](handleError(_0x33389b,null));};exports[_0x07bd('0x4d')]=function(_0x39823e,_0x7755e2){return db[_0x07bd('0x44')]['create'](_0x39823e[_0x07bd('0x4e')],{})[_0x07bd('0x29')](respondWithResult(_0x7755e2,0xc9))[_0x07bd('0x4c')](handleError(_0x7755e2,null));};exports[_0x07bd('0x27')]=function(_0x1d05ad,_0xc96a7d){if(_0x1d05ad[_0x07bd('0x4e')]['id']){delete _0x1d05ad[_0x07bd('0x4e')]['id'];}return db[_0x07bd('0x44')][_0x07bd('0x4b')]({'where':{'id':_0x1d05ad[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0xc96a7d,null))['then'](saveUpdates(_0x1d05ad[_0x07bd('0x4e')],null))[_0x07bd('0x29')](respondWithResult(_0xc96a7d,null))[_0x07bd('0x4c')](handleError(_0xc96a7d,null));};exports['destroy']=function(_0x51c9f4,_0x1e7a6e){return db['MailQueueReport'][_0x07bd('0x4b')]({'where':{'id':_0x51c9f4[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0x1e7a6e,null))[_0x07bd('0x29')](removeEntity(_0x1e7a6e,null))[_0x07bd('0x4c')](handleError(_0x1e7a6e,null));};exports[_0x07bd('0x50')]=function(_0x2cadbb,_0x157eb4){return db['MailQueueReport'][_0x07bd('0x50')]()[_0x07bd('0x29')](respondWithResult(_0x157eb4,null))[_0x07bd('0x4c')](handleError(_0x157eb4,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 95cbef3..007d829 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 _0xfaf0=['request-promise','path','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash','util','api','moment'];(function(_0x458a46,_0x58cfeb){var _0x42eee1=function(_0xbe7cbe){while(--_0xbe7cbe){_0x458a46['push'](_0x458a46['shift']());}};_0x42eee1(++_0x58cfeb);}(_0xfaf0,0x6a));var _0x0faf=function(_0x38b8a1,_0x503759){_0x38b8a1=_0x38b8a1-0x0;var _0x286b01=_0xfaf0[_0x38b8a1];return _0x286b01;};'use strict';var _=require(_0x0faf('0x0'));var util=require(_0x0faf('0x1'));var logger=require('../../config/logger')(_0x0faf('0x2'));var moment=require(_0x0faf('0x3'));var BPromise=require('bluebird');var rp=require(_0x0faf('0x4'));var fs=require('fs');var path=require(_0x0faf('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0faf('0x6'));module['exports']=function(_0x345a37,_0x17372b){return _0x345a37[_0x0faf('0x7')](_0x0faf('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x0faf('0x9'),'fields':[_0x0faf('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0cfe=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid'];(function(_0x5614a3,_0x44be51){var _0x505e19=function(_0x4d178c){while(--_0x4d178c){_0x5614a3['push'](_0x5614a3['shift']());}};_0x505e19(++_0x44be51);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x29a91f,_0x58e323){_0x29a91f=_0x29a91f-0x0;var _0x358c19=_0x0cfe[_0x29a91f];return _0x358c19;};'use strict';var _=require(_0xe0cf('0x0'));var util=require('util');var logger=require(_0xe0cf('0x1'))(_0xe0cf('0x2'));var moment=require(_0xe0cf('0x3'));var BPromise=require('bluebird');var rp=require(_0xe0cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0cf('0x5'));var config=require(_0xe0cf('0x6'));var attributes=require(_0xe0cf('0x7'));module[_0xe0cf('0x8')]=function(_0x58a4f7,_0x27c9ca){return _0x58a4f7[_0xe0cf('0x9')](_0xe0cf('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xe0cf('0xb'),'fields':[_0xe0cf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index f35458c..64cb88c 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(_0xeadc11,_0x27e378){var _0x4257b6=function(_0x38bb40){while(--_0x38bb40){_0xeadc11['push'](_0xeadc11['shift']());}};_0x4257b6(++_0x27e378);}(_0x2ef3,0xba));var _0x32ef=function(_0x87caf,_0x2555d0){_0x87caf=_0x87caf-0x0;var _0x16ccf5=_0x2ef3[_0x87caf];return _0x16ccf5;};'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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x50721b,_0xcb5807){var _0x5c4285=function(_0x5b161f){while(--_0x5b161f){_0x50721b['push'](_0x50721b['shift']());}};_0x5c4285(++_0xcb5807);}(_0x1261,0x144));var _0x1126=function(_0x3cf387,_0x31ed26){_0x3cf387=_0x3cf387-0x0;var _0x24425f=_0x1261[_0x3cf387];return _0x24425f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 4d5a216..bf1fa07 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x128f18,_0xd7ba38){var _0x28d6fb=function(_0x155986){while(--_0x155986){_0x128f18['push'](_0x128f18['shift']());}};_0x28d6fb(++_0xd7ba38);}(_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 +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5ada87,_0x39ce09){var _0x133b12=function(_0x4796f4){while(--_0x4796f4){_0x5ada87['push'](_0x5ada87['shift']());}};_0x133b12(++_0x39ce09);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xcb91[_0x59c301];return _0x3866b9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index f5a2856..446ba70 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 _0xa038=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x5c8d87,_0x27c270){var _0x5f4e3f=function(_0x4285f8){while(--_0x4285f8){_0x5c8d87['push'](_0x5c8d87['shift']());}};_0x5f4e3f(++_0x27c270);}(_0xa038,0x197));var _0x8a03=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xa038[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require(_0x8a03('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x8a03('0x1')]},'authentication':{'type':Sequelize[_0x8a03('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x8a03('0x1')]},'password':{'type':Sequelize[_0x8a03('0x1')]},'port':{'type':Sequelize[_0x8a03('0x3')]},'tls':{'type':Sequelize[_0x8a03('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8a03('0x1')],'defaultValue':_0x8a03('0x4')},'connTimeout':{'type':Sequelize[_0x8a03('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x8a03('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd1af=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0xee0d98,_0x1e4d5f){var _0xb048b2=function(_0x406038){while(--_0x406038){_0xee0d98['push'](_0xee0d98['shift']());}};_0xb048b2(++_0x1e4d5f);}(_0xd1af,0xae));var _0xfd1a=function(_0x34172b,_0x25d399){_0x34172b=_0x34172b-0x0;var _0x51f8f1=_0xd1af[_0x34172b];return _0x51f8f1;};'use strict';var Sequelize=require(_0xfd1a('0x0'));module[_0xfd1a('0x1')]={'description':{'type':Sequelize[_0xfd1a('0x2')]},'host':{'type':Sequelize[_0xfd1a('0x2')]},'authentication':{'type':Sequelize[_0xfd1a('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xfd1a('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xfd1a('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xfd1a('0x2')],'defaultValue':_0xfd1a('0x5')},'connTimeout':{'type':Sequelize[_0xfd1a('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xfd1a('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xfd1a('0x2')]},'modernAuthentication':{'type':Sequelize[_0xfd1a('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 f453f1a..24363f2 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 _0x1038=['bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment'];(function(_0x3e54fd,_0x2847bd){var _0x189bb9=function(_0x1aefa0){while(--_0x1aefa0){_0x3e54fd['push'](_0x3e54fd['shift']());}};_0x189bb9(++_0x2847bd);}(_0x1038,0x167));var _0x8103=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x1038[_0x622035];return _0x326cf2;};'use strict';var _=require(_0x8103('0x0'));var util=require(_0x8103('0x1'));var logger=require(_0x8103('0x2'))(_0x8103('0x3'));var moment=require(_0x8103('0x4'));var BPromise=require(_0x8103('0x5'));var rp=require(_0x8103('0x6'));var fs=require('fs');var path=require(_0x8103('0x7'));var rimraf=require(_0x8103('0x8'));var config=require(_0x8103('0x9'));var attributes=require(_0x8103('0xa'));module['exports']=function(_0x1289c8,_0x42dc2c){return _0x1289c8['define'](_0x8103('0xb'),attributes,{'tableName':_0x8103('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6807=['request-promise','rimraf','exports','MailServerIn','lodash','../../config/logger','api','moment','bluebird'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x6807,0x109));var _0x7680=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6807[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7680('0x0'));var util=require('util');var logger=require(_0x7680('0x1'))(_0x7680('0x2'));var moment=require(_0x7680('0x3'));var BPromise=require(_0x7680('0x4'));var rp=require(_0x7680('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7680('0x6'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x7680('0x7')]=function(_0x267c3b,_0x2240d9){return _0x267c3b['define'](_0x7680('0x8'),attributes,{'tableName':'mail_servers_in','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 e6797f5..70ce950 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 _0x37a4=['lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailServerIn','findAll','options','where','attributes','limit','include','map','model'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x37a4,0xcb));var _0x437a=function(_0xdd83bf,_0x295443){_0xdd83bf=_0xdd83bf-0x0;var _0x52193d=_0x37a4[_0xdd83bf];return _0x52193d;};'use strict';var _=require(_0x437a('0x0'));var util=require('util');var moment=require(_0x437a('0x1'));var BPromise=require('bluebird');var rs=require(_0x437a('0x2'));var fs=require('fs');var Redis=require(_0x437a('0x3'));var db=require(_0x437a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x437a('0x5'));var config=require(_0x437a('0x6'));var jayson=require(_0x437a('0x7'));var client=jayson[_0x437a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c567f,_0x3a4961,_0x5017ce){return new BPromise(function(_0x36270b,_0x15ac16){return client[_0x437a('0x9')](_0x1c567f,_0x5017ce)[_0x437a('0xa')](function(_0xb81523){logger[_0x437a('0xb')](_0x437a('0xc'),_0x3a4961,_0x437a('0xd'));logger[_0x437a('0xe')](_0x437a('0xf'),_0x3a4961,_0x437a('0xd'),JSON['stringify'](_0xb81523));if(_0xb81523[_0x437a('0x10')]){if(_0xb81523[_0x437a('0x10')][_0x437a('0x11')]===0x1f4){logger[_0x437a('0x10')](_0x437a('0xc'),_0x3a4961,_0xb81523['error'][_0x437a('0x12')]);return _0x15ac16(_0xb81523['error'][_0x437a('0x12')]);}logger[_0x437a('0x10')](_0x437a('0xc'),_0x3a4961,_0xb81523[_0x437a('0x10')][_0x437a('0x12')]);return _0x36270b(_0xb81523[_0x437a('0x10')][_0x437a('0x12')]);}else{logger[_0x437a('0xb')](_0x437a('0xc'),_0x3a4961,_0x437a('0xd'));_0x36270b(_0xb81523[_0x437a('0x13')][_0x437a('0x12')]);}})['catch'](function(_0x469122){logger['error'](_0x437a('0xc'),_0x3a4961,_0x469122);_0x15ac16(_0x469122);});});}exports[_0x437a('0x14')]=function(_0x170ba3){var _0x60f54b=this;return new Promise(function(_0x3d1a23,_0x2f98f9){return db['MailServerIn'][_0x437a('0x15')]({'raw':_0x170ba3[_0x437a('0x16')]?_0x170ba3[_0x437a('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x170ba3[_0x437a('0x16')]?_0x170ba3['options'][_0x437a('0x17')]||null:null,'attributes':_0x170ba3[_0x437a('0x16')]?_0x170ba3['options'][_0x437a('0x18')]||null:null,'limit':_0x170ba3['options']?_0x170ba3[_0x437a('0x16')][_0x437a('0x19')]||null:null,'include':_0x170ba3[_0x437a('0x16')]?_0x170ba3[_0x437a('0x16')][_0x437a('0x1a')]?_[_0x437a('0x1b')](_0x170ba3[_0x437a('0x16')][_0x437a('0x1a')],function(_0x288faa){return{'model':db[_0x288faa[_0x437a('0x1c')]],'as':_0x288faa['as'],'attributes':_0x288faa[_0x437a('0x18')],'include':_0x288faa[_0x437a('0x1a')]?_['map'](_0x288faa[_0x437a('0x1a')],function(_0x29ccd0){return{'model':db[_0x29ccd0[_0x437a('0x1c')]],'as':_0x29ccd0['as'],'attributes':_0x29ccd0['attributes'],'include':_0x29ccd0[_0x437a('0x1a')]?_['map'](_0x29ccd0[_0x437a('0x1a')],function(_0x422c2e){return{'model':db[_0x422c2e[_0x437a('0x1c')]],'as':_0x422c2e['as'],'attributes':_0x422c2e[_0x437a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x437a('0xa')](function(_0x1c00f1){logger[_0x437a('0xb')](_0x437a('0x14'),_0x170ba3);logger[_0x437a('0xe')]('GetMailServerIn',_0x170ba3,JSON['stringify'](_0x1c00f1));_0x3d1a23(_0x1c00f1);})['catch'](function(_0x434eb1){logger[_0x437a('0x10')](_0x437a('0x14'),_0x434eb1['message'],_0x170ba3);_0x2f98f9(_0x60f54b[_0x437a('0x10')](0x1f4,_0x434eb1[_0x437a('0x12')]));});});}; \ No newline at end of file +var _0x4a2e=['model','attributes','map','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','include'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x4a2e,0x125));var _0xe4a2=function(_0x2410e9,_0x6028ce){_0x2410e9=_0x2410e9-0x0;var _0x560eba=_0x4a2e[_0x2410e9];return _0x560eba;};'use strict';var _=require(_0xe4a2('0x0'));var util=require(_0xe4a2('0x1'));var moment=require(_0xe4a2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4a2('0x3'));var fs=require('fs');var Redis=require(_0xe4a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4a2('0x5'));var logger=require(_0xe4a2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe4a2('0x7'));var client=jayson['client'][_0xe4a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53fef5,_0xf15155,_0x4ec2aa){return new BPromise(function(_0x2445da,_0x5aa55e){return client['request'](_0x53fef5,_0x4ec2aa)[_0xe4a2('0x9')](function(_0x101db8){logger[_0xe4a2('0xa')](_0xe4a2('0xb'),_0xf15155,_0xe4a2('0xc'));logger[_0xe4a2('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0xf15155,_0xe4a2('0xc'),JSON[_0xe4a2('0xe')](_0x101db8));if(_0x101db8[_0xe4a2('0xf')]){if(_0x101db8['error'][_0xe4a2('0x10')]===0x1f4){logger['error'](_0xe4a2('0xb'),_0xf15155,_0x101db8[_0xe4a2('0xf')][_0xe4a2('0x11')]);return _0x5aa55e(_0x101db8[_0xe4a2('0xf')]['message']);}logger[_0xe4a2('0xf')](_0xe4a2('0xb'),_0xf15155,_0x101db8[_0xe4a2('0xf')][_0xe4a2('0x11')]);return _0x2445da(_0x101db8[_0xe4a2('0xf')]['message']);}else{logger['info'](_0xe4a2('0xb'),_0xf15155,_0xe4a2('0xc'));_0x2445da(_0x101db8[_0xe4a2('0x12')][_0xe4a2('0x11')]);}})[_0xe4a2('0x13')](function(_0x1a77ef){logger['error'](_0xe4a2('0xb'),_0xf15155,_0x1a77ef);_0x5aa55e(_0x1a77ef);});});}exports[_0xe4a2('0x14')]=function(_0x255407){var _0x129f14=this;return new Promise(function(_0x4e6646,_0x23a6b5){return db[_0xe4a2('0x15')][_0xe4a2('0x16')]({'raw':_0x255407[_0xe4a2('0x17')]?_0x255407[_0xe4a2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x255407[_0xe4a2('0x17')]?_0x255407[_0xe4a2('0x17')][_0xe4a2('0x18')]||null:null,'attributes':_0x255407[_0xe4a2('0x17')]?_0x255407[_0xe4a2('0x17')]['attributes']||null:null,'limit':_0x255407[_0xe4a2('0x17')]?_0x255407[_0xe4a2('0x17')]['limit']||null:null,'include':_0x255407['options']?_0x255407[_0xe4a2('0x17')][_0xe4a2('0x19')]?_['map'](_0x255407[_0xe4a2('0x17')][_0xe4a2('0x19')],function(_0x2dd3aa){return{'model':db[_0x2dd3aa[_0xe4a2('0x1a')]],'as':_0x2dd3aa['as'],'attributes':_0x2dd3aa[_0xe4a2('0x1b')],'include':_0x2dd3aa[_0xe4a2('0x19')]?_[_0xe4a2('0x1c')](_0x2dd3aa[_0xe4a2('0x19')],function(_0x151f21){return{'model':db[_0x151f21[_0xe4a2('0x1a')]],'as':_0x151f21['as'],'attributes':_0x151f21[_0xe4a2('0x1b')],'include':_0x151f21['include']?_[_0xe4a2('0x1c')](_0x151f21['include'],function(_0x3eabc8){return{'model':db[_0x3eabc8[_0xe4a2('0x1a')]],'as':_0x3eabc8['as'],'attributes':_0x3eabc8['attributes']};}):[]};}):[]};}):[]:[]})[_0xe4a2('0x9')](function(_0x57545f){logger[_0xe4a2('0xa')](_0xe4a2('0x14'),_0x255407);logger[_0xe4a2('0xd')](_0xe4a2('0x14'),_0x255407,JSON[_0xe4a2('0xe')](_0x57545f));_0x4e6646(_0x57545f);})[_0xe4a2('0x13')](function(_0x1715ac){logger[_0xe4a2('0xf')](_0xe4a2('0x14'),_0x1715ac[_0xe4a2('0x11')],_0x255407);_0x23a6b5(_0x129f14[_0xe4a2('0xf')](0x1f4,_0x1715ac['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c3a7079..4ca65d7 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 _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(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7a54,0x106));var _0x47a5=function(_0x32b986,_0x25560a){_0x32b986=_0x32b986-0x0;var _0x166b15=_0x7a54[_0x32b986];return _0x166b15;};'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 +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(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 79fd1ab..d05d6cd 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 _0xbee3=['exports','STRING','BOOLEAN'];(function(_0x391638,_0x199b7f){var _0x4ea053=function(_0x31a8d4){while(--_0x31a8d4){_0x391638['push'](_0x391638['shift']());}};_0x4ea053(++_0x199b7f);}(_0xbee3,0xd5));var _0x3bee=function(_0x3caf9f,_0xec59b8){_0x3caf9f=_0x3caf9f-0x0;var _0x203e82=_0xbee3[_0x3caf9f];return _0x203e82;};'use strict';var Sequelize=require('sequelize');module[_0x3bee('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x3bee('0x1')]},'pass':{'type':Sequelize[_0x3bee('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x3bee('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x3bee('0x1')]},'authentication':{'type':Sequelize[_0x3bee('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x878f=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x36b8c3,_0x510529){var _0x10b676=function(_0xf23c48){while(--_0xf23c48){_0x36b8c3['push'](_0x36b8c3['shift']());}};_0x10b676(++_0x510529);}(_0x878f,0x173));var _0xf878=function(_0xc7851b,_0x578d41){_0xc7851b=_0xc7851b-0x0;var _0x513569=_0x878f[_0xc7851b];return _0x513569;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'description':{'type':Sequelize[_0xf878('0x1')]},'host':{'type':Sequelize[_0xf878('0x1')]},'user':{'type':Sequelize[_0xf878('0x1')]},'pass':{'type':Sequelize[_0xf878('0x1')]},'port':{'type':Sequelize[_0xf878('0x2')]},'secure':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xf878('0x1')]},'authentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 00d22be..3a4bb0c 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 _0x9019=['count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x9019,0xc9));var _0x9901=function(_0xa8f776,_0x420cbf){_0xa8f776=_0xa8f776-0x0;var _0x435961=_0x9019[_0xa8f776];return _0x435961;};'use strict';var emlformat=require(_0x9901('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9901('0x1'));var jsonpatch=require(_0x9901('0x2'));var rp=require(_0x9901('0x3'));var moment=require('moment');var BPromise=require(_0x9901('0x4'));var Mustache=require(_0x9901('0x5'));var util=require(_0x9901('0x6'));var path=require(_0x9901('0x7'));var sox=require(_0x9901('0x8'));var csv=require('to-csv');var ejs=require(_0x9901('0x9'));var fs=require('fs');var fs_extra=require(_0x9901('0xa'));var _=require('lodash');var squel=require(_0x9901('0xb'));var crypto=require(_0x9901('0xc'));var jsforce=require(_0x9901('0xd'));var deskjs=require(_0x9901('0xe'));var toCsv=require(_0x9901('0xf'));var querystring=require(_0x9901('0x10'));var Papa=require('papaparse');var Redis=require(_0x9901('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9901('0x12'));var as=require(_0x9901('0x13'));var hardwareService=require(_0x9901('0x14'));var logger=require(_0x9901('0x15'))(_0x9901('0x16'));var utils=require(_0x9901('0x17'));var config=require(_0x9901('0x18'));var licenseUtil=require(_0x9901('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f5c46,_0x2c61d9){_0x2c61d9=_0x2c61d9||0xcc;return function(_0x2a8597){if(_0x2a8597){return _0x2f5c46[_0x9901('0x1a')](_0x2c61d9);}return _0x2f5c46['status'](_0x2c61d9)[_0x9901('0x1b')]();};}function respondWithResult(_0x50682e,_0x2728fa){_0x2728fa=_0x2728fa||0xc8;return function(_0x543545){if(_0x543545){return _0x50682e[_0x9901('0x1c')](_0x2728fa)[_0x9901('0x1d')](_0x543545);}};}function respondWithFilteredResult(_0x72600b,_0x13bb45){return function(_0x486936){if(_0x486936){var _0x114b7c=typeof _0x13bb45[_0x9901('0x1e')]===_0x9901('0x1f')&&typeof _0x13bb45[_0x9901('0x20')]==='undefined';var _0x33a79c=_0x486936['count'];var _0x2a4214=_0x114b7c?0x0:_0x13bb45[_0x9901('0x1e')];var _0x464ed2=_0x114b7c?_0x486936[_0x9901('0x21')]:_0x13bb45[_0x9901('0x1e')]+_0x13bb45[_0x9901('0x20')];var _0x5e1193;if(_0x464ed2>=_0x33a79c){_0x464ed2=_0x33a79c;_0x5e1193=0xc8;}else{_0x5e1193=0xce;}_0x72600b[_0x9901('0x1c')](_0x5e1193);return _0x72600b[_0x9901('0x22')](_0x9901('0x23'),_0x2a4214+'-'+_0x464ed2+'/'+_0x33a79c)['json'](_0x486936);}return null;};}function patchUpdates(_0x4a3781){return function(_0x5de1d7){try{jsonpatch[_0x9901('0x24')](_0x5de1d7,_0x4a3781,!![]);}catch(_0x10463f){return BPromise[_0x9901('0x25')](_0x10463f);}return _0x5de1d7[_0x9901('0x26')]();};}function saveUpdates(_0x42acd8,_0x27f506){return function(_0x4693e3){if(_0x4693e3){return _0x4693e3[_0x9901('0x27')](_0x42acd8)['then'](function(_0x535fbc){return _0x535fbc;});}return null;};}function removeEntity(_0x15e566,_0x52a72b){return function(_0x46a298){if(_0x46a298){return _0x46a298[_0x9901('0x28')]()[_0x9901('0x29')](function(){_0x15e566[_0x9901('0x1c')](0xcc)[_0x9901('0x1b')]();});}};}function handleEntityNotFound(_0x723719,_0xf3e44e){return function(_0x241428){if(!_0x241428){_0x723719['sendStatus'](0x194);}return _0x241428;};}function handleError(_0x378442,_0x50c8d9){_0x50c8d9=_0x50c8d9||0x1f4;return function(_0x583f73){logger['error'](_0x583f73[_0x9901('0x2a')]);if(_0x583f73[_0x9901('0x2b')]){delete _0x583f73[_0x9901('0x2b')];}_0x378442[_0x9901('0x1c')](_0x50c8d9)[_0x9901('0x2c')](_0x583f73);};}exports['index']=function(_0x120e14,_0x21ae9a){var _0x54d264={},_0x4a50f3={},_0x35ede0={'count':0x0,'rows':[]};var _0x58b48b=_[_0x9901('0x2d')](db['MailServerOut'][_0x9901('0x2e')],function(_0x44d340){return{'name':_0x44d340[_0x9901('0x2f')],'type':_0x44d340[_0x9901('0x30')]['key']};});_0x4a50f3['model']=_[_0x9901('0x2d')](_0x58b48b,_0x9901('0x2b'));_0x4a50f3[_0x9901('0x31')]=_[_0x9901('0x32')](_0x120e14[_0x9901('0x31')]);_0x4a50f3[_0x9901('0x33')]=_[_0x9901('0x34')](_0x4a50f3[_0x9901('0x35')],_0x4a50f3[_0x9901('0x31')]);_0x54d264[_0x9901('0x36')]=_[_0x9901('0x34')](_0x4a50f3[_0x9901('0x35')],qs[_0x9901('0x37')](_0x120e14[_0x9901('0x31')][_0x9901('0x37')]));_0x54d264['attributes']=_0x54d264[_0x9901('0x36')][_0x9901('0x38')]?_0x54d264[_0x9901('0x36')]:_0x4a50f3[_0x9901('0x35')];if(!_0x120e14[_0x9901('0x31')][_0x9901('0x39')](_0x9901('0x3a'))){_0x54d264[_0x9901('0x20')]=qs['limit'](_0x120e14[_0x9901('0x31')][_0x9901('0x20')]);_0x54d264['offset']=qs[_0x9901('0x1e')](_0x120e14['query'][_0x9901('0x1e')]);}_0x54d264[_0x9901('0x3b')]=qs[_0x9901('0x3c')](_0x120e14['query']['sort']);_0x54d264[_0x9901('0x3d')]=qs['filters'](_[_0x9901('0x3e')](_0x120e14['query'],_0x4a50f3['filters']),_0x58b48b);if(_0x120e14['query']['filter']){_0x54d264[_0x9901('0x3d')]=_['merge'](_0x54d264[_0x9901('0x3d')],{'$or':_['map'](_0x58b48b,function(_0x2724ec){if(_0x2724ec[_0x9901('0x30')]!==_0x9901('0x3f')){var _0x3c77a5={};_0x3c77a5[_0x2724ec[_0x9901('0x2b')]]={'$like':'%'+_0x120e14[_0x9901('0x31')][_0x9901('0x40')]+'%'};return _0x3c77a5;}})});}_0x54d264=_[_0x9901('0x41')]({},_0x54d264,_0x120e14[_0x9901('0x42')]);var _0x4a3a5e={'where':_0x54d264['where']};return db[_0x9901('0x43')][_0x9901('0x21')](_0x4a3a5e)['then'](function(_0x1458c7){_0x35ede0[_0x9901('0x21')]=_0x1458c7;if(_0x120e14[_0x9901('0x31')][_0x9901('0x44')]){_0x54d264[_0x9901('0x45')]=[{'all':!![]}];}return db[_0x9901('0x43')][_0x9901('0x46')](_0x54d264);})[_0x9901('0x29')](function(_0x165c95){_0x35ede0[_0x9901('0x47')]=_0x165c95;return _0x35ede0;})['then'](respondWithFilteredResult(_0x21ae9a,_0x54d264))[_0x9901('0x48')](handleError(_0x21ae9a,null));};exports[_0x9901('0x49')]=function(_0x347de7,_0x150a7d){var _0x1a6460={'raw':!![],'where':{'id':_0x347de7[_0x9901('0x4a')]['id']}},_0x2d08c7={};_0x2d08c7['model']=_[_0x9901('0x32')](db[_0x9901('0x43')][_0x9901('0x2e')]);_0x2d08c7[_0x9901('0x31')]=_[_0x9901('0x32')](_0x347de7[_0x9901('0x31')]);_0x2d08c7[_0x9901('0x33')]=_[_0x9901('0x34')](_0x2d08c7[_0x9901('0x35')],_0x2d08c7[_0x9901('0x31')]);_0x1a6460[_0x9901('0x36')]=_['intersection'](_0x2d08c7[_0x9901('0x35')],qs['fields'](_0x347de7['query'][_0x9901('0x37')]));_0x1a6460[_0x9901('0x36')]=_0x1a6460[_0x9901('0x36')]['length']?_0x1a6460[_0x9901('0x36')]:_0x2d08c7[_0x9901('0x35')];if(_0x347de7[_0x9901('0x31')][_0x9901('0x44')]){_0x1a6460[_0x9901('0x45')]=[{'all':!![]}];}_0x1a6460=_['merge']({},_0x1a6460,_0x347de7['options']);return db[_0x9901('0x43')][_0x9901('0x4b')](_0x1a6460)[_0x9901('0x29')](handleEntityNotFound(_0x150a7d,null))[_0x9901('0x29')](respondWithResult(_0x150a7d,null))['catch'](handleError(_0x150a7d,null));};exports[_0x9901('0x4c')]=function(_0x15a883,_0x14c1f8){return db[_0x9901('0x43')][_0x9901('0x4c')](_0x15a883['body'],{})[_0x9901('0x29')](respondWithResult(_0x14c1f8,0xc9))[_0x9901('0x48')](handleError(_0x14c1f8,null));};exports['update']=function(_0x3bda09,_0xe9b23d){if(_0x3bda09[_0x9901('0x4d')]['id']){delete _0x3bda09[_0x9901('0x4d')]['id'];}return db['MailServerOut'][_0x9901('0x4b')]({'where':{'id':_0x3bda09['params']['id']}})[_0x9901('0x29')](handleEntityNotFound(_0xe9b23d,null))['then'](saveUpdates(_0x3bda09[_0x9901('0x4d')],null))['then'](respondWithResult(_0xe9b23d,null))[_0x9901('0x48')](handleError(_0xe9b23d,null));};exports[_0x9901('0x28')]=function(_0x496101,_0x13dc18){return db[_0x9901('0x43')][_0x9901('0x4b')]({'where':{'id':_0x496101[_0x9901('0x4a')]['id']}})[_0x9901('0x29')](handleEntityNotFound(_0x13dc18,null))[_0x9901('0x29')](removeEntity(_0x13dc18,null))[_0x9901('0x48')](handleError(_0x13dc18,null));}; \ No newline at end of file +var _0x12f7=['../../mysqldb','status','end','offset','limit','count','set','json','apply','reject','save','update','destroy','then','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x182d8c,_0x32c47c){var _0x58b4a3=function(_0x2907f6){while(--_0x2907f6){_0x182d8c['push'](_0x182d8c['shift']());}};_0x58b4a3(++_0x32c47c);}(_0x12f7,0x7f));var _0x712f=function(_0x4ec2ed,_0x548881){_0x4ec2ed=_0x4ec2ed-0x0;var _0x2eca99=_0x12f7[_0x4ec2ed];return _0x2eca99;};'use strict';var emlformat=require(_0x712f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x712f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x712f('0x2'));var moment=require(_0x712f('0x3'));var BPromise=require(_0x712f('0x4'));var Mustache=require(_0x712f('0x5'));var util=require(_0x712f('0x6'));var path=require(_0x712f('0x7'));var sox=require(_0x712f('0x8'));var csv=require(_0x712f('0x9'));var ejs=require(_0x712f('0xa'));var fs=require('fs');var fs_extra=require(_0x712f('0xb'));var _=require('lodash');var squel=require(_0x712f('0xc'));var crypto=require('crypto');var jsforce=require(_0x712f('0xd'));var deskjs=require(_0x712f('0xe'));var toCsv=require(_0x712f('0x9'));var querystring=require('querystring');var Papa=require(_0x712f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x712f('0x10'));var hardwareService=require(_0x712f('0x11'));var logger=require(_0x712f('0x12'))(_0x712f('0x13'));var utils=require(_0x712f('0x14'));var config=require(_0x712f('0x15'));var licenseUtil=require(_0x712f('0x16'));var db=require(_0x712f('0x17'))['db'];function respondWithStatusCode(_0x553242,_0x1954f0){_0x1954f0=_0x1954f0||0xcc;return function(_0x183826){if(_0x183826){return _0x553242['sendStatus'](_0x1954f0);}return _0x553242[_0x712f('0x18')](_0x1954f0)[_0x712f('0x19')]();};}function respondWithResult(_0x14fc5b,_0x2cb637){_0x2cb637=_0x2cb637||0xc8;return function(_0x5e7949){if(_0x5e7949){return _0x14fc5b[_0x712f('0x18')](_0x2cb637)['json'](_0x5e7949);}};}function respondWithFilteredResult(_0x3a4aff,_0x5e334f){return function(_0x2155a5){if(_0x2155a5){var _0x232c26=typeof _0x5e334f[_0x712f('0x1a')]==='undefined'&&typeof _0x5e334f[_0x712f('0x1b')]==='undefined';var _0x133f0b=_0x2155a5['count'];var _0x37eb2f=_0x232c26?0x0:_0x5e334f[_0x712f('0x1a')];var _0x51aef5=_0x232c26?_0x2155a5[_0x712f('0x1c')]:_0x5e334f['offset']+_0x5e334f[_0x712f('0x1b')];var _0x1499f6;if(_0x51aef5>=_0x133f0b){_0x51aef5=_0x133f0b;_0x1499f6=0xc8;}else{_0x1499f6=0xce;}_0x3a4aff[_0x712f('0x18')](_0x1499f6);return _0x3a4aff[_0x712f('0x1d')]('Content-Range',_0x37eb2f+'-'+_0x51aef5+'/'+_0x133f0b)[_0x712f('0x1e')](_0x2155a5);}return null;};}function patchUpdates(_0xd9c2fa){return function(_0xd6d404){try{jsonpatch[_0x712f('0x1f')](_0xd6d404,_0xd9c2fa,!![]);}catch(_0x25f4e3){return BPromise[_0x712f('0x20')](_0x25f4e3);}return _0xd6d404[_0x712f('0x21')]();};}function saveUpdates(_0x4a4ffd,_0x1f34f3){return function(_0x477e3c){if(_0x477e3c){return _0x477e3c[_0x712f('0x22')](_0x4a4ffd)['then'](function(_0x244f22){return _0x244f22;});}return null;};}function removeEntity(_0x4b201e,_0x37cf38){return function(_0x15d5e1){if(_0x15d5e1){return _0x15d5e1[_0x712f('0x23')]()[_0x712f('0x24')](function(){_0x4b201e[_0x712f('0x18')](0xcc)[_0x712f('0x19')]();});}};}function handleEntityNotFound(_0xc63c64,_0x49f121){return function(_0x2245bc){if(!_0x2245bc){_0xc63c64[_0x712f('0x25')](0x194);}return _0x2245bc;};}function handleError(_0x577b0e,_0x16f170){_0x16f170=_0x16f170||0x1f4;return function(_0x495b59){logger[_0x712f('0x26')](_0x495b59['stack']);if(_0x495b59[_0x712f('0x27')]){delete _0x495b59[_0x712f('0x27')];}_0x577b0e[_0x712f('0x18')](_0x16f170)[_0x712f('0x28')](_0x495b59);};}exports['index']=function(_0x3283c5,_0xeb8701){var _0x5deb21={},_0x3252ce={},_0x23c956={'count':0x0,'rows':[]};var _0x2065a4=_[_0x712f('0x29')](db['MailServerOut'][_0x712f('0x2a')],function(_0x6caa90){return{'name':_0x6caa90[_0x712f('0x2b')],'type':_0x6caa90[_0x712f('0x2c')][_0x712f('0x2d')]};});_0x3252ce['model']=_[_0x712f('0x29')](_0x2065a4,_0x712f('0x27'));_0x3252ce[_0x712f('0x2e')]=_[_0x712f('0x2f')](_0x3283c5[_0x712f('0x2e')]);_0x3252ce[_0x712f('0x30')]=_[_0x712f('0x31')](_0x3252ce[_0x712f('0x32')],_0x3252ce[_0x712f('0x2e')]);_0x5deb21[_0x712f('0x33')]=_[_0x712f('0x31')](_0x3252ce['model'],qs[_0x712f('0x34')](_0x3283c5['query'][_0x712f('0x34')]));_0x5deb21[_0x712f('0x33')]=_0x5deb21[_0x712f('0x33')][_0x712f('0x35')]?_0x5deb21[_0x712f('0x33')]:_0x3252ce[_0x712f('0x32')];if(!_0x3283c5[_0x712f('0x2e')][_0x712f('0x36')](_0x712f('0x37'))){_0x5deb21[_0x712f('0x1b')]=qs[_0x712f('0x1b')](_0x3283c5[_0x712f('0x2e')][_0x712f('0x1b')]);_0x5deb21[_0x712f('0x1a')]=qs['offset'](_0x3283c5['query'][_0x712f('0x1a')]);}_0x5deb21[_0x712f('0x38')]=qs[_0x712f('0x39')](_0x3283c5[_0x712f('0x2e')][_0x712f('0x39')]);_0x5deb21[_0x712f('0x3a')]=qs[_0x712f('0x30')](_[_0x712f('0x3b')](_0x3283c5[_0x712f('0x2e')],_0x3252ce[_0x712f('0x30')]),_0x2065a4);if(_0x3283c5[_0x712f('0x2e')][_0x712f('0x3c')]){_0x5deb21['where']=_[_0x712f('0x3d')](_0x5deb21[_0x712f('0x3a')],{'$or':_[_0x712f('0x29')](_0x2065a4,function(_0x57ea59){if(_0x57ea59[_0x712f('0x2c')]!==_0x712f('0x3e')){var _0x78a6bc={};_0x78a6bc[_0x57ea59[_0x712f('0x27')]]={'$like':'%'+_0x3283c5[_0x712f('0x2e')][_0x712f('0x3c')]+'%'};return _0x78a6bc;}})});}_0x5deb21=_[_0x712f('0x3d')]({},_0x5deb21,_0x3283c5[_0x712f('0x3f')]);var _0x1a0fe1={'where':_0x5deb21[_0x712f('0x3a')]};return db[_0x712f('0x40')][_0x712f('0x1c')](_0x1a0fe1)[_0x712f('0x24')](function(_0x5d5347){_0x23c956[_0x712f('0x1c')]=_0x5d5347;if(_0x3283c5[_0x712f('0x2e')][_0x712f('0x41')]){_0x5deb21[_0x712f('0x42')]=[{'all':!![]}];}return db[_0x712f('0x40')][_0x712f('0x43')](_0x5deb21);})[_0x712f('0x24')](function(_0x1647d7){_0x23c956[_0x712f('0x44')]=_0x1647d7;return _0x23c956;})[_0x712f('0x24')](respondWithFilteredResult(_0xeb8701,_0x5deb21))[_0x712f('0x45')](handleError(_0xeb8701,null));};exports[_0x712f('0x46')]=function(_0x5223c7,_0x2727f3){var _0x1201e0={'raw':!![],'where':{'id':_0x5223c7[_0x712f('0x47')]['id']}},_0x50931e={};_0x50931e[_0x712f('0x32')]=_[_0x712f('0x2f')](db['MailServerOut']['rawAttributes']);_0x50931e[_0x712f('0x2e')]=_['keys'](_0x5223c7[_0x712f('0x2e')]);_0x50931e[_0x712f('0x30')]=_['intersection'](_0x50931e['model'],_0x50931e[_0x712f('0x2e')]);_0x1201e0['attributes']=_[_0x712f('0x31')](_0x50931e[_0x712f('0x32')],qs[_0x712f('0x34')](_0x5223c7[_0x712f('0x2e')]['fields']));_0x1201e0[_0x712f('0x33')]=_0x1201e0[_0x712f('0x33')][_0x712f('0x35')]?_0x1201e0['attributes']:_0x50931e[_0x712f('0x32')];if(_0x5223c7[_0x712f('0x2e')][_0x712f('0x41')]){_0x1201e0['include']=[{'all':!![]}];}_0x1201e0=_[_0x712f('0x3d')]({},_0x1201e0,_0x5223c7['options']);return db['MailServerOut']['find'](_0x1201e0)[_0x712f('0x24')](handleEntityNotFound(_0x2727f3,null))['then'](respondWithResult(_0x2727f3,null))[_0x712f('0x45')](handleError(_0x2727f3,null));};exports[_0x712f('0x48')]=function(_0x1ff0c8,_0x48d8c9){return db['MailServerOut'][_0x712f('0x48')](_0x1ff0c8['body'],{})[_0x712f('0x24')](respondWithResult(_0x48d8c9,0xc9))[_0x712f('0x45')](handleError(_0x48d8c9,null));};exports['update']=function(_0x225d40,_0x1c3383){if(_0x225d40[_0x712f('0x49')]['id']){delete _0x225d40[_0x712f('0x49')]['id'];}return db[_0x712f('0x40')][_0x712f('0x4a')]({'where':{'id':_0x225d40[_0x712f('0x47')]['id']}})[_0x712f('0x24')](handleEntityNotFound(_0x1c3383,null))[_0x712f('0x24')](saveUpdates(_0x225d40['body'],null))['then'](respondWithResult(_0x1c3383,null))[_0x712f('0x45')](handleError(_0x1c3383,null));};exports[_0x712f('0x23')]=function(_0x3a3f3a,_0x1446e1){return db[_0x712f('0x40')][_0x712f('0x4a')]({'where':{'id':_0x3a3f3a['params']['id']}})[_0x712f('0x24')](handleEntityNotFound(_0x1446e1,null))['then'](removeEntity(_0x1446e1,null))[_0x712f('0x45')](handleError(_0x1446e1,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4c6159f..70fc90a 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 _0x2f7f=['define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x2f7f,0xbe));var _0xf2f7=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x2f7f[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0xf2f7('0x0'));var util=require(_0xf2f7('0x1'));var logger=require(_0xf2f7('0x2'))('api');var moment=require(_0xf2f7('0x3'));var BPromise=require('bluebird');var rp=require(_0xf2f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf2f7('0x5'));var attributes=require(_0xf2f7('0x6'));module[_0xf2f7('0x7')]=function(_0x58be1e,_0x276057){return _0x58be1e[_0xf2f7('0x8')](_0xf2f7('0x9'),attributes,{'tableName':_0xf2f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf084=['bluebird','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api'];(function(_0x1e6bc1,_0x1e3986){var _0x1d148c=function(_0x4a7023){while(--_0x4a7023){_0x1e6bc1['push'](_0x1e6bc1['shift']());}};_0x1d148c(++_0x1e3986);}(_0xf084,0x74));var _0x4f08=function(_0x59b6d7,_0x399af3){_0x59b6d7=_0x59b6d7-0x0;var _0x8ec1df=_0xf084[_0x59b6d7];return _0x8ec1df;};'use strict';var _=require(_0x4f08('0x0'));var util=require(_0x4f08('0x1'));var logger=require(_0x4f08('0x2'))(_0x4f08('0x3'));var moment=require('moment');var BPromise=require(_0x4f08('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f08('0x5'));var rimraf=require('rimraf');var config=require(_0x4f08('0x6'));var attributes=require(_0x4f08('0x7'));module[_0x4f08('0x8')]=function(_0x330b6e,_0x1862ac){return _0x330b6e[_0x4f08('0x9')](_0x4f08('0xa'),attributes,{'tableName':_0x4f08('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 7bbebbf..c411a6a 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(_0x15d111,_0x1feb3d){var _0x159c1c=function(_0xccffbc){while(--_0xccffbc){_0x15d111['push'](_0x15d111['shift']());}};_0x159c1c(++_0x1feb3d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4d7aaf,_0xb955da){_0x4d7aaf=_0x4d7aaf-0x0;var _0x33fb7b=_0x5f2f[_0x4d7aaf];return _0x33fb7b;};'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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x310428,_0xec9879){var _0x56c99d=function(_0x5f070a){while(--_0x5f070a){_0x310428['push'](_0x310428['shift']());}};_0x56c99d(++_0xec9879);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e49ce,_0x25ef32){_0x2e49ce=_0x2e49ce-0x0;var _0x54b588=_0x2ef3[_0x2e49ce];return _0x54b588;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 66fc1e2..84b28c9 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 _0x0ca3=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/:id','show','post','put','update'];(function(_0x22e6ec,_0x78f3d9){var _0x30b94f=function(_0x4f4b27){while(--_0x4f4b27){_0x22e6ec['push'](_0x22e6ec['shift']());}};_0x30b94f(++_0x78f3d9);}(_0x0ca3,0x114));var _0x30ca=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0x0ca3[_0xfbdff6];return _0x4cb9be;};'use strict';var multer=require(_0x30ca('0x0'));var util=require(_0x30ca('0x1'));var path=require(_0x30ca('0x2'));var timeout=require(_0x30ca('0x3'));var express=require('express');var router=express[_0x30ca('0x4')]();var fs_extra=require(_0x30ca('0x5'));var auth=require(_0x30ca('0x6'));var interaction=require(_0x30ca('0x7'));var config=require(_0x30ca('0x8'));var controller=require(_0x30ca('0x9'));router['get']('/',auth[_0x30ca('0xa')](),controller[_0x30ca('0xb')]);router[_0x30ca('0xc')]('/describe',auth[_0x30ca('0xa')](),controller['describe']);router[_0x30ca('0xc')](_0x30ca('0xd'),auth['isAuthenticated'](),controller[_0x30ca('0xe')]);router[_0x30ca('0xf')]('/',auth[_0x30ca('0xa')](),controller['create']);router[_0x30ca('0x10')](_0x30ca('0xd'),auth[_0x30ca('0xa')](),controller[_0x30ca('0x11')]);router[_0x30ca('0x12')](_0x30ca('0xd'),auth[_0x30ca('0xa')](),controller[_0x30ca('0x13')]);module[_0x30ca('0x14')]=router; \ No newline at end of file +var _0xd78b=['post','put','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x1b8a3d,_0x110236){var _0x58c1d2=function(_0x55fa22){while(--_0x55fa22){_0x1b8a3d['push'](_0x1b8a3d['shift']());}};_0x58c1d2(++_0x110236);}(_0xd78b,0x1bc));var _0xbd78=function(_0x4b342e,_0x425550){_0x4b342e=_0x4b342e-0x0;var _0x42e1cd=_0xd78b[_0x4b342e];return _0x42e1cd;};'use strict';var multer=require('multer');var util=require(_0xbd78('0x0'));var path=require(_0xbd78('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd78('0x2'));var router=express[_0xbd78('0x3')]();var fs_extra=require(_0xbd78('0x4'));var auth=require(_0xbd78('0x5'));var interaction=require(_0xbd78('0x6'));var config=require(_0xbd78('0x7'));var controller=require(_0xbd78('0x8'));router['get']('/',auth[_0xbd78('0x9')](),controller[_0xbd78('0xa')]);router['get'](_0xbd78('0xb'),auth[_0xbd78('0x9')](),controller[_0xbd78('0xc')]);router[_0xbd78('0xd')](_0xbd78('0xe'),auth[_0xbd78('0x9')](),controller[_0xbd78('0xf')]);router[_0xbd78('0x10')]('/',auth[_0xbd78('0x9')](),controller['create']);router[_0xbd78('0x11')](_0xbd78('0xe'),auth[_0xbd78('0x9')](),controller['update']);router[_0xbd78('0x12')]('/:id',auth[_0xbd78('0x9')](),controller[_0xbd78('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 1610329..bd73c83 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 _0x8506=['exports','name'];(function(_0x416447,_0x399384){var _0x1d668b=function(_0x19ca87){while(--_0x19ca87){_0x416447['push'](_0x416447['shift']());}};_0x1d668b(++_0x399384);}(_0x8506,0xe8));var _0x6850=function(_0x51b0aa,_0x4b52ac){_0x51b0aa=_0x51b0aa-0x0;var _0x16a5ca=_0x8506[_0x51b0aa];return _0x16a5ca;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6850('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7d9f=['sequelize','exports','STRING','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x13c2cf,_0x568ba5){_0x13c2cf=_0x13c2cf-0x0;var _0x237785=_0x7d9f[_0x13c2cf];return _0x237785;};'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 df09b76..0e300a2 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 _0xc4af=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','name','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','include','findAll','catch','show','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xc4af,0x1a3));var _0xfc4a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc4af[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xfc4a('0x0'));var rimraf=require(_0xfc4a('0x1'));var zipdir=require(_0xfc4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc4a('0x3'));var moment=require(_0xfc4a('0x4'));var BPromise=require(_0xfc4a('0x5'));var Mustache=require(_0xfc4a('0x6'));var util=require(_0xfc4a('0x7'));var path=require(_0xfc4a('0x8'));var sox=require(_0xfc4a('0x9'));var csv=require(_0xfc4a('0xa'));var ejs=require(_0xfc4a('0xb'));var fs=require('fs');var fs_extra=require(_0xfc4a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc4a('0xd'));var deskjs=require(_0xfc4a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfc4a('0xf'));var Papa=require('papaparse');var Redis=require(_0xfc4a('0x10'));var authService=require(_0xfc4a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfc4a('0x12'));var hardwareService=require(_0xfc4a('0x13'));var logger=require(_0xfc4a('0x14'))(_0xfc4a('0x15'));var utils=require(_0xfc4a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfc4a('0x17'));var db=require(_0xfc4a('0x18'))['db'];function respondWithStatusCode(_0x27ed5a,_0x56790f){_0x56790f=_0x56790f||0xcc;return function(_0x5cc239){if(_0x5cc239){return _0x27ed5a[_0xfc4a('0x19')](_0x56790f);}return _0x27ed5a['status'](_0x56790f)[_0xfc4a('0x1a')]();};}function respondWithResult(_0x1b5d1d,_0x3b0a59){_0x3b0a59=_0x3b0a59||0xc8;return function(_0x230d27){if(_0x230d27){return _0x1b5d1d[_0xfc4a('0x1b')](_0x3b0a59)[_0xfc4a('0x1c')](_0x230d27);}};}function respondWithFilteredResult(_0x40d59f,_0x40387b){return function(_0x2ca40c){if(_0x2ca40c){var _0x4d68c6=typeof _0x40387b[_0xfc4a('0x1d')]===_0xfc4a('0x1e')&&typeof _0x40387b['limit']===_0xfc4a('0x1e');var _0x5c062e=_0x2ca40c[_0xfc4a('0x1f')];var _0x302535=_0x4d68c6?0x0:_0x40387b[_0xfc4a('0x1d')];var _0x13af6a=_0x4d68c6?_0x2ca40c[_0xfc4a('0x1f')]:_0x40387b[_0xfc4a('0x1d')]+_0x40387b[_0xfc4a('0x20')];var _0xcc3263;if(_0x13af6a>=_0x5c062e){_0x13af6a=_0x5c062e;_0xcc3263=0xc8;}else{_0xcc3263=0xce;}_0x40d59f[_0xfc4a('0x1b')](_0xcc3263);return _0x40d59f['set'](_0xfc4a('0x21'),_0x302535+'-'+_0x13af6a+'/'+_0x5c062e)[_0xfc4a('0x1c')](_0x2ca40c);}return null;};}function patchUpdates(_0x9d0654){return function(_0x1813a7){try{jsonpatch['apply'](_0x1813a7,_0x9d0654,!![]);}catch(_0x3f8518){return BPromise[_0xfc4a('0x22')](_0x3f8518);}return _0x1813a7[_0xfc4a('0x23')]();};}function saveUpdates(_0x611a6e,_0x7463e9){return function(_0x4877f0){if(_0x4877f0){return _0x4877f0[_0xfc4a('0x24')](_0x611a6e)[_0xfc4a('0x25')](function(_0x5e899c){return _0x5e899c;});}return null;};}function removeEntity(_0x388c16,_0x42625c){return function(_0x5a0427){if(_0x5a0427){return _0x5a0427[_0xfc4a('0x26')]()[_0xfc4a('0x25')](function(){_0x388c16[_0xfc4a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x162f9b,_0x199c41){return function(_0x4db779){if(!_0x4db779){_0x162f9b[_0xfc4a('0x19')](0x194);}return _0x4db779;};}function handleError(_0x1f5a32,_0x51ffb4){_0x51ffb4=_0x51ffb4||0x1f4;return function(_0x2527da){logger[_0xfc4a('0x27')](_0x2527da['stack']);if(_0x2527da['name']){delete _0x2527da[_0xfc4a('0x28')];}_0x1f5a32[_0xfc4a('0x1b')](_0x51ffb4)['send'](_0x2527da);};}exports[_0xfc4a('0x29')]=function(_0x349dfa,_0x430613){var _0x189e8b={},_0x1dffa3={},_0x4591a7={'count':0x0,'rows':[]};var _0x747e9=_['map'](db[_0xfc4a('0x2a')][_0xfc4a('0x2b')],function(_0x1b0f37){return{'name':_0x1b0f37[_0xfc4a('0x2c')],'type':_0x1b0f37[_0xfc4a('0x2d')][_0xfc4a('0x2e')]};});_0x1dffa3[_0xfc4a('0x2f')]=_[_0xfc4a('0x30')](_0x747e9,_0xfc4a('0x28'));_0x1dffa3[_0xfc4a('0x31')]=_[_0xfc4a('0x32')](_0x349dfa[_0xfc4a('0x31')]);_0x1dffa3[_0xfc4a('0x33')]=_[_0xfc4a('0x34')](_0x1dffa3[_0xfc4a('0x2f')],_0x1dffa3[_0xfc4a('0x31')]);_0x189e8b[_0xfc4a('0x35')]=_[_0xfc4a('0x34')](_0x1dffa3[_0xfc4a('0x2f')],qs[_0xfc4a('0x36')](_0x349dfa['query'][_0xfc4a('0x36')]));_0x189e8b[_0xfc4a('0x35')]=_0x189e8b[_0xfc4a('0x35')][_0xfc4a('0x37')]?_0x189e8b[_0xfc4a('0x35')]:_0x1dffa3['model'];if(!_0x349dfa[_0xfc4a('0x31')][_0xfc4a('0x38')]('nolimit')){_0x189e8b['limit']=qs['limit'](_0x349dfa[_0xfc4a('0x31')]['limit']);_0x189e8b[_0xfc4a('0x1d')]=qs[_0xfc4a('0x1d')](_0x349dfa[_0xfc4a('0x31')][_0xfc4a('0x1d')]);}_0x189e8b['order']=qs[_0xfc4a('0x39')](_0x349dfa['query'][_0xfc4a('0x39')]);_0x189e8b[_0xfc4a('0x3a')]=qs['filters'](_['pick'](_0x349dfa[_0xfc4a('0x31')],_0x1dffa3['filters']),_0x747e9);if(_0x349dfa[_0xfc4a('0x31')][_0xfc4a('0x3b')]){_0x189e8b[_0xfc4a('0x3a')]=_[_0xfc4a('0x3c')](_0x189e8b[_0xfc4a('0x3a')],{'$or':_[_0xfc4a('0x30')](_0x747e9,function(_0x44c234){if(_0x44c234[_0xfc4a('0x2d')]!=='VIRTUAL'){var _0x29bc69={};_0x29bc69[_0x44c234[_0xfc4a('0x28')]]={'$like':'%'+_0x349dfa['query'][_0xfc4a('0x3b')]+'%'};return _0x29bc69;}})});}_0x189e8b=_[_0xfc4a('0x3c')]({},_0x189e8b,_0x349dfa[_0xfc4a('0x3d')]);var _0x17a137={'where':_0x189e8b[_0xfc4a('0x3a')]};return db[_0xfc4a('0x2a')][_0xfc4a('0x1f')](_0x17a137)[_0xfc4a('0x25')](function(_0x2b3da0){_0x4591a7['count']=_0x2b3da0;if(_0x349dfa[_0xfc4a('0x31')]['includeAll']){_0x189e8b[_0xfc4a('0x3e')]=[{'all':!![]}];}return db[_0xfc4a('0x2a')][_0xfc4a('0x3f')](_0x189e8b);})['then'](function(_0xa60770){_0x4591a7['rows']=_0xa60770;return _0x4591a7;})[_0xfc4a('0x25')](respondWithFilteredResult(_0x430613,_0x189e8b))[_0xfc4a('0x40')](handleError(_0x430613,null));};exports[_0xfc4a('0x41')]=function(_0x25daba,_0xb238a5){var _0x4bb4fb={'raw':!![],'where':{'id':_0x25daba[_0xfc4a('0x42')]['id']}},_0xe15467={};_0xe15467[_0xfc4a('0x2f')]=_[_0xfc4a('0x32')](db[_0xfc4a('0x2a')][_0xfc4a('0x2b')]);_0xe15467[_0xfc4a('0x31')]=_[_0xfc4a('0x32')](_0x25daba[_0xfc4a('0x31')]);_0xe15467[_0xfc4a('0x33')]=_['intersection'](_0xe15467[_0xfc4a('0x2f')],_0xe15467['query']);_0x4bb4fb[_0xfc4a('0x35')]=_['intersection'](_0xe15467['model'],qs[_0xfc4a('0x36')](_0x25daba[_0xfc4a('0x31')][_0xfc4a('0x36')]));_0x4bb4fb['attributes']=_0x4bb4fb[_0xfc4a('0x35')][_0xfc4a('0x37')]?_0x4bb4fb['attributes']:_0xe15467[_0xfc4a('0x2f')];if(_0x25daba[_0xfc4a('0x31')][_0xfc4a('0x43')]){_0x4bb4fb[_0xfc4a('0x3e')]=[{'all':!![]}];}_0x4bb4fb=_['merge']({},_0x4bb4fb,_0x25daba[_0xfc4a('0x3d')]);return db['MailSubstatus']['find'](_0x4bb4fb)[_0xfc4a('0x25')](handleEntityNotFound(_0xb238a5,null))['then'](respondWithResult(_0xb238a5,null))[_0xfc4a('0x40')](handleError(_0xb238a5,null));};exports[_0xfc4a('0x44')]=function(_0x38e72c,_0x7e9e46){return db[_0xfc4a('0x2a')][_0xfc4a('0x44')](_0x38e72c[_0xfc4a('0x45')],{})['then'](respondWithResult(_0x7e9e46,0xc9))[_0xfc4a('0x40')](handleError(_0x7e9e46,null));};exports[_0xfc4a('0x24')]=function(_0x4f9778,_0x5845b0){if(_0x4f9778[_0xfc4a('0x45')]['id']){delete _0x4f9778['body']['id'];}return db[_0xfc4a('0x2a')][_0xfc4a('0x46')]({'where':{'id':_0x4f9778[_0xfc4a('0x42')]['id']}})[_0xfc4a('0x25')](handleEntityNotFound(_0x5845b0,null))[_0xfc4a('0x25')](saveUpdates(_0x4f9778[_0xfc4a('0x45')],null))[_0xfc4a('0x25')](respondWithResult(_0x5845b0,null))[_0xfc4a('0x40')](handleError(_0x5845b0,null));};exports['destroy']=function(_0x3f4af1,_0x5d2aa4){return db[_0xfc4a('0x2a')][_0xfc4a('0x46')]({'where':{'id':_0x3f4af1[_0xfc4a('0x42')]['id']}})[_0xfc4a('0x25')](handleEntityNotFound(_0x5d2aa4,null))[_0xfc4a('0x25')](removeEntity(_0x5d2aa4,null))[_0xfc4a('0x40')](handleError(_0x5d2aa4,null));};exports[_0xfc4a('0x47')]=function(_0x318fbf,_0x35d829){return db[_0xfc4a('0x2a')]['describe']()['then'](respondWithResult(_0x35d829,null))[_0xfc4a('0x40')](handleError(_0x35d829,null));}; \ No newline at end of file +var _0xf4db=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','rows','show','params','include','options','find','catch','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','MailSubstatus','type','key','model','map','query','keys','filters'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf4db,0xa5));var _0xbf4d=function(_0x42e7ce,_0x375d2e){_0x42e7ce=_0x42e7ce-0x0;var _0x3d5428=_0xf4db[_0x42e7ce];return _0x3d5428;};'use strict';var emlformat=require(_0xbf4d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf4d('0x1'));var jsonpatch=require(_0xbf4d('0x2'));var rp=require(_0xbf4d('0x3'));var moment=require(_0xbf4d('0x4'));var BPromise=require(_0xbf4d('0x5'));var Mustache=require(_0xbf4d('0x6'));var util=require('util');var path=require(_0xbf4d('0x7'));var sox=require(_0xbf4d('0x8'));var csv=require(_0xbf4d('0x9'));var ejs=require(_0xbf4d('0xa'));var fs=require('fs');var fs_extra=require(_0xbf4d('0xb'));var _=require(_0xbf4d('0xc'));var squel=require('squel');var crypto=require(_0xbf4d('0xd'));var jsforce=require(_0xbf4d('0xe'));var deskjs=require(_0xbf4d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf4d('0x10'));var Redis=require(_0xbf4d('0x11'));var authService=require(_0xbf4d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf4d('0x13'));var logger=require('../../config/logger')(_0xbf4d('0x14'));var utils=require(_0xbf4d('0x15'));var config=require(_0xbf4d('0x16'));var licenseUtil=require(_0xbf4d('0x17'));var db=require(_0xbf4d('0x18'))['db'];function respondWithStatusCode(_0x39f080,_0x477e3c){_0x477e3c=_0x477e3c||0xcc;return function(_0x3815f1){if(_0x3815f1){return _0x39f080[_0xbf4d('0x19')](_0x477e3c);}return _0x39f080[_0xbf4d('0x1a')](_0x477e3c)['end']();};}function respondWithResult(_0x389a64,_0x55b541){_0x55b541=_0x55b541||0xc8;return function(_0x12d55a){if(_0x12d55a){return _0x389a64[_0xbf4d('0x1a')](_0x55b541)[_0xbf4d('0x1b')](_0x12d55a);}};}function respondWithFilteredResult(_0x14fd64,_0x526deb){return function(_0x2ac874){if(_0x2ac874){var _0x1b5e7e=typeof _0x526deb[_0xbf4d('0x1c')]==='undefined'&&typeof _0x526deb['limit']==='undefined';var _0x180b68=_0x2ac874['count'];var _0xccec17=_0x1b5e7e?0x0:_0x526deb[_0xbf4d('0x1c')];var _0x14d864=_0x1b5e7e?_0x2ac874[_0xbf4d('0x1d')]:_0x526deb[_0xbf4d('0x1c')]+_0x526deb[_0xbf4d('0x1e')];var _0x4dbe6e;if(_0x14d864>=_0x180b68){_0x14d864=_0x180b68;_0x4dbe6e=0xc8;}else{_0x4dbe6e=0xce;}_0x14fd64[_0xbf4d('0x1a')](_0x4dbe6e);return _0x14fd64['set'](_0xbf4d('0x1f'),_0xccec17+'-'+_0x14d864+'/'+_0x180b68)[_0xbf4d('0x1b')](_0x2ac874);}return null;};}function patchUpdates(_0x348e11){return function(_0x5a1eac){try{jsonpatch['apply'](_0x5a1eac,_0x348e11,!![]);}catch(_0x2585f8){return BPromise[_0xbf4d('0x20')](_0x2585f8);}return _0x5a1eac[_0xbf4d('0x21')]();};}function saveUpdates(_0x4580c0,_0x50371d){return function(_0x551a40){if(_0x551a40){return _0x551a40[_0xbf4d('0x22')](_0x4580c0)[_0xbf4d('0x23')](function(_0x2ad341){return _0x2ad341;});}return null;};}function removeEntity(_0x11613c,_0x20e0b5){return function(_0x2816c1){if(_0x2816c1){return _0x2816c1[_0xbf4d('0x24')]()[_0xbf4d('0x23')](function(){_0x11613c['status'](0xcc)[_0xbf4d('0x25')]();});}};}function handleEntityNotFound(_0x2281b7,_0x3337fb){return function(_0x226cc5){if(!_0x226cc5){_0x2281b7['sendStatus'](0x194);}return _0x226cc5;};}function handleError(_0x20bfbf,_0x297257){_0x297257=_0x297257||0x1f4;return function(_0x50a815){logger[_0xbf4d('0x26')](_0x50a815[_0xbf4d('0x27')]);if(_0x50a815[_0xbf4d('0x28')]){delete _0x50a815[_0xbf4d('0x28')];}_0x20bfbf['status'](_0x297257)[_0xbf4d('0x29')](_0x50a815);};}exports[_0xbf4d('0x2a')]=function(_0x26fc37,_0x59214c){var _0x27e261={},_0x1f1743={},_0xe8347d={'count':0x0,'rows':[]};var _0x30a597=_['map'](db[_0xbf4d('0x2b')]['rawAttributes'],function(_0x484260){return{'name':_0x484260['fieldName'],'type':_0x484260[_0xbf4d('0x2c')][_0xbf4d('0x2d')]};});_0x1f1743[_0xbf4d('0x2e')]=_[_0xbf4d('0x2f')](_0x30a597,'name');_0x1f1743[_0xbf4d('0x30')]=_[_0xbf4d('0x31')](_0x26fc37[_0xbf4d('0x30')]);_0x1f1743[_0xbf4d('0x32')]=_[_0xbf4d('0x33')](_0x1f1743['model'],_0x1f1743[_0xbf4d('0x30')]);_0x27e261[_0xbf4d('0x34')]=_[_0xbf4d('0x33')](_0x1f1743['model'],qs[_0xbf4d('0x35')](_0x26fc37[_0xbf4d('0x30')][_0xbf4d('0x35')]));_0x27e261[_0xbf4d('0x34')]=_0x27e261[_0xbf4d('0x34')][_0xbf4d('0x36')]?_0x27e261['attributes']:_0x1f1743[_0xbf4d('0x2e')];if(!_0x26fc37[_0xbf4d('0x30')][_0xbf4d('0x37')](_0xbf4d('0x38'))){_0x27e261[_0xbf4d('0x1e')]=qs[_0xbf4d('0x1e')](_0x26fc37[_0xbf4d('0x30')][_0xbf4d('0x1e')]);_0x27e261['offset']=qs[_0xbf4d('0x1c')](_0x26fc37[_0xbf4d('0x30')]['offset']);}_0x27e261['order']=qs[_0xbf4d('0x39')](_0x26fc37[_0xbf4d('0x30')]['sort']);_0x27e261[_0xbf4d('0x3a')]=qs[_0xbf4d('0x32')](_['pick'](_0x26fc37[_0xbf4d('0x30')],_0x1f1743['filters']),_0x30a597);if(_0x26fc37[_0xbf4d('0x30')][_0xbf4d('0x3b')]){_0x27e261[_0xbf4d('0x3a')]=_[_0xbf4d('0x3c')](_0x27e261[_0xbf4d('0x3a')],{'$or':_['map'](_0x30a597,function(_0x2e0a54){if(_0x2e0a54[_0xbf4d('0x2c')]!==_0xbf4d('0x3d')){var _0x4aeaef={};_0x4aeaef[_0x2e0a54[_0xbf4d('0x28')]]={'$like':'%'+_0x26fc37['query'][_0xbf4d('0x3b')]+'%'};return _0x4aeaef;}})});}_0x27e261=_[_0xbf4d('0x3c')]({},_0x27e261,_0x26fc37['options']);var _0x24c14b={'where':_0x27e261[_0xbf4d('0x3a')]};return db['MailSubstatus'][_0xbf4d('0x1d')](_0x24c14b)['then'](function(_0x1c2768){_0xe8347d[_0xbf4d('0x1d')]=_0x1c2768;if(_0x26fc37[_0xbf4d('0x30')][_0xbf4d('0x3e')]){_0x27e261['include']=[{'all':!![]}];}return db[_0xbf4d('0x2b')]['findAll'](_0x27e261);})[_0xbf4d('0x23')](function(_0x29c922){_0xe8347d[_0xbf4d('0x3f')]=_0x29c922;return _0xe8347d;})[_0xbf4d('0x23')](respondWithFilteredResult(_0x59214c,_0x27e261))['catch'](handleError(_0x59214c,null));};exports[_0xbf4d('0x40')]=function(_0x4ff719,_0x2787e2){var _0xd4ee25={'raw':!![],'where':{'id':_0x4ff719[_0xbf4d('0x41')]['id']}},_0x21bf5c={};_0x21bf5c[_0xbf4d('0x2e')]=_[_0xbf4d('0x31')](db[_0xbf4d('0x2b')]['rawAttributes']);_0x21bf5c['query']=_['keys'](_0x4ff719[_0xbf4d('0x30')]);_0x21bf5c[_0xbf4d('0x32')]=_[_0xbf4d('0x33')](_0x21bf5c[_0xbf4d('0x2e')],_0x21bf5c[_0xbf4d('0x30')]);_0xd4ee25[_0xbf4d('0x34')]=_[_0xbf4d('0x33')](_0x21bf5c[_0xbf4d('0x2e')],qs[_0xbf4d('0x35')](_0x4ff719[_0xbf4d('0x30')][_0xbf4d('0x35')]));_0xd4ee25[_0xbf4d('0x34')]=_0xd4ee25[_0xbf4d('0x34')][_0xbf4d('0x36')]?_0xd4ee25[_0xbf4d('0x34')]:_0x21bf5c['model'];if(_0x4ff719['query'][_0xbf4d('0x3e')]){_0xd4ee25[_0xbf4d('0x42')]=[{'all':!![]}];}_0xd4ee25=_[_0xbf4d('0x3c')]({},_0xd4ee25,_0x4ff719[_0xbf4d('0x43')]);return db['MailSubstatus'][_0xbf4d('0x44')](_0xd4ee25)[_0xbf4d('0x23')](handleEntityNotFound(_0x2787e2,null))[_0xbf4d('0x23')](respondWithResult(_0x2787e2,null))[_0xbf4d('0x45')](handleError(_0x2787e2,null));};exports['create']=function(_0x1ff252,_0x734027){return db[_0xbf4d('0x2b')]['create'](_0x1ff252['body'],{})[_0xbf4d('0x23')](respondWithResult(_0x734027,0xc9))['catch'](handleError(_0x734027,null));};exports[_0xbf4d('0x22')]=function(_0x5183c0,_0x105a81){if(_0x5183c0[_0xbf4d('0x46')]['id']){delete _0x5183c0[_0xbf4d('0x46')]['id'];}return db[_0xbf4d('0x2b')][_0xbf4d('0x44')]({'where':{'id':_0x5183c0[_0xbf4d('0x41')]['id']}})[_0xbf4d('0x23')](handleEntityNotFound(_0x105a81,null))['then'](saveUpdates(_0x5183c0[_0xbf4d('0x46')],null))[_0xbf4d('0x23')](respondWithResult(_0x105a81,null))[_0xbf4d('0x45')](handleError(_0x105a81,null));};exports[_0xbf4d('0x24')]=function(_0x175284,_0x457597){return db[_0xbf4d('0x2b')]['find']({'where':{'id':_0x175284[_0xbf4d('0x41')]['id']}})[_0xbf4d('0x23')](handleEntityNotFound(_0x457597,null))[_0xbf4d('0x23')](removeEntity(_0x457597,null))[_0xbf4d('0x45')](handleError(_0x457597,null));};exports[_0xbf4d('0x47')]=function(_0x377f9c,_0x314ea8){return db['MailSubstatus'][_0xbf4d('0x47')]()[_0xbf4d('0x23')](respondWithResult(_0x314ea8,null))[_0xbf4d('0x45')](handleError(_0x314ea8,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index cbe8f1b..771590a 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 _0x6abb=['setMaxListeners','update','emit','hook','exports','../../mysqldb'];(function(_0x44532f,_0x2dac86){var _0x11e878=function(_0x1cb557){while(--_0x1cb557){_0x44532f['push'](_0x44532f['shift']());}};_0x11e878(++_0x2dac86);}(_0x6abb,0xf5));var _0xb6ab=function(_0x42f8fb,_0x326d5b){_0x42f8fb=_0x42f8fb-0x0;var _0x3e3df9=_0x6abb[_0x42f8fb];return _0x3e3df9;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xb6ab('0x0'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xb6ab('0x1')](0x0);var events={'afterUpdate':_0xb6ab('0x2')};function emitEvent(_0x9b638c){return function(_0x202ec0,_0x53a6e5,_0x55d0db){MailSubstatusEvents[_0xb6ab('0x3')](_0x9b638c+':'+_0x202ec0['id'],_0x202ec0);MailSubstatusEvents[_0xb6ab('0x3')](_0x9b638c,_0x202ec0);_0x55d0db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xb6ab('0x4')](e,emitEvent(event));}}module[_0xb6ab('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x6b49=['hasOwnProperty','exports','MailSubstatus','update','emit'];(function(_0x4a01f6,_0x4cdaa8){var _0x1a00e0=function(_0x274c93){while(--_0x274c93){_0x4a01f6['push'](_0x4a01f6['shift']());}};_0x1a00e0(++_0x4cdaa8);}(_0x6b49,0x1d3));var _0x96b4=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x6b49[_0x13b392];return _0x39db24;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0x96b4('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x96b4('0x1')};function emitEvent(_0xcfca68){return function(_0x104b0e,_0x402fae,_0x201229){MailSubstatusEvents[_0x96b4('0x2')](_0xcfca68+':'+_0x104b0e['id'],_0x104b0e);MailSubstatusEvents[_0x96b4('0x2')](_0xcfca68,_0x104b0e);_0x201229(null);};}for(var e in events){if(events[_0x96b4('0x3')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x96b4('0x4')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 56ebd48..99bd896 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 _0xcaa7=['exports','models','MailSubstatus','mail_substatuses','Condition','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes'];(function(_0x3a84e7,_0x3ea135){var _0x1f7d06=function(_0x86eb1d){while(--_0x86eb1d){_0x3a84e7['push'](_0x3a84e7['shift']());}};_0x1f7d06(++_0x3ea135);}(_0xcaa7,0x16a));var _0x7caa=function(_0x2c7d90,_0x129415){_0x2c7d90=_0x2c7d90-0x0;var _0x35a25c=_0xcaa7[_0x2c7d90];return _0x35a25c;};'use strict';var attributes=require(_0x7caa('0x0'));module[_0x7caa('0x1')]=function(_0x4073e6){var _0x552696=_0x4073e6[_0x7caa('0x2')];return _0x4073e6['define'](_0x7caa('0x3'),attributes,{'tableName':_0x7caa('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4fb4aa,_0x22876d,_0x33fc93){return _0x552696[_0x7caa('0x5')]['update']({'value':_0x4fb4aa['name']},{'where':{'field':_0x7caa('0x6'),'value':_0x4fb4aa[_0x7caa('0x7')][_0x7caa('0x8')]}})[_0x7caa('0x9')](function(){_0x33fc93();})[_0x7caa('0xa')](function(_0x25677a){_0x33fc93(_0x25677a);});}}});}; \ No newline at end of file +var _0x10dc=['./mailSubstatus.attributes','exports','models','Condition','name','mailSubstatus','_previousDataValues','then','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x10dc,0x90));var _0xc10d=function(_0x12399a,_0x2462c2){_0x12399a=_0x12399a-0x0;var _0x590db3=_0x10dc[_0x12399a];return _0x590db3;};'use strict';var attributes=require(_0xc10d('0x0'));module[_0xc10d('0x1')]=function(_0x379acd){var _0x30f4b6=_0x379acd[_0xc10d('0x2')];return _0x379acd['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3687e3,_0x140715,_0x45911d){return _0x30f4b6[_0xc10d('0x3')]['update']({'value':_0x3687e3[_0xc10d('0x4')]},{'where':{'field':_0xc10d('0x5'),'value':_0x3687e3[_0xc10d('0x6')][_0xc10d('0x4')]}})[_0xc10d('0x7')](function(){_0x45911d();})[_0xc10d('0x8')](function(_0x1327d6){_0x45911d(_0x1327d6);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 868d6bc..4d89599 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 _0x4487=['then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4a7641,_0x2c20e5){var _0x1130e3=function(_0x1b25f2){while(--_0x1b25f2){_0x4a7641['push'](_0x4a7641['shift']());}};_0x1130e3(++_0x2c20e5);}(_0x4487,0x9b));var _0x7448=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x4487[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0x7448('0x0'));var util=require('util');var moment=require(_0x7448('0x1'));var BPromise=require(_0x7448('0x2'));var rs=require(_0x7448('0x3'));var fs=require('fs');var Redis=require(_0x7448('0x4'));var db=require(_0x7448('0x5'))['db'];var utils=require(_0x7448('0x6'));var logger=require(_0x7448('0x7'))(_0x7448('0x8'));var config=require(_0x7448('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7448('0xa')][_0x7448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x254ad5,_0x3e374c,_0x2a424b){return new BPromise(function(_0x1ea077,_0x5be5b0){return client[_0x7448('0xc')](_0x254ad5,_0x2a424b)[_0x7448('0xd')](function(_0x55dab2){logger[_0x7448('0xe')](_0x7448('0xf'),_0x3e374c,_0x7448('0x10'));logger[_0x7448('0x11')](_0x7448('0x12'),_0x3e374c,_0x7448('0x10'),JSON['stringify'](_0x55dab2));if(_0x55dab2['error']){if(_0x55dab2[_0x7448('0x13')][_0x7448('0x14')]===0x1f4){logger[_0x7448('0x13')](_0x7448('0xf'),_0x3e374c,_0x55dab2[_0x7448('0x13')][_0x7448('0x15')]);return _0x5be5b0(_0x55dab2[_0x7448('0x13')][_0x7448('0x15')]);}logger[_0x7448('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x3e374c,_0x55dab2['error'][_0x7448('0x15')]);return _0x1ea077(_0x55dab2[_0x7448('0x13')]['message']);}else{logger[_0x7448('0xe')](_0x7448('0xf'),_0x3e374c,_0x7448('0x10'));_0x1ea077(_0x55dab2[_0x7448('0x16')][_0x7448('0x15')]);}})[_0x7448('0x17')](function(_0x520fc5){logger[_0x7448('0x13')](_0x7448('0xf'),_0x3e374c,_0x520fc5);_0x5be5b0(_0x520fc5);});});} \ No newline at end of file +var _0x6761=['../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','MailSubstatus,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x408339,_0xed63d4){var _0x28ceb4=function(_0x7b5f4e){while(--_0x7b5f4e){_0x408339['push'](_0x408339['shift']());}};_0x28ceb4(++_0xed63d4);}(_0x6761,0xc0));var _0x1676=function(_0x2a74e3,_0x58b6d6){_0x2a74e3=_0x2a74e3-0x0;var _0x450156=_0x6761[_0x2a74e3];return _0x450156;};'use strict';var _=require(_0x1676('0x0'));var util=require('util');var moment=require(_0x1676('0x1'));var BPromise=require(_0x1676('0x2'));var rs=require(_0x1676('0x3'));var fs=require('fs');var Redis=require(_0x1676('0x4'));var db=require(_0x1676('0x5'))['db'];var utils=require(_0x1676('0x6'));var logger=require(_0x1676('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1676('0x8'));var client=jayson[_0x1676('0x9')][_0x1676('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x591088,_0x4eccec,_0x406f7f){return new BPromise(function(_0x3df338,_0x58fb8e){return client['request'](_0x591088,_0x406f7f)[_0x1676('0xb')](function(_0x5e9b9e){logger[_0x1676('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x4eccec,_0x1676('0xd'));logger[_0x1676('0xe')](_0x1676('0xf'),_0x4eccec,'request\x20sent',JSON[_0x1676('0x10')](_0x5e9b9e));if(_0x5e9b9e[_0x1676('0x11')]){if(_0x5e9b9e['error']['code']===0x1f4){logger[_0x1676('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x4eccec,_0x5e9b9e[_0x1676('0x11')][_0x1676('0x12')]);return _0x58fb8e(_0x5e9b9e[_0x1676('0x11')]['message']);}logger[_0x1676('0x11')](_0x1676('0x13'),_0x4eccec,_0x5e9b9e['error'][_0x1676('0x12')]);return _0x3df338(_0x5e9b9e[_0x1676('0x11')][_0x1676('0x12')]);}else{logger[_0x1676('0xc')](_0x1676('0x13'),_0x4eccec,_0x1676('0xd'));_0x3df338(_0x5e9b9e[_0x1676('0x14')]['message']);}})[_0x1676('0x15')](function(_0x3d88fc){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x4eccec,_0x3d88fc);_0x58fb8e(_0x3d88fc);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 48ff7d7..3c9f03a 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 _0xc12f=['fs-extra','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x5ab27f,_0x21a462){var _0x23826c=function(_0x4292ac){while(--_0x4292ac){_0x5ab27f['push'](_0x5ab27f['shift']());}};_0x23826c(++_0x21a462);}(_0xc12f,0xb7));var _0xfc12=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xc12f[_0x5f309e];return _0x487b5e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfc12('0x0'));var timeout=require(_0xfc12('0x1'));var express=require(_0xfc12('0x2'));var router=express[_0xfc12('0x3')]();var fs_extra=require(_0xfc12('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xfc12('0x5')]('/',auth[_0xfc12('0x6')](),controller[_0xfc12('0x7')]);router[_0xfc12('0x5')]('/describe',auth[_0xfc12('0x6')](),controller['describe']);router['get']('/:id',auth[_0xfc12('0x6')](),controller[_0xfc12('0x8')]);router[_0xfc12('0x9')]('/',auth[_0xfc12('0x6')](),controller[_0xfc12('0xa')]);router[_0xfc12('0xb')](_0xfc12('0xc'),auth[_0xfc12('0x6')](),controller[_0xfc12('0xd')]);router[_0xfc12('0xe')](_0xfc12('0xc'),auth[_0xfc12('0x6')](),controller[_0xfc12('0xf')]);module[_0xfc12('0x10')]=router; \ No newline at end of file +var _0xaaaf=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x2d1198,_0x37ddcc){var _0x88805f=function(_0x1fd073){while(--_0x1fd073){_0x2d1198['push'](_0x2d1198['shift']());}};_0x88805f(++_0x37ddcc);}(_0xaaaf,0x6c));var _0xfaaa=function(_0x575142,_0xd931de){_0x575142=_0x575142-0x0;var _0x5c8770=_0xaaaf[_0x575142];return _0x5c8770;};'use strict';var multer=require(_0xfaaa('0x0'));var util=require(_0xfaaa('0x1'));var path=require(_0xfaaa('0x2'));var timeout=require('connect-timeout');var express=require(_0xfaaa('0x3'));var router=express[_0xfaaa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfaaa('0x5'));var interaction=require(_0xfaaa('0x6'));var config=require('../../config/environment');var controller=require(_0xfaaa('0x7'));router[_0xfaaa('0x8')]('/',auth['isAuthenticated'](),controller[_0xfaaa('0x9')]);router[_0xfaaa('0x8')](_0xfaaa('0xa'),auth[_0xfaaa('0xb')](),controller[_0xfaaa('0xc')]);router[_0xfaaa('0x8')](_0xfaaa('0xd'),auth[_0xfaaa('0xb')](),controller[_0xfaaa('0xe')]);router[_0xfaaa('0xf')]('/',auth[_0xfaaa('0xb')](),controller[_0xfaaa('0x10')]);router[_0xfaaa('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfaaa('0x12')](_0xfaaa('0xd'),auth[_0xfaaa('0xb')](),controller[_0xfaaa('0x13')]);module[_0xfaaa('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index ab91ecc..d33e3fc 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xb14b26,_0x38cf9f){var _0xfdb28a=function(_0x380d1c){while(--_0x380d1c){_0xb14b26['push'](_0xb14b26['shift']());}};_0xfdb28a(++_0x38cf9f);}(_0x34e8,0x12c));var _0x834e=function(_0x3ebf22,_0xcb8465){_0x3ebf22=_0x3ebf22-0x0;var _0x4f0380=_0x34e8[_0x3ebf22];return _0x4f0380;};'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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x1a1b93,_0x5d8eae){var _0x4c3ce0=function(_0x2a45ea){while(--_0x2a45ea){_0x1a1b93['push'](_0x1a1b93['shift']());}};_0x4c3ce0(++_0x5d8eae);}(_0x00bb,0x1d8));var _0xb00b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00bb[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ad938f5..eeb7eaa 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 _0x9ad2=['lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','includeAll','findAll','rows','then','catch','include','options','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra'];(function(_0x2cc7a8,_0xd13a33){var _0x131c53=function(_0x553320){while(--_0x553320){_0x2cc7a8['push'](_0x2cc7a8['shift']());}};_0x131c53(++_0xd13a33);}(_0x9ad2,0x1c4));var _0x29ad=function(_0x5af25d,_0x5f0091){_0x5af25d=_0x5af25d-0x0;var _0x430703=_0x9ad2[_0x5af25d];return _0x430703;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29ad('0x0'));var zipdir=require(_0x29ad('0x1'));var jsonpatch=require(_0x29ad('0x2'));var rp=require(_0x29ad('0x3'));var moment=require(_0x29ad('0x4'));var BPromise=require(_0x29ad('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x29ad('0x6'));var sox=require(_0x29ad('0x7'));var csv=require('to-csv');var ejs=require(_0x29ad('0x8'));var fs=require('fs');var fs_extra=require(_0x29ad('0x9'));var _=require(_0x29ad('0xa'));var squel=require(_0x29ad('0xb'));var crypto=require('crypto');var jsforce=require(_0x29ad('0xc'));var deskjs=require(_0x29ad('0xd'));var toCsv=require(_0x29ad('0xe'));var querystring=require(_0x29ad('0xf'));var Papa=require(_0x29ad('0x10'));var Redis=require(_0x29ad('0x11'));var authService=require(_0x29ad('0x12'));var qs=require(_0x29ad('0x13'));var as=require(_0x29ad('0x14'));var hardwareService=require(_0x29ad('0x15'));var logger=require(_0x29ad('0x16'))(_0x29ad('0x17'));var utils=require(_0x29ad('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x29ad('0x19'));var db=require(_0x29ad('0x1a'))['db'];function respondWithStatusCode(_0x75b17b,_0x381767){_0x381767=_0x381767||0xcc;return function(_0x2582ea){if(_0x2582ea){return _0x75b17b[_0x29ad('0x1b')](_0x381767);}return _0x75b17b[_0x29ad('0x1c')](_0x381767)[_0x29ad('0x1d')]();};}function respondWithResult(_0x5b3b05,_0x46ccce){_0x46ccce=_0x46ccce||0xc8;return function(_0x43c577){if(_0x43c577){return _0x5b3b05['status'](_0x46ccce)[_0x29ad('0x1e')](_0x43c577);}};}function respondWithFilteredResult(_0x2cb7b1,_0x1a7cd2){return function(_0x5015b0){if(_0x5015b0){var _0x4a0af3=typeof _0x1a7cd2[_0x29ad('0x1f')]==='undefined'&&typeof _0x1a7cd2[_0x29ad('0x20')]==='undefined';var _0x500291=_0x5015b0[_0x29ad('0x21')];var _0x302b99=_0x4a0af3?0x0:_0x1a7cd2['offset'];var _0x3beb1e=_0x4a0af3?_0x5015b0[_0x29ad('0x21')]:_0x1a7cd2['offset']+_0x1a7cd2[_0x29ad('0x20')];var _0x1b1050;if(_0x3beb1e>=_0x500291){_0x3beb1e=_0x500291;_0x1b1050=0xc8;}else{_0x1b1050=0xce;}_0x2cb7b1[_0x29ad('0x1c')](_0x1b1050);return _0x2cb7b1[_0x29ad('0x22')](_0x29ad('0x23'),_0x302b99+'-'+_0x3beb1e+'/'+_0x500291)[_0x29ad('0x1e')](_0x5015b0);}return null;};}function patchUpdates(_0x17884d){return function(_0x421d1f){try{jsonpatch[_0x29ad('0x24')](_0x421d1f,_0x17884d,!![]);}catch(_0x426440){return BPromise[_0x29ad('0x25')](_0x426440);}return _0x421d1f[_0x29ad('0x26')]();};}function saveUpdates(_0x1c94a5,_0x4e83f9){return function(_0x20dc2f){if(_0x20dc2f){return _0x20dc2f[_0x29ad('0x27')](_0x1c94a5)['then'](function(_0x44a8e4){return _0x44a8e4;});}return null;};}function removeEntity(_0x32c8d2,_0x1ef34a){return function(_0x425b53){if(_0x425b53){return _0x425b53[_0x29ad('0x28')]()['then'](function(){_0x32c8d2['status'](0xcc)[_0x29ad('0x1d')]();});}};}function handleEntityNotFound(_0x1589d7,_0x34d73a){return function(_0x3e33db){if(!_0x3e33db){_0x1589d7[_0x29ad('0x1b')](0x194);}return _0x3e33db;};}function handleError(_0x380ebb,_0x44f8c9){_0x44f8c9=_0x44f8c9||0x1f4;return function(_0x434973){logger[_0x29ad('0x29')](_0x434973[_0x29ad('0x2a')]);if(_0x434973[_0x29ad('0x2b')]){delete _0x434973['name'];}_0x380ebb[_0x29ad('0x1c')](_0x44f8c9)[_0x29ad('0x2c')](_0x434973);};}exports[_0x29ad('0x2d')]=function(_0x2b78da,_0x1f2d48){var _0x5841e6={},_0xd65dc9={},_0x35520f={'count':0x0,'rows':[]};var _0x51d801=_[_0x29ad('0x2e')](db[_0x29ad('0x2f')][_0x29ad('0x30')],function(_0x56206d){return{'name':_0x56206d['fieldName'],'type':_0x56206d[_0x29ad('0x31')][_0x29ad('0x32')]};});_0xd65dc9[_0x29ad('0x33')]=_[_0x29ad('0x2e')](_0x51d801,_0x29ad('0x2b'));_0xd65dc9[_0x29ad('0x34')]=_[_0x29ad('0x35')](_0x2b78da[_0x29ad('0x34')]);_0xd65dc9[_0x29ad('0x36')]=_[_0x29ad('0x37')](_0xd65dc9[_0x29ad('0x33')],_0xd65dc9['query']);_0x5841e6[_0x29ad('0x38')]=_['intersection'](_0xd65dc9['model'],qs[_0x29ad('0x39')](_0x2b78da['query']['fields']));_0x5841e6[_0x29ad('0x38')]=_0x5841e6[_0x29ad('0x38')][_0x29ad('0x3a')]?_0x5841e6[_0x29ad('0x38')]:_0xd65dc9[_0x29ad('0x33')];if(!_0x2b78da[_0x29ad('0x34')]['hasOwnProperty'](_0x29ad('0x3b'))){_0x5841e6['limit']=qs[_0x29ad('0x20')](_0x2b78da[_0x29ad('0x34')]['limit']);_0x5841e6[_0x29ad('0x1f')]=qs[_0x29ad('0x1f')](_0x2b78da[_0x29ad('0x34')][_0x29ad('0x1f')]);}_0x5841e6[_0x29ad('0x3c')]=qs[_0x29ad('0x3d')](_0x2b78da[_0x29ad('0x34')][_0x29ad('0x3d')]);_0x5841e6['where']=qs[_0x29ad('0x36')](_[_0x29ad('0x3e')](_0x2b78da['query'],_0xd65dc9[_0x29ad('0x36')]),_0x51d801);if(_0x2b78da[_0x29ad('0x34')][_0x29ad('0x3f')]){_0x5841e6[_0x29ad('0x40')]=_[_0x29ad('0x41')](_0x5841e6[_0x29ad('0x40')],{'$or':_[_0x29ad('0x2e')](_0x51d801,function(_0x1e2a4c){if(_0x1e2a4c[_0x29ad('0x31')]!=='VIRTUAL'){var _0x34d88b={};_0x34d88b[_0x1e2a4c[_0x29ad('0x2b')]]={'$like':'%'+_0x2b78da['query'][_0x29ad('0x3f')]+'%'};return _0x34d88b;}})});}_0x5841e6=_['merge']({},_0x5841e6,_0x2b78da['options']);var _0x1dcd50={'where':_0x5841e6[_0x29ad('0x40')]};return db[_0x29ad('0x2f')][_0x29ad('0x21')](_0x1dcd50)['then'](function(_0x20212a){_0x35520f['count']=_0x20212a;if(_0x2b78da[_0x29ad('0x34')][_0x29ad('0x42')]){_0x5841e6['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x29ad('0x43')](_0x5841e6);})['then'](function(_0x4e7085){_0x35520f[_0x29ad('0x44')]=_0x4e7085;return _0x35520f;})[_0x29ad('0x45')](respondWithFilteredResult(_0x1f2d48,_0x5841e6))[_0x29ad('0x46')](handleError(_0x1f2d48,null));};exports['show']=function(_0x1525ec,_0x5a890b){var _0x2addf1={'raw':!![],'where':{'id':_0x1525ec['params']['id']}},_0x1009ad={};_0x1009ad[_0x29ad('0x33')]=_[_0x29ad('0x35')](db[_0x29ad('0x2f')][_0x29ad('0x30')]);_0x1009ad[_0x29ad('0x34')]=_[_0x29ad('0x35')](_0x1525ec[_0x29ad('0x34')]);_0x1009ad[_0x29ad('0x36')]=_[_0x29ad('0x37')](_0x1009ad[_0x29ad('0x33')],_0x1009ad[_0x29ad('0x34')]);_0x2addf1[_0x29ad('0x38')]=_[_0x29ad('0x37')](_0x1009ad[_0x29ad('0x33')],qs['fields'](_0x1525ec[_0x29ad('0x34')]['fields']));_0x2addf1[_0x29ad('0x38')]=_0x2addf1['attributes'][_0x29ad('0x3a')]?_0x2addf1[_0x29ad('0x38')]:_0x1009ad[_0x29ad('0x33')];if(_0x1525ec['query'][_0x29ad('0x42')]){_0x2addf1[_0x29ad('0x47')]=[{'all':!![]}];}_0x2addf1=_[_0x29ad('0x41')]({},_0x2addf1,_0x1525ec[_0x29ad('0x48')]);return db[_0x29ad('0x2f')][_0x29ad('0x49')](_0x2addf1)[_0x29ad('0x45')](handleEntityNotFound(_0x5a890b,null))['then'](respondWithResult(_0x5a890b,null))[_0x29ad('0x46')](handleError(_0x5a890b,null));};exports['create']=function(_0x5414c6,_0x22575a){return db[_0x29ad('0x2f')]['create'](_0x5414c6[_0x29ad('0x4a')],{})[_0x29ad('0x45')](respondWithResult(_0x22575a,0xc9))[_0x29ad('0x46')](handleError(_0x22575a,null));};exports[_0x29ad('0x27')]=function(_0x325ef0,_0x1267e3){if(_0x325ef0[_0x29ad('0x4a')]['id']){delete _0x325ef0[_0x29ad('0x4a')]['id'];}return db[_0x29ad('0x2f')][_0x29ad('0x49')]({'where':{'id':_0x325ef0['params']['id']}})[_0x29ad('0x45')](handleEntityNotFound(_0x1267e3,null))[_0x29ad('0x45')](saveUpdates(_0x325ef0[_0x29ad('0x4a')],null))[_0x29ad('0x45')](respondWithResult(_0x1267e3,null))['catch'](handleError(_0x1267e3,null));};exports[_0x29ad('0x28')]=function(_0x23e2c6,_0x28bb21){return db[_0x29ad('0x2f')][_0x29ad('0x49')]({'where':{'id':_0x23e2c6[_0x29ad('0x4b')]['id']}})[_0x29ad('0x45')](handleEntityNotFound(_0x28bb21,null))[_0x29ad('0x45')](removeEntity(_0x28bb21,null))['catch'](handleError(_0x28bb21,null));};exports[_0x29ad('0x4c')]=function(_0xcc5aab,_0x19cc58){return db[_0x29ad('0x2f')]['describe']()[_0x29ad('0x45')](respondWithResult(_0x19cc58,null))[_0x29ad('0x46')](handleError(_0x19cc58,null));}; \ No newline at end of file +var _0x0f2e=['end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','MailTransferReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','filter','where','VIRTUAL','merge','options','include','rows','catch','show','keys','includeAll','create','body','find','describe','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x42b54e,_0x5a194f){var _0x3f17cd=function(_0x54bd8a){while(--_0x54bd8a){_0x42b54e['push'](_0x42b54e['shift']());}};_0x3f17cd(++_0x5a194f);}(_0x0f2e,0x75));var _0xe0f2=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0x0f2e[_0x2714ec];return _0x2608e5;};'use strict';var emlformat=require(_0xe0f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0f2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0f2('0x2'));var moment=require('moment');var BPromise=require(_0xe0f2('0x3'));var Mustache=require(_0xe0f2('0x4'));var util=require('util');var path=require(_0xe0f2('0x5'));var sox=require(_0xe0f2('0x6'));var csv=require(_0xe0f2('0x7'));var ejs=require(_0xe0f2('0x8'));var fs=require('fs');var fs_extra=require(_0xe0f2('0x9'));var _=require(_0xe0f2('0xa'));var squel=require(_0xe0f2('0xb'));var crypto=require(_0xe0f2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe0f2('0xd'));var toCsv=require(_0xe0f2('0x7'));var querystring=require(_0xe0f2('0xe'));var Papa=require(_0xe0f2('0xf'));var Redis=require('ioredis');var authService=require(_0xe0f2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0f2('0x11'))(_0xe0f2('0x12'));var utils=require(_0xe0f2('0x13'));var config=require(_0xe0f2('0x14'));var licenseUtil=require(_0xe0f2('0x15'));var db=require(_0xe0f2('0x16'))['db'];function respondWithStatusCode(_0x20c464,_0x2f0be2){_0x2f0be2=_0x2f0be2||0xcc;return function(_0x54065b){if(_0x54065b){return _0x20c464[_0xe0f2('0x17')](_0x2f0be2);}return _0x20c464[_0xe0f2('0x18')](_0x2f0be2)[_0xe0f2('0x19')]();};}function respondWithResult(_0x4fa0cc,_0x54e243){_0x54e243=_0x54e243||0xc8;return function(_0x5f56db){if(_0x5f56db){return _0x4fa0cc[_0xe0f2('0x18')](_0x54e243)[_0xe0f2('0x1a')](_0x5f56db);}};}function respondWithFilteredResult(_0x44260e,_0xb57309){return function(_0x229415){if(_0x229415){var _0x2b1fa9=typeof _0xb57309['offset']===_0xe0f2('0x1b')&&typeof _0xb57309[_0xe0f2('0x1c')]===_0xe0f2('0x1b');var _0x381803=_0x229415[_0xe0f2('0x1d')];var _0x478d00=_0x2b1fa9?0x0:_0xb57309[_0xe0f2('0x1e')];var _0x166ed1=_0x2b1fa9?_0x229415[_0xe0f2('0x1d')]:_0xb57309[_0xe0f2('0x1e')]+_0xb57309[_0xe0f2('0x1c')];var _0x5c4357;if(_0x166ed1>=_0x381803){_0x166ed1=_0x381803;_0x5c4357=0xc8;}else{_0x5c4357=0xce;}_0x44260e[_0xe0f2('0x18')](_0x5c4357);return _0x44260e[_0xe0f2('0x1f')](_0xe0f2('0x20'),_0x478d00+'-'+_0x166ed1+'/'+_0x381803)[_0xe0f2('0x1a')](_0x229415);}return null;};}function patchUpdates(_0x1012cc){return function(_0x53f374){try{jsonpatch[_0xe0f2('0x21')](_0x53f374,_0x1012cc,!![]);}catch(_0x254eff){return BPromise[_0xe0f2('0x22')](_0x254eff);}return _0x53f374['save']();};}function saveUpdates(_0xda10c3,_0x9551bd){return function(_0x41db6c){if(_0x41db6c){return _0x41db6c[_0xe0f2('0x23')](_0xda10c3)[_0xe0f2('0x24')](function(_0x562424){return _0x562424;});}return null;};}function removeEntity(_0x4c2c6e,_0x3bb01e){return function(_0x3fef0f){if(_0x3fef0f){return _0x3fef0f[_0xe0f2('0x25')]()['then'](function(){_0x4c2c6e[_0xe0f2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e0011,_0x4eafa5){return function(_0xa896df){if(!_0xa896df){_0x4e0011[_0xe0f2('0x17')](0x194);}return _0xa896df;};}function handleError(_0x42abde,_0x82f4e3){_0x82f4e3=_0x82f4e3||0x1f4;return function(_0x54d859){logger[_0xe0f2('0x26')](_0x54d859[_0xe0f2('0x27')]);if(_0x54d859[_0xe0f2('0x28')]){delete _0x54d859['name'];}_0x42abde['status'](_0x82f4e3)['send'](_0x54d859);};}exports[_0xe0f2('0x29')]=function(_0x491c14,_0x4fedb5){var _0x25ba07={},_0x4d89de={},_0x3f7df3={'count':0x0,'rows':[]};var _0x396eb7=_['map'](db[_0xe0f2('0x2a')][_0xe0f2('0x2b')],function(_0x475096){return{'name':_0x475096[_0xe0f2('0x2c')],'type':_0x475096['type'][_0xe0f2('0x2d')]};});_0x4d89de[_0xe0f2('0x2e')]=_[_0xe0f2('0x2f')](_0x396eb7,'name');_0x4d89de[_0xe0f2('0x30')]=_['keys'](_0x491c14['query']);_0x4d89de[_0xe0f2('0x31')]=_[_0xe0f2('0x32')](_0x4d89de[_0xe0f2('0x2e')],_0x4d89de[_0xe0f2('0x30')]);_0x25ba07[_0xe0f2('0x33')]=_[_0xe0f2('0x32')](_0x4d89de[_0xe0f2('0x2e')],qs['fields'](_0x491c14[_0xe0f2('0x30')][_0xe0f2('0x34')]));_0x25ba07[_0xe0f2('0x33')]=_0x25ba07[_0xe0f2('0x33')][_0xe0f2('0x35')]?_0x25ba07[_0xe0f2('0x33')]:_0x4d89de[_0xe0f2('0x2e')];if(!_0x491c14[_0xe0f2('0x30')]['hasOwnProperty']('nolimit')){_0x25ba07[_0xe0f2('0x1c')]=qs[_0xe0f2('0x1c')](_0x491c14[_0xe0f2('0x30')]['limit']);_0x25ba07[_0xe0f2('0x1e')]=qs[_0xe0f2('0x1e')](_0x491c14[_0xe0f2('0x30')][_0xe0f2('0x1e')]);}_0x25ba07[_0xe0f2('0x36')]=qs['sort'](_0x491c14[_0xe0f2('0x30')][_0xe0f2('0x37')]);_0x25ba07['where']=qs[_0xe0f2('0x31')](_['pick'](_0x491c14[_0xe0f2('0x30')],_0x4d89de[_0xe0f2('0x31')]),_0x396eb7);if(_0x491c14[_0xe0f2('0x30')][_0xe0f2('0x38')]){_0x25ba07[_0xe0f2('0x39')]=_['merge'](_0x25ba07[_0xe0f2('0x39')],{'$or':_[_0xe0f2('0x2f')](_0x396eb7,function(_0x2170e2){if(_0x2170e2['type']!==_0xe0f2('0x3a')){var _0x19b8c0={};_0x19b8c0[_0x2170e2['name']]={'$like':'%'+_0x491c14[_0xe0f2('0x30')][_0xe0f2('0x38')]+'%'};return _0x19b8c0;}})});}_0x25ba07=_[_0xe0f2('0x3b')]({},_0x25ba07,_0x491c14[_0xe0f2('0x3c')]);var _0x1709a5={'where':_0x25ba07['where']};return db['MailTransferReport'][_0xe0f2('0x1d')](_0x1709a5)[_0xe0f2('0x24')](function(_0x2b5999){_0x3f7df3[_0xe0f2('0x1d')]=_0x2b5999;if(_0x491c14[_0xe0f2('0x30')]['includeAll']){_0x25ba07[_0xe0f2('0x3d')]=[{'all':!![]}];}return db[_0xe0f2('0x2a')]['findAll'](_0x25ba07);})[_0xe0f2('0x24')](function(_0x2784da){_0x3f7df3[_0xe0f2('0x3e')]=_0x2784da;return _0x3f7df3;})[_0xe0f2('0x24')](respondWithFilteredResult(_0x4fedb5,_0x25ba07))[_0xe0f2('0x3f')](handleError(_0x4fedb5,null));};exports[_0xe0f2('0x40')]=function(_0x1707fa,_0x48e1b7){var _0x1fa47f={'raw':!![],'where':{'id':_0x1707fa['params']['id']}},_0x8a8089={};_0x8a8089['model']=_[_0xe0f2('0x41')](db['MailTransferReport'][_0xe0f2('0x2b')]);_0x8a8089['query']=_[_0xe0f2('0x41')](_0x1707fa['query']);_0x8a8089[_0xe0f2('0x31')]=_[_0xe0f2('0x32')](_0x8a8089['model'],_0x8a8089[_0xe0f2('0x30')]);_0x1fa47f[_0xe0f2('0x33')]=_[_0xe0f2('0x32')](_0x8a8089[_0xe0f2('0x2e')],qs[_0xe0f2('0x34')](_0x1707fa[_0xe0f2('0x30')]['fields']));_0x1fa47f['attributes']=_0x1fa47f[_0xe0f2('0x33')]['length']?_0x1fa47f[_0xe0f2('0x33')]:_0x8a8089['model'];if(_0x1707fa[_0xe0f2('0x30')][_0xe0f2('0x42')]){_0x1fa47f[_0xe0f2('0x3d')]=[{'all':!![]}];}_0x1fa47f=_[_0xe0f2('0x3b')]({},_0x1fa47f,_0x1707fa[_0xe0f2('0x3c')]);return db[_0xe0f2('0x2a')]['find'](_0x1fa47f)[_0xe0f2('0x24')](handleEntityNotFound(_0x48e1b7,null))[_0xe0f2('0x24')](respondWithResult(_0x48e1b7,null))[_0xe0f2('0x3f')](handleError(_0x48e1b7,null));};exports['create']=function(_0x40db37,_0x474dc9){return db[_0xe0f2('0x2a')][_0xe0f2('0x43')](_0x40db37[_0xe0f2('0x44')],{})[_0xe0f2('0x24')](respondWithResult(_0x474dc9,0xc9))['catch'](handleError(_0x474dc9,null));};exports[_0xe0f2('0x23')]=function(_0x2f7e63,_0x2604f4){if(_0x2f7e63[_0xe0f2('0x44')]['id']){delete _0x2f7e63[_0xe0f2('0x44')]['id'];}return db[_0xe0f2('0x2a')][_0xe0f2('0x45')]({'where':{'id':_0x2f7e63['params']['id']}})[_0xe0f2('0x24')](handleEntityNotFound(_0x2604f4,null))[_0xe0f2('0x24')](saveUpdates(_0x2f7e63[_0xe0f2('0x44')],null))['then'](respondWithResult(_0x2604f4,null))[_0xe0f2('0x3f')](handleError(_0x2604f4,null));};exports['destroy']=function(_0x30e770,_0x58f4b1){return db[_0xe0f2('0x2a')][_0xe0f2('0x45')]({'where':{'id':_0x30e770['params']['id']}})[_0xe0f2('0x24')](handleEntityNotFound(_0x58f4b1,null))[_0xe0f2('0x24')](removeEntity(_0x58f4b1,null))['catch'](handleError(_0x58f4b1,null));};exports[_0xe0f2('0x46')]=function(_0x4869d3,_0x5858c1){return db[_0xe0f2('0x2a')][_0xe0f2('0x46')]()['then'](respondWithResult(_0x5858c1,null))[_0xe0f2('0x3f')](handleError(_0x5858c1,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 953d1d3..a68759c 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 _0x1a6b=['exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a6b,0x94));var _0xb1a6=function(_0x63ccf1,_0x2d252f){_0x63ccf1=_0x63ccf1-0x0;var _0x4c7f0f=_0x1a6b[_0x63ccf1];return _0x4c7f0f;};'use strict';var _=require(_0xb1a6('0x0'));var util=require(_0xb1a6('0x1'));var logger=require(_0xb1a6('0x2'))('api');var moment=require(_0xb1a6('0x3'));var BPromise=require(_0xb1a6('0x4'));var rp=require(_0xb1a6('0x5'));var fs=require('fs');var path=require(_0xb1a6('0x6'));var rimraf=require('rimraf');var config=require(_0xb1a6('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0xb1a6('0x8')]=function(_0x23feb8,_0x4d0ca1){return _0x23feb8[_0xb1a6('0x9')]('MailTransferReport',attributes,{'tableName':_0xb1a6('0xa'),'paranoid':![],'indexes':[{'name':_0xb1a6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x70d8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer'];(function(_0x4ad867,_0xb1f4ad){var _0x1f5cb6=function(_0x32d4ce){while(--_0x32d4ce){_0x4ad867['push'](_0x4ad867['shift']());}};_0x1f5cb6(++_0xb1f4ad);}(_0x70d8,0xa9));var _0x870d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x70d8[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x870d('0x0'));var util=require(_0x870d('0x1'));var logger=require(_0x870d('0x2'))(_0x870d('0x3'));var moment=require(_0x870d('0x4'));var BPromise=require(_0x870d('0x5'));var rp=require(_0x870d('0x6'));var fs=require('fs');var path=require(_0x870d('0x7'));var rimraf=require(_0x870d('0x8'));var config=require('../../config/environment');var attributes=require(_0x870d('0x9'));module['exports']=function(_0x5b131d,_0x161ad6){return _0x5b131d[_0x870d('0xa')](_0x870d('0xb'),attributes,{'tableName':_0x870d('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7506443..5b5c487 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 _0x41a5=['code','MailTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x425e86,_0x2b06f7){var _0x25799d=function(_0x27f2b2){while(--_0x27f2b2){_0x425e86['push'](_0x425e86['shift']());}};_0x25799d(++_0x2b06f7);}(_0x41a5,0x146));var _0x541a=function(_0x1d6946,_0x1bf6f3){_0x1d6946=_0x1d6946-0x0;var _0x10c3a6=_0x41a5[_0x1d6946];return _0x10c3a6;};'use strict';var _=require('lodash');var util=require(_0x541a('0x0'));var moment=require(_0x541a('0x1'));var BPromise=require(_0x541a('0x2'));var rs=require(_0x541a('0x3'));var fs=require('fs');var Redis=require(_0x541a('0x4'));var db=require(_0x541a('0x5'))['db'];var utils=require(_0x541a('0x6'));var logger=require(_0x541a('0x7'))(_0x541a('0x8'));var config=require('../../config/environment');var jayson=require(_0x541a('0x9'));var client=jayson[_0x541a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1af9fd,_0x4ba24f,_0x1141a3){return new BPromise(function(_0x41a3a1,_0x412be6){return client[_0x541a('0xb')](_0x1af9fd,_0x1141a3)[_0x541a('0xc')](function(_0x51274d){logger[_0x541a('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x4ba24f,_0x541a('0xe'));logger[_0x541a('0xf')](_0x541a('0x10'),_0x4ba24f,_0x541a('0xe'),JSON[_0x541a('0x11')](_0x51274d));if(_0x51274d[_0x541a('0x12')]){if(_0x51274d['error'][_0x541a('0x13')]===0x1f4){logger[_0x541a('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x4ba24f,_0x51274d[_0x541a('0x12')]['message']);return _0x412be6(_0x51274d[_0x541a('0x12')]['message']);}logger['error'](_0x541a('0x14'),_0x4ba24f,_0x51274d['error'][_0x541a('0x15')]);return _0x41a3a1(_0x51274d[_0x541a('0x12')][_0x541a('0x15')]);}else{logger[_0x541a('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x4ba24f,_0x541a('0xe'));_0x41a3a1(_0x51274d['result'][_0x541a('0x15')]);}})[_0x541a('0x16')](function(_0x37d070){logger['error'](_0x541a('0x14'),_0x4ba24f,_0x37d070);_0x412be6(_0x37d070);});});} \ No newline at end of file +var _0x733d=['then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x2a690a,_0x4afc04){var _0x8ba65a=function(_0x84d6ce){while(--_0x84d6ce){_0x2a690a['push'](_0x2a690a['shift']());}};_0x8ba65a(++_0x4afc04);}(_0x733d,0x186));var _0xd733=function(_0x285ba,_0x1f8fe8){_0x285ba=_0x285ba-0x0;var _0x279a75=_0x733d[_0x285ba];return _0x279a75;};'use strict';var _=require('lodash');var util=require(_0xd733('0x0'));var moment=require(_0xd733('0x1'));var BPromise=require(_0xd733('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd733('0x3'));var db=require(_0xd733('0x4'))['db'];var utils=require(_0xd733('0x5'));var logger=require(_0xd733('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd733('0x7'));var client=jayson[_0xd733('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d9090,_0x217820,_0x2d6ac5){return new BPromise(function(_0x12f1f6,_0x2d66a3){return client['request'](_0x2d9090,_0x2d6ac5)[_0xd733('0x9')](function(_0x3c40b1){logger['info'](_0xd733('0xa'),_0x217820,'request\x20sent');logger[_0xd733('0xb')](_0xd733('0xc'),_0x217820,_0xd733('0xd'),JSON[_0xd733('0xe')](_0x3c40b1));if(_0x3c40b1[_0xd733('0xf')]){if(_0x3c40b1[_0xd733('0xf')][_0xd733('0x10')]===0x1f4){logger[_0xd733('0xf')](_0xd733('0xa'),_0x217820,_0x3c40b1['error'][_0xd733('0x11')]);return _0x2d66a3(_0x3c40b1[_0xd733('0xf')]['message']);}logger['error'](_0xd733('0xa'),_0x217820,_0x3c40b1['error'][_0xd733('0x11')]);return _0x12f1f6(_0x3c40b1[_0xd733('0xf')][_0xd733('0x11')]);}else{logger[_0xd733('0x12')](_0xd733('0xa'),_0x217820,_0xd733('0xd'));_0x12f1f6(_0x3c40b1[_0xd733('0x13')][_0xd733('0x11')]);}})[_0xd733('0x14')](function(_0x32c7a0){logger[_0xd733('0xf')](_0xd733('0xa'),_0x217820,_0x32c7a0);_0x2d66a3(_0x32c7a0);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f38977c..6d5a5af 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 _0x7d7d=['post','create','put','delete','destroy','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show'];(function(_0x10c68b,_0x4780bc){var _0x364f05=function(_0x2041dc){while(--_0x2041dc){_0x10c68b['push'](_0x10c68b['shift']());}};_0x364f05(++_0x4780bc);}(_0x7d7d,0x76));var _0xd7d7=function(_0x58001f,_0x3d9c4c){_0x58001f=_0x58001f-0x0;var _0x935187=_0x7d7d[_0x58001f];return _0x935187;};'use strict';var multer=require('multer');var util=require(_0xd7d7('0x0'));var path=require('path');var timeout=require(_0xd7d7('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd7d7('0x2'));var config=require(_0xd7d7('0x3'));var controller=require('./memberReport.controller');router[_0xd7d7('0x4')]('/',auth[_0xd7d7('0x5')](),controller[_0xd7d7('0x6')]);router[_0xd7d7('0x4')]('/describe',auth[_0xd7d7('0x5')](),controller[_0xd7d7('0x7')]);router[_0xd7d7('0x4')](_0xd7d7('0x8'),auth[_0xd7d7('0x5')](),controller[_0xd7d7('0x9')]);router[_0xd7d7('0xa')]('/',auth[_0xd7d7('0x5')](),controller[_0xd7d7('0xb')]);router[_0xd7d7('0xc')](_0xd7d7('0x8'),auth[_0xd7d7('0x5')](),controller['update']);router[_0xd7d7('0xd')](_0xd7d7('0x8'),auth['isAuthenticated'](),controller[_0xd7d7('0xe')]);module[_0xd7d7('0xf')]=router; \ No newline at end of file +var _0x0902=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0x0902,0x1a3));var _0x2090=function(_0x2c3201,_0x1f76ff){_0x2c3201=_0x2c3201-0x0;var _0x564fc4=_0x0902[_0x2c3201];return _0x564fc4;};'use strict';var multer=require(_0x2090('0x0'));var util=require('util');var path=require(_0x2090('0x1'));var timeout=require(_0x2090('0x2'));var express=require(_0x2090('0x3'));var router=express[_0x2090('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2090('0x5'));var interaction=require(_0x2090('0x6'));var config=require(_0x2090('0x7'));var controller=require(_0x2090('0x8'));router[_0x2090('0x9')]('/',auth[_0x2090('0xa')](),controller[_0x2090('0xb')]);router[_0x2090('0x9')](_0x2090('0xc'),auth['isAuthenticated'](),controller[_0x2090('0xd')]);router[_0x2090('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2090('0xe')]);router['post']('/',auth[_0x2090('0xa')](),controller[_0x2090('0xf')]);router[_0x2090('0x10')](_0x2090('0x11'),auth[_0x2090('0xa')](),controller[_0x2090('0x12')]);router[_0x2090('0x13')](_0x2090('0x11'),auth[_0x2090('0xa')](),controller[_0x2090('0x14')]);module[_0x2090('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ff2d849..306e1f2 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 _0xa965=['exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment'];(function(_0x268cb2,_0x887ba6){var _0x24c29e=function(_0x5af7d8){while(--_0x5af7d8){_0x268cb2['push'](_0x268cb2['shift']());}};_0x24c29e(++_0x887ba6);}(_0xa965,0x97));var _0x5a96=function(_0x14ed4e,_0x3dcf54){_0x14ed4e=_0x14ed4e-0x0;var _0x5c3d8a=_0xa965[_0x14ed4e];return _0x5c3d8a;};'use strict';var Sequelize=require(_0x5a96('0x0'));var moment=require(_0x5a96('0x1'));module[_0x5a96('0x2')]={'channel':{'type':Sequelize[_0x5a96('0x3')]},'membername':{'type':Sequelize[_0x5a96('0x3')]},'interface':{'type':Sequelize[_0x5a96('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x5a96('0x4')},'duration':{'type':Sequelize[_0x5a96('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5a96('0x6')],'set':function(_0x2eba8a){var _0x5ca902=moment(_0x2eba8a);var _0x14d9f0=moment(this[_0x5a96('0x7')](_0x5a96('0x8')));var _0x2341d0=_0x5ca902[_0x5a96('0x9')](_0x14d9f0,'seconds');this[_0x5a96('0xa')](_0x5a96('0xb'),_0x2eba8a);this['setDataValue'](_0x5a96('0xc'),_0x2341d0>=0x0?_0x2341d0:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x5a96('0xd')},'data2':{'type':Sequelize[_0x5a96('0x3')],'comment':_0x5a96('0xe')},'data3':{'type':Sequelize[_0x5a96('0x3')],'comment':_0x5a96('0xf')},'data4':{'type':Sequelize[_0x5a96('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x5a96('0x3')],'comment':_0x5a96('0x10')},'role':{'type':Sequelize[_0x5a96('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x5a96('0x3')]}}; \ No newline at end of file +var _0x5011=['sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x385cda,_0x2e32d1){var _0x5488b7=function(_0x1e8bfc){while(--_0x1e8bfc){_0x385cda['push'](_0x385cda['shift']());}};_0x5488b7(++_0x2e32d1);}(_0x5011,0x10e));var _0x1501=function(_0x2b35ca,_0x4943ce){_0x2b35ca=_0x2b35ca-0x0;var _0x68389e=_0x5011[_0x2b35ca];return _0x68389e;};'use strict';var Sequelize=require(_0x1501('0x0'));var moment=require(_0x1501('0x1'));module[_0x1501('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1501('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1501('0x3')],'defaultValue':_0x1501('0x4'),'comment':_0x1501('0x5')},'duration':{'type':Sequelize[_0x1501('0x6')]},'enterAt':{'type':Sequelize[_0x1501('0x7')]},'exitAt':{'type':Sequelize[_0x1501('0x7')],'set':function(_0x51b890){var _0x136a2a=moment(_0x51b890);var _0x51b982=moment(this[_0x1501('0x8')]('enterAt'));var _0x317452=_0x136a2a[_0x1501('0x9')](_0x51b982,_0x1501('0xa'));this[_0x1501('0xb')]('exitAt',_0x51b890);this[_0x1501('0xb')]('duration',_0x317452>=0x0?_0x317452:null);}},'data1':{'type':Sequelize[_0x1501('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x1501('0x3')],'comment':_0x1501('0xc')},'data3':{'type':Sequelize[_0x1501('0x3')],'comment':_0x1501('0xd')},'data4':{'type':Sequelize[_0x1501('0x3')],'comment':_0x1501('0xe')},'data5':{'type':Sequelize[_0x1501('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 42827bc..f13ab96 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 _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x1621c4,_0x5cb08b){var _0x52e148=function(_0x472abe){while(--_0x472abe){_0x1621c4['push'](_0x1621c4['shift']());}};_0x52e148(++_0x5cb08b);}(_0x3e74,0x175));var _0x43e7=function(_0x14330d,_0x130dc2){_0x14330d=_0x14330d-0x0;var _0x1b47e6=_0x3e74[_0x14330d];return _0x1b47e6;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,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(_0x2ae86e,_0x110e55){var _0x3f425c=function(_0x4a2135){while(--_0x4a2135){_0x2ae86e['push'](_0x2ae86e['shift']());}};_0x3f425c(++_0x110e55);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 b2f2e1b..456597e 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 _0x39bd=['bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x39bd,0x7c));var _0xd39b=function(_0x59d575,_0xd8214){_0x59d575=_0x59d575-0x0;var _0x45b735=_0x39bd[_0x59d575];return _0x45b735;};'use strict';var _=require(_0xd39b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd39b('0x1'));var moment=require('moment');var BPromise=require(_0xd39b('0x2'));var rp=require(_0xd39b('0x3'));var fs=require('fs');var path=require(_0xd39b('0x4'));var rimraf=require(_0xd39b('0x5'));var config=require(_0xd39b('0x6'));var attributes=require(_0xd39b('0x7'));module['exports']=function(_0x59c87e,_0x4746e8){return _0x59c87e[_0xd39b('0x8')](_0xd39b('0x9'),attributes,{'tableName':_0xd39b('0xa'),'paranoid':![],'indexes':[{'name':_0xd39b('0xb'),'fields':[_0xd39b('0xc'),_0xd39b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1315=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface'];(function(_0x1f9451,_0x2133d4){var _0x5ba640=function(_0x605adc){while(--_0x605adc){_0x1f9451['push'](_0x1f9451['shift']());}};_0x5ba640(++_0x2133d4);}(_0x1315,0xdd));var _0x5131=function(_0x1aab5d,_0x288dad){_0x1aab5d=_0x1aab5d-0x0;var _0x56b096=_0x1315[_0x1aab5d];return _0x56b096;};'use strict';var _=require(_0x5131('0x0'));var util=require(_0x5131('0x1'));var logger=require(_0x5131('0x2'))(_0x5131('0x3'));var moment=require(_0x5131('0x4'));var BPromise=require(_0x5131('0x5'));var rp=require(_0x5131('0x6'));var fs=require('fs');var path=require(_0x5131('0x7'));var rimraf=require(_0x5131('0x8'));var config=require('../../config/environment');var attributes=require(_0x5131('0x9'));module[_0x5131('0xa')]=function(_0x539190,_0x1762f7){return _0x539190[_0x5131('0xb')](_0x5131('0xc'),attributes,{'tableName':_0x5131('0xd'),'paranoid':![],'indexes':[{'name':_0x5131('0xe'),'fields':[_0x5131('0xf'),_0x5131('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b6ad8cc..c15d983 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 _0xad68=['update','body','where','UpdateMemberReport','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','MemberReport','findAll','options','raw','attributes','limit','include','map','model','then','GetMemberReport','CreateMemberReport'];(function(_0x2a9548,_0x2742f6){var _0xf55c55=function(_0x2862d8){while(--_0x2862d8){_0x2a9548['push'](_0x2a9548['shift']());}};_0xf55c55(++_0x2742f6);}(_0xad68,0x100));var _0x8ad6=function(_0x481366,_0x41e46b){_0x481366=_0x481366-0x0;var _0x229649=_0xad68[_0x481366];return _0x229649;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8ad6('0x0'));var BPromise=require(_0x8ad6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ad6('0x2'))['db'];var utils=require(_0x8ad6('0x3'));var logger=require(_0x8ad6('0x4'))(_0x8ad6('0x5'));var config=require(_0x8ad6('0x6'));var jayson=require(_0x8ad6('0x7'));var client=jayson[_0x8ad6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144a85,_0x1ca47f,_0x3e009f){return new BPromise(function(_0x46ba71,_0x2680e5){return client['request'](_0x144a85,_0x3e009f)['then'](function(_0xe8b4bd){logger[_0x8ad6('0x9')]('MemberReport,\x20%s,\x20%s',_0x1ca47f,'request\x20sent');logger[_0x8ad6('0xa')](_0x8ad6('0xb'),_0x1ca47f,_0x8ad6('0xc'),JSON[_0x8ad6('0xd')](_0xe8b4bd));if(_0xe8b4bd[_0x8ad6('0xe')]){if(_0xe8b4bd[_0x8ad6('0xe')][_0x8ad6('0xf')]===0x1f4){logger[_0x8ad6('0xe')]('MemberReport,\x20%s,\x20%s',_0x1ca47f,_0xe8b4bd[_0x8ad6('0xe')]['message']);return _0x2680e5(_0xe8b4bd['error'][_0x8ad6('0x10')]);}logger['error'](_0x8ad6('0x11'),_0x1ca47f,_0xe8b4bd['error'][_0x8ad6('0x10')]);return _0x46ba71(_0xe8b4bd[_0x8ad6('0xe')][_0x8ad6('0x10')]);}else{logger['info'](_0x8ad6('0x11'),_0x1ca47f,_0x8ad6('0xc'));_0x46ba71(_0xe8b4bd[_0x8ad6('0x12')][_0x8ad6('0x10')]);}})[_0x8ad6('0x13')](function(_0xb7e3e2){logger[_0x8ad6('0xe')](_0x8ad6('0x11'),_0x1ca47f,_0xb7e3e2);_0x2680e5(_0xb7e3e2);});});}exports['GetMemberReport']=function(_0x8ca3e3){var _0x3e5f02=this;return new Promise(function(_0x29e6a6,_0x28a9b8){return db[_0x8ad6('0x14')][_0x8ad6('0x15')]({'raw':_0x8ca3e3[_0x8ad6('0x16')]?_0x8ca3e3['options'][_0x8ad6('0x17')]===undefined?!![]:![]:!![],'where':_0x8ca3e3[_0x8ad6('0x16')]?_0x8ca3e3[_0x8ad6('0x16')]['where']||null:null,'attributes':_0x8ca3e3[_0x8ad6('0x16')]?_0x8ca3e3[_0x8ad6('0x16')][_0x8ad6('0x18')]||null:null,'limit':_0x8ca3e3[_0x8ad6('0x16')]?_0x8ca3e3[_0x8ad6('0x16')][_0x8ad6('0x19')]||null:null,'include':_0x8ca3e3[_0x8ad6('0x16')]?_0x8ca3e3[_0x8ad6('0x16')][_0x8ad6('0x1a')]?_['map'](_0x8ca3e3['options'][_0x8ad6('0x1a')],function(_0x351267){return{'model':db[_0x351267['model']],'as':_0x351267['as'],'attributes':_0x351267[_0x8ad6('0x18')],'include':_0x351267[_0x8ad6('0x1a')]?_[_0x8ad6('0x1b')](_0x351267['include'],function(_0x54adf7){return{'model':db[_0x54adf7['model']],'as':_0x54adf7['as'],'attributes':_0x54adf7[_0x8ad6('0x18')],'include':_0x54adf7[_0x8ad6('0x1a')]?_[_0x8ad6('0x1b')](_0x54adf7[_0x8ad6('0x1a')],function(_0x1c79c9){return{'model':db[_0x1c79c9[_0x8ad6('0x1c')]],'as':_0x1c79c9['as'],'attributes':_0x1c79c9[_0x8ad6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8ad6('0x1d')](function(_0x44586f){logger[_0x8ad6('0x9')](_0x8ad6('0x1e'),_0x8ca3e3);logger[_0x8ad6('0xa')](_0x8ad6('0x1e'),_0x8ca3e3,JSON[_0x8ad6('0xd')](_0x44586f));_0x29e6a6(_0x44586f);})[_0x8ad6('0x13')](function(_0x24a2fa){logger[_0x8ad6('0xe')](_0x8ad6('0x1e'),_0x24a2fa[_0x8ad6('0x10')],_0x8ca3e3);_0x28a9b8(_0x3e5f02[_0x8ad6('0xe')](0x1f4,_0x24a2fa['message']));});});};exports[_0x8ad6('0x1f')]=function(_0x3e261c){var _0x105d07=this;return new Promise(function(_0x514443,_0x18bf7b){return db['MemberReport']['create'](_0x3e261c['body'],{'raw':_0x3e261c[_0x8ad6('0x16')]?_0x3e261c[_0x8ad6('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x8ad6('0x1d')](function(_0x3eda44){logger[_0x8ad6('0x9')](_0x8ad6('0x1f'),_0x3e261c);logger[_0x8ad6('0xa')]('CreateMemberReport',_0x3e261c,JSON[_0x8ad6('0xd')](_0x3eda44));_0x514443(_0x3eda44);})[_0x8ad6('0x13')](function(_0x4f61b6){logger[_0x8ad6('0xe')]('CreateMemberReport',_0x4f61b6['message'],_0x3e261c);_0x18bf7b(_0x105d07[_0x8ad6('0xe')](0x1f4,_0x4f61b6[_0x8ad6('0x10')]));});});};exports['UpdateMemberReport']=function(_0x325f23){var _0x272f41=this;return new Promise(function(_0x370a78,_0x664d41){return db['MemberReport'][_0x8ad6('0x20')](_0x325f23[_0x8ad6('0x21')],{'raw':_0x325f23[_0x8ad6('0x16')]?_0x325f23[_0x8ad6('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x325f23['options']?_0x325f23[_0x8ad6('0x16')][_0x8ad6('0x22')]||null:null,'attributes':_0x325f23[_0x8ad6('0x16')]?_0x325f23['options']['attributes']||null:null,'limit':_0x325f23[_0x8ad6('0x16')]?_0x325f23[_0x8ad6('0x16')]['limit']||null:null})[_0x8ad6('0x1d')](function(_0x178652){logger['info'](_0x8ad6('0x23'),_0x325f23);logger['debug'](_0x8ad6('0x23'),_0x325f23,JSON['stringify'](_0x178652));_0x370a78(_0x178652);})[_0x8ad6('0x13')](function(_0x452e0f){logger['error'](_0x8ad6('0x23'),_0x452e0f['message'],_0x325f23);_0x664d41(_0x272f41['error'](0x1f4,_0x452e0f[_0x8ad6('0x10')]));});});}; \ No newline at end of file +var _0x9ca0=['MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','create','body','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','then'];(function(_0x14e206,_0x50b956){var _0x33afc4=function(_0x1a2cd5){while(--_0x1a2cd5){_0x14e206['push'](_0x14e206['shift']());}};_0x33afc4(++_0x50b956);}(_0x9ca0,0x65));var _0x09ca=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x9ca0[_0x39772f];return _0xc9edbf;};'use strict';var _=require(_0x09ca('0x0'));var util=require(_0x09ca('0x1'));var moment=require(_0x09ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x09ca('0x3'));var fs=require('fs');var Redis=require(_0x09ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x09ca('0x5'));var logger=require(_0x09ca('0x6'))('rpc');var config=require(_0x09ca('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x09ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f8649,_0x3bf4d9,_0x224661){return new BPromise(function(_0x35e94d,_0x498d91){return client['request'](_0x1f8649,_0x224661)[_0x09ca('0x9')](function(_0x44b875){logger['info'](_0x09ca('0xa'),_0x3bf4d9,_0x09ca('0xb'));logger[_0x09ca('0xc')](_0x09ca('0xd'),_0x3bf4d9,_0x09ca('0xb'),JSON[_0x09ca('0xe')](_0x44b875));if(_0x44b875['error']){if(_0x44b875[_0x09ca('0xf')][_0x09ca('0x10')]===0x1f4){logger['error'](_0x09ca('0xa'),_0x3bf4d9,_0x44b875['error'][_0x09ca('0x11')]);return _0x498d91(_0x44b875[_0x09ca('0xf')][_0x09ca('0x11')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x3bf4d9,_0x44b875[_0x09ca('0xf')][_0x09ca('0x11')]);return _0x35e94d(_0x44b875['error'][_0x09ca('0x11')]);}else{logger[_0x09ca('0x12')](_0x09ca('0xa'),_0x3bf4d9,_0x09ca('0xb'));_0x35e94d(_0x44b875[_0x09ca('0x13')][_0x09ca('0x11')]);}})[_0x09ca('0x14')](function(_0x118c6c){logger[_0x09ca('0xf')](_0x09ca('0xa'),_0x3bf4d9,_0x118c6c);_0x498d91(_0x118c6c);});});}exports[_0x09ca('0x15')]=function(_0x3d8f28){var _0x53ecd4=this;return new Promise(function(_0x62be0c,_0x23c9ea){return db[_0x09ca('0x16')][_0x09ca('0x17')]({'raw':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28[_0x09ca('0x18')][_0x09ca('0x19')]===undefined?!![]:![]:!![],'where':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28['options'][_0x09ca('0x1a')]||null:null,'attributes':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28[_0x09ca('0x18')]['attributes']||null:null,'limit':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28[_0x09ca('0x18')][_0x09ca('0x1b')]||null:null,'include':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28['options'][_0x09ca('0x1c')]?_[_0x09ca('0x1d')](_0x3d8f28[_0x09ca('0x18')][_0x09ca('0x1c')],function(_0x44f036){return{'model':db[_0x44f036[_0x09ca('0x1e')]],'as':_0x44f036['as'],'attributes':_0x44f036[_0x09ca('0x1f')],'include':_0x44f036['include']?_[_0x09ca('0x1d')](_0x44f036[_0x09ca('0x1c')],function(_0x459822){return{'model':db[_0x459822[_0x09ca('0x1e')]],'as':_0x459822['as'],'attributes':_0x459822[_0x09ca('0x1f')],'include':_0x459822[_0x09ca('0x1c')]?_[_0x09ca('0x1d')](_0x459822[_0x09ca('0x1c')],function(_0x576466){return{'model':db[_0x576466[_0x09ca('0x1e')]],'as':_0x576466['as'],'attributes':_0x576466[_0x09ca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x09ca('0x9')](function(_0x4b3da5){logger['info'](_0x09ca('0x15'),_0x3d8f28);logger[_0x09ca('0xc')](_0x09ca('0x15'),_0x3d8f28,JSON[_0x09ca('0xe')](_0x4b3da5));_0x62be0c(_0x4b3da5);})['catch'](function(_0x2d2f54){logger['error'](_0x09ca('0x15'),_0x2d2f54[_0x09ca('0x11')],_0x3d8f28);_0x23c9ea(_0x53ecd4[_0x09ca('0xf')](0x1f4,_0x2d2f54['message']));});});};exports['CreateMemberReport']=function(_0x2d6280){var _0x476134=this;return new Promise(function(_0x4b5f00,_0x490dc4){return db[_0x09ca('0x16')][_0x09ca('0x20')](_0x2d6280[_0x09ca('0x21')],{'raw':_0x2d6280[_0x09ca('0x18')]?_0x2d6280[_0x09ca('0x18')][_0x09ca('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xbeec46){logger['info'](_0x09ca('0x22'),_0x2d6280);logger[_0x09ca('0xc')](_0x09ca('0x22'),_0x2d6280,JSON['stringify'](_0xbeec46));_0x4b5f00(_0xbeec46);})[_0x09ca('0x14')](function(_0x53f472){logger[_0x09ca('0xf')]('CreateMemberReport',_0x53f472[_0x09ca('0x11')],_0x2d6280);_0x490dc4(_0x476134[_0x09ca('0xf')](0x1f4,_0x53f472['message']));});});};exports[_0x09ca('0x23')]=function(_0x11cb3b){var _0x46f089=this;return new Promise(function(_0x4e1dd9,_0x3ae5de){return db[_0x09ca('0x16')][_0x09ca('0x24')](_0x11cb3b[_0x09ca('0x21')],{'raw':_0x11cb3b['options']?_0x11cb3b[_0x09ca('0x18')][_0x09ca('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11cb3b[_0x09ca('0x18')]?_0x11cb3b[_0x09ca('0x18')]['where']||null:null,'attributes':_0x11cb3b[_0x09ca('0x18')]?_0x11cb3b['options']['attributes']||null:null,'limit':_0x11cb3b[_0x09ca('0x18')]?_0x11cb3b['options'][_0x09ca('0x1b')]||null:null})[_0x09ca('0x9')](function(_0x10fcb7){logger[_0x09ca('0x12')]('UpdateMemberReport',_0x11cb3b);logger[_0x09ca('0xc')]('UpdateMemberReport',_0x11cb3b,JSON['stringify'](_0x10fcb7));_0x4e1dd9(_0x10fcb7);})[_0x09ca('0x14')](function(_0x140f70){logger['error'](_0x09ca('0x23'),_0x140f70[_0x09ca('0x11')],_0x11cb3b);_0x3ae5de(_0x46f089['error'](0x1f4,_0x140f70[_0x09ca('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index a71c355..84ba6b4 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 _0x705a=['util','express','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer'];(function(_0x13514b,_0x1aeaeb){var _0x25a813=function(_0x4ac6e4){while(--_0x4ac6e4){_0x13514b['push'](_0x13514b['shift']());}};_0x25a813(++_0x1aeaeb);}(_0x705a,0x7d));var _0xa705=function(_0x34b3ba,_0x19e7f5){_0x34b3ba=_0x34b3ba-0x0;var _0x31862a=_0x705a[_0x34b3ba];return _0x31862a;};'use strict';var multer=require(_0xa705('0x0'));var util=require(_0xa705('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa705('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa705('0x3'));var interaction=require(_0xa705('0x4'));var config=require('../../config/environment');var controller=require(_0xa705('0x5'));router[_0xa705('0x6')]('/',controller[_0xa705('0x7')]);module[_0xa705('0x8')]=router; \ No newline at end of file +var _0x9d3e=['get','index','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x9d3e,0x1c3));var _0xe9d3=function(_0x2f5c30,_0x4b8aa0){_0x2f5c30=_0x2f5c30-0x0;var _0x9f5f99=_0x9d3e[_0x2f5c30];return _0x9f5f99;};'use strict';var multer=require(_0xe9d3('0x0'));var util=require(_0xe9d3('0x1'));var path=require(_0xe9d3('0x2'));var timeout=require(_0xe9d3('0x3'));var express=require(_0xe9d3('0x4'));var router=express[_0xe9d3('0x5')]();var fs_extra=require(_0xe9d3('0x6'));var auth=require(_0xe9d3('0x7'));var interaction=require(_0xe9d3('0x8'));var config=require(_0xe9d3('0x9'));var controller=require(_0xe9d3('0xa'));router[_0xe9d3('0xb')]('/',controller[_0xe9d3('0xc')]);module[_0xe9d3('0xd')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index fec9127..438b064 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 _0x6fd9=['exports','sequelize'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6fd9,0xeb));var _0x96fd=function(_0x458a83,_0x42f38f){_0x458a83=_0x458a83-0x0;var _0x5d35fb=_0x6fd9[_0x458a83];return _0x5d35fb;};'use strict';var Sequelize=require(_0x96fd('0x0'));module[_0x96fd('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x4477=['STRING','exports'];(function(_0x2a1267,_0x55b7ef){var _0x384d41=function(_0x41c255){while(--_0x41c255){_0x2a1267['push'](_0x2a1267['shift']());}};_0x384d41(++_0x55b7ef);}(_0x4477,0x181));var _0x7447=function(_0xf6cfc3,_0x480008){_0xf6cfc3=_0xf6cfc3-0x0;var _0x1fddc8=_0x4477[_0xf6cfc3];return _0x1fddc8;};'use strict';var Sequelize=require('sequelize');module[_0x7447('0x0')]={'version':{'type':Sequelize[_0x7447('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 7f3de88..ebf4289 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 _0x1414=['status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','end','sendStatus','error','stack','name','send','index','Migration','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','then','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x1414,0xf4));var _0x4141=function(_0x2c82ea,_0x5a7756){_0x2c82ea=_0x2c82ea-0x0;var _0x33acf4=_0x1414[_0x2c82ea];return _0x33acf4;};'use strict';var emlformat=require(_0x4141('0x0'));var rimraf=require(_0x4141('0x1'));var zipdir=require(_0x4141('0x2'));var jsonpatch=require(_0x4141('0x3'));var rp=require('request-promise');var moment=require(_0x4141('0x4'));var BPromise=require(_0x4141('0x5'));var Mustache=require('mustache');var util=require(_0x4141('0x6'));var path=require(_0x4141('0x7'));var sox=require('sox');var csv=require(_0x4141('0x8'));var ejs=require(_0x4141('0x9'));var fs=require('fs');var fs_extra=require(_0x4141('0xa'));var _=require(_0x4141('0xb'));var squel=require(_0x4141('0xc'));var crypto=require(_0x4141('0xd'));var jsforce=require(_0x4141('0xe'));var deskjs=require(_0x4141('0xf'));var toCsv=require(_0x4141('0x8'));var querystring=require('querystring');var Papa=require(_0x4141('0x10'));var Redis=require(_0x4141('0x11'));var authService=require(_0x4141('0x12'));var qs=require(_0x4141('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4141('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4141('0x15'));var licenseUtil=require(_0x4141('0x16'));var db=require(_0x4141('0x17'))['db'];function respondWithStatusCode(_0x5a3c7b,_0xc9c1b4){_0xc9c1b4=_0xc9c1b4||0xcc;return function(_0x2c66d6){if(_0x2c66d6){return _0x5a3c7b['sendStatus'](_0xc9c1b4);}return _0x5a3c7b['status'](_0xc9c1b4)['end']();};}function respondWithResult(_0x48096c,_0x592aa8){_0x592aa8=_0x592aa8||0xc8;return function(_0x224ce2){if(_0x224ce2){return _0x48096c[_0x4141('0x18')](_0x592aa8)[_0x4141('0x19')](_0x224ce2);}};}function respondWithFilteredResult(_0x4fdb72,_0x45aa25){return function(_0x22ee46){if(_0x22ee46){var _0x3e2a69=typeof _0x45aa25[_0x4141('0x1a')]===_0x4141('0x1b')&&typeof _0x45aa25['limit']===_0x4141('0x1b');var _0x2a52bd=_0x22ee46[_0x4141('0x1c')];var _0x242eb3=_0x3e2a69?0x0:_0x45aa25[_0x4141('0x1a')];var _0x42ff32=_0x3e2a69?_0x22ee46[_0x4141('0x1c')]:_0x45aa25[_0x4141('0x1a')]+_0x45aa25[_0x4141('0x1d')];var _0x2104d1;if(_0x42ff32>=_0x2a52bd){_0x42ff32=_0x2a52bd;_0x2104d1=0xc8;}else{_0x2104d1=0xce;}_0x4fdb72[_0x4141('0x18')](_0x2104d1);return _0x4fdb72[_0x4141('0x1e')](_0x4141('0x1f'),_0x242eb3+'-'+_0x42ff32+'/'+_0x2a52bd)[_0x4141('0x19')](_0x22ee46);}return null;};}function patchUpdates(_0xc14556){return function(_0x1a9c65){try{jsonpatch[_0x4141('0x20')](_0x1a9c65,_0xc14556,!![]);}catch(_0x4dec63){return BPromise['reject'](_0x4dec63);}return _0x1a9c65[_0x4141('0x21')]();};}function saveUpdates(_0xdc2d82,_0x4c741b){return function(_0xe7ac52){if(_0xe7ac52){return _0xe7ac52[_0x4141('0x22')](_0xdc2d82)['then'](function(_0x26ad89){return _0x26ad89;});}return null;};}function removeEntity(_0xb6842d,_0x1b8a21){return function(_0x4865d0){if(_0x4865d0){return _0x4865d0['destroy']()['then'](function(){_0xb6842d[_0x4141('0x18')](0xcc)[_0x4141('0x23')]();});}};}function handleEntityNotFound(_0x46627b,_0x289d91){return function(_0xd650d6){if(!_0xd650d6){_0x46627b[_0x4141('0x24')](0x194);}return _0xd650d6;};}function handleError(_0x53023f,_0x121612){_0x121612=_0x121612||0x1f4;return function(_0x47cd23){logger[_0x4141('0x25')](_0x47cd23[_0x4141('0x26')]);if(_0x47cd23[_0x4141('0x27')]){delete _0x47cd23[_0x4141('0x27')];}_0x53023f['status'](_0x121612)[_0x4141('0x28')](_0x47cd23);};}exports[_0x4141('0x29')]=function(_0xe3ce35,_0x1925cc){var _0x5a00fb={},_0x5a0f52={},_0x19b4b5={'count':0x0,'rows':[]};var _0x2751b4=_['map'](db[_0x4141('0x2a')][_0x4141('0x2b')],function(_0x4b798d){return{'name':_0x4b798d[_0x4141('0x2c')],'type':_0x4b798d[_0x4141('0x2d')][_0x4141('0x2e')]};});_0x5a0f52[_0x4141('0x2f')]=_[_0x4141('0x30')](_0x2751b4,'name');_0x5a0f52[_0x4141('0x31')]=_['keys'](_0xe3ce35[_0x4141('0x31')]);_0x5a0f52[_0x4141('0x32')]=_['intersection'](_0x5a0f52[_0x4141('0x2f')],_0x5a0f52[_0x4141('0x31')]);_0x5a00fb[_0x4141('0x33')]=_['intersection'](_0x5a0f52[_0x4141('0x2f')],qs[_0x4141('0x34')](_0xe3ce35['query'][_0x4141('0x34')]));_0x5a00fb['attributes']=_0x5a00fb[_0x4141('0x33')]['length']?_0x5a00fb['attributes']:_0x5a0f52[_0x4141('0x2f')];if(!_0xe3ce35[_0x4141('0x31')][_0x4141('0x35')](_0x4141('0x36'))){_0x5a00fb[_0x4141('0x1d')]=qs['limit'](_0xe3ce35['query'][_0x4141('0x1d')]);_0x5a00fb[_0x4141('0x1a')]=qs[_0x4141('0x1a')](_0xe3ce35[_0x4141('0x31')][_0x4141('0x1a')]);}_0x5a00fb[_0x4141('0x37')]=qs['sort'](_0xe3ce35[_0x4141('0x31')][_0x4141('0x38')]);_0x5a00fb['where']=qs[_0x4141('0x32')](_[_0x4141('0x39')](_0xe3ce35[_0x4141('0x31')],_0x5a0f52[_0x4141('0x32')]),_0x2751b4);if(_0xe3ce35[_0x4141('0x31')][_0x4141('0x3a')]){_0x5a00fb[_0x4141('0x3b')]=_['merge'](_0x5a00fb[_0x4141('0x3b')],{'$or':_[_0x4141('0x30')](_0x2751b4,function(_0x832d62){if(_0x832d62['type']!=='VIRTUAL'){var _0x5365bb={};_0x5365bb[_0x832d62[_0x4141('0x27')]]={'$like':'%'+_0xe3ce35[_0x4141('0x31')]['filter']+'%'};return _0x5365bb;}})});}_0x5a00fb=_[_0x4141('0x3c')]({},_0x5a00fb,_0xe3ce35[_0x4141('0x3d')]);var _0x2245fa={'where':_0x5a00fb[_0x4141('0x3b')]};return db[_0x4141('0x2a')][_0x4141('0x1c')](_0x2245fa)[_0x4141('0x3e')](function(_0x4ca91f){_0x19b4b5[_0x4141('0x1c')]=_0x4ca91f;if(_0xe3ce35[_0x4141('0x31')][_0x4141('0x3f')]){_0x5a00fb['include']=[{'all':!![]}];}return db[_0x4141('0x2a')][_0x4141('0x40')](_0x5a00fb);})[_0x4141('0x3e')](function(_0x2f8c6c){_0x19b4b5[_0x4141('0x41')]=_0x2f8c6c;return _0x19b4b5;})[_0x4141('0x3e')](respondWithFilteredResult(_0x1925cc,_0x5a00fb))[_0x4141('0x42')](handleError(_0x1925cc,null));}; \ No newline at end of file +var _0x64f3=['mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','Migration','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2355a4,_0xc0b80d){var _0xe22dd=function(_0x43282c){while(--_0x43282c){_0x2355a4['push'](_0x2355a4['shift']());}};_0xe22dd(++_0xc0b80d);}(_0x64f3,0x83));var _0x364f=function(_0x2ff981,_0x5e4baf){_0x2ff981=_0x2ff981-0x0;var _0x1aec23=_0x64f3[_0x2ff981];return _0x1aec23;};'use strict';var emlformat=require(_0x364f('0x0'));var rimraf=require(_0x364f('0x1'));var zipdir=require(_0x364f('0x2'));var jsonpatch=require(_0x364f('0x3'));var rp=require(_0x364f('0x4'));var moment=require(_0x364f('0x5'));var BPromise=require(_0x364f('0x6'));var Mustache=require(_0x364f('0x7'));var util=require(_0x364f('0x8'));var path=require(_0x364f('0x9'));var sox=require(_0x364f('0xa'));var csv=require(_0x364f('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x364f('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x364f('0xd'));var jsforce=require(_0x364f('0xe'));var deskjs=require(_0x364f('0xf'));var toCsv=require(_0x364f('0xb'));var querystring=require(_0x364f('0x10'));var Papa=require(_0x364f('0x11'));var Redis=require(_0x364f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x364f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x364f('0x14'));var logger=require(_0x364f('0x15'))(_0x364f('0x16'));var utils=require(_0x364f('0x17'));var config=require(_0x364f('0x18'));var licenseUtil=require(_0x364f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe6e3ff,_0xbe9d72){_0xbe9d72=_0xbe9d72||0xcc;return function(_0x13bdfa){if(_0x13bdfa){return _0xe6e3ff[_0x364f('0x1a')](_0xbe9d72);}return _0xe6e3ff[_0x364f('0x1b')](_0xbe9d72)[_0x364f('0x1c')]();};}function respondWithResult(_0x246b01,_0x4e8432){_0x4e8432=_0x4e8432||0xc8;return function(_0x1d15d2){if(_0x1d15d2){return _0x246b01[_0x364f('0x1b')](_0x4e8432)['json'](_0x1d15d2);}};}function respondWithFilteredResult(_0x4b3261,_0xd6c762){return function(_0x1b13ea){if(_0x1b13ea){var _0x553e25=typeof _0xd6c762[_0x364f('0x1d')]==='undefined'&&typeof _0xd6c762[_0x364f('0x1e')]===_0x364f('0x1f');var _0x2252f3=_0x1b13ea[_0x364f('0x20')];var _0x492a67=_0x553e25?0x0:_0xd6c762[_0x364f('0x1d')];var _0x1947f1=_0x553e25?_0x1b13ea[_0x364f('0x20')]:_0xd6c762[_0x364f('0x1d')]+_0xd6c762[_0x364f('0x1e')];var _0x53326a;if(_0x1947f1>=_0x2252f3){_0x1947f1=_0x2252f3;_0x53326a=0xc8;}else{_0x53326a=0xce;}_0x4b3261[_0x364f('0x1b')](_0x53326a);return _0x4b3261['set'](_0x364f('0x21'),_0x492a67+'-'+_0x1947f1+'/'+_0x2252f3)[_0x364f('0x22')](_0x1b13ea);}return null;};}function patchUpdates(_0x5744b0){return function(_0x28dec8){try{jsonpatch['apply'](_0x28dec8,_0x5744b0,!![]);}catch(_0x1a06dd){return BPromise[_0x364f('0x23')](_0x1a06dd);}return _0x28dec8[_0x364f('0x24')]();};}function saveUpdates(_0x2d717b,_0x6e226c){return function(_0x1faaaf){if(_0x1faaaf){return _0x1faaaf[_0x364f('0x25')](_0x2d717b)[_0x364f('0x26')](function(_0x4af2ca){return _0x4af2ca;});}return null;};}function removeEntity(_0x48b8a1,_0x2b4fde){return function(_0x42ff75){if(_0x42ff75){return _0x42ff75[_0x364f('0x27')]()[_0x364f('0x26')](function(){_0x48b8a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42243a,_0x589201){return function(_0x2475de){if(!_0x2475de){_0x42243a['sendStatus'](0x194);}return _0x2475de;};}function handleError(_0x10f6ca,_0x29d78d){_0x29d78d=_0x29d78d||0x1f4;return function(_0x3da744){logger[_0x364f('0x28')](_0x3da744[_0x364f('0x29')]);if(_0x3da744[_0x364f('0x2a')]){delete _0x3da744[_0x364f('0x2a')];}_0x10f6ca[_0x364f('0x1b')](_0x29d78d)[_0x364f('0x2b')](_0x3da744);};}exports[_0x364f('0x2c')]=function(_0x3022c8,_0x5ed312){var _0x102578={},_0x19287c={},_0x40a2d4={'count':0x0,'rows':[]};var _0x267819=_[_0x364f('0x2d')](db[_0x364f('0x2e')]['rawAttributes'],function(_0x2148cd){return{'name':_0x2148cd['fieldName'],'type':_0x2148cd[_0x364f('0x2f')][_0x364f('0x30')]};});_0x19287c[_0x364f('0x31')]=_[_0x364f('0x2d')](_0x267819,_0x364f('0x2a'));_0x19287c[_0x364f('0x32')]=_[_0x364f('0x33')](_0x3022c8[_0x364f('0x32')]);_0x19287c[_0x364f('0x34')]=_[_0x364f('0x35')](_0x19287c[_0x364f('0x31')],_0x19287c[_0x364f('0x32')]);_0x102578[_0x364f('0x36')]=_[_0x364f('0x35')](_0x19287c[_0x364f('0x31')],qs['fields'](_0x3022c8[_0x364f('0x32')]['fields']));_0x102578[_0x364f('0x36')]=_0x102578['attributes'][_0x364f('0x37')]?_0x102578[_0x364f('0x36')]:_0x19287c['model'];if(!_0x3022c8['query'][_0x364f('0x38')](_0x364f('0x39'))){_0x102578[_0x364f('0x1e')]=qs[_0x364f('0x1e')](_0x3022c8[_0x364f('0x32')][_0x364f('0x1e')]);_0x102578[_0x364f('0x1d')]=qs['offset'](_0x3022c8[_0x364f('0x32')][_0x364f('0x1d')]);}_0x102578['order']=qs['sort'](_0x3022c8[_0x364f('0x32')][_0x364f('0x3a')]);_0x102578[_0x364f('0x3b')]=qs['filters'](_[_0x364f('0x3c')](_0x3022c8[_0x364f('0x32')],_0x19287c[_0x364f('0x34')]),_0x267819);if(_0x3022c8[_0x364f('0x32')][_0x364f('0x3d')]){_0x102578[_0x364f('0x3b')]=_[_0x364f('0x3e')](_0x102578[_0x364f('0x3b')],{'$or':_[_0x364f('0x2d')](_0x267819,function(_0x181e23){if(_0x181e23[_0x364f('0x2f')]!=='VIRTUAL'){var _0x3c5c6a={};_0x3c5c6a[_0x181e23['name']]={'$like':'%'+_0x3022c8['query'][_0x364f('0x3d')]+'%'};return _0x3c5c6a;}})});}_0x102578=_[_0x364f('0x3e')]({},_0x102578,_0x3022c8[_0x364f('0x3f')]);var _0x58cd19={'where':_0x102578['where']};return db[_0x364f('0x2e')]['count'](_0x58cd19)[_0x364f('0x26')](function(_0x12a72b){_0x40a2d4[_0x364f('0x20')]=_0x12a72b;if(_0x3022c8[_0x364f('0x32')][_0x364f('0x40')]){_0x102578[_0x364f('0x41')]=[{'all':!![]}];}return db['Migration'][_0x364f('0x42')](_0x102578);})[_0x364f('0x26')](function(_0x3842b5){_0x40a2d4[_0x364f('0x43')]=_0x3842b5;return _0x40a2d4;})[_0x364f('0x26')](respondWithFilteredResult(_0x5ed312,_0x102578))[_0x364f('0x44')](handleError(_0x5ed312,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7ad599a..0aff079 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 _0x1373=['moment','bluebird','path','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api'];(function(_0x3bc895,_0xcc39a8){var _0x35d8fc=function(_0x46355b){while(--_0x46355b){_0x3bc895['push'](_0x3bc895['shift']());}};_0x35d8fc(++_0xcc39a8);}(_0x1373,0x1a9));var _0x3137=function(_0x301658,_0x353760){_0x301658=_0x301658-0x0;var _0x348cf6=_0x1373[_0x301658];return _0x348cf6;};'use strict';var _=require(_0x3137('0x0'));var util=require(_0x3137('0x1'));var logger=require(_0x3137('0x2'))(_0x3137('0x3'));var moment=require(_0x3137('0x4'));var BPromise=require(_0x3137('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3137('0x6'));var rimraf=require(_0x3137('0x7'));var config=require('../../config/environment');var attributes=require(_0x3137('0x8'));module[_0x3137('0x9')]=function(_0x134b84,_0xde4544){return _0x134b84[_0x3137('0xa')](_0x3137('0xb'),attributes,{'tableName':_0x3137('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bf4=['exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./migration.attributes'];(function(_0x5e29c7,_0xc2f44e){var _0x5ba897=function(_0x650b47){while(--_0x650b47){_0x5e29c7['push'](_0x5e29c7['shift']());}};_0x5ba897(++_0xc2f44e);}(_0x0bf4,0xe8));var _0x40bf=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0x0bf4[_0x347471];return _0x422b6a;};'use strict';var _=require(_0x40bf('0x0'));var util=require(_0x40bf('0x1'));var logger=require(_0x40bf('0x2'))(_0x40bf('0x3'));var moment=require(_0x40bf('0x4'));var BPromise=require(_0x40bf('0x5'));var rp=require(_0x40bf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x40bf('0x7'));module[_0x40bf('0x8')]=function(_0x3c807b,_0x2de9fb){return _0x3c807b[_0x40bf('0x9')](_0x40bf('0xa'),attributes,{'tableName':_0x40bf('0xb'),'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 aba98cd..cb6eddd 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 _0xc7ea=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0xc7ea,0x171));var _0xac7e=function(_0x2646a5,_0x4c7180){_0x2646a5=_0x2646a5-0x0;var _0x2c8339=_0xc7ea[_0x2646a5];return _0x2c8339;};'use strict';var _=require(_0xac7e('0x0'));var util=require(_0xac7e('0x1'));var moment=require('moment');var BPromise=require(_0xac7e('0x2'));var rs=require(_0xac7e('0x3'));var fs=require('fs');var Redis=require(_0xac7e('0x4'));var db=require(_0xac7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7e('0x6'))(_0xac7e('0x7'));var config=require(_0xac7e('0x8'));var jayson=require(_0xac7e('0x9'));var client=jayson[_0xac7e('0xa')][_0xac7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x447bfe,_0x1aca29,_0x1612f3){return new BPromise(function(_0x1cb874,_0x4d83fb){return client[_0xac7e('0xc')](_0x447bfe,_0x1612f3)[_0xac7e('0xd')](function(_0x2efbf4){logger[_0xac7e('0xe')](_0xac7e('0xf'),_0x1aca29,_0xac7e('0x10'));logger[_0xac7e('0x11')](_0xac7e('0x12'),_0x1aca29,_0xac7e('0x10'),JSON[_0xac7e('0x13')](_0x2efbf4));if(_0x2efbf4[_0xac7e('0x14')]){if(_0x2efbf4[_0xac7e('0x14')]['code']===0x1f4){logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x2efbf4['error'][_0xac7e('0x15')]);return _0x4d83fb(_0x2efbf4[_0xac7e('0x14')][_0xac7e('0x15')]);}logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x2efbf4['error'][_0xac7e('0x15')]);return _0x1cb874(_0x2efbf4[_0xac7e('0x14')][_0xac7e('0x15')]);}else{logger[_0xac7e('0xe')](_0xac7e('0xf'),_0x1aca29,_0xac7e('0x10'));_0x1cb874(_0x2efbf4[_0xac7e('0x16')][_0xac7e('0x15')]);}})['catch'](function(_0x3f4869){logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x3f4869);_0x4d83fb(_0x3f4869);});});} \ No newline at end of file +var _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x34dc3d,_0x3548b2){var _0x5837b1=function(_0x7119bd){while(--_0x7119bd){_0x34dc3d['push'](_0x34dc3d['shift']());}};_0x5837b1(++_0x3548b2);}(_0x153f,0x15b));var _0xf153=function(_0x590fd3,_0x5ec0c8){_0x590fd3=_0x590fd3-0x0;var _0x3293ff=_0x153f[_0x590fd3];return _0x3293ff;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('Migration,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index c114d17..f87ba32 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 _0x3c50=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','create','update','delete','isAuthenticated','destroy','exports'];(function(_0x5c802c,_0x434257){var _0x3ca25f=function(_0x5984cb){while(--_0x5984cb){_0x5c802c['push'](_0x5c802c['shift']());}};_0x3ca25f(++_0x434257);}(_0x3c50,0x132));var _0x03c5=function(_0x470ee9,_0x2b745d){_0x470ee9=_0x470ee9-0x0;var _0x2f3506=_0x3c50[_0x470ee9];return _0x2f3506;};'use strict';var multer=require(_0x03c5('0x0'));var util=require('util');var path=require(_0x03c5('0x1'));var timeout=require('connect-timeout');var express=require(_0x03c5('0x2'));var router=express[_0x03c5('0x3')]();var fs_extra=require(_0x03c5('0x4'));var auth=require(_0x03c5('0x5'));var interaction=require(_0x03c5('0x6'));var config=require(_0x03c5('0x7'));var controller=require('./network.controller');router[_0x03c5('0x8')]('/',auth['isAuthenticated'](),controller[_0x03c5('0x9')]);router[_0x03c5('0x8')](_0x03c5('0xa'),auth['isAuthenticated'](),controller[_0x03c5('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x03c5('0xc')]);router['put'](_0x03c5('0xa'),auth['isAuthenticated'](),controller[_0x03c5('0xd')]);router[_0x03c5('0xe')]('/:id',auth[_0x03c5('0xf')](),controller[_0x03c5('0x10')]);module[_0x03c5('0x11')]=router; \ No newline at end of file +var _0x8f9d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0x8f9d,0x93));var _0xd8f9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8f9d[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['show']);router[_0xd8f9('0xd')]('/',auth[_0xd8f9('0x9')](),controller['create']);router[_0xd8f9('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);module[_0xd8f9('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index a47d568..6d91986 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 _0x4c70=['turn','STRING','sequelize','ENUM','localnet','externip'];(function(_0x4d56b9,_0x9221f0){var _0x37b056=function(_0x174fe9){while(--_0x174fe9){_0x4d56b9['push'](_0x4d56b9['shift']());}};_0x37b056(++_0x9221f0);}(_0x4c70,0x122));var _0x04c7=function(_0x10eb6b,_0x3fe155){_0x10eb6b=_0x10eb6b-0x0;var _0x3a3ab1=_0x4c70[_0x10eb6b];return _0x3a3ab1;};'use strict';var Sequelize=require(_0x04c7('0x0'));module['exports']={'type':{'type':Sequelize[_0x04c7('0x1')](_0x04c7('0x2'),_0x04c7('0x3'),'stun',_0x04c7('0x4'))},'value':{'type':Sequelize[_0x04c7('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed4b=['exports','ENUM','localnet','stun','turn','STRING'];(function(_0x225fc8,_0x2f9b09){var _0x3a601f=function(_0x144e04){while(--_0x144e04){_0x225fc8['push'](_0x225fc8['shift']());}};_0x3a601f(++_0x2f9b09);}(_0xed4b,0x7e));var _0xbed4=function(_0x27579d,_0x568070){_0x27579d=_0x27579d-0x0;var _0x37fbc2=_0xed4b[_0x27579d];return _0x37fbc2;};'use strict';var Sequelize=require('sequelize');module[_0xbed4('0x0')]={'type':{'type':Sequelize[_0xbed4('0x1')](_0xbed4('0x2'),'externip',_0xbed4('0x3'),_0xbed4('0x4'))},'value':{'type':Sequelize[_0xbed4('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 5a38802..d24e558 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 _0x4412=['utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/turn_xcally.conf','util','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','name','send','map','Network','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0x4412,0x162));var _0x2441=function(_0x3447d5,_0x4250ac){_0x3447d5=_0x3447d5-0x0;var _0x20250b=_0x4412[_0x3447d5];return _0x20250b;};'use strict';var util=require(_0x2441('0x0'));var path=require('path');var ejs=require(_0x2441('0x1'));var fs=require('fs');var _=require(_0x2441('0x2'));var qs=require(_0x2441('0x3'));var logger=require(_0x2441('0x4'))('api');var config=require(_0x2441('0x5'));var db=require(_0x2441('0x6'))['db'];var jayson=require(_0x2441('0x7'));var client=jayson[_0x2441('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa849ea,_0x3d1b91,_0x3d4563,_0x34e7c4){return new Promise(function(_0x5934ee,_0x39919a){var _0x289c4f=_0x34e7c4||client;return _0x289c4f[_0x2441('0x9')](_0xa849ea,_0x3d4563)[_0x2441('0xa')](function(_0x4c9606){logger[_0x2441('0xb')](_0x2441('0xc'),_0x3d1b91,_0x2441('0xd'));logger[_0x2441('0xe')](_0x2441('0xf'),_0x3d1b91,_0x2441('0xd'),JSON[_0x2441('0x10')](_0x4c9606));if(_0x4c9606['error']){if(_0x4c9606['error']['code']===0x1f4){logger[_0x2441('0x11')](_0x2441('0xc'),_0x3d1b91,_0x4c9606[_0x2441('0x11')][_0x2441('0x12')]);return _0x39919a(_0x4c9606[_0x2441('0x11')][_0x2441('0x12')]);}logger[_0x2441('0x11')]('Network,\x20%s,\x20%s',_0x3d1b91,_0x4c9606['error']['message']);return _0x5934ee(_0x4c9606[_0x2441('0x11')][_0x2441('0x12')]);}else{logger['info'](_0x2441('0xc'),_0x3d1b91,_0x2441('0xd'));_0x5934ee(_0x4c9606[_0x2441('0x13')][_0x2441('0x12')]);}})[_0x2441('0x14')](function(_0x4410a1){logger[_0x2441('0x11')](_0x2441('0xc'),_0x3d1b91,_0x4410a1);_0x39919a(_0x4410a1);});});}function respondWithResult(_0x525a37,_0x2c3536){_0x2c3536=_0x2c3536||0xc8;return function(_0x3a7e8f){if(_0x3a7e8f){return _0x525a37[_0x2441('0x15')](_0x2c3536)[_0x2441('0x16')](_0x3a7e8f);}};}function respondWithFilteredResult(_0x5c81b1,_0xe7d01b){return function(_0x26ee65){if(_0x26ee65){var _0x4af02a=typeof _0xe7d01b[_0x2441('0x17')]==='undefined'&&typeof _0xe7d01b[_0x2441('0x18')]===_0x2441('0x19');var _0x1d3872=_0x26ee65[_0x2441('0x1a')];var _0x4311ea=_0x4af02a?0x0:_0xe7d01b[_0x2441('0x17')];var _0x89d2c0=_0x4af02a?_0x26ee65[_0x2441('0x1a')]:_0xe7d01b['offset']+_0xe7d01b[_0x2441('0x18')];var _0x1e9de0;if(_0x89d2c0>=_0x1d3872){_0x89d2c0=_0x1d3872;_0x1e9de0=0xc8;}else{_0x1e9de0=0xce;}_0x5c81b1[_0x2441('0x15')](_0x1e9de0);return _0x5c81b1[_0x2441('0x1b')](_0x2441('0x1c'),_0x4311ea+'-'+_0x89d2c0+'/'+_0x1d3872)[_0x2441('0x16')](_0x26ee65);}return null;};}function saveUpdates(_0x5e052b){return function(_0x3493aa){if(_0x3493aa){return _0x3493aa[_0x2441('0x1d')](_0x5e052b)[_0x2441('0xa')](function(_0x48a17b){return _0x48a17b;});}return null;};}function removeEntity(_0x4af771){return function(_0x241a11){if(_0x241a11){return _0x241a11[_0x2441('0x1e')]()[_0x2441('0xa')](function(){_0x4af771[_0x2441('0x15')](0xcc)[_0x2441('0x1f')]();});}};}function handleEntityNotFound(_0x53b1b1){return function(_0x14051f){if(!_0x14051f){_0x53b1b1[_0x2441('0x20')](0x194);}return _0x14051f;};}function handleError(_0x4eb395,_0x1c7c97){_0x1c7c97=_0x1c7c97||0x1f4;return function(_0x459205){logger['error'](_0x459205['stack']);if(_0x459205[_0x2441('0x21')]){delete _0x459205['name'];}_0x4eb395[_0x2441('0x15')](_0x1c7c97)[_0x2441('0x22')](_0x459205);};}exports['index']=function(_0x5de834,_0x3bfa28){var _0x35e3e1={},_0x3f783f={},_0x5d6ad8={'count':0x0,'rows':[]};var _0xbf0a7a=_[_0x2441('0x23')](db[_0x2441('0x24')][_0x2441('0x25')],function(_0x453859){return{'name':_0x453859['fieldName'],'type':_0x453859[_0x2441('0x26')][_0x2441('0x27')]};});_0x3f783f[_0x2441('0x28')]=_[_0x2441('0x23')](_0xbf0a7a,_0x2441('0x21'));_0x3f783f['query']=_[_0x2441('0x29')](_0x5de834['query']);_0x3f783f['filters']=_[_0x2441('0x2a')](_0x3f783f[_0x2441('0x28')],_0x3f783f[_0x2441('0x2b')]);_0x35e3e1[_0x2441('0x2c')]=_[_0x2441('0x2a')](_0x3f783f[_0x2441('0x28')],qs[_0x2441('0x2d')](_0x5de834['query']['fields']));_0x35e3e1[_0x2441('0x2c')]=_0x35e3e1['attributes'][_0x2441('0x2e')]?_0x35e3e1[_0x2441('0x2c')]:_0x3f783f[_0x2441('0x28')];if(!_0x5de834[_0x2441('0x2b')]['hasOwnProperty']('nolimit')){_0x35e3e1[_0x2441('0x18')]=qs[_0x2441('0x18')](_0x5de834['query']['limit']);_0x35e3e1[_0x2441('0x17')]=qs[_0x2441('0x17')](_0x5de834[_0x2441('0x2b')]['offset']);}_0x35e3e1[_0x2441('0x2f')]=qs[_0x2441('0x30')](_0x5de834[_0x2441('0x2b')][_0x2441('0x30')]);_0x35e3e1[_0x2441('0x31')]=qs[_0x2441('0x32')](_[_0x2441('0x33')](_0x5de834['query'],_0x3f783f['filters']),_0xbf0a7a);if(_0x5de834['query'][_0x2441('0x34')]){_0x35e3e1[_0x2441('0x31')]=_[_0x2441('0x35')](_0x35e3e1['where'],{'$or':_[_0x2441('0x23')](_0xbf0a7a,function(_0x3da51c){if(_0x3da51c[_0x2441('0x26')]!==_0x2441('0x36')){var _0x561952={};_0x561952[_0x3da51c['name']]={'$like':'%'+_0x5de834['query'][_0x2441('0x34')]+'%'};return _0x561952;}})});}_0x35e3e1=_['merge']({},_0x35e3e1,_0x5de834[_0x2441('0x37')]);var _0x38e5a3={'where':_0x35e3e1[_0x2441('0x31')]};return db[_0x2441('0x24')][_0x2441('0x1a')](_0x38e5a3)[_0x2441('0xa')](function(_0x27a959){_0x5d6ad8[_0x2441('0x1a')]=_0x27a959;if(_0x5de834[_0x2441('0x2b')][_0x2441('0x38')]){_0x35e3e1[_0x2441('0x39')]=[{'all':!![]}];}return db[_0x2441('0x24')][_0x2441('0x3a')](_0x35e3e1);})['then'](function(_0x580074){_0x5d6ad8[_0x2441('0x3b')]=_0x580074;return _0x5d6ad8;})[_0x2441('0xa')](respondWithFilteredResult(_0x3bfa28,_0x35e3e1))[_0x2441('0x14')](handleError(_0x3bfa28,null));};exports[_0x2441('0x3c')]=function(_0x399cf6,_0x3667fa){var _0x5eac4b={'raw':!![],'where':{'id':_0x399cf6[_0x2441('0x3d')]['id']}},_0x1840c0={};_0x1840c0[_0x2441('0x28')]=_[_0x2441('0x29')](db[_0x2441('0x24')][_0x2441('0x25')]);_0x1840c0[_0x2441('0x2b')]=_[_0x2441('0x29')](_0x399cf6['query']);_0x1840c0[_0x2441('0x32')]=_[_0x2441('0x2a')](_0x1840c0[_0x2441('0x28')],_0x1840c0[_0x2441('0x2b')]);_0x5eac4b[_0x2441('0x2c')]=_[_0x2441('0x2a')](_0x1840c0[_0x2441('0x28')],qs[_0x2441('0x2d')](_0x399cf6['query'][_0x2441('0x2d')]));_0x5eac4b[_0x2441('0x2c')]=_0x5eac4b[_0x2441('0x2c')][_0x2441('0x2e')]?_0x5eac4b[_0x2441('0x2c')]:_0x1840c0[_0x2441('0x28')];if(_0x399cf6[_0x2441('0x2b')][_0x2441('0x38')]){_0x5eac4b[_0x2441('0x39')]=[{'all':!![]}];}_0x5eac4b=_[_0x2441('0x35')]({},_0x5eac4b,_0x399cf6[_0x2441('0x37')]);return db[_0x2441('0x24')][_0x2441('0x3e')](_0x5eac4b)['then'](handleEntityNotFound(_0x3667fa,null))['then'](respondWithResult(_0x3667fa,null))[_0x2441('0x14')](handleError(_0x3667fa,null));};exports[_0x2441('0x3f')]=function(_0x550631,_0x5c6fb4){var _0x28c262;return db[_0x2441('0x24')][_0x2441('0x3f')](_0x550631[_0x2441('0x40')],{'raw':!![]})['then'](function(_0x53b28e){_0x28c262=_0x53b28e;return db['Network']['findAll']({'where':{'type':_0x550631['body']['type']},'raw':!![]});})['then'](function(_0x3e7386){if(_0x28c262[_0x2441('0x26')][_0x2441('0x41')]()==_0x2441('0x42')){var _0x5954b5=fs[_0x2441('0x43')](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x46')),_0x2441('0x47'));var _0xa946b6=ejs[_0x2441('0x48')](_0x5954b5,{'networks':_0x3e7386||[]});fs[_0x2441('0x49')](_0x2441('0x4a'),_0xa946b6);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x3f'),{'module':_0x2441('0x4c')});}else if(_0x28c262[_0x2441('0x26')][_0x2441('0x41')]()==_0x2441('0x4d')){var _0x12f1f8=fs[_0x2441('0x43')](path['join'](config['root'],_0x2441('0x4e')),_0x2441('0x47'));var _0x4e6a45=ejs[_0x2441('0x48')](_0x12f1f8,{'networks':_0x3e7386||[]});fs[_0x2441('0x49')]('/etc/asterisk/turn_xcally.conf',_0x4e6a45);return respondWithRpcPromise(_0x2441('0x4b'),'create',{'module':_0x2441('0x4c')});}else{var _0x2919e8=fs[_0x2441('0x43')](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x4f')),_0x2441('0x47'));var _0x2df333=ejs['render'](_0x2919e8,{'networks':_0x3e7386||[]});fs['writeFileSync'](util[_0x2441('0x50')](_0x2441('0x51'),_0x550631['body'][_0x2441('0x26')][_0x2441('0x52')]()),_0x2df333);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x3f'),{'module':_0x2441('0x53')});}})['then'](function(){return _0x28c262;})[_0x2441('0xa')](respondWithResult(_0x5c6fb4,0xc9))[_0x2441('0x14')](handleError(_0x5c6fb4,null));};exports[_0x2441('0x1d')]=function(_0xcbda81,_0xa7a092){var _0x5ee70b;return db[_0x2441('0x24')]['find']({'where':{'id':_0xcbda81['params']['id']}})[_0x2441('0xa')](handleEntityNotFound(_0xa7a092,null))[_0x2441('0xa')](saveUpdates(_0xcbda81[_0x2441('0x40')],null))[_0x2441('0xa')](function(_0x2bb92c){if(_0x2bb92c){_0x5ee70b=_0x2bb92c;return db[_0x2441('0x24')][_0x2441('0x3a')]({'where':{'type':_0x5ee70b[_0x2441('0x26')]},'raw':!![]});}return null;})[_0x2441('0xa')](function(_0x207a16){if(_0x5ee70b[_0x2441('0x26')][_0x2441('0x41')]()==_0x2441('0x42')){var _0x4b336d=fs[_0x2441('0x43')](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x46')),'utf8');var _0x1f3bf6=ejs[_0x2441('0x48')](_0x4b336d,{'networks':_0x207a16||[]});fs[_0x2441('0x49')](_0x2441('0x4a'),_0x1f3bf6);return respondWithRpcPromise('Reload',_0x2441('0x1d'),{'module':_0x2441('0x4c')});}else if(_0x5ee70b[_0x2441('0x26')]['toUpperCase']()==_0x2441('0x4d')){var _0x520fe5=fs[_0x2441('0x43')](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x4e')),_0x2441('0x47'));var _0x21fbfd=ejs[_0x2441('0x48')](_0x520fe5,{'networks':_0x207a16||[]});fs[_0x2441('0x49')](_0x2441('0x54'),_0x21fbfd);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x1d'),{'module':_0x2441('0x4c')});}else{var _0x6f0bbf=fs['readFileSync'](path[_0x2441('0x44')](config['root'],_0x2441('0x4f')),_0x2441('0x47'));var _0x1684f0=ejs[_0x2441('0x48')](_0x6f0bbf,{'networks':_0x207a16||[]});fs[_0x2441('0x49')](util[_0x2441('0x50')](_0x2441('0x51'),_0xcbda81[_0x2441('0x40')]['type'][_0x2441('0x52')]()),_0x1684f0);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x1d'),{'module':_0x2441('0x53')});}})['then'](function(_0x43e059){if(_0x43e059){return _0x5ee70b;}return null;})[_0x2441('0xa')](respondWithResult(_0xa7a092,null))[_0x2441('0x14')](handleError(_0xa7a092,null));};exports['destroy']=function(_0x389768,_0x335d24){var _0x1f63d9;return db['Network'][_0x2441('0x3e')]({'where':{'id':_0x389768[_0x2441('0x3d')]['id']}})[_0x2441('0xa')](function(_0x4f8044){_0x1f63d9=_0x4f8044;return _0x4f8044;})[_0x2441('0xa')](handleEntityNotFound(_0x335d24,null))[_0x2441('0xa')](removeEntity(_0x335d24,null))[_0x2441('0xa')](function(){if(_0x1f63d9){return db[_0x2441('0x24')][_0x2441('0x3a')]({'where':{'type':_0x1f63d9['type']},'raw':!![]});}})[_0x2441('0xa')](function(_0x349831){if(_0x1f63d9[_0x2441('0x26')][_0x2441('0x41')]()==_0x2441('0x42')){var _0x522d40=fs['readFileSync'](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x46')),_0x2441('0x47'));var _0x5cef14=ejs['render'](_0x522d40,{'networks':_0x349831||[]});fs[_0x2441('0x49')](_0x2441('0x4a'),_0x5cef14);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x1e'),{'module':_0x2441('0x4c')});}else if(_0x1f63d9[_0x2441('0x26')]['toUpperCase']()==_0x2441('0x4d')){var _0x268886=fs[_0x2441('0x43')](path[_0x2441('0x44')](config['root'],_0x2441('0x4e')),_0x2441('0x47'));var _0x4265f0=ejs[_0x2441('0x48')](_0x268886,{'networks':_0x349831||[]});fs[_0x2441('0x49')]('/etc/asterisk/turn_xcally.conf',_0x4265f0);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x331ab2=fs[_0x2441('0x43')](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x4f')),_0x2441('0x47'));var _0x1b66f6=ejs[_0x2441('0x48')](_0x331ab2,{'networks':_0x349831||[]});fs[_0x2441('0x49')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1f63d9[_0x2441('0x26')][_0x2441('0x52')]()),_0x1b66f6);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x1e'),{'module':_0x2441('0x53')});}})[_0x2441('0x14')](handleError(_0x335d24,null));}; \ No newline at end of file +var _0xf90f=['readFileSync','server/files/templates/turn_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/turn_xcally.conf','join','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','update','find','res_stun_monitor.so','format','util','ejs','lodash','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','undefined','limit','offset','count','set','Content-Range','destroy','end','name','send','index','map','Network','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','keys','includeAll','create','body','toUpperCase','STUN','root','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','TURN'];(function(_0x2048c7,_0x14e572){var _0x3f0795=function(_0x1747ee){while(--_0x1747ee){_0x2048c7['push'](_0x2048c7['shift']());}};_0x3f0795(++_0x14e572);}(_0xf90f,0x66));var _0xff90=function(_0x380e1e,_0x393f7b){_0x380e1e=_0x380e1e-0x0;var _0x5e346d=_0xf90f[_0x380e1e];return _0x5e346d;};'use strict';var util=require(_0xff90('0x0'));var path=require('path');var ejs=require(_0xff90('0x1'));var fs=require('fs');var _=require(_0xff90('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xff90('0x3'))(_0xff90('0x4'));var config=require('../../config/environment');var db=require(_0xff90('0x5'))['db'];var jayson=require(_0xff90('0x6'));var client=jayson[_0xff90('0x7')][_0xff90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44096b,_0x5631b4,_0x53394e,_0x182b3d){return new Promise(function(_0x708e4c,_0x451c15){var _0xd21d3e=_0x182b3d||client;return _0xd21d3e[_0xff90('0x9')](_0x44096b,_0x53394e)[_0xff90('0xa')](function(_0x57c54e){logger[_0xff90('0xb')](_0xff90('0xc'),_0x5631b4,_0xff90('0xd'));logger[_0xff90('0xe')](_0xff90('0xf'),_0x5631b4,_0xff90('0xd'),JSON[_0xff90('0x10')](_0x57c54e));if(_0x57c54e[_0xff90('0x11')]){if(_0x57c54e[_0xff90('0x11')][_0xff90('0x12')]===0x1f4){logger[_0xff90('0x11')]('Network,\x20%s,\x20%s',_0x5631b4,_0x57c54e[_0xff90('0x11')][_0xff90('0x13')]);return _0x451c15(_0x57c54e[_0xff90('0x11')][_0xff90('0x13')]);}logger['error'](_0xff90('0xc'),_0x5631b4,_0x57c54e['error'][_0xff90('0x13')]);return _0x708e4c(_0x57c54e[_0xff90('0x11')]['message']);}else{logger[_0xff90('0xb')]('Network,\x20%s,\x20%s',_0x5631b4,_0xff90('0xd'));_0x708e4c(_0x57c54e['result'][_0xff90('0x13')]);}})[_0xff90('0x14')](function(_0x511d39){logger['error'](_0xff90('0xc'),_0x5631b4,_0x511d39);_0x451c15(_0x511d39);});});}function respondWithResult(_0x32f765,_0x2fe875){_0x2fe875=_0x2fe875||0xc8;return function(_0xa1278a){if(_0xa1278a){return _0x32f765[_0xff90('0x15')](_0x2fe875)[_0xff90('0x16')](_0xa1278a);}};}function respondWithFilteredResult(_0x274ebc,_0x445be3){return function(_0x2e2bbd){if(_0x2e2bbd){var _0x24d8f5=typeof _0x445be3['offset']===_0xff90('0x17')&&typeof _0x445be3[_0xff90('0x18')]===_0xff90('0x17');var _0x202f43=_0x2e2bbd['count'];var _0x207de9=_0x24d8f5?0x0:_0x445be3[_0xff90('0x19')];var _0x27c208=_0x24d8f5?_0x2e2bbd[_0xff90('0x1a')]:_0x445be3[_0xff90('0x19')]+_0x445be3['limit'];var _0x4a851f;if(_0x27c208>=_0x202f43){_0x27c208=_0x202f43;_0x4a851f=0xc8;}else{_0x4a851f=0xce;}_0x274ebc['status'](_0x4a851f);return _0x274ebc[_0xff90('0x1b')](_0xff90('0x1c'),_0x207de9+'-'+_0x27c208+'/'+_0x202f43)[_0xff90('0x16')](_0x2e2bbd);}return null;};}function saveUpdates(_0x3d271a){return function(_0x441887){if(_0x441887){return _0x441887['update'](_0x3d271a)['then'](function(_0x19c51b){return _0x19c51b;});}return null;};}function removeEntity(_0x46d5a4){return function(_0x19c456){if(_0x19c456){return _0x19c456[_0xff90('0x1d')]()[_0xff90('0xa')](function(){_0x46d5a4[_0xff90('0x15')](0xcc)[_0xff90('0x1e')]();});}};}function handleEntityNotFound(_0x2b21c7){return function(_0x493157){if(!_0x493157){_0x2b21c7['sendStatus'](0x194);}return _0x493157;};}function handleError(_0x5828be,_0x47e24c){_0x47e24c=_0x47e24c||0x1f4;return function(_0x562dae){logger['error'](_0x562dae['stack']);if(_0x562dae[_0xff90('0x1f')]){delete _0x562dae['name'];}_0x5828be[_0xff90('0x15')](_0x47e24c)[_0xff90('0x20')](_0x562dae);};}exports[_0xff90('0x21')]=function(_0x3c0fbc,_0x5b5e30){var _0x1cd908={},_0x215a49={},_0x4a1e13={'count':0x0,'rows':[]};var _0x3cf242=_[_0xff90('0x22')](db[_0xff90('0x23')]['rawAttributes'],function(_0x166781){return{'name':_0x166781[_0xff90('0x24')],'type':_0x166781[_0xff90('0x25')][_0xff90('0x26')]};});_0x215a49[_0xff90('0x27')]=_['map'](_0x3cf242,_0xff90('0x1f'));_0x215a49[_0xff90('0x28')]=_['keys'](_0x3c0fbc[_0xff90('0x28')]);_0x215a49[_0xff90('0x29')]=_[_0xff90('0x2a')](_0x215a49['model'],_0x215a49[_0xff90('0x28')]);_0x1cd908['attributes']=_[_0xff90('0x2a')](_0x215a49[_0xff90('0x27')],qs['fields'](_0x3c0fbc[_0xff90('0x28')][_0xff90('0x2b')]));_0x1cd908[_0xff90('0x2c')]=_0x1cd908[_0xff90('0x2c')][_0xff90('0x2d')]?_0x1cd908[_0xff90('0x2c')]:_0x215a49['model'];if(!_0x3c0fbc[_0xff90('0x28')][_0xff90('0x2e')](_0xff90('0x2f'))){_0x1cd908[_0xff90('0x18')]=qs[_0xff90('0x18')](_0x3c0fbc[_0xff90('0x28')]['limit']);_0x1cd908[_0xff90('0x19')]=qs['offset'](_0x3c0fbc[_0xff90('0x28')][_0xff90('0x19')]);}_0x1cd908['order']=qs['sort'](_0x3c0fbc[_0xff90('0x28')][_0xff90('0x30')]);_0x1cd908[_0xff90('0x31')]=qs[_0xff90('0x29')](_['pick'](_0x3c0fbc[_0xff90('0x28')],_0x215a49[_0xff90('0x29')]),_0x3cf242);if(_0x3c0fbc[_0xff90('0x28')][_0xff90('0x32')]){_0x1cd908[_0xff90('0x31')]=_[_0xff90('0x33')](_0x1cd908[_0xff90('0x31')],{'$or':_[_0xff90('0x22')](_0x3cf242,function(_0x1103fd){if(_0x1103fd[_0xff90('0x25')]!==_0xff90('0x34')){var _0x4c56a5={};_0x4c56a5[_0x1103fd[_0xff90('0x1f')]]={'$like':'%'+_0x3c0fbc[_0xff90('0x28')][_0xff90('0x32')]+'%'};return _0x4c56a5;}})});}_0x1cd908=_[_0xff90('0x33')]({},_0x1cd908,_0x3c0fbc[_0xff90('0x35')]);var _0x3bde89={'where':_0x1cd908[_0xff90('0x31')]};return db[_0xff90('0x23')][_0xff90('0x1a')](_0x3bde89)['then'](function(_0x463f7f){_0x4a1e13[_0xff90('0x1a')]=_0x463f7f;if(_0x3c0fbc[_0xff90('0x28')]['includeAll']){_0x1cd908[_0xff90('0x36')]=[{'all':!![]}];}return db[_0xff90('0x23')][_0xff90('0x37')](_0x1cd908);})['then'](function(_0x336ece){_0x4a1e13[_0xff90('0x38')]=_0x336ece;return _0x4a1e13;})[_0xff90('0xa')](respondWithFilteredResult(_0x5b5e30,_0x1cd908))[_0xff90('0x14')](handleError(_0x5b5e30,null));};exports[_0xff90('0x39')]=function(_0xea5cf2,_0x1b4ef2){var _0x12114a={'raw':!![],'where':{'id':_0xea5cf2[_0xff90('0x3a')]['id']}},_0x364b04={};_0x364b04[_0xff90('0x27')]=_['keys'](db[_0xff90('0x23')][_0xff90('0x3b')]);_0x364b04[_0xff90('0x28')]=_[_0xff90('0x3c')](_0xea5cf2[_0xff90('0x28')]);_0x364b04[_0xff90('0x29')]=_[_0xff90('0x2a')](_0x364b04['model'],_0x364b04[_0xff90('0x28')]);_0x12114a[_0xff90('0x2c')]=_[_0xff90('0x2a')](_0x364b04['model'],qs[_0xff90('0x2b')](_0xea5cf2[_0xff90('0x28')][_0xff90('0x2b')]));_0x12114a['attributes']=_0x12114a['attributes'][_0xff90('0x2d')]?_0x12114a[_0xff90('0x2c')]:_0x364b04[_0xff90('0x27')];if(_0xea5cf2[_0xff90('0x28')][_0xff90('0x3d')]){_0x12114a[_0xff90('0x36')]=[{'all':!![]}];}_0x12114a=_[_0xff90('0x33')]({},_0x12114a,_0xea5cf2[_0xff90('0x35')]);return db['Network']['find'](_0x12114a)['then'](handleEntityNotFound(_0x1b4ef2,null))['then'](respondWithResult(_0x1b4ef2,null))[_0xff90('0x14')](handleError(_0x1b4ef2,null));};exports[_0xff90('0x3e')]=function(_0x61a22a,_0x15e0e7){var _0xf4483e;return db[_0xff90('0x23')][_0xff90('0x3e')](_0x61a22a[_0xff90('0x3f')],{'raw':!![]})[_0xff90('0xa')](function(_0x134888){_0xf4483e=_0x134888;return db[_0xff90('0x23')][_0xff90('0x37')]({'where':{'type':_0x61a22a[_0xff90('0x3f')][_0xff90('0x25')]},'raw':!![]});})[_0xff90('0xa')](function(_0x4206e7){if(_0xf4483e[_0xff90('0x25')][_0xff90('0x40')]()==_0xff90('0x41')){var _0x1e9c90=fs['readFileSync'](path['join'](config[_0xff90('0x42')],_0xff90('0x43')),'utf8');var _0x4b15c7=ejs['render'](_0x1e9c90,{'networks':_0x4206e7||[]});fs['writeFileSync'](_0xff90('0x44'),_0x4b15c7);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0xf4483e[_0xff90('0x25')][_0xff90('0x40')]()==_0xff90('0x45')){var _0xa90cb9=fs[_0xff90('0x46')](path['join'](config[_0xff90('0x42')],_0xff90('0x47')),_0xff90('0x48'));var _0x58e98b=ejs[_0xff90('0x49')](_0xa90cb9,{'networks':_0x4206e7||[]});fs[_0xff90('0x4a')](_0xff90('0x4b'),_0x58e98b);return respondWithRpcPromise('Reload',_0xff90('0x3e'),{'module':'res_stun_monitor.so'});}else{var _0x295367=fs[_0xff90('0x46')](path[_0xff90('0x4c')](config[_0xff90('0x42')],_0xff90('0x4d')),'utf8');var _0x1ac4d1=ejs[_0xff90('0x49')](_0x295367,{'networks':_0x4206e7||[]});fs[_0xff90('0x4a')](util['format'](_0xff90('0x4e'),_0x61a22a['body'][_0xff90('0x25')][_0xff90('0x4f')]()),_0x1ac4d1);return respondWithRpcPromise(_0xff90('0x50'),'create',{'module':_0xff90('0x51')});}})[_0xff90('0xa')](function(){return _0xf4483e;})[_0xff90('0xa')](respondWithResult(_0x15e0e7,0xc9))[_0xff90('0x14')](handleError(_0x15e0e7,null));};exports[_0xff90('0x52')]=function(_0x2b1d5d,_0xf13df){var _0x35dd2a;return db['Network'][_0xff90('0x53')]({'where':{'id':_0x2b1d5d[_0xff90('0x3a')]['id']}})[_0xff90('0xa')](handleEntityNotFound(_0xf13df,null))['then'](saveUpdates(_0x2b1d5d['body'],null))[_0xff90('0xa')](function(_0x534aaa){if(_0x534aaa){_0x35dd2a=_0x534aaa;return db['Network'][_0xff90('0x37')]({'where':{'type':_0x35dd2a[_0xff90('0x25')]},'raw':!![]});}return null;})['then'](function(_0x441bab){if(_0x35dd2a[_0xff90('0x25')][_0xff90('0x40')]()=='STUN'){var _0x4403d1=fs[_0xff90('0x46')](path[_0xff90('0x4c')](config[_0xff90('0x42')],_0xff90('0x43')),_0xff90('0x48'));var _0x3d7040=ejs[_0xff90('0x49')](_0x4403d1,{'networks':_0x441bab||[]});fs[_0xff90('0x4a')](_0xff90('0x44'),_0x3d7040);return respondWithRpcPromise('Reload','update',{'module':_0xff90('0x54')});}else if(_0x35dd2a[_0xff90('0x25')][_0xff90('0x40')]()==_0xff90('0x45')){var _0x787295=fs[_0xff90('0x46')](path['join'](config['root'],_0xff90('0x47')),_0xff90('0x48'));var _0x7cb365=ejs[_0xff90('0x49')](_0x787295,{'networks':_0x441bab||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x7cb365);return respondWithRpcPromise(_0xff90('0x50'),_0xff90('0x52'),{'module':_0xff90('0x54')});}else{var _0x5bf640=fs['readFileSync'](path[_0xff90('0x4c')](config[_0xff90('0x42')],_0xff90('0x4d')),_0xff90('0x48'));var _0x5e35d1=ejs[_0xff90('0x49')](_0x5bf640,{'networks':_0x441bab||[]});fs[_0xff90('0x4a')](util[_0xff90('0x55')](_0xff90('0x4e'),_0x2b1d5d[_0xff90('0x3f')][_0xff90('0x25')][_0xff90('0x4f')]()),_0x5e35d1);return respondWithRpcPromise(_0xff90('0x50'),_0xff90('0x52'),{'module':_0xff90('0x51')});}})[_0xff90('0xa')](function(_0x3ba2ea){if(_0x3ba2ea){return _0x35dd2a;}return null;})[_0xff90('0xa')](respondWithResult(_0xf13df,null))[_0xff90('0x14')](handleError(_0xf13df,null));};exports[_0xff90('0x1d')]=function(_0x8a080c,_0x37b695){var _0x564dd6;return db[_0xff90('0x23')][_0xff90('0x53')]({'where':{'id':_0x8a080c[_0xff90('0x3a')]['id']}})[_0xff90('0xa')](function(_0x38f19e){_0x564dd6=_0x38f19e;return _0x38f19e;})[_0xff90('0xa')](handleEntityNotFound(_0x37b695,null))[_0xff90('0xa')](removeEntity(_0x37b695,null))[_0xff90('0xa')](function(){if(_0x564dd6){return db[_0xff90('0x23')][_0xff90('0x37')]({'where':{'type':_0x564dd6[_0xff90('0x25')]},'raw':!![]});}})['then'](function(_0x270246){if(_0x564dd6['type'][_0xff90('0x40')]()==_0xff90('0x41')){var _0x39e621=fs[_0xff90('0x46')](path['join'](config[_0xff90('0x42')],_0xff90('0x43')),'utf8');var _0x1d2db3=ejs[_0xff90('0x49')](_0x39e621,{'networks':_0x270246||[]});fs['writeFileSync'](_0xff90('0x44'),_0x1d2db3);return respondWithRpcPromise(_0xff90('0x50'),'destroy',{'module':_0xff90('0x54')});}else if(_0x564dd6[_0xff90('0x25')][_0xff90('0x40')]()==_0xff90('0x45')){var _0x126d8d=fs[_0xff90('0x46')](path['join'](config[_0xff90('0x42')],_0xff90('0x47')),_0xff90('0x48'));var _0xb56baa=ejs[_0xff90('0x49')](_0x126d8d,{'networks':_0x270246||[]});fs[_0xff90('0x4a')](_0xff90('0x4b'),_0xb56baa);return respondWithRpcPromise('Reload',_0xff90('0x1d'),{'module':_0xff90('0x54')});}else{var _0x4f6758=fs[_0xff90('0x46')](path[_0xff90('0x4c')](config[_0xff90('0x42')],_0xff90('0x4d')),'utf8');var _0x30869a=ejs['render'](_0x4f6758,{'networks':_0x270246||[]});fs[_0xff90('0x4a')](util[_0xff90('0x55')](_0xff90('0x4e'),_0x564dd6[_0xff90('0x25')]['toLowerCase']()),_0x30869a);return respondWithRpcPromise(_0xff90('0x50'),'destroy',{'module':_0xff90('0x51')});}})[_0xff90('0x14')](handleError(_0x37b695,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index c7f6f08..7cd34ac 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 _0x2bb0=['exports','define','Network','lodash','util','../../config/logger','moment','path','../../config/environment','./network.attributes'];(function(_0x452145,_0x1fa5b6){var _0x1b49f2=function(_0xd99025){while(--_0xd99025){_0x452145['push'](_0x452145['shift']());}};_0x1b49f2(++_0x1fa5b6);}(_0x2bb0,0xf3));var _0x02bb=function(_0x18e68d,_0x3345c2){_0x18e68d=_0x18e68d-0x0;var _0x114fb0=_0x2bb0[_0x18e68d];return _0x114fb0;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var logger=require(_0x02bb('0x2'))('api');var moment=require(_0x02bb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x02bb('0x4'));var rimraf=require('rimraf');var config=require(_0x02bb('0x5'));var attributes=require(_0x02bb('0x6'));module[_0x02bb('0x7')]=function(_0x390ff7,_0x43dbb7){return _0x390ff7[_0x02bb('0x8')](_0x02bb('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1752=['bluebird','request-promise','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','util','../../config/logger','api','moment'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x1752,0xa5));var _0x2175=function(_0x29ab7d,_0x46867f){_0x29ab7d=_0x29ab7d-0x0;var _0xabacd9=_0x1752[_0x29ab7d];return _0xabacd9;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var logger=require(_0x2175('0x1'))(_0x2175('0x2'));var moment=require(_0x2175('0x3'));var BPromise=require(_0x2175('0x4'));var rp=require(_0x2175('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2175('0x6'));var config=require(_0x2175('0x7'));var attributes=require(_0x2175('0x8'));module[_0x2175('0x9')]=function(_0x222868,_0x27ff0b){return _0x222868[_0x2175('0xa')](_0x2175('0xb'),attributes,{'tableName':_0x2175('0xc'),'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 9c7bb0c..2b9820a 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x6c258d,_0x1795f9){_0x6c258d=_0x6c258d-0x0;var _0x2c53f8=_0x7a54[_0x6c258d];return _0x2c53f8;};'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(_0x4662e1,_0x3c6c75){_0x4662e1=_0x4662e1-0x0;var _0xac77ca=_0x7a54[_0x4662e1];return _0xac77ca;};'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 e25e5f4..683ac99 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 _0xb10b=['show','/:id/dispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x161709,_0x3f9c90){var _0x33be6f=function(_0x2ffa89){while(--_0x2ffa89){_0x161709['push'](_0x161709['shift']());}};_0x33be6f(++_0x3f9c90);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a3cc7,_0x2900e3){_0x1a3cc7=_0x1a3cc7-0x0;var _0x338438=_0xb10b[_0x1a3cc7];return _0x338438;};'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')]('/describe',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['getDispositions']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getAnswers']);router[_0xbb10('0x9')]('/:id/applications',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('0x16')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x16')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x18')]);router['post'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);router[_0xbb10('0x16')](_0xbb10('0x1a'),controller[_0xbb10('0x1b')]);router[_0xbb10('0x16')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['post'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x16')](_0xbb10('0x1f'),auth[_0xbb10('0xb')](),controller['send']);router[_0xbb10('0x20')](_0xbb10('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xbb10('0x21')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x22')]);router[_0xbb10('0x21')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x23')]);router[_0xbb10('0x21')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xbb10('0x25')]);module[_0xbb10('0x26')]=router; \ No newline at end of file +var _0x7b84=['notify','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition'];(function(_0x378ae2,_0x564353){var _0x597f74=function(_0x2369b2){while(--_0x2369b2){_0x378ae2['push'](_0x378ae2['shift']());}};_0x597f74(++_0x564353);}(_0x7b84,0x17c));var _0x47b8=function(_0x115569,_0x99a003){_0x115569=_0x115569-0x0;var _0x392d72=_0x7b84[_0x115569];return _0x392d72;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0xa')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0xa')](_0x47b8('0x15'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);router[_0x47b8('0xa')](_0x47b8('0x17'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x18')]);router[_0x47b8('0xa')](_0x47b8('0x19'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1a')]);router['post']('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1b')]);router[_0x47b8('0x1c')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1d')]);router[_0x47b8('0x1c')]('/:id/canned_answers',auth[_0x47b8('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x47b8('0x1e')]);router[_0x47b8('0x1c')](_0x47b8('0x15'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x47b8('0x19'),auth['isAuthenticated'](),controller[_0x47b8('0x1f')]);router[_0x47b8('0x1c')](_0x47b8('0x20'),auth[_0x47b8('0xb')](),controller['send']);router[_0x47b8('0x21')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x22')]);router[_0x47b8('0x23')](_0x47b8('0xf'),auth['isAuthenticated'](),controller[_0x47b8('0x24')]);router[_0x47b8('0x23')]('/:id/dispositions',auth[_0x47b8('0xb')](),controller[_0x47b8('0x25')]);router[_0x47b8('0x23')](_0x47b8('0x13'),auth['isAuthenticated'](),controller[_0x47b8('0x26')]);router[_0x47b8('0x23')](_0x47b8('0x19'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x27')]);module[_0x47b8('0x28')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 45a7110..fd57501 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 _0xfb4b=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xfb4b,0x95));var _0xbfb4=function(_0x540d50,_0x329512){_0x540d50=_0x540d50-0x0;var _0x26ced3=_0xfb4b[_0x540d50];return _0x26ced3;};'use strict';var Sequelize=require(_0xbfb4('0x0'));var rs=require(_0xbfb4('0x1'));module['exports']={'name':{'type':Sequelize[_0xbfb4('0x2')],'unique':_0xbfb4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbfb4('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xbfb4('0x4')]();}},'replyUri':{'type':Sequelize[_0xbfb4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xbfb4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbfb4('0x5')],'defaultValue':function(){return _0xbfb4('0x6');}},'notificationSound':{'type':Sequelize[_0xbfb4('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbfb4('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbfb4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbfb4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xbfb4('0x2')]},'queueTransfer':{'type':Sequelize[_0xbfb4('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbfb4('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbfb4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbfb4('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xbfb4('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xbfb4('0x7')],'defaultValue':![],'comment':_0xbfb4('0xa'),'set':function(_0x5cee72){if(!_0x5cee72)this[_0xbfb4('0xb')]('mandatoryDispositionPauseId',null);this[_0xbfb4('0xb')]('mandatoryDisposition',_0x5cee72);}}}; \ No newline at end of file +var _0xad8c=['generate','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','mandatoryDisposition','randomstring','exports','STRING'];(function(_0x225ecc,_0x2deeb3){var _0x2ea166=function(_0x240d94){while(--_0x240d94){_0x225ecc['push'](_0x225ecc['shift']());}};_0x2ea166(++_0x2deeb3);}(_0xad8c,0xc3));var _0xcad8=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xad8c[_0x376db5];return _0x304c17;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcad8('0x0'));module[_0xcad8('0x1')]={'name':{'type':Sequelize[_0xcad8('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xcad8('0x2')]},'token':{'type':Sequelize[_0xcad8('0x2')],'defaultValue':function(){return rs[_0xcad8('0x3')]();}},'replyUri':{'type':Sequelize[_0xcad8('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xcad8('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xcad8('0x4');}},'notificationSound':{'type':Sequelize[_0xcad8('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcad8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcad8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xcad8('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcad8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcad8('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcad8('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xcad8('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcad8('0x8'),'set':function(_0x34fa96){if(!_0x34fa96)this[_0xcad8('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xcad8('0xa'),_0x34fa96);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 7fc66f3..ecdbc3a 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 _0x8c97=['bulkCreate','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','save','update','destroy','stack','name','send','index','Pause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','merge','filter','options','includeAll','include','findAll','show','find','create','body','user','get','OpenchannelAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','mandatoryDispositionPause','describe','OpenchannelAccountId','Disposition','findOne','nolimit','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','CmContact','Contacts','Applications','applications','list','orderBy','priority','asc','account','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','interaction','unshift','waitForTheAssignedAgent','queueId','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8c97,0x194));var _0x78c9=function(_0x2d6a06,_0x1cfb60){_0x2d6a06=_0x2d6a06-0x0;var _0x25edd2=_0x8c97[_0x2d6a06];return _0x25edd2;};'use strict';var emlformat=require(_0x78c9('0x0'));var rimraf=require(_0x78c9('0x1'));var zipdir=require(_0x78c9('0x2'));var jsonpatch=require(_0x78c9('0x3'));var rp=require('request-promise');var moment=require(_0x78c9('0x4'));var BPromise=require(_0x78c9('0x5'));var Mustache=require('mustache');var util=require(_0x78c9('0x6'));var path=require(_0x78c9('0x7'));var sox=require(_0x78c9('0x8'));var csv=require(_0x78c9('0x9'));var ejs=require(_0x78c9('0xa'));var fs=require('fs');var fs_extra=require(_0x78c9('0xb'));var _=require(_0x78c9('0xc'));var squel=require(_0x78c9('0xd'));var crypto=require(_0x78c9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x78c9('0xf'));var toCsv=require(_0x78c9('0x9'));var querystring=require(_0x78c9('0x10'));var Papa=require('papaparse');var Redis=require(_0x78c9('0x11'));var authService=require(_0x78c9('0x12'));var qs=require(_0x78c9('0x13'));var as=require(_0x78c9('0x14'));var hardwareService=require(_0x78c9('0x15'));var logger=require(_0x78c9('0x16'))(_0x78c9('0x17'));var utils=require('../../config/utils');var config=require(_0x78c9('0x18'));var licenseUtil=require(_0x78c9('0x19'));var db=require(_0x78c9('0x1a'))['db'];config['redis']=_[_0x78c9('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x78c9('0x1c'))(new Redis(config[_0x78c9('0x1d')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x78c9('0x1e'));var client=jayson[_0x78c9('0x1f')][_0x78c9('0x20')]({'port':0x232c});var client9002=jayson[_0x78c9('0x1f')][_0x78c9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2d440d,_0x5b6476,_0x26337c,_0x340a36){return new BPromise(function(_0x1ec89e,_0x452e26){var _0x41ad55=_0x340a36||client;return _0x41ad55[_0x78c9('0x21')](_0x2d440d,_0x26337c)[_0x78c9('0x22')](function(_0x5ccf0b){logger['info'](_0x78c9('0x23'),_0x5b6476,_0x78c9('0x24'));logger[_0x78c9('0x25')](_0x78c9('0x26'),_0x5b6476,_0x78c9('0x24'),JSON['stringify'](_0x5ccf0b));if(_0x5ccf0b['error']){if(_0x5ccf0b[_0x78c9('0x27')][_0x78c9('0x28')]===0x1f4){logger[_0x78c9('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x5b6476,_0x5ccf0b[_0x78c9('0x27')][_0x78c9('0x29')]);return _0x452e26(_0x5ccf0b[_0x78c9('0x27')][_0x78c9('0x29')]);}logger['error'](_0x78c9('0x23'),_0x5b6476,_0x5ccf0b[_0x78c9('0x27')][_0x78c9('0x29')]);return _0x1ec89e(_0x5ccf0b['error'][_0x78c9('0x29')]);}else{logger[_0x78c9('0x2a')](_0x78c9('0x23'),_0x5b6476,'request\x20sent');_0x1ec89e(_0x5ccf0b[_0x78c9('0x2b')]['message']);}})[_0x78c9('0x2c')](function(_0x4ffae8){logger[_0x78c9('0x27')](_0x78c9('0x23'),_0x5b6476,_0x4ffae8);_0x452e26(_0x4ffae8);});});}function respondWithStatusCode(_0x57b2d5,_0x58036f){_0x58036f=_0x58036f||0xcc;return function(_0x31b38b){if(_0x31b38b){return _0x57b2d5[_0x78c9('0x2d')](_0x58036f);}return _0x57b2d5[_0x78c9('0x2e')](_0x58036f)[_0x78c9('0x2f')]();};}function respondWithResult(_0x15043c,_0x344785){_0x344785=_0x344785||0xc8;return function(_0x4d3cf6){if(_0x4d3cf6){return _0x15043c[_0x78c9('0x2e')](_0x344785)[_0x78c9('0x30')](_0x4d3cf6);}};}function respondWithFilteredResult(_0x949c5d,_0x125a3b){return function(_0x1298db){if(_0x1298db){var _0x500b0c=typeof _0x125a3b[_0x78c9('0x31')]===_0x78c9('0x32')&&typeof _0x125a3b['limit']==='undefined';var _0x82fd8f=_0x1298db['count'];var _0x3ab44c=_0x500b0c?0x0:_0x125a3b[_0x78c9('0x31')];var _0x41256c=_0x500b0c?_0x1298db[_0x78c9('0x33')]:_0x125a3b[_0x78c9('0x31')]+_0x125a3b[_0x78c9('0x34')];var _0x2f72d8;if(_0x41256c>=_0x82fd8f){_0x41256c=_0x82fd8f;_0x2f72d8=0xc8;}else{_0x2f72d8=0xce;}_0x949c5d[_0x78c9('0x2e')](_0x2f72d8);return _0x949c5d[_0x78c9('0x35')]('Content-Range',_0x3ab44c+'-'+_0x41256c+'/'+_0x82fd8f)['json'](_0x1298db);}return null;};}function patchUpdates(_0x592197){return function(_0x2cf801){try{jsonpatch['apply'](_0x2cf801,_0x592197,!![]);}catch(_0x1be530){return BPromise['reject'](_0x1be530);}return _0x2cf801[_0x78c9('0x36')]();};}function saveUpdates(_0x79b81e,_0x1d7895){return function(_0x5adaa4){if(_0x5adaa4){return _0x5adaa4[_0x78c9('0x37')](_0x79b81e)[_0x78c9('0x22')](function(_0x5f24d7){return _0x5f24d7;});}return null;};}function removeEntity(_0x151d97,_0x25b48f){return function(_0x14d160){if(_0x14d160){return _0x14d160[_0x78c9('0x38')]()[_0x78c9('0x22')](function(){var _0x13f201=_0x14d160['get']({'plain':!![]});var _0x5e6ed1='OpenchannelAccounts';return db['UserProfileResource'][_0x78c9('0x38')]({'where':{'type':_0x5e6ed1,'resourceId':_0x13f201['id']}})['then'](function(){return _0x14d160;});})[_0x78c9('0x22')](function(){_0x151d97[_0x78c9('0x2e')](0xcc)[_0x78c9('0x2f')]();});}};}function handleEntityNotFound(_0x3c64f6,_0x23299a){return function(_0x5072fe){if(!_0x5072fe){_0x3c64f6[_0x78c9('0x2d')](0x194);}return _0x5072fe;};}function handleError(_0x1f90b2,_0x4229e9){_0x4229e9=_0x4229e9||0x1f4;return function(_0x382b20){logger[_0x78c9('0x27')](_0x382b20[_0x78c9('0x39')]);if(_0x382b20['name']){delete _0x382b20[_0x78c9('0x3a')];}_0x1f90b2[_0x78c9('0x2e')](_0x4229e9)[_0x78c9('0x3b')](_0x382b20);};}exports[_0x78c9('0x3c')]=function(_0x4d18f8,_0x2f1e33){var _0x57464a={'include':[{'model':db[_0x78c9('0x3d')],'as':'mandatoryDispositionPause'}]},_0x125c1f={},_0xfc4b54={'count':0x0,'rows':[]};var _0xd6deaa=_['map'](db[_0x78c9('0x3e')][_0x78c9('0x3f')],function(_0x52254e){return{'name':_0x52254e[_0x78c9('0x40')],'type':_0x52254e[_0x78c9('0x41')][_0x78c9('0x42')]};});_0x125c1f[_0x78c9('0x43')]=_[_0x78c9('0x44')](_0xd6deaa,_0x78c9('0x3a'));_0x125c1f[_0x78c9('0x45')]=_[_0x78c9('0x46')](_0x4d18f8[_0x78c9('0x45')]);_0x125c1f['filters']=_[_0x78c9('0x47')](_0x125c1f[_0x78c9('0x43')],_0x125c1f[_0x78c9('0x45')]);_0x57464a[_0x78c9('0x48')]=_[_0x78c9('0x47')](_0x125c1f[_0x78c9('0x43')],qs[_0x78c9('0x49')](_0x4d18f8[_0x78c9('0x45')][_0x78c9('0x49')]));_0x57464a['attributes']=_0x57464a[_0x78c9('0x48')][_0x78c9('0x4a')]?_0x57464a['attributes']:_0x125c1f[_0x78c9('0x43')];if(!_0x4d18f8[_0x78c9('0x45')][_0x78c9('0x4b')]('nolimit')){_0x57464a['limit']=qs[_0x78c9('0x34')](_0x4d18f8[_0x78c9('0x45')]['limit']);_0x57464a[_0x78c9('0x31')]=qs[_0x78c9('0x31')](_0x4d18f8[_0x78c9('0x45')][_0x78c9('0x31')]);}_0x57464a['order']=qs[_0x78c9('0x4c')](_0x4d18f8[_0x78c9('0x45')][_0x78c9('0x4c')]);_0x57464a[_0x78c9('0x4d')]=qs[_0x78c9('0x4e')](_['pick'](_0x4d18f8[_0x78c9('0x45')],_0x125c1f['filters']),_0xd6deaa);if(_0x4d18f8[_0x78c9('0x45')]['filter']){_0x57464a['where']=_[_0x78c9('0x4f')](_0x57464a[_0x78c9('0x4d')],{'$or':_[_0x78c9('0x44')](_0xd6deaa,function(_0x182e70){if(_0x182e70[_0x78c9('0x41')]!=='VIRTUAL'){var _0x5c59d7={};_0x5c59d7[_0x182e70[_0x78c9('0x3a')]]={'$like':'%'+_0x4d18f8['query'][_0x78c9('0x50')]+'%'};return _0x5c59d7;}})});}_0x57464a=_[_0x78c9('0x4f')]({},_0x57464a,_0x4d18f8[_0x78c9('0x51')]);var _0x307405={'where':_0x57464a[_0x78c9('0x4d')]};return db['OpenchannelAccount'][_0x78c9('0x33')](_0x307405)[_0x78c9('0x22')](function(_0x3f22c3){_0xfc4b54[_0x78c9('0x33')]=_0x3f22c3;if(_0x4d18f8[_0x78c9('0x45')][_0x78c9('0x52')]){_0x57464a[_0x78c9('0x53')]=[{'all':!![]}];}return db[_0x78c9('0x3e')][_0x78c9('0x54')](_0x57464a);})[_0x78c9('0x22')](function(_0x2a46ff){_0xfc4b54['rows']=_0x2a46ff;return _0xfc4b54;})[_0x78c9('0x22')](respondWithFilteredResult(_0x2f1e33,_0x57464a))[_0x78c9('0x2c')](handleError(_0x2f1e33,null));};exports[_0x78c9('0x55')]=function(_0x59b8ac,_0x3c89e2){var _0x164949={'raw':![],'where':{'id':_0x59b8ac['params']['id']},'include':[{'model':db[_0x78c9('0x3d')],'as':'mandatoryDispositionPause'}]},_0xe1e5d3={};_0xe1e5d3[_0x78c9('0x43')]=_[_0x78c9('0x46')](db['OpenchannelAccount'][_0x78c9('0x3f')]);_0xe1e5d3['query']=_[_0x78c9('0x46')](_0x59b8ac[_0x78c9('0x45')]);_0xe1e5d3[_0x78c9('0x4e')]=_[_0x78c9('0x47')](_0xe1e5d3[_0x78c9('0x43')],_0xe1e5d3[_0x78c9('0x45')]);_0x164949[_0x78c9('0x48')]=_[_0x78c9('0x47')](_0xe1e5d3['model'],qs[_0x78c9('0x49')](_0x59b8ac[_0x78c9('0x45')]['fields']));_0x164949['attributes']=_0x164949[_0x78c9('0x48')][_0x78c9('0x4a')]?_0x164949['attributes']:_0xe1e5d3[_0x78c9('0x43')];if(_0x59b8ac['query']['includeAll']){_0x164949[_0x78c9('0x53')]=[{'all':!![]}];}_0x164949=_['merge']({},_0x164949,_0x59b8ac[_0x78c9('0x51')]);return db[_0x78c9('0x3e')][_0x78c9('0x56')](_0x164949)[_0x78c9('0x22')](handleEntityNotFound(_0x3c89e2,null))[_0x78c9('0x22')](respondWithResult(_0x3c89e2,null))[_0x78c9('0x2c')](handleError(_0x3c89e2,null));};exports[_0x78c9('0x57')]=function(_0x5fddd0,_0x7cbf73){return db[_0x78c9('0x3e')][_0x78c9('0x57')](_0x5fddd0[_0x78c9('0x58')],{})['then'](function(_0x1a2524){var _0x4bcc81=_0x5fddd0[_0x78c9('0x59')][_0x78c9('0x5a')]({'plain':!![]});if(!_0x4bcc81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bcc81['role']==='user'){var _0x5e5312=_0x1a2524[_0x78c9('0x5a')]({'plain':!![]});var _0x4dc0be=_0x78c9('0x5b');return db['UserProfileSection'][_0x78c9('0x56')]({'where':{'name':_0x4dc0be,'userProfileId':_0x4bcc81[_0x78c9('0x5c')]},'raw':!![]})['then'](function(_0x354d06){if(_0x354d06&&_0x354d06[_0x78c9('0x5d')]===0x0){return db[_0x78c9('0x5e')][_0x78c9('0x57')]({'name':_0x5e5312[_0x78c9('0x3a')],'resourceId':_0x5e5312['id'],'type':_0x354d06[_0x78c9('0x3a')],'sectionId':_0x354d06['id']},{})[_0x78c9('0x22')](function(){return _0x1a2524;});}else{return _0x1a2524;}})['catch'](function(_0x798570){logger[_0x78c9('0x27')](_0x78c9('0x5f'),_0x798570);throw _0x798570;});}return _0x1a2524;})[_0x78c9('0x22')](respondWithResult(_0x7cbf73,0xc9))[_0x78c9('0x2c')](handleError(_0x7cbf73,null));};exports[_0x78c9('0x37')]=function(_0x4457f0,_0x5af310){if(_0x4457f0[_0x78c9('0x58')]['id']){delete _0x4457f0['body']['id'];}return db[_0x78c9('0x3e')][_0x78c9('0x56')]({'where':{'id':_0x4457f0[_0x78c9('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0x78c9('0x61')}]})['then'](handleEntityNotFound(_0x5af310,null))['then'](saveUpdates(_0x4457f0[_0x78c9('0x58')],null))['then'](respondWithResult(_0x5af310,null))['catch'](handleError(_0x5af310,null));};exports[_0x78c9('0x38')]=function(_0x3672d7,_0x3dac52){return db['OpenchannelAccount'][_0x78c9('0x56')]({'where':{'id':_0x3672d7[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x3dac52,null))[_0x78c9('0x22')](removeEntity(_0x3dac52,null))[_0x78c9('0x2c')](handleError(_0x3dac52,null));};exports[_0x78c9('0x62')]=function(_0x244b3e,_0x228fcc){return db['OpenchannelAccount']['describe']()[_0x78c9('0x22')](respondWithResult(_0x228fcc,null))[_0x78c9('0x2c')](handleError(_0x228fcc,null));};exports['addDisposition']=function(_0x3c1fd0,_0x5dc1f6,_0x18c6e6){if(_0x3c1fd0[_0x78c9('0x58')]['id']){delete _0x3c1fd0[_0x78c9('0x58')]['id'];}return db['OpenchannelAccount'][_0x78c9('0x56')]({'where':{'id':_0x3c1fd0[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x5dc1f6,null))['then'](function(_0x3248ec){if(_0x3248ec){_0x3c1fd0['body'][_0x78c9('0x63')]=_0x3248ec['id'];return db[_0x78c9('0x64')][_0x78c9('0x57')](_0x3c1fd0[_0x78c9('0x58')]);}})[_0x78c9('0x22')](respondWithResult(_0x5dc1f6,null))['catch'](handleError(_0x5dc1f6,null));};exports['getDispositions']=function(_0x4e39ed,_0x9975de,_0x2eb568){var _0x3ef1bc={'raw':![],'where':{}};var _0x499206={};var _0x509a02={'count':0x0,'rows':[]};return db[_0x78c9('0x3e')][_0x78c9('0x65')]({'where':{'id':_0x4e39ed[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x9975de,null))[_0x78c9('0x22')](function(_0x404a22){if(_0x404a22){_0x499206[_0x78c9('0x43')]=_[_0x78c9('0x46')](db['Disposition']['rawAttributes']);_0x499206[_0x78c9('0x45')]=_[_0x78c9('0x46')](_0x4e39ed[_0x78c9('0x45')]);_0x499206[_0x78c9('0x4e')]=_['intersection'](_0x499206[_0x78c9('0x43')],_0x499206[_0x78c9('0x45')]);_0x3ef1bc[_0x78c9('0x48')]=_[_0x78c9('0x47')](_0x499206[_0x78c9('0x43')],qs[_0x78c9('0x49')](_0x4e39ed['query'][_0x78c9('0x49')]));_0x3ef1bc[_0x78c9('0x48')]=_0x3ef1bc[_0x78c9('0x48')]['length']?_0x3ef1bc[_0x78c9('0x48')]:_0x499206[_0x78c9('0x43')];if(!_0x4e39ed[_0x78c9('0x45')][_0x78c9('0x4b')](_0x78c9('0x66'))){_0x3ef1bc['limit']=qs['limit'](_0x4e39ed['query'][_0x78c9('0x34')]);_0x3ef1bc[_0x78c9('0x31')]=qs[_0x78c9('0x31')](_0x4e39ed[_0x78c9('0x45')][_0x78c9('0x31')]);}_0x3ef1bc[_0x78c9('0x67')]=qs[_0x78c9('0x4c')](_0x4e39ed['query'][_0x78c9('0x4c')]);_0x3ef1bc[_0x78c9('0x4d')]=qs[_0x78c9('0x4e')](_[_0x78c9('0x68')](_0x4e39ed[_0x78c9('0x45')],_0x499206['filters']));_0x3ef1bc['where'][_0x78c9('0x63')]=_0x404a22['id'];if(_0x4e39ed[_0x78c9('0x45')]['filter']){_0x3ef1bc[_0x78c9('0x4d')]=_[_0x78c9('0x4f')](_0x3ef1bc[_0x78c9('0x4d')],{'$or':_[_0x78c9('0x44')](_0x3ef1bc['attributes'],function(_0x4d8b8f){var _0x138c00={};_0x138c00[_0x4d8b8f]={'$like':'%'+_0x4e39ed[_0x78c9('0x45')][_0x78c9('0x50')]+'%'};return _0x138c00;})});}_0x3ef1bc=_['merge']({},_0x3ef1bc,_0x4e39ed['options']);return db['Disposition']['count']({'where':_0x3ef1bc[_0x78c9('0x4d')]})['then'](function(_0x43b938){_0x509a02[_0x78c9('0x33')]=_0x43b938;if(_0x4e39ed[_0x78c9('0x45')][_0x78c9('0x52')]){_0x3ef1bc['include']=[{'all':!![]}];}return db[_0x78c9('0x64')][_0x78c9('0x54')](_0x3ef1bc);})[_0x78c9('0x22')](function(_0x20cfd7){_0x509a02[_0x78c9('0x69')]=_0x20cfd7;return _0x509a02;});}})[_0x78c9('0x22')](respondWithFilteredResult(_0x9975de,_0x3ef1bc))['catch'](handleError(_0x9975de,null));};exports[_0x78c9('0x6a')]=function(_0x2dbdb2,_0x51879a,_0x31c014){return db[_0x78c9('0x3e')][_0x78c9('0x56')]({'where':{'id':_0x2dbdb2['params']['id']}})['then'](handleEntityNotFound(_0x51879a,null))[_0x78c9('0x22')](function(_0x3023a7){if(_0x3023a7){return _0x3023a7[_0x78c9('0x6a')](_0x2dbdb2['query'][_0x78c9('0x6b')]);}})[_0x78c9('0x22')](respondWithStatusCode(_0x51879a,null))[_0x78c9('0x2c')](handleError(_0x51879a,null));};exports[_0x78c9('0x6c')]=function(_0x370df0,_0xd3148d,_0x39b63a){if(_0x370df0[_0x78c9('0x58')]['id']){delete _0x370df0[_0x78c9('0x58')]['id'];}return db[_0x78c9('0x3e')][_0x78c9('0x56')]({'where':{'id':_0x370df0['params']['id']}})['then'](handleEntityNotFound(_0xd3148d,null))[_0x78c9('0x22')](function(_0xa712f9){if(_0xa712f9){_0x370df0[_0x78c9('0x58')][_0x78c9('0x63')]=_0xa712f9['id'];return db['CannedAnswer'][_0x78c9('0x57')](_0x370df0[_0x78c9('0x58')]);}})[_0x78c9('0x22')](respondWithResult(_0xd3148d,null))['catch'](handleError(_0xd3148d,null));};exports['getAnswers']=function(_0x5eafee,_0x3f9514,_0xd2fcad){var _0x25228a={'raw':![],'where':{}};var _0x3a4d5d={};var _0x371571={'count':0x0,'rows':[]};return db[_0x78c9('0x3e')][_0x78c9('0x65')]({'where':{'id':_0x5eafee['params']['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x3f9514,null))[_0x78c9('0x22')](function(_0x4f60d7){if(_0x4f60d7){_0x3a4d5d[_0x78c9('0x43')]=_['keys'](db[_0x78c9('0x6d')][_0x78c9('0x3f')]);_0x3a4d5d[_0x78c9('0x45')]=_[_0x78c9('0x46')](_0x5eafee[_0x78c9('0x45')]);_0x3a4d5d[_0x78c9('0x4e')]=_[_0x78c9('0x47')](_0x3a4d5d[_0x78c9('0x43')],_0x3a4d5d[_0x78c9('0x45')]);_0x25228a[_0x78c9('0x48')]=_['intersection'](_0x3a4d5d[_0x78c9('0x43')],qs['fields'](_0x5eafee[_0x78c9('0x45')]['fields']));_0x25228a['attributes']=_0x25228a[_0x78c9('0x48')][_0x78c9('0x4a')]?_0x25228a[_0x78c9('0x48')]:_0x3a4d5d[_0x78c9('0x43')];if(!_0x5eafee['query']['hasOwnProperty'](_0x78c9('0x66'))){_0x25228a[_0x78c9('0x34')]=qs[_0x78c9('0x34')](_0x5eafee['query'][_0x78c9('0x34')]);_0x25228a[_0x78c9('0x31')]=qs[_0x78c9('0x31')](_0x5eafee['query']['offset']);}_0x25228a['order']=qs[_0x78c9('0x4c')](_0x5eafee[_0x78c9('0x45')][_0x78c9('0x4c')]);_0x25228a['where']=qs[_0x78c9('0x4e')](_[_0x78c9('0x68')](_0x5eafee[_0x78c9('0x45')],_0x3a4d5d[_0x78c9('0x4e')]));_0x25228a[_0x78c9('0x4d')][_0x78c9('0x63')]=_0x4f60d7['id'];if(_0x5eafee['query'][_0x78c9('0x50')]){_0x25228a[_0x78c9('0x4d')]=_['merge'](_0x25228a[_0x78c9('0x4d')],{'$or':_[_0x78c9('0x44')](_0x25228a['attributes'],function(_0x8d99b){var _0x110e37={};_0x110e37[_0x8d99b]={'$like':'%'+_0x5eafee[_0x78c9('0x45')][_0x78c9('0x50')]+'%'};return _0x110e37;})});}_0x25228a=_[_0x78c9('0x4f')]({},_0x25228a,_0x5eafee[_0x78c9('0x51')]);return db[_0x78c9('0x6d')][_0x78c9('0x33')]({'where':_0x25228a[_0x78c9('0x4d')]})['then'](function(_0x2bb794){_0x371571[_0x78c9('0x33')]=_0x2bb794;if(_0x5eafee[_0x78c9('0x45')][_0x78c9('0x52')]){_0x25228a[_0x78c9('0x53')]=[{'all':!![]}];}return db[_0x78c9('0x6d')]['findAll'](_0x25228a);})[_0x78c9('0x22')](function(_0x136885){_0x371571[_0x78c9('0x69')]=_0x136885;return _0x371571;});}})['then'](respondWithFilteredResult(_0x3f9514,_0x25228a))[_0x78c9('0x2c')](handleError(_0x3f9514,null));};exports['removeAnswers']=function(_0x2ec38e,_0x4649d7,_0x282d3b){return db[_0x78c9('0x3e')]['find']({'where':{'id':_0x2ec38e['params']['id']}})['then'](handleEntityNotFound(_0x4649d7,null))[_0x78c9('0x22')](function(_0x3d9dda){if(_0x3d9dda){return _0x3d9dda['removeAnswers'](_0x2ec38e['query'][_0x78c9('0x6b')]);}})[_0x78c9('0x22')](respondWithStatusCode(_0x4649d7,null))[_0x78c9('0x2c')](handleError(_0x4649d7,null));};exports[_0x78c9('0x6e')]=function(_0x448fab,_0x4997ac,_0x4abece){var _0x54b09d={'body':_0x448fab[_0x78c9('0x58')],'channel':_0x78c9('0x6f')};var _0xef760c=[];var _0x114934=[];var _0x4d5779={};var _0x31bcb5=![];return db['CmContact'][_0x78c9('0x62')]()[_0x78c9('0x22')](function(_0x4f104c){if(!_0x4f104c){throw new db[(_0x78c9('0x70'))][(_0x78c9('0x71'))](_0x78c9('0x72'));}_0xef760c=_[_0x78c9('0x73')](_[_0x78c9('0x46')](_0x4f104c),[_0x78c9('0x74'),_0x78c9('0x75')]);_0x114934=_[_0x78c9('0x73')](_['keys'](_0x4f104c),[_0x78c9('0x74'),_0x78c9('0x75'),_0x78c9('0x76'),_0x78c9('0x77')]);if(_0x448fab[_0x78c9('0x58')]['id']){delete _0x448fab[_0x78c9('0x58')]['id'];}if(_[_0x78c9('0x78')](_0x448fab['body'][_0x78c9('0x79')])){throw new db[(_0x78c9('0x70'))][(_0x78c9('0x71'))](_0x78c9('0x7a'));}if(_[_0x78c9('0x78')](_0x448fab['body'][_0x78c9('0x58')])||_0x448fab[_0x78c9('0x58')][_0x78c9('0x58')]===''){throw new db['Sequelize'][(_0x78c9('0x71'))](_0x78c9('0x7b'));}if(_[_0x78c9('0x78')](_0x448fab[_0x78c9('0x58')][_0x78c9('0x7c')])){throw new db[(_0x78c9('0x70'))]['ValidationError'](_0x78c9('0x7d')+_0x114934);}if(!_[_0x78c9('0x7e')](_0x114934,_0x448fab['body'][_0x78c9('0x7c')])){throw new db['Sequelize'][(_0x78c9('0x71'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x114934);}_0x4d5779[_0x448fab[_0x78c9('0x58')][_0x78c9('0x7c')]]=_0x448fab['body']['from'];})[_0x78c9('0x22')](function(){return db[_0x78c9('0x3e')]['find']({'where':{'id':_0x448fab[_0x78c9('0x60')]['id']},'include':[{'model':db[_0x78c9('0x7f')],'as':_0x78c9('0x80'),'include':[{'model':db[_0x78c9('0x81')],'as':_0x78c9('0x82'),'where':_0x4d5779,'limit':0x1,'order':[[_0x78c9('0x75'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x78c9('0x83')}]});})[_0x78c9('0x22')](handleEntityNotFound(_0x4997ac,null))[_0x78c9('0x22')](function(_0x85f10){if(_0x85f10&&_0x85f10['List']){_0x54b09d['account']=_0x85f10;_0x54b09d[_0x78c9('0x84')]=_0x85f10['Applications'];_0x54b09d[_0x78c9('0x85')]=_0x85f10[_0x78c9('0x80')];_0x54b09d[_0x78c9('0x84')]=_[_0x78c9('0x86')](_0x54b09d[_0x78c9('0x84')],[_0x78c9('0x87')],[_0x78c9('0x88')]);if(_0x54b09d[_0x78c9('0x89')]['Applications']){delete _0x54b09d[_0x78c9('0x89')]['Applications'];}if(_0x54b09d[_0x78c9('0x89')][_0x78c9('0x80')]&&_0x54b09d[_0x78c9('0x89')][_0x78c9('0x80')]['Contacts'][_0x78c9('0x4a')]){return _0x54b09d[_0x78c9('0x89')][_0x78c9('0x80')][_0x78c9('0x82')][0x0];}var _0x41d788=_['defaults'](_0x448fab[_0x78c9('0x58')],{'firstName':_0x448fab[_0x78c9('0x58')][_0x78c9('0x79')],'ListId':_0x85f10[_0x78c9('0x77')]});_0x41d788[_0x448fab[_0x78c9('0x58')]['mapKey']]=_0x448fab['body'][_0x78c9('0x79')];return db[_0x78c9('0x81')][_0x78c9('0x57')](_0x41d788,{'fields':_0xef760c,'raw':!![]});}})[_0x78c9('0x22')](handleEntityNotFound(_0x4997ac,null))[_0x78c9('0x22')](function(_0x285963){_0x54b09d['contact']=_0x285963;if(_0x285963){var _0x521b2f={'ContactId':_0x285963['id'],'OpenchannelAccountId':_0x448fab[_0x78c9('0x60')]['id'],'from':(_0x285963[_0x78c9('0x8a')]||'')+'\x20'+(_0x285963['lastName']||'')};var _0x558d0e={'OpenchannelAccountId':_0x448fab[_0x78c9('0x60')]['id'],'closed':![]};if(_0x448fab[_0x78c9('0x58')][_0x78c9('0x8b')]){_0x558d0e[_0x78c9('0x8b')]=_0x448fab[_0x78c9('0x58')]['threadId'];return db[_0x78c9('0x8c')]['find']({'where':_0x558d0e})[_0x78c9('0x22')](function(_0x1b6386){if(_0x1b6386){return[_0x1b6386,![]];}_0x521b2f[_0x78c9('0x8b')]=_0x448fab['body'][_0x78c9('0x8b')];_0x521b2f['externalUrl']=_0x448fab[_0x78c9('0x58')][_0x78c9('0x8d')];return db['OpenchannelInteraction'][_0x78c9('0x57')](_0x521b2f)[_0x78c9('0x22')](function(_0x405a8f){return[_0x405a8f,!![]];});});}else{_0x558d0e[_0x78c9('0x8b')]=null;}_0x558d0e[_0x78c9('0x8e')]=_0x285963['id'];return db['OpenchannelInteraction'][_0x78c9('0x56')]({'where':_0x558d0e})['then'](function(_0x1ae2fa){if(_0x1ae2fa){return[_0x1ae2fa,![]];}return db[_0x78c9('0x8c')]['create'](_0x521b2f)[_0x78c9('0x22')](function(_0x5690da){return[_0x5690da,!![]];});});}})[_0x78c9('0x8f')](function(_0x2ba204,_0xfb1b1b){if(_0x2ba204){_0x31bcb5=_0xfb1b1b;if(!_0xfb1b1b){var _0x4e8e22={'from':(_0x54b09d[_0x78c9('0x90')][_0x78c9('0x8a')]||'')+'\x20'+(_0x54b09d[_0x78c9('0x90')][_0x78c9('0x91')]||'')};if(_0x448fab[_0x78c9('0x58')][_0x78c9('0x8b')]&&_0x448fab[_0x78c9('0x58')][_0x78c9('0x92')]&&_0x448fab[_0x78c9('0x58')][_0x78c9('0x8b')]!=_0x448fab[_0x78c9('0x58')][_0x78c9('0x92')]){_0x4e8e22[_0x78c9('0x8b')]=_0x448fab['body'][_0x78c9('0x92')];}return _0x2ba204[_0x78c9('0x37')](_0x4e8e22);}else{return _0x2ba204;}}})[_0x78c9('0x22')](function(_0x3c702b){_0x54b09d['interaction']=_0x3c702b[_0x78c9('0x5a')]({'plain':!![]});_0x54b09d['interaction'][_0x78c9('0x93')]=_0x31bcb5;if(_0x54b09d['interaction'][_0x78c9('0x93')]){if(_0x54b09d[_0x78c9('0x89')][_0x78c9('0x94')]){_0x54b09d['applications'][_0x78c9('0x95')]({'id':0x0,'priority':_0x54b09d[_0x78c9('0x84')]['length']+0x1,'app':_0x78c9('0x96'),'appdata':_0x78c9('0x97'),'interval':_0x78c9('0x98')});}}return db[_0x78c9('0x99')][_0x78c9('0x57')]({'body':_0x448fab[_0x78c9('0x58')][_0x78c9('0x58')],'OpenchannelAccountId':_0x448fab[_0x78c9('0x60')]['id'],'OpenchannelInteractionId':_0x3c702b['id'],'direction':'in','ContactId':_0x54b09d[_0x78c9('0x90')]['id'],'AttachmentId':_0x448fab[_0x78c9('0x58')][_0x78c9('0x9a')]});})[_0x78c9('0x22')](function(_0x395c20){_0x54b09d[_0x78c9('0x29')]=_0x395c20;if(!_0x54b09d['interaction'][_0x78c9('0x9b')])return;return db[_0x78c9('0x9c')][_0x78c9('0x56')]({'attributes':['id',_0x78c9('0x3a')],'where':{'id':_0x54b09d[_0x78c9('0x9d')]['UserId']}});})[_0x78c9('0x22')](function(_0x5aa63d){if(_0x5aa63d){_0x54b09d[_0x78c9('0x84')][_0x78c9('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5aa63d[_0x78c9('0x3a')]+','+(_0x54b09d['account'][_0x78c9('0x9f')]||0xa),'interval':'*,*,*,*'});}if(!_0x54b09d[_0x78c9('0x9d')]['queueId'])return;return db['OpenchannelQueue'][_0x78c9('0x56')]({'attributes':['id',_0x78c9('0x3a')],'where':{'id':_0x54b09d[_0x78c9('0x9d')][_0x78c9('0xa0')]}});})[_0x78c9('0x22')](function(_0x29820f){if(_0x29820f){_0x54b09d[_0x78c9('0x84')][_0x78c9('0x9e')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x29820f[_0x78c9('0x3a')]+','+(_0x54b09d[_0x78c9('0x89')][_0x78c9('0xa1')]||0x12c),'interval':_0x78c9('0x98')});}return respondWithRpcPromise(_0x78c9('0xa2'),_0x78c9('0xa3'),_0x54b09d);})[_0x78c9('0x22')](function(_0x5a081b){respondWithRpcPromise(_0x78c9('0xa4'),_0x78c9('0xa4'),{'event':_0x78c9('0x6e'),'message':_0x5a081b},client9002);return _0x5a081b;})['then'](respondWithResult(_0x4997ac,null))[_0x78c9('0x2c')](handleError(_0x4997ac,null));};exports[_0x78c9('0xa5')]=function(_0x164fde,_0x1d1cee){var _0x2fb650=_0x164fde['params']['id'];var _0x5133bb=_0x164fde['body'];var _0x165bb8=0xc8;var _0x5e3ed1=null;return db[_0x78c9('0xa6')][_0x78c9('0xa7')]({'isolationLevel':db[_0x78c9('0xa6')][_0x78c9('0xa8')][_0x78c9('0xa9')][_0x78c9('0xaa')]},function(_0x1abeb0){return db['OpenchannelAccount'][_0x78c9('0x65')]({'where':{'id':_0x2fb650},'transaction':_0x1abeb0})[_0x78c9('0x22')](function(_0x466b9e){if(_0x466b9e){return db['OpenchannelApplication'][_0x78c9('0x38')]({'where':{'OpenchannelAccountId':_0x2fb650},'transaction':_0x1abeb0})[_0x78c9('0x22')](function(){var _0x4acd60=_['map'](_0x5133bb,function(_0x1afc01){_0x1afc01[_0x78c9('0x63')]=_0x2fb650;return _0x1afc01;});return db[_0x78c9('0xab')][_0x78c9('0xac')](_0x4acd60,{'transaction':_0x1abeb0});});}else{_0x165bb8=0x194;_0x5e3ed1=[];}});})['then'](function(){if(_0x165bb8!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2fb650},'order':'priority'})[_0x78c9('0x22')](function(_0x5177ef){_0x5e3ed1=_0x5177ef;});}})[_0x78c9('0x2c')](function(_0x582265){_0x165bb8=0x1f4;logger[_0x78c9('0x27')](_0x582265['stack']);if(_0x582265[_0x78c9('0x3a')]){delete _0x582265[_0x78c9('0x3a')];}_0x5e3ed1=_0x582265;})['finally'](function(){if(_0x5e3ed1===null){_0x1d1cee[_0x78c9('0x2d')](_0x165bb8);}else{if(_0x165bb8===0x1f4){_0x1d1cee['status'](_0x165bb8)[_0x78c9('0x3b')](_0x5e3ed1);}else{_0x1d1cee[_0x78c9('0x2e')](_0x165bb8)[_0x78c9('0x30')](_0x5e3ed1);}}});};exports[_0x78c9('0xad')]=function(_0x23b2eb,_0x1e04c1,_0xaaf7fe){var _0x5f4947={};var _0x32d007={};var _0x4c5635;var _0x22781a;return db[_0x78c9('0x3e')]['findOne']({'where':{'id':_0x23b2eb['params']['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x1e04c1,null))['then'](function(_0x27380a){if(_0x27380a){_0x4c5635=_0x27380a;_0x32d007[_0x78c9('0x43')]=_[_0x78c9('0x46')](db[_0x78c9('0xab')][_0x78c9('0x3f')]);_0x32d007['query']=_[_0x78c9('0x46')](_0x23b2eb[_0x78c9('0x45')]);_0x32d007[_0x78c9('0x4e')]=_['intersection'](_0x32d007[_0x78c9('0x43')],_0x32d007[_0x78c9('0x45')]);_0x5f4947['attributes']=_[_0x78c9('0x47')](_0x32d007[_0x78c9('0x43')],qs['fields'](_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x49')]));_0x5f4947[_0x78c9('0x48')]=_0x5f4947[_0x78c9('0x48')]['length']?_0x5f4947[_0x78c9('0x48')]:_0x32d007['model'];_0x5f4947['order']=qs[_0x78c9('0x4c')](_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x4c')]);_0x5f4947[_0x78c9('0x4d')]=qs[_0x78c9('0x4e')](_[_0x78c9('0x68')](_0x23b2eb[_0x78c9('0x45')],_0x32d007['filters']));if(_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x50')]){_0x5f4947[_0x78c9('0x4d')]=_[_0x78c9('0x4f')](_0x5f4947[_0x78c9('0x4d')],{'$or':_['map'](_0x5f4947[_0x78c9('0x48')],function(_0x6d7f04){var _0xe5a0ed={};_0xe5a0ed[_0x6d7f04]={'$like':'%'+_0x23b2eb['query'][_0x78c9('0x50')]+'%'};return _0xe5a0ed;})});}_0x5f4947=_['merge']({},_0x5f4947,_0x23b2eb['options']);return _0x4c5635['getApplications'](_0x5f4947);}})[_0x78c9('0x22')](function(_0xf9800){if(_0xf9800){_0x22781a=_0xf9800[_0x78c9('0x4a')];if(!_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x4b')](_0x78c9('0x66'))){_0x5f4947['limit']=qs[_0x78c9('0x34')](_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x34')]);_0x5f4947[_0x78c9('0x31')]=qs[_0x78c9('0x31')](_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x31')]);}return _0x4c5635[_0x78c9('0xad')](_0x5f4947);}})[_0x78c9('0x22')](function(_0x407dc3){if(_0x407dc3){return _0x407dc3?{'count':_0x22781a,'rows':_0x407dc3}:null;}})[_0x78c9('0x22')](respondWithResult(_0x1e04c1,null))[_0x78c9('0x2c')](handleError(_0x1e04c1,null));};exports[_0x78c9('0xae')]=function(_0xd31ed2,_0x4ec637,_0x3e2f7c){var _0x3b57c5={'raw':![],'where':{}};var _0x1f8dc1={};var _0x5a72c8={'count':0x0,'rows':[]};return db[_0x78c9('0x3e')][_0x78c9('0x65')]({'where':{'id':_0xd31ed2[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x4ec637,null))[_0x78c9('0x22')](function(_0x4d5e54){if(_0x4d5e54){_0x1f8dc1[_0x78c9('0x43')]=_[_0x78c9('0x46')](db['OpenchannelInteraction'][_0x78c9('0x3f')]);_0x1f8dc1[_0x78c9('0x45')]=_[_0x78c9('0x46')](_0xd31ed2[_0x78c9('0x45')]);_0x1f8dc1['filters']=_[_0x78c9('0x47')](_0x1f8dc1[_0x78c9('0x43')],_0x1f8dc1[_0x78c9('0x45')]);_0x3b57c5[_0x78c9('0x48')]=_['intersection'](_0x1f8dc1[_0x78c9('0x43')],qs[_0x78c9('0x49')](_0xd31ed2['query'][_0x78c9('0x49')]));_0x3b57c5[_0x78c9('0x48')]=_0x3b57c5[_0x78c9('0x48')][_0x78c9('0x4a')]?_0x3b57c5['attributes']:_0x1f8dc1[_0x78c9('0x43')];if(!_0xd31ed2['query']['hasOwnProperty']('nolimit')){_0x3b57c5[_0x78c9('0x34')]=qs[_0x78c9('0x34')](_0xd31ed2[_0x78c9('0x45')][_0x78c9('0x34')]);_0x3b57c5[_0x78c9('0x31')]=qs['offset'](_0xd31ed2[_0x78c9('0x45')][_0x78c9('0x31')]);}_0x3b57c5[_0x78c9('0x67')]=qs[_0x78c9('0x4c')](_0xd31ed2['query'][_0x78c9('0x4c')]);_0x3b57c5['where']=qs[_0x78c9('0x4e')](_[_0x78c9('0x68')](_0xd31ed2[_0x78c9('0x45')],_0x1f8dc1['filters']));_0x3b57c5[_0x78c9('0x4d')][_0x78c9('0x63')]=_0x4d5e54['id'];if(_0xd31ed2['query'][_0x78c9('0x50')]){_0x3b57c5[_0x78c9('0x4d')]=_[_0x78c9('0x4f')](_0x3b57c5[_0x78c9('0x4d')],{'$or':_[_0x78c9('0x44')](_0x3b57c5['attributes'],function(_0x39110a){var _0x11da34={};_0x11da34[_0x39110a]={'$like':'%'+_0xd31ed2[_0x78c9('0x45')]['filter']+'%'};return _0x11da34;})});}_0x3b57c5=_['merge']({},_0x3b57c5,_0xd31ed2['options']);return db['OpenchannelInteraction'][_0x78c9('0x33')]({'where':_0x3b57c5[_0x78c9('0x4d')]})[_0x78c9('0x22')](function(_0x5d773c){_0x5a72c8['count']=_0x5d773c;if(_0xd31ed2[_0x78c9('0x45')][_0x78c9('0x52')]){_0x3b57c5[_0x78c9('0x53')]=[{'model':db['CmContact'],'as':_0x78c9('0xaf'),'required':![]},{'model':db[_0x78c9('0x9c')],'as':'Owner','attributes':['name',_0x78c9('0xb0'),_0x78c9('0xb1')],'required':![]},{'model':db[_0x78c9('0xb2')],'as':_0x78c9('0xb3'),'attributes':['id',_0x78c9('0x3a'),_0x78c9('0xb4')],'where':_0xd31ed2[_0x78c9('0x45')][_0x78c9('0xb5')]?{'id':_0xd31ed2[_0x78c9('0x45')][_0x78c9('0xb5')]}:undefined,'required':_0xd31ed2[_0x78c9('0x45')][_0x78c9('0xb5')]?!![]:![]}];}return db[_0x78c9('0x8c')][_0x78c9('0x54')](_0x3b57c5);})[_0x78c9('0x22')](function(_0x2204ce){_0x5a72c8[_0x78c9('0x69')]=_0x2204ce;return _0x5a72c8;});}})[_0x78c9('0x22')](respondWithFilteredResult(_0x4ec637,_0x3b57c5))[_0x78c9('0x2c')](handleError(_0x4ec637,null));};exports[_0x78c9('0xb6')]=function(_0x2bc425,_0x8d5b0f,_0x1b45ea){return db[_0x78c9('0x3e')][_0x78c9('0x56')]({'where':{'id':_0x2bc425[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x8d5b0f,null))[_0x78c9('0x22')](function(_0x5a3b6e){if(_0x5a3b6e){return _0x5a3b6e[_0x78c9('0xb6')](_0x2bc425[_0x78c9('0x58')]['ids'],_['omit'](_0x2bc425[_0x78c9('0x58')],['ids','id'])||{})[_0x78c9('0x8f')](function(_0x1f67d5){for(var _0x4c70ef=0x0;_0x4c70ef<_0x2bc425[_0x78c9('0x58')][_0x78c9('0x6b')]['length'];_0x4c70ef+=0x1){socket[_0x78c9('0xb7')]('userOpenchannelAccount:save',{'UserId':Number(_0x2bc425['body'][_0x78c9('0x6b')][_0x4c70ef]),'OpenchannelAccountId':Number(_0x2bc425[_0x78c9('0x60')]['id'])});}return _0x1f67d5;});}})['then'](respondWithResult(_0x8d5b0f,null))[_0x78c9('0x2c')](handleError(_0x8d5b0f,null));};exports[_0x78c9('0xb8')]=function(_0x5aef42,_0x1ff4f9,_0x31db0f){return db[_0x78c9('0x3e')][_0x78c9('0x56')]({'where':{'id':_0x5aef42['params']['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x1ff4f9,null))[_0x78c9('0x22')](function(_0x15d00a){if(_0x15d00a){return _0x15d00a[_0x78c9('0xb8')](_0x5aef42[_0x78c9('0x45')][_0x78c9('0x6b')])[_0x78c9('0x22')](function(){if(_[_0x78c9('0xb9')](_0x5aef42['query'][_0x78c9('0x6b')])){for(var _0x264c7f=0x0;_0x264c7f<_0x5aef42[_0x78c9('0x45')][_0x78c9('0x6b')][_0x78c9('0x4a')];_0x264c7f+=0x1){socket[_0x78c9('0xb7')](_0x78c9('0xba'),{'UserId':Number(_0x5aef42[_0x78c9('0x45')]['ids'][_0x264c7f]),'OpenchannelAccountId':Number(_0x5aef42[_0x78c9('0x60')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x5aef42['query']['ids']),'OpenchannelAccountId':Number(_0x5aef42[_0x78c9('0x60')]['id'])});}});}})[_0x78c9('0x22')](respondWithStatusCode(_0x1ff4f9,null))[_0x78c9('0x2c')](handleError(_0x1ff4f9,null));};exports[_0x78c9('0xbb')]=function(_0x31b965,_0x2f5708,_0x4426be){var _0x46ea3d={};var _0x2ecb6a={};var _0x2fa46f;var _0x4b3556;return db['OpenchannelAccount'][_0x78c9('0x65')]({'where':{'id':_0x31b965[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x2f5708,null))[_0x78c9('0x22')](function(_0x4a3608){if(_0x4a3608){_0x2fa46f=_0x4a3608;_0x2ecb6a[_0x78c9('0x43')]=_[_0x78c9('0x46')](db[_0x78c9('0x9c')]['rawAttributes']);_0x2ecb6a[_0x78c9('0x45')]=_[_0x78c9('0x46')](_0x31b965[_0x78c9('0x45')]);_0x2ecb6a[_0x78c9('0x4e')]=_[_0x78c9('0x47')](_0x2ecb6a[_0x78c9('0x43')],_0x2ecb6a['query']);_0x46ea3d[_0x78c9('0x48')]=_[_0x78c9('0x47')](_0x2ecb6a[_0x78c9('0x43')],qs[_0x78c9('0x49')](_0x31b965[_0x78c9('0x45')][_0x78c9('0x49')]));_0x46ea3d[_0x78c9('0x48')]=_0x46ea3d[_0x78c9('0x48')][_0x78c9('0x4a')]?_0x46ea3d['attributes']:_0x2ecb6a[_0x78c9('0x43')];_0x46ea3d['order']=qs[_0x78c9('0x4c')](_0x31b965[_0x78c9('0x45')][_0x78c9('0x4c')]);_0x46ea3d[_0x78c9('0x4d')]=qs['filters'](_[_0x78c9('0x68')](_0x31b965[_0x78c9('0x45')],_0x2ecb6a[_0x78c9('0x4e')]));if(_0x31b965['query'][_0x78c9('0x50')]){_0x46ea3d[_0x78c9('0x4d')]=_[_0x78c9('0x4f')](_0x46ea3d[_0x78c9('0x4d')],{'$or':_[_0x78c9('0x44')](_0x46ea3d[_0x78c9('0x48')],function(_0x19171c){var _0x11c637={};_0x11c637[_0x19171c]={'$like':'%'+_0x31b965[_0x78c9('0x45')]['filter']+'%'};return _0x11c637;})});}_0x46ea3d=_['merge']({},_0x46ea3d,_0x31b965['options']);return _0x2fa46f[_0x78c9('0xbb')](_0x46ea3d);}})[_0x78c9('0x22')](function(_0x45b9ce){if(_0x45b9ce){_0x4b3556=_0x45b9ce[_0x78c9('0x4a')];if(!_0x31b965[_0x78c9('0x45')]['hasOwnProperty'](_0x78c9('0x66'))){_0x46ea3d[_0x78c9('0x34')]=qs[_0x78c9('0x34')](_0x31b965[_0x78c9('0x45')][_0x78c9('0x34')]);_0x46ea3d[_0x78c9('0x31')]=qs[_0x78c9('0x31')](_0x31b965[_0x78c9('0x45')][_0x78c9('0x31')]);}return _0x2fa46f[_0x78c9('0xbb')](_0x46ea3d);}})['then'](function(_0x6ff55){if(_0x6ff55){return _0x6ff55?{'count':_0x4b3556,'rows':_0x6ff55}:null;}})[_0x78c9('0x22')](respondWithResult(_0x2f5708,null))[_0x78c9('0x2c')](handleError(_0x2f5708,null));};exports[_0x78c9('0x3b')]=function(_0xdc203f,_0x3779b9,_0x5e0b33){var _0x2a7dcc,_0x4aae45,_0x21a0bd;if(_[_0x78c9('0x78')](_0xdc203f['body'][_0x78c9('0x58')])||_0xdc203f[_0x78c9('0x58')][_0x78c9('0x58')]===''){throw new db[(_0x78c9('0x70'))][(_0x78c9('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x78c9('0x78')](_0xdc203f[_0x78c9('0x58')]['to'])){}_0x2a7dcc=_0xdc203f[_0x78c9('0x58')]['to'];return db[_0x78c9('0x3e')]['findOne']({'where':{'id':_0xdc203f[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x3779b9,null))[_0x78c9('0x22')](function(_0x168f96){if(_0x168f96){return db['OpenchannelAccount'][_0x78c9('0x56')]({'where':{'id':_0x168f96['id']},'include':[{'model':db['CmList'],'as':_0x78c9('0x80'),'include':[{'model':db[_0x78c9('0x81')],'as':_0x78c9('0x82'),'where':{[_0x168f96['mapKey']]:_0x2a7dcc},'limit':0x1,'order':[['updatedAt',_0x78c9('0xbc')]]}]}]})[_0x78c9('0x22')](handleEntityNotFound(_0x3779b9,null))['then'](function(_0x17de8c){if(_0x17de8c&&_0x17de8c['List']){_0x4aae45=_0x17de8c[_0x78c9('0x5a')]({'plain':!![]});if(_0x4aae45[_0x78c9('0x80')]&&_0x4aae45['List'][_0x78c9('0x82')][_0x78c9('0x4a')]){return _0x4aae45[_0x78c9('0x80')]['Contacts'][0x0];}return db['CmContact'][_0x78c9('0x57')](_['defaults'](_0xdc203f[_0x78c9('0x58')],{'firstName':_0x2a7dcc,[_0x17de8c[_0x78c9('0x7c')]]:_0x2a7dcc,'phone':_0x2a7dcc,'ListId':_0x4aae45['ListId']}));}})[_0x78c9('0x22')](handleEntityNotFound(_0x3779b9,null))[_0x78c9('0x22')](function(_0xadd492){if(_0xadd492){_0x21a0bd=_0xadd492;return db[_0x78c9('0x8c')][_0x78c9('0x56')]({'where':{'ContactId':_0x21a0bd['id'],'closed':![],'OpenchannelAccountId':_0x4aae45['id']}})['then'](function(_0x43626a){if(_0x43626a){return[_0x43626a,![]];}return db[_0x78c9('0x8c')]['create']({'UserId':_0xdc203f[_0x78c9('0x59')]['id'],'ContactId':_0x21a0bd['id'],'OpenchannelAccountId':_0x4aae45['id'],'lastMsgDirection':_0x78c9('0xbd'),'firstMsgDirection':'out','Messages':[_[_0x78c9('0x4f')](_0xdc203f['body'],{'read':![],'body':_0xdc203f[_0x78c9('0x58')][_0x78c9('0x58')],'OpenchannelAccountId':_0x4aae45['id'],'UserId':_0xdc203f[_0x78c9('0x59')]['id'],'ContactId':_0x21a0bd['id']})]},{'include':[{'model':db[_0x78c9('0x99')],'as':_0x78c9('0xbe')}]})['then'](function(_0x414004){return[_0x414004,!![]];});});}})['spread'](function(_0x3a4f30,_0x70568f){if(_0x70568f){return _0x3a4f30;}return db[_0x78c9('0x99')][_0x78c9('0x57')](_[_0x78c9('0x4f')](_0xdc203f[_0x78c9('0x58')],{'read':![],'body':_0xdc203f['body'][_0x78c9('0x58')],'OpenchannelAccountId':_0x4aae45['id'],'OpenchannelInteractionId':_0x3a4f30['id'],'UserId':_0xdc203f[_0x78c9('0x59')]['id'],'ContactId':_0x21a0bd['id']}))[_0x78c9('0x22')](function(_0x481fbd){_0x3a4f30[_0x78c9('0xbf')][_0x78c9('0xbe')]=[];_0x3a4f30[_0x78c9('0xbf')]['Messages'][_0x78c9('0x95')](_0x481fbd[_0x78c9('0xbf')]);return _0x3a4f30;});});}})['then'](respondWithResult(_0x3779b9,null))[_0x78c9('0x2c')](handleError(_0x3779b9,null));}; \ No newline at end of file +var _0x1a0b=['queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','Contact','fullname','internal','Tag','color','tag','addAgents','omit','emit','removeAgents','isArray','getAgents','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','end','status','offset','undefined','limit','count','set','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','sendStatus','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','name','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','length','include','find','create','body','user','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','CannedAnswer','removeAnswers','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','OpenchannelApplication','List','account','applications','Applications','list','orderBy','priority','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','spread','firstName','messageId','interaction','created','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','unshift'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x1a0b,0x18f));var _0xb1a0=function(_0x214fc4,_0x3fe28b){_0x214fc4=_0x214fc4-0x0;var _0x3bb477=_0x1a0b[_0x214fc4];return _0x3bb477;};'use strict';var emlformat=require(_0xb1a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1a0('0x1'));var jsonpatch=require(_0xb1a0('0x2'));var rp=require(_0xb1a0('0x3'));var moment=require(_0xb1a0('0x4'));var BPromise=require(_0xb1a0('0x5'));var Mustache=require(_0xb1a0('0x6'));var util=require(_0xb1a0('0x7'));var path=require(_0xb1a0('0x8'));var sox=require(_0xb1a0('0x9'));var csv=require(_0xb1a0('0xa'));var ejs=require(_0xb1a0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb1a0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb1a0('0xd'));var toCsv=require(_0xb1a0('0xa'));var querystring=require(_0xb1a0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb1a0('0xf'));var qs=require(_0xb1a0('0x10'));var as=require(_0xb1a0('0x11'));var hardwareService=require(_0xb1a0('0x12'));var logger=require(_0xb1a0('0x13'))(_0xb1a0('0x14'));var utils=require('../../config/utils');var config=require(_0xb1a0('0x15'));var licenseUtil=require(_0xb1a0('0x16'));var db=require(_0xb1a0('0x17'))['db'];config['redis']=_[_0xb1a0('0x18')](config[_0xb1a0('0x19')],{'host':_0xb1a0('0x1a'),'port':0x18eb});var socket=require(_0xb1a0('0x1b'))(new Redis(config['redis']));require(_0xb1a0('0x1c'))[_0xb1a0('0x1d')](socket);var jayson=require(_0xb1a0('0x1e'));var client=jayson[_0xb1a0('0x1f')][_0xb1a0('0x20')]({'port':0x232c});var client9002=jayson[_0xb1a0('0x1f')][_0xb1a0('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x44c05d,_0x393c2e,_0x437d8a,_0x104389){return new BPromise(function(_0x65f9b3,_0x2bbb14){var _0x3e6d71=_0x104389||client;return _0x3e6d71[_0xb1a0('0x21')](_0x44c05d,_0x437d8a)[_0xb1a0('0x22')](function(_0x2c3d0e){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x393c2e,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x393c2e,'request\x20sent',JSON['stringify'](_0x2c3d0e));if(_0x2c3d0e['error']){if(_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x24')]===0x1f4){logger[_0xb1a0('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x393c2e,_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x25')]);return _0x2bbb14(_0x2c3d0e[_0xb1a0('0x23')]['message']);}logger[_0xb1a0('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x393c2e,_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x25')]);return _0x65f9b3(_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x25')]);}else{logger['info'](_0xb1a0('0x26'),_0x393c2e,'request\x20sent');_0x65f9b3(_0x2c3d0e[_0xb1a0('0x27')][_0xb1a0('0x25')]);}})[_0xb1a0('0x28')](function(_0x10e675){logger[_0xb1a0('0x23')](_0xb1a0('0x26'),_0x393c2e,_0x10e675);_0x2bbb14(_0x10e675);});});}function respondWithStatusCode(_0xb64c7d,_0x282119){_0x282119=_0x282119||0xcc;return function(_0x2e4630){if(_0x2e4630){return _0xb64c7d['sendStatus'](_0x282119);}return _0xb64c7d['status'](_0x282119)[_0xb1a0('0x29')]();};}function respondWithResult(_0x1006dc,_0x3b8900){_0x3b8900=_0x3b8900||0xc8;return function(_0x480854){if(_0x480854){return _0x1006dc[_0xb1a0('0x2a')](_0x3b8900)['json'](_0x480854);}};}function respondWithFilteredResult(_0x3fff58,_0x5a809f){return function(_0x38eab3){if(_0x38eab3){var _0x1d5ec7=typeof _0x5a809f[_0xb1a0('0x2b')]===_0xb1a0('0x2c')&&typeof _0x5a809f[_0xb1a0('0x2d')]===_0xb1a0('0x2c');var _0x320e38=_0x38eab3[_0xb1a0('0x2e')];var _0x1abda5=_0x1d5ec7?0x0:_0x5a809f['offset'];var _0x19b4e4=_0x1d5ec7?_0x38eab3[_0xb1a0('0x2e')]:_0x5a809f[_0xb1a0('0x2b')]+_0x5a809f[_0xb1a0('0x2d')];var _0x3953b2;if(_0x19b4e4>=_0x320e38){_0x19b4e4=_0x320e38;_0x3953b2=0xc8;}else{_0x3953b2=0xce;}_0x3fff58[_0xb1a0('0x2a')](_0x3953b2);return _0x3fff58[_0xb1a0('0x2f')]('Content-Range',_0x1abda5+'-'+_0x19b4e4+'/'+_0x320e38)['json'](_0x38eab3);}return null;};}function patchUpdates(_0xa038bc){return function(_0x1826c3){try{jsonpatch['apply'](_0x1826c3,_0xa038bc,!![]);}catch(_0x42008f){return BPromise[_0xb1a0('0x30')](_0x42008f);}return _0x1826c3[_0xb1a0('0x31')]();};}function saveUpdates(_0x25f44f,_0x69ef32){return function(_0x1822d9){if(_0x1822d9){return _0x1822d9[_0xb1a0('0x32')](_0x25f44f)[_0xb1a0('0x22')](function(_0x39e4f2){return _0x39e4f2;});}return null;};}function removeEntity(_0x357e23,_0x12ef87){return function(_0x1a0e11){if(_0x1a0e11){return _0x1a0e11[_0xb1a0('0x33')]()[_0xb1a0('0x22')](function(){var _0x2d5d11=_0x1a0e11['get']({'plain':!![]});var _0x297e1d=_0xb1a0('0x34');return db[_0xb1a0('0x35')][_0xb1a0('0x33')]({'where':{'type':_0x297e1d,'resourceId':_0x2d5d11['id']}})[_0xb1a0('0x22')](function(){return _0x1a0e11;});})['then'](function(){_0x357e23['status'](0xcc)[_0xb1a0('0x29')]();});}};}function handleEntityNotFound(_0x1e89da,_0x2c2375){return function(_0x3e8dd6){if(!_0x3e8dd6){_0x1e89da[_0xb1a0('0x36')](0x194);}return _0x3e8dd6;};}function handleError(_0xab9e36,_0x503a1b){_0x503a1b=_0x503a1b||0x1f4;return function(_0x21ba57){logger[_0xb1a0('0x23')](_0x21ba57['stack']);if(_0x21ba57['name']){delete _0x21ba57['name'];}_0xab9e36['status'](_0x503a1b)[_0xb1a0('0x37')](_0x21ba57);};}exports['index']=function(_0x30bf80,_0x33efbd){var _0x265e04={'include':[{'model':db[_0xb1a0('0x38')],'as':_0xb1a0('0x39')}]},_0x3eea9a={},_0x418815={'count':0x0,'rows':[]};var _0x1b7d70=_[_0xb1a0('0x3a')](db[_0xb1a0('0x3b')][_0xb1a0('0x3c')],function(_0x283000){return{'name':_0x283000[_0xb1a0('0x3d')],'type':_0x283000[_0xb1a0('0x3e')]['key']};});_0x3eea9a['model']=_[_0xb1a0('0x3a')](_0x1b7d70,_0xb1a0('0x3f'));_0x3eea9a[_0xb1a0('0x40')]=_['keys'](_0x30bf80['query']);_0x3eea9a[_0xb1a0('0x41')]=_[_0xb1a0('0x42')](_0x3eea9a[_0xb1a0('0x43')],_0x3eea9a[_0xb1a0('0x40')]);_0x265e04[_0xb1a0('0x44')]=_[_0xb1a0('0x42')](_0x3eea9a[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x30bf80['query'][_0xb1a0('0x45')]));_0x265e04['attributes']=_0x265e04[_0xb1a0('0x44')]['length']?_0x265e04[_0xb1a0('0x44')]:_0x3eea9a[_0xb1a0('0x43')];if(!_0x30bf80[_0xb1a0('0x40')][_0xb1a0('0x46')]('nolimit')){_0x265e04['limit']=qs['limit'](_0x30bf80['query']['limit']);_0x265e04[_0xb1a0('0x2b')]=qs[_0xb1a0('0x2b')](_0x30bf80[_0xb1a0('0x40')][_0xb1a0('0x2b')]);}_0x265e04[_0xb1a0('0x47')]=qs['sort'](_0x30bf80[_0xb1a0('0x40')][_0xb1a0('0x48')]);_0x265e04[_0xb1a0('0x49')]=qs[_0xb1a0('0x41')](_[_0xb1a0('0x4a')](_0x30bf80[_0xb1a0('0x40')],_0x3eea9a['filters']),_0x1b7d70);if(_0x30bf80[_0xb1a0('0x40')][_0xb1a0('0x4b')]){_0x265e04['where']=_[_0xb1a0('0x4c')](_0x265e04[_0xb1a0('0x49')],{'$or':_[_0xb1a0('0x3a')](_0x1b7d70,function(_0x4aa192){if(_0x4aa192['type']!==_0xb1a0('0x4d')){var _0xeff1e1={};_0xeff1e1[_0x4aa192['name']]={'$like':'%'+_0x30bf80[_0xb1a0('0x40')][_0xb1a0('0x4b')]+'%'};return _0xeff1e1;}})});}_0x265e04=_[_0xb1a0('0x4c')]({},_0x265e04,_0x30bf80[_0xb1a0('0x4e')]);var _0x303d91={'where':_0x265e04[_0xb1a0('0x49')]};return db[_0xb1a0('0x3b')][_0xb1a0('0x2e')](_0x303d91)[_0xb1a0('0x22')](function(_0x116c7a){_0x418815[_0xb1a0('0x2e')]=_0x116c7a;if(_0x30bf80['query'][_0xb1a0('0x4f')]){_0x265e04['include']=[{'all':!![]}];}return db[_0xb1a0('0x3b')][_0xb1a0('0x50')](_0x265e04);})['then'](function(_0x15012b){_0x418815[_0xb1a0('0x51')]=_0x15012b;return _0x418815;})[_0xb1a0('0x22')](respondWithFilteredResult(_0x33efbd,_0x265e04))[_0xb1a0('0x28')](handleError(_0x33efbd,null));};exports[_0xb1a0('0x52')]=function(_0x3c7c27,_0xeefaab){var _0x238696={'raw':![],'where':{'id':_0x3c7c27[_0xb1a0('0x53')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x48d0a0={};_0x48d0a0[_0xb1a0('0x43')]=_['keys'](db['OpenchannelAccount'][_0xb1a0('0x3c')]);_0x48d0a0[_0xb1a0('0x40')]=_[_0xb1a0('0x54')](_0x3c7c27[_0xb1a0('0x40')]);_0x48d0a0[_0xb1a0('0x41')]=_[_0xb1a0('0x42')](_0x48d0a0['model'],_0x48d0a0['query']);_0x238696[_0xb1a0('0x44')]=_[_0xb1a0('0x42')](_0x48d0a0[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x3c7c27[_0xb1a0('0x40')][_0xb1a0('0x45')]));_0x238696[_0xb1a0('0x44')]=_0x238696[_0xb1a0('0x44')][_0xb1a0('0x55')]?_0x238696[_0xb1a0('0x44')]:_0x48d0a0['model'];if(_0x3c7c27[_0xb1a0('0x40')][_0xb1a0('0x4f')]){_0x238696[_0xb1a0('0x56')]=[{'all':!![]}];}_0x238696=_[_0xb1a0('0x4c')]({},_0x238696,_0x3c7c27[_0xb1a0('0x4e')]);return db[_0xb1a0('0x3b')][_0xb1a0('0x57')](_0x238696)[_0xb1a0('0x22')](handleEntityNotFound(_0xeefaab,null))[_0xb1a0('0x22')](respondWithResult(_0xeefaab,null))['catch'](handleError(_0xeefaab,null));};exports['create']=function(_0x103f50,_0x20a5b2){return db[_0xb1a0('0x3b')][_0xb1a0('0x58')](_0x103f50[_0xb1a0('0x59')],{})[_0xb1a0('0x22')](function(_0x2f9128){var _0x18f8f3=_0x103f50[_0xb1a0('0x5a')]['get']({'plain':!![]});if(!_0x18f8f3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18f8f3['role']===_0xb1a0('0x5a')){var _0x41965d=_0x2f9128[_0xb1a0('0x5b')]({'plain':!![]});var _0x4e0420=_0xb1a0('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x4e0420,'userProfileId':_0x18f8f3[_0xb1a0('0x5c')]},'raw':!![]})[_0xb1a0('0x22')](function(_0x37c876){if(_0x37c876&&_0x37c876['autoAssociation']===0x0){return db[_0xb1a0('0x35')]['create']({'name':_0x41965d[_0xb1a0('0x3f')],'resourceId':_0x41965d['id'],'type':_0x37c876[_0xb1a0('0x3f')],'sectionId':_0x37c876['id']},{})[_0xb1a0('0x22')](function(){return _0x2f9128;});}else{return _0x2f9128;}})['catch'](function(_0x1a9691){logger[_0xb1a0('0x23')](_0xb1a0('0x5d'),_0x1a9691);throw _0x1a9691;});}return _0x2f9128;})[_0xb1a0('0x22')](respondWithResult(_0x20a5b2,0xc9))[_0xb1a0('0x28')](handleError(_0x20a5b2,null));};exports['update']=function(_0x3596b9,_0x4a6049){if(_0x3596b9[_0xb1a0('0x59')]['id']){delete _0x3596b9[_0xb1a0('0x59')]['id'];}return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x3596b9['params']['id']},'include':[{'model':db['Pause'],'as':_0xb1a0('0x39')}]})[_0xb1a0('0x22')](handleEntityNotFound(_0x4a6049,null))['then'](saveUpdates(_0x3596b9[_0xb1a0('0x59')],null))[_0xb1a0('0x22')](respondWithResult(_0x4a6049,null))[_0xb1a0('0x28')](handleError(_0x4a6049,null));};exports[_0xb1a0('0x33')]=function(_0x1275ef,_0x488c20){return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x1275ef[_0xb1a0('0x53')]['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x488c20,null))[_0xb1a0('0x22')](removeEntity(_0x488c20,null))[_0xb1a0('0x28')](handleError(_0x488c20,null));};exports[_0xb1a0('0x5e')]=function(_0x23c26b,_0x55d6f3){return db[_0xb1a0('0x3b')]['describe']()[_0xb1a0('0x22')](respondWithResult(_0x55d6f3,null))['catch'](handleError(_0x55d6f3,null));};exports[_0xb1a0('0x5f')]=function(_0x970dd,_0x331a42,_0x26ca1a){if(_0x970dd[_0xb1a0('0x59')]['id']){delete _0x970dd['body']['id'];}return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x970dd['params']['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x331a42,null))[_0xb1a0('0x22')](function(_0x4195a8){if(_0x4195a8){_0x970dd[_0xb1a0('0x59')][_0xb1a0('0x60')]=_0x4195a8['id'];return db[_0xb1a0('0x61')][_0xb1a0('0x58')](_0x970dd[_0xb1a0('0x59')]);}})[_0xb1a0('0x22')](respondWithResult(_0x331a42,null))[_0xb1a0('0x28')](handleError(_0x331a42,null));};exports[_0xb1a0('0x62')]=function(_0x2c34a3,_0x4fa868,_0xf688ea){var _0x2cd939={'raw':![],'where':{}};var _0x5535a5={};var _0x2a97ab={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb1a0('0x63')]({'where':{'id':_0x2c34a3['params']['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x4fa868,null))[_0xb1a0('0x22')](function(_0xa774c3){if(_0xa774c3){_0x5535a5[_0xb1a0('0x43')]=_['keys'](db[_0xb1a0('0x61')][_0xb1a0('0x3c')]);_0x5535a5[_0xb1a0('0x40')]=_[_0xb1a0('0x54')](_0x2c34a3[_0xb1a0('0x40')]);_0x5535a5[_0xb1a0('0x41')]=_['intersection'](_0x5535a5['model'],_0x5535a5['query']);_0x2cd939[_0xb1a0('0x44')]=_[_0xb1a0('0x42')](_0x5535a5[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x2c34a3[_0xb1a0('0x40')][_0xb1a0('0x45')]));_0x2cd939[_0xb1a0('0x44')]=_0x2cd939['attributes'][_0xb1a0('0x55')]?_0x2cd939['attributes']:_0x5535a5[_0xb1a0('0x43')];if(!_0x2c34a3['query']['hasOwnProperty'](_0xb1a0('0x64'))){_0x2cd939[_0xb1a0('0x2d')]=qs[_0xb1a0('0x2d')](_0x2c34a3['query']['limit']);_0x2cd939['offset']=qs[_0xb1a0('0x2b')](_0x2c34a3[_0xb1a0('0x40')][_0xb1a0('0x2b')]);}_0x2cd939[_0xb1a0('0x47')]=qs[_0xb1a0('0x48')](_0x2c34a3[_0xb1a0('0x40')][_0xb1a0('0x48')]);_0x2cd939[_0xb1a0('0x49')]=qs[_0xb1a0('0x41')](_[_0xb1a0('0x4a')](_0x2c34a3[_0xb1a0('0x40')],_0x5535a5[_0xb1a0('0x41')]));_0x2cd939['where']['OpenchannelAccountId']=_0xa774c3['id'];if(_0x2c34a3[_0xb1a0('0x40')][_0xb1a0('0x4b')]){_0x2cd939[_0xb1a0('0x49')]=_[_0xb1a0('0x4c')](_0x2cd939[_0xb1a0('0x49')],{'$or':_['map'](_0x2cd939[_0xb1a0('0x44')],function(_0x4fbb80){var _0x4d804b={};_0x4d804b[_0x4fbb80]={'$like':'%'+_0x2c34a3['query']['filter']+'%'};return _0x4d804b;})});}_0x2cd939=_['merge']({},_0x2cd939,_0x2c34a3[_0xb1a0('0x4e')]);return db[_0xb1a0('0x61')]['count']({'where':_0x2cd939[_0xb1a0('0x49')]})[_0xb1a0('0x22')](function(_0x2a4ac6){_0x2a97ab[_0xb1a0('0x2e')]=_0x2a4ac6;if(_0x2c34a3[_0xb1a0('0x40')]['includeAll']){_0x2cd939[_0xb1a0('0x56')]=[{'all':!![]}];}return db[_0xb1a0('0x61')][_0xb1a0('0x50')](_0x2cd939);})[_0xb1a0('0x22')](function(_0x1708b9){_0x2a97ab['rows']=_0x1708b9;return _0x2a97ab;});}})[_0xb1a0('0x22')](respondWithFilteredResult(_0x4fa868,_0x2cd939))['catch'](handleError(_0x4fa868,null));};exports[_0xb1a0('0x65')]=function(_0x49d0a4,_0x29aa4a,_0x4d6501){return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x49d0a4[_0xb1a0('0x53')]['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x29aa4a,null))[_0xb1a0('0x22')](function(_0x338350){if(_0x338350){return _0x338350['removeDispositions'](_0x49d0a4[_0xb1a0('0x40')][_0xb1a0('0x66')]);}})['then'](respondWithStatusCode(_0x29aa4a,null))['catch'](handleError(_0x29aa4a,null));};exports['addAnswer']=function(_0x42a260,_0xb221c6,_0x3da335){if(_0x42a260[_0xb1a0('0x59')]['id']){delete _0x42a260[_0xb1a0('0x59')]['id'];}return db[_0xb1a0('0x3b')]['find']({'where':{'id':_0x42a260[_0xb1a0('0x53')]['id']}})['then'](handleEntityNotFound(_0xb221c6,null))[_0xb1a0('0x22')](function(_0x111546){if(_0x111546){_0x42a260[_0xb1a0('0x59')][_0xb1a0('0x60')]=_0x111546['id'];return db[_0xb1a0('0x67')][_0xb1a0('0x58')](_0x42a260[_0xb1a0('0x59')]);}})[_0xb1a0('0x22')](respondWithResult(_0xb221c6,null))[_0xb1a0('0x28')](handleError(_0xb221c6,null));};exports['getAnswers']=function(_0x7f7294,_0x1a82f4,_0xd7009c){var _0x4a7a21={'raw':![],'where':{}};var _0x44e00c={};var _0x13df36={'count':0x0,'rows':[]};return db[_0xb1a0('0x3b')][_0xb1a0('0x63')]({'where':{'id':_0x7f7294[_0xb1a0('0x53')]['id']}})['then'](handleEntityNotFound(_0x1a82f4,null))[_0xb1a0('0x22')](function(_0x3175fd){if(_0x3175fd){_0x44e00c[_0xb1a0('0x43')]=_[_0xb1a0('0x54')](db[_0xb1a0('0x67')][_0xb1a0('0x3c')]);_0x44e00c['query']=_[_0xb1a0('0x54')](_0x7f7294[_0xb1a0('0x40')]);_0x44e00c[_0xb1a0('0x41')]=_[_0xb1a0('0x42')](_0x44e00c[_0xb1a0('0x43')],_0x44e00c[_0xb1a0('0x40')]);_0x4a7a21['attributes']=_[_0xb1a0('0x42')](_0x44e00c[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x7f7294[_0xb1a0('0x40')][_0xb1a0('0x45')]));_0x4a7a21[_0xb1a0('0x44')]=_0x4a7a21[_0xb1a0('0x44')][_0xb1a0('0x55')]?_0x4a7a21[_0xb1a0('0x44')]:_0x44e00c[_0xb1a0('0x43')];if(!_0x7f7294[_0xb1a0('0x40')][_0xb1a0('0x46')](_0xb1a0('0x64'))){_0x4a7a21['limit']=qs[_0xb1a0('0x2d')](_0x7f7294[_0xb1a0('0x40')][_0xb1a0('0x2d')]);_0x4a7a21[_0xb1a0('0x2b')]=qs['offset'](_0x7f7294[_0xb1a0('0x40')][_0xb1a0('0x2b')]);}_0x4a7a21[_0xb1a0('0x47')]=qs[_0xb1a0('0x48')](_0x7f7294[_0xb1a0('0x40')]['sort']);_0x4a7a21[_0xb1a0('0x49')]=qs[_0xb1a0('0x41')](_[_0xb1a0('0x4a')](_0x7f7294[_0xb1a0('0x40')],_0x44e00c[_0xb1a0('0x41')]));_0x4a7a21['where'][_0xb1a0('0x60')]=_0x3175fd['id'];if(_0x7f7294[_0xb1a0('0x40')]['filter']){_0x4a7a21['where']=_['merge'](_0x4a7a21[_0xb1a0('0x49')],{'$or':_[_0xb1a0('0x3a')](_0x4a7a21[_0xb1a0('0x44')],function(_0x707cb5){var _0x175f32={};_0x175f32[_0x707cb5]={'$like':'%'+_0x7f7294[_0xb1a0('0x40')]['filter']+'%'};return _0x175f32;})});}_0x4a7a21=_[_0xb1a0('0x4c')]({},_0x4a7a21,_0x7f7294[_0xb1a0('0x4e')]);return db[_0xb1a0('0x67')][_0xb1a0('0x2e')]({'where':_0x4a7a21[_0xb1a0('0x49')]})[_0xb1a0('0x22')](function(_0x192fb7){_0x13df36['count']=_0x192fb7;if(_0x7f7294[_0xb1a0('0x40')]['includeAll']){_0x4a7a21['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4a7a21);})['then'](function(_0x4e97d7){_0x13df36[_0xb1a0('0x51')]=_0x4e97d7;return _0x13df36;});}})[_0xb1a0('0x22')](respondWithFilteredResult(_0x1a82f4,_0x4a7a21))[_0xb1a0('0x28')](handleError(_0x1a82f4,null));};exports[_0xb1a0('0x68')]=function(_0x5f3d45,_0x412a63,_0x32e15e){return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x5f3d45[_0xb1a0('0x53')]['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x412a63,null))[_0xb1a0('0x22')](function(_0x32f983){if(_0x32f983){return _0x32f983[_0xb1a0('0x68')](_0x5f3d45[_0xb1a0('0x40')]['ids']);}})[_0xb1a0('0x22')](respondWithStatusCode(_0x412a63,null))['catch'](handleError(_0x412a63,null));};exports['notify']=function(_0x88b9eb,_0xf95cb2,_0x327a5d){var _0x266384={'body':_0x88b9eb['body'],'channel':'openchannel'};var _0x449c0d=[];var _0x33707b=[];var _0x1adf0b={};var _0x2d34fb=![];return db['CmContact'][_0xb1a0('0x5e')]()[_0xb1a0('0x22')](function(_0x4ffbad){if(!_0x4ffbad){throw new db['Sequelize'][(_0xb1a0('0x69'))](_0xb1a0('0x6a'));}_0x449c0d=_['difference'](_[_0xb1a0('0x54')](_0x4ffbad),[_0xb1a0('0x6b'),'updatedAt']);_0x33707b=_[_0xb1a0('0x6c')](_[_0xb1a0('0x54')](_0x4ffbad),['createdAt',_0xb1a0('0x6d'),_0xb1a0('0x6e'),_0xb1a0('0x6f')]);if(_0x88b9eb['body']['id']){delete _0x88b9eb[_0xb1a0('0x59')]['id'];}if(_[_0xb1a0('0x70')](_0x88b9eb['body'][_0xb1a0('0x71')])){throw new db[(_0xb1a0('0x72'))][(_0xb1a0('0x69'))](_0xb1a0('0x73'));}if(_['isNil'](_0x88b9eb['body'][_0xb1a0('0x59')])||_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x59')]===''){throw new db['Sequelize']['ValidationError'](_0xb1a0('0x74'));}if(_['isNil'](_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x75')])){throw new db[(_0xb1a0('0x72'))][(_0xb1a0('0x69'))](_0xb1a0('0x76')+_0x33707b);}if(!_[_0xb1a0('0x77')](_0x33707b,_0x88b9eb[_0xb1a0('0x59')]['mapKey'])){throw new db[(_0xb1a0('0x72'))][(_0xb1a0('0x69'))](_0xb1a0('0x78')+_0x33707b);}_0x1adf0b[_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x75')]]=_0x88b9eb['body']['from'];})[_0xb1a0('0x22')](function(){return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x88b9eb['params']['id']},'include':[{'model':db[_0xb1a0('0x79')],'as':'List','include':[{'model':db[_0xb1a0('0x7a')],'as':_0xb1a0('0x7b'),'where':_0x1adf0b,'limit':0x1,'order':[[_0xb1a0('0x6d'),_0xb1a0('0x7c')]]}]},{'model':db[_0xb1a0('0x7d')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0xf95cb2,null))[_0xb1a0('0x22')](function(_0x29cc7d){if(_0x29cc7d&&_0x29cc7d[_0xb1a0('0x7e')]){_0x266384[_0xb1a0('0x7f')]=_0x29cc7d;_0x266384[_0xb1a0('0x80')]=_0x29cc7d[_0xb1a0('0x81')];_0x266384[_0xb1a0('0x82')]=_0x29cc7d['List'];_0x266384[_0xb1a0('0x80')]=_[_0xb1a0('0x83')](_0x266384[_0xb1a0('0x80')],[_0xb1a0('0x84')],[_0xb1a0('0x85')]);if(_0x266384[_0xb1a0('0x7f')][_0xb1a0('0x81')]){delete _0x266384[_0xb1a0('0x7f')][_0xb1a0('0x81')];}if(_0x266384[_0xb1a0('0x7f')]['List']&&_0x266384['account']['List'][_0xb1a0('0x7b')][_0xb1a0('0x55')]){return _0x266384[_0xb1a0('0x7f')][_0xb1a0('0x7e')][_0xb1a0('0x7b')][0x0];}var _0x24fa6f=_['defaults'](_0x88b9eb[_0xb1a0('0x59')],{'firstName':_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x71')],'ListId':_0x29cc7d[_0xb1a0('0x6f')]});_0x24fa6f[_0x88b9eb['body']['mapKey']]=_0x88b9eb['body'][_0xb1a0('0x71')];return db[_0xb1a0('0x7a')][_0xb1a0('0x58')](_0x24fa6f,{'fields':_0x449c0d,'raw':!![]});}})['then'](handleEntityNotFound(_0xf95cb2,null))[_0xb1a0('0x22')](function(_0x44702c){_0x266384[_0xb1a0('0x86')]=_0x44702c;if(_0x44702c){var _0x46c8ad={'ContactId':_0x44702c['id'],'OpenchannelAccountId':_0x88b9eb['params']['id'],'from':(_0x44702c['firstName']||'')+'\x20'+(_0x44702c[_0xb1a0('0x87')]||'')};var _0x560475={'OpenchannelAccountId':_0x88b9eb[_0xb1a0('0x53')]['id'],'closed':![]};if(_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x88')]){_0x560475[_0xb1a0('0x88')]=_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x88')];return db[_0xb1a0('0x89')][_0xb1a0('0x57')]({'where':_0x560475})['then'](function(_0x11a7b6){if(_0x11a7b6){return[_0x11a7b6,![]];}_0x46c8ad[_0xb1a0('0x88')]=_0x88b9eb['body'][_0xb1a0('0x88')];_0x46c8ad['externalUrl']=_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x8a')];return db['OpenchannelInteraction'][_0xb1a0('0x58')](_0x46c8ad)[_0xb1a0('0x22')](function(_0x114060){return[_0x114060,!![]];});});}else{_0x560475['threadId']=null;}_0x560475['ContactId']=_0x44702c['id'];return db[_0xb1a0('0x89')][_0xb1a0('0x57')]({'where':_0x560475})[_0xb1a0('0x22')](function(_0x8dc0ce){if(_0x8dc0ce){return[_0x8dc0ce,![]];}return db['OpenchannelInteraction'][_0xb1a0('0x58')](_0x46c8ad)[_0xb1a0('0x22')](function(_0x1638fc){return[_0x1638fc,!![]];});});}})[_0xb1a0('0x8b')](function(_0x6615ce,_0x4252a6){if(_0x6615ce){_0x2d34fb=_0x4252a6;if(!_0x4252a6){var _0xee284e={'from':(_0x266384[_0xb1a0('0x86')][_0xb1a0('0x8c')]||'')+'\x20'+(_0x266384[_0xb1a0('0x86')][_0xb1a0('0x87')]||'')};if(_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x88')]&&_0x88b9eb[_0xb1a0('0x59')]['messageId']&&_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x88')]!=_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x8d')]){_0xee284e[_0xb1a0('0x88')]=_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x8d')];}return _0x6615ce['update'](_0xee284e);}else{return _0x6615ce;}}})[_0xb1a0('0x22')](function(_0x235a2c){_0x266384['interaction']=_0x235a2c['get']({'plain':!![]});_0x266384[_0xb1a0('0x8e')][_0xb1a0('0x8f')]=_0x2d34fb;if(_0x266384['interaction'][_0xb1a0('0x8f')]){if(_0x266384['account']['autoclose']){_0x266384[_0xb1a0('0x80')][_0xb1a0('0x90')]({'id':0x0,'priority':_0x266384[_0xb1a0('0x80')][_0xb1a0('0x55')]+0x1,'app':'close','appdata':_0xb1a0('0x91'),'interval':_0xb1a0('0x92')});}}return db[_0xb1a0('0x93')]['create']({'body':_0x88b9eb[_0xb1a0('0x59')]['body'],'OpenchannelAccountId':_0x88b9eb['params']['id'],'OpenchannelInteractionId':_0x235a2c['id'],'direction':'in','ContactId':_0x266384[_0xb1a0('0x86')]['id'],'AttachmentId':_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x94')]});})['then'](function(_0x107ceb){_0x266384['message']=_0x107ceb;if(!_0x266384[_0xb1a0('0x8e')][_0xb1a0('0x95')])return;return db[_0xb1a0('0x96')][_0xb1a0('0x57')]({'attributes':['id',_0xb1a0('0x3f')],'where':{'id':_0x266384[_0xb1a0('0x8e')][_0xb1a0('0x95')]}});})[_0xb1a0('0x22')](function(_0x1b95ed){if(_0x1b95ed){_0x266384[_0xb1a0('0x80')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb1a0('0x97'),'appdata':_0x1b95ed[_0xb1a0('0x3f')]+','+(_0x266384[_0xb1a0('0x7f')][_0xb1a0('0x98')]||0xa),'interval':_0xb1a0('0x92')});}if(!_0x266384[_0xb1a0('0x8e')][_0xb1a0('0x99')])return;return db[_0xb1a0('0x9a')][_0xb1a0('0x57')]({'attributes':['id',_0xb1a0('0x3f')],'where':{'id':_0x266384['interaction'][_0xb1a0('0x99')]}});})['then'](function(_0x62896f){if(_0x62896f){_0x266384[_0xb1a0('0x80')][_0xb1a0('0x9b')]({'id':0x0,'priority':0x1,'app':_0xb1a0('0x9c'),'appdata':_0x62896f['name']+','+(_0x266384[_0xb1a0('0x7f')][_0xb1a0('0x9d')]||0x12c),'interval':_0xb1a0('0x92')});}return respondWithRpcPromise(_0xb1a0('0x9e'),_0xb1a0('0x9f'),_0x266384);})[_0xb1a0('0x22')](function(_0x2fef3e){respondWithRpcPromise(_0xb1a0('0xa0'),_0xb1a0('0xa0'),{'event':'notify','message':_0x2fef3e},client9002);return _0x2fef3e;})[_0xb1a0('0x22')](respondWithResult(_0xf95cb2,null))[_0xb1a0('0x28')](handleError(_0xf95cb2,null));};exports[_0xb1a0('0xa1')]=function(_0x5e91c4,_0x53864f){var _0x1fe334=_0x5e91c4[_0xb1a0('0x53')]['id'];var _0x1d939d=_0x5e91c4[_0xb1a0('0x59')];var _0x59235b=0xc8;var _0xf015d6=null;return db[_0xb1a0('0xa2')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xb1a0('0xa3')][_0xb1a0('0xa4')]},function(_0x4f02f1){return db['OpenchannelAccount'][_0xb1a0('0x63')]({'where':{'id':_0x1fe334},'transaction':_0x4f02f1})['then'](function(_0x508d78){if(_0x508d78){return db[_0xb1a0('0x7d')][_0xb1a0('0x33')]({'where':{'OpenchannelAccountId':_0x1fe334},'transaction':_0x4f02f1})[_0xb1a0('0x22')](function(){var _0x42be80=_['map'](_0x1d939d,function(_0xc6fb7f){_0xc6fb7f[_0xb1a0('0x60')]=_0x1fe334;return _0xc6fb7f;});return db[_0xb1a0('0x7d')][_0xb1a0('0xa5')](_0x42be80,{'transaction':_0x4f02f1});});}else{_0x59235b=0x194;_0xf015d6=[];}});})['then'](function(){if(_0x59235b!==0x194){return db[_0xb1a0('0x7d')][_0xb1a0('0xa6')]({'where':{'OpenchannelAccountId':_0x1fe334},'order':_0xb1a0('0x84')})[_0xb1a0('0x22')](function(_0x375ea4){_0xf015d6=_0x375ea4;});}})['catch'](function(_0x2d7066){_0x59235b=0x1f4;logger[_0xb1a0('0x23')](_0x2d7066[_0xb1a0('0xa7')]);if(_0x2d7066['name']){delete _0x2d7066[_0xb1a0('0x3f')];}_0xf015d6=_0x2d7066;})[_0xb1a0('0xa8')](function(){if(_0xf015d6===null){_0x53864f['sendStatus'](_0x59235b);}else{if(_0x59235b===0x1f4){_0x53864f[_0xb1a0('0x2a')](_0x59235b)[_0xb1a0('0x37')](_0xf015d6);}else{_0x53864f[_0xb1a0('0x2a')](_0x59235b)['json'](_0xf015d6);}}});};exports[_0xb1a0('0xa9')]=function(_0x1a9bb6,_0x27f270,_0x583f6f){var _0x184d28={};var _0x58f562={};var _0x30774d;var _0x3eeb22;return db[_0xb1a0('0x3b')][_0xb1a0('0x63')]({'where':{'id':_0x1a9bb6[_0xb1a0('0x53')]['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x27f270,null))[_0xb1a0('0x22')](function(_0x2c6fd6){if(_0x2c6fd6){_0x30774d=_0x2c6fd6;_0x58f562[_0xb1a0('0x43')]=_[_0xb1a0('0x54')](db[_0xb1a0('0x7d')][_0xb1a0('0x3c')]);_0x58f562[_0xb1a0('0x40')]=_[_0xb1a0('0x54')](_0x1a9bb6['query']);_0x58f562[_0xb1a0('0x41')]=_[_0xb1a0('0x42')](_0x58f562['model'],_0x58f562[_0xb1a0('0x40')]);_0x184d28[_0xb1a0('0x44')]=_[_0xb1a0('0x42')](_0x58f562[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x1a9bb6[_0xb1a0('0x40')][_0xb1a0('0x45')]));_0x184d28[_0xb1a0('0x44')]=_0x184d28[_0xb1a0('0x44')][_0xb1a0('0x55')]?_0x184d28[_0xb1a0('0x44')]:_0x58f562[_0xb1a0('0x43')];_0x184d28[_0xb1a0('0x47')]=qs[_0xb1a0('0x48')](_0x1a9bb6['query'][_0xb1a0('0x48')]);_0x184d28[_0xb1a0('0x49')]=qs[_0xb1a0('0x41')](_['pick'](_0x1a9bb6[_0xb1a0('0x40')],_0x58f562[_0xb1a0('0x41')]));if(_0x1a9bb6[_0xb1a0('0x40')][_0xb1a0('0x4b')]){_0x184d28[_0xb1a0('0x49')]=_[_0xb1a0('0x4c')](_0x184d28[_0xb1a0('0x49')],{'$or':_[_0xb1a0('0x3a')](_0x184d28['attributes'],function(_0x466567){var _0x1d1bb8={};_0x1d1bb8[_0x466567]={'$like':'%'+_0x1a9bb6[_0xb1a0('0x40')]['filter']+'%'};return _0x1d1bb8;})});}_0x184d28=_[_0xb1a0('0x4c')]({},_0x184d28,_0x1a9bb6[_0xb1a0('0x4e')]);return _0x30774d[_0xb1a0('0xa9')](_0x184d28);}})[_0xb1a0('0x22')](function(_0x1b0dd1){if(_0x1b0dd1){_0x3eeb22=_0x1b0dd1[_0xb1a0('0x55')];if(!_0x1a9bb6[_0xb1a0('0x40')][_0xb1a0('0x46')]('nolimit')){_0x184d28[_0xb1a0('0x2d')]=qs[_0xb1a0('0x2d')](_0x1a9bb6['query'][_0xb1a0('0x2d')]);_0x184d28[_0xb1a0('0x2b')]=qs[_0xb1a0('0x2b')](_0x1a9bb6[_0xb1a0('0x40')][_0xb1a0('0x2b')]);}return _0x30774d['getApplications'](_0x184d28);}})[_0xb1a0('0x22')](function(_0x42911){if(_0x42911){return _0x42911?{'count':_0x3eeb22,'rows':_0x42911}:null;}})['then'](respondWithResult(_0x27f270,null))['catch'](handleError(_0x27f270,null));};exports['getInteractions']=function(_0x5d0823,_0x4f198b,_0x34e405){var _0x3b9441={'raw':![],'where':{}};var _0x3083a9={};var _0x346c5d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb1a0('0x63')]({'where':{'id':_0x5d0823['params']['id']}})['then'](handleEntityNotFound(_0x4f198b,null))[_0xb1a0('0x22')](function(_0xec6565){if(_0xec6565){_0x3083a9[_0xb1a0('0x43')]=_['keys'](db[_0xb1a0('0x89')][_0xb1a0('0x3c')]);_0x3083a9[_0xb1a0('0x40')]=_[_0xb1a0('0x54')](_0x5d0823[_0xb1a0('0x40')]);_0x3083a9[_0xb1a0('0x41')]=_[_0xb1a0('0x42')](_0x3083a9[_0xb1a0('0x43')],_0x3083a9['query']);_0x3b9441[_0xb1a0('0x44')]=_['intersection'](_0x3083a9[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x5d0823['query']['fields']));_0x3b9441[_0xb1a0('0x44')]=_0x3b9441[_0xb1a0('0x44')][_0xb1a0('0x55')]?_0x3b9441['attributes']:_0x3083a9[_0xb1a0('0x43')];if(!_0x5d0823[_0xb1a0('0x40')]['hasOwnProperty'](_0xb1a0('0x64'))){_0x3b9441[_0xb1a0('0x2d')]=qs[_0xb1a0('0x2d')](_0x5d0823[_0xb1a0('0x40')][_0xb1a0('0x2d')]);_0x3b9441['offset']=qs[_0xb1a0('0x2b')](_0x5d0823['query']['offset']);}_0x3b9441[_0xb1a0('0x47')]=qs[_0xb1a0('0x48')](_0x5d0823[_0xb1a0('0x40')][_0xb1a0('0x48')]);_0x3b9441[_0xb1a0('0x49')]=qs[_0xb1a0('0x41')](_[_0xb1a0('0x4a')](_0x5d0823['query'],_0x3083a9[_0xb1a0('0x41')]));_0x3b9441[_0xb1a0('0x49')][_0xb1a0('0x60')]=_0xec6565['id'];if(_0x5d0823[_0xb1a0('0x40')][_0xb1a0('0x4b')]){_0x3b9441['where']=_[_0xb1a0('0x4c')](_0x3b9441[_0xb1a0('0x49')],{'$or':_[_0xb1a0('0x3a')](_0x3b9441[_0xb1a0('0x44')],function(_0x2a3389){var _0x9933df={};_0x9933df[_0x2a3389]={'$like':'%'+_0x5d0823['query'][_0xb1a0('0x4b')]+'%'};return _0x9933df;})});}_0x3b9441=_['merge']({},_0x3b9441,_0x5d0823[_0xb1a0('0x4e')]);return db[_0xb1a0('0x89')][_0xb1a0('0x2e')]({'where':_0x3b9441[_0xb1a0('0x49')]})[_0xb1a0('0x22')](function(_0x12471d){_0x346c5d[_0xb1a0('0x2e')]=_0x12471d;if(_0x5d0823[_0xb1a0('0x40')][_0xb1a0('0x4f')]){_0x3b9441[_0xb1a0('0x56')]=[{'model':db['CmContact'],'as':_0xb1a0('0xaa'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xb1a0('0x3f'),_0xb1a0('0xab'),_0xb1a0('0xac')],'required':![]},{'model':db[_0xb1a0('0xad')],'as':'Tags','attributes':['id',_0xb1a0('0x3f'),_0xb1a0('0xae')],'where':_0x5d0823['query'][_0xb1a0('0xaf')]?{'id':_0x5d0823['query'][_0xb1a0('0xaf')]}:undefined,'required':_0x5d0823[_0xb1a0('0x40')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xb1a0('0x50')](_0x3b9441);})[_0xb1a0('0x22')](function(_0x45fc91){_0x346c5d[_0xb1a0('0x51')]=_0x45fc91;return _0x346c5d;});}})[_0xb1a0('0x22')](respondWithFilteredResult(_0x4f198b,_0x3b9441))[_0xb1a0('0x28')](handleError(_0x4f198b,null));};exports[_0xb1a0('0xb0')]=function(_0x1ac2ca,_0x2c3f93,_0x2732e8){return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x1ac2ca['params']['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x2c3f93,null))[_0xb1a0('0x22')](function(_0x49bf10){if(_0x49bf10){return _0x49bf10[_0xb1a0('0xb0')](_0x1ac2ca['body'][_0xb1a0('0x66')],_[_0xb1a0('0xb1')](_0x1ac2ca['body'],[_0xb1a0('0x66'),'id'])||{})[_0xb1a0('0x8b')](function(_0x11ee8d){for(var _0x2a9558=0x0;_0x2a9558<_0x1ac2ca['body'][_0xb1a0('0x66')][_0xb1a0('0x55')];_0x2a9558+=0x1){socket[_0xb1a0('0xb2')]('userOpenchannelAccount:save',{'UserId':Number(_0x1ac2ca[_0xb1a0('0x59')]['ids'][_0x2a9558]),'OpenchannelAccountId':Number(_0x1ac2ca[_0xb1a0('0x53')]['id'])});}return _0x11ee8d;});}})[_0xb1a0('0x22')](respondWithResult(_0x2c3f93,null))[_0xb1a0('0x28')](handleError(_0x2c3f93,null));};exports[_0xb1a0('0xb3')]=function(_0x4c0678,_0x1a7a1b,_0x2f1d67){return db['OpenchannelAccount'][_0xb1a0('0x57')]({'where':{'id':_0x4c0678['params']['id']}})['then'](handleEntityNotFound(_0x1a7a1b,null))[_0xb1a0('0x22')](function(_0xb25c6c){if(_0xb25c6c){return _0xb25c6c[_0xb1a0('0xb3')](_0x4c0678['query'][_0xb1a0('0x66')])[_0xb1a0('0x22')](function(){if(_[_0xb1a0('0xb4')](_0x4c0678[_0xb1a0('0x40')][_0xb1a0('0x66')])){for(var _0x5885d5=0x0;_0x5885d5<_0x4c0678[_0xb1a0('0x40')][_0xb1a0('0x66')]['length'];_0x5885d5+=0x1){socket[_0xb1a0('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4c0678[_0xb1a0('0x40')][_0xb1a0('0x66')][_0x5885d5]),'OpenchannelAccountId':Number(_0x4c0678[_0xb1a0('0x53')]['id'])});}}else{socket[_0xb1a0('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4c0678['query']['ids']),'OpenchannelAccountId':Number(_0x4c0678[_0xb1a0('0x53')]['id'])});}});}})[_0xb1a0('0x22')](respondWithStatusCode(_0x1a7a1b,null))[_0xb1a0('0x28')](handleError(_0x1a7a1b,null));};exports['getAgents']=function(_0xcae218,_0x591657,_0x4d1b83){var _0x15cdce={};var _0x2ba0a6={};var _0x56c51c;var _0x496a0b;return db[_0xb1a0('0x3b')]['findOne']({'where':{'id':_0xcae218[_0xb1a0('0x53')]['id']}})['then'](handleEntityNotFound(_0x591657,null))['then'](function(_0x57f10d){if(_0x57f10d){_0x56c51c=_0x57f10d;_0x2ba0a6[_0xb1a0('0x43')]=_[_0xb1a0('0x54')](db[_0xb1a0('0x96')][_0xb1a0('0x3c')]);_0x2ba0a6[_0xb1a0('0x40')]=_[_0xb1a0('0x54')](_0xcae218['query']);_0x2ba0a6[_0xb1a0('0x41')]=_['intersection'](_0x2ba0a6[_0xb1a0('0x43')],_0x2ba0a6[_0xb1a0('0x40')]);_0x15cdce['attributes']=_[_0xb1a0('0x42')](_0x2ba0a6[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0xcae218[_0xb1a0('0x40')][_0xb1a0('0x45')]));_0x15cdce['attributes']=_0x15cdce[_0xb1a0('0x44')][_0xb1a0('0x55')]?_0x15cdce['attributes']:_0x2ba0a6[_0xb1a0('0x43')];_0x15cdce[_0xb1a0('0x47')]=qs['sort'](_0xcae218[_0xb1a0('0x40')][_0xb1a0('0x48')]);_0x15cdce[_0xb1a0('0x49')]=qs['filters'](_[_0xb1a0('0x4a')](_0xcae218[_0xb1a0('0x40')],_0x2ba0a6['filters']));if(_0xcae218['query'][_0xb1a0('0x4b')]){_0x15cdce[_0xb1a0('0x49')]=_['merge'](_0x15cdce['where'],{'$or':_[_0xb1a0('0x3a')](_0x15cdce['attributes'],function(_0x218343){var _0x1eb1b4={};_0x1eb1b4[_0x218343]={'$like':'%'+_0xcae218[_0xb1a0('0x40')]['filter']+'%'};return _0x1eb1b4;})});}_0x15cdce=_['merge']({},_0x15cdce,_0xcae218[_0xb1a0('0x4e')]);return _0x56c51c['getAgents'](_0x15cdce);}})[_0xb1a0('0x22')](function(_0xb9152d){if(_0xb9152d){_0x496a0b=_0xb9152d['length'];if(!_0xcae218['query'][_0xb1a0('0x46')](_0xb1a0('0x64'))){_0x15cdce[_0xb1a0('0x2d')]=qs[_0xb1a0('0x2d')](_0xcae218[_0xb1a0('0x40')][_0xb1a0('0x2d')]);_0x15cdce[_0xb1a0('0x2b')]=qs[_0xb1a0('0x2b')](_0xcae218[_0xb1a0('0x40')][_0xb1a0('0x2b')]);}return _0x56c51c[_0xb1a0('0xb5')](_0x15cdce);}})['then'](function(_0x58e1c4){if(_0x58e1c4){return _0x58e1c4?{'count':_0x496a0b,'rows':_0x58e1c4}:null;}})[_0xb1a0('0x22')](respondWithResult(_0x591657,null))[_0xb1a0('0x28')](handleError(_0x591657,null));};exports['send']=function(_0x185c04,_0x1550f5,_0x5aad4f){var _0x20275b,_0x429a5a,_0x162774;if(_[_0xb1a0('0x70')](_0x185c04[_0xb1a0('0x59')][_0xb1a0('0x59')])||_0x185c04[_0xb1a0('0x59')][_0xb1a0('0x59')]===''){throw new db[(_0xb1a0('0x72'))][(_0xb1a0('0x69'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb1a0('0x70')](_0x185c04[_0xb1a0('0x59')]['to'])){}_0x20275b=_0x185c04[_0xb1a0('0x59')]['to'];return db[_0xb1a0('0x3b')][_0xb1a0('0x63')]({'where':{'id':_0x185c04['params']['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x1550f5,null))[_0xb1a0('0x22')](function(_0x26162d){if(_0x26162d){return db[_0xb1a0('0x3b')]['find']({'where':{'id':_0x26162d['id']},'include':[{'model':db[_0xb1a0('0x79')],'as':_0xb1a0('0x7e'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x26162d['mapKey']]:_0x20275b},'limit':0x1,'order':[[_0xb1a0('0x6d'),_0xb1a0('0x7c')]]}]}]})[_0xb1a0('0x22')](handleEntityNotFound(_0x1550f5,null))[_0xb1a0('0x22')](function(_0x4931b7){if(_0x4931b7&&_0x4931b7[_0xb1a0('0x7e')]){_0x429a5a=_0x4931b7[_0xb1a0('0x5b')]({'plain':!![]});if(_0x429a5a['List']&&_0x429a5a['List'][_0xb1a0('0x7b')][_0xb1a0('0x55')]){return _0x429a5a[_0xb1a0('0x7e')][_0xb1a0('0x7b')][0x0];}return db[_0xb1a0('0x7a')][_0xb1a0('0x58')](_[_0xb1a0('0x18')](_0x185c04[_0xb1a0('0x59')],{'firstName':_0x20275b,[_0x4931b7[_0xb1a0('0x75')]]:_0x20275b,'phone':_0x20275b,'ListId':_0x429a5a[_0xb1a0('0x6f')]}));}})[_0xb1a0('0x22')](handleEntityNotFound(_0x1550f5,null))[_0xb1a0('0x22')](function(_0x3631a9){if(_0x3631a9){_0x162774=_0x3631a9;return db[_0xb1a0('0x89')][_0xb1a0('0x57')]({'where':{'ContactId':_0x162774['id'],'closed':![],'OpenchannelAccountId':_0x429a5a['id']}})['then'](function(_0x1e5a3f){if(_0x1e5a3f){return[_0x1e5a3f,![]];}return db[_0xb1a0('0x89')][_0xb1a0('0x58')]({'UserId':_0x185c04['user']['id'],'ContactId':_0x162774['id'],'OpenchannelAccountId':_0x429a5a['id'],'lastMsgDirection':_0xb1a0('0xb6'),'firstMsgDirection':_0xb1a0('0xb6'),'Messages':[_[_0xb1a0('0x4c')](_0x185c04['body'],{'read':![],'body':_0x185c04[_0xb1a0('0x59')][_0xb1a0('0x59')],'OpenchannelAccountId':_0x429a5a['id'],'UserId':_0x185c04[_0xb1a0('0x5a')]['id'],'ContactId':_0x162774['id']})]},{'include':[{'model':db[_0xb1a0('0x93')],'as':_0xb1a0('0xb7')}]})[_0xb1a0('0x22')](function(_0x34a84f){return[_0x34a84f,!![]];});});}})[_0xb1a0('0x8b')](function(_0x4b73a4,_0x5dc3e8){if(_0x5dc3e8){return _0x4b73a4;}return db[_0xb1a0('0x93')][_0xb1a0('0x58')](_[_0xb1a0('0x4c')](_0x185c04[_0xb1a0('0x59')],{'read':![],'body':_0x185c04['body'][_0xb1a0('0x59')],'OpenchannelAccountId':_0x429a5a['id'],'OpenchannelInteractionId':_0x4b73a4['id'],'UserId':_0x185c04[_0xb1a0('0x5a')]['id'],'ContactId':_0x162774['id']}))[_0xb1a0('0x22')](function(_0x5622ab){_0x4b73a4[_0xb1a0('0xb8')][_0xb1a0('0xb7')]=[];_0x4b73a4['dataValues']['Messages'][_0xb1a0('0x90')](_0x5622ab['dataValues']);return _0x4b73a4;});});}})['then'](respondWithResult(_0x1550f5,null))['catch'](handleError(_0x1550f5,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 1c87432..f3e4daa 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 _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x5d8b5e,_0x19c68e){var _0x90dea0=function(_0x4e832a){while(--_0x4e832a){_0x5d8b5e['push'](_0x5d8b5e['shift']());}};_0x90dea0(++_0x19c68e);}(_0x13f6,0x124));var _0x613f=function(_0x46538e,_0x1a2620){_0x46538e=_0x46538e-0x0;var _0x4da081=_0x13f6[_0x46538e];return _0x4da081;};'use strict';var EventEmitter=require(_0x613f('0x0'));var OpenchannelAccount=require(_0x613f('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){OpenchannelAccountEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);OpenchannelAccountEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x6f0d=['remove','emit','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x2e2676,_0x581376){var _0x38997b=function(_0x509528){while(--_0x509528){_0x2e2676['push'](_0x2e2676['shift']());}};_0x38997b(++_0x581376);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4b8609,_0x45bfdc){_0x4b8609=_0x4b8609-0x0;var _0x1f2269=_0x6f0d[_0x4b8609];return _0x1f2269;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xd6f0('0x0'))['db'][_0xd6f0('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd6f0('0x2')](0x0);var events={'afterCreate':_0xd6f0('0x3'),'afterUpdate':'update','afterDestroy':_0xd6f0('0x4')};function emitEvent(_0x135a93){return function(_0x2f78fb,_0x25344b,_0x3a757f){OpenchannelAccountEvents['emit'](_0x135a93+':'+_0x2f78fb['id'],_0x2f78fb);OpenchannelAccountEvents[_0xd6f0('0x5')](_0x135a93,_0x2f78fb);_0x3a757f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xd6f0('0x6')](e,emitEvent(event));}}module[_0xd6f0('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 107b970..f5c7de5 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(_0xad5150,_0x4d0c3c){var _0x55cc8b=function(_0x52a2ef){while(--_0x52a2ef){_0xad5150['push'](_0xad5150['shift']());}};_0x55cc8b(++_0x4d0c3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x329572,_0x5dbb9f){var _0x15bd1f=function(_0x271455){while(--_0x271455){_0x329572['push'](_0x329572['shift']());}};_0x15bd1f(++_0x5dbb9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 2c284b1..dcace57 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 _0x41bb=['stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x272b70,_0x2ed3c4){var _0x406b78=function(_0x570726){while(--_0x570726){_0x272b70['push'](_0x272b70['shift']());}};_0x406b78(++_0x2ed3c4);}(_0x41bb,0xc5));var _0xb41b=function(_0x30974f,_0x31c0c2){_0x30974f=_0x30974f-0x0;var _0x38d25d=_0x41bb[_0x30974f];return _0x38d25d;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xb41b('0xa')],{'host':_0xb41b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb41b('0xa')]));require(_0xb41b('0xc'))[_0xb41b('0xd')](socket);function respondWithRpcPromise(_0xa2aa66,_0x26d531,_0x11f049){return new BPromise(function(_0x5e5c5b,_0x4baa03){return client[_0xb41b('0xe')](_0xa2aa66,_0x11f049)['then'](function(_0x2e906c){logger[_0xb41b('0xf')](_0xb41b('0x10'),_0x26d531,_0xb41b('0x11'));logger[_0xb41b('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x26d531,_0xb41b('0x11'),JSON[_0xb41b('0x13')](_0x2e906c));if(_0x2e906c[_0xb41b('0x14')]){if(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x15')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x26d531,_0x2e906c['error'][_0xb41b('0x16')]);return _0x4baa03(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x16')]);}logger[_0xb41b('0x14')](_0xb41b('0x10'),_0x26d531,_0x2e906c['error'][_0xb41b('0x16')]);return _0x5e5c5b(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x16')]);}else{logger[_0xb41b('0xf')](_0xb41b('0x10'),_0x26d531,_0xb41b('0x11'));_0x5e5c5b(_0x2e906c[_0xb41b('0x17')]['message']);}})['catch'](function(_0x5da8e3){logger[_0xb41b('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x26d531,_0x5da8e3);_0x4baa03(_0x5da8e3);});});} \ No newline at end of file +var _0x6e6c=['OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1694ce,_0x220256){var _0x5895be=function(_0x3693e8){while(--_0x3693e8){_0x1694ce['push'](_0x1694ce['shift']());}};_0x5895be(++_0x220256);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var moment=require('moment');var BPromise=require(_0xc6e6('0x2'));var rs=require(_0xc6e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6e6('0x4'));var logger=require('../../config/logger')(_0xc6e6('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6e6('0x6'));var client=jayson[_0xc6e6('0x7')]['http']({'port':0x232a});config[_0xc6e6('0x8')]=_[_0xc6e6('0x9')](config['redis'],{'host':_0xc6e6('0xa'),'port':0x18eb});var socket=require(_0xc6e6('0xb'))(new Redis(config['redis']));require(_0xc6e6('0xc'))['register'](socket);function respondWithRpcPromise(_0x172aa9,_0x3b2f50,_0x29f78a){return new BPromise(function(_0x3ddf6f,_0x12596b){return client[_0xc6e6('0xd')](_0x172aa9,_0x29f78a)[_0xc6e6('0xe')](function(_0x10aae5){logger[_0xc6e6('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0xc6e6('0x10'));logger['debug'](_0xc6e6('0x11'),_0x3b2f50,_0xc6e6('0x10'),JSON[_0xc6e6('0x12')](_0x10aae5));if(_0x10aae5[_0xc6e6('0x13')]){if(_0x10aae5['error'][_0xc6e6('0x14')]===0x1f4){logger[_0xc6e6('0x13')](_0xc6e6('0x15'),_0x3b2f50,_0x10aae5[_0xc6e6('0x13')][_0xc6e6('0x16')]);return _0x12596b(_0x10aae5['error'][_0xc6e6('0x16')]);}logger[_0xc6e6('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0x10aae5[_0xc6e6('0x13')][_0xc6e6('0x16')]);return _0x3ddf6f(_0x10aae5[_0xc6e6('0x13')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0xc6e6('0x10'));_0x3ddf6f(_0x10aae5['result'][_0xc6e6('0x16')]);}})[_0xc6e6('0x17')](function(_0x1ecc8f){logger[_0xc6e6('0x13')](_0xc6e6('0x15'),_0x3b2f50,_0x1ecc8f);_0x12596b(_0x1ecc8f);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 95a2536..05b9412 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 _0x1da1=['./openchannelAccount.events','save','remove','update','emit','register'];(function(_0xa94837,_0x2004d2){var _0xab61c4=function(_0x348470){while(--_0x348470){_0xa94837['push'](_0xa94837['shift']());}};_0xab61c4(++_0x2004d2);}(_0x1da1,0x1a4));var _0x11da=function(_0x5676c4,_0x402978){_0x5676c4=_0x5676c4-0x0;var _0x382c12=_0x1da1[_0x5676c4];return _0x382c12;};'use strict';var OpenchannelAccountEvents=require(_0x11da('0x0'));var events=[_0x11da('0x1'),_0x11da('0x2'),_0x11da('0x3')];function createListener(_0x46896e,_0x5b0fe4){return function(_0x55af86){_0x5b0fe4[_0x11da('0x4')](_0x46896e,_0x55af86);};}function removeListener(_0x1beca5,_0x3d6bd5){return function(){OpenchannelAccountEvents['removeListener'](_0x1beca5,_0x3d6bd5);};}exports[_0x11da('0x5')]=function(_0x209cbb){for(var _0x15c324=0x0,_0x5ecc27=events['length'];_0x15c324<_0x5ecc27;_0x15c324++){var _0x287653=events[_0x15c324];var _0x109f4b=createListener('openchannelAccount:'+_0x287653,_0x209cbb);OpenchannelAccountEvents['on'](_0x287653,_0x109f4b);}}; \ No newline at end of file +var _0xc91b=['save','remove','update','emit','removeListener','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0xc91b,0x16f));var _0xbc91=function(_0x4dc244,_0x3c19d0){_0x4dc244=_0x4dc244-0x0;var _0x42e7ae=_0xc91b[_0x4dc244];return _0x42e7ae;};'use strict';var OpenchannelAccountEvents=require(_0xbc91('0x0'));var events=[_0xbc91('0x1'),_0xbc91('0x2'),_0xbc91('0x3')];function createListener(_0x2a5f39,_0xb4810d){return function(_0x1ac340){_0xb4810d[_0xbc91('0x4')](_0x2a5f39,_0x1ac340);};}function removeListener(_0x5e8e01,_0x38fe3a){return function(){OpenchannelAccountEvents[_0xbc91('0x5')](_0x5e8e01,_0x38fe3a);};}exports['register']=function(_0x222ed7){for(var _0x1e295b=0x0,_0x535cb9=events[_0xbc91('0x6')];_0x1e295b<_0x535cb9;_0x1e295b++){var _0x43731a=events[_0x1e295b];var _0x36e15f=createListener(_0xbc91('0x7')+_0x43731a,_0x222ed7);OpenchannelAccountEvents['on'](_0x43731a,_0x36e15f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index c8cbd5f..6adab7e 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 _0x3128=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x3128,0x118));var _0x8312=function(_0x46cf21,_0x2c1ac9){_0x46cf21=_0x46cf21-0x0;var _0x1c2cbe=_0x3128[_0x46cf21];return _0x1c2cbe;};'use strict';var multer=require(_0x8312('0x0'));var util=require(_0x8312('0x1'));var path=require(_0x8312('0x2'));var timeout=require(_0x8312('0x3'));var express=require(_0x8312('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8312('0x5'));var interaction=require(_0x8312('0x6'));var config=require(_0x8312('0x7'));var controller=require('./openchannelApplication.controller');router[_0x8312('0x8')]('/',auth['isAuthenticated'](),controller[_0x8312('0x9')]);router[_0x8312('0x8')](_0x8312('0xa'),auth[_0x8312('0xb')](),controller[_0x8312('0xc')]);router[_0x8312('0xd')]('/',auth[_0x8312('0xb')](),controller['create']);router[_0x8312('0xe')](_0x8312('0xa'),auth[_0x8312('0xb')](),controller[_0x8312('0xf')]);router[_0x8312('0x10')](_0x8312('0xa'),auth[_0x8312('0xb')](),controller[_0x8312('0x11')]);module[_0x8312('0x12')]=router; \ No newline at end of file +var _0x8d29=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','create','put','/:id','update'];(function(_0x57b540,_0x5eb3da){var _0x412e0f=function(_0x1a2bc4){while(--_0x1a2bc4){_0x57b540['push'](_0x57b540['shift']());}};_0x412e0f(++_0x5eb3da);}(_0x8d29,0x16c));var _0x98d2=function(_0x46b638,_0x4d784d){_0x46b638=_0x46b638-0x0;var _0x45a09d=_0x8d29[_0x46b638];return _0x45a09d;};'use strict';var multer=require('multer');var util=require(_0x98d2('0x0'));var path=require(_0x98d2('0x1'));var timeout=require(_0x98d2('0x2'));var express=require(_0x98d2('0x3'));var router=express[_0x98d2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x98d2('0x5'));var interaction=require(_0x98d2('0x6'));var config=require(_0x98d2('0x7'));var controller=require(_0x98d2('0x8'));router[_0x98d2('0x9')]('/',auth[_0x98d2('0xa')](),controller[_0x98d2('0xb')]);router[_0x98d2('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x98d2('0xa')](),controller[_0x98d2('0xc')]);router[_0x98d2('0xd')](_0x98d2('0xe'),auth[_0x98d2('0xa')](),controller[_0x98d2('0xf')]);router[_0x98d2('0x10')](_0x98d2('0xe'),auth[_0x98d2('0xa')](),controller[_0x98d2('0x11')]);module[_0x98d2('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 c10f60d..69dd6c3 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 _0x8af9=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x9e4a55,_0x15b54e){var _0x5bc4ec=function(_0x1727c1){while(--_0x1727c1){_0x9e4a55['push'](_0x9e4a55['shift']());}};_0x5bc4ec(++_0x15b54e);}(_0x8af9,0x1b6));var _0x98af=function(_0x144397,_0x5888af){_0x144397=_0x144397-0x0;var _0x5047c4=_0x8af9[_0x144397];return _0x5047c4;};'use strict';var Sequelize=require(_0x98af('0x0'));module[_0x98af('0x1')]={'priority':{'type':Sequelize[_0x98af('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x98af('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x98af('0x4')]()},'description':{'type':Sequelize[_0x98af('0x3')]},'interval':{'type':Sequelize[_0x98af('0x3')],'defaultValue':_0x98af('0x5')}}; \ No newline at end of file +var _0x49c8=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x1ba0a4,_0xf4dc80){var _0x561400=function(_0x54f3ef){while(--_0x54f3ef){_0x1ba0a4['push'](_0x1ba0a4['shift']());}};_0x561400(++_0xf4dc80);}(_0x49c8,0x14f));var _0x849c=function(_0x3cbbe0,_0x3a0614){_0x3cbbe0=_0x3cbbe0-0x0;var _0xb72693=_0x49c8[_0x3cbbe0];return _0xb72693;};'use strict';var Sequelize=require(_0x849c('0x0'));module[_0x849c('0x1')]={'priority':{'type':Sequelize[_0x849c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x849c('0x3')],'allowNull':![],'defaultValue':_0x849c('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x849c('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x849c('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 96ebbb0..02a93bd 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 _0xeab7=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model'];(function(_0xa06c99,_0x5a4d67){var _0x1e3e32=function(_0x4cc3e8){while(--_0x4cc3e8){_0xa06c99['push'](_0xa06c99['shift']());}};_0x1e3e32(++_0x5a4d67);}(_0xeab7,0x187));var _0x7eab=function(_0x163f34,_0x1222c6){_0x163f34=_0x163f34-0x0;var _0xe3975b=_0xeab7[_0x163f34];return _0xe3975b;};'use strict';var emlformat=require(_0x7eab('0x0'));var rimraf=require(_0x7eab('0x1'));var zipdir=require(_0x7eab('0x2'));var jsonpatch=require(_0x7eab('0x3'));var rp=require('request-promise');var moment=require(_0x7eab('0x4'));var BPromise=require(_0x7eab('0x5'));var Mustache=require(_0x7eab('0x6'));var util=require('util');var path=require(_0x7eab('0x7'));var sox=require('sox');var csv=require(_0x7eab('0x8'));var ejs=require(_0x7eab('0x9'));var fs=require('fs');var fs_extra=require(_0x7eab('0xa'));var _=require(_0x7eab('0xb'));var squel=require(_0x7eab('0xc'));var crypto=require(_0x7eab('0xd'));var jsforce=require(_0x7eab('0xe'));var deskjs=require(_0x7eab('0xf'));var toCsv=require(_0x7eab('0x8'));var querystring=require(_0x7eab('0x10'));var Papa=require(_0x7eab('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7eab('0x12'));var logger=require('../../config/logger')(_0x7eab('0x13'));var utils=require(_0x7eab('0x14'));var config=require(_0x7eab('0x15'));var licenseUtil=require(_0x7eab('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd3df,_0x50a102){_0x50a102=_0x50a102||0xcc;return function(_0x3479be){if(_0x3479be){return _0x5dd3df['sendStatus'](_0x50a102);}return _0x5dd3df[_0x7eab('0x17')](_0x50a102)[_0x7eab('0x18')]();};}function respondWithResult(_0x33e9ac,_0xcdcbc5){_0xcdcbc5=_0xcdcbc5||0xc8;return function(_0x1041df){if(_0x1041df){return _0x33e9ac[_0x7eab('0x17')](_0xcdcbc5)[_0x7eab('0x19')](_0x1041df);}};}function respondWithFilteredResult(_0x3bb069,_0x3de6f6){return function(_0x27f24f){if(_0x27f24f){var _0x2a9368=typeof _0x3de6f6[_0x7eab('0x1a')]===_0x7eab('0x1b')&&typeof _0x3de6f6[_0x7eab('0x1c')]===_0x7eab('0x1b');var _0x6d3d7a=_0x27f24f['count'];var _0x448735=_0x2a9368?0x0:_0x3de6f6[_0x7eab('0x1a')];var _0x17c6e8=_0x2a9368?_0x27f24f[_0x7eab('0x1d')]:_0x3de6f6[_0x7eab('0x1a')]+_0x3de6f6[_0x7eab('0x1c')];var _0x2c3105;if(_0x17c6e8>=_0x6d3d7a){_0x17c6e8=_0x6d3d7a;_0x2c3105=0xc8;}else{_0x2c3105=0xce;}_0x3bb069[_0x7eab('0x17')](_0x2c3105);return _0x3bb069[_0x7eab('0x1e')](_0x7eab('0x1f'),_0x448735+'-'+_0x17c6e8+'/'+_0x6d3d7a)[_0x7eab('0x19')](_0x27f24f);}return null;};}function patchUpdates(_0x44290f){return function(_0x622c4c){try{jsonpatch['apply'](_0x622c4c,_0x44290f,!![]);}catch(_0x416652){return BPromise['reject'](_0x416652);}return _0x622c4c['save']();};}function saveUpdates(_0x40235e,_0x4b3911){return function(_0x34051b){if(_0x34051b){return _0x34051b[_0x7eab('0x20')](_0x40235e)[_0x7eab('0x21')](function(_0x3d88e8){return _0x3d88e8;});}return null;};}function removeEntity(_0x15b39b,_0x490a19){return function(_0x5ed664){if(_0x5ed664){return _0x5ed664[_0x7eab('0x22')]()['then'](function(){_0x15b39b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x420b98,_0x124248){return function(_0x44d9cf){if(!_0x44d9cf){_0x420b98[_0x7eab('0x23')](0x194);}return _0x44d9cf;};}function handleError(_0x3bacc1,_0x503893){_0x503893=_0x503893||0x1f4;return function(_0x207645){logger[_0x7eab('0x24')](_0x207645[_0x7eab('0x25')]);if(_0x207645['name']){delete _0x207645[_0x7eab('0x26')];}_0x3bacc1[_0x7eab('0x17')](_0x503893)[_0x7eab('0x27')](_0x207645);};}exports[_0x7eab('0x28')]=function(_0x4f6ac3,_0x2d4ea4){var _0x4453f7={},_0x5dc914={},_0x1644be={'count':0x0,'rows':[]};var _0xcc2833=_[_0x7eab('0x29')](db[_0x7eab('0x2a')][_0x7eab('0x2b')],function(_0x59efb1){return{'name':_0x59efb1['fieldName'],'type':_0x59efb1[_0x7eab('0x2c')][_0x7eab('0x2d')]};});_0x5dc914[_0x7eab('0x2e')]=_[_0x7eab('0x29')](_0xcc2833,_0x7eab('0x26'));_0x5dc914[_0x7eab('0x2f')]=_[_0x7eab('0x30')](_0x4f6ac3[_0x7eab('0x2f')]);_0x5dc914['filters']=_[_0x7eab('0x31')](_0x5dc914[_0x7eab('0x2e')],_0x5dc914[_0x7eab('0x2f')]);_0x4453f7[_0x7eab('0x32')]=_[_0x7eab('0x31')](_0x5dc914[_0x7eab('0x2e')],qs[_0x7eab('0x33')](_0x4f6ac3[_0x7eab('0x2f')][_0x7eab('0x33')]));_0x4453f7['attributes']=_0x4453f7[_0x7eab('0x32')][_0x7eab('0x34')]?_0x4453f7[_0x7eab('0x32')]:_0x5dc914[_0x7eab('0x2e')];if(!_0x4f6ac3['query'][_0x7eab('0x35')](_0x7eab('0x36'))){_0x4453f7[_0x7eab('0x1c')]=qs[_0x7eab('0x1c')](_0x4f6ac3['query'][_0x7eab('0x1c')]);_0x4453f7[_0x7eab('0x1a')]=qs[_0x7eab('0x1a')](_0x4f6ac3[_0x7eab('0x2f')][_0x7eab('0x1a')]);}_0x4453f7['order']=qs[_0x7eab('0x37')](_0x4f6ac3[_0x7eab('0x2f')][_0x7eab('0x37')]);_0x4453f7[_0x7eab('0x38')]=qs[_0x7eab('0x39')](_[_0x7eab('0x3a')](_0x4f6ac3[_0x7eab('0x2f')],_0x5dc914[_0x7eab('0x39')]),_0xcc2833);if(_0x4f6ac3[_0x7eab('0x2f')][_0x7eab('0x3b')]){_0x4453f7[_0x7eab('0x38')]=_[_0x7eab('0x3c')](_0x4453f7[_0x7eab('0x38')],{'$or':_[_0x7eab('0x29')](_0xcc2833,function(_0x232082){if(_0x232082[_0x7eab('0x2c')]!==_0x7eab('0x3d')){var _0x10fe68={};_0x10fe68[_0x232082[_0x7eab('0x26')]]={'$like':'%'+_0x4f6ac3['query'][_0x7eab('0x3b')]+'%'};return _0x10fe68;}})});}_0x4453f7=_[_0x7eab('0x3c')]({},_0x4453f7,_0x4f6ac3[_0x7eab('0x3e')]);var _0x3bce1e={'where':_0x4453f7['where']};return db[_0x7eab('0x2a')][_0x7eab('0x1d')](_0x3bce1e)[_0x7eab('0x21')](function(_0x1d3c09){_0x1644be['count']=_0x1d3c09;if(_0x4f6ac3[_0x7eab('0x2f')][_0x7eab('0x3f')]){_0x4453f7[_0x7eab('0x40')]=[{'all':!![]}];}return db[_0x7eab('0x2a')][_0x7eab('0x41')](_0x4453f7);})[_0x7eab('0x21')](function(_0x5c4f73){_0x1644be[_0x7eab('0x42')]=_0x5c4f73;return _0x1644be;})[_0x7eab('0x21')](respondWithFilteredResult(_0x2d4ea4,_0x4453f7))[_0x7eab('0x43')](handleError(_0x2d4ea4,null));};exports[_0x7eab('0x44')]=function(_0x3943f9,_0x895382){var _0x36af32={'raw':!![],'where':{'id':_0x3943f9[_0x7eab('0x45')]['id']}},_0x5325ea={};_0x5325ea['model']=_[_0x7eab('0x30')](db[_0x7eab('0x2a')]['rawAttributes']);_0x5325ea['query']=_[_0x7eab('0x30')](_0x3943f9['query']);_0x5325ea[_0x7eab('0x39')]=_[_0x7eab('0x31')](_0x5325ea[_0x7eab('0x2e')],_0x5325ea['query']);_0x36af32[_0x7eab('0x32')]=_[_0x7eab('0x31')](_0x5325ea[_0x7eab('0x2e')],qs[_0x7eab('0x33')](_0x3943f9[_0x7eab('0x2f')][_0x7eab('0x33')]));_0x36af32[_0x7eab('0x32')]=_0x36af32[_0x7eab('0x32')][_0x7eab('0x34')]?_0x36af32[_0x7eab('0x32')]:_0x5325ea[_0x7eab('0x2e')];if(_0x3943f9['query'][_0x7eab('0x3f')]){_0x36af32[_0x7eab('0x40')]=[{'all':!![]}];}_0x36af32=_[_0x7eab('0x3c')]({},_0x36af32,_0x3943f9[_0x7eab('0x3e')]);return db[_0x7eab('0x2a')][_0x7eab('0x46')](_0x36af32)[_0x7eab('0x21')](handleEntityNotFound(_0x895382,null))['then'](respondWithResult(_0x895382,null))[_0x7eab('0x43')](handleError(_0x895382,null));};exports[_0x7eab('0x47')]=function(_0x4b97d4,_0x506753){return db[_0x7eab('0x2a')][_0x7eab('0x47')](_0x4b97d4[_0x7eab('0x48')],{})[_0x7eab('0x21')](respondWithResult(_0x506753,0xc9))[_0x7eab('0x43')](handleError(_0x506753,null));};exports['update']=function(_0x1dbd61,_0xaa103c){if(_0x1dbd61[_0x7eab('0x48')]['id']){delete _0x1dbd61[_0x7eab('0x48')]['id'];}return db[_0x7eab('0x2a')]['find']({'where':{'id':_0x1dbd61[_0x7eab('0x45')]['id']}})[_0x7eab('0x21')](handleEntityNotFound(_0xaa103c,null))[_0x7eab('0x21')](saveUpdates(_0x1dbd61[_0x7eab('0x48')],null))[_0x7eab('0x21')](respondWithResult(_0xaa103c,null))[_0x7eab('0x43')](handleError(_0xaa103c,null));};exports[_0x7eab('0x22')]=function(_0x364b85,_0x51bc78){return db[_0x7eab('0x2a')][_0x7eab('0x46')]({'where':{'id':_0x364b85[_0x7eab('0x45')]['id']}})[_0x7eab('0x21')](handleEntityNotFound(_0x51bc78,null))[_0x7eab('0x21')](removeEntity(_0x51bc78,null))['catch'](handleError(_0x51bc78,null));}; \ No newline at end of file +var _0xa49a=['sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','rawAttributes','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','map','OpenchannelApplication','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xa49a,0x139));var _0xaa49=function(_0x1f7521,_0x1d41f7){_0x1f7521=_0x1f7521-0x0;var _0x42b163=_0xa49a[_0x1f7521];return _0x42b163;};'use strict';var emlformat=require(_0xaa49('0x0'));var rimraf=require(_0xaa49('0x1'));var zipdir=require(_0xaa49('0x2'));var jsonpatch=require(_0xaa49('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaa49('0x4'));var Mustache=require(_0xaa49('0x5'));var util=require('util');var path=require(_0xaa49('0x6'));var sox=require(_0xaa49('0x7'));var csv=require(_0xaa49('0x8'));var ejs=require(_0xaa49('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa49('0xa'));var squel=require(_0xaa49('0xb'));var crypto=require(_0xaa49('0xc'));var jsforce=require(_0xaa49('0xd'));var deskjs=require(_0xaa49('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaa49('0xf'));var authService=require(_0xaa49('0x10'));var qs=require(_0xaa49('0x11'));var as=require(_0xaa49('0x12'));var hardwareService=require(_0xaa49('0x13'));var logger=require(_0xaa49('0x14'))(_0xaa49('0x15'));var utils=require(_0xaa49('0x16'));var config=require(_0xaa49('0x17'));var licenseUtil=require(_0xaa49('0x18'));var db=require(_0xaa49('0x19'))['db'];function respondWithStatusCode(_0x5527b3,_0x404041){_0x404041=_0x404041||0xcc;return function(_0x151147){if(_0x151147){return _0x5527b3['sendStatus'](_0x404041);}return _0x5527b3['status'](_0x404041)[_0xaa49('0x1a')]();};}function respondWithResult(_0x43c6b4,_0x198365){_0x198365=_0x198365||0xc8;return function(_0x497633){if(_0x497633){return _0x43c6b4[_0xaa49('0x1b')](_0x198365)['json'](_0x497633);}};}function respondWithFilteredResult(_0x5e067b,_0x11ec7b){return function(_0x27a98e){if(_0x27a98e){var _0x144a6d=typeof _0x11ec7b['offset']===_0xaa49('0x1c')&&typeof _0x11ec7b[_0xaa49('0x1d')]===_0xaa49('0x1c');var _0x5f4140=_0x27a98e[_0xaa49('0x1e')];var _0x4fa190=_0x144a6d?0x0:_0x11ec7b[_0xaa49('0x1f')];var _0x22bea9=_0x144a6d?_0x27a98e[_0xaa49('0x1e')]:_0x11ec7b[_0xaa49('0x1f')]+_0x11ec7b['limit'];var _0x13d8fe;if(_0x22bea9>=_0x5f4140){_0x22bea9=_0x5f4140;_0x13d8fe=0xc8;}else{_0x13d8fe=0xce;}_0x5e067b['status'](_0x13d8fe);return _0x5e067b['set'](_0xaa49('0x20'),_0x4fa190+'-'+_0x22bea9+'/'+_0x5f4140)[_0xaa49('0x21')](_0x27a98e);}return null;};}function patchUpdates(_0x3ce0aa){return function(_0x45aba9){try{jsonpatch['apply'](_0x45aba9,_0x3ce0aa,!![]);}catch(_0x3d7e18){return BPromise[_0xaa49('0x22')](_0x3d7e18);}return _0x45aba9[_0xaa49('0x23')]();};}function saveUpdates(_0x876141,_0x198e29){return function(_0x24a2f8){if(_0x24a2f8){return _0x24a2f8[_0xaa49('0x24')](_0x876141)['then'](function(_0x3c4c1d){return _0x3c4c1d;});}return null;};}function removeEntity(_0x35c3d4,_0x3d73a2){return function(_0x3f9428){if(_0x3f9428){return _0x3f9428[_0xaa49('0x25')]()[_0xaa49('0x26')](function(){_0x35c3d4[_0xaa49('0x1b')](0xcc)[_0xaa49('0x1a')]();});}};}function handleEntityNotFound(_0x5f1b69,_0x5d2b57){return function(_0x465993){if(!_0x465993){_0x5f1b69['sendStatus'](0x194);}return _0x465993;};}function handleError(_0x4ae9a0,_0x4802b5){_0x4802b5=_0x4802b5||0x1f4;return function(_0x24249f){logger[_0xaa49('0x27')](_0x24249f[_0xaa49('0x28')]);if(_0x24249f[_0xaa49('0x29')]){delete _0x24249f[_0xaa49('0x29')];}_0x4ae9a0[_0xaa49('0x1b')](_0x4802b5)[_0xaa49('0x2a')](_0x24249f);};}exports['index']=function(_0x342fc2,_0x4abb63){var _0x44b90c={},_0x4d7154={},_0x12e7d2={'count':0x0,'rows':[]};var _0x5e177b=_[_0xaa49('0x2b')](db[_0xaa49('0x2c')]['rawAttributes'],function(_0x3d276c){return{'name':_0x3d276c['fieldName'],'type':_0x3d276c[_0xaa49('0x2d')][_0xaa49('0x2e')]};});_0x4d7154[_0xaa49('0x2f')]=_[_0xaa49('0x2b')](_0x5e177b,_0xaa49('0x29'));_0x4d7154[_0xaa49('0x30')]=_['keys'](_0x342fc2[_0xaa49('0x30')]);_0x4d7154[_0xaa49('0x31')]=_[_0xaa49('0x32')](_0x4d7154['model'],_0x4d7154['query']);_0x44b90c[_0xaa49('0x33')]=_[_0xaa49('0x32')](_0x4d7154[_0xaa49('0x2f')],qs[_0xaa49('0x34')](_0x342fc2['query'][_0xaa49('0x34')]));_0x44b90c['attributes']=_0x44b90c['attributes'][_0xaa49('0x35')]?_0x44b90c[_0xaa49('0x33')]:_0x4d7154[_0xaa49('0x2f')];if(!_0x342fc2[_0xaa49('0x30')][_0xaa49('0x36')](_0xaa49('0x37'))){_0x44b90c[_0xaa49('0x1d')]=qs[_0xaa49('0x1d')](_0x342fc2[_0xaa49('0x30')][_0xaa49('0x1d')]);_0x44b90c[_0xaa49('0x1f')]=qs[_0xaa49('0x1f')](_0x342fc2['query'][_0xaa49('0x1f')]);}_0x44b90c[_0xaa49('0x38')]=qs[_0xaa49('0x39')](_0x342fc2[_0xaa49('0x30')][_0xaa49('0x39')]);_0x44b90c[_0xaa49('0x3a')]=qs[_0xaa49('0x31')](_[_0xaa49('0x3b')](_0x342fc2[_0xaa49('0x30')],_0x4d7154[_0xaa49('0x31')]),_0x5e177b);if(_0x342fc2[_0xaa49('0x30')]['filter']){_0x44b90c[_0xaa49('0x3a')]=_[_0xaa49('0x3c')](_0x44b90c[_0xaa49('0x3a')],{'$or':_[_0xaa49('0x2b')](_0x5e177b,function(_0x592b53){if(_0x592b53['type']!==_0xaa49('0x3d')){var _0x3468eb={};_0x3468eb[_0x592b53[_0xaa49('0x29')]]={'$like':'%'+_0x342fc2[_0xaa49('0x30')]['filter']+'%'};return _0x3468eb;}})});}_0x44b90c=_['merge']({},_0x44b90c,_0x342fc2[_0xaa49('0x3e')]);var _0x4de4cc={'where':_0x44b90c['where']};return db['OpenchannelApplication']['count'](_0x4de4cc)[_0xaa49('0x26')](function(_0xebddcf){_0x12e7d2[_0xaa49('0x1e')]=_0xebddcf;if(_0x342fc2['query'][_0xaa49('0x3f')]){_0x44b90c[_0xaa49('0x40')]=[{'all':!![]}];}return db[_0xaa49('0x2c')]['findAll'](_0x44b90c);})['then'](function(_0x150986){_0x12e7d2[_0xaa49('0x41')]=_0x150986;return _0x12e7d2;})[_0xaa49('0x26')](respondWithFilteredResult(_0x4abb63,_0x44b90c))['catch'](handleError(_0x4abb63,null));};exports[_0xaa49('0x42')]=function(_0x1c91b9,_0x432db9){var _0x454008={'raw':!![],'where':{'id':_0x1c91b9[_0xaa49('0x43')]['id']}},_0x200052={};_0x200052[_0xaa49('0x2f')]=_[_0xaa49('0x44')](db[_0xaa49('0x2c')][_0xaa49('0x45')]);_0x200052['query']=_[_0xaa49('0x44')](_0x1c91b9[_0xaa49('0x30')]);_0x200052['filters']=_[_0xaa49('0x32')](_0x200052[_0xaa49('0x2f')],_0x200052[_0xaa49('0x30')]);_0x454008[_0xaa49('0x33')]=_[_0xaa49('0x32')](_0x200052[_0xaa49('0x2f')],qs[_0xaa49('0x34')](_0x1c91b9['query']['fields']));_0x454008[_0xaa49('0x33')]=_0x454008[_0xaa49('0x33')][_0xaa49('0x35')]?_0x454008['attributes']:_0x200052['model'];if(_0x1c91b9[_0xaa49('0x30')][_0xaa49('0x3f')]){_0x454008['include']=[{'all':!![]}];}_0x454008=_[_0xaa49('0x3c')]({},_0x454008,_0x1c91b9[_0xaa49('0x3e')]);return db[_0xaa49('0x2c')]['find'](_0x454008)['then'](handleEntityNotFound(_0x432db9,null))[_0xaa49('0x26')](respondWithResult(_0x432db9,null))[_0xaa49('0x46')](handleError(_0x432db9,null));};exports['create']=function(_0x111285,_0x157df0){return db[_0xaa49('0x2c')][_0xaa49('0x47')](_0x111285[_0xaa49('0x48')],{})['then'](respondWithResult(_0x157df0,0xc9))[_0xaa49('0x46')](handleError(_0x157df0,null));};exports[_0xaa49('0x24')]=function(_0x9c7104,_0xf3425c){if(_0x9c7104['body']['id']){delete _0x9c7104['body']['id'];}return db[_0xaa49('0x2c')][_0xaa49('0x49')]({'where':{'id':_0x9c7104[_0xaa49('0x43')]['id']}})[_0xaa49('0x26')](handleEntityNotFound(_0xf3425c,null))[_0xaa49('0x26')](saveUpdates(_0x9c7104[_0xaa49('0x48')],null))[_0xaa49('0x26')](respondWithResult(_0xf3425c,null))[_0xaa49('0x46')](handleError(_0xf3425c,null));};exports[_0xaa49('0x25')]=function(_0x1cd053,_0x2159a3){return db[_0xaa49('0x2c')][_0xaa49('0x49')]({'where':{'id':_0x1cd053[_0xaa49('0x43')]['id']}})[_0xaa49('0x26')](handleEntityNotFound(_0x2159a3,null))['then'](removeEntity(_0x2159a3,null))['catch'](handleError(_0x2159a3,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d037460..16664a0 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 _0x3adc=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x3b5964,_0x2f21c4){var _0xbc8296=function(_0x1f0789){while(--_0x1f0789){_0x3b5964['push'](_0x3b5964['shift']());}};_0xbc8296(++_0x2f21c4);}(_0x3adc,0x1a5));var _0xc3ad=function(_0x436b03,_0x3d9bf0){_0x436b03=_0x436b03-0x0;var _0x38103f=_0x3adc[_0x436b03];return _0x38103f;};'use strict';var _=require(_0xc3ad('0x0'));var util=require(_0xc3ad('0x1'));var logger=require(_0xc3ad('0x2'))(_0xc3ad('0x3'));var moment=require(_0xc3ad('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3ad('0x5'));var fs=require('fs');var path=require(_0xc3ad('0x6'));var rimraf=require(_0xc3ad('0x7'));var config=require(_0xc3ad('0x8'));var attributes=require(_0xc3ad('0x9'));module['exports']=function(_0x2b4b46,_0x57f037){return _0x2b4b46[_0xc3ad('0xa')](_0xc3ad('0xb'),attributes,{'tableName':_0xc3ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc3ad('0xd'),'collate':_0xc3ad('0xe')});}; \ No newline at end of file +var _0x4147=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./openchannelApplication.attributes'];(function(_0x35d211,_0x4fbae4){var _0x3b0892=function(_0x452b6f){while(--_0x452b6f){_0x35d211['push'](_0x35d211['shift']());}};_0x3b0892(++_0x4fbae4);}(_0x4147,0xf4));var _0x7414=function(_0x12010d,_0x43e72c){_0x12010d=_0x12010d-0x0;var _0xcc8c1c=_0x4147[_0x12010d];return _0xcc8c1c;};'use strict';var _=require(_0x7414('0x0'));var util=require(_0x7414('0x1'));var logger=require(_0x7414('0x2'))('api');var moment=require(_0x7414('0x3'));var BPromise=require(_0x7414('0x4'));var rp=require(_0x7414('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7414('0x6'));var config=require('../../config/environment');var attributes=require(_0x7414('0x7'));module[_0x7414('0x8')]=function(_0x4afb14,_0x2e66af){return _0x4afb14[_0x7414('0x9')](_0x7414('0xa'),attributes,{'tableName':_0x7414('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7414('0xc'),'collate':_0x7414('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ed55863..753ef73 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 _0xad12=['attributes','limit','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xad12,0xbe));var _0x2ad1=function(_0x153b7f,_0x56e5a3){_0x153b7f=_0x153b7f-0x0;var _0x117b80=_0xad12[_0x153b7f];return _0x117b80;};'use strict';var _=require(_0x2ad1('0x0'));var util=require(_0x2ad1('0x1'));var moment=require('moment');var BPromise=require(_0x2ad1('0x2'));var rs=require(_0x2ad1('0x3'));var fs=require('fs');var Redis=require(_0x2ad1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2ad1('0x5'))(_0x2ad1('0x6'));var config=require(_0x2ad1('0x7'));var jayson=require(_0x2ad1('0x8'));var client=jayson[_0x2ad1('0x9')][_0x2ad1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x575b05,_0x3afe80,_0x5520ce){return new BPromise(function(_0x197101,_0x167a81){return client['request'](_0x575b05,_0x5520ce)[_0x2ad1('0xb')](function(_0x4c9acb){logger[_0x2ad1('0xc')](_0x2ad1('0xd'),_0x3afe80,_0x2ad1('0xe'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x3afe80,_0x2ad1('0xe'),JSON['stringify'](_0x4c9acb));if(_0x4c9acb[_0x2ad1('0xf')]){if(_0x4c9acb['error'][_0x2ad1('0x10')]===0x1f4){logger[_0x2ad1('0xf')](_0x2ad1('0xd'),_0x3afe80,_0x4c9acb[_0x2ad1('0xf')][_0x2ad1('0x11')]);return _0x167a81(_0x4c9acb[_0x2ad1('0xf')][_0x2ad1('0x11')]);}logger['error'](_0x2ad1('0xd'),_0x3afe80,_0x4c9acb[_0x2ad1('0xf')][_0x2ad1('0x11')]);return _0x197101(_0x4c9acb[_0x2ad1('0xf')][_0x2ad1('0x11')]);}else{logger['info'](_0x2ad1('0xd'),_0x3afe80,_0x2ad1('0xe'));_0x197101(_0x4c9acb[_0x2ad1('0x12')][_0x2ad1('0x11')]);}})[_0x2ad1('0x13')](function(_0xb5bad3){logger[_0x2ad1('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x3afe80,_0xb5bad3);_0x167a81(_0xb5bad3);});});}exports[_0x2ad1('0x14')]=function(_0x6a1ef5){var _0x244012=this;return new Promise(function(_0x16e3b0,_0xdc3df3){return db[_0x2ad1('0x15')][_0x2ad1('0x16')](_0x6a1ef5[_0x2ad1('0x17')],{'raw':_0x6a1ef5[_0x2ad1('0x18')]?_0x6a1ef5['options'][_0x2ad1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a1ef5[_0x2ad1('0x18')]?_0x6a1ef5['options'][_0x2ad1('0x1a')]||null:null,'attributes':_0x6a1ef5[_0x2ad1('0x18')]?_0x6a1ef5[_0x2ad1('0x18')][_0x2ad1('0x1b')]||null:null,'limit':_0x6a1ef5[_0x2ad1('0x18')]?_0x6a1ef5['options'][_0x2ad1('0x1c')]||null:null})[_0x2ad1('0xb')](function(_0xe81b22){logger['info'](_0x2ad1('0x14'),_0x6a1ef5);logger[_0x2ad1('0x1d')](_0x2ad1('0x14'),_0x6a1ef5,JSON[_0x2ad1('0x1e')](_0xe81b22));_0x16e3b0(_0xe81b22);})[_0x2ad1('0x13')](function(_0x1c6e43){logger[_0x2ad1('0xf')](_0x2ad1('0x14'),_0x1c6e43[_0x2ad1('0x11')],_0x6a1ef5);_0xdc3df3(_0x244012['error'](0x1f4,_0x1c6e43[_0x2ad1('0x11')]));});});}; \ No newline at end of file +var _0xae0c=['options','raw','attributes','then','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','update','body'];(function(_0x323d3a,_0x325482){var _0x24847a=function(_0x9b0376){while(--_0x9b0376){_0x323d3a['push'](_0x323d3a['shift']());}};_0x24847a(++_0x325482);}(_0xae0c,0xec));var _0xcae0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xae0c[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xcae0('0x0'));var util=require(_0xcae0('0x1'));var moment=require(_0xcae0('0x2'));var BPromise=require(_0xcae0('0x3'));var rs=require(_0xcae0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcae0('0x5'));var logger=require(_0xcae0('0x6'))('rpc');var config=require(_0xcae0('0x7'));var jayson=require(_0xcae0('0x8'));var client=jayson[_0xcae0('0x9')][_0xcae0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27853a,_0x6754f7,_0x42c0c4){return new BPromise(function(_0x33ae1b,_0x5843ab){return client[_0xcae0('0xb')](_0x27853a,_0x42c0c4)['then'](function(_0xfb11df){logger[_0xcae0('0xc')](_0xcae0('0xd'),_0x6754f7,_0xcae0('0xe'));logger[_0xcae0('0xf')](_0xcae0('0x10'),_0x6754f7,_0xcae0('0xe'),JSON[_0xcae0('0x11')](_0xfb11df));if(_0xfb11df[_0xcae0('0x12')]){if(_0xfb11df[_0xcae0('0x12')]['code']===0x1f4){logger['error'](_0xcae0('0xd'),_0x6754f7,_0xfb11df['error'][_0xcae0('0x13')]);return _0x5843ab(_0xfb11df[_0xcae0('0x12')][_0xcae0('0x13')]);}logger[_0xcae0('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x6754f7,_0xfb11df[_0xcae0('0x12')][_0xcae0('0x13')]);return _0x33ae1b(_0xfb11df[_0xcae0('0x12')][_0xcae0('0x13')]);}else{logger['info'](_0xcae0('0xd'),_0x6754f7,_0xcae0('0xe'));_0x33ae1b(_0xfb11df[_0xcae0('0x14')][_0xcae0('0x13')]);}})[_0xcae0('0x15')](function(_0x2c32cd){logger['error'](_0xcae0('0xd'),_0x6754f7,_0x2c32cd);_0x5843ab(_0x2c32cd);});});}exports[_0xcae0('0x16')]=function(_0x3ef191){var _0x5482bb=this;return new Promise(function(_0x574da6,_0x11d284){return db['OpenchannelApplication'][_0xcae0('0x17')](_0x3ef191[_0xcae0('0x18')],{'raw':_0x3ef191[_0xcae0('0x19')]?_0x3ef191[_0xcae0('0x19')][_0xcae0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ef191[_0xcae0('0x19')]?_0x3ef191[_0xcae0('0x19')]['where']||null:null,'attributes':_0x3ef191[_0xcae0('0x19')]?_0x3ef191[_0xcae0('0x19')][_0xcae0('0x1b')]||null:null,'limit':_0x3ef191[_0xcae0('0x19')]?_0x3ef191[_0xcae0('0x19')]['limit']||null:null})[_0xcae0('0x1c')](function(_0x4b892b){logger[_0xcae0('0xc')](_0xcae0('0x16'),_0x3ef191);logger[_0xcae0('0xf')]('UpdateOpenchannelApplication',_0x3ef191,JSON['stringify'](_0x4b892b));_0x574da6(_0x4b892b);})['catch'](function(_0x5dbde2){logger['error'](_0xcae0('0x16'),_0x5dbde2[_0xcae0('0x13')],_0x3ef191);_0x11d284(_0x5482bb[_0xcae0('0x12')](0x1f4,_0x5dbde2[_0xcae0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c556cf4..d917c63 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 _0x8d72=['addTags','put','tracked','openchannelinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','openchannel','openchannelinteraction:addtags'];(function(_0x3d7aa1,_0x14c003){var _0x2add27=function(_0x6938c){while(--_0x6938c){_0x3d7aa1['push'](_0x3d7aa1['shift']());}};_0x2add27(++_0x14c003);}(_0x8d72,0x1e6));var _0x28d7=function(_0x117754,_0x558cf0){_0x117754=_0x117754-0x0;var _0x5b71ab=_0x8d72[_0x117754];return _0x5b71ab;};'use strict';var multer=require(_0x28d7('0x0'));var util=require(_0x28d7('0x1'));var path=require(_0x28d7('0x2'));var timeout=require('connect-timeout');var express=require(_0x28d7('0x3'));var router=express[_0x28d7('0x4')]();var fs_extra=require(_0x28d7('0x5'));var auth=require(_0x28d7('0x6'));var interaction=require(_0x28d7('0x7'));var config=require(_0x28d7('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x28d7('0x9')]('/',auth['isAuthenticated'](),controller[_0x28d7('0xa')]);router[_0x28d7('0x9')](_0x28d7('0xb'),auth[_0x28d7('0xc')](),controller[_0x28d7('0xd')]);router[_0x28d7('0x9')](_0x28d7('0xe'),auth[_0x28d7('0xc')](),controller[_0x28d7('0xf')]);router[_0x28d7('0x9')](_0x28d7('0x10'),auth['isAuthenticated'](),controller[_0x28d7('0x11')]);router[_0x28d7('0x9')](_0x28d7('0x12'),auth[_0x28d7('0xc')](),controller[_0x28d7('0x13')]);router['post']('/',auth[_0x28d7('0xc')](),controller[_0x28d7('0x14')]);router['post'](_0x28d7('0x10'),auth[_0x28d7('0xc')](),controller['addMessage']);router[_0x28d7('0x15')]('/:id/tags',auth[_0x28d7('0xc')](),interaction['tracked'](_0x28d7('0x16'),_0x28d7('0x17')),controller[_0x28d7('0x18')]);router[_0x28d7('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x28d7('0x1a')](_0x28d7('0x16'),_0x28d7('0x1b')),controller[_0x28d7('0x1c')]);router[_0x28d7('0x1d')](_0x28d7('0xe'),auth[_0x28d7('0xc')](),interaction[_0x28d7('0x1a')]('openchannel','openchannelinteraction:destroy'),controller[_0x28d7('0x1e')]);router[_0x28d7('0x1d')](_0x28d7('0x1f'),auth[_0x28d7('0xc')](),controller[_0x28d7('0x20')]);module[_0x28d7('0x21')]=router; \ No newline at end of file +var _0xa360=['delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update'];(function(_0x423df1,_0x41a8de){var _0x3d9851=function(_0x5460c6){while(--_0x5460c6){_0x423df1['push'](_0x423df1['shift']());}};_0x3d9851(++_0x41a8de);}(_0xa360,0xed));var _0x0a36=function(_0x3b0490,_0x546412){_0x3b0490=_0x3b0490-0x0;var _0x234faf=_0xa360[_0x3b0490];return _0x234faf;};'use strict';var multer=require('multer');var util=require(_0x0a36('0x0'));var path=require(_0x0a36('0x1'));var timeout=require(_0x0a36('0x2'));var express=require(_0x0a36('0x3'));var router=express[_0x0a36('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0a36('0x5'));var interaction=require(_0x0a36('0x6'));var config=require(_0x0a36('0x7'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x0a36('0x8')](),controller[_0x0a36('0x9')]);router[_0x0a36('0xa')](_0x0a36('0xb'),auth[_0x0a36('0x8')](),controller[_0x0a36('0xc')]);router['get'](_0x0a36('0xd'),auth[_0x0a36('0x8')](),controller['show']);router[_0x0a36('0xa')](_0x0a36('0xe'),auth[_0x0a36('0x8')](),controller[_0x0a36('0xf')]);router[_0x0a36('0xa')](_0x0a36('0x10'),auth['isAuthenticated'](),controller[_0x0a36('0x11')]);router[_0x0a36('0x12')]('/',auth[_0x0a36('0x8')](),controller[_0x0a36('0x13')]);router['post']('/:id/messages',auth[_0x0a36('0x8')](),controller[_0x0a36('0x14')]);router[_0x0a36('0x12')]('/:id/tags',auth[_0x0a36('0x8')](),interaction[_0x0a36('0x15')](_0x0a36('0x16'),_0x0a36('0x17')),controller[_0x0a36('0x18')]);router[_0x0a36('0x19')](_0x0a36('0xd'),auth[_0x0a36('0x8')](),interaction[_0x0a36('0x15')]('openchannel',_0x0a36('0x1a')),controller['update']);router[_0x0a36('0x1b')]('/:id',auth[_0x0a36('0x8')](),interaction['tracked'](_0x0a36('0x16'),_0x0a36('0x1c')),controller[_0x0a36('0x1d')]);router['delete'](_0x0a36('0x1e'),auth[_0x0a36('0x8')](),controller[_0x0a36('0x1f')]);module[_0x0a36('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index a2ee663..9836295 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 _0x9d86=['STRING','ENUM','out','BOOLEAN','INTEGER','sequelize','DATE'];(function(_0x5d0bae,_0x147e4d){var _0x1dd9e8=function(_0x40985b){while(--_0x40985b){_0x5d0bae['push'](_0x5d0bae['shift']());}};_0x1dd9e8(++_0x147e4d);}(_0x9d86,0xbb));var _0x69d8=function(_0x2bfce0,_0x554be2){_0x2bfce0=_0x2bfce0-0x0;var _0x37d45b=_0x9d86[_0x2bfce0];return _0x37d45b;};'use strict';var Sequelize=require(_0x69d8('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x69d8('0x1')]},'disposition':{'type':Sequelize[_0x69d8('0x2')]},'secondDisposition':{'type':Sequelize[_0x69d8('0x2')]},'thirdDisposition':{'type':Sequelize[_0x69d8('0x2')]},'note':{'type':Sequelize[_0x69d8('0x2')]},'read1stAt':{'type':Sequelize[_0x69d8('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x69d8('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x69d8('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x69d8('0x3')]('in',_0x69d8('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x69d8('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x69d8('0x6')]}}; \ No newline at end of file +var _0x609a=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0xae4f19,_0xab2aee){var _0x2a7b03=function(_0x10647d){while(--_0x10647d){_0xae4f19['push'](_0xae4f19['shift']());}};_0x2a7b03(++_0xab2aee);}(_0x609a,0x1ec));var _0xa609=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x609a[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xa609('0x0'));module[_0xa609('0x1')]={'closed':{'type':Sequelize[_0xa609('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa609('0x3')]},'disposition':{'type':Sequelize[_0xa609('0x4')]},'secondDisposition':{'type':Sequelize[_0xa609('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa609('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xa609('0x4')]},'externalUrl':{'type':Sequelize[_0xa609('0x4')]},'lastMsgAt':{'type':Sequelize[_0xa609('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa609('0x5')]('in',_0xa609('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xa609('0x5')]('in',_0xa609('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xa609('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xa609('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa609('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index aee5ea4..8d9537b 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 _0xca9e=['mkdirSync','Openchannel','N.A.','toString','closed','closedAt','disposition','threadId','Public','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','renderFile','root','server','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','error','rimraf','moment','util','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','getOptions','findAll','user','catch','query','from','params','model','keys','filters','attributes','intersection','fields','length','includeAll','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','findOne','hasOwnProperty','nolimit','order','sort','pick','OpenchannelInteractionId','filter','where','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','omit','spread','color','removeTags','download','unix','join','files','tmp','attachments','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','Attachment','createdAt','secret','read','Account','Owner','fullname','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca9e,0x99));var _0xeca9=function(_0x13ad9f,_0x50751a){_0x13ad9f=_0x13ad9f-0x0;var _0xa6a338=_0xca9e[_0x13ad9f];return _0xa6a338;};'use strict';var rimraf=require(_0xeca9('0x0'));var zipdir=require('zip-dir');var moment=require(_0xeca9('0x1'));var util=require(_0xeca9('0x2'));var path=require(_0xeca9('0x3'));var ejs=require(_0xeca9('0x4'));var fs=require('fs');var _=require(_0xeca9('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xeca9('0x6'));var pdf=require(_0xeca9('0x7'));var logger=require(_0xeca9('0x8'))(_0xeca9('0x9'));var config=require(_0xeca9('0xa'));var db=require(_0xeca9('0xb'))['db'];config['redis']=_[_0xeca9('0xc')](config['redis'],{'host':_0xeca9('0xd'),'port':0x18eb});var socket=require(_0xeca9('0xe'))(new Redis(config[_0xeca9('0xf')]));require(_0xeca9('0x10'))['register'](socket);function respondWithStatusCode(_0x1fab95,_0x4cf206){_0x4cf206=_0x4cf206||0xcc;return function(_0x555f31){if(_0x555f31){return _0x1fab95[_0xeca9('0x11')](_0x4cf206);}return _0x1fab95['status'](_0x4cf206)[_0xeca9('0x12')]();};}function respondWithResult(_0x1d74e2,_0x554a60){_0x554a60=_0x554a60||0xc8;return function(_0xa8fb1d){if(_0xa8fb1d){return _0x1d74e2[_0xeca9('0x13')](_0x554a60)[_0xeca9('0x14')](_0xa8fb1d);}};}function respondWithFilteredResult(_0x4c292a,_0x1081a1){return function(_0x2a996b){if(_0x2a996b){var _0x4a0c99=typeof _0x1081a1[_0xeca9('0x15')]===_0xeca9('0x16')&&typeof _0x1081a1[_0xeca9('0x17')]===_0xeca9('0x16');var _0x3dd712=_0x2a996b[_0xeca9('0x18')];var _0x42820f=_0x4a0c99?0x0:_0x1081a1['offset'];var _0x29ebc6=_0x4a0c99?_0x2a996b[_0xeca9('0x18')]:_0x1081a1[_0xeca9('0x15')]+_0x1081a1['limit'];var _0x3cb685;if(_0x29ebc6>=_0x3dd712){_0x29ebc6=_0x3dd712;_0x3cb685=0xc8;}else{_0x3cb685=0xce;}_0x4c292a[_0xeca9('0x13')](_0x3cb685);return _0x4c292a[_0xeca9('0x19')](_0xeca9('0x1a'),_0x42820f+'-'+_0x29ebc6+'/'+_0x3dd712)[_0xeca9('0x14')](_0x2a996b);}return null;};}function saveUpdates(_0x1e5527){return function(_0x14f8c){if(_0x14f8c){return _0x14f8c[_0xeca9('0x1b')](_0x1e5527)[_0xeca9('0x1c')](function(_0x5aa9ed){return _0x5aa9ed;});}return null;};}function removeEntity(_0x460702){return function(_0xf1a27d){if(_0xf1a27d){return _0xf1a27d[_0xeca9('0x1d')]()['then'](function(){_0x460702['status'](0xcc)[_0xeca9('0x12')]();});}};}function handleEntityNotFound(_0x219376){return function(_0x4db6a3){if(!_0x4db6a3){_0x219376[_0xeca9('0x11')](0x194);}return _0x4db6a3;};}function handleError(_0x16d86e,_0x1acd36){_0x1acd36=_0x1acd36||0x1f4;return function(_0x248e70){logger['error'](_0x248e70['stack']);if(_0x248e70['name']){delete _0x248e70[_0xeca9('0x1e')];}_0x16d86e['status'](_0x1acd36)[_0xeca9('0x1f')](_0x248e70);};}exports[_0xeca9('0x20')]=function(_0x2fe072,_0x7d3cb0){var _0x40deba={};var _0x2e6c02=_['map'](db[_0xeca9('0x21')][_0xeca9('0x22')],function(_0x1f9959){return{'name':_0x1f9959[_0xeca9('0x23')],'type':_0x1f9959['type']['key']};});_0x40deba=qs[_0xeca9('0x24')](_0x2e6c02,_0x2fe072);return interaction[_0xeca9('0x25')]('openchannel',_0x2fe072['query'],_0x2fe072[_0xeca9('0x26')],_0x40deba,_0x2e6c02)[_0xeca9('0x1c')](respondWithFilteredResult(_0x7d3cb0,_0x40deba))[_0xeca9('0x27')](handleError(_0x7d3cb0,null));};exports['show']=function(_0x5f3c44,_0x4f7a50){var _0x51a2db={};if(_0x5f3c44[_0xeca9('0x28')]['type']&&_0x5f3c44['query']['type']===_0xeca9('0x29')){_0x51a2db[_0xeca9('0x29')]=_0x5f3c44[_0xeca9('0x2a')]['id'];}else{_0x51a2db['id']=_0x5f3c44[_0xeca9('0x2a')]['id'];}var _0xe8d53b={'raw':![],'where':_0x51a2db},_0x2e861e={};_0x2e861e[_0xeca9('0x2b')]=_['keys'](db[_0xeca9('0x21')][_0xeca9('0x22')]);_0x2e861e[_0xeca9('0x28')]=_[_0xeca9('0x2c')](_0x5f3c44[_0xeca9('0x28')]);_0x2e861e[_0xeca9('0x2d')]=_['intersection'](_0x2e861e[_0xeca9('0x2b')],_0x2e861e['query']);_0xe8d53b[_0xeca9('0x2e')]=_[_0xeca9('0x2f')](_0x2e861e[_0xeca9('0x2b')],qs[_0xeca9('0x30')](_0x5f3c44[_0xeca9('0x28')][_0xeca9('0x30')]));_0xe8d53b['attributes']=_0xe8d53b[_0xeca9('0x2e')][_0xeca9('0x31')]?_0xe8d53b[_0xeca9('0x2e')]:_0x2e861e['model'];if(_0x5f3c44['query'][_0xeca9('0x32')]){_0xe8d53b['include']=[{'all':!![]}];}_0xe8d53b=_['merge']({},_0xe8d53b,_0x5f3c44[_0xeca9('0x33')]);return db[_0xeca9('0x21')][_0xeca9('0x34')](_0xe8d53b)['then'](handleEntityNotFound(_0x4f7a50,null))[_0xeca9('0x1c')](respondWithResult(_0x4f7a50,null))[_0xeca9('0x27')](handleError(_0x4f7a50,null));};exports[_0xeca9('0x35')]=function(_0x25bd54,_0x1d31bc){return db['OpenchannelInteraction']['create'](_0x25bd54[_0xeca9('0x36')],{})['then'](respondWithResult(_0x1d31bc,0xc9))[_0xeca9('0x27')](handleError(_0x1d31bc,null));};exports[_0xeca9('0x1b')]=function(_0x516f6c,_0x12637d){if(_0x516f6c[_0xeca9('0x36')]['id']){delete _0x516f6c['body']['id'];}return db[_0xeca9('0x21')][_0xeca9('0x34')]({'where':{'id':_0x516f6c[_0xeca9('0x2a')]['id']}})['then'](handleEntityNotFound(_0x12637d,null))[_0xeca9('0x1c')](saveUpdates(_0x516f6c[_0xeca9('0x36')],null))[_0xeca9('0x1c')](respondWithResult(_0x12637d,null))[_0xeca9('0x27')](handleError(_0x12637d,null));};exports[_0xeca9('0x1d')]=function(_0x3fed6d,_0x4ec1e8){return db[_0xeca9('0x21')][_0xeca9('0x34')]({'where':{'id':_0x3fed6d[_0xeca9('0x2a')]['id']}})[_0xeca9('0x1c')](handleEntityNotFound(_0x4ec1e8,null))[_0xeca9('0x1c')](removeEntity(_0x4ec1e8,null))[_0xeca9('0x27')](handleError(_0x4ec1e8,null));};exports[_0xeca9('0x37')]=function(_0x2e1245,_0x5e3f96){return db[_0xeca9('0x21')][_0xeca9('0x37')]()['then'](respondWithResult(_0x5e3f96,null))[_0xeca9('0x27')](handleError(_0x5e3f96,null));};exports[_0xeca9('0x38')]=function(_0x20a617,_0x93da07){return db[_0xeca9('0x39')][_0xeca9('0x34')]({'where':{'id':_0x20a617[_0xeca9('0x2a')]['id']}})[_0xeca9('0x1c')](handleEntityNotFound(_0x93da07,null))[_0xeca9('0x1c')](function(_0x199f8f){if(_0x199f8f){return _0x199f8f[_0xeca9('0x38')](_0x20a617[_0xeca9('0x36')][_0xeca9('0x3a')],_['omit'](_0x20a617[_0xeca9('0x36')],['ids','id'])||{});}})[_0xeca9('0x1c')](respondWithResult(_0x93da07,null))[_0xeca9('0x27')](handleError(_0x93da07,null));};exports['getMessages']=function(_0x37b623,_0x28c034){var _0x10a78f={'raw':![],'where':{}};var _0x1418d5={};var _0x1af1b8={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xeca9('0x3b')]({'where':{'id':_0x37b623[_0xeca9('0x2a')]['id']}})[_0xeca9('0x1c')](handleEntityNotFound(_0x28c034,null))[_0xeca9('0x1c')](function(_0x57b5f2){if(_0x57b5f2){_0x1418d5['model']=_[_0xeca9('0x2c')](db[_0xeca9('0x39')][_0xeca9('0x22')]);_0x1418d5['query']=_[_0xeca9('0x2c')](_0x37b623[_0xeca9('0x28')]);_0x1418d5[_0xeca9('0x2d')]=_[_0xeca9('0x2f')](_0x1418d5[_0xeca9('0x2b')],_0x1418d5[_0xeca9('0x28')]);_0x10a78f[_0xeca9('0x2e')]=_['intersection'](_0x1418d5[_0xeca9('0x2b')],qs[_0xeca9('0x30')](_0x37b623['query'][_0xeca9('0x30')]));_0x10a78f['attributes']=_0x10a78f[_0xeca9('0x2e')][_0xeca9('0x31')]?_0x10a78f[_0xeca9('0x2e')]:_0x1418d5[_0xeca9('0x2b')];if(!_0x37b623[_0xeca9('0x28')][_0xeca9('0x3c')](_0xeca9('0x3d'))){_0x10a78f[_0xeca9('0x17')]=qs[_0xeca9('0x17')](_0x37b623['query']['limit']);_0x10a78f['offset']=qs[_0xeca9('0x15')](_0x37b623[_0xeca9('0x28')]['offset']);}_0x10a78f[_0xeca9('0x3e')]=qs[_0xeca9('0x3f')](_0x37b623[_0xeca9('0x28')][_0xeca9('0x3f')]);_0x10a78f['where']=qs['filters'](_[_0xeca9('0x40')](_0x37b623['query'],_0x1418d5[_0xeca9('0x2d')]));_0x10a78f['where'][_0xeca9('0x41')]=_0x57b5f2['id'];if(_0x37b623[_0xeca9('0x28')][_0xeca9('0x42')]){_0x10a78f[_0xeca9('0x43')]=_['merge'](_0x10a78f[_0xeca9('0x43')],{'$or':_[_0xeca9('0x44')](_0x10a78f[_0xeca9('0x2e')],function(_0x11ebf6){var _0xad6bd5={};_0xad6bd5[_0x11ebf6]={'$like':'%'+_0x37b623[_0xeca9('0x28')]['filter']+'%'};return _0xad6bd5;})});}if(_0x37b623[_0xeca9('0x28')]['$gte']){var _0x1506a6=_0x37b623['query'][_0xeca9('0x45')][_0xeca9('0x46')](',');var _0x493fd5={};_0x493fd5[_0x1506a6[0x0]]={'$gte':moment(_0x1506a6[0x1])[_0xeca9('0x47')](_0xeca9('0x48'))};_0x10a78f[_0xeca9('0x43')]=_[_0xeca9('0x49')](_0x10a78f[_0xeca9('0x43')],_0x493fd5);}_0x10a78f=_[_0xeca9('0x49')]({},_0x10a78f,_0x37b623[_0xeca9('0x33')]);return db['OpenchannelMessage'][_0xeca9('0x18')]({'where':_0x10a78f[_0xeca9('0x43')]})[_0xeca9('0x1c')](function(_0x2ddc15){_0x1af1b8[_0xeca9('0x18')]=_0x2ddc15;if(_0x37b623[_0xeca9('0x28')][_0xeca9('0x32')]){_0x10a78f['include']=[{'all':!![]}];}return db[_0xeca9('0x39')][_0xeca9('0x25')](_0x10a78f);})[_0xeca9('0x1c')](function(_0x5012de){_0x1af1b8[_0xeca9('0x4a')]=_0x5012de;return _0x1af1b8;});}})[_0xeca9('0x1c')](respondWithFilteredResult(_0x28c034,_0x10a78f))[_0xeca9('0x27')](handleError(_0x28c034,null));};exports[_0xeca9('0x4b')]=function(_0x5b3187,_0x1dc73d){return db['OpenchannelInteraction']['find']({'where':{'id':_0x5b3187[_0xeca9('0x2a')]['id']}})[_0xeca9('0x1c')](handleEntityNotFound(_0x1dc73d,null))[_0xeca9('0x1c')](function(_0xaea2b1){if(_0xaea2b1){return _0xaea2b1[_0xeca9('0x4c')](_0x5b3187['body'][_0xeca9('0x3a')],_[_0xeca9('0x4d')](_0x5b3187[_0xeca9('0x36')],[_0xeca9('0x3a'),'id'])||{})[_0xeca9('0x4e')](function(){return db['Tag'][_0xeca9('0x25')]({'attributes':['id',_0xeca9('0x1e'),_0xeca9('0x4f')],'where':{'id':_0x5b3187[_0xeca9('0x36')][_0xeca9('0x3a')]}});})[_0xeca9('0x1c')](function(_0x4faa59){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x5b3187[_0xeca9('0x2a')]['id']),'tags':_0x4faa59||[]});return{'id':Number(_0x5b3187['params']['id']),'tags':_0x4faa59||[]};});}})['then'](respondWithResult(_0x1dc73d,null))[_0xeca9('0x27')](handleError(_0x1dc73d,null));};exports[_0xeca9('0x50')]=function(_0x13237f,_0x12e30d){return db['OpenchannelInteraction'][_0xeca9('0x34')]({'where':{'id':_0x13237f['params']['id']}})[_0xeca9('0x1c')](handleEntityNotFound(_0x12e30d,null))['then'](function(_0x36748c){if(_0x36748c){return _0x36748c['removeTags'](_0x13237f['query'][_0xeca9('0x3a')]);}})[_0xeca9('0x1c')](respondWithStatusCode(_0x12e30d,null))[_0xeca9('0x27')](handleError(_0x12e30d,null));};exports[_0xeca9('0x51')]=function(_0x5697f6,_0x1a94ae){var _0x37e8f2=moment()[_0xeca9('0x52')]()['toString']();var _0x6651fc=path[_0xeca9('0x53')](config['root'],'server',_0xeca9('0x54'),_0xeca9('0x55'));var _0x4b6379=path[_0xeca9('0x53')](config['root'],'server',_0xeca9('0x54'),_0xeca9('0x56'));var _0x17b118=path[_0xeca9('0x53')](_0x6651fc,_0x37e8f2);var _0x125110=util[_0xeca9('0x47')](_0xeca9('0x57'),_0x5697f6['params']['id'],_0x37e8f2);var _0x709676=path[_0xeca9('0x53')](_0x6651fc,_0x125110);var _0x12ae80=[];_0x12ae80['push']({'model':db[_0xeca9('0x58')],'as':_0xeca9('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x12ae80[_0xeca9('0x59')]({'model':db[_0xeca9('0x5a')],'as':_0xeca9('0x5b'),'attributes':['id',_0xeca9('0x5c'),'lastName'],'raw':!![]});if(_0x5697f6[_0xeca9('0x28')]['attachments']){_0x12ae80[_0xeca9('0x59')]({'model':db['Attachment'],'as':_0xeca9('0x5d'),'raw':!![]});}var _0x558419=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0xeca9('0x36'),_0xeca9('0x5e'),'direction',_0xeca9('0x5f'),_0xeca9('0x60')],'include':_0x12ae80}];_0x558419['push']({'model':db['OpenchannelAccount'],'as':_0xeca9('0x61'),'attributes':['id',_0xeca9('0x1e')]});_0x558419[_0xeca9('0x59')]({'model':db[_0xeca9('0x58')],'as':_0xeca9('0x62'),'attributes':['id',_0xeca9('0x63')]});return db[_0xeca9('0x21')]['find']({'where':{'id':_0x5697f6[_0xeca9('0x2a')]['id']},'include':_0x558419})[_0xeca9('0x1c')](handleEntityNotFound(_0x1a94ae,null))[_0xeca9('0x1c')](function(_0x529d37){if(_0x529d37){var _0x193611=_0x529d37[_0xeca9('0x64')]({'plain':!![]});fs[_0xeca9('0x65')](_0x17b118);var _0x49530a={'channel':_0xeca9('0x66'),'account':_0x193611[_0xeca9('0x61')][_0xeca9('0x1e')],'agent':_0x193611[_0xeca9('0x62')]?_0x193611[_0xeca9('0x62')][_0xeca9('0x63')]:_0xeca9('0x67'),'createdAt':moment(_0x193611['createdAt'])[_0xeca9('0x47')](_0xeca9('0x48'))[_0xeca9('0x68')](),'closedAt':_0x193611[_0xeca9('0x69')]?moment(_0x193611[_0xeca9('0x6a')])['format'](_0xeca9('0x48'))['toString']():'','disposition':_0x193611[_0xeca9('0x6b')],'visibility':_0x193611[_0xeca9('0x6c')]?_0xeca9('0x6d'):'Private','messages':_(_0x193611[_0xeca9('0x6e')])[_0xeca9('0x42')]({'secret':![]})['map'](function(_0x54ecc3){if(_0x54ecc3[_0xeca9('0x5d')]){var _0x1f1bbf=path[_0xeca9('0x53')](_0x4b6379,_0x54ecc3[_0xeca9('0x5d')][_0xeca9('0x6f')]);if(fs[_0xeca9('0x70')](_0x1f1bbf)){fs[_0xeca9('0x71')](_0x1f1bbf)[_0xeca9('0x72')](fs[_0xeca9('0x73')](path[_0xeca9('0x53')](_0x17b118,_0x54ecc3[_0xeca9('0x5d')]['basename'])));}}return{'date':moment(_0x54ecc3[_0xeca9('0x5e')])[_0xeca9('0x47')](_0xeca9('0x48'))[_0xeca9('0x68')](),'sender':_0x54ecc3['direction']===_0xeca9('0x74')?_0x54ecc3[_0xeca9('0x58')]?_0x54ecc3[_0xeca9('0x58')]['fullname']:_0xeca9('0x75'):_0x54ecc3[_0xeca9('0x5b')][_0xeca9('0x5c')]+(_0x54ecc3[_0xeca9('0x5b')]['lastName']?'\x20'+_0x54ecc3[_0xeca9('0x5b')][_0xeca9('0x76')]:''),'body':_0x54ecc3[_0xeca9('0x5d')]?_0x54ecc3[_0xeca9('0x5d')][_0xeca9('0x6f')]:_0x54ecc3['body'],'direction':_0x54ecc3['direction']===_0xeca9('0x74')?'A':'C','secret':_0x54ecc3['secret'],'read':_0x54ecc3[_0xeca9('0x60')],'attachment':_0x54ecc3[_0xeca9('0x5d')]};})['value']()};return ejs[_0xeca9('0x77')](path[_0xeca9('0x53')](config[_0xeca9('0x78')],_0xeca9('0x79'),'views',_0xeca9('0x7a')),{'interaction':_0x49530a})[_0xeca9('0x1c')](function(_0x3e3a6f){var _0x340982=path[_0xeca9('0x53')](_0x17b118,_0xeca9('0x7b')+_0x193611['id']+'-'+_0x37e8f2+_0xeca9('0x7c'));var _0x442190={'path':_0x340982,'channel':_0xeca9('0x66'),'interactionId':_0x193611['id']};return pdf[_0xeca9('0x7d')](_0x3e3a6f,_0x442190);})['then'](function(){return new Promise(function(_0x53a2ec,_0x4f6871){zipdir(_0x17b118,{'saveTo':_0x709676},function(_0x1b340b,_0x28ba41){if(_0x1b340b)return _0x4f6871(_0x1b340b);return _0x53a2ec(_0x28ba41);});})['then'](function(){return new Promise(function(_0x2e21c8,_0x41231a){rimraf(_0x17b118,function(_0x2a0c9e){if(_0x2a0c9e)_0x41231a(_0x2a0c9e);return _0x2e21c8();});});})['then'](function(){return _0x1a94ae[_0xeca9('0x51')](_0x709676,_0x125110,function(_0x509ee3){if(_0x509ee3){logger[_0xeca9('0x7e')]('Unable\x20to\x20delete\x20zip\x20file',_0x509ee3);}else{fs['unlinkSync'](_0x709676);}});});});}else{return _0x1a94ae[_0xeca9('0x11')](0xc8);}})[_0xeca9('0x27')](handleError(_0x1a94ae,null));}; \ No newline at end of file +var _0xb642=['createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/parsers/qs','api','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','json','undefined','limit','count','offset','set','update','destroy','then','status','end','error','stack','name','index','rawAttributes','fieldName','type','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','intersection','fields','attributes','length','includeAll','include','merge','options','OpenchannelInteraction','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','hasOwnProperty','order','sort','filters','pick','where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','Attachment','Messages','secret','Account','Owner','get','mkdirSync','Openchannel','createdAt','Public','Private','basename','existsSync','createReadStream','createWriteStream','direction','Contact','lastName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf'];(function(_0x4d7682,_0x373768){var _0x58af3d=function(_0x15aab8){while(--_0x15aab8){_0x4d7682['push'](_0x4d7682['shift']());}};_0x58af3d(++_0x373768);}(_0xb642,0x7f));var _0x2b64=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xb642[_0x3054be];return _0x3df150;};'use strict';var rimraf=require(_0x2b64('0x0'));var zipdir=require(_0x2b64('0x1'));var moment=require(_0x2b64('0x2'));var util=require(_0x2b64('0x3'));var path=require(_0x2b64('0x4'));var ejs=require(_0x2b64('0x5'));var fs=require('fs');var _=require(_0x2b64('0x6'));var Redis=require(_0x2b64('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x2b64('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x2b64('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2b64('0xa')]=_['defaults'](config[_0x2b64('0xa')],{'host':_0x2b64('0xb'),'port':0x18eb});var socket=require(_0x2b64('0xc'))(new Redis(config[_0x2b64('0xa')]));require(_0x2b64('0xd'))[_0x2b64('0xe')](socket);function respondWithStatusCode(_0x3fccad,_0x235f74){_0x235f74=_0x235f74||0xcc;return function(_0x4c3cc8){if(_0x4c3cc8){return _0x3fccad[_0x2b64('0xf')](_0x235f74);}return _0x3fccad['status'](_0x235f74)['end']();};}function respondWithResult(_0x2859cc,_0x5a3812){_0x5a3812=_0x5a3812||0xc8;return function(_0x35e43a){if(_0x35e43a){return _0x2859cc['status'](_0x5a3812)[_0x2b64('0x10')](_0x35e43a);}};}function respondWithFilteredResult(_0x17c6e5,_0x3b19f3){return function(_0x37141d){if(_0x37141d){var _0x944586=typeof _0x3b19f3['offset']===_0x2b64('0x11')&&typeof _0x3b19f3[_0x2b64('0x12')]===_0x2b64('0x11');var _0x19c0fe=_0x37141d[_0x2b64('0x13')];var _0x51c642=_0x944586?0x0:_0x3b19f3[_0x2b64('0x14')];var _0x4e56ee=_0x944586?_0x37141d[_0x2b64('0x13')]:_0x3b19f3[_0x2b64('0x14')]+_0x3b19f3['limit'];var _0x11b7ea;if(_0x4e56ee>=_0x19c0fe){_0x4e56ee=_0x19c0fe;_0x11b7ea=0xc8;}else{_0x11b7ea=0xce;}_0x17c6e5['status'](_0x11b7ea);return _0x17c6e5[_0x2b64('0x15')]('Content-Range',_0x51c642+'-'+_0x4e56ee+'/'+_0x19c0fe)[_0x2b64('0x10')](_0x37141d);}return null;};}function saveUpdates(_0x32c7d1){return function(_0x56e833){if(_0x56e833){return _0x56e833[_0x2b64('0x16')](_0x32c7d1)['then'](function(_0x179f66){return _0x179f66;});}return null;};}function removeEntity(_0x762d53){return function(_0x2a400d){if(_0x2a400d){return _0x2a400d[_0x2b64('0x17')]()[_0x2b64('0x18')](function(){_0x762d53[_0x2b64('0x19')](0xcc)[_0x2b64('0x1a')]();});}};}function handleEntityNotFound(_0x2ffadc){return function(_0x4dca3e){if(!_0x4dca3e){_0x2ffadc['sendStatus'](0x194);}return _0x4dca3e;};}function handleError(_0x2c3d55,_0xb99cfc){_0xb99cfc=_0xb99cfc||0x1f4;return function(_0x3c4d68){logger[_0x2b64('0x1b')](_0x3c4d68[_0x2b64('0x1c')]);if(_0x3c4d68[_0x2b64('0x1d')]){delete _0x3c4d68[_0x2b64('0x1d')];}_0x2c3d55[_0x2b64('0x19')](_0xb99cfc)['send'](_0x3c4d68);};}exports[_0x2b64('0x1e')]=function(_0x5e5788,_0x1878b2){var _0x1266e1={};var _0x3e3705=_['map'](db['OpenchannelInteraction'][_0x2b64('0x1f')],function(_0x415406){return{'name':_0x415406[_0x2b64('0x20')],'type':_0x415406[_0x2b64('0x21')]['key']};});_0x1266e1=qs[_0x2b64('0x22')](_0x3e3705,_0x5e5788);return interaction[_0x2b64('0x23')](_0x2b64('0x24'),_0x5e5788[_0x2b64('0x25')],_0x5e5788[_0x2b64('0x26')],_0x1266e1,_0x3e3705)[_0x2b64('0x18')](respondWithFilteredResult(_0x1878b2,_0x1266e1))[_0x2b64('0x27')](handleError(_0x1878b2,null));};exports[_0x2b64('0x28')]=function(_0xcb4cbb,_0x3d04de){var _0x27abd9={};if(_0xcb4cbb[_0x2b64('0x25')][_0x2b64('0x21')]&&_0xcb4cbb[_0x2b64('0x25')][_0x2b64('0x21')]===_0x2b64('0x29')){_0x27abd9[_0x2b64('0x29')]=_0xcb4cbb[_0x2b64('0x2a')]['id'];}else{_0x27abd9['id']=_0xcb4cbb[_0x2b64('0x2a')]['id'];}var _0x1777de={'raw':![],'where':_0x27abd9},_0x3bbfcd={};_0x3bbfcd[_0x2b64('0x2b')]=_[_0x2b64('0x2c')](db['OpenchannelInteraction'][_0x2b64('0x1f')]);_0x3bbfcd['query']=_[_0x2b64('0x2c')](_0xcb4cbb[_0x2b64('0x25')]);_0x3bbfcd['filters']=_[_0x2b64('0x2d')](_0x3bbfcd[_0x2b64('0x2b')],_0x3bbfcd[_0x2b64('0x25')]);_0x1777de['attributes']=_[_0x2b64('0x2d')](_0x3bbfcd[_0x2b64('0x2b')],qs['fields'](_0xcb4cbb[_0x2b64('0x25')][_0x2b64('0x2e')]));_0x1777de[_0x2b64('0x2f')]=_0x1777de[_0x2b64('0x2f')][_0x2b64('0x30')]?_0x1777de[_0x2b64('0x2f')]:_0x3bbfcd[_0x2b64('0x2b')];if(_0xcb4cbb[_0x2b64('0x25')][_0x2b64('0x31')]){_0x1777de[_0x2b64('0x32')]=[{'all':!![]}];}_0x1777de=_[_0x2b64('0x33')]({},_0x1777de,_0xcb4cbb[_0x2b64('0x34')]);return db[_0x2b64('0x35')][_0x2b64('0x36')](_0x1777de)[_0x2b64('0x18')](handleEntityNotFound(_0x3d04de,null))[_0x2b64('0x18')](respondWithResult(_0x3d04de,null))[_0x2b64('0x27')](handleError(_0x3d04de,null));};exports[_0x2b64('0x37')]=function(_0x572ea9,_0x50ea9d){return db[_0x2b64('0x35')]['create'](_0x572ea9['body'],{})[_0x2b64('0x18')](respondWithResult(_0x50ea9d,0xc9))[_0x2b64('0x27')](handleError(_0x50ea9d,null));};exports[_0x2b64('0x16')]=function(_0x3d955b,_0x37d347){if(_0x3d955b['body']['id']){delete _0x3d955b[_0x2b64('0x38')]['id'];}return db[_0x2b64('0x35')]['find']({'where':{'id':_0x3d955b[_0x2b64('0x2a')]['id']}})[_0x2b64('0x18')](handleEntityNotFound(_0x37d347,null))[_0x2b64('0x18')](saveUpdates(_0x3d955b[_0x2b64('0x38')],null))[_0x2b64('0x18')](respondWithResult(_0x37d347,null))[_0x2b64('0x27')](handleError(_0x37d347,null));};exports[_0x2b64('0x17')]=function(_0x581d6d,_0x26a11c){return db[_0x2b64('0x35')][_0x2b64('0x36')]({'where':{'id':_0x581d6d[_0x2b64('0x2a')]['id']}})[_0x2b64('0x18')](handleEntityNotFound(_0x26a11c,null))[_0x2b64('0x18')](removeEntity(_0x26a11c,null))[_0x2b64('0x27')](handleError(_0x26a11c,null));};exports[_0x2b64('0x39')]=function(_0x371635,_0x31bf3e){return db[_0x2b64('0x35')]['describe']()[_0x2b64('0x18')](respondWithResult(_0x31bf3e,null))[_0x2b64('0x27')](handleError(_0x31bf3e,null));};exports[_0x2b64('0x3a')]=function(_0x3b844b,_0x1773fa){return db[_0x2b64('0x3b')][_0x2b64('0x36')]({'where':{'id':_0x3b844b[_0x2b64('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1773fa,null))['then'](function(_0x7b38fe){if(_0x7b38fe){return _0x7b38fe['addMessage'](_0x3b844b[_0x2b64('0x38')][_0x2b64('0x3c')],_[_0x2b64('0x3d')](_0x3b844b[_0x2b64('0x38')],[_0x2b64('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x1773fa,null))[_0x2b64('0x27')](handleError(_0x1773fa,null));};exports['getMessages']=function(_0x3f66a0,_0x319f98){var _0x4e353c={'raw':![],'where':{}};var _0x52e992={};var _0x4d5a81={'count':0x0,'rows':[]};return db[_0x2b64('0x35')]['findOne']({'where':{'id':_0x3f66a0['params']['id']}})[_0x2b64('0x18')](handleEntityNotFound(_0x319f98,null))[_0x2b64('0x18')](function(_0x44bed4){if(_0x44bed4){_0x52e992[_0x2b64('0x2b')]=_[_0x2b64('0x2c')](db[_0x2b64('0x3b')][_0x2b64('0x1f')]);_0x52e992[_0x2b64('0x25')]=_['keys'](_0x3f66a0[_0x2b64('0x25')]);_0x52e992['filters']=_['intersection'](_0x52e992[_0x2b64('0x2b')],_0x52e992[_0x2b64('0x25')]);_0x4e353c[_0x2b64('0x2f')]=_[_0x2b64('0x2d')](_0x52e992[_0x2b64('0x2b')],qs['fields'](_0x3f66a0[_0x2b64('0x25')]['fields']));_0x4e353c[_0x2b64('0x2f')]=_0x4e353c[_0x2b64('0x2f')]['length']?_0x4e353c['attributes']:_0x52e992[_0x2b64('0x2b')];if(!_0x3f66a0['query'][_0x2b64('0x3e')]('nolimit')){_0x4e353c[_0x2b64('0x12')]=qs[_0x2b64('0x12')](_0x3f66a0[_0x2b64('0x25')]['limit']);_0x4e353c[_0x2b64('0x14')]=qs[_0x2b64('0x14')](_0x3f66a0[_0x2b64('0x25')][_0x2b64('0x14')]);}_0x4e353c[_0x2b64('0x3f')]=qs[_0x2b64('0x40')](_0x3f66a0['query']['sort']);_0x4e353c['where']=qs[_0x2b64('0x41')](_[_0x2b64('0x42')](_0x3f66a0['query'],_0x52e992[_0x2b64('0x41')]));_0x4e353c[_0x2b64('0x43')]['OpenchannelInteractionId']=_0x44bed4['id'];if(_0x3f66a0[_0x2b64('0x25')][_0x2b64('0x44')]){_0x4e353c[_0x2b64('0x43')]=_['merge'](_0x4e353c[_0x2b64('0x43')],{'$or':_[_0x2b64('0x45')](_0x4e353c[_0x2b64('0x2f')],function(_0x1b1bf8){var _0x4d194d={};_0x4d194d[_0x1b1bf8]={'$like':'%'+_0x3f66a0['query'][_0x2b64('0x44')]+'%'};return _0x4d194d;})});}if(_0x3f66a0[_0x2b64('0x25')]['$gte']){var _0x4c6f9c=_0x3f66a0['query'][_0x2b64('0x46')][_0x2b64('0x47')](',');var _0x591f50={};_0x591f50[_0x4c6f9c[0x0]]={'$gte':moment(_0x4c6f9c[0x1])[_0x2b64('0x48')](_0x2b64('0x49'))};_0x4e353c[_0x2b64('0x43')]=_[_0x2b64('0x33')](_0x4e353c[_0x2b64('0x43')],_0x591f50);}_0x4e353c=_[_0x2b64('0x33')]({},_0x4e353c,_0x3f66a0[_0x2b64('0x34')]);return db[_0x2b64('0x3b')][_0x2b64('0x13')]({'where':_0x4e353c['where']})[_0x2b64('0x18')](function(_0x352b90){_0x4d5a81['count']=_0x352b90;if(_0x3f66a0['query'][_0x2b64('0x31')]){_0x4e353c[_0x2b64('0x32')]=[{'all':!![]}];}return db[_0x2b64('0x3b')]['findAll'](_0x4e353c);})[_0x2b64('0x18')](function(_0x208565){_0x4d5a81['rows']=_0x208565;return _0x4d5a81;});}})[_0x2b64('0x18')](respondWithFilteredResult(_0x319f98,_0x4e353c))[_0x2b64('0x27')](handleError(_0x319f98,null));};exports[_0x2b64('0x4a')]=function(_0x2e1ca9,_0x359d99){return db[_0x2b64('0x35')][_0x2b64('0x36')]({'where':{'id':_0x2e1ca9[_0x2b64('0x2a')]['id']}})[_0x2b64('0x18')](handleEntityNotFound(_0x359d99,null))[_0x2b64('0x18')](function(_0x190697){if(_0x190697){return _0x190697[_0x2b64('0x4b')](_0x2e1ca9[_0x2b64('0x38')][_0x2b64('0x3c')],_['omit'](_0x2e1ca9[_0x2b64('0x38')],[_0x2b64('0x3c'),'id'])||{})[_0x2b64('0x4c')](function(){return db['Tag'][_0x2b64('0x23')]({'attributes':['id',_0x2b64('0x1d'),_0x2b64('0x4d')],'where':{'id':_0x2e1ca9[_0x2b64('0x38')]['ids']}});})[_0x2b64('0x18')](function(_0x626661){socket[_0x2b64('0x4e')](_0x2b64('0x4f'),{'id':Number(_0x2e1ca9[_0x2b64('0x2a')]['id']),'tags':_0x626661||[]});return{'id':Number(_0x2e1ca9['params']['id']),'tags':_0x626661||[]};});}})['then'](respondWithResult(_0x359d99,null))[_0x2b64('0x27')](handleError(_0x359d99,null));};exports[_0x2b64('0x50')]=function(_0x2a79f5,_0x529990){return db['OpenchannelInteraction'][_0x2b64('0x36')]({'where':{'id':_0x2a79f5[_0x2b64('0x2a')]['id']}})[_0x2b64('0x18')](handleEntityNotFound(_0x529990,null))[_0x2b64('0x18')](function(_0x4573cc){if(_0x4573cc){return _0x4573cc[_0x2b64('0x50')](_0x2a79f5[_0x2b64('0x25')][_0x2b64('0x3c')]);}})[_0x2b64('0x18')](respondWithStatusCode(_0x529990,null))[_0x2b64('0x27')](handleError(_0x529990,null));};exports[_0x2b64('0x51')]=function(_0x4e9960,_0x5a9aad){var _0x415a6c=moment()[_0x2b64('0x52')]()[_0x2b64('0x53')]();var _0x544191=path['join'](config[_0x2b64('0x54')],_0x2b64('0x55'),_0x2b64('0x56'),_0x2b64('0x57'));var _0x84661c=path[_0x2b64('0x58')](config[_0x2b64('0x54')],'server',_0x2b64('0x56'),_0x2b64('0x59'));var _0x4dc12d=path[_0x2b64('0x58')](_0x544191,_0x415a6c);var _0xe4e07b=util[_0x2b64('0x48')](_0x2b64('0x5a'),_0x4e9960[_0x2b64('0x2a')]['id'],_0x415a6c);var _0x5b37fe=path['join'](_0x544191,_0xe4e07b);var _0x32ef91=[];_0x32ef91[_0x2b64('0x5b')]({'model':db[_0x2b64('0x5c')],'as':_0x2b64('0x5c'),'attributes':['id',_0x2b64('0x5d')],'raw':!![]});_0x32ef91[_0x2b64('0x5b')]({'model':db[_0x2b64('0x5e')],'as':'Contact','attributes':['id',_0x2b64('0x5f'),'lastName'],'raw':!![]});if(_0x4e9960[_0x2b64('0x25')][_0x2b64('0x59')]){_0x32ef91['push']({'model':db[_0x2b64('0x60')],'as':_0x2b64('0x60'),'raw':!![]});}var _0xd1e9ca=[{'model':db[_0x2b64('0x3b')],'as':_0x2b64('0x61'),'attributes':['id',_0x2b64('0x38'),'createdAt','direction',_0x2b64('0x62'),'read'],'include':_0x32ef91}];_0xd1e9ca['push']({'model':db['OpenchannelAccount'],'as':_0x2b64('0x63'),'attributes':['id','name']});_0xd1e9ca[_0x2b64('0x5b')]({'model':db['User'],'as':_0x2b64('0x64'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x2b64('0x36')]({'where':{'id':_0x4e9960['params']['id']},'include':_0xd1e9ca})[_0x2b64('0x18')](handleEntityNotFound(_0x5a9aad,null))[_0x2b64('0x18')](function(_0x4ccf5a){if(_0x4ccf5a){var _0x3efd64=_0x4ccf5a[_0x2b64('0x65')]({'plain':!![]});fs[_0x2b64('0x66')](_0x4dc12d);var _0x437ee4={'channel':_0x2b64('0x67'),'account':_0x3efd64[_0x2b64('0x63')]['name'],'agent':_0x3efd64[_0x2b64('0x64')]?_0x3efd64[_0x2b64('0x64')][_0x2b64('0x5d')]:'N.A.','createdAt':moment(_0x3efd64[_0x2b64('0x68')])[_0x2b64('0x48')](_0x2b64('0x49'))['toString'](),'closedAt':_0x3efd64['closed']?moment(_0x3efd64['closedAt'])['format'](_0x2b64('0x49'))[_0x2b64('0x53')]():'','disposition':_0x3efd64['disposition'],'visibility':_0x3efd64['threadId']?_0x2b64('0x69'):_0x2b64('0x6a'),'messages':_(_0x3efd64['Messages'])[_0x2b64('0x44')]({'secret':![]})['map'](function(_0x6410eb){if(_0x6410eb[_0x2b64('0x60')]){var _0x129b2d=path[_0x2b64('0x58')](_0x84661c,_0x6410eb[_0x2b64('0x60')][_0x2b64('0x6b')]);if(fs[_0x2b64('0x6c')](_0x129b2d)){fs[_0x2b64('0x6d')](_0x129b2d)['pipe'](fs[_0x2b64('0x6e')](path[_0x2b64('0x58')](_0x4dc12d,_0x6410eb[_0x2b64('0x60')][_0x2b64('0x6b')])));}}return{'date':moment(_0x6410eb[_0x2b64('0x68')])[_0x2b64('0x48')](_0x2b64('0x49'))['toString'](),'sender':_0x6410eb[_0x2b64('0x6f')]==='out'?_0x6410eb['User']?_0x6410eb['User'][_0x2b64('0x5d')]:'System':_0x6410eb['Contact'][_0x2b64('0x5f')]+(_0x6410eb[_0x2b64('0x70')][_0x2b64('0x71')]?'\x20'+_0x6410eb[_0x2b64('0x70')][_0x2b64('0x71')]:''),'body':_0x6410eb['Attachment']?_0x6410eb['Attachment'][_0x2b64('0x6b')]:_0x6410eb[_0x2b64('0x38')],'direction':_0x6410eb[_0x2b64('0x6f')]==='out'?'A':'C','secret':_0x6410eb[_0x2b64('0x62')],'read':_0x6410eb[_0x2b64('0x72')],'attachment':_0x6410eb[_0x2b64('0x60')]};})[_0x2b64('0x73')]()};return ejs[_0x2b64('0x74')](path['join'](config[_0x2b64('0x54')],_0x2b64('0x55'),_0x2b64('0x75'),_0x2b64('0x76')),{'interaction':_0x437ee4})[_0x2b64('0x18')](function(_0x3c25c9){var _0x2edcbc=path[_0x2b64('0x58')](_0x4dc12d,_0x2b64('0x77')+_0x3efd64['id']+'-'+_0x415a6c+_0x2b64('0x78'));var _0x428157={'path':_0x2edcbc,'channel':_0x2b64('0x67'),'interactionId':_0x3efd64['id']};return pdf[_0x2b64('0x79')](_0x3c25c9,_0x428157);})[_0x2b64('0x18')](function(){return new Promise(function(_0x3c8de3,_0x25ad60){zipdir(_0x4dc12d,{'saveTo':_0x5b37fe},function(_0x395b17,_0x4da1d2){if(_0x395b17)return _0x25ad60(_0x395b17);return _0x3c8de3(_0x4da1d2);});})[_0x2b64('0x18')](function(){return new Promise(function(_0x5a07cc,_0x39ee12){rimraf(_0x4dc12d,function(_0x28f0e0){if(_0x28f0e0)_0x39ee12(_0x28f0e0);return _0x5a07cc();});});})[_0x2b64('0x18')](function(){return _0x5a9aad['download'](_0x5b37fe,_0xe4e07b,function(_0xcb47f6){if(_0xcb47f6){logger[_0x2b64('0x1b')](_0x2b64('0x7a'),_0xcb47f6);}else{fs[_0x2b64('0x7b')](_0x5b37fe);}});});});}else{return _0x5a9aad[_0x2b64('0xf')](0xc8);}})[_0x2b64('0x27')](handleError(_0x5a9aad,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 8af8871..cbddfee 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 _0x6a99=['unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','map','findAll'];(function(_0x5d07ff,_0x1f976f){var _0x5226ad=function(_0x1653a4){while(--_0x1653a4){_0x5d07ff['push'](_0x5d07ff['shift']());}};_0x5226ad(++_0x1f976f);}(_0x6a99,0x18c));var _0x96a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6a99[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x96a9('0x0'));var OpenchannelInteraction=require(_0x96a9('0x1'))['db'][_0x96a9('0x2')];var OpenchannelMessage=require(_0x96a9('0x1'))['db'][_0x96a9('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x96a9('0x4')](0x0);var events={'afterCreate':_0x96a9('0x5'),'afterUpdate':_0x96a9('0x6'),'afterDestroy':_0x96a9('0x7')};function emitEvent(_0x3eba1f){return function(_0x22adbe,_0x5ee907,_0x42210d){_0x22adbe[_0x96a9('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x66501){_0x22adbe[_0x96a9('0x9')]('Users',_0x66501[_0x96a9('0xa')](function(_0x2d30f7){return{'id':_0x2d30f7['id']};}));return OpenchannelMessage[_0x96a9('0xb')]({'where':{'OpenchannelInteractionId':_0x22adbe['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x304216){_0x22adbe[_0x96a9('0x9')](_0x96a9('0xc'),_0x304216['length']);OpenchannelInteractionEvents[_0x96a9('0xd')](_0x3eba1f+':'+_0x22adbe['id'],_0x22adbe);OpenchannelInteractionEvents[_0x96a9('0xd')](_0x3eba1f,_0x22adbe);_0x42210d(null);})[_0x96a9('0xe')](_0x42210d(null));};}for(var e in events){if(events[_0x96a9('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x96a9('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xa78a=['exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook'];(function(_0x51f2bb,_0x59e870){var _0x3c8b5d=function(_0x3de75b){while(--_0x3de75b){_0x51f2bb['push'](_0x51f2bb['shift']());}};_0x3c8b5d(++_0x59e870);}(_0xa78a,0xeb));var _0xaa78=function(_0x8a1f44,_0x2c92d3){_0x8a1f44=_0x8a1f44-0x0;var _0x3f7bee=_0xa78a[_0x8a1f44];return _0x3f7bee;};'use strict';var EventEmitter=require(_0xaa78('0x0'));var OpenchannelInteraction=require(_0xaa78('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xaa78('0x1'))['db'][_0xaa78('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xaa78('0x3')](0x0);var events={'afterCreate':_0xaa78('0x4'),'afterUpdate':_0xaa78('0x5'),'afterDestroy':'remove'};function emitEvent(_0x227d24){return function(_0x51fd0e,_0x5a91b0,_0x3390a1){_0x51fd0e[_0xaa78('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40c75e){_0x51fd0e[_0xaa78('0x7')](_0xaa78('0x8'),_0x40c75e[_0xaa78('0x9')](function(_0xc21896){return{'id':_0xc21896['id']};}));return OpenchannelMessage[_0xaa78('0xa')]({'where':{'OpenchannelInteractionId':_0x51fd0e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa78('0xb')](function(_0x244f57){_0x51fd0e[_0xaa78('0x7')]('unreadMessages',_0x244f57[_0xaa78('0xc')]);OpenchannelInteractionEvents[_0xaa78('0xd')](_0x227d24+':'+_0x51fd0e['id'],_0x51fd0e);OpenchannelInteractionEvents[_0xaa78('0xd')](_0x227d24,_0x51fd0e);_0x3390a1(null);})[_0xaa78('0xe')](_0x3390a1(null));};}for(var e in events){if(events[_0xaa78('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xaa78('0x10')](e,emitEvent(event));}}module[_0xaa78('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 923c94c..23d4fcb 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 _0x3550=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','lodash','util'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x3550,0x11b));var _0x0355=function(_0x1879ba,_0x8a6257){_0x1879ba=_0x1879ba-0x0;var _0x507437=_0x3550[_0x1879ba];return _0x507437;};'use strict';var _=require(_0x0355('0x0'));var util=require(_0x0355('0x1'));var logger=require(_0x0355('0x2'))('api');var moment=require(_0x0355('0x3'));var BPromise=require(_0x0355('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0355('0x5'));var config=require(_0x0355('0x6'));var attributes=require(_0x0355('0x7'));module[_0x0355('0x8')]=function(_0x1188ab,_0x2f9b92){return _0x1188ab['define'](_0x0355('0x9'),attributes,{'tableName':_0x0355('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0355('0xb'),'hooks':{'beforeUpdate':function(_0xb93e60,_0x2d057c,_0x42146d){if(_0xb93e60[_0x0355('0xc')](_0x0355('0xd'))){_0xb93e60[_0x0355('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x42146d(null,_0xb93e60);}}});}; \ No newline at end of file +var _0xfb98=['../../config/environment','./openchannelInteraction.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x225f62,_0x5cd94a){var _0xc44e8a=function(_0x4bb0f2){while(--_0x4bb0f2){_0x225f62['push'](_0x225f62['shift']());}};_0xc44e8a(++_0x5cd94a);}(_0xfb98,0xd5));var _0x8fb9=function(_0x5c7fd8,_0x16f4b1){_0x5c7fd8=_0x5c7fd8-0x0;var _0x1d314f=_0xfb98[_0x5c7fd8];return _0x1d314f;};'use strict';var _=require('lodash');var util=require(_0x8fb9('0x0'));var logger=require(_0x8fb9('0x1'))(_0x8fb9('0x2'));var moment=require(_0x8fb9('0x3'));var BPromise=require(_0x8fb9('0x4'));var rp=require(_0x8fb9('0x5'));var fs=require('fs');var path=require(_0x8fb9('0x6'));var rimraf=require(_0x8fb9('0x7'));var config=require(_0x8fb9('0x8'));var attributes=require(_0x8fb9('0x9'));module[_0x8fb9('0xa')]=function(_0x2be9c4,_0x465df2){return _0x2be9c4[_0x8fb9('0xb')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8fb9('0xc'),'collate':_0x8fb9('0xd'),'hooks':{'beforeUpdate':function(_0x9f3681,_0x59b28c,_0x7af428){if(_0x9f3681[_0x8fb9('0xe')](_0x8fb9('0xf'))){_0x9f3681['closedAt']=moment()[_0x8fb9('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x7af428(null,_0x9f3681);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index a77de24..3644e70 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 _0x3d39=['socket.io-emitter','redis','./openchannelInteraction.socket','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','then','AddTagsToOpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','localhost'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3d39,0x14a));var _0x93d3=function(_0x1bcc02,_0x3f6e5c){_0x1bcc02=_0x1bcc02-0x0;var _0x55c792=_0x3d39[_0x1bcc02];return _0x55c792;};'use strict';var _=require(_0x93d3('0x0'));var util=require('util');var moment=require(_0x93d3('0x1'));var BPromise=require(_0x93d3('0x2'));var rs=require(_0x93d3('0x3'));var fs=require('fs');var Redis=require(_0x93d3('0x4'));var db=require(_0x93d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93d3('0x6'))('rpc');var config=require(_0x93d3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x93d3('0x8')][_0x93d3('0x9')]({'port':0x232a});config['redis']=_[_0x93d3('0xa')](config['redis'],{'host':_0x93d3('0xb'),'port':0x18eb});var socket=require(_0x93d3('0xc'))(new Redis(config[_0x93d3('0xd')]));require(_0x93d3('0xe'))['register'](socket);function respondWithRpcPromise(_0x5ab4ae,_0x3256c3,_0x128859){return new BPromise(function(_0x23cc27,_0x3037c5){return client['request'](_0x5ab4ae,_0x128859)['then'](function(_0x209675){logger['info'](_0x93d3('0xf'),_0x3256c3,'request\x20sent');logger[_0x93d3('0x10')](_0x93d3('0x11'),_0x3256c3,'request\x20sent',JSON[_0x93d3('0x12')](_0x209675));if(_0x209675['error']){if(_0x209675[_0x93d3('0x13')]['code']===0x1f4){logger[_0x93d3('0x13')](_0x93d3('0xf'),_0x3256c3,_0x209675[_0x93d3('0x13')]['message']);return _0x3037c5(_0x209675[_0x93d3('0x13')][_0x93d3('0x14')]);}logger[_0x93d3('0x13')](_0x93d3('0xf'),_0x3256c3,_0x209675[_0x93d3('0x13')]['message']);return _0x23cc27(_0x209675['error'][_0x93d3('0x14')]);}else{logger[_0x93d3('0x15')](_0x93d3('0xf'),_0x3256c3,'request\x20sent');_0x23cc27(_0x209675[_0x93d3('0x16')]['message']);}})[_0x93d3('0x17')](function(_0x22fc7f){logger[_0x93d3('0x13')](_0x93d3('0xf'),_0x3256c3,_0x22fc7f);_0x3037c5(_0x22fc7f);});});}exports[_0x93d3('0x18')]=function(_0x10ab9f){var _0x14dd74=this;return new Promise(function(_0x3d8221,_0x5e9aea){return db[_0x93d3('0x19')]['update'](_0x10ab9f[_0x93d3('0x1a')],{'raw':_0x10ab9f[_0x93d3('0x1b')]?_0x10ab9f['options'][_0x93d3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10ab9f[_0x93d3('0x1b')]?_0x10ab9f['options'][_0x93d3('0x1d')]||null:null,'attributes':_0x10ab9f['options']?_0x10ab9f[_0x93d3('0x1b')][_0x93d3('0x1e')]||null:null,'limit':_0x10ab9f['options']?_0x10ab9f[_0x93d3('0x1b')]['limit']||null:null})[_0x93d3('0x1f')](function(_0x397117){logger['info'](_0x93d3('0x18'),_0x10ab9f);logger[_0x93d3('0x10')]('UpdateOpenchannelInteraction',_0x10ab9f,JSON[_0x93d3('0x12')](_0x397117));_0x3d8221(_0x397117);})[_0x93d3('0x17')](function(_0x1dd95a){logger[_0x93d3('0x13')](_0x93d3('0x18'),_0x1dd95a['message'],_0x10ab9f);_0x5e9aea(_0x14dd74[_0x93d3('0x13')](0x1f4,_0x1dd95a[_0x93d3('0x14')]));});});};exports[_0x93d3('0x20')]=function(_0x1e084c){return new Promise(function(_0x1189cd,_0x4df434){return db[_0x93d3('0x19')][_0x93d3('0x21')]({'where':_0x1e084c[_0x93d3('0x1b')]?_0x1e084c['options']['where']||null:null})['then'](function(_0xec0dad){if(_0xec0dad){return _0xec0dad['addTags'](_0x1e084c['body'][_0x93d3('0x22')],_[_0x93d3('0x23')](_0x1e084c[_0x93d3('0x1a')],[_0x93d3('0x22'),'id'])||{});}})[_0x93d3('0x24')](function(_0x157b8e){logger[_0x93d3('0x15')]('AddTags',_0x1e084c);logger[_0x93d3('0x10')](_0x93d3('0x25'),_0x1e084c,JSON[_0x93d3('0x12')](_0x157b8e));_0x1189cd(_0x157b8e);})[_0x93d3('0x17')](function(_0x5558f7){logger['error'](_0x93d3('0x25'),_0x5558f7[_0x93d3('0x14')],_0x1e084c);_0x4df434(_this[_0x93d3('0x13')](0x1f4,_0x5558f7[_0x93d3('0x14')]));});});}; \ No newline at end of file +var _0xca91=['find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','debug','AddTagsToOpenchannelInteraction'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xca91,0x19b));var _0x1ca9=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0xca91[_0x3f578f];return _0x32c754;};'use strict';var _=require(_0x1ca9('0x0'));var util=require(_0x1ca9('0x1'));var moment=require(_0x1ca9('0x2'));var BPromise=require(_0x1ca9('0x3'));var rs=require(_0x1ca9('0x4'));var fs=require('fs');var Redis=require(_0x1ca9('0x5'));var db=require(_0x1ca9('0x6'))['db'];var utils=require(_0x1ca9('0x7'));var logger=require(_0x1ca9('0x8'))(_0x1ca9('0x9'));var config=require('../../config/environment');var jayson=require(_0x1ca9('0xa'));var client=jayson[_0x1ca9('0xb')][_0x1ca9('0xc')]({'port':0x232a});config[_0x1ca9('0xd')]=_[_0x1ca9('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1ca9('0xf'))(new Redis(config[_0x1ca9('0xd')]));require(_0x1ca9('0x10'))[_0x1ca9('0x11')](socket);function respondWithRpcPromise(_0x4ea50f,_0x26e8c2,_0x46498c){return new BPromise(function(_0x4006e4,_0x4e09d8){return client[_0x1ca9('0x12')](_0x4ea50f,_0x46498c)[_0x1ca9('0x13')](function(_0x44fa2d){logger[_0x1ca9('0x14')](_0x1ca9('0x15'),_0x26e8c2,'request\x20sent');logger['debug'](_0x1ca9('0x16'),_0x26e8c2,_0x1ca9('0x17'),JSON[_0x1ca9('0x18')](_0x44fa2d));if(_0x44fa2d['error']){if(_0x44fa2d['error'][_0x1ca9('0x19')]===0x1f4){logger[_0x1ca9('0x1a')](_0x1ca9('0x15'),_0x26e8c2,_0x44fa2d[_0x1ca9('0x1a')][_0x1ca9('0x1b')]);return _0x4e09d8(_0x44fa2d[_0x1ca9('0x1a')][_0x1ca9('0x1b')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x26e8c2,_0x44fa2d['error'][_0x1ca9('0x1b')]);return _0x4006e4(_0x44fa2d['error'][_0x1ca9('0x1b')]);}else{logger[_0x1ca9('0x14')](_0x1ca9('0x15'),_0x26e8c2,'request\x20sent');_0x4006e4(_0x44fa2d[_0x1ca9('0x1c')][_0x1ca9('0x1b')]);}})[_0x1ca9('0x1d')](function(_0x8b8e49){logger['error'](_0x1ca9('0x15'),_0x26e8c2,_0x8b8e49);_0x4e09d8(_0x8b8e49);});});}exports[_0x1ca9('0x1e')]=function(_0x5cc3b6){var _0x1e1b8b=this;return new Promise(function(_0x3f933f,_0x1e2681){return db[_0x1ca9('0x1f')][_0x1ca9('0x20')](_0x5cc3b6[_0x1ca9('0x21')],{'raw':_0x5cc3b6[_0x1ca9('0x22')]?_0x5cc3b6[_0x1ca9('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cc3b6[_0x1ca9('0x22')]?_0x5cc3b6['options'][_0x1ca9('0x23')]||null:null,'attributes':_0x5cc3b6[_0x1ca9('0x22')]?_0x5cc3b6[_0x1ca9('0x22')][_0x1ca9('0x24')]||null:null,'limit':_0x5cc3b6[_0x1ca9('0x22')]?_0x5cc3b6[_0x1ca9('0x22')]['limit']||null:null})[_0x1ca9('0x13')](function(_0x428919){logger['info'](_0x1ca9('0x1e'),_0x5cc3b6);logger[_0x1ca9('0x25')](_0x1ca9('0x1e'),_0x5cc3b6,JSON[_0x1ca9('0x18')](_0x428919));_0x3f933f(_0x428919);})['catch'](function(_0x17b825){logger['error'](_0x1ca9('0x1e'),_0x17b825[_0x1ca9('0x1b')],_0x5cc3b6);_0x1e2681(_0x1e1b8b[_0x1ca9('0x1a')](0x1f4,_0x17b825[_0x1ca9('0x1b')]));});});};exports[_0x1ca9('0x26')]=function(_0x4da016){return new Promise(function(_0x554c8f,_0x29a434){return db[_0x1ca9('0x1f')][_0x1ca9('0x27')]({'where':_0x4da016[_0x1ca9('0x22')]?_0x4da016[_0x1ca9('0x22')]['where']||null:null})[_0x1ca9('0x13')](function(_0x10d9c2){if(_0x10d9c2){return _0x10d9c2[_0x1ca9('0x28')](_0x4da016[_0x1ca9('0x21')][_0x1ca9('0x29')],_[_0x1ca9('0x2a')](_0x4da016[_0x1ca9('0x21')],[_0x1ca9('0x29'),'id'])||{});}})[_0x1ca9('0x2b')](function(_0x2d2c31){logger[_0x1ca9('0x14')](_0x1ca9('0x2c'),_0x4da016);logger['debug']('AddTags',_0x4da016,JSON[_0x1ca9('0x18')](_0x2d2c31));_0x554c8f(_0x2d2c31);})[_0x1ca9('0x1d')](function(_0x36f8d5){logger[_0x1ca9('0x1a')](_0x1ca9('0x2c'),_0x36f8d5[_0x1ca9('0x1b')],_0x4da016);_0x29a434(_this['error'](0x1f4,_0x36f8d5[_0x1ca9('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 9b5eb18..411a0f2 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 _0x9015=['emit','removeListener','register','length','openchannelInteraction:','save','remove'];(function(_0x50e818,_0x68ddd1){var _0x58fa49=function(_0x43eefe){while(--_0x43eefe){_0x50e818['push'](_0x50e818['shift']());}};_0x58fa49(++_0x68ddd1);}(_0x9015,0x1e8));var _0x5901=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x9015[_0x1203f];return _0x365f0a;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x5901('0x0'),_0x5901('0x1'),'update'];function createListener(_0x55286a,_0x570d9b){return function(_0x53b622){_0x570d9b[_0x5901('0x2')](_0x55286a,_0x53b622);};}function removeListener(_0x22bc9d,_0x7d632c){return function(){OpenchannelInteractionEvents[_0x5901('0x3')](_0x22bc9d,_0x7d632c);};}exports[_0x5901('0x4')]=function(_0x6253f7){for(var _0x5e49ca=0x0,_0x36eb90=events[_0x5901('0x5')];_0x5e49ca<_0x36eb90;_0x5e49ca++){var _0x4cb7e3=events[_0x5e49ca];var _0x433695=createListener(_0x5901('0x6')+_0x4cb7e3,_0x6253f7);OpenchannelInteractionEvents['on'](_0x4cb7e3,_0x433695);}}; \ No newline at end of file +var _0x1fde=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','update'];(function(_0x50ff28,_0x5e9631){var _0x1a9cdb=function(_0x21c28b){while(--_0x21c28b){_0x50ff28['push'](_0x50ff28['shift']());}};_0x1a9cdb(++_0x5e9631);}(_0x1fde,0xfa));var _0xe1fd=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x1fde[_0x10dbf6];return _0x452147;};'use strict';var OpenchannelInteractionEvents=require(_0xe1fd('0x0'));var events=['save','remove',_0xe1fd('0x1')];function createListener(_0x568da4,_0x54a6da){return function(_0x5a8142){_0x54a6da[_0xe1fd('0x2')](_0x568da4,_0x5a8142);};}function removeListener(_0x314049,_0x225678){return function(){OpenchannelInteractionEvents[_0xe1fd('0x3')](_0x314049,_0x225678);};}exports[_0xe1fd('0x4')]=function(_0x424fb4){for(var _0x1b487f=0x0,_0xd761e4=events[_0xe1fd('0x5')];_0x1b487f<_0xd761e4;_0x1b487f++){var _0x37ac5d=events[_0x1b487f];var _0x831e0c=createListener(_0xe1fd('0x6')+_0x37ac5d,_0x424fb4);OpenchannelInteractionEvents['on'](_0x37ac5d,_0x831e0c);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 4c2a3e8..77ddbf4 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x2b18e9,_0x18e52f){var _0x9d0c32=function(_0x3ba0ba){while(--_0x3ba0ba){_0x2b18e9['push'](_0x2b18e9['shift']());}};_0x9d0c32(++_0x18e52f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x2e00b6,_0x8c052c){var _0x5777d6=function(_0x3ba097){while(--_0x3ba097){_0x2e00b6['push'](_0x2e00b6['shift']());}};_0x5777d6(++_0x8c052c);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d6161,_0x2608f8){_0x5d6161=_0x5d6161-0x0;var _0x24135c=_0xedd9[_0x5d6161];return _0x24135c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 5c4c63d..d838c48 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 _0x57f8=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x5ad66c,_0x3da763){var _0x16cd4b=function(_0x21b3a2){while(--_0x21b3a2){_0x5ad66c['push'](_0x5ad66c['shift']());}};_0x16cd4b(++_0x3da763);}(_0x57f8,0x198));var _0x857f=function(_0x34d2a0,_0x6cde4f){_0x34d2a0=_0x34d2a0-0x0;var _0x505c5b=_0x57f8[_0x34d2a0];return _0x505c5b;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'body':{'type':Sequelize[_0x857f('0x1')](_0x857f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x857f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x857f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x857f('0x4')]('in',_0x857f('0x5')),'defaultValue':_0x857f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x857f('0x6')]},'providerName':{'type':Sequelize[_0x857f('0x7')]},'providerResponse':{'type':Sequelize[_0x857f('0x1')]}}; \ No newline at end of file +var _0x594d=['DATE','STRING','sequelize','medium','BOOLEAN','out'];(function(_0x289bc0,_0x3503bb){var _0x3f5c89=function(_0x6289f8){while(--_0x6289f8){_0x289bc0['push'](_0x289bc0['shift']());}};_0x3f5c89(++_0x3503bb);}(_0x594d,0x92));var _0xd594=function(_0x4ceac4,_0x44efad){_0x4ceac4=_0x4ceac4-0x0;var _0x10eb6d=_0x594d[_0x4ceac4];return _0x10eb6d;};'use strict';var Sequelize=require(_0xd594('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xd594('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xd594('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd594('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd594('0x3')),'defaultValue':_0xd594('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd594('0x4')]},'providerName':{'type':Sequelize[_0xd594('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 a7662c2..d29f007 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 _0x1772=['api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','OpenchannelMessage','type','key','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','create','body','update','find','describe','accept','openchannel','acceptMessage','reject','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','internal','interface','channel','motionChannel','event','EventManager','rejectmessage','util','lodash','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x1772,0x130));var _0x2177=function(_0x3fbb15,_0x4ade43){_0x3fbb15=_0x3fbb15-0x0;var _0x16fe3a=_0x1772[_0x3fbb15];return _0x16fe3a;};'use strict';var util=require(_0x2177('0x0'));var _=require(_0x2177('0x1'));var Redis=require(_0x2177('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x2177('0x3'));var logger=require(_0x2177('0x4'))(_0x2177('0x5'));var config=require(_0x2177('0x6'));var db=require(_0x2177('0x7'))['db'];config[_0x2177('0x8')]=_['defaults'](config[_0x2177('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2177('0x9'))(new Redis(config['redis']));require(_0x2177('0xa'))['register'](socket);var jayson=require(_0x2177('0xb'));var client=jayson[_0x2177('0xc')][_0x2177('0xd')]({'port':0x232c});var client9002=jayson[_0x2177('0xc')]['http']({'port':0x232a});var interaction_log=require(_0x2177('0x4'))(_0x2177('0xe'));function respondWithRpcPromise(_0x1ccfce,_0x2ff5ad,_0x1cacca,_0x11874a){return new Promise(function(_0x109fdb,_0x2366f3){var _0x3bbfd1=_0x11874a||client;return _0x3bbfd1[_0x2177('0xf')](_0x1ccfce,_0x1cacca)[_0x2177('0x10')](function(_0x1a0ab1){logger[_0x2177('0x11')](_0x2177('0x12'),_0x2ff5ad,_0x2177('0x13'));logger[_0x2177('0x14')](_0x2177('0x15'),_0x2ff5ad,'request\x20sent',JSON['stringify'](_0x1a0ab1));if(_0x1a0ab1[_0x2177('0x16')]){if(_0x1a0ab1[_0x2177('0x16')][_0x2177('0x17')]===0x1f4){logger[_0x2177('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x2ff5ad,_0x1a0ab1[_0x2177('0x16')][_0x2177('0x18')]);return _0x2366f3(_0x1a0ab1[_0x2177('0x16')][_0x2177('0x18')]);}logger[_0x2177('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x2ff5ad,_0x1a0ab1['error'][_0x2177('0x18')]);return _0x109fdb(_0x1a0ab1[_0x2177('0x16')]['message']);}else{logger['info'](_0x2177('0x12'),_0x2ff5ad,_0x2177('0x13'));_0x109fdb(_0x1a0ab1['result'][_0x2177('0x18')]);}})[_0x2177('0x19')](function(_0x2c4e98){logger[_0x2177('0x16')](_0x2177('0x12'),_0x2ff5ad,_0x2c4e98);_0x2366f3(_0x2c4e98);});});}function respondWithResult(_0x8f7681,_0x3fcc8e){_0x3fcc8e=_0x3fcc8e||0xc8;return function(_0x4b71e5){if(_0x4b71e5){return _0x8f7681[_0x2177('0x1a')](_0x3fcc8e)[_0x2177('0x1b')](_0x4b71e5);}};}function respondWithFilteredResult(_0x48810f,_0x23b5fd){return function(_0x5351ea){if(_0x5351ea){var _0x5d9c70=typeof _0x23b5fd[_0x2177('0x1c')]===_0x2177('0x1d')&&typeof _0x23b5fd[_0x2177('0x1e')]==='undefined';var _0x1f86d9=_0x5351ea[_0x2177('0x1f')];var _0xd37cac=_0x5d9c70?0x0:_0x23b5fd[_0x2177('0x1c')];var _0x984edb=_0x5d9c70?_0x5351ea[_0x2177('0x1f')]:_0x23b5fd[_0x2177('0x1c')]+_0x23b5fd[_0x2177('0x1e')];var _0x5608be;if(_0x984edb>=_0x1f86d9){_0x984edb=_0x1f86d9;_0x5608be=0xc8;}else{_0x5608be=0xce;}_0x48810f[_0x2177('0x1a')](_0x5608be);return _0x48810f[_0x2177('0x20')](_0x2177('0x21'),_0xd37cac+'-'+_0x984edb+'/'+_0x1f86d9)[_0x2177('0x1b')](_0x5351ea);}return null;};}function saveUpdates(_0x48e16c){return function(_0x2a942a){if(_0x2a942a){return _0x2a942a['update'](_0x48e16c)[_0x2177('0x10')](function(_0x1c1d0e){return _0x1c1d0e;});}return null;};}function removeEntity(_0xdb47ac){return function(_0x12158e){if(_0x12158e){return _0x12158e[_0x2177('0x22')]()[_0x2177('0x10')](function(){_0xdb47ac[_0x2177('0x1a')](0xcc)[_0x2177('0x23')]();});}};}function handleEntityNotFound(_0x57c19b){return function(_0x1a0266){if(!_0x1a0266){_0x57c19b[_0x2177('0x24')](0x194);}return _0x1a0266;};}function handleError(_0x53bfaa,_0x1f5726){_0x1f5726=_0x1f5726||0x1f4;return function(_0x2c9d85){logger['error'](_0x2c9d85[_0x2177('0x25')]);if(_0x2c9d85[_0x2177('0x26')]){delete _0x2c9d85['name'];}_0x53bfaa[_0x2177('0x1a')](_0x1f5726)[_0x2177('0x27')](_0x2c9d85);};}exports[_0x2177('0x28')]=function(_0x387baa,_0x40c137){var _0x1abf2b={},_0x567072={},_0x2ef7f5={'count':0x0,'rows':[]};var _0x7320b8=_[_0x2177('0x29')](db[_0x2177('0x2a')]['rawAttributes'],function(_0x16d06e){return{'name':_0x16d06e['fieldName'],'type':_0x16d06e[_0x2177('0x2b')][_0x2177('0x2c')]};});_0x567072['model']=_[_0x2177('0x29')](_0x7320b8,'name');_0x567072[_0x2177('0x2d')]=_['keys'](_0x387baa[_0x2177('0x2d')]);_0x567072['filters']=_['intersection'](_0x567072[_0x2177('0x2e')],_0x567072['query']);_0x1abf2b['attributes']=_[_0x2177('0x2f')](_0x567072[_0x2177('0x2e')],qs[_0x2177('0x30')](_0x387baa['query'][_0x2177('0x30')]));_0x1abf2b[_0x2177('0x31')]=_0x1abf2b['attributes'][_0x2177('0x32')]?_0x1abf2b[_0x2177('0x31')]:_0x567072[_0x2177('0x2e')];if(!_0x387baa['query'][_0x2177('0x33')](_0x2177('0x34'))){_0x1abf2b[_0x2177('0x1e')]=qs['limit'](_0x387baa['query'][_0x2177('0x1e')]);_0x1abf2b[_0x2177('0x1c')]=qs[_0x2177('0x1c')](_0x387baa[_0x2177('0x2d')][_0x2177('0x1c')]);}_0x1abf2b[_0x2177('0x35')]=qs[_0x2177('0x36')](_0x387baa['query'][_0x2177('0x36')]);_0x1abf2b[_0x2177('0x37')]=qs[_0x2177('0x38')](_['pick'](_0x387baa[_0x2177('0x2d')],_0x567072[_0x2177('0x38')]),_0x7320b8);if(_0x387baa[_0x2177('0x2d')][_0x2177('0x39')]){_0x1abf2b['where']=_['merge'](_0x1abf2b['where'],{'$or':_[_0x2177('0x29')](_0x7320b8,function(_0x2921f9){if(_0x2921f9['type']!=='VIRTUAL'){var _0x352a86={};_0x352a86[_0x2921f9['name']]={'$like':'%'+_0x387baa['query'][_0x2177('0x39')]+'%'};return _0x352a86;}})});}_0x1abf2b=_[_0x2177('0x3a')]({},_0x1abf2b,_0x387baa[_0x2177('0x3b')]);var _0xb1698a={'where':_0x1abf2b[_0x2177('0x37')]};return db[_0x2177('0x2a')]['count'](_0xb1698a)[_0x2177('0x10')](function(_0x695b14){_0x2ef7f5[_0x2177('0x1f')]=_0x695b14;if(_0x387baa[_0x2177('0x2d')][_0x2177('0x3c')]){_0x1abf2b[_0x2177('0x3d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x2177('0x3e')](_0x1abf2b);})[_0x2177('0x10')](function(_0x3f16a0){_0x2ef7f5[_0x2177('0x3f')]=_0x3f16a0;return _0x2ef7f5;})[_0x2177('0x10')](respondWithFilteredResult(_0x40c137,_0x1abf2b))[_0x2177('0x19')](handleError(_0x40c137,null));};exports['show']=function(_0x5688f8,_0x2d711c){var _0x4b327f={'raw':!![],'where':{'id':_0x5688f8[_0x2177('0x40')]['id']}},_0x50eb64={};_0x50eb64[_0x2177('0x2e')]=_[_0x2177('0x41')](db[_0x2177('0x2a')][_0x2177('0x42')]);_0x50eb64[_0x2177('0x2d')]=_[_0x2177('0x41')](_0x5688f8[_0x2177('0x2d')]);_0x50eb64[_0x2177('0x38')]=_['intersection'](_0x50eb64[_0x2177('0x2e')],_0x50eb64[_0x2177('0x2d')]);_0x4b327f[_0x2177('0x31')]=_['intersection'](_0x50eb64[_0x2177('0x2e')],qs[_0x2177('0x30')](_0x5688f8['query'][_0x2177('0x30')]));_0x4b327f[_0x2177('0x31')]=_0x4b327f[_0x2177('0x31')][_0x2177('0x32')]?_0x4b327f['attributes']:_0x50eb64['model'];if(_0x5688f8[_0x2177('0x2d')][_0x2177('0x3c')]){_0x4b327f['include']=[{'all':!![]}];}_0x4b327f=_[_0x2177('0x3a')]({},_0x4b327f,_0x5688f8[_0x2177('0x3b')]);return db[_0x2177('0x2a')]['find'](_0x4b327f)[_0x2177('0x10')](handleEntityNotFound(_0x2d711c,null))[_0x2177('0x10')](respondWithResult(_0x2d711c,null))[_0x2177('0x19')](handleError(_0x2d711c,null));};exports[_0x2177('0x43')]=function(_0x70b080,_0x117b10){return db['OpenchannelMessage'][_0x2177('0x43')](_0x70b080[_0x2177('0x44')],{})[_0x2177('0x10')](respondWithResult(_0x117b10,0xc9))[_0x2177('0x19')](handleError(_0x117b10,null));};exports[_0x2177('0x45')]=function(_0x103008,_0x4e6574){if(_0x103008[_0x2177('0x44')]['id']){delete _0x103008[_0x2177('0x44')]['id'];}return db['OpenchannelMessage'][_0x2177('0x46')]({'where':{'id':_0x103008[_0x2177('0x40')]['id']}})['then'](handleEntityNotFound(_0x4e6574,null))[_0x2177('0x10')](saveUpdates(_0x103008[_0x2177('0x44')],null))[_0x2177('0x10')](respondWithResult(_0x4e6574,null))[_0x2177('0x19')](handleError(_0x4e6574,null));};exports['destroy']=function(_0x308244,_0x3c6c26){return db[_0x2177('0x2a')]['find']({'where':{'id':_0x308244[_0x2177('0x40')]['id']}})[_0x2177('0x10')](handleEntityNotFound(_0x3c6c26,null))['then'](removeEntity(_0x3c6c26,null))[_0x2177('0x19')](handleError(_0x3c6c26,null));};exports[_0x2177('0x47')]=function(_0xbadc8b,_0xc2b968){return db[_0x2177('0x2a')][_0x2177('0x47')]()[_0x2177('0x10')](respondWithResult(_0xc2b968,null))[_0x2177('0x19')](handleError(_0xc2b968,null));};exports[_0x2177('0x48')]=function(_0x164666,_0x442517){var _0x4745fc=_0x2177('0x49');return interactionService[_0x2177('0x4a')](_0x164666,_0x4745fc)[_0x2177('0x10')](respondWithResult(_0x442517,null))['catch'](handleError(_0x442517,null));};exports[_0x2177('0x4b')]=function(_0x416613,_0x2d982d){var _0x4aa5e7={'agent':{},'channel':_0x2177('0x49')};if(_0x416613['body']['id']){delete _0x416613['body']['id'];}_0x416613['body'][_0x2177('0x4c')]=_0x416613[_0x2177('0x44')]['UserId']||_0x416613[_0x2177('0x4d')]['id'];_0x4aa5e7[_0x2177('0x4e')]['id']=_0x416613[_0x2177('0x44')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x416613[_0x2177('0x40')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d982d,null))['then'](function(_0x72d1df){if(_0x72d1df){_0x4aa5e7[_0x2177('0x18')]=_0x72d1df['get']({'plain':!![]});return db[_0x2177('0x4f')]['find']({'where':{'id':_0x72d1df[_0x2177('0x50')]}});}return null;})[_0x2177('0x10')](handleEntityNotFound(_0x2d982d,null))[_0x2177('0x10')](function(_0xba952d){if(_0xba952d){_0x4aa5e7[_0x2177('0x51')]=_0xba952d[_0x2177('0x52')]({'plain':!![]});interaction_log[_0x2177('0x11')](_0x2177('0x53'),_0x416613['user']['id'],_0x416613[_0x2177('0x4d')][_0x2177('0x26')],_0x416613[_0x2177('0x4d')][_0x2177('0x54')],_0x4aa5e7[_0x2177('0x51')]['id'],_0x416613[_0x2177('0x44')]?JSON[_0x2177('0x55')](_0x416613[_0x2177('0x44')]):_0x2177('0x56'));return respondWithRpcPromise(_0x2177('0x57'),_0x2177('0x58'),_0x4aa5e7);}return null;})[_0x2177('0x10')](function(_0x53e916){var _0x52b7b0=_0x2177('0x59')+_0x53e916[_0x2177('0x18')][_0x2177('0x5a')];return db['sequelize']['query'](_0x52b7b0,{'type':db['Sequelize'][_0x2177('0x5b')][_0x2177('0x5c')],'raw':!![]})['then'](function(_0x581f8e){return _0x581f8e;});})[_0x2177('0x10')](function(_0x5d5a74){if(_0x5d5a74){_0x4aa5e7[_0x2177('0x18')][_0x2177('0x5d')]=_0x5d5a74[0x0];if(!_0x416613[_0x2177('0x44')][_0x2177('0x4c')])return;return db[_0x2177('0x5e')]['find']({'where':{'id':_0x416613[_0x2177('0x44')]['UserId'],'role':'agent'},'attributes':['id',_0x2177('0x26'),_0x2177('0x5f'),'email',_0x2177('0x60')],'raw':!![]});}return null;})[_0x2177('0x10')](function(_0x4f8012){if(!_0x4f8012)return null;_0x4aa5e7[_0x2177('0x18')][_0x2177('0x4e')]=_0x4f8012;return _0x4aa5e7;})[_0x2177('0x10')](function(_0xd09cba){if(_0xd09cba){_0xd09cba['message'][_0x2177('0x61')]=util['format']('SIP/%s',_0x416613[_0x2177('0x4d')][_0x2177('0x26')]);_0xd09cba['message'][_0x2177('0x62')]=_0x4aa5e7['channel'];_0xd09cba[_0x2177('0x18')][_0x2177('0x63')]=_0x4aa5e7[_0x2177('0x62')];_0xd09cba[_0x2177('0x18')][_0x2177('0x64')]=_0x2177('0x4b');respondWithRpcPromise('EventManager',_0x2177('0x65'),{'event':_0x2177('0x66'),'message':_0xd09cba[_0x2177('0x18')]},client9002);return _0x4aa5e7;}return null;})[_0x2177('0x10')](respondWithResult(_0x2d982d,null))[_0x2177('0x19')](handleError(_0x2d982d,null));}; \ No newline at end of file +var _0xeef0=['VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','accept','openchannel','acceptMessage','reject','UserId','user','OpenchannelInteractionId','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','agent','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','sort','where','filters','pick','filter','merge'];(function(_0x43ffe1,_0x933b2){var _0xc145bc=function(_0x3ef608){while(--_0x3ef608){_0x43ffe1['push'](_0x43ffe1['shift']());}};_0xc145bc(++_0x933b2);}(_0xeef0,0x1c8));var _0x0eef=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xeef0[_0x4b2436];return _0x4f5ab2;};'use strict';var util=require(_0x0eef('0x0'));var _=require(_0x0eef('0x1'));var Redis=require(_0x0eef('0x2'));var interactionService=require(_0x0eef('0x3'));var qs=require(_0x0eef('0x4'));var logger=require(_0x0eef('0x5'))(_0x0eef('0x6'));var config=require(_0x0eef('0x7'));var db=require(_0x0eef('0x8'))['db'];config[_0x0eef('0x9')]=_[_0x0eef('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x0eef('0xb')](socket);var jayson=require(_0x0eef('0xc'));var client=jayson[_0x0eef('0xd')][_0x0eef('0xe')]({'port':0x232c});var client9002=jayson[_0x0eef('0xd')][_0x0eef('0xe')]({'port':0x232a});var interaction_log=require(_0x0eef('0x5'))('openchannel-interactions');function respondWithRpcPromise(_0x4280db,_0x1818c0,_0x509f1b,_0xb2efeb){return new Promise(function(_0x261a15,_0x36ba8f){var _0x440bbe=_0xb2efeb||client;return _0x440bbe[_0x0eef('0xf')](_0x4280db,_0x509f1b)['then'](function(_0x5c85ed){logger[_0x0eef('0x10')](_0x0eef('0x11'),_0x1818c0,_0x0eef('0x12'));logger[_0x0eef('0x13')](_0x0eef('0x14'),_0x1818c0,_0x0eef('0x12'),JSON[_0x0eef('0x15')](_0x5c85ed));if(_0x5c85ed[_0x0eef('0x16')]){if(_0x5c85ed[_0x0eef('0x16')][_0x0eef('0x17')]===0x1f4){logger[_0x0eef('0x16')](_0x0eef('0x11'),_0x1818c0,_0x5c85ed[_0x0eef('0x16')][_0x0eef('0x18')]);return _0x36ba8f(_0x5c85ed[_0x0eef('0x16')][_0x0eef('0x18')]);}logger[_0x0eef('0x16')](_0x0eef('0x11'),_0x1818c0,_0x5c85ed[_0x0eef('0x16')]['message']);return _0x261a15(_0x5c85ed[_0x0eef('0x16')][_0x0eef('0x18')]);}else{logger[_0x0eef('0x10')](_0x0eef('0x11'),_0x1818c0,_0x0eef('0x12'));_0x261a15(_0x5c85ed[_0x0eef('0x19')]['message']);}})['catch'](function(_0x41c95d){logger[_0x0eef('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1818c0,_0x41c95d);_0x36ba8f(_0x41c95d);});});}function respondWithResult(_0x52875f,_0x5e9e02){_0x5e9e02=_0x5e9e02||0xc8;return function(_0x4c4d22){if(_0x4c4d22){return _0x52875f[_0x0eef('0x1a')](_0x5e9e02)[_0x0eef('0x1b')](_0x4c4d22);}};}function respondWithFilteredResult(_0x4e0944,_0x45028b){return function(_0x939926){if(_0x939926){var _0x5be8ff=typeof _0x45028b[_0x0eef('0x1c')]===_0x0eef('0x1d')&&typeof _0x45028b['limit']===_0x0eef('0x1d');var _0x4891eb=_0x939926[_0x0eef('0x1e')];var _0x42095b=_0x5be8ff?0x0:_0x45028b[_0x0eef('0x1c')];var _0x349deb=_0x5be8ff?_0x939926[_0x0eef('0x1e')]:_0x45028b[_0x0eef('0x1c')]+_0x45028b[_0x0eef('0x1f')];var _0x137c33;if(_0x349deb>=_0x4891eb){_0x349deb=_0x4891eb;_0x137c33=0xc8;}else{_0x137c33=0xce;}_0x4e0944[_0x0eef('0x1a')](_0x137c33);return _0x4e0944[_0x0eef('0x20')](_0x0eef('0x21'),_0x42095b+'-'+_0x349deb+'/'+_0x4891eb)[_0x0eef('0x1b')](_0x939926);}return null;};}function saveUpdates(_0x49fa1f){return function(_0x6c0726){if(_0x6c0726){return _0x6c0726[_0x0eef('0x22')](_0x49fa1f)[_0x0eef('0x23')](function(_0x3c618a){return _0x3c618a;});}return null;};}function removeEntity(_0x593393){return function(_0x5c3315){if(_0x5c3315){return _0x5c3315['destroy']()[_0x0eef('0x23')](function(){_0x593393[_0x0eef('0x1a')](0xcc)[_0x0eef('0x24')]();});}};}function handleEntityNotFound(_0x57a384){return function(_0x400414){if(!_0x400414){_0x57a384[_0x0eef('0x25')](0x194);}return _0x400414;};}function handleError(_0x6947de,_0x24609e){_0x24609e=_0x24609e||0x1f4;return function(_0x2c36ef){logger[_0x0eef('0x16')](_0x2c36ef[_0x0eef('0x26')]);if(_0x2c36ef[_0x0eef('0x27')]){delete _0x2c36ef[_0x0eef('0x27')];}_0x6947de['status'](_0x24609e)['send'](_0x2c36ef);};}exports[_0x0eef('0x28')]=function(_0x49552b,_0x4152e8){var _0x2bfbdf={},_0x460e10={},_0x219e0f={'count':0x0,'rows':[]};var _0x270adc=_[_0x0eef('0x29')](db[_0x0eef('0x2a')][_0x0eef('0x2b')],function(_0x11c5da){return{'name':_0x11c5da[_0x0eef('0x2c')],'type':_0x11c5da['type'][_0x0eef('0x2d')]};});_0x460e10['model']=_['map'](_0x270adc,_0x0eef('0x27'));_0x460e10[_0x0eef('0x2e')]=_[_0x0eef('0x2f')](_0x49552b[_0x0eef('0x2e')]);_0x460e10['filters']=_['intersection'](_0x460e10['model'],_0x460e10['query']);_0x2bfbdf['attributes']=_[_0x0eef('0x30')](_0x460e10[_0x0eef('0x31')],qs[_0x0eef('0x32')](_0x49552b[_0x0eef('0x2e')][_0x0eef('0x32')]));_0x2bfbdf[_0x0eef('0x33')]=_0x2bfbdf[_0x0eef('0x33')][_0x0eef('0x34')]?_0x2bfbdf[_0x0eef('0x33')]:_0x460e10[_0x0eef('0x31')];if(!_0x49552b[_0x0eef('0x2e')]['hasOwnProperty']('nolimit')){_0x2bfbdf['limit']=qs[_0x0eef('0x1f')](_0x49552b['query'][_0x0eef('0x1f')]);_0x2bfbdf['offset']=qs[_0x0eef('0x1c')](_0x49552b[_0x0eef('0x2e')][_0x0eef('0x1c')]);}_0x2bfbdf['order']=qs[_0x0eef('0x35')](_0x49552b[_0x0eef('0x2e')][_0x0eef('0x35')]);_0x2bfbdf[_0x0eef('0x36')]=qs[_0x0eef('0x37')](_[_0x0eef('0x38')](_0x49552b['query'],_0x460e10[_0x0eef('0x37')]),_0x270adc);if(_0x49552b[_0x0eef('0x2e')][_0x0eef('0x39')]){_0x2bfbdf['where']=_[_0x0eef('0x3a')](_0x2bfbdf[_0x0eef('0x36')],{'$or':_[_0x0eef('0x29')](_0x270adc,function(_0x4e7ba5){if(_0x4e7ba5['type']!==_0x0eef('0x3b')){var _0x5962e0={};_0x5962e0[_0x4e7ba5[_0x0eef('0x27')]]={'$like':'%'+_0x49552b[_0x0eef('0x2e')][_0x0eef('0x39')]+'%'};return _0x5962e0;}})});}_0x2bfbdf=_[_0x0eef('0x3a')]({},_0x2bfbdf,_0x49552b[_0x0eef('0x3c')]);var _0x491ee7={'where':_0x2bfbdf['where']};return db[_0x0eef('0x2a')][_0x0eef('0x1e')](_0x491ee7)[_0x0eef('0x23')](function(_0x122bb0){_0x219e0f[_0x0eef('0x1e')]=_0x122bb0;if(_0x49552b[_0x0eef('0x2e')][_0x0eef('0x3d')]){_0x2bfbdf[_0x0eef('0x3e')]=[{'all':!![]}];}return db[_0x0eef('0x2a')]['findAll'](_0x2bfbdf);})[_0x0eef('0x23')](function(_0x3de309){_0x219e0f[_0x0eef('0x3f')]=_0x3de309;return _0x219e0f;})[_0x0eef('0x23')](respondWithFilteredResult(_0x4152e8,_0x2bfbdf))[_0x0eef('0x40')](handleError(_0x4152e8,null));};exports[_0x0eef('0x41')]=function(_0x42d5a4,_0x2ad2fc){var _0x57fcf5={'raw':!![],'where':{'id':_0x42d5a4[_0x0eef('0x42')]['id']}},_0x4fbaf0={};_0x4fbaf0['model']=_[_0x0eef('0x2f')](db[_0x0eef('0x2a')][_0x0eef('0x2b')]);_0x4fbaf0[_0x0eef('0x2e')]=_[_0x0eef('0x2f')](_0x42d5a4['query']);_0x4fbaf0[_0x0eef('0x37')]=_[_0x0eef('0x30')](_0x4fbaf0[_0x0eef('0x31')],_0x4fbaf0[_0x0eef('0x2e')]);_0x57fcf5[_0x0eef('0x33')]=_[_0x0eef('0x30')](_0x4fbaf0['model'],qs[_0x0eef('0x32')](_0x42d5a4[_0x0eef('0x2e')][_0x0eef('0x32')]));_0x57fcf5[_0x0eef('0x33')]=_0x57fcf5[_0x0eef('0x33')][_0x0eef('0x34')]?_0x57fcf5[_0x0eef('0x33')]:_0x4fbaf0['model'];if(_0x42d5a4[_0x0eef('0x2e')][_0x0eef('0x3d')]){_0x57fcf5[_0x0eef('0x3e')]=[{'all':!![]}];}_0x57fcf5=_[_0x0eef('0x3a')]({},_0x57fcf5,_0x42d5a4[_0x0eef('0x3c')]);return db[_0x0eef('0x2a')][_0x0eef('0x43')](_0x57fcf5)[_0x0eef('0x23')](handleEntityNotFound(_0x2ad2fc,null))[_0x0eef('0x23')](respondWithResult(_0x2ad2fc,null))[_0x0eef('0x40')](handleError(_0x2ad2fc,null));};exports[_0x0eef('0x44')]=function(_0x33a372,_0x28ec88){return db[_0x0eef('0x2a')]['create'](_0x33a372[_0x0eef('0x45')],{})[_0x0eef('0x23')](respondWithResult(_0x28ec88,0xc9))[_0x0eef('0x40')](handleError(_0x28ec88,null));};exports[_0x0eef('0x22')]=function(_0xb0a73,_0x166c27){if(_0xb0a73['body']['id']){delete _0xb0a73[_0x0eef('0x45')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0xb0a73[_0x0eef('0x42')]['id']}})[_0x0eef('0x23')](handleEntityNotFound(_0x166c27,null))['then'](saveUpdates(_0xb0a73[_0x0eef('0x45')],null))['then'](respondWithResult(_0x166c27,null))[_0x0eef('0x40')](handleError(_0x166c27,null));};exports[_0x0eef('0x46')]=function(_0x4842f3,_0x2c1c21){return db['OpenchannelMessage']['find']({'where':{'id':_0x4842f3[_0x0eef('0x42')]['id']}})[_0x0eef('0x23')](handleEntityNotFound(_0x2c1c21,null))[_0x0eef('0x23')](removeEntity(_0x2c1c21,null))['catch'](handleError(_0x2c1c21,null));};exports[_0x0eef('0x47')]=function(_0x36825a,_0x14ef25){return db['OpenchannelMessage'][_0x0eef('0x47')]()[_0x0eef('0x23')](respondWithResult(_0x14ef25,null))[_0x0eef('0x40')](handleError(_0x14ef25,null));};exports[_0x0eef('0x48')]=function(_0x307266,_0x53877a){var _0xbbdcdd=_0x0eef('0x49');return interactionService[_0x0eef('0x4a')](_0x307266,_0xbbdcdd)[_0x0eef('0x23')](respondWithResult(_0x53877a,null))[_0x0eef('0x40')](handleError(_0x53877a,null));};exports[_0x0eef('0x4b')]=function(_0x40aad5,_0x26f8d5){var _0x5461de={'agent':{},'channel':_0x0eef('0x49')};if(_0x40aad5['body']['id']){delete _0x40aad5['body']['id'];}_0x40aad5['body'][_0x0eef('0x4c')]=_0x40aad5[_0x0eef('0x45')][_0x0eef('0x4c')]||_0x40aad5[_0x0eef('0x4d')]['id'];_0x5461de['agent']['id']=_0x40aad5[_0x0eef('0x45')]['UserId'];return db['OpenchannelMessage'][_0x0eef('0x43')]({'where':{'id':_0x40aad5[_0x0eef('0x42')]['id'],'UserId':null}})[_0x0eef('0x23')](handleEntityNotFound(_0x26f8d5,null))[_0x0eef('0x23')](function(_0x474461){if(_0x474461){_0x5461de[_0x0eef('0x18')]=_0x474461['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x0eef('0x43')]({'where':{'id':_0x474461[_0x0eef('0x4e')]}});}return null;})[_0x0eef('0x23')](handleEntityNotFound(_0x26f8d5,null))[_0x0eef('0x23')](function(_0x503dd5){if(_0x503dd5){_0x5461de['interaction']=_0x503dd5[_0x0eef('0x4f')]({'plain':!![]});interaction_log['info'](_0x0eef('0x50'),_0x40aad5[_0x0eef('0x4d')]['id'],_0x40aad5[_0x0eef('0x4d')][_0x0eef('0x27')],_0x40aad5[_0x0eef('0x4d')][_0x0eef('0x51')],_0x5461de[_0x0eef('0x52')]['id'],_0x40aad5['body']?JSON[_0x0eef('0x15')](_0x40aad5[_0x0eef('0x45')]):'null');return respondWithRpcPromise(_0x0eef('0x53'),_0x0eef('0x54'),_0x5461de);}return null;})[_0x0eef('0x23')](function(_0x307c3f){var _0x1d1d27=_0x0eef('0x55')+_0x307c3f[_0x0eef('0x18')][_0x0eef('0x56')];return db['sequelize'][_0x0eef('0x2e')](_0x1d1d27,{'type':db[_0x0eef('0x57')][_0x0eef('0x58')]['SELECT'],'raw':!![]})[_0x0eef('0x23')](function(_0xaed919){return _0xaed919;});})[_0x0eef('0x23')](function(_0x14e4cf){if(_0x14e4cf){_0x5461de[_0x0eef('0x18')][_0x0eef('0x59')]=_0x14e4cf[0x0];if(!_0x40aad5[_0x0eef('0x45')][_0x0eef('0x4c')])return;return db[_0x0eef('0x5a')][_0x0eef('0x43')]({'where':{'id':_0x40aad5['body'][_0x0eef('0x4c')],'role':'agent'},'attributes':['id',_0x0eef('0x27'),_0x0eef('0x5b'),_0x0eef('0x5c'),_0x0eef('0x5d')],'raw':!![]});}return null;})['then'](function(_0x20cac8){if(!_0x20cac8)return null;_0x5461de[_0x0eef('0x18')][_0x0eef('0x5e')]=_0x20cac8;return _0x5461de;})[_0x0eef('0x23')](function(_0x31fc8a){if(_0x31fc8a){_0x31fc8a['message'][_0x0eef('0x5f')]=util[_0x0eef('0x60')](_0x0eef('0x61'),_0x40aad5['user']['name']);_0x31fc8a['message'][_0x0eef('0x62')]=_0x5461de[_0x0eef('0x62')];_0x31fc8a[_0x0eef('0x18')][_0x0eef('0x63')]=_0x5461de['channel'];_0x31fc8a[_0x0eef('0x18')][_0x0eef('0x64')]=_0x0eef('0x4b');respondWithRpcPromise('EventManager',_0x0eef('0x65'),{'event':_0x0eef('0x66'),'message':_0x31fc8a[_0x0eef('0x18')]},client9002);return _0x5461de;}return null;})[_0x0eef('0x23')](respondWithResult(_0x26f8d5,null))[_0x0eef('0x40')](handleError(_0x26f8d5,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index d306add..06abc52 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 _0x1f38=['hook','exports','../../mysqldb','OpenchannelMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0x1f38,0x158));var _0x81f3=function(_0x4bb94b,_0x50628a){_0x4bb94b=_0x4bb94b-0x0;var _0x36dcc6=_0x1f38[_0x4bb94b];return _0x36dcc6;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x81f3('0x0'))['db'][_0x81f3('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x81f3('0x2'),'afterUpdate':_0x81f3('0x3'),'afterDestroy':_0x81f3('0x4')};function emitEvent(_0x581cb7){return function(_0x405e7e,_0x2a394f,_0x350476){OpenchannelMessageEvents[_0x81f3('0x5')](_0x581cb7+':'+_0x405e7e['id'],_0x405e7e);OpenchannelMessageEvents['emit'](_0x581cb7,_0x405e7e);_0x350476(null);};}for(var e in events){if(events[_0x81f3('0x6')](e)){var event=events[e];OpenchannelMessage[_0x81f3('0x7')](e,emitEvent(event));}}module[_0x81f3('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x7790=['events','../../mysqldb','OpenchannelMessage','save','update','emit','exports'];(function(_0x26371f,_0x3529d6){var _0x7bf77f=function(_0xaaf7ec){while(--_0xaaf7ec){_0x26371f['push'](_0x26371f['shift']());}};_0x7bf77f(++_0x3529d6);}(_0x7790,0x10a));var _0x0779=function(_0x151d3a,_0x485697){_0x151d3a=_0x151d3a-0x0;var _0x3b5c29=_0x7790[_0x151d3a];return _0x3b5c29;};'use strict';var EventEmitter=require(_0x0779('0x0'));var OpenchannelMessage=require(_0x0779('0x1'))['db'][_0x0779('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0779('0x3'),'afterUpdate':_0x0779('0x4'),'afterDestroy':'remove'};function emitEvent(_0x39266a){return function(_0x56ce83,_0x43485f,_0x194023){OpenchannelMessageEvents[_0x0779('0x5')](_0x39266a+':'+_0x56ce83['id'],_0x56ce83);OpenchannelMessageEvents[_0x0779('0x5')](_0x39266a,_0x56ce83);_0x194023(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x0779('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 7d7f715..9257cdd 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 _0x66ab=['toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','Interaction','omit','Contact','POST','format','threadId','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','get','direction'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x66ab,0x153));var _0xb66a=function(_0x4bd09f,_0x17df6b){_0x4bd09f=_0x4bd09f-0x0;var _0x131757=_0x66ab[_0x4bd09f];return _0x131757;};'use strict';var _=require(_0xb66a('0x0'));var util=require(_0xb66a('0x1'));var logger=require(_0xb66a('0x2'))(_0xb66a('0x3'));var moment=require(_0xb66a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb66a('0x5'));var fs=require('fs');var path=require(_0xb66a('0x6'));var rimraf=require(_0xb66a('0x7'));var config=require(_0xb66a('0x8'));var attributes=require(_0xb66a('0x9'));module[_0xb66a('0xa')]=function(_0x2a8e24,_0x31a24){return _0x2a8e24[_0xb66a('0xb')](_0xb66a('0xc'),attributes,{'tableName':_0xb66a('0xd'),'paranoid':![],'indexes':[{'name':_0xb66a('0xe'),'fields':[_0xb66a('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25af50,_0x2da5a8,_0x394be7){var _0x45b9ba=_0x2a8e24['models'];var _0x43b8ad=_0x25af50[_0xb66a('0x10')]({'plain':!![]});if(_0x43b8ad[_0xb66a('0x11')][_0xb66a('0x12')]()==='in'||_0x43b8ad[_0xb66a('0x11')][_0xb66a('0x12')]()===_0xb66a('0x13')&&!_0x43b8ad[_0xb66a('0x14')]&&!_[_0xb66a('0x15')](_0x43b8ad[_0xb66a('0x16')])){_0x45b9ba[_0xb66a('0x17')][_0xb66a('0x18')]({'where':{'id':_0x43b8ad[_0xb66a('0x19')]}})[_0xb66a('0x1a')](function(_0x4edb86){if(_0x4edb86){_0x4edb86[_0xb66a('0x1b')]({'lastMsgAt':_0x43b8ad['createdAt'],'lastMsgDirection':_0x43b8ad[_0xb66a('0x11')][_0xb66a('0x12')]()});}})[_0xb66a('0x1c')](function(_0x10790b){console[_0xb66a('0x1d')](_0x10790b);});}if(_0x43b8ad['direction']===_0xb66a('0x13')&&!_0x43b8ad[_0xb66a('0x14')]){var _0x188b75;_0x45b9ba['CmContact'][_0xb66a('0x1e')]()[_0xb66a('0x1a')](function(_0x195d9c){return _0x45b9ba[_0xb66a('0x1f')][_0xb66a('0x20')]({'where':{'id':_0x43b8ad[_0xb66a('0x21')]},'include':[{'model':_0x45b9ba[_0xb66a('0x17')],'as':_0xb66a('0x22'),'where':{'id':_0x43b8ad[_0xb66a('0x19')]},'limit':0x1,'include':[{'model':_0x45b9ba[_0xb66a('0x23')],'as':'Contact','attributes':_[_0xb66a('0x24')](_0x195d9c)}]}]});})[_0xb66a('0x1a')](function(_0x15e1a6){_0x188b75=_0x15e1a6[_0xb66a('0x10')]({'plain':!![]});if(_0x188b75&&_0x188b75[_0xb66a('0x25')]){logger[_0xb66a('0x26')](_0xb66a('0x27'),_0xb66a('0x28'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x43b8ad['id'],_0x188b75[_0xb66a('0x25')]));if(_0x188b75[_0xb66a('0x22')]&&_0x188b75['Interactions'][_0xb66a('0x29')]){_0x43b8ad[_0xb66a('0x2a')]=_[_0xb66a('0x2b')](_0x188b75[_0xb66a('0x22')][0x0],_0xb66a('0x2c'));_0x43b8ad['Contact']=_0x188b75[_0xb66a('0x22')][0x0]['Contact'];}var _0x2da5a8={'method':'POST','uri':encodeURI(_0x188b75[_0xb66a('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2da5a8['method']){case'GET':_0x2da5a8['qs']=_0x43b8ad;break;case _0xb66a('0x2d'):_0x2da5a8[_0xb66a('0xf')]=_0x43b8ad;break;}return rp(_0x2da5a8)[_0xb66a('0x1a')](function(_0x43ecf0){logger['info'](_0xb66a('0x27'),_0xb66a('0x28'),util[_0xb66a('0x2e')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x43b8ad['id'],_0x188b75['replyUri']));if(_0x43ecf0[_0xb66a('0xf')][_0xb66a('0x2f')]&&_0x43ecf0['body']['threadId']!=_0x43b8ad[_0xb66a('0x2a')][_0xb66a('0x2f')]){return _0x45b9ba[_0xb66a('0x17')]['update']({'threadId':_0x43ecf0[_0xb66a('0xf')]['threadId']},{'where':{'id':_0x43b8ad['Interaction']['id']}});}else{return;}})[_0xb66a('0x1a')](function(){return _0x25af50[_0xb66a('0x1b')]({'read':!![]});})['catch'](function(_0x5f3008){logger['error'](_0xb66a('0x27'),_0xb66a('0x28'),util[_0xb66a('0x30')](_0x5f3008,{'showHidden':![],'depth':null}));_0x394be7();});}else{_0x394be7();}})[_0xb66a('0x31')](function(){_0x394be7();});}else{_0x394be7();}}},'charset':_0xb66a('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9548=['OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','POST','method','GET','body','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','lodash','util','api','moment','bluebird','request-promise','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9548,0xb3));var _0x8954=function(_0x1d675d,_0xe64d4e){_0x1d675d=_0x1d675d-0x0;var _0x134ec8=_0x9548[_0x1d675d];return _0x134ec8;};'use strict';var _=require(_0x8954('0x0'));var util=require(_0x8954('0x1'));var logger=require('../../config/logger')(_0x8954('0x2'));var moment=require(_0x8954('0x3'));var BPromise=require(_0x8954('0x4'));var rp=require(_0x8954('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8954('0x6'));var config=require('../../config/environment');var attributes=require(_0x8954('0x7'));module[_0x8954('0x8')]=function(_0x4e7872,_0x4dde0d){return _0x4e7872[_0x8954('0x9')](_0x8954('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x8954('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57abc7,_0x47ce81,_0x4dbe97){var _0x3cd5da=_0x4e7872[_0x8954('0xc')];var _0x2799b2=_0x57abc7[_0x8954('0xd')]({'plain':!![]});if(_0x2799b2[_0x8954('0xe')]['toLowerCase']()==='in'||_0x2799b2[_0x8954('0xe')][_0x8954('0xf')]()===_0x8954('0x10')&&!_0x2799b2[_0x8954('0x11')]&&!_['isNil'](_0x2799b2[_0x8954('0x12')])){_0x3cd5da[_0x8954('0x13')][_0x8954('0x14')]({'where':{'id':_0x2799b2[_0x8954('0x15')]}})[_0x8954('0x16')](function(_0x24a709){if(_0x24a709){_0x24a709['update']({'lastMsgAt':_0x2799b2[_0x8954('0x17')],'lastMsgDirection':_0x2799b2[_0x8954('0xe')][_0x8954('0xf')]()});}})[_0x8954('0x18')](function(_0x125f60){console[_0x8954('0x19')](_0x125f60);});}if(_0x2799b2[_0x8954('0xe')]===_0x8954('0x10')&&!_0x2799b2[_0x8954('0x11')]){var _0x142d56;_0x3cd5da[_0x8954('0x1a')][_0x8954('0x1b')]()[_0x8954('0x16')](function(_0x1a4795){return _0x3cd5da[_0x8954('0x1c')][_0x8954('0x1d')]({'where':{'id':_0x2799b2[_0x8954('0x1e')]},'include':[{'model':_0x3cd5da[_0x8954('0x13')],'as':_0x8954('0x1f'),'where':{'id':_0x2799b2[_0x8954('0x15')]},'limit':0x1,'include':[{'model':_0x3cd5da[_0x8954('0x1a')],'as':_0x8954('0x20'),'attributes':_['keys'](_0x1a4795)}]}]});})['then'](function(_0xcdde40){_0x142d56=_0xcdde40[_0x8954('0xd')]({'plain':!![]});if(_0x142d56&&_0x142d56['replyUri']){logger['info'](_0x8954('0x21'),'afterCreate',util[_0x8954('0x22')](_0x8954('0x23'),_0x2799b2['id'],_0x142d56[_0x8954('0x24')]));if(_0x142d56[_0x8954('0x1f')]&&_0x142d56[_0x8954('0x1f')][_0x8954('0x25')]){_0x2799b2[_0x8954('0x26')]=_['omit'](_0x142d56['Interactions'][0x0],_0x8954('0x20'));_0x2799b2[_0x8954('0x20')]=_0x142d56[_0x8954('0x1f')][0x0]['Contact'];}var _0x47ce81={'method':_0x8954('0x27'),'uri':encodeURI(_0x142d56[_0x8954('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x47ce81[_0x8954('0x28')]){case _0x8954('0x29'):_0x47ce81['qs']=_0x2799b2;break;case _0x8954('0x27'):_0x47ce81[_0x8954('0x2a')]=_0x2799b2;break;}return rp(_0x47ce81)[_0x8954('0x16')](function(_0x3a3518){logger[_0x8954('0x2b')](_0x8954('0x21'),_0x8954('0x2c'),util[_0x8954('0x22')](_0x8954('0x2d'),_0x2799b2['id'],_0x142d56['replyUri']));if(_0x3a3518['body'][_0x8954('0x2e')]&&_0x3a3518[_0x8954('0x2a')][_0x8954('0x2e')]!=_0x2799b2[_0x8954('0x26')]['threadId']){return _0x3cd5da[_0x8954('0x13')]['update']({'threadId':_0x3a3518[_0x8954('0x2a')][_0x8954('0x2e')]},{'where':{'id':_0x2799b2['Interaction']['id']}});}else{return;}})[_0x8954('0x16')](function(){return _0x57abc7[_0x8954('0x2f')]({'read':!![]});})[_0x8954('0x18')](function(_0x1a8c12){logger[_0x8954('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x8954('0x2c'),util[_0x8954('0x30')](_0x1a8c12,{'showHidden':![],'depth':null}));_0x4dbe97();});}else{_0x4dbe97();}})[_0x8954('0x31')](function(){_0x4dbe97();});}else{_0x4dbe97();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index cc1bff6..37c838c 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x230366,_0x23cc5d){var _0x3f8f11=function(_0x331238){while(--_0x331238){_0x230366['push'](_0x230366['shift']());}};_0x3f8f11(++_0x23cc5d);}(_0xadb5,0xad));var _0x5adb=function(_0x3ad444,_0xde57f){_0x3ad444=_0x3ad444-0x0;var _0x1aa435=_0xadb5[_0x3ad444];return _0x1aa435;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x58503e,_0x4cc2a5){var _0x52c1db=function(_0x2ba642){while(--_0x2ba642){_0x58503e['push'](_0x58503e['shift']());}};_0x52c1db(++_0x4cc2a5);}(_0x7a54,0x106));var _0x47a5=function(_0x295e76,_0x38ac2a){_0x295e76=_0x295e76-0x0;var _0x218b14=_0x7a54[_0x295e76];return _0x218b14;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 652c69e..1a1c2c0 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 _0x3bd7=['update','emit','removeListener','length','remove'];(function(_0x461d3b,_0x572c17){var _0x1c847d=function(_0x5a459c){while(--_0x5a459c){_0x461d3b['push'](_0x461d3b['shift']());}};_0x1c847d(++_0x572c17);}(_0x3bd7,0x199));var _0x73bd=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x3bd7[_0x2aea9e];return _0x430b92;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x73bd('0x0'),_0x73bd('0x1')];function createListener(_0x22da7f,_0x4f66a5){return function(_0x4242ff){_0x4f66a5[_0x73bd('0x2')](_0x22da7f,_0x4242ff);};}function removeListener(_0x1b4214,_0x56fbc2){return function(){OpenchannelMessageEvents[_0x73bd('0x3')](_0x1b4214,_0x56fbc2);};}exports['register']=function(_0xe20fe9){for(var _0x1aa5e1=0x0,_0x4bca41=events[_0x73bd('0x4')];_0x1aa5e1<_0x4bca41;_0x1aa5e1++){var _0x4c1254=events[_0x1aa5e1];var _0x569bef=createListener('openchannelMessage:'+_0x4c1254,_0xe20fe9);OpenchannelMessageEvents['on'](_0x4c1254,_0x569bef);}}; \ No newline at end of file +var _0xc7b9=['./openchannelMessage.events','save','remove','emit','register','length','openchannelMessage:'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc7b9,0xa8));var _0x9c7b=function(_0x106edd,_0x4ea707){_0x106edd=_0x106edd-0x0;var _0xf8f818=_0xc7b9[_0x106edd];return _0xf8f818;};'use strict';var OpenchannelMessageEvents=require(_0x9c7b('0x0'));var events=[_0x9c7b('0x1'),_0x9c7b('0x2'),'update'];function createListener(_0x58cfe6,_0x1be38d){return function(_0x109776){_0x1be38d[_0x9c7b('0x3')](_0x58cfe6,_0x109776);};}function removeListener(_0x562eff,_0x2f9195){return function(){OpenchannelMessageEvents['removeListener'](_0x562eff,_0x2f9195);};}exports[_0x9c7b('0x4')]=function(_0x2ca7d5){for(var _0x111c60=0x0,_0x4671ad=events[_0x9c7b('0x5')];_0x111c60<_0x4671ad;_0x111c60++){var _0x5412f7=events[_0x111c60];var _0x8f975b=createListener(_0x9c7b('0x6')+_0x5412f7,_0x2ca7d5);OpenchannelMessageEvents['on'](_0x5412f7,_0x8f975b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 4c48ae2..985df85 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 _0x0de7=['/:id','/:id/teams','getTeams','/:id/users','post','create','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x0de7,0xba));var _0x70de=function(_0x4250cc,_0x4ed99e){_0x4250cc=_0x4250cc-0x0;var _0x3e26aa=_0x0de7[_0x4250cc];return _0x3e26aa;};'use strict';var multer=require(_0x70de('0x0'));var util=require(_0x70de('0x1'));var path=require('path');var timeout=require(_0x70de('0x2'));var express=require(_0x70de('0x3'));var router=express[_0x70de('0x4')]();var fs_extra=require(_0x70de('0x5'));var auth=require(_0x70de('0x6'));var interaction=require(_0x70de('0x7'));var config=require('../../config/environment');var controller=require(_0x70de('0x8'));router['get']('/',auth[_0x70de('0x9')](),controller[_0x70de('0xa')]);router[_0x70de('0xb')](_0x70de('0xc'),auth[_0x70de('0x9')](),controller[_0x70de('0xd')]);router[_0x70de('0xb')](_0x70de('0xe'),auth[_0x70de('0x9')](),controller['show']);router[_0x70de('0xb')]('/:id/members',auth[_0x70de('0x9')](),controller['getMembers']);router[_0x70de('0xb')](_0x70de('0xf'),auth[_0x70de('0x9')](),controller[_0x70de('0x10')]);router[_0x70de('0xb')](_0x70de('0x11'),auth[_0x70de('0x9')](),controller['getAgents']);router[_0x70de('0x12')]('/',auth[_0x70de('0x9')](),controller[_0x70de('0x13')]);router[_0x70de('0x12')](_0x70de('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x70de('0x12')](_0x70de('0x11'),auth[_0x70de('0x9')](),controller['addAgents']);router['put'](_0x70de('0xe'),auth[_0x70de('0x9')](),controller['update']);router[_0x70de('0x14')]('/:id',auth[_0x70de('0x9')](),controller[_0x70de('0x15')]);router['delete'](_0x70de('0xf'),auth[_0x70de('0x9')](),controller[_0x70de('0x16')]);router[_0x70de('0x14')](_0x70de('0x11'),auth[_0x70de('0x9')](),controller[_0x70de('0x17')]);module[_0x70de('0x18')]=router; \ No newline at end of file +var _0x241b=['../../config/environment','./openchannelQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4a618b,_0x11d42e){var _0x1a006d=function(_0x18c914){while(--_0x18c914){_0x4a618b['push'](_0x4a618b['shift']());}};_0x1a006d(++_0x11d42e);}(_0x241b,0xac));var _0xb241=function(_0x4239fb,_0x393962){_0x4239fb=_0x4239fb-0x0;var _0x259e7a=_0x241b[_0x4239fb];return _0x259e7a;};'use strict';var multer=require(_0xb241('0x0'));var util=require(_0xb241('0x1'));var path=require(_0xb241('0x2'));var timeout=require(_0xb241('0x3'));var express=require(_0xb241('0x4'));var router=express[_0xb241('0x5')]();var fs_extra=require(_0xb241('0x6'));var auth=require(_0xb241('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb241('0x8'));var controller=require(_0xb241('0x9'));router[_0xb241('0xa')]('/',auth[_0xb241('0xb')](),controller['index']);router[_0xb241('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xb241('0xc')]);router[_0xb241('0xa')](_0xb241('0xd'),auth[_0xb241('0xb')](),controller[_0xb241('0xe')]);router[_0xb241('0xa')](_0xb241('0xf'),auth['isAuthenticated'](),controller[_0xb241('0x10')]);router[_0xb241('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb241('0x11')]);router['get'](_0xb241('0x12'),auth[_0xb241('0xb')](),controller[_0xb241('0x13')]);router[_0xb241('0x14')]('/',auth[_0xb241('0xb')](),controller[_0xb241('0x15')]);router[_0xb241('0x14')](_0xb241('0x16'),auth[_0xb241('0xb')](),controller[_0xb241('0x17')]);router[_0xb241('0x14')](_0xb241('0x12'),auth[_0xb241('0xb')](),controller[_0xb241('0x18')]);router['put'](_0xb241('0xd'),auth[_0xb241('0xb')](),controller[_0xb241('0x19')]);router[_0xb241('0x1a')](_0xb241('0xd'),auth['isAuthenticated'](),controller[_0xb241('0x1b')]);router[_0xb241('0x1a')](_0xb241('0x16'),auth[_0xb241('0xb')](),controller[_0xb241('0x1c')]);router['delete'](_0xb241('0x12'),auth[_0xb241('0xb')](),controller[_0xb241('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index b425dfb..70ae78b 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 _0xe83f=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe83f,0x13a));var _0xfe83=function(_0x60ff7e,_0x1823d5){_0x60ff7e=_0x60ff7e-0x0;var _0x27c040=_0xe83f[_0x60ff7e];return _0x27c040;};'use strict';var Sequelize=require('sequelize');module[_0xfe83('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfe83('0x1')]},'timeout':{'type':Sequelize[_0xfe83('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfe83('0x3')](_0xfe83('0x4'),_0xfe83('0x5'),_0xfe83('0x6'))}}; \ No newline at end of file +var _0x7f95=['sequelize','STRING','name','INTEGER','beepall'];(function(_0x18156f,_0x3fe186){var _0x478ffe=function(_0x4cd7f2){while(--_0x4cd7f2){_0x18156f['push'](_0x18156f['shift']());}};_0x478ffe(++_0x3fe186);}(_0x7f95,0xe6));var _0x57f9=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x7f95[_0x5dfc2a];return _0x3f1a71;};'use strict';var Sequelize=require(_0x57f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x57f9('0x1')],'unique':_0x57f9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x57f9('0x1')]},'timeout':{'type':Sequelize[_0x57f9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x57f9('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index eb78d50..37bfcce 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 _0xaf9a=['findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','nolimit','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','emit','userOpenchannelQueue:save','Team','ids','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','union','compact','isEmpty','removeAgents','addAgents','omit','isArray','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','sendStatus','error','name','send','index','map','OpenchannelQueue','fieldName','type','key','where','include','findAll','rows','catch','show','params','model','keys','rawAttributes','query','attributes','intersection','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','filters','hasOwnProperty','order','sort','pick','OpenchannelQueueId','filter','options','UserOpenchannelQueue','User'];(function(_0x10dc85,_0x22bb2d){var _0x2adb59=function(_0x4b56a1){while(--_0x4b56a1){_0x10dc85['push'](_0x10dc85['shift']());}};_0x2adb59(++_0x22bb2d);}(_0xaf9a,0xa5));var _0xaaf9=function(_0x452361,_0x1e6ae2){_0x452361=_0x452361-0x0;var _0x125cbd=_0xaf9a[_0x452361];return _0x125cbd;};'use strict';var BPromise=require(_0xaaf9('0x0'));var util=require(_0xaaf9('0x1'));var _=require(_0xaaf9('0x2'));var squel=require(_0xaaf9('0x3'));var Redis=require('ioredis');var qs=require(_0xaaf9('0x4'));var logger=require('../../config/logger')(_0xaaf9('0x5'));var config=require('../../config/environment');var db=require(_0xaaf9('0x6'))['db'];config[_0xaaf9('0x7')]=_[_0xaaf9('0x8')](config[_0xaaf9('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xaaf9('0x9'))(new Redis(config[_0xaaf9('0x7')]));require(_0xaaf9('0xa'))[_0xaaf9('0xb')](socket);function respondWithStatusCode(_0x215bab,_0x4e424e){_0x4e424e=_0x4e424e||0xcc;return function(_0x1399ae){if(_0x1399ae){return _0x215bab['sendStatus'](_0x4e424e);}return _0x215bab[_0xaaf9('0xc')](_0x4e424e)['end']();};}function respondWithResult(_0x2051c8,_0x20bb43){_0x20bb43=_0x20bb43||0xc8;return function(_0x1ff010){if(_0x1ff010){return _0x2051c8['status'](_0x20bb43)[_0xaaf9('0xd')](_0x1ff010);}};}function respondWithFilteredResult(_0x3ed624,_0xee3144){return function(_0x47c8ed){if(_0x47c8ed){var _0x1611e6=typeof _0xee3144['offset']===_0xaaf9('0xe')&&typeof _0xee3144[_0xaaf9('0xf')]==='undefined';var _0x37ea99=_0x47c8ed[_0xaaf9('0x10')];var _0x43ff13=_0x1611e6?0x0:_0xee3144['offset'];var _0xaaf80a=_0x1611e6?_0x47c8ed[_0xaaf9('0x10')]:_0xee3144[_0xaaf9('0x11')]+_0xee3144[_0xaaf9('0xf')];var _0x55e8ca;if(_0xaaf80a>=_0x37ea99){_0xaaf80a=_0x37ea99;_0x55e8ca=0xc8;}else{_0x55e8ca=0xce;}_0x3ed624[_0xaaf9('0xc')](_0x55e8ca);return _0x3ed624['set'](_0xaaf9('0x12'),_0x43ff13+'-'+_0xaaf80a+'/'+_0x37ea99)[_0xaaf9('0xd')](_0x47c8ed);}return null;};}function saveUpdates(_0x10ebc0){return function(_0xa8551){if(_0xa8551){return _0xa8551[_0xaaf9('0x13')](_0x10ebc0)[_0xaaf9('0x14')](function(_0x255182){return _0x255182;});}return null;};}function removeEntity(_0x3a5ee0){return function(_0x2a9cf6){if(_0x2a9cf6){return _0x2a9cf6[_0xaaf9('0x15')]()[_0xaaf9('0x14')](function(){var _0x254571=_0x2a9cf6[_0xaaf9('0x16')]({'plain':!![]});var _0x53d367=_0xaaf9('0x17');return db[_0xaaf9('0x18')]['destroy']({'where':{'type':_0x53d367,'resourceId':_0x254571['id']}})[_0xaaf9('0x14')](function(){return _0x2a9cf6;});})['then'](function(){_0x3a5ee0[_0xaaf9('0xc')](0xcc)[_0xaaf9('0x19')]();});}};}function handleEntityNotFound(_0x242cab){return function(_0x2a82f8){if(!_0x2a82f8){_0x242cab[_0xaaf9('0x1a')](0x194);}return _0x2a82f8;};}function handleError(_0x43c7f1,_0x2f1cd2){_0x2f1cd2=_0x2f1cd2||0x1f4;return function(_0x24186a){logger[_0xaaf9('0x1b')](_0x24186a['stack']);if(_0x24186a['name']){delete _0x24186a[_0xaaf9('0x1c')];}_0x43c7f1['status'](_0x2f1cd2)[_0xaaf9('0x1d')](_0x24186a);};}exports[_0xaaf9('0x1e')]=function(_0x266f75,_0x57c4fa){var _0x44467b={};var _0x923636={'count':0x0,'rows':[]};var _0x287ac7=_[_0xaaf9('0x1f')](db[_0xaaf9('0x20')]['rawAttributes'],function(_0x5bdad2){return{'name':_0x5bdad2[_0xaaf9('0x21')],'type':_0x5bdad2[_0xaaf9('0x22')][_0xaaf9('0x23')]};});_0x44467b=qs['getOptions'](_0x287ac7,_0x266f75);var _0xd38ef3={'where':_0x44467b[_0xaaf9('0x24')]};return db[_0xaaf9('0x20')][_0xaaf9('0x10')](_0xd38ef3)[_0xaaf9('0x14')](function(_0x1e4073){_0x923636['count']=_0x1e4073;_0x44467b[_0xaaf9('0x25')]=qs[_0xaaf9('0x25')](_0x266f75['query']);return db[_0xaaf9('0x20')][_0xaaf9('0x26')](_0x44467b);})[_0xaaf9('0x14')](function(_0x153cd8){_0x923636[_0xaaf9('0x27')]=_0x153cd8;return _0x923636;})['then'](respondWithFilteredResult(_0x57c4fa,_0x44467b))[_0xaaf9('0x28')](handleError(_0x57c4fa,null));};exports[_0xaaf9('0x29')]=function(_0x4123ed,_0x176e6c){var _0x27769b={'raw':!![],'where':{'id':_0x4123ed[_0xaaf9('0x2a')]['id']}},_0x1e038d={};_0x1e038d[_0xaaf9('0x2b')]=_[_0xaaf9('0x2c')](db[_0xaaf9('0x20')][_0xaaf9('0x2d')]);_0x1e038d[_0xaaf9('0x2e')]=_['keys'](_0x4123ed[_0xaaf9('0x2e')]);_0x1e038d['filters']=_['intersection'](_0x1e038d[_0xaaf9('0x2b')],_0x1e038d['query']);_0x27769b[_0xaaf9('0x2f')]=_[_0xaaf9('0x30')](_0x1e038d['model'],qs['fields'](_0x4123ed[_0xaaf9('0x2e')][_0xaaf9('0x31')]));_0x27769b[_0xaaf9('0x2f')]=_0x27769b['attributes'][_0xaaf9('0x32')]?_0x27769b[_0xaaf9('0x2f')]:_0x1e038d[_0xaaf9('0x2b')];if(_0x4123ed['query'][_0xaaf9('0x33')]){_0x27769b[_0xaaf9('0x25')]=[{'all':!![]}];}_0x27769b=_[_0xaaf9('0x34')]({},_0x27769b,_0x4123ed['options']);return db[_0xaaf9('0x20')][_0xaaf9('0x35')](_0x27769b)[_0xaaf9('0x14')](handleEntityNotFound(_0x176e6c,null))['then'](respondWithResult(_0x176e6c,null))[_0xaaf9('0x28')](handleError(_0x176e6c,null));};exports[_0xaaf9('0x36')]=function(_0x1edb5f,_0x3e0e61){return db['OpenchannelQueue'][_0xaaf9('0x36')](_0x1edb5f[_0xaaf9('0x37')],{})[_0xaaf9('0x14')](function(_0x2e71cc){var _0x38dab5=_0x1edb5f[_0xaaf9('0x38')][_0xaaf9('0x16')]({'plain':!![]});if(!_0x38dab5)throw new Error(_0xaaf9('0x39'));if(_0x38dab5[_0xaaf9('0x3a')]==='user'){var _0xc4ee05=_0x2e71cc[_0xaaf9('0x16')]({'plain':!![]});var _0x3d1ce4=_0xaaf9('0x17');return db[_0xaaf9('0x3b')][_0xaaf9('0x35')]({'where':{'name':_0x3d1ce4,'userProfileId':_0x38dab5[_0xaaf9('0x3c')]},'raw':!![]})[_0xaaf9('0x14')](function(_0x129bfc){if(_0x129bfc&&_0x129bfc[_0xaaf9('0x3d')]===0x0){return db['UserProfileResource'][_0xaaf9('0x36')]({'name':_0xc4ee05[_0xaaf9('0x1c')],'resourceId':_0xc4ee05['id'],'type':_0x129bfc[_0xaaf9('0x1c')],'sectionId':_0x129bfc['id']},{})[_0xaaf9('0x14')](function(){return _0x2e71cc;});}else{return _0x2e71cc;}})[_0xaaf9('0x28')](function(_0x4e242b){logger[_0xaaf9('0x1b')](_0xaaf9('0x3e'),_0x4e242b);throw _0x4e242b;});}return _0x2e71cc;})[_0xaaf9('0x14')](respondWithResult(_0x3e0e61,0xc9))['catch'](handleError(_0x3e0e61,null));};exports[_0xaaf9('0x13')]=function(_0x3c8de9,_0x21d0fc){if(_0x3c8de9[_0xaaf9('0x37')]['id']){delete _0x3c8de9['body']['id'];}return db['OpenchannelQueue'][_0xaaf9('0x35')]({'where':{'id':_0x3c8de9['params']['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x21d0fc,null))[_0xaaf9('0x14')](saveUpdates(_0x3c8de9[_0xaaf9('0x37')],null))[_0xaaf9('0x14')](respondWithResult(_0x21d0fc,null))[_0xaaf9('0x28')](handleError(_0x21d0fc,null));};exports['destroy']=function(_0x2609f3,_0x5ed2fe){return db['OpenchannelQueue'][_0xaaf9('0x35')]({'where':{'id':_0x2609f3[_0xaaf9('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5ed2fe,null))[_0xaaf9('0x14')](removeEntity(_0x5ed2fe,null))[_0xaaf9('0x28')](handleError(_0x5ed2fe,null));};exports[_0xaaf9('0x3f')]=function(_0x262427,_0xb85200){return db['OpenchannelQueue'][_0xaaf9('0x3f')]()['then'](respondWithResult(_0xb85200,null))[_0xaaf9('0x28')](handleError(_0xb85200,null));};exports['getMembers']=function(_0x10e22e,_0x5ecdfd){var _0x1845c5={'raw':!![],'where':{}},_0x169f6e={},_0x599b4e;return db[_0xaaf9('0x20')][_0xaaf9('0x40')]({'where':{'id':_0x10e22e['params']['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x5ecdfd,null))['then'](function(_0x3e8311){if(_0x3e8311){_0x599b4e=_0x3e8311[_0xaaf9('0x16')]({'plain':!![]});_0x169f6e[_0xaaf9('0x2b')]=_[_0xaaf9('0x2c')](db['UserOpenchannelQueue'][_0xaaf9('0x2d')]);_0x169f6e[_0xaaf9('0x2e')]=_['keys'](_0x10e22e[_0xaaf9('0x2e')]);_0x169f6e[_0xaaf9('0x41')]=_['intersection'](_0x169f6e[_0xaaf9('0x2b')],_0x169f6e['query']);_0x1845c5[_0xaaf9('0x2f')]=_['intersection'](_0x169f6e[_0xaaf9('0x2b')],qs['fields'](_0x10e22e['query'][_0xaaf9('0x31')]));_0x1845c5[_0xaaf9('0x2f')]=_0x1845c5['attributes'][_0xaaf9('0x32')]?_0x1845c5['attributes']:_0x169f6e[_0xaaf9('0x2b')];if(!_0x10e22e[_0xaaf9('0x2e')][_0xaaf9('0x42')]('nolimit')){_0x1845c5[_0xaaf9('0xf')]=qs[_0xaaf9('0xf')](_0x10e22e['query'][_0xaaf9('0xf')]);_0x1845c5[_0xaaf9('0x11')]=qs[_0xaaf9('0x11')](_0x10e22e['query']['offset']);}_0x1845c5[_0xaaf9('0x43')]=qs[_0xaaf9('0x44')](_0x10e22e[_0xaaf9('0x2e')]['sort']);_0x1845c5[_0xaaf9('0x24')]=qs['filters'](_[_0xaaf9('0x45')](_0x10e22e[_0xaaf9('0x2e')],_0x169f6e[_0xaaf9('0x41')]));_0x1845c5[_0xaaf9('0x24')][_0xaaf9('0x46')]=_0x3e8311['id'];if(_0x10e22e[_0xaaf9('0x2e')][_0xaaf9('0x47')]){_0x1845c5['where']=_[_0xaaf9('0x34')](_0x1845c5['where'],{'$or':_[_0xaaf9('0x1f')](_0x1845c5['attributes'],function(_0x1fbe0b){var _0x175915={};_0x175915[_0x1fbe0b]={'$like':'%'+_0x10e22e[_0xaaf9('0x2e')][_0xaaf9('0x47')]+'%'};return _0x175915;})});}_0x1845c5=_['merge']({},_0x1845c5,_0x10e22e[_0xaaf9('0x48')]);return db[_0xaaf9('0x49')][_0xaaf9('0x26')](_0x1845c5);}})[_0xaaf9('0x14')](function(_0x4316dd){if(_0x4316dd){return db[_0xaaf9('0x4a')][_0xaaf9('0x4b')]({'where':{'id':_[_0xaaf9('0x1f')](_0x4316dd,_0xaaf9('0x4c')),'role':_0xaaf9('0x4d')},'attributes':['id',_0xaaf9('0x1c'),_0xaaf9('0x4e'),_0xaaf9('0x4f'),_0xaaf9('0x50')]});}})['then'](function(_0xdfa3d0){if(_0xdfa3d0){return{'count':_0xdfa3d0[_0xaaf9('0x10')],'rows':_[_0xaaf9('0x1f')](_0xdfa3d0[_0xaaf9('0x27')],function(_0x3b6876){return{'membername':_0x3b6876[_0xaaf9('0x1c')],'UserId':_0x3b6876['id'],'queue_name':_0x599b4e[_0xaaf9('0x1c')],'OpenchannelQueueId':_0x599b4e['id'],'interface':util[_0xaaf9('0x51')]('%s/%s',_0xaaf9('0x52'),_0x3b6876[_0xaaf9('0x1c')]),'penalty':0x0,'paused':_0x3b6876[_0xaaf9('0x4e')],'createdAt':_0x3b6876[_0xaaf9('0x50')],'updatedAt':_0x3b6876[_0xaaf9('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaaf9('0x14')](respondWithFilteredResult(_0x5ecdfd,_0x1845c5))[_0xaaf9('0x28')](handleError(_0x5ecdfd,null));};exports['getTeams']=function(_0x51c014,_0x2f45b8){var _0x2dd422={};var _0x2aa6e2={};var _0x3410d5;var _0x37b258;return db[_0xaaf9('0x20')][_0xaaf9('0x40')]({'where':{'id':_0x51c014[_0xaaf9('0x2a')]['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x2f45b8,null))[_0xaaf9('0x14')](function(_0x4d398a){if(_0x4d398a){_0x3410d5=_0x4d398a;_0x2aa6e2['model']=_[_0xaaf9('0x2c')](db['Team'][_0xaaf9('0x2d')]);_0x2aa6e2[_0xaaf9('0x2e')]=_['keys'](_0x51c014[_0xaaf9('0x2e')]);_0x2aa6e2[_0xaaf9('0x41')]=_['intersection'](_0x2aa6e2[_0xaaf9('0x2b')],_0x2aa6e2[_0xaaf9('0x2e')]);_0x2dd422[_0xaaf9('0x2f')]=_['intersection'](_0x2aa6e2[_0xaaf9('0x2b')],qs[_0xaaf9('0x31')](_0x51c014[_0xaaf9('0x2e')][_0xaaf9('0x31')]));_0x2dd422[_0xaaf9('0x2f')]=_0x2dd422[_0xaaf9('0x2f')][_0xaaf9('0x32')]?_0x2dd422['attributes']:_0x2aa6e2[_0xaaf9('0x2b')];_0x2dd422[_0xaaf9('0x43')]=qs['sort'](_0x51c014[_0xaaf9('0x2e')][_0xaaf9('0x44')]);_0x2dd422[_0xaaf9('0x24')]=qs['filters'](_[_0xaaf9('0x45')](_0x51c014[_0xaaf9('0x2e')],_0x2aa6e2[_0xaaf9('0x41')]));if(_0x51c014[_0xaaf9('0x2e')][_0xaaf9('0x47')]){_0x2dd422[_0xaaf9('0x24')]=_[_0xaaf9('0x34')](_0x2dd422[_0xaaf9('0x24')],{'$or':_[_0xaaf9('0x1f')](_0x2dd422[_0xaaf9('0x2f')],function(_0x4ae9f5){var _0x4c821f={};_0x4c821f[_0x4ae9f5]={'$like':'%'+_0x51c014[_0xaaf9('0x2e')][_0xaaf9('0x47')]+'%'};return _0x4c821f;})});}_0x2dd422=_['merge']({},_0x2dd422,_0x51c014[_0xaaf9('0x48')]);return _0x3410d5[_0xaaf9('0x53')](_0x2dd422);}})['then'](function(_0x616e1){if(_0x616e1){_0x37b258=_0x616e1[_0xaaf9('0x32')];if(!_0x51c014['query'][_0xaaf9('0x42')](_0xaaf9('0x54'))){_0x2dd422[_0xaaf9('0xf')]=qs[_0xaaf9('0xf')](_0x51c014['query']['limit']);_0x2dd422['offset']=qs[_0xaaf9('0x11')](_0x51c014[_0xaaf9('0x2e')]['offset']);}return _0x3410d5['getTeams'](_0x2dd422);}})[_0xaaf9('0x14')](function(_0xfb4c01){if(_0xfb4c01){return _0xfb4c01?{'count':_0x37b258,'rows':_0xfb4c01}:null;}})[_0xaaf9('0x14')](respondWithResult(_0x2f45b8,null))[_0xaaf9('0x28')](handleError(_0x2f45b8,null));};exports['addTeams']=function(_0x3e1c13,_0xb97bf6){var _0x555f56=_0x3e1c13[_0xaaf9('0x37')]['ids'];return db['Team']['findAll']({'where':{'id':_0x555f56},'attributes':['id'],'include':[{'model':db[_0xaaf9('0x4a')],'as':_0xaaf9('0x55'),'attributes':['id',_0xaaf9('0x1c'),_0xaaf9('0x56'),_0xaaf9('0x57'),_0xaaf9('0x58')],'raw':!![]}]})['then'](function(_0x383e7e){if(_0x383e7e){var _0x21a53=_[_0xaaf9('0x59')](_0x383e7e,function(_0x4190d4){var _0x2f395a=_0x4190d4['get']({'plain':!![]});return _0x2f395a[_0xaaf9('0x55')];});return db[_0xaaf9('0x20')][_0xaaf9('0x35')]({'where':{'id':_0x3e1c13['params']['id']}})[_0xaaf9('0x14')](function(_0x51bfce){return db[_0xaaf9('0x5a')][_0xaaf9('0x5b')](function(_0x55850f){return _0x51bfce[_0xaaf9('0x5c')](_0x555f56,{'transaction':_0x55850f})[_0xaaf9('0x14')](function(){return BPromise[_0xaaf9('0x5d')](_0x21a53,function(_0x2c439e){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x2c439e['id'],'OpenchannelQueueId':_0x3e1c13[_0xaaf9('0x2a')]['id']},'transaction':_0x55850f});});})[_0xaaf9('0x14')](function(){_0x21a53['forEach'](function(_0x54dd9d){socket[_0xaaf9('0x5e')](_0xaaf9('0x5f'),{'UserId':_0x54dd9d['id'],'OpenchannelQueueId':_0x51bfce['id']});});});});});}})['then'](respondWithStatusCode(_0xb97bf6,null))[_0xaaf9('0x28')](handleError(_0xb97bf6,null));};exports['removeTeams']=function(_0x30c1d0,_0x2b5b52){return db[_0xaaf9('0x60')]['findAll']({'where':{'id':_0x30c1d0[_0xaaf9('0x2e')][_0xaaf9('0x61')]},'attributes':['id'],'include':[{'model':db[_0xaaf9('0x4a')],'as':_0xaaf9('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2b5b52,null))[_0xaaf9('0x14')](function(_0x4695f1){var _0x428ef7=_[_0xaaf9('0x1f')](_0x4695f1,'id');var _0x33b40f=[];var _0x52b6d9=[];var _0x32fb4c=squel['select']();_0x32fb4c[_0xaaf9('0x62')](_0xaaf9('0x63'))['from'](_0xaaf9('0x64'),'tq')[_0xaaf9('0x65')](_0xaaf9('0x66'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xaaf9('0x24')](_0xaaf9('0x67'),_0x30c1d0[_0xaaf9('0x2a')]['id']);for(var _0x5aa8b3=0x0;_0x5aa8b3<_0x4695f1[_0xaaf9('0x32')];_0x5aa8b3+=0x1){let _0xc7d63f=_0x4695f1[_0x5aa8b3];for(var _0x13d432=0x0;_0x13d432<_0xc7d63f['Agents']['length'];_0x13d432+=0x1){let _0x3fe2ea=_0xc7d63f[_0xaaf9('0x55')][_0x13d432];var _0x22c266=_0x32fb4c[_0xaaf9('0x68')]();_0x22c266['where'](_0xaaf9('0x69'),_0x3fe2ea['id']);_0x52b6d9[_0xaaf9('0x6a')](db[_0xaaf9('0x5a')][_0xaaf9('0x2e')](_0x22c266['toString'](),{'type':db[_0xaaf9('0x5a')][_0xaaf9('0x6b')]['SELECT']})['then'](function(_0x449950){if(_0x449950[_0xaaf9('0x32')]===0x1){return _0x3fe2ea['id'];}else{var _0x4eefd9=_[_0xaaf9('0x6c')](_[_0xaaf9('0x1f')](_0x449950,_0xaaf9('0x6d')),function(_0x38e4cf){return _[_0xaaf9('0x6e')](_0x428ef7,_0x38e4cf);});if(_0x4eefd9){return _0x3fe2ea['id'];}}}));}}return BPromise['all'](_0x52b6d9)[_0xaaf9('0x14')](function(_0x47f23b){_0x33b40f=_(_0x33b40f)[_0xaaf9('0x6f')](_0x47f23b)[_0xaaf9('0x70')]()['value']();return db[_0xaaf9('0x20')]['find']({'where':{'id':_0x30c1d0[_0xaaf9('0x2a')]['id']}})['then'](function(_0xa9ba04){return db[_0xaaf9('0x5a')][_0xaaf9('0x5b')](function(_0x5d777a){return _0xa9ba04['removeTeams'](_0x30c1d0[_0xaaf9('0x2e')][_0xaaf9('0x61')],{'transaction':_0x5d777a})[_0xaaf9('0x14')](function(){if(!_[_0xaaf9('0x71')](_0x33b40f)){return _0xa9ba04[_0xaaf9('0x72')](_0x33b40f,{'transaction':_0x5d777a});}})[_0xaaf9('0x14')](function(){_0x33b40f['forEach'](function(_0x4dce05){socket[_0xaaf9('0x5e')]('userOpenchannelQueue:remove',{'UserId':_0x4dce05,'OpenchannelQueueId':_0xa9ba04['id']});});});});});});})[_0xaaf9('0x14')](respondWithStatusCode(_0x2b5b52,null))[_0xaaf9('0x28')](handleError(_0x2b5b52,null));};exports[_0xaaf9('0x73')]=function(_0x3a4dd0,_0x280588){return db[_0xaaf9('0x20')][_0xaaf9('0x35')]({'where':{'id':_0x3a4dd0[_0xaaf9('0x2a')]['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x280588,null))['then'](function(_0x585603){if(_0x585603){return _0x585603[_0xaaf9('0x73')](_0x3a4dd0[_0xaaf9('0x37')][_0xaaf9('0x61')],_[_0xaaf9('0x74')](_0x3a4dd0[_0xaaf9('0x37')],[_0xaaf9('0x61'),'id'])||{})['spread'](function(_0x43c761){for(var _0xbfd0ac=0x0;_0xbfd0ac<_0x3a4dd0[_0xaaf9('0x37')]['ids']['length'];_0xbfd0ac+=0x1){socket[_0xaaf9('0x5e')](_0xaaf9('0x5f'),{'UserId':Number(_0x3a4dd0['body'][_0xaaf9('0x61')][_0xbfd0ac]),'OpenchannelQueueId':Number(_0x3a4dd0[_0xaaf9('0x2a')]['id'])});}return _0x43c761;});}})['then'](respondWithResult(_0x280588,null))['catch'](handleError(_0x280588,null));};exports[_0xaaf9('0x72')]=function(_0x1102de,_0x34d60b){return db[_0xaaf9('0x20')][_0xaaf9('0x35')]({'where':{'id':_0x1102de[_0xaaf9('0x2a')]['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x34d60b,null))[_0xaaf9('0x14')](function(_0x2fd204){if(_0x2fd204){return _0x2fd204[_0xaaf9('0x72')](_0x1102de[_0xaaf9('0x2e')][_0xaaf9('0x61')])[_0xaaf9('0x14')](function(){if(_[_0xaaf9('0x75')](_0x1102de[_0xaaf9('0x2e')][_0xaaf9('0x61')])){for(var _0x4c91e9=0x0;_0x4c91e9<_0x1102de[_0xaaf9('0x2e')][_0xaaf9('0x61')]['length'];_0x4c91e9+=0x1){socket[_0xaaf9('0x5e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x1102de[_0xaaf9('0x2e')][_0xaaf9('0x61')][_0x4c91e9]),'OpenchannelQueueId':Number(_0x1102de[_0xaaf9('0x2a')]['id'])});}}else{socket[_0xaaf9('0x5e')](_0xaaf9('0x76'),{'UserId':Number(_0x1102de['query'][_0xaaf9('0x61')]),'OpenchannelQueueId':Number(_0x1102de['params']['id'])});}});}})[_0xaaf9('0x14')](respondWithStatusCode(_0x34d60b,null))[_0xaaf9('0x28')](handleError(_0x34d60b,null));};exports[_0xaaf9('0x77')]=function(_0xea1693,_0x357a9a){var _0x256bd9={};var _0x524f27={};var _0x5b2c95;var _0x1325ae;return db[_0xaaf9('0x20')]['findOne']({'where':{'id':_0xea1693['params']['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x357a9a,null))[_0xaaf9('0x14')](function(_0x1a7691){if(_0x1a7691){_0x5b2c95=_0x1a7691;_0x524f27[_0xaaf9('0x2b')]=_[_0xaaf9('0x2c')](db['User'][_0xaaf9('0x2d')]);_0x524f27[_0xaaf9('0x2e')]=_[_0xaaf9('0x2c')](_0xea1693[_0xaaf9('0x2e')]);_0x524f27[_0xaaf9('0x41')]=_[_0xaaf9('0x30')](_0x524f27[_0xaaf9('0x2b')],_0x524f27[_0xaaf9('0x2e')]);_0x256bd9[_0xaaf9('0x2f')]=_['intersection'](_0x524f27[_0xaaf9('0x2b')],qs[_0xaaf9('0x31')](_0xea1693[_0xaaf9('0x2e')][_0xaaf9('0x31')]));_0x256bd9[_0xaaf9('0x2f')]=_0x256bd9['attributes'][_0xaaf9('0x32')]?_0x256bd9[_0xaaf9('0x2f')]:_0x524f27[_0xaaf9('0x2b')];_0x256bd9[_0xaaf9('0x43')]=qs['sort'](_0xea1693[_0xaaf9('0x2e')][_0xaaf9('0x44')]);_0x256bd9['where']=qs[_0xaaf9('0x41')](_[_0xaaf9('0x45')](_0xea1693['query'],_0x524f27['filters']));if(_0xea1693['query'][_0xaaf9('0x47')]){_0x256bd9[_0xaaf9('0x24')]=_['merge'](_0x256bd9['where'],{'$or':_[_0xaaf9('0x1f')](_0x256bd9[_0xaaf9('0x2f')],function(_0x450b74){var _0x3c1718={};_0x3c1718[_0x450b74]={'$like':'%'+_0xea1693[_0xaaf9('0x2e')][_0xaaf9('0x47')]+'%'};return _0x3c1718;})});}_0x256bd9=_[_0xaaf9('0x34')]({},_0x256bd9,_0xea1693['options']);return _0x5b2c95[_0xaaf9('0x77')](_0x256bd9);}})['then'](function(_0x5de109){if(_0x5de109){_0x1325ae=_0x5de109[_0xaaf9('0x32')];if(!_0xea1693[_0xaaf9('0x2e')][_0xaaf9('0x42')](_0xaaf9('0x54'))){_0x256bd9[_0xaaf9('0xf')]=qs[_0xaaf9('0xf')](_0xea1693[_0xaaf9('0x2e')][_0xaaf9('0xf')]);_0x256bd9[_0xaaf9('0x11')]=qs['offset'](_0xea1693['query'][_0xaaf9('0x11')]);}return _0x5b2c95[_0xaaf9('0x77')](_0x256bd9);}})[_0xaaf9('0x14')](function(_0x2ecf37){if(_0x2ecf37){return _0x2ecf37?{'count':_0x1325ae,'rows':_0x2ecf37}:null;}})['then'](respondWithResult(_0x357a9a,null))[_0xaaf9('0x28')](handleError(_0x357a9a,null));}; \ No newline at end of file +var _0xe8e7=['getMembers','get','UserOpenchannelQueue','nolimit','order','sort','pick','OpenchannelQueueId','filter','map','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','length','hasOwnProperty','addTeams','findAll','User','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','destroy','then','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','where','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','update','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe8e7,0x130));var _0x7e8e=function(_0x1cb9ef,_0x5a2a1f){_0x1cb9ef=_0x1cb9ef-0x0;var _0x398252=_0xe8e7[_0x1cb9ef];return _0x398252;};'use strict';var BPromise=require(_0x7e8e('0x0'));var util=require(_0x7e8e('0x1'));var _=require(_0x7e8e('0x2'));var squel=require(_0x7e8e('0x3'));var Redis=require('ioredis');var qs=require(_0x7e8e('0x4'));var logger=require(_0x7e8e('0x5'))(_0x7e8e('0x6'));var config=require(_0x7e8e('0x7'));var db=require('../../mysqldb')['db'];config[_0x7e8e('0x8')]=_['defaults'](config[_0x7e8e('0x8')],{'host':_0x7e8e('0x9'),'port':0x18eb});var socket=require(_0x7e8e('0xa'))(new Redis(config[_0x7e8e('0x8')]));require(_0x7e8e('0xb'))['register'](socket);function respondWithStatusCode(_0x167d26,_0x52648c){_0x52648c=_0x52648c||0xcc;return function(_0x4e7ad7){if(_0x4e7ad7){return _0x167d26[_0x7e8e('0xc')](_0x52648c);}return _0x167d26['status'](_0x52648c)[_0x7e8e('0xd')]();};}function respondWithResult(_0xd294e1,_0x295f5d){_0x295f5d=_0x295f5d||0xc8;return function(_0x428265){if(_0x428265){return _0xd294e1[_0x7e8e('0xe')](_0x295f5d)[_0x7e8e('0xf')](_0x428265);}};}function respondWithFilteredResult(_0x196f4c,_0x19b7c1){return function(_0x3c54f8){if(_0x3c54f8){var _0x1b5e6e=typeof _0x19b7c1['offset']===_0x7e8e('0x10')&&typeof _0x19b7c1[_0x7e8e('0x11')]===_0x7e8e('0x10');var _0x1ac78c=_0x3c54f8[_0x7e8e('0x12')];var _0xe2efaf=_0x1b5e6e?0x0:_0x19b7c1[_0x7e8e('0x13')];var _0x25b879=_0x1b5e6e?_0x3c54f8['count']:_0x19b7c1[_0x7e8e('0x13')]+_0x19b7c1['limit'];var _0x3cf812;if(_0x25b879>=_0x1ac78c){_0x25b879=_0x1ac78c;_0x3cf812=0xc8;}else{_0x3cf812=0xce;}_0x196f4c[_0x7e8e('0xe')](_0x3cf812);return _0x196f4c[_0x7e8e('0x14')](_0x7e8e('0x15'),_0xe2efaf+'-'+_0x25b879+'/'+_0x1ac78c)[_0x7e8e('0xf')](_0x3c54f8);}return null;};}function saveUpdates(_0x89728){return function(_0x458c26){if(_0x458c26){return _0x458c26['update'](_0x89728)['then'](function(_0x3a2427){return _0x3a2427;});}return null;};}function removeEntity(_0x4949a0){return function(_0x5b0828){if(_0x5b0828){return _0x5b0828[_0x7e8e('0x16')]()[_0x7e8e('0x17')](function(){var _0x53463d=_0x5b0828['get']({'plain':!![]});var _0x47efa7='OpenchannelQueues';return db[_0x7e8e('0x18')]['destroy']({'where':{'type':_0x47efa7,'resourceId':_0x53463d['id']}})[_0x7e8e('0x17')](function(){return _0x5b0828;});})[_0x7e8e('0x17')](function(){_0x4949a0[_0x7e8e('0xe')](0xcc)[_0x7e8e('0xd')]();});}};}function handleEntityNotFound(_0x200e8f){return function(_0x378d01){if(!_0x378d01){_0x200e8f[_0x7e8e('0xc')](0x194);}return _0x378d01;};}function handleError(_0x2dcd59,_0x1082ab){_0x1082ab=_0x1082ab||0x1f4;return function(_0x478b9f){logger[_0x7e8e('0x19')](_0x478b9f[_0x7e8e('0x1a')]);if(_0x478b9f[_0x7e8e('0x1b')]){delete _0x478b9f[_0x7e8e('0x1b')];}_0x2dcd59[_0x7e8e('0xe')](_0x1082ab)[_0x7e8e('0x1c')](_0x478b9f);};}exports[_0x7e8e('0x1d')]=function(_0x61fa3e,_0x1e2951){var _0x4869b2={};var _0x29c701={'count':0x0,'rows':[]};var _0x450084=_['map'](db[_0x7e8e('0x1e')][_0x7e8e('0x1f')],function(_0x456fa5){return{'name':_0x456fa5[_0x7e8e('0x20')],'type':_0x456fa5[_0x7e8e('0x21')]['key']};});_0x4869b2=qs['getOptions'](_0x450084,_0x61fa3e);var _0x4b1838={'where':_0x4869b2[_0x7e8e('0x22')]};return db['OpenchannelQueue'][_0x7e8e('0x12')](_0x4b1838)[_0x7e8e('0x17')](function(_0x260b95){_0x29c701[_0x7e8e('0x12')]=_0x260b95;_0x4869b2[_0x7e8e('0x23')]=qs[_0x7e8e('0x23')](_0x61fa3e[_0x7e8e('0x24')]);return db[_0x7e8e('0x1e')]['findAll'](_0x4869b2);})[_0x7e8e('0x17')](function(_0x496ea5){_0x29c701[_0x7e8e('0x25')]=_0x496ea5;return _0x29c701;})[_0x7e8e('0x17')](respondWithFilteredResult(_0x1e2951,_0x4869b2))[_0x7e8e('0x26')](handleError(_0x1e2951,null));};exports[_0x7e8e('0x27')]=function(_0x35b4ad,_0x5b6bbb){var _0x22ef32={'raw':!![],'where':{'id':_0x35b4ad[_0x7e8e('0x28')]['id']}},_0x7bdffa={};_0x7bdffa[_0x7e8e('0x29')]=_[_0x7e8e('0x2a')](db[_0x7e8e('0x1e')][_0x7e8e('0x1f')]);_0x7bdffa[_0x7e8e('0x24')]=_[_0x7e8e('0x2a')](_0x35b4ad['query']);_0x7bdffa[_0x7e8e('0x2b')]=_[_0x7e8e('0x2c')](_0x7bdffa[_0x7e8e('0x29')],_0x7bdffa['query']);_0x22ef32[_0x7e8e('0x2d')]=_[_0x7e8e('0x2c')](_0x7bdffa[_0x7e8e('0x29')],qs[_0x7e8e('0x2e')](_0x35b4ad[_0x7e8e('0x24')][_0x7e8e('0x2e')]));_0x22ef32['attributes']=_0x22ef32[_0x7e8e('0x2d')]['length']?_0x22ef32['attributes']:_0x7bdffa[_0x7e8e('0x29')];if(_0x35b4ad[_0x7e8e('0x24')][_0x7e8e('0x2f')]){_0x22ef32['include']=[{'all':!![]}];}_0x22ef32=_[_0x7e8e('0x30')]({},_0x22ef32,_0x35b4ad[_0x7e8e('0x31')]);return db[_0x7e8e('0x1e')][_0x7e8e('0x32')](_0x22ef32)[_0x7e8e('0x17')](handleEntityNotFound(_0x5b6bbb,null))['then'](respondWithResult(_0x5b6bbb,null))[_0x7e8e('0x26')](handleError(_0x5b6bbb,null));};exports[_0x7e8e('0x33')]=function(_0x38c9e9,_0x95bb45){return db[_0x7e8e('0x1e')]['create'](_0x38c9e9[_0x7e8e('0x34')],{})[_0x7e8e('0x17')](function(_0x4f8ef5){var _0x111a83=_0x38c9e9['user']['get']({'plain':!![]});if(!_0x111a83)throw new Error(_0x7e8e('0x35'));if(_0x111a83[_0x7e8e('0x36')]===_0x7e8e('0x37')){var _0x51d60c=_0x4f8ef5['get']({'plain':!![]});var _0x148c6f=_0x7e8e('0x38');return db[_0x7e8e('0x39')]['find']({'where':{'name':_0x148c6f,'userProfileId':_0x111a83[_0x7e8e('0x3a')]},'raw':!![]})['then'](function(_0x11abc6){if(_0x11abc6&&_0x11abc6[_0x7e8e('0x3b')]===0x0){return db[_0x7e8e('0x18')][_0x7e8e('0x33')]({'name':_0x51d60c[_0x7e8e('0x1b')],'resourceId':_0x51d60c['id'],'type':_0x11abc6[_0x7e8e('0x1b')],'sectionId':_0x11abc6['id']},{})[_0x7e8e('0x17')](function(){return _0x4f8ef5;});}else{return _0x4f8ef5;}})['catch'](function(_0xe8b7c8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe8b7c8);throw _0xe8b7c8;});}return _0x4f8ef5;})[_0x7e8e('0x17')](respondWithResult(_0x95bb45,0xc9))[_0x7e8e('0x26')](handleError(_0x95bb45,null));};exports[_0x7e8e('0x3c')]=function(_0x54df88,_0x2e35b9){if(_0x54df88[_0x7e8e('0x34')]['id']){delete _0x54df88[_0x7e8e('0x34')]['id'];}return db[_0x7e8e('0x1e')][_0x7e8e('0x32')]({'where':{'id':_0x54df88[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](handleEntityNotFound(_0x2e35b9,null))['then'](saveUpdates(_0x54df88[_0x7e8e('0x34')],null))['then'](respondWithResult(_0x2e35b9,null))[_0x7e8e('0x26')](handleError(_0x2e35b9,null));};exports[_0x7e8e('0x16')]=function(_0x37eac5,_0x26d666){return db[_0x7e8e('0x1e')]['find']({'where':{'id':_0x37eac5[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](handleEntityNotFound(_0x26d666,null))[_0x7e8e('0x17')](removeEntity(_0x26d666,null))['catch'](handleError(_0x26d666,null));};exports[_0x7e8e('0x3d')]=function(_0x458024,_0x48f6ff){return db[_0x7e8e('0x1e')][_0x7e8e('0x3d')]()[_0x7e8e('0x17')](respondWithResult(_0x48f6ff,null))[_0x7e8e('0x26')](handleError(_0x48f6ff,null));};exports[_0x7e8e('0x3e')]=function(_0xd3c086,_0x24604c){var _0x4d0212={'raw':!![],'where':{}},_0x29b2b7={},_0x201866;return db[_0x7e8e('0x1e')]['findOne']({'where':{'id':_0xd3c086[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](handleEntityNotFound(_0x24604c,null))['then'](function(_0x2059b3){if(_0x2059b3){_0x201866=_0x2059b3[_0x7e8e('0x3f')]({'plain':!![]});_0x29b2b7['model']=_[_0x7e8e('0x2a')](db[_0x7e8e('0x40')][_0x7e8e('0x1f')]);_0x29b2b7[_0x7e8e('0x24')]=_[_0x7e8e('0x2a')](_0xd3c086['query']);_0x29b2b7[_0x7e8e('0x2b')]=_[_0x7e8e('0x2c')](_0x29b2b7[_0x7e8e('0x29')],_0x29b2b7['query']);_0x4d0212[_0x7e8e('0x2d')]=_[_0x7e8e('0x2c')](_0x29b2b7[_0x7e8e('0x29')],qs[_0x7e8e('0x2e')](_0xd3c086['query'][_0x7e8e('0x2e')]));_0x4d0212[_0x7e8e('0x2d')]=_0x4d0212[_0x7e8e('0x2d')]['length']?_0x4d0212[_0x7e8e('0x2d')]:_0x29b2b7[_0x7e8e('0x29')];if(!_0xd3c086['query']['hasOwnProperty'](_0x7e8e('0x41'))){_0x4d0212[_0x7e8e('0x11')]=qs[_0x7e8e('0x11')](_0xd3c086[_0x7e8e('0x24')]['limit']);_0x4d0212[_0x7e8e('0x13')]=qs['offset'](_0xd3c086[_0x7e8e('0x24')][_0x7e8e('0x13')]);}_0x4d0212[_0x7e8e('0x42')]=qs['sort'](_0xd3c086[_0x7e8e('0x24')][_0x7e8e('0x43')]);_0x4d0212[_0x7e8e('0x22')]=qs[_0x7e8e('0x2b')](_[_0x7e8e('0x44')](_0xd3c086[_0x7e8e('0x24')],_0x29b2b7['filters']));_0x4d0212[_0x7e8e('0x22')][_0x7e8e('0x45')]=_0x2059b3['id'];if(_0xd3c086[_0x7e8e('0x24')][_0x7e8e('0x46')]){_0x4d0212[_0x7e8e('0x22')]=_['merge'](_0x4d0212[_0x7e8e('0x22')],{'$or':_[_0x7e8e('0x47')](_0x4d0212[_0x7e8e('0x2d')],function(_0x3cbbf4){var _0x166def={};_0x166def[_0x3cbbf4]={'$like':'%'+_0xd3c086[_0x7e8e('0x24')]['filter']+'%'};return _0x166def;})});}_0x4d0212=_['merge']({},_0x4d0212,_0xd3c086[_0x7e8e('0x31')]);return db[_0x7e8e('0x40')]['findAll'](_0x4d0212);}})['then'](function(_0x52c85a){if(_0x52c85a){return db['User']['findAndCountAll']({'where':{'id':_[_0x7e8e('0x47')](_0x52c85a,_0x7e8e('0x48')),'role':'agent'},'attributes':['id','name',_0x7e8e('0x49'),_0x7e8e('0x4a'),_0x7e8e('0x4b')]});}})[_0x7e8e('0x17')](function(_0x4f2510){if(_0x4f2510){return{'count':_0x4f2510['count'],'rows':_[_0x7e8e('0x47')](_0x4f2510[_0x7e8e('0x25')],function(_0x461ab8){return{'membername':_0x461ab8[_0x7e8e('0x1b')],'UserId':_0x461ab8['id'],'queue_name':_0x201866[_0x7e8e('0x1b')],'OpenchannelQueueId':_0x201866['id'],'interface':util[_0x7e8e('0x4c')](_0x7e8e('0x4d'),'SIP',_0x461ab8[_0x7e8e('0x1b')]),'penalty':0x0,'paused':_0x461ab8[_0x7e8e('0x49')],'createdAt':_0x461ab8['createdAt'],'updatedAt':_0x461ab8[_0x7e8e('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7e8e('0x17')](respondWithFilteredResult(_0x24604c,_0x4d0212))[_0x7e8e('0x26')](handleError(_0x24604c,null));};exports[_0x7e8e('0x4e')]=function(_0x16c427,_0x27a1b3){var _0x23e9a2={};var _0x481bd1={};var _0x232791;var _0x14abb1;return db[_0x7e8e('0x1e')][_0x7e8e('0x4f')]({'where':{'id':_0x16c427[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](handleEntityNotFound(_0x27a1b3,null))[_0x7e8e('0x17')](function(_0x366880){if(_0x366880){_0x232791=_0x366880;_0x481bd1[_0x7e8e('0x29')]=_[_0x7e8e('0x2a')](db[_0x7e8e('0x50')]['rawAttributes']);_0x481bd1[_0x7e8e('0x24')]=_['keys'](_0x16c427[_0x7e8e('0x24')]);_0x481bd1[_0x7e8e('0x2b')]=_[_0x7e8e('0x2c')](_0x481bd1['model'],_0x481bd1['query']);_0x23e9a2[_0x7e8e('0x2d')]=_[_0x7e8e('0x2c')](_0x481bd1['model'],qs[_0x7e8e('0x2e')](_0x16c427['query'][_0x7e8e('0x2e')]));_0x23e9a2['attributes']=_0x23e9a2[_0x7e8e('0x2d')][_0x7e8e('0x51')]?_0x23e9a2[_0x7e8e('0x2d')]:_0x481bd1[_0x7e8e('0x29')];_0x23e9a2[_0x7e8e('0x42')]=qs[_0x7e8e('0x43')](_0x16c427['query']['sort']);_0x23e9a2[_0x7e8e('0x22')]=qs[_0x7e8e('0x2b')](_['pick'](_0x16c427[_0x7e8e('0x24')],_0x481bd1[_0x7e8e('0x2b')]));if(_0x16c427[_0x7e8e('0x24')][_0x7e8e('0x46')]){_0x23e9a2[_0x7e8e('0x22')]=_[_0x7e8e('0x30')](_0x23e9a2[_0x7e8e('0x22')],{'$or':_[_0x7e8e('0x47')](_0x23e9a2[_0x7e8e('0x2d')],function(_0x9710b2){var _0x3d1530={};_0x3d1530[_0x9710b2]={'$like':'%'+_0x16c427['query'][_0x7e8e('0x46')]+'%'};return _0x3d1530;})});}_0x23e9a2=_[_0x7e8e('0x30')]({},_0x23e9a2,_0x16c427['options']);return _0x232791[_0x7e8e('0x4e')](_0x23e9a2);}})['then'](function(_0x284c28){if(_0x284c28){_0x14abb1=_0x284c28[_0x7e8e('0x51')];if(!_0x16c427['query'][_0x7e8e('0x52')](_0x7e8e('0x41'))){_0x23e9a2[_0x7e8e('0x11')]=qs['limit'](_0x16c427['query'][_0x7e8e('0x11')]);_0x23e9a2[_0x7e8e('0x13')]=qs[_0x7e8e('0x13')](_0x16c427[_0x7e8e('0x24')][_0x7e8e('0x13')]);}return _0x232791[_0x7e8e('0x4e')](_0x23e9a2);}})['then'](function(_0x461468){if(_0x461468){return _0x461468?{'count':_0x14abb1,'rows':_0x461468}:null;}})[_0x7e8e('0x17')](respondWithResult(_0x27a1b3,null))[_0x7e8e('0x26')](handleError(_0x27a1b3,null));};exports[_0x7e8e('0x53')]=function(_0x8e8a8e,_0x36ffcd){var _0x4c4bdc=_0x8e8a8e[_0x7e8e('0x34')]['ids'];return db['Team'][_0x7e8e('0x54')]({'where':{'id':_0x4c4bdc},'attributes':['id'],'include':[{'model':db[_0x7e8e('0x55')],'as':_0x7e8e('0x56'),'attributes':['id',_0x7e8e('0x1b'),'online',_0x7e8e('0x57'),_0x7e8e('0x58')],'raw':!![]}]})[_0x7e8e('0x17')](function(_0x2da65c){if(_0x2da65c){var _0x5c83ab=_['flatMap'](_0x2da65c,function(_0x54455e){var _0x315088=_0x54455e[_0x7e8e('0x3f')]({'plain':!![]});return _0x315088[_0x7e8e('0x56')];});return db[_0x7e8e('0x1e')]['find']({'where':{'id':_0x8e8a8e[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](function(_0x499db4){return db[_0x7e8e('0x59')][_0x7e8e('0x5a')](function(_0x459df8){return _0x499db4[_0x7e8e('0x53')](_0x4c4bdc,{'transaction':_0x459df8})[_0x7e8e('0x17')](function(){return BPromise[_0x7e8e('0x5b')](_0x5c83ab,function(_0x21b4d3){return db[_0x7e8e('0x40')][_0x7e8e('0x5c')]({'where':{'UserId':_0x21b4d3['id'],'OpenchannelQueueId':_0x8e8a8e[_0x7e8e('0x28')]['id']},'transaction':_0x459df8});});})['then'](function(){_0x5c83ab[_0x7e8e('0x5d')](function(_0x353f6f){socket[_0x7e8e('0x5e')]('userOpenchannelQueue:save',{'UserId':_0x353f6f['id'],'OpenchannelQueueId':_0x499db4['id']});});});});});}})['then'](respondWithStatusCode(_0x36ffcd,null))[_0x7e8e('0x26')](handleError(_0x36ffcd,null));};exports[_0x7e8e('0x5f')]=function(_0x5d944b,_0x4637b3){return db[_0x7e8e('0x50')][_0x7e8e('0x54')]({'where':{'id':_0x5d944b[_0x7e8e('0x24')][_0x7e8e('0x60')]},'attributes':['id'],'include':[{'model':db[_0x7e8e('0x55')],'as':_0x7e8e('0x56'),'attributes':['id'],'raw':!![]}]})[_0x7e8e('0x17')](handleEntityNotFound(_0x4637b3,null))[_0x7e8e('0x17')](function(_0x49f746){var _0x163ce6=_[_0x7e8e('0x47')](_0x49f746,'id');var _0x20bc4e=[];var _0x267095=[];var _0x26ecf9=squel[_0x7e8e('0x61')]();_0x26ecf9['field'](_0x7e8e('0x62'))[_0x7e8e('0x63')]('team_has_openchannel_queues','tq')[_0x7e8e('0x64')](_0x7e8e('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7e8e('0x66'),_0x5d944b[_0x7e8e('0x28')]['id']);for(var _0x4fe347=0x0;_0x4fe347<_0x49f746[_0x7e8e('0x51')];_0x4fe347+=0x1){let _0x2caf8d=_0x49f746[_0x4fe347];for(var _0x402c11=0x0;_0x402c11<_0x2caf8d[_0x7e8e('0x56')]['length'];_0x402c11+=0x1){let _0x17b19e=_0x2caf8d[_0x7e8e('0x56')][_0x402c11];var _0x132e1b=_0x26ecf9[_0x7e8e('0x67')]();_0x132e1b[_0x7e8e('0x22')](_0x7e8e('0x68'),_0x17b19e['id']);_0x267095[_0x7e8e('0x69')](db[_0x7e8e('0x59')][_0x7e8e('0x24')](_0x132e1b['toString'](),{'type':db[_0x7e8e('0x59')][_0x7e8e('0x6a')][_0x7e8e('0x6b')]})['then'](function(_0x44710a){if(_0x44710a[_0x7e8e('0x51')]===0x1){return _0x17b19e['id'];}else{var _0x591fd4=_[_0x7e8e('0x6c')](_['map'](_0x44710a,_0x7e8e('0x6d')),function(_0x4b20a8){return _[_0x7e8e('0x6e')](_0x163ce6,_0x4b20a8);});if(_0x591fd4){return _0x17b19e['id'];}}}));}}return BPromise['all'](_0x267095)[_0x7e8e('0x17')](function(_0x17830a){_0x20bc4e=_(_0x20bc4e)[_0x7e8e('0x6f')](_0x17830a)[_0x7e8e('0x70')]()[_0x7e8e('0x71')]();return db[_0x7e8e('0x1e')]['find']({'where':{'id':_0x5d944b[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](function(_0x362181){return db[_0x7e8e('0x59')]['transaction'](function(_0x4154b4){return _0x362181[_0x7e8e('0x5f')](_0x5d944b['query'][_0x7e8e('0x60')],{'transaction':_0x4154b4})[_0x7e8e('0x17')](function(){if(!_['isEmpty'](_0x20bc4e)){return _0x362181[_0x7e8e('0x72')](_0x20bc4e,{'transaction':_0x4154b4});}})[_0x7e8e('0x17')](function(){_0x20bc4e['forEach'](function(_0x1828a3){socket[_0x7e8e('0x5e')](_0x7e8e('0x73'),{'UserId':_0x1828a3,'OpenchannelQueueId':_0x362181['id']});});});});});});})[_0x7e8e('0x17')](respondWithStatusCode(_0x4637b3,null))[_0x7e8e('0x26')](handleError(_0x4637b3,null));};exports[_0x7e8e('0x74')]=function(_0x4fab54,_0x3dd513){return db[_0x7e8e('0x1e')][_0x7e8e('0x32')]({'where':{'id':_0x4fab54[_0x7e8e('0x28')]['id']}})['then'](handleEntityNotFound(_0x3dd513,null))[_0x7e8e('0x17')](function(_0x1910ac){if(_0x1910ac){return _0x1910ac[_0x7e8e('0x74')](_0x4fab54['body'][_0x7e8e('0x60')],_[_0x7e8e('0x75')](_0x4fab54[_0x7e8e('0x34')],[_0x7e8e('0x60'),'id'])||{})[_0x7e8e('0x76')](function(_0x57e40f){for(var _0x191a1b=0x0;_0x191a1b<_0x4fab54[_0x7e8e('0x34')][_0x7e8e('0x60')][_0x7e8e('0x51')];_0x191a1b+=0x1){socket[_0x7e8e('0x5e')](_0x7e8e('0x77'),{'UserId':Number(_0x4fab54[_0x7e8e('0x34')]['ids'][_0x191a1b]),'OpenchannelQueueId':Number(_0x4fab54['params']['id'])});}return _0x57e40f;});}})[_0x7e8e('0x17')](respondWithResult(_0x3dd513,null))[_0x7e8e('0x26')](handleError(_0x3dd513,null));};exports[_0x7e8e('0x72')]=function(_0x4d7413,_0x43e625){return db[_0x7e8e('0x1e')][_0x7e8e('0x32')]({'where':{'id':_0x4d7413[_0x7e8e('0x28')]['id']}})['then'](handleEntityNotFound(_0x43e625,null))[_0x7e8e('0x17')](function(_0x4a9bc7){if(_0x4a9bc7){return _0x4a9bc7[_0x7e8e('0x72')](_0x4d7413['query'][_0x7e8e('0x60')])[_0x7e8e('0x17')](function(){if(_[_0x7e8e('0x78')](_0x4d7413['query']['ids'])){for(var _0x3a537e=0x0;_0x3a537e<_0x4d7413[_0x7e8e('0x24')][_0x7e8e('0x60')][_0x7e8e('0x51')];_0x3a537e+=0x1){socket[_0x7e8e('0x5e')](_0x7e8e('0x73'),{'UserId':Number(_0x4d7413[_0x7e8e('0x24')]['ids'][_0x3a537e]),'OpenchannelQueueId':Number(_0x4d7413[_0x7e8e('0x28')]['id'])});}}else{socket[_0x7e8e('0x5e')](_0x7e8e('0x73'),{'UserId':Number(_0x4d7413[_0x7e8e('0x24')]['ids']),'OpenchannelQueueId':Number(_0x4d7413[_0x7e8e('0x28')]['id'])});}});}})[_0x7e8e('0x17')](respondWithStatusCode(_0x43e625,null))[_0x7e8e('0x26')](handleError(_0x43e625,null));};exports[_0x7e8e('0x79')]=function(_0x4cf545,_0x55bc40){var _0x526033={};var _0x2a61f9={};var _0x5598f3;var _0x154b27;return db[_0x7e8e('0x1e')][_0x7e8e('0x4f')]({'where':{'id':_0x4cf545[_0x7e8e('0x28')]['id']}})['then'](handleEntityNotFound(_0x55bc40,null))[_0x7e8e('0x17')](function(_0x6a0277){if(_0x6a0277){_0x5598f3=_0x6a0277;_0x2a61f9[_0x7e8e('0x29')]=_[_0x7e8e('0x2a')](db[_0x7e8e('0x55')][_0x7e8e('0x1f')]);_0x2a61f9[_0x7e8e('0x24')]=_[_0x7e8e('0x2a')](_0x4cf545[_0x7e8e('0x24')]);_0x2a61f9[_0x7e8e('0x2b')]=_['intersection'](_0x2a61f9[_0x7e8e('0x29')],_0x2a61f9[_0x7e8e('0x24')]);_0x526033['attributes']=_[_0x7e8e('0x2c')](_0x2a61f9[_0x7e8e('0x29')],qs[_0x7e8e('0x2e')](_0x4cf545['query'][_0x7e8e('0x2e')]));_0x526033['attributes']=_0x526033['attributes']['length']?_0x526033['attributes']:_0x2a61f9['model'];_0x526033[_0x7e8e('0x42')]=qs[_0x7e8e('0x43')](_0x4cf545[_0x7e8e('0x24')]['sort']);_0x526033[_0x7e8e('0x22')]=qs[_0x7e8e('0x2b')](_[_0x7e8e('0x44')](_0x4cf545['query'],_0x2a61f9[_0x7e8e('0x2b')]));if(_0x4cf545[_0x7e8e('0x24')][_0x7e8e('0x46')]){_0x526033[_0x7e8e('0x22')]=_[_0x7e8e('0x30')](_0x526033['where'],{'$or':_[_0x7e8e('0x47')](_0x526033[_0x7e8e('0x2d')],function(_0x2d21ec){var _0x53886f={};_0x53886f[_0x2d21ec]={'$like':'%'+_0x4cf545['query'][_0x7e8e('0x46')]+'%'};return _0x53886f;})});}_0x526033=_[_0x7e8e('0x30')]({},_0x526033,_0x4cf545[_0x7e8e('0x31')]);return _0x5598f3[_0x7e8e('0x79')](_0x526033);}})[_0x7e8e('0x17')](function(_0x315999){if(_0x315999){_0x154b27=_0x315999[_0x7e8e('0x51')];if(!_0x4cf545[_0x7e8e('0x24')][_0x7e8e('0x52')](_0x7e8e('0x41'))){_0x526033['limit']=qs[_0x7e8e('0x11')](_0x4cf545[_0x7e8e('0x24')]['limit']);_0x526033[_0x7e8e('0x13')]=qs[_0x7e8e('0x13')](_0x4cf545['query']['offset']);}return _0x5598f3[_0x7e8e('0x79')](_0x526033);}})[_0x7e8e('0x17')](function(_0x33ba48){if(_0x33ba48){return _0x33ba48?{'count':_0x154b27,'rows':_0x33ba48}:null;}})[_0x7e8e('0x17')](respondWithResult(_0x55bc40,null))['catch'](handleError(_0x55bc40,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 245b06d..421add5 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 _0xd700=['save','update','remove','emit','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0xdac678,_0x5d1714){var _0x92c2fe=function(_0x1108c5){while(--_0x1108c5){_0xdac678['push'](_0xdac678['shift']());}};_0x92c2fe(++_0x5d1714);}(_0xd700,0x164));var _0x0d70=function(_0x8ec947,_0x444fa2){_0x8ec947=_0x8ec947-0x0;var _0x115d2b=_0xd700[_0x8ec947];return _0x115d2b;};'use strict';var EventEmitter=require(_0x0d70('0x0'));var OpenchannelQueue=require(_0x0d70('0x1'))['db'][_0x0d70('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0d70('0x3')](0x0);var events={'afterCreate':_0x0d70('0x4'),'afterUpdate':_0x0d70('0x5'),'afterDestroy':_0x0d70('0x6')};function emitEvent(_0x3a0754){return function(_0x4116b9,_0x47f7af,_0x59f41f){OpenchannelQueueEvents['emit'](_0x3a0754+':'+_0x4116b9['id'],_0x4116b9);OpenchannelQueueEvents[_0x0d70('0x7')](_0x3a0754,_0x4116b9);_0x59f41f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x0d70('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x35d3=['hook','exports','events','OpenchannelQueue','save','update','emit','hasOwnProperty'];(function(_0x440b46,_0x4aa409){var _0x11341a=function(_0xaf4c77){while(--_0xaf4c77){_0x440b46['push'](_0x440b46['shift']());}};_0x11341a(++_0x4aa409);}(_0x35d3,0x102));var _0x335d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x35d3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x335d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x335d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x335d('0x2'),'afterUpdate':_0x335d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5b957d){return function(_0x3b2df9,_0x3fbae3,_0x49c24f){OpenchannelQueueEvents[_0x335d('0x4')](_0x5b957d+':'+_0x3b2df9['id'],_0x3b2df9);OpenchannelQueueEvents['emit'](_0x5b957d,_0x3b2df9);_0x49c24f(null);};}for(var e in events){if(events[_0x335d('0x5')](e)){var event=events[e];OpenchannelQueue[_0x335d('0x6')](e,emitEvent(event));}}module[_0x335d('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 36232c0..fd4a3c7 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 _0xf7da=['OpenchannelQueue','lodash','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3b2b54,_0x2c38b7){var _0x16df50=function(_0x49d598){while(--_0x49d598){_0x3b2b54['push'](_0x3b2b54['shift']());}};_0x16df50(++_0x2c38b7);}(_0xf7da,0x1c3));var _0xaf7d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf7da[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xaf7d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaf7d('0x1'));var moment=require(_0xaf7d('0x2'));var BPromise=require('bluebird');var rp=require(_0xaf7d('0x3'));var fs=require('fs');var path=require(_0xaf7d('0x4'));var rimraf=require(_0xaf7d('0x5'));var config=require(_0xaf7d('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0xaf7d('0x7')]=function(_0x77f8e2,_0x42d012){return _0x77f8e2[_0xaf7d('0x8')](_0xaf7d('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc86e=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','openchannel_queues'];(function(_0x276e4c,_0xc308d8){var _0x38ac7a=function(_0x2a8994){while(--_0x2a8994){_0x276e4c['push'](_0x276e4c['shift']());}};_0x38ac7a(++_0xc308d8);}(_0xc86e,0xf2));var _0xec86=function(_0x20262f,_0x1df6b8){_0x20262f=_0x20262f-0x0;var _0x2eb441=_0xc86e[_0x20262f];return _0x2eb441;};'use strict';var _=require(_0xec86('0x0'));var util=require(_0xec86('0x1'));var logger=require(_0xec86('0x2'))(_0xec86('0x3'));var moment=require(_0xec86('0x4'));var BPromise=require('bluebird');var rp=require(_0xec86('0x5'));var fs=require('fs');var path=require(_0xec86('0x6'));var rimraf=require('rimraf');var config=require(_0xec86('0x7'));var attributes=require(_0xec86('0x8'));module['exports']=function(_0x34358a,_0x49ce42){return _0x34358a['define'](_0xec86('0x9'),attributes,{'tableName':_0xec86('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 1c94239..f71a8ef 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 _0xbd60=['model','then','catch','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x58bf55,_0x1e0a77){var _0x3be445=function(_0x103bfc){while(--_0x103bfc){_0x58bf55['push'](_0x58bf55['shift']());}};_0x3be445(++_0x1e0a77);}(_0xbd60,0x180));var _0x0bd6=function(_0x179314,_0x32d3a2){_0x179314=_0x179314-0x0;var _0x3556f7=_0xbd60[_0x179314];return _0x3556f7;};'use strict';var _=require(_0x0bd6('0x0'));var util=require('util');var moment=require(_0x0bd6('0x1'));var BPromise=require(_0x0bd6('0x2'));var rs=require(_0x0bd6('0x3'));var fs=require('fs');var Redis=require(_0x0bd6('0x4'));var db=require(_0x0bd6('0x5'))['db'];var utils=require(_0x0bd6('0x6'));var logger=require('../../config/logger')(_0x0bd6('0x7'));var config=require(_0x0bd6('0x8'));var jayson=require(_0x0bd6('0x9'));var client=jayson[_0x0bd6('0xa')][_0x0bd6('0xb')]({'port':0x232a});config[_0x0bd6('0xc')]=_[_0x0bd6('0xd')](config[_0x0bd6('0xc')],{'host':_0x0bd6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0bd6('0xf'))[_0x0bd6('0x10')](socket);function respondWithRpcPromise(_0x50c74e,_0x4474ad,_0x5aac9e){return new BPromise(function(_0x5041d5,_0x10c235){return client[_0x0bd6('0x11')](_0x50c74e,_0x5aac9e)['then'](function(_0x2dc988){logger[_0x0bd6('0x12')](_0x0bd6('0x13'),_0x4474ad,_0x0bd6('0x14'));logger[_0x0bd6('0x15')](_0x0bd6('0x16'),_0x4474ad,_0x0bd6('0x14'),JSON[_0x0bd6('0x17')](_0x2dc988));if(_0x2dc988['error']){if(_0x2dc988[_0x0bd6('0x18')]['code']===0x1f4){logger[_0x0bd6('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x4474ad,_0x2dc988[_0x0bd6('0x18')][_0x0bd6('0x19')]);return _0x10c235(_0x2dc988['error']['message']);}logger['error'](_0x0bd6('0x13'),_0x4474ad,_0x2dc988[_0x0bd6('0x18')][_0x0bd6('0x19')]);return _0x5041d5(_0x2dc988[_0x0bd6('0x18')][_0x0bd6('0x19')]);}else{logger[_0x0bd6('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x4474ad,'request\x20sent');_0x5041d5(_0x2dc988[_0x0bd6('0x1a')]['message']);}})['catch'](function(_0x1795dd){logger[_0x0bd6('0x18')](_0x0bd6('0x13'),_0x4474ad,_0x1795dd);_0x10c235(_0x1795dd);});});}exports[_0x0bd6('0x1b')]=function(_0x12313b){var _0x389d9c=this;return new Promise(function(_0x505540,_0x547841){return db['OpenchannelQueue'][_0x0bd6('0x1c')]({'raw':_0x12313b[_0x0bd6('0x1d')]?_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x1e')]===undefined?!![]:![]:!![],'where':_0x12313b[_0x0bd6('0x1d')]?_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x1f')]||null:null,'attributes':_0x12313b['options']?_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x20')]||null:null,'limit':_0x12313b[_0x0bd6('0x1d')]?_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x21')]||null:null,'include':_0x12313b[_0x0bd6('0x1d')]?_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x22')]?_[_0x0bd6('0x23')](_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x22')],function(_0x20e3a7){return{'model':db[_0x20e3a7[_0x0bd6('0x24')]],'as':_0x20e3a7['as'],'attributes':_0x20e3a7[_0x0bd6('0x20')],'include':_0x20e3a7[_0x0bd6('0x22')]?_['map'](_0x20e3a7[_0x0bd6('0x22')],function(_0x2c37d4){return{'model':db[_0x2c37d4[_0x0bd6('0x24')]],'as':_0x2c37d4['as'],'attributes':_0x2c37d4[_0x0bd6('0x20')],'include':_0x2c37d4[_0x0bd6('0x22')]?_[_0x0bd6('0x23')](_0x2c37d4[_0x0bd6('0x22')],function(_0x1e493b){return{'model':db[_0x1e493b[_0x0bd6('0x24')]],'as':_0x1e493b['as'],'attributes':_0x1e493b[_0x0bd6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0bd6('0x25')](function(_0x151613){logger[_0x0bd6('0x12')](_0x0bd6('0x1b'),_0x12313b);logger['debug'](_0x0bd6('0x1b'),_0x12313b,JSON[_0x0bd6('0x17')](_0x151613));_0x505540(_0x151613);})[_0x0bd6('0x26')](function(_0x4607e3){logger['error']('GetOpenchannelQueue',_0x4607e3[_0x0bd6('0x19')],_0x12313b);_0x547841(_0x389d9c[_0x0bd6('0x18')](0x1f4,_0x4607e3[_0x0bd6('0x19')]));});});};exports[_0x0bd6('0x27')]=function(_0x31066c){var _0x201a82=this;return new Promise(function(_0x5f9bf,_0x263a57){return db[_0x0bd6('0x28')][_0x0bd6('0x29')]({'raw':_0x31066c[_0x0bd6('0x1d')]?_0x31066c[_0x0bd6('0x1d')][_0x0bd6('0x1e')]===undefined?!![]:![]:!![],'where':_0x31066c['options']?_0x31066c[_0x0bd6('0x1d')][_0x0bd6('0x1f')]||null:null,'attributes':_0x31066c['options']?_0x31066c[_0x0bd6('0x1d')][_0x0bd6('0x20')]||null:null,'include':_0x31066c[_0x0bd6('0x1d')]?_0x31066c[_0x0bd6('0x1d')][_0x0bd6('0x22')]?_['map'](_0x31066c[_0x0bd6('0x1d')][_0x0bd6('0x22')],function(_0x553273){return{'model':db[_0x553273['model']],'as':_0x553273['as'],'attributes':_0x553273['attributes'],'include':_0x553273['include']?_[_0x0bd6('0x23')](_0x553273['include'],function(_0x2e6c5f){return{'model':db[_0x2e6c5f[_0x0bd6('0x24')]],'as':_0x2e6c5f['as'],'attributes':_0x2e6c5f[_0x0bd6('0x20')],'include':_0x2e6c5f[_0x0bd6('0x22')]?_[_0x0bd6('0x23')](_0x2e6c5f[_0x0bd6('0x22')],function(_0x39d5f4){return{'model':db[_0x39d5f4[_0x0bd6('0x24')]],'as':_0x39d5f4['as'],'attributes':_0x39d5f4[_0x0bd6('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x263436){logger[_0x0bd6('0x12')](_0x0bd6('0x27'),_0x31066c);logger['debug'](_0x0bd6('0x27'),_0x31066c,JSON[_0x0bd6('0x17')](_0x263436));_0x5f9bf(_0x263436);})['catch'](function(_0x39330c){logger[_0x0bd6('0x18')](_0x0bd6('0x27'),_0x39330c[_0x0bd6('0x19')],_0x31066c);_0x263a57(_0x201a82[_0x0bd6('0x18')](0x1f4,_0x39330c[_0x0bd6('0x19')]));});});}; \ No newline at end of file +var _0x5ef1=['stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','attributes','limit','include','map','model','ShowOpenchannelQueue','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1e48b3,_0x3150bc){var _0x295fae=function(_0x58b33a){while(--_0x58b33a){_0x1e48b3['push'](_0x1e48b3['shift']());}};_0x295fae(++_0x3150bc);}(_0x5ef1,0x170));var _0x15ef=function(_0x1850e2,_0x7dab61){_0x1850e2=_0x1850e2-0x0;var _0x1f5de4=_0x5ef1[_0x1850e2];return _0x1f5de4;};'use strict';var _=require('lodash');var util=require(_0x15ef('0x0'));var moment=require(_0x15ef('0x1'));var BPromise=require(_0x15ef('0x2'));var rs=require(_0x15ef('0x3'));var fs=require('fs');var Redis=require(_0x15ef('0x4'));var db=require(_0x15ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15ef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x15ef('0x7'));var client=jayson[_0x15ef('0x8')][_0x15ef('0x9')]({'port':0x232a});config[_0x15ef('0xa')]=_[_0x15ef('0xb')](config['redis'],{'host':_0x15ef('0xc'),'port':0x18eb});var socket=require(_0x15ef('0xd'))(new Redis(config['redis']));require(_0x15ef('0xe'))['register'](socket);function respondWithRpcPromise(_0x3dcff3,_0x397282,_0x2c9e79){return new BPromise(function(_0x3485eb,_0x51be6b){return client[_0x15ef('0xf')](_0x3dcff3,_0x2c9e79)[_0x15ef('0x10')](function(_0x4c9369){logger[_0x15ef('0x11')](_0x15ef('0x12'),_0x397282,_0x15ef('0x13'));logger[_0x15ef('0x14')](_0x15ef('0x15'),_0x397282,_0x15ef('0x13'),JSON[_0x15ef('0x16')](_0x4c9369));if(_0x4c9369[_0x15ef('0x17')]){if(_0x4c9369[_0x15ef('0x17')][_0x15ef('0x18')]===0x1f4){logger[_0x15ef('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x397282,_0x4c9369['error'][_0x15ef('0x19')]);return _0x51be6b(_0x4c9369['error']['message']);}logger[_0x15ef('0x17')](_0x15ef('0x12'),_0x397282,_0x4c9369[_0x15ef('0x17')]['message']);return _0x3485eb(_0x4c9369[_0x15ef('0x17')][_0x15ef('0x19')]);}else{logger[_0x15ef('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x397282,_0x15ef('0x13'));_0x3485eb(_0x4c9369[_0x15ef('0x1a')][_0x15ef('0x19')]);}})[_0x15ef('0x1b')](function(_0x26263a){logger[_0x15ef('0x17')](_0x15ef('0x12'),_0x397282,_0x26263a);_0x51be6b(_0x26263a);});});}exports[_0x15ef('0x1c')]=function(_0x11b129){var _0x3c4a73=this;return new Promise(function(_0x3ce014,_0x327b95){return db[_0x15ef('0x1d')]['findAll']({'raw':_0x11b129[_0x15ef('0x1e')]?_0x11b129[_0x15ef('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x11b129[_0x15ef('0x1e')]?_0x11b129['options']['where']||null:null,'attributes':_0x11b129[_0x15ef('0x1e')]?_0x11b129[_0x15ef('0x1e')][_0x15ef('0x1f')]||null:null,'limit':_0x11b129[_0x15ef('0x1e')]?_0x11b129['options'][_0x15ef('0x20')]||null:null,'include':_0x11b129[_0x15ef('0x1e')]?_0x11b129[_0x15ef('0x1e')][_0x15ef('0x21')]?_[_0x15ef('0x22')](_0x11b129[_0x15ef('0x1e')][_0x15ef('0x21')],function(_0x2f4d7b){return{'model':db[_0x2f4d7b[_0x15ef('0x23')]],'as':_0x2f4d7b['as'],'attributes':_0x2f4d7b[_0x15ef('0x1f')],'include':_0x2f4d7b[_0x15ef('0x21')]?_[_0x15ef('0x22')](_0x2f4d7b[_0x15ef('0x21')],function(_0x1566ae){return{'model':db[_0x1566ae[_0x15ef('0x23')]],'as':_0x1566ae['as'],'attributes':_0x1566ae[_0x15ef('0x1f')],'include':_0x1566ae[_0x15ef('0x21')]?_[_0x15ef('0x22')](_0x1566ae[_0x15ef('0x21')],function(_0x492e34){return{'model':db[_0x492e34['model']],'as':_0x492e34['as'],'attributes':_0x492e34[_0x15ef('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x15ef('0x10')](function(_0x55e2b2){logger['info']('GetOpenchannelQueue',_0x11b129);logger['debug']('GetOpenchannelQueue',_0x11b129,JSON[_0x15ef('0x16')](_0x55e2b2));_0x3ce014(_0x55e2b2);})[_0x15ef('0x1b')](function(_0x2fd1ef){logger[_0x15ef('0x17')](_0x15ef('0x1c'),_0x2fd1ef[_0x15ef('0x19')],_0x11b129);_0x327b95(_0x3c4a73[_0x15ef('0x17')](0x1f4,_0x2fd1ef[_0x15ef('0x19')]));});});};exports[_0x15ef('0x24')]=function(_0x120362){var _0xd9943c=this;return new Promise(function(_0x474acd,_0x66f75d){return db[_0x15ef('0x1d')][_0x15ef('0x25')]({'raw':_0x120362[_0x15ef('0x1e')]?_0x120362['options']['raw']===undefined?!![]:![]:!![],'where':_0x120362[_0x15ef('0x1e')]?_0x120362[_0x15ef('0x1e')][_0x15ef('0x26')]||null:null,'attributes':_0x120362['options']?_0x120362[_0x15ef('0x1e')][_0x15ef('0x1f')]||null:null,'include':_0x120362[_0x15ef('0x1e')]?_0x120362['options']['include']?_[_0x15ef('0x22')](_0x120362['options']['include'],function(_0x4a126b){return{'model':db[_0x4a126b[_0x15ef('0x23')]],'as':_0x4a126b['as'],'attributes':_0x4a126b['attributes'],'include':_0x4a126b['include']?_[_0x15ef('0x22')](_0x4a126b['include'],function(_0x3156c9){return{'model':db[_0x3156c9[_0x15ef('0x23')]],'as':_0x3156c9['as'],'attributes':_0x3156c9[_0x15ef('0x1f')],'include':_0x3156c9[_0x15ef('0x21')]?_[_0x15ef('0x22')](_0x3156c9[_0x15ef('0x21')],function(_0x14568b){return{'model':db[_0x14568b[_0x15ef('0x23')]],'as':_0x14568b['as'],'attributes':_0x14568b[_0x15ef('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x15ef('0x10')](function(_0x4ee693){logger[_0x15ef('0x11')](_0x15ef('0x24'),_0x120362);logger[_0x15ef('0x14')](_0x15ef('0x24'),_0x120362,JSON[_0x15ef('0x16')](_0x4ee693));_0x474acd(_0x4ee693);})[_0x15ef('0x1b')](function(_0x1e8bc9){logger[_0x15ef('0x17')]('ShowOpenchannelQueue',_0x1e8bc9[_0x15ef('0x19')],_0x120362);_0x66f75d(_0xd9943c[_0x15ef('0x17')](0x1f4,_0x1e8bc9[_0x15ef('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index cd04863..4be3122 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 _0x6189=['update','register','length','openchannelQueue:','save','remove'];(function(_0x5acfba,_0x47e7e3){var _0x958004=function(_0x17e079){while(--_0x17e079){_0x5acfba['push'](_0x5acfba['shift']());}};_0x958004(++_0x47e7e3);}(_0x6189,0x148));var _0x9618=function(_0x446ea3,_0x581dc1){_0x446ea3=_0x446ea3-0x0;var _0x5e4a90=_0x6189[_0x446ea3];return _0x5e4a90;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x9618('0x0'),_0x9618('0x1'),_0x9618('0x2')];function createListener(_0x46b1fa,_0x136a9a){return function(_0x49c16e){_0x136a9a['emit'](_0x46b1fa,_0x49c16e);};}function removeListener(_0x264a06,_0x34ad87){return function(){OpenchannelQueueEvents['removeListener'](_0x264a06,_0x34ad87);};}exports[_0x9618('0x3')]=function(_0x3c2bd9){for(var _0x2ea715=0x0,_0x14810d=events[_0x9618('0x4')];_0x2ea715<_0x14810d;_0x2ea715++){var _0x38e062=events[_0x2ea715];var _0xbd1787=createListener(_0x9618('0x5')+_0x38e062,_0x3c2bd9);OpenchannelQueueEvents['on'](_0x38e062,_0xbd1787);}}; \ No newline at end of file +var _0x904d=['./openchannelQueue.events','save','remove','update','emit','removeListener','register','openchannelQueue:'];(function(_0x166d5f,_0x46a683){var _0x3c471a=function(_0x51a1d4){while(--_0x51a1d4){_0x166d5f['push'](_0x166d5f['shift']());}};_0x3c471a(++_0x46a683);}(_0x904d,0x110));var _0xd904=function(_0x1db863,_0x8f181d){_0x1db863=_0x1db863-0x0;var _0x18b578=_0x904d[_0x1db863];return _0x18b578;};'use strict';var OpenchannelQueueEvents=require(_0xd904('0x0'));var events=[_0xd904('0x1'),_0xd904('0x2'),_0xd904('0x3')];function createListener(_0x27b15c,_0x2d2bba){return function(_0x55475f){_0x2d2bba[_0xd904('0x4')](_0x27b15c,_0x55475f);};}function removeListener(_0x1efa0e,_0x10ee33){return function(){OpenchannelQueueEvents[_0xd904('0x5')](_0x1efa0e,_0x10ee33);};}exports[_0xd904('0x6')]=function(_0x3f5260){for(var _0x212b58=0x0,_0x5110ef=events['length'];_0x212b58<_0x5110ef;_0x212b58++){var _0x53ddf2=events[_0x212b58];var _0x2fc34e=createListener(_0xd904('0x7')+_0x53ddf2,_0x3f5260);OpenchannelQueueEvents['on'](_0x53ddf2,_0x2fc34e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 69a966b..ffe42ec 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 _0xcdfd=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x435cc5,_0x3f4545){var _0xfff27=function(_0x37eb70){while(--_0x37eb70){_0x435cc5['push'](_0x435cc5['shift']());}};_0xfff27(++_0x3f4545);}(_0xcdfd,0x141));var _0xdcdf=function(_0x3dfc6a,_0x3f5c71){_0x3dfc6a=_0x3dfc6a-0x0;var _0x1872ba=_0xcdfd[_0x3dfc6a];return _0x1872ba;};'use strict';var multer=require(_0xdcdf('0x0'));var util=require(_0xdcdf('0x1'));var path=require(_0xdcdf('0x2'));var timeout=require(_0xdcdf('0x3'));var express=require(_0xdcdf('0x4'));var router=express[_0xdcdf('0x5')]();var fs_extra=require(_0xdcdf('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdcdf('0x7'));var config=require(_0xdcdf('0x8'));var controller=require(_0xdcdf('0x9'));router['get']('/',auth[_0xdcdf('0xa')](),controller[_0xdcdf('0xb')]);router[_0xdcdf('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xdcdf('0xd')]);router['get'](_0xdcdf('0xe'),auth[_0xdcdf('0xa')](),controller[_0xdcdf('0xf')]);router[_0xdcdf('0x10')]('/',auth[_0xdcdf('0xa')](),controller[_0xdcdf('0x11')]);router[_0xdcdf('0x12')](_0xdcdf('0xe'),auth[_0xdcdf('0xa')](),controller[_0xdcdf('0x13')]);router[_0xdcdf('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xdcdf('0x15')]);module[_0xdcdf('0x16')]=router; \ No newline at end of file +var _0x0e31=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete'];(function(_0xe89d97,_0x33e5ac){var _0x1b6e5d=function(_0x5618cb){while(--_0x5618cb){_0xe89d97['push'](_0xe89d97['shift']());}};_0x1b6e5d(++_0x33e5ac);}(_0x0e31,0x154));var _0x10e3=function(_0x59ef3d,_0x5c7aee){_0x59ef3d=_0x59ef3d-0x0;var _0x585558=_0x0e31[_0x59ef3d];return _0x585558;};'use strict';var multer=require('multer');var util=require(_0x10e3('0x0'));var path=require(_0x10e3('0x1'));var timeout=require(_0x10e3('0x2'));var express=require(_0x10e3('0x3'));var router=express[_0x10e3('0x4')]();var fs_extra=require(_0x10e3('0x5'));var auth=require(_0x10e3('0x6'));var interaction=require(_0x10e3('0x7'));var config=require(_0x10e3('0x8'));var controller=require(_0x10e3('0x9'));router[_0x10e3('0xa')]('/',auth[_0x10e3('0xb')](),controller[_0x10e3('0xc')]);router[_0x10e3('0xa')]('/describe',auth[_0x10e3('0xb')](),controller[_0x10e3('0xd')]);router['get'](_0x10e3('0xe'),auth[_0x10e3('0xb')](),controller['show']);router[_0x10e3('0xf')]('/',auth[_0x10e3('0xb')](),controller[_0x10e3('0x10')]);router[_0x10e3('0x11')](_0x10e3('0xe'),auth['isAuthenticated'](),controller[_0x10e3('0x12')]);router[_0x10e3('0x13')](_0x10e3('0xe'),auth['isAuthenticated'](),controller['destroy']);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 881fb43..9c9fb9d 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 _0xc432=['STRING','DATE','moment'];(function(_0xdffc9a,_0x8779fb){var _0x591a69=function(_0x53ad9b){while(--_0x53ad9b){_0xdffc9a['push'](_0xdffc9a['shift']());}};_0x591a69(++_0x8779fb);}(_0xc432,0xb0));var _0x2c43=function(_0xbfca8e,_0x5d2d79){_0xbfca8e=_0xbfca8e-0x0;var _0x3eb4dd=_0xc432[_0xbfca8e];return _0x3eb4dd;};'use strict';var moment=require(_0x2c43('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2c43('0x1')]},'joinAt':{'type':Sequelize[_0x2c43('0x2')]},'leaveAt':{'type':Sequelize[_0x2c43('0x2')]},'acceptAt':{'type':Sequelize[_0x2c43('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x2c43('0x1')]}}; \ No newline at end of file +var _0xb605=['STRING','DATE','moment','sequelize','exports'];(function(_0x46625b,_0x4584d3){var _0x135e5a=function(_0x215b30){while(--_0x215b30){_0x46625b['push'](_0x46625b['shift']());}};_0x135e5a(++_0x4584d3);}(_0xb605,0x160));var _0x5b60=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0xb605[_0x3acee8];return _0x5046cc;};'use strict';var moment=require(_0x5b60('0x0'));var Sequelize=require(_0x5b60('0x1'));module[_0x5b60('0x2')]={'uniqueid':{'type':Sequelize[_0x5b60('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5b60('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5b60('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index d70ba29..0eae3a9 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 _0x42d5=['sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','eml-format','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x447249,_0x50f9bf){var _0x2a77b2=function(_0x1f4779){while(--_0x1f4779){_0x447249['push'](_0x447249['shift']());}};_0x2a77b2(++_0x50f9bf);}(_0x42d5,0x1c7));var _0x542d=function(_0xd6674a,_0x2638d0){_0xd6674a=_0xd6674a-0x0;var _0x267304=_0x42d5[_0xd6674a];return _0x267304;};'use strict';var emlformat=require(_0x542d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x542d('0x1'));var BPromise=require(_0x542d('0x2'));var Mustache=require(_0x542d('0x3'));var util=require('util');var path=require(_0x542d('0x4'));var sox=require(_0x542d('0x5'));var csv=require('to-csv');var ejs=require(_0x542d('0x6'));var fs=require('fs');var fs_extra=require(_0x542d('0x7'));var _=require(_0x542d('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x542d('0x9'));var deskjs=require(_0x542d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x542d('0xb'));var Papa=require('papaparse');var Redis=require(_0x542d('0xc'));var authService=require(_0x542d('0xd'));var qs=require(_0x542d('0xe'));var as=require(_0x542d('0xf'));var hardwareService=require(_0x542d('0x10'));var logger=require(_0x542d('0x11'))(_0x542d('0x12'));var utils=require('../../config/utils');var config=require(_0x542d('0x13'));var licenseUtil=require(_0x542d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ffd05,_0x229719){_0x229719=_0x229719||0xcc;return function(_0x3e5171){if(_0x3e5171){return _0x1ffd05[_0x542d('0x15')](_0x229719);}return _0x1ffd05[_0x542d('0x16')](_0x229719)[_0x542d('0x17')]();};}function respondWithResult(_0x9e5e64,_0x1ce19b){_0x1ce19b=_0x1ce19b||0xc8;return function(_0x791952){if(_0x791952){return _0x9e5e64['status'](_0x1ce19b)['json'](_0x791952);}};}function respondWithFilteredResult(_0x5cf3e5,_0xdd1a66){return function(_0x5c0302){if(_0x5c0302){var _0xb7f12f=typeof _0xdd1a66['offset']===_0x542d('0x18')&&typeof _0xdd1a66[_0x542d('0x19')]==='undefined';var _0x4ee5cd=_0x5c0302[_0x542d('0x1a')];var _0x152dc3=_0xb7f12f?0x0:_0xdd1a66[_0x542d('0x1b')];var _0x1cc5dd=_0xb7f12f?_0x5c0302[_0x542d('0x1a')]:_0xdd1a66['offset']+_0xdd1a66[_0x542d('0x19')];var _0x19b18a;if(_0x1cc5dd>=_0x4ee5cd){_0x1cc5dd=_0x4ee5cd;_0x19b18a=0xc8;}else{_0x19b18a=0xce;}_0x5cf3e5[_0x542d('0x16')](_0x19b18a);return _0x5cf3e5[_0x542d('0x1c')](_0x542d('0x1d'),_0x152dc3+'-'+_0x1cc5dd+'/'+_0x4ee5cd)[_0x542d('0x1e')](_0x5c0302);}return null;};}function patchUpdates(_0xd22d56){return function(_0x429167){try{jsonpatch[_0x542d('0x1f')](_0x429167,_0xd22d56,!![]);}catch(_0x2bc55f){return BPromise[_0x542d('0x20')](_0x2bc55f);}return _0x429167[_0x542d('0x21')]();};}function saveUpdates(_0x4f5c1e,_0xc146d1){return function(_0x1fc78f){if(_0x1fc78f){return _0x1fc78f[_0x542d('0x22')](_0x4f5c1e)['then'](function(_0x215d0d){return _0x215d0d;});}return null;};}function removeEntity(_0x411e72,_0x4f9b0a){return function(_0x3ba86a){if(_0x3ba86a){return _0x3ba86a[_0x542d('0x23')]()[_0x542d('0x24')](function(){_0x411e72[_0x542d('0x16')](0xcc)[_0x542d('0x17')]();});}};}function handleEntityNotFound(_0x314aae,_0x76c4b5){return function(_0x7fb998){if(!_0x7fb998){_0x314aae[_0x542d('0x15')](0x194);}return _0x7fb998;};}function handleError(_0x2449b6,_0x3dee49){_0x3dee49=_0x3dee49||0x1f4;return function(_0x2e7ef7){logger['error'](_0x2e7ef7[_0x542d('0x25')]);if(_0x2e7ef7[_0x542d('0x26')]){delete _0x2e7ef7[_0x542d('0x26')];}_0x2449b6[_0x542d('0x16')](_0x3dee49)[_0x542d('0x27')](_0x2e7ef7);};}exports[_0x542d('0x28')]=function(_0x272e1d,_0x29645b){var _0x327c78={},_0x232103={},_0x15fedd={'count':0x0,'rows':[]};var _0x479b84=_['map'](db[_0x542d('0x29')][_0x542d('0x2a')],function(_0x56f6f3){return{'name':_0x56f6f3[_0x542d('0x2b')],'type':_0x56f6f3[_0x542d('0x2c')][_0x542d('0x2d')]};});_0x232103[_0x542d('0x2e')]=_[_0x542d('0x2f')](_0x479b84,'name');_0x232103[_0x542d('0x30')]=_[_0x542d('0x31')](_0x272e1d[_0x542d('0x30')]);_0x232103['filters']=_[_0x542d('0x32')](_0x232103[_0x542d('0x2e')],_0x232103[_0x542d('0x30')]);_0x327c78[_0x542d('0x33')]=_[_0x542d('0x32')](_0x232103['model'],qs['fields'](_0x272e1d[_0x542d('0x30')][_0x542d('0x34')]));_0x327c78['attributes']=_0x327c78[_0x542d('0x33')][_0x542d('0x35')]?_0x327c78['attributes']:_0x232103[_0x542d('0x2e')];if(!_0x272e1d[_0x542d('0x30')][_0x542d('0x36')]('nolimit')){_0x327c78['limit']=qs[_0x542d('0x19')](_0x272e1d[_0x542d('0x30')][_0x542d('0x19')]);_0x327c78[_0x542d('0x1b')]=qs[_0x542d('0x1b')](_0x272e1d[_0x542d('0x30')][_0x542d('0x1b')]);}_0x327c78[_0x542d('0x37')]=qs['sort'](_0x272e1d[_0x542d('0x30')][_0x542d('0x38')]);_0x327c78['where']=qs[_0x542d('0x39')](_[_0x542d('0x3a')](_0x272e1d[_0x542d('0x30')],_0x232103[_0x542d('0x39')]),_0x479b84);if(_0x272e1d[_0x542d('0x30')][_0x542d('0x3b')]){_0x327c78[_0x542d('0x3c')]=_[_0x542d('0x3d')](_0x327c78[_0x542d('0x3c')],{'$or':_['map'](_0x479b84,function(_0x134ef9){if(_0x134ef9['type']!==_0x542d('0x3e')){var _0x59bef1={};_0x59bef1[_0x134ef9[_0x542d('0x26')]]={'$like':'%'+_0x272e1d[_0x542d('0x30')][_0x542d('0x3b')]+'%'};return _0x59bef1;}})});}_0x327c78=_[_0x542d('0x3d')]({},_0x327c78,_0x272e1d[_0x542d('0x3f')]);var _0xcc9cbc={'where':_0x327c78[_0x542d('0x3c')]};return db[_0x542d('0x29')][_0x542d('0x1a')](_0xcc9cbc)[_0x542d('0x24')](function(_0x32a28f){_0x15fedd[_0x542d('0x1a')]=_0x32a28f;if(_0x272e1d[_0x542d('0x30')][_0x542d('0x40')]){_0x327c78[_0x542d('0x41')]=[{'all':!![]}];}return db[_0x542d('0x29')]['findAll'](_0x327c78);})[_0x542d('0x24')](function(_0x509ea7){_0x15fedd[_0x542d('0x42')]=_0x509ea7;return _0x15fedd;})[_0x542d('0x24')](respondWithFilteredResult(_0x29645b,_0x327c78))[_0x542d('0x43')](handleError(_0x29645b,null));};exports[_0x542d('0x44')]=function(_0x177d9f,_0x6d4eee){var _0x113e39={'raw':!![],'where':{'id':_0x177d9f['params']['id']}},_0x1c1271={};_0x1c1271[_0x542d('0x2e')]=_['keys'](db['OpenchannelQueueReport'][_0x542d('0x2a')]);_0x1c1271[_0x542d('0x30')]=_[_0x542d('0x31')](_0x177d9f['query']);_0x1c1271['filters']=_[_0x542d('0x32')](_0x1c1271['model'],_0x1c1271[_0x542d('0x30')]);_0x113e39[_0x542d('0x33')]=_[_0x542d('0x32')](_0x1c1271['model'],qs['fields'](_0x177d9f['query']['fields']));_0x113e39[_0x542d('0x33')]=_0x113e39[_0x542d('0x33')][_0x542d('0x35')]?_0x113e39[_0x542d('0x33')]:_0x1c1271[_0x542d('0x2e')];if(_0x177d9f[_0x542d('0x30')][_0x542d('0x40')]){_0x113e39['include']=[{'all':!![]}];}_0x113e39=_[_0x542d('0x3d')]({},_0x113e39,_0x177d9f[_0x542d('0x3f')]);return db[_0x542d('0x29')][_0x542d('0x45')](_0x113e39)[_0x542d('0x24')](handleEntityNotFound(_0x6d4eee,null))[_0x542d('0x24')](respondWithResult(_0x6d4eee,null))[_0x542d('0x43')](handleError(_0x6d4eee,null));};exports['create']=function(_0x418779,_0x419ffa){return db[_0x542d('0x29')][_0x542d('0x46')](_0x418779[_0x542d('0x47')],{})[_0x542d('0x24')](respondWithResult(_0x419ffa,0xc9))['catch'](handleError(_0x419ffa,null));};exports['update']=function(_0x5386ac,_0x495176){if(_0x5386ac[_0x542d('0x47')]['id']){delete _0x5386ac[_0x542d('0x47')]['id'];}return db['OpenchannelQueueReport'][_0x542d('0x45')]({'where':{'id':_0x5386ac['params']['id']}})['then'](handleEntityNotFound(_0x495176,null))[_0x542d('0x24')](saveUpdates(_0x5386ac[_0x542d('0x47')],null))[_0x542d('0x24')](respondWithResult(_0x495176,null))[_0x542d('0x43')](handleError(_0x495176,null));};exports[_0x542d('0x23')]=function(_0x454323,_0x18ab9a){return db[_0x542d('0x29')]['find']({'where':{'id':_0x454323[_0x542d('0x48')]['id']}})[_0x542d('0x24')](handleEntityNotFound(_0x18ab9a,null))[_0x542d('0x24')](removeEntity(_0x18ab9a,null))[_0x542d('0x43')](handleError(_0x18ab9a,null));};exports['describe']=function(_0x48cffe,_0x4c50d0){return db[_0x542d('0x29')]['describe']()[_0x542d('0x24')](respondWithResult(_0x4c50d0,null))[_0x542d('0x43')](handleError(_0x4c50d0,null));}; \ No newline at end of file +var _0x9ab8=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x27643f,_0x138edb){var _0x2327e7=function(_0x2a2ff3){while(--_0x2a2ff3){_0x27643f['push'](_0x27643f['shift']());}};_0x2327e7(++_0x138edb);}(_0x9ab8,0x138));var _0x89ab=function(_0x345efe,_0x4ac6c1){_0x345efe=_0x345efe-0x0;var _0x228358=_0x9ab8[_0x345efe];return _0x228358;};'use strict';var emlformat=require(_0x89ab('0x0'));var rimraf=require(_0x89ab('0x1'));var zipdir=require(_0x89ab('0x2'));var jsonpatch=require(_0x89ab('0x3'));var rp=require(_0x89ab('0x4'));var moment=require('moment');var BPromise=require(_0x89ab('0x5'));var Mustache=require(_0x89ab('0x6'));var util=require(_0x89ab('0x7'));var path=require(_0x89ab('0x8'));var sox=require(_0x89ab('0x9'));var csv=require(_0x89ab('0xa'));var ejs=require(_0x89ab('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x89ab('0xc'));var squel=require(_0x89ab('0xd'));var crypto=require(_0x89ab('0xe'));var jsforce=require(_0x89ab('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x89ab('0xa'));var querystring=require('querystring');var Papa=require(_0x89ab('0x10'));var Redis=require('ioredis');var authService=require(_0x89ab('0x11'));var qs=require(_0x89ab('0x12'));var as=require(_0x89ab('0x13'));var hardwareService=require(_0x89ab('0x14'));var logger=require(_0x89ab('0x15'))(_0x89ab('0x16'));var utils=require(_0x89ab('0x17'));var config=require(_0x89ab('0x18'));var licenseUtil=require(_0x89ab('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18c4b9,_0x160883){_0x160883=_0x160883||0xcc;return function(_0x5eb791){if(_0x5eb791){return _0x18c4b9[_0x89ab('0x1a')](_0x160883);}return _0x18c4b9['status'](_0x160883)[_0x89ab('0x1b')]();};}function respondWithResult(_0x1f3ecd,_0x2238ab){_0x2238ab=_0x2238ab||0xc8;return function(_0x2cdb78){if(_0x2cdb78){return _0x1f3ecd[_0x89ab('0x1c')](_0x2238ab)[_0x89ab('0x1d')](_0x2cdb78);}};}function respondWithFilteredResult(_0x29cbcb,_0x100654){return function(_0x74c88c){if(_0x74c88c){var _0x35fbef=typeof _0x100654[_0x89ab('0x1e')]===_0x89ab('0x1f')&&typeof _0x100654[_0x89ab('0x20')]==='undefined';var _0x2ecee0=_0x74c88c[_0x89ab('0x21')];var _0x22768d=_0x35fbef?0x0:_0x100654[_0x89ab('0x1e')];var _0x11a155=_0x35fbef?_0x74c88c[_0x89ab('0x21')]:_0x100654[_0x89ab('0x1e')]+_0x100654[_0x89ab('0x20')];var _0x37ec80;if(_0x11a155>=_0x2ecee0){_0x11a155=_0x2ecee0;_0x37ec80=0xc8;}else{_0x37ec80=0xce;}_0x29cbcb[_0x89ab('0x1c')](_0x37ec80);return _0x29cbcb[_0x89ab('0x22')]('Content-Range',_0x22768d+'-'+_0x11a155+'/'+_0x2ecee0)[_0x89ab('0x1d')](_0x74c88c);}return null;};}function patchUpdates(_0x210233){return function(_0x4694c0){try{jsonpatch[_0x89ab('0x23')](_0x4694c0,_0x210233,!![]);}catch(_0xe37da){return BPromise[_0x89ab('0x24')](_0xe37da);}return _0x4694c0[_0x89ab('0x25')]();};}function saveUpdates(_0x51beb2,_0x52f3e5){return function(_0x452e26){if(_0x452e26){return _0x452e26[_0x89ab('0x26')](_0x51beb2)[_0x89ab('0x27')](function(_0xa1a899){return _0xa1a899;});}return null;};}function removeEntity(_0x4d7a68,_0x34a90d){return function(_0x123359){if(_0x123359){return _0x123359[_0x89ab('0x28')]()[_0x89ab('0x27')](function(){_0x4d7a68[_0x89ab('0x1c')](0xcc)[_0x89ab('0x1b')]();});}};}function handleEntityNotFound(_0x1ad465,_0xc29e17){return function(_0x5222ce){if(!_0x5222ce){_0x1ad465[_0x89ab('0x1a')](0x194);}return _0x5222ce;};}function handleError(_0x4e4de7,_0x307c11){_0x307c11=_0x307c11||0x1f4;return function(_0x1124dc){logger[_0x89ab('0x29')](_0x1124dc['stack']);if(_0x1124dc['name']){delete _0x1124dc['name'];}_0x4e4de7[_0x89ab('0x1c')](_0x307c11)[_0x89ab('0x2a')](_0x1124dc);};}exports[_0x89ab('0x2b')]=function(_0x546889,_0x57d4fa){var _0x5226cf={},_0x1e7ed3={},_0x101e85={'count':0x0,'rows':[]};var _0x5b74e7=_[_0x89ab('0x2c')](db[_0x89ab('0x2d')][_0x89ab('0x2e')],function(_0x274dde){return{'name':_0x274dde[_0x89ab('0x2f')],'type':_0x274dde[_0x89ab('0x30')][_0x89ab('0x31')]};});_0x1e7ed3[_0x89ab('0x32')]=_[_0x89ab('0x2c')](_0x5b74e7,'name');_0x1e7ed3[_0x89ab('0x33')]=_['keys'](_0x546889['query']);_0x1e7ed3['filters']=_[_0x89ab('0x34')](_0x1e7ed3[_0x89ab('0x32')],_0x1e7ed3[_0x89ab('0x33')]);_0x5226cf[_0x89ab('0x35')]=_[_0x89ab('0x34')](_0x1e7ed3[_0x89ab('0x32')],qs['fields'](_0x546889['query'][_0x89ab('0x36')]));_0x5226cf[_0x89ab('0x35')]=_0x5226cf[_0x89ab('0x35')][_0x89ab('0x37')]?_0x5226cf[_0x89ab('0x35')]:_0x1e7ed3[_0x89ab('0x32')];if(!_0x546889[_0x89ab('0x33')][_0x89ab('0x38')](_0x89ab('0x39'))){_0x5226cf[_0x89ab('0x20')]=qs['limit'](_0x546889['query']['limit']);_0x5226cf['offset']=qs[_0x89ab('0x1e')](_0x546889['query'][_0x89ab('0x1e')]);}_0x5226cf[_0x89ab('0x3a')]=qs['sort'](_0x546889['query'][_0x89ab('0x3b')]);_0x5226cf[_0x89ab('0x3c')]=qs[_0x89ab('0x3d')](_['pick'](_0x546889[_0x89ab('0x33')],_0x1e7ed3[_0x89ab('0x3d')]),_0x5b74e7);if(_0x546889['query'][_0x89ab('0x3e')]){_0x5226cf[_0x89ab('0x3c')]=_[_0x89ab('0x3f')](_0x5226cf[_0x89ab('0x3c')],{'$or':_['map'](_0x5b74e7,function(_0xac0f08){if(_0xac0f08[_0x89ab('0x30')]!==_0x89ab('0x40')){var _0x33a220={};_0x33a220[_0xac0f08[_0x89ab('0x41')]]={'$like':'%'+_0x546889['query']['filter']+'%'};return _0x33a220;}})});}_0x5226cf=_['merge']({},_0x5226cf,_0x546889[_0x89ab('0x42')]);var _0x3160d8={'where':_0x5226cf['where']};return db[_0x89ab('0x2d')]['count'](_0x3160d8)[_0x89ab('0x27')](function(_0x23a0b0){_0x101e85[_0x89ab('0x21')]=_0x23a0b0;if(_0x546889[_0x89ab('0x33')][_0x89ab('0x43')]){_0x5226cf[_0x89ab('0x44')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x89ab('0x45')](_0x5226cf);})[_0x89ab('0x27')](function(_0x276209){_0x101e85[_0x89ab('0x46')]=_0x276209;return _0x101e85;})[_0x89ab('0x27')](respondWithFilteredResult(_0x57d4fa,_0x5226cf))[_0x89ab('0x47')](handleError(_0x57d4fa,null));};exports[_0x89ab('0x48')]=function(_0x2a95c5,_0x412269){var _0x547479={'raw':!![],'where':{'id':_0x2a95c5[_0x89ab('0x49')]['id']}},_0x5fac36={};_0x5fac36[_0x89ab('0x32')]=_[_0x89ab('0x4a')](db['OpenchannelQueueReport']['rawAttributes']);_0x5fac36[_0x89ab('0x33')]=_[_0x89ab('0x4a')](_0x2a95c5[_0x89ab('0x33')]);_0x5fac36[_0x89ab('0x3d')]=_[_0x89ab('0x34')](_0x5fac36[_0x89ab('0x32')],_0x5fac36[_0x89ab('0x33')]);_0x547479[_0x89ab('0x35')]=_[_0x89ab('0x34')](_0x5fac36[_0x89ab('0x32')],qs[_0x89ab('0x36')](_0x2a95c5[_0x89ab('0x33')][_0x89ab('0x36')]));_0x547479[_0x89ab('0x35')]=_0x547479[_0x89ab('0x35')]['length']?_0x547479[_0x89ab('0x35')]:_0x5fac36[_0x89ab('0x32')];if(_0x2a95c5[_0x89ab('0x33')][_0x89ab('0x43')]){_0x547479['include']=[{'all':!![]}];}_0x547479=_[_0x89ab('0x3f')]({},_0x547479,_0x2a95c5[_0x89ab('0x42')]);return db[_0x89ab('0x2d')][_0x89ab('0x4b')](_0x547479)[_0x89ab('0x27')](handleEntityNotFound(_0x412269,null))['then'](respondWithResult(_0x412269,null))[_0x89ab('0x47')](handleError(_0x412269,null));};exports['create']=function(_0x3c442c,_0x45e0ac){return db['OpenchannelQueueReport'][_0x89ab('0x4c')](_0x3c442c[_0x89ab('0x4d')],{})[_0x89ab('0x27')](respondWithResult(_0x45e0ac,0xc9))['catch'](handleError(_0x45e0ac,null));};exports[_0x89ab('0x26')]=function(_0x1a9a04,_0x1749c2){if(_0x1a9a04[_0x89ab('0x4d')]['id']){delete _0x1a9a04[_0x89ab('0x4d')]['id'];}return db['OpenchannelQueueReport'][_0x89ab('0x4b')]({'where':{'id':_0x1a9a04['params']['id']}})[_0x89ab('0x27')](handleEntityNotFound(_0x1749c2,null))[_0x89ab('0x27')](saveUpdates(_0x1a9a04[_0x89ab('0x4d')],null))[_0x89ab('0x27')](respondWithResult(_0x1749c2,null))[_0x89ab('0x47')](handleError(_0x1749c2,null));};exports['destroy']=function(_0x1747f1,_0x678172){return db[_0x89ab('0x2d')][_0x89ab('0x4b')]({'where':{'id':_0x1747f1[_0x89ab('0x49')]['id']}})[_0x89ab('0x27')](handleEntityNotFound(_0x678172,null))[_0x89ab('0x27')](removeEntity(_0x678172,null))[_0x89ab('0x47')](handleError(_0x678172,null));};exports[_0x89ab('0x4e')]=function(_0x14782,_0x1280b0){return db[_0x89ab('0x2d')]['describe']()[_0x89ab('0x27')](respondWithResult(_0x1280b0,null))['catch'](handleError(_0x1280b0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 2b368cd..034632a 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x11595a,_0x58ed48){var _0x34cc1e=function(_0x5e6aec){while(--_0x5e6aec){_0x11595a['push'](_0x11595a['shift']());}};_0x34cc1e(++_0x58ed48);}(_0x5fc3,0xa8));var _0x35fc=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0x5fc3[_0x42ca15];return _0x1c6ded;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x414c8b,_0x49a096){var _0x561db9=function(_0x229ec5){while(--_0x229ec5){_0x414c8b['push'](_0x414c8b['shift']());}};_0x561db9(++_0x49a096);}(_0x1261,0x144));var _0x1126=function(_0x24b53b,_0x57c20d){_0x24b53b=_0x24b53b-0x0;var _0x3b5c00=_0x1261[_0x24b53b];return _0x3b5c00;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 3c342ca..bf5742b 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 _0x536f=['../../config/logger','../../config/environment','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','debug','catch','update','body','raw','where','attributes','UpdateOpenchannelQueueReport','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0xcc581c,_0x414241){var _0xcd8e39=function(_0xdee7eb){while(--_0xdee7eb){_0xcc581c['push'](_0xcc581c['shift']());}};_0xcd8e39(++_0x414241);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf536('0x1'));var db=require(_0xf536('0x2'))['db'];var utils=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))('rpc');var config=require(_0xf536('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x6')][_0xf536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc517,_0x486ee3,_0x5952b7){return new BPromise(function(_0x3b5191,_0x422541){return client[_0xf536('0x8')](_0x2fc517,_0x5952b7)[_0xf536('0x9')](function(_0x4f2eaf){logger['info'](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x486ee3,_0xf536('0xb'),JSON[_0xf536('0xc')](_0x4f2eaf));if(_0x4f2eaf[_0xf536('0xd')]){if(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xe')]===0x1f4){logger['error'](_0xf536('0xa'),_0x486ee3,_0x4f2eaf['error'][_0xf536('0xf')]);return _0x422541(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}logger[_0xf536('0xd')](_0xf536('0xa'),_0x486ee3,_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);return _0x3b5191(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}else{logger[_0xf536('0x10')](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));_0x3b5191(_0x4f2eaf['result'][_0xf536('0xf')]);}})['catch'](function(_0x238b9d){logger['error'](_0xf536('0xa'),_0x486ee3,_0x238b9d);_0x422541(_0x238b9d);});});}exports[_0xf536('0x11')]=function(_0xbca324){var _0x19756b=this;return new Promise(function(_0x4532a0,_0x189334){return db[_0xf536('0x12')][_0xf536('0x13')](_0xbca324['body'],{'raw':_0xbca324[_0xf536('0x14')]?_0xbca324[_0xf536('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x466f95){logger[_0xf536('0x10')](_0xf536('0x11'),_0xbca324);logger[_0xf536('0x15')](_0xf536('0x11'),_0xbca324,JSON[_0xf536('0xc')](_0x466f95));_0x4532a0(_0x466f95);})[_0xf536('0x16')](function(_0xe1d6a8){logger[_0xf536('0xd')](_0xf536('0x11'),_0xe1d6a8['message'],_0xbca324);_0x189334(_0x19756b[_0xf536('0xd')](0x1f4,_0xe1d6a8[_0xf536('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1df79c){var _0xddf70e=this;return new Promise(function(_0x2d9dfb,_0x252cae){return db[_0xf536('0x12')][_0xf536('0x17')](_0x1df79c[_0xf536('0x18')],{'raw':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')][_0xf536('0x1a')]||null:null,'attributes':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x1b')]||null:null,'limit':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')]['limit']||null:null})[_0xf536('0x9')](function(_0x485da0){logger[_0xf536('0x10')](_0xf536('0x1c'),_0x1df79c);logger[_0xf536('0x15')](_0xf536('0x1c'),_0x1df79c,JSON[_0xf536('0xc')](_0x485da0));_0x2d9dfb(_0x485da0);})[_0xf536('0x16')](function(_0x330c47){logger[_0xf536('0xd')](_0xf536('0x1c'),_0x330c47[_0xf536('0xf')],_0x1df79c);_0x252cae(_0xddf70e[_0xf536('0xd')](0x1f4,_0x330c47[_0xf536('0xf')]));});});}; \ No newline at end of file +var _0x0447=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','raw','then','UpdateOpenchannelQueueReport','update','body','options','where','attributes','limit','catch','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0447,0x8b));var _0x7044=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0x0447[_0x26a4ea];return _0x1b669e;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var moment=require(_0x7044('0x2'));var BPromise=require(_0x7044('0x3'));var rs=require(_0x7044('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7044('0x5'))['db'];var utils=require(_0x7044('0x6'));var logger=require(_0x7044('0x7'))(_0x7044('0x8'));var config=require(_0x7044('0x9'));var jayson=require(_0x7044('0xa'));var client=jayson[_0x7044('0xb')][_0x7044('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x66b8cb,_0x51de50,_0x72d341){return new BPromise(function(_0x42d53b,_0x2a2b36){return client[_0x7044('0xd')](_0x66b8cb,_0x72d341)['then'](function(_0x41616d){logger[_0x7044('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x51de50,_0x7044('0xf'));logger[_0x7044('0x10')](_0x7044('0x11'),_0x51de50,_0x7044('0xf'),JSON['stringify'](_0x41616d));if(_0x41616d[_0x7044('0x12')]){if(_0x41616d['error']['code']===0x1f4){logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')][_0x7044('0x14')]);return _0x2a2b36(_0x41616d[_0x7044('0x12')]['message']);}logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')]['message']);return _0x42d53b(_0x41616d['error'][_0x7044('0x14')]);}else{logger[_0x7044('0xe')](_0x7044('0x13'),_0x51de50,_0x7044('0xf'));_0x42d53b(_0x41616d[_0x7044('0x15')][_0x7044('0x14')]);}})['catch'](function(_0xdae8a){logger[_0x7044('0x12')](_0x7044('0x13'),_0x51de50,_0xdae8a);_0x2a2b36(_0xdae8a);});});}exports[_0x7044('0x16')]=function(_0x219486){var _0x3f373c=this;return new Promise(function(_0x4df89b,_0x1f300e){return db[_0x7044('0x17')][_0x7044('0x18')](_0x219486['body'],{'raw':_0x219486['options']?_0x219486['options'][_0x7044('0x19')]===undefined?!![]:![]:!![]})[_0x7044('0x1a')](function(_0x2c5dcb){logger[_0x7044('0xe')](_0x7044('0x16'),_0x219486);logger['debug'](_0x7044('0x16'),_0x219486,JSON['stringify'](_0x2c5dcb));_0x4df89b(_0x2c5dcb);})['catch'](function(_0x3db88b){logger[_0x7044('0x12')](_0x7044('0x16'),_0x3db88b[_0x7044('0x14')],_0x219486);_0x1f300e(_0x3f373c[_0x7044('0x12')](0x1f4,_0x3db88b[_0x7044('0x14')]));});});};exports[_0x7044('0x1b')]=function(_0x9452a1){var _0x4271b5=this;return new Promise(function(_0x5e2c9a,_0x5d7d8a){return db[_0x7044('0x17')][_0x7044('0x1c')](_0x9452a1[_0x7044('0x1d')],{'raw':_0x9452a1[_0x7044('0x1e')]?_0x9452a1[_0x7044('0x1e')][_0x7044('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9452a1[_0x7044('0x1e')]?_0x9452a1[_0x7044('0x1e')][_0x7044('0x1f')]||null:null,'attributes':_0x9452a1[_0x7044('0x1e')]?_0x9452a1[_0x7044('0x1e')][_0x7044('0x20')]||null:null,'limit':_0x9452a1['options']?_0x9452a1[_0x7044('0x1e')][_0x7044('0x21')]||null:null})[_0x7044('0x1a')](function(_0x1a75ff){logger['info'](_0x7044('0x1b'),_0x9452a1);logger['debug']('UpdateOpenchannelQueueReport',_0x9452a1,JSON['stringify'](_0x1a75ff));_0x5e2c9a(_0x1a75ff);})[_0x7044('0x22')](function(_0x55ea91){logger[_0x7044('0x12')](_0x7044('0x1b'),_0x55ea91['message'],_0x9452a1);_0x5d7d8a(_0x4271b5['error'](0x1f4,_0x55ea91[_0x7044('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 628e524..15ec7b5 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 _0x4af1=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','destroy','exports','multer'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x4af1,0x179));var _0x14af=function(_0x580239,_0x135bfc){_0x580239=_0x580239-0x0;var _0x31993c=_0x4af1[_0x580239];return _0x31993c;};'use strict';var multer=require(_0x14af('0x0'));var util=require(_0x14af('0x1'));var path=require('path');var timeout=require(_0x14af('0x2'));var express=require(_0x14af('0x3'));var router=express['Router']();var fs_extra=require(_0x14af('0x4'));var auth=require(_0x14af('0x5'));var interaction=require(_0x14af('0x6'));var config=require(_0x14af('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x14af('0x8')]('/',auth[_0x14af('0x9')](),controller[_0x14af('0xa')]);router[_0x14af('0x8')]('/describe',auth[_0x14af('0x9')](),controller[_0x14af('0xb')]);router[_0x14af('0x8')](_0x14af('0xc'),auth[_0x14af('0x9')](),controller[_0x14af('0xd')]);router['post']('/',auth[_0x14af('0x9')](),controller[_0x14af('0xe')]);router[_0x14af('0xf')]('/:id',auth[_0x14af('0x9')](),controller['update']);router['delete'](_0x14af('0xc'),auth[_0x14af('0x9')](),controller[_0x14af('0x10')]);module[_0x14af('0x11')]=router; \ No newline at end of file +var _0x12f9=['./openchannelTransferReport.controller','get','isAuthenticated','describe','/:id','show','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0x12f9,0x199));var _0x912f=function(_0x1b9f97,_0xcc9cd3){_0x1b9f97=_0x1b9f97-0x0;var _0x3e9a9b=_0x12f9[_0x1b9f97];return _0x3e9a9b;};'use strict';var multer=require('multer');var util=require(_0x912f('0x0'));var path=require(_0x912f('0x1'));var timeout=require(_0x912f('0x2'));var express=require(_0x912f('0x3'));var router=express[_0x912f('0x4')]();var fs_extra=require(_0x912f('0x5'));var auth=require(_0x912f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x912f('0x7'));router[_0x912f('0x8')]('/',auth[_0x912f('0x9')](),controller['index']);router['get']('/describe',auth[_0x912f('0x9')](),controller[_0x912f('0xa')]);router[_0x912f('0x8')](_0x912f('0xb'),auth['isAuthenticated'](),controller[_0x912f('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x912f('0xd')]('/:id',auth[_0x912f('0x9')](),controller[_0x912f('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x912f('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 2fe7ee6..79cae59 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5ad43c,_0x3e6348){_0x5ad43c=_0x5ad43c-0x0;var _0x1ee77e=_0xb43b[_0x5ad43c];return _0x1ee77e;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x44f415,_0x276134){var _0x2cc367=function(_0x404c6d){while(--_0x404c6d){_0x44f415['push'](_0x44f415['shift']());}};_0x2cc367(++_0x276134);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0xf3cd[_0x3eb630];return _0x1b840d;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index ce4e1e9..ae3ebaf 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 _0x7ad4=['query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','findAll','show','params','length','includeAll','include','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model'];(function(_0x7f842,_0x50c142){var _0x52afae=function(_0x144d38){while(--_0x144d38){_0x7f842['push'](_0x7f842['shift']());}};_0x52afae(++_0x50c142);}(_0x7ad4,0x1e9));var _0x47ad=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7ad4[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x47ad('0x0'));var rimraf=require(_0x47ad('0x1'));var zipdir=require(_0x47ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47ad('0x3'));var moment=require(_0x47ad('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x47ad('0x5'));var path=require('path');var sox=require(_0x47ad('0x6'));var csv=require(_0x47ad('0x7'));var ejs=require(_0x47ad('0x8'));var fs=require('fs');var fs_extra=require(_0x47ad('0x9'));var _=require('lodash');var squel=require(_0x47ad('0xa'));var crypto=require(_0x47ad('0xb'));var jsforce=require(_0x47ad('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x47ad('0xd'));var Papa=require(_0x47ad('0xe'));var Redis=require(_0x47ad('0xf'));var authService=require(_0x47ad('0x10'));var qs=require(_0x47ad('0x11'));var as=require(_0x47ad('0x12'));var hardwareService=require(_0x47ad('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x47ad('0x14'));var config=require(_0x47ad('0x15'));var licenseUtil=require(_0x47ad('0x16'));var db=require(_0x47ad('0x17'))['db'];function respondWithStatusCode(_0x2962f7,_0x2a07a3){_0x2a07a3=_0x2a07a3||0xcc;return function(_0x167ebe){if(_0x167ebe){return _0x2962f7[_0x47ad('0x18')](_0x2a07a3);}return _0x2962f7[_0x47ad('0x19')](_0x2a07a3)[_0x47ad('0x1a')]();};}function respondWithResult(_0x1744de,_0x50e24){_0x50e24=_0x50e24||0xc8;return function(_0x55f5b3){if(_0x55f5b3){return _0x1744de[_0x47ad('0x19')](_0x50e24)[_0x47ad('0x1b')](_0x55f5b3);}};}function respondWithFilteredResult(_0x226b46,_0x33ca89){return function(_0x59f04d){if(_0x59f04d){var _0x416fbd=typeof _0x33ca89['offset']==='undefined'&&typeof _0x33ca89[_0x47ad('0x1c')]===_0x47ad('0x1d');var _0x590dd9=_0x59f04d[_0x47ad('0x1e')];var _0x2f0714=_0x416fbd?0x0:_0x33ca89[_0x47ad('0x1f')];var _0x5b7948=_0x416fbd?_0x59f04d[_0x47ad('0x1e')]:_0x33ca89['offset']+_0x33ca89[_0x47ad('0x1c')];var _0x1c8e5f;if(_0x5b7948>=_0x590dd9){_0x5b7948=_0x590dd9;_0x1c8e5f=0xc8;}else{_0x1c8e5f=0xce;}_0x226b46[_0x47ad('0x19')](_0x1c8e5f);return _0x226b46[_0x47ad('0x20')](_0x47ad('0x21'),_0x2f0714+'-'+_0x5b7948+'/'+_0x590dd9)[_0x47ad('0x1b')](_0x59f04d);}return null;};}function patchUpdates(_0x424ca0){return function(_0x5c4def){try{jsonpatch['apply'](_0x5c4def,_0x424ca0,!![]);}catch(_0x3152be){return BPromise[_0x47ad('0x22')](_0x3152be);}return _0x5c4def[_0x47ad('0x23')]();};}function saveUpdates(_0x27ebea,_0x40879a){return function(_0x13cf71){if(_0x13cf71){return _0x13cf71[_0x47ad('0x24')](_0x27ebea)['then'](function(_0x2237a4){return _0x2237a4;});}return null;};}function removeEntity(_0x30a08d,_0x147904){return function(_0x4229ce){if(_0x4229ce){return _0x4229ce[_0x47ad('0x25')]()[_0x47ad('0x26')](function(){_0x30a08d[_0x47ad('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227671,_0x261982){return function(_0x452f00){if(!_0x452f00){_0x227671[_0x47ad('0x18')](0x194);}return _0x452f00;};}function handleError(_0x535294,_0x337846){_0x337846=_0x337846||0x1f4;return function(_0x17c244){logger[_0x47ad('0x27')](_0x17c244[_0x47ad('0x28')]);if(_0x17c244[_0x47ad('0x29')]){delete _0x17c244['name'];}_0x535294[_0x47ad('0x19')](_0x337846)[_0x47ad('0x2a')](_0x17c244);};}exports[_0x47ad('0x2b')]=function(_0x40074c,_0x357f92){var _0x1a52dc={},_0x1782f4={},_0x381ed1={'count':0x0,'rows':[]};var _0x189acc=_[_0x47ad('0x2c')](db[_0x47ad('0x2d')][_0x47ad('0x2e')],function(_0x4acb22){return{'name':_0x4acb22[_0x47ad('0x2f')],'type':_0x4acb22[_0x47ad('0x30')]['key']};});_0x1782f4[_0x47ad('0x31')]=_['map'](_0x189acc,_0x47ad('0x29'));_0x1782f4[_0x47ad('0x32')]=_[_0x47ad('0x33')](_0x40074c[_0x47ad('0x32')]);_0x1782f4['filters']=_[_0x47ad('0x34')](_0x1782f4['model'],_0x1782f4[_0x47ad('0x32')]);_0x1a52dc[_0x47ad('0x35')]=_['intersection'](_0x1782f4[_0x47ad('0x31')],qs[_0x47ad('0x36')](_0x40074c[_0x47ad('0x32')][_0x47ad('0x36')]));_0x1a52dc[_0x47ad('0x35')]=_0x1a52dc[_0x47ad('0x35')]['length']?_0x1a52dc[_0x47ad('0x35')]:_0x1782f4[_0x47ad('0x31')];if(!_0x40074c[_0x47ad('0x32')][_0x47ad('0x37')](_0x47ad('0x38'))){_0x1a52dc[_0x47ad('0x1c')]=qs[_0x47ad('0x1c')](_0x40074c[_0x47ad('0x32')][_0x47ad('0x1c')]);_0x1a52dc[_0x47ad('0x1f')]=qs[_0x47ad('0x1f')](_0x40074c[_0x47ad('0x32')][_0x47ad('0x1f')]);}_0x1a52dc[_0x47ad('0x39')]=qs[_0x47ad('0x3a')](_0x40074c['query'][_0x47ad('0x3a')]);_0x1a52dc['where']=qs[_0x47ad('0x3b')](_[_0x47ad('0x3c')](_0x40074c[_0x47ad('0x32')],_0x1782f4['filters']),_0x189acc);if(_0x40074c[_0x47ad('0x32')]['filter']){_0x1a52dc['where']=_[_0x47ad('0x3d')](_0x1a52dc[_0x47ad('0x3e')],{'$or':_['map'](_0x189acc,function(_0x346fd7){if(_0x346fd7[_0x47ad('0x30')]!==_0x47ad('0x3f')){var _0x17d3a3={};_0x17d3a3[_0x346fd7[_0x47ad('0x29')]]={'$like':'%'+_0x40074c['query'][_0x47ad('0x40')]+'%'};return _0x17d3a3;}})});}_0x1a52dc=_[_0x47ad('0x3d')]({},_0x1a52dc,_0x40074c['options']);var _0x5914d5={'where':_0x1a52dc['where']};return db['OpenchannelTransferReport'][_0x47ad('0x1e')](_0x5914d5)['then'](function(_0x51ed0e){_0x381ed1[_0x47ad('0x1e')]=_0x51ed0e;if(_0x40074c[_0x47ad('0x32')]['includeAll']){_0x1a52dc['include']=[{'all':!![]}];}return db[_0x47ad('0x2d')][_0x47ad('0x41')](_0x1a52dc);})['then'](function(_0xbd34e7){_0x381ed1['rows']=_0xbd34e7;return _0x381ed1;})[_0x47ad('0x26')](respondWithFilteredResult(_0x357f92,_0x1a52dc))['catch'](handleError(_0x357f92,null));};exports[_0x47ad('0x42')]=function(_0x5317e4,_0x1e8c60){var _0x513361={'raw':!![],'where':{'id':_0x5317e4[_0x47ad('0x43')]['id']}},_0x57070e={};_0x57070e[_0x47ad('0x31')]=_['keys'](db[_0x47ad('0x2d')][_0x47ad('0x2e')]);_0x57070e['query']=_[_0x47ad('0x33')](_0x5317e4[_0x47ad('0x32')]);_0x57070e[_0x47ad('0x3b')]=_[_0x47ad('0x34')](_0x57070e[_0x47ad('0x31')],_0x57070e['query']);_0x513361[_0x47ad('0x35')]=_[_0x47ad('0x34')](_0x57070e[_0x47ad('0x31')],qs[_0x47ad('0x36')](_0x5317e4[_0x47ad('0x32')][_0x47ad('0x36')]));_0x513361[_0x47ad('0x35')]=_0x513361[_0x47ad('0x35')][_0x47ad('0x44')]?_0x513361['attributes']:_0x57070e[_0x47ad('0x31')];if(_0x5317e4[_0x47ad('0x32')][_0x47ad('0x45')]){_0x513361[_0x47ad('0x46')]=[{'all':!![]}];}_0x513361=_[_0x47ad('0x3d')]({},_0x513361,_0x5317e4[_0x47ad('0x47')]);return db[_0x47ad('0x2d')][_0x47ad('0x48')](_0x513361)[_0x47ad('0x26')](handleEntityNotFound(_0x1e8c60,null))[_0x47ad('0x26')](respondWithResult(_0x1e8c60,null))[_0x47ad('0x49')](handleError(_0x1e8c60,null));};exports[_0x47ad('0x4a')]=function(_0xba3110,_0x457e64){return db[_0x47ad('0x2d')][_0x47ad('0x4a')](_0xba3110[_0x47ad('0x4b')],{})[_0x47ad('0x26')](respondWithResult(_0x457e64,0xc9))[_0x47ad('0x49')](handleError(_0x457e64,null));};exports[_0x47ad('0x24')]=function(_0x196242,_0x431162){if(_0x196242[_0x47ad('0x4b')]['id']){delete _0x196242[_0x47ad('0x4b')]['id'];}return db['OpenchannelTransferReport'][_0x47ad('0x48')]({'where':{'id':_0x196242['params']['id']}})[_0x47ad('0x26')](handleEntityNotFound(_0x431162,null))[_0x47ad('0x26')](saveUpdates(_0x196242[_0x47ad('0x4b')],null))[_0x47ad('0x26')](respondWithResult(_0x431162,null))[_0x47ad('0x49')](handleError(_0x431162,null));};exports[_0x47ad('0x25')]=function(_0x7e29ed,_0x22e9e6){return db[_0x47ad('0x2d')][_0x47ad('0x48')]({'where':{'id':_0x7e29ed[_0x47ad('0x43')]['id']}})[_0x47ad('0x26')](handleEntityNotFound(_0x22e9e6,null))[_0x47ad('0x26')](removeEntity(_0x22e9e6,null))[_0x47ad('0x49')](handleError(_0x22e9e6,null));};exports[_0x47ad('0x4c')]=function(_0x25cbdb,_0x390f48){return db[_0x47ad('0x2d')][_0x47ad('0x4c')]()[_0x47ad('0x26')](respondWithResult(_0x390f48,null))[_0x47ad('0x49')](handleError(_0x390f48,null));}; \ No newline at end of file +var _0xac9d=['fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac9d,0x14d));var _0xdac9=function(_0x211576,_0xcc41af){_0x211576=_0x211576-0x0;var _0x3ce235=_0xac9d[_0x211576];return _0x3ce235;};'use strict';var emlformat=require(_0xdac9('0x0'));var rimraf=require(_0xdac9('0x1'));var zipdir=require(_0xdac9('0x2'));var jsonpatch=require(_0xdac9('0x3'));var rp=require(_0xdac9('0x4'));var moment=require(_0xdac9('0x5'));var BPromise=require(_0xdac9('0x6'));var Mustache=require(_0xdac9('0x7'));var util=require('util');var path=require(_0xdac9('0x8'));var sox=require('sox');var csv=require(_0xdac9('0x9'));var ejs=require(_0xdac9('0xa'));var fs=require('fs');var fs_extra=require(_0xdac9('0xb'));var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var licenseUtil=require(_0xdac9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xcc;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['sendStatus'](_0xeddbc1);}return _0x3d8e97[_0xdac9('0x1b')](_0xeddbc1)[_0xdac9('0x1c')]();};}function respondWithResult(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0xc8;return function(_0x5dd536){if(_0x5dd536){return _0x9e1bf6[_0xdac9('0x1b')](_0x5f0bbd)[_0xdac9('0x1d')](_0x5dd536);}};}function respondWithFilteredResult(_0x50f9fe,_0x76af7a){return function(_0x36cbe4){if(_0x36cbe4){var _0x152ea5=typeof _0x76af7a[_0xdac9('0x1e')]===_0xdac9('0x1f')&&typeof _0x76af7a[_0xdac9('0x20')]===_0xdac9('0x1f');var _0xec1016=_0x36cbe4['count'];var _0x283343=_0x152ea5?0x0:_0x76af7a[_0xdac9('0x1e')];var _0x571e07=_0x152ea5?_0x36cbe4[_0xdac9('0x21')]:_0x76af7a[_0xdac9('0x1e')]+_0x76af7a[_0xdac9('0x20')];var _0x181d11;if(_0x571e07>=_0xec1016){_0x571e07=_0xec1016;_0x181d11=0xc8;}else{_0x181d11=0xce;}_0x50f9fe['status'](_0x181d11);return _0x50f9fe['set'](_0xdac9('0x22'),_0x283343+'-'+_0x571e07+'/'+_0xec1016)[_0xdac9('0x1d')](_0x36cbe4);}return null;};}function patchUpdates(_0x2b9d91){return function(_0x395ec7){try{jsonpatch['apply'](_0x395ec7,_0x2b9d91,!![]);}catch(_0x23ee5e){return BPromise[_0xdac9('0x23')](_0x23ee5e);}return _0x395ec7[_0xdac9('0x24')]();};}function saveUpdates(_0xae680a,_0xe7bd10){return function(_0x42317c){if(_0x42317c){return _0x42317c[_0xdac9('0x25')](_0xae680a)[_0xdac9('0x26')](function(_0x419f0c){return _0x419f0c;});}return null;};}function removeEntity(_0x33de5c,_0x5a0fa2){return function(_0x2943f5){if(_0x2943f5){return _0x2943f5[_0xdac9('0x27')]()[_0xdac9('0x26')](function(){_0x33de5c[_0xdac9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e631a,_0x5686db){return function(_0x3ce475){if(!_0x3ce475){_0x1e631a[_0xdac9('0x28')](0x194);}return _0x3ce475;};}function handleError(_0x566d8c,_0x433be9){_0x433be9=_0x433be9||0x1f4;return function(_0x5105f1){logger[_0xdac9('0x29')](_0x5105f1[_0xdac9('0x2a')]);if(_0x5105f1[_0xdac9('0x2b')]){delete _0x5105f1[_0xdac9('0x2b')];}_0x566d8c['status'](_0x433be9)['send'](_0x5105f1);};}exports[_0xdac9('0x2c')]=function(_0x170afd,_0x4fe3bd){var _0x4c4e21={},_0x3eed7a={},_0x3505c5={'count':0x0,'rows':[]};var _0x13efba=_[_0xdac9('0x2d')](db[_0xdac9('0x2e')][_0xdac9('0x2f')],function(_0xed99f9){return{'name':_0xed99f9[_0xdac9('0x30')],'type':_0xed99f9[_0xdac9('0x31')][_0xdac9('0x32')]};});_0x3eed7a[_0xdac9('0x33')]=_[_0xdac9('0x2d')](_0x13efba,_0xdac9('0x2b'));_0x3eed7a[_0xdac9('0x34')]=_[_0xdac9('0x35')](_0x170afd[_0xdac9('0x34')]);_0x3eed7a[_0xdac9('0x36')]=_[_0xdac9('0x37')](_0x3eed7a[_0xdac9('0x33')],_0x3eed7a[_0xdac9('0x34')]);_0x4c4e21[_0xdac9('0x38')]=_['intersection'](_0x3eed7a['model'],qs[_0xdac9('0x39')](_0x170afd[_0xdac9('0x34')][_0xdac9('0x39')]));_0x4c4e21[_0xdac9('0x38')]=_0x4c4e21[_0xdac9('0x38')]['length']?_0x4c4e21[_0xdac9('0x38')]:_0x3eed7a['model'];if(!_0x170afd[_0xdac9('0x34')][_0xdac9('0x3a')]('nolimit')){_0x4c4e21[_0xdac9('0x20')]=qs['limit'](_0x170afd['query'][_0xdac9('0x20')]);_0x4c4e21[_0xdac9('0x1e')]=qs[_0xdac9('0x1e')](_0x170afd[_0xdac9('0x34')][_0xdac9('0x1e')]);}_0x4c4e21[_0xdac9('0x3b')]=qs['sort'](_0x170afd[_0xdac9('0x34')][_0xdac9('0x3c')]);_0x4c4e21['where']=qs[_0xdac9('0x36')](_[_0xdac9('0x3d')](_0x170afd[_0xdac9('0x34')],_0x3eed7a[_0xdac9('0x36')]),_0x13efba);if(_0x170afd[_0xdac9('0x34')][_0xdac9('0x3e')]){_0x4c4e21[_0xdac9('0x3f')]=_['merge'](_0x4c4e21[_0xdac9('0x3f')],{'$or':_[_0xdac9('0x2d')](_0x13efba,function(_0x238769){if(_0x238769['type']!==_0xdac9('0x40')){var _0x338e4a={};_0x338e4a[_0x238769[_0xdac9('0x2b')]]={'$like':'%'+_0x170afd[_0xdac9('0x34')]['filter']+'%'};return _0x338e4a;}})});}_0x4c4e21=_['merge']({},_0x4c4e21,_0x170afd[_0xdac9('0x41')]);var _0xe47a3c={'where':_0x4c4e21[_0xdac9('0x3f')]};return db[_0xdac9('0x2e')][_0xdac9('0x21')](_0xe47a3c)['then'](function(_0x8435e8){_0x3505c5['count']=_0x8435e8;if(_0x170afd[_0xdac9('0x34')][_0xdac9('0x42')]){_0x4c4e21[_0xdac9('0x43')]=[{'all':!![]}];}return db[_0xdac9('0x2e')][_0xdac9('0x44')](_0x4c4e21);})[_0xdac9('0x26')](function(_0x413fb1){_0x3505c5[_0xdac9('0x45')]=_0x413fb1;return _0x3505c5;})[_0xdac9('0x26')](respondWithFilteredResult(_0x4fe3bd,_0x4c4e21))[_0xdac9('0x46')](handleError(_0x4fe3bd,null));};exports[_0xdac9('0x47')]=function(_0x24b570,_0x278826){var _0x441676={'raw':!![],'where':{'id':_0x24b570[_0xdac9('0x48')]['id']}},_0x5335ae={};_0x5335ae[_0xdac9('0x33')]=_['keys'](db[_0xdac9('0x2e')][_0xdac9('0x2f')]);_0x5335ae[_0xdac9('0x34')]=_[_0xdac9('0x35')](_0x24b570[_0xdac9('0x34')]);_0x5335ae[_0xdac9('0x36')]=_['intersection'](_0x5335ae[_0xdac9('0x33')],_0x5335ae['query']);_0x441676[_0xdac9('0x38')]=_[_0xdac9('0x37')](_0x5335ae[_0xdac9('0x33')],qs[_0xdac9('0x39')](_0x24b570['query']['fields']));_0x441676['attributes']=_0x441676[_0xdac9('0x38')]['length']?_0x441676['attributes']:_0x5335ae[_0xdac9('0x33')];if(_0x24b570[_0xdac9('0x34')]['includeAll']){_0x441676['include']=[{'all':!![]}];}_0x441676=_[_0xdac9('0x49')]({},_0x441676,_0x24b570[_0xdac9('0x41')]);return db[_0xdac9('0x2e')][_0xdac9('0x4a')](_0x441676)[_0xdac9('0x26')](handleEntityNotFound(_0x278826,null))[_0xdac9('0x26')](respondWithResult(_0x278826,null))[_0xdac9('0x46')](handleError(_0x278826,null));};exports[_0xdac9('0x4b')]=function(_0x5c008b,_0x621cf){return db[_0xdac9('0x2e')][_0xdac9('0x4b')](_0x5c008b[_0xdac9('0x4c')],{})[_0xdac9('0x26')](respondWithResult(_0x621cf,0xc9))[_0xdac9('0x46')](handleError(_0x621cf,null));};exports[_0xdac9('0x25')]=function(_0x37b498,_0x140dc5){if(_0x37b498[_0xdac9('0x4c')]['id']){delete _0x37b498[_0xdac9('0x4c')]['id'];}return db[_0xdac9('0x2e')][_0xdac9('0x4a')]({'where':{'id':_0x37b498[_0xdac9('0x48')]['id']}})['then'](handleEntityNotFound(_0x140dc5,null))['then'](saveUpdates(_0x37b498['body'],null))[_0xdac9('0x26')](respondWithResult(_0x140dc5,null))[_0xdac9('0x46')](handleError(_0x140dc5,null));};exports['destroy']=function(_0x2a60bd,_0x2843f2){return db[_0xdac9('0x2e')]['find']({'where':{'id':_0x2a60bd[_0xdac9('0x48')]['id']}})[_0xdac9('0x26')](handleEntityNotFound(_0x2843f2,null))['then'](removeEntity(_0x2843f2,null))['catch'](handleError(_0x2843f2,null));};exports[_0xdac9('0x4d')]=function(_0x4469d8,_0x222de9){return db[_0xdac9('0x2e')][_0xdac9('0x4d')]()[_0xdac9('0x26')](respondWithResult(_0x222de9,null))[_0xdac9('0x46')](handleError(_0x222de9,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 133cc30..d532615 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 _0x279d=['bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5ba8b3,_0x462f2b){var _0x4ba550=function(_0x3afc24){while(--_0x3afc24){_0x5ba8b3['push'](_0x5ba8b3['shift']());}};_0x4ba550(++_0x462f2b);}(_0x279d,0x133));var _0xd279=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x279d[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xd279('0x0'));var util=require(_0xd279('0x1'));var logger=require(_0xd279('0x2'))(_0xd279('0x3'));var moment=require(_0xd279('0x4'));var BPromise=require(_0xd279('0x5'));var rp=require(_0xd279('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd279('0x7'));var config=require(_0xd279('0x8'));var attributes=require(_0xd279('0x9'));module['exports']=function(_0x177636,_0x2c3fb6){return _0x177636['define'](_0xd279('0xa'),attributes,{'tableName':_0xd279('0xb'),'paranoid':![],'indexes':[{'name':_0xd279('0xc'),'fields':[_0xd279('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1664=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','uniqueid'];(function(_0x1fb620,_0x471543){var _0x3142cd=function(_0x4594cd){while(--_0x4594cd){_0x1fb620['push'](_0x1fb620['shift']());}};_0x3142cd(++_0x471543);}(_0x1664,0x145));var _0x4166=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x1664[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x4166('0x0'));var util=require(_0x4166('0x1'));var logger=require(_0x4166('0x2'))(_0x4166('0x3'));var moment=require(_0x4166('0x4'));var BPromise=require(_0x4166('0x5'));var rp=require(_0x4166('0x6'));var fs=require('fs');var path=require(_0x4166('0x7'));var rimraf=require(_0x4166('0x8'));var config=require('../../config/environment');var attributes=require(_0x4166('0x9'));module['exports']=function(_0x12de5b,_0x5ce8ad){return _0x12de5b[_0x4166('0xa')](_0x4166('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x4166('0xc'),'fields':[_0x4166('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 71a616f..4016bfa 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 _0x4ab0=['jayson/promise','client','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x162a95,_0x9dfb1f){var _0x54cd40=function(_0x249ed1){while(--_0x249ed1){_0x162a95['push'](_0x162a95['shift']());}};_0x54cd40(++_0x9dfb1f);}(_0x4ab0,0xd5));var _0x04ab=function(_0x2fd0d1,_0x24f605){_0x2fd0d1=_0x2fd0d1-0x0;var _0x359edf=_0x4ab0[_0x2fd0d1];return _0x359edf;};'use strict';var _=require('lodash');var util=require(_0x04ab('0x0'));var moment=require(_0x04ab('0x1'));var BPromise=require(_0x04ab('0x2'));var rs=require(_0x04ab('0x3'));var fs=require('fs');var Redis=require(_0x04ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x04ab('0x5'))(_0x04ab('0x6'));var config=require('../../config/environment');var jayson=require(_0x04ab('0x7'));var client=jayson[_0x04ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f5901,_0x293f1d,_0x1ff7f6){return new BPromise(function(_0x4bc05e,_0x101d6b){return client[_0x04ab('0x9')](_0x3f5901,_0x1ff7f6)[_0x04ab('0xa')](function(_0x41ce1e){logger['info'](_0x04ab('0xb'),_0x293f1d,_0x04ab('0xc'));logger[_0x04ab('0xd')](_0x04ab('0xe'),_0x293f1d,'request\x20sent',JSON[_0x04ab('0xf')](_0x41ce1e));if(_0x41ce1e[_0x04ab('0x10')]){if(_0x41ce1e[_0x04ab('0x10')][_0x04ab('0x11')]===0x1f4){logger[_0x04ab('0x10')](_0x04ab('0xb'),_0x293f1d,_0x41ce1e['error'][_0x04ab('0x12')]);return _0x101d6b(_0x41ce1e['error'][_0x04ab('0x12')]);}logger[_0x04ab('0x10')](_0x04ab('0xb'),_0x293f1d,_0x41ce1e[_0x04ab('0x10')]['message']);return _0x4bc05e(_0x41ce1e['error']['message']);}else{logger[_0x04ab('0x13')](_0x04ab('0xb'),_0x293f1d,_0x04ab('0xc'));_0x4bc05e(_0x41ce1e[_0x04ab('0x14')][_0x04ab('0x12')]);}})[_0x04ab('0x15')](function(_0x42c937){logger[_0x04ab('0x10')](_0x04ab('0xb'),_0x293f1d,_0x42c937);_0x101d6b(_0x42c937);});});} \ No newline at end of file +var _0xf9d5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis'];(function(_0x3e91c3,_0x36abf9){var _0x129346=function(_0x3e031c){while(--_0x3e031c){_0x3e91c3['push'](_0x3e91c3['shift']());}};_0x129346(++_0x36abf9);}(_0xf9d5,0x122));var _0x5f9d=function(_0x50df1f,_0x45b8b1){_0x50df1f=_0x50df1f-0x0;var _0x5180e3=_0xf9d5[_0x50df1f];return _0x5180e3;};'use strict';var _=require('lodash');var util=require(_0x5f9d('0x0'));var moment=require(_0x5f9d('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f9d('0x2'));var fs=require('fs');var Redis=require(_0x5f9d('0x3'));var db=require(_0x5f9d('0x4'))['db'];var utils=require(_0x5f9d('0x5'));var logger=require(_0x5f9d('0x6'))(_0x5f9d('0x7'));var config=require(_0x5f9d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24999e,_0x38fb6b,_0x4fb9f7){return new BPromise(function(_0x3420b2,_0x23e865){return client[_0x5f9d('0xa')](_0x24999e,_0x4fb9f7)[_0x5f9d('0xb')](function(_0xcc3772){logger[_0x5f9d('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38fb6b,_0x5f9d('0xd'));logger[_0x5f9d('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x38fb6b,'request\x20sent',JSON[_0x5f9d('0xf')](_0xcc3772));if(_0xcc3772[_0x5f9d('0x10')]){if(_0xcc3772[_0x5f9d('0x10')]['code']===0x1f4){logger[_0x5f9d('0x10')](_0x5f9d('0x11'),_0x38fb6b,_0xcc3772[_0x5f9d('0x10')][_0x5f9d('0x12')]);return _0x23e865(_0xcc3772['error'][_0x5f9d('0x12')]);}logger[_0x5f9d('0x10')](_0x5f9d('0x11'),_0x38fb6b,_0xcc3772['error'][_0x5f9d('0x12')]);return _0x3420b2(_0xcc3772[_0x5f9d('0x10')]['message']);}else{logger['info'](_0x5f9d('0x11'),_0x38fb6b,_0x5f9d('0xd'));_0x3420b2(_0xcc3772[_0x5f9d('0x13')][_0x5f9d('0x12')]);}})[_0x5f9d('0x14')](function(_0x47f480){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x38fb6b,_0x47f480);_0x23e865(_0x47f480);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1fd8ddc..e6fe919 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 _0xbe9f=['create','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2d2684,_0x206264){var _0x2af4db=function(_0x194aba){while(--_0x194aba){_0x2d2684['push'](_0x2d2684['shift']());}};_0x2af4db(++_0x206264);}(_0xbe9f,0x1ac));var _0xfbe9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xbe9f[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xfbe9('0x0'));var util=require(_0xfbe9('0x1'));var path=require(_0xfbe9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfbe9('0x3')]();var fs_extra=require(_0xfbe9('0x4'));var auth=require(_0xfbe9('0x5'));var interaction=require(_0xfbe9('0x6'));var config=require(_0xfbe9('0x7'));var controller=require(_0xfbe9('0x8'));router[_0xfbe9('0x9')]('/',auth[_0xfbe9('0xa')](),controller[_0xfbe9('0xb')]);router['get'](_0xfbe9('0xc'),auth[_0xfbe9('0xa')](),controller[_0xfbe9('0xd')]);router['post']('/',auth[_0xfbe9('0xa')](),controller[_0xfbe9('0xe')]);router['put'](_0xfbe9('0xc'),auth[_0xfbe9('0xa')](),controller[_0xfbe9('0xf')]);router[_0xfbe9('0x10')](_0xfbe9('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4815=['../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x349b5c,_0x55e5fa){var _0x3efcac=function(_0x27832d){while(--_0x27832d){_0x349b5c['push'](_0x349b5c['shift']());}};_0x3efcac(++_0x55e5fa);}(_0x4815,0x8a));var _0x5481=function(_0x4afafa,_0x203dc5){_0x4afafa=_0x4afafa-0x0;var _0x4dab93=_0x4815[_0x4afafa];return _0x4dab93;};'use strict';var multer=require(_0x5481('0x0'));var util=require(_0x5481('0x1'));var path=require(_0x5481('0x2'));var timeout=require(_0x5481('0x3'));var express=require(_0x5481('0x4'));var router=express[_0x5481('0x5')]();var fs_extra=require(_0x5481('0x6'));var auth=require(_0x5481('0x7'));var interaction=require(_0x5481('0x8'));var config=require(_0x5481('0x9'));var controller=require(_0x5481('0xa'));router[_0x5481('0xb')]('/',auth[_0x5481('0xc')](),controller[_0x5481('0xd')]);router['get'](_0x5481('0xe'),auth[_0x5481('0xc')](),controller['show']);router['post']('/',auth[_0x5481('0xc')](),controller[_0x5481('0xf')]);router[_0x5481('0x10')](_0x5481('0xe'),auth[_0x5481('0xc')](),controller[_0x5481('0x11')]);router[_0x5481('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5481('0x13')]);module[_0x5481('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7113bba..80645af 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 _0x9e47=['sequelize','exports','STRING','name'];(function(_0x49431e,_0x17699a){var _0x759cc0=function(_0x149f00){while(--_0x149f00){_0x49431e['push'](_0x49431e['shift']());}};_0x759cc0(++_0x17699a);}(_0x9e47,0xd4));var _0x79e4=function(_0x5433cc,_0x54c691){_0x5433cc=_0x5433cc-0x0;var _0x5cacd4=_0x9e47[_0x5433cc];return _0x5cacd4;};'use strict';var Sequelize=require(_0x79e4('0x0'));module[_0x79e4('0x1')]={'name':{'type':Sequelize[_0x79e4('0x2')],'unique':_0x79e4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x79e4('0x2')]}}; \ No newline at end of file +var _0x1032=['name','sequelize','STRING'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x1032,0x94));var _0x2103=function(_0x2256d2,_0x5c0398){_0x2256d2=_0x2256d2-0x0;var _0x9415fa=_0x1032[_0x2256d2];return _0x9415fa;};'use strict';var Sequelize=require(_0x2103('0x0'));module['exports']={'name':{'type':Sequelize[_0x2103('0x1')],'unique':_0x2103('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x2103('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 5c01de7..1d2bc79 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 _0xd9c1=['sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','role','user','UserProfileSection','userProfileId','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x111852,_0x26ffd5){var _0x427ad4=function(_0x48d911){while(--_0x48d911){_0x111852['push'](_0x111852['shift']());}};_0x427ad4(++_0x26ffd5);}(_0xd9c1,0x137));var _0x1d9c=function(_0xb5c31d,_0x504ba5){_0xb5c31d=_0xb5c31d-0x0;var _0x5e7cc4=_0xd9c1[_0xb5c31d];return _0x5e7cc4;};'use strict';var emlformat=require(_0x1d9c('0x0'));var rimraf=require(_0x1d9c('0x1'));var zipdir=require(_0x1d9c('0x2'));var jsonpatch=require(_0x1d9c('0x3'));var rp=require(_0x1d9c('0x4'));var moment=require('moment');var BPromise=require(_0x1d9c('0x5'));var Mustache=require(_0x1d9c('0x6'));var util=require(_0x1d9c('0x7'));var path=require(_0x1d9c('0x8'));var sox=require(_0x1d9c('0x9'));var csv=require('to-csv');var ejs=require(_0x1d9c('0xa'));var fs=require('fs');var fs_extra=require(_0x1d9c('0xb'));var _=require(_0x1d9c('0xc'));var squel=require('squel');var crypto=require(_0x1d9c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1d9c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d9c('0xf'));var Redis=require(_0x1d9c('0x10'));var authService=require(_0x1d9c('0x11'));var qs=require(_0x1d9c('0x12'));var as=require(_0x1d9c('0x13'));var hardwareService=require(_0x1d9c('0x14'));var logger=require(_0x1d9c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1d9c('0x16'));var licenseUtil=require(_0x1d9c('0x17'));var db=require(_0x1d9c('0x18'))['db'];function respondWithStatusCode(_0xbe65,_0x1cf1d9){_0x1cf1d9=_0x1cf1d9||0xcc;return function(_0x301122){if(_0x301122){return _0xbe65[_0x1d9c('0x19')](_0x1cf1d9);}return _0xbe65[_0x1d9c('0x1a')](_0x1cf1d9)['end']();};}function respondWithResult(_0x2e28fd,_0x25fafd){_0x25fafd=_0x25fafd||0xc8;return function(_0x3c55fc){if(_0x3c55fc){return _0x2e28fd[_0x1d9c('0x1a')](_0x25fafd)[_0x1d9c('0x1b')](_0x3c55fc);}};}function respondWithFilteredResult(_0x29e7b5,_0x3f6687){return function(_0x57fbba){if(_0x57fbba){var _0x766c51=typeof _0x3f6687['offset']==='undefined'&&typeof _0x3f6687[_0x1d9c('0x1c')]===_0x1d9c('0x1d');var _0x3b6a12=_0x57fbba[_0x1d9c('0x1e')];var _0x29cce5=_0x766c51?0x0:_0x3f6687['offset'];var _0x5da5d0=_0x766c51?_0x57fbba[_0x1d9c('0x1e')]:_0x3f6687[_0x1d9c('0x1f')]+_0x3f6687[_0x1d9c('0x1c')];var _0x159e77;if(_0x5da5d0>=_0x3b6a12){_0x5da5d0=_0x3b6a12;_0x159e77=0xc8;}else{_0x159e77=0xce;}_0x29e7b5[_0x1d9c('0x1a')](_0x159e77);return _0x29e7b5[_0x1d9c('0x20')](_0x1d9c('0x21'),_0x29cce5+'-'+_0x5da5d0+'/'+_0x3b6a12)[_0x1d9c('0x1b')](_0x57fbba);}return null;};}function patchUpdates(_0x26ce1f){return function(_0x46a639){try{jsonpatch[_0x1d9c('0x22')](_0x46a639,_0x26ce1f,!![]);}catch(_0x3146eb){return BPromise['reject'](_0x3146eb);}return _0x46a639[_0x1d9c('0x23')]();};}function saveUpdates(_0xac7797,_0x44639e){return function(_0xb124fa){if(_0xb124fa){return _0xb124fa['update'](_0xac7797)[_0x1d9c('0x24')](function(_0x5759db){return _0x5759db;});}return null;};}function removeEntity(_0x1b9b4b,_0x54bcd8){return function(_0xfa4b87){if(_0xfa4b87){return _0xfa4b87[_0x1d9c('0x25')]()['then'](function(){var _0xbd7d9=_0xfa4b87[_0x1d9c('0x26')]({'plain':!![]});var _0x111df8=_0x1d9c('0x27');return db[_0x1d9c('0x28')][_0x1d9c('0x25')]({'where':{'type':_0x111df8,'resourceId':_0xbd7d9['id']}})[_0x1d9c('0x24')](function(){return _0xfa4b87;});})[_0x1d9c('0x24')](function(){_0x1b9b4b[_0x1d9c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x429842,_0x186873){return function(_0x3927c9){if(!_0x3927c9){_0x429842['sendStatus'](0x194);}return _0x3927c9;};}function handleError(_0x28174d,_0x4789dc){_0x4789dc=_0x4789dc||0x1f4;return function(_0x9689ae){logger[_0x1d9c('0x29')](_0x9689ae[_0x1d9c('0x2a')]);if(_0x9689ae[_0x1d9c('0x2b')]){delete _0x9689ae['name'];}_0x28174d['status'](_0x4789dc)[_0x1d9c('0x2c')](_0x9689ae);};}exports[_0x1d9c('0x2d')]=function(_0x3ef7c7,_0x2e07ed){var _0x2934ad={},_0x202f17={},_0xcf8465={'count':0x0,'rows':[]};var _0x1e54a8=_[_0x1d9c('0x2e')](db[_0x1d9c('0x2f')][_0x1d9c('0x30')],function(_0x49d6a3){return{'name':_0x49d6a3[_0x1d9c('0x31')],'type':_0x49d6a3[_0x1d9c('0x32')][_0x1d9c('0x33')]};});_0x202f17[_0x1d9c('0x34')]=_['map'](_0x1e54a8,_0x1d9c('0x2b'));_0x202f17['query']=_[_0x1d9c('0x35')](_0x3ef7c7[_0x1d9c('0x36')]);_0x202f17[_0x1d9c('0x37')]=_[_0x1d9c('0x38')](_0x202f17[_0x1d9c('0x34')],_0x202f17['query']);_0x2934ad[_0x1d9c('0x39')]=_[_0x1d9c('0x38')](_0x202f17['model'],qs['fields'](_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x3a')]));_0x2934ad[_0x1d9c('0x39')]=_0x2934ad[_0x1d9c('0x39')][_0x1d9c('0x3b')]?_0x2934ad[_0x1d9c('0x39')]:_0x202f17['model'];if(!_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x3c')](_0x1d9c('0x3d'))){_0x2934ad['limit']=qs[_0x1d9c('0x1c')](_0x3ef7c7[_0x1d9c('0x36')]['limit']);_0x2934ad[_0x1d9c('0x1f')]=qs[_0x1d9c('0x1f')](_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x1f')]);}_0x2934ad[_0x1d9c('0x3e')]=qs['sort'](_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x3f')]);_0x2934ad[_0x1d9c('0x40')]=qs[_0x1d9c('0x37')](_['pick'](_0x3ef7c7[_0x1d9c('0x36')],_0x202f17[_0x1d9c('0x37')]),_0x1e54a8);if(_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x41')]){_0x2934ad['where']=_[_0x1d9c('0x42')](_0x2934ad[_0x1d9c('0x40')],{'$or':_[_0x1d9c('0x2e')](_0x1e54a8,function(_0x1cba31){if(_0x1cba31[_0x1d9c('0x32')]!==_0x1d9c('0x43')){var _0x36c90b={};_0x36c90b[_0x1cba31[_0x1d9c('0x2b')]]={'$like':'%'+_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x41')]+'%'};return _0x36c90b;}})});}_0x2934ad=_[_0x1d9c('0x42')]({},_0x2934ad,_0x3ef7c7[_0x1d9c('0x44')]);var _0x59910d={'where':_0x2934ad['where']};return db['Pause'][_0x1d9c('0x1e')](_0x59910d)[_0x1d9c('0x24')](function(_0x44413){_0xcf8465['count']=_0x44413;if(_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x45')]){_0x2934ad[_0x1d9c('0x46')]=[{'all':!![]}];}return db[_0x1d9c('0x2f')][_0x1d9c('0x47')](_0x2934ad);})[_0x1d9c('0x24')](function(_0x21d604){_0xcf8465[_0x1d9c('0x48')]=_0x21d604;return _0xcf8465;})[_0x1d9c('0x24')](respondWithFilteredResult(_0x2e07ed,_0x2934ad))[_0x1d9c('0x49')](handleError(_0x2e07ed,null));};exports[_0x1d9c('0x4a')]=function(_0x5904b9,_0x2e395c){var _0xdd8bef={'raw':!![],'where':{'id':_0x5904b9[_0x1d9c('0x4b')]['id']}},_0x554b3f={};_0x554b3f[_0x1d9c('0x34')]=_['keys'](db[_0x1d9c('0x2f')][_0x1d9c('0x30')]);_0x554b3f[_0x1d9c('0x36')]=_['keys'](_0x5904b9['query']);_0x554b3f[_0x1d9c('0x37')]=_[_0x1d9c('0x38')](_0x554b3f[_0x1d9c('0x34')],_0x554b3f[_0x1d9c('0x36')]);_0xdd8bef['attributes']=_['intersection'](_0x554b3f[_0x1d9c('0x34')],qs[_0x1d9c('0x3a')](_0x5904b9[_0x1d9c('0x36')][_0x1d9c('0x3a')]));_0xdd8bef[_0x1d9c('0x39')]=_0xdd8bef[_0x1d9c('0x39')][_0x1d9c('0x3b')]?_0xdd8bef[_0x1d9c('0x39')]:_0x554b3f[_0x1d9c('0x34')];if(_0x5904b9['query']['includeAll']){_0xdd8bef[_0x1d9c('0x46')]=[{'all':!![]}];}_0xdd8bef=_[_0x1d9c('0x42')]({},_0xdd8bef,_0x5904b9[_0x1d9c('0x44')]);return db[_0x1d9c('0x2f')][_0x1d9c('0x4c')](_0xdd8bef)[_0x1d9c('0x24')](handleEntityNotFound(_0x2e395c,null))[_0x1d9c('0x24')](respondWithResult(_0x2e395c,null))['catch'](handleError(_0x2e395c,null));};exports[_0x1d9c('0x4d')]=function(_0x467e63,_0x25820c){return db[_0x1d9c('0x2f')][_0x1d9c('0x4d')](_0x467e63['body'],{})[_0x1d9c('0x24')](function(_0x1a9fba){var _0x4e448e=_0x467e63['user']['get']({'plain':!![]});if(!_0x4e448e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e448e[_0x1d9c('0x4e')]===_0x1d9c('0x4f')){var _0x32a1f9=_0x1a9fba[_0x1d9c('0x26')]({'plain':!![]});var _0x12d516=_0x1d9c('0x27');return db[_0x1d9c('0x50')][_0x1d9c('0x4c')]({'where':{'name':_0x12d516,'userProfileId':_0x4e448e[_0x1d9c('0x51')]},'raw':!![]})[_0x1d9c('0x24')](function(_0xfdde3){if(_0xfdde3&&_0xfdde3['autoAssociation']===0x0){return db['UserProfileResource'][_0x1d9c('0x4d')]({'name':_0x32a1f9['name'],'resourceId':_0x32a1f9['id'],'type':_0xfdde3[_0x1d9c('0x2b')],'sectionId':_0xfdde3['id']},{})[_0x1d9c('0x24')](function(){return _0x1a9fba;});}else{return _0x1a9fba;}})['catch'](function(_0x28bbcb){logger[_0x1d9c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28bbcb);throw _0x28bbcb;});}return _0x1a9fba;})[_0x1d9c('0x24')](respondWithResult(_0x25820c,0xc9))['catch'](handleError(_0x25820c,null));};exports[_0x1d9c('0x52')]=function(_0x1e4482,_0x281686){if(_0x1e4482[_0x1d9c('0x53')]['id']){delete _0x1e4482[_0x1d9c('0x53')]['id'];}return db[_0x1d9c('0x2f')][_0x1d9c('0x4c')]({'where':{'id':_0x1e4482['params']['id']}})[_0x1d9c('0x24')](handleEntityNotFound(_0x281686,null))[_0x1d9c('0x24')](saveUpdates(_0x1e4482[_0x1d9c('0x53')],null))[_0x1d9c('0x24')](respondWithResult(_0x281686,null))['catch'](handleError(_0x281686,null));};exports[_0x1d9c('0x25')]=function(_0x1738f1,_0x36ffaa){return db[_0x1d9c('0x2f')]['find']({'where':{'id':_0x1738f1[_0x1d9c('0x4b')]['id']}})[_0x1d9c('0x24')](handleEntityNotFound(_0x36ffaa,null))['then'](removeEntity(_0x36ffaa,null))[_0x1d9c('0x49')](handleError(_0x36ffaa,null));}; \ No newline at end of file +var _0x3390=['request-promise','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','merge','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir'];(function(_0x3aaf97,_0x4fa2e8){var _0xeba75e=function(_0xf7f986){while(--_0xf7f986){_0x3aaf97['push'](_0x3aaf97['shift']());}};_0xeba75e(++_0x4fa2e8);}(_0x3390,0x175));var _0x0339=function(_0x55275a,_0x5c769b){_0x55275a=_0x55275a-0x0;var _0x45860a=_0x3390[_0x55275a];return _0x45860a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0339('0x0'));var zipdir=require(_0x0339('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0339('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0339('0x3'));var util=require('util');var path=require('path');var sox=require(_0x0339('0x4'));var csv=require(_0x0339('0x5'));var ejs=require(_0x0339('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0339('0x7'));var squel=require(_0x0339('0x8'));var crypto=require(_0x0339('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0339('0xa'));var toCsv=require(_0x0339('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0339('0xb'));var qs=require(_0x0339('0xc'));var as=require(_0x0339('0xd'));var hardwareService=require(_0x0339('0xe'));var logger=require(_0x0339('0xf'))(_0x0339('0x10'));var utils=require('../../config/utils');var config=require(_0x0339('0x11'));var licenseUtil=require(_0x0339('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e96c5,_0x4a3bc8){_0x4a3bc8=_0x4a3bc8||0xcc;return function(_0x14efb){if(_0x14efb){return _0x2e96c5[_0x0339('0x13')](_0x4a3bc8);}return _0x2e96c5['status'](_0x4a3bc8)['end']();};}function respondWithResult(_0x5cd124,_0x4de60c){_0x4de60c=_0x4de60c||0xc8;return function(_0x1b3002){if(_0x1b3002){return _0x5cd124[_0x0339('0x14')](_0x4de60c)[_0x0339('0x15')](_0x1b3002);}};}function respondWithFilteredResult(_0x568724,_0x436195){return function(_0x4785f3){if(_0x4785f3){var _0x276048=typeof _0x436195[_0x0339('0x16')]===_0x0339('0x17')&&typeof _0x436195[_0x0339('0x18')]===_0x0339('0x17');var _0x2ab91e=_0x4785f3[_0x0339('0x19')];var _0x1d4da0=_0x276048?0x0:_0x436195[_0x0339('0x16')];var _0x3a9669=_0x276048?_0x4785f3[_0x0339('0x19')]:_0x436195[_0x0339('0x16')]+_0x436195['limit'];var _0x16fbac;if(_0x3a9669>=_0x2ab91e){_0x3a9669=_0x2ab91e;_0x16fbac=0xc8;}else{_0x16fbac=0xce;}_0x568724['status'](_0x16fbac);return _0x568724['set'](_0x0339('0x1a'),_0x1d4da0+'-'+_0x3a9669+'/'+_0x2ab91e)[_0x0339('0x15')](_0x4785f3);}return null;};}function patchUpdates(_0x5575d0){return function(_0x3cbf33){try{jsonpatch[_0x0339('0x1b')](_0x3cbf33,_0x5575d0,!![]);}catch(_0x981f4d){return BPromise['reject'](_0x981f4d);}return _0x3cbf33[_0x0339('0x1c')]();};}function saveUpdates(_0x300756,_0x308a21){return function(_0x5bcdfb){if(_0x5bcdfb){return _0x5bcdfb[_0x0339('0x1d')](_0x300756)[_0x0339('0x1e')](function(_0x2d9992){return _0x2d9992;});}return null;};}function removeEntity(_0x115643,_0x19d262){return function(_0x4ceb06){if(_0x4ceb06){return _0x4ceb06[_0x0339('0x1f')]()[_0x0339('0x1e')](function(){var _0x247e31=_0x4ceb06[_0x0339('0x20')]({'plain':!![]});var _0x147f61=_0x0339('0x21');return db[_0x0339('0x22')][_0x0339('0x1f')]({'where':{'type':_0x147f61,'resourceId':_0x247e31['id']}})[_0x0339('0x1e')](function(){return _0x4ceb06;});})[_0x0339('0x1e')](function(){_0x115643[_0x0339('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfef446,_0x14cb31){return function(_0x115b8c){if(!_0x115b8c){_0xfef446[_0x0339('0x13')](0x194);}return _0x115b8c;};}function handleError(_0x3c7054,_0x30e7e2){_0x30e7e2=_0x30e7e2||0x1f4;return function(_0xcc3ba1){logger[_0x0339('0x23')](_0xcc3ba1[_0x0339('0x24')]);if(_0xcc3ba1[_0x0339('0x25')]){delete _0xcc3ba1[_0x0339('0x25')];}_0x3c7054[_0x0339('0x14')](_0x30e7e2)[_0x0339('0x26')](_0xcc3ba1);};}exports['index']=function(_0x2ee6e5,_0x24c445){var _0x3a3cdc={},_0x4904b4={},_0x2a8d82={'count':0x0,'rows':[]};var _0x1845cd=_[_0x0339('0x27')](db[_0x0339('0x28')][_0x0339('0x29')],function(_0x363159){return{'name':_0x363159[_0x0339('0x2a')],'type':_0x363159[_0x0339('0x2b')]['key']};});_0x4904b4[_0x0339('0x2c')]=_['map'](_0x1845cd,_0x0339('0x25'));_0x4904b4[_0x0339('0x2d')]=_['keys'](_0x2ee6e5[_0x0339('0x2d')]);_0x4904b4[_0x0339('0x2e')]=_[_0x0339('0x2f')](_0x4904b4[_0x0339('0x2c')],_0x4904b4[_0x0339('0x2d')]);_0x3a3cdc[_0x0339('0x30')]=_['intersection'](_0x4904b4[_0x0339('0x2c')],qs['fields'](_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x31')]));_0x3a3cdc['attributes']=_0x3a3cdc[_0x0339('0x30')][_0x0339('0x32')]?_0x3a3cdc['attributes']:_0x4904b4[_0x0339('0x2c')];if(!_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x33')](_0x0339('0x34'))){_0x3a3cdc[_0x0339('0x18')]=qs[_0x0339('0x18')](_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x18')]);_0x3a3cdc['offset']=qs['offset'](_0x2ee6e5['query'][_0x0339('0x16')]);}_0x3a3cdc['order']=qs[_0x0339('0x35')](_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x35')]);_0x3a3cdc[_0x0339('0x36')]=qs[_0x0339('0x2e')](_['pick'](_0x2ee6e5[_0x0339('0x2d')],_0x4904b4[_0x0339('0x2e')]),_0x1845cd);if(_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x37')]){_0x3a3cdc[_0x0339('0x36')]=_['merge'](_0x3a3cdc[_0x0339('0x36')],{'$or':_[_0x0339('0x27')](_0x1845cd,function(_0x3ecd76){if(_0x3ecd76[_0x0339('0x2b')]!==_0x0339('0x38')){var _0x3be031={};_0x3be031[_0x3ecd76['name']]={'$like':'%'+_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x37')]+'%'};return _0x3be031;}})});}_0x3a3cdc=_['merge']({},_0x3a3cdc,_0x2ee6e5[_0x0339('0x39')]);var _0x417fc0={'where':_0x3a3cdc[_0x0339('0x36')]};return db[_0x0339('0x28')][_0x0339('0x19')](_0x417fc0)[_0x0339('0x1e')](function(_0x24a564){_0x2a8d82[_0x0339('0x19')]=_0x24a564;if(_0x2ee6e5[_0x0339('0x2d')]['includeAll']){_0x3a3cdc[_0x0339('0x3a')]=[{'all':!![]}];}return db[_0x0339('0x28')][_0x0339('0x3b')](_0x3a3cdc);})['then'](function(_0x11d238){_0x2a8d82['rows']=_0x11d238;return _0x2a8d82;})[_0x0339('0x1e')](respondWithFilteredResult(_0x24c445,_0x3a3cdc))[_0x0339('0x3c')](handleError(_0x24c445,null));};exports[_0x0339('0x3d')]=function(_0x49b543,_0x2e7e4e){var _0x1d6667={'raw':!![],'where':{'id':_0x49b543[_0x0339('0x3e')]['id']}},_0x1a9cd7={};_0x1a9cd7['model']=_['keys'](db[_0x0339('0x28')][_0x0339('0x29')]);_0x1a9cd7[_0x0339('0x2d')]=_[_0x0339('0x3f')](_0x49b543[_0x0339('0x2d')]);_0x1a9cd7[_0x0339('0x2e')]=_['intersection'](_0x1a9cd7[_0x0339('0x2c')],_0x1a9cd7[_0x0339('0x2d')]);_0x1d6667[_0x0339('0x30')]=_[_0x0339('0x2f')](_0x1a9cd7[_0x0339('0x2c')],qs[_0x0339('0x31')](_0x49b543[_0x0339('0x2d')]['fields']));_0x1d6667[_0x0339('0x30')]=_0x1d6667['attributes'][_0x0339('0x32')]?_0x1d6667['attributes']:_0x1a9cd7[_0x0339('0x2c')];if(_0x49b543[_0x0339('0x2d')][_0x0339('0x40')]){_0x1d6667['include']=[{'all':!![]}];}_0x1d6667=_[_0x0339('0x41')]({},_0x1d6667,_0x49b543[_0x0339('0x39')]);return db[_0x0339('0x28')]['find'](_0x1d6667)[_0x0339('0x1e')](handleEntityNotFound(_0x2e7e4e,null))[_0x0339('0x1e')](respondWithResult(_0x2e7e4e,null))[_0x0339('0x3c')](handleError(_0x2e7e4e,null));};exports[_0x0339('0x42')]=function(_0x396dea,_0x53b1c4){return db[_0x0339('0x28')][_0x0339('0x42')](_0x396dea[_0x0339('0x43')],{})['then'](function(_0x2d9d44){var _0x3e269c=_0x396dea[_0x0339('0x44')][_0x0339('0x20')]({'plain':!![]});if(!_0x3e269c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e269c[_0x0339('0x45')]===_0x0339('0x44')){var _0x1defdc=_0x2d9d44[_0x0339('0x20')]({'plain':!![]});var _0x461c36=_0x0339('0x21');return db[_0x0339('0x46')][_0x0339('0x47')]({'where':{'name':_0x461c36,'userProfileId':_0x3e269c[_0x0339('0x48')]},'raw':!![]})[_0x0339('0x1e')](function(_0x67325d){if(_0x67325d&&_0x67325d[_0x0339('0x49')]===0x0){return db[_0x0339('0x22')][_0x0339('0x42')]({'name':_0x1defdc['name'],'resourceId':_0x1defdc['id'],'type':_0x67325d[_0x0339('0x25')],'sectionId':_0x67325d['id']},{})[_0x0339('0x1e')](function(){return _0x2d9d44;});}else{return _0x2d9d44;}})[_0x0339('0x3c')](function(_0x14a468){logger[_0x0339('0x23')](_0x0339('0x4a'),_0x14a468);throw _0x14a468;});}return _0x2d9d44;})[_0x0339('0x1e')](respondWithResult(_0x53b1c4,0xc9))['catch'](handleError(_0x53b1c4,null));};exports[_0x0339('0x1d')]=function(_0x31fbab,_0x3aab65){if(_0x31fbab['body']['id']){delete _0x31fbab[_0x0339('0x43')]['id'];}return db[_0x0339('0x28')]['find']({'where':{'id':_0x31fbab[_0x0339('0x3e')]['id']}})[_0x0339('0x1e')](handleEntityNotFound(_0x3aab65,null))[_0x0339('0x1e')](saveUpdates(_0x31fbab[_0x0339('0x43')],null))[_0x0339('0x1e')](respondWithResult(_0x3aab65,null))[_0x0339('0x3c')](handleError(_0x3aab65,null));};exports['destroy']=function(_0x4c8b3b,_0x282f06){return db[_0x0339('0x28')][_0x0339('0x47')]({'where':{'id':_0x4c8b3b[_0x0339('0x3e')]['id']}})[_0x0339('0x1e')](handleEntityNotFound(_0x282f06,null))[_0x0339('0x1e')](removeEntity(_0x282f06,null))['catch'](handleError(_0x282f06,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ef41ee0..823bbfe 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1cd5b1,_0x58dd23){_0x1cd5b1=_0x1cd5b1-0x0;var _0x25b4c7=_0x7fbe[_0x1cd5b1];return _0x25b4c7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 428ad2e..1d0d52e 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x1ce210,_0x32e6ba){var _0x452b3d=function(_0x27ea63){while(--_0x27ea63){_0x1ce210['push'](_0x1ce210['shift']());}};_0x452b3d(++_0x32e6ba);}(_0xb10b,0x12a));var _0xbb10=function(_0x4cdf87,_0x200caf){_0x4cdf87=_0x4cdf87-0x0;var _0x14d49d=_0xb10b[_0x4cdf87];return _0x14d49d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x3960aa,_0x42b864){var _0x57da0f=function(_0x348661){while(--_0x348661){_0x3960aa['push'](_0x3960aa['shift']());}};_0x57da0f(++_0x42b864);}(_0x7a54,0x106));var _0x47a5=function(_0x559f57,_0x29591f){_0x559f57=_0x559f57-0x0;var _0x4f6332=_0x7a54[_0x559f57];return _0x4f6332;};'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 05f2da9..def0029 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 _0xbec5=['get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','upload','webhookPost','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller'];(function(_0x4e88e3,_0x5282c5){var _0x3183c5=function(_0x2909b3){while(--_0x2909b3){_0x4e88e3['push'](_0x4e88e3['shift']());}};_0x3183c5(++_0x5282c5);}(_0xbec5,0xe5));var _0x5bec=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0xbec5[_0x879e31];return _0x3467e8;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),controller[_0x5bec('0xc')]);router[_0x5bec('0x9')](_0x5bec('0xd'),auth[_0x5bec('0xe')](),controller[_0x5bec('0xf')]);router['get'](_0x5bec('0x10'),auth['isAuthenticated'](),controller[_0x5bec('0x11')]);var upload=multer({'storage':multer[_0x5bec('0x12')]({'destination':function(_0x117162,_0x4a5482,_0x288d1b){_0x288d1b(null,path[_0x5bec('0x13')](config[_0x5bec('0x14')],'server/files/plugins'));},'filename':function(_0x6bee21,_0x1c888f,_0x589d14){_0x1c888f[_0x5bec('0x15')]=_0x1c888f[_0x5bec('0x15')][_0x5bec('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x589d14(null,util[_0x5bec('0x17')](_0x5bec('0x18'),path[_0x5bec('0x19')](_0x1c888f[_0x5bec('0x15')],path[_0x5bec('0x1a')](_0x1c888f[_0x5bec('0x15')])),Date[_0x5bec('0x1b')](),path[_0x5bec('0x1a')](_0x1c888f[_0x5bec('0x15')])));}})});router[_0x5bec('0x1c')]('/',upload['single']('file'),controller[_0x5bec('0x1d')]);router[_0x5bec('0x1c')](_0x5bec('0xb'),controller[_0x5bec('0x1e')]);router['put']('/:id',auth[_0x5bec('0xe')](),controller[_0x5bec('0x1f')]);router['delete'](_0x5bec('0xd'),auth[_0x5bec('0xe')](),controller[_0x5bec('0x20')]);module[_0x5bec('0x21')]=router; \ No newline at end of file +var _0x222f=['index','webhookGet','isAuthenticated','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','extname','now','post','single','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0x222f,0x1a4));var _0xf222=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0x222f[_0x4d8dc3];return _0x9b03d9;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf222('0x4'));var auth=require(_0xf222('0x5'));var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require('./plugin.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/webhook',controller[_0xf222('0xa')]);router[_0xf222('0x8')]('/:id',auth[_0xf222('0xb')](),controller[_0xf222('0xc')]);router[_0xf222('0x8')](_0xf222('0xd'),auth[_0xf222('0xb')](),controller[_0xf222('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e29ad,_0x405080,_0x226dbd){_0x226dbd(null,path[_0xf222('0xf')](config['root'],_0xf222('0x10')));},'filename':function(_0x2850c7,_0x2a6965,_0x3d3d29){_0x2a6965[_0xf222('0x11')]=_0x2a6965[_0xf222('0x11')][_0xf222('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d3d29(null,util[_0xf222('0x13')]('%s-%s%s',path['basename'](_0x2a6965[_0xf222('0x11')],path[_0xf222('0x14')](_0x2a6965['originalname'])),Date[_0xf222('0x15')](),path[_0xf222('0x14')](_0x2a6965[_0xf222('0x11')])));}})});router[_0xf222('0x16')]('/',upload[_0xf222('0x17')](_0xf222('0x18')),controller[_0xf222('0x19')]);router['post'](_0xf222('0x1a'),controller[_0xf222('0x1b')]);router[_0xf222('0x1c')](_0xf222('0x1d'),auth[_0xf222('0xb')](),controller[_0xf222('0x1e')]);router[_0xf222('0x1f')]('/:id',auth[_0xf222('0xb')](),controller[_0xf222('0x1f')]);module[_0xf222('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 32d2137..f917bf9 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 _0x61e8=['html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','ENUM'];(function(_0xcd76ee,_0x345953){var _0x289064=function(_0x1e7957){while(--_0x1e7957){_0xcd76ee['push'](_0xcd76ee['shift']());}};_0x289064(++_0x345953);}(_0x61e8,0x18f));var _0x861e=function(_0x312bd4,_0x4cce7b){_0x312bd4=_0x312bd4-0x0;var _0x2f5d6b=_0x61e8[_0x312bd4];return _0x2f5d6b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x861e('0x0')](_0x861e('0x1'),_0x861e('0x2'))},'description':{'type':Sequelize[_0x861e('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x861e('0x4')],'comment':_0x861e('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x861e('0x6')},'sidebar':{'type':Sequelize[_0x861e('0x0')]('adminOnly','agentOnly',_0x861e('0x7'),'never'),'defaultValue':_0x861e('0x7'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x861e('0x4')]},'adminUrl':{'type':Sequelize[_0x861e('0x4')]},'agentUrl':{'type':Sequelize[_0x861e('0x4')]},'scriptName':{'type':Sequelize[_0x861e('0x4')]},'scriptPath':{'type':Sequelize[_0x861e('0x4')]}}; \ No newline at end of file +var _0x4971=['sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x2da61e,_0x8bf68f){var _0x5b9c75=function(_0x51a89e){while(--_0x51a89e){_0x2da61e['push'](_0x2da61e['shift']());}};_0x5b9c75(++_0x8bf68f);}(_0x4971,0x82));var _0x1497=function(_0xef4ef0,_0x3c72f9){_0xef4ef0=_0xef4ef0-0x0;var _0x39b60b=_0x4971[_0xef4ef0];return _0x39b60b;};'use strict';var Sequelize=require(_0x1497('0x0'));module['exports']={'name':{'type':Sequelize[_0x1497('0x1')]},'type':{'type':Sequelize[_0x1497('0x2')](_0x1497('0x3'),_0x1497('0x4'))},'description':{'type':Sequelize[_0x1497('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x1497('0x1')],'comment':_0x1497('0x6')},'active':{'type':Sequelize[_0x1497('0x7')],'defaultValue':0x0,'comment':_0x1497('0x8')},'sidebar':{'type':Sequelize[_0x1497('0x2')]('adminOnly',_0x1497('0x9'),_0x1497('0xa'),_0x1497('0xb')),'defaultValue':_0x1497('0xa'),'comment':_0x1497('0xc')},'icon':{'type':Sequelize[_0x1497('0x1')]},'adminUrl':{'type':Sequelize[_0x1497('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x1497('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 450c919..e76ff9e 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 _0x2a60=['zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','join','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','lstatSync','isFile','Invalid\x20plugin\x20structure','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','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','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-type','endsWith','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','content-length','statusCode','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','offset','undefined','count','set','json','apply','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','intersection','options','find','catch','download','params','root','server/files/plugins','format','basename','createWriteStream'];(function(_0x2375e1,_0x3d125a){var _0x2ccc7d=function(_0x343bb6){while(--_0x343bb6){_0x2375e1['push'](_0x2375e1['shift']());}};_0x2ccc7d(++_0x3d125a);}(_0x2a60,0x1b9));var _0x02a6=function(_0x5ee175,_0x547ff2){_0x5ee175=_0x5ee175-0x0;var _0x325634=_0x2a60[_0x5ee175];return _0x325634;};'use strict';var emlformat=require(_0x02a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x02a6('0x1'));var rp=require('request-promise');var moment=require(_0x02a6('0x2'));var BPromise=require(_0x02a6('0x3'));var Mustache=require(_0x02a6('0x4'));var util=require(_0x02a6('0x5'));var path=require(_0x02a6('0x6'));var sox=require(_0x02a6('0x7'));var csv=require(_0x02a6('0x8'));var ejs=require(_0x02a6('0x9'));var fs=require('fs');var fs_extra=require(_0x02a6('0xa'));var _=require(_0x02a6('0xb'));var squel=require('squel');var crypto=require(_0x02a6('0xc'));var jsforce=require(_0x02a6('0xd'));var deskjs=require(_0x02a6('0xe'));var toCsv=require(_0x02a6('0x8'));var querystring=require(_0x02a6('0xf'));var Papa=require(_0x02a6('0x10'));var extract=require(_0x02a6('0x11'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x02a6('0x12'));var authService=require(_0x02a6('0x13'));var qs=require(_0x02a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x02a6('0x15'));var utils=require(_0x02a6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x02a6('0x17'));var db=require(_0x02a6('0x18'))['db'];config['redis']=_[_0x02a6('0x19')](config[_0x02a6('0x1a')],{'host':_0x02a6('0x1b'),'port':0x18eb});var socket=require(_0x02a6('0x1c'))(new Redis(config[_0x02a6('0x1a')]));require('./plugin.socket')[_0x02a6('0x1d')](socket);function respondWithStatusCode(_0x585a9b,_0x3b6e7a){_0x3b6e7a=_0x3b6e7a||0xcc;return function(_0x457fef){if(_0x457fef){return _0x585a9b['sendStatus'](_0x3b6e7a);}return _0x585a9b[_0x02a6('0x1e')](_0x3b6e7a)[_0x02a6('0x1f')]();};}function respondWithResult(_0xab90d,_0x32fa70){_0x32fa70=_0x32fa70||0xc8;return function(_0x52f199){if(_0x52f199){return _0xab90d[_0x02a6('0x1e')](_0x32fa70)['json'](_0x52f199);}};}function respondWithFilteredResult(_0x4f6cbe,_0x4be296){return function(_0xc018d6){if(_0xc018d6){var _0x3ab24b=typeof _0x4be296[_0x02a6('0x20')]===_0x02a6('0x21')&&typeof _0x4be296['limit']===_0x02a6('0x21');var _0x4f61d3=_0xc018d6[_0x02a6('0x22')];var _0x404e69=_0x3ab24b?0x0:_0x4be296[_0x02a6('0x20')];var _0xd5af0d=_0x3ab24b?_0xc018d6['count']:_0x4be296[_0x02a6('0x20')]+_0x4be296['limit'];var _0x534c9a;if(_0xd5af0d>=_0x4f61d3){_0xd5af0d=_0x4f61d3;_0x534c9a=0xc8;}else{_0x534c9a=0xce;}_0x4f6cbe[_0x02a6('0x1e')](_0x534c9a);return _0x4f6cbe[_0x02a6('0x23')]('Content-Range',_0x404e69+'-'+_0xd5af0d+'/'+_0x4f61d3)[_0x02a6('0x24')](_0xc018d6);}return null;};}function patchUpdates(_0x24c583){return function(_0x223a59){try{jsonpatch[_0x02a6('0x25')](_0x223a59,_0x24c583,!![]);}catch(_0x31c5a7){return BPromise['reject'](_0x31c5a7);}return _0x223a59['save']();};}function saveUpdates(_0xa0df64,_0x16060a){return function(_0x2d5f58){if(_0x2d5f58){return _0x2d5f58[_0x02a6('0x26')](_0xa0df64)[_0x02a6('0x27')](function(_0x12f6d3){return _0x12f6d3;});}return null;};}function removeEntity(_0x1cf849,_0x4ddfad){return function(_0x2dd259){if(_0x2dd259){return _0x2dd259[_0x02a6('0x28')]()['then'](function(){var _0x10e6a8=_0x2dd259[_0x02a6('0x29')]({'plain':!![]});var _0x1be690='Plugins';return db[_0x02a6('0x2a')][_0x02a6('0x28')]({'where':{'type':_0x1be690,'resourceId':_0x10e6a8['id']}})[_0x02a6('0x27')](function(){return _0x2dd259;});})[_0x02a6('0x27')](function(){_0x1cf849[_0x02a6('0x1e')](0xcc)[_0x02a6('0x1f')]();});}};}function handleEntityNotFound(_0x235422,_0x561bb9){return function(_0x46268a){if(!_0x46268a){_0x235422[_0x02a6('0x2b')](0x194);}return _0x46268a;};}function handleError(_0x508039,_0x470fc6){_0x470fc6=_0x470fc6||0x1f4;return function(_0x3d7aad){logger[_0x02a6('0x2c')](_0x3d7aad[_0x02a6('0x2d')]);if(_0x3d7aad['name']){delete _0x3d7aad[_0x02a6('0x2e')];}_0x508039[_0x02a6('0x1e')](_0x470fc6)[_0x02a6('0x2f')](_0x3d7aad);};}exports[_0x02a6('0x30')]=function(_0x435c0a,_0x2622e8){var _0x16eadb={},_0x59e056={},_0x3b78e5={'count':0x0,'rows':[]};var _0x5d2acc=_[_0x02a6('0x31')](db[_0x02a6('0x32')][_0x02a6('0x33')],function(_0x56b6e1){return{'name':_0x56b6e1[_0x02a6('0x34')],'type':_0x56b6e1[_0x02a6('0x35')]['key']};});_0x59e056['model']=_[_0x02a6('0x31')](_0x5d2acc,'name');_0x59e056[_0x02a6('0x36')]=_[_0x02a6('0x37')](_0x435c0a[_0x02a6('0x36')]);_0x59e056[_0x02a6('0x38')]=_['intersection'](_0x59e056[_0x02a6('0x39')],_0x59e056['query']);_0x16eadb[_0x02a6('0x3a')]=_['intersection'](_0x59e056[_0x02a6('0x39')],qs[_0x02a6('0x3b')](_0x435c0a[_0x02a6('0x36')][_0x02a6('0x3b')]));_0x16eadb[_0x02a6('0x3a')]=_0x16eadb[_0x02a6('0x3a')][_0x02a6('0x3c')]?_0x16eadb[_0x02a6('0x3a')]:_0x59e056['model'];if(!_0x435c0a[_0x02a6('0x36')][_0x02a6('0x3d')](_0x02a6('0x3e'))){_0x16eadb['limit']=qs[_0x02a6('0x3f')](_0x435c0a[_0x02a6('0x36')]['limit']);_0x16eadb[_0x02a6('0x20')]=qs['offset'](_0x435c0a[_0x02a6('0x36')]['offset']);}_0x16eadb[_0x02a6('0x40')]=qs['sort'](_0x435c0a['query'][_0x02a6('0x41')]);_0x16eadb[_0x02a6('0x42')]=qs[_0x02a6('0x38')](_[_0x02a6('0x43')](_0x435c0a[_0x02a6('0x36')],_0x59e056[_0x02a6('0x38')]),_0x5d2acc);if(_0x435c0a['query']['filter']){_0x16eadb['where']=_[_0x02a6('0x44')](_0x16eadb[_0x02a6('0x42')],{'$or':_['map'](_0x5d2acc,function(_0x235d7b){if(_0x235d7b[_0x02a6('0x35')]!==_0x02a6('0x45')){var _0x18738f={};_0x18738f[_0x235d7b['name']]={'$like':'%'+_0x435c0a[_0x02a6('0x36')][_0x02a6('0x46')]+'%'};return _0x18738f;}})});}_0x16eadb=_[_0x02a6('0x44')]({},_0x16eadb,_0x435c0a['options']);var _0xc8c8d9={'where':_0x16eadb[_0x02a6('0x42')]};return db['Plugin']['count'](_0xc8c8d9)[_0x02a6('0x27')](function(_0x457ac3){_0x3b78e5[_0x02a6('0x22')]=_0x457ac3;if(_0x435c0a[_0x02a6('0x36')][_0x02a6('0x47')]){_0x16eadb[_0x02a6('0x48')]=[{'all':!![]}];}return db[_0x02a6('0x32')][_0x02a6('0x49')](_0x16eadb);})['then'](function(_0x78111d){_0x3b78e5[_0x02a6('0x4a')]=_0x78111d;return _0x3b78e5;})[_0x02a6('0x27')](respondWithFilteredResult(_0x2622e8,_0x16eadb))['catch'](handleError(_0x2622e8,null));};exports[_0x02a6('0x4b')]=function(_0x3868e4,_0x4ec1a6){var _0x49e069={'raw':!![],'where':{'id':_0x3868e4['params']['id']}},_0x4512a6={};_0x4512a6[_0x02a6('0x39')]=_['keys'](db[_0x02a6('0x32')][_0x02a6('0x33')]);_0x4512a6[_0x02a6('0x36')]=_[_0x02a6('0x37')](_0x3868e4[_0x02a6('0x36')]);_0x4512a6[_0x02a6('0x38')]=_[_0x02a6('0x4c')](_0x4512a6[_0x02a6('0x39')],_0x4512a6[_0x02a6('0x36')]);_0x49e069[_0x02a6('0x3a')]=_['intersection'](_0x4512a6[_0x02a6('0x39')],qs[_0x02a6('0x3b')](_0x3868e4[_0x02a6('0x36')][_0x02a6('0x3b')]));_0x49e069[_0x02a6('0x3a')]=_0x49e069[_0x02a6('0x3a')]['length']?_0x49e069[_0x02a6('0x3a')]:_0x4512a6[_0x02a6('0x39')];if(_0x3868e4[_0x02a6('0x36')][_0x02a6('0x47')]){_0x49e069[_0x02a6('0x48')]=[{'all':!![]}];}_0x49e069=_[_0x02a6('0x44')]({},_0x49e069,_0x3868e4[_0x02a6('0x4d')]);return db['Plugin'][_0x02a6('0x4e')](_0x49e069)[_0x02a6('0x27')](handleEntityNotFound(_0x4ec1a6,null))[_0x02a6('0x27')](respondWithResult(_0x4ec1a6,null))[_0x02a6('0x4f')](handleError(_0x4ec1a6,null));};exports[_0x02a6('0x50')]=function(_0x32cd8c,_0x9d578a,_0x5123d5){return db[_0x02a6('0x32')][_0x02a6('0x4e')]({'where':{'id':_0x32cd8c[_0x02a6('0x51')]['id']},'attributes':[_0x02a6('0x2e'),_0x02a6('0x6')],'raw':!![]})[_0x02a6('0x27')](handleEntityNotFound(_0x9d578a,null))['then'](function(_0x37c0f3){if(_0x37c0f3){var _0x1e335c=path['join'](config[_0x02a6('0x52')],_0x02a6('0x53'),util[_0x02a6('0x54')]('%s.zip',path[_0x02a6('0x55')](_0x37c0f3[_0x02a6('0x6')])));var _0xfeba4a=fs[_0x02a6('0x56')](_0x1e335c);var _0x1c2ac5=archiver(_0x02a6('0x57'),{'zlib':{'level':0x9}});_0x1c2ac5['on'](_0x02a6('0x58'),function(_0x275bb1){if(_0x275bb1[_0x02a6('0x59')]===_0x02a6('0x5a')){logger[_0x02a6('0x2c')](_0x275bb1);}else{throw new db[(_0x02a6('0x5b'))][(_0x02a6('0x5c'))](_0x02a6('0x5d'));}});_0x1c2ac5['on']('error',function(_0xf88d28){throw new db[(_0x02a6('0x5b'))][(_0x02a6('0x5c'))](_0x02a6('0x5d'));});_0x1c2ac5[_0x02a6('0x5e')](_0xfeba4a);_0x1c2ac5[_0x02a6('0x5f')]('**/*',{'cwd':path[_0x02a6('0x60')](config[_0x02a6('0x52')],_0x02a6('0x53'),path[_0x02a6('0x61')](_0x37c0f3[_0x02a6('0x6')])),'ignore':[path[_0x02a6('0x60')](path[_0x02a6('0x55')](_0x37c0f3[_0x02a6('0x6')]),_0x02a6('0x62')),path['join'](path[_0x02a6('0x55')](_0x37c0f3['path']),_0x02a6('0x63'))],'nodir':!![]})[_0x02a6('0x64')]();_0xfeba4a['on']('close',function(){if(!fs[_0x02a6('0x65')](_0x1e335c)){throw new db[(_0x02a6('0x5b'))][(_0x02a6('0x5c'))](_0x02a6('0x66'));}return _0x9d578a['download'](_0x1e335c,util[_0x02a6('0x54')](_0x02a6('0x67'),path[_0x02a6('0x55')](_0x37c0f3[_0x02a6('0x6')])),function(_0x22eccb){if(_0x22eccb){throw new db[(_0x02a6('0x5b'))]['Error'](_0x02a6('0x68'));}fs['unlinkSync'](_0x1e335c);logger[_0x02a6('0x69')](_0x02a6('0x6a'));logger[_0x02a6('0x69')](_0x02a6('0x6b'));});});}return null;})[_0x02a6('0x4f')](handleError(_0x9d578a,null));};exports[_0x02a6('0x6c')]=function(_0x26cd55,_0xb24f3c,_0x367a9a){var _0x48220d=path['basename'](_0x26cd55['file'][_0x02a6('0x6d')],path[_0x02a6('0x6e')](_0x26cd55['file'][_0x02a6('0x6d')]));var _0x3511aa=path[_0x02a6('0x60')](config[_0x02a6('0x52')],'server/files/plugins',_0x26cd55[_0x02a6('0x6f')][_0x02a6('0x6d')]);var _0x1ef8fb=path['join'](config['root'],_0x02a6('0x53'),_0x48220d);logger['info'](_0x02a6('0x70'),_0x3511aa);logger[_0x02a6('0x69')](_0x02a6('0x71'),_0x1ef8fb);try{fs[_0x02a6('0x72')](_0x3511aa,parseInt(_0x02a6('0x73'),0x8));extract(_0x3511aa,{'dir':_0x1ef8fb},function(_0x6a5d5a){if(_0x6a5d5a){logger['error'](_0x6a5d5a);handleError(_0x6a5d5a,!![]);};var _0x5ef091=fs['readdirSync'](_0x1ef8fb);if(_0x5ef091['length']>0x1){removeReferences(_0x3511aa,_0x1ef8fb);logger['error']('Invalid\x20plugin\x20structure');return _0x367a9a(new Error('Invalid\x20plugin\x20structure'));}var _0x5dea0e=fs[_0x02a6('0x74')](path['join'](_0x1ef8fb,_0x5ef091[0x0]));if(_0x5dea0e[_0x02a6('0x75')]()){removeReferences(_0x3511aa,_0x1ef8fb);logger[_0x02a6('0x2c')](_0x02a6('0x76'));return _0x367a9a(new Error(_0x02a6('0x76')));}if(_0x5dea0e[_0x02a6('0x77')]()){var _0x3e3a67=fs[_0x02a6('0x78')](path['join'](_0x1ef8fb,_0x5ef091[0x0]));if(_0x3e3a67[_0x02a6('0x3c')]===0x0){removeReferences(_0x3511aa,_0x1ef8fb);logger['error'](_0x02a6('0x76'));return _0x367a9a(new Error(_0x02a6('0x76')));}var _0x12c5b2=_0x3e3a67[_0x02a6('0x79')](function(_0x971063){return _0x971063==='manifest.json';});if(!_0x12c5b2){return _0x367a9a(new Error(_0x02a6('0x7a')));}var _0x20b2f2=fs[_0x02a6('0x7b')](path[_0x02a6('0x60')](_0x1ef8fb,_0x5ef091[0x0],'manifest.json'));var _0x1e2a65=JSON[_0x02a6('0x7c')](_0x20b2f2);if(_0x02a6('0x21')==typeof _0x1e2a65[_0x02a6('0x2e')]){return _0x367a9a(new Error(_0x02a6('0x7d')));}if('undefined'==typeof _0x1e2a65['type']){return _0x367a9a(new Error(_0x02a6('0x7e')));}if(_0x02a6('0x21')==typeof _0x1e2a65[_0x02a6('0x7f')]){return _0x367a9a(new Error(_0x02a6('0x80')));}if(_0x02a6('0x21')==typeof _0x1e2a65[_0x02a6('0x81')]){return _0x367a9a(new Error(_0x02a6('0x82')));}if(_0x1e2a65[_0x02a6('0x35')]==='html'){if(_0x02a6('0x21')==typeof _0x1e2a65['parameters'][_0x02a6('0x83')]){return _0x367a9a(new Error(_0x02a6('0x84')));}if(_0x02a6('0x21')==typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x85')]&&_0x02a6('0x21')==typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x86')]){return _0x367a9a(new Error(_0x02a6('0x87')));}}else if(_0x1e2a65[_0x02a6('0x35')]==='script'){if('undefined'==typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x88')]){return _0x367a9a(new Error(_0x02a6('0x89')));}if(_0x02a6('0x21')==typeof _0x1e2a65['parameters'][_0x02a6('0x8a')]){return _0x367a9a(new Error(_0x02a6('0x8b')));}}else{return _0x367a9a(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x282043=_0x1e2a65['name'];var _0x174b81=_0x1e2a65[_0x02a6('0x8c')];var _0x55e1cd=_0x1e2a65[_0x02a6('0x35')];var _0x11afb2=_0x1e2a65[_0x02a6('0x8d')]?_0x1e2a65['sidebar']:_0x02a6('0x8e');var _0x36482a=_0x1e2a65[_0x02a6('0x8f')]?_0x1e2a65[_0x02a6('0x8f')]:_0x02a6('0x90');var _0x1af9ce='';var _0x333ae4='';var _0x34da5a='';var _0x3e6818='';var _0x45b6ee=_0x1e2a65[_0x02a6('0x7f')];if(_0x55e1cd==='html'){if(_0x02a6('0x21')!=typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')]['admin']){var _0x20df23=_0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x02a6('0x91')](_0x20df23)){_0x1af9ce=path[_0x02a6('0x60')](_0x02a6('0x92'),_0x48220d,_0x5ef091[0x0],_0x20df23);}else{_0x1af9ce=_0x20df23;}}else{logger[_0x02a6('0x69')](_0x02a6('0x93'));}if('undefined'!=typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x86')]){var _0x4a34d3=_0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x86')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4a34d3)){_0x333ae4=path[_0x02a6('0x60')]('plugins',_0x48220d,_0x5ef091[0x0],_0x4a34d3);}else{_0x333ae4=_0x4a34d3;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x55e1cd==='script'){_0x34da5a=_0x1e2a65[_0x02a6('0x81')]['scriptName'];_0x3e6818=_0x1e2a65['parameters'][_0x02a6('0x8a')];if(_0x02a6('0x21')!=typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')]){if('undefined'!=typeof _0x1e2a65['parameters'][_0x02a6('0x83')][_0x02a6('0x85')]){var _0x20df23=_0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x02a6('0x91')](_0x20df23)){_0x1af9ce=path[_0x02a6('0x60')](_0x02a6('0x92'),_0x48220d,_0x5ef091[0x0],_0x20df23);}else{_0x1af9ce=_0x20df23;}}if(_0x02a6('0x21')!=typeof _0x1e2a65[_0x02a6('0x81')]['views'][_0x02a6('0x86')]){var _0x4a34d3=_0x1e2a65['parameters'][_0x02a6('0x83')][_0x02a6('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x02a6('0x91')](_0x4a34d3)){_0x333ae4=path[_0x02a6('0x60')](_0x02a6('0x92'),_0x48220d,_0x5ef091[0x0],_0x4a34d3);}else{_0x333ae4=_0x4a34d3;}}}}var _0x9f1cee={'name':_0x282043,'description':_0x174b81,'path':path[_0x02a6('0x60')](_0x48220d,_0x5ef091[0x0]),'type':_0x55e1cd,'sidebar':_0x11afb2,'icon':_0x36482a,'adminUrl':_0x1af9ce,'agentUrl':_0x333ae4,'scriptName':_0x34da5a,'scriptPath':_0x3e6818,'version':_0x45b6ee};removeReferences(_0x3511aa,null);return db['Plugin']['create'](_0x9f1cee)[_0x02a6('0x27')](function(_0x316127){var _0x2088a9={'role':_0x26cd55[_0x02a6('0x94')][_0x02a6('0x95')],'userProfileId':_0x26cd55[_0x02a6('0x94')][_0x02a6('0x96')]};if(!_0x2088a9)throw new Error(_0x02a6('0x97'));if(_0x2088a9[_0x02a6('0x95')]===_0x02a6('0x98')){var _0xe734bd=_0x316127['get']({'plain':!![]});return db[_0x02a6('0x99')][_0x02a6('0x4e')]({'where':{'name':_0x02a6('0x9a'),'userProfileId':_0x2088a9['userProfileId']},'raw':!![]})[_0x02a6('0x27')](function(_0x3cc436){if(_0x3cc436&&_0x3cc436[_0x02a6('0x9b')]===0x0){return db['UserProfileResource'][_0x02a6('0x9c')]({'name':_0xe734bd[_0x02a6('0x2e')],'resourceId':_0xe734bd['id'],'type':_0x3cc436['name'],'sectionId':_0x3cc436['id']},{})[_0x02a6('0x27')](function(){return _0x316127;});}else{return _0x316127;}})[_0x02a6('0x4f')](function(_0x20f51d){logger[_0x02a6('0x2c')](_0x02a6('0x9d'),_0x20f51d);throw _0x20f51d;});}return _0x316127;})[_0x02a6('0x27')](respondWithResult(_0xb24f3c,null))[_0x02a6('0x4f')](handleError(_0xb24f3c,null));}});}catch(_0x8b78b2){_0xb24f3c['status'](0x1f4)[_0x02a6('0x2f')](_0x8b78b2);}};function removeReferences(_0x3eb578,_0x180572){try{if(_0x3eb578){fs[_0x02a6('0x9e')](_0x3eb578);logger[_0x02a6('0x69')](_0x02a6('0x9f'));}if(_0x180572){rimraf(_0x180572,function(){});logger[_0x02a6('0x69')](_0x02a6('0xa0'));}}catch(_0x1e95f0){logger[_0x02a6('0x2c')](_0x1e95f0);}}exports[_0x02a6('0x26')]=function(_0x81eed7,_0x48b07e,_0x625865){return db[_0x02a6('0x32')]['find']({'where':{'id':_0x81eed7[_0x02a6('0x51')]['id']}})[_0x02a6('0x27')](handleEntityNotFound(_0x48b07e,null))[_0x02a6('0x27')](saveUpdates(_0x81eed7[_0x02a6('0x94')],null))[_0x02a6('0x27')](respondWithResult(_0x48b07e,null))[_0x02a6('0x4f')](handleError(_0x48b07e,null));};exports['delete']=function(_0x571725,_0x5e6fce,_0x5a5984){return db[_0x02a6('0x32')][_0x02a6('0x4e')]({'where':{'id':_0x571725[_0x02a6('0x51')]['id']}})['then'](function(_0x1dc722){if(_0x1dc722){return _0x1dc722[_0x02a6('0x28')]();}})[_0x02a6('0x27')](function(_0x5480d6){rimraf(path[_0x02a6('0x60')](config[_0x02a6('0x52')],_0x02a6('0x53'),path[_0x02a6('0x61')](_0x5480d6[_0x02a6('0x6')])),function(){});return _0x5480d6;})[_0x02a6('0x27')](handleEntityNotFound(_0x5e6fce,null))[_0x02a6('0x27')](respondWithStatusCode(_0x5e6fce,null))['catch'](handleError(_0x5e6fce,null));};exports[_0x02a6('0xa1')]=function(_0x55091d,_0x126860,_0x25ee5b){return BPromise[_0x02a6('0xa2')]()[_0x02a6('0x27')](function(){if(!_0x55091d['query'][_0x02a6('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x55091d[_0x02a6('0x36')][_0x02a6('0xa3')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x4f7ed4=_0x55091d[_0x02a6('0x36')][_0x02a6('0xa4')]?_0x55091d[_0x02a6('0x36')]['hostname']+':'+_0x55091d['query']['port']:_0x02a6('0xa5')+_0x55091d[_0x02a6('0x36')][_0x02a6('0xa3')];var _0xc335b5=_0x55091d[_0x02a6('0x36')]['json']?_0x55091d[_0x02a6('0x36')][_0x02a6('0x24')]:!![];var _0x147d9f=_0x55091d[_0x02a6('0x36')][_0x02a6('0xa6')]?_0x55091d['query'][_0x02a6('0xa6')]:null;var _0x242627={'method':_0x55091d[_0x02a6('0xa7')],'uri':util[_0x02a6('0x54')](_0x02a6('0xa8'),_0x4f7ed4,_0x55091d[_0x02a6('0x36')][_0x02a6('0x6')]),'json':_0xc335b5,'resolveWithFullResponse':!![],'encoding':_0x147d9f,'qs':_0x55091d[_0x02a6('0x36')]};if(_0x55091d[_0x02a6('0xa9')]){_0x242627[_0x02a6('0xa9')]=_0x55091d[_0x02a6('0xa9')];if(_0x242627['headers']['content-length']){delete _0x242627[_0x02a6('0xa9')]['content-length'];}}if(_0x242627['headers'][_0x02a6('0xaa')]){delete _0x242627[_0x02a6('0xa9')]['content-type'];}return rp(_0x242627);})[_0x02a6('0x27')](function(_0x18e08a){if(_0x18e08a){_0x126860[_0x02a6('0x23')](_0x18e08a[_0x02a6('0xa9')]);logger[_0x02a6('0x69')](_0x18e08a[_0x02a6('0x94')]);if(_[_0x02a6('0xab')](_0x55091d['query'][_0x02a6('0x6')],_0x02a6('0x50'))&&_0x18e08a['statusCode']==0x1f4){return _0x126860[_0x02a6('0x2b')](_0x18e08a['statusCode']);}else{return _0x126860[_0x02a6('0x1e')](_0x18e08a['statusCode'])[_0x02a6('0x2f')](_0x18e08a[_0x02a6('0x94')]);}}else{return _0x126860[_0x02a6('0x2b')](0xc8);}})[_0x02a6('0x4f')](handleError(_0x126860,null));};exports['webhookPost']=function(_0x240235,_0x5aa9b9,_0x23db97){return BPromise[_0x02a6('0xa2')]()[_0x02a6('0x27')](function(){if(!_0x240235[_0x02a6('0x36')][_0x02a6('0x6')]){throw new Error(_0x02a6('0xac'));}if(!_0x240235[_0x02a6('0x36')][_0x02a6('0xa3')]){throw new Error(_0x02a6('0xad'));}var _0x4222dd=_0x240235[_0x02a6('0x36')][_0x02a6('0xa4')]?_0x240235['query']['hostname']+':'+_0x240235[_0x02a6('0x36')][_0x02a6('0xa3')]:_0x02a6('0xa5')+_0x240235[_0x02a6('0x36')]['port'];var _0x547fb8=_0x240235[_0x02a6('0x36')][_0x02a6('0x24')]?_0x240235[_0x02a6('0x36')][_0x02a6('0x24')]:!![];var _0x263b1c=_0x240235[_0x02a6('0x36')][_0x02a6('0xa6')]?_0x240235[_0x02a6('0x36')]['encoding']:null;var _0x2f560b={'method':_0x240235[_0x02a6('0xa7')],'uri':util[_0x02a6('0x54')](_0x02a6('0xa8'),_0x4222dd,_0x240235[_0x02a6('0x36')]['path']),'json':_0x547fb8,'resolveWithFullResponse':!![],'encoding':_0x263b1c,'body':_0x240235[_0x02a6('0x94')]};if(_0x240235[_0x02a6('0xa9')]){_0x2f560b[_0x02a6('0xa9')]=_0x240235['headers'];if(_0x2f560b['headers'][_0x02a6('0xae')]){delete _0x2f560b['headers'][_0x02a6('0xae')];}}if(_0x2f560b[_0x02a6('0xa9')][_0x02a6('0xaa')]){delete _0x2f560b[_0x02a6('0xa9')][_0x02a6('0xaa')];}return rp(_0x2f560b);})['then'](function(_0x5445d5){if(_0x5445d5){_0x5aa9b9[_0x02a6('0x23')](_0x5445d5[_0x02a6('0xa9')]);logger[_0x02a6('0x69')](_0x5445d5['body']);return _0x5aa9b9[_0x02a6('0x1e')](_0x5445d5[_0x02a6('0xaf')])[_0x02a6('0x2f')](_0x5445d5[_0x02a6('0x94')]);}else{return _0x5aa9b9[_0x02a6('0x2b')](0xc8);}})['catch'](handleError(_0x5aa9b9,null));}; \ No newline at end of file +var _0xf97b=['lodash','crypto','jsforce','desk.js','papaparse','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','update','destroy','then','error','stack','send','index','map','Plugin','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','params','keys','length','includeAll','options','find','catch','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','root','dirname','node_modules/**/*','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','get','UserProfileSection','Plugins','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0xd964c6,_0x28b99f){var _0x4393a4=function(_0x67455b){while(--_0x67455b){_0xd964c6['push'](_0xd964c6['shift']());}};_0x4393a4(++_0x28b99f);}(_0xf97b,0x14f));var _0xbf97=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf97b[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf97('0x0'));var zipdir=require(_0xbf97('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf97('0x2'));var moment=require(_0xbf97('0x3'));var BPromise=require(_0xbf97('0x4'));var Mustache=require(_0xbf97('0x5'));var util=require(_0xbf97('0x6'));var path=require(_0xbf97('0x7'));var sox=require(_0xbf97('0x8'));var csv=require('to-csv');var ejs=require(_0xbf97('0x9'));var fs=require('fs');var fs_extra=require(_0xbf97('0xa'));var _=require(_0xbf97('0xb'));var squel=require('squel');var crypto=require(_0xbf97('0xc'));var jsforce=require(_0xbf97('0xd'));var deskjs=require(_0xbf97('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf97('0xf'));var extract=require('extract-zip');var rimraf=require(_0xbf97('0x0'));var archiver=require(_0xbf97('0x10'));var Redis=require(_0xbf97('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbf97('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf97('0x13'));var logger=require(_0xbf97('0x14'))(_0xbf97('0x15'));var utils=require(_0xbf97('0x16'));var config=require(_0xbf97('0x17'));var licenseUtil=require(_0xbf97('0x18'));var db=require(_0xbf97('0x19'))['db'];config[_0xbf97('0x1a')]=_[_0xbf97('0x1b')](config[_0xbf97('0x1a')],{'host':_0xbf97('0x1c'),'port':0x18eb});var socket=require(_0xbf97('0x1d'))(new Redis(config['redis']));require(_0xbf97('0x1e'))[_0xbf97('0x1f')](socket);function respondWithStatusCode(_0x5b1dee,_0x1c116a){_0x1c116a=_0x1c116a||0xcc;return function(_0xafbf1f){if(_0xafbf1f){return _0x5b1dee[_0xbf97('0x20')](_0x1c116a);}return _0x5b1dee['status'](_0x1c116a)[_0xbf97('0x21')]();};}function respondWithResult(_0x37b0fb,_0x1e5de1){_0x1e5de1=_0x1e5de1||0xc8;return function(_0x380729){if(_0x380729){return _0x37b0fb['status'](_0x1e5de1)[_0xbf97('0x22')](_0x380729);}};}function respondWithFilteredResult(_0x14fe5e,_0xa9c5d5){return function(_0x156ea1){if(_0x156ea1){var _0x4fc1d5=typeof _0xa9c5d5[_0xbf97('0x23')]===_0xbf97('0x24')&&typeof _0xa9c5d5['limit']===_0xbf97('0x24');var _0x122b42=_0x156ea1['count'];var _0x2ade79=_0x4fc1d5?0x0:_0xa9c5d5[_0xbf97('0x23')];var _0xd2edd2=_0x4fc1d5?_0x156ea1['count']:_0xa9c5d5['offset']+_0xa9c5d5[_0xbf97('0x25')];var _0x3d709f;if(_0xd2edd2>=_0x122b42){_0xd2edd2=_0x122b42;_0x3d709f=0xc8;}else{_0x3d709f=0xce;}_0x14fe5e[_0xbf97('0x26')](_0x3d709f);return _0x14fe5e[_0xbf97('0x27')](_0xbf97('0x28'),_0x2ade79+'-'+_0xd2edd2+'/'+_0x122b42)['json'](_0x156ea1);}return null;};}function patchUpdates(_0x325e87){return function(_0x23af98){try{jsonpatch[_0xbf97('0x29')](_0x23af98,_0x325e87,!![]);}catch(_0x474cd8){return BPromise[_0xbf97('0x2a')](_0x474cd8);}return _0x23af98['save']();};}function saveUpdates(_0x2235ff,_0x130efd){return function(_0x3510c2){if(_0x3510c2){return _0x3510c2[_0xbf97('0x2b')](_0x2235ff)['then'](function(_0x23d7be){return _0x23d7be;});}return null;};}function removeEntity(_0x1fd2e0,_0x4003a3){return function(_0x31c4d2){if(_0x31c4d2){return _0x31c4d2[_0xbf97('0x2c')]()['then'](function(){var _0x208288=_0x31c4d2['get']({'plain':!![]});var _0x180f40='Plugins';return db['UserProfileResource'][_0xbf97('0x2c')]({'where':{'type':_0x180f40,'resourceId':_0x208288['id']}})[_0xbf97('0x2d')](function(){return _0x31c4d2;});})['then'](function(){_0x1fd2e0[_0xbf97('0x26')](0xcc)[_0xbf97('0x21')]();});}};}function handleEntityNotFound(_0x5b12df,_0x320467){return function(_0x1e8164){if(!_0x1e8164){_0x5b12df[_0xbf97('0x20')](0x194);}return _0x1e8164;};}function handleError(_0x3e7da1,_0x3c2392){_0x3c2392=_0x3c2392||0x1f4;return function(_0x1834ae){logger[_0xbf97('0x2e')](_0x1834ae[_0xbf97('0x2f')]);if(_0x1834ae['name']){delete _0x1834ae['name'];}_0x3e7da1['status'](_0x3c2392)[_0xbf97('0x30')](_0x1834ae);};}exports[_0xbf97('0x31')]=function(_0x5ad552,_0x1b8252){var _0x1e83db={},_0x29a5c4={},_0x2e9b76={'count':0x0,'rows':[]};var _0x34945d=_[_0xbf97('0x32')](db[_0xbf97('0x33')][_0xbf97('0x34')],function(_0x13bb41){return{'name':_0x13bb41[_0xbf97('0x35')],'type':_0x13bb41[_0xbf97('0x36')]['key']};});_0x29a5c4[_0xbf97('0x37')]=_[_0xbf97('0x32')](_0x34945d,_0xbf97('0x38'));_0x29a5c4[_0xbf97('0x39')]=_['keys'](_0x5ad552[_0xbf97('0x39')]);_0x29a5c4[_0xbf97('0x3a')]=_[_0xbf97('0x3b')](_0x29a5c4[_0xbf97('0x37')],_0x29a5c4[_0xbf97('0x39')]);_0x1e83db[_0xbf97('0x3c')]=_[_0xbf97('0x3b')](_0x29a5c4['model'],qs[_0xbf97('0x3d')](_0x5ad552['query'][_0xbf97('0x3d')]));_0x1e83db[_0xbf97('0x3c')]=_0x1e83db[_0xbf97('0x3c')]['length']?_0x1e83db[_0xbf97('0x3c')]:_0x29a5c4[_0xbf97('0x37')];if(!_0x5ad552[_0xbf97('0x39')][_0xbf97('0x3e')]('nolimit')){_0x1e83db[_0xbf97('0x25')]=qs[_0xbf97('0x25')](_0x5ad552[_0xbf97('0x39')][_0xbf97('0x25')]);_0x1e83db[_0xbf97('0x23')]=qs[_0xbf97('0x23')](_0x5ad552[_0xbf97('0x39')]['offset']);}_0x1e83db[_0xbf97('0x3f')]=qs[_0xbf97('0x40')](_0x5ad552[_0xbf97('0x39')][_0xbf97('0x40')]);_0x1e83db[_0xbf97('0x41')]=qs[_0xbf97('0x3a')](_[_0xbf97('0x42')](_0x5ad552[_0xbf97('0x39')],_0x29a5c4[_0xbf97('0x3a')]),_0x34945d);if(_0x5ad552[_0xbf97('0x39')][_0xbf97('0x43')]){_0x1e83db['where']=_[_0xbf97('0x44')](_0x1e83db[_0xbf97('0x41')],{'$or':_[_0xbf97('0x32')](_0x34945d,function(_0x5df7c9){if(_0x5df7c9[_0xbf97('0x36')]!==_0xbf97('0x45')){var _0x370496={};_0x370496[_0x5df7c9[_0xbf97('0x38')]]={'$like':'%'+_0x5ad552[_0xbf97('0x39')][_0xbf97('0x43')]+'%'};return _0x370496;}})});}_0x1e83db=_[_0xbf97('0x44')]({},_0x1e83db,_0x5ad552['options']);var _0x357336={'where':_0x1e83db[_0xbf97('0x41')]};return db[_0xbf97('0x33')][_0xbf97('0x46')](_0x357336)['then'](function(_0x35aae1){_0x2e9b76[_0xbf97('0x46')]=_0x35aae1;if(_0x5ad552[_0xbf97('0x39')]['includeAll']){_0x1e83db[_0xbf97('0x47')]=[{'all':!![]}];}return db['Plugin'][_0xbf97('0x48')](_0x1e83db);})[_0xbf97('0x2d')](function(_0x1fa84a){_0x2e9b76[_0xbf97('0x49')]=_0x1fa84a;return _0x2e9b76;})[_0xbf97('0x2d')](respondWithFilteredResult(_0x1b8252,_0x1e83db))['catch'](handleError(_0x1b8252,null));};exports['show']=function(_0x59e9e6,_0xa7d88b){var _0x2d7633={'raw':!![],'where':{'id':_0x59e9e6[_0xbf97('0x4a')]['id']}},_0x4e5dfc={};_0x4e5dfc[_0xbf97('0x37')]=_[_0xbf97('0x4b')](db[_0xbf97('0x33')]['rawAttributes']);_0x4e5dfc[_0xbf97('0x39')]=_[_0xbf97('0x4b')](_0x59e9e6[_0xbf97('0x39')]);_0x4e5dfc['filters']=_[_0xbf97('0x3b')](_0x4e5dfc[_0xbf97('0x37')],_0x4e5dfc[_0xbf97('0x39')]);_0x2d7633['attributes']=_[_0xbf97('0x3b')](_0x4e5dfc[_0xbf97('0x37')],qs[_0xbf97('0x3d')](_0x59e9e6[_0xbf97('0x39')][_0xbf97('0x3d')]));_0x2d7633[_0xbf97('0x3c')]=_0x2d7633[_0xbf97('0x3c')][_0xbf97('0x4c')]?_0x2d7633['attributes']:_0x4e5dfc[_0xbf97('0x37')];if(_0x59e9e6[_0xbf97('0x39')][_0xbf97('0x4d')]){_0x2d7633[_0xbf97('0x47')]=[{'all':!![]}];}_0x2d7633=_[_0xbf97('0x44')]({},_0x2d7633,_0x59e9e6[_0xbf97('0x4e')]);return db[_0xbf97('0x33')][_0xbf97('0x4f')](_0x2d7633)[_0xbf97('0x2d')](handleEntityNotFound(_0xa7d88b,null))[_0xbf97('0x2d')](respondWithResult(_0xa7d88b,null))[_0xbf97('0x50')](handleError(_0xa7d88b,null));};exports['download']=function(_0x16990e,_0x4587c6,_0x990ec1){return db['Plugin'][_0xbf97('0x4f')]({'where':{'id':_0x16990e[_0xbf97('0x4a')]['id']},'attributes':['name','path'],'raw':!![]})[_0xbf97('0x2d')](handleEntityNotFound(_0x4587c6,null))['then'](function(_0x466237){if(_0x466237){var _0x5f4320=path[_0xbf97('0x51')](config['root'],_0xbf97('0x52'),util[_0xbf97('0x53')](_0xbf97('0x54'),path[_0xbf97('0x55')](_0x466237['path'])));var _0x58c96a=fs[_0xbf97('0x56')](_0x5f4320);var _0x27941c=archiver(_0xbf97('0x57'),{'zlib':{'level':0x9}});_0x27941c['on'](_0xbf97('0x58'),function(_0x451c39){if(_0x451c39[_0xbf97('0x59')]===_0xbf97('0x5a')){logger[_0xbf97('0x2e')](_0x451c39);}else{throw new db['Sequelize'][(_0xbf97('0x5b'))](_0xbf97('0x5c'));}});_0x27941c['on'](_0xbf97('0x2e'),function(_0x3e262a){throw new db[(_0xbf97('0x5d'))][(_0xbf97('0x5b'))](_0xbf97('0x5c'));});_0x27941c[_0xbf97('0x5e')](_0x58c96a);_0x27941c[_0xbf97('0x5f')](_0xbf97('0x60'),{'cwd':path[_0xbf97('0x51')](config[_0xbf97('0x61')],_0xbf97('0x52'),path[_0xbf97('0x62')](_0x466237[_0xbf97('0x7')])),'ignore':[path[_0xbf97('0x51')](path[_0xbf97('0x55')](_0x466237['path']),_0xbf97('0x63')),path[_0xbf97('0x51')](path[_0xbf97('0x55')](_0x466237[_0xbf97('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x58c96a['on'](_0xbf97('0x64'),function(){if(!fs[_0xbf97('0x65')](_0x5f4320)){throw new db['Sequelize']['Error']('Plugin\x20not\x20found');}return _0x4587c6['download'](_0x5f4320,util[_0xbf97('0x53')](_0xbf97('0x54'),path[_0xbf97('0x55')](_0x466237['path'])),function(_0x40a443){if(_0x40a443){throw new db[(_0xbf97('0x5d'))][(_0xbf97('0x5b'))](_0xbf97('0x66'));}fs[_0xbf97('0x67')](_0x5f4320);logger['info'](_0xbf97('0x68'));logger[_0xbf97('0x69')](_0xbf97('0x6a'));});});}return null;})[_0xbf97('0x50')](handleError(_0x4587c6,null));};exports['upload']=function(_0x5a2c2c,_0x5184d4,_0x3b49ca){var _0x344af9=path[_0xbf97('0x55')](_0x5a2c2c[_0xbf97('0x6b')][_0xbf97('0x6c')],path[_0xbf97('0x6d')](_0x5a2c2c[_0xbf97('0x6b')][_0xbf97('0x6c')]));var _0x4da671=path[_0xbf97('0x51')](config['root'],'server/files/plugins',_0x5a2c2c[_0xbf97('0x6b')][_0xbf97('0x6c')]);var _0x522b7c=path['join'](config[_0xbf97('0x61')],_0xbf97('0x52'),_0x344af9);logger['info'](_0xbf97('0x6e'),_0x4da671);logger[_0xbf97('0x69')](_0xbf97('0x6f'),_0x522b7c);try{fs[_0xbf97('0x70')](_0x4da671,parseInt(_0xbf97('0x71'),0x8));extract(_0x4da671,{'dir':_0x522b7c},function(_0x164e3e){if(_0x164e3e){logger[_0xbf97('0x2e')](_0x164e3e);handleError(_0x164e3e,!![]);};var _0x870f19=fs[_0xbf97('0x72')](_0x522b7c);if(_0x870f19[_0xbf97('0x4c')]>0x1){removeReferences(_0x4da671,_0x522b7c);logger[_0xbf97('0x2e')]('Invalid\x20plugin\x20structure');return _0x3b49ca(new Error(_0xbf97('0x73')));}var _0x51d1e6=fs[_0xbf97('0x74')](path[_0xbf97('0x51')](_0x522b7c,_0x870f19[0x0]));if(_0x51d1e6['isFile']()){removeReferences(_0x4da671,_0x522b7c);logger[_0xbf97('0x2e')](_0xbf97('0x73'));return _0x3b49ca(new Error(_0xbf97('0x73')));}if(_0x51d1e6[_0xbf97('0x75')]()){var _0x212bcc=fs[_0xbf97('0x72')](path[_0xbf97('0x51')](_0x522b7c,_0x870f19[0x0]));if(_0x212bcc[_0xbf97('0x4c')]===0x0){removeReferences(_0x4da671,_0x522b7c);logger[_0xbf97('0x2e')](_0xbf97('0x73'));return _0x3b49ca(new Error('Invalid\x20plugin\x20structure'));}var _0x47e77e=_0x212bcc[_0xbf97('0x76')](function(_0x26c007){return _0x26c007===_0xbf97('0x77');});if(!_0x47e77e){return _0x3b49ca(new Error(_0xbf97('0x78')));}var _0x194c26=fs['readFileSync'](path['join'](_0x522b7c,_0x870f19[0x0],_0xbf97('0x77')));var _0x2a8674=JSON[_0xbf97('0x79')](_0x194c26);if('undefined'==typeof _0x2a8674[_0xbf97('0x38')]){return _0x3b49ca(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x36')]){return _0x3b49ca(new Error(_0xbf97('0x7a')));}if(_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x7b')]){return _0x3b49ca(new Error(_0xbf97('0x7c')));}if(_0xbf97('0x24')==typeof _0x2a8674['parameters']){return _0x3b49ca(new Error(_0xbf97('0x7d')));}if(_0x2a8674[_0xbf97('0x36')]==='html'){if(_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')]){return _0x3b49ca(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x80')]&&_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x81')]){return _0x3b49ca(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x2a8674[_0xbf97('0x36')]===_0xbf97('0x82')){if(_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x83')]){return _0x3b49ca(new Error(_0xbf97('0x84')));}if(_0xbf97('0x24')==typeof _0x2a8674['parameters'][_0xbf97('0x85')]){return _0x3b49ca(new Error(_0xbf97('0x86')));}}else{return _0x3b49ca(new Error(_0xbf97('0x87')));}var _0x438e37=_0x2a8674[_0xbf97('0x38')];var _0x4eddd8=_0x2a8674[_0xbf97('0x88')];var _0x34e89e=_0x2a8674[_0xbf97('0x36')];var _0x2a04a6=_0x2a8674[_0xbf97('0x89')]?_0x2a8674[_0xbf97('0x89')]:_0xbf97('0x8a');var _0x26925e=_0x2a8674['icon']?_0x2a8674[_0xbf97('0x8b')]:'icon-apps';var _0x355632='';var _0xd7cde7='';var _0x3aae99='';var _0x47af7c='';var _0x2bec17=_0x2a8674[_0xbf97('0x7b')];if(_0x34e89e===_0xbf97('0x8c')){if(_0xbf97('0x24')!=typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x80')]){var _0x23f067=_0x2a8674['parameters'][_0xbf97('0x7f')][_0xbf97('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xbf97('0x8d')](_0x23f067)){_0x355632=path['join'](_0xbf97('0x8e'),_0x344af9,_0x870f19[0x0],_0x23f067);}else{_0x355632=_0x23f067;}}else{logger[_0xbf97('0x69')](_0xbf97('0x8f'));}if(_0xbf97('0x24')!=typeof _0x2a8674['parameters']['views']['agent']){var _0x3fc0fb=_0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3fc0fb)){_0xd7cde7=path[_0xbf97('0x51')](_0xbf97('0x8e'),_0x344af9,_0x870f19[0x0],_0x3fc0fb);}else{_0xd7cde7=_0x3fc0fb;}}else{logger[_0xbf97('0x69')](_0xbf97('0x90'));}}else if(_0x34e89e==='script'){_0x3aae99=_0x2a8674[_0xbf97('0x7e')]['scriptName'];_0x47af7c=_0x2a8674[_0xbf97('0x7e')][_0xbf97('0x85')];if(_0xbf97('0x24')!=typeof _0x2a8674[_0xbf97('0x7e')]['views']){if(_0xbf97('0x24')!=typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x80')]){var _0x23f067=_0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xbf97('0x8d')](_0x23f067)){_0x355632=path['join'](_0xbf97('0x8e'),_0x344af9,_0x870f19[0x0],_0x23f067);}else{_0x355632=_0x23f067;}}if(_0xbf97('0x24')!=typeof _0x2a8674[_0xbf97('0x7e')]['views']['agent']){var _0x3fc0fb=_0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xbf97('0x8d')](_0x3fc0fb)){_0xd7cde7=path[_0xbf97('0x51')](_0xbf97('0x8e'),_0x344af9,_0x870f19[0x0],_0x3fc0fb);}else{_0xd7cde7=_0x3fc0fb;}}}}var _0x38898e={'name':_0x438e37,'description':_0x4eddd8,'path':path[_0xbf97('0x51')](_0x344af9,_0x870f19[0x0]),'type':_0x34e89e,'sidebar':_0x2a04a6,'icon':_0x26925e,'adminUrl':_0x355632,'agentUrl':_0xd7cde7,'scriptName':_0x3aae99,'scriptPath':_0x47af7c,'version':_0x2bec17};removeReferences(_0x4da671,null);return db[_0xbf97('0x33')]['create'](_0x38898e)[_0xbf97('0x2d')](function(_0x183b52){var _0x4b06cb={'role':_0x5a2c2c[_0xbf97('0x91')][_0xbf97('0x92')],'userProfileId':_0x5a2c2c[_0xbf97('0x91')][_0xbf97('0x93')]};if(!_0x4b06cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b06cb['role']==='user'){var _0x175cef=_0x183b52[_0xbf97('0x94')]({'plain':!![]});return db[_0xbf97('0x95')]['find']({'where':{'name':_0xbf97('0x96'),'userProfileId':_0x4b06cb[_0xbf97('0x93')]},'raw':!![]})[_0xbf97('0x2d')](function(_0x337cb3){if(_0x337cb3&&_0x337cb3[_0xbf97('0x97')]===0x0){return db[_0xbf97('0x98')][_0xbf97('0x99')]({'name':_0x175cef[_0xbf97('0x38')],'resourceId':_0x175cef['id'],'type':_0x337cb3['name'],'sectionId':_0x337cb3['id']},{})[_0xbf97('0x2d')](function(){return _0x183b52;});}else{return _0x183b52;}})[_0xbf97('0x50')](function(_0x2430aa){logger[_0xbf97('0x2e')](_0xbf97('0x9a'),_0x2430aa);throw _0x2430aa;});}return _0x183b52;})['then'](respondWithResult(_0x5184d4,null))[_0xbf97('0x50')](handleError(_0x5184d4,null));}});}catch(_0x37002b){_0x5184d4[_0xbf97('0x26')](0x1f4)['send'](_0x37002b);}};function removeReferences(_0x3259f5,_0x139cb3){try{if(_0x3259f5){fs[_0xbf97('0x67')](_0x3259f5);logger[_0xbf97('0x69')](_0xbf97('0x9b'));}if(_0x139cb3){rimraf(_0x139cb3,function(){});logger[_0xbf97('0x69')](_0xbf97('0x9c'));}}catch(_0x341a77){logger[_0xbf97('0x2e')](_0x341a77);}}exports['update']=function(_0x5444a5,_0x10e3db,_0x58f9fc){return db[_0xbf97('0x33')][_0xbf97('0x4f')]({'where':{'id':_0x5444a5[_0xbf97('0x4a')]['id']}})[_0xbf97('0x2d')](handleEntityNotFound(_0x10e3db,null))['then'](saveUpdates(_0x5444a5[_0xbf97('0x91')],null))[_0xbf97('0x2d')](respondWithResult(_0x10e3db,null))[_0xbf97('0x50')](handleError(_0x10e3db,null));};exports['delete']=function(_0x510ce4,_0x1866e4,_0x134870){return db[_0xbf97('0x33')][_0xbf97('0x4f')]({'where':{'id':_0x510ce4['params']['id']}})[_0xbf97('0x2d')](function(_0x238fce){if(_0x238fce){return _0x238fce[_0xbf97('0x2c')]();}})[_0xbf97('0x2d')](function(_0x3c6582){rimraf(path['join'](config['root'],'server/files/plugins',path[_0xbf97('0x62')](_0x3c6582['path'])),function(){});return _0x3c6582;})['then'](handleEntityNotFound(_0x1866e4,null))['then'](respondWithStatusCode(_0x1866e4,null))[_0xbf97('0x50')](handleError(_0x1866e4,null));};exports[_0xbf97('0x9d')]=function(_0x5e38aa,_0x43cefe,_0x338600){return BPromise[_0xbf97('0x9e')]()[_0xbf97('0x2d')](function(){if(!_0x5e38aa['query'][_0xbf97('0x7')]){throw new Error(_0xbf97('0x9f'));}if(!_0x5e38aa['query']['port']){throw new Error(_0xbf97('0xa0'));}var _0x25a8af=_0x5e38aa['query'][_0xbf97('0xa1')]?_0x5e38aa['query'][_0xbf97('0xa1')]+':'+_0x5e38aa[_0xbf97('0x39')][_0xbf97('0xa2')]:_0xbf97('0xa3')+_0x5e38aa[_0xbf97('0x39')][_0xbf97('0xa2')];var _0x322f9b=_0x5e38aa[_0xbf97('0x39')][_0xbf97('0x22')]?_0x5e38aa['query'][_0xbf97('0x22')]:!![];var _0x568be5=_0x5e38aa[_0xbf97('0x39')][_0xbf97('0xa4')]?_0x5e38aa[_0xbf97('0x39')][_0xbf97('0xa4')]:null;var _0x250591={'method':_0x5e38aa[_0xbf97('0xa5')],'uri':util[_0xbf97('0x53')]('%s%s',_0x25a8af,_0x5e38aa[_0xbf97('0x39')]['path']),'json':_0x322f9b,'resolveWithFullResponse':!![],'encoding':_0x568be5,'qs':_0x5e38aa[_0xbf97('0x39')]};if(_0x5e38aa[_0xbf97('0xa6')]){_0x250591[_0xbf97('0xa6')]=_0x5e38aa['headers'];if(_0x250591[_0xbf97('0xa6')][_0xbf97('0xa7')]){delete _0x250591[_0xbf97('0xa6')][_0xbf97('0xa7')];}}if(_0x250591[_0xbf97('0xa6')]['content-type']){delete _0x250591[_0xbf97('0xa6')][_0xbf97('0xa8')];}return rp(_0x250591);})[_0xbf97('0x2d')](function(_0x47d780){if(_0x47d780){_0x43cefe[_0xbf97('0x27')](_0x47d780[_0xbf97('0xa6')]);logger['info'](_0x47d780[_0xbf97('0x91')]);if(_[_0xbf97('0xa9')](_0x5e38aa[_0xbf97('0x39')]['path'],'download')&&_0x47d780[_0xbf97('0xaa')]==0x1f4){return _0x43cefe[_0xbf97('0x20')](_0x47d780[_0xbf97('0xaa')]);}else{return _0x43cefe[_0xbf97('0x26')](_0x47d780['statusCode'])[_0xbf97('0x30')](_0x47d780[_0xbf97('0x91')]);}}else{return _0x43cefe[_0xbf97('0x20')](0xc8);}})['catch'](handleError(_0x43cefe,null));};exports[_0xbf97('0xab')]=function(_0x2878da,_0x49ffe3,_0x47cf6b){return BPromise[_0xbf97('0x9e')]()['then'](function(){if(!_0x2878da[_0xbf97('0x39')]['path']){throw new Error(_0xbf97('0x9f'));}if(!_0x2878da['query'][_0xbf97('0xa2')]){throw new Error(_0xbf97('0xa0'));}var _0x133930=_0x2878da['query'][_0xbf97('0xa1')]?_0x2878da[_0xbf97('0x39')]['hostname']+':'+_0x2878da[_0xbf97('0x39')]['port']:'http://localhost:'+_0x2878da['query']['port'];var _0x284f34=_0x2878da[_0xbf97('0x39')][_0xbf97('0x22')]?_0x2878da[_0xbf97('0x39')][_0xbf97('0x22')]:!![];var _0x44a22f=_0x2878da[_0xbf97('0x39')][_0xbf97('0xa4')]?_0x2878da['query'][_0xbf97('0xa4')]:null;var _0x4a031c={'method':_0x2878da[_0xbf97('0xa5')],'uri':util['format'](_0xbf97('0xac'),_0x133930,_0x2878da['query'][_0xbf97('0x7')]),'json':_0x284f34,'resolveWithFullResponse':!![],'encoding':_0x44a22f,'body':_0x2878da['body']};if(_0x2878da[_0xbf97('0xa6')]){_0x4a031c[_0xbf97('0xa6')]=_0x2878da[_0xbf97('0xa6')];if(_0x4a031c['headers'][_0xbf97('0xa7')]){delete _0x4a031c['headers'][_0xbf97('0xa7')];}}if(_0x4a031c[_0xbf97('0xa6')][_0xbf97('0xa8')]){delete _0x4a031c[_0xbf97('0xa6')][_0xbf97('0xa8')];}return rp(_0x4a031c);})[_0xbf97('0x2d')](function(_0x194bd2){if(_0x194bd2){_0x49ffe3[_0xbf97('0x27')](_0x194bd2[_0xbf97('0xa6')]);logger[_0xbf97('0x69')](_0x194bd2['body']);return _0x49ffe3[_0xbf97('0x26')](_0x194bd2[_0xbf97('0xaa')])['send'](_0x194bd2[_0xbf97('0x91')]);}else{return _0x49ffe3[_0xbf97('0x20')](0xc8);}})[_0xbf97('0x50')](handleError(_0x49ffe3,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index cbab4ee..4e25843 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 _0x7046=['events','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x4c8944,_0x54f1b1){var _0x533add=function(_0x19b0a8){while(--_0x19b0a8){_0x4c8944['push'](_0x4c8944['shift']());}};_0x533add(++_0x54f1b1);}(_0x7046,0x144));var _0x6704=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7046[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0x6704('0x0'));var Plugin=require(_0x6704('0x1'))['db'][_0x6704('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6704('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6704('0x4'),'afterDestroy':_0x6704('0x5')};function emitEvent(_0x2899c5){return function(_0x5258e7,_0x1e9b2a,_0x35bcc6){PluginEvents[_0x6704('0x6')](_0x2899c5+':'+_0x5258e7['id'],_0x5258e7);PluginEvents[_0x6704('0x6')](_0x2899c5,_0x5258e7);_0x35bcc6(null);};}for(var e in events){if(events[_0x6704('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x6704('0x8')]=PluginEvents; \ No newline at end of file +var _0xaee6=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0xaee6,0x187));var _0x6aee=function(_0x682e55,_0xf2bb47){_0x682e55=_0x682e55-0x0;var _0x2ee3b0=_0xaee6[_0x682e55];return _0x2ee3b0;};'use strict';var EventEmitter=require(_0x6aee('0x0'));var Plugin=require(_0x6aee('0x1'))['db'][_0x6aee('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6aee('0x3')](0x0);var events={'afterCreate':_0x6aee('0x4'),'afterUpdate':_0x6aee('0x5'),'afterDestroy':'remove'};function emitEvent(_0x46980d){return function(_0x3f11af,_0x1e23ba,_0x5e83b4){PluginEvents[_0x6aee('0x6')](_0x46980d+':'+_0x3f11af['id'],_0x3f11af);PluginEvents[_0x6aee('0x6')](_0x46980d,_0x3f11af);_0x5e83b4(null);};}for(var e in events){if(events[_0x6aee('0x7')](e)){var event=events[e];Plugin[_0x6aee('0x8')](e,emitEvent(event));}}module[_0x6aee('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 378e5af..37c44cf 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 _0x6aa4=['../../config/environment','./plugin.attributes','exports','define','plugins','lodash','util','api','moment','bluebird','path'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x6aa4,0x12e));var _0x46aa=function(_0x24a67b,_0x47cdbc){_0x24a67b=_0x24a67b-0x0;var _0x222073=_0x6aa4[_0x24a67b];return _0x222073;};'use strict';var _=require(_0x46aa('0x0'));var util=require(_0x46aa('0x1'));var logger=require('../../config/logger')(_0x46aa('0x2'));var moment=require(_0x46aa('0x3'));var BPromise=require(_0x46aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46aa('0x5'));var rimraf=require('rimraf');var config=require(_0x46aa('0x6'));var attributes=require(_0x46aa('0x7'));module[_0x46aa('0x8')]=function(_0x515846,_0x28779){return _0x515846[_0x46aa('0x9')]('Plugin',attributes,{'tableName':_0x46aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x942a=['bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','../../config/logger','api','moment'];(function(_0x268a71,_0x320096){var _0xd456b3=function(_0x200e01){while(--_0x200e01){_0x268a71['push'](_0x268a71['shift']());}};_0xd456b3(++_0x320096);}(_0x942a,0x175));var _0xa942=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0x942a[_0x44ae0b];return _0x69232a;};'use strict';var _=require(_0xa942('0x0'));var util=require('util');var logger=require(_0xa942('0x1'))(_0xa942('0x2'));var moment=require(_0xa942('0x3'));var BPromise=require(_0xa942('0x4'));var rp=require(_0xa942('0x5'));var fs=require('fs');var path=require(_0xa942('0x6'));var rimraf=require(_0xa942('0x7'));var config=require(_0xa942('0x8'));var attributes=require(_0xa942('0x9'));module['exports']=function(_0xf71030,_0x1ee3c3){return _0xf71030[_0xa942('0xa')](_0xa942('0xb'),attributes,{'tableName':_0xa942('0xc'),'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 da54bc1..fecb199 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 _0x697e=['Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','catch','options','raw','CreatePlugin','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','./plugin.socket','register','request','then','info','request\x20sent','debug'];(function(_0x19bdb3,_0x4e8659){var _0x87f65b=function(_0x4dcdc1){while(--_0x4dcdc1){_0x19bdb3['push'](_0x19bdb3['shift']());}};_0x87f65b(++_0x4e8659);}(_0x697e,0xe4));var _0xe697=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x697e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe697('0x0'));var moment=require(_0xe697('0x1'));var BPromise=require(_0xe697('0x2'));var rs=require(_0xe697('0x3'));var fs=require('fs');var Redis=require(_0xe697('0x4'));var db=require(_0xe697('0x5'))['db'];var utils=require(_0xe697('0x6'));var logger=require(_0xe697('0x7'))(_0xe697('0x8'));var config=require('../../config/environment');var jayson=require(_0xe697('0x9'));var client=jayson[_0xe697('0xa')]['http']({'port':0x232a});config[_0xe697('0xb')]=_['defaults'](config[_0xe697('0xb')],{'host':_0xe697('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe697('0xb')]));require(_0xe697('0xd'))[_0xe697('0xe')](socket);function respondWithRpcPromise(_0x8d5a8,_0x3d77b7,_0x3760dc){return new BPromise(function(_0x3faf90,_0x1657d4){return client[_0xe697('0xf')](_0x8d5a8,_0x3760dc)[_0xe697('0x10')](function(_0x63f632){logger[_0xe697('0x11')]('Plugin,\x20%s,\x20%s',_0x3d77b7,_0xe697('0x12'));logger[_0xe697('0x13')](_0xe697('0x14'),_0x3d77b7,_0xe697('0x12'),JSON[_0xe697('0x15')](_0x63f632));if(_0x63f632[_0xe697('0x16')]){if(_0x63f632[_0xe697('0x16')][_0xe697('0x17')]===0x1f4){logger[_0xe697('0x16')]('Plugin,\x20%s,\x20%s',_0x3d77b7,_0x63f632[_0xe697('0x16')]['message']);return _0x1657d4(_0x63f632[_0xe697('0x16')][_0xe697('0x18')]);}logger['error'](_0xe697('0x19'),_0x3d77b7,_0x63f632[_0xe697('0x16')]['message']);return _0x3faf90(_0x63f632[_0xe697('0x16')][_0xe697('0x18')]);}else{logger['info'](_0xe697('0x19'),_0x3d77b7,_0xe697('0x12'));_0x3faf90(_0x63f632[_0xe697('0x1a')][_0xe697('0x18')]);}})[_0xe697('0x1b')](function(_0x17b988){logger[_0xe697('0x16')]('Plugin,\x20%s,\x20%s',_0x3d77b7,_0x17b988);_0x1657d4(_0x17b988);});});}exports['CreatePlugin']=function(_0x43a0e0){var _0xee6087=this;return new Promise(function(_0x3c9472,_0x411c2e){return db['Plugin']['create'](_0x43a0e0['body'],{'raw':_0x43a0e0[_0xe697('0x1c')]?_0x43a0e0[_0xe697('0x1c')][_0xe697('0x1d')]===undefined?!![]:![]:!![]})[_0xe697('0x10')](function(_0x4150d1){logger['info'](_0xe697('0x1e'),_0x43a0e0);logger['debug'](_0xe697('0x1e'),_0x43a0e0,JSON[_0xe697('0x15')](_0x4150d1));_0x3c9472(_0x4150d1);})[_0xe697('0x1b')](function(_0x2f6175){logger['error'](_0xe697('0x1e'),_0x2f6175['message'],_0x43a0e0);_0x411c2e(_0xee6087[_0xe697('0x16')](0x1f4,_0x2f6175['message']));});});}; \ No newline at end of file +var _0x4c73=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x4c73,0x14c));var _0x34c7=function(_0x167f48,_0x343696){_0x167f48=_0x167f48-0x0;var _0x5b36fb=_0x4c73[_0x167f48];return _0x5b36fb;};'use strict';var _=require(_0x34c7('0x0'));var util=require(_0x34c7('0x1'));var moment=require(_0x34c7('0x2'));var BPromise=require(_0x34c7('0x3'));var rs=require(_0x34c7('0x4'));var fs=require('fs');var Redis=require(_0x34c7('0x5'));var db=require(_0x34c7('0x6'))['db'];var utils=require(_0x34c7('0x7'));var logger=require('../../config/logger')(_0x34c7('0x8'));var config=require(_0x34c7('0x9'));var jayson=require(_0x34c7('0xa'));var client=jayson[_0x34c7('0xb')][_0x34c7('0xc')]({'port':0x232a});config[_0x34c7('0xd')]=_['defaults'](config[_0x34c7('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x34c7('0xe'))(new Redis(config[_0x34c7('0xd')]));require('./plugin.socket')[_0x34c7('0xf')](socket);function respondWithRpcPromise(_0x56a95b,_0x3d0adc,_0x11ed76){return new BPromise(function(_0x3e3d3c,_0x45f3db){return client[_0x34c7('0x10')](_0x56a95b,_0x11ed76)[_0x34c7('0x11')](function(_0x31e24f){logger[_0x34c7('0x12')](_0x34c7('0x13'),_0x3d0adc,_0x34c7('0x14'));logger[_0x34c7('0x15')](_0x34c7('0x16'),_0x3d0adc,_0x34c7('0x14'),JSON[_0x34c7('0x17')](_0x31e24f));if(_0x31e24f[_0x34c7('0x18')]){if(_0x31e24f[_0x34c7('0x18')][_0x34c7('0x19')]===0x1f4){logger[_0x34c7('0x18')]('Plugin,\x20%s,\x20%s',_0x3d0adc,_0x31e24f[_0x34c7('0x18')][_0x34c7('0x1a')]);return _0x45f3db(_0x31e24f['error'][_0x34c7('0x1a')]);}logger[_0x34c7('0x18')](_0x34c7('0x13'),_0x3d0adc,_0x31e24f[_0x34c7('0x18')][_0x34c7('0x1a')]);return _0x3e3d3c(_0x31e24f[_0x34c7('0x18')][_0x34c7('0x1a')]);}else{logger[_0x34c7('0x12')](_0x34c7('0x13'),_0x3d0adc,_0x34c7('0x14'));_0x3e3d3c(_0x31e24f[_0x34c7('0x1b')][_0x34c7('0x1a')]);}})[_0x34c7('0x1c')](function(_0x484405){logger[_0x34c7('0x18')]('Plugin,\x20%s,\x20%s',_0x3d0adc,_0x484405);_0x45f3db(_0x484405);});});}exports['CreatePlugin']=function(_0x548e71){var _0x3e6af1=this;return new Promise(function(_0x5ae135,_0x3bee56){return db[_0x34c7('0x1d')][_0x34c7('0x1e')](_0x548e71[_0x34c7('0x1f')],{'raw':_0x548e71[_0x34c7('0x20')]?_0x548e71[_0x34c7('0x20')][_0x34c7('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x1e576b){logger[_0x34c7('0x12')](_0x34c7('0x22'),_0x548e71);logger['debug'](_0x34c7('0x22'),_0x548e71,JSON[_0x34c7('0x17')](_0x1e576b));_0x5ae135(_0x1e576b);})[_0x34c7('0x1c')](function(_0x111844){logger[_0x34c7('0x18')](_0x34c7('0x22'),_0x111844[_0x34c7('0x1a')],_0x548e71);_0x3bee56(_0x3e6af1[_0x34c7('0x18')](0x1f4,_0x111844[_0x34c7('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4be984b..fea9f68 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 _0xa11e=['length','plugin:','./plugin.events','save','remove','update','emit','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa11e,0x110));var _0xea11=function(_0x5c7fe3,_0x437916){_0x5c7fe3=_0x5c7fe3-0x0;var _0xe29f1e=_0xa11e[_0x5c7fe3];return _0xe29f1e;};'use strict';var PluginEvents=require(_0xea11('0x0'));var events=[_0xea11('0x1'),_0xea11('0x2'),_0xea11('0x3')];function createListener(_0x3f4ce2,_0x171130){return function(_0xa0b7ca){_0x171130[_0xea11('0x4')](_0x3f4ce2,_0xa0b7ca);};}function removeListener(_0x58a6cf,_0xcee3c3){return function(){PluginEvents[_0xea11('0x5')](_0x58a6cf,_0xcee3c3);};}exports[_0xea11('0x6')]=function(_0x3228b4){for(var _0x525b95=0x0,_0x3d62ad=events[_0xea11('0x7')];_0x525b95<_0x3d62ad;_0x525b95++){var _0x4e0099=events[_0x525b95];var _0x44c216=createListener(_0xea11('0x8')+_0x4e0099,_0x3228b4);PluginEvents['on'](_0x4e0099,_0x44c216);}}; \ No newline at end of file +var _0x6474=['update','emit','length','plugin:','save','remove'];(function(_0x30fec7,_0x43f441){var _0x462f4a=function(_0x465871){while(--_0x465871){_0x30fec7['push'](_0x30fec7['shift']());}};_0x462f4a(++_0x43f441);}(_0x6474,0x1b4));var _0x4647=function(_0x1bd020,_0x33223a){_0x1bd020=_0x1bd020-0x0;var _0x39ccc9=_0x6474[_0x1bd020];return _0x39ccc9;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x4647('0x0'),_0x4647('0x1'),_0x4647('0x2')];function createListener(_0x58ace7,_0x4fd9ef){return function(_0x267890){_0x4fd9ef[_0x4647('0x3')](_0x58ace7,_0x267890);};}function removeListener(_0x11678c,_0x3daab6){return function(){PluginEvents['removeListener'](_0x11678c,_0x3daab6);};}exports['register']=function(_0x390e5c){for(var _0x341233=0x0,_0x42a459=events[_0x4647('0x4')];_0x341233<_0x42a459;_0x341233++){var _0x1e2609=events[_0x341233];var _0x5abaf5=createListener(_0x4647('0x5')+_0x1e2609,_0x390e5c);PluginEvents['on'](_0x1e2609,_0x5abaf5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 367ebdd..faf3bfe 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(_0x2e0a25,_0x2da7a6){var _0x359873=function(_0x47fb4b){while(--_0x47fb4b){_0x2e0a25['push'](_0x2e0a25['shift']());}};_0x359873(++_0x2da7a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x665daa,_0x2913ac){var _0x38c00e=function(_0x471cc0){while(--_0x471cc0){_0x665daa['push'](_0x665daa['shift']());}};_0x38c00e(++_0x2913ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 16663ea..d38ebdd 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 _0x8ce3=['length','catch','show','describe','params','then','create','body','script','join','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','exec','bluebird','status','json','stack','name','send','npm\x20install','info','error','index','list','reject','express','motion2'];(function(_0x304429,_0x5c956f){var _0x26a77f=function(_0xe50d9d){while(--_0xe50d9d){_0x304429['push'](_0x304429['shift']());}};_0x26a77f(++_0x5c956f);}(_0x8ce3,0xc3));var _0x38ce=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0x8ce3[_0x2c5255];return _0x30d0ea;};'use strict';var _=require(_0x38ce('0x0'));var pm2=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var path=require(_0x38ce('0x3'));var exec=require(_0x38ce('0x4'))[_0x38ce('0x5')];var BPromise=require(_0x38ce('0x6'));function handleEntityNotFound(_0x17b96d,_0x1efae3){return function(_0x381fa0){if(!_0x381fa0){_0x17b96d['sendStatus'](0x194);;}return _0x381fa0;};}function respondWithResult(_0x372f86,_0xb24f4c){_0xb24f4c=_0xb24f4c||0xc8;return function(_0x58074c){if(_0x58074c){return _0x372f86[_0x38ce('0x7')](_0xb24f4c)[_0x38ce('0x8')](_0x58074c);}return null;};}function handleError(_0x3f8011,_0x482955){_0x482955=_0x482955||0x1f4;return function(_0x3c66e5){logger['error'](_0x3c66e5[_0x38ce('0x9')]);if(_0x3c66e5['name']){delete _0x3c66e5[_0x38ce('0xa')];}_0x3f8011[_0x38ce('0x7')](_0x482955)[_0x38ce('0xb')](_0x3c66e5);};}function execChildProcess(){return new BPromise(function(_0x2c0cab,_0x564332){exec(_0x38ce('0xc'),function(_0x2a9045,_0x171a02,_0x29bd3a){logger[_0x38ce('0xd')](_0x171a02);logger[_0x38ce('0xd')](_0x29bd3a);if(_0x2a9045){logger[_0x38ce('0xe')](_0x2a9045);return _0x564332(_0x2a9045);}return _0x2c0cab(_0x171a02);});});}exports[_0x38ce('0xf')]=function(_0x263d6f,_0x2e661b){return pm2[_0x38ce('0x10')]()['then'](function(_0x48ba7c){if(_0x48ba7c){var _0x3c4d7f=_[_0x38ce('0x11')](_0x48ba7c,function(_0x2369f3){return _0x2369f3['name']===_0x38ce('0x12')||_0x2369f3['name']===_0x38ce('0x13');});return{'rows':_0x3c4d7f,'count':_0x3c4d7f[_0x38ce('0x14')]};}return null;})['then'](respondWithResult(_0x2e661b,null))[_0x38ce('0x15')](handleError(_0x2e661b,null));};exports[_0x38ce('0x16')]=function(_0x1dfaba,_0x51f670){return pm2[_0x38ce('0x17')](_0x1dfaba[_0x38ce('0x18')]['id'])[_0x38ce('0x19')](respondWithResult(_0x51f670,null))[_0x38ce('0x19')](handleEntityNotFound(_0x51f670,null))[_0x38ce('0x15')](handleError(_0x51f670,null));};exports[_0x38ce('0x1a')]=function(_0x2d4218,_0x518b04){if(_0x2d4218[_0x38ce('0x1b')][_0x38ce('0xa')]&&_0x2d4218[_0x38ce('0x1b')][_0x38ce('0x1c')]){var _0x30b060=path[_0x38ce('0x1d')](__dirname,_0x38ce('0x1e'),_0x2d4218[_0x38ce('0x1b')][_0x38ce('0x1c')]);var _0x3cf50b=process[_0x38ce('0x1f')]();process['chdir'](path[_0x38ce('0x20')](_0x30b060));return execChildProcess()[_0x38ce('0x19')](function(_0xe40e9c){process[_0x38ce('0x21')](_0x3cf50b);return pm2['start']({'name':_0x2d4218[_0x38ce('0x1b')][_0x38ce('0xa')],'script':_0x30b060});})['then'](function(_0xe0af00){pm2[_0x38ce('0x22')]();return _0xe0af00[0x0];})[_0x38ce('0x19')](respondWithResult(_0x518b04,0xc9))['catch'](handleError(_0x518b04,null));}else{return _0x518b04['status'](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x23')});}};exports[_0x38ce('0x24')]=function(_0x21d4e7,_0x264cf0){if(_0x21d4e7[_0x38ce('0x1b')]['id']){delete _0x21d4e7[_0x38ce('0x1b')]['id'];}var _0xce1f64={'online':_0x38ce('0x25'),'stopped':_0x38ce('0x26')};if(_0xce1f64[_0x38ce('0x27')](_0x21d4e7[_0x38ce('0x1b')]['status'])){return pm2[_0xce1f64[_0x21d4e7[_0x38ce('0x1b')][_0x38ce('0x7')]]](_0x21d4e7['params']['id'])[_0x38ce('0x19')](respondWithResult(_0x264cf0,0xc8))[_0x38ce('0x15')](handleError(_0x264cf0,null));}else{return _0x264cf0['status'](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x28')});}};exports['destroy']=function(_0x28d775,_0x53f2c9){if(_0x28d775[_0x38ce('0x1b')]['id']){delete _0x28d775[_0x38ce('0x1b')]['id'];}if(_0x28d775[_0x38ce('0x18')]['id']){return pm2[_0x38ce('0x29')](_0x28d775[_0x38ce('0x18')]['id'])[_0x38ce('0x19')](function(_0x34262a){pm2[_0x38ce('0x22')]();return _0x34262a[0x0];})['then'](respondWithResult(_0x53f2c9,null))['catch'](handleError(_0x53f2c9,null));}else{return _0x53f2c9[_0x38ce('0x7')](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x2a')});}}; \ No newline at end of file +var _0xe13a=['exec','bluebird','sendStatus','json','error','stack','name','status','npm\x20install','info','index','reject','express','length','catch','show','describe','params','then','body','script','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','send','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xe13a,0x178));var _0xae13=function(_0x23a389,_0x51a803){_0x23a389=_0x23a389-0x0;var _0x4d1035=_0xe13a[_0x23a389];return _0x4d1035;};'use strict';var _=require('lodash');var pm2=require(_0xae13('0x0'));var logger=require(_0xae13('0x1'))(_0xae13('0x2'));var path=require(_0xae13('0x3'));var exec=require('child_process')[_0xae13('0x4')];var BPromise=require(_0xae13('0x5'));function handleEntityNotFound(_0x3ebbfe,_0x10abd7){return function(_0x28a89a){if(!_0x28a89a){_0x3ebbfe[_0xae13('0x6')](0x194);;}return _0x28a89a;};}function respondWithResult(_0x412a07,_0x3379ed){_0x3379ed=_0x3379ed||0xc8;return function(_0x341ba4){if(_0x341ba4){return _0x412a07['status'](_0x3379ed)[_0xae13('0x7')](_0x341ba4);}return null;};}function handleError(_0x2b2e1f,_0x27fefd){_0x27fefd=_0x27fefd||0x1f4;return function(_0x2a793f){logger[_0xae13('0x8')](_0x2a793f[_0xae13('0x9')]);if(_0x2a793f[_0xae13('0xa')]){delete _0x2a793f[_0xae13('0xa')];}_0x2b2e1f[_0xae13('0xb')](_0x27fefd)['send'](_0x2a793f);};}function execChildProcess(){return new BPromise(function(_0x404b0e,_0x83de98){exec(_0xae13('0xc'),function(_0x3a6d41,_0x14df2d,_0x3006f0){logger[_0xae13('0xd')](_0x14df2d);logger['info'](_0x3006f0);if(_0x3a6d41){logger[_0xae13('0x8')](_0x3a6d41);return _0x83de98(_0x3a6d41);}return _0x404b0e(_0x14df2d);});});}exports[_0xae13('0xe')]=function(_0x5c61bb,_0x589803){return pm2['list']()['then'](function(_0x52484b){if(_0x52484b){var _0x26ff3e=_[_0xae13('0xf')](_0x52484b,function(_0x44e141){return _0x44e141[_0xae13('0xa')]===_0xae13('0x10')||_0x44e141[_0xae13('0xa')]==='motion2';});return{'rows':_0x26ff3e,'count':_0x26ff3e[_0xae13('0x11')]};}return null;})['then'](respondWithResult(_0x589803,null))[_0xae13('0x12')](handleError(_0x589803,null));};exports[_0xae13('0x13')]=function(_0x207363,_0x118e52){return pm2[_0xae13('0x14')](_0x207363[_0xae13('0x15')]['id'])[_0xae13('0x16')](respondWithResult(_0x118e52,null))[_0xae13('0x16')](handleEntityNotFound(_0x118e52,null))[_0xae13('0x12')](handleError(_0x118e52,null));};exports['create']=function(_0x4462a5,_0x50eb6c){if(_0x4462a5[_0xae13('0x17')][_0xae13('0xa')]&&_0x4462a5['body'][_0xae13('0x18')]){var _0x39d41c=path[_0xae13('0x19')](__dirname,_0xae13('0x1a'),_0x4462a5[_0xae13('0x17')][_0xae13('0x18')]);var _0x54b3b4=process['cwd']();process[_0xae13('0x1b')](path[_0xae13('0x1c')](_0x39d41c));return execChildProcess()['then'](function(_0x168b92){process['chdir'](_0x54b3b4);return pm2[_0xae13('0x1d')]({'name':_0x4462a5[_0xae13('0x17')][_0xae13('0xa')],'script':_0x39d41c});})['then'](function(_0x57124a){pm2['dump']();return _0x57124a[0x0];})[_0xae13('0x16')](respondWithResult(_0x50eb6c,0xc9))[_0xae13('0x12')](handleError(_0x50eb6c,null));}else{return _0x50eb6c[_0xae13('0xb')](0x1f4)['send']({'message':_0xae13('0x1e')});}};exports['update']=function(_0x3d0d60,_0x5de054){if(_0x3d0d60[_0xae13('0x17')]['id']){delete _0x3d0d60[_0xae13('0x17')]['id'];}var _0x526e4e={'online':_0xae13('0x1f'),'stopped':_0xae13('0x20')};if(_0x526e4e[_0xae13('0x21')](_0x3d0d60[_0xae13('0x17')]['status'])){return pm2[_0x526e4e[_0x3d0d60[_0xae13('0x17')][_0xae13('0xb')]]](_0x3d0d60[_0xae13('0x15')]['id'])[_0xae13('0x16')](respondWithResult(_0x5de054,0xc8))[_0xae13('0x12')](handleError(_0x5de054,null));}else{return _0x5de054[_0xae13('0xb')](0x1f4)[_0xae13('0x22')]({'message':'Unknown\x20status'});}};exports[_0xae13('0x23')]=function(_0x591f94,_0xf6289c){if(_0x591f94[_0xae13('0x17')]['id']){delete _0x591f94[_0xae13('0x17')]['id'];}if(_0x591f94[_0xae13('0x15')]['id']){return pm2[_0xae13('0x24')](_0x591f94[_0xae13('0x15')]['id'])[_0xae13('0x16')](function(_0x48f0f6){pm2['dump']();return _0x48f0f6[0x0];})[_0xae13('0x16')](respondWithResult(_0xf6289c,null))[_0xae13('0x12')](handleError(_0xf6289c,null));}else{return _0xf6289c[_0xae13('0xb')](0x1f4)[_0xae13('0x22')]({'message':_0xae13('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 7d93f3b..e6858b5 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 _0x7ffa=['./realtime.controller','/agents','isAuthenticated','/queues','getQueues','exports','Router'];(function(_0x464eb8,_0x294dba){var _0x39f9d3=function(_0x7b84a6){while(--_0x7b84a6){_0x464eb8['push'](_0x464eb8['shift']());}};_0x39f9d3(++_0x294dba);}(_0x7ffa,0x8b));var _0xa7ff=function(_0x1fa06f,_0x4711f8){_0x1fa06f=_0x1fa06f-0x0;var _0x213336=_0x7ffa[_0x1fa06f];return _0x213336;};'use strict';var express=require('express');var router=express[_0xa7ff('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xa7ff('0x1'));router['get'](_0xa7ff('0x2'),auth[_0xa7ff('0x3')](),controller['getAgents']);router['get'](_0xa7ff('0x4'),auth[_0xa7ff('0x3')](),controller[_0xa7ff('0x5')]);module[_0xa7ff('0x6')]=router; \ No newline at end of file +var _0xa761=['getQueues','exports','express','../../components/auth/service','./realtime.controller','get','isAuthenticated','getAgents','/queues'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xa761,0x89));var _0x1a76=function(_0x522ecd,_0x1c3573){_0x522ecd=_0x522ecd-0x0;var _0x2e4126=_0xa761[_0x522ecd];return _0x2e4126;};'use strict';var express=require(_0x1a76('0x0'));var router=express['Router']();var auth=require(_0x1a76('0x1'));var controller=require(_0x1a76('0x2'));router[_0x1a76('0x3')]('/agents',auth[_0x1a76('0x4')](),controller[_0x1a76('0x5')]);router[_0x1a76('0x3')](_0x1a76('0x6'),auth[_0x1a76('0x4')](),controller[_0x1a76('0x7')]);module[_0x1a76('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 77706fb..933a60c 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 _0xa9f3=['user','userProfileId','Agents','agent','online','extraQueryConditions','assign','omit','UserProfile','getResources','User','findAndCountAll','rows','map','find','filterAgentAttributes','getAgentStatus','includes','voice','pause','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','key','outbound','dialActive','dialMethod','QueueCampaigns','Queues','name','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','handleError','undefined','count','offset','limit','status','set','Content-Range','json','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','*pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','order','getRealtimeAgents','length','rawAttributes','fieldName','type','role','getOptions','push','sequelize','literal','forEach','Pause','where','merge'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa9f3,0x1d3));var _0x3a9f=function(_0x3edd69,_0x333a26){_0x3edd69=_0x3edd69-0x0;var _0x1b19f4=_0xa9f3[_0x3edd69];return _0x1b19f4;};'use strict';var _=require(_0x3a9f('0x0'));var util=require(_0x3a9f('0x1'));var rta=require(_0x3a9f('0x2'));var rtq=require(_0x3a9f('0x3'));var qs=require(_0x3a9f('0x4'));var utils=require('../../config/utils');var db=require(_0x3a9f('0x5'))['db'];var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APIHandleError=require(_0x3a9f('0x6'))[_0x3a9f('0x7')];function respondWithFilteredResult(_0x23a18e,_0x4d441e){return function(_0x55b681){if(_0x55b681){var _0x310108=typeof _0x4d441e['offset']===_0x3a9f('0x8')&&typeof _0x4d441e['limit']===_0x3a9f('0x8');var _0x29b39e=_0x55b681[_0x3a9f('0x9')];var _0x5477b1=_0x310108?0x0:_0x4d441e[_0x3a9f('0xa')];var _0x4b5b26=_0x310108?_0x55b681[_0x3a9f('0x9')]:_0x4d441e[_0x3a9f('0xa')]+_0x4d441e[_0x3a9f('0xb')];var _0x25b6b1;if(_0x4b5b26>=_0x29b39e){_0x4b5b26=_0x29b39e;_0x25b6b1=0xc8;}else{_0x25b6b1=0xce;}_0x23a18e[_0x3a9f('0xc')](_0x25b6b1);return _0x23a18e[_0x3a9f('0xd')](_0x3a9f('0xe'),_0x5477b1+'-'+_0x4b5b26+'/'+_0x29b39e)[_0x3a9f('0xf')](_0x55b681);}return null;};}exports[_0x3a9f('0x10')]=function(_0x4f0ec0,_0x2b1511){var _0x14acfd={'count':0x0,'rows':[]};var _0x1d26a7={};var _0x4176fe;var _0x5e758a=utils[_0x3a9f('0x11')]();var _0x5b3660;var _0x3faed4;var _0x3a40f2=_0x4f0ec0['query'][_0x3a9f('0x12')];var _0x546be2=_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x14')];var _0x1b23be=_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x15')];var _0x427437=_0x546be2==='pause'||_0x546be2===_0x3a9f('0x16')?!![]:![];var _0x13881c=[];var _0x344044;var _0x4ee741;Promise['resolve']()[_0x3a9f('0x17')](function(){if(_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x18')]){if(!utils[_0x3a9f('0x19')](_0x4f0ec0['query'][_0x3a9f('0x18')])){throw new APIBadRequestError(util[_0x3a9f('0x1a')](_0x3a9f('0x1b'),_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x18')]));}_0x4176fe=_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x18')][_0x3a9f('0x1c')]();}if(!_0x4f0ec0['query'][_0x3a9f('0x1d')]||!_0x4f0ec0['query']['sort']['includes'](_0x3a9f('0x1e'))){_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x1d')]=rta[_0x3a9f('0x1f')](_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x1d')]);return;}var _0x422ecd=rta[_0x3a9f('0x20')](_0x4f0ec0['query'][_0x3a9f('0x1d')]);_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x1d')]=_0x422ecd[_0x3a9f('0x21')]['join'](',');_0x344044=_0x422ecd[_0x3a9f('0x22')];})[_0x3a9f('0x17')](function(){if(!_0x3a40f2){return[];}return rta['getAgentIdsByQueues'](_0x3a40f2,_0x4176fe);})['then'](function(_0x544e0d){_0x13881c=_0x544e0d;return rta[_0x3a9f('0x23')]();})['then'](function(_0x1dc8a0){_0x3faed4=_0x1dc8a0['rows'];if((!_0x546be2||_0x427437)&&!_0x344044){return _0x13881c;}if(_0x344044&&!_0x546be2){return rta['getSortedAgentsIdsByStatus'](_0x3faed4,_0x13881c,_0x344044);}else{return rta['getAgentIdsByStatus'](_0x3faed4,_0x13881c,_0x546be2);}})[_0x3a9f('0x17')](function(_0x132c25){_0x13881c=_0x132c25;var _0x5950f8=![];if(_0x13881c[_0x3a9f('0x24')]===0x0){if(_0x3a40f2||_0x546be2){_0x5950f8=!![];}if(_0x427437){_0x5950f8=![];}}if(_0x5950f8){return _0x14acfd;}var _0x23e1a7=_['map'](db['User'][_0x3a9f('0x25')],function(_0x595b13){return{'name':_0x595b13[_0x3a9f('0x26')],'type':_0x595b13[_0x3a9f('0x27')]['key']};});_0x4f0ec0['query'][_0x3a9f('0x28')]='agent';_0x1d26a7=qs[_0x3a9f('0x29')](_0x23e1a7,_0x4f0ec0);_0x1d26a7['raw']=!![];var _0x5a4f28=[];if(_0x13881c[_0x3a9f('0x24')]>0x0){_0x5a4f28[_0x3a9f('0x2a')]({'id':{'$in':_0x13881c}});if(_0x344044&&!_0x546be2){_0x4ee741=[db[_0x3a9f('0x2b')][_0x3a9f('0x2c')]('FIELD(id,'+_0x13881c+')')];_0x1d26a7[_0x3a9f('0x22')]=_0x4ee741;}}if(_0x427437){_0x5e758a[_0x3a9f('0x2d')](function(_0x1e983f){var _0x1863e0=!![];if(_0x546be2===_0x3a9f('0x16')&&_0x4176fe!==_0x1e983f){_0x1863e0=![];}_0x5a4f28[_0x3a9f('0x2a')]({[_0x1e983f+_0x3a9f('0x2e')]:_0x1863e0});});if(_0x1b23be){_0x5a4f28[_0x3a9f('0x2a')]({'pauseType':_0x1b23be});}}else if(_0x546be2){_0x5e758a['forEach'](function(_0x40319a){_0x5a4f28[_0x3a9f('0x2a')]({[_0x40319a+_0x3a9f('0x2e')]:![]});});}_0x1d26a7[_0x3a9f('0x2f')]=_[_0x3a9f('0x30')](_0x1d26a7[_0x3a9f('0x2f')],{'$and':_0x5a4f28});if(_0x4f0ec0['user']['role']===_0x3a9f('0x31')){var _0x8559a7={'params':{'id':_0x4f0ec0[_0x3a9f('0x31')][_0x3a9f('0x32')]},'query':{'section':_0x3a9f('0x33'),'role':_0x3a9f('0x34'),'raw':!![],'ids':_0x13881c,'customSorting':_0x4ee741}};if(_0x4f0ec0['query'][_0x3a9f('0x35')]){_0x8559a7[_0x3a9f('0x13')][_0x3a9f('0x35')]=!![];}if(_0x427437){_0x8559a7['query'][_0x3a9f('0x36')]=_0x5a4f28;}_0x8559a7[_0x3a9f('0x13')]=Object[_0x3a9f('0x37')](_0x8559a7[_0x3a9f('0x13')],_[_0x3a9f('0x38')](_0x4f0ec0[_0x3a9f('0x13')],'id'));return db[_0x3a9f('0x39')][_0x3a9f('0x3a')](_0x8559a7);}return db[_0x3a9f('0x3b')][_0x3a9f('0x3c')](_0x1d26a7);})['then'](function(_0x205f31){_0x14acfd[_0x3a9f('0x9')]=_0x205f31[_0x3a9f('0x9')];_0x5b3660=_0x205f31[_0x3a9f('0x3d')];return _0x5b3660[_0x3a9f('0x3e')](function(_0x5d2e32){var _0x117f1f=_[_0x3a9f('0x3f')](_0x3faed4,['id',_0x5d2e32['id']]);if(_0x117f1f){var _0x199966=rta[_0x3a9f('0x40')](_0x117f1f);_['merge'](_0x5d2e32,_0x199966);}_0x5d2e32[_0x3a9f('0x1e')]=rta[_0x3a9f('0x41')](_0x5d2e32);if(_0x5d2e32['globalStatus'][_0x3a9f('0x42')]('pause')){_0x5e758a[_0x3a9f('0x2d')](function(_0x78bca1){if(_0x5d2e32[_0x78bca1+'Pause']){if(_0x78bca1===_0x3a9f('0x43')){if(_0x5d2e32['voiceStatus']!=='talking'){_0x5d2e32['voiceStatus']=_0x3a9f('0x44');}}else{_0x5d2e32[_0x78bca1+_0x3a9f('0x45')]=_0x3a9f('0x44');}}});}return _0x5d2e32;});})[_0x3a9f('0x17')](function(_0x1cadfe){if(!_0x344044||_0x4ee741){return _0x1cadfe;}return rta[_0x3a9f('0x46')](_0x1cadfe,_0x344044);})[_0x3a9f('0x17')](function(_0x154f8d){var _0x12402d=rta[_0x3a9f('0x47')]();_0x14acfd['rows']=_0x154f8d[_0x3a9f('0x3e')](function(_0x43fa49){return _[_0x3a9f('0x48')](_0x43fa49,_0x12402d);});return _0x14acfd;})[_0x3a9f('0x17')](respondWithFilteredResult(_0x2b1511,_0x1d26a7))[_0x3a9f('0x49')](APIHandleError(_0x2b1511));};exports[_0x3a9f('0x4a')]=function(_0x58304e,_0x1fddb0){var _0x1a684a={'count':0x0,'rows':[]};var _0x443eb1={};var _0x5ee654;var _0x268067;var _0x23209c;Promise['resolve']()[_0x3a9f('0x17')](function(){if(_0x58304e[_0x3a9f('0x13')][_0x3a9f('0x18')]){if(!utils[_0x3a9f('0x19')](_0x58304e[_0x3a9f('0x13')]['channel'])){throw new APIBadRequestError(util[_0x3a9f('0x1a')](_0x3a9f('0x1b'),_0x58304e[_0x3a9f('0x13')][_0x3a9f('0x18')]));}_0x5ee654=_0x58304e[_0x3a9f('0x13')]['channel'][_0x3a9f('0x1c')]();}var _0x55ae84=_[_0x3a9f('0x4b')](_0x5ee654)+'Queue';var _0x8a86ec=_[_0x3a9f('0x3e')](db[_0x55ae84]['rawAttributes'],function(_0x3d0dd5){return{'name':_0x3d0dd5[_0x3a9f('0x26')],'type':_0x3d0dd5[_0x3a9f('0x27')][_0x3a9f('0x4c')]};});if(!_0x58304e[_0x3a9f('0x13')]['fields']){var _0x1bec59=['id','name'];if(_0x5ee654===_0x3a9f('0x43')){_0x1bec59['push'](_0x3a9f('0x27'));if(_0x58304e['query'][_0x3a9f('0x27')]===_0x3a9f('0x4d')){_0x1bec59[_0x3a9f('0x2a')]([_0x3a9f('0x4e'),_0x3a9f('0x4f')]);}}_0x58304e[_0x3a9f('0x13')]['fields']=_0x1bec59['join'](',');}_0x443eb1=qs['getOptions'](_0x8a86ec,_0x58304e);if(_0x58304e[_0x3a9f('0x31')][_0x3a9f('0x28')]===_0x3a9f('0x31')){var _0x21ca0f={'params':{'id':_0x58304e[_0x3a9f('0x31')][_0x3a9f('0x32')]},'query':{'section':_0x5ee654===_0x3a9f('0x43')&&_0x58304e[_0x3a9f('0x13')]['type']===_0x3a9f('0x4d')?_0x3a9f('0x50'):_['startCase'](_0x5ee654)+_0x3a9f('0x51'),'type':_0x58304e[_0x3a9f('0x13')][_0x3a9f('0x27')],'nolimit':!![],'sort':_0x3a9f('0x52'),'filter':_0x58304e[_0x3a9f('0x13')][_0x3a9f('0x53')]}};_0x21ca0f[_0x3a9f('0x13')]=Object[_0x3a9f('0x37')](_0x21ca0f[_0x3a9f('0x13')],_0x58304e['query']);delete _0x21ca0f['query']['id'];return db['UserProfile'][_0x3a9f('0x3a')](_0x21ca0f);}return db[_0x55ae84][_0x3a9f('0x3c')](_0x443eb1);})[_0x3a9f('0x17')](function(_0x5cb2db){_0x1a684a[_0x3a9f('0x9')]=_0x5cb2db[_0x3a9f('0x9')];_0x268067=_0x5cb2db[_0x3a9f('0x3d')];return rtq[_0x3a9f('0x54')](_0x58304e,_0x5ee654);})[_0x3a9f('0x17')](function(_0x2e5f9d){_0x23209c=_0x2e5f9d[_0x3a9f('0x3d')];return rtq[_0x3a9f('0x55')](_0x268067,_0x23209c,_0x5ee654,_0x58304e[_0x3a9f('0x13')]['type']);})[_0x3a9f('0x17')](function(_0x412fe0){_0x1a684a['rows']=_0x412fe0;return _0x1a684a;})['then'](respondWithFilteredResult(_0x1fddb0,_0x443eb1))[_0x3a9f('0x49')](APIHandleError(_0x1fddb0));}; \ No newline at end of file +var _0x86ab=['raw','sequelize','literal','FIELD(id,','forEach','push','Pause','where','merge','user','Agents','online','extraQueryConditions','assign','getResources','findAndCountAll','find','filterAgentAttributes','globalStatus','getAgentStatus','includes','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','Queue','fields','name','outbound','dialActive','dialMethod','join','userProfileId','QueueCampaigns','Queues','filter','UserProfile','getRealtimeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','APIBadRequestError','../../errors/api','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','pauseTypeFilter','pause','*pause','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','validateSortParameter','getUpdatedSortOptions','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions'];(function(_0x28ea3b,_0x13d7a1){var _0x5ac766=function(_0x1ea77b){while(--_0x1ea77b){_0x28ea3b['push'](_0x28ea3b['shift']());}};_0x5ac766(++_0x13d7a1);}(_0x86ab,0x140));var _0xb86a=function(_0x704d5d,_0xf94e89){_0x704d5d=_0x704d5d-0x0;var _0x1020ee=_0x86ab[_0x704d5d];return _0x1020ee;};'use strict';var _=require(_0xb86a('0x0'));var util=require('util');var rta=require(_0xb86a('0x1'));var rtq=require(_0xb86a('0x2'));var qs=require(_0xb86a('0x3'));var utils=require(_0xb86a('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require('../../errors/api')[_0xb86a('0x5')];var APIHandleError=require(_0xb86a('0x6'))[_0xb86a('0x7')];function respondWithFilteredResult(_0x2a6335,_0x336e69){return function(_0x49b89d){if(_0x49b89d){var _0x4e8159=typeof _0x336e69[_0xb86a('0x8')]===_0xb86a('0x9')&&typeof _0x336e69[_0xb86a('0xa')]===_0xb86a('0x9');var _0x15bb84=_0x49b89d[_0xb86a('0xb')];var _0x3f2439=_0x4e8159?0x0:_0x336e69['offset'];var _0x530efd=_0x4e8159?_0x49b89d[_0xb86a('0xb')]:_0x336e69[_0xb86a('0x8')]+_0x336e69[_0xb86a('0xa')];var _0x5235c2;if(_0x530efd>=_0x15bb84){_0x530efd=_0x15bb84;_0x5235c2=0xc8;}else{_0x5235c2=0xce;}_0x2a6335[_0xb86a('0xc')](_0x5235c2);return _0x2a6335[_0xb86a('0xd')](_0xb86a('0xe'),_0x3f2439+'-'+_0x530efd+'/'+_0x15bb84)[_0xb86a('0xf')](_0x49b89d);}return null;};}exports[_0xb86a('0x10')]=function(_0x167f10,_0x244367){var _0x2f0ae3={'count':0x0,'rows':[]};var _0x51ef57={};var _0x2a32e2;var _0x5acead=utils[_0xb86a('0x11')]();var _0x573fe0;var _0x16567d;var _0x3a3885=_0x167f10['query']['globalQueueFilter'];var _0x41a02d=_0x167f10[_0xb86a('0x12')]['globalStatusFilter'];var _0x675589=_0x167f10[_0xb86a('0x12')][_0xb86a('0x13')];var _0x1f49b5=_0x41a02d===_0xb86a('0x14')||_0x41a02d===_0xb86a('0x15')?!![]:![];var _0x3cc71d=[];var _0x5dca65;var _0x5b2dee;Promise[_0xb86a('0x16')]()['then'](function(){if(_0x167f10['query'][_0xb86a('0x17')]){if(!utils[_0xb86a('0x18')](_0x167f10[_0xb86a('0x12')]['channel'])){throw new APIBadRequestError(util[_0xb86a('0x19')](_0xb86a('0x1a'),_0x167f10[_0xb86a('0x12')][_0xb86a('0x17')]));}_0x2a32e2=_0x167f10[_0xb86a('0x12')]['channel'][_0xb86a('0x1b')]();}if(!_0x167f10[_0xb86a('0x12')][_0xb86a('0x1c')]||!_0x167f10[_0xb86a('0x12')][_0xb86a('0x1c')]['includes']('globalStatus')){_0x167f10[_0xb86a('0x12')][_0xb86a('0x1c')]=rta[_0xb86a('0x1d')](_0x167f10[_0xb86a('0x12')][_0xb86a('0x1c')]);return;}var _0x25ddc4=rta[_0xb86a('0x1e')](_0x167f10['query'][_0xb86a('0x1c')]);_0x167f10[_0xb86a('0x12')][_0xb86a('0x1c')]=_0x25ddc4['fields']['join'](',');_0x5dca65=_0x25ddc4[_0xb86a('0x1f')];})[_0xb86a('0x20')](function(){if(!_0x3a3885){return[];}return rta[_0xb86a('0x21')](_0x3a3885,_0x2a32e2);})['then'](function(_0x2d0de8){_0x3cc71d=_0x2d0de8;return rta[_0xb86a('0x22')]();})[_0xb86a('0x20')](function(_0x3abd9c){_0x16567d=_0x3abd9c[_0xb86a('0x23')];if((!_0x41a02d||_0x1f49b5)&&!_0x5dca65){return _0x3cc71d;}if(_0x5dca65&&!_0x41a02d){return rta[_0xb86a('0x24')](_0x16567d,_0x3cc71d,_0x5dca65);}else{return rta[_0xb86a('0x25')](_0x16567d,_0x3cc71d,_0x41a02d);}})[_0xb86a('0x20')](function(_0x4606e8){_0x3cc71d=_0x4606e8;var _0x16420c=![];if(_0x3cc71d[_0xb86a('0x26')]===0x0){if(_0x3a3885||_0x41a02d){_0x16420c=!![];}if(_0x1f49b5){_0x16420c=![];}}if(_0x16420c){return _0x2f0ae3;}var _0x41ca36=_[_0xb86a('0x27')](db[_0xb86a('0x28')][_0xb86a('0x29')],function(_0x4b5744){return{'name':_0x4b5744[_0xb86a('0x2a')],'type':_0x4b5744[_0xb86a('0x2b')][_0xb86a('0x2c')]};});_0x167f10[_0xb86a('0x12')][_0xb86a('0x2d')]=_0xb86a('0x2e');_0x51ef57=qs[_0xb86a('0x2f')](_0x41ca36,_0x167f10);_0x51ef57[_0xb86a('0x30')]=!![];var _0x20022f=[];if(_0x3cc71d[_0xb86a('0x26')]>0x0){_0x20022f['push']({'id':{'$in':_0x3cc71d}});if(_0x5dca65&&!_0x41a02d){_0x5b2dee=[db[_0xb86a('0x31')][_0xb86a('0x32')](_0xb86a('0x33')+_0x3cc71d+')')];_0x51ef57[_0xb86a('0x1f')]=_0x5b2dee;}}if(_0x1f49b5){_0x5acead[_0xb86a('0x34')](function(_0x21b5c8){var _0x458319=!![];if(_0x41a02d==='*pause'&&_0x2a32e2!==_0x21b5c8){_0x458319=![];}_0x20022f[_0xb86a('0x35')]({[_0x21b5c8+_0xb86a('0x36')]:_0x458319});});if(_0x675589){_0x20022f['push']({'pauseType':_0x675589});}}else if(_0x41a02d){_0x5acead[_0xb86a('0x34')](function(_0x18cf82){_0x20022f[_0xb86a('0x35')]({[_0x18cf82+_0xb86a('0x36')]:![]});});}_0x51ef57[_0xb86a('0x37')]=_[_0xb86a('0x38')](_0x51ef57[_0xb86a('0x37')],{'$and':_0x20022f});if(_0x167f10[_0xb86a('0x39')][_0xb86a('0x2d')]===_0xb86a('0x39')){var _0x5b2816={'params':{'id':_0x167f10[_0xb86a('0x39')]['userProfileId']},'query':{'section':_0xb86a('0x3a'),'role':_0xb86a('0x2e'),'raw':!![],'ids':_0x3cc71d,'customSorting':_0x5b2dee}};if(_0x167f10[_0xb86a('0x12')][_0xb86a('0x3b')]){_0x5b2816[_0xb86a('0x12')][_0xb86a('0x3b')]=!![];}if(_0x1f49b5){_0x5b2816['query'][_0xb86a('0x3c')]=_0x20022f;}_0x5b2816[_0xb86a('0x12')]=Object[_0xb86a('0x3d')](_0x5b2816[_0xb86a('0x12')],_['omit'](_0x167f10[_0xb86a('0x12')],'id'));return db['UserProfile'][_0xb86a('0x3e')](_0x5b2816);}return db[_0xb86a('0x28')][_0xb86a('0x3f')](_0x51ef57);})[_0xb86a('0x20')](function(_0x3382c6){_0x2f0ae3['count']=_0x3382c6['count'];_0x573fe0=_0x3382c6[_0xb86a('0x23')];return _0x573fe0[_0xb86a('0x27')](function(_0x2c4a8d){var _0x2cbd75=_[_0xb86a('0x40')](_0x16567d,['id',_0x2c4a8d['id']]);if(_0x2cbd75){var _0x3beeea=rta[_0xb86a('0x41')](_0x2cbd75);_['merge'](_0x2c4a8d,_0x3beeea);}_0x2c4a8d[_0xb86a('0x42')]=rta[_0xb86a('0x43')](_0x2c4a8d);if(_0x2c4a8d[_0xb86a('0x42')][_0xb86a('0x44')](_0xb86a('0x14'))){_0x5acead[_0xb86a('0x34')](function(_0x2feafa){if(_0x2c4a8d[_0x2feafa+_0xb86a('0x36')]){if(_0x2feafa===_0xb86a('0x45')){if(_0x2c4a8d[_0xb86a('0x46')]!==_0xb86a('0x47')){_0x2c4a8d[_0xb86a('0x46')]=_0xb86a('0x14');}}else{_0x2c4a8d[_0x2feafa+_0xb86a('0x48')]=_0xb86a('0x14');}}});}return _0x2c4a8d;});})[_0xb86a('0x20')](function(_0x423180){if(!_0x5dca65||_0x5b2dee){return _0x423180;}return rta[_0xb86a('0x49')](_0x423180,_0x5dca65);})[_0xb86a('0x20')](function(_0x3f7117){var _0x3bd6d0=rta[_0xb86a('0x4a')]();_0x2f0ae3[_0xb86a('0x23')]=_0x3f7117[_0xb86a('0x27')](function(_0x152627){return _[_0xb86a('0x4b')](_0x152627,_0x3bd6d0);});return _0x2f0ae3;})['then'](respondWithFilteredResult(_0x244367,_0x51ef57))[_0xb86a('0x4c')](APIHandleError(_0x244367));};exports[_0xb86a('0x4d')]=function(_0x2bf30f,_0x1c21f6){var _0x1c9c0f={'count':0x0,'rows':[]};var _0x2ee837={};var _0x333712;var _0x37eac3;var _0x1a5181;Promise[_0xb86a('0x16')]()[_0xb86a('0x20')](function(){if(_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x17')]){if(!utils[_0xb86a('0x18')](_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x17')])){throw new APIBadRequestError(util['format'](_0xb86a('0x1a'),_0x2bf30f['query'][_0xb86a('0x17')]));}_0x333712=_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x17')][_0xb86a('0x1b')]();}var _0x293a72=_[_0xb86a('0x4e')](_0x333712)+_0xb86a('0x4f');var _0x270f56=_[_0xb86a('0x27')](db[_0x293a72][_0xb86a('0x29')],function(_0x4f94cb){return{'name':_0x4f94cb[_0xb86a('0x2a')],'type':_0x4f94cb[_0xb86a('0x2b')]['key']};});if(!_0x2bf30f['query'][_0xb86a('0x50')]){var _0x175f35=['id',_0xb86a('0x51')];if(_0x333712===_0xb86a('0x45')){_0x175f35[_0xb86a('0x35')](_0xb86a('0x2b'));if(_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x2b')]===_0xb86a('0x52')){_0x175f35[_0xb86a('0x35')]([_0xb86a('0x53'),_0xb86a('0x54')]);}}_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x50')]=_0x175f35[_0xb86a('0x55')](',');}_0x2ee837=qs[_0xb86a('0x2f')](_0x270f56,_0x2bf30f);if(_0x2bf30f['user'][_0xb86a('0x2d')]===_0xb86a('0x39')){var _0x202a2b={'params':{'id':_0x2bf30f['user'][_0xb86a('0x56')]},'query':{'section':_0x333712===_0xb86a('0x45')&&_0x2bf30f['query'][_0xb86a('0x2b')]==='outbound'?_0xb86a('0x57'):_[_0xb86a('0x4e')](_0x333712)+_0xb86a('0x58'),'type':_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x2b')],'nolimit':!![],'sort':'name','filter':_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x59')]}};_0x202a2b[_0xb86a('0x12')]=Object[_0xb86a('0x3d')](_0x202a2b[_0xb86a('0x12')],_0x2bf30f[_0xb86a('0x12')]);delete _0x202a2b['query']['id'];return db[_0xb86a('0x5a')][_0xb86a('0x3e')](_0x202a2b);}return db[_0x293a72]['findAndCountAll'](_0x2ee837);})[_0xb86a('0x20')](function(_0x492cac){_0x1c9c0f['count']=_0x492cac[_0xb86a('0xb')];_0x37eac3=_0x492cac[_0xb86a('0x23')];return rtq[_0xb86a('0x5b')](_0x2bf30f,_0x333712);})[_0xb86a('0x20')](function(_0x4cd0bf){_0x1a5181=_0x4cd0bf[_0xb86a('0x23')];return rtq['initializeQueues'](_0x37eac3,_0x1a5181,_0x333712,_0x2bf30f[_0xb86a('0x12')]['type']);})[_0xb86a('0x20')](function(_0x21c905){_0x1c9c0f[_0xb86a('0x23')]=_0x21c905;return _0x1c9c0f;})[_0xb86a('0x20')](respondWithFilteredResult(_0x1c21f6,_0x2ee837))[_0xb86a('0x4c')](APIHandleError(_0x1c21f6));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index fc66836..540eccd 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xa1f5c4,_0x247496){var _0x3f2f74=function(_0x3dae53){while(--_0x3dae53){_0xa1f5c4['push'](_0xa1f5c4['shift']());}};_0x3f2f74(++_0x247496);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x29d7d4,_0x27da9e){var _0x4196d1=function(_0x3190ab){while(--_0x3190ab){_0x29d7d4['push'](_0x29d7d4['shift']());}};_0x4196d1(++_0x27da9e);}(_0xedd9,0xfc));var _0x9edd=function(_0x18d5bf,_0x13c110){_0x18d5bf=_0x18d5bf-0x0;var _0x29ac4b=_0xedd9[_0x18d5bf];return _0x29ac4b;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 32f2be5..897f8b5 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 _0x869e=['INTEGER','DATE','STRING','sequelize','exports'];(function(_0xed3008,_0x24ec19){var _0xa84e62=function(_0x3356f2){while(--_0x3356f2){_0xed3008['push'](_0xed3008['shift']());}};_0xa84e62(++_0x24ec19);}(_0x869e,0x15c));var _0xe869=function(_0x1ecf91,_0x3f6399){_0x1ecf91=_0x1ecf91-0x0;var _0x103dd8=_0x869e[_0x1ecf91];return _0x103dd8;};'use strict';var Sequelize=require(_0xe869('0x0'));module[_0xe869('0x1')]={'state':{'type':Sequelize[_0xe869('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe869('0x3')]},'uniqueid':{'type':Sequelize[_0xe869('0x4')]},'starttime':{'type':Sequelize[_0xe869('0x3')]},'responsetime':{'type':Sequelize[_0xe869('0x3')]},'ringtime':{'type':Sequelize[_0xe869('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe869('0x4')]},'membername':{'type':Sequelize[_0xe869('0x4')]}}; \ No newline at end of file +var _0xc962=['INTEGER','sequelize','DATE','STRING'];(function(_0x340673,_0x57da0d){var _0x4c5db1=function(_0x57965c){while(--_0x57965c){_0x340673['push'](_0x340673['shift']());}};_0x4c5db1(++_0x57da0d);}(_0xc962,0x6d));var _0x2c96=function(_0x4546d7,_0x2b13f4){_0x4546d7=_0x4546d7-0x0;var _0xff48a=_0xc962[_0x4546d7];return _0xff48a;};'use strict';var Sequelize=require(_0x2c96('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2c96('0x1')]},'uniqueid':{'type':Sequelize[_0x2c96('0x2')]},'starttime':{'type':Sequelize[_0x2c96('0x1')]},'responsetime':{'type':Sequelize[_0x2c96('0x1')]},'ringtime':{'type':Sequelize[_0x2c96('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x2c96('0x2')]},'campaigntype':{'type':Sequelize[_0x2c96('0x2')]},'membername':{'type':Sequelize[_0x2c96('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a244201..d4cfebd 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 _0x8d70=['./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0xd34b55,_0x217d27){var _0x26162f=function(_0x3d3a32){while(--_0x3d3a32){_0xd34b55['push'](_0xd34b55['shift']());}};_0x26162f(++_0x217d27);}(_0x8d70,0x17a));var _0x08d7=function(_0x27f94a,_0x350916){_0x27f94a=_0x27f94a-0x0;var _0x34876a=_0x8d70[_0x27f94a];return _0x34876a;};'use strict';var _=require(_0x08d7('0x0'));var util=require(_0x08d7('0x1'));var logger=require(_0x08d7('0x2'))(_0x08d7('0x3'));var moment=require(_0x08d7('0x4'));var BPromise=require('bluebird');var rp=require(_0x08d7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x08d7('0x6'));var attributes=require(_0x08d7('0x7'));module[_0x08d7('0x8')]=function(_0x3fb307,_0x350b36){return _0x3fb307[_0x08d7('0x9')]('ReportAgentPreview',attributes,{'tableName':_0x08d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a94=['path','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1912b7,_0x2554e4){var _0x5b1789=function(_0x40a915){while(--_0x40a915){_0x1912b7['push'](_0x1912b7['shift']());}};_0x5b1789(++_0x2554e4);}(_0x5a94,0xc2));var _0x45a9=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x5a94[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x45a9('0x0'));var util=require(_0x45a9('0x1'));var logger=require(_0x45a9('0x2'))(_0x45a9('0x3'));var moment=require(_0x45a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x45a9('0x5'));var fs=require('fs');var path=require(_0x45a9('0x6'));var rimraf=require('rimraf');var config=require(_0x45a9('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0x45a9('0x8')]=function(_0xe37f2a,_0x5e2fdf){return _0xe37f2a[_0x45a9('0x9')]('ReportAgentPreview',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 576bc8c..1bae6b1 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 _0x3597=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','result','catch','ReportAgentPreview','create','options','CreateReportAgentPreview','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0x3597,0x91));var _0x7359=function(_0x31cd4a,_0x23eac9){_0x31cd4a=_0x31cd4a-0x0;var _0x57eb73=_0x3597[_0x31cd4a];return _0x57eb73;};'use strict';var _=require(_0x7359('0x0'));var util=require('util');var moment=require(_0x7359('0x1'));var BPromise=require(_0x7359('0x2'));var rs=require(_0x7359('0x3'));var fs=require('fs');var Redis=require(_0x7359('0x4'));var db=require(_0x7359('0x5'))['db'];var utils=require(_0x7359('0x6'));var logger=require(_0x7359('0x7'))('rpc');var config=require(_0x7359('0x8'));var jayson=require(_0x7359('0x9'));var client=jayson[_0x7359('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9b20,_0x5143ae,_0x435848){return new BPromise(function(_0x3e4f4e,_0xc03e3){return client[_0x7359('0xb')](_0x1b9b20,_0x435848)[_0x7359('0xc')](function(_0x5830ee){logger[_0x7359('0xd')](_0x7359('0xe'),_0x5143ae,_0x7359('0xf'));logger[_0x7359('0x10')](_0x7359('0x11'),_0x5143ae,_0x7359('0xf'),JSON['stringify'](_0x5830ee));if(_0x5830ee['error']){if(_0x5830ee[_0x7359('0x12')]['code']===0x1f4){logger[_0x7359('0x12')](_0x7359('0xe'),_0x5143ae,_0x5830ee[_0x7359('0x12')][_0x7359('0x13')]);return _0xc03e3(_0x5830ee[_0x7359('0x12')][_0x7359('0x13')]);}logger['error'](_0x7359('0xe'),_0x5143ae,_0x5830ee[_0x7359('0x12')][_0x7359('0x13')]);return _0x3e4f4e(_0x5830ee['error'][_0x7359('0x13')]);}else{logger[_0x7359('0xd')](_0x7359('0xe'),_0x5143ae,_0x7359('0xf'));_0x3e4f4e(_0x5830ee[_0x7359('0x14')][_0x7359('0x13')]);}})[_0x7359('0x15')](function(_0x410fa2){logger[_0x7359('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5143ae,_0x410fa2);_0xc03e3(_0x410fa2);});});}exports['CreateReportAgentPreview']=function(_0x5cb20c){var _0x536fca=this;return new Promise(function(_0xa269ee,_0x4b81ed){return db[_0x7359('0x16')][_0x7359('0x17')](_0x5cb20c['body'],{'raw':_0x5cb20c['options']?_0x5cb20c[_0x7359('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7359('0xc')](function(_0x119cf9){logger[_0x7359('0xd')](_0x7359('0x19'),_0x5cb20c);logger[_0x7359('0x10')](_0x7359('0x19'),_0x5cb20c,JSON[_0x7359('0x1a')](_0x119cf9));_0xa269ee(_0x119cf9);})[_0x7359('0x15')](function(_0x8a804a){logger[_0x7359('0x12')](_0x7359('0x19'),_0x8a804a['message'],_0x5cb20c);_0x4b81ed(_0x536fca[_0x7359('0x12')](0x1f4,_0x8a804a[_0x7359('0x13')]));});});}; \ No newline at end of file +var _0x47ca=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','info','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x47ca,0xff));var _0xa47c=function(_0x29a2ce,_0x5d6558){_0x29a2ce=_0x29a2ce-0x0;var _0x2fa9ea=_0x47ca[_0x29a2ce];return _0x2fa9ea;};'use strict';var _=require(_0xa47c('0x0'));var util=require(_0xa47c('0x1'));var moment=require(_0xa47c('0x2'));var BPromise=require(_0xa47c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa47c('0x4'));var db=require(_0xa47c('0x5'))['db'];var utils=require(_0xa47c('0x6'));var logger=require(_0xa47c('0x7'))(_0xa47c('0x8'));var config=require(_0xa47c('0x9'));var jayson=require(_0xa47c('0xa'));var client=jayson[_0xa47c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc7159e,_0x437e37,_0x206972){return new BPromise(function(_0x28a9d0,_0x3c1eb9){return client[_0xa47c('0xc')](_0xc7159e,_0x206972)[_0xa47c('0xd')](function(_0xd6dbb2){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x437e37,_0xa47c('0xe'));logger['debug'](_0xa47c('0xf'),_0x437e37,_0xa47c('0xe'),JSON['stringify'](_0xd6dbb2));if(_0xd6dbb2[_0xa47c('0x10')]){if(_0xd6dbb2[_0xa47c('0x10')][_0xa47c('0x11')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x437e37,_0xd6dbb2['error'][_0xa47c('0x12')]);return _0x3c1eb9(_0xd6dbb2['error'][_0xa47c('0x12')]);}logger[_0xa47c('0x10')](_0xa47c('0x13'),_0x437e37,_0xd6dbb2[_0xa47c('0x10')][_0xa47c('0x12')]);return _0x28a9d0(_0xd6dbb2[_0xa47c('0x10')]['message']);}else{logger['info'](_0xa47c('0x13'),_0x437e37,_0xa47c('0xe'));_0x28a9d0(_0xd6dbb2[_0xa47c('0x14')][_0xa47c('0x12')]);}})['catch'](function(_0x348f7d){logger[_0xa47c('0x10')](_0xa47c('0x13'),_0x437e37,_0x348f7d);_0x3c1eb9(_0x348f7d);});});}exports[_0xa47c('0x15')]=function(_0x5a1789){var _0x14a9d8=this;return new Promise(function(_0x1eb669,_0x1c45f6){return db[_0xa47c('0x16')][_0xa47c('0x17')](_0x5a1789[_0xa47c('0x18')],{'raw':_0x5a1789['options']?_0x5a1789[_0xa47c('0x19')][_0xa47c('0x1a')]===undefined?!![]:![]:!![]})[_0xa47c('0xd')](function(_0x49d877){logger[_0xa47c('0x1b')](_0xa47c('0x15'),_0x5a1789);logger['debug'](_0xa47c('0x15'),_0x5a1789,JSON[_0xa47c('0x1c')](_0x49d877));_0x1eb669(_0x49d877);})[_0xa47c('0x1d')](function(_0x2bb8d9){logger[_0xa47c('0x10')](_0xa47c('0x15'),_0x2bb8d9[_0xa47c('0x12')],_0x5a1789);_0x1c45f6(_0x14a9d8[_0xa47c('0x10')](0x1f4,_0x2bb8d9[_0xa47c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b15dc54..9c4f8a6 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 _0x6231=['/agents','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels'];(function(_0x1566fc,_0x3e42cc){var _0x578288=function(_0x1dd98e){while(--_0x1dd98e){_0x1566fc['push'](_0x1566fc['shift']());}};_0x578288(++_0x3e42cc);}(_0x6231,0x113));var _0x1623=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6231[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1623('0x0'));var express=require(_0x1623('0x1'));var router=express[_0x1623('0x2')]();var auth=require(_0x1623('0x3'));var controller=require(_0x1623('0x4'));router[_0x1623('0x5')]('/voice/channels',auth[_0x1623('0x6')](),controller[_0x1623('0x7')]);router[_0x1623('0x5')](_0x1623('0x8'),auth['isAuthenticated'](),controller[_0x1623('0x9')]);router['get'](_0x1623('0xa'),auth[_0x1623('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0x1623('0x5')](_0x1623('0xb'),auth[_0x1623('0x6')](),controller[_0x1623('0xc')]);router[_0x1623('0x5')](_0x1623('0xd'),auth[_0x1623('0x6')](),controller['chatQueues']);router['get'](_0x1623('0xe'),auth[_0x1623('0x6')](),controller[_0x1623('0xf')]);router[_0x1623('0x5')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x1623('0x10')]);router[_0x1623('0x5')](_0x1623('0x11'),auth['isAuthenticated'](),controller[_0x1623('0x12')]);router[_0x1623('0x5')]('/sms/queues',auth['isAuthenticated'](),controller[_0x1623('0x13')]);router[_0x1623('0x5')]('/whatsapp/queues',auth[_0x1623('0x6')](),controller[_0x1623('0x14')]);router[_0x1623('0x5')](_0x1623('0x15'),auth[_0x1623('0x6')](),controller[_0x1623('0x16')]);router['get'](_0x1623('0x17'),auth[_0x1623('0x6')](),controller['voiceQueuesPreview']);router[_0x1623('0x5')](_0x1623('0x18'),auth['isAuthenticated'](),controller[_0x1623('0x19')]);router[_0x1623('0x5')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x1623('0x1a')]);router[_0x1623('0x5')](_0x1623('0x1b'),auth[_0x1623('0x6')](),controller[_0x1623('0x1c')]);router[_0x1623('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x1623('0x6')](),controller[_0x1623('0x1d')]);router[_0x1623('0x5')](_0x1623('0x1e'),auth[_0x1623('0x6')](),controller[_0x1623('0x1f')]);router[_0x1623('0x20')](_0x1623('0x1e'),auth[_0x1623('0x6')](),controller[_0x1623('0x21')]);router['get'](_0x1623('0x22'),auth[_0x1623('0x6')](),controller['outbound']);router[_0x1623('0x5')](_0x1623('0x23'),auth[_0x1623('0x6')](),controller[_0x1623('0x24')]);router[_0x1623('0x5')](_0x1623('0x25'),auth[_0x1623('0x6')](),controller['agents']);router[_0x1623('0x20')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x1623('0x26')]);router[_0x1623('0x5')]('/telephones',auth[_0x1623('0x6')](),controller[_0x1623('0x27')]);router[_0x1623('0x5')](_0x1623('0x28'),auth[_0x1623('0x6')](),controller[_0x1623('0x29')]);router[_0x1623('0x5')](_0x1623('0x2a'),auth['isAuthenticated'](),controller[_0x1623('0x2b')]);router[_0x1623('0x5')]('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router[_0x1623('0x5')](_0x1623('0x2c'),auth[_0x1623('0x6')](),controller[_0x1623('0x2d')]);router[_0x1623('0x5')](_0x1623('0x2e'),auth[_0x1623('0x6')](),controller[_0x1623('0x2f')]);router[_0x1623('0x5')](_0x1623('0x30'),auth[_0x1623('0x6')](),controller[_0x1623('0x31')]);router['get'](_0x1623('0x32'),auth['isAuthenticated'](),controller[_0x1623('0x33')]);router[_0x1623('0x5')](_0x1623('0x34'),auth['isAuthenticated'](),controller[_0x1623('0x35')]);router[_0x1623('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x1623('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0x1623('0x5')](_0x1623('0x36'),auth[_0x1623('0x6')](),controller[_0x1623('0x37')]);router['post'](_0x1623('0x38'),auth[_0x1623('0x6')](),controller[_0x1623('0x39')](_0x1623('0x3a')));router[_0x1623('0x5')](_0x1623('0x3b'),auth[_0x1623('0x6')](),controller[_0x1623('0x3c')]);router[_0x1623('0x3d')](_0x1623('0x3e'),auth[_0x1623('0x6')](),controller[_0x1623('0x39')](_0x1623('0x3f')));router['get'](_0x1623('0x40'),auth[_0x1623('0x6')](),controller['showChatQueues']);router[_0x1623('0x3d')]('/fax/queues/:id/notify',auth[_0x1623('0x6')](),controller['queueNotify'](_0x1623('0x41')));router[_0x1623('0x5')](_0x1623('0x42'),auth[_0x1623('0x6')](),controller['showFaxQueues']);router[_0x1623('0x3d')](_0x1623('0x43'),auth[_0x1623('0x6')](),controller[_0x1623('0x39')](_0x1623('0x44')));router[_0x1623('0x5')](_0x1623('0x45'),auth['isAuthenticated'](),controller[_0x1623('0x46')]);router['post']('/sms/queues/:id/notify',auth[_0x1623('0x6')](),controller['queueNotify'](_0x1623('0x47')));router[_0x1623('0x3d')](_0x1623('0x48'),auth['isAuthenticated'](),controller[_0x1623('0x39')](_0x1623('0x49')));router['get'](_0x1623('0x4a'),auth['isAuthenticated'](),controller[_0x1623('0x4b')]);router[_0x1623('0x5')]('/whatsapp/queues/:id',auth[_0x1623('0x6')](),controller[_0x1623('0x4c')]);router[_0x1623('0x3d')]('/agents/:id/notify',auth[_0x1623('0x6')](),controller[_0x1623('0x4d')]);module['exports']=router; \ No newline at end of file +var _0xd696=['chatQueues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues'];(function(_0x27cae4,_0x1fe454){var _0x468f66=function(_0x299ed4){while(--_0x299ed4){_0x27cae4['push'](_0x27cae4['shift']());}};_0x468f66(++_0x1fe454);}(_0xd696,0xea));var _0x6d69=function(_0x8980,_0x3e943b){_0x8980=_0x8980-0x0;var _0x3491a6=_0xd696[_0x8980];return _0x3491a6;};'use strict';var multer=require(_0x6d69('0x0'));var util=require(_0x6d69('0x1'));var path=require(_0x6d69('0x2'));var express=require(_0x6d69('0x3'));var router=express['Router']();var auth=require(_0x6d69('0x4'));var controller=require(_0x6d69('0x5'));router[_0x6d69('0x6')](_0x6d69('0x7'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x9')]);router['get'](_0x6d69('0xa'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x6d69('0x6')](_0x6d69('0xb'),auth[_0x6d69('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x6d69('0x6')](_0x6d69('0xc'),auth[_0x6d69('0x8')](),controller[_0x6d69('0xd')]);router[_0x6d69('0x6')](_0x6d69('0xe'),auth[_0x6d69('0x8')](),controller[_0x6d69('0xf')]);router['get'](_0x6d69('0x10'),auth[_0x6d69('0x8')](),controller['mailQueues']);router[_0x6d69('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x6d69('0x11')]);router['get'](_0x6d69('0x12'),auth['isAuthenticated'](),controller[_0x6d69('0x13')]);router[_0x6d69('0x6')](_0x6d69('0x14'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x15')]);router['get'](_0x6d69('0x16'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x17')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0x6d69('0x18')]);router['get'](_0x6d69('0x19'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x1a')]);router['get'](_0x6d69('0x1b'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x1c')]);router['get'](_0x6d69('0x1d'),auth['isAuthenticated'](),controller[_0x6d69('0x1e')]);router['get'](_0x6d69('0x1f'),auth[_0x6d69('0x8')](),controller['voiceQueuesChannelHangup']);router[_0x6d69('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x6d69('0x8')](),controller[_0x6d69('0x20')]);router['get'](_0x6d69('0x21'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x6d69('0x22')](_0x6d69('0x21'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x23')]);router[_0x6d69('0x6')](_0x6d69('0x24'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x25')]);router[_0x6d69('0x6')](_0x6d69('0x26'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x27')]);router[_0x6d69('0x6')](_0x6d69('0x28'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x29')]);router[_0x6d69('0x22')](_0x6d69('0x2a'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x2b')]);router[_0x6d69('0x6')]('/telephones',auth[_0x6d69('0x8')](),controller[_0x6d69('0x2c')]);router[_0x6d69('0x6')](_0x6d69('0x2d'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x2e')]);router[_0x6d69('0x6')](_0x6d69('0x2f'),auth[_0x6d69('0x8')](),controller['campaigns']);router['get'](_0x6d69('0x30'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x31')]);router[_0x6d69('0x6')](_0x6d69('0x32'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x33')]);router[_0x6d69('0x6')](_0x6d69('0x34'),auth['isAuthenticated'](),controller[_0x6d69('0x35')]);router[_0x6d69('0x6')](_0x6d69('0x36'),auth['isAuthenticated'](),controller[_0x6d69('0x37')]);router[_0x6d69('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x6d69('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x6d69('0x6')]('/sms/queues/waitinginteractions',auth[_0x6d69('0x8')](),controller[_0x6d69('0x38')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x6d69('0x8')](),controller[_0x6d69('0x39')]);router['get']('/fax/queues/waitinginteractions',auth[_0x6d69('0x8')](),controller[_0x6d69('0x3a')]);router[_0x6d69('0x3b')]('/mail/queues/:id/notify',auth[_0x6d69('0x8')](),controller[_0x6d69('0x3c')](_0x6d69('0x3d')));router['get'](_0x6d69('0x3e'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x3f')]);router[_0x6d69('0x3b')](_0x6d69('0x40'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x3c')](_0x6d69('0x41')));router['get'](_0x6d69('0x42'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x43')]);router[_0x6d69('0x3b')](_0x6d69('0x44'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x3c')](_0x6d69('0x45')));router[_0x6d69('0x6')](_0x6d69('0x46'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x47')]);router[_0x6d69('0x3b')]('/openchannel/queues/:id/notify',auth[_0x6d69('0x8')](),controller['queueNotify']('openchannel'));router['get'](_0x6d69('0x48'),auth['isAuthenticated'](),controller[_0x6d69('0x49')]);router[_0x6d69('0x3b')](_0x6d69('0x4a'),auth['isAuthenticated'](),controller['queueNotify'](_0x6d69('0x4b')));router[_0x6d69('0x3b')](_0x6d69('0x4c'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x3c')](_0x6d69('0x4d')));router[_0x6d69('0x6')](_0x6d69('0x4e'),auth[_0x6d69('0x8')](),controller['showSmsQueues']);router[_0x6d69('0x6')](_0x6d69('0x4f'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x50')]);router[_0x6d69('0x3b')]('/agents/:id/notify',auth[_0x6d69('0x8')](),controller[_0x6d69('0x51')]);module[_0x6d69('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5c04af0..45fefbe 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 _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x137cc2,_0x13978e){var _0x3c9820=function(_0x55016d){while(--_0x55016d){_0x137cc2['push'](_0x137cc2['shift']());}};_0x3c9820(++_0x13978e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x199934,_0x4530da){var _0x25ae46=function(_0x36f9a1){while(--_0x36f9a1){_0x199934['push'](_0x199934['shift']());}};_0x25ae46(++_0x4530da);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c146969..3ea4b55 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 _0x7cc7=['get','index','/:id/run','isAuthenticated','create','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xaf788c,_0x14eabb){var _0x128727=function(_0x526780){while(--_0x526780){_0xaf788c['push'](_0xaf788c['shift']());}};_0x128727(++_0x14eabb);}(_0x7cc7,0x1e5));var _0x77cc=function(_0x11e79b,_0x42c500){_0x11e79b=_0x11e79b-0x0;var _0x7cb31b=_0x7cc7[_0x11e79b];return _0x7cb31b;};'use strict';var multer=require('multer');var util=require(_0x77cc('0x0'));var path=require(_0x77cc('0x1'));var timeout=require(_0x77cc('0x2'));var express=require(_0x77cc('0x3'));var router=express[_0x77cc('0x4')]();var fs_extra=require(_0x77cc('0x5'));var auth=require(_0x77cc('0x6'));var interaction=require(_0x77cc('0x7'));var config=require(_0x77cc('0x8'));var controller=require('./schedule.controller');router[_0x77cc('0x9')]('/',auth['isAuthenticated'](),controller[_0x77cc('0xa')]);router[_0x77cc('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x77cc('0xb'),auth['isAuthenticated'](),controller['run']);router['post']('/',auth[_0x77cc('0xc')](),controller[_0x77cc('0xd')]);router[_0x77cc('0xe')]('/:id',auth[_0x77cc('0xc')](),controller[_0x77cc('0xf')]);router[_0x77cc('0x10')](_0x77cc('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x77cc('0x12')]=router; \ No newline at end of file +var _0xecc2=['/:id/run','run','create','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3ba347,_0x461aa0){var _0x3295e7=function(_0x4bb537){while(--_0x4bb537){_0x3ba347['push'](_0x3ba347['shift']());}};_0x3295e7(++_0x461aa0);}(_0xecc2,0xcf));var _0x2ecc=function(_0x524f0e,_0x2e6801){_0x524f0e=_0x524f0e-0x0;var _0x630076=_0xecc2[_0x524f0e];return _0x630076;};'use strict';var multer=require('multer');var util=require(_0x2ecc('0x0'));var path=require(_0x2ecc('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ecc('0x2')]();var fs_extra=require(_0x2ecc('0x3'));var auth=require(_0x2ecc('0x4'));var interaction=require(_0x2ecc('0x5'));var config=require(_0x2ecc('0x6'));var controller=require(_0x2ecc('0x7'));router[_0x2ecc('0x8')]('/',auth[_0x2ecc('0x9')](),controller[_0x2ecc('0xa')]);router[_0x2ecc('0x8')](_0x2ecc('0xb'),auth[_0x2ecc('0x9')](),controller[_0x2ecc('0xc')]);router[_0x2ecc('0x8')](_0x2ecc('0xd'),auth[_0x2ecc('0x9')](),controller[_0x2ecc('0xe')]);router['post']('/',auth[_0x2ecc('0x9')](),controller[_0x2ecc('0xf')]);router[_0x2ecc('0x10')](_0x2ecc('0xb'),auth[_0x2ecc('0x9')](),controller[_0x2ecc('0x11')]);router[_0x2ecc('0x12')](_0x2ecc('0xb'),auth[_0x2ecc('0x9')](),controller['destroy']);module[_0x2ecc('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 53866b1..57dbc68 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 _0x8ace=['months','weeks','days','minutes','ENUM','csv','pdf','custom','BOOLEAN','TEXT','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','quarters'];(function(_0x281015,_0xead8eb){var _0xfcbe5c=function(_0x2c8662){while(--_0x2c8662){_0x281015['push'](_0x281015['shift']());}};_0xfcbe5c(++_0xead8eb);}(_0x8ace,0x1ca));var _0xe8ac=function(_0x47bbd5,_0xfab6bc){_0x47bbd5=_0x47bbd5-0x0;var _0xea2a13=_0x8ace[_0x47bbd5];return _0xea2a13;};'use strict';var Sequelize=require('sequelize');module[_0xe8ac('0x0')]={'name':{'type':Sequelize[_0xe8ac('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe8ac('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe8ac('0x2')},'startAt':{'type':Sequelize[_0xe8ac('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xe8ac('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe8ac('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xe8ac('0x5'),_0xe8ac('0x6'),_0xe8ac('0x7'),_0xe8ac('0x8'),'hours',_0xe8ac('0x9')),'allowNull':![],'defaultValue':_0xe8ac('0x8')},'output':{'type':Sequelize[_0xe8ac('0xa')](_0xe8ac('0xb'),_0xe8ac('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0xe8ac('0xb')},'type':{'type':Sequelize['ENUM'](_0xe8ac('0xd'),'default'),'allowNull':![],'defaultValue':_0xe8ac('0xd')},'sendMail':{'type':Sequelize[_0xe8ac('0xe')],'defaultValue':![]},'email':{'type':Sequelize[_0xe8ac('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xe8ac('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xe8ac('0xe')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2a2d=['BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','weeks','days','hours','csv','pdf','xlsx','default','custom'];(function(_0x54d41f,_0x7dd88a){var _0x523ed6=function(_0x2a1b9c){while(--_0x2a1b9c){_0x54d41f['push'](_0x54d41f['shift']());}};_0x523ed6(++_0x7dd88a);}(_0x2a2d,0x74));var _0xd2a2=function(_0x3e80e5,_0x5ba461){_0x3e80e5=_0x3e80e5-0x0;var _0x43a128=_0x2a2d[_0x3e80e5];return _0x43a128;};'use strict';var Sequelize=require(_0xd2a2('0x0'));module[_0xd2a2('0x1')]={'name':{'type':Sequelize[_0xd2a2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd2a2('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd2a2('0x2')],'allowNull':![],'defaultValue':_0xd2a2('0x3')},'startAt':{'type':Sequelize[_0xd2a2('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd2a2('0x5')](_0xd2a2('0x6'),_0xd2a2('0x7'),_0xd2a2('0x8'),_0xd2a2('0x9'),_0xd2a2('0xa'),_0xd2a2('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xd2a2('0xa')},'output':{'type':Sequelize[_0xd2a2('0x5')](_0xd2a2('0xc'),_0xd2a2('0xd'),_0xd2a2('0xe')),'allowNull':![],'defaultValue':_0xd2a2('0xc')},'type':{'type':Sequelize[_0xd2a2('0x5')]('custom',_0xd2a2('0xf')),'allowNull':![],'defaultValue':_0xd2a2('0x10')},'sendMail':{'type':Sequelize[_0xd2a2('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0xd2a2('0x2')]},'cc':{'type':Sequelize[_0xd2a2('0x12')]},'bcc':{'type':Sequelize[_0xd2a2('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xd2a2('0x11')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 3c81ed2..c8f5637 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 _0xf140=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','then','get','Scheduler','stack','name','send','index','Schedule','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','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','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xf140,0x1e1));var _0x0f14=function(_0x3b1648,_0x4504c0){_0x3b1648=_0x3b1648-0x0;var _0x44225e=_0xf140[_0x3b1648];return _0x44225e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f14('0x0'));var zipdir=require(_0x0f14('0x1'));var jsonpatch=require(_0x0f14('0x2'));var rp=require(_0x0f14('0x3'));var moment=require(_0x0f14('0x4'));var BPromise=require(_0x0f14('0x5'));var Mustache=require(_0x0f14('0x6'));var util=require(_0x0f14('0x7'));var path=require(_0x0f14('0x8'));var sox=require('sox');var csv=require(_0x0f14('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f14('0xa'));var squel=require(_0x0f14('0xb'));var crypto=require('crypto');var jsforce=require(_0x0f14('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0f14('0x9'));var querystring=require(_0x0f14('0xd'));var Papa=require(_0x0f14('0xe'));var Redis=require(_0x0f14('0xf'));var authService=require(_0x0f14('0x10'));var qs=require(_0x0f14('0x11'));var as=require(_0x0f14('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f14('0x13'))(_0x0f14('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0f14('0x15'));var db=require(_0x0f14('0x16'))['db'];function respondWithStatusCode(_0x1aa93b,_0x14b77c){_0x14b77c=_0x14b77c||0xcc;return function(_0x4950a4){if(_0x4950a4){return _0x1aa93b[_0x0f14('0x17')](_0x14b77c);}return _0x1aa93b[_0x0f14('0x18')](_0x14b77c)[_0x0f14('0x19')]();};}function respondWithResult(_0x6407e3,_0x5c5f0e){_0x5c5f0e=_0x5c5f0e||0xc8;return function(_0x313f98){if(_0x313f98){return _0x6407e3[_0x0f14('0x18')](_0x5c5f0e)[_0x0f14('0x1a')](_0x313f98);}};}function respondWithFilteredResult(_0x4dc59b,_0x419639){return function(_0x3326e3){if(_0x3326e3){var _0x107c9d=typeof _0x419639[_0x0f14('0x1b')]===_0x0f14('0x1c')&&typeof _0x419639['limit']===_0x0f14('0x1c');var _0x568c54=_0x3326e3[_0x0f14('0x1d')];var _0x576e95=_0x107c9d?0x0:_0x419639[_0x0f14('0x1b')];var _0x1571c9=_0x107c9d?_0x3326e3['count']:_0x419639[_0x0f14('0x1b')]+_0x419639[_0x0f14('0x1e')];var _0x3768f5;if(_0x1571c9>=_0x568c54){_0x1571c9=_0x568c54;_0x3768f5=0xc8;}else{_0x3768f5=0xce;}_0x4dc59b[_0x0f14('0x18')](_0x3768f5);return _0x4dc59b[_0x0f14('0x1f')](_0x0f14('0x20'),_0x576e95+'-'+_0x1571c9+'/'+_0x568c54)[_0x0f14('0x1a')](_0x3326e3);}return null;};}function patchUpdates(_0x409adc){return function(_0xfa0d64){try{jsonpatch['apply'](_0xfa0d64,_0x409adc,!![]);}catch(_0x4fc16c){return BPromise[_0x0f14('0x21')](_0x4fc16c);}return _0xfa0d64[_0x0f14('0x22')]();};}function saveUpdates(_0x250397,_0x2f0066){return function(_0x58c38f){if(_0x58c38f){return _0x58c38f['update'](_0x250397)['then'](function(_0x588adc){return _0x588adc;});}return null;};}function removeEntity(_0x2c6f2d,_0x2da4fc){return function(_0x5806d7){if(_0x5806d7){return _0x5806d7[_0x0f14('0x23')]()[_0x0f14('0x24')](function(){var _0x4479eb=_0x5806d7[_0x0f14('0x25')]({'plain':!![]});var _0x1f2402=_0x0f14('0x26');return db['UserProfileResource'][_0x0f14('0x23')]({'where':{'type':_0x1f2402,'resourceId':_0x4479eb['id']}})[_0x0f14('0x24')](function(){return _0x5806d7;});})[_0x0f14('0x24')](function(){_0x2c6f2d[_0x0f14('0x18')](0xcc)[_0x0f14('0x19')]();});}};}function handleEntityNotFound(_0x24232b,_0x5033a7){return function(_0x4d2cbc){if(!_0x4d2cbc){_0x24232b[_0x0f14('0x17')](0x194);}return _0x4d2cbc;};}function handleError(_0x298434,_0x3af539){_0x3af539=_0x3af539||0x1f4;return function(_0x69fe32){logger['error'](_0x69fe32[_0x0f14('0x27')]);if(_0x69fe32[_0x0f14('0x28')]){delete _0x69fe32[_0x0f14('0x28')];}_0x298434[_0x0f14('0x18')](_0x3af539)[_0x0f14('0x29')](_0x69fe32);};}exports[_0x0f14('0x2a')]=function(_0x24b104,_0xc47819){var _0x141156={},_0x53c962={},_0x6948d6={'count':0x0,'rows':[]};var _0x3c9d94=_['map'](db[_0x0f14('0x2b')][_0x0f14('0x2c')],function(_0x5cf61e){return{'name':_0x5cf61e[_0x0f14('0x2d')],'type':_0x5cf61e['type'][_0x0f14('0x2e')]};});_0x53c962[_0x0f14('0x2f')]=_[_0x0f14('0x30')](_0x3c9d94,'name');_0x53c962[_0x0f14('0x31')]=_[_0x0f14('0x32')](_0x24b104[_0x0f14('0x31')]);_0x53c962['filters']=_[_0x0f14('0x33')](_0x53c962[_0x0f14('0x2f')],_0x53c962['query']);_0x141156['attributes']=_[_0x0f14('0x33')](_0x53c962[_0x0f14('0x2f')],qs[_0x0f14('0x34')](_0x24b104['query'][_0x0f14('0x34')]));_0x141156['attributes']=_0x141156[_0x0f14('0x35')][_0x0f14('0x36')]?_0x141156['attributes']:_0x53c962[_0x0f14('0x2f')];if(!_0x24b104['query'][_0x0f14('0x37')](_0x0f14('0x38'))){_0x141156['limit']=qs[_0x0f14('0x1e')](_0x24b104[_0x0f14('0x31')]['limit']);_0x141156[_0x0f14('0x1b')]=qs[_0x0f14('0x1b')](_0x24b104[_0x0f14('0x31')][_0x0f14('0x1b')]);}_0x141156['order']=qs[_0x0f14('0x39')](_0x24b104[_0x0f14('0x31')]['sort']);_0x141156['where']=qs[_0x0f14('0x3a')](_[_0x0f14('0x3b')](_0x24b104[_0x0f14('0x31')],_0x53c962[_0x0f14('0x3a')]),_0x3c9d94);if(_0x24b104['query'][_0x0f14('0x3c')]){_0x141156[_0x0f14('0x3d')]=_['merge'](_0x141156[_0x0f14('0x3d')],{'$or':_[_0x0f14('0x30')](_0x3c9d94,function(_0x6a0306){if(_0x6a0306[_0x0f14('0x3e')]!==_0x0f14('0x3f')){var _0x22709b={};_0x22709b[_0x6a0306[_0x0f14('0x28')]]={'$like':'%'+_0x24b104[_0x0f14('0x31')][_0x0f14('0x3c')]+'%'};return _0x22709b;}})});}_0x141156=_[_0x0f14('0x40')]({},_0x141156,_0x24b104[_0x0f14('0x41')]);var _0x359b67={'where':_0x141156['where']};return db[_0x0f14('0x2b')]['count'](_0x359b67)[_0x0f14('0x24')](function(_0x14a254){_0x6948d6[_0x0f14('0x1d')]=_0x14a254;if(_0x24b104[_0x0f14('0x31')][_0x0f14('0x42')]){_0x141156[_0x0f14('0x43')]=[{'all':!![]}];}return db[_0x0f14('0x2b')][_0x0f14('0x44')](_0x141156);})[_0x0f14('0x24')](function(_0x5313f0){_0x6948d6[_0x0f14('0x45')]=_0x5313f0;return _0x6948d6;})[_0x0f14('0x24')](respondWithFilteredResult(_0xc47819,_0x141156))[_0x0f14('0x46')](handleError(_0xc47819,null));};exports[_0x0f14('0x47')]=function(_0xd2d476,_0x578c1a){var _0x55bf4e={'raw':![],'where':{'id':_0xd2d476[_0x0f14('0x48')]['id']}},_0x4a880a={};_0x4a880a['model']=_[_0x0f14('0x32')](db[_0x0f14('0x2b')][_0x0f14('0x2c')]);_0x4a880a['query']=_[_0x0f14('0x32')](_0xd2d476[_0x0f14('0x31')]);_0x4a880a[_0x0f14('0x3a')]=_[_0x0f14('0x33')](_0x4a880a[_0x0f14('0x2f')],_0x4a880a[_0x0f14('0x31')]);_0x55bf4e[_0x0f14('0x35')]=_[_0x0f14('0x33')](_0x4a880a[_0x0f14('0x2f')],qs[_0x0f14('0x34')](_0xd2d476[_0x0f14('0x31')][_0x0f14('0x34')]));_0x55bf4e['attributes']=_0x55bf4e[_0x0f14('0x35')]['length']?_0x55bf4e[_0x0f14('0x35')]:_0x4a880a[_0x0f14('0x2f')];if(_0xd2d476[_0x0f14('0x31')]['includeAll']){_0x55bf4e[_0x0f14('0x43')]=[{'all':!![]}];}_0x55bf4e=_['merge']({},_0x55bf4e,_0xd2d476['options']);return db[_0x0f14('0x2b')][_0x0f14('0x49')](_0x55bf4e)[_0x0f14('0x24')](handleEntityNotFound(_0x578c1a,null))[_0x0f14('0x24')](respondWithResult(_0x578c1a,null))[_0x0f14('0x46')](handleError(_0x578c1a,null));};exports[_0x0f14('0x4a')]=function(_0x46c154,_0x17f421){return db[_0x0f14('0x2b')][_0x0f14('0x4a')](_0x46c154[_0x0f14('0x4b')],{})[_0x0f14('0x24')](function(_0x5bc8ba){var _0x1c05e5=_0x46c154[_0x0f14('0x4c')]['get']({'plain':!![]});if(!_0x1c05e5)throw new Error(_0x0f14('0x4d'));if(_0x1c05e5[_0x0f14('0x4e')]===_0x0f14('0x4c')){var _0x2a7a9c=_0x5bc8ba[_0x0f14('0x25')]({'plain':!![]});var _0x10a87b=_0x0f14('0x26');return db['UserProfileSection'][_0x0f14('0x49')]({'where':{'name':_0x10a87b,'userProfileId':_0x1c05e5[_0x0f14('0x4f')]},'raw':!![]})[_0x0f14('0x24')](function(_0x5d39de){if(_0x5d39de&&_0x5d39de[_0x0f14('0x50')]===0x0){return db['UserProfileResource'][_0x0f14('0x4a')]({'name':_0x2a7a9c[_0x0f14('0x28')],'resourceId':_0x2a7a9c['id'],'type':_0x5d39de[_0x0f14('0x28')],'sectionId':_0x5d39de['id']},{})[_0x0f14('0x24')](function(){return _0x5bc8ba;});}else{return _0x5bc8ba;}})[_0x0f14('0x46')](function(_0x501309){logger['error'](_0x0f14('0x51'),_0x501309);throw _0x501309;});}return _0x5bc8ba;})[_0x0f14('0x24')](respondWithResult(_0x17f421,0xc9))[_0x0f14('0x46')](handleError(_0x17f421,null));};exports[_0x0f14('0x52')]=function(_0x67aa95,_0x15b23f){if(_0x67aa95['body']['id']){delete _0x67aa95[_0x0f14('0x4b')]['id'];}return db[_0x0f14('0x2b')][_0x0f14('0x49')]({'where':{'id':_0x67aa95['params']['id']}})[_0x0f14('0x24')](handleEntityNotFound(_0x15b23f,null))[_0x0f14('0x24')](saveUpdates(_0x67aa95[_0x0f14('0x4b')],null))[_0x0f14('0x24')](respondWithResult(_0x15b23f,null))[_0x0f14('0x46')](handleError(_0x15b23f,null));};exports[_0x0f14('0x23')]=function(_0xec201f,_0x5d20ba){return db['Schedule'][_0x0f14('0x49')]({'where':{'id':_0xec201f[_0x0f14('0x48')]['id']}})[_0x0f14('0x24')](handleEntityNotFound(_0x5d20ba,null))[_0x0f14('0x24')](removeEntity(_0x5d20ba,null))[_0x0f14('0x46')](handleError(_0x5d20ba,null));};exports['run']=function(_0x54a3f9,_0x8763f8,_0x1007ab){var _0x537898=require('../../config/schedule');return db[_0x0f14('0x2b')][_0x0f14('0x49')]({'where':{'id':_0x54a3f9[_0x0f14('0x48')]['id']},'raw':!![]})[_0x0f14('0x24')](handleEntityNotFound(_0x8763f8,null))[_0x0f14('0x24')](function(){_0x537898['run'](_0x54a3f9['params']['id']);})[_0x0f14('0x24')](respondWithStatusCode(_0x8763f8,null))[_0x0f14('0x46')](handleError(_0x8763f8,null));}; \ No newline at end of file +var _0x9359=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','Scheduler','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Schedule','findAll','rows','catch','params','includeAll','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','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis'];(function(_0x5224b4,_0x4b3811){var _0x544f3b=function(_0x3e5d89){while(--_0x3e5d89){_0x5224b4['push'](_0x5224b4['shift']());}};_0x544f3b(++_0x4b3811);}(_0x9359,0xe7));var _0x9935=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9359[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x9935('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9935('0x1'));var jsonpatch=require(_0x9935('0x2'));var rp=require(_0x9935('0x3'));var moment=require(_0x9935('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9935('0x5'));var util=require('util');var path=require(_0x9935('0x6'));var sox=require('sox');var csv=require(_0x9935('0x7'));var ejs=require(_0x9935('0x8'));var fs=require('fs');var fs_extra=require(_0x9935('0x9'));var _=require(_0x9935('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9935('0xb'));var deskjs=require(_0x9935('0xc'));var toCsv=require(_0x9935('0x7'));var querystring=require('querystring');var Papa=require(_0x9935('0xd'));var Redis=require(_0x9935('0xe'));var authService=require(_0x9935('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9935('0x10'));var hardwareService=require(_0x9935('0x11'));var logger=require(_0x9935('0x12'))(_0x9935('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9935('0x14'));var db=require(_0x9935('0x15'))['db'];function respondWithStatusCode(_0xb9a73b,_0x3ee375){_0x3ee375=_0x3ee375||0xcc;return function(_0x54a23f){if(_0x54a23f){return _0xb9a73b['sendStatus'](_0x3ee375);}return _0xb9a73b[_0x9935('0x16')](_0x3ee375)[_0x9935('0x17')]();};}function respondWithResult(_0x589712,_0x56eeb1){_0x56eeb1=_0x56eeb1||0xc8;return function(_0x3da725){if(_0x3da725){return _0x589712[_0x9935('0x16')](_0x56eeb1)[_0x9935('0x18')](_0x3da725);}};}function respondWithFilteredResult(_0x3c8782,_0x53827e){return function(_0x3bd9b7){if(_0x3bd9b7){var _0x351116=typeof _0x53827e[_0x9935('0x19')]===_0x9935('0x1a')&&typeof _0x53827e[_0x9935('0x1b')]===_0x9935('0x1a');var _0x221cc2=_0x3bd9b7['count'];var _0x4306ae=_0x351116?0x0:_0x53827e['offset'];var _0x447af1=_0x351116?_0x3bd9b7[_0x9935('0x1c')]:_0x53827e[_0x9935('0x19')]+_0x53827e[_0x9935('0x1b')];var _0x39f1fb;if(_0x447af1>=_0x221cc2){_0x447af1=_0x221cc2;_0x39f1fb=0xc8;}else{_0x39f1fb=0xce;}_0x3c8782['status'](_0x39f1fb);return _0x3c8782[_0x9935('0x1d')](_0x9935('0x1e'),_0x4306ae+'-'+_0x447af1+'/'+_0x221cc2)[_0x9935('0x18')](_0x3bd9b7);}return null;};}function patchUpdates(_0x151566){return function(_0x58af2a){try{jsonpatch[_0x9935('0x1f')](_0x58af2a,_0x151566,!![]);}catch(_0x3e98d7){return BPromise['reject'](_0x3e98d7);}return _0x58af2a['save']();};}function saveUpdates(_0x552b52,_0x2d9f14){return function(_0xe54db4){if(_0xe54db4){return _0xe54db4['update'](_0x552b52)[_0x9935('0x20')](function(_0x5da7df){return _0x5da7df;});}return null;};}function removeEntity(_0x3e6d02,_0x2c6eb2){return function(_0x54b78d){if(_0x54b78d){return _0x54b78d['destroy']()[_0x9935('0x20')](function(){var _0x3159a1=_0x54b78d[_0x9935('0x21')]({'plain':!![]});var _0x170cb7=_0x9935('0x22');return db[_0x9935('0x23')][_0x9935('0x24')]({'where':{'type':_0x170cb7,'resourceId':_0x3159a1['id']}})[_0x9935('0x20')](function(){return _0x54b78d;});})[_0x9935('0x20')](function(){_0x3e6d02[_0x9935('0x16')](0xcc)[_0x9935('0x17')]();});}};}function handleEntityNotFound(_0x129af7,_0x31dbcd){return function(_0x1aa711){if(!_0x1aa711){_0x129af7[_0x9935('0x25')](0x194);}return _0x1aa711;};}function handleError(_0x1a2792,_0x2cc383){_0x2cc383=_0x2cc383||0x1f4;return function(_0x12572d){logger[_0x9935('0x26')](_0x12572d[_0x9935('0x27')]);if(_0x12572d[_0x9935('0x28')]){delete _0x12572d[_0x9935('0x28')];}_0x1a2792[_0x9935('0x16')](_0x2cc383)[_0x9935('0x29')](_0x12572d);};}exports[_0x9935('0x2a')]=function(_0x957291,_0xb723d4){var _0x2c2424={},_0x429364={},_0x5a9906={'count':0x0,'rows':[]};var _0x4ca045=_[_0x9935('0x2b')](db['Schedule'][_0x9935('0x2c')],function(_0xb2b3d0){return{'name':_0xb2b3d0[_0x9935('0x2d')],'type':_0xb2b3d0[_0x9935('0x2e')][_0x9935('0x2f')]};});_0x429364['model']=_[_0x9935('0x2b')](_0x4ca045,'name');_0x429364[_0x9935('0x30')]=_['keys'](_0x957291[_0x9935('0x30')]);_0x429364[_0x9935('0x31')]=_[_0x9935('0x32')](_0x429364['model'],_0x429364[_0x9935('0x30')]);_0x2c2424[_0x9935('0x33')]=_[_0x9935('0x32')](_0x429364[_0x9935('0x34')],qs[_0x9935('0x35')](_0x957291[_0x9935('0x30')][_0x9935('0x35')]));_0x2c2424[_0x9935('0x33')]=_0x2c2424['attributes'][_0x9935('0x36')]?_0x2c2424['attributes']:_0x429364[_0x9935('0x34')];if(!_0x957291[_0x9935('0x30')][_0x9935('0x37')](_0x9935('0x38'))){_0x2c2424[_0x9935('0x1b')]=qs[_0x9935('0x1b')](_0x957291['query']['limit']);_0x2c2424[_0x9935('0x19')]=qs['offset'](_0x957291[_0x9935('0x30')][_0x9935('0x19')]);}_0x2c2424[_0x9935('0x39')]=qs['sort'](_0x957291['query'][_0x9935('0x3a')]);_0x2c2424[_0x9935('0x3b')]=qs[_0x9935('0x31')](_[_0x9935('0x3c')](_0x957291[_0x9935('0x30')],_0x429364[_0x9935('0x31')]),_0x4ca045);if(_0x957291['query']['filter']){_0x2c2424[_0x9935('0x3b')]=_['merge'](_0x2c2424['where'],{'$or':_[_0x9935('0x2b')](_0x4ca045,function(_0x4e940e){if(_0x4e940e['type']!=='VIRTUAL'){var _0x58005c={};_0x58005c[_0x4e940e[_0x9935('0x28')]]={'$like':'%'+_0x957291[_0x9935('0x30')][_0x9935('0x3d')]+'%'};return _0x58005c;}})});}_0x2c2424=_[_0x9935('0x3e')]({},_0x2c2424,_0x957291[_0x9935('0x3f')]);var _0x3a39c9={'where':_0x2c2424[_0x9935('0x3b')]};return db[_0x9935('0x40')]['count'](_0x3a39c9)['then'](function(_0x3d6957){_0x5a9906[_0x9935('0x1c')]=_0x3d6957;if(_0x957291[_0x9935('0x30')]['includeAll']){_0x2c2424['include']=[{'all':!![]}];}return db[_0x9935('0x40')][_0x9935('0x41')](_0x2c2424);})['then'](function(_0x189112){_0x5a9906[_0x9935('0x42')]=_0x189112;return _0x5a9906;})[_0x9935('0x20')](respondWithFilteredResult(_0xb723d4,_0x2c2424))[_0x9935('0x43')](handleError(_0xb723d4,null));};exports['show']=function(_0x1870a3,_0x14b68c){var _0x1dd943={'raw':![],'where':{'id':_0x1870a3[_0x9935('0x44')]['id']}},_0x497c48={};_0x497c48['model']=_['keys'](db['Schedule'][_0x9935('0x2c')]);_0x497c48[_0x9935('0x30')]=_['keys'](_0x1870a3[_0x9935('0x30')]);_0x497c48[_0x9935('0x31')]=_[_0x9935('0x32')](_0x497c48[_0x9935('0x34')],_0x497c48[_0x9935('0x30')]);_0x1dd943['attributes']=_[_0x9935('0x32')](_0x497c48[_0x9935('0x34')],qs['fields'](_0x1870a3[_0x9935('0x30')][_0x9935('0x35')]));_0x1dd943[_0x9935('0x33')]=_0x1dd943[_0x9935('0x33')][_0x9935('0x36')]?_0x1dd943['attributes']:_0x497c48[_0x9935('0x34')];if(_0x1870a3[_0x9935('0x30')][_0x9935('0x45')]){_0x1dd943['include']=[{'all':!![]}];}_0x1dd943=_[_0x9935('0x3e')]({},_0x1dd943,_0x1870a3[_0x9935('0x3f')]);return db[_0x9935('0x40')][_0x9935('0x46')](_0x1dd943)[_0x9935('0x20')](handleEntityNotFound(_0x14b68c,null))[_0x9935('0x20')](respondWithResult(_0x14b68c,null))[_0x9935('0x43')](handleError(_0x14b68c,null));};exports[_0x9935('0x47')]=function(_0x3c5005,_0x4d64ee){return db[_0x9935('0x40')][_0x9935('0x47')](_0x3c5005['body'],{})[_0x9935('0x20')](function(_0xed91c8){var _0x58bfc6=_0x3c5005[_0x9935('0x48')][_0x9935('0x21')]({'plain':!![]});if(!_0x58bfc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58bfc6[_0x9935('0x49')]==='user'){var _0x54f523=_0xed91c8['get']({'plain':!![]});var _0x9db330=_0x9935('0x22');return db[_0x9935('0x4a')][_0x9935('0x46')]({'where':{'name':_0x9db330,'userProfileId':_0x58bfc6[_0x9935('0x4b')]},'raw':!![]})['then'](function(_0x3f229e){if(_0x3f229e&&_0x3f229e[_0x9935('0x4c')]===0x0){return db[_0x9935('0x23')][_0x9935('0x47')]({'name':_0x54f523[_0x9935('0x28')],'resourceId':_0x54f523['id'],'type':_0x3f229e['name'],'sectionId':_0x3f229e['id']},{})[_0x9935('0x20')](function(){return _0xed91c8;});}else{return _0xed91c8;}})['catch'](function(_0x40af11){logger[_0x9935('0x26')](_0x9935('0x4d'),_0x40af11);throw _0x40af11;});}return _0xed91c8;})[_0x9935('0x20')](respondWithResult(_0x4d64ee,0xc9))[_0x9935('0x43')](handleError(_0x4d64ee,null));};exports[_0x9935('0x4e')]=function(_0x224896,_0x44254d){if(_0x224896[_0x9935('0x4f')]['id']){delete _0x224896['body']['id'];}return db[_0x9935('0x40')][_0x9935('0x46')]({'where':{'id':_0x224896[_0x9935('0x44')]['id']}})[_0x9935('0x20')](handleEntityNotFound(_0x44254d,null))[_0x9935('0x20')](saveUpdates(_0x224896[_0x9935('0x4f')],null))[_0x9935('0x20')](respondWithResult(_0x44254d,null))['catch'](handleError(_0x44254d,null));};exports[_0x9935('0x24')]=function(_0x10a863,_0x55b4aa){return db[_0x9935('0x40')][_0x9935('0x46')]({'where':{'id':_0x10a863[_0x9935('0x44')]['id']}})[_0x9935('0x20')](handleEntityNotFound(_0x55b4aa,null))[_0x9935('0x20')](removeEntity(_0x55b4aa,null))['catch'](handleError(_0x55b4aa,null));};exports[_0x9935('0x50')]=function(_0x45cb7c,_0x3c022c,_0x66f104){var _0x3a6d59=require(_0x9935('0x51'));return db[_0x9935('0x40')][_0x9935('0x46')]({'where':{'id':_0x45cb7c[_0x9935('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3c022c,null))[_0x9935('0x20')](function(){_0x3a6d59[_0x9935('0x50')](_0x45cb7c[_0x9935('0x44')]['id']);})[_0x9935('0x20')](respondWithStatusCode(_0x3c022c,null))[_0x9935('0x43')](handleError(_0x3c022c,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 4a5022c..eab3fc9 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 _0xe45e=['../../config/environment','./schedule.attributes','exports','define','tools_schedules','util','moment','request-promise','path','rimraf'];(function(_0x1b6c96,_0x30bd30){var _0x80e240=function(_0x294150){while(--_0x294150){_0x1b6c96['push'](_0x1b6c96['shift']());}};_0x80e240(++_0x30bd30);}(_0xe45e,0xa5));var _0xee45=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0xe45e[_0x560448];return _0x550276;};'use strict';var _=require('lodash');var util=require(_0xee45('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xee45('0x1'));var BPromise=require('bluebird');var rp=require(_0xee45('0x2'));var fs=require('fs');var path=require(_0xee45('0x3'));var rimraf=require(_0xee45('0x4'));var config=require(_0xee45('0x5'));var attributes=require(_0xee45('0x6'));module[_0xee45('0x7')]=function(_0x31da7d,_0x91713d){return _0x31da7d[_0xee45('0x8')]('Schedule',attributes,{'tableName':_0xee45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9564=['tools_schedules','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Schedule'];(function(_0x361c94,_0xab75f9){var _0x271657=function(_0x1aaebc){while(--_0x1aaebc){_0x361c94['push'](_0x361c94['shift']());}};_0x271657(++_0xab75f9);}(_0x9564,0x12a));var _0x4956=function(_0x549996,_0xd04634){_0x549996=_0x549996-0x0;var _0x4de5d1=_0x9564[_0x549996];return _0x4de5d1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4956('0x0'))(_0x4956('0x1'));var moment=require(_0x4956('0x2'));var BPromise=require('bluebird');var rp=require(_0x4956('0x3'));var fs=require('fs');var path=require(_0x4956('0x4'));var rimraf=require(_0x4956('0x5'));var config=require(_0x4956('0x6'));var attributes=require('./schedule.attributes');module[_0x4956('0x7')]=function(_0x4d4cd6,_0x5f5521){return _0x4d4cd6[_0x4956('0x8')](_0x4956('0x9'),attributes,{'tableName':_0x4956('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 3d3ae59..12f1254 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 _0x59ac=['error','code','message','info','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24669e,_0x49e709){var _0x27682e=function(_0x39c1ec){while(--_0x39c1ec){_0x24669e['push'](_0x24669e['shift']());}};_0x27682e(++_0x49e709);}(_0x59ac,0x7d));var _0xc59a=function(_0x17325e,_0x5863f2){_0x17325e=_0x17325e-0x0;var _0x51062a=_0x59ac[_0x17325e];return _0x51062a;};'use strict';var _=require('lodash');var util=require(_0xc59a('0x0'));var moment=require('moment');var BPromise=require(_0xc59a('0x1'));var rs=require(_0xc59a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc59a('0x3'))['db'];var utils=require(_0xc59a('0x4'));var logger=require('../../config/logger')(_0xc59a('0x5'));var config=require(_0xc59a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc59a('0x7')][_0xc59a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2049a3,_0x589e6f,_0x5e9267){return new BPromise(function(_0x3330d6,_0x1521ce){return client[_0xc59a('0x9')](_0x2049a3,_0x5e9267)[_0xc59a('0xa')](function(_0x54bb5e){logger['info'](_0xc59a('0xb'),_0x589e6f,_0xc59a('0xc'));logger['debug'](_0xc59a('0xd'),_0x589e6f,_0xc59a('0xc'),JSON[_0xc59a('0xe')](_0x54bb5e));if(_0x54bb5e[_0xc59a('0xf')]){if(_0x54bb5e[_0xc59a('0xf')][_0xc59a('0x10')]===0x1f4){logger[_0xc59a('0xf')](_0xc59a('0xb'),_0x589e6f,_0x54bb5e['error'][_0xc59a('0x11')]);return _0x1521ce(_0x54bb5e[_0xc59a('0xf')][_0xc59a('0x11')]);}logger[_0xc59a('0xf')](_0xc59a('0xb'),_0x589e6f,_0x54bb5e[_0xc59a('0xf')][_0xc59a('0x11')]);return _0x3330d6(_0x54bb5e['error'][_0xc59a('0x11')]);}else{logger[_0xc59a('0x12')](_0xc59a('0xb'),_0x589e6f,_0xc59a('0xc'));_0x3330d6(_0x54bb5e['result'][_0xc59a('0x11')]);}})[_0xc59a('0x13')](function(_0x57c8da){logger[_0xc59a('0xf')](_0xc59a('0xb'),_0x589e6f,_0x57c8da);_0x1521ce(_0x57c8da);});});} \ No newline at end of file +var _0xe39f=['result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3f993a,_0x8786d2){var _0x4869b8=function(_0x7bd94c){while(--_0x7bd94c){_0x3f993a['push'](_0x3f993a['shift']());}};_0x4869b8(++_0x8786d2);}(_0xe39f,0xaa));var _0xfe39=function(_0x1df79c,_0x5ad8fd){_0x1df79c=_0x1df79c-0x0;var _0x2f23e4=_0xe39f[_0x1df79c];return _0x2f23e4;};'use strict';var _=require('lodash');var util=require(_0xfe39('0x0'));var moment=require('moment');var BPromise=require(_0xfe39('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe39('0x2'));var db=require(_0xfe39('0x3'))['db'];var utils=require(_0xfe39('0x4'));var logger=require(_0xfe39('0x5'))(_0xfe39('0x6'));var config=require(_0xfe39('0x7'));var jayson=require(_0xfe39('0x8'));var client=jayson[_0xfe39('0x9')][_0xfe39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a1023,_0x1c4ae3,_0x4b81da){return new BPromise(function(_0x57a5cc,_0xf43026){return client['request'](_0x5a1023,_0x4b81da)['then'](function(_0x911ad6){logger[_0xfe39('0xb')](_0xfe39('0xc'),_0x1c4ae3,_0xfe39('0xd'));logger['debug'](_0xfe39('0xe'),_0x1c4ae3,'request\x20sent',JSON[_0xfe39('0xf')](_0x911ad6));if(_0x911ad6[_0xfe39('0x10')]){if(_0x911ad6[_0xfe39('0x10')][_0xfe39('0x11')]===0x1f4){logger[_0xfe39('0x10')]('Schedule,\x20%s,\x20%s',_0x1c4ae3,_0x911ad6[_0xfe39('0x10')][_0xfe39('0x12')]);return _0xf43026(_0x911ad6[_0xfe39('0x10')]['message']);}logger[_0xfe39('0x10')](_0xfe39('0xc'),_0x1c4ae3,_0x911ad6[_0xfe39('0x10')][_0xfe39('0x12')]);return _0x57a5cc(_0x911ad6['error'][_0xfe39('0x12')]);}else{logger[_0xfe39('0xb')]('Schedule,\x20%s,\x20%s',_0x1c4ae3,_0xfe39('0xd'));_0x57a5cc(_0x911ad6[_0xfe39('0x13')][_0xfe39('0x12')]);}})[_0xfe39('0x14')](function(_0x37d4d2){logger[_0xfe39('0x10')](_0xfe39('0xc'),_0x1c4ae3,_0x37d4d2);_0xf43026(_0x37d4d2);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c1c263f..69193f6 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 _0x44b3=['index','get','/describe','describe','/:id','/:id/download','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./screenRecording.controller','isAuthenticated'];(function(_0x2d3be7,_0x5e7b0f){var _0x4fd2e9=function(_0xfdbc70){while(--_0xfdbc70){_0x2d3be7['push'](_0x2d3be7['shift']());}};_0x4fd2e9(++_0x5e7b0f);}(_0x44b3,0x137));var _0x344b=function(_0x1a945e,_0x1a75e0){_0x1a945e=_0x1a945e-0x0;var _0x37d430=_0x44b3[_0x1a945e];return _0x37d430;};'use strict';var multer=require(_0x344b('0x0'));var util=require(_0x344b('0x1'));var path=require(_0x344b('0x2'));var timeout=require(_0x344b('0x3'));var express=require(_0x344b('0x4'));var router=express['Router']();var fs_extra=require(_0x344b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x344b('0x6'));var config=require('../../config/environment');var controller=require(_0x344b('0x7'));router['get']('/',auth[_0x344b('0x8')](),controller[_0x344b('0x9')]);router[_0x344b('0xa')](_0x344b('0xb'),auth['isAuthenticated'](),controller[_0x344b('0xc')]);router[_0x344b('0xa')](_0x344b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x344b('0xa')](_0x344b('0xe'),auth[_0x344b('0x8')](),controller['download']);router[_0x344b('0xf')]('/',auth[_0x344b('0x8')](),controller['create']);router[_0x344b('0x10')](_0x344b('0xd'),auth[_0x344b('0x8')](),controller['update']);router[_0x344b('0x11')](_0x344b('0xd'),auth[_0x344b('0x8')](),controller[_0x344b('0x12')]);module[_0x344b('0x13')]=router; \ No newline at end of file +var _0x2a45=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2d0307,_0x14ee85){var _0x1eb11e=function(_0x362c45){while(--_0x362c45){_0x2d0307['push'](_0x2d0307['shift']());}};_0x1eb11e(++_0x14ee85);}(_0x2a45,0xb8));var _0x52a4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x2a45[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x52a4('0x0'));var util=require(_0x52a4('0x1'));var path=require(_0x52a4('0x2'));var timeout=require(_0x52a4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x52a4('0x4'));var auth=require(_0x52a4('0x5'));var interaction=require(_0x52a4('0x6'));var config=require(_0x52a4('0x7'));var controller=require(_0x52a4('0x8'));router[_0x52a4('0x9')]('/',auth[_0x52a4('0xa')](),controller[_0x52a4('0xb')]);router['get'](_0x52a4('0xc'),auth[_0x52a4('0xa')](),controller[_0x52a4('0xd')]);router['get'](_0x52a4('0xe'),auth[_0x52a4('0xa')](),controller[_0x52a4('0xf')]);router['get']('/:id/download',auth[_0x52a4('0xa')](),controller['download']);router[_0x52a4('0x10')]('/',auth[_0x52a4('0xa')](),controller[_0x52a4('0x11')]);router[_0x52a4('0x12')](_0x52a4('0xe'),auth[_0x52a4('0xa')](),controller['update']);router[_0x52a4('0x13')]('/:id',auth[_0x52a4('0xa')](),controller[_0x52a4('0x14')]);module[_0x52a4('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index bb25dc0..54e29c0 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 _0x57ca=['MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','DATE','startedAt','format'];(function(_0x7bda4d,_0x4f3c28){var _0x51362c=function(_0x43c4e2){while(--_0x43c4e2){_0x7bda4d['push'](_0x7bda4d['shift']());}};_0x51362c(++_0x4f3c28);}(_0x57ca,0x108));var _0xa57c=function(_0x209526,_0x40a1f0){_0x209526=_0x209526-0x0;var _0x40d077=_0x57ca[_0x209526];return _0x40d077;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var config=require('../../config/environment');module[_0xa57c('0x2')]={'format':{'type':Sequelize[_0xa57c('0x3')],'get':function(){return this[_0xa57c('0x4')](_0xa57c('0x5'))?path[_0xa57c('0x6')](this['getDataValue'](_0xa57c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xa57c('0x7')]},'channel':{'type':Sequelize[_0xa57c('0x7')]},'value':{'type':Sequelize[_0xa57c('0x7')],'set':function(_0xbdfffb){var _0x314574=_0xbdfffb[_0xa57c('0x8')](/\\/g,'/');this[_0xa57c('0x9')]('value',_0x314574);}},'rating':{'type':Sequelize[_0xa57c('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x46ba92){this[_0xa57c('0x9')]('startedAt',moment()[_0xa57c('0xb')](_0x46ba92,'ms'));this['setDataValue'](_0xa57c('0xc'),moment());this[_0xa57c('0x9')]('duration',_0x46ba92);}},'startedAt':{'type':Sequelize[_0xa57c('0xd')],'get':function(){return moment(this['getDataValue'](_0xa57c('0xe')))[_0xa57c('0xf')](_0xa57c('0x10'))[_0xa57c('0x11')]();}},'closedAt':{'type':Sequelize[_0xa57c('0xd')],'get':function(){return moment(this['getDataValue'](_0xa57c('0xc')))['format'](_0xa57c('0x10'))[_0xa57c('0x11')]();}},'createdAt':{'type':Sequelize[_0xa57c('0xd')],'get':function(){return moment(this[_0xa57c('0x4')](_0xa57c('0x12')))[_0xa57c('0xf')](_0xa57c('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0xa57c('0xd')],'get':function(){return moment(this[_0xa57c('0x4')](_0xa57c('0x13')))['format'](_0xa57c('0x10'))['toString']();}}}; \ No newline at end of file +var _0x5a13=['path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','moment'];(function(_0x3d5983,_0x4b2df8){var _0x5cd144=function(_0x714e3b){while(--_0x714e3b){_0x3d5983['push'](_0x3d5983['shift']());}};_0x5cd144(++_0x4b2df8);}(_0x5a13,0x92));var _0x35a1=function(_0xb1aad7,_0x1116fe){_0xb1aad7=_0xb1aad7-0x0;var _0x5bcc11=_0x5a13[_0xb1aad7];return _0x5bcc11;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x35a1('0x0'));var path=require(_0x35a1('0x1'));var config=require(_0x35a1('0x2'));module[_0x35a1('0x3')]={'format':{'type':Sequelize[_0x35a1('0x4')],'get':function(){return this[_0x35a1('0x5')]('value')?path[_0x35a1('0x6')](this['getDataValue'](_0x35a1('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x4222a1){var _0x3bd7c9=_0x4222a1[_0x35a1('0x8')](/\\/g,'/');this[_0x35a1('0x9')](_0x35a1('0x7'),_0x3bd7c9);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x35a1('0xa')],'set':function(_0x469d94){this[_0x35a1('0x9')](_0x35a1('0xb'),moment()[_0x35a1('0xc')](_0x469d94,'ms'));this[_0x35a1('0x9')](_0x35a1('0xd'),moment());this[_0x35a1('0x9')](_0x35a1('0xe'),_0x469d94);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35a1('0x5')](_0x35a1('0xb')))[_0x35a1('0xf')](_0x35a1('0x10'))[_0x35a1('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35a1('0x5')]('closedAt'))[_0x35a1('0xf')](_0x35a1('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0x35a1('0x12')],'get':function(){return moment(this[_0x35a1('0x5')](_0x35a1('0x13')))[_0x35a1('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x35a1('0x11')]();}},'updatedAt':{'type':Sequelize[_0x35a1('0x12')],'get':function(){return moment(this[_0x35a1('0x5')](_0x35a1('0x14')))['format'](_0x35a1('0x10'))[_0x35a1('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 4a71648..5503b73 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 _0x5fc3=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','existsSync','decryptFile','secrets','join','Sequelize','ValidationError','filename','unlink','message','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x118591,_0x247276){var _0x4c4e55=function(_0x246910){while(--_0x246910){_0x118591['push'](_0x118591['shift']());}};_0x4c4e55(++_0x247276);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x5fc3[_0x2bf466];return _0x856885;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}exports['index']=function(_0x26b7cb,_0x645eac){var _0x383837={},_0x9f3c8a={},_0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x28')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x2b')]['key']};});_0x9f3c8a[_0x35fc('0x2c')]=_[_0x35fc('0x2d')](_[_0x35fc('0x28')](_0x134dfa,_0x35fc('0x26')),[_0x35fc('0x2e')]);_0x9f3c8a[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x26b7cb[_0x35fc('0x2f')]);_0x9f3c8a[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x9f3c8a['model'],_0x9f3c8a['query']);_0x383837[_0x35fc('0x33')]=_['intersection'](_0x9f3c8a[_0x35fc('0x2c')],qs[_0x35fc('0x34')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x34')]));_0x383837[_0x35fc('0x33')]=_0x383837[_0x35fc('0x33')]['length']?_0x383837[_0x35fc('0x33')]:_0x9f3c8a[_0x35fc('0x2c')];if(!_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x35')](_0x35fc('0x36'))){_0x383837[_0x35fc('0x1c')]=qs['limit'](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x1c')]);_0x383837[_0x35fc('0x1a')]=qs['offset'](_0x26b7cb[_0x35fc('0x2f')]['offset']);}_0x383837[_0x35fc('0x37')]=qs[_0x35fc('0x38')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x38')]);_0x383837['where']=qs['filters'](_['pick'](_0x26b7cb[_0x35fc('0x2f')],_0x9f3c8a['filters']),_0x134dfa);if(_0x26b7cb[_0x35fc('0x2f')]['filter']){_0x383837[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x383837[_0x35fc('0x39')],{'$or':_[_0x35fc('0x28')](_0x134dfa,function(_0x1c10e0){if(_0x1c10e0[_0x35fc('0x2b')]!==_0x35fc('0x3b')){var _0x4ec0dc={};_0x4ec0dc[_0x1c10e0[_0x35fc('0x26')]]={'$like':'%'+_0x26b7cb[_0x35fc('0x2f')]['filter']+'%'};return _0x4ec0dc;}})});}_0x383837=_[_0x35fc('0x3a')]({},_0x383837,_0x26b7cb[_0x35fc('0x3c')]);var _0x1aac67={'where':_0x383837[_0x35fc('0x39')]};return db[_0x35fc('0x29')][_0x35fc('0x1d')](_0x1aac67)['then'](function(_0x3f6480){_0x3735da[_0x35fc('0x1d')]=_0x3f6480;if(_0x26b7cb[_0x35fc('0x2f')]['includeAll']){_0x383837[_0x35fc('0x3d')]=[{'all':!![]}];}return db[_0x35fc('0x29')]['findAll'](_0x383837);})[_0x35fc('0x24')](function(_0x280af1){_0x3735da[_0x35fc('0x3e')]=_0x280af1;return _0x3735da;})[_0x35fc('0x24')](respondWithFilteredResult(_0x645eac,_0x383837))[_0x35fc('0x3f')](handleError(_0x645eac,null));};exports[_0x35fc('0x40')]=function(_0x211b70,_0x3ec51f){var _0x5a7e9e={'raw':![],'where':{'id':_0x211b70[_0x35fc('0x41')]['id']}},_0x596e83={};_0x596e83[_0x35fc('0x2c')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x596e83[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x211b70['query']);_0x596e83[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x596e83[_0x35fc('0x2c')],_0x596e83[_0x35fc('0x2f')]);_0x5a7e9e['attributes']=_['intersection'](_0x596e83['model'],qs['fields'](_0x211b70['query'][_0x35fc('0x34')]));_0x5a7e9e[_0x35fc('0x33')]=_0x5a7e9e['attributes'][_0x35fc('0x42')]?_0x5a7e9e['attributes']:_0x596e83[_0x35fc('0x2c')];if(_0x211b70[_0x35fc('0x2f')][_0x35fc('0x43')]){_0x5a7e9e[_0x35fc('0x3d')]=[{'all':!![]}];}_0x5a7e9e=_[_0x35fc('0x3a')]({},_0x5a7e9e,_0x211b70['options']);return db[_0x35fc('0x29')][_0x35fc('0x44')](_0x5a7e9e)['then'](handleEntityNotFound(_0x3ec51f,null))[_0x35fc('0x24')](respondWithResult(_0x3ec51f,null))[_0x35fc('0x3f')](handleError(_0x3ec51f,null));};exports[_0x35fc('0x45')]=function(_0x211746,_0x5bc8c3){return db[_0x35fc('0x29')]['create'](_0x211746['body'],{})[_0x35fc('0x24')](respondWithResult(_0x5bc8c3,0xc9))[_0x35fc('0x3f')](handleError(_0x5bc8c3,null));};exports[_0x35fc('0x23')]=function(_0xca8aef,_0xf2ca20){if(_0xca8aef[_0x35fc('0x46')]['id']){delete _0xca8aef[_0x35fc('0x46')]['id'];}delete _0xca8aef[_0x35fc('0x46')]['duration'];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x47')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x48')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x49')];return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0xca8aef[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0xf2ca20,null))[_0x35fc('0x24')](saveUpdates(_0xca8aef[_0x35fc('0x46')],null))[_0x35fc('0x24')](respondWithResult(_0xf2ca20,null))[_0x35fc('0x3f')](handleError(_0xf2ca20,null));};exports['describe']=function(_0x553ed6,_0x144f77){return db[_0x35fc('0x29')][_0x35fc('0x4a')]()[_0x35fc('0x24')](respondWithResult(_0x144f77,null))[_0x35fc('0x3f')](handleError(_0x144f77,null));};exports[_0x35fc('0x4b')]=function(_0x4a4798,_0x4f024c,_0x388521){var _0x19b2ce=require(_0x35fc('0x4c'));var _0x38bc78=![];var _0x5b2595={};if(_0x4a4798[_0x35fc('0x2f')][_0x35fc('0x2b')]&&_0x4a4798['query'][_0x35fc('0x2b')]===_0x35fc('0x4d')){_0x5b2595['uniqueid']=_0x4a4798[_0x35fc('0x41')]['id'];}else{_0x5b2595['id']=_0x4a4798[_0x35fc('0x41')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':_0x5b2595,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x4f024c,null))['then'](function(_0x240338){if(_0x240338){var _0x2ea8d6=path['join'](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x240338[_0x35fc('0x49')]);var _0x145854=util[_0x35fc('0x2e')]('%s.cypher',_0x2ea8d6);if(fs[_0x35fc('0x50')](_0x145854)){_0x38bc78=!![];return _0x19b2ce[_0x35fc('0x51')](_0x145854,_0x2ea8d6,config[_0x35fc('0x52')]['recording'])[_0x35fc('0x24')](function(){return _0x240338;});}return _0x240338;}})[_0x35fc('0x24')](function(_0x47fb1a){if(_0x47fb1a){var _0x35a676=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x47fb1a[_0x35fc('0x49')]);if(!fs[_0x35fc('0x50')](_0x35a676)){throw new db[(_0x35fc('0x54'))][(_0x35fc('0x55'))]('ScreenRecording\x20not\x20found');}if(_0x47fb1a[_0x35fc('0x56')]){return _0x4f024c[_0x35fc('0x4b')](_0x35a676,_0x47fb1a[_0x35fc('0x56')]+path['extname'](_0x35a676),function(){if(_0x38bc78){fs[_0x35fc('0x57')](_0x35a676);}});}else{return _0x4f024c['download'](_0x35a676,function(_0x4ceacc){if(_0x38bc78){fs['unlink'](_0x35a676);}});}}})[_0x35fc('0x3f')](function(_0xb1c68a){if(_0xb1c68a[_0x35fc('0x58')]===_0x35fc('0x59')){_0x4f024c[_0x35fc('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x4f024c,null);}});};exports['destroy']=function(_0x4faef4,_0x51d231){return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0x4faef4[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](function(_0x511e8b){if(_[_0x35fc('0x5a')](_0x511e8b)){throw new ReferenceError(_0x35fc('0x5b'));}return _0x511e8b;})[_0x35fc('0x24')](function(_0x1b0063){var _0x37bea1=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x1b0063[_0x35fc('0x49')]);logger['info'](_0x35fc('0x5c'),_0x37bea1);if(!_['isNil'](_0x1b0063[_0x35fc('0x49')])&&fs[_0x35fc('0x50')](_0x37bea1)){logger[_0x35fc('0x5d')](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}_0x37bea1=_0x37bea1+'.cypher';if(!_['isNil'](_0x1b0063['value'])&&fs[_0x35fc('0x50')](_0x37bea1)){logger['info'](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}return _0x1b0063;})['then'](function(_0x42a53a){if(!_0x42a53a)throw new InternalError();return _0x42a53a[_0x35fc('0x25')]();})[_0x35fc('0x24')](function(){_0x51d231[_0x35fc('0x18')](0xcc)['end']();})[_0x35fc('0x3f')](handleError(_0x51d231,null));}; \ No newline at end of file +var _0xae24=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','ScreenRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','duration','createdAt','closedAt','find','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xae24,0x182));var _0x4ae2=function(_0x80fb29,_0x170f94){_0x80fb29=_0x80fb29-0x0;var _0x10e099=_0xae24[_0x80fb29];return _0x10e099;};'use strict';var emlformat=require(_0x4ae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ae2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae2('0x2'));var moment=require(_0x4ae2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ae2('0x4'));var path=require('path');var sox=require(_0x4ae2('0x5'));var csv=require(_0x4ae2('0x6'));var ejs=require(_0x4ae2('0x7'));var fs=require('fs');var fs_extra=require(_0x4ae2('0x8'));var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xcc;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0x15')](_0x22ac1e);}return _0x25d2b4[_0x4ae2('0x16')](_0x22ac1e)[_0x4ae2('0x17')]();};}function respondWithResult(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0xc8;return function(_0xd527a0){if(_0xd527a0){return _0x145287['status'](_0x3cabc9)['json'](_0xd527a0);}};}function respondWithFilteredResult(_0x4d5cab,_0x2f3936){return function(_0xf834a1){if(_0xf834a1){var _0x5f447a=typeof _0x2f3936[_0x4ae2('0x18')]===_0x4ae2('0x19')&&typeof _0x2f3936[_0x4ae2('0x1a')]===_0x4ae2('0x19');var _0x428d24=_0xf834a1[_0x4ae2('0x1b')];var _0x3d4259=_0x5f447a?0x0:_0x2f3936[_0x4ae2('0x18')];var _0x41b672=_0x5f447a?_0xf834a1[_0x4ae2('0x1b')]:_0x2f3936['offset']+_0x2f3936['limit'];var _0x44a2d3;if(_0x41b672>=_0x428d24){_0x41b672=_0x428d24;_0x44a2d3=0xc8;}else{_0x44a2d3=0xce;}_0x4d5cab[_0x4ae2('0x16')](_0x44a2d3);return _0x4d5cab['set'](_0x4ae2('0x1c'),_0x3d4259+'-'+_0x41b672+'/'+_0x428d24)[_0x4ae2('0x1d')](_0xf834a1);}return null;};}function patchUpdates(_0xccb3b){return function(_0x2ad222){try{jsonpatch[_0x4ae2('0x1e')](_0x2ad222,_0xccb3b,!![]);}catch(_0x497218){return BPromise[_0x4ae2('0x1f')](_0x497218);}return _0x2ad222['save']();};}function saveUpdates(_0x522165,_0x2ceec4){return function(_0x151b70){if(_0x151b70){return _0x151b70[_0x4ae2('0x20')](_0x522165)[_0x4ae2('0x21')](function(_0xca16bf){return _0xca16bf;});}return null;};}function removeEntity(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(_0x4a0ddb){return _0x4a0ddb[_0x4ae2('0x22')]()[_0x4ae2('0x21')](function(){_0x526768[_0x4ae2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f112,_0x6f0cc6){return function(_0x2454b3){if(!_0x2454b3){_0x43f112[_0x4ae2('0x15')](0x194);}return _0x2454b3;};}function handleError(_0x1c2934,_0x255772){_0x255772=_0x255772||0x1f4;return function(_0x5b2e65){logger['error'](_0x5b2e65[_0x4ae2('0x23')]);if(_0x5b2e65[_0x4ae2('0x24')]){delete _0x5b2e65[_0x4ae2('0x24')];}_0x1c2934[_0x4ae2('0x16')](_0x255772)[_0x4ae2('0x25')](_0x5b2e65);};}exports[_0x4ae2('0x26')]=function(_0x57a377,_0x5ec1fd){var _0x3e2666={},_0x4e7741={},_0x554cff={'count':0x0,'rows':[]};var _0x5e9f03=_[_0x4ae2('0x27')](db[_0x4ae2('0x28')]['rawAttributes'],function(_0x883fd5){return{'name':_0x883fd5[_0x4ae2('0x29')],'type':_0x883fd5[_0x4ae2('0x2a')][_0x4ae2('0x2b')]};});_0x4e7741[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_[_0x4ae2('0x27')](_0x5e9f03,_0x4ae2('0x24')),[_0x4ae2('0x2e')]);_0x4e7741[_0x4ae2('0x2f')]=_[_0x4ae2('0x30')](_0x57a377[_0x4ae2('0x2f')]);_0x4e7741[_0x4ae2('0x31')]=_[_0x4ae2('0x32')](_0x4e7741[_0x4ae2('0x2c')],_0x4e7741[_0x4ae2('0x2f')]);_0x3e2666[_0x4ae2('0x33')]=_['intersection'](_0x4e7741[_0x4ae2('0x2c')],qs['fields'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x3e2666['attributes']=_0x3e2666[_0x4ae2('0x33')][_0x4ae2('0x35')]?_0x3e2666[_0x4ae2('0x33')]:_0x4e7741[_0x4ae2('0x2c')];if(!_0x57a377['query'][_0x4ae2('0x36')](_0x4ae2('0x37'))){_0x3e2666[_0x4ae2('0x1a')]=qs[_0x4ae2('0x1a')](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x1a')]);_0x3e2666[_0x4ae2('0x18')]=qs[_0x4ae2('0x18')](_0x57a377[_0x4ae2('0x2f')]['offset']);}_0x3e2666[_0x4ae2('0x38')]=qs['sort'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x39')]);_0x3e2666[_0x4ae2('0x3a')]=qs[_0x4ae2('0x31')](_[_0x4ae2('0x3b')](_0x57a377[_0x4ae2('0x2f')],_0x4e7741['filters']),_0x5e9f03);if(_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]){_0x3e2666[_0x4ae2('0x3a')]=_[_0x4ae2('0x3d')](_0x3e2666['where'],{'$or':_[_0x4ae2('0x27')](_0x5e9f03,function(_0x34a784){if(_0x34a784[_0x4ae2('0x2a')]!==_0x4ae2('0x3e')){var _0x232243={};_0x232243[_0x34a784[_0x4ae2('0x24')]]={'$like':'%'+_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]+'%'};return _0x232243;}})});}_0x3e2666=_[_0x4ae2('0x3d')]({},_0x3e2666,_0x57a377[_0x4ae2('0x3f')]);var _0x2aaef1={'where':_0x3e2666['where']};return db[_0x4ae2('0x28')][_0x4ae2('0x1b')](_0x2aaef1)[_0x4ae2('0x21')](function(_0x1473e6){_0x554cff['count']=_0x1473e6;if(_0x57a377['query'][_0x4ae2('0x40')]){_0x3e2666[_0x4ae2('0x41')]=[{'all':!![]}];}return db[_0x4ae2('0x28')][_0x4ae2('0x42')](_0x3e2666);})['then'](function(_0x3c0a56){_0x554cff[_0x4ae2('0x43')]=_0x3c0a56;return _0x554cff;})['then'](respondWithFilteredResult(_0x5ec1fd,_0x3e2666))[_0x4ae2('0x44')](handleError(_0x5ec1fd,null));};exports[_0x4ae2('0x45')]=function(_0x11a5d9,_0x5a9126){var _0x2f6431={'raw':![],'where':{'id':_0x11a5d9[_0x4ae2('0x46')]['id']}},_0x29e12c={};_0x29e12c[_0x4ae2('0x2c')]=_[_0x4ae2('0x30')](db[_0x4ae2('0x28')][_0x4ae2('0x47')]);_0x29e12c[_0x4ae2('0x2f')]=_['keys'](_0x11a5d9[_0x4ae2('0x2f')]);_0x29e12c[_0x4ae2('0x31')]=_['intersection'](_0x29e12c[_0x4ae2('0x2c')],_0x29e12c[_0x4ae2('0x2f')]);_0x2f6431['attributes']=_[_0x4ae2('0x32')](_0x29e12c[_0x4ae2('0x2c')],qs['fields'](_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x2f6431[_0x4ae2('0x33')]=_0x2f6431['attributes']['length']?_0x2f6431[_0x4ae2('0x33')]:_0x29e12c[_0x4ae2('0x2c')];if(_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x40')]){_0x2f6431['include']=[{'all':!![]}];}_0x2f6431=_[_0x4ae2('0x3d')]({},_0x2f6431,_0x11a5d9[_0x4ae2('0x3f')]);return db[_0x4ae2('0x28')]['find'](_0x2f6431)[_0x4ae2('0x21')](handleEntityNotFound(_0x5a9126,null))[_0x4ae2('0x21')](respondWithResult(_0x5a9126,null))[_0x4ae2('0x44')](handleError(_0x5a9126,null));};exports['create']=function(_0x16bf0b,_0x24ec08){return db[_0x4ae2('0x28')][_0x4ae2('0x48')](_0x16bf0b[_0x4ae2('0x49')],{})[_0x4ae2('0x21')](respondWithResult(_0x24ec08,0xc9))[_0x4ae2('0x44')](handleError(_0x24ec08,null));};exports[_0x4ae2('0x20')]=function(_0x3a6110,_0xf6d12a){if(_0x3a6110['body']['id']){delete _0x3a6110[_0x4ae2('0x49')]['id'];}delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4a')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4b')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4c')];delete _0x3a6110[_0x4ae2('0x49')]['value'];return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x3a6110['params']['id']}})[_0x4ae2('0x21')](handleEntityNotFound(_0xf6d12a,null))[_0x4ae2('0x21')](saveUpdates(_0x3a6110['body'],null))[_0x4ae2('0x21')](respondWithResult(_0xf6d12a,null))['catch'](handleError(_0xf6d12a,null));};exports[_0x4ae2('0x4e')]=function(_0x5e1c80,_0x1ae8bb){return db[_0x4ae2('0x28')][_0x4ae2('0x4e')]()[_0x4ae2('0x21')](respondWithResult(_0x1ae8bb,null))[_0x4ae2('0x44')](handleError(_0x1ae8bb,null));};exports[_0x4ae2('0x4f')]=function(_0x201260,_0xf77b17,_0x28de70){var _0x529355=require(_0x4ae2('0x50'));var _0x4284b4=![];var _0x825c3a={};if(_0x201260[_0x4ae2('0x2f')]['type']&&_0x201260[_0x4ae2('0x2f')][_0x4ae2('0x2a')]===_0x4ae2('0x51')){_0x825c3a['uniqueid']=_0x201260['params']['id'];}else{_0x825c3a['id']=_0x201260[_0x4ae2('0x46')]['id'];}return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':_0x825c3a,'attributes':['id',_0x4ae2('0x52')],'raw':!![]})[_0x4ae2('0x21')](handleEntityNotFound(_0xf77b17,null))[_0x4ae2('0x21')](function(_0x18a8e6){if(_0x18a8e6){var _0x390c1f=path[_0x4ae2('0x53')](config['root'],_0x4ae2('0x54'),_0x18a8e6['value']);var _0x11f028=util[_0x4ae2('0x2e')](_0x4ae2('0x55'),_0x390c1f);if(fs[_0x4ae2('0x56')](_0x11f028)){_0x4284b4=!![];return _0x529355[_0x4ae2('0x57')](_0x11f028,_0x390c1f,config[_0x4ae2('0x58')][_0x4ae2('0x59')])[_0x4ae2('0x21')](function(){return _0x18a8e6;});}return _0x18a8e6;}})['then'](function(_0x496f98){if(_0x496f98){var _0x33fb77=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x496f98['value']);if(!fs[_0x4ae2('0x56')](_0x33fb77)){throw new db[(_0x4ae2('0x5b'))][(_0x4ae2('0x5c'))](_0x4ae2('0x5d'));}if(_0x496f98[_0x4ae2('0x5e')]){return _0xf77b17['download'](_0x33fb77,_0x496f98['filename']+path['extname'](_0x33fb77),function(){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}else{return _0xf77b17['download'](_0x33fb77,function(_0x4e54d1){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}}})['catch'](function(_0x3efbaf){if(_0x3efbaf['message']===_0x4ae2('0x5d')){_0xf77b17['status'](0x194)[_0x4ae2('0x25')]('Not\x20found');}else{return handleError(_0xf77b17,null);}});};exports[_0x4ae2('0x22')]=function(_0x981338,_0x3f46f3){return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x981338['params']['id']}})['then'](function(_0x344963){if(_[_0x4ae2('0x60')](_0x344963)){throw new ReferenceError('Entity\x20not\x20found');}return _0x344963;})[_0x4ae2('0x21')](function(_0x29183d){var _0x517800=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x29183d['value']);logger[_0x4ae2('0x61')](_0x4ae2('0x62'),_0x517800);if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')](_0x4ae2('0x63')+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}_0x517800=_0x517800+_0x4ae2('0x65');if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')]('File:\x20\x22'+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}return _0x29183d;})['then'](function(_0x3f24bb){if(!_0x3f24bb)throw new InternalError();return _0x3f24bb['destroy']();})[_0x4ae2('0x21')](function(){_0x3f46f3['status'](0xcc)[_0x4ae2('0x17')]();})['catch'](handleError(_0x3f46f3,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 69af415..90a7131 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 _0x4439=['interactionid','util','api','moment','request-promise','rimraf','../../config/environment','./screenRecording.attributes','screen_recordings'];(function(_0x186026,_0xf863af){var _0x2ef2f0=function(_0x3c11eb){while(--_0x3c11eb){_0x186026['push'](_0x186026['shift']());}};_0x2ef2f0(++_0xf863af);}(_0x4439,0x64));var _0x9443=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x4439[_0x420b24];return _0x4da552;};'use strict';var _=require('lodash');var util=require(_0x9443('0x0'));var logger=require('../../config/logger')(_0x9443('0x1'));var moment=require(_0x9443('0x2'));var BPromise=require('bluebird');var rp=require(_0x9443('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9443('0x4'));var config=require(_0x9443('0x5'));var attributes=require(_0x9443('0x6'));module['exports']=function(_0x1cda09,_0x234637){return _0x1cda09['define']('ScreenRecording',attributes,{'tableName':_0x9443('0x7'),'paranoid':![],'indexes':[{'name':_0x9443('0x8'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd58=['exports','define','ScreenRecording','screen_recordings','interactionid','../../config/logger','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x21968e,_0x56c1c4){var _0x30ebc8=function(_0x5a2352){while(--_0x5a2352){_0x21968e['push'](_0x21968e['shift']());}};_0x30ebc8(++_0x56c1c4);}(_0xbd58,0x19c));var _0x8bd5=function(_0x161cd6,_0x56da19){_0x161cd6=_0x161cd6-0x0;var _0x5a75db=_0xbd58[_0x161cd6];return _0x5a75db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8bd5('0x0'))('api');var moment=require('moment');var BPromise=require(_0x8bd5('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bd5('0x2'));var rimraf=require(_0x8bd5('0x3'));var config=require(_0x8bd5('0x4'));var attributes=require(_0x8bd5('0x5'));module[_0x8bd5('0x6')]=function(_0x2577db,_0xf0825d){return _0x2577db[_0x8bd5('0x7')](_0x8bd5('0x8'),attributes,{'tableName':_0x8bd5('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x8bd5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 8d81edf..a5572b6 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 _0x8638=['request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8638,0x109));var _0x8863=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x8638[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x8863('0x0'));var util=require(_0x8863('0x1'));var moment=require('moment');var BPromise=require(_0x8863('0x2'));var rs=require(_0x8863('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8863('0x4'));var logger=require(_0x8863('0x5'))(_0x8863('0x6'));var config=require(_0x8863('0x7'));var jayson=require(_0x8863('0x8'));var client=jayson[_0x8863('0x9')][_0x8863('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c695d,_0x1bc2ee,_0x4508a8){return new BPromise(function(_0x39d165,_0x10f0be){return client[_0x8863('0xb')](_0x4c695d,_0x4508a8)[_0x8863('0xc')](function(_0x43557b){logger[_0x8863('0xd')](_0x8863('0xe'),_0x1bc2ee,_0x8863('0xf'));logger[_0x8863('0x10')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1bc2ee,_0x8863('0xf'),JSON[_0x8863('0x11')](_0x43557b));if(_0x43557b[_0x8863('0x12')]){if(_0x43557b[_0x8863('0x12')][_0x8863('0x13')]===0x1f4){logger[_0x8863('0x12')](_0x8863('0xe'),_0x1bc2ee,_0x43557b[_0x8863('0x12')][_0x8863('0x14')]);return _0x10f0be(_0x43557b['error'][_0x8863('0x14')]);}logger[_0x8863('0x12')](_0x8863('0xe'),_0x1bc2ee,_0x43557b['error']['message']);return _0x39d165(_0x43557b[_0x8863('0x12')][_0x8863('0x14')]);}else{logger[_0x8863('0xd')](_0x8863('0xe'),_0x1bc2ee,_0x8863('0xf'));_0x39d165(_0x43557b[_0x8863('0x15')]['message']);}})[_0x8863('0x16')](function(_0x314dbf){logger[_0x8863('0x12')](_0x8863('0xe'),_0x1bc2ee,_0x314dbf);_0x10f0be(_0x314dbf);});});} \ No newline at end of file +var _0x786c=['code','ScreenRecording,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request\x20sent','stringify','error'];(function(_0x47888a,_0x7d2f3a){var _0x2b15a4=function(_0x12a3e9){while(--_0x12a3e9){_0x47888a['push'](_0x47888a['shift']());}};_0x2b15a4(++_0x7d2f3a);}(_0x786c,0x159));var _0xc786=function(_0x594ac1,_0x5a95aa){_0x594ac1=_0x594ac1-0x0;var _0x42744e=_0x786c[_0x594ac1];return _0x42744e;};'use strict';var _=require(_0xc786('0x0'));var util=require(_0xc786('0x1'));var moment=require(_0xc786('0x2'));var BPromise=require(_0xc786('0x3'));var rs=require(_0xc786('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc786('0x5'))['db'];var utils=require(_0xc786('0x6'));var logger=require(_0xc786('0x7'))(_0xc786('0x8'));var config=require(_0xc786('0x9'));var jayson=require(_0xc786('0xa'));var client=jayson['client'][_0xc786('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b9357,_0xe43e67,_0x58878b){return new BPromise(function(_0x259a3c,_0x182cec){return client['request'](_0x4b9357,_0x58878b)['then'](function(_0x59878b){logger['info']('ScreenRecording,\x20%s,\x20%s',_0xe43e67,'request\x20sent');logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0xe43e67,_0xc786('0xc'),JSON[_0xc786('0xd')](_0x59878b));if(_0x59878b[_0xc786('0xe')]){if(_0x59878b[_0xc786('0xe')][_0xc786('0xf')]===0x1f4){logger['error'](_0xc786('0x10'),_0xe43e67,_0x59878b[_0xc786('0xe')][_0xc786('0x11')]);return _0x182cec(_0x59878b[_0xc786('0xe')]['message']);}logger[_0xc786('0xe')](_0xc786('0x10'),_0xe43e67,_0x59878b[_0xc786('0xe')][_0xc786('0x11')]);return _0x259a3c(_0x59878b[_0xc786('0xe')]['message']);}else{logger[_0xc786('0x12')](_0xc786('0x10'),_0xe43e67,'request\x20sent');_0x259a3c(_0x59878b['result'][_0xc786('0x11')]);}})[_0xc786('0x13')](function(_0x3c701b){logger[_0xc786('0xe')](_0xc786('0x10'),_0xe43e67,_0x3c701b);_0x182cec(_0x3c701b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index e37aa2e..6bbc4ea 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 _0x574e=['getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','join','/:id/logo_login','addLogoLogin','addPreferred','favicon','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getDate','/:id','show','/:id/logo'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x574e,0x1de));var _0xe574=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x574e[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xe574('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe574('0x1'));var express=require(_0xe574('0x2'));var router=express[_0xe574('0x3')]();var fs_extra=require(_0xe574('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe574('0x5'));var config=require(_0xe574('0x6'));var controller=require('./setting.controller');router[_0xe574('0x7')]('/',auth[_0xe574('0x8')](),controller[_0xe574('0x9')]);router[_0xe574('0x7')]('/now',controller[_0xe574('0xa')]);router[_0xe574('0x7')](_0xe574('0xb'),controller[_0xe574('0xc')]);router[_0xe574('0x7')](_0xe574('0xd'),controller[_0xe574('0xe')]);router['get']('/:id/logo_login',controller[_0xe574('0xf')]);router[_0xe574('0x7')](_0xe574('0x10'),controller[_0xe574('0x11')]);router['get'](_0xe574('0x12'),controller['getPreferred']);router[_0xe574('0x7')](_0xe574('0x13'),controller[_0xe574('0x14')]);var upload=multer({'storage':multer[_0xe574('0x15')]({'destination':function(_0x16e1b5,_0x5ae54d,_0x2e6668){_0x2e6668(null,path['join'](config[_0xe574('0x16')],_0xe574('0x17')));},'filename':function(_0x452c3c,_0x42a81f,_0x4d0cf2){_0x4d0cf2(null,util[_0xe574('0x18')](_0xe574('0x19'),_0xe574('0x1a'),path[_0xe574('0x1b')](_0x42a81f[_0xe574('0x1c')])));}})});router[_0xe574('0x1d')]('/:id/logo',upload[_0xe574('0x1e')](_0xe574('0x1f')),controller[_0xe574('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5666db,_0x31b25b,_0x286373){_0x286373(null,path[_0xe574('0x21')](config[_0xe574('0x16')],'server/files/images/logos/'));},'filename':function(_0x5551f1,_0x1020c0,_0x408e32){_0x408e32(null,util['format'](_0xe574('0x19'),'logologin',path[_0xe574('0x1b')](_0x1020c0[_0xe574('0x1c')])));}})});router['post'](_0xe574('0x22'),upload[_0xe574('0x1e')](_0xe574('0x1f')),controller[_0xe574('0x23')]);var upload=multer({'storage':multer[_0xe574('0x15')]({'destination':function(_0x3d52c8,_0x3a11f5,_0x31213e){_0x31213e(null,path['join'](config[_0xe574('0x16')],_0xe574('0x17')));},'filename':function(_0x1602bc,_0x4ad13e,_0x54e648){_0x54e648(null,util[_0xe574('0x18')](_0xe574('0x19'),'preferred',path[_0xe574('0x1b')](_0x4ad13e[_0xe574('0x1c')])));}})});router[_0xe574('0x1d')](_0xe574('0x12'),upload[_0xe574('0x1e')]('file'),controller[_0xe574('0x24')]);var upload=multer({'storage':multer[_0xe574('0x15')]({'destination':function(_0x58ff1a,_0x52f35,_0x1828fa){_0x1828fa(null,path['join'](config[_0xe574('0x16')],'server/files/images/logos/'));},'filename':function(_0xe46602,_0x29f630,_0x1540c7){_0x1540c7(null,util[_0xe574('0x18')](_0xe574('0x19'),_0xe574('0x25'),path['extname'](_0x29f630['originalname'])));}})});router['post'](_0xe574('0x13'),upload['single'](_0xe574('0x1f')),controller['addFavicon']);router[_0xe574('0x26')](_0xe574('0xb'),auth[_0xe574('0x8')](),controller[_0xe574('0x27')]);module[_0xe574('0x28')]=router; \ No newline at end of file +var _0x98ec=['addPreferred','favicon','/:id/favicon','addFavicon','put','isAuthenticated','update','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/preferred','diskStorage','join','server/files/images/logos/','format','%s%s','extname','originalname','post','single','addLogo','root','/:id/logo_login','addLogoLogin','file'];(function(_0xdd5da0,_0x37f7b0){var _0x66fdd8=function(_0x4ea342){while(--_0x4ea342){_0xdd5da0['push'](_0xdd5da0['shift']());}};_0x66fdd8(++_0x37f7b0);}(_0x98ec,0x112));var _0xc98e=function(_0x1b8a39,_0xbbb945){_0x1b8a39=_0x1b8a39-0x0;var _0x45bd44=_0x98ec[_0x1b8a39];return _0x45bd44;};'use strict';var multer=require(_0xc98e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc98e('0x1'));var express=require('express');var router=express[_0xc98e('0x2')]();var fs_extra=require(_0xc98e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc98e('0x4'));var config=require(_0xc98e('0x5'));var controller=require('./setting.controller');router[_0xc98e('0x6')]('/',auth['isAuthenticated'](),controller[_0xc98e('0x7')]);router[_0xc98e('0x6')](_0xc98e('0x8'),controller[_0xc98e('0x9')]);router[_0xc98e('0x6')](_0xc98e('0xa'),controller[_0xc98e('0xb')]);router[_0xc98e('0x6')](_0xc98e('0xc'),controller[_0xc98e('0xd')]);router[_0xc98e('0x6')]('/:id/logo_login',controller[_0xc98e('0xe')]);router[_0xc98e('0x6')]('/:id/gdpr',controller['gdpr']);router['get'](_0xc98e('0xf'),controller['getPreferred']);router['get']('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0xc98e('0x10')]({'destination':function(_0x276db0,_0x503cad,_0x584401){_0x584401(null,path[_0xc98e('0x11')](config['root'],_0xc98e('0x12')));},'filename':function(_0x11d575,_0x40eaaa,_0x191d9b){_0x191d9b(null,util[_0xc98e('0x13')](_0xc98e('0x14'),'logo',path[_0xc98e('0x15')](_0x40eaaa[_0xc98e('0x16')])));}})});router[_0xc98e('0x17')]('/:id/logo',upload[_0xc98e('0x18')]('file'),controller[_0xc98e('0x19')]);var upload=multer({'storage':multer[_0xc98e('0x10')]({'destination':function(_0x395235,_0x22034a,_0x41493b){_0x41493b(null,path[_0xc98e('0x11')](config[_0xc98e('0x1a')],_0xc98e('0x12')));},'filename':function(_0x2c5636,_0x34d20b,_0x49e4ae){_0x49e4ae(null,util['format']('%s%s','logologin',path[_0xc98e('0x15')](_0x34d20b[_0xc98e('0x16')])));}})});router[_0xc98e('0x17')](_0xc98e('0x1b'),upload['single']('file'),controller[_0xc98e('0x1c')]);var upload=multer({'storage':multer[_0xc98e('0x10')]({'destination':function(_0x143eec,_0x13b558,_0x7c616c){_0x7c616c(null,path['join'](config['root'],_0xc98e('0x12')));},'filename':function(_0x570f13,_0x3609d2,_0x49c8fd){_0x49c8fd(null,util[_0xc98e('0x13')](_0xc98e('0x14'),'preferred',path[_0xc98e('0x15')](_0x3609d2['originalname'])));}})});router['post']('/:id/preferred',upload['single'](_0xc98e('0x1d')),controller[_0xc98e('0x1e')]);var upload=multer({'storage':multer[_0xc98e('0x10')]({'destination':function(_0x15399a,_0x491649,_0x52677d){_0x52677d(null,path[_0xc98e('0x11')](config[_0xc98e('0x1a')],'server/files/images/logos/'));},'filename':function(_0x45a496,_0x163b81,_0x23d7d8){_0x23d7d8(null,util[_0xc98e('0x13')]('%s%s',_0xc98e('0x1f'),path[_0xc98e('0x15')](_0x163b81['originalname'])));}})});router[_0xc98e('0x17')](_0xc98e('0x20'),upload[_0xc98e('0x18')](_0xc98e('0x1d')),controller[_0xc98e('0x21')]);router[_0xc98e('0x22')](_0xc98e('0xa'),auth[_0xc98e('0x23')](),controller[_0xc98e('0x24')]);module[_0xc98e('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index b48ac7e..78f1b31 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 _0xd16a=['UNSIGNED','sequelize','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x463ccd,_0x2de72b){var _0x1d04eb=function(_0x7dd8ef){while(--_0x7dd8ef){_0x463ccd['push'](_0x463ccd['shift']());}};_0x1d04eb(++_0x2de72b);}(_0xd16a,0x121));var _0xad16=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd16a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xad16('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xad16('0x1')](0xb),'unique':_0xad16('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xad16('0x1')](0xb),'unique':_0xad16('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xad16('0x4')],'defaultValue':_0xad16('0x5')},'logo':{'type':Sequelize[_0xad16('0x4')]},'defaultLogo':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xad16('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xad16('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xad16('0x4')]},'turnaddr':{'type':Sequelize[_0xad16('0x4')]},'turnusername':{'type':Sequelize[_0xad16('0x4')]},'turnpassword':{'type':Sequelize[_0xad16('0x4')]},'pageTitle':{'type':Sequelize[_0xad16('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xad16('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xad16('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xad16('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xad16('0x4')]},'defaultPreferred':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xad16('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xad16('0x4')]},'defaultFavicon':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xad16('0x1')]},'transcribeRegion':{'type':Sequelize[_0xad16('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xad16('0x1')]},'sentimentRegion':{'type':Sequelize[_0xad16('0x4')]},'language':{'type':Sequelize[_0xad16('0x4')]},'bucket':{'type':Sequelize[_0xad16('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xad16('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xad16('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xad16('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xad16('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x567d=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x567d,0xf3));var _0xd567=function(_0xf4d9d,_0x31e068){_0xf4d9d=_0xf4d9d-0x0;var _0x35d1e0=_0x567d[_0xf4d9d];return _0x35d1e0;};'use strict';var Sequelize=require(_0xd567('0x0'));module[_0xd567('0x1')]={'min_internal':{'type':Sequelize[_0xd567('0x2')](0xb),'unique':_0xd567('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xd567('0x2')](0xb),'unique':_0xd567('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xd567('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xd567('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xd567('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xd567('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xd567('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xd567('0x5')]},'turnpassword':{'type':Sequelize[_0xd567('0x5')]},'pageTitle':{'type':Sequelize[_0xd567('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xd567('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xd567('0x7')},'enableEmailPreview':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xd567('0x5')],'defaultValue':_0xd567('0x8')},'chatTimeout':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xd567('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xd567('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xd567('0x5')]},'defaultFavicon':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xd567('0x2')]},'sentimentRegion':{'type':Sequelize[_0xd567('0x5')]},'language':{'type':Sequelize[_0xd567('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xd567('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xd567('0x2')](0x2)[_0xd567('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xd567('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xd567('0x2')](0x2)[_0xd567('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 55f9b1c..9d1fe9e 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 _0xfda0=['squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','end','send','index','map','Setting','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','length','find','body','params','addLogo','file','filename','addLogoLogin','loginLogo','server/files/images/logos','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','getLicense','defaultPreferred','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x36c571,_0x11d7f3){var _0x2c69c3=function(_0x2120bf){while(--_0x2120bf){_0x36c571['push'](_0x36c571['shift']());}};_0x2c69c3(++_0x11d7f3);}(_0xfda0,0xee));var _0x0fda=function(_0x312558,_0x3e70a2){_0x312558=_0x312558-0x0;var _0x2060ab=_0xfda0[_0x312558];return _0x2060ab;};'use strict';var emlformat=require(_0x0fda('0x0'));var rimraf=require(_0x0fda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0fda('0x2'));var moment=require(_0x0fda('0x3'));var BPromise=require(_0x0fda('0x4'));var Mustache=require(_0x0fda('0x5'));var util=require(_0x0fda('0x6'));var path=require(_0x0fda('0x7'));var sox=require(_0x0fda('0x8'));var csv=require(_0x0fda('0x9'));var ejs=require(_0x0fda('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fda('0xb'));var squel=require(_0x0fda('0xc'));var crypto=require(_0x0fda('0xd'));var jsforce=require(_0x0fda('0xe'));var deskjs=require(_0x0fda('0xf'));var toCsv=require(_0x0fda('0x9'));var querystring=require('querystring');var Papa=require(_0x0fda('0x10'));var Redis=require('ioredis');var authService=require(_0x0fda('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0fda('0x12'));var hardwareService=require(_0x0fda('0x13'));var logger=require(_0x0fda('0x14'))(_0x0fda('0x15'));var utils=require(_0x0fda('0x16'));var config=require(_0x0fda('0x17'));var licenseUtil=require(_0x0fda('0x18'));var db=require(_0x0fda('0x19'))['db'];var jayson=require(_0x0fda('0x1a'));var client=jayson[_0x0fda('0x1b')][_0x0fda('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1c076d,_0x4523e7,_0xc7f16d,_0x3096fa){return new BPromise(function(_0x54ed72,_0x432a0c){var _0x854d59=_0x3096fa||client;return _0x854d59[_0x0fda('0x1d')](_0x1c076d,_0xc7f16d)[_0x0fda('0x1e')](function(_0x3f31e0){logger['info'](_0x0fda('0x1f'),_0x4523e7,_0x0fda('0x20'));logger[_0x0fda('0x21')](_0x0fda('0x22'),_0x4523e7,_0x0fda('0x20'),JSON['stringify'](_0x3f31e0));if(_0x3f31e0[_0x0fda('0x23')]){if(_0x3f31e0[_0x0fda('0x23')]['code']===0x1f4){logger[_0x0fda('0x23')](_0x0fda('0x1f'),_0x4523e7,_0x3f31e0[_0x0fda('0x23')]['message']);return _0x432a0c(_0x3f31e0[_0x0fda('0x23')][_0x0fda('0x24')]);}logger[_0x0fda('0x23')](_0x0fda('0x1f'),_0x4523e7,_0x3f31e0['error'][_0x0fda('0x24')]);return _0x54ed72(_0x3f31e0['error'][_0x0fda('0x24')]);}else{logger[_0x0fda('0x25')](_0x0fda('0x1f'),_0x4523e7,_0x0fda('0x20'));_0x54ed72(_0x3f31e0[_0x0fda('0x26')][_0x0fda('0x24')]);}})[_0x0fda('0x27')](function(_0x250420){logger[_0x0fda('0x23')](_0x0fda('0x1f'),_0x4523e7,_0x250420);_0x432a0c(_0x250420);});});}function respondWithStatusCode(_0x399ee3,_0x469568){_0x469568=_0x469568||0xcc;return function(_0x123210){if(_0x123210){return _0x399ee3[_0x0fda('0x28')](_0x469568);}return _0x399ee3['status'](_0x469568)['end']();};}function respondWithResult(_0x234a80,_0x4653da){_0x4653da=_0x4653da||0xc8;return function(_0x37e0ae){if(_0x37e0ae){return _0x234a80[_0x0fda('0x29')](_0x4653da)['json'](_0x37e0ae);}};}function respondWithFilteredResult(_0x2d0e33,_0x27b549){return function(_0x37796e){if(_0x37796e){var _0xc1a305=typeof _0x27b549[_0x0fda('0x2a')]===_0x0fda('0x2b')&&typeof _0x27b549['limit']===_0x0fda('0x2b');var _0x403c9c=_0x37796e[_0x0fda('0x2c')];var _0x3a5107=_0xc1a305?0x0:_0x27b549[_0x0fda('0x2a')];var _0x1f2dfb=_0xc1a305?_0x37796e['count']:_0x27b549['offset']+_0x27b549[_0x0fda('0x2d')];var _0x2528e9;if(_0x1f2dfb>=_0x403c9c){_0x1f2dfb=_0x403c9c;_0x2528e9=0xc8;}else{_0x2528e9=0xce;}_0x2d0e33[_0x0fda('0x29')](_0x2528e9);return _0x2d0e33[_0x0fda('0x2e')](_0x0fda('0x2f'),_0x3a5107+'-'+_0x1f2dfb+'/'+_0x403c9c)[_0x0fda('0x30')](_0x37796e);}return null;};}function patchUpdates(_0x1b26ad){return function(_0x27678b){try{jsonpatch[_0x0fda('0x31')](_0x27678b,_0x1b26ad,!![]);}catch(_0x3a69e7){return BPromise[_0x0fda('0x32')](_0x3a69e7);}return _0x27678b[_0x0fda('0x33')]();};}function saveUpdates(_0x3e344b,_0x484bb4){return function(_0x3547db){if(_0x3547db){return _0x3547db[_0x0fda('0x34')](_0x3e344b)[_0x0fda('0x1e')](function(_0x5d3370){return _0x5d3370;});}return null;};}function removeEntity(_0x313637,_0x249d3c){return function(_0x4fc6f5){if(_0x4fc6f5){return _0x4fc6f5['destroy']()[_0x0fda('0x1e')](function(){_0x313637[_0x0fda('0x29')](0xcc)[_0x0fda('0x35')]();});}};}function handleEntityNotFound(_0x4abb54,_0x173e47){return function(_0x294d93){if(!_0x294d93){_0x4abb54[_0x0fda('0x28')](0x194);}return _0x294d93;};}function handleError(_0x2e13dc,_0x1de899){_0x1de899=_0x1de899||0x1f4;return function(_0x170395){logger['error'](_0x170395['stack']);if(_0x170395['name']){delete _0x170395['name'];}_0x2e13dc[_0x0fda('0x29')](_0x1de899)[_0x0fda('0x36')](_0x170395);};}exports[_0x0fda('0x37')]=function(_0x2b0dff,_0x3e30a1){var _0x22dc0a={},_0x4c268f={},_0xf32dfa={'count':0x0,'rows':[]};var _0x25aafd=_[_0x0fda('0x38')](db[_0x0fda('0x39')]['rawAttributes'],function(_0x3585c7){return{'name':_0x3585c7[_0x0fda('0x3a')],'type':_0x3585c7[_0x0fda('0x3b')][_0x0fda('0x3c')]};});_0x4c268f[_0x0fda('0x3d')]=_[_0x0fda('0x38')](_0x25aafd,_0x0fda('0x3e'));_0x4c268f['query']=_[_0x0fda('0x3f')](_0x2b0dff[_0x0fda('0x40')]);_0x4c268f[_0x0fda('0x41')]=_[_0x0fda('0x42')](_0x4c268f[_0x0fda('0x3d')],_0x4c268f['query']);_0x22dc0a[_0x0fda('0x43')]=_['intersection'](_0x4c268f[_0x0fda('0x3d')],qs['fields'](_0x2b0dff['query'][_0x0fda('0x44')]));_0x22dc0a['attributes']=_0x22dc0a[_0x0fda('0x43')]['length']?_0x22dc0a['attributes']:_0x4c268f[_0x0fda('0x3d')];if(!_0x2b0dff[_0x0fda('0x40')]['hasOwnProperty'](_0x0fda('0x45'))){_0x22dc0a[_0x0fda('0x2d')]=qs[_0x0fda('0x2d')](_0x2b0dff[_0x0fda('0x40')][_0x0fda('0x2d')]);_0x22dc0a[_0x0fda('0x2a')]=qs[_0x0fda('0x2a')](_0x2b0dff[_0x0fda('0x40')]['offset']);}_0x22dc0a[_0x0fda('0x46')]=qs[_0x0fda('0x47')](_0x2b0dff[_0x0fda('0x40')][_0x0fda('0x47')]);_0x22dc0a[_0x0fda('0x48')]=qs['filters'](_[_0x0fda('0x49')](_0x2b0dff[_0x0fda('0x40')],_0x4c268f[_0x0fda('0x41')]),_0x25aafd);if(_0x2b0dff[_0x0fda('0x40')][_0x0fda('0x4a')]){_0x22dc0a[_0x0fda('0x48')]=_[_0x0fda('0x4b')](_0x22dc0a[_0x0fda('0x48')],{'$or':_['map'](_0x25aafd,function(_0x2da836){if(_0x2da836[_0x0fda('0x3b')]!==_0x0fda('0x4c')){var _0xa96f00={};_0xa96f00[_0x2da836[_0x0fda('0x3e')]]={'$like':'%'+_0x2b0dff[_0x0fda('0x40')]['filter']+'%'};return _0xa96f00;}})});}_0x22dc0a=_['merge']({},_0x22dc0a,_0x2b0dff[_0x0fda('0x4d')]);var _0x1a779e={'where':_0x22dc0a[_0x0fda('0x48')]};return db[_0x0fda('0x39')][_0x0fda('0x2c')](_0x1a779e)['then'](function(_0x3aa349){_0xf32dfa['count']=_0x3aa349;if(_0x2b0dff[_0x0fda('0x40')][_0x0fda('0x4e')]){_0x22dc0a[_0x0fda('0x4f')]=[{'all':!![]}];}return db[_0x0fda('0x39')]['findAll'](_0x22dc0a);})[_0x0fda('0x1e')](function(_0x2e0d07){_0xf32dfa[_0x0fda('0x50')]=_0x2e0d07;return _0xf32dfa;})['then'](respondWithFilteredResult(_0x3e30a1,_0x22dc0a))[_0x0fda('0x27')](handleError(_0x3e30a1,null));};exports[_0x0fda('0x51')]=function(_0x4ab9d6,_0x160bac){var _0x452df2={'raw':![],'where':{'id':_0x4ab9d6['params']['id']}},_0x1daf84={};_0x1daf84[_0x0fda('0x3d')]=_[_0x0fda('0x3f')](db[_0x0fda('0x39')][_0x0fda('0x52')]);_0x1daf84['query']=_['keys'](_0x4ab9d6['query']);_0x1daf84[_0x0fda('0x41')]=_[_0x0fda('0x42')](_0x1daf84[_0x0fda('0x3d')],_0x1daf84[_0x0fda('0x40')]);_0x452df2[_0x0fda('0x43')]=_[_0x0fda('0x42')](_0x1daf84[_0x0fda('0x3d')],qs[_0x0fda('0x44')](_0x4ab9d6[_0x0fda('0x40')]['fields']));_0x452df2['attributes']=_0x452df2[_0x0fda('0x43')][_0x0fda('0x53')]?_0x452df2[_0x0fda('0x43')]:_0x1daf84['model'];if(_0x4ab9d6['query']['includeAll']){_0x452df2[_0x0fda('0x4f')]=[{'all':!![]}];}_0x452df2=_[_0x0fda('0x4b')]({},_0x452df2,_0x4ab9d6[_0x0fda('0x4d')]);return db[_0x0fda('0x39')][_0x0fda('0x54')](_0x452df2)['then'](handleEntityNotFound(_0x160bac,null))[_0x0fda('0x1e')](respondWithResult(_0x160bac,null))[_0x0fda('0x27')](handleError(_0x160bac,null));};exports[_0x0fda('0x34')]=function(_0x13b56c,_0x4215b1){if(_0x13b56c[_0x0fda('0x55')]['id']){delete _0x13b56c[_0x0fda('0x55')]['id'];}return db[_0x0fda('0x39')][_0x0fda('0x54')]({'where':{'id':_0x13b56c[_0x0fda('0x56')]['id']}})[_0x0fda('0x1e')](handleEntityNotFound(_0x4215b1,null))['then'](saveUpdates(_0x13b56c[_0x0fda('0x55')],null))[_0x0fda('0x1e')](respondWithResult(_0x4215b1,null))['catch'](handleError(_0x4215b1,null));};exports[_0x0fda('0x57')]=function(_0x2956dd,_0x386ab6,_0x2ea4f8){if(_0x2956dd[_0x0fda('0x58')]&&_0x2956dd[_0x0fda('0x58')][_0x0fda('0x59')]){_0x2956dd[_0x0fda('0x55')]['logo']=_0x2956dd['file'][_0x0fda('0x59')];}return db['Setting'][_0x0fda('0x54')]({'where':{'id':_0x2956dd[_0x0fda('0x56')]['id']}})['then'](handleEntityNotFound(_0x386ab6,null))[_0x0fda('0x1e')](saveUpdates(_0x2956dd[_0x0fda('0x55')],null))[_0x0fda('0x1e')](respondWithResult(_0x386ab6,null))[_0x0fda('0x27')](handleError(_0x386ab6,null));};exports[_0x0fda('0x5a')]=function(_0x51330b,_0xdbf66e,_0x2dc25d){if(_0x51330b[_0x0fda('0x58')]&&_0x51330b[_0x0fda('0x58')][_0x0fda('0x59')]){_0x51330b[_0x0fda('0x55')][_0x0fda('0x5b')]=_0x51330b[_0x0fda('0x58')]['filename'];}return db[_0x0fda('0x39')][_0x0fda('0x54')]({'where':{'id':_0x51330b[_0x0fda('0x56')]['id']}})[_0x0fda('0x1e')](handleEntityNotFound(_0xdbf66e,null))[_0x0fda('0x1e')](saveUpdates(_0x51330b[_0x0fda('0x55')],null))[_0x0fda('0x1e')](respondWithResult(_0xdbf66e,null))[_0x0fda('0x27')](handleError(_0xdbf66e,null));};var utilLicense=require(_0x0fda('0x18'));exports['getLogo']=function(_0x557a32,_0x4c81aa,_0x5d299e){var _0x2f2ab6=_0x0fda('0x5c');var _0x5c75d1={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x167c80){if(_0x167c80){_0x5c75d1=_0x167c80;}return db['Setting'][_0x0fda('0x54')]({'where':{'id':_0x557a32['params']['id']},'attributes':[_0x0fda('0x5d'),_0x0fda('0x5b'),_0x0fda('0x5e'),_0x0fda('0x5f'),_0x0fda('0x60'),_0x0fda('0x61'),'defaultPreferred',_0x0fda('0x62')],'raw':!![]});})[_0x0fda('0x1e')](handleEntityNotFound(_0x4c81aa,null))[_0x0fda('0x1e')](function(_0x598cf5){if(_0x598cf5){var _0x1a0f31=_0x598cf5[_0x0fda('0x5d')]&&fs[_0x0fda('0x63')](path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x2f2ab6,_[_0x0fda('0x66')](_0x598cf5[_0x0fda('0x5d')])))?path['join'](config[_0x0fda('0x65')],_0x2f2ab6,_[_0x0fda('0x66')](_0x598cf5[_0x0fda('0x5d')])):path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x2f2ab6,_[_0x0fda('0x66')](_0x0fda('0x67')));var _0x2d543b=_0x0fda('0x68')+_['upperFirst'](_0x0fda('0x5d'));if(_0x598cf5[_0x2d543b]||!_0x5c75d1[_0x0fda('0x69')]){_0x1a0f31=path['join'](config[_0x0fda('0x65')],_0x2f2ab6,_[_0x0fda('0x66')](_0x0fda('0x67')));}if(!fs[_0x0fda('0x63')](_0x1a0f31)){throw new db[(_0x0fda('0x6a'))][(_0x0fda('0x6b'))](_[_0x0fda('0x6c')]('logo')+_0x0fda('0x6d'));}return _0x4c81aa[_0x0fda('0x6e')](_0x1a0f31);}})[_0x0fda('0x27')](handleError(_0x4c81aa,null));};var utilLicense=require(_0x0fda('0x18'));exports[_0x0fda('0x6f')]=function(_0x2adccc,_0x3008d4,_0x72b30b){var _0x739c52=_0x0fda('0x5c');var _0x4eccae={'custom':![]};return utilLicense[_0x0fda('0x70')]()[_0x0fda('0x1e')](function(_0x366ddc){if(_0x366ddc){_0x4eccae=_0x366ddc;}return db[_0x0fda('0x39')][_0x0fda('0x54')]({'where':{'id':_0x2adccc['params']['id']},'attributes':[_0x0fda('0x5d'),_0x0fda('0x5b'),_0x0fda('0x5e'),_0x0fda('0x5f'),_0x0fda('0x60'),'defaultLoginLogo',_0x0fda('0x71'),'defaultFavicon'],'raw':!![]});})[_0x0fda('0x1e')](handleEntityNotFound(_0x3008d4,null))['then'](function(_0x3f1bc6){if(_0x3f1bc6){var _0x4683c2=_0x3f1bc6[_0x0fda('0x5b')]&&fs['existsSync'](path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x739c52,_[_0x0fda('0x66')](_0x3f1bc6[_0x0fda('0x5b')])))?path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x739c52,_[_0x0fda('0x66')](_0x3f1bc6[_0x0fda('0x5b')])):path['join'](config['root'],_0x739c52,_['toLower']('default_loginLogo.svg'));var _0x44cd02='default'+_[_0x0fda('0x6c')](_0x0fda('0x5b'));if(_0x3f1bc6[_0x44cd02]||!_0x4eccae[_0x0fda('0x69')]){_0x4683c2=path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x739c52,_[_0x0fda('0x66')]('default_loginLogo.svg'));}if(!fs[_0x0fda('0x63')](_0x4683c2)){throw new db[(_0x0fda('0x6a'))][(_0x0fda('0x6b'))](_[_0x0fda('0x6c')]('loginLogo')+_0x0fda('0x6d'));}return _0x3008d4['download'](_0x4683c2);}})[_0x0fda('0x27')](handleError(_0x3008d4,null));};exports[_0x0fda('0x72')]=function(_0x401f33,_0x5cbe53){return db['Setting']['find']({'where':{'id':_0x401f33[_0x0fda('0x56')]['id']},'attributes':['securePassword']})[_0x0fda('0x1e')](respondWithResult(_0x5cbe53,null))[_0x0fda('0x27')](handleError(_0x5cbe53,null));};exports[_0x0fda('0x73')]=function(_0x272f1b,_0x219ad9,_0x37b847){if(_0x272f1b[_0x0fda('0x58')]&&_0x272f1b['file'][_0x0fda('0x59')]){_0x272f1b[_0x0fda('0x55')][_0x0fda('0x5e')]=_0x272f1b['file'][_0x0fda('0x59')];}return db[_0x0fda('0x39')][_0x0fda('0x54')]({'where':{'id':_0x272f1b[_0x0fda('0x56')]['id']}})[_0x0fda('0x1e')](handleEntityNotFound(_0x219ad9,null))[_0x0fda('0x1e')](saveUpdates(_0x272f1b['body'],null))[_0x0fda('0x1e')](respondWithResult(_0x219ad9,null))[_0x0fda('0x27')](handleError(_0x219ad9,null));};var utilLicense=require(_0x0fda('0x18'));exports[_0x0fda('0x74')]=function(_0x27aa83,_0x3d8190,_0x4fb5f6){var _0x229141=_0x0fda('0x5c');var _0xec99a9={'custom':![]};return utilLicense['getLicense']()[_0x0fda('0x1e')](function(_0x217ed4){if(_0x217ed4){_0xec99a9=_0x217ed4;}return db[_0x0fda('0x39')][_0x0fda('0x54')]({'where':{'id':_0x27aa83[_0x0fda('0x56')]['id']},'attributes':[_0x0fda('0x5d'),'loginLogo','preferred',_0x0fda('0x5f'),'defaultLogo',_0x0fda('0x61'),_0x0fda('0x71'),'defaultFavicon'],'raw':!![]});})[_0x0fda('0x1e')](handleEntityNotFound(_0x3d8190,null))[_0x0fda('0x1e')](function(_0x235582){if(_0x235582){var _0x2217b3=_0x235582[_0x0fda('0x5e')]&&fs['existsSync'](path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x229141,_['toLower'](_0x235582[_0x0fda('0x5e')])))?path['join'](config[_0x0fda('0x65')],_0x229141,_[_0x0fda('0x66')](_0x235582['preferred'])):path[_0x0fda('0x64')](config['root'],_0x229141,_[_0x0fda('0x66')](_0x0fda('0x75')));var _0x21cdad=_0x0fda('0x68')+_[_0x0fda('0x6c')]('preferred');if(_0x235582[_0x21cdad]||!_0xec99a9[_0x0fda('0x69')]||!_0xec99a9[_0x0fda('0x5e')]){_0x2217b3=path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x229141,_[_0x0fda('0x66')]('default_preferred.png'));}if(!fs[_0x0fda('0x63')](_0x2217b3)){throw new db[(_0x0fda('0x6a'))]['ValidationError'](_[_0x0fda('0x6c')](_0x0fda('0x5e'))+_0x0fda('0x6d'));}return _0x3d8190[_0x0fda('0x6e')](_0x2217b3);}})[_0x0fda('0x27')](handleError(_0x3d8190,null));};exports[_0x0fda('0x76')]=function(_0x28a33c,_0x368702,_0x134d6c){if(_0x28a33c[_0x0fda('0x58')]&&_0x28a33c[_0x0fda('0x58')][_0x0fda('0x59')]){_0x28a33c[_0x0fda('0x55')][_0x0fda('0x5f')]=_0x28a33c[_0x0fda('0x58')]['filename'];}return db[_0x0fda('0x39')]['find']({'where':{'id':_0x28a33c[_0x0fda('0x56')]['id']}})[_0x0fda('0x1e')](handleEntityNotFound(_0x368702,null))['then'](saveUpdates(_0x28a33c[_0x0fda('0x55')],null))[_0x0fda('0x1e')](respondWithResult(_0x368702,null))[_0x0fda('0x27')](handleError(_0x368702,null));};var utilLicense=require(_0x0fda('0x18'));exports[_0x0fda('0x77')]=function(_0x5ddaa3,_0x3e2d32,_0x57da79){var _0x242f85=_0x0fda('0x5c');var _0x1669ed={'custom':![]};return utilLicense[_0x0fda('0x70')]()[_0x0fda('0x1e')](function(_0x1fbcce){if(_0x1fbcce){_0x1669ed=_0x1fbcce;}return db['Setting']['find']({'where':{'id':_0x5ddaa3[_0x0fda('0x56')]['id']},'attributes':[_0x0fda('0x5d'),_0x0fda('0x5b'),_0x0fda('0x5e'),_0x0fda('0x5f'),_0x0fda('0x60'),_0x0fda('0x61'),_0x0fda('0x71'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3e2d32,null))[_0x0fda('0x1e')](function(_0x10cbfc){if(_0x10cbfc){var _0x10eb86=_0x10cbfc[_0x0fda('0x5f')]&&fs[_0x0fda('0x63')](path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x242f85,_['toLower'](_0x10cbfc['favicon'])))?path['join'](config['root'],_0x242f85,_[_0x0fda('0x66')](_0x10cbfc[_0x0fda('0x5f')])):path[_0x0fda('0x64')](config['root'],_0x242f85,_['toLower'](_0x0fda('0x78')));var _0x38963a=_0x0fda('0x68')+_['upperFirst'](_0x0fda('0x5f'));if(_0x10cbfc[_0x38963a]||!_0x1669ed[_0x0fda('0x69')]){_0x10eb86=path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x242f85,_['toLower']('default_favicon.ico'));}if(!fs[_0x0fda('0x63')](_0x10eb86)){throw new db[(_0x0fda('0x6a'))][(_0x0fda('0x6b'))](_['upperFirst'](_0x0fda('0x5f'))+_0x0fda('0x6d'));}return _0x3e2d32[_0x0fda('0x6e')](_0x10eb86);}})[_0x0fda('0x27')](handleError(_0x3e2d32,null));};exports[_0x0fda('0x79')]=function(_0x119582,_0x2ebcb7){var _0x4a5bea={'offset':moment()[_0x0fda('0x7a')]()};_0x4a5bea[_0x0fda('0x7b')]=moment()[_0x0fda('0x7a')](_0x4a5bea[_0x0fda('0x2a')])['format'](_0x0fda('0x7c'));return _0x2ebcb7['status'](0xc8)[_0x0fda('0x36')](_0x4a5bea);}; \ No newline at end of file +var _0xe062=['util','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','update','destroy','name','Setting','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','sort','where','filters','merge','filter','includeAll','findAll','rows','show','rawAttributes','include','options','body','file','filename','logo','find','params','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','root','join','toLower','upperFirst','ValidationError','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','default','Sequelize','gdpr','default_preferred.png','custom','addFavicon','default_favicon.ico','getDate','now','utcOffset','send','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x1f7e36,_0x4680ab){var _0x1a71f3=function(_0x69b7bc){while(--_0x69b7bc){_0x1f7e36['push'](_0x1f7e36['shift']());}};_0x1a71f3(++_0x4680ab);}(_0xe062,0xd5));var _0x2e06=function(_0x511451,_0x423f1c){_0x511451=_0x511451-0x0;var _0x16da1d=_0xe062[_0x511451];return _0x16da1d;};'use strict';var emlformat=require(_0x2e06('0x0'));var rimraf=require(_0x2e06('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e06('0x2'));var rp=require(_0x2e06('0x3'));var moment=require(_0x2e06('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2e06('0x5'));var path=require(_0x2e06('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2e06('0x7'));var fs=require('fs');var fs_extra=require(_0x2e06('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2e06('0x9'));var jsforce=require(_0x2e06('0xa'));var deskjs=require(_0x2e06('0xb'));var toCsv=require(_0x2e06('0xc'));var querystring=require(_0x2e06('0xd'));var Papa=require(_0x2e06('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2e06('0xf'));var as=require(_0x2e06('0x10'));var hardwareService=require(_0x2e06('0x11'));var logger=require('../../config/logger')(_0x2e06('0x12'));var utils=require(_0x2e06('0x13'));var config=require(_0x2e06('0x14'));var licenseUtil=require(_0x2e06('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2e06('0x16'));var client=jayson[_0x2e06('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd781db,_0x12fbe2,_0x56f769,_0x745e06){return new BPromise(function(_0x2a3a2a,_0x9a3ab4){var _0x25909a=_0x745e06||client;return _0x25909a[_0x2e06('0x18')](_0xd781db,_0x56f769)[_0x2e06('0x19')](function(_0x5e4795){logger[_0x2e06('0x1a')](_0x2e06('0x1b'),_0x12fbe2,_0x2e06('0x1c'));logger[_0x2e06('0x1d')](_0x2e06('0x1e'),_0x12fbe2,_0x2e06('0x1c'),JSON[_0x2e06('0x1f')](_0x5e4795));if(_0x5e4795[_0x2e06('0x20')]){if(_0x5e4795[_0x2e06('0x20')]['code']===0x1f4){logger[_0x2e06('0x20')](_0x2e06('0x1b'),_0x12fbe2,_0x5e4795['error'][_0x2e06('0x21')]);return _0x9a3ab4(_0x5e4795[_0x2e06('0x20')][_0x2e06('0x21')]);}logger[_0x2e06('0x20')](_0x2e06('0x1b'),_0x12fbe2,_0x5e4795[_0x2e06('0x20')][_0x2e06('0x21')]);return _0x2a3a2a(_0x5e4795[_0x2e06('0x20')][_0x2e06('0x21')]);}else{logger[_0x2e06('0x1a')](_0x2e06('0x1b'),_0x12fbe2,_0x2e06('0x1c'));_0x2a3a2a(_0x5e4795[_0x2e06('0x22')][_0x2e06('0x21')]);}})[_0x2e06('0x23')](function(_0x38b5db){logger[_0x2e06('0x20')](_0x2e06('0x1b'),_0x12fbe2,_0x38b5db);_0x9a3ab4(_0x38b5db);});});}function respondWithStatusCode(_0x4963eb,_0x21eea1){_0x21eea1=_0x21eea1||0xcc;return function(_0x1c1e6f){if(_0x1c1e6f){return _0x4963eb[_0x2e06('0x24')](_0x21eea1);}return _0x4963eb[_0x2e06('0x25')](_0x21eea1)[_0x2e06('0x26')]();};}function respondWithResult(_0x10deac,_0x73d502){_0x73d502=_0x73d502||0xc8;return function(_0x1ed50e){if(_0x1ed50e){return _0x10deac[_0x2e06('0x25')](_0x73d502)['json'](_0x1ed50e);}};}function respondWithFilteredResult(_0x43e830,_0x123daf){return function(_0xdcb6f8){if(_0xdcb6f8){var _0x3d1011=typeof _0x123daf[_0x2e06('0x27')]==='undefined'&&typeof _0x123daf[_0x2e06('0x28')]==='undefined';var _0x1ed86f=_0xdcb6f8[_0x2e06('0x29')];var _0x577278=_0x3d1011?0x0:_0x123daf[_0x2e06('0x27')];var _0x18f703=_0x3d1011?_0xdcb6f8[_0x2e06('0x29')]:_0x123daf['offset']+_0x123daf['limit'];var _0x2cb75f;if(_0x18f703>=_0x1ed86f){_0x18f703=_0x1ed86f;_0x2cb75f=0xc8;}else{_0x2cb75f=0xce;}_0x43e830[_0x2e06('0x25')](_0x2cb75f);return _0x43e830[_0x2e06('0x2a')](_0x2e06('0x2b'),_0x577278+'-'+_0x18f703+'/'+_0x1ed86f)[_0x2e06('0x2c')](_0xdcb6f8);}return null;};}function patchUpdates(_0x63e387){return function(_0x25b1f2){try{jsonpatch[_0x2e06('0x2d')](_0x25b1f2,_0x63e387,!![]);}catch(_0x18aab8){return BPromise['reject'](_0x18aab8);}return _0x25b1f2['save']();};}function saveUpdates(_0x4dfc10,_0x4a265b){return function(_0x40a4a7){if(_0x40a4a7){return _0x40a4a7[_0x2e06('0x2e')](_0x4dfc10)['then'](function(_0x321e27){return _0x321e27;});}return null;};}function removeEntity(_0x4274e7,_0x2c3777){return function(_0x4f8579){if(_0x4f8579){return _0x4f8579[_0x2e06('0x2f')]()[_0x2e06('0x19')](function(){_0x4274e7['status'](0xcc)[_0x2e06('0x26')]();});}};}function handleEntityNotFound(_0x13acb4,_0x177d3c){return function(_0x2d1e03){if(!_0x2d1e03){_0x13acb4['sendStatus'](0x194);}return _0x2d1e03;};}function handleError(_0x3c0cee,_0x11a55f){_0x11a55f=_0x11a55f||0x1f4;return function(_0x2fd67c){logger[_0x2e06('0x20')](_0x2fd67c['stack']);if(_0x2fd67c[_0x2e06('0x30')]){delete _0x2fd67c[_0x2e06('0x30')];}_0x3c0cee['status'](_0x11a55f)['send'](_0x2fd67c);};}exports['index']=function(_0x2ada2b,_0x5a83ea){var _0x5a0f36={},_0x370235={},_0x1b28c6={'count':0x0,'rows':[]};var _0x37ce38=_['map'](db[_0x2e06('0x31')]['rawAttributes'],function(_0x6d6c9f){return{'name':_0x6d6c9f['fieldName'],'type':_0x6d6c9f[_0x2e06('0x32')][_0x2e06('0x33')]};});_0x370235['model']=_['map'](_0x37ce38,_0x2e06('0x30'));_0x370235[_0x2e06('0x34')]=_[_0x2e06('0x35')](_0x2ada2b[_0x2e06('0x34')]);_0x370235['filters']=_[_0x2e06('0x36')](_0x370235['model'],_0x370235['query']);_0x5a0f36[_0x2e06('0x37')]=_['intersection'](_0x370235['model'],qs[_0x2e06('0x38')](_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x38')]));_0x5a0f36[_0x2e06('0x37')]=_0x5a0f36[_0x2e06('0x37')][_0x2e06('0x39')]?_0x5a0f36[_0x2e06('0x37')]:_0x370235[_0x2e06('0x3a')];if(!_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x3b')]('nolimit')){_0x5a0f36[_0x2e06('0x28')]=qs[_0x2e06('0x28')](_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x28')]);_0x5a0f36[_0x2e06('0x27')]=qs['offset'](_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x27')]);}_0x5a0f36['order']=qs['sort'](_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x3c')]);_0x5a0f36[_0x2e06('0x3d')]=qs[_0x2e06('0x3e')](_['pick'](_0x2ada2b[_0x2e06('0x34')],_0x370235['filters']),_0x37ce38);if(_0x2ada2b[_0x2e06('0x34')]['filter']){_0x5a0f36[_0x2e06('0x3d')]=_[_0x2e06('0x3f')](_0x5a0f36[_0x2e06('0x3d')],{'$or':_['map'](_0x37ce38,function(_0x208ef5){if(_0x208ef5[_0x2e06('0x32')]!=='VIRTUAL'){var _0x2452da={};_0x2452da[_0x208ef5[_0x2e06('0x30')]]={'$like':'%'+_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x40')]+'%'};return _0x2452da;}})});}_0x5a0f36=_[_0x2e06('0x3f')]({},_0x5a0f36,_0x2ada2b['options']);var _0xbb7917={'where':_0x5a0f36[_0x2e06('0x3d')]};return db[_0x2e06('0x31')]['count'](_0xbb7917)[_0x2e06('0x19')](function(_0x48e446){_0x1b28c6[_0x2e06('0x29')]=_0x48e446;if(_0x2ada2b['query'][_0x2e06('0x41')]){_0x5a0f36['include']=[{'all':!![]}];}return db[_0x2e06('0x31')][_0x2e06('0x42')](_0x5a0f36);})['then'](function(_0x111509){_0x1b28c6[_0x2e06('0x43')]=_0x111509;return _0x1b28c6;})[_0x2e06('0x19')](respondWithFilteredResult(_0x5a83ea,_0x5a0f36))[_0x2e06('0x23')](handleError(_0x5a83ea,null));};exports[_0x2e06('0x44')]=function(_0x5a749a,_0x2dcdaa){var _0x508fff={'raw':![],'where':{'id':_0x5a749a['params']['id']}},_0x1de5dd={};_0x1de5dd[_0x2e06('0x3a')]=_[_0x2e06('0x35')](db[_0x2e06('0x31')][_0x2e06('0x45')]);_0x1de5dd['query']=_[_0x2e06('0x35')](_0x5a749a[_0x2e06('0x34')]);_0x1de5dd['filters']=_['intersection'](_0x1de5dd[_0x2e06('0x3a')],_0x1de5dd['query']);_0x508fff[_0x2e06('0x37')]=_[_0x2e06('0x36')](_0x1de5dd['model'],qs[_0x2e06('0x38')](_0x5a749a[_0x2e06('0x34')][_0x2e06('0x38')]));_0x508fff[_0x2e06('0x37')]=_0x508fff[_0x2e06('0x37')]['length']?_0x508fff['attributes']:_0x1de5dd[_0x2e06('0x3a')];if(_0x5a749a[_0x2e06('0x34')][_0x2e06('0x41')]){_0x508fff[_0x2e06('0x46')]=[{'all':!![]}];}_0x508fff=_['merge']({},_0x508fff,_0x5a749a[_0x2e06('0x47')]);return db[_0x2e06('0x31')]['find'](_0x508fff)[_0x2e06('0x19')](handleEntityNotFound(_0x2dcdaa,null))[_0x2e06('0x19')](respondWithResult(_0x2dcdaa,null))['catch'](handleError(_0x2dcdaa,null));};exports['update']=function(_0x342446,_0x2b242b){if(_0x342446[_0x2e06('0x48')]['id']){delete _0x342446[_0x2e06('0x48')]['id'];}return db[_0x2e06('0x31')]['find']({'where':{'id':_0x342446['params']['id']}})['then'](handleEntityNotFound(_0x2b242b,null))[_0x2e06('0x19')](saveUpdates(_0x342446[_0x2e06('0x48')],null))[_0x2e06('0x19')](respondWithResult(_0x2b242b,null))[_0x2e06('0x23')](handleError(_0x2b242b,null));};exports['addLogo']=function(_0x4abc51,_0x56757f,_0xfe7903){if(_0x4abc51[_0x2e06('0x49')]&&_0x4abc51['file'][_0x2e06('0x4a')]){_0x4abc51['body'][_0x2e06('0x4b')]=_0x4abc51[_0x2e06('0x49')][_0x2e06('0x4a')];}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x4abc51[_0x2e06('0x4d')]['id']}})[_0x2e06('0x19')](handleEntityNotFound(_0x56757f,null))[_0x2e06('0x19')](saveUpdates(_0x4abc51['body'],null))[_0x2e06('0x19')](respondWithResult(_0x56757f,null))[_0x2e06('0x23')](handleError(_0x56757f,null));};exports['addLogoLogin']=function(_0x44ae67,_0x52448a,_0xb25fec){if(_0x44ae67[_0x2e06('0x49')]&&_0x44ae67[_0x2e06('0x49')][_0x2e06('0x4a')]){_0x44ae67[_0x2e06('0x48')]['loginLogo']=_0x44ae67['file'][_0x2e06('0x4a')];}return db['Setting'][_0x2e06('0x4c')]({'where':{'id':_0x44ae67[_0x2e06('0x4d')]['id']}})[_0x2e06('0x19')](handleEntityNotFound(_0x52448a,null))['then'](saveUpdates(_0x44ae67['body'],null))['then'](respondWithResult(_0x52448a,null))['catch'](handleError(_0x52448a,null));};var utilLicense=require(_0x2e06('0x15'));exports[_0x2e06('0x4e')]=function(_0x240a00,_0x4e155f,_0xdcc1fa){var _0x56fcc0=_0x2e06('0x4f');var _0x1c278e={'custom':![]};return utilLicense[_0x2e06('0x50')]()[_0x2e06('0x19')](function(_0x520231){if(_0x520231){_0x1c278e=_0x520231;}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x240a00[_0x2e06('0x4d')]['id']},'attributes':[_0x2e06('0x4b'),_0x2e06('0x51'),_0x2e06('0x52'),_0x2e06('0x53'),_0x2e06('0x54'),_0x2e06('0x55'),'defaultPreferred',_0x2e06('0x56')],'raw':!![]});})[_0x2e06('0x19')](handleEntityNotFound(_0x4e155f,null))['then'](function(_0x3c17d5){if(_0x3c17d5){var _0x2cac99=_0x3c17d5[_0x2e06('0x4b')]&&fs[_0x2e06('0x57')](path['join'](config[_0x2e06('0x58')],_0x56fcc0,_['toLower'](_0x3c17d5[_0x2e06('0x4b')])))?path[_0x2e06('0x59')](config['root'],_0x56fcc0,_[_0x2e06('0x5a')](_0x3c17d5[_0x2e06('0x4b')])):path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x56fcc0,_['toLower']('default_logo.svg'));var _0x3fb063='default'+_[_0x2e06('0x5b')](_0x2e06('0x4b'));if(_0x3c17d5[_0x3fb063]||!_0x1c278e['custom']){_0x2cac99=path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x56fcc0,_['toLower']('default_logo.svg'));}if(!fs[_0x2e06('0x57')](_0x2cac99)){throw new db['Sequelize'][(_0x2e06('0x5c'))](_[_0x2e06('0x5b')](_0x2e06('0x4b'))+_0x2e06('0x5d'));}return _0x4e155f[_0x2e06('0x5e')](_0x2cac99);}})[_0x2e06('0x23')](handleError(_0x4e155f,null));};var utilLicense=require(_0x2e06('0x15'));exports[_0x2e06('0x5f')]=function(_0x11d138,_0x46e269,_0x2dd1f2){var _0x1d7e5c=_0x2e06('0x4f');var _0x58acbc={'custom':![]};return utilLicense[_0x2e06('0x50')]()[_0x2e06('0x19')](function(_0x28304a){if(_0x28304a){_0x58acbc=_0x28304a;}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x11d138[_0x2e06('0x4d')]['id']},'attributes':['logo','loginLogo','preferred','favicon',_0x2e06('0x54'),_0x2e06('0x55'),_0x2e06('0x60'),_0x2e06('0x56')],'raw':!![]});})[_0x2e06('0x19')](handleEntityNotFound(_0x46e269,null))[_0x2e06('0x19')](function(_0x198a86){if(_0x198a86){var _0x4198d0=_0x198a86[_0x2e06('0x51')]&&fs[_0x2e06('0x57')](path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x1d7e5c,_['toLower'](_0x198a86[_0x2e06('0x51')])))?path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x1d7e5c,_[_0x2e06('0x5a')](_0x198a86[_0x2e06('0x51')])):path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x1d7e5c,_[_0x2e06('0x5a')](_0x2e06('0x61')));var _0x3aef3f=_0x2e06('0x62')+_[_0x2e06('0x5b')](_0x2e06('0x51'));if(_0x198a86[_0x3aef3f]||!_0x58acbc['custom']){_0x4198d0=path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x1d7e5c,_[_0x2e06('0x5a')](_0x2e06('0x61')));}if(!fs[_0x2e06('0x57')](_0x4198d0)){throw new db[(_0x2e06('0x63'))][(_0x2e06('0x5c'))](_[_0x2e06('0x5b')](_0x2e06('0x51'))+'\x20not\x20found');}return _0x46e269['download'](_0x4198d0);}})['catch'](handleError(_0x46e269,null));};exports[_0x2e06('0x64')]=function(_0x23dc3b,_0x23edfb){return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x23dc3b['params']['id']},'attributes':['securePassword']})[_0x2e06('0x19')](respondWithResult(_0x23edfb,null))['catch'](handleError(_0x23edfb,null));};exports['addPreferred']=function(_0x429ab2,_0x23c9c1,_0x48901d){if(_0x429ab2[_0x2e06('0x49')]&&_0x429ab2['file'][_0x2e06('0x4a')]){_0x429ab2[_0x2e06('0x48')][_0x2e06('0x52')]=_0x429ab2[_0x2e06('0x49')]['filename'];}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x429ab2[_0x2e06('0x4d')]['id']}})[_0x2e06('0x19')](handleEntityNotFound(_0x23c9c1,null))['then'](saveUpdates(_0x429ab2[_0x2e06('0x48')],null))['then'](respondWithResult(_0x23c9c1,null))['catch'](handleError(_0x23c9c1,null));};var utilLicense=require(_0x2e06('0x15'));exports['getPreferred']=function(_0x5ac6c1,_0x1a7bc2,_0x216e2e){var _0x764ba0=_0x2e06('0x4f');var _0x5606d3={'custom':![]};return utilLicense[_0x2e06('0x50')]()[_0x2e06('0x19')](function(_0x346cda){if(_0x346cda){_0x5606d3=_0x346cda;}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x5ac6c1[_0x2e06('0x4d')]['id']},'attributes':[_0x2e06('0x4b'),_0x2e06('0x51'),_0x2e06('0x52'),_0x2e06('0x53'),_0x2e06('0x54'),_0x2e06('0x55'),_0x2e06('0x60'),_0x2e06('0x56')],'raw':!![]});})[_0x2e06('0x19')](handleEntityNotFound(_0x1a7bc2,null))[_0x2e06('0x19')](function(_0x2d3a6b){if(_0x2d3a6b){var _0x41d705=_0x2d3a6b[_0x2e06('0x52')]&&fs[_0x2e06('0x57')](path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x764ba0,_['toLower'](_0x2d3a6b[_0x2e06('0x52')])))?path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x764ba0,_['toLower'](_0x2d3a6b[_0x2e06('0x52')])):path['join'](config['root'],_0x764ba0,_[_0x2e06('0x5a')](_0x2e06('0x65')));var _0x5a0d9d=_0x2e06('0x62')+_[_0x2e06('0x5b')](_0x2e06('0x52'));if(_0x2d3a6b[_0x5a0d9d]||!_0x5606d3[_0x2e06('0x66')]||!_0x5606d3['preferred']){_0x41d705=path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x764ba0,_[_0x2e06('0x5a')](_0x2e06('0x65')));}if(!fs[_0x2e06('0x57')](_0x41d705)){throw new db['Sequelize'][(_0x2e06('0x5c'))](_[_0x2e06('0x5b')](_0x2e06('0x52'))+_0x2e06('0x5d'));}return _0x1a7bc2[_0x2e06('0x5e')](_0x41d705);}})[_0x2e06('0x23')](handleError(_0x1a7bc2,null));};exports[_0x2e06('0x67')]=function(_0x136bd0,_0xd49423,_0x2de795){if(_0x136bd0['file']&&_0x136bd0[_0x2e06('0x49')][_0x2e06('0x4a')]){_0x136bd0[_0x2e06('0x48')][_0x2e06('0x53')]=_0x136bd0[_0x2e06('0x49')]['filename'];}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x136bd0['params']['id']}})[_0x2e06('0x19')](handleEntityNotFound(_0xd49423,null))[_0x2e06('0x19')](saveUpdates(_0x136bd0[_0x2e06('0x48')],null))['then'](respondWithResult(_0xd49423,null))[_0x2e06('0x23')](handleError(_0xd49423,null));};var utilLicense=require(_0x2e06('0x15'));exports['getFavicon']=function(_0x433701,_0x121ec4,_0x1e1b80){var _0x4c3605=_0x2e06('0x4f');var _0x15f0b5={'custom':![]};return utilLicense[_0x2e06('0x50')]()[_0x2e06('0x19')](function(_0x535aca){if(_0x535aca){_0x15f0b5=_0x535aca;}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x433701[_0x2e06('0x4d')]['id']},'attributes':[_0x2e06('0x4b'),_0x2e06('0x51'),_0x2e06('0x52'),_0x2e06('0x53'),_0x2e06('0x54'),_0x2e06('0x55'),_0x2e06('0x60'),_0x2e06('0x56')],'raw':!![]});})[_0x2e06('0x19')](handleEntityNotFound(_0x121ec4,null))[_0x2e06('0x19')](function(_0x5f0c4a){if(_0x5f0c4a){var _0x2b513e=_0x5f0c4a['favicon']&&fs['existsSync'](path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x4c3605,_[_0x2e06('0x5a')](_0x5f0c4a[_0x2e06('0x53')])))?path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x4c3605,_[_0x2e06('0x5a')](_0x5f0c4a[_0x2e06('0x53')])):path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x4c3605,_[_0x2e06('0x5a')]('default_favicon.ico'));var _0x8947a4=_0x2e06('0x62')+_[_0x2e06('0x5b')](_0x2e06('0x53'));if(_0x5f0c4a[_0x8947a4]||!_0x15f0b5['custom']){_0x2b513e=path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x4c3605,_['toLower'](_0x2e06('0x68')));}if(!fs[_0x2e06('0x57')](_0x2b513e)){throw new db['Sequelize'][(_0x2e06('0x5c'))](_[_0x2e06('0x5b')](_0x2e06('0x53'))+_0x2e06('0x5d'));}return _0x121ec4[_0x2e06('0x5e')](_0x2b513e);}})['catch'](handleError(_0x121ec4,null));};exports[_0x2e06('0x69')]=function(_0x321528,_0x90ce4){var _0xb7ba5={'offset':moment()['utcOffset']()};_0xb7ba5[_0x2e06('0x6a')]=moment()[_0x2e06('0x6b')](_0xb7ba5[_0x2e06('0x27')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x90ce4[_0x2e06('0x25')](0xc8)[_0x2e06('0x6c')](_0xb7ba5);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index bd87547..353ec00 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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x55ca,0x126));var _0xa55c=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x55ca[_0x5c6244];return _0x5800ce;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x16c467,_0x53d6fa){var _0x22db4f=function(_0x498d3f){while(--_0x498d3f){_0x16c467['push'](_0x16c467['shift']());}};_0x22db4f(++_0x53d6fa);}(_0x3e74,0x175));var _0x43e7=function(_0x1f1f30,_0x4b3040){_0x1f1f30=_0x1f1f30-0x0;var _0x27442f=_0x3e74[_0x1f1f30];return _0x27442f;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 2897d91..c0be38f 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 _0x4f46=['raw','where','include','map','model','attributes','then','ShowSetting','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Setting','find','options'];(function(_0x14241c,_0x513878){var _0x50d4d7=function(_0x256d3f){while(--_0x256d3f){_0x14241c['push'](_0x14241c['shift']());}};_0x50d4d7(++_0x513878);}(_0x4f46,0x174));var _0x64f4=function(_0x211de7,_0x2e6f69){_0x211de7=_0x211de7-0x0;var _0x2b29e0=_0x4f46[_0x211de7];return _0x2b29e0;};'use strict';var _=require(_0x64f4('0x0'));var util=require('util');var moment=require(_0x64f4('0x1'));var BPromise=require(_0x64f4('0x2'));var rs=require(_0x64f4('0x3'));var fs=require('fs');var Redis=require(_0x64f4('0x4'));var db=require(_0x64f4('0x5'))['db'];var utils=require(_0x64f4('0x6'));var logger=require(_0x64f4('0x7'))('rpc');var config=require(_0x64f4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x64f4('0x9')][_0x64f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4075ff,_0x1189ba,_0x33ec3b){return new BPromise(function(_0x1d6d37,_0x1be2df){return client['request'](_0x4075ff,_0x33ec3b)['then'](function(_0x2ce711){logger[_0x64f4('0xb')](_0x64f4('0xc'),_0x1189ba,_0x64f4('0xd'));logger[_0x64f4('0xe')](_0x64f4('0xf'),_0x1189ba,_0x64f4('0xd'),JSON[_0x64f4('0x10')](_0x2ce711));if(_0x2ce711[_0x64f4('0x11')]){if(_0x2ce711['error'][_0x64f4('0x12')]===0x1f4){logger[_0x64f4('0x11')]('Setting,\x20%s,\x20%s',_0x1189ba,_0x2ce711['error'][_0x64f4('0x13')]);return _0x1be2df(_0x2ce711[_0x64f4('0x11')][_0x64f4('0x13')]);}logger[_0x64f4('0x11')](_0x64f4('0xc'),_0x1189ba,_0x2ce711[_0x64f4('0x11')]['message']);return _0x1d6d37(_0x2ce711[_0x64f4('0x11')][_0x64f4('0x13')]);}else{logger[_0x64f4('0xb')](_0x64f4('0xc'),_0x1189ba,_0x64f4('0xd'));_0x1d6d37(_0x2ce711[_0x64f4('0x14')][_0x64f4('0x13')]);}})['catch'](function(_0x3f929d){logger['error'](_0x64f4('0xc'),_0x1189ba,_0x3f929d);_0x1be2df(_0x3f929d);});});}exports['ShowSetting']=function(_0x4a4d94){var _0x269534=this;return new Promise(function(_0x260866,_0x591ff3){return db[_0x64f4('0x15')][_0x64f4('0x16')]({'raw':_0x4a4d94[_0x64f4('0x17')]?_0x4a4d94[_0x64f4('0x17')][_0x64f4('0x18')]===undefined?!![]:![]:!![],'where':_0x4a4d94['options']?_0x4a4d94['options'][_0x64f4('0x19')]||null:null,'attributes':_0x4a4d94[_0x64f4('0x17')]?_0x4a4d94[_0x64f4('0x17')]['attributes']||null:null,'include':_0x4a4d94[_0x64f4('0x17')]?_0x4a4d94[_0x64f4('0x17')][_0x64f4('0x1a')]?_[_0x64f4('0x1b')](_0x4a4d94[_0x64f4('0x17')][_0x64f4('0x1a')],function(_0x5e7018){return{'model':db[_0x5e7018[_0x64f4('0x1c')]],'as':_0x5e7018['as'],'attributes':_0x5e7018[_0x64f4('0x1d')],'include':_0x5e7018['include']?_['map'](_0x5e7018['include'],function(_0x4551e1){return{'model':db[_0x4551e1['model']],'as':_0x4551e1['as'],'attributes':_0x4551e1['attributes'],'include':_0x4551e1['include']?_[_0x64f4('0x1b')](_0x4551e1[_0x64f4('0x1a')],function(_0xc202ac){return{'model':db[_0xc202ac[_0x64f4('0x1c')]],'as':_0xc202ac['as'],'attributes':_0xc202ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x64f4('0x1e')](function(_0x744cf6){logger[_0x64f4('0xb')](_0x64f4('0x1f'),_0x4a4d94);logger[_0x64f4('0xe')](_0x64f4('0x1f'),_0x4a4d94,JSON[_0x64f4('0x10')](_0x744cf6));_0x260866(_0x744cf6);})[_0x64f4('0x20')](function(_0x10d2de){logger['error']('ShowSetting',_0x10d2de[_0x64f4('0x13')],_0x4a4d94);_0x591ff3(_0x269534['error'](0x1f4,_0x10d2de[_0x64f4('0x13')]));});});}; \ No newline at end of file +var _0x541b=['find','options','where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting'];(function(_0x42dcf2,_0x1a30d0){var _0x591566=function(_0x235c7c){while(--_0x235c7c){_0x42dcf2['push'](_0x42dcf2['shift']());}};_0x591566(++_0x1a30d0);}(_0x541b,0xce));var _0xb541=function(_0x1ff085,_0xa5d361){_0x1ff085=_0x1ff085-0x0;var _0x229856=_0x541b[_0x1ff085];return _0x229856;};'use strict';var _=require(_0xb541('0x0'));var util=require(_0xb541('0x1'));var moment=require(_0xb541('0x2'));var BPromise=require(_0xb541('0x3'));var rs=require(_0xb541('0x4'));var fs=require('fs');var Redis=require(_0xb541('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb541('0x6'));var logger=require('../../config/logger')(_0xb541('0x7'));var config=require(_0xb541('0x8'));var jayson=require(_0xb541('0x9'));var client=jayson[_0xb541('0xa')][_0xb541('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d9f28,_0x2ed1cf,_0x1d3775){return new BPromise(function(_0xb3190a,_0x2b8d19){return client[_0xb541('0xc')](_0x4d9f28,_0x1d3775)['then'](function(_0x381f42){logger[_0xb541('0xd')](_0xb541('0xe'),_0x2ed1cf,_0xb541('0xf'));logger[_0xb541('0x10')](_0xb541('0x11'),_0x2ed1cf,_0xb541('0xf'),JSON[_0xb541('0x12')](_0x381f42));if(_0x381f42[_0xb541('0x13')]){if(_0x381f42['error'][_0xb541('0x14')]===0x1f4){logger[_0xb541('0x13')](_0xb541('0xe'),_0x2ed1cf,_0x381f42[_0xb541('0x13')][_0xb541('0x15')]);return _0x2b8d19(_0x381f42[_0xb541('0x13')][_0xb541('0x15')]);}logger['error'](_0xb541('0xe'),_0x2ed1cf,_0x381f42[_0xb541('0x13')][_0xb541('0x15')]);return _0xb3190a(_0x381f42[_0xb541('0x13')][_0xb541('0x15')]);}else{logger[_0xb541('0xd')](_0xb541('0xe'),_0x2ed1cf,_0xb541('0xf'));_0xb3190a(_0x381f42[_0xb541('0x16')][_0xb541('0x15')]);}})[_0xb541('0x17')](function(_0x3bfe44){logger[_0xb541('0x13')]('Setting,\x20%s,\x20%s',_0x2ed1cf,_0x3bfe44);_0x2b8d19(_0x3bfe44);});});}exports[_0xb541('0x18')]=function(_0x1494a2){var _0x2f64b2=this;return new Promise(function(_0x1734e2,_0x1615b6){return db['Setting'][_0xb541('0x19')]({'raw':_0x1494a2[_0xb541('0x1a')]?_0x1494a2[_0xb541('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1494a2[_0xb541('0x1a')]?_0x1494a2[_0xb541('0x1a')][_0xb541('0x1b')]||null:null,'attributes':_0x1494a2['options']?_0x1494a2[_0xb541('0x1a')][_0xb541('0x1c')]||null:null,'include':_0x1494a2[_0xb541('0x1a')]?_0x1494a2['options'][_0xb541('0x1d')]?_[_0xb541('0x1e')](_0x1494a2[_0xb541('0x1a')]['include'],function(_0x31a82e){return{'model':db[_0x31a82e[_0xb541('0x1f')]],'as':_0x31a82e['as'],'attributes':_0x31a82e[_0xb541('0x1c')],'include':_0x31a82e[_0xb541('0x1d')]?_['map'](_0x31a82e['include'],function(_0x1b1aec){return{'model':db[_0x1b1aec[_0xb541('0x1f')]],'as':_0x1b1aec['as'],'attributes':_0x1b1aec['attributes'],'include':_0x1b1aec[_0xb541('0x1d')]?_['map'](_0x1b1aec[_0xb541('0x1d')],function(_0x15096a){return{'model':db[_0x15096a[_0xb541('0x1f')]],'as':_0x15096a['as'],'attributes':_0x15096a['attributes']};}):[]};}):[]};}):[]:[]})[_0xb541('0x20')](function(_0xb461a9){logger[_0xb541('0xd')](_0xb541('0x18'),_0x1494a2);logger[_0xb541('0x10')](_0xb541('0x18'),_0x1494a2,JSON['stringify'](_0xb461a9));_0x1734e2(_0xb461a9);})[_0xb541('0x17')](function(_0x476484){logger[_0xb541('0x13')]('ShowSetting',_0x476484['message'],_0x1494a2);_0x1615b6(_0x2f64b2[_0xb541('0x13')](0x1f4,_0x476484[_0xb541('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8d396c3..9664f65 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(_0x2e9be4,_0x463bf6){var _0x22cb76=function(_0x185fab){while(--_0x185fab){_0x2e9be4['push'](_0x2e9be4['shift']());}};_0x22cb76(++_0x463bf6);}(_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 +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x49f13f,_0x4d335f){var _0x235aa0=function(_0x19f4b6){while(--_0x19f4b6){_0x49f13f['push'](_0x49f13f['shift']());}};_0x235aa0(++_0x4d335f);}(_0x7a54,0x106));var _0x47a5=function(_0x3dac0f,_0x45393a){_0x3dac0f=_0x3dac0f-0x0;var _0x302790=_0x7a54[_0x3dac0f];return _0x302790;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 38154d8..8dca515 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 _0xa038=['bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','STRING','generate','ENUM','twilio','skebby','connectel','clickatell'];(function(_0x25996d,_0x5b282e){var _0x12d802=function(_0x34fe7b){while(--_0x34fe7b){_0x25996d['push'](_0x25996d['shift']());}};_0x12d802(++_0x5b282e);}(_0xa038,0x83));var _0x8a03=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xa038[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x8a03('0x0'));var rs=require(_0x8a03('0x1'));module['exports']={'name':{'type':Sequelize[_0x8a03('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x8a03('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8a03('0x3')]();}},'phone':{'type':Sequelize[_0x8a03('0x2')]},'type':{'type':Sequelize[_0x8a03('0x4')](_0x8a03('0x5'),_0x8a03('0x6'),_0x8a03('0x7'),'clicksend','plivo',_0x8a03('0x8'),_0x8a03('0x9'),_0x8a03('0xa'),_0x8a03('0xb'),_0x8a03('0xc'))},'accountSid':{'type':Sequelize[_0x8a03('0x2')]},'authId':{'type':Sequelize[_0x8a03('0x2')]},'authToken':{'type':Sequelize[_0x8a03('0x2')]},'smsMethod':{'type':Sequelize[_0x8a03('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8a03('0x2')]},'password':{'type':Sequelize[_0x8a03('0x2')]},'apiKey':{'type':Sequelize[_0x8a03('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x8a03('0x2')]},'senderString':{'type':Sequelize[_0x8a03('0x2')]},'deliveryReport':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x8a03('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8a03('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8a03('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8a03('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8a03('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8a03('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8a03('0xf')],'comment':_0x8a03('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':![],'comment':_0x8a03('0x11'),'set':function(_0x16e2ea){if(!_0x16e2ea)this['setDataValue'](_0x8a03('0x12'),null);this[_0x8a03('0x13')]('mandatoryDisposition',_0x16e2ea);}}}; \ No newline at end of file +var _0xcad4=['twilio','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','STRING','generate'];(function(_0x346610,_0x33bf69){var _0x55f160=function(_0x42bf5a){while(--_0x42bf5a){_0x346610['push'](_0x346610['shift']());}};_0x55f160(++_0x33bf69);}(_0xcad4,0x75));var _0x4cad=function(_0x3a7458,_0x131630){_0x3a7458=_0x3a7458-0x0;var _0x2778c5=_0xcad4[_0x3a7458];return _0x2778c5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x4cad('0x0'));module['exports']={'name':{'type':Sequelize[_0x4cad('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x4cad('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x4cad('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x4cad('0x1')],'defaultValue':function(){return rs[_0x4cad('0x2')]();}},'phone':{'type':Sequelize[_0x4cad('0x1')]},'type':{'type':Sequelize['ENUM'](_0x4cad('0x3'),'skebby','connectel',_0x4cad('0x4'),_0x4cad('0x5'),_0x4cad('0x6'),_0x4cad('0x7'),_0x4cad('0x8'),'infobip',_0x4cad('0x9'))},'accountSid':{'type':Sequelize[_0x4cad('0x1')]},'authId':{'type':Sequelize[_0x4cad('0x1')]},'authToken':{'type':Sequelize[_0x4cad('0x1')]},'smsMethod':{'type':Sequelize[_0x4cad('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0x4cad('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x4cad('0x1')]},'applicationId':{'type':Sequelize[_0x4cad('0x1')]},'accountId':{'type':Sequelize[_0x4cad('0x1')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x4cad('0x1')]},'notificationTemplate':{'type':Sequelize[_0x4cad('0xb')],'defaultValue':function(){return _0x4cad('0xc');}},'notificationSound':{'type':Sequelize[_0x4cad('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4cad('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4cad('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4cad('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4cad('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4cad('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4cad('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4cad('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4cad('0xe')],'comment':_0x4cad('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x4cad('0xd')],'defaultValue':![],'comment':_0x4cad('0x10'),'set':function(_0x5d9e87){if(!_0x5d9e87)this['setDataValue'](_0x4cad('0x11'),null);this[_0x4cad('0x12')](_0x4cad('0x13'),_0x5d9e87);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index fb04c4d..b908043 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 _0x11dc=['notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','messageId','MessageSid','skebby','sender','text','clicksend','message_id','plivo','From','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','Tags','color','tag','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','connectel','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','describe','SmsAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','findOne','nolimit','order','removeAnswers'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x11dc,0x78));var _0xc11d=function(_0x5b174b,_0x404869){_0x5b174b=_0x5b174b-0x0;var _0x47ee37=_0x11dc[_0x5b174b];return _0x47ee37;};'use strict';var emlformat=require(_0xc11d('0x0'));var rimraf=require(_0xc11d('0x1'));var zipdir=require(_0xc11d('0x2'));var jsonpatch=require(_0xc11d('0x3'));var rp=require(_0xc11d('0x4'));var moment=require(_0xc11d('0x5'));var BPromise=require(_0xc11d('0x6'));var Mustache=require(_0xc11d('0x7'));var util=require(_0xc11d('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc11d('0x9'));var ejs=require(_0xc11d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc11d('0xb'));var squel=require('squel');var crypto=require(_0xc11d('0xc'));var jsforce=require(_0xc11d('0xd'));var deskjs=require(_0xc11d('0xe'));var toCsv=require(_0xc11d('0x9'));var querystring=require(_0xc11d('0xf'));var Papa=require(_0xc11d('0x10'));var Redis=require('ioredis');var authService=require(_0xc11d('0x11'));var qs=require(_0xc11d('0x12'));var as=require(_0xc11d('0x13'));var hardwareService=require(_0xc11d('0x14'));var logger=require(_0xc11d('0x15'))(_0xc11d('0x16'));var utils=require(_0xc11d('0x17'));var config=require(_0xc11d('0x18'));var licenseUtil=require(_0xc11d('0x19'));var db=require(_0xc11d('0x1a'))['db'];config['redis']=_['defaults'](config[_0xc11d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xc11d('0x1c'))(new Redis(config[_0xc11d('0x1b')]));require(_0xc11d('0x1d'))[_0xc11d('0x1e')](socket);var jayson=require(_0xc11d('0x1f'));var client=jayson[_0xc11d('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4f09d1,_0x5e8503,_0x29b589,_0x17a35d){return new BPromise(function(_0x44e139,_0x4ac0c4){var _0x2e8396=_0x17a35d||client;return _0x2e8396[_0xc11d('0x21')](_0x4f09d1,_0x29b589)[_0xc11d('0x22')](function(_0x5f3352){logger[_0xc11d('0x23')](_0xc11d('0x24'),_0x5e8503,_0xc11d('0x25'));logger[_0xc11d('0x26')](_0xc11d('0x27'),_0x5e8503,_0xc11d('0x25'),JSON[_0xc11d('0x28')](_0x5f3352));if(_0x5f3352[_0xc11d('0x29')]){if(_0x5f3352['error'][_0xc11d('0x2a')]===0x1f4){logger['error'](_0xc11d('0x24'),_0x5e8503,_0x5f3352['error'][_0xc11d('0x2b')]);return _0x4ac0c4(_0x5f3352['error'][_0xc11d('0x2b')]);}logger[_0xc11d('0x29')](_0xc11d('0x24'),_0x5e8503,_0x5f3352[_0xc11d('0x29')][_0xc11d('0x2b')]);return _0x44e139(_0x5f3352[_0xc11d('0x29')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x5e8503,_0xc11d('0x25'));_0x44e139(_0x5f3352[_0xc11d('0x2c')][_0xc11d('0x2b')]);}})['catch'](function(_0x1c174c){logger[_0xc11d('0x29')](_0xc11d('0x24'),_0x5e8503,_0x1c174c);_0x4ac0c4(_0x1c174c);});});}function respondWithStatusCode(_0x3e30c7,_0x16c37c){_0x16c37c=_0x16c37c||0xcc;return function(_0x4c91b0){if(_0x4c91b0){return _0x3e30c7['sendStatus'](_0x16c37c);}return _0x3e30c7['status'](_0x16c37c)[_0xc11d('0x2d')]();};}function respondWithResult(_0xbe93d5,_0x4b6314){_0x4b6314=_0x4b6314||0xc8;return function(_0x2e9465){if(_0x2e9465){return _0xbe93d5[_0xc11d('0x2e')](_0x4b6314)[_0xc11d('0x2f')](_0x2e9465);}};}function respondWithFilteredResult(_0x5e6c25,_0x2ec4fe){return function(_0x5d8e65){if(_0x5d8e65){var _0x130a00=typeof _0x2ec4fe[_0xc11d('0x30')]==='undefined'&&typeof _0x2ec4fe[_0xc11d('0x31')]===_0xc11d('0x32');var _0x398206=_0x5d8e65[_0xc11d('0x33')];var _0x2a28e6=_0x130a00?0x0:_0x2ec4fe[_0xc11d('0x30')];var _0x41aada=_0x130a00?_0x5d8e65[_0xc11d('0x33')]:_0x2ec4fe[_0xc11d('0x30')]+_0x2ec4fe[_0xc11d('0x31')];var _0xae1aa;if(_0x41aada>=_0x398206){_0x41aada=_0x398206;_0xae1aa=0xc8;}else{_0xae1aa=0xce;}_0x5e6c25[_0xc11d('0x2e')](_0xae1aa);return _0x5e6c25[_0xc11d('0x34')](_0xc11d('0x35'),_0x2a28e6+'-'+_0x41aada+'/'+_0x398206)['json'](_0x5d8e65);}return null;};}function patchUpdates(_0x4d9ef6){return function(_0x3caae6){try{jsonpatch[_0xc11d('0x36')](_0x3caae6,_0x4d9ef6,!![]);}catch(_0xd5691c){return BPromise['reject'](_0xd5691c);}return _0x3caae6['save']();};}function saveUpdates(_0x35c1c1,_0x294b4b){return function(_0x4c12b1){if(_0x4c12b1){return _0x4c12b1[_0xc11d('0x37')](_0x35c1c1)[_0xc11d('0x22')](function(_0x4f63be){return _0x4f63be;});}return null;};}function removeEntity(_0x1f80ca,_0x2e563f){return function(_0x3077d5){if(_0x3077d5){return _0x3077d5[_0xc11d('0x38')]()['then'](function(){var _0x3bd3b2=_0x3077d5[_0xc11d('0x39')]({'plain':!![]});var _0x873469=_0xc11d('0x3a');return db[_0xc11d('0x3b')]['destroy']({'where':{'type':_0x873469,'resourceId':_0x3bd3b2['id']}})[_0xc11d('0x22')](function(){return _0x3077d5;});})[_0xc11d('0x22')](function(){_0x1f80ca[_0xc11d('0x2e')](0xcc)[_0xc11d('0x2d')]();});}};}function handleEntityNotFound(_0x40c223,_0x13a55e){return function(_0x192051){if(!_0x192051){_0x40c223[_0xc11d('0x3c')](0x194);}return _0x192051;};}function handleError(_0xecda2c,_0x4471b8){_0x4471b8=_0x4471b8||0x1f4;return function(_0x2c8739){logger[_0xc11d('0x29')](_0x2c8739[_0xc11d('0x3d')]);if(_0x2c8739[_0xc11d('0x3e')]){delete _0x2c8739['name'];}_0xecda2c[_0xc11d('0x2e')](_0x4471b8)[_0xc11d('0x3f')](_0x2c8739);};}exports[_0xc11d('0x40')]=function(_0x56fe84,_0x35572d){var _0x455258={'include':[{'model':db[_0xc11d('0x41')],'as':_0xc11d('0x42')}]},_0x47dae5={},_0x26e51b={'count':0x0,'rows':[]};var _0x5120d7=_['map'](db[_0xc11d('0x43')][_0xc11d('0x44')],function(_0x325769){return{'name':_0x325769[_0xc11d('0x45')],'type':_0x325769[_0xc11d('0x46')]['key']};});_0x47dae5['model']=_[_0xc11d('0x47')](_0x5120d7,'name');_0x47dae5[_0xc11d('0x48')]=_['keys'](_0x56fe84[_0xc11d('0x48')]);_0x47dae5[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x47dae5[_0xc11d('0x4b')],_0x47dae5[_0xc11d('0x48')]);_0x455258[_0xc11d('0x4c')]=_[_0xc11d('0x4a')](_0x47dae5['model'],qs[_0xc11d('0x4d')](_0x56fe84[_0xc11d('0x48')]['fields']));_0x455258[_0xc11d('0x4c')]=_0x455258[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0x455258['attributes']:_0x47dae5[_0xc11d('0x4b')];if(!_0x56fe84['query'][_0xc11d('0x4f')]('nolimit')){_0x455258['limit']=qs['limit'](_0x56fe84['query'][_0xc11d('0x31')]);_0x455258[_0xc11d('0x30')]=qs[_0xc11d('0x30')](_0x56fe84[_0xc11d('0x48')][_0xc11d('0x30')]);}_0x455258['order']=qs[_0xc11d('0x50')](_0x56fe84['query'][_0xc11d('0x50')]);_0x455258[_0xc11d('0x51')]=qs[_0xc11d('0x49')](_[_0xc11d('0x52')](_0x56fe84[_0xc11d('0x48')],_0x47dae5[_0xc11d('0x49')]),_0x5120d7);if(_0x56fe84[_0xc11d('0x48')][_0xc11d('0x53')]){_0x455258[_0xc11d('0x51')]=_[_0xc11d('0x54')](_0x455258[_0xc11d('0x51')],{'$or':_[_0xc11d('0x47')](_0x5120d7,function(_0x31f435){if(_0x31f435['type']!=='VIRTUAL'){var _0x35c7a6={};_0x35c7a6[_0x31f435['name']]={'$like':'%'+_0x56fe84[_0xc11d('0x48')]['filter']+'%'};return _0x35c7a6;}})});}_0x455258=_[_0xc11d('0x54')]({},_0x455258,_0x56fe84[_0xc11d('0x55')]);var _0x3f4201={'where':_0x455258[_0xc11d('0x51')]};return db[_0xc11d('0x43')][_0xc11d('0x33')](_0x3f4201)['then'](function(_0x1d758b){_0x26e51b['count']=_0x1d758b;if(_0x56fe84['query'][_0xc11d('0x56')]){_0x455258[_0xc11d('0x57')]=[{'all':!![]}];}return db[_0xc11d('0x43')][_0xc11d('0x58')](_0x455258);})[_0xc11d('0x22')](function(_0x57ee73){_0x26e51b[_0xc11d('0x59')]=_0x57ee73;return _0x26e51b;})['then'](respondWithFilteredResult(_0x35572d,_0x455258))[_0xc11d('0x5a')](handleError(_0x35572d,null));};exports[_0xc11d('0x5b')]=function(_0x242680,_0x35f40c){var _0x3f7ffd={'raw':![],'where':{'id':_0x242680[_0xc11d('0x5c')]['id']},'include':[{'model':db[_0xc11d('0x41')],'as':'mandatoryDispositionPause'}]},_0x4a7e4c={};_0x4a7e4c[_0xc11d('0x4b')]=_[_0xc11d('0x5d')](db[_0xc11d('0x43')][_0xc11d('0x44')]);_0x4a7e4c[_0xc11d('0x48')]=_[_0xc11d('0x5d')](_0x242680[_0xc11d('0x48')]);_0x4a7e4c[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x4a7e4c[_0xc11d('0x4b')],_0x4a7e4c[_0xc11d('0x48')]);_0x3f7ffd[_0xc11d('0x4c')]=_[_0xc11d('0x4a')](_0x4a7e4c[_0xc11d('0x4b')],qs['fields'](_0x242680[_0xc11d('0x48')][_0xc11d('0x4d')]));_0x3f7ffd[_0xc11d('0x4c')]=_0x3f7ffd[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0x3f7ffd['attributes']:_0x4a7e4c[_0xc11d('0x4b')];if(_0x242680[_0xc11d('0x48')][_0xc11d('0x56')]){_0x3f7ffd[_0xc11d('0x57')]=[{'all':!![]}];}_0x3f7ffd=_[_0xc11d('0x54')]({},_0x3f7ffd,_0x242680[_0xc11d('0x55')]);return db[_0xc11d('0x43')][_0xc11d('0x5e')](_0x3f7ffd)[_0xc11d('0x22')](handleEntityNotFound(_0x35f40c,null))[_0xc11d('0x22')](respondWithResult(_0x35f40c,null))[_0xc11d('0x5a')](handleError(_0x35f40c,null));};exports[_0xc11d('0x5f')]=function(_0x179d4f,_0x366a31){return db[_0xc11d('0x43')]['create'](_0x179d4f[_0xc11d('0x60')],{})[_0xc11d('0x22')](function(_0x13ad59){var _0x2e3f34=_0x179d4f['user'][_0xc11d('0x39')]({'plain':!![]});if(!_0x2e3f34)throw new Error(_0xc11d('0x61'));if(_0x2e3f34['role']===_0xc11d('0x62')){var _0x4c917f=_0x13ad59[_0xc11d('0x39')]({'plain':!![]});var _0x4eab84=_0xc11d('0x3a');return db[_0xc11d('0x63')][_0xc11d('0x5e')]({'where':{'name':_0x4eab84,'userProfileId':_0x2e3f34[_0xc11d('0x64')]},'raw':!![]})[_0xc11d('0x22')](function(_0x2518a6){if(_0x2518a6&&_0x2518a6[_0xc11d('0x65')]===0x0){return db[_0xc11d('0x3b')]['create']({'name':_0x4c917f[_0xc11d('0x3e')],'resourceId':_0x4c917f['id'],'type':_0x2518a6[_0xc11d('0x3e')],'sectionId':_0x2518a6['id']},{})['then'](function(){return _0x13ad59;});}else{return _0x13ad59;}})[_0xc11d('0x5a')](function(_0x33e366){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33e366);throw _0x33e366;});}return _0x13ad59;})[_0xc11d('0x22')](respondWithResult(_0x366a31,0xc9))[_0xc11d('0x5a')](handleError(_0x366a31,null));};exports[_0xc11d('0x37')]=function(_0x258dbe,_0xdcc603){if(_0x258dbe[_0xc11d('0x60')]['id']){delete _0x258dbe[_0xc11d('0x60')]['id'];}return db[_0xc11d('0x43')][_0xc11d('0x5e')]({'where':{'id':_0x258dbe[_0xc11d('0x5c')]['id']},'include':[{'model':db[_0xc11d('0x41')],'as':_0xc11d('0x42')}]})['then'](handleEntityNotFound(_0xdcc603,null))['then'](saveUpdates(_0x258dbe['body'],null))[_0xc11d('0x22')](respondWithResult(_0xdcc603,null))[_0xc11d('0x5a')](handleError(_0xdcc603,null));};exports[_0xc11d('0x38')]=function(_0x419588,_0x4845c5){return db[_0xc11d('0x43')][_0xc11d('0x5e')]({'where':{'id':_0x419588[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x4845c5,null))[_0xc11d('0x22')](removeEntity(_0x4845c5,null))[_0xc11d('0x5a')](handleError(_0x4845c5,null));};exports[_0xc11d('0x66')]=function(_0x455cb4,_0x53647f){return db[_0xc11d('0x43')][_0xc11d('0x66')]()[_0xc11d('0x22')](respondWithResult(_0x53647f,null))[_0xc11d('0x5a')](handleError(_0x53647f,null));};exports['addDisposition']=function(_0x553b03,_0x2ef895,_0x4cfa5b){if(_0x553b03[_0xc11d('0x60')]['id']){delete _0x553b03[_0xc11d('0x60')]['id'];}return db[_0xc11d('0x43')]['find']({'where':{'id':_0x553b03['params']['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x2ef895,null))['then'](function(_0x176e6f){if(_0x176e6f){_0x553b03[_0xc11d('0x60')][_0xc11d('0x67')]=_0x176e6f['id'];return db[_0xc11d('0x68')][_0xc11d('0x5f')](_0x553b03[_0xc11d('0x60')]);}})[_0xc11d('0x22')](respondWithResult(_0x2ef895,null))['catch'](handleError(_0x2ef895,null));};exports['getDispositions']=function(_0x5ec6e2,_0x1b18ad,_0x129636){var _0x56bb3b={'raw':![],'where':{}};var _0x30480e={};var _0x576c07={'count':0x0,'rows':[]};return db[_0xc11d('0x43')]['findOne']({'where':{'id':_0x5ec6e2['params']['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x1b18ad,null))[_0xc11d('0x22')](function(_0x471744){if(_0x471744){_0x30480e[_0xc11d('0x4b')]=_[_0xc11d('0x5d')](db[_0xc11d('0x68')][_0xc11d('0x44')]);_0x30480e[_0xc11d('0x48')]=_[_0xc11d('0x5d')](_0x5ec6e2[_0xc11d('0x48')]);_0x30480e[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x30480e[_0xc11d('0x4b')],_0x30480e[_0xc11d('0x48')]);_0x56bb3b['attributes']=_[_0xc11d('0x4a')](_0x30480e['model'],qs[_0xc11d('0x4d')](_0x5ec6e2['query'][_0xc11d('0x4d')]));_0x56bb3b[_0xc11d('0x4c')]=_0x56bb3b[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0x56bb3b[_0xc11d('0x4c')]:_0x30480e['model'];if(!_0x5ec6e2[_0xc11d('0x48')][_0xc11d('0x4f')]('nolimit')){_0x56bb3b[_0xc11d('0x31')]=qs[_0xc11d('0x31')](_0x5ec6e2['query'][_0xc11d('0x31')]);_0x56bb3b[_0xc11d('0x30')]=qs['offset'](_0x5ec6e2[_0xc11d('0x48')][_0xc11d('0x30')]);}_0x56bb3b['order']=qs['sort'](_0x5ec6e2['query'][_0xc11d('0x50')]);_0x56bb3b[_0xc11d('0x51')]=qs[_0xc11d('0x49')](_[_0xc11d('0x52')](_0x5ec6e2[_0xc11d('0x48')],_0x30480e[_0xc11d('0x49')]));_0x56bb3b[_0xc11d('0x51')][_0xc11d('0x67')]=_0x471744['id'];if(_0x5ec6e2[_0xc11d('0x48')][_0xc11d('0x53')]){_0x56bb3b[_0xc11d('0x51')]=_[_0xc11d('0x54')](_0x56bb3b[_0xc11d('0x51')],{'$or':_['map'](_0x56bb3b[_0xc11d('0x4c')],function(_0x24c9b4){var _0x346bd4={};_0x346bd4[_0x24c9b4]={'$like':'%'+_0x5ec6e2['query'][_0xc11d('0x53')]+'%'};return _0x346bd4;})});}_0x56bb3b=_[_0xc11d('0x54')]({},_0x56bb3b,_0x5ec6e2[_0xc11d('0x55')]);return db['Disposition'][_0xc11d('0x33')]({'where':_0x56bb3b['where']})['then'](function(_0x1e6e4f){_0x576c07['count']=_0x1e6e4f;if(_0x5ec6e2['query'][_0xc11d('0x56')]){_0x56bb3b[_0xc11d('0x57')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x56bb3b);})[_0xc11d('0x22')](function(_0x2009d0){_0x576c07[_0xc11d('0x59')]=_0x2009d0;return _0x576c07;});}})[_0xc11d('0x22')](respondWithFilteredResult(_0x1b18ad,_0x56bb3b))[_0xc11d('0x5a')](handleError(_0x1b18ad,null));};exports['removeDispositions']=function(_0x3ca4af,_0x5478bb,_0x12d4e2){return db[_0xc11d('0x43')][_0xc11d('0x5e')]({'where':{'id':_0x3ca4af[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x5478bb,null))[_0xc11d('0x22')](function(_0xbda1fe){if(_0xbda1fe){return _0xbda1fe[_0xc11d('0x69')](_0x3ca4af['query'][_0xc11d('0x6a')]);}})[_0xc11d('0x22')](respondWithStatusCode(_0x5478bb,null))[_0xc11d('0x5a')](handleError(_0x5478bb,null));};exports[_0xc11d('0x6b')]=function(_0x504cb3,_0x173119,_0x41d7b6){if(_0x504cb3[_0xc11d('0x60')]['id']){delete _0x504cb3[_0xc11d('0x60')]['id'];}return db[_0xc11d('0x43')]['find']({'where':{'id':_0x504cb3[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x173119,null))['then'](function(_0x1c0ea1){if(_0x1c0ea1){_0x504cb3[_0xc11d('0x60')][_0xc11d('0x67')]=_0x1c0ea1['id'];return db[_0xc11d('0x6c')][_0xc11d('0x5f')](_0x504cb3[_0xc11d('0x60')]);}})[_0xc11d('0x22')](respondWithResult(_0x173119,null))[_0xc11d('0x5a')](handleError(_0x173119,null));};exports['getAnswers']=function(_0x3adb3c,_0x37499a,_0x3928ae){var _0xfc0f6b={'raw':![],'where':{}};var _0x574829={};var _0x5eabec={'count':0x0,'rows':[]};return db[_0xc11d('0x43')][_0xc11d('0x6d')]({'where':{'id':_0x3adb3c[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x37499a,null))[_0xc11d('0x22')](function(_0x223a00){if(_0x223a00){_0x574829['model']=_[_0xc11d('0x5d')](db[_0xc11d('0x6c')][_0xc11d('0x44')]);_0x574829[_0xc11d('0x48')]=_['keys'](_0x3adb3c[_0xc11d('0x48')]);_0x574829[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x574829['model'],_0x574829[_0xc11d('0x48')]);_0xfc0f6b['attributes']=_['intersection'](_0x574829['model'],qs[_0xc11d('0x4d')](_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x4d')]));_0xfc0f6b[_0xc11d('0x4c')]=_0xfc0f6b[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0xfc0f6b[_0xc11d('0x4c')]:_0x574829[_0xc11d('0x4b')];if(!_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x4f')](_0xc11d('0x6e'))){_0xfc0f6b[_0xc11d('0x31')]=qs[_0xc11d('0x31')](_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x31')]);_0xfc0f6b[_0xc11d('0x30')]=qs[_0xc11d('0x30')](_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x30')]);}_0xfc0f6b[_0xc11d('0x6f')]=qs[_0xc11d('0x50')](_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x50')]);_0xfc0f6b[_0xc11d('0x51')]=qs['filters'](_[_0xc11d('0x52')](_0x3adb3c['query'],_0x574829['filters']));_0xfc0f6b[_0xc11d('0x51')][_0xc11d('0x67')]=_0x223a00['id'];if(_0x3adb3c['query']['filter']){_0xfc0f6b[_0xc11d('0x51')]=_[_0xc11d('0x54')](_0xfc0f6b['where'],{'$or':_[_0xc11d('0x47')](_0xfc0f6b[_0xc11d('0x4c')],function(_0x24afac){var _0x483cf9={};_0x483cf9[_0x24afac]={'$like':'%'+_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x53')]+'%'};return _0x483cf9;})});}_0xfc0f6b=_[_0xc11d('0x54')]({},_0xfc0f6b,_0x3adb3c[_0xc11d('0x55')]);return db['CannedAnswer']['count']({'where':_0xfc0f6b[_0xc11d('0x51')]})[_0xc11d('0x22')](function(_0x1a2f64){_0x5eabec[_0xc11d('0x33')]=_0x1a2f64;if(_0x3adb3c[_0xc11d('0x48')]['includeAll']){_0xfc0f6b[_0xc11d('0x57')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xfc0f6b);})[_0xc11d('0x22')](function(_0x169b27){_0x5eabec[_0xc11d('0x59')]=_0x169b27;return _0x5eabec;});}})[_0xc11d('0x22')](respondWithFilteredResult(_0x37499a,_0xfc0f6b))[_0xc11d('0x5a')](handleError(_0x37499a,null));};exports[_0xc11d('0x70')]=function(_0x1a10d0,_0x98822,_0x58c9c6){return db['SmsAccount'][_0xc11d('0x5e')]({'where':{'id':_0x1a10d0['params']['id']}})['then'](handleEntityNotFound(_0x98822,null))[_0xc11d('0x22')](function(_0x405861){if(_0x405861){return _0x405861[_0xc11d('0x70')](_0x1a10d0[_0xc11d('0x48')][_0xc11d('0x6a')]);}})[_0xc11d('0x22')](respondWithStatusCode(_0x98822,null))[_0xc11d('0x5a')](handleError(_0x98822,null));};exports[_0xc11d('0x71')]=function(_0x3dcbfe,_0x5e1b11,_0x3cc7eb){var _0x75d4f9={'channel':_0xc11d('0x72')};var _0x5467da=[];var _0x5bf3f0=[];var _0x351308={};return db[_0xc11d('0x43')][_0xc11d('0x5e')]({'where':{'id':_0x3dcbfe[_0xc11d('0x5c')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xc11d('0x73')}]})[_0xc11d('0x22')](handleEntityNotFound(_0x5e1b11,null))[_0xc11d('0x22')](function(_0x294ca1){_0x75d4f9[_0xc11d('0x74')]=_0x294ca1;_0x75d4f9[_0xc11d('0x75')]=_[_0xc11d('0x76')](_0x294ca1[_0xc11d('0x73')],[_0xc11d('0x77')],[_0xc11d('0x78')]);if(_0x75d4f9[_0xc11d('0x74')]['Applications']){delete _0x75d4f9[_0xc11d('0x74')][_0xc11d('0x73')];}return db[_0xc11d('0x79')][_0xc11d('0x66')]();})[_0xc11d('0x22')](function(_0x1bea8e){if(!_0x1bea8e){throw new db[(_0xc11d('0x7a'))][(_0xc11d('0x7b'))](_0xc11d('0x7c'));}_0x5467da=_[_0xc11d('0x7d')](_['keys'](_0x1bea8e),[_0xc11d('0x7e'),'updatedAt']);_0x5bf3f0=_[_0xc11d('0x7d')](_[_0xc11d('0x5d')](_0x1bea8e),[_0xc11d('0x7e'),_0xc11d('0x7f'),_0xc11d('0x80'),'ListId']);_0x75d4f9[_0xc11d('0x60')]={'mapKey':_0xc11d('0x81')};if(_0x75d4f9[_0xc11d('0x74')]['type']){switch(_0x75d4f9[_0xc11d('0x74')]['type']){case _0xc11d('0x82'):_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]=_0x3dcbfe[_0xc11d('0x60')]['From'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')]['Body'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x84')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x85')];break;case _0xc11d('0x86'):_0x75d4f9[_0xc11d('0x60')]['from']='+'+_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x87')];_0x75d4f9[_0xc11d('0x60')]['body']=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x88')];break;case'connectel':_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]=_0x3dcbfe['body'][_0xc11d('0x83')];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x2b')];break;case _0xc11d('0x89'):_0x75d4f9['body'][_0xc11d('0x83')]=_0x3dcbfe['body']['from'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x60')];_0x75d4f9['body'][_0xc11d('0x84')]=_0x3dcbfe['body'][_0xc11d('0x8a')];break;case _0xc11d('0x8b'):_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x8c')];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe['body']['Text'];_0x75d4f9['body'][_0xc11d('0x84')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x8d')];break;case _0xc11d('0x8e'):_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]='+'+_0x3dcbfe[_0xc11d('0x60')]['results'][0x0][_0xc11d('0x83')];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe['body']['results'][0x0]['text'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x84')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x8f')][0x0]['messageId'];break;case _0xc11d('0x90'):_0x75d4f9[_0xc11d('0x60')]['from']=_0x3dcbfe['body'][_0xc11d('0x91')];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')]['segmentedMessage'][_0xc11d('0x2b')];break;case _0xc11d('0x92'):_0x75d4f9[_0xc11d('0x60')]['from']=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x93')];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')]['text'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x84')]=_0x3dcbfe[_0xc11d('0x60')]['replyMessageId'];break;case _0xc11d('0x94'):_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x84')]=_0x3dcbfe[_0xc11d('0x60')][0x0][_0xc11d('0x2b')]['id'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]=_0x3dcbfe[_0xc11d('0x60')][0x0][_0xc11d('0x2b')]['from'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')][0x0]['message']['text'];break;case _0xc11d('0x95'):_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]=_0x3dcbfe[_0xc11d('0x60')]['from'];_0x75d4f9['body'][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')]['message'];_0x75d4f9['body'][_0xc11d('0x84')]=_0x3dcbfe['body'][_0xc11d('0x96')];break;}}if(_0x75d4f9[_0xc11d('0x60')]['id']){delete _0x75d4f9[_0xc11d('0x60')]['id'];}if(_['isNil'](_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')])){throw new db[(_0xc11d('0x7a'))][(_0xc11d('0x7b'))](_0xc11d('0x97'));}if(_[_0xc11d('0x98')](_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')])||_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]===''){throw new db[(_0xc11d('0x7a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x75d4f9['body'][_0xc11d('0x99')])){throw new db[(_0xc11d('0x7a'))][(_0xc11d('0x7b'))](_0xc11d('0x9a')+_0x5bf3f0);}if(!_['includes'](_0x5bf3f0,_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x99')])){throw new db['Sequelize']['ValidationError'](_0xc11d('0x9b')+_0x5bf3f0);}_0x351308[_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x99')]]=_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')];return db['CmList'][_0xc11d('0x5e')]({'where':{'id':_0x75d4f9[_0xc11d('0x74')][_0xc11d('0x9c')]},'include':[{'model':db[_0xc11d('0x79')],'as':'Contacts','where':_0x351308,'limit':0x1,'order':[[_0xc11d('0x7f'),'DESC']]}]});})[_0xc11d('0x22')](handleEntityNotFound(_0x5e1b11,null))[_0xc11d('0x22')](function(_0xdd1850){if(_0xdd1850){_0x75d4f9[_0xc11d('0x9d')]=_[_0xc11d('0x9e')](_0xdd1850,[_0xc11d('0x9f')]);if(_0xdd1850['Contacts'][_0xc11d('0x4e')]){return _0xdd1850['Contacts'][0x0];}var _0x340eb3=_[_0xc11d('0xa0')](_0x75d4f9[_0xc11d('0x60')],{'firstName':_0x75d4f9['body'][_0xc11d('0x83')],'ListId':_0xdd1850['id']});_0x340eb3[_0x75d4f9['body']['mapKey']]=_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')];return db[_0xc11d('0x79')][_0xc11d('0x5f')](_0x340eb3,{'fields':_0x5467da,'raw':!![]});}})[_0xc11d('0x22')](handleEntityNotFound(_0x5e1b11,null))[_0xc11d('0x22')](function(_0x3a087c){if(_0x3a087c){_0x75d4f9[_0xc11d('0xa1')]=_0x3a087c;var _0x5ccc6b={'ContactId':_0x3a087c['id'],'phone':_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')],'SmsAccountId':_0x3dcbfe[_0xc11d('0x5c')]['id']};var _0x7cbbdb={'ContactId':_0x3a087c['id'],'SmsAccountId':_0x3dcbfe[_0xc11d('0x5c')]['id'],'closed':![]};return db[_0xc11d('0xa2')][_0xc11d('0x5e')]({'where':_0x7cbbdb})[_0xc11d('0x22')](function(_0x33a732){if(_0x33a732){return[_0x33a732,![]];}return db[_0xc11d('0xa2')][_0xc11d('0x5f')](_0x5ccc6b)[_0xc11d('0x22')](function(_0x2cc5c6){return[_0x2cc5c6,!![]];});});}})[_0xc11d('0xa3')](function(_0x197222,_0x93b2a8){_0x75d4f9[_0xc11d('0xa4')]=_0x197222[_0xc11d('0x39')]({'plain':!![]});_0x75d4f9[_0xc11d('0xa4')][_0xc11d('0xa5')]=![];if(_0x93b2a8){if(_0x75d4f9[_0xc11d('0x74')][_0xc11d('0xa6')]){_0x75d4f9[_0xc11d('0x75')][_0xc11d('0xa7')]({'id':0x0,'priority':_0x75d4f9[_0xc11d('0x75')][_0xc11d('0x4e')]+0x1,'app':_0xc11d('0xa8'),'appdata':'unmanaged','interval':_0xc11d('0xa9')});}_0x75d4f9[_0xc11d('0xa4')]['created']=!![];}return db[_0xc11d('0xaa')]['create']({'phone':_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')],'messageId':_0x75d4f9['body'][_0xc11d('0x84')],'body':_0x75d4f9['body'][_0xc11d('0x60')],'SmsAccountId':_0x3dcbfe[_0xc11d('0x5c')]['id'],'SmsInteractionId':_0x197222['id'],'direction':'in','ContactId':_0x197222[_0xc11d('0xab')],'AttachmentId':_0x75d4f9[_0xc11d('0x60')][_0xc11d('0xac')]});})[_0xc11d('0x22')](function(_0x4479b7){_0x75d4f9[_0xc11d('0x2b')]=_0x4479b7;if(!_0x75d4f9['interaction'][_0xc11d('0xad')])return;return db[_0xc11d('0xae')][_0xc11d('0x5e')]({'attributes':['id',_0xc11d('0x3e')],'where':{'id':_0x75d4f9[_0xc11d('0xa4')][_0xc11d('0xad')]}});})[_0xc11d('0x22')](function(_0x421a42){if(_0x421a42){_0x75d4f9[_0xc11d('0x75')][_0xc11d('0xaf')]({'id':0x0,'priority':0x0,'app':_0xc11d('0xb0'),'appdata':_0x421a42[_0xc11d('0x3e')]+','+(_0x75d4f9[_0xc11d('0x74')][_0xc11d('0xb1')]||0xa),'interval':_0xc11d('0xa9')});}if(!_0x75d4f9['interaction'][_0xc11d('0xb2')])return;return db[_0xc11d('0xb3')]['find']({'attributes':['id',_0xc11d('0x3e')],'where':{'id':_0x75d4f9[_0xc11d('0xa4')][_0xc11d('0xb2')]}});})[_0xc11d('0x22')](function(_0x3c42cc){if(_0x3c42cc){_0x75d4f9[_0xc11d('0x75')][_0xc11d('0xaf')]({'id':0x0,'priority':0x1,'app':_0xc11d('0xb4'),'appdata':_0x3c42cc[_0xc11d('0x3e')]+','+(_0x75d4f9[_0xc11d('0x74')][_0xc11d('0xb5')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xc11d('0xb6'),_0x75d4f9);})['then'](function(_0x157c43){if(_0x157c43){var _0x3959d9=0xc8;var _0x3e8c8a=_0xc11d('0xb7');logger['info'](_0xc11d('0x27'),_0x3e8c8a,_0x3959d9,'entity\x20found');logger['debug'](_0xc11d('0xb8'),_0x3e8c8a,_0x3959d9,'entity\x20found',JSON[_0xc11d('0x28')](_0x157c43));if(_0x75d4f9[_0xc11d('0x74')][_0xc11d('0x46')]===_0xc11d('0x82')){return _0x5e1b11[_0xc11d('0x2e')](_0x3959d9)[_0xc11d('0x34')]('Content-Type','text/xml')[_0xc11d('0x3f')](_0xc11d('0xb9'));}else{return _0x5e1b11[_0xc11d('0x2e')](_0x3959d9)['json'](_0x157c43);}}})[_0xc11d('0x5a')](handleError(_0x5e1b11,null));};exports['addApplications']=function(_0x43aeb6,_0xf4fbe2){var _0x36d412=_0x43aeb6[_0xc11d('0x5c')]['id'];var _0x495752=_0x43aeb6['body'];var _0x58f4d3=0xc8;var _0x3c3baf=null;return db[_0xc11d('0xba')][_0xc11d('0xbb')]({'isolationLevel':db[_0xc11d('0xba')][_0xc11d('0xbc')][_0xc11d('0xbd')][_0xc11d('0xbe')]},function(_0x1261c2){return db[_0xc11d('0x43')]['findOne']({'where':{'id':_0x36d412},'transaction':_0x1261c2})[_0xc11d('0x22')](function(_0x50e74e){if(_0x50e74e){return db[_0xc11d('0xbf')][_0xc11d('0x38')]({'where':{'SmsAccountId':_0x36d412},'transaction':_0x1261c2})[_0xc11d('0x22')](function(){var _0x4a941b=_[_0xc11d('0x47')](_0x495752,function(_0x25b5ba){_0x25b5ba[_0xc11d('0x67')]=_0x36d412;return _0x25b5ba;});return db[_0xc11d('0xbf')][_0xc11d('0xc0')](_0x4a941b,{'transaction':_0x1261c2});});}else{_0x58f4d3=0x194;_0x3c3baf=[];}});})['then'](function(){if(_0x58f4d3!==0x194){return db['SmsApplication'][_0xc11d('0xc1')]({'where':{'SmsAccountId':_0x36d412},'order':_0xc11d('0x77')})[_0xc11d('0x22')](function(_0x24a198){_0x3c3baf=_0x24a198;});}})[_0xc11d('0x5a')](function(_0x48947f){_0x58f4d3=0x1f4;logger[_0xc11d('0x29')](_0x48947f[_0xc11d('0x3d')]);if(_0x48947f['name']){delete _0x48947f[_0xc11d('0x3e')];}_0x3c3baf=_0x48947f;})[_0xc11d('0xc2')](function(){if(_0x3c3baf===null){_0xf4fbe2[_0xc11d('0x3c')](_0x58f4d3);}else{if(_0x58f4d3===0x1f4){_0xf4fbe2[_0xc11d('0x2e')](_0x58f4d3)[_0xc11d('0x3f')](_0x3c3baf);}else{_0xf4fbe2[_0xc11d('0x2e')](_0x58f4d3)[_0xc11d('0x2f')](_0x3c3baf);}}});};exports[_0xc11d('0xc3')]=function(_0x5a943e,_0x2fab28,_0x3324fb){var _0x309e50={};var _0x5037ee={};var _0x165689;var _0x22b42c;return db[_0xc11d('0x43')][_0xc11d('0x6d')]({'where':{'id':_0x5a943e[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x2fab28,null))[_0xc11d('0x22')](function(_0x1e7626){if(_0x1e7626){_0x165689=_0x1e7626;_0x5037ee['model']=_['keys'](db['SmsApplication'][_0xc11d('0x44')]);_0x5037ee[_0xc11d('0x48')]=_['keys'](_0x5a943e['query']);_0x5037ee[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x5037ee[_0xc11d('0x4b')],_0x5037ee[_0xc11d('0x48')]);_0x309e50[_0xc11d('0x4c')]=_[_0xc11d('0x4a')](_0x5037ee[_0xc11d('0x4b')],qs['fields'](_0x5a943e[_0xc11d('0x48')][_0xc11d('0x4d')]));_0x309e50[_0xc11d('0x4c')]=_0x309e50['attributes'][_0xc11d('0x4e')]?_0x309e50[_0xc11d('0x4c')]:_0x5037ee[_0xc11d('0x4b')];_0x309e50[_0xc11d('0x6f')]=qs['sort'](_0x5a943e[_0xc11d('0x48')]['sort']);_0x309e50[_0xc11d('0x51')]=qs[_0xc11d('0x49')](_[_0xc11d('0x52')](_0x5a943e[_0xc11d('0x48')],_0x5037ee[_0xc11d('0x49')]));if(_0x5a943e[_0xc11d('0x48')][_0xc11d('0x53')]){_0x309e50[_0xc11d('0x51')]=_[_0xc11d('0x54')](_0x309e50['where'],{'$or':_['map'](_0x309e50['attributes'],function(_0x2bf6fb){var _0x54ab2b={};_0x54ab2b[_0x2bf6fb]={'$like':'%'+_0x5a943e[_0xc11d('0x48')][_0xc11d('0x53')]+'%'};return _0x54ab2b;})});}_0x309e50=_[_0xc11d('0x54')]({},_0x309e50,_0x5a943e[_0xc11d('0x55')]);return _0x165689[_0xc11d('0xc3')](_0x309e50);}})[_0xc11d('0x22')](function(_0x21f663){if(_0x21f663){_0x22b42c=_0x21f663[_0xc11d('0x4e')];if(!_0x5a943e[_0xc11d('0x48')][_0xc11d('0x4f')](_0xc11d('0x6e'))){_0x309e50[_0xc11d('0x31')]=qs[_0xc11d('0x31')](_0x5a943e[_0xc11d('0x48')][_0xc11d('0x31')]);_0x309e50['offset']=qs[_0xc11d('0x30')](_0x5a943e['query']['offset']);}return _0x165689[_0xc11d('0xc3')](_0x309e50);}})[_0xc11d('0x22')](function(_0x496ce8){if(_0x496ce8){return _0x496ce8?{'count':_0x22b42c,'rows':_0x496ce8}:null;}})[_0xc11d('0x22')](respondWithResult(_0x2fab28,null))[_0xc11d('0x5a')](handleError(_0x2fab28,null));};exports[_0xc11d('0xc4')]=function(_0x450d2c,_0x1965c8,_0x40d18b){var _0x3b95e2={'raw':![],'where':{}};var _0x5ecb0c={};var _0xf9fd8c={'count':0x0,'rows':[]};return db[_0xc11d('0x43')][_0xc11d('0x6d')]({'where':{'id':_0x450d2c[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x1965c8,null))[_0xc11d('0x22')](function(_0x2e1bfc){if(_0x2e1bfc){_0x5ecb0c[_0xc11d('0x4b')]=_[_0xc11d('0x5d')](db[_0xc11d('0xa2')][_0xc11d('0x44')]);_0x5ecb0c[_0xc11d('0x48')]=_[_0xc11d('0x5d')](_0x450d2c['query']);_0x5ecb0c[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x5ecb0c[_0xc11d('0x4b')],_0x5ecb0c[_0xc11d('0x48')]);_0x3b95e2[_0xc11d('0x4c')]=_[_0xc11d('0x4a')](_0x5ecb0c[_0xc11d('0x4b')],qs['fields'](_0x450d2c[_0xc11d('0x48')][_0xc11d('0x4d')]));_0x3b95e2[_0xc11d('0x4c')]=_0x3b95e2[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0x3b95e2[_0xc11d('0x4c')]:_0x5ecb0c[_0xc11d('0x4b')];if(!_0x450d2c['query'][_0xc11d('0x4f')](_0xc11d('0x6e'))){_0x3b95e2[_0xc11d('0x31')]=qs['limit'](_0x450d2c[_0xc11d('0x48')][_0xc11d('0x31')]);_0x3b95e2['offset']=qs[_0xc11d('0x30')](_0x450d2c[_0xc11d('0x48')][_0xc11d('0x30')]);}_0x3b95e2[_0xc11d('0x6f')]=qs[_0xc11d('0x50')](_0x450d2c[_0xc11d('0x48')][_0xc11d('0x50')]);_0x3b95e2[_0xc11d('0x51')]=qs[_0xc11d('0x49')](_[_0xc11d('0x52')](_0x450d2c[_0xc11d('0x48')],_0x5ecb0c['filters']));_0x3b95e2[_0xc11d('0x51')][_0xc11d('0x67')]=_0x2e1bfc['id'];if(_0x450d2c[_0xc11d('0x48')][_0xc11d('0x53')]){_0x3b95e2[_0xc11d('0x51')]=_[_0xc11d('0x54')](_0x3b95e2[_0xc11d('0x51')],{'$or':_[_0xc11d('0x47')](_0x3b95e2[_0xc11d('0x4c')],function(_0xd46771){var _0x9bf315={};_0x9bf315[_0xd46771]={'$like':'%'+_0x450d2c['query']['filter']+'%'};return _0x9bf315;})});}_0x3b95e2=_['merge']({},_0x3b95e2,_0x450d2c['options']);return db['SmsInteraction']['count']({'where':_0x3b95e2[_0xc11d('0x51')]})[_0xc11d('0x22')](function(_0x3b0e4c){_0xf9fd8c[_0xc11d('0x33')]=_0x3b0e4c;if(_0x450d2c[_0xc11d('0x48')][_0xc11d('0x56')]){_0x3b95e2[_0xc11d('0x57')]=[{'model':db[_0xc11d('0x79')],'as':_0xc11d('0xc5'),'required':![]},{'model':db['User'],'as':_0xc11d('0xc6'),'attributes':[_0xc11d('0x3e'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0xc11d('0xc7'),'attributes':['id',_0xc11d('0x3e'),_0xc11d('0xc8')],'where':_0x450d2c['query']['tag']?{'id':_0x450d2c['query'][_0xc11d('0xc9')]}:undefined,'required':_0x450d2c[_0xc11d('0x48')][_0xc11d('0xc9')]?!![]:![]}];}return db[_0xc11d('0xa2')][_0xc11d('0x58')](_0x3b95e2);})[_0xc11d('0x22')](function(_0x1637f6){_0xf9fd8c[_0xc11d('0x59')]=_0x1637f6;return _0xf9fd8c;});}})[_0xc11d('0x22')](respondWithFilteredResult(_0x1965c8,_0x3b95e2))[_0xc11d('0x5a')](handleError(_0x1965c8,null));};exports[_0xc11d('0x3f')]=function(_0xfe374a,_0x55632d,_0x29e13e){var _0x262019,_0x5d143c,_0x5e6274;if(_['isNil'](_0xfe374a[_0xc11d('0x60')][_0xc11d('0x60')])||_0xfe374a[_0xc11d('0x60')][_0xc11d('0x60')]===''){throw new db[(_0xc11d('0x7a'))][(_0xc11d('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc11d('0x98')](_0xfe374a[_0xc11d('0x60')]['to'])){throw new db[(_0xc11d('0x7a'))][(_0xc11d('0x7b'))](_0xc11d('0xca'));}_0x262019=_0xfe374a[_0xc11d('0x60')]['to'];return db['SmsAccount']['find']({'where':{'id':_0xfe374a[_0xc11d('0x5c')]['id']},'include':[{'model':db[_0xc11d('0xcb')],'as':_0xc11d('0xcc'),'include':[{'model':db[_0xc11d('0x79')],'as':'Contacts','where':{'mobile':_0x262019},'limit':0x1,'order':[[_0xc11d('0x7f'),_0xc11d('0xcd')]]}]}]})['then'](handleEntityNotFound(_0x55632d,null))[_0xc11d('0x22')](function(_0x527443){if(_0x527443&&_0x527443[_0xc11d('0xcc')]){_0x5d143c=_0x527443[_0xc11d('0x39')]({'plain':!![]});if(_0x5d143c[_0xc11d('0xcc')]&&_0x5d143c[_0xc11d('0xcc')][_0xc11d('0x9f')][_0xc11d('0x4e')]){return _0x5d143c[_0xc11d('0xcc')][_0xc11d('0x9f')][0x0];}return db[_0xc11d('0x79')]['create'](_['defaults'](_0xfe374a[_0xc11d('0x60')],{'firstName':_0x262019,'mobile':_0x262019,'phone':_0x262019,'ListId':_0x5d143c[_0xc11d('0x9c')]}));}})[_0xc11d('0x22')](handleEntityNotFound(_0x55632d,null))[_0xc11d('0x22')](function(_0x91880d){if(_0x91880d){_0x5e6274=_0x91880d;return db['SmsInteraction']['find']({'where':{'ContactId':_0x5e6274['id'],'closed':![],'SmsAccountId':_0x5d143c['id']}})[_0xc11d('0x22')](function(_0xb905d6){if(_0xb905d6){return[_0xb905d6,![]];}return db['SmsInteraction'][_0xc11d('0x5f')]({'UserId':_0xfe374a[_0xc11d('0x62')]['id'],'ContactId':_0x5e6274['id'],'SmsAccountId':_0x5d143c['id'],'phone':_0x262019,'firstMsgDirection':_0xc11d('0xce'),'Messages':[_[_0xc11d('0x54')](_0xfe374a[_0xc11d('0x60')],{'read':![],'body':_0xfe374a[_0xc11d('0x60')]['body'],'phone':_0x262019,'SmsAccountId':_0x5d143c['id'],'UserId':_0xfe374a[_0xc11d('0x62')]['id'],'ContactId':_0x5e6274['id']})]},{'include':[{'model':db[_0xc11d('0xaa')],'as':_0xc11d('0xcf')}]})[_0xc11d('0x22')](function(_0x330082){return[_0x330082,!![]];});});}})['spread'](function(_0x5050cf,_0x5d11fe){if(_0x5d11fe){return _0x5050cf;}return db[_0xc11d('0xaa')][_0xc11d('0x5f')](_[_0xc11d('0x54')](_0xfe374a['body'],{'read':![],'body':_0xfe374a[_0xc11d('0x60')][_0xc11d('0x60')],'phone':_0x262019,'SmsAccountId':_0x5d143c['id'],'SmsInteractionId':_0x5050cf['id'],'UserId':_0xfe374a[_0xc11d('0x62')]['id'],'ContactId':_0x5e6274['id']}))[_0xc11d('0x22')](function(_0x1f5f87){_0x5050cf[_0xc11d('0xd0')][_0xc11d('0xcf')]=[];_0x5050cf[_0xc11d('0xd0')][_0xc11d('0xcf')]['push'](_0x1f5f87[_0xc11d('0xd0')]);return _0x5050cf;});})[_0xc11d('0x22')](respondWithResult(_0x55632d,null))[_0xc11d('0x5a')](handleError(_0x55632d,null));};exports[_0xc11d('0x2e')]=function(_0x25a7b4,_0x5687c4,_0x86c430){if(_0x25a7b4['body']['id']){delete _0x25a7b4['body']['id'];}var _0x1a3055,_0x1de8ed,_0x58a452;return db['SmsAccount'][_0xc11d('0x5e')]({'where':{'id':_0x25a7b4[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x5687c4,null))['then'](function(_0x326231){if(_0x326231){_0x58a452=_0x326231;logger[_0xc11d('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc11d('0x2e'),'received\x20delivery\x20report\x20from',_0x326231[_0xc11d('0x46')],util[_0xc11d('0xd1')](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));switch(_0x326231[_0xc11d('0x46')]){case _0xc11d('0x86'):if(_0x25a7b4['body']['skebby_dispatch_id']&&_0x25a7b4[_0xc11d('0x60')]['status']){_0x1de8ed=_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x2e')];return db[_0xc11d('0xaa')][_0xc11d('0x5e')]({'where':{'messageId':_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd2')]}});}break;case'connectel':if(_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd3')]&&_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd4')]){_0x1de8ed=_0x25a7b4['body'][_0xc11d('0xd4')];return db['SmsMessage'][_0xc11d('0x5e')]({'where':{'messageId':_0x25a7b4['body'][_0xc11d('0xd3')]}});}break;case'clicksend':if(_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x8a')]&&_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd5')]){_0x1de8ed=_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd5')];return db[_0xc11d('0xaa')][_0xc11d('0x5e')]({'where':{'messageId':_0x25a7b4['body']['message_id']}});}break;case _0xc11d('0x8e'):var _0x330e0d=_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x8f')][0x0];if(_0x330e0d[_0xc11d('0x84')]&&_0x330e0d['status'][_0xc11d('0xd6')]===_0xc11d('0xd7')){_0x1de8ed=_0x330e0d[_0xc11d('0x2e')][_0xc11d('0xd6')];return db[_0xc11d('0xaa')]['find']({'where':{'messageId':_0x330e0d[_0xc11d('0x84')]}});}break;case _0xc11d('0x92'):if(_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x84')]&&_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x2e')]){_0x1de8ed=_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x2e')];return db[_0xc11d('0xaa')][_0xc11d('0x5e')]({'where':{'messageId':_0x25a7b4['body'][_0xc11d('0x84')]}});}break;case _0xc11d('0x94'):if(_0x25a7b4[_0xc11d('0x60')][0x0][_0xc11d('0x2b')]['id']){_0x1de8ed=_0x25a7b4[_0xc11d('0x60')][0x0][_0xc11d('0x46')];return db[_0xc11d('0xaa')][_0xc11d('0x5e')]({'where':{'messageId':_0x25a7b4['body'][0x0]['message']['id']}});}break;case _0xc11d('0x95'):if(_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd8')]&&_0x25a7b4['body'][_0xc11d('0x2e')]){_0x1de8ed=_0x25a7b4['body'][_0xc11d('0x2e')];return db[_0xc11d('0xaa')]['find']({'where':{'messageId':_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd8')]}});}break;}}})[_0xc11d('0x22')](handleEntityNotFound(_0x5687c4,null))[_0xc11d('0x22')](function(_0x4be91b){if(_0x4be91b){_0x1a3055=_0x4be91b;switch(_0x58a452[_0xc11d('0x46')]){case _0xc11d('0x86'):if(_0x1de8ed==='DELIVERED'){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),_0xc11d('0x2e'),_0xc11d('0x86'),util[_0xc11d('0xd1')](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc11d('0xd9'):if(_0x1de8ed==='1'){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),_0xc11d('0x2e'),_0xc11d('0x86'),util[_0xc11d('0xd1')](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x25a7b4[_0xc11d('0x60')]['error_code']&&_0x1de8ed>=0xc8&&_0x1de8ed<=0xce){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),_0xc11d('0x2e'),'clicksend',util[_0xc11d('0xd1')](_0x25a7b4['body'],{'showHidden':![],'depth':null}));}break;case _0xc11d('0x8e'):var _0x3db2ce=_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x8f')][0x0];if(_0x3db2ce[_0xc11d('0x2e')][_0xc11d('0xd6')]===_0xc11d('0xd7')){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),_0xc11d('0x2e'),'infobip',util[_0xc11d('0xd1')](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc11d('0x92'):if(_0x1de8ed==_0xc11d('0xda')||_0x1de8ed==_0xc11d('0xdb')){return _0x1a3055['update']({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),'status','clickatell',util['inspect'](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc11d('0x94'):if(_0x1de8ed==_0xc11d('0xdc')){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger['error'](_0xc11d('0x27'),_0xc11d('0x2e'),'bandwidth',util[_0xc11d('0xd1')](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc11d('0x95'):if(_0x1de8ed==='DELIVRD'||_0x1de8ed===_0xc11d('0xdd')){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),_0xc11d('0x2e'),_0xc11d('0x95'),util['inspect'](_0x25a7b4['body'],{'showHidden':![],'depth':null}));}break;}return _0x1a3055;}})[_0xc11d('0x22')](respondWithResult(_0x5687c4,null))['catch'](handleError(_0x5687c4,null));};exports[_0xc11d('0xde')]=function(_0x4b3d1a,_0x544ae1,_0x40224a){var _0x59cb41,_0x35c0b5,_0x2b967b;return db[_0xc11d('0x43')]['find']({'where':{'id':_0x4b3d1a[_0xc11d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x544ae1,null))['then'](function(_0x1b1794){if(_0x1b1794){_0x2b967b=_0x1b1794;logger[_0xc11d('0x26')](_0xc11d('0x27'),_0xc11d('0x2e'),_0xc11d('0xdf'),_0x1b1794[_0xc11d('0x46')],util[_0xc11d('0xd1')](_0x4b3d1a[_0xc11d('0x48')],{'showHidden':![],'depth':null}));switch(_0x1b1794['type']){case _0xc11d('0x90'):if(_0x4b3d1a[_0xc11d('0x48')][_0xc11d('0xe0')]&&_0x4b3d1a[_0xc11d('0x48')][_0xc11d('0xe1')]){_0x35c0b5=_0x4b3d1a[_0xc11d('0x48')][_0xc11d('0xe1')];return db['SmsMessage'][_0xc11d('0x5e')]({'where':{'messageId':_0x4b3d1a[_0xc11d('0x48')]['message-id']}});}break;}}})[_0xc11d('0x22')](handleEntityNotFound(_0x544ae1,null))[_0xc11d('0x22')](function(_0x32b61f){if(_0x32b61f){_0x59cb41=_0x32b61f;switch(_0x2b967b['type']){case _0xc11d('0x90'):if(_0x35c0b5==='2'||_0x35c0b5==='6'){return _0x59cb41[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),'status','csc',util['inspect'](_0x4b3d1a['query'],{'showHidden':![],'depth':null}));};break;}return _0x59cb41;}})['then'](respondWithResult(_0x544ae1,null))[_0xc11d('0x5a')](handleError(_0x544ae1,null));};exports[_0xc11d('0xe2')]=function(_0x4cbae0,_0x34b9b2,_0x58fbf7){return db[_0xc11d('0x43')][_0xc11d('0x5e')]({'where':{'id':_0x4cbae0[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x34b9b2,null))['then'](function(_0x2636a6){if(_0x2636a6){return _0x2636a6[_0xc11d('0xe2')](_0x4cbae0[_0xc11d('0x60')][_0xc11d('0x6a')],_[_0xc11d('0x9e')](_0x4cbae0['body'],[_0xc11d('0x6a'),'id'])||{})[_0xc11d('0xa3')](function(_0x294396){for(var _0x196ab5=0x0;_0x196ab5<_0x4cbae0[_0xc11d('0x60')]['ids'][_0xc11d('0x4e')];_0x196ab5+=0x1){socket[_0xc11d('0xe3')](_0xc11d('0xe4'),{'UserId':Number(_0x4cbae0[_0xc11d('0x60')][_0xc11d('0x6a')][_0x196ab5]),'SmsAccountId':Number(_0x4cbae0[_0xc11d('0x5c')]['id'])});}return _0x294396;});}})['then'](respondWithResult(_0x34b9b2,null))['catch'](handleError(_0x34b9b2,null));};exports['removeAgents']=function(_0xd4c742,_0x3f2186,_0xc41803){return db[_0xc11d('0x43')]['find']({'where':{'id':_0xd4c742[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x3f2186,null))[_0xc11d('0x22')](function(_0x36f907){if(_0x36f907){return _0x36f907[_0xc11d('0xe5')](_0xd4c742[_0xc11d('0x48')][_0xc11d('0x6a')])[_0xc11d('0x22')](function(){if(_[_0xc11d('0xe6')](_0xd4c742[_0xc11d('0x48')][_0xc11d('0x6a')])){for(var _0xb2fbe4=0x0;_0xb2fbe4<_0xd4c742['query'][_0xc11d('0x6a')][_0xc11d('0x4e')];_0xb2fbe4+=0x1){socket[_0xc11d('0xe3')](_0xc11d('0xe7'),{'UserId':Number(_0xd4c742['query'][_0xc11d('0x6a')][_0xb2fbe4]),'SmsAccountId':Number(_0xd4c742[_0xc11d('0x5c')]['id'])});}}else{socket['emit'](_0xc11d('0xe7'),{'UserId':Number(_0xd4c742['query'][_0xc11d('0x6a')]),'SmsAccountId':Number(_0xd4c742[_0xc11d('0x5c')]['id'])});}});}})[_0xc11d('0x22')](respondWithStatusCode(_0x3f2186,null))['catch'](handleError(_0x3f2186,null));};exports[_0xc11d('0xe8')]=function(_0xf79394,_0x49bf7f,_0x49891b){var _0x183143={};var _0x270d3c={};var _0xf789cb;var _0x575e34;return db[_0xc11d('0x43')]['findOne']({'where':{'id':_0xf79394[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x49bf7f,null))[_0xc11d('0x22')](function(_0x429d08){if(_0x429d08){_0xf789cb=_0x429d08;_0x270d3c[_0xc11d('0x4b')]=_[_0xc11d('0x5d')](db[_0xc11d('0xae')][_0xc11d('0x44')]);_0x270d3c[_0xc11d('0x48')]=_[_0xc11d('0x5d')](_0xf79394['query']);_0x270d3c[_0xc11d('0x49')]=_['intersection'](_0x270d3c['model'],_0x270d3c['query']);_0x183143[_0xc11d('0x4c')]=_[_0xc11d('0x4a')](_0x270d3c[_0xc11d('0x4b')],qs[_0xc11d('0x4d')](_0xf79394[_0xc11d('0x48')][_0xc11d('0x4d')]));_0x183143[_0xc11d('0x4c')]=_0x183143[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0x183143[_0xc11d('0x4c')]:_0x270d3c[_0xc11d('0x4b')];_0x183143[_0xc11d('0x6f')]=qs['sort'](_0xf79394[_0xc11d('0x48')]['sort']);_0x183143[_0xc11d('0x51')]=qs['filters'](_[_0xc11d('0x52')](_0xf79394[_0xc11d('0x48')],_0x270d3c[_0xc11d('0x49')]));if(_0xf79394['query'][_0xc11d('0x53')]){_0x183143[_0xc11d('0x51')]=_['merge'](_0x183143[_0xc11d('0x51')],{'$or':_[_0xc11d('0x47')](_0x183143[_0xc11d('0x4c')],function(_0x32f635){var _0x4ac885={};_0x4ac885[_0x32f635]={'$like':'%'+_0xf79394[_0xc11d('0x48')]['filter']+'%'};return _0x4ac885;})});}_0x183143=_[_0xc11d('0x54')]({},_0x183143,_0xf79394['options']);return _0xf789cb[_0xc11d('0xe8')](_0x183143);}})[_0xc11d('0x22')](function(_0xd98ba7){if(_0xd98ba7){_0x575e34=_0xd98ba7['length'];if(!_0xf79394[_0xc11d('0x48')]['hasOwnProperty'](_0xc11d('0x6e'))){_0x183143[_0xc11d('0x31')]=qs[_0xc11d('0x31')](_0xf79394[_0xc11d('0x48')]['limit']);_0x183143[_0xc11d('0x30')]=qs['offset'](_0xf79394[_0xc11d('0x48')][_0xc11d('0x30')]);}return _0xf789cb[_0xc11d('0xe8')](_0x183143);}})['then'](function(_0x31c443){if(_0x31c443){return _0x31c443?{'count':_0x575e34,'rows':_0x31c443}:null;}})[_0xc11d('0x22')](respondWithResult(_0x49bf7f,null))[_0xc11d('0x5a')](handleError(_0x49bf7f,null));}; \ No newline at end of file +var _0xa18e=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','SmsAccounts','stack','name','index','Pause','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','SmsAccount','findAll','rows','catch','params','mandatoryDispositionPause','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','SmsAccountId','Disposition','getDispositions','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','infobip','results','csc','segmentedMessage','clickatell','replyMessageId','intelepeer','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','updatedAt','DESC','list','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','SmsMessage','AttachmentId','UserId','User','agent','*,*,*,*','queueId','SmsQueue','unshift','queue','Start','startRouting','receiveMessage','entity\x20found','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','finally','send','getApplications','Contact','Owner','fullname','Tags','color','tag','CmList','List','out','Messages','dataValues','debug','requestid','statusInt','clicksend','message_id','status_code','groupName','DELIVERED','bandwidth','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa18e,0xcd));var _0xea18=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xa18e[_0x44bcb0];return _0xfaf881;};'use strict';var emlformat=require(_0xea18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea18('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea18('0x2'));var moment=require(_0xea18('0x3'));var BPromise=require(_0xea18('0x4'));var Mustache=require('mustache');var util=require(_0xea18('0x5'));var path=require(_0xea18('0x6'));var sox=require(_0xea18('0x7'));var csv=require(_0xea18('0x8'));var ejs=require(_0xea18('0x9'));var fs=require('fs');var fs_extra=require(_0xea18('0xa'));var _=require('lodash');var squel=require(_0xea18('0xb'));var crypto=require(_0xea18('0xc'));var jsforce=require(_0xea18('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xea18('0x8'));var querystring=require(_0xea18('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xea18('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xea18('0x10'));var hardwareService=require(_0xea18('0x11'));var logger=require(_0xea18('0x12'))(_0xea18('0x13'));var utils=require(_0xea18('0x14'));var config=require(_0xea18('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xea18('0x16'))['db'];config['redis']=_[_0xea18('0x17')](config[_0xea18('0x18')],{'host':_0xea18('0x19'),'port':0x18eb});var socket=require(_0xea18('0x1a'))(new Redis(config[_0xea18('0x18')]));require(_0xea18('0x1b'))[_0xea18('0x1c')](socket);var jayson=require(_0xea18('0x1d'));var client=jayson[_0xea18('0x1e')][_0xea18('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x569d5d,_0x4616c0,_0x72f50,_0x9b6e10){return new BPromise(function(_0x32e2cc,_0x185b1d){var _0x25b5ab=_0x9b6e10||client;return _0x25b5ab['request'](_0x569d5d,_0x72f50)[_0xea18('0x20')](function(_0x3e82e9){logger[_0xea18('0x21')](_0xea18('0x22'),_0x4616c0,_0xea18('0x23'));logger['debug'](_0xea18('0x24'),_0x4616c0,_0xea18('0x23'),JSON[_0xea18('0x25')](_0x3e82e9));if(_0x3e82e9[_0xea18('0x26')]){if(_0x3e82e9[_0xea18('0x26')][_0xea18('0x27')]===0x1f4){logger[_0xea18('0x26')]('SmsAccount,\x20%s,\x20%s',_0x4616c0,_0x3e82e9[_0xea18('0x26')][_0xea18('0x28')]);return _0x185b1d(_0x3e82e9[_0xea18('0x26')][_0xea18('0x28')]);}logger[_0xea18('0x26')](_0xea18('0x22'),_0x4616c0,_0x3e82e9[_0xea18('0x26')]['message']);return _0x32e2cc(_0x3e82e9[_0xea18('0x26')]['message']);}else{logger[_0xea18('0x21')](_0xea18('0x22'),_0x4616c0,_0xea18('0x23'));_0x32e2cc(_0x3e82e9[_0xea18('0x29')][_0xea18('0x28')]);}})['catch'](function(_0x37de8c){logger[_0xea18('0x26')](_0xea18('0x22'),_0x4616c0,_0x37de8c);_0x185b1d(_0x37de8c);});});}function respondWithStatusCode(_0x1cfa8b,_0x377c35){_0x377c35=_0x377c35||0xcc;return function(_0x116e69){if(_0x116e69){return _0x1cfa8b[_0xea18('0x2a')](_0x377c35);}return _0x1cfa8b[_0xea18('0x2b')](_0x377c35)[_0xea18('0x2c')]();};}function respondWithResult(_0x286da6,_0x214e68){_0x214e68=_0x214e68||0xc8;return function(_0x2df66e){if(_0x2df66e){return _0x286da6[_0xea18('0x2b')](_0x214e68)['json'](_0x2df66e);}};}function respondWithFilteredResult(_0x41a9bc,_0x466cc9){return function(_0x509901){if(_0x509901){var _0x1d51e6=typeof _0x466cc9[_0xea18('0x2d')]===_0xea18('0x2e')&&typeof _0x466cc9['limit']===_0xea18('0x2e');var _0x524a21=_0x509901[_0xea18('0x2f')];var _0x598765=_0x1d51e6?0x0:_0x466cc9[_0xea18('0x2d')];var _0x2f9a31=_0x1d51e6?_0x509901[_0xea18('0x2f')]:_0x466cc9[_0xea18('0x2d')]+_0x466cc9[_0xea18('0x30')];var _0x449013;if(_0x2f9a31>=_0x524a21){_0x2f9a31=_0x524a21;_0x449013=0xc8;}else{_0x449013=0xce;}_0x41a9bc[_0xea18('0x2b')](_0x449013);return _0x41a9bc[_0xea18('0x31')](_0xea18('0x32'),_0x598765+'-'+_0x2f9a31+'/'+_0x524a21)[_0xea18('0x33')](_0x509901);}return null;};}function patchUpdates(_0x36089a){return function(_0x587e8b){try{jsonpatch[_0xea18('0x34')](_0x587e8b,_0x36089a,!![]);}catch(_0x310863){return BPromise[_0xea18('0x35')](_0x310863);}return _0x587e8b[_0xea18('0x36')]();};}function saveUpdates(_0x2ad722,_0x4be2e2){return function(_0x3f3e4e){if(_0x3f3e4e){return _0x3f3e4e[_0xea18('0x37')](_0x2ad722)[_0xea18('0x20')](function(_0x442ef0){return _0x442ef0;});}return null;};}function removeEntity(_0x1ea79c,_0x9c8b90){return function(_0x49c341){if(_0x49c341){return _0x49c341[_0xea18('0x38')]()[_0xea18('0x20')](function(){var _0x437882=_0x49c341['get']({'plain':!![]});var _0x23015d=_0xea18('0x39');return db['UserProfileResource'][_0xea18('0x38')]({'where':{'type':_0x23015d,'resourceId':_0x437882['id']}})[_0xea18('0x20')](function(){return _0x49c341;});})[_0xea18('0x20')](function(){_0x1ea79c['status'](0xcc)[_0xea18('0x2c')]();});}};}function handleEntityNotFound(_0x1c7c1f,_0x1caefd){return function(_0x3e5568){if(!_0x3e5568){_0x1c7c1f[_0xea18('0x2a')](0x194);}return _0x3e5568;};}function handleError(_0x1fc166,_0x23ad80){_0x23ad80=_0x23ad80||0x1f4;return function(_0x14d7dd){logger['error'](_0x14d7dd[_0xea18('0x3a')]);if(_0x14d7dd[_0xea18('0x3b')]){delete _0x14d7dd[_0xea18('0x3b')];}_0x1fc166['status'](_0x23ad80)['send'](_0x14d7dd);};}exports[_0xea18('0x3c')]=function(_0x29b792,_0x1992cc){var _0x47abc9={'include':[{'model':db[_0xea18('0x3d')],'as':'mandatoryDispositionPause'}]},_0x18f0a5={},_0x1f0d1f={'count':0x0,'rows':[]};var _0x488abc=_[_0xea18('0x3e')](db['SmsAccount'][_0xea18('0x3f')],function(_0x533649){return{'name':_0x533649[_0xea18('0x40')],'type':_0x533649[_0xea18('0x41')][_0xea18('0x42')]};});_0x18f0a5[_0xea18('0x43')]=_[_0xea18('0x3e')](_0x488abc,'name');_0x18f0a5['query']=_[_0xea18('0x44')](_0x29b792[_0xea18('0x45')]);_0x18f0a5[_0xea18('0x46')]=_['intersection'](_0x18f0a5[_0xea18('0x43')],_0x18f0a5[_0xea18('0x45')]);_0x47abc9['attributes']=_[_0xea18('0x47')](_0x18f0a5[_0xea18('0x43')],qs[_0xea18('0x48')](_0x29b792[_0xea18('0x45')][_0xea18('0x48')]));_0x47abc9[_0xea18('0x49')]=_0x47abc9[_0xea18('0x49')][_0xea18('0x4a')]?_0x47abc9['attributes']:_0x18f0a5['model'];if(!_0x29b792[_0xea18('0x45')][_0xea18('0x4b')](_0xea18('0x4c'))){_0x47abc9['limit']=qs[_0xea18('0x30')](_0x29b792[_0xea18('0x45')][_0xea18('0x30')]);_0x47abc9[_0xea18('0x2d')]=qs[_0xea18('0x2d')](_0x29b792[_0xea18('0x45')][_0xea18('0x2d')]);}_0x47abc9[_0xea18('0x4d')]=qs['sort'](_0x29b792[_0xea18('0x45')][_0xea18('0x4e')]);_0x47abc9[_0xea18('0x4f')]=qs[_0xea18('0x46')](_['pick'](_0x29b792[_0xea18('0x45')],_0x18f0a5[_0xea18('0x46')]),_0x488abc);if(_0x29b792[_0xea18('0x45')][_0xea18('0x50')]){_0x47abc9['where']=_[_0xea18('0x51')](_0x47abc9[_0xea18('0x4f')],{'$or':_[_0xea18('0x3e')](_0x488abc,function(_0x356eb4){if(_0x356eb4['type']!==_0xea18('0x52')){var _0x470974={};_0x470974[_0x356eb4['name']]={'$like':'%'+_0x29b792['query'][_0xea18('0x50')]+'%'};return _0x470974;}})});}_0x47abc9=_[_0xea18('0x51')]({},_0x47abc9,_0x29b792[_0xea18('0x53')]);var _0x412e28={'where':_0x47abc9['where']};return db['SmsAccount'][_0xea18('0x2f')](_0x412e28)[_0xea18('0x20')](function(_0x38f8ab){_0x1f0d1f[_0xea18('0x2f')]=_0x38f8ab;if(_0x29b792['query'][_0xea18('0x54')]){_0x47abc9[_0xea18('0x55')]=[{'all':!![]}];}return db[_0xea18('0x56')][_0xea18('0x57')](_0x47abc9);})[_0xea18('0x20')](function(_0x38c7b6){_0x1f0d1f[_0xea18('0x58')]=_0x38c7b6;return _0x1f0d1f;})[_0xea18('0x20')](respondWithFilteredResult(_0x1992cc,_0x47abc9))[_0xea18('0x59')](handleError(_0x1992cc,null));};exports['show']=function(_0x5e4293,_0x29c6c9){var _0x4db4b6={'raw':![],'where':{'id':_0x5e4293[_0xea18('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0xea18('0x5b')}]},_0x4368ff={};_0x4368ff[_0xea18('0x43')]=_[_0xea18('0x44')](db['SmsAccount'][_0xea18('0x3f')]);_0x4368ff[_0xea18('0x45')]=_[_0xea18('0x44')](_0x5e4293[_0xea18('0x45')]);_0x4368ff['filters']=_[_0xea18('0x47')](_0x4368ff[_0xea18('0x43')],_0x4368ff[_0xea18('0x45')]);_0x4db4b6['attributes']=_['intersection'](_0x4368ff['model'],qs[_0xea18('0x48')](_0x5e4293[_0xea18('0x45')][_0xea18('0x48')]));_0x4db4b6[_0xea18('0x49')]=_0x4db4b6[_0xea18('0x49')][_0xea18('0x4a')]?_0x4db4b6[_0xea18('0x49')]:_0x4368ff[_0xea18('0x43')];if(_0x5e4293[_0xea18('0x45')][_0xea18('0x54')]){_0x4db4b6['include']=[{'all':!![]}];}_0x4db4b6=_['merge']({},_0x4db4b6,_0x5e4293[_0xea18('0x53')]);return db['SmsAccount'][_0xea18('0x5c')](_0x4db4b6)[_0xea18('0x20')](handleEntityNotFound(_0x29c6c9,null))[_0xea18('0x20')](respondWithResult(_0x29c6c9,null))[_0xea18('0x59')](handleError(_0x29c6c9,null));};exports[_0xea18('0x5d')]=function(_0x414bf2,_0x57b89b){return db['SmsAccount'][_0xea18('0x5d')](_0x414bf2['body'],{})[_0xea18('0x20')](function(_0x2a37db){var _0xb386cf=_0x414bf2[_0xea18('0x5e')][_0xea18('0x5f')]({'plain':!![]});if(!_0xb386cf)throw new Error(_0xea18('0x60'));if(_0xb386cf['role']==='user'){var _0x5c905f=_0x2a37db['get']({'plain':!![]});var _0x586fff=_0xea18('0x39');return db[_0xea18('0x61')]['find']({'where':{'name':_0x586fff,'userProfileId':_0xb386cf[_0xea18('0x62')]},'raw':!![]})['then'](function(_0x5507a3){if(_0x5507a3&&_0x5507a3[_0xea18('0x63')]===0x0){return db[_0xea18('0x64')][_0xea18('0x5d')]({'name':_0x5c905f[_0xea18('0x3b')],'resourceId':_0x5c905f['id'],'type':_0x5507a3[_0xea18('0x3b')],'sectionId':_0x5507a3['id']},{})[_0xea18('0x20')](function(){return _0x2a37db;});}else{return _0x2a37db;}})['catch'](function(_0x12b299){logger[_0xea18('0x26')](_0xea18('0x65'),_0x12b299);throw _0x12b299;});}return _0x2a37db;})[_0xea18('0x20')](respondWithResult(_0x57b89b,0xc9))[_0xea18('0x59')](handleError(_0x57b89b,null));};exports[_0xea18('0x37')]=function(_0x1d625c,_0x1fd40c){if(_0x1d625c[_0xea18('0x66')]['id']){delete _0x1d625c[_0xea18('0x66')]['id'];}return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x1d625c[_0xea18('0x5a')]['id']},'include':[{'model':db[_0xea18('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1fd40c,null))[_0xea18('0x20')](saveUpdates(_0x1d625c['body'],null))[_0xea18('0x20')](respondWithResult(_0x1fd40c,null))[_0xea18('0x59')](handleError(_0x1fd40c,null));};exports[_0xea18('0x38')]=function(_0x584ad9,_0x2c8efa){return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x584ad9[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x2c8efa,null))[_0xea18('0x20')](removeEntity(_0x2c8efa,null))['catch'](handleError(_0x2c8efa,null));};exports[_0xea18('0x67')]=function(_0x158e25,_0x2bf95b){return db[_0xea18('0x56')][_0xea18('0x67')]()[_0xea18('0x20')](respondWithResult(_0x2bf95b,null))['catch'](handleError(_0x2bf95b,null));};exports['addDisposition']=function(_0x5168c5,_0x2df508,_0x416547){if(_0x5168c5[_0xea18('0x66')]['id']){delete _0x5168c5['body']['id'];}return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x5168c5[_0xea18('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2df508,null))['then'](function(_0x302b1f){if(_0x302b1f){_0x5168c5[_0xea18('0x66')][_0xea18('0x68')]=_0x302b1f['id'];return db[_0xea18('0x69')][_0xea18('0x5d')](_0x5168c5[_0xea18('0x66')]);}})[_0xea18('0x20')](respondWithResult(_0x2df508,null))[_0xea18('0x59')](handleError(_0x2df508,null));};exports[_0xea18('0x6a')]=function(_0x54416a,_0x4f051a,_0x7f233f){var _0x4bb5ad={'raw':![],'where':{}};var _0x2d61c1={};var _0x47e2af={'count':0x0,'rows':[]};return db[_0xea18('0x56')]['findOne']({'where':{'id':_0x54416a[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x4f051a,null))[_0xea18('0x20')](function(_0x777708){if(_0x777708){_0x2d61c1[_0xea18('0x43')]=_[_0xea18('0x44')](db['Disposition'][_0xea18('0x3f')]);_0x2d61c1['query']=_[_0xea18('0x44')](_0x54416a[_0xea18('0x45')]);_0x2d61c1[_0xea18('0x46')]=_[_0xea18('0x47')](_0x2d61c1[_0xea18('0x43')],_0x2d61c1['query']);_0x4bb5ad[_0xea18('0x49')]=_[_0xea18('0x47')](_0x2d61c1[_0xea18('0x43')],qs[_0xea18('0x48')](_0x54416a[_0xea18('0x45')][_0xea18('0x48')]));_0x4bb5ad['attributes']=_0x4bb5ad[_0xea18('0x49')][_0xea18('0x4a')]?_0x4bb5ad['attributes']:_0x2d61c1[_0xea18('0x43')];if(!_0x54416a[_0xea18('0x45')]['hasOwnProperty']('nolimit')){_0x4bb5ad[_0xea18('0x30')]=qs[_0xea18('0x30')](_0x54416a[_0xea18('0x45')][_0xea18('0x30')]);_0x4bb5ad[_0xea18('0x2d')]=qs[_0xea18('0x2d')](_0x54416a[_0xea18('0x45')][_0xea18('0x2d')]);}_0x4bb5ad[_0xea18('0x4d')]=qs['sort'](_0x54416a[_0xea18('0x45')]['sort']);_0x4bb5ad[_0xea18('0x4f')]=qs[_0xea18('0x46')](_[_0xea18('0x6b')](_0x54416a[_0xea18('0x45')],_0x2d61c1['filters']));_0x4bb5ad['where']['SmsAccountId']=_0x777708['id'];if(_0x54416a[_0xea18('0x45')]['filter']){_0x4bb5ad[_0xea18('0x4f')]=_[_0xea18('0x51')](_0x4bb5ad[_0xea18('0x4f')],{'$or':_[_0xea18('0x3e')](_0x4bb5ad[_0xea18('0x49')],function(_0x25976f){var _0x112c0b={};_0x112c0b[_0x25976f]={'$like':'%'+_0x54416a['query']['filter']+'%'};return _0x112c0b;})});}_0x4bb5ad=_[_0xea18('0x51')]({},_0x4bb5ad,_0x54416a[_0xea18('0x53')]);return db[_0xea18('0x69')]['count']({'where':_0x4bb5ad[_0xea18('0x4f')]})[_0xea18('0x20')](function(_0x57c8d4){_0x47e2af['count']=_0x57c8d4;if(_0x54416a[_0xea18('0x45')][_0xea18('0x54')]){_0x4bb5ad[_0xea18('0x55')]=[{'all':!![]}];}return db[_0xea18('0x69')]['findAll'](_0x4bb5ad);})[_0xea18('0x20')](function(_0x1552a1){_0x47e2af[_0xea18('0x58')]=_0x1552a1;return _0x47e2af;});}})['then'](respondWithFilteredResult(_0x4f051a,_0x4bb5ad))['catch'](handleError(_0x4f051a,null));};exports[_0xea18('0x6c')]=function(_0x1c8d80,_0x146ea1,_0x6bd0a8){return db['SmsAccount'][_0xea18('0x5c')]({'where':{'id':_0x1c8d80[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x146ea1,null))['then'](function(_0x393af9){if(_0x393af9){return _0x393af9[_0xea18('0x6c')](_0x1c8d80[_0xea18('0x45')][_0xea18('0x6d')]);}})[_0xea18('0x20')](respondWithStatusCode(_0x146ea1,null))[_0xea18('0x59')](handleError(_0x146ea1,null));};exports[_0xea18('0x6e')]=function(_0x22b016,_0x7a6b87,_0x4502e8){if(_0x22b016['body']['id']){delete _0x22b016['body']['id'];}return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x22b016[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x7a6b87,null))[_0xea18('0x20')](function(_0x51de7c){if(_0x51de7c){_0x22b016['body'][_0xea18('0x68')]=_0x51de7c['id'];return db[_0xea18('0x6f')]['create'](_0x22b016['body']);}})[_0xea18('0x20')](respondWithResult(_0x7a6b87,null))['catch'](handleError(_0x7a6b87,null));};exports[_0xea18('0x70')]=function(_0x75810f,_0x56f3d8,_0x142107){var _0x284892={'raw':![],'where':{}};var _0x422a31={};var _0x17da2f={'count':0x0,'rows':[]};return db[_0xea18('0x56')][_0xea18('0x71')]({'where':{'id':_0x75810f[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x56f3d8,null))['then'](function(_0x526e50){if(_0x526e50){_0x422a31[_0xea18('0x43')]=_['keys'](db[_0xea18('0x6f')][_0xea18('0x3f')]);_0x422a31[_0xea18('0x45')]=_[_0xea18('0x44')](_0x75810f[_0xea18('0x45')]);_0x422a31[_0xea18('0x46')]=_[_0xea18('0x47')](_0x422a31[_0xea18('0x43')],_0x422a31[_0xea18('0x45')]);_0x284892['attributes']=_['intersection'](_0x422a31[_0xea18('0x43')],qs['fields'](_0x75810f[_0xea18('0x45')][_0xea18('0x48')]));_0x284892[_0xea18('0x49')]=_0x284892[_0xea18('0x49')][_0xea18('0x4a')]?_0x284892[_0xea18('0x49')]:_0x422a31[_0xea18('0x43')];if(!_0x75810f[_0xea18('0x45')][_0xea18('0x4b')]('nolimit')){_0x284892[_0xea18('0x30')]=qs['limit'](_0x75810f[_0xea18('0x45')]['limit']);_0x284892[_0xea18('0x2d')]=qs['offset'](_0x75810f[_0xea18('0x45')]['offset']);}_0x284892['order']=qs['sort'](_0x75810f[_0xea18('0x45')][_0xea18('0x4e')]);_0x284892['where']=qs[_0xea18('0x46')](_['pick'](_0x75810f[_0xea18('0x45')],_0x422a31['filters']));_0x284892['where'][_0xea18('0x68')]=_0x526e50['id'];if(_0x75810f[_0xea18('0x45')][_0xea18('0x50')]){_0x284892[_0xea18('0x4f')]=_[_0xea18('0x51')](_0x284892['where'],{'$or':_['map'](_0x284892[_0xea18('0x49')],function(_0x282652){var _0x2bd9e4={};_0x2bd9e4[_0x282652]={'$like':'%'+_0x75810f[_0xea18('0x45')]['filter']+'%'};return _0x2bd9e4;})});}_0x284892=_[_0xea18('0x51')]({},_0x284892,_0x75810f[_0xea18('0x53')]);return db['CannedAnswer'][_0xea18('0x2f')]({'where':_0x284892[_0xea18('0x4f')]})[_0xea18('0x20')](function(_0x5bb284){_0x17da2f[_0xea18('0x2f')]=_0x5bb284;if(_0x75810f['query'][_0xea18('0x54')]){_0x284892[_0xea18('0x55')]=[{'all':!![]}];}return db[_0xea18('0x6f')]['findAll'](_0x284892);})['then'](function(_0x3d12f5){_0x17da2f[_0xea18('0x58')]=_0x3d12f5;return _0x17da2f;});}})['then'](respondWithFilteredResult(_0x56f3d8,_0x284892))[_0xea18('0x59')](handleError(_0x56f3d8,null));};exports[_0xea18('0x72')]=function(_0x675709,_0x7c46be,_0x17e9e8){return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x675709[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x7c46be,null))['then'](function(_0x1feea5){if(_0x1feea5){return _0x1feea5['removeAnswers'](_0x675709[_0xea18('0x45')][_0xea18('0x6d')]);}})[_0xea18('0x20')](respondWithStatusCode(_0x7c46be,null))[_0xea18('0x59')](handleError(_0x7c46be,null));};exports[_0xea18('0x73')]=function(_0x551c2a,_0x6a3f0b,_0x11ed24){var _0xb37e7={'channel':'sms'};var _0x2fd15a=[];var _0x1c7e4b=[];var _0x2b2ece={};return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x551c2a[_0xea18('0x5a')]['id']},'include':[{'model':db[_0xea18('0x74')],'as':_0xea18('0x75')}]})['then'](handleEntityNotFound(_0x6a3f0b,null))[_0xea18('0x20')](function(_0x458cb6){_0xb37e7['account']=_0x458cb6;_0xb37e7[_0xea18('0x76')]=_[_0xea18('0x77')](_0x458cb6[_0xea18('0x75')],[_0xea18('0x78')],[_0xea18('0x79')]);if(_0xb37e7['account'][_0xea18('0x75')]){delete _0xb37e7[_0xea18('0x7a')]['Applications'];}return db[_0xea18('0x7b')][_0xea18('0x67')]();})[_0xea18('0x20')](function(_0x2c3634){if(!_0x2c3634){throw new db['Sequelize'][(_0xea18('0x7c'))](_0xea18('0x7d'));}_0x2fd15a=_[_0xea18('0x7e')](_['keys'](_0x2c3634),[_0xea18('0x7f'),'updatedAt']);_0x1c7e4b=_['difference'](_[_0xea18('0x44')](_0x2c3634),[_0xea18('0x7f'),'updatedAt',_0xea18('0x80'),_0xea18('0x81')]);_0xb37e7[_0xea18('0x66')]={'mapKey':_0xea18('0x82')};if(_0xb37e7[_0xea18('0x7a')][_0xea18('0x41')]){switch(_0xb37e7[_0xea18('0x7a')][_0xea18('0x41')]){case _0xea18('0x83'):_0xb37e7['body'][_0xea18('0x84')]=_0x551c2a['body'][_0xea18('0x85')];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x86')];_0xb37e7[_0xea18('0x66')][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')]['MessageSid'];break;case _0xea18('0x88'):_0xb37e7['body'][_0xea18('0x84')]='+'+_0x551c2a['body'][_0xea18('0x89')];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x8a')];break;case _0xea18('0x8b'):_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x84')];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a['body'][_0xea18('0x28')];break;case'clicksend':_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x84')];_0xb37e7['body'][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x66')];_0xb37e7[_0xea18('0x66')][_0xea18('0x87')]=_0x551c2a['body']['message_id'];break;case'plivo':_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x85')];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a['body']['Text'];_0xb37e7['body'][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')]['MessageUUID'];break;case _0xea18('0x8c'):_0xb37e7[_0xea18('0x66')]['from']='+'+_0x551c2a[_0xea18('0x66')][_0xea18('0x8d')][0x0][_0xea18('0x84')];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a['body']['results'][0x0][_0xea18('0x8a')];_0xb37e7['body'][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x8d')][0x0][_0xea18('0x87')];break;case _0xea18('0x8e'):_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')]['originatingAddress'];_0xb37e7['body']['body']=_0x551c2a[_0xea18('0x66')][_0xea18('0x8f')][_0xea18('0x28')];break;case _0xea18('0x90'):_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')]['fromNumber'];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x8a')];_0xb37e7['body'][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x91')];break;case'bandwidth':_0xb37e7[_0xea18('0x66')][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')][0x0]['message']['id'];_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')][0x0][_0xea18('0x28')]['from'];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][0x0]['message'][_0xea18('0x8a')];break;case _0xea18('0x92'):_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')]['from'];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x28')];_0xb37e7[_0xea18('0x66')][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')]['refid'];break;}}if(_0xb37e7['body']['id']){delete _0xb37e7[_0xea18('0x66')]['id'];}if(_[_0xea18('0x93')](_0xb37e7['body'][_0xea18('0x84')])){throw new db[(_0xea18('0x94'))][(_0xea18('0x7c'))](_0xea18('0x95'));}if(_[_0xea18('0x93')](_0xb37e7[_0xea18('0x66')][_0xea18('0x66')])||_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]===''){throw new db[(_0xea18('0x94'))][(_0xea18('0x7c'))](_0xea18('0x96'));}if(_[_0xea18('0x93')](_0xb37e7[_0xea18('0x66')]['mapKey'])){throw new db[(_0xea18('0x94'))][(_0xea18('0x7c'))](_0xea18('0x97')+_0x1c7e4b);}if(!_[_0xea18('0x98')](_0x1c7e4b,_0xb37e7[_0xea18('0x66')][_0xea18('0x99')])){throw new db[(_0xea18('0x94'))][(_0xea18('0x7c'))](_0xea18('0x9a')+_0x1c7e4b);}_0x2b2ece[_0xb37e7[_0xea18('0x66')]['mapKey']]=_0xb37e7[_0xea18('0x66')][_0xea18('0x84')];return db['CmList'][_0xea18('0x5c')]({'where':{'id':_0xb37e7[_0xea18('0x7a')]['ListId']},'include':[{'model':db[_0xea18('0x7b')],'as':_0xea18('0x9b'),'where':_0x2b2ece,'limit':0x1,'order':[[_0xea18('0x9c'),_0xea18('0x9d')]]}]});})[_0xea18('0x20')](handleEntityNotFound(_0x6a3f0b,null))[_0xea18('0x20')](function(_0x48442d){if(_0x48442d){_0xb37e7[_0xea18('0x9e')]=_['omit'](_0x48442d,[_0xea18('0x9b')]);if(_0x48442d['Contacts']['length']){return _0x48442d[_0xea18('0x9b')][0x0];}var _0x34f2e5=_[_0xea18('0x17')](_0xb37e7[_0xea18('0x66')],{'firstName':_0xb37e7[_0xea18('0x66')]['from'],'ListId':_0x48442d['id']});_0x34f2e5[_0xb37e7[_0xea18('0x66')][_0xea18('0x99')]]=_0xb37e7[_0xea18('0x66')][_0xea18('0x84')];return db[_0xea18('0x7b')][_0xea18('0x5d')](_0x34f2e5,{'fields':_0x2fd15a,'raw':!![]});}})[_0xea18('0x20')](handleEntityNotFound(_0x6a3f0b,null))[_0xea18('0x20')](function(_0x19404a){if(_0x19404a){_0xb37e7[_0xea18('0x9f')]=_0x19404a;var _0x4e66de={'ContactId':_0x19404a['id'],'phone':_0xb37e7['body'][_0xea18('0x84')],'SmsAccountId':_0x551c2a[_0xea18('0x5a')]['id']};var _0x334c6e={'ContactId':_0x19404a['id'],'SmsAccountId':_0x551c2a['params']['id'],'closed':![]};return db[_0xea18('0xa0')][_0xea18('0x5c')]({'where':_0x334c6e})[_0xea18('0x20')](function(_0x3c691c){if(_0x3c691c){return[_0x3c691c,![]];}return db['SmsInteraction']['create'](_0x4e66de)[_0xea18('0x20')](function(_0x5cb9bc){return[_0x5cb9bc,!![]];});});}})['spread'](function(_0x3c871d,_0x387485){_0xb37e7['interaction']=_0x3c871d['get']({'plain':!![]});_0xb37e7[_0xea18('0xa1')][_0xea18('0xa2')]=![];if(_0x387485){if(_0xb37e7[_0xea18('0x7a')][_0xea18('0xa3')]){_0xb37e7[_0xea18('0x76')][_0xea18('0xa4')]({'id':0x0,'priority':_0xb37e7['applications'][_0xea18('0x4a')]+0x1,'app':_0xea18('0xa5'),'appdata':_0xea18('0xa6'),'interval':'*,*,*,*'});}_0xb37e7[_0xea18('0xa1')]['created']=!![];}return db[_0xea18('0xa7')][_0xea18('0x5d')]({'phone':_0xb37e7[_0xea18('0x66')][_0xea18('0x84')],'messageId':_0xb37e7[_0xea18('0x66')][_0xea18('0x87')],'body':_0xb37e7[_0xea18('0x66')][_0xea18('0x66')],'SmsAccountId':_0x551c2a[_0xea18('0x5a')]['id'],'SmsInteractionId':_0x3c871d['id'],'direction':'in','ContactId':_0x3c871d['ContactId'],'AttachmentId':_0xb37e7[_0xea18('0x66')][_0xea18('0xa8')]});})[_0xea18('0x20')](function(_0x11c66a){_0xb37e7[_0xea18('0x28')]=_0x11c66a;if(!_0xb37e7['interaction'][_0xea18('0xa9')])return;return db[_0xea18('0xaa')][_0xea18('0x5c')]({'attributes':['id',_0xea18('0x3b')],'where':{'id':_0xb37e7[_0xea18('0xa1')]['UserId']}});})[_0xea18('0x20')](function(_0x2ec477){if(_0x2ec477){_0xb37e7[_0xea18('0x76')]['unshift']({'id':0x0,'priority':0x0,'app':_0xea18('0xab'),'appdata':_0x2ec477['name']+','+(_0xb37e7[_0xea18('0x7a')]['waitForTheAssignedAgent']||0xa),'interval':_0xea18('0xac')});}if(!_0xb37e7['interaction'][_0xea18('0xad')])return;return db[_0xea18('0xae')][_0xea18('0x5c')]({'attributes':['id',_0xea18('0x3b')],'where':{'id':_0xb37e7[_0xea18('0xa1')][_0xea18('0xad')]}});})[_0xea18('0x20')](function(_0x379b5d){if(_0x379b5d){_0xb37e7[_0xea18('0x76')][_0xea18('0xaf')]({'id':0x0,'priority':0x1,'app':_0xea18('0xb0'),'appdata':_0x379b5d[_0xea18('0x3b')]+','+(_0xb37e7[_0xea18('0x7a')]['waitForTheAssignedQueue']||0x12c),'interval':_0xea18('0xac')});}return respondWithRpcPromise(_0xea18('0xb1'),_0xea18('0xb2'),_0xb37e7);})[_0xea18('0x20')](function(_0x269cd8){if(_0x269cd8){var _0x2e3849=0xc8;var _0x262e90=_0xea18('0xb3');logger[_0xea18('0x21')](_0xea18('0x24'),_0x262e90,_0x2e3849,_0xea18('0xb4'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x262e90,_0x2e3849,'entity\x20found',JSON['stringify'](_0x269cd8));if(_0xb37e7[_0xea18('0x7a')][_0xea18('0x41')]===_0xea18('0x83')){return _0x6a3f0b[_0xea18('0x2b')](_0x2e3849)[_0xea18('0x31')]('Content-Type',_0xea18('0xb5'))['send'](_0xea18('0xb6'));}else{return _0x6a3f0b['status'](_0x2e3849)[_0xea18('0x33')](_0x269cd8);}}})['catch'](handleError(_0x6a3f0b,null));};exports[_0xea18('0xb7')]=function(_0x4cfab3,_0x52f449){var _0xb531ac=_0x4cfab3['params']['id'];var _0x2281d7=_0x4cfab3['body'];var _0x3116a7=0xc8;var _0x2beff2=null;return db[_0xea18('0xb8')][_0xea18('0xb9')]({'isolationLevel':db[_0xea18('0xb8')]['Transaction'][_0xea18('0xba')]['READ_COMMITTED']},function(_0x2b6cee){return db['SmsAccount'][_0xea18('0x71')]({'where':{'id':_0xb531ac},'transaction':_0x2b6cee})[_0xea18('0x20')](function(_0x5c46b1){if(_0x5c46b1){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0xb531ac},'transaction':_0x2b6cee})[_0xea18('0x20')](function(){var _0xc60f0d=_[_0xea18('0x3e')](_0x2281d7,function(_0x4b9ac2){_0x4b9ac2[_0xea18('0x68')]=_0xb531ac;return _0x4b9ac2;});return db[_0xea18('0x74')]['bulkCreate'](_0xc60f0d,{'transaction':_0x2b6cee});});}else{_0x3116a7=0x194;_0x2beff2=[];}});})[_0xea18('0x20')](function(){if(_0x3116a7!==0x194){return db[_0xea18('0x74')]['findAndCountAll']({'where':{'SmsAccountId':_0xb531ac},'order':_0xea18('0x78')})['then'](function(_0x54c0ae){_0x2beff2=_0x54c0ae;});}})[_0xea18('0x59')](function(_0x442441){_0x3116a7=0x1f4;logger[_0xea18('0x26')](_0x442441[_0xea18('0x3a')]);if(_0x442441[_0xea18('0x3b')]){delete _0x442441[_0xea18('0x3b')];}_0x2beff2=_0x442441;})[_0xea18('0xbb')](function(){if(_0x2beff2===null){_0x52f449[_0xea18('0x2a')](_0x3116a7);}else{if(_0x3116a7===0x1f4){_0x52f449[_0xea18('0x2b')](_0x3116a7)[_0xea18('0xbc')](_0x2beff2);}else{_0x52f449[_0xea18('0x2b')](_0x3116a7)[_0xea18('0x33')](_0x2beff2);}}});};exports[_0xea18('0xbd')]=function(_0x438d6d,_0x3a8a2b,_0x4497cb){var _0x50136d={};var _0x18aa56={};var _0x2ed32b;var _0x35777b;return db[_0xea18('0x56')]['findOne']({'where':{'id':_0x438d6d[_0xea18('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3a8a2b,null))[_0xea18('0x20')](function(_0x465899){if(_0x465899){_0x2ed32b=_0x465899;_0x18aa56[_0xea18('0x43')]=_[_0xea18('0x44')](db['SmsApplication']['rawAttributes']);_0x18aa56[_0xea18('0x45')]=_['keys'](_0x438d6d['query']);_0x18aa56[_0xea18('0x46')]=_[_0xea18('0x47')](_0x18aa56[_0xea18('0x43')],_0x18aa56[_0xea18('0x45')]);_0x50136d[_0xea18('0x49')]=_[_0xea18('0x47')](_0x18aa56['model'],qs[_0xea18('0x48')](_0x438d6d[_0xea18('0x45')][_0xea18('0x48')]));_0x50136d[_0xea18('0x49')]=_0x50136d[_0xea18('0x49')][_0xea18('0x4a')]?_0x50136d['attributes']:_0x18aa56['model'];_0x50136d[_0xea18('0x4d')]=qs['sort'](_0x438d6d[_0xea18('0x45')][_0xea18('0x4e')]);_0x50136d[_0xea18('0x4f')]=qs[_0xea18('0x46')](_[_0xea18('0x6b')](_0x438d6d['query'],_0x18aa56[_0xea18('0x46')]));if(_0x438d6d[_0xea18('0x45')][_0xea18('0x50')]){_0x50136d[_0xea18('0x4f')]=_[_0xea18('0x51')](_0x50136d[_0xea18('0x4f')],{'$or':_[_0xea18('0x3e')](_0x50136d[_0xea18('0x49')],function(_0x31f568){var _0x50a8ff={};_0x50a8ff[_0x31f568]={'$like':'%'+_0x438d6d[_0xea18('0x45')][_0xea18('0x50')]+'%'};return _0x50a8ff;})});}_0x50136d=_[_0xea18('0x51')]({},_0x50136d,_0x438d6d['options']);return _0x2ed32b[_0xea18('0xbd')](_0x50136d);}})['then'](function(_0x3cea1f){if(_0x3cea1f){_0x35777b=_0x3cea1f[_0xea18('0x4a')];if(!_0x438d6d['query'][_0xea18('0x4b')](_0xea18('0x4c'))){_0x50136d[_0xea18('0x30')]=qs['limit'](_0x438d6d[_0xea18('0x45')][_0xea18('0x30')]);_0x50136d['offset']=qs[_0xea18('0x2d')](_0x438d6d[_0xea18('0x45')]['offset']);}return _0x2ed32b[_0xea18('0xbd')](_0x50136d);}})[_0xea18('0x20')](function(_0x4cb137){if(_0x4cb137){return _0x4cb137?{'count':_0x35777b,'rows':_0x4cb137}:null;}})[_0xea18('0x20')](respondWithResult(_0x3a8a2b,null))[_0xea18('0x59')](handleError(_0x3a8a2b,null));};exports['getInteractions']=function(_0x85338c,_0x5eb6d0,_0x416d64){var _0x261933={'raw':![],'where':{}};var _0x54aa89={};var _0x5b0616={'count':0x0,'rows':[]};return db['SmsAccount'][_0xea18('0x71')]({'where':{'id':_0x85338c['params']['id']}})['then'](handleEntityNotFound(_0x5eb6d0,null))[_0xea18('0x20')](function(_0x5d87ac){if(_0x5d87ac){_0x54aa89[_0xea18('0x43')]=_[_0xea18('0x44')](db[_0xea18('0xa0')][_0xea18('0x3f')]);_0x54aa89[_0xea18('0x45')]=_[_0xea18('0x44')](_0x85338c[_0xea18('0x45')]);_0x54aa89[_0xea18('0x46')]=_[_0xea18('0x47')](_0x54aa89['model'],_0x54aa89[_0xea18('0x45')]);_0x261933['attributes']=_[_0xea18('0x47')](_0x54aa89[_0xea18('0x43')],qs[_0xea18('0x48')](_0x85338c[_0xea18('0x45')][_0xea18('0x48')]));_0x261933[_0xea18('0x49')]=_0x261933['attributes'][_0xea18('0x4a')]?_0x261933['attributes']:_0x54aa89[_0xea18('0x43')];if(!_0x85338c[_0xea18('0x45')]['hasOwnProperty'](_0xea18('0x4c'))){_0x261933['limit']=qs[_0xea18('0x30')](_0x85338c[_0xea18('0x45')][_0xea18('0x30')]);_0x261933[_0xea18('0x2d')]=qs[_0xea18('0x2d')](_0x85338c[_0xea18('0x45')][_0xea18('0x2d')]);}_0x261933[_0xea18('0x4d')]=qs[_0xea18('0x4e')](_0x85338c['query'][_0xea18('0x4e')]);_0x261933[_0xea18('0x4f')]=qs[_0xea18('0x46')](_[_0xea18('0x6b')](_0x85338c[_0xea18('0x45')],_0x54aa89[_0xea18('0x46')]));_0x261933[_0xea18('0x4f')][_0xea18('0x68')]=_0x5d87ac['id'];if(_0x85338c[_0xea18('0x45')][_0xea18('0x50')]){_0x261933['where']=_[_0xea18('0x51')](_0x261933['where'],{'$or':_[_0xea18('0x3e')](_0x261933[_0xea18('0x49')],function(_0x453b8f){var _0x399f48={};_0x399f48[_0x453b8f]={'$like':'%'+_0x85338c[_0xea18('0x45')][_0xea18('0x50')]+'%'};return _0x399f48;})});}_0x261933=_[_0xea18('0x51')]({},_0x261933,_0x85338c[_0xea18('0x53')]);return db[_0xea18('0xa0')][_0xea18('0x2f')]({'where':_0x261933[_0xea18('0x4f')]})['then'](function(_0x516244){_0x5b0616[_0xea18('0x2f')]=_0x516244;if(_0x85338c[_0xea18('0x45')]['includeAll']){_0x261933[_0xea18('0x55')]=[{'model':db[_0xea18('0x7b')],'as':_0xea18('0xbe'),'required':![]},{'model':db['User'],'as':_0xea18('0xbf'),'attributes':['name',_0xea18('0xc0'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xea18('0xc1'),'attributes':['id',_0xea18('0x3b'),_0xea18('0xc2')],'where':_0x85338c[_0xea18('0x45')][_0xea18('0xc3')]?{'id':_0x85338c['query'][_0xea18('0xc3')]}:undefined,'required':_0x85338c['query'][_0xea18('0xc3')]?!![]:![]}];}return db[_0xea18('0xa0')]['findAll'](_0x261933);})[_0xea18('0x20')](function(_0xca3f71){_0x5b0616[_0xea18('0x58')]=_0xca3f71;return _0x5b0616;});}})[_0xea18('0x20')](respondWithFilteredResult(_0x5eb6d0,_0x261933))[_0xea18('0x59')](handleError(_0x5eb6d0,null));};exports[_0xea18('0xbc')]=function(_0x32d6c1,_0x4936b6,_0xe34e7){var _0x44abe5,_0x4971e1,_0x37ab56;if(_['isNil'](_0x32d6c1[_0xea18('0x66')][_0xea18('0x66')])||_0x32d6c1[_0xea18('0x66')][_0xea18('0x66')]===''){throw new db[(_0xea18('0x94'))][(_0xea18('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xea18('0x93')](_0x32d6c1[_0xea18('0x66')]['to'])){throw new db['Sequelize'][(_0xea18('0x7c'))]('to\x20is\x20mandatory');}_0x44abe5=_0x32d6c1[_0xea18('0x66')]['to'];return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x32d6c1['params']['id']},'include':[{'model':db[_0xea18('0xc4')],'as':_0xea18('0xc5'),'include':[{'model':db['CmContact'],'as':_0xea18('0x9b'),'where':{'mobile':_0x44abe5},'limit':0x1,'order':[[_0xea18('0x9c'),_0xea18('0x9d')]]}]}]})['then'](handleEntityNotFound(_0x4936b6,null))[_0xea18('0x20')](function(_0x1c6b85){if(_0x1c6b85&&_0x1c6b85['List']){_0x4971e1=_0x1c6b85[_0xea18('0x5f')]({'plain':!![]});if(_0x4971e1[_0xea18('0xc5')]&&_0x4971e1[_0xea18('0xc5')][_0xea18('0x9b')][_0xea18('0x4a')]){return _0x4971e1['List']['Contacts'][0x0];}return db[_0xea18('0x7b')][_0xea18('0x5d')](_['defaults'](_0x32d6c1[_0xea18('0x66')],{'firstName':_0x44abe5,'mobile':_0x44abe5,'phone':_0x44abe5,'ListId':_0x4971e1['ListId']}));}})[_0xea18('0x20')](handleEntityNotFound(_0x4936b6,null))['then'](function(_0x2ca124){if(_0x2ca124){_0x37ab56=_0x2ca124;return db[_0xea18('0xa0')][_0xea18('0x5c')]({'where':{'ContactId':_0x37ab56['id'],'closed':![],'SmsAccountId':_0x4971e1['id']}})[_0xea18('0x20')](function(_0x5095a5){if(_0x5095a5){return[_0x5095a5,![]];}return db[_0xea18('0xa0')]['create']({'UserId':_0x32d6c1[_0xea18('0x5e')]['id'],'ContactId':_0x37ab56['id'],'SmsAccountId':_0x4971e1['id'],'phone':_0x44abe5,'firstMsgDirection':_0xea18('0xc6'),'Messages':[_[_0xea18('0x51')](_0x32d6c1[_0xea18('0x66')],{'read':![],'body':_0x32d6c1[_0xea18('0x66')][_0xea18('0x66')],'phone':_0x44abe5,'SmsAccountId':_0x4971e1['id'],'UserId':_0x32d6c1['user']['id'],'ContactId':_0x37ab56['id']})]},{'include':[{'model':db[_0xea18('0xa7')],'as':_0xea18('0xc7')}]})[_0xea18('0x20')](function(_0x248ae7){return[_0x248ae7,!![]];});});}})['spread'](function(_0x33d8a0,_0x495f8a){if(_0x495f8a){return _0x33d8a0;}return db['SmsMessage'][_0xea18('0x5d')](_[_0xea18('0x51')](_0x32d6c1[_0xea18('0x66')],{'read':![],'body':_0x32d6c1[_0xea18('0x66')][_0xea18('0x66')],'phone':_0x44abe5,'SmsAccountId':_0x4971e1['id'],'SmsInteractionId':_0x33d8a0['id'],'UserId':_0x32d6c1['user']['id'],'ContactId':_0x37ab56['id']}))[_0xea18('0x20')](function(_0x312912){_0x33d8a0['dataValues'][_0xea18('0xc7')]=[];_0x33d8a0[_0xea18('0xc8')]['Messages']['push'](_0x312912['dataValues']);return _0x33d8a0;});})['then'](respondWithResult(_0x4936b6,null))['catch'](handleError(_0x4936b6,null));};exports[_0xea18('0x2b')]=function(_0x16e0f6,_0xc46a,_0x5abf4b){if(_0x16e0f6['body']['id']){delete _0x16e0f6[_0xea18('0x66')]['id'];}var _0x43666c,_0x24ea1e,_0x3fef54;return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x16e0f6[_0xea18('0x5a')]['id']}})['then'](handleEntityNotFound(_0xc46a,null))[_0xea18('0x20')](function(_0x531bec){if(_0x531bec){_0x3fef54=_0x531bec;logger[_0xea18('0xc9')](_0xea18('0x24'),'status','received\x20delivery\x20report\x20from',_0x531bec['type'],util['inspect'](_0x16e0f6['body'],{'showHidden':![],'depth':null}));switch(_0x531bec[_0xea18('0x41')]){case _0xea18('0x88'):if(_0x16e0f6[_0xea18('0x66')]['skebby_dispatch_id']&&_0x16e0f6[_0xea18('0x66')][_0xea18('0x2b')]){_0x24ea1e=_0x16e0f6[_0xea18('0x66')][_0xea18('0x2b')];return db['SmsMessage'][_0xea18('0x5c')]({'where':{'messageId':_0x16e0f6[_0xea18('0x66')]['skebby_dispatch_id']}});}break;case _0xea18('0x8b'):if(_0x16e0f6[_0xea18('0x66')][_0xea18('0xca')]&&_0x16e0f6['body'][_0xea18('0xcb')]){_0x24ea1e=_0x16e0f6[_0xea18('0x66')][_0xea18('0xcb')];return db['SmsMessage'][_0xea18('0x5c')]({'where':{'messageId':_0x16e0f6[_0xea18('0x66')][_0xea18('0xca')]}});}break;case _0xea18('0xcc'):if(_0x16e0f6[_0xea18('0x66')][_0xea18('0xcd')]&&_0x16e0f6[_0xea18('0x66')][_0xea18('0xce')]){_0x24ea1e=_0x16e0f6[_0xea18('0x66')]['status_code'];return db[_0xea18('0xa7')][_0xea18('0x5c')]({'where':{'messageId':_0x16e0f6[_0xea18('0x66')][_0xea18('0xcd')]}});}break;case _0xea18('0x8c'):var _0x2e42ff=_0x16e0f6[_0xea18('0x66')][_0xea18('0x8d')][0x0];if(_0x2e42ff[_0xea18('0x87')]&&_0x2e42ff[_0xea18('0x2b')][_0xea18('0xcf')]===_0xea18('0xd0')){_0x24ea1e=_0x2e42ff[_0xea18('0x2b')][_0xea18('0xcf')];return db[_0xea18('0xa7')][_0xea18('0x5c')]({'where':{'messageId':_0x2e42ff[_0xea18('0x87')]}});}break;case _0xea18('0x90'):if(_0x16e0f6[_0xea18('0x66')][_0xea18('0x87')]&&_0x16e0f6[_0xea18('0x66')]['status']){_0x24ea1e=_0x16e0f6[_0xea18('0x66')][_0xea18('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x16e0f6[_0xea18('0x66')]['messageId']}});}break;case _0xea18('0xd1'):if(_0x16e0f6['body'][0x0][_0xea18('0x28')]['id']){_0x24ea1e=_0x16e0f6[_0xea18('0x66')][0x0][_0xea18('0x41')];return db['SmsMessage'][_0xea18('0x5c')]({'where':{'messageId':_0x16e0f6[_0xea18('0x66')][0x0]['message']['id']}});}break;case _0xea18('0x92'):if(_0x16e0f6[_0xea18('0x66')]['redif']&&_0x16e0f6[_0xea18('0x66')][_0xea18('0x2b')]){_0x24ea1e=_0x16e0f6[_0xea18('0x66')][_0xea18('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x16e0f6[_0xea18('0x66')]['redif']}});}break;}}})[_0xea18('0x20')](handleEntityNotFound(_0xc46a,null))[_0xea18('0x20')](function(_0x4ddda0){if(_0x4ddda0){_0x43666c=_0x4ddda0;switch(_0x3fef54['type']){case _0xea18('0x88'):if(_0x24ea1e===_0xea18('0xd0')){return _0x43666c[_0xea18('0x37')]({'read':!![]});}else{logger[_0xea18('0x26')](_0xea18('0x24'),_0xea18('0x2b'),_0xea18('0x88'),util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case _0xea18('0x8b'):if(_0x24ea1e==='1'){return _0x43666c[_0xea18('0x37')]({'read':!![]});}else{logger[_0xea18('0x26')](_0xea18('0x24'),_0xea18('0x2b'),_0xea18('0x88'),util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x16e0f6['body']['error_code']&&_0x24ea1e>=0xc8&&_0x24ea1e<=0xce){return _0x43666c['update']({'read':!![]});}else{logger[_0xea18('0x26')](_0xea18('0x24'),_0xea18('0x2b'),_0xea18('0xcc'),util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case _0xea18('0x8c'):var _0x40453b=_0x16e0f6['body'][_0xea18('0x8d')][0x0];if(_0x40453b[_0xea18('0x2b')][_0xea18('0xcf')]===_0xea18('0xd0')){return _0x43666c['update']({'read':!![]});}else{logger[_0xea18('0x26')](_0xea18('0x24'),_0xea18('0x2b'),_0xea18('0x8c'),util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x24ea1e==_0xea18('0xd3')||_0x24ea1e==_0xea18('0xd4')){return _0x43666c[_0xea18('0x37')]({'read':!![]});}else{logger[_0xea18('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea18('0x2b'),_0xea18('0x90'),util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case _0xea18('0xd1'):if(_0x24ea1e==_0xea18('0xd5')){return _0x43666c[_0xea18('0x37')]({'read':!![]});}else{logger['error'](_0xea18('0x24'),_0xea18('0x2b'),'bandwidth',util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case _0xea18('0x92'):if(_0x24ea1e===_0xea18('0xd6')||_0x24ea1e===_0xea18('0xd7')){return _0x43666c[_0xea18('0x37')]({'read':!![]});}else{logger[_0xea18('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea18('0x2b'),'intelepeer',util['inspect'](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;}return _0x43666c;}})[_0xea18('0x20')](respondWithResult(_0xc46a,null))[_0xea18('0x59')](handleError(_0xc46a,null));};exports[_0xea18('0xd8')]=function(_0x16ac03,_0x14474e,_0xdd7c97){var _0x1ff9f6,_0x400309,_0x35e43d;return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x16ac03[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x14474e,null))[_0xea18('0x20')](function(_0x34f059){if(_0x34f059){_0x35e43d=_0x34f059;logger[_0xea18('0xc9')](_0xea18('0x24'),_0xea18('0x2b'),_0xea18('0xd9'),_0x34f059[_0xea18('0x41')],util[_0xea18('0xd2')](_0x16ac03['query'],{'showHidden':![],'depth':null}));switch(_0x34f059[_0xea18('0x41')]){case _0xea18('0x8e'):if(_0x16ac03[_0xea18('0x45')][_0xea18('0xda')]&&_0x16ac03[_0xea18('0x45')]['state']){_0x400309=_0x16ac03[_0xea18('0x45')][_0xea18('0xdb')];return db[_0xea18('0xa7')]['find']({'where':{'messageId':_0x16ac03[_0xea18('0x45')][_0xea18('0xda')]}});}break;}}})[_0xea18('0x20')](handleEntityNotFound(_0x14474e,null))[_0xea18('0x20')](function(_0x330895){if(_0x330895){_0x1ff9f6=_0x330895;switch(_0x35e43d[_0xea18('0x41')]){case _0xea18('0x8e'):if(_0x400309==='2'||_0x400309==='6'){return _0x1ff9f6[_0xea18('0x37')]({'read':!![]});}else{logger[_0xea18('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea18('0x2b'),'csc',util[_0xea18('0xd2')](_0x16ac03[_0xea18('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x1ff9f6;}})[_0xea18('0x20')](respondWithResult(_0x14474e,null))['catch'](handleError(_0x14474e,null));};exports[_0xea18('0xdc')]=function(_0x4b8e3d,_0x4854e5,_0x130715){return db['SmsAccount']['find']({'where':{'id':_0x4b8e3d[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x4854e5,null))[_0xea18('0x20')](function(_0x2ba6af){if(_0x2ba6af){return _0x2ba6af['addAgents'](_0x4b8e3d[_0xea18('0x66')][_0xea18('0x6d')],_[_0xea18('0xdd')](_0x4b8e3d[_0xea18('0x66')],[_0xea18('0x6d'),'id'])||{})['spread'](function(_0x4a15fa){for(var _0x4a960b=0x0;_0x4a960b<_0x4b8e3d[_0xea18('0x66')][_0xea18('0x6d')]['length'];_0x4a960b+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x4b8e3d['body']['ids'][_0x4a960b]),'SmsAccountId':Number(_0x4b8e3d['params']['id'])});}return _0x4a15fa;});}})[_0xea18('0x20')](respondWithResult(_0x4854e5,null))[_0xea18('0x59')](handleError(_0x4854e5,null));};exports['removeAgents']=function(_0x12851d,_0x175d02,_0x521700){return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x12851d[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x175d02,null))[_0xea18('0x20')](function(_0xd6c1d9){if(_0xd6c1d9){return _0xd6c1d9[_0xea18('0xde')](_0x12851d[_0xea18('0x45')][_0xea18('0x6d')])[_0xea18('0x20')](function(){if(_[_0xea18('0xdf')](_0x12851d[_0xea18('0x45')][_0xea18('0x6d')])){for(var _0xc90ae8=0x0;_0xc90ae8<_0x12851d[_0xea18('0x45')][_0xea18('0x6d')][_0xea18('0x4a')];_0xc90ae8+=0x1){socket[_0xea18('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x12851d['query']['ids'][_0xc90ae8]),'SmsAccountId':Number(_0x12851d[_0xea18('0x5a')]['id'])});}}else{socket[_0xea18('0xe0')](_0xea18('0xe1'),{'UserId':Number(_0x12851d[_0xea18('0x45')][_0xea18('0x6d')]),'SmsAccountId':Number(_0x12851d['params']['id'])});}});}})[_0xea18('0x20')](respondWithStatusCode(_0x175d02,null))[_0xea18('0x59')](handleError(_0x175d02,null));};exports['getAgents']=function(_0x2c2cdd,_0x244872,_0x73a320){var _0x6212c0={};var _0x761d5a={};var _0x365a69;var _0x36c0a4;return db[_0xea18('0x56')][_0xea18('0x71')]({'where':{'id':_0x2c2cdd[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x244872,null))[_0xea18('0x20')](function(_0x2f5c13){if(_0x2f5c13){_0x365a69=_0x2f5c13;_0x761d5a['model']=_[_0xea18('0x44')](db[_0xea18('0xaa')][_0xea18('0x3f')]);_0x761d5a[_0xea18('0x45')]=_['keys'](_0x2c2cdd[_0xea18('0x45')]);_0x761d5a[_0xea18('0x46')]=_[_0xea18('0x47')](_0x761d5a[_0xea18('0x43')],_0x761d5a['query']);_0x6212c0[_0xea18('0x49')]=_[_0xea18('0x47')](_0x761d5a['model'],qs[_0xea18('0x48')](_0x2c2cdd[_0xea18('0x45')][_0xea18('0x48')]));_0x6212c0[_0xea18('0x49')]=_0x6212c0['attributes'][_0xea18('0x4a')]?_0x6212c0[_0xea18('0x49')]:_0x761d5a[_0xea18('0x43')];_0x6212c0[_0xea18('0x4d')]=qs[_0xea18('0x4e')](_0x2c2cdd[_0xea18('0x45')][_0xea18('0x4e')]);_0x6212c0['where']=qs[_0xea18('0x46')](_[_0xea18('0x6b')](_0x2c2cdd[_0xea18('0x45')],_0x761d5a[_0xea18('0x46')]));if(_0x2c2cdd[_0xea18('0x45')][_0xea18('0x50')]){_0x6212c0[_0xea18('0x4f')]=_['merge'](_0x6212c0[_0xea18('0x4f')],{'$or':_[_0xea18('0x3e')](_0x6212c0[_0xea18('0x49')],function(_0x501441){var _0x287066={};_0x287066[_0x501441]={'$like':'%'+_0x2c2cdd[_0xea18('0x45')][_0xea18('0x50')]+'%'};return _0x287066;})});}_0x6212c0=_[_0xea18('0x51')]({},_0x6212c0,_0x2c2cdd[_0xea18('0x53')]);return _0x365a69[_0xea18('0xe2')](_0x6212c0);}})[_0xea18('0x20')](function(_0x1efc55){if(_0x1efc55){_0x36c0a4=_0x1efc55[_0xea18('0x4a')];if(!_0x2c2cdd[_0xea18('0x45')][_0xea18('0x4b')]('nolimit')){_0x6212c0[_0xea18('0x30')]=qs[_0xea18('0x30')](_0x2c2cdd[_0xea18('0x45')]['limit']);_0x6212c0['offset']=qs[_0xea18('0x2d')](_0x2c2cdd['query'][_0xea18('0x2d')]);}return _0x365a69['getAgents'](_0x6212c0);}})['then'](function(_0x4ab962){if(_0x4ab962){return _0x4ab962?{'count':_0x36c0a4,'rows':_0x4ab962}:null;}})[_0xea18('0x20')](respondWithResult(_0x244872,null))[_0xea18('0x59')](handleError(_0x244872,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index d9bb872..063e2ce 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 _0x761a=['save','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x83d08e,_0x228942){var _0x404d4f=function(_0x161ce){while(--_0x161ce){_0x83d08e['push'](_0x83d08e['shift']());}};_0x404d4f(++_0x228942);}(_0x761a,0x104));var _0xa761=function(_0x44b002,_0x2062a2){_0x44b002=_0x44b002-0x0;var _0x2e3ab4=_0x761a[_0x44b002];return _0x2e3ab4;};'use strict';var EventEmitter=require(_0xa761('0x0'));var SmsAccount=require(_0xa761('0x1'))['db'][_0xa761('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa761('0x3')](0x0);var events={'afterCreate':_0xa761('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x123bef){return function(_0x29f342,_0xaf7e25,_0x473104){SmsAccountEvents[_0xa761('0x5')](_0x123bef+':'+_0x29f342['id'],_0x29f342);SmsAccountEvents[_0xa761('0x5')](_0x123bef,_0x29f342);_0x473104(null);};}for(var e in events){if(events[_0xa761('0x6')](e)){var event=events[e];SmsAccount[_0xa761('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x1750=['hook','../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x11a4ef,_0x5790ce){var _0x311fcb=function(_0x4629d1){while(--_0x4629d1){_0x11a4ef['push'](_0x11a4ef['shift']());}};_0x311fcb(++_0x5790ce);}(_0x1750,0x71));var _0x0175=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x1750[_0x5d4607];return _0x5e4a86;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x0175('0x0'))['db'][_0x0175('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x0175('0x2')](0x0);var events={'afterCreate':_0x0175('0x3'),'afterUpdate':_0x0175('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e3695){return function(_0x210131,_0x283026,_0x2295fa){SmsAccountEvents[_0x0175('0x5')](_0x2e3695+':'+_0x210131['id'],_0x210131);SmsAccountEvents['emit'](_0x2e3695,_0x210131);_0x2295fa(null);};}for(var e in events){if(events[_0x0175('0x6')](e)){var event=events[e];SmsAccount[_0x0175('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 261b118..21f7042 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 _0xe62d=['SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x24ab18,_0x11d696){var _0x5e0ca1=function(_0x9b8dd7){while(--_0x9b8dd7){_0x24ab18['push'](_0x24ab18['shift']());}};_0x5e0ca1(++_0x11d696);}(_0xe62d,0x10a));var _0xde62=function(_0x476123,_0x47b9cc){_0x476123=_0x476123-0x0;var _0x5ca23f=_0xe62d[_0x476123];return _0x5ca23f;};'use strict';var _=require(_0xde62('0x0'));var util=require(_0xde62('0x1'));var logger=require(_0xde62('0x2'))(_0xde62('0x3'));var moment=require(_0xde62('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xde62('0x5'));var rimraf=require(_0xde62('0x6'));var config=require(_0xde62('0x7'));var attributes=require('./smsAccount.attributes');module[_0xde62('0x8')]=function(_0x14c524,_0x1cfb9e){return _0x14c524[_0xde62('0x9')](_0xde62('0xa'),attributes,{'tableName':_0xde62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6353=['./smsAccount.attributes','exports','sms_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x2d42d5,_0x91a418){var _0x1ad892=function(_0x3cd393){while(--_0x3cd393){_0x2d42d5['push'](_0x2d42d5['shift']());}};_0x1ad892(++_0x91a418);}(_0x6353,0xc9));var _0x3635=function(_0x433ae0,_0x209a59){_0x433ae0=_0x433ae0-0x0;var _0x7b57dc=_0x6353[_0x433ae0];return _0x7b57dc;};'use strict';var _=require(_0x3635('0x0'));var util=require(_0x3635('0x1'));var logger=require(_0x3635('0x2'))(_0x3635('0x3'));var moment=require(_0x3635('0x4'));var BPromise=require('bluebird');var rp=require(_0x3635('0x5'));var fs=require('fs');var path=require(_0x3635('0x6'));var rimraf=require('rimraf');var config=require(_0x3635('0x7'));var attributes=require(_0x3635('0x8'));module[_0x3635('0x9')]=function(_0x52d770,_0x5738e2){return _0x52d770['define']('SmsAccount',attributes,{'tableName':_0x3635('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index d30a90d..b00e031 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 _0x2cb2=['request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','util','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register'];(function(_0x20f6dd,_0x17dd5e){var _0x2d16e1=function(_0x193b7a){while(--_0x193b7a){_0x20f6dd['push'](_0x20f6dd['shift']());}};_0x2d16e1(++_0x17dd5e);}(_0x2cb2,0x1f2));var _0x22cb=function(_0x6544dd,_0x1866d7){_0x6544dd=_0x6544dd-0x0;var _0x355f5a=_0x2cb2[_0x6544dd];return _0x355f5a;};'use strict';var _=require('lodash');var util=require(_0x22cb('0x0'));var moment=require('moment');var BPromise=require(_0x22cb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22cb('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x22cb('0x3'));var config=require(_0x22cb('0x4'));var jayson=require(_0x22cb('0x5'));var client=jayson['client'][_0x22cb('0x6')]({'port':0x232a});config[_0x22cb('0x7')]=_['defaults'](config['redis'],{'host':_0x22cb('0x8'),'port':0x18eb});var socket=require(_0x22cb('0x9'))(new Redis(config[_0x22cb('0x7')]));require(_0x22cb('0xa'))[_0x22cb('0xb')](socket);function respondWithRpcPromise(_0x659ce1,_0x641af6,_0x272056){return new BPromise(function(_0x29ee19,_0x1bc8be){return client[_0x22cb('0xc')](_0x659ce1,_0x272056)[_0x22cb('0xd')](function(_0x1057b3){logger[_0x22cb('0xe')](_0x22cb('0xf'),_0x641af6,'request\x20sent');logger[_0x22cb('0x10')](_0x22cb('0x11'),_0x641af6,_0x22cb('0x12'),JSON['stringify'](_0x1057b3));if(_0x1057b3[_0x22cb('0x13')]){if(_0x1057b3[_0x22cb('0x13')][_0x22cb('0x14')]===0x1f4){logger[_0x22cb('0x13')](_0x22cb('0xf'),_0x641af6,_0x1057b3[_0x22cb('0x13')][_0x22cb('0x15')]);return _0x1bc8be(_0x1057b3['error']['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x641af6,_0x1057b3['error'][_0x22cb('0x15')]);return _0x29ee19(_0x1057b3[_0x22cb('0x13')]['message']);}else{logger[_0x22cb('0xe')]('SmsAccount,\x20%s,\x20%s',_0x641af6,_0x22cb('0x12'));_0x29ee19(_0x1057b3[_0x22cb('0x16')][_0x22cb('0x15')]);}})[_0x22cb('0x17')](function(_0x15e46f){logger[_0x22cb('0x13')](_0x22cb('0xf'),_0x641af6,_0x15e46f);_0x1bc8be(_0x15e46f);});});}exports[_0x22cb('0x18')]=function(_0x34cb56){var _0x161520=this;return new Promise(function(_0x1db010,_0x475468){return db[_0x22cb('0x19')][_0x22cb('0x1a')]({'raw':_0x34cb56['options']?_0x34cb56[_0x22cb('0x1b')][_0x22cb('0x1c')]===undefined?!![]:![]:!![],'where':_0x34cb56[_0x22cb('0x1b')]?_0x34cb56['options'][_0x22cb('0x1d')]||null:null,'attributes':_0x34cb56['options']?_0x34cb56[_0x22cb('0x1b')][_0x22cb('0x1e')]||null:null,'include':_0x34cb56[_0x22cb('0x1b')]?_0x34cb56[_0x22cb('0x1b')][_0x22cb('0x1f')]?_[_0x22cb('0x20')](_0x34cb56[_0x22cb('0x1b')][_0x22cb('0x1f')],function(_0x30e247){return{'model':db[_0x30e247['model']],'as':_0x30e247['as'],'attributes':_0x30e247[_0x22cb('0x1e')],'include':_0x30e247[_0x22cb('0x1f')]?_[_0x22cb('0x20')](_0x30e247[_0x22cb('0x1f')],function(_0x4062d0){return{'model':db[_0x4062d0[_0x22cb('0x21')]],'as':_0x4062d0['as'],'attributes':_0x4062d0[_0x22cb('0x1e')],'include':_0x4062d0[_0x22cb('0x1f')]?_[_0x22cb('0x20')](_0x4062d0[_0x22cb('0x1f')],function(_0x207557){return{'model':db[_0x207557[_0x22cb('0x21')]],'as':_0x207557['as'],'attributes':_0x207557[_0x22cb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x22cb('0xd')](function(_0x44deed){logger[_0x22cb('0xe')](_0x22cb('0x18'),_0x34cb56);logger[_0x22cb('0x10')](_0x22cb('0x18'),_0x34cb56,JSON['stringify'](_0x44deed));_0x1db010(_0x44deed);})[_0x22cb('0x17')](function(_0x30d60f){logger[_0x22cb('0x13')](_0x22cb('0x18'),_0x30d60f[_0x22cb('0x15')],_0x34cb56);_0x475468(_0x161520['error'](0x1f4,_0x30d60f['message']));});});}; \ No newline at end of file +var _0x4cb5=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','debug','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5633a1,_0x48990f){var _0x45af69=function(_0xcfb22){while(--_0xcfb22){_0x5633a1['push'](_0x5633a1['shift']());}};_0x45af69(++_0x48990f);}(_0x4cb5,0xc5));var _0x54cb=function(_0x2df387,_0x1d3ea1){_0x2df387=_0x2df387-0x0;var _0x3b1708=_0x4cb5[_0x2df387];return _0x3b1708;};'use strict';var _=require(_0x54cb('0x0'));var util=require('util');var moment=require(_0x54cb('0x1'));var BPromise=require(_0x54cb('0x2'));var rs=require(_0x54cb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x54cb('0x4'))(_0x54cb('0x5'));var config=require(_0x54cb('0x6'));var jayson=require(_0x54cb('0x7'));var client=jayson[_0x54cb('0x8')]['http']({'port':0x232a});config[_0x54cb('0x9')]=_[_0x54cb('0xa')](config[_0x54cb('0x9')],{'host':_0x54cb('0xb'),'port':0x18eb});var socket=require(_0x54cb('0xc'))(new Redis(config[_0x54cb('0x9')]));require(_0x54cb('0xd'))['register'](socket);function respondWithRpcPromise(_0x5581f9,_0xdda621,_0x3fd27b){return new BPromise(function(_0x3c8df8,_0x2f75a8){return client[_0x54cb('0xe')](_0x5581f9,_0x3fd27b)[_0x54cb('0xf')](function(_0x58629a){logger[_0x54cb('0x10')](_0x54cb('0x11'),_0xdda621,_0x54cb('0x12'));logger['debug'](_0x54cb('0x13'),_0xdda621,_0x54cb('0x12'),JSON[_0x54cb('0x14')](_0x58629a));if(_0x58629a[_0x54cb('0x15')]){if(_0x58629a[_0x54cb('0x15')][_0x54cb('0x16')]===0x1f4){logger[_0x54cb('0x15')](_0x54cb('0x11'),_0xdda621,_0x58629a[_0x54cb('0x15')][_0x54cb('0x17')]);return _0x2f75a8(_0x58629a[_0x54cb('0x15')]['message']);}logger[_0x54cb('0x15')](_0x54cb('0x11'),_0xdda621,_0x58629a[_0x54cb('0x15')][_0x54cb('0x17')]);return _0x3c8df8(_0x58629a[_0x54cb('0x15')][_0x54cb('0x17')]);}else{logger[_0x54cb('0x10')](_0x54cb('0x11'),_0xdda621,_0x54cb('0x12'));_0x3c8df8(_0x58629a[_0x54cb('0x18')][_0x54cb('0x17')]);}})[_0x54cb('0x19')](function(_0x2a269b){logger[_0x54cb('0x15')](_0x54cb('0x11'),_0xdda621,_0x2a269b);_0x2f75a8(_0x2a269b);});});}exports[_0x54cb('0x1a')]=function(_0x5a51ba){var _0x2ccf14=this;return new Promise(function(_0x48c252,_0x4ad40f){return db[_0x54cb('0x1b')][_0x54cb('0x1c')]({'raw':_0x5a51ba[_0x54cb('0x1d')]?_0x5a51ba['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a51ba['options']?_0x5a51ba[_0x54cb('0x1d')][_0x54cb('0x1e')]||null:null,'attributes':_0x5a51ba[_0x54cb('0x1d')]?_0x5a51ba[_0x54cb('0x1d')][_0x54cb('0x1f')]||null:null,'include':_0x5a51ba[_0x54cb('0x1d')]?_0x5a51ba[_0x54cb('0x1d')][_0x54cb('0x20')]?_['map'](_0x5a51ba[_0x54cb('0x1d')][_0x54cb('0x20')],function(_0x4df284){return{'model':db[_0x4df284['model']],'as':_0x4df284['as'],'attributes':_0x4df284[_0x54cb('0x1f')],'include':_0x4df284[_0x54cb('0x20')]?_[_0x54cb('0x21')](_0x4df284[_0x54cb('0x20')],function(_0x45281d){return{'model':db[_0x45281d['model']],'as':_0x45281d['as'],'attributes':_0x45281d[_0x54cb('0x1f')],'include':_0x45281d[_0x54cb('0x20')]?_['map'](_0x45281d['include'],function(_0x577d8e){return{'model':db[_0x577d8e[_0x54cb('0x22')]],'as':_0x577d8e['as'],'attributes':_0x577d8e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5464d7){logger['info'](_0x54cb('0x1a'),_0x5a51ba);logger[_0x54cb('0x23')](_0x54cb('0x1a'),_0x5a51ba,JSON[_0x54cb('0x14')](_0x5464d7));_0x48c252(_0x5464d7);})[_0x54cb('0x19')](function(_0x13fb0e){logger[_0x54cb('0x15')](_0x54cb('0x1a'),_0x13fb0e[_0x54cb('0x17')],_0x5a51ba);_0x4ad40f(_0x2ccf14[_0x54cb('0x15')](0x1f4,_0x13fb0e[_0x54cb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index aa785e6..ce7b765 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(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 8e0f352..1265c78 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x5601f8,_0x211c63){var _0x1e1901=function(_0x23be74){while(--_0x23be74){_0x5601f8['push'](_0x5601f8['shift']());}};_0x1e1901(++_0x211c63);}(_0x3e74,0x175));var _0x43e7=function(_0x529b4e,_0x49529d){_0x529b4e=_0x529b4e-0x0;var _0x337b2f=_0x3e74[_0x529b4e];return _0x337b2f;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x3ad00a,_0x59ca09){var _0x115213=function(_0x362552){while(--_0x362552){_0x3ad00a['push'](_0x3ad00a['shift']());}};_0x115213(++_0x59ca09);}(_0x55ca,0x126));var _0xa55c=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x55ca[_0x3b6652];return _0x14d39f;};'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 28cedfb..b7278f0 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 _0xd65d=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xd65d,0x142));var _0xdd65=function(_0x3694e1,_0x2f5ad9){_0x3694e1=_0x3694e1-0x0;var _0x3d4cf0=_0xd65d[_0x3694e1];return _0x3d4cf0;};'use strict';var Sequelize=require('sequelize');module[_0xdd65('0x0')]={'priority':{'type':Sequelize[_0xdd65('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdd65('0x2')],'allowNull':![],'defaultValue':_0xdd65('0x3')},'appdata':{'type':Sequelize[_0xdd65('0x4')]()},'description':{'type':Sequelize[_0xdd65('0x2')]},'interval':{'type':Sequelize[_0xdd65('0x2')],'defaultValue':_0xdd65('0x5')}}; \ No newline at end of file +var _0xf16c=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xf16c,0xfe));var _0xcf16=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf16c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xcf16('0x0'));module['exports']={'priority':{'type':Sequelize[_0xcf16('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xcf16('0x2')],'allowNull':![],'defaultValue':_0xcf16('0x3')},'appdata':{'type':Sequelize[_0xcf16('0x4')]()},'description':{'type':Sequelize[_0xcf16('0x2')]},'interval':{'type':Sequelize[_0xcf16('0x2')],'defaultValue':_0xcf16('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index edf8e7a..12394a2 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 _0xe627=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','SmsApplication','includeAll','rows','catch','show','params','include','find','create'];(function(_0xbd95e7,_0x25de09){var _0x79ff0d=function(_0x3c9c28){while(--_0x3c9c28){_0xbd95e7['push'](_0xbd95e7['shift']());}};_0x79ff0d(++_0x25de09);}(_0xe627,0xeb));var _0x7e62=function(_0x2a8c3e,_0x313d5f){_0x2a8c3e=_0x2a8c3e-0x0;var _0x4eb725=_0xe627[_0x2a8c3e];return _0x4eb725;};'use strict';var emlformat=require(_0x7e62('0x0'));var rimraf=require(_0x7e62('0x1'));var zipdir=require(_0x7e62('0x2'));var jsonpatch=require(_0x7e62('0x3'));var rp=require(_0x7e62('0x4'));var moment=require(_0x7e62('0x5'));var BPromise=require(_0x7e62('0x6'));var Mustache=require(_0x7e62('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7e62('0x8'));var ejs=require(_0x7e62('0x9'));var fs=require('fs');var fs_extra=require(_0x7e62('0xa'));var _=require(_0x7e62('0xb'));var squel=require(_0x7e62('0xc'));var crypto=require(_0x7e62('0xd'));var jsforce=require(_0x7e62('0xe'));var deskjs=require(_0x7e62('0xf'));var toCsv=require(_0x7e62('0x8'));var querystring=require(_0x7e62('0x10'));var Papa=require('papaparse');var Redis=require(_0x7e62('0x11'));var authService=require(_0x7e62('0x12'));var qs=require(_0x7e62('0x13'));var as=require(_0x7e62('0x14'));var hardwareService=require(_0x7e62('0x15'));var logger=require(_0x7e62('0x16'))('api');var utils=require(_0x7e62('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7e62('0x18'));var db=require(_0x7e62('0x19'))['db'];function respondWithStatusCode(_0x11f703,_0x89f9a1){_0x89f9a1=_0x89f9a1||0xcc;return function(_0x5a3a47){if(_0x5a3a47){return _0x11f703[_0x7e62('0x1a')](_0x89f9a1);}return _0x11f703[_0x7e62('0x1b')](_0x89f9a1)[_0x7e62('0x1c')]();};}function respondWithResult(_0x41a40c,_0x1861e4){_0x1861e4=_0x1861e4||0xc8;return function(_0x5569ef){if(_0x5569ef){return _0x41a40c[_0x7e62('0x1b')](_0x1861e4)[_0x7e62('0x1d')](_0x5569ef);}};}function respondWithFilteredResult(_0xa090e2,_0x45a8e2){return function(_0x4c173d){if(_0x4c173d){var _0x2582fd=typeof _0x45a8e2['offset']===_0x7e62('0x1e')&&typeof _0x45a8e2[_0x7e62('0x1f')]===_0x7e62('0x1e');var _0x319894=_0x4c173d[_0x7e62('0x20')];var _0x132b74=_0x2582fd?0x0:_0x45a8e2[_0x7e62('0x21')];var _0x1fff70=_0x2582fd?_0x4c173d['count']:_0x45a8e2[_0x7e62('0x21')]+_0x45a8e2['limit'];var _0x3eaece;if(_0x1fff70>=_0x319894){_0x1fff70=_0x319894;_0x3eaece=0xc8;}else{_0x3eaece=0xce;}_0xa090e2[_0x7e62('0x1b')](_0x3eaece);return _0xa090e2[_0x7e62('0x22')](_0x7e62('0x23'),_0x132b74+'-'+_0x1fff70+'/'+_0x319894)[_0x7e62('0x1d')](_0x4c173d);}return null;};}function patchUpdates(_0x37cd1f){return function(_0x306b2c){try{jsonpatch[_0x7e62('0x24')](_0x306b2c,_0x37cd1f,!![]);}catch(_0x2fd783){return BPromise['reject'](_0x2fd783);}return _0x306b2c[_0x7e62('0x25')]();};}function saveUpdates(_0x645444,_0x547129){return function(_0xd84930){if(_0xd84930){return _0xd84930[_0x7e62('0x26')](_0x645444)[_0x7e62('0x27')](function(_0x56eafd){return _0x56eafd;});}return null;};}function removeEntity(_0x26d2e6,_0x36d583){return function(_0x59e444){if(_0x59e444){return _0x59e444[_0x7e62('0x28')]()[_0x7e62('0x27')](function(){_0x26d2e6[_0x7e62('0x1b')](0xcc)[_0x7e62('0x1c')]();});}};}function handleEntityNotFound(_0x5553fa,_0xb9f35){return function(_0x3f44f6){if(!_0x3f44f6){_0x5553fa['sendStatus'](0x194);}return _0x3f44f6;};}function handleError(_0x9cb35e,_0x497053){_0x497053=_0x497053||0x1f4;return function(_0x12fd04){logger[_0x7e62('0x29')](_0x12fd04[_0x7e62('0x2a')]);if(_0x12fd04[_0x7e62('0x2b')]){delete _0x12fd04[_0x7e62('0x2b')];}_0x9cb35e[_0x7e62('0x1b')](_0x497053)[_0x7e62('0x2c')](_0x12fd04);};}exports[_0x7e62('0x2d')]=function(_0x12bd82,_0x9654ba){var _0x55b39d={},_0x17064a={},_0x2d4e68={'count':0x0,'rows':[]};var _0x1573d2=_['map'](db['SmsApplication'][_0x7e62('0x2e')],function(_0x964bd1){return{'name':_0x964bd1[_0x7e62('0x2f')],'type':_0x964bd1[_0x7e62('0x30')][_0x7e62('0x31')]};});_0x17064a['model']=_[_0x7e62('0x32')](_0x1573d2,_0x7e62('0x2b'));_0x17064a[_0x7e62('0x33')]=_[_0x7e62('0x34')](_0x12bd82[_0x7e62('0x33')]);_0x17064a[_0x7e62('0x35')]=_[_0x7e62('0x36')](_0x17064a[_0x7e62('0x37')],_0x17064a[_0x7e62('0x33')]);_0x55b39d[_0x7e62('0x38')]=_[_0x7e62('0x36')](_0x17064a[_0x7e62('0x37')],qs[_0x7e62('0x39')](_0x12bd82[_0x7e62('0x33')]['fields']));_0x55b39d['attributes']=_0x55b39d[_0x7e62('0x38')][_0x7e62('0x3a')]?_0x55b39d[_0x7e62('0x38')]:_0x17064a[_0x7e62('0x37')];if(!_0x12bd82[_0x7e62('0x33')][_0x7e62('0x3b')]('nolimit')){_0x55b39d['limit']=qs[_0x7e62('0x1f')](_0x12bd82[_0x7e62('0x33')]['limit']);_0x55b39d[_0x7e62('0x21')]=qs['offset'](_0x12bd82[_0x7e62('0x33')][_0x7e62('0x21')]);}_0x55b39d[_0x7e62('0x3c')]=qs[_0x7e62('0x3d')](_0x12bd82[_0x7e62('0x33')][_0x7e62('0x3d')]);_0x55b39d['where']=qs['filters'](_[_0x7e62('0x3e')](_0x12bd82[_0x7e62('0x33')],_0x17064a[_0x7e62('0x35')]),_0x1573d2);if(_0x12bd82['query'][_0x7e62('0x3f')]){_0x55b39d[_0x7e62('0x40')]=_[_0x7e62('0x41')](_0x55b39d[_0x7e62('0x40')],{'$or':_[_0x7e62('0x32')](_0x1573d2,function(_0x416dd9){if(_0x416dd9[_0x7e62('0x30')]!==_0x7e62('0x42')){var _0x1b1fe1={};_0x1b1fe1[_0x416dd9[_0x7e62('0x2b')]]={'$like':'%'+_0x12bd82[_0x7e62('0x33')][_0x7e62('0x3f')]+'%'};return _0x1b1fe1;}})});}_0x55b39d=_[_0x7e62('0x41')]({},_0x55b39d,_0x12bd82[_0x7e62('0x43')]);var _0x2c3669={'where':_0x55b39d[_0x7e62('0x40')]};return db[_0x7e62('0x44')][_0x7e62('0x20')](_0x2c3669)['then'](function(_0x37c155){_0x2d4e68[_0x7e62('0x20')]=_0x37c155;if(_0x12bd82[_0x7e62('0x33')][_0x7e62('0x45')]){_0x55b39d['include']=[{'all':!![]}];}return db[_0x7e62('0x44')]['findAll'](_0x55b39d);})[_0x7e62('0x27')](function(_0x40f8ed){_0x2d4e68[_0x7e62('0x46')]=_0x40f8ed;return _0x2d4e68;})[_0x7e62('0x27')](respondWithFilteredResult(_0x9654ba,_0x55b39d))[_0x7e62('0x47')](handleError(_0x9654ba,null));};exports[_0x7e62('0x48')]=function(_0x4ff06b,_0x435305){var _0x480f72={'raw':!![],'where':{'id':_0x4ff06b[_0x7e62('0x49')]['id']}},_0x2ed7e6={};_0x2ed7e6[_0x7e62('0x37')]=_[_0x7e62('0x34')](db['SmsApplication'][_0x7e62('0x2e')]);_0x2ed7e6['query']=_['keys'](_0x4ff06b[_0x7e62('0x33')]);_0x2ed7e6[_0x7e62('0x35')]=_['intersection'](_0x2ed7e6[_0x7e62('0x37')],_0x2ed7e6['query']);_0x480f72['attributes']=_[_0x7e62('0x36')](_0x2ed7e6[_0x7e62('0x37')],qs[_0x7e62('0x39')](_0x4ff06b['query'][_0x7e62('0x39')]));_0x480f72[_0x7e62('0x38')]=_0x480f72[_0x7e62('0x38')][_0x7e62('0x3a')]?_0x480f72[_0x7e62('0x38')]:_0x2ed7e6[_0x7e62('0x37')];if(_0x4ff06b[_0x7e62('0x33')]['includeAll']){_0x480f72[_0x7e62('0x4a')]=[{'all':!![]}];}_0x480f72=_[_0x7e62('0x41')]({},_0x480f72,_0x4ff06b[_0x7e62('0x43')]);return db[_0x7e62('0x44')][_0x7e62('0x4b')](_0x480f72)['then'](handleEntityNotFound(_0x435305,null))[_0x7e62('0x27')](respondWithResult(_0x435305,null))[_0x7e62('0x47')](handleError(_0x435305,null));};exports[_0x7e62('0x4c')]=function(_0x4425e8,_0x16f047){return db['SmsApplication'][_0x7e62('0x4c')](_0x4425e8[_0x7e62('0x4d')],{})[_0x7e62('0x27')](respondWithResult(_0x16f047,0xc9))[_0x7e62('0x47')](handleError(_0x16f047,null));};exports[_0x7e62('0x26')]=function(_0x57a7c9,_0x141ec8){if(_0x57a7c9['body']['id']){delete _0x57a7c9[_0x7e62('0x4d')]['id'];}return db[_0x7e62('0x44')][_0x7e62('0x4b')]({'where':{'id':_0x57a7c9[_0x7e62('0x49')]['id']}})[_0x7e62('0x27')](handleEntityNotFound(_0x141ec8,null))[_0x7e62('0x27')](saveUpdates(_0x57a7c9[_0x7e62('0x4d')],null))[_0x7e62('0x27')](respondWithResult(_0x141ec8,null))[_0x7e62('0x47')](handleError(_0x141ec8,null));};exports[_0x7e62('0x28')]=function(_0x12ad06,_0x2238f2){return db[_0x7e62('0x44')]['find']({'where':{'id':_0x12ad06[_0x7e62('0x49')]['id']}})[_0x7e62('0x27')](handleEntityNotFound(_0x2238f2,null))[_0x7e62('0x27')](removeEntity(_0x2238f2,null))[_0x7e62('0x47')](handleError(_0x2238f2,null));}; \ No newline at end of file +var _0x4bb4=['../../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','save','update','then','destroy','stack','name','index','SmsApplication','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','show','include','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1100b9,_0x25ff23){var _0x1097f4=function(_0x265da4){while(--_0x265da4){_0x1100b9['push'](_0x1100b9['shift']());}};_0x1097f4(++_0x25ff23);}(_0x4bb4,0x1b9));var _0x44bb=function(_0xd66aa5,_0x1828d0){_0xd66aa5=_0xd66aa5-0x0;var _0x17cbc7=_0x4bb4[_0xd66aa5];return _0x17cbc7;};'use strict';var emlformat=require(_0x44bb('0x0'));var rimraf=require(_0x44bb('0x1'));var zipdir=require(_0x44bb('0x2'));var jsonpatch=require(_0x44bb('0x3'));var rp=require(_0x44bb('0x4'));var moment=require(_0x44bb('0x5'));var BPromise=require(_0x44bb('0x6'));var Mustache=require(_0x44bb('0x7'));var util=require(_0x44bb('0x8'));var path=require(_0x44bb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44bb('0xa'));var _=require(_0x44bb('0xb'));var squel=require(_0x44bb('0xc'));var crypto=require(_0x44bb('0xd'));var jsforce=require(_0x44bb('0xe'));var deskjs=require(_0x44bb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x44bb('0x10'));var Papa=require(_0x44bb('0x11'));var Redis=require(_0x44bb('0x12'));var authService=require(_0x44bb('0x13'));var qs=require(_0x44bb('0x14'));var as=require(_0x44bb('0x15'));var hardwareService=require(_0x44bb('0x16'));var logger=require(_0x44bb('0x17'))(_0x44bb('0x18'));var utils=require(_0x44bb('0x19'));var config=require(_0x44bb('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x44bb('0x1b'))['db'];function respondWithStatusCode(_0x5c7a04,_0x5b8339){_0x5b8339=_0x5b8339||0xcc;return function(_0x46d6cf){if(_0x46d6cf){return _0x5c7a04[_0x44bb('0x1c')](_0x5b8339);}return _0x5c7a04[_0x44bb('0x1d')](_0x5b8339)[_0x44bb('0x1e')]();};}function respondWithResult(_0x3f088a,_0x24d731){_0x24d731=_0x24d731||0xc8;return function(_0xb78dcb){if(_0xb78dcb){return _0x3f088a[_0x44bb('0x1d')](_0x24d731)[_0x44bb('0x1f')](_0xb78dcb);}};}function respondWithFilteredResult(_0x41c015,_0x2827f3){return function(_0x4464d4){if(_0x4464d4){var _0x5d83ce=typeof _0x2827f3[_0x44bb('0x20')]===_0x44bb('0x21')&&typeof _0x2827f3['limit']===_0x44bb('0x21');var _0xb9ab2c=_0x4464d4[_0x44bb('0x22')];var _0x21fd2e=_0x5d83ce?0x0:_0x2827f3[_0x44bb('0x20')];var _0x40e508=_0x5d83ce?_0x4464d4[_0x44bb('0x22')]:_0x2827f3['offset']+_0x2827f3[_0x44bb('0x23')];var _0x40f7c9;if(_0x40e508>=_0xb9ab2c){_0x40e508=_0xb9ab2c;_0x40f7c9=0xc8;}else{_0x40f7c9=0xce;}_0x41c015[_0x44bb('0x1d')](_0x40f7c9);return _0x41c015['set'](_0x44bb('0x24'),_0x21fd2e+'-'+_0x40e508+'/'+_0xb9ab2c)['json'](_0x4464d4);}return null;};}function patchUpdates(_0x3b8810){return function(_0x35f719){try{jsonpatch[_0x44bb('0x25')](_0x35f719,_0x3b8810,!![]);}catch(_0x2d7b6c){return BPromise[_0x44bb('0x26')](_0x2d7b6c);}return _0x35f719[_0x44bb('0x27')]();};}function saveUpdates(_0x51118b,_0x488a3f){return function(_0x1f11a8){if(_0x1f11a8){return _0x1f11a8[_0x44bb('0x28')](_0x51118b)[_0x44bb('0x29')](function(_0x366a4b){return _0x366a4b;});}return null;};}function removeEntity(_0x416e4a,_0x258cf9){return function(_0x47301a){if(_0x47301a){return _0x47301a[_0x44bb('0x2a')]()['then'](function(){_0x416e4a[_0x44bb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b8ca5,_0x479aa0){return function(_0xc6d33d){if(!_0xc6d33d){_0x1b8ca5['sendStatus'](0x194);}return _0xc6d33d;};}function handleError(_0x5904ac,_0x9b6d22){_0x9b6d22=_0x9b6d22||0x1f4;return function(_0x1b387d){logger['error'](_0x1b387d[_0x44bb('0x2b')]);if(_0x1b387d[_0x44bb('0x2c')]){delete _0x1b387d[_0x44bb('0x2c')];}_0x5904ac[_0x44bb('0x1d')](_0x9b6d22)['send'](_0x1b387d);};}exports[_0x44bb('0x2d')]=function(_0x20f85c,_0x4ca1ab){var _0x2553b9={},_0xdfc035={},_0x54efc4={'count':0x0,'rows':[]};var _0x4279a7=_['map'](db[_0x44bb('0x2e')][_0x44bb('0x2f')],function(_0x7ee819){return{'name':_0x7ee819[_0x44bb('0x30')],'type':_0x7ee819[_0x44bb('0x31')][_0x44bb('0x32')]};});_0xdfc035['model']=_[_0x44bb('0x33')](_0x4279a7,'name');_0xdfc035[_0x44bb('0x34')]=_[_0x44bb('0x35')](_0x20f85c['query']);_0xdfc035['filters']=_[_0x44bb('0x36')](_0xdfc035[_0x44bb('0x37')],_0xdfc035[_0x44bb('0x34')]);_0x2553b9['attributes']=_[_0x44bb('0x36')](_0xdfc035[_0x44bb('0x37')],qs[_0x44bb('0x38')](_0x20f85c[_0x44bb('0x34')][_0x44bb('0x38')]));_0x2553b9[_0x44bb('0x39')]=_0x2553b9['attributes'][_0x44bb('0x3a')]?_0x2553b9[_0x44bb('0x39')]:_0xdfc035[_0x44bb('0x37')];if(!_0x20f85c[_0x44bb('0x34')][_0x44bb('0x3b')](_0x44bb('0x3c'))){_0x2553b9['limit']=qs[_0x44bb('0x23')](_0x20f85c['query'][_0x44bb('0x23')]);_0x2553b9[_0x44bb('0x20')]=qs[_0x44bb('0x20')](_0x20f85c['query'][_0x44bb('0x20')]);}_0x2553b9['order']=qs[_0x44bb('0x3d')](_0x20f85c[_0x44bb('0x34')][_0x44bb('0x3d')]);_0x2553b9[_0x44bb('0x3e')]=qs[_0x44bb('0x3f')](_[_0x44bb('0x40')](_0x20f85c['query'],_0xdfc035[_0x44bb('0x3f')]),_0x4279a7);if(_0x20f85c[_0x44bb('0x34')]['filter']){_0x2553b9[_0x44bb('0x3e')]=_[_0x44bb('0x41')](_0x2553b9[_0x44bb('0x3e')],{'$or':_[_0x44bb('0x33')](_0x4279a7,function(_0xc29dcb){if(_0xc29dcb[_0x44bb('0x31')]!==_0x44bb('0x42')){var _0x3cbfe7={};_0x3cbfe7[_0xc29dcb[_0x44bb('0x2c')]]={'$like':'%'+_0x20f85c[_0x44bb('0x34')][_0x44bb('0x43')]+'%'};return _0x3cbfe7;}})});}_0x2553b9=_[_0x44bb('0x41')]({},_0x2553b9,_0x20f85c[_0x44bb('0x44')]);var _0x18c461={'where':_0x2553b9['where']};return db[_0x44bb('0x2e')][_0x44bb('0x22')](_0x18c461)[_0x44bb('0x29')](function(_0x40096f){_0x54efc4[_0x44bb('0x22')]=_0x40096f;if(_0x20f85c[_0x44bb('0x34')][_0x44bb('0x45')]){_0x2553b9['include']=[{'all':!![]}];}return db[_0x44bb('0x2e')][_0x44bb('0x46')](_0x2553b9);})[_0x44bb('0x29')](function(_0x30171e){_0x54efc4['rows']=_0x30171e;return _0x54efc4;})[_0x44bb('0x29')](respondWithFilteredResult(_0x4ca1ab,_0x2553b9))['catch'](handleError(_0x4ca1ab,null));};exports[_0x44bb('0x47')]=function(_0xeccc49,_0x1d8bcc){var _0x1dad62={'raw':!![],'where':{'id':_0xeccc49['params']['id']}},_0x39c0d7={};_0x39c0d7['model']=_[_0x44bb('0x35')](db['SmsApplication'][_0x44bb('0x2f')]);_0x39c0d7[_0x44bb('0x34')]=_[_0x44bb('0x35')](_0xeccc49['query']);_0x39c0d7['filters']=_[_0x44bb('0x36')](_0x39c0d7['model'],_0x39c0d7[_0x44bb('0x34')]);_0x1dad62[_0x44bb('0x39')]=_[_0x44bb('0x36')](_0x39c0d7['model'],qs[_0x44bb('0x38')](_0xeccc49[_0x44bb('0x34')][_0x44bb('0x38')]));_0x1dad62['attributes']=_0x1dad62[_0x44bb('0x39')]['length']?_0x1dad62[_0x44bb('0x39')]:_0x39c0d7[_0x44bb('0x37')];if(_0xeccc49[_0x44bb('0x34')][_0x44bb('0x45')]){_0x1dad62[_0x44bb('0x48')]=[{'all':!![]}];}_0x1dad62=_[_0x44bb('0x41')]({},_0x1dad62,_0xeccc49[_0x44bb('0x44')]);return db['SmsApplication']['find'](_0x1dad62)[_0x44bb('0x29')](handleEntityNotFound(_0x1d8bcc,null))[_0x44bb('0x29')](respondWithResult(_0x1d8bcc,null))[_0x44bb('0x49')](handleError(_0x1d8bcc,null));};exports[_0x44bb('0x4a')]=function(_0x1938ca,_0x49b633){return db['SmsApplication'][_0x44bb('0x4a')](_0x1938ca[_0x44bb('0x4b')],{})[_0x44bb('0x29')](respondWithResult(_0x49b633,0xc9))['catch'](handleError(_0x49b633,null));};exports[_0x44bb('0x28')]=function(_0x1e680b,_0x1b80b3){if(_0x1e680b[_0x44bb('0x4b')]['id']){delete _0x1e680b[_0x44bb('0x4b')]['id'];}return db[_0x44bb('0x2e')]['find']({'where':{'id':_0x1e680b[_0x44bb('0x4c')]['id']}})[_0x44bb('0x29')](handleEntityNotFound(_0x1b80b3,null))[_0x44bb('0x29')](saveUpdates(_0x1e680b[_0x44bb('0x4b')],null))[_0x44bb('0x29')](respondWithResult(_0x1b80b3,null))[_0x44bb('0x49')](handleError(_0x1b80b3,null));};exports['destroy']=function(_0x1c9ad3,_0x173f3){return db[_0x44bb('0x2e')]['find']({'where':{'id':_0x1c9ad3[_0x44bb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x173f3,null))[_0x44bb('0x29')](removeEntity(_0x173f3,null))[_0x44bb('0x49')](handleError(_0x173f3,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index d6f5c68..ed52d14 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 _0xd7b9=['exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5c8a11,_0x10805f){var _0x116b22=function(_0x10a697){while(--_0x10a697){_0x5c8a11['push'](_0x5c8a11['shift']());}};_0x116b22(++_0x10805f);}(_0xd7b9,0x11d));var _0x9d7b=function(_0x338491,_0x25f9f9){_0x338491=_0x338491-0x0;var _0x4bf6fc=_0xd7b9[_0x338491];return _0x4bf6fc;};'use strict';var _=require(_0x9d7b('0x0'));var util=require(_0x9d7b('0x1'));var logger=require(_0x9d7b('0x2'))(_0x9d7b('0x3'));var moment=require(_0x9d7b('0x4'));var BPromise=require(_0x9d7b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d7b('0x6'));var rimraf=require(_0x9d7b('0x7'));var config=require(_0x9d7b('0x8'));var attributes=require('./smsApplication.attributes');module[_0x9d7b('0x9')]=function(_0x1d6346,_0x51c420){return _0x1d6346[_0x9d7b('0xa')](_0x9d7b('0xb'),attributes,{'tableName':_0x9d7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9d7b('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xde5f=['utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4'];(function(_0x451d47,_0x3db835){var _0x1a4219=function(_0x3a160d){while(--_0x3a160d){_0x451d47['push'](_0x451d47['shift']());}};_0x1a4219(++_0x3db835);}(_0xde5f,0x83));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfde5('0x0'));var util=require('util');var logger=require(_0xfde5('0x1'))('api');var moment=require(_0xfde5('0x2'));var BPromise=require(_0xfde5('0x3'));var rp=require(_0xfde5('0x4'));var fs=require('fs');var path=require(_0xfde5('0x5'));var rimraf=require(_0xfde5('0x6'));var config=require('../../config/environment');var attributes=require(_0xfde5('0x7'));module[_0xfde5('0x8')]=function(_0x4f3b89,_0x55746b){return _0x4f3b89['define'](_0xfde5('0x9'),attributes,{'tableName':_0xfde5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfde5('0xb'),'collate':_0xfde5('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c9c02b1..0c67ae3 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 _0x6017=['rpc','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x437f8f,_0x1d5b2b){var _0x45390e=function(_0x1cc917){while(--_0x1cc917){_0x437f8f['push'](_0x437f8f['shift']());}};_0x45390e(++_0x1d5b2b);}(_0x6017,0xae));var _0x7601=function(_0x1bd2c4,_0x4359d1){_0x1bd2c4=_0x1bd2c4-0x0;var _0x4ca1a8=_0x6017[_0x1bd2c4];return _0x4ca1a8;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var moment=require(_0x7601('0x2'));var BPromise=require('bluebird');var rs=require(_0x7601('0x3'));var fs=require('fs');var Redis=require(_0x7601('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7601('0x5'));var logger=require('../../config/logger')(_0x7601('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7601('0x7')][_0x7601('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcb5ed9,_0x34a36d,_0x2bc643){return new BPromise(function(_0xe6e524,_0x4ff3e4){return client[_0x7601('0x9')](_0xcb5ed9,_0x2bc643)[_0x7601('0xa')](function(_0xd3a338){logger['info'](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));logger[_0x7601('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x34a36d,_0x7601('0xc'),JSON[_0x7601('0xe')](_0xd3a338));if(_0xd3a338[_0x7601('0xf')]){if(_0xd3a338[_0x7601('0xf')][_0x7601('0x10')]===0x1f4){logger[_0x7601('0xf')](_0x7601('0xb'),_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0x4ff3e4(_0xd3a338[_0x7601('0xf')]['message']);}logger[_0x7601('0xf')]('SmsApplication,\x20%s,\x20%s',_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0xe6e524(_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);}else{logger[_0x7601('0x12')](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));_0xe6e524(_0xd3a338[_0x7601('0x13')][_0x7601('0x11')]);}})['catch'](function(_0xa0e556){logger[_0x7601('0xf')]('SmsApplication,\x20%s,\x20%s',_0x34a36d,_0xa0e556);_0x4ff3e4(_0xa0e556);});});} \ No newline at end of file +var _0x7e27=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x5b6b28,_0xb71cf){var _0x441405=function(_0x9bbb88){while(--_0x9bbb88){_0x5b6b28['push'](_0x5b6b28['shift']());}};_0x441405(++_0xb71cf);}(_0x7e27,0xdd));var _0x77e2=function(_0x4624c7,_0xe2d475){_0x4624c7=_0x4624c7-0x0;var _0x182f49=_0x7e27[_0x4624c7];return _0x182f49;};'use strict';var _=require(_0x77e2('0x0'));var util=require(_0x77e2('0x1'));var moment=require('moment');var BPromise=require(_0x77e2('0x2'));var rs=require(_0x77e2('0x3'));var fs=require('fs');var Redis=require(_0x77e2('0x4'));var db=require(_0x77e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77e2('0x6'))(_0x77e2('0x7'));var config=require(_0x77e2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x77e2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101e56,_0x137a61,_0x502153){return new BPromise(function(_0x3c2b3f,_0x2cdfa3){return client[_0x77e2('0xa')](_0x101e56,_0x502153)[_0x77e2('0xb')](function(_0x3802ce){logger[_0x77e2('0xc')](_0x77e2('0xd'),_0x137a61,'request\x20sent');logger['debug'](_0x77e2('0xe'),_0x137a61,'request\x20sent',JSON[_0x77e2('0xf')](_0x3802ce));if(_0x3802ce[_0x77e2('0x10')]){if(_0x3802ce['error']['code']===0x1f4){logger[_0x77e2('0x10')](_0x77e2('0xd'),_0x137a61,_0x3802ce['error'][_0x77e2('0x11')]);return _0x2cdfa3(_0x3802ce['error']['message']);}logger[_0x77e2('0x10')](_0x77e2('0xd'),_0x137a61,_0x3802ce[_0x77e2('0x10')][_0x77e2('0x11')]);return _0x3c2b3f(_0x3802ce[_0x77e2('0x10')]['message']);}else{logger[_0x77e2('0xc')](_0x77e2('0xd'),_0x137a61,'request\x20sent');_0x3c2b3f(_0x3802ce[_0x77e2('0x12')][_0x77e2('0x11')]);}})[_0x77e2('0x13')](function(_0x1352c1){logger[_0x77e2('0x10')](_0x77e2('0xd'),_0x137a61,_0x1352c1);_0x2cdfa3(_0x1352c1);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 4766579..d6e700e 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 _0x3423=['/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['post']('/',auth[_0x3342('0xa')](),controller['create']);router[_0x3342('0x11')](_0x3342('0xf'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x11')](_0x3342('0x13'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x16')),controller['addTags']);router[_0x3342('0x17')](_0x3342('0xe'),auth['isAuthenticated'](),interaction[_0x3342('0x14')](_0x3342('0x15'),'smsinteraction:update'),controller['update']);router[_0x3342('0x18')](_0x3342('0xe'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x19')),controller[_0x3342('0x1a')]);router[_0x3342('0x18')](_0x3342('0x13'),auth['isAuthenticated'](),controller[_0x3342('0x1b')]);module[_0x3342('0x1c')]=router; \ No newline at end of file +var _0xb688=['destroy','/:id/tags','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','sms'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb688,0xcf));var _0x8b68=function(_0x322944,_0x282203){_0x322944=_0x322944-0x0;var _0xc8374c=_0xb688[_0x322944];return _0xc8374c;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x14')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x14')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x16')]);router[_0x8b68('0x14')]('/:id/tags',auth[_0x8b68('0xc')](),interaction['tracked']('sms',_0x8b68('0x17')),controller[_0x8b68('0x18')]);router[_0x8b68('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x8b68('0x1a')]('sms',_0x8b68('0x1b')),controller[_0x8b68('0x1c')]);router[_0x8b68('0x1d')](_0x8b68('0xe'),auth['isAuthenticated'](),interaction[_0x8b68('0x1a')](_0x8b68('0x1e'),'smsinteraction:destroy'),controller[_0x8b68('0x1f')]);router[_0x8b68('0x1d')](_0x8b68('0x20'),auth[_0x8b68('0xc')](),controller[_0x8b68('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 f60bc6c..3838257 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 _0xa908=['out','BOOLEAN','INTEGER','sequelize','exports','DATE','STRING','ENUM'];(function(_0x478f5a,_0x272c62){var _0x4e15d7=function(_0x157556){while(--_0x157556){_0x478f5a['push'](_0x478f5a['shift']());}};_0x4e15d7(++_0x272c62);}(_0xa908,0x1c3));var _0x8a90=function(_0x469393,_0x247969){_0x469393=_0x469393-0x0;var _0x5f720d=_0xa908[_0x469393];return _0x5f720d;};'use strict';var Sequelize=require(_0x8a90('0x0'));var moment=require('moment');module[_0x8a90('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8a90('0x2')]},'disposition':{'type':Sequelize[_0x8a90('0x3')]},'secondDisposition':{'type':Sequelize[_0x8a90('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8a90('0x3')]},'note':{'type':Sequelize[_0x8a90('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8a90('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x8a90('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8a90('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8a90('0x4')]('in',_0x8a90('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8a90('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8a90('0x7')]}}; \ No newline at end of file +var _0x6d5e=['DATE','ENUM','out','sequelize','moment','exports','BOOLEAN','STRING'];(function(_0x11b664,_0x5ed6d7){var _0x419ea6=function(_0x2f90bb){while(--_0x2f90bb){_0x11b664['push'](_0x11b664['shift']());}};_0x419ea6(++_0x5ed6d7);}(_0x6d5e,0x103));var _0xe6d5=function(_0x55845f,_0xa3e48b){_0x55845f=_0x55845f-0x0;var _0xa10fa6=_0x6d5e[_0x55845f];return _0xa10fa6;};'use strict';var Sequelize=require(_0xe6d5('0x0'));var moment=require(_0xe6d5('0x1'));module[_0xe6d5('0x2')]={'closed':{'type':Sequelize[_0xe6d5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe6d5('0x4')]},'secondDisposition':{'type':Sequelize[_0xe6d5('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe6d5('0x4')]},'note':{'type':Sequelize[_0xe6d5('0x4')]},'phone':{'type':Sequelize[_0xe6d5('0x4')]},'read1stAt':{'type':Sequelize[_0xe6d5('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xe6d5('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe6d5('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe6d5('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ffb0dd8..2d02fa2 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 _0xf03b=['YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','Tag','name','color','emit','removeTags','download','toString','join','root','server','files','User','push','CmContact','Contact','firstName','lastName','Messages','direction','secret','read','SmsAccount','Owner','fullname','get','mkdirSync','Sms','Account','createdAt','closed','closedAt','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','update','then','destroy','stack','send','index','map','rawAttributes','fieldName','type','key','getOptions','query','user','catch','show','model','keys','SmsInteraction','filters','intersection','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','SmsMessage','params','ids','omit','getMessages','findOne','attributes','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','format'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xf03b,0x19f));var _0xbf03=function(_0xf36a0d,_0x3b603f){_0xf36a0d=_0xf36a0d-0x0;var _0x2da0e7=_0xf03b[_0xf36a0d];return _0x2da0e7;};'use strict';var rimraf=require(_0xbf03('0x0'));var zipdir=require(_0xbf03('0x1'));var moment=require(_0xbf03('0x2'));var BPromise=require(_0xbf03('0x3'));var util=require('util');var path=require(_0xbf03('0x4'));var ejs=require(_0xbf03('0x5'));var fs=require('fs');var _=require(_0xbf03('0x6'));var Redis=require(_0xbf03('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xbf03('0x8'));var pdf=require(_0xbf03('0x9'));var logger=require(_0xbf03('0xa'))(_0xbf03('0xb'));var config=require(_0xbf03('0xc'));var db=require(_0xbf03('0xd'))['db'];config[_0xbf03('0xe')]=_[_0xbf03('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbf03('0x10'))(new Redis(config[_0xbf03('0xe')]));require(_0xbf03('0x11'))[_0xbf03('0x12')](socket);function respondWithStatusCode(_0x5136b6,_0x384ed0){_0x384ed0=_0x384ed0||0xcc;return function(_0x5461d0){if(_0x5461d0){return _0x5136b6[_0xbf03('0x13')](_0x384ed0);}return _0x5136b6[_0xbf03('0x14')](_0x384ed0)[_0xbf03('0x15')]();};}function respondWithResult(_0xe5a032,_0xdf276e){_0xdf276e=_0xdf276e||0xc8;return function(_0xb01e9e){if(_0xb01e9e){return _0xe5a032[_0xbf03('0x14')](_0xdf276e)['json'](_0xb01e9e);}};}function respondWithFilteredResult(_0x1f7879,_0x3e36a9){return function(_0x4af423){if(_0x4af423){var _0x47479b=typeof _0x3e36a9['offset']==='undefined'&&typeof _0x3e36a9['limit']===_0xbf03('0x16');var _0x995ed=_0x4af423[_0xbf03('0x17')];var _0x29e486=_0x47479b?0x0:_0x3e36a9[_0xbf03('0x18')];var _0x3c072d=_0x47479b?_0x4af423[_0xbf03('0x17')]:_0x3e36a9[_0xbf03('0x18')]+_0x3e36a9[_0xbf03('0x19')];var _0x1a5a6d;if(_0x3c072d>=_0x995ed){_0x3c072d=_0x995ed;_0x1a5a6d=0xc8;}else{_0x1a5a6d=0xce;}_0x1f7879['status'](_0x1a5a6d);return _0x1f7879[_0xbf03('0x1a')](_0xbf03('0x1b'),_0x29e486+'-'+_0x3c072d+'/'+_0x995ed)['json'](_0x4af423);}return null;};}function saveUpdates(_0x4a96bb){return function(_0x585e31){if(_0x585e31){return _0x585e31[_0xbf03('0x1c')](_0x4a96bb)[_0xbf03('0x1d')](function(_0xc4260a){return _0xc4260a;});}return null;};}function removeEntity(_0x186b5a){return function(_0x238653){if(_0x238653){return _0x238653[_0xbf03('0x1e')]()['then'](function(){_0x186b5a[_0xbf03('0x14')](0xcc)[_0xbf03('0x15')]();});}};}function handleEntityNotFound(_0x473808){return function(_0x4eb2ed){if(!_0x4eb2ed){_0x473808[_0xbf03('0x13')](0x194);}return _0x4eb2ed;};}function handleError(_0x12bc3b,_0x3f3f41){_0x3f3f41=_0x3f3f41||0x1f4;return function(_0x22f0ec){logger['error'](_0x22f0ec[_0xbf03('0x1f')]);if(_0x22f0ec['name']){delete _0x22f0ec['name'];}_0x12bc3b[_0xbf03('0x14')](_0x3f3f41)[_0xbf03('0x20')](_0x22f0ec);};}exports[_0xbf03('0x21')]=function(_0xc68bdf,_0x49b60d){var _0x5975fc={};var _0x50b236=_[_0xbf03('0x22')](db['SmsInteraction'][_0xbf03('0x23')],function(_0x265bb4){return{'name':_0x265bb4[_0xbf03('0x24')],'type':_0x265bb4[_0xbf03('0x25')][_0xbf03('0x26')]};});_0x5975fc=qs[_0xbf03('0x27')](_0x50b236,_0xc68bdf);return interaction['findAll']('sms',_0xc68bdf[_0xbf03('0x28')],_0xc68bdf[_0xbf03('0x29')],_0x5975fc,_0x50b236)[_0xbf03('0x1d')](respondWithFilteredResult(_0x49b60d,_0x5975fc))[_0xbf03('0x2a')](handleError(_0x49b60d,null));};exports[_0xbf03('0x2b')]=function(_0x2a0942,_0x39c70f){var _0x2159a1={'raw':![],'where':{'id':_0x2a0942['params']['id']}},_0x549bf3={};_0x549bf3[_0xbf03('0x2c')]=_[_0xbf03('0x2d')](db[_0xbf03('0x2e')][_0xbf03('0x23')]);_0x549bf3['query']=_[_0xbf03('0x2d')](_0x2a0942['query']);_0x549bf3[_0xbf03('0x2f')]=_[_0xbf03('0x30')](_0x549bf3[_0xbf03('0x2c')],_0x549bf3[_0xbf03('0x28')]);_0x2159a1['attributes']=_[_0xbf03('0x30')](_0x549bf3[_0xbf03('0x2c')],qs['fields'](_0x2a0942[_0xbf03('0x28')][_0xbf03('0x31')]));_0x2159a1['attributes']=_0x2159a1['attributes'][_0xbf03('0x32')]?_0x2159a1['attributes']:_0x549bf3['model'];if(_0x2a0942[_0xbf03('0x28')][_0xbf03('0x33')]){_0x2159a1[_0xbf03('0x34')]=[{'all':!![]}];}_0x2159a1=_[_0xbf03('0x35')]({},_0x2159a1,_0x2a0942[_0xbf03('0x36')]);return db[_0xbf03('0x2e')]['find'](_0x2159a1)[_0xbf03('0x1d')](handleEntityNotFound(_0x39c70f,null))[_0xbf03('0x1d')](respondWithResult(_0x39c70f,null))[_0xbf03('0x2a')](handleError(_0x39c70f,null));};exports[_0xbf03('0x37')]=function(_0x2ce051,_0x2a2d15){return db[_0xbf03('0x2e')][_0xbf03('0x37')](_0x2ce051[_0xbf03('0x38')],{})['then'](respondWithResult(_0x2a2d15,0xc9))['catch'](handleError(_0x2a2d15,null));};exports['update']=function(_0x135f94,_0x4ae930){if(_0x135f94[_0xbf03('0x38')]['id']){delete _0x135f94['body']['id'];}return db['SmsInteraction'][_0xbf03('0x39')]({'where':{'id':_0x135f94['params']['id']}})['then'](handleEntityNotFound(_0x4ae930,null))['then'](saveUpdates(_0x135f94[_0xbf03('0x38')],null))[_0xbf03('0x1d')](respondWithResult(_0x4ae930,null))[_0xbf03('0x2a')](handleError(_0x4ae930,null));};exports['destroy']=function(_0x47cb3d,_0x4b601a){return db[_0xbf03('0x2e')]['find']({'where':{'id':_0x47cb3d['params']['id']}})[_0xbf03('0x1d')](handleEntityNotFound(_0x4b601a,null))['then'](removeEntity(_0x4b601a,null))[_0xbf03('0x2a')](handleError(_0x4b601a,null));};exports['describe']=function(_0x9c0dd3,_0x2fd76d){return db[_0xbf03('0x2e')][_0xbf03('0x3a')]()[_0xbf03('0x1d')](respondWithResult(_0x2fd76d,null))[_0xbf03('0x2a')](handleError(_0x2fd76d,null));};exports[_0xbf03('0x3b')]=function(_0xda416,_0x227c33){return db[_0xbf03('0x3c')]['find']({'where':{'id':_0xda416[_0xbf03('0x3d')]['id']}})[_0xbf03('0x1d')](handleEntityNotFound(_0x227c33,null))[_0xbf03('0x1d')](function(_0x37ca5c){if(_0x37ca5c){return _0x37ca5c[_0xbf03('0x3b')](_0xda416[_0xbf03('0x38')][_0xbf03('0x3e')],_[_0xbf03('0x3f')](_0xda416[_0xbf03('0x38')],[_0xbf03('0x3e'),'id'])||{});}})[_0xbf03('0x1d')](respondWithResult(_0x227c33,null))[_0xbf03('0x2a')](handleError(_0x227c33,null));};exports[_0xbf03('0x40')]=function(_0x186c3e,_0xe96ef7){var _0x27f98f={'raw':![],'where':{}};var _0x373755={};var _0x5ba356={'count':0x0,'rows':[]};return db[_0xbf03('0x2e')][_0xbf03('0x41')]({'where':{'id':_0x186c3e['params']['id']}})[_0xbf03('0x1d')](handleEntityNotFound(_0xe96ef7,null))[_0xbf03('0x1d')](function(_0x45ef92){if(_0x45ef92){_0x373755[_0xbf03('0x2c')]=_[_0xbf03('0x2d')](db[_0xbf03('0x3c')][_0xbf03('0x23')]);_0x373755[_0xbf03('0x28')]=_[_0xbf03('0x2d')](_0x186c3e[_0xbf03('0x28')]);_0x373755[_0xbf03('0x2f')]=_[_0xbf03('0x30')](_0x373755[_0xbf03('0x2c')],_0x373755[_0xbf03('0x28')]);_0x27f98f['attributes']=_[_0xbf03('0x30')](_0x373755[_0xbf03('0x2c')],qs['fields'](_0x186c3e['query'][_0xbf03('0x31')]));_0x27f98f[_0xbf03('0x42')]=_0x27f98f[_0xbf03('0x42')]['length']?_0x27f98f[_0xbf03('0x42')]:_0x373755[_0xbf03('0x2c')];if(!_0x186c3e[_0xbf03('0x28')][_0xbf03('0x43')](_0xbf03('0x44'))){_0x27f98f[_0xbf03('0x19')]=qs[_0xbf03('0x19')](_0x186c3e[_0xbf03('0x28')][_0xbf03('0x19')]);_0x27f98f[_0xbf03('0x18')]=qs[_0xbf03('0x18')](_0x186c3e['query']['offset']);}_0x27f98f[_0xbf03('0x45')]=qs[_0xbf03('0x46')](_0x186c3e[_0xbf03('0x28')][_0xbf03('0x46')]);_0x27f98f[_0xbf03('0x47')]=qs[_0xbf03('0x2f')](_[_0xbf03('0x48')](_0x186c3e[_0xbf03('0x28')],_0x373755[_0xbf03('0x2f')]));_0x27f98f[_0xbf03('0x47')][_0xbf03('0x49')]=_0x45ef92['id'];if(_0x186c3e[_0xbf03('0x28')][_0xbf03('0x4a')]){_0x27f98f[_0xbf03('0x47')]=_[_0xbf03('0x35')](_0x27f98f[_0xbf03('0x47')],{'$or':_['map'](_0x27f98f['attributes'],function(_0x514186){var _0x198870={};_0x198870[_0x514186]={'$like':'%'+_0x186c3e[_0xbf03('0x28')][_0xbf03('0x4a')]+'%'};return _0x198870;})});}if(_0x186c3e[_0xbf03('0x28')][_0xbf03('0x4b')]){var _0x24b21b=_0x186c3e['query'][_0xbf03('0x4b')]['split'](',');var _0x512aac={};_0x512aac[_0x24b21b[0x0]]={'$gte':moment(_0x24b21b[0x1])[_0xbf03('0x4c')](_0xbf03('0x4d'))};_0x27f98f[_0xbf03('0x47')]=_[_0xbf03('0x35')](_0x27f98f[_0xbf03('0x47')],_0x512aac);}_0x27f98f=_['merge']({},_0x27f98f,_0x186c3e[_0xbf03('0x36')]);return db[_0xbf03('0x3c')][_0xbf03('0x17')]({'where':_0x27f98f[_0xbf03('0x47')]})[_0xbf03('0x1d')](function(_0x5c43ec){_0x5ba356[_0xbf03('0x17')]=_0x5c43ec;if(_0x186c3e['query']['includeAll']){_0x27f98f['include']=[{'all':!![]}];}return db['SmsMessage'][_0xbf03('0x4e')](_0x27f98f);})[_0xbf03('0x1d')](function(_0x1ac8a7){_0x5ba356[_0xbf03('0x4f')]=_0x1ac8a7;return _0x5ba356;});}})[_0xbf03('0x1d')](respondWithFilteredResult(_0xe96ef7,_0x27f98f))['catch'](handleError(_0xe96ef7,null));};exports[_0xbf03('0x50')]=function(_0xbe004e,_0x3874d7){return db[_0xbf03('0x2e')][_0xbf03('0x39')]({'where':{'id':_0xbe004e[_0xbf03('0x3d')]['id']}})[_0xbf03('0x1d')](handleEntityNotFound(_0x3874d7,null))['then'](function(_0x2ed964){if(_0x2ed964){return _0x2ed964['setTags'](_0xbe004e[_0xbf03('0x38')][_0xbf03('0x3e')],_[_0xbf03('0x3f')](_0xbe004e[_0xbf03('0x38')],[_0xbf03('0x3e'),'id'])||{})[_0xbf03('0x51')](function(){return db[_0xbf03('0x52')][_0xbf03('0x4e')]({'attributes':['id',_0xbf03('0x53'),_0xbf03('0x54')],'where':{'id':_0xbe004e[_0xbf03('0x38')][_0xbf03('0x3e')]}});})['then'](function(_0x1db0b9){socket[_0xbf03('0x55')]('smsInteractionTags:save',{'id':Number(_0xbe004e[_0xbf03('0x3d')]['id']),'tags':_0x1db0b9||[]});return{'id':Number(_0xbe004e[_0xbf03('0x3d')]['id']),'tags':_0x1db0b9||[]};});}})[_0xbf03('0x1d')](respondWithResult(_0x3874d7,null))[_0xbf03('0x2a')](handleError(_0x3874d7,null));};exports[_0xbf03('0x56')]=function(_0x2bc4fd,_0x825825){return db[_0xbf03('0x2e')]['find']({'where':{'id':_0x2bc4fd['params']['id']}})[_0xbf03('0x1d')](handleEntityNotFound(_0x825825,null))[_0xbf03('0x1d')](function(_0x1dbcd9){if(_0x1dbcd9){return _0x1dbcd9[_0xbf03('0x56')](_0x2bc4fd['query'][_0xbf03('0x3e')]);}})[_0xbf03('0x1d')](respondWithStatusCode(_0x825825,null))[_0xbf03('0x2a')](handleError(_0x825825,null));};exports[_0xbf03('0x57')]=function(_0x428bea,_0x23566d){var _0x5b353f=moment()['unix']()[_0xbf03('0x58')]();var _0x173f9e=path[_0xbf03('0x59')](config[_0xbf03('0x5a')],_0xbf03('0x5b'),_0xbf03('0x5c'),'tmp');var _0x2212f6=path['join'](_0x173f9e,_0x5b353f);var _0x13ab05=util['format']('transcript-%d-%s.zip',_0x428bea[_0xbf03('0x3d')]['id'],_0x5b353f);var _0x3e602e=path[_0xbf03('0x59')](_0x173f9e,_0x13ab05);var _0x3a6a53=[];_0x3a6a53['push']({'model':db[_0xbf03('0x5d')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3a6a53[_0xbf03('0x5e')]({'model':db[_0xbf03('0x5f')],'as':_0xbf03('0x60'),'attributes':['id',_0xbf03('0x61'),_0xbf03('0x62')],'raw':!![]});var _0xb35ae7=[{'model':db[_0xbf03('0x3c')],'as':_0xbf03('0x63'),'attributes':['id',_0xbf03('0x38'),'createdAt',_0xbf03('0x64'),_0xbf03('0x65'),_0xbf03('0x66')],'include':_0x3a6a53}];_0xb35ae7['push']({'model':db[_0xbf03('0x67')],'as':'Account','attributes':['id',_0xbf03('0x53')]});_0xb35ae7[_0xbf03('0x5e')]({'model':db[_0xbf03('0x5d')],'as':_0xbf03('0x68'),'attributes':['id',_0xbf03('0x69')]});return db[_0xbf03('0x2e')][_0xbf03('0x39')]({'where':{'id':_0x428bea[_0xbf03('0x3d')]['id']},'include':_0xb35ae7})[_0xbf03('0x1d')](handleEntityNotFound(_0x23566d,null))[_0xbf03('0x1d')](function(_0x2cd1ec){if(_0x2cd1ec){var _0x311d81=_0x2cd1ec[_0xbf03('0x6a')]({'plain':!![]});fs[_0xbf03('0x6b')](_0x2212f6);var _0x2e4f7f={'channel':_0xbf03('0x6c'),'account':_0x311d81[_0xbf03('0x6d')][_0xbf03('0x53')],'agent':_0x311d81[_0xbf03('0x68')]?_0x311d81['Owner']['fullname']:'N.A.','createdAt':moment(_0x311d81[_0xbf03('0x6e')])['format'](_0xbf03('0x4d'))[_0xbf03('0x58')](),'closedAt':_0x311d81[_0xbf03('0x6f')]?moment(_0x311d81[_0xbf03('0x70')])['format'](_0xbf03('0x4d'))[_0xbf03('0x58')]():'','disposition':_0x311d81['disposition'],'messages':_(_0x311d81[_0xbf03('0x63')])[_0xbf03('0x4a')]({'secret':![]})[_0xbf03('0x22')](function(_0xcd9708){return{'date':moment(_0xcd9708[_0xbf03('0x6e')])[_0xbf03('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbf03('0x58')](),'sender':_0xcd9708['direction']==='out'?_0xcd9708[_0xbf03('0x5d')]?_0xcd9708[_0xbf03('0x5d')][_0xbf03('0x69')]:'System':_0xcd9708[_0xbf03('0x60')]['firstName']+(_0xcd9708[_0xbf03('0x60')][_0xbf03('0x62')]?'\x20'+_0xcd9708[_0xbf03('0x60')][_0xbf03('0x62')]:''),'body':_0xcd9708['body'],'direction':_0xcd9708[_0xbf03('0x64')]===_0xbf03('0x71')?'A':'C','secret':_0xcd9708[_0xbf03('0x65')],'read':_0xcd9708[_0xbf03('0x66')]};})[_0xbf03('0x72')]()};return ejs[_0xbf03('0x73')](path[_0xbf03('0x59')](config[_0xbf03('0x5a')],_0xbf03('0x5b'),_0xbf03('0x74'),_0xbf03('0x75')),{'interaction':_0x2e4f7f})[_0xbf03('0x1d')](function(_0x528dbf){var _0x1b7e9b=path[_0xbf03('0x59')](_0x2212f6,_0xbf03('0x76')+_0x311d81['id']+'-'+_0x5b353f+_0xbf03('0x77'));var _0xa19833={'path':_0x1b7e9b,'channel':_0xbf03('0x6c'),'interactionId':_0x311d81['id']};return pdf[_0xbf03('0x78')](_0x528dbf,_0xa19833);})['then'](function(){return new BPromise(function(_0x403775,_0x4f65ed){zipdir(_0x2212f6,{'saveTo':_0x3e602e},function(_0x5ace83,_0x5ad59e){if(_0x5ace83)return _0x4f65ed(_0x5ace83);return _0x403775(_0x5ad59e);});})[_0xbf03('0x1d')](function(){return new BPromise(function(_0x1fd9a0,_0x45669d){rimraf(_0x2212f6,function(_0x373cec){if(_0x373cec)_0x45669d(_0x373cec);return _0x1fd9a0();});});})['then'](function(){return _0x23566d['download'](_0x3e602e,_0x13ab05,function(_0x12ab67){if(_0x12ab67){console[_0xbf03('0x79')]('err',_0x12ab67);}else{fs[_0xbf03('0x7a')](_0x3e602e);}});});});}else{return _0x23566d[_0xbf03('0x13')](0xc8);}})[_0xbf03('0x2a')](handleError(_0x23566d,null));}; \ No newline at end of file +var _0x80ce=['createPdfFromHTML','log','err','unlinkSync','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','error','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','sms','user','catch','show','params','model','keys','query','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','sort','pick','where','filter','$gte','split','findAll','rows','setTags','spread','Tag','color','smsInteractionTags:save','removeTags','download','toString','root','files','tmp','format','transcript-%d-%s.zip','join','User','push','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','out','System','Contact','read','renderFile','server','downloadInteraction.ejs','transcript-','.pdf'];(function(_0x342981,_0xffb36b){var _0x321b9b=function(_0x189149){while(--_0x189149){_0x342981['push'](_0x342981['shift']());}};_0x321b9b(++_0xffb36b);}(_0x80ce,0x7d));var _0xe80c=function(_0x23263c,_0x39c3bf){_0x23263c=_0x23263c-0x0;var _0x4952aa=_0x80ce[_0x23263c];return _0x4952aa;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xe80c('0x0'));var util=require(_0xe80c('0x1'));var path=require(_0xe80c('0x2'));var ejs=require(_0xe80c('0x3'));var fs=require('fs');var _=require(_0xe80c('0x4'));var Redis=require(_0xe80c('0x5'));var interaction=require(_0xe80c('0x6'));var qs=require(_0xe80c('0x7'));var pdf=require(_0xe80c('0x8'));var logger=require(_0xe80c('0x9'))(_0xe80c('0xa'));var config=require(_0xe80c('0xb'));var db=require(_0xe80c('0xc'))['db'];config['redis']=_['defaults'](config[_0xe80c('0xd')],{'host':_0xe80c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe80c('0xd')]));require(_0xe80c('0xf'))[_0xe80c('0x10')](socket);function respondWithStatusCode(_0xb0e4f6,_0x23552e){_0x23552e=_0x23552e||0xcc;return function(_0x235156){if(_0x235156){return _0xb0e4f6['sendStatus'](_0x23552e);}return _0xb0e4f6[_0xe80c('0x11')](_0x23552e)[_0xe80c('0x12')]();};}function respondWithResult(_0x59aca3,_0x4f7a7f){_0x4f7a7f=_0x4f7a7f||0xc8;return function(_0x5a8754){if(_0x5a8754){return _0x59aca3['status'](_0x4f7a7f)[_0xe80c('0x13')](_0x5a8754);}};}function respondWithFilteredResult(_0x1f8ea2,_0x2e619d){return function(_0x29c9e8){if(_0x29c9e8){var _0x2246f1=typeof _0x2e619d[_0xe80c('0x14')]===_0xe80c('0x15')&&typeof _0x2e619d[_0xe80c('0x16')]==='undefined';var _0x237665=_0x29c9e8[_0xe80c('0x17')];var _0x4e9612=_0x2246f1?0x0:_0x2e619d[_0xe80c('0x14')];var _0x53b0cb=_0x2246f1?_0x29c9e8[_0xe80c('0x17')]:_0x2e619d[_0xe80c('0x14')]+_0x2e619d[_0xe80c('0x16')];var _0x4d91a3;if(_0x53b0cb>=_0x237665){_0x53b0cb=_0x237665;_0x4d91a3=0xc8;}else{_0x4d91a3=0xce;}_0x1f8ea2[_0xe80c('0x11')](_0x4d91a3);return _0x1f8ea2['set'](_0xe80c('0x18'),_0x4e9612+'-'+_0x53b0cb+'/'+_0x237665)['json'](_0x29c9e8);}return null;};}function saveUpdates(_0x2a9bd0){return function(_0x9a6912){if(_0x9a6912){return _0x9a6912[_0xe80c('0x19')](_0x2a9bd0)[_0xe80c('0x1a')](function(_0x40617a){return _0x40617a;});}return null;};}function removeEntity(_0x220a1d){return function(_0x2cc1c8){if(_0x2cc1c8){return _0x2cc1c8[_0xe80c('0x1b')]()[_0xe80c('0x1a')](function(){_0x220a1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9363){return function(_0x1aff0e){if(!_0x1aff0e){_0x1f9363[_0xe80c('0x1c')](0x194);}return _0x1aff0e;};}function handleError(_0x31878d,_0x24b63c){_0x24b63c=_0x24b63c||0x1f4;return function(_0x31db11){logger[_0xe80c('0x1d')](_0x31db11['stack']);if(_0x31db11[_0xe80c('0x1e')]){delete _0x31db11[_0xe80c('0x1e')];}_0x31878d[_0xe80c('0x11')](_0x24b63c)[_0xe80c('0x1f')](_0x31db11);};}exports[_0xe80c('0x20')]=function(_0x35ec8a,_0x2bbbf3){var _0x30d37b={};var _0x2221f4=_[_0xe80c('0x21')](db[_0xe80c('0x22')][_0xe80c('0x23')],function(_0x1ce71d){return{'name':_0x1ce71d[_0xe80c('0x24')],'type':_0x1ce71d[_0xe80c('0x25')]['key']};});_0x30d37b=qs['getOptions'](_0x2221f4,_0x35ec8a);return interaction['findAll'](_0xe80c('0x26'),_0x35ec8a['query'],_0x35ec8a[_0xe80c('0x27')],_0x30d37b,_0x2221f4)[_0xe80c('0x1a')](respondWithFilteredResult(_0x2bbbf3,_0x30d37b))[_0xe80c('0x28')](handleError(_0x2bbbf3,null));};exports[_0xe80c('0x29')]=function(_0x68b8db,_0xca0868){var _0x488186={'raw':![],'where':{'id':_0x68b8db[_0xe80c('0x2a')]['id']}},_0x342665={};_0x342665[_0xe80c('0x2b')]=_[_0xe80c('0x2c')](db[_0xe80c('0x22')][_0xe80c('0x23')]);_0x342665[_0xe80c('0x2d')]=_[_0xe80c('0x2c')](_0x68b8db[_0xe80c('0x2d')]);_0x342665['filters']=_[_0xe80c('0x2e')](_0x342665[_0xe80c('0x2b')],_0x342665[_0xe80c('0x2d')]);_0x488186['attributes']=_[_0xe80c('0x2e')](_0x342665[_0xe80c('0x2b')],qs['fields'](_0x68b8db['query'][_0xe80c('0x2f')]));_0x488186[_0xe80c('0x30')]=_0x488186[_0xe80c('0x30')][_0xe80c('0x31')]?_0x488186['attributes']:_0x342665[_0xe80c('0x2b')];if(_0x68b8db['query'][_0xe80c('0x32')]){_0x488186[_0xe80c('0x33')]=[{'all':!![]}];}_0x488186=_[_0xe80c('0x34')]({},_0x488186,_0x68b8db[_0xe80c('0x35')]);return db['SmsInteraction'][_0xe80c('0x36')](_0x488186)[_0xe80c('0x1a')](handleEntityNotFound(_0xca0868,null))[_0xe80c('0x1a')](respondWithResult(_0xca0868,null))['catch'](handleError(_0xca0868,null));};exports[_0xe80c('0x37')]=function(_0x4258d4,_0x23b9f6){return db[_0xe80c('0x22')]['create'](_0x4258d4[_0xe80c('0x38')],{})[_0xe80c('0x1a')](respondWithResult(_0x23b9f6,0xc9))[_0xe80c('0x28')](handleError(_0x23b9f6,null));};exports[_0xe80c('0x19')]=function(_0x417d46,_0x4c6174){if(_0x417d46['body']['id']){delete _0x417d46['body']['id'];}return db['SmsInteraction'][_0xe80c('0x36')]({'where':{'id':_0x417d46[_0xe80c('0x2a')]['id']}})[_0xe80c('0x1a')](handleEntityNotFound(_0x4c6174,null))['then'](saveUpdates(_0x417d46['body'],null))[_0xe80c('0x1a')](respondWithResult(_0x4c6174,null))[_0xe80c('0x28')](handleError(_0x4c6174,null));};exports[_0xe80c('0x1b')]=function(_0xd09abb,_0xf88620){return db[_0xe80c('0x22')]['find']({'where':{'id':_0xd09abb[_0xe80c('0x2a')]['id']}})[_0xe80c('0x1a')](handleEntityNotFound(_0xf88620,null))[_0xe80c('0x1a')](removeEntity(_0xf88620,null))[_0xe80c('0x28')](handleError(_0xf88620,null));};exports[_0xe80c('0x39')]=function(_0x5abe23,_0x36e133){return db[_0xe80c('0x22')]['describe']()[_0xe80c('0x1a')](respondWithResult(_0x36e133,null))[_0xe80c('0x28')](handleError(_0x36e133,null));};exports[_0xe80c('0x3a')]=function(_0x21ef02,_0xe48a0b){return db[_0xe80c('0x3b')][_0xe80c('0x36')]({'where':{'id':_0x21ef02[_0xe80c('0x2a')]['id']}})[_0xe80c('0x1a')](handleEntityNotFound(_0xe48a0b,null))[_0xe80c('0x1a')](function(_0x33e8c1){if(_0x33e8c1){return _0x33e8c1[_0xe80c('0x3a')](_0x21ef02[_0xe80c('0x38')]['ids'],_[_0xe80c('0x3c')](_0x21ef02[_0xe80c('0x38')],[_0xe80c('0x3d'),'id'])||{});}})[_0xe80c('0x1a')](respondWithResult(_0xe48a0b,null))['catch'](handleError(_0xe48a0b,null));};exports[_0xe80c('0x3e')]=function(_0x5ac377,_0x174043){var _0x57dd2d={'raw':![],'where':{}};var _0x57eb04={};var _0x475a5e={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xe80c('0x3f')]({'where':{'id':_0x5ac377[_0xe80c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x174043,null))[_0xe80c('0x1a')](function(_0xd7cd34){if(_0xd7cd34){_0x57eb04[_0xe80c('0x2b')]=_['keys'](db[_0xe80c('0x3b')]['rawAttributes']);_0x57eb04[_0xe80c('0x2d')]=_[_0xe80c('0x2c')](_0x5ac377[_0xe80c('0x2d')]);_0x57eb04[_0xe80c('0x40')]=_[_0xe80c('0x2e')](_0x57eb04[_0xe80c('0x2b')],_0x57eb04['query']);_0x57dd2d[_0xe80c('0x30')]=_['intersection'](_0x57eb04[_0xe80c('0x2b')],qs['fields'](_0x5ac377[_0xe80c('0x2d')][_0xe80c('0x2f')]));_0x57dd2d[_0xe80c('0x30')]=_0x57dd2d[_0xe80c('0x30')][_0xe80c('0x31')]?_0x57dd2d['attributes']:_0x57eb04[_0xe80c('0x2b')];if(!_0x5ac377[_0xe80c('0x2d')][_0xe80c('0x41')](_0xe80c('0x42'))){_0x57dd2d[_0xe80c('0x16')]=qs[_0xe80c('0x16')](_0x5ac377[_0xe80c('0x2d')][_0xe80c('0x16')]);_0x57dd2d[_0xe80c('0x14')]=qs[_0xe80c('0x14')](_0x5ac377[_0xe80c('0x2d')]['offset']);}_0x57dd2d['order']=qs[_0xe80c('0x43')](_0x5ac377[_0xe80c('0x2d')]['sort']);_0x57dd2d['where']=qs[_0xe80c('0x40')](_[_0xe80c('0x44')](_0x5ac377['query'],_0x57eb04[_0xe80c('0x40')]));_0x57dd2d[_0xe80c('0x45')]['SmsInteractionId']=_0xd7cd34['id'];if(_0x5ac377['query'][_0xe80c('0x46')]){_0x57dd2d['where']=_['merge'](_0x57dd2d[_0xe80c('0x45')],{'$or':_[_0xe80c('0x21')](_0x57dd2d[_0xe80c('0x30')],function(_0x19f67e){var _0x1be5ff={};_0x1be5ff[_0x19f67e]={'$like':'%'+_0x5ac377[_0xe80c('0x2d')][_0xe80c('0x46')]+'%'};return _0x1be5ff;})});}if(_0x5ac377[_0xe80c('0x2d')]['$gte']){var _0x50c212=_0x5ac377[_0xe80c('0x2d')][_0xe80c('0x47')][_0xe80c('0x48')](',');var _0x369b0c={};_0x369b0c[_0x50c212[0x0]]={'$gte':moment(_0x50c212[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x57dd2d['where']=_[_0xe80c('0x34')](_0x57dd2d[_0xe80c('0x45')],_0x369b0c);}_0x57dd2d=_[_0xe80c('0x34')]({},_0x57dd2d,_0x5ac377[_0xe80c('0x35')]);return db[_0xe80c('0x3b')]['count']({'where':_0x57dd2d[_0xe80c('0x45')]})['then'](function(_0x44f044){_0x475a5e[_0xe80c('0x17')]=_0x44f044;if(_0x5ac377[_0xe80c('0x2d')]['includeAll']){_0x57dd2d[_0xe80c('0x33')]=[{'all':!![]}];}return db[_0xe80c('0x3b')][_0xe80c('0x49')](_0x57dd2d);})[_0xe80c('0x1a')](function(_0x4a630a){_0x475a5e[_0xe80c('0x4a')]=_0x4a630a;return _0x475a5e;});}})[_0xe80c('0x1a')](respondWithFilteredResult(_0x174043,_0x57dd2d))[_0xe80c('0x28')](handleError(_0x174043,null));};exports['addTags']=function(_0x342552,_0x287cb0){return db[_0xe80c('0x22')][_0xe80c('0x36')]({'where':{'id':_0x342552['params']['id']}})['then'](handleEntityNotFound(_0x287cb0,null))[_0xe80c('0x1a')](function(_0x51998d){if(_0x51998d){return _0x51998d[_0xe80c('0x4b')](_0x342552[_0xe80c('0x38')][_0xe80c('0x3d')],_['omit'](_0x342552['body'],[_0xe80c('0x3d'),'id'])||{})[_0xe80c('0x4c')](function(){return db[_0xe80c('0x4d')][_0xe80c('0x49')]({'attributes':['id',_0xe80c('0x1e'),_0xe80c('0x4e')],'where':{'id':_0x342552['body']['ids']}});})[_0xe80c('0x1a')](function(_0x1091a8){socket['emit'](_0xe80c('0x4f'),{'id':Number(_0x342552[_0xe80c('0x2a')]['id']),'tags':_0x1091a8||[]});return{'id':Number(_0x342552['params']['id']),'tags':_0x1091a8||[]};});}})['then'](respondWithResult(_0x287cb0,null))['catch'](handleError(_0x287cb0,null));};exports['removeTags']=function(_0x3d93fd,_0x516960){return db[_0xe80c('0x22')]['find']({'where':{'id':_0x3d93fd[_0xe80c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x516960,null))[_0xe80c('0x1a')](function(_0x39de5d){if(_0x39de5d){return _0x39de5d[_0xe80c('0x50')](_0x3d93fd[_0xe80c('0x2d')]['ids']);}})[_0xe80c('0x1a')](respondWithStatusCode(_0x516960,null))[_0xe80c('0x28')](handleError(_0x516960,null));};exports[_0xe80c('0x51')]=function(_0x538b9a,_0x625a68){var _0x12e238=moment()['unix']()[_0xe80c('0x52')]();var _0x4f67a8=path['join'](config[_0xe80c('0x53')],'server',_0xe80c('0x54'),_0xe80c('0x55'));var _0x12339f=path['join'](_0x4f67a8,_0x12e238);var _0x495bfd=util[_0xe80c('0x56')](_0xe80c('0x57'),_0x538b9a[_0xe80c('0x2a')]['id'],_0x12e238);var _0x47005a=path[_0xe80c('0x58')](_0x4f67a8,_0x495bfd);var _0x184385=[];_0x184385['push']({'model':db[_0xe80c('0x59')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x184385[_0xe80c('0x5a')]({'model':db[_0xe80c('0x5b')],'as':'Contact','attributes':['id',_0xe80c('0x5c'),_0xe80c('0x5d')],'raw':!![]});var _0x518ed0=[{'model':db[_0xe80c('0x3b')],'as':_0xe80c('0x5e'),'attributes':['id','body','createdAt',_0xe80c('0x5f'),_0xe80c('0x60'),'read'],'include':_0x184385}];_0x518ed0[_0xe80c('0x5a')]({'model':db[_0xe80c('0x61')],'as':_0xe80c('0x62'),'attributes':['id','name']});_0x518ed0[_0xe80c('0x5a')]({'model':db[_0xe80c('0x59')],'as':_0xe80c('0x63'),'attributes':['id',_0xe80c('0x64')]});return db[_0xe80c('0x22')][_0xe80c('0x36')]({'where':{'id':_0x538b9a[_0xe80c('0x2a')]['id']},'include':_0x518ed0})[_0xe80c('0x1a')](handleEntityNotFound(_0x625a68,null))[_0xe80c('0x1a')](function(_0x5ed004){if(_0x5ed004){var _0x2dd127=_0x5ed004[_0xe80c('0x65')]({'plain':!![]});fs[_0xe80c('0x66')](_0x12339f);var _0xf86aee={'channel':_0xe80c('0x67'),'account':_0x2dd127['Account'][_0xe80c('0x1e')],'agent':_0x2dd127[_0xe80c('0x63')]?_0x2dd127['Owner'][_0xe80c('0x64')]:_0xe80c('0x68'),'createdAt':moment(_0x2dd127['createdAt'])[_0xe80c('0x56')](_0xe80c('0x69'))[_0xe80c('0x52')](),'closedAt':_0x2dd127[_0xe80c('0x6a')]?moment(_0x2dd127[_0xe80c('0x6b')])[_0xe80c('0x56')](_0xe80c('0x69'))[_0xe80c('0x52')]():'','disposition':_0x2dd127['disposition'],'messages':_(_0x2dd127[_0xe80c('0x5e')])[_0xe80c('0x46')]({'secret':![]})[_0xe80c('0x21')](function(_0x19d10c){return{'date':moment(_0x19d10c['createdAt'])['format'](_0xe80c('0x69'))[_0xe80c('0x52')](),'sender':_0x19d10c['direction']===_0xe80c('0x6c')?_0x19d10c[_0xe80c('0x59')]?_0x19d10c['User']['fullname']:_0xe80c('0x6d'):_0x19d10c['Contact'][_0xe80c('0x5c')]+(_0x19d10c['Contact'][_0xe80c('0x5d')]?'\x20'+_0x19d10c[_0xe80c('0x6e')][_0xe80c('0x5d')]:''),'body':_0x19d10c[_0xe80c('0x38')],'direction':_0x19d10c['direction']==='out'?'A':'C','secret':_0x19d10c['secret'],'read':_0x19d10c[_0xe80c('0x6f')]};})['value']()};return ejs[_0xe80c('0x70')](path[_0xe80c('0x58')](config[_0xe80c('0x53')],_0xe80c('0x71'),'views',_0xe80c('0x72')),{'interaction':_0xf86aee})[_0xe80c('0x1a')](function(_0x16a240){var _0x3d790d=path[_0xe80c('0x58')](_0x12339f,_0xe80c('0x73')+_0x2dd127['id']+'-'+_0x12e238+_0xe80c('0x74'));var _0x36bd0f={'path':_0x3d790d,'channel':_0xe80c('0x67'),'interactionId':_0x2dd127['id']};return pdf[_0xe80c('0x75')](_0x16a240,_0x36bd0f);})[_0xe80c('0x1a')](function(){return new BPromise(function(_0x1a9251,_0x18a8c2){zipdir(_0x12339f,{'saveTo':_0x47005a},function(_0x5e8112,_0x1e0fc0){if(_0x5e8112)return _0x18a8c2(_0x5e8112);return _0x1a9251(_0x1e0fc0);});})[_0xe80c('0x1a')](function(){return new BPromise(function(_0x3170a2,_0x393f3c){rimraf(_0x12339f,function(_0x551fad){if(_0x551fad)_0x393f3c(_0x551fad);return _0x3170a2();});});})[_0xe80c('0x1a')](function(){return _0x625a68['download'](_0x47005a,_0x495bfd,function(_0x40471e){if(_0x40471e){console[_0xe80c('0x76')](_0xe80c('0x77'),_0x40471e);}else{fs[_0xe80c('0x78')](_0x47005a);}});});});}else{return _0x625a68['sendStatus'](0xc8);}})[_0xe80c('0x28')](handleError(_0x625a68,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 1540182..672a6f4 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 _0xfcbb=['catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x5c6a78,_0x5c0503){var _0x236c5e=function(_0x44ef45){while(--_0x44ef45){_0x5c6a78['push'](_0x5c6a78['shift']());}};_0x236c5e(++_0x5c0503);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x492c40,_0xc5ad39){_0x492c40=_0x492c40-0x0;var _0x3e1580=_0xfcbb[_0x492c40];return _0x3e1580;};'use strict';var EventEmitter=require(_0xbfcb('0x0'));var SmsInteraction=require(_0xbfcb('0x1'))['db'][_0xbfcb('0x2')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xbfcb('0x3')](0x0);var events={'afterCreate':_0xbfcb('0x4'),'afterUpdate':_0xbfcb('0x5'),'afterDestroy':_0xbfcb('0x6')};function emitEvent(_0x1d8b50){return function(_0x5c5a1a,_0x5201d3,_0x32c2aa){_0x5c5a1a[_0xbfcb('0x7')]({'attributes':['id'],'raw':!![]})[_0xbfcb('0x8')](function(_0x2df839){_0x5c5a1a[_0xbfcb('0x9')](_0xbfcb('0xa'),_0x2df839[_0xbfcb('0xb')](function(_0x571001){return{'id':_0x571001['id']};}));return SmsMessage[_0xbfcb('0xc')]({'where':{'SmsInteractionId':_0x5c5a1a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbfcb('0x8')](function(_0x346685){_0x5c5a1a['setDataValue'](_0xbfcb('0xd'),_0x346685[_0xbfcb('0xe')]);SmsInteractionEvents[_0xbfcb('0xf')](_0x1d8b50+':'+_0x5c5a1a['id'],_0x5c5a1a);SmsInteractionEvents[_0xbfcb('0xf')](_0x1d8b50,_0x5c5a1a);_0x32c2aa(null);})[_0xbfcb('0x10')](_0x32c2aa(null));};}for(var e in events){if(events[_0xbfcb('0x11')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xbfcb('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x7d25=['SmsMessage','setMaxListeners','save','update','then','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction'];(function(_0x2d28be,_0x339c94){var _0x235041=function(_0x4ccc39){while(--_0x4ccc39){_0x2d28be['push'](_0x2d28be['shift']());}};_0x235041(++_0x339c94);}(_0x7d25,0x8a));var _0x57d2=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x7d25[_0x307d86];return _0x361745;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x57d2('0x0'))['db'][_0x57d2('0x1')];var SmsMessage=require(_0x57d2('0x0'))['db'][_0x57d2('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x57d2('0x3')](0x0);var events={'afterCreate':_0x57d2('0x4'),'afterUpdate':_0x57d2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5337ca){return function(_0x52a4f4,_0x5dea84,_0x3c5511){_0x52a4f4['getUsers']({'attributes':['id'],'raw':!![]})[_0x57d2('0x6')](function(_0x263d35){_0x52a4f4[_0x57d2('0x7')]('Users',_0x263d35['map'](function(_0xeb8b91){return{'id':_0xeb8b91['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x52a4f4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x57d2('0x6')](function(_0x5153c2){_0x52a4f4[_0x57d2('0x7')]('unreadMessages',_0x5153c2[_0x57d2('0x8')]);SmsInteractionEvents[_0x57d2('0x9')](_0x5337ca+':'+_0x52a4f4['id'],_0x52a4f4);SmsInteractionEvents[_0x57d2('0x9')](_0x5337ca,_0x52a4f4);_0x3c5511(null);})[_0x57d2('0xa')](_0x3c5511(null));};}for(var e in events){if(events[_0x57d2('0xb')](e)){var event=events[e];SmsInteraction[_0x57d2('0xc')](e,emitEvent(event));}}module[_0x57d2('0xd')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 1f04616..4839eb7 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 _0x9b43=['define','sms_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x1b0d4c,_0x7e6a1){var _0xb0d298=function(_0x3c0811){while(--_0x3c0811){_0x1b0d4c['push'](_0x1b0d4c['shift']());}};_0xb0d298(++_0x7e6a1);}(_0x9b43,0x135));var _0x39b4=function(_0x5a4eaa,_0x152556){_0x5a4eaa=_0x5a4eaa-0x0;var _0x3f4b8b=_0x9b43[_0x5a4eaa];return _0x3f4b8b;};'use strict';var _=require(_0x39b4('0x0'));var util=require(_0x39b4('0x1'));var logger=require(_0x39b4('0x2'))(_0x39b4('0x3'));var moment=require(_0x39b4('0x4'));var BPromise=require(_0x39b4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39b4('0x6'));var rimraf=require(_0x39b4('0x7'));var config=require(_0x39b4('0x8'));var attributes=require(_0x39b4('0x9'));module[_0x39b4('0xa')]=function(_0x2eb573,_0x1b2e04){return _0x2eb573[_0x39b4('0xb')]('SmsInteraction',attributes,{'tableName':_0x39b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d07fd,_0x43ccab,_0x340ee3){if(_0x5d07fd[_0x39b4('0xd')](_0x39b4('0xe'))){_0x5d07fd['closedAt']=moment()['format'](_0x39b4('0xf'));}_0x340ee3(null,_0x5d07fd);}}});}; \ No newline at end of file +var _0x5444=['../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x321ddc,_0x58f72a){var _0x277f53=function(_0x3ebc0e){while(--_0x3ebc0e){_0x321ddc['push'](_0x321ddc['shift']());}};_0x277f53(++_0x58f72a);}(_0x5444,0x180));var _0x4544=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5444[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4544('0x0'));var util=require(_0x4544('0x1'));var logger=require(_0x4544('0x2'))('api');var moment=require(_0x4544('0x3'));var BPromise=require('bluebird');var rp=require(_0x4544('0x4'));var fs=require('fs');var path=require(_0x4544('0x5'));var rimraf=require(_0x4544('0x6'));var config=require(_0x4544('0x7'));var attributes=require(_0x4544('0x8'));module[_0x4544('0x9')]=function(_0x202774,_0xed5916){return _0x202774[_0x4544('0xa')]('SmsInteraction',attributes,{'tableName':_0x4544('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57cf99,_0x1afb09,_0x5c9a92){if(_0x57cf99[_0x4544('0xc')](_0x4544('0xd'))){_0x57cf99[_0x4544('0xe')]=moment()[_0x4544('0xf')](_0x4544('0x10'));}_0x5c9a92(null,_0x57cf99);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ce8935c..bfc1e65 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 _0x88ae=['info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','then','debug','stringify','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register'];(function(_0x1acfb9,_0x52bc80){var _0x1416e3=function(_0x1909d1){while(--_0x1909d1){_0x1acfb9['push'](_0x1acfb9['shift']());}};_0x1416e3(++_0x52bc80);}(_0x88ae,0x1dc));var _0xe88a=function(_0x9e671f,_0x2d25ac){_0x9e671f=_0x9e671f-0x0;var _0x2f6959=_0x88ae[_0x9e671f];return _0x2f6959;};'use strict';var _=require(_0xe88a('0x0'));var util=require(_0xe88a('0x1'));var moment=require(_0xe88a('0x2'));var BPromise=require(_0xe88a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe88a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe88a('0x5'));var logger=require(_0xe88a('0x6'))('rpc');var config=require(_0xe88a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe88a('0x8')][_0xe88a('0x9')]({'port':0x232a});config[_0xe88a('0xa')]=_[_0xe88a('0xb')](config[_0xe88a('0xa')],{'host':_0xe88a('0xc'),'port':0x18eb});var socket=require(_0xe88a('0xd'))(new Redis(config[_0xe88a('0xa')]));require(_0xe88a('0xe'))[_0xe88a('0xf')](socket);function respondWithRpcPromise(_0x1c5022,_0x1c246c,_0x1022f7){return new BPromise(function(_0x5b4823,_0x23887a){return client['request'](_0x1c5022,_0x1022f7)['then'](function(_0x554404){logger[_0xe88a('0x10')](_0xe88a('0x11'),_0x1c246c,_0xe88a('0x12'));logger['debug'](_0xe88a('0x13'),_0x1c246c,_0xe88a('0x12'),JSON['stringify'](_0x554404));if(_0x554404['error']){if(_0x554404[_0xe88a('0x14')][_0xe88a('0x15')]===0x1f4){logger['error'](_0xe88a('0x11'),_0x1c246c,_0x554404[_0xe88a('0x14')][_0xe88a('0x16')]);return _0x23887a(_0x554404[_0xe88a('0x14')][_0xe88a('0x16')]);}logger[_0xe88a('0x14')](_0xe88a('0x11'),_0x1c246c,_0x554404[_0xe88a('0x14')][_0xe88a('0x16')]);return _0x5b4823(_0x554404['error']['message']);}else{logger[_0xe88a('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x1c246c,_0xe88a('0x12'));_0x5b4823(_0x554404['result']['message']);}})[_0xe88a('0x17')](function(_0x3c146c){logger['error'](_0xe88a('0x11'),_0x1c246c,_0x3c146c);_0x23887a(_0x3c146c);});});}exports[_0xe88a('0x18')]=function(_0x19ab32){var _0x31d295=this;return new Promise(function(_0x4b1b01,_0xab4d23){return db[_0xe88a('0x19')]['update'](_0x19ab32[_0xe88a('0x1a')],{'raw':_0x19ab32[_0xe88a('0x1b')]?_0x19ab32[_0xe88a('0x1b')][_0xe88a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19ab32[_0xe88a('0x1b')]?_0x19ab32[_0xe88a('0x1b')][_0xe88a('0x1d')]||null:null,'attributes':_0x19ab32[_0xe88a('0x1b')]?_0x19ab32['options'][_0xe88a('0x1e')]||null:null,'limit':_0x19ab32[_0xe88a('0x1b')]?_0x19ab32[_0xe88a('0x1b')][_0xe88a('0x1f')]||null:null})[_0xe88a('0x20')](function(_0x282f57){logger['info']('UpdateSmsInteraction',_0x19ab32);logger[_0xe88a('0x21')](_0xe88a('0x18'),_0x19ab32,JSON[_0xe88a('0x22')](_0x282f57));_0x4b1b01(_0x282f57);})[_0xe88a('0x17')](function(_0xf7a605){logger['error'](_0xe88a('0x18'),_0xf7a605[_0xe88a('0x16')],_0x19ab32);_0xab4d23(_0x31d295[_0xe88a('0x14')](0x1f4,_0xf7a605[_0xe88a('0x16')]));});});};exports[_0xe88a('0x23')]=function(_0x156eef){return new Promise(function(_0x18c2ee,_0x322298){return db['SmsInteraction']['find']({'where':_0x156eef['options']?_0x156eef[_0xe88a('0x1b')][_0xe88a('0x1d')]||null:null})[_0xe88a('0x20')](function(_0x21be32){if(_0x21be32){return _0x21be32[_0xe88a('0x24')](_0x156eef[_0xe88a('0x1a')][_0xe88a('0x25')],_[_0xe88a('0x26')](_0x156eef[_0xe88a('0x1a')],[_0xe88a('0x25'),'id'])||{});}})[_0xe88a('0x27')](function(_0x3e18d9){logger[_0xe88a('0x10')](_0xe88a('0x28'),_0x156eef);logger[_0xe88a('0x21')](_0xe88a('0x28'),_0x156eef,JSON[_0xe88a('0x22')](_0x3e18d9));_0x18c2ee(_0x3e18d9);})[_0xe88a('0x17')](function(_0x1e2b55){logger[_0xe88a('0x14')](_0xe88a('0x28'),_0x1e2b55[_0xe88a('0x16')],_0x156eef);_0x322298(_this[_0xe88a('0x14')](0x1f4,_0x1e2b55['message']));});});}; \ No newline at end of file +var _0x705b=['SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','limit','AddTagsToSmsInteraction','find','addTags','body','omit','ids','AddTags','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info'];(function(_0x13d2d5,_0x39e8be){var _0x53ffcc=function(_0x438e70){while(--_0x438e70){_0x13d2d5['push'](_0x13d2d5['shift']());}};_0x53ffcc(++_0x39e8be);}(_0x705b,0xe4));var _0xb705=function(_0x135a36,_0x2fcf5f){_0x135a36=_0x135a36-0x0;var _0x3571d3=_0x705b[_0x135a36];return _0x3571d3;};'use strict';var _=require(_0xb705('0x0'));var util=require(_0xb705('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb705('0x2'));var db=require(_0xb705('0x3'))['db'];var utils=require(_0xb705('0x4'));var logger=require(_0xb705('0x5'))('rpc');var config=require(_0xb705('0x6'));var jayson=require(_0xb705('0x7'));var client=jayson[_0xb705('0x8')][_0xb705('0x9')]({'port':0x232a});config[_0xb705('0xa')]=_[_0xb705('0xb')](config[_0xb705('0xa')],{'host':_0xb705('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb705('0xa')]));require(_0xb705('0xd'))[_0xb705('0xe')](socket);function respondWithRpcPromise(_0x5a4515,_0x4162bf,_0xf6e9a8){return new BPromise(function(_0x35727f,_0x1651fe){return client[_0xb705('0xf')](_0x5a4515,_0xf6e9a8)[_0xb705('0x10')](function(_0x504121){logger[_0xb705('0x11')](_0xb705('0x12'),_0x4162bf,'request\x20sent');logger[_0xb705('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x4162bf,_0xb705('0x14'),JSON[_0xb705('0x15')](_0x504121));if(_0x504121[_0xb705('0x16')]){if(_0x504121[_0xb705('0x16')][_0xb705('0x17')]===0x1f4){logger[_0xb705('0x16')](_0xb705('0x12'),_0x4162bf,_0x504121[_0xb705('0x16')][_0xb705('0x18')]);return _0x1651fe(_0x504121['error'][_0xb705('0x18')]);}logger['error'](_0xb705('0x12'),_0x4162bf,_0x504121[_0xb705('0x16')][_0xb705('0x18')]);return _0x35727f(_0x504121['error'][_0xb705('0x18')]);}else{logger[_0xb705('0x11')](_0xb705('0x12'),_0x4162bf,_0xb705('0x14'));_0x35727f(_0x504121[_0xb705('0x19')][_0xb705('0x18')]);}})[_0xb705('0x1a')](function(_0x152307){logger[_0xb705('0x16')](_0xb705('0x12'),_0x4162bf,_0x152307);_0x1651fe(_0x152307);});});}exports[_0xb705('0x1b')]=function(_0x4e3350){var _0x1da946=this;return new Promise(function(_0x17d37f,_0x121189){return db[_0xb705('0x1c')][_0xb705('0x1d')](_0x4e3350['body'],{'raw':_0x4e3350[_0xb705('0x1e')]?_0x4e3350[_0xb705('0x1e')][_0xb705('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e3350[_0xb705('0x1e')]?_0x4e3350[_0xb705('0x1e')][_0xb705('0x20')]||null:null,'attributes':_0x4e3350['options']?_0x4e3350[_0xb705('0x1e')]['attributes']||null:null,'limit':_0x4e3350['options']?_0x4e3350[_0xb705('0x1e')][_0xb705('0x21')]||null:null})[_0xb705('0x10')](function(_0x3f8f43){logger[_0xb705('0x11')](_0xb705('0x1b'),_0x4e3350);logger[_0xb705('0x13')](_0xb705('0x1b'),_0x4e3350,JSON[_0xb705('0x15')](_0x3f8f43));_0x17d37f(_0x3f8f43);})[_0xb705('0x1a')](function(_0x14353){logger['error'](_0xb705('0x1b'),_0x14353[_0xb705('0x18')],_0x4e3350);_0x121189(_0x1da946[_0xb705('0x16')](0x1f4,_0x14353[_0xb705('0x18')]));});});};exports[_0xb705('0x22')]=function(_0x37dc92){return new Promise(function(_0xc3279f,_0x250b03){return db[_0xb705('0x1c')][_0xb705('0x23')]({'where':_0x37dc92['options']?_0x37dc92[_0xb705('0x1e')][_0xb705('0x20')]||null:null})[_0xb705('0x10')](function(_0xf5f2be){if(_0xf5f2be){return _0xf5f2be[_0xb705('0x24')](_0x37dc92[_0xb705('0x25')]['ids'],_[_0xb705('0x26')](_0x37dc92[_0xb705('0x25')],[_0xb705('0x27'),'id'])||{});}})['spread'](function(_0x343cbc){logger[_0xb705('0x11')]('AddTags',_0x37dc92);logger['debug'](_0xb705('0x28'),_0x37dc92,JSON['stringify'](_0x343cbc));_0xc3279f(_0x343cbc);})['catch'](function(_0x1cb6be){logger[_0xb705('0x16')](_0xb705('0x28'),_0x1cb6be[_0xb705('0x18')],_0x37dc92);_0x250b03(_this['error'](0x1f4,_0x1cb6be['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c4ea7a2..0700506 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 _0x86c8=['register','length','smsInteraction:','./smsInteraction.events','remove','emit','removeListener'];(function(_0x19b7b5,_0x5ec225){var _0x13047e=function(_0x542eb2){while(--_0x542eb2){_0x19b7b5['push'](_0x19b7b5['shift']());}};_0x13047e(++_0x5ec225);}(_0x86c8,0x1a7));var _0x886c=function(_0x174ad8,_0x46e5f0){_0x174ad8=_0x174ad8-0x0;var _0x20f68b=_0x86c8[_0x174ad8];return _0x20f68b;};'use strict';var SmsInteractionEvents=require(_0x886c('0x0'));var events=['save',_0x886c('0x1'),'update'];function createListener(_0x2b0afc,_0x5f4595){return function(_0x5da8eb){_0x5f4595[_0x886c('0x2')](_0x2b0afc,_0x5da8eb);};}function removeListener(_0x5cd15e,_0x44511c){return function(){SmsInteractionEvents[_0x886c('0x3')](_0x5cd15e,_0x44511c);};}exports[_0x886c('0x4')]=function(_0x416a1d){for(var _0x53cea0=0x0,_0x1afe1a=events[_0x886c('0x5')];_0x53cea0<_0x1afe1a;_0x53cea0++){var _0x33710b=events[_0x53cea0];var _0x4c72ea=createListener(_0x886c('0x6')+_0x33710b,_0x416a1d);SmsInteractionEvents['on'](_0x33710b,_0x4c72ea);}}; \ No newline at end of file +var _0x00ad=['remove','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x502ad7,_0x39a859){var _0x1e97f0=function(_0x2e41de){while(--_0x2e41de){_0x502ad7['push'](_0x502ad7['shift']());}};_0x1e97f0(++_0x39a859);}(_0x00ad,0x1cd));var _0xd00a=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x00ad[_0xf0bcac];return _0x4e4c65;};'use strict';var SmsInteractionEvents=require(_0xd00a('0x0'));var events=['save',_0xd00a('0x1'),'update'];function createListener(_0x46cd7c,_0x52f12d){return function(_0x543bc6){_0x52f12d['emit'](_0x46cd7c,_0x543bc6);};}function removeListener(_0x140b0a,_0x24960f){return function(){SmsInteractionEvents[_0xd00a('0x2')](_0x140b0a,_0x24960f);};}exports[_0xd00a('0x3')]=function(_0x3885d7){for(var _0x44abaf=0x0,_0x2ae048=events[_0xd00a('0x4')];_0x44abaf<_0x2ae048;_0x44abaf++){var _0x5888b4=events[_0x44abaf];var _0x56cc40=createListener(_0xd00a('0x5')+_0x5888b4,_0x3885d7);SmsInteractionEvents['on'](_0x5888b4,_0x56cc40);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index cc58926..a155888 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 _0xe126=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','tracked','smsmessage:create','/:id/status','status','update','put','/:id/accept','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x270656,_0x4c38c5){var _0x4b8e7a=function(_0x276f23){while(--_0x276f23){_0x270656['push'](_0x270656['shift']());}};_0x4b8e7a(++_0x4c38c5);}(_0xe126,0xeb));var _0x6e12=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xe126[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require(_0x6e12('0x0'));var util=require(_0x6e12('0x1'));var path=require('path');var timeout=require(_0x6e12('0x2'));var express=require(_0x6e12('0x3'));var router=express[_0x6e12('0x4')]();var fs_extra=require(_0x6e12('0x5'));var auth=require(_0x6e12('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6e12('0x7'));var controller=require('./smsMessage.controller');router[_0x6e12('0x8')]('/',auth[_0x6e12('0x9')](),controller['index']);router[_0x6e12('0x8')](_0x6e12('0xa'),auth[_0x6e12('0x9')](),controller[_0x6e12('0xb')]);router[_0x6e12('0x8')](_0x6e12('0xc'),auth[_0x6e12('0x9')](),controller['show']);router['post']('/',auth[_0x6e12('0x9')](),interaction[_0x6e12('0xd')]('sms',_0x6e12('0xe')),controller['create']);router['post'](_0x6e12('0xf'),controller[_0x6e12('0x10')]);router['put'](_0x6e12('0xc'),auth['isAuthenticated'](),controller[_0x6e12('0x11')]);router[_0x6e12('0x12')](_0x6e12('0x13'),auth[_0x6e12('0x9')](),controller['accept']);router[_0x6e12('0x12')]('/:id/reject',auth[_0x6e12('0x9')](),controller[_0x6e12('0x14')]);router[_0x6e12('0x15')](_0x6e12('0xc'),auth['isAuthenticated'](),controller[_0x6e12('0x16')]);module[_0x6e12('0x17')]=router; \ No newline at end of file +var _0xfc9a=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked','sms','/:id/status','status','put','/:id','update'];(function(_0x16f2a5,_0x43f763){var _0x523572=function(_0x2444f3){while(--_0x2444f3){_0x16f2a5['push'](_0x16f2a5['shift']());}};_0x523572(++_0x43f763);}(_0xfc9a,0x83));var _0xafc9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfc9a[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xafc9('0x0'));var util=require(_0xafc9('0x1'));var path=require(_0xafc9('0x2'));var timeout=require(_0xafc9('0x3'));var express=require(_0xafc9('0x4'));var router=express[_0xafc9('0x5')]();var fs_extra=require(_0xafc9('0x6'));var auth=require(_0xafc9('0x7'));var interaction=require(_0xafc9('0x8'));var config=require(_0xafc9('0x9'));var controller=require(_0xafc9('0xa'));router[_0xafc9('0xb')]('/',auth[_0xafc9('0xc')](),controller[_0xafc9('0xd')]);router['get'](_0xafc9('0xe'),auth[_0xafc9('0xc')](),controller[_0xafc9('0xf')]);router['get']('/:id',auth[_0xafc9('0xc')](),controller['show']);router[_0xafc9('0x10')]('/',auth[_0xafc9('0xc')](),interaction[_0xafc9('0x11')](_0xafc9('0x12'),'smsmessage:create'),controller['create']);router[_0xafc9('0x10')](_0xafc9('0x13'),controller[_0xafc9('0x14')]);router[_0xafc9('0x15')](_0xafc9('0x16'),auth[_0xafc9('0xc')](),controller[_0xafc9('0x17')]);router['put'](_0xafc9('0x18'),auth['isAuthenticated'](),controller[_0xafc9('0x19')]);router['put'](_0xafc9('0x1a'),auth[_0xafc9('0xc')](),controller[_0xafc9('0x1b')]);router[_0xafc9('0x1c')](_0xafc9('0x16'),auth[_0xafc9('0xc')](),controller[_0xafc9('0x1d')]);module[_0xafc9('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 32330a7..54fa058 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 _0xedc1=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xf286f5,_0x42aa45){var _0x58c4af=function(_0xe47e2){while(--_0xe47e2){_0xf286f5['push'](_0xf286f5['shift']());}};_0x58c4af(++_0x42aa45);}(_0xedc1,0x158));var _0x1edc=function(_0x2f06e0,_0x2e1c2a){_0x2f06e0=_0x2f06e0-0x0;var _0xf2711b=_0xedc1[_0x2f06e0];return _0xf2711b;};'use strict';var Sequelize=require(_0x1edc('0x0'));module[_0x1edc('0x1')]={'body':{'type':Sequelize[_0x1edc('0x2')](_0x1edc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1edc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1edc('0x5')]('in','out'),'defaultValue':_0x1edc('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1edc('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1edc('0x8')]},'secret':{'type':Sequelize[_0x1edc('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1edc('0x7')]},'providerResponse':{'type':Sequelize[_0x1edc('0x2')]}}; \ No newline at end of file +var _0x5ad6=['TEXT','sequelize','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0xa7dd48,_0x5e2890){var _0x22265a=function(_0x5ba345){while(--_0x5ba345){_0xa7dd48['push'](_0xa7dd48['shift']());}};_0x22265a(++_0x5e2890);}(_0x5ad6,0xfd));var _0x65ad=function(_0x4e0b8c,_0x443f31){_0x4e0b8c=_0x4e0b8c-0x0;var _0x633ecc=_0x5ad6[_0x4e0b8c];return _0x633ecc;};'use strict';var Sequelize=require(_0x65ad('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x65ad('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x65ad('0x2')]('in',_0x65ad('0x3')),'defaultValue':_0x65ad('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x65ad('0x4')](0xbe)},'phone':{'type':Sequelize[_0x65ad('0x4')]},'readAt':{'type':Sequelize[_0x65ad('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x65ad('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 27ded6c..afae3fa 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 _0xd621=['type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','SmsMessage','includeAll','findAll','rows','show','params','keys','find','create','body','describe','accept','sms','UserId','user','interaction','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','format','SIP/%s','channel','motionChannel','reject','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','infobip','results','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','end','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x45d352,_0x121343){var _0x4178fd=function(_0x5666d4){while(--_0x5666d4){_0x45d352['push'](_0x45d352['shift']());}};_0x4178fd(++_0x121343);}(_0xd621,0x128));var _0x1d62=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0xd621[_0x24b477];return _0x4041a6;};'use strict';var util=require('util');var _=require(_0x1d62('0x0'));var Redis=require(_0x1d62('0x1'));var interactionService=require('../../components/interaction/service');var qs=require(_0x1d62('0x2'));var logger=require(_0x1d62('0x3'))(_0x1d62('0x4'));var config=require(_0x1d62('0x5'));var db=require(_0x1d62('0x6'))['db'];config[_0x1d62('0x7')]=_[_0x1d62('0x8')](config['redis'],{'host':_0x1d62('0x9'),'port':0x18eb});var socket=require(_0x1d62('0xa'))(new Redis(config['redis']));require(_0x1d62('0xb'))[_0x1d62('0xc')](socket);var jayson=require(_0x1d62('0xd'));var client=jayson[_0x1d62('0xe')][_0x1d62('0xf')]({'port':0x232c});var client9002=jayson[_0x1d62('0xe')][_0x1d62('0xf')]({'port':0x232a});var interaction_log=require(_0x1d62('0x3'))('sms-interactions');function respondWithRpcPromise(_0x40808b,_0x462aa3,_0x112ed6,_0x4f42e5){return new Promise(function(_0xbcb128,_0x1fa9cc){var _0x355557=_0x4f42e5||client;return _0x355557[_0x1d62('0x10')](_0x40808b,_0x112ed6)[_0x1d62('0x11')](function(_0x5a7a4e){logger['info'](_0x1d62('0x12'),_0x462aa3,_0x1d62('0x13'));logger['debug'](_0x1d62('0x14'),_0x462aa3,_0x1d62('0x13'),JSON['stringify'](_0x5a7a4e));if(_0x5a7a4e[_0x1d62('0x15')]){if(_0x5a7a4e[_0x1d62('0x15')][_0x1d62('0x16')]===0x1f4){logger['error'](_0x1d62('0x12'),_0x462aa3,_0x5a7a4e['error'][_0x1d62('0x17')]);return _0x1fa9cc(_0x5a7a4e[_0x1d62('0x15')][_0x1d62('0x17')]);}logger[_0x1d62('0x15')]('SmsMessage,\x20%s,\x20%s',_0x462aa3,_0x5a7a4e[_0x1d62('0x15')][_0x1d62('0x17')]);return _0xbcb128(_0x5a7a4e[_0x1d62('0x15')][_0x1d62('0x17')]);}else{logger[_0x1d62('0x18')](_0x1d62('0x12'),_0x462aa3,_0x1d62('0x13'));_0xbcb128(_0x5a7a4e[_0x1d62('0x19')][_0x1d62('0x17')]);}})[_0x1d62('0x1a')](function(_0x472570){logger[_0x1d62('0x15')]('SmsMessage,\x20%s,\x20%s',_0x462aa3,_0x472570);_0x1fa9cc(_0x472570);});});}function respondWithResult(_0x437964,_0x2eb3de){_0x2eb3de=_0x2eb3de||0xc8;return function(_0x314a20){if(_0x314a20){return _0x437964[_0x1d62('0x1b')](_0x2eb3de)[_0x1d62('0x1c')](_0x314a20);}};}function respondWithFilteredResult(_0x3a8f4f,_0x13d80d){return function(_0x2ff89e){if(_0x2ff89e){var _0x4841a0=typeof _0x13d80d[_0x1d62('0x1d')]===_0x1d62('0x1e')&&typeof _0x13d80d[_0x1d62('0x1f')]===_0x1d62('0x1e');var _0x2e3899=_0x2ff89e[_0x1d62('0x20')];var _0x1c40c1=_0x4841a0?0x0:_0x13d80d[_0x1d62('0x1d')];var _0x50dbec=_0x4841a0?_0x2ff89e[_0x1d62('0x20')]:_0x13d80d[_0x1d62('0x1d')]+_0x13d80d['limit'];var _0x64fc68;if(_0x50dbec>=_0x2e3899){_0x50dbec=_0x2e3899;_0x64fc68=0xc8;}else{_0x64fc68=0xce;}_0x3a8f4f[_0x1d62('0x1b')](_0x64fc68);return _0x3a8f4f['set'](_0x1d62('0x21'),_0x1c40c1+'-'+_0x50dbec+'/'+_0x2e3899)[_0x1d62('0x1c')](_0x2ff89e);}return null;};}function saveUpdates(_0x2a3bbf){return function(_0x5f5bf6){if(_0x5f5bf6){return _0x5f5bf6[_0x1d62('0x22')](_0x2a3bbf)[_0x1d62('0x11')](function(_0x4fc15c){return _0x4fc15c;});}return null;};}function removeEntity(_0x530d59){return function(_0x545d1e){if(_0x545d1e){return _0x545d1e['destroy']()[_0x1d62('0x11')](function(){_0x530d59[_0x1d62('0x1b')](0xcc)[_0x1d62('0x23')]();});}};}function handleEntityNotFound(_0x3c3ae4){return function(_0x32f4a1){if(!_0x32f4a1){_0x3c3ae4['sendStatus'](0x194);}return _0x32f4a1;};}function handleError(_0x1a5000,_0x3146c8){_0x3146c8=_0x3146c8||0x1f4;return function(_0x13f352){logger[_0x1d62('0x15')](_0x13f352[_0x1d62('0x24')]);if(_0x13f352[_0x1d62('0x25')]){delete _0x13f352[_0x1d62('0x25')];}_0x1a5000[_0x1d62('0x1b')](_0x3146c8)[_0x1d62('0x26')](_0x13f352);};}exports[_0x1d62('0x27')]=function(_0x192e80,_0x465949){var _0x462de8={},_0x1dfcf6={},_0x43d005={'count':0x0,'rows':[]};var _0x5bd28b=_[_0x1d62('0x28')](db['SmsMessage'][_0x1d62('0x29')],function(_0x3cc68a){return{'name':_0x3cc68a[_0x1d62('0x2a')],'type':_0x3cc68a[_0x1d62('0x2b')]['key']};});_0x1dfcf6[_0x1d62('0x2c')]=_['map'](_0x5bd28b,'name');_0x1dfcf6['query']=_['keys'](_0x192e80[_0x1d62('0x2d')]);_0x1dfcf6[_0x1d62('0x2e')]=_[_0x1d62('0x2f')](_0x1dfcf6[_0x1d62('0x2c')],_0x1dfcf6[_0x1d62('0x2d')]);_0x462de8[_0x1d62('0x30')]=_['intersection'](_0x1dfcf6[_0x1d62('0x2c')],qs['fields'](_0x192e80[_0x1d62('0x2d')][_0x1d62('0x31')]));_0x462de8[_0x1d62('0x30')]=_0x462de8[_0x1d62('0x30')][_0x1d62('0x32')]?_0x462de8[_0x1d62('0x30')]:_0x1dfcf6['model'];if(!_0x192e80['query'][_0x1d62('0x33')](_0x1d62('0x34'))){_0x462de8['limit']=qs['limit'](_0x192e80[_0x1d62('0x2d')][_0x1d62('0x1f')]);_0x462de8[_0x1d62('0x1d')]=qs[_0x1d62('0x1d')](_0x192e80['query']['offset']);}_0x462de8[_0x1d62('0x35')]=qs['sort'](_0x192e80[_0x1d62('0x2d')][_0x1d62('0x36')]);_0x462de8['where']=qs[_0x1d62('0x2e')](_[_0x1d62('0x37')](_0x192e80[_0x1d62('0x2d')],_0x1dfcf6[_0x1d62('0x2e')]),_0x5bd28b);if(_0x192e80[_0x1d62('0x2d')]['filter']){_0x462de8[_0x1d62('0x38')]=_[_0x1d62('0x39')](_0x462de8['where'],{'$or':_['map'](_0x5bd28b,function(_0x391c21){if(_0x391c21[_0x1d62('0x2b')]!==_0x1d62('0x3a')){var _0x44a400={};_0x44a400[_0x391c21[_0x1d62('0x25')]]={'$like':'%'+_0x192e80[_0x1d62('0x2d')][_0x1d62('0x3b')]+'%'};return _0x44a400;}})});}_0x462de8=_[_0x1d62('0x39')]({},_0x462de8,_0x192e80[_0x1d62('0x3c')]);var _0x33a4e8={'where':_0x462de8[_0x1d62('0x38')]};return db[_0x1d62('0x3d')][_0x1d62('0x20')](_0x33a4e8)[_0x1d62('0x11')](function(_0x1efb2f){_0x43d005[_0x1d62('0x20')]=_0x1efb2f;if(_0x192e80[_0x1d62('0x2d')][_0x1d62('0x3e')]){_0x462de8['include']=[{'all':!![]}];}return db['SmsMessage'][_0x1d62('0x3f')](_0x462de8);})['then'](function(_0x1966c8){_0x43d005[_0x1d62('0x40')]=_0x1966c8;return _0x43d005;})[_0x1d62('0x11')](respondWithFilteredResult(_0x465949,_0x462de8))[_0x1d62('0x1a')](handleError(_0x465949,null));};exports[_0x1d62('0x41')]=function(_0x294b2f,_0x1dab1f){var _0xfddcfd={'raw':!![],'where':{'id':_0x294b2f[_0x1d62('0x42')]['id']}},_0x221267={};_0x221267['model']=_[_0x1d62('0x43')](db['SmsMessage'][_0x1d62('0x29')]);_0x221267['query']=_['keys'](_0x294b2f[_0x1d62('0x2d')]);_0x221267[_0x1d62('0x2e')]=_[_0x1d62('0x2f')](_0x221267[_0x1d62('0x2c')],_0x221267[_0x1d62('0x2d')]);_0xfddcfd[_0x1d62('0x30')]=_[_0x1d62('0x2f')](_0x221267[_0x1d62('0x2c')],qs[_0x1d62('0x31')](_0x294b2f[_0x1d62('0x2d')][_0x1d62('0x31')]));_0xfddcfd[_0x1d62('0x30')]=_0xfddcfd[_0x1d62('0x30')][_0x1d62('0x32')]?_0xfddcfd[_0x1d62('0x30')]:_0x221267[_0x1d62('0x2c')];if(_0x294b2f[_0x1d62('0x2d')]['includeAll']){_0xfddcfd['include']=[{'all':!![]}];}_0xfddcfd=_['merge']({},_0xfddcfd,_0x294b2f[_0x1d62('0x3c')]);return db[_0x1d62('0x3d')][_0x1d62('0x44')](_0xfddcfd)['then'](handleEntityNotFound(_0x1dab1f,null))['then'](respondWithResult(_0x1dab1f,null))[_0x1d62('0x1a')](handleError(_0x1dab1f,null));};exports[_0x1d62('0x45')]=function(_0x26d3ab,_0x54448b){return db[_0x1d62('0x3d')][_0x1d62('0x45')](_0x26d3ab[_0x1d62('0x46')],{})[_0x1d62('0x11')](respondWithResult(_0x54448b,0xc9))['catch'](handleError(_0x54448b,null));};exports['update']=function(_0x447606,_0x2335f6){if(_0x447606[_0x1d62('0x46')]['id']){delete _0x447606[_0x1d62('0x46')]['id'];}return db[_0x1d62('0x3d')][_0x1d62('0x44')]({'where':{'id':_0x447606[_0x1d62('0x42')]['id']}})[_0x1d62('0x11')](handleEntityNotFound(_0x2335f6,null))[_0x1d62('0x11')](saveUpdates(_0x447606[_0x1d62('0x46')],null))[_0x1d62('0x11')](respondWithResult(_0x2335f6,null))['catch'](handleError(_0x2335f6,null));};exports['destroy']=function(_0x35c942,_0x3961cd){return db['SmsMessage'][_0x1d62('0x44')]({'where':{'id':_0x35c942[_0x1d62('0x42')]['id']}})[_0x1d62('0x11')](handleEntityNotFound(_0x3961cd,null))[_0x1d62('0x11')](removeEntity(_0x3961cd,null))['catch'](handleError(_0x3961cd,null));};exports[_0x1d62('0x47')]=function(_0x3074c4,_0x5a08ff){return db[_0x1d62('0x3d')][_0x1d62('0x47')]()[_0x1d62('0x11')](respondWithResult(_0x5a08ff,null))[_0x1d62('0x1a')](handleError(_0x5a08ff,null));};exports[_0x1d62('0x48')]=function(_0x5e9487,_0x4802c8){var _0x571184=_0x1d62('0x49');return interactionService['acceptMessage'](_0x5e9487,_0x571184)['then'](respondWithResult(_0x4802c8,null))['catch'](handleError(_0x4802c8,null));};exports['reject']=function(_0xfe00c9,_0x3a702d){var _0x11be48={'agent':{},'channel':'sms'};if(_0xfe00c9[_0x1d62('0x46')]['id']){delete _0xfe00c9['body']['id'];}_0xfe00c9['body'][_0x1d62('0x4a')]=_0xfe00c9[_0x1d62('0x46')]['UserId']||_0xfe00c9[_0x1d62('0x4b')]['id'];_0x11be48['agent']['id']=_0xfe00c9[_0x1d62('0x46')]['UserId'];return db[_0x1d62('0x3d')]['find']({'where':{'id':_0xfe00c9[_0x1d62('0x42')]['id'],'UserId':null}})[_0x1d62('0x11')](handleEntityNotFound(_0x3a702d,null))[_0x1d62('0x11')](function(_0x1a7b92){if(_0x1a7b92){_0x11be48[_0x1d62('0x17')]=_0x1a7b92['get']({'plain':!![]});return db['SmsInteraction'][_0x1d62('0x44')]({'where':{'id':_0x1a7b92['SmsInteractionId']}});}return null;})[_0x1d62('0x11')](handleEntityNotFound(_0x3a702d,null))[_0x1d62('0x11')](function(_0x5064dd){if(_0x5064dd){_0x11be48[_0x1d62('0x4c')]=_0x5064dd[_0x1d62('0x4d')]({'plain':!![]});interaction_log[_0x1d62('0x18')](_0x1d62('0x4e'),_0xfe00c9[_0x1d62('0x4b')]['id'],_0xfe00c9[_0x1d62('0x4b')][_0x1d62('0x25')],_0xfe00c9[_0x1d62('0x4b')][_0x1d62('0x4f')],_0x11be48[_0x1d62('0x4c')]['id'],_0xfe00c9[_0x1d62('0x46')]?JSON[_0x1d62('0x50')](_0xfe00c9[_0x1d62('0x46')]):_0x1d62('0x51'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x11be48);}return null;})['then'](function(_0x330b15){var _0x3db1fd=_0x1d62('0x52')+_0x330b15[_0x1d62('0x17')]['ContactId'];return db[_0x1d62('0x53')][_0x1d62('0x2d')](_0x3db1fd,{'type':db[_0x1d62('0x54')][_0x1d62('0x55')]['SELECT'],'raw':!![]})['then'](function(_0x13c42d){return _0x13c42d;});})[_0x1d62('0x11')](function(_0x15eb30){if(_0x15eb30){_0x11be48[_0x1d62('0x17')][_0x1d62('0x56')]=_0x15eb30[0x0];if(!_0xfe00c9[_0x1d62('0x46')][_0x1d62('0x4a')])return;return db[_0x1d62('0x57')]['find']({'where':{'id':_0xfe00c9[_0x1d62('0x46')][_0x1d62('0x4a')],'role':_0x1d62('0x58')},'attributes':['id',_0x1d62('0x25'),_0x1d62('0x59'),_0x1d62('0x5a'),'internal'],'raw':!![]});}return null;})[_0x1d62('0x11')](function(_0x3d72ee){if(!_0x3d72ee)return null;_0x11be48[_0x1d62('0x17')][_0x1d62('0x58')]=_0x3d72ee;return _0x11be48;})[_0x1d62('0x11')](function(_0x3c4498){if(_0x3c4498){_0x3c4498[_0x1d62('0x17')]['interface']=util[_0x1d62('0x5b')](_0x1d62('0x5c'),_0xfe00c9[_0x1d62('0x4b')][_0x1d62('0x25')]);_0x3c4498['message'][_0x1d62('0x5d')]=_0x11be48[_0x1d62('0x5d')];_0x3c4498[_0x1d62('0x17')][_0x1d62('0x5e')]=_0x11be48[_0x1d62('0x5d')];_0x3c4498['message']['event']=_0x1d62('0x5f');respondWithRpcPromise(_0x1d62('0x60'),_0x1d62('0x60'),{'event':_0x1d62('0x61'),'message':_0x3c4498['message']},client9002);return _0x11be48;}return null;})[_0x1d62('0x11')](respondWithResult(_0x3a702d,null))[_0x1d62('0x1a')](handleError(_0x3a702d,null));};exports[_0x1d62('0x1b')]=function(_0x68355b,_0x36a5ad){if(_0x68355b[_0x1d62('0x46')]['id']){delete _0x68355b['body']['id'];}var _0x4b0170;return db['SmsMessage'][_0x1d62('0x44')]({'where':{'id':_0x68355b[_0x1d62('0x42')]['id']}})[_0x1d62('0x11')](handleEntityNotFound(_0x36a5ad,null))[_0x1d62('0x11')](function(_0x4925b0){if(_0x4925b0){_0x4b0170=_0x4925b0;return db[_0x1d62('0x62')]['find']({'where':{'id':_0x4925b0[_0x1d62('0x63')]}});}})[_0x1d62('0x11')](handleEntityNotFound(_0x36a5ad,null))[_0x1d62('0x11')](function(_0x4122a4){if(_0x4122a4){logger[_0x1d62('0x64')](_0x1d62('0x14'),_0x1d62('0x1b'),'received\x20delivery\x20report\x20from',_0x4122a4[_0x1d62('0x2b')],util[_0x1d62('0x65')](_0x68355b[_0x1d62('0x46')],{'showHidden':![],'depth':null}));switch(_0x4122a4[_0x1d62('0x2b')]){case _0x1d62('0x66'):if(_0x68355b[_0x1d62('0x46')][_0x1d62('0x67')]&&_0x68355b[_0x1d62('0x46')]['MessageSid']===_0x4b0170[_0x1d62('0x68')]){return _0x4b0170[_0x1d62('0x22')]({'read':!![]});}else{logger[_0x1d62('0x15')](_0x1d62('0x69'),'status',_0x1d62('0x66'),util['inspect'](_0x68355b[_0x1d62('0x46')],{'showHidden':![],'depth':null}));}break;case _0x1d62('0x6a'):if(_0x68355b[_0x1d62('0x46')][_0x1d62('0x6b')]&&_0x68355b[_0x1d62('0x46')][_0x1d62('0x6b')]===_0x4b0170[_0x1d62('0x68')]&&_['indexOf']([_0x1d62('0x6c'),_0x1d62('0x6d')],_0x68355b['body'][_0x1d62('0x6e')])>=0x0){return _0x4b0170[_0x1d62('0x22')]({'read':!![]});}else{logger[_0x1d62('0x15')](_0x1d62('0x69'),_0x1d62('0x1b'),'plivio',util['inspect'](_0x68355b[_0x1d62('0x46')],{'showHidden':![],'depth':null}));}break;case _0x1d62('0x6f'):var _0x2e9a39=_0x68355b[_0x1d62('0x46')][_0x1d62('0x70')][0x0];if(_0x2e9a39['status']['groupName']==='DELIVERED'){return _0x4b0170['update']({'read':!![]});}else{logger[_0x1d62('0x15')](_0x1d62('0x69'),_0x1d62('0x1b'),'infobip',util[_0x1d62('0x65')](_0x68355b['body'],{'showHidden':![],'depth':null}));}break;}return _0x4b0170;}})[_0x1d62('0x11')](respondWithResult(_0x36a5ad,null))['catch'](handleError(_0x36a5ad,null));}; \ No newline at end of file +var _0x13ff=['groupName','DELIVERED','util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','json','limit','undefined','count','offset','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','create','body','update','find','params','describe','accept','sms','acceptMessage','reject','UserId','user','agent','SmsInteraction','interaction','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','internal','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','infobip'];(function(_0x282f96,_0x2be4be){var _0x12d02b=function(_0x51cc9d){while(--_0x51cc9d){_0x282f96['push'](_0x282f96['shift']());}};_0x12d02b(++_0x2be4be);}(_0x13ff,0xe6));var _0xf13f=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x13ff[_0x2b10c6];return _0x3789d2;};'use strict';var util=require(_0xf13f('0x0'));var _=require('lodash');var Redis=require(_0xf13f('0x1'));var interactionService=require(_0xf13f('0x2'));var qs=require(_0xf13f('0x3'));var logger=require(_0xf13f('0x4'))(_0xf13f('0x5'));var config=require(_0xf13f('0x6'));var db=require(_0xf13f('0x7'))['db'];config['redis']=_['defaults'](config[_0xf13f('0x8')],{'host':_0xf13f('0x9'),'port':0x18eb});var socket=require(_0xf13f('0xa'))(new Redis(config[_0xf13f('0x8')]));require('./smsMessage.socket')[_0xf13f('0xb')](socket);var jayson=require(_0xf13f('0xc'));var client=jayson[_0xf13f('0xd')][_0xf13f('0xe')]({'port':0x232c});var client9002=jayson['client'][_0xf13f('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0xf13f('0xf'));function respondWithRpcPromise(_0x596562,_0x53eb30,_0x3a6851,_0x3df8c3){return new Promise(function(_0x3a0039,_0xf109fa){var _0x23159a=_0x3df8c3||client;return _0x23159a[_0xf13f('0x10')](_0x596562,_0x3a6851)[_0xf13f('0x11')](function(_0xdff879){logger[_0xf13f('0x12')](_0xf13f('0x13'),_0x53eb30,'request\x20sent');logger[_0xf13f('0x14')](_0xf13f('0x15'),_0x53eb30,_0xf13f('0x16'),JSON[_0xf13f('0x17')](_0xdff879));if(_0xdff879[_0xf13f('0x18')]){if(_0xdff879[_0xf13f('0x18')][_0xf13f('0x19')]===0x1f4){logger[_0xf13f('0x18')](_0xf13f('0x13'),_0x53eb30,_0xdff879[_0xf13f('0x18')]['message']);return _0xf109fa(_0xdff879[_0xf13f('0x18')][_0xf13f('0x1a')]);}logger[_0xf13f('0x18')](_0xf13f('0x13'),_0x53eb30,_0xdff879['error'][_0xf13f('0x1a')]);return _0x3a0039(_0xdff879[_0xf13f('0x18')][_0xf13f('0x1a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x53eb30,'request\x20sent');_0x3a0039(_0xdff879['result'][_0xf13f('0x1a')]);}})[_0xf13f('0x1b')](function(_0x22eec3){logger[_0xf13f('0x18')](_0xf13f('0x13'),_0x53eb30,_0x22eec3);_0xf109fa(_0x22eec3);});});}function respondWithResult(_0x1b09fb,_0x58293e){_0x58293e=_0x58293e||0xc8;return function(_0x446631){if(_0x446631){return _0x1b09fb[_0xf13f('0x1c')](_0x58293e)[_0xf13f('0x1d')](_0x446631);}};}function respondWithFilteredResult(_0x4c6fdc,_0xddbffa){return function(_0x474341){if(_0x474341){var _0x66c556=typeof _0xddbffa['offset']==='undefined'&&typeof _0xddbffa[_0xf13f('0x1e')]===_0xf13f('0x1f');var _0x6078b=_0x474341[_0xf13f('0x20')];var _0x5e6d96=_0x66c556?0x0:_0xddbffa[_0xf13f('0x21')];var _0x503fff=_0x66c556?_0x474341['count']:_0xddbffa[_0xf13f('0x21')]+_0xddbffa[_0xf13f('0x1e')];var _0x185bfc;if(_0x503fff>=_0x6078b){_0x503fff=_0x6078b;_0x185bfc=0xc8;}else{_0x185bfc=0xce;}_0x4c6fdc[_0xf13f('0x1c')](_0x185bfc);return _0x4c6fdc['set']('Content-Range',_0x5e6d96+'-'+_0x503fff+'/'+_0x6078b)[_0xf13f('0x1d')](_0x474341);}return null;};}function saveUpdates(_0x86d615){return function(_0x561587){if(_0x561587){return _0x561587['update'](_0x86d615)[_0xf13f('0x11')](function(_0x4d5187){return _0x4d5187;});}return null;};}function removeEntity(_0x12296a){return function(_0x2b5ee9){if(_0x2b5ee9){return _0x2b5ee9[_0xf13f('0x22')]()[_0xf13f('0x11')](function(){_0x12296a[_0xf13f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47b864){return function(_0x2e7388){if(!_0x2e7388){_0x47b864['sendStatus'](0x194);}return _0x2e7388;};}function handleError(_0x1d307f,_0x190435){_0x190435=_0x190435||0x1f4;return function(_0x1f3508){logger[_0xf13f('0x18')](_0x1f3508[_0xf13f('0x23')]);if(_0x1f3508[_0xf13f('0x24')]){delete _0x1f3508[_0xf13f('0x24')];}_0x1d307f['status'](_0x190435)[_0xf13f('0x25')](_0x1f3508);};}exports[_0xf13f('0x26')]=function(_0x373dc6,_0x4d36ac){var _0x489e9f={},_0x42607b={},_0xa0836e={'count':0x0,'rows':[]};var _0x10cece=_[_0xf13f('0x27')](db[_0xf13f('0x28')][_0xf13f('0x29')],function(_0x30b9f0){return{'name':_0x30b9f0[_0xf13f('0x2a')],'type':_0x30b9f0['type'][_0xf13f('0x2b')]};});_0x42607b['model']=_['map'](_0x10cece,_0xf13f('0x24'));_0x42607b[_0xf13f('0x2c')]=_[_0xf13f('0x2d')](_0x373dc6[_0xf13f('0x2c')]);_0x42607b[_0xf13f('0x2e')]=_[_0xf13f('0x2f')](_0x42607b[_0xf13f('0x30')],_0x42607b[_0xf13f('0x2c')]);_0x489e9f[_0xf13f('0x31')]=_['intersection'](_0x42607b[_0xf13f('0x30')],qs[_0xf13f('0x32')](_0x373dc6[_0xf13f('0x2c')][_0xf13f('0x32')]));_0x489e9f[_0xf13f('0x31')]=_0x489e9f[_0xf13f('0x31')][_0xf13f('0x33')]?_0x489e9f[_0xf13f('0x31')]:_0x42607b[_0xf13f('0x30')];if(!_0x373dc6['query'][_0xf13f('0x34')](_0xf13f('0x35'))){_0x489e9f['limit']=qs['limit'](_0x373dc6[_0xf13f('0x2c')]['limit']);_0x489e9f[_0xf13f('0x21')]=qs[_0xf13f('0x21')](_0x373dc6[_0xf13f('0x2c')][_0xf13f('0x21')]);}_0x489e9f[_0xf13f('0x36')]=qs[_0xf13f('0x37')](_0x373dc6[_0xf13f('0x2c')]['sort']);_0x489e9f[_0xf13f('0x38')]=qs[_0xf13f('0x2e')](_[_0xf13f('0x39')](_0x373dc6['query'],_0x42607b[_0xf13f('0x2e')]),_0x10cece);if(_0x373dc6['query'][_0xf13f('0x3a')]){_0x489e9f[_0xf13f('0x38')]=_[_0xf13f('0x3b')](_0x489e9f[_0xf13f('0x38')],{'$or':_[_0xf13f('0x27')](_0x10cece,function(_0x38ca30){if(_0x38ca30[_0xf13f('0x3c')]!==_0xf13f('0x3d')){var _0x38402e={};_0x38402e[_0x38ca30[_0xf13f('0x24')]]={'$like':'%'+_0x373dc6[_0xf13f('0x2c')]['filter']+'%'};return _0x38402e;}})});}_0x489e9f=_['merge']({},_0x489e9f,_0x373dc6[_0xf13f('0x3e')]);var _0x144b9e={'where':_0x489e9f[_0xf13f('0x38')]};return db['SmsMessage'][_0xf13f('0x20')](_0x144b9e)[_0xf13f('0x11')](function(_0xbf3635){_0xa0836e['count']=_0xbf3635;if(_0x373dc6[_0xf13f('0x2c')][_0xf13f('0x3f')]){_0x489e9f[_0xf13f('0x40')]=[{'all':!![]}];}return db[_0xf13f('0x28')][_0xf13f('0x41')](_0x489e9f);})[_0xf13f('0x11')](function(_0x5da0de){_0xa0836e['rows']=_0x5da0de;return _0xa0836e;})[_0xf13f('0x11')](respondWithFilteredResult(_0x4d36ac,_0x489e9f))['catch'](handleError(_0x4d36ac,null));};exports['show']=function(_0x4104ed,_0x355271){var _0x2b6b1f={'raw':!![],'where':{'id':_0x4104ed['params']['id']}},_0x360a01={};_0x360a01['model']=_['keys'](db[_0xf13f('0x28')][_0xf13f('0x29')]);_0x360a01['query']=_[_0xf13f('0x2d')](_0x4104ed['query']);_0x360a01[_0xf13f('0x2e')]=_[_0xf13f('0x2f')](_0x360a01[_0xf13f('0x30')],_0x360a01['query']);_0x2b6b1f['attributes']=_['intersection'](_0x360a01[_0xf13f('0x30')],qs[_0xf13f('0x32')](_0x4104ed[_0xf13f('0x2c')]['fields']));_0x2b6b1f[_0xf13f('0x31')]=_0x2b6b1f[_0xf13f('0x31')][_0xf13f('0x33')]?_0x2b6b1f['attributes']:_0x360a01[_0xf13f('0x30')];if(_0x4104ed['query'][_0xf13f('0x3f')]){_0x2b6b1f['include']=[{'all':!![]}];}_0x2b6b1f=_['merge']({},_0x2b6b1f,_0x4104ed[_0xf13f('0x3e')]);return db[_0xf13f('0x28')]['find'](_0x2b6b1f)[_0xf13f('0x11')](handleEntityNotFound(_0x355271,null))['then'](respondWithResult(_0x355271,null))[_0xf13f('0x1b')](handleError(_0x355271,null));};exports[_0xf13f('0x42')]=function(_0x5ed791,_0x24b0d8){return db[_0xf13f('0x28')][_0xf13f('0x42')](_0x5ed791[_0xf13f('0x43')],{})[_0xf13f('0x11')](respondWithResult(_0x24b0d8,0xc9))['catch'](handleError(_0x24b0d8,null));};exports[_0xf13f('0x44')]=function(_0x5425a9,_0x96672a){if(_0x5425a9[_0xf13f('0x43')]['id']){delete _0x5425a9[_0xf13f('0x43')]['id'];}return db[_0xf13f('0x28')][_0xf13f('0x45')]({'where':{'id':_0x5425a9['params']['id']}})[_0xf13f('0x11')](handleEntityNotFound(_0x96672a,null))[_0xf13f('0x11')](saveUpdates(_0x5425a9['body'],null))[_0xf13f('0x11')](respondWithResult(_0x96672a,null))['catch'](handleError(_0x96672a,null));};exports[_0xf13f('0x22')]=function(_0x2aa59b,_0x1c6861){return db[_0xf13f('0x28')]['find']({'where':{'id':_0x2aa59b[_0xf13f('0x46')]['id']}})[_0xf13f('0x11')](handleEntityNotFound(_0x1c6861,null))[_0xf13f('0x11')](removeEntity(_0x1c6861,null))[_0xf13f('0x1b')](handleError(_0x1c6861,null));};exports[_0xf13f('0x47')]=function(_0x2638f1,_0x3091c2){return db[_0xf13f('0x28')][_0xf13f('0x47')]()[_0xf13f('0x11')](respondWithResult(_0x3091c2,null))[_0xf13f('0x1b')](handleError(_0x3091c2,null));};exports[_0xf13f('0x48')]=function(_0x5c0b54,_0x57a2cf){var _0x295d87=_0xf13f('0x49');return interactionService[_0xf13f('0x4a')](_0x5c0b54,_0x295d87)[_0xf13f('0x11')](respondWithResult(_0x57a2cf,null))['catch'](handleError(_0x57a2cf,null));};exports[_0xf13f('0x4b')]=function(_0x117697,_0x364976){var _0x521037={'agent':{},'channel':_0xf13f('0x49')};if(_0x117697['body']['id']){delete _0x117697[_0xf13f('0x43')]['id'];}_0x117697[_0xf13f('0x43')][_0xf13f('0x4c')]=_0x117697[_0xf13f('0x43')][_0xf13f('0x4c')]||_0x117697[_0xf13f('0x4d')]['id'];_0x521037[_0xf13f('0x4e')]['id']=_0x117697[_0xf13f('0x43')][_0xf13f('0x4c')];return db[_0xf13f('0x28')][_0xf13f('0x45')]({'where':{'id':_0x117697[_0xf13f('0x46')]['id'],'UserId':null}})[_0xf13f('0x11')](handleEntityNotFound(_0x364976,null))['then'](function(_0x4f99e5){if(_0x4f99e5){_0x521037[_0xf13f('0x1a')]=_0x4f99e5['get']({'plain':!![]});return db[_0xf13f('0x4f')][_0xf13f('0x45')]({'where':{'id':_0x4f99e5['SmsInteractionId']}});}return null;})[_0xf13f('0x11')](handleEntityNotFound(_0x364976,null))[_0xf13f('0x11')](function(_0x3dae0b){if(_0x3dae0b){_0x521037[_0xf13f('0x50')]=_0x3dae0b[_0xf13f('0x51')]({'plain':!![]});interaction_log['info'](_0xf13f('0x52'),_0x117697[_0xf13f('0x4d')]['id'],_0x117697['user'][_0xf13f('0x24')],_0x117697[_0xf13f('0x4d')]['role'],_0x521037[_0xf13f('0x50')]['id'],_0x117697[_0xf13f('0x43')]?JSON[_0xf13f('0x17')](_0x117697[_0xf13f('0x43')]):_0xf13f('0x53'));return respondWithRpcPromise(_0xf13f('0x54'),_0xf13f('0x55'),_0x521037);}return null;})['then'](function(_0xd2f90e){var _0x4a8876=_0xf13f('0x56')+_0xd2f90e[_0xf13f('0x1a')][_0xf13f('0x57')];return db[_0xf13f('0x58')][_0xf13f('0x2c')](_0x4a8876,{'type':db[_0xf13f('0x59')][_0xf13f('0x5a')]['SELECT'],'raw':!![]})[_0xf13f('0x11')](function(_0x1187d6){return _0x1187d6;});})[_0xf13f('0x11')](function(_0x40b698){if(_0x40b698){_0x521037[_0xf13f('0x1a')][_0xf13f('0x5b')]=_0x40b698[0x0];if(!_0x117697[_0xf13f('0x43')][_0xf13f('0x4c')])return;return db['User'][_0xf13f('0x45')]({'where':{'id':_0x117697[_0xf13f('0x43')]['UserId'],'role':_0xf13f('0x4e')},'attributes':['id','name',_0xf13f('0x5c'),'email',_0xf13f('0x5d')],'raw':!![]});}return null;})['then'](function(_0x1c8aee){if(!_0x1c8aee)return null;_0x521037[_0xf13f('0x1a')][_0xf13f('0x4e')]=_0x1c8aee;return _0x521037;})[_0xf13f('0x11')](function(_0x2cd778){if(_0x2cd778){_0x2cd778['message']['interface']=util[_0xf13f('0x5e')](_0xf13f('0x5f'),_0x117697['user'][_0xf13f('0x24')]);_0x2cd778[_0xf13f('0x1a')]['channel']=_0x521037[_0xf13f('0x60')];_0x2cd778[_0xf13f('0x1a')][_0xf13f('0x61')]=_0x521037[_0xf13f('0x60')];_0x2cd778[_0xf13f('0x1a')]['event']=_0xf13f('0x4b');respondWithRpcPromise(_0xf13f('0x62'),_0xf13f('0x62'),{'event':_0xf13f('0x63'),'message':_0x2cd778[_0xf13f('0x1a')]},client9002);return _0x521037;}return null;})[_0xf13f('0x11')](respondWithResult(_0x364976,null))[_0xf13f('0x1b')](handleError(_0x364976,null));};exports[_0xf13f('0x1c')]=function(_0x24de21,_0x1c6d52){if(_0x24de21[_0xf13f('0x43')]['id']){delete _0x24de21[_0xf13f('0x43')]['id'];}var _0x580bff;return db['SmsMessage'][_0xf13f('0x45')]({'where':{'id':_0x24de21['params']['id']}})[_0xf13f('0x11')](handleEntityNotFound(_0x1c6d52,null))['then'](function(_0x5d8e13){if(_0x5d8e13){_0x580bff=_0x5d8e13;return db[_0xf13f('0x64')]['find']({'where':{'id':_0x5d8e13[_0xf13f('0x65')]}});}})['then'](handleEntityNotFound(_0x1c6d52,null))[_0xf13f('0x11')](function(_0x4ea6f8){if(_0x4ea6f8){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xf13f('0x66'),_0x4ea6f8[_0xf13f('0x3c')],util[_0xf13f('0x67')](_0x24de21[_0xf13f('0x43')],{'showHidden':![],'depth':null}));switch(_0x4ea6f8[_0xf13f('0x3c')]){case'twilio':if(_0x24de21[_0xf13f('0x43')]['MessageSid']&&_0x24de21[_0xf13f('0x43')][_0xf13f('0x68')]===_0x580bff[_0xf13f('0x69')]){return _0x580bff[_0xf13f('0x44')]({'read':!![]});}else{logger[_0xf13f('0x18')](_0xf13f('0x6a'),_0xf13f('0x1c'),'twilio',util[_0xf13f('0x67')](_0x24de21['body'],{'showHidden':![],'depth':null}));}break;case _0xf13f('0x6b'):if(_0x24de21[_0xf13f('0x43')][_0xf13f('0x6c')]&&_0x24de21[_0xf13f('0x43')][_0xf13f('0x6c')]===_0x580bff['messageId']&&_[_0xf13f('0x6d')](['sent',_0xf13f('0x6e')],_0x24de21[_0xf13f('0x43')]['Status'])>=0x0){return _0x580bff[_0xf13f('0x44')]({'read':!![]});}else{logger['error'](_0xf13f('0x6a'),'status','plivio',util[_0xf13f('0x67')](_0x24de21['body'],{'showHidden':![],'depth':null}));}break;case _0xf13f('0x6f'):var _0x4fd9e3=_0x24de21[_0xf13f('0x43')]['results'][0x0];if(_0x4fd9e3[_0xf13f('0x1c')][_0xf13f('0x70')]===_0xf13f('0x71')){return _0x580bff[_0xf13f('0x44')]({'read':!![]});}else{logger[_0xf13f('0x18')](_0xf13f('0x6a'),'status',_0xf13f('0x6f'),util[_0xf13f('0x67')](_0x24de21['body'],{'showHidden':![],'depth':null}));}break;}return _0x580bff;}})[_0xf13f('0x11')](respondWithResult(_0x1c6d52,null))['catch'](handleError(_0x1c6d52,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 5e7d85e..7f44c6e 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 _0x1c54=['../../mysqldb','remove','emit','hasOwnProperty','hook','exports'];(function(_0x18fd21,_0x4af3d1){var _0x113f67=function(_0x45b480){while(--_0x45b480){_0x18fd21['push'](_0x18fd21['shift']());}};_0x113f67(++_0x4af3d1);}(_0x1c54,0xcc));var _0x41c5=function(_0x545eb3,_0x2d590c){_0x545eb3=_0x545eb3-0x0;var _0x24beed=_0x1c54[_0x545eb3];return _0x24beed;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x41c5('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x41c5('0x1')};function emitEvent(_0x328b86){return function(_0x1b18be,_0x2ddeb9,_0x425963){SmsMessageEvents[_0x41c5('0x2')](_0x328b86+':'+_0x1b18be['id'],_0x1b18be);SmsMessageEvents['emit'](_0x328b86,_0x1b18be);_0x425963(null);};}for(var e in events){if(events[_0x41c5('0x3')](e)){var event=events[e];SmsMessage[_0x41c5('0x4')](e,emitEvent(event));}}module[_0x41c5('0x5')]=SmsMessageEvents; \ No newline at end of file +var _0x228e=['hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1473b0,_0x18cdcf){var _0x1b901d=function(_0x19c3bf){while(--_0x19c3bf){_0x1473b0['push'](_0x1473b0['shift']());}};_0x1b901d(++_0x18cdcf);}(_0x228e,0x64));var _0xe228=function(_0xafc1cf,_0x1eac9f){_0xafc1cf=_0xafc1cf-0x0;var _0x3dfe53=_0x228e[_0xafc1cf];return _0x3dfe53;};'use strict';var EventEmitter=require(_0xe228('0x0'));var SmsMessage=require(_0xe228('0x1'))['db'][_0xe228('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe228('0x3')](0x0);var events={'afterCreate':_0xe228('0x4'),'afterUpdate':_0xe228('0x5'),'afterDestroy':'remove'};function emitEvent(_0x36b0d7){return function(_0x2271a8,_0x1aac24,_0x3e5b93){SmsMessageEvents['emit'](_0x36b0d7+':'+_0x2271a8['id'],_0x2271a8);SmsMessageEvents[_0xe228('0x6')](_0x36b0d7,_0x2271a8);_0x3e5b93(null);};}for(var e in events){if(events[_0xe228('0x7')](e)){var event=events[e];SmsMessage[_0xe228('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index a1ed7ec..f67f6e8 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 _0xfd72=['SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','SmsInteractionId','findOne','then','catch','error','secret','SmsAccountId','type','twilio','phone','accountSid','authToken','create','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','login?username=','&password=','password','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','queued_count','head','messages','message_id','clickSend','authId','remote','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','infobip','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','login','timestamp','keys','sort','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','bandwidth','accountId','/messages','applicationId','intelepeer','apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define'];(function(_0x4180a1,_0x473266){var _0x1f4fe0=function(_0xaf6e92){while(--_0xaf6e92){_0x4180a1['push'](_0x4180a1['shift']());}};_0x1f4fe0(++_0x473266);}(_0xfd72,0x6c));var _0x2fd7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfd72[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2fd7('0x0'));var util=require(_0x2fd7('0x1'));var logger=require(_0x2fd7('0x2'))(_0x2fd7('0x3'));var moment=require(_0x2fd7('0x4'));var BPromise=require(_0x2fd7('0x5'));var rp=require(_0x2fd7('0x6'));var fs=require('fs');var path=require(_0x2fd7('0x7'));var rimraf=require(_0x2fd7('0x8'));var config=require(_0x2fd7('0x9'));var attributes=require(_0x2fd7('0xa'));module['exports']=function(_0xfba8e8,_0x4ab1a7){return _0xfba8e8[_0x2fd7('0xb')](_0x2fd7('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x2fd7('0xd'),'fields':[_0x2fd7('0xd')]},{'name':_0x2fd7('0xe'),'fields':[_0x2fd7('0xf')],'type':_0x2fd7('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e33c7,_0x16dd95,_0x31b5f0){var _0x25dc7a=_0xfba8e8[_0x2fd7('0x11')];var _0x44d19e=_0x3e33c7[_0x2fd7('0x12')]({'plain':!![]});if(_0x44d19e[_0x2fd7('0x13')][_0x2fd7('0x14')]()==='in'||_0x44d19e[_0x2fd7('0x13')][_0x2fd7('0x14')]()===_0x2fd7('0x15')&&!_0x44d19e['secret']&&!_['isNil'](_0x44d19e['UserId'])&&!_['isNil'](_0x44d19e[_0x2fd7('0x16')])){_0x25dc7a['SmsInteraction'][_0x2fd7('0x17')]({'where':{'id':_0x44d19e[_0x2fd7('0x16')]}})[_0x2fd7('0x18')](function(_0x5f1f36){if(_0x5f1f36){_0x5f1f36['update']({'lastMsgAt':_0x44d19e['createdAt'],'lastMsgDirection':_0x44d19e[_0x2fd7('0x13')][_0x2fd7('0x14')]()});}})[_0x2fd7('0x19')](function(_0x5f3b19){console[_0x2fd7('0x1a')](_0x5f3b19);});}if(_0x44d19e['direction']===_0x2fd7('0x15')&&!_0x44d19e[_0x2fd7('0x1b')]){var _0x3a3bb7;_0x25dc7a['SmsAccount']['find']({'where':{'id':_0x44d19e[_0x2fd7('0x1c')]},'raw':!![]})[_0x2fd7('0x18')](function(_0x120338){_0x3a3bb7=_0x120338;if(_0x3a3bb7&&_0x3a3bb7[_0x2fd7('0x1d')]){switch(_0x3a3bb7[_0x2fd7('0x1d')]){case _0x2fd7('0x1e'):var _0x11d6e2=require('twilio');if(_0x3a3bb7['accountSid']&&_0x3a3bb7['authToken']&&_0x3a3bb7[_0x2fd7('0x1f')]){var _0x4bcbbc=new _0x11d6e2(_0x3a3bb7[_0x2fd7('0x20')],_0x3a3bb7[_0x2fd7('0x21')]);_0x4bcbbc['messages'][_0x2fd7('0x22')]({'body':_0x44d19e[_0x2fd7('0xf')],'to':_0x44d19e['phone'],'from':_0x3a3bb7[_0x2fd7('0x1f')],'statusCallback':_0x3a3bb7['remote']+_0x2fd7('0x23')+_0x44d19e['id']+_0x2fd7('0x24')+_0x3a3bb7[_0x2fd7('0x25')]})[_0x2fd7('0x18')](function(_0x86b680){if(_0x86b680[_0x2fd7('0x26')]){return _0x3e33c7[_0x2fd7('0x27')]({'messageId':_0x86b680['sid']});}})[_0x2fd7('0x19')](function(_0x10aa78){logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'twilio',util['inspect'](_0x10aa78,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x1e'),_0x2fd7('0x2a'));}break;case _0x2fd7('0x2b'):var _0x1ec378='https://api.skebby.it/API/v1.0/REST/';if(_0x3a3bb7[_0x2fd7('0x2c')]&&_0x3a3bb7['password']){var _0x11943d={'recipient':[_0x44d19e[_0x2fd7('0x1f')]],'message':_0x44d19e[_0x2fd7('0xf')],'message_type':_0x3a3bb7[_0x2fd7('0x2d')]};if(_0x3a3bb7[_0x2fd7('0x2d')]&&_0x3a3bb7['smsMethod']!=='SI'){_0x11943d[_0x2fd7('0x2e')]=_0x3a3bb7[_0x2fd7('0x1f')];}var _0x2cb7b7={'url':_0x1ec378+_0x2fd7('0x2f')+_0x3a3bb7[_0x2fd7('0x2c')]+_0x2fd7('0x30')+_0x3a3bb7[_0x2fd7('0x31')],'method':_0x2fd7('0x32')};rp(_0x2cb7b7)[_0x2fd7('0x18')](function(_0x2f2e30){var _0x1478f0=_0x2f2e30[_0x2fd7('0x33')](';');var _0x9671bf={'user_key':_0x1478f0[0x0],'session_key':_0x1478f0[0x1]};_0x2cb7b7={'url':_0x1ec378+_0x2fd7('0x34'),'method':_0x2fd7('0x35'),'headers':{'user_key':_0x9671bf['user_key'],'Session_key':_0x9671bf[_0x2fd7('0x36')]},'json':!![],'body':_0x11943d};return rp(_0x2cb7b7);})[_0x2fd7('0x18')](function(_0x1cb520){if(_0x1cb520[_0x2fd7('0x37')]>=0x1){var _0xf38767={'messageId':_0x1cb520[_0x2fd7('0x38')]};if(_0x3a3bb7['smsMethod']!=='GP'||!_0x3a3bb7[_0x2fd7('0x39')]){_0xf38767[_0x2fd7('0x3a')]=!![];}return _0x3e33c7['update'](_0xf38767);}else{return logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'skebby',util['inspect'](_0x1cb520,{'showHidden':![],'depth':null}));}})['catch'](function(_0x397307){return logger[_0x2fd7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2fd7('0x29'),_0x2fd7('0x2b'),util[_0x2fd7('0x3b')](_0x397307,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),'afterCreate',_0x2fd7('0x2b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2fd7('0x3c'):if(_0x3a3bb7[_0x2fd7('0x21')]){var _0x1ae77a={'recipient':_0x44d19e[_0x2fd7('0x1f')],'message':_0x44d19e['body'],'sender':_0x3a3bb7[_0x2fd7('0x3d')]||_0x3a3bb7[_0x2fd7('0x1f')],'authorization':_0x3a3bb7['authToken']};var _0x16dd95={'method':_0x2fd7('0x35'),'uri':_0x2fd7('0x3e'),'body':_0x1ae77a,'json':!![]};rp(_0x16dd95)['then'](function(_0x3293cd){var _0x4251cd={'messageId':_0x3293cd[_0x2fd7('0x3f')]};if(!_0x3a3bb7[_0x2fd7('0x39')]){_0x4251cd[_0x2fd7('0x3a')]=!![];}return _0x3e33c7['update'](_0x4251cd);})[_0x2fd7('0x19')](function(_0x2160cc){logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'connectel',util[_0x2fd7('0x3b')](_0x2160cc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2fd7('0x28'),_0x2fd7('0x29'),'connectel',_0x2fd7('0x40'));}break;case _0x2fd7('0x41'):if(_0x3a3bb7['username']&&_0x3a3bb7['password']){var _0x1ae77a={'messages':[{'source':_0x2fd7('0x42'),'to':_0x44d19e[_0x2fd7('0x1f')],'body':_0x44d19e[_0x2fd7('0xf')],'from':_0x3a3bb7['senderString']||_0x3a3bb7[_0x2fd7('0x1f')]}]};var _0x37a06e=util['format'](_0x2fd7('0x43'),_0x3a3bb7['username'],_0x3a3bb7['password']);var _0x16dd95={'method':'POST','uri':_0x2fd7('0x44'),'body':_0x1ae77a,'headers':{'Authorization':util[_0x2fd7('0x45')](_0x2fd7('0x46'),new Buffer(_0x37a06e)[_0x2fd7('0x47')](_0x2fd7('0x48')))},'json':!![]};rp(_0x16dd95)[_0x2fd7('0x18')](function(_0x403dad){if(_0x403dad[_0x2fd7('0x49')]>=0xc8&&_0x403dad[_0x2fd7('0x49')]<=0xce){if(_0x403dad['data']&&_0x403dad['data'][_0x2fd7('0x4a')]>0x0){var _0x39245b=_[_0x2fd7('0x4b')](_0x403dad['data'][_0x2fd7('0x4c')]);var _0x15d484={'messageId':_0x39245b[_0x2fd7('0x4d')]};if(!_0x3a3bb7[_0x2fd7('0x39')]){_0x15d484[_0x2fd7('0x3a')]=!![];}return _0x3e33c7[_0x2fd7('0x27')](_0x15d484);}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'clickSend',util['inspect'](_0x403dad,{'showHidden':![],'depth':null}));}}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x4e'),util[_0x2fd7('0x3b')](_0x403dad,{'showHidden':![],'depth':null}));}})['catch'](function(_0x290d2c){logger[_0x2fd7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2fd7('0x29'),'clickSend',util[_0x2fd7('0x3b')](_0x290d2c,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x3a3bb7[_0x2fd7('0x4f')]&&_0x3a3bb7[_0x2fd7('0x21')]){var _0x1ae77a={'dst':_0x44d19e[_0x2fd7('0x1f')],'text':_0x44d19e['body'],'src':_0x3a3bb7[_0x2fd7('0x3d')]||_0x3a3bb7[_0x2fd7('0x1f')],'url':_0x3a3bb7[_0x2fd7('0x50')]+_0x2fd7('0x23')+_0x44d19e['id']+_0x2fd7('0x24')+_0x3a3bb7[_0x2fd7('0x25')]};var _0x37a06e=util[_0x2fd7('0x45')]('%s:%s',_0x3a3bb7[_0x2fd7('0x4f')],_0x3a3bb7['authToken']);var _0x16dd95={'method':_0x2fd7('0x35'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x3a3bb7[_0x2fd7('0x4f')]),'body':_0x1ae77a,'headers':{'Authorization':util[_0x2fd7('0x45')](_0x2fd7('0x46'),new Buffer(_0x37a06e)[_0x2fd7('0x47')](_0x2fd7('0x48')))},'json':!![]};rp(_0x16dd95)[_0x2fd7('0x18')](function(_0x15c080){var _0x518a23={'messageId':_0x15c080[_0x2fd7('0x51')][0x0]};return _0x3e33c7[_0x2fd7('0x27')](_0x518a23);})[_0x2fd7('0x19')](function(_0x295606){logger['error'](_0x2fd7('0x28'),_0x2fd7('0x29'),'plivo',util[_0x2fd7('0x3b')](_0x295606,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'plivo',_0x2fd7('0x52'));}break;case'infobip':if(_0x3a3bb7['username']&&_0x3a3bb7['password']){if(_0x3a3bb7['baseUrl']){var _0x15c5ae={'method':_0x2fd7('0x35'),'uri':_0x3a3bb7[_0x2fd7('0x53')]+'/auth/1/session','body':{'username':_0x3a3bb7[_0x2fd7('0x2c')],'password':_0x3a3bb7[_0x2fd7('0x31')]},'json':!![]};return rp(_0x15c5ae)['then'](function(_0x8dc6ec){var _0x56f799={'method':_0x2fd7('0x35'),'uri':_0x3a3bb7[_0x2fd7('0x53')]+_0x2fd7('0x54'),'body':{'messages':[{'from':_0x3a3bb7[_0x2fd7('0x1f')],'destinations':[{'to':_0x44d19e[_0x2fd7('0x1f')]}],'text':_0x44d19e[_0x2fd7('0xf')],'notifyUrl':_0x3a3bb7[_0x2fd7('0x50')]+_0x2fd7('0x23')+_0x44d19e['id']+'/status?token='+_0x3a3bb7[_0x2fd7('0x25')],'notifyContentType':_0x2fd7('0x55'),'callbackData':_0x3a3bb7[_0x2fd7('0x1f')]+';'+_0x44d19e['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x8dc6ec['token']},'json':!![]};return rp(_0x56f799)[_0x2fd7('0x18')](function(_0x594b6c){if(_0x594b6c['messages']){var _0x4a9db3={'messageId':_0x594b6c[_0x2fd7('0x4c')][0x0][_0x2fd7('0xd')]};if(!_0x3a3bb7[_0x2fd7('0x39')]){_0x4a9db3[_0x2fd7('0x3a')]=!![];}return _0x3e33c7[_0x2fd7('0x27')](_0x4a9db3);}else{return logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x56'),util[_0x2fd7('0x3b')](_0x594b6c,{'showHidden':![],'depth':null}));}});})[_0x2fd7('0x19')](function(_0x43eb8f){return logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),'afterCreate',_0x2fd7('0x56'),util['inspect'](_0x43eb8f,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x56'),_0x2fd7('0x57'));}}else{logger['error'](_0x2fd7('0x28'),'afterCreate',_0x2fd7('0x56'),_0x2fd7('0x58'));}break;case _0x2fd7('0x59'):var _0x5ee41c=require(_0x2fd7('0x5a'));if(_0x3a3bb7['apiKey']){var _0x1e21fa={};_0x1e21fa[_0x2fd7('0x5b')]=_0x3a3bb7['username'];_0x1e21fa[_0x2fd7('0x1f')]=_0x44d19e[_0x2fd7('0x1f')];_0x1e21fa[_0x2fd7('0x2e')]=_0x3a3bb7['phone'];_0x1e21fa['text']=_0x44d19e[_0x2fd7('0xf')];_0x1e21fa[_0x2fd7('0x5c')]=+new Date();var _0x7994c1='';var _0x4bcc92='';var _0x5bf5e3=Object[_0x2fd7('0x5d')](_0x1e21fa);_0x5bf5e3[_0x2fd7('0x5e')]();for(var _0x250203=0x0;_0x250203<_0x5bf5e3['length'];_0x250203++){if(_0x7994c1!=''){_0x7994c1+='&';}_0x7994c1+=_0x5bf5e3[_0x250203]+'='+encodeURIComponent(_0x1e21fa[_0x5bf5e3[_0x250203]]);_0x4bcc92+=_0x1e21fa[_0x5bf5e3[_0x250203]];}_0x4bcc92+=_0x3a3bb7['apiKey'];_0x4bcc92=_0x5ee41c[_0x2fd7('0x5f')](_0x2fd7('0x60'))[_0x2fd7('0x27')](_0x4bcc92)[_0x2fd7('0x61')](_0x2fd7('0x62'));if(_0x7994c1!==''){_0x7994c1+='&';}_0x7994c1+=_0x2fd7('0x63')+_0x4bcc92;var _0x2cb7b7={'method':'GET','uri':_0x3a3bb7['baseUrl']+_0x2fd7('0x64')+_0x7994c1,'json':!![]};return rp(_0x2cb7b7)['then'](function(_0x4914c6){var _0x3997e7=Object[_0x2fd7('0x5d')](_0x4914c6);if(_0x4914c6[_0x3997e7[0x0]][_0x2fd7('0x1a')]&&parseInt(_0x4914c6[_0x3997e7[0x0]][_0x2fd7('0x1a')])===0x0){var _0xb8a0bc={'messageId':_0x4914c6[_0x3997e7[0x0]][_0x2fd7('0x65')]};if(!_0x3a3bb7[_0x2fd7('0x39')]){_0xb8a0bc[_0x2fd7('0x3a')]=!![];}return _0x3e33c7[_0x2fd7('0x27')](_0xb8a0bc);}else{return logger['error'](_0x2fd7('0x28'),'afterCreate',_0x2fd7('0x59'),util['inspect'](_0x4914c6[_0x2fd7('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x411e8e){return logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'csc',util['inspect'](_0x411e8e,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x59'),_0x2fd7('0x66'));}break;case _0x2fd7('0x67'):if(_0x3a3bb7['apiKey']){var _0x58a727={'method':'POST','uri':_0x2fd7('0x68'),'headers':{'Authorization':_0x3a3bb7['apiKey']},'body':{'content':_0x44d19e[_0x2fd7('0xf')],'to':[_0x44d19e[_0x2fd7('0x1f')]],'from':_0x3a3bb7[_0x2fd7('0x1f')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x58a727)['then'](function(_0x4df399){if(!_0x4df399[_0x2fd7('0x1a')]){var _0x38a0a4={'messageId':_0x4df399[_0x2fd7('0x4c')][0x0]['apiMessageId']};if(!_0x3a3bb7[_0x2fd7('0x39')]){_0x38a0a4[_0x2fd7('0x3a')]=!![];}return _0x3e33c7['update'](_0x38a0a4);}else{return logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x67'),util[_0x2fd7('0x3b')](_0x4df399[_0x2fd7('0x1a')],{'showHidden':![],'depth':null}));}})[_0x2fd7('0x19')](function(_0x3e2aa7){return logger['error'](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x67'),util['inspect'](_0x3e2aa7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2fd7('0x28'),_0x2fd7('0x29'),'clickatell',_0x2fd7('0x66'));}break;case _0x2fd7('0x69'):if(_0x3a3bb7['username']&&_0x3a3bb7[_0x2fd7('0x31')]){var _0x37a06e=util[_0x2fd7('0x45')](_0x2fd7('0x43'),_0x3a3bb7[_0x2fd7('0x2c')],_0x3a3bb7['password']);var _0x16dd95={'method':_0x2fd7('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3a3bb7[_0x2fd7('0x6a')]+_0x2fd7('0x6b'),'body':{'to':[_0x44d19e[_0x2fd7('0x1f')]],'text':_0x44d19e[_0x2fd7('0xf')],'from':_0x3a3bb7[_0x2fd7('0x1f')],'applicationId':_0x3a3bb7[_0x2fd7('0x6c')]},'headers':{'Authorization':util[_0x2fd7('0x45')]('Basic\x20%s',new Buffer(_0x37a06e)[_0x2fd7('0x47')]('base64'))},'json':!![]};rp(_0x16dd95)[_0x2fd7('0x18')](function(_0x515bf6){if(_0x515bf6['id']){var _0x4728d5={'messageId':_0x515bf6['id']};return _0x3e33c7[_0x2fd7('0x27')](_0x4728d5);}else{logger['error'](_0x2fd7('0x28'),'afterCreate','bandwidth',util['inspect'](_0x515bf6,{'showHidden':![],'depth':null}));}})[_0x2fd7('0x19')](function(_0x266477){logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x69'),util[_0x2fd7('0x3b')](_0x266477,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x69'),_0x2fd7('0x58'));}break;case _0x2fd7('0x6d'):if(_0x3a3bb7[_0x2fd7('0x6e')]){var _0x5076e7={};var _0x2cb7b7={'method':'POST','uri':_0x2fd7('0x6f'),'headers':{'Authorization':_0x2fd7('0x70')+_0x3a3bb7['apiKey'],'Content-Type':_0x2fd7('0x55')},'body':{'from':_0x3a3bb7[_0x2fd7('0x1f')],'to':_0x44d19e['phone'],'text':_0x44d19e[_0x2fd7('0xf')]},'json':!![]};return rp(_0x2cb7b7)[_0x2fd7('0x18')](function(_0x11b157){if(_0x11b157[_0x2fd7('0x71')]==0xca){_0x5076e7['message']=_0x11b157;var _0x1d10d2={'method':_0x2fd7('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x3a3bb7['apiKey'],'Content-Type':_0x2fd7('0x55')},'body':{'refid':_0x5076e7['message'][_0x2fd7('0x72')]},'json':!![]};return rp(_0x1d10d2)[_0x2fd7('0x18')](function(_0x5811d1){_0x5076e7[_0x2fd7('0x73')]=_0x5811d1;var _0x127923={'messageId':_0x5076e7['message']['refid'],'read':!![]};return _0x3e33c7['update'](_0x127923);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2fd7('0x29'),_0x2fd7('0x6d'),util[_0x2fd7('0x3b')](_0x11b157,{'showHidden':![],'depth':null}));}})[_0x2fd7('0x19')](function(_0x16baa4){return logger[_0x2fd7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x2fd7('0x3b')](_0x16baa4,{'showHidden':![],'depth':null}));});}else{return logger[_0x2fd7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2fd7('0x6d'),_0x2fd7('0x74'));}break;}}})[_0x2fd7('0x75')](function(){_0x31b5f0();});}else{_0x31b5f0();}}},'charset':_0x2fd7('0x76'),'collate':_0x2fd7('0x77')});}; \ No newline at end of file +var _0xabd6=['catch','error','find','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','senderString','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','%s:%s','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','keys','createHash','md5','digest','hex','signature=','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','findOne','SmsInteractionId','update','createdAt'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xabd6,0x155));var _0x6abd=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xabd6[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x6abd('0x0'));var util=require(_0x6abd('0x1'));var logger=require(_0x6abd('0x2'))(_0x6abd('0x3'));var moment=require(_0x6abd('0x4'));var BPromise=require(_0x6abd('0x5'));var rp=require(_0x6abd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6abd('0x7'));var config=require('../../config/environment');var attributes=require(_0x6abd('0x8'));module[_0x6abd('0x9')]=function(_0x37b7e0,_0x3b1c7c){return _0x37b7e0[_0x6abd('0xa')](_0x6abd('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x6abd('0xc'),'fields':['messageId']},{'name':_0x6abd('0xd'),'fields':[_0x6abd('0xe')],'type':_0x6abd('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39dd88,_0x228a14,_0xbd446){var _0x4cb8de=_0x37b7e0[_0x6abd('0x10')];var _0x2fe6ac=_0x39dd88[_0x6abd('0x11')]({'plain':!![]});if(_0x2fe6ac[_0x6abd('0x12')][_0x6abd('0x13')]()==='in'||_0x2fe6ac[_0x6abd('0x12')]['toLowerCase']()===_0x6abd('0x14')&&!_0x2fe6ac[_0x6abd('0x15')]&&!_['isNil'](_0x2fe6ac[_0x6abd('0x16')])&&!_[_0x6abd('0x17')](_0x2fe6ac['SmsInteractionId'])){_0x4cb8de['SmsInteraction'][_0x6abd('0x18')]({'where':{'id':_0x2fe6ac[_0x6abd('0x19')]}})['then'](function(_0x3df45c){if(_0x3df45c){_0x3df45c[_0x6abd('0x1a')]({'lastMsgAt':_0x2fe6ac[_0x6abd('0x1b')],'lastMsgDirection':_0x2fe6ac[_0x6abd('0x12')][_0x6abd('0x13')]()});}})[_0x6abd('0x1c')](function(_0x585186){console[_0x6abd('0x1d')](_0x585186);});}if(_0x2fe6ac[_0x6abd('0x12')]===_0x6abd('0x14')&&!_0x2fe6ac[_0x6abd('0x15')]){var _0x3f41f9;_0x4cb8de['SmsAccount'][_0x6abd('0x1e')]({'where':{'id':_0x2fe6ac['SmsAccountId']},'raw':!![]})[_0x6abd('0x1f')](function(_0xc28daa){_0x3f41f9=_0xc28daa;if(_0x3f41f9&&_0x3f41f9['type']){switch(_0x3f41f9[_0x6abd('0x20')]){case _0x6abd('0x21'):var _0x2995=require(_0x6abd('0x21'));if(_0x3f41f9[_0x6abd('0x22')]&&_0x3f41f9[_0x6abd('0x23')]&&_0x3f41f9[_0x6abd('0x24')]){var _0x263e26=new _0x2995(_0x3f41f9[_0x6abd('0x22')],_0x3f41f9['authToken']);_0x263e26[_0x6abd('0x25')][_0x6abd('0x26')]({'body':_0x2fe6ac[_0x6abd('0xe')],'to':_0x2fe6ac['phone'],'from':_0x3f41f9[_0x6abd('0x24')],'statusCallback':_0x3f41f9[_0x6abd('0x27')]+'/api/sms/messages/'+_0x2fe6ac['id']+_0x6abd('0x28')+_0x3f41f9[_0x6abd('0x29')]})[_0x6abd('0x1f')](function(_0x1bf86d){if(_0x1bf86d[_0x6abd('0x2a')]){return _0x39dd88[_0x6abd('0x1a')]({'messageId':_0x1bf86d[_0x6abd('0x2a')]});}})[_0x6abd('0x1c')](function(_0x1729dc){logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),'twilio',util[_0x6abd('0x2d')](_0x1729dc,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6abd('0x2c'),'twilio',_0x6abd('0x2e'));}break;case'skebby':var _0x1a2f61=_0x6abd('0x2f');if(_0x3f41f9[_0x6abd('0x30')]&&_0x3f41f9[_0x6abd('0x31')]){var _0x292153={'recipient':[_0x2fe6ac[_0x6abd('0x24')]],'message':_0x2fe6ac[_0x6abd('0xe')],'message_type':_0x3f41f9[_0x6abd('0x32')]};if(_0x3f41f9[_0x6abd('0x32')]&&_0x3f41f9[_0x6abd('0x32')]!=='SI'){_0x292153['sender']=_0x3f41f9[_0x6abd('0x24')];}var _0x25fb43={'url':_0x1a2f61+_0x6abd('0x33')+_0x3f41f9['username']+_0x6abd('0x34')+_0x3f41f9[_0x6abd('0x31')],'method':_0x6abd('0x35')};rp(_0x25fb43)['then'](function(_0x1ee773){var _0x1e8ad4=_0x1ee773['split'](';');var _0x315865={'user_key':_0x1e8ad4[0x0],'session_key':_0x1e8ad4[0x1]};_0x25fb43={'url':_0x1a2f61+_0x6abd('0x36'),'method':_0x6abd('0x37'),'headers':{'user_key':_0x315865[_0x6abd('0x38')],'Session_key':_0x315865[_0x6abd('0x39')]},'json':!![],'body':_0x292153};return rp(_0x25fb43);})[_0x6abd('0x1f')](function(_0x4c2fa1){if(_0x4c2fa1['total_sent']>=0x1){var _0x1add52={'messageId':_0x4c2fa1[_0x6abd('0x3a')]};if(_0x3f41f9['smsMethod']!=='GP'||!_0x3f41f9[_0x6abd('0x3b')]){_0x1add52[_0x6abd('0x3c')]=!![];}return _0x39dd88[_0x6abd('0x1a')](_0x1add52);}else{return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),'afterCreate','skebby',util['inspect'](_0x4c2fa1,{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x1d34f1){return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),'afterCreate',_0x6abd('0x3d'),util['inspect'](_0x1d34f1,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),'afterCreate',_0x6abd('0x3d'),_0x6abd('0x3e'));}break;case'connectel':if(_0x3f41f9['authToken']){var _0x319709={'recipient':_0x2fe6ac[_0x6abd('0x24')],'message':_0x2fe6ac[_0x6abd('0xe')],'sender':_0x3f41f9['senderString']||_0x3f41f9[_0x6abd('0x24')],'authorization':_0x3f41f9[_0x6abd('0x23')]};var _0x228a14={'method':_0x6abd('0x37'),'uri':_0x6abd('0x3f'),'body':_0x319709,'json':!![]};rp(_0x228a14)[_0x6abd('0x1f')](function(_0x1902f9){var _0xb4f815={'messageId':_0x1902f9[_0x6abd('0x40')]};if(!_0x3f41f9['deliveryReport']){_0xb4f815[_0x6abd('0x3c')]=!![];}return _0x39dd88[_0x6abd('0x1a')](_0xb4f815);})['catch'](function(_0x2e66c9){logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),'connectel',util[_0x6abd('0x2d')](_0x2e66c9,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x41'),_0x6abd('0x42'));}break;case _0x6abd('0x43'):if(_0x3f41f9[_0x6abd('0x30')]&&_0x3f41f9[_0x6abd('0x31')]){var _0x319709={'messages':[{'source':'xCALLY\x20Motion','to':_0x2fe6ac[_0x6abd('0x24')],'body':_0x2fe6ac[_0x6abd('0xe')],'from':_0x3f41f9[_0x6abd('0x44')]||_0x3f41f9[_0x6abd('0x24')]}]};var _0x2d4f1b=util[_0x6abd('0x45')]('%s:%s',_0x3f41f9[_0x6abd('0x30')],_0x3f41f9['password']);var _0x228a14={'method':_0x6abd('0x37'),'uri':_0x6abd('0x46'),'body':_0x319709,'headers':{'Authorization':util[_0x6abd('0x45')](_0x6abd('0x47'),new Buffer(_0x2d4f1b)[_0x6abd('0x48')]('base64'))},'json':!![]};rp(_0x228a14)[_0x6abd('0x1f')](function(_0x395294){if(_0x395294[_0x6abd('0x49')]>=0xc8&&_0x395294['http_code']<=0xce){if(_0x395294['data']&&_0x395294[_0x6abd('0x4a')][_0x6abd('0x4b')]>0x0){var _0x3de6b5=_[_0x6abd('0x4c')](_0x395294[_0x6abd('0x4a')][_0x6abd('0x25')]);var _0x45f84b={'messageId':_0x3de6b5[_0x6abd('0x4d')]};if(!_0x3f41f9[_0x6abd('0x3b')]){_0x45f84b['read']=!![];}return _0x39dd88[_0x6abd('0x1a')](_0x45f84b);}else{logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x4e'),util[_0x6abd('0x2d')](_0x395294,{'showHidden':![],'depth':null}));}}else{logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6abd('0x2c'),'clickSend',util[_0x6abd('0x2d')](_0x395294,{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x128ccb){logger[_0x6abd('0x1d')](_0x6abd('0x2b'),'afterCreate',_0x6abd('0x4e'),util[_0x6abd('0x2d')](_0x128ccb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6abd('0x4f'):if(_0x3f41f9[_0x6abd('0x50')]&&_0x3f41f9[_0x6abd('0x23')]){var _0x319709={'dst':_0x2fe6ac[_0x6abd('0x24')],'text':_0x2fe6ac[_0x6abd('0xe')],'src':_0x3f41f9[_0x6abd('0x44')]||_0x3f41f9[_0x6abd('0x24')],'url':_0x3f41f9['remote']+_0x6abd('0x51')+_0x2fe6ac['id']+_0x6abd('0x28')+_0x3f41f9[_0x6abd('0x29')]};var _0x2d4f1b=util[_0x6abd('0x45')](_0x6abd('0x52'),_0x3f41f9['authId'],_0x3f41f9[_0x6abd('0x23')]);var _0x228a14={'method':_0x6abd('0x37'),'uri':util[_0x6abd('0x45')]('https://api.plivo.com/v1/Account/%s/Message/',_0x3f41f9[_0x6abd('0x50')]),'body':_0x319709,'headers':{'Authorization':util['format'](_0x6abd('0x47'),new Buffer(_0x2d4f1b)[_0x6abd('0x48')](_0x6abd('0x53')))},'json':!![]};rp(_0x228a14)['then'](function(_0x2ec93a){var _0x145951={'messageId':_0x2ec93a[_0x6abd('0x54')][0x0]};return _0x39dd88[_0x6abd('0x1a')](_0x145951);})['catch'](function(_0x26d586){logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x4f'),util['inspect'](_0x26d586,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),'plivo',_0x6abd('0x55'));}break;case _0x6abd('0x56'):if(_0x3f41f9['username']&&_0x3f41f9['password']){if(_0x3f41f9[_0x6abd('0x57')]){var _0x20c8da={'method':'POST','uri':_0x3f41f9[_0x6abd('0x57')]+_0x6abd('0x58'),'body':{'username':_0x3f41f9[_0x6abd('0x30')],'password':_0x3f41f9[_0x6abd('0x31')]},'json':!![]};return rp(_0x20c8da)[_0x6abd('0x1f')](function(_0x35e485){var _0x21c74c={'method':'POST','uri':_0x3f41f9['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3f41f9['phone'],'destinations':[{'to':_0x2fe6ac[_0x6abd('0x24')]}],'text':_0x2fe6ac[_0x6abd('0xe')],'notifyUrl':_0x3f41f9[_0x6abd('0x27')]+_0x6abd('0x51')+_0x2fe6ac['id']+'/status?token='+_0x3f41f9['token'],'notifyContentType':'application/json','callbackData':_0x3f41f9['phone']+';'+_0x2fe6ac[_0x6abd('0xe')]}]},'headers':{'Authorization':_0x6abd('0x59')+_0x35e485[_0x6abd('0x29')]},'json':!![]};return rp(_0x21c74c)[_0x6abd('0x1f')](function(_0x15e73f){if(_0x15e73f[_0x6abd('0x25')]){var _0x582ff0={'messageId':_0x15e73f['messages'][0x0]['messageId']};if(!_0x3f41f9[_0x6abd('0x3b')]){_0x582ff0[_0x6abd('0x3c')]=!![];}return _0x39dd88['update'](_0x582ff0);}else{return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x56'),util['inspect'](_0x15e73f,{'showHidden':![],'depth':null}));}});})[_0x6abd('0x1c')](function(_0x215926){return logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x56'),util['inspect'](_0x215926,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x56'),_0x6abd('0x5a'));}}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x56'),_0x6abd('0x3e'));}break;case _0x6abd('0x5b'):var _0x460dc1=require(_0x6abd('0x5c'));if(_0x3f41f9[_0x6abd('0x5d')]){var _0x25f732={};_0x25f732[_0x6abd('0x5e')]=_0x3f41f9[_0x6abd('0x30')];_0x25f732[_0x6abd('0x24')]=_0x2fe6ac[_0x6abd('0x24')];_0x25f732[_0x6abd('0x5f')]=_0x3f41f9[_0x6abd('0x24')];_0x25f732[_0x6abd('0x60')]=_0x2fe6ac['body'];_0x25f732['timestamp']=+new Date();var _0x6b6525='';var _0x15210c='';var _0x36ab08=Object[_0x6abd('0x61')](_0x25f732);_0x36ab08['sort']();for(var _0x4c8879=0x0;_0x4c8879<_0x36ab08['length'];_0x4c8879++){if(_0x6b6525!=''){_0x6b6525+='&';}_0x6b6525+=_0x36ab08[_0x4c8879]+'='+encodeURIComponent(_0x25f732[_0x36ab08[_0x4c8879]]);_0x15210c+=_0x25f732[_0x36ab08[_0x4c8879]];}_0x15210c+=_0x3f41f9[_0x6abd('0x5d')];_0x15210c=_0x460dc1[_0x6abd('0x62')](_0x6abd('0x63'))[_0x6abd('0x1a')](_0x15210c)[_0x6abd('0x64')](_0x6abd('0x65'));if(_0x6b6525!==''){_0x6b6525+='&';}_0x6b6525+=_0x6abd('0x66')+_0x15210c;var _0x25fb43={'method':'GET','uri':_0x3f41f9['baseUrl']+'/external/get/send.php?'+_0x6b6525,'json':!![]};return rp(_0x25fb43)[_0x6abd('0x1f')](function(_0x4090a1){var _0x3763cd=Object[_0x6abd('0x61')](_0x4090a1);if(_0x4090a1[_0x3763cd[0x0]][_0x6abd('0x1d')]&&parseInt(_0x4090a1[_0x3763cd[0x0]][_0x6abd('0x1d')])===0x0){var _0x4dabd0={'messageId':_0x4090a1[_0x3763cd[0x0]][_0x6abd('0x67')]};if(!_0x3f41f9['deliveryReport']){_0x4dabd0[_0x6abd('0x3c')]=!![];}return _0x39dd88[_0x6abd('0x1a')](_0x4dabd0);}else{return logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util[_0x6abd('0x2d')](_0x4090a1['error'],{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x1df422){return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x5b'),util['inspect'](_0x1df422,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case _0x6abd('0x68'):if(_0x3f41f9[_0x6abd('0x5d')]){var _0xa0f4a0={'method':_0x6abd('0x37'),'uri':_0x6abd('0x69'),'headers':{'Authorization':_0x3f41f9['apiKey']},'body':{'content':_0x2fe6ac['body'],'to':[_0x2fe6ac[_0x6abd('0x24')]],'from':_0x3f41f9[_0x6abd('0x24')],'binary':![],'clientMessageId':_0x6abd('0x6a'),'charset':_0x6abd('0x6b')},'json':!![]};rp(_0xa0f4a0)[_0x6abd('0x1f')](function(_0x491d54){if(!_0x491d54[_0x6abd('0x1d')]){var _0x76fa73={'messageId':_0x491d54[_0x6abd('0x25')][0x0][_0x6abd('0x6c')]};if(!_0x3f41f9[_0x6abd('0x3b')]){_0x76fa73['read']=!![];}return _0x39dd88[_0x6abd('0x1a')](_0x76fa73);}else{return logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6abd('0x2c'),_0x6abd('0x68'),util[_0x6abd('0x2d')](_0x491d54[_0x6abd('0x1d')],{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x461ada){return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x68'),util[_0x6abd('0x2d')](_0x461ada,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x68'),_0x6abd('0x6d'));}break;case _0x6abd('0x6e'):if(_0x3f41f9[_0x6abd('0x30')]&&_0x3f41f9[_0x6abd('0x31')]){var _0x2d4f1b=util[_0x6abd('0x45')](_0x6abd('0x52'),_0x3f41f9[_0x6abd('0x30')],_0x3f41f9[_0x6abd('0x31')]);var _0x228a14={'method':_0x6abd('0x37'),'uri':_0x6abd('0x6f')+_0x3f41f9[_0x6abd('0x70')]+_0x6abd('0x71'),'body':{'to':[_0x2fe6ac[_0x6abd('0x24')]],'text':_0x2fe6ac[_0x6abd('0xe')],'from':_0x3f41f9['phone'],'applicationId':_0x3f41f9['applicationId']},'headers':{'Authorization':util['format'](_0x6abd('0x47'),new Buffer(_0x2d4f1b)[_0x6abd('0x48')]('base64'))},'json':!![]};rp(_0x228a14)['then'](function(_0x36d0d4){if(_0x36d0d4['id']){var _0x19e437={'messageId':_0x36d0d4['id']};return _0x39dd88[_0x6abd('0x1a')](_0x19e437);}else{logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6abd('0x2c'),_0x6abd('0x6e'),util['inspect'](_0x36d0d4,{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x56b5b6){logger[_0x6abd('0x1d')](_0x6abd('0x2b'),'afterCreate',_0x6abd('0x6e'),util[_0x6abd('0x2d')](_0x56b5b6,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x6e'),_0x6abd('0x3e'));}break;case _0x6abd('0x72'):if(_0x3f41f9[_0x6abd('0x5d')]){var _0x42db9e={};var _0x25fb43={'method':_0x6abd('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x3f41f9[_0x6abd('0x5d')],'Content-Type':_0x6abd('0x73')},'body':{'from':_0x3f41f9[_0x6abd('0x24')],'to':_0x2fe6ac[_0x6abd('0x24')],'text':_0x2fe6ac['body']},'json':!![]};return rp(_0x25fb43)[_0x6abd('0x1f')](function(_0x1877a7){if(_0x1877a7['code']==0xca){_0x42db9e[_0x6abd('0x74')]=_0x1877a7;var _0x2928f7={'method':'POST','uri':_0x6abd('0x75'),'headers':{'Authorization':_0x6abd('0x76')+_0x3f41f9[_0x6abd('0x5d')],'Content-Type':_0x6abd('0x73')},'body':{'refid':_0x42db9e[_0x6abd('0x74')][_0x6abd('0x77')]},'json':!![]};return rp(_0x2928f7)[_0x6abd('0x1f')](function(_0x1133a2){_0x42db9e[_0x6abd('0x78')]=_0x1133a2;var _0x10fce9={'messageId':_0x42db9e[_0x6abd('0x74')][_0x6abd('0x77')],'read':!![]};return _0x39dd88[_0x6abd('0x1a')](_0x10fce9);});}else{return logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util['inspect'](_0x1877a7,{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x137bdf){return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),'intelepeer',util['inspect'](_0x137bdf,{'showHidden':![],'depth':null}));});}else{return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x72'),_0x6abd('0x79'));}break;}}})['finally'](function(){_0xbd446();});}else{_0xbd446();}}},'charset':'utf8mb4','collate':_0x6abd('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 658d691..c3b01f7 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 _0x4e8c=['rpc','../../config/environment','client','http','redis','localhost','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2827db,_0x39131a){var _0x567d6e=function(_0x4ccaf6){while(--_0x4ccaf6){_0x2827db['push'](_0x2827db['shift']());}};_0x567d6e(++_0x39131a);}(_0x4e8c,0x13a));var _0xc4e8=function(_0x4d63ac,_0x4c051b){_0x4d63ac=_0x4d63ac-0x0;var _0x287c4a=_0x4e8c[_0x4d63ac];return _0x287c4a;};'use strict';var _=require('lodash');var util=require(_0xc4e8('0x0'));var moment=require('moment');var BPromise=require(_0xc4e8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4e8('0x2'));var db=require(_0xc4e8('0x3'))['db'];var utils=require(_0xc4e8('0x4'));var logger=require(_0xc4e8('0x5'))(_0xc4e8('0x6'));var config=require(_0xc4e8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc4e8('0x8')][_0xc4e8('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc4e8('0xa')],{'host':_0xc4e8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4e8('0xa')]));require(_0xc4e8('0xc'))[_0xc4e8('0xd')](socket);function respondWithRpcPromise(_0x1adf94,_0x12632a,_0x14d308){return new BPromise(function(_0x49d21f,_0x3d1349){return client[_0xc4e8('0xe')](_0x1adf94,_0x14d308)[_0xc4e8('0xf')](function(_0x4072ee){logger[_0xc4e8('0x10')]('SmsMessage,\x20%s,\x20%s',_0x12632a,_0xc4e8('0x11'));logger[_0xc4e8('0x12')](_0xc4e8('0x13'),_0x12632a,'request\x20sent',JSON['stringify'](_0x4072ee));if(_0x4072ee['error']){if(_0x4072ee[_0xc4e8('0x14')][_0xc4e8('0x15')]===0x1f4){logger['error'](_0xc4e8('0x16'),_0x12632a,_0x4072ee[_0xc4e8('0x14')][_0xc4e8('0x17')]);return _0x3d1349(_0x4072ee[_0xc4e8('0x14')][_0xc4e8('0x17')]);}logger[_0xc4e8('0x14')]('SmsMessage,\x20%s,\x20%s',_0x12632a,_0x4072ee[_0xc4e8('0x14')]['message']);return _0x49d21f(_0x4072ee[_0xc4e8('0x14')][_0xc4e8('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x12632a,_0xc4e8('0x11'));_0x49d21f(_0x4072ee['result']['message']);}})['catch'](function(_0x557a6a){logger[_0xc4e8('0x14')](_0xc4e8('0x16'),_0x12632a,_0x557a6a);_0x3d1349(_0x557a6a);});});}exports[_0xc4e8('0x18')]=function(_0x9e8fe9){var _0x47a70a=this;return new Promise(function(_0x1f0427,_0x302ba2){return db[_0xc4e8('0x19')][_0xc4e8('0x1a')](_0x9e8fe9[_0xc4e8('0x1b')],{'raw':_0x9e8fe9[_0xc4e8('0x1c')]?_0x9e8fe9[_0xc4e8('0x1c')][_0xc4e8('0x1d')]===undefined?!![]:![]:!![]})[_0xc4e8('0xf')](function(_0x4bdb3c){logger[_0xc4e8('0x10')](_0xc4e8('0x18'),_0x9e8fe9);logger[_0xc4e8('0x12')](_0xc4e8('0x18'),_0x9e8fe9,JSON[_0xc4e8('0x1e')](_0x4bdb3c));_0x1f0427(_0x4bdb3c);})[_0xc4e8('0x1f')](function(_0x3de623){logger[_0xc4e8('0x14')](_0xc4e8('0x18'),_0x3de623[_0xc4e8('0x17')],_0x9e8fe9);_0x302ba2(_0x47a70a[_0xc4e8('0x14')](0x1f4,_0x3de623[_0xc4e8('0x17')]));});});}; \ No newline at end of file +var _0x9531=['socket.io-emitter','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','message','error','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x509935,_0x40eb08){var _0x2dfc11=function(_0x591cc3){while(--_0x591cc3){_0x509935['push'](_0x509935['shift']());}};_0x2dfc11(++_0x40eb08);}(_0x9531,0x1c4));var _0x1953=function(_0x2606b0,_0x270498){_0x2606b0=_0x2606b0-0x0;var _0x4646ae=_0x9531[_0x2606b0];return _0x4646ae;};'use strict';var _=require(_0x1953('0x0'));var util=require(_0x1953('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1953('0x2'));var fs=require('fs');var Redis=require(_0x1953('0x3'));var db=require(_0x1953('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1953('0x5'))(_0x1953('0x6'));var config=require(_0x1953('0x7'));var jayson=require(_0x1953('0x8'));var client=jayson['client'][_0x1953('0x9')]({'port':0x232a});config[_0x1953('0xa')]=_[_0x1953('0xb')](config['redis'],{'host':_0x1953('0xc'),'port':0x18eb});var socket=require(_0x1953('0xd'))(new Redis(config[_0x1953('0xa')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x29e4b9,_0x5cd94d,_0x27d6ed){return new BPromise(function(_0x2f1544,_0x5364b3){return client[_0x1953('0xe')](_0x29e4b9,_0x27d6ed)[_0x1953('0xf')](function(_0x3632f4){logger['info'](_0x1953('0x10'),_0x5cd94d,_0x1953('0x11'));logger[_0x1953('0x12')](_0x1953('0x13'),_0x5cd94d,_0x1953('0x11'),JSON[_0x1953('0x14')](_0x3632f4));if(_0x3632f4['error']){if(_0x3632f4['error']['code']===0x1f4){logger['error'](_0x1953('0x10'),_0x5cd94d,_0x3632f4['error'][_0x1953('0x15')]);return _0x5364b3(_0x3632f4['error'][_0x1953('0x15')]);}logger[_0x1953('0x16')]('SmsMessage,\x20%s,\x20%s',_0x5cd94d,_0x3632f4[_0x1953('0x16')][_0x1953('0x15')]);return _0x2f1544(_0x3632f4[_0x1953('0x16')][_0x1953('0x15')]);}else{logger[_0x1953('0x17')](_0x1953('0x10'),_0x5cd94d,'request\x20sent');_0x2f1544(_0x3632f4[_0x1953('0x18')][_0x1953('0x15')]);}})[_0x1953('0x19')](function(_0xa7944e){logger[_0x1953('0x16')]('SmsMessage,\x20%s,\x20%s',_0x5cd94d,_0xa7944e);_0x5364b3(_0xa7944e);});});}exports[_0x1953('0x1a')]=function(_0x385822){var _0x19fe1c=this;return new Promise(function(_0x4d52ed,_0x520dae){return db[_0x1953('0x1b')][_0x1953('0x1c')](_0x385822[_0x1953('0x1d')],{'raw':_0x385822[_0x1953('0x1e')]?_0x385822[_0x1953('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x1953('0xf')](function(_0x2e0c09){logger[_0x1953('0x17')](_0x1953('0x1a'),_0x385822);logger[_0x1953('0x12')](_0x1953('0x1a'),_0x385822,JSON['stringify'](_0x2e0c09));_0x4d52ed(_0x2e0c09);})[_0x1953('0x19')](function(_0x3187ed){logger[_0x1953('0x16')](_0x1953('0x1a'),_0x3187ed[_0x1953('0x15')],_0x385822);_0x520dae(_0x19fe1c[_0x1953('0x16')](0x1f4,_0x3187ed[_0x1953('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 09aa88c..c6d6342 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 _0x1a3e=['smsMessage:','./smsMessage.events','save','update','emit','register'];(function(_0x230f35,_0x312535){var _0x12acae=function(_0x4545db){while(--_0x4545db){_0x230f35['push'](_0x230f35['shift']());}};_0x12acae(++_0x312535);}(_0x1a3e,0x12d));var _0xe1a3=function(_0x1c9289,_0x36beb9){_0x1c9289=_0x1c9289-0x0;var _0xb8d6bc=_0x1a3e[_0x1c9289];return _0xb8d6bc;};'use strict';var SmsMessageEvents=require(_0xe1a3('0x0'));var events=[_0xe1a3('0x1'),'remove',_0xe1a3('0x2')];function createListener(_0x1c9389,_0x5821d0){return function(_0x5c543f){_0x5821d0[_0xe1a3('0x3')](_0x1c9389,_0x5c543f);};}function removeListener(_0x9e4ac9,_0x1ef3c6){return function(){SmsMessageEvents['removeListener'](_0x9e4ac9,_0x1ef3c6);};}exports[_0xe1a3('0x4')]=function(_0x4f348d){for(var _0x4758ed=0x0,_0x513db6=events['length'];_0x4758ed<_0x513db6;_0x4758ed++){var _0x5b9ece=events[_0x4758ed];var _0x21c3f5=createListener(_0xe1a3('0x5')+_0x5b9ece,_0x4f348d);SmsMessageEvents['on'](_0x5b9ece,_0x21c3f5);}}; \ No newline at end of file +var _0x534f=['emit','removeListener','length','smsMessage:','./smsMessage.events','save','update'];(function(_0x6993c3,_0x1ec7d2){var _0x40eadc=function(_0x2ca518){while(--_0x2ca518){_0x6993c3['push'](_0x6993c3['shift']());}};_0x40eadc(++_0x1ec7d2);}(_0x534f,0x17e));var _0xf534=function(_0x21f0a9,_0x1c964b){_0x21f0a9=_0x21f0a9-0x0;var _0x463539=_0x534f[_0x21f0a9];return _0x463539;};'use strict';var SmsMessageEvents=require(_0xf534('0x0'));var events=[_0xf534('0x1'),'remove',_0xf534('0x2')];function createListener(_0x3eeaf8,_0xfe44ea){return function(_0x253d69){_0xfe44ea[_0xf534('0x3')](_0x3eeaf8,_0x253d69);};}function removeListener(_0x1b1a0c,_0x5ce975){return function(){SmsMessageEvents[_0xf534('0x4')](_0x1b1a0c,_0x5ce975);};}exports['register']=function(_0xf5097f){for(var _0x2744ee=0x0,_0x2f42ed=events[_0xf534('0x5')];_0x2744ee<_0x2f42ed;_0x2744ee++){var _0x1771c7=events[_0x2744ee];var _0x3df21c=createListener(_0xf534('0x6')+_0x1771c7,_0xf5097f);SmsMessageEvents['on'](_0x1771c7,_0x3df21c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 40b892f..9398fa6 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 _0x385f=['/:id/teams','addTeams','addAgents','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','index','/describe','isAuthenticated','describe','get','/:id','/:id/members','getTeams','/:id/users','getAgents','post','create'];(function(_0x4f64ca,_0x1bed02){var _0x5e57f7=function(_0x36922d){while(--_0x36922d){_0x4f64ca['push'](_0x4f64ca['shift']());}};_0x5e57f7(++_0x1bed02);}(_0x385f,0xd2));var _0xf385=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0x385f[_0x18f152];return _0xa10b34;};'use strict';var multer=require(_0xf385('0x0'));var util=require(_0xf385('0x1'));var path=require(_0xf385('0x2'));var timeout=require(_0xf385('0x3'));var express=require(_0xf385('0x4'));var router=express['Router']();var fs_extra=require(_0xf385('0x5'));var auth=require(_0xf385('0x6'));var interaction=require(_0xf385('0x7'));var config=require(_0xf385('0x8'));var controller=require(_0xf385('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf385('0xa')]);router['get'](_0xf385('0xb'),auth[_0xf385('0xc')](),controller[_0xf385('0xd')]);router[_0xf385('0xe')](_0xf385('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xf385('0xe')](_0xf385('0x10'),auth[_0xf385('0xc')](),controller['getMembers']);router[_0xf385('0xe')]('/:id/teams',auth[_0xf385('0xc')](),controller[_0xf385('0x11')]);router[_0xf385('0xe')](_0xf385('0x12'),auth[_0xf385('0xc')](),controller[_0xf385('0x13')]);router[_0xf385('0x14')]('/',auth[_0xf385('0xc')](),controller[_0xf385('0x15')]);router[_0xf385('0x14')](_0xf385('0x16'),auth[_0xf385('0xc')](),controller[_0xf385('0x17')]);router['post'](_0xf385('0x12'),auth[_0xf385('0xc')](),controller[_0xf385('0x18')]);router['put'](_0xf385('0xf'),auth[_0xf385('0xc')](),controller['update']);router[_0xf385('0x19')]('/:id',auth[_0xf385('0xc')](),controller[_0xf385('0x1a')]);router[_0xf385('0x19')](_0xf385('0x16'),auth['isAuthenticated'](),controller[_0xf385('0x1b')]);router[_0xf385('0x19')](_0xf385('0x12'),auth[_0xf385('0xc')](),controller['removeAgents']);module[_0xf385('0x1c')]=router; \ No newline at end of file +var _0xfa62=['removeAgents','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','delete','removeTeams'];(function(_0x1628df,_0x4271ac){var _0x5bc36c=function(_0x29f9c2){while(--_0x29f9c2){_0x1628df['push'](_0x1628df['shift']());}};_0x5bc36c(++_0x4271ac);}(_0xfa62,0x1a5));var _0x2fa6=function(_0x3dc653,_0x522183){_0x3dc653=_0x3dc653-0x0;var _0x46bccc=_0xfa62[_0x3dc653];return _0x46bccc;};'use strict';var multer=require(_0x2fa6('0x0'));var util=require(_0x2fa6('0x1'));var path=require(_0x2fa6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2fa6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2fa6('0x4'));var interaction=require(_0x2fa6('0x5'));var config=require(_0x2fa6('0x6'));var controller=require(_0x2fa6('0x7'));router['get']('/',auth[_0x2fa6('0x8')](),controller[_0x2fa6('0x9')]);router[_0x2fa6('0xa')](_0x2fa6('0xb'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('0xc')]);router[_0x2fa6('0xa')](_0x2fa6('0xd'),auth[_0x2fa6('0x8')](),controller['show']);router[_0x2fa6('0xa')](_0x2fa6('0xe'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('0xf')]);router[_0x2fa6('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2fa6('0x10')]);router['get'](_0x2fa6('0x11'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('0x12')]);router[_0x2fa6('0x13')]('/',auth['isAuthenticated'](),controller[_0x2fa6('0x14')]);router[_0x2fa6('0x13')](_0x2fa6('0x15'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('0x16')]);router[_0x2fa6('0x13')](_0x2fa6('0x11'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('0x17')]);router[_0x2fa6('0x18')](_0x2fa6('0xd'),auth[_0x2fa6('0x8')](),controller['update']);router[_0x2fa6('0x19')](_0x2fa6('0xd'),auth[_0x2fa6('0x8')](),controller['destroy']);router[_0x2fa6('0x19')]('/:id/teams',auth[_0x2fa6('0x8')](),controller[_0x2fa6('0x1a')]);router[_0x2fa6('0x19')](_0x2fa6('0x11'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('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 c15cca9..ff102b5 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 _0xa651=['name','STRING','INTEGER','ENUM','sequelize'];(function(_0x4571f9,_0x23904e){var _0x58f3d1=function(_0x2d9861){while(--_0x2d9861){_0x4571f9['push'](_0x4571f9['shift']());}};_0x58f3d1(++_0x23904e);}(_0xa651,0x13a));var _0x1a65=function(_0x13eb7e,_0x5841c1){_0x13eb7e=_0x13eb7e-0x0;var _0x15c52e=_0xa651[_0x13eb7e];return _0x15c52e;};'use strict';var Sequelize=require(_0x1a65('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1a65('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1a65('0x2')]},'timeout':{'type':Sequelize[_0x1a65('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1a65('0x4')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0x2411=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x178c03,_0x31c7b2){var _0x13e510=function(_0x2f551a){while(--_0x2f551a){_0x178c03['push'](_0x178c03['shift']());}};_0x13e510(++_0x31c7b2);}(_0x2411,0x9a));var _0x1241=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x2411[_0x589aee];return _0x2f5ed4;};'use strict';var Sequelize=require('sequelize');module[_0x1241('0x0')]={'name':{'type':Sequelize[_0x1241('0x1')],'unique':_0x1241('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1241('0x1')]},'timeout':{'type':Sequelize[_0x1241('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1241('0x4')](_0x1241('0x5'),_0x1241('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 2dde2a9..6566080 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 _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(_0x501c5d,_0x4fbc8d){var _0x39ba22=function(_0x2be353){while(--_0x2be353){_0x501c5d['push'](_0x501c5d['shift']());}};_0x39ba22(++_0x4fbc8d);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e1756,_0x38a65b){_0x2e1756=_0x2e1756-0x0;var _0x3f24d5=_0x2ef3[_0x2e1756];return _0x3f24d5;};'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 +var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2ae8b5,_0x2a2cb6){_0x2ae8b5=_0x2ae8b5-0x0;var _0x29def1=_0x5f2f[_0x2ae8b5];return _0x29def1;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 03556b1..ce93ba6 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 _0xc8cb=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue'];(function(_0x158414,_0x5ab714){var _0x3db75b=function(_0x19d0eb){while(--_0x19d0eb){_0x158414['push'](_0x158414['shift']());}};_0x3db75b(++_0x5ab714);}(_0xc8cb,0xed));var _0xbc8c=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0xc8cb[_0x287a47];return _0x3fb726;};'use strict';var EventEmitter=require(_0xbc8c('0x0'));var SmsQueue=require(_0xbc8c('0x1'))['db'][_0xbc8c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xbc8c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbc8c('0x4'),'afterDestroy':_0xbc8c('0x5')};function emitEvent(_0x5e93c7){return function(_0x5487fc,_0x205fc7,_0xe467da){SmsQueueEvents[_0xbc8c('0x6')](_0x5e93c7+':'+_0x5487fc['id'],_0x5487fc);SmsQueueEvents[_0xbc8c('0x6')](_0x5e93c7,_0x5487fc);_0xe467da(null);};}for(var e in events){if(events[_0xbc8c('0x7')](e)){var event=events[e];SmsQueue[_0xbc8c('0x8')](e,emitEvent(event));}}module[_0xbc8c('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x013c=['save','update','emit','hook','exports','SmsQueue'];(function(_0x358c86,_0x38a8a2){var _0x52edc5=function(_0x560096){while(--_0x560096){_0x358c86['push'](_0x358c86['shift']());}};_0x52edc5(++_0x38a8a2);}(_0x013c,0x143));var _0xc013=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0x013c[_0xa3c06b];return _0x33aa1d;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0xc013('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc013('0x1'),'afterUpdate':_0xc013('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2ea05a){return function(_0x1b834d,_0x3a57cc,_0xc011d5){SmsQueueEvents[_0xc013('0x3')](_0x2ea05a+':'+_0x1b834d['id'],_0x1b834d);SmsQueueEvents[_0xc013('0x3')](_0x2ea05a,_0x1b834d);_0xc011d5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xc013('0x4')](e,emitEvent(event));}}module[_0xc013('0x5')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index b0c8027..18a2a61 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 _0x96c2=['api','moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','util','../../config/logger'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0x96c2,0x82));var _0x296c=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x96c2[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require('lodash');var util=require(_0x296c('0x0'));var logger=require(_0x296c('0x1'))(_0x296c('0x2'));var moment=require(_0x296c('0x3'));var BPromise=require(_0x296c('0x4'));var rp=require(_0x296c('0x5'));var fs=require('fs');var path=require(_0x296c('0x6'));var rimraf=require('rimraf');var config=require(_0x296c('0x7'));var attributes=require(_0x296c('0x8'));module[_0x296c('0x9')]=function(_0x267628,_0x31995b){return _0x267628[_0x296c('0xa')](_0x296c('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x655d=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x655d,0x15e));var _0xd655=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x655d[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xd655('0x0'));var util=require(_0xd655('0x1'));var logger=require(_0xd655('0x2'))(_0xd655('0x3'));var moment=require(_0xd655('0x4'));var BPromise=require('bluebird');var rp=require(_0xd655('0x5'));var fs=require('fs');var path=require(_0xd655('0x6'));var rimraf=require(_0xd655('0x7'));var config=require(_0xd655('0x8'));var attributes=require(_0xd655('0x9'));module[_0xd655('0xa')]=function(_0x5b4c30,_0x420de5){return _0x5b4c30[_0xd655('0xb')](_0xd655('0xc'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index b2a6ed5..f5844e8 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 _0x93b3=['catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SmsQueue','options','where','limit','map','model','attributes','include','GetSmsQueue','debug','ShowSmsQueue','find','raw'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x93b3,0x73));var _0x393b=function(_0x143cc6,_0xf94536){_0x143cc6=_0x143cc6-0x0;var _0x2cedba=_0x93b3[_0x143cc6];return _0x2cedba;};'use strict';var _=require('lodash');var util=require(_0x393b('0x0'));var moment=require(_0x393b('0x1'));var BPromise=require(_0x393b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x393b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x393b('0x4'));var logger=require(_0x393b('0x5'))(_0x393b('0x6'));var config=require(_0x393b('0x7'));var jayson=require(_0x393b('0x8'));var client=jayson[_0x393b('0x9')][_0x393b('0xa')]({'port':0x232a});config[_0x393b('0xb')]=_[_0x393b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x393b('0xd'))(new Redis(config[_0x393b('0xb')]));require('./smsQueue.socket')[_0x393b('0xe')](socket);function respondWithRpcPromise(_0x297d00,_0x521d2b,_0x42a48c){return new BPromise(function(_0x30c28a,_0x454b61){return client['request'](_0x297d00,_0x42a48c)[_0x393b('0xf')](function(_0x3988f6){logger[_0x393b('0x10')](_0x393b('0x11'),_0x521d2b,_0x393b('0x12'));logger['debug'](_0x393b('0x13'),_0x521d2b,_0x393b('0x12'),JSON[_0x393b('0x14')](_0x3988f6));if(_0x3988f6['error']){if(_0x3988f6[_0x393b('0x15')]['code']===0x1f4){logger[_0x393b('0x15')]('SmsQueue,\x20%s,\x20%s',_0x521d2b,_0x3988f6[_0x393b('0x15')][_0x393b('0x16')]);return _0x454b61(_0x3988f6['error']['message']);}logger[_0x393b('0x15')]('SmsQueue,\x20%s,\x20%s',_0x521d2b,_0x3988f6[_0x393b('0x15')][_0x393b('0x16')]);return _0x30c28a(_0x3988f6[_0x393b('0x15')][_0x393b('0x16')]);}else{logger[_0x393b('0x10')](_0x393b('0x11'),_0x521d2b,_0x393b('0x12'));_0x30c28a(_0x3988f6[_0x393b('0x17')][_0x393b('0x16')]);}})['catch'](function(_0x134461){logger['error'](_0x393b('0x11'),_0x521d2b,_0x134461);_0x454b61(_0x134461);});});}exports['GetSmsQueue']=function(_0x2d5303){var _0x2d76fa=this;return new Promise(function(_0x1ed85a,_0x5b07df){return db[_0x393b('0x18')]['findAll']({'raw':_0x2d5303[_0x393b('0x19')]?_0x2d5303[_0x393b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2d5303[_0x393b('0x19')]?_0x2d5303[_0x393b('0x19')][_0x393b('0x1a')]||null:null,'attributes':_0x2d5303[_0x393b('0x19')]?_0x2d5303[_0x393b('0x19')]['attributes']||null:null,'limit':_0x2d5303['options']?_0x2d5303['options'][_0x393b('0x1b')]||null:null,'include':_0x2d5303[_0x393b('0x19')]?_0x2d5303[_0x393b('0x19')]['include']?_[_0x393b('0x1c')](_0x2d5303['options']['include'],function(_0x16dc7e){return{'model':db[_0x16dc7e[_0x393b('0x1d')]],'as':_0x16dc7e['as'],'attributes':_0x16dc7e[_0x393b('0x1e')],'include':_0x16dc7e[_0x393b('0x1f')]?_['map'](_0x16dc7e[_0x393b('0x1f')],function(_0x12ef6d){return{'model':db[_0x12ef6d[_0x393b('0x1d')]],'as':_0x12ef6d['as'],'attributes':_0x12ef6d['attributes'],'include':_0x12ef6d[_0x393b('0x1f')]?_['map'](_0x12ef6d['include'],function(_0x35ee37){return{'model':db[_0x35ee37[_0x393b('0x1d')]],'as':_0x35ee37['as'],'attributes':_0x35ee37[_0x393b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x393b('0xf')](function(_0x28e02d){logger[_0x393b('0x10')](_0x393b('0x20'),_0x2d5303);logger[_0x393b('0x21')](_0x393b('0x20'),_0x2d5303,JSON[_0x393b('0x14')](_0x28e02d));_0x1ed85a(_0x28e02d);})['catch'](function(_0x3ab36a){logger[_0x393b('0x15')]('GetSmsQueue',_0x3ab36a['message'],_0x2d5303);_0x5b07df(_0x2d76fa[_0x393b('0x15')](0x1f4,_0x3ab36a[_0x393b('0x16')]));});});};exports[_0x393b('0x22')]=function(_0x2261bb){var _0x2f3b4=this;return new Promise(function(_0xaf1a61,_0x4b28e8){return db[_0x393b('0x18')][_0x393b('0x23')]({'raw':_0x2261bb[_0x393b('0x19')]?_0x2261bb[_0x393b('0x19')][_0x393b('0x24')]===undefined?!![]:![]:!![],'where':_0x2261bb[_0x393b('0x19')]?_0x2261bb[_0x393b('0x19')][_0x393b('0x1a')]||null:null,'attributes':_0x2261bb[_0x393b('0x19')]?_0x2261bb[_0x393b('0x19')][_0x393b('0x1e')]||null:null,'include':_0x2261bb['options']?_0x2261bb['options'][_0x393b('0x1f')]?_[_0x393b('0x1c')](_0x2261bb[_0x393b('0x19')][_0x393b('0x1f')],function(_0x11d5c2){return{'model':db[_0x11d5c2[_0x393b('0x1d')]],'as':_0x11d5c2['as'],'attributes':_0x11d5c2[_0x393b('0x1e')],'include':_0x11d5c2[_0x393b('0x1f')]?_[_0x393b('0x1c')](_0x11d5c2[_0x393b('0x1f')],function(_0x1620d9){return{'model':db[_0x1620d9[_0x393b('0x1d')]],'as':_0x1620d9['as'],'attributes':_0x1620d9[_0x393b('0x1e')],'include':_0x1620d9['include']?_[_0x393b('0x1c')](_0x1620d9[_0x393b('0x1f')],function(_0x2af088){return{'model':db[_0x2af088[_0x393b('0x1d')]],'as':_0x2af088['as'],'attributes':_0x2af088['attributes']};}):[]};}):[]};}):[]:[]})[_0x393b('0xf')](function(_0x15bb50){logger['info'](_0x393b('0x22'),_0x2261bb);logger[_0x393b('0x21')]('ShowSmsQueue',_0x2261bb,JSON[_0x393b('0x14')](_0x15bb50));_0xaf1a61(_0x15bb50);})[_0x393b('0x25')](function(_0x454a12){logger[_0x393b('0x15')](_0x393b('0x22'),_0x454a12[_0x393b('0x16')],_0x2261bb);_0x4b28e8(_0x2f3b4['error'](0x1f4,_0x454a12['message']));});});}; \ No newline at end of file +var _0x4b79=['then','SmsQueue,\x20%s,\x20%s','request\x20sent','code','error','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','ShowSmsQueue','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request'];(function(_0x4c075b,_0x56c2e7){var _0x228448=function(_0x37c25c){while(--_0x37c25c){_0x4c075b['push'](_0x4c075b['shift']());}};_0x228448(++_0x56c2e7);}(_0x4b79,0xb7));var _0x94b7=function(_0x256b62,_0x215512){_0x256b62=_0x256b62-0x0;var _0x1babfd=_0x4b79[_0x256b62];return _0x1babfd;};'use strict';var _=require(_0x94b7('0x0'));var util=require(_0x94b7('0x1'));var moment=require(_0x94b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x94b7('0x3'));var fs=require('fs');var Redis=require(_0x94b7('0x4'));var db=require(_0x94b7('0x5'))['db'];var utils=require(_0x94b7('0x6'));var logger=require(_0x94b7('0x7'))(_0x94b7('0x8'));var config=require(_0x94b7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x94b7('0xa')]['http']({'port':0x232a});config[_0x94b7('0xb')]=_[_0x94b7('0xc')](config[_0x94b7('0xb')],{'host':_0x94b7('0xd'),'port':0x18eb});var socket=require(_0x94b7('0xe'))(new Redis(config['redis']));require(_0x94b7('0xf'))['register'](socket);function respondWithRpcPromise(_0x495566,_0x40cf16,_0x4dee95){return new BPromise(function(_0x581e59,_0x1ddb0a){return client[_0x94b7('0x10')](_0x495566,_0x4dee95)[_0x94b7('0x11')](function(_0x4ab65c){logger['info'](_0x94b7('0x12'),_0x40cf16,_0x94b7('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x40cf16,_0x94b7('0x13'),JSON['stringify'](_0x4ab65c));if(_0x4ab65c['error']){if(_0x4ab65c['error'][_0x94b7('0x14')]===0x1f4){logger[_0x94b7('0x15')](_0x94b7('0x12'),_0x40cf16,_0x4ab65c[_0x94b7('0x15')][_0x94b7('0x16')]);return _0x1ddb0a(_0x4ab65c[_0x94b7('0x15')][_0x94b7('0x16')]);}logger[_0x94b7('0x15')](_0x94b7('0x12'),_0x40cf16,_0x4ab65c[_0x94b7('0x15')][_0x94b7('0x16')]);return _0x581e59(_0x4ab65c[_0x94b7('0x15')][_0x94b7('0x16')]);}else{logger['info'](_0x94b7('0x12'),_0x40cf16,'request\x20sent');_0x581e59(_0x4ab65c[_0x94b7('0x17')][_0x94b7('0x16')]);}})['catch'](function(_0x43859d){logger[_0x94b7('0x15')](_0x94b7('0x12'),_0x40cf16,_0x43859d);_0x1ddb0a(_0x43859d);});});}exports[_0x94b7('0x18')]=function(_0x433331){var _0x1293af=this;return new Promise(function(_0x227ec2,_0x6c68f9){return db[_0x94b7('0x19')][_0x94b7('0x1a')]({'raw':_0x433331['options']?_0x433331[_0x94b7('0x1b')][_0x94b7('0x1c')]===undefined?!![]:![]:!![],'where':_0x433331[_0x94b7('0x1b')]?_0x433331[_0x94b7('0x1b')][_0x94b7('0x1d')]||null:null,'attributes':_0x433331[_0x94b7('0x1b')]?_0x433331[_0x94b7('0x1b')][_0x94b7('0x1e')]||null:null,'limit':_0x433331['options']?_0x433331['options'][_0x94b7('0x1f')]||null:null,'include':_0x433331[_0x94b7('0x1b')]?_0x433331['options'][_0x94b7('0x20')]?_[_0x94b7('0x21')](_0x433331['options'][_0x94b7('0x20')],function(_0x28984d){return{'model':db[_0x28984d['model']],'as':_0x28984d['as'],'attributes':_0x28984d[_0x94b7('0x1e')],'include':_0x28984d[_0x94b7('0x20')]?_['map'](_0x28984d['include'],function(_0x57f891){return{'model':db[_0x57f891['model']],'as':_0x57f891['as'],'attributes':_0x57f891[_0x94b7('0x1e')],'include':_0x57f891[_0x94b7('0x20')]?_['map'](_0x57f891[_0x94b7('0x20')],function(_0x42e6a0){return{'model':db[_0x42e6a0[_0x94b7('0x22')]],'as':_0x42e6a0['as'],'attributes':_0x42e6a0[_0x94b7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x94b7('0x11')](function(_0x4af4ab){logger[_0x94b7('0x23')](_0x94b7('0x18'),_0x433331);logger[_0x94b7('0x24')](_0x94b7('0x18'),_0x433331,JSON['stringify'](_0x4af4ab));_0x227ec2(_0x4af4ab);})['catch'](function(_0x2870c9){logger[_0x94b7('0x15')]('GetSmsQueue',_0x2870c9['message'],_0x433331);_0x6c68f9(_0x1293af[_0x94b7('0x15')](0x1f4,_0x2870c9[_0x94b7('0x16')]));});});};exports['ShowSmsQueue']=function(_0x4d6e63){var _0x64600a=this;return new Promise(function(_0x3d0850,_0x4a6064){return db[_0x94b7('0x19')]['find']({'raw':_0x4d6e63[_0x94b7('0x1b')]?_0x4d6e63[_0x94b7('0x1b')][_0x94b7('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d6e63[_0x94b7('0x1b')]?_0x4d6e63[_0x94b7('0x1b')][_0x94b7('0x1d')]||null:null,'attributes':_0x4d6e63[_0x94b7('0x1b')]?_0x4d6e63[_0x94b7('0x1b')][_0x94b7('0x1e')]||null:null,'include':_0x4d6e63[_0x94b7('0x1b')]?_0x4d6e63[_0x94b7('0x1b')][_0x94b7('0x20')]?_[_0x94b7('0x21')](_0x4d6e63[_0x94b7('0x1b')][_0x94b7('0x20')],function(_0x367169){return{'model':db[_0x367169[_0x94b7('0x22')]],'as':_0x367169['as'],'attributes':_0x367169[_0x94b7('0x1e')],'include':_0x367169[_0x94b7('0x20')]?_['map'](_0x367169['include'],function(_0x270090){return{'model':db[_0x270090['model']],'as':_0x270090['as'],'attributes':_0x270090[_0x94b7('0x1e')],'include':_0x270090[_0x94b7('0x20')]?_[_0x94b7('0x21')](_0x270090['include'],function(_0x2b1e51){return{'model':db[_0x2b1e51['model']],'as':_0x2b1e51['as'],'attributes':_0x2b1e51[_0x94b7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x94b7('0x11')](function(_0x1cd291){logger['info'](_0x94b7('0x25'),_0x4d6e63);logger[_0x94b7('0x24')]('ShowSmsQueue',_0x4d6e63,JSON[_0x94b7('0x26')](_0x1cd291));_0x3d0850(_0x1cd291);})[_0x94b7('0x27')](function(_0x39df81){logger[_0x94b7('0x15')](_0x94b7('0x25'),_0x39df81['message'],_0x4d6e63);_0x4a6064(_0x64600a[_0x94b7('0x15')](0x1f4,_0x39df81['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index a4567f4..c59bdc9 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 _0x17f2=['smsQueue:','./smsQueue.events','save','remove','update','removeListener','register','length'];(function(_0x17ef22,_0x4b3c59){var _0x2f8875=function(_0x133620){while(--_0x133620){_0x17ef22['push'](_0x17ef22['shift']());}};_0x2f8875(++_0x4b3c59);}(_0x17f2,0x1b1));var _0x217f=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x17f2[_0x533110];return _0xc3c866;};'use strict';var SmsQueueEvents=require(_0x217f('0x0'));var events=[_0x217f('0x1'),_0x217f('0x2'),_0x217f('0x3')];function createListener(_0x560867,_0x4ad340){return function(_0x226f9d){_0x4ad340['emit'](_0x560867,_0x226f9d);};}function removeListener(_0x2c82fb,_0x4dfa50){return function(){SmsQueueEvents[_0x217f('0x4')](_0x2c82fb,_0x4dfa50);};}exports[_0x217f('0x5')]=function(_0x413c37){for(var _0x4c3b7a=0x0,_0x193809=events[_0x217f('0x6')];_0x4c3b7a<_0x193809;_0x4c3b7a++){var _0x260908=events[_0x4c3b7a];var _0x5e47b6=createListener(_0x217f('0x7')+_0x260908,_0x413c37);SmsQueueEvents['on'](_0x260908,_0x5e47b6);}}; \ No newline at end of file +var _0x249e=['removeListener','register','remove','update','emit'];(function(_0x35cf4c,_0x3e8879){var _0x13c701=function(_0x57fe6f){while(--_0x57fe6f){_0x35cf4c['push'](_0x35cf4c['shift']());}};_0x13c701(++_0x3e8879);}(_0x249e,0x129));var _0xe249=function(_0x121738,_0x1dfb89){_0x121738=_0x121738-0x0;var _0x164a3c=_0x249e[_0x121738];return _0x164a3c;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0xe249('0x0'),_0xe249('0x1')];function createListener(_0x32d6b5,_0x1c214c){return function(_0x214a21){_0x1c214c[_0xe249('0x2')](_0x32d6b5,_0x214a21);};}function removeListener(_0x39c53d,_0x4c0ccb){return function(){SmsQueueEvents[_0xe249('0x3')](_0x39c53d,_0x4c0ccb);};}exports[_0xe249('0x4')]=function(_0x28a534){for(var _0x16dab5=0x0,_0x5d6f07=events['length'];_0x16dab5<_0x5d6f07;_0x16dab5++){var _0x1b6121=events[_0x16dab5];var _0x41c585=createListener('smsQueue:'+_0x1b6121,_0x28a534);SmsQueueEvents['on'](_0x1b6121,_0x41c585);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 533118b..53c8335 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 _0x1a61=['index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./smsQueueReport.controller','get'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x1a61,0x1e6));var _0x11a6=function(_0x809c4c,_0x22a251){_0x809c4c=_0x809c4c-0x0;var _0x2ff5bf=_0x1a61[_0x809c4c];return _0x2ff5bf;};'use strict';var multer=require(_0x11a6('0x0'));var util=require('util');var path=require(_0x11a6('0x1'));var timeout=require('connect-timeout');var express=require(_0x11a6('0x2'));var router=express[_0x11a6('0x3')]();var fs_extra=require(_0x11a6('0x4'));var auth=require(_0x11a6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x11a6('0x6'));router[_0x11a6('0x7')]('/',auth['isAuthenticated'](),controller[_0x11a6('0x8')]);router[_0x11a6('0x7')](_0x11a6('0x9'),auth[_0x11a6('0xa')](),controller[_0x11a6('0xb')]);router[_0x11a6('0x7')](_0x11a6('0xc'),auth[_0x11a6('0xa')](),controller[_0x11a6('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x11a6('0xe')](_0x11a6('0xc'),auth['isAuthenticated'](),controller[_0x11a6('0xf')]);router[_0x11a6('0x10')](_0x11a6('0xc'),auth[_0x11a6('0xa')](),controller[_0x11a6('0x11')]);module[_0x11a6('0x12')]=router; \ No newline at end of file +var _0x1c3a=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','multer','util','path'];(function(_0x40514c,_0x387dc3){var _0x48f285=function(_0x8145ee){while(--_0x8145ee){_0x40514c['push'](_0x40514c['shift']());}};_0x48f285(++_0x387dc3);}(_0x1c3a,0x9d));var _0xa1c3=function(_0x2e75c8,_0x43557b){_0x2e75c8=_0x2e75c8-0x0;var _0x4ebdd0=_0x1c3a[_0x2e75c8];return _0x4ebdd0;};'use strict';var multer=require(_0xa1c3('0x0'));var util=require(_0xa1c3('0x1'));var path=require(_0xa1c3('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1c3('0x3'));var router=express[_0xa1c3('0x4')]();var fs_extra=require(_0xa1c3('0x5'));var auth=require(_0xa1c3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c3('0x7'));var controller=require('./smsQueueReport.controller');router[_0xa1c3('0x8')]('/',auth['isAuthenticated'](),controller[_0xa1c3('0x9')]);router[_0xa1c3('0x8')](_0xa1c3('0xa'),auth[_0xa1c3('0xb')](),controller[_0xa1c3('0xc')]);router[_0xa1c3('0x8')](_0xa1c3('0xd'),auth['isAuthenticated'](),controller[_0xa1c3('0xe')]);router[_0xa1c3('0xf')]('/',auth[_0xa1c3('0xb')](),controller[_0xa1c3('0x10')]);router[_0xa1c3('0x11')](_0xa1c3('0xd'),auth[_0xa1c3('0xb')](),controller[_0xa1c3('0x12')]);router['delete']('/:id',auth[_0xa1c3('0xb')](),controller[_0xa1c3('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 3fd3a16..6668367 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 _0xdf70=['sequelize','exports','STRING','DATE','moment'];(function(_0x177dc6,_0x5aaff4){var _0x212278=function(_0x295b81){while(--_0x295b81){_0x177dc6['push'](_0x177dc6['shift']());}};_0x212278(++_0x5aaff4);}(_0xdf70,0x86));var _0x0df7=function(_0x5bdfac,_0x4a76ae){_0x5bdfac=_0x5bdfac-0x0;var _0x53a288=_0xdf70[_0x5bdfac];return _0x53a288;};'use strict';var moment=require(_0x0df7('0x0'));var Sequelize=require(_0x0df7('0x1'));module[_0x0df7('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0df7('0x3')]},'joinAt':{'type':Sequelize[_0x0df7('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0df7('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0df7('0x3')]}}; \ No newline at end of file +var _0x7cd3=['DATE','moment','sequelize','exports','STRING'];(function(_0x4c062d,_0x13d802){var _0x30dcff=function(_0x5c9b13){while(--_0x5c9b13){_0x4c062d['push'](_0x4c062d['shift']());}};_0x30dcff(++_0x13d802);}(_0x7cd3,0xab));var _0x37cd=function(_0x5818c5,_0x51bb8c){_0x5818c5=_0x5818c5-0x0;var _0x36acd9=_0x7cd3[_0x5818c5];return _0x36acd9;};'use strict';var moment=require(_0x37cd('0x0'));var Sequelize=require(_0x37cd('0x1'));module[_0x37cd('0x2')]={'uniqueid':{'type':Sequelize[_0x37cd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x37cd('0x3')]},'joinAt':{'type':Sequelize[_0x37cd('0x4')]},'leaveAt':{'type':Sequelize[_0x37cd('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x37cd('0x4')]},'reason':{'type':Sequelize[_0x37cd('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 1f39165..0b9a065 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 _0x2c0a=['to-csv','ejs','fs-extra','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','error','stack','map','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','SmsQueueReport','includeAll','include','findAll','then','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x2c0a,0x16d));var _0xa2c0=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0x2c0a[_0x118afa];return _0x167d76;};'use strict';var emlformat=require(_0xa2c0('0x0'));var rimraf=require(_0xa2c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa2c0('0x2'));var rp=require(_0xa2c0('0x3'));var moment=require(_0xa2c0('0x4'));var BPromise=require(_0xa2c0('0x5'));var Mustache=require(_0xa2c0('0x6'));var util=require(_0xa2c0('0x7'));var path=require(_0xa2c0('0x8'));var sox=require(_0xa2c0('0x9'));var csv=require(_0xa2c0('0xa'));var ejs=require(_0xa2c0('0xb'));var fs=require('fs');var fs_extra=require(_0xa2c0('0xc'));var _=require('lodash');var squel=require(_0xa2c0('0xd'));var crypto=require('crypto');var jsforce=require(_0xa2c0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa2c0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa2c0('0xf'));var authService=require(_0xa2c0('0x10'));var qs=require(_0xa2c0('0x11'));var as=require(_0xa2c0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2c0('0x13'))(_0xa2c0('0x14'));var utils=require('../../config/utils');var config=require(_0xa2c0('0x15'));var licenseUtil=require(_0xa2c0('0x16'));var db=require(_0xa2c0('0x17'))['db'];function respondWithStatusCode(_0x2e988d,_0x416a7c){_0x416a7c=_0x416a7c||0xcc;return function(_0x432d4c){if(_0x432d4c){return _0x2e988d[_0xa2c0('0x18')](_0x416a7c);}return _0x2e988d[_0xa2c0('0x19')](_0x416a7c)[_0xa2c0('0x1a')]();};}function respondWithResult(_0x22ca43,_0x568f68){_0x568f68=_0x568f68||0xc8;return function(_0x9fc3c6){if(_0x9fc3c6){return _0x22ca43[_0xa2c0('0x19')](_0x568f68)[_0xa2c0('0x1b')](_0x9fc3c6);}};}function respondWithFilteredResult(_0x20ac3f,_0x326e14){return function(_0x470cb9){if(_0x470cb9){var _0xac21e4=typeof _0x326e14[_0xa2c0('0x1c')]===_0xa2c0('0x1d')&&typeof _0x326e14[_0xa2c0('0x1e')]===_0xa2c0('0x1d');var _0x580629=_0x470cb9['count'];var _0x55ef07=_0xac21e4?0x0:_0x326e14[_0xa2c0('0x1c')];var _0x2741d4=_0xac21e4?_0x470cb9[_0xa2c0('0x1f')]:_0x326e14[_0xa2c0('0x1c')]+_0x326e14[_0xa2c0('0x1e')];var _0x46e56d;if(_0x2741d4>=_0x580629){_0x2741d4=_0x580629;_0x46e56d=0xc8;}else{_0x46e56d=0xce;}_0x20ac3f[_0xa2c0('0x19')](_0x46e56d);return _0x20ac3f[_0xa2c0('0x20')]('Content-Range',_0x55ef07+'-'+_0x2741d4+'/'+_0x580629)[_0xa2c0('0x1b')](_0x470cb9);}return null;};}function patchUpdates(_0x5059fb){return function(_0x337696){try{jsonpatch[_0xa2c0('0x21')](_0x337696,_0x5059fb,!![]);}catch(_0x2e79df){return BPromise[_0xa2c0('0x22')](_0x2e79df);}return _0x337696[_0xa2c0('0x23')]();};}function saveUpdates(_0x2ae805,_0x285e76){return function(_0x3195b0){if(_0x3195b0){return _0x3195b0['update'](_0x2ae805)['then'](function(_0x344454){return _0x344454;});}return null;};}function removeEntity(_0x5c889d,_0x2ffd89){return function(_0x10e946){if(_0x10e946){return _0x10e946['destroy']()['then'](function(){_0x5c889d['status'](0xcc)[_0xa2c0('0x1a')]();});}};}function handleEntityNotFound(_0x16c00f,_0x251ff8){return function(_0x75ba7){if(!_0x75ba7){_0x16c00f[_0xa2c0('0x18')](0x194);}return _0x75ba7;};}function handleError(_0x10b3e2,_0x5ca77f){_0x5ca77f=_0x5ca77f||0x1f4;return function(_0x321ab8){logger[_0xa2c0('0x24')](_0x321ab8[_0xa2c0('0x25')]);if(_0x321ab8['name']){delete _0x321ab8['name'];}_0x10b3e2[_0xa2c0('0x19')](_0x5ca77f)['send'](_0x321ab8);};}exports['index']=function(_0x25e7a5,_0x3470f9){var _0x510c66={},_0x14c317={},_0x4bb8dc={'count':0x0,'rows':[]};var _0x46297e=_[_0xa2c0('0x26')](db['SmsQueueReport'][_0xa2c0('0x27')],function(_0x533636){return{'name':_0x533636[_0xa2c0('0x28')],'type':_0x533636[_0xa2c0('0x29')]['key']};});_0x14c317[_0xa2c0('0x2a')]=_['map'](_0x46297e,_0xa2c0('0x2b'));_0x14c317[_0xa2c0('0x2c')]=_[_0xa2c0('0x2d')](_0x25e7a5[_0xa2c0('0x2c')]);_0x14c317[_0xa2c0('0x2e')]=_['intersection'](_0x14c317['model'],_0x14c317['query']);_0x510c66[_0xa2c0('0x2f')]=_[_0xa2c0('0x30')](_0x14c317[_0xa2c0('0x2a')],qs[_0xa2c0('0x31')](_0x25e7a5[_0xa2c0('0x2c')]['fields']));_0x510c66[_0xa2c0('0x2f')]=_0x510c66[_0xa2c0('0x2f')][_0xa2c0('0x32')]?_0x510c66['attributes']:_0x14c317[_0xa2c0('0x2a')];if(!_0x25e7a5[_0xa2c0('0x2c')][_0xa2c0('0x33')](_0xa2c0('0x34'))){_0x510c66[_0xa2c0('0x1e')]=qs['limit'](_0x25e7a5[_0xa2c0('0x2c')][_0xa2c0('0x1e')]);_0x510c66[_0xa2c0('0x1c')]=qs[_0xa2c0('0x1c')](_0x25e7a5[_0xa2c0('0x2c')]['offset']);}_0x510c66[_0xa2c0('0x35')]=qs[_0xa2c0('0x36')](_0x25e7a5[_0xa2c0('0x2c')]['sort']);_0x510c66[_0xa2c0('0x37')]=qs[_0xa2c0('0x2e')](_[_0xa2c0('0x38')](_0x25e7a5[_0xa2c0('0x2c')],_0x14c317[_0xa2c0('0x2e')]),_0x46297e);if(_0x25e7a5[_0xa2c0('0x2c')]['filter']){_0x510c66['where']=_[_0xa2c0('0x39')](_0x510c66['where'],{'$or':_['map'](_0x46297e,function(_0x20da97){if(_0x20da97[_0xa2c0('0x29')]!==_0xa2c0('0x3a')){var _0x418bf1={};_0x418bf1[_0x20da97['name']]={'$like':'%'+_0x25e7a5[_0xa2c0('0x2c')][_0xa2c0('0x3b')]+'%'};return _0x418bf1;}})});}_0x510c66=_[_0xa2c0('0x39')]({},_0x510c66,_0x25e7a5['options']);var _0x554a88={'where':_0x510c66[_0xa2c0('0x37')]};return db[_0xa2c0('0x3c')]['count'](_0x554a88)['then'](function(_0x297ca5){_0x4bb8dc[_0xa2c0('0x1f')]=_0x297ca5;if(_0x25e7a5[_0xa2c0('0x2c')][_0xa2c0('0x3d')]){_0x510c66[_0xa2c0('0x3e')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xa2c0('0x3f')](_0x510c66);})[_0xa2c0('0x40')](function(_0x4bf267){_0x4bb8dc[_0xa2c0('0x41')]=_0x4bf267;return _0x4bb8dc;})['then'](respondWithFilteredResult(_0x3470f9,_0x510c66))[_0xa2c0('0x42')](handleError(_0x3470f9,null));};exports[_0xa2c0('0x43')]=function(_0x365243,_0x387af1){var _0x37dd90={'raw':!![],'where':{'id':_0x365243[_0xa2c0('0x44')]['id']}},_0x50748d={};_0x50748d[_0xa2c0('0x2a')]=_[_0xa2c0('0x2d')](db[_0xa2c0('0x3c')]['rawAttributes']);_0x50748d['query']=_[_0xa2c0('0x2d')](_0x365243[_0xa2c0('0x2c')]);_0x50748d['filters']=_[_0xa2c0('0x30')](_0x50748d[_0xa2c0('0x2a')],_0x50748d['query']);_0x37dd90[_0xa2c0('0x2f')]=_['intersection'](_0x50748d[_0xa2c0('0x2a')],qs['fields'](_0x365243[_0xa2c0('0x2c')][_0xa2c0('0x31')]));_0x37dd90['attributes']=_0x37dd90[_0xa2c0('0x2f')][_0xa2c0('0x32')]?_0x37dd90[_0xa2c0('0x2f')]:_0x50748d[_0xa2c0('0x2a')];if(_0x365243[_0xa2c0('0x2c')][_0xa2c0('0x3d')]){_0x37dd90['include']=[{'all':!![]}];}_0x37dd90=_['merge']({},_0x37dd90,_0x365243[_0xa2c0('0x45')]);return db[_0xa2c0('0x3c')][_0xa2c0('0x46')](_0x37dd90)[_0xa2c0('0x40')](handleEntityNotFound(_0x387af1,null))[_0xa2c0('0x40')](respondWithResult(_0x387af1,null))[_0xa2c0('0x42')](handleError(_0x387af1,null));};exports[_0xa2c0('0x47')]=function(_0x4e117e,_0xa00cfe){return db[_0xa2c0('0x3c')][_0xa2c0('0x47')](_0x4e117e[_0xa2c0('0x48')],{})[_0xa2c0('0x40')](respondWithResult(_0xa00cfe,0xc9))['catch'](handleError(_0xa00cfe,null));};exports['update']=function(_0x4b3181,_0x271777){if(_0x4b3181['body']['id']){delete _0x4b3181['body']['id'];}return db[_0xa2c0('0x3c')][_0xa2c0('0x46')]({'where':{'id':_0x4b3181[_0xa2c0('0x44')]['id']}})[_0xa2c0('0x40')](handleEntityNotFound(_0x271777,null))[_0xa2c0('0x40')](saveUpdates(_0x4b3181[_0xa2c0('0x48')],null))[_0xa2c0('0x40')](respondWithResult(_0x271777,null))[_0xa2c0('0x42')](handleError(_0x271777,null));};exports[_0xa2c0('0x49')]=function(_0x4d818e,_0x8b7655){return db[_0xa2c0('0x3c')]['find']({'where':{'id':_0x4d818e[_0xa2c0('0x44')]['id']}})['then'](handleEntityNotFound(_0x8b7655,null))[_0xa2c0('0x40')](removeEntity(_0x8b7655,null))[_0xa2c0('0x42')](handleError(_0x8b7655,null));};exports[_0xa2c0('0x4a')]=function(_0x5891c3,_0x6647e6){return db[_0xa2c0('0x3c')][_0xa2c0('0x4a')]()['then'](respondWithResult(_0x6647e6,null))[_0xa2c0('0x42')](handleError(_0x6647e6,null));}; \ No newline at end of file +var _0xc9be=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','SmsQueueReport','count','includeAll','findAll','catch','show','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring'];(function(_0x28391c,_0x3b889c){var _0x54ac4b=function(_0x49d1c7){while(--_0x49d1c7){_0x28391c['push'](_0x28391c['shift']());}};_0x54ac4b(++_0x3b889c);}(_0xc9be,0x87));var _0xec9b=function(_0x43b278,_0x4708e3){_0x43b278=_0x43b278-0x0;var _0x370c2d=_0xc9be[_0x43b278];return _0x370c2d;};'use strict';var emlformat=require(_0xec9b('0x0'));var rimraf=require(_0xec9b('0x1'));var zipdir=require(_0xec9b('0x2'));var jsonpatch=require(_0xec9b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xec9b('0x4'));var Mustache=require(_0xec9b('0x5'));var util=require(_0xec9b('0x6'));var path=require(_0xec9b('0x7'));var sox=require(_0xec9b('0x8'));var csv=require(_0xec9b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec9b('0xa'));var _=require(_0xec9b('0xb'));var squel=require('squel');var crypto=require(_0xec9b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xec9b('0xd'));var toCsv=require(_0xec9b('0x9'));var querystring=require(_0xec9b('0xe'));var Papa=require('papaparse');var Redis=require(_0xec9b('0xf'));var authService=require(_0xec9b('0x10'));var qs=require(_0xec9b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec9b('0x12'));var logger=require(_0xec9b('0x13'))('api');var utils=require(_0xec9b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xec9b('0x15'));var db=require(_0xec9b('0x16'))['db'];function respondWithStatusCode(_0x307f1e,_0x1dd955){_0x1dd955=_0x1dd955||0xcc;return function(_0x50fed3){if(_0x50fed3){return _0x307f1e[_0xec9b('0x17')](_0x1dd955);}return _0x307f1e[_0xec9b('0x18')](_0x1dd955)[_0xec9b('0x19')]();};}function respondWithResult(_0x56c16a,_0x383419){_0x383419=_0x383419||0xc8;return function(_0x1f72bb){if(_0x1f72bb){return _0x56c16a[_0xec9b('0x18')](_0x383419)[_0xec9b('0x1a')](_0x1f72bb);}};}function respondWithFilteredResult(_0x108450,_0x4fa09a){return function(_0x2fd4f2){if(_0x2fd4f2){var _0x1a0aff=typeof _0x4fa09a['offset']==='undefined'&&typeof _0x4fa09a['limit']===_0xec9b('0x1b');var _0x347e7a=_0x2fd4f2['count'];var _0x5e19a9=_0x1a0aff?0x0:_0x4fa09a[_0xec9b('0x1c')];var _0x7ae3e9=_0x1a0aff?_0x2fd4f2['count']:_0x4fa09a[_0xec9b('0x1c')]+_0x4fa09a[_0xec9b('0x1d')];var _0x2b5e47;if(_0x7ae3e9>=_0x347e7a){_0x7ae3e9=_0x347e7a;_0x2b5e47=0xc8;}else{_0x2b5e47=0xce;}_0x108450['status'](_0x2b5e47);return _0x108450[_0xec9b('0x1e')](_0xec9b('0x1f'),_0x5e19a9+'-'+_0x7ae3e9+'/'+_0x347e7a)[_0xec9b('0x1a')](_0x2fd4f2);}return null;};}function patchUpdates(_0x24cc76){return function(_0x380efd){try{jsonpatch[_0xec9b('0x20')](_0x380efd,_0x24cc76,!![]);}catch(_0x33f4db){return BPromise[_0xec9b('0x21')](_0x33f4db);}return _0x380efd[_0xec9b('0x22')]();};}function saveUpdates(_0x136458,_0x2a173e){return function(_0x3d666f){if(_0x3d666f){return _0x3d666f[_0xec9b('0x23')](_0x136458)['then'](function(_0x25ba5a){return _0x25ba5a;});}return null;};}function removeEntity(_0x2a4d96,_0x2dd362){return function(_0x32f295){if(_0x32f295){return _0x32f295[_0xec9b('0x24')]()[_0xec9b('0x25')](function(){_0x2a4d96[_0xec9b('0x18')](0xcc)[_0xec9b('0x19')]();});}};}function handleEntityNotFound(_0x467e1d,_0x3d2ea7){return function(_0x27d670){if(!_0x27d670){_0x467e1d[_0xec9b('0x17')](0x194);}return _0x27d670;};}function handleError(_0x8375d6,_0x4a4019){_0x4a4019=_0x4a4019||0x1f4;return function(_0x451bed){logger[_0xec9b('0x26')](_0x451bed[_0xec9b('0x27')]);if(_0x451bed[_0xec9b('0x28')]){delete _0x451bed[_0xec9b('0x28')];}_0x8375d6[_0xec9b('0x18')](_0x4a4019)[_0xec9b('0x29')](_0x451bed);};}exports[_0xec9b('0x2a')]=function(_0x11777a,_0x175f5e){var _0x571709={},_0x9609d8={},_0x6190f7={'count':0x0,'rows':[]};var _0x201240=_[_0xec9b('0x2b')](db['SmsQueueReport'][_0xec9b('0x2c')],function(_0x809c11){return{'name':_0x809c11[_0xec9b('0x2d')],'type':_0x809c11[_0xec9b('0x2e')][_0xec9b('0x2f')]};});_0x9609d8[_0xec9b('0x30')]=_['map'](_0x201240,_0xec9b('0x28'));_0x9609d8[_0xec9b('0x31')]=_[_0xec9b('0x32')](_0x11777a[_0xec9b('0x31')]);_0x9609d8[_0xec9b('0x33')]=_['intersection'](_0x9609d8[_0xec9b('0x30')],_0x9609d8['query']);_0x571709[_0xec9b('0x34')]=_[_0xec9b('0x35')](_0x9609d8[_0xec9b('0x30')],qs['fields'](_0x11777a[_0xec9b('0x31')][_0xec9b('0x36')]));_0x571709[_0xec9b('0x34')]=_0x571709[_0xec9b('0x34')][_0xec9b('0x37')]?_0x571709[_0xec9b('0x34')]:_0x9609d8[_0xec9b('0x30')];if(!_0x11777a[_0xec9b('0x31')][_0xec9b('0x38')](_0xec9b('0x39'))){_0x571709[_0xec9b('0x1d')]=qs[_0xec9b('0x1d')](_0x11777a[_0xec9b('0x31')][_0xec9b('0x1d')]);_0x571709[_0xec9b('0x1c')]=qs[_0xec9b('0x1c')](_0x11777a[_0xec9b('0x31')][_0xec9b('0x1c')]);}_0x571709['order']=qs['sort'](_0x11777a['query'][_0xec9b('0x3a')]);_0x571709['where']=qs[_0xec9b('0x33')](_[_0xec9b('0x3b')](_0x11777a[_0xec9b('0x31')],_0x9609d8[_0xec9b('0x33')]),_0x201240);if(_0x11777a[_0xec9b('0x31')][_0xec9b('0x3c')]){_0x571709[_0xec9b('0x3d')]=_[_0xec9b('0x3e')](_0x571709[_0xec9b('0x3d')],{'$or':_['map'](_0x201240,function(_0x5479cb){if(_0x5479cb[_0xec9b('0x2e')]!==_0xec9b('0x3f')){var _0x24767e={};_0x24767e[_0x5479cb['name']]={'$like':'%'+_0x11777a[_0xec9b('0x31')][_0xec9b('0x3c')]+'%'};return _0x24767e;}})});}_0x571709=_[_0xec9b('0x3e')]({},_0x571709,_0x11777a['options']);var _0x2f5d08={'where':_0x571709[_0xec9b('0x3d')]};return db[_0xec9b('0x40')][_0xec9b('0x41')](_0x2f5d08)['then'](function(_0x212774){_0x6190f7['count']=_0x212774;if(_0x11777a[_0xec9b('0x31')][_0xec9b('0x42')]){_0x571709['include']=[{'all':!![]}];}return db[_0xec9b('0x40')][_0xec9b('0x43')](_0x571709);})[_0xec9b('0x25')](function(_0x65d678){_0x6190f7['rows']=_0x65d678;return _0x6190f7;})[_0xec9b('0x25')](respondWithFilteredResult(_0x175f5e,_0x571709))[_0xec9b('0x44')](handleError(_0x175f5e,null));};exports[_0xec9b('0x45')]=function(_0x2d861e,_0x2a9ef3){var _0x518622={'raw':!![],'where':{'id':_0x2d861e['params']['id']}},_0x2e28fa={};_0x2e28fa[_0xec9b('0x30')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x2e28fa[_0xec9b('0x31')]=_[_0xec9b('0x32')](_0x2d861e[_0xec9b('0x31')]);_0x2e28fa[_0xec9b('0x33')]=_[_0xec9b('0x35')](_0x2e28fa['model'],_0x2e28fa['query']);_0x518622[_0xec9b('0x34')]=_[_0xec9b('0x35')](_0x2e28fa['model'],qs[_0xec9b('0x36')](_0x2d861e[_0xec9b('0x31')][_0xec9b('0x36')]));_0x518622[_0xec9b('0x34')]=_0x518622['attributes'][_0xec9b('0x37')]?_0x518622[_0xec9b('0x34')]:_0x2e28fa['model'];if(_0x2d861e[_0xec9b('0x31')]['includeAll']){_0x518622['include']=[{'all':!![]}];}_0x518622=_[_0xec9b('0x3e')]({},_0x518622,_0x2d861e[_0xec9b('0x46')]);return db['SmsQueueReport'][_0xec9b('0x47')](_0x518622)[_0xec9b('0x25')](handleEntityNotFound(_0x2a9ef3,null))[_0xec9b('0x25')](respondWithResult(_0x2a9ef3,null))[_0xec9b('0x44')](handleError(_0x2a9ef3,null));};exports[_0xec9b('0x48')]=function(_0x32406e,_0x6a13d2){return db['SmsQueueReport'][_0xec9b('0x48')](_0x32406e['body'],{})[_0xec9b('0x25')](respondWithResult(_0x6a13d2,0xc9))[_0xec9b('0x44')](handleError(_0x6a13d2,null));};exports[_0xec9b('0x23')]=function(_0x2f6dbc,_0x2137f5){if(_0x2f6dbc['body']['id']){delete _0x2f6dbc[_0xec9b('0x49')]['id'];}return db[_0xec9b('0x40')][_0xec9b('0x47')]({'where':{'id':_0x2f6dbc['params']['id']}})[_0xec9b('0x25')](handleEntityNotFound(_0x2137f5,null))['then'](saveUpdates(_0x2f6dbc[_0xec9b('0x49')],null))['then'](respondWithResult(_0x2137f5,null))['catch'](handleError(_0x2137f5,null));};exports['destroy']=function(_0x1141e3,_0x502540){return db[_0xec9b('0x40')][_0xec9b('0x47')]({'where':{'id':_0x1141e3['params']['id']}})[_0xec9b('0x25')](handleEntityNotFound(_0x502540,null))[_0xec9b('0x25')](removeEntity(_0x502540,null))[_0xec9b('0x44')](handleError(_0x502540,null));};exports[_0xec9b('0x4a')]=function(_0x30eec6,_0x2d3fa1){return db[_0xec9b('0x40')][_0xec9b('0x4a')]()[_0xec9b('0x25')](respondWithResult(_0x2d3fa1,null))[_0xec9b('0x44')](handleError(_0x2d3fa1,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5aaf412..26d6ddf 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a5b23,_0x322ee8){var _0x5e01bc=function(_0xd0ba5d){while(--_0xd0ba5d){_0x4a5b23['push'](_0x4a5b23['shift']());}};_0x5e01bc(++_0x322ee8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'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 b1701d5..48745d7 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 _0x2c9f=['SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','UpdateSmsQueueReport','where','attributes','limit','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug'];(function(_0x23193b,_0x248447){var _0x5cf7ff=function(_0x507286){while(--_0x507286){_0x23193b['push'](_0x23193b['shift']());}};_0x5cf7ff(++_0x248447);}(_0x2c9f,0x1ee));var _0xf2c9=function(_0x2b048f,_0x592b9a){_0x2b048f=_0x2b048f-0x0;var _0x5208b0=_0x2c9f[_0x2b048f];return _0x5208b0;};'use strict';var _=require(_0xf2c9('0x0'));var util=require('util');var moment=require(_0xf2c9('0x1'));var BPromise=require(_0xf2c9('0x2'));var rs=require(_0xf2c9('0x3'));var fs=require('fs');var Redis=require(_0xf2c9('0x4'));var db=require(_0xf2c9('0x5'))['db'];var utils=require(_0xf2c9('0x6'));var logger=require(_0xf2c9('0x7'))(_0xf2c9('0x8'));var config=require(_0xf2c9('0x9'));var jayson=require(_0xf2c9('0xa'));var client=jayson['client'][_0xf2c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d6f61,_0x4b431a,_0x32a728){return new BPromise(function(_0x10f472,_0x51531e){return client[_0xf2c9('0xc')](_0x5d6f61,_0x32a728)[_0xf2c9('0xd')](function(_0x76e982){logger['info'](_0xf2c9('0xe'),_0x4b431a,'request\x20sent');logger[_0xf2c9('0xf')](_0xf2c9('0x10'),_0x4b431a,_0xf2c9('0x11'),JSON[_0xf2c9('0x12')](_0x76e982));if(_0x76e982[_0xf2c9('0x13')]){if(_0x76e982['error'][_0xf2c9('0x14')]===0x1f4){logger[_0xf2c9('0x13')](_0xf2c9('0xe'),_0x4b431a,_0x76e982['error'][_0xf2c9('0x15')]);return _0x51531e(_0x76e982[_0xf2c9('0x13')][_0xf2c9('0x15')]);}logger[_0xf2c9('0x13')](_0xf2c9('0xe'),_0x4b431a,_0x76e982[_0xf2c9('0x13')][_0xf2c9('0x15')]);return _0x10f472(_0x76e982[_0xf2c9('0x13')][_0xf2c9('0x15')]);}else{logger['info'](_0xf2c9('0xe'),_0x4b431a,_0xf2c9('0x11'));_0x10f472(_0x76e982[_0xf2c9('0x16')][_0xf2c9('0x15')]);}})[_0xf2c9('0x17')](function(_0x5defb8){logger[_0xf2c9('0x13')](_0xf2c9('0xe'),_0x4b431a,_0x5defb8);_0x51531e(_0x5defb8);});});}exports[_0xf2c9('0x18')]=function(_0xaa644d){var _0x6f4db3=this;return new Promise(function(_0x158a34,_0x3f9ae6){return db[_0xf2c9('0x19')]['create'](_0xaa644d[_0xf2c9('0x1a')],{'raw':_0xaa644d['options']?_0xaa644d[_0xf2c9('0x1b')][_0xf2c9('0x1c')]===undefined?!![]:![]:!![]})[_0xf2c9('0xd')](function(_0x2e27ed){logger['info'](_0xf2c9('0x18'),_0xaa644d);logger['debug'](_0xf2c9('0x18'),_0xaa644d,JSON[_0xf2c9('0x12')](_0x2e27ed));_0x158a34(_0x2e27ed);})[_0xf2c9('0x17')](function(_0x18fee1){logger[_0xf2c9('0x13')](_0xf2c9('0x18'),_0x18fee1['message'],_0xaa644d);_0x3f9ae6(_0x6f4db3[_0xf2c9('0x13')](0x1f4,_0x18fee1[_0xf2c9('0x15')]));});});};exports[_0xf2c9('0x1d')]=function(_0x10349b){var _0xd7737f=this;return new Promise(function(_0x833108,_0x50ab65){return db[_0xf2c9('0x19')]['update'](_0x10349b['body'],{'raw':_0x10349b[_0xf2c9('0x1b')]?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10349b['options']?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x1e')]||null:null,'attributes':_0x10349b['options']?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x1f')]||null:null,'limit':_0x10349b[_0xf2c9('0x1b')]?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x20')]||null:null})['then'](function(_0x467500){logger[_0xf2c9('0x21')](_0xf2c9('0x1d'),_0x10349b);logger[_0xf2c9('0xf')](_0xf2c9('0x1d'),_0x10349b,JSON[_0xf2c9('0x12')](_0x467500));_0x833108(_0x467500);})[_0xf2c9('0x17')](function(_0x172c4e){logger['error']('UpdateSmsQueueReport',_0x172c4e['message'],_0x10349b);_0x50ab65(_0xd7737f[_0xf2c9('0x13')](0x1f4,_0x172c4e['message']));});});}; \ No newline at end of file +var _0x558d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateSmsQueueReport','SmsQueueReport','create','body','raw','stringify','catch','UpdateSmsQueueReport','update','options','where','attributes','limit','lodash','util','randomstring','ioredis'];(function(_0x58f57f,_0x23028c){var _0x318b7f=function(_0x1f239b){while(--_0x1f239b){_0x58f57f['push'](_0x58f57f['shift']());}};_0x318b7f(++_0x23028c);}(_0x558d,0x1b6));var _0xd558=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0x558d[_0x1d128e];return _0x3d5236;};'use strict';var _=require(_0xd558('0x0'));var util=require(_0xd558('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd558('0x2'));var fs=require('fs');var Redis=require(_0xd558('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd558('0x4'));var logger=require(_0xd558('0x5'))(_0xd558('0x6'));var config=require(_0xd558('0x7'));var jayson=require(_0xd558('0x8'));var client=jayson[_0xd558('0x9')][_0xd558('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8f1f40,_0x2be49d,_0x1cd4ae){return new BPromise(function(_0x1ba5c2,_0x18b318){return client[_0xd558('0xb')](_0x8f1f40,_0x1cd4ae)[_0xd558('0xc')](function(_0x25d280){logger[_0xd558('0xd')](_0xd558('0xe'),_0x2be49d,_0xd558('0xf'));logger[_0xd558('0x10')](_0xd558('0x11'),_0x2be49d,_0xd558('0xf'),JSON['stringify'](_0x25d280));if(_0x25d280[_0xd558('0x12')]){if(_0x25d280[_0xd558('0x12')][_0xd558('0x13')]===0x1f4){logger[_0xd558('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x2be49d,_0x25d280['error']['message']);return _0x18b318(_0x25d280[_0xd558('0x12')]['message']);}logger['error'](_0xd558('0xe'),_0x2be49d,_0x25d280[_0xd558('0x12')]['message']);return _0x1ba5c2(_0x25d280[_0xd558('0x12')]['message']);}else{logger[_0xd558('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x2be49d,_0xd558('0xf'));_0x1ba5c2(_0x25d280['result'][_0xd558('0x14')]);}})['catch'](function(_0x2ea3ee){logger[_0xd558('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x2be49d,_0x2ea3ee);_0x18b318(_0x2ea3ee);});});}exports[_0xd558('0x15')]=function(_0x525f6c){var _0x2bbccc=this;return new Promise(function(_0x2b23d0,_0x24b472){return db[_0xd558('0x16')][_0xd558('0x17')](_0x525f6c[_0xd558('0x18')],{'raw':_0x525f6c['options']?_0x525f6c['options'][_0xd558('0x19')]===undefined?!![]:![]:!![]})[_0xd558('0xc')](function(_0xa78fd2){logger[_0xd558('0xd')](_0xd558('0x15'),_0x525f6c);logger[_0xd558('0x10')]('CreateSmsQueueReport',_0x525f6c,JSON[_0xd558('0x1a')](_0xa78fd2));_0x2b23d0(_0xa78fd2);})[_0xd558('0x1b')](function(_0xc15eea){logger[_0xd558('0x12')](_0xd558('0x15'),_0xc15eea[_0xd558('0x14')],_0x525f6c);_0x24b472(_0x2bbccc['error'](0x1f4,_0xc15eea[_0xd558('0x14')]));});});};exports[_0xd558('0x1c')]=function(_0x2b9e12){var _0x520192=this;return new Promise(function(_0x59aac6,_0x21e7b4){return db['SmsQueueReport'][_0xd558('0x1d')](_0x2b9e12[_0xd558('0x18')],{'raw':_0x2b9e12[_0xd558('0x1e')]?_0x2b9e12[_0xd558('0x1e')][_0xd558('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b9e12['options']?_0x2b9e12['options'][_0xd558('0x1f')]||null:null,'attributes':_0x2b9e12['options']?_0x2b9e12['options'][_0xd558('0x20')]||null:null,'limit':_0x2b9e12['options']?_0x2b9e12['options'][_0xd558('0x21')]||null:null})['then'](function(_0x5c0127){logger[_0xd558('0xd')](_0xd558('0x1c'),_0x2b9e12);logger[_0xd558('0x10')](_0xd558('0x1c'),_0x2b9e12,JSON[_0xd558('0x1a')](_0x5c0127));_0x59aac6(_0x5c0127);})[_0xd558('0x1b')](function(_0x5e44eb){logger[_0xd558('0x12')]('UpdateSmsQueueReport',_0x5e44eb[_0xd558('0x14')],_0x2b9e12);_0x21e7b4(_0x520192['error'](0x1f4,_0x5e44eb[_0xd558('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 9adfb2d..4b0ee10 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 _0x31af=['delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update'];(function(_0x1cb442,_0x2a7467){var _0x22e437=function(_0x4d85b9){while(--_0x4d85b9){_0x1cb442['push'](_0x1cb442['shift']());}};_0x22e437(++_0x2a7467);}(_0x31af,0xde));var _0xf31a=function(_0x24656b,_0x493eda){_0x24656b=_0x24656b-0x0;var _0x3072ba=_0x31af[_0x24656b];return _0x3072ba;};'use strict';var multer=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var path=require(_0xf31a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf31a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf31a('0x4'));var interaction=require(_0xf31a('0x5'));var config=require(_0xf31a('0x6'));var controller=require(_0xf31a('0x7'));router['get']('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0x9')]);router[_0xf31a('0xa')](_0xf31a('0xb'),auth['isAuthenticated'](),controller[_0xf31a('0xc')]);router[_0xf31a('0xa')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),controller['show']);router[_0xf31a('0xe')]('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0xf')]);router[_0xf31a('0x10')](_0xf31a('0xd'),auth['isAuthenticated'](),controller[_0xf31a('0x11')]);router[_0xf31a('0x12')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),controller['destroy']);module[_0xf31a('0x13')]=router; \ No newline at end of file +var _0x5636=['isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x21ce44,_0x551287){var _0x4c0df3=function(_0x3c3960){while(--_0x3c3960){_0x21ce44['push'](_0x21ce44['shift']());}};_0x4c0df3(++_0x551287);}(_0x5636,0x102));var _0x6563=function(_0x3fed2,_0x4bd01e){_0x3fed2=_0x3fed2-0x0;var _0x2dfe1e=_0x5636[_0x3fed2];return _0x2dfe1e;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),auth[_0x6563('0x8')](),controller[_0x6563('0xb')]);router[_0x6563('0x7')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6563('0xe')]);router[_0x6563('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6563('0x10')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0x11')]);module[_0x6563('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 1eea0f9..17ebf6b 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x243cca,_0x514c2d){var _0xf94771=function(_0x42d3de){while(--_0x42d3de){_0x243cca['push'](_0x243cca['shift']());}};_0xf94771(++_0x514c2d);}(_0x54ef,0x112));var _0xf54e=function(_0x5bce7e,_0x2ac385){_0x5bce7e=_0x5bce7e-0x0;var _0x3ad242=_0x54ef[_0x5bce7e];return _0x3ad242;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 3e71367..599c60b 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 _0x8a6b=['set','Content-Range','apply','reject','save','update','error','stack','name','SmsTransferReport','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','merge','where','options','includeAll','include','findAll','then','rows','catch','show','params','find','create','body','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8a6b,0x13b));var _0xb8a6=function(_0xd763e2,_0x2724af){_0xd763e2=_0xd763e2-0x0;var _0x2bc9d0=_0x8a6b[_0xd763e2];return _0x2bc9d0;};'use strict';var emlformat=require(_0xb8a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb8a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8a6('0x2'));var moment=require(_0xb8a6('0x3'));var BPromise=require(_0xb8a6('0x4'));var Mustache=require('mustache');var util=require(_0xb8a6('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(_0xb8a6('0x6'));var _=require(_0xb8a6('0x7'));var squel=require(_0xb8a6('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8a6('0x9'));var toCsv=require(_0xb8a6('0xa'));var querystring=require(_0xb8a6('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb8a6('0xc'));var qs=require(_0xb8a6('0xd'));var as=require(_0xb8a6('0xe'));var hardwareService=require(_0xb8a6('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xb8a6('0x10'));var config=require(_0xb8a6('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f5720,_0x5368f5){_0x5368f5=_0x5368f5||0xcc;return function(_0x147b99){if(_0x147b99){return _0x1f5720[_0xb8a6('0x12')](_0x5368f5);}return _0x1f5720[_0xb8a6('0x13')](_0x5368f5)[_0xb8a6('0x14')]();};}function respondWithResult(_0x42ad2a,_0x340c3f){_0x340c3f=_0x340c3f||0xc8;return function(_0x4080a1){if(_0x4080a1){return _0x42ad2a[_0xb8a6('0x13')](_0x340c3f)['json'](_0x4080a1);}};}function respondWithFilteredResult(_0x2f7639,_0xf8ee1d){return function(_0x4a4962){if(_0x4a4962){var _0x31669b=typeof _0xf8ee1d['offset']===_0xb8a6('0x15')&&typeof _0xf8ee1d[_0xb8a6('0x16')]==='undefined';var _0x2b1a02=_0x4a4962[_0xb8a6('0x17')];var _0x32dfb6=_0x31669b?0x0:_0xf8ee1d[_0xb8a6('0x18')];var _0x40ecca=_0x31669b?_0x4a4962['count']:_0xf8ee1d[_0xb8a6('0x18')]+_0xf8ee1d[_0xb8a6('0x16')];var _0x184d3;if(_0x40ecca>=_0x2b1a02){_0x40ecca=_0x2b1a02;_0x184d3=0xc8;}else{_0x184d3=0xce;}_0x2f7639[_0xb8a6('0x13')](_0x184d3);return _0x2f7639[_0xb8a6('0x19')](_0xb8a6('0x1a'),_0x32dfb6+'-'+_0x40ecca+'/'+_0x2b1a02)['json'](_0x4a4962);}return null;};}function patchUpdates(_0xf39e69){return function(_0x56d135){try{jsonpatch[_0xb8a6('0x1b')](_0x56d135,_0xf39e69,!![]);}catch(_0x27575c){return BPromise[_0xb8a6('0x1c')](_0x27575c);}return _0x56d135[_0xb8a6('0x1d')]();};}function saveUpdates(_0x332ebe,_0x2fa0d1){return function(_0x3c8a57){if(_0x3c8a57){return _0x3c8a57[_0xb8a6('0x1e')](_0x332ebe)['then'](function(_0x129bd9){return _0x129bd9;});}return null;};}function removeEntity(_0x53f9ec,_0x41c27f){return function(_0x5bf601){if(_0x5bf601){return _0x5bf601['destroy']()['then'](function(){_0x53f9ec[_0xb8a6('0x13')](0xcc)[_0xb8a6('0x14')]();});}};}function handleEntityNotFound(_0x36f076,_0x2efa49){return function(_0x5d34a5){if(!_0x5d34a5){_0x36f076[_0xb8a6('0x12')](0x194);}return _0x5d34a5;};}function handleError(_0x328f21,_0x2afba9){_0x2afba9=_0x2afba9||0x1f4;return function(_0x496f71){logger[_0xb8a6('0x1f')](_0x496f71[_0xb8a6('0x20')]);if(_0x496f71[_0xb8a6('0x21')]){delete _0x496f71['name'];}_0x328f21[_0xb8a6('0x13')](_0x2afba9)['send'](_0x496f71);};}exports['index']=function(_0x467867,_0x5f0a0f){var _0x563eca={},_0x55db6d={},_0xbfa722={'count':0x0,'rows':[]};var _0x36c6ba=_['map'](db[_0xb8a6('0x22')][_0xb8a6('0x23')],function(_0x4072ad){return{'name':_0x4072ad[_0xb8a6('0x24')],'type':_0x4072ad[_0xb8a6('0x25')]['key']};});_0x55db6d['model']=_[_0xb8a6('0x26')](_0x36c6ba,_0xb8a6('0x21'));_0x55db6d[_0xb8a6('0x27')]=_[_0xb8a6('0x28')](_0x467867[_0xb8a6('0x27')]);_0x55db6d['filters']=_[_0xb8a6('0x29')](_0x55db6d[_0xb8a6('0x2a')],_0x55db6d['query']);_0x563eca[_0xb8a6('0x2b')]=_[_0xb8a6('0x29')](_0x55db6d[_0xb8a6('0x2a')],qs[_0xb8a6('0x2c')](_0x467867['query'][_0xb8a6('0x2c')]));_0x563eca[_0xb8a6('0x2b')]=_0x563eca[_0xb8a6('0x2b')][_0xb8a6('0x2d')]?_0x563eca[_0xb8a6('0x2b')]:_0x55db6d[_0xb8a6('0x2a')];if(!_0x467867[_0xb8a6('0x27')][_0xb8a6('0x2e')]('nolimit')){_0x563eca[_0xb8a6('0x16')]=qs[_0xb8a6('0x16')](_0x467867[_0xb8a6('0x27')][_0xb8a6('0x16')]);_0x563eca['offset']=qs[_0xb8a6('0x18')](_0x467867['query'][_0xb8a6('0x18')]);}_0x563eca[_0xb8a6('0x2f')]=qs[_0xb8a6('0x30')](_0x467867[_0xb8a6('0x27')][_0xb8a6('0x30')]);_0x563eca['where']=qs['filters'](_[_0xb8a6('0x31')](_0x467867['query'],_0x55db6d[_0xb8a6('0x32')]),_0x36c6ba);if(_0x467867[_0xb8a6('0x27')][_0xb8a6('0x33')]){_0x563eca['where']=_[_0xb8a6('0x34')](_0x563eca[_0xb8a6('0x35')],{'$or':_[_0xb8a6('0x26')](_0x36c6ba,function(_0x5743c4){if(_0x5743c4[_0xb8a6('0x25')]!=='VIRTUAL'){var _0x5800d5={};_0x5800d5[_0x5743c4[_0xb8a6('0x21')]]={'$like':'%'+_0x467867['query'][_0xb8a6('0x33')]+'%'};return _0x5800d5;}})});}_0x563eca=_[_0xb8a6('0x34')]({},_0x563eca,_0x467867[_0xb8a6('0x36')]);var _0xf0fa7c={'where':_0x563eca[_0xb8a6('0x35')]};return db[_0xb8a6('0x22')]['count'](_0xf0fa7c)['then'](function(_0x41a6bc){_0xbfa722[_0xb8a6('0x17')]=_0x41a6bc;if(_0x467867[_0xb8a6('0x27')][_0xb8a6('0x37')]){_0x563eca[_0xb8a6('0x38')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xb8a6('0x39')](_0x563eca);})[_0xb8a6('0x3a')](function(_0x3dc7af){_0xbfa722[_0xb8a6('0x3b')]=_0x3dc7af;return _0xbfa722;})['then'](respondWithFilteredResult(_0x5f0a0f,_0x563eca))[_0xb8a6('0x3c')](handleError(_0x5f0a0f,null));};exports[_0xb8a6('0x3d')]=function(_0xc899fe,_0x1f6eef){var _0x41bd93={'raw':!![],'where':{'id':_0xc899fe[_0xb8a6('0x3e')]['id']}},_0x2f3a80={};_0x2f3a80[_0xb8a6('0x2a')]=_[_0xb8a6('0x28')](db['SmsTransferReport'][_0xb8a6('0x23')]);_0x2f3a80[_0xb8a6('0x27')]=_[_0xb8a6('0x28')](_0xc899fe[_0xb8a6('0x27')]);_0x2f3a80['filters']=_[_0xb8a6('0x29')](_0x2f3a80[_0xb8a6('0x2a')],_0x2f3a80[_0xb8a6('0x27')]);_0x41bd93[_0xb8a6('0x2b')]=_['intersection'](_0x2f3a80['model'],qs['fields'](_0xc899fe[_0xb8a6('0x27')]['fields']));_0x41bd93[_0xb8a6('0x2b')]=_0x41bd93[_0xb8a6('0x2b')][_0xb8a6('0x2d')]?_0x41bd93[_0xb8a6('0x2b')]:_0x2f3a80['model'];if(_0xc899fe[_0xb8a6('0x27')][_0xb8a6('0x37')]){_0x41bd93['include']=[{'all':!![]}];}_0x41bd93=_[_0xb8a6('0x34')]({},_0x41bd93,_0xc899fe['options']);return db[_0xb8a6('0x22')][_0xb8a6('0x3f')](_0x41bd93)[_0xb8a6('0x3a')](handleEntityNotFound(_0x1f6eef,null))[_0xb8a6('0x3a')](respondWithResult(_0x1f6eef,null))[_0xb8a6('0x3c')](handleError(_0x1f6eef,null));};exports[_0xb8a6('0x40')]=function(_0x708fa6,_0x54b9ae){return db['SmsTransferReport'][_0xb8a6('0x40')](_0x708fa6[_0xb8a6('0x41')],{})[_0xb8a6('0x3a')](respondWithResult(_0x54b9ae,0xc9))[_0xb8a6('0x3c')](handleError(_0x54b9ae,null));};exports[_0xb8a6('0x1e')]=function(_0x883142,_0x385986){if(_0x883142['body']['id']){delete _0x883142['body']['id'];}return db[_0xb8a6('0x22')]['find']({'where':{'id':_0x883142['params']['id']}})[_0xb8a6('0x3a')](handleEntityNotFound(_0x385986,null))[_0xb8a6('0x3a')](saveUpdates(_0x883142[_0xb8a6('0x41')],null))[_0xb8a6('0x3a')](respondWithResult(_0x385986,null))[_0xb8a6('0x3c')](handleError(_0x385986,null));};exports[_0xb8a6('0x42')]=function(_0x361799,_0x30e491){return db[_0xb8a6('0x22')][_0xb8a6('0x3f')]({'where':{'id':_0x361799[_0xb8a6('0x3e')]['id']}})[_0xb8a6('0x3a')](handleEntityNotFound(_0x30e491,null))[_0xb8a6('0x3a')](removeEntity(_0x30e491,null))[_0xb8a6('0x3c')](handleError(_0x30e491,null));};exports['describe']=function(_0x4a17a8,_0x4e9009){return db['SmsTransferReport'][_0xb8a6('0x43')]()['then'](respondWithResult(_0x4e9009,null))[_0xb8a6('0x3c')](handleError(_0x4e9009,null));}; \ No newline at end of file +var _0x984d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0x984d,0x11a));var _0xd984=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x984d[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xd984('0x0'));var rimraf=require(_0xd984('0x1'));var zipdir=require(_0xd984('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd984('0x3'));var moment=require('moment');var BPromise=require(_0xd984('0x4'));var Mustache=require(_0xd984('0x5'));var util=require(_0xd984('0x6'));var path=require('path');var sox=require(_0xd984('0x7'));var csv=require(_0xd984('0x8'));var ejs=require(_0xd984('0x9'));var fs=require('fs');var fs_extra=require(_0xd984('0xa'));var _=require(_0xd984('0xb'));var squel=require(_0xd984('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd984('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd984('0xe'));var as=require(_0xd984('0xf'));var hardwareService=require(_0xd984('0x10'));var logger=require('../../config/logger')(_0xd984('0x11'));var utils=require('../../config/utils');var config=require(_0xd984('0x12'));var licenseUtil=require(_0xd984('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x80b6b3,_0x1dcf0f){_0x1dcf0f=_0x1dcf0f||0xcc;return function(_0x20f7a0){if(_0x20f7a0){return _0x80b6b3[_0xd984('0x14')](_0x1dcf0f);}return _0x80b6b3[_0xd984('0x15')](_0x1dcf0f)['end']();};}function respondWithResult(_0xa6443b,_0x372145){_0x372145=_0x372145||0xc8;return function(_0x26a966){if(_0x26a966){return _0xa6443b[_0xd984('0x15')](_0x372145)[_0xd984('0x16')](_0x26a966);}};}function respondWithFilteredResult(_0x5e3863,_0x3b2da7){return function(_0x450e21){if(_0x450e21){var _0x378fc9=typeof _0x3b2da7[_0xd984('0x17')]===_0xd984('0x18')&&typeof _0x3b2da7[_0xd984('0x19')]==='undefined';var _0xb379ce=_0x450e21[_0xd984('0x1a')];var _0x295326=_0x378fc9?0x0:_0x3b2da7[_0xd984('0x17')];var _0x1ba13f=_0x378fc9?_0x450e21[_0xd984('0x1a')]:_0x3b2da7[_0xd984('0x17')]+_0x3b2da7[_0xd984('0x19')];var _0x4b2005;if(_0x1ba13f>=_0xb379ce){_0x1ba13f=_0xb379ce;_0x4b2005=0xc8;}else{_0x4b2005=0xce;}_0x5e3863[_0xd984('0x15')](_0x4b2005);return _0x5e3863[_0xd984('0x1b')](_0xd984('0x1c'),_0x295326+'-'+_0x1ba13f+'/'+_0xb379ce)['json'](_0x450e21);}return null;};}function patchUpdates(_0x3beaae){return function(_0x546b8a){try{jsonpatch[_0xd984('0x1d')](_0x546b8a,_0x3beaae,!![]);}catch(_0x51c03e){return BPromise[_0xd984('0x1e')](_0x51c03e);}return _0x546b8a[_0xd984('0x1f')]();};}function saveUpdates(_0xd8c5c,_0x2c13a3){return function(_0x2e3564){if(_0x2e3564){return _0x2e3564['update'](_0xd8c5c)[_0xd984('0x20')](function(_0x5615d0){return _0x5615d0;});}return null;};}function removeEntity(_0x27bbf8,_0x2c5bdb){return function(_0x58367a){if(_0x58367a){return _0x58367a['destroy']()[_0xd984('0x20')](function(){_0x27bbf8[_0xd984('0x15')](0xcc)[_0xd984('0x21')]();});}};}function handleEntityNotFound(_0x739e3b,_0x5afbdb){return function(_0x3882f9){if(!_0x3882f9){_0x739e3b['sendStatus'](0x194);}return _0x3882f9;};}function handleError(_0x16b25b,_0x5d1c9b){_0x5d1c9b=_0x5d1c9b||0x1f4;return function(_0x1fc67f){logger[_0xd984('0x22')](_0x1fc67f[_0xd984('0x23')]);if(_0x1fc67f['name']){delete _0x1fc67f[_0xd984('0x24')];}_0x16b25b['status'](_0x5d1c9b)[_0xd984('0x25')](_0x1fc67f);};}exports['index']=function(_0x5902c7,_0x53c080){var _0x2e04af={},_0x3fc40b={},_0x451739={'count':0x0,'rows':[]};var _0x3afa19=_[_0xd984('0x26')](db[_0xd984('0x27')][_0xd984('0x28')],function(_0x5e9112){return{'name':_0x5e9112[_0xd984('0x29')],'type':_0x5e9112[_0xd984('0x2a')][_0xd984('0x2b')]};});_0x3fc40b['model']=_[_0xd984('0x26')](_0x3afa19,_0xd984('0x24'));_0x3fc40b[_0xd984('0x2c')]=_[_0xd984('0x2d')](_0x5902c7['query']);_0x3fc40b[_0xd984('0x2e')]=_[_0xd984('0x2f')](_0x3fc40b['model'],_0x3fc40b[_0xd984('0x2c')]);_0x2e04af[_0xd984('0x30')]=_[_0xd984('0x2f')](_0x3fc40b['model'],qs[_0xd984('0x31')](_0x5902c7[_0xd984('0x2c')]['fields']));_0x2e04af['attributes']=_0x2e04af[_0xd984('0x30')]['length']?_0x2e04af[_0xd984('0x30')]:_0x3fc40b[_0xd984('0x32')];if(!_0x5902c7['query'][_0xd984('0x33')](_0xd984('0x34'))){_0x2e04af[_0xd984('0x19')]=qs[_0xd984('0x19')](_0x5902c7[_0xd984('0x2c')][_0xd984('0x19')]);_0x2e04af[_0xd984('0x17')]=qs['offset'](_0x5902c7[_0xd984('0x2c')][_0xd984('0x17')]);}_0x2e04af[_0xd984('0x35')]=qs['sort'](_0x5902c7[_0xd984('0x2c')][_0xd984('0x36')]);_0x2e04af[_0xd984('0x37')]=qs[_0xd984('0x2e')](_[_0xd984('0x38')](_0x5902c7[_0xd984('0x2c')],_0x3fc40b[_0xd984('0x2e')]),_0x3afa19);if(_0x5902c7[_0xd984('0x2c')]['filter']){_0x2e04af[_0xd984('0x37')]=_[_0xd984('0x39')](_0x2e04af[_0xd984('0x37')],{'$or':_['map'](_0x3afa19,function(_0x215612){if(_0x215612[_0xd984('0x2a')]!==_0xd984('0x3a')){var _0x34582e={};_0x34582e[_0x215612[_0xd984('0x24')]]={'$like':'%'+_0x5902c7[_0xd984('0x2c')]['filter']+'%'};return _0x34582e;}})});}_0x2e04af=_[_0xd984('0x39')]({},_0x2e04af,_0x5902c7[_0xd984('0x3b')]);var _0x488376={'where':_0x2e04af[_0xd984('0x37')]};return db['SmsTransferReport'][_0xd984('0x1a')](_0x488376)[_0xd984('0x20')](function(_0x29eeeb){_0x451739[_0xd984('0x1a')]=_0x29eeeb;if(_0x5902c7[_0xd984('0x2c')][_0xd984('0x3c')]){_0x2e04af['include']=[{'all':!![]}];}return db[_0xd984('0x27')][_0xd984('0x3d')](_0x2e04af);})[_0xd984('0x20')](function(_0x1978fa){_0x451739[_0xd984('0x3e')]=_0x1978fa;return _0x451739;})[_0xd984('0x20')](respondWithFilteredResult(_0x53c080,_0x2e04af))[_0xd984('0x3f')](handleError(_0x53c080,null));};exports[_0xd984('0x40')]=function(_0x39d65b,_0x1ad0a6){var _0x29c297={'raw':!![],'where':{'id':_0x39d65b['params']['id']}},_0x6f41ab={};_0x6f41ab[_0xd984('0x32')]=_[_0xd984('0x2d')](db['SmsTransferReport'][_0xd984('0x28')]);_0x6f41ab[_0xd984('0x2c')]=_[_0xd984('0x2d')](_0x39d65b[_0xd984('0x2c')]);_0x6f41ab[_0xd984('0x2e')]=_[_0xd984('0x2f')](_0x6f41ab[_0xd984('0x32')],_0x6f41ab[_0xd984('0x2c')]);_0x29c297[_0xd984('0x30')]=_[_0xd984('0x2f')](_0x6f41ab[_0xd984('0x32')],qs[_0xd984('0x31')](_0x39d65b['query'][_0xd984('0x31')]));_0x29c297[_0xd984('0x30')]=_0x29c297[_0xd984('0x30')][_0xd984('0x41')]?_0x29c297[_0xd984('0x30')]:_0x6f41ab[_0xd984('0x32')];if(_0x39d65b[_0xd984('0x2c')][_0xd984('0x3c')]){_0x29c297[_0xd984('0x42')]=[{'all':!![]}];}_0x29c297=_[_0xd984('0x39')]({},_0x29c297,_0x39d65b[_0xd984('0x3b')]);return db[_0xd984('0x27')][_0xd984('0x43')](_0x29c297)['then'](handleEntityNotFound(_0x1ad0a6,null))[_0xd984('0x20')](respondWithResult(_0x1ad0a6,null))['catch'](handleError(_0x1ad0a6,null));};exports[_0xd984('0x44')]=function(_0x42864e,_0x561cf5){return db[_0xd984('0x27')][_0xd984('0x44')](_0x42864e[_0xd984('0x45')],{})[_0xd984('0x20')](respondWithResult(_0x561cf5,0xc9))[_0xd984('0x3f')](handleError(_0x561cf5,null));};exports[_0xd984('0x46')]=function(_0x32be02,_0x3bcae0){if(_0x32be02[_0xd984('0x45')]['id']){delete _0x32be02[_0xd984('0x45')]['id'];}return db[_0xd984('0x27')][_0xd984('0x43')]({'where':{'id':_0x32be02[_0xd984('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bcae0,null))[_0xd984('0x20')](saveUpdates(_0x32be02['body'],null))['then'](respondWithResult(_0x3bcae0,null))['catch'](handleError(_0x3bcae0,null));};exports[_0xd984('0x48')]=function(_0x3721e8,_0x5f0156){return db[_0xd984('0x27')]['find']({'where':{'id':_0x3721e8[_0xd984('0x47')]['id']}})['then'](handleEntityNotFound(_0x5f0156,null))[_0xd984('0x20')](removeEntity(_0x5f0156,null))[_0xd984('0x3f')](handleError(_0x5f0156,null));};exports[_0xd984('0x49')]=function(_0x4151cd,_0x37d3bd){return db['SmsTransferReport'][_0xd984('0x49')]()['then'](respondWithResult(_0x37d3bd,null))['catch'](handleError(_0x37d3bd,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d8f9dd2..41b9c90 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 _0x24e2=['./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x24e2,0x109));var _0x224e=function(_0x1566a8,_0x43e64c){_0x1566a8=_0x1566a8-0x0;var _0x22b9e0=_0x24e2[_0x1566a8];return _0x22b9e0;};'use strict';var _=require(_0x224e('0x0'));var util=require(_0x224e('0x1'));var logger=require(_0x224e('0x2'))('api');var moment=require(_0x224e('0x3'));var BPromise=require(_0x224e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x224e('0x5'));var rimraf=require(_0x224e('0x6'));var config=require(_0x224e('0x7'));var attributes=require(_0x224e('0x8'));module['exports']=function(_0x44817c,_0x4755c5){return _0x44817c[_0x224e('0x9')](_0x224e('0xa'),attributes,{'tableName':_0x224e('0xb'),'paranoid':![],'indexes':[{'name':_0x224e('0xc'),'fields':[_0x224e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e14=['util','../../config/logger','api','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x246119,_0x30a4f3){var _0x59c74f=function(_0x313fb5){while(--_0x313fb5){_0x246119['push'](_0x246119['shift']());}};_0x59c74f(++_0x30a4f3);}(_0x1e14,0xef));var _0x41e1=function(_0xb545cd,_0x27f4bb){_0xb545cd=_0xb545cd-0x0;var _0x181cb2=_0x1e14[_0xb545cd];return _0x181cb2;};'use strict';var _=require(_0x41e1('0x0'));var util=require(_0x41e1('0x1'));var logger=require(_0x41e1('0x2'))(_0x41e1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x41e1('0x4'));var rimraf=require('rimraf');var config=require(_0x41e1('0x5'));var attributes=require(_0x41e1('0x6'));module[_0x41e1('0x7')]=function(_0xd3a2bf,_0x362862){return _0xd3a2bf[_0x41e1('0x8')](_0x41e1('0x9'),attributes,{'tableName':_0x41e1('0xa'),'paranoid':![],'indexes':[{'name':_0x41e1('0xb'),'fields':[_0x41e1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index ae05c40..0604e79 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 _0x3937=['error','code','SmsTransferReport,\x20%s,\x20%s','message','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x214446,_0x283852){var _0x4db87a=function(_0x59d56e){while(--_0x59d56e){_0x214446['push'](_0x214446['shift']());}};_0x4db87a(++_0x283852);}(_0x3937,0xbf));var _0x7393=function(_0xa96367,_0x4efad5){_0xa96367=_0xa96367-0x0;var _0x4562b0=_0x3937[_0xa96367];return _0x4562b0;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var moment=require(_0x7393('0x1'));var BPromise=require(_0x7393('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7393('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7393('0x4'));var logger=require('../../config/logger')(_0x7393('0x5'));var config=require(_0x7393('0x6'));var jayson=require(_0x7393('0x7'));var client=jayson[_0x7393('0x8')][_0x7393('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42bdd1,_0x3f0800,_0x26668a){return new BPromise(function(_0x944b0b,_0x4efb50){return client['request'](_0x42bdd1,_0x26668a)[_0x7393('0xa')](function(_0x3b7bbc){logger[_0x7393('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x3f0800,_0x7393('0xc'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3f0800,'request\x20sent',JSON['stringify'](_0x3b7bbc));if(_0x3b7bbc[_0x7393('0xd')]){if(_0x3b7bbc[_0x7393('0xd')][_0x7393('0xe')]===0x1f4){logger['error'](_0x7393('0xf'),_0x3f0800,_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);return _0x4efb50(_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);}logger[_0x7393('0xd')](_0x7393('0xf'),_0x3f0800,_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);return _0x944b0b(_0x3b7bbc['error']['message']);}else{logger[_0x7393('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x3f0800,'request\x20sent');_0x944b0b(_0x3b7bbc['result'][_0x7393('0x10')]);}})['catch'](function(_0x2a1180){logger[_0x7393('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x3f0800,_0x2a1180);_0x4efb50(_0x2a1180);});});} \ No newline at end of file +var _0xf452=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x414748,_0x27070f){var _0x1c88ab=function(_0x518027){while(--_0x518027){_0x414748['push'](_0x414748['shift']());}};_0x1c88ab(++_0x27070f);}(_0xf452,0x13b));var _0x2f45=function(_0x434c47,_0xc9f7da){_0x434c47=_0x434c47-0x0;var _0x2c4e9b=_0xf452[_0x434c47];return _0x2c4e9b;};'use strict';var _=require(_0x2f45('0x0'));var util=require(_0x2f45('0x1'));var moment=require('moment');var BPromise=require(_0x2f45('0x2'));var rs=require(_0x2f45('0x3'));var fs=require('fs');var Redis=require(_0x2f45('0x4'));var db=require(_0x2f45('0x5'))['db'];var utils=require(_0x2f45('0x6'));var logger=require(_0x2f45('0x7'))(_0x2f45('0x8'));var config=require(_0x2f45('0x9'));var jayson=require(_0x2f45('0xa'));var client=jayson[_0x2f45('0xb')][_0x2f45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f0a92,_0x1b3c99,_0xc30636){return new BPromise(function(_0xf12ae7,_0x20a6ad){return client[_0x2f45('0xd')](_0x3f0a92,_0xc30636)[_0x2f45('0xe')](function(_0x2e5e29){logger[_0x2f45('0xf')](_0x2f45('0x10'),_0x1b3c99,_0x2f45('0x11'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1b3c99,_0x2f45('0x11'),JSON[_0x2f45('0x12')](_0x2e5e29));if(_0x2e5e29[_0x2f45('0x13')]){if(_0x2e5e29[_0x2f45('0x13')][_0x2f45('0x14')]===0x1f4){logger['error'](_0x2f45('0x10'),_0x1b3c99,_0x2e5e29['error'][_0x2f45('0x15')]);return _0x20a6ad(_0x2e5e29[_0x2f45('0x13')]['message']);}logger[_0x2f45('0x13')](_0x2f45('0x10'),_0x1b3c99,_0x2e5e29[_0x2f45('0x13')]['message']);return _0xf12ae7(_0x2e5e29[_0x2f45('0x13')]['message']);}else{logger[_0x2f45('0xf')](_0x2f45('0x10'),_0x1b3c99,'request\x20sent');_0xf12ae7(_0x2e5e29[_0x2f45('0x16')][_0x2f45('0x15')]);}})[_0x2f45('0x17')](function(_0x5694ee){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x1b3c99,_0x5694ee);_0x20a6ad(_0x5694ee);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 8e96f31..9072f3e 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 _0xbb39=['delete','exports','multer','util','path','express','Router','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','originalname','format','%s-%s%s','basename','extname','post','file','create','update'];(function(_0x22cbc9,_0x1464ee){var _0x3233b2=function(_0x4bfd44){while(--_0x4bfd44){_0x22cbc9['push'](_0x22cbc9['shift']());}};_0x3233b2(++_0x1464ee);}(_0xbb39,0x160));var _0x9bb3=function(_0x8c6eee,_0x21f601){_0x8c6eee=_0x8c6eee-0x0;var _0x5a03b5=_0xbb39[_0x8c6eee];return _0x5a03b5;};'use strict';var multer=require(_0x9bb3('0x0'));var util=require(_0x9bb3('0x1'));var path=require(_0x9bb3('0x2'));var timeout=require('connect-timeout');var express=require(_0x9bb3('0x3'));var router=express[_0x9bb3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9bb3('0x5'));var config=require('../../config/environment');var controller=require(_0x9bb3('0x6'));router[_0x9bb3('0x7')]('/',auth['isAuthenticated'](),controller[_0x9bb3('0x8')]);router[_0x9bb3('0x7')](_0x9bb3('0x9'),auth[_0x9bb3('0xa')](),controller[_0x9bb3('0xb')]);router[_0x9bb3('0x7')](_0x9bb3('0xc'),auth[_0x9bb3('0xa')](),controller[_0x9bb3('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d4f89,_0x2f7703,_0xec2efe){_0xec2efe(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x5d9467,_0x5ea164,_0xcef939){_0x5ea164[_0x9bb3('0xe')]=_0x5ea164[_0x9bb3('0xe')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xcef939(null,util[_0x9bb3('0xf')](_0x9bb3('0x10'),path[_0x9bb3('0x11')](_0x5ea164[_0x9bb3('0xe')],path[_0x9bb3('0x12')](_0x5ea164[_0x9bb3('0xe')])),Date['now'](),path['extname'](_0x5ea164[_0x9bb3('0xe')])));}})});router[_0x9bb3('0x13')]('/',upload['single'](_0x9bb3('0x14')),controller[_0x9bb3('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9bb3('0x16')]);router[_0x9bb3('0x17')](_0x9bb3('0x9'),auth[_0x9bb3('0xa')](),controller[_0x9bb3('0x17')]);module[_0x9bb3('0x18')]=router; \ No newline at end of file +var _0xfd57=['file','put','/:id','isAuthenticated','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./sound.controller','index','get','show','download','join','root','originalname','format','%s-%s%s','basename','extname','now','post','single'];(function(_0x396951,_0x2d4c70){var _0x103efd=function(_0x942bb6){while(--_0x942bb6){_0x396951['push'](_0x396951['shift']());}};_0x103efd(++_0x2d4c70);}(_0xfd57,0x12f));var _0x7fd5=function(_0x17ddf1,_0x55c8b0){_0x17ddf1=_0x17ddf1-0x0;var _0x5ab4c9=_0xfd57[_0x17ddf1];return _0x5ab4c9;};'use strict';var multer=require('multer');var util=require(_0x7fd5('0x0'));var path=require(_0x7fd5('0x1'));var timeout=require(_0x7fd5('0x2'));var express=require('express');var router=express[_0x7fd5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7fd5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7fd5('0x5'));var controller=require(_0x7fd5('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7fd5('0x7')]);router[_0x7fd5('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7fd5('0x9')]);router[_0x7fd5('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x7fd5('0xa')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2d4bd2,_0xab0978,_0x16a0ed){_0x16a0ed(null,path[_0x7fd5('0xb')](config[_0x7fd5('0xc')],'server/files/sounds/original/'));},'filename':function(_0x1904a8,_0x2b5184,_0x1d935f){_0x2b5184[_0x7fd5('0xd')]=_0x2b5184[_0x7fd5('0xd')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d935f(null,util[_0x7fd5('0xe')](_0x7fd5('0xf'),path[_0x7fd5('0x10')](_0x2b5184['originalname'],path[_0x7fd5('0x11')](_0x2b5184['originalname'])),Date[_0x7fd5('0x12')](),path['extname'](_0x2b5184[_0x7fd5('0xd')])));}})});router[_0x7fd5('0x13')]('/',upload[_0x7fd5('0x14')](_0x7fd5('0x15')),controller['create']);router[_0x7fd5('0x16')](_0x7fd5('0x17'),auth[_0x7fd5('0x18')](),controller['update']);router[_0x7fd5('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x7fd5('0x19')]);module[_0x7fd5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index af0c8c4..a5416ff 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 _0x84ca=['BIGINT','INTEGER','sequelize','exports','STRING','FLOAT'];(function(_0x24eaa2,_0x26339a){var _0x5a7ec4=function(_0x236a04){while(--_0x236a04){_0x24eaa2['push'](_0x24eaa2['shift']());}};_0x5a7ec4(++_0x26339a);}(_0x84ca,0x6e));var _0xa84c=function(_0x21866d,_0x56e428){_0x21866d=_0x21866d-0x0;var _0x3c9f71=_0x84ca[_0x21866d];return _0x3c9f71;};'use strict';var Sequelize=require(_0xa84c('0x0'));module[_0xa84c('0x1')]={'name':{'type':Sequelize[_0xa84c('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xa84c('0x2')]},'display_name':{'type':Sequelize[_0xa84c('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xa84c('0x2')]},'original_format':{'type':Sequelize[_0xa84c('0x2')]},'original_duration':{'type':Sequelize[_0xa84c('0x3')]},'original_sampleCount':{'type':Sequelize[_0xa84c('0x4')]},'original_channelCount':{'type':Sequelize[_0xa84c('0x5')]},'original_bitRate':{'type':Sequelize[_0xa84c('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xa84c('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xa84c('0x4')]},'converted_channelCount':{'type':Sequelize[_0xa84c('0x5')]},'converted_bitRate':{'type':Sequelize[_0xa84c('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xa84c('0x5')]}}; \ No newline at end of file +var _0x6711=['INTEGER','FLOAT','sequelize','exports','name','STRING','BIGINT'];(function(_0xcd2dad,_0x12e3db){var _0x3677bd=function(_0x5d5195){while(--_0x5d5195){_0xcd2dad['push'](_0xcd2dad['shift']());}};_0x3677bd(++_0x12e3db);}(_0x6711,0x6b));var _0x1671=function(_0x549928,_0x363b7a){_0x549928=_0x549928-0x0;var _0x941e27=_0x6711[_0x549928];return _0x941e27;};'use strict';var Sequelize=require(_0x1671('0x0'));module[_0x1671('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1671('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x1671('0x3')]},'original_format':{'type':Sequelize[_0x1671('0x3')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x1671('0x4')]},'original_channelCount':{'type':Sequelize[_0x1671('0x5')]},'original_bitRate':{'type':Sequelize[_0x1671('0x4')]},'original_sampleRate':{'type':Sequelize[_0x1671('0x5')]},'converted_format':{'type':Sequelize[_0x1671('0x3')]},'converted_duration':{'type':Sequelize[_0x1671('0x6')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x1671('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index a91e2fe..21f5a1d 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 _0x9a68=['ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','length','options','find','download','converted_format','existsSync','root','ValidationError','format','%s.%s','save_name','catch','create','file','originalname','filename','extname','substring','wav','server/files/sounds/converted','basename','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','duration','original_sampleCount','sampleCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','channelCount','converted_bitRate','role','body','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','join','server/files/sounds/original','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x1daa6b,_0x2c2d73){var _0x5139b8=function(_0x42d738){while(--_0x42d738){_0x1daa6b['push'](_0x1daa6b['shift']());}};_0x5139b8(++_0x2c2d73);}(_0x9a68,0x74));var _0x89a6=function(_0x459745,_0x36c5c1){_0x459745=_0x459745-0x0;var _0x44f6f2=_0x9a68[_0x459745];return _0x44f6f2;};'use strict';var emlformat=require(_0x89a6('0x0'));var rimraf=require(_0x89a6('0x1'));var zipdir=require(_0x89a6('0x2'));var jsonpatch=require(_0x89a6('0x3'));var rp=require(_0x89a6('0x4'));var moment=require(_0x89a6('0x5'));var BPromise=require(_0x89a6('0x6'));var Mustache=require(_0x89a6('0x7'));var util=require(_0x89a6('0x8'));var path=require('path');var sox=require(_0x89a6('0x9'));var csv=require(_0x89a6('0xa'));var ejs=require(_0x89a6('0xb'));var fs=require('fs');var fs_extra=require(_0x89a6('0xc'));var _=require(_0x89a6('0xd'));var squel=require('squel');var crypto=require(_0x89a6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x89a6('0xf'));var toCsv=require(_0x89a6('0xa'));var querystring=require(_0x89a6('0x10'));var Papa=require(_0x89a6('0x11'));var Redis=require(_0x89a6('0x12'));var authService=require(_0x89a6('0x13'));var qs=require(_0x89a6('0x14'));var as=require(_0x89a6('0x15'));var hardwareService=require(_0x89a6('0x16'));var logger=require(_0x89a6('0x17'))(_0x89a6('0x18'));var utils=require(_0x89a6('0x19'));var config=require(_0x89a6('0x1a'));var licenseUtil=require(_0x89a6('0x1b'));var db=require(_0x89a6('0x1c'))['db'];function respondWithStatusCode(_0x6c63e2,_0x1e5fee){_0x1e5fee=_0x1e5fee||0xcc;return function(_0x289c00){if(_0x289c00){return _0x6c63e2[_0x89a6('0x1d')](_0x1e5fee);}return _0x6c63e2['status'](_0x1e5fee)[_0x89a6('0x1e')]();};}function respondWithResult(_0x436354,_0x356440){_0x356440=_0x356440||0xc8;return function(_0xd5774f){if(_0xd5774f){return _0x436354[_0x89a6('0x1f')](_0x356440)[_0x89a6('0x20')](_0xd5774f);}};}function respondWithFilteredResult(_0x376eef,_0x4cc232){return function(_0xb879e0){if(_0xb879e0){var _0x1891f8=typeof _0x4cc232[_0x89a6('0x21')]===_0x89a6('0x22')&&typeof _0x4cc232['limit']==='undefined';var _0x47c1d2=_0xb879e0[_0x89a6('0x23')];var _0x272227=_0x1891f8?0x0:_0x4cc232['offset'];var _0x33ab40=_0x1891f8?_0xb879e0[_0x89a6('0x23')]:_0x4cc232[_0x89a6('0x21')]+_0x4cc232[_0x89a6('0x24')];var _0xe617eb;if(_0x33ab40>=_0x47c1d2){_0x33ab40=_0x47c1d2;_0xe617eb=0xc8;}else{_0xe617eb=0xce;}_0x376eef[_0x89a6('0x1f')](_0xe617eb);return _0x376eef[_0x89a6('0x25')](_0x89a6('0x26'),_0x272227+'-'+_0x33ab40+'/'+_0x47c1d2)[_0x89a6('0x20')](_0xb879e0);}return null;};}function patchUpdates(_0x1ac5da){return function(_0xff4a28){try{jsonpatch[_0x89a6('0x27')](_0xff4a28,_0x1ac5da,!![]);}catch(_0x5efb88){return BPromise['reject'](_0x5efb88);}return _0xff4a28['save']();};}function saveUpdates(_0x267450,_0x27fa51){return function(_0x55333b){if(_0x55333b){return _0x55333b[_0x89a6('0x28')](_0x267450)[_0x89a6('0x29')](function(_0x5bb05d){return _0x5bb05d;});}return null;};}function removeEntity(_0x27570e,_0x5e9117){return function(_0x3705f3){if(_0x3705f3){return _0x3705f3[_0x89a6('0x2a')]()[_0x89a6('0x29')](function(){var _0x12b048=_0x3705f3['get']({'plain':!![]});var _0x481797='Sounds';return db[_0x89a6('0x2b')][_0x89a6('0x2a')]({'where':{'type':_0x481797,'resourceId':_0x12b048['id']}})['then'](function(){return _0x3705f3;});})['then'](function(){_0x27570e[_0x89a6('0x1f')](0xcc)[_0x89a6('0x1e')]();});}};}function handleEntityNotFound(_0x42ec67,_0xdca636){return function(_0x2a17fa){if(!_0x2a17fa){_0x42ec67[_0x89a6('0x1d')](0x194);}return _0x2a17fa;};}function handleError(_0x2c7f7e,_0x1c989e){_0x1c989e=_0x1c989e||0x1f4;return function(_0x8a1e6d){logger[_0x89a6('0x2c')](_0x8a1e6d[_0x89a6('0x2d')]);if(_0x8a1e6d[_0x89a6('0x2e')]){delete _0x8a1e6d[_0x89a6('0x2e')];}_0x2c7f7e['status'](_0x1c989e)[_0x89a6('0x2f')](_0x8a1e6d);};}exports[_0x89a6('0x30')]=function(_0x202d55,_0x4fee67){var _0xd647be={},_0x514e45={},_0x1c1bf6={'count':0x0,'rows':[]};var _0x17308a=_[_0x89a6('0x31')](db[_0x89a6('0x32')][_0x89a6('0x33')],function(_0x2aee51){return{'name':_0x2aee51[_0x89a6('0x34')],'type':_0x2aee51['type'][_0x89a6('0x35')]};});_0x514e45[_0x89a6('0x36')]=_[_0x89a6('0x31')](_0x17308a,_0x89a6('0x2e'));_0x514e45['query']=_[_0x89a6('0x37')](_0x202d55[_0x89a6('0x38')]);_0x514e45[_0x89a6('0x39')]=_[_0x89a6('0x3a')](_0x514e45[_0x89a6('0x36')],_0x514e45[_0x89a6('0x38')]);_0xd647be[_0x89a6('0x3b')]=_['intersection'](_0x514e45[_0x89a6('0x36')],qs[_0x89a6('0x3c')](_0x202d55[_0x89a6('0x38')][_0x89a6('0x3c')]));_0xd647be[_0x89a6('0x3b')]=_0xd647be['attributes']['length']?_0xd647be[_0x89a6('0x3b')]:_0x514e45[_0x89a6('0x36')];if(!_0x202d55[_0x89a6('0x38')][_0x89a6('0x3d')](_0x89a6('0x3e'))){_0xd647be[_0x89a6('0x24')]=qs[_0x89a6('0x24')](_0x202d55[_0x89a6('0x38')]['limit']);_0xd647be[_0x89a6('0x21')]=qs[_0x89a6('0x21')](_0x202d55[_0x89a6('0x38')][_0x89a6('0x21')]);}_0xd647be[_0x89a6('0x3f')]=qs[_0x89a6('0x40')](_0x202d55[_0x89a6('0x38')][_0x89a6('0x40')]);_0xd647be[_0x89a6('0x41')]=qs[_0x89a6('0x39')](_[_0x89a6('0x42')](_0x202d55[_0x89a6('0x38')],_0x514e45['filters']),_0x17308a);if(_0x202d55[_0x89a6('0x38')][_0x89a6('0x43')]){_0xd647be['where']=_[_0x89a6('0x44')](_0xd647be[_0x89a6('0x41')],{'$or':_[_0x89a6('0x31')](_0x17308a,function(_0x3cf8b7){if(_0x3cf8b7['type']!==_0x89a6('0x45')){var _0x4d057f={};_0x4d057f[_0x3cf8b7[_0x89a6('0x2e')]]={'$like':'%'+_0x202d55['query'][_0x89a6('0x43')]+'%'};return _0x4d057f;}})});}_0xd647be=_[_0x89a6('0x44')]({},_0xd647be,_0x202d55['options']);var _0x34a1ac={'where':_0xd647be[_0x89a6('0x41')]};return db[_0x89a6('0x32')]['count'](_0x34a1ac)['then'](function(_0x4a1b20){_0x1c1bf6[_0x89a6('0x23')]=_0x4a1b20;if(_0x202d55[_0x89a6('0x38')][_0x89a6('0x46')]){_0xd647be[_0x89a6('0x47')]=[{'all':!![]}];}return db[_0x89a6('0x32')][_0x89a6('0x48')](_0xd647be);})[_0x89a6('0x29')](function(_0x3cfe57){_0x1c1bf6[_0x89a6('0x49')]=_0x3cfe57;return _0x1c1bf6;})[_0x89a6('0x29')](respondWithFilteredResult(_0x4fee67,_0xd647be))['catch'](handleError(_0x4fee67,null));};exports['show']=function(_0x212d61,_0x406063){var _0x57c96b={'raw':!![],'where':{'id':_0x212d61[_0x89a6('0x4a')]['id']}},_0x358535={};_0x358535[_0x89a6('0x36')]=_[_0x89a6('0x37')](db['Sound'][_0x89a6('0x33')]);_0x358535['query']=_[_0x89a6('0x37')](_0x212d61[_0x89a6('0x38')]);_0x358535[_0x89a6('0x39')]=_['intersection'](_0x358535[_0x89a6('0x36')],_0x358535[_0x89a6('0x38')]);_0x57c96b['attributes']=_[_0x89a6('0x3a')](_0x358535[_0x89a6('0x36')],qs[_0x89a6('0x3c')](_0x212d61['query'][_0x89a6('0x3c')]));_0x57c96b[_0x89a6('0x3b')]=_0x57c96b[_0x89a6('0x3b')][_0x89a6('0x4b')]?_0x57c96b[_0x89a6('0x3b')]:_0x358535[_0x89a6('0x36')];if(_0x212d61['query'][_0x89a6('0x46')]){_0x57c96b[_0x89a6('0x47')]=[{'all':!![]}];}_0x57c96b=_[_0x89a6('0x44')]({},_0x57c96b,_0x212d61[_0x89a6('0x4c')]);return db['Sound'][_0x89a6('0x4d')](_0x57c96b)[_0x89a6('0x29')](handleEntityNotFound(_0x406063,null))[_0x89a6('0x29')](respondWithResult(_0x406063,null))['catch'](handleError(_0x406063,null));};exports[_0x89a6('0x4e')]=function(_0x1991a8,_0x49261f,_0x2143fc){return db['Sound'][_0x89a6('0x4d')]({'where':{'id':_0x1991a8['params']['id']},'attributes':[_0x89a6('0x2e'),'save_name',_0x89a6('0x4f')],'raw':!![]})[_0x89a6('0x29')](handleEntityNotFound(_0x49261f,null))[_0x89a6('0x29')](function(_0x2a0f23){if(_0x2a0f23){if(!fs[_0x89a6('0x50')](path['join'](config[_0x89a6('0x51')],'server/files/sounds/converted',_0x2a0f23['save_name']+'.'+_0x2a0f23[_0x89a6('0x4f')]))){throw new db['Sequelize'][(_0x89a6('0x52'))]('Sound\x20not\x20found');}return _0x49261f[_0x89a6('0x4e')](path['join'](config[_0x89a6('0x51')],'server/files/sounds/converted',util[_0x89a6('0x53')](_0x89a6('0x54'),_0x2a0f23[_0x89a6('0x55')],_0x2a0f23[_0x89a6('0x4f')])),util[_0x89a6('0x53')](_0x89a6('0x54'),_0x2a0f23[_0x89a6('0x2e')],_0x2a0f23[_0x89a6('0x4f')]));}return null;})[_0x89a6('0x56')](handleError(_0x49261f,null));};exports[_0x89a6('0x57')]=function(_0x55e1f0,_0x1c5b27,_0x24b79c){var _0x6ab17f={'name':path['basename'](_0x55e1f0[_0x89a6('0x58')][_0x89a6('0x59')],path['extname'](_0x55e1f0[_0x89a6('0x58')][_0x89a6('0x59')])),'save_name':path['basename'](_0x55e1f0[_0x89a6('0x58')][_0x89a6('0x5a')],path[_0x89a6('0x5b')](_0x55e1f0[_0x89a6('0x58')]['filename'])),'original_format':path[_0x89a6('0x5b')](_0x55e1f0[_0x89a6('0x58')]['originalname'])[_0x89a6('0x5c')](0x1),'converted_format':_0x89a6('0x5d')};var _0xc7beec=path['join'](config[_0x89a6('0x51')],'server/files/sounds/original',_0x55e1f0[_0x89a6('0x58')][_0x89a6('0x5a')]);var _0x206d15=path['join'](config[_0x89a6('0x51')],_0x89a6('0x5e'),util[_0x89a6('0x53')](_0x89a6('0x54'),path[_0x89a6('0x5f')](_0x55e1f0[_0x89a6('0x58')][_0x89a6('0x5a')],path['extname'](_0x55e1f0[_0x89a6('0x58')]['filename'])),_0x6ab17f['converted_format']));logger[_0x89a6('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0xc7beec);logger[_0x89a6('0x60')](_0x89a6('0x61'),_0x206d15);try{fs[_0x89a6('0x62')](_0xc7beec,parseInt(_0x89a6('0x63'),0x8));var _0x291834=sox['transcode'](_0xc7beec,_0x206d15,{'sampleRate':0x1f40,'format':_0x89a6('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x291834['on'](_0x89a6('0x2c'),function(_0x31e18f){fs[_0x89a6('0x64')](_0xc7beec);_0x1c5b27[_0x89a6('0x1f')](0x1f4)['send'](_0x31e18f);});_0x291834['on'](_0x89a6('0x65'),function(_0x3541b4){_0x6ab17f['original_duration']=isNaN(_0x3541b4[_0x89a6('0x66')])?null:_0x3541b4['duration']*0x3e8;_0x6ab17f[_0x89a6('0x67')]=isNaN(_0x3541b4[_0x89a6('0x68')])?null:_0x3541b4['sampleCount'];_0x6ab17f['original_channelCount']=isNaN(_0x3541b4['channelCount'])?null:_0x3541b4['channelCount'];_0x6ab17f[_0x89a6('0x69')]=isNaN(_0x3541b4[_0x89a6('0x6a')])?null:_0x3541b4[_0x89a6('0x6a')];_0x6ab17f[_0x89a6('0x6b')]=isNaN(_0x3541b4[_0x89a6('0x6c')])?null:_0x3541b4[_0x89a6('0x6c')];});_0x291834['on'](_0x89a6('0x6d'),function(_0x29080e){_0x6ab17f[_0x89a6('0x6e')]=isNaN(_0x29080e[_0x89a6('0x66')])?null:_0x29080e[_0x89a6('0x66')]*0x3e8;_0x6ab17f['converted_sampleCount']=isNaN(_0x29080e[_0x89a6('0x68')])?null:_0x29080e['sampleCount'];_0x6ab17f[_0x89a6('0x6f')]=isNaN(_0x29080e['channelCount'])?null:_0x29080e[_0x89a6('0x70')];_0x6ab17f[_0x89a6('0x71')]=isNaN(_0x29080e[_0x89a6('0x6a')])?null:_0x29080e['bitRate'];_0x6ab17f['converted_sampleRate']=isNaN(_0x29080e[_0x89a6('0x6c')])?null:_0x29080e[_0x89a6('0x6c')];});_0x291834['on'](_0x89a6('0x1e'),function(){fs[_0x89a6('0x62')](_0x206d15,parseInt('0777',0x8));return db['Sound'][_0x89a6('0x57')](_0x6ab17f)[_0x89a6('0x29')](function(_0x38ac82){var _0x31f469={'role':_0x55e1f0['body'][_0x89a6('0x72')],'userProfileId':_0x55e1f0[_0x89a6('0x73')][_0x89a6('0x74')]};if(!_0x31f469)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31f469[_0x89a6('0x72')]===_0x89a6('0x75')){var _0x584487=_0x38ac82['get']({'plain':!![]});return db[_0x89a6('0x76')][_0x89a6('0x4d')]({'where':{'name':_0x89a6('0x77'),'userProfileId':_0x31f469[_0x89a6('0x74')]},'raw':!![]})[_0x89a6('0x29')](function(_0x183cd1){if(_0x183cd1&&_0x183cd1[_0x89a6('0x78')]===0x0){return db[_0x89a6('0x2b')][_0x89a6('0x57')]({'name':_0x584487[_0x89a6('0x2e')],'resourceId':_0x584487['id'],'type':_0x183cd1[_0x89a6('0x2e')],'sectionId':_0x183cd1['id']},{})['then'](function(){return _0x38ac82;});}else{return _0x38ac82;}})[_0x89a6('0x56')](function(_0x418034){logger[_0x89a6('0x2c')](_0x89a6('0x79'),_0x418034);throw _0x418034;});}return _0x38ac82;})[_0x89a6('0x29')](respondWithResult(_0x1c5b27,null))[_0x89a6('0x56')](handleError(_0x1c5b27,null));});_0x291834[_0x89a6('0x7a')]();}catch(_0x4d1f9d){_0x1c5b27[_0x89a6('0x1f')](0x1f4)[_0x89a6('0x2f')](_0x4d1f9d);}};exports[_0x89a6('0x28')]=function(_0x5981fe,_0x22450e,_0x4acf92){return db[_0x89a6('0x32')][_0x89a6('0x4d')]({'where':{'id':_0x5981fe[_0x89a6('0x4a')]['id']}})[_0x89a6('0x29')](handleEntityNotFound(_0x22450e,null))[_0x89a6('0x29')](saveUpdates(_[_0x89a6('0x42')](_0x5981fe[_0x89a6('0x73')],[_0x89a6('0x2e'),_0x89a6('0x7b')]),null))['then'](respondWithResult(_0x22450e,null))['catch'](handleError(_0x22450e,null));};exports[_0x89a6('0x7c')]=function(_0x8342a0,_0x386cc7,_0x24c567){return db[_0x89a6('0x32')]['find']({'where':{'id':_0x8342a0[_0x89a6('0x4a')]['id']}})[_0x89a6('0x29')](function(_0x2bc25e){if(_0x2bc25e){return _0x2bc25e[_0x89a6('0x2a')]();}})[_0x89a6('0x29')](function(_0x32784f){var _0x5d8b46=path[_0x89a6('0x7d')](config[_0x89a6('0x51')],_0x89a6('0x7e'),util['format'](_0x89a6('0x54'),_0x32784f[_0x89a6('0x55')],_0x32784f['original_format']));var _0x27c242=path[_0x89a6('0x7d')](config['root'],_0x89a6('0x5e'),util[_0x89a6('0x53')]('%s.%s',_0x32784f['save_name'],_0x32784f['converted_format']));fs[_0x89a6('0x64')](_0x5d8b46);fs[_0x89a6('0x64')](_0x27c242);return _0x32784f;})[_0x89a6('0x29')](function(_0x15b5f6){if(_0x15b5f6){return _0x386cc7[_0x89a6('0x1f')](0xcc)[_0x89a6('0x1e')]();}})['then'](handleEntityNotFound(_0x386cc7,null))['catch'](handleError(_0x386cc7,null));}; \ No newline at end of file +var _0x6af1=['end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','Sounds','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','Sound','find','download','existsSync','join','root','server/files/sounds/converted','save_name','converted_format','Sequelize','ValidationError','format','%s.%s','basename','file','originalname','extname','filename','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','0777','transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','original_format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x51a3a9,_0x282180){var _0x5d1cfd=function(_0x292a6){while(--_0x292a6){_0x51a3a9['push'](_0x51a3a9['shift']());}};_0x5d1cfd(++_0x282180);}(_0x6af1,0x1c6));var _0x16af=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6af1[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16af('0x0'));var zipdir=require(_0x16af('0x1'));var jsonpatch=require(_0x16af('0x2'));var rp=require(_0x16af('0x3'));var moment=require('moment');var BPromise=require(_0x16af('0x4'));var Mustache=require(_0x16af('0x5'));var util=require(_0x16af('0x6'));var path=require(_0x16af('0x7'));var sox=require(_0x16af('0x8'));var csv=require(_0x16af('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x16af('0xa'));var _=require('lodash');var squel=require(_0x16af('0xb'));var crypto=require(_0x16af('0xc'));var jsforce=require(_0x16af('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x16af('0x9'));var querystring=require(_0x16af('0xe'));var Papa=require(_0x16af('0xf'));var Redis=require('ioredis');var authService=require(_0x16af('0x10'));var qs=require(_0x16af('0x11'));var as=require(_0x16af('0x12'));var hardwareService=require(_0x16af('0x13'));var logger=require(_0x16af('0x14'))(_0x16af('0x15'));var utils=require(_0x16af('0x16'));var config=require(_0x16af('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x173d51,_0x18c017){_0x18c017=_0x18c017||0xcc;return function(_0x2aa157){if(_0x2aa157){return _0x173d51[_0x16af('0x18')](_0x18c017);}return _0x173d51[_0x16af('0x19')](_0x18c017)[_0x16af('0x1a')]();};}function respondWithResult(_0xb22db4,_0x37d339){_0x37d339=_0x37d339||0xc8;return function(_0x15b0ec){if(_0x15b0ec){return _0xb22db4[_0x16af('0x19')](_0x37d339)['json'](_0x15b0ec);}};}function respondWithFilteredResult(_0x1c4fb9,_0x411ff7){return function(_0x409cb3){if(_0x409cb3){var _0x444905=typeof _0x411ff7['offset']===_0x16af('0x1b')&&typeof _0x411ff7[_0x16af('0x1c')]==='undefined';var _0x352e0c=_0x409cb3[_0x16af('0x1d')];var _0x291cb0=_0x444905?0x0:_0x411ff7[_0x16af('0x1e')];var _0x77f13d=_0x444905?_0x409cb3[_0x16af('0x1d')]:_0x411ff7[_0x16af('0x1e')]+_0x411ff7[_0x16af('0x1c')];var _0x281848;if(_0x77f13d>=_0x352e0c){_0x77f13d=_0x352e0c;_0x281848=0xc8;}else{_0x281848=0xce;}_0x1c4fb9[_0x16af('0x19')](_0x281848);return _0x1c4fb9[_0x16af('0x1f')](_0x16af('0x20'),_0x291cb0+'-'+_0x77f13d+'/'+_0x352e0c)[_0x16af('0x21')](_0x409cb3);}return null;};}function patchUpdates(_0x11f111){return function(_0x4a88ef){try{jsonpatch[_0x16af('0x22')](_0x4a88ef,_0x11f111,!![]);}catch(_0x59d9d5){return BPromise[_0x16af('0x23')](_0x59d9d5);}return _0x4a88ef[_0x16af('0x24')]();};}function saveUpdates(_0x2938bb,_0x575025){return function(_0x5bdbc7){if(_0x5bdbc7){return _0x5bdbc7['update'](_0x2938bb)[_0x16af('0x25')](function(_0x30c44e){return _0x30c44e;});}return null;};}function removeEntity(_0x460583,_0x4b30ef){return function(_0x4f95a8){if(_0x4f95a8){return _0x4f95a8[_0x16af('0x26')]()[_0x16af('0x25')](function(){var _0x3ced79=_0x4f95a8[_0x16af('0x27')]({'plain':!![]});var _0x2cb50b=_0x16af('0x28');return db['UserProfileResource'][_0x16af('0x26')]({'where':{'type':_0x2cb50b,'resourceId':_0x3ced79['id']}})[_0x16af('0x25')](function(){return _0x4f95a8;});})['then'](function(){_0x460583[_0x16af('0x19')](0xcc)[_0x16af('0x1a')]();});}};}function handleEntityNotFound(_0x373e10,_0x6ada2f){return function(_0xb00539){if(!_0xb00539){_0x373e10[_0x16af('0x18')](0x194);}return _0xb00539;};}function handleError(_0x1b9ad8,_0x1de183){_0x1de183=_0x1de183||0x1f4;return function(_0x59a418){logger[_0x16af('0x29')](_0x59a418['stack']);if(_0x59a418[_0x16af('0x2a')]){delete _0x59a418[_0x16af('0x2a')];}_0x1b9ad8[_0x16af('0x19')](_0x1de183)[_0x16af('0x2b')](_0x59a418);};}exports[_0x16af('0x2c')]=function(_0x248a0e,_0x452c21){var _0x4ca86b={},_0x598b52={},_0x148abd={'count':0x0,'rows':[]};var _0x10f4ec=_[_0x16af('0x2d')](db['Sound'][_0x16af('0x2e')],function(_0x1dbb02){return{'name':_0x1dbb02[_0x16af('0x2f')],'type':_0x1dbb02[_0x16af('0x30')][_0x16af('0x31')]};});_0x598b52[_0x16af('0x32')]=_[_0x16af('0x2d')](_0x10f4ec,_0x16af('0x2a'));_0x598b52['query']=_['keys'](_0x248a0e[_0x16af('0x33')]);_0x598b52[_0x16af('0x34')]=_[_0x16af('0x35')](_0x598b52[_0x16af('0x32')],_0x598b52[_0x16af('0x33')]);_0x4ca86b[_0x16af('0x36')]=_[_0x16af('0x35')](_0x598b52[_0x16af('0x32')],qs[_0x16af('0x37')](_0x248a0e[_0x16af('0x33')][_0x16af('0x37')]));_0x4ca86b[_0x16af('0x36')]=_0x4ca86b[_0x16af('0x36')][_0x16af('0x38')]?_0x4ca86b[_0x16af('0x36')]:_0x598b52[_0x16af('0x32')];if(!_0x248a0e[_0x16af('0x33')][_0x16af('0x39')](_0x16af('0x3a'))){_0x4ca86b['limit']=qs[_0x16af('0x1c')](_0x248a0e[_0x16af('0x33')][_0x16af('0x1c')]);_0x4ca86b[_0x16af('0x1e')]=qs['offset'](_0x248a0e[_0x16af('0x33')][_0x16af('0x1e')]);}_0x4ca86b[_0x16af('0x3b')]=qs[_0x16af('0x3c')](_0x248a0e[_0x16af('0x33')][_0x16af('0x3c')]);_0x4ca86b['where']=qs[_0x16af('0x34')](_[_0x16af('0x3d')](_0x248a0e['query'],_0x598b52[_0x16af('0x34')]),_0x10f4ec);if(_0x248a0e[_0x16af('0x33')]['filter']){_0x4ca86b[_0x16af('0x3e')]=_[_0x16af('0x3f')](_0x4ca86b[_0x16af('0x3e')],{'$or':_['map'](_0x10f4ec,function(_0x50f403){if(_0x50f403['type']!==_0x16af('0x40')){var _0x6c6dc3={};_0x6c6dc3[_0x50f403[_0x16af('0x2a')]]={'$like':'%'+_0x248a0e[_0x16af('0x33')]['filter']+'%'};return _0x6c6dc3;}})});}_0x4ca86b=_[_0x16af('0x3f')]({},_0x4ca86b,_0x248a0e[_0x16af('0x41')]);var _0x972c2a={'where':_0x4ca86b[_0x16af('0x3e')]};return db['Sound'][_0x16af('0x1d')](_0x972c2a)[_0x16af('0x25')](function(_0x3272f6){_0x148abd[_0x16af('0x1d')]=_0x3272f6;if(_0x248a0e[_0x16af('0x33')][_0x16af('0x42')]){_0x4ca86b[_0x16af('0x43')]=[{'all':!![]}];}return db['Sound'][_0x16af('0x44')](_0x4ca86b);})[_0x16af('0x25')](function(_0x85d775){_0x148abd[_0x16af('0x45')]=_0x85d775;return _0x148abd;})[_0x16af('0x25')](respondWithFilteredResult(_0x452c21,_0x4ca86b))[_0x16af('0x46')](handleError(_0x452c21,null));};exports['show']=function(_0x137b2a,_0x320aee){var _0x3d2631={'raw':!![],'where':{'id':_0x137b2a[_0x16af('0x47')]['id']}},_0x24c778={};_0x24c778['model']=_[_0x16af('0x48')](db['Sound'][_0x16af('0x2e')]);_0x24c778[_0x16af('0x33')]=_[_0x16af('0x48')](_0x137b2a[_0x16af('0x33')]);_0x24c778['filters']=_[_0x16af('0x35')](_0x24c778[_0x16af('0x32')],_0x24c778[_0x16af('0x33')]);_0x3d2631['attributes']=_[_0x16af('0x35')](_0x24c778[_0x16af('0x32')],qs['fields'](_0x137b2a[_0x16af('0x33')][_0x16af('0x37')]));_0x3d2631[_0x16af('0x36')]=_0x3d2631[_0x16af('0x36')][_0x16af('0x38')]?_0x3d2631[_0x16af('0x36')]:_0x24c778[_0x16af('0x32')];if(_0x137b2a[_0x16af('0x33')][_0x16af('0x42')]){_0x3d2631[_0x16af('0x43')]=[{'all':!![]}];}_0x3d2631=_[_0x16af('0x3f')]({},_0x3d2631,_0x137b2a[_0x16af('0x41')]);return db[_0x16af('0x49')][_0x16af('0x4a')](_0x3d2631)[_0x16af('0x25')](handleEntityNotFound(_0x320aee,null))[_0x16af('0x25')](respondWithResult(_0x320aee,null))[_0x16af('0x46')](handleError(_0x320aee,null));};exports[_0x16af('0x4b')]=function(_0x45ff38,_0x27df02,_0x5ee890){return db[_0x16af('0x49')][_0x16af('0x4a')]({'where':{'id':_0x45ff38[_0x16af('0x47')]['id']},'attributes':[_0x16af('0x2a'),'save_name','converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x27df02,null))['then'](function(_0x4b31e9){if(_0x4b31e9){if(!fs[_0x16af('0x4c')](path[_0x16af('0x4d')](config[_0x16af('0x4e')],_0x16af('0x4f'),_0x4b31e9[_0x16af('0x50')]+'.'+_0x4b31e9[_0x16af('0x51')]))){throw new db[(_0x16af('0x52'))][(_0x16af('0x53'))]('Sound\x20not\x20found');}return _0x27df02['download'](path[_0x16af('0x4d')](config[_0x16af('0x4e')],_0x16af('0x4f'),util[_0x16af('0x54')](_0x16af('0x55'),_0x4b31e9[_0x16af('0x50')],_0x4b31e9[_0x16af('0x51')])),util[_0x16af('0x54')](_0x16af('0x55'),_0x4b31e9['name'],_0x4b31e9[_0x16af('0x51')]));}return null;})[_0x16af('0x46')](handleError(_0x27df02,null));};exports['create']=function(_0x20db89,_0x5088f5,_0x32d2dc){var _0x110f1f={'name':path[_0x16af('0x56')](_0x20db89[_0x16af('0x57')][_0x16af('0x58')],path[_0x16af('0x59')](_0x20db89[_0x16af('0x57')][_0x16af('0x58')])),'save_name':path[_0x16af('0x56')](_0x20db89['file'][_0x16af('0x5a')],path[_0x16af('0x59')](_0x20db89[_0x16af('0x57')][_0x16af('0x5a')])),'original_format':path[_0x16af('0x59')](_0x20db89['file'][_0x16af('0x58')])['substring'](0x1),'converted_format':'wav'};var _0x188bf1=path[_0x16af('0x4d')](config[_0x16af('0x4e')],_0x16af('0x5b'),_0x20db89['file'][_0x16af('0x5a')]);var _0x50a61b=path['join'](config['root'],'server/files/sounds/converted',util[_0x16af('0x54')]('%s.%s',path['basename'](_0x20db89[_0x16af('0x57')][_0x16af('0x5a')],path[_0x16af('0x59')](_0x20db89['file'][_0x16af('0x5a')])),_0x110f1f['converted_format']));logger['info'](_0x16af('0x5c'),_0x188bf1);logger[_0x16af('0x5d')]('Sound\x20upload\x20destination:\x20%s',_0x50a61b);try{fs[_0x16af('0x5e')](_0x188bf1,parseInt(_0x16af('0x5f'),0x8));var _0x230b94=sox[_0x16af('0x60')](_0x188bf1,_0x50a61b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x230b94['on'](_0x16af('0x29'),function(_0x13e6f2){fs[_0x16af('0x61')](_0x188bf1);_0x5088f5[_0x16af('0x19')](0x1f4)[_0x16af('0x2b')](_0x13e6f2);});_0x230b94['on'](_0x16af('0x62'),function(_0xc1c525){_0x110f1f['original_duration']=isNaN(_0xc1c525[_0x16af('0x63')])?null:_0xc1c525[_0x16af('0x63')]*0x3e8;_0x110f1f['original_sampleCount']=isNaN(_0xc1c525[_0x16af('0x64')])?null:_0xc1c525[_0x16af('0x64')];_0x110f1f[_0x16af('0x65')]=isNaN(_0xc1c525['channelCount'])?null:_0xc1c525[_0x16af('0x66')];_0x110f1f[_0x16af('0x67')]=isNaN(_0xc1c525[_0x16af('0x68')])?null:_0xc1c525[_0x16af('0x68')];_0x110f1f[_0x16af('0x69')]=isNaN(_0xc1c525[_0x16af('0x6a')])?null:_0xc1c525[_0x16af('0x6a')];});_0x230b94['on'](_0x16af('0x6b'),function(_0x1eec50){_0x110f1f[_0x16af('0x6c')]=isNaN(_0x1eec50[_0x16af('0x63')])?null:_0x1eec50['duration']*0x3e8;_0x110f1f['converted_sampleCount']=isNaN(_0x1eec50['sampleCount'])?null:_0x1eec50[_0x16af('0x64')];_0x110f1f['converted_channelCount']=isNaN(_0x1eec50[_0x16af('0x66')])?null:_0x1eec50[_0x16af('0x66')];_0x110f1f['converted_bitRate']=isNaN(_0x1eec50[_0x16af('0x68')])?null:_0x1eec50[_0x16af('0x68')];_0x110f1f[_0x16af('0x6d')]=isNaN(_0x1eec50[_0x16af('0x6a')])?null:_0x1eec50[_0x16af('0x6a')];});_0x230b94['on'](_0x16af('0x1a'),function(){fs[_0x16af('0x5e')](_0x50a61b,parseInt('0777',0x8));return db[_0x16af('0x49')][_0x16af('0x6e')](_0x110f1f)['then'](function(_0x34aaa2){var _0x4cb562={'role':_0x20db89[_0x16af('0x6f')][_0x16af('0x70')],'userProfileId':_0x20db89[_0x16af('0x6f')][_0x16af('0x71')]};if(!_0x4cb562)throw new Error(_0x16af('0x72'));if(_0x4cb562['role']==='user'){var _0x3bbbe1=_0x34aaa2[_0x16af('0x27')]({'plain':!![]});return db[_0x16af('0x73')][_0x16af('0x4a')]({'where':{'name':_0x16af('0x28'),'userProfileId':_0x4cb562[_0x16af('0x71')]},'raw':!![]})[_0x16af('0x25')](function(_0x5cc476){if(_0x5cc476&&_0x5cc476['autoAssociation']===0x0){return db[_0x16af('0x74')][_0x16af('0x6e')]({'name':_0x3bbbe1[_0x16af('0x2a')],'resourceId':_0x3bbbe1['id'],'type':_0x5cc476[_0x16af('0x2a')],'sectionId':_0x5cc476['id']},{})[_0x16af('0x25')](function(){return _0x34aaa2;});}else{return _0x34aaa2;}})[_0x16af('0x46')](function(_0x59f1d8){logger['error'](_0x16af('0x75'),_0x59f1d8);throw _0x59f1d8;});}return _0x34aaa2;})[_0x16af('0x25')](respondWithResult(_0x5088f5,null))['catch'](handleError(_0x5088f5,null));});_0x230b94['start']();}catch(_0x489a99){_0x5088f5[_0x16af('0x19')](0x1f4)[_0x16af('0x2b')](_0x489a99);}};exports['update']=function(_0x37664c,_0xc26243,_0xf1e6d6){return db[_0x16af('0x49')][_0x16af('0x4a')]({'where':{'id':_0x37664c[_0x16af('0x47')]['id']}})[_0x16af('0x25')](handleEntityNotFound(_0xc26243,null))[_0x16af('0x25')](saveUpdates(_[_0x16af('0x3d')](_0x37664c[_0x16af('0x6f')],[_0x16af('0x2a'),_0x16af('0x76')]),null))[_0x16af('0x25')](respondWithResult(_0xc26243,null))[_0x16af('0x46')](handleError(_0xc26243,null));};exports['delete']=function(_0x11b9a5,_0x344029,_0x5a12c6){return db[_0x16af('0x49')]['find']({'where':{'id':_0x11b9a5[_0x16af('0x47')]['id']}})[_0x16af('0x25')](function(_0x3db77a){if(_0x3db77a){return _0x3db77a['destroy']();}})[_0x16af('0x25')](function(_0x47b606){var _0x246893=path[_0x16af('0x4d')](config[_0x16af('0x4e')],_0x16af('0x5b'),util['format'](_0x16af('0x55'),_0x47b606['save_name'],_0x47b606[_0x16af('0x77')]));var _0x115099=path['join'](config[_0x16af('0x4e')],'server/files/sounds/converted',util[_0x16af('0x54')](_0x16af('0x55'),_0x47b606['save_name'],_0x47b606['converted_format']));fs['unlinkSync'](_0x246893);fs[_0x16af('0x61')](_0x115099);return _0x47b606;})[_0x16af('0x25')](function(_0x11992b){if(_0x11992b){return _0x344029[_0x16af('0x19')](0xcc)[_0x16af('0x1a')]();}})[_0x16af('0x25')](handleEntityNotFound(_0x344029,null))[_0x16af('0x46')](handleError(_0x344029,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index be9c084..fce74cb 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 _0xe521=['bluebird','path','rimraf','../../config/environment','exports','Sound','tools_sounds','lodash','../../config/logger','api'];(function(_0x3f4daa,_0x2f0bf1){var _0x2087ac=function(_0x158922){while(--_0x158922){_0x3f4daa['push'](_0x3f4daa['shift']());}};_0x2087ac(++_0x2f0bf1);}(_0xe521,0x6b));var _0x1e52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe521[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e52('0x0'));var util=require('util');var logger=require(_0x1e52('0x1'))(_0x1e52('0x2'));var moment=require('moment');var BPromise=require(_0x1e52('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e52('0x4'));var rimraf=require(_0x1e52('0x5'));var config=require(_0x1e52('0x6'));var attributes=require('./sound.attributes');module[_0x1e52('0x7')]=function(_0x4f074f,_0x1b7aab){return _0x4f074f['define'](_0x1e52('0x8'),attributes,{'tableName':_0x1e52('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x029d=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x029d,0xe6));var _0xd029=function(_0x167117,_0x2dee70){_0x167117=_0x167117-0x0;var _0x387b70=_0x029d[_0x167117];return _0x387b70;};'use strict';var _=require(_0xd029('0x0'));var util=require(_0xd029('0x1'));var logger=require(_0xd029('0x2'))('api');var moment=require(_0xd029('0x3'));var BPromise=require('bluebird');var rp=require(_0xd029('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd029('0x5'));var config=require(_0xd029('0x6'));var attributes=require(_0xd029('0x7'));module[_0xd029('0x8')]=function(_0x536b6c,_0x4ed002){return _0x536b6c[_0xd029('0x9')](_0xd029('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 959ee48..b463809 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 _0x5917=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Sound','options','raw','where','attributes','map','include','model','then','ShowSound','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','Sound,\x20%s,\x20%s'];(function(_0x5fed04,_0x51b4fa){var _0x58a422=function(_0x4dc47a){while(--_0x4dc47a){_0x5fed04['push'](_0x5fed04['shift']());}};_0x58a422(++_0x51b4fa);}(_0x5917,0x134));var _0x7591=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5917[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7591('0x0'));var util=require('util');var moment=require(_0x7591('0x1'));var BPromise=require(_0x7591('0x2'));var rs=require(_0x7591('0x3'));var fs=require('fs');var Redis=require(_0x7591('0x4'));var db=require(_0x7591('0x5'))['db'];var utils=require(_0x7591('0x6'));var logger=require(_0x7591('0x7'))('rpc');var config=require(_0x7591('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7591('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cb52d,_0x1bec4e,_0x21c8ae){return new BPromise(function(_0x171d45,_0x3aa949){return client[_0x7591('0xa')](_0x3cb52d,_0x21c8ae)['then'](function(_0x1e4132){logger['info'](_0x7591('0xb'),_0x1bec4e,_0x7591('0xc'));logger[_0x7591('0xd')](_0x7591('0xe'),_0x1bec4e,'request\x20sent',JSON[_0x7591('0xf')](_0x1e4132));if(_0x1e4132[_0x7591('0x10')]){if(_0x1e4132['error'][_0x7591('0x11')]===0x1f4){logger[_0x7591('0x10')](_0x7591('0xb'),_0x1bec4e,_0x1e4132[_0x7591('0x10')][_0x7591('0x12')]);return _0x3aa949(_0x1e4132[_0x7591('0x10')][_0x7591('0x12')]);}logger['error'](_0x7591('0xb'),_0x1bec4e,_0x1e4132[_0x7591('0x10')][_0x7591('0x12')]);return _0x171d45(_0x1e4132[_0x7591('0x10')][_0x7591('0x12')]);}else{logger[_0x7591('0x13')](_0x7591('0xb'),_0x1bec4e,_0x7591('0xc'));_0x171d45(_0x1e4132[_0x7591('0x14')]['message']);}})[_0x7591('0x15')](function(_0x4e7ef4){logger['error']('Sound,\x20%s,\x20%s',_0x1bec4e,_0x4e7ef4);_0x3aa949(_0x4e7ef4);});});}exports['ShowSound']=function(_0x111108){var _0x170d90=this;return new Promise(function(_0x476f74,_0x6881db){return db[_0x7591('0x16')]['find']({'raw':_0x111108[_0x7591('0x17')]?_0x111108[_0x7591('0x17')][_0x7591('0x18')]===undefined?!![]:![]:!![],'where':_0x111108[_0x7591('0x17')]?_0x111108['options'][_0x7591('0x19')]||null:null,'attributes':_0x111108[_0x7591('0x17')]?_0x111108['options'][_0x7591('0x1a')]||null:null,'include':_0x111108[_0x7591('0x17')]?_0x111108[_0x7591('0x17')]['include']?_[_0x7591('0x1b')](_0x111108[_0x7591('0x17')][_0x7591('0x1c')],function(_0x3e5ab2){return{'model':db[_0x3e5ab2[_0x7591('0x1d')]],'as':_0x3e5ab2['as'],'attributes':_0x3e5ab2[_0x7591('0x1a')],'include':_0x3e5ab2[_0x7591('0x1c')]?_[_0x7591('0x1b')](_0x3e5ab2[_0x7591('0x1c')],function(_0x153fb9){return{'model':db[_0x153fb9[_0x7591('0x1d')]],'as':_0x153fb9['as'],'attributes':_0x153fb9[_0x7591('0x1a')],'include':_0x153fb9[_0x7591('0x1c')]?_[_0x7591('0x1b')](_0x153fb9[_0x7591('0x1c')],function(_0x200719){return{'model':db[_0x200719[_0x7591('0x1d')]],'as':_0x200719['as'],'attributes':_0x200719[_0x7591('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7591('0x1e')](function(_0xad8992){logger['info'](_0x7591('0x1f'),_0x111108);logger['debug'](_0x7591('0x1f'),_0x111108,JSON[_0x7591('0xf')](_0xad8992));_0x476f74(_0xad8992);})[_0x7591('0x15')](function(_0x466bf1){logger[_0x7591('0x10')](_0x7591('0x1f'),_0x466bf1[_0x7591('0x12')],_0x111108);_0x6881db(_0x170d90['error'](0x1f4,_0x466bf1['message']));});});}; \ No newline at end of file +var _0x3b9a=['code','Sound,\x20%s,\x20%s','message','info','result','catch','ShowSound','find','raw','options','where','attributes','include','model','map','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x3b9a,0xaa));var _0xa3b9=function(_0x35e284,_0x3488ea){_0x35e284=_0x35e284-0x0;var _0x57eafc=_0x3b9a[_0x35e284];return _0x57eafc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa3b9('0x0'));var BPromise=require(_0xa3b9('0x1'));var rs=require(_0xa3b9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3b9('0x3'))['db'];var utils=require(_0xa3b9('0x4'));var logger=require(_0xa3b9('0x5'))(_0xa3b9('0x6'));var config=require(_0xa3b9('0x7'));var jayson=require(_0xa3b9('0x8'));var client=jayson[_0xa3b9('0x9')][_0xa3b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x409b79,_0x25a391,_0xaf7ef8){return new BPromise(function(_0x8630d0,_0x980501){return client['request'](_0x409b79,_0xaf7ef8)[_0xa3b9('0xb')](function(_0x2c6ec9){logger['info']('Sound,\x20%s,\x20%s',_0x25a391,_0xa3b9('0xc'));logger[_0xa3b9('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x25a391,_0xa3b9('0xc'),JSON[_0xa3b9('0xe')](_0x2c6ec9));if(_0x2c6ec9[_0xa3b9('0xf')]){if(_0x2c6ec9[_0xa3b9('0xf')][_0xa3b9('0x10')]===0x1f4){logger[_0xa3b9('0xf')](_0xa3b9('0x11'),_0x25a391,_0x2c6ec9[_0xa3b9('0xf')][_0xa3b9('0x12')]);return _0x980501(_0x2c6ec9['error'][_0xa3b9('0x12')]);}logger[_0xa3b9('0xf')](_0xa3b9('0x11'),_0x25a391,_0x2c6ec9[_0xa3b9('0xf')][_0xa3b9('0x12')]);return _0x8630d0(_0x2c6ec9[_0xa3b9('0xf')][_0xa3b9('0x12')]);}else{logger[_0xa3b9('0x13')]('Sound,\x20%s,\x20%s',_0x25a391,_0xa3b9('0xc'));_0x8630d0(_0x2c6ec9[_0xa3b9('0x14')][_0xa3b9('0x12')]);}})[_0xa3b9('0x15')](function(_0x36ee77){logger[_0xa3b9('0xf')](_0xa3b9('0x11'),_0x25a391,_0x36ee77);_0x980501(_0x36ee77);});});}exports[_0xa3b9('0x16')]=function(_0x36885a){var _0x148c89=this;return new Promise(function(_0x411c2a,_0x4b7e94){return db['Sound'][_0xa3b9('0x17')]({'raw':_0x36885a['options']?_0x36885a['options'][_0xa3b9('0x18')]===undefined?!![]:![]:!![],'where':_0x36885a['options']?_0x36885a[_0xa3b9('0x19')][_0xa3b9('0x1a')]||null:null,'attributes':_0x36885a['options']?_0x36885a[_0xa3b9('0x19')][_0xa3b9('0x1b')]||null:null,'include':_0x36885a[_0xa3b9('0x19')]?_0x36885a[_0xa3b9('0x19')]['include']?_['map'](_0x36885a[_0xa3b9('0x19')][_0xa3b9('0x1c')],function(_0xc63d43){return{'model':db[_0xc63d43[_0xa3b9('0x1d')]],'as':_0xc63d43['as'],'attributes':_0xc63d43[_0xa3b9('0x1b')],'include':_0xc63d43[_0xa3b9('0x1c')]?_[_0xa3b9('0x1e')](_0xc63d43[_0xa3b9('0x1c')],function(_0x5b9c27){return{'model':db[_0x5b9c27[_0xa3b9('0x1d')]],'as':_0x5b9c27['as'],'attributes':_0x5b9c27['attributes'],'include':_0x5b9c27['include']?_['map'](_0x5b9c27['include'],function(_0x536927){return{'model':db[_0x536927[_0xa3b9('0x1d')]],'as':_0x536927['as'],'attributes':_0x536927[_0xa3b9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa3b9('0xb')](function(_0x85acdd){logger[_0xa3b9('0x13')](_0xa3b9('0x16'),_0x36885a);logger['debug'](_0xa3b9('0x16'),_0x36885a,JSON[_0xa3b9('0xe')](_0x85acdd));_0x411c2a(_0x85acdd);})[_0xa3b9('0x15')](function(_0x2cdce5){logger[_0xa3b9('0xf')]('ShowSound',_0x2cdce5['message'],_0x36885a);_0x4b7e94(_0x148c89[_0xa3b9('0xf')](0x1f4,_0x2cdce5[_0xa3b9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 65210af..cf65cdc 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0xc28590,_0x154df6){var _0x1ae7a2=function(_0xd039a5){while(--_0xd039a5){_0xc28590['push'](_0xc28590['shift']());}};_0x1ae7a2(++_0x154df6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xb7e7[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('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(_0xb1ee6d,_0x427b4c){var _0x559dde=function(_0x359e7a){while(--_0x359e7a){_0xb1ee6d['push'](_0xb1ee6d['shift']());}};_0x559dde(++_0x427b4c);}(_0xda3f,0xec));var _0xfda3=function(_0xeeb588,_0x7151a7){_0xeeb588=_0xeeb588-0x0;var _0x1835e7=_0xda3f[_0xeeb588];return _0x1835e7;};'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 e3c7826..a4931fc 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 _0x287f=['sequelize','STRING','TEXT','out'];(function(_0x53f6f3,_0x485b4e){var _0x4dce48=function(_0x7f24cd){while(--_0x7f24cd){_0x53f6f3['push'](_0x53f6f3['shift']());}};_0x4dce48(++_0x485b4e);}(_0x287f,0x6c));var _0xf287=function(_0x5bd208,_0x532a55){_0x5bd208=_0x5bd208-0x0;var _0x2cc216=_0x287f[_0x5bd208];return _0x2cc216;};'use strict';var Sequelize=require(_0xf287('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf287('0x1')]},'body':{'type':Sequelize[_0xf287('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf287('0x3')),'defaultValue':_0xf287('0x3'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf287('0x2')]}}; \ No newline at end of file +var _0xc8e9=['medium','ENUM','out','sequelize','exports','STRING'];(function(_0x39fe14,_0x5bd555){var _0x36b4df=function(_0x4bd719){while(--_0x4bd719){_0x39fe14['push'](_0x39fe14['shift']());}};_0x36b4df(++_0x5bd555);}(_0xc8e9,0xe1));var _0x9c8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc8e9[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x9c8e('0x0'));module[_0x9c8e('0x1')]={'uniqueid':{'type':Sequelize[_0x9c8e('0x2')]},'body':{'type':Sequelize['TEXT'](_0x9c8e('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x9c8e('0x4')]('in',_0x9c8e('0x5')),'defaultValue':_0x9c8e('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x9c8e('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 96171d7..bba26fb 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 _0x6f83=['destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','SquareMessage','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then'];(function(_0xcbf182,_0x5d7bd4){var _0x2db93a=function(_0x321744){while(--_0x321744){_0xcbf182['push'](_0xcbf182['shift']());}};_0x2db93a(++_0x5d7bd4);}(_0x6f83,0x72));var _0x36f8=function(_0x644c54,_0x594aea){_0x644c54=_0x644c54-0x0;var _0x4523bb=_0x6f83[_0x644c54];return _0x4523bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36f8('0x0'));var zipdir=require(_0x36f8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36f8('0x2'));var moment=require(_0x36f8('0x3'));var BPromise=require(_0x36f8('0x4'));var Mustache=require(_0x36f8('0x5'));var util=require(_0x36f8('0x6'));var path=require(_0x36f8('0x7'));var sox=require(_0x36f8('0x8'));var csv=require(_0x36f8('0x9'));var ejs=require(_0x36f8('0xa'));var fs=require('fs');var fs_extra=require(_0x36f8('0xb'));var _=require(_0x36f8('0xc'));var squel=require(_0x36f8('0xd'));var crypto=require(_0x36f8('0xe'));var jsforce=require(_0x36f8('0xf'));var deskjs=require(_0x36f8('0x10'));var toCsv=require(_0x36f8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36f8('0x11'));var qs=require(_0x36f8('0x12'));var as=require(_0x36f8('0x13'));var hardwareService=require(_0x36f8('0x14'));var logger=require(_0x36f8('0x15'))(_0x36f8('0x16'));var utils=require(_0x36f8('0x17'));var config=require(_0x36f8('0x18'));var licenseUtil=require(_0x36f8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71e1ab,_0x196122){_0x196122=_0x196122||0xcc;return function(_0x166a1c){if(_0x166a1c){return _0x71e1ab[_0x36f8('0x1a')](_0x196122);}return _0x71e1ab['status'](_0x196122)[_0x36f8('0x1b')]();};}function respondWithResult(_0x189e22,_0x40a1c0){_0x40a1c0=_0x40a1c0||0xc8;return function(_0x5a8556){if(_0x5a8556){return _0x189e22[_0x36f8('0x1c')](_0x40a1c0)[_0x36f8('0x1d')](_0x5a8556);}};}function respondWithFilteredResult(_0x1ba051,_0x5048e0){return function(_0x429efc){if(_0x429efc){var _0x3e3281=typeof _0x5048e0[_0x36f8('0x1e')]===_0x36f8('0x1f')&&typeof _0x5048e0['limit']==='undefined';var _0x3f9947=_0x429efc['count'];var _0x517cba=_0x3e3281?0x0:_0x5048e0[_0x36f8('0x1e')];var _0x3d6a3c=_0x3e3281?_0x429efc['count']:_0x5048e0[_0x36f8('0x1e')]+_0x5048e0[_0x36f8('0x20')];var _0x290e63;if(_0x3d6a3c>=_0x3f9947){_0x3d6a3c=_0x3f9947;_0x290e63=0xc8;}else{_0x290e63=0xce;}_0x1ba051[_0x36f8('0x1c')](_0x290e63);return _0x1ba051[_0x36f8('0x21')](_0x36f8('0x22'),_0x517cba+'-'+_0x3d6a3c+'/'+_0x3f9947)[_0x36f8('0x1d')](_0x429efc);}return null;};}function patchUpdates(_0x16b9e8){return function(_0x283fd0){try{jsonpatch[_0x36f8('0x23')](_0x283fd0,_0x16b9e8,!![]);}catch(_0x26fc64){return BPromise[_0x36f8('0x24')](_0x26fc64);}return _0x283fd0['save']();};}function saveUpdates(_0xefe5b2,_0x42d203){return function(_0x41ccc3){if(_0x41ccc3){return _0x41ccc3['update'](_0xefe5b2)[_0x36f8('0x25')](function(_0x52b5ac){return _0x52b5ac;});}return null;};}function removeEntity(_0x362eae,_0x206075){return function(_0x4d2cd9){if(_0x4d2cd9){return _0x4d2cd9[_0x36f8('0x26')]()['then'](function(){_0x362eae[_0x36f8('0x1c')](0xcc)[_0x36f8('0x1b')]();});}};}function handleEntityNotFound(_0xb2acc5,_0x2eeb82){return function(_0x6740e1){if(!_0x6740e1){_0xb2acc5[_0x36f8('0x1a')](0x194);}return _0x6740e1;};}function handleError(_0x59291b,_0x462fd2){_0x462fd2=_0x462fd2||0x1f4;return function(_0xb2bbfd){logger[_0x36f8('0x27')](_0xb2bbfd[_0x36f8('0x28')]);if(_0xb2bbfd[_0x36f8('0x29')]){delete _0xb2bbfd[_0x36f8('0x29')];}_0x59291b[_0x36f8('0x1c')](_0x462fd2)[_0x36f8('0x2a')](_0xb2bbfd);};}exports[_0x36f8('0x2b')]=function(_0x51a2a1,_0x449882){var _0x1f67ea={},_0x3f01a6={},_0x328be8={'count':0x0,'rows':[]};var _0x191cdc=_[_0x36f8('0x2c')](db['SquareMessage'][_0x36f8('0x2d')],function(_0x302745){return{'name':_0x302745[_0x36f8('0x2e')],'type':_0x302745[_0x36f8('0x2f')][_0x36f8('0x30')]};});_0x3f01a6[_0x36f8('0x31')]=_[_0x36f8('0x2c')](_0x191cdc,_0x36f8('0x29'));_0x3f01a6[_0x36f8('0x32')]=_[_0x36f8('0x33')](_0x51a2a1[_0x36f8('0x32')]);_0x3f01a6['filters']=_['intersection'](_0x3f01a6['model'],_0x3f01a6[_0x36f8('0x32')]);_0x1f67ea[_0x36f8('0x34')]=_[_0x36f8('0x35')](_0x3f01a6['model'],qs[_0x36f8('0x36')](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x36')]));_0x1f67ea[_0x36f8('0x34')]=_0x1f67ea[_0x36f8('0x34')][_0x36f8('0x37')]?_0x1f67ea[_0x36f8('0x34')]:_0x3f01a6[_0x36f8('0x31')];if(!_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x38')]('nolimit')){_0x1f67ea[_0x36f8('0x20')]=qs[_0x36f8('0x20')](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x20')]);_0x1f67ea[_0x36f8('0x1e')]=qs['offset'](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x1e')]);}_0x1f67ea[_0x36f8('0x39')]=qs['sort'](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x3a')]);_0x1f67ea[_0x36f8('0x3b')]=qs[_0x36f8('0x3c')](_['pick'](_0x51a2a1['query'],_0x3f01a6[_0x36f8('0x3c')]),_0x191cdc);if(_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x3d')]){_0x1f67ea[_0x36f8('0x3b')]=_[_0x36f8('0x3e')](_0x1f67ea[_0x36f8('0x3b')],{'$or':_[_0x36f8('0x2c')](_0x191cdc,function(_0x598db5){if(_0x598db5[_0x36f8('0x2f')]!=='VIRTUAL'){var _0x258c27={};_0x258c27[_0x598db5[_0x36f8('0x29')]]={'$like':'%'+_0x51a2a1[_0x36f8('0x32')]['filter']+'%'};return _0x258c27;}})});}_0x1f67ea=_['merge']({},_0x1f67ea,_0x51a2a1[_0x36f8('0x3f')]);var _0x245a27={'where':_0x1f67ea[_0x36f8('0x3b')]};return db[_0x36f8('0x40')][_0x36f8('0x41')](_0x245a27)[_0x36f8('0x25')](function(_0x437218){_0x328be8[_0x36f8('0x41')]=_0x437218;if(_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x42')]){_0x1f67ea['include']=[{'all':!![]}];}return db[_0x36f8('0x40')][_0x36f8('0x43')](_0x1f67ea);})[_0x36f8('0x25')](function(_0x1e97de){_0x328be8[_0x36f8('0x44')]=_0x1e97de;return _0x328be8;})['then'](respondWithFilteredResult(_0x449882,_0x1f67ea))[_0x36f8('0x45')](handleError(_0x449882,null));};exports[_0x36f8('0x46')]=function(_0x3e1700,_0x53aa30){var _0x10e763={'raw':!![],'where':{'id':_0x3e1700[_0x36f8('0x47')]['id']}},_0x3b9d5e={};_0x3b9d5e[_0x36f8('0x31')]=_[_0x36f8('0x33')](db['SquareMessage'][_0x36f8('0x2d')]);_0x3b9d5e[_0x36f8('0x32')]=_[_0x36f8('0x33')](_0x3e1700[_0x36f8('0x32')]);_0x3b9d5e[_0x36f8('0x3c')]=_[_0x36f8('0x35')](_0x3b9d5e[_0x36f8('0x31')],_0x3b9d5e[_0x36f8('0x32')]);_0x10e763['attributes']=_[_0x36f8('0x35')](_0x3b9d5e['model'],qs[_0x36f8('0x36')](_0x3e1700[_0x36f8('0x32')]['fields']));_0x10e763[_0x36f8('0x34')]=_0x10e763[_0x36f8('0x34')]['length']?_0x10e763['attributes']:_0x3b9d5e[_0x36f8('0x31')];if(_0x3e1700[_0x36f8('0x32')][_0x36f8('0x42')]){_0x10e763[_0x36f8('0x48')]=[{'all':!![]}];}_0x10e763=_[_0x36f8('0x3e')]({},_0x10e763,_0x3e1700['options']);return db['SquareMessage'][_0x36f8('0x49')](_0x10e763)[_0x36f8('0x25')](handleEntityNotFound(_0x53aa30,null))[_0x36f8('0x25')](respondWithResult(_0x53aa30,null))[_0x36f8('0x45')](handleError(_0x53aa30,null));};exports[_0x36f8('0x4a')]=function(_0x5085ac,_0x4b324d){return db[_0x36f8('0x40')][_0x36f8('0x4a')](_0x5085ac[_0x36f8('0x4b')],{})[_0x36f8('0x25')](respondWithResult(_0x4b324d,0xc9))[_0x36f8('0x45')](handleError(_0x4b324d,null));};exports['update']=function(_0x8e0950,_0x488b41){if(_0x8e0950[_0x36f8('0x4b')]['id']){delete _0x8e0950[_0x36f8('0x4b')]['id'];}return db[_0x36f8('0x40')]['find']({'where':{'id':_0x8e0950[_0x36f8('0x47')]['id']}})[_0x36f8('0x25')](handleEntityNotFound(_0x488b41,null))[_0x36f8('0x25')](saveUpdates(_0x8e0950[_0x36f8('0x4b')],null))[_0x36f8('0x25')](respondWithResult(_0x488b41,null))['catch'](handleError(_0x488b41,null));};exports[_0x36f8('0x26')]=function(_0x4bacdb,_0x5b38da){return db['SquareMessage'][_0x36f8('0x49')]({'where':{'id':_0x4bacdb[_0x36f8('0x47')]['id']}})[_0x36f8('0x25')](handleEntityNotFound(_0x5b38da,null))[_0x36f8('0x25')](removeEntity(_0x5b38da,null))[_0x36f8('0x45')](handleError(_0x5b38da,null));}; \ No newline at end of file +var _0xe24e=['count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareMessage','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4cdf5b,_0x2411df){var _0x14042f=function(_0x4330c3){while(--_0x4330c3){_0x4cdf5b['push'](_0x4cdf5b['shift']());}};_0x14042f(++_0x2411df);}(_0xe24e,0x15f));var _0xee24=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xe24e[_0x500419];return _0x241c1a;};'use strict';var emlformat=require(_0xee24('0x0'));var rimraf=require(_0xee24('0x1'));var zipdir=require(_0xee24('0x2'));var jsonpatch=require(_0xee24('0x3'));var rp=require(_0xee24('0x4'));var moment=require(_0xee24('0x5'));var BPromise=require(_0xee24('0x6'));var Mustache=require('mustache');var util=require(_0xee24('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xee24('0x8'));var fs=require('fs');var fs_extra=require(_0xee24('0x9'));var _=require(_0xee24('0xa'));var squel=require(_0xee24('0xb'));var crypto=require(_0xee24('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xee24('0xd'));var toCsv=require(_0xee24('0xe'));var querystring=require(_0xee24('0xf'));var Papa=require(_0xee24('0x10'));var Redis=require(_0xee24('0x11'));var authService=require(_0xee24('0x12'));var qs=require(_0xee24('0x13'));var as=require(_0xee24('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee24('0x15'))(_0xee24('0x16'));var utils=require(_0xee24('0x17'));var config=require(_0xee24('0x18'));var licenseUtil=require(_0xee24('0x19'));var db=require(_0xee24('0x1a'))['db'];function respondWithStatusCode(_0x7a2c92,_0x3a3289){_0x3a3289=_0x3a3289||0xcc;return function(_0x5b143f){if(_0x5b143f){return _0x7a2c92[_0xee24('0x1b')](_0x3a3289);}return _0x7a2c92[_0xee24('0x1c')](_0x3a3289)[_0xee24('0x1d')]();};}function respondWithResult(_0x20a438,_0x3d6824){_0x3d6824=_0x3d6824||0xc8;return function(_0x35611a){if(_0x35611a){return _0x20a438[_0xee24('0x1c')](_0x3d6824)[_0xee24('0x1e')](_0x35611a);}};}function respondWithFilteredResult(_0xe7780d,_0x2b8fe5){return function(_0x177564){if(_0x177564){var _0x42db45=typeof _0x2b8fe5[_0xee24('0x1f')]===_0xee24('0x20')&&typeof _0x2b8fe5[_0xee24('0x21')]==='undefined';var _0x49972a=_0x177564[_0xee24('0x22')];var _0x1e0609=_0x42db45?0x0:_0x2b8fe5[_0xee24('0x1f')];var _0x13b287=_0x42db45?_0x177564[_0xee24('0x22')]:_0x2b8fe5[_0xee24('0x1f')]+_0x2b8fe5[_0xee24('0x21')];var _0x110be5;if(_0x13b287>=_0x49972a){_0x13b287=_0x49972a;_0x110be5=0xc8;}else{_0x110be5=0xce;}_0xe7780d[_0xee24('0x1c')](_0x110be5);return _0xe7780d[_0xee24('0x23')](_0xee24('0x24'),_0x1e0609+'-'+_0x13b287+'/'+_0x49972a)[_0xee24('0x1e')](_0x177564);}return null;};}function patchUpdates(_0x3ec49f){return function(_0x2d961e){try{jsonpatch[_0xee24('0x25')](_0x2d961e,_0x3ec49f,!![]);}catch(_0x15c5ff){return BPromise[_0xee24('0x26')](_0x15c5ff);}return _0x2d961e[_0xee24('0x27')]();};}function saveUpdates(_0x443592,_0x14064c){return function(_0x29fcdf){if(_0x29fcdf){return _0x29fcdf[_0xee24('0x28')](_0x443592)[_0xee24('0x29')](function(_0x19ea1e){return _0x19ea1e;});}return null;};}function removeEntity(_0x677ce6,_0x19f587){return function(_0x41fad2){if(_0x41fad2){return _0x41fad2[_0xee24('0x2a')]()[_0xee24('0x29')](function(){_0x677ce6[_0xee24('0x1c')](0xcc)[_0xee24('0x1d')]();});}};}function handleEntityNotFound(_0x41f580,_0x30bd69){return function(_0x15c02f){if(!_0x15c02f){_0x41f580[_0xee24('0x1b')](0x194);}return _0x15c02f;};}function handleError(_0x7884aa,_0x471aa2){_0x471aa2=_0x471aa2||0x1f4;return function(_0x3c1083){logger[_0xee24('0x2b')](_0x3c1083['stack']);if(_0x3c1083[_0xee24('0x2c')]){delete _0x3c1083[_0xee24('0x2c')];}_0x7884aa[_0xee24('0x1c')](_0x471aa2)[_0xee24('0x2d')](_0x3c1083);};}exports[_0xee24('0x2e')]=function(_0x3d4964,_0x36e17a){var _0x6ccc9e={},_0x1b6811={},_0x5d468d={'count':0x0,'rows':[]};var _0x36a543=_[_0xee24('0x2f')](db[_0xee24('0x30')]['rawAttributes'],function(_0x3ebb7d){return{'name':_0x3ebb7d['fieldName'],'type':_0x3ebb7d[_0xee24('0x31')][_0xee24('0x32')]};});_0x1b6811[_0xee24('0x33')]=_[_0xee24('0x2f')](_0x36a543,_0xee24('0x2c'));_0x1b6811[_0xee24('0x34')]=_[_0xee24('0x35')](_0x3d4964[_0xee24('0x34')]);_0x1b6811[_0xee24('0x36')]=_[_0xee24('0x37')](_0x1b6811[_0xee24('0x33')],_0x1b6811['query']);_0x6ccc9e[_0xee24('0x38')]=_[_0xee24('0x37')](_0x1b6811[_0xee24('0x33')],qs['fields'](_0x3d4964[_0xee24('0x34')][_0xee24('0x39')]));_0x6ccc9e['attributes']=_0x6ccc9e[_0xee24('0x38')][_0xee24('0x3a')]?_0x6ccc9e['attributes']:_0x1b6811[_0xee24('0x33')];if(!_0x3d4964['query'][_0xee24('0x3b')]('nolimit')){_0x6ccc9e[_0xee24('0x21')]=qs[_0xee24('0x21')](_0x3d4964[_0xee24('0x34')][_0xee24('0x21')]);_0x6ccc9e[_0xee24('0x1f')]=qs[_0xee24('0x1f')](_0x3d4964['query'][_0xee24('0x1f')]);}_0x6ccc9e[_0xee24('0x3c')]=qs[_0xee24('0x3d')](_0x3d4964['query']['sort']);_0x6ccc9e[_0xee24('0x3e')]=qs['filters'](_['pick'](_0x3d4964['query'],_0x1b6811['filters']),_0x36a543);if(_0x3d4964[_0xee24('0x34')][_0xee24('0x3f')]){_0x6ccc9e[_0xee24('0x3e')]=_['merge'](_0x6ccc9e[_0xee24('0x3e')],{'$or':_[_0xee24('0x2f')](_0x36a543,function(_0x43e9ea){if(_0x43e9ea['type']!==_0xee24('0x40')){var _0x2d1975={};_0x2d1975[_0x43e9ea['name']]={'$like':'%'+_0x3d4964[_0xee24('0x34')][_0xee24('0x3f')]+'%'};return _0x2d1975;}})});}_0x6ccc9e=_[_0xee24('0x41')]({},_0x6ccc9e,_0x3d4964['options']);var _0x268ba3={'where':_0x6ccc9e[_0xee24('0x3e')]};return db[_0xee24('0x30')]['count'](_0x268ba3)['then'](function(_0x5b7f62){_0x5d468d[_0xee24('0x22')]=_0x5b7f62;if(_0x3d4964[_0xee24('0x34')][_0xee24('0x42')]){_0x6ccc9e[_0xee24('0x43')]=[{'all':!![]}];}return db['SquareMessage'][_0xee24('0x44')](_0x6ccc9e);})[_0xee24('0x29')](function(_0x2c063c){_0x5d468d[_0xee24('0x45')]=_0x2c063c;return _0x5d468d;})[_0xee24('0x29')](respondWithFilteredResult(_0x36e17a,_0x6ccc9e))[_0xee24('0x46')](handleError(_0x36e17a,null));};exports[_0xee24('0x47')]=function(_0x290eaf,_0x232aed){var _0x4b0e0a={'raw':!![],'where':{'id':_0x290eaf[_0xee24('0x48')]['id']}},_0x200415={};_0x200415['model']=_[_0xee24('0x35')](db[_0xee24('0x30')]['rawAttributes']);_0x200415[_0xee24('0x34')]=_[_0xee24('0x35')](_0x290eaf[_0xee24('0x34')]);_0x200415[_0xee24('0x36')]=_[_0xee24('0x37')](_0x200415[_0xee24('0x33')],_0x200415['query']);_0x4b0e0a['attributes']=_[_0xee24('0x37')](_0x200415[_0xee24('0x33')],qs[_0xee24('0x39')](_0x290eaf[_0xee24('0x34')][_0xee24('0x39')]));_0x4b0e0a[_0xee24('0x38')]=_0x4b0e0a['attributes']['length']?_0x4b0e0a[_0xee24('0x38')]:_0x200415[_0xee24('0x33')];if(_0x290eaf[_0xee24('0x34')][_0xee24('0x42')]){_0x4b0e0a[_0xee24('0x43')]=[{'all':!![]}];}_0x4b0e0a=_['merge']({},_0x4b0e0a,_0x290eaf[_0xee24('0x49')]);return db[_0xee24('0x30')][_0xee24('0x4a')](_0x4b0e0a)[_0xee24('0x29')](handleEntityNotFound(_0x232aed,null))[_0xee24('0x29')](respondWithResult(_0x232aed,null))[_0xee24('0x46')](handleError(_0x232aed,null));};exports[_0xee24('0x4b')]=function(_0xa101d8,_0xc2e74f){return db[_0xee24('0x30')]['create'](_0xa101d8['body'],{})['then'](respondWithResult(_0xc2e74f,0xc9))['catch'](handleError(_0xc2e74f,null));};exports[_0xee24('0x28')]=function(_0x4dc9ed,_0x50069a){if(_0x4dc9ed['body']['id']){delete _0x4dc9ed[_0xee24('0x4c')]['id'];}return db['SquareMessage'][_0xee24('0x4a')]({'where':{'id':_0x4dc9ed['params']['id']}})['then'](handleEntityNotFound(_0x50069a,null))[_0xee24('0x29')](saveUpdates(_0x4dc9ed[_0xee24('0x4c')],null))[_0xee24('0x29')](respondWithResult(_0x50069a,null))[_0xee24('0x46')](handleError(_0x50069a,null));};exports[_0xee24('0x2a')]=function(_0x3b5294,_0x413007){return db[_0xee24('0x30')][_0xee24('0x4a')]({'where':{'id':_0x3b5294[_0xee24('0x48')]['id']}})[_0xee24('0x29')](handleEntityNotFound(_0x413007,null))[_0xee24('0x29')](removeEntity(_0x413007,null))[_0xee24('0x46')](handleError(_0x413007,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 2d1a7ec..6b37389 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 _0xffef=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages'];(function(_0x12d13f,_0x5c09cb){var _0x20bb53=function(_0x3e0b1d){while(--_0x3e0b1d){_0x12d13f['push'](_0x12d13f['shift']());}};_0x20bb53(++_0x5c09cb);}(_0xffef,0x11e));var _0xfffe=function(_0x3cc4a3,_0x4fc3f4){_0x3cc4a3=_0x3cc4a3-0x0;var _0x557d18=_0xffef[_0x3cc4a3];return _0x557d18;};'use strict';var _=require('lodash');var util=require(_0xfffe('0x0'));var logger=require(_0xfffe('0x1'))(_0xfffe('0x2'));var moment=require(_0xfffe('0x3'));var BPromise=require('bluebird');var rp=require(_0xfffe('0x4'));var fs=require('fs');var path=require(_0xfffe('0x5'));var rimraf=require(_0xfffe('0x6'));var config=require(_0xfffe('0x7'));var attributes=require(_0xfffe('0x8'));module[_0xfffe('0x9')]=function(_0x5cd1a3,_0x327122){return _0x5cd1a3[_0xfffe('0xa')](_0xfffe('0xb'),attributes,{'tableName':_0xfffe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49ce=['define','square_messages','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x519228,_0x2bcbc2){var _0xc3c605=function(_0x4d3811){while(--_0x4d3811){_0x519228['push'](_0x519228['shift']());}};_0xc3c605(++_0x2bcbc2);}(_0x49ce,0x86));var _0xe49c=function(_0x113696,_0x1843cc){_0x113696=_0x113696-0x0;var _0x1fb234=_0x49ce[_0x113696];return _0x1fb234;};'use strict';var _=require(_0xe49c('0x0'));var util=require(_0xe49c('0x1'));var logger=require(_0xe49c('0x2'))('api');var moment=require(_0xe49c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe49c('0x4'));var fs=require('fs');var path=require(_0xe49c('0x5'));var rimraf=require(_0xe49c('0x6'));var config=require(_0xe49c('0x7'));var attributes=require('./squareMessage.attributes');module[_0xe49c('0x8')]=function(_0x29781d,_0x579927){return _0x29781d[_0xe49c('0x9')]('SquareMessage',attributes,{'tableName':_0xe49c('0xa'),'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 0aea1ba..277eae4 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 _0x12d1=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareMessage','options','CreateSquareMessage','moment','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then'];(function(_0x5aa441,_0x5ca270){var _0x1dc66e=function(_0x186778){while(--_0x186778){_0x5aa441['push'](_0x5aa441['shift']());}};_0x1dc66e(++_0x5ca270);}(_0x12d1,0x1af));var _0x112d=function(_0x25611a,_0x57fe33){_0x25611a=_0x25611a-0x0;var _0x11bf64=_0x12d1[_0x25611a];return _0x11bf64;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x112d('0x0'));var BPromise=require('bluebird');var rs=require(_0x112d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x112d('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x112d('0x3'));var config=require('../../config/environment');var jayson=require(_0x112d('0x4'));var client=jayson[_0x112d('0x5')][_0x112d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x59c1ae,_0x426ba5,_0x49f072){return new BPromise(function(_0xd1a711,_0x14c4af){return client[_0x112d('0x7')](_0x59c1ae,_0x49f072)[_0x112d('0x8')](function(_0x28e211){logger[_0x112d('0x9')](_0x112d('0xa'),_0x426ba5,_0x112d('0xb'));logger[_0x112d('0xc')](_0x112d('0xd'),_0x426ba5,_0x112d('0xb'),JSON[_0x112d('0xe')](_0x28e211));if(_0x28e211[_0x112d('0xf')]){if(_0x28e211[_0x112d('0xf')][_0x112d('0x10')]===0x1f4){logger['error'](_0x112d('0xa'),_0x426ba5,_0x28e211[_0x112d('0xf')][_0x112d('0x11')]);return _0x14c4af(_0x28e211[_0x112d('0xf')]['message']);}logger[_0x112d('0xf')](_0x112d('0xa'),_0x426ba5,_0x28e211[_0x112d('0xf')]['message']);return _0xd1a711(_0x28e211[_0x112d('0xf')][_0x112d('0x11')]);}else{logger[_0x112d('0x9')](_0x112d('0xa'),_0x426ba5,_0x112d('0xb'));_0xd1a711(_0x28e211['result'][_0x112d('0x11')]);}})[_0x112d('0x12')](function(_0x402693){logger[_0x112d('0xf')]('SquareMessage,\x20%s,\x20%s',_0x426ba5,_0x402693);_0x14c4af(_0x402693);});});}exports['CreateSquareMessage']=function(_0x3baef8){var _0x1c1b13=this;return new Promise(function(_0x3564d4,_0x15b411){return db[_0x112d('0x13')]['create'](_0x3baef8['body'],{'raw':_0x3baef8[_0x112d('0x14')]?_0x3baef8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x24c0de){logger['info']('CreateSquareMessage',_0x3baef8);logger[_0x112d('0xc')](_0x112d('0x15'),_0x3baef8,JSON[_0x112d('0xe')](_0x24c0de));_0x3564d4(_0x24c0de);})[_0x112d('0x12')](function(_0x420d0a){logger[_0x112d('0xf')](_0x112d('0x15'),_0x420d0a[_0x112d('0x11')],_0x3baef8);_0x15b411(_0x1c1b13['error'](0x1f4,_0x420d0a[_0x112d('0x11')]));});});}; \ No newline at end of file +var _0xe08d=['client','http','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x226494,_0xc4b645){var _0x27b950=function(_0x3e6acf){while(--_0x3e6acf){_0x226494['push'](_0x226494['shift']());}};_0x27b950(++_0xc4b645);}(_0xe08d,0x6d));var _0xde08=function(_0x2289b7,_0x48633b){_0x2289b7=_0x2289b7-0x0;var _0x1f5857=_0xe08d[_0x2289b7];return _0x1f5857;};'use strict';var _=require(_0xde08('0x0'));var util=require(_0xde08('0x1'));var moment=require(_0xde08('0x2'));var BPromise=require(_0xde08('0x3'));var rs=require(_0xde08('0x4'));var fs=require('fs');var Redis=require(_0xde08('0x5'));var db=require(_0xde08('0x6'))['db'];var utils=require(_0xde08('0x7'));var logger=require('../../config/logger')(_0xde08('0x8'));var config=require(_0xde08('0x9'));var jayson=require(_0xde08('0xa'));var client=jayson[_0xde08('0xb')][_0xde08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cca75,_0x569cc9,_0x2f3a1d){return new BPromise(function(_0x10c7a0,_0x2ff259){return client['request'](_0x3cca75,_0x2f3a1d)[_0xde08('0xd')](function(_0xb37d3c){logger['info'](_0xde08('0xe'),_0x569cc9,_0xde08('0xf'));logger[_0xde08('0x10')](_0xde08('0x11'),_0x569cc9,_0xde08('0xf'),JSON['stringify'](_0xb37d3c));if(_0xb37d3c[_0xde08('0x12')]){if(_0xb37d3c[_0xde08('0x12')][_0xde08('0x13')]===0x1f4){logger[_0xde08('0x12')](_0xde08('0xe'),_0x569cc9,_0xb37d3c['error']['message']);return _0x2ff259(_0xb37d3c[_0xde08('0x12')]['message']);}logger[_0xde08('0x12')](_0xde08('0xe'),_0x569cc9,_0xb37d3c[_0xde08('0x12')][_0xde08('0x14')]);return _0x10c7a0(_0xb37d3c[_0xde08('0x12')][_0xde08('0x14')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x569cc9,'request\x20sent');_0x10c7a0(_0xb37d3c['result'][_0xde08('0x14')]);}})[_0xde08('0x15')](function(_0x1f8b34){logger[_0xde08('0x12')](_0xde08('0xe'),_0x569cc9,_0x1f8b34);_0x2ff259(_0x1f8b34);});});}exports[_0xde08('0x16')]=function(_0x58e9e2){var _0x4f41f8=this;return new Promise(function(_0x291c2a,_0x5bfd1a){return db[_0xde08('0x17')][_0xde08('0x18')](_0x58e9e2[_0xde08('0x19')],{'raw':_0x58e9e2[_0xde08('0x1a')]?_0x58e9e2[_0xde08('0x1a')][_0xde08('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2b6994){logger[_0xde08('0x1c')]('CreateSquareMessage',_0x58e9e2);logger[_0xde08('0x10')](_0xde08('0x16'),_0x58e9e2,JSON[_0xde08('0x1d')](_0x2b6994));_0x291c2a(_0x2b6994);})[_0xde08('0x15')](function(_0x1fd0b3){logger['error'](_0xde08('0x16'),_0x1fd0b3[_0xde08('0x14')],_0x58e9e2);_0x5bfd1a(_0x4f41f8[_0xde08('0x12')](0x1f4,_0x1fd0b3[_0xde08('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 9e13d96..01f388e 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 _0x5c8b=['test','post','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','15s'];(function(_0xb4536d,_0x32365f){var _0x1081f9=function(_0x55c4b6){while(--_0x55c4b6){_0xb4536d['push'](_0xb4536d['shift']());}};_0x1081f9(++_0x32365f);}(_0x5c8b,0xb7));var _0xb5c8=function(_0x2ab081,_0xf21358){_0x2ab081=_0x2ab081-0x0;var _0x5063db=_0x5c8b[_0x2ab081];return _0x5063db;};'use strict';var multer=require(_0xb5c8('0x0'));var util=require(_0xb5c8('0x1'));var path=require('path');var timeout=require(_0xb5c8('0x2'));var express=require(_0xb5c8('0x3'));var router=express[_0xb5c8('0x4')]();var fs_extra=require(_0xb5c8('0x5'));var auth=require(_0xb5c8('0x6'));var interaction=require(_0xb5c8('0x7'));var config=require('../../config/environment');var controller=require(_0xb5c8('0x8'));router[_0xb5c8('0x9')]('/',auth[_0xb5c8('0xa')](),controller[_0xb5c8('0xb')]);router[_0xb5c8('0x9')]('/:id',auth[_0xb5c8('0xa')](),controller[_0xb5c8('0xc')]);router[_0xb5c8('0x9')](_0xb5c8('0xd'),auth[_0xb5c8('0xa')](),timeout(_0xb5c8('0xe')),controller[_0xb5c8('0xf')]);router[_0xb5c8('0x10')]('/',auth[_0xb5c8('0xa')](),controller['create']);router[_0xb5c8('0x11')](_0xb5c8('0x12'),auth[_0xb5c8('0xa')](),controller[_0xb5c8('0x13')]);router['delete'](_0xb5c8('0x12'),auth[_0xb5c8('0xa')](),controller[_0xb5c8('0x14')]);module[_0xb5c8('0x15')]=router; \ No newline at end of file +var _0xc86a=['test','post','create','put','update','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s'];(function(_0x139928,_0x41ed69){var _0x16ef95=function(_0x12e1cf){while(--_0x12e1cf){_0x139928['push'](_0x139928['shift']());}};_0x16ef95(++_0x41ed69);}(_0xc86a,0x11e));var _0xac86=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0xc86a[_0x2b737c];return _0x466ed5;};'use strict';var multer=require(_0xac86('0x0'));var util=require('util');var path=require(_0xac86('0x1'));var timeout=require(_0xac86('0x2'));var express=require(_0xac86('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xac86('0x4'));var interaction=require(_0xac86('0x5'));var config=require(_0xac86('0x6'));var controller=require('./squareOdbc.controller');router[_0xac86('0x7')]('/',auth[_0xac86('0x8')](),controller[_0xac86('0x9')]);router[_0xac86('0x7')](_0xac86('0xa'),auth['isAuthenticated'](),controller[_0xac86('0xb')]);router[_0xac86('0x7')](_0xac86('0xc'),auth[_0xac86('0x8')](),timeout(_0xac86('0xd')),controller[_0xac86('0xe')]);router[_0xac86('0xf')]('/',auth[_0xac86('0x8')](),controller[_0xac86('0x10')]);router[_0xac86('0x11')](_0xac86('0xa'),auth[_0xac86('0x8')](),controller[_0xac86('0x12')]);router['delete']('/:id',auth[_0xac86('0x8')](),controller['destroy']);module[_0xac86('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 6c407e6..0724048 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 _0x5717=['STRING','sequelize','exports'];(function(_0x19abe9,_0x224e7c){var _0x32327f=function(_0x20fdbf){while(--_0x20fdbf){_0x19abe9['push'](_0x19abe9['shift']());}};_0x32327f(++_0x224e7c);}(_0x5717,0x73));var _0x7571=function(_0x4f4f0a,_0x541feb){_0x4f4f0a=_0x4f4f0a-0x0;var _0x5ef644=_0x5717[_0x4f4f0a];return _0x5ef644;};'use strict';var Sequelize=require(_0x7571('0x0'));module[_0x7571('0x1')]={'name':{'type':Sequelize[_0x7571('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x7571('0x2')]},'description':{'type':Sequelize[_0x7571('0x2')]}}; \ No newline at end of file +var _0x573c=['name','sequelize','exports','STRING'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x573c,0xa1));var _0xc573=function(_0x2a9749,_0x10b5b7){_0x2a9749=_0x2a9749-0x0;var _0x53ad53=_0x573c[_0x2a9749];return _0x53ad53;};'use strict';var Sequelize=require(_0xc573('0x0'));module[_0xc573('0x1')]={'name':{'type':Sequelize[_0xc573('0x2')],'unique':_0xc573('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xc573('0x2')]},'description':{'type':Sequelize[_0xc573('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 26f9bb7..3a3f73d 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 _0x5f98=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','get','ODBC','destroy','end','sendStatus','stack','name','index','SquareOdbc','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path'];(function(_0xcda377,_0x1e2678){var _0x1c024f=function(_0x1aeb61){while(--_0x1aeb61){_0xcda377['push'](_0xcda377['shift']());}};_0x1c024f(++_0x1e2678);}(_0x5f98,0x14d));var _0x85f9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f98[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85f9('0x0'));var zipdir=require(_0x85f9('0x1'));var jsonpatch=require(_0x85f9('0x2'));var rp=require(_0x85f9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x85f9('0x4'));var util=require(_0x85f9('0x5'));var path=require(_0x85f9('0x6'));var sox=require('sox');var csv=require(_0x85f9('0x7'));var ejs=require(_0x85f9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85f9('0x9'));var squel=require(_0x85f9('0xa'));var crypto=require(_0x85f9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x85f9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x85f9('0xd'));var Papa=require(_0x85f9('0xe'));var Redis=require('ioredis');var authService=require(_0x85f9('0xf'));var qs=require(_0x85f9('0x10'));var as=require(_0x85f9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85f9('0x12'))('api');var utils=require(_0x85f9('0x13'));var config=require(_0x85f9('0x14'));var licenseUtil=require(_0x85f9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57e066,_0x332d72){_0x332d72=_0x332d72||0xcc;return function(_0x5ae7e3){if(_0x5ae7e3){return _0x57e066['sendStatus'](_0x332d72);}return _0x57e066[_0x85f9('0x16')](_0x332d72)['end']();};}function respondWithResult(_0x1aa8c2,_0x17ca82){_0x17ca82=_0x17ca82||0xc8;return function(_0x19c287){if(_0x19c287){return _0x1aa8c2[_0x85f9('0x16')](_0x17ca82)[_0x85f9('0x17')](_0x19c287);}};}function respondWithFilteredResult(_0x4aeb7d,_0x524515){return function(_0x1c074a){if(_0x1c074a){var _0x375643=typeof _0x524515[_0x85f9('0x18')]==='undefined'&&typeof _0x524515[_0x85f9('0x19')]===_0x85f9('0x1a');var _0x554562=_0x1c074a[_0x85f9('0x1b')];var _0x275385=_0x375643?0x0:_0x524515['offset'];var _0x5b9ef6=_0x375643?_0x1c074a[_0x85f9('0x1b')]:_0x524515[_0x85f9('0x18')]+_0x524515[_0x85f9('0x19')];var _0x4062a7;if(_0x5b9ef6>=_0x554562){_0x5b9ef6=_0x554562;_0x4062a7=0xc8;}else{_0x4062a7=0xce;}_0x4aeb7d['status'](_0x4062a7);return _0x4aeb7d[_0x85f9('0x1c')](_0x85f9('0x1d'),_0x275385+'-'+_0x5b9ef6+'/'+_0x554562)['json'](_0x1c074a);}return null;};}function patchUpdates(_0x5a8933){return function(_0x540755){try{jsonpatch[_0x85f9('0x1e')](_0x540755,_0x5a8933,!![]);}catch(_0x4cf92d){return BPromise[_0x85f9('0x1f')](_0x4cf92d);}return _0x540755[_0x85f9('0x20')]();};}function saveUpdates(_0x5f2aec,_0x44c088){return function(_0x56dae2){if(_0x56dae2){return _0x56dae2['update'](_0x5f2aec)[_0x85f9('0x21')](function(_0x586bc2){return _0x586bc2;});}return null;};}function removeEntity(_0xac7311,_0x11b7bb){return function(_0xd49171){if(_0xd49171){return _0xd49171['destroy']()[_0x85f9('0x21')](function(){var _0x179479=_0xd49171[_0x85f9('0x22')]({'plain':!![]});var _0x111e26=_0x85f9('0x23');return db['UserProfileResource'][_0x85f9('0x24')]({'where':{'type':_0x111e26,'resourceId':_0x179479['id']}})[_0x85f9('0x21')](function(){return _0xd49171;});})[_0x85f9('0x21')](function(){_0xac7311[_0x85f9('0x16')](0xcc)[_0x85f9('0x25')]();});}};}function handleEntityNotFound(_0x35e734,_0x4c0baf){return function(_0x18aae4){if(!_0x18aae4){_0x35e734[_0x85f9('0x26')](0x194);}return _0x18aae4;};}function handleError(_0x5dcbe2,_0x58af8f){_0x58af8f=_0x58af8f||0x1f4;return function(_0x58dfc6){logger['error'](_0x58dfc6[_0x85f9('0x27')]);if(_0x58dfc6['name']){delete _0x58dfc6[_0x85f9('0x28')];}_0x5dcbe2[_0x85f9('0x16')](_0x58af8f)['send'](_0x58dfc6);};}exports[_0x85f9('0x29')]=function(_0x548ba2,_0x22c763){var _0x42b063={},_0x31ae6f={},_0x5e5ac5={'count':0x0,'rows':[]};var _0x30f527=_['map'](db[_0x85f9('0x2a')]['rawAttributes'],function(_0x29603d){return{'name':_0x29603d['fieldName'],'type':_0x29603d[_0x85f9('0x2b')]['key']};});_0x31ae6f['model']=_['map'](_0x30f527,_0x85f9('0x28'));_0x31ae6f[_0x85f9('0x2c')]=_[_0x85f9('0x2d')](_0x548ba2[_0x85f9('0x2c')]);_0x31ae6f[_0x85f9('0x2e')]=_[_0x85f9('0x2f')](_0x31ae6f[_0x85f9('0x30')],_0x31ae6f['query']);_0x42b063[_0x85f9('0x31')]=_[_0x85f9('0x2f')](_0x31ae6f['model'],qs['fields'](_0x548ba2['query'][_0x85f9('0x32')]));_0x42b063[_0x85f9('0x31')]=_0x42b063['attributes']['length']?_0x42b063[_0x85f9('0x31')]:_0x31ae6f[_0x85f9('0x30')];if(!_0x548ba2[_0x85f9('0x2c')][_0x85f9('0x33')]('nolimit')){_0x42b063[_0x85f9('0x19')]=qs['limit'](_0x548ba2[_0x85f9('0x2c')][_0x85f9('0x19')]);_0x42b063[_0x85f9('0x18')]=qs[_0x85f9('0x18')](_0x548ba2['query'][_0x85f9('0x18')]);}_0x42b063[_0x85f9('0x34')]=qs[_0x85f9('0x35')](_0x548ba2[_0x85f9('0x2c')]['sort']);_0x42b063[_0x85f9('0x36')]=qs[_0x85f9('0x2e')](_[_0x85f9('0x37')](_0x548ba2[_0x85f9('0x2c')],_0x31ae6f[_0x85f9('0x2e')]),_0x30f527);if(_0x548ba2['query'][_0x85f9('0x38')]){_0x42b063['where']=_[_0x85f9('0x39')](_0x42b063[_0x85f9('0x36')],{'$or':_[_0x85f9('0x3a')](_0x30f527,function(_0x19fefd){if(_0x19fefd[_0x85f9('0x2b')]!=='VIRTUAL'){var _0x291e6f={};_0x291e6f[_0x19fefd[_0x85f9('0x28')]]={'$like':'%'+_0x548ba2['query'][_0x85f9('0x38')]+'%'};return _0x291e6f;}})});}_0x42b063=_[_0x85f9('0x39')]({},_0x42b063,_0x548ba2[_0x85f9('0x3b')]);var _0x392a3c={'where':_0x42b063[_0x85f9('0x36')]};return db['SquareOdbc'][_0x85f9('0x1b')](_0x392a3c)[_0x85f9('0x21')](function(_0x292cdf){_0x5e5ac5['count']=_0x292cdf;if(_0x548ba2[_0x85f9('0x2c')]['includeAll']){_0x42b063[_0x85f9('0x3c')]=[{'all':!![]}];}return db[_0x85f9('0x2a')][_0x85f9('0x3d')](_0x42b063);})[_0x85f9('0x21')](function(_0x18fd06){_0x5e5ac5[_0x85f9('0x3e')]=_0x18fd06;return _0x5e5ac5;})[_0x85f9('0x21')](respondWithFilteredResult(_0x22c763,_0x42b063))[_0x85f9('0x3f')](handleError(_0x22c763,null));};exports[_0x85f9('0x40')]=function(_0x63c0a0,_0x2f7654){var _0x3b7c34={'raw':!![],'where':{'id':_0x63c0a0[_0x85f9('0x41')]['id']}},_0x180e35={};_0x180e35[_0x85f9('0x30')]=_[_0x85f9('0x2d')](db[_0x85f9('0x2a')][_0x85f9('0x42')]);_0x180e35['query']=_[_0x85f9('0x2d')](_0x63c0a0[_0x85f9('0x2c')]);_0x180e35[_0x85f9('0x2e')]=_['intersection'](_0x180e35[_0x85f9('0x30')],_0x180e35[_0x85f9('0x2c')]);_0x3b7c34[_0x85f9('0x31')]=_[_0x85f9('0x2f')](_0x180e35[_0x85f9('0x30')],qs[_0x85f9('0x32')](_0x63c0a0[_0x85f9('0x2c')][_0x85f9('0x32')]));_0x3b7c34['attributes']=_0x3b7c34[_0x85f9('0x31')][_0x85f9('0x43')]?_0x3b7c34[_0x85f9('0x31')]:_0x180e35[_0x85f9('0x30')];if(_0x63c0a0[_0x85f9('0x2c')][_0x85f9('0x44')]){_0x3b7c34[_0x85f9('0x3c')]=[{'all':!![]}];}_0x3b7c34=_[_0x85f9('0x39')]({},_0x3b7c34,_0x63c0a0[_0x85f9('0x3b')]);return db[_0x85f9('0x2a')]['find'](_0x3b7c34)['then'](handleEntityNotFound(_0x2f7654,null))[_0x85f9('0x21')](respondWithResult(_0x2f7654,null))[_0x85f9('0x3f')](handleError(_0x2f7654,null));};exports['create']=function(_0x12614d,_0x16e07f){return db[_0x85f9('0x2a')][_0x85f9('0x45')](_0x12614d[_0x85f9('0x46')],{})[_0x85f9('0x21')](function(_0x100242){var _0x2f9955=_0x12614d[_0x85f9('0x47')][_0x85f9('0x22')]({'plain':!![]});if(!_0x2f9955)throw new Error(_0x85f9('0x48'));if(_0x2f9955['role']===_0x85f9('0x47')){var _0x6075b4=_0x100242[_0x85f9('0x22')]({'plain':!![]});var _0x391522=_0x85f9('0x23');return db[_0x85f9('0x49')][_0x85f9('0x4a')]({'where':{'name':_0x391522,'userProfileId':_0x2f9955[_0x85f9('0x4b')]},'raw':!![]})[_0x85f9('0x21')](function(_0x4963be){if(_0x4963be&&_0x4963be[_0x85f9('0x4c')]===0x0){return db[_0x85f9('0x4d')]['create']({'name':_0x6075b4[_0x85f9('0x28')],'resourceId':_0x6075b4['id'],'type':_0x4963be[_0x85f9('0x28')],'sectionId':_0x4963be['id']},{})['then'](function(){return _0x100242;});}else{return _0x100242;}})[_0x85f9('0x3f')](function(_0x564849){logger[_0x85f9('0x4e')](_0x85f9('0x4f'),_0x564849);throw _0x564849;});}return _0x100242;})[_0x85f9('0x21')](respondWithResult(_0x16e07f,0xc9))[_0x85f9('0x3f')](handleError(_0x16e07f,null));};exports[_0x85f9('0x50')]=function(_0x6ccbe4,_0x53fb7a){if(_0x6ccbe4[_0x85f9('0x46')]['id']){delete _0x6ccbe4[_0x85f9('0x46')]['id'];}return db[_0x85f9('0x2a')][_0x85f9('0x4a')]({'where':{'id':_0x6ccbe4[_0x85f9('0x41')]['id']}})[_0x85f9('0x21')](handleEntityNotFound(_0x53fb7a,null))[_0x85f9('0x21')](saveUpdates(_0x6ccbe4[_0x85f9('0x46')],null))['then'](respondWithResult(_0x53fb7a,null))[_0x85f9('0x3f')](handleError(_0x53fb7a,null));};exports[_0x85f9('0x24')]=function(_0x3ffc06,_0x404358){return db['SquareOdbc'][_0x85f9('0x4a')]({'where':{'id':_0x3ffc06[_0x85f9('0x41')]['id']}})[_0x85f9('0x21')](handleEntityNotFound(_0x404358,null))['then'](removeEntity(_0x404358,null))['catch'](handleError(_0x404358,null));};exports['test']=function(_0x5827c0,_0x5bac4e,_0x1692b7){var _0x21d135;return db[_0x85f9('0x2a')]['find']({'where':{'id':_0x5827c0[_0x85f9('0x41')]['id']},'attributes':['id',_0x85f9('0x51')]})[_0x85f9('0x21')](handleEntityNotFound(_0x5bac4e,null))[_0x85f9('0x21')](function(_0x57e329){if(_0x57e329){var _0x549c14=require(_0x85f9('0x52'))();_0x549c14[_0x85f9('0x53')](_0x57e329[_0x85f9('0x51')]);_0x549c14[_0x85f9('0x54')]();return _0x57e329;}})[_0x85f9('0x21')](respondWithResult(_0x5bac4e,null))['catch'](handleError(_0x5bac4e,null));}; \ No newline at end of file +var _0xebcc=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','ODBC','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','keys','options','find','create','body','get','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir'];(function(_0x2da765,_0x4ff68a){var _0x4ba661=function(_0x202217){while(--_0x202217){_0x2da765['push'](_0x2da765['shift']());}};_0x4ba661(++_0x4ff68a);}(_0xebcc,0x161));var _0xcebc=function(_0x2b12a8,_0x52f321){_0x2b12a8=_0x2b12a8-0x0;var _0xd38ecc=_0xebcc[_0x2b12a8];return _0xd38ecc;};'use strict';var emlformat=require(_0xcebc('0x0'));var rimraf=require(_0xcebc('0x1'));var zipdir=require(_0xcebc('0x2'));var jsonpatch=require(_0xcebc('0x3'));var rp=require(_0xcebc('0x4'));var moment=require(_0xcebc('0x5'));var BPromise=require(_0xcebc('0x6'));var Mustache=require(_0xcebc('0x7'));var util=require('util');var path=require('path');var sox=require(_0xcebc('0x8'));var csv=require('to-csv');var ejs=require(_0xcebc('0x9'));var fs=require('fs');var fs_extra=require(_0xcebc('0xa'));var _=require(_0xcebc('0xb'));var squel=require(_0xcebc('0xc'));var crypto=require(_0xcebc('0xd'));var jsforce=require(_0xcebc('0xe'));var deskjs=require(_0xcebc('0xf'));var toCsv=require(_0xcebc('0x10'));var querystring=require('querystring');var Papa=require(_0xcebc('0x11'));var Redis=require(_0xcebc('0x12'));var authService=require(_0xcebc('0x13'));var qs=require(_0xcebc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcebc('0x15'));var logger=require(_0xcebc('0x16'))(_0xcebc('0x17'));var utils=require('../../config/utils');var config=require(_0xcebc('0x18'));var licenseUtil=require(_0xcebc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc110b5,_0x4f15ca){_0x4f15ca=_0x4f15ca||0xcc;return function(_0x2d20a2){if(_0x2d20a2){return _0xc110b5['sendStatus'](_0x4f15ca);}return _0xc110b5[_0xcebc('0x1a')](_0x4f15ca)[_0xcebc('0x1b')]();};}function respondWithResult(_0x3b3d3a,_0x2db149){_0x2db149=_0x2db149||0xc8;return function(_0x2efce4){if(_0x2efce4){return _0x3b3d3a[_0xcebc('0x1a')](_0x2db149)[_0xcebc('0x1c')](_0x2efce4);}};}function respondWithFilteredResult(_0x259403,_0x545279){return function(_0x5a7627){if(_0x5a7627){var _0x24e388=typeof _0x545279[_0xcebc('0x1d')]===_0xcebc('0x1e')&&typeof _0x545279[_0xcebc('0x1f')]==='undefined';var _0x4278db=_0x5a7627[_0xcebc('0x20')];var _0xce210a=_0x24e388?0x0:_0x545279[_0xcebc('0x1d')];var _0x588c72=_0x24e388?_0x5a7627['count']:_0x545279[_0xcebc('0x1d')]+_0x545279[_0xcebc('0x1f')];var _0x29d258;if(_0x588c72>=_0x4278db){_0x588c72=_0x4278db;_0x29d258=0xc8;}else{_0x29d258=0xce;}_0x259403[_0xcebc('0x1a')](_0x29d258);return _0x259403[_0xcebc('0x21')]('Content-Range',_0xce210a+'-'+_0x588c72+'/'+_0x4278db)[_0xcebc('0x1c')](_0x5a7627);}return null;};}function patchUpdates(_0x51b09b){return function(_0x5eb895){try{jsonpatch[_0xcebc('0x22')](_0x5eb895,_0x51b09b,!![]);}catch(_0x44893b){return BPromise[_0xcebc('0x23')](_0x44893b);}return _0x5eb895[_0xcebc('0x24')]();};}function saveUpdates(_0x5280f0,_0x47a1e9){return function(_0x59478c){if(_0x59478c){return _0x59478c[_0xcebc('0x25')](_0x5280f0)[_0xcebc('0x26')](function(_0x4106bc){return _0x4106bc;});}return null;};}function removeEntity(_0x48ff8e,_0x3c1820){return function(_0x616cc2){if(_0x616cc2){return _0x616cc2[_0xcebc('0x27')]()[_0xcebc('0x26')](function(){var _0x3dc5e0=_0x616cc2['get']({'plain':!![]});var _0x165223=_0xcebc('0x28');return db['UserProfileResource'][_0xcebc('0x27')]({'where':{'type':_0x165223,'resourceId':_0x3dc5e0['id']}})[_0xcebc('0x26')](function(){return _0x616cc2;});})[_0xcebc('0x26')](function(){_0x48ff8e['status'](0xcc)[_0xcebc('0x1b')]();});}};}function handleEntityNotFound(_0x4567d0,_0x1319e5){return function(_0x55f81b){if(!_0x55f81b){_0x4567d0[_0xcebc('0x29')](0x194);}return _0x55f81b;};}function handleError(_0x3bc289,_0x505aee){_0x505aee=_0x505aee||0x1f4;return function(_0x146ecb){logger[_0xcebc('0x2a')](_0x146ecb[_0xcebc('0x2b')]);if(_0x146ecb[_0xcebc('0x2c')]){delete _0x146ecb['name'];}_0x3bc289['status'](_0x505aee)[_0xcebc('0x2d')](_0x146ecb);};}exports[_0xcebc('0x2e')]=function(_0x148f72,_0x204f27){var _0x2bc808={},_0x5bdd5a={},_0x596852={'count':0x0,'rows':[]};var _0x35fe50=_[_0xcebc('0x2f')](db[_0xcebc('0x30')][_0xcebc('0x31')],function(_0x3c48c0){return{'name':_0x3c48c0[_0xcebc('0x32')],'type':_0x3c48c0[_0xcebc('0x33')]['key']};});_0x5bdd5a[_0xcebc('0x34')]=_[_0xcebc('0x2f')](_0x35fe50,_0xcebc('0x2c'));_0x5bdd5a[_0xcebc('0x35')]=_['keys'](_0x148f72[_0xcebc('0x35')]);_0x5bdd5a[_0xcebc('0x36')]=_[_0xcebc('0x37')](_0x5bdd5a[_0xcebc('0x34')],_0x5bdd5a[_0xcebc('0x35')]);_0x2bc808[_0xcebc('0x38')]=_['intersection'](_0x5bdd5a[_0xcebc('0x34')],qs[_0xcebc('0x39')](_0x148f72[_0xcebc('0x35')][_0xcebc('0x39')]));_0x2bc808[_0xcebc('0x38')]=_0x2bc808[_0xcebc('0x38')][_0xcebc('0x3a')]?_0x2bc808['attributes']:_0x5bdd5a[_0xcebc('0x34')];if(!_0x148f72['query'][_0xcebc('0x3b')]('nolimit')){_0x2bc808[_0xcebc('0x1f')]=qs[_0xcebc('0x1f')](_0x148f72['query'][_0xcebc('0x1f')]);_0x2bc808['offset']=qs[_0xcebc('0x1d')](_0x148f72[_0xcebc('0x35')][_0xcebc('0x1d')]);}_0x2bc808[_0xcebc('0x3c')]=qs[_0xcebc('0x3d')](_0x148f72[_0xcebc('0x35')]['sort']);_0x2bc808[_0xcebc('0x3e')]=qs[_0xcebc('0x36')](_[_0xcebc('0x3f')](_0x148f72[_0xcebc('0x35')],_0x5bdd5a[_0xcebc('0x36')]),_0x35fe50);if(_0x148f72['query']['filter']){_0x2bc808[_0xcebc('0x3e')]=_['merge'](_0x2bc808[_0xcebc('0x3e')],{'$or':_['map'](_0x35fe50,function(_0x208757){if(_0x208757[_0xcebc('0x33')]!=='VIRTUAL'){var _0x380a81={};_0x380a81[_0x208757['name']]={'$like':'%'+_0x148f72[_0xcebc('0x35')][_0xcebc('0x40')]+'%'};return _0x380a81;}})});}_0x2bc808=_[_0xcebc('0x41')]({},_0x2bc808,_0x148f72['options']);var _0x26c6e9={'where':_0x2bc808[_0xcebc('0x3e')]};return db[_0xcebc('0x30')][_0xcebc('0x20')](_0x26c6e9)[_0xcebc('0x26')](function(_0x54c071){_0x596852[_0xcebc('0x20')]=_0x54c071;if(_0x148f72[_0xcebc('0x35')][_0xcebc('0x42')]){_0x2bc808[_0xcebc('0x43')]=[{'all':!![]}];}return db[_0xcebc('0x30')]['findAll'](_0x2bc808);})['then'](function(_0x54595d){_0x596852[_0xcebc('0x44')]=_0x54595d;return _0x596852;})[_0xcebc('0x26')](respondWithFilteredResult(_0x204f27,_0x2bc808))[_0xcebc('0x45')](handleError(_0x204f27,null));};exports[_0xcebc('0x46')]=function(_0x33569b,_0x4cba64){var _0x511ad2={'raw':!![],'where':{'id':_0x33569b[_0xcebc('0x47')]['id']}},_0x421de1={};_0x421de1['model']=_[_0xcebc('0x48')](db[_0xcebc('0x30')]['rawAttributes']);_0x421de1[_0xcebc('0x35')]=_[_0xcebc('0x48')](_0x33569b[_0xcebc('0x35')]);_0x421de1['filters']=_[_0xcebc('0x37')](_0x421de1[_0xcebc('0x34')],_0x421de1[_0xcebc('0x35')]);_0x511ad2[_0xcebc('0x38')]=_[_0xcebc('0x37')](_0x421de1[_0xcebc('0x34')],qs[_0xcebc('0x39')](_0x33569b[_0xcebc('0x35')][_0xcebc('0x39')]));_0x511ad2[_0xcebc('0x38')]=_0x511ad2[_0xcebc('0x38')]['length']?_0x511ad2[_0xcebc('0x38')]:_0x421de1[_0xcebc('0x34')];if(_0x33569b[_0xcebc('0x35')]['includeAll']){_0x511ad2[_0xcebc('0x43')]=[{'all':!![]}];}_0x511ad2=_[_0xcebc('0x41')]({},_0x511ad2,_0x33569b[_0xcebc('0x49')]);return db[_0xcebc('0x30')][_0xcebc('0x4a')](_0x511ad2)[_0xcebc('0x26')](handleEntityNotFound(_0x4cba64,null))[_0xcebc('0x26')](respondWithResult(_0x4cba64,null))[_0xcebc('0x45')](handleError(_0x4cba64,null));};exports[_0xcebc('0x4b')]=function(_0x16d74e,_0x16f611){return db[_0xcebc('0x30')][_0xcebc('0x4b')](_0x16d74e[_0xcebc('0x4c')],{})[_0xcebc('0x26')](function(_0x126bcf){var _0x496a46=_0x16d74e['user'][_0xcebc('0x4d')]({'plain':!![]});if(!_0x496a46)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x496a46[_0xcebc('0x4e')]===_0xcebc('0x4f')){var _0x372c55=_0x126bcf[_0xcebc('0x4d')]({'plain':!![]});var _0x50885f='ODBC';return db['UserProfileSection'][_0xcebc('0x4a')]({'where':{'name':_0x50885f,'userProfileId':_0x496a46[_0xcebc('0x50')]},'raw':!![]})[_0xcebc('0x26')](function(_0x1ab293){if(_0x1ab293&&_0x1ab293[_0xcebc('0x51')]===0x0){return db[_0xcebc('0x52')][_0xcebc('0x4b')]({'name':_0x372c55[_0xcebc('0x2c')],'resourceId':_0x372c55['id'],'type':_0x1ab293['name'],'sectionId':_0x1ab293['id']},{})[_0xcebc('0x26')](function(){return _0x126bcf;});}else{return _0x126bcf;}})[_0xcebc('0x45')](function(_0xb191ff){logger[_0xcebc('0x2a')](_0xcebc('0x53'),_0xb191ff);throw _0xb191ff;});}return _0x126bcf;})[_0xcebc('0x26')](respondWithResult(_0x16f611,0xc9))['catch'](handleError(_0x16f611,null));};exports[_0xcebc('0x25')]=function(_0x51da65,_0x244f25){if(_0x51da65[_0xcebc('0x4c')]['id']){delete _0x51da65[_0xcebc('0x4c')]['id'];}return db[_0xcebc('0x30')][_0xcebc('0x4a')]({'where':{'id':_0x51da65[_0xcebc('0x47')]['id']}})[_0xcebc('0x26')](handleEntityNotFound(_0x244f25,null))[_0xcebc('0x26')](saveUpdates(_0x51da65[_0xcebc('0x4c')],null))[_0xcebc('0x26')](respondWithResult(_0x244f25,null))[_0xcebc('0x45')](handleError(_0x244f25,null));};exports[_0xcebc('0x27')]=function(_0x3847ee,_0x52ff13){return db[_0xcebc('0x30')][_0xcebc('0x4a')]({'where':{'id':_0x3847ee[_0xcebc('0x47')]['id']}})['then'](handleEntityNotFound(_0x52ff13,null))['then'](removeEntity(_0x52ff13,null))[_0xcebc('0x45')](handleError(_0x52ff13,null));};exports[_0xcebc('0x54')]=function(_0x19b905,_0x633050,_0x161d12){var _0x4076df;return db[_0xcebc('0x30')]['find']({'where':{'id':_0x19b905[_0xcebc('0x47')]['id']},'attributes':['id',_0xcebc('0x55')]})[_0xcebc('0x26')](handleEntityNotFound(_0x633050,null))[_0xcebc('0x26')](function(_0x3d98a5){if(_0x3d98a5){var _0x4cc7b1=require(_0xcebc('0x56'))();_0x4cc7b1[_0xcebc('0x57')](_0x3d98a5[_0xcebc('0x55')]);_0x4cc7b1[_0xcebc('0x58')]();return _0x3d98a5;}})[_0xcebc('0x26')](respondWithResult(_0x633050,null))[_0xcebc('0x45')](handleError(_0x633050,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 23c2cb6..5d9f2ab 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 _0x62e9=['bluebird','rimraf','exports','define','SquareOdbc','lodash','util','api','moment'];(function(_0x293fbe,_0x1156da){var _0x46e96e=function(_0x13e7f9){while(--_0x13e7f9){_0x293fbe['push'](_0x293fbe['shift']());}};_0x46e96e(++_0x1156da);}(_0x62e9,0x176));var _0x962e=function(_0x1648d7,_0x1a877f){_0x1648d7=_0x1648d7-0x0;var _0x8c6c7f=_0x62e9[_0x1648d7];return _0x8c6c7f;};'use strict';var _=require(_0x962e('0x0'));var util=require(_0x962e('0x1'));var logger=require('../../config/logger')(_0x962e('0x2'));var moment=require(_0x962e('0x3'));var BPromise=require(_0x962e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x962e('0x5'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x962e('0x6')]=function(_0x8c344c,_0x12ff37){return _0x8c344c[_0x962e('0x7')](_0x962e('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafe6=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x3d34fc,_0x19448a){var _0x35a98c=function(_0x34b179){while(--_0x34b179){_0x3d34fc['push'](_0x3d34fc['shift']());}};_0x35a98c(++_0x19448a);}(_0xafe6,0x1e1));var _0x6afe=function(_0x35186c,_0x1eb946){_0x35186c=_0x35186c-0x0;var _0xd11ecb=_0xafe6[_0x35186c];return _0xd11ecb;};'use strict';var _=require(_0x6afe('0x0'));var util=require(_0x6afe('0x1'));var logger=require(_0x6afe('0x2'))('api');var moment=require(_0x6afe('0x3'));var BPromise=require(_0x6afe('0x4'));var rp=require(_0x6afe('0x5'));var fs=require('fs');var path=require(_0x6afe('0x6'));var rimraf=require(_0x6afe('0x7'));var config=require(_0x6afe('0x8'));var attributes=require(_0x6afe('0x9'));module[_0x6afe('0xa')]=function(_0x3ad20b,_0x11c32b){return _0x3ad20b[_0x6afe('0xb')](_0x6afe('0xc'),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 478ac37..21f67eb 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 _0xb753=['message','SquareOdbc','find','options','raw','where','attributes','include','map','model','ShowSquareOdbc','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x11d8a4,_0x44f364){var _0x40e618=function(_0x1e015d){while(--_0x1e015d){_0x11d8a4['push'](_0x11d8a4['shift']());}};_0x40e618(++_0x44f364);}(_0xb753,0x1ac));var _0x3b75=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0xb753[_0x421eeb];return _0x2c7371;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3b75('0x0'));var BPromise=require(_0x3b75('0x1'));var rs=require(_0x3b75('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b75('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b75('0x4'))(_0x3b75('0x5'));var config=require(_0x3b75('0x6'));var jayson=require(_0x3b75('0x7'));var client=jayson[_0x3b75('0x8')][_0x3b75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11b06c,_0x23c27c,_0x15ddb9){return new BPromise(function(_0x41cb8a,_0x5d447b){return client[_0x3b75('0xa')](_0x11b06c,_0x15ddb9)[_0x3b75('0xb')](function(_0x4c5c77){logger[_0x3b75('0xc')](_0x3b75('0xd'),_0x23c27c,_0x3b75('0xe'));logger[_0x3b75('0xf')](_0x3b75('0x10'),_0x23c27c,'request\x20sent',JSON[_0x3b75('0x11')](_0x4c5c77));if(_0x4c5c77['error']){if(_0x4c5c77[_0x3b75('0x12')][_0x3b75('0x13')]===0x1f4){logger[_0x3b75('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x23c27c,_0x4c5c77[_0x3b75('0x12')][_0x3b75('0x14')]);return _0x5d447b(_0x4c5c77[_0x3b75('0x12')][_0x3b75('0x14')]);}logger[_0x3b75('0x12')](_0x3b75('0xd'),_0x23c27c,_0x4c5c77[_0x3b75('0x12')]['message']);return _0x41cb8a(_0x4c5c77[_0x3b75('0x12')][_0x3b75('0x14')]);}else{logger[_0x3b75('0xc')](_0x3b75('0xd'),_0x23c27c,_0x3b75('0xe'));_0x41cb8a(_0x4c5c77['result'][_0x3b75('0x14')]);}})['catch'](function(_0x3f078f){logger[_0x3b75('0x12')](_0x3b75('0xd'),_0x23c27c,_0x3f078f);_0x5d447b(_0x3f078f);});});}exports['ShowSquareOdbc']=function(_0x3a726c){var _0x3b7e78=this;return new Promise(function(_0x1ba138,_0x10b743){return db[_0x3b75('0x15')][_0x3b75('0x16')]({'raw':_0x3a726c['options']?_0x3a726c[_0x3b75('0x17')][_0x3b75('0x18')]===undefined?!![]:![]:!![],'where':_0x3a726c['options']?_0x3a726c[_0x3b75('0x17')][_0x3b75('0x19')]||null:null,'attributes':_0x3a726c[_0x3b75('0x17')]?_0x3a726c['options'][_0x3b75('0x1a')]||null:null,'include':_0x3a726c[_0x3b75('0x17')]?_0x3a726c[_0x3b75('0x17')][_0x3b75('0x1b')]?_[_0x3b75('0x1c')](_0x3a726c[_0x3b75('0x17')][_0x3b75('0x1b')],function(_0x3e42eb){return{'model':db[_0x3e42eb[_0x3b75('0x1d')]],'as':_0x3e42eb['as'],'attributes':_0x3e42eb[_0x3b75('0x1a')],'include':_0x3e42eb[_0x3b75('0x1b')]?_['map'](_0x3e42eb[_0x3b75('0x1b')],function(_0x1b1447){return{'model':db[_0x1b1447[_0x3b75('0x1d')]],'as':_0x1b1447['as'],'attributes':_0x1b1447[_0x3b75('0x1a')],'include':_0x1b1447[_0x3b75('0x1b')]?_[_0x3b75('0x1c')](_0x1b1447[_0x3b75('0x1b')],function(_0x1ad35a){return{'model':db[_0x1ad35a[_0x3b75('0x1d')]],'as':_0x1ad35a['as'],'attributes':_0x1ad35a[_0x3b75('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xaa00fc){logger[_0x3b75('0xc')](_0x3b75('0x1e'),_0x3a726c);logger[_0x3b75('0xf')](_0x3b75('0x1e'),_0x3a726c,JSON[_0x3b75('0x11')](_0xaa00fc));_0x1ba138(_0xaa00fc);})[_0x3b75('0x1f')](function(_0x1b3cdb){logger[_0x3b75('0x12')](_0x3b75('0x1e'),_0x1b3cdb[_0x3b75('0x14')],_0x3a726c);_0x10b743(_0x3b7e78[_0x3b75('0x12')](0x1f4,_0x1b3cdb[_0x3b75('0x14')]));});});}; \ No newline at end of file +var _0xbe96=['request\x20sent','error','message','info','result','catch','SquareOdbc','options','raw','where','include','attributes','model','map','ShowSquareOdbc','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','SquareOdbc,\x20%s,\x20%s','debug'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbe96,0x100));var _0x6be9=function(_0x4d9de3,_0x2c2856){_0x4d9de3=_0x4d9de3-0x0;var _0x6521db=_0xbe96[_0x4d9de3];return _0x6521db;};'use strict';var _=require(_0x6be9('0x0'));var util=require(_0x6be9('0x1'));var moment=require(_0x6be9('0x2'));var BPromise=require('bluebird');var rs=require(_0x6be9('0x3'));var fs=require('fs');var Redis=require(_0x6be9('0x4'));var db=require(_0x6be9('0x5'))['db'];var utils=require(_0x6be9('0x6'));var logger=require(_0x6be9('0x7'))(_0x6be9('0x8'));var config=require(_0x6be9('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xeadccb,_0x458b0e,_0x342373){return new BPromise(function(_0x417253,_0x191db2){return client[_0x6be9('0xa')](_0xeadccb,_0x342373)[_0x6be9('0xb')](function(_0xbcdece){logger['info'](_0x6be9('0xc'),_0x458b0e,'request\x20sent');logger[_0x6be9('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x458b0e,_0x6be9('0xe'),JSON['stringify'](_0xbcdece));if(_0xbcdece[_0x6be9('0xf')]){if(_0xbcdece[_0x6be9('0xf')]['code']===0x1f4){logger[_0x6be9('0xf')](_0x6be9('0xc'),_0x458b0e,_0xbcdece[_0x6be9('0xf')][_0x6be9('0x10')]);return _0x191db2(_0xbcdece[_0x6be9('0xf')]['message']);}logger[_0x6be9('0xf')](_0x6be9('0xc'),_0x458b0e,_0xbcdece[_0x6be9('0xf')][_0x6be9('0x10')]);return _0x417253(_0xbcdece[_0x6be9('0xf')][_0x6be9('0x10')]);}else{logger[_0x6be9('0x11')](_0x6be9('0xc'),_0x458b0e,_0x6be9('0xe'));_0x417253(_0xbcdece[_0x6be9('0x12')]['message']);}})[_0x6be9('0x13')](function(_0x194c6b){logger[_0x6be9('0xf')](_0x6be9('0xc'),_0x458b0e,_0x194c6b);_0x191db2(_0x194c6b);});});}exports['ShowSquareOdbc']=function(_0x42383c){var _0x3fc3f6=this;return new Promise(function(_0x3615ad,_0x589c60){return db[_0x6be9('0x14')]['find']({'raw':_0x42383c[_0x6be9('0x15')]?_0x42383c[_0x6be9('0x15')][_0x6be9('0x16')]===undefined?!![]:![]:!![],'where':_0x42383c['options']?_0x42383c[_0x6be9('0x15')][_0x6be9('0x17')]||null:null,'attributes':_0x42383c[_0x6be9('0x15')]?_0x42383c[_0x6be9('0x15')]['attributes']||null:null,'include':_0x42383c[_0x6be9('0x15')]?_0x42383c[_0x6be9('0x15')][_0x6be9('0x18')]?_['map'](_0x42383c['options']['include'],function(_0x3bc9a6){return{'model':db[_0x3bc9a6['model']],'as':_0x3bc9a6['as'],'attributes':_0x3bc9a6[_0x6be9('0x19')],'include':_0x3bc9a6['include']?_['map'](_0x3bc9a6[_0x6be9('0x18')],function(_0x4b3897){return{'model':db[_0x4b3897[_0x6be9('0x1a')]],'as':_0x4b3897['as'],'attributes':_0x4b3897[_0x6be9('0x19')],'include':_0x4b3897[_0x6be9('0x18')]?_[_0x6be9('0x1b')](_0x4b3897['include'],function(_0x3c682d){return{'model':db[_0x3c682d[_0x6be9('0x1a')]],'as':_0x3c682d['as'],'attributes':_0x3c682d[_0x6be9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6be9('0xb')](function(_0x2ec943){logger[_0x6be9('0x11')](_0x6be9('0x1c'),_0x42383c);logger['debug'](_0x6be9('0x1c'),_0x42383c,JSON[_0x6be9('0x1d')](_0x2ec943));_0x3615ad(_0x2ec943);})[_0x6be9('0x13')](function(_0x470ca1){logger[_0x6be9('0xf')](_0x6be9('0x1c'),_0x470ca1['message'],_0x42383c);_0x589c60(_0x3fc3f6[_0x6be9('0xf')](0x1f4,_0x470ca1['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3bcc7b3..4038f74 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 _0xce00=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','isAuthenticated','post','create'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xce00,0x1aa));var _0x0ce0=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0xce00[_0x45346d];return _0x5ce7ca;};'use strict';var multer=require(_0x0ce0('0x0'));var util=require('util');var path=require(_0x0ce0('0x1'));var timeout=require(_0x0ce0('0x2'));var express=require(_0x0ce0('0x3'));var router=express[_0x0ce0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0ce0('0x5'));var interaction=require(_0x0ce0('0x6'));var config=require(_0x0ce0('0x7'));var controller=require(_0x0ce0('0x8'));router[_0x0ce0('0x9')]('/',auth['isAuthenticated'](),controller[_0x0ce0('0xa')]);router[_0x0ce0('0x9')]('/:id',auth[_0x0ce0('0xb')](),controller['show']);router[_0x0ce0('0xc')]('/',auth[_0x0ce0('0xb')](),controller[_0x0ce0('0xd')]);router[_0x0ce0('0xe')](_0x0ce0('0xf'),auth[_0x0ce0('0xb')](),controller[_0x0ce0('0x10')]);router[_0x0ce0('0x11')](_0x0ce0('0xf'),auth[_0x0ce0('0xb')](),controller[_0x0ce0('0x12')]);module[_0x0ce0('0x13')]=router; \ No newline at end of file +var _0x85aa=['fs-extra','../../config/environment','./squareProject.controller','get','index','post','isAuthenticated','put','update','delete','util','connect-timeout','Router'];(function(_0x55cc1f,_0x2b9320){var _0xa828ba=function(_0x303c1d){while(--_0x303c1d){_0x55cc1f['push'](_0x55cc1f['shift']());}};_0xa828ba(++_0x2b9320);}(_0x85aa,0x183));var _0xa85a=function(_0x942a1b,_0x5edb0c){_0x942a1b=_0x942a1b-0x0;var _0x5dd4c6=_0x85aa[_0x942a1b];return _0x5dd4c6;};'use strict';var multer=require('multer');var util=require(_0xa85a('0x0'));var path=require('path');var timeout=require(_0xa85a('0x1'));var express=require('express');var router=express[_0xa85a('0x2')]();var fs_extra=require(_0xa85a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa85a('0x4'));var controller=require(_0xa85a('0x5'));router[_0xa85a('0x6')]('/',auth['isAuthenticated'](),controller[_0xa85a('0x7')]);router[_0xa85a('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa85a('0x8')]('/',auth[_0xa85a('0x9')](),controller['create']);router[_0xa85a('0xa')]('/:id',auth[_0xa85a('0x9')](),controller[_0xa85a('0xb')]);router[_0xa85a('0xc')]('/:id',auth[_0xa85a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0afed96..d23ec51 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 _0x3aed=['exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize'];(function(_0x1de1e3,_0x3423cb){var _0x24c026=function(_0x5c9be4){while(--_0x5c9be4){_0x1de1e3['push'](_0x1de1e3['shift']());}};_0x24c026(++_0x3423cb);}(_0x3aed,0x1c6));var _0xd3ae=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x3aed[_0x2aecb2];return _0x3ebb80;};'use strict';var Sequelize=require(_0xd3ae('0x0'));module[_0xd3ae('0x1')]={'name':{'type':Sequelize[_0xd3ae('0x2')],'unique':_0xd3ae('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd3ae('0x2')]},'notes':{'type':Sequelize[_0xd3ae('0x4')]},'preproduction':{'type':Sequelize[_0xd3ae('0x5')](_0xd3ae('0x6')),'get':function(){if(this[_0xd3ae('0x7')]('preproduction')){return this[_0xd3ae('0x7')](_0xd3ae('0x8'))[_0xd3ae('0x9')](_0xd3ae('0xa'));}}},'production':{'type':Sequelize[_0xd3ae('0x5')](_0xd3ae('0x6')),'get':function(){if(this[_0xd3ae('0x7')](_0xd3ae('0xb'))){return this[_0xd3ae('0x7')]('production')[_0xd3ae('0x9')](_0xd3ae('0xa'));}}},'savedAt':{'type':Sequelize[_0xd3ae('0xc')]},'publishedAt':{'type':Sequelize[_0xd3ae('0xc')]}}; \ No newline at end of file +var _0xfc8f=['preproduction','toString','production','utf8','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue'];(function(_0x5b9bec,_0xe50f7a){var _0xddbbc5=function(_0x162a45){while(--_0x162a45){_0x5b9bec['push'](_0x5b9bec['shift']());}};_0xddbbc5(++_0xe50f7a);}(_0xfc8f,0xa0));var _0xffc8=function(_0x43deea,_0x46e407){_0x43deea=_0x43deea-0x0;var _0x400e5d=_0xfc8f[_0x43deea];return _0x400e5d;};'use strict';var Sequelize=require(_0xffc8('0x0'));module[_0xffc8('0x1')]={'name':{'type':Sequelize[_0xffc8('0x2')],'unique':_0xffc8('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xffc8('0x4')]},'preproduction':{'type':Sequelize[_0xffc8('0x5')](_0xffc8('0x6')),'get':function(){if(this[_0xffc8('0x7')](_0xffc8('0x8'))){return this[_0xffc8('0x7')]('preproduction')[_0xffc8('0x9')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0xffc8('0x6')),'get':function(){if(this[_0xffc8('0x7')](_0xffc8('0xa'))){return this[_0xffc8('0x7')]('production')[_0xffc8('0x9')](_0xffc8('0xb'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index bf7a454..eae2608 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 _0x3566=['role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','SquareProjects','UserProfileResource','destroy','publish','agi','stringify','end','sendStatus','error','stack','name','index','map','SquareProject','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','where','includeAll','include','rows','catch','params','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x5af812,_0x43d252){var _0x1489f2=function(_0x1c7fa9){while(--_0x1c7fa9){_0x5af812['push'](_0x5af812['shift']());}};_0x1489f2(++_0x43d252);}(_0x3566,0x121));var _0x6356=function(_0x1b410e,_0x23eacd){_0x1b410e=_0x1b410e-0x0;var _0x3d63eb=_0x3566[_0x1b410e];return _0x3d63eb;};'use strict';var _=require(_0x6356('0x0'));var Redis=require('ioredis');var qs=require(_0x6356('0x1'));var logger=require(_0x6356('0x2'))('api');var config=require(_0x6356('0x3'));var db=require(_0x6356('0x4'))['db'];config[_0x6356('0x5')]=_[_0x6356('0x6')](config[_0x6356('0x5')],{'host':_0x6356('0x7'),'port':0x18eb});var socket=require(_0x6356('0x8'))(new Redis(config[_0x6356('0x5')]));require('./squareProject.socket')[_0x6356('0x9')](socket);function respondWithResult(_0x4cb700,_0x32d6bb){_0x32d6bb=_0x32d6bb||0xc8;return function(_0x4ccead){if(_0x4ccead){return _0x4cb700[_0x6356('0xa')](_0x32d6bb)[_0x6356('0xb')](_0x4ccead);}};}function respondWithFilteredResult(_0x4318e4,_0x4a03fa){return function(_0x39b367){if(_0x39b367){var _0xe3efb1=typeof _0x4a03fa[_0x6356('0xc')]===_0x6356('0xd')&&typeof _0x4a03fa[_0x6356('0xe')]==='undefined';var _0x1a51ab=_0x39b367['count'];var _0xbc11ba=_0xe3efb1?0x0:_0x4a03fa['offset'];var _0x237ca8=_0xe3efb1?_0x39b367[_0x6356('0xf')]:_0x4a03fa[_0x6356('0xc')]+_0x4a03fa['limit'];var _0x51800;if(_0x237ca8>=_0x1a51ab){_0x237ca8=_0x1a51ab;_0x51800=0xc8;}else{_0x51800=0xce;}_0x4318e4[_0x6356('0xa')](_0x51800);return _0x4318e4[_0x6356('0x10')](_0x6356('0x11'),_0xbc11ba+'-'+_0x237ca8+'/'+_0x1a51ab)[_0x6356('0xb')](_0x39b367);}return null;};}function saveUpdates(_0x2cf68c){return function(_0x27006a){if(_0x27006a){return _0x27006a[_0x6356('0x12')](_0x2cf68c)[_0x6356('0x13')](function(_0x51fd36){return _0x51fd36;});}return null;};}function removeEntity(_0x4b6082){return function(_0x532436){if(_0x532436){return _0x532436['destroy']()['then'](function(){var _0x2c8e89=_0x532436['get']({'plain':!![]});var _0x19c5d9=_0x6356('0x14');return db[_0x6356('0x15')][_0x6356('0x16')]({'where':{'type':_0x19c5d9,'resourceId':_0x2c8e89['id']}})['then'](function(){return _0x532436;});})[_0x6356('0x13')](function(){var _0x4f98c2=new Redis(config[_0x6356('0x5')]);_0x4f98c2[_0x6356('0x17')](_0x6356('0x18'),JSON[_0x6356('0x19')]({'id':_0x532436['id'],'deleted':!![]}));})['then'](function(){_0x4b6082[_0x6356('0xa')](0xcc)[_0x6356('0x1a')]();});}};}function handleEntityNotFound(_0xb3cd38){return function(_0x390a93){if(!_0x390a93){_0xb3cd38[_0x6356('0x1b')](0x194);}return _0x390a93;};}function handleError(_0x2c26a4,_0x5c2721){_0x5c2721=_0x5c2721||0x1f4;return function(_0xd5e5f2){logger[_0x6356('0x1c')](_0xd5e5f2[_0x6356('0x1d')]);if(_0xd5e5f2[_0x6356('0x1e')]){delete _0xd5e5f2[_0x6356('0x1e')];}_0x2c26a4['status'](_0x5c2721)['send'](_0xd5e5f2);};}exports[_0x6356('0x1f')]=function(_0x27cae2,_0x4ed516){var _0x22d546={},_0x367efa={},_0x290970={'count':0x0,'rows':[]};var _0x141c39=_[_0x6356('0x20')](db[_0x6356('0x21')][_0x6356('0x22')],function(_0xc33170){return{'name':_0xc33170['fieldName'],'type':_0xc33170[_0x6356('0x23')][_0x6356('0x24')]};});_0x367efa[_0x6356('0x25')]=_[_0x6356('0x20')](_0x141c39,_0x6356('0x1e'));_0x367efa['query']=_['keys'](_0x27cae2[_0x6356('0x26')]);_0x367efa[_0x6356('0x27')]=_[_0x6356('0x28')](_0x367efa['model'],_0x367efa[_0x6356('0x26')]);_0x22d546[_0x6356('0x29')]=_['intersection'](_0x367efa[_0x6356('0x25')],qs['fields'](_0x27cae2[_0x6356('0x26')][_0x6356('0x2a')]));_0x22d546['attributes']=_0x22d546[_0x6356('0x29')][_0x6356('0x2b')]?_0x22d546[_0x6356('0x29')]:_0x367efa[_0x6356('0x25')];if(!_0x27cae2[_0x6356('0x26')][_0x6356('0x2c')](_0x6356('0x2d'))){_0x22d546['limit']=qs[_0x6356('0xe')](_0x27cae2['query']['limit']);_0x22d546[_0x6356('0xc')]=qs[_0x6356('0xc')](_0x27cae2[_0x6356('0x26')]['offset']);}_0x22d546[_0x6356('0x2e')]=qs[_0x6356('0x2f')](_0x27cae2['query']['sort']);_0x22d546['where']=qs[_0x6356('0x27')](_[_0x6356('0x30')](_0x27cae2[_0x6356('0x26')],_0x367efa[_0x6356('0x27')]),_0x141c39);if(_0x27cae2['query']['filter']){_0x22d546['where']=_[_0x6356('0x31')](_0x22d546['where'],{'$or':_['map'](_0x141c39,function(_0x26c62a){if(_0x26c62a[_0x6356('0x23')]!==_0x6356('0x32')){var _0x49d92c={};_0x49d92c[_0x26c62a[_0x6356('0x1e')]]={'$like':'%'+_0x27cae2['query'][_0x6356('0x33')]+'%'};return _0x49d92c;}})});}_0x22d546=_['merge']({},_0x22d546,_0x27cae2['options']);var _0x4d832d={'where':_0x22d546[_0x6356('0x34')]};return db['SquareProject'][_0x6356('0xf')](_0x4d832d)[_0x6356('0x13')](function(_0x979c83){_0x290970[_0x6356('0xf')]=_0x979c83;if(_0x27cae2['query'][_0x6356('0x35')]){_0x22d546[_0x6356('0x36')]=[{'all':!![]}];}return db[_0x6356('0x21')]['findAll'](_0x22d546);})[_0x6356('0x13')](function(_0x474d43){_0x290970[_0x6356('0x37')]=_0x474d43;return _0x290970;})[_0x6356('0x13')](respondWithFilteredResult(_0x4ed516,_0x22d546))[_0x6356('0x38')](handleError(_0x4ed516,null));};exports['show']=function(_0x240952,_0x1c6b76){var _0x4b5fff={'raw':![],'where':{'id':_0x240952[_0x6356('0x39')]['id']}},_0x5181c6={};_0x5181c6[_0x6356('0x25')]=_[_0x6356('0x3a')](db['SquareProject']['rawAttributes']);_0x5181c6[_0x6356('0x26')]=_['keys'](_0x240952[_0x6356('0x26')]);_0x5181c6[_0x6356('0x27')]=_['intersection'](_0x5181c6[_0x6356('0x25')],_0x5181c6[_0x6356('0x26')]);_0x4b5fff['attributes']=_[_0x6356('0x28')](_0x5181c6[_0x6356('0x25')],qs[_0x6356('0x2a')](_0x240952[_0x6356('0x26')][_0x6356('0x2a')]));_0x4b5fff[_0x6356('0x29')]=_0x4b5fff[_0x6356('0x29')][_0x6356('0x2b')]?_0x4b5fff['attributes']:_0x5181c6[_0x6356('0x25')];if(_0x240952[_0x6356('0x26')][_0x6356('0x35')]){_0x4b5fff[_0x6356('0x36')]=[{'all':!![]}];}_0x4b5fff=_['merge']({},_0x4b5fff,_0x240952[_0x6356('0x3b')]);return db[_0x6356('0x21')][_0x6356('0x3c')](_0x4b5fff)[_0x6356('0x13')](handleEntityNotFound(_0x1c6b76,null))[_0x6356('0x13')](respondWithResult(_0x1c6b76,null))[_0x6356('0x38')](handleError(_0x1c6b76,null));};exports[_0x6356('0x3d')]=function(_0x54ec6b,_0x5c0d28){return db[_0x6356('0x21')][_0x6356('0x3d')](_0x54ec6b[_0x6356('0x3e')],{})['then'](function(_0x3aafe1){var _0x3a7b44=_0x54ec6b[_0x6356('0x3f')][_0x6356('0x40')]({'plain':!![]});if(!_0x3a7b44)throw new Error(_0x6356('0x41'));if(_0x3a7b44[_0x6356('0x42')]===_0x6356('0x3f')){var _0x1043d9=_0x3aafe1[_0x6356('0x40')]({'plain':!![]});var _0x82822=_0x6356('0x14');return db[_0x6356('0x43')][_0x6356('0x3c')]({'where':{'name':_0x82822,'userProfileId':_0x3a7b44[_0x6356('0x44')]},'raw':!![]})[_0x6356('0x13')](function(_0x1216c7){if(_0x1216c7&&_0x1216c7[_0x6356('0x45')]===0x0){return db[_0x6356('0x15')][_0x6356('0x3d')]({'name':_0x1043d9[_0x6356('0x1e')],'resourceId':_0x1043d9['id'],'type':_0x1216c7[_0x6356('0x1e')],'sectionId':_0x1216c7['id']},{})[_0x6356('0x13')](function(){return _0x3aafe1;});}else{return _0x3aafe1;}})['catch'](function(_0x395ddf){logger['error'](_0x6356('0x46'),_0x395ddf);throw _0x395ddf;});}return _0x3aafe1;})[_0x6356('0x13')](respondWithResult(_0x5c0d28,0xc9))['catch'](handleError(_0x5c0d28,null));};exports['update']=function(_0x5b4235,_0x149d9f){if(_0x5b4235[_0x6356('0x3e')]['id']){delete _0x5b4235[_0x6356('0x3e')]['id'];}return db[_0x6356('0x21')][_0x6356('0x3c')]({'where':{'id':_0x5b4235[_0x6356('0x39')]['id']}})[_0x6356('0x13')](handleEntityNotFound(_0x149d9f,null))[_0x6356('0x13')](saveUpdates(_0x5b4235[_0x6356('0x3e')],null))[_0x6356('0x13')](function(_0x4b59b1){if(!_0x4b59b1)return;var _0x13bcea=_0x4b59b1[_0x6356('0x40')]({'plain':!![]});return _0x13bcea;})[_0x6356('0x13')](function(_0x3d799d){var _0x529adb=new Redis(config[_0x6356('0x5')]);_0x529adb['publish'](_0x6356('0x18'),JSON[_0x6356('0x19')](_[_0x6356('0x30')](_0x3d799d,['id',_0x6356('0x1e'),'production'])));return _0x3d799d;})[_0x6356('0x13')](respondWithResult(_0x149d9f,null))[_0x6356('0x38')](handleError(_0x149d9f,null));};exports[_0x6356('0x16')]=function(_0x25ecbb,_0x361433){return db[_0x6356('0x21')]['find']({'where':{'id':_0x25ecbb[_0x6356('0x39')]['id']}})[_0x6356('0x13')](handleEntityNotFound(_0x361433,null))['then'](removeEntity(_0x361433,null))[_0x6356('0x38')](handleError(_0x361433,null));}; \ No newline at end of file +var _0x99b9=['agi','stringify','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','keys','includeAll','include','SquareProject','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','SquareProjects','UserProfileResource','publish'];(function(_0x4bcc35,_0x9ae5cc){var _0x260585=function(_0x354959){while(--_0x354959){_0x4bcc35['push'](_0x4bcc35['shift']());}};_0x260585(++_0x9ae5cc);}(_0x99b9,0x10b));var _0x999b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x99b9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x999b('0x0'));var Redis=require(_0x999b('0x1'));var qs=require(_0x999b('0x2'));var logger=require(_0x999b('0x3'))(_0x999b('0x4'));var config=require('../../config/environment');var db=require(_0x999b('0x5'))['db'];config[_0x999b('0x6')]=_[_0x999b('0x7')](config[_0x999b('0x6')],{'host':_0x999b('0x8'),'port':0x18eb});var socket=require(_0x999b('0x9'))(new Redis(config['redis']));require('./squareProject.socket')[_0x999b('0xa')](socket);function respondWithResult(_0x32d960,_0x1c3760){_0x1c3760=_0x1c3760||0xc8;return function(_0x437056){if(_0x437056){return _0x32d960[_0x999b('0xb')](_0x1c3760)['json'](_0x437056);}};}function respondWithFilteredResult(_0x199658,_0x28e39f){return function(_0x22966c){if(_0x22966c){var _0xc1e596=typeof _0x28e39f[_0x999b('0xc')]===_0x999b('0xd')&&typeof _0x28e39f[_0x999b('0xe')]===_0x999b('0xd');var _0x389f7e=_0x22966c[_0x999b('0xf')];var _0x253c35=_0xc1e596?0x0:_0x28e39f['offset'];var _0x5e2969=_0xc1e596?_0x22966c['count']:_0x28e39f[_0x999b('0xc')]+_0x28e39f['limit'];var _0x2a4fef;if(_0x5e2969>=_0x389f7e){_0x5e2969=_0x389f7e;_0x2a4fef=0xc8;}else{_0x2a4fef=0xce;}_0x199658[_0x999b('0xb')](_0x2a4fef);return _0x199658[_0x999b('0x10')](_0x999b('0x11'),_0x253c35+'-'+_0x5e2969+'/'+_0x389f7e)['json'](_0x22966c);}return null;};}function saveUpdates(_0x1be812){return function(_0x4d563c){if(_0x4d563c){return _0x4d563c[_0x999b('0x12')](_0x1be812)['then'](function(_0x4857f4){return _0x4857f4;});}return null;};}function removeEntity(_0x733454){return function(_0x3da052){if(_0x3da052){return _0x3da052[_0x999b('0x13')]()[_0x999b('0x14')](function(){var _0x4cfcb6=_0x3da052[_0x999b('0x15')]({'plain':!![]});var _0x35d825=_0x999b('0x16');return db[_0x999b('0x17')]['destroy']({'where':{'type':_0x35d825,'resourceId':_0x4cfcb6['id']}})[_0x999b('0x14')](function(){return _0x3da052;});})['then'](function(){var _0x1ddf72=new Redis(config['redis']);_0x1ddf72[_0x999b('0x18')](_0x999b('0x19'),JSON[_0x999b('0x1a')]({'id':_0x3da052['id'],'deleted':!![]}));})['then'](function(){_0x733454['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x341314){return function(_0x145536){if(!_0x145536){_0x341314[_0x999b('0x1b')](0x194);}return _0x145536;};}function handleError(_0x4c4b96,_0x5c55a6){_0x5c55a6=_0x5c55a6||0x1f4;return function(_0x531b8b){logger[_0x999b('0x1c')](_0x531b8b[_0x999b('0x1d')]);if(_0x531b8b[_0x999b('0x1e')]){delete _0x531b8b[_0x999b('0x1e')];}_0x4c4b96[_0x999b('0xb')](_0x5c55a6)[_0x999b('0x1f')](_0x531b8b);};}exports[_0x999b('0x20')]=function(_0xf6514d,_0x5f0897){var _0x2af927={},_0x194e85={},_0x5090cf={'count':0x0,'rows':[]};var _0x26acb3=_[_0x999b('0x21')](db['SquareProject'][_0x999b('0x22')],function(_0x50b271){return{'name':_0x50b271[_0x999b('0x23')],'type':_0x50b271[_0x999b('0x24')][_0x999b('0x25')]};});_0x194e85[_0x999b('0x26')]=_[_0x999b('0x21')](_0x26acb3,'name');_0x194e85[_0x999b('0x27')]=_['keys'](_0xf6514d[_0x999b('0x27')]);_0x194e85[_0x999b('0x28')]=_[_0x999b('0x29')](_0x194e85['model'],_0x194e85[_0x999b('0x27')]);_0x2af927[_0x999b('0x2a')]=_['intersection'](_0x194e85[_0x999b('0x26')],qs[_0x999b('0x2b')](_0xf6514d[_0x999b('0x27')]['fields']));_0x2af927[_0x999b('0x2a')]=_0x2af927['attributes'][_0x999b('0x2c')]?_0x2af927[_0x999b('0x2a')]:_0x194e85[_0x999b('0x26')];if(!_0xf6514d[_0x999b('0x27')][_0x999b('0x2d')](_0x999b('0x2e'))){_0x2af927[_0x999b('0xe')]=qs[_0x999b('0xe')](_0xf6514d['query'][_0x999b('0xe')]);_0x2af927[_0x999b('0xc')]=qs[_0x999b('0xc')](_0xf6514d['query'][_0x999b('0xc')]);}_0x2af927[_0x999b('0x2f')]=qs['sort'](_0xf6514d['query'][_0x999b('0x30')]);_0x2af927[_0x999b('0x31')]=qs[_0x999b('0x28')](_[_0x999b('0x32')](_0xf6514d[_0x999b('0x27')],_0x194e85['filters']),_0x26acb3);if(_0xf6514d[_0x999b('0x27')][_0x999b('0x33')]){_0x2af927[_0x999b('0x31')]=_[_0x999b('0x34')](_0x2af927[_0x999b('0x31')],{'$or':_[_0x999b('0x21')](_0x26acb3,function(_0x2c8747){if(_0x2c8747[_0x999b('0x24')]!==_0x999b('0x35')){var _0x39a223={};_0x39a223[_0x2c8747['name']]={'$like':'%'+_0xf6514d['query'][_0x999b('0x33')]+'%'};return _0x39a223;}})});}_0x2af927=_[_0x999b('0x34')]({},_0x2af927,_0xf6514d[_0x999b('0x36')]);var _0x49f30d={'where':_0x2af927[_0x999b('0x31')]};return db['SquareProject']['count'](_0x49f30d)[_0x999b('0x14')](function(_0x8d9fca){_0x5090cf[_0x999b('0xf')]=_0x8d9fca;if(_0xf6514d['query']['includeAll']){_0x2af927['include']=[{'all':!![]}];}return db['SquareProject'][_0x999b('0x37')](_0x2af927);})[_0x999b('0x14')](function(_0x14923f){_0x5090cf['rows']=_0x14923f;return _0x5090cf;})['then'](respondWithFilteredResult(_0x5f0897,_0x2af927))[_0x999b('0x38')](handleError(_0x5f0897,null));};exports[_0x999b('0x39')]=function(_0x49a958,_0x2d6b28){var _0x143cde={'raw':![],'where':{'id':_0x49a958[_0x999b('0x3a')]['id']}},_0x3e195f={};_0x3e195f[_0x999b('0x26')]=_[_0x999b('0x3b')](db['SquareProject'][_0x999b('0x22')]);_0x3e195f[_0x999b('0x27')]=_[_0x999b('0x3b')](_0x49a958[_0x999b('0x27')]);_0x3e195f[_0x999b('0x28')]=_[_0x999b('0x29')](_0x3e195f[_0x999b('0x26')],_0x3e195f['query']);_0x143cde['attributes']=_[_0x999b('0x29')](_0x3e195f['model'],qs[_0x999b('0x2b')](_0x49a958[_0x999b('0x27')][_0x999b('0x2b')]));_0x143cde['attributes']=_0x143cde[_0x999b('0x2a')][_0x999b('0x2c')]?_0x143cde['attributes']:_0x3e195f['model'];if(_0x49a958[_0x999b('0x27')][_0x999b('0x3c')]){_0x143cde[_0x999b('0x3d')]=[{'all':!![]}];}_0x143cde=_[_0x999b('0x34')]({},_0x143cde,_0x49a958[_0x999b('0x36')]);return db[_0x999b('0x3e')][_0x999b('0x3f')](_0x143cde)[_0x999b('0x14')](handleEntityNotFound(_0x2d6b28,null))[_0x999b('0x14')](respondWithResult(_0x2d6b28,null))[_0x999b('0x38')](handleError(_0x2d6b28,null));};exports[_0x999b('0x40')]=function(_0x4a9197,_0x5a27e3){return db['SquareProject']['create'](_0x4a9197[_0x999b('0x41')],{})['then'](function(_0x1a8f75){var _0x1e49ab=_0x4a9197[_0x999b('0x42')][_0x999b('0x15')]({'plain':!![]});if(!_0x1e49ab)throw new Error(_0x999b('0x43'));if(_0x1e49ab[_0x999b('0x44')]===_0x999b('0x42')){var _0x58e593=_0x1a8f75[_0x999b('0x15')]({'plain':!![]});var _0x56e2f1='SquareProjects';return db['UserProfileSection']['find']({'where':{'name':_0x56e2f1,'userProfileId':_0x1e49ab[_0x999b('0x45')]},'raw':!![]})['then'](function(_0x456502){if(_0x456502&&_0x456502[_0x999b('0x46')]===0x0){return db['UserProfileResource'][_0x999b('0x40')]({'name':_0x58e593[_0x999b('0x1e')],'resourceId':_0x58e593['id'],'type':_0x456502[_0x999b('0x1e')],'sectionId':_0x456502['id']},{})[_0x999b('0x14')](function(){return _0x1a8f75;});}else{return _0x1a8f75;}})[_0x999b('0x38')](function(_0xa76410){logger['error'](_0x999b('0x47'),_0xa76410);throw _0xa76410;});}return _0x1a8f75;})[_0x999b('0x14')](respondWithResult(_0x5a27e3,0xc9))[_0x999b('0x38')](handleError(_0x5a27e3,null));};exports[_0x999b('0x12')]=function(_0x407e12,_0x4f8111){if(_0x407e12['body']['id']){delete _0x407e12[_0x999b('0x41')]['id'];}return db['SquareProject'][_0x999b('0x3f')]({'where':{'id':_0x407e12[_0x999b('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4f8111,null))[_0x999b('0x14')](saveUpdates(_0x407e12['body'],null))[_0x999b('0x14')](function(_0x5068e8){if(!_0x5068e8)return;var _0x5aa95f=_0x5068e8[_0x999b('0x15')]({'plain':!![]});return _0x5aa95f;})[_0x999b('0x14')](function(_0x5d5ade){var _0x4afb2a=new Redis(config[_0x999b('0x6')]);_0x4afb2a[_0x999b('0x18')]('agi',JSON[_0x999b('0x1a')](_[_0x999b('0x32')](_0x5d5ade,['id','name',_0x999b('0x48')])));return _0x5d5ade;})[_0x999b('0x14')](respondWithResult(_0x4f8111,null))['catch'](handleError(_0x4f8111,null));};exports['destroy']=function(_0x2004f1,_0x5bf570){return db[_0x999b('0x3e')]['find']({'where':{'id':_0x2004f1['params']['id']}})[_0x999b('0x14')](handleEntityNotFound(_0x5bf570,null))[_0x999b('0x14')](removeEntity(_0x5bf570,null))[_0x999b('0x38')](handleError(_0x5bf570,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3e588d0..1435eb0 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 _0xaec1=['SquareProject','setMaxListeners','save','remove','hasOwnProperty','hook','../../mysqldb'];(function(_0x3edc39,_0x11c82d){var _0x2eec75=function(_0x588b11){while(--_0x588b11){_0x3edc39['push'](_0x3edc39['shift']());}};_0x2eec75(++_0x11c82d);}(_0xaec1,0x15d));var _0x1aec=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xaec1[_0xdea41a];return _0x15d0d8;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x1aec('0x0'))['db'][_0x1aec('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1aec('0x2')](0x0);var events={'afterCreate':_0x1aec('0x3'),'afterUpdate':'update','afterDestroy':_0x1aec('0x4')};function emitEvent(_0x4b7efd){return function(_0x1f27ba,_0x1c8295,_0x475c12){SquareProjectEvents['emit'](_0x4b7efd+':'+_0x1f27ba['id'],_0x1f27ba);SquareProjectEvents['emit'](_0x4b7efd,_0x1f27ba);_0x475c12(null);};}for(var e in events){if(events[_0x1aec('0x5')](e)){var event=events[e];SquareProject[_0x1aec('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x3ae7=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x51fc7,_0x2489c1){var _0x2d30bc=function(_0x4b3548){while(--_0x4b3548){_0x51fc7['push'](_0x51fc7['shift']());}};_0x2d30bc(++_0x2489c1);}(_0x3ae7,0x10f));var _0x73ae=function(_0x399bed,_0x52118a){_0x399bed=_0x399bed-0x0;var _0xb09571=_0x3ae7[_0x399bed];return _0xb09571;};'use strict';var EventEmitter=require(_0x73ae('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x73ae('0x1')](0x0);var events={'afterCreate':_0x73ae('0x2'),'afterUpdate':_0x73ae('0x3'),'afterDestroy':_0x73ae('0x4')};function emitEvent(_0x17f984){return function(_0x14f6ed,_0x3ef367,_0x14c42b){SquareProjectEvents[_0x73ae('0x5')](_0x17f984+':'+_0x14f6ed['id'],_0x14f6ed);SquareProjectEvents[_0x73ae('0x5')](_0x17f984,_0x14f6ed);_0x14c42b(null);};}for(var e in events){if(events[_0x73ae('0x6')](e)){var event=events[e];SquareProject[_0x73ae('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 4ee1beb..d97ef82 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 _0xce28=['production','publishedAt','format','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','preproduction','YYYY-MM-DD\x20HH:mm:ss','changed'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0xce28,0x1b3));var _0x8ce2=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xce28[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x8ce2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8ce2('0x1'));var moment=require(_0x8ce2('0x2'));var BPromise=require(_0x8ce2('0x3'));var rp=require(_0x8ce2('0x4'));var fs=require('fs');var path=require(_0x8ce2('0x5'));var rimraf=require(_0x8ce2('0x6'));var config=require(_0x8ce2('0x7'));var attributes=require(_0x8ce2('0x8'));module[_0x8ce2('0x9')]=function(_0x388c5a,_0x11a9f0){return _0x388c5a[_0x8ce2('0xa')](_0x8ce2('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11d662,_0x44c62a,_0x686fa8){if(_0x11d662['changed'](_0x8ce2('0xc'))){_0x11d662['savedAt']=moment()['format'](_0x8ce2('0xd'));}if(_0x11d662[_0x8ce2('0xe')](_0x8ce2('0xf'))){_0x11d662[_0x8ce2('0x10')]=moment()[_0x8ce2('0x11')](_0x8ce2('0xd'));}_0x686fa8(null,_0x11d662);}}});}; \ No newline at end of file +var _0xb39c=['SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','util','../../config/logger','api','request-promise','path','rimraf','./squareProject.attributes','exports','define'];(function(_0x4bb903,_0x6aca73){var _0x409d5f=function(_0x55e0de){while(--_0x55e0de){_0x4bb903['push'](_0x4bb903['shift']());}};_0x409d5f(++_0x6aca73);}(_0xb39c,0x127));var _0xcb39=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb39c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xcb39('0x0'));var logger=require(_0xcb39('0x1'))(_0xcb39('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcb39('0x3'));var fs=require('fs');var path=require(_0xcb39('0x4'));var rimraf=require(_0xcb39('0x5'));var config=require('../../config/environment');var attributes=require(_0xcb39('0x6'));module[_0xcb39('0x7')]=function(_0x2477f9,_0x3f244c){return _0x2477f9[_0xcb39('0x8')](_0xcb39('0x9'),attributes,{'tableName':_0xcb39('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2383bf,_0x538a60,_0x3cdd7e){if(_0x2383bf['changed'](_0xcb39('0xb'))){_0x2383bf[_0xcb39('0xc')]=moment()[_0xcb39('0xd')](_0xcb39('0xe'));}if(_0x2383bf[_0xcb39('0xf')]('production')){_0x2383bf['publishedAt']=moment()[_0xcb39('0xd')](_0xcb39('0xe'));}_0x3cdd7e(null,_0x2383bf);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 163d42a..29c5e4f 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 _0x7b9b=['SquareProject','stringify','lodash','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','findAll','raw','options','where','attributes','include','map','model','then','info','GetSquareProjects','debug','catch','error','message','ShowSquareProject'];(function(_0x1c9721,_0x3f83a4){var _0x5b1a4c=function(_0x44f048){while(--_0x44f048){_0x1c9721['push'](_0x1c9721['shift']());}};_0x5b1a4c(++_0x3f83a4);}(_0x7b9b,0x1bc));var _0xb7b9=function(_0x3093a4,_0x13d353){_0x3093a4=_0x3093a4-0x0;var _0x204931=_0x7b9b[_0x3093a4];return _0x204931;};'use strict';var _=require(_0xb7b9('0x0'));var Redis=require(_0xb7b9('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xb7b9('0x2'))(_0xb7b9('0x3'));var config=require(_0xb7b9('0x4'));config[_0xb7b9('0x5')]=_[_0xb7b9('0x6')](config[_0xb7b9('0x5')],{'host':_0xb7b9('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb7b9('0x5')]));require('./squareProject.socket')['register'](socket);exports['GetSquareProjects']=function(_0x188423){var _0x4b38ad=this;return new Promise(function(_0x388266,_0x5fc909){return db['SquareProject'][_0xb7b9('0x8')]({'raw':_0x188423['options']?_0x188423['options'][_0xb7b9('0x9')]===undefined?!![]:![]:!![],'where':_0x188423[_0xb7b9('0xa')]?_0x188423[_0xb7b9('0xa')][_0xb7b9('0xb')]||null:null,'attributes':_0x188423['options']?_0x188423[_0xb7b9('0xa')][_0xb7b9('0xc')]||null:null,'limit':_0x188423[_0xb7b9('0xa')]?_0x188423[_0xb7b9('0xa')]['limit']||null:null,'include':_0x188423['options']?_0x188423[_0xb7b9('0xa')][_0xb7b9('0xd')]?_[_0xb7b9('0xe')](_0x188423[_0xb7b9('0xa')]['include'],function(_0x126148){return{'model':db[_0x126148[_0xb7b9('0xf')]],'as':_0x126148['as'],'attributes':_0x126148['attributes'],'include':_0x126148[_0xb7b9('0xd')]?_['map'](_0x126148[_0xb7b9('0xd')],function(_0x287bdf){return{'model':db[_0x287bdf['model']],'as':_0x287bdf['as'],'attributes':_0x287bdf['attributes'],'include':_0x287bdf['include']?_[_0xb7b9('0xe')](_0x287bdf[_0xb7b9('0xd')],function(_0x228a75){return{'model':db[_0x228a75[_0xb7b9('0xf')]],'as':_0x228a75['as'],'attributes':_0x228a75[_0xb7b9('0xc')]};}):[]};}):[]};}):[]:[]})[_0xb7b9('0x10')](function(_0x546422){logger[_0xb7b9('0x11')](_0xb7b9('0x12'),_0x188423);logger[_0xb7b9('0x13')](_0xb7b9('0x12'),_0x188423,JSON['stringify'](_0x546422));_0x388266(_0x546422);})[_0xb7b9('0x14')](function(_0x51fd1c){logger[_0xb7b9('0x15')](_0xb7b9('0x12'),_0x51fd1c[_0xb7b9('0x16')],_0x188423);_0x5fc909(_0x4b38ad[_0xb7b9('0x15')](0x1f4,_0x51fd1c['message']));});});};exports[_0xb7b9('0x17')]=function(_0x3715bd){var _0x399a45=this;return new Promise(function(_0x40f0e3,_0xdfb28d){return db[_0xb7b9('0x18')]['find']({'raw':_0x3715bd[_0xb7b9('0xa')]?_0x3715bd[_0xb7b9('0xa')][_0xb7b9('0x9')]===undefined?!![]:![]:!![],'where':_0x3715bd[_0xb7b9('0xa')]?_0x3715bd[_0xb7b9('0xa')]['where']||null:null,'attributes':_0x3715bd['options']?_0x3715bd[_0xb7b9('0xa')][_0xb7b9('0xc')]||null:null,'include':_0x3715bd[_0xb7b9('0xa')]?_0x3715bd['options']['include']?_['map'](_0x3715bd[_0xb7b9('0xa')][_0xb7b9('0xd')],function(_0x5c6c60){return{'model':db[_0x5c6c60[_0xb7b9('0xf')]],'as':_0x5c6c60['as'],'attributes':_0x5c6c60[_0xb7b9('0xc')],'include':_0x5c6c60[_0xb7b9('0xd')]?_[_0xb7b9('0xe')](_0x5c6c60[_0xb7b9('0xd')],function(_0x49f874){return{'model':db[_0x49f874[_0xb7b9('0xf')]],'as':_0x49f874['as'],'attributes':_0x49f874[_0xb7b9('0xc')],'include':_0x49f874['include']?_[_0xb7b9('0xe')](_0x49f874[_0xb7b9('0xd')],function(_0x22b21d){return{'model':db[_0x22b21d[_0xb7b9('0xf')]],'as':_0x22b21d['as'],'attributes':_0x22b21d[_0xb7b9('0xc')]};}):[]};}):[]};}):[]:[]})[_0xb7b9('0x10')](function(_0x55b96b){logger[_0xb7b9('0x11')](_0xb7b9('0x17'),_0x3715bd);logger['debug'](_0xb7b9('0x17'),_0x3715bd,JSON[_0xb7b9('0x19')](_0x55b96b));_0x40f0e3(_0x55b96b);})[_0xb7b9('0x14')](function(_0x5bde9f){logger[_0xb7b9('0x15')](_0xb7b9('0x17'),_0x5bde9f[_0xb7b9('0x16')],_0x3715bd);_0xdfb28d(_0x399a45[_0xb7b9('0x15')](0x1f4,_0x5bde9f[_0xb7b9('0x16')]));});});}; \ No newline at end of file +var _0xf8fa=['SquareProject','options','raw','where','limit','include','map','model','attributes','info','debug','stringify','catch','error','message','find','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','register','GetSquareProjects'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xf8fa,0x170));var _0xaf8f=function(_0x209e98,_0x39cac6){_0x209e98=_0x209e98-0x0;var _0x3825a0=_0xf8fa[_0x209e98];return _0x3825a0;};'use strict';var _=require(_0xaf8f('0x0'));var Redis=require(_0xaf8f('0x1'));var db=require(_0xaf8f('0x2'))['db'];var logger=require(_0xaf8f('0x3'))('rpc');var config=require(_0xaf8f('0x4'));config[_0xaf8f('0x5')]=_[_0xaf8f('0x6')](config[_0xaf8f('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf8f('0x7'))(new Redis(config[_0xaf8f('0x5')]));require('./squareProject.socket')[_0xaf8f('0x8')](socket);exports[_0xaf8f('0x9')]=function(_0x3c87a7){var _0x34ae1d=this;return new Promise(function(_0x3ac4d8,_0x57f776){return db[_0xaf8f('0xa')]['findAll']({'raw':_0x3c87a7['options']?_0x3c87a7[_0xaf8f('0xb')][_0xaf8f('0xc')]===undefined?!![]:![]:!![],'where':_0x3c87a7[_0xaf8f('0xb')]?_0x3c87a7[_0xaf8f('0xb')][_0xaf8f('0xd')]||null:null,'attributes':_0x3c87a7[_0xaf8f('0xb')]?_0x3c87a7['options']['attributes']||null:null,'limit':_0x3c87a7[_0xaf8f('0xb')]?_0x3c87a7['options'][_0xaf8f('0xe')]||null:null,'include':_0x3c87a7[_0xaf8f('0xb')]?_0x3c87a7['options'][_0xaf8f('0xf')]?_[_0xaf8f('0x10')](_0x3c87a7[_0xaf8f('0xb')]['include'],function(_0x30e1bc){return{'model':db[_0x30e1bc[_0xaf8f('0x11')]],'as':_0x30e1bc['as'],'attributes':_0x30e1bc[_0xaf8f('0x12')],'include':_0x30e1bc['include']?_[_0xaf8f('0x10')](_0x30e1bc[_0xaf8f('0xf')],function(_0x226716){return{'model':db[_0x226716[_0xaf8f('0x11')]],'as':_0x226716['as'],'attributes':_0x226716[_0xaf8f('0x12')],'include':_0x226716[_0xaf8f('0xf')]?_[_0xaf8f('0x10')](_0x226716[_0xaf8f('0xf')],function(_0x16c8d5){return{'model':db[_0x16c8d5[_0xaf8f('0x11')]],'as':_0x16c8d5['as'],'attributes':_0x16c8d5[_0xaf8f('0x12')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x81693c){logger[_0xaf8f('0x13')](_0xaf8f('0x9'),_0x3c87a7);logger[_0xaf8f('0x14')]('GetSquareProjects',_0x3c87a7,JSON[_0xaf8f('0x15')](_0x81693c));_0x3ac4d8(_0x81693c);})[_0xaf8f('0x16')](function(_0x14caca){logger[_0xaf8f('0x17')]('GetSquareProjects',_0x14caca[_0xaf8f('0x18')],_0x3c87a7);_0x57f776(_0x34ae1d['error'](0x1f4,_0x14caca[_0xaf8f('0x18')]));});});};exports['ShowSquareProject']=function(_0x26932b){var _0x108c77=this;return new Promise(function(_0x6b1837,_0x159790){return db[_0xaf8f('0xa')][_0xaf8f('0x19')]({'raw':_0x26932b['options']?_0x26932b[_0xaf8f('0xb')][_0xaf8f('0xc')]===undefined?!![]:![]:!![],'where':_0x26932b[_0xaf8f('0xb')]?_0x26932b[_0xaf8f('0xb')]['where']||null:null,'attributes':_0x26932b[_0xaf8f('0xb')]?_0x26932b['options']['attributes']||null:null,'include':_0x26932b['options']?_0x26932b[_0xaf8f('0xb')][_0xaf8f('0xf')]?_[_0xaf8f('0x10')](_0x26932b[_0xaf8f('0xb')][_0xaf8f('0xf')],function(_0x17e71c){return{'model':db[_0x17e71c['model']],'as':_0x17e71c['as'],'attributes':_0x17e71c[_0xaf8f('0x12')],'include':_0x17e71c[_0xaf8f('0xf')]?_['map'](_0x17e71c['include'],function(_0xd17178){return{'model':db[_0xd17178['model']],'as':_0xd17178['as'],'attributes':_0xd17178[_0xaf8f('0x12')],'include':_0xd17178[_0xaf8f('0xf')]?_['map'](_0xd17178[_0xaf8f('0xf')],function(_0x353c33){return{'model':db[_0x353c33[_0xaf8f('0x11')]],'as':_0x353c33['as'],'attributes':_0x353c33[_0xaf8f('0x12')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37b501){logger[_0xaf8f('0x13')]('ShowSquareProject',_0x26932b);logger[_0xaf8f('0x14')]('ShowSquareProject',_0x26932b,JSON[_0xaf8f('0x15')](_0x37b501));_0x6b1837(_0x37b501);})[_0xaf8f('0x16')](function(_0x49d268){logger[_0xaf8f('0x17')](_0xaf8f('0x1a'),_0x49d268[_0xaf8f('0x18')],_0x26932b);_0x159790(_0x108c77[_0xaf8f('0x17')](0x1f4,_0x49d268['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d6e4f08..82c99ec 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 _0x9c56=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x57b27c,_0x84abfa){var _0xe0c87a=function(_0x238d19){while(--_0x238d19){_0x57b27c['push'](_0x57b27c['shift']());}};_0xe0c87a(++_0x84abfa);}(_0x9c56,0x149));var _0x69c5=function(_0xd466fb,_0x4e2e68){_0xd466fb=_0xd466fb-0x0;var _0x3d4d33=_0x9c56[_0xd466fb];return _0x3d4d33;};'use strict';var SquareProjectEvents=require(_0x69c5('0x0'));var events=[_0x69c5('0x1'),_0x69c5('0x2'),_0x69c5('0x3')];function createListener(_0x44835e,_0x25a557){return function(_0x38b3b4){_0x25a557[_0x69c5('0x4')](_0x44835e,_0x38b3b4);};}function removeListener(_0xc63e42,_0x453bbe){return function(){SquareProjectEvents[_0x69c5('0x5')](_0xc63e42,_0x453bbe);};}exports[_0x69c5('0x6')]=function(_0x747664){for(var _0x1c06c4=0x0,_0x1951aa=events['length'];_0x1c06c4<_0x1951aa;_0x1c06c4++){var _0x1f1dbf=events[_0x1c06c4];var _0x4dd3cb=createListener(_0x69c5('0x7')+_0x1f1dbf,_0x747664);SquareProjectEvents['on'](_0x1f1dbf,_0x4dd3cb);}}; \ No newline at end of file +var _0xea3f=['remove','emit','removeListener','register','./squareProject.events'];(function(_0x47ae01,_0x2dd0b0){var _0x15b3b7=function(_0x540ebc){while(--_0x540ebc){_0x47ae01['push'](_0x47ae01['shift']());}};_0x15b3b7(++_0x2dd0b0);}(_0xea3f,0x9f));var _0xfea3=function(_0x14102c,_0x1cb214){_0x14102c=_0x14102c-0x0;var _0x13297b=_0xea3f[_0x14102c];return _0x13297b;};'use strict';var SquareProjectEvents=require(_0xfea3('0x0'));var events=['save',_0xfea3('0x1'),'update'];function createListener(_0x49485e,_0x12ceb1){return function(_0x3d757c){_0x12ceb1[_0xfea3('0x2')](_0x49485e,_0x3d757c);};}function removeListener(_0x7927c9,_0xea7b70){return function(){SquareProjectEvents[_0xfea3('0x3')](_0x7927c9,_0xea7b70);};}exports[_0xfea3('0x4')]=function(_0x31e2e9){for(var _0x1ed663=0x0,_0xf977a0=events['length'];_0x1ed663<_0xf977a0;_0x1ed663++){var _0xf2c9b3=events[_0x1ed663];var _0x418c28=createListener('squareProject:'+_0xf2c9b3,_0x31e2e9);SquareProjectEvents['on'](_0xf2c9b3,_0x418c28);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 799c08f..f6c2569 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x58309f,_0x1a5e6e){var _0x4c83e0=function(_0x2cee91){while(--_0x2cee91){_0x58309f['push'](_0x58309f['shift']());}};_0x4c83e0(++_0x1a5e6e);}(_0x53ec,0x192));var _0xc53e=function(_0x5cdf3c,_0x233f63){_0x5cdf3c=_0x5cdf3c-0x0;var _0x515b20=_0x53ec[_0x5cdf3c];return _0x515b20;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _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(_0x443cdc,_0x1d1da7){var _0x13bd4b=function(_0x1f9a1b){while(--_0x1f9a1b){_0x443cdc['push'](_0x443cdc['shift']());}};_0x13bd4b(++_0x1d1da7);}(_0x326f,0xd1));var _0xf326=function(_0x5907be,_0x2b9df1){_0x5907be=_0x5907be-0x0;var _0x3c4f26=_0x326f[_0x5907be];return _0x3c4f26;};'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 6fab0c7..9fc559e 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 _0xda19=['getDataValue','exports','STRING','VIRTUAL'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0xda19,0xd5));var _0x9da1=function(_0x3aae26,_0x4f0e12){_0x3aae26=_0x3aae26-0x0;var _0x33610d=_0xda19[_0x3aae26];return _0x33610d;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'uniqueid':{'type':Sequelize[_0x9da1('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9da1('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9da1('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9da1('0x1')]},'dnid':{'type':Sequelize[_0x9da1('0x1')]},'projectName':{'type':Sequelize[_0x9da1('0x1')]},'saveName':{'type':Sequelize[_0x9da1('0x1')]},'filename':{'type':Sequelize[_0x9da1('0x1')]},'savePath':{'type':Sequelize[_0x9da1('0x1')]},'format':{'type':Sequelize[_0x9da1('0x2')],'get':function(){var _0x2c3cdd='';var _0x1c24e6=this[_0x9da1('0x3')]('savePath');if(_0x1c24e6){_0x2c3cdd=_0x1c24e6['substring'](_0x1c24e6['lastIndexOf']('.'));}return _0x2c3cdd;}}}; \ No newline at end of file +var _0x5d17=['getDataValue','savePath','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x2824e8,_0x40b6d5){var _0x20ea22=function(_0x25bc34){while(--_0x25bc34){_0x2824e8['push'](_0x2824e8['shift']());}};_0x20ea22(++_0x40b6d5);}(_0x5d17,0x114));var _0x75d1=function(_0x38045f,_0x551f77){_0x38045f=_0x38045f-0x0;var _0xfd4f8c=_0x5d17[_0x38045f];return _0xfd4f8c;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'extension':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'dnid':{'type':Sequelize[_0x75d1('0x2')]},'projectName':{'type':Sequelize[_0x75d1('0x2')]},'saveName':{'type':Sequelize[_0x75d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x75d1('0x2')]},'format':{'type':Sequelize[_0x75d1('0x3')],'get':function(){var _0x5c957a='';var _0x1ee61b=this[_0x75d1('0x4')](_0x75d1('0x5'));if(_0x1ee61b){_0x5c957a=_0x1ee61b[_0x75d1('0x6')](_0x1ee61b['lastIndexOf']('.'));}return _0x5c957a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 9870d5c..f3460a0 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 _0x088f=['.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareRecording','includeAll','include','findAll','rows','show','params','find','catch','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','unlink','message','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync'];(function(_0x21df92,_0x3e7d13){var _0x3a40e0=function(_0x1c8f9a){while(--_0x1c8f9a){_0x21df92['push'](_0x21df92['shift']());}};_0x3a40e0(++_0x3e7d13);}(_0x088f,0x185));var _0xf088=function(_0xc64fa7,_0x974362){_0xc64fa7=_0xc64fa7-0x0;var _0x4d0168=_0x088f[_0xc64fa7];return _0x4d0168;};'use strict';var emlformat=require(_0xf088('0x0'));var rimraf=require(_0xf088('0x1'));var zipdir=require(_0xf088('0x2'));var jsonpatch=require(_0xf088('0x3'));var rp=require('request-promise');var moment=require(_0xf088('0x4'));var BPromise=require(_0xf088('0x5'));var Mustache=require('mustache');var util=require(_0xf088('0x6'));var path=require(_0xf088('0x7'));var sox=require(_0xf088('0x8'));var csv=require(_0xf088('0x9'));var ejs=require(_0xf088('0xa'));var fs=require('fs');var fs_extra=require(_0xf088('0xb'));var _=require(_0xf088('0xc'));var squel=require(_0xf088('0xd'));var crypto=require(_0xf088('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf088('0xf'));var toCsv=require(_0xf088('0x9'));var querystring=require('querystring');var Papa=require(_0xf088('0x10'));var Redis=require(_0xf088('0x11'));var authService=require(_0xf088('0x12'));var qs=require(_0xf088('0x13'));var as=require(_0xf088('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf088('0x15'))(_0xf088('0x16'));var utils=require(_0xf088('0x17'));var config=require(_0xf088('0x18'));var licenseUtil=require(_0xf088('0x19'));var db=require(_0xf088('0x1a'))['db'];function respondWithStatusCode(_0x4a1d5b,_0x845b57){_0x845b57=_0x845b57||0xcc;return function(_0x481867){if(_0x481867){return _0x4a1d5b[_0xf088('0x1b')](_0x845b57);}return _0x4a1d5b[_0xf088('0x1c')](_0x845b57)['end']();};}function respondWithResult(_0x7a16d9,_0x4170d2){_0x4170d2=_0x4170d2||0xc8;return function(_0x4066e9){if(_0x4066e9){return _0x7a16d9[_0xf088('0x1c')](_0x4170d2)[_0xf088('0x1d')](_0x4066e9);}};}function respondWithFilteredResult(_0x7d84b3,_0x15f6f8){return function(_0x1dcbe1){if(_0x1dcbe1){var _0x561cf3=typeof _0x15f6f8[_0xf088('0x1e')]==='undefined'&&typeof _0x15f6f8[_0xf088('0x1f')]==='undefined';var _0x5bc653=_0x1dcbe1[_0xf088('0x20')];var _0x2c67ee=_0x561cf3?0x0:_0x15f6f8[_0xf088('0x1e')];var _0x3da8ee=_0x561cf3?_0x1dcbe1[_0xf088('0x20')]:_0x15f6f8[_0xf088('0x1e')]+_0x15f6f8['limit'];var _0x561a24;if(_0x3da8ee>=_0x5bc653){_0x3da8ee=_0x5bc653;_0x561a24=0xc8;}else{_0x561a24=0xce;}_0x7d84b3['status'](_0x561a24);return _0x7d84b3[_0xf088('0x21')](_0xf088('0x22'),_0x2c67ee+'-'+_0x3da8ee+'/'+_0x5bc653)[_0xf088('0x1d')](_0x1dcbe1);}return null;};}function patchUpdates(_0x1821a4){return function(_0x3fdcc6){try{jsonpatch[_0xf088('0x23')](_0x3fdcc6,_0x1821a4,!![]);}catch(_0x39ced0){return BPromise['reject'](_0x39ced0);}return _0x3fdcc6['save']();};}function saveUpdates(_0x15f999,_0x11c968){return function(_0x2a8bfa){if(_0x2a8bfa){return _0x2a8bfa[_0xf088('0x24')](_0x15f999)[_0xf088('0x25')](function(_0x1a4da3){return _0x1a4da3;});}return null;};}function removeEntity(_0x57e1cc,_0x43e6b1){return function(_0x46aa8c){if(_0x46aa8c){return _0x46aa8c[_0xf088('0x26')]()[_0xf088('0x25')](function(){_0x57e1cc[_0xf088('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3060a1,_0x1fdb83){return function(_0x1b09fc){if(!_0x1b09fc){_0x3060a1[_0xf088('0x1b')](0x194);}return _0x1b09fc;};}function handleError(_0x25657c,_0x1776fd){_0x1776fd=_0x1776fd||0x1f4;return function(_0x3a4900){logger[_0xf088('0x27')](_0x3a4900['stack']);if(_0x3a4900[_0xf088('0x28')]){delete _0x3a4900['name'];}_0x25657c[_0xf088('0x1c')](_0x1776fd)[_0xf088('0x29')](_0x3a4900);};}exports[_0xf088('0x2a')]=function(_0x37755c,_0x43a71c){var _0x339eb5={},_0x20bce3={},_0x23a4af={'count':0x0,'rows':[]};var _0x1628c3=_[_0xf088('0x2b')](db['SquareRecording'][_0xf088('0x2c')],function(_0x4cccaf){return{'name':_0x4cccaf[_0xf088('0x2d')],'type':_0x4cccaf[_0xf088('0x2e')][_0xf088('0x2f')]};});_0x20bce3['model']=_[_0xf088('0x2b')](_0x1628c3,_0xf088('0x28'));_0x20bce3[_0xf088('0x30')]=_[_0xf088('0x31')](_0x37755c[_0xf088('0x30')]);_0x20bce3[_0xf088('0x32')]=_[_0xf088('0x33')](_0x20bce3[_0xf088('0x34')],_0x20bce3[_0xf088('0x30')]);_0x339eb5[_0xf088('0x35')]=_[_0xf088('0x33')](_0x20bce3['model'],qs[_0xf088('0x36')](_0x37755c[_0xf088('0x30')][_0xf088('0x36')]));_0x339eb5[_0xf088('0x35')]=_0x339eb5[_0xf088('0x35')][_0xf088('0x37')]?_0x339eb5[_0xf088('0x35')]:_0x20bce3[_0xf088('0x34')];if(!_0x37755c['query']['hasOwnProperty'](_0xf088('0x38'))){_0x339eb5[_0xf088('0x1f')]=qs[_0xf088('0x1f')](_0x37755c[_0xf088('0x30')][_0xf088('0x1f')]);_0x339eb5[_0xf088('0x1e')]=qs[_0xf088('0x1e')](_0x37755c['query'][_0xf088('0x1e')]);}_0x339eb5[_0xf088('0x39')]=qs[_0xf088('0x3a')](_0x37755c[_0xf088('0x30')][_0xf088('0x3a')]);_0x339eb5[_0xf088('0x3b')]=qs['filters'](_[_0xf088('0x3c')](_0x37755c[_0xf088('0x30')],_0x20bce3[_0xf088('0x32')]),_0x1628c3);if(_0x37755c[_0xf088('0x30')][_0xf088('0x3d')]){_0x339eb5[_0xf088('0x3b')]=_['merge'](_0x339eb5[_0xf088('0x3b')],{'$or':_[_0xf088('0x2b')](_0x1628c3,function(_0x3dc90e){if(_0x3dc90e[_0xf088('0x2e')]!==_0xf088('0x3e')){var _0x3e09a7={};_0x3e09a7[_0x3dc90e[_0xf088('0x28')]]={'$like':'%'+_0x37755c[_0xf088('0x30')]['filter']+'%'};return _0x3e09a7;}})});}_0x339eb5=_[_0xf088('0x3f')]({},_0x339eb5,_0x37755c[_0xf088('0x40')]);var _0x84fc54={'where':_0x339eb5[_0xf088('0x3b')]};return db[_0xf088('0x41')][_0xf088('0x20')](_0x84fc54)['then'](function(_0x4abfd2){_0x23a4af['count']=_0x4abfd2;if(_0x37755c[_0xf088('0x30')][_0xf088('0x42')]){_0x339eb5[_0xf088('0x43')]=[{'all':!![]}];}return db['SquareRecording'][_0xf088('0x44')](_0x339eb5);})['then'](function(_0x177838){_0x23a4af[_0xf088('0x45')]=_0x177838;return _0x23a4af;})[_0xf088('0x25')](respondWithFilteredResult(_0x43a71c,_0x339eb5))['catch'](handleError(_0x43a71c,null));};exports[_0xf088('0x46')]=function(_0x30e79e,_0x3f1892){var _0x28e145={'raw':!![],'where':{'id':_0x30e79e[_0xf088('0x47')]['id']}},_0x35708c={};_0x35708c[_0xf088('0x34')]=_[_0xf088('0x31')](db[_0xf088('0x41')][_0xf088('0x2c')]);_0x35708c[_0xf088('0x30')]=_['keys'](_0x30e79e[_0xf088('0x30')]);_0x35708c[_0xf088('0x32')]=_[_0xf088('0x33')](_0x35708c[_0xf088('0x34')],_0x35708c['query']);_0x28e145[_0xf088('0x35')]=_['intersection'](_0x35708c['model'],qs['fields'](_0x30e79e[_0xf088('0x30')][_0xf088('0x36')]));_0x28e145['attributes']=_0x28e145[_0xf088('0x35')][_0xf088('0x37')]?_0x28e145[_0xf088('0x35')]:_0x35708c['model'];if(_0x30e79e[_0xf088('0x30')]['includeAll']){_0x28e145[_0xf088('0x43')]=[{'all':!![]}];}_0x28e145=_[_0xf088('0x3f')]({},_0x28e145,_0x30e79e['options']);return db[_0xf088('0x41')][_0xf088('0x48')](_0x28e145)[_0xf088('0x25')](handleEntityNotFound(_0x3f1892,null))[_0xf088('0x25')](respondWithResult(_0x3f1892,null))[_0xf088('0x49')](handleError(_0x3f1892,null));};exports[_0xf088('0x4a')]=function(_0x5c296a,_0x3a7dab){return db['SquareRecording'][_0xf088('0x4a')](_0x5c296a[_0xf088('0x4b')],{})[_0xf088('0x25')](respondWithResult(_0x3a7dab,0xc9))[_0xf088('0x49')](handleError(_0x3a7dab,null));};exports[_0xf088('0x24')]=function(_0x2e4de3,_0x5de993){if(_0x2e4de3[_0xf088('0x4b')]['id']){delete _0x2e4de3['body']['id'];}return db[_0xf088('0x41')][_0xf088('0x48')]({'where':{'id':_0x2e4de3[_0xf088('0x47')]['id']}})[_0xf088('0x25')](handleEntityNotFound(_0x5de993,null))['then'](saveUpdates(_0x2e4de3[_0xf088('0x4b')],null))[_0xf088('0x25')](respondWithResult(_0x5de993,null))[_0xf088('0x49')](handleError(_0x5de993,null));};exports[_0xf088('0x4c')]=function(_0x1da433,_0x489376,_0x2fbe90){var _0x5275be=require('../../components/encryptor');var _0x549701=![];var _0x1031ce={};if(_0x1da433[_0xf088('0x30')][_0xf088('0x2e')]&&_0x1da433[_0xf088('0x30')][_0xf088('0x2e')]===_0xf088('0x4d')){_0x1031ce[_0xf088('0x4d')]=_0x1da433[_0xf088('0x47')]['id'];}else{_0x1031ce['id']=_0x1da433[_0xf088('0x47')]['id'];}return db[_0xf088('0x41')][_0xf088('0x48')]({'where':_0x1031ce,'attributes':['id',_0xf088('0x4e'),_0xf088('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x489376,null))['then'](function(_0x314f1a){if(_0x314f1a){var _0x35aeec=_0x314f1a['savePath'];var _0x501442=util[_0xf088('0x50')](_0xf088('0x51'),_0x35aeec);if(fs[_0xf088('0x52')](_0x501442)){_0x549701=!![];return _0x5275be[_0xf088('0x53')](_0x501442,_0x35aeec,config[_0xf088('0x54')][_0xf088('0x55')])['then'](function(){return _0x314f1a;});}return _0x314f1a;}})[_0xf088('0x25')](function(_0x563cd8){if(_0x563cd8){var _0x2dc436=_0x563cd8[_0xf088('0x4e')];if(!fs[_0xf088('0x52')](_0x2dc436)){throw new db[(_0xf088('0x56'))]['ValidationError'](_0xf088('0x57'));}if(_0x563cd8[_0xf088('0x4f')]){return _0x489376[_0xf088('0x4c')](_0x2dc436,_0x563cd8[_0xf088('0x4f')]+path['extname'](_0x2dc436),function(){if(_0x549701){fs[_0xf088('0x58')](_0x2dc436);}});}else{return _0x489376['download'](_0x2dc436,function(_0x3cb082){if(_0x549701){fs[_0xf088('0x58')](_0x2dc436);}});}}})[_0xf088('0x49')](function(_0x4083e7){if(_0x4083e7[_0xf088('0x59')]==='SquareRecording\x20not\x20found'){_0x489376[_0xf088('0x1c')](0x194)[_0xf088('0x29')]('Not\x20found');}else{return handleError(_0x489376,null);}});};exports['destroy']=function(_0x2d8e28,_0x4959b6){return db[_0xf088('0x41')]['find']({'where':{'id':_0x2d8e28['params']['id']}})[_0xf088('0x25')](function(_0x16183f){if(_[_0xf088('0x5a')](_0x16183f)){throw new ReferenceError(_0xf088('0x5b'));}return _0x16183f;})[_0xf088('0x25')](function(_0x2935ad){var _0x1cc33f=_0x2935ad['savePath'];logger[_0xf088('0x5c')]('cancellazione\x20fisica\x20documento\x20%s',_0x1cc33f);if(!_['isNil'](_0x2935ad[_0xf088('0x4e')])&&fs['existsSync'](_0x1cc33f)){logger[_0xf088('0x5c')](_0xf088('0x5d')+_0x1cc33f+_0xf088('0x5e'));fs[_0xf088('0x5f')](_0x1cc33f);}_0x1cc33f=_0x1cc33f+_0xf088('0x60');if(!_[_0xf088('0x5a')](_0x2935ad[_0xf088('0x4e')])&&fs['existsSync'](_0x1cc33f)){logger[_0xf088('0x5c')](_0xf088('0x5d')+_0x1cc33f+_0xf088('0x5e'));fs[_0xf088('0x5f')](_0x1cc33f);}return _0x2935ad;})[_0xf088('0x25')](function(_0x13b5cb){if(!_0x13b5cb)throw new InternalError();return _0x13b5cb[_0xf088('0x26')]();})[_0xf088('0x25')](function(){_0x4959b6[_0xf088('0x1c')](0xcc)['end']();})[_0xf088('0x49')](handleError(_0x4959b6,null));}; \ No newline at end of file +var _0x8eaf=['length','find','body','params','../../components/encryptor','uniqueid','savePath','filename','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','SquareRecording','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','rows','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8eaf,0x1e5));var _0xf8ea=function(_0x5199af,_0x1eb67c){_0x5199af=_0x5199af-0x0;var _0x381974=_0x8eaf[_0x5199af];return _0x381974;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf8ea('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8ea('0x1'));var rp=require(_0xf8ea('0x2'));var moment=require(_0xf8ea('0x3'));var BPromise=require(_0xf8ea('0x4'));var Mustache=require(_0xf8ea('0x5'));var util=require(_0xf8ea('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf8ea('0x7'));var ejs=require(_0xf8ea('0x8'));var fs=require('fs');var fs_extra=require(_0xf8ea('0x9'));var _=require(_0xf8ea('0xa'));var squel=require(_0xf8ea('0xb'));var crypto=require(_0xf8ea('0xc'));var jsforce=require(_0xf8ea('0xd'));var deskjs=require(_0xf8ea('0xe'));var toCsv=require(_0xf8ea('0x7'));var querystring=require('querystring');var Papa=require(_0xf8ea('0xf'));var Redis=require('ioredis');var authService=require(_0xf8ea('0x10'));var qs=require(_0xf8ea('0x11'));var as=require(_0xf8ea('0x12'));var hardwareService=require(_0xf8ea('0x13'));var logger=require(_0xf8ea('0x14'))(_0xf8ea('0x15'));var utils=require(_0xf8ea('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf8ea('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d4c8e,_0x1e20d1){_0x1e20d1=_0x1e20d1||0xcc;return function(_0x18777c){if(_0x18777c){return _0x4d4c8e['sendStatus'](_0x1e20d1);}return _0x4d4c8e[_0xf8ea('0x18')](_0x1e20d1)[_0xf8ea('0x19')]();};}function respondWithResult(_0x4d1303,_0x11a005){_0x11a005=_0x11a005||0xc8;return function(_0x12246d){if(_0x12246d){return _0x4d1303[_0xf8ea('0x18')](_0x11a005)[_0xf8ea('0x1a')](_0x12246d);}};}function respondWithFilteredResult(_0x4d42a8,_0x310099){return function(_0x186d74){if(_0x186d74){var _0x13a3c4=typeof _0x310099[_0xf8ea('0x1b')]==='undefined'&&typeof _0x310099[_0xf8ea('0x1c')]==='undefined';var _0x16c60f=_0x186d74[_0xf8ea('0x1d')];var _0x3db3f8=_0x13a3c4?0x0:_0x310099['offset'];var _0x2cc549=_0x13a3c4?_0x186d74[_0xf8ea('0x1d')]:_0x310099[_0xf8ea('0x1b')]+_0x310099[_0xf8ea('0x1c')];var _0x13224a;if(_0x2cc549>=_0x16c60f){_0x2cc549=_0x16c60f;_0x13224a=0xc8;}else{_0x13224a=0xce;}_0x4d42a8[_0xf8ea('0x18')](_0x13224a);return _0x4d42a8[_0xf8ea('0x1e')](_0xf8ea('0x1f'),_0x3db3f8+'-'+_0x2cc549+'/'+_0x16c60f)['json'](_0x186d74);}return null;};}function patchUpdates(_0x221363){return function(_0x1f5137){try{jsonpatch[_0xf8ea('0x20')](_0x1f5137,_0x221363,!![]);}catch(_0xccfd33){return BPromise[_0xf8ea('0x21')](_0xccfd33);}return _0x1f5137[_0xf8ea('0x22')]();};}function saveUpdates(_0x28bb62,_0x2704eb){return function(_0x4f74a1){if(_0x4f74a1){return _0x4f74a1[_0xf8ea('0x23')](_0x28bb62)[_0xf8ea('0x24')](function(_0x2af3ce){return _0x2af3ce;});}return null;};}function removeEntity(_0x3d4fa5,_0x3a49eb){return function(_0x403c07){if(_0x403c07){return _0x403c07[_0xf8ea('0x25')]()[_0xf8ea('0x24')](function(){_0x3d4fa5[_0xf8ea('0x18')](0xcc)[_0xf8ea('0x19')]();});}};}function handleEntityNotFound(_0x2e60c0,_0x358993){return function(_0x4cd726){if(!_0x4cd726){_0x2e60c0['sendStatus'](0x194);}return _0x4cd726;};}function handleError(_0x19e7fe,_0x1ca1cd){_0x1ca1cd=_0x1ca1cd||0x1f4;return function(_0x2fa656){logger[_0xf8ea('0x26')](_0x2fa656['stack']);if(_0x2fa656['name']){delete _0x2fa656[_0xf8ea('0x27')];}_0x19e7fe[_0xf8ea('0x18')](_0x1ca1cd)[_0xf8ea('0x28')](_0x2fa656);};}exports['index']=function(_0x47767b,_0x26c6a3){var _0x4102fa={},_0x446619={},_0x19dfab={'count':0x0,'rows':[]};var _0x4faa21=_['map'](db[_0xf8ea('0x29')][_0xf8ea('0x2a')],function(_0x337681){return{'name':_0x337681[_0xf8ea('0x2b')],'type':_0x337681[_0xf8ea('0x2c')][_0xf8ea('0x2d')]};});_0x446619['model']=_['map'](_0x4faa21,'name');_0x446619[_0xf8ea('0x2e')]=_[_0xf8ea('0x2f')](_0x47767b['query']);_0x446619[_0xf8ea('0x30')]=_[_0xf8ea('0x31')](_0x446619['model'],_0x446619[_0xf8ea('0x2e')]);_0x4102fa[_0xf8ea('0x32')]=_[_0xf8ea('0x31')](_0x446619[_0xf8ea('0x33')],qs[_0xf8ea('0x34')](_0x47767b[_0xf8ea('0x2e')][_0xf8ea('0x34')]));_0x4102fa[_0xf8ea('0x32')]=_0x4102fa[_0xf8ea('0x32')]['length']?_0x4102fa[_0xf8ea('0x32')]:_0x446619[_0xf8ea('0x33')];if(!_0x47767b[_0xf8ea('0x2e')]['hasOwnProperty'](_0xf8ea('0x35'))){_0x4102fa[_0xf8ea('0x1c')]=qs[_0xf8ea('0x1c')](_0x47767b[_0xf8ea('0x2e')][_0xf8ea('0x1c')]);_0x4102fa[_0xf8ea('0x1b')]=qs[_0xf8ea('0x1b')](_0x47767b[_0xf8ea('0x2e')][_0xf8ea('0x1b')]);}_0x4102fa[_0xf8ea('0x36')]=qs[_0xf8ea('0x37')](_0x47767b[_0xf8ea('0x2e')][_0xf8ea('0x37')]);_0x4102fa[_0xf8ea('0x38')]=qs['filters'](_[_0xf8ea('0x39')](_0x47767b[_0xf8ea('0x2e')],_0x446619['filters']),_0x4faa21);if(_0x47767b['query'][_0xf8ea('0x3a')]){_0x4102fa[_0xf8ea('0x38')]=_['merge'](_0x4102fa['where'],{'$or':_[_0xf8ea('0x3b')](_0x4faa21,function(_0x5192b0){if(_0x5192b0['type']!==_0xf8ea('0x3c')){var _0x2842f5={};_0x2842f5[_0x5192b0[_0xf8ea('0x27')]]={'$like':'%'+_0x47767b['query'][_0xf8ea('0x3a')]+'%'};return _0x2842f5;}})});}_0x4102fa=_[_0xf8ea('0x3d')]({},_0x4102fa,_0x47767b[_0xf8ea('0x3e')]);var _0x30faee={'where':_0x4102fa['where']};return db[_0xf8ea('0x29')][_0xf8ea('0x1d')](_0x30faee)[_0xf8ea('0x24')](function(_0x481fb6){_0x19dfab[_0xf8ea('0x1d')]=_0x481fb6;if(_0x47767b[_0xf8ea('0x2e')][_0xf8ea('0x3f')]){_0x4102fa[_0xf8ea('0x40')]=[{'all':!![]}];}return db[_0xf8ea('0x29')]['findAll'](_0x4102fa);})[_0xf8ea('0x24')](function(_0x26970a){_0x19dfab[_0xf8ea('0x41')]=_0x26970a;return _0x19dfab;})[_0xf8ea('0x24')](respondWithFilteredResult(_0x26c6a3,_0x4102fa))[_0xf8ea('0x42')](handleError(_0x26c6a3,null));};exports['show']=function(_0x5ba6f2,_0x4cc289){var _0x549b94={'raw':!![],'where':{'id':_0x5ba6f2['params']['id']}},_0x55eb0c={};_0x55eb0c[_0xf8ea('0x33')]=_['keys'](db[_0xf8ea('0x29')][_0xf8ea('0x2a')]);_0x55eb0c[_0xf8ea('0x2e')]=_[_0xf8ea('0x2f')](_0x5ba6f2['query']);_0x55eb0c[_0xf8ea('0x30')]=_[_0xf8ea('0x31')](_0x55eb0c[_0xf8ea('0x33')],_0x55eb0c['query']);_0x549b94[_0xf8ea('0x32')]=_[_0xf8ea('0x31')](_0x55eb0c[_0xf8ea('0x33')],qs['fields'](_0x5ba6f2[_0xf8ea('0x2e')][_0xf8ea('0x34')]));_0x549b94['attributes']=_0x549b94[_0xf8ea('0x32')][_0xf8ea('0x43')]?_0x549b94[_0xf8ea('0x32')]:_0x55eb0c['model'];if(_0x5ba6f2['query'][_0xf8ea('0x3f')]){_0x549b94[_0xf8ea('0x40')]=[{'all':!![]}];}_0x549b94=_['merge']({},_0x549b94,_0x5ba6f2[_0xf8ea('0x3e')]);return db[_0xf8ea('0x29')][_0xf8ea('0x44')](_0x549b94)['then'](handleEntityNotFound(_0x4cc289,null))[_0xf8ea('0x24')](respondWithResult(_0x4cc289,null))['catch'](handleError(_0x4cc289,null));};exports['create']=function(_0x5c42b2,_0x2b8776){return db[_0xf8ea('0x29')]['create'](_0x5c42b2[_0xf8ea('0x45')],{})[_0xf8ea('0x24')](respondWithResult(_0x2b8776,0xc9))[_0xf8ea('0x42')](handleError(_0x2b8776,null));};exports[_0xf8ea('0x23')]=function(_0x4e3f27,_0x6481cc){if(_0x4e3f27[_0xf8ea('0x45')]['id']){delete _0x4e3f27[_0xf8ea('0x45')]['id'];}return db['SquareRecording'][_0xf8ea('0x44')]({'where':{'id':_0x4e3f27[_0xf8ea('0x46')]['id']}})['then'](handleEntityNotFound(_0x6481cc,null))[_0xf8ea('0x24')](saveUpdates(_0x4e3f27['body'],null))[_0xf8ea('0x24')](respondWithResult(_0x6481cc,null))[_0xf8ea('0x42')](handleError(_0x6481cc,null));};exports['download']=function(_0x101344,_0x102e7c,_0x4d4023){var _0x3b2ebe=require(_0xf8ea('0x47'));var _0x5845f8=![];var _0x5e1ba5={};if(_0x101344[_0xf8ea('0x2e')][_0xf8ea('0x2c')]&&_0x101344[_0xf8ea('0x2e')][_0xf8ea('0x2c')]===_0xf8ea('0x48')){_0x5e1ba5[_0xf8ea('0x48')]=_0x101344[_0xf8ea('0x46')]['id'];}else{_0x5e1ba5['id']=_0x101344[_0xf8ea('0x46')]['id'];}return db[_0xf8ea('0x29')][_0xf8ea('0x44')]({'where':_0x5e1ba5,'attributes':['id',_0xf8ea('0x49'),_0xf8ea('0x4a')],'raw':!![]})[_0xf8ea('0x24')](handleEntityNotFound(_0x102e7c,null))[_0xf8ea('0x24')](function(_0x27f670){if(_0x27f670){var _0x3aff0d=_0x27f670[_0xf8ea('0x49')];var _0x552466=util['format']('%s.cypher',_0x3aff0d);if(fs[_0xf8ea('0x4b')](_0x552466)){_0x5845f8=!![];return _0x3b2ebe[_0xf8ea('0x4c')](_0x552466,_0x3aff0d,config[_0xf8ea('0x4d')][_0xf8ea('0x4e')])[_0xf8ea('0x24')](function(){return _0x27f670;});}return _0x27f670;}})[_0xf8ea('0x24')](function(_0x1e6ed4){if(_0x1e6ed4){var _0x4efe84=_0x1e6ed4['savePath'];if(!fs[_0xf8ea('0x4b')](_0x4efe84)){throw new db[(_0xf8ea('0x4f'))][(_0xf8ea('0x50'))](_0xf8ea('0x51'));}if(_0x1e6ed4[_0xf8ea('0x4a')]){return _0x102e7c[_0xf8ea('0x52')](_0x4efe84,_0x1e6ed4[_0xf8ea('0x4a')]+path[_0xf8ea('0x53')](_0x4efe84),function(){if(_0x5845f8){fs[_0xf8ea('0x54')](_0x4efe84);}});}else{return _0x102e7c[_0xf8ea('0x52')](_0x4efe84,function(_0x313fe8){if(_0x5845f8){fs[_0xf8ea('0x54')](_0x4efe84);}});}}})['catch'](function(_0x465d90){if(_0x465d90['message']===_0xf8ea('0x51')){_0x102e7c['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x102e7c,null);}});};exports[_0xf8ea('0x25')]=function(_0x3e83ce,_0x353027){return db[_0xf8ea('0x29')][_0xf8ea('0x44')]({'where':{'id':_0x3e83ce['params']['id']}})[_0xf8ea('0x24')](function(_0x298bcf){if(_[_0xf8ea('0x55')](_0x298bcf)){throw new ReferenceError(_0xf8ea('0x56'));}return _0x298bcf;})[_0xf8ea('0x24')](function(_0x4c0dce){var _0x34b0eb=_0x4c0dce[_0xf8ea('0x49')];logger[_0xf8ea('0x57')](_0xf8ea('0x58'),_0x34b0eb);if(!_['isNil'](_0x4c0dce[_0xf8ea('0x49')])&&fs[_0xf8ea('0x4b')](_0x34b0eb)){logger[_0xf8ea('0x57')](_0xf8ea('0x59')+_0x34b0eb+_0xf8ea('0x5a'));fs[_0xf8ea('0x5b')](_0x34b0eb);}_0x34b0eb=_0x34b0eb+'.cypher';if(!_[_0xf8ea('0x55')](_0x4c0dce['savePath'])&&fs[_0xf8ea('0x4b')](_0x34b0eb)){logger['info'](_0xf8ea('0x59')+_0x34b0eb+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf8ea('0x5b')](_0x34b0eb);}return _0x4c0dce;})[_0xf8ea('0x24')](function(_0x4a5db9){if(!_0x4a5db9)throw new InternalError();return _0x4a5db9[_0xf8ea('0x25')]();})[_0xf8ea('0x24')](function(){_0x353027[_0xf8ea('0x18')](0xcc)[_0xf8ea('0x19')]();})[_0xf8ea('0x42')](handleError(_0x353027,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 2ab38f5..3b274e6 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 _0xf19c=['rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x91b46b,_0x2fd22d){var _0xed7d9e=function(_0x47e700){while(--_0x47e700){_0x91b46b['push'](_0x91b46b['shift']());}};_0xed7d9e(++_0x2fd22d);}(_0xf19c,0x10b));var _0xcf19=function(_0xc73162,_0x1be710){_0xc73162=_0xc73162-0x0;var _0x3fdc74=_0xf19c[_0xc73162];return _0x3fdc74;};'use strict';var _=require(_0xcf19('0x0'));var util=require(_0xcf19('0x1'));var logger=require(_0xcf19('0x2'))('api');var moment=require(_0xcf19('0x3'));var BPromise=require(_0xcf19('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf19('0x5'));var rimraf=require(_0xcf19('0x6'));var config=require(_0xcf19('0x7'));var attributes=require(_0xcf19('0x8'));module[_0xcf19('0x9')]=function(_0x59a408,_0x3d3608){return _0x59a408[_0xcf19('0xa')](_0xcf19('0xb'),attributes,{'tableName':_0xcf19('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1574=['../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xe0d6d,_0x365162){var _0x162274=function(_0x1f9c89){while(--_0x1f9c89){_0xe0d6d['push'](_0xe0d6d['shift']());}};_0x162274(++_0x365162);}(_0x1574,0x148));var _0x4157=function(_0x22d618,_0x5411c4){_0x22d618=_0x22d618-0x0;var _0xd264e4=_0x1574[_0x22d618];return _0xd264e4;};'use strict';var _=require(_0x4157('0x0'));var util=require(_0x4157('0x1'));var logger=require(_0x4157('0x2'))(_0x4157('0x3'));var moment=require('moment');var BPromise=require(_0x4157('0x4'));var rp=require(_0x4157('0x5'));var fs=require('fs');var path=require(_0x4157('0x6'));var rimraf=require(_0x4157('0x7'));var config=require(_0x4157('0x8'));var attributes=require(_0x4157('0x9'));module[_0x4157('0xa')]=function(_0x43c6dc,_0xbd0cf7){return _0x43c6dc[_0x4157('0xb')](_0x4157('0xc'),attributes,{'tableName':_0x4157('0xd'),'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 347cb5f..7972f1f 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 _0xf02e=['../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2fdbdb,_0x3c56b5){var _0x2ba7f9=function(_0x61604d){while(--_0x61604d){_0x2fdbdb['push'](_0x2fdbdb['shift']());}};_0x2ba7f9(++_0x3c56b5);}(_0xf02e,0xc3));var _0xef02=function(_0x24e0db,_0x470cef){_0x24e0db=_0x24e0db-0x0;var _0x514450=_0xf02e[_0x24e0db];return _0x514450;};'use strict';var _=require(_0xef02('0x0'));var util=require('util');var moment=require(_0xef02('0x1'));var BPromise=require(_0xef02('0x2'));var rs=require(_0xef02('0x3'));var fs=require('fs');var Redis=require(_0xef02('0x4'));var db=require(_0xef02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xef02('0x6'))(_0xef02('0x7'));var config=require(_0xef02('0x8'));var jayson=require(_0xef02('0x9'));var client=jayson[_0xef02('0xa')][_0xef02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x159ef7,_0x1f3aa9,_0x5cf142){return new BPromise(function(_0x15d49b,_0x1d94a6){return client[_0xef02('0xc')](_0x159ef7,_0x5cf142)[_0xef02('0xd')](function(_0x521943){logger['info'](_0xef02('0xe'),_0x1f3aa9,_0xef02('0xf'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1f3aa9,_0xef02('0xf'),JSON['stringify'](_0x521943));if(_0x521943[_0xef02('0x10')]){if(_0x521943[_0xef02('0x10')][_0xef02('0x11')]===0x1f4){logger[_0xef02('0x10')]('SquareRecording,\x20%s,\x20%s',_0x1f3aa9,_0x521943['error'][_0xef02('0x12')]);return _0x1d94a6(_0x521943['error'][_0xef02('0x12')]);}logger[_0xef02('0x10')](_0xef02('0xe'),_0x1f3aa9,_0x521943[_0xef02('0x10')][_0xef02('0x12')]);return _0x15d49b(_0x521943[_0xef02('0x10')][_0xef02('0x12')]);}else{logger[_0xef02('0x13')](_0xef02('0xe'),_0x1f3aa9,_0xef02('0xf'));_0x15d49b(_0x521943[_0xef02('0x14')]['message']);}})[_0xef02('0x15')](function(_0x1cb429){logger['error'](_0xef02('0xe'),_0x1f3aa9,_0x1cb429);_0x1d94a6(_0x1cb429);});});}exports[_0xef02('0x16')]=function(_0x342492){var _0x3dd966=this;return new Promise(function(_0x258d72,_0x30b76f){return db[_0xef02('0x17')][_0xef02('0x18')](_0x342492[_0xef02('0x19')],{'raw':_0x342492['options']?_0x342492[_0xef02('0x1a')][_0xef02('0x1b')]===undefined?!![]:![]:!![]})[_0xef02('0xd')](function(_0x524921){logger[_0xef02('0x13')](_0xef02('0x16'),_0x342492);logger[_0xef02('0x1c')](_0xef02('0x16'),_0x342492,JSON['stringify'](_0x524921));_0x258d72(_0x524921);})[_0xef02('0x15')](function(_0x238bc9){logger[_0xef02('0x10')](_0xef02('0x16'),_0x238bc9[_0xef02('0x12')],_0x342492);_0x30b76f(_0x3dd966['error'](0x1f4,_0x238bc9[_0xef02('0x12')]));});});}; \ No newline at end of file +var _0xbfc1=['CreateSquareRecording','SquareRecording','create','body','options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0xbfc1,0x1f4));var _0x1bfc=function(_0x2d5c70,_0x270f45){_0x2d5c70=_0x2d5c70-0x0;var _0x24ecfb=_0xbfc1[_0x2d5c70];return _0x24ecfb;};'use strict';var _=require(_0x1bfc('0x0'));var util=require('util');var moment=require(_0x1bfc('0x1'));var BPromise=require(_0x1bfc('0x2'));var rs=require(_0x1bfc('0x3'));var fs=require('fs');var Redis=require(_0x1bfc('0x4'));var db=require(_0x1bfc('0x5'))['db'];var utils=require(_0x1bfc('0x6'));var logger=require(_0x1bfc('0x7'))('rpc');var config=require(_0x1bfc('0x8'));var jayson=require(_0x1bfc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x68f64d,_0x27a1bb,_0x2ab271){return new BPromise(function(_0x1e267c,_0x17f2e2){return client[_0x1bfc('0xa')](_0x68f64d,_0x2ab271)[_0x1bfc('0xb')](function(_0x10bf73){logger[_0x1bfc('0xc')](_0x1bfc('0xd'),_0x27a1bb,_0x1bfc('0xe'));logger[_0x1bfc('0xf')](_0x1bfc('0x10'),_0x27a1bb,_0x1bfc('0xe'),JSON[_0x1bfc('0x11')](_0x10bf73));if(_0x10bf73[_0x1bfc('0x12')]){if(_0x10bf73[_0x1bfc('0x12')][_0x1bfc('0x13')]===0x1f4){logger[_0x1bfc('0x12')](_0x1bfc('0xd'),_0x27a1bb,_0x10bf73[_0x1bfc('0x12')][_0x1bfc('0x14')]);return _0x17f2e2(_0x10bf73['error'][_0x1bfc('0x14')]);}logger[_0x1bfc('0x12')](_0x1bfc('0xd'),_0x27a1bb,_0x10bf73[_0x1bfc('0x12')][_0x1bfc('0x14')]);return _0x1e267c(_0x10bf73[_0x1bfc('0x12')][_0x1bfc('0x14')]);}else{logger['info'](_0x1bfc('0xd'),_0x27a1bb,_0x1bfc('0xe'));_0x1e267c(_0x10bf73[_0x1bfc('0x15')][_0x1bfc('0x14')]);}})['catch'](function(_0x4a0ef3){logger[_0x1bfc('0x12')](_0x1bfc('0xd'),_0x27a1bb,_0x4a0ef3);_0x17f2e2(_0x4a0ef3);});});}exports[_0x1bfc('0x16')]=function(_0x4a71a2){var _0x39ca6c=this;return new Promise(function(_0x467e05,_0x5d8e80){return db[_0x1bfc('0x17')][_0x1bfc('0x18')](_0x4a71a2[_0x1bfc('0x19')],{'raw':_0x4a71a2[_0x1bfc('0x1a')]?_0x4a71a2[_0x1bfc('0x1a')][_0x1bfc('0x1b')]===undefined?!![]:![]:!![]})[_0x1bfc('0xb')](function(_0x176c71){logger[_0x1bfc('0xc')]('CreateSquareRecording',_0x4a71a2);logger[_0x1bfc('0xf')]('CreateSquareRecording',_0x4a71a2,JSON[_0x1bfc('0x11')](_0x176c71));_0x467e05(_0x176c71);})[_0x1bfc('0x1c')](function(_0x73035){logger[_0x1bfc('0x12')](_0x1bfc('0x16'),_0x73035[_0x1bfc('0x14')],_0x4a71a2);_0x5d8e80(_0x39ca6c[_0x1bfc('0x12')](0x1f4,_0x73035['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 9f13b02..fdb9f45 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(_0x485bad,_0x21c418){var _0x523c91=function(_0x7393a4){while(--_0x7393a4){_0x485bad['push'](_0x485bad['shift']());}};_0x523c91(++_0x21c418);}(_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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index c7d2f1e..51d69bb 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 _0x2755=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2755,0xca));var _0x5275=function(_0x17543f,_0x34a3aa){_0x17543f=_0x17543f-0x0;var _0x479c57=_0x2755[_0x17543f];return _0x479c57;};'use strict';var Sequelize=require(_0x5275('0x0'));module[_0x5275('0x1')]={'network':{'type':Sequelize[_0x5275('0x2')]},'network_script':{'type':Sequelize[_0x5275('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5275('0x2')]},'language':{'type':Sequelize[_0x5275('0x2')]},'type':{'type':Sequelize[_0x5275('0x2')]},'uniqueid':{'type':Sequelize[_0x5275('0x2')]},'version':{'type':Sequelize[_0x5275('0x2')]},'callerid':{'type':Sequelize[_0x5275('0x2')]},'calleridname':{'type':Sequelize[_0x5275('0x2')]},'callingpres':{'type':Sequelize[_0x5275('0x2')]},'callingani2':{'type':Sequelize[_0x5275('0x2')]},'callington':{'type':Sequelize[_0x5275('0x2')]},'callingtns':{'type':Sequelize[_0x5275('0x2')]},'dnid':{'type':Sequelize[_0x5275('0x2')]},'rdnis':{'type':Sequelize[_0x5275('0x2')]},'context':{'type':Sequelize[_0x5275('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5275('0x2')]},'enhanced':{'type':Sequelize[_0x5275('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5275('0x3')]},'bot':{'type':Sequelize[_0x5275('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xb4a5=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb4a5,0x127));var _0x5b4a=function(_0x42babf,_0x2b9b48){_0x42babf=_0x42babf-0x0;var _0x5e592c=_0xb4a5[_0x42babf];return _0x5e592c;};'use strict';var Sequelize=require(_0x5b4a('0x0'));module[_0x5b4a('0x1')]={'network':{'type':Sequelize[_0x5b4a('0x2')]},'network_script':{'type':Sequelize[_0x5b4a('0x2')]},'request':{'type':Sequelize[_0x5b4a('0x2')]},'channel':{'type':Sequelize[_0x5b4a('0x2')]},'language':{'type':Sequelize[_0x5b4a('0x2')]},'type':{'type':Sequelize[_0x5b4a('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x5b4a('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5b4a('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x5b4a('0x2')]},'callington':{'type':Sequelize[_0x5b4a('0x2')]},'callingtns':{'type':Sequelize[_0x5b4a('0x2')]},'dnid':{'type':Sequelize[_0x5b4a('0x2')]},'rdnis':{'type':Sequelize[_0x5b4a('0x2')]},'context':{'type':Sequelize[_0x5b4a('0x2')]},'extension':{'type':Sequelize[_0x5b4a('0x2')]},'priority':{'type':Sequelize[_0x5b4a('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5b4a('0x2')]},'threadid':{'type':Sequelize[_0x5b4a('0x2')]},'project_name':{'type':Sequelize[_0x5b4a('0x2')]},'joinAt':{'type':Sequelize[_0x5b4a('0x3')]},'leaveAt':{'type':Sequelize[_0x5b4a('0x3')]},'bot':{'type':Sequelize[_0x5b4a('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 1db2fc3..7b59900 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 _0x8829=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x8829,0xcf));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9882('0x0'));var zipdir=require(_0x9882('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9882('0x2'));var moment=require(_0x9882('0x3'));var BPromise=require(_0x9882('0x4'));var Mustache=require(_0x9882('0x5'));var util=require(_0x9882('0x6'));var path=require(_0x9882('0x7'));var sox=require('sox');var csv=require(_0x9882('0x8'));var ejs=require(_0x9882('0x9'));var fs=require('fs');var fs_extra=require(_0x9882('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9882('0xb'));var jsforce=require(_0x9882('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9882('0x8'));var querystring=require(_0x9882('0xd'));var Papa=require(_0x9882('0xe'));var Redis=require(_0x9882('0xf'));var authService=require(_0x9882('0x10'));var qs=require(_0x9882('0x11'));var as=require(_0x9882('0x12'));var hardwareService=require(_0x9882('0x13'));var logger=require(_0x9882('0x14'))(_0x9882('0x15'));var utils=require(_0x9882('0x16'));var config=require(_0x9882('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9882('0x18'))['db'];function respondWithStatusCode(_0xec8ea6,_0x46e1cc){_0x46e1cc=_0x46e1cc||0xcc;return function(_0x359556){if(_0x359556){return _0xec8ea6[_0x9882('0x19')](_0x46e1cc);}return _0xec8ea6[_0x9882('0x1a')](_0x46e1cc)[_0x9882('0x1b')]();};}function respondWithResult(_0x35fd97,_0x1f90c5){_0x1f90c5=_0x1f90c5||0xc8;return function(_0x4fef14){if(_0x4fef14){return _0x35fd97[_0x9882('0x1a')](_0x1f90c5)[_0x9882('0x1c')](_0x4fef14);}};}function respondWithFilteredResult(_0x2d5baa,_0x35c115){return function(_0x25579c){if(_0x25579c){var _0x422473=typeof _0x35c115[_0x9882('0x1d')]===_0x9882('0x1e')&&typeof _0x35c115['limit']===_0x9882('0x1e');var _0x163054=_0x25579c[_0x9882('0x1f')];var _0x192aba=_0x422473?0x0:_0x35c115[_0x9882('0x1d')];var _0x35f23b=_0x422473?_0x25579c[_0x9882('0x1f')]:_0x35c115[_0x9882('0x1d')]+_0x35c115[_0x9882('0x20')];var _0x56da89;if(_0x35f23b>=_0x163054){_0x35f23b=_0x163054;_0x56da89=0xc8;}else{_0x56da89=0xce;}_0x2d5baa['status'](_0x56da89);return _0x2d5baa[_0x9882('0x21')](_0x9882('0x22'),_0x192aba+'-'+_0x35f23b+'/'+_0x163054)['json'](_0x25579c);}return null;};}function patchUpdates(_0x451ca5){return function(_0x2e67e6){try{jsonpatch[_0x9882('0x23')](_0x2e67e6,_0x451ca5,!![]);}catch(_0x40c252){return BPromise[_0x9882('0x24')](_0x40c252);}return _0x2e67e6[_0x9882('0x25')]();};}function saveUpdates(_0x5bd27f,_0x4b7b5d){return function(_0x24b67f){if(_0x24b67f){return _0x24b67f[_0x9882('0x26')](_0x5bd27f)[_0x9882('0x27')](function(_0x38fa7b){return _0x38fa7b;});}return null;};}function removeEntity(_0x5201b7,_0x56db60){return function(_0xd60194){if(_0xd60194){return _0xd60194[_0x9882('0x28')]()[_0x9882('0x27')](function(){_0x5201b7[_0x9882('0x1a')](0xcc)[_0x9882('0x1b')]();});}};}function handleEntityNotFound(_0x3be835,_0x2eefcc){return function(_0x367863){if(!_0x367863){_0x3be835[_0x9882('0x19')](0x194);}return _0x367863;};}function handleError(_0xec7da2,_0x169876){_0x169876=_0x169876||0x1f4;return function(_0x50f0c9){logger[_0x9882('0x29')](_0x50f0c9[_0x9882('0x2a')]);if(_0x50f0c9[_0x9882('0x2b')]){delete _0x50f0c9[_0x9882('0x2b')];}_0xec7da2[_0x9882('0x1a')](_0x169876)[_0x9882('0x2c')](_0x50f0c9);};}exports[_0x9882('0x2d')]=function(_0x24f4fc,_0x2c2cc9){var _0x394d72={},_0x22a6de={},_0x400a08={'count':0x0,'rows':[]};var _0x4d87bc=_['map'](db[_0x9882('0x2e')]['rawAttributes'],function(_0x1839a2){return{'name':_0x1839a2[_0x9882('0x2f')],'type':_0x1839a2[_0x9882('0x30')]['key']};});_0x22a6de[_0x9882('0x31')]=_['map'](_0x4d87bc,_0x9882('0x2b'));_0x22a6de[_0x9882('0x32')]=_['keys'](_0x24f4fc[_0x9882('0x32')]);_0x22a6de[_0x9882('0x33')]=_[_0x9882('0x34')](_0x22a6de['model'],_0x22a6de[_0x9882('0x32')]);_0x394d72[_0x9882('0x35')]=_[_0x9882('0x34')](_0x22a6de[_0x9882('0x31')],qs[_0x9882('0x36')](_0x24f4fc['query']['fields']));_0x394d72['attributes']=_0x394d72['attributes'][_0x9882('0x37')]?_0x394d72[_0x9882('0x35')]:_0x22a6de['model'];if(!_0x24f4fc[_0x9882('0x32')][_0x9882('0x38')](_0x9882('0x39'))){_0x394d72[_0x9882('0x20')]=qs[_0x9882('0x20')](_0x24f4fc[_0x9882('0x32')][_0x9882('0x20')]);_0x394d72[_0x9882('0x1d')]=qs['offset'](_0x24f4fc[_0x9882('0x32')][_0x9882('0x1d')]);}_0x394d72[_0x9882('0x3a')]=qs[_0x9882('0x3b')](_0x24f4fc[_0x9882('0x32')][_0x9882('0x3b')]);_0x394d72[_0x9882('0x3c')]=qs[_0x9882('0x33')](_[_0x9882('0x3d')](_0x24f4fc['query'],_0x22a6de['filters']),_0x4d87bc);if(_0x24f4fc[_0x9882('0x32')][_0x9882('0x3e')]){_0x394d72['where']=_[_0x9882('0x3f')](_0x394d72['where'],{'$or':_[_0x9882('0x40')](_0x4d87bc,function(_0x43734b){if(_0x43734b['type']!==_0x9882('0x41')){var _0x34324d={};_0x34324d[_0x43734b['name']]={'$like':'%'+_0x24f4fc[_0x9882('0x32')][_0x9882('0x3e')]+'%'};return _0x34324d;}})});}_0x394d72=_['merge']({},_0x394d72,_0x24f4fc[_0x9882('0x42')]);var _0x538155={'where':_0x394d72[_0x9882('0x3c')]};return db[_0x9882('0x2e')][_0x9882('0x1f')](_0x538155)['then'](function(_0x1e6ff8){_0x400a08[_0x9882('0x1f')]=_0x1e6ff8;if(_0x24f4fc['query'][_0x9882('0x43')]){_0x394d72[_0x9882('0x44')]=[{'all':!![]}];}return db['SquareReport'][_0x9882('0x45')](_0x394d72);})[_0x9882('0x27')](function(_0x1537fb){_0x400a08[_0x9882('0x46')]=_0x1537fb;return _0x400a08;})[_0x9882('0x27')](respondWithFilteredResult(_0x2c2cc9,_0x394d72))[_0x9882('0x47')](handleError(_0x2c2cc9,null));};exports[_0x9882('0x48')]=function(_0x3df37b,_0x3b4194){var _0x3e883b={'raw':!![],'where':{'id':_0x3df37b[_0x9882('0x49')]['id']}},_0x1edf39={};_0x1edf39[_0x9882('0x31')]=_['keys'](db[_0x9882('0x2e')][_0x9882('0x4a')]);_0x1edf39[_0x9882('0x32')]=_['keys'](_0x3df37b[_0x9882('0x32')]);_0x1edf39['filters']=_[_0x9882('0x34')](_0x1edf39['model'],_0x1edf39['query']);_0x3e883b['attributes']=_[_0x9882('0x34')](_0x1edf39[_0x9882('0x31')],qs[_0x9882('0x36')](_0x3df37b[_0x9882('0x32')]['fields']));_0x3e883b[_0x9882('0x35')]=_0x3e883b['attributes'][_0x9882('0x37')]?_0x3e883b[_0x9882('0x35')]:_0x1edf39[_0x9882('0x31')];if(_0x3df37b[_0x9882('0x32')][_0x9882('0x43')]){_0x3e883b[_0x9882('0x44')]=[{'all':!![]}];}_0x3e883b=_[_0x9882('0x3f')]({},_0x3e883b,_0x3df37b[_0x9882('0x42')]);return db['SquareReport'][_0x9882('0x4b')](_0x3e883b)[_0x9882('0x27')](handleEntityNotFound(_0x3b4194,null))[_0x9882('0x27')](respondWithResult(_0x3b4194,null))['catch'](handleError(_0x3b4194,null));};exports['create']=function(_0x373ae8,_0x2c1237){return db[_0x9882('0x2e')][_0x9882('0x4c')](_0x373ae8['body'],{})[_0x9882('0x27')](respondWithResult(_0x2c1237,0xc9))[_0x9882('0x47')](handleError(_0x2c1237,null));};exports[_0x9882('0x26')]=function(_0x4f5590,_0x1636c7){if(_0x4f5590['body']['id']){delete _0x4f5590['body']['id'];}return db['SquareReport'][_0x9882('0x4b')]({'where':{'id':_0x4f5590[_0x9882('0x49')]['id']}})['then'](handleEntityNotFound(_0x1636c7,null))[_0x9882('0x27')](saveUpdates(_0x4f5590[_0x9882('0x4d')],null))[_0x9882('0x27')](respondWithResult(_0x1636c7,null))['catch'](handleError(_0x1636c7,null));};exports[_0x9882('0x28')]=function(_0x3aa153,_0x3f0872){return db[_0x9882('0x2e')][_0x9882('0x4b')]({'where':{'id':_0x3aa153[_0x9882('0x49')]['id']}})[_0x9882('0x27')](handleEntityNotFound(_0x3f0872,null))[_0x9882('0x27')](removeEntity(_0x3f0872,null))[_0x9882('0x47')](handleError(_0x3f0872,null));};exports[_0x9882('0x4e')]=function(_0xff6d18,_0x11f10b){return db['SquareReport'][_0x9882('0x4e')]()[_0x9882('0x27')](respondWithResult(_0x11f10b,null))['catch'](handleError(_0x11f10b,null));}; \ No newline at end of file +var _0x1497=['intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','update','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','then','destroy','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes'];(function(_0x4b5ab2,_0x12080b){var _0x478f48=function(_0x3b0296){while(--_0x3b0296){_0x4b5ab2['push'](_0x4b5ab2['shift']());}};_0x478f48(++_0x12080b);}(_0x1497,0x19e));var _0x7149=function(_0x5827a2,_0x1c931f){_0x5827a2=_0x5827a2-0x0;var _0x6b8862=_0x1497[_0x5827a2];return _0x6b8862;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7149('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7149('0x1'));var moment=require(_0x7149('0x2'));var BPromise=require(_0x7149('0x3'));var Mustache=require(_0x7149('0x4'));var util=require(_0x7149('0x5'));var path=require(_0x7149('0x6'));var sox=require('sox');var csv=require(_0x7149('0x7'));var ejs=require(_0x7149('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7149('0x9'));var squel=require(_0x7149('0xa'));var crypto=require(_0x7149('0xb'));var jsforce=require(_0x7149('0xc'));var deskjs=require(_0x7149('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7149('0xe'));var Papa=require('papaparse');var Redis=require(_0x7149('0xf'));var authService=require(_0x7149('0x10'));var qs=require(_0x7149('0x11'));var as=require(_0x7149('0x12'));var hardwareService=require(_0x7149('0x13'));var logger=require(_0x7149('0x14'))(_0x7149('0x15'));var utils=require(_0x7149('0x16'));var config=require(_0x7149('0x17'));var licenseUtil=require(_0x7149('0x18'));var db=require(_0x7149('0x19'))['db'];function respondWithStatusCode(_0x3fa14a,_0x34d716){_0x34d716=_0x34d716||0xcc;return function(_0x36a541){if(_0x36a541){return _0x3fa14a[_0x7149('0x1a')](_0x34d716);}return _0x3fa14a['status'](_0x34d716)[_0x7149('0x1b')]();};}function respondWithResult(_0x4efd67,_0x2c37d1){_0x2c37d1=_0x2c37d1||0xc8;return function(_0x1fb38d){if(_0x1fb38d){return _0x4efd67['status'](_0x2c37d1)['json'](_0x1fb38d);}};}function respondWithFilteredResult(_0x156f8a,_0x123e2a){return function(_0x28b09f){if(_0x28b09f){var _0x8a24b9=typeof _0x123e2a[_0x7149('0x1c')]==='undefined'&&typeof _0x123e2a[_0x7149('0x1d')]===_0x7149('0x1e');var _0xa1019f=_0x28b09f[_0x7149('0x1f')];var _0x3b0185=_0x8a24b9?0x0:_0x123e2a[_0x7149('0x1c')];var _0x288887=_0x8a24b9?_0x28b09f['count']:_0x123e2a[_0x7149('0x1c')]+_0x123e2a[_0x7149('0x1d')];var _0x1e9af7;if(_0x288887>=_0xa1019f){_0x288887=_0xa1019f;_0x1e9af7=0xc8;}else{_0x1e9af7=0xce;}_0x156f8a[_0x7149('0x20')](_0x1e9af7);return _0x156f8a[_0x7149('0x21')](_0x7149('0x22'),_0x3b0185+'-'+_0x288887+'/'+_0xa1019f)[_0x7149('0x23')](_0x28b09f);}return null;};}function patchUpdates(_0x1bf76a){return function(_0x1ec9c8){try{jsonpatch['apply'](_0x1ec9c8,_0x1bf76a,!![]);}catch(_0x4f5b5e){return BPromise[_0x7149('0x24')](_0x4f5b5e);}return _0x1ec9c8[_0x7149('0x25')]();};}function saveUpdates(_0x260a04,_0x1ca7c7){return function(_0x32e617){if(_0x32e617){return _0x32e617['update'](_0x260a04)[_0x7149('0x26')](function(_0x4f2adf){return _0x4f2adf;});}return null;};}function removeEntity(_0x7505dd,_0xd41390){return function(_0x40d16d){if(_0x40d16d){return _0x40d16d[_0x7149('0x27')]()[_0x7149('0x26')](function(){_0x7505dd['status'](0xcc)[_0x7149('0x1b')]();});}};}function handleEntityNotFound(_0x8fda17,_0x54af50){return function(_0x2afdfd){if(!_0x2afdfd){_0x8fda17[_0x7149('0x1a')](0x194);}return _0x2afdfd;};}function handleError(_0x2731f6,_0x2c37e4){_0x2c37e4=_0x2c37e4||0x1f4;return function(_0x4184fc){logger[_0x7149('0x28')](_0x4184fc[_0x7149('0x29')]);if(_0x4184fc[_0x7149('0x2a')]){delete _0x4184fc['name'];}_0x2731f6[_0x7149('0x20')](_0x2c37e4)['send'](_0x4184fc);};}exports[_0x7149('0x2b')]=function(_0x2085eb,_0x696b7f){var _0x2a16bc={},_0x282a59={},_0x14455b={'count':0x0,'rows':[]};var _0x57a0ea=_[_0x7149('0x2c')](db[_0x7149('0x2d')][_0x7149('0x2e')],function(_0x4d0c80){return{'name':_0x4d0c80[_0x7149('0x2f')],'type':_0x4d0c80['type'][_0x7149('0x30')]};});_0x282a59[_0x7149('0x31')]=_['map'](_0x57a0ea,_0x7149('0x2a'));_0x282a59[_0x7149('0x32')]=_[_0x7149('0x33')](_0x2085eb[_0x7149('0x32')]);_0x282a59[_0x7149('0x34')]=_['intersection'](_0x282a59[_0x7149('0x31')],_0x282a59[_0x7149('0x32')]);_0x2a16bc[_0x7149('0x35')]=_[_0x7149('0x36')](_0x282a59[_0x7149('0x31')],qs[_0x7149('0x37')](_0x2085eb[_0x7149('0x32')]['fields']));_0x2a16bc[_0x7149('0x35')]=_0x2a16bc[_0x7149('0x35')][_0x7149('0x38')]?_0x2a16bc[_0x7149('0x35')]:_0x282a59[_0x7149('0x31')];if(!_0x2085eb[_0x7149('0x32')][_0x7149('0x39')](_0x7149('0x3a'))){_0x2a16bc[_0x7149('0x1d')]=qs['limit'](_0x2085eb['query']['limit']);_0x2a16bc['offset']=qs['offset'](_0x2085eb['query']['offset']);}_0x2a16bc['order']=qs[_0x7149('0x3b')](_0x2085eb['query'][_0x7149('0x3b')]);_0x2a16bc[_0x7149('0x3c')]=qs[_0x7149('0x34')](_[_0x7149('0x3d')](_0x2085eb[_0x7149('0x32')],_0x282a59[_0x7149('0x34')]),_0x57a0ea);if(_0x2085eb['query'][_0x7149('0x3e')]){_0x2a16bc[_0x7149('0x3c')]=_[_0x7149('0x3f')](_0x2a16bc[_0x7149('0x3c')],{'$or':_[_0x7149('0x2c')](_0x57a0ea,function(_0x9898eb){if(_0x9898eb[_0x7149('0x40')]!=='VIRTUAL'){var _0x2ad957={};_0x2ad957[_0x9898eb[_0x7149('0x2a')]]={'$like':'%'+_0x2085eb[_0x7149('0x32')]['filter']+'%'};return _0x2ad957;}})});}_0x2a16bc=_[_0x7149('0x3f')]({},_0x2a16bc,_0x2085eb['options']);var _0x294873={'where':_0x2a16bc[_0x7149('0x3c')]};return db[_0x7149('0x2d')][_0x7149('0x1f')](_0x294873)[_0x7149('0x26')](function(_0x1c3a00){_0x14455b['count']=_0x1c3a00;if(_0x2085eb[_0x7149('0x32')]['includeAll']){_0x2a16bc[_0x7149('0x41')]=[{'all':!![]}];}return db[_0x7149('0x2d')][_0x7149('0x42')](_0x2a16bc);})[_0x7149('0x26')](function(_0x255724){_0x14455b[_0x7149('0x43')]=_0x255724;return _0x14455b;})[_0x7149('0x26')](respondWithFilteredResult(_0x696b7f,_0x2a16bc))['catch'](handleError(_0x696b7f,null));};exports[_0x7149('0x44')]=function(_0x15eb79,_0x40fa08){var _0x33845f={'raw':!![],'where':{'id':_0x15eb79[_0x7149('0x45')]['id']}},_0x3cd945={};_0x3cd945[_0x7149('0x31')]=_[_0x7149('0x33')](db[_0x7149('0x2d')][_0x7149('0x2e')]);_0x3cd945['query']=_['keys'](_0x15eb79[_0x7149('0x32')]);_0x3cd945['filters']=_[_0x7149('0x36')](_0x3cd945[_0x7149('0x31')],_0x3cd945[_0x7149('0x32')]);_0x33845f['attributes']=_[_0x7149('0x36')](_0x3cd945[_0x7149('0x31')],qs[_0x7149('0x37')](_0x15eb79[_0x7149('0x32')][_0x7149('0x37')]));_0x33845f[_0x7149('0x35')]=_0x33845f[_0x7149('0x35')][_0x7149('0x38')]?_0x33845f['attributes']:_0x3cd945[_0x7149('0x31')];if(_0x15eb79[_0x7149('0x32')][_0x7149('0x46')]){_0x33845f[_0x7149('0x41')]=[{'all':!![]}];}_0x33845f=_['merge']({},_0x33845f,_0x15eb79[_0x7149('0x47')]);return db[_0x7149('0x2d')][_0x7149('0x48')](_0x33845f)[_0x7149('0x26')](handleEntityNotFound(_0x40fa08,null))['then'](respondWithResult(_0x40fa08,null))[_0x7149('0x49')](handleError(_0x40fa08,null));};exports[_0x7149('0x4a')]=function(_0x2671dd,_0x2d783b){return db[_0x7149('0x2d')][_0x7149('0x4a')](_0x2671dd[_0x7149('0x4b')],{})[_0x7149('0x26')](respondWithResult(_0x2d783b,0xc9))[_0x7149('0x49')](handleError(_0x2d783b,null));};exports[_0x7149('0x4c')]=function(_0x5b0151,_0x151658){if(_0x5b0151[_0x7149('0x4b')]['id']){delete _0x5b0151[_0x7149('0x4b')]['id'];}return db[_0x7149('0x2d')]['find']({'where':{'id':_0x5b0151[_0x7149('0x45')]['id']}})['then'](handleEntityNotFound(_0x151658,null))['then'](saveUpdates(_0x5b0151[_0x7149('0x4b')],null))[_0x7149('0x26')](respondWithResult(_0x151658,null))[_0x7149('0x49')](handleError(_0x151658,null));};exports[_0x7149('0x27')]=function(_0x3c5979,_0x4daafe){return db[_0x7149('0x2d')][_0x7149('0x48')]({'where':{'id':_0x3c5979[_0x7149('0x45')]['id']}})[_0x7149('0x26')](handleEntityNotFound(_0x4daafe,null))[_0x7149('0x26')](removeEntity(_0x4daafe,null))[_0x7149('0x49')](handleError(_0x4daafe,null));};exports[_0x7149('0x4d')]=function(_0x371f22,_0x301b8b){return db[_0x7149('0x2d')]['describe']()[_0x7149('0x26')](respondWithResult(_0x301b8b,null))[_0x7149('0x49')](handleError(_0x301b8b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 99186f2..7592eb9 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 _0x7671=['../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x7c3553,_0x58020e){var _0x3d2fc5=function(_0x1197d1){while(--_0x1197d1){_0x7c3553['push'](_0x7c3553['shift']());}};_0x3d2fc5(++_0x58020e);}(_0x7671,0x1d9));var _0x1767=function(_0x192add,_0x4490e4){_0x192add=_0x192add-0x0;var _0x1b9d9d=_0x7671[_0x192add];return _0x1b9d9d;};'use strict';var _=require(_0x1767('0x0'));var util=require(_0x1767('0x1'));var logger=require('../../config/logger')(_0x1767('0x2'));var moment=require(_0x1767('0x3'));var BPromise=require(_0x1767('0x4'));var rp=require(_0x1767('0x5'));var fs=require('fs');var path=require(_0x1767('0x6'));var rimraf=require('rimraf');var config=require(_0x1767('0x7'));var attributes=require(_0x1767('0x8'));module[_0x1767('0x9')]=function(_0xde6673,_0x464b95){return _0xde6673['define'](_0x1767('0xa'),attributes,{'tableName':_0x1767('0xb'),'paranoid':![],'indexes':[{'name':_0x1767('0xc'),'fields':['uniqueid',_0x1767('0xd')]},{'name':_0x1767('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9da=['uniqueid','project_name','leaveAt','lodash','../../config/logger','api','request-promise','path','rimraf','exports','define','SquareReport','report_square','uid_pname'];(function(_0x5b80fb,_0x232d60){var _0x2d29a5=function(_0x50bad3){while(--_0x50bad3){_0x5b80fb['push'](_0x5b80fb['shift']());}};_0x2d29a5(++_0x232d60);}(_0xd9da,0x11b));var _0xad9d=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd9da[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xad9d('0x0'));var util=require('util');var logger=require(_0xad9d('0x1'))(_0xad9d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad9d('0x3'));var fs=require('fs');var path=require(_0xad9d('0x4'));var rimraf=require(_0xad9d('0x5'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0xad9d('0x6')]=function(_0x3b1454,_0x261b71){return _0x3b1454[_0xad9d('0x7')](_0xad9d('0x8'),attributes,{'tableName':_0xad9d('0x9'),'paranoid':![],'indexes':[{'name':_0xad9d('0xa'),'fields':[_0xad9d('0xb'),_0xad9d('0xc')]},{'name':_0xad9d('0xd'),'fields':[_0xad9d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 39c0713..4e4ea22 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 _0xa6cd=['limit','then','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareReport','body','options','raw','UpdateSquareReport','update','where','attributes'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0xa6cd,0x110));var _0xda6c=function(_0x5f1498,_0x1295b2){_0x5f1498=_0x5f1498-0x0;var _0x3db54e=_0xa6cd[_0x5f1498];return _0x3db54e;};'use strict';var _=require(_0xda6c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda6c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda6c('0x2'));var db=require(_0xda6c('0x3'))['db'];var utils=require(_0xda6c('0x4'));var logger=require(_0xda6c('0x5'))('rpc');var config=require(_0xda6c('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14598f,_0x3eb2c6,_0x397dd8){return new BPromise(function(_0x4da0c0,_0x15dfec){return client[_0xda6c('0x7')](_0x14598f,_0x397dd8)['then'](function(_0x45284f){logger[_0xda6c('0x8')](_0xda6c('0x9'),_0x3eb2c6,_0xda6c('0xa'));logger[_0xda6c('0xb')](_0xda6c('0xc'),_0x3eb2c6,_0xda6c('0xa'),JSON[_0xda6c('0xd')](_0x45284f));if(_0x45284f['error']){if(_0x45284f[_0xda6c('0xe')]['code']===0x1f4){logger[_0xda6c('0xe')](_0xda6c('0x9'),_0x3eb2c6,_0x45284f['error'][_0xda6c('0xf')]);return _0x15dfec(_0x45284f[_0xda6c('0xe')]['message']);}logger['error'](_0xda6c('0x9'),_0x3eb2c6,_0x45284f[_0xda6c('0xe')][_0xda6c('0xf')]);return _0x4da0c0(_0x45284f['error'][_0xda6c('0xf')]);}else{logger[_0xda6c('0x8')](_0xda6c('0x9'),_0x3eb2c6,_0xda6c('0xa'));_0x4da0c0(_0x45284f['result']['message']);}})[_0xda6c('0x10')](function(_0x50cd52){logger[_0xda6c('0xe')](_0xda6c('0x9'),_0x3eb2c6,_0x50cd52);_0x15dfec(_0x50cd52);});});}exports[_0xda6c('0x11')]=function(_0x5ee3d8){var _0x5694d9=this;return new Promise(function(_0x1cc1c6,_0x5d215a){return db['SquareReport']['create'](_0x5ee3d8[_0xda6c('0x12')],{'raw':_0x5ee3d8['options']?_0x5ee3d8[_0xda6c('0x13')][_0xda6c('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x43d691){logger[_0xda6c('0x8')](_0xda6c('0x11'),_0x5ee3d8);logger[_0xda6c('0xb')](_0xda6c('0x11'),_0x5ee3d8,JSON[_0xda6c('0xd')](_0x43d691));_0x1cc1c6(_0x43d691);})['catch'](function(_0x329b57){logger[_0xda6c('0xe')](_0xda6c('0x11'),_0x329b57[_0xda6c('0xf')],_0x5ee3d8);_0x5d215a(_0x5694d9[_0xda6c('0xe')](0x1f4,_0x329b57[_0xda6c('0xf')]));});});};exports[_0xda6c('0x15')]=function(_0x4d2931){var _0x447ab5=this;return new Promise(function(_0x4e901f,_0x1db895){return db['SquareReport'][_0xda6c('0x16')](_0x4d2931[_0xda6c('0x12')],{'raw':_0x4d2931[_0xda6c('0x13')]?_0x4d2931[_0xda6c('0x13')][_0xda6c('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d2931[_0xda6c('0x13')]?_0x4d2931['options'][_0xda6c('0x17')]||null:null,'attributes':_0x4d2931[_0xda6c('0x13')]?_0x4d2931[_0xda6c('0x13')][_0xda6c('0x18')]||null:null,'limit':_0x4d2931[_0xda6c('0x13')]?_0x4d2931[_0xda6c('0x13')][_0xda6c('0x19')]||null:null})[_0xda6c('0x1a')](function(_0x5722d0){logger[_0xda6c('0x8')](_0xda6c('0x15'),_0x4d2931);logger[_0xda6c('0xb')](_0xda6c('0x15'),_0x4d2931,JSON['stringify'](_0x5722d0));_0x4e901f(_0x5722d0);})[_0xda6c('0x10')](function(_0x182eb7){logger[_0xda6c('0xe')](_0xda6c('0x15'),_0x182eb7[_0xda6c('0xf')],_0x4d2931);_0x1db895(_0x447ab5[_0xda6c('0xe')](0x1f4,_0x182eb7[_0xda6c('0xf')]));});});}; \ No newline at end of file +var _0x03ca=['message','catch','CreateSquareReport','SquareReport','create','body','options','update','where','attributes','UpdateSquareReport','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x03ca,0x1db));var _0xa03c=function(_0x4a85f0,_0x574958){_0x4a85f0=_0x4a85f0-0x0;var _0x16cdb5=_0x03ca[_0x4a85f0];return _0x16cdb5;};'use strict';var _=require('lodash');var util=require(_0xa03c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa03c('0x1'));var fs=require('fs');var Redis=require(_0xa03c('0x2'));var db=require(_0xa03c('0x3'))['db'];var utils=require(_0xa03c('0x4'));var logger=require('../../config/logger')(_0xa03c('0x5'));var config=require(_0xa03c('0x6'));var jayson=require(_0xa03c('0x7'));var client=jayson[_0xa03c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x373383,_0x54439a,_0x4c3f1c){return new BPromise(function(_0x4423ca,_0x4a8341){return client['request'](_0x373383,_0x4c3f1c)[_0xa03c('0x9')](function(_0x1166b5){logger[_0xa03c('0xa')]('SquareReport,\x20%s,\x20%s',_0x54439a,_0xa03c('0xb'));logger[_0xa03c('0xc')](_0xa03c('0xd'),_0x54439a,_0xa03c('0xb'),JSON[_0xa03c('0xe')](_0x1166b5));if(_0x1166b5['error']){if(_0x1166b5[_0xa03c('0xf')][_0xa03c('0x10')]===0x1f4){logger[_0xa03c('0xf')](_0xa03c('0x11'),_0x54439a,_0x1166b5[_0xa03c('0xf')][_0xa03c('0x12')]);return _0x4a8341(_0x1166b5[_0xa03c('0xf')][_0xa03c('0x12')]);}logger[_0xa03c('0xf')](_0xa03c('0x11'),_0x54439a,_0x1166b5[_0xa03c('0xf')][_0xa03c('0x12')]);return _0x4423ca(_0x1166b5[_0xa03c('0xf')][_0xa03c('0x12')]);}else{logger[_0xa03c('0xa')](_0xa03c('0x11'),_0x54439a,_0xa03c('0xb'));_0x4423ca(_0x1166b5['result'][_0xa03c('0x12')]);}})[_0xa03c('0x13')](function(_0x57f085){logger[_0xa03c('0xf')](_0xa03c('0x11'),_0x54439a,_0x57f085);_0x4a8341(_0x57f085);});});}exports[_0xa03c('0x14')]=function(_0x5eabaa){var _0x5d5b9a=this;return new Promise(function(_0x5db67a,_0x42854a){return db[_0xa03c('0x15')][_0xa03c('0x16')](_0x5eabaa[_0xa03c('0x17')],{'raw':_0x5eabaa['options']?_0x5eabaa[_0xa03c('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xa03c('0x9')](function(_0x368e12){logger[_0xa03c('0xa')](_0xa03c('0x14'),_0x5eabaa);logger['debug'](_0xa03c('0x14'),_0x5eabaa,JSON[_0xa03c('0xe')](_0x368e12));_0x5db67a(_0x368e12);})['catch'](function(_0x4a67cb){logger[_0xa03c('0xf')](_0xa03c('0x14'),_0x4a67cb[_0xa03c('0x12')],_0x5eabaa);_0x42854a(_0x5d5b9a[_0xa03c('0xf')](0x1f4,_0x4a67cb[_0xa03c('0x12')]));});});};exports['UpdateSquareReport']=function(_0x5888f5){var _0x244737=this;return new Promise(function(_0x3f82d7,_0x5f0232){return db[_0xa03c('0x15')][_0xa03c('0x19')](_0x5888f5[_0xa03c('0x17')],{'raw':_0x5888f5['options']?_0x5888f5[_0xa03c('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5888f5['options']?_0x5888f5['options'][_0xa03c('0x1a')]||null:null,'attributes':_0x5888f5[_0xa03c('0x18')]?_0x5888f5['options'][_0xa03c('0x1b')]||null:null,'limit':_0x5888f5[_0xa03c('0x18')]?_0x5888f5[_0xa03c('0x18')]['limit']||null:null})[_0xa03c('0x9')](function(_0x2e5195){logger[_0xa03c('0xa')]('UpdateSquareReport',_0x5888f5);logger[_0xa03c('0xc')](_0xa03c('0x1c'),_0x5888f5,JSON[_0xa03c('0xe')](_0x2e5195));_0x3f82d7(_0x2e5195);})[_0xa03c('0x13')](function(_0x213e32){logger[_0xa03c('0xf')](_0xa03c('0x1c'),_0x213e32['message'],_0x5888f5);_0x5f0232(_0x244737[_0xa03c('0xf')](0x1f4,_0x213e32['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index bbb2c81..389ad7c 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 _0x6a10=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6a10,0x6a));var _0x06a1=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x6a10[_0x3c8e9a];return _0x2d4c57;};'use strict';var multer=require(_0x06a1('0x0'));var util=require(_0x06a1('0x1'));var path=require(_0x06a1('0x2'));var timeout=require(_0x06a1('0x3'));var express=require(_0x06a1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x06a1('0x5'));var interaction=require(_0x06a1('0x6'));var config=require(_0x06a1('0x7'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x06a1('0x8')](),controller[_0x06a1('0x9')]);router[_0x06a1('0xa')](_0x06a1('0xb'),auth[_0x06a1('0x8')](),controller[_0x06a1('0xc')]);router[_0x06a1('0xa')]('/:id',auth[_0x06a1('0x8')](),controller['show']);router['post']('/',auth[_0x06a1('0x8')](),controller[_0x06a1('0xd')]);router[_0x06a1('0xe')](_0x06a1('0xf'),auth[_0x06a1('0x8')](),controller[_0x06a1('0x10')]);router[_0x06a1('0x11')](_0x06a1('0xf'),auth[_0x06a1('0x8')](),controller[_0x06a1('0x12')]);module[_0x06a1('0x13')]=router; \ No newline at end of file +var _0x9d01=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x8276f2,_0x4024aa){var _0x3c5da0=function(_0x499443){while(--_0x499443){_0x8276f2['push'](_0x8276f2['shift']());}};_0x3c5da0(++_0x4024aa);}(_0x9d01,0xe4));var _0x19d0=function(_0x282a1e,_0x4dd4db){_0x282a1e=_0x282a1e-0x0;var _0x460b6c=_0x9d01[_0x282a1e];return _0x460b6c;};'use strict';var multer=require('multer');var util=require(_0x19d0('0x0'));var path=require('path');var timeout=require(_0x19d0('0x1'));var express=require(_0x19d0('0x2'));var router=express[_0x19d0('0x3')]();var fs_extra=require(_0x19d0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x19d0('0x5'));var config=require(_0x19d0('0x6'));var controller=require('./squareReportDetail.controller');router[_0x19d0('0x7')]('/',auth['isAuthenticated'](),controller[_0x19d0('0x8')]);router['get']('/describe',auth[_0x19d0('0x9')](),controller[_0x19d0('0xa')]);router[_0x19d0('0x7')](_0x19d0('0xb'),auth[_0x19d0('0x9')](),controller['show']);router[_0x19d0('0xc')]('/',auth[_0x19d0('0x9')](),controller[_0x19d0('0xd')]);router[_0x19d0('0xe')](_0x19d0('0xb'),auth['isAuthenticated'](),controller[_0x19d0('0xf')]);router[_0x19d0('0x10')](_0x19d0('0xb'),auth['isAuthenticated'](),controller[_0x19d0('0x11')]);module[_0x19d0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 48e7477..c9a1891 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 _0xd5cc=['exports','STRING','TEXT','sequelize'];(function(_0x4936f9,_0x30b15c){var _0xfc53b7=function(_0x23f3a7){while(--_0x23f3a7){_0x4936f9['push'](_0x4936f9['shift']());}};_0xfc53b7(++_0x30b15c);}(_0xd5cc,0xbb));var _0xcd5c=function(_0x31f431,_0x1002be){_0x31f431=_0x31f431-0x0;var _0x1a6956=_0xd5cc[_0x31f431];return _0x1a6956;};'use strict';var Sequelize=require(_0xcd5c('0x0'));module[_0xcd5c('0x1')]={'uniqueid':{'type':Sequelize[_0xcd5c('0x2')]},'node':{'type':Sequelize[_0xcd5c('0x2')]},'application':{'type':Sequelize[_0xcd5c('0x2')]},'data':{'type':Sequelize[_0xcd5c('0x3')]},'project_name':{'type':Sequelize[_0xcd5c('0x2')]},'callerid':{'type':Sequelize[_0xcd5c('0x2')]}}; \ No newline at end of file +var _0x6b9b=['sequelize','exports','STRING'];(function(_0x1936cc,_0x81e11){var _0x5d227a=function(_0x11eb8b){while(--_0x11eb8b){_0x1936cc['push'](_0x1936cc['shift']());}};_0x5d227a(++_0x81e11);}(_0x6b9b,0x156));var _0xb6b9=function(_0xaaddf6,_0x57eb6f){_0xaaddf6=_0xaaddf6-0x0;var _0xed0b7f=_0x6b9b[_0xaaddf6];return _0xed0b7f;};'use strict';var Sequelize=require(_0xb6b9('0x0'));module[_0xb6b9('0x1')]={'uniqueid':{'type':Sequelize[_0xb6b9('0x2')]},'node':{'type':Sequelize[_0xb6b9('0x2')]},'application':{'type':Sequelize[_0xb6b9('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xb6b9('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index d1d90ef..aa9d30e 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 _0x2b65=['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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0x2b65,0x131));var _0x52b6=function(_0x1353bc,_0x432b07){_0x1353bc=_0x1353bc-0x0;var _0x3097a6=_0x2b65[_0x1353bc];return _0x3097a6;};'use strict';var emlformat=require(_0x52b6('0x0'));var rimraf=require(_0x52b6('0x1'));var zipdir=require(_0x52b6('0x2'));var jsonpatch=require(_0x52b6('0x3'));var rp=require(_0x52b6('0x4'));var moment=require(_0x52b6('0x5'));var BPromise=require(_0x52b6('0x6'));var Mustache=require(_0x52b6('0x7'));var util=require('util');var path=require(_0x52b6('0x8'));var sox=require(_0x52b6('0x9'));var csv=require(_0x52b6('0xa'));var ejs=require(_0x52b6('0xb'));var fs=require('fs');var fs_extra=require(_0x52b6('0xc'));var _=require(_0x52b6('0xd'));var squel=require(_0x52b6('0xe'));var crypto=require(_0x52b6('0xf'));var jsforce=require(_0x52b6('0x10'));var deskjs=require(_0x52b6('0x11'));var toCsv=require('to-csv');var querystring=require(_0x52b6('0x12'));var Papa=require(_0x52b6('0x13'));var Redis=require(_0x52b6('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x52b6('0x15'));var as=require(_0x52b6('0x16'));var hardwareService=require(_0x52b6('0x17'));var logger=require(_0x52b6('0x18'))('api');var utils=require(_0x52b6('0x19'));var config=require(_0x52b6('0x1a'));var licenseUtil=require(_0x52b6('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x247d40,_0xc7ccc2){_0xc7ccc2=_0xc7ccc2||0xcc;return function(_0x5292e4){if(_0x5292e4){return _0x247d40[_0x52b6('0x1c')](_0xc7ccc2);}return _0x247d40['status'](_0xc7ccc2)['end']();};}function respondWithResult(_0x2b8de5,_0x911df9){_0x911df9=_0x911df9||0xc8;return function(_0x982e14){if(_0x982e14){return _0x2b8de5[_0x52b6('0x1d')](_0x911df9)[_0x52b6('0x1e')](_0x982e14);}};}function respondWithFilteredResult(_0x1bc871,_0x383803){return function(_0x297417){if(_0x297417){var _0x1ab3f5=typeof _0x383803[_0x52b6('0x1f')]===_0x52b6('0x20')&&typeof _0x383803[_0x52b6('0x21')]===_0x52b6('0x20');var _0x47aade=_0x297417[_0x52b6('0x22')];var _0x2fa3ed=_0x1ab3f5?0x0:_0x383803[_0x52b6('0x1f')];var _0x47d203=_0x1ab3f5?_0x297417[_0x52b6('0x22')]:_0x383803[_0x52b6('0x1f')]+_0x383803['limit'];var _0x4821e3;if(_0x47d203>=_0x47aade){_0x47d203=_0x47aade;_0x4821e3=0xc8;}else{_0x4821e3=0xce;}_0x1bc871[_0x52b6('0x1d')](_0x4821e3);return _0x1bc871['set'](_0x52b6('0x23'),_0x2fa3ed+'-'+_0x47d203+'/'+_0x47aade)['json'](_0x297417);}return null;};}function patchUpdates(_0x2e472f){return function(_0xc3aa84){try{jsonpatch[_0x52b6('0x24')](_0xc3aa84,_0x2e472f,!![]);}catch(_0x15472e){return BPromise['reject'](_0x15472e);}return _0xc3aa84[_0x52b6('0x25')]();};}function saveUpdates(_0x364b0a,_0x1246db){return function(_0x3c0f76){if(_0x3c0f76){return _0x3c0f76[_0x52b6('0x26')](_0x364b0a)[_0x52b6('0x27')](function(_0xf1c324){return _0xf1c324;});}return null;};}function removeEntity(_0x272d07,_0x16e7fc){return function(_0x55aa4c){if(_0x55aa4c){return _0x55aa4c[_0x52b6('0x28')]()[_0x52b6('0x27')](function(){_0x272d07[_0x52b6('0x1d')](0xcc)[_0x52b6('0x29')]();});}};}function handleEntityNotFound(_0x81012,_0x858f84){return function(_0x1a87a2){if(!_0x1a87a2){_0x81012[_0x52b6('0x1c')](0x194);}return _0x1a87a2;};}function handleError(_0xa971b,_0x3d9072){_0x3d9072=_0x3d9072||0x1f4;return function(_0x396e80){logger[_0x52b6('0x2a')](_0x396e80[_0x52b6('0x2b')]);if(_0x396e80[_0x52b6('0x2c')]){delete _0x396e80[_0x52b6('0x2c')];}_0xa971b[_0x52b6('0x1d')](_0x3d9072)['send'](_0x396e80);};}exports[_0x52b6('0x2d')]=function(_0x14feb5,_0x1716b6){var _0x92fe9e={},_0x3f03b7={},_0x31e71a={'count':0x0,'rows':[]};var _0x2e415b=_['map'](db[_0x52b6('0x2e')][_0x52b6('0x2f')],function(_0x5a1bc3){return{'name':_0x5a1bc3[_0x52b6('0x30')],'type':_0x5a1bc3[_0x52b6('0x31')][_0x52b6('0x32')]};});_0x3f03b7[_0x52b6('0x33')]=_[_0x52b6('0x34')](_0x2e415b,'name');_0x3f03b7[_0x52b6('0x35')]=_['keys'](_0x14feb5[_0x52b6('0x35')]);_0x3f03b7[_0x52b6('0x36')]=_[_0x52b6('0x37')](_0x3f03b7[_0x52b6('0x33')],_0x3f03b7[_0x52b6('0x35')]);_0x92fe9e[_0x52b6('0x38')]=_['intersection'](_0x3f03b7[_0x52b6('0x33')],qs[_0x52b6('0x39')](_0x14feb5[_0x52b6('0x35')]['fields']));_0x92fe9e['attributes']=_0x92fe9e[_0x52b6('0x38')][_0x52b6('0x3a')]?_0x92fe9e['attributes']:_0x3f03b7[_0x52b6('0x33')];if(!_0x14feb5[_0x52b6('0x35')][_0x52b6('0x3b')](_0x52b6('0x3c'))){_0x92fe9e[_0x52b6('0x21')]=qs[_0x52b6('0x21')](_0x14feb5[_0x52b6('0x35')][_0x52b6('0x21')]);_0x92fe9e[_0x52b6('0x1f')]=qs[_0x52b6('0x1f')](_0x14feb5[_0x52b6('0x35')][_0x52b6('0x1f')]);}_0x92fe9e['order']=qs[_0x52b6('0x3d')](_0x14feb5[_0x52b6('0x35')][_0x52b6('0x3d')]);_0x92fe9e[_0x52b6('0x3e')]=qs[_0x52b6('0x36')](_['pick'](_0x14feb5['query'],_0x3f03b7[_0x52b6('0x36')]),_0x2e415b);if(_0x14feb5[_0x52b6('0x35')]['filter']){_0x92fe9e['where']=_[_0x52b6('0x3f')](_0x92fe9e['where'],{'$or':_['map'](_0x2e415b,function(_0x59aea9){if(_0x59aea9[_0x52b6('0x31')]!==_0x52b6('0x40')){var _0x12d466={};_0x12d466[_0x59aea9[_0x52b6('0x2c')]]={'$like':'%'+_0x14feb5[_0x52b6('0x35')][_0x52b6('0x41')]+'%'};return _0x12d466;}})});}_0x92fe9e=_[_0x52b6('0x3f')]({},_0x92fe9e,_0x14feb5[_0x52b6('0x42')]);var _0x592437={'where':_0x92fe9e[_0x52b6('0x3e')]};return db[_0x52b6('0x2e')]['count'](_0x592437)[_0x52b6('0x27')](function(_0x3b9f61){_0x31e71a[_0x52b6('0x22')]=_0x3b9f61;if(_0x14feb5[_0x52b6('0x35')][_0x52b6('0x43')]){_0x92fe9e[_0x52b6('0x44')]=[{'all':!![]}];}return db[_0x52b6('0x2e')][_0x52b6('0x45')](_0x92fe9e);})['then'](function(_0x1dc759){_0x31e71a[_0x52b6('0x46')]=_0x1dc759;return _0x31e71a;})[_0x52b6('0x27')](respondWithFilteredResult(_0x1716b6,_0x92fe9e))[_0x52b6('0x47')](handleError(_0x1716b6,null));};exports['show']=function(_0x3e92b4,_0xbc0117){var _0x4c3303={'raw':!![],'where':{'id':_0x3e92b4[_0x52b6('0x48')]['id']}},_0x236d60={};_0x236d60[_0x52b6('0x33')]=_[_0x52b6('0x49')](db[_0x52b6('0x2e')][_0x52b6('0x2f')]);_0x236d60[_0x52b6('0x35')]=_[_0x52b6('0x49')](_0x3e92b4[_0x52b6('0x35')]);_0x236d60[_0x52b6('0x36')]=_[_0x52b6('0x37')](_0x236d60[_0x52b6('0x33')],_0x236d60[_0x52b6('0x35')]);_0x4c3303[_0x52b6('0x38')]=_[_0x52b6('0x37')](_0x236d60[_0x52b6('0x33')],qs['fields'](_0x3e92b4['query']['fields']));_0x4c3303['attributes']=_0x4c3303[_0x52b6('0x38')][_0x52b6('0x3a')]?_0x4c3303[_0x52b6('0x38')]:_0x236d60[_0x52b6('0x33')];if(_0x3e92b4['query'][_0x52b6('0x43')]){_0x4c3303[_0x52b6('0x44')]=[{'all':!![]}];}_0x4c3303=_[_0x52b6('0x3f')]({},_0x4c3303,_0x3e92b4[_0x52b6('0x42')]);return db[_0x52b6('0x2e')][_0x52b6('0x4a')](_0x4c3303)['then'](handleEntityNotFound(_0xbc0117,null))[_0x52b6('0x27')](respondWithResult(_0xbc0117,null))[_0x52b6('0x47')](handleError(_0xbc0117,null));};exports[_0x52b6('0x4b')]=function(_0x29e11a,_0x361acf){return db[_0x52b6('0x2e')][_0x52b6('0x4b')](_0x29e11a[_0x52b6('0x4c')],{})[_0x52b6('0x27')](respondWithResult(_0x361acf,0xc9))[_0x52b6('0x47')](handleError(_0x361acf,null));};exports[_0x52b6('0x26')]=function(_0x42182a,_0x39a0e3){if(_0x42182a[_0x52b6('0x4c')]['id']){delete _0x42182a['body']['id'];}return db[_0x52b6('0x2e')][_0x52b6('0x4a')]({'where':{'id':_0x42182a[_0x52b6('0x48')]['id']}})[_0x52b6('0x27')](handleEntityNotFound(_0x39a0e3,null))[_0x52b6('0x27')](saveUpdates(_0x42182a[_0x52b6('0x4c')],null))[_0x52b6('0x27')](respondWithResult(_0x39a0e3,null))[_0x52b6('0x47')](handleError(_0x39a0e3,null));};exports['destroy']=function(_0x533784,_0x388fbe){return db[_0x52b6('0x2e')][_0x52b6('0x4a')]({'where':{'id':_0x533784[_0x52b6('0x48')]['id']}})[_0x52b6('0x27')](handleEntityNotFound(_0x388fbe,null))[_0x52b6('0x27')](removeEntity(_0x388fbe,null))[_0x52b6('0x47')](handleError(_0x388fbe,null));};exports[_0x52b6('0x4d')]=function(_0x183498,_0x3d8da1){return db[_0x52b6('0x2e')][_0x52b6('0x4d')]()[_0x52b6('0x27')](respondWithResult(_0x3d8da1,null))['catch'](handleError(_0x3d8da1,null));}; \ No newline at end of file +var _0x1409=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe'];(function(_0x556720,_0x13ded5){var _0x11a0ea=function(_0x5812fc){while(--_0x5812fc){_0x556720['push'](_0x556720['shift']());}};_0x11a0ea(++_0x13ded5);}(_0x1409,0x1e6));var _0x9140=function(_0x392a4e,_0x29d79c){_0x392a4e=_0x392a4e-0x0;var _0x1b9e27=_0x1409[_0x392a4e];return _0x1b9e27;};'use strict';var emlformat=require(_0x9140('0x0'));var rimraf=require(_0x9140('0x1'));var zipdir=require(_0x9140('0x2'));var jsonpatch=require(_0x9140('0x3'));var rp=require(_0x9140('0x4'));var moment=require(_0x9140('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9140('0x6'));var path=require(_0x9140('0x7'));var sox=require('sox');var csv=require(_0x9140('0x8'));var ejs=require(_0x9140('0x9'));var fs=require('fs');var fs_extra=require(_0x9140('0xa'));var _=require(_0x9140('0xb'));var squel=require(_0x9140('0xc'));var crypto=require(_0x9140('0xd'));var jsforce=require(_0x9140('0xe'));var deskjs=require(_0x9140('0xf'));var toCsv=require(_0x9140('0x8'));var querystring=require(_0x9140('0x10'));var Papa=require(_0x9140('0x11'));var Redis=require(_0x9140('0x12'));var authService=require(_0x9140('0x13'));var qs=require(_0x9140('0x14'));var as=require(_0x9140('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9140('0x16'))(_0x9140('0x17'));var utils=require(_0x9140('0x18'));var config=require(_0x9140('0x19'));var licenseUtil=require(_0x9140('0x1a'));var db=require(_0x9140('0x1b'))['db'];function respondWithStatusCode(_0xc363ce,_0x57466b){_0x57466b=_0x57466b||0xcc;return function(_0x2a9961){if(_0x2a9961){return _0xc363ce[_0x9140('0x1c')](_0x57466b);}return _0xc363ce[_0x9140('0x1d')](_0x57466b)[_0x9140('0x1e')]();};}function respondWithResult(_0x2ffe69,_0x1aed0f){_0x1aed0f=_0x1aed0f||0xc8;return function(_0x4811fd){if(_0x4811fd){return _0x2ffe69[_0x9140('0x1d')](_0x1aed0f)[_0x9140('0x1f')](_0x4811fd);}};}function respondWithFilteredResult(_0x590ea8,_0x450417){return function(_0x4f8291){if(_0x4f8291){var _0xe07181=typeof _0x450417[_0x9140('0x20')]===_0x9140('0x21')&&typeof _0x450417[_0x9140('0x22')]===_0x9140('0x21');var _0x7489e2=_0x4f8291[_0x9140('0x23')];var _0x30452c=_0xe07181?0x0:_0x450417[_0x9140('0x20')];var _0x8bb9ac=_0xe07181?_0x4f8291['count']:_0x450417[_0x9140('0x20')]+_0x450417['limit'];var _0x54618a;if(_0x8bb9ac>=_0x7489e2){_0x8bb9ac=_0x7489e2;_0x54618a=0xc8;}else{_0x54618a=0xce;}_0x590ea8['status'](_0x54618a);return _0x590ea8[_0x9140('0x24')](_0x9140('0x25'),_0x30452c+'-'+_0x8bb9ac+'/'+_0x7489e2)[_0x9140('0x1f')](_0x4f8291);}return null;};}function patchUpdates(_0x59eb2a){return function(_0x72f6e4){try{jsonpatch[_0x9140('0x26')](_0x72f6e4,_0x59eb2a,!![]);}catch(_0x5bd69e){return BPromise[_0x9140('0x27')](_0x5bd69e);}return _0x72f6e4[_0x9140('0x28')]();};}function saveUpdates(_0x35efdd,_0xb1a08e){return function(_0x17a29c){if(_0x17a29c){return _0x17a29c[_0x9140('0x29')](_0x35efdd)[_0x9140('0x2a')](function(_0x5ec67e){return _0x5ec67e;});}return null;};}function removeEntity(_0x4ec0e8,_0x500c38){return function(_0x14e2ec){if(_0x14e2ec){return _0x14e2ec[_0x9140('0x2b')]()[_0x9140('0x2a')](function(){_0x4ec0e8['status'](0xcc)[_0x9140('0x1e')]();});}};}function handleEntityNotFound(_0x3797df,_0x3c3831){return function(_0x11d8e7){if(!_0x11d8e7){_0x3797df[_0x9140('0x1c')](0x194);}return _0x11d8e7;};}function handleError(_0x476e03,_0x526ad4){_0x526ad4=_0x526ad4||0x1f4;return function(_0x34624c){logger[_0x9140('0x2c')](_0x34624c[_0x9140('0x2d')]);if(_0x34624c[_0x9140('0x2e')]){delete _0x34624c[_0x9140('0x2e')];}_0x476e03['status'](_0x526ad4)[_0x9140('0x2f')](_0x34624c);};}exports[_0x9140('0x30')]=function(_0x58384a,_0x1293b5){var _0x1527be={},_0x2f5be4={},_0x106a87={'count':0x0,'rows':[]};var _0xe8cf34=_['map'](db[_0x9140('0x31')][_0x9140('0x32')],function(_0x5a2bdb){return{'name':_0x5a2bdb[_0x9140('0x33')],'type':_0x5a2bdb[_0x9140('0x34')]['key']};});_0x2f5be4[_0x9140('0x35')]=_[_0x9140('0x36')](_0xe8cf34,'name');_0x2f5be4['query']=_['keys'](_0x58384a[_0x9140('0x37')]);_0x2f5be4[_0x9140('0x38')]=_[_0x9140('0x39')](_0x2f5be4[_0x9140('0x35')],_0x2f5be4[_0x9140('0x37')]);_0x1527be[_0x9140('0x3a')]=_[_0x9140('0x39')](_0x2f5be4[_0x9140('0x35')],qs['fields'](_0x58384a['query'][_0x9140('0x3b')]));_0x1527be[_0x9140('0x3a')]=_0x1527be[_0x9140('0x3a')][_0x9140('0x3c')]?_0x1527be[_0x9140('0x3a')]:_0x2f5be4['model'];if(!_0x58384a[_0x9140('0x37')][_0x9140('0x3d')](_0x9140('0x3e'))){_0x1527be[_0x9140('0x22')]=qs['limit'](_0x58384a[_0x9140('0x37')][_0x9140('0x22')]);_0x1527be[_0x9140('0x20')]=qs[_0x9140('0x20')](_0x58384a[_0x9140('0x37')][_0x9140('0x20')]);}_0x1527be[_0x9140('0x3f')]=qs[_0x9140('0x40')](_0x58384a[_0x9140('0x37')]['sort']);_0x1527be[_0x9140('0x41')]=qs['filters'](_[_0x9140('0x42')](_0x58384a[_0x9140('0x37')],_0x2f5be4[_0x9140('0x38')]),_0xe8cf34);if(_0x58384a[_0x9140('0x37')][_0x9140('0x43')]){_0x1527be[_0x9140('0x41')]=_['merge'](_0x1527be[_0x9140('0x41')],{'$or':_[_0x9140('0x36')](_0xe8cf34,function(_0xcb299e){if(_0xcb299e[_0x9140('0x34')]!==_0x9140('0x44')){var _0x211c0e={};_0x211c0e[_0xcb299e[_0x9140('0x2e')]]={'$like':'%'+_0x58384a[_0x9140('0x37')][_0x9140('0x43')]+'%'};return _0x211c0e;}})});}_0x1527be=_[_0x9140('0x45')]({},_0x1527be,_0x58384a[_0x9140('0x46')]);var _0xed7044={'where':_0x1527be['where']};return db['SquareDetailsReport'][_0x9140('0x23')](_0xed7044)[_0x9140('0x2a')](function(_0x2ae285){_0x106a87[_0x9140('0x23')]=_0x2ae285;if(_0x58384a[_0x9140('0x37')][_0x9140('0x47')]){_0x1527be[_0x9140('0x48')]=[{'all':!![]}];}return db[_0x9140('0x31')][_0x9140('0x49')](_0x1527be);})[_0x9140('0x2a')](function(_0x17207a){_0x106a87['rows']=_0x17207a;return _0x106a87;})['then'](respondWithFilteredResult(_0x1293b5,_0x1527be))[_0x9140('0x4a')](handleError(_0x1293b5,null));};exports[_0x9140('0x4b')]=function(_0x2578fd,_0x4147fc){var _0x4055f2={'raw':!![],'where':{'id':_0x2578fd[_0x9140('0x4c')]['id']}},_0x57d33f={};_0x57d33f[_0x9140('0x35')]=_['keys'](db['SquareDetailsReport'][_0x9140('0x32')]);_0x57d33f[_0x9140('0x37')]=_['keys'](_0x2578fd[_0x9140('0x37')]);_0x57d33f[_0x9140('0x38')]=_['intersection'](_0x57d33f[_0x9140('0x35')],_0x57d33f['query']);_0x4055f2[_0x9140('0x3a')]=_['intersection'](_0x57d33f[_0x9140('0x35')],qs[_0x9140('0x3b')](_0x2578fd['query'][_0x9140('0x3b')]));_0x4055f2[_0x9140('0x3a')]=_0x4055f2[_0x9140('0x3a')][_0x9140('0x3c')]?_0x4055f2[_0x9140('0x3a')]:_0x57d33f[_0x9140('0x35')];if(_0x2578fd[_0x9140('0x37')]['includeAll']){_0x4055f2[_0x9140('0x48')]=[{'all':!![]}];}_0x4055f2=_['merge']({},_0x4055f2,_0x2578fd['options']);return db[_0x9140('0x31')][_0x9140('0x4d')](_0x4055f2)[_0x9140('0x2a')](handleEntityNotFound(_0x4147fc,null))[_0x9140('0x2a')](respondWithResult(_0x4147fc,null))[_0x9140('0x4a')](handleError(_0x4147fc,null));};exports['create']=function(_0x47292e,_0x5029e5){return db[_0x9140('0x31')][_0x9140('0x4e')](_0x47292e[_0x9140('0x4f')],{})[_0x9140('0x2a')](respondWithResult(_0x5029e5,0xc9))['catch'](handleError(_0x5029e5,null));};exports['update']=function(_0x346900,_0x9606e4){if(_0x346900[_0x9140('0x4f')]['id']){delete _0x346900[_0x9140('0x4f')]['id'];}return db['SquareDetailsReport'][_0x9140('0x4d')]({'where':{'id':_0x346900['params']['id']}})[_0x9140('0x2a')](handleEntityNotFound(_0x9606e4,null))['then'](saveUpdates(_0x346900[_0x9140('0x4f')],null))[_0x9140('0x2a')](respondWithResult(_0x9606e4,null))[_0x9140('0x4a')](handleError(_0x9606e4,null));};exports[_0x9140('0x2b')]=function(_0x52d5b7,_0xa8ef8b){return db[_0x9140('0x31')]['find']({'where':{'id':_0x52d5b7[_0x9140('0x4c')]['id']}})[_0x9140('0x2a')](handleEntityNotFound(_0xa8ef8b,null))[_0x9140('0x2a')](removeEntity(_0xa8ef8b,null))['catch'](handleError(_0xa8ef8b,null));};exports[_0x9140('0x50')]=function(_0x48a316,_0x1be9ed){return db[_0x9140('0x31')][_0x9140('0x50')]()[_0x9140('0x2a')](respondWithResult(_0x1be9ed,null))[_0x9140('0x4a')](handleError(_0x1be9ed,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ac8defb..a98a282 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 _0xa944=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details'];(function(_0x334eae,_0x100379){var _0x279c84=function(_0x14dc78){while(--_0x14dc78){_0x334eae['push'](_0x334eae['shift']());}};_0x279c84(++_0x100379);}(_0xa944,0xaa));var _0x4a94=function(_0x41013b,_0x428de5){_0x41013b=_0x41013b-0x0;var _0x3f9601=_0xa944[_0x41013b];return _0x3f9601;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4a94('0x0'))('api');var moment=require(_0x4a94('0x1'));var BPromise=require(_0x4a94('0x2'));var rp=require(_0x4a94('0x3'));var fs=require('fs');var path=require(_0x4a94('0x4'));var rimraf=require(_0x4a94('0x5'));var config=require('../../config/environment');var attributes=require(_0x4a94('0x6'));module[_0x4a94('0x7')]=function(_0x5c436a,_0x3247b7){return _0x5c436a['define'](_0x4a94('0x8'),attributes,{'tableName':_0x4a94('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x253d=['report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','define','SquareDetailsReport'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x253d,0x112));var _0xd253=function(_0x599e89,_0xe66eb1){_0x599e89=_0x599e89-0x0;var _0x2f74d6=_0x253d[_0x599e89];return _0x2f74d6;};'use strict';var _=require(_0xd253('0x0'));var util=require(_0xd253('0x1'));var logger=require(_0xd253('0x2'))(_0xd253('0x3'));var moment=require(_0xd253('0x4'));var BPromise=require(_0xd253('0x5'));var rp=require(_0xd253('0x6'));var fs=require('fs');var path=require(_0xd253('0x7'));var rimraf=require(_0xd253('0x8'));var config=require('../../config/environment');var attributes=require(_0xd253('0x9'));module['exports']=function(_0x4209b0,_0x22da63){return _0x4209b0[_0xd253('0xa')](_0xd253('0xb'),attributes,{'tableName':_0xd253('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 45dc731..120ae76 100644 --- a/server/api/squareReportDetail/squareReportDetail.rpc.js +++ b/server/api/squareReportDetail/squareReportDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b7f=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','SquareDetailsReport,\x20%s,\x20%s','message','request\x20sent','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','stringify','catch','lodash','util','bluebird'];(function(_0x49a785,_0xe609b3){var _0x517712=function(_0x13df3f){while(--_0x13df3f){_0x49a785['push'](_0x49a785['shift']());}};_0x517712(++_0xe609b3);}(_0x0b7f,0x115));var _0xf0b7=function(_0x212009,_0x4be73a){_0x212009=_0x212009-0x0;var _0x2ee852=_0x0b7f[_0x212009];return _0x2ee852;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b7('0x3'));var db=require(_0xf0b7('0x4'))['db'];var utils=require(_0xf0b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0b7('0x6'));var jayson=require(_0xf0b7('0x7'));var client=jayson[_0xf0b7('0x8')][_0xf0b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2de8,_0x5e449a,_0x1408ee){return new BPromise(function(_0x276f09,_0x275a13){return client[_0xf0b7('0xa')](_0x2b2de8,_0x1408ee)[_0xf0b7('0xb')](function(_0x588b46){logger[_0xf0b7('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x5e449a,'request\x20sent');logger['debug'](_0xf0b7('0xd'),_0x5e449a,'request\x20sent',JSON['stringify'](_0x588b46));if(_0x588b46[_0xf0b7('0xe')]){if(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0xf')]===0x1f4){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x275a13(_0x588b46[_0xf0b7('0xe')]['message']);}logger['error'](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x276f09(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);}else{logger['info'](_0xf0b7('0x10'),_0x5e449a,_0xf0b7('0x12'));_0x276f09(_0x588b46[_0xf0b7('0x13')][_0xf0b7('0x11')]);}})['catch'](function(_0x303db6){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x303db6);_0x275a13(_0x303db6);});});}exports[_0xf0b7('0x14')]=function(_0x52b27e){var _0x1e5fc9=this;return new Promise(function(_0x153d23,_0x28fd36){return db[_0xf0b7('0x15')][_0xf0b7('0x16')](_0x52b27e['body'],{'raw':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e['options'][_0xf0b7('0x18')]===undefined?!![]:![]:!![]})[_0xf0b7('0xb')](function(_0x374496){logger['info']('CreateSquareDetailsReport',_0x52b27e);logger[_0xf0b7('0x19')](_0xf0b7('0x14'),_0x52b27e,JSON[_0xf0b7('0x1a')](_0x374496));_0x153d23(_0x374496);})[_0xf0b7('0x1b')](function(_0xb90b3c){logger[_0xf0b7('0xe')](_0xf0b7('0x14'),_0xb90b3c[_0xf0b7('0x11')],_0x52b27e);_0x28fd36(_0x1e5fc9[_0xf0b7('0xe')](0x1f4,_0xb90b3c['message']));});});}; \ No newline at end of file +var _0xbbbc=['options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','CreateSquareDetailsReport','create','body'];(function(_0x23ce16,_0x42bb0b){var _0x3ae29e=function(_0x3bb262){while(--_0x3bb262){_0x23ce16['push'](_0x23ce16['shift']());}};_0x3ae29e(++_0x42bb0b);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x19f5ad,_0xb7bc88){_0x19f5ad=_0x19f5ad-0x0;var _0x3c1507=_0xbbbc[_0x19f5ad];return _0x3c1507;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['SquareDetailsReport'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![]})[_0xcbbb('0xd')](function(_0x45de5f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')]('CreateSquareDetailsReport',_0x3436af,JSON[_0xcbbb('0x1a')](_0x45de5f));_0x5052df(_0x45de5f);})[_0xcbbb('0x14')](function(_0x159c62){logger[_0xcbbb('0x11')](_0xcbbb('0x15'),_0x159c62[_0xcbbb('0x12')],_0x3436af);_0x57c5e9(_0x3572bb[_0xcbbb('0x11')](0x1f4,_0x159c62[_0xcbbb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 7b15d9b..323b77f 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 _0x124f=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports','express','Router'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x124f,0xbb));var _0xf124=function(_0x3ceb91,_0x2a7f94){_0x3ceb91=_0x3ceb91-0x0;var _0x71ab37=_0x124f[_0x3ceb91];return _0x71ab37;};'use strict';var express=require(_0xf124('0x0'));var router=express[_0xf124('0x1')]();var auth=require(_0xf124('0x2'));var controller=require(_0xf124('0x3'));router[_0xf124('0x4')]('/',auth[_0xf124('0x5')](),controller[_0xf124('0x6')]);router[_0xf124('0x4')](_0xf124('0x7'),auth[_0xf124('0x5')](),controller['killProcess']);module[_0xf124('0x8')]=router; \ No newline at end of file +var _0x7f3c=['./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','express'];(function(_0x2853d9,_0x2c00e5){var _0x82a50a=function(_0xdcb37b){while(--_0xdcb37b){_0x2853d9['push'](_0x2853d9['shift']());}};_0x82a50a(++_0x2c00e5);}(_0x7f3c,0x16f));var _0xc7f3=function(_0x16ecad,_0x205047){_0x16ecad=_0x16ecad-0x0;var _0x313ff7=_0x7f3c[_0x16ecad];return _0x313ff7;};'use strict';var express=require(_0xc7f3('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xc7f3('0x1'));router[_0xc7f3('0x2')]('/',auth['isAuthenticated'](),controller[_0xc7f3('0x3')]);router[_0xc7f3('0x2')](_0xc7f3('0x4'),auth[_0xc7f3('0x5')](),controller[_0xc7f3('0x6')]);module[_0xc7f3('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 6c2a078..f886465 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 _0x8189=['child_process','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x8189,0x12b));var _0x9818=function(_0x46a74d,_0x1df49e){_0x46a74d=_0x46a74d-0x0;var _0x3d3481=_0x8189[_0x46a74d];return _0x3d3481;};'use strict';var info=require(_0x9818('0x0'));var exec=require(_0x9818('0x1'))['exec'];var logger=require(_0x9818('0x2'))(_0x9818('0x3'));var util=require(_0x9818('0x4'));var BPromise=require('bluebird');var _=require(_0x9818('0x5'));function handleError(_0x3473c3,_0x5684bf,_0x3367ca){_0x5684bf=_0x5684bf||0x1f4;return function(_0x447a32){logger[_0x9818('0x6')](_0x9818('0x7'),_0x3367ca,_0x5684bf,util[_0x9818('0x8')](_0x447a32,{'showHidden':![],'depth':null}));delete _0x447a32['name'];_0x3473c3[_0x9818('0x9')](_0x5684bf)['send'](_0x447a32);};}exports[_0x9818('0xa')]=function(_0x3e8fd3,_0x248124){return info['getAllData']()[_0x9818('0xb')](function(_0x3d3518){return _0x248124[_0x9818('0x9')](0xc8)[_0x9818('0xc')](_0x3d3518);})[_0x9818('0xd')](function(_0x1842fe){return _0x248124[_0x9818('0x9')](0x1f4)[_0x9818('0xc')](_0x1842fe);});};exports[_0x9818('0xe')]=function(_0x42d9dc,_0x5ce54f){var _0x25874b=['components/import/cm'];return new BPromise(function(_0x582025,_0x3ce6f1){return exec(util[_0x9818('0xf')](_0x9818('0x10'),_0x42d9dc[_0x9818('0x11')][_0x9818('0x12')]),function(_0x2dd849,_0xe7eee8,_0x577303){if(_0x2dd849){return _0x3ce6f1(_0x2dd849);}return _0x582025(_0xe7eee8);});})[_0x9818('0xb')](function(_0x3f49e3){var _0x2b04c7=![];var _0x4bd5a1=_0x3f49e3[_0x9818('0x13')](/\n/);for(var _0x43aaeb=0x0,_0x598655=_0x25874b[_0x9818('0x14')];_0x43aaeb<_0x598655,_0x2b04c7===![];_0x43aaeb+=0x1){if(_0x3f49e3[_0x9818('0x15')](_0x25874b[_0x43aaeb])>=0x0){_0x2b04c7=!![];}}if(!_0x2b04c7){throw new Error(util[_0x9818('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x42d9dc['params'][_0x9818('0x12')]));}process[_0x9818('0x16')](_0x42d9dc['params'][_0x9818('0x12')],_0x9818('0x17'));return _0x5ce54f[_0x9818('0x9')](0xc8)[_0x9818('0xc')]({'message':util['format'](_0x9818('0x18'),_0x42d9dc['params'][_0x9818('0x12')])});})[_0x9818('0xd')](handleError(_0x5ce54f,null,_0x9818('0xe')));}; \ No newline at end of file +var _0x643d=['send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status'];(function(_0x36d1f1,_0x1410f3){var _0x8f4c70=function(_0x59ab3f){while(--_0x59ab3f){_0x36d1f1['push'](_0x36d1f1['shift']());}};_0x8f4c70(++_0x1410f3);}(_0x643d,0xdd));var _0xd643=function(_0x4ae5b9,_0x4a42d2){_0x4ae5b9=_0x4ae5b9-0x0;var _0x3f94f4=_0x643d[_0x4ae5b9];return _0x3f94f4;};'use strict';var info=require(_0xd643('0x0'));var exec=require(_0xd643('0x1'))[_0xd643('0x2')];var logger=require(_0xd643('0x3'))('api');var util=require(_0xd643('0x4'));var BPromise=require(_0xd643('0x5'));var _=require(_0xd643('0x6'));function handleError(_0x3e5803,_0xa8e2b4,_0x19c328){_0xa8e2b4=_0xa8e2b4||0x1f4;return function(_0x42ee63){logger[_0xd643('0x7')](_0xd643('0x8'),_0x19c328,_0xa8e2b4,util[_0xd643('0x9')](_0x42ee63,{'showHidden':![],'depth':null}));delete _0x42ee63['name'];_0x3e5803[_0xd643('0xa')](_0xa8e2b4)[_0xd643('0xb')](_0x42ee63);};}exports[_0xd643('0xc')]=function(_0x571435,_0x2529e8){return info[_0xd643('0xd')]()[_0xd643('0xe')](function(_0x47e793){return _0x2529e8[_0xd643('0xa')](0xc8)[_0xd643('0xf')](_0x47e793);})[_0xd643('0x10')](function(_0x1e5614){return _0x2529e8[_0xd643('0xa')](0x1f4)['json'](_0x1e5614);});};exports[_0xd643('0x11')]=function(_0x3679aa,_0x2b8094){var _0x286086=[_0xd643('0x12')];return new BPromise(function(_0x35d857,_0x26fcb1){return exec(util[_0xd643('0x13')](_0xd643('0x14'),_0x3679aa['params'][_0xd643('0x15')]),function(_0x419e33,_0x3c1314,_0xdd433e){if(_0x419e33){return _0x26fcb1(_0x419e33);}return _0x35d857(_0x3c1314);});})[_0xd643('0xe')](function(_0x2aa5d4){var _0x5c6d3b=![];var _0x5993d=_0x2aa5d4[_0xd643('0x16')](/\n/);for(var _0x55bab7=0x0,_0x3060bf=_0x286086[_0xd643('0x17')];_0x55bab7<_0x3060bf,_0x5c6d3b===![];_0x55bab7+=0x1){if(_0x2aa5d4[_0xd643('0x18')](_0x286086[_0x55bab7])>=0x0){_0x5c6d3b=!![];}}if(!_0x5c6d3b){throw new Error(util['format'](_0xd643('0x19'),_0x3679aa[_0xd643('0x1a')][_0xd643('0x15')]));}process['kill'](_0x3679aa['params'][_0xd643('0x15')],_0xd643('0x1b'));return _0x2b8094[_0xd643('0xa')](0xc8)['json']({'message':util['format'](_0xd643('0x1c'),_0x3679aa[_0xd643('0x1a')]['pid'])});})['catch'](handleError(_0x2b8094,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 72199c5..ac04eee 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 _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get'];(function(_0x2a4173,_0x3972a7){var _0x5e3b31=function(_0x195c4d){while(--_0x195c4d){_0x2a4173['push'](_0x2a4173['shift']());}};_0x5e3b31(++_0x3972a7);}(_0xa75b,0x170));var _0xba75=function(_0x511e8d,_0x1dbcba){_0x511e8d=_0x511e8d-0x0;var _0x113f95=_0xa75b[_0x511e8d];return _0x113f95;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file +var _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x17ba,0xab));var _0xa17b=function(_0x532fc1,_0x44cb4d){_0x532fc1=_0x532fc1-0x0;var _0xdfd673=_0x17ba[_0x532fc1];return _0xdfd673;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 116881c..0a633c8 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 _0x60d7=['#0091EA','sequelize','exports','name'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x60d7,0x139));var _0x760d=function(_0x942991,_0x195803){_0x942991=_0x942991-0x0;var _0x1051a6=_0x60d7[_0x942991];return _0x1051a6;};'use strict';var Sequelize=require(_0x760d('0x0'));module[_0x760d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x760d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x760d('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9158=['sequelize','exports','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9158,0x16e));var _0x8915=function(_0x5d89e1,_0xb2638f){_0x5d89e1=_0x5d89e1-0x0;var _0x3da607=_0x9158[_0x5d89e1];return _0x3da607;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'name':{'type':Sequelize[_0x8915('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8915('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x8915('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index acf60f0..f0753ae 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 _0x032f=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','Tag','include','rows','catch','show','params','length','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Tags','UserProfileResource','stack','name','send','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x032f,0x7b));var _0xf032=function(_0x5a5257,_0xdf9f77){_0x5a5257=_0x5a5257-0x0;var _0xce6419=_0x032f[_0x5a5257];return _0xce6419;};'use strict';var emlformat=require(_0xf032('0x0'));var rimraf=require(_0xf032('0x1'));var zipdir=require(_0xf032('0x2'));var jsonpatch=require(_0xf032('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf032('0x4'));var util=require(_0xf032('0x5'));var path=require(_0xf032('0x6'));var sox=require(_0xf032('0x7'));var csv=require(_0xf032('0x8'));var ejs=require(_0xf032('0x9'));var fs=require('fs');var fs_extra=require(_0xf032('0xa'));var _=require(_0xf032('0xb'));var squel=require(_0xf032('0xc'));var crypto=require(_0xf032('0xd'));var jsforce=require(_0xf032('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf032('0x8'));var querystring=require(_0xf032('0xf'));var Papa=require(_0xf032('0x10'));var Redis=require(_0xf032('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf032('0x12'));var as=require(_0xf032('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf032('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf032('0x15'))['db'];function respondWithStatusCode(_0x3c2a78,_0x25ae7e){_0x25ae7e=_0x25ae7e||0xcc;return function(_0x21ea31){if(_0x21ea31){return _0x3c2a78[_0xf032('0x16')](_0x25ae7e);}return _0x3c2a78['status'](_0x25ae7e)['end']();};}function respondWithResult(_0x472f1b,_0x3231d0){_0x3231d0=_0x3231d0||0xc8;return function(_0x17c4ab){if(_0x17c4ab){return _0x472f1b[_0xf032('0x17')](_0x3231d0)['json'](_0x17c4ab);}};}function respondWithFilteredResult(_0x2287b1,_0x3ce02f){return function(_0x3eab9d){if(_0x3eab9d){var _0x20ec95=typeof _0x3ce02f[_0xf032('0x18')]===_0xf032('0x19')&&typeof _0x3ce02f[_0xf032('0x1a')]===_0xf032('0x19');var _0x336472=_0x3eab9d['count'];var _0x47d6de=_0x20ec95?0x0:_0x3ce02f[_0xf032('0x18')];var _0x52bd26=_0x20ec95?_0x3eab9d[_0xf032('0x1b')]:_0x3ce02f[_0xf032('0x18')]+_0x3ce02f[_0xf032('0x1a')];var _0x427898;if(_0x52bd26>=_0x336472){_0x52bd26=_0x336472;_0x427898=0xc8;}else{_0x427898=0xce;}_0x2287b1[_0xf032('0x17')](_0x427898);return _0x2287b1[_0xf032('0x1c')](_0xf032('0x1d'),_0x47d6de+'-'+_0x52bd26+'/'+_0x336472)['json'](_0x3eab9d);}return null;};}function patchUpdates(_0x135a38){return function(_0x3a7bd1){try{jsonpatch[_0xf032('0x1e')](_0x3a7bd1,_0x135a38,!![]);}catch(_0x9c1fa9){return BPromise['reject'](_0x9c1fa9);}return _0x3a7bd1[_0xf032('0x1f')]();};}function saveUpdates(_0x4954c6,_0xe129d2){return function(_0x2264dc){if(_0x2264dc){return _0x2264dc[_0xf032('0x20')](_0x4954c6)[_0xf032('0x21')](function(_0x348e20){return _0x348e20;});}return null;};}function removeEntity(_0xda000b,_0x40273a){return function(_0x3fe17f){if(_0x3fe17f){return _0x3fe17f[_0xf032('0x22')]()[_0xf032('0x21')](function(){var _0x49056e=_0x3fe17f['get']({'plain':!![]});var _0x44fb27=_0xf032('0x23');return db[_0xf032('0x24')][_0xf032('0x22')]({'where':{'type':_0x44fb27,'resourceId':_0x49056e['id']}})[_0xf032('0x21')](function(){return _0x3fe17f;});})[_0xf032('0x21')](function(){_0xda000b[_0xf032('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56b834,_0x10e8aa){return function(_0x3c5b5b){if(!_0x3c5b5b){_0x56b834['sendStatus'](0x194);}return _0x3c5b5b;};}function handleError(_0x10ddd0,_0xaa0e12){_0xaa0e12=_0xaa0e12||0x1f4;return function(_0x6b105f){logger['error'](_0x6b105f[_0xf032('0x25')]);if(_0x6b105f[_0xf032('0x26')]){delete _0x6b105f[_0xf032('0x26')];}_0x10ddd0['status'](_0xaa0e12)[_0xf032('0x27')](_0x6b105f);};}exports[_0xf032('0x28')]=function(_0x46b889,_0x4af26f){var _0x2a1ff3={},_0x396c9d={},_0x38131a={'count':0x0,'rows':[]};var _0x434496=_['map'](db['Tag'][_0xf032('0x29')],function(_0x29fb02){return{'name':_0x29fb02[_0xf032('0x2a')],'type':_0x29fb02[_0xf032('0x2b')][_0xf032('0x2c')]};});_0x396c9d[_0xf032('0x2d')]=_[_0xf032('0x2e')](_0x434496,_0xf032('0x26'));_0x396c9d[_0xf032('0x2f')]=_[_0xf032('0x30')](_0x46b889['query']);_0x396c9d[_0xf032('0x31')]=_[_0xf032('0x32')](_0x396c9d[_0xf032('0x2d')],_0x396c9d[_0xf032('0x2f')]);_0x2a1ff3['attributes']=_[_0xf032('0x32')](_0x396c9d[_0xf032('0x2d')],qs[_0xf032('0x33')](_0x46b889['query'][_0xf032('0x33')]));_0x2a1ff3[_0xf032('0x34')]=_0x2a1ff3[_0xf032('0x34')]['length']?_0x2a1ff3[_0xf032('0x34')]:_0x396c9d[_0xf032('0x2d')];if(!_0x46b889[_0xf032('0x2f')][_0xf032('0x35')](_0xf032('0x36'))){_0x2a1ff3['limit']=qs[_0xf032('0x1a')](_0x46b889[_0xf032('0x2f')][_0xf032('0x1a')]);_0x2a1ff3[_0xf032('0x18')]=qs[_0xf032('0x18')](_0x46b889[_0xf032('0x2f')][_0xf032('0x18')]);}_0x2a1ff3[_0xf032('0x37')]=qs[_0xf032('0x38')](_0x46b889[_0xf032('0x2f')][_0xf032('0x38')]);_0x2a1ff3[_0xf032('0x39')]=qs['filters'](_['pick'](_0x46b889['query'],_0x396c9d[_0xf032('0x31')]),_0x434496);if(_0x46b889['query'][_0xf032('0x3a')]){_0x2a1ff3[_0xf032('0x39')]=_['merge'](_0x2a1ff3[_0xf032('0x39')],{'$or':_[_0xf032('0x2e')](_0x434496,function(_0x16ce92){if(_0x16ce92[_0xf032('0x2b')]!==_0xf032('0x3b')){var _0x47980a={};_0x47980a[_0x16ce92[_0xf032('0x26')]]={'$like':'%'+_0x46b889[_0xf032('0x2f')][_0xf032('0x3a')]+'%'};return _0x47980a;}})});}_0x2a1ff3=_[_0xf032('0x3c')]({},_0x2a1ff3,_0x46b889[_0xf032('0x3d')]);var _0x5a98ee={'where':_0x2a1ff3[_0xf032('0x39')]};return db[_0xf032('0x3e')][_0xf032('0x1b')](_0x5a98ee)[_0xf032('0x21')](function(_0x2424c4){_0x38131a[_0xf032('0x1b')]=_0x2424c4;if(_0x46b889['query']['includeAll']){_0x2a1ff3[_0xf032('0x3f')]=[{'all':!![]}];}return db[_0xf032('0x3e')]['findAll'](_0x2a1ff3);})[_0xf032('0x21')](function(_0x2e5a54){_0x38131a[_0xf032('0x40')]=_0x2e5a54;return _0x38131a;})[_0xf032('0x21')](respondWithFilteredResult(_0x4af26f,_0x2a1ff3))[_0xf032('0x41')](handleError(_0x4af26f,null));};exports[_0xf032('0x42')]=function(_0x76cb59,_0x23e6a1){var _0x31c92d={'raw':!![],'where':{'id':_0x76cb59[_0xf032('0x43')]['id']}},_0x51348f={};_0x51348f[_0xf032('0x2d')]=_['keys'](db['Tag'][_0xf032('0x29')]);_0x51348f[_0xf032('0x2f')]=_['keys'](_0x76cb59['query']);_0x51348f['filters']=_[_0xf032('0x32')](_0x51348f[_0xf032('0x2d')],_0x51348f[_0xf032('0x2f')]);_0x31c92d[_0xf032('0x34')]=_[_0xf032('0x32')](_0x51348f['model'],qs[_0xf032('0x33')](_0x76cb59[_0xf032('0x2f')][_0xf032('0x33')]));_0x31c92d[_0xf032('0x34')]=_0x31c92d['attributes'][_0xf032('0x44')]?_0x31c92d[_0xf032('0x34')]:_0x51348f[_0xf032('0x2d')];if(_0x76cb59[_0xf032('0x2f')][_0xf032('0x45')]){_0x31c92d['include']=[{'all':!![]}];}_0x31c92d=_['merge']({},_0x31c92d,_0x76cb59['options']);return db[_0xf032('0x3e')][_0xf032('0x46')](_0x31c92d)['then'](handleEntityNotFound(_0x23e6a1,null))[_0xf032('0x21')](respondWithResult(_0x23e6a1,null))[_0xf032('0x41')](handleError(_0x23e6a1,null));};exports[_0xf032('0x47')]=function(_0x37392a,_0x5501b6){return db[_0xf032('0x3e')]['create'](_0x37392a['body'],{})[_0xf032('0x21')](function(_0x18aac9){var _0x1c5277=_0x37392a[_0xf032('0x48')][_0xf032('0x49')]({'plain':!![]});if(!_0x1c5277)throw new Error(_0xf032('0x4a'));if(_0x1c5277[_0xf032('0x4b')]===_0xf032('0x48')){var _0x3edd07=_0x18aac9[_0xf032('0x49')]({'plain':!![]});var _0x91de0e='Tags';return db[_0xf032('0x4c')][_0xf032('0x46')]({'where':{'name':_0x91de0e,'userProfileId':_0x1c5277['userProfileId']},'raw':!![]})[_0xf032('0x21')](function(_0x50dab5){if(_0x50dab5&&_0x50dab5[_0xf032('0x4d')]===0x0){return db['UserProfileResource'][_0xf032('0x47')]({'name':_0x3edd07[_0xf032('0x26')],'resourceId':_0x3edd07['id'],'type':_0x50dab5[_0xf032('0x26')],'sectionId':_0x50dab5['id']},{})['then'](function(){return _0x18aac9;});}else{return _0x18aac9;}})[_0xf032('0x41')](function(_0xa716c9){logger[_0xf032('0x4e')](_0xf032('0x4f'),_0xa716c9);throw _0xa716c9;});}return _0x18aac9;})['then'](respondWithResult(_0x5501b6,0xc9))[_0xf032('0x41')](handleError(_0x5501b6,null));};exports[_0xf032('0x20')]=function(_0x5a8bdd,_0x5260e4){if(_0x5a8bdd[_0xf032('0x50')]['id']){delete _0x5a8bdd['body']['id'];}return db[_0xf032('0x3e')]['find']({'where':{'id':_0x5a8bdd[_0xf032('0x43')]['id']}})[_0xf032('0x21')](handleEntityNotFound(_0x5260e4,null))[_0xf032('0x21')](saveUpdates(_0x5a8bdd['body'],null))[_0xf032('0x21')](respondWithResult(_0x5260e4,null))['catch'](handleError(_0x5260e4,null));};exports[_0xf032('0x22')]=function(_0x5c5607,_0x433e1a){return db['Tag'][_0xf032('0x46')]({'where':{'id':_0x5c5607[_0xf032('0x43')]['id']}})[_0xf032('0x21')](handleEntityNotFound(_0x433e1a,null))[_0xf032('0x21')](removeEntity(_0x433e1a,null))[_0xf032('0x41')](handleError(_0x433e1a,null));};exports[_0xf032('0x51')]=function(_0x42befa,_0x1a0d3d){return db[_0xf032('0x3e')][_0xf032('0x51')]()[_0xf032('0x21')](respondWithResult(_0x1a0d3d,null))['catch'](handleError(_0x1a0d3d,null));}; \ No newline at end of file +var _0x3dec=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x275f4a,_0x2077d4){var _0x4b4a21=function(_0x391bab){while(--_0x391bab){_0x275f4a['push'](_0x275f4a['shift']());}};_0x4b4a21(++_0x2077d4);}(_0x3dec,0x8e));var _0xc3de=function(_0x594ff5,_0x47aa57){_0x594ff5=_0x594ff5-0x0;var _0x5042d6=_0x3dec[_0x594ff5];return _0x5042d6;};'use strict';var emlformat=require(_0xc3de('0x0'));var rimraf=require(_0xc3de('0x1'));var zipdir=require(_0xc3de('0x2'));var jsonpatch=require(_0xc3de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3de('0x4'));var Mustache=require(_0xc3de('0x5'));var util=require('util');var path=require(_0xc3de('0x6'));var sox=require(_0xc3de('0x7'));var csv=require(_0xc3de('0x8'));var ejs=require(_0xc3de('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3de('0xa'));var squel=require(_0xc3de('0xb'));var crypto=require(_0xc3de('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc3de('0xd'));var toCsv=require(_0xc3de('0x8'));var querystring=require(_0xc3de('0xe'));var Papa=require(_0xc3de('0xf'));var Redis=require(_0xc3de('0x10'));var authService=require(_0xc3de('0x11'));var qs=require(_0xc3de('0x12'));var as=require(_0xc3de('0x13'));var hardwareService=require(_0xc3de('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc3de('0x15'));var config=require(_0xc3de('0x16'));var licenseUtil=require(_0xc3de('0x17'));var db=require(_0xc3de('0x18'))['db'];function respondWithStatusCode(_0x2f1946,_0x9866f){_0x9866f=_0x9866f||0xcc;return function(_0x45e280){if(_0x45e280){return _0x2f1946[_0xc3de('0x19')](_0x9866f);}return _0x2f1946[_0xc3de('0x1a')](_0x9866f)[_0xc3de('0x1b')]();};}function respondWithResult(_0x2f6403,_0x56da8e){_0x56da8e=_0x56da8e||0xc8;return function(_0x188379){if(_0x188379){return _0x2f6403['status'](_0x56da8e)[_0xc3de('0x1c')](_0x188379);}};}function respondWithFilteredResult(_0xf5e410,_0x4cdaf1){return function(_0x109bda){if(_0x109bda){var _0x1d9a0f=typeof _0x4cdaf1[_0xc3de('0x1d')]===_0xc3de('0x1e')&&typeof _0x4cdaf1[_0xc3de('0x1f')]===_0xc3de('0x1e');var _0x460a22=_0x109bda[_0xc3de('0x20')];var _0x4fa055=_0x1d9a0f?0x0:_0x4cdaf1['offset'];var _0x3950c1=_0x1d9a0f?_0x109bda[_0xc3de('0x20')]:_0x4cdaf1[_0xc3de('0x1d')]+_0x4cdaf1[_0xc3de('0x1f')];var _0x2966d9;if(_0x3950c1>=_0x460a22){_0x3950c1=_0x460a22;_0x2966d9=0xc8;}else{_0x2966d9=0xce;}_0xf5e410[_0xc3de('0x1a')](_0x2966d9);return _0xf5e410[_0xc3de('0x21')](_0xc3de('0x22'),_0x4fa055+'-'+_0x3950c1+'/'+_0x460a22)[_0xc3de('0x1c')](_0x109bda);}return null;};}function patchUpdates(_0xc0fae8){return function(_0x28f875){try{jsonpatch[_0xc3de('0x23')](_0x28f875,_0xc0fae8,!![]);}catch(_0x5382ee){return BPromise[_0xc3de('0x24')](_0x5382ee);}return _0x28f875[_0xc3de('0x25')]();};}function saveUpdates(_0x37b63c,_0x42561b){return function(_0x40eab7){if(_0x40eab7){return _0x40eab7[_0xc3de('0x26')](_0x37b63c)[_0xc3de('0x27')](function(_0x1c1684){return _0x1c1684;});}return null;};}function removeEntity(_0x2a737f,_0x234c6e){return function(_0x58f71a){if(_0x58f71a){return _0x58f71a[_0xc3de('0x28')]()[_0xc3de('0x27')](function(){var _0x7abed0=_0x58f71a[_0xc3de('0x29')]({'plain':!![]});var _0xf8c8d8=_0xc3de('0x2a');return db[_0xc3de('0x2b')][_0xc3de('0x28')]({'where':{'type':_0xf8c8d8,'resourceId':_0x7abed0['id']}})[_0xc3de('0x27')](function(){return _0x58f71a;});})[_0xc3de('0x27')](function(){_0x2a737f[_0xc3de('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a41fc,_0x3c0509){return function(_0x5e9106){if(!_0x5e9106){_0x5a41fc[_0xc3de('0x19')](0x194);}return _0x5e9106;};}function handleError(_0x579b56,_0x2f89b8){_0x2f89b8=_0x2f89b8||0x1f4;return function(_0x5ece11){logger[_0xc3de('0x2c')](_0x5ece11['stack']);if(_0x5ece11[_0xc3de('0x2d')]){delete _0x5ece11[_0xc3de('0x2d')];}_0x579b56[_0xc3de('0x1a')](_0x2f89b8)[_0xc3de('0x2e')](_0x5ece11);};}exports[_0xc3de('0x2f')]=function(_0x34bc75,_0x2e01f2){var _0x26dbb6={},_0x27d976={},_0x4bfab5={'count':0x0,'rows':[]};var _0x4f6f94=_[_0xc3de('0x30')](db[_0xc3de('0x31')][_0xc3de('0x32')],function(_0x2f4fdd){return{'name':_0x2f4fdd[_0xc3de('0x33')],'type':_0x2f4fdd[_0xc3de('0x34')][_0xc3de('0x35')]};});_0x27d976[_0xc3de('0x36')]=_['map'](_0x4f6f94,_0xc3de('0x2d'));_0x27d976[_0xc3de('0x37')]=_[_0xc3de('0x38')](_0x34bc75[_0xc3de('0x37')]);_0x27d976[_0xc3de('0x39')]=_[_0xc3de('0x3a')](_0x27d976['model'],_0x27d976[_0xc3de('0x37')]);_0x26dbb6[_0xc3de('0x3b')]=_[_0xc3de('0x3a')](_0x27d976['model'],qs[_0xc3de('0x3c')](_0x34bc75[_0xc3de('0x37')][_0xc3de('0x3c')]));_0x26dbb6[_0xc3de('0x3b')]=_0x26dbb6[_0xc3de('0x3b')][_0xc3de('0x3d')]?_0x26dbb6[_0xc3de('0x3b')]:_0x27d976[_0xc3de('0x36')];if(!_0x34bc75[_0xc3de('0x37')][_0xc3de('0x3e')](_0xc3de('0x3f'))){_0x26dbb6['limit']=qs[_0xc3de('0x1f')](_0x34bc75[_0xc3de('0x37')][_0xc3de('0x1f')]);_0x26dbb6[_0xc3de('0x1d')]=qs['offset'](_0x34bc75['query']['offset']);}_0x26dbb6['order']=qs[_0xc3de('0x40')](_0x34bc75[_0xc3de('0x37')][_0xc3de('0x40')]);_0x26dbb6['where']=qs['filters'](_[_0xc3de('0x41')](_0x34bc75[_0xc3de('0x37')],_0x27d976[_0xc3de('0x39')]),_0x4f6f94);if(_0x34bc75['query'][_0xc3de('0x42')]){_0x26dbb6[_0xc3de('0x43')]=_[_0xc3de('0x44')](_0x26dbb6['where'],{'$or':_['map'](_0x4f6f94,function(_0xc98d89){if(_0xc98d89[_0xc3de('0x34')]!=='VIRTUAL'){var _0x52401b={};_0x52401b[_0xc98d89['name']]={'$like':'%'+_0x34bc75[_0xc3de('0x37')]['filter']+'%'};return _0x52401b;}})});}_0x26dbb6=_[_0xc3de('0x44')]({},_0x26dbb6,_0x34bc75[_0xc3de('0x45')]);var _0x461651={'where':_0x26dbb6[_0xc3de('0x43')]};return db['Tag'][_0xc3de('0x20')](_0x461651)[_0xc3de('0x27')](function(_0x1cc5be){_0x4bfab5[_0xc3de('0x20')]=_0x1cc5be;if(_0x34bc75[_0xc3de('0x37')][_0xc3de('0x46')]){_0x26dbb6['include']=[{'all':!![]}];}return db[_0xc3de('0x31')]['findAll'](_0x26dbb6);})[_0xc3de('0x27')](function(_0x40f775){_0x4bfab5[_0xc3de('0x47')]=_0x40f775;return _0x4bfab5;})[_0xc3de('0x27')](respondWithFilteredResult(_0x2e01f2,_0x26dbb6))[_0xc3de('0x48')](handleError(_0x2e01f2,null));};exports[_0xc3de('0x49')]=function(_0x47f6b9,_0x131ebc){var _0x524302={'raw':!![],'where':{'id':_0x47f6b9['params']['id']}},_0x1ed18f={};_0x1ed18f['model']=_['keys'](db[_0xc3de('0x31')][_0xc3de('0x32')]);_0x1ed18f['query']=_[_0xc3de('0x38')](_0x47f6b9['query']);_0x1ed18f[_0xc3de('0x39')]=_['intersection'](_0x1ed18f[_0xc3de('0x36')],_0x1ed18f[_0xc3de('0x37')]);_0x524302[_0xc3de('0x3b')]=_['intersection'](_0x1ed18f['model'],qs[_0xc3de('0x3c')](_0x47f6b9['query']['fields']));_0x524302[_0xc3de('0x3b')]=_0x524302['attributes']['length']?_0x524302[_0xc3de('0x3b')]:_0x1ed18f[_0xc3de('0x36')];if(_0x47f6b9[_0xc3de('0x37')]['includeAll']){_0x524302[_0xc3de('0x4a')]=[{'all':!![]}];}_0x524302=_[_0xc3de('0x44')]({},_0x524302,_0x47f6b9[_0xc3de('0x45')]);return db['Tag'][_0xc3de('0x4b')](_0x524302)[_0xc3de('0x27')](handleEntityNotFound(_0x131ebc,null))[_0xc3de('0x27')](respondWithResult(_0x131ebc,null))[_0xc3de('0x48')](handleError(_0x131ebc,null));};exports[_0xc3de('0x4c')]=function(_0xf634c3,_0x2a31ec){return db['Tag']['create'](_0xf634c3[_0xc3de('0x4d')],{})[_0xc3de('0x27')](function(_0x285910){var _0x1bf3f6=_0xf634c3[_0xc3de('0x4e')]['get']({'plain':!![]});if(!_0x1bf3f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bf3f6[_0xc3de('0x4f')]===_0xc3de('0x4e')){var _0x3b162c=_0x285910['get']({'plain':!![]});var _0x5f0c09=_0xc3de('0x2a');return db[_0xc3de('0x50')][_0xc3de('0x4b')]({'where':{'name':_0x5f0c09,'userProfileId':_0x1bf3f6[_0xc3de('0x51')]},'raw':!![]})['then'](function(_0x5cb8ec){if(_0x5cb8ec&&_0x5cb8ec[_0xc3de('0x52')]===0x0){return db['UserProfileResource'][_0xc3de('0x4c')]({'name':_0x3b162c[_0xc3de('0x2d')],'resourceId':_0x3b162c['id'],'type':_0x5cb8ec[_0xc3de('0x2d')],'sectionId':_0x5cb8ec['id']},{})['then'](function(){return _0x285910;});}else{return _0x285910;}})[_0xc3de('0x48')](function(_0x2855db){logger[_0xc3de('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2855db);throw _0x2855db;});}return _0x285910;})['then'](respondWithResult(_0x2a31ec,0xc9))['catch'](handleError(_0x2a31ec,null));};exports[_0xc3de('0x26')]=function(_0x180204,_0x131ffb){if(_0x180204[_0xc3de('0x4d')]['id']){delete _0x180204[_0xc3de('0x4d')]['id'];}return db[_0xc3de('0x31')][_0xc3de('0x4b')]({'where':{'id':_0x180204[_0xc3de('0x53')]['id']}})['then'](handleEntityNotFound(_0x131ffb,null))[_0xc3de('0x27')](saveUpdates(_0x180204['body'],null))[_0xc3de('0x27')](respondWithResult(_0x131ffb,null))['catch'](handleError(_0x131ffb,null));};exports[_0xc3de('0x28')]=function(_0x397c05,_0x5f2195){return db[_0xc3de('0x31')][_0xc3de('0x4b')]({'where':{'id':_0x397c05[_0xc3de('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f2195,null))[_0xc3de('0x27')](removeEntity(_0x5f2195,null))[_0xc3de('0x48')](handleError(_0x5f2195,null));};exports[_0xc3de('0x54')]=function(_0xc6546b,_0x4a4e2e){return db['Tag']['describe']()['then'](respondWithResult(_0x4a4e2e,null))['catch'](handleError(_0x4a4e2e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index cf1ae84..38cd8fb 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 _0xaf2b=['exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./tag.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaf2b,0x93));var _0xbaf2=function(_0x30662f,_0x4d202e){_0x30662f=_0x30662f-0x0;var _0x40d038=_0xaf2b[_0x30662f];return _0x40d038;};'use strict';var _=require(_0xbaf2('0x0'));var util=require(_0xbaf2('0x1'));var logger=require(_0xbaf2('0x2'))(_0xbaf2('0x3'));var moment=require(_0xbaf2('0x4'));var BPromise=require(_0xbaf2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbaf2('0x6'));var rimraf=require(_0xbaf2('0x7'));var config=require('../../config/environment');var attributes=require(_0xbaf2('0x8'));module[_0xbaf2('0x9')]=function(_0x14a4d1,_0x363ad6){return _0x14a4d1[_0xbaf2('0xa')](_0xbaf2('0xb'),attributes,{'tableName':_0xbaf2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb40=['../../config/environment','./tag.attributes','define','tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x475bd7,_0x33aad9){var _0x27c23a=function(_0x1b31a5){while(--_0x1b31a5){_0x475bd7['push'](_0x475bd7['shift']());}};_0x27c23a(++_0x33aad9);}(_0xeb40,0x176));var _0x0eb4=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xeb40[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x0eb4('0x0'));var util=require('util');var logger=require(_0x0eb4('0x1'))(_0x0eb4('0x2'));var moment=require(_0x0eb4('0x3'));var BPromise=require(_0x0eb4('0x4'));var rp=require(_0x0eb4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0eb4('0x6'));var attributes=require(_0x0eb4('0x7'));module['exports']=function(_0x3950f5,_0x35cbd4){return _0x3950f5[_0x0eb4('0x8')]('Tag',attributes,{'tableName':_0x0eb4('0x9'),'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 4d7cb1e..4fe37e4 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 _0xeec6=['then','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0xeec6,0x1c2));var _0x6eec=function(_0x55b037,_0x2d9392){_0x55b037=_0x55b037-0x0;var _0x5f1053=_0xeec6[_0x55b037];return _0x5f1053;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('Tag,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file +var _0xf021=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','then','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Tag,\x20%s,\x20%s','result','catch'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xf021,0x18f));var _0x1f02=function(_0xb98e6e,_0xe56cbc){_0xb98e6e=_0xb98e6e-0x0;var _0x26751c=_0xf021[_0xb98e6e];return _0x26751c;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var moment=require(_0x1f02('0x2'));var BPromise=require(_0x1f02('0x3'));var rs=require(_0x1f02('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f02('0x6'))(_0x1f02('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f02('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x383d0b,_0x257d6a,_0x2a6c50){return new BPromise(function(_0x4193d2,_0x1f1cec){return client['request'](_0x383d0b,_0x2a6c50)[_0x1f02('0x9')](function(_0x5dc295){logger['info']('Tag,\x20%s,\x20%s',_0x257d6a,_0x1f02('0xa'));logger[_0x1f02('0xb')](_0x1f02('0xc'),_0x257d6a,_0x1f02('0xa'),JSON[_0x1f02('0xd')](_0x5dc295));if(_0x5dc295['error']){if(_0x5dc295[_0x1f02('0xe')][_0x1f02('0xf')]===0x1f4){logger[_0x1f02('0xe')]('Tag,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x1f1cec(_0x5dc295[_0x1f02('0xe')]['message']);}logger['error']('Tag,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x4193d2(_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);}else{logger[_0x1f02('0x11')](_0x1f02('0x12'),_0x257d6a,_0x1f02('0xa'));_0x4193d2(_0x5dc295[_0x1f02('0x13')]['message']);}})[_0x1f02('0x14')](function(_0x5cca16){logger['error']('Tag,\x20%s,\x20%s',_0x257d6a,_0x5cca16);_0x1f1cec(_0x5cca16);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 52b1ec4..adc0fa3 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(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_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 diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index f6538b5..a40b016 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 _0x757a=['exports','STRING'];(function(_0x4873e7,_0xadd09b){var _0x589ef4=function(_0x199c64){while(--_0x199c64){_0x4873e7['push'](_0x4873e7['shift']());}};_0x589ef4(++_0xadd09b);}(_0x757a,0xde));var _0xa757=function(_0x86bcd1,_0x1647b8){_0x86bcd1=_0x86bcd1-0x0;var _0x36fc08=_0x757a[_0x86bcd1];return _0x36fc08;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_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 4f4b91c..c8e5c2b 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 _0x0734=['UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','get','Queues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','transaction','through','penalty','TeamVoiceQueue','findOrCreate','Queue:save','findAll','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','TeamVoicePrefix','spread','Sms','Whatsapp','removeAgents','QueueId','getAgents','User','pick','eml-format','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','Team','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','catch','includeAll','find','create','body','user','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue'];(function(_0x429477,_0x49affb){var _0x1d5f94=function(_0x202332){while(--_0x202332){_0x429477['push'](_0x429477['shift']());}};_0x1d5f94(++_0x49affb);}(_0x0734,0x161));var _0x4073=function(_0x177f15,_0x47214f){_0x177f15=_0x177f15-0x0;var _0x3683f6=_0x0734[_0x177f15];return _0x3683f6;};'use strict';var emlformat=require(_0x4073('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4073('0x1'));var BPromise=require(_0x4073('0x2'));var Mustache=require(_0x4073('0x3'));var util=require('util');var path=require(_0x4073('0x4'));var sox=require(_0x4073('0x5'));var csv=require('to-csv');var ejs=require(_0x4073('0x6'));var fs=require('fs');var fs_extra=require(_0x4073('0x7'));var _=require(_0x4073('0x8'));var squel=require('squel');var crypto=require(_0x4073('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4073('0xa'));var Papa=require(_0x4073('0xb'));var Redis=require('ioredis');var authService=require(_0x4073('0xc'));var qs=require(_0x4073('0xd'));var as=require(_0x4073('0xe'));var hardwareService=require(_0x4073('0xf'));var logger=require(_0x4073('0x10'))('api');var utils=require(_0x4073('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4073('0x12'));var db=require(_0x4073('0x13'))['db'];config[_0x4073('0x14')]=_[_0x4073('0x15')](config['redis'],{'host':_0x4073('0x16'),'port':0x18eb});var socket=require(_0x4073('0x17'))(new Redis(config['redis']));require(_0x4073('0x18'))[_0x4073('0x19')](socket);function respondWithStatusCode(_0x33d8dd,_0x1a3ad5){_0x1a3ad5=_0x1a3ad5||0xcc;return function(_0x254b4b){if(_0x254b4b){return _0x33d8dd[_0x4073('0x1a')](_0x1a3ad5);}return _0x33d8dd[_0x4073('0x1b')](_0x1a3ad5)['end']();};}function respondWithResult(_0x485de8,_0x1fd75b){_0x1fd75b=_0x1fd75b||0xc8;return function(_0x450a9c){if(_0x450a9c){return _0x485de8['status'](_0x1fd75b)[_0x4073('0x1c')](_0x450a9c);}};}function respondWithFilteredResult(_0x38c113,_0x2adbfe){return function(_0x105c0e){if(_0x105c0e){var _0x284b4e=typeof _0x2adbfe[_0x4073('0x1d')]==='undefined'&&typeof _0x2adbfe[_0x4073('0x1e')]==='undefined';var _0x597bfc=_0x105c0e[_0x4073('0x1f')];var _0x191b56=_0x284b4e?0x0:_0x2adbfe[_0x4073('0x1d')];var _0xe3d8a0=_0x284b4e?_0x105c0e[_0x4073('0x1f')]:_0x2adbfe[_0x4073('0x1d')]+_0x2adbfe['limit'];var _0x3888a6;if(_0xe3d8a0>=_0x597bfc){_0xe3d8a0=_0x597bfc;_0x3888a6=0xc8;}else{_0x3888a6=0xce;}_0x38c113[_0x4073('0x1b')](_0x3888a6);return _0x38c113[_0x4073('0x20')](_0x4073('0x21'),_0x191b56+'-'+_0xe3d8a0+'/'+_0x597bfc)[_0x4073('0x1c')](_0x105c0e);}return null;};}function patchUpdates(_0x1b7ecb){return function(_0x239e51){try{jsonpatch[_0x4073('0x22')](_0x239e51,_0x1b7ecb,!![]);}catch(_0x158da7){return BPromise[_0x4073('0x23')](_0x158da7);}return _0x239e51['save']();};}function saveUpdates(_0x376d53,_0x34cd14){return function(_0x16d706){if(_0x16d706){return _0x16d706[_0x4073('0x24')](_0x376d53)[_0x4073('0x25')](function(_0x3881b9){return _0x3881b9;});}return null;};}function handleEntityNotFound(_0x9aa4d8,_0x2f0a14){return function(_0x90cac5){if(!_0x90cac5){_0x9aa4d8[_0x4073('0x1a')](0x194);}return _0x90cac5;};}function handleError(_0x249798,_0x387d30){_0x387d30=_0x387d30||0x1f4;return function(_0x2c014a){logger[_0x4073('0x26')](_0x2c014a[_0x4073('0x27')]);if(_0x2c014a['name']){delete _0x2c014a[_0x4073('0x28')];}_0x249798[_0x4073('0x1b')](_0x387d30)[_0x4073('0x29')](_0x2c014a);};}exports[_0x4073('0x2a')]=function(_0x2c713d,_0x43b7da){var _0x3094d6={},_0x184ae8={},_0x14d036={'count':0x0,'rows':[]};var _0x3183b8=_['map'](db[_0x4073('0x2b')][_0x4073('0x2c')],function(_0x197da1){return{'name':_0x197da1[_0x4073('0x2d')],'type':_0x197da1['type'][_0x4073('0x2e')]};});_0x184ae8[_0x4073('0x2f')]=_[_0x4073('0x30')](_0x3183b8,'name');_0x184ae8[_0x4073('0x31')]=_[_0x4073('0x32')](_0x2c713d[_0x4073('0x31')]);_0x184ae8[_0x4073('0x33')]=_['intersection'](_0x184ae8[_0x4073('0x2f')],_0x184ae8[_0x4073('0x31')]);_0x3094d6['attributes']=_[_0x4073('0x34')](_0x184ae8['model'],qs[_0x4073('0x35')](_0x2c713d[_0x4073('0x31')]['fields']));_0x3094d6[_0x4073('0x36')]=_0x3094d6[_0x4073('0x36')][_0x4073('0x37')]?_0x3094d6[_0x4073('0x36')]:_0x184ae8[_0x4073('0x2f')];if(!_0x2c713d['query'][_0x4073('0x38')](_0x4073('0x39'))){_0x3094d6['limit']=qs['limit'](_0x2c713d[_0x4073('0x31')][_0x4073('0x1e')]);_0x3094d6['offset']=qs[_0x4073('0x1d')](_0x2c713d[_0x4073('0x31')][_0x4073('0x1d')]);}_0x3094d6['order']=qs[_0x4073('0x3a')](_0x2c713d[_0x4073('0x31')][_0x4073('0x3a')]);_0x3094d6[_0x4073('0x3b')]=qs[_0x4073('0x33')](_['pick'](_0x2c713d['query'],_0x184ae8[_0x4073('0x33')]),_0x3183b8);if(_0x2c713d[_0x4073('0x31')]['filter']){_0x3094d6[_0x4073('0x3b')]=_[_0x4073('0x3c')](_0x3094d6[_0x4073('0x3b')],{'$or':_[_0x4073('0x30')](_0x3183b8,function(_0x3ede39){if(_0x3ede39['type']!==_0x4073('0x3d')){var _0x1a40d4={};_0x1a40d4[_0x3ede39[_0x4073('0x28')]]={'$like':'%'+_0x2c713d[_0x4073('0x31')][_0x4073('0x3e')]+'%'};return _0x1a40d4;}})});}_0x3094d6=_[_0x4073('0x3c')]({},_0x3094d6,_0x2c713d[_0x4073('0x3f')]);var _0x24a099={'where':_0x3094d6[_0x4073('0x3b')]};return db[_0x4073('0x2b')][_0x4073('0x1f')](_0x24a099)['then'](function(_0x3332cf){_0x14d036['count']=_0x3332cf;if(_0x2c713d[_0x4073('0x31')]['includeAll']){_0x3094d6[_0x4073('0x40')]=[{'all':!![]}];}return db[_0x4073('0x2b')]['findAll'](_0x3094d6);})[_0x4073('0x25')](function(_0x45242){_0x14d036['rows']=_0x45242;return _0x14d036;})['then'](respondWithFilteredResult(_0x43b7da,_0x3094d6))[_0x4073('0x41')](handleError(_0x43b7da,null));};exports['show']=function(_0x3e6388,_0x4ce5b3){var _0xa368c9={'raw':![],'where':{'id':_0x3e6388['params']['id']}},_0x19443b={};_0x19443b['model']=_[_0x4073('0x32')](db[_0x4073('0x2b')][_0x4073('0x2c')]);_0x19443b[_0x4073('0x31')]=_[_0x4073('0x32')](_0x3e6388[_0x4073('0x31')]);_0x19443b['filters']=_[_0x4073('0x34')](_0x19443b[_0x4073('0x2f')],_0x19443b[_0x4073('0x31')]);_0xa368c9[_0x4073('0x36')]=_[_0x4073('0x34')](_0x19443b['model'],qs[_0x4073('0x35')](_0x3e6388[_0x4073('0x31')]['fields']));_0xa368c9[_0x4073('0x36')]=_0xa368c9[_0x4073('0x36')][_0x4073('0x37')]?_0xa368c9[_0x4073('0x36')]:_0x19443b['model'];if(_0x3e6388[_0x4073('0x31')][_0x4073('0x42')]){_0xa368c9[_0x4073('0x40')]=[{'all':!![]}];}_0xa368c9=_[_0x4073('0x3c')]({},_0xa368c9,_0x3e6388[_0x4073('0x3f')]);return db[_0x4073('0x2b')][_0x4073('0x43')](_0xa368c9)[_0x4073('0x25')](handleEntityNotFound(_0x4ce5b3,null))[_0x4073('0x25')](respondWithResult(_0x4ce5b3,null))[_0x4073('0x41')](handleError(_0x4ce5b3,null));};exports['create']=function(_0x182096,_0x5cec6a){return db['Team'][_0x4073('0x44')](_0x182096[_0x4073('0x45')],{})[_0x4073('0x25')](function(_0x30de77){var _0x2ff460=_0x182096[_0x4073('0x46')]['get']({'plain':!![]});if(!_0x2ff460)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ff460['role']===_0x4073('0x46')){var _0x220a26=_0x30de77['get']({'plain':!![]});var _0x23b146=_0x4073('0x47');return db[_0x4073('0x48')]['find']({'where':{'name':_0x23b146,'userProfileId':_0x2ff460[_0x4073('0x49')]},'raw':!![]})[_0x4073('0x25')](function(_0x184b5a){if(_0x184b5a&&_0x184b5a[_0x4073('0x4a')]===0x0){return db['UserProfileResource'][_0x4073('0x44')]({'name':_0x220a26[_0x4073('0x28')],'resourceId':_0x220a26['id'],'type':_0x184b5a[_0x4073('0x28')],'sectionId':_0x184b5a['id']},{})['then'](function(){return _0x30de77;});}else{return _0x30de77;}})[_0x4073('0x41')](function(_0x27dea3){logger[_0x4073('0x26')](_0x4073('0x4b'),_0x27dea3);throw _0x27dea3;});}return _0x30de77;})[_0x4073('0x25')](respondWithResult(_0x5cec6a,0xc9))[_0x4073('0x41')](handleError(_0x5cec6a,null));};exports[_0x4073('0x24')]=function(_0x7826fd,_0x14bcb5){if(_0x7826fd[_0x4073('0x45')]['id']){delete _0x7826fd[_0x4073('0x45')]['id'];}return db[_0x4073('0x2b')]['find']({'where':{'id':_0x7826fd[_0x4073('0x4c')]['id']}})['then'](handleEntityNotFound(_0x14bcb5,null))['then'](saveUpdates(_0x7826fd[_0x4073('0x45')],null))[_0x4073('0x25')](respondWithResult(_0x14bcb5,null))[_0x4073('0x41')](handleError(_0x14bcb5,null));};exports[_0x4073('0x4d')]=function(_0x2d56f1,_0x1cc95e){var _0x19221a=_0x2d56f1[_0x4073('0x4c')]['id'];var _0x39581d=[];return db[_0x4073('0x4e')]['transaction'](function(_0x314129){var _0x6e3afe=_0x4073('0x4f')+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x6e3afe,{'type':db[_0x4073('0x50')][_0x4073('0x51')][_0x4073('0x52')],'raw':!![],'transaction':_0x314129})['then'](function(_0x2f1d88){_0x39581d=_[_0x4073('0x30')](_0x2f1d88,function(_0x1ef94e){return Number(_0x1ef94e[_0x4073('0x53')]);});})['then'](function(){var _0x4063fd=_0x4073('0x54')+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x4063fd,{'type':db[_0x4073('0x50')][_0x4073('0x51')]['SELECT'],'raw':!![],'transaction':_0x314129});})['then'](function(_0x338a95){var _0x22ba79=_[_0x4073('0x30')](_0x338a95,function(_0x345b38){return Number(_0x345b38[_0x4073('0x55')]);});return db[_0x4073('0x56')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'VoiceQueueId':{'$in':_0x22ba79}},'transaction':_0x314129});})[_0x4073('0x25')](function(){var _0x30d8c8=_0x4073('0x57')+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x30d8c8,{'type':db[_0x4073('0x50')]['QueryTypes'][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x2615fd){var _0x370f6a=_[_0x4073('0x30')](_0x2615fd,function(_0x570290){return Number(_0x570290['MailQueueId']);});return db[_0x4073('0x58')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'MailQueueId':{'$in':_0x370f6a}},'transaction':_0x314129});})[_0x4073('0x25')](function(){var _0x498af5='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x498af5,{'type':db['Sequelize'][_0x4073('0x51')][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x50e95a){var _0x439ccd=_[_0x4073('0x30')](_0x50e95a,function(_0x49666f){return Number(_0x49666f[_0x4073('0x59')]);});return db[_0x4073('0x5a')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'SmsQueueId':{'$in':_0x439ccd}},'transaction':_0x314129});})[_0x4073('0x25')](function(){var _0x1b1be2=_0x4073('0x5b')+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x1b1be2,{'type':db[_0x4073('0x50')][_0x4073('0x51')][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x37d3ce){var _0xb714b2=_['map'](_0x37d3ce,function(_0x413a4c){return Number(_0x413a4c[_0x4073('0x5c')]);});return db[_0x4073('0x5d')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'ChatQueueId':{'$in':_0xb714b2}},'transaction':_0x314129});})[_0x4073('0x25')](function(){var _0x1c9ac0=_0x4073('0x5e')+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x1c9ac0,{'type':db['Sequelize'][_0x4073('0x51')][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x235918){var _0x11683a=_[_0x4073('0x30')](_0x235918,function(_0x50b5e9){return Number(_0x50b5e9[_0x4073('0x5f')]);});return db[_0x4073('0x60')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'FaxQueueId':{'$in':_0x11683a}},'transaction':_0x314129});})['then'](function(){var _0x344879=_0x4073('0x61')+_0x19221a;return db['sequelize'][_0x4073('0x31')](_0x344879,{'type':db['Sequelize']['QueryTypes'][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x34f172){var _0x3b62ff=_[_0x4073('0x30')](_0x34f172,function(_0x2dca89){return Number(_0x2dca89[_0x4073('0x62')]);});return db[_0x4073('0x63')]['destroy']({'where':{'UserId':{'$in':_0x39581d},'OpenchannelQueueId':{'$in':_0x3b62ff}},'transaction':_0x314129});})[_0x4073('0x25')](function(){var _0x103a5c=_0x4073('0x64')+_0x19221a;return db[_0x4073('0x4e')]['query'](_0x103a5c,{'type':db[_0x4073('0x50')][_0x4073('0x51')][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})['then'](function(_0x4fef4b){var _0x1d278c=_[_0x4073('0x30')](_0x4fef4b,function(_0x4c8769){return Number(_0x4c8769[_0x4073('0x65')]);});return db[_0x4073('0x66')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'WhatsappQueueId':{'$in':_0x1d278c}},'transaction':_0x314129});})[_0x4073('0x25')](function(){return db['TeamVoicePrefix'][_0x4073('0x43')]({'where':{'TeamId':_0x19221a}});})[_0x4073('0x25')](function(_0x18c095){if(_0x18c095===null){return;}return db[_0x4073('0x67')]['destroy']({'where':{'UserId':{'$in':_0x39581d},'VoicePrefixId':_0x18c095[_0x4073('0x68')]},'transaction':_0x314129});})[_0x4073('0x25')](function(){return db[_0x4073('0x2b')]['destroy']({'where':{'id':_0x19221a},'cascade':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x12b8a8){if(_0x12b8a8===0x0){_0x1cc95e[_0x4073('0x1a')](0x194);}else{return db[_0x4073('0x69')][_0x4073('0x4d')]({'where':{'type':_0x4073('0x47'),'resourceId':_0x19221a},'cascade':!![],'transaction':_0x314129})[_0x4073('0x25')](function(){_0x1cc95e[_0x4073('0x1b')](0xcc)['end']();});}})[_0x4073('0x41')](function(_0x355f0a){_0x1cc95e[_0x4073('0x1b')](0x1f4)[_0x4073('0x29')](_0x355f0a);});});};exports[_0x4073('0x6a')]=function(_0x579227,_0x5892e4,_0x1628d0){return db['Team'][_0x4073('0x6b')]({'where':{'id':_0x579227[_0x4073('0x4c')]['id']}})[_0x4073('0x25')](handleEntityNotFound(_0x5892e4,null))['then'](function(_0x3dce67){if(!_0x579227[_0x4073('0x31')][_0x4073('0x6c')]||!utils[_0x4073('0x6d')](_0x579227['query'][_0x4073('0x6c')])){throw new db[(_0x4073('0x50'))][(_0x4073('0x6e'))](_0x4073('0x6f'));}var _0x4249b1={};var _0x4dbfae={};_0x4dbfae['model']=_[_0x4073('0x32')](db[_[_0x4073('0x70')](_0x579227['query'][_0x4073('0x6c')][_0x4073('0x71')]())+_0x4073('0x72')]['rawAttributes']);_0x4dbfae['query']=_[_0x4073('0x32')](_0x579227[_0x4073('0x31')]);_0x4dbfae[_0x4073('0x33')]=_[_0x4073('0x34')](_0x4dbfae[_0x4073('0x2f')],_0x4dbfae['query']);_0x4249b1[_0x4073('0x36')]=_[_0x4073('0x34')](_0x4dbfae[_0x4073('0x2f')],qs[_0x4073('0x35')](_0x579227['query'][_0x4073('0x35')]));_0x4249b1[_0x4073('0x36')]=_0x4249b1[_0x4073('0x36')][_0x4073('0x37')]?_0x4249b1[_0x4073('0x36')]:_0x4dbfae['model'];_0x4249b1['limit']=qs[_0x4073('0x1e')](_0x579227[_0x4073('0x31')][_0x4073('0x1e')]);_0x4249b1[_0x4073('0x1d')]=qs['offset'](_0x579227[_0x4073('0x31')][_0x4073('0x1d')]);_0x4249b1[_0x4073('0x73')]=qs[_0x4073('0x3a')](_0x579227['query']['sort']);_0x4249b1['where']=qs[_0x4073('0x33')](_['pick'](_0x579227[_0x4073('0x31')],_0x4dbfae['filters']));_0x4249b1=_[_0x4073('0x3c')]({},_0x4249b1,_0x579227['options']);return _0x3dce67[_0x4073('0x74')+_[_0x4073('0x70')](_0x579227['query'][_0x4073('0x6c')][_0x4073('0x71')]())+_0x4073('0x75')](_0x4249b1);})[_0x4073('0x25')](respondWithResult(_0x5892e4,null))[_0x4073('0x41')](handleError(_0x5892e4,null));};exports['addQueues']=function(_0x3aaa55,_0x4cb41f,_0x3aad2c){return db['Team']['findOne']({'where':{'id':_0x3aaa55[_0x4073('0x4c')]['id']}})[_0x4073('0x25')](function(_0x3e4e72){if(_0x3e4e72){if(!_0x3aaa55[_0x4073('0x45')][_0x4073('0x6c')]||!utils['isValidChannel'](_0x3aaa55['body']['channel'])){throw new db[(_0x4073('0x50'))][(_0x4073('0x6e'))](_0x4073('0x6f'));}return _0x3e4e72[_0x4073('0x76')+_[_0x4073('0x70')](_0x3aaa55[_0x4073('0x45')][_0x4073('0x6c')][_0x4073('0x71')]())+_0x4073('0x75')](_0x3aaa55['body'][_0x4073('0x77')]);}return null;})[_0x4073('0x25')](handleEntityNotFound(_0x4cb41f,null))['then'](respondWithStatusCode(_0x4cb41f,null))[_0x4073('0x41')](handleError(_0x4cb41f,null));};exports[_0x4073('0x78')]=function(_0x57aa55,_0x5e3628,_0x146f51){return db[_0x4073('0x2b')]['findOne']({'where':{'id':_0x57aa55['params']['id']}})[_0x4073('0x25')](function(_0x422296){if(_0x422296){if(!_0x57aa55['query']['channel']||!utils['isValidChannel'](_0x57aa55[_0x4073('0x31')][_0x4073('0x6c')])){throw new db[(_0x4073('0x50'))]['ValidationError'](_0x4073('0x6f'));}return _0x422296[_0x4073('0x79')+_[_0x4073('0x70')](_0x57aa55[_0x4073('0x31')][_0x4073('0x6c')][_0x4073('0x71')]())+'Queues'](_0x57aa55[_0x4073('0x31')][_0x4073('0x77')]);}return null;})[_0x4073('0x25')](handleEntityNotFound(_0x5e3628,null))[_0x4073('0x25')](respondWithStatusCode(_0x5e3628,null))[_0x4073('0x41')](handleError(_0x5e3628,null));};exports[_0x4073('0x7a')]=function(_0x4eb1ce,_0x46f7cc){var _0x2dc055=_[_0x4073('0x7b')](_0x4eb1ce[_0x4073('0x45')][_0x4073('0x77')])?_0x4eb1ce[_0x4073('0x45')][_0x4073('0x77')]:[_0x4eb1ce['body'][_0x4073('0x77')]];var _0x73412=_0x4eb1ce[_0x4073('0x4c')]['id'];return db[_0x4073('0x2b')]['find']({'where':{'id':_0x73412}})['then'](handleEntityNotFound(_0x46f7cc,null))[_0x4073('0x25')](function(_0x2bd6da){if(_0x2bd6da){var _0x171f04=[_0x4073('0x7c'),_0x4073('0x7d'),_0x4073('0x7e'),'Sms',_0x4073('0x7f'),_0x4073('0x80'),'Whatsapp'];return db[_0x4073('0x4e')][_0x4073('0x81')](function(_0x13e0f4){var _0x547f2b=_[_0x4073('0x30')](_0x171f04,function(_0x45004c){var _0x3ceb67={'attributes':['id',_0x4073('0x28')]};if(_0x45004c===_0x4073('0x7c')){_0x3ceb67[_0x4073('0x82')]={'attributes':[_0x4073('0x83')]};}return _0x2bd6da[_0x4073('0x74')+_0x45004c+_0x4073('0x75')](_0x3ceb67)['then'](function(_0x4a1167){var _0x202281=_[_0x4073('0x30')](_0x4a1167,function(_0x298a0e){var _0x25022b=_[_0x4073('0x30')](_0x2dc055,function(_0x53657d){var _0x4f09f3={'where':{'UserId':_0x53657d,[_0x45004c+'QueueId']:_0x298a0e['id']},'transaction':_0x13e0f4};if(_0x45004c===_0x4073('0x7c')){_0x4f09f3[_0x4073('0x15')]={'penalty':_0x298a0e[_0x4073('0x84')]['penalty']};}return db['User'+_0x45004c+_0x4073('0x72')][_0x4073('0x85')](_0x4f09f3)['then'](function(){socket['emit']('user'+_0x45004c+_0x4073('0x86'),{'UserId':_0x53657d,[_0x45004c+'QueueId']:_0x298a0e['id']});if(_0x45004c!==_0x4073('0x7c')){return;}return db['User'][_0x4073('0x87')]({'where':{'id':_0x2dc055,'online':0x1},'attributes':['id','name','online',_0x4073('0x88'),_0x4073('0x89')],'raw':!![]})[_0x4073('0x25')](function(_0x518521){var _0x20e216=_['map'](_0x518521,function(_0x51e7df){return db[_0x4073('0x8a')][_0x4073('0x8b')]({'membername':_0x51e7df[_0x4073('0x28')],'UserId':_0x51e7df['id'],'queue_name':_0x298a0e[_0x4073('0x28')],'VoiceQueueId':_0x298a0e['id'],'interface':_[_0x4073('0x8c')](_0x51e7df['interface'])?util['format'](_0x4073('0x8d'),_0x51e7df['name']):_0x51e7df[_0x4073('0x89')],'paused':_0x51e7df[_0x4073('0x88')]||![],'penalty':_0x298a0e[_0x4073('0x84')][_0x4073('0x83')]},{'transaction':_0x13e0f4});});return Promise[_0x4073('0x8e')](_0x20e216);});});});return Promise[_0x4073('0x8e')](_0x25022b);});return Promise['all'](_0x202281);})[_0x4073('0x25')](function(){return db[_0x4073('0x8f')][_0x4073('0x6b')]({'where':{'teamId':_0x73412}})['then'](function(_0x2824bd){if(_0x2824bd){var _0x3f66b6=_[_0x4073('0x30')](_0x2dc055,function(_0x58b767){db[_0x4073('0x67')]['upsert']({'UserId':_0x58b767,'VoicePrefixId':_0x2824bd[_0x4073('0x68')]});});return Promise[_0x4073('0x8e')](_0x3f66b6);}});});});return Promise[_0x4073('0x8e')](_0x547f2b)[_0x4073('0x25')](function(){return _0x2bd6da[_0x4073('0x7a')](_0x2dc055,{'transaction':_0x13e0f4})[_0x4073('0x90')](function(_0x3281e4){return _0x3281e4;});});});}})[_0x4073('0x25')](respondWithResult(_0x46f7cc,null))[_0x4073('0x41')](handleError(_0x46f7cc,null));};exports['removeAgents']=function(_0x37d85a,_0x5db9f0){var _0xc577ae=_[_0x4073('0x7b')](_0x37d85a['query'][_0x4073('0x77')])?_0x37d85a['query'][_0x4073('0x77')]:[_0x37d85a[_0x4073('0x31')][_0x4073('0x77')]];var _0x1b805e=_0x37d85a[_0x4073('0x4c')]['id'];return db[_0x4073('0x2b')][_0x4073('0x43')]({'where':{'id':_0x1b805e}})[_0x4073('0x25')](handleEntityNotFound(_0x5db9f0,null))[_0x4073('0x25')](function(_0x5284ee){if(_0x5284ee){var _0x3e0edd=[_0x4073('0x7c'),_0x4073('0x7d'),_0x4073('0x7e'),_0x4073('0x91'),_0x4073('0x7f'),_0x4073('0x80'),_0x4073('0x92')];return db[_0x4073('0x4e')]['transaction'](function(_0x43d2f9){var _0x32bc32=_[_0x4073('0x30')](_0x3e0edd,function(_0x5e9d02){var _0x2f96c6={'attributes':['id','name']};return _0x5284ee['get'+_0x5e9d02+_0x4073('0x75')](_0x2f96c6)[_0x4073('0x25')](function(_0x290281){var _0x5784be=_[_0x4073('0x30')](_0x290281,function(_0x421f8d){return _0x421f8d[_0x4073('0x93')](_0xc577ae,{'transaction':_0x43d2f9})[_0x4073('0x25')](function(){var _0x25d718=_[_0x4073('0x30')](_0xc577ae,function(_0x4e3a62){socket['emit'](_0x4073('0x46')+_0x5e9d02+'Queue:remove',{'UserId':Number(_0x4e3a62),[_0x5e9d02+_0x4073('0x94')]:_0x421f8d['id']});if(_0x5e9d02!==_0x4073('0x7c')){return;}return db[_0x4073('0x8a')]['destroy']({'where':{'VoiceQueueId':_0x421f8d['id'],'UserId':_0x4e3a62},'transaction':_0x43d2f9});});return Promise[_0x4073('0x8e')](_0x25d718);});});return Promise['all'](_0x5784be);});});return Promise['all'](_0x32bc32)[_0x4073('0x25')](function(){return _0x5284ee[_0x4073('0x93')](_0xc577ae,{'transaction':_0x43d2f9});})[_0x4073('0x25')](function(){return db[_0x4073('0x8f')][_0x4073('0x6b')]({'where':{'teamId':_0x1b805e}})[_0x4073('0x25')](function(_0x2f27d4){if(_0x2f27d4){var _0x2cbea1=_[_0x4073('0x30')](_0xc577ae,function(_0x52abe4){db[_0x4073('0x67')][_0x4073('0x4d')]({'where':{'UserId':_0x52abe4,'VoicePrefixId':_0x2f27d4[_0x4073('0x68')]}});});return Promise[_0x4073('0x8e')](_0x2cbea1);}});});});}})[_0x4073('0x25')](respondWithStatusCode(_0x5db9f0,null))[_0x4073('0x41')](handleError(_0x5db9f0,null));};exports[_0x4073('0x95')]=function(_0x48d584,_0x1c58eb,_0x461115){var _0x37699a={};var _0x28a54e={};var _0xe1c793;var _0x3b6bdd;return db['Team'][_0x4073('0x6b')]({'where':{'id':_0x48d584[_0x4073('0x4c')]['id']}})[_0x4073('0x25')](handleEntityNotFound(_0x1c58eb,null))[_0x4073('0x25')](function(_0x4690d6){if(_0x4690d6){_0xe1c793=_0x4690d6;_0x28a54e[_0x4073('0x2f')]=_['keys'](db[_0x4073('0x96')]['rawAttributes']);_0x28a54e[_0x4073('0x31')]=_[_0x4073('0x32')](_0x48d584['query']);_0x28a54e[_0x4073('0x33')]=_['intersection'](_0x28a54e['model'],_0x28a54e[_0x4073('0x31')]);_0x37699a[_0x4073('0x36')]=_[_0x4073('0x34')](_0x28a54e[_0x4073('0x2f')],qs[_0x4073('0x35')](_0x48d584[_0x4073('0x31')]['fields']));_0x37699a[_0x4073('0x36')]=_0x37699a['attributes'][_0x4073('0x37')]?_0x37699a['attributes']:_0x28a54e[_0x4073('0x2f')];_0x37699a['order']=qs[_0x4073('0x3a')](_0x48d584[_0x4073('0x31')]['sort']);_0x37699a[_0x4073('0x3b')]=qs['filters'](_[_0x4073('0x97')](_0x48d584['query'],_0x28a54e[_0x4073('0x33')]));if(_0x48d584[_0x4073('0x31')][_0x4073('0x3e')]){_0x37699a[_0x4073('0x3b')]=_[_0x4073('0x3c')](_0x37699a[_0x4073('0x3b')],{'$or':_[_0x4073('0x30')](_0x37699a['attributes'],function(_0x474b33){var _0x6bf211={};_0x6bf211[_0x474b33]={'$like':'%'+_0x48d584[_0x4073('0x31')][_0x4073('0x3e')]+'%'};return _0x6bf211;})});}_0x37699a=_[_0x4073('0x3c')]({},_0x37699a,_0x48d584['options']);return _0xe1c793[_0x4073('0x95')](_0x37699a);}})[_0x4073('0x25')](function(_0x4578c7){if(_0x4578c7){_0x3b6bdd=_0x4578c7[_0x4073('0x37')];if(!_0x48d584['query'][_0x4073('0x38')](_0x4073('0x39'))){_0x37699a['limit']=qs['limit'](_0x48d584[_0x4073('0x31')][_0x4073('0x1e')]);_0x37699a[_0x4073('0x1d')]=qs[_0x4073('0x1d')](_0x48d584[_0x4073('0x31')][_0x4073('0x1d')]);}return _0xe1c793[_0x4073('0x95')](_0x37699a);}})['then'](function(_0x52f098){if(_0x52f098){return _0x52f098?{'count':_0x3b6bdd,'rows':_0x52f098}:null;}})[_0x4073('0x25')](respondWithResult(_0x1c58eb,null))[_0x4073('0x41')](handleError(_0x1c58eb,null));}; \ No newline at end of file +var _0x74d0=['addQueues','add','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','defaults','TeamVoiceQueue','findOrCreate','emit','Queue:save','User','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','UserVoicePrefix','upsert','spread','removeAgents','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','Team','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','body','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','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','ChatQueueId','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x74d0,0x1eb));var _0x074d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x74d0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x074d('0x0'));var rimraf=require(_0x074d('0x1'));var zipdir=require(_0x074d('0x2'));var jsonpatch=require(_0x074d('0x3'));var rp=require('request-promise');var moment=require(_0x074d('0x4'));var BPromise=require(_0x074d('0x5'));var Mustache=require(_0x074d('0x6'));var util=require(_0x074d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x074d('0x8'));var ejs=require(_0x074d('0x9'));var fs=require('fs');var fs_extra=require(_0x074d('0xa'));var _=require('lodash');var squel=require(_0x074d('0xb'));var crypto=require(_0x074d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x074d('0xd'));var toCsv=require(_0x074d('0x8'));var querystring=require(_0x074d('0xe'));var Papa=require(_0x074d('0xf'));var Redis=require(_0x074d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x074d('0x11'));var as=require(_0x074d('0x12'));var hardwareService=require(_0x074d('0x13'));var logger=require(_0x074d('0x14'))(_0x074d('0x15'));var utils=require(_0x074d('0x16'));var config=require(_0x074d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x074d('0x18')]=_['defaults'](config[_0x074d('0x18')],{'host':_0x074d('0x19'),'port':0x18eb});var socket=require(_0x074d('0x1a'))(new Redis(config[_0x074d('0x18')]));require(_0x074d('0x1b'))[_0x074d('0x1c')](socket);function respondWithStatusCode(_0x4ca2d0,_0x109c32){_0x109c32=_0x109c32||0xcc;return function(_0x3209c3){if(_0x3209c3){return _0x4ca2d0[_0x074d('0x1d')](_0x109c32);}return _0x4ca2d0[_0x074d('0x1e')](_0x109c32)[_0x074d('0x1f')]();};}function respondWithResult(_0x24e03d,_0x30d37a){_0x30d37a=_0x30d37a||0xc8;return function(_0x441d26){if(_0x441d26){return _0x24e03d[_0x074d('0x1e')](_0x30d37a)['json'](_0x441d26);}};}function respondWithFilteredResult(_0x3185fa,_0x157e81){return function(_0x1ad740){if(_0x1ad740){var _0x20c6e4=typeof _0x157e81['offset']===_0x074d('0x20')&&typeof _0x157e81[_0x074d('0x21')]==='undefined';var _0x8b77ef=_0x1ad740[_0x074d('0x22')];var _0x3bf674=_0x20c6e4?0x0:_0x157e81['offset'];var _0x28eb80=_0x20c6e4?_0x1ad740[_0x074d('0x22')]:_0x157e81['offset']+_0x157e81[_0x074d('0x21')];var _0x34e353;if(_0x28eb80>=_0x8b77ef){_0x28eb80=_0x8b77ef;_0x34e353=0xc8;}else{_0x34e353=0xce;}_0x3185fa['status'](_0x34e353);return _0x3185fa[_0x074d('0x23')](_0x074d('0x24'),_0x3bf674+'-'+_0x28eb80+'/'+_0x8b77ef)[_0x074d('0x25')](_0x1ad740);}return null;};}function patchUpdates(_0x20ec87){return function(_0x31d1e0){try{jsonpatch[_0x074d('0x26')](_0x31d1e0,_0x20ec87,!![]);}catch(_0x59ce78){return BPromise[_0x074d('0x27')](_0x59ce78);}return _0x31d1e0[_0x074d('0x28')]();};}function saveUpdates(_0x15f7b3,_0x4883f3){return function(_0xe43ec1){if(_0xe43ec1){return _0xe43ec1[_0x074d('0x29')](_0x15f7b3)[_0x074d('0x2a')](function(_0x20c707){return _0x20c707;});}return null;};}function handleEntityNotFound(_0x5b6285,_0x5bf584){return function(_0x10ef76){if(!_0x10ef76){_0x5b6285['sendStatus'](0x194);}return _0x10ef76;};}function handleError(_0x56f13d,_0x305199){_0x305199=_0x305199||0x1f4;return function(_0x2555da){logger[_0x074d('0x2b')](_0x2555da[_0x074d('0x2c')]);if(_0x2555da['name']){delete _0x2555da[_0x074d('0x2d')];}_0x56f13d['status'](_0x305199)[_0x074d('0x2e')](_0x2555da);};}exports['index']=function(_0x3fc0ed,_0x312a9f){var _0x110adc={},_0x41da54={},_0x382088={'count':0x0,'rows':[]};var _0x4be06f=_[_0x074d('0x2f')](db[_0x074d('0x30')][_0x074d('0x31')],function(_0x3e3102){return{'name':_0x3e3102[_0x074d('0x32')],'type':_0x3e3102['type']['key']};});_0x41da54['model']=_[_0x074d('0x2f')](_0x4be06f,_0x074d('0x2d'));_0x41da54[_0x074d('0x33')]=_[_0x074d('0x34')](_0x3fc0ed[_0x074d('0x33')]);_0x41da54[_0x074d('0x35')]=_[_0x074d('0x36')](_0x41da54[_0x074d('0x37')],_0x41da54[_0x074d('0x33')]);_0x110adc[_0x074d('0x38')]=_['intersection'](_0x41da54[_0x074d('0x37')],qs[_0x074d('0x39')](_0x3fc0ed[_0x074d('0x33')][_0x074d('0x39')]));_0x110adc[_0x074d('0x38')]=_0x110adc[_0x074d('0x38')][_0x074d('0x3a')]?_0x110adc['attributes']:_0x41da54[_0x074d('0x37')];if(!_0x3fc0ed[_0x074d('0x33')][_0x074d('0x3b')](_0x074d('0x3c'))){_0x110adc[_0x074d('0x21')]=qs['limit'](_0x3fc0ed[_0x074d('0x33')][_0x074d('0x21')]);_0x110adc[_0x074d('0x3d')]=qs[_0x074d('0x3d')](_0x3fc0ed[_0x074d('0x33')]['offset']);}_0x110adc[_0x074d('0x3e')]=qs['sort'](_0x3fc0ed[_0x074d('0x33')][_0x074d('0x3f')]);_0x110adc[_0x074d('0x40')]=qs[_0x074d('0x35')](_['pick'](_0x3fc0ed[_0x074d('0x33')],_0x41da54[_0x074d('0x35')]),_0x4be06f);if(_0x3fc0ed[_0x074d('0x33')][_0x074d('0x41')]){_0x110adc[_0x074d('0x40')]=_['merge'](_0x110adc[_0x074d('0x40')],{'$or':_['map'](_0x4be06f,function(_0x5b8ec6){if(_0x5b8ec6[_0x074d('0x42')]!==_0x074d('0x43')){var _0x536c18={};_0x536c18[_0x5b8ec6[_0x074d('0x2d')]]={'$like':'%'+_0x3fc0ed[_0x074d('0x33')][_0x074d('0x41')]+'%'};return _0x536c18;}})});}_0x110adc=_[_0x074d('0x44')]({},_0x110adc,_0x3fc0ed[_0x074d('0x45')]);var _0xe0cd51={'where':_0x110adc[_0x074d('0x40')]};return db[_0x074d('0x30')]['count'](_0xe0cd51)[_0x074d('0x2a')](function(_0x5e7076){_0x382088[_0x074d('0x22')]=_0x5e7076;if(_0x3fc0ed['query'][_0x074d('0x46')]){_0x110adc[_0x074d('0x47')]=[{'all':!![]}];}return db[_0x074d('0x30')][_0x074d('0x48')](_0x110adc);})[_0x074d('0x2a')](function(_0x225beb){_0x382088[_0x074d('0x49')]=_0x225beb;return _0x382088;})[_0x074d('0x2a')](respondWithFilteredResult(_0x312a9f,_0x110adc))[_0x074d('0x4a')](handleError(_0x312a9f,null));};exports[_0x074d('0x4b')]=function(_0x177676,_0x4ce801){var _0x3329bd={'raw':![],'where':{'id':_0x177676[_0x074d('0x4c')]['id']}},_0x46673a={};_0x46673a[_0x074d('0x37')]=_[_0x074d('0x34')](db[_0x074d('0x30')][_0x074d('0x31')]);_0x46673a['query']=_['keys'](_0x177676[_0x074d('0x33')]);_0x46673a[_0x074d('0x35')]=_[_0x074d('0x36')](_0x46673a[_0x074d('0x37')],_0x46673a[_0x074d('0x33')]);_0x3329bd['attributes']=_['intersection'](_0x46673a[_0x074d('0x37')],qs[_0x074d('0x39')](_0x177676[_0x074d('0x33')][_0x074d('0x39')]));_0x3329bd[_0x074d('0x38')]=_0x3329bd[_0x074d('0x38')]['length']?_0x3329bd['attributes']:_0x46673a[_0x074d('0x37')];if(_0x177676[_0x074d('0x33')][_0x074d('0x46')]){_0x3329bd['include']=[{'all':!![]}];}_0x3329bd=_[_0x074d('0x44')]({},_0x3329bd,_0x177676[_0x074d('0x45')]);return db[_0x074d('0x30')][_0x074d('0x4d')](_0x3329bd)[_0x074d('0x2a')](handleEntityNotFound(_0x4ce801,null))[_0x074d('0x2a')](respondWithResult(_0x4ce801,null))[_0x074d('0x4a')](handleError(_0x4ce801,null));};exports['create']=function(_0x21b23a,_0x468994){return db[_0x074d('0x30')][_0x074d('0x4e')](_0x21b23a['body'],{})[_0x074d('0x2a')](function(_0x4c8e8a){var _0x332bc2=_0x21b23a[_0x074d('0x4f')]['get']({'plain':!![]});if(!_0x332bc2)throw new Error(_0x074d('0x50'));if(_0x332bc2[_0x074d('0x51')]==='user'){var _0x5174b2=_0x4c8e8a[_0x074d('0x52')]({'plain':!![]});var _0x1ccb94=_0x074d('0x53');return db['UserProfileSection'][_0x074d('0x4d')]({'where':{'name':_0x1ccb94,'userProfileId':_0x332bc2['userProfileId']},'raw':!![]})[_0x074d('0x2a')](function(_0x36d8a7){if(_0x36d8a7&&_0x36d8a7['autoAssociation']===0x0){return db['UserProfileResource'][_0x074d('0x4e')]({'name':_0x5174b2[_0x074d('0x2d')],'resourceId':_0x5174b2['id'],'type':_0x36d8a7[_0x074d('0x2d')],'sectionId':_0x36d8a7['id']},{})[_0x074d('0x2a')](function(){return _0x4c8e8a;});}else{return _0x4c8e8a;}})[_0x074d('0x4a')](function(_0x3f0001){logger[_0x074d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f0001);throw _0x3f0001;});}return _0x4c8e8a;})[_0x074d('0x2a')](respondWithResult(_0x468994,0xc9))[_0x074d('0x4a')](handleError(_0x468994,null));};exports[_0x074d('0x29')]=function(_0x45909c,_0x300c31){if(_0x45909c[_0x074d('0x54')]['id']){delete _0x45909c['body']['id'];}return db[_0x074d('0x30')][_0x074d('0x4d')]({'where':{'id':_0x45909c[_0x074d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x300c31,null))[_0x074d('0x2a')](saveUpdates(_0x45909c[_0x074d('0x54')],null))['then'](respondWithResult(_0x300c31,null))[_0x074d('0x4a')](handleError(_0x300c31,null));};exports[_0x074d('0x55')]=function(_0x72e9ec,_0x5093a4){var _0x3ed980=_0x72e9ec['params']['id'];var _0x126348=[];return db[_0x074d('0x56')]['transaction'](function(_0x25835a){var _0xb05b0=_0x074d('0x57')+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0xb05b0,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a})[_0x074d('0x2a')](function(_0x3de980){_0x126348=_[_0x074d('0x2f')](_0x3de980,function(_0x400b80){return Number(_0x400b80[_0x074d('0x5b')]);});})[_0x074d('0x2a')](function(){var _0x196d3c='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0x196d3c,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})[_0x074d('0x2a')](function(_0x44b08e){var _0x19ae52=_['map'](_0x44b08e,function(_0x1cabc6){return Number(_0x1cabc6[_0x074d('0x5c')]);});return db['UserVoiceQueue'][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'VoiceQueueId':{'$in':_0x19ae52}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0x334c35=_0x074d('0x5d')+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0x334c35,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})[_0x074d('0x2a')](function(_0x190af1){var _0x4de918=_['map'](_0x190af1,function(_0x1db590){return Number(_0x1db590['MailQueueId']);});return db[_0x074d('0x5e')][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'MailQueueId':{'$in':_0x4de918}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0x3b425e=_0x074d('0x5f')+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0x3b425e,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})['then'](function(_0x63fb11){var _0x822049=_[_0x074d('0x2f')](_0x63fb11,function(_0x4cf98b){return Number(_0x4cf98b[_0x074d('0x60')]);});return db[_0x074d('0x61')]['destroy']({'where':{'UserId':{'$in':_0x126348},'SmsQueueId':{'$in':_0x822049}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0x16b72c=_0x074d('0x62')+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0x16b72c,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})['then'](function(_0xd4150){var _0x50cc35=_[_0x074d('0x2f')](_0xd4150,function(_0xbc9b19){return Number(_0xbc9b19[_0x074d('0x63')]);});return db['UserChatQueue'][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'ChatQueueId':{'$in':_0x50cc35}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0x157fdc='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3ed980;return db[_0x074d('0x56')]['query'](_0x157fdc,{'type':db[_0x074d('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x25835a});})['then'](function(_0x5e93fb){var _0x21af8b=_['map'](_0x5e93fb,function(_0x1a3724){return Number(_0x1a3724['FaxQueueId']);});return db[_0x074d('0x64')][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'FaxQueueId':{'$in':_0x21af8b}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0xecd57e='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0xecd57e,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})[_0x074d('0x2a')](function(_0x1a1e49){var _0x52c080=_[_0x074d('0x2f')](_0x1a1e49,function(_0x37ea35){return Number(_0x37ea35[_0x074d('0x65')]);});return db[_0x074d('0x66')][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'OpenchannelQueueId':{'$in':_0x52c080}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0x3e56b8='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3ed980;return db['sequelize'][_0x074d('0x33')](_0x3e56b8,{'type':db['Sequelize']['QueryTypes'][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})[_0x074d('0x2a')](function(_0x24337b){var _0x13b83b=_[_0x074d('0x2f')](_0x24337b,function(_0x282894){return Number(_0x282894[_0x074d('0x67')]);});return db[_0x074d('0x68')][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'WhatsappQueueId':{'$in':_0x13b83b}},'transaction':_0x25835a});})['then'](function(){return db[_0x074d('0x69')]['find']({'where':{'TeamId':_0x3ed980}});})[_0x074d('0x2a')](function(_0x3ae5b9){if(_0x3ae5b9===null){return;}return db['UserVoicePrefix'][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'VoicePrefixId':_0x3ae5b9[_0x074d('0x6a')]},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){return db[_0x074d('0x30')][_0x074d('0x55')]({'where':{'id':_0x3ed980},'cascade':!![],'transaction':_0x25835a});})[_0x074d('0x2a')](function(_0x180b53){if(_0x180b53===0x0){_0x5093a4[_0x074d('0x1d')](0x194);}else{return db[_0x074d('0x6b')]['destroy']({'where':{'type':_0x074d('0x53'),'resourceId':_0x3ed980},'cascade':!![],'transaction':_0x25835a})[_0x074d('0x2a')](function(){_0x5093a4['status'](0xcc)[_0x074d('0x1f')]();});}})[_0x074d('0x4a')](function(_0x29987c){_0x5093a4['status'](0x1f4)[_0x074d('0x2e')](_0x29987c);});});};exports[_0x074d('0x6c')]=function(_0x1e690a,_0x2de0a1,_0xbfa81){return db[_0x074d('0x30')][_0x074d('0x6d')]({'where':{'id':_0x1e690a['params']['id']}})[_0x074d('0x2a')](handleEntityNotFound(_0x2de0a1,null))[_0x074d('0x2a')](function(_0x18a92e){if(!_0x1e690a['query'][_0x074d('0x6e')]||!utils[_0x074d('0x6f')](_0x1e690a['query'][_0x074d('0x6e')])){throw new db[(_0x074d('0x58'))][(_0x074d('0x70'))](_0x074d('0x71'));}var _0x8a77e5={};var _0x29b82d={};_0x29b82d[_0x074d('0x37')]=_[_0x074d('0x34')](db[_[_0x074d('0x72')](_0x1e690a[_0x074d('0x33')]['channel']['toLowerCase']())+'Queue'][_0x074d('0x31')]);_0x29b82d[_0x074d('0x33')]=_['keys'](_0x1e690a[_0x074d('0x33')]);_0x29b82d['filters']=_[_0x074d('0x36')](_0x29b82d[_0x074d('0x37')],_0x29b82d['query']);_0x8a77e5['attributes']=_['intersection'](_0x29b82d[_0x074d('0x37')],qs[_0x074d('0x39')](_0x1e690a[_0x074d('0x33')][_0x074d('0x39')]));_0x8a77e5[_0x074d('0x38')]=_0x8a77e5['attributes'][_0x074d('0x3a')]?_0x8a77e5[_0x074d('0x38')]:_0x29b82d[_0x074d('0x37')];_0x8a77e5[_0x074d('0x21')]=qs['limit'](_0x1e690a[_0x074d('0x33')][_0x074d('0x21')]);_0x8a77e5[_0x074d('0x3d')]=qs[_0x074d('0x3d')](_0x1e690a[_0x074d('0x33')][_0x074d('0x3d')]);_0x8a77e5[_0x074d('0x3e')]=qs[_0x074d('0x3f')](_0x1e690a[_0x074d('0x33')][_0x074d('0x3f')]);_0x8a77e5['where']=qs['filters'](_['pick'](_0x1e690a[_0x074d('0x33')],_0x29b82d[_0x074d('0x35')]));_0x8a77e5=_['merge']({},_0x8a77e5,_0x1e690a[_0x074d('0x45')]);return _0x18a92e['get'+_[_0x074d('0x72')](_0x1e690a[_0x074d('0x33')]['channel'][_0x074d('0x73')]())+_0x074d('0x74')](_0x8a77e5);})[_0x074d('0x2a')](respondWithResult(_0x2de0a1,null))[_0x074d('0x4a')](handleError(_0x2de0a1,null));};exports[_0x074d('0x75')]=function(_0xa8e08f,_0x48a82e,_0x199089){return db['Team'][_0x074d('0x6d')]({'where':{'id':_0xa8e08f[_0x074d('0x4c')]['id']}})['then'](function(_0x1f957b){if(_0x1f957b){if(!_0xa8e08f[_0x074d('0x54')][_0x074d('0x6e')]||!utils['isValidChannel'](_0xa8e08f[_0x074d('0x54')][_0x074d('0x6e')])){throw new db[(_0x074d('0x58'))][(_0x074d('0x70'))](_0x074d('0x71'));}return _0x1f957b[_0x074d('0x76')+_['capitalize'](_0xa8e08f['body']['channel']['toLowerCase']())+_0x074d('0x74')](_0xa8e08f[_0x074d('0x54')][_0x074d('0x77')]);}return null;})[_0x074d('0x2a')](handleEntityNotFound(_0x48a82e,null))[_0x074d('0x2a')](respondWithStatusCode(_0x48a82e,null))[_0x074d('0x4a')](handleError(_0x48a82e,null));};exports['removeQueues']=function(_0x56e820,_0x1372f7,_0x336694){return db[_0x074d('0x30')][_0x074d('0x6d')]({'where':{'id':_0x56e820[_0x074d('0x4c')]['id']}})['then'](function(_0x4e2aed){if(_0x4e2aed){if(!_0x56e820[_0x074d('0x33')][_0x074d('0x6e')]||!utils[_0x074d('0x6f')](_0x56e820['query'][_0x074d('0x6e')])){throw new db[(_0x074d('0x58'))]['ValidationError'](_0x074d('0x71'));}return _0x4e2aed['remove'+_[_0x074d('0x72')](_0x56e820[_0x074d('0x33')][_0x074d('0x6e')][_0x074d('0x73')]())+_0x074d('0x74')](_0x56e820[_0x074d('0x33')][_0x074d('0x77')]);}return null;})['then'](handleEntityNotFound(_0x1372f7,null))[_0x074d('0x2a')](respondWithStatusCode(_0x1372f7,null))[_0x074d('0x4a')](handleError(_0x1372f7,null));};exports[_0x074d('0x78')]=function(_0x2bf9ef,_0x2a35df){var _0x351db2=_[_0x074d('0x79')](_0x2bf9ef[_0x074d('0x54')][_0x074d('0x77')])?_0x2bf9ef[_0x074d('0x54')]['ids']:[_0x2bf9ef[_0x074d('0x54')][_0x074d('0x77')]];var _0x17b8ff=_0x2bf9ef[_0x074d('0x4c')]['id'];return db[_0x074d('0x30')][_0x074d('0x4d')]({'where':{'id':_0x17b8ff}})[_0x074d('0x2a')](handleEntityNotFound(_0x2a35df,null))[_0x074d('0x2a')](function(_0x651496){if(_0x651496){var _0x56a1bc=[_0x074d('0x7a'),_0x074d('0x7b'),_0x074d('0x7c'),_0x074d('0x7d'),_0x074d('0x7e'),_0x074d('0x7f'),_0x074d('0x80')];return db[_0x074d('0x56')][_0x074d('0x81')](function(_0x2a84af){var _0x589997=_['map'](_0x56a1bc,function(_0x2528af){var _0x565a2b={'attributes':['id','name']};if(_0x2528af===_0x074d('0x7a')){_0x565a2b[_0x074d('0x82')]={'attributes':[_0x074d('0x83')]};}return _0x651496[_0x074d('0x52')+_0x2528af+_0x074d('0x74')](_0x565a2b)[_0x074d('0x2a')](function(_0x1b1044){var _0x288b76=_[_0x074d('0x2f')](_0x1b1044,function(_0x33644b){var _0x3a529f=_[_0x074d('0x2f')](_0x351db2,function(_0x3012ad){var _0xc2e911={'where':{'UserId':_0x3012ad,[_0x2528af+_0x074d('0x84')]:_0x33644b['id']},'transaction':_0x2a84af};if(_0x2528af===_0x074d('0x7a')){_0xc2e911[_0x074d('0x85')]={'penalty':_0x33644b[_0x074d('0x86')]['penalty']};}return db['User'+_0x2528af+'Queue'][_0x074d('0x87')](_0xc2e911)['then'](function(){socket[_0x074d('0x88')](_0x074d('0x4f')+_0x2528af+_0x074d('0x89'),{'UserId':_0x3012ad,[_0x2528af+'QueueId']:_0x33644b['id']});if(_0x2528af!=='Voice'){return;}return db[_0x074d('0x8a')][_0x074d('0x48')]({'where':{'id':_0x351db2,'online':0x1},'attributes':['id',_0x074d('0x2d'),'online',_0x074d('0x8b'),_0x074d('0x8c')],'raw':!![]})['then'](function(_0x354896){var _0x3d2d24=_[_0x074d('0x2f')](_0x354896,function(_0x27434f){return db[_0x074d('0x8d')]['upsert']({'membername':_0x27434f['name'],'UserId':_0x27434f['id'],'queue_name':_0x33644b[_0x074d('0x2d')],'VoiceQueueId':_0x33644b['id'],'interface':_[_0x074d('0x8e')](_0x27434f['interface'])?util[_0x074d('0x8f')](_0x074d('0x90'),_0x27434f['name']):_0x27434f[_0x074d('0x8c')],'paused':_0x27434f[_0x074d('0x8b')]||![],'penalty':_0x33644b[_0x074d('0x86')][_0x074d('0x83')]},{'transaction':_0x2a84af});});return Promise[_0x074d('0x91')](_0x3d2d24);});});});return Promise[_0x074d('0x91')](_0x3a529f);});return Promise[_0x074d('0x91')](_0x288b76);})[_0x074d('0x2a')](function(){return db[_0x074d('0x69')][_0x074d('0x6d')]({'where':{'teamId':_0x17b8ff}})[_0x074d('0x2a')](function(_0x273f51){if(_0x273f51){var _0x4b68b8=_[_0x074d('0x2f')](_0x351db2,function(_0x58a9f6){db[_0x074d('0x92')][_0x074d('0x93')]({'UserId':_0x58a9f6,'VoicePrefixId':_0x273f51[_0x074d('0x6a')]});});return Promise[_0x074d('0x91')](_0x4b68b8);}});});});return Promise[_0x074d('0x91')](_0x589997)[_0x074d('0x2a')](function(){return _0x651496[_0x074d('0x78')](_0x351db2,{'transaction':_0x2a84af})[_0x074d('0x94')](function(_0x367cfc){return _0x367cfc;});});});}})[_0x074d('0x2a')](respondWithResult(_0x2a35df,null))[_0x074d('0x4a')](handleError(_0x2a35df,null));};exports[_0x074d('0x95')]=function(_0x45bce5,_0x5668a4){var _0x176c4f=_[_0x074d('0x79')](_0x45bce5[_0x074d('0x33')][_0x074d('0x77')])?_0x45bce5[_0x074d('0x33')]['ids']:[_0x45bce5['query']['ids']];var _0x976f83=_0x45bce5[_0x074d('0x4c')]['id'];return db[_0x074d('0x30')]['find']({'where':{'id':_0x976f83}})[_0x074d('0x2a')](handleEntityNotFound(_0x5668a4,null))[_0x074d('0x2a')](function(_0x24b8d1){if(_0x24b8d1){var _0x2885c0=['Voice',_0x074d('0x7b'),_0x074d('0x7c'),_0x074d('0x7d'),_0x074d('0x7e'),'Openchannel',_0x074d('0x80')];return db[_0x074d('0x56')][_0x074d('0x81')](function(_0x1b6c53){var _0x4c6ce3=_[_0x074d('0x2f')](_0x2885c0,function(_0x3fff2a){var _0x17329d={'attributes':['id',_0x074d('0x2d')]};return _0x24b8d1[_0x074d('0x52')+_0x3fff2a+_0x074d('0x74')](_0x17329d)['then'](function(_0x1b639a){var _0xc47e25=_[_0x074d('0x2f')](_0x1b639a,function(_0x50063f){return _0x50063f[_0x074d('0x95')](_0x176c4f,{'transaction':_0x1b6c53})[_0x074d('0x2a')](function(){var _0x408f6=_[_0x074d('0x2f')](_0x176c4f,function(_0x33e61c){socket[_0x074d('0x88')](_0x074d('0x4f')+_0x3fff2a+'Queue:remove',{'UserId':Number(_0x33e61c),[_0x3fff2a+_0x074d('0x84')]:_0x50063f['id']});if(_0x3fff2a!==_0x074d('0x7a')){return;}return db['UserVoiceQueueRt'][_0x074d('0x55')]({'where':{'VoiceQueueId':_0x50063f['id'],'UserId':_0x33e61c},'transaction':_0x1b6c53});});return Promise[_0x074d('0x91')](_0x408f6);});});return Promise['all'](_0xc47e25);});});return Promise['all'](_0x4c6ce3)[_0x074d('0x2a')](function(){return _0x24b8d1[_0x074d('0x95')](_0x176c4f,{'transaction':_0x1b6c53});})[_0x074d('0x2a')](function(){return db[_0x074d('0x69')][_0x074d('0x6d')]({'where':{'teamId':_0x976f83}})[_0x074d('0x2a')](function(_0x4deabc){if(_0x4deabc){var _0x14ca0f=_[_0x074d('0x2f')](_0x176c4f,function(_0x2758ae){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x2758ae,'VoicePrefixId':_0x4deabc[_0x074d('0x6a')]}});});return Promise['all'](_0x14ca0f);}});});});}})[_0x074d('0x2a')](respondWithStatusCode(_0x5668a4,null))[_0x074d('0x4a')](handleError(_0x5668a4,null));};exports[_0x074d('0x96')]=function(_0x4f06bb,_0x795255,_0x53e25b){var _0x1affc7={};var _0x120ef5={};var _0x1937b1;var _0x37aa3e;return db['Team'][_0x074d('0x6d')]({'where':{'id':_0x4f06bb['params']['id']}})[_0x074d('0x2a')](handleEntityNotFound(_0x795255,null))['then'](function(_0x159ec6){if(_0x159ec6){_0x1937b1=_0x159ec6;_0x120ef5[_0x074d('0x37')]=_[_0x074d('0x34')](db[_0x074d('0x8a')][_0x074d('0x31')]);_0x120ef5[_0x074d('0x33')]=_[_0x074d('0x34')](_0x4f06bb[_0x074d('0x33')]);_0x120ef5[_0x074d('0x35')]=_[_0x074d('0x36')](_0x120ef5[_0x074d('0x37')],_0x120ef5[_0x074d('0x33')]);_0x1affc7[_0x074d('0x38')]=_['intersection'](_0x120ef5['model'],qs[_0x074d('0x39')](_0x4f06bb['query']['fields']));_0x1affc7['attributes']=_0x1affc7[_0x074d('0x38')][_0x074d('0x3a')]?_0x1affc7[_0x074d('0x38')]:_0x120ef5[_0x074d('0x37')];_0x1affc7[_0x074d('0x3e')]=qs[_0x074d('0x3f')](_0x4f06bb['query'][_0x074d('0x3f')]);_0x1affc7[_0x074d('0x40')]=qs['filters'](_[_0x074d('0x97')](_0x4f06bb['query'],_0x120ef5[_0x074d('0x35')]));if(_0x4f06bb['query']['filter']){_0x1affc7[_0x074d('0x40')]=_[_0x074d('0x44')](_0x1affc7[_0x074d('0x40')],{'$or':_['map'](_0x1affc7['attributes'],function(_0x3897f4){var _0x9008b2={};_0x9008b2[_0x3897f4]={'$like':'%'+_0x4f06bb['query'][_0x074d('0x41')]+'%'};return _0x9008b2;})});}_0x1affc7=_['merge']({},_0x1affc7,_0x4f06bb[_0x074d('0x45')]);return _0x1937b1[_0x074d('0x96')](_0x1affc7);}})['then'](function(_0x22cfaa){if(_0x22cfaa){_0x37aa3e=_0x22cfaa[_0x074d('0x3a')];if(!_0x4f06bb[_0x074d('0x33')][_0x074d('0x3b')]('nolimit')){_0x1affc7[_0x074d('0x21')]=qs[_0x074d('0x21')](_0x4f06bb[_0x074d('0x33')]['limit']);_0x1affc7[_0x074d('0x3d')]=qs['offset'](_0x4f06bb['query'][_0x074d('0x3d')]);}return _0x1937b1[_0x074d('0x96')](_0x1affc7);}})[_0x074d('0x2a')](function(_0x2344d6){if(_0x2344d6){return _0x2344d6?{'count':_0x37aa3e,'rows':_0x2344d6}:null;}})['then'](respondWithResult(_0x795255,null))[_0x074d('0x4a')](handleError(_0x795255,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 859355b..433830a 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 _0xe75a=['exports','events','../../mysqldb','Team','save','remove','emit','hasOwnProperty','hook'];(function(_0x528562,_0xb94d4a){var _0x5029e5=function(_0x231f99){while(--_0x231f99){_0x528562['push'](_0x528562['shift']());}};_0x5029e5(++_0xb94d4a);}(_0xe75a,0x13c));var _0xae75=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0xe75a[_0x11f226];return _0x30be77;};'use strict';var EventEmitter=require(_0xae75('0x0'));var Team=require(_0xae75('0x1'))['db'][_0xae75('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xae75('0x3'),'afterUpdate':'update','afterDestroy':_0xae75('0x4')};function emitEvent(_0x451954){return function(_0x5269d8,_0x440b31,_0x3ba25d){TeamEvents[_0xae75('0x5')](_0x451954+':'+_0x5269d8['id'],_0x5269d8);TeamEvents[_0xae75('0x5')](_0x451954,_0x5269d8);_0x3ba25d(null);};}for(var e in events){if(events[_0xae75('0x6')](e)){var event=events[e];Team[_0xae75('0x7')](e,emitEvent(event));}}module[_0xae75('0x8')]=TeamEvents; \ No newline at end of file +var _0x9cc8=['emit','hasOwnProperty','hook','exports','events','Team','save','update','remove'];(function(_0x1dae99,_0x4207dc){var _0x1cda0c=function(_0x50d809){while(--_0x50d809){_0x1dae99['push'](_0x1dae99['shift']());}};_0x1cda0c(++_0x4207dc);}(_0x9cc8,0x163));var _0x89cc=function(_0x1042e8,_0x4c744c){_0x1042e8=_0x1042e8-0x0;var _0x33c1a4=_0x9cc8[_0x1042e8];return _0x33c1a4;};'use strict';var EventEmitter=require(_0x89cc('0x0'));var Team=require('../../mysqldb')['db'][_0x89cc('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x89cc('0x2'),'afterUpdate':_0x89cc('0x3'),'afterDestroy':_0x89cc('0x4')};function emitEvent(_0x38dd49){return function(_0x1c9d45,_0x4df11e,_0x121d0d){TeamEvents[_0x89cc('0x5')](_0x38dd49+':'+_0x1c9d45['id'],_0x1c9d45);TeamEvents[_0x89cc('0x5')](_0x38dd49,_0x1c9d45);_0x121d0d(null);};}for(var e in events){if(events[_0x89cc('0x6')](e)){var event=events[e];Team[_0x89cc('0x7')](e,emitEvent(event));}}module[_0x89cc('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c1b9ea8..2660aec 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 _0xbb71=['resolve','map','lodash','./team.attributes','get','then','setDataValue','channel','catch','exports','define','Team','Chat','Fax','Openchannel','Sms','Voice','Whatsapp'];(function(_0x404e42,_0xdbcc){var _0x3ec4e0=function(_0x2918f5){while(--_0x2918f5){_0x404e42['push'](_0x404e42['shift']());}};_0x3ec4e0(++_0xdbcc);}(_0xbb71,0xda));var _0x1bb7=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xbb71[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x1bb7('0x0'));var attributes=require(_0x1bb7('0x1'));function getQueuesByChannel(_0x1256e9,_0x56a986){var _0x2652ea=_0x1bb7('0x2')+_0x56a986+'Queues';return _0x1256e9[_0x2652ea]()[_0x1bb7('0x3')](function(_0x37a678){return _['map'](_0x37a678,function(_0x490f40){_0x490f40[_0x1bb7('0x4')](_0x1bb7('0x5'),_0x56a986);return _0x490f40;});})[_0x1bb7('0x6')](function(_0x262fce){throw _0x262fce;});}module[_0x1bb7('0x7')]=function(_0xe23e02){return _0xe23e02[_0x1bb7('0x8')](_0x1bb7('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1fe190=this;var _0x4ced18=[_0x1bb7('0xa'),_0x1bb7('0xb'),'Mail',_0x1bb7('0xc'),_0x1bb7('0xd'),_0x1bb7('0xe'),_0x1bb7('0xf')];return Promise[_0x1bb7('0x10')]()[_0x1bb7('0x3')](function(){var _0x764beb=_[_0x1bb7('0x11')](_0x4ced18,function(_0x410db8){return getQueuesByChannel(_0x1fe190,_0x410db8);});return Promise['all'](_0x764beb);})[_0x1bb7('0x6')](function(_0x741f3d){throw _0x741f3d;});}}});}; \ No newline at end of file +var _0x030c=['Fax','Sms','Voice','Whatsapp','resolve','map','all','lodash','./team.attributes','get','Queues','then','setDataValue','catch','define','Team','teams','Chat'];(function(_0x2b5c3a,_0x3ad701){var _0x42b9a3=function(_0x42f1c3){while(--_0x42f1c3){_0x2b5c3a['push'](_0x2b5c3a['shift']());}};_0x42b9a3(++_0x3ad701);}(_0x030c,0x85));var _0xc030=function(_0xc38772,_0x43a24a){_0xc38772=_0xc38772-0x0;var _0x38a0cb=_0x030c[_0xc38772];return _0x38a0cb;};'use strict';var _=require(_0xc030('0x0'));var attributes=require(_0xc030('0x1'));function getQueuesByChannel(_0x2481ab,_0x40e000){var _0x1e5939=_0xc030('0x2')+_0x40e000+_0xc030('0x3');return _0x2481ab[_0x1e5939]()[_0xc030('0x4')](function(_0x4cad74){return _['map'](_0x4cad74,function(_0x2282c3){_0x2282c3[_0xc030('0x5')]('channel',_0x40e000);return _0x2282c3;});})[_0xc030('0x6')](function(_0x1b1dcc){throw _0x1b1dcc;});}module['exports']=function(_0x241fc2){return _0x241fc2[_0xc030('0x7')](_0xc030('0x8'),attributes,{'tableName':_0xc030('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x49e8e9=this;var _0x2d9835=[_0xc030('0xa'),_0xc030('0xb'),'Mail','Openchannel',_0xc030('0xc'),_0xc030('0xd'),_0xc030('0xe')];return Promise[_0xc030('0xf')]()[_0xc030('0x4')](function(){var _0x533f76=_[_0xc030('0x10')](_0x2d9835,function(_0x485bc2){return getQueuesByChannel(_0x49e8e9,_0x485bc2);});return Promise[_0xc030('0x11')](_0x533f76);})[_0xc030('0x6')](function(_0x44c52f){throw _0x44c52f;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index fca1192..f045087 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 _0x0ccd=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./team.socket','then','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x6ae570,_0x20bc83){var _0x2983df=function(_0x7c331e){while(--_0x7c331e){_0x6ae570['push'](_0x6ae570['shift']());}};_0x2983df(++_0x20bc83);}(_0x0ccd,0xfa));var _0xd0cc=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x0ccd[_0x3d4ef1];return _0x409423;};'use strict';var _=require(_0xd0cc('0x0'));var util=require(_0xd0cc('0x1'));var moment=require(_0xd0cc('0x2'));var BPromise=require(_0xd0cc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0cc('0x4'))['db'];var utils=require(_0xd0cc('0x5'));var logger=require('../../config/logger')(_0xd0cc('0x6'));var config=require(_0xd0cc('0x7'));var jayson=require(_0xd0cc('0x8'));var client=jayson[_0xd0cc('0x9')]['http']({'port':0x232a});config[_0xd0cc('0xa')]=_[_0xd0cc('0xb')](config[_0xd0cc('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0cc('0xc'))(new Redis(config[_0xd0cc('0xa')]));require(_0xd0cc('0xd'))['register'](socket);function respondWithRpcPromise(_0x284f2e,_0x330778,_0x5b01b6){return new BPromise(function(_0x40a3a5,_0x3f6c34){return client['request'](_0x284f2e,_0x5b01b6)[_0xd0cc('0xe')](function(_0x12df10){logger['info'](_0xd0cc('0xf'),_0x330778,'request\x20sent');logger[_0xd0cc('0x10')](_0xd0cc('0x11'),_0x330778,_0xd0cc('0x12'),JSON[_0xd0cc('0x13')](_0x12df10));if(_0x12df10[_0xd0cc('0x14')]){if(_0x12df10['error'][_0xd0cc('0x15')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x330778,_0x12df10[_0xd0cc('0x14')][_0xd0cc('0x16')]);return _0x3f6c34(_0x12df10[_0xd0cc('0x14')]['message']);}logger[_0xd0cc('0x14')]('Team,\x20%s,\x20%s',_0x330778,_0x12df10[_0xd0cc('0x14')]['message']);return _0x40a3a5(_0x12df10[_0xd0cc('0x14')][_0xd0cc('0x16')]);}else{logger[_0xd0cc('0x17')](_0xd0cc('0xf'),_0x330778,_0xd0cc('0x12'));_0x40a3a5(_0x12df10[_0xd0cc('0x18')][_0xd0cc('0x16')]);}})['catch'](function(_0x1eb55e){logger[_0xd0cc('0x14')](_0xd0cc('0xf'),_0x330778,_0x1eb55e);_0x3f6c34(_0x1eb55e);});});} \ No newline at end of file +var _0xbc29=['socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis'];(function(_0x3a038b,_0x472807){var _0x331b5e=function(_0x47e383){while(--_0x47e383){_0x3a038b['push'](_0x3a038b['shift']());}};_0x331b5e(++_0x472807);}(_0xbc29,0xad));var _0x9bc2=function(_0x3759ba,_0x3b32da){_0x3759ba=_0x3759ba-0x0;var _0x45eec5=_0xbc29[_0x3759ba];return _0x45eec5;};'use strict';var _=require('lodash');var util=require(_0x9bc2('0x0'));var moment=require(_0x9bc2('0x1'));var BPromise=require(_0x9bc2('0x2'));var rs=require(_0x9bc2('0x3'));var fs=require('fs');var Redis=require(_0x9bc2('0x4'));var db=require(_0x9bc2('0x5'))['db'];var utils=require(_0x9bc2('0x6'));var logger=require('../../config/logger')(_0x9bc2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9bc2('0x8')][_0x9bc2('0x9')]({'port':0x232a});config[_0x9bc2('0xa')]=_['defaults'](config[_0x9bc2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9bc2('0xb'))(new Redis(config[_0x9bc2('0xa')]));require('./team.socket')[_0x9bc2('0xc')](socket);function respondWithRpcPromise(_0x1d6a4a,_0xae8e71,_0x464603){return new BPromise(function(_0x103bf8,_0x427ddb){return client[_0x9bc2('0xd')](_0x1d6a4a,_0x464603)[_0x9bc2('0xe')](function(_0x496bc9){logger[_0x9bc2('0xf')](_0x9bc2('0x10'),_0xae8e71,_0x9bc2('0x11'));logger['debug'](_0x9bc2('0x12'),_0xae8e71,_0x9bc2('0x11'),JSON[_0x9bc2('0x13')](_0x496bc9));if(_0x496bc9[_0x9bc2('0x14')]){if(_0x496bc9['error']['code']===0x1f4){logger[_0x9bc2('0x14')](_0x9bc2('0x10'),_0xae8e71,_0x496bc9[_0x9bc2('0x14')][_0x9bc2('0x15')]);return _0x427ddb(_0x496bc9['error'][_0x9bc2('0x15')]);}logger[_0x9bc2('0x14')](_0x9bc2('0x10'),_0xae8e71,_0x496bc9[_0x9bc2('0x14')]['message']);return _0x103bf8(_0x496bc9[_0x9bc2('0x14')][_0x9bc2('0x15')]);}else{logger[_0x9bc2('0xf')]('Team,\x20%s,\x20%s',_0xae8e71,_0x9bc2('0x11'));_0x103bf8(_0x496bc9[_0x9bc2('0x16')][_0x9bc2('0x15')]);}})['catch'](function(_0x15cd42){logger[_0x9bc2('0x14')](_0x9bc2('0x10'),_0xae8e71,_0x15cd42);_0x427ddb(_0x15cd42);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index bd3218b..5992749 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 _0x76ef=['remove','update','emit','removeListener','length','team:','./team.events','save'];(function(_0x2f3e5f,_0x2fe7b9){var _0x5be5d6=function(_0x15d6ec){while(--_0x15d6ec){_0x2f3e5f['push'](_0x2f3e5f['shift']());}};_0x5be5d6(++_0x2fe7b9);}(_0x76ef,0xb6));var _0xf76e=function(_0x3fb734,_0x296772){_0x3fb734=_0x3fb734-0x0;var _0x534958=_0x76ef[_0x3fb734];return _0x534958;};'use strict';var TeamEvents=require(_0xf76e('0x0'));var events=[_0xf76e('0x1'),_0xf76e('0x2'),_0xf76e('0x3')];function createListener(_0x1260ea,_0x2bdf1){return function(_0x290545){_0x2bdf1[_0xf76e('0x4')](_0x1260ea,_0x290545);};}function removeListener(_0x44a888,_0xfa2b0b){return function(){TeamEvents[_0xf76e('0x5')](_0x44a888,_0xfa2b0b);};}exports['register']=function(_0x2a8095){for(var _0x502094=0x0,_0x4b0ffe=events[_0xf76e('0x6')];_0x502094<_0x4b0ffe;_0x502094++){var _0x4489b9=events[_0x502094];var _0x33f13b=createListener(_0xf76e('0x7')+_0x4489b9,_0x2a8095);TeamEvents['on'](_0x4489b9,_0x33f13b);}}; \ No newline at end of file +var _0x22fb=['save','remove','emit','removeListener','register','length','team:','./team.events'];(function(_0x24c135,_0xdb4450){var _0x290c66=function(_0x537cf8){while(--_0x537cf8){_0x24c135['push'](_0x24c135['shift']());}};_0x290c66(++_0xdb4450);}(_0x22fb,0x18f));var _0xb22f=function(_0x3f6913,_0x335b4a){_0x3f6913=_0x3f6913-0x0;var _0x4486f3=_0x22fb[_0x3f6913];return _0x4486f3;};'use strict';var TeamEvents=require(_0xb22f('0x0'));var events=[_0xb22f('0x1'),_0xb22f('0x2'),'update'];function createListener(_0x2b5587,_0x3ba8e1){return function(_0x51a5b6){_0x3ba8e1[_0xb22f('0x3')](_0x2b5587,_0x51a5b6);};}function removeListener(_0x1936df,_0x16a46e){return function(){TeamEvents[_0xb22f('0x4')](_0x1936df,_0x16a46e);};}exports[_0xb22f('0x5')]=function(_0x179f8a){for(var _0x3485cd=0x0,_0x5bf93a=events[_0xb22f('0x6')];_0x3485cd<_0x5bf93a;_0x3485cd++){var _0x5e1f1b=events[_0x3485cd];var _0x5465c5=createListener(_0xb22f('0x7')+_0x5e1f1b,_0x179f8a);TeamEvents['on'](_0x5e1f1b,_0x5465c5);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 9fad40b..469381e 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 _0x5374=['exports','INTEGER'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x5374,0xd6));var _0x4537=function(_0x1c016c,_0x346f54){_0x1c016c=_0x1c016c-0x0;var _0x5ed216=_0x5374[_0x1c016c];return _0x5ed216;};'use strict';var Sequelize=require('sequelize');module[_0x4537('0x0')]={'TeamId':{'type':Sequelize[_0x4537('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xea67=['INTEGER','sequelize','exports'];(function(_0x116aef,_0x1033b2){var _0x17d01c=function(_0x169e42){while(--_0x169e42){_0x116aef['push'](_0x116aef['shift']());}};_0x17d01c(++_0x1033b2);}(_0xea67,0x172));var _0x7ea6=function(_0x11f0a6,_0x1ce59d){_0x11f0a6=_0x11f0a6-0x0;var _0xa5ab4b=_0xea67[_0x11f0a6];return _0xa5ab4b;};'use strict';var Sequelize=require(_0x7ea6('0x0'));module[_0x7ea6('0x1')]={'TeamId':{'type':Sequelize[_0x7ea6('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x7ea6('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 300ec22..0359e8d 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 _0x081e=['bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','lodash','util','api'];(function(_0xcba145,_0xcd2673){var _0x38e216=function(_0x48c346){while(--_0x48c346){_0xcba145['push'](_0xcba145['shift']());}};_0x38e216(++_0xcd2673);}(_0x081e,0xc5));var _0xe081=function(_0x395718,_0x20322d){_0x395718=_0x395718-0x0;var _0x3028b8=_0x081e[_0x395718];return _0x3028b8;};'use strict';var _=require(_0xe081('0x0'));var util=require(_0xe081('0x1'));var logger=require('../../config/logger')(_0xe081('0x2'));var moment=require('moment');var BPromise=require(_0xe081('0x3'));var rp=require(_0xe081('0x4'));var fs=require('fs');var path=require(_0xe081('0x5'));var rimraf=require(_0xe081('0x6'));var config=require(_0xe081('0x7'));var attributes=require(_0xe081('0x8'));module[_0xe081('0x9')]=function(_0x50d6cb,_0x2271b4){return _0x50d6cb['define']('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24cf=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','../../config/logger'];(function(_0x36fc47,_0x354b21){var _0x1867fc=function(_0x566509){while(--_0x566509){_0x36fc47['push'](_0x36fc47['shift']());}};_0x1867fc(++_0x354b21);}(_0x24cf,0x1d5));var _0xf24c=function(_0x29178e,_0x5c15fd){_0x29178e=_0x29178e-0x0;var _0x1744d0=_0x24cf[_0x29178e];return _0x1744d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf24c('0x0'))(_0xf24c('0x1'));var moment=require(_0xf24c('0x2'));var BPromise=require(_0xf24c('0x3'));var rp=require(_0xf24c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf24c('0x5'));var config=require(_0xf24c('0x6'));var attributes=require(_0xf24c('0x7'));module[_0xf24c('0x8')]=function(_0x5c4ebc,_0x4983e2){return _0x5c4ebc['define'](_0xf24c('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 0c465bb..c608973 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(_0xe59cff,_0x1a7dbe){var _0x26e8c1=function(_0x6a95cc){while(--_0x6a95cc){_0xe59cff['push'](_0xe59cff['shift']());}};_0x26e8c1(++_0x1a7dbe);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x30f2cc,_0x275d9b){var _0x208f56=function(_0x56adc0){while(--_0x56adc0){_0x30f2cc['push'](_0x30f2cc['shift']());}};_0x208f56(++_0x275d9b);}(_0xe706,0xa3));var _0x6e70=function(_0x450b2a,_0x174591){_0x450b2a=_0x450b2a-0x0;var _0x37a7ff=_0xe706[_0x450b2a];return _0x37a7ff;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index c3bc136..1a83b65 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 _0x0a25=['sequelize','INTEGER'];(function(_0x4c0abe,_0x4647a2){var _0x5dbe93=function(_0x3436c4){while(--_0x3436c4){_0x4c0abe['push'](_0x4c0abe['shift']());}};_0x5dbe93(++_0x4647a2);}(_0x0a25,0x1bc));var _0x50a2=function(_0x56d1ed,_0x237e84){_0x56d1ed=_0x56d1ed-0x0;var _0x1b282b=_0x0a25[_0x56d1ed];return _0x1b282b;};'use strict';var Sequelize=require(_0x50a2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x50a2('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x16dc=['exports'];(function(_0x17f5b1,_0x46ae49){var _0x4c139c=function(_0x421703){while(--_0x421703){_0x17f5b1['push'](_0x17f5b1['shift']());}};_0x4c139c(++_0x46ae49);}(_0x16dc,0xe3));var _0xc16d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16dc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc16d('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 7018f76..23b98e5 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 _0xfcbd=['team_has_voice_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x565283,_0x301a2f){var _0x248698=function(_0x5521ec){while(--_0x5521ec){_0x565283['push'](_0x565283['shift']());}};_0x248698(++_0x301a2f);}(_0xfcbd,0x160));var _0xdfcb=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0xfcbd[_0x479509];return _0x382da8;};'use strict';var _=require(_0xdfcb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdfcb('0x1'));var moment=require(_0xdfcb('0x2'));var BPromise=require(_0xdfcb('0x3'));var rp=require(_0xdfcb('0x4'));var fs=require('fs');var path=require(_0xdfcb('0x5'));var rimraf=require(_0xdfcb('0x6'));var config=require(_0xdfcb('0x7'));var attributes=require(_0xdfcb('0x8'));module[_0xdfcb('0x9')]=function(_0x4bdf76,_0x5615a6){return _0x4bdf76[_0xdfcb('0xa')](_0xdfcb('0xb'),attributes,{'tableName':_0xdfcb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a3a=['exports','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x97ab47,_0x5cdab2){var _0x2d291f=function(_0x14f4fd){while(--_0x14f4fd){_0x97ab47['push'](_0x97ab47['shift']());}};_0x2d291f(++_0x5cdab2);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x524190,_0x468d06){_0x524190=_0x524190-0x0;var _0x898064=_0x2a3a[_0x524190];return _0x898064;};'use strict';var _=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var logger=require(_0xa2a3('0x2'))(_0xa2a3('0x3'));var moment=require(_0xa2a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a3('0x5'));var rimraf=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var attributes=require(_0xa2a3('0x8'));module[_0xa2a3('0x9')]=function(_0xf652d7,_0x186655){return _0xf652d7['define'](_0xa2a3('0xa'),attributes,{'tableName':_0xa2a3('0xb'),'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 a77303b..ca5257d 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 _0x8f9e=['../../config/environment','jayson/promise','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f9e,0x160));var _0xe8f9=function(_0x3da901,_0x498bec){_0x3da901=_0x3da901-0x0;var _0xda8ce8=_0x8f9e[_0x3da901];return _0xda8ce8;};'use strict';var _=require(_0xe8f9('0x0'));var util=require(_0xe8f9('0x1'));var moment=require('moment');var BPromise=require(_0xe8f9('0x2'));var rs=require(_0xe8f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe8f9('0x4'))('rpc');var config=require(_0xe8f9('0x5'));var jayson=require(_0xe8f9('0x6'));var client=jayson[_0xe8f9('0x7')][_0xe8f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bec90,_0x4696ef,_0x4fd4ae){return new BPromise(function(_0x34be93,_0x38611d){return client[_0xe8f9('0x9')](_0x3bec90,_0x4fd4ae)[_0xe8f9('0xa')](function(_0xd952d8){logger['info'](_0xe8f9('0xb'),_0x4696ef,_0xe8f9('0xc'));logger[_0xe8f9('0xd')](_0xe8f9('0xe'),_0x4696ef,_0xe8f9('0xc'),JSON[_0xe8f9('0xf')](_0xd952d8));if(_0xd952d8['error']){if(_0xd952d8[_0xe8f9('0x10')]['code']===0x1f4){logger[_0xe8f9('0x10')](_0xe8f9('0xb'),_0x4696ef,_0xd952d8[_0xe8f9('0x10')]['message']);return _0x38611d(_0xd952d8[_0xe8f9('0x10')][_0xe8f9('0x11')]);}logger['error'](_0xe8f9('0xb'),_0x4696ef,_0xd952d8['error'][_0xe8f9('0x11')]);return _0x34be93(_0xd952d8['error'][_0xe8f9('0x11')]);}else{logger[_0xe8f9('0x12')](_0xe8f9('0xb'),_0x4696ef,_0xe8f9('0xc'));_0x34be93(_0xd952d8[_0xe8f9('0x13')][_0xe8f9('0x11')]);}})[_0xe8f9('0x14')](function(_0x25e62c){logger[_0xe8f9('0x10')](_0xe8f9('0xb'),_0x4696ef,_0x25e62c);_0x38611d(_0x25e62c);});});} \ No newline at end of file +var _0x7072=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7072,0x8e));var _0x2707=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7072[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2707('0x3'));var db=require(_0x2707('0x4'))['db'];var utils=require(_0x2707('0x5'));var logger=require('../../config/logger')(_0x2707('0x6'));var config=require(_0x2707('0x7'));var jayson=require(_0x2707('0x8'));var client=jayson[_0x2707('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54facf,_0x155b7f,_0x431013){return new BPromise(function(_0x27cca2,_0x475b50){return client[_0x2707('0xa')](_0x54facf,_0x431013)[_0x2707('0xb')](function(_0x853f7f){logger[_0x2707('0xc')](_0x2707('0xd'),_0x155b7f,_0x2707('0xe'));logger[_0x2707('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x155b7f,'request\x20sent',JSON['stringify'](_0x853f7f));if(_0x853f7f[_0x2707('0x10')]){if(_0x853f7f[_0x2707('0x10')][_0x2707('0x11')]===0x1f4){logger[_0x2707('0x10')](_0x2707('0xd'),_0x155b7f,_0x853f7f[_0x2707('0x10')][_0x2707('0x12')]);return _0x475b50(_0x853f7f[_0x2707('0x10')][_0x2707('0x12')]);}logger[_0x2707('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x155b7f,_0x853f7f[_0x2707('0x10')][_0x2707('0x12')]);return _0x27cca2(_0x853f7f[_0x2707('0x10')][_0x2707('0x12')]);}else{logger[_0x2707('0xc')](_0x2707('0xd'),_0x155b7f,_0x2707('0xe'));_0x27cca2(_0x853f7f[_0x2707('0x13')]['message']);}})[_0x2707('0x14')](function(_0x363809){logger[_0x2707('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x155b7f,_0x363809);_0x475b50(_0x363809);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3277e64..847df79 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 _0xeaab=['exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xeaab,0xd9));var _0xbeaa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeaab[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xbeaa('0x0'));var util=require('util');var path=require(_0xbeaa('0x1'));var timeout=require(_0xbeaa('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbeaa('0x3'));var auth=require(_0xbeaa('0x4'));var interaction=require(_0xbeaa('0x5'));var config=require(_0xbeaa('0x6'));var controller=require(_0xbeaa('0x7'));router[_0xbeaa('0x8')]('/',auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xa')]);router[_0xbeaa('0x8')](_0xbeaa('0xb'),auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xc')]);router[_0xbeaa('0xd')]('/',auth[_0xbeaa('0x9')](),controller['create']);router[_0xbeaa('0xe')](_0xbeaa('0xb'),auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xf')]);router[_0xbeaa('0x10')](_0xbeaa('0xb'),auth[_0xbeaa('0x9')](),controller['destroy']);module[_0xbeaa('0x11')]=router; \ No newline at end of file +var _0x68fd=['index','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x55fb6b,_0x9eb0e0){var _0x42ba9f=function(_0x33472f){while(--_0x33472f){_0x55fb6b['push'](_0x55fb6b['shift']());}};_0x42ba9f(++_0x9eb0e0);}(_0x68fd,0x1e9));var _0xd68f=function(_0x342168,_0x39482e){_0x342168=_0x342168-0x0;var _0x121e6e=_0x68fd[_0x342168];return _0x121e6e;};'use strict';var multer=require(_0xd68f('0x0'));var util=require('util');var path=require(_0xd68f('0x1'));var timeout=require(_0xd68f('0x2'));var express=require('express');var router=express[_0xd68f('0x3')]();var fs_extra=require(_0xd68f('0x4'));var auth=require(_0xd68f('0x5'));var interaction=require(_0xd68f('0x6'));var config=require(_0xd68f('0x7'));var controller=require(_0xd68f('0x8'));router[_0xd68f('0x9')]('/',auth[_0xd68f('0xa')](),controller[_0xd68f('0xb')]);router['get'](_0xd68f('0xc'),auth[_0xd68f('0xa')](),controller[_0xd68f('0xd')]);router[_0xd68f('0xe')]('/',auth[_0xd68f('0xa')](),controller[_0xd68f('0xf')]);router[_0xd68f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd68f('0x11')]);router['delete'](_0xd68f('0xc'),auth[_0xd68f('0xa')](),controller[_0xd68f('0x12')]);module[_0xd68f('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 5ddeb4e..0a53241 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 _0xb854=['exports','STRING','TEXT','sequelize'];(function(_0x197f4c,_0x2dcd7d){var _0x47c03c=function(_0x43f7ed){while(--_0x43f7ed){_0x197f4c['push'](_0x197f4c['shift']());}};_0x47c03c(++_0x2dcd7d);}(_0xb854,0x9f));var _0x4b85=function(_0x1161d5,_0x1364ec){_0x1161d5=_0x1161d5-0x0;var _0x5885ac=_0xb854[_0x1161d5];return _0x5885ac;};'use strict';var Sequelize=require(_0x4b85('0x0'));module[_0x4b85('0x1')]={'name':{'type':Sequelize[_0x4b85('0x2')]},'description':{'type':Sequelize[_0x4b85('0x2')]},'html':{'type':Sequelize[_0x4b85('0x3')]}}; \ No newline at end of file +var _0xcd64=['sequelize','exports','TEXT'];(function(_0x18be96,_0x15e628){var _0x4b9baa=function(_0x2791b9){while(--_0x2791b9){_0x18be96['push'](_0x18be96['shift']());}};_0x4b9baa(++_0x15e628);}(_0xcd64,0x99));var _0x4cd6=function(_0x185938,_0x56eb82){_0x185938=_0x185938-0x0;var _0x268108=_0xcd64[_0x185938];return _0x268108;};'use strict';var Sequelize=require(_0x4cd6('0x0'));module[_0x4cd6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x4cd6('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 9cc7c3a..00cd880 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 _0x1cda=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','role','user','UserProfileSection','UserProfileResource','error','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','destroy','then','get','Templates','end','stack','name','send','index','map','Template','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','order'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1cda,0x103));var _0xa1cd=function(_0x15a0e8,_0x1112da){_0x15a0e8=_0x15a0e8-0x0;var _0x515ad5=_0x1cda[_0x15a0e8];return _0x515ad5;};'use strict';var emlformat=require(_0xa1cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1cd('0x1'));var jsonpatch=require(_0xa1cd('0x2'));var rp=require(_0xa1cd('0x3'));var moment=require(_0xa1cd('0x4'));var BPromise=require(_0xa1cd('0x5'));var Mustache=require(_0xa1cd('0x6'));var util=require(_0xa1cd('0x7'));var path=require(_0xa1cd('0x8'));var sox=require(_0xa1cd('0x9'));var csv=require(_0xa1cd('0xa'));var ejs=require(_0xa1cd('0xb'));var fs=require('fs');var fs_extra=require(_0xa1cd('0xc'));var _=require(_0xa1cd('0xd'));var squel=require(_0xa1cd('0xe'));var crypto=require(_0xa1cd('0xf'));var jsforce=require(_0xa1cd('0x10'));var deskjs=require(_0xa1cd('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa1cd('0x12'));var Papa=require(_0xa1cd('0x13'));var Redis=require('ioredis');var authService=require(_0xa1cd('0x14'));var qs=require(_0xa1cd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1cd('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa1cd('0x17'));var licenseUtil=require(_0xa1cd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ab569,_0x523509){_0x523509=_0x523509||0xcc;return function(_0x2f9590){if(_0x2f9590){return _0x2ab569[_0xa1cd('0x19')](_0x523509);}return _0x2ab569[_0xa1cd('0x1a')](_0x523509)['end']();};}function respondWithResult(_0x3e4246,_0x4393bd){_0x4393bd=_0x4393bd||0xc8;return function(_0x40654b){if(_0x40654b){return _0x3e4246[_0xa1cd('0x1a')](_0x4393bd)[_0xa1cd('0x1b')](_0x40654b);}};}function respondWithFilteredResult(_0x81390d,_0x4c16c2){return function(_0x5123fd){if(_0x5123fd){var _0x164898=typeof _0x4c16c2[_0xa1cd('0x1c')]===_0xa1cd('0x1d')&&typeof _0x4c16c2[_0xa1cd('0x1e')]===_0xa1cd('0x1d');var _0x47d5a0=_0x5123fd['count'];var _0x400557=_0x164898?0x0:_0x4c16c2['offset'];var _0x233eaa=_0x164898?_0x5123fd[_0xa1cd('0x1f')]:_0x4c16c2[_0xa1cd('0x1c')]+_0x4c16c2[_0xa1cd('0x1e')];var _0x5727ab;if(_0x233eaa>=_0x47d5a0){_0x233eaa=_0x47d5a0;_0x5727ab=0xc8;}else{_0x5727ab=0xce;}_0x81390d['status'](_0x5727ab);return _0x81390d['set'](_0xa1cd('0x20'),_0x400557+'-'+_0x233eaa+'/'+_0x47d5a0)[_0xa1cd('0x1b')](_0x5123fd);}return null;};}function patchUpdates(_0x2889d1){return function(_0x42ddc7){try{jsonpatch['apply'](_0x42ddc7,_0x2889d1,!![]);}catch(_0x28173f){return BPromise['reject'](_0x28173f);}return _0x42ddc7[_0xa1cd('0x21')]();};}function saveUpdates(_0x2007c1,_0x4746b6){return function(_0x1c2573){if(_0x1c2573){return _0x1c2573['update'](_0x2007c1)['then'](function(_0xf84008){return _0xf84008;});}return null;};}function removeEntity(_0x52e890,_0x581fdb){return function(_0x5656d4){if(_0x5656d4){return _0x5656d4[_0xa1cd('0x22')]()[_0xa1cd('0x23')](function(){var _0x28e380=_0x5656d4[_0xa1cd('0x24')]({'plain':!![]});var _0x461f24=_0xa1cd('0x25');return db['UserProfileResource'][_0xa1cd('0x22')]({'where':{'type':_0x461f24,'resourceId':_0x28e380['id']}})[_0xa1cd('0x23')](function(){return _0x5656d4;});})[_0xa1cd('0x23')](function(){_0x52e890['status'](0xcc)[_0xa1cd('0x26')]();});}};}function handleEntityNotFound(_0x2e6ba4,_0x4d12d6){return function(_0x5e633b){if(!_0x5e633b){_0x2e6ba4[_0xa1cd('0x19')](0x194);}return _0x5e633b;};}function handleError(_0x29e6df,_0x23b056){_0x23b056=_0x23b056||0x1f4;return function(_0x2bb304){logger['error'](_0x2bb304[_0xa1cd('0x27')]);if(_0x2bb304[_0xa1cd('0x28')]){delete _0x2bb304[_0xa1cd('0x28')];}_0x29e6df[_0xa1cd('0x1a')](_0x23b056)[_0xa1cd('0x29')](_0x2bb304);};}exports[_0xa1cd('0x2a')]=function(_0xb226d1,_0x18912d){var _0x399fb0={},_0x3fef57={},_0x27dc23={'count':0x0,'rows':[]};var _0x5ca893=_[_0xa1cd('0x2b')](db[_0xa1cd('0x2c')][_0xa1cd('0x2d')],function(_0x324f1a){return{'name':_0x324f1a[_0xa1cd('0x2e')],'type':_0x324f1a['type'][_0xa1cd('0x2f')]};});_0x3fef57[_0xa1cd('0x30')]=_[_0xa1cd('0x2b')](_0x5ca893,_0xa1cd('0x28'));_0x3fef57['query']=_['keys'](_0xb226d1[_0xa1cd('0x31')]);_0x3fef57[_0xa1cd('0x32')]=_['intersection'](_0x3fef57[_0xa1cd('0x30')],_0x3fef57['query']);_0x399fb0[_0xa1cd('0x33')]=_[_0xa1cd('0x34')](_0x3fef57[_0xa1cd('0x30')],qs[_0xa1cd('0x35')](_0xb226d1[_0xa1cd('0x31')][_0xa1cd('0x35')]));_0x399fb0['attributes']=_0x399fb0[_0xa1cd('0x33')][_0xa1cd('0x36')]?_0x399fb0[_0xa1cd('0x33')]:_0x3fef57[_0xa1cd('0x30')];if(!_0xb226d1['query']['hasOwnProperty'](_0xa1cd('0x37'))){_0x399fb0['limit']=qs[_0xa1cd('0x1e')](_0xb226d1[_0xa1cd('0x31')][_0xa1cd('0x1e')]);_0x399fb0[_0xa1cd('0x1c')]=qs[_0xa1cd('0x1c')](_0xb226d1[_0xa1cd('0x31')]['offset']);}_0x399fb0[_0xa1cd('0x38')]=qs[_0xa1cd('0x39')](_0xb226d1['query'][_0xa1cd('0x39')]);_0x399fb0[_0xa1cd('0x3a')]=qs[_0xa1cd('0x32')](_['pick'](_0xb226d1[_0xa1cd('0x31')],_0x3fef57['filters']),_0x5ca893);if(_0xb226d1[_0xa1cd('0x31')][_0xa1cd('0x3b')]){_0x399fb0[_0xa1cd('0x3a')]=_[_0xa1cd('0x3c')](_0x399fb0[_0xa1cd('0x3a')],{'$or':_[_0xa1cd('0x2b')](_0x5ca893,function(_0x3199de){if(_0x3199de['type']!==_0xa1cd('0x3d')){var _0x1b19e9={};_0x1b19e9[_0x3199de[_0xa1cd('0x28')]]={'$like':'%'+_0xb226d1[_0xa1cd('0x31')][_0xa1cd('0x3b')]+'%'};return _0x1b19e9;}})});}_0x399fb0=_['merge']({},_0x399fb0,_0xb226d1[_0xa1cd('0x3e')]);var _0x44ae62={'where':_0x399fb0['where']};return db[_0xa1cd('0x2c')][_0xa1cd('0x1f')](_0x44ae62)[_0xa1cd('0x23')](function(_0x476d4a){_0x27dc23[_0xa1cd('0x1f')]=_0x476d4a;if(_0xb226d1[_0xa1cd('0x31')][_0xa1cd('0x3f')]){_0x399fb0[_0xa1cd('0x40')]=[{'all':!![]}];}return db[_0xa1cd('0x2c')][_0xa1cd('0x41')](_0x399fb0);})[_0xa1cd('0x23')](function(_0x406918){_0x27dc23['rows']=_0x406918;return _0x27dc23;})[_0xa1cd('0x23')](respondWithFilteredResult(_0x18912d,_0x399fb0))[_0xa1cd('0x42')](handleError(_0x18912d,null));};exports[_0xa1cd('0x43')]=function(_0x418caf,_0x40325c){var _0x263dbc={'raw':!![],'where':{'id':_0x418caf[_0xa1cd('0x44')]['id']}},_0x2299c7={};_0x2299c7[_0xa1cd('0x30')]=_[_0xa1cd('0x45')](db[_0xa1cd('0x2c')][_0xa1cd('0x2d')]);_0x2299c7['query']=_[_0xa1cd('0x45')](_0x418caf['query']);_0x2299c7['filters']=_[_0xa1cd('0x34')](_0x2299c7[_0xa1cd('0x30')],_0x2299c7['query']);_0x263dbc[_0xa1cd('0x33')]=_[_0xa1cd('0x34')](_0x2299c7[_0xa1cd('0x30')],qs[_0xa1cd('0x35')](_0x418caf[_0xa1cd('0x31')][_0xa1cd('0x35')]));_0x263dbc[_0xa1cd('0x33')]=_0x263dbc[_0xa1cd('0x33')][_0xa1cd('0x36')]?_0x263dbc['attributes']:_0x2299c7[_0xa1cd('0x30')];if(_0x418caf['query']['includeAll']){_0x263dbc['include']=[{'all':!![]}];}_0x263dbc=_[_0xa1cd('0x3c')]({},_0x263dbc,_0x418caf['options']);return db['Template'][_0xa1cd('0x46')](_0x263dbc)['then'](handleEntityNotFound(_0x40325c,null))[_0xa1cd('0x23')](respondWithResult(_0x40325c,null))[_0xa1cd('0x42')](handleError(_0x40325c,null));};exports['create']=function(_0x159a89,_0x5d9e65){return db[_0xa1cd('0x2c')][_0xa1cd('0x47')](_0x159a89[_0xa1cd('0x48')],{})['then'](function(_0x5d7c77){var _0x198c75=_0x159a89['user']['get']({'plain':!![]});if(!_0x198c75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x198c75[_0xa1cd('0x49')]===_0xa1cd('0x4a')){var _0x4b9721=_0x5d7c77[_0xa1cd('0x24')]({'plain':!![]});var _0x36e7c4='Templates';return db[_0xa1cd('0x4b')][_0xa1cd('0x46')]({'where':{'name':_0x36e7c4,'userProfileId':_0x198c75['userProfileId']},'raw':!![]})[_0xa1cd('0x23')](function(_0xe92b46){if(_0xe92b46&&_0xe92b46['autoAssociation']===0x0){return db[_0xa1cd('0x4c')]['create']({'name':_0x4b9721[_0xa1cd('0x28')],'resourceId':_0x4b9721['id'],'type':_0xe92b46[_0xa1cd('0x28')],'sectionId':_0xe92b46['id']},{})[_0xa1cd('0x23')](function(){return _0x5d7c77;});}else{return _0x5d7c77;}})[_0xa1cd('0x42')](function(_0x41ec3d){logger[_0xa1cd('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41ec3d);throw _0x41ec3d;});}return _0x5d7c77;})[_0xa1cd('0x23')](respondWithResult(_0x5d9e65,0xc9))[_0xa1cd('0x42')](handleError(_0x5d9e65,null));};exports[_0xa1cd('0x4e')]=function(_0x5697f2,_0x35b7ff){if(_0x5697f2[_0xa1cd('0x48')]['id']){delete _0x5697f2['body']['id'];}return db[_0xa1cd('0x2c')][_0xa1cd('0x46')]({'where':{'id':_0x5697f2[_0xa1cd('0x44')]['id']}})[_0xa1cd('0x23')](handleEntityNotFound(_0x35b7ff,null))[_0xa1cd('0x23')](saveUpdates(_0x5697f2[_0xa1cd('0x48')],null))['then'](respondWithResult(_0x35b7ff,null))[_0xa1cd('0x42')](handleError(_0x35b7ff,null));};exports[_0xa1cd('0x22')]=function(_0x4c4379,_0x5476a5){return db[_0xa1cd('0x2c')][_0xa1cd('0x46')]({'where':{'id':_0x4c4379['params']['id']}})[_0xa1cd('0x23')](handleEntityNotFound(_0x5476a5,null))[_0xa1cd('0x23')](removeEntity(_0x5476a5,null))[_0xa1cd('0x42')](handleError(_0x5476a5,null));}; \ No newline at end of file +var _0xc8ca=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Templates','UserProfileResource','error','name','map','Template','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc8ca,0x13d));var _0xac8c=function(_0x6f128b,_0x59ccd4){_0x6f128b=_0x6f128b-0x0;var _0xd8045=_0xc8ca[_0x6f128b];return _0xd8045;};'use strict';var emlformat=require(_0xac8c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac8c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac8c('0x2'));var moment=require(_0xac8c('0x3'));var BPromise=require(_0xac8c('0x4'));var Mustache=require(_0xac8c('0x5'));var util=require(_0xac8c('0x6'));var path=require(_0xac8c('0x7'));var sox=require('sox');var csv=require(_0xac8c('0x8'));var ejs=require(_0xac8c('0x9'));var fs=require('fs');var fs_extra=require(_0xac8c('0xa'));var _=require(_0xac8c('0xb'));var squel=require(_0xac8c('0xc'));var crypto=require(_0xac8c('0xd'));var jsforce=require(_0xac8c('0xe'));var deskjs=require(_0xac8c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xac8c('0x10'));var Papa=require(_0xac8c('0x11'));var Redis=require('ioredis');var authService=require(_0xac8c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xac8c('0x13'));var hardwareService=require(_0xac8c('0x14'));var logger=require(_0xac8c('0x15'))(_0xac8c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac8c('0x17'))['db'];function respondWithStatusCode(_0xa16866,_0x2daf17){_0x2daf17=_0x2daf17||0xcc;return function(_0x308cf0){if(_0x308cf0){return _0xa16866[_0xac8c('0x18')](_0x2daf17);}return _0xa16866[_0xac8c('0x19')](_0x2daf17)['end']();};}function respondWithResult(_0xf49fb9,_0x3e45d4){_0x3e45d4=_0x3e45d4||0xc8;return function(_0x51bbea){if(_0x51bbea){return _0xf49fb9[_0xac8c('0x19')](_0x3e45d4)[_0xac8c('0x1a')](_0x51bbea);}};}function respondWithFilteredResult(_0xd21033,_0x165d3b){return function(_0x548684){if(_0x548684){var _0x4e5ab4=typeof _0x165d3b[_0xac8c('0x1b')]==='undefined'&&typeof _0x165d3b[_0xac8c('0x1c')]===_0xac8c('0x1d');var _0x495dcc=_0x548684[_0xac8c('0x1e')];var _0x1060da=_0x4e5ab4?0x0:_0x165d3b[_0xac8c('0x1b')];var _0x45d5bd=_0x4e5ab4?_0x548684[_0xac8c('0x1e')]:_0x165d3b[_0xac8c('0x1b')]+_0x165d3b[_0xac8c('0x1c')];var _0x2f4ba7;if(_0x45d5bd>=_0x495dcc){_0x45d5bd=_0x495dcc;_0x2f4ba7=0xc8;}else{_0x2f4ba7=0xce;}_0xd21033['status'](_0x2f4ba7);return _0xd21033[_0xac8c('0x1f')](_0xac8c('0x20'),_0x1060da+'-'+_0x45d5bd+'/'+_0x495dcc)[_0xac8c('0x1a')](_0x548684);}return null;};}function patchUpdates(_0x2367e0){return function(_0x1ad29b){try{jsonpatch[_0xac8c('0x21')](_0x1ad29b,_0x2367e0,!![]);}catch(_0x1198e1){return BPromise[_0xac8c('0x22')](_0x1198e1);}return _0x1ad29b['save']();};}function saveUpdates(_0x7d6b6b,_0x4ac441){return function(_0x5c4e94){if(_0x5c4e94){return _0x5c4e94[_0xac8c('0x23')](_0x7d6b6b)[_0xac8c('0x24')](function(_0x1039c4){return _0x1039c4;});}return null;};}function removeEntity(_0x59724d,_0x4b1c95){return function(_0x3bb547){if(_0x3bb547){return _0x3bb547[_0xac8c('0x25')]()[_0xac8c('0x24')](function(){var _0x2bc452=_0x3bb547[_0xac8c('0x26')]({'plain':!![]});var _0x55cc65=_0xac8c('0x27');return db[_0xac8c('0x28')][_0xac8c('0x25')]({'where':{'type':_0x55cc65,'resourceId':_0x2bc452['id']}})[_0xac8c('0x24')](function(){return _0x3bb547;});})[_0xac8c('0x24')](function(){_0x59724d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1580b6,_0x2ecc6b){return function(_0x3c3776){if(!_0x3c3776){_0x1580b6['sendStatus'](0x194);}return _0x3c3776;};}function handleError(_0x487567,_0x33ffa1){_0x33ffa1=_0x33ffa1||0x1f4;return function(_0x268351){logger[_0xac8c('0x29')](_0x268351['stack']);if(_0x268351[_0xac8c('0x2a')]){delete _0x268351[_0xac8c('0x2a')];}_0x487567[_0xac8c('0x19')](_0x33ffa1)['send'](_0x268351);};}exports['index']=function(_0x211559,_0x4fa612){var _0x3c7a87={},_0x4dd7e4={},_0x3a7ae4={'count':0x0,'rows':[]};var _0x537148=_[_0xac8c('0x2b')](db[_0xac8c('0x2c')][_0xac8c('0x2d')],function(_0xb39554){return{'name':_0xb39554[_0xac8c('0x2e')],'type':_0xb39554[_0xac8c('0x2f')][_0xac8c('0x30')]};});_0x4dd7e4['model']=_[_0xac8c('0x2b')](_0x537148,'name');_0x4dd7e4[_0xac8c('0x31')]=_[_0xac8c('0x32')](_0x211559[_0xac8c('0x31')]);_0x4dd7e4[_0xac8c('0x33')]=_[_0xac8c('0x34')](_0x4dd7e4[_0xac8c('0x35')],_0x4dd7e4[_0xac8c('0x31')]);_0x3c7a87[_0xac8c('0x36')]=_[_0xac8c('0x34')](_0x4dd7e4[_0xac8c('0x35')],qs['fields'](_0x211559[_0xac8c('0x31')][_0xac8c('0x37')]));_0x3c7a87[_0xac8c('0x36')]=_0x3c7a87[_0xac8c('0x36')]['length']?_0x3c7a87['attributes']:_0x4dd7e4[_0xac8c('0x35')];if(!_0x211559[_0xac8c('0x31')]['hasOwnProperty'](_0xac8c('0x38'))){_0x3c7a87[_0xac8c('0x1c')]=qs[_0xac8c('0x1c')](_0x211559['query'][_0xac8c('0x1c')]);_0x3c7a87[_0xac8c('0x1b')]=qs[_0xac8c('0x1b')](_0x211559[_0xac8c('0x31')][_0xac8c('0x1b')]);}_0x3c7a87[_0xac8c('0x39')]=qs[_0xac8c('0x3a')](_0x211559[_0xac8c('0x31')][_0xac8c('0x3a')]);_0x3c7a87[_0xac8c('0x3b')]=qs[_0xac8c('0x33')](_[_0xac8c('0x3c')](_0x211559[_0xac8c('0x31')],_0x4dd7e4[_0xac8c('0x33')]),_0x537148);if(_0x211559['query']['filter']){_0x3c7a87[_0xac8c('0x3b')]=_[_0xac8c('0x3d')](_0x3c7a87[_0xac8c('0x3b')],{'$or':_[_0xac8c('0x2b')](_0x537148,function(_0x338bd0){if(_0x338bd0['type']!==_0xac8c('0x3e')){var _0x10ce35={};_0x10ce35[_0x338bd0[_0xac8c('0x2a')]]={'$like':'%'+_0x211559[_0xac8c('0x31')][_0xac8c('0x3f')]+'%'};return _0x10ce35;}})});}_0x3c7a87=_[_0xac8c('0x3d')]({},_0x3c7a87,_0x211559[_0xac8c('0x40')]);var _0x380139={'where':_0x3c7a87[_0xac8c('0x3b')]};return db[_0xac8c('0x2c')][_0xac8c('0x1e')](_0x380139)[_0xac8c('0x24')](function(_0x48fe30){_0x3a7ae4['count']=_0x48fe30;if(_0x211559[_0xac8c('0x31')][_0xac8c('0x41')]){_0x3c7a87[_0xac8c('0x42')]=[{'all':!![]}];}return db['Template'][_0xac8c('0x43')](_0x3c7a87);})[_0xac8c('0x24')](function(_0x4f1670){_0x3a7ae4[_0xac8c('0x44')]=_0x4f1670;return _0x3a7ae4;})['then'](respondWithFilteredResult(_0x4fa612,_0x3c7a87))[_0xac8c('0x45')](handleError(_0x4fa612,null));};exports[_0xac8c('0x46')]=function(_0x24d402,_0x4835fc){var _0xb86596={'raw':!![],'where':{'id':_0x24d402[_0xac8c('0x47')]['id']}},_0x166e5d={};_0x166e5d[_0xac8c('0x35')]=_[_0xac8c('0x32')](db['Template'][_0xac8c('0x2d')]);_0x166e5d[_0xac8c('0x31')]=_[_0xac8c('0x32')](_0x24d402['query']);_0x166e5d[_0xac8c('0x33')]=_['intersection'](_0x166e5d[_0xac8c('0x35')],_0x166e5d[_0xac8c('0x31')]);_0xb86596[_0xac8c('0x36')]=_[_0xac8c('0x34')](_0x166e5d['model'],qs['fields'](_0x24d402[_0xac8c('0x31')][_0xac8c('0x37')]));_0xb86596['attributes']=_0xb86596[_0xac8c('0x36')]['length']?_0xb86596['attributes']:_0x166e5d[_0xac8c('0x35')];if(_0x24d402['query'][_0xac8c('0x41')]){_0xb86596[_0xac8c('0x42')]=[{'all':!![]}];}_0xb86596=_[_0xac8c('0x3d')]({},_0xb86596,_0x24d402[_0xac8c('0x40')]);return db[_0xac8c('0x2c')][_0xac8c('0x48')](_0xb86596)['then'](handleEntityNotFound(_0x4835fc,null))[_0xac8c('0x24')](respondWithResult(_0x4835fc,null))[_0xac8c('0x45')](handleError(_0x4835fc,null));};exports['create']=function(_0x557c3f,_0x4ebb87){return db['Template'][_0xac8c('0x49')](_0x557c3f[_0xac8c('0x4a')],{})['then'](function(_0x1b0396){var _0x9b1a59=_0x557c3f[_0xac8c('0x4b')][_0xac8c('0x26')]({'plain':!![]});if(!_0x9b1a59)throw new Error(_0xac8c('0x4c'));if(_0x9b1a59[_0xac8c('0x4d')]===_0xac8c('0x4b')){var _0x4273a9=_0x1b0396[_0xac8c('0x26')]({'plain':!![]});var _0x3659c4=_0xac8c('0x27');return db[_0xac8c('0x4e')][_0xac8c('0x48')]({'where':{'name':_0x3659c4,'userProfileId':_0x9b1a59['userProfileId']},'raw':!![]})[_0xac8c('0x24')](function(_0x40a79e){if(_0x40a79e&&_0x40a79e[_0xac8c('0x4f')]===0x0){return db[_0xac8c('0x28')][_0xac8c('0x49')]({'name':_0x4273a9[_0xac8c('0x2a')],'resourceId':_0x4273a9['id'],'type':_0x40a79e[_0xac8c('0x2a')],'sectionId':_0x40a79e['id']},{})['then'](function(){return _0x1b0396;});}else{return _0x1b0396;}})[_0xac8c('0x45')](function(_0x18b92c){logger[_0xac8c('0x29')](_0xac8c('0x50'),_0x18b92c);throw _0x18b92c;});}return _0x1b0396;})[_0xac8c('0x24')](respondWithResult(_0x4ebb87,0xc9))['catch'](handleError(_0x4ebb87,null));};exports[_0xac8c('0x23')]=function(_0x1fc9b6,_0x3bc5d5){if(_0x1fc9b6['body']['id']){delete _0x1fc9b6['body']['id'];}return db[_0xac8c('0x2c')][_0xac8c('0x48')]({'where':{'id':_0x1fc9b6['params']['id']}})[_0xac8c('0x24')](handleEntityNotFound(_0x3bc5d5,null))[_0xac8c('0x24')](saveUpdates(_0x1fc9b6[_0xac8c('0x4a')],null))[_0xac8c('0x24')](respondWithResult(_0x3bc5d5,null))[_0xac8c('0x45')](handleError(_0x3bc5d5,null));};exports['destroy']=function(_0xc89ee8,_0x231ce0){return db[_0xac8c('0x2c')][_0xac8c('0x48')]({'where':{'id':_0xc89ee8[_0xac8c('0x47')]['id']}})[_0xac8c('0x24')](handleEntityNotFound(_0x231ce0,null))[_0xac8c('0x24')](removeEntity(_0x231ce0,null))['catch'](handleError(_0x231ce0,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d0c5210..f666d51 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 _0x3018=['tools_templates','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./template.attributes','Template'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x3018,0x1b1));var _0x8301=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3018[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x8301('0x0'));var util=require(_0x8301('0x1'));var logger=require(_0x8301('0x2'))(_0x8301('0x3'));var moment=require(_0x8301('0x4'));var BPromise=require('bluebird');var rp=require(_0x8301('0x5'));var fs=require('fs');var path=require(_0x8301('0x6'));var rimraf=require(_0x8301('0x7'));var config=require(_0x8301('0x8'));var attributes=require(_0x8301('0x9'));module['exports']=function(_0x16c424,_0xbfeda2){return _0x16c424['define'](_0x8301('0xa'),attributes,{'tableName':_0x8301('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5175=['./template.attributes','exports','Template','tools_templates','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0x5175,0xe0));var _0x5517=function(_0x2ee935,_0x1f940c){_0x2ee935=_0x2ee935-0x0;var _0x3c960e=_0x5175[_0x2ee935];return _0x3c960e;};'use strict';var _=require(_0x5517('0x0'));var util=require(_0x5517('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5517('0x2'));var BPromise=require(_0x5517('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5517('0x4'));var rimraf=require(_0x5517('0x5'));var config=require(_0x5517('0x6'));var attributes=require(_0x5517('0x7'));module[_0x5517('0x8')]=function(_0x3cbee8,_0x1611db){return _0x3cbee8['define'](_0x5517('0x9'),attributes,{'tableName':_0x5517('0xa'),'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 ddc062b..8562357 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 _0x4441=['http','request','request\x20sent','stringify','error','Template,\x20%s,\x20%s','message','info','catch','GetTemplate','Template','options','raw','limit','include','model','map','attributes','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x4441,0xd4));var _0x1444=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4441[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x1444('0x0'));var util=require('util');var moment=require(_0x1444('0x1'));var BPromise=require(_0x1444('0x2'));var rs=require(_0x1444('0x3'));var fs=require('fs');var Redis=require(_0x1444('0x4'));var db=require(_0x1444('0x5'))['db'];var utils=require(_0x1444('0x6'));var logger=require(_0x1444('0x7'))(_0x1444('0x8'));var config=require(_0x1444('0x9'));var jayson=require(_0x1444('0xa'));var client=jayson[_0x1444('0xb')][_0x1444('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe26b0a,_0x10cc2d,_0x2a04d2){return new BPromise(function(_0x272e3d,_0x224858){return client[_0x1444('0xd')](_0xe26b0a,_0x2a04d2)['then'](function(_0x58248b){logger['info']('Template,\x20%s,\x20%s',_0x10cc2d,_0x1444('0xe'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x10cc2d,_0x1444('0xe'),JSON[_0x1444('0xf')](_0x58248b));if(_0x58248b[_0x1444('0x10')]){if(_0x58248b[_0x1444('0x10')]['code']===0x1f4){logger[_0x1444('0x10')](_0x1444('0x11'),_0x10cc2d,_0x58248b['error'][_0x1444('0x12')]);return _0x224858(_0x58248b[_0x1444('0x10')][_0x1444('0x12')]);}logger['error']('Template,\x20%s,\x20%s',_0x10cc2d,_0x58248b[_0x1444('0x10')]['message']);return _0x272e3d(_0x58248b[_0x1444('0x10')][_0x1444('0x12')]);}else{logger[_0x1444('0x13')](_0x1444('0x11'),_0x10cc2d,_0x1444('0xe'));_0x272e3d(_0x58248b['result'][_0x1444('0x12')]);}})[_0x1444('0x14')](function(_0x4c68f7){logger[_0x1444('0x10')](_0x1444('0x11'),_0x10cc2d,_0x4c68f7);_0x224858(_0x4c68f7);});});}exports[_0x1444('0x15')]=function(_0x33e17a){var _0x4ca519=this;return new Promise(function(_0x4bf20a,_0x1bb876){return db[_0x1444('0x16')]['findAll']({'raw':_0x33e17a[_0x1444('0x17')]?_0x33e17a[_0x1444('0x17')][_0x1444('0x18')]===undefined?!![]:![]:!![],'where':_0x33e17a['options']?_0x33e17a[_0x1444('0x17')]['where']||null:null,'attributes':_0x33e17a[_0x1444('0x17')]?_0x33e17a[_0x1444('0x17')]['attributes']||null:null,'limit':_0x33e17a['options']?_0x33e17a[_0x1444('0x17')][_0x1444('0x19')]||null:null,'include':_0x33e17a[_0x1444('0x17')]?_0x33e17a[_0x1444('0x17')][_0x1444('0x1a')]?_['map'](_0x33e17a['options'][_0x1444('0x1a')],function(_0x167877){return{'model':db[_0x167877[_0x1444('0x1b')]],'as':_0x167877['as'],'attributes':_0x167877['attributes'],'include':_0x167877[_0x1444('0x1a')]?_[_0x1444('0x1c')](_0x167877[_0x1444('0x1a')],function(_0x125204){return{'model':db[_0x125204[_0x1444('0x1b')]],'as':_0x125204['as'],'attributes':_0x125204[_0x1444('0x1d')],'include':_0x125204[_0x1444('0x1a')]?_[_0x1444('0x1c')](_0x125204[_0x1444('0x1a')],function(_0x56cbd7){return{'model':db[_0x56cbd7[_0x1444('0x1b')]],'as':_0x56cbd7['as'],'attributes':_0x56cbd7[_0x1444('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1444('0x1e')](function(_0x3a1895){logger[_0x1444('0x13')](_0x1444('0x15'),_0x33e17a);logger[_0x1444('0x1f')]('GetTemplate',_0x33e17a,JSON[_0x1444('0xf')](_0x3a1895));_0x4bf20a(_0x3a1895);})[_0x1444('0x14')](function(_0x223d21){logger[_0x1444('0x10')](_0x1444('0x15'),_0x223d21[_0x1444('0x12')],_0x33e17a);_0x1bb876(_0x4ca519['error'](0x1f4,_0x223d21[_0x1444('0x12')]));});});}; \ No newline at end of file +var _0xf693=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x4e0878,_0x5b1004){var _0x44d0a2=function(_0x523161){while(--_0x523161){_0x4e0878['push'](_0x4e0878['shift']());}};_0x44d0a2(++_0x5b1004);}(_0xf693,0x1ba));var _0x3f69=function(_0x58708a,_0xc39fb3){_0x58708a=_0x58708a-0x0;var _0x2cf144=_0xf693[_0x58708a];return _0x2cf144;};'use strict';var _=require(_0x3f69('0x0'));var util=require(_0x3f69('0x1'));var moment=require(_0x3f69('0x2'));var BPromise=require(_0x3f69('0x3'));var rs=require(_0x3f69('0x4'));var fs=require('fs');var Redis=require(_0x3f69('0x5'));var db=require(_0x3f69('0x6'))['db'];var utils=require(_0x3f69('0x7'));var logger=require(_0x3f69('0x8'))(_0x3f69('0x9'));var config=require(_0x3f69('0xa'));var jayson=require(_0x3f69('0xb'));var client=jayson[_0x3f69('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59cfed,_0x3ac682,_0x514050){return new BPromise(function(_0x154920,_0x4091e5){return client['request'](_0x59cfed,_0x514050)['then'](function(_0x2a752f){logger['info'](_0x3f69('0xd'),_0x3ac682,_0x3f69('0xe'));logger[_0x3f69('0xf')](_0x3f69('0x10'),_0x3ac682,_0x3f69('0xe'),JSON[_0x3f69('0x11')](_0x2a752f));if(_0x2a752f['error']){if(_0x2a752f[_0x3f69('0x12')][_0x3f69('0x13')]===0x1f4){logger['error'](_0x3f69('0xd'),_0x3ac682,_0x2a752f[_0x3f69('0x12')][_0x3f69('0x14')]);return _0x4091e5(_0x2a752f[_0x3f69('0x12')][_0x3f69('0x14')]);}logger['error'](_0x3f69('0xd'),_0x3ac682,_0x2a752f['error'][_0x3f69('0x14')]);return _0x154920(_0x2a752f[_0x3f69('0x12')][_0x3f69('0x14')]);}else{logger[_0x3f69('0x15')](_0x3f69('0xd'),_0x3ac682,_0x3f69('0xe'));_0x154920(_0x2a752f['result'][_0x3f69('0x14')]);}})[_0x3f69('0x16')](function(_0x47e9fa){logger['error'](_0x3f69('0xd'),_0x3ac682,_0x47e9fa);_0x4091e5(_0x47e9fa);});});}exports[_0x3f69('0x17')]=function(_0x5ac814){var _0x4ae7a1=this;return new Promise(function(_0x17a9c9,_0x5b6ce4){return db[_0x3f69('0x18')]['findAll']({'raw':_0x5ac814[_0x3f69('0x19')]?_0x5ac814['options'][_0x3f69('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ac814['options']?_0x5ac814['options'][_0x3f69('0x1b')]||null:null,'attributes':_0x5ac814[_0x3f69('0x19')]?_0x5ac814['options'][_0x3f69('0x1c')]||null:null,'limit':_0x5ac814['options']?_0x5ac814[_0x3f69('0x19')][_0x3f69('0x1d')]||null:null,'include':_0x5ac814['options']?_0x5ac814[_0x3f69('0x19')][_0x3f69('0x1e')]?_[_0x3f69('0x1f')](_0x5ac814['options']['include'],function(_0x59d52d){return{'model':db[_0x59d52d[_0x3f69('0x20')]],'as':_0x59d52d['as'],'attributes':_0x59d52d[_0x3f69('0x1c')],'include':_0x59d52d[_0x3f69('0x1e')]?_[_0x3f69('0x1f')](_0x59d52d[_0x3f69('0x1e')],function(_0x415958){return{'model':db[_0x415958['model']],'as':_0x415958['as'],'attributes':_0x415958[_0x3f69('0x1c')],'include':_0x415958['include']?_['map'](_0x415958['include'],function(_0xb08e65){return{'model':db[_0xb08e65[_0x3f69('0x20')]],'as':_0xb08e65['as'],'attributes':_0xb08e65[_0x3f69('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3f69('0x21')](function(_0x1dde91){logger[_0x3f69('0x15')](_0x3f69('0x17'),_0x5ac814);logger[_0x3f69('0xf')](_0x3f69('0x17'),_0x5ac814,JSON[_0x3f69('0x11')](_0x1dde91));_0x17a9c9(_0x1dde91);})[_0x3f69('0x16')](function(_0x59b17c){logger['error']('GetTemplate',_0x59b17c[_0x3f69('0x14')],_0x5ac814);_0x5b6ce4(_0x4ae7a1['error'](0x1f4,_0x59b17c[_0x3f69('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 6770529..50563de 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 _0x74a2=['isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','addAllCondition','/:id/actions','addAction','put','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get'];(function(_0x53b1ed,_0x46eac2){var _0x2c663d=function(_0x227b1c){while(--_0x227b1c){_0x53b1ed['push'](_0x53b1ed['shift']());}};_0x2c663d(++_0x46eac2);}(_0x74a2,0x1bf));var _0x274a=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0x74a2[_0x356127];return _0x5d4c75;};'use strict';var multer=require('multer');var util=require(_0x274a('0x0'));var path=require(_0x274a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x274a('0x2')]();var fs_extra=require(_0x274a('0x3'));var auth=require(_0x274a('0x4'));var interaction=require(_0x274a('0x5'));var config=require(_0x274a('0x6'));var controller=require(_0x274a('0x7'));router[_0x274a('0x8')]('/',auth[_0x274a('0x9')](),controller[_0x274a('0xa')]);router[_0x274a('0x8')](_0x274a('0xb'),auth[_0x274a('0x9')](),controller[_0x274a('0xc')]);router[_0x274a('0x8')](_0x274a('0xd'),auth['isAuthenticated'](),controller[_0x274a('0xe')]);router[_0x274a('0x8')]('/:id/any_conditions',auth[_0x274a('0x9')](),controller[_0x274a('0xf')]);router[_0x274a('0x8')]('/:id/actions',auth[_0x274a('0x9')](),controller[_0x274a('0x10')]);router['post']('/',auth[_0x274a('0x9')](),controller['create']);router[_0x274a('0x11')](_0x274a('0xd'),auth['isAuthenticated'](),controller[_0x274a('0x12')]);router[_0x274a('0x11')]('/:id/any_conditions',auth[_0x274a('0x9')](),controller['addAnyCondition']);router['post'](_0x274a('0x13'),auth['isAuthenticated'](),controller[_0x274a('0x14')]);router[_0x274a('0x15')](_0x274a('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x274a('0xb'),auth[_0x274a('0x9')](),controller[_0x274a('0x16')]);module[_0x274a('0x17')]=router; \ No newline at end of file +var _0x6972=['create','post','addAllCondition','addAction','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions'];(function(_0x407a3e,_0x15acb0){var _0x129fe3=function(_0x124c2f){while(--_0x124c2f){_0x407a3e['push'](_0x407a3e['shift']());}};_0x129fe3(++_0x15acb0);}(_0x6972,0x173));var _0x2697=function(_0xd098d3,_0x5d4922){_0xd098d3=_0xd098d3-0x0;var _0x35f755=_0x6972[_0xd098d3];return _0x35f755;};'use strict';var multer=require(_0x2697('0x0'));var util=require('util');var path=require(_0x2697('0x1'));var timeout=require(_0x2697('0x2'));var express=require(_0x2697('0x3'));var router=express['Router']();var fs_extra=require(_0x2697('0x4'));var auth=require(_0x2697('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2697('0x6'));var controller=require(_0x2697('0x7'));router[_0x2697('0x8')]('/',auth[_0x2697('0x9')](),controller[_0x2697('0xa')]);router[_0x2697('0x8')](_0x2697('0xb'),auth[_0x2697('0x9')](),controller[_0x2697('0xc')]);router[_0x2697('0x8')](_0x2697('0xd'),auth[_0x2697('0x9')](),controller[_0x2697('0xe')]);router['get'](_0x2697('0xf'),auth[_0x2697('0x9')](),controller[_0x2697('0x10')]);router['get'](_0x2697('0x11'),auth[_0x2697('0x9')](),controller[_0x2697('0x12')]);router['post']('/',auth[_0x2697('0x9')](),controller[_0x2697('0x13')]);router[_0x2697('0x14')](_0x2697('0xd'),auth[_0x2697('0x9')](),controller[_0x2697('0x15')]);router[_0x2697('0x14')](_0x2697('0xf'),auth[_0x2697('0x9')](),controller['addAnyCondition']);router[_0x2697('0x14')](_0x2697('0x11'),auth[_0x2697('0x9')](),controller[_0x2697('0x16')]);router[_0x2697('0x17')](_0x2697('0xb'),auth[_0x2697('0x9')](),controller['update']);router[_0x2697('0x18')]('/:id',auth[_0x2697('0x9')](),controller[_0x2697('0x19')]);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 7dd3b9e..562f361 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 _0xadb2=['exports','STRING'];(function(_0x287ef0,_0x22d6c6){var _0x37d443=function(_0x3b70c0){while(--_0x3b70c0){_0x287ef0['push'](_0x287ef0['shift']());}};_0x37d443(++_0x22d6c6);}(_0xadb2,0xf2));var _0x2adb=function(_0x45fc66,_0x1ee1a1){_0x45fc66=_0x45fc66-0x0;var _0x4bb191=_0xadb2[_0x45fc66];return _0x4bb191;};'use strict';var Sequelize=require('sequelize');module[_0x2adb('0x0')]={'name':{'type':Sequelize[_0x2adb('0x1')]},'channel':{'type':Sequelize[_0x2adb('0x1')]},'description':{'type':Sequelize[_0x2adb('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3fb4=['sequelize','exports','STRING','BOOLEAN'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x3fb4,0xe0));var _0x43fb=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x3fb4[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x43fb('0x0'));module[_0x43fb('0x1')]={'name':{'type':Sequelize[_0x43fb('0x2')]},'channel':{'type':Sequelize[_0x43fb('0x2')]},'description':{'type':Sequelize[_0x43fb('0x2')]},'status':{'type':Sequelize[_0x43fb('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 422f9d2..fb5cbb9 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 _0x81bc=['show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','offset','count','apply','reject','update','destroy','get','Triggers','UserProfileResource','then','status','error','stack','name','send','index','map','Trigger','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch'];(function(_0x514ef1,_0x5d5cb1){var _0x3f5790=function(_0x12f7f4){while(--_0x12f7f4){_0x514ef1['push'](_0x514ef1['shift']());}};_0x3f5790(++_0x5d5cb1);}(_0x81bc,0xc8));var _0xc81b=function(_0x122fe6,_0x4ac758){_0x122fe6=_0x122fe6-0x0;var _0x36b7d2=_0x81bc[_0x122fe6];return _0x36b7d2;};'use strict';var emlformat=require(_0xc81b('0x0'));var rimraf=require(_0xc81b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc81b('0x2'));var moment=require(_0xc81b('0x3'));var BPromise=require(_0xc81b('0x4'));var Mustache=require(_0xc81b('0x5'));var util=require(_0xc81b('0x6'));var path=require(_0xc81b('0x7'));var sox=require(_0xc81b('0x8'));var csv=require(_0xc81b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc81b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc81b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc81b('0x9'));var querystring=require('querystring');var Papa=require(_0xc81b('0xc'));var Redis=require(_0xc81b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc81b('0xe'));var as=require(_0xc81b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc81b('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xc81b('0x11'));var licenseUtil=require(_0xc81b('0x12'));var db=require(_0xc81b('0x13'))['db'];function respondWithStatusCode(_0xdc7d8f,_0x4302cc){_0x4302cc=_0x4302cc||0xcc;return function(_0x2745e0){if(_0x2745e0){return _0xdc7d8f[_0xc81b('0x14')](_0x4302cc);}return _0xdc7d8f['status'](_0x4302cc)[_0xc81b('0x15')]();};}function respondWithResult(_0x3e68e6,_0x544b87){_0x544b87=_0x544b87||0xc8;return function(_0x43c3ff){if(_0x43c3ff){return _0x3e68e6['status'](_0x544b87)[_0xc81b('0x16')](_0x43c3ff);}};}function respondWithFilteredResult(_0x3af0c0,_0x1f7542){return function(_0x406f91){if(_0x406f91){var _0x42c23d=typeof _0x1f7542['offset']==='undefined'&&typeof _0x1f7542[_0xc81b('0x17')]===_0xc81b('0x18');var _0x233527=_0x406f91['count'];var _0x246342=_0x42c23d?0x0:_0x1f7542[_0xc81b('0x19')];var _0x1b5b8c=_0x42c23d?_0x406f91[_0xc81b('0x1a')]:_0x1f7542[_0xc81b('0x19')]+_0x1f7542['limit'];var _0x36a60c;if(_0x1b5b8c>=_0x233527){_0x1b5b8c=_0x233527;_0x36a60c=0xc8;}else{_0x36a60c=0xce;}_0x3af0c0['status'](_0x36a60c);return _0x3af0c0['set']('Content-Range',_0x246342+'-'+_0x1b5b8c+'/'+_0x233527)[_0xc81b('0x16')](_0x406f91);}return null;};}function patchUpdates(_0x519e2b){return function(_0x9ffff7){try{jsonpatch[_0xc81b('0x1b')](_0x9ffff7,_0x519e2b,!![]);}catch(_0x847aa5){return BPromise[_0xc81b('0x1c')](_0x847aa5);}return _0x9ffff7['save']();};}function saveUpdates(_0x56b336,_0x2a7b69){return function(_0x40649b){if(_0x40649b){return _0x40649b[_0xc81b('0x1d')](_0x56b336)['then'](function(_0x2b2869){return _0x2b2869;});}return null;};}function removeEntity(_0x4c1a1c,_0x18021f){return function(_0x16a453){if(_0x16a453){return _0x16a453[_0xc81b('0x1e')]()['then'](function(){var _0x588869=_0x16a453[_0xc81b('0x1f')]({'plain':!![]});var _0xf6e286=_0xc81b('0x20');return db[_0xc81b('0x21')]['destroy']({'where':{'type':_0xf6e286,'resourceId':_0x588869['id']}})[_0xc81b('0x22')](function(){return _0x16a453;});})[_0xc81b('0x22')](function(){_0x4c1a1c[_0xc81b('0x23')](0xcc)[_0xc81b('0x15')]();});}};}function handleEntityNotFound(_0x47a272,_0x456819){return function(_0x366b87){if(!_0x366b87){_0x47a272['sendStatus'](0x194);}return _0x366b87;};}function handleError(_0x294d3b,_0x4d6a17){_0x4d6a17=_0x4d6a17||0x1f4;return function(_0x73283a){logger[_0xc81b('0x24')](_0x73283a[_0xc81b('0x25')]);if(_0x73283a[_0xc81b('0x26')]){delete _0x73283a[_0xc81b('0x26')];}_0x294d3b[_0xc81b('0x23')](_0x4d6a17)[_0xc81b('0x27')](_0x73283a);};}exports[_0xc81b('0x28')]=function(_0x2aa5f2,_0x1edb92){var _0x15a3a7={},_0x1af30f={},_0x100d68={'count':0x0,'rows':[]};var _0xbb4de6=_[_0xc81b('0x29')](db[_0xc81b('0x2a')]['rawAttributes'],function(_0x2c4a01){return{'name':_0x2c4a01[_0xc81b('0x2b')],'type':_0x2c4a01[_0xc81b('0x2c')]['key']};});_0x1af30f[_0xc81b('0x2d')]=_[_0xc81b('0x29')](_0xbb4de6,_0xc81b('0x26'));_0x1af30f[_0xc81b('0x2e')]=_[_0xc81b('0x2f')](_0x2aa5f2[_0xc81b('0x2e')]);_0x1af30f['filters']=_[_0xc81b('0x30')](_0x1af30f[_0xc81b('0x2d')],_0x1af30f['query']);_0x15a3a7[_0xc81b('0x31')]=_[_0xc81b('0x30')](_0x1af30f[_0xc81b('0x2d')],qs[_0xc81b('0x32')](_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x32')]));_0x15a3a7[_0xc81b('0x31')]=_0x15a3a7[_0xc81b('0x31')][_0xc81b('0x33')]?_0x15a3a7[_0xc81b('0x31')]:_0x1af30f[_0xc81b('0x2d')];if(!_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x34')](_0xc81b('0x35'))){_0x15a3a7[_0xc81b('0x17')]=qs[_0xc81b('0x17')](_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x17')]);_0x15a3a7[_0xc81b('0x19')]=qs[_0xc81b('0x19')](_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x19')]);}_0x15a3a7[_0xc81b('0x36')]=qs[_0xc81b('0x37')](_0x2aa5f2[_0xc81b('0x2e')]['sort']);_0x15a3a7[_0xc81b('0x38')]=qs[_0xc81b('0x39')](_[_0xc81b('0x3a')](_0x2aa5f2['query'],_0x1af30f[_0xc81b('0x39')]),_0xbb4de6);if(_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x3b')]){_0x15a3a7[_0xc81b('0x38')]=_['merge'](_0x15a3a7[_0xc81b('0x38')],{'$or':_[_0xc81b('0x29')](_0xbb4de6,function(_0x326339){if(_0x326339[_0xc81b('0x2c')]!==_0xc81b('0x3c')){var _0x278451={};_0x278451[_0x326339[_0xc81b('0x26')]]={'$like':'%'+_0x2aa5f2[_0xc81b('0x2e')]['filter']+'%'};return _0x278451;}})});}_0x15a3a7=_[_0xc81b('0x3d')]({},_0x15a3a7,_0x2aa5f2[_0xc81b('0x3e')]);var _0x45d82f={'where':_0x15a3a7[_0xc81b('0x38')]};return db[_0xc81b('0x2a')][_0xc81b('0x1a')](_0x45d82f)[_0xc81b('0x22')](function(_0x4b5341){_0x100d68[_0xc81b('0x1a')]=_0x4b5341;if(_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x3f')]){_0x15a3a7[_0xc81b('0x40')]=[{'all':!![]}];}return db[_0xc81b('0x2a')][_0xc81b('0x41')](_0x15a3a7);})[_0xc81b('0x22')](function(_0x443d76){_0x100d68['rows']=_0x443d76;return _0x100d68;})[_0xc81b('0x22')](respondWithFilteredResult(_0x1edb92,_0x15a3a7))[_0xc81b('0x42')](handleError(_0x1edb92,null));};exports[_0xc81b('0x43')]=function(_0x5c4591,_0x3a5484){var _0x10e970={'raw':![],'where':{'id':_0x5c4591['params']['id']}},_0x364040={};_0x364040['model']=_[_0xc81b('0x2f')](db['Trigger'][_0xc81b('0x44')]);_0x364040[_0xc81b('0x2e')]=_[_0xc81b('0x2f')](_0x5c4591['query']);_0x364040['filters']=_[_0xc81b('0x30')](_0x364040['model'],_0x364040[_0xc81b('0x2e')]);_0x10e970[_0xc81b('0x31')]=_['intersection'](_0x364040[_0xc81b('0x2d')],qs[_0xc81b('0x32')](_0x5c4591[_0xc81b('0x2e')]['fields']));_0x10e970[_0xc81b('0x31')]=_0x10e970['attributes'][_0xc81b('0x33')]?_0x10e970[_0xc81b('0x31')]:_0x364040[_0xc81b('0x2d')];if(_0x5c4591['query'][_0xc81b('0x3f')]){_0x10e970['include']=[{'all':!![]}];}_0x10e970=_['merge']({},_0x10e970,_0x5c4591[_0xc81b('0x3e')]);return db[_0xc81b('0x2a')]['find'](_0x10e970)[_0xc81b('0x22')](handleEntityNotFound(_0x3a5484,null))['then'](respondWithResult(_0x3a5484,null))[_0xc81b('0x42')](handleError(_0x3a5484,null));};exports[_0xc81b('0x45')]=function(_0x1aaec0,_0x2f9b04){return db[_0xc81b('0x2a')][_0xc81b('0x45')](_0x1aaec0[_0xc81b('0x46')],{})[_0xc81b('0x22')](function(_0x213754){var _0x3f9659=_0x1aaec0[_0xc81b('0x47')][_0xc81b('0x1f')]({'plain':!![]});if(!_0x3f9659)throw new Error(_0xc81b('0x48'));if(_0x3f9659[_0xc81b('0x49')]===_0xc81b('0x47')){var _0x2e1326=_0x213754[_0xc81b('0x1f')]({'plain':!![]});var _0x9465d5=_0xc81b('0x20');return db[_0xc81b('0x4a')][_0xc81b('0x4b')]({'where':{'name':_0x9465d5,'userProfileId':_0x3f9659[_0xc81b('0x4c')]},'raw':!![]})[_0xc81b('0x22')](function(_0x4c4b68){if(_0x4c4b68&&_0x4c4b68['autoAssociation']===0x0){return db[_0xc81b('0x21')][_0xc81b('0x45')]({'name':_0x2e1326[_0xc81b('0x26')],'resourceId':_0x2e1326['id'],'type':_0x4c4b68[_0xc81b('0x26')],'sectionId':_0x4c4b68['id']},{})['then'](function(){return _0x213754;});}else{return _0x213754;}})[_0xc81b('0x42')](function(_0x8727f5){logger[_0xc81b('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8727f5);throw _0x8727f5;});}return _0x213754;})[_0xc81b('0x22')](respondWithResult(_0x2f9b04,0xc9))[_0xc81b('0x42')](handleError(_0x2f9b04,null));};exports[_0xc81b('0x1d')]=function(_0x3bf6ba,_0x32f1c0){if(_0x3bf6ba[_0xc81b('0x46')]['id']){delete _0x3bf6ba[_0xc81b('0x46')]['id'];}return db[_0xc81b('0x2a')]['find']({'where':{'id':_0x3bf6ba[_0xc81b('0x4d')]['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x32f1c0,null))[_0xc81b('0x22')](saveUpdates(_0x3bf6ba['body'],null))[_0xc81b('0x22')](respondWithResult(_0x32f1c0,null))[_0xc81b('0x42')](handleError(_0x32f1c0,null));};exports[_0xc81b('0x1e')]=function(_0x48d50d,_0x33b701){return db[_0xc81b('0x2a')]['find']({'where':{'id':_0x48d50d['params']['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x33b701,null))[_0xc81b('0x22')](removeEntity(_0x33b701,null))[_0xc81b('0x42')](handleError(_0x33b701,null));};exports['addAllCondition']=function(_0x3f0417,_0x28603f,_0x10f365){if(_0x3f0417['body']['id']){delete _0x3f0417['body']['id'];}return db[_0xc81b('0x2a')][_0xc81b('0x4b')]({'where':{'id':_0x3f0417[_0xc81b('0x4d')]['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x28603f,null))['then'](function(_0x4fd747){if(_0x4fd747){_0x3f0417[_0xc81b('0x46')][_0xc81b('0x4e')]=_0x4fd747['id'];return db[_0xc81b('0x4f')][_0xc81b('0x45')](_0x3f0417[_0xc81b('0x46')]);}})['then'](respondWithResult(_0x28603f,null))[_0xc81b('0x42')](handleError(_0x28603f,null));};exports[_0xc81b('0x50')]=function(_0x3be88c,_0x4ebf0c,_0x340ba9){if(_0x3be88c[_0xc81b('0x46')]['id']){delete _0x3be88c[_0xc81b('0x46')]['id'];}return db[_0xc81b('0x2a')]['find']({'where':{'id':_0x3be88c[_0xc81b('0x4d')]['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x4ebf0c,null))['then'](function(_0x382e42){if(_0x382e42){_0x3be88c[_0xc81b('0x46')][_0xc81b('0x51')]=_0x382e42['id'];return db['Condition'][_0xc81b('0x45')](_0x3be88c['body']);}})[_0xc81b('0x22')](respondWithResult(_0x4ebf0c,null))[_0xc81b('0x42')](handleError(_0x4ebf0c,null));};exports[_0xc81b('0x52')]=function(_0x58bc8c,_0x28acc1,_0x4a1bef){var _0x498e63={};var _0x2305f4={};var _0x3f18fd;var _0x4a5b4b;return db[_0xc81b('0x2a')][_0xc81b('0x53')]({'where':{'id':_0x58bc8c[_0xc81b('0x4d')]['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x28acc1,null))['then'](function(_0x5e9fd7){if(_0x5e9fd7){_0x3f18fd=_0x5e9fd7;_0x2305f4[_0xc81b('0x2d')]=_[_0xc81b('0x2f')](db[_0xc81b('0x4f')][_0xc81b('0x44')]);_0x2305f4[_0xc81b('0x2e')]=_[_0xc81b('0x2f')](_0x58bc8c[_0xc81b('0x2e')]);_0x2305f4['filters']=_[_0xc81b('0x30')](_0x2305f4[_0xc81b('0x2d')],_0x2305f4[_0xc81b('0x2e')]);_0x498e63['attributes']=_[_0xc81b('0x30')](_0x2305f4[_0xc81b('0x2d')],qs['fields'](_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x32')]));_0x498e63[_0xc81b('0x31')]=_0x498e63['attributes'][_0xc81b('0x33')]?_0x498e63['attributes']:_0x2305f4[_0xc81b('0x2d')];_0x498e63[_0xc81b('0x36')]=qs[_0xc81b('0x37')](_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x37')]);_0x498e63['where']=qs[_0xc81b('0x39')](_[_0xc81b('0x3a')](_0x58bc8c[_0xc81b('0x2e')],_0x2305f4['filters']));if(_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x3b')]){_0x498e63[_0xc81b('0x38')]=_[_0xc81b('0x3d')](_0x498e63[_0xc81b('0x38')],{'$or':_[_0xc81b('0x29')](_0x498e63[_0xc81b('0x31')],function(_0x348d3c){var _0x52592d={};_0x52592d[_0x348d3c]={'$like':'%'+_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x3b')]+'%'};return _0x52592d;})});}_0x498e63=_[_0xc81b('0x3d')]({},_0x498e63,_0x58bc8c[_0xc81b('0x3e')]);return _0x3f18fd[_0xc81b('0x52')](_0x498e63);}})[_0xc81b('0x22')](function(_0x33c151){if(_0x33c151){_0x4a5b4b=_0x33c151['length'];if(!_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x34')]('nolimit')){_0x498e63[_0xc81b('0x17')]=qs['limit'](_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x17')]);_0x498e63['offset']=qs[_0xc81b('0x19')](_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x19')]);}return _0x3f18fd[_0xc81b('0x52')](_0x498e63);}})[_0xc81b('0x22')](function(_0x1cfbd1){if(_0x1cfbd1){return _0x1cfbd1?{'count':_0x4a5b4b,'rows':_0x1cfbd1}:null;}})['then'](respondWithResult(_0x28acc1,null))[_0xc81b('0x42')](handleError(_0x28acc1,null));};exports[_0xc81b('0x54')]=function(_0xa31287,_0xe766be,_0x2b5765){var _0xf89607={};var _0x2c4eaf={};var _0x145ae6;var _0x46e6b1;return db[_0xc81b('0x2a')][_0xc81b('0x53')]({'where':{'id':_0xa31287['params']['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0xe766be,null))['then'](function(_0x18f809){if(_0x18f809){_0x145ae6=_0x18f809;_0x2c4eaf[_0xc81b('0x2d')]=_[_0xc81b('0x2f')](db[_0xc81b('0x4f')][_0xc81b('0x44')]);_0x2c4eaf[_0xc81b('0x2e')]=_[_0xc81b('0x2f')](_0xa31287[_0xc81b('0x2e')]);_0x2c4eaf['filters']=_[_0xc81b('0x30')](_0x2c4eaf[_0xc81b('0x2d')],_0x2c4eaf['query']);_0xf89607[_0xc81b('0x31')]=_['intersection'](_0x2c4eaf[_0xc81b('0x2d')],qs['fields'](_0xa31287['query'][_0xc81b('0x32')]));_0xf89607[_0xc81b('0x31')]=_0xf89607[_0xc81b('0x31')][_0xc81b('0x33')]?_0xf89607['attributes']:_0x2c4eaf[_0xc81b('0x2d')];_0xf89607[_0xc81b('0x36')]=qs[_0xc81b('0x37')](_0xa31287[_0xc81b('0x2e')][_0xc81b('0x37')]);_0xf89607[_0xc81b('0x38')]=qs[_0xc81b('0x39')](_['pick'](_0xa31287[_0xc81b('0x2e')],_0x2c4eaf[_0xc81b('0x39')]));if(_0xa31287[_0xc81b('0x2e')][_0xc81b('0x3b')]){_0xf89607[_0xc81b('0x38')]=_[_0xc81b('0x3d')](_0xf89607[_0xc81b('0x38')],{'$or':_[_0xc81b('0x29')](_0xf89607[_0xc81b('0x31')],function(_0x41c8e3){var _0x378cb2={};_0x378cb2[_0x41c8e3]={'$like':'%'+_0xa31287[_0xc81b('0x2e')]['filter']+'%'};return _0x378cb2;})});}_0xf89607=_[_0xc81b('0x3d')]({},_0xf89607,_0xa31287[_0xc81b('0x3e')]);return _0x145ae6[_0xc81b('0x54')](_0xf89607);}})[_0xc81b('0x22')](function(_0xd40e44){if(_0xd40e44){_0x46e6b1=_0xd40e44[_0xc81b('0x33')];if(!_0xa31287[_0xc81b('0x2e')][_0xc81b('0x34')](_0xc81b('0x35'))){_0xf89607[_0xc81b('0x17')]=qs[_0xc81b('0x17')](_0xa31287[_0xc81b('0x2e')][_0xc81b('0x17')]);_0xf89607[_0xc81b('0x19')]=qs[_0xc81b('0x19')](_0xa31287[_0xc81b('0x2e')][_0xc81b('0x19')]);}return _0x145ae6['getAnyConditions'](_0xf89607);}})[_0xc81b('0x22')](function(_0x5c8cd2){if(_0x5c8cd2){return _0x5c8cd2?{'count':_0x46e6b1,'rows':_0x5c8cd2}:null;}})[_0xc81b('0x22')](respondWithResult(_0xe766be,null))[_0xc81b('0x42')](handleError(_0xe766be,null));};exports[_0xc81b('0x55')]=function(_0x14aa95,_0x312f9f,_0x221742){if(_0x14aa95[_0xc81b('0x46')]['id']){delete _0x14aa95[_0xc81b('0x46')]['id'];}return db[_0xc81b('0x2a')]['find']({'where':{'id':_0x14aa95['params']['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x312f9f,null))[_0xc81b('0x22')](function(_0x15fde0){if(_0x15fde0){_0x14aa95[_0xc81b('0x46')][_0xc81b('0x56')]=_0x15fde0['id'];return db[_0xc81b('0x57')]['create'](_0x14aa95[_0xc81b('0x46')]);}})[_0xc81b('0x22')](respondWithResult(_0x312f9f,null))[_0xc81b('0x42')](handleError(_0x312f9f,null));};exports['getActions']=function(_0x437b43,_0x432f53,_0x43a8f1){var _0x5e6db7={};var _0x2982ed={};var _0xc97b0d;var _0x2ef92c;return db[_0xc81b('0x2a')]['findOne']({'where':{'id':_0x437b43['params']['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x432f53,null))['then'](function(_0x48f914){if(_0x48f914){_0xc97b0d=_0x48f914;_0x2982ed['model']=_['keys'](db[_0xc81b('0x57')]['rawAttributes']);_0x2982ed[_0xc81b('0x2e')]=_[_0xc81b('0x2f')](_0x437b43[_0xc81b('0x2e')]);_0x2982ed[_0xc81b('0x39')]=_[_0xc81b('0x30')](_0x2982ed[_0xc81b('0x2d')],_0x2982ed['query']);_0x5e6db7[_0xc81b('0x31')]=_['intersection'](_0x2982ed[_0xc81b('0x2d')],qs[_0xc81b('0x32')](_0x437b43[_0xc81b('0x2e')][_0xc81b('0x32')]));_0x5e6db7[_0xc81b('0x31')]=_0x5e6db7[_0xc81b('0x31')][_0xc81b('0x33')]?_0x5e6db7[_0xc81b('0x31')]:_0x2982ed[_0xc81b('0x2d')];_0x5e6db7[_0xc81b('0x36')]=qs['sort'](_0x437b43[_0xc81b('0x2e')][_0xc81b('0x37')]);_0x5e6db7[_0xc81b('0x38')]=qs['filters'](_['pick'](_0x437b43[_0xc81b('0x2e')],_0x2982ed['filters']));if(_0x437b43[_0xc81b('0x2e')][_0xc81b('0x3b')]){_0x5e6db7[_0xc81b('0x38')]=_[_0xc81b('0x3d')](_0x5e6db7[_0xc81b('0x38')],{'$or':_[_0xc81b('0x29')](_0x5e6db7[_0xc81b('0x31')],function(_0x432f3f){var _0x31c2ba={};_0x31c2ba[_0x432f3f]={'$like':'%'+_0x437b43[_0xc81b('0x2e')][_0xc81b('0x3b')]+'%'};return _0x31c2ba;})});}_0x5e6db7=_[_0xc81b('0x3d')]({},_0x5e6db7,_0x437b43['options']);return _0xc97b0d[_0xc81b('0x58')](_0x5e6db7);}})[_0xc81b('0x22')](function(_0x4ffde3){if(_0x4ffde3){_0x2ef92c=_0x4ffde3[_0xc81b('0x33')];if(!_0x437b43['query'][_0xc81b('0x34')](_0xc81b('0x35'))){_0x5e6db7[_0xc81b('0x17')]=qs[_0xc81b('0x17')](_0x437b43[_0xc81b('0x2e')][_0xc81b('0x17')]);_0x5e6db7[_0xc81b('0x19')]=qs['offset'](_0x437b43['query'][_0xc81b('0x19')]);}return _0xc97b0d['getActions'](_0x5e6db7);}})[_0xc81b('0x22')](function(_0x3a14b1){if(_0x3a14b1){return _0x3a14b1?{'count':_0x2ef92c,'rows':_0x3a14b1}:null;}})[_0xc81b('0x22')](respondWithResult(_0x432f53,null))[_0xc81b('0x42')](handleError(_0x432f53,null));}; \ No newline at end of file +var _0x96e6=['then','get','Triggers','UserProfileResource','destroy','error','stack','name','send','Trigger','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','options','getAnyConditions','addAction','getActions','Action','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','apply','save'];(function(_0x1630f1,_0x2eba83){var _0x1531e6=function(_0x1d25ec){while(--_0x1d25ec){_0x1630f1['push'](_0x1630f1['shift']());}};_0x1531e6(++_0x2eba83);}(_0x96e6,0xf1));var _0x696e=function(_0x49a454,_0x2088f7){_0x49a454=_0x49a454-0x0;var _0x2f31d2=_0x96e6[_0x49a454];return _0x2f31d2;};'use strict';var emlformat=require(_0x696e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x696e('0x1'));var rp=require(_0x696e('0x2'));var moment=require(_0x696e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x696e('0x4'));var path=require(_0x696e('0x5'));var sox=require(_0x696e('0x6'));var csv=require(_0x696e('0x7'));var ejs=require(_0x696e('0x8'));var fs=require('fs');var fs_extra=require(_0x696e('0x9'));var _=require(_0x696e('0xa'));var squel=require('squel');var crypto=require(_0x696e('0xb'));var jsforce=require(_0x696e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x696e('0x7'));var querystring=require(_0x696e('0xd'));var Papa=require(_0x696e('0xe'));var Redis=require(_0x696e('0xf'));var authService=require(_0x696e('0x10'));var qs=require(_0x696e('0x11'));var as=require(_0x696e('0x12'));var hardwareService=require(_0x696e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x696e('0x14'));var config=require(_0x696e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x696e('0x16'))['db'];function respondWithStatusCode(_0x43a764,_0x112bc6){_0x112bc6=_0x112bc6||0xcc;return function(_0x2663d9){if(_0x2663d9){return _0x43a764[_0x696e('0x17')](_0x112bc6);}return _0x43a764['status'](_0x112bc6)[_0x696e('0x18')]();};}function respondWithResult(_0x3d19f6,_0x2ce901){_0x2ce901=_0x2ce901||0xc8;return function(_0x4101f6){if(_0x4101f6){return _0x3d19f6[_0x696e('0x19')](_0x2ce901)['json'](_0x4101f6);}};}function respondWithFilteredResult(_0x54f97c,_0x48953f){return function(_0x7114ae){if(_0x7114ae){var _0xec7ca8=typeof _0x48953f[_0x696e('0x1a')]===_0x696e('0x1b')&&typeof _0x48953f[_0x696e('0x1c')]==='undefined';var _0x350d76=_0x7114ae[_0x696e('0x1d')];var _0x2df931=_0xec7ca8?0x0:_0x48953f[_0x696e('0x1a')];var _0x2ef27a=_0xec7ca8?_0x7114ae[_0x696e('0x1d')]:_0x48953f[_0x696e('0x1a')]+_0x48953f[_0x696e('0x1c')];var _0x896cbd;if(_0x2ef27a>=_0x350d76){_0x2ef27a=_0x350d76;_0x896cbd=0xc8;}else{_0x896cbd=0xce;}_0x54f97c['status'](_0x896cbd);return _0x54f97c['set']('Content-Range',_0x2df931+'-'+_0x2ef27a+'/'+_0x350d76)['json'](_0x7114ae);}return null;};}function patchUpdates(_0x39af79){return function(_0x2856dd){try{jsonpatch[_0x696e('0x1e')](_0x2856dd,_0x39af79,!![]);}catch(_0x2f25ab){return BPromise['reject'](_0x2f25ab);}return _0x2856dd[_0x696e('0x1f')]();};}function saveUpdates(_0x198700,_0x1f3483){return function(_0x474ec4){if(_0x474ec4){return _0x474ec4['update'](_0x198700)[_0x696e('0x20')](function(_0x19e618){return _0x19e618;});}return null;};}function removeEntity(_0x10ba08,_0x7bfc2a){return function(_0x1be00d){if(_0x1be00d){return _0x1be00d['destroy']()[_0x696e('0x20')](function(){var _0x32410d=_0x1be00d[_0x696e('0x21')]({'plain':!![]});var _0x564ca0=_0x696e('0x22');return db[_0x696e('0x23')][_0x696e('0x24')]({'where':{'type':_0x564ca0,'resourceId':_0x32410d['id']}})[_0x696e('0x20')](function(){return _0x1be00d;});})[_0x696e('0x20')](function(){_0x10ba08['status'](0xcc)[_0x696e('0x18')]();});}};}function handleEntityNotFound(_0x11725c,_0x54ed58){return function(_0x45346f){if(!_0x45346f){_0x11725c[_0x696e('0x17')](0x194);}return _0x45346f;};}function handleError(_0x25d4f5,_0x1d3abd){_0x1d3abd=_0x1d3abd||0x1f4;return function(_0x4fb6ac){logger[_0x696e('0x25')](_0x4fb6ac[_0x696e('0x26')]);if(_0x4fb6ac[_0x696e('0x27')]){delete _0x4fb6ac['name'];}_0x25d4f5['status'](_0x1d3abd)[_0x696e('0x28')](_0x4fb6ac);};}exports['index']=function(_0x5b1cc0,_0xdf2ca9){var _0xf708e6={},_0x273bb9={},_0x214496={'count':0x0,'rows':[]};var _0x548c2e=_['map'](db[_0x696e('0x29')][_0x696e('0x2a')],function(_0x4ef60c){return{'name':_0x4ef60c[_0x696e('0x2b')],'type':_0x4ef60c['type'][_0x696e('0x2c')]};});_0x273bb9[_0x696e('0x2d')]=_[_0x696e('0x2e')](_0x548c2e,_0x696e('0x27'));_0x273bb9[_0x696e('0x2f')]=_['keys'](_0x5b1cc0['query']);_0x273bb9['filters']=_[_0x696e('0x30')](_0x273bb9[_0x696e('0x2d')],_0x273bb9[_0x696e('0x2f')]);_0xf708e6['attributes']=_['intersection'](_0x273bb9[_0x696e('0x2d')],qs[_0x696e('0x31')](_0x5b1cc0[_0x696e('0x2f')][_0x696e('0x31')]));_0xf708e6['attributes']=_0xf708e6[_0x696e('0x32')][_0x696e('0x33')]?_0xf708e6[_0x696e('0x32')]:_0x273bb9['model'];if(!_0x5b1cc0[_0x696e('0x2f')][_0x696e('0x34')](_0x696e('0x35'))){_0xf708e6[_0x696e('0x1c')]=qs[_0x696e('0x1c')](_0x5b1cc0['query'][_0x696e('0x1c')]);_0xf708e6[_0x696e('0x1a')]=qs[_0x696e('0x1a')](_0x5b1cc0[_0x696e('0x2f')][_0x696e('0x1a')]);}_0xf708e6[_0x696e('0x36')]=qs[_0x696e('0x37')](_0x5b1cc0[_0x696e('0x2f')]['sort']);_0xf708e6[_0x696e('0x38')]=qs[_0x696e('0x39')](_[_0x696e('0x3a')](_0x5b1cc0[_0x696e('0x2f')],_0x273bb9['filters']),_0x548c2e);if(_0x5b1cc0['query']['filter']){_0xf708e6[_0x696e('0x38')]=_[_0x696e('0x3b')](_0xf708e6[_0x696e('0x38')],{'$or':_[_0x696e('0x2e')](_0x548c2e,function(_0x26f2cf){if(_0x26f2cf[_0x696e('0x3c')]!==_0x696e('0x3d')){var _0x2bee71={};_0x2bee71[_0x26f2cf[_0x696e('0x27')]]={'$like':'%'+_0x5b1cc0['query'][_0x696e('0x3e')]+'%'};return _0x2bee71;}})});}_0xf708e6=_[_0x696e('0x3b')]({},_0xf708e6,_0x5b1cc0['options']);var _0x30069e={'where':_0xf708e6['where']};return db[_0x696e('0x29')][_0x696e('0x1d')](_0x30069e)['then'](function(_0x2f5eb8){_0x214496[_0x696e('0x1d')]=_0x2f5eb8;if(_0x5b1cc0[_0x696e('0x2f')][_0x696e('0x3f')]){_0xf708e6[_0x696e('0x40')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0xf708e6);})['then'](function(_0x4d91cf){_0x214496[_0x696e('0x41')]=_0x4d91cf;return _0x214496;})['then'](respondWithFilteredResult(_0xdf2ca9,_0xf708e6))[_0x696e('0x42')](handleError(_0xdf2ca9,null));};exports[_0x696e('0x43')]=function(_0x188aeb,_0xd52b9a){var _0x245e8c={'raw':![],'where':{'id':_0x188aeb[_0x696e('0x44')]['id']}},_0x1b8353={};_0x1b8353[_0x696e('0x2d')]=_[_0x696e('0x45')](db[_0x696e('0x29')][_0x696e('0x2a')]);_0x1b8353['query']=_['keys'](_0x188aeb['query']);_0x1b8353[_0x696e('0x39')]=_[_0x696e('0x30')](_0x1b8353[_0x696e('0x2d')],_0x1b8353[_0x696e('0x2f')]);_0x245e8c[_0x696e('0x32')]=_[_0x696e('0x30')](_0x1b8353['model'],qs['fields'](_0x188aeb[_0x696e('0x2f')][_0x696e('0x31')]));_0x245e8c['attributes']=_0x245e8c['attributes'][_0x696e('0x33')]?_0x245e8c[_0x696e('0x32')]:_0x1b8353[_0x696e('0x2d')];if(_0x188aeb['query'][_0x696e('0x3f')]){_0x245e8c[_0x696e('0x40')]=[{'all':!![]}];}_0x245e8c=_[_0x696e('0x3b')]({},_0x245e8c,_0x188aeb['options']);return db['Trigger'][_0x696e('0x46')](_0x245e8c)['then'](handleEntityNotFound(_0xd52b9a,null))['then'](respondWithResult(_0xd52b9a,null))['catch'](handleError(_0xd52b9a,null));};exports[_0x696e('0x47')]=function(_0x312f9e,_0x1fa01d){return db[_0x696e('0x29')]['create'](_0x312f9e[_0x696e('0x48')],{})['then'](function(_0xe54d67){var _0x537baf=_0x312f9e['user'][_0x696e('0x21')]({'plain':!![]});if(!_0x537baf)throw new Error(_0x696e('0x49'));if(_0x537baf[_0x696e('0x4a')]===_0x696e('0x4b')){var _0x433f20=_0xe54d67[_0x696e('0x21')]({'plain':!![]});var _0x50a762=_0x696e('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x50a762,'userProfileId':_0x537baf[_0x696e('0x4c')]},'raw':!![]})[_0x696e('0x20')](function(_0x18f32b){if(_0x18f32b&&_0x18f32b[_0x696e('0x4d')]===0x0){return db[_0x696e('0x23')][_0x696e('0x47')]({'name':_0x433f20['name'],'resourceId':_0x433f20['id'],'type':_0x18f32b[_0x696e('0x27')],'sectionId':_0x18f32b['id']},{})[_0x696e('0x20')](function(){return _0xe54d67;});}else{return _0xe54d67;}})[_0x696e('0x42')](function(_0x37fcb4){logger[_0x696e('0x25')](_0x696e('0x4e'),_0x37fcb4);throw _0x37fcb4;});}return _0xe54d67;})[_0x696e('0x20')](respondWithResult(_0x1fa01d,0xc9))['catch'](handleError(_0x1fa01d,null));};exports[_0x696e('0x4f')]=function(_0x5b8af2,_0x1108d5){if(_0x5b8af2[_0x696e('0x48')]['id']){delete _0x5b8af2[_0x696e('0x48')]['id'];}return db[_0x696e('0x29')]['find']({'where':{'id':_0x5b8af2[_0x696e('0x44')]['id']}})[_0x696e('0x20')](handleEntityNotFound(_0x1108d5,null))['then'](saveUpdates(_0x5b8af2[_0x696e('0x48')],null))['then'](respondWithResult(_0x1108d5,null))['catch'](handleError(_0x1108d5,null));};exports[_0x696e('0x24')]=function(_0x275bb3,_0x2043aa){return db[_0x696e('0x29')][_0x696e('0x46')]({'where':{'id':_0x275bb3[_0x696e('0x44')]['id']}})[_0x696e('0x20')](handleEntityNotFound(_0x2043aa,null))[_0x696e('0x20')](removeEntity(_0x2043aa,null))[_0x696e('0x42')](handleError(_0x2043aa,null));};exports[_0x696e('0x50')]=function(_0xfc4b02,_0x563e94,_0x5874ea){if(_0xfc4b02[_0x696e('0x48')]['id']){delete _0xfc4b02[_0x696e('0x48')]['id'];}return db[_0x696e('0x29')]['find']({'where':{'id':_0xfc4b02[_0x696e('0x44')]['id']}})['then'](handleEntityNotFound(_0x563e94,null))[_0x696e('0x20')](function(_0xbdcf08){if(_0xbdcf08){_0xfc4b02[_0x696e('0x48')][_0x696e('0x51')]=_0xbdcf08['id'];return db[_0x696e('0x52')][_0x696e('0x47')](_0xfc4b02[_0x696e('0x48')]);}})[_0x696e('0x20')](respondWithResult(_0x563e94,null))[_0x696e('0x42')](handleError(_0x563e94,null));};exports[_0x696e('0x53')]=function(_0x1a7534,_0x6f707c,_0x4ade6b){if(_0x1a7534[_0x696e('0x48')]['id']){delete _0x1a7534['body']['id'];}return db[_0x696e('0x29')][_0x696e('0x46')]({'where':{'id':_0x1a7534['params']['id']}})[_0x696e('0x20')](handleEntityNotFound(_0x6f707c,null))[_0x696e('0x20')](function(_0x1f1f96){if(_0x1f1f96){_0x1a7534[_0x696e('0x48')]['TriggerAnyId']=_0x1f1f96['id'];return db[_0x696e('0x52')][_0x696e('0x47')](_0x1a7534[_0x696e('0x48')]);}})[_0x696e('0x20')](respondWithResult(_0x6f707c,null))['catch'](handleError(_0x6f707c,null));};exports[_0x696e('0x54')]=function(_0x1eb921,_0x24667a,_0x592fa2){var _0x1624b6={};var _0x799f1e={};var _0x2f4c1e;var _0x3784ef;return db[_0x696e('0x29')][_0x696e('0x55')]({'where':{'id':_0x1eb921[_0x696e('0x44')]['id']}})['then'](handleEntityNotFound(_0x24667a,null))[_0x696e('0x20')](function(_0x1c68fa){if(_0x1c68fa){_0x2f4c1e=_0x1c68fa;_0x799f1e['model']=_[_0x696e('0x45')](db['Condition'][_0x696e('0x2a')]);_0x799f1e['query']=_['keys'](_0x1eb921[_0x696e('0x2f')]);_0x799f1e['filters']=_['intersection'](_0x799f1e[_0x696e('0x2d')],_0x799f1e[_0x696e('0x2f')]);_0x1624b6[_0x696e('0x32')]=_['intersection'](_0x799f1e[_0x696e('0x2d')],qs['fields'](_0x1eb921[_0x696e('0x2f')][_0x696e('0x31')]));_0x1624b6[_0x696e('0x32')]=_0x1624b6[_0x696e('0x32')][_0x696e('0x33')]?_0x1624b6[_0x696e('0x32')]:_0x799f1e[_0x696e('0x2d')];_0x1624b6['order']=qs[_0x696e('0x37')](_0x1eb921[_0x696e('0x2f')][_0x696e('0x37')]);_0x1624b6['where']=qs['filters'](_[_0x696e('0x3a')](_0x1eb921[_0x696e('0x2f')],_0x799f1e[_0x696e('0x39')]));if(_0x1eb921['query'][_0x696e('0x3e')]){_0x1624b6[_0x696e('0x38')]=_[_0x696e('0x3b')](_0x1624b6['where'],{'$or':_['map'](_0x1624b6[_0x696e('0x32')],function(_0x34885d){var _0x2ee8e2={};_0x2ee8e2[_0x34885d]={'$like':'%'+_0x1eb921[_0x696e('0x2f')]['filter']+'%'};return _0x2ee8e2;})});}_0x1624b6=_[_0x696e('0x3b')]({},_0x1624b6,_0x1eb921[_0x696e('0x56')]);return _0x2f4c1e[_0x696e('0x54')](_0x1624b6);}})[_0x696e('0x20')](function(_0x3124bc){if(_0x3124bc){_0x3784ef=_0x3124bc['length'];if(!_0x1eb921[_0x696e('0x2f')][_0x696e('0x34')](_0x696e('0x35'))){_0x1624b6[_0x696e('0x1c')]=qs['limit'](_0x1eb921[_0x696e('0x2f')][_0x696e('0x1c')]);_0x1624b6[_0x696e('0x1a')]=qs[_0x696e('0x1a')](_0x1eb921[_0x696e('0x2f')][_0x696e('0x1a')]);}return _0x2f4c1e[_0x696e('0x54')](_0x1624b6);}})[_0x696e('0x20')](function(_0x167497){if(_0x167497){return _0x167497?{'count':_0x3784ef,'rows':_0x167497}:null;}})[_0x696e('0x20')](respondWithResult(_0x24667a,null))[_0x696e('0x42')](handleError(_0x24667a,null));};exports[_0x696e('0x57')]=function(_0xd75c5c,_0x578bb4,_0x33710b){var _0xaccd43={};var _0x135911={};var _0x291328;var _0x29c0c2;return db[_0x696e('0x29')][_0x696e('0x55')]({'where':{'id':_0xd75c5c[_0x696e('0x44')]['id']}})[_0x696e('0x20')](handleEntityNotFound(_0x578bb4,null))[_0x696e('0x20')](function(_0x4c2674){if(_0x4c2674){_0x291328=_0x4c2674;_0x135911['model']=_[_0x696e('0x45')](db['Condition'][_0x696e('0x2a')]);_0x135911[_0x696e('0x2f')]=_[_0x696e('0x45')](_0xd75c5c[_0x696e('0x2f')]);_0x135911[_0x696e('0x39')]=_['intersection'](_0x135911[_0x696e('0x2d')],_0x135911['query']);_0xaccd43[_0x696e('0x32')]=_['intersection'](_0x135911['model'],qs[_0x696e('0x31')](_0xd75c5c[_0x696e('0x2f')][_0x696e('0x31')]));_0xaccd43['attributes']=_0xaccd43['attributes']['length']?_0xaccd43[_0x696e('0x32')]:_0x135911[_0x696e('0x2d')];_0xaccd43['order']=qs[_0x696e('0x37')](_0xd75c5c[_0x696e('0x2f')]['sort']);_0xaccd43[_0x696e('0x38')]=qs['filters'](_[_0x696e('0x3a')](_0xd75c5c['query'],_0x135911[_0x696e('0x39')]));if(_0xd75c5c['query'][_0x696e('0x3e')]){_0xaccd43[_0x696e('0x38')]=_[_0x696e('0x3b')](_0xaccd43[_0x696e('0x38')],{'$or':_[_0x696e('0x2e')](_0xaccd43[_0x696e('0x32')],function(_0x4f907d){var _0x4b034f={};_0x4b034f[_0x4f907d]={'$like':'%'+_0xd75c5c[_0x696e('0x2f')][_0x696e('0x3e')]+'%'};return _0x4b034f;})});}_0xaccd43=_[_0x696e('0x3b')]({},_0xaccd43,_0xd75c5c['options']);return _0x291328['getAnyConditions'](_0xaccd43);}})[_0x696e('0x20')](function(_0x28bc94){if(_0x28bc94){_0x29c0c2=_0x28bc94['length'];if(!_0xd75c5c[_0x696e('0x2f')]['hasOwnProperty'](_0x696e('0x35'))){_0xaccd43['limit']=qs[_0x696e('0x1c')](_0xd75c5c['query'][_0x696e('0x1c')]);_0xaccd43[_0x696e('0x1a')]=qs[_0x696e('0x1a')](_0xd75c5c[_0x696e('0x2f')][_0x696e('0x1a')]);}return _0x291328[_0x696e('0x57')](_0xaccd43);}})['then'](function(_0xa29aa2){if(_0xa29aa2){return _0xa29aa2?{'count':_0x29c0c2,'rows':_0xa29aa2}:null;}})['then'](respondWithResult(_0x578bb4,null))['catch'](handleError(_0x578bb4,null));};exports[_0x696e('0x58')]=function(_0x563fef,_0xbcda31,_0x3cb7df){if(_0x563fef[_0x696e('0x48')]['id']){delete _0x563fef[_0x696e('0x48')]['id'];}return db[_0x696e('0x29')][_0x696e('0x46')]({'where':{'id':_0x563fef['params']['id']}})[_0x696e('0x20')](handleEntityNotFound(_0xbcda31,null))['then'](function(_0x273219){if(_0x273219){_0x563fef['body']['TriggerId']=_0x273219['id'];return db['Action'][_0x696e('0x47')](_0x563fef[_0x696e('0x48')]);}})[_0x696e('0x20')](respondWithResult(_0xbcda31,null))[_0x696e('0x42')](handleError(_0xbcda31,null));};exports[_0x696e('0x59')]=function(_0x30a5c1,_0x6717dd,_0x9cd4ca){var _0xf1cfca={};var _0x3222c1={};var _0x3a82c6;var _0xe03617;return db[_0x696e('0x29')][_0x696e('0x55')]({'where':{'id':_0x30a5c1['params']['id']}})[_0x696e('0x20')](handleEntityNotFound(_0x6717dd,null))[_0x696e('0x20')](function(_0x1cac58){if(_0x1cac58){_0x3a82c6=_0x1cac58;_0x3222c1[_0x696e('0x2d')]=_[_0x696e('0x45')](db[_0x696e('0x5a')][_0x696e('0x2a')]);_0x3222c1[_0x696e('0x2f')]=_[_0x696e('0x45')](_0x30a5c1[_0x696e('0x2f')]);_0x3222c1['filters']=_[_0x696e('0x30')](_0x3222c1[_0x696e('0x2d')],_0x3222c1[_0x696e('0x2f')]);_0xf1cfca['attributes']=_['intersection'](_0x3222c1['model'],qs[_0x696e('0x31')](_0x30a5c1['query'][_0x696e('0x31')]));_0xf1cfca[_0x696e('0x32')]=_0xf1cfca['attributes']['length']?_0xf1cfca['attributes']:_0x3222c1[_0x696e('0x2d')];_0xf1cfca['order']=qs[_0x696e('0x37')](_0x30a5c1[_0x696e('0x2f')][_0x696e('0x37')]);_0xf1cfca[_0x696e('0x38')]=qs[_0x696e('0x39')](_[_0x696e('0x3a')](_0x30a5c1[_0x696e('0x2f')],_0x3222c1['filters']));if(_0x30a5c1[_0x696e('0x2f')][_0x696e('0x3e')]){_0xf1cfca[_0x696e('0x38')]=_[_0x696e('0x3b')](_0xf1cfca[_0x696e('0x38')],{'$or':_[_0x696e('0x2e')](_0xf1cfca[_0x696e('0x32')],function(_0x374033){var _0x955399={};_0x955399[_0x374033]={'$like':'%'+_0x30a5c1[_0x696e('0x2f')][_0x696e('0x3e')]+'%'};return _0x955399;})});}_0xf1cfca=_[_0x696e('0x3b')]({},_0xf1cfca,_0x30a5c1[_0x696e('0x56')]);return _0x3a82c6[_0x696e('0x59')](_0xf1cfca);}})[_0x696e('0x20')](function(_0x36a4dd){if(_0x36a4dd){_0xe03617=_0x36a4dd[_0x696e('0x33')];if(!_0x30a5c1[_0x696e('0x2f')][_0x696e('0x34')](_0x696e('0x35'))){_0xf1cfca[_0x696e('0x1c')]=qs[_0x696e('0x1c')](_0x30a5c1[_0x696e('0x2f')][_0x696e('0x1c')]);_0xf1cfca[_0x696e('0x1a')]=qs['offset'](_0x30a5c1[_0x696e('0x2f')][_0x696e('0x1a')]);}return _0x3a82c6['getActions'](_0xf1cfca);}})[_0x696e('0x20')](function(_0x4e923d){if(_0x4e923d){return _0x4e923d?{'count':_0xe03617,'rows':_0x4e923d}:null;}})['then'](respondWithResult(_0x6717dd,null))['catch'](handleError(_0x6717dd,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 15f06d4..de01a8a 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 _0xc997=['bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers','util','../../config/logger','api','moment'];(function(_0xe62262,_0x14f742){var _0x18b029=function(_0xd87ac1){while(--_0xd87ac1){_0xe62262['push'](_0xe62262['shift']());}};_0x18b029(++_0x14f742);}(_0xc997,0x1ac));var _0x7c99=function(_0x902d0f,_0x3929ab){_0x902d0f=_0x902d0f-0x0;var _0x339b27=_0xc997[_0x902d0f];return _0x339b27;};'use strict';var _=require('lodash');var util=require(_0x7c99('0x0'));var logger=require(_0x7c99('0x1'))(_0x7c99('0x2'));var moment=require(_0x7c99('0x3'));var BPromise=require(_0x7c99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c99('0x5'));var rimraf=require(_0x7c99('0x6'));var config=require(_0x7c99('0x7'));var attributes=require(_0x7c99('0x8'));module[_0x7c99('0x9')]=function(_0x404ffb,_0x1a21e1){return _0x404ffb[_0x7c99('0xa')]('Trigger',attributes,{'tableName':_0x7c99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45ea=['./trigger.attributes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xaa7f3f,_0x3b18f8){var _0x3733ba=function(_0x1256c1){while(--_0x1256c1){_0xaa7f3f['push'](_0xaa7f3f['shift']());}};_0x3733ba(++_0x3b18f8);}(_0x45ea,0x1f0));var _0xa45e=function(_0x3aea81,_0x9751c0){_0x3aea81=_0x3aea81-0x0;var _0x5d2956=_0x45ea[_0x3aea81];return _0x5d2956;};'use strict';var _=require(_0xa45e('0x0'));var util=require(_0xa45e('0x1'));var logger=require(_0xa45e('0x2'))(_0xa45e('0x3'));var moment=require(_0xa45e('0x4'));var BPromise=require(_0xa45e('0x5'));var rp=require(_0xa45e('0x6'));var fs=require('fs');var path=require(_0xa45e('0x7'));var rimraf=require(_0xa45e('0x8'));var config=require(_0xa45e('0x9'));var attributes=require(_0xa45e('0xa'));module['exports']=function(_0x418a41,_0x3ee60d){return _0x418a41['define']('Trigger',attributes,{'tableName':'tools_triggers','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 ef65490..f153708 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 _0x84af=['where','include','model','attributes','map','info','catch','ShowTrigger','find','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetTrigger','Trigger','findAll','options'];(function(_0x33305a,_0x3ef421){var _0x47c2c4=function(_0x9cd1e2){while(--_0x9cd1e2){_0x33305a['push'](_0x33305a['shift']());}};_0x47c2c4(++_0x3ef421);}(_0x84af,0x117));var _0xf84a=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x84af[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xf84a('0x0'));var util=require('util');var moment=require(_0xf84a('0x1'));var BPromise=require(_0xf84a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf84a('0x3'))['db'];var utils=require(_0xf84a('0x4'));var logger=require(_0xf84a('0x5'))('rpc');var config=require(_0xf84a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf84a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x483da3,_0x6d4e84,_0xefb8cd){return new BPromise(function(_0x145d96,_0x3c9f54){return client[_0xf84a('0x8')](_0x483da3,_0xefb8cd)[_0xf84a('0x9')](function(_0x3b04e0){logger['info'](_0xf84a('0xa'),_0x6d4e84,'request\x20sent');logger[_0xf84a('0xb')](_0xf84a('0xc'),_0x6d4e84,_0xf84a('0xd'),JSON[_0xf84a('0xe')](_0x3b04e0));if(_0x3b04e0['error']){if(_0x3b04e0[_0xf84a('0xf')]['code']===0x1f4){logger[_0xf84a('0xf')](_0xf84a('0xa'),_0x6d4e84,_0x3b04e0[_0xf84a('0xf')][_0xf84a('0x10')]);return _0x3c9f54(_0x3b04e0['error'][_0xf84a('0x10')]);}logger[_0xf84a('0xf')](_0xf84a('0xa'),_0x6d4e84,_0x3b04e0[_0xf84a('0xf')][_0xf84a('0x10')]);return _0x145d96(_0x3b04e0['error'][_0xf84a('0x10')]);}else{logger['info'](_0xf84a('0xa'),_0x6d4e84,_0xf84a('0xd'));_0x145d96(_0x3b04e0['result']['message']);}})['catch'](function(_0x283381){logger[_0xf84a('0xf')]('Trigger,\x20%s,\x20%s',_0x6d4e84,_0x283381);_0x3c9f54(_0x283381);});});}exports[_0xf84a('0x11')]=function(_0x269bb3){var _0x1c56e8=this;return new Promise(function(_0x122aef,_0x348784){return db[_0xf84a('0x12')][_0xf84a('0x13')]({'raw':_0x269bb3[_0xf84a('0x14')]?_0x269bb3[_0xf84a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x269bb3[_0xf84a('0x14')]?_0x269bb3[_0xf84a('0x14')][_0xf84a('0x15')]||null:null,'attributes':_0x269bb3[_0xf84a('0x14')]?_0x269bb3[_0xf84a('0x14')]['attributes']||null:null,'limit':_0x269bb3[_0xf84a('0x14')]?_0x269bb3[_0xf84a('0x14')]['limit']||null:null,'include':_0x269bb3[_0xf84a('0x14')]?_0x269bb3[_0xf84a('0x14')][_0xf84a('0x16')]?_['map'](_0x269bb3[_0xf84a('0x14')][_0xf84a('0x16')],function(_0x12d828){return{'model':db[_0x12d828[_0xf84a('0x17')]],'as':_0x12d828['as'],'attributes':_0x12d828[_0xf84a('0x18')],'include':_0x12d828[_0xf84a('0x16')]?_[_0xf84a('0x19')](_0x12d828[_0xf84a('0x16')],function(_0x42b3b7){return{'model':db[_0x42b3b7[_0xf84a('0x17')]],'as':_0x42b3b7['as'],'attributes':_0x42b3b7[_0xf84a('0x18')],'include':_0x42b3b7[_0xf84a('0x16')]?_[_0xf84a('0x19')](_0x42b3b7[_0xf84a('0x16')],function(_0x75f02c){return{'model':db[_0x75f02c['model']],'as':_0x75f02c['as'],'attributes':_0x75f02c[_0xf84a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf84a('0x9')](function(_0x1d2037){logger[_0xf84a('0x1a')]('GetTrigger',_0x269bb3);logger['debug'](_0xf84a('0x11'),_0x269bb3,JSON['stringify'](_0x1d2037));_0x122aef(_0x1d2037);})[_0xf84a('0x1b')](function(_0x3a9a70){logger['error'](_0xf84a('0x11'),_0x3a9a70['message'],_0x269bb3);_0x348784(_0x1c56e8[_0xf84a('0xf')](0x1f4,_0x3a9a70[_0xf84a('0x10')]));});});};exports[_0xf84a('0x1c')]=function(_0x36b211){var _0x17bd6f=this;return new Promise(function(_0xa5eb12,_0x4628d5){return db[_0xf84a('0x12')][_0xf84a('0x1d')]({'raw':_0x36b211[_0xf84a('0x14')]?_0x36b211[_0xf84a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x36b211[_0xf84a('0x14')]?_0x36b211[_0xf84a('0x14')][_0xf84a('0x15')]||null:null,'attributes':_0x36b211[_0xf84a('0x14')]?_0x36b211[_0xf84a('0x14')]['attributes']||null:null,'include':_0x36b211[_0xf84a('0x14')]?_0x36b211[_0xf84a('0x14')][_0xf84a('0x16')]?_[_0xf84a('0x19')](_0x36b211['options'][_0xf84a('0x16')],function(_0x10aae4){return{'model':db[_0x10aae4['model']],'as':_0x10aae4['as'],'attributes':_0x10aae4[_0xf84a('0x18')],'include':_0x10aae4['include']?_['map'](_0x10aae4[_0xf84a('0x16')],function(_0x58d65e){return{'model':db[_0x58d65e[_0xf84a('0x17')]],'as':_0x58d65e['as'],'attributes':_0x58d65e[_0xf84a('0x18')],'include':_0x58d65e[_0xf84a('0x16')]?_[_0xf84a('0x19')](_0x58d65e['include'],function(_0x138b3d){return{'model':db[_0x138b3d[_0xf84a('0x17')]],'as':_0x138b3d['as'],'attributes':_0x138b3d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf84a('0x9')](function(_0x16470a){logger['info'](_0xf84a('0x1c'),_0x36b211);logger['debug'](_0xf84a('0x1c'),_0x36b211,JSON['stringify'](_0x16470a));_0xa5eb12(_0x16470a);})[_0xf84a('0x1b')](function(_0x270265){logger[_0xf84a('0xf')]('ShowTrigger',_0x270265[_0xf84a('0x10')],_0x36b211);_0x4628d5(_0x17bd6f['error'](0x1f4,_0x270265[_0xf84a('0x10')]));});});}; \ No newline at end of file +var _0xe507=['message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowTrigger','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xe507,0xe7));var _0x7e50=function(_0x168478,_0x323a27){_0x168478=_0x168478-0x0;var _0x29c2f8=_0xe507[_0x168478];return _0x29c2f8;};'use strict';var _=require(_0x7e50('0x0'));var util=require('util');var moment=require(_0x7e50('0x1'));var BPromise=require(_0x7e50('0x2'));var rs=require(_0x7e50('0x3'));var fs=require('fs');var Redis=require(_0x7e50('0x4'));var db=require(_0x7e50('0x5'))['db'];var utils=require(_0x7e50('0x6'));var logger=require(_0x7e50('0x7'))(_0x7e50('0x8'));var config=require(_0x7e50('0x9'));var jayson=require(_0x7e50('0xa'));var client=jayson[_0x7e50('0xb')][_0x7e50('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a1def,_0x2105f4,_0x7a3f4e){return new BPromise(function(_0x34ee8c,_0x5ee1b1){return client['request'](_0x5a1def,_0x7a3f4e)[_0x7e50('0xd')](function(_0x5ef2a2){logger[_0x7e50('0xe')](_0x7e50('0xf'),_0x2105f4,_0x7e50('0x10'));logger[_0x7e50('0x11')](_0x7e50('0x12'),_0x2105f4,_0x7e50('0x10'),JSON[_0x7e50('0x13')](_0x5ef2a2));if(_0x5ef2a2['error']){if(_0x5ef2a2[_0x7e50('0x14')]['code']===0x1f4){logger['error'](_0x7e50('0xf'),_0x2105f4,_0x5ef2a2[_0x7e50('0x14')][_0x7e50('0x15')]);return _0x5ee1b1(_0x5ef2a2[_0x7e50('0x14')][_0x7e50('0x15')]);}logger[_0x7e50('0x14')](_0x7e50('0xf'),_0x2105f4,_0x5ef2a2[_0x7e50('0x14')][_0x7e50('0x15')]);return _0x34ee8c(_0x5ef2a2[_0x7e50('0x14')][_0x7e50('0x15')]);}else{logger[_0x7e50('0xe')](_0x7e50('0xf'),_0x2105f4,_0x7e50('0x10'));_0x34ee8c(_0x5ef2a2[_0x7e50('0x16')][_0x7e50('0x15')]);}})['catch'](function(_0x46580d){logger['error'](_0x7e50('0xf'),_0x2105f4,_0x46580d);_0x5ee1b1(_0x46580d);});});}exports[_0x7e50('0x17')]=function(_0x37daaa){var _0x147197=this;return new Promise(function(_0x1f0711,_0x1bd9f6){return db[_0x7e50('0x18')][_0x7e50('0x19')]({'raw':_0x37daaa[_0x7e50('0x1a')]?_0x37daaa[_0x7e50('0x1a')][_0x7e50('0x1b')]===undefined?!![]:![]:!![],'where':_0x37daaa[_0x7e50('0x1a')]?_0x37daaa[_0x7e50('0x1a')][_0x7e50('0x1c')]||null:null,'attributes':_0x37daaa['options']?_0x37daaa[_0x7e50('0x1a')][_0x7e50('0x1d')]||null:null,'limit':_0x37daaa['options']?_0x37daaa['options'][_0x7e50('0x1e')]||null:null,'include':_0x37daaa[_0x7e50('0x1a')]?_0x37daaa[_0x7e50('0x1a')]['include']?_[_0x7e50('0x1f')](_0x37daaa[_0x7e50('0x1a')]['include'],function(_0x307f69){return{'model':db[_0x307f69['model']],'as':_0x307f69['as'],'attributes':_0x307f69['attributes'],'include':_0x307f69[_0x7e50('0x20')]?_['map'](_0x307f69['include'],function(_0x373db2){return{'model':db[_0x373db2[_0x7e50('0x21')]],'as':_0x373db2['as'],'attributes':_0x373db2[_0x7e50('0x1d')],'include':_0x373db2[_0x7e50('0x20')]?_[_0x7e50('0x1f')](_0x373db2[_0x7e50('0x20')],function(_0x185caf){return{'model':db[_0x185caf[_0x7e50('0x21')]],'as':_0x185caf['as'],'attributes':_0x185caf[_0x7e50('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39b77e){logger['info']('GetTrigger',_0x37daaa);logger['debug'](_0x7e50('0x17'),_0x37daaa,JSON[_0x7e50('0x13')](_0x39b77e));_0x1f0711(_0x39b77e);})[_0x7e50('0x22')](function(_0x71af51){logger[_0x7e50('0x14')](_0x7e50('0x17'),_0x71af51[_0x7e50('0x15')],_0x37daaa);_0x1bd9f6(_0x147197['error'](0x1f4,_0x71af51[_0x7e50('0x15')]));});});};exports['ShowTrigger']=function(_0x170a8b){var _0x3212e6=this;return new Promise(function(_0x3c8322,_0x125742){return db[_0x7e50('0x18')]['find']({'raw':_0x170a8b[_0x7e50('0x1a')]?_0x170a8b[_0x7e50('0x1a')][_0x7e50('0x1b')]===undefined?!![]:![]:!![],'where':_0x170a8b[_0x7e50('0x1a')]?_0x170a8b[_0x7e50('0x1a')][_0x7e50('0x1c')]||null:null,'attributes':_0x170a8b[_0x7e50('0x1a')]?_0x170a8b['options']['attributes']||null:null,'include':_0x170a8b[_0x7e50('0x1a')]?_0x170a8b['options'][_0x7e50('0x20')]?_[_0x7e50('0x1f')](_0x170a8b[_0x7e50('0x1a')][_0x7e50('0x20')],function(_0x4b0519){return{'model':db[_0x4b0519[_0x7e50('0x21')]],'as':_0x4b0519['as'],'attributes':_0x4b0519[_0x7e50('0x1d')],'include':_0x4b0519[_0x7e50('0x20')]?_['map'](_0x4b0519['include'],function(_0xa1ac94){return{'model':db[_0xa1ac94[_0x7e50('0x21')]],'as':_0xa1ac94['as'],'attributes':_0xa1ac94[_0x7e50('0x1d')],'include':_0xa1ac94[_0x7e50('0x20')]?_[_0x7e50('0x1f')](_0xa1ac94[_0x7e50('0x20')],function(_0x8de204){return{'model':db[_0x8de204[_0x7e50('0x21')]],'as':_0x8de204['as'],'attributes':_0x8de204[_0x7e50('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53a4d8){logger[_0x7e50('0xe')](_0x7e50('0x23'),_0x170a8b);logger[_0x7e50('0x11')](_0x7e50('0x23'),_0x170a8b,JSON['stringify'](_0x53a4d8));_0x3c8322(_0x53a4d8);})[_0x7e50('0x22')](function(_0x4cd447){logger[_0x7e50('0x14')](_0x7e50('0x23'),_0x4cd447['message'],_0x170a8b);_0x125742(_0x3212e6[_0x7e50('0x14')](0x1f4,_0x4cd447[_0x7e50('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index d320b3c..a8214bd 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 _0x6a95=['/:id','show','post','clone','create','put','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1fccec,_0x48c67f){var _0x5b98b5=function(_0x1f788b){while(--_0x1f788b){_0x1fccec['push'](_0x1fccec['shift']());}};_0x5b98b5(++_0x48c67f);}(_0x6a95,0x117));var _0x56a9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6a95[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x56a9('0x0'));var util=require('util');var path=require(_0x56a9('0x1'));var timeout=require('connect-timeout');var express=require(_0x56a9('0x2'));var router=express['Router']();var fs_extra=require(_0x56a9('0x3'));var auth=require(_0x56a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x56a9('0x5'));var controller=require('./trunk.controller');router[_0x56a9('0x6')]('/',auth[_0x56a9('0x7')](),controller[_0x56a9('0x8')]);router['get'](_0x56a9('0x9'),auth[_0x56a9('0x7')](),controller[_0x56a9('0xa')]);router[_0x56a9('0xb')]('/:id/clone',auth[_0x56a9('0x7')](),controller[_0x56a9('0xc')]);router[_0x56a9('0xb')]('/',auth[_0x56a9('0x7')](),controller[_0x56a9('0xd')]);router[_0x56a9('0xe')]('/:id',auth[_0x56a9('0x7')](),controller['update']);router[_0x56a9('0xf')](_0x56a9('0x9'),auth[_0x56a9('0x7')](),controller[_0x56a9('0x10')]);module[_0x56a9('0x11')]=router; \ No newline at end of file +var _0x800e=['index','/:id','show','/:id/clone','clone','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x800e,0x16a));var _0xe800=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x800e[_0x179e11];return _0x549f04;};'use strict';var multer=require('multer');var util=require(_0xe800('0x0'));var path=require(_0xe800('0x1'));var timeout=require(_0xe800('0x2'));var express=require(_0xe800('0x3'));var router=express[_0xe800('0x4')]();var fs_extra=require(_0xe800('0x5'));var auth=require(_0xe800('0x6'));var interaction=require(_0xe800('0x7'));var config=require(_0xe800('0x8'));var controller=require(_0xe800('0x9'));router[_0xe800('0xa')]('/',auth[_0xe800('0xb')](),controller[_0xe800('0xc')]);router[_0xe800('0xa')](_0xe800('0xd'),auth['isAuthenticated'](),controller[_0xe800('0xe')]);router['post'](_0xe800('0xf'),auth['isAuthenticated'](),controller[_0xe800('0x10')]);router[_0xe800('0x11')]('/',auth[_0xe800('0xb')](),controller['create']);router['put'](_0xe800('0xd'),auth[_0xe800('0xb')](),controller[_0xe800('0x12')]);router[_0xe800('0x13')](_0xe800('0xd'),auth['isAuthenticated'](),controller[_0xe800('0x14')]);module[_0xe800('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 3f6216a..38ae92a 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 _0x089f=['BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','outgoing','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uas','pai','active','passive','actpass'];(function(_0x620cbe,_0x193075){var _0x30ad91=function(_0x1478cc){while(--_0x1478cc){_0x620cbe['push'](_0x620cbe['shift']());}};_0x30ad91(++_0x193075);}(_0x089f,0x67));var _0xf089=function(_0x36722c,_0x11220e){_0x36722c=_0x36722c-0x0;var _0xa07433=_0x089f[_0x36722c];return _0xa07433;};'use strict';var Sequelize=require(_0xf089('0x0'));module[_0xf089('0x1')]={'name':{'type':Sequelize[_0xf089('0x2')],'allowNull':![],'unique':_0xf089('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf089('0x4'),_0xf089('0x5'),_0xf089('0x6')),'allowNull':![],'defaultValue':_0xf089('0x4')},'context':{'type':Sequelize[_0xf089('0x2')],'allowNull':![],'defaultValue':_0xf089('0x7')},'callingpres':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x9'),_0xf089('0xa'),_0xf089('0xb'),_0xf089('0xc'),'PROHIB_NOT_SCREENED',_0xf089('0xd'),'PROHIB_FAILED_SCREEN',_0xf089('0xe'))},'deny':{'type':Sequelize[_0xf089('0x2')]},'permit':{'type':Sequelize[_0xf089('0x2')]},'secret':{'type':Sequelize[_0xf089('0x2')]},'md5secret':{'type':Sequelize[_0xf089('0x2')]},'remotesecret':{'type':Sequelize[_0xf089('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xf089('0xf'),'set':function(_0x2bbdb9){this[_0xf089('0x10')](_0xf089('0x11'),_0x2bbdb9?_0x2bbdb9['join'](','):null);},'get':function(){return this['getDataValue'](_0xf089('0x11'))?this[_0xf089('0x12')](_0xf089('0x11'))[_0xf089('0x13')](','):null;},'comment':_0xf089('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0xf089('0x15'),_0xf089('0x16'),_0xf089('0x17'),'inband',_0xf089('0x18')),'defaultValue':_0xf089('0x15')},'directmedia':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no',_0xf089('0x1a'),_0xf089('0x1b'),_0xf089('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf089('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xf089('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x21b241){this['setDataValue'](_0xf089('0x1d'),_0x21b241?_0x21b241[_0xf089('0x1e')](','):null);},'get':function(){return this[_0xf089('0x12')]('nat')?this['getDataValue'](_0xf089('0x1d'))['split'](','):null;},'comment':_0xf089('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xf089('0x2')]},'pickupgroup':{'type':Sequelize[_0xf089('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf089('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf089('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf089('0x2')],'defaultValue':_0xf089('0x20')},'allow':{'type':Sequelize[_0xf089('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x16d055){this['setDataValue']('allow',_0x16d055?_0x16d055[_0xf089('0x1e')](';'):_0xf089('0x21'));},'get':function(){return this[_0xf089('0x12')](_0xf089('0x22'))?this[_0xf089('0x12')]('allow')['split'](';'):null;},'comment':_0xf089('0x23')},'autoframing':{'type':Sequelize['ENUM'](_0xf089('0x19'),'no')},'insecure':{'type':Sequelize[_0xf089('0x2')],'defaultValue':_0xf089('0x24'),'set':function(_0x291811){this[_0xf089('0x10')](_0xf089('0x25'),_0x291811?_0x291811['join'](','):null);},'get':function(){return this[_0xf089('0x12')](_0xf089('0x25'))?this[_0xf089('0x12')]('insecure')[_0xf089('0x13')](','):null;},'comment':_0xf089('0x26')},'trustrpid':{'type':Sequelize[_0xf089('0x8')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xf089('0x19'),'no',_0xf089('0x27'))},'promiscredir':{'type':Sequelize['ENUM'](_0xf089('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'accountcode':{'type':Sequelize[_0xf089('0x28')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf089('0x2')],'defaultValue':_0xf089('0x29')},'amaflags':{'type':Sequelize[_0xf089('0x2')]},'callcounter':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no'),'defaultValue':_0xf089('0x19')},'busylevel':{'type':Sequelize[_0xf089('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xf089('0x2')]},'template':{'type':Sequelize[_0xf089('0x2')]},'videosupport':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no',_0xf089('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf089('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x2b'),'refuse',_0xf089('0x2c'))},'session_expires':{'type':Sequelize[_0xf089('0x28')](0xb)},'session_minse':{'type':Sequelize[_0xf089('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0xf089('0x8')]('uac','uas'),'defaultValue':_0xf089('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0xf089('0x2')]},'regexten':{'type':Sequelize[_0xf089('0x2')]},'fromdomain':{'type':Sequelize[_0xf089('0x2')]},'fromuser':{'type':Sequelize[_0xf089('0x2')]},'port':{'type':Sequelize[_0xf089('0x28')](0x5)},'qualify':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no'),'defaultValue':_0xf089('0x19')},'keepalive':{'type':Sequelize[_0xf089('0x28')](0xb)},'defaultip':{'type':Sequelize[_0xf089('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xf089('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no',_0xf089('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf089('0x2')]},'callbackextension':{'type':Sequelize[_0xf089('0x2')]},'timert1':{'type':Sequelize[_0xf089('0x28')](0xb)},'timerb':{'type':Sequelize[_0xf089('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf089('0x28')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf089('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xf089('0x2')]},'use_q850_reason':{'type':Sequelize[_0xf089('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf089('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'force_avp':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'icesupport':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xf089('0x28')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xf089('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xf089('0x2')]},'dtlssetup':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x2f'),_0xf089('0x30'),_0xf089('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf089('0x2')]},'usereqphone':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xf089('0x2')]},'call_limit':{'type':Sequelize[_0xf089('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'vmexten':{'type':Sequelize[_0xf089('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf089('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no','nonat',_0xf089('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xf089('0x2')]},'active':{'type':Sequelize[_0xf089('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf089('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xa944=['transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB','udp','setDataValue','join'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa944,0x123));var _0x4a94=function(_0x524a62,_0x2f6a71){_0x524a62=_0x524a62-0x0;var _0x26e211=_0xa944[_0x524a62];return _0x26e211;};'use strict';var Sequelize=require(_0x4a94('0x0'));module[_0x4a94('0x1')]={'name':{'type':Sequelize[_0x4a94('0x2')],'allowNull':![],'unique':_0x4a94('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x5'),_0x4a94('0x6'),_0x4a94('0x7')),'allowNull':![],'defaultValue':_0x4a94('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4a94('0x8')},'callingpres':{'type':Sequelize[_0x4a94('0x4')]('ALLOWED_NOT_SCREENED',_0x4a94('0x9'),'ALLOWED_FAILED_SCREEN',_0x4a94('0xa'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x4a94('0xb'))},'deny':{'type':Sequelize[_0x4a94('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x4a94('0x2')]},'md5secret':{'type':Sequelize[_0x4a94('0x2')]},'remotesecret':{'type':Sequelize[_0x4a94('0x2')]},'transport':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0xc'),'set':function(_0x570bf1){this[_0x4a94('0xd')]('transport',_0x570bf1?_0x570bf1[_0x4a94('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x4a94('0xf'))?this[_0x4a94('0x10')](_0x4a94('0xf'))[_0x4a94('0x11')](','):null;},'comment':_0x4a94('0x12')},'dtmfmode':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x13'),_0x4a94('0x14'),_0x4a94('0x15'),_0x4a94('0x16'),'auto'),'defaultValue':_0x4a94('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no','nonat',_0x4a94('0x18'),_0x4a94('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4a94('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4a94('0x2')]},'directmediadeny':{'type':Sequelize[_0x4a94('0x2')]},'nat':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0x1a'),'set':function(_0x371fc7){this[_0x4a94('0xd')](_0x4a94('0x1b'),_0x371fc7?_0x371fc7['join'](','):null);},'get':function(){return this[_0x4a94('0x10')](_0x4a94('0x1b'))?this['getDataValue'](_0x4a94('0x1b'))[_0x4a94('0x11')](','):null;},'comment':_0x4a94('0x1c')},'callgroup':{'type':Sequelize[_0x4a94('0x2')]},'namedcallgroup':{'type':Sequelize[_0x4a94('0x2')]},'pickupgroup':{'type':Sequelize[_0x4a94('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x4a94('0x2')]},'language':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4a94('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0x1d')},'allow':{'type':Sequelize[_0x4a94('0x2')],'allowNull':![],'defaultValue':_0x4a94('0x1e'),'set':function(_0x56ff7c){this[_0x4a94('0xd')](_0x4a94('0x1f'),_0x56ff7c?_0x56ff7c[_0x4a94('0xe')](';'):_0x4a94('0x1e'));},'get':function(){return this[_0x4a94('0x10')](_0x4a94('0x1f'))?this[_0x4a94('0x10')]('allow')[_0x4a94('0x11')](';'):null;},'comment':_0x4a94('0x20')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0x21'),'set':function(_0x2b5542){this['setDataValue'](_0x4a94('0x22'),_0x2b5542?_0x2b5542[_0x4a94('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x4a94('0x22'))?this[_0x4a94('0x10')](_0x4a94('0x22'))[_0x4a94('0x11')](','):null;},'comment':_0x4a94('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4a94('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no',_0x4a94('0x24'))},'promiscredir':{'type':Sequelize[_0x4a94('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'accountcode':{'type':Sequelize[_0x4a94('0x25')](0xb)},'setvar':{'type':Sequelize[_0x4a94('0x2')]},'callerid':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0x26')},'amaflags':{'type':Sequelize[_0x4a94('0x2')]},'callcounter':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x4a94('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x4a94('0x2')]},'template':{'type':Sequelize[_0x4a94('0x2')]},'videosupport':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4a94('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4a94('0x4')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x4a94('0x4')]('accept','refuse','originate')},'session_expires':{'type':Sequelize[_0x4a94('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x4a94('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x4a94('0x27'),'uas'),'defaultValue':_0x4a94('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x4a94('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x4a94('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no'),'defaultValue':_0x4a94('0x17')},'keepalive':{'type':Sequelize[_0x4a94('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x4a94('0x2')]},'defaultuser':{'type':Sequelize[_0x4a94('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4a94('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no',_0x4a94('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4a94('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x4a94('0x25')](0xb)},'timerb':{'type':Sequelize[_0x4a94('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x4a94('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x4a94('0x2')]},'contactdeny':{'type':Sequelize[_0x4a94('0x2')]},'contactacl':{'type':Sequelize[_0x4a94('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x4a94('0x2')]},'use_q850_reason':{'type':Sequelize[_0x4a94('0x2')]},'maxforwards':{'type':Sequelize[_0x4a94('0x25')](0xb)},'encryption':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'force_avp':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'icesupport':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x4a94('0x4')]('yes','no',_0x4a94('0x2a'),_0x4a94('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x4a94('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x4a94('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x4a94('0x2')]},'dtlscafile':{'type':Sequelize[_0x4a94('0x2')]},'dtlscapath':{'type':Sequelize[_0x4a94('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x4a94('0x2c'),_0x4a94('0x2d'),_0x4a94('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4a94('0x2')]},'usereqphone':{'type':Sequelize[_0x4a94('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4a94('0x2')]},'recordofffeature':{'type':Sequelize[_0x4a94('0x2')]},'call_limit':{'type':Sequelize[_0x4a94('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'vmexten':{'type':Sequelize[_0x4a94('0x2')]},'mohinterpret':{'type':Sequelize[_0x4a94('0x2')]},'mohsuggest':{'type':Sequelize[_0x4a94('0x2')]},'parkinglot':{'type':Sequelize[_0x4a94('0x2')]},'description':{'type':Sequelize[_0x4a94('0x2')]},'host':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0x2f')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x4a94('0x30'),_0x4a94('0x18'),_0x4a94('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4a94('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4a94('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 78a7de2..4c8f560 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 _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0x519ebe,_0x26fb6e){var _0x1eb815=function(_0x2fb645){while(--_0x2fb645){_0x519ebe['push'](_0x519ebe['shift']());}};_0x1eb815(++_0x26fb6e);}(_0x9a19,0x114));var _0x99a1=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x9a19[_0x16bb4b];return _0x8aeb84;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file +var _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x2fe58e,_0x422dfc){var _0x29dc09=function(_0x19cf93){while(--_0x19cf93){_0x2fe58e['push'](_0x2fe58e['shift']());}};_0x29dc09(++_0x422dfc);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 6ee9793..1a78686 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 _0x00f0=['exports','define','tools_trunks','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x3d8e70,_0x551cbf){var _0x168f81=function(_0x44968b){while(--_0x44968b){_0x3d8e70['push'](_0x3d8e70['shift']());}};_0x168f81(++_0x551cbf);}(_0x00f0,0x1c6));var _0x000f=function(_0x490117,_0x5e3b9d){_0x490117=_0x490117-0x0;var _0x55713c=_0x00f0[_0x490117];return _0x55713c;};'use strict';var _=require(_0x000f('0x0'));var util=require('util');var logger=require(_0x000f('0x1'))(_0x000f('0x2'));var moment=require(_0x000f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x000f('0x4'));var rimraf=require(_0x000f('0x5'));var config=require(_0x000f('0x6'));var attributes=require(_0x000f('0x7'));module[_0x000f('0x8')]=function(_0x486b01,_0x18c280){return _0x486b01[_0x000f('0x9')]('Trunk',attributes,{'tableName':_0x000f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7df4=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Trunk'];(function(_0x41c2f2,_0x22d465){var _0x59cf5f=function(_0x457ec7){while(--_0x457ec7){_0x41c2f2['push'](_0x41c2f2['shift']());}};_0x59cf5f(++_0x22d465);}(_0x7df4,0x90));var _0x47df=function(_0x1c7e82,_0x103104){_0x1c7e82=_0x1c7e82-0x0;var _0x5bec25=_0x7df4[_0x1c7e82];return _0x5bec25;};'use strict';var _=require(_0x47df('0x0'));var util=require(_0x47df('0x1'));var logger=require(_0x47df('0x2'))(_0x47df('0x3'));var moment=require(_0x47df('0x4'));var BPromise=require(_0x47df('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47df('0x6'));var rimraf=require(_0x47df('0x7'));var config=require(_0x47df('0x8'));var attributes=require('./trunk.attributes');module[_0x47df('0x9')]=function(_0xe3ebd8,_0x55a4ec){return _0xe3ebd8[_0x47df('0xa')](_0x47df('0xb'),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 e314f33..f673fa9 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 _0x0ec8=['Trunk,\x20%s,\x20%s','message','result','catch','findAll','options','where','attributes','limit','map','include','model','then','debug','GetTrunk','stringify','ShowTrunk','find','raw','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0ec8,0x167));var _0x80ec=function(_0x2b2be6,_0x341100){_0x2b2be6=_0x2b2be6-0x0;var _0x89e6e5=_0x0ec8[_0x2b2be6];return _0x89e6e5;};'use strict';var _=require(_0x80ec('0x0'));var util=require(_0x80ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x80ec('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80ec('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x80ec('0x4'))(_0x80ec('0x5'));var config=require(_0x80ec('0x6'));var jayson=require(_0x80ec('0x7'));var client=jayson[_0x80ec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32ce88,_0x29955b,_0x15ffbe){return new BPromise(function(_0xf3188,_0x14bce4){return client[_0x80ec('0x9')](_0x32ce88,_0x15ffbe)['then'](function(_0x3d9b1e){logger[_0x80ec('0xa')]('Trunk,\x20%s,\x20%s',_0x29955b,_0x80ec('0xb'));logger['debug'](_0x80ec('0xc'),_0x29955b,_0x80ec('0xb'),JSON['stringify'](_0x3d9b1e));if(_0x3d9b1e['error']){if(_0x3d9b1e[_0x80ec('0xd')][_0x80ec('0xe')]===0x1f4){logger[_0x80ec('0xd')](_0x80ec('0xf'),_0x29955b,_0x3d9b1e['error'][_0x80ec('0x10')]);return _0x14bce4(_0x3d9b1e[_0x80ec('0xd')]['message']);}logger[_0x80ec('0xd')](_0x80ec('0xf'),_0x29955b,_0x3d9b1e[_0x80ec('0xd')][_0x80ec('0x10')]);return _0xf3188(_0x3d9b1e[_0x80ec('0xd')][_0x80ec('0x10')]);}else{logger[_0x80ec('0xa')]('Trunk,\x20%s,\x20%s',_0x29955b,'request\x20sent');_0xf3188(_0x3d9b1e[_0x80ec('0x11')][_0x80ec('0x10')]);}})[_0x80ec('0x12')](function(_0x3659f1){logger[_0x80ec('0xd')](_0x80ec('0xf'),_0x29955b,_0x3659f1);_0x14bce4(_0x3659f1);});});}exports['GetTrunk']=function(_0x3f194d){var _0x14e95e=this;return new Promise(function(_0x3090db,_0x48e3bf){return db['Trunk'][_0x80ec('0x13')]({'raw':_0x3f194d[_0x80ec('0x14')]?_0x3f194d[_0x80ec('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x3f194d[_0x80ec('0x14')]?_0x3f194d['options'][_0x80ec('0x15')]||null:null,'attributes':_0x3f194d[_0x80ec('0x14')]?_0x3f194d[_0x80ec('0x14')][_0x80ec('0x16')]||null:null,'limit':_0x3f194d[_0x80ec('0x14')]?_0x3f194d['options'][_0x80ec('0x17')]||null:null,'include':_0x3f194d['options']?_0x3f194d[_0x80ec('0x14')]['include']?_[_0x80ec('0x18')](_0x3f194d['options']['include'],function(_0x196024){return{'model':db[_0x196024['model']],'as':_0x196024['as'],'attributes':_0x196024[_0x80ec('0x16')],'include':_0x196024['include']?_[_0x80ec('0x18')](_0x196024[_0x80ec('0x19')],function(_0xf4436a){return{'model':db[_0xf4436a[_0x80ec('0x1a')]],'as':_0xf4436a['as'],'attributes':_0xf4436a[_0x80ec('0x16')],'include':_0xf4436a[_0x80ec('0x19')]?_[_0x80ec('0x18')](_0xf4436a['include'],function(_0x327606){return{'model':db[_0x327606['model']],'as':_0x327606['as'],'attributes':_0x327606['attributes']};}):[]};}):[]};}):[]:[]})[_0x80ec('0x1b')](function(_0x2cfb7c){logger[_0x80ec('0xa')]('GetTrunk',_0x3f194d);logger[_0x80ec('0x1c')](_0x80ec('0x1d'),_0x3f194d,JSON[_0x80ec('0x1e')](_0x2cfb7c));_0x3090db(_0x2cfb7c);})[_0x80ec('0x12')](function(_0x4d0546){logger[_0x80ec('0xd')](_0x80ec('0x1d'),_0x4d0546[_0x80ec('0x10')],_0x3f194d);_0x48e3bf(_0x14e95e[_0x80ec('0xd')](0x1f4,_0x4d0546[_0x80ec('0x10')]));});});};exports[_0x80ec('0x1f')]=function(_0x5ecfca){var _0x127cef=this;return new Promise(function(_0xa9f0ac,_0x4a4235){return db['Trunk'][_0x80ec('0x20')]({'raw':_0x5ecfca[_0x80ec('0x14')]?_0x5ecfca[_0x80ec('0x14')][_0x80ec('0x21')]===undefined?!![]:![]:!![],'where':_0x5ecfca['options']?_0x5ecfca['options'][_0x80ec('0x15')]||null:null,'attributes':_0x5ecfca[_0x80ec('0x14')]?_0x5ecfca[_0x80ec('0x14')]['attributes']||null:null,'include':_0x5ecfca[_0x80ec('0x14')]?_0x5ecfca['options'][_0x80ec('0x19')]?_['map'](_0x5ecfca[_0x80ec('0x14')][_0x80ec('0x19')],function(_0x5a9b08){return{'model':db[_0x5a9b08[_0x80ec('0x1a')]],'as':_0x5a9b08['as'],'attributes':_0x5a9b08[_0x80ec('0x16')],'include':_0x5a9b08[_0x80ec('0x19')]?_[_0x80ec('0x18')](_0x5a9b08[_0x80ec('0x19')],function(_0x28780b){return{'model':db[_0x28780b[_0x80ec('0x1a')]],'as':_0x28780b['as'],'attributes':_0x28780b[_0x80ec('0x16')],'include':_0x28780b['include']?_[_0x80ec('0x18')](_0x28780b[_0x80ec('0x19')],function(_0x2adbd0){return{'model':db[_0x2adbd0[_0x80ec('0x1a')]],'as':_0x2adbd0['as'],'attributes':_0x2adbd0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x17cbe0){logger[_0x80ec('0xa')]('ShowTrunk',_0x5ecfca);logger[_0x80ec('0x1c')](_0x80ec('0x1f'),_0x5ecfca,JSON[_0x80ec('0x1e')](_0x17cbe0));_0xa9f0ac(_0x17cbe0);})['catch'](function(_0x32c5cc){logger[_0x80ec('0xd')](_0x80ec('0x1f'),_0x32c5cc[_0x80ec('0x10')],_0x5ecfca);_0x4a4235(_0x127cef[_0x80ec('0xd')](0x1f4,_0x32c5cc[_0x80ec('0x10')]));});});}; \ No newline at end of file +var _0xfa48=['code','message','result','catch','options','raw','where','limit','include','model','attributes','map','then','GetTrunk','ShowTrunk','Trunk','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2b550c,_0x1acc94){var _0x2e63e4=function(_0x13c7c3){while(--_0x13c7c3){_0x2b550c['push'](_0x2b550c['shift']());}};_0x2e63e4(++_0x1acc94);}(_0xfa48,0x1a9));var _0x8fa4=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xfa48[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x8fa4('0x0'));var util=require('util');var moment=require(_0x8fa4('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fa4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fa4('0x3'))['db'];var utils=require(_0x8fa4('0x4'));var logger=require(_0x8fa4('0x5'))(_0x8fa4('0x6'));var config=require(_0x8fa4('0x7'));var jayson=require(_0x8fa4('0x8'));var client=jayson['client'][_0x8fa4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe88a2,_0x227094,_0x73963d){return new BPromise(function(_0x5cd3cf,_0x3a2c40){return client[_0x8fa4('0xa')](_0xe88a2,_0x73963d)['then'](function(_0x26372e){logger[_0x8fa4('0xb')](_0x8fa4('0xc'),_0x227094,_0x8fa4('0xd'));logger[_0x8fa4('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x227094,_0x8fa4('0xd'),JSON[_0x8fa4('0xf')](_0x26372e));if(_0x26372e[_0x8fa4('0x10')]){if(_0x26372e['error'][_0x8fa4('0x11')]===0x1f4){logger[_0x8fa4('0x10')](_0x8fa4('0xc'),_0x227094,_0x26372e[_0x8fa4('0x10')][_0x8fa4('0x12')]);return _0x3a2c40(_0x26372e[_0x8fa4('0x10')][_0x8fa4('0x12')]);}logger[_0x8fa4('0x10')](_0x8fa4('0xc'),_0x227094,_0x26372e['error'][_0x8fa4('0x12')]);return _0x5cd3cf(_0x26372e[_0x8fa4('0x10')]['message']);}else{logger['info'](_0x8fa4('0xc'),_0x227094,_0x8fa4('0xd'));_0x5cd3cf(_0x26372e[_0x8fa4('0x13')][_0x8fa4('0x12')]);}})[_0x8fa4('0x14')](function(_0x4f745a){logger[_0x8fa4('0x10')]('Trunk,\x20%s,\x20%s',_0x227094,_0x4f745a);_0x3a2c40(_0x4f745a);});});}exports['GetTrunk']=function(_0x2d7a7a){var _0x2a213e=this;return new Promise(function(_0x821f28,_0x10cc52){return db['Trunk']['findAll']({'raw':_0x2d7a7a[_0x8fa4('0x15')]?_0x2d7a7a[_0x8fa4('0x15')][_0x8fa4('0x16')]===undefined?!![]:![]:!![],'where':_0x2d7a7a[_0x8fa4('0x15')]?_0x2d7a7a[_0x8fa4('0x15')][_0x8fa4('0x17')]||null:null,'attributes':_0x2d7a7a[_0x8fa4('0x15')]?_0x2d7a7a['options']['attributes']||null:null,'limit':_0x2d7a7a['options']?_0x2d7a7a['options'][_0x8fa4('0x18')]||null:null,'include':_0x2d7a7a['options']?_0x2d7a7a[_0x8fa4('0x15')][_0x8fa4('0x19')]?_['map'](_0x2d7a7a[_0x8fa4('0x15')][_0x8fa4('0x19')],function(_0x43dbea){return{'model':db[_0x43dbea[_0x8fa4('0x1a')]],'as':_0x43dbea['as'],'attributes':_0x43dbea[_0x8fa4('0x1b')],'include':_0x43dbea[_0x8fa4('0x19')]?_[_0x8fa4('0x1c')](_0x43dbea[_0x8fa4('0x19')],function(_0x200e21){return{'model':db[_0x200e21[_0x8fa4('0x1a')]],'as':_0x200e21['as'],'attributes':_0x200e21['attributes'],'include':_0x200e21[_0x8fa4('0x19')]?_[_0x8fa4('0x1c')](_0x200e21[_0x8fa4('0x19')],function(_0x5b2443){return{'model':db[_0x5b2443['model']],'as':_0x5b2443['as'],'attributes':_0x5b2443[_0x8fa4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8fa4('0x1d')](function(_0x553909){logger[_0x8fa4('0xb')](_0x8fa4('0x1e'),_0x2d7a7a);logger[_0x8fa4('0xe')](_0x8fa4('0x1e'),_0x2d7a7a,JSON[_0x8fa4('0xf')](_0x553909));_0x821f28(_0x553909);})[_0x8fa4('0x14')](function(_0x2c540e){logger['error'](_0x8fa4('0x1e'),_0x2c540e[_0x8fa4('0x12')],_0x2d7a7a);_0x10cc52(_0x2a213e[_0x8fa4('0x10')](0x1f4,_0x2c540e['message']));});});};exports[_0x8fa4('0x1f')]=function(_0x467a5a){var _0x446e37=this;return new Promise(function(_0x2232c9,_0x584818){return db[_0x8fa4('0x20')][_0x8fa4('0x21')]({'raw':_0x467a5a[_0x8fa4('0x15')]?_0x467a5a[_0x8fa4('0x15')][_0x8fa4('0x16')]===undefined?!![]:![]:!![],'where':_0x467a5a[_0x8fa4('0x15')]?_0x467a5a[_0x8fa4('0x15')][_0x8fa4('0x17')]||null:null,'attributes':_0x467a5a[_0x8fa4('0x15')]?_0x467a5a['options']['attributes']||null:null,'include':_0x467a5a['options']?_0x467a5a[_0x8fa4('0x15')][_0x8fa4('0x19')]?_[_0x8fa4('0x1c')](_0x467a5a['options'][_0x8fa4('0x19')],function(_0x462e29){return{'model':db[_0x462e29[_0x8fa4('0x1a')]],'as':_0x462e29['as'],'attributes':_0x462e29[_0x8fa4('0x1b')],'include':_0x462e29[_0x8fa4('0x19')]?_[_0x8fa4('0x1c')](_0x462e29[_0x8fa4('0x19')],function(_0x53bd0a){return{'model':db[_0x53bd0a[_0x8fa4('0x1a')]],'as':_0x53bd0a['as'],'attributes':_0x53bd0a[_0x8fa4('0x1b')],'include':_0x53bd0a['include']?_[_0x8fa4('0x1c')](_0x53bd0a[_0x8fa4('0x19')],function(_0x25ec26){return{'model':db[_0x25ec26[_0x8fa4('0x1a')]],'as':_0x25ec26['as'],'attributes':_0x25ec26['attributes']};}):[]};}):[]};}):[]:[]})[_0x8fa4('0x1d')](function(_0x7eaa98){logger[_0x8fa4('0xb')](_0x8fa4('0x1f'),_0x467a5a);logger[_0x8fa4('0xe')](_0x8fa4('0x1f'),_0x467a5a,JSON[_0x8fa4('0xf')](_0x7eaa98));_0x2232c9(_0x7eaa98);})[_0x8fa4('0x14')](function(_0xb04948){logger[_0x8fa4('0x10')](_0x8fa4('0x1f'),_0xb04948[_0x8fa4('0x12')],_0x467a5a);_0x584818(_0x446e37['error'](0x1f4,_0xb04948[_0x8fa4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 70f5086..e5be572 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 _0x2ee5=['isAuthenticated','update','express','Router','./user-setting.controller','put','/:id'];(function(_0x59b1e7,_0x8b07a6){var _0x22d24f=function(_0x4131fa){while(--_0x4131fa){_0x59b1e7['push'](_0x59b1e7['shift']());}};_0x22d24f(++_0x8b07a6);}(_0x2ee5,0x14b));var _0x52ee=function(_0xd41ece,_0x241cdb){_0xd41ece=_0xd41ece-0x0;var _0x5e2da2=_0x2ee5[_0xd41ece];return _0x5e2da2;};'use strict';var express=require(_0x52ee('0x0'));var router=express[_0x52ee('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x52ee('0x2'));router[_0x52ee('0x3')](_0x52ee('0x4'),auth[_0x52ee('0x5')](),controller[_0x52ee('0x6')]);module['exports']=router; \ No newline at end of file +var _0x364b=['express','Router','../../components/auth/service','put','/:id'];(function(_0x3da8b7,_0x5cefcb){var _0x305992=function(_0x321d6f){while(--_0x321d6f){_0x3da8b7['push'](_0x3da8b7['shift']());}};_0x305992(++_0x5cefcb);}(_0x364b,0x113));var _0xb364=function(_0x387ca0,_0x5c9b88){_0x387ca0=_0x387ca0-0x0;var _0x3257d3=_0x364b[_0x387ca0];return _0x3257d3;};'use strict';var express=require(_0xb364('0x0'));var router=express[_0xb364('0x1')]();var auth=require(_0xb364('0x2'));var controller=require('./user-setting.controller');router[_0xb364('0x3')](_0xb364('0x4'),auth['isAuthenticated'](),controller['update']);module['exports']=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 ba9fa2a..834b4f4 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 _0x716f=['UserId','error','warning','info','debug','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x716f,0xc7));var _0xf716=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x716f[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xf716('0x0'),_0xf716('0x1'),_0xf716('0x2'),_0xf716('0x3')];module[_0xf716('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xf716('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xf716('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf716('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xf716('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf716('0x9')],'unique':_0xf716('0xa')}}; \ No newline at end of file +var _0xfdd3=['debug','exports','BOOLEAN','TEXT','DATE','INTEGER','sequelize','error','warning','info'];(function(_0x3e7d62,_0x597c90){var _0x14d3ae=function(_0x7c6006){while(--_0x7c6006){_0x3e7d62['push'](_0x3e7d62['shift']());}};_0x14d3ae(++_0x597c90);}(_0xfdd3,0x92));var _0x3fdd=function(_0x404c8b,_0x26969d){_0x404c8b=_0x404c8b-0x0;var _0x1e4dd0=_0xfdd3[_0x404c8b];return _0x1e4dd0;};'use strict';var Sequelize=require(_0x3fdd('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x3fdd('0x1'),_0x3fdd('0x2'),_0x3fdd('0x3'),_0x3fdd('0x4')];module[_0x3fdd('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x3fdd('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x3fdd('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x3fdd('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x3fdd('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x3fdd('0x9')],'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 1321942..a57499f 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 _0xe739=['name','send','user','role','Unauthorized','params','UserSetting','find','lodash','../../config/logger','api','../../config/environment','./user-setting.socket','register','redis','defaults','localhost','status','json','update','then','error','stack'];(function(_0x459d34,_0x3c66f2){var _0x154781=function(_0x21c96d){while(--_0x21c96d){_0x459d34['push'](_0x459d34['shift']());}};_0x154781(++_0x3c66f2);}(_0xe739,0x105));var _0x9e73=function(_0x1a1d2f,_0x5d1d5d){_0x1a1d2f=_0x1a1d2f-0x0;var _0x4b9093=_0xe739[_0x1a1d2f];return _0x4b9093;};'use strict';var _=require(_0x9e73('0x0'));var Redis=require('ioredis');var logger=require(_0x9e73('0x1'))(_0x9e73('0x2'));var config=require(_0x9e73('0x3'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9e73('0x4'))[_0x9e73('0x5')](socket);config[_0x9e73('0x6')]=_[_0x9e73('0x7')](config['redis'],{'host':_0x9e73('0x8'),'port':0x18eb});function respondWithResult(_0x26cb5b,_0xb37872){_0xb37872=_0xb37872||0xc8;return function(_0x5e46e7){if(_0x5e46e7){return _0x26cb5b[_0x9e73('0x9')](_0xb37872)[_0x9e73('0xa')](_0x5e46e7);}};}function saveUpdates(_0x471872){return function(_0x274187){if(_0x274187){return _0x274187[_0x9e73('0xb')](_0x471872)[_0x9e73('0xc')](function(_0x52393d){return _0x52393d;});}return null;};}function handleEntityNotFound(_0x33ce2d){return function(_0x5f06cb){if(!_0x5f06cb){_0x33ce2d['sendStatus'](0x194);}return _0x5f06cb;};}function handleError(_0x145c76,_0x530e27){_0x530e27=_0x530e27||0x1f4;return function(_0x186b89){logger[_0x9e73('0xd')](_0x186b89[_0x9e73('0xe')]);if(_0x186b89['name']){delete _0x186b89[_0x9e73('0xf')];}_0x145c76[_0x9e73('0x9')](_0x530e27)[_0x9e73('0x10')](_0x186b89);};}exports[_0x9e73('0xb')]=function(_0x5c1c3b,_0x27c0ba){if(_0x5c1c3b[_0x9e73('0x11')][_0x9e73('0x12')]!=='admin')throw new Error(_0x9e73('0x13'));if(isNaN(Number(_0x5c1c3b[_0x9e73('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x9e73('0x15')][_0x9e73('0x16')]({'where':{'id':_0x5c1c3b[_0x9e73('0x14')]['id']}})['then'](handleEntityNotFound(_0x27c0ba,null))[_0x9e73('0xc')](saveUpdates(_0x5c1c3b['body'],null))[_0x9e73('0xc')](respondWithResult(_0x27c0ba,null))['catch'](handleError(_0x27c0ba,null));}; \ No newline at end of file +var _0xe1dc=['params','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','defaults','redis','localhost','json','update','then','sendStatus','error','stack','name','user','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find'];(function(_0x5d68ba,_0x33be44){var _0x17cee3=function(_0x14e9ed){while(--_0x14e9ed){_0x5d68ba['push'](_0x5d68ba['shift']());}};_0x17cee3(++_0x33be44);}(_0xe1dc,0x8a));var _0xce1d=function(_0x2ec55e,_0x525043){_0x2ec55e=_0x2ec55e-0x0;var _0x1225cb=_0xe1dc[_0x2ec55e];return _0x1225cb;};'use strict';var _=require(_0xce1d('0x0'));var Redis=require(_0xce1d('0x1'));var logger=require(_0xce1d('0x2'))(_0xce1d('0x3'));var config=require(_0xce1d('0x4'));var db=require(_0xce1d('0x5'))['db'];var socket=require(_0xce1d('0x6'))(new Redis(config['redis']));require(_0xce1d('0x7'))['register'](socket);config['redis']=_[_0xce1d('0x8')](config[_0xce1d('0x9')],{'host':_0xce1d('0xa'),'port':0x18eb});function respondWithResult(_0x110cc2,_0x2a91e2){_0x2a91e2=_0x2a91e2||0xc8;return function(_0x62d18b){if(_0x62d18b){return _0x110cc2['status'](_0x2a91e2)[_0xce1d('0xb')](_0x62d18b);}};}function saveUpdates(_0x7f91e1){return function(_0x54eec8){if(_0x54eec8){return _0x54eec8[_0xce1d('0xc')](_0x7f91e1)[_0xce1d('0xd')](function(_0x326c07){return _0x326c07;});}return null;};}function handleEntityNotFound(_0x1a5a48){return function(_0x134417){if(!_0x134417){_0x1a5a48[_0xce1d('0xe')](0x194);}return _0x134417;};}function handleError(_0xcb8b27,_0x3d3286){_0x3d3286=_0x3d3286||0x1f4;return function(_0x4b4ddc){logger[_0xce1d('0xf')](_0x4b4ddc[_0xce1d('0x10')]);if(_0x4b4ddc['name']){delete _0x4b4ddc[_0xce1d('0x11')];}_0xcb8b27['status'](_0x3d3286)['send'](_0x4b4ddc);};}exports['update']=function(_0x378ee5,_0x48d0fe){if(_0x378ee5[_0xce1d('0x12')]['role']!==_0xce1d('0x13'))throw new Error(_0xce1d('0x14'));if(isNaN(Number(_0x378ee5['params']['id'])))throw new Error(_0xce1d('0x15'));return db[_0xce1d('0x16')][_0xce1d('0x17')]({'where':{'id':_0x378ee5[_0xce1d('0x18')]['id']}})[_0xce1d('0xd')](handleEntityNotFound(_0x48d0fe,null))[_0xce1d('0xd')](saveUpdates(_0x378ee5[_0xce1d('0x19')],null))['then'](respondWithResult(_0x48d0fe,null))[_0xce1d('0x1a')](handleError(_0x48d0fe,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 6672c69..b97d83f 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 _0x9ee3=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0xb89c1c,_0x54b4cb){var _0x2f0be3=function(_0x103ae4){while(--_0x103ae4){_0xb89c1c['push'](_0xb89c1c['shift']());}};_0x2f0be3(++_0x54b4cb);}(_0x9ee3,0xe2));var _0x39ee=function(_0x5d99d6,_0x573a21){_0x5d99d6=_0x5d99d6-0x0;var _0x1a5423=_0x9ee3[_0x5d99d6];return _0x1a5423;};'use strict';var EventEmitter=require(_0x39ee('0x0'));var UserSetting=require(_0x39ee('0x1'))['db'][_0x39ee('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x39ee('0x3')](0x0);var events={'afterCreate':_0x39ee('0x4'),'afterUpdate':_0x39ee('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2ee92b){return function(_0x414bea,_0x5f4750,_0x4c2c04){UserSettingEvents['emit'](_0x2ee92b+':'+_0x414bea['id'],_0x414bea);UserSettingEvents[_0x39ee('0x6')](_0x2ee92b,_0x414bea);_0x4c2c04(null);};}for(var e in events){if(events[_0x39ee('0x7')](e)){var event=events[e];UserSetting[_0x39ee('0x8')](e,emitEvent(event));}}module[_0x39ee('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x727d=['emit','hasOwnProperty','hook','events','../../mysqldb','UserSetting','save','update','remove'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x727d,0x1e9));var _0xd727=function(_0x28b077,_0xe071ed){_0x28b077=_0x28b077-0x0;var _0x43b3d3=_0x727d[_0x28b077];return _0x43b3d3;};'use strict';var EventEmitter=require(_0xd727('0x0'));var UserSetting=require(_0xd727('0x1'))['db'][_0xd727('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd727('0x3'),'afterUpdate':_0xd727('0x4'),'afterDestroy':_0xd727('0x5')};function emitEvent(_0x2829f4){return function(_0x39a222,_0x2ddb96,_0x13f294){UserSettingEvents[_0xd727('0x6')](_0x2829f4+':'+_0x39a222['id'],_0x39a222);UserSettingEvents['emit'](_0x2829f4,_0x39a222);_0x13f294(null);};}for(var e in events){if(events[_0xd727('0x7')](e)){var event=events[e];UserSetting[_0xd727('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 46289b3..f48a67b 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 _0xb9be=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x3bddcc,_0x15574f){var _0x10afc1=function(_0x510d0c){while(--_0x510d0c){_0x3bddcc['push'](_0x3bddcc['shift']());}};_0x10afc1(++_0x15574f);}(_0xb9be,0xc5));var _0xeb9b=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0xb9be[_0x3f3f40];return _0x403b7a;};'use strict';var attributes=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]=function(_0x314d6e){return _0x314d6e[_0xeb9b('0x2')](_0xeb9b('0x3'),attributes,{'tableName':_0xeb9b('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fbcda){if(!_0x2fbcda[_0xeb9b('0x5')])_0x2fbcda[_0xeb9b('0x6')]=null;else if(_0x2fbcda['clientSideLoggingEnabledSince']===null)_0x2fbcda['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0xad95=['./user-setting.attributes','exports','user_settings','clientSideLoggingEnabledSince'];(function(_0x15fd58,_0x1ffc80){var _0x335768=function(_0x38b9fc){while(--_0x38b9fc){_0x15fd58['push'](_0x15fd58['shift']());}};_0x335768(++_0x1ffc80);}(_0xad95,0x70));var _0x5ad9=function(_0x1d2244,_0x1b3ba5){_0x1d2244=_0x1d2244-0x0;var _0x2b9ac3=_0xad95[_0x1d2244];return _0x2b9ac3;};'use strict';var attributes=require(_0x5ad9('0x0'));module[_0x5ad9('0x1')]=function(_0x1fe578){return _0x1fe578['define']('UserSetting',attributes,{'tableName':_0x5ad9('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x235c61){if(!_0x235c61['clientSideLoggingEnabled'])_0x235c61['clientSideLoggingEnabledSince']=null;else if(_0x235c61[_0x5ad9('0x3')]===null)_0x235c61['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 334f122..d4d78a8 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 _0xafe2=['register','length','user-setting:','save','update','emit','user-setting:update','user-setting:update:user-','UserId'];(function(_0x353c48,_0x55343a){var _0x1a6fa0=function(_0x376918){while(--_0x376918){_0x353c48['push'](_0x353c48['shift']());}};_0x1a6fa0(++_0x55343a);}(_0xafe2,0x1e0));var _0x2afe=function(_0x2753b5,_0xb1d0b6){_0x2753b5=_0x2753b5-0x0;var _0x16d631=_0xafe2[_0x2753b5];return _0x16d631;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x2afe('0x0'),'remove',_0x2afe('0x1')];function createListener(_0x50a973,_0x1a1b63){return function(_0x268d6e){_0x1a1b63[_0x2afe('0x2')](_0x50a973,_0x268d6e);if(_0x50a973===_0x2afe('0x3')){_0x1a1b63[_0x2afe('0x2')](_0x2afe('0x4')+_0x268d6e[_0x2afe('0x5')],_0x268d6e);}};}exports[_0x2afe('0x6')]=function(_0x5491ff){for(var _0x250982=0x0,_0x18f1db=events[_0x2afe('0x7')];_0x250982<_0x18f1db;_0x250982++){var _0xeaab4b=events[_0x250982];var _0x207f34=createListener(_0x2afe('0x8')+_0xeaab4b,_0x5491ff);UserSettingEvents['on'](_0xeaab4b,_0x207f34);}}; \ No newline at end of file +var _0xd270=['length','./user-setting.events','remove','emit','user-setting:update:user-','UserId','register'];(function(_0x19d355,_0x4d73a6){var _0x591ab6=function(_0x6cfbc2){while(--_0x6cfbc2){_0x19d355['push'](_0x19d355['shift']());}};_0x591ab6(++_0x4d73a6);}(_0xd270,0xf6));var _0x0d27=function(_0x445798,_0x1e5b29){_0x445798=_0x445798-0x0;var _0x463b5b=_0xd270[_0x445798];return _0x463b5b;};'use strict';var UserSettingEvents=require(_0x0d27('0x0'));var events=['save',_0x0d27('0x1'),'update'];function createListener(_0x48026b,_0x5b9ad2){return function(_0x5a1ba1){_0x5b9ad2[_0x0d27('0x2')](_0x48026b,_0x5a1ba1);if(_0x48026b==='user-setting:update'){_0x5b9ad2[_0x0d27('0x2')](_0x0d27('0x3')+_0x5a1ba1[_0x0d27('0x4')],_0x5a1ba1);}};}exports[_0x0d27('0x5')]=function(_0x354bdb){for(var _0x4e651e=0x0,_0x1bc20f=events[_0x0d27('0x6')];_0x4e651e<_0x1bc20f;_0x4e651e++){var _0x5e5b66=events[_0x4e651e];var _0x326d9d=createListener('user-setting:'+_0x5e5b66,_0x354bdb);UserSettingEvents['on'](_0x5e5b66,_0x326d9d);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5be5566..2bd35c5 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 _0x1015=['changePassword','delete','removeTeams','/:id','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','/:id/queues','diskStorage','root','format','%s-%s','originalname','/:id/avatar','single','file','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','update','put','/:id/password'];(function(_0x19d494,_0x33670c){var _0x3d71f3=function(_0xf23452){while(--_0xf23452){_0x19d494['push'](_0x19d494['shift']());}};_0x3d71f3(++_0x33670c);}(_0x1015,0x85));var _0x5101=function(_0x2cd4d5,_0x1e4426){_0x2cd4d5=_0x2cd4d5-0x0;var _0x6362b=_0x1015[_0x2cd4d5];return _0x6362b;};'use strict';var multer=require(_0x5101('0x0'));var util=require(_0x5101('0x1'));var path=require(_0x5101('0x2'));var timeout=require(_0x5101('0x3'));var express=require(_0x5101('0x4'));var router=express[_0x5101('0x5')]();var fs_extra=require(_0x5101('0x6'));var auth=require(_0x5101('0x7'));var interaction=require(_0x5101('0x8'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x5101('0x9')]('/',auth[_0x5101('0xa')](),controller[_0x5101('0xb')]);router[_0x5101('0x9')](_0x5101('0xc'),auth[_0x5101('0xa')](),controller[_0x5101('0xd')]);router[_0x5101('0x9')](_0x5101('0xe'),auth[_0x5101('0xa')](),controller[_0x5101('0xf')]);router[_0x5101('0x9')](_0x5101('0x10'),auth[_0x5101('0xa')](),controller[_0x5101('0x11')]);router[_0x5101('0x9')]('/:id',auth[_0x5101('0xa')](),controller[_0x5101('0x12')]);router['get']('/:id/avatar',controller[_0x5101('0x13')]);router[_0x5101('0x9')](_0x5101('0x14'),auth[_0x5101('0xa')](),controller[_0x5101('0x15')]);router[_0x5101('0x9')](_0x5101('0x16'),auth[_0x5101('0xa')](),controller[_0x5101('0x17')]);router[_0x5101('0x9')]('/:id/queues',auth['isAuthenticated'](),controller[_0x5101('0x18')]);router['get'](_0x5101('0x19'),auth[_0x5101('0xa')](),controller[_0x5101('0x1a')]);router['get'](_0x5101('0x1b'),auth['isAuthenticated'](),controller[_0x5101('0x1c')]);router[_0x5101('0x9')]('/:id/recordings',auth[_0x5101('0xa')](),controller[_0x5101('0x1d')]);router[_0x5101('0x9')](_0x5101('0x1e'),auth[_0x5101('0xa')](),controller['getScreenRecordings']);router[_0x5101('0x9')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x5101('0x1f')]);router[_0x5101('0x9')](_0x5101('0x20'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x5101('0x9')](_0x5101('0x21'),auth[_0x5101('0xa')](),controller[_0x5101('0x22')]);router[_0x5101('0x9')](_0x5101('0x23'),auth[_0x5101('0xa')](),controller[_0x5101('0x24')]);router[_0x5101('0x9')](_0x5101('0x25'),auth[_0x5101('0xa')](),controller[_0x5101('0x26')]);router[_0x5101('0x9')]('/:id/whatsapp/interactions',auth[_0x5101('0xa')](),controller['getWhatsappInteractions']);router[_0x5101('0x9')](_0x5101('0x27'),auth[_0x5101('0xa')](),controller[_0x5101('0x28')]);router[_0x5101('0x9')]('/:id/lists',auth[_0x5101('0xa')](),controller[_0x5101('0x29')]);router[_0x5101('0x9')](_0x5101('0x2a'),auth['isAuthenticated'](),controller[_0x5101('0x2b')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x5101('0x9')](_0x5101('0x2c'),auth[_0x5101('0xa')](),controller[_0x5101('0x2d')]);router[_0x5101('0x9')](_0x5101('0x2e'),auth[_0x5101('0xa')](),controller['getMailAccounts']);router[_0x5101('0x9')](_0x5101('0x2f'),auth[_0x5101('0xa')](),controller[_0x5101('0x30')]);router[_0x5101('0x9')](_0x5101('0x31'),auth['isAuthenticated'](),controller[_0x5101('0x32')]);router[_0x5101('0x9')](_0x5101('0x33'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x5101('0x9')](_0x5101('0x34'),auth[_0x5101('0xa')](),controller[_0x5101('0x35')]);router['get'](_0x5101('0x36'),auth[_0x5101('0xa')](),controller[_0x5101('0x37')]);router[_0x5101('0x9')](_0x5101('0x38'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x5101('0x39')](_0x5101('0x16'),auth[_0x5101('0xa')](),controller['addContacts']);router[_0x5101('0x39')]('/',auth[_0x5101('0xa')](),controller['create']);router['post'](_0x5101('0x3a'),auth['isAuthenticated'](),controller[_0x5101('0x3b')]);router[_0x5101('0x39')](_0x5101('0x3c'),auth[_0x5101('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x5101('0x3d')]({'destination':function(_0x568d4b,_0x2a374f,_0x15cefd){_0x15cefd(null,path['join'](config[_0x5101('0x3e')],'server/files/images/'));},'filename':function(_0x28b7aa,_0x2df414,_0x1790e0){_0x1790e0(null,util[_0x5101('0x3f')](_0x5101('0x40'),Date['now'](),_0x2df414[_0x5101('0x41')]));}})});router[_0x5101('0x39')](_0x5101('0x42'),upload[_0x5101('0x43')](_0x5101('0x44')),controller['addAvatar']);router['post']('/:id/login',auth[_0x5101('0xa')](),controller[_0x5101('0x45')]);router['post'](_0x5101('0x46'),auth['isAuthenticated'](),controller[_0x5101('0x47')]);router[_0x5101('0x39')](_0x5101('0x48'),auth['isAuthenticated'](),controller[_0x5101('0x49')]);router[_0x5101('0x39')](_0x5101('0x4a'),auth[_0x5101('0xa')](),controller[_0x5101('0x4b')]);router[_0x5101('0x39')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x5101('0x39')](_0x5101('0x4c'),auth['isAuthenticated'](),controller['addChatInteractions']);router['post'](_0x5101('0x4d'),auth[_0x5101('0xa')](),controller[_0x5101('0x4e')]);router[_0x5101('0x39')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x5101('0x4f')]);router['post'](_0x5101('0x50'),auth[_0x5101('0xa')](),controller['addSmsInteractions']);router[_0x5101('0x39')](_0x5101('0x51'),auth[_0x5101('0xa')](),controller[_0x5101('0x52')]);router[_0x5101('0x39')](_0x5101('0x53'),auth[_0x5101('0xa')](),controller['addWhatsappInteractions']);router[_0x5101('0x39')]('/:id/fax_accounts',auth[_0x5101('0xa')](),controller[_0x5101('0x54')]);router[_0x5101('0x39')](_0x5101('0x2e'),auth[_0x5101('0xa')](),controller[_0x5101('0x55')]);router[_0x5101('0x39')](_0x5101('0x2f'),auth[_0x5101('0xa')](),controller[_0x5101('0x56')]);router[_0x5101('0x39')]('/:id/sms_accounts',auth[_0x5101('0xa')](),controller['addSmsAccounts']);router[_0x5101('0x39')](_0x5101('0x33'),auth[_0x5101('0xa')](),controller[_0x5101('0x57')]);router[_0x5101('0x39')](_0x5101('0x34'),auth[_0x5101('0xa')](),controller[_0x5101('0x58')]);router[_0x5101('0x39')]('/:id/api_key',auth[_0x5101('0xa')](),controller[_0x5101('0x59')]);router['put']('/:id',auth[_0x5101('0xa')](),controller[_0x5101('0x5a')]);router[_0x5101('0x5b')](_0x5101('0x5c'),auth[_0x5101('0xa')](),controller[_0x5101('0x5d')]);router[_0x5101('0x5e')](_0x5101('0x3c'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x5101('0x5e')](_0x5101('0x27'),auth[_0x5101('0xa')](),controller[_0x5101('0x5f')]);router[_0x5101('0x5e')](_0x5101('0x60'),auth['isAuthenticated'](),controller[_0x5101('0x61')]);router['delete'](_0x5101('0x4c'),auth[_0x5101('0xa')](),controller[_0x5101('0x62')]);router[_0x5101('0x5e')](_0x5101('0x4d'),auth[_0x5101('0xa')](),controller[_0x5101('0x63')]);router['delete'](_0x5101('0x64'),auth[_0x5101('0xa')](),controller[_0x5101('0x65')]);router[_0x5101('0x5e')]('/:id/sms_interactions',auth[_0x5101('0xa')](),controller[_0x5101('0x66')]);router['delete'](_0x5101('0x51'),auth[_0x5101('0xa')](),controller[_0x5101('0x67')]);router[_0x5101('0x5e')](_0x5101('0x53'),auth[_0x5101('0xa')](),controller['removeWhatsappInteractions']);router[_0x5101('0x5e')](_0x5101('0x2c'),auth[_0x5101('0xa')](),controller[_0x5101('0x68')]);router['delete'](_0x5101('0x2e'),auth['isAuthenticated'](),controller[_0x5101('0x69')]);router[_0x5101('0x5e')](_0x5101('0x2f'),auth['isAuthenticated'](),controller[_0x5101('0x6a')]);router[_0x5101('0x5e')](_0x5101('0x31'),auth[_0x5101('0xa')](),controller[_0x5101('0x6b')]);router['delete'](_0x5101('0x33'),auth[_0x5101('0xa')](),controller[_0x5101('0x6c')]);router['delete'](_0x5101('0x34'),auth['isAuthenticated'](),controller[_0x5101('0x6d')]);router[_0x5101('0x5e')](_0x5101('0x38'),auth['isAuthenticated'](),controller[_0x5101('0x6e')]);router[_0x5101('0x39')]('/:id/messengerSoundNotification',auth[_0x5101('0xa')](),controller[_0x5101('0x6f')]);module[_0x5101('0x70')]=router; \ No newline at end of file +var _0x9a18=['/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/api_key','createApiKey','/:id','update','put','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeSmsAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/whoami','whoami','getPresence','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getLists','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','post','addContacts','/create_many','bulkCreate','diskStorage','server/files/images/','format','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause'];(function(_0x2ce515,_0x3dcb43){var _0x19f78b=function(_0x19e86d){while(--_0x19e86d){_0x2ce515['push'](_0x2ce515['shift']());}};_0x19f78b(++_0x3dcb43);}(_0x9a18,0xfa));var _0x89a1=function(_0x79e614,_0x30c7ea){_0x79e614=_0x79e614-0x0;var _0x27e2f3=_0x9a18[_0x79e614];return _0x27e2f3;};'use strict';var multer=require(_0x89a1('0x0'));var util=require(_0x89a1('0x1'));var path=require(_0x89a1('0x2'));var timeout=require(_0x89a1('0x3'));var express=require(_0x89a1('0x4'));var router=express['Router']();var fs_extra=require(_0x89a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x89a1('0x6'));var config=require(_0x89a1('0x7'));var controller=require('./user.controller');router[_0x89a1('0x8')]('/',auth[_0x89a1('0x9')](),controller[_0x89a1('0xa')]);router[_0x89a1('0x8')](_0x89a1('0xb'),auth[_0x89a1('0x9')](),controller['describe']);router[_0x89a1('0x8')](_0x89a1('0xc'),auth[_0x89a1('0x9')](),controller[_0x89a1('0xd')]);router['get']('/presence',auth[_0x89a1('0x9')](),controller[_0x89a1('0xe')]);router[_0x89a1('0x8')]('/:id',auth[_0x89a1('0x9')](),controller['show']);router[_0x89a1('0x8')](_0x89a1('0xf'),controller[_0x89a1('0x10')]);router['get']('/:id/open_tabs',auth[_0x89a1('0x9')](),controller[_0x89a1('0x11')]);router[_0x89a1('0x8')](_0x89a1('0x12'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x13')]);router[_0x89a1('0x8')](_0x89a1('0x14'),auth[_0x89a1('0x9')](),controller['getQueues']);router[_0x89a1('0x8')](_0x89a1('0x15'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x16')]);router['get'](_0x89a1('0x17'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x18')]);router[_0x89a1('0x8')](_0x89a1('0x19'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x1a')]);router[_0x89a1('0x8')](_0x89a1('0x1b'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x89a1('0x8')](_0x89a1('0x1c'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x1d')]);router[_0x89a1('0x8')](_0x89a1('0x1e'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x1f')]);router['get'](_0x89a1('0x20'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x89a1('0x8')](_0x89a1('0x21'),auth['isAuthenticated'](),controller[_0x89a1('0x22')]);router['get'](_0x89a1('0x23'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x24')]);router[_0x89a1('0x8')](_0x89a1('0x25'),auth[_0x89a1('0x9')](),controller['getWhatsappInteractions']);router[_0x89a1('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get']('/:id/lists',auth[_0x89a1('0x9')](),controller[_0x89a1('0x26')]);router[_0x89a1('0x8')]('/:id/agents',auth['isAuthenticated'](),controller['getAgents']);router[_0x89a1('0x8')]('/:id/prefixes',auth[_0x89a1('0x9')](),controller[_0x89a1('0x27')]);router[_0x89a1('0x8')](_0x89a1('0x28'),auth['isAuthenticated'](),controller[_0x89a1('0x29')]);router[_0x89a1('0x8')](_0x89a1('0x2a'),auth[_0x89a1('0x9')](),controller['getMailAccounts']);router['get'](_0x89a1('0x2b'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x2c')]);router['get'](_0x89a1('0x2d'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x2e')]);router[_0x89a1('0x8')](_0x89a1('0x2f'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x30')]);router[_0x89a1('0x8')](_0x89a1('0x31'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x32')]);router[_0x89a1('0x8')]('/:id/scheduled_calls',auth[_0x89a1('0x9')](),controller[_0x89a1('0x33')]);router['get']('/:id/api_key',auth[_0x89a1('0x9')](),controller['getApiKey']);router[_0x89a1('0x34')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x89a1('0x35')]);router[_0x89a1('0x34')]('/',auth[_0x89a1('0x9')](),controller['create']);router[_0x89a1('0x34')](_0x89a1('0x36'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x37')]);router[_0x89a1('0x34')](_0x89a1('0x14'),auth[_0x89a1('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x89a1('0x38')]({'destination':function(_0x2cb315,_0x3f1e5e,_0x1911f0){_0x1911f0(null,path['join'](config['root'],_0x89a1('0x39')));},'filename':function(_0x2db036,_0x2a3d0e,_0x43f670){_0x43f670(null,util[_0x89a1('0x3a')]('%s-%s',Date['now'](),_0x2a3d0e[_0x89a1('0x3b')]));}})});router[_0x89a1('0x34')](_0x89a1('0xf'),upload[_0x89a1('0x3c')](_0x89a1('0x3d')),controller[_0x89a1('0x3e')]);router[_0x89a1('0x34')](_0x89a1('0x3f'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x40')]);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0x89a1('0x41')]);router[_0x89a1('0x34')](_0x89a1('0x42'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x43')]);router[_0x89a1('0x34')](_0x89a1('0x44'),auth['isAuthenticated'](),controller[_0x89a1('0x45')]);router[_0x89a1('0x34')](_0x89a1('0x46'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x47')]);router['post'](_0x89a1('0x48'),auth[_0x89a1('0x9')](),controller['addChatInteractions']);router[_0x89a1('0x34')](_0x89a1('0x49'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x4a')]);router[_0x89a1('0x34')](_0x89a1('0x4b'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x4c')]);router[_0x89a1('0x34')]('/:id/sms_interactions',auth[_0x89a1('0x9')](),controller[_0x89a1('0x4d')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x89a1('0x4e')]);router['post']('/:id/whatsapp_interactions',auth[_0x89a1('0x9')](),controller[_0x89a1('0x4f')]);router[_0x89a1('0x34')](_0x89a1('0x28'),auth['isAuthenticated'](),controller[_0x89a1('0x50')]);router[_0x89a1('0x34')](_0x89a1('0x2a'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0x89a1('0x34')](_0x89a1('0x2b'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x51')]);router[_0x89a1('0x34')]('/:id/sms_accounts',auth[_0x89a1('0x9')](),controller[_0x89a1('0x52')]);router[_0x89a1('0x34')](_0x89a1('0x2f'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x53')]);router[_0x89a1('0x34')](_0x89a1('0x31'),auth[_0x89a1('0x9')](),controller['addWhatsappAccounts']);router[_0x89a1('0x34')](_0x89a1('0x54'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x55')]);router['put'](_0x89a1('0x56'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x57')]);router[_0x89a1('0x58')](_0x89a1('0x59'),auth[_0x89a1('0x9')](),controller['changePassword']);router[_0x89a1('0x5a')](_0x89a1('0x14'),auth['isAuthenticated'](),controller[_0x89a1('0x5b')]);router[_0x89a1('0x5a')]('/:id/teams',auth[_0x89a1('0x9')](),controller[_0x89a1('0x5c')]);router['delete'](_0x89a1('0x56'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x5d')]);router['delete'](_0x89a1('0x48'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x5e')]);router['delete'](_0x89a1('0x49'),auth[_0x89a1('0x9')](),controller['removeMailInteractions']);router[_0x89a1('0x5a')](_0x89a1('0x4b'),auth[_0x89a1('0x9')](),controller['removeFaxInteractions']);router['delete'](_0x89a1('0x5f'),auth['isAuthenticated'](),controller[_0x89a1('0x60')]);router[_0x89a1('0x5a')](_0x89a1('0x61'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x62')]);router[_0x89a1('0x5a')](_0x89a1('0x63'),auth['isAuthenticated'](),controller[_0x89a1('0x64')]);router[_0x89a1('0x5a')](_0x89a1('0x28'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x89a1('0x5a')](_0x89a1('0x2a'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x89a1('0x5a')](_0x89a1('0x2b'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router['delete'](_0x89a1('0x2d'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x65')]);router[_0x89a1('0x5a')]('/:id/chat_websites',auth[_0x89a1('0x9')](),controller['removeChatWebsites']);router[_0x89a1('0x5a')](_0x89a1('0x31'),auth[_0x89a1('0x9')](),controller['removeWhatsappAccounts']);router['delete'](_0x89a1('0x54'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x66')]);router[_0x89a1('0x34')](_0x89a1('0x67'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x68')]);module[_0x89a1('0x69')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 0f4c52b..03ef484 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 _0xd30f=['user','agent','telephone','local','INTEGER','internal','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','rfc2833','yes','nonat','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','certificate','active','passive','actpass','TEXT','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','email','ENUM','admin'];(function(_0x3a522d,_0x54e1d7){var _0x275450=function(_0x58b515){while(--_0x58b515){_0x3a522d['push'](_0x3a522d['shift']());}};_0x275450(++_0x54e1d7);}(_0xd30f,0xa9));var _0xfd30=function(_0x3f8160,_0x33d946){_0x3f8160=_0x3f8160-0x0;var _0x497b06=_0xd30f[_0x3f8160];return _0x497b06;};'use strict';var Sequelize=require(_0xfd30('0x0'));var moment=require(_0xfd30('0x1'));var util=require(_0xfd30('0x2'));var _=require(_0xfd30('0x3'));module[_0xfd30('0x4')]={'name':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'unique':_0xfd30('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x7a89da){this[_0xfd30('0x7')]('name',_0x7a89da);this[_0xfd30('0x7')](_0xfd30('0x8'),_0x7a89da);},'comment':_0xfd30('0x9')},'fullname':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'set':function(_0x1732f9){this[_0xfd30('0x7')](_0xfd30('0xa'),_0x1732f9);this['setDataValue'](_0xfd30('0xb'),util[_0xfd30('0xc')](_0xfd30('0xd'),_0x1732f9,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0xfd30('0x5')]},'email':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'unique':_0xfd30('0xe'),'validate':{'isEmail':!![]},'set':function(_0x234221){if(_0x234221){this[_0xfd30('0x7')](_0xfd30('0xe'),_0x234221['toLowerCase']());}}},'role':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x10'),_0xfd30('0x11'),_0xfd30('0x12'),_0xfd30('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xfd30('0x5')],'defaultValue':_0xfd30('0x14')},'internal':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x404d3f){this['setDataValue'](_0xfd30('0x16'),_0x404d3f);this[_0xfd30('0x7')]('accountcode',_0x404d3f);this[_0xfd30('0x7')](_0xfd30('0xb'),util[_0xfd30('0xc')](_0xfd30('0xd'),this[_0xfd30('0x17')](_0xfd30('0xa')),_0x404d3f));}},'salt':{'type':Sequelize[_0xfd30('0x5')]},'phone':{'type':Sequelize[_0xfd30('0x5')]},'mobile':{'type':Sequelize[_0xfd30('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xfd30('0x5')]},'userpic':{'type':Sequelize[_0xfd30('0x5')]},'city':{'type':Sequelize[_0xfd30('0x5')]},'country':{'type':Sequelize[_0xfd30('0x5')]},'online':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xfd30('0x19')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xfd30('0x5')],'defaultValue':_0xfd30('0x1a')},'lastPauseAt':{'type':Sequelize[_0xfd30('0x19')]},'chatCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xfd30('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xfd30('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xfd30('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x1b'),'user',_0xfd30('0x1c')),'allowNull':!![],'defaultValue':_0xfd30('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xfd30('0x1d')},'callingpres':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x1e'),'ALLOWED_PASSED_SCREEN',_0xfd30('0x1f'),_0xfd30('0x20'),_0xfd30('0x21'),'PROHIB_PASSED_SCREEN',_0xfd30('0x22'),_0xfd30('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xfd30('0x24'),'set':function(_0xee5832){this[_0xfd30('0x7')]('transport',_0xee5832?_0xee5832[_0xfd30('0x25')](','):null);},'get':function(){return this[_0xfd30('0x17')](_0xfd30('0x26'))?this[_0xfd30('0x17')](_0xfd30('0x26'))[_0xfd30('0x27')](','):null;},'comment':_0xfd30('0x28')},'dtmfmode':{'type':Sequelize[_0xfd30('0xf')]('rfc2833',_0xfd30('0x29'),_0xfd30('0x2a'),'inband','auto'),'allowNull':!![],'defaultValue':_0xfd30('0x2b')},'directmedia':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no',_0xfd30('0x2d'),'update',_0xfd30('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xfd30('0x2f'),'set':function(_0x5dff4a){this[_0xfd30('0x7')](_0xfd30('0x30'),_0x5dff4a?_0x5dff4a[_0xfd30('0x25')](','):null);},'get':function(){return this[_0xfd30('0x17')](_0xfd30('0x30'))?this[_0xfd30('0x17')](_0xfd30('0x30'))[_0xfd30('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xfd30('0x5')]},'namedcallgroup':{'type':Sequelize[_0xfd30('0x5')]},'pickupgroup':{'type':Sequelize[_0xfd30('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xfd30('0x5')]},'language':{'type':Sequelize[_0xfd30('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xfd30('0x5')]},'disallow':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'defaultValue':_0xfd30('0x31')},'allow':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'defaultValue':_0xfd30('0x32'),'set':function(_0x1c49ff){this[_0xfd30('0x7')]('allow',_0x1c49ff?_0x1c49ff[_0xfd30('0x25')](';'):_0xfd30('0x32'));},'get':function(){return this[_0xfd30('0x17')]('allow')?this[_0xfd30('0x17')](_0xfd30('0x33'))[_0xfd30('0x27')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![],'set':function(_0x5ca79b){this[_0xfd30('0x7')]('insecure',_0x5ca79b?_0x5ca79b[_0xfd30('0x25')](','):null);},'get':function(){return this['getDataValue'](_0xfd30('0x34'))?this['getDataValue'](_0xfd30('0x34'))[_0xfd30('0x27')](','):null;},'comment':_0xfd30('0x35')},'trustrpid':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xfd30('0x2c'),'no',_0xfd30('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xfd30('0x37')},'amaflags':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0xfd30('0x2c')},'busylevel':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xfd30('0x2c'),'no',_0xfd30('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x39'),'refuse',_0xfd30('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x3b'),'uas'),'allowNull':!![],'defaultValue':_0xfd30('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0xfd30('0x2c')},'keepalive':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xfd30('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xfd30('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no','fingerprint',_0xfd30('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x3e'),_0xfd30('0x3f'),_0xfd30('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no',_0xfd30('0x2d'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xfd30('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xfd30('0x19')]},'passwordResetAt':{'type':Sequelize[_0xfd30('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xfd30('0x41')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x424e76){this[_0xfd30('0x7')](_0xfd30('0x42'),_0x424e76);var _0x49e101=this[_0xfd30('0x43')]({'plain':!![]});switch(_0x424e76){case 0x0:case 0x1:var _0xcaf46e=_0x49e101[_0xfd30('0x26')]?_[_0xfd30('0x44')](_0x49e101[_0xfd30('0x26')])?_0x49e101['transport'][_0xfd30('0x25')]():_0x49e101['transport']:'udp';if(_0xcaf46e===_0xfd30('0x45')){_0xcaf46e=_0xfd30('0x24');}this[_0xfd30('0x7')](_0xfd30('0x26'),_0xcaf46e);this[_0xfd30('0x7')](_0xfd30('0x46'),'no');this[_0xfd30('0x7')]('avpf',null);this[_0xfd30('0x7')](_0xfd30('0x47'),null);this['setDataValue'](_0xfd30('0x48'),null);this['setDataValue'](_0xfd30('0x49'),null);this[_0xfd30('0x7')](_0xfd30('0x4a'),null);this[_0xfd30('0x7')](_0xfd30('0x4b'),null);this[_0xfd30('0x7')](_0xfd30('0x4c'),null);this['setDataValue'](_0xfd30('0x4d'),null);this[_0xfd30('0x7')](_0xfd30('0x4e'),'no');break;case 0x2:this[_0xfd30('0x7')]('transport',_0xfd30('0x45'));this[_0xfd30('0x7')](_0xfd30('0x46'),_0xfd30('0x2c'));this[_0xfd30('0x7')](_0xfd30('0x4f'),'yes');this[_0xfd30('0x7')]('force_avp',_0xfd30('0x2c'));this[_0xfd30('0x7')](_0xfd30('0x48'),_0xfd30('0x2c'));this[_0xfd30('0x7')]('dtlsenable',_0xfd30('0x2c'));this['setDataValue'](_0xfd30('0x4a'),'no');this[_0xfd30('0x7')]('dtlssetup',_0xfd30('0x40'));this[_0xfd30('0x7')](_0xfd30('0x4c'),_0x49e101[_0xfd30('0x4c')]||_0xfd30('0x50'));this[_0xfd30('0x7')](_0xfd30('0x4d'),_0x49e101['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xfd30('0x7')](_0xfd30('0x4e'),_0xfd30('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0xfd30('0x41')],'set':function(_0x4609d2){this[_0xfd30('0x7')](_0xfd30('0x51'),_0x4609d2?_0x4609d2['join'](','):[]);},'get':function(){return this['getDataValue'](_0xfd30('0x51'))?_[_0xfd30('0x52')](this[_0xfd30('0x17')](_0xfd30('0x51'))[_0xfd30('0x27')](','),function(_0x2abde4){return parseInt(_0x2abde4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xfd30('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xfd30('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xfd30('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xfd30('0x53')],'get':function(){return this[_0xfd30('0x17')](_0xfd30('0x54'))?this['getDataValue'](_0xfd30('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xfd30('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x57c57e){if(typeof _0x57c57e===_0xfd30('0x55')){var _0xadb835=_0x57c57e==='1'?!![]:_0x57c57e==='0'?![]:_0x57c57e===_0xfd30('0x56')?!![]:_0x57c57e===_0xfd30('0x57')?![]:![];this[_0xfd30('0x7')](_0xfd30('0x58'),_0xadb835);}else{this[_0xfd30('0x7')](_0xfd30('0x58'),_0x57c57e);}}},'blocked':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![],'set':function(_0x5077be){this[_0xfd30('0x7')](_0xfd30('0x59'),_0x5077be);if(_0x5077be===!![]){this[_0xfd30('0x7')](_0xfd30('0x5a'),moment());this['setDataValue'](_0xfd30('0x5b'),0x0);}else{this[_0xfd30('0x7')](_0xfd30('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0xfd30('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xfd30('0x15')](0x5)[_0xfd30('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]}}; \ No newline at end of file +var _0x9cba=['The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','email','toLowerCase','ENUM','user','agent','telephone','internal','accountcode','format','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','wss','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','util','exports','STRING','name','setDataValue','defaultuser'];(function(_0x544419,_0x539c34){var _0x6eadc9=function(_0xcdf22a){while(--_0xcdf22a){_0x544419['push'](_0x544419['shift']());}};_0x6eadc9(++_0x539c34);}(_0x9cba,0x17d));var _0xa9cb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9cba[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xa9cb('0x0'));var moment=require('moment');var util=require(_0xa9cb('0x1'));var _=require('lodash');module[_0xa9cb('0x2')]={'name':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':![],'unique':_0xa9cb('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x294f9b){this[_0xa9cb('0x5')]('name',_0x294f9b);this[_0xa9cb('0x5')](_0xa9cb('0x6'),_0x294f9b);},'comment':_0xa9cb('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x215470){this[_0xa9cb('0x5')](_0xa9cb('0x8'),_0x215470);this[_0xa9cb('0x5')](_0xa9cb('0x9'),util['format']('\x22%s\x22\x20<%s>',_0x215470,this[_0xa9cb('0xa')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':![],'unique':_0xa9cb('0xb'),'validate':{'isEmail':!![]},'set':function(_0x4d4bed){if(_0x4d4bed){this[_0xa9cb('0x5')](_0xa9cb('0xb'),_0x4d4bed[_0xa9cb('0xc')]());}}},'role':{'type':Sequelize[_0xa9cb('0xd')]('admin',_0xa9cb('0xe'),_0xa9cb('0xf'),_0xa9cb('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa9cb('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xa9cb('0x11'),'set':function(_0x57b0ba){this['setDataValue']('internal',_0x57b0ba);this[_0xa9cb('0x5')](_0xa9cb('0x12'),_0x57b0ba);this[_0xa9cb('0x5')](_0xa9cb('0x9'),util[_0xa9cb('0x13')](_0xa9cb('0x14'),this[_0xa9cb('0xa')](_0xa9cb('0x8')),_0x57b0ba));}},'salt':{'type':Sequelize[_0xa9cb('0x3')]},'phone':{'type':Sequelize[_0xa9cb('0x3')]},'mobile':{'type':Sequelize[_0xa9cb('0x3')]},'address':{'type':Sequelize[_0xa9cb('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xa9cb('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa9cb('0x3')]},'online':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa9cb('0x16')]},'voicePause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa9cb('0x3')],'defaultValue':_0xa9cb('0x17')},'lastPauseAt':{'type':Sequelize[_0xa9cb('0x16')]},'chatCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa9cb('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![],'defaultValue':_0xa9cb('0x19')},'ipaddr':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xa9cb('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xa9cb('0x1a'),_0xa9cb('0xe'),_0xa9cb('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![],'defaultValue':_0xa9cb('0x1c')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xa9cb('0x1d'),_0xa9cb('0x1e'),_0xa9cb('0x1f'),_0xa9cb('0x20'),_0xa9cb('0x21'),_0xa9cb('0x22'),_0xa9cb('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa9cb('0x24'),'set':function(_0x2bcd1c){this[_0xa9cb('0x5')](_0xa9cb('0x25'),_0x2bcd1c?_0x2bcd1c[_0xa9cb('0x26')](','):null);},'get':function(){return this['getDataValue'](_0xa9cb('0x25'))?this['getDataValue']('transport')['split'](','):null;},'comment':_0xa9cb('0x27')},'dtmfmode':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x28'),_0xa9cb('0x29'),_0xa9cb('0x2a'),_0xa9cb('0x2b'),_0xa9cb('0x2c')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no',_0xa9cb('0x2e'),_0xa9cb('0x2f'),_0xa9cb('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![],'defaultValue':_0xa9cb('0x31'),'set':function(_0x378ccd){this[_0xa9cb('0x5')]('nat',_0x378ccd?_0x378ccd[_0xa9cb('0x26')](','):null);},'get':function(){return this[_0xa9cb('0xa')](_0xa9cb('0x32'))?this[_0xa9cb('0xa')](_0xa9cb('0x32'))[_0xa9cb('0x33')](','):null;},'comment':_0xa9cb('0x34')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xa9cb('0x3')]},'pickupgroup':{'type':Sequelize[_0xa9cb('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xa9cb('0x3')]},'language':{'type':Sequelize[_0xa9cb('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa9cb('0x3')]},'disallow':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':![],'defaultValue':_0xa9cb('0x35')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa9cb('0x36'),'set':function(_0x1a4ec1){this[_0xa9cb('0x5')](_0xa9cb('0x37'),_0x1a4ec1?_0x1a4ec1[_0xa9cb('0x26')](';'):_0xa9cb('0x36'));},'get':function(){return this['getDataValue']('allow')?this[_0xa9cb('0xa')](_0xa9cb('0x37'))[_0xa9cb('0x33')](';'):null;},'comment':_0xa9cb('0x38')},'autoframing':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![],'set':function(_0x3967ed){this['setDataValue'](_0xa9cb('0x39'),_0x3967ed?_0x3967ed[_0xa9cb('0x26')](','):null);},'get':function(){return this[_0xa9cb('0xa')](_0xa9cb('0x39'))?this[_0xa9cb('0xa')](_0xa9cb('0x39'))[_0xa9cb('0x33')](','):null;},'comment':_0xa9cb('0x3a')},'trustrpid':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no',_0xa9cb('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xa9cb('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xa9cb('0x2d')},'busylevel':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no',_0xa9cb('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x3d'),_0xa9cb('0x3e'),_0xa9cb('0x3f')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'allowNull':!![],'defaultValue':_0xa9cb('0x40')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xa9cb('0x2d')},'keepalive':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no',_0xa9cb('0x41'),_0xa9cb('0x42')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x43'),_0xa9cb('0x44'),_0xa9cb('0x45')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa9cb('0xd')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no',_0xa9cb('0x2e'),_0xa9cb('0x2f'),_0xa9cb('0x46')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xa9cb('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa9cb('0x47')]},'showWebBar':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0,'set':function(_0x48a95a){this[_0xa9cb('0x5')](_0xa9cb('0x48'),_0x48a95a);var _0x55cdcd=this[_0xa9cb('0x49')]({'plain':!![]});switch(_0x48a95a){case 0x0:case 0x1:var _0x3189e8=_0x55cdcd['transport']?_[_0xa9cb('0x4a')](_0x55cdcd['transport'])?_0x55cdcd[_0xa9cb('0x25')][_0xa9cb('0x26')]():_0x55cdcd[_0xa9cb('0x25')]:_0xa9cb('0x24');if(_0x3189e8==='wss'){_0x3189e8=_0xa9cb('0x24');}this[_0xa9cb('0x5')](_0xa9cb('0x25'),_0x3189e8);this[_0xa9cb('0x5')](_0xa9cb('0x4b'),'no');this[_0xa9cb('0x5')](_0xa9cb('0x4c'),null);this[_0xa9cb('0x5')](_0xa9cb('0x4d'),null);this[_0xa9cb('0x5')](_0xa9cb('0x4e'),null);this[_0xa9cb('0x5')]('dtlsenable',null);this[_0xa9cb('0x5')](_0xa9cb('0x4f'),null);this[_0xa9cb('0x5')](_0xa9cb('0x50'),null);this[_0xa9cb('0x5')]('dtlscertfile',null);this['setDataValue'](_0xa9cb('0x51'),null);this[_0xa9cb('0x5')](_0xa9cb('0x52'),'no');break;case 0x2:this[_0xa9cb('0x5')]('transport',_0xa9cb('0x53'));this[_0xa9cb('0x5')](_0xa9cb('0x4b'),_0xa9cb('0x2d'));this[_0xa9cb('0x5')](_0xa9cb('0x4c'),'yes');this[_0xa9cb('0x5')](_0xa9cb('0x4d'),_0xa9cb('0x2d'));this[_0xa9cb('0x5')](_0xa9cb('0x4e'),_0xa9cb('0x2d'));this[_0xa9cb('0x5')](_0xa9cb('0x54'),_0xa9cb('0x2d'));this[_0xa9cb('0x5')](_0xa9cb('0x4f'),'no');this['setDataValue'](_0xa9cb('0x50'),'actpass');this['setDataValue'](_0xa9cb('0x55'),_0x55cdcd['dtlscertfile']||_0xa9cb('0x56'));this[_0xa9cb('0x5')](_0xa9cb('0x51'),_0x55cdcd[_0xa9cb('0x51')]||'/etc/pki/tls/private/motion.key');this[_0xa9cb('0x5')](_0xa9cb('0x52'),_0xa9cb('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0xa9cb('0x47')],'set':function(_0x27c748){this[_0xa9cb('0x5')]('permissions',_0x27c748?_0x27c748['join'](','):[]);},'get':function(){return this[_0xa9cb('0xa')](_0xa9cb('0x57'))?_[_0xa9cb('0x58')](this[_0xa9cb('0xa')](_0xa9cb('0x57'))[_0xa9cb('0x33')](','),function(_0x422fc3){return parseInt(_0x422fc3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa9cb('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa9cb('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa9cb('0x3')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa9cb('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa9cb('0x3')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa9cb('0x59')],'get':function(){return this[_0xa9cb('0xa')](_0xa9cb('0x5a'))?this[_0xa9cb('0xa')](_0xa9cb('0x5a')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa9cb('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![],'set':function(_0x4ce898){if(typeof _0x4ce898===_0xa9cb('0x5b')){var _0x14abf4=_0x4ce898==='1'?!![]:_0x4ce898==='0'?![]:_0x4ce898===_0xa9cb('0x5c')?!![]:_0x4ce898===_0xa9cb('0x5d')?![]:![];this[_0xa9cb('0x5')](_0xa9cb('0x5e'),_0x14abf4);}else{this[_0xa9cb('0x5')]('screenrecording',_0x4ce898);}}},'blocked':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![],'set':function(_0x5c2fe0){this[_0xa9cb('0x5')](_0xa9cb('0x5f'),_0x5c2fe0);if(_0x5c2fe0===!![]){this['setDataValue']('blockedAt',moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0xa9cb('0x5')](_0xa9cb('0x60'),null);}}},'blockedAt':{'type':Sequelize[_0xa9cb('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index b436a5b..5aa3f07 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 _0xdf23=['api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','http','sendStatus','status','end','json','offset','undefined','limit','count','set','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','update','agent','emit','destroy','get','role','user','Agents','Telephones','telephone','ignore','map','value','includes','name','UserProfileResource','send','User','rawAttributes','fieldName','type','filter','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','where','query','includeAll','include','userSetting','true','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','fax','all','catch','show','params','getOptions','options','find','whatsapp','mail','body','addContacts','ids','omit','internal','findById','securePassword','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','permissions','101','103','104','105','106','107','109','111','114','create','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','isEmpty','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','isValidChannel','Unknown\x20channel','toLowerCase','Queues','penalty','capitalize','QueueId','Queue:save','voice','VoiceQueue','SIP/%s','interface','UserVoiceQueueRt','upsert','remove','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','root','join','server/files/images/','download','getOpenTabs','openchannel','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','describe','CmList','List','Tag','Tags','tag','getQueues','model','keys','Queue','intersection','fields','order','sort','pick','filters','merge','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','format','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','transaction','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','LOGININPAUSE','MemberReport','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','online','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','Voice','VoicePrefixId','getDataValue','removeTeams','resolve','getAssociatedQueues','removeAgent','TeamVoicePrefix','UserVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','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','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','getChatWebsites','ChatWebsite','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$contains','$contained','$any','lastName','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','unknown','ringing','teams','queues','inbound','flatten','lower','col','asc','desc','substring','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','charAt','toUpperCase','select','field','InteractionId','ui.createdAt','user_has_','ui.UserId\x20=\x20?','toString','OpenTabs','enabled','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../components/realtime/agents'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xdf23,0x18e));var _0x3df2=function(_0x43b99e,_0x5757ab){_0x43b99e=_0x43b99e-0x0;var _0x1061fe=_0xdf23[_0x43b99e];return _0x1061fe;};'use strict';var moment=require('moment');var util=require(_0x3df2('0x0'));var path=require(_0x3df2('0x1'));var fs=require('fs');var _=require(_0x3df2('0x2'));var squel=require(_0x3df2('0x3'));var Redis=require(_0x3df2('0x4'));var jayson=require('jayson/promise');var authService=require('../../components/auth/service');var contacts=require('../../components/contacts');var qs=require(_0x3df2('0x5'));var rta=require(_0x3df2('0x6'));var logger=require('../../config/logger')(_0x3df2('0x7'));var utils=require(_0x3df2('0x8'));var config=require(_0x3df2('0x9'));var licenseUtil=require(_0x3df2('0xa'));var APIBadRequestError=require(_0x3df2('0xb'))[_0x3df2('0xc')];var APINotFoundError=require(_0x3df2('0xb'))[_0x3df2('0xd')];var APIForbiddenError=require('../../errors/api')[_0x3df2('0xe')];var APIHandleError=require(_0x3df2('0xb'))['handleError'];var db=require(_0x3df2('0xf'))['db'];var socket=require(_0x3df2('0x10'))(new Redis(config[_0x3df2('0x11')]));require(_0x3df2('0x12'))[_0x3df2('0x13')](socket);config[_0x3df2('0x11')]=_[_0x3df2('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var amiClient=jayson['client'][_0x3df2('0x15')]({'port':0x232a});var values;function respondWithStatusCode(_0x2001c8,_0x12e609){_0x12e609=_0x12e609||0xcc;return function(_0x406bad){if(_0x406bad){return _0x2001c8[_0x3df2('0x16')](_0x12e609);}return _0x2001c8[_0x3df2('0x17')](_0x12e609)[_0x3df2('0x18')]();};}function respondWithResult(_0x5d1f04,_0x348315){_0x348315=_0x348315||0xc8;return function(_0x2244da){if(_0x2244da){return _0x5d1f04[_0x3df2('0x17')](_0x348315)[_0x3df2('0x19')](_0x2244da);}};}function respondWithFilteredResult(_0x5da49b,_0x3de3e1){return function(_0x3e6b02){if(_0x3e6b02){var _0x23beb0=typeof _0x3de3e1[_0x3df2('0x1a')]===_0x3df2('0x1b')&&typeof _0x3de3e1[_0x3df2('0x1c')]==='undefined';var _0x75a663=_0x3e6b02[_0x3df2('0x1d')];var _0xbd406f=_0x23beb0?0x0:_0x3de3e1[_0x3df2('0x1a')];var _0x15330d=_0x23beb0?_0x3e6b02[_0x3df2('0x1d')]:_0x3de3e1[_0x3df2('0x1a')]+_0x3de3e1[_0x3df2('0x1c')];var _0x434417;if(_0x15330d>=_0x75a663){_0x15330d=_0x75a663;_0x434417=0xc8;}else{_0x434417=0xce;}_0x5da49b['status'](_0x434417);return _0x5da49b[_0x3df2('0x1e')]('Content-Range',_0xbd406f+'-'+_0x15330d+'/'+_0x75a663)[_0x3df2('0x19')](_0x3e6b02);}return null;};}function respondWithRpcPromise(_0x1611c4,_0x9d859c,_0x4338fd,_0x550b78){return new Promise(function(_0x55a318,_0x30fe39){var _0x484af2=_0x550b78||amiClient;return _0x484af2['request'](_0x1611c4,_0x4338fd)[_0x3df2('0x1f')](function(_0x45a2bc){logger[_0x3df2('0x20')](_0x3df2('0x21'),_0x9d859c,'request\x20sent');logger[_0x3df2('0x22')](_0x3df2('0x23'),_0x9d859c,_0x3df2('0x24'),JSON['stringify'](_0x45a2bc));if(_0x45a2bc[_0x3df2('0x25')]){if(_0x45a2bc[_0x3df2('0x25')][_0x3df2('0x26')]===0x1f4){logger[_0x3df2('0x25')](_0x3df2('0x21'),_0x9d859c,_0x45a2bc[_0x3df2('0x25')]['message']);return _0x30fe39(_0x45a2bc[_0x3df2('0x25')]['message']);}logger[_0x3df2('0x25')](_0x3df2('0x21'),_0x9d859c,_0x45a2bc[_0x3df2('0x25')][_0x3df2('0x27')]);return _0x55a318(_0x45a2bc['error'][_0x3df2('0x27')]);}else{logger['info'](_0x3df2('0x21'),_0x9d859c,_0x3df2('0x24'));_0x55a318(_0x45a2bc['result'][_0x3df2('0x27')]);}})['catch'](function(_0x5ad292){logger[_0x3df2('0x25')](_0x3df2('0x21'),_0x9d859c,_0x5ad292);_0x30fe39(_0x5ad292);});});}function saveUpdates(_0x2df084){return function(_0x1f0d74){if(_0x1f0d74){return _0x1f0d74[_0x3df2('0x28')](_0x2df084)['then'](function(_0x413db5){if(_0x413db5['role']===_0x3df2('0x29')){socket[_0x3df2('0x2a')]('userNotification:recalc:'+_0x413db5['id'],_0x413db5);}return _0x413db5;});}return null;};}function removeEntity(_0x4d5d25,_0x15ddff){return function(_0x5e563a){if(_0x5e563a){return _0x5e563a[_0x3df2('0x2b')]({'transaction':_0x15ddff})[_0x3df2('0x1f')](function(){var _0x2c057a=_0x5e563a[_0x3df2('0x2c')]({'plain':!![]});if(_0x2c057a[_0x3df2('0x2d')]==='admin')return;var _0x5ba4e2=[{'name':'Users','value':_0x3df2('0x2e'),'ignore':!![]},{'name':_0x3df2('0x2f'),'value':_0x3df2('0x29'),'ignore':![]},{'name':_0x3df2('0x30'),'value':_0x3df2('0x31'),'ignore':![]}];var _0x3f8f73=_(_0x5ba4e2)['filter'](_0x3df2('0x32'))[_0x3df2('0x33')](_0x3df2('0x34'))[_0x3df2('0x34')]();if(_[_0x3df2('0x35')](_0x3f8f73,_0x2c057a[_0x3df2('0x2d')])){return;}var _0x5afeb1=_['find'](_0x5ba4e2,[_0x3df2('0x34'),_0x2c057a[_0x3df2('0x2d')]])[_0x3df2('0x36')];return db[_0x3df2('0x37')][_0x3df2('0x2b')]({'where':{'type':_0x5afeb1,'resourceId':_0x2c057a['id']},'transaction':_0x15ddff})[_0x3df2('0x1f')](function(){return _0x5e563a;});})[_0x3df2('0x1f')](function(){_0x4d5d25[_0x3df2('0x17')](0xcc)[_0x3df2('0x18')]();});}};}function handleEntityNotFound(_0x3b5ec7){return function(_0x140b91){if(!_0x140b91){_0x3b5ec7[_0x3df2('0x16')](0x194);}return _0x140b91;};}function handleError(_0x294aad,_0x2650b2){_0x2650b2=_0x2650b2||0x1f4;return function(_0x3807d0){logger[_0x3df2('0x25')](_0x3807d0['stack']);if(_0x3807d0[_0x3df2('0x36')]){delete _0x3807d0[_0x3df2('0x36')];}_0x294aad[_0x3df2('0x17')](_0x2650b2)[_0x3df2('0x38')](_0x3807d0);};}function getUserAttributes(){return _(db[_0x3df2('0x39')][_0x3df2('0x3a')])[_0x3df2('0x33')](function(_0x39d37a){return{'name':_0x39d37a[_0x3df2('0x3b')],'type':_0x39d37a[_0x3df2('0x3c')]['key']};})[_0x3df2('0x3d')](function(_0x258057){return![_0x3df2('0x3e'),_0x3df2('0x3f'),_0x3df2('0x40'),_0x3df2('0x41'),_0x3df2('0x42'),_0x3df2('0x43')]['includes'](_0x258057[_0x3df2('0x36')]);})[_0x3df2('0x34')]();}exports[_0x3df2('0x44')]=function(_0x1455a0,_0x30bc6f){var _0x1cc6c5={},_0x26e42a={'count':0x0,'rows':[]};var _0x5e7c11=getUserAttributes();_0x1cc6c5=qs['getOptions'](_0x5e7c11,_0x1455a0);var _0x1fd6a4={'where':_0x1cc6c5[_0x3df2('0x45')]};return db['User'][_0x3df2('0x1d')](_0x1fd6a4)[_0x3df2('0x1f')](function(_0x4755e9){_0x26e42a[_0x3df2('0x1d')]=_0x4755e9;if(_0x1455a0[_0x3df2('0x46')][_0x3df2('0x47')]){_0x1cc6c5[_0x3df2('0x48')]=[{'all':!![]}];}if(_0x1455a0[_0x3df2('0x46')][_0x3df2('0x49')]===_0x3df2('0x4a')){_0x1cc6c5[_0x3df2('0x48')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_['includes'](_0x1cc6c5['attributes'],'id')){_0x1cc6c5[_0x3df2('0x4b')][_0x3df2('0x4c')]('id');}return db[_0x3df2('0x39')][_0x3df2('0x4d')](_0x1cc6c5);})[_0x3df2('0x1f')](function(_0x442596){_0x26e42a[_0x3df2('0x4e')]=_0x442596;if(_0x1455a0[_0x3df2('0x46')][_0x3df2('0x4f')]===_0x3df2('0x4a')){var _0x109be5=[];for(var _0x264570=0x0;_0x264570<_0x26e42a[_0x3df2('0x4e')][_0x3df2('0x50')];_0x264570++){_0x109be5[_0x3df2('0x4c')](get_open_tabs(_0x3df2('0x51'),_0x26e42a['rows'][_0x264570][_0x3df2('0x52')]));_0x109be5[_0x3df2('0x4c')](get_open_tabs(_0x3df2('0x53'),_0x26e42a[_0x3df2('0x4e')][_0x264570]['dataValues']));_0x109be5[_0x3df2('0x4c')](get_open_tabs(_0x3df2('0x54'),_0x26e42a['rows'][_0x264570][_0x3df2('0x52')]));_0x109be5[_0x3df2('0x4c')](get_open_tabs('mail',_0x26e42a[_0x3df2('0x4e')][_0x264570]['dataValues']));_0x109be5[_0x3df2('0x4c')](get_open_tabs('openchannel',_0x26e42a[_0x3df2('0x4e')][_0x264570][_0x3df2('0x52')]));_0x109be5[_0x3df2('0x4c')](get_open_tabs('whatsapp',_0x26e42a['rows'][_0x264570][_0x3df2('0x52')]));}return Promise[_0x3df2('0x55')](_0x109be5)['then'](function(){return _0x26e42a;});}else{return _0x26e42a;}})['then'](respondWithFilteredResult(_0x30bc6f,_0x1cc6c5))[_0x3df2('0x56')](handleError(_0x30bc6f,null));};exports[_0x3df2('0x57')]=function(_0x1562c8,_0x5e244a){var _0xeff8dc=getUserAttributes();_0x1562c8[_0x3df2('0x46')]['id']=_0x1562c8[_0x3df2('0x58')]['id'];var _0x44b585=qs[_0x3df2('0x59')](_0xeff8dc,_0x1562c8);if(_0x1562c8[_0x3df2('0x46')]['includeAll']){_0x44b585['include']=[{'all':!![]}];}if(_0x1562c8['query'][_0x3df2('0x49')]==='true'){_0x44b585['include']=[{'model':db['UserSetting'],'as':_0x3df2('0x49')}];}_0x44b585=_['merge']({},_0x44b585,_0x1562c8[_0x3df2('0x5a')]);if(!_[_0x3df2('0x35')](_0x44b585[_0x3df2('0x4b')],'id')){_0x44b585[_0x3df2('0x4b')][_0x3df2('0x4c')]('id');}return db[_0x3df2('0x39')][_0x3df2('0x5b')](_0x44b585)[_0x3df2('0x1f')](handleEntityNotFound(_0x5e244a,null))[_0x3df2('0x1f')](function(_0xc8ecd5){var _0x59761f=[];values=_0xc8ecd5;if(_0x1562c8[_0x3df2('0x46')][_0x3df2('0x4f')]===_0x3df2('0x4a')){_0x59761f['push'](get_open_tabs(_0x3df2('0x51'),_0xc8ecd5[_0x3df2('0x52')]));_0x59761f['push'](get_open_tabs(_0x3df2('0x53'),_0xc8ecd5[_0x3df2('0x52')]));_0x59761f[_0x3df2('0x4c')](get_open_tabs('openchannel',_0xc8ecd5[_0x3df2('0x52')]));_0x59761f['push'](get_open_tabs(_0x3df2('0x5c'),_0xc8ecd5[_0x3df2('0x52')]));_0x59761f[_0x3df2('0x4c')](get_open_tabs('fax',_0xc8ecd5[_0x3df2('0x52')]));_0x59761f['push'](get_open_tabs(_0x3df2('0x5d'),_0xc8ecd5[_0x3df2('0x52')]));return Promise[_0x3df2('0x55')](_0x59761f);}else{return values;}})[_0x3df2('0x1f')](function(){return values;})[_0x3df2('0x1f')](respondWithResult(_0x5e244a,null))['catch'](handleError(_0x5e244a,null));};exports[_0x3df2('0x28')]=function(_0x3dd685,_0x2743b3){if(_0x3dd685[_0x3df2('0x5e')]['id']){delete _0x3dd685[_0x3df2('0x5e')]['id'];}delete _0x3dd685[_0x3df2('0x5e')]['role'];return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x3dd685['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x2743b3,null))['then'](saveUpdates(_0x3dd685[_0x3df2('0x5e')],null))[_0x3df2('0x1f')](respondWithResult(_0x2743b3,null))['catch'](handleError(_0x2743b3,null));};exports['describe']=function(_0x5a017a,_0x40f9fc){return db[_0x3df2('0x39')]['describe']()['then'](respondWithResult(_0x40f9fc,null))['catch'](handleError(_0x40f9fc,null));};exports['addContacts']=function(_0x4943b3,_0x3310d3){return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x4943b3['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x3310d3,null))[_0x3df2('0x1f')](function(_0x372076){if(_0x372076){return _0x372076[_0x3df2('0x5f')](_0x4943b3[_0x3df2('0x5e')][_0x3df2('0x60')],_[_0x3df2('0x61')](_0x4943b3[_0x3df2('0x5e')],[_0x3df2('0x60'),'id'])||{});}})['then'](respondWithResult(_0x3310d3,null))[_0x3df2('0x56')](handleError(_0x3310d3,null));};function validateUser(_0x4ba81f){return new Promise(function(_0x2c9b27,_0x3db065){if(_0x4ba81f[_0x3df2('0x62')])return _0x2c9b27(_0x4ba81f);return db['Setting'][_0x3df2('0x63')](0x1)[_0x3df2('0x1f')](function(_0x4e47c8){if(_0x4e47c8[_0x3df2('0x64')])authService['validatePasswordPattern'](_0x4ba81f['password']);db['User'][_0x3df2('0x65')](_0x3df2('0x62'))[_0x3df2('0x1f')](function(_0x5d5074){if(_[_0x3df2('0x66')](_0x5d5074)){_0x4ba81f['internal']=_0x4e47c8['min_internal']||0x1;return;}if(_[_0x3df2('0x66')](_0x4e47c8[_0x3df2('0x67')])||_0x4e47c8[_0x3df2('0x67')]===_0x5d5074){_0x4ba81f[_0x3df2('0x62')]=_0x5d5074+0x1;return;}if(_0x4e47c8[_0x3df2('0x67')]>_0x5d5074){_0x4ba81f[_0x3df2('0x62')]=_0x4e47c8['min_internal'];return;}return db[_0x3df2('0x68')][_0x3df2('0x46')](_0x3df2('0x69'),{'type':db[_0x3df2('0x68')][_0x3df2('0x6a')][_0x3df2('0x6b')]})[_0x3df2('0x1f')](function(_0x22ba01){if(_0x22ba01&&_0x22ba01[_0x3df2('0x50')]){for(var _0xd92f98=0x0,_0x42c94e=_0x22ba01['length'];_0xd92f98<_0x42c94e&&_[_0x3df2('0x66')](_0x4ba81f[_0x3df2('0x62')]);_0xd92f98++){if(_0x4e47c8['min_internal']<=_0x22ba01[_0xd92f98][_0x3df2('0x6c')]){_0x4ba81f[_0x3df2('0x62')]=_0x22ba01[_0xd92f98]['from'];}else if(_0x4e47c8[_0x3df2('0x67')]>_0x22ba01[_0xd92f98][_0x3df2('0x6c')]&&_0x4e47c8[_0x3df2('0x67')]<=_0x22ba01[_0xd92f98]['to']){_0x4ba81f['internal']=_0x4e47c8[_0x3df2('0x67')];}}}if(_[_0x3df2('0x66')](_0x4ba81f['internal'])){_0x4ba81f[_0x3df2('0x62')]=_0x5d5074+0x1;}return _0x2c9b27(_0x4ba81f);});});})[_0x3df2('0x56')](function(_0x22c4cd){_0x3db065(_0x22c4cd);});});}function updateUser(_0x4c88a0){return new Promise(function(_0x5a586c,_0x148a87){try{if(_0x4c88a0[_0x3df2('0x6d')]){_0x4c88a0[_0x3df2('0x6e')]=_0x4c88a0[_0x3df2('0x62')];_0x4c88a0[_0x3df2('0x6f')]={'mailbox':_0x4c88a0[_0x3df2('0x62')],'password':_0x4c88a0[_0x3df2('0x3e')],'fullname':_0x4c88a0[_0x3df2('0x70')],'email':_0x4c88a0['email']};}if(_0x4c88a0[_0x3df2('0x2d')]==='agent'){if(!_0x4c88a0[_0x3df2('0x71')])_0x4c88a0['permissions']=[_0x3df2('0x72'),'102',_0x3df2('0x73'),'113','110',_0x3df2('0x74'),_0x3df2('0x75'),_0x3df2('0x76'),_0x3df2('0x77'),'108',_0x3df2('0x78'),'100',_0x3df2('0x79'),_0x3df2('0x7a'),'115'];}_0x5a586c(_0x4c88a0);}catch(_0x2f25d9){_0x148a87(_0x2f25d9);}});}exports[_0x3df2('0x7b')]=function(_0x76115f,_0xb736b){if(_0x76115f[_0x3df2('0x2e')]['role']==='agent')throw new Error('Unauthorized');if(_0x76115f[_0x3df2('0x5e')][_0x3df2('0x2d')]===_0x3df2('0x2e')&&_0x76115f[_0x3df2('0x2e')][_0x3df2('0x2d')]!==_0x3df2('0x7c')){throw new Error(_0x3df2('0x7d'));}if(_0x76115f[_0x3df2('0x5e')][_0x3df2('0x2d')]==='admin'&&_0x76115f['user'][_0x3df2('0x2d')]!==_0x3df2('0x7c')){throw new Error(_0x3df2('0x7e'));}return licenseUtil[_0x3df2('0x7f')]([_0x76115f['body']])[_0x3df2('0x1f')](function(){return validateUser(_0x76115f[_0x3df2('0x5e')]);})['then'](function(_0x51685c){return updateUser(_0x51685c)['then'](function(_0xa1c276){if(_0xa1c276[_0x3df2('0x2d')]===_0x3df2('0x7c')){_0xa1c276[_0x3df2('0x80')]=_0x76115f['user'][_0x3df2('0x80')];delete _0xa1c276[_0x3df2('0x81')];}return _0xa1c276;});})[_0x3df2('0x1f')](function(_0xf85b39){return db[_0x3df2('0x39')][_0x3df2('0x7b')](_0xf85b39,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x3df2('0x1f')](function(_0x4390bb){if(_0x76115f['body'][_0x3df2('0x2d')]===_0x3df2('0x2e'))return _0x4390bb;if(_0x76115f[_0x3df2('0x2e')][_0x3df2('0x2d')]!=='user')return _0x4390bb;return db[_0x3df2('0x82')][_0x3df2('0x5b')]({'where':{'name':_0x4390bb[_0x3df2('0x2d')]===_0x3df2('0x29')?_0x3df2('0x2f'):_0x3df2('0x30'),'userProfileId':_0x76115f[_0x3df2('0x2e')]['userProfileId']},'raw':!![]})[_0x3df2('0x1f')](function(_0x3f3cbf){if(!_0x3f3cbf||_0x3f3cbf[_0x3df2('0x83')]!=0x0)return _0x4390bb;return db['UserProfileResource'][_0x3df2('0x7b')]({'name':_0x4390bb[_0x3df2('0x36')],'resourceId':_0x4390bb['id'],'type':_0x3f3cbf[_0x3df2('0x36')],'sectionId':_0x3f3cbf['id']},{})['then'](function(){return _0x4390bb;});})[_0x3df2('0x56')](function(_0x41b792){logger[_0x3df2('0x25')](_0x3df2('0x84'),_0x41b792);throw _0x41b792;});})[_0x3df2('0x1f')](respondWithResult(_0xb736b,0xc9))[_0x3df2('0x56')](handleError(_0xb736b,null));};exports[_0x3df2('0x85')]=function(_0x4a2f08,_0x3e3f45){var _0x4651a4=_0x4a2f08[_0x3df2('0x5e')];var _0x1c1e17=[];if(_0x4a2f08[_0x3df2('0x2e')]['role']===_0x3df2('0x29'))throw new Error(_0x3df2('0x86'));if(_['some'](_0x4651a4,['role',_0x3df2('0x2e')])&&_0x4a2f08[_0x3df2('0x2e')][_0x3df2('0x2d')]!=='admin'){throw new Error(_0x3df2('0x7d'));}if(_[_0x3df2('0x87')](_0x4651a4,[_0x3df2('0x2d'),_0x3df2('0x7c')])&&_0x4a2f08[_0x3df2('0x2e')][_0x3df2('0x2d')]!==_0x3df2('0x7c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x3df2('0x7f')](_0x4651a4)[_0x3df2('0x1f')](function(){return validateUser(_0x4651a4[0x0]);})[_0x3df2('0x1f')](function(){for(var _0x54f231=0x1;_0x54f231<_0x4651a4[_0x3df2('0x50')];_0x54f231++){var _0x510c41=_0x4651a4[_0x54f231-0x1][_0x3df2('0x62')];if(!_0x4651a4[_0x54f231]['internal'])_0x4651a4[_0x54f231]['internal']=_0x510c41+0x1;_0x1c1e17['push'](validateUser(_0x4651a4[_0x54f231]));}return Promise[_0x3df2('0x55')](_0x1c1e17);})[_0x3df2('0x1f')](function(){_0x1c1e17=[];for(var _0x39b89b=0x0;_0x39b89b<_0x4651a4[_0x3df2('0x50')];_0x39b89b++){_0x1c1e17['push'](updateUser(_0x4651a4[_0x39b89b]));}return Promise[_0x3df2('0x55')](_0x1c1e17);})[_0x3df2('0x1f')](function(){_0x1c1e17=_0x4651a4[_0x3df2('0x33')](function(_0x459e6d){return db['User']['create'](_0x459e6d,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})['then'](function(_0x2f4f89){_0x459e6d['id']=_0x2f4f89['id'];return _0x459e6d;});});return Promise[_0x3df2('0x55')](_0x1c1e17);})[_0x3df2('0x1f')](function(_0x49bd4f){if(_0x4a2f08[_0x3df2('0x5e')][_0x3df2('0x2d')]===_0x3df2('0x2e'))return _0x49bd4f;if(_0x4a2f08[_0x3df2('0x2e')][_0x3df2('0x2d')]!==_0x3df2('0x2e'))return _0x49bd4f;var _0x59c0c9=_['some'](_0x49bd4f,function(_0x2a31d9){return _0x2a31d9[_0x3df2('0x2d')]==='agent'||_0x2a31d9['role']==='telephone';});if(!_0x59c0c9)return _0x49bd4f;return db[_0x3df2('0x82')][_0x3df2('0x4d')]({'where':{'name':{'$or':[_0x3df2('0x2f'),_0x3df2('0x30')]},'userProfileId':_0x4a2f08[_0x3df2('0x2e')][_0x3df2('0x81')]},'raw':!![]})[_0x3df2('0x1f')](function(_0x3e1b07){if(_[_0x3df2('0x88')](_0x3e1b07)||!_['some'](_0x3e1b07,[_0x3df2('0x83'),0x0]))return _0x49bd4f;_0x1c1e17=[];var _0x1f6b34=_(_0x3e1b07)[_0x3df2('0x33')](function(_0x50c409){if(_0x50c409['autoAssociation']===0x1)return;return _0x50c409[_0x3df2('0x36')]===_0x3df2('0x2f')?_0x3df2('0x29'):_0x3df2('0x31');})[_0x3df2('0x89')]()[_0x3df2('0x34')]();for(var _0x355b84=0x0;_0x355b84<_0x49bd4f[_0x3df2('0x50')];_0x355b84++){if(!_['includes'](_0x1f6b34,_0x49bd4f[_0x355b84]['role']))return;var _0x3b396b=_0x49bd4f[_0x355b84]['role']===_0x3df2('0x29')?_0x3df2('0x2f'):_0x3df2('0x30');_0x1c1e17['push'](db['UserProfileResource'][_0x3df2('0x7b')]({'name':_0x49bd4f[_0x355b84][_0x3df2('0x36')],'resourceId':_0x49bd4f[_0x355b84]['id'],'type':_0x3b396b,'sectionId':_[_0x3df2('0x5b')](_0x3e1b07,[_0x3df2('0x36'),_0x3b396b])['id']},{}));}return Promise[_0x3df2('0x55')](_0x1c1e17);});})[_0x3df2('0x1f')](respondWithResult(_0x3e3f45,0xc9))[_0x3df2('0x56')](handleError(_0x3e3f45,null));};exports[_0x3df2('0x8a')]=function(_0x40d0f9,_0x221d67){if(_0x40d0f9[_0x3df2('0x5e')]['id']){delete _0x40d0f9[_0x3df2('0x5e')]['id'];}return db[_0x3df2('0x39')]['find']({'where':{'id':_0x40d0f9[_0x3df2('0x58')]['id']}})['then'](function(_0x5a9d8d){if(!_0x5a9d8d)return null;if(_0x5a9d8d['id']===_0x40d0f9[_0x3df2('0x2e')]['id']){if(!_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8b')]||!_0x40d0f9['body'][_0x3df2('0x8c')]){throw new db['Sequelize'][(_0x3df2('0x8d'))](_0x3df2('0x8e'));}if(!_0x5a9d8d[_0x3df2('0x8f')](_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8b')])){throw new db['Sequelize'][(_0x3df2('0x8d'))]('Wrong\x20credentials');}if(_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8b')]===_0x40d0f9['body']['newPassword']){throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x40d0f9[_0x3df2('0x2e')][_0x3df2('0x2d')]===_0x3df2('0x7c')){if(!_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8c')]){throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x40d0f9[_0x3df2('0x2e')][_0x3df2('0x2d')]===_0x3df2('0x2e')){if(!_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8c')]){throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))](_0x3df2('0x91'));}if(_0x5a9d8d[_0x3df2('0x2d')]!=='agent'){throw new db[(_0x3df2('0x90'))]['ValidationError'](_0x3df2('0x86'));}}else{throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))](_0x3df2('0x86'));}return _0x5a9d8d;})[_0x3df2('0x1f')](handleEntityNotFound(_0x221d67,null))[_0x3df2('0x1f')](function(_0x397389){return db[_0x3df2('0x92')][_0x3df2('0x93')]({'attributes':['id','securePassword',_0x3df2('0x94'),_0x3df2('0x95')]})['then'](function(_0x51ab8c){if(_0x51ab8c[_0x3df2('0x64')])authService['validatePasswordPattern'](_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8c')]);if(!_0x51ab8c[_0x3df2('0x94')]||!_0x397389[_0x3df2('0x40')])return _0x397389;authService[_0x3df2('0x96')](_0x40d0f9['body'][_0x3df2('0x8c')],_0x397389[_0x3df2('0x40')],_0x51ab8c[_0x3df2('0x95')]);return _0x397389;})[_0x3df2('0x1f')](saveUpdates({'password':_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8c')],'passwordResetAt':_0x40d0f9['user']['id']==_0x40d0f9[_0x3df2('0x58')]['id']?moment():null,'previousPasswords':authService[_0x3df2('0x97')](_0x40d0f9[_0x3df2('0x5e')]['newPassword'],_0x397389['previousPasswords'])},null));})['then'](respondWithResult(_0x221d67,null))[_0x3df2('0x56')](handleError(_0x221d67,null));};exports[_0x3df2('0x98')]=function(_0x185ab3,_0x35bd26){var _0x252398=_0x185ab3[_0x3df2('0x5e')][_0x3df2('0x99')];return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x185ab3[_0x3df2('0x58')]['id']},'attributes':['id',_0x3df2('0x36'),_0x3df2('0x2d'),'online',_0x3df2('0x9a'),_0x3df2('0x9b'),'interface']})['then'](handleEntityNotFound(_0x35bd26,null))[_0x3df2('0x1f')](function(_0x374f44){if(_0x374f44){if(!utils[_0x3df2('0x9c')](_0x252398)){throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))](_0x3df2('0x9d'));}return _0x374f44['add'+_['capitalize'](_0x252398[_0x3df2('0x9e')]())+_0x3df2('0x9f')](_0x185ab3['body'][_0x3df2('0x60')],{'penalty':_0x185ab3['body'][_0x3df2('0xa0')]||0x0})['spread'](function(_0x1718bb){for(var _0x847158=0x0;_0x847158<_0x185ab3['body'][_0x3df2('0x60')][_0x3df2('0x50')];_0x847158+=0x1){var _0x1e11ac={'UserId':Number(_0x185ab3[_0x3df2('0x58')]['id'])};_0x1e11ac[_[_0x3df2('0xa1')](_0x252398[_0x3df2('0x9e')]())+_0x3df2('0xa2')]=Number(_0x185ab3[_0x3df2('0x5e')][_0x3df2('0x60')][_0x847158]);socket[_0x3df2('0x2a')](_0x3df2('0x2e')+_[_0x3df2('0xa1')](_0x252398[_0x3df2('0x9e')]())+_0x3df2('0xa3'),_0x1e11ac);}return _0x1718bb;})[_0x3df2('0x1f')](function(){if(_0x252398===_0x3df2('0xa4')){return db[_0x3df2('0xa5')][_0x3df2('0x4d')]({'where':{'id':_0x185ab3[_0x3df2('0x5e')][_0x3df2('0x60')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x3df2('0x1f')](function(_0x2f1b14){var _0x3ab534=_0x374f44[_0x3df2('0x2c')]({'plain':!![]});var _0x543b7c=[];if(_0x252398===_0x3df2('0xa4')&&_0x3ab534['role']==='agent'&&_0x3ab534['online']){for(let _0x1776d3=0x0;_0x1776d3<_0x2f1b14[_0x3df2('0x50')];_0x1776d3+=0x1){_0x543b7c[_0x3df2('0x4c')]({'membername':_0x3ab534[_0x3df2('0x36')],'UserId':_0x3ab534['id'],'queue_name':_0x2f1b14[_0x1776d3][_0x3df2('0x36')],'VoiceQueueId':_0x2f1b14[_0x1776d3]['id'],'interface':_[_0x3df2('0x66')](_0x3ab534['interface'])?util['format'](_0x3df2('0xa6'),_0x3ab534[_0x3df2('0x36')]):_0x3ab534[_0x3df2('0xa7')],'paused':_0x3ab534[_0x3df2('0x9b')]||![],'penalty':_0x185ab3[_0x3df2('0x5e')][_0x3df2('0xa0')]||0x0});}return Promise[_0x3df2('0x55')](_0x543b7c[_0x3df2('0x33')](function(_0x32aced){return db[_0x3df2('0xa8')][_0x3df2('0xa9')](_0x32aced);}));}return _0x374f44;});}})[_0x3df2('0x1f')](respondWithStatusCode(_0x35bd26,null))['catch'](handleError(_0x35bd26,null));};exports['removeQueues']=function(_0x247079,_0x58b011){var _0xca71b9,_0x3df639;return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x247079['params']['id']},'attributes':['id','name',_0x3df2('0x2d')]})['then'](handleEntityNotFound(_0x58b011,null))[_0x3df2('0x1f')](function(_0x11c339){if(_0x11c339){_0xca71b9=_0x11c339;if(!_0x247079[_0x3df2('0x46')][_0x3df2('0x99')]||!utils[_0x3df2('0x9c')](_0x247079['query']['channel'])){throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))](_0x3df2('0x9d'));}return _0x11c339[_0x3df2('0xaa')+_[_0x3df2('0xa1')](_0x247079[_0x3df2('0x46')][_0x3df2('0x99')][_0x3df2('0x9e')]())+'Queues'](_0x247079['query'][_0x3df2('0x60')]);}})['then'](function(_0x4cb519){if(_[_0x3df2('0xab')](_0x247079[_0x3df2('0x46')][_0x3df2('0x60')])){for(var _0x2eb2cb=0x0;_0x2eb2cb<_0x247079[_0x3df2('0x46')][_0x3df2('0x60')][_0x3df2('0x50')];_0x2eb2cb+=0x1){_0x3df639={'UserId':Number(_0x247079[_0x3df2('0x58')]['id'])};_0x3df639[_[_0x3df2('0xa1')](_0x247079[_0x3df2('0x46')][_0x3df2('0x99')]['toLowerCase']())+_0x3df2('0xa2')]=Number(_0x247079[_0x3df2('0x46')]['ids'][_0x2eb2cb]);socket[_0x3df2('0x2a')]('user'+_['capitalize'](_0x247079[_0x3df2('0x46')][_0x3df2('0x99')][_0x3df2('0x9e')]())+_0x3df2('0xac'),_0x3df639);}}else{_0x3df639={'UserId':Number(_0x247079[_0x3df2('0x58')]['id'])};_0x3df639[_[_0x3df2('0xa1')](_0x247079[_0x3df2('0x46')][_0x3df2('0x99')][_0x3df2('0x9e')]())+_0x3df2('0xa2')]=Number(_0x247079[_0x3df2('0x46')][_0x3df2('0x60')]);socket[_0x3df2('0x2a')](_0x3df2('0x2e')+_[_0x3df2('0xa1')](_0x247079[_0x3df2('0x46')][_0x3df2('0x99')][_0x3df2('0x9e')]())+_0x3df2('0xac'),_0x3df639);}return _0x4cb519;})[_0x3df2('0x1f')](function(){if(_0x247079[_0x3df2('0x46')][_0x3df2('0x99')]==='voice'){return db['UserVoiceQueueRt'][_0x3df2('0x2b')]({'where':{'UserId':_0x247079[_0x3df2('0x58')]['id'],'VoiceQueueId':_0x247079[_0x3df2('0x46')]['ids']},'individualHooks':!![]})[_0x3df2('0x1f')](function(){return _0xca71b9;});}return _0xca71b9;})[_0x3df2('0x1f')](respondWithStatusCode(_0x58b011,null))[_0x3df2('0x56')](handleError(_0x58b011,null));};exports[_0x3df2('0xad')]=function(_0x1e4e2d,_0x544c9d){_0x1e4e2d[_0x3df2('0x5e')][_0x3df2('0xae')]=_0x1e4e2d[_0x3df2('0xaf')][_0x3df2('0xb0')];return db[_0x3df2('0x39')]['find']({'where':{'id':_0x1e4e2d[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x544c9d,null))[_0x3df2('0x1f')](saveUpdates(_0x1e4e2d[_0x3df2('0x5e')],null))[_0x3df2('0x1f')](respondWithResult(_0x544c9d,null))['catch'](handleError(_0x544c9d,null));};exports[_0x3df2('0xb1')]=function(_0x57d998,_0x484173){var _0x1086a6=path['join'](config[_0x3df2('0xb2')],'server/files/images/logos/default_profile.png');return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x57d998[_0x3df2('0x58')]['id']},'attributes':['id',_0x3df2('0xae')],'raw':!![]})[_0x3df2('0x1f')](handleEntityNotFound(_0x484173,null))['then'](function(_0x109f78){if(_0x109f78){if(_['isNil'](_0x109f78[_0x3df2('0xae')])){return _0x484173['download'](_0x1086a6);}else{if(!fs['existsSync'](path[_0x3df2('0xb3')](config[_0x3df2('0xb2')],_0x3df2('0xb4'),_0x109f78[_0x3df2('0xae')]))){return _0x484173[_0x3df2('0xb5')](_0x1086a6);}return _0x484173[_0x3df2('0xb5')](path[_0x3df2('0xb3')](config[_0x3df2('0xb2')],'server/files/images/',_0x109f78[_0x3df2('0xae')]));}}})['catch'](handleError(_0x484173,null));};exports[_0x3df2('0xb6')]=function(_0x596a74,_0xb8881d){return db['User']['find']({'where':{'id':_0x596a74['params']['id']},'attributes':['id']})[_0x3df2('0x1f')](handleEntityNotFound(_0xb8881d,null))[_0x3df2('0x1f')](function(_0x2943d8){var _0xbeb913=[];values=_0x2943d8['dataValues'];_0xbeb913['push'](get_open_tabs(_0x3df2('0x51'),_0x2943d8[_0x3df2('0x52')]));_0xbeb913['push'](get_open_tabs(_0x3df2('0x53'),_0x2943d8['dataValues']));_0xbeb913['push'](get_open_tabs(_0x3df2('0xb7'),_0x2943d8[_0x3df2('0x52')]));_0xbeb913[_0x3df2('0x4c')](get_open_tabs(_0x3df2('0x5c'),_0x2943d8[_0x3df2('0x52')]));_0xbeb913['push'](get_open_tabs(_0x3df2('0x54'),_0x2943d8[_0x3df2('0x52')]));_0xbeb913['push'](get_open_tabs(_0x3df2('0x5d'),_0x2943d8[_0x3df2('0x52')]));return Promise[_0x3df2('0x55')](_0xbeb913);})['then'](function(_0x56ded1){if(_0x56ded1){var _0x17c25b=_[_0x3df2('0x33')](values[_0x3df2('0xb8')],function(_0x522e35){return{'channel':_0x3df2('0xb9'),'id':_0x522e35['id'],'createdAt':_0x522e35[_0x3df2('0xba')]};});var _0x48ee84=_['map'](values[_0x3df2('0xbb')],function(_0x3a5708){return{'channel':_0x3df2('0xbc'),'id':_0x3a5708['id'],'createdAt':_0x3a5708['createdAt']};});var _0x3cd629=_[_0x3df2('0x33')](values['OpenchannelOpenTabs'],function(_0x59737c){return{'channel':_0x3df2('0xbd'),'id':_0x59737c['id'],'createdAt':_0x59737c[_0x3df2('0xba')]};});var _0x4dbbee=_['map'](values[_0x3df2('0xbe')],function(_0xc0e911){return{'channel':_0x3df2('0xbf'),'id':_0xc0e911['id'],'createdAt':_0xc0e911['createdAt']};});var _0x2f498d=_[_0x3df2('0x33')](values[_0x3df2('0xc0')],function(_0x17ea40){return{'channel':'SMS','id':_0x17ea40['id'],'createdAt':_0x17ea40['createdAt']};});var _0x204dff=_['map'](values[_0x3df2('0xc1')],function(_0x2506cf){return{'channel':_0x3df2('0xc2'),'id':_0x2506cf['id'],'createdAt':_0x2506cf[_0x3df2('0xba')]};});var _0x41cc19=_[_0x3df2('0xc3')](_0x17c25b,_0x48ee84,_0x3cd629,_0x4dbbee,_0x2f498d,_0x204dff);var _0x2dae37={'count':_0x41cc19[_0x3df2('0x50')],'rows':_0x41cc19};return _0x2dae37;}else return null;})[_0x3df2('0x1f')](respondWithResult(_0xb8881d,null))[_0x3df2('0x56')](handleError(_0xb8881d,null));};exports[_0x3df2('0xc4')]=function(_0x58f152,_0x1f20f9){var _0x118edb={};return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x58f152[_0x3df2('0x58')]['id']}})['then'](function(_0x1f4094){if(!_0x1f4094){throw new APINotFoundError(util['format'](_0x3df2('0xc5'),_0x58f152[_0x3df2('0x58')]['id']));}return contacts[_0x3df2('0xc6')]();})[_0x3df2('0x1f')](function(_0x14aee5){_0x58f152[_0x3df2('0x46')]['User']=_0x58f152[_0x3df2('0x58')]['id'];_0x118edb=qs[_0x3df2('0x59')](_0x14aee5,_0x58f152);if(_0x58f152[_0x3df2('0x46')]['hasOwnProperty'](_0x3df2('0x47'))){_0x118edb['include']=[{'model':db[_0x3df2('0xc7')],'as':_0x3df2('0xc8'),'required':![]},{'model':db[_0x3df2('0xc9')],'as':_0x3df2('0xca'),'attributes':['id',_0x3df2('0x36'),'color'],'where':_0x58f152[_0x3df2('0x46')]['tag']?{'id':_0x58f152[_0x3df2('0x46')][_0x3df2('0xcb')]}:undefined,'required':_0x58f152[_0x3df2('0x46')][_0x3df2('0xcb')]?!![]:![]}];}return contacts[_0x3df2('0x4d')](_0x58f152[_0x3df2('0x46')],_0x58f152[_0x3df2('0x2e')],_0x118edb,_0x14aee5);})[_0x3df2('0x1f')](respondWithFilteredResult(_0x1f20f9,_0x118edb))[_0x3df2('0x56')](APIHandleError(_0x1f20f9));};exports[_0x3df2('0xcc')]=function(_0x38db5b,_0xd5e36){var _0x559bdf;var _0x3d3820={};var _0x2ec743;return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x38db5b[_0x3df2('0x58')]['id']},'attributes':['id',_0x3df2('0x36'),_0x3df2('0x2d')]})[_0x3df2('0x1f')](handleEntityNotFound(_0xd5e36,null))[_0x3df2('0x1f')](function(_0x1d0895){if(!utils[_0x3df2('0x9c')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0x99')])){throw new db[(_0x3df2('0x90'))]['ValidationError'](_0x3df2('0x9d'));}_0x559bdf=_0x1d0895;var _0x1a3c39={};_0x1a3c39[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_[_0x3df2('0xa1')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0x99')])+_0x3df2('0xcf')][_0x3df2('0x3a')]);_0x1a3c39[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x38db5b[_0x3df2('0x46')]);_0x1a3c39['filters']=_[_0x3df2('0xd0')](_0x1a3c39[_0x3df2('0xcd')],_0x1a3c39[_0x3df2('0x46')]);_0x3d3820[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x1a3c39[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0xd1')]));_0x3d3820['attributes']=_0x3d3820[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x3d3820['attributes']:_0x1a3c39[_0x3df2('0xcd')];_0x3d3820[_0x3df2('0xd2')]=qs[_0x3df2('0xd3')](_0x38db5b[_0x3df2('0x46')]['sort']);_0x3d3820[_0x3df2('0x45')]=qs['filters'](_[_0x3df2('0xd4')](_0x38db5b[_0x3df2('0x46')],_0x1a3c39[_0x3df2('0xd5')]));if(_0x38db5b[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x3d3820[_0x3df2('0x45')]=_['merge'](_0x3d3820[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x3d3820[_0x3df2('0x4b')],function(_0x2dc1cf){var _0x999e6={};_0x999e6[_0x2dc1cf]={'$like':'%'+_0x38db5b[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x999e6;})});}_0x3d3820=_[_0x3df2('0xd6')]({},_0x3d3820,_0x38db5b[_0x3df2('0x5a')]);switch(_0x559bdf['role']){case _0x3df2('0x7c'):return db[_[_0x3df2('0xa1')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0x99')])+_0x3df2('0xcf')][_0x3df2('0x4d')](_0x3d3820);case _0x3df2('0x2e'):case _0x3df2('0x29'):return _0x559bdf[_0x3df2('0x2c')+_[_0x3df2('0xa1')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0x99')])+'Queues'](_0x3d3820);default:throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))](_0x3df2('0xd7'));}})[_0x3df2('0x1f')](function(_0x1be815){_0x2ec743=_0x1be815['length'];if(!_0x38db5b['query'][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0x3d3820['limit']=qs[_0x3df2('0x1c')](_0x38db5b['query'][_0x3df2('0x1c')]);_0x3d3820['offset']=qs[_0x3df2('0x1a')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0x1a')]);}switch(_0x559bdf['role']){case _0x3df2('0x7c'):return db[_[_0x3df2('0xa1')](_0x38db5b['query'][_0x3df2('0x99')])+_0x3df2('0xcf')]['findAll'](_0x3d3820);case _0x3df2('0x2e'):case _0x3df2('0x29'):return _0x559bdf[_0x3df2('0x2c')+_[_0x3df2('0xa1')](_0x38db5b['query'][_0x3df2('0x99')])+_0x3df2('0x9f')](_0x3d3820);}})[_0x3df2('0x1f')](function(_0x3e863c){return{'count':_0x2ec743,'rows':_0x3e863c};})[_0x3df2('0x1f')](respondWithResult(_0xd5e36,null))[_0x3df2('0x56')](handleError(_0xd5e36,null));};exports[_0x3df2('0xda')]=function(_0x2cd29b,_0x4dbd71){var _0x16dd70={};var _0xfa6b8b={};var _0x589bf4;var _0x3f4a68;return db['User'][_0x3df2('0x93')]({'where':{'id':_0x2cd29b['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x4dbd71,null))[_0x3df2('0x1f')](function(_0x187767){if(_0x187767){_0x589bf4=_0x187767;_0xfa6b8b[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xa8')]['rawAttributes']);_0xfa6b8b['query']=_[_0x3df2('0xce')](_0x2cd29b[_0x3df2('0x46')]);_0xfa6b8b[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0xfa6b8b[_0x3df2('0xcd')],_0xfa6b8b[_0x3df2('0x46')]);_0x16dd70[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0xfa6b8b[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x2cd29b[_0x3df2('0x46')]['fields']));_0x16dd70[_0x3df2('0x4b')]=_0x16dd70[_0x3df2('0x4b')]['length']?_0x16dd70[_0x3df2('0x4b')]:_0xfa6b8b[_0x3df2('0xcd')];_0x16dd70['order']=qs[_0x3df2('0xd3')](_0x2cd29b[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x16dd70[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x2cd29b['query'],_0xfa6b8b[_0x3df2('0xd5')]));if(_0x2cd29b['query'][_0x3df2('0x3d')]){_0x16dd70[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x16dd70['where'],{'$or':_[_0x3df2('0x33')](_0x16dd70['attributes'],function(_0x32813d){var _0x2846df={};_0x2846df[_0x32813d]={'$like':'%'+_0x2cd29b[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x2846df;})});}_0x16dd70=_[_0x3df2('0xd6')]({},_0x16dd70,_0x2cd29b[_0x3df2('0x5a')]);return _0x589bf4['getVoiceQueuesRt'](_0x16dd70);}})['then'](function(_0x1570e3){if(_0x1570e3){_0x3f4a68=_0x1570e3[_0x3df2('0x50')];if(!_0x2cd29b[_0x3df2('0x46')]['hasOwnProperty'](_0x3df2('0xd9'))){_0x16dd70[_0x3df2('0x1c')]=qs['limit'](_0x2cd29b['query']['limit']);_0x16dd70[_0x3df2('0x1a')]=qs['offset'](_0x2cd29b['query']['offset']);}return _0x589bf4[_0x3df2('0xda')](_0x16dd70);}})[_0x3df2('0x1f')](function(_0x1c2169){if(_0x1c2169){return _0x1c2169?{'count':_0x3f4a68,'rows':_0x1c2169}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x4dbd71,null))['catch'](handleError(_0x4dbd71,null));};exports[_0x3df2('0xdb')]=function(_0x49b726,_0x530f66){var _0x3e8630={};var _0x148ac0={};var _0x59b877;var _0x1eb355;return db['User'][_0x3df2('0x93')]({'where':{'id':_0x49b726['params']['id']}})['then'](handleEntityNotFound(_0x530f66,null))['then'](function(_0x13c706){if(_0x13c706){_0x59b877=_0x13c706;_0x148ac0[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xdc')][_0x3df2('0x3a')]);_0x148ac0[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x49b726[_0x3df2('0x46')]);_0x148ac0[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x148ac0['model'],_0x148ac0[_0x3df2('0x46')]);_0x3e8630[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x148ac0['model'],qs[_0x3df2('0xd1')](_0x49b726[_0x3df2('0x46')]['fields']));_0x3e8630['attributes']=_0x3e8630[_0x3df2('0x4b')]['length']?_0x3e8630[_0x3df2('0x4b')]:_0x148ac0[_0x3df2('0xcd')];_0x3e8630[_0x3df2('0xd2')]=qs[_0x3df2('0xd3')](_0x49b726[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x3e8630[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_['pick'](_0x49b726[_0x3df2('0x46')],_0x148ac0['filters']));if(_0x49b726[_0x3df2('0x46')]['filter']){_0x3e8630[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x3e8630['where'],{'$or':_[_0x3df2('0x33')](_0x3e8630[_0x3df2('0x4b')],function(_0x278054){var _0xebb941={};_0xebb941[_0x278054]={'$like':'%'+_0x49b726['query'][_0x3df2('0x3d')]+'%'};return _0xebb941;})});}_0x3e8630=_[_0x3df2('0xd6')]({},_0x3e8630,_0x49b726[_0x3df2('0x5a')]);return _0x59b877[_0x3df2('0xdb')](_0x3e8630);}})[_0x3df2('0x1f')](function(_0x13d845){if(_0x13d845){_0x1eb355=_0x13d845[_0x3df2('0x50')];if(!_0x49b726[_0x3df2('0x46')]['hasOwnProperty'](_0x3df2('0xd9'))){_0x3e8630[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0x49b726[_0x3df2('0x46')]['limit']);_0x3e8630[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x49b726[_0x3df2('0x46')]['offset']);}return _0x59b877[_0x3df2('0xdb')](_0x3e8630);}})[_0x3df2('0x1f')](function(_0xe827fd){if(_0xe827fd){return _0xe827fd?{'count':_0x1eb355,'rows':_0xe827fd}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x530f66,null))[_0x3df2('0x56')](handleError(_0x530f66,null));};exports[_0x3df2('0xdd')]=function(_0x2e185c,_0xddb90b){var _0x17e7cf={'raw':!![],'where':{}};var _0x506855={};var _0xeabae={'count':0x0,'rows':[]};return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x2e185c[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0xddb90b,null))['then'](function(_0x525c43){if(_0x525c43){_0x506855[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db['VoiceRecording'][_0x3df2('0x3a')]);_0x506855[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x2e185c['query']);_0x506855[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x506855[_0x3df2('0xcd')],_0x506855[_0x3df2('0x46')]);_0x17e7cf[_0x3df2('0x4b')]=_['intersection'](_0x506855[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x2e185c[_0x3df2('0x46')][_0x3df2('0xd1')]));_0x17e7cf[_0x3df2('0x4b')]=_0x17e7cf[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x17e7cf['attributes']:_0x506855[_0x3df2('0xcd')];if(!_0x2e185c[_0x3df2('0x46')]['hasOwnProperty'](_0x3df2('0xd9'))){_0x17e7cf[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0x2e185c[_0x3df2('0x46')][_0x3df2('0x1c')]);_0x17e7cf['offset']=qs[_0x3df2('0x1a')](_0x2e185c['query'][_0x3df2('0x1a')]);}_0x17e7cf[_0x3df2('0xd2')]=qs['sort'](_0x2e185c[_0x3df2('0x46')]['sort']);_0x17e7cf['where']=qs['filters'](_[_0x3df2('0xd4')](_0x2e185c['query'],_0x506855[_0x3df2('0xd5')]));_0x17e7cf[_0x3df2('0x45')][_0x3df2('0xde')]=_0x525c43['id'];if(_0x2e185c[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x17e7cf[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x17e7cf[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x17e7cf[_0x3df2('0x4b')],function(_0x5abd5e){var _0xd731d1={};_0xd731d1[_0x5abd5e]={'$like':'%'+_0x2e185c[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0xd731d1;})});}_0x17e7cf=_[_0x3df2('0xd6')]({},_0x17e7cf,_0x2e185c['options']);return db['VoiceRecording'][_0x3df2('0x1d')]({'where':_0x17e7cf[_0x3df2('0x45')]})[_0x3df2('0x1f')](function(_0x4cf712){_0xeabae[_0x3df2('0x1d')]=_0x4cf712;if(_0x2e185c['query'][_0x3df2('0x47')]){_0x17e7cf[_0x3df2('0x48')]=[{'all':!![]}];}return db[_0x3df2('0xdf')][_0x3df2('0x4d')](_0x17e7cf);})['then'](function(_0x3ba114){_0xeabae['rows']=_0x3ba114;return _0xeabae;});}})[_0x3df2('0x1f')](respondWithFilteredResult(_0xddb90b,_0x17e7cf))['catch'](handleError(_0xddb90b,null));};exports['getScreenRecordings']=function(_0x39a446,_0x3da848){var _0x3d1556={'raw':!![],'where':{}};var _0x14c282={};var _0x387ee0={'count':0x0,'rows':[]};return db['User'][_0x3df2('0x93')]({'where':{'id':_0x39a446['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x3da848,null))['then'](function(_0x555e1d){if(_0x555e1d){_0x14c282[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db['ScreenRecording'][_0x3df2('0x3a')]);_0x14c282[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x39a446[_0x3df2('0x46')]);_0x14c282[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x14c282[_0x3df2('0xcd')],_0x14c282[_0x3df2('0x46')]);_0x3d1556['attributes']=_[_0x3df2('0xd0')](_0x14c282[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x39a446[_0x3df2('0x46')]['fields']));_0x3d1556[_0x3df2('0x4b')]=_0x3d1556['attributes'][_0x3df2('0x50')]?_0x3d1556[_0x3df2('0x4b')]:_0x14c282[_0x3df2('0xcd')];if(!_0x39a446[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0x3d1556['limit']=qs[_0x3df2('0x1c')](_0x39a446['query'][_0x3df2('0x1c')]);_0x3d1556[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x39a446[_0x3df2('0x46')]['offset']);}_0x3d1556[_0x3df2('0xd2')]=qs['sort'](_0x39a446[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x3d1556[_0x3df2('0x45')]=qs['filters'](_[_0x3df2('0xd4')](_0x39a446[_0x3df2('0x46')],_0x14c282[_0x3df2('0xd5')]));_0x3d1556[_0x3df2('0x45')][_0x3df2('0xde')]=_0x555e1d['id'];if(_0x39a446[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x3d1556[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x3d1556[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x3d1556[_0x3df2('0x4b')],function(_0x36156c){var _0x56ed20={};_0x56ed20[_0x36156c]={'$like':'%'+_0x39a446[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x56ed20;})});}_0x3d1556=_[_0x3df2('0xd6')]({},_0x3d1556,_0x39a446['options']);return db[_0x3df2('0xe0')][_0x3df2('0x1d')]({'where':_0x3d1556[_0x3df2('0x45')]})['then'](function(_0x4ebfae){_0x387ee0[_0x3df2('0x1d')]=_0x4ebfae;if(_0x39a446['query'][_0x3df2('0x47')]){_0x3d1556['include']=[{'all':!![]}];}return db[_0x3df2('0xe0')][_0x3df2('0x4d')](_0x3d1556);})[_0x3df2('0x1f')](function(_0x186dfd){_0x387ee0[_0x3df2('0x4e')]=_0x186dfd;return _0x387ee0;});}})[_0x3df2('0x1f')](respondWithFilteredResult(_0x3da848,_0x3d1556))[_0x3df2('0x56')](handleError(_0x3da848,null));};exports[_0x3df2('0xe1')]=function(_0x3862dd,_0x2cdc9e){var _0x4a7dd1={};var _0x3045af={};var _0x278166;var _0x188407;return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x3862dd[_0x3df2('0x58')]['id']}})['then'](handleEntityNotFound(_0x2cdc9e,null))[_0x3df2('0x1f')](function(_0x1ec4e3){if(_0x1ec4e3){_0x278166=_0x1ec4e3;_0x3045af[_0x3df2('0xcd')]=_['keys'](db[_0x3df2('0xe2')][_0x3df2('0x3a')]);_0x3045af[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x3862dd[_0x3df2('0x46')]);_0x3045af[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x3045af['model'],_0x3045af[_0x3df2('0x46')]);_0x4a7dd1[_0x3df2('0x4b')]=_['intersection'](_0x3045af[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x3862dd[_0x3df2('0x46')][_0x3df2('0xd1')]));_0x4a7dd1[_0x3df2('0x4b')]=_0x4a7dd1[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x4a7dd1['attributes']:_0x3045af[_0x3df2('0xcd')];_0x4a7dd1[_0x3df2('0xd2')]=qs[_0x3df2('0xd3')](_0x3862dd[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x4a7dd1[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x3862dd[_0x3df2('0x46')],_0x3045af[_0x3df2('0xd5')]));if(_0x3862dd[_0x3df2('0x46')]['filter']){_0x4a7dd1[_0x3df2('0x45')]=_['merge'](_0x4a7dd1[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x4a7dd1[_0x3df2('0x4b')],function(_0x4e3cc8){var _0x3aecce={};_0x3aecce[_0x4e3cc8]={'$like':'%'+_0x3862dd[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x3aecce;})});}_0x4a7dd1=_[_0x3df2('0xd6')]({},_0x4a7dd1,_0x3862dd['options']);return _0x278166['getChatInteractions'](_0x4a7dd1);}})[_0x3df2('0x1f')](function(_0x486a67){if(_0x486a67){_0x188407=_0x486a67['length'];if(!_0x3862dd[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0x4a7dd1['limit']=qs[_0x3df2('0x1c')](_0x3862dd['query'][_0x3df2('0x1c')]);_0x4a7dd1[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x3862dd[_0x3df2('0x46')][_0x3df2('0x1a')]);}return _0x278166['getChatInteractions'](_0x4a7dd1);}})[_0x3df2('0x1f')](function(_0x211344){if(_0x211344){return _0x211344?{'count':_0x188407,'rows':_0x211344}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x2cdc9e,null))[_0x3df2('0x56')](handleError(_0x2cdc9e,null));};exports[_0x3df2('0xe3')]=function(_0x448edf,_0x2b7a3f){var _0x16cd5f={};var _0x512270={};var _0x5d3559;var _0x5a85f2;return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x448edf['params']['id']}})['then'](handleEntityNotFound(_0x2b7a3f,null))['then'](function(_0x2e8bd3){if(_0x2e8bd3){_0x5d3559=_0x2e8bd3;_0x512270[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xe4')]['rawAttributes']);_0x512270[_0x3df2('0x46')]=_['keys'](_0x448edf[_0x3df2('0x46')]);_0x512270[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x512270['model'],_0x512270[_0x3df2('0x46')]);_0x16cd5f['attributes']=_['intersection'](_0x512270[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x448edf['query'][_0x3df2('0xd1')]));_0x16cd5f[_0x3df2('0x4b')]=_0x16cd5f[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x16cd5f['attributes']:_0x512270[_0x3df2('0xcd')];_0x16cd5f[_0x3df2('0xd2')]=qs['sort'](_0x448edf[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x16cd5f['where']=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x448edf['query'],_0x512270['filters']));if(_0x448edf[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x16cd5f['where']=_[_0x3df2('0xd6')](_0x16cd5f[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x16cd5f[_0x3df2('0x4b')],function(_0x6f8727){var _0xde5e32={};_0xde5e32[_0x6f8727]={'$like':'%'+_0x448edf[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0xde5e32;})});}_0x16cd5f=_[_0x3df2('0xd6')]({},_0x16cd5f,_0x448edf[_0x3df2('0x5a')]);return _0x5d3559[_0x3df2('0xe3')](_0x16cd5f);}})['then'](function(_0x44c0bd){if(_0x44c0bd){_0x5a85f2=_0x44c0bd[_0x3df2('0x50')];if(!_0x448edf[_0x3df2('0x46')]['hasOwnProperty']('nolimit')){_0x16cd5f[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0x448edf[_0x3df2('0x46')][_0x3df2('0x1c')]);_0x16cd5f['offset']=qs['offset'](_0x448edf[_0x3df2('0x46')]['offset']);}return _0x5d3559['getOpenchannelInteractions'](_0x16cd5f);}})[_0x3df2('0x1f')](function(_0x49c728){if(_0x49c728){return _0x49c728?{'count':_0x5a85f2,'rows':_0x49c728}:null;}})['then'](respondWithResult(_0x2b7a3f,null))['catch'](handleError(_0x2b7a3f,null));};exports[_0x3df2('0xe5')]=function(_0x27360f,_0x4f5da4){var _0x311ecd={'raw':!![],'where':{}};var _0x50c776={};var _0x1aaf19={'count':0x0,'rows':[]};return db['User'][_0x3df2('0x93')]({'where':{'id':_0x27360f[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x4f5da4,null))[_0x3df2('0x1f')](function(_0x5b2104){if(_0x5b2104){_0x50c776[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xe6')][_0x3df2('0x3a')]);_0x50c776[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x27360f['query']);_0x50c776[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x50c776[_0x3df2('0xcd')],_0x50c776[_0x3df2('0x46')]);_0x311ecd[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x50c776[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x27360f[_0x3df2('0x46')][_0x3df2('0xd1')]));_0x311ecd[_0x3df2('0x4b')]=_0x311ecd[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x311ecd[_0x3df2('0x4b')]:_0x50c776[_0x3df2('0xcd')];if(!_0x27360f[_0x3df2('0x46')]['hasOwnProperty'](_0x3df2('0xd9'))){_0x311ecd[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0x27360f['query'][_0x3df2('0x1c')]);_0x311ecd[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x27360f[_0x3df2('0x46')][_0x3df2('0x1a')]);}_0x311ecd['order']=qs[_0x3df2('0xd3')](_0x27360f[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x311ecd[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_['pick'](_0x27360f['query'],_0x50c776[_0x3df2('0xd5')]));_0x311ecd['where'][_0x3df2('0xde')]=_0x5b2104['id'];if(_0x27360f[_0x3df2('0x46')]['filter']){_0x311ecd[_0x3df2('0x45')]=_['merge'](_0x311ecd[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x311ecd[_0x3df2('0x4b')],function(_0x328222){var _0x5e3cfc={};_0x5e3cfc[_0x328222]={'$like':'%'+_0x27360f[_0x3df2('0x46')]['filter']+'%'};return _0x5e3cfc;})});}_0x311ecd=_[_0x3df2('0xd6')]({},_0x311ecd,_0x27360f[_0x3df2('0x5a')]);return db[_0x3df2('0xe6')][_0x3df2('0x1d')]({'where':_0x311ecd[_0x3df2('0x45')]})['then'](function(_0x1d480f){_0x1aaf19[_0x3df2('0x1d')]=_0x1d480f;if(_0x27360f['query'][_0x3df2('0x47')]){_0x311ecd[_0x3df2('0x48')]=[{'all':!![]}];}return db[_0x3df2('0xe6')]['findAll'](_0x311ecd);})[_0x3df2('0x1f')](function(_0x51aa64){_0x1aaf19[_0x3df2('0x4e')]=_0x51aa64;return _0x1aaf19;});}})[_0x3df2('0x1f')](respondWithFilteredResult(_0x4f5da4,_0x311ecd))['catch'](handleError(_0x4f5da4,null));};exports[_0x3df2('0xe7')]=function(_0x47f5de,_0x369eec){var _0xc32c88={};var _0x507722={};var _0x188b1a;var _0x38a0e3;return db[_0x3df2('0x39')]['findOne']({'where':{'id':_0x47f5de[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x369eec,null))[_0x3df2('0x1f')](function(_0x5c1e6b){if(_0x5c1e6b){_0x188b1a=_0x5c1e6b;_0x507722[_0x3df2('0xcd')]=_['keys'](db[_0x3df2('0xe8')][_0x3df2('0x3a')]);_0x507722[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x47f5de[_0x3df2('0x46')]);_0x507722[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x507722[_0x3df2('0xcd')],_0x507722[_0x3df2('0x46')]);_0xc32c88[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x507722[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x47f5de['query'][_0x3df2('0xd1')]));_0xc32c88[_0x3df2('0x4b')]=_0xc32c88['attributes'][_0x3df2('0x50')]?_0xc32c88[_0x3df2('0x4b')]:_0x507722[_0x3df2('0xcd')];_0xc32c88[_0x3df2('0xd2')]=qs[_0x3df2('0xd3')](_0x47f5de[_0x3df2('0x46')][_0x3df2('0xd3')]);_0xc32c88[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x47f5de[_0x3df2('0x46')],_0x507722['filters']));if(_0x47f5de['query'][_0x3df2('0x3d')]){_0xc32c88['where']=_[_0x3df2('0xd6')](_0xc32c88[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0xc32c88[_0x3df2('0x4b')],function(_0x378012){var _0x18d35a={};_0x18d35a[_0x378012]={'$like':'%'+_0x47f5de['query'][_0x3df2('0x3d')]+'%'};return _0x18d35a;})});}_0xc32c88=_[_0x3df2('0xd6')]({},_0xc32c88,_0x47f5de[_0x3df2('0x5a')]);return _0x188b1a['getSmsInteractions'](_0xc32c88);}})['then'](function(_0x1721a4){if(_0x1721a4){_0x38a0e3=_0x1721a4[_0x3df2('0x50')];if(!_0x47f5de[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0xc32c88['limit']=qs[_0x3df2('0x1c')](_0x47f5de[_0x3df2('0x46')][_0x3df2('0x1c')]);_0xc32c88[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x47f5de['query']['offset']);}return _0x188b1a[_0x3df2('0xe7')](_0xc32c88);}})[_0x3df2('0x1f')](function(_0x1b0aed){if(_0x1b0aed){return _0x1b0aed?{'count':_0x38a0e3,'rows':_0x1b0aed}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x369eec,null))[_0x3df2('0x56')](handleError(_0x369eec,null));};exports[_0x3df2('0xe9')]=function(_0xfeb611,_0x456313){var _0x160c7a={};var _0x1bc2ec={};var _0x5e0bb1;var _0x31cb2e;return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0xfeb611['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x456313,null))[_0x3df2('0x1f')](function(_0x3eee83){if(_0x3eee83){_0x5e0bb1=_0x3eee83;_0x1bc2ec[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db['FaxInteraction']['rawAttributes']);_0x1bc2ec[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0xfeb611['query']);_0x1bc2ec['filters']=_[_0x3df2('0xd0')](_0x1bc2ec[_0x3df2('0xcd')],_0x1bc2ec[_0x3df2('0x46')]);_0x160c7a[_0x3df2('0x4b')]=_['intersection'](_0x1bc2ec[_0x3df2('0xcd')],qs['fields'](_0xfeb611[_0x3df2('0x46')]['fields']));_0x160c7a['attributes']=_0x160c7a[_0x3df2('0x4b')]['length']?_0x160c7a[_0x3df2('0x4b')]:_0x1bc2ec[_0x3df2('0xcd')];_0x160c7a['order']=qs[_0x3df2('0xd3')](_0xfeb611[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x160c7a[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_['pick'](_0xfeb611[_0x3df2('0x46')],_0x1bc2ec[_0x3df2('0xd5')]));if(_0xfeb611[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x160c7a[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x160c7a[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x160c7a[_0x3df2('0x4b')],function(_0x3f9b1b){var _0x265502={};_0x265502[_0x3f9b1b]={'$like':'%'+_0xfeb611[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x265502;})});}_0x160c7a=_[_0x3df2('0xd6')]({},_0x160c7a,_0xfeb611[_0x3df2('0x5a')]);return _0x5e0bb1['getFaxInteractions'](_0x160c7a);}})[_0x3df2('0x1f')](function(_0x499789){if(_0x499789){_0x31cb2e=_0x499789[_0x3df2('0x50')];if(!_0xfeb611[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0x160c7a[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0xfeb611[_0x3df2('0x46')]['limit']);_0x160c7a['offset']=qs[_0x3df2('0x1a')](_0xfeb611[_0x3df2('0x46')][_0x3df2('0x1a')]);}return _0x5e0bb1['getFaxInteractions'](_0x160c7a);}})['then'](function(_0xeb2473){if(_0xeb2473){return _0xeb2473?{'count':_0x31cb2e,'rows':_0xeb2473}:null;}})['then'](respondWithResult(_0x456313,null))[_0x3df2('0x56')](handleError(_0x456313,null));};exports[_0x3df2('0xea')]=function(_0x352107,_0x3b7924){var _0x40665e={};var _0x1ef8d1={};var _0x21a7ba;var _0x1e5564;return db['User']['findOne']({'where':{'id':_0x352107['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x3b7924,null))[_0x3df2('0x1f')](function(_0x237bd8){if(_0x237bd8){_0x21a7ba=_0x237bd8;_0x1ef8d1[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xeb')][_0x3df2('0x3a')]);_0x1ef8d1[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x352107[_0x3df2('0x46')]);_0x1ef8d1[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x1ef8d1[_0x3df2('0xcd')],_0x1ef8d1[_0x3df2('0x46')]);_0x40665e[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x1ef8d1[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x352107['query']['fields']));_0x40665e[_0x3df2('0x4b')]=_0x40665e[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x40665e[_0x3df2('0x4b')]:_0x1ef8d1[_0x3df2('0xcd')];_0x40665e['order']=qs['sort'](_0x352107[_0x3df2('0x46')]['sort']);_0x40665e[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x352107['query'],_0x1ef8d1['filters']));if(_0x352107[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x40665e[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x40665e[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x40665e[_0x3df2('0x4b')],function(_0x5d5ad2){var _0x40c224={};_0x40c224[_0x5d5ad2]={'$like':'%'+_0x352107[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x40c224;})});}_0x40665e=_['merge']({},_0x40665e,_0x352107[_0x3df2('0x5a')]);return _0x21a7ba['getWhatsappInteractions'](_0x40665e);}})[_0x3df2('0x1f')](function(_0x2342ae){if(_0x2342ae){_0x1e5564=_0x2342ae[_0x3df2('0x50')];if(!_0x352107[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0x40665e['limit']=qs['limit'](_0x352107['query'][_0x3df2('0x1c')]);_0x40665e[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x352107['query'][_0x3df2('0x1a')]);}return _0x21a7ba[_0x3df2('0xea')](_0x40665e);}})[_0x3df2('0x1f')](function(_0x37d20b){if(_0x37d20b){return _0x37d20b?{'count':_0x1e5564,'rows':_0x37d20b}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x3b7924,null))[_0x3df2('0x56')](handleError(_0x3b7924,null));};exports[_0x3df2('0xec')]=function(_0x10b4c4,_0x4d37ad,_0x2e5552){var _0x46702a;var _0x38d0e0;var _0xf43077;var _0x5be3d8=!_[_0x3df2('0x66')](_0x10b4c4['params']['id'])?_0x10b4c4[_0x3df2('0x58')]['id']:!_[_0x3df2('0x66')](_0x10b4c4[_0x3df2('0x2e')]['id'])?_0x10b4c4[_0x3df2('0x2e')]['id']:null;return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x5be3d8,'role':{'$or':[_0x3df2('0x7c'),'user',_0x3df2('0x29')]}},'attributes':['id',_0x3df2('0x36'),_0x3df2('0xed'),_0x3df2('0xee'),_0x3df2('0x2d'),_0x3df2('0x62'),_0x3df2('0x9a')]})[_0x3df2('0x1f')](function(_0x44fffd){if(_0x44fffd){if(_0x44fffd['role']===_0x3df2('0x29')){_0x46702a=_0x44fffd;if(_0x10b4c4[_0x3df2('0x5e')][_0x3df2('0xa7')]){_0xf43077=util[_0x3df2('0xef')](_0x3df2('0xf0'),_0x46702a[_0x10b4c4[_0x3df2('0x5e')][_0x3df2('0xa7')]]);}else if(_0x10b4c4[_0x3df2('0x5e')][_0x3df2('0xf1')]){_0xf43077=util[_0x3df2('0xef')](_0x3df2('0xa6'),_0x10b4c4['body'][_0x3df2('0xf1')]);}else{_0xf43077=util[_0x3df2('0xef')](_0x3df2('0xa6'),_0x46702a['name']);}socket['to'](util[_0x3df2('0xef')](_0x3df2('0xf2'),_0x46702a[_0x3df2('0x36')]))['emit'](_0x3df2('0xf3'),{'user':{'id':_0x46702a['id'],'name':_0x46702a[_0x3df2('0x36')]},'ip':_0x10b4c4[_0x3df2('0xf4')][_0x3df2('0xf5')]||_0x10b4c4['connection'][_0x3df2('0xf6')]||_0x10b4c4[_0x3df2('0xf7')][_0x3df2('0xf6')]||_0x10b4c4[_0x3df2('0xf8')][_0x3df2('0xf7')][_0x3df2('0xf6')]});return new Promise(function(_0x2b5782,_0x3437b8){db['sequelize'][_0x3df2('0xf9')]()['then'](_0x319db4=>{db[_0x3df2('0xa8')][_0x3df2('0x2b')]({'where':{'membername':_0x46702a[_0x3df2('0x36')]},'individualHooks':!![]},{'transaction':_0x319db4})[_0x3df2('0x1f')](function(){return _0x319db4['commit']();})[_0x3df2('0x1f')](_0x2b5782)[_0x3df2('0x56')](_0x3437b8);});});}}else{throw new db[(_0x3df2('0x90'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x46702a){return _0x46702a[_0x3df2('0xfa')]({'raw':!![]});}})[_0x3df2('0x1f')](function(_0x3706c7){if(_0x46702a){if(_0x3706c7){_0x38d0e0=_0x3706c7;if(_0x38d0e0[_0x3df2('0x50')]){var _0x597820=_0x38d0e0[_0x3df2('0x33')](function(_0x55d61f){return{'membername':_0x46702a[_0x3df2('0x36')],'UserId':_0x46702a['id'],'queue_name':_0x55d61f[_0x3df2('0x36')],'VoiceQueueId':_0x55d61f['id'],'interface':_0xf43077,'paused':_0x46702a[_0x3df2('0x9a')]||![],'penalty':_0x55d61f[_0x3df2('0xfb')]||0x0};});return db['UserVoiceQueueRt'][_0x3df2('0x85')](_0x597820);}}}})[_0x3df2('0x1f')](function(){if(_0x46702a){return db['MemberReport'][_0x3df2('0x4d')]({'where':{'membername':_0x46702a[_0x3df2('0x36')],'exitAt':null}});}})['then'](function(_0x2ce24b){if(_0x46702a){var _0x261fa4=[];_0x2ce24b[_0x3df2('0xfc')](function(_0x4f4bc8){_0x261fa4[_0x3df2('0x4c')](_0x4f4bc8[_0x3df2('0x28')]({'exitAt':moment()[_0x3df2('0xef')](_0x3df2('0xfd'))}));});return Promise[_0x3df2('0x55')](_0x261fa4);}})[_0x3df2('0x1f')](function(){if(_0x46702a){var _0x2ac95f=[];var _0x4a84f4=[];var _0x2f34f4=utils[_0x3df2('0xfe')]();var _0x5cd011={'membername':_0x46702a[_0x3df2('0x36')],'interface':_0xf43077,'enterAt':moment()[_0x3df2('0xef')](_0x3df2('0xfd')),'role':_0x46702a[_0x3df2('0x2d')],'internal':_0x46702a[_0x3df2('0x62')]};_0x2f34f4[_0x3df2('0xfc')](function(_0x327855){_0x2ac95f[_0x3df2('0x4c')](_[_0x3df2('0xd6')]({'channel':_0x327855,'type':'LOGIN','data1':_0x10b4c4['body'][_0x3df2('0xff')],'data2':_0xf43077},_0x5cd011));if(_0x46702a[_0x3df2('0x9a')]){_0x4a84f4[_0x3df2('0x4c')](_[_0x3df2('0xd6')]({'channel':_0x327855,'type':_0x3df2('0x100'),'data1':_0x3df2('0x101')},_0x5cd011));}});return db[_0x3df2('0x102')][_0x3df2('0x85')](_0x2ac95f[_0x3df2('0xc3')](_0x4a84f4),{'individualHooks':!![]});}})[_0x3df2('0x1f')](function(){if(_0x46702a){return _0x46702a[_0x3df2('0x28')]({'online':!![],'lastLoginAt':moment()[_0x3df2('0xef')](_0x3df2('0xfd')),'voicePause':_0x46702a['loginInPause']||![],'mailPause':_0x46702a['loginInPause']||![],'chatPause':_0x46702a[_0x3df2('0x9a')]||![],'faxPause':_0x46702a['loginInPause']||![],'smsPause':_0x46702a['loginInPause']||![],'openchannelPause':_0x46702a[_0x3df2('0x9a')]||![],'whatsappPause':_0x46702a[_0x3df2('0x9a')]||![],'pauseType':_0x46702a[_0x3df2('0x9a')]?_0x3df2('0x101'):null,'interface':_0xf43077,'lastPauseAt':moment()[_0x3df2('0xef')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x3df2('0x1f')](function(_0x1fa7e1){if(_0x10b4c4['isMiddleware']){return _0x2e5552();}else{return Promise['resolve'](_0x1fa7e1)[_0x3df2('0x1f')](respondWithResult(_0x4d37ad,null));}})[_0x3df2('0x56')](handleError(_0x4d37ad,null));};exports[_0x3df2('0x103')]=function(_0x33d85c,_0x1bc2aa){var _0x1280d4;return db['User'][_0x3df2('0x5b')]({'where':{'id':_0x33d85c[_0x3df2('0x58')]['id'],'role':_0x3df2('0x29')},'attributes':['id',_0x3df2('0x36'),_0x3df2('0x2d')]})[_0x3df2('0x1f')](handleEntityNotFound(_0x1bc2aa,null))[_0x3df2('0x1f')](function(_0x3785dd){if(_0x3785dd){_0x1280d4=_0x3785dd;return db['UserVoiceQueueRt'][_0x3df2('0x2b')]({'where':{'membername':_0x1280d4[_0x3df2('0x36')]},'individualHooks':!![]});}})['then'](function(){return db[_0x3df2('0x102')][_0x3df2('0x4d')]({'where':{'membername':_0x1280d4[_0x3df2('0x36')],'exitAt':null}});})['then'](function(_0x32fe34){var _0x2977ff=[];_0x32fe34['forEach'](function(_0x51c130){_0x2977ff[_0x3df2('0x4c')](_0x51c130[_0x3df2('0x28')]({'exitAt':moment()[_0x3df2('0xef')](_0x3df2('0xfd'))}));});return Promise[_0x3df2('0x55')](_0x2977ff);})[_0x3df2('0x1f')](function(){return _0x1280d4[_0x3df2('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3df2('0x1f')](respondWithResult(_0x1bc2aa,null))[_0x3df2('0x56')](handleError(_0x1bc2aa,null));};exports[_0x3df2('0x104')]=function(_0x2e7b06,_0x49c482){var _0x833c10;return db[_0x3df2('0xa8')][_0x3df2('0x28')]({'paused':0x1},{'where':{'UserId':_0x2e7b06[_0x3df2('0x58')]['id']},'individualHooks':!![]})[_0x3df2('0x1f')](function(){return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x2e7b06[_0x3df2('0x58')]['id'],'role':'agent'},'attributes':['id',_0x3df2('0x36'),'role',_0x3df2('0x62'),'interface','online']});})[_0x3df2('0x1f')](handleEntityNotFound(_0x49c482,null))[_0x3df2('0x1f')](function(_0x8f8358){if(_0x8f8358){_0x833c10=_0x8f8358;return respondWithRpcPromise(_0x3df2('0x105'),_0x3df2('0x104'),{'id':_0x833c10['id'],'name':_0x833c10[_0x3df2('0x36')],'pause':!![]});}})['then'](function(){if(_0x833c10){return db['MemberReport'][_0x3df2('0x4d')]({'where':{'membername':_0x833c10[_0x3df2('0x36')],'type':'PAUSE','exitAt':null}});}})[_0x3df2('0x1f')](function(_0x561e7f){if(_0x561e7f[_0x3df2('0x50')]){var _0x16a72f=moment()[_0x3df2('0xef')](_0x3df2('0xfd'));for(var _0x3d2e19=0x0,_0x3dc909=_0x561e7f[_0x3df2('0x50')];_0x3d2e19<_0x3dc909;_0x3d2e19++){_0x561e7f[_0x3d2e19]['updateAttributes']({'exitAt':_0x16a72f});}}})[_0x3df2('0x1f')](function(){var _0x1bb244=[];var _0x1f0548=utils['getChannels']();_0x1f0548['forEach'](function(_0x111243){_0x1bb244[_0x3df2('0x4c')]({'channel':_0x111243,'membername':_0x833c10[_0x3df2('0x36')],'interface':_[_0x3df2('0x66')](_0x833c10[_0x3df2('0xa7')])?util['format'](_0x3df2('0xa6'),_0x833c10[_0x3df2('0x36')]):_0x833c10['interface'],'type':_0x3df2('0x100'),'enterAt':moment()[_0x3df2('0xef')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2e7b06[_0x3df2('0x5e')][_0x3df2('0x3c')]||'DEFAULT\x20PAUSE','role':_0x833c10[_0x3df2('0x2d')],'internal':_0x833c10[_0x3df2('0x62')]});});return db[_0x3df2('0x102')][_0x3df2('0x85')](_0x1bb244,{'individualHooks':!![]});})[_0x3df2('0x1f')](function(){return _0x833c10[_0x3df2('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2e7b06['body'][_0x3df2('0x3c')]||_0x3df2('0x106'),'lastPauseAt':moment()[_0x3df2('0xef')](_0x3df2('0xfd'))});})['then'](respondWithResult(_0x49c482,null))[_0x3df2('0x56')](handleError(_0x49c482,null));};exports[_0x3df2('0x107')]=function(_0x3d717e,_0x1f510b){if(_0x3d717e[_0x3df2('0x5e')][_0x3df2('0x99')]&&!utils[_0x3df2('0x9c')](_0x3d717e[_0x3df2('0x5e')][_0x3df2('0x99')])){throw new APIBadRequestError(util[_0x3df2('0xef')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3d717e[_0x3df2('0x5e')][_0x3df2('0x99')]));}return db['User']['find']({'where':{'id':_0x3d717e['params']['id']},'attributes':['id','name',_0x3df2('0x2d'),_0x3df2('0x62'),_0x3df2('0xa7'),_0x3df2('0x108'),'voicePause','mailPause',_0x3df2('0x109'),_0x3df2('0x10a'),_0x3df2('0x10b'),_0x3df2('0x10c'),_0x3df2('0x10d'),_0x3df2('0x10e'),_0x3df2('0x10f')]})[_0x3df2('0x1f')](function(_0x18dea3){if(!_0x18dea3){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x3d717e[_0x3df2('0x58')]['id']));}return _0x18dea3[_0x3df2('0x107')](_0x3d717e[_0x3df2('0x5e')][_0x3df2('0x99')]);})['then'](respondWithResult(_0x1f510b,null))[_0x3df2('0x56')](APIHandleError(_0x1f510b));};exports['getTeams']=function(_0x5e0d8c,_0x484aa3){var _0x38e525={};var _0x45d657={};var _0x4edf5d;var _0x5009f8;return db[_0x3df2('0x39')]['findOne']({'where':{'id':_0x5e0d8c[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x484aa3,null))[_0x3df2('0x1f')](function(_0x1f97aa){if(_0x1f97aa){_0x4edf5d=_0x1f97aa;_0x45d657[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0x110')][_0x3df2('0x3a')]);_0x45d657['query']=_['keys'](_0x5e0d8c['query']);_0x45d657[_0x3df2('0xd5')]=_['intersection'](_0x45d657[_0x3df2('0xcd')],_0x45d657[_0x3df2('0x46')]);_0x38e525[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x45d657[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x5e0d8c['query'][_0x3df2('0xd1')]));_0x38e525['attributes']=_0x38e525[_0x3df2('0x4b')]['length']?_0x38e525['attributes']:_0x45d657[_0x3df2('0xcd')];_0x38e525[_0x3df2('0xd2')]=qs['sort'](_0x5e0d8c[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x38e525[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_['pick'](_0x5e0d8c[_0x3df2('0x46')],_0x45d657[_0x3df2('0xd5')]));if(_0x5e0d8c['query'][_0x3df2('0x3d')]){_0x38e525[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x38e525[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x38e525['attributes'],function(_0x4f4a03){var _0x266a2d={};_0x266a2d[_0x4f4a03]={'$like':'%'+_0x5e0d8c[_0x3df2('0x46')]['filter']+'%'};return _0x266a2d;})});}_0x38e525=_[_0x3df2('0xd6')]({},_0x38e525,_0x5e0d8c['options']);return _0x4edf5d['getTeams'](_0x38e525);}})[_0x3df2('0x1f')](function(_0x462adf){if(_0x462adf){_0x5009f8=_0x462adf['length'];if(!_0x5e0d8c[_0x3df2('0x46')][_0x3df2('0xd8')]('nolimit')){_0x38e525[_0x3df2('0x1c')]=qs['limit'](_0x5e0d8c[_0x3df2('0x46')]['limit']);_0x38e525[_0x3df2('0x1a')]=qs['offset'](_0x5e0d8c[_0x3df2('0x46')][_0x3df2('0x1a')]);}return _0x4edf5d[_0x3df2('0x111')](_0x38e525);}})[_0x3df2('0x1f')](function(_0x4d3c4f){if(_0x4d3c4f){return _0x4d3c4f?{'count':_0x5009f8,'rows':_0x4d3c4f}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x484aa3,null))['catch'](handleError(_0x484aa3,null));};exports[_0x3df2('0x112')]=function(_0x3d7228,_0x1a79fd){var _0x29d930=_0x3d7228['params']['id'];var _0x15cb45=_0x3d7228[_0x3df2('0x5e')]?_0x3d7228['body'][_0x3df2('0x60')]:null;var _0x40d230=[];return Promise['resolve']()[_0x3df2('0x1f')](function(){if(!_0x15cb45)throw new APIBadRequestError(_0x3df2('0x113'));})['then'](function(){return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x29d930}});})['then'](function(_0x4f2b0a){if(!_0x4f2b0a)throw new APINotFoundError(util['format'](_0x3df2('0xc5'),_0x3d7228[_0x3df2('0x58')]['id']));return db[_0x3df2('0x68')][_0x3df2('0xf9')](function(_0xbc9fba){return _0x4f2b0a['addTeams'](_0x15cb45,{'transaction':_0xbc9fba})['then'](function(){return db[_0x3df2('0x110')]['findAll']({'where':{'id':{'$in':_0x15cb45}}});})[_0x3df2('0x1f')](function(_0x13584a){var _0x5e6a4e=_[_0x3df2('0x33')](_0x13584a,function(_0x45b83d){return _0x45b83d['getAssociatedQueues']();});return Promise[_0x3df2('0x55')](_0x5e6a4e);})[_0x3df2('0x1f')](function(_0x1a9b6d){_0x40d230=_[_0x3df2('0x114')](_0x1a9b6d);var _0x401762=_['map'](_0x40d230,function(_0x16b404){return _0x16b404['addAgent'](_0x4f2b0a['id'],{'transaction':_0xbc9fba});});return Promise[_0x3df2('0x55')](_0x401762);})[_0x3df2('0x1f')](function(){if(!_0x4f2b0a['online'])return;var _0x310fbe=_[_0x3df2('0x3d')](_0x40d230,function(_0x109faf){return _0x109faf['getDataValue']('channel')===_0x3df2('0x115');});var _0x30bbb9=_[_0x3df2('0x33')](_0x310fbe,function(_0x34a347){return db[_0x3df2('0xa8')][_0x3df2('0xa9')]({'membername':_0x4f2b0a[_0x3df2('0x36')],'UserId':_0x4f2b0a['id'],'queue_name':_0x34a347[_0x3df2('0x36')],'VoiceQueueId':_0x34a347['id'],'interface':_[_0x3df2('0x66')](_0x4f2b0a['interface'])?util['format'](_0x3df2('0xa6'),_0x4f2b0a[_0x3df2('0x36')]):_0x4f2b0a[_0x3df2('0xa7')],'paused':_0x4f2b0a[_0x3df2('0x9b')]||![],'penalty':_0x4f2b0a[_0x3df2('0xa0')]},{'transaction':_0xbc9fba});});return Promise[_0x3df2('0x55')](_0x30bbb9);})[_0x3df2('0x1f')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x15cb45}}});})['then'](function(_0x2ab147){var _0x3f2708=_[_0x3df2('0x33')](_0x2ab147,function(_0x2904ca){return db['UserVoicePrefix']['create']({'UserId':_0x4f2b0a['id'],'VoicePrefixId':_0x2904ca[_0x3df2('0x116')]},{'transaction':_0xbc9fba});});return Promise[_0x3df2('0x55')](_0x3f2708);});});})[_0x3df2('0x1f')](function(){for(var _0xf54344=0x0;_0xf54344<_0x40d230['length'];_0xf54344++){var _0x1afe93=_0x40d230[_0xf54344][_0x3df2('0x117')]('channel');var _0x2c70d8=_0x1afe93+_0x3df2('0xa2');socket[_0x3df2('0x2a')](_0x3df2('0x2e')+_0x1afe93+_0x3df2('0xa3'),{'UserId':_0x29d930,['queueField']:_0x40d230[_0xf54344]['id']});}})[_0x3df2('0x1f')](respondWithStatusCode(_0x1a79fd,null))['catch'](APIHandleError(_0x1a79fd));};exports[_0x3df2('0x118')]=function(_0x25a5a5,_0x4aab7a){var _0x6c1846=_0x25a5a5[_0x3df2('0x58')]['id'];var _0x4b19b2=null;if(_0x25a5a5['query'][_0x3df2('0x60')]){_0x4b19b2=_[_0x3df2('0xab')](_0x25a5a5[_0x3df2('0x46')][_0x3df2('0x60')])?_0x25a5a5[_0x3df2('0x46')][_0x3df2('0x60')]:[_0x25a5a5[_0x3df2('0x46')]['ids']];}var _0x487e23=[];return Promise[_0x3df2('0x119')]()['then'](function(){if(!_0x4b19b2)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x3df2('0x1f')](function(){return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x6c1846}});})[_0x3df2('0x1f')](function(_0x5c241d){if(!_0x5c241d)throw new APINotFoundError(util[_0x3df2('0xef')](_0x3df2('0xc5'),_0x25a5a5['params']['id']));return db[_0x3df2('0x68')][_0x3df2('0xf9')](function(_0x256060){return _0x5c241d[_0x3df2('0x118')](_0x4b19b2,{'transaction':_0x256060})[_0x3df2('0x1f')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x4b19b2}}});})[_0x3df2('0x1f')](function(_0x35af80){var _0x405718=_[_0x3df2('0x33')](_0x35af80,function(_0x16d1ee){return _0x16d1ee[_0x3df2('0x11a')]();});return Promise[_0x3df2('0x55')](_0x405718);})[_0x3df2('0x1f')](function(_0x35f849){_0x487e23=_[_0x3df2('0x114')](_0x35f849);var _0x365fa0=_['map'](_0x487e23,function(_0x170f41){return _0x170f41[_0x3df2('0x11b')](_0x5c241d['id'],{'transaction':_0x256060});});return Promise['all'](_0x365fa0);})[_0x3df2('0x1f')](function(){if(!_0x5c241d[_0x3df2('0x108')])return;var _0x37bc7d=_[_0x3df2('0x3d')](_0x487e23,function(_0x29cbb6){return _0x29cbb6[_0x3df2('0x117')](_0x3df2('0x99'))===_0x3df2('0x115');});var _0x37ec75=_[_0x3df2('0x33')](_0x37bc7d,function(_0x2efef9){return db[_0x3df2('0xa8')]['destroy']({'where':{'VoiceQueueId':_0x2efef9['id'],'UserId':_0x5c241d['id']},'transaction':_0x256060});});return Promise[_0x3df2('0x55')](_0x37ec75);})['then'](function(){return db[_0x3df2('0x11c')][_0x3df2('0x4d')]({'where':{'teamId':{'$in':_0x4b19b2}}});})['then'](function(_0x2751a3){var _0x2a5edd=_[_0x3df2('0x33')](_0x2751a3,function(_0x1fbb71){return db[_0x3df2('0x11d')][_0x3df2('0x2b')]({'where':{'UserId':_0x5c241d['id'],'VoicePrefixId':_0x1fbb71[_0x3df2('0x116')]}},{'transaction':_0x256060});});return Promise[_0x3df2('0x55')](_0x2a5edd);});});})[_0x3df2('0x1f')](function(){for(var _0x5c768d=0x0;_0x5c768d<_0x487e23['length'];_0x5c768d++){var _0x108c42=_0x487e23[_0x5c768d][_0x3df2('0x117')](_0x3df2('0x99'));var _0x3319f3=_0x108c42+_0x3df2('0xa2');socket[_0x3df2('0x2a')](_0x3df2('0x2e')+_0x108c42+_0x3df2('0xac'),{'UserId':_0x6c1846,['queueField']:_0x487e23[_0x5c768d]['id']});}})['then'](respondWithStatusCode(_0x4aab7a,null))['catch'](APIHandleError(_0x4aab7a));};exports[_0x3df2('0x11e')]=function(_0x2dd6ee,_0x622a40){var _0xfae129={};var _0x587f5c={};var _0x3083db;var _0x2aaf55;return db['User'][_0x3df2('0x93')]({'where':{'id':_0x2dd6ee[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x622a40,null))[_0x3df2('0x1f')](function(_0x5b236b){if(_0x5b236b){_0x3083db=_0x5b236b;_0x587f5c[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xc7')][_0x3df2('0x3a')]);_0x587f5c[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x2dd6ee['query']);_0x587f5c[_0x3df2('0xd5')]=_['intersection'](_0x587f5c[_0x3df2('0xcd')],_0x587f5c[_0x3df2('0x46')]);_0xfae129[_0x3df2('0x4b')]=_['intersection'](_0x587f5c[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x2dd6ee[_0x3df2('0x46')][_0x3df2('0xd1')]));_0xfae129[_0x3df2('0x4b')]=_0xfae129[_0x3df2('0x4b')]['length']?_0xfae129[_0x3df2('0x4b')]:_0x587f5c[_0x3df2('0xcd')];_0xfae129[_0x3df2('0xd2')]=qs[_0x3df2('0xd3')](_0x2dd6ee[_0x3df2('0x46')][_0x3df2('0xd3')]);_0xfae129['where']=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x2dd6ee['query'],_0x587f5c[_0x3df2('0xd5')]));if(_0x2dd6ee[_0x3df2('0x46')]['filter']){_0xfae129[_0x3df2('0x45')]=_['merge'](_0xfae129[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0xfae129['attributes'],function(_0x5b775c){var _0x14b103={};_0x14b103[_0x5b775c]={'$like':'%'+_0x2dd6ee['query']['filter']+'%'};return _0x14b103;})});}_0xfae129=_[_0x3df2('0xd6')]({},_0xfae129,_0x2dd6ee['options']);return _0x3083db[_0x3df2('0x11e')](_0xfae129);}})['then'](function(_0x211b17){if(_0x211b17){_0x2aaf55=_0x211b17['length'];if(!_0x2dd6ee[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0xfae129[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0x2dd6ee[_0x3df2('0x46')][_0x3df2('0x1c')]);_0xfae129[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x2dd6ee[_0x3df2('0x46')][_0x3df2('0x1a')]);}return _0x3083db[_0x3df2('0x11e')](_0xfae129);}})[_0x3df2('0x1f')](function(_0x29ac72){if(_0x29ac72){return _0x29ac72?{'count':_0x2aaf55,'rows':_0x29ac72}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x622a40,null))[_0x3df2('0x56')](handleError(_0x622a40,null));};exports[_0x3df2('0x11f')]=function(_0xf9d567,_0x1ace41){var _0x2dc34c={};var _0x2fc1c0={};var _0x5aa4ea;return db[_0x3df2('0x39')]['findOne']({'where':{'id':_0xf9d567['params']['id']}})['then'](handleEntityNotFound(_0x1ace41,null))[_0x3df2('0x1f')](function(_0x16710a){if(_0x16710a){_0x5aa4ea=_0x16710a;_0x2fc1c0['model']=_[_0x3df2('0xce')](db[_0x3df2('0x39')][_0x3df2('0x3a')]);_0x2fc1c0[_0x3df2('0x46')]=_['keys'](_0xf9d567[_0x3df2('0x46')]);_0x2fc1c0['filters']=_[_0x3df2('0xd0')](_0x2fc1c0['model'],_0x2fc1c0['query']);_0x2dc34c['attributes']=_[_0x3df2('0xd0')](_0x2fc1c0['model'],qs['fields'](_0xf9d567[_0x3df2('0x46')]['fields']));_0x2dc34c[_0x3df2('0x4b')]=_0x2dc34c[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x2dc34c[_0x3df2('0x4b')]:_0x2fc1c0[_0x3df2('0xcd')];_0x2dc34c[_0x3df2('0xd2')]=qs['sort'](_0xf9d567[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x2dc34c[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0xf9d567[_0x3df2('0x46')],_0x2fc1c0[_0x3df2('0xd5')]));if(_0xf9d567['query'][_0x3df2('0x3d')]){_0x2dc34c[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x2dc34c[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x2dc34c[_0x3df2('0x4b')],function(_0x303766){var _0x47bf30={};_0x47bf30[_0x303766]={'$like':'%'+_0xf9d567[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x47bf30;})});}_0x2dc34c[_0x3df2('0xcd')]=db['User'];_0x2dc34c['as']=_0x3df2('0x2f');_0x2dc34c=_[_0x3df2('0xd6')]({},_0x2dc34c,_0xf9d567['options']);return _0x5aa4ea[_0x3df2('0xfa')]({'include':[_0x2dc34c]});}})[_0x3df2('0x1f')](function(_0x262420){if(_0x262420){var _0x464d0c={},_0x1b797f=[];for(var _0xe1a86a=0x0;_0xe1a86a<_0x262420[_0x3df2('0x50')];_0xe1a86a+=0x1){for(var _0x265d3f=0x0,_0x5e6cb8;_0x265d3f<_0x262420[_0xe1a86a][_0x3df2('0x2f')][_0x3df2('0x50')];_0x265d3f+=0x1){_0x5e6cb8=_0x262420[_0xe1a86a][_0x3df2('0x2f')][_0x265d3f][_0x3df2('0x2c')]({'plain':!![]});_0x464d0c[_0x5e6cb8['id']]=_0x5e6cb8;}}_0x464d0c=_[_0x3df2('0x120')](_0x464d0c);for(var _0x4b91d8=qs[_0x3df2('0x1a')](_0xf9d567[_0x3df2('0x46')][_0x3df2('0x1a')]);_0x4b91d8<_0x464d0c[_0x3df2('0x50')]&&_0x1b797f['length']=_0x36e01b){_0x2031a3=_0x36e01b;_0x18b98f=0xc8;}else{_0x18b98f=0xce;}_0x11748e['status'](_0x18b98f);return _0x11748e['set'](_0xa071('0x1c'),_0x52c0b4+'-'+_0x2031a3+'/'+_0x36e01b)[_0xa071('0x17')](_0x1e1875);}return null;};}function respondWithRpcPromise(_0x1c5f11,_0x1a5aff,_0x89fa44,_0x1ea10e){return new Promise(function(_0x433dc2,_0x151463){var _0x4a58bb=_0x1ea10e||amiClient;return _0x4a58bb['request'](_0x1c5f11,_0x89fa44)[_0xa071('0x1d')](function(_0x123201){logger['info']('User,\x20%s,\x20%s',_0x1a5aff,'request\x20sent');logger[_0xa071('0x1e')](_0xa071('0x1f'),_0x1a5aff,_0xa071('0x20'),JSON[_0xa071('0x21')](_0x123201));if(_0x123201[_0xa071('0x22')]){if(_0x123201[_0xa071('0x22')][_0xa071('0x23')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x1a5aff,_0x123201[_0xa071('0x22')][_0xa071('0x24')]);return _0x151463(_0x123201[_0xa071('0x22')][_0xa071('0x24')]);}logger['error'](_0xa071('0x25'),_0x1a5aff,_0x123201[_0xa071('0x22')][_0xa071('0x24')]);return _0x433dc2(_0x123201[_0xa071('0x22')][_0xa071('0x24')]);}else{logger['info'](_0xa071('0x25'),_0x1a5aff,_0xa071('0x20'));_0x433dc2(_0x123201[_0xa071('0x26')][_0xa071('0x24')]);}})[_0xa071('0x27')](function(_0x3a2e57){logger[_0xa071('0x22')](_0xa071('0x25'),_0x1a5aff,_0x3a2e57);_0x151463(_0x3a2e57);});});}function saveUpdates(_0x245d55){return function(_0x408c59){if(_0x408c59){return _0x408c59['update'](_0x245d55)[_0xa071('0x1d')](function(_0x4cb6fb){if(_0x4cb6fb['role']===_0xa071('0x28')){socket[_0xa071('0x29')]('userNotification:recalc:'+_0x4cb6fb['id'],_0x4cb6fb);}return _0x4cb6fb;});}return null;};}function removeEntity(_0x5d6b36,_0x33e5d4){return function(_0x3c9840){if(_0x3c9840){return _0x3c9840[_0xa071('0x2a')]({'transaction':_0x33e5d4})[_0xa071('0x1d')](function(){var _0x47c869=_0x3c9840[_0xa071('0x2b')]({'plain':!![]});if(_0x47c869[_0xa071('0x2c')]===_0xa071('0x2d'))return;var _0x2b6e1b=[{'name':_0xa071('0x2e'),'value':'user','ignore':!![]},{'name':_0xa071('0x2f'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0xa071('0x30'),'ignore':![]}];var _0x157811=_(_0x2b6e1b)[_0xa071('0x31')](_0xa071('0x32'))['map'](_0xa071('0x33'))['value']();if(_[_0xa071('0x34')](_0x157811,_0x47c869['role'])){return;}var _0x101dac=_[_0xa071('0x35')](_0x2b6e1b,[_0xa071('0x33'),_0x47c869[_0xa071('0x2c')]])[_0xa071('0x36')];return db[_0xa071('0x37')][_0xa071('0x2a')]({'where':{'type':_0x101dac,'resourceId':_0x47c869['id']},'transaction':_0x33e5d4})[_0xa071('0x1d')](function(){return _0x3c9840;});})[_0xa071('0x1d')](function(){_0x5d6b36['status'](0xcc)[_0xa071('0x16')]();});}};}function handleEntityNotFound(_0x2de264){return function(_0x9a65e0){if(!_0x9a65e0){_0x2de264[_0xa071('0x14')](0x194);}return _0x9a65e0;};}function handleError(_0x47d4a5,_0x5bd1f3){_0x5bd1f3=_0x5bd1f3||0x1f4;return function(_0x1fa0be){logger[_0xa071('0x22')](_0x1fa0be[_0xa071('0x38')]);if(_0x1fa0be[_0xa071('0x36')]){delete _0x1fa0be['name'];}_0x47d4a5[_0xa071('0x15')](_0x5bd1f3)[_0xa071('0x39')](_0x1fa0be);};}function getUserAttributes(){return _(db[_0xa071('0x3a')][_0xa071('0x3b')])['map'](function(_0x2f4ffe){return{'name':_0x2f4ffe['fieldName'],'type':_0x2f4ffe[_0xa071('0x3c')][_0xa071('0x3d')]};})[_0xa071('0x31')](function(_0x20893f){return!['password',_0xa071('0x3e'),_0xa071('0x3f'),_0xa071('0x40'),_0xa071('0x41'),'md5secret'][_0xa071('0x34')](_0x20893f['name']);})[_0xa071('0x33')]();}exports[_0xa071('0x42')]=function(_0x3ca1ab,_0x445e87){var _0x4d1226={},_0x30de10={'count':0x0,'rows':[]};var _0x559536=getUserAttributes();_0x4d1226=qs['getOptions'](_0x559536,_0x3ca1ab);var _0x192da3={'where':_0x4d1226[_0xa071('0x43')]};return db[_0xa071('0x3a')][_0xa071('0x1b')](_0x192da3)['then'](function(_0xfaa76f){_0x30de10[_0xa071('0x1b')]=_0xfaa76f;if(_0x3ca1ab[_0xa071('0x44')][_0xa071('0x45')]){_0x4d1226[_0xa071('0x46')]=[{'all':!![]}];}if(_0x3ca1ab['query']['userSetting']===_0xa071('0x47')){_0x4d1226[_0xa071('0x46')]=[{'model':db[_0xa071('0x48')],'as':'userSetting'}];}if(!_['includes'](_0x4d1226['attributes'],'id')){_0x4d1226[_0xa071('0x49')][_0xa071('0x4a')]('id');}return db[_0xa071('0x3a')]['findAll'](_0x4d1226);})[_0xa071('0x1d')](function(_0x4dfda){_0x30de10['rows']=_0x4dfda;if(_0x3ca1ab[_0xa071('0x44')][_0xa071('0x4b')]==='true'){var _0x52bc35=[];for(var _0x445a00=0x0;_0x445a00<_0x30de10[_0xa071('0x4c')]['length'];_0x445a00++){_0x52bc35[_0xa071('0x4a')](get_open_tabs(_0xa071('0x4d'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));_0x52bc35[_0xa071('0x4a')](get_open_tabs(_0xa071('0x4f'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));_0x52bc35['push'](get_open_tabs(_0xa071('0x50'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));_0x52bc35[_0xa071('0x4a')](get_open_tabs(_0xa071('0x51'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));_0x52bc35[_0xa071('0x4a')](get_open_tabs(_0xa071('0x52'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));_0x52bc35[_0xa071('0x4a')](get_open_tabs(_0xa071('0x53'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));}return Promise['all'](_0x52bc35)[_0xa071('0x1d')](function(){return _0x30de10;});}else{return _0x30de10;}})[_0xa071('0x1d')](respondWithFilteredResult(_0x445e87,_0x4d1226))[_0xa071('0x27')](handleError(_0x445e87,null));};exports[_0xa071('0x54')]=function(_0x500c61,_0x4b9dc4){var _0x12b889=getUserAttributes();_0x500c61[_0xa071('0x44')]['id']=_0x500c61[_0xa071('0x55')]['id'];var _0x3209cb=qs[_0xa071('0x56')](_0x12b889,_0x500c61);if(_0x500c61[_0xa071('0x44')][_0xa071('0x45')]){_0x3209cb[_0xa071('0x46')]=[{'all':!![]}];}if(_0x500c61[_0xa071('0x44')][_0xa071('0x57')]===_0xa071('0x47')){_0x3209cb[_0xa071('0x46')]=[{'model':db[_0xa071('0x48')],'as':_0xa071('0x57')}];}_0x3209cb=_[_0xa071('0x58')]({},_0x3209cb,_0x500c61[_0xa071('0x59')]);if(!_[_0xa071('0x34')](_0x3209cb[_0xa071('0x49')],'id')){_0x3209cb[_0xa071('0x49')][_0xa071('0x4a')]('id');}return db[_0xa071('0x3a')][_0xa071('0x35')](_0x3209cb)[_0xa071('0x1d')](handleEntityNotFound(_0x4b9dc4,null))[_0xa071('0x1d')](function(_0x3b74a1){var _0x1dbfb8=[];values=_0x3b74a1;if(_0x500c61['query'][_0xa071('0x4b')]===_0xa071('0x47')){_0x1dbfb8['push'](get_open_tabs(_0xa071('0x4d'),_0x3b74a1['dataValues']));_0x1dbfb8[_0xa071('0x4a')](get_open_tabs(_0xa071('0x4f'),_0x3b74a1[_0xa071('0x4e')]));_0x1dbfb8[_0xa071('0x4a')](get_open_tabs(_0xa071('0x52'),_0x3b74a1[_0xa071('0x4e')]));_0x1dbfb8['push'](get_open_tabs('whatsapp',_0x3b74a1[_0xa071('0x4e')]));_0x1dbfb8[_0xa071('0x4a')](get_open_tabs(_0xa071('0x50'),_0x3b74a1[_0xa071('0x4e')]));_0x1dbfb8['push'](get_open_tabs('mail',_0x3b74a1[_0xa071('0x4e')]));return Promise[_0xa071('0x5a')](_0x1dbfb8);}else{return values;}})[_0xa071('0x1d')](function(){return values;})[_0xa071('0x1d')](respondWithResult(_0x4b9dc4,null))[_0xa071('0x27')](handleError(_0x4b9dc4,null));};exports[_0xa071('0x5b')]=function(_0x3832b5,_0x41cf1e){if(_0x3832b5[_0xa071('0x5c')]['id']){delete _0x3832b5[_0xa071('0x5c')]['id'];}delete _0x3832b5[_0xa071('0x5c')][_0xa071('0x2c')];return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x3832b5[_0xa071('0x55')]['id']}})['then'](handleEntityNotFound(_0x41cf1e,null))['then'](saveUpdates(_0x3832b5[_0xa071('0x5c')],null))[_0xa071('0x1d')](respondWithResult(_0x41cf1e,null))[_0xa071('0x27')](handleError(_0x41cf1e,null));};exports[_0xa071('0x5d')]=function(_0x1f1b78,_0x386c80){return db[_0xa071('0x3a')][_0xa071('0x5d')]()[_0xa071('0x1d')](respondWithResult(_0x386c80,null))[_0xa071('0x27')](handleError(_0x386c80,null));};exports[_0xa071('0x5e')]=function(_0x3cfd15,_0x4161e1){return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x3cfd15[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x4161e1,null))[_0xa071('0x1d')](function(_0x51c179){if(_0x51c179){return _0x51c179['addContacts'](_0x3cfd15[_0xa071('0x5c')][_0xa071('0x5f')],_[_0xa071('0x60')](_0x3cfd15['body'],[_0xa071('0x5f'),'id'])||{});}})[_0xa071('0x1d')](respondWithResult(_0x4161e1,null))[_0xa071('0x27')](handleError(_0x4161e1,null));};function validateUser(_0x203fcd){return new Promise(function(_0x59273a,_0x2880ac){if(_0x203fcd[_0xa071('0x61')])return _0x59273a(_0x203fcd);return db[_0xa071('0x62')]['findById'](0x1)[_0xa071('0x1d')](function(_0x3b2b93){if(_0x3b2b93[_0xa071('0x63')])authService[_0xa071('0x64')](_0x203fcd[_0xa071('0x65')]);db[_0xa071('0x3a')][_0xa071('0x66')](_0xa071('0x61'))['then'](function(_0x2fd8ef){if(_[_0xa071('0x67')](_0x2fd8ef)){_0x203fcd[_0xa071('0x61')]=_0x3b2b93[_0xa071('0x68')]||0x1;return;}if(_['isNil'](_0x3b2b93[_0xa071('0x68')])||_0x3b2b93[_0xa071('0x68')]===_0x2fd8ef){_0x203fcd[_0xa071('0x61')]=_0x2fd8ef+0x1;return;}if(_0x3b2b93[_0xa071('0x68')]>_0x2fd8ef){_0x203fcd[_0xa071('0x61')]=_0x3b2b93['min_internal'];return;}return db['sequelize']['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0xa071('0x69')][_0xa071('0x6a')]})[_0xa071('0x1d')](function(_0x3ce83b){if(_0x3ce83b&&_0x3ce83b[_0xa071('0x6b')]){for(var _0x205173=0x0,_0x3b3508=_0x3ce83b[_0xa071('0x6b')];_0x205173<_0x3b3508&&_[_0xa071('0x67')](_0x203fcd[_0xa071('0x61')]);_0x205173++){if(_0x3b2b93[_0xa071('0x68')]<=_0x3ce83b[_0x205173][_0xa071('0x6c')]){_0x203fcd[_0xa071('0x61')]=_0x3ce83b[_0x205173]['from'];}else if(_0x3b2b93['min_internal']>_0x3ce83b[_0x205173][_0xa071('0x6c')]&&_0x3b2b93['min_internal']<=_0x3ce83b[_0x205173]['to']){_0x203fcd[_0xa071('0x61')]=_0x3b2b93[_0xa071('0x68')];}}}if(_[_0xa071('0x67')](_0x203fcd[_0xa071('0x61')])){_0x203fcd['internal']=_0x2fd8ef+0x1;}return _0x59273a(_0x203fcd);});});})['catch'](function(_0x346248){_0x2880ac(_0x346248);});});}function updateUser(_0x299cd9){return new Promise(function(_0x3a5e64,_0x1c8773){try{if(_0x299cd9['voicemail']){_0x299cd9[_0xa071('0x6d')]=_0x299cd9['internal'];_0x299cd9[_0xa071('0x6e')]={'mailbox':_0x299cd9[_0xa071('0x61')],'password':_0x299cd9[_0xa071('0x65')],'fullname':_0x299cd9[_0xa071('0x6f')],'email':_0x299cd9['email']};}if(_0x299cd9['role']===_0xa071('0x28')){if(!_0x299cd9['permissions'])_0x299cd9[_0xa071('0x70')]=[_0xa071('0x71'),_0xa071('0x72'),_0xa071('0x73'),_0xa071('0x74'),_0xa071('0x75'),_0xa071('0x76'),'105',_0xa071('0x77'),_0xa071('0x78'),_0xa071('0x79'),_0xa071('0x7a'),_0xa071('0x7b'),_0xa071('0x7c'),_0xa071('0x7d'),_0xa071('0x7e')];}_0x3a5e64(_0x299cd9);}catch(_0x1ce5bf){_0x1c8773(_0x1ce5bf);}});}exports[_0xa071('0x7f')]=function(_0x2730a4,_0x21327c){if(_0x2730a4['user'][_0xa071('0x2c')]===_0xa071('0x28'))throw new Error(_0xa071('0x80'));if(_0x2730a4[_0xa071('0x5c')][_0xa071('0x2c')]==='user'&&_0x2730a4[_0xa071('0x81')][_0xa071('0x2c')]!==_0xa071('0x2d')){throw new Error(_0xa071('0x82'));}if(_0x2730a4[_0xa071('0x5c')][_0xa071('0x2c')]===_0xa071('0x2d')&&_0x2730a4[_0xa071('0x81')][_0xa071('0x2c')]!==_0xa071('0x2d')){throw new Error(_0xa071('0x83'));}return licenseUtil[_0xa071('0x84')]([_0x2730a4[_0xa071('0x5c')]])['then'](function(){return validateUser(_0x2730a4[_0xa071('0x5c')]);})['then'](function(_0x1eb5b1){return updateUser(_0x1eb5b1)['then'](function(_0x190ca9){if(_0x190ca9[_0xa071('0x2c')]===_0xa071('0x2d')){_0x190ca9['settingsEnabled']=_0x2730a4['user']['settingsEnabled'];delete _0x190ca9[_0xa071('0x85')];}return _0x190ca9;});})['then'](function(_0x14da39){return db['User'][_0xa071('0x7f')](_0x14da39,{'include':[{'model':db[_0xa071('0x6e')],'as':_0xa071('0x6e')}]});})[_0xa071('0x1d')](function(_0x55eda2){if(_0x2730a4[_0xa071('0x5c')][_0xa071('0x2c')]===_0xa071('0x81'))return _0x55eda2;if(_0x2730a4[_0xa071('0x81')]['role']!==_0xa071('0x81'))return _0x55eda2;return db[_0xa071('0x86')][_0xa071('0x35')]({'where':{'name':_0x55eda2[_0xa071('0x2c')]===_0xa071('0x28')?'Agents':_0xa071('0x87'),'userProfileId':_0x2730a4[_0xa071('0x81')][_0xa071('0x85')]},'raw':!![]})['then'](function(_0x57e4db){if(!_0x57e4db||_0x57e4db[_0xa071('0x88')]!=0x0)return _0x55eda2;return db['UserProfileResource']['create']({'name':_0x55eda2[_0xa071('0x36')],'resourceId':_0x55eda2['id'],'type':_0x57e4db[_0xa071('0x36')],'sectionId':_0x57e4db['id']},{})[_0xa071('0x1d')](function(){return _0x55eda2;});})[_0xa071('0x27')](function(_0x5f427e){logger['error'](_0xa071('0x89'),_0x5f427e);throw _0x5f427e;});})[_0xa071('0x1d')](respondWithResult(_0x21327c,0xc9))[_0xa071('0x27')](handleError(_0x21327c,null));};exports['bulkCreate']=function(_0x44e706,_0x23f61d){var _0x213908=_0x44e706['body'];var _0x958e3b=[];if(_0x44e706[_0xa071('0x81')][_0xa071('0x2c')]===_0xa071('0x28'))throw new Error('Unauthorized');if(_[_0xa071('0x8a')](_0x213908,[_0xa071('0x2c'),_0xa071('0x81')])&&_0x44e706[_0xa071('0x81')][_0xa071('0x2c')]!==_0xa071('0x2d')){throw new Error(_0xa071('0x82'));}if(_[_0xa071('0x8a')](_0x213908,[_0xa071('0x2c'),'admin'])&&_0x44e706[_0xa071('0x81')][_0xa071('0x2c')]!=='admin'){throw new Error(_0xa071('0x8b'));}return licenseUtil[_0xa071('0x84')](_0x213908)[_0xa071('0x1d')](function(){return validateUser(_0x213908[0x0]);})[_0xa071('0x1d')](function(){for(var _0x11baf4=0x1;_0x11baf4<_0x213908[_0xa071('0x6b')];_0x11baf4++){var _0x27a943=_0x213908[_0x11baf4-0x1][_0xa071('0x61')];if(!_0x213908[_0x11baf4][_0xa071('0x61')])_0x213908[_0x11baf4][_0xa071('0x61')]=_0x27a943+0x1;_0x958e3b[_0xa071('0x4a')](validateUser(_0x213908[_0x11baf4]));}return Promise[_0xa071('0x5a')](_0x958e3b);})[_0xa071('0x1d')](function(){_0x958e3b=[];for(var _0x1eb91f=0x0;_0x1eb91f<_0x213908[_0xa071('0x6b')];_0x1eb91f++){_0x958e3b['push'](updateUser(_0x213908[_0x1eb91f]));}return Promise['all'](_0x958e3b);})[_0xa071('0x1d')](function(){_0x958e3b=_0x213908[_0xa071('0x8c')](function(_0x5f2f82){return db[_0xa071('0x3a')][_0xa071('0x7f')](_0x5f2f82,{'include':[{'model':db['VoiceMail'],'as':_0xa071('0x6e')}]})[_0xa071('0x1d')](function(_0x8edda9){_0x5f2f82['id']=_0x8edda9['id'];return _0x5f2f82;});});return Promise[_0xa071('0x5a')](_0x958e3b);})[_0xa071('0x1d')](function(_0x30442b){if(_0x44e706[_0xa071('0x5c')][_0xa071('0x2c')]===_0xa071('0x81'))return _0x30442b;if(_0x44e706['user'][_0xa071('0x2c')]!==_0xa071('0x81'))return _0x30442b;var _0x44ed26=_[_0xa071('0x8a')](_0x30442b,function(_0x28e978){return _0x28e978['role']===_0xa071('0x28')||_0x28e978[_0xa071('0x2c')]===_0xa071('0x30');});if(!_0x44ed26)return _0x30442b;return db[_0xa071('0x86')][_0xa071('0x8d')]({'where':{'name':{'$or':[_0xa071('0x2f'),_0xa071('0x87')]},'userProfileId':_0x44e706[_0xa071('0x81')][_0xa071('0x85')]},'raw':!![]})[_0xa071('0x1d')](function(_0x2d273a){if(_[_0xa071('0x8e')](_0x2d273a)||!_[_0xa071('0x8a')](_0x2d273a,['autoAssociation',0x0]))return _0x30442b;_0x958e3b=[];var _0x2f0dcc=_(_0x2d273a)[_0xa071('0x8c')](function(_0x13f790){if(_0x13f790[_0xa071('0x88')]===0x1)return;return _0x13f790[_0xa071('0x36')]==='Agents'?_0xa071('0x28'):_0xa071('0x30');})[_0xa071('0x8f')]()['value']();for(var _0x147f28=0x0;_0x147f28<_0x30442b['length'];_0x147f28++){if(!_[_0xa071('0x34')](_0x2f0dcc,_0x30442b[_0x147f28][_0xa071('0x2c')]))return;var _0x185892=_0x30442b[_0x147f28][_0xa071('0x2c')]===_0xa071('0x28')?_0xa071('0x2f'):'Telephones';_0x958e3b[_0xa071('0x4a')](db[_0xa071('0x37')][_0xa071('0x7f')]({'name':_0x30442b[_0x147f28]['name'],'resourceId':_0x30442b[_0x147f28]['id'],'type':_0x185892,'sectionId':_[_0xa071('0x35')](_0x2d273a,[_0xa071('0x36'),_0x185892])['id']},{}));}return Promise[_0xa071('0x5a')](_0x958e3b);});})['then'](respondWithResult(_0x23f61d,0xc9))[_0xa071('0x27')](handleError(_0x23f61d,null));};exports[_0xa071('0x90')]=function(_0x468a1a,_0x2c7bf6){if(_0x468a1a[_0xa071('0x5c')]['id']){delete _0x468a1a[_0xa071('0x5c')]['id'];}return db['User'][_0xa071('0x35')]({'where':{'id':_0x468a1a[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](function(_0xcc593e){if(!_0xcc593e)return null;if(_0xcc593e['id']===_0x468a1a[_0xa071('0x81')]['id']){if(!_0x468a1a[_0xa071('0x5c')][_0xa071('0x91')]||!_0x468a1a[_0xa071('0x5c')][_0xa071('0x92')]){throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))](_0xa071('0x95'));}if(!_0xcc593e['authenticate'](_0x468a1a[_0xa071('0x5c')]['oldPassword'])){throw new db['Sequelize']['ValidationError'](_0xa071('0x96'));}if(_0x468a1a[_0xa071('0x5c')][_0xa071('0x91')]===_0x468a1a['body']['newPassword']){throw new db['Sequelize'][(_0xa071('0x94'))](_0xa071('0x97'));}}else if(_0x468a1a[_0xa071('0x81')][_0xa071('0x2c')]==='admin'){if(!_0x468a1a[_0xa071('0x5c')][_0xa071('0x92')]){throw new db[(_0xa071('0x93'))]['ValidationError'](_0xa071('0x98'));}}else if(_0x468a1a[_0xa071('0x81')][_0xa071('0x2c')]==='user'){if(!_0x468a1a[_0xa071('0x5c')][_0xa071('0x92')]){throw new db['Sequelize'][(_0xa071('0x94'))](_0xa071('0x98'));}if(_0xcc593e['role']!==_0xa071('0x28')){throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))](_0xa071('0x80'));}}else{throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))]('Unauthorized');}return _0xcc593e;})[_0xa071('0x1d')](handleEntityNotFound(_0x2c7bf6,null))[_0xa071('0x1d')](function(_0x475a1a){return db[_0xa071('0x62')][_0xa071('0x99')]({'attributes':['id',_0xa071('0x63'),_0xa071('0x9a'),_0xa071('0x9b')]})[_0xa071('0x1d')](function(_0x502736){if(_0x502736[_0xa071('0x63')])authService[_0xa071('0x64')](_0x468a1a[_0xa071('0x5c')][_0xa071('0x92')]);if(!_0x502736[_0xa071('0x9a')]||!_0x475a1a[_0xa071('0x3f')])return _0x475a1a;authService[_0xa071('0x9c')](_0x468a1a[_0xa071('0x5c')]['newPassword'],_0x475a1a[_0xa071('0x3f')],_0x502736[_0xa071('0x9b')]);return _0x475a1a;})['then'](saveUpdates({'password':_0x468a1a[_0xa071('0x5c')][_0xa071('0x92')],'passwordResetAt':_0x468a1a[_0xa071('0x81')]['id']==_0x468a1a[_0xa071('0x55')]['id']?moment():null,'previousPasswords':authService[_0xa071('0x9d')](_0x468a1a['body'][_0xa071('0x92')],_0x475a1a[_0xa071('0x3f')])},null));})[_0xa071('0x1d')](respondWithResult(_0x2c7bf6,null))[_0xa071('0x27')](handleError(_0x2c7bf6,null));};exports[_0xa071('0x9e')]=function(_0x1198db,_0x5c2f75){var _0x139491=_0x1198db['body'][_0xa071('0x9f')];return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x1198db['params']['id']},'attributes':['id',_0xa071('0x36'),_0xa071('0x2c'),'online',_0xa071('0xa0'),'voicePause',_0xa071('0xa1')]})['then'](handleEntityNotFound(_0x5c2f75,null))[_0xa071('0x1d')](function(_0x58a4dd){if(_0x58a4dd){if(!utils['isValidChannel'](_0x139491)){throw new db['Sequelize'][(_0xa071('0x94'))](_0xa071('0xa2'));}return _0x58a4dd[_0xa071('0xa3')+_['capitalize'](_0x139491[_0xa071('0xa4')]())+'Queues'](_0x1198db[_0xa071('0x5c')][_0xa071('0x5f')],{'penalty':_0x1198db[_0xa071('0x5c')][_0xa071('0xa5')]||0x0})[_0xa071('0xa6')](function(_0x24ff27){for(var _0x262313=0x0;_0x262313<_0x1198db[_0xa071('0x5c')][_0xa071('0x5f')][_0xa071('0x6b')];_0x262313+=0x1){var _0x52437b={'UserId':Number(_0x1198db[_0xa071('0x55')]['id'])};_0x52437b[_[_0xa071('0xa7')](_0x139491[_0xa071('0xa4')]())+'QueueId']=Number(_0x1198db[_0xa071('0x5c')][_0xa071('0x5f')][_0x262313]);socket[_0xa071('0x29')]('user'+_[_0xa071('0xa7')](_0x139491['toLowerCase']())+_0xa071('0xa8'),_0x52437b);}return _0x24ff27;})[_0xa071('0x1d')](function(){if(_0x139491===_0xa071('0xa9')){return db['VoiceQueue'][_0xa071('0x8d')]({'where':{'id':_0x1198db[_0xa071('0x5c')][_0xa071('0x5f')]||[]},'raw':!![],'attributes':['id',_0xa071('0x36')]});}})[_0xa071('0x1d')](function(_0x274bc){var _0x5eeed7=_0x58a4dd[_0xa071('0x2b')]({'plain':!![]});var _0x4b8b4e=[];if(_0x139491===_0xa071('0xa9')&&_0x5eeed7[_0xa071('0x2c')]===_0xa071('0x28')&&_0x5eeed7[_0xa071('0xaa')]){for(let _0x20aaa7=0x0;_0x20aaa7<_0x274bc[_0xa071('0x6b')];_0x20aaa7+=0x1){_0x4b8b4e[_0xa071('0x4a')]({'membername':_0x5eeed7[_0xa071('0x36')],'UserId':_0x5eeed7['id'],'queue_name':_0x274bc[_0x20aaa7][_0xa071('0x36')],'VoiceQueueId':_0x274bc[_0x20aaa7]['id'],'interface':_['isNil'](_0x5eeed7[_0xa071('0xa1')])?util[_0xa071('0xab')]('SIP/%s',_0x5eeed7['name']):_0x5eeed7[_0xa071('0xa1')],'paused':_0x5eeed7[_0xa071('0xac')]||![],'penalty':_0x1198db[_0xa071('0x5c')][_0xa071('0xa5')]||0x0});}return Promise['all'](_0x4b8b4e[_0xa071('0x8c')](function(_0x15286f){return db[_0xa071('0xad')][_0xa071('0xae')](_0x15286f);}));}return _0x58a4dd;});}})[_0xa071('0x1d')](respondWithStatusCode(_0x5c2f75,null))['catch'](handleError(_0x5c2f75,null));};exports[_0xa071('0xaf')]=function(_0x26d5b1,_0x545fd5){var _0x265a9a,_0x2a1e4e;return db['User'][_0xa071('0x35')]({'where':{'id':_0x26d5b1[_0xa071('0x55')]['id']},'attributes':['id',_0xa071('0x36'),_0xa071('0x2c')]})[_0xa071('0x1d')](handleEntityNotFound(_0x545fd5,null))[_0xa071('0x1d')](function(_0x1b7709){if(_0x1b7709){_0x265a9a=_0x1b7709;if(!_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')]||!utils[_0xa071('0xb0')](_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')])){throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))](_0xa071('0xa2'));}return _0x1b7709[_0xa071('0xb1')+_['capitalize'](_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')][_0xa071('0xa4')]())+_0xa071('0xb2')](_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')]);}})[_0xa071('0x1d')](function(_0x14b0a0){if(_[_0xa071('0xb3')](_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')])){for(var _0x5702ec=0x0;_0x5702ec<_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')][_0xa071('0x6b')];_0x5702ec+=0x1){_0x2a1e4e={'UserId':Number(_0x26d5b1[_0xa071('0x55')]['id'])};_0x2a1e4e[_[_0xa071('0xa7')](_0x26d5b1['query'][_0xa071('0x9f')][_0xa071('0xa4')]())+'QueueId']=Number(_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')][_0x5702ec]);socket[_0xa071('0x29')](_0xa071('0x81')+_[_0xa071('0xa7')](_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')][_0xa071('0xa4')]())+_0xa071('0xb4'),_0x2a1e4e);}}else{_0x2a1e4e={'UserId':Number(_0x26d5b1[_0xa071('0x55')]['id'])};_0x2a1e4e[_[_0xa071('0xa7')](_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')][_0xa071('0xa4')]())+'QueueId']=Number(_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')]);socket[_0xa071('0x29')]('user'+_['capitalize'](_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')][_0xa071('0xa4')]())+_0xa071('0xb4'),_0x2a1e4e);}return _0x14b0a0;})[_0xa071('0x1d')](function(){if(_0x26d5b1[_0xa071('0x44')]['channel']===_0xa071('0xa9')){return db[_0xa071('0xad')]['destroy']({'where':{'UserId':_0x26d5b1['params']['id'],'VoiceQueueId':_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')]},'individualHooks':!![]})[_0xa071('0x1d')](function(){return _0x265a9a;});}return _0x265a9a;})[_0xa071('0x1d')](respondWithStatusCode(_0x545fd5,null))[_0xa071('0x27')](handleError(_0x545fd5,null));};exports[_0xa071('0xb5')]=function(_0x3b0e39,_0x27336f){_0x3b0e39[_0xa071('0x5c')][_0xa071('0xb6')]=_0x3b0e39[_0xa071('0xb7')][_0xa071('0xb8')];return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x3b0e39[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x27336f,null))[_0xa071('0x1d')](saveUpdates(_0x3b0e39[_0xa071('0x5c')],null))[_0xa071('0x1d')](respondWithResult(_0x27336f,null))[_0xa071('0x27')](handleError(_0x27336f,null));};exports[_0xa071('0xb9')]=function(_0x534333,_0x2245fa){var _0x18c69b=path['join'](config[_0xa071('0xba')],'server/files/images/logos/default_profile.png');return db['User'][_0xa071('0x35')]({'where':{'id':_0x534333[_0xa071('0x55')]['id']},'attributes':['id',_0xa071('0xb6')],'raw':!![]})['then'](handleEntityNotFound(_0x2245fa,null))[_0xa071('0x1d')](function(_0x2c7564){if(_0x2c7564){if(_['isNil'](_0x2c7564[_0xa071('0xb6')])){return _0x2245fa['download'](_0x18c69b);}else{if(!fs[_0xa071('0xbb')](path['join'](config[_0xa071('0xba')],_0xa071('0xbc'),_0x2c7564[_0xa071('0xb6')]))){return _0x2245fa['download'](_0x18c69b);}return _0x2245fa[_0xa071('0xbd')](path['join'](config['root'],_0xa071('0xbc'),_0x2c7564[_0xa071('0xb6')]));}}})[_0xa071('0x27')](handleError(_0x2245fa,null));};exports['getOpenTabs']=function(_0x510390,_0x14d037){return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x510390[_0xa071('0x55')]['id']},'attributes':['id']})[_0xa071('0x1d')](handleEntityNotFound(_0x14d037,null))[_0xa071('0x1d')](function(_0x115658){var _0x23c0f5=[];values=_0x115658[_0xa071('0x4e')];_0x23c0f5[_0xa071('0x4a')](get_open_tabs(_0xa071('0x4d'),_0x115658[_0xa071('0x4e')]));_0x23c0f5[_0xa071('0x4a')](get_open_tabs(_0xa071('0x4f'),_0x115658['dataValues']));_0x23c0f5[_0xa071('0x4a')](get_open_tabs(_0xa071('0x52'),_0x115658[_0xa071('0x4e')]));_0x23c0f5[_0xa071('0x4a')](get_open_tabs(_0xa071('0x53'),_0x115658[_0xa071('0x4e')]));_0x23c0f5[_0xa071('0x4a')](get_open_tabs('fax',_0x115658[_0xa071('0x4e')]));_0x23c0f5[_0xa071('0x4a')](get_open_tabs(_0xa071('0x51'),_0x115658[_0xa071('0x4e')]));return Promise[_0xa071('0x5a')](_0x23c0f5);})[_0xa071('0x1d')](function(_0x5317a4){if(_0x5317a4){var _0x4a9225=_[_0xa071('0x8c')](values[_0xa071('0xbe')],function(_0x26e93c){return{'channel':_0xa071('0xbf'),'id':_0x26e93c['id'],'createdAt':_0x26e93c['createdAt']};});var _0x2a1d77=_[_0xa071('0x8c')](values['FaxOpenTabs'],function(_0x1ff00d){return{'channel':'FAX','id':_0x1ff00d['id'],'createdAt':_0x1ff00d[_0xa071('0xc0')]};});var _0x396d7e=_[_0xa071('0x8c')](values[_0xa071('0xc1')],function(_0x23708c){return{'channel':_0xa071('0xc2'),'id':_0x23708c['id'],'createdAt':_0x23708c['createdAt']};});var _0x49cbbe=_[_0xa071('0x8c')](values[_0xa071('0xc3')],function(_0x5ab20e){return{'channel':_0xa071('0xc4'),'id':_0x5ab20e['id'],'createdAt':_0x5ab20e[_0xa071('0xc0')]};});var _0x5131b5=_[_0xa071('0x8c')](values['SmsOpenTabs'],function(_0x9fbec3){return{'channel':_0xa071('0xc5'),'id':_0x9fbec3['id'],'createdAt':_0x9fbec3[_0xa071('0xc0')]};});var _0x35365e=_[_0xa071('0x8c')](values[_0xa071('0xc6')],function(_0x45ce04){return{'channel':'WHATSAPP','id':_0x45ce04['id'],'createdAt':_0x45ce04['createdAt']};});var _0x3bcfe9=_[_0xa071('0xc7')](_0x4a9225,_0x2a1d77,_0x396d7e,_0x49cbbe,_0x5131b5,_0x35365e);var _0x531c7e={'count':_0x3bcfe9[_0xa071('0x6b')],'rows':_0x3bcfe9};return _0x531c7e;}else return null;})[_0xa071('0x1d')](respondWithResult(_0x14d037,null))[_0xa071('0x27')](handleError(_0x14d037,null));};exports[_0xa071('0xc8')]=function(_0x444a4b,_0x2a1e81){var _0xa7267b={};return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x444a4b[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](function(_0x3a26dc){if(!_0x3a26dc){throw new APINotFoundError(util[_0xa071('0xab')](_0xa071('0xc9'),_0x444a4b[_0xa071('0x55')]['id']));}return contacts[_0xa071('0x5d')]();})[_0xa071('0x1d')](function(_0x16c45d){_0x444a4b[_0xa071('0x44')][_0xa071('0x3a')]=_0x444a4b[_0xa071('0x55')]['id'];_0xa7267b=qs[_0xa071('0x56')](_0x16c45d,_0x444a4b);if(_0x444a4b['query'][_0xa071('0xca')](_0xa071('0x45'))){_0xa7267b['include']=[{'model':db[_0xa071('0xcb')],'as':_0xa071('0xcc'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xa071('0x36'),_0xa071('0xcd')],'where':_0x444a4b[_0xa071('0x44')][_0xa071('0xce')]?{'id':_0x444a4b[_0xa071('0x44')][_0xa071('0xce')]}:undefined,'required':_0x444a4b[_0xa071('0x44')]['tag']?!![]:![]}];}return contacts['findAll'](_0x444a4b['query'],_0x444a4b[_0xa071('0x81')],_0xa7267b,_0x16c45d);})[_0xa071('0x1d')](respondWithFilteredResult(_0x2a1e81,_0xa7267b))[_0xa071('0x27')](APIHandleError(_0x2a1e81));};exports['getQueues']=function(_0x16e0dd,_0xfe37e9){var _0x2f7921;var _0x37f058={};var _0x2cd85b;return db[_0xa071('0x3a')]['findOne']({'where':{'id':_0x16e0dd[_0xa071('0x55')]['id']},'attributes':['id','name',_0xa071('0x2c')]})['then'](handleEntityNotFound(_0xfe37e9,null))['then'](function(_0x18bd32){if(!utils['isValidChannel'](_0x16e0dd['query'][_0xa071('0x9f')])){throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))]('Unknown\x20channel');}_0x2f7921=_0x18bd32;var _0x10f178={};_0x10f178['model']=_['keys'](db[_[_0xa071('0xa7')](_0x16e0dd[_0xa071('0x44')][_0xa071('0x9f')])+_0xa071('0xcf')][_0xa071('0x3b')]);_0x10f178['query']=_[_0xa071('0xd0')](_0x16e0dd[_0xa071('0x44')]);_0x10f178['filters']=_[_0xa071('0xd1')](_0x10f178[_0xa071('0xd2')],_0x10f178[_0xa071('0x44')]);_0x37f058[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x10f178['model'],qs[_0xa071('0xd3')](_0x16e0dd['query'][_0xa071('0xd3')]));_0x37f058[_0xa071('0x49')]=_0x37f058[_0xa071('0x49')][_0xa071('0x6b')]?_0x37f058['attributes']:_0x10f178[_0xa071('0xd2')];_0x37f058['order']=qs[_0xa071('0xd4')](_0x16e0dd['query'][_0xa071('0xd4')]);_0x37f058[_0xa071('0x43')]=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x16e0dd[_0xa071('0x44')],_0x10f178['filters']));if(_0x16e0dd['query'][_0xa071('0x31')]){_0x37f058[_0xa071('0x43')]=_[_0xa071('0x58')](_0x37f058[_0xa071('0x43')],{'$or':_['map'](_0x37f058[_0xa071('0x49')],function(_0x128f0f){var _0x549ad8={};_0x549ad8[_0x128f0f]={'$like':'%'+_0x16e0dd['query']['filter']+'%'};return _0x549ad8;})});}_0x37f058=_[_0xa071('0x58')]({},_0x37f058,_0x16e0dd[_0xa071('0x59')]);switch(_0x2f7921[_0xa071('0x2c')]){case _0xa071('0x2d'):return db[_['capitalize'](_0x16e0dd['query'][_0xa071('0x9f')])+'Queue'][_0xa071('0x8d')](_0x37f058);case _0xa071('0x81'):case _0xa071('0x28'):return _0x2f7921[_0xa071('0x2b')+_[_0xa071('0xa7')](_0x16e0dd['query'][_0xa071('0x9f')])+_0xa071('0xb2')](_0x37f058);default:throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))](_0xa071('0xd7'));}})[_0xa071('0x1d')](function(_0x3f5173){_0x2cd85b=_0x3f5173[_0xa071('0x6b')];if(!_0x16e0dd[_0xa071('0x44')][_0xa071('0xca')]('nolimit')){_0x37f058['limit']=qs[_0xa071('0x1a')](_0x16e0dd['query']['limit']);_0x37f058['offset']=qs['offset'](_0x16e0dd[_0xa071('0x44')]['offset']);}switch(_0x2f7921[_0xa071('0x2c')]){case _0xa071('0x2d'):return db[_[_0xa071('0xa7')](_0x16e0dd[_0xa071('0x44')]['channel'])+'Queue']['findAll'](_0x37f058);case _0xa071('0x81'):case _0xa071('0x28'):return _0x2f7921[_0xa071('0x2b')+_[_0xa071('0xa7')](_0x16e0dd['query'][_0xa071('0x9f')])+_0xa071('0xb2')](_0x37f058);}})[_0xa071('0x1d')](function(_0x2dc169){return{'count':_0x2cd85b,'rows':_0x2dc169};})[_0xa071('0x1d')](respondWithResult(_0xfe37e9,null))[_0xa071('0x27')](handleError(_0xfe37e9,null));};exports[_0xa071('0xd8')]=function(_0x282da3,_0x2c9221){var _0x48fe3a={};var _0x1a8c0d={};var _0x45cdf8;var _0xdf7bff;return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x282da3[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x2c9221,null))[_0xa071('0x1d')](function(_0x107d91){if(_0x107d91){_0x45cdf8=_0x107d91;_0x1a8c0d[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xad')]['rawAttributes']);_0x1a8c0d[_0xa071('0x44')]=_['keys'](_0x282da3[_0xa071('0x44')]);_0x1a8c0d['filters']=_[_0xa071('0xd1')](_0x1a8c0d[_0xa071('0xd2')],_0x1a8c0d['query']);_0x48fe3a['attributes']=_[_0xa071('0xd1')](_0x1a8c0d[_0xa071('0xd2')],qs['fields'](_0x282da3[_0xa071('0x44')]['fields']));_0x48fe3a['attributes']=_0x48fe3a['attributes'][_0xa071('0x6b')]?_0x48fe3a[_0xa071('0x49')]:_0x1a8c0d[_0xa071('0xd2')];_0x48fe3a['order']=qs[_0xa071('0xd4')](_0x282da3[_0xa071('0x44')][_0xa071('0xd4')]);_0x48fe3a[_0xa071('0x43')]=qs['filters'](_[_0xa071('0xd6')](_0x282da3[_0xa071('0x44')],_0x1a8c0d[_0xa071('0xd5')]));if(_0x282da3[_0xa071('0x44')][_0xa071('0x31')]){_0x48fe3a[_0xa071('0x43')]=_['merge'](_0x48fe3a[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x48fe3a[_0xa071('0x49')],function(_0x310da4){var _0x168354={};_0x168354[_0x310da4]={'$like':'%'+_0x282da3[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x168354;})});}_0x48fe3a=_[_0xa071('0x58')]({},_0x48fe3a,_0x282da3['options']);return _0x45cdf8[_0xa071('0xd8')](_0x48fe3a);}})[_0xa071('0x1d')](function(_0x53216f){if(_0x53216f){_0xdf7bff=_0x53216f[_0xa071('0x6b')];if(!_0x282da3['query'][_0xa071('0xca')](_0xa071('0xd9'))){_0x48fe3a[_0xa071('0x1a')]=qs['limit'](_0x282da3['query'][_0xa071('0x1a')]);_0x48fe3a[_0xa071('0x18')]=qs['offset'](_0x282da3[_0xa071('0x44')][_0xa071('0x18')]);}return _0x45cdf8[_0xa071('0xd8')](_0x48fe3a);}})[_0xa071('0x1d')](function(_0x178f53){if(_0x178f53){return _0x178f53?{'count':_0xdf7bff,'rows':_0x178f53}:null;}})['then'](respondWithResult(_0x2c9221,null))[_0xa071('0x27')](handleError(_0x2c9221,null));};exports[_0xa071('0xda')]=function(_0x3b7c80,_0x3cdac4){var _0x53b1fe={};var _0x5ce98c={};var _0x2b8406;var _0x3d5102;return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x3b7c80[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x3cdac4,null))['then'](function(_0x269056){if(_0x269056){_0x2b8406=_0x269056;_0x5ce98c[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xdb')]['rawAttributes']);_0x5ce98c[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x3b7c80[_0xa071('0x44')]);_0x5ce98c[_0xa071('0xd5')]=_['intersection'](_0x5ce98c[_0xa071('0xd2')],_0x5ce98c['query']);_0x53b1fe['attributes']=_[_0xa071('0xd1')](_0x5ce98c[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0x3b7c80['query'][_0xa071('0xd3')]));_0x53b1fe[_0xa071('0x49')]=_0x53b1fe[_0xa071('0x49')][_0xa071('0x6b')]?_0x53b1fe[_0xa071('0x49')]:_0x5ce98c[_0xa071('0xd2')];_0x53b1fe['order']=qs[_0xa071('0xd4')](_0x3b7c80['query'][_0xa071('0xd4')]);_0x53b1fe[_0xa071('0x43')]=qs['filters'](_[_0xa071('0xd6')](_0x3b7c80['query'],_0x5ce98c[_0xa071('0xd5')]));if(_0x3b7c80[_0xa071('0x44')][_0xa071('0x31')]){_0x53b1fe['where']=_['merge'](_0x53b1fe[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x53b1fe[_0xa071('0x49')],function(_0x52fa54){var _0x4339d9={};_0x4339d9[_0x52fa54]={'$like':'%'+_0x3b7c80[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x4339d9;})});}_0x53b1fe=_['merge']({},_0x53b1fe,_0x3b7c80[_0xa071('0x59')]);return _0x2b8406['getGroups'](_0x53b1fe);}})[_0xa071('0x1d')](function(_0x172973){if(_0x172973){_0x3d5102=_0x172973[_0xa071('0x6b')];if(!_0x3b7c80[_0xa071('0x44')][_0xa071('0xca')](_0xa071('0xd9'))){_0x53b1fe[_0xa071('0x1a')]=qs['limit'](_0x3b7c80[_0xa071('0x44')]['limit']);_0x53b1fe['offset']=qs['offset'](_0x3b7c80[_0xa071('0x44')][_0xa071('0x18')]);}return _0x2b8406[_0xa071('0xda')](_0x53b1fe);}})['then'](function(_0x4d7cb6){if(_0x4d7cb6){return _0x4d7cb6?{'count':_0x3d5102,'rows':_0x4d7cb6}:null;}})['then'](respondWithResult(_0x3cdac4,null))[_0xa071('0x27')](handleError(_0x3cdac4,null));};exports[_0xa071('0xdc')]=function(_0x23b602,_0x3478f8){var _0x26df99={'raw':!![],'where':{}};var _0x357dda={};var _0x2245a1={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x23b602[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x3478f8,null))[_0xa071('0x1d')](function(_0xf05164){if(_0xf05164){_0x357dda['model']=_[_0xa071('0xd0')](db[_0xa071('0xdd')][_0xa071('0x3b')]);_0x357dda[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x23b602[_0xa071('0x44')]);_0x357dda['filters']=_[_0xa071('0xd1')](_0x357dda[_0xa071('0xd2')],_0x357dda[_0xa071('0x44')]);_0x26df99[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x357dda[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0x23b602[_0xa071('0x44')]['fields']));_0x26df99[_0xa071('0x49')]=_0x26df99[_0xa071('0x49')][_0xa071('0x6b')]?_0x26df99['attributes']:_0x357dda[_0xa071('0xd2')];if(!_0x23b602['query']['hasOwnProperty'](_0xa071('0xd9'))){_0x26df99[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0x23b602[_0xa071('0x44')][_0xa071('0x1a')]);_0x26df99[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x23b602[_0xa071('0x44')][_0xa071('0x18')]);}_0x26df99[_0xa071('0xde')]=qs['sort'](_0x23b602['query'][_0xa071('0xd4')]);_0x26df99['where']=qs['filters'](_[_0xa071('0xd6')](_0x23b602[_0xa071('0x44')],_0x357dda[_0xa071('0xd5')]));_0x26df99[_0xa071('0x43')]['UserId']=_0xf05164['id'];if(_0x23b602[_0xa071('0x44')][_0xa071('0x31')]){_0x26df99[_0xa071('0x43')]=_['merge'](_0x26df99[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x26df99[_0xa071('0x49')],function(_0x3a4b2e){var _0x381f3d={};_0x381f3d[_0x3a4b2e]={'$like':'%'+_0x23b602[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x381f3d;})});}_0x26df99=_[_0xa071('0x58')]({},_0x26df99,_0x23b602[_0xa071('0x59')]);return db['VoiceRecording']['count']({'where':_0x26df99[_0xa071('0x43')]})['then'](function(_0x4b1ad7){_0x2245a1[_0xa071('0x1b')]=_0x4b1ad7;if(_0x23b602['query'][_0xa071('0x45')]){_0x26df99['include']=[{'all':!![]}];}return db[_0xa071('0xdd')]['findAll'](_0x26df99);})[_0xa071('0x1d')](function(_0xe03510){_0x2245a1['rows']=_0xe03510;return _0x2245a1;});}})['then'](respondWithFilteredResult(_0x3478f8,_0x26df99))[_0xa071('0x27')](handleError(_0x3478f8,null));};exports[_0xa071('0xdf')]=function(_0x25b167,_0x2dcd87){var _0x55413f={'raw':!![],'where':{}};var _0x5b339f={};var _0x887bcb={'count':0x0,'rows':[]};return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x25b167[_0xa071('0x55')]['id']}})['then'](handleEntityNotFound(_0x2dcd87,null))[_0xa071('0x1d')](function(_0x571842){if(_0x571842){_0x5b339f[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xe0')]['rawAttributes']);_0x5b339f[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x25b167['query']);_0x5b339f[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x5b339f[_0xa071('0xd2')],_0x5b339f['query']);_0x55413f[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x5b339f[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0x25b167[_0xa071('0x44')][_0xa071('0xd3')]));_0x55413f[_0xa071('0x49')]=_0x55413f[_0xa071('0x49')]['length']?_0x55413f[_0xa071('0x49')]:_0x5b339f[_0xa071('0xd2')];if(!_0x25b167[_0xa071('0x44')]['hasOwnProperty']('nolimit')){_0x55413f[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0x25b167[_0xa071('0x44')]['limit']);_0x55413f[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x25b167['query'][_0xa071('0x18')]);}_0x55413f['order']=qs['sort'](_0x25b167[_0xa071('0x44')][_0xa071('0xd4')]);_0x55413f[_0xa071('0x43')]=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x25b167[_0xa071('0x44')],_0x5b339f[_0xa071('0xd5')]));_0x55413f[_0xa071('0x43')]['UserId']=_0x571842['id'];if(_0x25b167[_0xa071('0x44')][_0xa071('0x31')]){_0x55413f[_0xa071('0x43')]=_['merge'](_0x55413f[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x55413f[_0xa071('0x49')],function(_0x59d871){var _0x162ddd={};_0x162ddd[_0x59d871]={'$like':'%'+_0x25b167[_0xa071('0x44')]['filter']+'%'};return _0x162ddd;})});}_0x55413f=_[_0xa071('0x58')]({},_0x55413f,_0x25b167[_0xa071('0x59')]);return db[_0xa071('0xe0')][_0xa071('0x1b')]({'where':_0x55413f[_0xa071('0x43')]})[_0xa071('0x1d')](function(_0xef6adc){_0x887bcb[_0xa071('0x1b')]=_0xef6adc;if(_0x25b167[_0xa071('0x44')][_0xa071('0x45')]){_0x55413f[_0xa071('0x46')]=[{'all':!![]}];}return db[_0xa071('0xe0')][_0xa071('0x8d')](_0x55413f);})['then'](function(_0x29796d){_0x887bcb[_0xa071('0x4c')]=_0x29796d;return _0x887bcb;});}})['then'](respondWithFilteredResult(_0x2dcd87,_0x55413f))[_0xa071('0x27')](handleError(_0x2dcd87,null));};exports[_0xa071('0xe1')]=function(_0xee433b,_0x140209){var _0x139237={};var _0x3b8edf={};var _0x4bbb31;var _0x4b1605;return db[_0xa071('0x3a')]['findOne']({'where':{'id':_0xee433b['params']['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x140209,null))[_0xa071('0x1d')](function(_0x26ae89){if(_0x26ae89){_0x4bbb31=_0x26ae89;_0x3b8edf['model']=_[_0xa071('0xd0')](db[_0xa071('0xe2')][_0xa071('0x3b')]);_0x3b8edf[_0xa071('0x44')]=_[_0xa071('0xd0')](_0xee433b[_0xa071('0x44')]);_0x3b8edf[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x3b8edf[_0xa071('0xd2')],_0x3b8edf[_0xa071('0x44')]);_0x139237[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x3b8edf[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0xee433b[_0xa071('0x44')][_0xa071('0xd3')]));_0x139237[_0xa071('0x49')]=_0x139237[_0xa071('0x49')][_0xa071('0x6b')]?_0x139237[_0xa071('0x49')]:_0x3b8edf[_0xa071('0xd2')];_0x139237[_0xa071('0xde')]=qs[_0xa071('0xd4')](_0xee433b[_0xa071('0x44')][_0xa071('0xd4')]);_0x139237['where']=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0xee433b['query'],_0x3b8edf['filters']));if(_0xee433b[_0xa071('0x44')][_0xa071('0x31')]){_0x139237[_0xa071('0x43')]=_['merge'](_0x139237['where'],{'$or':_[_0xa071('0x8c')](_0x139237[_0xa071('0x49')],function(_0x8415e){var _0x56cc32={};_0x56cc32[_0x8415e]={'$like':'%'+_0xee433b[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x56cc32;})});}_0x139237=_[_0xa071('0x58')]({},_0x139237,_0xee433b[_0xa071('0x59')]);return _0x4bbb31[_0xa071('0xe1')](_0x139237);}})[_0xa071('0x1d')](function(_0x47010e){if(_0x47010e){_0x4b1605=_0x47010e[_0xa071('0x6b')];if(!_0xee433b[_0xa071('0x44')][_0xa071('0xca')](_0xa071('0xd9'))){_0x139237['limit']=qs[_0xa071('0x1a')](_0xee433b['query'][_0xa071('0x1a')]);_0x139237[_0xa071('0x18')]=qs['offset'](_0xee433b[_0xa071('0x44')][_0xa071('0x18')]);}return _0x4bbb31[_0xa071('0xe1')](_0x139237);}})['then'](function(_0x42fcf9){if(_0x42fcf9){return _0x42fcf9?{'count':_0x4b1605,'rows':_0x42fcf9}:null;}})[_0xa071('0x1d')](respondWithResult(_0x140209,null))[_0xa071('0x27')](handleError(_0x140209,null));};exports['getOpenchannelInteractions']=function(_0x17e31,_0x2814db){var _0x50141b={};var _0x560918={};var _0xf149ad;var _0x4321a1;return db[_0xa071('0x3a')]['findOne']({'where':{'id':_0x17e31[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x2814db,null))[_0xa071('0x1d')](function(_0xee2dc6){if(_0xee2dc6){_0xf149ad=_0xee2dc6;_0x560918[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xe3')]['rawAttributes']);_0x560918[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x17e31[_0xa071('0x44')]);_0x560918['filters']=_[_0xa071('0xd1')](_0x560918[_0xa071('0xd2')],_0x560918[_0xa071('0x44')]);_0x50141b[_0xa071('0x49')]=_['intersection'](_0x560918[_0xa071('0xd2')],qs['fields'](_0x17e31[_0xa071('0x44')]['fields']));_0x50141b['attributes']=_0x50141b[_0xa071('0x49')]['length']?_0x50141b[_0xa071('0x49')]:_0x560918[_0xa071('0xd2')];_0x50141b[_0xa071('0xde')]=qs[_0xa071('0xd4')](_0x17e31[_0xa071('0x44')][_0xa071('0xd4')]);_0x50141b[_0xa071('0x43')]=qs[_0xa071('0xd5')](_['pick'](_0x17e31['query'],_0x560918['filters']));if(_0x17e31['query'][_0xa071('0x31')]){_0x50141b['where']=_[_0xa071('0x58')](_0x50141b[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x50141b[_0xa071('0x49')],function(_0x1bf357){var _0x1d8513={};_0x1d8513[_0x1bf357]={'$like':'%'+_0x17e31[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x1d8513;})});}_0x50141b=_[_0xa071('0x58')]({},_0x50141b,_0x17e31[_0xa071('0x59')]);return _0xf149ad[_0xa071('0xe4')](_0x50141b);}})[_0xa071('0x1d')](function(_0x1c3996){if(_0x1c3996){_0x4321a1=_0x1c3996[_0xa071('0x6b')];if(!_0x17e31[_0xa071('0x44')]['hasOwnProperty'](_0xa071('0xd9'))){_0x50141b[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0x17e31[_0xa071('0x44')][_0xa071('0x1a')]);_0x50141b[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x17e31[_0xa071('0x44')]['offset']);}return _0xf149ad['getOpenchannelInteractions'](_0x50141b);}})[_0xa071('0x1d')](function(_0x16a244){if(_0x16a244){return _0x16a244?{'count':_0x4321a1,'rows':_0x16a244}:null;}})[_0xa071('0x1d')](respondWithResult(_0x2814db,null))[_0xa071('0x27')](handleError(_0x2814db,null));};exports[_0xa071('0xe5')]=function(_0x492650,_0x5b204d){var _0x5a13a4={'raw':!![],'where':{}};var _0x19e7f2={};var _0x3fe224={'count':0x0,'rows':[]};return db[_0xa071('0x3a')]['findOne']({'where':{'id':_0x492650[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x5b204d,null))[_0xa071('0x1d')](function(_0x2cd708){if(_0x2cd708){_0x19e7f2['model']=_[_0xa071('0xd0')](db['MailInteraction'][_0xa071('0x3b')]);_0x19e7f2[_0xa071('0x44')]=_['keys'](_0x492650['query']);_0x19e7f2[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x19e7f2[_0xa071('0xd2')],_0x19e7f2['query']);_0x5a13a4[_0xa071('0x49')]=_['intersection'](_0x19e7f2[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0x492650[_0xa071('0x44')][_0xa071('0xd3')]));_0x5a13a4[_0xa071('0x49')]=_0x5a13a4[_0xa071('0x49')][_0xa071('0x6b')]?_0x5a13a4[_0xa071('0x49')]:_0x19e7f2[_0xa071('0xd2')];if(!_0x492650[_0xa071('0x44')]['hasOwnProperty'](_0xa071('0xd9'))){_0x5a13a4[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0x492650[_0xa071('0x44')][_0xa071('0x1a')]);_0x5a13a4[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x492650[_0xa071('0x44')][_0xa071('0x18')]);}_0x5a13a4[_0xa071('0xde')]=qs[_0xa071('0xd4')](_0x492650[_0xa071('0x44')][_0xa071('0xd4')]);_0x5a13a4[_0xa071('0x43')]=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x492650[_0xa071('0x44')],_0x19e7f2[_0xa071('0xd5')]));_0x5a13a4[_0xa071('0x43')][_0xa071('0xe6')]=_0x2cd708['id'];if(_0x492650['query'][_0xa071('0x31')]){_0x5a13a4[_0xa071('0x43')]=_[_0xa071('0x58')](_0x5a13a4[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x5a13a4[_0xa071('0x49')],function(_0x5f545d){var _0x524006={};_0x524006[_0x5f545d]={'$like':'%'+_0x492650['query'][_0xa071('0x31')]+'%'};return _0x524006;})});}_0x5a13a4=_[_0xa071('0x58')]({},_0x5a13a4,_0x492650[_0xa071('0x59')]);return db['MailInteraction']['count']({'where':_0x5a13a4[_0xa071('0x43')]})['then'](function(_0x3dfa7a){_0x3fe224[_0xa071('0x1b')]=_0x3dfa7a;if(_0x492650[_0xa071('0x44')]['includeAll']){_0x5a13a4[_0xa071('0x46')]=[{'all':!![]}];}return db[_0xa071('0xe7')]['findAll'](_0x5a13a4);})[_0xa071('0x1d')](function(_0x456865){_0x3fe224[_0xa071('0x4c')]=_0x456865;return _0x3fe224;});}})[_0xa071('0x1d')](respondWithFilteredResult(_0x5b204d,_0x5a13a4))[_0xa071('0x27')](handleError(_0x5b204d,null));};exports[_0xa071('0xe8')]=function(_0x4e2c77,_0x1a91b3){var _0x576812={};var _0x14784f={};var _0x3cc9cc;var _0x518bf3;return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x4e2c77['params']['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x1a91b3,null))[_0xa071('0x1d')](function(_0x9fba3){if(_0x9fba3){_0x3cc9cc=_0x9fba3;_0x14784f[_0xa071('0xd2')]=_['keys'](db[_0xa071('0xe9')][_0xa071('0x3b')]);_0x14784f[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x4e2c77['query']);_0x14784f[_0xa071('0xd5')]=_['intersection'](_0x14784f['model'],_0x14784f[_0xa071('0x44')]);_0x576812['attributes']=_[_0xa071('0xd1')](_0x14784f['model'],qs[_0xa071('0xd3')](_0x4e2c77[_0xa071('0x44')]['fields']));_0x576812['attributes']=_0x576812[_0xa071('0x49')][_0xa071('0x6b')]?_0x576812['attributes']:_0x14784f[_0xa071('0xd2')];_0x576812[_0xa071('0xde')]=qs['sort'](_0x4e2c77[_0xa071('0x44')]['sort']);_0x576812[_0xa071('0x43')]=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x4e2c77[_0xa071('0x44')],_0x14784f[_0xa071('0xd5')]));if(_0x4e2c77[_0xa071('0x44')]['filter']){_0x576812[_0xa071('0x43')]=_[_0xa071('0x58')](_0x576812[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x576812[_0xa071('0x49')],function(_0xa0fa5){var _0x2d1aff={};_0x2d1aff[_0xa0fa5]={'$like':'%'+_0x4e2c77[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x2d1aff;})});}_0x576812=_['merge']({},_0x576812,_0x4e2c77[_0xa071('0x59')]);return _0x3cc9cc[_0xa071('0xe8')](_0x576812);}})[_0xa071('0x1d')](function(_0x439878){if(_0x439878){_0x518bf3=_0x439878[_0xa071('0x6b')];if(!_0x4e2c77[_0xa071('0x44')][_0xa071('0xca')]('nolimit')){_0x576812[_0xa071('0x1a')]=qs['limit'](_0x4e2c77[_0xa071('0x44')][_0xa071('0x1a')]);_0x576812[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x4e2c77[_0xa071('0x44')][_0xa071('0x18')]);}return _0x3cc9cc['getSmsInteractions'](_0x576812);}})[_0xa071('0x1d')](function(_0x1a07f0){if(_0x1a07f0){return _0x1a07f0?{'count':_0x518bf3,'rows':_0x1a07f0}:null;}})[_0xa071('0x1d')](respondWithResult(_0x1a91b3,null))[_0xa071('0x27')](handleError(_0x1a91b3,null));};exports[_0xa071('0xea')]=function(_0x19e329,_0x19fb31){var _0xa8cb2c={};var _0x473b2e={};var _0x54ca1c;var _0x4c3c99;return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x19e329['params']['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x19fb31,null))['then'](function(_0x1d5dff){if(_0x1d5dff){_0x54ca1c=_0x1d5dff;_0x473b2e[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xeb')][_0xa071('0x3b')]);_0x473b2e['query']=_[_0xa071('0xd0')](_0x19e329[_0xa071('0x44')]);_0x473b2e['filters']=_[_0xa071('0xd1')](_0x473b2e[_0xa071('0xd2')],_0x473b2e[_0xa071('0x44')]);_0xa8cb2c[_0xa071('0x49')]=_['intersection'](_0x473b2e[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0x19e329['query'][_0xa071('0xd3')]));_0xa8cb2c[_0xa071('0x49')]=_0xa8cb2c[_0xa071('0x49')][_0xa071('0x6b')]?_0xa8cb2c[_0xa071('0x49')]:_0x473b2e['model'];_0xa8cb2c['order']=qs[_0xa071('0xd4')](_0x19e329[_0xa071('0x44')]['sort']);_0xa8cb2c['where']=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x19e329['query'],_0x473b2e[_0xa071('0xd5')]));if(_0x19e329['query'][_0xa071('0x31')]){_0xa8cb2c[_0xa071('0x43')]=_['merge'](_0xa8cb2c['where'],{'$or':_['map'](_0xa8cb2c['attributes'],function(_0x4836fa){var _0x5280eb={};_0x5280eb[_0x4836fa]={'$like':'%'+_0x19e329[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x5280eb;})});}_0xa8cb2c=_[_0xa071('0x58')]({},_0xa8cb2c,_0x19e329['options']);return _0x54ca1c[_0xa071('0xea')](_0xa8cb2c);}})[_0xa071('0x1d')](function(_0x275b78){if(_0x275b78){_0x4c3c99=_0x275b78[_0xa071('0x6b')];if(!_0x19e329[_0xa071('0x44')]['hasOwnProperty'](_0xa071('0xd9'))){_0xa8cb2c[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0x19e329[_0xa071('0x44')][_0xa071('0x1a')]);_0xa8cb2c[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x19e329['query'][_0xa071('0x18')]);}return _0x54ca1c[_0xa071('0xea')](_0xa8cb2c);}})[_0xa071('0x1d')](function(_0x2721a5){if(_0x2721a5){return _0x2721a5?{'count':_0x4c3c99,'rows':_0x2721a5}:null;}})[_0xa071('0x1d')](respondWithResult(_0x19fb31,null))['catch'](handleError(_0x19fb31,null));};exports[_0xa071('0xec')]=function(_0x58c283,_0x4a567a){var _0x231425={};var _0x5cd777={};var _0x44f40d;var _0x43abd1;return db['User'][_0xa071('0x99')]({'where':{'id':_0x58c283[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x4a567a,null))[_0xa071('0x1d')](function(_0x587c31){if(_0x587c31){_0x44f40d=_0x587c31;_0x5cd777[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xed')][_0xa071('0x3b')]);_0x5cd777[_0xa071('0x44')]=_['keys'](_0x58c283[_0xa071('0x44')]);_0x5cd777[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x5cd777[_0xa071('0xd2')],_0x5cd777[_0xa071('0x44')]);_0x231425[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x5cd777['model'],qs['fields'](_0x58c283[_0xa071('0x44')][_0xa071('0xd3')]));_0x231425[_0xa071('0x49')]=_0x231425[_0xa071('0x49')][_0xa071('0x6b')]?_0x231425['attributes']:_0x5cd777[_0xa071('0xd2')];_0x231425[_0xa071('0xde')]=qs['sort'](_0x58c283['query'][_0xa071('0xd4')]);_0x231425['where']=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x58c283[_0xa071('0x44')],_0x5cd777[_0xa071('0xd5')]));if(_0x58c283[_0xa071('0x44')][_0xa071('0x31')]){_0x231425['where']=_[_0xa071('0x58')](_0x231425['where'],{'$or':_[_0xa071('0x8c')](_0x231425[_0xa071('0x49')],function(_0x25422f){var _0x1c15a5={};_0x1c15a5[_0x25422f]={'$like':'%'+_0x58c283[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x1c15a5;})});}_0x231425=_['merge']({},_0x231425,_0x58c283['options']);return _0x44f40d[_0xa071('0xec')](_0x231425);}})[_0xa071('0x1d')](function(_0x20ac14){if(_0x20ac14){_0x43abd1=_0x20ac14['length'];if(!_0x58c283[_0xa071('0x44')]['hasOwnProperty'](_0xa071('0xd9'))){_0x231425['limit']=qs[_0xa071('0x1a')](_0x58c283[_0xa071('0x44')]['limit']);_0x231425[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x58c283[_0xa071('0x44')][_0xa071('0x18')]);}return _0x44f40d[_0xa071('0xec')](_0x231425);}})['then'](function(_0x2bfc00){if(_0x2bfc00){return _0x2bfc00?{'count':_0x43abd1,'rows':_0x2bfc00}:null;}})[_0xa071('0x1d')](respondWithResult(_0x4a567a,null))['catch'](handleError(_0x4a567a,null));};exports[_0xa071('0xee')]=function(_0x2664e2,_0x2ed8ae,_0x5cb6e0){var _0x506d87;var _0x4a63de;var _0x381835;var _0x241d70=!_[_0xa071('0x67')](_0x2664e2['params']['id'])?_0x2664e2['params']['id']:!_['isNil'](_0x2664e2[_0xa071('0x81')]['id'])?_0x2664e2[_0xa071('0x81')]['id']:null;return db['User'][_0xa071('0x35')]({'where':{'id':_0x241d70,'role':{'$or':[_0xa071('0x2d'),_0xa071('0x81'),'agent']}},'attributes':['id',_0xa071('0x36'),'phone',_0xa071('0xef'),_0xa071('0x2c'),_0xa071('0x61'),_0xa071('0xa0')]})['then'](function(_0x3129bf){if(_0x3129bf){if(_0x3129bf['role']===_0xa071('0x28')){_0x506d87=_0x3129bf;if(_0x2664e2[_0xa071('0x5c')][_0xa071('0xa1')]){_0x381835=util[_0xa071('0xab')](_0xa071('0xf0'),_0x506d87[_0x2664e2['body'][_0xa071('0xa1')]]);}else if(_0x2664e2[_0xa071('0x5c')]['intrf']){_0x381835=util[_0xa071('0xab')](_0xa071('0xf1'),_0x2664e2['body'][_0xa071('0xf2')]);}else{_0x381835=util[_0xa071('0xab')]('SIP/%s',_0x506d87[_0xa071('0x36')]);}socket['to'](util['format'](_0xa071('0xf3'),_0x506d87[_0xa071('0x36')]))[_0xa071('0x29')](_0xa071('0xf4'),{'user':{'id':_0x506d87['id'],'name':_0x506d87['name']},'ip':_0x2664e2[_0xa071('0xf5')][_0xa071('0xf6')]||_0x2664e2[_0xa071('0xf7')][_0xa071('0xf8')]||_0x2664e2[_0xa071('0xf9')][_0xa071('0xf8')]||_0x2664e2[_0xa071('0xf7')][_0xa071('0xf9')][_0xa071('0xf8')]});return new Promise(function(_0x4ca9d7,_0x307840){db[_0xa071('0xfa')][_0xa071('0xfb')]()[_0xa071('0x1d')](_0x3d4c06=>{db[_0xa071('0xad')][_0xa071('0x2a')]({'where':{'membername':_0x506d87['name']},'individualHooks':!![]},{'transaction':_0x3d4c06})[_0xa071('0x1d')](function(){return _0x3d4c06[_0xa071('0xfc')]();})['then'](_0x4ca9d7)[_0xa071('0x27')](_0x307840);});});}}else{throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))](_0xa071('0xfd'));}})[_0xa071('0x1d')](function(){if(_0x506d87){return _0x506d87[_0xa071('0xfe')]({'raw':!![]});}})['then'](function(_0x595493){if(_0x506d87){if(_0x595493){_0x4a63de=_0x595493;if(_0x4a63de[_0xa071('0x6b')]){var _0x3f371e=_0x4a63de[_0xa071('0x8c')](function(_0x240817){return{'membername':_0x506d87[_0xa071('0x36')],'UserId':_0x506d87['id'],'queue_name':_0x240817[_0xa071('0x36')],'VoiceQueueId':_0x240817['id'],'interface':_0x381835,'paused':_0x506d87[_0xa071('0xa0')]||![],'penalty':_0x240817[_0xa071('0xff')]||0x0};});return db[_0xa071('0xad')][_0xa071('0x100')](_0x3f371e);}}}})[_0xa071('0x1d')](function(){if(_0x506d87){return db['MemberReport'][_0xa071('0x8d')]({'where':{'membername':_0x506d87[_0xa071('0x36')],'exitAt':null}});}})['then'](function(_0x304a24){if(_0x506d87){var _0x5ca310=[];_0x304a24['forEach'](function(_0x2c8bd9){_0x5ca310[_0xa071('0x4a')](_0x2c8bd9[_0xa071('0x5b')]({'exitAt':moment()[_0xa071('0xab')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x5ca310);}})[_0xa071('0x1d')](function(){if(_0x506d87){var _0x309b18=[];var _0x2190ca=[];var _0x2320bb=utils[_0xa071('0x101')]();var _0x31cd98={'membername':_0x506d87[_0xa071('0x36')],'interface':_0x381835,'enterAt':moment()[_0xa071('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x506d87[_0xa071('0x2c')],'internal':_0x506d87[_0xa071('0x61')]};_0x2320bb[_0xa071('0x102')](function(_0x1aba9d){_0x309b18[_0xa071('0x4a')](_[_0xa071('0x58')]({'channel':_0x1aba9d,'type':_0xa071('0x103'),'data1':_0x2664e2[_0xa071('0x5c')][_0xa071('0x104')],'data2':_0x381835},_0x31cd98));if(_0x506d87[_0xa071('0xa0')]){_0x2190ca[_0xa071('0x4a')](_[_0xa071('0x58')]({'channel':_0x1aba9d,'type':_0xa071('0x105'),'data1':_0xa071('0x106')},_0x31cd98));}});return db['MemberReport'][_0xa071('0x100')](_0x309b18[_0xa071('0xc7')](_0x2190ca),{'individualHooks':!![]});}})['then'](function(){if(_0x506d87){return _0x506d87[_0xa071('0x5b')]({'online':!![],'lastLoginAt':moment()['format'](_0xa071('0x107')),'voicePause':_0x506d87['loginInPause']||![],'mailPause':_0x506d87[_0xa071('0xa0')]||![],'chatPause':_0x506d87[_0xa071('0xa0')]||![],'faxPause':_0x506d87[_0xa071('0xa0')]||![],'smsPause':_0x506d87[_0xa071('0xa0')]||![],'openchannelPause':_0x506d87[_0xa071('0xa0')]||![],'whatsappPause':_0x506d87[_0xa071('0xa0')]||![],'pauseType':_0x506d87[_0xa071('0xa0')]?_0xa071('0x106'):null,'interface':_0x381835,'lastPauseAt':moment()[_0xa071('0xab')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xa071('0x1d')](function(_0x481b9a){if(_0x2664e2[_0xa071('0x108')]){return _0x5cb6e0();}else{return Promise['resolve'](_0x481b9a)[_0xa071('0x1d')](respondWithResult(_0x2ed8ae,null));}})[_0xa071('0x27')](handleError(_0x2ed8ae,null));};exports[_0xa071('0x109')]=function(_0x353f72,_0x410c2a){var _0x5b49f5;return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x353f72[_0xa071('0x55')]['id'],'role':_0xa071('0x28')},'attributes':['id',_0xa071('0x36'),_0xa071('0x2c')]})[_0xa071('0x1d')](handleEntityNotFound(_0x410c2a,null))[_0xa071('0x1d')](function(_0x8c9e8d){if(_0x8c9e8d){_0x5b49f5=_0x8c9e8d;return db[_0xa071('0xad')][_0xa071('0x2a')]({'where':{'membername':_0x5b49f5[_0xa071('0x36')]},'individualHooks':!![]});}})[_0xa071('0x1d')](function(){return db[_0xa071('0x10a')][_0xa071('0x8d')]({'where':{'membername':_0x5b49f5['name'],'exitAt':null}});})[_0xa071('0x1d')](function(_0x5de4e6){var _0x5cfd3c=[];_0x5de4e6[_0xa071('0x102')](function(_0x133133){_0x5cfd3c[_0xa071('0x4a')](_0x133133[_0xa071('0x5b')]({'exitAt':moment()[_0xa071('0xab')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xa071('0x5a')](_0x5cfd3c);})['then'](function(){return _0x5b49f5['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa071('0x1d')](respondWithResult(_0x410c2a,null))[_0xa071('0x27')](handleError(_0x410c2a,null));};exports['pause']=function(_0x37b479,_0x817010){var _0x51ebff;return db[_0xa071('0xad')][_0xa071('0x5b')]({'paused':0x1},{'where':{'UserId':_0x37b479['params']['id']},'individualHooks':!![]})[_0xa071('0x1d')](function(){return db['User'][_0xa071('0x35')]({'where':{'id':_0x37b479[_0xa071('0x55')]['id'],'role':'agent'},'attributes':['id',_0xa071('0x36'),_0xa071('0x2c'),_0xa071('0x61'),_0xa071('0xa1'),'online']});})[_0xa071('0x1d')](handleEntityNotFound(_0x817010,null))[_0xa071('0x1d')](function(_0x43cd7f){if(_0x43cd7f){_0x51ebff=_0x43cd7f;return respondWithRpcPromise(_0xa071('0x10b'),_0xa071('0x10c'),{'id':_0x51ebff['id'],'name':_0x51ebff[_0xa071('0x36')],'pause':!![]});}})[_0xa071('0x1d')](function(){if(_0x51ebff){return db[_0xa071('0x10a')]['findAll']({'where':{'membername':_0x51ebff['name'],'type':_0xa071('0x105'),'exitAt':null}});}})['then'](function(_0x553056){if(_0x553056['length']){var _0x4d137d=moment()[_0xa071('0xab')](_0xa071('0x107'));for(var _0x29f5ee=0x0,_0x4363c8=_0x553056[_0xa071('0x6b')];_0x29f5ee<_0x4363c8;_0x29f5ee++){_0x553056[_0x29f5ee]['updateAttributes']({'exitAt':_0x4d137d});}}})[_0xa071('0x1d')](function(){var _0x450820=[];var _0x2be67e=utils[_0xa071('0x101')]();_0x2be67e[_0xa071('0x102')](function(_0xafba0f){_0x450820[_0xa071('0x4a')]({'channel':_0xafba0f,'membername':_0x51ebff[_0xa071('0x36')],'interface':_[_0xa071('0x67')](_0x51ebff['interface'])?util['format'](_0xa071('0xf1'),_0x51ebff[_0xa071('0x36')]):_0x51ebff['interface'],'type':_0xa071('0x105'),'enterAt':moment()['format'](_0xa071('0x107')),'data1':_0x37b479[_0xa071('0x5c')][_0xa071('0x3c')]||_0xa071('0x10d'),'role':_0x51ebff[_0xa071('0x2c')],'internal':_0x51ebff[_0xa071('0x61')]});});return db[_0xa071('0x10a')][_0xa071('0x100')](_0x450820,{'individualHooks':!![]});})[_0xa071('0x1d')](function(){return _0x51ebff[_0xa071('0x5b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x37b479['body'][_0xa071('0x3c')]||_0xa071('0x10d'),'lastPauseAt':moment()[_0xa071('0xab')](_0xa071('0x107'))});})['then'](respondWithResult(_0x817010,null))['catch'](handleError(_0x817010,null));};exports[_0xa071('0x10e')]=function(_0x7ed9cd,_0x25f143){if(_0x7ed9cd[_0xa071('0x5c')][_0xa071('0x9f')]&&!utils['isValidChannel'](_0x7ed9cd[_0xa071('0x5c')][_0xa071('0x9f')])){throw new APIBadRequestError(util[_0xa071('0xab')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x7ed9cd[_0xa071('0x5c')][_0xa071('0x9f')]));}return db['User'][_0xa071('0x35')]({'where':{'id':_0x7ed9cd[_0xa071('0x55')]['id']},'attributes':['id',_0xa071('0x36'),_0xa071('0x2c'),_0xa071('0x61'),'interface',_0xa071('0xaa'),'voicePause',_0xa071('0x10f'),_0xa071('0x110'),_0xa071('0x111'),_0xa071('0x112'),_0xa071('0x113'),'whatsappPause',_0xa071('0x114'),'lastPauseAt']})[_0xa071('0x1d')](function(_0x2aad1e){if(!_0x2aad1e){throw new APINotFoundError(util[_0xa071('0xab')](_0xa071('0xc9'),_0x7ed9cd[_0xa071('0x55')]['id']));}return _0x2aad1e['unpause'](_0x7ed9cd['body'][_0xa071('0x9f')]);})[_0xa071('0x1d')](respondWithResult(_0x25f143,null))['catch'](APIHandleError(_0x25f143));};exports[_0xa071('0x115')]=function(_0xfd7dcf,_0x1fcd1a){var _0x1f4602={};var _0x125842={};var _0x55ad15;var _0x44d55a;return db['User'][_0xa071('0x99')]({'where':{'id':_0xfd7dcf[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x1fcd1a,null))[_0xa071('0x1d')](function(_0x139069){if(_0x139069){_0x55ad15=_0x139069;_0x125842['model']=_['keys'](db[_0xa071('0x116')]['rawAttributes']);_0x125842[_0xa071('0x44')]=_[_0xa071('0xd0')](_0xfd7dcf[_0xa071('0x44')]);_0x125842[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x125842[_0xa071('0xd2')],_0x125842[_0xa071('0x44')]);_0x1f4602['attributes']=_[_0xa071('0xd1')](_0x125842[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0xfd7dcf['query'][_0xa071('0xd3')]));_0x1f4602[_0xa071('0x49')]=_0x1f4602[_0xa071('0x49')][_0xa071('0x6b')]?_0x1f4602[_0xa071('0x49')]:_0x125842[_0xa071('0xd2')];_0x1f4602['order']=qs[_0xa071('0xd4')](_0xfd7dcf['query']['sort']);_0x1f4602[_0xa071('0x43')]=qs['filters'](_[_0xa071('0xd6')](_0xfd7dcf['query'],_0x125842[_0xa071('0xd5')]));if(_0xfd7dcf[_0xa071('0x44')][_0xa071('0x31')]){_0x1f4602['where']=_[_0xa071('0x58')](_0x1f4602[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x1f4602[_0xa071('0x49')],function(_0xc48b69){var _0x3c40d5={};_0x3c40d5[_0xc48b69]={'$like':'%'+_0xfd7dcf[_0xa071('0x44')]['filter']+'%'};return _0x3c40d5;})});}_0x1f4602=_['merge']({},_0x1f4602,_0xfd7dcf[_0xa071('0x59')]);return _0x55ad15[_0xa071('0x115')](_0x1f4602);}})[_0xa071('0x1d')](function(_0x300f3b){if(_0x300f3b){_0x44d55a=_0x300f3b[_0xa071('0x6b')];if(!_0xfd7dcf[_0xa071('0x44')]['hasOwnProperty'](_0xa071('0xd9'))){_0x1f4602[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0xfd7dcf['query'][_0xa071('0x1a')]);_0x1f4602[_0xa071('0x18')]=qs[_0xa071('0x18')](_0xfd7dcf[_0xa071('0x44')]['offset']);}return _0x55ad15[_0xa071('0x115')](_0x1f4602);}})['then'](function(_0x4ab971){if(_0x4ab971){return _0x4ab971?{'count':_0x44d55a,'rows':_0x4ab971}:null;}})[_0xa071('0x1d')](respondWithResult(_0x1fcd1a,null))[_0xa071('0x27')](handleError(_0x1fcd1a,null));};exports['addTeams']=function(_0x73df80,_0x397af7){var _0x5430b3=_0x73df80[_0xa071('0x55')]['id'];var _0x5e2fb5=_0x73df80[_0xa071('0x5c')]?_0x73df80[_0xa071('0x5c')][_0xa071('0x5f')]:null;var _0x828212=[];return Promise['resolve']()[_0xa071('0x1d')](function(){if(!_0x5e2fb5)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x5430b3}});})[_0xa071('0x1d')](function(_0xd3961d){if(!_0xd3961d)throw new APINotFoundError(util[_0xa071('0xab')](_0xa071('0xc9'),_0x73df80[_0xa071('0x55')]['id']));return db['sequelize']['transaction'](function(_0x6ae3f7){return _0xd3961d[_0xa071('0x117')](_0x5e2fb5,{'transaction':_0x6ae3f7})['then'](function(){return db[_0xa071('0x116')][_0xa071('0x8d')]({'where':{'id':{'$in':_0x5e2fb5}}});})[_0xa071('0x1d')](function(_0xb07362){var _0x166a71=_[_0xa071('0x8c')](_0xb07362,function(_0x2486a9){return _0x2486a9[_0xa071('0x118')]();});return Promise['all'](_0x166a71);})[_0xa071('0x1d')](function(_0x296306){_0x828212=_[_0xa071('0x119')](_0x296306);var _0x7801ef=_[_0xa071('0x8c')](_0x828212,function(_0x4c8f14){return _0x4c8f14['addAgent'](_0xd3961d['id'],{'transaction':_0x6ae3f7});});return Promise[_0xa071('0x5a')](_0x7801ef);})[_0xa071('0x1d')](function(){if(!_0xd3961d[_0xa071('0xaa')])return;var _0x888e89=_[_0xa071('0x31')](_0x828212,function(_0x5abff8){return _0x5abff8[_0xa071('0x11a')]('channel')===_0xa071('0x11b');});var _0x214027=_[_0xa071('0x8c')](_0x888e89,function(_0x40e850){return db[_0xa071('0xad')][_0xa071('0xae')]({'membername':_0xd3961d['name'],'UserId':_0xd3961d['id'],'queue_name':_0x40e850[_0xa071('0x36')],'VoiceQueueId':_0x40e850['id'],'interface':_[_0xa071('0x67')](_0xd3961d[_0xa071('0xa1')])?util[_0xa071('0xab')](_0xa071('0xf1'),_0xd3961d[_0xa071('0x36')]):_0xd3961d[_0xa071('0xa1')],'paused':_0xd3961d[_0xa071('0xac')]||![],'penalty':_0xd3961d[_0xa071('0xa5')]},{'transaction':_0x6ae3f7});});return Promise[_0xa071('0x5a')](_0x214027);})[_0xa071('0x1d')](function(){return db[_0xa071('0x11c')][_0xa071('0x8d')]({'where':{'teamId':{'$in':_0x5e2fb5}}});})['then'](function(_0x32ce37){var _0x457dd7=_[_0xa071('0x8c')](_0x32ce37,function(_0x4db00a){return db[_0xa071('0x11d')][_0xa071('0x7f')]({'UserId':_0xd3961d['id'],'VoicePrefixId':_0x4db00a[_0xa071('0x11e')]},{'transaction':_0x6ae3f7});});return Promise[_0xa071('0x5a')](_0x457dd7);});});})[_0xa071('0x1d')](function(){for(var _0x5538de=0x0;_0x5538de<_0x828212[_0xa071('0x6b')];_0x5538de++){var _0x3f2f08=_0x828212[_0x5538de][_0xa071('0x11a')]('channel');var _0x5bbf01=_0x3f2f08+'QueueId';socket[_0xa071('0x29')](_0xa071('0x81')+_0x3f2f08+'Queue:save',{'UserId':_0x5430b3,['queueField']:_0x828212[_0x5538de]['id']});}})[_0xa071('0x1d')](respondWithStatusCode(_0x397af7,null))[_0xa071('0x27')](APIHandleError(_0x397af7));};exports[_0xa071('0x11f')]=function(_0xff4f1b,_0x24e46f){var _0x55707d=_0xff4f1b[_0xa071('0x55')]['id'];var _0x50fd65=null;if(_0xff4f1b[_0xa071('0x44')][_0xa071('0x5f')]){_0x50fd65=_[_0xa071('0xb3')](_0xff4f1b[_0xa071('0x44')][_0xa071('0x5f')])?_0xff4f1b[_0xa071('0x44')][_0xa071('0x5f')]:[_0xff4f1b[_0xa071('0x44')][_0xa071('0x5f')]];}var _0xd4ac2a=[];return Promise[_0xa071('0x120')]()['then'](function(){if(!_0x50fd65)throw new APIBadRequestError(_0xa071('0x121'));})[_0xa071('0x1d')](function(){return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x55707d}});})['then'](function(_0x2de13a){if(!_0x2de13a)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0xff4f1b[_0xa071('0x55')]['id']));return db['sequelize'][_0xa071('0xfb')](function(_0xdfbd1f){return _0x2de13a['removeTeams'](_0x50fd65,{'transaction':_0xdfbd1f})[_0xa071('0x1d')](function(){return db['Team'][_0xa071('0x8d')]({'where':{'id':{'$in':_0x50fd65}}});})[_0xa071('0x1d')](function(_0x4370b3){var _0x5ce446=_[_0xa071('0x8c')](_0x4370b3,function(_0x57ef39){return _0x57ef39['getAssociatedQueues']();});return Promise[_0xa071('0x5a')](_0x5ce446);})[_0xa071('0x1d')](function(_0x209af3){_0xd4ac2a=_[_0xa071('0x119')](_0x209af3);var _0x46361c=_['map'](_0xd4ac2a,function(_0x497faf){return _0x497faf[_0xa071('0x122')](_0x2de13a['id'],{'transaction':_0xdfbd1f});});return Promise[_0xa071('0x5a')](_0x46361c);})[_0xa071('0x1d')](function(){if(!_0x2de13a[_0xa071('0xaa')])return;var _0x50fe5b=_['filter'](_0xd4ac2a,function(_0x2d678c){return _0x2d678c[_0xa071('0x11a')]('channel')===_0xa071('0x11b');});var _0x58cdb7=_['map'](_0x50fe5b,function(_0x37023c){return db[_0xa071('0xad')][_0xa071('0x2a')]({'where':{'VoiceQueueId':_0x37023c['id'],'UserId':_0x2de13a['id']},'transaction':_0xdfbd1f});});return Promise[_0xa071('0x5a')](_0x58cdb7);})[_0xa071('0x1d')](function(){return db['TeamVoicePrefix'][_0xa071('0x8d')]({'where':{'teamId':{'$in':_0x50fd65}}});})[_0xa071('0x1d')](function(_0x2a92cc){var _0x314acf=_[_0xa071('0x8c')](_0x2a92cc,function(_0x284c48){return db['UserVoicePrefix'][_0xa071('0x2a')]({'where':{'UserId':_0x2de13a['id'],'VoicePrefixId':_0x284c48[_0xa071('0x11e')]}},{'transaction':_0xdfbd1f});});return Promise[_0xa071('0x5a')](_0x314acf);});});})[_0xa071('0x1d')](function(){for(var _0x280dc0=0x0;_0x280dc0<_0xd4ac2a[_0xa071('0x6b')];_0x280dc0++){var _0x1d3747=_0xd4ac2a[_0x280dc0][_0xa071('0x11a')]('channel');var _0x59c914=_0x1d3747+_0xa071('0x123');socket[_0xa071('0x29')]('user'+_0x1d3747+_0xa071('0xb4'),{'UserId':_0x55707d,['queueField']:_0xd4ac2a[_0x280dc0]['id']});}})[_0xa071('0x1d')](respondWithStatusCode(_0x24e46f,null))['catch'](APIHandleError(_0x24e46f));};exports['getLists']=function(_0x49ce15,_0x182ef4){var _0x2fa309={};var _0x2c144d={};var _0x50e78c;var _0x101f10;return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x49ce15[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x182ef4,null))[_0xa071('0x1d')](function(_0x22f6ce){if(_0x22f6ce){_0x50e78c=_0x22f6ce;_0x2c144d[_0xa071('0xd2')]=_[_0xa071('0xd0')](db['CmList'][_0xa071('0x3b')]);_0x2c144d['query']=_[_0xa071('0xd0')](_0x49ce15[_0xa071('0x44')]);_0x2c144d[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x2c144d[_0xa071('0xd2')],_0x2c144d[_0xa071('0x44')]);_0x2fa309['attributes']=_['intersection'](_0x2c144d[_0xa071('0xd2')],qs['fields'](_0x49ce15[_0xa071('0x44')][_0xa071('0xd3')]));_0x2fa309[_0xa071('0x49')]=_0x2fa309[_0xa071('0x49')][_0xa071('0x6b')]?_0x2fa309[_0xa071('0x49')]:_0x2c144d[_0xa071('0xd2')];_0x2fa309[_0xa071('0xde')]=qs[_0xa071('0xd4')](_0x49ce15['query'][_0xa071('0xd4')]);_0x2fa309[_0xa071('0x43')]=qs['filters'](_['pick'](_0x49ce15[_0xa071('0x44')],_0x2c144d['filters']));if(_0x49ce15['query']['filter']){_0x2fa309[_0xa071('0x43')]=_[_0xa071('0x58')](_0x2fa309['where'],{'$or':_[_0xa071('0x8c')](_0x2fa309[_0xa071('0x49')],function(_0xf6d19b){var _0x293a94={};_0x293a94[_0xf6d19b]={'$like':'%'+_0x49ce15[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x293a94;})});}_0x2fa309=_['merge']({},_0x2fa309,_0x49ce15[_0xa071('0x59')]);return _0x50e78c[_0xa071('0x124')](_0x2fa309);}})[_0xa071('0x1d')](function(_0x26095a){if(_0x26095a){_0x101f10=_0x26095a[_0xa071('0x6b')];if(!_0x49ce15[_0xa071('0x44')][_0xa071('0xca')](_0xa071('0xd9'))){_0x2fa309['limit']=qs[_0xa071('0x1a')](_0x49ce15['query']['limit']);_0x2fa309[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x49ce15[_0xa071('0x44')][_0xa071('0x18')]);}return _0x50e78c[_0xa071('0x124')](_0x2fa309);}})[_0xa071('0x1d')](function(_0xa36b44){if(_0xa36b44){return _0xa36b44?{'count':_0x101f10,'rows':_0xa36b44}:null;}})[_0xa071('0x1d')](respondWithResult(_0x182ef4,null))[_0xa071('0x27')](handleError(_0x182ef4,null));};exports['getAgents']=function(_0x40aa04,_0x3a95bc){var _0x3d4d62={};var _0x4a3871={};var _0x5f57a9;return db[_0xa071('0x3a')]['findOne']({'where':{'id':_0x40aa04['params']['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x3a95bc,null))[_0xa071('0x1d')](function(_0x245207){if(_0x245207){_0x5f57a9=_0x245207;_0x4a3871[_0xa071('0xd2')]=_['keys'](db[_0xa071('0x3a')][_0xa071('0x3b')]);_0x4a3871[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x40aa04[_0xa071('0x44')]);_0x4a3871['filters']=_[_0xa071('0xd1')](_0x4a3871[_0xa071('0xd2')],_0x4a3871[_0xa071('0x44')]);_0x3d4d62[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x4a3871['model'],qs[_0xa071('0xd3')](_0x40aa04[_0xa071('0x44')][_0xa071('0xd3')]));_0x3d4d62[_0xa071('0x49')]=_0x3d4d62[_0xa071('0x49')][_0xa071('0x6b')]?_0x3d4d62[_0xa071('0x49')]:_0x4a3871[_0xa071('0xd2')];_0x3d4d62[_0xa071('0xde')]=qs[_0xa071('0xd4')](_0x40aa04[_0xa071('0x44')][_0xa071('0xd4')]);_0x3d4d62['where']=qs['filters'](_[_0xa071('0xd6')](_0x40aa04[_0xa071('0x44')],_0x4a3871['filters']));if(_0x40aa04[_0xa071('0x44')][_0xa071('0x31')]){_0x3d4d62[_0xa071('0x43')]=_[_0xa071('0x58')](_0x3d4d62['where'],{'$or':_[_0xa071('0x8c')](_0x3d4d62[_0xa071('0x49')],function(_0x2a6b04){var _0x160c63={};_0x160c63[_0x2a6b04]={'$like':'%'+_0x40aa04[_0xa071('0x44')]['filter']+'%'};return _0x160c63;})});}_0x3d4d62['model']=db['User'];_0x3d4d62['as']=_0xa071('0x2f');_0x3d4d62=_['merge']({},_0x3d4d62,_0x40aa04[_0xa071('0x59')]);return _0x5f57a9[_0xa071('0xfe')]({'include':[_0x3d4d62]});}})[_0xa071('0x1d')](function(_0xb9aecb){if(_0xb9aecb){var _0x5ce752={},_0x2ab4f0=[];for(var _0x1d35d3=0x0;_0x1d35d3<_0xb9aecb[_0xa071('0x6b')];_0x1d35d3+=0x1){for(var _0x2bd851=0x0,_0x2f03a3;_0x2bd851<_0xb9aecb[_0x1d35d3][_0xa071('0x2f')]['length'];_0x2bd851+=0x1){_0x2f03a3=_0xb9aecb[_0x1d35d3]['Agents'][_0x2bd851][_0xa071('0x2b')]({'plain':!![]});_0x5ce752[_0x2f03a3['id']]=_0x2f03a3;}}_0x5ce752=_[_0xa071('0x125')](_0x5ce752);for(var _0x85c77c=qs[_0xa071('0x18')](_0x40aa04[_0xa071('0x44')][_0xa071('0x18')]);_0x85c77c<_0x5ce752[_0xa071('0x6b')]&&_0x2ab4f0['length']=_0x2b9234[_0xc936('0x53')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x2a156a){return db['UserVoiceQueueRt'][_0xc936('0x48')]({'where':{'membername':_0x2a156a['name']},'individualHooks':!![]});}})[_0xc936('0x15')](function(){if(_0x2a156a){return _0x2a156a[_0xc936('0x54')]({'raw':!![]});}})['then'](function(_0x270aa1){if(_0x2a156a){if(_0x270aa1){var _0x374d66=[];_0x1ede84=_0x270aa1;if(_0x1ede84[_0xc936('0x2b')]){for(var _0x1f5135=0x0;_0x1f5135<_0x1ede84[_0xc936('0x2b')];_0x1f5135++){_0x374d66[_0xc936('0x49')](db[_0xc936('0x47')][_0xc936('0x55')]({'membername':_0x2a156a['name'],'UserId':_0x2a156a['id'],'queue_name':_0x1ede84[_0x1f5135][_0xc936('0x22')],'VoiceQueueId':_0x1ede84[_0x1f5135]['id'],'interface':_0x2287b6,'paused':_0x2a156a[_0xc936('0x4e')]||![],'penalty':_0x1ede84[_0x1f5135][_0xc936('0x56')]||0x0}));}return BPromise[_0xc936('0x4a')](_0x374d66);}}}})[_0xc936('0x15')](function(){if(_0x2a156a){return db[_0xc936('0x28')][_0xc936('0x29')]({'where':{'membername':_0x2a156a[_0xc936('0x22')],'exitAt':null}});}})[_0xc936('0x15')](function(_0x3f81b4){if(_0x2a156a){if(_0x3f81b4&&_0x3f81b4[_0xc936('0x2b')]){var _0x390da6=[];_0x3f81b4[_0xc936('0x2e')](function(_0x295a80){_0x390da6[_0xc936('0x49')](_0x295a80['update']({'exitAt':moment()[_0xc936('0x30')](_0xc936('0x32'))}));});return BPromise[_0xc936('0x4a')](_0x390da6);}}})[_0xc936('0x15')](function(){if(_0x2a156a){var _0x1666c8=[];var _0x22c98f=[];var _0x29d661=utils['getChannels']();var _0x333a49={'membername':_0x2a156a['name'],'interface':_0x2287b6,'enterAt':moment()[_0xc936('0x30')](_0xc936('0x32')),'role':_0x2a156a[_0xc936('0x33')],'internal':_0x2a156a[_0xc936('0x23')]};_0x29d661[_0xc936('0x2e')](function(_0x50e13a){_0x1666c8[_0xc936('0x49')](_[_0xc936('0x57')]({'channel':_0x50e13a,'type':'LOGIN','data1':_0xc936('0x58'),'data2':_0x2287b6},_0x333a49));if(_0x2a156a['loginInPause']){_0x22c98f[_0xc936('0x49')](_[_0xc936('0x57')]({'channel':_0x50e13a,'type':'PAUSE','data1':_0xc936('0x59')},_0x333a49));}});return db[_0xc936('0x28')]['bulkCreate'](_0x1666c8[_0xc936('0x5a')](_0x22c98f),{'individualHooks':!![]});}})[_0xc936('0x15')](function(){if(_0x2a156a){return _0x2a156a['update']({'online':!![],'lastLoginAt':moment()[_0xc936('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2a156a[_0xc936('0x4e')]||![],'mailPause':_0x2a156a[_0xc936('0x4e')]||![],'chatPause':_0x2a156a[_0xc936('0x4e')]||![],'faxPause':_0x2a156a[_0xc936('0x4e')]||![],'smsPause':_0x2a156a['loginInPause']||![],'openchannelPause':_0x2a156a[_0xc936('0x4e')]||![],'pauseType':_0x2a156a[_0xc936('0x4e')]?_0xc936('0x59'):null,'lastPauseAt':moment()[_0xc936('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2287b6});}})[_0xc936('0x15')](function(_0x34ab41){_0x53a4cd(_0x34ab41);})['catch'](function(_0x2036fd){_0x2e961a(_0x1cae00[_0xc936('0x1a')](0x1f4,_0x2036fd['message']));});});}; \ No newline at end of file +var _0x4c54=['isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','online','voicePause','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','params','unpause','LogoutUser','destroy','forEach','all','findOne','mobile','phone','loginInPause','SIP/%s','agent','../../config/license/util','agents','getVoiceQueues','UserVoiceQueue.penalty','findAll','merge','callysquare','LOGININPAUSE','concat','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetUser','User','options','raw','where','limit','include','map','attributes','model','then','info','debug','stringify','error','message','ShowUser','find','catch','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','push','isNil','type','body','uniqueid','bulkCreate','update','DEFAULT\x20PAUSE','resolve','channel'];(function(_0x1b4877,_0x182a0e){var _0x4c6230=function(_0x68ee75){while(--_0x68ee75){_0x1b4877['push'](_0x1b4877['shift']());}};_0x4c6230(++_0x182a0e);}(_0x4c54,0x177));var _0x44c5=function(_0x4cb122,_0x26e468){_0x4cb122=_0x4cb122-0x0;var _0x338dfd=_0x4c54[_0x4cb122];return _0x338dfd;};'use strict';var _=require(_0x44c5('0x0'));var util=require('util');var moment=require(_0x44c5('0x1'));var BPromise=require(_0x44c5('0x2'));var Redis=require(_0x44c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x44c5('0x4'));var logger=require('../../config/logger')(_0x44c5('0x5'));var config=require(_0x44c5('0x6'));config[_0x44c5('0x7')]=_[_0x44c5('0x8')](config[_0x44c5('0x7')],{'host':_0x44c5('0x9'),'port':0x18eb});var socket=require(_0x44c5('0xa'))(new Redis(config[_0x44c5('0x7')]));require('./user.socket')[_0x44c5('0xb')](socket);exports[_0x44c5('0xc')]=function(_0x2e2a36){var _0x5d69e4=this;return new Promise(function(_0x200128,_0x4b857d){return db[_0x44c5('0xd')]['findAll']({'raw':_0x2e2a36[_0x44c5('0xe')]?_0x2e2a36[_0x44c5('0xe')][_0x44c5('0xf')]===undefined?!![]:![]:!![],'where':_0x2e2a36[_0x44c5('0xe')]?_0x2e2a36['options'][_0x44c5('0x10')]||null:null,'attributes':_0x2e2a36['options']?_0x2e2a36[_0x44c5('0xe')]['attributes']||null:null,'limit':_0x2e2a36[_0x44c5('0xe')]?_0x2e2a36[_0x44c5('0xe')][_0x44c5('0x11')]||null:null,'include':_0x2e2a36['options']?_0x2e2a36[_0x44c5('0xe')][_0x44c5('0x12')]?_[_0x44c5('0x13')](_0x2e2a36['options'][_0x44c5('0x12')],function(_0x521255){return{'model':db[_0x521255['model']],'as':_0x521255['as'],'attributes':_0x521255[_0x44c5('0x14')],'include':_0x521255[_0x44c5('0x12')]?_[_0x44c5('0x13')](_0x521255[_0x44c5('0x12')],function(_0x110c06){return{'model':db[_0x110c06[_0x44c5('0x15')]],'as':_0x110c06['as'],'attributes':_0x110c06['attributes'],'include':_0x110c06[_0x44c5('0x12')]?_['map'](_0x110c06[_0x44c5('0x12')],function(_0x473794){return{'model':db[_0x473794['model']],'as':_0x473794['as'],'attributes':_0x473794['attributes']};}):[]};}):[]};}):[]:[]})[_0x44c5('0x16')](function(_0x39f1bd){logger[_0x44c5('0x17')](_0x44c5('0xc'),_0x2e2a36);logger[_0x44c5('0x18')](_0x44c5('0xc'),_0x2e2a36,JSON[_0x44c5('0x19')](_0x39f1bd));_0x200128(_0x39f1bd);})['catch'](function(_0x4d5fdf){logger[_0x44c5('0x1a')]('GetUser',_0x4d5fdf[_0x44c5('0x1b')],_0x2e2a36);_0x4b857d(_0x5d69e4[_0x44c5('0x1a')](0x1f4,_0x4d5fdf[_0x44c5('0x1b')]));});});};exports[_0x44c5('0x1c')]=function(_0x3d8156){var _0x4896a3=this;return new Promise(function(_0x4295ab,_0x153f72){return db[_0x44c5('0xd')][_0x44c5('0x1d')]({'raw':_0x3d8156['options']?_0x3d8156[_0x44c5('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x3d8156[_0x44c5('0xe')]?_0x3d8156[_0x44c5('0xe')]['where']||null:null,'attributes':_0x3d8156[_0x44c5('0xe')]?_0x3d8156[_0x44c5('0xe')][_0x44c5('0x14')]||null:null,'include':_0x3d8156[_0x44c5('0xe')]?_0x3d8156[_0x44c5('0xe')][_0x44c5('0x12')]?_[_0x44c5('0x13')](_0x3d8156[_0x44c5('0xe')][_0x44c5('0x12')],function(_0x1103aa){return{'model':db[_0x1103aa[_0x44c5('0x15')]],'as':_0x1103aa['as'],'attributes':_0x1103aa[_0x44c5('0x14')],'include':_0x1103aa[_0x44c5('0x12')]?_['map'](_0x1103aa['include'],function(_0x41c682){return{'model':db[_0x41c682[_0x44c5('0x15')]],'as':_0x41c682['as'],'attributes':_0x41c682[_0x44c5('0x14')],'include':_0x41c682[_0x44c5('0x12')]?_['map'](_0x41c682[_0x44c5('0x12')],function(_0x506ac7){return{'model':db[_0x506ac7[_0x44c5('0x15')]],'as':_0x506ac7['as'],'attributes':_0x506ac7[_0x44c5('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x264fd7){logger[_0x44c5('0x17')]('ShowUser',_0x3d8156);logger['debug'](_0x44c5('0x1c'),_0x3d8156,JSON[_0x44c5('0x19')](_0x264fd7));_0x4295ab(_0x264fd7);})[_0x44c5('0x1e')](function(_0x54db51){logger[_0x44c5('0x1a')](_0x44c5('0x1c'),_0x54db51[_0x44c5('0x1b')],_0x3d8156);_0x153f72(_0x4896a3['error'](0x1f4,_0x54db51[_0x44c5('0x1b')]));});});};exports[_0x44c5('0x1f')]=function(_0x185ada){var _0x20e9f6;return db[_0x44c5('0xd')]['find']({'where':_0x185ada['options'][_0x44c5('0x10')]||{},'attributes':['id',_0x44c5('0x20'),_0x44c5('0x21'),_0x44c5('0x22'),_0x44c5('0x23')]})[_0x44c5('0x16')](function(_0x2eab40){if(!_0x2eab40){throw new Error(util[_0x44c5('0x24')](_0x44c5('0x25'),_0x185ada['params']['id']));}_0x20e9f6=_0x2eab40;return db[_0x44c5('0x26')]['update']({'paused':0x1},{'where':{'UserId':_0x20e9f6['id']},'individualHooks':!![]});})[_0x44c5('0x16')](function(){return db[_0x44c5('0x27')]['findAll']({'where':{'membername':_0x20e9f6[_0x44c5('0x20')],'type':_0x44c5('0x28'),'exitAt':null}});})[_0x44c5('0x16')](function(_0x21edb6){if(_0x21edb6&&_0x21edb6['length']){var _0x477f29=moment()[_0x44c5('0x24')](_0x44c5('0x29'));for(var _0x8a33a3=0x0,_0x1037b0=_0x21edb6[_0x44c5('0x2a')];_0x8a33a3<_0x1037b0;_0x8a33a3++){_0x21edb6[_0x8a33a3][_0x44c5('0x2b')]({'exitAt':_0x477f29});}}})['then'](function(){var _0x3eaec8=[];var _0x1fe149=utils[_0x44c5('0x2c')]();_0x1fe149['forEach'](function(_0x580242){_0x3eaec8[_0x44c5('0x2d')]({'channel':_0x580242,'membername':_0x20e9f6[_0x44c5('0x20')],'interface':_[_0x44c5('0x2e')](_0x20e9f6[_0x44c5('0x23')])?util[_0x44c5('0x24')]('SIP/%s',_0x20e9f6['name']):_0x20e9f6['interface'],'type':_0x44c5('0x28'),'enterAt':moment()['format'](_0x44c5('0x29')),'data1':_0x185ada['body'][_0x44c5('0x2f')]||'DEFAULT\x20PAUSE','role':_0x20e9f6['role'],'internal':_0x20e9f6[_0x44c5('0x22')],'uniqueid':_0x185ada[_0x44c5('0x30')][_0x44c5('0x31')]||null});});return db[_0x44c5('0x27')][_0x44c5('0x32')](_0x3eaec8,{'individualHooks':!![]});})[_0x44c5('0x16')](function(){return _0x20e9f6[_0x44c5('0x33')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x185ada['body'][_0x44c5('0x2f')]||_0x44c5('0x34'),'lastPauseAt':moment()[_0x44c5('0x24')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x44c5('0x1e')](function(_0x2e4616){throw _0x2e4616;});};exports['UnpauseUser']=function(_0xbfc288){return Promise[_0x44c5('0x35')]()[_0x44c5('0x16')](function(){if(_0xbfc288['body'][_0x44c5('0x36')]&&!utils[_0x44c5('0x37')](_0xbfc288[_0x44c5('0x30')]['channel'])){throw new Error(util[_0x44c5('0x24')](_0x44c5('0x38'),_0xbfc288[_0x44c5('0x30')]['channel']));}return db['User']['findOne']({'where':_0xbfc288['options']['where']||{},'attributes':['id',_0x44c5('0x20'),_0x44c5('0x21'),_0x44c5('0x22'),_0x44c5('0x23'),_0x44c5('0x39'),_0x44c5('0x3a'),_0x44c5('0x3b'),'chatPause',_0x44c5('0x3c'),_0x44c5('0x3d'),_0x44c5('0x3e'),_0x44c5('0x3f'),_0x44c5('0x40'),'lastPauseAt']});})[_0x44c5('0x16')](function(_0x3cf915){if(!_0x3cf915){throw new Error(util['format'](_0x44c5('0x25'),_0xbfc288[_0x44c5('0x41')]['id']));}return _0x3cf915[_0x44c5('0x42')](_0xbfc288[_0x44c5('0x30')]['channel'],'system');})[_0x44c5('0x1e')](function(_0x4be382){throw _0x4be382;});};exports[_0x44c5('0x43')]=function(_0x2774eb){var _0x157805=this;return new Promise(function(_0xc4daf6,_0x520865){var _0xb9d6a6;return db[_0x44c5('0xd')]['findOne']({'where':_0x2774eb[_0x44c5('0xe')]['where']||{},'attributes':['id',_0x44c5('0x20')]})[_0x44c5('0x16')](function(_0x51ffc0){if(_0x51ffc0){_0xb9d6a6=_0x51ffc0;return db[_0x44c5('0x26')][_0x44c5('0x44')]({'where':{'membername':_0xb9d6a6[_0x44c5('0x20')]},'individualHooks':!![]});}})[_0x44c5('0x16')](function(){if(_0xb9d6a6){return db[_0x44c5('0x27')]['findAll']({'where':{'membername':_0xb9d6a6['name'],'exitAt':null}});}})['then'](function(_0x538991){if(_0xb9d6a6){if(_0x538991&&_0x538991[_0x44c5('0x2a')]){var _0x151a6b=[];_0x538991[_0x44c5('0x45')](function(_0x22aeda){_0x151a6b[_0x44c5('0x2d')](_0x22aeda['update']({'exitAt':moment()[_0x44c5('0x24')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x44c5('0x46')](_0x151a6b);}}})[_0x44c5('0x16')](function(){if(_0xb9d6a6){return _0xb9d6a6[_0x44c5('0x33')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x44c5('0x16')](function(_0x351c99){_0xc4daf6(_0x351c99);})[_0x44c5('0x1e')](function(_0x1bf09f){_0x520865(_0x157805[_0x44c5('0x1a')](0x1f4,_0x1bf09f['message']));});});};exports['LoginUser']=function(_0x111a0f){var _0xed73a0=this;return new Promise(function(_0x4cbb8a,_0x5ea150){var _0x21b1be;var _0x262754;var _0x10960e;var _0x58cc65;return db[_0x44c5('0xd')][_0x44c5('0x47')]({'where':_0x111a0f['options'][_0x44c5('0x10')]||{},'attributes':['id',_0x44c5('0x20'),'role',_0x44c5('0x48'),_0x44c5('0x49'),'internal',_0x44c5('0x4a'),_0x44c5('0x23')]})['then'](function(_0x7c8961){if(_0x7c8961){_0x21b1be=_0x7c8961;_0x58cc65=_0x111a0f['body'][_0x44c5('0x23')]?_0x111a0f[_0x44c5('0x30')]['interface']:util['format'](_0x44c5('0x4b'),_0x21b1be[_0x44c5('0x20')]);return db['User']['count']({'where':{'role':_0x44c5('0x4c'),'online':!![],'id':{'$ne':_0x21b1be['id']}}});}})[_0x44c5('0x16')](function(_0x3ee2ff){if(_0x3ee2ff){_0x10960e=_0x3ee2ff;return require(_0x44c5('0x4d'))['getLicense']();}})[_0x44c5('0x16')](function(_0x2b1771){if(_0x2b1771&&_0x2b1771['agents']&&_0x10960e>=_0x2b1771[_0x44c5('0x4e')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x44c5('0x16')](function(){if(_0x21b1be){return db[_0x44c5('0x26')][_0x44c5('0x44')]({'where':{'membername':_0x21b1be['name']},'individualHooks':!![]});}})[_0x44c5('0x16')](function(){if(_0x21b1be){return _0x21b1be[_0x44c5('0x4f')]({'raw':!![]});}})[_0x44c5('0x16')](function(_0x2695cd){if(_0x21b1be){if(_0x2695cd){var _0x3ea16d=[];_0x262754=_0x2695cd;if(_0x262754[_0x44c5('0x2a')]){for(var _0x56496b=0x0;_0x56496b<_0x262754['length'];_0x56496b++){_0x3ea16d['push'](db[_0x44c5('0x26')]['upsert']({'membername':_0x21b1be['name'],'UserId':_0x21b1be['id'],'queue_name':_0x262754[_0x56496b]['name'],'VoiceQueueId':_0x262754[_0x56496b]['id'],'interface':_0x58cc65,'paused':_0x21b1be['loginInPause']||![],'penalty':_0x262754[_0x56496b][_0x44c5('0x50')]||0x0}));}return BPromise[_0x44c5('0x46')](_0x3ea16d);}}}})[_0x44c5('0x16')](function(){if(_0x21b1be){return db[_0x44c5('0x27')][_0x44c5('0x51')]({'where':{'membername':_0x21b1be['name'],'exitAt':null}});}})[_0x44c5('0x16')](function(_0x45b781){if(_0x21b1be){if(_0x45b781&&_0x45b781[_0x44c5('0x2a')]){var _0x4c4471=[];_0x45b781[_0x44c5('0x45')](function(_0x9821d9){_0x4c4471['push'](_0x9821d9[_0x44c5('0x33')]({'exitAt':moment()[_0x44c5('0x24')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x4c4471);}}})[_0x44c5('0x16')](function(){if(_0x21b1be){var _0x5db9b6=[];var _0xd48f56=[];var _0x1764e9=utils['getChannels']();var _0x2fd8b2={'membername':_0x21b1be[_0x44c5('0x20')],'interface':_0x58cc65,'enterAt':moment()[_0x44c5('0x24')](_0x44c5('0x29')),'role':_0x21b1be[_0x44c5('0x21')],'internal':_0x21b1be[_0x44c5('0x22')]};_0x1764e9['forEach'](function(_0x3fcd46){_0x5db9b6[_0x44c5('0x2d')](_[_0x44c5('0x52')]({'channel':_0x3fcd46,'type':'LOGIN','data1':_0x44c5('0x53'),'data2':_0x58cc65},_0x2fd8b2));if(_0x21b1be[_0x44c5('0x4a')]){_0xd48f56['push'](_['merge']({'channel':_0x3fcd46,'type':'PAUSE','data1':_0x44c5('0x54')},_0x2fd8b2));}});return db[_0x44c5('0x27')][_0x44c5('0x32')](_0x5db9b6[_0x44c5('0x55')](_0xd48f56),{'individualHooks':!![]});}})[_0x44c5('0x16')](function(){if(_0x21b1be){return _0x21b1be[_0x44c5('0x33')]({'online':!![],'lastLoginAt':moment()[_0x44c5('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x21b1be[_0x44c5('0x4a')]||![],'mailPause':_0x21b1be[_0x44c5('0x4a')]||![],'chatPause':_0x21b1be[_0x44c5('0x4a')]||![],'faxPause':_0x21b1be[_0x44c5('0x4a')]||![],'smsPause':_0x21b1be[_0x44c5('0x4a')]||![],'openchannelPause':_0x21b1be[_0x44c5('0x4a')]||![],'pauseType':_0x21b1be[_0x44c5('0x4a')]?_0x44c5('0x54'):null,'lastPauseAt':moment()[_0x44c5('0x24')](_0x44c5('0x29')),'interface':_0x58cc65});}})[_0x44c5('0x16')](function(_0x3532b2){_0x4cbb8a(_0x3532b2);})[_0x44c5('0x1e')](function(_0x3916ee){_0x5ea150(_0xed73a0[_0x44c5('0x1a')](0x1f4,_0x3916ee[_0x44c5('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 52be61d..1b6bfa5 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 _0x37da=['save','remove','emit','removeListener','register','user:'];(function(_0x312ffc,_0x46faf9){var _0x4a65ba=function(_0x4d1fee){while(--_0x4d1fee){_0x312ffc['push'](_0x312ffc['shift']());}};_0x4a65ba(++_0x46faf9);}(_0x37da,0x84));var _0xa37d=function(_0x512062,_0xf6f822){_0x512062=_0x512062-0x0;var _0x2a43ca=_0x37da[_0x512062];return _0x2a43ca;};'use strict';var UserEvents=require('./user.events');var events=[_0xa37d('0x0'),_0xa37d('0x1'),'update'];function createListener(_0x561ea6,_0x2c8e28){return function(_0x59a476){_0x2c8e28[_0xa37d('0x2')](_0x561ea6,_0x59a476);};}function removeListener(_0x50bb0b,_0x5de6f1){return function(){UserEvents[_0xa37d('0x3')](_0x50bb0b,_0x5de6f1);};}exports[_0xa37d('0x4')]=function(_0x26d5f4){for(var _0xee0061=0x0,_0x24a473=events['length'];_0xee0061<_0x24a473;_0xee0061++){var _0x13b183=events[_0xee0061];var _0x4d71f9=createListener(_0xa37d('0x5')+_0x13b183,_0x26d5f4);UserEvents['on'](_0x13b183,_0x4d71f9);}}; \ No newline at end of file +var _0x1fd7=['emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x3cd9d4,_0x45f7b9){var _0x3b515a=function(_0x2d70c8){while(--_0x2d70c8){_0x3cd9d4['push'](_0x3cd9d4['shift']());}};_0x3b515a(++_0x45f7b9);}(_0x1fd7,0xfd));var _0x71fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fd7[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require(_0x71fd('0x0'));var events=[_0x71fd('0x1'),_0x71fd('0x2'),'update'];function createListener(_0x1f2c3a,_0x1e0210){return function(_0x144755){_0x1e0210[_0x71fd('0x3')](_0x1f2c3a,_0x144755);};}function removeListener(_0x3b5ccb,_0x4ac480){return function(){UserEvents[_0x71fd('0x4')](_0x3b5ccb,_0x4ac480);};}exports[_0x71fd('0x5')]=function(_0x5a7491){for(var _0x4436d5=0x0,_0xc1c72d=events[_0x71fd('0x6')];_0x4436d5<_0xc1c72d;_0x4436d5++){var _0x3a72c2=events[_0x4436d5];var _0x28eb41=createListener(_0x71fd('0x7')+_0x3a72c2,_0x5a7491);UserEvents['on'](_0x3a72c2,_0x28eb41);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 0380cb2..b206713 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xa8c8eb,_0x32d9d4){var _0x258214=function(_0x389c9e){while(--_0x389c9e){_0xa8c8eb['push'](_0xa8c8eb['shift']());}};_0x258214(++_0x32d9d4);}(_0xe706,0xa3));var _0x6e70=function(_0x549ffa,_0x4011d9){_0x549ffa=_0x549ffa-0x0;var _0x378324=_0xe706[_0x549ffa];return _0x378324;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1884b2,_0x3a2ace){var _0x34ddb7=function(_0x3160cf){while(--_0x3160cf){_0x1884b2['push'](_0x1884b2['shift']());}};_0x34ddb7(++_0x3a2ace);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 7976f5f..bf43e53 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 _0xbc82=['sequelize'];(function(_0x2527cb,_0x9b8826){var _0x2cc454=function(_0x4ed195){while(--_0x4ed195){_0x2527cb['push'](_0x2527cb['shift']());}};_0x2cc454(++_0x9b8826);}(_0xbc82,0x13e));var _0x2bc8=function(_0x4f153b,_0x39818f){_0x4f153b=_0x4f153b-0x0;var _0x4e0cf8=_0xbc82[_0x4f153b];return _0x4e0cf8;};'use strict';var Sequelize=require(_0x2bc8('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x676a=['INTEGER','exports'];(function(_0x2a381f,_0x5ac78b){var _0xbb80ac=function(_0x5aa22f){while(--_0x5aa22f){_0x2a381f['push'](_0x2a381f['shift']());}};_0xbb80ac(++_0x5ac78b);}(_0x676a,0x14f));var _0xa676=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0x676a[_0x57b236];return _0x4feb29;};'use strict';var Sequelize=require('sequelize');module[_0xa676('0x0')]={'penalty':{'type':Sequelize[_0xa676('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index f0e1fc4..865674b 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 _0x69c8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0x238c67,_0x4c409e){var _0x51d179=function(_0x24ab46){while(--_0x24ab46){_0x238c67['push'](_0x238c67['shift']());}};_0x51d179(++_0x4c409e);}(_0x69c8,0x7a));var _0x869c=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0x69c8[_0x2e41e2];return _0x2844d6;};'use strict';var _=require(_0x869c('0x0'));var util=require(_0x869c('0x1'));var logger=require(_0x869c('0x2'))(_0x869c('0x3'));var moment=require(_0x869c('0x4'));var BPromise=require(_0x869c('0x5'));var rp=require(_0x869c('0x6'));var fs=require('fs');var path=require(_0x869c('0x7'));var rimraf=require(_0x869c('0x8'));var config=require(_0x869c('0x9'));var attributes=require('./userChatQueue.attributes');module[_0x869c('0xa')]=function(_0x49d17e,_0x36e1ce){return _0x49d17e[_0x869c('0xb')](_0x869c('0xc'),attributes,{'tableName':_0x869c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb394=['UserChatQueue','user_has_chat_queues','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define'];(function(_0x3782f6,_0x5eded2){var _0xf58702=function(_0x3c0d22){while(--_0x3c0d22){_0x3782f6['push'](_0x3782f6['shift']());}};_0xf58702(++_0x5eded2);}(_0xb394,0x1a6));var _0x4b39=function(_0x15d6b6,_0x141d63){_0x15d6b6=_0x15d6b6-0x0;var _0xf3c727=_0xb394[_0x15d6b6];return _0xf3c727;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b39('0x0'))(_0x4b39('0x1'));var moment=require(_0x4b39('0x2'));var BPromise=require('bluebird');var rp=require(_0x4b39('0x3'));var fs=require('fs');var path=require(_0x4b39('0x4'));var rimraf=require(_0x4b39('0x5'));var config=require(_0x4b39('0x6'));var attributes=require(_0x4b39('0x7'));module[_0x4b39('0x8')]=function(_0x393e15,_0x56dbdf){return _0x393e15[_0x4b39('0x9')](_0x4b39('0xa'),attributes,{'tableName':_0x4b39('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index bb9924d..dde20f7 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 _0x7b0d=['rpc','../../config/environment','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1e7ead,_0x7f6227){var _0x3912b2=function(_0x1eeb03){while(--_0x1eeb03){_0x1e7ead['push'](_0x1e7ead['shift']());}};_0x3912b2(++_0x7f6227);}(_0x7b0d,0x1c8));var _0xd7b0=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7b0d[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require(_0xd7b0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd7b0('0x1'));var fs=require('fs');var Redis=require(_0xd7b0('0x2'));var db=require(_0xd7b0('0x3'))['db'];var utils=require(_0xd7b0('0x4'));var logger=require(_0xd7b0('0x5'))(_0xd7b0('0x6'));var config=require(_0xd7b0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd7b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe9cdea,_0x240c83,_0x53fdb0){return new BPromise(function(_0x48e7e0,_0x1fc9a7){return client[_0xd7b0('0x9')](_0xe9cdea,_0x53fdb0)[_0xd7b0('0xa')](function(_0x46bde8){logger[_0xd7b0('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x240c83,_0xd7b0('0xc'));logger[_0xd7b0('0xd')](_0xd7b0('0xe'),_0x240c83,_0xd7b0('0xc'),JSON[_0xd7b0('0xf')](_0x46bde8));if(_0x46bde8[_0xd7b0('0x10')]){if(_0x46bde8[_0xd7b0('0x10')][_0xd7b0('0x11')]===0x1f4){logger[_0xd7b0('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x240c83,_0x46bde8[_0xd7b0('0x10')][_0xd7b0('0x12')]);return _0x1fc9a7(_0x46bde8[_0xd7b0('0x10')]['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x240c83,_0x46bde8['error']['message']);return _0x48e7e0(_0x46bde8[_0xd7b0('0x10')][_0xd7b0('0x12')]);}else{logger[_0xd7b0('0xb')](_0xd7b0('0x13'),_0x240c83,_0xd7b0('0xc'));_0x48e7e0(_0x46bde8['result']['message']);}})[_0xd7b0('0x14')](function(_0xcf9050){logger['error'](_0xd7b0('0x13'),_0x240c83,_0xcf9050);_0x1fc9a7(_0xcf9050);});});} \ No newline at end of file +var _0x4d22=['../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x12cac1,_0x3b514c){var _0xa55f9f=function(_0x5b3abb){while(--_0x5b3abb){_0x12cac1['push'](_0x12cac1['shift']());}};_0xa55f9f(++_0x3b514c);}(_0x4d22,0xa1));var _0x24d2=function(_0x4157b9,_0x147461){_0x4157b9=_0x4157b9-0x0;var _0x457d88=_0x4d22[_0x4157b9];return _0x457d88;};'use strict';var _=require('lodash');var util=require(_0x24d2('0x0'));var moment=require(_0x24d2('0x1'));var BPromise=require(_0x24d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24d2('0x3'));var db=require(_0x24d2('0x4'))['db'];var utils=require(_0x24d2('0x5'));var logger=require('../../config/logger')(_0x24d2('0x6'));var config=require(_0x24d2('0x7'));var jayson=require(_0x24d2('0x8'));var client=jayson[_0x24d2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17889f,_0x3565cc,_0x43b53a){return new BPromise(function(_0x9a75a8,_0x26ff09){return client[_0x24d2('0xa')](_0x17889f,_0x43b53a)[_0x24d2('0xb')](function(_0x4efc8f){logger['info'](_0x24d2('0xc'),_0x3565cc,_0x24d2('0xd'));logger[_0x24d2('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3565cc,_0x24d2('0xd'),JSON[_0x24d2('0xf')](_0x4efc8f));if(_0x4efc8f[_0x24d2('0x10')]){if(_0x4efc8f[_0x24d2('0x10')]['code']===0x1f4){logger[_0x24d2('0x10')](_0x24d2('0xc'),_0x3565cc,_0x4efc8f[_0x24d2('0x10')][_0x24d2('0x11')]);return _0x26ff09(_0x4efc8f[_0x24d2('0x10')]['message']);}logger[_0x24d2('0x10')](_0x24d2('0xc'),_0x3565cc,_0x4efc8f['error'][_0x24d2('0x11')]);return _0x9a75a8(_0x4efc8f[_0x24d2('0x10')][_0x24d2('0x11')]);}else{logger[_0x24d2('0x12')](_0x24d2('0xc'),_0x3565cc,_0x24d2('0xd'));_0x9a75a8(_0x4efc8f[_0x24d2('0x13')]['message']);}})[_0x24d2('0x14')](function(_0xe844b6){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x3565cc,_0xe844b6);_0x26ff09(_0xe844b6);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index fc9f0ab..68f3126 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2629a2,_0xc206c9){var _0x199803=function(_0x248e5e){while(--_0x248e5e){_0x2629a2['push'](_0x2629a2['shift']());}};_0x199803(++_0xc206c9);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x487dfd,_0x448170){var _0x17723c=function(_0xa8b613){while(--_0xa8b613){_0x487dfd['push'](_0x487dfd['shift']());}};_0x17723c(++_0x448170);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 706b73a..c4b8c57 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 _0x6ee8=['STRING','sequelize','exports','INTEGER'];(function(_0x5bc2b2,_0x1687cc){var _0x1e8a2d=function(_0x597806){while(--_0x597806){_0x5bc2b2['push'](_0x5bc2b2['shift']());}};_0x1e8a2d(++_0x1687cc);}(_0x6ee8,0x185));var _0x86ee=function(_0x2212d5,_0x375e95){_0x2212d5=_0x2212d5-0x0;var _0x407ca9=_0x6ee8[_0x2212d5];return _0x407ca9;};'use strict';var Sequelize=require(_0x86ee('0x0'));module[_0x86ee('0x1')]={'penalty':{'type':Sequelize[_0x86ee('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x86ee('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x86ee('0x3')]}}; \ No newline at end of file +var _0xa6a4=['exports','INTEGER','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa6a4,0x6e));var _0x4a6a=function(_0x41c3b7,_0x1b21ff){_0x41c3b7=_0x41c3b7-0x0;var _0x1d4414=_0xa6a4[_0x41c3b7];return _0x1d4414;};'use strict';var Sequelize=require(_0x4a6a('0x0'));module[_0x4a6a('0x1')]={'penalty':{'type':Sequelize[_0x4a6a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 1aca247..d346a86 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 _0x9de5=['user_has_fax_queues','api','moment','bluebird','rimraf','../../config/environment','define','UserFaxQueue'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x9de5,0x131));var _0x59de=function(_0x1824b7,_0x2346e3){_0x1824b7=_0x1824b7-0x0;var _0x574ace=_0x9de5[_0x1824b7];return _0x574ace;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x59de('0x0'));var moment=require(_0x59de('0x1'));var BPromise=require(_0x59de('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x59de('0x3'));var config=require(_0x59de('0x4'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x396370,_0x14592d){return _0x396370[_0x59de('0x5')](_0x59de('0x6'),attributes,{'tableName':_0x59de('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a0c=['user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x316670,_0x56566d){var _0x206584=function(_0x1e9e70){while(--_0x1e9e70){_0x316670['push'](_0x316670['shift']());}};_0x206584(++_0x56566d);}(_0x4a0c,0x137));var _0xc4a0=function(_0x56ae0d,_0x316d24){_0x56ae0d=_0x56ae0d-0x0;var _0x17824f=_0x4a0c[_0x56ae0d];return _0x17824f;};'use strict';var _=require(_0xc4a0('0x0'));var util=require('util');var logger=require(_0xc4a0('0x1'))(_0xc4a0('0x2'));var moment=require(_0xc4a0('0x3'));var BPromise=require(_0xc4a0('0x4'));var rp=require(_0xc4a0('0x5'));var fs=require('fs');var path=require(_0xc4a0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xc4a0('0x7')]=function(_0x597e66,_0x5de17d){return _0x597e66[_0xc4a0('0x8')]('UserFaxQueue',attributes,{'tableName':_0xc4a0('0x9'),'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 d2f9552..7a4a165 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 _0xe845=['code','message','UserFaxQueue,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe845,0x12a));var _0x5e84=function(_0x1ac60f,_0x54ef30){_0x1ac60f=_0x1ac60f-0x0;var _0x449b2e=_0xe845[_0x1ac60f];return _0x449b2e;};'use strict';var _=require(_0x5e84('0x0'));var util=require(_0x5e84('0x1'));var moment=require(_0x5e84('0x2'));var BPromise=require(_0x5e84('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e84('0x4'));var db=require(_0x5e84('0x5'))['db'];var utils=require(_0x5e84('0x6'));var logger=require(_0x5e84('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5e84('0x8')][_0x5e84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x380b1a,_0xef117d,_0x6f52eb){return new BPromise(function(_0x5b953e,_0x45ba2b){return client['request'](_0x380b1a,_0x6f52eb)[_0x5e84('0xa')](function(_0x592261){logger[_0x5e84('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0xef117d,'request\x20sent');logger[_0x5e84('0xc')](_0x5e84('0xd'),_0xef117d,_0x5e84('0xe'),JSON[_0x5e84('0xf')](_0x592261));if(_0x592261[_0x5e84('0x10')]){if(_0x592261['error'][_0x5e84('0x11')]===0x1f4){logger[_0x5e84('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0xef117d,_0x592261[_0x5e84('0x10')][_0x5e84('0x12')]);return _0x45ba2b(_0x592261[_0x5e84('0x10')][_0x5e84('0x12')]);}logger['error'](_0x5e84('0x13'),_0xef117d,_0x592261[_0x5e84('0x10')][_0x5e84('0x12')]);return _0x5b953e(_0x592261[_0x5e84('0x10')][_0x5e84('0x12')]);}else{logger[_0x5e84('0xb')](_0x5e84('0x13'),_0xef117d,_0x5e84('0xe'));_0x5b953e(_0x592261[_0x5e84('0x14')]['message']);}})['catch'](function(_0x104020){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0xef117d,_0x104020);_0x45ba2b(_0x104020);});});} \ No newline at end of file +var _0xd02e=['UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x168563,_0x280a82){var _0x2f8614=function(_0x5af816){while(--_0x5af816){_0x168563['push'](_0x168563['shift']());}};_0x2f8614(++_0x280a82);}(_0xd02e,0x125));var _0xed02=function(_0x28b8e9,_0x5e8608){_0x28b8e9=_0x28b8e9-0x0;var _0x41daec=_0xd02e[_0x28b8e9];return _0x41daec;};'use strict';var _=require(_0xed02('0x0'));var util=require(_0xed02('0x1'));var moment=require('moment');var BPromise=require(_0xed02('0x2'));var rs=require(_0xed02('0x3'));var fs=require('fs');var Redis=require(_0xed02('0x4'));var db=require(_0xed02('0x5'))['db'];var utils=require(_0xed02('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed02('0x7')][_0xed02('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc917ed,_0x433edf,_0x118939){return new BPromise(function(_0x4dd389,_0x368684){return client[_0xed02('0x9')](_0xc917ed,_0x118939)[_0xed02('0xa')](function(_0x4af399){logger[_0xed02('0xb')](_0xed02('0xc'),_0x433edf,_0xed02('0xd'));logger[_0xed02('0xe')](_0xed02('0xf'),_0x433edf,'request\x20sent',JSON[_0xed02('0x10')](_0x4af399));if(_0x4af399[_0xed02('0x11')]){if(_0x4af399[_0xed02('0x11')][_0xed02('0x12')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x433edf,_0x4af399[_0xed02('0x11')][_0xed02('0x13')]);return _0x368684(_0x4af399['error'][_0xed02('0x13')]);}logger[_0xed02('0x11')](_0xed02('0xc'),_0x433edf,_0x4af399[_0xed02('0x11')][_0xed02('0x13')]);return _0x4dd389(_0x4af399[_0xed02('0x11')][_0xed02('0x13')]);}else{logger[_0xed02('0xb')](_0xed02('0xc'),_0x433edf,_0xed02('0xd'));_0x4dd389(_0x4af399[_0xed02('0x14')]['message']);}})[_0xed02('0x15')](function(_0x4bea06){logger[_0xed02('0x11')](_0xed02('0xc'),_0x433edf,_0x4bea06);_0x368684(_0x4bea06);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index c9b15be..54dd00e 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1ea5e2,_0x382cec){var _0x39380c=function(_0x27893b){while(--_0x27893b){_0x1ea5e2['push'](_0x1ea5e2['shift']());}};_0x39380c(++_0x382cec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4217f6,_0x8a27e5){var _0x29053f=function(_0x28d022){while(--_0x28d022){_0x4217f6['push'](_0x4217f6['shift']());}};_0x29053f(++_0x8a27e5);}(_0xedd9,0xfc));var _0x9edd=function(_0x39418d,_0x27ee49){_0x39418d=_0x39418d-0x0;var _0x221357=_0xedd9[_0x39418d];return _0x221357;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index e330e41..ddcf8fc 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 _0x5a44=['exports'];(function(_0x214b8a,_0x4684e2){var _0x29729c=function(_0x21b69c){while(--_0x21b69c){_0x214b8a['push'](_0x214b8a['shift']());}};_0x29729c(++_0x4684e2);}(_0x5a44,0xdd));var _0x45a4=function(_0x4a5261,_0xd5582f){_0x4a5261=_0x4a5261-0x0;var _0x191590=_0x5a44[_0x4a5261];return _0x191590;};'use strict';var Sequelize=require('sequelize');module[_0x45a4('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8970=['sequelize','exports','INTEGER'];(function(_0x51da74,_0xed04){var _0x58cbd7=function(_0x3de772){while(--_0x3de772){_0x51da74['push'](_0x51da74['shift']());}};_0x58cbd7(++_0xed04);}(_0x8970,0x12f));var _0x0897=function(_0x375ffd,_0x216e84){_0x375ffd=_0x375ffd-0x0;var _0x265c11=_0x8970[_0x375ffd];return _0x265c11;};'use strict';var Sequelize=require(_0x0897('0x0'));module[_0x0897('0x1')]={'penalty':{'type':Sequelize[_0x0897('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 faad0a8..d065f89 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 _0x5323=['bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','lodash','util','../../config/logger','moment'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x5323,0xf8));var _0x3532=function(_0x578957,_0x3045f9){_0x578957=_0x578957-0x0;var _0x246d93=_0x5323[_0x578957];return _0x246d93;};'use strict';var _=require(_0x3532('0x0'));var util=require(_0x3532('0x1'));var logger=require(_0x3532('0x2'))('api');var moment=require(_0x3532('0x3'));var BPromise=require(_0x3532('0x4'));var rp=require(_0x3532('0x5'));var fs=require('fs');var path=require(_0x3532('0x6'));var rimraf=require(_0x3532('0x7'));var config=require(_0x3532('0x8'));var attributes=require(_0x3532('0x9'));module[_0x3532('0xa')]=function(_0x469630,_0x1dcf5d){return _0x469630['define'](_0x3532('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30e9=['rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','lodash','util','moment','request-promise'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x30e9,0x15b));var _0x930e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x30e9[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x930e('0x0'));var util=require(_0x930e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x930e('0x2'));var BPromise=require('bluebird');var rp=require(_0x930e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x930e('0x4'));var config=require(_0x930e('0x5'));var attributes=require(_0x930e('0x6'));module[_0x930e('0x7')]=function(_0xe627de,_0x55d68f){return _0xe627de['define'](_0x930e('0x8'),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 669f3dd..3827b47 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 _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\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(_0x4c8ad1,_0x1b3e74){var _0x162fad=function(_0x153bc0){while(--_0x153bc0){_0x4c8ad1['push'](_0x4c8ad1['shift']());}};_0x162fad(++_0x1b3e74);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x59dc02,_0x120477){_0x59dc02=_0x59dc02-0x0;var _0x556178=_0x7fbe[_0x59dc02];return _0x556178;};'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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x373dce,_0x4e3b8c){var _0x1cc73f=function(_0xb1672c){while(--_0xb1672c){_0x373dce['push'](_0x373dce['shift']());}};_0x1cc73f(++_0x4e3b8c);}(_0x34e8,0x12c));var _0x834e=function(_0x46dfcd,_0x2172b6){_0x46dfcd=_0x46dfcd-0x0;var _0x2e7114=_0x34e8[_0x46dfcd];return _0x2e7114;};'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')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 89387d7..6f13705 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 _0xad70=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports'];(function(_0xae29a9,_0x35230d){var _0x2edab8=function(_0x3a213e){while(--_0x3a213e){_0xae29a9['push'](_0xae29a9['shift']());}};_0x2edab8(++_0x35230d);}(_0xad70,0xfd));var _0x0ad7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad70[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0ad7('0x0'));var util=require(_0x0ad7('0x1'));var path=require(_0x0ad7('0x2'));var timeout=require(_0x0ad7('0x3'));var express=require(_0x0ad7('0x4'));var router=express[_0x0ad7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0ad7('0x6'));var config=require('../../config/environment');var controller=require(_0x0ad7('0x7'));router['post']('/',auth[_0x0ad7('0x8')](),controller[_0x0ad7('0x9')]);module[_0x0ad7('0xa')]=router; \ No newline at end of file +var _0x51f6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express'];(function(_0x5dbe03,_0x2941ff){var _0x8f51a9=function(_0x9fc00e){while(--_0x9fc00e){_0x5dbe03['push'](_0x5dbe03['shift']());}};_0x8f51a9(++_0x2941ff);}(_0x51f6,0x7d));var _0x651f=function(_0x55d7ce,_0x282867){_0x55d7ce=_0x55d7ce-0x0;var _0x3e050c=_0x51f6[_0x55d7ce];return _0x3e050c;};'use strict';var multer=require(_0x651f('0x0'));var util=require(_0x651f('0x1'));var path=require(_0x651f('0x2'));var timeout=require(_0x651f('0x3'));var express=require(_0x651f('0x4'));var router=express[_0x651f('0x5')]();var fs_extra=require(_0x651f('0x6'));var auth=require(_0x651f('0x7'));var interaction=require(_0x651f('0x8'));var config=require('../../config/environment');var controller=require(_0x651f('0x9'));router['post']('/',auth[_0x651f('0xa')](),controller[_0x651f('0xb')]);module[_0x651f('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 7c0d2d8..2ff2a27 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 _0x5cc5=['TEXT','STRING','sequelize','exports'];(function(_0x2127b9,_0x107f97){var _0x442e68=function(_0x909361){while(--_0x909361){_0x2127b9['push'](_0x2127b9['shift']());}};_0x442e68(++_0x107f97);}(_0x5cc5,0x186));var _0x55cc=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x5cc5[_0x725b8e];return _0x43ac45;};'use strict';var Sequelize=require(_0x55cc('0x0'));module[_0x55cc('0x1')]={'body':{'type':Sequelize[_0x55cc('0x2')]},'senderName':{'type':Sequelize[_0x55cc('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x55cc('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xf33b=['TEXT','BOOLEAN','sequelize'];(function(_0x578b2e,_0x148b70){var _0xac2b58=function(_0x5362af){while(--_0x5362af){_0x578b2e['push'](_0x578b2e['shift']());}};_0xac2b58(++_0x148b70);}(_0xf33b,0x146));var _0xbf33=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xf33b[_0x31cb5f];return _0x586042;};'use strict';var Sequelize=require(_0xbf33('0x0'));module['exports']={'body':{'type':Sequelize[_0xbf33('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xbf33('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index dcdae5c..fde93d8 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 _0xf8c6=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','then','destroy','error','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','model','User','ids','queue','replace','Queue','push','all','union','flatten','findOne','getAgents','map','eml-format'];(function(_0x171884,_0x6684db){var _0x5d5c1b=function(_0x42dca1){while(--_0x42dca1){_0x171884['push'](_0x171884['shift']());}};_0x5d5c1b(++_0x6684db);}(_0xf8c6,0xcb));var _0x6f8c=function(_0x3c7680,_0x1155b9){_0x3c7680=_0x3c7680-0x0;var _0x4f3f96=_0xf8c6[_0x3c7680];return _0x4f3f96;};'use strict';var emlformat=require(_0x6f8c('0x0'));var rimraf=require(_0x6f8c('0x1'));var zipdir=require(_0x6f8c('0x2'));var jsonpatch=require(_0x6f8c('0x3'));var rp=require(_0x6f8c('0x4'));var moment=require(_0x6f8c('0x5'));var BPromise=require(_0x6f8c('0x6'));var Mustache=require('mustache');var util=require(_0x6f8c('0x7'));var path=require(_0x6f8c('0x8'));var sox=require(_0x6f8c('0x9'));var csv=require(_0x6f8c('0xa'));var ejs=require(_0x6f8c('0xb'));var fs=require('fs');var fs_extra=require(_0x6f8c('0xc'));var _=require('lodash');var squel=require(_0x6f8c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6f8c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f8c('0xf'));var Papa=require('papaparse');var Redis=require(_0x6f8c('0x10'));var authService=require(_0x6f8c('0x11'));var qs=require(_0x6f8c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f8c('0x13'));var logger=require('../../config/logger')(_0x6f8c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6f8c('0x15'));var db=require(_0x6f8c('0x16'))['db'];config[_0x6f8c('0x17')]=_[_0x6f8c('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6f8c('0x19'))(new Redis(config[_0x6f8c('0x17')]));require(_0x6f8c('0x1a'))[_0x6f8c('0x1b')](socket);function respondWithStatusCode(_0x2b83c1,_0x27f86c){_0x27f86c=_0x27f86c||0xcc;return function(_0xfa9b43){if(_0xfa9b43){return _0x2b83c1[_0x6f8c('0x1c')](_0x27f86c);}return _0x2b83c1['status'](_0x27f86c)[_0x6f8c('0x1d')]();};}function respondWithResult(_0x56cdf0,_0x57872e){_0x57872e=_0x57872e||0xc8;return function(_0x1b08d2){if(_0x1b08d2){return _0x56cdf0['status'](_0x57872e)[_0x6f8c('0x1e')](_0x1b08d2);}};}function respondWithFilteredResult(_0x7f9ecc,_0x340685){return function(_0x2c8bc4){if(_0x2c8bc4){var _0x4cb306=typeof _0x340685[_0x6f8c('0x1f')]===_0x6f8c('0x20')&&typeof _0x340685[_0x6f8c('0x21')]==='undefined';var _0xe632aa=_0x2c8bc4[_0x6f8c('0x22')];var _0x2d8ebe=_0x4cb306?0x0:_0x340685[_0x6f8c('0x1f')];var _0x21f2a9=_0x4cb306?_0x2c8bc4[_0x6f8c('0x22')]:_0x340685['offset']+_0x340685['limit'];var _0x11b1fb;if(_0x21f2a9>=_0xe632aa){_0x21f2a9=_0xe632aa;_0x11b1fb=0xc8;}else{_0x11b1fb=0xce;}_0x7f9ecc[_0x6f8c('0x23')](_0x11b1fb);return _0x7f9ecc[_0x6f8c('0x24')](_0x6f8c('0x25'),_0x2d8ebe+'-'+_0x21f2a9+'/'+_0xe632aa)[_0x6f8c('0x1e')](_0x2c8bc4);}return null;};}function patchUpdates(_0x5eca04){return function(_0x87bea4){try{jsonpatch[_0x6f8c('0x26')](_0x87bea4,_0x5eca04,!![]);}catch(_0x7bfc0e){return BPromise['reject'](_0x7bfc0e);}return _0x87bea4[_0x6f8c('0x27')]();};}function saveUpdates(_0x3556c7,_0x56dbe8){return function(_0x2e5647){if(_0x2e5647){return _0x2e5647['update'](_0x3556c7)[_0x6f8c('0x28')](function(_0x4344f0){return _0x4344f0;});}return null;};}function removeEntity(_0x2c585a,_0x18de53){return function(_0xf3f9d9){if(_0xf3f9d9){return _0xf3f9d9[_0x6f8c('0x29')]()['then'](function(){_0x2c585a[_0x6f8c('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cad51,_0x292b10){return function(_0x183b25){if(!_0x183b25){_0x2cad51[_0x6f8c('0x1c')](0x194);}return _0x183b25;};}function handleError(_0x146aff,_0x157630){_0x157630=_0x157630||0x1f4;return function(_0x366195){logger[_0x6f8c('0x2a')](_0x366195['stack']);if(_0x366195[_0x6f8c('0x2b')]){delete _0x366195['name'];}_0x146aff['status'](_0x157630)['send'](_0x366195);};}exports[_0x6f8c('0x2c')]=function(_0x4215fd,_0x300c2b,_0x250bd1){if(!_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x2e')](_0x6f8c('0x2f'))&&!_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x2e')](_0x6f8c('0x30'))){throw new db['Sequelize'][(_0x6f8c('0x31'))](_0x6f8c('0x32'));}else{if(_0x4215fd['body']['hasOwnProperty'](_0x6f8c('0x30'))&&!_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x2e')](_0x6f8c('0x33'))){throw new db[(_0x6f8c('0x34'))][(_0x6f8c('0x31'))](_0x6f8c('0x35'));}if(!_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x2e')](_0x6f8c('0x36'))){throw new db[(_0x6f8c('0x34'))]['ValidationError'](_0x6f8c('0x37'));}else{try{var _0x5105e8=JSON[_0x6f8c('0x38')](_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x36')]);}catch(_0x22c689){logger[_0x6f8c('0x2a')](_0x22c689);throw new db['Sequelize']['ValidationError'](_0x6f8c('0x39'));}var _0x2cf795=[_0x6f8c('0x3a'),'faxqueue',_0x6f8c('0x3b'),_0x6f8c('0x3c'),_0x6f8c('0x3d'),_0x6f8c('0x3e'),'whatsappqueue',_0x6f8c('0x3f'),_0x6f8c('0x40')];if(_['some'](_0x5105e8,function(_0x151707){return!_[_0x6f8c('0x41')](_0x2cf795,_0x151707['model'][_0x6f8c('0x42')]());})){throw new db['Sequelize'][(_0x6f8c('0x31'))](_0x6f8c('0x43'));}}}var _0x1ac3df={};_0x1ac3df[_0x6f8c('0x44')]=_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x2e')]('senderName')?_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x44')]:_0x4215fd[_0x6f8c('0x40')]['fullname'];_0x1ac3df[_0x6f8c('0x45')]=_[_0x6f8c('0x46')](_0x4215fd[_0x6f8c('0x2d')]['recipientsDescription'])?null:_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x45')];_0x1ac3df[_0x6f8c('0x47')]=_0x4215fd[_0x6f8c('0x2d')]['beep']||![];_0x1ac3df[_0x6f8c('0x48')]=_0x4215fd[_0x6f8c('0x40')]['id'];return getContent(_0x4215fd['body'])[_0x6f8c('0x28')](function(_0xe06fc1){_0x1ac3df[_0x6f8c('0x2d')]=_0xe06fc1;return getRecipients(_0x5105e8);})['then'](function(_0x546de8){_0x1ac3df[_0x6f8c('0x49')]=_[_0x6f8c('0x4a')](_0x546de8)[_0x6f8c('0x4b')](',');return db[_0x6f8c('0x4c')][_0x6f8c('0x4d')](function(_0x9fdf3){return db['UserNotification'][_0x6f8c('0x4e')](_0x1ac3df,{'raw':!![],'transaction':_0x9fdf3})[_0x6f8c('0x28')](function(_0x9846fb){var _0x5963b7={'sender':_0x1ac3df['senderName'],'description':_0x1ac3df[_0x6f8c('0x45')],'content':_0x1ac3df[_0x6f8c('0x2d')],'beep':_0x1ac3df[_0x6f8c('0x47')]};_0x546de8[_0x6f8c('0x4f')](function(_0x35e4b5){_0x5963b7[_0x6f8c('0x50')]=_0x35e4b5;socket[_0x6f8c('0x51')](_0x6f8c('0x52'),_0x5963b7);});return _0x9846fb;});});})[_0x6f8c('0x28')](respondWithResult(_0x300c2b,0xc9))[_0x6f8c('0x53')](handleError(_0x300c2b,null));};function getContent(_0x224f34){return new BPromise(function(_0x3e13e8,_0x521cbd){if(_0x224f34[_0x6f8c('0x2f')]){_0x3e13e8(_0x224f34[_0x6f8c('0x2f')]);return;}return db[_0x6f8c('0x54')]['findOne']({'attributes':['html'],'where':{'id':_0x224f34[_0x6f8c('0x30')]},'raw':!![]})[_0x6f8c('0x28')](function(_0x25bb7d){if(!_0x25bb7d)throw new db[(_0x6f8c('0x34'))][(_0x6f8c('0x31'))](_0x6f8c('0x55'));var _0x5e4559=Mustache[_0x6f8c('0x56')](_0x25bb7d[_0x6f8c('0x57')],_0x224f34[_0x6f8c('0x33')]);_0x3e13e8(_0x5e4559);})[_0x6f8c('0x53')](function(_0x4844a3){_0x521cbd(_0x4844a3);});});}function getRecipients(_0x3ae68f){return new BPromise(function(_0x5ca169,_0x4d57b4){var _0x304401=[];var _0x228888=[];_0x3ae68f[_0x6f8c('0x4f')](function(_0x1e7488){var _0x5a5dfb=_[_0x6f8c('0x58')](_0x1e7488[_0x6f8c('0x59')][_0x6f8c('0x42')]());if(_0x5a5dfb===_0x6f8c('0x5a')){_0x304401=_['union'](_0x304401,_0x1e7488[_0x6f8c('0x5b')]);}else{if(_[_0x6f8c('0x41')](_0x5a5dfb,_0x6f8c('0x5c')))_0x5a5dfb=_0x5a5dfb[_0x6f8c('0x5d')]('queue',_0x6f8c('0x5e'));_0x1e7488[_0x6f8c('0x5b')][_0x6f8c('0x4f')](function(_0x378884){_0x228888[_0x6f8c('0x5f')](getAgents(_0x5a5dfb,_0x378884));});}});return BPromise[_0x6f8c('0x60')](_0x228888)[_0x6f8c('0x28')](function(_0x4d0754){_0x304401=_[_0x6f8c('0x61')](_0x304401,_[_0x6f8c('0x62')](_0x4d0754));_0x5ca169(_0x304401);})['catch'](function(_0x3f0017){_0x4d57b4(_0x3f0017);});});}function getAgents(_0x142ae3,_0x3fba4f){return new BPromise(function(_0x3b97dd,_0x561330){return db[_0x142ae3][_0x6f8c('0x63')]({'where':{'id':_0x3fba4f}})[_0x6f8c('0x28')](function(_0x538be3){return _0x538be3[_0x6f8c('0x64')]({'attributes':['id'],'raw':!![]})[_0x6f8c('0x28')](function(_0x5b3cc5){var _0x552647=_[_0x6f8c('0x65')](_0x5b3cc5,'id');_0x3b97dd(_0x552647);});})[_0x6f8c('0x53')](function(_0x4ba1ea){_0x561330(_0x4ba1ea);});});} \ No newline at end of file +var _0x2519=['destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','smsqueue','voicequeue','whatsappqueue','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','isEmpty','recipientsDescription','beep','recipientsId','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','catch','text','Template','findOne','html','User','union','ids','queue','Queue','push','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','then'];(function(_0x271276,_0x122b24){var _0x5c5ca0=function(_0x2eec27){while(--_0x2eec27){_0x271276['push'](_0x271276['shift']());}};_0x5c5ca0(++_0x122b24);}(_0x2519,0x19f));var _0x9251=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2519[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9251('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9251('0x1'));var jsonpatch=require(_0x9251('0x2'));var rp=require(_0x9251('0x3'));var moment=require(_0x9251('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9251('0x5'));var path=require('path');var sox=require(_0x9251('0x6'));var csv=require('to-csv');var ejs=require(_0x9251('0x7'));var fs=require('fs');var fs_extra=require(_0x9251('0x8'));var _=require(_0x9251('0x9'));var squel=require(_0x9251('0xa'));var crypto=require(_0x9251('0xb'));var jsforce=require(_0x9251('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9251('0xd'));var querystring=require(_0x9251('0xe'));var Papa=require('papaparse');var Redis=require(_0x9251('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9251('0x10'));var as=require(_0x9251('0x11'));var hardwareService=require(_0x9251('0x12'));var logger=require('../../config/logger')(_0x9251('0x13'));var utils=require(_0x9251('0x14'));var config=require(_0x9251('0x15'));var licenseUtil=require(_0x9251('0x16'));var db=require(_0x9251('0x17'))['db'];config['redis']=_[_0x9251('0x18')](config[_0x9251('0x19')],{'host':_0x9251('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9251('0x19')]));require(_0x9251('0x1b'))[_0x9251('0x1c')](socket);function respondWithStatusCode(_0x10e08,_0x4f1c7e){_0x4f1c7e=_0x4f1c7e||0xcc;return function(_0x5c4b9b){if(_0x5c4b9b){return _0x10e08[_0x9251('0x1d')](_0x4f1c7e);}return _0x10e08[_0x9251('0x1e')](_0x4f1c7e)[_0x9251('0x1f')]();};}function respondWithResult(_0x2e8629,_0x48033e){_0x48033e=_0x48033e||0xc8;return function(_0x4089d7){if(_0x4089d7){return _0x2e8629[_0x9251('0x1e')](_0x48033e)['json'](_0x4089d7);}};}function respondWithFilteredResult(_0x1a2b24,_0x2aed71){return function(_0x345b51){if(_0x345b51){var _0x324492=typeof _0x2aed71[_0x9251('0x20')]===_0x9251('0x21')&&typeof _0x2aed71[_0x9251('0x22')]===_0x9251('0x21');var _0x534931=_0x345b51[_0x9251('0x23')];var _0x49193a=_0x324492?0x0:_0x2aed71[_0x9251('0x20')];var _0x12408f=_0x324492?_0x345b51[_0x9251('0x23')]:_0x2aed71[_0x9251('0x20')]+_0x2aed71[_0x9251('0x22')];var _0xfa6148;if(_0x12408f>=_0x534931){_0x12408f=_0x534931;_0xfa6148=0xc8;}else{_0xfa6148=0xce;}_0x1a2b24['status'](_0xfa6148);return _0x1a2b24['set'](_0x9251('0x24'),_0x49193a+'-'+_0x12408f+'/'+_0x534931)['json'](_0x345b51);}return null;};}function patchUpdates(_0x3dedec){return function(_0x2bde77){try{jsonpatch[_0x9251('0x25')](_0x2bde77,_0x3dedec,!![]);}catch(_0x2cdcc4){return BPromise['reject'](_0x2cdcc4);}return _0x2bde77[_0x9251('0x26')]();};}function saveUpdates(_0x41d9bc,_0x2098d1){return function(_0x4dda62){if(_0x4dda62){return _0x4dda62['update'](_0x41d9bc)[_0x9251('0x27')](function(_0x48fc9b){return _0x48fc9b;});}return null;};}function removeEntity(_0x4fed51,_0x433ad7){return function(_0x1a193b){if(_0x1a193b){return _0x1a193b[_0x9251('0x28')]()['then'](function(){_0x4fed51[_0x9251('0x1e')](0xcc)[_0x9251('0x1f')]();});}};}function handleEntityNotFound(_0x18e478,_0x6a82be){return function(_0x1d0b76){if(!_0x1d0b76){_0x18e478[_0x9251('0x1d')](0x194);}return _0x1d0b76;};}function handleError(_0x48bec3,_0x7efde){_0x7efde=_0x7efde||0x1f4;return function(_0x58f5c2){logger[_0x9251('0x29')](_0x58f5c2[_0x9251('0x2a')]);if(_0x58f5c2[_0x9251('0x2b')]){delete _0x58f5c2[_0x9251('0x2b')];}_0x48bec3[_0x9251('0x1e')](_0x7efde)['send'](_0x58f5c2);};}exports[_0x9251('0x2c')]=function(_0x2f21cf,_0x21f45c,_0x4cff8f){if(!_0x2f21cf[_0x9251('0x2d')][_0x9251('0x2e')]('text')&&!_0x2f21cf[_0x9251('0x2d')][_0x9251('0x2e')](_0x9251('0x2f'))){throw new db[(_0x9251('0x30'))][(_0x9251('0x31'))](_0x9251('0x32'));}else{if(_0x2f21cf['body'][_0x9251('0x2e')](_0x9251('0x2f'))&&!_0x2f21cf[_0x9251('0x2d')][_0x9251('0x2e')](_0x9251('0x33'))){throw new db[(_0x9251('0x30'))][(_0x9251('0x31'))](_0x9251('0x34'));}if(!_0x2f21cf[_0x9251('0x2d')]['hasOwnProperty'](_0x9251('0x35'))){throw new db[(_0x9251('0x30'))]['ValidationError'](_0x9251('0x36'));}else{try{var _0x5a2152=JSON[_0x9251('0x37')](_0x2f21cf[_0x9251('0x2d')]['recipients']);}catch(_0x245093){logger[_0x9251('0x29')](_0x245093);throw new db[(_0x9251('0x30'))]['ValidationError'](_0x9251('0x38'));}var _0x11c4d1=[_0x9251('0x39'),'faxqueue','mailqueue','openchannelqueue',_0x9251('0x3a'),_0x9251('0x3b'),_0x9251('0x3c'),'team','user'];if(_['some'](_0x5a2152,function(_0x2e6c5c){return!_[_0x9251('0x3d')](_0x11c4d1,_0x2e6c5c[_0x9251('0x3e')][_0x9251('0x3f')]());})){throw new db[(_0x9251('0x30'))][(_0x9251('0x31'))](_0x9251('0x40'));}}}var _0x8c8dd4={};_0x8c8dd4[_0x9251('0x41')]=_0x2f21cf[_0x9251('0x2d')][_0x9251('0x2e')](_0x9251('0x41'))?_0x2f21cf[_0x9251('0x2d')][_0x9251('0x41')]:_0x2f21cf[_0x9251('0x42')]['fullname'];_0x8c8dd4['recipientsDescription']=_[_0x9251('0x43')](_0x2f21cf['body'][_0x9251('0x44')])?null:_0x2f21cf[_0x9251('0x2d')]['recipientsDescription'];_0x8c8dd4[_0x9251('0x45')]=_0x2f21cf[_0x9251('0x2d')]['beep']||![];_0x8c8dd4['SenderId']=_0x2f21cf['user']['id'];return getContent(_0x2f21cf[_0x9251('0x2d')])['then'](function(_0x4596f0){_0x8c8dd4[_0x9251('0x2d')]=_0x4596f0;return getRecipients(_0x5a2152);})['then'](function(_0x354477){_0x8c8dd4[_0x9251('0x46')]=_['sortBy'](_0x354477)['join'](',');return db[_0x9251('0x47')][_0x9251('0x48')](function(_0x24235a){return db[_0x9251('0x49')][_0x9251('0x4a')](_0x8c8dd4,{'raw':!![],'transaction':_0x24235a})['then'](function(_0x3aaedf){var _0x9d08e7={'sender':_0x8c8dd4[_0x9251('0x41')],'description':_0x8c8dd4[_0x9251('0x44')],'content':_0x8c8dd4[_0x9251('0x2d')],'beep':_0x8c8dd4[_0x9251('0x45')]};_0x354477[_0x9251('0x4b')](function(_0x1c5759){_0x9d08e7[_0x9251('0x4c')]=_0x1c5759;socket['emit'](_0x9251('0x4d'),_0x9d08e7);});return _0x3aaedf;});});})[_0x9251('0x27')](respondWithResult(_0x21f45c,0xc9))[_0x9251('0x4e')](handleError(_0x21f45c,null));};function getContent(_0x32c152){return new BPromise(function(_0x464cf3,_0x428a79){if(_0x32c152[_0x9251('0x4f')]){_0x464cf3(_0x32c152[_0x9251('0x4f')]);return;}return db[_0x9251('0x50')][_0x9251('0x51')]({'attributes':[_0x9251('0x52')],'where':{'id':_0x32c152[_0x9251('0x2f')]},'raw':!![]})[_0x9251('0x27')](function(_0x565e74){if(!_0x565e74)throw new db[(_0x9251('0x30'))][(_0x9251('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x2f420e=Mustache['render'](_0x565e74[_0x9251('0x52')],_0x32c152['view']);_0x464cf3(_0x2f420e);})['catch'](function(_0x4ccc8a){_0x428a79(_0x4ccc8a);});});}function getRecipients(_0x3411ae){return new BPromise(function(_0x5edc90,_0x30f8c0){var _0x3b63ee=[];var _0x3ac4eb=[];_0x3411ae[_0x9251('0x4b')](function(_0x10b9bf){var _0x3f1dda=_['startCase'](_0x10b9bf[_0x9251('0x3e')][_0x9251('0x3f')]());if(_0x3f1dda===_0x9251('0x53')){_0x3b63ee=_[_0x9251('0x54')](_0x3b63ee,_0x10b9bf[_0x9251('0x55')]);}else{if(_['includes'](_0x3f1dda,_0x9251('0x56')))_0x3f1dda=_0x3f1dda['replace'](_0x9251('0x56'),_0x9251('0x57'));_0x10b9bf[_0x9251('0x55')][_0x9251('0x4b')](function(_0x35ad14){_0x3ac4eb[_0x9251('0x58')](getAgents(_0x3f1dda,_0x35ad14));});}});return BPromise['all'](_0x3ac4eb)[_0x9251('0x27')](function(_0x1f8ebc){_0x3b63ee=_[_0x9251('0x54')](_0x3b63ee,_['flatten'](_0x1f8ebc));_0x5edc90(_0x3b63ee);})[_0x9251('0x4e')](function(_0x58a265){_0x30f8c0(_0x58a265);});});}function getAgents(_0x229e22,_0x457f4d){return new BPromise(function(_0x2c5511,_0x3ed2bc){return db[_0x229e22][_0x9251('0x51')]({'where':{'id':_0x457f4d}})[_0x9251('0x27')](function(_0x4d50ea){return _0x4d50ea[_0x9251('0x59')]({'attributes':['id'],'raw':!![]})[_0x9251('0x27')](function(_0x336817){var _0x436e55=_[_0x9251('0x5a')](_0x336817,'id');_0x2c5511(_0x436e55);});})[_0x9251('0x4e')](function(_0x11cb83){_0x3ed2bc(_0x11cb83);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index a327b57..8e3b34e 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 _0xf419=['emit','exports','../../mysqldb','UserNotification','setMaxListeners','save'];(function(_0x3f121a,_0x140b43){var _0x20fc0f=function(_0x4bf18d){while(--_0x4bf18d){_0x3f121a['push'](_0x3f121a['shift']());}};_0x20fc0f(++_0x140b43);}(_0xf419,0x19a));var _0x9f41=function(_0xf00981,_0x5f0153){_0xf00981=_0xf00981-0x0;var _0x7bd842=_0xf419[_0xf00981];return _0x7bd842;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x9f41('0x0'))['db'][_0x9f41('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9f41('0x2')](0x0);var events={'afterCreate':_0x9f41('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17e858){return function(_0x45492b,_0x5400bf,_0x5ac5ac){UserNotificationEvents['emit'](_0x17e858+':'+_0x45492b['id'],_0x45492b);UserNotificationEvents[_0x9f41('0x4')](_0x17e858,_0x45492b);_0x5ac5ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x9f41('0x5')]=UserNotificationEvents; \ No newline at end of file +var _0x638b=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5391e2,_0x204d77){var _0x442935=function(_0x5a5a2c){while(--_0x5a5a2c){_0x5391e2['push'](_0x5391e2['shift']());}};_0x442935(++_0x204d77);}(_0x638b,0x1af));var _0xb638=function(_0x1895de,_0x3f70a3){_0x1895de=_0x1895de-0x0;var _0x473709=_0x638b[_0x1895de];return _0x473709;};'use strict';var EventEmitter=require(_0xb638('0x0'));var UserNotification=require(_0xb638('0x1'))['db'][_0xb638('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb638('0x3')](0x0);var events={'afterCreate':_0xb638('0x4'),'afterUpdate':_0xb638('0x5'),'afterDestroy':_0xb638('0x6')};function emitEvent(_0xe91dbc){return function(_0xd6b527,_0x4bc29c,_0x106d3d){UserNotificationEvents[_0xb638('0x7')](_0xe91dbc+':'+_0xd6b527['id'],_0xd6b527);UserNotificationEvents[_0xb638('0x7')](_0xe91dbc,_0xd6b527);_0x106d3d(null);};}for(var e in events){if(events[_0xb638('0x8')](e)){var event=events[e];UserNotification[_0xb638('0x9')](e,emitEvent(event));}}module[_0xb638('0xa')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 2d309b2..09464e3 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 _0xbd16=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','utf8mb4_unicode_ci','lodash'];(function(_0x365caf,_0x383074){var _0x355070=function(_0x472bb2){while(--_0x472bb2){_0x365caf['push'](_0x365caf['shift']());}};_0x355070(++_0x383074);}(_0xbd16,0x1d8));var _0x6bd1=function(_0x57c3d1,_0x4589d7){_0x57c3d1=_0x57c3d1-0x0;var _0x5180a8=_0xbd16[_0x57c3d1];return _0x5180a8;};'use strict';var _=require(_0x6bd1('0x0'));var util=require(_0x6bd1('0x1'));var logger=require(_0x6bd1('0x2'))(_0x6bd1('0x3'));var moment=require('moment');var BPromise=require(_0x6bd1('0x4'));var rp=require(_0x6bd1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6bd1('0x6'));var config=require(_0x6bd1('0x7'));var attributes=require(_0x6bd1('0x8'));module[_0x6bd1('0x9')]=function(_0x284df4,_0x32ba0e){return _0x284df4['define']('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6bd1('0xa')});}; \ No newline at end of file +var _0x339d=['api','path','rimraf','../../config/environment','define','userNotifications','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x2e8dcc,_0x3f24bc){var _0x5eda2d=function(_0x1f2d45){while(--_0x1f2d45){_0x2e8dcc['push'](_0x2e8dcc['shift']());}};_0x5eda2d(++_0x3f24bc);}(_0x339d,0xb2));var _0xd339=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x339d[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var util=require(_0xd339('0x0'));var logger=require(_0xd339('0x1'))(_0xd339('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd339('0x3'));var rimraf=require(_0xd339('0x4'));var config=require(_0xd339('0x5'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x2d2da0,_0x4db33a){return _0x2d2da0[_0xd339('0x6')]('UserNotification',attributes,{'tableName':_0xd339('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd339('0x8')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d4aef6c..59ee9c9 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 _0x984d=['register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x984d,0x7c));var _0xd984=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x984d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd984('0x0'));var util=require(_0xd984('0x1'));var moment=require('moment');var BPromise=require(_0xd984('0x2'));var rs=require(_0xd984('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd984('0x4'))['db'];var utils=require(_0xd984('0x5'));var logger=require(_0xd984('0x6'))(_0xd984('0x7'));var config=require(_0xd984('0x8'));var jayson=require(_0xd984('0x9'));var client=jayson[_0xd984('0xa')]['http']({'port':0x232a});config[_0xd984('0xb')]=_[_0xd984('0xc')](config[_0xd984('0xb')],{'host':_0xd984('0xd'),'port':0x18eb});var socket=require(_0xd984('0xe'))(new Redis(config[_0xd984('0xb')]));require(_0xd984('0xf'))[_0xd984('0x10')](socket);function respondWithRpcPromise(_0x230052,_0x250a6c,_0x1da25c){return new BPromise(function(_0x34a8d9,_0x40ccc8){return client[_0xd984('0x11')](_0x230052,_0x1da25c)[_0xd984('0x12')](function(_0x3c9daa){logger[_0xd984('0x13')](_0xd984('0x14'),_0x250a6c,_0xd984('0x15'));logger[_0xd984('0x16')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x250a6c,_0xd984('0x15'),JSON[_0xd984('0x17')](_0x3c9daa));if(_0x3c9daa[_0xd984('0x18')]){if(_0x3c9daa['error'][_0xd984('0x19')]===0x1f4){logger[_0xd984('0x18')](_0xd984('0x14'),_0x250a6c,_0x3c9daa[_0xd984('0x18')]['message']);return _0x40ccc8(_0x3c9daa[_0xd984('0x18')][_0xd984('0x1a')]);}logger[_0xd984('0x18')](_0xd984('0x14'),_0x250a6c,_0x3c9daa[_0xd984('0x18')][_0xd984('0x1a')]);return _0x34a8d9(_0x3c9daa[_0xd984('0x18')][_0xd984('0x1a')]);}else{logger[_0xd984('0x13')](_0xd984('0x14'),_0x250a6c,_0xd984('0x15'));_0x34a8d9(_0x3c9daa['result'][_0xd984('0x1a')]);}})[_0xd984('0x1b')](function(_0x5e1ac6){logger[_0xd984('0x18')]('UserNotification,\x20%s,\x20%s',_0x250a6c,_0x5e1ac6);_0x40ccc8(_0x5e1ac6);});});} \ No newline at end of file +var _0x78b1=['defaults','redis','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x78b1,0xb4));var _0x178b=function(_0x2bdd00,_0x138793){_0x2bdd00=_0x2bdd00-0x0;var _0x7c5e30=_0x78b1[_0x2bdd00];return _0x7c5e30;};'use strict';var _=require('lodash');var util=require(_0x178b('0x0'));var moment=require(_0x178b('0x1'));var BPromise=require(_0x178b('0x2'));var rs=require(_0x178b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x178b('0x4'))['db'];var utils=require(_0x178b('0x5'));var logger=require(_0x178b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x178b('0x7')][_0x178b('0x8')]({'port':0x232a});config['redis']=_[_0x178b('0x9')](config[_0x178b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x178b('0xb'))[_0x178b('0xc')](socket);function respondWithRpcPromise(_0x50ec1c,_0x290642,_0x412b75){return new BPromise(function(_0x4bb5ed,_0x3f6618){return client['request'](_0x50ec1c,_0x412b75)[_0x178b('0xd')](function(_0x47da9b){logger[_0x178b('0xe')](_0x178b('0xf'),_0x290642,'request\x20sent');logger[_0x178b('0x10')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x290642,_0x178b('0x11'),JSON['stringify'](_0x47da9b));if(_0x47da9b['error']){if(_0x47da9b['error']['code']===0x1f4){logger[_0x178b('0x12')](_0x178b('0xf'),_0x290642,_0x47da9b[_0x178b('0x12')][_0x178b('0x13')]);return _0x3f6618(_0x47da9b[_0x178b('0x12')][_0x178b('0x13')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x290642,_0x47da9b[_0x178b('0x12')][_0x178b('0x13')]);return _0x4bb5ed(_0x47da9b[_0x178b('0x12')][_0x178b('0x13')]);}else{logger[_0x178b('0xe')](_0x178b('0xf'),_0x290642,_0x178b('0x11'));_0x4bb5ed(_0x47da9b['result']['message']);}})[_0x178b('0x14')](function(_0x1792af){logger[_0x178b('0x12')](_0x178b('0xf'),_0x290642,_0x1792af);_0x3f6618(_0x1792af);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 545037b..4f52e0c 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 _0xac96=['update','emit','removeListener','save'];(function(_0x4375fd,_0x32ed49){var _0x438f43=function(_0x38bd05){while(--_0x38bd05){_0x4375fd['push'](_0x4375fd['shift']());}};_0x438f43(++_0x32ed49);}(_0xac96,0xbb));var _0x6ac9=function(_0x34373d,_0x53b6ac){_0x34373d=_0x34373d-0x0;var _0x125a53=_0xac96[_0x34373d];return _0x125a53;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x6ac9('0x0'),'remove',_0x6ac9('0x1')];function createListener(_0x1321f9,_0x357db0){return function(_0x579148){_0x357db0[_0x6ac9('0x2')](_0x1321f9,_0x579148);};}function removeListener(_0x1c8681,_0x592fd1){return function(){UserNotificationEvents[_0x6ac9('0x3')](_0x1c8681,_0x592fd1);};}exports['register']=function(_0x35c329){for(var _0x190a06=0x0,_0x55f709=events['length'];_0x190a06<_0x55f709;_0x190a06++){var _0x11d5ec=events[_0x190a06];var _0x38fc68=createListener('userNotification:'+_0x11d5ec,_0x35c329);UserNotificationEvents['on'](_0x11d5ec,_0x38fc68);}}; \ No newline at end of file +var _0x25b2=['userNotification:','./userNotification.events','save','remove','update','emit','register','length'];(function(_0x196e1b,_0x55fa06){var _0x5e1f18=function(_0x3bdb41){while(--_0x3bdb41){_0x196e1b['push'](_0x196e1b['shift']());}};_0x5e1f18(++_0x55fa06);}(_0x25b2,0x181));var _0x225b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x25b2[_0x5bd426];return _0x23a7eb;};'use strict';var UserNotificationEvents=require(_0x225b('0x0'));var events=[_0x225b('0x1'),_0x225b('0x2'),_0x225b('0x3')];function createListener(_0x6fc29f,_0x99f5c){return function(_0x5b3a94){_0x99f5c[_0x225b('0x4')](_0x6fc29f,_0x5b3a94);};}function removeListener(_0xc19086,_0x2f2669){return function(){UserNotificationEvents['removeListener'](_0xc19086,_0x2f2669);};}exports[_0x225b('0x5')]=function(_0x53731e){for(var _0x8f3906=0x0,_0x4bb7e0=events[_0x225b('0x6')];_0x8f3906<_0x4bb7e0;_0x8f3906++){var _0x11c170=events[_0x8f3906];var _0xeea9bd=createListener(_0x225b('0x7')+_0x11c170,_0x53731e);UserNotificationEvents['on'](_0x11c170,_0xeea9bd);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index cf384bc..f368ad4 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x56cc18,_0x3e73ec){var _0x1a672f=function(_0x362604){while(--_0x362604){_0x56cc18['push'](_0x56cc18['shift']());}};_0x1a672f(++_0x3e73ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3600a0,_0x5995bd){var _0x38801b=function(_0x328fbf){while(--_0x328fbf){_0x3600a0['push'](_0x3600a0['shift']());}};_0x38801b(++_0x5995bd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xcb91[_0x8af54b];return _0x27d8f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index dc939cf..fefeb05 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 _0x24ca=['sequelize','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x24ca,0x1bc));var _0xa24c=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x24ca[_0x1dc24d];return _0x5d7fb2;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa24c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1f7f=['INTEGER','sequelize','exports'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x1f7f,0x1f3));var _0xf1f7=function(_0x128a40,_0x546c18){_0x128a40=_0x128a40-0x0;var _0x1359d4=_0x1f7f[_0x128a40];return _0x1359d4;};'use strict';var Sequelize=require(_0xf1f7('0x0'));module[_0xf1f7('0x1')]={'penalty':{'type':Sequelize[_0xf1f7('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 9e0bfa4..4eb970e 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 _0x1db6=['path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf9e31c,_0x195b1b){var _0x2df975=function(_0x2f7bf8){while(--_0x2f7bf8){_0xf9e31c['push'](_0xf9e31c['shift']());}};_0x2df975(++_0x195b1b);}(_0x1db6,0xaf));var _0x61db=function(_0x13fc84,_0x905ef){_0x13fc84=_0x13fc84-0x0;var _0x46d899=_0x1db6[_0x13fc84];return _0x46d899;};'use strict';var _=require(_0x61db('0x0'));var util=require(_0x61db('0x1'));var logger=require(_0x61db('0x2'))(_0x61db('0x3'));var moment=require(_0x61db('0x4'));var BPromise=require(_0x61db('0x5'));var rp=require(_0x61db('0x6'));var fs=require('fs');var path=require(_0x61db('0x7'));var rimraf=require('rimraf');var config=require(_0x61db('0x8'));var attributes=require(_0x61db('0x9'));module[_0x61db('0xa')]=function(_0x11a59a,_0x2c6319){return _0x11a59a[_0x61db('0xb')](_0x61db('0xc'),attributes,{'tableName':_0x61db('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2772=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2772,0xff));var _0x2277=function(_0x8f5d0d,_0x24301d){_0x8f5d0d=_0x8f5d0d-0x0;var _0x456e49=_0x2772[_0x8f5d0d];return _0x456e49;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2277('0x0'))('api');var moment=require('moment');var BPromise=require(_0x2277('0x1'));var rp=require(_0x2277('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2277('0x3'));var config=require(_0x2277('0x4'));var attributes=require(_0x2277('0x5'));module[_0x2277('0x6')]=function(_0x47b127,_0xded2b9){return _0x47b127[_0x2277('0x7')](_0x2277('0x8'),attributes,{'tableName':_0x2277('0x9'),'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 aeb02d9..db6d741 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 _0xb863=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment'];(function(_0x450732,_0x5d5426){var _0x15c0be=function(_0x25770e){while(--_0x25770e){_0x450732['push'](_0x450732['shift']());}};_0x15c0be(++_0x5d5426);}(_0xb863,0x1cc));var _0x3b86=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xb863[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x3b86('0x0'));var util=require('util');var moment=require(_0x3b86('0x1'));var BPromise=require(_0x3b86('0x2'));var rs=require(_0x3b86('0x3'));var fs=require('fs');var Redis=require(_0x3b86('0x4'));var db=require(_0x3b86('0x5'))['db'];var utils=require(_0x3b86('0x6'));var logger=require(_0x3b86('0x7'))(_0x3b86('0x8'));var config=require(_0x3b86('0x9'));var jayson=require(_0x3b86('0xa'));var client=jayson[_0x3b86('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56ce85,_0x4d6185,_0x4d3e81){return new BPromise(function(_0x312da5,_0x3c85cd){return client['request'](_0x56ce85,_0x4d3e81)[_0x3b86('0xc')](function(_0x26622d){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4d6185,'request\x20sent');logger['debug'](_0x3b86('0xd'),_0x4d6185,'request\x20sent',JSON[_0x3b86('0xe')](_0x26622d));if(_0x26622d[_0x3b86('0xf')]){if(_0x26622d['error'][_0x3b86('0x10')]===0x1f4){logger[_0x3b86('0xf')](_0x3b86('0x11'),_0x4d6185,_0x26622d[_0x3b86('0xf')]['message']);return _0x3c85cd(_0x26622d['error'][_0x3b86('0x12')]);}logger[_0x3b86('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4d6185,_0x26622d[_0x3b86('0xf')][_0x3b86('0x12')]);return _0x312da5(_0x26622d[_0x3b86('0xf')]['message']);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4d6185,_0x3b86('0x13'));_0x312da5(_0x26622d[_0x3b86('0x14')][_0x3b86('0x12')]);}})[_0x3b86('0x15')](function(_0x4e9633){logger[_0x3b86('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4d6185,_0x4e9633);_0x3c85cd(_0x4e9633);});});} \ No newline at end of file +var _0xd8e8=['info','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UserOpenchannelQueue,\x20%s,\x20%s','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd8e8,0xac));var _0x8d8e=function(_0x1b400d,_0x4c6a82){_0x1b400d=_0x1b400d-0x0;var _0x2cb49c=_0xd8e8[_0x1b400d];return _0x2cb49c;};'use strict';var _=require(_0x8d8e('0x0'));var util=require(_0x8d8e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d8e('0x2'));var fs=require('fs');var Redis=require(_0x8d8e('0x3'));var db=require(_0x8d8e('0x4'))['db'];var utils=require(_0x8d8e('0x5'));var logger=require(_0x8d8e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x579ae7,_0x290371,_0x3820a1){return new BPromise(function(_0xa3ce01,_0x47aa7b){return client['request'](_0x579ae7,_0x3820a1)[_0x8d8e('0x7')](function(_0x131909){logger[_0x8d8e('0x8')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x290371,'request\x20sent');logger['debug'](_0x8d8e('0x9'),_0x290371,_0x8d8e('0xa'),JSON[_0x8d8e('0xb')](_0x131909));if(_0x131909[_0x8d8e('0xc')]){if(_0x131909[_0x8d8e('0xc')][_0x8d8e('0xd')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x290371,_0x131909[_0x8d8e('0xc')]['message']);return _0x47aa7b(_0x131909[_0x8d8e('0xc')][_0x8d8e('0xe')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x290371,_0x131909[_0x8d8e('0xc')][_0x8d8e('0xe')]);return _0xa3ce01(_0x131909['error']['message']);}else{logger[_0x8d8e('0x8')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x290371,_0x8d8e('0xa'));_0xa3ce01(_0x131909[_0x8d8e('0xf')][_0x8d8e('0xe')]);}})[_0x8d8e('0x10')](function(_0x2e99e4){logger[_0x8d8e('0xc')](_0x8d8e('0x11'),_0x290371,_0x2e99e4);_0x47aa7b(_0x2e99e4);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 5c048d7..b870bee 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 _0x33cc=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/:id/sections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','/:id','update','delete','destroy','removeSections','exports','multer'];(function(_0x4adfd3,_0x2b7785){var _0x4f3fba=function(_0x39ef95){while(--_0x39ef95){_0x4adfd3['push'](_0x4adfd3['shift']());}};_0x4f3fba(++_0x2b7785);}(_0x33cc,0x15b));var _0xc33c=function(_0x2a8033,_0x268312){_0x2a8033=_0x2a8033-0x0;var _0x208f48=_0x33cc[_0x2a8033];return _0x208f48;};'use strict';var multer=require(_0xc33c('0x0'));var util=require(_0xc33c('0x1'));var path=require(_0xc33c('0x2'));var timeout=require(_0xc33c('0x3'));var express=require(_0xc33c('0x4'));var router=express[_0xc33c('0x5')]();var fs_extra=require(_0xc33c('0x6'));var auth=require(_0xc33c('0x7'));var interaction=require(_0xc33c('0x8'));var config=require(_0xc33c('0x9'));var controller=require(_0xc33c('0xa'));router[_0xc33c('0xb')]('/',auth[_0xc33c('0xc')](),controller[_0xc33c('0xd')]);router['get']('/describe',auth[_0xc33c('0xc')](),controller['describe']);router['get']('/:id',auth[_0xc33c('0xc')](),controller['show']);router[_0xc33c('0xb')](_0xc33c('0xe'),auth['isAuthenticated'](),controller['getSections']);router[_0xc33c('0xb')](_0xc33c('0xf'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x10')]);router['post']('/',auth[_0xc33c('0xc')](),controller[_0xc33c('0x11')]);router[_0xc33c('0x12')](_0xc33c('0x13'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x14')]);router[_0xc33c('0x12')]('/:id/sections',auth['isAuthenticated'](),controller[_0xc33c('0x15')]);router[_0xc33c('0x12')](_0xc33c('0xf'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x16')]);router['put'](_0xc33c('0x17'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x18')]);router[_0xc33c('0x19')](_0xc33c('0x17'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x1a')]);router['delete'](_0xc33c('0xe'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x1b')]);router[_0xc33c('0x19')]('/:id/resources',auth[_0xc33c('0xc')](),controller['removeResources']);module[_0xc33c('0x1c')]=router; \ No newline at end of file +var _0x2a0a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','getSections','/:id/resources','getResources','post','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','connect-timeout'];(function(_0x84261a,_0x315d87){var _0x4b9d50=function(_0x590a5a){while(--_0x590a5a){_0x84261a['push'](_0x84261a['shift']());}};_0x4b9d50(++_0x315d87);}(_0x2a0a,0x1a1));var _0xa2a0=function(_0xec7b4d,_0x271d0e){_0xec7b4d=_0xec7b4d-0x0;var _0x318962=_0x2a0a[_0xec7b4d];return _0x318962;};'use strict';var multer=require(_0xa2a0('0x0'));var util=require(_0xa2a0('0x1'));var path=require('path');var timeout=require(_0xa2a0('0x2'));var express=require(_0xa2a0('0x3'));var router=express[_0xa2a0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa2a0('0x5'));var interaction=require(_0xa2a0('0x6'));var config=require(_0xa2a0('0x7'));var controller=require(_0xa2a0('0x8'));router[_0xa2a0('0x9')]('/',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xb')]);router[_0xa2a0('0x9')](_0xa2a0('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa2a0('0xd'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xe')]);router[_0xa2a0('0x9')]('/:id/sections',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xf')]);router[_0xa2a0('0x9')](_0xa2a0('0x10'),auth['isAuthenticated'](),controller[_0xa2a0('0x11')]);router[_0xa2a0('0x12')]('/',auth[_0xa2a0('0xa')](),controller['create']);router[_0xa2a0('0x12')]('/:id/clone',auth[_0xa2a0('0xa')](),controller['clone']);router[_0xa2a0('0x12')]('/:id/sections',auth['isAuthenticated'](),controller[_0xa2a0('0x13')]);router[_0xa2a0('0x12')]('/:id/resources',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x14')]);router[_0xa2a0('0x15')](_0xa2a0('0xd'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x16')]);router[_0xa2a0('0x17')](_0xa2a0('0xd'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x18')]);router['delete']('/:id/sections',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x19')]);router[_0xa2a0('0x17')](_0xa2a0('0x10'),auth['isAuthenticated'](),controller[_0xa2a0('0x1a')]);module[_0xa2a0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7e66096..8c8f238 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 _0x3f95=['STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x598152,_0x4230ac){var _0x71af95=function(_0x59f1da){while(--_0x59f1da){_0x598152['push'](_0x598152['shift']());}};_0x71af95(++_0x4230ac);}(_0x3f95,0xdf));var _0x53f9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3f95[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x53f9('0x0'));module[_0x53f9('0x1')]={'name':{'type':Sequelize[_0x53f9('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x53f9('0x2')],'set':function(_0x4474ed){this[_0x53f9('0x3')](_0x53f9('0x4'),_0x4474ed?_0x4474ed[_0x53f9('0x5')](''):[]);},'get':function(){return this[_0x53f9('0x6')](_0x53f9('0x4'))?this[_0x53f9('0x6')](_0x53f9('0x4'))[_0x53f9('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf9f1=['join','getDataValue','BOOLEAN','sequelize','name','STRING','setDataValue','crudPermissions'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xf9f1,0x6b));var _0x1f9f=function(_0x1509f4,_0x26dee3){_0x1509f4=_0x1509f4-0x0;var _0x24ee67=_0xf9f1[_0x1509f4];return _0x24ee67;};'use strict';var Sequelize=require(_0x1f9f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1f9f('0x1')},'crudPermissions':{'type':Sequelize[_0x1f9f('0x2')],'set':function(_0x33047b){this[_0x1f9f('0x3')](_0x1f9f('0x4'),_0x33047b?_0x33047b[_0x1f9f('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x1f9f('0x4'))?this[_0x1f9f('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x1f9f('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 1fa886b..3ff1c10 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 _0x1c6e=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','clone','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','get','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','getResources','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','update','destroy','then','end','name','map','UserProfile'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0x1c6e,0xb7));var _0xe1c6=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0x1c6e[_0x17e771];return _0x1f3a6d;};'use strict';var emlformat=require(_0xe1c6('0x0'));var rimraf=require(_0xe1c6('0x1'));var zipdir=require(_0xe1c6('0x2'));var jsonpatch=require(_0xe1c6('0x3'));var rp=require('request-promise');var moment=require(_0xe1c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe1c6('0x5'));var util=require('util');var path=require(_0xe1c6('0x6'));var sox=require(_0xe1c6('0x7'));var csv=require(_0xe1c6('0x8'));var ejs=require(_0xe1c6('0x9'));var fs=require('fs');var fs_extra=require(_0xe1c6('0xa'));var _=require(_0xe1c6('0xb'));var squel=require('squel');var crypto=require(_0xe1c6('0xc'));var jsforce=require(_0xe1c6('0xd'));var deskjs=require(_0xe1c6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe1c6('0xf'));var Papa=require(_0xe1c6('0x10'));var Redis=require(_0xe1c6('0x11'));var authService=require(_0xe1c6('0x12'));var qs=require(_0xe1c6('0x13'));var as=require(_0xe1c6('0x14'));var hardwareService=require(_0xe1c6('0x15'));var logger=require('../../config/logger')(_0xe1c6('0x16'));var utils=require(_0xe1c6('0x17'));var config=require(_0xe1c6('0x18'));var licenseUtil=require(_0xe1c6('0x19'));var db=require(_0xe1c6('0x1a'))['db'];config['redis']=_[_0xe1c6('0x1b')](config['redis'],{'host':_0xe1c6('0x1c'),'port':0x18eb});var socket=require(_0xe1c6('0x1d'))(new Redis(config['redis']));require(_0xe1c6('0x1e'))[_0xe1c6('0x1f')](socket);function respondWithStatusCode(_0x22364e,_0x34fdd9){_0x34fdd9=_0x34fdd9||0xcc;return function(_0x4f86db){if(_0x4f86db){return _0x22364e[_0xe1c6('0x20')](_0x34fdd9);}return _0x22364e[_0xe1c6('0x21')](_0x34fdd9)['end']();};}function respondWithResult(_0x1c3db6,_0x26c229){_0x26c229=_0x26c229||0xc8;return function(_0x43041b){if(_0x43041b){return _0x1c3db6[_0xe1c6('0x21')](_0x26c229)[_0xe1c6('0x22')](_0x43041b);}};}function respondWithFilteredResult(_0x43cbd1,_0x478ed8){return function(_0x6bad49){if(_0x6bad49){var _0x2699f0=typeof _0x478ed8[_0xe1c6('0x23')]==='undefined'&&typeof _0x478ed8[_0xe1c6('0x24')]===_0xe1c6('0x25');var _0x15df34=_0x6bad49[_0xe1c6('0x26')];var _0x58121c=_0x2699f0?0x0:_0x478ed8[_0xe1c6('0x23')];var _0x1f4a66=_0x2699f0?_0x6bad49[_0xe1c6('0x26')]:_0x478ed8[_0xe1c6('0x23')]+_0x478ed8[_0xe1c6('0x24')];var _0x2da305;if(_0x1f4a66>=_0x15df34){_0x1f4a66=_0x15df34;_0x2da305=0xc8;}else{_0x2da305=0xce;}_0x43cbd1['status'](_0x2da305);return _0x43cbd1['set']('Content-Range',_0x58121c+'-'+_0x1f4a66+'/'+_0x15df34)[_0xe1c6('0x22')](_0x6bad49);}return null;};}function patchUpdates(_0x177bc2){return function(_0x4438e1){try{jsonpatch[_0xe1c6('0x27')](_0x4438e1,_0x177bc2,!![]);}catch(_0x3aeaf8){return BPromise[_0xe1c6('0x28')](_0x3aeaf8);}return _0x4438e1[_0xe1c6('0x29')]();};}function saveUpdates(_0x109e2e,_0x4f31da){return function(_0x17f795){if(_0x17f795){return _0x17f795[_0xe1c6('0x2a')](_0x109e2e)['then'](function(_0x202961){return _0x202961;});}return null;};}function removeEntity(_0x5bea5c,_0x2482e6){return function(_0x5bde64){if(_0x5bde64){return _0x5bde64[_0xe1c6('0x2b')]()[_0xe1c6('0x2c')](function(){_0x5bea5c[_0xe1c6('0x21')](0xcc)[_0xe1c6('0x2d')]();});}};}function handleEntityNotFound(_0x5909ec,_0x35cba7){return function(_0x219272){if(!_0x219272){_0x5909ec[_0xe1c6('0x20')](0x194);}return _0x219272;};}function handleError(_0x29d8c9,_0x4bd33d){_0x4bd33d=_0x4bd33d||0x1f4;return function(_0x5bb559){logger['error'](_0x5bb559['stack']);if(_0x5bb559[_0xe1c6('0x2e')]){delete _0x5bb559[_0xe1c6('0x2e')];}_0x29d8c9['status'](_0x4bd33d)['send'](_0x5bb559);};}exports['index']=function(_0x30f484,_0x8379fc){var _0x2b043a={},_0x264752={},_0x781d52={'count':0x0,'rows':[]};var _0x5b42db=_[_0xe1c6('0x2f')](db[_0xe1c6('0x30')]['rawAttributes'],function(_0x701b84){return{'name':_0x701b84[_0xe1c6('0x31')],'type':_0x701b84[_0xe1c6('0x32')][_0xe1c6('0x33')]};});_0x264752[_0xe1c6('0x34')]=_[_0xe1c6('0x2f')](_0x5b42db,'name');_0x264752[_0xe1c6('0x35')]=_[_0xe1c6('0x36')](_0x30f484[_0xe1c6('0x35')]);_0x264752[_0xe1c6('0x37')]=_[_0xe1c6('0x38')](_0x264752['model'],_0x264752['query']);_0x2b043a[_0xe1c6('0x39')]=_['intersection'](_0x264752[_0xe1c6('0x34')],qs[_0xe1c6('0x3a')](_0x30f484[_0xe1c6('0x35')][_0xe1c6('0x3a')]));_0x2b043a['attributes']=_0x2b043a[_0xe1c6('0x39')][_0xe1c6('0x3b')]?_0x2b043a[_0xe1c6('0x39')]:_0x264752['model'];if(!_0x30f484[_0xe1c6('0x35')][_0xe1c6('0x3c')](_0xe1c6('0x3d'))){_0x2b043a[_0xe1c6('0x24')]=qs[_0xe1c6('0x24')](_0x30f484[_0xe1c6('0x35')][_0xe1c6('0x24')]);_0x2b043a['offset']=qs['offset'](_0x30f484['query'][_0xe1c6('0x23')]);}_0x2b043a[_0xe1c6('0x3e')]=qs[_0xe1c6('0x3f')](_0x30f484['query'][_0xe1c6('0x3f')]);_0x2b043a[_0xe1c6('0x40')]=qs[_0xe1c6('0x37')](_[_0xe1c6('0x41')](_0x30f484[_0xe1c6('0x35')],_0x264752['filters']),_0x5b42db);if(_0x30f484[_0xe1c6('0x35')][_0xe1c6('0x42')]){_0x2b043a[_0xe1c6('0x40')]=_['merge'](_0x2b043a[_0xe1c6('0x40')],{'$or':_[_0xe1c6('0x2f')](_0x5b42db,function(_0x267363){if(_0x267363['type']!==_0xe1c6('0x43')){var _0x4b30fc={};_0x4b30fc[_0x267363[_0xe1c6('0x2e')]]={'$like':'%'+_0x30f484[_0xe1c6('0x35')]['filter']+'%'};return _0x4b30fc;}})});}_0x2b043a=_['merge']({},_0x2b043a,_0x30f484[_0xe1c6('0x44')]);var _0x464371={'where':_0x2b043a[_0xe1c6('0x40')]};return db[_0xe1c6('0x30')][_0xe1c6('0x26')](_0x464371)[_0xe1c6('0x2c')](function(_0x21f28b){_0x781d52['count']=_0x21f28b;if(_0x30f484[_0xe1c6('0x35')][_0xe1c6('0x45')]){_0x2b043a[_0xe1c6('0x46')]=[{'all':!![]}];}return db['UserProfile'][_0xe1c6('0x47')](_0x2b043a);})[_0xe1c6('0x2c')](function(_0x2bc704){_0x781d52[_0xe1c6('0x48')]=_0x2bc704;return _0x781d52;})[_0xe1c6('0x2c')](respondWithFilteredResult(_0x8379fc,_0x2b043a))[_0xe1c6('0x49')](handleError(_0x8379fc,null));};exports[_0xe1c6('0x4a')]=function(_0x125bae,_0x42ada1){var _0x5d3f64={'raw':![],'where':{'id':_0x125bae[_0xe1c6('0x4b')]['id']}},_0x26a826={};_0x26a826['model']=_[_0xe1c6('0x36')](db['UserProfile'][_0xe1c6('0x4c')]);_0x26a826[_0xe1c6('0x35')]=_[_0xe1c6('0x36')](_0x125bae[_0xe1c6('0x35')]);_0x26a826[_0xe1c6('0x37')]=_[_0xe1c6('0x38')](_0x26a826['model'],_0x26a826['query']);_0x5d3f64[_0xe1c6('0x39')]=_['intersection'](_0x26a826[_0xe1c6('0x34')],qs[_0xe1c6('0x3a')](_0x125bae[_0xe1c6('0x35')][_0xe1c6('0x3a')]));_0x5d3f64[_0xe1c6('0x39')]=_0x5d3f64[_0xe1c6('0x39')][_0xe1c6('0x3b')]?_0x5d3f64[_0xe1c6('0x39')]:_0x26a826[_0xe1c6('0x34')];if(_0x125bae[_0xe1c6('0x35')][_0xe1c6('0x45')]){_0x5d3f64[_0xe1c6('0x46')]=[{'all':!![]}];}_0x5d3f64=_[_0xe1c6('0x4d')]({},_0x5d3f64,_0x125bae['options']);return db[_0xe1c6('0x30')][_0xe1c6('0x4e')](_0x5d3f64)[_0xe1c6('0x2c')](handleEntityNotFound(_0x42ada1,null))[_0xe1c6('0x2c')](respondWithResult(_0x42ada1,null))[_0xe1c6('0x49')](handleError(_0x42ada1,null));};exports[_0xe1c6('0x4f')]=function(_0x46df43,_0x146cc9){return db[_0xe1c6('0x30')]['create'](_0x46df43[_0xe1c6('0x50')],{})[_0xe1c6('0x2c')](respondWithResult(_0x146cc9,0xc9))['catch'](handleError(_0x146cc9,null));};exports[_0xe1c6('0x51')]=function(_0x321a6a,_0x3495dd){var _0x3c924f={'where':{'id':_0x321a6a[_0xe1c6('0x4b')]['id']}},_0x49e522={};_0x49e522[_0xe1c6('0x34')]=_[_0xe1c6('0x36')](db['UserProfile'][_0xe1c6('0x4c')]);_0x3c924f[_0xe1c6('0x39')]=_[_0xe1c6('0x38')](_0x49e522['model'],qs[_0xe1c6('0x3a')](_0x321a6a['query'][_0xe1c6('0x3a')]));_0x3c924f[_0xe1c6('0x39')]=_0x3c924f[_0xe1c6('0x39')]['length']?_0x3c924f['attributes']:_0x49e522[_0xe1c6('0x34')];if(_0x321a6a[_0xe1c6('0x35')]['includeAll']){_0x3c924f[_0xe1c6('0x46')]=[{'all':!![]}];}_0x3c924f=_[_0xe1c6('0x4d')]({},_0x3c924f,_0x321a6a[_0xe1c6('0x44')]);return db[_0xe1c6('0x30')][_0xe1c6('0x4e')](_0x3c924f)[_0xe1c6('0x2c')](handleEntityNotFound(_0x3495dd,null))[_0xe1c6('0x2c')](function(_0x250e7b){if(_0x250e7b){var _0x23a68e=_0x250e7b['get']({'plain':!![]});_0x23a68e=qs[_0xe1c6('0x52')](_0x23a68e,['id',_0xe1c6('0x53'),_0xe1c6('0x54'),_0xe1c6('0x55')]);_0x321a6a['body']=_['omit'](_0x321a6a[_0xe1c6('0x50')],['id','createdAt',_0xe1c6('0x54')]);return db[_0xe1c6('0x56')][_0xe1c6('0x57')](function(_0x1f60ce){return db[_0xe1c6('0x30')][_0xe1c6('0x4f')](_[_0xe1c6('0x4d')](_0x23a68e,_0x321a6a[_0xe1c6('0x50')]),{'include':_0x321a6a['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x1f60ce})['then'](function(_0x1a7e6c){var _0x29a28e=_0x1a7e6c[_0xe1c6('0x58')]({'plain':!![]});return db['UserProfileSection'][_0xe1c6('0x47')]({'where':{'userProfileId':_0x321a6a[_0xe1c6('0x4b')]['id']},'raw':!![]})[_0xe1c6('0x2c')](function(_0x105dc6){if(_0x105dc6){return BPromise[_0xe1c6('0x59')](_0x105dc6,function(_0x56bb94){return new BPromise(function(_0x1e9fe2,_0x516b34){if(_0x56bb94['autoAssociation']===null||_0x56bb94[_0xe1c6('0x5a')]===0x1)_0x1e9fe2(null);return db['UserProfileResource'][_0xe1c6('0x47')]({'where':{'sectionId':_0x56bb94['id']},'raw':!![]})[_0xe1c6('0x2c')](function(_0x515b55){var _0x163ad8=_['map'](_0x515b55,function(_0x953d68){return qs['omit'](_0x953d68,['id',_0xe1c6('0x53'),_0xe1c6('0x54'),_0xe1c6('0x5b')]);});_0x1e9fe2(_0x163ad8);})[_0xe1c6('0x49')](function(_0x24078d){_0x516b34(_0x24078d);});})['then'](function(_0x568c35){var _0x386240=qs[_0xe1c6('0x52')](_0x56bb94,['id','createdAt',_0xe1c6('0x54')]);_0x386240[_0xe1c6('0x5c')]=_0x29a28e['id'];if(_0x568c35)_0x386240[_0xe1c6('0x5d')]=_0x568c35;return _0x386240;})[_0xe1c6('0x2c')](function(_0x50515c){return db[_0xe1c6('0x5e')][_0xe1c6('0x4f')](_0x50515c,{'include':[{'model':db['UserProfileResource'],'as':_0xe1c6('0x5d')}],'raw':!![],'transaction':_0x1f60ce});});})['then'](function(){return _0x29a28e;});}});});});}})[_0xe1c6('0x2c')](respondWithResult(_0x3495dd,0xc9))['catch'](handleError(_0x3495dd,null));};exports[_0xe1c6('0x2a')]=function(_0xde7ef,_0x53fa58){if(_0xde7ef[_0xe1c6('0x50')]['id']){delete _0xde7ef[_0xe1c6('0x50')]['id'];}return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0xde7ef[_0xe1c6('0x4b')]['id']}})[_0xe1c6('0x2c')](handleEntityNotFound(_0x53fa58,null))[_0xe1c6('0x2c')](saveUpdates(_0xde7ef[_0xe1c6('0x50')],null))[_0xe1c6('0x2c')](respondWithResult(_0x53fa58,null))[_0xe1c6('0x49')](handleError(_0x53fa58,null));};exports['destroy']=function(_0x4811b6,_0x116a78){return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0x4811b6[_0xe1c6('0x4b')]['id']}})[_0xe1c6('0x2c')](handleEntityNotFound(_0x116a78,null))[_0xe1c6('0x2c')](removeEntity(_0x116a78,null))[_0xe1c6('0x49')](handleError(_0x116a78,null));};exports['describe']=function(_0x3e7abb,_0x3cb3d7){return db['UserProfile']['describe']()['then'](respondWithResult(_0x3cb3d7,null))[_0xe1c6('0x49')](handleError(_0x3cb3d7,null));};exports['addSections']=function(_0x2e497a,_0x25f761){var _0xd22314=_0x2e497a[_0xe1c6('0x50')];return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0x2e497a['params']['id']}})[_0xe1c6('0x2c')](handleEntityNotFound(_0x25f761,null))[_0xe1c6('0x2c')](function(_0xa3746c){if(_0xa3746c){return db[_0xe1c6('0x56')][_0xe1c6('0x57')](function(_0x2ed146){return db[_0xe1c6('0x5e')][_0xe1c6('0x2b')]({'where':{'userProfileId':_0x2e497a['params']['id'],'sectionId':_[_0xe1c6('0x2f')](_0xd22314,function(_0x3803f0){return _0x3803f0[_0xe1c6('0x5b')];})},'transaction':_0x2ed146})[_0xe1c6('0x2c')](function(){var _0x2592c4=_['map'](_0xd22314,function(_0x26f448){_0x26f448['userProfileId']=_0x2e497a[_0xe1c6('0x4b')]['id'];return _0x26f448;});var _0x4810a0=[];return BPromise['each'](_0x2592c4,function(_0x6d8c9e){return db[_0xe1c6('0x5e')][_0xe1c6('0x4f')](_0x6d8c9e,{'include':[{'model':db[_0xe1c6('0x5f')],'as':'Resources'}],'raw':!![],'transaction':_0x2ed146})['then'](function(_0x119d4f){_0x4810a0[_0xe1c6('0x60')](_0x119d4f['get']({'plain':!![]}));});})[_0xe1c6('0x2c')](function(){return _0x4810a0;});});});}})[_0xe1c6('0x2c')](function(_0x424d41){return _0x424d41;})['then'](respondWithResult(_0x25f761,null))[_0xe1c6('0x49')](handleError(_0x25f761,null));};exports[_0xe1c6('0x61')]=function(_0x4ed0ed,_0x40cd78){var _0x46c281;return db['UserProfile']['find']({'where':{'id':_0x4ed0ed[_0xe1c6('0x4b')]['id']},'attributes':['id',_0xe1c6('0x2e')]})[_0xe1c6('0x2c')](handleEntityNotFound(_0x40cd78,null))[_0xe1c6('0x2c')](function(_0x126c5b){if(_0x126c5b){_0x46c281=_0x126c5b;return db[_0xe1c6('0x5e')][_0xe1c6('0x2b')]({'where':{'userProfileId':_0x4ed0ed['params']['id'],'sectionId':_0x4ed0ed[_0xe1c6('0x35')][_0xe1c6('0x62')]}});}})[_0xe1c6('0x2c')](function(){return _0x46c281;})[_0xe1c6('0x2c')](respondWithStatusCode(_0x40cd78,null))[_0xe1c6('0x49')](handleError(_0x40cd78,null));};exports[_0xe1c6('0x63')]=function(_0x108d9d,_0x4da977){var _0x29fc13=[];var _0x40ecc4=[];return db[_0xe1c6('0x5e')][_0xe1c6('0x47')]({'where':{'userProfileId':_0x108d9d[_0xe1c6('0x4b')]['id']},'raw':!![]})[_0xe1c6('0x2c')](function(_0xe727){_0x29fc13=_[_0xe1c6('0x42')](_0xe727,function(_0x57f246){return _0x57f246[_0xe1c6('0x64')]===0x1||_['includes']([0x3eb,0x709],_0x57f246[_0xe1c6('0x5b')]);});if(!_[_0xe1c6('0x65')](_0x29fc13)){return _['map'](_0x29fc13,function(_0x30e3f4){return _0x30e3f4[_0xe1c6('0x5b')];});}else{return;}})[_0xe1c6('0x2c')](function(_0x26bcad){if(_0x26bcad)_0x40ecc4=_0x26bcad;if(_[_0xe1c6('0x66')](_0x40ecc4,0x64)){var _0x23d2bb=_[_0xe1c6('0x4e')](_0x29fc13,{'sectionId':0x64});return hasDefaultDashboard(_0x23d2bb)[_0xe1c6('0x2c')](function(_0xabf05){return _[_0xe1c6('0x2f')](_0x29fc13,function(_0x512a49){if(_0x512a49[_0xe1c6('0x5b')]===0x64){_0x512a49['subsections']=_0xabf05;}return _0x512a49;});});}else{return;}})['then'](function(_0x4f8d0a){if(_0x4f8d0a)_0x29fc13=_0x4f8d0a;if(_[_0xe1c6('0x66')](_0x40ecc4,0x3eb)){var _0x336d97=_[_0xe1c6('0x4e')](_0x29fc13,{'sectionId':0x3eb});return getCustomDashboards(_0x336d97)['then'](function(_0x1f8c66){return _[_0xe1c6('0x2f')](_0x29fc13,function(_0x489feb){if(_0x336d97[_0xe1c6('0x64')]){if(_0x489feb[_0xe1c6('0x5b')]===0x3eb){_0x489feb[_0xe1c6('0x67')]=_0x1f8c66;}}else{if(_0x489feb[_0xe1c6('0x5b')]===0x64){if(!_0x489feb[_0xe1c6('0x67')]){_0x489feb[_0xe1c6('0x67')]=[];}_0x489feb[_0xe1c6('0x67')]=_0x489feb[_0xe1c6('0x67')][_0xe1c6('0x68')](_0x1f8c66);}}return _0x489feb;});});}else{return;}})[_0xe1c6('0x2c')](function(_0x4f37e3){if(_0x4f37e3)_0x29fc13=_0x4f37e3;if(_['includes'](_0x40ecc4,0x709)){var _0x175d99=_['find'](_0x29fc13,{'sectionId':0x709});return getPlugins(_0x175d99)[_0xe1c6('0x2c')](function(_0x5abe8d){if(_0x175d99[_0xe1c6('0x64')]){return _[_0xe1c6('0x2f')](_0x29fc13,function(_0x4df37a){if(_0x4df37a[_0xe1c6('0x5b')]===0x709){_0x4df37a[_0xe1c6('0x67')]=_0x5abe8d;}return _0x4df37a;});}else{var _0x28259c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5abe8d};var _0x56ced8=_[_0xe1c6('0x2f')](_0x29fc13);_0x56ced8[_0xe1c6('0x60')](_0x28259c);return _0x56ced8;}});}else{return;}})[_0xe1c6('0x2c')](function(_0x35fe78){if(_0x35fe78)_0x29fc13=_0x35fe78;return _[_0xe1c6('0x42')](_0x29fc13,[_0xe1c6('0x64'),0x1]);})['then'](respondWithResult(_0x4da977,null))[_0xe1c6('0x49')](handleError(_0x4da977,null));};function hasDefaultDashboard(_0x5bb188){var _0x52f3be=[0x65];return new BPromise(function(_0x4d3dca,_0x468d36){try{if(_0x5bb188['autoAssociation']){_0x4d3dca(_0x52f3be);}else{return db[_0xe1c6('0x5f')][_0xe1c6('0x69')]({'where':{'sectionId':_0x5bb188['id']},'raw':!![]})[_0xe1c6('0x2c')](function(_0x38d138){_0x38d138?_0x4d3dca(_0x52f3be):_0x4d3dca();});}}catch(_0x310e7b){_0x468d36(_0x310e7b);}});}function getCustomDashboards(_0x4383e3){var _0x289920=[];return new BPromise(function(_0x5b2354,_0x9ee15b){try{if(_0x4383e3[_0xe1c6('0x5a')]){return db[_0xe1c6('0x6a')][_0xe1c6('0x47')]({'raw':!![]})[_0xe1c6('0x2c')](function(_0x1739e6){_0x1739e6['forEach'](function(_0x25fafb){_0x289920[_0xe1c6('0x60')](_0x25fafb['id']+0x1869f);});_0x5b2354(_0x289920);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x4383e3['id']},'raw':!![]})[_0xe1c6('0x2c')](function(_0x31ea16){_0x31ea16[_0xe1c6('0x6b')](function(_0x407733){_0x289920['push'](_0x407733['resourceId']+0x1869f);});_0x5b2354(_0x289920);});}}catch(_0x28673e){_0x9ee15b(_0x28673e);}});}function getPlugins(_0x166a2a){var _0x3ab46a=[];return new BPromise(function(_0x575a0f,_0x4f1607){try{if(_0x166a2a[_0xe1c6('0x5a')]){return db[_0xe1c6('0x6c')]['findAll']({'raw':!![]})[_0xe1c6('0x2c')](function(_0x5a4eae){_0x5a4eae[_0xe1c6('0x6b')](function(_0x3a4752){_0x3ab46a['push'](_0x3a4752['id']+0x15b38);});_0x575a0f(_0x3ab46a);});}else{return db['UserProfileResource'][_0xe1c6('0x47')]({'where':{'sectionId':_0x166a2a['id']},'raw':!![]})['then'](function(_0x47fed5){_0x47fed5[_0xe1c6('0x6b')](function(_0x331218){_0x3ab46a[_0xe1c6('0x60')](_0x331218[_0xe1c6('0x6d')]+0x15b38);});_0x575a0f(_0x3ab46a);});}}catch(_0x52c835){_0x4f1607(_0x52c835);}});}exports[_0xe1c6('0x6e')]=function(_0x5c27b8,_0x1d753a){return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0x5c27b8[_0xe1c6('0x4b')]['id']}})[_0xe1c6('0x2c')](handleEntityNotFound(_0x1d753a,null))['then'](function(_0x5a41ca){if(_0x5a41ca){return db[_0xe1c6('0x56')][_0xe1c6('0x57')](function(_0x4d38c8){return db[_0xe1c6('0x5e')][_0xe1c6('0x47')]({'where':{'userProfileId':_0x5c27b8[_0xe1c6('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0xe1c6('0x2c')](function(_0x520401){if(_0x520401){return db[_0xe1c6('0x5e')][_0xe1c6('0x2b')]({'where':{'userProfileId':_0x5c27b8[_0xe1c6('0x4b')]['id'],'id':_[_0xe1c6('0x2f')](_0x520401,function(_0x27c3bb){return _0x27c3bb['id'];})},'transaction':_0x4d38c8});}})[_0xe1c6('0x2c')](function(_0x8a47ca){var _0x47d67b=_[_0xe1c6('0x2f')](_0x5c27b8['body'],function(_0x731c7e){_0x731c7e[_0xe1c6('0x5c')]=_0x5c27b8['params']['id'];return _0x731c7e;});return db[_0xe1c6('0x5e')][_0xe1c6('0x6f')](_0x47d67b,{'raw':!![],'transaction':_0x4d38c8});})[_0xe1c6('0x2c')](function(_0x39f66a){var _0x1df2a4=_[_0xe1c6('0x42')](_['map'](_0x39f66a,function(_0x5b3347){return _0x5b3347[_0xe1c6('0x58')]({'plain':!![]});}),{'includeAll':![]});if(_0x1df2a4){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x5c27b8[_0xe1c6('0x4b')]['id'],'sectionId':_[_0xe1c6('0x2f')](_0x1df2a4,function(_0x46ca2d){return _0x46ca2d[_0xe1c6('0x5b')];})},'attributes':['id',_0xe1c6('0x5b')],'raw':!![]})[_0xe1c6('0x2c')](function(_0x7a5a6){var _0x2012ae=_[_0xe1c6('0x2f')](_0x5c27b8[_0xe1c6('0x50')],function(_0x1e26f9){_0x1e26f9[_0xe1c6('0x5c')]=_0x5c27b8[_0xe1c6('0x4b')]['id'];return _0x1e26f9;});return db[_0xe1c6('0x5f')][_0xe1c6('0x6f')](_0x2012ae,{'raw':!![],'transaction':_0x4d38c8});});}})[_0xe1c6('0x49')](handleError(_0x1d753a,null));});}})[_0xe1c6('0x2c')](function(_0x3a98f3){var _0x48662c=_[_0xe1c6('0x2f')](_0x3a98f3,function(_0x2207a9){return _0x2207a9['get']({'plain':!![]});});})['then'](respondWithResult(_0x1d753a,null))[_0xe1c6('0x49')](handleError(_0x1d753a,null));};exports['removeResources']=function(_0x4f5483,_0x1df171,_0x2148fd){return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0x4f5483[_0xe1c6('0x4b')]['id']}})[_0xe1c6('0x2c')](handleEntityNotFound(_0x1df171,null))[_0xe1c6('0x2c')](function(_0x521ffd){if(_0x521ffd){return _0x521ffd[_0xe1c6('0x70')](_0x4f5483['query'][_0xe1c6('0x62')]);}})[_0xe1c6('0x2c')](respondWithStatusCode(_0x1df171,null))[_0xe1c6('0x49')](handleError(_0x1df171,null));};exports['getResources']=function(_0x550f78,_0x5c5934){var _0x1988a3={};if(!_0x550f78[_0xe1c6('0x35')][_0xe1c6('0x71')])throw new Error(_0xe1c6('0x72'));if(!_0x550f78['query'][_0xe1c6('0x3c')](_0xe1c6('0x3d'))){_0x1988a3[_0xe1c6('0x24')]=qs[_0xe1c6('0x24')](_0x550f78[_0xe1c6('0x35')][_0xe1c6('0x24')]);_0x1988a3[_0xe1c6('0x23')]=qs['offset'](_0x550f78[_0xe1c6('0x35')]['offset']);}return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0x550f78[_0xe1c6('0x4b')]['id']}})[_0xe1c6('0x2c')](function(_0x447cda){if(!_0x447cda)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x550f78[_0xe1c6('0x4b')]['id']);return db['UserProfile'][_0xe1c6('0x73')](_0x550f78);})[_0xe1c6('0x2c')](respondWithFilteredResult(_0x5c5934,_0x1988a3))['catch'](handleError(_0x5c5934,null));}; \ No newline at end of file +var _0xf997=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','clone','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','get','UserProfileSection','autoAssociation','sectionId','Resources','find','destroy','describe','addSections','userProfileId','each','UserProfileResource','getSections','enabled','includes','subsections','concat','push','findOne','forEach','Plugin','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./userProfile.socket','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','error','stack','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','name'];(function(_0x1e4e65,_0x3d9c6b){var _0x35402f=function(_0x4ec406){while(--_0x4ec406){_0x1e4e65['push'](_0x1e4e65['shift']());}};_0x35402f(++_0x3d9c6b);}(_0xf997,0xa9));var _0x7f99=function(_0x5b5399,_0x5ec522){_0x5b5399=_0x5b5399-0x0;var _0xc6ebef=_0xf997[_0x5b5399];return _0xc6ebef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f99('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f99('0x1'));var rp=require(_0x7f99('0x2'));var moment=require(_0x7f99('0x3'));var BPromise=require(_0x7f99('0x4'));var Mustache=require(_0x7f99('0x5'));var util=require(_0x7f99('0x6'));var path=require(_0x7f99('0x7'));var sox=require(_0x7f99('0x8'));var csv=require(_0x7f99('0x9'));var ejs=require(_0x7f99('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f99('0xb'));var squel=require(_0x7f99('0xc'));var crypto=require('crypto');var jsforce=require(_0x7f99('0xd'));var deskjs=require(_0x7f99('0xe'));var toCsv=require(_0x7f99('0x9'));var querystring=require(_0x7f99('0xf'));var Papa=require('papaparse');var Redis=require(_0x7f99('0x10'));var authService=require(_0x7f99('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7f99('0x12'));var hardwareService=require(_0x7f99('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7f99('0x14'));var config=require(_0x7f99('0x15'));var licenseUtil=require(_0x7f99('0x16'));var db=require('../../mysqldb')['db'];config[_0x7f99('0x17')]=_[_0x7f99('0x18')](config[_0x7f99('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f99('0x17')]));require(_0x7f99('0x19'))['register'](socket);function respondWithStatusCode(_0x3312a2,_0x283dd1){_0x283dd1=_0x283dd1||0xcc;return function(_0x35bda9){if(_0x35bda9){return _0x3312a2['sendStatus'](_0x283dd1);}return _0x3312a2[_0x7f99('0x1a')](_0x283dd1)[_0x7f99('0x1b')]();};}function respondWithResult(_0x376b19,_0x413291){_0x413291=_0x413291||0xc8;return function(_0x17fe39){if(_0x17fe39){return _0x376b19[_0x7f99('0x1a')](_0x413291)[_0x7f99('0x1c')](_0x17fe39);}};}function respondWithFilteredResult(_0x84e125,_0x3d45a8){return function(_0xdc5342){if(_0xdc5342){var _0x1fb3a6=typeof _0x3d45a8['offset']===_0x7f99('0x1d')&&typeof _0x3d45a8[_0x7f99('0x1e')]===_0x7f99('0x1d');var _0x192f7f=_0xdc5342['count'];var _0x4a49b7=_0x1fb3a6?0x0:_0x3d45a8[_0x7f99('0x1f')];var _0x5db301=_0x1fb3a6?_0xdc5342[_0x7f99('0x20')]:_0x3d45a8[_0x7f99('0x1f')]+_0x3d45a8[_0x7f99('0x1e')];var _0x5ce8ea;if(_0x5db301>=_0x192f7f){_0x5db301=_0x192f7f;_0x5ce8ea=0xc8;}else{_0x5ce8ea=0xce;}_0x84e125[_0x7f99('0x1a')](_0x5ce8ea);return _0x84e125[_0x7f99('0x21')](_0x7f99('0x22'),_0x4a49b7+'-'+_0x5db301+'/'+_0x192f7f)[_0x7f99('0x1c')](_0xdc5342);}return null;};}function patchUpdates(_0x322d24){return function(_0x5c79ce){try{jsonpatch['apply'](_0x5c79ce,_0x322d24,!![]);}catch(_0x5c943e){return BPromise[_0x7f99('0x23')](_0x5c943e);}return _0x5c79ce[_0x7f99('0x24')]();};}function saveUpdates(_0x164312,_0x238a2a){return function(_0x2b74cc){if(_0x2b74cc){return _0x2b74cc[_0x7f99('0x25')](_0x164312)[_0x7f99('0x26')](function(_0x1b2fe1){return _0x1b2fe1;});}return null;};}function removeEntity(_0x4f5f76,_0x18ee1e){return function(_0x2d4763){if(_0x2d4763){return _0x2d4763['destroy']()[_0x7f99('0x26')](function(){_0x4f5f76['status'](0xcc)[_0x7f99('0x1b')]();});}};}function handleEntityNotFound(_0x3dd3e6,_0x5b4a84){return function(_0x2dd100){if(!_0x2dd100){_0x3dd3e6['sendStatus'](0x194);}return _0x2dd100;};}function handleError(_0x1cca02,_0x356931){_0x356931=_0x356931||0x1f4;return function(_0x205efb){logger[_0x7f99('0x27')](_0x205efb[_0x7f99('0x28')]);if(_0x205efb['name']){delete _0x205efb['name'];}_0x1cca02[_0x7f99('0x1a')](_0x356931)[_0x7f99('0x29')](_0x205efb);};}exports[_0x7f99('0x2a')]=function(_0x1b91dd,_0xb1d480){var _0x5e21e1={},_0xe74e59={},_0x15fcaa={'count':0x0,'rows':[]};var _0x4058c9=_[_0x7f99('0x2b')](db[_0x7f99('0x2c')][_0x7f99('0x2d')],function(_0x35949e){return{'name':_0x35949e[_0x7f99('0x2e')],'type':_0x35949e[_0x7f99('0x2f')][_0x7f99('0x30')]};});_0xe74e59[_0x7f99('0x31')]=_[_0x7f99('0x2b')](_0x4058c9,_0x7f99('0x32'));_0xe74e59[_0x7f99('0x33')]=_[_0x7f99('0x34')](_0x1b91dd['query']);_0xe74e59[_0x7f99('0x35')]=_[_0x7f99('0x36')](_0xe74e59[_0x7f99('0x31')],_0xe74e59[_0x7f99('0x33')]);_0x5e21e1[_0x7f99('0x37')]=_[_0x7f99('0x36')](_0xe74e59[_0x7f99('0x31')],qs[_0x7f99('0x38')](_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x38')]));_0x5e21e1[_0x7f99('0x37')]=_0x5e21e1[_0x7f99('0x37')][_0x7f99('0x39')]?_0x5e21e1[_0x7f99('0x37')]:_0xe74e59[_0x7f99('0x31')];if(!_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x3a')]('nolimit')){_0x5e21e1['limit']=qs[_0x7f99('0x1e')](_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x1e')]);_0x5e21e1[_0x7f99('0x1f')]=qs[_0x7f99('0x1f')](_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x1f')]);}_0x5e21e1[_0x7f99('0x3b')]=qs[_0x7f99('0x3c')](_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x3c')]);_0x5e21e1[_0x7f99('0x3d')]=qs['filters'](_['pick'](_0x1b91dd['query'],_0xe74e59[_0x7f99('0x35')]),_0x4058c9);if(_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x3e')]){_0x5e21e1[_0x7f99('0x3d')]=_[_0x7f99('0x3f')](_0x5e21e1[_0x7f99('0x3d')],{'$or':_[_0x7f99('0x2b')](_0x4058c9,function(_0x36b7fc){if(_0x36b7fc[_0x7f99('0x2f')]!=='VIRTUAL'){var _0x457373={};_0x457373[_0x36b7fc[_0x7f99('0x32')]]={'$like':'%'+_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x3e')]+'%'};return _0x457373;}})});}_0x5e21e1=_[_0x7f99('0x3f')]({},_0x5e21e1,_0x1b91dd['options']);var _0x4463e2={'where':_0x5e21e1[_0x7f99('0x3d')]};return db[_0x7f99('0x2c')][_0x7f99('0x20')](_0x4463e2)['then'](function(_0x18ae9e){_0x15fcaa[_0x7f99('0x20')]=_0x18ae9e;if(_0x1b91dd['query'][_0x7f99('0x40')]){_0x5e21e1[_0x7f99('0x41')]=[{'all':!![]}];}return db['UserProfile'][_0x7f99('0x42')](_0x5e21e1);})['then'](function(_0x983a6e){_0x15fcaa[_0x7f99('0x43')]=_0x983a6e;return _0x15fcaa;})['then'](respondWithFilteredResult(_0xb1d480,_0x5e21e1))[_0x7f99('0x44')](handleError(_0xb1d480,null));};exports[_0x7f99('0x45')]=function(_0x2cca4d,_0x1dffd1){var _0x5b2f45={'raw':![],'where':{'id':_0x2cca4d[_0x7f99('0x46')]['id']}},_0xf404e4={};_0xf404e4['model']=_['keys'](db[_0x7f99('0x2c')][_0x7f99('0x2d')]);_0xf404e4['query']=_[_0x7f99('0x34')](_0x2cca4d[_0x7f99('0x33')]);_0xf404e4[_0x7f99('0x35')]=_[_0x7f99('0x36')](_0xf404e4[_0x7f99('0x31')],_0xf404e4[_0x7f99('0x33')]);_0x5b2f45['attributes']=_['intersection'](_0xf404e4[_0x7f99('0x31')],qs[_0x7f99('0x38')](_0x2cca4d[_0x7f99('0x33')][_0x7f99('0x38')]));_0x5b2f45[_0x7f99('0x37')]=_0x5b2f45[_0x7f99('0x37')]['length']?_0x5b2f45[_0x7f99('0x37')]:_0xf404e4[_0x7f99('0x31')];if(_0x2cca4d['query'][_0x7f99('0x40')]){_0x5b2f45[_0x7f99('0x41')]=[{'all':!![]}];}_0x5b2f45=_[_0x7f99('0x3f')]({},_0x5b2f45,_0x2cca4d[_0x7f99('0x47')]);return db['UserProfile']['find'](_0x5b2f45)['then'](handleEntityNotFound(_0x1dffd1,null))[_0x7f99('0x26')](respondWithResult(_0x1dffd1,null))[_0x7f99('0x44')](handleError(_0x1dffd1,null));};exports['create']=function(_0x2b28be,_0x559143){return db['UserProfile'][_0x7f99('0x48')](_0x2b28be[_0x7f99('0x49')],{})[_0x7f99('0x26')](respondWithResult(_0x559143,0xc9))[_0x7f99('0x44')](handleError(_0x559143,null));};exports[_0x7f99('0x4a')]=function(_0x1c6b96,_0x15e82f){var _0x42c50b={'where':{'id':_0x1c6b96[_0x7f99('0x46')]['id']}},_0x1045ef={};_0x1045ef[_0x7f99('0x31')]=_[_0x7f99('0x34')](db[_0x7f99('0x2c')][_0x7f99('0x2d')]);_0x42c50b[_0x7f99('0x37')]=_[_0x7f99('0x36')](_0x1045ef[_0x7f99('0x31')],qs[_0x7f99('0x38')](_0x1c6b96[_0x7f99('0x33')][_0x7f99('0x38')]));_0x42c50b['attributes']=_0x42c50b[_0x7f99('0x37')][_0x7f99('0x39')]?_0x42c50b[_0x7f99('0x37')]:_0x1045ef[_0x7f99('0x31')];if(_0x1c6b96['query'][_0x7f99('0x40')]){_0x42c50b[_0x7f99('0x41')]=[{'all':!![]}];}_0x42c50b=_[_0x7f99('0x3f')]({},_0x42c50b,_0x1c6b96[_0x7f99('0x47')]);return db[_0x7f99('0x2c')]['find'](_0x42c50b)[_0x7f99('0x26')](handleEntityNotFound(_0x15e82f,null))[_0x7f99('0x26')](function(_0x21a717){if(_0x21a717){var _0x33e017=_0x21a717['get']({'plain':!![]});_0x33e017=qs[_0x7f99('0x4b')](_0x33e017,['id','createdAt',_0x7f99('0x4c'),_0x7f99('0x4d')]);_0x1c6b96['body']=_[_0x7f99('0x4b')](_0x1c6b96['body'],['id',_0x7f99('0x4e'),_0x7f99('0x4c')]);return db[_0x7f99('0x4f')][_0x7f99('0x50')](function(_0x4561ed){return db[_0x7f99('0x2c')][_0x7f99('0x48')](_[_0x7f99('0x3f')](_0x33e017,_0x1c6b96[_0x7f99('0x49')]),{'include':_0x1c6b96['query'][_0x7f99('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x4561ed})[_0x7f99('0x26')](function(_0x276a6f){var _0x1aec82=_0x276a6f[_0x7f99('0x51')]({'plain':!![]});return db[_0x7f99('0x52')][_0x7f99('0x42')]({'where':{'userProfileId':_0x1c6b96[_0x7f99('0x46')]['id']},'raw':!![]})[_0x7f99('0x26')](function(_0x18d0c6){if(_0x18d0c6){return BPromise['each'](_0x18d0c6,function(_0x1c3a80){return new BPromise(function(_0x1f85d7,_0x529b1a){if(_0x1c3a80[_0x7f99('0x53')]===null||_0x1c3a80['autoAssociation']===0x1)_0x1f85d7(null);return db['UserProfileResource'][_0x7f99('0x42')]({'where':{'sectionId':_0x1c3a80['id']},'raw':!![]})[_0x7f99('0x26')](function(_0x129bb4){var _0x55eeab=_[_0x7f99('0x2b')](_0x129bb4,function(_0x57728a){return qs[_0x7f99('0x4b')](_0x57728a,['id',_0x7f99('0x4e'),_0x7f99('0x4c'),_0x7f99('0x54')]);});_0x1f85d7(_0x55eeab);})[_0x7f99('0x44')](function(_0x142a34){_0x529b1a(_0x142a34);});})[_0x7f99('0x26')](function(_0x140380){var _0x559f72=qs[_0x7f99('0x4b')](_0x1c3a80,['id',_0x7f99('0x4e'),_0x7f99('0x4c')]);_0x559f72['userProfileId']=_0x1aec82['id'];if(_0x140380)_0x559f72[_0x7f99('0x55')]=_0x140380;return _0x559f72;})[_0x7f99('0x26')](function(_0x19cf1d){return db['UserProfileSection'][_0x7f99('0x48')](_0x19cf1d,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x4561ed});});})['then'](function(){return _0x1aec82;});}});});});}})[_0x7f99('0x26')](respondWithResult(_0x15e82f,0xc9))[_0x7f99('0x44')](handleError(_0x15e82f,null));};exports[_0x7f99('0x25')]=function(_0x36c6cc,_0x4f8d77){if(_0x36c6cc[_0x7f99('0x49')]['id']){delete _0x36c6cc[_0x7f99('0x49')]['id'];}return db[_0x7f99('0x2c')][_0x7f99('0x56')]({'where':{'id':_0x36c6cc[_0x7f99('0x46')]['id']}})[_0x7f99('0x26')](handleEntityNotFound(_0x4f8d77,null))[_0x7f99('0x26')](saveUpdates(_0x36c6cc[_0x7f99('0x49')],null))[_0x7f99('0x26')](respondWithResult(_0x4f8d77,null))[_0x7f99('0x44')](handleError(_0x4f8d77,null));};exports[_0x7f99('0x57')]=function(_0x528bf6,_0x4ad7e1){return db[_0x7f99('0x2c')][_0x7f99('0x56')]({'where':{'id':_0x528bf6[_0x7f99('0x46')]['id']}})[_0x7f99('0x26')](handleEntityNotFound(_0x4ad7e1,null))[_0x7f99('0x26')](removeEntity(_0x4ad7e1,null))['catch'](handleError(_0x4ad7e1,null));};exports[_0x7f99('0x58')]=function(_0x55ce42,_0x2f2fa2){return db[_0x7f99('0x2c')][_0x7f99('0x58')]()[_0x7f99('0x26')](respondWithResult(_0x2f2fa2,null))['catch'](handleError(_0x2f2fa2,null));};exports[_0x7f99('0x59')]=function(_0x3887c3,_0x2419bd){var _0x2143b0=_0x3887c3[_0x7f99('0x49')];return db['UserProfile'][_0x7f99('0x56')]({'where':{'id':_0x3887c3[_0x7f99('0x46')]['id']}})[_0x7f99('0x26')](handleEntityNotFound(_0x2419bd,null))['then'](function(_0x4ba050){if(_0x4ba050){return db[_0x7f99('0x4f')]['transaction'](function(_0x520990){return db[_0x7f99('0x52')]['destroy']({'where':{'userProfileId':_0x3887c3[_0x7f99('0x46')]['id'],'sectionId':_[_0x7f99('0x2b')](_0x2143b0,function(_0x43512c){return _0x43512c[_0x7f99('0x54')];})},'transaction':_0x520990})[_0x7f99('0x26')](function(){var _0x2083b4=_[_0x7f99('0x2b')](_0x2143b0,function(_0x127668){_0x127668[_0x7f99('0x5a')]=_0x3887c3[_0x7f99('0x46')]['id'];return _0x127668;});var _0x231e04=[];return BPromise[_0x7f99('0x5b')](_0x2083b4,function(_0x54c122){return db[_0x7f99('0x52')][_0x7f99('0x48')](_0x54c122,{'include':[{'model':db[_0x7f99('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x520990})[_0x7f99('0x26')](function(_0x239305){_0x231e04['push'](_0x239305[_0x7f99('0x51')]({'plain':!![]}));});})[_0x7f99('0x26')](function(){return _0x231e04;});});});}})[_0x7f99('0x26')](function(_0x25c849){return _0x25c849;})[_0x7f99('0x26')](respondWithResult(_0x2419bd,null))[_0x7f99('0x44')](handleError(_0x2419bd,null));};exports['removeSections']=function(_0x333500,_0x548f4f){var _0x2ff64e;return db[_0x7f99('0x2c')]['find']({'where':{'id':_0x333500[_0x7f99('0x46')]['id']},'attributes':['id',_0x7f99('0x32')]})[_0x7f99('0x26')](handleEntityNotFound(_0x548f4f,null))[_0x7f99('0x26')](function(_0xecd7f4){if(_0xecd7f4){_0x2ff64e=_0xecd7f4;return db[_0x7f99('0x52')]['destroy']({'where':{'userProfileId':_0x333500['params']['id'],'sectionId':_0x333500[_0x7f99('0x33')]['ids']}});}})['then'](function(){return _0x2ff64e;})['then'](respondWithStatusCode(_0x548f4f,null))[_0x7f99('0x44')](handleError(_0x548f4f,null));};exports[_0x7f99('0x5d')]=function(_0x5abe0f,_0x46f9a5){var _0x487db3=[];var _0x309332=[];return db[_0x7f99('0x52')][_0x7f99('0x42')]({'where':{'userProfileId':_0x5abe0f['params']['id']},'raw':!![]})[_0x7f99('0x26')](function(_0x1f329b){_0x487db3=_[_0x7f99('0x3e')](_0x1f329b,function(_0x4eddb1){return _0x4eddb1[_0x7f99('0x5e')]===0x1||_[_0x7f99('0x5f')]([0x3eb,0x709],_0x4eddb1[_0x7f99('0x54')]);});if(!_['isEmpty'](_0x487db3)){return _[_0x7f99('0x2b')](_0x487db3,function(_0xe35277){return _0xe35277['sectionId'];});}else{return;}})[_0x7f99('0x26')](function(_0x4c0ad7){if(_0x4c0ad7)_0x309332=_0x4c0ad7;if(_[_0x7f99('0x5f')](_0x309332,0x64)){var _0x4213a5=_[_0x7f99('0x56')](_0x487db3,{'sectionId':0x64});return hasDefaultDashboard(_0x4213a5)[_0x7f99('0x26')](function(_0x5902d9){return _[_0x7f99('0x2b')](_0x487db3,function(_0x4090ae){if(_0x4090ae[_0x7f99('0x54')]===0x64){_0x4090ae['subsections']=_0x5902d9;}return _0x4090ae;});});}else{return;}})[_0x7f99('0x26')](function(_0x5ebb67){if(_0x5ebb67)_0x487db3=_0x5ebb67;if(_['includes'](_0x309332,0x3eb)){var _0x4a8818=_[_0x7f99('0x56')](_0x487db3,{'sectionId':0x3eb});return getCustomDashboards(_0x4a8818)['then'](function(_0x2cdb0c){return _[_0x7f99('0x2b')](_0x487db3,function(_0x10f7fc){if(_0x4a8818[_0x7f99('0x5e')]){if(_0x10f7fc[_0x7f99('0x54')]===0x3eb){_0x10f7fc[_0x7f99('0x60')]=_0x2cdb0c;}}else{if(_0x10f7fc[_0x7f99('0x54')]===0x64){if(!_0x10f7fc['subsections']){_0x10f7fc['subsections']=[];}_0x10f7fc[_0x7f99('0x60')]=_0x10f7fc['subsections'][_0x7f99('0x61')](_0x2cdb0c);}}return _0x10f7fc;});});}else{return;}})[_0x7f99('0x26')](function(_0x41c122){if(_0x41c122)_0x487db3=_0x41c122;if(_[_0x7f99('0x5f')](_0x309332,0x709)){var _0x519edc=_['find'](_0x487db3,{'sectionId':0x709});return getPlugins(_0x519edc)[_0x7f99('0x26')](function(_0x3270cb){if(_0x519edc[_0x7f99('0x5e')]){return _[_0x7f99('0x2b')](_0x487db3,function(_0x252dba){if(_0x252dba[_0x7f99('0x54')]===0x709){_0x252dba['subsections']=_0x3270cb;}return _0x252dba;});}else{var _0x2faaff={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3270cb};var _0x83f988=_[_0x7f99('0x2b')](_0x487db3);_0x83f988[_0x7f99('0x62')](_0x2faaff);return _0x83f988;}});}else{return;}})[_0x7f99('0x26')](function(_0x4a9476){if(_0x4a9476)_0x487db3=_0x4a9476;return _[_0x7f99('0x3e')](_0x487db3,[_0x7f99('0x5e'),0x1]);})['then'](respondWithResult(_0x46f9a5,null))[_0x7f99('0x44')](handleError(_0x46f9a5,null));};function hasDefaultDashboard(_0x201818){var _0x29ecb4=[0x65];return new BPromise(function(_0x66749d,_0x38c534){try{if(_0x201818[_0x7f99('0x53')]){_0x66749d(_0x29ecb4);}else{return db[_0x7f99('0x5c')][_0x7f99('0x63')]({'where':{'sectionId':_0x201818['id']},'raw':!![]})[_0x7f99('0x26')](function(_0x3886c4){_0x3886c4?_0x66749d(_0x29ecb4):_0x66749d();});}}catch(_0xc9ae52){_0x38c534(_0xc9ae52);}});}function getCustomDashboards(_0x430795){var _0x4ceaff=[];return new BPromise(function(_0x450dbc,_0x30c374){try{if(_0x430795['autoAssociation']){return db['Dashboard'][_0x7f99('0x42')]({'raw':!![]})[_0x7f99('0x26')](function(_0x51499a){_0x51499a[_0x7f99('0x64')](function(_0x467a41){_0x4ceaff['push'](_0x467a41['id']+0x1869f);});_0x450dbc(_0x4ceaff);});}else{return db[_0x7f99('0x5c')][_0x7f99('0x42')]({'where':{'sectionId':_0x430795['id']},'raw':!![]})[_0x7f99('0x26')](function(_0xce6087){_0xce6087[_0x7f99('0x64')](function(_0x53637f){_0x4ceaff[_0x7f99('0x62')](_0x53637f['resourceId']+0x1869f);});_0x450dbc(_0x4ceaff);});}}catch(_0x5d47d0){_0x30c374(_0x5d47d0);}});}function getPlugins(_0x2147f1){var _0x1d2e38=[];return new BPromise(function(_0x394715,_0x4490fc){try{if(_0x2147f1['autoAssociation']){return db[_0x7f99('0x65')]['findAll']({'raw':!![]})[_0x7f99('0x26')](function(_0x3eea34){_0x3eea34[_0x7f99('0x64')](function(_0x17819b){_0x1d2e38[_0x7f99('0x62')](_0x17819b['id']+0x15b38);});_0x394715(_0x1d2e38);});}else{return db[_0x7f99('0x5c')][_0x7f99('0x42')]({'where':{'sectionId':_0x2147f1['id']},'raw':!![]})['then'](function(_0x44db09){_0x44db09['forEach'](function(_0xc2c076){_0x1d2e38[_0x7f99('0x62')](_0xc2c076['resourceId']+0x15b38);});_0x394715(_0x1d2e38);});}}catch(_0x49de01){_0x4490fc(_0x49de01);}});}exports['addResources']=function(_0x3e646f,_0x1bfebf){return db[_0x7f99('0x2c')][_0x7f99('0x56')]({'where':{'id':_0x3e646f[_0x7f99('0x46')]['id']}})[_0x7f99('0x26')](handleEntityNotFound(_0x1bfebf,null))[_0x7f99('0x26')](function(_0xc96f18){if(_0xc96f18){return db['sequelize'][_0x7f99('0x50')](function(_0x1bb12e){return db[_0x7f99('0x52')]['findAll']({'where':{'userProfileId':_0x3e646f[_0x7f99('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x7f99('0x26')](function(_0x406466){if(_0x406466){return db[_0x7f99('0x52')][_0x7f99('0x57')]({'where':{'userProfileId':_0x3e646f[_0x7f99('0x46')]['id'],'id':_['map'](_0x406466,function(_0x281a17){return _0x281a17['id'];})},'transaction':_0x1bb12e});}})['then'](function(_0x1af5f6){var _0x32dd23=_[_0x7f99('0x2b')](_0x3e646f['body'],function(_0x43dda8){_0x43dda8[_0x7f99('0x5a')]=_0x3e646f[_0x7f99('0x46')]['id'];return _0x43dda8;});return db[_0x7f99('0x52')][_0x7f99('0x66')](_0x32dd23,{'raw':!![],'transaction':_0x1bb12e});})[_0x7f99('0x26')](function(_0x389130){var _0x522a6b=_[_0x7f99('0x3e')](_['map'](_0x389130,function(_0xcccf25){return _0xcccf25[_0x7f99('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x522a6b){return db['UserProfileSection'][_0x7f99('0x42')]({'where':{'userProfileId':_0x3e646f[_0x7f99('0x46')]['id'],'sectionId':_[_0x7f99('0x2b')](_0x522a6b,function(_0x320199){return _0x320199['sectionId'];})},'attributes':['id',_0x7f99('0x54')],'raw':!![]})[_0x7f99('0x26')](function(_0xfa803){var _0x25f3a7=_[_0x7f99('0x2b')](_0x3e646f[_0x7f99('0x49')],function(_0x20656d){_0x20656d[_0x7f99('0x5a')]=_0x3e646f[_0x7f99('0x46')]['id'];return _0x20656d;});return db[_0x7f99('0x5c')][_0x7f99('0x66')](_0x25f3a7,{'raw':!![],'transaction':_0x1bb12e});});}})[_0x7f99('0x44')](handleError(_0x1bfebf,null));});}})[_0x7f99('0x26')](function(_0x150f53){var _0x2cabe7=_[_0x7f99('0x2b')](_0x150f53,function(_0x5b83da){return _0x5b83da[_0x7f99('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x1bfebf,null))['catch'](handleError(_0x1bfebf,null));};exports[_0x7f99('0x67')]=function(_0x2c47fb,_0x5ec3df,_0x1ea747){return db['UserProfile'][_0x7f99('0x56')]({'where':{'id':_0x2c47fb[_0x7f99('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ec3df,null))[_0x7f99('0x26')](function(_0x510d3c){if(_0x510d3c){return _0x510d3c[_0x7f99('0x67')](_0x2c47fb[_0x7f99('0x33')][_0x7f99('0x68')]);}})['then'](respondWithStatusCode(_0x5ec3df,null))[_0x7f99('0x44')](handleError(_0x5ec3df,null));};exports[_0x7f99('0x69')]=function(_0x7af538,_0x4b5b33){var _0xe98158={};if(!_0x7af538['query'][_0x7f99('0x6a')])throw new Error(_0x7f99('0x6b'));if(!_0x7af538[_0x7f99('0x33')][_0x7f99('0x3a')](_0x7f99('0x6c'))){_0xe98158[_0x7f99('0x1e')]=qs[_0x7f99('0x1e')](_0x7af538['query']['limit']);_0xe98158['offset']=qs[_0x7f99('0x1f')](_0x7af538[_0x7f99('0x33')][_0x7f99('0x1f')]);}return db[_0x7f99('0x2c')][_0x7f99('0x56')]({'where':{'id':_0x7af538[_0x7f99('0x46')]['id']}})[_0x7f99('0x26')](function(_0x5edd65){if(!_0x5edd65)throw new Error(_0x7f99('0x6d')+_0x7af538[_0x7f99('0x46')]['id']);return db['UserProfile']['getResources'](_0x7af538);})[_0x7f99('0x26')](respondWithFilteredResult(_0x4b5b33,_0xe98158))[_0x7f99('0x44')](handleError(_0x4b5b33,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e61b394..3360c69 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 _0x8374=['hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x8374,0x174));var _0x4837=function(_0x3288e7,_0x1bad6a){_0x3288e7=_0x3288e7-0x0;var _0x2a0ef6=_0x8374[_0x3288e7];return _0x2a0ef6;};'use strict';var EventEmitter=require(_0x4837('0x0'));var UserProfile=require(_0x4837('0x1'))['db'][_0x4837('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4837('0x3')](0x0);var events={'afterCreate':_0x4837('0x4'),'afterUpdate':_0x4837('0x5'),'afterDestroy':_0x4837('0x6')};function emitEvent(_0x1d4017){return function(_0x149f91,_0x386e70,_0x188f7f){UserProfileEvents[_0x4837('0x7')](_0x1d4017+':'+_0x149f91['id'],_0x149f91);UserProfileEvents[_0x4837('0x7')](_0x1d4017,_0x149f91);_0x188f7f(null);};}for(var e in events){if(events[_0x4837('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x4837('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x8506=['update','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x4e500e,_0x362f46){var _0x18a3ea=function(_0x3746b8){while(--_0x3746b8){_0x4e500e['push'](_0x4e500e['shift']());}};_0x18a3ea(++_0x362f46);}(_0x8506,0xe8));var _0x6850=function(_0x2d186a,_0x16d77f){_0x2d186a=_0x2d186a-0x0;var _0x11f173=_0x8506[_0x2d186a];return _0x11f173;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x6850('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6850('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6850('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2e0f9d){return function(_0x204a8a,_0x321eff,_0x5e9ff2){UserProfileEvents[_0x6850('0x3')](_0x2e0f9d+':'+_0x204a8a['id'],_0x204a8a);UserProfileEvents[_0x6850('0x3')](_0x2e0f9d,_0x204a8a);_0x5e9ff2(null);};}for(var e in events){if(events[_0x6850('0x4')](e)){var event=events[e];UserProfile[_0x6850('0x5')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2b688f7..755dc26 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 _0xe5dd=['limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','include','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','Tags','tag','ThroughTags','true','chat','dataValues','sms','fax','openchannel','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','projects','JscriptyProject','contacts','CmContact','parentSections','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','role','Telephones','membername','User','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','type','outbound','musiconholds','VoiceChanSpy','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','users','Users','admin','user','zendeskaccounts','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','Variable','Plugin','AnalyticExtractedReport','reportId','metrics','AnalyticMetric','toUpperCase','QueryTypes','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','sequelize','query','OpenTabs','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','isEmpty','autoAssociation','rawAttributes','keys','filters','attributes','intersection','fields'];(function(_0x593893,_0x288a73){var _0x2ed926=function(_0x3886e1){while(--_0x3886e1){_0x593893['push'](_0x593893['shift']());}};_0x2ed926(++_0x288a73);}(_0xe5dd,0xd1));var _0xde5d=function(_0x1a6753,_0x42455d){_0x1a6753=_0x1a6753-0x0;var _0x404a8e=_0xe5dd[_0x1a6753];return _0x404a8e;};'use strict';var _=require(_0xde5d('0x0'));var attributes=require(_0xde5d('0x1'));var squel=require(_0xde5d('0x2'));module[_0xde5d('0x3')]=function(_0x46a1e6){var _0x500759=_0x46a1e6[_0xde5d('0x4')];function _0x5caa39(_0x419bbb,_0x27a63b){return new Promise(function(_0x2ae5f9,_0x59450a){if(!_0x27a63b)return _0x2ae5f9(null);var _0x3d2cb0=_0x27a63b['filter']?{[_0x27a63b[_0xde5d('0x5')][_0xde5d('0x6')]]:_0x27a63b[_0xde5d('0x5')][_0xde5d('0x7')]}:undefined;return _0x500759[_0x419bbb][_0xde5d('0x8')]({'where':_0x3d2cb0,'raw':!![]})[_0xde5d('0x9')](function(_0xbf442a){_0x27a63b[_0xde5d('0xa')]=_[_0xde5d('0xb')](_0xbf442a,'id');_0x2ae5f9(_0x27a63b);})[_0xde5d('0xc')](function(_0x45b5b1){_0x59450a(_0x45b5b1);});});}function _0x264086(_0x17ced3,_0x4152cb){return new Promise(function(_0xa8e3e3,_0x1da379){var _0x19f8ed=_0x17ced3['filter']?{[_0x17ced3['filter']['field']]:_0x17ced3[_0xde5d('0x5')][_0xde5d('0x7')]}:undefined;return _0x500759[_0x17ced3[_0xde5d('0xd')]]['findAll']({'where':_0x19f8ed,'raw':!![]})[_0xde5d('0x9')](function(_0x4a3371){_0x4152cb['associatedResources']=_['map'](_0x4a3371,function(_0x55df39){return _0x55df39[_0xde5d('0xe')];});_0xa8e3e3(_0x4152cb);})[_0xde5d('0xc')](function(_0x32aac5){_0x1da379(_0x32aac5);});});}function _0x5594b2(_0x1be44e,_0x2f0a61,_0x3f5caf){if(!_0x2f0a61)return Promise[_0xde5d('0xf')](null);return new Promise(function(_0x4e7469,_0xcc04de){return _0x500759[_0xde5d('0x10')][_0xde5d('0x8')]({'where':{'sectionId':_0x2f0a61['id']},'raw':!![]})[_0xde5d('0x9')](function(_0x52f578){if(_0x1be44e[_0xde5d('0x6')]&&_0x1be44e[_0xde5d('0x6')]!=='id'){_0x2f0a61['associatedResources']=_[_0xde5d('0xb')](_0x52f578,function(_0x593058){return _0x593058[_0x1be44e[_0xde5d('0x6')]];});}else{if(_0x3f5caf==='AnalyticExtractedReport'){_0x2f0a61[_0xde5d('0xa')]=_['map'](_0x52f578,function(_0x3ab403){return{'id':_0x3ab403['resourceId'],'type':_0x3ab403['type']};});}else{_0x2f0a61[_0xde5d('0xa')]=_[_0xde5d('0xb')](_0x52f578,function(_0x249008){return _0x249008[_0xde5d('0x11')];});}}_0x4e7469(_0x2f0a61);})[_0xde5d('0xc')](function(_0x3ffb46){_0xcc04de(_0x3ffb46);});});}function _0x560c96(_0x3fa2f3,_0x341cfe){var _0x5b3495={'parentSections':[]};switch(_0x3fa2f3[_0xde5d('0x12')]()){case _0xde5d('0x13'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x15');break;case _0xde5d('0x16'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x17');break;case'squarerecordings':_0x5b3495[_0xde5d('0x14')]='SquareRecording';_0x5b3495['parentSections']=[{'name':'SquareProjects','field':_0xde5d('0xe'),'foreignKey':'projectName'}];break;case _0xde5d('0x18'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x19');break;case _0xde5d('0x1a'):_0x5b3495['childModel']=_0xde5d('0x1b');_0x5b3495[_0xde5d('0x1c')]=[{'name':_0xde5d('0x1d'),'field':'id','foreignKey':_0xde5d('0x1e')}];break;case _0xde5d('0x1f'):_0x5b3495[_0xde5d('0x14')]='CmList';break;case _0xde5d('0x20'):_0x5b3495['childModel']=_0xde5d('0x21');break;case _0xde5d('0x22'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x23');break;case'chatqueues':_0x5b3495['childModel']=_0xde5d('0x24');break;case _0xde5d('0x25'):_0x5b3495['childModel']=_0xde5d('0x26');break;case _0xde5d('0x27'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x28');break;case'faxaccounts':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x29');break;case _0xde5d('0x2a'):case'internalroutes':case'outboundroutes':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x2b');break;case'contexts':_0x5b3495['childModel']=_0xde5d('0x2c');break;case _0xde5d('0x2d'):_0x5b3495['childModel']=_0xde5d('0x2e');break;case _0xde5d('0x2f'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x30');_0x5b3495[_0xde5d('0x1c')]=[{'name':_0xde5d('0x31'),'field':'name','foreignKey':'membername','model':'User','filter':{'field':_0xde5d('0x32'),'value':['agent']}},{'name':_0xde5d('0x33'),'field':_0xde5d('0xe'),'foreignKey':_0xde5d('0x34'),'model':_0xde5d('0x35'),'filter':{'field':_0xde5d('0x32'),'value':[_0xde5d('0x36')]}},{'name':_0xde5d('0x37'),'field':_0xde5d('0xe'),'foreignKey':_0xde5d('0x38'),'model':_0xde5d('0x39'),'filter':{'field':'type','value':['inbound']}},{'name':_0xde5d('0x3a'),'field':_0xde5d('0xe'),'foreignKey':_0xde5d('0x38'),'model':_0xde5d('0x39'),'filter':{'field':_0xde5d('0x3b'),'value':[_0xde5d('0x3c')]}}];break;case _0xde5d('0x3d'):_0x5b3495[_0xde5d('0x14')]='VoiceMusicOnHold';break;case'chanspies':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x3e');break;case _0xde5d('0x3f'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x40');break;case'ivrcampaigns':_0x5b3495['childModel']='Campaign';break;case _0xde5d('0x41'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x42');break;case _0xde5d('0x43'):_0x5b3495[_0xde5d('0x14')]='MailAccount';break;case _0xde5d('0x44'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x45');break;case _0xde5d('0x46'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x47');break;case _0xde5d('0x48'):_0x5b3495[_0xde5d('0x14')]='OpenchannelAccount';break;case _0xde5d('0x49'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x4a');break;case _0xde5d('0x4b'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x4c');break;case _0xde5d('0x4d'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x4e');break;case _0xde5d('0x4f'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x50');break;case'teams':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x51');break;case _0xde5d('0x52'):case _0xde5d('0x53'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x39');if(_0x341cfe){_0x5b3495[_0xde5d('0x1c')]=[{'name':'VoiceQueues'},{'name':_0xde5d('0x3a')}];}break;case _0xde5d('0x54'):case'agents':case'telephones':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x35');if(_0x341cfe){_0x5b3495[_0xde5d('0x1c')]=[{'name':_0xde5d('0x55'),'filter':{'field':'role','value':[_0xde5d('0x56'),_0xde5d('0x57')]},'ignore':!![]},{'name':'Agents'},{'name':_0xde5d('0x33')}];}break;case _0xde5d('0x58'):_0x5b3495[_0xde5d('0x14')]='ZendeskAccount';break;case _0xde5d('0x59'):_0x5b3495['childModel']='SalesforceAccount';break;case _0xde5d('0x5a'):_0x5b3495[_0xde5d('0x14')]='FreshdeskAccount';break;case _0xde5d('0x5b'):_0x5b3495['childModel']='SugarcrmAccount';break;case _0xde5d('0x5c'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x5d');break;case _0xde5d('0x5e'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x5f');break;case _0xde5d('0x60'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x35');break;case _0xde5d('0x61'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x62');break;case'dispositions':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x63');break;case _0xde5d('0x64'):_0x5b3495[_0xde5d('0x14')]='Dashboard';break;case _0xde5d('0x65'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x66');break;case'pauses':_0x5b3495[_0xde5d('0x14')]='Pause';break;case'scheduler':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x67');break;case _0xde5d('0x68'):_0x5b3495['childModel']=_0xde5d('0x69');break;case _0xde5d('0x6a'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x6b');break;case _0xde5d('0x6c'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x6d');break;case _0xde5d('0x6e'):_0x5b3495[_0xde5d('0x14')]='Trigger';break;case _0xde5d('0x6f'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x70');break;case'variables':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x71');break;case'plugins':_0x5b3495['childModel']=_0xde5d('0x72');break;case'extractedreports':_0x5b3495['childModel']=_0xde5d('0x73');_0x5b3495[_0xde5d('0x1c')]=[{'name':'Reports','field':'id','foreignKey':_0xde5d('0x74')}];break;case _0xde5d('0x75'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x76');break;}return _0x5b3495;}function _0x50928c(_0x4c314c,_0x38f8a0){var _0x404840=_0x4c314c['charAt'](0x0)[_0xde5d('0x77')]()+_0x4c314c['slice'](0x1);var _0x530458={'type':_0x500759['Sequelize'][_0xde5d('0x78')]['SELECT'],'raw':!![]};return new Promise(function(_0x4872a7,_0x250912){var _0x21fe19=squel[_0xde5d('0x79')]()[_0xde5d('0x6')](_0xde5d('0x7a')+_0x404840+_0xde5d('0x7b'),'id')['field'](_0xde5d('0x7c'))['from'](_0xde5d('0x7d')+_0x4c314c+_0xde5d('0x7e'),'ui')[_0xde5d('0x7f')]('ui.UserId\x20=\x20?',_0x38f8a0['id']);return _0x500759[_0xde5d('0x80')][_0xde5d('0x81')](_0x21fe19['toString'](),_0x530458)[_0xde5d('0x9')](function(_0x50f2bd){_0x38f8a0[_0x404840+_0xde5d('0x82')]=_0x50f2bd;_0x4872a7(_0x50f2bd);})[_0xde5d('0xc')](function(_0x170e03){_0x250912(_0x170e03);});});}return _0x46a1e6['define']('UserProfile',attributes,{'tableName':_0xde5d('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x50a1ec){var _0x3a978b=require(_0xde5d('0x84'));var _0x23caad={'raw':_0x50a1ec['query'][_0xde5d('0x85')],'where':{}};var _0x48ea19={};var _0x1dfbaa={'count':0x0,'rows':[]};var _0x31d8c1=_0x50a1ec[_0xde5d('0x81')][_0xde5d('0x86')];var _0x56f887=_0x50a1ec['query'][_0xde5d('0x87')]||![];var _0x4869ca=_0x560c96(_0x31d8c1,_0x56f887);if(!_0x4869ca['childModel'])throw new Error(_0xde5d('0x88')+_0x31d8c1+'\x27');var _0x243dcd=[{'name':_0x31d8c1}];if(!_['isEmpty'](_0x4869ca[_0xde5d('0x1c')]))_0x243dcd=_0x4869ca[_0xde5d('0x1c')];var _0x440faf=[];for(var _0xfd2e26=0x0;_0xfd2e26<_0x243dcd[_0xde5d('0x89')];_0xfd2e26++){_0x440faf[_0xde5d('0x8a')](_0x500759[_0xde5d('0x8b')][_0xde5d('0x8c')]({'where':{'userProfileId':_0x50a1ec[_0xde5d('0x8d')]['id'],'name':_0x243dcd[_0xfd2e26][_0xde5d('0xe')]},'raw':!![]}));}return Promise[_0xde5d('0x8e')](_0x440faf)[_0xde5d('0x9')](function(_0x358130){var _0x4fabee=_[_0xde5d('0x5')](_0x358130,function(_0x322aa5){return _0x322aa5?_0x322aa5:undefined;});var _0x43a707=_[_0xde5d('0x5')](_0x243dcd,['ignore',!![]]);var _0x5e3dd5=_[_0xde5d('0x8f')](_0x4fabee)&&_[_0xde5d('0x8f')](_0x43a707)?null:_['union'](_0x43a707,_0x4fabee);if(!_0x5e3dd5)return null;var _0x2d2bf9=[];for(var _0x1cfc90=0x0;_0x1cfc90<_0x5e3dd5[_0xde5d('0x89')];_0x1cfc90++){var _0xcac546=_[_0xde5d('0x8c')](_0x243dcd,function(_0x303a87){return _0x5e3dd5[_0x1cfc90]?_0x303a87['name']===_0x5e3dd5[_0x1cfc90][_0xde5d('0xe')]:null;});if(_0xcac546){if(_0x5e3dd5[_0x1cfc90]['ignore']){_0x2d2bf9[_0xde5d('0x8a')](_0x5caa39(_0x4869ca[_0xde5d('0x14')],_0x5e3dd5[_0x1cfc90]));}else{if(!_0x5e3dd5[_0x1cfc90][_0xde5d('0x90')]){_0x2d2bf9['push'](_0x5594b2(_0xcac546,_0x5e3dd5[_0x1cfc90],_0x4869ca['childModel']));}else{if(_0xcac546['model']){_0x2d2bf9[_0xde5d('0x8a')](_0x264086(_0xcac546,_0x5e3dd5[_0x1cfc90]));}}}}}return Promise[_0xde5d('0x8e')](_0x2d2bf9);})[_0xde5d('0x9')](function(_0x4866d9){var _0x241bf5=_0x4866d9;var _0x340503=null;if(_0x241bf5){_0x340503=_0x241bf5[_0xde5d('0x89')]===0x1?_0x241bf5[0x0]:null;}if(!_0x340503&&!_0x241bf5)return _0x1dfbaa;var _0x4ef289=_0x500759[_0x4869ca[_0xde5d('0x14')]][_0xde5d('0x91')];_0x48ea19[_0xde5d('0xd')]=_[_0xde5d('0x92')](_0x4ef289);_0x48ea19[_0xde5d('0x81')]=_[_0xde5d('0x92')](_0x50a1ec['query']);_0x48ea19[_0xde5d('0x93')]=_['intersection'](_0x48ea19[_0xde5d('0xd')],_0x48ea19[_0xde5d('0x81')]);_0x23caad[_0xde5d('0x94')]=_[_0xde5d('0x95')](_0x48ea19['model'],_0x3a978b['fields'](_0x50a1ec['query'][_0xde5d('0x96')]));_0x23caad['attributes']=_0x23caad['attributes'][_0xde5d('0x89')]?_0x23caad['attributes']:_0x48ea19[_0xde5d('0xd')];if(!_0x50a1ec[_0xde5d('0x81')]['hasOwnProperty']('nolimit')){_0x23caad[_0xde5d('0x97')]=_0x3a978b[_0xde5d('0x97')](_0x50a1ec[_0xde5d('0x81')][_0xde5d('0x97')]);_0x23caad[_0xde5d('0x98')]=_0x3a978b[_0xde5d('0x98')](_0x50a1ec[_0xde5d('0x81')]['offset']);}_0x23caad[_0xde5d('0x99')]=_0x3a978b[_0xde5d('0x9a')](_0x50a1ec[_0xde5d('0x81')]['sort']);_0x23caad['where']=_0x3a978b['filters'](_[_0xde5d('0x9b')](_0x50a1ec['query'],_0x48ea19['filters']));if(_0x50a1ec[_0xde5d('0x81')][_0xde5d('0x5')]){_0x23caad[_0xde5d('0x7f')]=_['merge'](_0x23caad[_0xde5d('0x7f')],{'$or':_[_0xde5d('0xb')](_0x4ef289,function(_0x3e4e9e){if(_0x3e4e9e[_0xde5d('0x3b')][_0xde5d('0x9c')]!==_0xde5d('0x9d')){var _0x48368a={};_0x48368a[_0x3e4e9e[_0xde5d('0x6')]]={'$like':'%'+_0x50a1ec['query']['filter']+'%'};return _0x48368a;}})});}var _0x5c0cad=[];var _0x2561a6=null;var _0x5e6b4c={};if(_0x340503){_0x2561a6=_[_0xde5d('0x8c')](_0x243dcd,[_0xde5d('0xe'),_0x340503[_0xde5d('0xe')]]);if(_0x2561a6[_0xde5d('0x6')]){_0x5e6b4c={};if(_0x4869ca['childModel']===_0xde5d('0x73')){_0x5e6b4c[_0x2561a6[_0xde5d('0x9e')]]=_[_0xde5d('0xb')](_0x340503[_0xde5d('0xa')],'id');}else{_0x5e6b4c[_0x2561a6[_0xde5d('0x9e')]]=_0x340503[_0xde5d('0xa')];}_0x5c0cad['push'](_0x5e6b4c);}else{_0x23caad[_0xde5d('0x7f')]['id']=_0x340503[_0xde5d('0xa')];}}else{for(var _0x77632d=0x0;_0x77632d<_0x241bf5['length'];_0x77632d++){_0x2561a6=_[_0xde5d('0x8c')](_0x243dcd,[_0xde5d('0xe'),_0x241bf5[_0x77632d]['name']]);if(_0x2561a6[_0xde5d('0x6')]){_0x5e6b4c={};_0x5e6b4c[_0x2561a6['foreignKey']]=_0x241bf5[_0x77632d][_0xde5d('0xa')];_0x5c0cad['push'](_0x5e6b4c);}else{if(!_0x23caad['where']['id'])_0x23caad['where']['id']=[];_0x241bf5[_0x77632d][_0xde5d('0xa')][_0xde5d('0x9f')](function(_0xc5ae0f){_0x23caad[_0xde5d('0x7f')]['id'][_0xde5d('0x8a')](_0xc5ae0f);});}}}if(!_[_0xde5d('0x8f')](_0x5c0cad)){_0x23caad['where']=_['merge'](_0x23caad[_0xde5d('0x7f')],{'$and':{'$or':_0x5c0cad}});}_0x23caad=_[_0xde5d('0xa0')]({},_0x23caad,_0x50a1ec['options']);if(_0x340503&&!_0x340503['autoAssociation']&&_0x4869ca[_0xde5d('0x14')]===_0xde5d('0x73')){if(_0x50a1ec['query']['includeAll']){_0x23caad[_0xde5d('0xa1')]=[{'all':!![]}];}return _0x500759[_0x4869ca['childModel']][_0xde5d('0x8')](_0x23caad)['then'](function(_0x27d476){var _0x115c0b=[];_0x27d476[_0xde5d('0x9f')](function(_0x374fed){var _0x3811e2;switch(_0x374fed['reportType']){case _0xde5d('0xa2'):_0x3811e2=_[_0xde5d('0x8c')](_0x340503[_0xde5d('0xa')],function(_0x1870d8){return _0x1870d8['id']===_0x374fed['reportId']&&_0x1870d8[_0xde5d('0x3b')]===_0xde5d('0xa3');});break;case _0xde5d('0xa4'):_0x3811e2=_[_0xde5d('0x8c')](_0x340503[_0xde5d('0xa')],function(_0x437a55){return _0x437a55['id']===_0x374fed[_0xde5d('0x74')]&&_0x437a55[_0xde5d('0x3b')]===_0xde5d('0xa5');});break;}if(_0x3811e2)_0x115c0b['push'](_0x374fed);});_0x1dfbaa['count']=_0x115c0b[_0xde5d('0x89')];_0x1dfbaa[_0xde5d('0xa6')]=_0x115c0b;return _0x1dfbaa;});}else{if(!_[_0xde5d('0x8f')](_0x50a1ec[_0xde5d('0x81')][_0xde5d('0xa7')])){_0x23caad[_0xde5d('0x7f')]['id']=_0x23caad[_0xde5d('0x7f')]['id']?_[_0xde5d('0x95')](_0x23caad[_0xde5d('0x7f')]['id'],_0x50a1ec[_0xde5d('0x81')]['ids']):_0x50a1ec['query'][_0xde5d('0xa7')];if(_0x50a1ec[_0xde5d('0x81')][_0xde5d('0xa8')]){_0x23caad['order']=_0x50a1ec['query']['customSorting'];}}if(_0x50a1ec[_0xde5d('0x81')]['extraQueryConditions']){_0x23caad['where']=_['merge'](_0x23caad[_0xde5d('0x7f')],{'$and':_0x50a1ec['query'][_0xde5d('0xa9')]});}return _0x500759[_0x4869ca['childModel']][_0xde5d('0xaa')]({'where':_0x23caad[_0xde5d('0x7f')]})[_0xde5d('0x9')](function(_0x27582b){_0x1dfbaa[_0xde5d('0xaa')]=_0x27582b;if(_0x50a1ec[_0xde5d('0x81')]['includeAll']){if(_0x4869ca[_0xde5d('0x14')]===_0xde5d('0x1b')){_0x23caad[_0xde5d('0xa1')]=[{'model':_0x500759['Tag'],'as':_0xde5d('0xab'),'attributes':['id',_0xde5d('0xe'),'color'],'required':_0x50a1ec[_0xde5d('0x81')][_0xde5d('0xac')]?!![]:![]},{'model':_0x500759[_0xde5d('0x6b')],'as':_0xde5d('0xad'),'attributes':['id',_0xde5d('0xe'),'color'],'through':_0x50a1ec['query'][_0xde5d('0xac')]?{'attributes':[],'where':{'TagId':_0x50a1ec[_0xde5d('0x81')][_0xde5d('0xac')]||undefined}}:{},'required':_0x50a1ec[_0xde5d('0x81')][_0xde5d('0xac')]?!![]:![]}];}else{_0x23caad[_0xde5d('0xa1')]=[{'all':!![]}];}}return _0x500759[_0x4869ca['childModel']][_0xde5d('0x8')](_0x23caad);})[_0xde5d('0x9')](function(_0x23b5b8){_0x1dfbaa[_0xde5d('0xa6')]=_0x23b5b8;if(_0x31d8c1===_0xde5d('0x31')&&_0x50a1ec['query']['openTabs']===_0xde5d('0xae')){var _0x5cbf19=[];for(var _0x36c9f8=0x0;_0x36c9f8<_0x1dfbaa[_0xde5d('0xa6')][_0xde5d('0x89')];_0x36c9f8++){_0x5cbf19[_0xde5d('0x8a')](_0x50928c(_0xde5d('0xaf'),_0x1dfbaa[_0xde5d('0xa6')][_0x36c9f8][_0xde5d('0xb0')]));_0x5cbf19[_0xde5d('0x8a')](_0x50928c(_0xde5d('0xb1'),_0x1dfbaa[_0xde5d('0xa6')][_0x36c9f8]['dataValues']));_0x5cbf19[_0xde5d('0x8a')](_0x50928c(_0xde5d('0xb2'),_0x1dfbaa[_0xde5d('0xa6')][_0x36c9f8][_0xde5d('0xb0')]));_0x5cbf19[_0xde5d('0x8a')](_0x50928c('mail',_0x1dfbaa['rows'][_0x36c9f8][_0xde5d('0xb0')]));_0x5cbf19[_0xde5d('0x8a')](_0x50928c(_0xde5d('0xb3'),_0x1dfbaa[_0xde5d('0xa6')][_0x36c9f8]['dataValues']));_0x5cbf19[_0xde5d('0x8a')](_0x50928c('whatsapp',_0x1dfbaa[_0xde5d('0xa6')][_0x36c9f8][_0xde5d('0xb0')]));}return Promise[_0xde5d('0x8e')](_0x5cbf19)[_0xde5d('0x9')](function(){return _0x1dfbaa;});}return _0x1dfbaa;});}});}}});}; \ No newline at end of file +var _0xadcd=['length','push','UserProfileSection','find','params','all','ignore','union','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','pick','merge','VIRTUAL','foreignKey','options','autoAssociation','includeAll','include','forEach','default','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','chat','dataValues','sms','fax','mail','openchannel','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','catch','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareProjects','JscriptyProject','contacts','CmContact','parentSections','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','voicerecordings','Agents','membername','agent','User','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceChanSpy','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','triggers','Trunk','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','InteractionId','_interactions','where','sequelize','toString','user_profiles','../../components/parsers/qs','query','raw','section','Invalid\x20section\x20\x27','isEmpty'];(function(_0x4c401b,_0x2c165f){var _0x12201b=function(_0x27ca7b){while(--_0x27ca7b){_0x4c401b['push'](_0x4c401b['shift']());}};_0x12201b(++_0x2c165f);}(_0xadcd,0xeb));var _0xdadc=function(_0x589527,_0x10ac3f){_0x589527=_0x589527-0x0;var _0x5537a1=_0xadcd[_0x589527];return _0x5537a1;};'use strict';var _=require('lodash');var attributes=require(_0xdadc('0x0'));var squel=require(_0xdadc('0x1'));module[_0xdadc('0x2')]=function(_0x43fb58){var _0x513985=_0x43fb58[_0xdadc('0x3')];function _0x4ff842(_0x2bdf2c,_0x36331f){return new Promise(function(_0x17d41b,_0x4f44d1){if(!_0x36331f)return _0x17d41b(null);var _0x36087f=_0x36331f['filter']?{[_0x36331f[_0xdadc('0x4')][_0xdadc('0x5')]]:_0x36331f['filter'][_0xdadc('0x6')]}:undefined;return _0x513985[_0x2bdf2c][_0xdadc('0x7')]({'where':_0x36087f,'raw':!![]})[_0xdadc('0x8')](function(_0x31a842){_0x36331f[_0xdadc('0x9')]=_[_0xdadc('0xa')](_0x31a842,'id');_0x17d41b(_0x36331f);})['catch'](function(_0x5e39b9){_0x4f44d1(_0x5e39b9);});});}function _0x57cc66(_0x20a9c1,_0x5a4911){return new Promise(function(_0x59a86b,_0x16dab3){var _0x398cba=_0x20a9c1[_0xdadc('0x4')]?{[_0x20a9c1['filter'][_0xdadc('0x5')]]:_0x20a9c1['filter'][_0xdadc('0x6')]}:undefined;return _0x513985[_0x20a9c1['model']]['findAll']({'where':_0x398cba,'raw':!![]})['then'](function(_0x540bcf){_0x5a4911[_0xdadc('0x9')]=_[_0xdadc('0xa')](_0x540bcf,function(_0x286acd){return _0x286acd[_0xdadc('0xb')];});_0x59a86b(_0x5a4911);})['catch'](function(_0x11cc6b){_0x16dab3(_0x11cc6b);});});}function _0x1c480f(_0xf183c9,_0x23d58d,_0x3811d0){if(!_0x23d58d)return Promise['resolve'](null);return new Promise(function(_0xebfac8,_0x593f30){return _0x513985[_0xdadc('0xc')]['findAll']({'where':{'sectionId':_0x23d58d['id']},'raw':!![]})[_0xdadc('0x8')](function(_0x4310bd){if(_0xf183c9[_0xdadc('0x5')]&&_0xf183c9[_0xdadc('0x5')]!=='id'){_0x23d58d[_0xdadc('0x9')]=_[_0xdadc('0xa')](_0x4310bd,function(_0x36bf0a){return _0x36bf0a[_0xf183c9[_0xdadc('0x5')]];});}else{if(_0x3811d0===_0xdadc('0xd')){_0x23d58d['associatedResources']=_[_0xdadc('0xa')](_0x4310bd,function(_0x4f364e){return{'id':_0x4f364e[_0xdadc('0xe')],'type':_0x4f364e[_0xdadc('0xf')]};});}else{_0x23d58d[_0xdadc('0x9')]=_['map'](_0x4310bd,function(_0x16e477){return _0x16e477['resourceId'];});}}_0xebfac8(_0x23d58d);})[_0xdadc('0x10')](function(_0xe645bc){_0x593f30(_0xe645bc);});});}function _0x12ba82(_0xf32be0,_0x22aac6){var _0x1c37aa={'parentSections':[]};switch(_0xf32be0['toLowerCase']()){case _0xdadc('0x11'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x13');break;case _0xdadc('0x14'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x15');break;case _0xdadc('0x16'):_0x1c37aa[_0xdadc('0x12')]='SquareRecording';_0x1c37aa['parentSections']=[{'name':_0xdadc('0x17'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x18');break;case _0xdadc('0x19'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x1a');_0x1c37aa[_0xdadc('0x1b')]=[{'name':_0xdadc('0x1c'),'field':'id','foreignKey':'ListId'}];break;case _0xdadc('0x1d'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x1e');break;case _0xdadc('0x1f'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x20');break;case _0xdadc('0x21'):_0x1c37aa['childModel']=_0xdadc('0x22');break;case _0xdadc('0x23'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x24');break;case'chatwebsites':_0x1c37aa['childModel']=_0xdadc('0x25');break;case'faxqueues':_0x1c37aa['childModel']=_0xdadc('0x26');break;case _0xdadc('0x27'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x28');break;case _0xdadc('0x29'):case _0xdadc('0x2a'):case _0xdadc('0x2b'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x2c');break;case _0xdadc('0x2d'):_0x1c37aa['childModel']='VoiceContext';break;case _0xdadc('0x2e'):_0x1c37aa[_0xdadc('0x12')]='VoiceMail';break;case _0xdadc('0x2f'):_0x1c37aa[_0xdadc('0x12')]='VoiceRecording';_0x1c37aa[_0xdadc('0x1b')]=[{'name':_0xdadc('0x30'),'field':'name','foreignKey':_0xdadc('0x31'),'model':'User','filter':{'field':'role','value':[_0xdadc('0x32')]}},{'name':'Telephones','field':'name','foreignKey':_0xdadc('0x31'),'model':_0xdadc('0x33'),'filter':{'field':_0xdadc('0x34'),'value':[_0xdadc('0x35')]}},{'name':_0xdadc('0x36'),'field':'name','foreignKey':_0xdadc('0x37'),'model':_0xdadc('0x38'),'filter':{'field':_0xdadc('0xf'),'value':[_0xdadc('0x39')]}},{'name':_0xdadc('0x3a'),'field':_0xdadc('0xb'),'foreignKey':_0xdadc('0x37'),'model':_0xdadc('0x38'),'filter':{'field':_0xdadc('0xf'),'value':['outbound']}}];break;case _0xdadc('0x3b'):_0x1c37aa[_0xdadc('0x12')]='VoiceMusicOnHold';break;case'chanspies':_0x1c37aa['childModel']=_0xdadc('0x3c');break;case'voiceprefixes':_0x1c37aa[_0xdadc('0x12')]='VoicePrefix';break;case'ivrcampaigns':_0x1c37aa['childModel']=_0xdadc('0x3d');break;case _0xdadc('0x3e'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x3f');break;case _0xdadc('0x40'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x41');break;case _0xdadc('0x42'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x43');break;case _0xdadc('0x44'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x45');break;case'openchannelaccounts':_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x46');break;case _0xdadc('0x47'):_0x1c37aa['childModel']=_0xdadc('0x48');break;case _0xdadc('0x49'):_0x1c37aa[_0xdadc('0x12')]='SmsAccount';break;case _0xdadc('0x4a'):_0x1c37aa['childModel']=_0xdadc('0x4b');break;case _0xdadc('0x4c'):_0x1c37aa[_0xdadc('0x12')]='WhatsappAccount';break;case _0xdadc('0x4d'):_0x1c37aa['childModel']=_0xdadc('0x4e');break;case _0xdadc('0x4f'):case _0xdadc('0x50'):_0x1c37aa[_0xdadc('0x12')]='VoiceQueue';if(_0x22aac6){_0x1c37aa['parentSections']=[{'name':_0xdadc('0x36')},{'name':_0xdadc('0x3a')}];}break;case _0xdadc('0x51'):case _0xdadc('0x52'):case _0xdadc('0x53'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x33');if(_0x22aac6){_0x1c37aa[_0xdadc('0x1b')]=[{'name':_0xdadc('0x54'),'filter':{'field':'role','value':[_0xdadc('0x55'),_0xdadc('0x56')]},'ignore':!![]},{'name':_0xdadc('0x30')},{'name':_0xdadc('0x57')}];}break;case _0xdadc('0x58'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x59');break;case _0xdadc('0x5a'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x5b');break;case _0xdadc('0x5c'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x5d');break;case _0xdadc('0x5e'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x5f');break;case'deskaccounts':_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x60');break;case _0xdadc('0x61'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x62');break;case _0xdadc('0x63'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x33');break;case _0xdadc('0x64'):_0x1c37aa['childModel']='CannedAnswer';break;case _0xdadc('0x65'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x66');break;case _0xdadc('0x67'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x68');break;case'intervals':_0x1c37aa['childModel']=_0xdadc('0x69');break;case _0xdadc('0x6a'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x6b');break;case _0xdadc('0x6c'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x6d');break;case _0xdadc('0x6e'):_0x1c37aa['childModel']=_0xdadc('0x6f');break;case _0xdadc('0x70'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x71');break;case'templates':_0x1c37aa['childModel']=_0xdadc('0x72');break;case _0xdadc('0x73'):_0x1c37aa[_0xdadc('0x12')]='Trigger';break;case'trunks':_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x74');break;case'variables':_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x75');break;case _0xdadc('0x76'):_0x1c37aa[_0xdadc('0x12')]='Plugin';break;case _0xdadc('0x77'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0xd');_0x1c37aa['parentSections']=[{'name':_0xdadc('0x78'),'field':'id','foreignKey':_0xdadc('0x79')}];break;case _0xdadc('0x7a'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x7b');break;}return _0x1c37aa;}function _0x406352(_0x25ae09,_0x5417c3){var _0x4d123a=_0x25ae09[_0xdadc('0x7c')](0x0)[_0xdadc('0x7d')]()+_0x25ae09[_0xdadc('0x7e')](0x1);var _0x133e6e={'type':_0x513985[_0xdadc('0x7f')]['QueryTypes'][_0xdadc('0x80')],'raw':!![]};return new Promise(function(_0x4b6109,_0x5672f8){var _0x34d4a6=squel['select']()[_0xdadc('0x5')]('ui.'+_0x4d123a+_0xdadc('0x81'),'id')[_0xdadc('0x5')]('ui.createdAt')['from']('user_has_'+_0x25ae09+_0xdadc('0x82'),'ui')[_0xdadc('0x83')]('ui.UserId\x20=\x20?',_0x5417c3['id']);return _0x513985[_0xdadc('0x84')]['query'](_0x34d4a6[_0xdadc('0x85')](),_0x133e6e)[_0xdadc('0x8')](function(_0x3c2781){_0x5417c3[_0x4d123a+'OpenTabs']=_0x3c2781;_0x4b6109(_0x3c2781);})[_0xdadc('0x10')](function(_0x3d1d97){_0x5672f8(_0x3d1d97);});});}return _0x43fb58['define']('UserProfile',attributes,{'tableName':_0xdadc('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x287866){var _0x4a2c82=require(_0xdadc('0x87'));var _0x38bdee={'raw':_0x287866[_0xdadc('0x88')][_0xdadc('0x89')],'where':{}};var _0x17ef9c={};var _0xbb1c30={'count':0x0,'rows':[]};var _0x4593f9=_0x287866[_0xdadc('0x88')][_0xdadc('0x8a')];var _0x51269b=_0x287866['query']['mergeResources']||![];var _0x2def15=_0x12ba82(_0x4593f9,_0x51269b);if(!_0x2def15[_0xdadc('0x12')])throw new Error(_0xdadc('0x8b')+_0x4593f9+'\x27');var _0x85afae=[{'name':_0x4593f9}];if(!_[_0xdadc('0x8c')](_0x2def15['parentSections']))_0x85afae=_0x2def15['parentSections'];var _0x3387b8=[];for(var _0x55c7a3=0x0;_0x55c7a3<_0x85afae[_0xdadc('0x8d')];_0x55c7a3++){_0x3387b8[_0xdadc('0x8e')](_0x513985[_0xdadc('0x8f')][_0xdadc('0x90')]({'where':{'userProfileId':_0x287866[_0xdadc('0x91')]['id'],'name':_0x85afae[_0x55c7a3][_0xdadc('0xb')]},'raw':!![]}));}return Promise[_0xdadc('0x92')](_0x3387b8)[_0xdadc('0x8')](function(_0x4e0ab9){var _0x425e06=_[_0xdadc('0x4')](_0x4e0ab9,function(_0x38852d){return _0x38852d?_0x38852d:undefined;});var _0xba7567=_[_0xdadc('0x4')](_0x85afae,[_0xdadc('0x93'),!![]]);var _0x1e7c08=_[_0xdadc('0x8c')](_0x425e06)&&_[_0xdadc('0x8c')](_0xba7567)?null:_[_0xdadc('0x94')](_0xba7567,_0x425e06);if(!_0x1e7c08)return null;var _0x40d7dd=[];for(var _0xceac87=0x0;_0xceac87<_0x1e7c08[_0xdadc('0x8d')];_0xceac87++){var _0x558aa2=_[_0xdadc('0x90')](_0x85afae,function(_0x69e206){return _0x1e7c08[_0xceac87]?_0x69e206['name']===_0x1e7c08[_0xceac87][_0xdadc('0xb')]:null;});if(_0x558aa2){if(_0x1e7c08[_0xceac87][_0xdadc('0x93')]){_0x40d7dd[_0xdadc('0x8e')](_0x4ff842(_0x2def15[_0xdadc('0x12')],_0x1e7c08[_0xceac87]));}else{if(!_0x1e7c08[_0xceac87]['autoAssociation']){_0x40d7dd[_0xdadc('0x8e')](_0x1c480f(_0x558aa2,_0x1e7c08[_0xceac87],_0x2def15[_0xdadc('0x12')]));}else{if(_0x558aa2[_0xdadc('0x95')]){_0x40d7dd[_0xdadc('0x8e')](_0x57cc66(_0x558aa2,_0x1e7c08[_0xceac87]));}}}}}return Promise[_0xdadc('0x92')](_0x40d7dd);})[_0xdadc('0x8')](function(_0x4073c7){var _0x46e7f8=_0x4073c7;var _0x57e2f7=null;if(_0x46e7f8){_0x57e2f7=_0x46e7f8['length']===0x1?_0x46e7f8[0x0]:null;}if(!_0x57e2f7&&!_0x46e7f8)return _0xbb1c30;var _0x36b2a9=_0x513985[_0x2def15[_0xdadc('0x12')]][_0xdadc('0x96')];_0x17ef9c[_0xdadc('0x95')]=_[_0xdadc('0x97')](_0x36b2a9);_0x17ef9c[_0xdadc('0x88')]=_[_0xdadc('0x97')](_0x287866[_0xdadc('0x88')]);_0x17ef9c[_0xdadc('0x98')]=_[_0xdadc('0x99')](_0x17ef9c[_0xdadc('0x95')],_0x17ef9c[_0xdadc('0x88')]);_0x38bdee[_0xdadc('0x9a')]=_['intersection'](_0x17ef9c[_0xdadc('0x95')],_0x4a2c82[_0xdadc('0x9b')](_0x287866[_0xdadc('0x88')][_0xdadc('0x9b')]));_0x38bdee[_0xdadc('0x9a')]=_0x38bdee[_0xdadc('0x9a')][_0xdadc('0x8d')]?_0x38bdee[_0xdadc('0x9a')]:_0x17ef9c[_0xdadc('0x95')];if(!_0x287866[_0xdadc('0x88')][_0xdadc('0x9c')](_0xdadc('0x9d'))){_0x38bdee[_0xdadc('0x9e')]=_0x4a2c82[_0xdadc('0x9e')](_0x287866[_0xdadc('0x88')][_0xdadc('0x9e')]);_0x38bdee[_0xdadc('0x9f')]=_0x4a2c82['offset'](_0x287866[_0xdadc('0x88')]['offset']);}_0x38bdee['order']=_0x4a2c82['sort'](_0x287866['query'][_0xdadc('0xa0')]);_0x38bdee['where']=_0x4a2c82[_0xdadc('0x98')](_[_0xdadc('0xa1')](_0x287866['query'],_0x17ef9c[_0xdadc('0x98')]));if(_0x287866['query'][_0xdadc('0x4')]){_0x38bdee['where']=_[_0xdadc('0xa2')](_0x38bdee[_0xdadc('0x83')],{'$or':_[_0xdadc('0xa')](_0x36b2a9,function(_0x383679){if(_0x383679['type']['key']!==_0xdadc('0xa3')){var _0x1fc89f={};_0x1fc89f[_0x383679['field']]={'$like':'%'+_0x287866[_0xdadc('0x88')][_0xdadc('0x4')]+'%'};return _0x1fc89f;}})});}var _0x53dbba=[];var _0x239b6d=null;var _0x4378bc={};if(_0x57e2f7){_0x239b6d=_['find'](_0x85afae,[_0xdadc('0xb'),_0x57e2f7['name']]);if(_0x239b6d[_0xdadc('0x5')]){_0x4378bc={};if(_0x2def15[_0xdadc('0x12')]===_0xdadc('0xd')){_0x4378bc[_0x239b6d[_0xdadc('0xa4')]]=_[_0xdadc('0xa')](_0x57e2f7[_0xdadc('0x9')],'id');}else{_0x4378bc[_0x239b6d[_0xdadc('0xa4')]]=_0x57e2f7[_0xdadc('0x9')];}_0x53dbba['push'](_0x4378bc);}else{_0x38bdee[_0xdadc('0x83')]['id']=_0x57e2f7[_0xdadc('0x9')];}}else{for(var _0xe22525=0x0;_0xe22525<_0x46e7f8[_0xdadc('0x8d')];_0xe22525++){_0x239b6d=_[_0xdadc('0x90')](_0x85afae,['name',_0x46e7f8[_0xe22525]['name']]);if(_0x239b6d[_0xdadc('0x5')]){_0x4378bc={};_0x4378bc[_0x239b6d['foreignKey']]=_0x46e7f8[_0xe22525]['associatedResources'];_0x53dbba[_0xdadc('0x8e')](_0x4378bc);}else{if(!_0x38bdee[_0xdadc('0x83')]['id'])_0x38bdee[_0xdadc('0x83')]['id']=[];_0x46e7f8[_0xe22525][_0xdadc('0x9')]['forEach'](function(_0x5c4a0c){_0x38bdee['where']['id'][_0xdadc('0x8e')](_0x5c4a0c);});}}}if(!_[_0xdadc('0x8c')](_0x53dbba)){_0x38bdee['where']=_[_0xdadc('0xa2')](_0x38bdee[_0xdadc('0x83')],{'$and':{'$or':_0x53dbba}});}_0x38bdee=_[_0xdadc('0xa2')]({},_0x38bdee,_0x287866[_0xdadc('0xa5')]);if(_0x57e2f7&&!_0x57e2f7[_0xdadc('0xa6')]&&_0x2def15['childModel']===_0xdadc('0xd')){if(_0x287866['query'][_0xdadc('0xa7')]){_0x38bdee[_0xdadc('0xa8')]=[{'all':!![]}];}return _0x513985[_0x2def15['childModel']]['findAll'](_0x38bdee)[_0xdadc('0x8')](function(_0x4b5766){var _0xcb2191=[];_0x4b5766[_0xdadc('0xa9')](function(_0x884473){var _0x2e1e9e;switch(_0x884473['reportType']){case _0xdadc('0xaa'):_0x2e1e9e=_['find'](_0x57e2f7[_0xdadc('0x9')],function(_0x4056a8){return _0x4056a8['id']===_0x884473[_0xdadc('0x79')]&&_0x4056a8[_0xdadc('0xf')]==='DefaultReports';});break;case _0xdadc('0xab'):_0x2e1e9e=_[_0xdadc('0x90')](_0x57e2f7['associatedResources'],function(_0x38624f){return _0x38624f['id']===_0x884473[_0xdadc('0x79')]&&_0x38624f[_0xdadc('0xf')]===_0xdadc('0xac');});break;}if(_0x2e1e9e)_0xcb2191[_0xdadc('0x8e')](_0x884473);});_0xbb1c30[_0xdadc('0xad')]=_0xcb2191[_0xdadc('0x8d')];_0xbb1c30[_0xdadc('0xae')]=_0xcb2191;return _0xbb1c30;});}else{if(!_[_0xdadc('0x8c')](_0x287866['query'][_0xdadc('0xaf')])){_0x38bdee[_0xdadc('0x83')]['id']=_0x38bdee['where']['id']?_['intersection'](_0x38bdee[_0xdadc('0x83')]['id'],_0x287866[_0xdadc('0x88')][_0xdadc('0xaf')]):_0x287866[_0xdadc('0x88')]['ids'];if(_0x287866[_0xdadc('0x88')][_0xdadc('0xb0')]){_0x38bdee['order']=_0x287866[_0xdadc('0x88')]['customSorting'];}}if(_0x287866[_0xdadc('0x88')][_0xdadc('0xb1')]){_0x38bdee['where']=_[_0xdadc('0xa2')](_0x38bdee[_0xdadc('0x83')],{'$and':_0x287866['query']['extraQueryConditions']});}return _0x513985[_0x2def15[_0xdadc('0x12')]]['count']({'where':_0x38bdee[_0xdadc('0x83')]})[_0xdadc('0x8')](function(_0x2c1098){_0xbb1c30['count']=_0x2c1098;if(_0x287866['query'][_0xdadc('0xa7')]){if(_0x2def15[_0xdadc('0x12')]===_0xdadc('0x1a')){_0x38bdee[_0xdadc('0xa8')]=[{'model':_0x513985['Tag'],'as':_0xdadc('0xb2'),'attributes':['id',_0xdadc('0xb'),_0xdadc('0xb3')],'required':_0x287866[_0xdadc('0x88')][_0xdadc('0xb4')]?!![]:![]},{'model':_0x513985[_0xdadc('0x71')],'as':_0xdadc('0xb5'),'attributes':['id',_0xdadc('0xb'),'color'],'through':_0x287866[_0xdadc('0x88')]['tag']?{'attributes':[],'where':{'TagId':_0x287866[_0xdadc('0x88')]['tag']||undefined}}:{},'required':_0x287866[_0xdadc('0x88')][_0xdadc('0xb4')]?!![]:![]}];}else{_0x38bdee['include']=[{'all':!![]}];}}return _0x513985[_0x2def15[_0xdadc('0x12')]][_0xdadc('0x7')](_0x38bdee);})[_0xdadc('0x8')](function(_0x4e170f){_0xbb1c30['rows']=_0x4e170f;if(_0x4593f9===_0xdadc('0x30')&&_0x287866[_0xdadc('0x88')]['openTabs']==='true'){var _0x345ea7=[];for(var _0x2aee43=0x0;_0x2aee43<_0xbb1c30[_0xdadc('0xae')]['length'];_0x2aee43++){_0x345ea7[_0xdadc('0x8e')](_0x406352(_0xdadc('0xb6'),_0xbb1c30[_0xdadc('0xae')][_0x2aee43][_0xdadc('0xb7')]));_0x345ea7[_0xdadc('0x8e')](_0x406352(_0xdadc('0xb8'),_0xbb1c30[_0xdadc('0xae')][_0x2aee43][_0xdadc('0xb7')]));_0x345ea7['push'](_0x406352(_0xdadc('0xb9'),_0xbb1c30['rows'][_0x2aee43][_0xdadc('0xb7')]));_0x345ea7[_0xdadc('0x8e')](_0x406352(_0xdadc('0xba'),_0xbb1c30[_0xdadc('0xae')][_0x2aee43][_0xdadc('0xb7')]));_0x345ea7['push'](_0x406352(_0xdadc('0xbb'),_0xbb1c30[_0xdadc('0xae')][_0x2aee43][_0xdadc('0xb7')]));_0x345ea7[_0xdadc('0x8e')](_0x406352('whatsapp',_0xbb1c30['rows'][_0x2aee43][_0xdadc('0xb7')]));}return Promise[_0xdadc('0x92')](_0x345ea7)[_0xdadc('0x8')](function(){return _0xbb1c30;});}return _0xbb1c30;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 81b3d32..c5cee37 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 _0xbd0a=['http','redis','localhost','socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x265d25,_0xb3f665){var _0x45a789=function(_0x4220bf){while(--_0x4220bf){_0x265d25['push'](_0x265d25['shift']());}};_0x45a789(++_0xb3f665);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x2bd50d,_0xd96baf){_0x2bd50d=_0x2bd50d-0x0;var _0x1d5957=_0xbd0a[_0x2bd50d];return _0x1d5957;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var moment=require(_0xabd0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabd0('0x2'))['db'];var utils=require(_0xabd0('0x3'));var logger=require(_0xabd0('0x4'))(_0xabd0('0x5'));var config=require(_0xabd0('0x6'));var jayson=require(_0xabd0('0x7'));var client=jayson[_0xabd0('0x8')][_0xabd0('0x9')]({'port':0x232a});config[_0xabd0('0xa')]=_['defaults'](config[_0xabd0('0xa')],{'host':_0xabd0('0xb'),'port':0x18eb});var socket=require(_0xabd0('0xc'))(new Redis(config['redis']));require(_0xabd0('0xd'))['register'](socket);function respondWithRpcPromise(_0x151048,_0x23d4e4,_0x2c31c9){return new BPromise(function(_0x3dc0ab,_0x50fc2d){return client[_0xabd0('0xe')](_0x151048,_0x2c31c9)['then'](function(_0x1b78e2){logger[_0xabd0('0xf')](_0xabd0('0x10'),_0x23d4e4,_0xabd0('0x11'));logger[_0xabd0('0x12')](_0xabd0('0x13'),_0x23d4e4,'request\x20sent',JSON[_0xabd0('0x14')](_0x1b78e2));if(_0x1b78e2['error']){if(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x16')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x23d4e4,_0x1b78e2['error']['message']);return _0x50fc2d(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);return _0x3dc0ab(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}else{logger[_0xabd0('0xf')]('UserProfile,\x20%s,\x20%s',_0x23d4e4,_0xabd0('0x11'));_0x3dc0ab(_0x1b78e2['result']['message']);}})[_0xabd0('0x18')](function(_0x391988){logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x391988);_0x50fc2d(_0x391988);});});} \ No newline at end of file +var _0x20de=['UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./userProfile.socket','then','info'];(function(_0x57bf95,_0x131d28){var _0x4580a2=function(_0x100c01){while(--_0x100c01){_0x57bf95['push'](_0x57bf95['shift']());}};_0x4580a2(++_0x131d28);}(_0x20de,0x134));var _0xe20d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x20de[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xe20d('0x0'));var util=require('util');var moment=require(_0xe20d('0x1'));var BPromise=require(_0xe20d('0x2'));var rs=require(_0xe20d('0x3'));var fs=require('fs');var Redis=require(_0xe20d('0x4'));var db=require(_0xe20d('0x5'))['db'];var utils=require(_0xe20d('0x6'));var logger=require(_0xe20d('0x7'))(_0xe20d('0x8'));var config=require(_0xe20d('0x9'));var jayson=require(_0xe20d('0xa'));var client=jayson[_0xe20d('0xb')]['http']({'port':0x232a});config[_0xe20d('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe20d('0xd'))(new Redis(config[_0xe20d('0xc')]));require(_0xe20d('0xe'))['register'](socket);function respondWithRpcPromise(_0x288d35,_0x2df52b,_0x5b40ad){return new BPromise(function(_0x339764,_0x337c85){return client['request'](_0x288d35,_0x5b40ad)[_0xe20d('0xf')](function(_0x21763b){logger[_0xe20d('0x10')](_0xe20d('0x11'),_0x2df52b,'request\x20sent');logger['debug'](_0xe20d('0x12'),_0x2df52b,_0xe20d('0x13'),JSON[_0xe20d('0x14')](_0x21763b));if(_0x21763b[_0xe20d('0x15')]){if(_0x21763b[_0xe20d('0x15')][_0xe20d('0x16')]===0x1f4){logger[_0xe20d('0x15')](_0xe20d('0x11'),_0x2df52b,_0x21763b[_0xe20d('0x15')]['message']);return _0x337c85(_0x21763b[_0xe20d('0x15')]['message']);}logger[_0xe20d('0x15')](_0xe20d('0x11'),_0x2df52b,_0x21763b[_0xe20d('0x15')]['message']);return _0x339764(_0x21763b[_0xe20d('0x15')]['message']);}else{logger[_0xe20d('0x10')](_0xe20d('0x11'),_0x2df52b,_0xe20d('0x13'));_0x339764(_0x21763b['result'][_0xe20d('0x17')]);}})[_0xe20d('0x18')](function(_0xd96fa7){logger[_0xe20d('0x15')]('UserProfile,\x20%s,\x20%s',_0x2df52b,_0xd96fa7);_0x337c85(_0xd96fa7);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index beb5e6a..e3f3c68 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 _0x16c6=['update','emit','register','length','userProfile:','./userProfile.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16c6,0x186));var _0x616c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x16c6[_0x4a9fb1];return _0x348672;};'use strict';var UserProfileEvents=require(_0x616c('0x0'));var events=[_0x616c('0x1'),'remove',_0x616c('0x2')];function createListener(_0x2a42c8,_0x19fbf2){return function(_0x1b6638){_0x19fbf2[_0x616c('0x3')](_0x2a42c8,_0x1b6638);};}function removeListener(_0xe644e8,_0x1e0e05){return function(){UserProfileEvents['removeListener'](_0xe644e8,_0x1e0e05);};}exports[_0x616c('0x4')]=function(_0x10c19c){for(var _0x4335e5=0x0,_0x5bb72e=events[_0x616c('0x5')];_0x4335e5<_0x5bb72e;_0x4335e5++){var _0x567be5=events[_0x4335e5];var _0x45d55b=createListener(_0x616c('0x6')+_0x567be5,_0x10c19c);UserProfileEvents['on'](_0x567be5,_0x45d55b);}}; \ No newline at end of file +var _0x1889=['save','update','emit','removeListener','userProfile:'];(function(_0x5be892,_0x68238a){var _0x53fc35=function(_0x8626ac){while(--_0x8626ac){_0x5be892['push'](_0x5be892['shift']());}};_0x53fc35(++_0x68238a);}(_0x1889,0x9b));var _0x9188=function(_0x19e8f0,_0x396f49){_0x19e8f0=_0x19e8f0-0x0;var _0x49c691=_0x1889[_0x19e8f0];return _0x49c691;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x9188('0x0'),'remove',_0x9188('0x1')];function createListener(_0x137190,_0x34ca1b){return function(_0x13d4be){_0x34ca1b[_0x9188('0x2')](_0x137190,_0x13d4be);};}function removeListener(_0x1ddcbc,_0x2ae9cd){return function(){UserProfileEvents[_0x9188('0x3')](_0x1ddcbc,_0x2ae9cd);};}exports['register']=function(_0x384e8e){for(var _0x580844=0x0,_0x8a6ddc=events['length'];_0x580844<_0x8a6ddc;_0x580844++){var _0x45f0a6=events[_0x580844];var _0x4e2607=createListener(_0x9188('0x4')+_0x45f0a6,_0x384e8e);UserProfileEvents['on'](_0x45f0a6,_0x4e2607);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index fe9418c..0f67859 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 _0x8b3b=['show','post','create','put','update','destroy','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x8b3b,0xfe));var _0xb8b3=function(_0x59ae80,_0x56b205){_0x59ae80=_0x59ae80-0x0;var _0x473bf9=_0x8b3b[_0x59ae80];return _0x473bf9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb8b3('0x0'));var timeout=require(_0xb8b3('0x1'));var express=require(_0xb8b3('0x2'));var router=express['Router']();var fs_extra=require(_0xb8b3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb8b3('0x4'));var config=require(_0xb8b3('0x5'));var controller=require(_0xb8b3('0x6'));router[_0xb8b3('0x7')]('/',auth['isAuthenticated'](),controller[_0xb8b3('0x8')]);router[_0xb8b3('0x7')]('/describe',auth[_0xb8b3('0x9')](),controller[_0xb8b3('0xa')]);router[_0xb8b3('0x7')](_0xb8b3('0xb'),auth['isAuthenticated'](),controller[_0xb8b3('0xc')]);router[_0xb8b3('0xd')]('/',auth['isAuthenticated'](),controller[_0xb8b3('0xe')]);router[_0xb8b3('0xf')](_0xb8b3('0xb'),auth['isAuthenticated'](),controller[_0xb8b3('0x10')]);router['delete']('/:id',auth[_0xb8b3('0x9')](),controller[_0xb8b3('0x11')]);module[_0xb8b3('0x12')]=router; \ No newline at end of file +var _0x5ff4=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./userProfileResource.controller','isAuthenticated','index','/describe','/:id','put','update'];(function(_0x17edf8,_0x3bef12){var _0x1bedb5=function(_0x50ff17){while(--_0x50ff17){_0x17edf8['push'](_0x17edf8['shift']());}};_0x1bedb5(++_0x3bef12);}(_0x5ff4,0x172));var _0x45ff=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x5ff4[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0x45ff('0x0'));var util=require(_0x45ff('0x1'));var path=require(_0x45ff('0x2'));var timeout=require(_0x45ff('0x3'));var express=require('express');var router=express[_0x45ff('0x4')]();var fs_extra=require(_0x45ff('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x45ff('0x6'));var controller=require(_0x45ff('0x7'));router['get']('/',auth[_0x45ff('0x8')](),controller[_0x45ff('0x9')]);router['get'](_0x45ff('0xa'),auth[_0x45ff('0x8')](),controller['describe']);router['get'](_0x45ff('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x45ff('0xc')]('/:id',auth[_0x45ff('0x8')](),controller[_0x45ff('0xd')]);router[_0x45ff('0xe')]('/:id',auth[_0x45ff('0x8')](),controller['destroy']);module[_0x45ff('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 092d2f0..fc0d93a 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 _0xdcfa=['STRING','sequelize'];(function(_0x1c5960,_0x456efb){var _0x5c9c93=function(_0xf820b1){while(--_0xf820b1){_0x1c5960['push'](_0x1c5960['shift']());}};_0x5c9c93(++_0x456efb);}(_0xdcfa,0xe7));var _0xadcf=function(_0x4a09a8,_0x4ed12d){_0x4a09a8=_0x4a09a8-0x0;var _0x7d30a9=_0xdcfa[_0x4a09a8];return _0x7d30a9;};'use strict';var Sequelize=require(_0xadcf('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xadcf('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x21cb=['INTEGER','exports','STRING'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x21cb,0xf7));var _0xb21c=function(_0x2fd674,_0x538865){_0x2fd674=_0x2fd674-0x0;var _0x47e641=_0x21cb[_0x2fd674];return _0x47e641;};'use strict';var Sequelize=require('sequelize');module[_0xb21c('0x0')]={'name':{'type':Sequelize[_0xb21c('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb21c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb21c('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 adfa20c..3662147 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 _0x7880=['destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then'];(function(_0x56aa66,_0x1ddf52){var _0xeba9ff=function(_0x5467b5){while(--_0x5467b5){_0x56aa66['push'](_0x56aa66['shift']());}};_0xeba9ff(++_0x1ddf52);}(_0x7880,0x1f4));var _0x0788=function(_0x77b868,_0x45ea4b){_0x77b868=_0x77b868-0x0;var _0x1f54ea=_0x7880[_0x77b868];return _0x1f54ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['UserProfileResource'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['create']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')](_0x4c6366['body'],{})[_0x0788('0x26')](respondWithResult(_0x39c3cc,0xc9))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x4563cd,_0x2395ad){if(_0x4563cd['body']['id']){delete _0x4563cd['body']['id'];}return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x4563cd['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x2395ad,null))['then'](saveUpdates(_0x4563cd[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x2395ad,null))[_0x0788('0x44')](handleError(_0x2395ad,null));};exports[_0x0788('0x27')]=function(_0x3c757a,_0x379928){return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x3c757a['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x379928,null))[_0x0788('0x26')](removeEntity(_0x379928,null))[_0x0788('0x44')](handleError(_0x379928,null));};exports['describe']=function(_0x1693d0,_0x5d32ae){return db['UserProfileResource'][_0x0788('0x4c')]()[_0x0788('0x26')](respondWithResult(_0x5d32ae,null))[_0x0788('0x44')](handleError(_0x5d32ae,null));}; \ No newline at end of file +var _0x9582=['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','UserProfileResource','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','describe','eml-format','rimraf','zip-dir'];(function(_0x8ab8b1,_0xaa46df){var _0x420c6f=function(_0x410c2a){while(--_0x410c2a){_0x8ab8b1['push'](_0x8ab8b1['shift']());}};_0x420c6f(++_0xaa46df);}(_0x9582,0x95));var _0x2958=function(_0x747068,_0x338623){_0x747068=_0x747068-0x0;var _0x26d792=_0x9582[_0x747068];return _0x26d792;};'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));};exports[_0x2958('0x4b')]=function(_0x1db8b1,_0x534677){return db['UserProfileResource'][_0x2958('0x4b')]()[_0x2958('0x25')](respondWithResult(_0x534677,null))[_0x2958('0x44')](handleError(_0x534677,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 39b074f..ccb9f2e 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 _0x4fa8=['resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','user_profile_has_resources'];(function(_0x5b1f36,_0x21d1bb){var _0x33a5fc=function(_0x3fffd3){while(--_0x3fffd3){_0x5b1f36['push'](_0x5b1f36['shift']());}};_0x33a5fc(++_0x21d1bb);}(_0x4fa8,0x1f0));var _0x84fa=function(_0x470926,_0x52239a){_0x470926=_0x470926-0x0;var _0x1a6cd0=_0x4fa8[_0x470926];return _0x1a6cd0;};'use strict';var _=require(_0x84fa('0x0'));var util=require('util');var logger=require(_0x84fa('0x1'))(_0x84fa('0x2'));var moment=require(_0x84fa('0x3'));var BPromise=require(_0x84fa('0x4'));var rp=require(_0x84fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84fa('0x6'));var config=require(_0x84fa('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x84fa('0x8')]=function(_0x2605de,_0x5b4a78){return _0x2605de[_0x84fa('0x9')]('UserProfileResource',attributes,{'tableName':_0x84fa('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x84fa('0xb'),_0x84fa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd057=['moment','bluebird','request-promise','path','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api'];(function(_0x50844c,_0x543358){var _0x298920=function(_0x948e81){while(--_0x948e81){_0x50844c['push'](_0x50844c['shift']());}};_0x298920(++_0x543358);}(_0xd057,0x19c));var _0x7d05=function(_0x913fe8,_0x3ae0fd){_0x913fe8=_0x913fe8-0x0;var _0x1426c0=_0xd057[_0x913fe8];return _0x1426c0;};'use strict';var _=require(_0x7d05('0x0'));var util=require(_0x7d05('0x1'));var logger=require(_0x7d05('0x2'))(_0x7d05('0x3'));var moment=require(_0x7d05('0x4'));var BPromise=require(_0x7d05('0x5'));var rp=require(_0x7d05('0x6'));var fs=require('fs');var path=require(_0x7d05('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7d05('0x8'));module[_0x7d05('0x9')]=function(_0x43ee13,_0x30236f){return _0x43ee13[_0x7d05('0xa')](_0x7d05('0xb'),attributes,{'tableName':_0x7d05('0xc'),'paranoid':![],'indexes':[{'name':_0x7d05('0xd'),'fields':[_0x7d05('0xe'),_0x7d05('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b0953f3..11202dc 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 _0x5de6=['http','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x215604,_0x578cf3){var _0x133626=function(_0x4de195){while(--_0x4de195){_0x215604['push'](_0x215604['shift']());}};_0x133626(++_0x578cf3);}(_0x5de6,0xd3));var _0x65de=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5de6[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x65de('0x0'));var rs=require(_0x65de('0x1'));var fs=require('fs');var Redis=require(_0x65de('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x65de('0x3'));var logger=require(_0x65de('0x4'))(_0x65de('0x5'));var config=require(_0x65de('0x6'));var jayson=require(_0x65de('0x7'));var client=jayson[_0x65de('0x8')][_0x65de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b8ef5,_0x2eb099,_0x8866ea){return new BPromise(function(_0xf6c199,_0x167a7b){return client['request'](_0x4b8ef5,_0x8866ea)[_0x65de('0xa')](function(_0x18c73c){logger[_0x65de('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x2eb099,_0x65de('0xc'));logger[_0x65de('0xd')](_0x65de('0xe'),_0x2eb099,'request\x20sent',JSON[_0x65de('0xf')](_0x18c73c));if(_0x18c73c[_0x65de('0x10')]){if(_0x18c73c['error'][_0x65de('0x11')]===0x1f4){logger['error'](_0x65de('0x12'),_0x2eb099,_0x18c73c[_0x65de('0x10')][_0x65de('0x13')]);return _0x167a7b(_0x18c73c[_0x65de('0x10')][_0x65de('0x13')]);}logger[_0x65de('0x10')](_0x65de('0x12'),_0x2eb099,_0x18c73c[_0x65de('0x10')][_0x65de('0x13')]);return _0xf6c199(_0x18c73c[_0x65de('0x10')]['message']);}else{logger[_0x65de('0xb')](_0x65de('0x12'),_0x2eb099,_0x65de('0xc'));_0xf6c199(_0x18c73c[_0x65de('0x14')][_0x65de('0x13')]);}})[_0x65de('0x15')](function(_0x21a0d8){logger[_0x65de('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x2eb099,_0x21a0d8);_0x167a7b(_0x21a0d8);});});} \ No newline at end of file +var _0x4697=['catch','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x4401fa,_0x42210b){var _0x4b1ac6=function(_0xec09ed){while(--_0xec09ed){_0x4401fa['push'](_0x4401fa['shift']());}};_0x4b1ac6(++_0x42210b);}(_0x4697,0x155));var _0x7469=function(_0x21a231,_0x99bca7){_0x21a231=_0x21a231-0x0;var _0x2efe47=_0x4697[_0x21a231];return _0x2efe47;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7469('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7469('0x1'));var db=require(_0x7469('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x7469('0x3'))(_0x7469('0x4'));var config=require(_0x7469('0x5'));var jayson=require(_0x7469('0x6'));var client=jayson[_0x7469('0x7')][_0x7469('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x275f63,_0x59a664,_0x560da2){return new BPromise(function(_0x364045,_0x2b7e3b){return client[_0x7469('0x9')](_0x275f63,_0x560da2)[_0x7469('0xa')](function(_0x5ed1a3){logger[_0x7469('0xb')](_0x7469('0xc'),_0x59a664,_0x7469('0xd'));logger[_0x7469('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x59a664,_0x7469('0xd'),JSON[_0x7469('0xf')](_0x5ed1a3));if(_0x5ed1a3[_0x7469('0x10')]){if(_0x5ed1a3[_0x7469('0x10')]['code']===0x1f4){logger[_0x7469('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x59a664,_0x5ed1a3[_0x7469('0x10')][_0x7469('0x11')]);return _0x2b7e3b(_0x5ed1a3[_0x7469('0x10')][_0x7469('0x11')]);}logger[_0x7469('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x59a664,_0x5ed1a3[_0x7469('0x10')][_0x7469('0x11')]);return _0x364045(_0x5ed1a3['error'][_0x7469('0x11')]);}else{logger[_0x7469('0xb')](_0x7469('0xc'),_0x59a664,_0x7469('0xd'));_0x364045(_0x5ed1a3[_0x7469('0x12')][_0x7469('0x11')]);}})[_0x7469('0x13')](function(_0x337c5c){logger[_0x7469('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x59a664,_0x337c5c);_0x2b7e3b(_0x337c5c);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9876eb9..bce439a 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 _0xa186=['show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x2e1be4,_0x8a5804){var _0x42a29d=function(_0x4f169f){while(--_0x4f169f){_0x2e1be4['push'](_0x2e1be4['shift']());}};_0x42a29d(++_0x8a5804);}(_0xa186,0x7e));var _0x6a18=function(_0x480a11,_0x2c6af2){_0x480a11=_0x480a11-0x0;var _0x438d83=_0xa186[_0x480a11];return _0x438d83;};'use strict';var multer=require(_0x6a18('0x0'));var util=require(_0x6a18('0x1'));var path=require(_0x6a18('0x2'));var timeout=require(_0x6a18('0x3'));var express=require(_0x6a18('0x4'));var router=express['Router']();var fs_extra=require(_0x6a18('0x5'));var auth=require(_0x6a18('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a18('0x7'));var controller=require(_0x6a18('0x8'));router['get']('/',auth[_0x6a18('0x9')](),controller[_0x6a18('0xa')]);router[_0x6a18('0xb')](_0x6a18('0xc'),auth[_0x6a18('0x9')](),controller['describe']);router['get'](_0x6a18('0xd'),auth['isAuthenticated'](),controller[_0x6a18('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6a18('0xf')]);router[_0x6a18('0x10')](_0x6a18('0xd'),auth[_0x6a18('0x9')](),controller[_0x6a18('0x11')]);router[_0x6a18('0x12')](_0x6a18('0xd'),auth['isAuthenticated'](),controller[_0x6a18('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7d04=['path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','update','delete','exports','multer','util'];(function(_0x4e0e9b,_0x45999e){var _0x4790b2=function(_0x3e2419){while(--_0x3e2419){_0x4e0e9b['push'](_0x4e0e9b['shift']());}};_0x4790b2(++_0x45999e);}(_0x7d04,0x18a));var _0x47d0=function(_0x34a181,_0x27163b){_0x34a181=_0x34a181-0x0;var _0x44820f=_0x7d04[_0x34a181];return _0x44820f;};'use strict';var multer=require(_0x47d0('0x0'));var util=require(_0x47d0('0x1'));var path=require(_0x47d0('0x2'));var timeout=require(_0x47d0('0x3'));var express=require('express');var router=express[_0x47d0('0x4')]();var fs_extra=require(_0x47d0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x47d0('0x6'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x47d0('0x7')](),controller[_0x47d0('0x8')]);router[_0x47d0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x47d0('0xa')]);router['get'](_0x47d0('0xb'),auth['isAuthenticated'](),controller[_0x47d0('0xc')]);router[_0x47d0('0xd')]('/',auth['isAuthenticated'](),controller[_0x47d0('0xe')]);router['put'](_0x47d0('0xb'),auth[_0x47d0('0x7')](),controller[_0x47d0('0xf')]);router[_0x47d0('0x10')](_0x47d0('0xb'),auth[_0x47d0('0x7')](),controller['destroy']);module[_0x47d0('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a7d876e..5a11a79 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 _0x7072=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split'];(function(_0x42bd12,_0x173a7f){var _0x4ae45c=function(_0xd6abb6){while(--_0xd6abb6){_0x42bd12['push'](_0x42bd12['shift']());}};_0x4ae45c(++_0x173a7f);}(_0x7072,0x138));var _0x2707=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x7072[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'name':{'type':Sequelize[_0x2707('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x2707('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x2707('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x2707('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xfdfa7a){this['setDataValue'](_0x2707('0x4'),_0xfdfa7a?_0xfdfa7a[_0x2707('0x5')](''):[]);},'get':function(){return this[_0x2707('0x6')](_0x2707('0x4'))?this[_0x2707('0x6')](_0x2707('0x4'))[_0x2707('0x7')](''):[];}}}; \ No newline at end of file +var _0xc900=['join','getDataValue','split','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xc900,0xb3));var _0x0c90=function(_0x53db6a,_0xc3fece){_0x53db6a=_0x53db6a-0x0;var _0x383bce=_0xc900[_0x53db6a];return _0x383bce;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0c90('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x0c90('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0c90('0x1')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0c90('0x0')],'set':function(_0x492f22){this[_0x0c90('0x3')](_0x0c90('0x4'),_0x492f22?_0x492f22[_0x0c90('0x5')](''):[]);},'get':function(){return this[_0x0c90('0x6')](_0x0c90('0x4'))?this[_0x0c90('0x6')]('crudPermissions')[_0x0c90('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 8cc858a..674aace 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 _0xee15=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','error','stack','name','index','UserProfileSection','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','destroy','describe','eml-format','request-promise','moment','mustache','util','path'];(function(_0x17229e,_0x13aa23){var _0x4af8e6=function(_0x23e482){while(--_0x23e482){_0x17229e['push'](_0x17229e['shift']());}};_0x4af8e6(++_0x13aa23);}(_0xee15,0x126));var _0x5ee1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xee15[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x5ee1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ee1('0x1'));var moment=require(_0x5ee1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5ee1('0x3'));var util=require(_0x5ee1('0x4'));var path=require(_0x5ee1('0x5'));var sox=require(_0x5ee1('0x6'));var csv=require(_0x5ee1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ee1('0x8'));var _=require(_0x5ee1('0x9'));var squel=require(_0x5ee1('0xa'));var crypto=require(_0x5ee1('0xb'));var jsforce=require(_0x5ee1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5ee1('0x7'));var querystring=require(_0x5ee1('0xd'));var Papa=require(_0x5ee1('0xe'));var Redis=require(_0x5ee1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5ee1('0x10'));var as=require(_0x5ee1('0x11'));var hardwareService=require(_0x5ee1('0x12'));var logger=require(_0x5ee1('0x13'))(_0x5ee1('0x14'));var utils=require(_0x5ee1('0x15'));var config=require(_0x5ee1('0x16'));var licenseUtil=require(_0x5ee1('0x17'));var db=require(_0x5ee1('0x18'))['db'];function respondWithStatusCode(_0x6987c1,_0x4a8da6){_0x4a8da6=_0x4a8da6||0xcc;return function(_0x34162c){if(_0x34162c){return _0x6987c1[_0x5ee1('0x19')](_0x4a8da6);}return _0x6987c1['status'](_0x4a8da6)[_0x5ee1('0x1a')]();};}function respondWithResult(_0x2f69b7,_0x5d8ca6){_0x5d8ca6=_0x5d8ca6||0xc8;return function(_0x1defb9){if(_0x1defb9){return _0x2f69b7['status'](_0x5d8ca6)[_0x5ee1('0x1b')](_0x1defb9);}};}function respondWithFilteredResult(_0x58826c,_0x36ac08){return function(_0x5d9ce0){if(_0x5d9ce0){var _0x4af983=typeof _0x36ac08[_0x5ee1('0x1c')]===_0x5ee1('0x1d')&&typeof _0x36ac08[_0x5ee1('0x1e')]===_0x5ee1('0x1d');var _0x21070e=_0x5d9ce0[_0x5ee1('0x1f')];var _0x423c09=_0x4af983?0x0:_0x36ac08[_0x5ee1('0x1c')];var _0x2fc370=_0x4af983?_0x5d9ce0['count']:_0x36ac08[_0x5ee1('0x1c')]+_0x36ac08['limit'];var _0x3bfd75;if(_0x2fc370>=_0x21070e){_0x2fc370=_0x21070e;_0x3bfd75=0xc8;}else{_0x3bfd75=0xce;}_0x58826c[_0x5ee1('0x20')](_0x3bfd75);return _0x58826c['set']('Content-Range',_0x423c09+'-'+_0x2fc370+'/'+_0x21070e)[_0x5ee1('0x1b')](_0x5d9ce0);}return null;};}function patchUpdates(_0x5222f6){return function(_0x337ab8){try{jsonpatch[_0x5ee1('0x21')](_0x337ab8,_0x5222f6,!![]);}catch(_0x537dfa){return BPromise[_0x5ee1('0x22')](_0x537dfa);}return _0x337ab8[_0x5ee1('0x23')]();};}function saveUpdates(_0x5cca6f,_0xdbd96c){return function(_0x382272){if(_0x382272){return _0x382272[_0x5ee1('0x24')](_0x5cca6f)['then'](function(_0x58e515){return _0x58e515;});}return null;};}function removeEntity(_0x572e74,_0x211660){return function(_0x4637e8){if(_0x4637e8){return _0x4637e8['destroy']()['then'](function(){_0x572e74[_0x5ee1('0x20')](0xcc)[_0x5ee1('0x1a')]();});}};}function handleEntityNotFound(_0x150f79,_0x1e6026){return function(_0x4fb84d){if(!_0x4fb84d){_0x150f79[_0x5ee1('0x19')](0x194);}return _0x4fb84d;};}function handleError(_0x31eaf9,_0x2d0012){_0x2d0012=_0x2d0012||0x1f4;return function(_0x2dcd62){logger[_0x5ee1('0x25')](_0x2dcd62[_0x5ee1('0x26')]);if(_0x2dcd62[_0x5ee1('0x27')]){delete _0x2dcd62['name'];}_0x31eaf9['status'](_0x2d0012)['send'](_0x2dcd62);};}exports[_0x5ee1('0x28')]=function(_0x50747c,_0x375c67){var _0x3cc9fb={},_0x2b4ea5={},_0xb96e0a={'count':0x0,'rows':[]};var _0x449346=_['map'](db[_0x5ee1('0x29')]['rawAttributes'],function(_0x3355a0){return{'name':_0x3355a0['fieldName'],'type':_0x3355a0[_0x5ee1('0x2a')][_0x5ee1('0x2b')]};});_0x2b4ea5['model']=_[_0x5ee1('0x2c')](_0x449346,_0x5ee1('0x27'));_0x2b4ea5[_0x5ee1('0x2d')]=_[_0x5ee1('0x2e')](_0x50747c[_0x5ee1('0x2d')]);_0x2b4ea5[_0x5ee1('0x2f')]=_[_0x5ee1('0x30')](_0x2b4ea5[_0x5ee1('0x31')],_0x2b4ea5[_0x5ee1('0x2d')]);_0x3cc9fb['attributes']=_[_0x5ee1('0x30')](_0x2b4ea5[_0x5ee1('0x31')],qs[_0x5ee1('0x32')](_0x50747c['query'][_0x5ee1('0x32')]));_0x3cc9fb['attributes']=_0x3cc9fb[_0x5ee1('0x33')][_0x5ee1('0x34')]?_0x3cc9fb[_0x5ee1('0x33')]:_0x2b4ea5[_0x5ee1('0x31')];if(!_0x50747c['query']['hasOwnProperty'](_0x5ee1('0x35'))){_0x3cc9fb[_0x5ee1('0x1e')]=qs[_0x5ee1('0x1e')](_0x50747c[_0x5ee1('0x2d')][_0x5ee1('0x1e')]);_0x3cc9fb['offset']=qs[_0x5ee1('0x1c')](_0x50747c['query'][_0x5ee1('0x1c')]);}_0x3cc9fb[_0x5ee1('0x36')]=qs[_0x5ee1('0x37')](_0x50747c[_0x5ee1('0x2d')][_0x5ee1('0x37')]);_0x3cc9fb[_0x5ee1('0x38')]=qs[_0x5ee1('0x2f')](_[_0x5ee1('0x39')](_0x50747c[_0x5ee1('0x2d')],_0x2b4ea5[_0x5ee1('0x2f')]),_0x449346);if(_0x50747c[_0x5ee1('0x2d')][_0x5ee1('0x3a')]){_0x3cc9fb[_0x5ee1('0x38')]=_['merge'](_0x3cc9fb[_0x5ee1('0x38')],{'$or':_[_0x5ee1('0x2c')](_0x449346,function(_0x2fb9e8){if(_0x2fb9e8['type']!==_0x5ee1('0x3b')){var _0x4f6e5b={};_0x4f6e5b[_0x2fb9e8[_0x5ee1('0x27')]]={'$like':'%'+_0x50747c[_0x5ee1('0x2d')]['filter']+'%'};return _0x4f6e5b;}})});}_0x3cc9fb=_[_0x5ee1('0x3c')]({},_0x3cc9fb,_0x50747c[_0x5ee1('0x3d')]);var _0x1f54ca={'where':_0x3cc9fb['where']};return db['UserProfileSection'][_0x5ee1('0x1f')](_0x1f54ca)[_0x5ee1('0x3e')](function(_0x40ee52){_0xb96e0a[_0x5ee1('0x1f')]=_0x40ee52;if(_0x50747c[_0x5ee1('0x2d')][_0x5ee1('0x3f')]){_0x3cc9fb[_0x5ee1('0x40')]=[{'all':!![]}];}return db[_0x5ee1('0x29')][_0x5ee1('0x41')](_0x3cc9fb);})[_0x5ee1('0x3e')](function(_0x55a932){_0xb96e0a['rows']=_0x55a932;return _0xb96e0a;})[_0x5ee1('0x3e')](respondWithFilteredResult(_0x375c67,_0x3cc9fb))[_0x5ee1('0x42')](handleError(_0x375c67,null));};exports[_0x5ee1('0x43')]=function(_0x41af64,_0x336bf4){var _0x5a182f={'raw':![],'where':{'id':_0x41af64[_0x5ee1('0x44')]['id']}},_0x1df635={};_0x1df635[_0x5ee1('0x31')]=_[_0x5ee1('0x2e')](db[_0x5ee1('0x29')][_0x5ee1('0x45')]);_0x1df635['query']=_[_0x5ee1('0x2e')](_0x41af64[_0x5ee1('0x2d')]);_0x1df635['filters']=_[_0x5ee1('0x30')](_0x1df635['model'],_0x1df635['query']);_0x5a182f[_0x5ee1('0x33')]=_[_0x5ee1('0x30')](_0x1df635[_0x5ee1('0x31')],qs['fields'](_0x41af64[_0x5ee1('0x2d')][_0x5ee1('0x32')]));_0x5a182f[_0x5ee1('0x33')]=_0x5a182f[_0x5ee1('0x33')][_0x5ee1('0x34')]?_0x5a182f[_0x5ee1('0x33')]:_0x1df635['model'];if(_0x41af64[_0x5ee1('0x2d')][_0x5ee1('0x3f')]){_0x5a182f['include']=[{'all':!![]}];}_0x5a182f=_[_0x5ee1('0x3c')]({},_0x5a182f,_0x41af64[_0x5ee1('0x3d')]);return db[_0x5ee1('0x29')]['find'](_0x5a182f)[_0x5ee1('0x3e')](handleEntityNotFound(_0x336bf4,null))[_0x5ee1('0x3e')](respondWithResult(_0x336bf4,null))[_0x5ee1('0x42')](handleError(_0x336bf4,null));};exports[_0x5ee1('0x46')]=function(_0x290b83,_0x46e1c4){return db[_0x5ee1('0x29')][_0x5ee1('0x46')](_0x290b83[_0x5ee1('0x47')],{})[_0x5ee1('0x3e')](respondWithResult(_0x46e1c4,0xc9))[_0x5ee1('0x42')](handleError(_0x46e1c4,null));};exports[_0x5ee1('0x24')]=function(_0x252583,_0xffbfdb){if(_0x252583['body']['id']){delete _0x252583['body']['id'];}return db[_0x5ee1('0x29')][_0x5ee1('0x48')]({'where':{'id':_0x252583[_0x5ee1('0x44')]['id']}})[_0x5ee1('0x3e')](handleEntityNotFound(_0xffbfdb,null))[_0x5ee1('0x3e')](saveUpdates(_0x252583[_0x5ee1('0x47')],null))[_0x5ee1('0x3e')](respondWithResult(_0xffbfdb,null))['catch'](handleError(_0xffbfdb,null));};exports[_0x5ee1('0x49')]=function(_0x5022c4,_0x2c88bf){return db[_0x5ee1('0x29')][_0x5ee1('0x48')]({'where':{'id':_0x5022c4[_0x5ee1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c88bf,null))[_0x5ee1('0x3e')](removeEntity(_0x2c88bf,null))['catch'](handleError(_0x2c88bf,null));};exports[_0x5ee1('0x4a')]=function(_0xc2f3a7,_0x164e32){return db[_0x5ee1('0x29')]['describe']()[_0x5ee1('0x3e')](respondWithResult(_0x164e32,null))[_0x5ee1('0x42')](handleError(_0x164e32,null));}; \ No newline at end of file +var _0xfcbe=['zip-dir','fast-json-patch','bluebird','util','path','to-csv','lodash','squel','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','limit','undefined','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','UserProfileSection','params','keys','find','catch','create','body','destroy','describe','eml-format'];(function(_0x5cc1a8,_0x2d43ad){var _0x354cb5=function(_0x10df93){while(--_0x10df93){_0x5cc1a8['push'](_0x5cc1a8['shift']());}};_0x354cb5(++_0x2d43ad);}(_0xfcbe,0x1af));var _0xefcb=function(_0xe477a0,_0x39023b){_0xe477a0=_0xe477a0-0x0;var _0x2a8eeb=_0xfcbe[_0xe477a0];return _0x2a8eeb;};'use strict';var emlformat=require(_0xefcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefcb('0x1'));var jsonpatch=require(_0xefcb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xefcb('0x3'));var Mustache=require('mustache');var util=require(_0xefcb('0x4'));var path=require(_0xefcb('0x5'));var sox=require('sox');var csv=require(_0xefcb('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xefcb('0x7'));var squel=require(_0xefcb('0x8'));var crypto=require('crypto');var jsforce=require(_0xefcb('0x9'));var deskjs=require(_0xefcb('0xa'));var toCsv=require(_0xefcb('0x6'));var querystring=require(_0xefcb('0xb'));var Papa=require('papaparse');var Redis=require(_0xefcb('0xc'));var authService=require(_0xefcb('0xd'));var qs=require(_0xefcb('0xe'));var as=require(_0xefcb('0xf'));var hardwareService=require(_0xefcb('0x10'));var logger=require('../../config/logger')(_0xefcb('0x11'));var utils=require(_0xefcb('0x12'));var config=require(_0xefcb('0x13'));var licenseUtil=require(_0xefcb('0x14'));var db=require(_0xefcb('0x15'))['db'];function respondWithStatusCode(_0x42612d,_0x593b0a){_0x593b0a=_0x593b0a||0xcc;return function(_0x5ce70d){if(_0x5ce70d){return _0x42612d['sendStatus'](_0x593b0a);}return _0x42612d[_0xefcb('0x16')](_0x593b0a)[_0xefcb('0x17')]();};}function respondWithResult(_0x375cbc,_0x184ab3){_0x184ab3=_0x184ab3||0xc8;return function(_0x1087a0){if(_0x1087a0){return _0x375cbc[_0xefcb('0x16')](_0x184ab3)[_0xefcb('0x18')](_0x1087a0);}};}function respondWithFilteredResult(_0x2d461c,_0x3f98c3){return function(_0x154a44){if(_0x154a44){var _0x5afb59=typeof _0x3f98c3[_0xefcb('0x19')]==='undefined'&&typeof _0x3f98c3[_0xefcb('0x1a')]===_0xefcb('0x1b');var _0xf4ab7b=_0x154a44[_0xefcb('0x1c')];var _0x181f2e=_0x5afb59?0x0:_0x3f98c3[_0xefcb('0x19')];var _0x58f498=_0x5afb59?_0x154a44[_0xefcb('0x1c')]:_0x3f98c3[_0xefcb('0x19')]+_0x3f98c3['limit'];var _0x138292;if(_0x58f498>=_0xf4ab7b){_0x58f498=_0xf4ab7b;_0x138292=0xc8;}else{_0x138292=0xce;}_0x2d461c[_0xefcb('0x16')](_0x138292);return _0x2d461c['set'](_0xefcb('0x1d'),_0x181f2e+'-'+_0x58f498+'/'+_0xf4ab7b)[_0xefcb('0x18')](_0x154a44);}return null;};}function patchUpdates(_0x31d1d1){return function(_0x5c39e9){try{jsonpatch[_0xefcb('0x1e')](_0x5c39e9,_0x31d1d1,!![]);}catch(_0x5632a1){return BPromise[_0xefcb('0x1f')](_0x5632a1);}return _0x5c39e9[_0xefcb('0x20')]();};}function saveUpdates(_0x2d765d,_0x2da338){return function(_0x3cd509){if(_0x3cd509){return _0x3cd509[_0xefcb('0x21')](_0x2d765d)[_0xefcb('0x22')](function(_0x24889b){return _0x24889b;});}return null;};}function removeEntity(_0x4b5bb9,_0x1162d4){return function(_0x2bc818){if(_0x2bc818){return _0x2bc818['destroy']()[_0xefcb('0x22')](function(){_0x4b5bb9[_0xefcb('0x16')](0xcc)[_0xefcb('0x17')]();});}};}function handleEntityNotFound(_0x2779e4,_0xbc6e95){return function(_0x5b5f2a){if(!_0x5b5f2a){_0x2779e4[_0xefcb('0x23')](0x194);}return _0x5b5f2a;};}function handleError(_0x388010,_0x2b4c27){_0x2b4c27=_0x2b4c27||0x1f4;return function(_0x88b3cf){logger[_0xefcb('0x24')](_0x88b3cf[_0xefcb('0x25')]);if(_0x88b3cf[_0xefcb('0x26')]){delete _0x88b3cf['name'];}_0x388010[_0xefcb('0x16')](_0x2b4c27)[_0xefcb('0x27')](_0x88b3cf);};}exports[_0xefcb('0x28')]=function(_0x2c5e96,_0x50be15){var _0x44dc5c={},_0x305559={},_0x54ddf5={'count':0x0,'rows':[]};var _0x5ca58a=_[_0xefcb('0x29')](db['UserProfileSection'][_0xefcb('0x2a')],function(_0xe3ee41){return{'name':_0xe3ee41[_0xefcb('0x2b')],'type':_0xe3ee41['type']['key']};});_0x305559[_0xefcb('0x2c')]=_[_0xefcb('0x29')](_0x5ca58a,_0xefcb('0x26'));_0x305559[_0xefcb('0x2d')]=_['keys'](_0x2c5e96[_0xefcb('0x2d')]);_0x305559[_0xefcb('0x2e')]=_[_0xefcb('0x2f')](_0x305559[_0xefcb('0x2c')],_0x305559[_0xefcb('0x2d')]);_0x44dc5c[_0xefcb('0x30')]=_[_0xefcb('0x2f')](_0x305559[_0xefcb('0x2c')],qs[_0xefcb('0x31')](_0x2c5e96['query']['fields']));_0x44dc5c[_0xefcb('0x30')]=_0x44dc5c[_0xefcb('0x30')][_0xefcb('0x32')]?_0x44dc5c[_0xefcb('0x30')]:_0x305559[_0xefcb('0x2c')];if(!_0x2c5e96[_0xefcb('0x2d')][_0xefcb('0x33')](_0xefcb('0x34'))){_0x44dc5c[_0xefcb('0x1a')]=qs[_0xefcb('0x1a')](_0x2c5e96[_0xefcb('0x2d')][_0xefcb('0x1a')]);_0x44dc5c['offset']=qs[_0xefcb('0x19')](_0x2c5e96[_0xefcb('0x2d')][_0xefcb('0x19')]);}_0x44dc5c[_0xefcb('0x35')]=qs['sort'](_0x2c5e96['query'][_0xefcb('0x36')]);_0x44dc5c[_0xefcb('0x37')]=qs['filters'](_[_0xefcb('0x38')](_0x2c5e96[_0xefcb('0x2d')],_0x305559[_0xefcb('0x2e')]),_0x5ca58a);if(_0x2c5e96[_0xefcb('0x2d')][_0xefcb('0x39')]){_0x44dc5c[_0xefcb('0x37')]=_[_0xefcb('0x3a')](_0x44dc5c[_0xefcb('0x37')],{'$or':_['map'](_0x5ca58a,function(_0xb60fda){if(_0xb60fda[_0xefcb('0x3b')]!==_0xefcb('0x3c')){var _0xd89b93={};_0xd89b93[_0xb60fda[_0xefcb('0x26')]]={'$like':'%'+_0x2c5e96[_0xefcb('0x2d')][_0xefcb('0x39')]+'%'};return _0xd89b93;}})});}_0x44dc5c=_[_0xefcb('0x3a')]({},_0x44dc5c,_0x2c5e96[_0xefcb('0x3d')]);var _0x5792a5={'where':_0x44dc5c['where']};return db['UserProfileSection'][_0xefcb('0x1c')](_0x5792a5)['then'](function(_0x26fe25){_0x54ddf5[_0xefcb('0x1c')]=_0x26fe25;if(_0x2c5e96['query'][_0xefcb('0x3e')]){_0x44dc5c['include']=[{'all':!![]}];}return db[_0xefcb('0x3f')]['findAll'](_0x44dc5c);})[_0xefcb('0x22')](function(_0x3bf6c5){_0x54ddf5['rows']=_0x3bf6c5;return _0x54ddf5;})[_0xefcb('0x22')](respondWithFilteredResult(_0x50be15,_0x44dc5c))['catch'](handleError(_0x50be15,null));};exports['show']=function(_0x20d828,_0x2c1f54){var _0xd96898={'raw':![],'where':{'id':_0x20d828[_0xefcb('0x40')]['id']}},_0x41704b={};_0x41704b[_0xefcb('0x2c')]=_['keys'](db[_0xefcb('0x3f')][_0xefcb('0x2a')]);_0x41704b[_0xefcb('0x2d')]=_[_0xefcb('0x41')](_0x20d828[_0xefcb('0x2d')]);_0x41704b['filters']=_[_0xefcb('0x2f')](_0x41704b[_0xefcb('0x2c')],_0x41704b[_0xefcb('0x2d')]);_0xd96898['attributes']=_[_0xefcb('0x2f')](_0x41704b[_0xefcb('0x2c')],qs[_0xefcb('0x31')](_0x20d828[_0xefcb('0x2d')][_0xefcb('0x31')]));_0xd96898[_0xefcb('0x30')]=_0xd96898[_0xefcb('0x30')][_0xefcb('0x32')]?_0xd96898[_0xefcb('0x30')]:_0x41704b[_0xefcb('0x2c')];if(_0x20d828[_0xefcb('0x2d')]['includeAll']){_0xd96898['include']=[{'all':!![]}];}_0xd96898=_[_0xefcb('0x3a')]({},_0xd96898,_0x20d828[_0xefcb('0x3d')]);return db['UserProfileSection'][_0xefcb('0x42')](_0xd96898)[_0xefcb('0x22')](handleEntityNotFound(_0x2c1f54,null))['then'](respondWithResult(_0x2c1f54,null))[_0xefcb('0x43')](handleError(_0x2c1f54,null));};exports[_0xefcb('0x44')]=function(_0x5e3837,_0x4b5141){return db[_0xefcb('0x3f')][_0xefcb('0x44')](_0x5e3837['body'],{})[_0xefcb('0x22')](respondWithResult(_0x4b5141,0xc9))[_0xefcb('0x43')](handleError(_0x4b5141,null));};exports['update']=function(_0x54bd67,_0x3e01c8){if(_0x54bd67[_0xefcb('0x45')]['id']){delete _0x54bd67['body']['id'];}return db[_0xefcb('0x3f')][_0xefcb('0x42')]({'where':{'id':_0x54bd67[_0xefcb('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e01c8,null))['then'](saveUpdates(_0x54bd67[_0xefcb('0x45')],null))[_0xefcb('0x22')](respondWithResult(_0x3e01c8,null))[_0xefcb('0x43')](handleError(_0x3e01c8,null));};exports[_0xefcb('0x46')]=function(_0x3ea0b6,_0x36c1d8){return db['UserProfileSection'][_0xefcb('0x42')]({'where':{'id':_0x3ea0b6['params']['id']}})[_0xefcb('0x22')](handleEntityNotFound(_0x36c1d8,null))[_0xefcb('0x22')](removeEntity(_0x36c1d8,null))[_0xefcb('0x43')](handleError(_0x36c1d8,null));};exports[_0xefcb('0x47')]=function(_0x44c0b1,_0x355467){return db[_0xefcb('0x3f')][_0xefcb('0x47')]()['then'](respondWithResult(_0x355467,null))['catch'](handleError(_0x355467,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 041bb3d..db759ba 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 _0x5ce2=['moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api'];(function(_0x1da9a2,_0x38e471){var _0x34eabf=function(_0x314ea2){while(--_0x314ea2){_0x1da9a2['push'](_0x1da9a2['shift']());}};_0x34eabf(++_0x38e471);}(_0x5ce2,0x1e7));var _0x25ce=function(_0x10d405,_0x28d136){_0x10d405=_0x10d405-0x0;var _0x12bd98=_0x5ce2[_0x10d405];return _0x12bd98;};'use strict';var _=require(_0x25ce('0x0'));var util=require(_0x25ce('0x1'));var logger=require('../../config/logger')(_0x25ce('0x2'));var moment=require(_0x25ce('0x3'));var BPromise=require(_0x25ce('0x4'));var rp=require(_0x25ce('0x5'));var fs=require('fs');var path=require(_0x25ce('0x6'));var rimraf=require('rimraf');var config=require(_0x25ce('0x7'));var attributes=require(_0x25ce('0x8'));module[_0x25ce('0x9')]=function(_0xdc640d,_0x2ebefb){return _0xdc640d['define']('UserProfileSection',attributes,{'tableName':_0x25ce('0xa'),'paranoid':![],'indexes':[{'name':_0x25ce('0xb'),'fields':[_0x25ce('0xc'),_0x25ce('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa11=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0xaa11,0x78));var _0x1aa1=function(_0x40ff3b,_0x238af7){_0x40ff3b=_0x40ff3b-0x0;var _0x3ccf4f=_0xaa11[_0x40ff3b];return _0x3ccf4f;};'use strict';var _=require(_0x1aa1('0x0'));var util=require(_0x1aa1('0x1'));var logger=require(_0x1aa1('0x2'))(_0x1aa1('0x3'));var moment=require(_0x1aa1('0x4'));var BPromise=require(_0x1aa1('0x5'));var rp=require(_0x1aa1('0x6'));var fs=require('fs');var path=require(_0x1aa1('0x7'));var rimraf=require('rimraf');var config=require(_0x1aa1('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x1aa1('0x9')]=function(_0x37ef0e,_0x502e0b){return _0x37ef0e['define'](_0x1aa1('0xa'),attributes,{'tableName':_0x1aa1('0xb'),'paranoid':![],'indexes':[{'name':_0x1aa1('0xc'),'fields':[_0x1aa1('0xd'),_0x1aa1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 96d8d5f..b72f630 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 _0xf643=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','bluebird','ioredis'];(function(_0x2c1f4e,_0x190aa7){var _0x5be799=function(_0x1180a4){while(--_0x1180a4){_0x2c1f4e['push'](_0x2c1f4e['shift']());}};_0x5be799(++_0x190aa7);}(_0xf643,0xa7));var _0x3f64=function(_0xada38c,_0x550eb8){_0xada38c=_0xada38c-0x0;var _0x26545b=_0xf643[_0xada38c];return _0x26545b;};'use strict';var _=require(_0x3f64('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3f64('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f64('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f64('0x3'));var logger=require(_0x3f64('0x4'))('rpc');var config=require(_0x3f64('0x5'));var jayson=require(_0x3f64('0x6'));var client=jayson[_0x3f64('0x7')][_0x3f64('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f44b3,_0xf581fd,_0x3fa061){return new BPromise(function(_0x47d53b,_0x4f47bc){return client['request'](_0x5f44b3,_0x3fa061)[_0x3f64('0x9')](function(_0x1df8be){logger['info'](_0x3f64('0xa'),_0xf581fd,_0x3f64('0xb'));logger['debug'](_0x3f64('0xc'),_0xf581fd,'request\x20sent',JSON['stringify'](_0x1df8be));if(_0x1df8be[_0x3f64('0xd')]){if(_0x1df8be['error']['code']===0x1f4){logger[_0x3f64('0xd')]('UserProfileSection,\x20%s,\x20%s',_0xf581fd,_0x1df8be[_0x3f64('0xd')]['message']);return _0x4f47bc(_0x1df8be['error'][_0x3f64('0xe')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0xf581fd,_0x1df8be[_0x3f64('0xd')][_0x3f64('0xe')]);return _0x47d53b(_0x1df8be[_0x3f64('0xd')][_0x3f64('0xe')]);}else{logger[_0x3f64('0xf')]('UserProfileSection,\x20%s,\x20%s',_0xf581fd,_0x3f64('0xb'));_0x47d53b(_0x1df8be['result']['message']);}})[_0x3f64('0x10')](function(_0x4e1c53){logger[_0x3f64('0xd')](_0x3f64('0xa'),_0xf581fd,_0x4e1c53);_0x4f47bc(_0x4e1c53);});});} \ No newline at end of file +var _0x76a8=['code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x76a8,0x1e7));var _0x876a=function(_0x55857a,_0x391123){_0x55857a=_0x55857a-0x0;var _0x38b322=_0x76a8[_0x55857a];return _0x38b322;};'use strict';var _=require(_0x876a('0x0'));var util=require(_0x876a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x876a('0x2'));var fs=require('fs');var Redis=require(_0x876a('0x3'));var db=require(_0x876a('0x4'))['db'];var utils=require(_0x876a('0x5'));var logger=require(_0x876a('0x6'))(_0x876a('0x7'));var config=require(_0x876a('0x8'));var jayson=require(_0x876a('0x9'));var client=jayson['client'][_0x876a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3981fa,_0x44ddfe,_0x5898f0){return new BPromise(function(_0x2681ef,_0x19a160){return client[_0x876a('0xb')](_0x3981fa,_0x5898f0)[_0x876a('0xc')](function(_0x1d98d5){logger[_0x876a('0xd')](_0x876a('0xe'),_0x44ddfe,_0x876a('0xf'));logger[_0x876a('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x44ddfe,_0x876a('0xf'),JSON[_0x876a('0x11')](_0x1d98d5));if(_0x1d98d5[_0x876a('0x12')]){if(_0x1d98d5[_0x876a('0x12')][_0x876a('0x13')]===0x1f4){logger[_0x876a('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x44ddfe,_0x1d98d5[_0x876a('0x12')][_0x876a('0x14')]);return _0x19a160(_0x1d98d5[_0x876a('0x12')][_0x876a('0x14')]);}logger[_0x876a('0x12')](_0x876a('0xe'),_0x44ddfe,_0x1d98d5['error'][_0x876a('0x14')]);return _0x2681ef(_0x1d98d5[_0x876a('0x12')][_0x876a('0x14')]);}else{logger[_0x876a('0xd')](_0x876a('0xe'),_0x44ddfe,_0x876a('0xf'));_0x2681ef(_0x1d98d5[_0x876a('0x15')][_0x876a('0x14')]);}})['catch'](function(_0x1e17f2){logger['error'](_0x876a('0xe'),_0x44ddfe,_0x1e17f2);_0x19a160(_0x1e17f2);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 879933d..19c9c10 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x300309,_0x1a8a6f){var _0x158e9a=function(_0x55e7c8){while(--_0x55e7c8){_0x300309['push'](_0x300309['shift']());}};_0x158e9a(++_0x1a8a6f);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5bf7c2,_0x1a5b0e){var _0x54284d=function(_0x4941f1){while(--_0x4941f1){_0x5bf7c2['push'](_0x5bf7c2['shift']());}};_0x54284d(++_0x1a5b0e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0xcb91[_0x3de873];return _0x380b8c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 8086e3e..f57da1d 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 _0x1574=['sequelize'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x1574,0x79));var _0x4157=function(_0x3a7c66,_0xf659e1){_0x3a7c66=_0x3a7c66-0x0;var _0x39f615=_0x1574[_0x3a7c66];return _0x39f615;};'use strict';var Sequelize=require(_0x4157('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd2fc=['exports'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0xd2fc,0xda));var _0xcd2f=function(_0xb2789c,_0x3d2166){_0xb2789c=_0xb2789c-0x0;var _0xa1322f=_0xd2fc[_0xb2789c];return _0xa1322f;};'use strict';var Sequelize=require('sequelize');module[_0xcd2f('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 db52a8c..376d33f 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 _0xf61e=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x24b185,_0x7e4e44){var _0x407e2f=function(_0x3c9c0e){while(--_0x3c9c0e){_0x24b185['push'](_0x24b185['shift']());}};_0x407e2f(++_0x7e4e44);}(_0xf61e,0x191));var _0xef61=function(_0x59921c,_0xdb547e){_0x59921c=_0x59921c-0x0;var _0x450419=_0xf61e[_0x59921c];return _0x450419;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('UserSmsQueue',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x964b=['util','api','moment','bluebird','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0x964b,0x112));var _0xb964=function(_0x2c375b,_0xbb7ecf){_0x2c375b=_0x2c375b-0x0;var _0x3c2cd9=_0x964b[_0x2c375b];return _0x3c2cd9;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var logger=require('../../config/logger')(_0xb964('0x2'));var moment=require(_0xb964('0x3'));var BPromise=require(_0xb964('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb964('0x5'));var config=require('../../config/environment');var attributes=require(_0xb964('0x6'));module[_0xb964('0x7')]=function(_0xba9f19,_0x11a0c1){return _0xba9f19[_0xb964('0x8')](_0xb964('0x9'),attributes,{'tableName':_0xb964('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 46d1c3d..010b3a4 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 _0x2f2d=['info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x403987,_0x55a50c){var _0x5be9ac=function(_0xc4dbb6){while(--_0xc4dbb6){_0x403987['push'](_0x403987['shift']());}};_0x5be9ac(++_0x55a50c);}(_0x2f2d,0x1d7));var _0xd2f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd2f2('0x0'));var util=require(_0xd2f2('0x1'));var moment=require('moment');var BPromise=require(_0xd2f2('0x2'));var rs=require(_0xd2f2('0x3'));var fs=require('fs');var Redis=require(_0xd2f2('0x4'));var db=require(_0xd2f2('0x5'))['db'];var utils=require(_0xd2f2('0x6'));var logger=require(_0xd2f2('0x7'))(_0xd2f2('0x8'));var config=require(_0xd2f2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd2f2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d688e,_0x4d3768,_0x2f81f4){return new BPromise(function(_0x2d9f23,_0x25bd3d){return client[_0xd2f2('0xb')](_0x4d688e,_0x2f81f4)[_0xd2f2('0xc')](function(_0x5771a6){logger[_0xd2f2('0xd')](_0xd2f2('0xe'),_0x4d3768,'request\x20sent');logger[_0xd2f2('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4d3768,_0xd2f2('0x10'),JSON['stringify'](_0x5771a6));if(_0x5771a6[_0xd2f2('0x11')]){if(_0x5771a6[_0xd2f2('0x11')][_0xd2f2('0x12')]===0x1f4){logger[_0xd2f2('0x11')](_0xd2f2('0xe'),_0x4d3768,_0x5771a6['error'][_0xd2f2('0x13')]);return _0x25bd3d(_0x5771a6[_0xd2f2('0x11')][_0xd2f2('0x13')]);}logger['error'](_0xd2f2('0xe'),_0x4d3768,_0x5771a6[_0xd2f2('0x11')][_0xd2f2('0x13')]);return _0x2d9f23(_0x5771a6[_0xd2f2('0x11')]['message']);}else{logger[_0xd2f2('0xd')](_0xd2f2('0xe'),_0x4d3768,_0xd2f2('0x10'));_0x2d9f23(_0x5771a6[_0xd2f2('0x14')][_0xd2f2('0x13')]);}})[_0xd2f2('0x15')](function(_0x4fd51a){logger[_0xd2f2('0x11')](_0xd2f2('0xe'),_0x4d3768,_0x4fd51a);_0x25bd3d(_0x4fd51a);});});} \ No newline at end of file +var _0xcbed=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result'];(function(_0x534bbd,_0x1e7685){var _0x3873c6=function(_0x36c5e7){while(--_0x36c5e7){_0x534bbd['push'](_0x534bbd['shift']());}};_0x3873c6(++_0x1e7685);}(_0xcbed,0x1a5));var _0xdcbe=function(_0x312eff,_0x501165){_0x312eff=_0x312eff-0x0;var _0x5182c0=_0xcbed[_0x312eff];return _0x5182c0;};'use strict';var _=require(_0xdcbe('0x0'));var util=require(_0xdcbe('0x1'));var moment=require('moment');var BPromise=require(_0xdcbe('0x2'));var rs=require(_0xdcbe('0x3'));var fs=require('fs');var Redis=require(_0xdcbe('0x4'));var db=require(_0xdcbe('0x5'))['db'];var utils=require(_0xdcbe('0x6'));var logger=require('../../config/logger')(_0xdcbe('0x7'));var config=require('../../config/environment');var jayson=require(_0xdcbe('0x8'));var client=jayson[_0xdcbe('0x9')][_0xdcbe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19c950,_0x8bd768,_0x4696ac){return new BPromise(function(_0x211e12,_0x261c7e){return client['request'](_0x19c950,_0x4696ac)[_0xdcbe('0xb')](function(_0x46dbfd){logger['info'](_0xdcbe('0xc'),_0x8bd768,_0xdcbe('0xd'));logger[_0xdcbe('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x8bd768,_0xdcbe('0xd'),JSON['stringify'](_0x46dbfd));if(_0x46dbfd[_0xdcbe('0xf')]){if(_0x46dbfd['error'][_0xdcbe('0x10')]===0x1f4){logger[_0xdcbe('0xf')](_0xdcbe('0xc'),_0x8bd768,_0x46dbfd[_0xdcbe('0xf')][_0xdcbe('0x11')]);return _0x261c7e(_0x46dbfd[_0xdcbe('0xf')][_0xdcbe('0x11')]);}logger['error'](_0xdcbe('0xc'),_0x8bd768,_0x46dbfd[_0xdcbe('0xf')][_0xdcbe('0x11')]);return _0x211e12(_0x46dbfd[_0xdcbe('0xf')][_0xdcbe('0x11')]);}else{logger[_0xdcbe('0x12')](_0xdcbe('0xc'),_0x8bd768,_0xdcbe('0xd'));_0x211e12(_0x46dbfd[_0xdcbe('0x13')][_0xdcbe('0x11')]);}})[_0xdcbe('0x14')](function(_0x3422f6){logger[_0xdcbe('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x8bd768,_0x3422f6);_0x261c7e(_0x3422f6);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e4747ac..2019f06 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 _0x9ab4=['sequelize','INTEGER'];(function(_0xd6c010,_0x5355e6){var _0x15893b=function(_0x1b0a5a){while(--_0x1b0a5a){_0xd6c010['push'](_0xd6c010['shift']());}};_0x15893b(++_0x5355e6);}(_0x9ab4,0x128));var _0x49ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ab4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x49ab('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x49ab('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x49ab('0x1')]}}; \ No newline at end of file +var _0xdfd3=['exports','INTEGER','sequelize'];(function(_0x32d87b,_0x461f9e){var _0x4a2de7=function(_0x4f9a99){while(--_0x4f9a99){_0x32d87b['push'](_0x32d87b['shift']());}};_0x4a2de7(++_0x461f9e);}(_0xdfd3,0x17f));var _0x3dfd=function(_0x1eb5da,_0x1974ec){_0x1eb5da=_0x1eb5da-0x0;var _0x579a2f=_0xdfd3[_0x1eb5da];return _0x579a2f;};'use strict';var Sequelize=require(_0x3dfd('0x0'));module[_0x3dfd('0x1')]={'UserId':{'type':Sequelize[_0x3dfd('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x3dfd('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 8457e88..0aacd41 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(_0x43babe,_0x1438ca){var _0x23dec6=function(_0x2a8df6){while(--_0x2a8df6){_0x43babe['push'](_0x43babe['shift']());}};_0x23dec6(++_0x1438ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x2e42c8,_0x2a8fc1){var _0x200fdc=function(_0x4b09db){while(--_0x4b09db){_0x2e42c8['push'](_0x2e42c8['shift']());}};_0x200fdc(++_0x2a8fc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 22cbd7b..b200740 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x520d3b,_0x1e133e){var _0x28c120=function(_0x32c067){while(--_0x32c067){_0x520d3b['push'](_0x520d3b['shift']());}};_0x28c120(++_0x1e133e);}(_0x70e0,0x17b));var _0x070e=function(_0x157623,_0x43f8ee){_0x157623=_0x157623-0x0;var _0x1ef39c=_0x70e0[_0x157623];return _0x1ef39c;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x34f255,_0x12fef3){var _0x5cb7a2=function(_0x29105d){while(--_0x29105d){_0x34f255['push'](_0x34f255['shift']());}};_0x5cb7a2(++_0x12fef3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xcb91[_0x53abe5];return _0xc1c37e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index a8593c6..72f6245 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 _0x62f2=['sequelize','exports','INTEGER'];(function(_0x87d595,_0x2411c8){var _0x2a49e2=function(_0x3f2305){while(--_0x3f2305){_0x87d595['push'](_0x87d595['shift']());}};_0x2a49e2(++_0x2411c8);}(_0x62f2,0xff));var _0x262f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x62f2[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x262f('0x0'));module[_0x262f('0x1')]={'penalty':{'type':Sequelize[_0x262f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1d13=['INTEGER','exports'];(function(_0x4cec96,_0xb2cc2f){var _0x48ffff=function(_0xf66217){while(--_0xf66217){_0x4cec96['push'](_0x4cec96['shift']());}};_0x48ffff(++_0xb2cc2f);}(_0x1d13,0x1d5));var _0x31d1=function(_0x3b8073,_0x33f9b7){_0x3b8073=_0x3b8073-0x0;var _0x3490be=_0x1d13[_0x3b8073];return _0x3490be;};'use strict';var Sequelize=require('sequelize');module[_0x31d1('0x0')]={'penalty':{'type':Sequelize[_0x31d1('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 84d21b2..d3e60ca 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 _0x670f=['request-promise','rimraf','./userVoiceQueue.attributes','define','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x7fc086,_0x477809){var _0x251b2f=function(_0x16cd1a){while(--_0x16cd1a){_0x7fc086['push'](_0x7fc086['shift']());}};_0x251b2f(++_0x477809);}(_0x670f,0xcd));var _0xf670=function(_0x255f32,_0x228ad7){_0x255f32=_0x255f32-0x0;var _0x11664f=_0x670f[_0x255f32];return _0x11664f;};'use strict';var _=require(_0xf670('0x0'));var util=require(_0xf670('0x1'));var logger=require(_0xf670('0x2'))(_0xf670('0x3'));var moment=require('moment');var BPromise=require(_0xf670('0x4'));var rp=require(_0xf670('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf670('0x6'));var config=require('../../config/environment');var attributes=require(_0xf670('0x7'));module['exports']=function(_0x2a7c47,_0x2129a2){return _0x2a7c47[_0xf670('0x8')]('UserVoiceQueue',attributes,{'tableName':_0xf670('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b56=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','./userVoiceQueue.attributes','exports','define'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x1b56,0x7a));var _0x61b5=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x1b56[_0x393d69];return _0x3cee37;};'use strict';var _=require(_0x61b5('0x0'));var util=require(_0x61b5('0x1'));var logger=require(_0x61b5('0x2'))(_0x61b5('0x3'));var moment=require(_0x61b5('0x4'));var BPromise=require(_0x61b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61b5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x61b5('0x7'));module[_0x61b5('0x8')]=function(_0x253d8c,_0x35a1ba){return _0x253d8c[_0x61b5('0x9')]('UserVoiceQueue',attributes,{'tableName':_0x61b5('0xa'),'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 91032b9..6595213 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 _0x703f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','request\x20sent','debug','error','code','UserVoiceQueue,\x20%s,\x20%s','message','info','bluebird'];(function(_0x461844,_0x5ced95){var _0x5c3d01=function(_0x4be194){while(--_0x4be194){_0x461844['push'](_0x461844['shift']());}};_0x5c3d01(++_0x5ced95);}(_0x703f,0x197));var _0xf703=function(_0x5c6d5e,_0x576c0d){_0x5c6d5e=_0x5c6d5e-0x0;var _0x52e46c=_0x703f[_0x5c6d5e];return _0x52e46c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf703('0x0'));var rs=require(_0xf703('0x1'));var fs=require('fs');var Redis=require(_0xf703('0x2'));var db=require(_0xf703('0x3'))['db'];var utils=require(_0xf703('0x4'));var logger=require(_0xf703('0x5'))(_0xf703('0x6'));var config=require(_0xf703('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf703('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x167658,_0x398f16,_0x4bc723){return new BPromise(function(_0x16b96b,_0xfd6f56){return client[_0xf703('0x9')](_0x167658,_0x4bc723)['then'](function(_0x48dfc0){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x398f16,_0xf703('0xa'));logger[_0xf703('0xb')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x398f16,_0xf703('0xa'),JSON['stringify'](_0x48dfc0));if(_0x48dfc0[_0xf703('0xc')]){if(_0x48dfc0[_0xf703('0xc')][_0xf703('0xd')]===0x1f4){logger[_0xf703('0xc')](_0xf703('0xe'),_0x398f16,_0x48dfc0['error'][_0xf703('0xf')]);return _0xfd6f56(_0x48dfc0[_0xf703('0xc')][_0xf703('0xf')]);}logger[_0xf703('0xc')](_0xf703('0xe'),_0x398f16,_0x48dfc0[_0xf703('0xc')][_0xf703('0xf')]);return _0x16b96b(_0x48dfc0[_0xf703('0xc')][_0xf703('0xf')]);}else{logger[_0xf703('0x10')](_0xf703('0xe'),_0x398f16,_0xf703('0xa'));_0x16b96b(_0x48dfc0['result']['message']);}})['catch'](function(_0xc1d0bd){logger[_0xf703('0xc')](_0xf703('0xe'),_0x398f16,_0xc1d0bd);_0xfd6f56(_0xc1d0bd);});});} \ No newline at end of file +var _0xf629=['UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x449957,_0x430ace){var _0x3fecd5=function(_0x5988c5){while(--_0x5988c5){_0x449957['push'](_0x449957['shift']());}};_0x3fecd5(++_0x430ace);}(_0xf629,0xf4));var _0x9f62=function(_0x448163,_0x54930d){_0x448163=_0x448163-0x0;var _0x2dcb26=_0xf629[_0x448163];return _0x2dcb26;};'use strict';var _=require(_0x9f62('0x0'));var util=require(_0x9f62('0x1'));var moment=require(_0x9f62('0x2'));var BPromise=require(_0x9f62('0x3'));var rs=require(_0x9f62('0x4'));var fs=require('fs');var Redis=require(_0x9f62('0x5'));var db=require(_0x9f62('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f62('0x7'))(_0x9f62('0x8'));var config=require(_0x9f62('0x9'));var jayson=require(_0x9f62('0xa'));var client=jayson[_0x9f62('0xb')][_0x9f62('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa9e1f5,_0x4def39,_0x5029ba){return new BPromise(function(_0x54f599,_0x48a5b1){return client[_0x9f62('0xd')](_0xa9e1f5,_0x5029ba)[_0x9f62('0xe')](function(_0x26d31f){logger[_0x9f62('0xf')](_0x9f62('0x10'),_0x4def39,'request\x20sent');logger[_0x9f62('0x11')](_0x9f62('0x12'),_0x4def39,'request\x20sent',JSON[_0x9f62('0x13')](_0x26d31f));if(_0x26d31f[_0x9f62('0x14')]){if(_0x26d31f['error'][_0x9f62('0x15')]===0x1f4){logger[_0x9f62('0x14')](_0x9f62('0x10'),_0x4def39,_0x26d31f[_0x9f62('0x14')][_0x9f62('0x16')]);return _0x48a5b1(_0x26d31f[_0x9f62('0x14')][_0x9f62('0x16')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4def39,_0x26d31f['error'][_0x9f62('0x16')]);return _0x54f599(_0x26d31f[_0x9f62('0x14')][_0x9f62('0x16')]);}else{logger[_0x9f62('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x4def39,_0x9f62('0x17'));_0x54f599(_0x26d31f[_0x9f62('0x18')][_0x9f62('0x16')]);}})[_0x9f62('0x19')](function(_0x1b4320){logger[_0x9f62('0x14')](_0x9f62('0x10'),_0x4def39,_0x1b4320);_0x48a5b1(_0x1b4320);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 934e7e8..43df749 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x479462,_0x3137db){var _0x479e5f=function(_0x38839f){while(--_0x38839f){_0x479462['push'](_0x479462['shift']());}};_0x479e5f(++_0x3137db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4ae9e8,_0x2fcf6e){var _0x267052=function(_0x2100da){while(--_0x2100da){_0x4ae9e8['push'](_0x4ae9e8['shift']());}};_0x267052(++_0x2fcf6e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xcb91[_0x245afe];return _0x4eefde;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index c1b1bfc..8bf488f 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 _0x5041=['INTEGER','queue_interface','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x502b7a,_0x580526){var _0x497698=function(_0x12e9e0){while(--_0x12e9e0){_0x502b7a['push'](_0x502b7a['shift']());}};_0x497698(++_0x580526);}(_0x5041,0x1ce));var _0x1504=function(_0x4bf675,_0x207936){_0x4bf675=_0x4bf675-0x0;var _0x49cb35=_0x5041[_0x4bf675];return _0x49cb35;};'use strict';var Sequelize=require('sequelize');module[_0x1504('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1504('0x1')},'membername':{'type':Sequelize[_0x1504('0x2')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x1504('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1504('0x2')],'allowNull':![],'unique':_0x1504('0x4'),'comment':_0x1504('0x1')},'VoiceQueueId':{'type':Sequelize[_0x1504('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x1504('0x2')],'allowNull':![],'unique':_0x1504('0x4'),'comment':_0x1504('0x1')},'penalty':{'type':Sequelize[_0x1504('0x3')](0xb),'defaultValue':0x0,'comment':_0x1504('0x1')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x1504('0x1')}}; \ No newline at end of file +var _0x4b5f=['STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports','INTEGER'];(function(_0xfcd650,_0x2126f6){var _0x30cf33=function(_0x21581b){while(--_0x21581b){_0xfcd650['push'](_0xfcd650['shift']());}};_0x30cf33(++_0x2126f6);}(_0x4b5f,0x81));var _0xf4b5=function(_0x16bfae,_0x36ed25){_0x16bfae=_0x16bfae-0x0;var _0x3870f5=_0x4b5f[_0x16bfae];return _0x3870f5;};'use strict';var Sequelize=require(_0xf4b5('0x0'));module[_0xf4b5('0x1')]={'uniqueid':{'type':Sequelize[_0xf4b5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xf4b5('0x3')],'allowNull':![],'comment':_0xf4b5('0x4')},'UserId':{'type':Sequelize[_0xf4b5('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf4b5('0x3')],'allowNull':![],'unique':_0xf4b5('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xf4b5('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xf4b5('0x3')],'allowNull':![],'unique':_0xf4b5('0x5'),'comment':_0xf4b5('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xf4b5('0x4')},'paused':{'type':Sequelize[_0xf4b5('0x2')](0xb),'defaultValue':0x0,'comment':_0xf4b5('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index a7edb5d..66599b2 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 _0x5eca=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x290201,_0x279632){var _0x3d5c08=function(_0x3d0f41){while(--_0x3d0f41){_0x290201['push'](_0x290201['shift']());}};_0x3d5c08(++_0x279632);}(_0x5eca,0x11d));var _0xa5ec=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5eca[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xa5ec('0x0'));var UserVoiceQueueRt=require(_0xa5ec('0x1'))['db'][_0xa5ec('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa5ec('0x3')](0x0);var events={'afterCreate':_0xa5ec('0x4'),'afterUpdate':_0xa5ec('0x5'),'afterDestroy':_0xa5ec('0x6')};function emitEvent(_0xa778c7){return function(_0xf7ba02,_0x2d9651,_0x4f38db){UserVoiceQueueRtEvents[_0xa5ec('0x7')](_0xa778c7+':'+_0xf7ba02['id'],_0xf7ba02);UserVoiceQueueRtEvents[_0xa5ec('0x7')](_0xa778c7,_0xf7ba02);_0x4f38db(null);};}for(var e in events){if(events[_0xa5ec('0x8')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xa5ec('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x92ca=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x56392b,_0x2a70ea){var _0x1a14dc=function(_0x19ff0d){while(--_0x19ff0d){_0x56392b['push'](_0x56392b['shift']());}};_0x1a14dc(++_0x2a70ea);}(_0x92ca,0x92));var _0xa92c=function(_0x163157,_0x59eea5){_0x163157=_0x163157-0x0;var _0x3db535=_0x92ca[_0x163157];return _0x3db535;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xa92c('0x0'))['db'][_0xa92c('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa92c('0x2')](0x0);var events={'afterCreate':_0xa92c('0x3'),'afterUpdate':_0xa92c('0x4'),'afterDestroy':_0xa92c('0x5')};function emitEvent(_0x175e79){return function(_0xd20bab,_0x33a7c7,_0x4d90c0){UserVoiceQueueRtEvents[_0xa92c('0x6')](_0x175e79+':'+_0xd20bab['id'],_0xd20bab);UserVoiceQueueRtEvents[_0xa92c('0x6')](_0x175e79,_0xd20bab);_0x4d90c0(null);};}for(var e in events){if(events[_0xa92c('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xa92c('0x8')](e,emitEvent(event));}}module[_0xa92c('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 4f66254..6f2f080 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 _0xa089=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger'];(function(_0x512f8c,_0x3545c1){var _0x2099f8=function(_0x5293eb){while(--_0x5293eb){_0x512f8c['push'](_0x512f8c['shift']());}};_0x2099f8(++_0x3545c1);}(_0xa089,0x8c));var _0x9a08=function(_0x5621c9,_0x3ddc3e){_0x5621c9=_0x5621c9-0x0;var _0x4cdb82=_0xa089[_0x5621c9];return _0x4cdb82;};'use strict';var _=require(_0x9a08('0x0'));var util=require(_0x9a08('0x1'));var logger=require(_0x9a08('0x2'))('api');var moment=require(_0x9a08('0x3'));var BPromise=require(_0x9a08('0x4'));var rp=require(_0x9a08('0x5'));var fs=require('fs');var path=require(_0x9a08('0x6'));var rimraf=require(_0x9a08('0x7'));var config=require(_0x9a08('0x8'));var attributes=require(_0x9a08('0x9'));module[_0x9a08('0xa')]=function(_0x2b08cf,_0x12d3f6){return _0x2b08cf['define'](_0x9a08('0xb'),attributes,{'tableName':_0x9a08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4160=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x54181a,_0x22d7c5){var _0x4bce5d=function(_0x35755d){while(--_0x35755d){_0x54181a['push'](_0x54181a['shift']());}};_0x4bce5d(++_0x22d7c5);}(_0x4160,0xe4));var _0x0416=function(_0x51ad8d,_0x39a2c1){_0x51ad8d=_0x51ad8d-0x0;var _0x543b3a=_0x4160[_0x51ad8d];return _0x543b3a;};'use strict';var _=require(_0x0416('0x0'));var util=require(_0x0416('0x1'));var logger=require(_0x0416('0x2'))(_0x0416('0x3'));var moment=require(_0x0416('0x4'));var BPromise=require(_0x0416('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0416('0x6'));var rimraf=require('rimraf');var config=require(_0x0416('0x7'));var attributes=require(_0x0416('0x8'));module[_0x0416('0x9')]=function(_0x54cac3,_0x6e46fc){return _0x54cac3['define'](_0x0416('0xa'),attributes,{'tableName':_0x0416('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 3293d50..46051e8 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 _0x5843=['UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','catch','findAll','options','raw','where','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','debug'];(function(_0xdd775e,_0x595f6b){var _0x3aba8=function(_0x51bc32){while(--_0x51bc32){_0xdd775e['push'](_0xdd775e['shift']());}};_0x3aba8(++_0x595f6b);}(_0x5843,0x1c2));var _0x3584=function(_0x3d8f5b,_0xe2d7e4){_0x3d8f5b=_0x3d8f5b-0x0;var _0x5e6317=_0x5843[_0x3d8f5b];return _0x5e6317;};'use strict';var _=require(_0x3584('0x0'));var util=require('util');var moment=require(_0x3584('0x1'));var BPromise=require('bluebird');var rs=require(_0x3584('0x2'));var fs=require('fs');var Redis=require(_0x3584('0x3'));var db=require(_0x3584('0x4'))['db'];var utils=require(_0x3584('0x5'));var logger=require('../../config/logger')(_0x3584('0x6'));var config=require('../../config/environment');var jayson=require(_0x3584('0x7'));var client=jayson[_0x3584('0x8')][_0x3584('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3584('0xa')],{'host':_0x3584('0xb'),'port':0x18eb});var socket=require(_0x3584('0xc'))(new Redis(config[_0x3584('0xa')]));require(_0x3584('0xd'))[_0x3584('0xe')](socket);function respondWithRpcPromise(_0x99188e,_0x5d1502,_0xe2a757){return new BPromise(function(_0x174c62,_0xdbbb25){return client[_0x3584('0xf')](_0x99188e,_0xe2a757)[_0x3584('0x10')](function(_0x284350){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5d1502,'request\x20sent');logger[_0x3584('0x11')](_0x3584('0x12'),_0x5d1502,_0x3584('0x13'),JSON['stringify'](_0x284350));if(_0x284350[_0x3584('0x14')]){if(_0x284350[_0x3584('0x14')]['code']===0x1f4){logger['error'](_0x3584('0x15'),_0x5d1502,_0x284350[_0x3584('0x14')][_0x3584('0x16')]);return _0xdbbb25(_0x284350['error'][_0x3584('0x16')]);}logger['error'](_0x3584('0x15'),_0x5d1502,_0x284350[_0x3584('0x14')][_0x3584('0x16')]);return _0x174c62(_0x284350[_0x3584('0x14')][_0x3584('0x16')]);}else{logger[_0x3584('0x17')](_0x3584('0x15'),_0x5d1502,_0x3584('0x13'));_0x174c62(_0x284350[_0x3584('0x18')]['message']);}})[_0x3584('0x19')](function(_0x1ff571){logger[_0x3584('0x14')](_0x3584('0x15'),_0x5d1502,_0x1ff571);_0xdbbb25(_0x1ff571);});});}exports['GetVoiceQueueRtPauses']=function(_0x13f7d9){var _0x439fd1=this;return new Promise(function(_0x3cc0f3,_0xad3360){return db['UserVoiceQueueRt'][_0x3584('0x1a')]({'raw':_0x13f7d9[_0x3584('0x1b')]?_0x13f7d9[_0x3584('0x1b')][_0x3584('0x1c')]===undefined?!![]:![]:!![],'where':_0x13f7d9['options']?_0x13f7d9['options'][_0x3584('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0x3584('0x1e'),db[_0x3584('0x1f')]['fn']('IF',db[_0x3584('0x1f')]['literal'](_0x3584('0x20')))),_0x3584('0x21')]]})['then'](function(_0x2b2cb6){logger[_0x3584('0x17')]('GetVoiceQueueRtPauses',_0x13f7d9);logger[_0x3584('0x11')](_0x3584('0x22'),_0x13f7d9,JSON[_0x3584('0x23')](_0x2b2cb6));_0x3cc0f3(_0x2b2cb6);})[_0x3584('0x19')](function(_0x2fb3d2){logger[_0x3584('0x14')](_0x3584('0x22'),_0x2fb3d2[_0x3584('0x16')],_0x13f7d9);_0xad3360(_0x439fd1[_0x3584('0x14')](0x1f4,_0x2fb3d2[_0x3584('0x16')]));});});}; \ No newline at end of file +var _0x2e56=['where','sequelize','literal','outboundQueuePauses','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','defaults','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','request','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw'];(function(_0x29e205,_0x4e527f){var _0x59a933=function(_0x1be21a){while(--_0x1be21a){_0x29e205['push'](_0x29e205['shift']());}};_0x59a933(++_0x4e527f);}(_0x2e56,0xb4));var _0x62e5=function(_0x5c2c72,_0x22cf09){_0x5c2c72=_0x5c2c72-0x0;var _0x11c44c=_0x2e56[_0x5c2c72];return _0x11c44c;};'use strict';var _=require(_0x62e5('0x0'));var util=require(_0x62e5('0x1'));var moment=require(_0x62e5('0x2'));var BPromise=require(_0x62e5('0x3'));var rs=require(_0x62e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62e5('0x5'))['db'];var utils=require(_0x62e5('0x6'));var logger=require('../../config/logger')(_0x62e5('0x7'));var config=require(_0x62e5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x62e5('0x9')]['http']({'port':0x232a});config['redis']=_[_0x62e5('0xa')](config['redis'],{'host':_0x62e5('0xb'),'port':0x18eb});var socket=require(_0x62e5('0xc'))(new Redis(config[_0x62e5('0xd')]));require(_0x62e5('0xe'))[_0x62e5('0xf')](socket);function respondWithRpcPromise(_0x593a12,_0x446926,_0x4c89d3){return new BPromise(function(_0x33743b,_0x330e9f){return client[_0x62e5('0x10')](_0x593a12,_0x4c89d3)['then'](function(_0x52ce1d){logger[_0x62e5('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x446926,'request\x20sent');logger[_0x62e5('0x12')](_0x62e5('0x13'),_0x446926,_0x62e5('0x14'),JSON['stringify'](_0x52ce1d));if(_0x52ce1d[_0x62e5('0x15')]){if(_0x52ce1d[_0x62e5('0x15')][_0x62e5('0x16')]===0x1f4){logger['error'](_0x62e5('0x17'),_0x446926,_0x52ce1d[_0x62e5('0x15')]['message']);return _0x330e9f(_0x52ce1d[_0x62e5('0x15')][_0x62e5('0x18')]);}logger[_0x62e5('0x15')](_0x62e5('0x17'),_0x446926,_0x52ce1d['error']['message']);return _0x33743b(_0x52ce1d[_0x62e5('0x15')][_0x62e5('0x18')]);}else{logger[_0x62e5('0x11')](_0x62e5('0x17'),_0x446926,'request\x20sent');_0x33743b(_0x52ce1d['result'][_0x62e5('0x18')]);}})[_0x62e5('0x19')](function(_0x19b587){logger[_0x62e5('0x15')](_0x62e5('0x17'),_0x446926,_0x19b587);_0x330e9f(_0x19b587);});});}exports[_0x62e5('0x1a')]=function(_0x44c5bf){var _0x5eddb7=this;return new Promise(function(_0x5fc1fa,_0x446914){return db[_0x62e5('0x1b')]['findAll']({'raw':_0x44c5bf['options']?_0x44c5bf[_0x62e5('0x1c')][_0x62e5('0x1d')]===undefined?!![]:![]:!![],'where':_0x44c5bf[_0x62e5('0x1c')]?_0x44c5bf[_0x62e5('0x1c')][_0x62e5('0x1e')]||null:null,'attributes':[[db[_0x62e5('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x62e5('0x1f')][_0x62e5('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),_0x62e5('0x21')]]})['then'](function(_0x22b8d7){logger[_0x62e5('0x11')]('GetVoiceQueueRtPauses',_0x44c5bf);logger[_0x62e5('0x12')](_0x62e5('0x1a'),_0x44c5bf,JSON[_0x62e5('0x22')](_0x22b8d7));_0x5fc1fa(_0x22b8d7);})[_0x62e5('0x19')](function(_0x123cc6){logger[_0x62e5('0x15')](_0x62e5('0x1a'),_0x123cc6[_0x62e5('0x18')],_0x44c5bf);_0x446914(_0x5eddb7[_0x62e5('0x15')](0x1f4,_0x123cc6[_0x62e5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 5017b96..8a18500 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 _0xc9b9=['remove','update','length'];(function(_0x36afd7,_0x1181dc){var _0x2e0da0=function(_0x2254e1){while(--_0x2254e1){_0x36afd7['push'](_0x36afd7['shift']());}};_0x2e0da0(++_0x1181dc);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0xc9b9[_0x56e4e7];return _0x383618;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x9c9b('0x0'),_0x9c9b('0x1')];function createListener(_0x3418ab,_0x4e2e8d){return function(_0x5ee8f8){_0x4e2e8d['emit'](_0x3418ab,_0x5ee8f8);};}function removeListener(_0x497d53,_0x38a64b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x497d53,_0x38a64b);};}exports['register']=function(_0x51abae){for(var _0x1f29f3=0x0,_0x15d94b=events[_0x9c9b('0x2')];_0x1f29f3<_0x15d94b;_0x1f29f3++){var _0x193305=events[_0x1f29f3];var _0xbbd998=createListener('userVoiceQueueRt:'+_0x193305,_0x51abae);UserVoiceQueueRtEvents['on'](_0x193305,_0xbbd998);}}; \ No newline at end of file +var _0xfd87=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','length','userVoiceQueueRt:'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0x7fd8('0x0'));var events=[_0x7fd8('0x1'),_0x7fd8('0x2'),_0x7fd8('0x3')];function createListener(_0x11b128,_0x15d25f){return function(_0x2631d9){_0x15d25f[_0x7fd8('0x4')](_0x11b128,_0x2631d9);};}function removeListener(_0x4429f2,_0x43b442){return function(){UserVoiceQueueRtEvents[_0x7fd8('0x5')](_0x4429f2,_0x43b442);};}exports['register']=function(_0x1395b6){for(var _0x10a778=0x0,_0x55681d=events[_0x7fd8('0x6')];_0x10a778<_0x55681d;_0x10a778++){var _0x6eaf96=events[_0x10a778];var _0x2e2d74=createListener(_0x7fd8('0x7')+_0x6eaf96,_0x1395b6);UserVoiceQueueRtEvents['on'](_0x6eaf96,_0x2e2d74);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 0371e56..37e6974 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(_0x58aa39,_0x1aa0a4){var _0x4f8e52=function(_0x1aa610){while(--_0x1aa610){_0x58aa39['push'](_0x58aa39['shift']());}};_0x4f8e52(++_0x1aa0a4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0xcb91[_0x325501];return _0x2c1626;};'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(_0x273f77,_0xe5b0cb){var _0x71e147=function(_0x564056){while(--_0x564056){_0x273f77['push'](_0x273f77['shift']());}};_0x71e147(++_0xe5b0cb);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a7152ac..65e8be4 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 _0xe67e=['exports','INTEGER'];(function(_0x1a8902,_0x8d7776){var _0x4585bd=function(_0x1e8824){while(--_0x1e8824){_0x1a8902['push'](_0x1a8902['shift']());}};_0x4585bd(++_0x8d7776);}(_0xe67e,0x142));var _0xee67=function(_0x23e8a1,_0x5e06ca){_0x23e8a1=_0x23e8a1-0x0;var _0x46ef5a=_0xe67e[_0x23e8a1];return _0x46ef5a;};'use strict';var Sequelize=require('sequelize');module[_0xee67('0x0')]={'penalty':{'type':Sequelize[_0xee67('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4371=['sequelize','exports'];(function(_0x159706,_0x57132e){var _0x1ed0a9=function(_0x588cd1){while(--_0x588cd1){_0x159706['push'](_0x159706['shift']());}};_0x1ed0a9(++_0x57132e);}(_0x4371,0x8a));var _0x1437=function(_0x4faa06,_0x2cd369){_0x4faa06=_0x4faa06-0x0;var _0x5b808a=_0x4371[_0x4faa06];return _0x5b808a;};'use strict';var Sequelize=require(_0x1437('0x0'));module[_0x1437('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 4914de4..8b49341 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 _0xbccb=['user_has_whatsapp_queues','lodash','util','api','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue'];(function(_0x12da97,_0x42a458){var _0x2d8ba3=function(_0x407ec3){while(--_0x407ec3){_0x12da97['push'](_0x12da97['shift']());}};_0x2d8ba3(++_0x42a458);}(_0xbccb,0xb1));var _0xbbcc=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0xbccb[_0x3c4f1f];return _0x19cb69;};'use strict';var _=require(_0xbbcc('0x0'));var util=require(_0xbbcc('0x1'));var logger=require('../../config/logger')(_0xbbcc('0x2'));var moment=require('moment');var BPromise=require(_0xbbcc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbcc('0x4'));var rimraf=require(_0xbbcc('0x5'));var config=require(_0xbbcc('0x6'));var attributes=require(_0xbbcc('0x7'));module[_0xbbcc('0x8')]=function(_0x86b5b0,_0x3b9358){return _0x86b5b0['define'](_0xbbcc('0x9'),attributes,{'tableName':_0xbbcc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56c1=['request-promise','rimraf','../../config/environment','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x475aa9,_0x439aab){var _0x360bbc=function(_0x331a22){while(--_0x331a22){_0x475aa9['push'](_0x475aa9['shift']());}};_0x360bbc(++_0x439aab);}(_0x56c1,0x1ea));var _0x156c=function(_0x11ee3c,_0x51803c){_0x11ee3c=_0x11ee3c-0x0;var _0x10488e=_0x56c1[_0x11ee3c];return _0x10488e;};'use strict';var _=require(_0x156c('0x0'));var util=require('util');var logger=require(_0x156c('0x1'))(_0x156c('0x2'));var moment=require(_0x156c('0x3'));var BPromise=require(_0x156c('0x4'));var rp=require(_0x156c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x156c('0x6'));var config=require(_0x156c('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x156c('0x8')]=function(_0x235546,_0x52fa7a){return _0x235546['define'](_0x156c('0x9'),attributes,{'tableName':_0x156c('0xa'),'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 6a718e2..c6bbee5 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 _0x15cf=['error','message','UserWhatsappQueue,\x20%s,\x20%s','info','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','request\x20sent','stringify'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x15cf,0xd2));var _0xf15c=function(_0x32d414,_0x4d23da){_0x32d414=_0x32d414-0x0;var _0x4e0bca=_0x15cf[_0x32d414];return _0x4e0bca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf15c('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf15c('0x1'));var db=require(_0xf15c('0x2'))['db'];var utils=require(_0xf15c('0x3'));var logger=require(_0xf15c('0x4'))('rpc');var config=require(_0xf15c('0x5'));var jayson=require(_0xf15c('0x6'));var client=jayson['client'][_0xf15c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1302e3,_0xbe39e4,_0x458a16){return new BPromise(function(_0x396909,_0x3116c1){return client[_0xf15c('0x8')](_0x1302e3,_0x458a16)['then'](function(_0x5a0801){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0xbe39e4,'request\x20sent');logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0xbe39e4,_0xf15c('0x9'),JSON[_0xf15c('0xa')](_0x5a0801));if(_0x5a0801[_0xf15c('0xb')]){if(_0x5a0801['error']['code']===0x1f4){logger[_0xf15c('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0xbe39e4,_0x5a0801[_0xf15c('0xb')][_0xf15c('0xc')]);return _0x3116c1(_0x5a0801[_0xf15c('0xb')][_0xf15c('0xc')]);}logger[_0xf15c('0xb')](_0xf15c('0xd'),_0xbe39e4,_0x5a0801[_0xf15c('0xb')]['message']);return _0x396909(_0x5a0801[_0xf15c('0xb')][_0xf15c('0xc')]);}else{logger[_0xf15c('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0xbe39e4,_0xf15c('0x9'));_0x396909(_0x5a0801[_0xf15c('0xf')][_0xf15c('0xc')]);}})[_0xf15c('0x10')](function(_0xe51add){logger[_0xf15c('0xb')](_0xf15c('0xd'),_0xbe39e4,_0xe51add);_0x3116c1(_0xe51add);});});} \ No newline at end of file +var _0x6b55=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x14f5ed,_0x3fd34d){var _0x49f682=function(_0x42f660){while(--_0x42f660){_0x14f5ed['push'](_0x14f5ed['shift']());}};_0x49f682(++_0x3fd34d);}(_0x6b55,0xb6));var _0x56b5=function(_0x4e690c,_0x5cac7d){_0x4e690c=_0x4e690c-0x0;var _0x16779e=_0x6b55[_0x4e690c];return _0x16779e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x56b5('0x0'));var BPromise=require(_0x56b5('0x1'));var rs=require(_0x56b5('0x2'));var fs=require('fs');var Redis=require(_0x56b5('0x3'));var db=require(_0x56b5('0x4'))['db'];var utils=require(_0x56b5('0x5'));var logger=require('../../config/logger')(_0x56b5('0x6'));var config=require(_0x56b5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x56b5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a4389,_0x4b9f38,_0x12f1e9){return new BPromise(function(_0x3754f7,_0x42e588){return client['request'](_0x4a4389,_0x12f1e9)['then'](function(_0x3756c4){logger['info'](_0x56b5('0x9'),_0x4b9f38,_0x56b5('0xa'));logger[_0x56b5('0xb')](_0x56b5('0xc'),_0x4b9f38,_0x56b5('0xa'),JSON[_0x56b5('0xd')](_0x3756c4));if(_0x3756c4['error']){if(_0x3756c4[_0x56b5('0xe')][_0x56b5('0xf')]===0x1f4){logger[_0x56b5('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4b9f38,_0x3756c4['error'][_0x56b5('0x10')]);return _0x42e588(_0x3756c4[_0x56b5('0xe')]['message']);}logger['error'](_0x56b5('0x9'),_0x4b9f38,_0x3756c4[_0x56b5('0xe')]['message']);return _0x3754f7(_0x3756c4['error']['message']);}else{logger[_0x56b5('0x11')](_0x56b5('0x9'),_0x4b9f38,'request\x20sent');_0x3754f7(_0x3756c4[_0x56b5('0x12')][_0x56b5('0x10')]);}})[_0x56b5('0x13')](function(_0x359fe0){logger[_0x56b5('0xe')](_0x56b5('0x9'),_0x4b9f38,_0x359fe0);_0x42e588(_0x359fe0);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e91ef08..6e5d836 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 _0xe489=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./variable.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x35456d,_0x11a9aa){var _0x57b49d=function(_0x1743cd){while(--_0x1743cd){_0x35456d['push'](_0x35456d['shift']());}};_0x57b49d(++_0x11a9aa);}(_0xe489,0x9e));var _0x9e48=function(_0x4b879b,_0x3c6bc0){_0x4b879b=_0x4b879b-0x0;var _0x5030ee=_0xe489[_0x4b879b];return _0x5030ee;};'use strict';var multer=require(_0x9e48('0x0'));var util=require(_0x9e48('0x1'));var path=require('path');var timeout=require(_0x9e48('0x2'));var express=require(_0x9e48('0x3'));var router=express[_0x9e48('0x4')]();var fs_extra=require(_0x9e48('0x5'));var auth=require(_0x9e48('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e48('0x7'));router['get']('/',auth[_0x9e48('0x8')](),controller[_0x9e48('0x9')]);router[_0x9e48('0xa')](_0x9e48('0xb'),auth['isAuthenticated'](),controller[_0x9e48('0xc')]);router[_0x9e48('0xd')]('/',auth[_0x9e48('0x8')](),controller[_0x9e48('0xe')]);router[_0x9e48('0xf')]('/:id',auth[_0x9e48('0x8')](),controller[_0x9e48('0x10')]);router[_0x9e48('0x11')](_0x9e48('0xb'),auth['isAuthenticated'](),controller[_0x9e48('0x12')]);module[_0x9e48('0x13')]=router; \ No newline at end of file +var _0x0eaa=['update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','isAuthenticated','show','create','put','/:id'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x3ba689,_0x4d91cc){_0x3ba689=_0x3ba689-0x0;var _0x7d1610=_0x0eaa[_0x3ba689];return _0x7d1610;};'use strict';var multer=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa0ea('0x2'));var router=express[_0xa0ea('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa0ea('0x4'));var interaction=require(_0xa0ea('0x5'));var config=require(_0xa0ea('0x6'));var controller=require(_0xa0ea('0x7'));router[_0xa0ea('0x8')]('/',auth['isAuthenticated'](),controller[_0xa0ea('0x9')]);router['get']('/:id',auth[_0xa0ea('0xa')](),controller[_0xa0ea('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa0ea('0xc')]);router[_0xa0ea('0xd')](_0xa0ea('0xe'),auth[_0xa0ea('0xa')](),controller[_0xa0ea('0xf')]);router['delete'](_0xa0ea('0xe'),auth[_0xa0ea('0xa')](),controller[_0xa0ea('0x10')]);module[_0xa0ea('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d72d4cd..710ebc4 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 _0xf45b=['STRING','name','sequelize','exports'];(function(_0x1f6b83,_0x5dd034){var _0x4d13e7=function(_0x4ec6c5){while(--_0x4ec6c5){_0x1f6b83['push'](_0x1f6b83['shift']());}};_0x4d13e7(++_0x5dd034);}(_0xf45b,0x13e));var _0xbf45=function(_0x23b106,_0x50acec){_0x23b106=_0x23b106-0x0;var _0x3c88e5=_0xf45b[_0x23b106];return _0x3c88e5;};'use strict';var Sequelize=require(_0xbf45('0x0'));module[_0xbf45('0x1')]={'name':{'type':Sequelize[_0xbf45('0x2')],'unique':_0xbf45('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4764=['exports','STRING','name','sequelize'];(function(_0x406ba7,_0x26e941){var _0x5e4c79=function(_0x4c4f6a){while(--_0x4c4f6a){_0x406ba7['push'](_0x406ba7['shift']());}};_0x5e4c79(++_0x26e941);}(_0x4764,0x14f));var _0x4476=function(_0x697334,_0x4f4abd){_0x697334=_0x697334-0x0;var _0x53f900=_0x4764[_0x697334];return _0x53f900;};'use strict';var Sequelize=require(_0x4476('0x0'));module[_0x4476('0x1')]={'name':{'type':Sequelize[_0x4476('0x2')],'unique':_0x4476('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index f5b8f6b..fdfad3e 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 _0x2b02=['send','index','Variable','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name'];(function(_0x23a8b4,_0x2d005d){var _0x2c2e70=function(_0x3cf3ca){while(--_0x3cf3ca){_0x23a8b4['push'](_0x23a8b4['shift']());}};_0x2c2e70(++_0x2d005d);}(_0x2b02,0x177));var _0x22b0=function(_0xfb7376,_0x533f35){_0xfb7376=_0xfb7376-0x0;var _0x177286=_0x2b02[_0xfb7376];return _0x177286;};'use strict';var emlformat=require(_0x22b0('0x0'));var rimraf=require(_0x22b0('0x1'));var zipdir=require(_0x22b0('0x2'));var jsonpatch=require(_0x22b0('0x3'));var rp=require(_0x22b0('0x4'));var moment=require(_0x22b0('0x5'));var BPromise=require(_0x22b0('0x6'));var Mustache=require(_0x22b0('0x7'));var util=require(_0x22b0('0x8'));var path=require(_0x22b0('0x9'));var sox=require(_0x22b0('0xa'));var csv=require(_0x22b0('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22b0('0xc'));var _=require(_0x22b0('0xd'));var squel=require(_0x22b0('0xe'));var crypto=require(_0x22b0('0xf'));var jsforce=require(_0x22b0('0x10'));var deskjs=require(_0x22b0('0x11'));var toCsv=require(_0x22b0('0xb'));var querystring=require('querystring');var Papa=require(_0x22b0('0x12'));var Redis=require(_0x22b0('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x22b0('0x14'));var hardwareService=require(_0x22b0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x22b0('0x16'));var config=require(_0x22b0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf6f798,_0x157d82){_0x157d82=_0x157d82||0xcc;return function(_0x3c0f17){if(_0x3c0f17){return _0xf6f798[_0x22b0('0x18')](_0x157d82);}return _0xf6f798['status'](_0x157d82)[_0x22b0('0x19')]();};}function respondWithResult(_0x758835,_0x4c47bf){_0x4c47bf=_0x4c47bf||0xc8;return function(_0x5e5c13){if(_0x5e5c13){return _0x758835[_0x22b0('0x1a')](_0x4c47bf)[_0x22b0('0x1b')](_0x5e5c13);}};}function respondWithFilteredResult(_0x3fd552,_0x45e99a){return function(_0x30a53a){if(_0x30a53a){var _0x3de6b3=typeof _0x45e99a['offset']==='undefined'&&typeof _0x45e99a[_0x22b0('0x1c')]===_0x22b0('0x1d');var _0x5c6554=_0x30a53a[_0x22b0('0x1e')];var _0x43af23=_0x3de6b3?0x0:_0x45e99a[_0x22b0('0x1f')];var _0x1797ef=_0x3de6b3?_0x30a53a[_0x22b0('0x1e')]:_0x45e99a[_0x22b0('0x1f')]+_0x45e99a[_0x22b0('0x1c')];var _0x324c43;if(_0x1797ef>=_0x5c6554){_0x1797ef=_0x5c6554;_0x324c43=0xc8;}else{_0x324c43=0xce;}_0x3fd552['status'](_0x324c43);return _0x3fd552['set'](_0x22b0('0x20'),_0x43af23+'-'+_0x1797ef+'/'+_0x5c6554)[_0x22b0('0x1b')](_0x30a53a);}return null;};}function patchUpdates(_0x89818b){return function(_0xd94a4b){try{jsonpatch[_0x22b0('0x21')](_0xd94a4b,_0x89818b,!![]);}catch(_0xf2f40b){return BPromise[_0x22b0('0x22')](_0xf2f40b);}return _0xd94a4b[_0x22b0('0x23')]();};}function saveUpdates(_0x2e5c63,_0x16574b){return function(_0x21a5c1){if(_0x21a5c1){return _0x21a5c1[_0x22b0('0x24')](_0x2e5c63)[_0x22b0('0x25')](function(_0x3b3a22){return _0x3b3a22;});}return null;};}function removeEntity(_0x373f1a,_0x233027){return function(_0x4e6f26){if(_0x4e6f26){return _0x4e6f26[_0x22b0('0x26')]()[_0x22b0('0x25')](function(){var _0x1e8351=_0x4e6f26[_0x22b0('0x27')]({'plain':!![]});var _0x36f3a7=_0x22b0('0x28');return db[_0x22b0('0x29')][_0x22b0('0x26')]({'where':{'type':_0x36f3a7,'resourceId':_0x1e8351['id']}})[_0x22b0('0x25')](function(){return _0x4e6f26;});})[_0x22b0('0x25')](function(){_0x373f1a['status'](0xcc)[_0x22b0('0x19')]();});}};}function handleEntityNotFound(_0x4ee591,_0x337134){return function(_0x3c7bb5){if(!_0x3c7bb5){_0x4ee591[_0x22b0('0x18')](0x194);}return _0x3c7bb5;};}function handleError(_0x2eff89,_0x34250e){_0x34250e=_0x34250e||0x1f4;return function(_0x379fcc){logger[_0x22b0('0x2a')](_0x379fcc[_0x22b0('0x2b')]);if(_0x379fcc[_0x22b0('0x2c')]){delete _0x379fcc[_0x22b0('0x2c')];}_0x2eff89[_0x22b0('0x1a')](_0x34250e)[_0x22b0('0x2d')](_0x379fcc);};}exports[_0x22b0('0x2e')]=function(_0x13420c,_0x4da144){var _0x196121={},_0x3f4628={},_0x25fb3d={'count':0x0,'rows':[]};var _0x4272f5=_['map'](db[_0x22b0('0x2f')][_0x22b0('0x30')],function(_0x2cecc9){return{'name':_0x2cecc9[_0x22b0('0x31')],'type':_0x2cecc9[_0x22b0('0x32')]['key']};});_0x3f4628[_0x22b0('0x33')]=_[_0x22b0('0x34')](_0x4272f5,_0x22b0('0x2c'));_0x3f4628[_0x22b0('0x35')]=_[_0x22b0('0x36')](_0x13420c['query']);_0x3f4628[_0x22b0('0x37')]=_[_0x22b0('0x38')](_0x3f4628[_0x22b0('0x33')],_0x3f4628[_0x22b0('0x35')]);_0x196121[_0x22b0('0x39')]=_[_0x22b0('0x38')](_0x3f4628[_0x22b0('0x33')],qs[_0x22b0('0x3a')](_0x13420c[_0x22b0('0x35')][_0x22b0('0x3a')]));_0x196121[_0x22b0('0x39')]=_0x196121[_0x22b0('0x39')]['length']?_0x196121[_0x22b0('0x39')]:_0x3f4628[_0x22b0('0x33')];if(!_0x13420c[_0x22b0('0x35')][_0x22b0('0x3b')](_0x22b0('0x3c'))){_0x196121['limit']=qs[_0x22b0('0x1c')](_0x13420c[_0x22b0('0x35')][_0x22b0('0x1c')]);_0x196121[_0x22b0('0x1f')]=qs[_0x22b0('0x1f')](_0x13420c[_0x22b0('0x35')][_0x22b0('0x1f')]);}_0x196121['order']=qs[_0x22b0('0x3d')](_0x13420c[_0x22b0('0x35')][_0x22b0('0x3d')]);_0x196121[_0x22b0('0x3e')]=qs[_0x22b0('0x37')](_[_0x22b0('0x3f')](_0x13420c[_0x22b0('0x35')],_0x3f4628['filters']),_0x4272f5);if(_0x13420c[_0x22b0('0x35')][_0x22b0('0x40')]){_0x196121[_0x22b0('0x3e')]=_[_0x22b0('0x41')](_0x196121[_0x22b0('0x3e')],{'$or':_[_0x22b0('0x34')](_0x4272f5,function(_0x40b55b){if(_0x40b55b[_0x22b0('0x32')]!==_0x22b0('0x42')){var _0x2a6e94={};_0x2a6e94[_0x40b55b[_0x22b0('0x2c')]]={'$like':'%'+_0x13420c[_0x22b0('0x35')]['filter']+'%'};return _0x2a6e94;}})});}_0x196121=_['merge']({},_0x196121,_0x13420c[_0x22b0('0x43')]);var _0xf3fc2c={'where':_0x196121[_0x22b0('0x3e')]};return db[_0x22b0('0x2f')]['count'](_0xf3fc2c)[_0x22b0('0x25')](function(_0x13b573){_0x25fb3d['count']=_0x13b573;if(_0x13420c[_0x22b0('0x35')]['includeAll']){_0x196121[_0x22b0('0x44')]=[{'all':!![]}];}return db[_0x22b0('0x2f')][_0x22b0('0x45')](_0x196121);})[_0x22b0('0x25')](function(_0x3a2327){_0x25fb3d[_0x22b0('0x46')]=_0x3a2327;return _0x25fb3d;})[_0x22b0('0x25')](respondWithFilteredResult(_0x4da144,_0x196121))[_0x22b0('0x47')](handleError(_0x4da144,null));};exports[_0x22b0('0x48')]=function(_0x20d557,_0x16d110){var _0x5eb7a3={'raw':!![],'where':{'id':_0x20d557['params']['id']}},_0x4855dd={};_0x4855dd[_0x22b0('0x33')]=_[_0x22b0('0x36')](db[_0x22b0('0x2f')]['rawAttributes']);_0x4855dd[_0x22b0('0x35')]=_[_0x22b0('0x36')](_0x20d557[_0x22b0('0x35')]);_0x4855dd[_0x22b0('0x37')]=_['intersection'](_0x4855dd[_0x22b0('0x33')],_0x4855dd[_0x22b0('0x35')]);_0x5eb7a3[_0x22b0('0x39')]=_[_0x22b0('0x38')](_0x4855dd[_0x22b0('0x33')],qs[_0x22b0('0x3a')](_0x20d557['query'][_0x22b0('0x3a')]));_0x5eb7a3[_0x22b0('0x39')]=_0x5eb7a3[_0x22b0('0x39')][_0x22b0('0x49')]?_0x5eb7a3['attributes']:_0x4855dd[_0x22b0('0x33')];if(_0x20d557[_0x22b0('0x35')][_0x22b0('0x4a')]){_0x5eb7a3['include']=[{'all':!![]}];}_0x5eb7a3=_['merge']({},_0x5eb7a3,_0x20d557[_0x22b0('0x43')]);return db[_0x22b0('0x2f')][_0x22b0('0x4b')](_0x5eb7a3)[_0x22b0('0x25')](handleEntityNotFound(_0x16d110,null))[_0x22b0('0x25')](respondWithResult(_0x16d110,null))[_0x22b0('0x47')](handleError(_0x16d110,null));};exports[_0x22b0('0x4c')]=function(_0x31c436,_0x4f13ea){return db[_0x22b0('0x2f')][_0x22b0('0x4c')](_0x31c436['body'],{})[_0x22b0('0x25')](function(_0x658579){var _0x1c64aa=_0x31c436[_0x22b0('0x4d')]['get']({'plain':!![]});if(!_0x1c64aa)throw new Error(_0x22b0('0x4e'));if(_0x1c64aa[_0x22b0('0x4f')]===_0x22b0('0x4d')){var _0x3ddd46=_0x658579[_0x22b0('0x27')]({'plain':!![]});var _0x3e8711='Variables';return db['UserProfileSection'][_0x22b0('0x4b')]({'where':{'name':_0x3e8711,'userProfileId':_0x1c64aa['userProfileId']},'raw':!![]})[_0x22b0('0x25')](function(_0x19aa7c){if(_0x19aa7c&&_0x19aa7c[_0x22b0('0x50')]===0x0){return db[_0x22b0('0x29')]['create']({'name':_0x3ddd46[_0x22b0('0x2c')],'resourceId':_0x3ddd46['id'],'type':_0x19aa7c[_0x22b0('0x2c')],'sectionId':_0x19aa7c['id']},{})[_0x22b0('0x25')](function(){return _0x658579;});}else{return _0x658579;}})[_0x22b0('0x47')](function(_0x45573f){logger['error'](_0x22b0('0x51'),_0x45573f);throw _0x45573f;});}return _0x658579;})[_0x22b0('0x25')](respondWithResult(_0x4f13ea,0xc9))['catch'](handleError(_0x4f13ea,null));};exports['update']=function(_0x2aac3a,_0x3fcf06){if(_0x2aac3a['body']['id']){delete _0x2aac3a['body']['id'];}return db[_0x22b0('0x2f')][_0x22b0('0x4b')]({'where':{'id':_0x2aac3a[_0x22b0('0x52')]['id']}})[_0x22b0('0x25')](handleEntityNotFound(_0x3fcf06,null))[_0x22b0('0x25')](saveUpdates(_0x2aac3a[_0x22b0('0x53')],null))[_0x22b0('0x25')](respondWithResult(_0x3fcf06,null))[_0x22b0('0x47')](handleError(_0x3fcf06,null));};exports[_0x22b0('0x26')]=function(_0x3379e8,_0x3fdee9){return db[_0x22b0('0x2f')]['find']({'where':{'id':_0x3379e8[_0x22b0('0x52')]['id']}})[_0x22b0('0x25')](handleEntityNotFound(_0x3fdee9,null))[_0x22b0('0x25')](removeEntity(_0x3fdee9,null))[_0x22b0('0x47')](handleError(_0x3fdee9,null));}; \ No newline at end of file +var _0x4589=['keys','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','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','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','Variables','UserProfileResource','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','Variable','findAll','rows','catch','show','params'];(function(_0x514038,_0x450ef3){var _0x589720=function(_0x1a356f){while(--_0x1a356f){_0x514038['push'](_0x514038['shift']());}};_0x589720(++_0x450ef3);}(_0x4589,0x16b));var _0x9458=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4589[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x9458('0x0'));var rimraf=require(_0x9458('0x1'));var zipdir=require(_0x9458('0x2'));var jsonpatch=require(_0x9458('0x3'));var rp=require(_0x9458('0x4'));var moment=require(_0x9458('0x5'));var BPromise=require(_0x9458('0x6'));var Mustache=require(_0x9458('0x7'));var util=require('util');var path=require(_0x9458('0x8'));var sox=require(_0x9458('0x9'));var csv=require(_0x9458('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9458('0xb'));var squel=require(_0x9458('0xc'));var crypto=require(_0x9458('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9458('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9458('0xf'));var Papa=require(_0x9458('0x10'));var Redis=require(_0x9458('0x11'));var authService=require(_0x9458('0x12'));var qs=require(_0x9458('0x13'));var as=require(_0x9458('0x14'));var hardwareService=require(_0x9458('0x15'));var logger=require(_0x9458('0x16'))(_0x9458('0x17'));var utils=require(_0x9458('0x18'));var config=require(_0x9458('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9458('0x1a'))['db'];function respondWithStatusCode(_0xc6f4c9,_0xb54c20){_0xb54c20=_0xb54c20||0xcc;return function(_0x2a087c){if(_0x2a087c){return _0xc6f4c9[_0x9458('0x1b')](_0xb54c20);}return _0xc6f4c9[_0x9458('0x1c')](_0xb54c20)[_0x9458('0x1d')]();};}function respondWithResult(_0x4dc3dc,_0xe608ab){_0xe608ab=_0xe608ab||0xc8;return function(_0x52aeec){if(_0x52aeec){return _0x4dc3dc['status'](_0xe608ab)[_0x9458('0x1e')](_0x52aeec);}};}function respondWithFilteredResult(_0x5d5002,_0x441d0e){return function(_0xbd5cdd){if(_0xbd5cdd){var _0x496481=typeof _0x441d0e[_0x9458('0x1f')]==='undefined'&&typeof _0x441d0e['limit']==='undefined';var _0x849d12=_0xbd5cdd[_0x9458('0x20')];var _0x27706b=_0x496481?0x0:_0x441d0e[_0x9458('0x1f')];var _0x5c426b=_0x496481?_0xbd5cdd[_0x9458('0x20')]:_0x441d0e[_0x9458('0x1f')]+_0x441d0e[_0x9458('0x21')];var _0x4b507f;if(_0x5c426b>=_0x849d12){_0x5c426b=_0x849d12;_0x4b507f=0xc8;}else{_0x4b507f=0xce;}_0x5d5002['status'](_0x4b507f);return _0x5d5002[_0x9458('0x22')](_0x9458('0x23'),_0x27706b+'-'+_0x5c426b+'/'+_0x849d12)[_0x9458('0x1e')](_0xbd5cdd);}return null;};}function patchUpdates(_0x42049c){return function(_0x1e3bf0){try{jsonpatch[_0x9458('0x24')](_0x1e3bf0,_0x42049c,!![]);}catch(_0x4cd32b){return BPromise[_0x9458('0x25')](_0x4cd32b);}return _0x1e3bf0['save']();};}function saveUpdates(_0x105784,_0x52c426){return function(_0x39fecb){if(_0x39fecb){return _0x39fecb[_0x9458('0x26')](_0x105784)['then'](function(_0x46e686){return _0x46e686;});}return null;};}function removeEntity(_0x245d5c,_0x4ae3d5){return function(_0x1d175a){if(_0x1d175a){return _0x1d175a['destroy']()['then'](function(){var _0x4b56d3=_0x1d175a['get']({'plain':!![]});var _0x41dac8=_0x9458('0x27');return db[_0x9458('0x28')][_0x9458('0x29')]({'where':{'type':_0x41dac8,'resourceId':_0x4b56d3['id']}})['then'](function(){return _0x1d175a;});})[_0x9458('0x2a')](function(){_0x245d5c['status'](0xcc)[_0x9458('0x1d')]();});}};}function handleEntityNotFound(_0x38b8ff,_0x34bd26){return function(_0x51d666){if(!_0x51d666){_0x38b8ff['sendStatus'](0x194);}return _0x51d666;};}function handleError(_0x3670c3,_0x54b65a){_0x54b65a=_0x54b65a||0x1f4;return function(_0x36e4a6){logger[_0x9458('0x2b')](_0x36e4a6[_0x9458('0x2c')]);if(_0x36e4a6[_0x9458('0x2d')]){delete _0x36e4a6[_0x9458('0x2d')];}_0x3670c3['status'](_0x54b65a)[_0x9458('0x2e')](_0x36e4a6);};}exports[_0x9458('0x2f')]=function(_0x575f18,_0x91201b){var _0x5a12f5={},_0x287a7b={},_0x320051={'count':0x0,'rows':[]};var _0xefd7e3=_[_0x9458('0x30')](db['Variable'][_0x9458('0x31')],function(_0x1a183f){return{'name':_0x1a183f[_0x9458('0x32')],'type':_0x1a183f[_0x9458('0x33')][_0x9458('0x34')]};});_0x287a7b[_0x9458('0x35')]=_[_0x9458('0x30')](_0xefd7e3,_0x9458('0x2d'));_0x287a7b[_0x9458('0x36')]=_['keys'](_0x575f18[_0x9458('0x36')]);_0x287a7b[_0x9458('0x37')]=_['intersection'](_0x287a7b[_0x9458('0x35')],_0x287a7b['query']);_0x5a12f5[_0x9458('0x38')]=_[_0x9458('0x39')](_0x287a7b[_0x9458('0x35')],qs[_0x9458('0x3a')](_0x575f18[_0x9458('0x36')][_0x9458('0x3a')]));_0x5a12f5['attributes']=_0x5a12f5[_0x9458('0x38')][_0x9458('0x3b')]?_0x5a12f5[_0x9458('0x38')]:_0x287a7b[_0x9458('0x35')];if(!_0x575f18[_0x9458('0x36')][_0x9458('0x3c')](_0x9458('0x3d'))){_0x5a12f5[_0x9458('0x21')]=qs[_0x9458('0x21')](_0x575f18[_0x9458('0x36')][_0x9458('0x21')]);_0x5a12f5[_0x9458('0x1f')]=qs[_0x9458('0x1f')](_0x575f18[_0x9458('0x36')]['offset']);}_0x5a12f5[_0x9458('0x3e')]=qs[_0x9458('0x3f')](_0x575f18[_0x9458('0x36')]['sort']);_0x5a12f5['where']=qs[_0x9458('0x37')](_[_0x9458('0x40')](_0x575f18[_0x9458('0x36')],_0x287a7b[_0x9458('0x37')]),_0xefd7e3);if(_0x575f18['query'][_0x9458('0x41')]){_0x5a12f5[_0x9458('0x42')]=_[_0x9458('0x43')](_0x5a12f5[_0x9458('0x42')],{'$or':_[_0x9458('0x30')](_0xefd7e3,function(_0x5f1b7a){if(_0x5f1b7a[_0x9458('0x33')]!==_0x9458('0x44')){var _0x5d48e0={};_0x5d48e0[_0x5f1b7a['name']]={'$like':'%'+_0x575f18[_0x9458('0x36')][_0x9458('0x41')]+'%'};return _0x5d48e0;}})});}_0x5a12f5=_[_0x9458('0x43')]({},_0x5a12f5,_0x575f18[_0x9458('0x45')]);var _0x363953={'where':_0x5a12f5[_0x9458('0x42')]};return db['Variable']['count'](_0x363953)[_0x9458('0x2a')](function(_0xb12347){_0x320051[_0x9458('0x20')]=_0xb12347;if(_0x575f18[_0x9458('0x36')][_0x9458('0x46')]){_0x5a12f5['include']=[{'all':!![]}];}return db[_0x9458('0x47')][_0x9458('0x48')](_0x5a12f5);})['then'](function(_0x164ac2){_0x320051[_0x9458('0x49')]=_0x164ac2;return _0x320051;})['then'](respondWithFilteredResult(_0x91201b,_0x5a12f5))[_0x9458('0x4a')](handleError(_0x91201b,null));};exports[_0x9458('0x4b')]=function(_0x2a3866,_0x41e4fb){var _0x334bcd={'raw':!![],'where':{'id':_0x2a3866[_0x9458('0x4c')]['id']}},_0x406956={};_0x406956[_0x9458('0x35')]=_[_0x9458('0x4d')](db['Variable'][_0x9458('0x31')]);_0x406956['query']=_[_0x9458('0x4d')](_0x2a3866[_0x9458('0x36')]);_0x406956['filters']=_[_0x9458('0x39')](_0x406956[_0x9458('0x35')],_0x406956['query']);_0x334bcd[_0x9458('0x38')]=_['intersection'](_0x406956['model'],qs['fields'](_0x2a3866[_0x9458('0x36')]['fields']));_0x334bcd['attributes']=_0x334bcd[_0x9458('0x38')][_0x9458('0x3b')]?_0x334bcd[_0x9458('0x38')]:_0x406956[_0x9458('0x35')];if(_0x2a3866['query'][_0x9458('0x46')]){_0x334bcd[_0x9458('0x4e')]=[{'all':!![]}];}_0x334bcd=_[_0x9458('0x43')]({},_0x334bcd,_0x2a3866['options']);return db['Variable'][_0x9458('0x4f')](_0x334bcd)[_0x9458('0x2a')](handleEntityNotFound(_0x41e4fb,null))['then'](respondWithResult(_0x41e4fb,null))[_0x9458('0x4a')](handleError(_0x41e4fb,null));};exports['create']=function(_0x5ac5f8,_0x48f610){return db['Variable'][_0x9458('0x50')](_0x5ac5f8[_0x9458('0x51')],{})[_0x9458('0x2a')](function(_0x243d5a){var _0x57e864=_0x5ac5f8['user'][_0x9458('0x52')]({'plain':!![]});if(!_0x57e864)throw new Error(_0x9458('0x53'));if(_0x57e864['role']==='user'){var _0x4ce80f=_0x243d5a['get']({'plain':!![]});var _0x24a9c4='Variables';return db[_0x9458('0x54')][_0x9458('0x4f')]({'where':{'name':_0x24a9c4,'userProfileId':_0x57e864[_0x9458('0x55')]},'raw':!![]})[_0x9458('0x2a')](function(_0x63b86f){if(_0x63b86f&&_0x63b86f[_0x9458('0x56')]===0x0){return db[_0x9458('0x28')]['create']({'name':_0x4ce80f[_0x9458('0x2d')],'resourceId':_0x4ce80f['id'],'type':_0x63b86f[_0x9458('0x2d')],'sectionId':_0x63b86f['id']},{})[_0x9458('0x2a')](function(){return _0x243d5a;});}else{return _0x243d5a;}})[_0x9458('0x4a')](function(_0x1f7103){logger[_0x9458('0x2b')](_0x9458('0x57'),_0x1f7103);throw _0x1f7103;});}return _0x243d5a;})['then'](respondWithResult(_0x48f610,0xc9))[_0x9458('0x4a')](handleError(_0x48f610,null));};exports[_0x9458('0x26')]=function(_0x32235e,_0x3898a7){if(_0x32235e[_0x9458('0x51')]['id']){delete _0x32235e[_0x9458('0x51')]['id'];}return db['Variable'][_0x9458('0x4f')]({'where':{'id':_0x32235e[_0x9458('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3898a7,null))['then'](saveUpdates(_0x32235e[_0x9458('0x51')],null))[_0x9458('0x2a')](respondWithResult(_0x3898a7,null))[_0x9458('0x4a')](handleError(_0x3898a7,null));};exports[_0x9458('0x29')]=function(_0x370e87,_0x299142){return db[_0x9458('0x47')][_0x9458('0x4f')]({'where':{'id':_0x370e87[_0x9458('0x4c')]['id']}})[_0x9458('0x2a')](handleEntityNotFound(_0x299142,null))[_0x9458('0x2a')](removeEntity(_0x299142,null))['catch'](handleError(_0x299142,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2a96fa1..900310d 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 _0x98ae=['exports','Variable','lodash','util','api','moment','bluebird','path','../../config/environment','./variable.attributes'];(function(_0x10522f,_0x3d468b){var _0x5d0d4d=function(_0x20436e){while(--_0x20436e){_0x10522f['push'](_0x10522f['shift']());}};_0x5d0d4d(++_0x3d468b);}(_0x98ae,0x1ce));var _0xe98a=function(_0x41f4c8,_0x25d16d){_0x41f4c8=_0x41f4c8-0x0;var _0x1daa04=_0x98ae[_0x41f4c8];return _0x1daa04;};'use strict';var _=require(_0xe98a('0x0'));var util=require(_0xe98a('0x1'));var logger=require('../../config/logger')(_0xe98a('0x2'));var moment=require(_0xe98a('0x3'));var BPromise=require(_0xe98a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe98a('0x5'));var rimraf=require('rimraf');var config=require(_0xe98a('0x6'));var attributes=require(_0xe98a('0x7'));module[_0xe98a('0x8')]=function(_0x4adaa8,_0x774436){return _0x4adaa8['define'](_0xe98a('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e94=['util','../../config/logger','api','moment','request-promise','rimraf','./variable.attributes','exports','define','Variable','tools_variables','lodash'];(function(_0xeb762a,_0x5b2851){var _0x21db58=function(_0x189618){while(--_0x189618){_0xeb762a['push'](_0xeb762a['shift']());}};_0x21db58(++_0x5b2851);}(_0x5e94,0xa7));var _0x45e9=function(_0x3f1579,_0x174d65){_0x3f1579=_0x3f1579-0x0;var _0x126a3b=_0x5e94[_0x3f1579];return _0x126a3b;};'use strict';var _=require(_0x45e9('0x0'));var util=require(_0x45e9('0x1'));var logger=require(_0x45e9('0x2'))(_0x45e9('0x3'));var moment=require(_0x45e9('0x4'));var BPromise=require('bluebird');var rp=require(_0x45e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45e9('0x6'));var config=require('../../config/environment');var attributes=require(_0x45e9('0x7'));module[_0x45e9('0x8')]=function(_0x138450,_0x223982){return _0x138450[_0x45e9('0x9')](_0x45e9('0xa'),attributes,{'tableName':_0x45e9('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 85c5bf4..738db40 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 _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x17d9ba,_0x4d980c){var _0x46185d=function(_0x1dce47){while(--_0x1dce47){_0x17d9ba['push'](_0x17d9ba['shift']());}};_0x46185d(++_0x4d980c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x50ad95,_0x530cfe){var _0xfc94ee=function(_0x1e7720){while(--_0x1e7720){_0x50ad95['push'](_0x50ad95['shift']());}};_0xfc94ee(++_0x530cfe);}(_0x5fc3,0xa8));var _0x35fc=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x5fc3[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 26d70e1..db45a9c 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 _0x9ca7=['/fetch','isAuthenticated','canUpdate','fetch','/pull','pull','/restart','restart','exports','Router','get','index'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x9ca7,0x1dd));var _0x79ca=function(_0x512fd6,_0x378b1d){_0x512fd6=_0x512fd6-0x0;var _0x176714=_0x9ca7[_0x512fd6];return _0x176714;};'use strict';var express=require('express');var router=express[_0x79ca('0x0')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x79ca('0x1')]('/',controller[_0x79ca('0x2')]);router['get'](_0x79ca('0x3'),auth[_0x79ca('0x4')](),auth[_0x79ca('0x5')](),controller[_0x79ca('0x6')]);router[_0x79ca('0x1')]('/reset',auth[_0x79ca('0x4')](),auth[_0x79ca('0x5')](),controller['reset']);router[_0x79ca('0x1')](_0x79ca('0x7'),auth[_0x79ca('0x4')](),auth[_0x79ca('0x5')](),controller[_0x79ca('0x8')]);router['get'](_0x79ca('0x9'),auth[_0x79ca('0x4')](),controller[_0x79ca('0xa')]);router[_0x79ca('0x1')]('/migrations',controller['migrations']);module[_0x79ca('0xb')]=router; \ No newline at end of file +var _0x1bb2=['restart','/migrations','migrations','exports','express','Router','./version.controller','index','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull'];(function(_0x6523a0,_0x4f2762){var _0x513b80=function(_0x45bf03){while(--_0x45bf03){_0x6523a0['push'](_0x6523a0['shift']());}};_0x513b80(++_0x4f2762);}(_0x1bb2,0x1be));var _0x21bb=function(_0x4a791e,_0x3f294c){_0x4a791e=_0x4a791e-0x0;var _0x2bb81a=_0x1bb2[_0x4a791e];return _0x2bb81a;};'use strict';var express=require(_0x21bb('0x0'));var router=express[_0x21bb('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x21bb('0x2'));router['get']('/',controller[_0x21bb('0x3')]);router[_0x21bb('0x4')](_0x21bb('0x5'),auth[_0x21bb('0x6')](),auth[_0x21bb('0x7')](),controller[_0x21bb('0x8')]);router['get'](_0x21bb('0x9'),auth[_0x21bb('0x6')](),auth[_0x21bb('0x7')](),controller[_0x21bb('0xa')]);router[_0x21bb('0x4')](_0x21bb('0xb'),auth[_0x21bb('0x6')](),auth[_0x21bb('0x7')](),controller[_0x21bb('0xc')]);router['get']('/restart',auth['isAuthenticated'](),controller[_0x21bb('0xd')]);router[_0x21bb('0x4')](_0x21bb('0xe'),controller[_0x21bb('0xf')]);module[_0x21bb('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 98d2741..aedfed5 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 _0x318f=['../../config/environment','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','replace','.js','push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb'];(function(_0x317b7b,_0xcc3504){var _0x2aff44=function(_0x548ad7){while(--_0x548ad7){_0x317b7b['push'](_0x317b7b['shift']());}};_0x2aff44(++_0xcc3504);}(_0x318f,0xcc));var _0xf318=function(_0x2af354,_0x5461d6){_0x2af354=_0x2af354-0x0;var _0x5c3864=_0x318f[_0x2af354];return _0x5c3864;};'use strict';var Umzug=require(_0xf318('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xf318('0x1'));var pkginfo=require(_0xf318('0x2'))(module,_0xf318('0x3'));var compareVersions=require(_0xf318('0x4'));var exec=require(_0xf318('0x5'))[_0xf318('0x6')];var db=require(_0xf318('0x7'))['db'];var config=require(_0xf318('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xf318('0x9'))(_0xf318('0xa'));var git=require(_0xf318('0xb'))(config[_0xf318('0xc')]);exports[_0xf318('0xd')]=function(_0x37d264,_0x47490a){var _0x3bed2a={'current':module[_0xf318('0xe')][_0xf318('0x3')],'phonebar':0x2};if(_0x37d264[_0xf318('0xf')]&&_0x37d264['query'][_0xf318('0x10')]){return git[_0xf318('0x11')]()[_0xf318('0x12')](function(_0x18e1ac,_0x45e80e){_0x3bed2a[_0xf318('0x10')]=(_0x18e1ac?module[_0xf318('0xe')]['version']:_0x45e80e[_0xf318('0x10')])||'2.0.0';return _0x47490a[_0xf318('0x13')](0xc8)[_0xf318('0x14')](_0x3bed2a);});}else{return _0x47490a[_0xf318('0x13')](0xc8)[_0xf318('0x14')](_0x3bed2a);}};exports['fetch']=function(_0x24c06f,_0x1712e7){return git['fetch']([_0xf318('0x15'),_0xf318('0x16')],function(_0x243688){if(_0x243688){logger[_0xf318('0x17')](_0x243688);return _0x1712e7[_0xf318('0x13')](0x1f4)[_0xf318('0x14')](_0x243688);}logger['info'](_0xf318('0x18'));return _0x1712e7[_0xf318('0x13')](0xc8)[_0xf318('0x14')]({'output':_0xf318('0x19')});});};exports[_0xf318('0x1a')]=function(_0x4995ae,_0x139b23){return git[_0xf318('0x1a')]([_0xf318('0x1b'),_0xf318('0x1c')],function(_0x280918){if(_0x280918){logger[_0xf318('0x17')](_0x280918);return _0x139b23[_0xf318('0x13')](0x1f4)['json'](_0x280918);}logger[_0xf318('0x1d')](_0xf318('0x1e'));return _0x139b23[_0xf318('0x13')](0xc8)[_0xf318('0x14')]({'output':_0xf318('0x1f')});});};exports[_0xf318('0x20')]=function(_0x4d4b1d,_0x1f3c04){exec('npm\x20install\x20--production',function(_0x4662d5,_0x4e9a98,_0x575e41){logger[_0xf318('0x1d')](_0x4e9a98);logger[_0xf318('0x1d')](_0x575e41);if(_0x4662d5){logger[_0xf318('0x17')](_0x4662d5);return _0x1f3c04['status'](0x1f4)[_0xf318('0x14')](_0x4662d5);}return _0x1f3c04['status'](0xc8)[_0xf318('0x14')]({'output':_0x4e9a98});});};exports[_0xf318('0x21')]=function(_0x5b6071,_0x2aca43){return pm2[_0xf318('0x21')]('motion2')['then'](function(_0x3272b1){logger['info'](_0xf318('0x22'),_0x3272b1);return _0x2aca43['status'](0xc8)[_0xf318('0x14')]({'output':_0xf318('0x23')});})['catch'](function(_0x4d2392){logger[_0xf318('0x17')](_0x4d2392);return _0x2aca43[_0xf318('0x13')](0x1f4)[_0xf318('0x14')](_0x4d2392);});};exports[_0xf318('0x24')]=function(_0x2d73ea,_0x5d3014){var _0x4721b3=fs[_0xf318('0x25')](path[_0xf318('0x26')](config[_0xf318('0xc')],'server',_0xf318('0x24')));var _0x23688b=[];for(var _0x535472=0x0;_0x535472<_0x4721b3['length'];_0x535472++){var _0x385e3a=_0x4721b3[_0x535472][_0xf318('0x27')](_0xf318('0x28'),'');if(compareVersions(module[_0xf318('0xe')][_0xf318('0x3')],_0x385e3a)===-0x1){_0x23688b[_0xf318('0x29')](_0x385e3a);}}if(_0x23688b['length']){var _0x3347e8=_0x23688b['sort'](compareVersions);var _0x173c10=new Umzug({'storage':_0xf318('0x2a'),'storageOptions':{'model':db[_0xf318('0x2b')],'modelName':_0xf318('0x2b'),'columnName':_0xf318('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0xf318('0x2c')],function(){throw new Error(_0xf318('0x2d'));}],'path':path['join'](config[_0xf318('0xc')],_0xf318('0x2e'),_0xf318('0x24')),'pattern':/\.js$/}});_0x173c10['up']({'migrations':_['map'](_0x3347e8,function(_0x1f3d18){return _0x1f3d18+_0xf318('0x28');})})[_0xf318('0x2f')](function(){return _0x5d3014[_0xf318('0x13')](0xc8)[_0xf318('0x14')]({'output':_0xf318('0x30')+module[_0xf318('0xe')]['version']+_0xf318('0x31')+_[_0xf318('0x32')](_0x3347e8),'migrations':_[_0xf318('0x26')](_0x3347e8)});})['catch'](function(_0x50f70e){if(_0x50f70e instanceof db[_0xf318('0x2a')][_0xf318('0x33')]){return _0x5d3014[_0xf318('0x13')](0xc8)['json']({'output':_0xf318('0x34')});}else{return _0x5d3014[_0xf318('0x13')](0x1f4)[_0xf318('0x14')](_0x50f70e);}});}else{return _0x5d3014[_0xf318('0x13')](0xc8)[_0xf318('0x14')]({'output':_0xf318('0x34')});}}; \ No newline at end of file +var _0xc874=['query','latest','tags','2.0.0','json','status','fetch','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','replace','.js','exports','push','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','version'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc874,0x1a3));var _0x4c87=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0xc874[_0x6d6a66];return _0x11eb6e;};'use strict';var Umzug=require(_0x4c87('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x4c87('0x1'));var pkginfo=require(_0x4c87('0x2'))(module,'version');var compareVersions=require(_0x4c87('0x3'));var exec=require(_0x4c87('0x4'))['exec'];var db=require(_0x4c87('0x5'))['db'];var config=require(_0x4c87('0x6'));var pm2=require(_0x4c87('0x7'));var logger=require(_0x4c87('0x8'))('update');var git=require(_0x4c87('0x9'))(config[_0x4c87('0xa')]);exports[_0x4c87('0xb')]=function(_0x166917,_0x4d393c){var _0x2cd1f7={'current':module['exports'][_0x4c87('0xc')],'phonebar':0x2};if(_0x166917[_0x4c87('0xd')]&&_0x166917[_0x4c87('0xd')][_0x4c87('0xe')]){return git['fetch']()[_0x4c87('0xf')](function(_0x4a9a32,_0x855189){_0x2cd1f7[_0x4c87('0xe')]=(_0x4a9a32?module['exports'][_0x4c87('0xc')]:_0x855189['latest'])||_0x4c87('0x10');return _0x4d393c['status'](0xc8)[_0x4c87('0x11')](_0x2cd1f7);});}else{return _0x4d393c[_0x4c87('0x12')](0xc8)[_0x4c87('0x11')](_0x2cd1f7);}};exports[_0x4c87('0x13')]=function(_0x3036af,_0xfba3b1){return git['fetch']([_0x4c87('0x14'),_0x4c87('0x15')],function(_0x2d7d13){if(_0x2d7d13){logger[_0x4c87('0x16')](_0x2d7d13);return _0xfba3b1[_0x4c87('0x12')](0x1f4)['json'](_0x2d7d13);}logger[_0x4c87('0x17')]('git\x20fetch');return _0xfba3b1[_0x4c87('0x12')](0xc8)[_0x4c87('0x11')]({'output':_0x4c87('0x18')});});};exports[_0x4c87('0x19')]=function(_0x158394,_0x5ecccc){return git[_0x4c87('0x19')](['--hard',_0x4c87('0x1a')],function(_0x184b98){if(_0x184b98){logger[_0x4c87('0x16')](_0x184b98);return _0x5ecccc[_0x4c87('0x12')](0x1f4)[_0x4c87('0x11')](_0x184b98);}logger[_0x4c87('0x17')](_0x4c87('0x1b'));return _0x5ecccc[_0x4c87('0x12')](0xc8)[_0x4c87('0x11')]({'output':'git\x20reset\x20--hard'});});};exports[_0x4c87('0x1c')]=function(_0x2f138b,_0x525803){exec('npm\x20install\x20--production',function(_0x2145f3,_0x52e8d1,_0x87a385){logger[_0x4c87('0x17')](_0x52e8d1);logger[_0x4c87('0x17')](_0x87a385);if(_0x2145f3){logger[_0x4c87('0x16')](_0x2145f3);return _0x525803[_0x4c87('0x12')](0x1f4)['json'](_0x2145f3);}return _0x525803[_0x4c87('0x12')](0xc8)['json']({'output':_0x52e8d1});});};exports[_0x4c87('0x1d')]=function(_0x1a6ee0,_0x576165){return pm2[_0x4c87('0x1d')](_0x4c87('0x1e'))[_0x4c87('0x1f')](function(_0x33bd26){logger[_0x4c87('0x17')](_0x4c87('0x20'),_0x33bd26);return _0x576165[_0x4c87('0x12')](0xc8)[_0x4c87('0x11')]({'output':_0x4c87('0x21')});})[_0x4c87('0x22')](function(_0x17bcf0){logger[_0x4c87('0x16')](_0x17bcf0);return _0x576165[_0x4c87('0x12')](0x1f4)['json'](_0x17bcf0);});};exports[_0x4c87('0x23')]=function(_0x58ed96,_0x77496f){var _0x50bb60=fs[_0x4c87('0x24')](path[_0x4c87('0x25')](config[_0x4c87('0xa')],'server',_0x4c87('0x23')));var _0x476dee=[];for(var _0x59e9c3=0x0;_0x59e9c3<_0x50bb60[_0x4c87('0x26')];_0x59e9c3++){var _0x302337=_0x50bb60[_0x59e9c3][_0x4c87('0x27')](_0x4c87('0x28'),'');if(compareVersions(module[_0x4c87('0x29')]['version'],_0x302337)===-0x1){_0x476dee[_0x4c87('0x2a')](_0x302337);}}if(_0x476dee[_0x4c87('0x26')]){var _0x3cf027=_0x476dee['sort'](compareVersions);var _0x243c8a=new Umzug({'storage':_0x4c87('0x2b'),'storageOptions':{'model':db[_0x4c87('0x2c')],'modelName':'Migration','columnName':_0x4c87('0xc')},'migrations':{'params':[db['sequelize'][_0x4c87('0x2d')](),db['sequelize']['constructor'],function(){throw new Error(_0x4c87('0x2e'));}],'path':path[_0x4c87('0x25')](config[_0x4c87('0xa')],_0x4c87('0x2f'),_0x4c87('0x23')),'pattern':/\.js$/}});_0x243c8a['up']({'migrations':_[_0x4c87('0x30')](_0x3cf027,function(_0x5ac7ef){return _0x5ac7ef+_0x4c87('0x28');})})['then'](function(){return _0x77496f[_0x4c87('0x12')](0xc8)['json']({'output':_0x4c87('0x31')+module['exports'][_0x4c87('0xc')]+_0x4c87('0x32')+_[_0x4c87('0x33')](_0x3cf027),'migrations':_[_0x4c87('0x25')](_0x3cf027)});})[_0x4c87('0x22')](function(_0x1ac02d){if(_0x1ac02d instanceof db[_0x4c87('0x2b')][_0x4c87('0x34')]){return _0x77496f[_0x4c87('0x12')](0xc8)[_0x4c87('0x11')]({'output':_0x4c87('0x35')});}else{return _0x77496f[_0x4c87('0x12')](0x1f4)['json'](_0x1ac02d);}});}else{return _0x77496f['status'](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 85aa59a..0f40bf4 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 _0x4917=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceAgentReport.controller','isAuthenticated','index','/describe','get','/:id','post','create','update','destroy','exports','multer'];(function(_0x373951,_0x2e37d1){var _0x2e9074=function(_0x35fba7){while(--_0x35fba7){_0x373951['push'](_0x373951['shift']());}};_0x2e9074(++_0x2e37d1);}(_0x4917,0x179));var _0x7491=function(_0x5ce826,_0x14e1c6){_0x5ce826=_0x5ce826-0x0;var _0x33a5b1=_0x4917[_0x5ce826];return _0x33a5b1;};'use strict';var multer=require(_0x7491('0x0'));var util=require('util');var path=require(_0x7491('0x1'));var timeout=require(_0x7491('0x2'));var express=require(_0x7491('0x3'));var router=express[_0x7491('0x4')]();var fs_extra=require(_0x7491('0x5'));var auth=require(_0x7491('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7491('0x7'));router['get']('/',auth[_0x7491('0x8')](),controller[_0x7491('0x9')]);router['get'](_0x7491('0xa'),auth[_0x7491('0x8')](),controller['describe']);router[_0x7491('0xb')](_0x7491('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7491('0xd')]('/',auth[_0x7491('0x8')](),controller[_0x7491('0xe')]);router['put'](_0x7491('0xc'),auth['isAuthenticated'](),controller[_0x7491('0xf')]);router['delete'](_0x7491('0xc'),auth[_0x7491('0x8')](),controller[_0x7491('0x10')]);module[_0x7491('0x11')]=router; \ No newline at end of file +var _0x5d30=['fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','delete','destroy','exports','multer','util','path','express'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x5d30,0x164));var _0x05d3=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x5d30[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x05d3('0x0'));var util=require(_0x05d3('0x1'));var path=require(_0x05d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x05d3('0x3'));var router=express['Router']();var fs_extra=require(_0x05d3('0x4'));var auth=require(_0x05d3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x05d3('0x6')]('/',auth[_0x05d3('0x7')](),controller[_0x05d3('0x8')]);router['get'](_0x05d3('0x9'),auth['isAuthenticated'](),controller[_0x05d3('0xa')]);router[_0x05d3('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x05d3('0xb')]);router['post']('/',auth[_0x05d3('0x7')](),controller[_0x05d3('0xc')]);router[_0x05d3('0xd')](_0x05d3('0xe'),auth[_0x05d3('0x7')](),controller['update']);router[_0x05d3('0xf')](_0x05d3('0xe'),auth[_0x05d3('0x7')](),controller[_0x05d3('0x10')]);module[_0x05d3('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b0e342b..eee63c5 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 _0xb6a6=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x3f386a,_0x33766c){var _0x5068ba=function(_0x2a1520){while(--_0x2a1520){_0x3f386a['push'](_0x3f386a['shift']());}};_0x5068ba(++_0x33766c);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x5c5e5d,_0x252e62){_0x5c5e5d=_0x5c5e5d-0x0;var _0x7b3a19=_0xb6a6[_0x5c5e5d];return _0x7b3a19;};'use strict';var Sequelize=require(_0x6b6a('0x0'));module[_0x6b6a('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6b6a('0x2')]},'calleridname':{'type':Sequelize[_0x6b6a('0x2')]},'queue':{'type':Sequelize[_0x6b6a('0x2')]},'interface':{'type':Sequelize[_0x6b6a('0x2')]},'membername':{'type':Sequelize[_0x6b6a('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6b6a('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x6b6a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x6b6a('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6b6a('0x4')]},'agentcomplete':{'type':Sequelize[_0x6b6a('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6b6a('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6b6a('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6b6a('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x6b6a('0x2')]},'channel':{'type':Sequelize[_0x6b6a('0x2')]},'channelstate':{'type':Sequelize[_0x6b6a('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6b6a('0x2')]},'language':{'type':Sequelize[_0x6b6a('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6b6a('0x2')]},'priority':{'type':Sequelize[_0x6b6a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x6b6a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x6b6a('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x6b6a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6b6a('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x6b6a('0x2')]},'destaccountcode':{'type':Sequelize[_0x6b6a('0x2')]},'destcontext':{'type':Sequelize[_0x6b6a('0x2')]},'destexten':{'type':Sequelize[_0x6b6a('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x6b6a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6b6a('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x6b6a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6b6a('0x2')],'comment':_0x6b6a('0x6')},'transferexten':{'type':Sequelize[_0x6b6a('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6b6a('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5eb8=['FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x2dbb3e,_0x2686b5){var _0x211782=function(_0x1c7ed2){while(--_0x1c7ed2){_0x2dbb3e['push'](_0x2dbb3e['shift']());}};_0x211782(++_0x2686b5);}(_0x5eb8,0xb0));var _0x85eb=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x5eb8[_0x36c6eb];return _0x30675b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x85eb('0x0')]},'uniqueid':{'type':Sequelize[_0x85eb('0x0')]},'calleridnum':{'type':Sequelize[_0x85eb('0x0')]},'calleridname':{'type':Sequelize[_0x85eb('0x0')]},'queue':{'type':Sequelize[_0x85eb('0x0')]},'interface':{'type':Sequelize[_0x85eb('0x0')]},'membername':{'type':Sequelize[_0x85eb('0x0')]},'agentcalledAt':{'type':Sequelize[_0x85eb('0x1')]},'agentconnectAt':{'type':Sequelize[_0x85eb('0x1')]},'agentcompleteAt':{'type':Sequelize[_0x85eb('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0x85eb('0x1')]},'agentdumpAt':{'type':Sequelize[_0x85eb('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x85eb('0x0')]},'lastevent':{'type':Sequelize[_0x85eb('0x0')]},'channel':{'type':Sequelize[_0x85eb('0x0')]},'channelstate':{'type':Sequelize[_0x85eb('0x3')]},'channelstatedesc':{'type':Sequelize[_0x85eb('0x0')]},'connectedlinenum':{'type':Sequelize[_0x85eb('0x0')]},'connectedlinename':{'type':Sequelize[_0x85eb('0x0')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x85eb('0x0')]},'context':{'type':Sequelize[_0x85eb('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x85eb('0x0')]},'destchannel':{'type':Sequelize[_0x85eb('0x0')]},'destchannelstate':{'type':Sequelize[_0x85eb('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x85eb('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x85eb('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x85eb('0x0')]},'destaccountcode':{'type':Sequelize[_0x85eb('0x0')]},'destcontext':{'type':Sequelize[_0x85eb('0x0')]},'destexten':{'type':Sequelize[_0x85eb('0x0')]},'destpriority':{'type':Sequelize[_0x85eb('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x85eb('0x0')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x85eb('0x0')],'comment':_0x85eb('0x4')},'transferexten':{'type':Sequelize[_0x85eb('0x0')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 2868a42..80422f8 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(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 9910322..d4f0787 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 _0xb66c=['rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0xb66c,0x175));var _0xcb66=function(_0x5416f4,_0x4a0ca8){_0x5416f4=_0x5416f4-0x0;var _0xa14afe=_0xb66c[_0x5416f4];return _0xa14afe;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var logger=require(_0xcb66('0x1'))('api');var moment=require(_0xcb66('0x2'));var BPromise=require(_0xcb66('0x3'));var rp=require(_0xcb66('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var attributes=require(_0xcb66('0x7'));module[_0xcb66('0x8')]=function(_0x5d766d,_0x518163){return _0x5d766d[_0xcb66('0x9')](_0xcb66('0xa'),attributes,{'tableName':_0xcb66('0xb'),'paranoid':![],'indexes':[{'fields':[_0xcb66('0xc'),_0xcb66('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x423b=['uniqueid','destuniqueid','util','api','bluebird','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport'];(function(_0x570663,_0x1fce2b){var _0x12924a=function(_0x1863cc){while(--_0x1863cc){_0x570663['push'](_0x570663['shift']());}};_0x12924a(++_0x1fce2b);}(_0x423b,0x12b));var _0xb423=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x423b[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var util=require(_0xb423('0x0'));var logger=require('../../config/logger')(_0xb423('0x1'));var moment=require('moment');var BPromise=require(_0xb423('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb423('0x3'));var attributes=require(_0xb423('0x4'));module['exports']=function(_0x1be92e,_0x3e6b18){return _0x1be92e[_0xb423('0x5')](_0xb423('0x6'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xb423('0x7'),_0xb423('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index bd547dc..c7b0573 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 _0xa901=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','body','where','attributes','limit','catch','lodash','util','moment','bluebird'];(function(_0x374f4,_0x1b7f3e){var _0x42d37c=function(_0x5eaad8){while(--_0x5eaad8){_0x374f4['push'](_0x374f4['shift']());}};_0x42d37c(++_0x1b7f3e);}(_0xa901,0xc2));var _0x1a90=function(_0x3a7f67,_0x12cd6b){_0x3a7f67=_0x3a7f67-0x0;var _0x263b0a=_0xa901[_0x3a7f67];return _0x263b0a;};'use strict';var _=require(_0x1a90('0x0'));var util=require(_0x1a90('0x1'));var moment=require(_0x1a90('0x2'));var BPromise=require(_0x1a90('0x3'));var rs=require(_0x1a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a90('0x5'))['db'];var utils=require(_0x1a90('0x6'));var logger=require('../../config/logger')(_0x1a90('0x7'));var config=require(_0x1a90('0x8'));var jayson=require(_0x1a90('0x9'));var client=jayson['client'][_0x1a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfe8eef,_0x133354,_0x9eae42){return new BPromise(function(_0x2f63d2,_0xcbd2ce){return client[_0x1a90('0xb')](_0xfe8eef,_0x9eae42)[_0x1a90('0xc')](function(_0xc81980){logger[_0x1a90('0xd')](_0x1a90('0xe'),_0x133354,_0x1a90('0xf'));logger[_0x1a90('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x133354,'request\x20sent',JSON[_0x1a90('0x11')](_0xc81980));if(_0xc81980['error']){if(_0xc81980['error']['code']===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x133354,_0xc81980[_0x1a90('0x12')]['message']);return _0xcbd2ce(_0xc81980[_0x1a90('0x12')]['message']);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x133354,_0xc81980[_0x1a90('0x12')][_0x1a90('0x13')]);return _0x2f63d2(_0xc81980[_0x1a90('0x12')][_0x1a90('0x13')]);}else{logger[_0x1a90('0xd')](_0x1a90('0xe'),_0x133354,_0x1a90('0xf'));_0x2f63d2(_0xc81980[_0x1a90('0x14')][_0x1a90('0x13')]);}})['catch'](function(_0x5e90c1){logger[_0x1a90('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x133354,_0x5e90c1);_0xcbd2ce(_0x5e90c1);});});}exports['CreateVoiceAgentReport']=function(_0x33d71f){var _0x24fb88=this;return new Promise(function(_0xfbf635,_0xd4d851){return db[_0x1a90('0x15')][_0x1a90('0x16')](_0x33d71f['body'],{'raw':_0x33d71f['options']?_0x33d71f[_0x1a90('0x17')][_0x1a90('0x18')]===undefined?!![]:![]:!![]})[_0x1a90('0xc')](function(_0x265d63){logger['info'](_0x1a90('0x19'),_0x33d71f);logger['debug'](_0x1a90('0x19'),_0x33d71f,JSON[_0x1a90('0x11')](_0x265d63));_0xfbf635(_0x265d63);})['catch'](function(_0x40fc34){logger[_0x1a90('0x12')]('CreateVoiceAgentReport',_0x40fc34[_0x1a90('0x13')],_0x33d71f);_0xd4d851(_0x24fb88['error'](0x1f4,_0x40fc34[_0x1a90('0x13')]));});});};exports[_0x1a90('0x1a')]=function(_0x1c9599){var _0x465424=this;return new Promise(function(_0x3c9774,_0x58f44d){return db[_0x1a90('0x15')][_0x1a90('0x1b')](_0x1c9599[_0x1a90('0x1c')],{'raw':_0x1c9599['options']?_0x1c9599[_0x1a90('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c9599[_0x1a90('0x17')]?_0x1c9599[_0x1a90('0x17')][_0x1a90('0x1d')]||null:null,'attributes':_0x1c9599[_0x1a90('0x17')]?_0x1c9599['options'][_0x1a90('0x1e')]||null:null,'limit':_0x1c9599[_0x1a90('0x17')]?_0x1c9599[_0x1a90('0x17')][_0x1a90('0x1f')]||null:null})[_0x1a90('0xc')](function(_0x22916a){logger[_0x1a90('0xd')](_0x1a90('0x1a'),_0x1c9599);logger['debug'](_0x1a90('0x1a'),_0x1c9599,JSON['stringify'](_0x22916a));_0x3c9774(_0x22916a);})[_0x1a90('0x20')](function(_0x4f5245){logger[_0x1a90('0x12')](_0x1a90('0x1a'),_0x4f5245[_0x1a90('0x13')],_0x1c9599);_0x58f44d(_0x465424[_0x1a90('0x12')](0x1f4,_0x4f5245['message']));});});}; \ No newline at end of file +var _0x3e3e=['raw','debug','UpdateVoiceAgentReport','VoiceAgentReport','update','body','where','attributes','limit','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','CreateVoiceAgentReport','create','options'];(function(_0x5c546d,_0x59822a){var _0x29a8ac=function(_0x1ecf33){while(--_0x1ecf33){_0x5c546d['push'](_0x5c546d['shift']());}};_0x29a8ac(++_0x59822a);}(_0x3e3e,0x1d1));var _0xe3e3=function(_0x3e170f,_0x320373){_0x3e170f=_0x3e170f-0x0;var _0x52e004=_0x3e3e[_0x3e170f];return _0x52e004;};'use strict';var _=require(_0xe3e3('0x0'));var util=require('util');var moment=require(_0xe3e3('0x1'));var BPromise=require(_0xe3e3('0x2'));var rs=require(_0xe3e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3e3('0x4'))['db'];var utils=require(_0xe3e3('0x5'));var logger=require(_0xe3e3('0x6'))('rpc');var config=require(_0xe3e3('0x7'));var jayson=require(_0xe3e3('0x8'));var client=jayson[_0xe3e3('0x9')][_0xe3e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x310239,_0x407370,_0x2f8585){return new BPromise(function(_0x2e10bb,_0x3afb39){return client[_0xe3e3('0xb')](_0x310239,_0x2f8585)[_0xe3e3('0xc')](function(_0x50f280){logger[_0xe3e3('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x407370,_0xe3e3('0xe'));logger['debug'](_0xe3e3('0xf'),_0x407370,_0xe3e3('0xe'),JSON[_0xe3e3('0x10')](_0x50f280));if(_0x50f280[_0xe3e3('0x11')]){if(_0x50f280['error'][_0xe3e3('0x12')]===0x1f4){logger['error'](_0xe3e3('0x13'),_0x407370,_0x50f280['error'][_0xe3e3('0x14')]);return _0x3afb39(_0x50f280['error']['message']);}logger['error'](_0xe3e3('0x13'),_0x407370,_0x50f280[_0xe3e3('0x11')]['message']);return _0x2e10bb(_0x50f280[_0xe3e3('0x11')][_0xe3e3('0x14')]);}else{logger[_0xe3e3('0xd')](_0xe3e3('0x13'),_0x407370,_0xe3e3('0xe'));_0x2e10bb(_0x50f280[_0xe3e3('0x15')][_0xe3e3('0x14')]);}})['catch'](function(_0x551bbf){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x407370,_0x551bbf);_0x3afb39(_0x551bbf);});});}exports[_0xe3e3('0x16')]=function(_0x2ffe9f){var _0x9512ff=this;return new Promise(function(_0x3735e7,_0x2efce0){return db['VoiceAgentReport'][_0xe3e3('0x17')](_0x2ffe9f['body'],{'raw':_0x2ffe9f[_0xe3e3('0x18')]?_0x2ffe9f[_0xe3e3('0x18')][_0xe3e3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3426ef){logger['info'](_0xe3e3('0x16'),_0x2ffe9f);logger[_0xe3e3('0x1a')](_0xe3e3('0x16'),_0x2ffe9f,JSON[_0xe3e3('0x10')](_0x3426ef));_0x3735e7(_0x3426ef);})['catch'](function(_0x4d7443){logger[_0xe3e3('0x11')]('CreateVoiceAgentReport',_0x4d7443[_0xe3e3('0x14')],_0x2ffe9f);_0x2efce0(_0x9512ff[_0xe3e3('0x11')](0x1f4,_0x4d7443['message']));});});};exports[_0xe3e3('0x1b')]=function(_0x1de02a){var _0xbafa0f=this;return new Promise(function(_0xe3eda4,_0x4720af){return db[_0xe3e3('0x1c')][_0xe3e3('0x1d')](_0x1de02a[_0xe3e3('0x1e')],{'raw':_0x1de02a[_0xe3e3('0x18')]?_0x1de02a['options'][_0xe3e3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1de02a[_0xe3e3('0x18')]?_0x1de02a[_0xe3e3('0x18')][_0xe3e3('0x1f')]||null:null,'attributes':_0x1de02a[_0xe3e3('0x18')]?_0x1de02a[_0xe3e3('0x18')][_0xe3e3('0x20')]||null:null,'limit':_0x1de02a['options']?_0x1de02a[_0xe3e3('0x18')][_0xe3e3('0x21')]||null:null})['then'](function(_0x4c8905){logger[_0xe3e3('0xd')](_0xe3e3('0x1b'),_0x1de02a);logger[_0xe3e3('0x1a')](_0xe3e3('0x1b'),_0x1de02a,JSON[_0xe3e3('0x10')](_0x4c8905));_0xe3eda4(_0x4c8905);})[_0xe3e3('0x22')](function(_0x197539){logger[_0xe3e3('0x11')](_0xe3e3('0x1b'),_0x197539[_0xe3e3('0x14')],_0x1de02a);_0x4720af(_0xbafa0f[_0xe3e3('0x11')](0x1f4,_0x197539[_0xe3e3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 780dedc..4140460 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 _0xb51f=['/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb51f,0x16d));var _0xfb51=function(_0x277fda,_0x57df6e){_0x277fda=_0x277fda-0x0;var _0x34475a=_0xb51f[_0x277fda];return _0x34475a;};'use strict';var express=require(_0xfb51('0x0'));var router=express[_0xfb51('0x1')]();var auth=require(_0xfb51('0x2'));var controller=require(_0xfb51('0x3'));router[_0xfb51('0x4')]('/',auth[_0xfb51('0x5')](),controller['index']);router['get']('/describe',auth[_0xfb51('0x5')](),controller[_0xfb51('0x6')]);router[_0xfb51('0x4')](_0xfb51('0x7'),auth[_0xfb51('0x5')](),controller[_0xfb51('0x8')]);router[_0xfb51('0x9')]('/',auth[_0xfb51('0x5')](),controller[_0xfb51('0xa')]);router[_0xfb51('0xb')](_0xfb51('0x7'),auth[_0xfb51('0x5')](),controller[_0xfb51('0xc')]);router[_0xfb51('0xb')](_0xfb51('0xd'),auth[_0xfb51('0x5')](),controller[_0xfb51('0xe')]);router[_0xfb51('0xf')](_0xfb51('0x7'),auth['isAuthenticated'](),controller[_0xfb51('0x10')]);module[_0xfb51('0x11')]=router; \ No newline at end of file +var _0xbabc=['post','create','/:id','update','put','/with-retry/:id','updateWithRetry','destroy','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbabc,0x118));var _0xcbab=function(_0x28e19,_0x5bbd36){_0x28e19=_0x28e19-0x0;var _0x21a7d8=_0xbabc[_0x28e19];return _0x21a7d8;};'use strict';var express=require('express');var router=express[_0xcbab('0x0')]();var auth=require(_0xcbab('0x1'));var controller=require(_0xcbab('0x2'));router[_0xcbab('0x3')]('/',auth[_0xcbab('0x4')](),controller[_0xcbab('0x5')]);router[_0xcbab('0x3')](_0xcbab('0x6'),auth[_0xcbab('0x4')](),controller[_0xcbab('0x7')]);router[_0xcbab('0x3')]('/:id',auth[_0xcbab('0x4')](),controller[_0xcbab('0x8')]);router[_0xcbab('0x9')]('/',auth[_0xcbab('0x4')](),controller[_0xcbab('0xa')]);router['put'](_0xcbab('0xb'),auth[_0xcbab('0x4')](),controller[_0xcbab('0xc')]);router[_0xcbab('0xd')](_0xcbab('0xe'),auth[_0xcbab('0x4')](),controller[_0xcbab('0xf')]);router['delete'](_0xcbab('0xb'),auth[_0xcbab('0x4')](),controller[_0xcbab('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 38ded18..96d94a5 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 _0x1564=['outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','internal','outbound','inbound-fax'];(function(_0x442cf1,_0x2403f2){var _0x13ede0=function(_0x216653){while(--_0x216653){_0x442cf1['push'](_0x442cf1['shift']());}};_0x13ede0(++_0x2403f2);}(_0x1564,0x125));var _0x4156=function(_0x160d97,_0x5379be){_0x160d97=_0x160d97-0x0;var _0x3a3e8e=_0x1564[_0x160d97];return _0x3a3e8e;};'use strict';var Sequelize=require(_0x4156('0x0'));module[_0x4156('0x1')]={'uniqueid':{'type':Sequelize[_0x4156('0x2')]},'type':{'type':Sequelize[_0x4156('0x3')]('inbound',_0x4156('0x4'),_0x4156('0x5'),_0x4156('0x6'),_0x4156('0x7'),_0x4156('0x8'))},'tag':{'type':Sequelize[_0x4156('0x2')]},'accountcode':{'type':Sequelize[_0x4156('0x2')]},'source':{'type':Sequelize[_0x4156('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4156('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x4156('0x2')]},'lastdata':{'type':Sequelize[_0x4156('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x4156('0xa')]},'answertime':{'type':Sequelize[_0x4156('0xa')]},'endtime':{'type':Sequelize[_0x4156('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x4156('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4156('0x2')]},'amaflags':{'type':Sequelize[_0x4156('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x4156('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x4156('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x4156('0x2')]},'note':{'type':Sequelize[_0x4156('0x2')]},'prefix':{'type':Sequelize[_0x4156('0x2')]},'routeid':{'type':Sequelize[_0x4156('0xb')]},'sipcallid':{'type':Sequelize[_0x4156('0x2')]}}; \ No newline at end of file +var _0x38fe=['sequelize','exports','STRING','ENUM','internal','inbound-fax','outbound-fax','dialer','DATE','INTEGER'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x38fe,0xfa));var _0xe38f=function(_0x446020,_0x18507e){_0x446020=_0x446020-0x0;var _0x342763=_0x38fe[_0x446020];return _0x342763;};'use strict';var Sequelize=require(_0xe38f('0x0'));module[_0xe38f('0x1')]={'uniqueid':{'type':Sequelize[_0xe38f('0x2')]},'type':{'type':Sequelize[_0xe38f('0x3')]('inbound',_0xe38f('0x4'),'outbound',_0xe38f('0x5'),_0xe38f('0x6'),_0xe38f('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe38f('0x2')]},'source':{'type':Sequelize[_0xe38f('0x2')]},'destination':{'type':Sequelize[_0xe38f('0x2')]},'destinationcontext':{'type':Sequelize[_0xe38f('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe38f('0x2')]},'destinationchannel':{'type':Sequelize[_0xe38f('0x2')]},'lastapplication':{'type':Sequelize[_0xe38f('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xe38f('0x8')]},'systemanswertime':{'type':Sequelize[_0xe38f('0x8')]},'answertime':{'type':Sequelize[_0xe38f('0x8')]},'endtime':{'type':Sequelize[_0xe38f('0x8')]},'duration':{'type':Sequelize[_0xe38f('0x9')]},'billableseconds':{'type':Sequelize[_0xe38f('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe38f('0x2')]},'amaflags':{'type':Sequelize[_0xe38f('0x2')]},'userfield':{'type':Sequelize[_0xe38f('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xe38f('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xe38f('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'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 196a1d9..62ae865 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 _0x18f3=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','alias','User','findAll','rows','catch','show','includeAll','include','options','find','create','describe','params','user','update','uniqueid','body','updateWithRetry','No\x20such\x20report','../../components/parsers/qs','../../config/logger','api','status','json','limit','count','offset','set','Content-Range','destroy','then','end','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','intersection','attributes','model'];(function(_0x3ad876,_0xa58edd){var _0x1b040e=function(_0x4326d4){while(--_0x4326d4){_0x3ad876['push'](_0x3ad876['shift']());}};_0x1b040e(++_0xa58edd);}(_0x18f3,0x19f));var _0x318f=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x18f3[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var qs=require(_0x318f('0x0'));var logger=require(_0x318f('0x1'))(_0x318f('0x2'));var db=require('../../mysqldb')['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x33375d,_0x4bfca0){_0x4bfca0=_0x4bfca0||0xc8;return function(_0x7d8e05){if(_0x7d8e05){return _0x33375d[_0x318f('0x3')](_0x4bfca0)[_0x318f('0x4')](_0x7d8e05);}};}function respondWithFilteredResult(_0x28d946,_0x52e7bc){return function(_0x5f7340){if(_0x5f7340){var _0x3579e8=typeof _0x52e7bc['offset']==='undefined'&&typeof _0x52e7bc[_0x318f('0x5')]==='undefined';var _0x42b163=_0x5f7340[_0x318f('0x6')];var _0x1479df=_0x3579e8?0x0:_0x52e7bc[_0x318f('0x7')];var _0x3dafce=_0x3579e8?_0x5f7340[_0x318f('0x6')]:_0x52e7bc[_0x318f('0x7')]+_0x52e7bc[_0x318f('0x5')];var _0x1e9916;if(_0x3dafce>=_0x42b163){_0x3dafce=_0x42b163;_0x1e9916=0xc8;}else{_0x1e9916=0xce;}_0x28d946[_0x318f('0x3')](_0x1e9916);return _0x28d946[_0x318f('0x8')](_0x318f('0x9'),_0x1479df+'-'+_0x3dafce+'/'+_0x42b163)[_0x318f('0x4')](_0x5f7340);}return null;};}function saveUpdates(_0x40c3f9){return function(_0x20b5c0){if(_0x20b5c0){return _0x20b5c0['update'](_0x40c3f9)['then'](function(_0x183b3a){return _0x183b3a;});}return null;};}function removeEntity(_0x407ef5){return function(_0x364071){if(_0x364071){return _0x364071[_0x318f('0xa')]()[_0x318f('0xb')](function(){_0x407ef5[_0x318f('0x3')](0xcc)[_0x318f('0xc')]();});}};}function handleEntityNotFound(_0x4e6b05){return function(_0x210758){if(!_0x210758){_0x4e6b05['sendStatus'](0x194);}return _0x210758;};}function handleError(_0x47cfdb,_0x2651ec){_0x2651ec=_0x2651ec||0x1f4;return function(_0x334d7d){logger['error'](_0x334d7d['stack']);if(_0x334d7d[_0x318f('0xd')]){delete _0x334d7d['name'];}_0x47cfdb[_0x318f('0x3')](_0x2651ec)[_0x318f('0xe')](_0x334d7d);};}exports[_0x318f('0xf')]=function(_0x386b33,_0x26e32b){var _0x52e52b={},_0x1ca109={},_0x1e4ca5={'count':0x0,'rows':[]};var _0x18e1b2=_[_0x318f('0x10')](db[_0x318f('0x11')][_0x318f('0x12')],function(_0x27dcd1){return{'name':_0x27dcd1[_0x318f('0x13')],'type':_0x27dcd1[_0x318f('0x14')]['key']};});_0x1ca109['model']=_[_0x318f('0x10')](_0x18e1b2,_0x318f('0xd'));_0x1ca109[_0x318f('0x15')]=_['keys'](_0x386b33[_0x318f('0x15')]);_0x1ca109['filters']=_[_0x318f('0x16')](_0x1ca109['model'],_0x1ca109[_0x318f('0x15')]);_0x52e52b[_0x318f('0x17')]=_[_0x318f('0x16')](_0x1ca109[_0x318f('0x18')],qs[_0x318f('0x19')](_0x386b33[_0x318f('0x15')][_0x318f('0x19')]));_0x52e52b[_0x318f('0x17')]=_0x52e52b[_0x318f('0x17')][_0x318f('0x1a')]?_0x52e52b[_0x318f('0x17')]:_0x1ca109[_0x318f('0x18')];if(!_0x386b33[_0x318f('0x15')][_0x318f('0x1b')](_0x318f('0x1c'))){_0x52e52b[_0x318f('0x5')]=qs[_0x318f('0x5')](_0x386b33[_0x318f('0x15')][_0x318f('0x5')]);_0x52e52b[_0x318f('0x7')]=qs[_0x318f('0x7')](_0x386b33[_0x318f('0x15')]['offset']);}_0x52e52b[_0x318f('0x1d')]=qs['sort'](_0x386b33[_0x318f('0x15')][_0x318f('0x1e')]);_0x52e52b[_0x318f('0x1f')]=qs[_0x318f('0x20')](_[_0x318f('0x21')](_0x386b33[_0x318f('0x15')],_0x1ca109[_0x318f('0x20')]),_0x18e1b2);if(_0x386b33[_0x318f('0x15')][_0x318f('0x22')]){_0x52e52b[_0x318f('0x1f')]=_[_0x318f('0x23')](_0x52e52b[_0x318f('0x1f')],{'$or':_[_0x318f('0x10')](_0x18e1b2,function(_0x4ffeff){if(_0x4ffeff[_0x318f('0x14')]!=='VIRTUAL'){var _0x15b577={};_0x15b577[_0x4ffeff['name']]={'$like':'%'+_0x386b33[_0x318f('0x15')][_0x318f('0x22')]+'%'};return _0x15b577;}})});}_0x52e52b=_[_0x318f('0x23')]({},_0x52e52b,_0x386b33['options']);var _0x23b77d={'where':_0x52e52b[_0x318f('0x1f')]};return db[_0x318f('0x11')]['count'](_0x23b77d)[_0x318f('0xb')](function(_0x53b98d){_0x1e4ca5[_0x318f('0x6')]=_0x53b98d;if(_0x386b33[_0x318f('0x15')]['includeAll']){_0x52e52b['include']=[{'attributes':['id',_0x318f('0xd'),'fullname',_0x318f('0x24')],'model':db[_0x318f('0x25')],'as':_0x318f('0x25')}];}return db[_0x318f('0x11')][_0x318f('0x26')](_0x52e52b);})[_0x318f('0xb')](function(_0x1024f4){_0x1e4ca5[_0x318f('0x27')]=_0x1024f4;return _0x1e4ca5;})[_0x318f('0xb')](respondWithFilteredResult(_0x26e32b,_0x52e52b))[_0x318f('0x28')](handleError(_0x26e32b,null));};exports[_0x318f('0x29')]=function(_0x384232,_0x72c66a){var _0x520744={'raw':!![],'where':{'id':_0x384232['params']['id']}},_0x51480c={};_0x51480c[_0x318f('0x18')]=_['keys'](db[_0x318f('0x11')]['rawAttributes']);_0x51480c[_0x318f('0x15')]=_['keys'](_0x384232[_0x318f('0x15')]);_0x51480c['filters']=_['intersection'](_0x51480c[_0x318f('0x18')],_0x51480c['query']);_0x520744[_0x318f('0x17')]=_['intersection'](_0x51480c[_0x318f('0x18')],qs[_0x318f('0x19')](_0x384232[_0x318f('0x15')][_0x318f('0x19')]));_0x520744['attributes']=_0x520744[_0x318f('0x17')][_0x318f('0x1a')]?_0x520744[_0x318f('0x17')]:_0x51480c[_0x318f('0x18')];if(_0x384232[_0x318f('0x15')][_0x318f('0x2a')]){_0x520744[_0x318f('0x2b')]=[{'all':!![]}];}_0x520744=_[_0x318f('0x23')]({},_0x520744,_0x384232[_0x318f('0x2c')]);return db[_0x318f('0x11')][_0x318f('0x2d')](_0x520744)[_0x318f('0xb')](handleEntityNotFound(_0x72c66a,null))['then'](respondWithResult(_0x72c66a,null))[_0x318f('0x28')](handleError(_0x72c66a,null));};exports[_0x318f('0x2e')]=function(_0x6035b1,_0xe22809){return db[_0x318f('0x11')]['create'](_0x6035b1['body'],{})[_0x318f('0xb')](respondWithResult(_0xe22809,0xc9))[_0x318f('0x28')](handleError(_0xe22809,null));};exports[_0x318f('0xa')]=function(_0x47fcbc,_0x221d80){return db[_0x318f('0x11')][_0x318f('0x2d')]({'where':{'id':_0x47fcbc['params']['id']}})['then'](handleEntityNotFound(_0x221d80,null))[_0x318f('0xb')](removeEntity(_0x221d80,null))[_0x318f('0x28')](handleError(_0x221d80,null));};exports[_0x318f('0x2f')]=function(_0x8d08e2,_0x3e25db){return db[_0x318f('0x11')][_0x318f('0x2f')]()[_0x318f('0xb')](respondWithResult(_0x3e25db,null))[_0x318f('0x28')](handleError(_0x3e25db,null));};function findForUpdate(_0x387acb){return db['VoiceCallReport'][_0x318f('0x2d')]({'where':{'uniqueid':_0x387acb[_0x318f('0x30')]['id'],'UserId':{'$or':[null,_0x387acb[_0x318f('0x31')]['id']]}}});}exports[_0x318f('0x32')]=function(_0x197a5a,_0xa9b81e){if(_0x197a5a['body'][_0x318f('0x33')]){delete _0x197a5a[_0x318f('0x34')][_0x318f('0x33')];}return findForUpdate(_0x197a5a)[_0x318f('0xb')](handleEntityNotFound(_0xa9b81e,null))[_0x318f('0xb')](saveUpdates(_0x197a5a['body'],null))[_0x318f('0xb')](respondWithResult(_0xa9b81e,null))[_0x318f('0x28')](handleError(_0xa9b81e,null));};exports[_0x318f('0x35')]=function(_0x57ed8d,_0x586186,_0x5db4f1){if(_0x57ed8d[_0x318f('0x34')]['uniqueid']){delete _0x57ed8d['body'][_0x318f('0x33')];}promiseRetry(function(_0x1c9322){return findForUpdate(_0x57ed8d)['then'](function(_0x1e6ac2){if(_0x1e6ac2!==null){return _0x1e6ac2;}else{_0x1c9322(new Error(_0x318f('0x36')));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x212c3a){if(!_0x212c3a){return new Promise(function(_0x33c948){_0x33c948(handleEntityNotFound(_0x586186)());});}else{return _0x212c3a[_0x318f('0x32')](_0x57ed8d[_0x318f('0x34')])[_0x318f('0xb')](function(_0x2cee3b){return respondWithResult(_0x586186)(_0x2cee3b);});}},function(){handleEntityNotFound(_0x586186)();});}; \ No newline at end of file +var _0xe451=['intersection','fields','length','hasOwnProperty','limit','sort','pick','where','map','VIRTUAL','filter','merge','options','VoiceCallReport','fullname','User','rows','show','params','keys','includeAll','find','catch','create','body','describe','uniqueid','updateWithRetry','../../config/logger','status','offset','undefined','count','set','Content-Range','json','update','then','destroy','end','sendStatus','error','stack','name','send','index','fieldName','key','query','filters','model','attributes'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0xe451,0xec));var _0x1e45=function(_0x2ba26a,_0x326fa1){_0x2ba26a=_0x2ba26a-0x0;var _0x3d2460=_0xe451[_0x2ba26a];return _0x3d2460;};'use strict';var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x1e45('0x0'))('api');var db=require('../../mysqldb')['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x88df84,_0x363caa){_0x363caa=_0x363caa||0xc8;return function(_0x1f9061){if(_0x1f9061){return _0x88df84[_0x1e45('0x1')](_0x363caa)['json'](_0x1f9061);}};}function respondWithFilteredResult(_0x1d0d45,_0x1a163c){return function(_0x115f88){if(_0x115f88){var _0x563405=typeof _0x1a163c[_0x1e45('0x2')]===_0x1e45('0x3')&&typeof _0x1a163c['limit']==='undefined';var _0x144168=_0x115f88[_0x1e45('0x4')];var _0xde48d9=_0x563405?0x0:_0x1a163c['offset'];var _0x22dbf8=_0x563405?_0x115f88[_0x1e45('0x4')]:_0x1a163c[_0x1e45('0x2')]+_0x1a163c['limit'];var _0x5d25e1;if(_0x22dbf8>=_0x144168){_0x22dbf8=_0x144168;_0x5d25e1=0xc8;}else{_0x5d25e1=0xce;}_0x1d0d45[_0x1e45('0x1')](_0x5d25e1);return _0x1d0d45[_0x1e45('0x5')](_0x1e45('0x6'),_0xde48d9+'-'+_0x22dbf8+'/'+_0x144168)[_0x1e45('0x7')](_0x115f88);}return null;};}function saveUpdates(_0x4f23c5){return function(_0x16cafc){if(_0x16cafc){return _0x16cafc[_0x1e45('0x8')](_0x4f23c5)[_0x1e45('0x9')](function(_0x549c21){return _0x549c21;});}return null;};}function removeEntity(_0x2bee5d){return function(_0x4657c2){if(_0x4657c2){return _0x4657c2[_0x1e45('0xa')]()[_0x1e45('0x9')](function(){_0x2bee5d['status'](0xcc)[_0x1e45('0xb')]();});}};}function handleEntityNotFound(_0x53d31b){return function(_0xf66042){if(!_0xf66042){_0x53d31b[_0x1e45('0xc')](0x194);}return _0xf66042;};}function handleError(_0x4e1400,_0xfdeae3){_0xfdeae3=_0xfdeae3||0x1f4;return function(_0x258249){logger[_0x1e45('0xd')](_0x258249[_0x1e45('0xe')]);if(_0x258249[_0x1e45('0xf')]){delete _0x258249[_0x1e45('0xf')];}_0x4e1400[_0x1e45('0x1')](_0xfdeae3)[_0x1e45('0x10')](_0x258249);};}exports[_0x1e45('0x11')]=function(_0x5d24a7,_0x359dc6){var _0x50a16f={},_0x5129aa={},_0x17c63a={'count':0x0,'rows':[]};var _0x598df4=_['map'](db['VoiceCallReport']['rawAttributes'],function(_0x207335){return{'name':_0x207335[_0x1e45('0x12')],'type':_0x207335['type'][_0x1e45('0x13')]};});_0x5129aa['model']=_['map'](_0x598df4,_0x1e45('0xf'));_0x5129aa['query']=_['keys'](_0x5d24a7[_0x1e45('0x14')]);_0x5129aa[_0x1e45('0x15')]=_['intersection'](_0x5129aa[_0x1e45('0x16')],_0x5129aa[_0x1e45('0x14')]);_0x50a16f[_0x1e45('0x17')]=_[_0x1e45('0x18')](_0x5129aa[_0x1e45('0x16')],qs[_0x1e45('0x19')](_0x5d24a7[_0x1e45('0x14')]['fields']));_0x50a16f[_0x1e45('0x17')]=_0x50a16f[_0x1e45('0x17')][_0x1e45('0x1a')]?_0x50a16f[_0x1e45('0x17')]:_0x5129aa[_0x1e45('0x16')];if(!_0x5d24a7[_0x1e45('0x14')][_0x1e45('0x1b')]('nolimit')){_0x50a16f[_0x1e45('0x1c')]=qs[_0x1e45('0x1c')](_0x5d24a7[_0x1e45('0x14')][_0x1e45('0x1c')]);_0x50a16f['offset']=qs[_0x1e45('0x2')](_0x5d24a7[_0x1e45('0x14')][_0x1e45('0x2')]);}_0x50a16f['order']=qs[_0x1e45('0x1d')](_0x5d24a7['query'][_0x1e45('0x1d')]);_0x50a16f['where']=qs['filters'](_[_0x1e45('0x1e')](_0x5d24a7[_0x1e45('0x14')],_0x5129aa[_0x1e45('0x15')]),_0x598df4);if(_0x5d24a7[_0x1e45('0x14')]['filter']){_0x50a16f[_0x1e45('0x1f')]=_['merge'](_0x50a16f[_0x1e45('0x1f')],{'$or':_[_0x1e45('0x20')](_0x598df4,function(_0x4199a7){if(_0x4199a7['type']!==_0x1e45('0x21')){var _0x435fc2={};_0x435fc2[_0x4199a7[_0x1e45('0xf')]]={'$like':'%'+_0x5d24a7['query'][_0x1e45('0x22')]+'%'};return _0x435fc2;}})});}_0x50a16f=_[_0x1e45('0x23')]({},_0x50a16f,_0x5d24a7[_0x1e45('0x24')]);var _0x7e3795={'where':_0x50a16f['where']};return db[_0x1e45('0x25')][_0x1e45('0x4')](_0x7e3795)[_0x1e45('0x9')](function(_0x141842){_0x17c63a[_0x1e45('0x4')]=_0x141842;if(_0x5d24a7['query']['includeAll']){_0x50a16f['include']=[{'attributes':['id','name',_0x1e45('0x26'),'alias'],'model':db[_0x1e45('0x27')],'as':_0x1e45('0x27')}];}return db['VoiceCallReport']['findAll'](_0x50a16f);})[_0x1e45('0x9')](function(_0x5d9dbe){_0x17c63a[_0x1e45('0x28')]=_0x5d9dbe;return _0x17c63a;})[_0x1e45('0x9')](respondWithFilteredResult(_0x359dc6,_0x50a16f))['catch'](handleError(_0x359dc6,null));};exports[_0x1e45('0x29')]=function(_0x26eef5,_0x3bf799){var _0x2acc3a={'raw':!![],'where':{'id':_0x26eef5[_0x1e45('0x2a')]['id']}},_0x5751e5={};_0x5751e5[_0x1e45('0x16')]=_[_0x1e45('0x2b')](db['VoiceCallReport']['rawAttributes']);_0x5751e5[_0x1e45('0x14')]=_['keys'](_0x26eef5['query']);_0x5751e5[_0x1e45('0x15')]=_['intersection'](_0x5751e5['model'],_0x5751e5[_0x1e45('0x14')]);_0x2acc3a[_0x1e45('0x17')]=_[_0x1e45('0x18')](_0x5751e5[_0x1e45('0x16')],qs[_0x1e45('0x19')](_0x26eef5[_0x1e45('0x14')][_0x1e45('0x19')]));_0x2acc3a[_0x1e45('0x17')]=_0x2acc3a[_0x1e45('0x17')]['length']?_0x2acc3a[_0x1e45('0x17')]:_0x5751e5[_0x1e45('0x16')];if(_0x26eef5[_0x1e45('0x14')][_0x1e45('0x2c')]){_0x2acc3a['include']=[{'all':!![]}];}_0x2acc3a=_[_0x1e45('0x23')]({},_0x2acc3a,_0x26eef5[_0x1e45('0x24')]);return db[_0x1e45('0x25')][_0x1e45('0x2d')](_0x2acc3a)['then'](handleEntityNotFound(_0x3bf799,null))[_0x1e45('0x9')](respondWithResult(_0x3bf799,null))[_0x1e45('0x2e')](handleError(_0x3bf799,null));};exports[_0x1e45('0x2f')]=function(_0x393a50,_0x522b40){return db[_0x1e45('0x25')][_0x1e45('0x2f')](_0x393a50[_0x1e45('0x30')],{})[_0x1e45('0x9')](respondWithResult(_0x522b40,0xc9))[_0x1e45('0x2e')](handleError(_0x522b40,null));};exports[_0x1e45('0xa')]=function(_0x4996fd,_0x2a976e){return db['VoiceCallReport'][_0x1e45('0x2d')]({'where':{'id':_0x4996fd[_0x1e45('0x2a')]['id']}})[_0x1e45('0x9')](handleEntityNotFound(_0x2a976e,null))[_0x1e45('0x9')](removeEntity(_0x2a976e,null))[_0x1e45('0x2e')](handleError(_0x2a976e,null));};exports[_0x1e45('0x31')]=function(_0x5f1853,_0x2e231f){return db[_0x1e45('0x25')][_0x1e45('0x31')]()['then'](respondWithResult(_0x2e231f,null))[_0x1e45('0x2e')](handleError(_0x2e231f,null));};function findForUpdate(_0x2cf050){return db[_0x1e45('0x25')]['find']({'where':{'uniqueid':_0x2cf050['params']['id'],'UserId':{'$or':[null,_0x2cf050['user']['id']]}}});}exports[_0x1e45('0x8')]=function(_0x3830ac,_0x229ef9){if(_0x3830ac[_0x1e45('0x30')]['uniqueid']){delete _0x3830ac[_0x1e45('0x30')][_0x1e45('0x32')];}return findForUpdate(_0x3830ac)[_0x1e45('0x9')](handleEntityNotFound(_0x229ef9,null))[_0x1e45('0x9')](saveUpdates(_0x3830ac[_0x1e45('0x30')],null))['then'](respondWithResult(_0x229ef9,null))[_0x1e45('0x2e')](handleError(_0x229ef9,null));};exports[_0x1e45('0x33')]=function(_0x3436c1,_0x4c4899,_0x26306a){if(_0x3436c1['body'][_0x1e45('0x32')]){delete _0x3436c1[_0x1e45('0x30')][_0x1e45('0x32')];}promiseRetry(function(_0x2d535d){return findForUpdate(_0x3436c1)[_0x1e45('0x9')](function(_0x41e088){if(_0x41e088!==null){return _0x41e088;}else{_0x2d535d(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0x1e45('0x9')](function(_0x1e0d84){if(!_0x1e0d84){return new Promise(function(_0x57435b){_0x57435b(handleEntityNotFound(_0x4c4899)());});}else{return _0x1e0d84[_0x1e45('0x8')](_0x3436c1['body'])[_0x1e45('0x9')](function(_0x3e6845){return respondWithResult(_0x4c4899)(_0x3e6845);});}},function(){handleEntityNotFound(_0x4c4899)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 47dff0f..1540d7a 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 _0x1b77=['define','VoiceCallReport','report_call','uniqueid','lodash','util','api','bluebird','request-promise','./voiceCallReport.attributes','exports'];(function(_0x48e645,_0x53cc57){var _0x2902f5=function(_0x2c3d4c){while(--_0x2c3d4c){_0x48e645['push'](_0x48e645['shift']());}};_0x2902f5(++_0x53cc57);}(_0x1b77,0x72));var _0x71b7=function(_0xc587ba,_0x5d4cf2){_0xc587ba=_0xc587ba-0x0;var _0x1549fa=_0x1b77[_0xc587ba];return _0x1549fa;};'use strict';var _=require(_0x71b7('0x0'));var util=require(_0x71b7('0x1'));var logger=require('../../config/logger')(_0x71b7('0x2'));var moment=require('moment');var BPromise=require(_0x71b7('0x3'));var rp=require(_0x71b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x71b7('0x5'));module[_0x71b7('0x6')]=function(_0x201664,_0x82e325){return _0x201664[_0x71b7('0x7')](_0x71b7('0x8'),attributes,{'tableName':_0x71b7('0x9'),'paranoid':![],'indexes':[{'fields':[_0x71b7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32c0=['../../config/environment','exports','define','report_call','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x45769d,_0x45b17b){var _0x5dd379=function(_0x33ab93){while(--_0x33ab93){_0x45769d['push'](_0x45769d['shift']());}};_0x5dd379(++_0x45b17b);}(_0x32c0,0x1f3));var _0x032c=function(_0x355b22,_0x337339){_0x355b22=_0x355b22-0x0;var _0x5039c2=_0x32c0[_0x355b22];return _0x5039c2;};'use strict';var _=require(_0x032c('0x0'));var util=require(_0x032c('0x1'));var logger=require('../../config/logger')(_0x032c('0x2'));var moment=require(_0x032c('0x3'));var BPromise=require('bluebird');var rp=require(_0x032c('0x4'));var fs=require('fs');var path=require(_0x032c('0x5'));var rimraf=require(_0x032c('0x6'));var config=require(_0x032c('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x032c('0x8')]=function(_0x282c50,_0x2d5376){return _0x282c50[_0x032c('0x9')]('VoiceCallReport',attributes,{'tableName':_0x032c('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c24e164..c8ba2fe 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 _0x886d=['error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','limit','include','map','model','attributes','then','debug','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2fd3da,_0x3df147){var _0x16d1e5=function(_0x1ad45b){while(--_0x1ad45b){_0x2fd3da['push'](_0x2fd3da['shift']());}};_0x16d1e5(++_0x3df147);}(_0x886d,0x1ea));var _0xd886=function(_0x46b295,_0x554b00){_0x46b295=_0x46b295-0x0;var _0x1c4c10=_0x886d[_0x46b295];return _0x1c4c10;};'use strict';var _=require(_0xd886('0x0'));var util=require(_0xd886('0x1'));var moment=require('moment');var BPromise=require(_0xd886('0x2'));var rs=require(_0xd886('0x3'));var fs=require('fs');var Redis=require(_0xd886('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd886('0x5'));var logger=require(_0xd886('0x6'))('rpc');var config=require(_0xd886('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd886('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x463370,_0x33399e,_0x1bbc7c){return new BPromise(function(_0x20037a,_0x285c46){return client[_0xd886('0x9')](_0x463370,_0x1bbc7c)['then'](function(_0x1034b1){logger[_0xd886('0xa')](_0xd886('0xb'),_0x33399e,_0xd886('0xc'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x33399e,_0xd886('0xc'),JSON[_0xd886('0xd')](_0x1034b1));if(_0x1034b1[_0xd886('0xe')]){if(_0x1034b1[_0xd886('0xe')][_0xd886('0xf')]===0x1f4){logger[_0xd886('0xe')](_0xd886('0xb'),_0x33399e,_0x1034b1[_0xd886('0xe')]['message']);return _0x285c46(_0x1034b1[_0xd886('0xe')][_0xd886('0x10')]);}logger[_0xd886('0xe')](_0xd886('0xb'),_0x33399e,_0x1034b1[_0xd886('0xe')][_0xd886('0x10')]);return _0x20037a(_0x1034b1[_0xd886('0xe')][_0xd886('0x10')]);}else{logger['info'](_0xd886('0xb'),_0x33399e,_0xd886('0xc'));_0x20037a(_0x1034b1[_0xd886('0x11')]['message']);}})[_0xd886('0x12')](function(_0x48f337){logger[_0xd886('0xe')](_0xd886('0xb'),_0x33399e,_0x48f337);_0x285c46(_0x48f337);});});}exports[_0xd886('0x13')]=function(_0x2804cf){var _0x1bd7b1=this;return new Promise(function(_0x4259ad,_0x5f03fc){return db[_0xd886('0x14')]['findAll']({'raw':_0x2804cf[_0xd886('0x15')]?_0x2804cf[_0xd886('0x15')][_0xd886('0x16')]===undefined?!![]:![]:!![],'where':_0x2804cf[_0xd886('0x15')]?_0x2804cf[_0xd886('0x15')][_0xd886('0x17')]||null:null,'attributes':_0x2804cf['options']?_0x2804cf[_0xd886('0x15')]['attributes']||null:null,'limit':_0x2804cf[_0xd886('0x15')]?_0x2804cf[_0xd886('0x15')][_0xd886('0x18')]||null:null,'include':_0x2804cf[_0xd886('0x15')]?_0x2804cf[_0xd886('0x15')][_0xd886('0x19')]?_[_0xd886('0x1a')](_0x2804cf[_0xd886('0x15')][_0xd886('0x19')],function(_0x3fa8fc){return{'model':db[_0x3fa8fc[_0xd886('0x1b')]],'as':_0x3fa8fc['as'],'attributes':_0x3fa8fc[_0xd886('0x1c')],'include':_0x3fa8fc[_0xd886('0x19')]?_[_0xd886('0x1a')](_0x3fa8fc[_0xd886('0x19')],function(_0x3be41c){return{'model':db[_0x3be41c[_0xd886('0x1b')]],'as':_0x3be41c['as'],'attributes':_0x3be41c[_0xd886('0x1c')],'include':_0x3be41c[_0xd886('0x19')]?_[_0xd886('0x1a')](_0x3be41c[_0xd886('0x19')],function(_0x14b689){return{'model':db[_0x14b689[_0xd886('0x1b')]],'as':_0x14b689['as'],'attributes':_0x14b689[_0xd886('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd886('0x1d')](function(_0xde1f4){logger[_0xd886('0xa')]('GetVoiceCallReport',_0x2804cf);logger[_0xd886('0x1e')](_0xd886('0x13'),_0x2804cf,JSON[_0xd886('0xd')](_0xde1f4));_0x4259ad(_0xde1f4);})[_0xd886('0x12')](function(_0xced56e){logger[_0xd886('0xe')]('GetVoiceCallReport',_0xced56e[_0xd886('0x10')],_0x2804cf);_0x5f03fc(_0x1bd7b1['error'](0x1f4,_0xced56e['message']));});});};exports['CreateVoiceCallReport']=function(_0x2959c4){var _0x5022d2=this;return new Promise(function(_0x48d1f0,_0x470af9){return db[_0xd886('0x14')][_0xd886('0x1f')](_0x2959c4['body'],{'raw':_0x2959c4[_0xd886('0x15')]?_0x2959c4[_0xd886('0x15')][_0xd886('0x16')]===undefined?!![]:![]:!![]})[_0xd886('0x1d')](function(_0x6c93e8){logger[_0xd886('0xa')]('CreateVoiceCallReport',_0x2959c4);logger[_0xd886('0x1e')](_0xd886('0x20'),_0x2959c4,JSON[_0xd886('0xd')](_0x6c93e8));_0x48d1f0(_0x6c93e8);})['catch'](function(_0x1e7713){logger[_0xd886('0xe')](_0xd886('0x20'),_0x1e7713[_0xd886('0x10')],_0x2959c4);_0x470af9(_0x5022d2[_0xd886('0xe')](0x1f4,_0x1e7713[_0xd886('0x10')]));});});};exports[_0xd886('0x21')]=function(_0x4f05a0){var _0x3fc6f9=this;return new Promise(function(_0x1eb732,_0x5d460a){return db['VoiceCallReport'][_0xd886('0x22')](_0x4f05a0[_0xd886('0x23')],{'raw':_0x4f05a0['options']?_0x4f05a0[_0xd886('0x15')][_0xd886('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f05a0[_0xd886('0x15')]?_0x4f05a0[_0xd886('0x15')]['where']||null:null,'attributes':_0x4f05a0[_0xd886('0x15')]?_0x4f05a0[_0xd886('0x15')]['attributes']||null:null,'limit':_0x4f05a0[_0xd886('0x15')]?_0x4f05a0['options'][_0xd886('0x18')]||null:null})[_0xd886('0x1d')](function(_0x1fa7d4){logger[_0xd886('0xa')]('UpdateVoiceCallReport',_0x4f05a0);logger[_0xd886('0x1e')](_0xd886('0x21'),_0x4f05a0,JSON[_0xd886('0xd')](_0x1fa7d4));_0x1eb732(_0x1fa7d4);})['catch'](function(_0x2caa0f){logger[_0xd886('0xe')](_0xd886('0x21'),_0x2caa0f['message'],_0x4f05a0);_0x5d460a(_0x3fc6f9[_0xd886('0xe')](0x1f4,_0x2caa0f[_0xd886('0x10')]));});});}; \ No newline at end of file +var _0xd513=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceCallReport','findAll','options','raw','attributes','include','map','model','VoiceCallReport','create','body','CreateVoiceCallReport','debug','UpdateVoiceCallReport','update','where','limit','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xe84a95,_0x3debeb){var _0x9e5d75=function(_0x72ddb3){while(--_0x72ddb3){_0xe84a95['push'](_0xe84a95['shift']());}};_0x9e5d75(++_0x3debeb);}(_0xd513,0x93));var _0x3d51=function(_0x1f15e2,_0x3d06cb){_0x1f15e2=_0x1f15e2-0x0;var _0xe04b9a=_0xd513[_0x1f15e2];return _0xe04b9a;};'use strict';var _=require('lodash');var util=require(_0x3d51('0x0'));var moment=require('moment');var BPromise=require(_0x3d51('0x1'));var rs=require(_0x3d51('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d51('0x3'))['db'];var utils=require(_0x3d51('0x4'));var logger=require(_0x3d51('0x5'))(_0x3d51('0x6'));var config=require(_0x3d51('0x7'));var jayson=require(_0x3d51('0x8'));var client=jayson[_0x3d51('0x9')][_0x3d51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbc8386,_0x57e69d,_0x7c6087){return new BPromise(function(_0x4a949a,_0x267240){return client[_0x3d51('0xb')](_0xbc8386,_0x7c6087)[_0x3d51('0xc')](function(_0x2f941f){logger[_0x3d51('0xd')](_0x3d51('0xe'),_0x57e69d,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x57e69d,_0x3d51('0xf'),JSON[_0x3d51('0x10')](_0x2f941f));if(_0x2f941f['error']){if(_0x2f941f[_0x3d51('0x11')]['code']===0x1f4){logger[_0x3d51('0x11')](_0x3d51('0xe'),_0x57e69d,_0x2f941f[_0x3d51('0x11')][_0x3d51('0x12')]);return _0x267240(_0x2f941f[_0x3d51('0x11')]['message']);}logger[_0x3d51('0x11')](_0x3d51('0xe'),_0x57e69d,_0x2f941f[_0x3d51('0x11')]['message']);return _0x4a949a(_0x2f941f[_0x3d51('0x11')][_0x3d51('0x12')]);}else{logger[_0x3d51('0xd')](_0x3d51('0xe'),_0x57e69d,'request\x20sent');_0x4a949a(_0x2f941f[_0x3d51('0x13')][_0x3d51('0x12')]);}})[_0x3d51('0x14')](function(_0x2d95ee){logger[_0x3d51('0x11')](_0x3d51('0xe'),_0x57e69d,_0x2d95ee);_0x267240(_0x2d95ee);});});}exports[_0x3d51('0x15')]=function(_0x4db3e9){var _0x290533=this;return new Promise(function(_0x1ccb8b,_0xc130d7){return db['VoiceCallReport'][_0x3d51('0x16')]({'raw':_0x4db3e9[_0x3d51('0x17')]?_0x4db3e9[_0x3d51('0x17')][_0x3d51('0x18')]===undefined?!![]:![]:!![],'where':_0x4db3e9[_0x3d51('0x17')]?_0x4db3e9[_0x3d51('0x17')]['where']||null:null,'attributes':_0x4db3e9['options']?_0x4db3e9[_0x3d51('0x17')][_0x3d51('0x19')]||null:null,'limit':_0x4db3e9[_0x3d51('0x17')]?_0x4db3e9[_0x3d51('0x17')]['limit']||null:null,'include':_0x4db3e9[_0x3d51('0x17')]?_0x4db3e9['options'][_0x3d51('0x1a')]?_[_0x3d51('0x1b')](_0x4db3e9[_0x3d51('0x17')]['include'],function(_0x33bdea){return{'model':db[_0x33bdea['model']],'as':_0x33bdea['as'],'attributes':_0x33bdea['attributes'],'include':_0x33bdea[_0x3d51('0x1a')]?_[_0x3d51('0x1b')](_0x33bdea[_0x3d51('0x1a')],function(_0x4bd828){return{'model':db[_0x4bd828[_0x3d51('0x1c')]],'as':_0x4bd828['as'],'attributes':_0x4bd828[_0x3d51('0x19')],'include':_0x4bd828['include']?_[_0x3d51('0x1b')](_0x4bd828[_0x3d51('0x1a')],function(_0x1c06dd){return{'model':db[_0x1c06dd[_0x3d51('0x1c')]],'as':_0x1c06dd['as'],'attributes':_0x1c06dd[_0x3d51('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3d51('0xc')](function(_0x1437af){logger['info'](_0x3d51('0x15'),_0x4db3e9);logger['debug']('GetVoiceCallReport',_0x4db3e9,JSON[_0x3d51('0x10')](_0x1437af));_0x1ccb8b(_0x1437af);})[_0x3d51('0x14')](function(_0x3f6f42){logger[_0x3d51('0x11')](_0x3d51('0x15'),_0x3f6f42[_0x3d51('0x12')],_0x4db3e9);_0xc130d7(_0x290533['error'](0x1f4,_0x3f6f42[_0x3d51('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x3797d5){var _0x1535c4=this;return new Promise(function(_0x10f2d5,_0x3cf84b){return db[_0x3d51('0x1d')][_0x3d51('0x1e')](_0x3797d5[_0x3d51('0x1f')],{'raw':_0x3797d5[_0x3d51('0x17')]?_0x3797d5[_0x3d51('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3d51('0xc')](function(_0x17896a){logger[_0x3d51('0xd')](_0x3d51('0x20'),_0x3797d5);logger[_0x3d51('0x21')](_0x3d51('0x20'),_0x3797d5,JSON['stringify'](_0x17896a));_0x10f2d5(_0x17896a);})[_0x3d51('0x14')](function(_0x47041d){logger[_0x3d51('0x11')](_0x3d51('0x20'),_0x47041d[_0x3d51('0x12')],_0x3797d5);_0x3cf84b(_0x1535c4[_0x3d51('0x11')](0x1f4,_0x47041d[_0x3d51('0x12')]));});});};exports[_0x3d51('0x22')]=function(_0x1eee2d){var _0x43e4ec=this;return new Promise(function(_0x7d8110,_0x44a907){return db[_0x3d51('0x1d')][_0x3d51('0x23')](_0x1eee2d[_0x3d51('0x1f')],{'raw':_0x1eee2d[_0x3d51('0x17')]?_0x1eee2d[_0x3d51('0x17')][_0x3d51('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eee2d['options']?_0x1eee2d[_0x3d51('0x17')][_0x3d51('0x24')]||null:null,'attributes':_0x1eee2d[_0x3d51('0x17')]?_0x1eee2d[_0x3d51('0x17')][_0x3d51('0x19')]||null:null,'limit':_0x1eee2d['options']?_0x1eee2d[_0x3d51('0x17')][_0x3d51('0x25')]||null:null})['then'](function(_0x17a2ed){logger[_0x3d51('0xd')](_0x3d51('0x22'),_0x1eee2d);logger[_0x3d51('0x21')]('UpdateVoiceCallReport',_0x1eee2d,JSON['stringify'](_0x17a2ed));_0x7d8110(_0x17a2ed);})['catch'](function(_0x541776){logger[_0x3d51('0x11')](_0x3d51('0x22'),_0x541776[_0x3d51('0x12')],_0x1eee2d);_0x44a907(_0x43e4ec[_0x3d51('0x11')](0x1f4,_0x541776[_0x3d51('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e1887a6..586ac0f 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 _0xf4fe=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xf4fe,0x84));var _0xef4f=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xf4fe[_0x174ef5];return _0x1cc379;};'use strict';var multer=require(_0xef4f('0x0'));var util=require(_0xef4f('0x1'));var path=require(_0xef4f('0x2'));var timeout=require(_0xef4f('0x3'));var express=require('express');var router=express[_0xef4f('0x4')]();var fs_extra=require(_0xef4f('0x5'));var auth=require(_0xef4f('0x6'));var interaction=require(_0xef4f('0x7'));var config=require(_0xef4f('0x8'));var controller=require(_0xef4f('0x9'));router[_0xef4f('0xa')]('/',auth[_0xef4f('0xb')](),controller['index']);router[_0xef4f('0xa')](_0xef4f('0xc'),auth[_0xef4f('0xb')](),controller[_0xef4f('0xd')]);router[_0xef4f('0xe')]('/',auth[_0xef4f('0xb')](),controller[_0xef4f('0xf')]);router[_0xef4f('0x10')](_0xef4f('0xc'),auth[_0xef4f('0xb')](),controller[_0xef4f('0x11')]);router[_0xef4f('0x12')](_0xef4f('0xc'),auth[_0xef4f('0xb')](),controller[_0xef4f('0x13')]);module[_0xef4f('0x14')]=router; \ No newline at end of file +var _0xc565=['connect-timeout','express','Router','fs-extra','../../components/auth/service','get','/:id','isAuthenticated','show','post','put','update','exports','multer','util','path'];(function(_0x568471,_0x4f1f18){var _0x5ee339=function(_0x1ffc18){while(--_0x1ffc18){_0x568471['push'](_0x568471['shift']());}};_0x5ee339(++_0x4f1f18);}(_0xc565,0x14d));var _0x5c56=function(_0x586998,_0x306581){_0x586998=_0x586998-0x0;var _0x3d9891=_0xc565[_0x586998];return _0x3d9891;};'use strict';var multer=require(_0x5c56('0x0'));var util=require(_0x5c56('0x1'));var path=require(_0x5c56('0x2'));var timeout=require(_0x5c56('0x3'));var express=require(_0x5c56('0x4'));var router=express[_0x5c56('0x5')]();var fs_extra=require(_0x5c56('0x6'));var auth=require(_0x5c56('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x5c56('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5c56('0x8')](_0x5c56('0x9'),auth[_0x5c56('0xa')](),controller[_0x5c56('0xb')]);router[_0x5c56('0xc')]('/',auth[_0x5c56('0xa')](),controller['create']);router[_0x5c56('0xd')](_0x5c56('0x9'),auth[_0x5c56('0xa')](),controller[_0x5c56('0xe')]);router['delete'](_0x5c56('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x5c56('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 337a70e..7b3787c 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 _0x4f22=['setDataValue','options','getDataValue','sequelize','STRING','name'];(function(_0x8e45c7,_0x36a9b){var _0x41ca8d=function(_0x2ca9f8){while(--_0x2ca9f8){_0x8e45c7['push'](_0x8e45c7['shift']());}};_0x41ca8d(++_0x36a9b);}(_0x4f22,0xc3));var _0x24f2=function(_0x484187,_0x2ec490){_0x484187=_0x484187-0x0;var _0x6bfed3=_0x4f22[_0x484187];return _0x6bfed3;};'use strict';var Sequelize=require(_0x24f2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x24f2('0x1')],'unique':_0x24f2('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x24f2('0x1')],'set':function(_0x35cfa3){this[_0x24f2('0x3')](_0x24f2('0x4'),_0x35cfa3?_0x35cfa3['join'](''):[]);},'get':function(){return this['getDataValue'](_0x24f2('0x4'))?this[_0x24f2('0x5')](_0x24f2('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x24f2('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x24f2('0x1')]},'description':{'type':Sequelize[_0x24f2('0x1')]}}; \ No newline at end of file +var _0x0327=['join','getDataValue','split','BOOLEAN','exports','STRING','setDataValue','options'];(function(_0x153d11,_0x3cff42){var _0x5e074f=function(_0x3a256e){while(--_0x3a256e){_0x153d11['push'](_0x153d11['shift']());}};_0x5e074f(++_0x3cff42);}(_0x0327,0x134));var _0x7032=function(_0x500e16,_0x30ec9a){_0x500e16=_0x500e16-0x0;var _0x54f1d1=_0x0327[_0x500e16];return _0x54f1d1;};'use strict';var Sequelize=require('sequelize');module[_0x7032('0x0')]={'name':{'type':Sequelize[_0x7032('0x1')]},'prefix':{'type':Sequelize[_0x7032('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x7032('0x1')],'set':function(_0x366434){this[_0x7032('0x2')](_0x7032('0x3'),_0x366434?_0x366434[_0x7032('0x4')](''):[]);},'get':function(){return this[_0x7032('0x5')](_0x7032('0x3'))?this['getDataValue'](_0x7032('0x3'))[_0x7032('0x6')](''):[];}},'auth':{'type':Sequelize[_0x7032('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x7032('0x1')]},'record':{'type':Sequelize[_0x7032('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7032('0x1')]},'description':{'type':Sequelize[_0x7032('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 8ecc6d3..5425771 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 _0xd73a=['update','then','destroy','get','ChanSpies','UserProfileResource','name','send','map','VoiceChanSpy','rawAttributes','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0xf48d27,_0xc761af){var _0x172722=function(_0x4722d1){while(--_0x4722d1){_0xf48d27['push'](_0xf48d27['shift']());}};_0x172722(++_0xc761af);}(_0xd73a,0x171));var _0xad73=function(_0x1060ea,_0x4c7322){_0x1060ea=_0x1060ea-0x0;var _0x49ec59=_0xd73a[_0x1060ea];return _0x49ec59;};'use strict';var emlformat=require(_0xad73('0x0'));var rimraf=require(_0xad73('0x1'));var zipdir=require(_0xad73('0x2'));var jsonpatch=require(_0xad73('0x3'));var rp=require(_0xad73('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad73('0x5'));var util=require(_0xad73('0x6'));var path=require(_0xad73('0x7'));var sox=require(_0xad73('0x8'));var csv=require(_0xad73('0x9'));var ejs=require(_0xad73('0xa'));var fs=require('fs');var fs_extra=require(_0xad73('0xb'));var _=require(_0xad73('0xc'));var squel=require(_0xad73('0xd'));var crypto=require(_0xad73('0xe'));var jsforce=require(_0xad73('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xad73('0x9'));var querystring=require('querystring');var Papa=require(_0xad73('0x10'));var Redis=require(_0xad73('0x11'));var authService=require(_0xad73('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xad73('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad73('0x14'))('api');var utils=require(_0xad73('0x15'));var config=require(_0xad73('0x16'));var licenseUtil=require(_0xad73('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1045be,_0x241ff5){_0x241ff5=_0x241ff5||0xcc;return function(_0x488787){if(_0x488787){return _0x1045be[_0xad73('0x18')](_0x241ff5);}return _0x1045be[_0xad73('0x19')](_0x241ff5)[_0xad73('0x1a')]();};}function respondWithResult(_0x27a9d2,_0x15f72d){_0x15f72d=_0x15f72d||0xc8;return function(_0x82fe13){if(_0x82fe13){return _0x27a9d2['status'](_0x15f72d)[_0xad73('0x1b')](_0x82fe13);}};}function respondWithFilteredResult(_0x35c2c5,_0x4336fa){return function(_0x155548){if(_0x155548){var _0x2f0dcd=typeof _0x4336fa[_0xad73('0x1c')]===_0xad73('0x1d')&&typeof _0x4336fa[_0xad73('0x1e')]===_0xad73('0x1d');var _0xad072c=_0x155548['count'];var _0x47381a=_0x2f0dcd?0x0:_0x4336fa['offset'];var _0x5bd242=_0x2f0dcd?_0x155548[_0xad73('0x1f')]:_0x4336fa[_0xad73('0x1c')]+_0x4336fa[_0xad73('0x1e')];var _0x578068;if(_0x5bd242>=_0xad072c){_0x5bd242=_0xad072c;_0x578068=0xc8;}else{_0x578068=0xce;}_0x35c2c5[_0xad73('0x19')](_0x578068);return _0x35c2c5[_0xad73('0x20')]('Content-Range',_0x47381a+'-'+_0x5bd242+'/'+_0xad072c)[_0xad73('0x1b')](_0x155548);}return null;};}function patchUpdates(_0x4289df){return function(_0x3e02ed){try{jsonpatch[_0xad73('0x21')](_0x3e02ed,_0x4289df,!![]);}catch(_0x2e6cdb){return BPromise[_0xad73('0x22')](_0x2e6cdb);}return _0x3e02ed[_0xad73('0x23')]();};}function saveUpdates(_0x497c3d,_0xfe2758){return function(_0x31f5c4){if(_0x31f5c4){return _0x31f5c4[_0xad73('0x24')](_0x497c3d)[_0xad73('0x25')](function(_0xb3e0b0){return _0xb3e0b0;});}return null;};}function removeEntity(_0x2a1295,_0xbfb297){return function(_0x439f09){if(_0x439f09){return _0x439f09[_0xad73('0x26')]()[_0xad73('0x25')](function(){var _0x18e58b=_0x439f09[_0xad73('0x27')]({'plain':!![]});var _0x182805=_0xad73('0x28');return db[_0xad73('0x29')][_0xad73('0x26')]({'where':{'type':_0x182805,'resourceId':_0x18e58b['id']}})[_0xad73('0x25')](function(){return _0x439f09;});})[_0xad73('0x25')](function(){_0x2a1295[_0xad73('0x19')](0xcc)[_0xad73('0x1a')]();});}};}function handleEntityNotFound(_0x5bd387,_0x4e0855){return function(_0x5cd6a6){if(!_0x5cd6a6){_0x5bd387[_0xad73('0x18')](0x194);}return _0x5cd6a6;};}function handleError(_0x6e79c8,_0x4e435b){_0x4e435b=_0x4e435b||0x1f4;return function(_0x3f1f80){logger['error'](_0x3f1f80['stack']);if(_0x3f1f80[_0xad73('0x2a')]){delete _0x3f1f80[_0xad73('0x2a')];}_0x6e79c8[_0xad73('0x19')](_0x4e435b)[_0xad73('0x2b')](_0x3f1f80);};}exports['index']=function(_0xdf45e8,_0x3fab83){var _0x6d8b43={},_0x5939f3={},_0xca0215={'count':0x0,'rows':[]};var _0x1b488a=_[_0xad73('0x2c')](db[_0xad73('0x2d')][_0xad73('0x2e')],function(_0x53cd43){return{'name':_0x53cd43['fieldName'],'type':_0x53cd43['type'][_0xad73('0x2f')]};});_0x5939f3['model']=_[_0xad73('0x2c')](_0x1b488a,'name');_0x5939f3[_0xad73('0x30')]=_[_0xad73('0x31')](_0xdf45e8['query']);_0x5939f3['filters']=_[_0xad73('0x32')](_0x5939f3[_0xad73('0x33')],_0x5939f3['query']);_0x6d8b43['attributes']=_[_0xad73('0x32')](_0x5939f3['model'],qs[_0xad73('0x34')](_0xdf45e8[_0xad73('0x30')]['fields']));_0x6d8b43[_0xad73('0x35')]=_0x6d8b43['attributes'][_0xad73('0x36')]?_0x6d8b43[_0xad73('0x35')]:_0x5939f3[_0xad73('0x33')];if(!_0xdf45e8[_0xad73('0x30')][_0xad73('0x37')](_0xad73('0x38'))){_0x6d8b43[_0xad73('0x1e')]=qs[_0xad73('0x1e')](_0xdf45e8[_0xad73('0x30')]['limit']);_0x6d8b43[_0xad73('0x1c')]=qs[_0xad73('0x1c')](_0xdf45e8['query'][_0xad73('0x1c')]);}_0x6d8b43[_0xad73('0x39')]=qs[_0xad73('0x3a')](_0xdf45e8[_0xad73('0x30')][_0xad73('0x3a')]);_0x6d8b43[_0xad73('0x3b')]=qs[_0xad73('0x3c')](_[_0xad73('0x3d')](_0xdf45e8[_0xad73('0x30')],_0x5939f3['filters']),_0x1b488a);if(_0xdf45e8[_0xad73('0x30')][_0xad73('0x3e')]){_0x6d8b43[_0xad73('0x3b')]=_['merge'](_0x6d8b43['where'],{'$or':_[_0xad73('0x2c')](_0x1b488a,function(_0x4c1ba9){if(_0x4c1ba9['type']!==_0xad73('0x3f')){var _0x12a385={};_0x12a385[_0x4c1ba9[_0xad73('0x2a')]]={'$like':'%'+_0xdf45e8[_0xad73('0x30')]['filter']+'%'};return _0x12a385;}})});}_0x6d8b43=_[_0xad73('0x40')]({},_0x6d8b43,_0xdf45e8[_0xad73('0x41')]);var _0x486961={'where':_0x6d8b43[_0xad73('0x3b')]};return db[_0xad73('0x2d')]['count'](_0x486961)[_0xad73('0x25')](function(_0x46f3e8){_0xca0215[_0xad73('0x1f')]=_0x46f3e8;if(_0xdf45e8['query'][_0xad73('0x42')]){_0x6d8b43[_0xad73('0x43')]=[{'all':!![]}];}return db[_0xad73('0x2d')][_0xad73('0x44')](_0x6d8b43);})[_0xad73('0x25')](function(_0x4ee68d){_0xca0215['rows']=_0x4ee68d;return _0xca0215;})['then'](respondWithFilteredResult(_0x3fab83,_0x6d8b43))[_0xad73('0x45')](handleError(_0x3fab83,null));};exports[_0xad73('0x46')]=function(_0x11c951,_0xaf84e7){var _0x17bd79={'raw':![],'where':{'id':_0x11c951[_0xad73('0x47')]['id']}},_0x325fd0={};_0x325fd0['model']=_[_0xad73('0x31')](db[_0xad73('0x2d')]['rawAttributes']);_0x325fd0['query']=_[_0xad73('0x31')](_0x11c951[_0xad73('0x30')]);_0x325fd0[_0xad73('0x3c')]=_[_0xad73('0x32')](_0x325fd0['model'],_0x325fd0[_0xad73('0x30')]);_0x17bd79[_0xad73('0x35')]=_[_0xad73('0x32')](_0x325fd0['model'],qs[_0xad73('0x34')](_0x11c951[_0xad73('0x30')][_0xad73('0x34')]));_0x17bd79[_0xad73('0x35')]=_0x17bd79['attributes']['length']?_0x17bd79[_0xad73('0x35')]:_0x325fd0[_0xad73('0x33')];if(_0x11c951[_0xad73('0x30')][_0xad73('0x42')]){_0x17bd79[_0xad73('0x43')]=[{'all':!![]}];}_0x17bd79=_[_0xad73('0x40')]({},_0x17bd79,_0x11c951[_0xad73('0x41')]);return db[_0xad73('0x2d')][_0xad73('0x48')](_0x17bd79)['then'](handleEntityNotFound(_0xaf84e7,null))['then'](respondWithResult(_0xaf84e7,null))[_0xad73('0x45')](handleError(_0xaf84e7,null));};exports[_0xad73('0x49')]=function(_0xd5f21,_0x5b6e41){return db[_0xad73('0x2d')][_0xad73('0x49')](_0xd5f21[_0xad73('0x4a')],{})[_0xad73('0x25')](function(_0x51f88f){var _0xa28ea5=_0xd5f21[_0xad73('0x4b')][_0xad73('0x27')]({'plain':!![]});if(!_0xa28ea5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa28ea5[_0xad73('0x4c')]===_0xad73('0x4b')){var _0x3e884f=_0x51f88f[_0xad73('0x27')]({'plain':!![]});var _0x50706c='ChanSpies';return db[_0xad73('0x4d')][_0xad73('0x48')]({'where':{'name':_0x50706c,'userProfileId':_0xa28ea5[_0xad73('0x4e')]},'raw':!![]})['then'](function(_0x5ca8d3){if(_0x5ca8d3&&_0x5ca8d3[_0xad73('0x4f')]===0x0){return db[_0xad73('0x29')][_0xad73('0x49')]({'name':_0x3e884f[_0xad73('0x2a')],'resourceId':_0x3e884f['id'],'type':_0x5ca8d3[_0xad73('0x2a')],'sectionId':_0x5ca8d3['id']},{})[_0xad73('0x25')](function(){return _0x51f88f;});}else{return _0x51f88f;}})[_0xad73('0x45')](function(_0x49c661){logger[_0xad73('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49c661);throw _0x49c661;});}return _0x51f88f;})[_0xad73('0x25')](respondWithResult(_0x5b6e41,0xc9))['catch'](handleError(_0x5b6e41,null));};exports['update']=function(_0x23b016,_0x3f0e65){if(_0x23b016['body']['id']){delete _0x23b016[_0xad73('0x4a')]['id'];}return db[_0xad73('0x2d')][_0xad73('0x48')]({'where':{'id':_0x23b016[_0xad73('0x47')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x3f0e65,null))[_0xad73('0x25')](saveUpdates(_0x23b016[_0xad73('0x4a')],null))[_0xad73('0x25')](respondWithResult(_0x3f0e65,null))[_0xad73('0x45')](handleError(_0x3f0e65,null));};exports[_0xad73('0x26')]=function(_0x4e2e80,_0x10d264){return db['VoiceChanSpy'][_0xad73('0x48')]({'where':{'id':_0x4e2e80[_0xad73('0x47')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x10d264,null))[_0xad73('0x25')](removeEntity(_0x10d264,null))['catch'](handleError(_0x10d264,null));}; \ No newline at end of file +var _0xbb95=['set','Content-Range','apply','save','then','destroy','get','ChanSpies','UserProfileResource','end','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','options','includeAll','findAll','catch','show','params','length','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','request-promise','moment','mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status'];(function(_0x37af9b,_0x366df3){var _0x3d2a7a=function(_0x42de65){while(--_0x42de65){_0x37af9b['push'](_0x37af9b['shift']());}};_0x3d2a7a(++_0x366df3);}(_0xbb95,0x7f));var _0x5bb9=function(_0x569372,_0x28c66d){_0x569372=_0x569372-0x0;var _0x51c7b3=_0xbb95[_0x569372];return _0x51c7b3;};'use strict';var emlformat=require(_0x5bb9('0x0'));var rimraf=require(_0x5bb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5bb9('0x2'));var moment=require(_0x5bb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5bb9('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5bb9('0x5'));var ejs=require(_0x5bb9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bb9('0x7'));var squel=require(_0x5bb9('0x8'));var crypto=require(_0x5bb9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5bb9('0xa'));var toCsv=require(_0x5bb9('0x5'));var querystring=require(_0x5bb9('0xb'));var Papa=require(_0x5bb9('0xc'));var Redis=require(_0x5bb9('0xd'));var authService=require(_0x5bb9('0xe'));var qs=require(_0x5bb9('0xf'));var as=require(_0x5bb9('0x10'));var hardwareService=require(_0x5bb9('0x11'));var logger=require(_0x5bb9('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x5bb9('0x13'));var licenseUtil=require(_0x5bb9('0x14'));var db=require(_0x5bb9('0x15'))['db'];function respondWithStatusCode(_0x1ce0d4,_0x2b75af){_0x2b75af=_0x2b75af||0xcc;return function(_0x159e47){if(_0x159e47){return _0x1ce0d4[_0x5bb9('0x16')](_0x2b75af);}return _0x1ce0d4['status'](_0x2b75af)['end']();};}function respondWithResult(_0x41eb45,_0x407a7b){_0x407a7b=_0x407a7b||0xc8;return function(_0x1ebea3){if(_0x1ebea3){return _0x41eb45['status'](_0x407a7b)[_0x5bb9('0x17')](_0x1ebea3);}};}function respondWithFilteredResult(_0x1a382f,_0x582492){return function(_0x1ae28a){if(_0x1ae28a){var _0x29b45c=typeof _0x582492[_0x5bb9('0x18')]===_0x5bb9('0x19')&&typeof _0x582492[_0x5bb9('0x1a')]===_0x5bb9('0x19');var _0x3b9f3c=_0x1ae28a['count'];var _0x16b7ab=_0x29b45c?0x0:_0x582492['offset'];var _0xecb76c=_0x29b45c?_0x1ae28a[_0x5bb9('0x1b')]:_0x582492[_0x5bb9('0x18')]+_0x582492['limit'];var _0x35ccab;if(_0xecb76c>=_0x3b9f3c){_0xecb76c=_0x3b9f3c;_0x35ccab=0xc8;}else{_0x35ccab=0xce;}_0x1a382f[_0x5bb9('0x1c')](_0x35ccab);return _0x1a382f[_0x5bb9('0x1d')](_0x5bb9('0x1e'),_0x16b7ab+'-'+_0xecb76c+'/'+_0x3b9f3c)[_0x5bb9('0x17')](_0x1ae28a);}return null;};}function patchUpdates(_0x2c9b5e){return function(_0x419f27){try{jsonpatch[_0x5bb9('0x1f')](_0x419f27,_0x2c9b5e,!![]);}catch(_0xda0a2e){return BPromise['reject'](_0xda0a2e);}return _0x419f27[_0x5bb9('0x20')]();};}function saveUpdates(_0x51fa3a,_0x1949c1){return function(_0x2d8d84){if(_0x2d8d84){return _0x2d8d84['update'](_0x51fa3a)[_0x5bb9('0x21')](function(_0x46da2e){return _0x46da2e;});}return null;};}function removeEntity(_0x4cd950,_0x1fb206){return function(_0x48c553){if(_0x48c553){return _0x48c553[_0x5bb9('0x22')]()['then'](function(){var _0x4909ea=_0x48c553[_0x5bb9('0x23')]({'plain':!![]});var _0x13a50d=_0x5bb9('0x24');return db[_0x5bb9('0x25')][_0x5bb9('0x22')]({'where':{'type':_0x13a50d,'resourceId':_0x4909ea['id']}})[_0x5bb9('0x21')](function(){return _0x48c553;});})[_0x5bb9('0x21')](function(){_0x4cd950['status'](0xcc)[_0x5bb9('0x26')]();});}};}function handleEntityNotFound(_0x362410,_0x478843){return function(_0x1e9450){if(!_0x1e9450){_0x362410[_0x5bb9('0x16')](0x194);}return _0x1e9450;};}function handleError(_0x91cce7,_0x5287d5){_0x5287d5=_0x5287d5||0x1f4;return function(_0x5b14e5){logger[_0x5bb9('0x27')](_0x5b14e5[_0x5bb9('0x28')]);if(_0x5b14e5['name']){delete _0x5b14e5[_0x5bb9('0x29')];}_0x91cce7[_0x5bb9('0x1c')](_0x5287d5)[_0x5bb9('0x2a')](_0x5b14e5);};}exports[_0x5bb9('0x2b')]=function(_0x4d9902,_0x508842){var _0x5e477f={},_0x56b8b4={},_0x5340e2={'count':0x0,'rows':[]};var _0xdfb304=_[_0x5bb9('0x2c')](db[_0x5bb9('0x2d')][_0x5bb9('0x2e')],function(_0x52124b){return{'name':_0x52124b[_0x5bb9('0x2f')],'type':_0x52124b[_0x5bb9('0x30')]['key']};});_0x56b8b4[_0x5bb9('0x31')]=_['map'](_0xdfb304,'name');_0x56b8b4[_0x5bb9('0x32')]=_[_0x5bb9('0x33')](_0x4d9902['query']);_0x56b8b4['filters']=_['intersection'](_0x56b8b4[_0x5bb9('0x31')],_0x56b8b4[_0x5bb9('0x32')]);_0x5e477f[_0x5bb9('0x34')]=_[_0x5bb9('0x35')](_0x56b8b4[_0x5bb9('0x31')],qs['fields'](_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x36')]));_0x5e477f['attributes']=_0x5e477f['attributes']['length']?_0x5e477f['attributes']:_0x56b8b4[_0x5bb9('0x31')];if(!_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x37')](_0x5bb9('0x38'))){_0x5e477f['limit']=qs[_0x5bb9('0x1a')](_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x1a')]);_0x5e477f[_0x5bb9('0x18')]=qs['offset'](_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x18')]);}_0x5e477f[_0x5bb9('0x39')]=qs[_0x5bb9('0x3a')](_0x4d9902[_0x5bb9('0x32')]['sort']);_0x5e477f[_0x5bb9('0x3b')]=qs['filters'](_[_0x5bb9('0x3c')](_0x4d9902[_0x5bb9('0x32')],_0x56b8b4[_0x5bb9('0x3d')]),_0xdfb304);if(_0x4d9902['query']['filter']){_0x5e477f[_0x5bb9('0x3b')]=_['merge'](_0x5e477f[_0x5bb9('0x3b')],{'$or':_[_0x5bb9('0x2c')](_0xdfb304,function(_0x59eb50){if(_0x59eb50[_0x5bb9('0x30')]!=='VIRTUAL'){var _0x197c89={};_0x197c89[_0x59eb50[_0x5bb9('0x29')]]={'$like':'%'+_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x3e')]+'%'};return _0x197c89;}})});}_0x5e477f=_['merge']({},_0x5e477f,_0x4d9902[_0x5bb9('0x3f')]);var _0x57f373={'where':_0x5e477f[_0x5bb9('0x3b')]};return db[_0x5bb9('0x2d')][_0x5bb9('0x1b')](_0x57f373)['then'](function(_0x29f2f1){_0x5340e2[_0x5bb9('0x1b')]=_0x29f2f1;if(_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x40')]){_0x5e477f['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x5bb9('0x41')](_0x5e477f);})[_0x5bb9('0x21')](function(_0x1c2a90){_0x5340e2['rows']=_0x1c2a90;return _0x5340e2;})[_0x5bb9('0x21')](respondWithFilteredResult(_0x508842,_0x5e477f))[_0x5bb9('0x42')](handleError(_0x508842,null));};exports[_0x5bb9('0x43')]=function(_0x1a5eaf,_0x256e06){var _0x2eff61={'raw':![],'where':{'id':_0x1a5eaf[_0x5bb9('0x44')]['id']}},_0x518e26={};_0x518e26[_0x5bb9('0x31')]=_['keys'](db[_0x5bb9('0x2d')]['rawAttributes']);_0x518e26[_0x5bb9('0x32')]=_[_0x5bb9('0x33')](_0x1a5eaf[_0x5bb9('0x32')]);_0x518e26[_0x5bb9('0x3d')]=_[_0x5bb9('0x35')](_0x518e26[_0x5bb9('0x31')],_0x518e26[_0x5bb9('0x32')]);_0x2eff61[_0x5bb9('0x34')]=_[_0x5bb9('0x35')](_0x518e26[_0x5bb9('0x31')],qs[_0x5bb9('0x36')](_0x1a5eaf[_0x5bb9('0x32')][_0x5bb9('0x36')]));_0x2eff61['attributes']=_0x2eff61['attributes'][_0x5bb9('0x45')]?_0x2eff61[_0x5bb9('0x34')]:_0x518e26['model'];if(_0x1a5eaf[_0x5bb9('0x32')][_0x5bb9('0x40')]){_0x2eff61['include']=[{'all':!![]}];}_0x2eff61=_[_0x5bb9('0x46')]({},_0x2eff61,_0x1a5eaf['options']);return db[_0x5bb9('0x2d')]['find'](_0x2eff61)[_0x5bb9('0x21')](handleEntityNotFound(_0x256e06,null))['then'](respondWithResult(_0x256e06,null))['catch'](handleError(_0x256e06,null));};exports[_0x5bb9('0x47')]=function(_0x2790f2,_0x262403){return db[_0x5bb9('0x2d')]['create'](_0x2790f2[_0x5bb9('0x48')],{})['then'](function(_0x2c1158){var _0x5ba5df=_0x2790f2[_0x5bb9('0x49')][_0x5bb9('0x23')]({'plain':!![]});if(!_0x5ba5df)throw new Error(_0x5bb9('0x4a'));if(_0x5ba5df['role']===_0x5bb9('0x49')){var _0x1053d1=_0x2c1158[_0x5bb9('0x23')]({'plain':!![]});var _0x174b0c=_0x5bb9('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x174b0c,'userProfileId':_0x5ba5df[_0x5bb9('0x4b')]},'raw':!![]})[_0x5bb9('0x21')](function(_0xa569ab){if(_0xa569ab&&_0xa569ab['autoAssociation']===0x0){return db[_0x5bb9('0x25')][_0x5bb9('0x47')]({'name':_0x1053d1[_0x5bb9('0x29')],'resourceId':_0x1053d1['id'],'type':_0xa569ab[_0x5bb9('0x29')],'sectionId':_0xa569ab['id']},{})[_0x5bb9('0x21')](function(){return _0x2c1158;});}else{return _0x2c1158;}})[_0x5bb9('0x42')](function(_0x436096){logger['error'](_0x5bb9('0x4c'),_0x436096);throw _0x436096;});}return _0x2c1158;})['then'](respondWithResult(_0x262403,0xc9))[_0x5bb9('0x42')](handleError(_0x262403,null));};exports['update']=function(_0x49d1be,_0x58a56c){if(_0x49d1be[_0x5bb9('0x48')]['id']){delete _0x49d1be['body']['id'];}return db['VoiceChanSpy'][_0x5bb9('0x4d')]({'where':{'id':_0x49d1be[_0x5bb9('0x44')]['id']}})['then'](handleEntityNotFound(_0x58a56c,null))['then'](saveUpdates(_0x49d1be[_0x5bb9('0x48')],null))[_0x5bb9('0x21')](respondWithResult(_0x58a56c,null))[_0x5bb9('0x42')](handleError(_0x58a56c,null));};exports[_0x5bb9('0x22')]=function(_0x5c750d,_0x57b13d){return db['VoiceChanSpy'][_0x5bb9('0x4d')]({'where':{'id':_0x5c750d[_0x5bb9('0x44')]['id']}})[_0x5bb9('0x21')](handleEntityNotFound(_0x57b13d,null))['then'](removeEntity(_0x57b13d,null))['catch'](handleError(_0x57b13d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index cd050ad..2fe814d 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 _0x5042=['system','push','merge','Set','chanspy','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','name','options','join','record','StopMixMonitor','length','concat','internal','User','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix'];(function(_0x971cc3,_0x5b8bce){var _0x2ce3f1=function(_0x532c9d){while(--_0x532c9d){_0x971cc3['push'](_0x971cc3['shift']());}};_0x2ce3f1(++_0x5b8bce);}(_0x5042,0x1c0));var _0x2504=function(_0x1af11f,_0x1ea9da){_0x1af11f=_0x1af11f-0x0;var _0x1a1b50=_0x5042[_0x1af11f];return _0x1a1b50;};'use strict';var _=require('lodash');var util=require(_0x2504('0x0'));var BPromise=require('bluebird');var attributes=require(_0x2504('0x1'));var getUserApplications=function(_0x36c8a4,_0x28661d,_0x54e367){var _0x298866=0x1;var _0x3b3347=[];var _0x224b2f={'context':_0x28661d[_0x2504('0x2')]||_0x2504('0x3'),'exten':util[_0x2504('0x4')](_0x2504('0x5'),_0x36c8a4[_0x2504('0x6')],_0x54e367),'type':_0x2504('0x7'),'isApp':![],'ChanSpyId':_0x36c8a4['id'],'UserId':_0x28661d['id']};_0x3b3347[_0x2504('0x8')](_[_0x2504('0x9')]({'app':_0x2504('0xa'),'appdata':util[_0x2504('0x4')]('CDR(type)=%s',_0x2504('0xb')),'priority':_0x298866++},_0x224b2f));if(_0x36c8a4['record']){_0x3b3347[_0x2504('0x8')](_[_0x2504('0x9')]({'app':_0x2504('0xc'),'appdata':util[_0x2504('0x4')](_0x2504('0xd'),_0x36c8a4['recordingFormat']),'priority':_0x298866++},_0x224b2f));}if(_0x36c8a4['auth']){_0x3b3347[_0x2504('0x8')](_['merge']({'app':_0x2504('0xe'),'appdata':_0x36c8a4[_0x2504('0xf')],'priority':_0x298866++},_0x224b2f));}_0x3b3347[_0x2504('0x8')](_[_0x2504('0x9')]({'app':'ChanSpy','appdata':util[_0x2504('0x4')]('SIP/%s,%s',_0x28661d[_0x2504('0x10')],_0x36c8a4[_0x2504('0x11')]?_0x36c8a4[_0x2504('0x11')][_0x2504('0x12')](''):''),'priority':_0x298866++},_0x224b2f));if(_0x36c8a4[_0x2504('0x13')]){_0x3b3347[_0x2504('0x8')](_[_0x2504('0x9')]({'app':_0x2504('0x14'),'priority':_0x298866++},_0x224b2f));}return _0x3b3347;};var getChanSpyApplications=function(_0xb6b9c7,_0xfb3a83){var _0x49157c=[];for(var _0x5a979f=0x0,_0x13f2e2=0x1;_0x5a979f<_0xfb3a83[_0x2504('0x15')];_0x5a979f++,_0x13f2e2=0x1){_0x49157c=_0x49157c[_0x2504('0x16')](getUserApplications(_0xb6b9c7,_0xfb3a83[_0x5a979f],_0xfb3a83[_0x5a979f][_0x2504('0x17')]));if(_0xfb3a83[_0x5a979f]['internal']!=_0xfb3a83[_0x5a979f][_0x2504('0x10')]){_0x49157c=_0x49157c[_0x2504('0x16')](getUserApplications(_0xb6b9c7,_0xfb3a83[_0x5a979f],_0xfb3a83[_0x5a979f][_0x2504('0x10')]));}}return _0x49157c;};var getChanSpyPromise=function(_0x562c6b,_0x621b66){return new BPromise(function(_0x130465,_0x338291){return _0x562c6b[_0x2504('0x18')]['findAll']({'attributes':['id',_0x2504('0x10'),'internal'],'where':{'role':_0x2504('0x19'),'chanspy':!![]},'raw':!![]})[_0x2504('0x1a')](function(_0x14636e){if(_0x14636e){return _0x130465(getChanSpyApplications(_0x621b66,_0x14636e));}return _0x130465([]);})[_0x2504('0x1b')](function(_0x3897a5){_0x338291(_0x3897a5);});});};module[_0x2504('0x1c')]=function(_0x196343,_0x482955){var _0x4be311=_0x196343['models'];return _0x196343[_0x2504('0x1d')](_0x2504('0x1e'),attributes,{'tableName':_0x2504('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x15053e,_0xf9ad9c,_0x49facc){return getChanSpyPromise(_0x4be311,_0x15053e)[_0x2504('0x1a')](function(_0x4b8067){if(_0x4b8067&&_0x4b8067[_0x2504('0x15')]){return _0x4be311[_0x2504('0x20')][_0x2504('0x21')](_0x4b8067);}})[_0x2504('0x1a')](function(){_0x49facc();})['catch'](function(_0x36a0ef){_0x49facc(_0x36a0ef);});},'afterUpdate':function(_0xee4751,_0x5a3aca,_0x331f69){return _0x4be311['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0xee4751['id']}})['then'](function(){return getChanSpyPromise(_0x4be311,_0xee4751);})[_0x2504('0x1a')](function(_0x25d72e){if(_0x25d72e&&_0x25d72e[_0x2504('0x15')]){return _0x4be311[_0x2504('0x20')][_0x2504('0x21')](_0x25d72e);}})[_0x2504('0x1a')](function(){_0x331f69();})[_0x2504('0x1b')](function(_0x53dd3b){_0x331f69(_0x53dd3b);});},'afterDestroy':function(_0x5db299,_0x432851,_0x3f8add){return _0x4be311[_0x2504('0x20')][_0x2504('0x22')]({'where':{'ChanSpyId':_0x5db299['id']}})['then'](function(){_0x3f8add();})[_0x2504('0x1b')](function(_0xb631a2){_0x3f8add(_0xb631a2);});}}});}; \ No newline at end of file +var _0xed4e=['Set','merge','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','record','StopMixMonitor','length','concat','internal','name','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push'];(function(_0x3c8c38,_0x277bc6){var _0x1edcab=function(_0x90dee3){while(--_0x90dee3){_0x3c8c38['push'](_0x3c8c38['shift']());}};_0x1edcab(++_0x277bc6);}(_0xed4e,0x1b3));var _0xeed4=function(_0x4e1657,_0x30c205){_0x4e1657=_0x4e1657-0x0;var _0x5eb21a=_0xed4e[_0x4e1657];return _0x5eb21a;};'use strict';var _=require(_0xeed4('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xeed4('0x1'));var getUserApplications=function(_0x4d13cb,_0x48d51f,_0x5902fe){var _0x2f32be=0x1;var _0x3599d3=[];var _0x699fbb={'context':_0x48d51f[_0xeed4('0x2')]||_0xeed4('0x3'),'exten':util[_0xeed4('0x4')](_0xeed4('0x5'),_0x4d13cb[_0xeed4('0x6')],_0x5902fe),'type':_0xeed4('0x7'),'isApp':![],'ChanSpyId':_0x4d13cb['id'],'UserId':_0x48d51f['id']};_0x3599d3[_0xeed4('0x8')](_['merge']({'app':_0xeed4('0x9'),'appdata':util[_0xeed4('0x4')]('CDR(type)=%s','chanspy'),'priority':_0x2f32be++},_0x699fbb));if(_0x4d13cb['record']){_0x3599d3['push'](_[_0xeed4('0xa')]({'app':'MixMonitor','appdata':util[_0xeed4('0x4')](_0xeed4('0xb'),_0x4d13cb[_0xeed4('0xc')]),'priority':_0x2f32be++},_0x699fbb));}if(_0x4d13cb[_0xeed4('0xd')]){_0x3599d3[_0xeed4('0x8')](_[_0xeed4('0xa')]({'app':_0xeed4('0xe'),'appdata':_0x4d13cb[_0xeed4('0xf')],'priority':_0x2f32be++},_0x699fbb));}_0x3599d3[_0xeed4('0x8')](_[_0xeed4('0xa')]({'app':_0xeed4('0x10'),'appdata':util[_0xeed4('0x4')](_0xeed4('0x11'),_0x48d51f['name'],_0x4d13cb[_0xeed4('0x12')]?_0x4d13cb[_0xeed4('0x12')][_0xeed4('0x13')](''):''),'priority':_0x2f32be++},_0x699fbb));if(_0x4d13cb[_0xeed4('0x14')]){_0x3599d3[_0xeed4('0x8')](_['merge']({'app':_0xeed4('0x15'),'priority':_0x2f32be++},_0x699fbb));}return _0x3599d3;};var getChanSpyApplications=function(_0x149c7c,_0x174f93){var _0xbfc710=[];for(var _0x36b153=0x0,_0x2b8c16=0x1;_0x36b153<_0x174f93[_0xeed4('0x16')];_0x36b153++,_0x2b8c16=0x1){_0xbfc710=_0xbfc710[_0xeed4('0x17')](getUserApplications(_0x149c7c,_0x174f93[_0x36b153],_0x174f93[_0x36b153][_0xeed4('0x18')]));if(_0x174f93[_0x36b153][_0xeed4('0x18')]!=_0x174f93[_0x36b153][_0xeed4('0x19')]){_0xbfc710=_0xbfc710[_0xeed4('0x17')](getUserApplications(_0x149c7c,_0x174f93[_0x36b153],_0x174f93[_0x36b153][_0xeed4('0x19')]));}}return _0xbfc710;};var getChanSpyPromise=function(_0xeaa3ae,_0x182167){return new BPromise(function(_0xa14065,_0xd2cbbc){return _0xeaa3ae['User']['findAll']({'attributes':['id',_0xeed4('0x19'),'internal'],'where':{'role':_0xeed4('0x1a'),'chanspy':!![]},'raw':!![]})[_0xeed4('0x1b')](function(_0x37dc77){if(_0x37dc77){return _0xa14065(getChanSpyApplications(_0x182167,_0x37dc77));}return _0xa14065([]);})[_0xeed4('0x1c')](function(_0x33f012){_0xd2cbbc(_0x33f012);});});};module[_0xeed4('0x1d')]=function(_0x4c9497,_0x840572){var _0x10998a=_0x4c9497[_0xeed4('0x1e')];return _0x4c9497[_0xeed4('0x1f')](_0xeed4('0x20'),attributes,{'tableName':_0xeed4('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x58ff97,_0x318a8c,_0x2f803b){return getChanSpyPromise(_0x10998a,_0x58ff97)[_0xeed4('0x1b')](function(_0x3da535){if(_0x3da535&&_0x3da535[_0xeed4('0x16')]){return _0x10998a[_0xeed4('0x22')]['bulkCreate'](_0x3da535);}})[_0xeed4('0x1b')](function(){_0x2f803b();})[_0xeed4('0x1c')](function(_0x406185){_0x2f803b(_0x406185);});},'afterUpdate':function(_0x31a5bd,_0x20333d,_0x8925d6){return _0x10998a[_0xeed4('0x22')][_0xeed4('0x23')]({'where':{'ChanSpyId':_0x31a5bd['id']}})['then'](function(){return getChanSpyPromise(_0x10998a,_0x31a5bd);})[_0xeed4('0x1b')](function(_0xa30160){if(_0xa30160&&_0xa30160['length']){return _0x10998a[_0xeed4('0x22')][_0xeed4('0x24')](_0xa30160);}})[_0xeed4('0x1b')](function(){_0x8925d6();})[_0xeed4('0x1c')](function(_0xc940ae){_0x8925d6(_0xc940ae);});},'afterDestroy':function(_0x179d67,_0x1b99f3,_0x314dd0){return _0x10998a[_0xeed4('0x22')]['destroy']({'where':{'ChanSpyId':_0x179d67['id']}})[_0xeed4('0x1b')](function(){_0x314dd0();})[_0xeed4('0x1c')](function(_0x62f2bb){_0x314dd0(_0x62f2bb);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index ac26860..b6ad03d 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 _0x049e=['then','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x2baca1,_0x2f3557){var _0x9aa62a=function(_0x5c47d5){while(--_0x5c47d5){_0x2baca1['push'](_0x2baca1['shift']());}};_0x9aa62a(++_0x2f3557);}(_0x049e,0x16a));var _0xe049=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x049e[_0x5ad0d7];return _0xd83bd;};'use strict';var _=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var moment=require('moment');var BPromise=require(_0xe049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe049('0x3'));var db=require(_0xe049('0x4'))['db'];var utils=require(_0xe049('0x5'));var logger=require(_0xe049('0x6'))(_0xe049('0x7'));var config=require('../../config/environment');var jayson=require(_0xe049('0x8'));var client=jayson[_0xe049('0x9')][_0xe049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221a5f,_0x1d4fc6,_0x17945b){return new BPromise(function(_0x22abb2,_0x515823){return client[_0xe049('0xb')](_0x221a5f,_0x17945b)[_0xe049('0xc')](function(_0x6d04ed){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x1d4fc6,_0xe049('0xd'));logger[_0xe049('0xe')](_0xe049('0xf'),_0x1d4fc6,'request\x20sent',JSON['stringify'](_0x6d04ed));if(_0x6d04ed['error']){if(_0x6d04ed[_0xe049('0x10')][_0xe049('0x11')]===0x1f4){logger[_0xe049('0x10')](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x515823(_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);}logger['error'](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x22abb2(_0x6d04ed[_0xe049('0x10')]['message']);}else{logger[_0xe049('0x14')](_0xe049('0x12'),_0x1d4fc6,'request\x20sent');_0x22abb2(_0x6d04ed[_0xe049('0x15')][_0xe049('0x13')]);}})['catch'](function(_0x8b9bfe){logger[_0xe049('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x1d4fc6,_0x8b9bfe);_0x515823(_0x8b9bfe);});});} \ No newline at end of file +var _0x16d2=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x16d2,0x123));var _0x216d=function(_0x168389,_0x19b2fe){_0x168389=_0x168389-0x0;var _0x4a264d=_0x16d2[_0x168389];return _0x4a264d;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var BPromise=require(_0x216d('0x3'));var rs=require(_0x216d('0x4'));var fs=require('fs');var Redis=require(_0x216d('0x5'));var db=require(_0x216d('0x6'))['db'];var utils=require(_0x216d('0x7'));var logger=require(_0x216d('0x8'))('rpc');var config=require(_0x216d('0x9'));var jayson=require(_0x216d('0xa'));var client=jayson[_0x216d('0xb')][_0x216d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8e2,_0x24c831,_0x3e0ada){return new BPromise(function(_0x28da14,_0x57accc){return client[_0x216d('0xd')](_0x1dd8e2,_0x3e0ada)[_0x216d('0xe')](function(_0x35abcf){logger[_0x216d('0xf')](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));logger['debug'](_0x216d('0x12'),_0x24c831,'request\x20sent',JSON[_0x216d('0x13')](_0x35abcf));if(_0x35abcf[_0x216d('0x14')]){if(_0x35abcf[_0x216d('0x14')][_0x216d('0x15')]===0x1f4){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x35abcf['error'][_0x216d('0x16')]);return _0x57accc(_0x35abcf['error'][_0x216d('0x16')]);}logger[_0x216d('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x24c831,_0x35abcf[_0x216d('0x14')][_0x216d('0x16')]);return _0x28da14(_0x35abcf['error'][_0x216d('0x16')]);}else{logger['info'](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));_0x28da14(_0x35abcf[_0x216d('0x17')][_0x216d('0x16')]);}})[_0x216d('0x18')](function(_0x304dfa){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x304dfa);_0x57accc(_0x304dfa);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f9a4234..9809ab6 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 _0x1f85=['isAuthenticated','show','put','update','delete','/:id','destroy','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index'];(function(_0x2bce80,_0x1df713){var _0x235ce2=function(_0x588c23){while(--_0x588c23){_0x2bce80['push'](_0x2bce80['shift']());}};_0x235ce2(++_0x1df713);}(_0x1f85,0x77));var _0x51f8=function(_0x383143,_0x6cdee5){_0x383143=_0x383143-0x0;var _0x5a04d5=_0x1f85[_0x383143];return _0x5a04d5;};'use strict';var multer=require(_0x51f8('0x0'));var util=require(_0x51f8('0x1'));var path=require(_0x51f8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51f8('0x3'));var interaction=require(_0x51f8('0x4'));var config=require(_0x51f8('0x5'));var controller=require(_0x51f8('0x6'));router[_0x51f8('0x7')]('/',auth['isAuthenticated'](),controller[_0x51f8('0x8')]);router[_0x51f8('0x7')]('/:id',auth[_0x51f8('0x9')](),controller[_0x51f8('0xa')]);router['post']('/',auth[_0x51f8('0x9')](),controller['create']);router[_0x51f8('0xb')]('/:id',auth[_0x51f8('0x9')](),controller[_0x51f8('0xc')]);router[_0x51f8('0xd')](_0x51f8('0xe'),auth['isAuthenticated'](),controller[_0x51f8('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb4a9=['show','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','index','get','/:id','isAuthenticated'];(function(_0x4e0d45,_0x55f937){var _0xb25758=function(_0x18d517){while(--_0x18d517){_0x4e0d45['push'](_0x4e0d45['shift']());}};_0xb25758(++_0x55f937);}(_0xb4a9,0x1a7));var _0x9b4a=function(_0x16a620,_0x30a33b){_0x16a620=_0x16a620-0x0;var _0x251797=_0xb4a9[_0x16a620];return _0x251797;};'use strict';var multer=require(_0x9b4a('0x0'));var util=require(_0x9b4a('0x1'));var path=require(_0x9b4a('0x2'));var timeout=require(_0x9b4a('0x3'));var express=require(_0x9b4a('0x4'));var router=express[_0x9b4a('0x5')]();var fs_extra=require(_0x9b4a('0x6'));var auth=require(_0x9b4a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9b4a('0x8'));var controller=require(_0x9b4a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9b4a('0xa')]);router[_0x9b4a('0xb')](_0x9b4a('0xc'),auth[_0x9b4a('0xd')](),controller[_0x9b4a('0xe')]);router[_0x9b4a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9b4a('0xc'),auth['isAuthenticated'](),controller[_0x9b4a('0x10')]);router[_0x9b4a('0x11')]('/:id',auth[_0x9b4a('0xd')](),controller[_0x9b4a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index ba93309..a775cbf 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 _0x1d9c=['name','STRING','BOOLEAN'];(function(_0x1ac4f1,_0x3aa8ad){var _0x359573=function(_0x33b54a){while(--_0x33b54a){_0x1ac4f1['push'](_0x1ac4f1['shift']());}};_0x359573(++_0x3aa8ad);}(_0x1d9c,0x171));var _0xc1d9=function(_0x247d01,_0x1851fb){_0x247d01=_0x247d01-0x0;var _0xf18e8=_0x1d9c[_0x247d01];return _0xf18e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc1d9('0x0')},'description':{'type':Sequelize[_0xc1d9('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc1d9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf78d=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xf78d,0xdc));var _0xdf78=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf78d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xdf78('0x0'));module[_0xdf78('0x1')]={'name':{'type':Sequelize[_0xdf78('0x2')],'unique':_0xdf78('0x3')},'description':{'type':Sequelize[_0xdf78('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xdf78('0x4')],'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 b596283..08db90a 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 _0x244b=['keys','length','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Contexts','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params'];(function(_0x583fb9,_0x2fa17a){var _0x50c8f8=function(_0x3fb618){while(--_0x3fb618){_0x583fb9['push'](_0x583fb9['shift']());}};_0x50c8f8(++_0x2fa17a);}(_0x244b,0x1bb));var _0xb244=function(_0x56526a,_0x3e8a46){_0x56526a=_0x56526a-0x0;var _0x4bb94d=_0x244b[_0x56526a];return _0x4bb94d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb244('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb244('0x1'));var moment=require(_0xb244('0x2'));var BPromise=require(_0xb244('0x3'));var Mustache=require(_0xb244('0x4'));var util=require(_0xb244('0x5'));var path=require('path');var sox=require(_0xb244('0x6'));var csv=require(_0xb244('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb244('0x8'));var _=require('lodash');var squel=require(_0xb244('0x9'));var crypto=require(_0xb244('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb244('0xb'));var toCsv=require(_0xb244('0x7'));var querystring=require(_0xb244('0xc'));var Papa=require(_0xb244('0xd'));var Redis=require(_0xb244('0xe'));var authService=require(_0xb244('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb244('0x10'))(_0xb244('0x11'));var utils=require(_0xb244('0x12'));var config=require(_0xb244('0x13'));var licenseUtil=require(_0xb244('0x14'));var db=require(_0xb244('0x15'))['db'];var jayson=require(_0xb244('0x16'));var client=jayson[_0xb244('0x17')][_0xb244('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1cd6e1,_0x34442c,_0x59bd7b,_0x34c5e4){return new BPromise(function(_0x367aba,_0x24deb5){var _0x2d86f0=_0x34c5e4||client;return _0x2d86f0['request'](_0x1cd6e1,_0x59bd7b)['then'](function(_0x3bbaba){logger[_0xb244('0x19')](_0xb244('0x1a'),_0x34442c,_0xb244('0x1b'));logger[_0xb244('0x1c')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x34442c,_0xb244('0x1b'),JSON[_0xb244('0x1d')](_0x3bbaba));if(_0x3bbaba[_0xb244('0x1e')]){if(_0x3bbaba['error']['code']===0x1f4){logger['error'](_0xb244('0x1a'),_0x34442c,_0x3bbaba['error'][_0xb244('0x1f')]);return _0x24deb5(_0x3bbaba[_0xb244('0x1e')][_0xb244('0x1f')]);}logger[_0xb244('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x34442c,_0x3bbaba[_0xb244('0x1e')][_0xb244('0x1f')]);return _0x367aba(_0x3bbaba[_0xb244('0x1e')][_0xb244('0x1f')]);}else{logger[_0xb244('0x19')]('VoiceContext,\x20%s,\x20%s',_0x34442c,_0xb244('0x1b'));_0x367aba(_0x3bbaba[_0xb244('0x20')][_0xb244('0x1f')]);}})[_0xb244('0x21')](function(_0x1225c8){logger[_0xb244('0x1e')](_0xb244('0x1a'),_0x34442c,_0x1225c8);_0x24deb5(_0x1225c8);});});}function respondWithStatusCode(_0x252f58,_0x330e7a){_0x330e7a=_0x330e7a||0xcc;return function(_0x17da66){if(_0x17da66){return _0x252f58[_0xb244('0x22')](_0x330e7a);}return _0x252f58['status'](_0x330e7a)[_0xb244('0x23')]();};}function respondWithResult(_0x435e34,_0x14caa1){_0x14caa1=_0x14caa1||0xc8;return function(_0x3829bd){if(_0x3829bd){return _0x435e34[_0xb244('0x24')](_0x14caa1)[_0xb244('0x25')](_0x3829bd);}};}function respondWithFilteredResult(_0x397026,_0x18e327){return function(_0x42d27b){if(_0x42d27b){var _0x48ee32=typeof _0x18e327[_0xb244('0x26')]===_0xb244('0x27')&&typeof _0x18e327[_0xb244('0x28')]===_0xb244('0x27');var _0x5cae49=_0x42d27b[_0xb244('0x29')];var _0x15e6b8=_0x48ee32?0x0:_0x18e327['offset'];var _0x3a4fed=_0x48ee32?_0x42d27b['count']:_0x18e327[_0xb244('0x26')]+_0x18e327['limit'];var _0x43f1a6;if(_0x3a4fed>=_0x5cae49){_0x3a4fed=_0x5cae49;_0x43f1a6=0xc8;}else{_0x43f1a6=0xce;}_0x397026['status'](_0x43f1a6);return _0x397026[_0xb244('0x2a')](_0xb244('0x2b'),_0x15e6b8+'-'+_0x3a4fed+'/'+_0x5cae49)[_0xb244('0x25')](_0x42d27b);}return null;};}function patchUpdates(_0x1fb524){return function(_0x4f180b){try{jsonpatch[_0xb244('0x2c')](_0x4f180b,_0x1fb524,!![]);}catch(_0x11ca83){return BPromise[_0xb244('0x2d')](_0x11ca83);}return _0x4f180b[_0xb244('0x2e')]();};}function saveUpdates(_0x2b7f9c,_0x7287e3){return function(_0x58e499){if(_0x58e499){return _0x58e499[_0xb244('0x2f')](_0x2b7f9c)[_0xb244('0x30')](function(_0x341676){return _0x341676;});}return null;};}function removeEntity(_0x4c500d,_0x54224d){return function(_0xceea0a){if(_0xceea0a){return _0xceea0a[_0xb244('0x31')]()[_0xb244('0x30')](function(){var _0x308ade=_0xceea0a[_0xb244('0x32')]({'plain':!![]});var _0x225c2b=_0xb244('0x33');return db['UserProfileResource'][_0xb244('0x31')]({'where':{'type':_0x225c2b,'resourceId':_0x308ade['id']}})[_0xb244('0x30')](function(){return _0xceea0a;});})[_0xb244('0x30')](function(){_0x4c500d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5111fe,_0x2545fc){return function(_0xb6761){if(!_0xb6761){_0x5111fe['sendStatus'](0x194);}return _0xb6761;};}function handleError(_0x1d81c5,_0xef8e91){_0xef8e91=_0xef8e91||0x1f4;return function(_0x2953ba){logger[_0xb244('0x1e')](_0x2953ba[_0xb244('0x34')]);if(_0x2953ba['name']){delete _0x2953ba[_0xb244('0x35')];}_0x1d81c5[_0xb244('0x24')](_0xef8e91)[_0xb244('0x36')](_0x2953ba);};}exports[_0xb244('0x37')]=function(_0x1efc61,_0x2a0bd0){var _0x5748f3={},_0x33acba={},_0xd39cae={'count':0x0,'rows':[]};var _0x2d26da=_[_0xb244('0x38')](db[_0xb244('0x39')][_0xb244('0x3a')],function(_0x5503cc){return{'name':_0x5503cc[_0xb244('0x3b')],'type':_0x5503cc[_0xb244('0x3c')][_0xb244('0x3d')]};});_0x33acba[_0xb244('0x3e')]=_[_0xb244('0x38')](_0x2d26da,_0xb244('0x35'));_0x33acba[_0xb244('0x3f')]=_['keys'](_0x1efc61['query']);_0x33acba[_0xb244('0x40')]=_['intersection'](_0x33acba[_0xb244('0x3e')],_0x33acba[_0xb244('0x3f')]);_0x5748f3[_0xb244('0x41')]=_[_0xb244('0x42')](_0x33acba[_0xb244('0x3e')],qs['fields'](_0x1efc61[_0xb244('0x3f')][_0xb244('0x43')]));_0x5748f3['attributes']=_0x5748f3[_0xb244('0x41')]['length']?_0x5748f3[_0xb244('0x41')]:_0x33acba['model'];if(!_0x1efc61[_0xb244('0x3f')][_0xb244('0x44')]('nolimit')){_0x5748f3[_0xb244('0x28')]=qs[_0xb244('0x28')](_0x1efc61[_0xb244('0x3f')]['limit']);_0x5748f3['offset']=qs[_0xb244('0x26')](_0x1efc61[_0xb244('0x3f')]['offset']);}_0x5748f3[_0xb244('0x45')]=qs['sort'](_0x1efc61[_0xb244('0x3f')]['sort']);_0x5748f3[_0xb244('0x46')]=qs[_0xb244('0x40')](_[_0xb244('0x47')](_0x1efc61[_0xb244('0x3f')],_0x33acba[_0xb244('0x40')]),_0x2d26da);if(_0x1efc61[_0xb244('0x3f')][_0xb244('0x48')]){_0x5748f3['where']=_[_0xb244('0x49')](_0x5748f3['where'],{'$or':_[_0xb244('0x38')](_0x2d26da,function(_0x4db10d){if(_0x4db10d[_0xb244('0x3c')]!==_0xb244('0x4a')){var _0xa6ab81={};_0xa6ab81[_0x4db10d[_0xb244('0x35')]]={'$like':'%'+_0x1efc61[_0xb244('0x3f')][_0xb244('0x48')]+'%'};return _0xa6ab81;}})});}_0x5748f3=_[_0xb244('0x49')]({},_0x5748f3,_0x1efc61[_0xb244('0x4b')]);var _0x188603={'where':_0x5748f3[_0xb244('0x46')]};return db['VoiceContext'][_0xb244('0x29')](_0x188603)[_0xb244('0x30')](function(_0x130d69){_0xd39cae[_0xb244('0x29')]=_0x130d69;if(_0x1efc61['query'][_0xb244('0x4c')]){_0x5748f3[_0xb244('0x4d')]=[{'all':!![]}];}return db[_0xb244('0x39')][_0xb244('0x4e')](_0x5748f3);})[_0xb244('0x30')](function(_0x2d5b22){_0xd39cae[_0xb244('0x4f')]=_0x2d5b22;return _0xd39cae;})[_0xb244('0x30')](respondWithFilteredResult(_0x2a0bd0,_0x5748f3))[_0xb244('0x21')](handleError(_0x2a0bd0,null));};exports[_0xb244('0x50')]=function(_0x4d477d,_0x4964b1){var _0x461534={'raw':![],'where':{'id':_0x4d477d[_0xb244('0x51')]['id']}},_0x3a6b2b={};_0x3a6b2b[_0xb244('0x3e')]=_[_0xb244('0x52')](db[_0xb244('0x39')]['rawAttributes']);_0x3a6b2b[_0xb244('0x3f')]=_[_0xb244('0x52')](_0x4d477d[_0xb244('0x3f')]);_0x3a6b2b[_0xb244('0x40')]=_['intersection'](_0x3a6b2b[_0xb244('0x3e')],_0x3a6b2b[_0xb244('0x3f')]);_0x461534[_0xb244('0x41')]=_[_0xb244('0x42')](_0x3a6b2b[_0xb244('0x3e')],qs[_0xb244('0x43')](_0x4d477d[_0xb244('0x3f')]['fields']));_0x461534[_0xb244('0x41')]=_0x461534['attributes'][_0xb244('0x53')]?_0x461534[_0xb244('0x41')]:_0x3a6b2b[_0xb244('0x3e')];if(_0x4d477d[_0xb244('0x3f')][_0xb244('0x4c')]){_0x461534['include']=[{'all':!![]}];}_0x461534=_[_0xb244('0x49')]({},_0x461534,_0x4d477d['options']);return db['VoiceContext'][_0xb244('0x54')](_0x461534)[_0xb244('0x30')](handleEntityNotFound(_0x4964b1,null))[_0xb244('0x30')](respondWithResult(_0x4964b1,null))[_0xb244('0x21')](handleError(_0x4964b1,null));};exports[_0xb244('0x55')]=function(_0x45e17b,_0x2783c4,_0x32365e){var _0x230f9e;return db[_0xb244('0x39')][_0xb244('0x55')](_0x45e17b[_0xb244('0x56')],{'raw':!![]})[_0xb244('0x30')](function(_0x1504df){_0x230f9e=_0x1504df;return db[_0xb244('0x39')][_0xb244('0x4e')]({'raw':!![]});})['then'](function(_0x211ea0){var _0xf30c40=fs[_0xb244('0x57')](path[_0xb244('0x58')](config[_0xb244('0x59')],_0xb244('0x5a')),_0xb244('0x5b'));var _0x29f114=ejs[_0xb244('0x5c')](_0xf30c40,{'contexts':_0x211ea0||[]});fs[_0xb244('0x5d')](_0xb244('0x5e'),_0x29f114);})[_0xb244('0x30')](function(){return respondWithRpcPromise('Reload',_0xb244('0x55'),{'module':_0xb244('0x5f')});})[_0xb244('0x30')](function(){var _0x160368=_0x45e17b['user'][_0xb244('0x32')]({'plain':!![]});if(!_0x160368)throw new Error(_0xb244('0x60'));if(_0x160368[_0xb244('0x61')]===_0xb244('0x62')){var _0x2dccf2=_0x230f9e[_0xb244('0x32')]({'plain':!![]});return db[_0xb244('0x63')]['find']({'where':{'name':_0xb244('0x33'),'userProfileId':_0x160368[_0xb244('0x64')]},'raw':!![]})[_0xb244('0x30')](function(_0x1099ea){if(_0x1099ea&&_0x1099ea[_0xb244('0x65')]===0x0){return db[_0xb244('0x66')][_0xb244('0x55')]({'name':_0x2dccf2[_0xb244('0x35')],'resourceId':_0x2dccf2['id'],'type':_0x1099ea[_0xb244('0x35')],'sectionId':_0x1099ea['id']},{})['then'](function(){return _0x230f9e;});}else{return _0x230f9e;}})['catch'](function(_0x27e1de){logger[_0xb244('0x1e')](_0xb244('0x67'),_0x27e1de);throw _0x27e1de;});}return _0x230f9e;})[_0xb244('0x30')](respondWithResult(_0x2783c4,0xc9))[_0xb244('0x21')](handleError(_0x2783c4,null));};exports[_0xb244('0x2f')]=function(_0x1d6021,_0x3906a2,_0x4cfa1c){var _0x233268;return db[_0xb244('0x39')]['find']({'where':{'id':_0x1d6021[_0xb244('0x51')]['id']}})[_0xb244('0x30')](handleEntityNotFound(_0x3906a2,null))[_0xb244('0x30')](saveUpdates(_0x1d6021[_0xb244('0x56')],null))[_0xb244('0x30')](function(_0x5c4af6){if(_0x5c4af6){_0x233268=_0x5c4af6;return db[_0xb244('0x39')][_0xb244('0x4e')]({'raw':!![]});}})[_0xb244('0x30')](function(_0x50cdae){var _0x3363a9=fs[_0xb244('0x57')](path[_0xb244('0x58')](config['root'],_0xb244('0x5a')),_0xb244('0x5b'));var _0x5f1227=ejs[_0xb244('0x5c')](_0x3363a9,{'contexts':_0x50cdae||[]});fs['writeFileSync'](_0xb244('0x5e'),_0x5f1227);})[_0xb244('0x30')](function(){return respondWithRpcPromise(_0xb244('0x68'),_0xb244('0x2f'),{'module':_0xb244('0x5f')});})[_0xb244('0x30')](function(){return _0x233268;})[_0xb244('0x30')](respondWithResult(_0x3906a2,null))[_0xb244('0x21')](handleError(_0x3906a2,null));};exports[_0xb244('0x31')]=function(_0x2781f8,_0x1d1c66,_0x56d047){var _0x5882a7;return db[_0xb244('0x39')]['find']({'where':{'id':_0x2781f8[_0xb244('0x51')]['id']}})[_0xb244('0x30')](handleEntityNotFound(_0x1d1c66,null))['then'](removeEntity(_0x1d1c66,null))[_0xb244('0x30')](function(){return db[_0xb244('0x39')][_0xb244('0x4e')]({'raw':!![]});})['then'](function(_0x5f3cc4){var _0x4eaeb7=fs[_0xb244('0x57')](path['join'](config['root'],_0xb244('0x5a')),'utf8');var _0x2e31dd=ejs[_0xb244('0x5c')](_0x4eaeb7,{'contexts':_0x5f3cc4});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x2e31dd);return respondWithRpcPromise(_0xb244('0x68'),_0xb244('0x31'),{'module':_0xb244('0x5f')});})[_0xb244('0x21')](handleError(_0x1d1c66,null));}; \ No newline at end of file +var _0x4785=['userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','utf8','render','Reload','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','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','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','save','update','destroy','get','Contexts','stack','name','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','create','readFileSync','root','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','UserProfileSection','find'];(function(_0x1031c7,_0x4d9887){var _0x6758e3=function(_0x5dc3a7){while(--_0x5dc3a7){_0x1031c7['push'](_0x1031c7['shift']());}};_0x6758e3(++_0x4d9887);}(_0x4785,0x1a8));var _0x5478=function(_0x5a6744,_0x144876){_0x5a6744=_0x5a6744-0x0;var _0xff7177=_0x4785[_0x5a6744];return _0xff7177;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5478('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5478('0x1'));var rp=require(_0x5478('0x2'));var moment=require(_0x5478('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5478('0x4'));var util=require(_0x5478('0x5'));var path=require('path');var sox=require(_0x5478('0x6'));var csv=require(_0x5478('0x7'));var ejs=require(_0x5478('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5478('0x9'));var crypto=require(_0x5478('0xa'));var jsforce=require(_0x5478('0xb'));var deskjs=require(_0x5478('0xc'));var toCsv=require(_0x5478('0x7'));var querystring=require(_0x5478('0xd'));var Papa=require(_0x5478('0xe'));var Redis=require(_0x5478('0xf'));var authService=require(_0x5478('0x10'));var qs=require(_0x5478('0x11'));var as=require(_0x5478('0x12'));var hardwareService=require(_0x5478('0x13'));var logger=require(_0x5478('0x14'))('api');var utils=require(_0x5478('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5478('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5478('0x17'));var client=jayson[_0x5478('0x18')][_0x5478('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5750a7,_0x58ed32,_0x5b1bf5,_0x5872c4){return new BPromise(function(_0x6d73b5,_0x43b7ad){var _0x11272c=_0x5872c4||client;return _0x11272c[_0x5478('0x1a')](_0x5750a7,_0x5b1bf5)[_0x5478('0x1b')](function(_0x42da1c){logger[_0x5478('0x1c')](_0x5478('0x1d'),_0x58ed32,'request\x20sent');logger[_0x5478('0x1e')](_0x5478('0x1f'),_0x58ed32,_0x5478('0x20'),JSON[_0x5478('0x21')](_0x42da1c));if(_0x42da1c[_0x5478('0x22')]){if(_0x42da1c[_0x5478('0x22')][_0x5478('0x23')]===0x1f4){logger[_0x5478('0x22')](_0x5478('0x1d'),_0x58ed32,_0x42da1c['error'][_0x5478('0x24')]);return _0x43b7ad(_0x42da1c[_0x5478('0x22')][_0x5478('0x24')]);}logger[_0x5478('0x22')](_0x5478('0x1d'),_0x58ed32,_0x42da1c[_0x5478('0x22')][_0x5478('0x24')]);return _0x6d73b5(_0x42da1c[_0x5478('0x22')][_0x5478('0x24')]);}else{logger[_0x5478('0x1c')](_0x5478('0x1d'),_0x58ed32,_0x5478('0x20'));_0x6d73b5(_0x42da1c[_0x5478('0x25')][_0x5478('0x24')]);}})[_0x5478('0x26')](function(_0x2e0b76){logger['error'](_0x5478('0x1d'),_0x58ed32,_0x2e0b76);_0x43b7ad(_0x2e0b76);});});}function respondWithStatusCode(_0x4959a3,_0x17c20e){_0x17c20e=_0x17c20e||0xcc;return function(_0x119e7b){if(_0x119e7b){return _0x4959a3[_0x5478('0x27')](_0x17c20e);}return _0x4959a3[_0x5478('0x28')](_0x17c20e)[_0x5478('0x29')]();};}function respondWithResult(_0xe2ca7,_0x32bcf2){_0x32bcf2=_0x32bcf2||0xc8;return function(_0x4dde48){if(_0x4dde48){return _0xe2ca7[_0x5478('0x28')](_0x32bcf2)[_0x5478('0x2a')](_0x4dde48);}};}function respondWithFilteredResult(_0x17ebba,_0x15ba5b){return function(_0x234745){if(_0x234745){var _0x4845b5=typeof _0x15ba5b['offset']==='undefined'&&typeof _0x15ba5b[_0x5478('0x2b')]===_0x5478('0x2c');var _0x24adad=_0x234745['count'];var _0x210115=_0x4845b5?0x0:_0x15ba5b[_0x5478('0x2d')];var _0xe5dd94=_0x4845b5?_0x234745['count']:_0x15ba5b[_0x5478('0x2d')]+_0x15ba5b['limit'];var _0x3703c2;if(_0xe5dd94>=_0x24adad){_0xe5dd94=_0x24adad;_0x3703c2=0xc8;}else{_0x3703c2=0xce;}_0x17ebba[_0x5478('0x28')](_0x3703c2);return _0x17ebba[_0x5478('0x2e')](_0x5478('0x2f'),_0x210115+'-'+_0xe5dd94+'/'+_0x24adad)[_0x5478('0x2a')](_0x234745);}return null;};}function patchUpdates(_0x3c0be8){return function(_0x27b180){try{jsonpatch['apply'](_0x27b180,_0x3c0be8,!![]);}catch(_0x64b281){return BPromise['reject'](_0x64b281);}return _0x27b180[_0x5478('0x30')]();};}function saveUpdates(_0xdfc524,_0x43e530){return function(_0x544f87){if(_0x544f87){return _0x544f87[_0x5478('0x31')](_0xdfc524)['then'](function(_0x3978a2){return _0x3978a2;});}return null;};}function removeEntity(_0x358282,_0x43a249){return function(_0x2c16cb){if(_0x2c16cb){return _0x2c16cb[_0x5478('0x32')]()[_0x5478('0x1b')](function(){var _0x49fe03=_0x2c16cb[_0x5478('0x33')]({'plain':!![]});var _0x35e387=_0x5478('0x34');return db['UserProfileResource'][_0x5478('0x32')]({'where':{'type':_0x35e387,'resourceId':_0x49fe03['id']}})[_0x5478('0x1b')](function(){return _0x2c16cb;});})[_0x5478('0x1b')](function(){_0x358282[_0x5478('0x28')](0xcc)[_0x5478('0x29')]();});}};}function handleEntityNotFound(_0x3fac47,_0x4c9686){return function(_0x2ccd54){if(!_0x2ccd54){_0x3fac47[_0x5478('0x27')](0x194);}return _0x2ccd54;};}function handleError(_0x55ff7b,_0x4d886a){_0x4d886a=_0x4d886a||0x1f4;return function(_0x438bac){logger[_0x5478('0x22')](_0x438bac[_0x5478('0x35')]);if(_0x438bac[_0x5478('0x36')]){delete _0x438bac[_0x5478('0x36')];}_0x55ff7b[_0x5478('0x28')](_0x4d886a)['send'](_0x438bac);};}exports[_0x5478('0x37')]=function(_0x173a35,_0x52d1c1){var _0x57b4ad={},_0x34a0d8={},_0x503629={'count':0x0,'rows':[]};var _0x879147=_['map'](db[_0x5478('0x38')][_0x5478('0x39')],function(_0x33c4e4){return{'name':_0x33c4e4[_0x5478('0x3a')],'type':_0x33c4e4[_0x5478('0x3b')][_0x5478('0x3c')]};});_0x34a0d8[_0x5478('0x3d')]=_[_0x5478('0x3e')](_0x879147,_0x5478('0x36'));_0x34a0d8['query']=_[_0x5478('0x3f')](_0x173a35[_0x5478('0x40')]);_0x34a0d8[_0x5478('0x41')]=_[_0x5478('0x42')](_0x34a0d8['model'],_0x34a0d8[_0x5478('0x40')]);_0x57b4ad[_0x5478('0x43')]=_['intersection'](_0x34a0d8[_0x5478('0x3d')],qs[_0x5478('0x44')](_0x173a35[_0x5478('0x40')][_0x5478('0x44')]));_0x57b4ad[_0x5478('0x43')]=_0x57b4ad[_0x5478('0x43')][_0x5478('0x45')]?_0x57b4ad[_0x5478('0x43')]:_0x34a0d8[_0x5478('0x3d')];if(!_0x173a35['query']['hasOwnProperty'](_0x5478('0x46'))){_0x57b4ad[_0x5478('0x2b')]=qs[_0x5478('0x2b')](_0x173a35['query']['limit']);_0x57b4ad[_0x5478('0x2d')]=qs['offset'](_0x173a35[_0x5478('0x40')][_0x5478('0x2d')]);}_0x57b4ad[_0x5478('0x47')]=qs[_0x5478('0x48')](_0x173a35[_0x5478('0x40')][_0x5478('0x48')]);_0x57b4ad[_0x5478('0x49')]=qs[_0x5478('0x41')](_[_0x5478('0x4a')](_0x173a35[_0x5478('0x40')],_0x34a0d8[_0x5478('0x41')]),_0x879147);if(_0x173a35[_0x5478('0x40')][_0x5478('0x4b')]){_0x57b4ad['where']=_[_0x5478('0x4c')](_0x57b4ad['where'],{'$or':_[_0x5478('0x3e')](_0x879147,function(_0x1f23d8){if(_0x1f23d8[_0x5478('0x3b')]!==_0x5478('0x4d')){var _0x308bea={};_0x308bea[_0x1f23d8[_0x5478('0x36')]]={'$like':'%'+_0x173a35['query'][_0x5478('0x4b')]+'%'};return _0x308bea;}})});}_0x57b4ad=_[_0x5478('0x4c')]({},_0x57b4ad,_0x173a35[_0x5478('0x4e')]);var _0x399f0d={'where':_0x57b4ad[_0x5478('0x49')]};return db[_0x5478('0x38')]['count'](_0x399f0d)[_0x5478('0x1b')](function(_0x2336a){_0x503629[_0x5478('0x4f')]=_0x2336a;if(_0x173a35[_0x5478('0x40')]['includeAll']){_0x57b4ad[_0x5478('0x50')]=[{'all':!![]}];}return db[_0x5478('0x38')][_0x5478('0x51')](_0x57b4ad);})[_0x5478('0x1b')](function(_0x21d575){_0x503629[_0x5478('0x52')]=_0x21d575;return _0x503629;})[_0x5478('0x1b')](respondWithFilteredResult(_0x52d1c1,_0x57b4ad))['catch'](handleError(_0x52d1c1,null));};exports[_0x5478('0x53')]=function(_0x2f8617,_0x17202f){var _0x7248e8={'raw':![],'where':{'id':_0x2f8617[_0x5478('0x54')]['id']}},_0x43330a={};_0x43330a[_0x5478('0x3d')]=_[_0x5478('0x3f')](db[_0x5478('0x38')]['rawAttributes']);_0x43330a[_0x5478('0x40')]=_[_0x5478('0x3f')](_0x2f8617[_0x5478('0x40')]);_0x43330a[_0x5478('0x41')]=_[_0x5478('0x42')](_0x43330a[_0x5478('0x3d')],_0x43330a[_0x5478('0x40')]);_0x7248e8['attributes']=_[_0x5478('0x42')](_0x43330a['model'],qs['fields'](_0x2f8617['query'][_0x5478('0x44')]));_0x7248e8['attributes']=_0x7248e8[_0x5478('0x43')][_0x5478('0x45')]?_0x7248e8[_0x5478('0x43')]:_0x43330a[_0x5478('0x3d')];if(_0x2f8617[_0x5478('0x40')]['includeAll']){_0x7248e8['include']=[{'all':!![]}];}_0x7248e8=_[_0x5478('0x4c')]({},_0x7248e8,_0x2f8617['options']);return db[_0x5478('0x38')]['find'](_0x7248e8)['then'](handleEntityNotFound(_0x17202f,null))[_0x5478('0x1b')](respondWithResult(_0x17202f,null))[_0x5478('0x26')](handleError(_0x17202f,null));};exports[_0x5478('0x55')]=function(_0x339f80,_0x24ec76,_0x58653f){var _0x2d073b;return db[_0x5478('0x38')][_0x5478('0x55')](_0x339f80['body'],{'raw':!![]})['then'](function(_0x31cf12){_0x2d073b=_0x31cf12;return db[_0x5478('0x38')][_0x5478('0x51')]({'raw':!![]});})[_0x5478('0x1b')](function(_0x2156cb){var _0x317817=fs[_0x5478('0x56')](path['join'](config[_0x5478('0x57')],_0x5478('0x58')),'utf8');var _0x43bbb5=ejs['render'](_0x317817,{'contexts':_0x2156cb||[]});fs[_0x5478('0x59')](_0x5478('0x5a'),_0x43bbb5);})[_0x5478('0x1b')](function(){return respondWithRpcPromise('Reload',_0x5478('0x55'),{'module':_0x5478('0x5b')});})['then'](function(){var _0x38a66d=_0x339f80[_0x5478('0x5c')][_0x5478('0x33')]({'plain':!![]});if(!_0x38a66d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38a66d[_0x5478('0x5d')]===_0x5478('0x5c')){var _0x16fe7b=_0x2d073b[_0x5478('0x33')]({'plain':!![]});return db[_0x5478('0x5e')][_0x5478('0x5f')]({'where':{'name':_0x5478('0x34'),'userProfileId':_0x38a66d[_0x5478('0x60')]},'raw':!![]})[_0x5478('0x1b')](function(_0x48a79d){if(_0x48a79d&&_0x48a79d[_0x5478('0x61')]===0x0){return db[_0x5478('0x62')][_0x5478('0x55')]({'name':_0x16fe7b[_0x5478('0x36')],'resourceId':_0x16fe7b['id'],'type':_0x48a79d['name'],'sectionId':_0x48a79d['id']},{})['then'](function(){return _0x2d073b;});}else{return _0x2d073b;}})[_0x5478('0x26')](function(_0x3b6053){logger[_0x5478('0x22')](_0x5478('0x63'),_0x3b6053);throw _0x3b6053;});}return _0x2d073b;})[_0x5478('0x1b')](respondWithResult(_0x24ec76,0xc9))[_0x5478('0x26')](handleError(_0x24ec76,null));};exports[_0x5478('0x31')]=function(_0x3c9bf1,_0x318325,_0x64436f){var _0xd19097;return db[_0x5478('0x38')][_0x5478('0x5f')]({'where':{'id':_0x3c9bf1[_0x5478('0x54')]['id']}})[_0x5478('0x1b')](handleEntityNotFound(_0x318325,null))[_0x5478('0x1b')](saveUpdates(_0x3c9bf1['body'],null))[_0x5478('0x1b')](function(_0x5d5f54){if(_0x5d5f54){_0xd19097=_0x5d5f54;return db[_0x5478('0x38')][_0x5478('0x51')]({'raw':!![]});}})[_0x5478('0x1b')](function(_0x2f7691){var _0x553ea3=fs['readFileSync'](path[_0x5478('0x64')](config[_0x5478('0x57')],_0x5478('0x58')),_0x5478('0x65'));var _0x4a4bc4=ejs[_0x5478('0x66')](_0x553ea3,{'contexts':_0x2f7691||[]});fs[_0x5478('0x59')](_0x5478('0x5a'),_0x4a4bc4);})[_0x5478('0x1b')](function(){return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});})[_0x5478('0x1b')](function(){return _0xd19097;})[_0x5478('0x1b')](respondWithResult(_0x318325,null))[_0x5478('0x26')](handleError(_0x318325,null));};exports['destroy']=function(_0x33df0a,_0x48ecee,_0xa21f43){var _0x53232c;return db[_0x5478('0x38')][_0x5478('0x5f')]({'where':{'id':_0x33df0a[_0x5478('0x54')]['id']}})[_0x5478('0x1b')](handleEntityNotFound(_0x48ecee,null))['then'](removeEntity(_0x48ecee,null))[_0x5478('0x1b')](function(){return db[_0x5478('0x38')][_0x5478('0x51')]({'raw':!![]});})[_0x5478('0x1b')](function(_0x362e04){var _0x1dc338=fs[_0x5478('0x56')](path['join'](config[_0x5478('0x57')],'server/files/templates/context.ejs'),'utf8');var _0x53e7e9=ejs[_0x5478('0x66')](_0x1dc338,{'contexts':_0x362e04});fs[_0x5478('0x59')](_0x5478('0x5a'),_0x53e7e9);return respondWithRpcPromise(_0x5478('0x67'),'destroy',{'module':'chan_sip.so'});})['catch'](handleError(_0x48ecee,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 70b5450..d3a981d 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 _0x4f7c=['rimraf','../../config/environment','./voiceContext.attributes','exports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4ad5e0,_0x454696){var _0x7fece7=function(_0x148aa2){while(--_0x148aa2){_0x4ad5e0['push'](_0x4ad5e0['shift']());}};_0x7fece7(++_0x454696);}(_0x4f7c,0x185));var _0xc4f7=function(_0x281303,_0x1a337f){_0x281303=_0x281303-0x0;var _0x32b93f=_0x4f7c[_0x281303];return _0x32b93f;};'use strict';var _=require('lodash');var util=require(_0xc4f7('0x0'));var logger=require(_0xc4f7('0x1'))(_0xc4f7('0x2'));var moment=require(_0xc4f7('0x3'));var BPromise=require(_0xc4f7('0x4'));var rp=require(_0xc4f7('0x5'));var fs=require('fs');var path=require(_0xc4f7('0x6'));var rimraf=require(_0xc4f7('0x7'));var config=require(_0xc4f7('0x8'));var attributes=require(_0xc4f7('0x9'));module[_0xc4f7('0xa')]=function(_0x593986,_0x3b61d3){return _0x593986['define']('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa24e=['voice_contexts','moment','request-promise','rimraf','define'];(function(_0x20e8f1,_0x5b60a4){var _0x4926e9=function(_0x15d171){while(--_0x15d171){_0x20e8f1['push'](_0x20e8f1['shift']());}};_0x4926e9(++_0x5b60a4);}(_0xa24e,0x14b));var _0xea24=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0xa24e[_0x124298];return _0x35ac24;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xea24('0x0'));var BPromise=require('bluebird');var rp=require(_0xea24('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea24('0x2'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module['exports']=function(_0x1b4afe,_0x3e38c7){return _0x1b4afe[_0xea24('0x3')]('VoiceContext',attributes,{'tableName':_0xea24('0x4'),'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 077838c..ef2a5a5 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 _0x7bf2=['../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x42001c,_0x22f5b4){var _0x16bc18=function(_0x263e8d){while(--_0x263e8d){_0x42001c['push'](_0x42001c['shift']());}};_0x16bc18(++_0x22f5b4);}(_0x7bf2,0xc8));var _0x27bf=function(_0x595a2d,_0x2ad01e){_0x595a2d=_0x595a2d-0x0;var _0xe5a375=_0x7bf2[_0x595a2d];return _0xe5a375;};'use strict';var _=require(_0x27bf('0x0'));var util=require(_0x27bf('0x1'));var moment=require('moment');var BPromise=require(_0x27bf('0x2'));var rs=require(_0x27bf('0x3'));var fs=require('fs');var Redis=require(_0x27bf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x27bf('0x5'));var logger=require('../../config/logger')(_0x27bf('0x6'));var config=require(_0x27bf('0x7'));var jayson=require(_0x27bf('0x8'));var client=jayson[_0x27bf('0x9')][_0x27bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x374acd,_0x2b48a7,_0x331a61){return new BPromise(function(_0x3ecf8e,_0x2f7254){return client[_0x27bf('0xb')](_0x374acd,_0x331a61)['then'](function(_0x4a5636){logger[_0x27bf('0xc')](_0x27bf('0xd'),_0x2b48a7,_0x27bf('0xe'));logger[_0x27bf('0xf')](_0x27bf('0x10'),_0x2b48a7,'request\x20sent',JSON[_0x27bf('0x11')](_0x4a5636));if(_0x4a5636[_0x27bf('0x12')]){if(_0x4a5636[_0x27bf('0x12')][_0x27bf('0x13')]===0x1f4){logger[_0x27bf('0x12')](_0x27bf('0xd'),_0x2b48a7,_0x4a5636['error'][_0x27bf('0x14')]);return _0x2f7254(_0x4a5636[_0x27bf('0x12')][_0x27bf('0x14')]);}logger['error'](_0x27bf('0xd'),_0x2b48a7,_0x4a5636[_0x27bf('0x12')][_0x27bf('0x14')]);return _0x3ecf8e(_0x4a5636[_0x27bf('0x12')][_0x27bf('0x14')]);}else{logger['info'](_0x27bf('0xd'),_0x2b48a7,'request\x20sent');_0x3ecf8e(_0x4a5636[_0x27bf('0x15')][_0x27bf('0x14')]);}})[_0x27bf('0x16')](function(_0x2793e6){logger[_0x27bf('0x12')](_0x27bf('0xd'),_0x2b48a7,_0x2793e6);_0x2f7254(_0x2793e6);});});} \ No newline at end of file +var _0x4178=['http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x432f9e,_0x35d0d8){var _0x2f0d10=function(_0x45e3d0){while(--_0x45e3d0){_0x432f9e['push'](_0x432f9e['shift']());}};_0x2f0d10(++_0x35d0d8);}(_0x4178,0x7f));var _0x8417=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4178[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0x8417('0x0'));var moment=require(_0x8417('0x1'));var BPromise=require(_0x8417('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8417('0x3'));var db=require(_0x8417('0x4'))['db'];var utils=require(_0x8417('0x5'));var logger=require(_0x8417('0x6'))(_0x8417('0x7'));var config=require(_0x8417('0x8'));var jayson=require(_0x8417('0x9'));var client=jayson[_0x8417('0xa')][_0x8417('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ca2a5,_0x3981be,_0x5f0140){return new BPromise(function(_0x3ab6f5,_0x14b485){return client['request'](_0x2ca2a5,_0x5f0140)[_0x8417('0xc')](function(_0x2abab1){logger[_0x8417('0xd')](_0x8417('0xe'),_0x3981be,_0x8417('0xf'));logger[_0x8417('0x10')](_0x8417('0x11'),_0x3981be,'request\x20sent',JSON[_0x8417('0x12')](_0x2abab1));if(_0x2abab1[_0x8417('0x13')]){if(_0x2abab1[_0x8417('0x13')][_0x8417('0x14')]===0x1f4){logger['error'](_0x8417('0xe'),_0x3981be,_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);return _0x14b485(_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);}logger['error'](_0x8417('0xe'),_0x3981be,_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);return _0x3ab6f5(_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);}else{logger[_0x8417('0xd')](_0x8417('0xe'),_0x3981be,'request\x20sent');_0x3ab6f5(_0x2abab1[_0x8417('0x16')][_0x8417('0x15')]);}})['catch'](function(_0xfb0896){logger[_0x8417('0x13')](_0x8417('0xe'),_0x3981be,_0xfb0896);_0x14b485(_0xfb0896);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 1fe8889..7b3f650 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 _0xbf99=['delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0xb161fc,_0x262d3e){var _0x5cb389=function(_0x1f91d9){while(--_0x1f91d9){_0xb161fc['push'](_0xb161fc['shift']());}};_0x5cb389(++_0x262d3e);}(_0xbf99,0x8e));var _0x9bf9=function(_0x552963,_0x232bbb){_0x552963=_0x552963-0x0;var _0xc973d5=_0xbf99[_0x552963];return _0xc973d5;};'use strict';var multer=require(_0x9bf9('0x0'));var util=require('util');var path=require(_0x9bf9('0x1'));var timeout=require('connect-timeout');var express=require(_0x9bf9('0x2'));var router=express[_0x9bf9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9bf9('0x4'));var interaction=require(_0x9bf9('0x5'));var config=require(_0x9bf9('0x6'));var controller=require(_0x9bf9('0x7'));router[_0x9bf9('0x8')]('/',auth[_0x9bf9('0x9')](),controller[_0x9bf9('0xa')]);router[_0x9bf9('0x8')](_0x9bf9('0xb'),auth[_0x9bf9('0x9')](),controller[_0x9bf9('0xc')]);router['get'](_0x9bf9('0xd'),auth[_0x9bf9('0x9')](),controller['show']);router[_0x9bf9('0xe')]('/',auth[_0x9bf9('0x9')](),controller[_0x9bf9('0xf')]);router[_0x9bf9('0x10')](_0x9bf9('0xd'),auth[_0x9bf9('0x9')](),controller[_0x9bf9('0x11')]);router[_0x9bf9('0x12')](_0x9bf9('0xd'),auth[_0x9bf9('0x9')](),controller[_0x9bf9('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf9a2=['update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','put'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf9a2,0x124));var _0x2f9a=function(_0x4e1119,_0x3c8b3a){_0x4e1119=_0x4e1119-0x0;var _0x3943c6=_0xf9a2[_0x4e1119];return _0x3943c6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2f9a('0x0'));var express=require(_0x2f9a('0x1'));var router=express[_0x2f9a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2f9a('0x3'));var interaction=require(_0x2f9a('0x4'));var config=require(_0x2f9a('0x5'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0x2f9a('0x6')](),controller[_0x2f9a('0x7')]);router[_0x2f9a('0x8')]('/describe',auth[_0x2f9a('0x6')](),controller[_0x2f9a('0x9')]);router['get'](_0x2f9a('0xa'),auth['isAuthenticated'](),controller[_0x2f9a('0xb')]);router[_0x2f9a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2f9a('0xd')](_0x2f9a('0xa'),auth[_0x2f9a('0x6')](),controller[_0x2f9a('0xe')]);router['delete'](_0x2f9a('0xa'),auth[_0x2f9a('0x6')](),controller[_0x2f9a('0xf')]);module[_0x2f9a('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7c41755..bd81a4d 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 _0x9f62=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0x9f62,0x154));var _0x29f6=function(_0x3d90cd,_0x361d4a){_0x3d90cd=_0x3d90cd-0x0;var _0x729d0a=_0x9f62[_0x3d90cd];return _0x729d0a;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file +var _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x4c5a24,_0x5ef60c){var _0x4b067e=function(_0x33c0da){while(--_0x33c0da){_0x4c5a24['push'](_0x4c5a24['shift']());}};_0x4b067e(++_0x5ef60c);}(_0x84ab,0x12f));var _0xb84a=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x84ab[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 69f61de..ead171d 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 _0xc113=['includeAll','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','set','Content-Range','apply','save','update','then','end','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','intersection','attributes','query','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options'];(function(_0x4973c2,_0x31b306){var _0xabd31f=function(_0x22a7eb){while(--_0x22a7eb){_0x4973c2['push'](_0x4973c2['shift']());}};_0xabd31f(++_0x31b306);}(_0xc113,0x130));var _0x3c11=function(_0x58b795,_0x1f3e17){_0x58b795=_0x58b795-0x0;var _0x2d61ad=_0xc113[_0x58b795];return _0x2d61ad;};'use strict';var emlformat=require(_0x3c11('0x0'));var rimraf=require(_0x3c11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3c11('0x2'));var moment=require(_0x3c11('0x3'));var BPromise=require(_0x3c11('0x4'));var Mustache=require(_0x3c11('0x5'));var util=require(_0x3c11('0x6'));var path=require(_0x3c11('0x7'));var sox=require(_0x3c11('0x8'));var csv=require(_0x3c11('0x9'));var ejs=require(_0x3c11('0xa'));var fs=require('fs');var fs_extra=require(_0x3c11('0xb'));var _=require('lodash');var squel=require(_0x3c11('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3c11('0xd'));var toCsv=require(_0x3c11('0x9'));var querystring=require(_0x3c11('0xe'));var Papa=require(_0x3c11('0xf'));var Redis=require(_0x3c11('0x10'));var authService=require(_0x3c11('0x11'));var qs=require(_0x3c11('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c11('0x13'))(_0x3c11('0x14'));var utils=require(_0x3c11('0x15'));var config=require(_0x3c11('0x16'));var licenseUtil=require(_0x3c11('0x17'));var db=require(_0x3c11('0x18'))['db'];function respondWithStatusCode(_0x4409b9,_0x172487){_0x172487=_0x172487||0xcc;return function(_0x2c3c7f){if(_0x2c3c7f){return _0x4409b9[_0x3c11('0x19')](_0x172487);}return _0x4409b9[_0x3c11('0x1a')](_0x172487)['end']();};}function respondWithResult(_0x325f1e,_0x15d4c8){_0x15d4c8=_0x15d4c8||0xc8;return function(_0x43f0b3){if(_0x43f0b3){return _0x325f1e[_0x3c11('0x1a')](_0x15d4c8)['json'](_0x43f0b3);}};}function respondWithFilteredResult(_0x53f649,_0x424ef4){return function(_0x3a229a){if(_0x3a229a){var _0x3e7b0c=typeof _0x424ef4['offset']==='undefined'&&typeof _0x424ef4[_0x3c11('0x1b')]==='undefined';var _0x1668cb=_0x3a229a[_0x3c11('0x1c')];var _0x1b1803=_0x3e7b0c?0x0:_0x424ef4['offset'];var _0x458117=_0x3e7b0c?_0x3a229a['count']:_0x424ef4[_0x3c11('0x1d')]+_0x424ef4[_0x3c11('0x1b')];var _0x846a58;if(_0x458117>=_0x1668cb){_0x458117=_0x1668cb;_0x846a58=0xc8;}else{_0x846a58=0xce;}_0x53f649[_0x3c11('0x1a')](_0x846a58);return _0x53f649[_0x3c11('0x1e')](_0x3c11('0x1f'),_0x1b1803+'-'+_0x458117+'/'+_0x1668cb)['json'](_0x3a229a);}return null;};}function patchUpdates(_0x38cb8e){return function(_0x1f1745){try{jsonpatch[_0x3c11('0x20')](_0x1f1745,_0x38cb8e,!![]);}catch(_0x21ddb3){return BPromise['reject'](_0x21ddb3);}return _0x1f1745[_0x3c11('0x21')]();};}function saveUpdates(_0x46c670,_0x580bca){return function(_0x4fbbdf){if(_0x4fbbdf){return _0x4fbbdf[_0x3c11('0x22')](_0x46c670)[_0x3c11('0x23')](function(_0x341968){return _0x341968;});}return null;};}function removeEntity(_0x586d85,_0xd7d78c){return function(_0x55d2ff){if(_0x55d2ff){return _0x55d2ff['destroy']()[_0x3c11('0x23')](function(){_0x586d85[_0x3c11('0x1a')](0xcc)[_0x3c11('0x24')]();});}};}function handleEntityNotFound(_0x4bfc96,_0x237771){return function(_0x28b923){if(!_0x28b923){_0x4bfc96['sendStatus'](0x194);}return _0x28b923;};}function handleError(_0x1fe371,_0x39a6e9){_0x39a6e9=_0x39a6e9||0x1f4;return function(_0x27aa2c){logger['error'](_0x27aa2c[_0x3c11('0x25')]);if(_0x27aa2c[_0x3c11('0x26')]){delete _0x27aa2c[_0x3c11('0x26')];}_0x1fe371[_0x3c11('0x1a')](_0x39a6e9)[_0x3c11('0x27')](_0x27aa2c);};}exports[_0x3c11('0x28')]=function(_0x5bcb4e,_0x135341){var _0x1790cc={},_0x25a4ed={},_0x11c909={'count':0x0,'rows':[]};var _0x318c7e=_[_0x3c11('0x29')](db[_0x3c11('0x2a')][_0x3c11('0x2b')],function(_0xd6344d){return{'name':_0xd6344d['fieldName'],'type':_0xd6344d[_0x3c11('0x2c')][_0x3c11('0x2d')]};});_0x25a4ed[_0x3c11('0x2e')]=_['map'](_0x318c7e,_0x3c11('0x26'));_0x25a4ed['query']=_['keys'](_0x5bcb4e['query']);_0x25a4ed['filters']=_[_0x3c11('0x2f')](_0x25a4ed[_0x3c11('0x2e')],_0x25a4ed['query']);_0x1790cc[_0x3c11('0x30')]=_['intersection'](_0x25a4ed['model'],qs['fields'](_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x32')]));_0x1790cc['attributes']=_0x1790cc[_0x3c11('0x30')][_0x3c11('0x33')]?_0x1790cc['attributes']:_0x25a4ed['model'];if(!_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x34')]('nolimit')){_0x1790cc[_0x3c11('0x1b')]=qs[_0x3c11('0x1b')](_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x1b')]);_0x1790cc[_0x3c11('0x1d')]=qs['offset'](_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x1d')]);}_0x1790cc[_0x3c11('0x35')]=qs[_0x3c11('0x36')](_0x5bcb4e['query'][_0x3c11('0x36')]);_0x1790cc[_0x3c11('0x37')]=qs[_0x3c11('0x38')](_['pick'](_0x5bcb4e[_0x3c11('0x31')],_0x25a4ed[_0x3c11('0x38')]),_0x318c7e);if(_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x39')]){_0x1790cc[_0x3c11('0x37')]=_['merge'](_0x1790cc[_0x3c11('0x37')],{'$or':_[_0x3c11('0x29')](_0x318c7e,function(_0x5c8e85){if(_0x5c8e85[_0x3c11('0x2c')]!==_0x3c11('0x3a')){var _0x379202={};_0x379202[_0x5c8e85[_0x3c11('0x26')]]={'$like':'%'+_0x5bcb4e[_0x3c11('0x31')]['filter']+'%'};return _0x379202;}})});}_0x1790cc=_[_0x3c11('0x3b')]({},_0x1790cc,_0x5bcb4e[_0x3c11('0x3c')]);var _0x30e8ef={'where':_0x1790cc[_0x3c11('0x37')]};return db[_0x3c11('0x2a')][_0x3c11('0x1c')](_0x30e8ef)['then'](function(_0x19388c){_0x11c909['count']=_0x19388c;if(_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x3d')]){_0x1790cc['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x3c11('0x3e')](_0x1790cc);})[_0x3c11('0x23')](function(_0x5d5345){_0x11c909[_0x3c11('0x3f')]=_0x5d5345;return _0x11c909;})[_0x3c11('0x23')](respondWithFilteredResult(_0x135341,_0x1790cc))[_0x3c11('0x40')](handleError(_0x135341,null));};exports[_0x3c11('0x41')]=function(_0x417a4e,_0x488854){var _0x573b3b={'raw':!![],'where':{'id':_0x417a4e[_0x3c11('0x42')]['id']}},_0x5d09b4={};_0x5d09b4[_0x3c11('0x2e')]=_[_0x3c11('0x43')](db[_0x3c11('0x2a')][_0x3c11('0x2b')]);_0x5d09b4['query']=_[_0x3c11('0x43')](_0x417a4e[_0x3c11('0x31')]);_0x5d09b4[_0x3c11('0x38')]=_[_0x3c11('0x2f')](_0x5d09b4[_0x3c11('0x2e')],_0x5d09b4['query']);_0x573b3b[_0x3c11('0x30')]=_['intersection'](_0x5d09b4[_0x3c11('0x2e')],qs['fields'](_0x417a4e[_0x3c11('0x31')][_0x3c11('0x32')]));_0x573b3b[_0x3c11('0x30')]=_0x573b3b[_0x3c11('0x30')][_0x3c11('0x33')]?_0x573b3b[_0x3c11('0x30')]:_0x5d09b4[_0x3c11('0x2e')];if(_0x417a4e['query'][_0x3c11('0x3d')]){_0x573b3b['include']=[{'all':!![]}];}_0x573b3b=_['merge']({},_0x573b3b,_0x417a4e[_0x3c11('0x3c')]);return db[_0x3c11('0x2a')][_0x3c11('0x44')](_0x573b3b)[_0x3c11('0x23')](handleEntityNotFound(_0x488854,null))[_0x3c11('0x23')](respondWithResult(_0x488854,null))[_0x3c11('0x40')](handleError(_0x488854,null));};exports[_0x3c11('0x45')]=function(_0x2dd42f,_0x103984){return db['VoiceDialReport'][_0x3c11('0x45')](_0x2dd42f[_0x3c11('0x46')],{})[_0x3c11('0x23')](respondWithResult(_0x103984,0xc9))['catch'](handleError(_0x103984,null));};exports[_0x3c11('0x22')]=function(_0x339f49,_0x3b72fe){if(_0x339f49[_0x3c11('0x46')]['id']){delete _0x339f49[_0x3c11('0x46')]['id'];}return db[_0x3c11('0x2a')][_0x3c11('0x44')]({'where':{'id':_0x339f49['params']['id']}})[_0x3c11('0x23')](handleEntityNotFound(_0x3b72fe,null))[_0x3c11('0x23')](saveUpdates(_0x339f49[_0x3c11('0x46')],null))[_0x3c11('0x23')](respondWithResult(_0x3b72fe,null))[_0x3c11('0x40')](handleError(_0x3b72fe,null));};exports[_0x3c11('0x47')]=function(_0xf7601b,_0xf3d85f){return db[_0x3c11('0x2a')]['find']({'where':{'id':_0xf7601b[_0x3c11('0x42')]['id']}})['then'](handleEntityNotFound(_0xf3d85f,null))[_0x3c11('0x23')](removeEntity(_0xf3d85f,null))[_0x3c11('0x40')](handleError(_0xf3d85f,null));};exports[_0x3c11('0x48')]=function(_0x4bc00b,_0x414531){return db[_0x3c11('0x2a')][_0x3c11('0x48')]()['then'](respondWithResult(_0x414531,null))[_0x3c11('0x40')](handleError(_0x414531,null));}; \ No newline at end of file +var _0x01b3=['nolimit','order','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','intersection','attributes','includeAll','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','filters','query','fields','length','hasOwnProperty'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x01b3,0xf0));var _0x301b=function(_0x29a91c,_0x5ac2c5){_0x29a91c=_0x29a91c-0x0;var _0x2ab4ff=_0x01b3[_0x29a91c];return _0x2ab4ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x301b('0x0'));var zipdir=require(_0x301b('0x1'));var jsonpatch=require(_0x301b('0x2'));var rp=require(_0x301b('0x3'));var moment=require(_0x301b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x301b('0x5'));var util=require(_0x301b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x301b('0x7'));var ejs=require(_0x301b('0x8'));var fs=require('fs');var fs_extra=require(_0x301b('0x9'));var _=require(_0x301b('0xa'));var squel=require('squel');var crypto=require(_0x301b('0xb'));var jsforce=require(_0x301b('0xc'));var deskjs=require(_0x301b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x301b('0xe'));var Papa=require(_0x301b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x301b('0x10'));var as=require(_0x301b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x301b('0x12'));var utils=require(_0x301b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x301b('0x14'));var db=require(_0x301b('0x15'))['db'];function respondWithStatusCode(_0x198ab3,_0x222558){_0x222558=_0x222558||0xcc;return function(_0x184f07){if(_0x184f07){return _0x198ab3[_0x301b('0x16')](_0x222558);}return _0x198ab3[_0x301b('0x17')](_0x222558)[_0x301b('0x18')]();};}function respondWithResult(_0x45d37d,_0x170bde){_0x170bde=_0x170bde||0xc8;return function(_0x1389ba){if(_0x1389ba){return _0x45d37d[_0x301b('0x17')](_0x170bde)[_0x301b('0x19')](_0x1389ba);}};}function respondWithFilteredResult(_0x55ab95,_0x1cbbdc){return function(_0x24b32d){if(_0x24b32d){var _0x30ebff=typeof _0x1cbbdc['offset']===_0x301b('0x1a')&&typeof _0x1cbbdc[_0x301b('0x1b')]===_0x301b('0x1a');var _0x134ab1=_0x24b32d[_0x301b('0x1c')];var _0x5435c4=_0x30ebff?0x0:_0x1cbbdc[_0x301b('0x1d')];var _0x442e5c=_0x30ebff?_0x24b32d[_0x301b('0x1c')]:_0x1cbbdc['offset']+_0x1cbbdc[_0x301b('0x1b')];var _0x48f513;if(_0x442e5c>=_0x134ab1){_0x442e5c=_0x134ab1;_0x48f513=0xc8;}else{_0x48f513=0xce;}_0x55ab95[_0x301b('0x17')](_0x48f513);return _0x55ab95[_0x301b('0x1e')](_0x301b('0x1f'),_0x5435c4+'-'+_0x442e5c+'/'+_0x134ab1)[_0x301b('0x19')](_0x24b32d);}return null;};}function patchUpdates(_0x56aef0){return function(_0x27490b){try{jsonpatch[_0x301b('0x20')](_0x27490b,_0x56aef0,!![]);}catch(_0x219f56){return BPromise[_0x301b('0x21')](_0x219f56);}return _0x27490b[_0x301b('0x22')]();};}function saveUpdates(_0x6c5c82,_0x365ff9){return function(_0x246620){if(_0x246620){return _0x246620['update'](_0x6c5c82)[_0x301b('0x23')](function(_0xff2ef5){return _0xff2ef5;});}return null;};}function removeEntity(_0x5ebe29,_0x5ba0d1){return function(_0x356e04){if(_0x356e04){return _0x356e04[_0x301b('0x24')]()[_0x301b('0x23')](function(){_0x5ebe29['status'](0xcc)[_0x301b('0x18')]();});}};}function handleEntityNotFound(_0x2805ec,_0x53dd13){return function(_0x2a7370){if(!_0x2a7370){_0x2805ec[_0x301b('0x16')](0x194);}return _0x2a7370;};}function handleError(_0x4a2c46,_0x4d3709){_0x4d3709=_0x4d3709||0x1f4;return function(_0x2588e9){logger['error'](_0x2588e9[_0x301b('0x25')]);if(_0x2588e9[_0x301b('0x26')]){delete _0x2588e9['name'];}_0x4a2c46['status'](_0x4d3709)['send'](_0x2588e9);};}exports['index']=function(_0x4010f8,_0x4f719c){var _0xe58b73={},_0x5742c2={},_0x5d31f2={'count':0x0,'rows':[]};var _0x1cc400=_[_0x301b('0x27')](db[_0x301b('0x28')][_0x301b('0x29')],function(_0x5f315a){return{'name':_0x5f315a[_0x301b('0x2a')],'type':_0x5f315a[_0x301b('0x2b')][_0x301b('0x2c')]};});_0x5742c2[_0x301b('0x2d')]=_[_0x301b('0x27')](_0x1cc400,_0x301b('0x26'));_0x5742c2['query']=_[_0x301b('0x2e')](_0x4010f8['query']);_0x5742c2[_0x301b('0x2f')]=_['intersection'](_0x5742c2[_0x301b('0x2d')],_0x5742c2[_0x301b('0x30')]);_0xe58b73['attributes']=_['intersection'](_0x5742c2['model'],qs[_0x301b('0x31')](_0x4010f8[_0x301b('0x30')][_0x301b('0x31')]));_0xe58b73['attributes']=_0xe58b73['attributes'][_0x301b('0x32')]?_0xe58b73['attributes']:_0x5742c2[_0x301b('0x2d')];if(!_0x4010f8[_0x301b('0x30')][_0x301b('0x33')](_0x301b('0x34'))){_0xe58b73[_0x301b('0x1b')]=qs['limit'](_0x4010f8['query'][_0x301b('0x1b')]);_0xe58b73[_0x301b('0x1d')]=qs[_0x301b('0x1d')](_0x4010f8['query'][_0x301b('0x1d')]);}_0xe58b73[_0x301b('0x35')]=qs['sort'](_0x4010f8[_0x301b('0x30')]['sort']);_0xe58b73[_0x301b('0x36')]=qs['filters'](_['pick'](_0x4010f8[_0x301b('0x30')],_0x5742c2['filters']),_0x1cc400);if(_0x4010f8[_0x301b('0x30')][_0x301b('0x37')]){_0xe58b73[_0x301b('0x36')]=_[_0x301b('0x38')](_0xe58b73[_0x301b('0x36')],{'$or':_[_0x301b('0x27')](_0x1cc400,function(_0x572ec2){if(_0x572ec2[_0x301b('0x2b')]!==_0x301b('0x39')){var _0x16c6ff={};_0x16c6ff[_0x572ec2['name']]={'$like':'%'+_0x4010f8[_0x301b('0x30')][_0x301b('0x37')]+'%'};return _0x16c6ff;}})});}_0xe58b73=_[_0x301b('0x38')]({},_0xe58b73,_0x4010f8[_0x301b('0x3a')]);var _0x56f967={'where':_0xe58b73[_0x301b('0x36')]};return db[_0x301b('0x28')]['count'](_0x56f967)[_0x301b('0x23')](function(_0x37a4af){_0x5d31f2[_0x301b('0x1c')]=_0x37a4af;if(_0x4010f8[_0x301b('0x30')]['includeAll']){_0xe58b73[_0x301b('0x3b')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x301b('0x3c')](_0xe58b73);})['then'](function(_0x1bf40c){_0x5d31f2[_0x301b('0x3d')]=_0x1bf40c;return _0x5d31f2;})[_0x301b('0x23')](respondWithFilteredResult(_0x4f719c,_0xe58b73))[_0x301b('0x3e')](handleError(_0x4f719c,null));};exports[_0x301b('0x3f')]=function(_0xb283e8,_0xa715ae){var _0x82248c={'raw':!![],'where':{'id':_0xb283e8['params']['id']}},_0x27faf8={};_0x27faf8[_0x301b('0x2d')]=_[_0x301b('0x2e')](db['VoiceDialReport']['rawAttributes']);_0x27faf8[_0x301b('0x30')]=_['keys'](_0xb283e8[_0x301b('0x30')]);_0x27faf8[_0x301b('0x2f')]=_[_0x301b('0x40')](_0x27faf8['model'],_0x27faf8[_0x301b('0x30')]);_0x82248c[_0x301b('0x41')]=_[_0x301b('0x40')](_0x27faf8[_0x301b('0x2d')],qs['fields'](_0xb283e8[_0x301b('0x30')][_0x301b('0x31')]));_0x82248c[_0x301b('0x41')]=_0x82248c[_0x301b('0x41')][_0x301b('0x32')]?_0x82248c['attributes']:_0x27faf8[_0x301b('0x2d')];if(_0xb283e8[_0x301b('0x30')][_0x301b('0x42')]){_0x82248c[_0x301b('0x3b')]=[{'all':!![]}];}_0x82248c=_[_0x301b('0x38')]({},_0x82248c,_0xb283e8['options']);return db['VoiceDialReport'][_0x301b('0x43')](_0x82248c)[_0x301b('0x23')](handleEntityNotFound(_0xa715ae,null))[_0x301b('0x23')](respondWithResult(_0xa715ae,null))[_0x301b('0x3e')](handleError(_0xa715ae,null));};exports[_0x301b('0x44')]=function(_0x10a7af,_0xf82de1){return db[_0x301b('0x28')]['create'](_0x10a7af[_0x301b('0x45')],{})[_0x301b('0x23')](respondWithResult(_0xf82de1,0xc9))[_0x301b('0x3e')](handleError(_0xf82de1,null));};exports[_0x301b('0x46')]=function(_0x273ad0,_0x3ce225){if(_0x273ad0[_0x301b('0x45')]['id']){delete _0x273ad0[_0x301b('0x45')]['id'];}return db['VoiceDialReport'][_0x301b('0x43')]({'where':{'id':_0x273ad0['params']['id']}})[_0x301b('0x23')](handleEntityNotFound(_0x3ce225,null))[_0x301b('0x23')](saveUpdates(_0x273ad0[_0x301b('0x45')],null))[_0x301b('0x23')](respondWithResult(_0x3ce225,null))['catch'](handleError(_0x3ce225,null));};exports['destroy']=function(_0x555be2,_0x4d1ea9){return db[_0x301b('0x28')][_0x301b('0x43')]({'where':{'id':_0x555be2[_0x301b('0x47')]['id']}})['then'](handleEntityNotFound(_0x4d1ea9,null))[_0x301b('0x23')](removeEntity(_0x4d1ea9,null))['catch'](handleError(_0x4d1ea9,null));};exports[_0x301b('0x48')]=function(_0x52ce04,_0x576381){return db[_0x301b('0x28')][_0x301b('0x48')]()['then'](respondWithResult(_0x576381,null))[_0x301b('0x3e')](handleError(_0x576381,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c9447da..d299b12 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 _0x2635=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2351f8,_0x4b1d1f){var _0x36a216=function(_0x383762){while(--_0x383762){_0x2351f8['push'](_0x2351f8['shift']());}};_0x36a216(++_0x4b1d1f);}(_0x2635,0x148));var _0x5263=function(_0x1d1b52,_0x15aec4){_0x1d1b52=_0x1d1b52-0x0;var _0x3c8734=_0x2635[_0x1d1b52];return _0x3c8734;};'use strict';var _=require(_0x5263('0x0'));var util=require(_0x5263('0x1'));var logger=require(_0x5263('0x2'))(_0x5263('0x3'));var moment=require(_0x5263('0x4'));var BPromise=require(_0x5263('0x5'));var rp=require(_0x5263('0x6'));var fs=require('fs');var path=require(_0x5263('0x7'));var rimraf=require(_0x5263('0x8'));var config=require(_0x5263('0x9'));var attributes=require(_0x5263('0xa'));module[_0x5263('0xb')]=function(_0x2afee5,_0x2edd24){return _0x2afee5[_0x5263('0xc')](_0x5263('0xd'),attributes,{'tableName':_0x5263('0xe'),'paranoid':![],'indexes':[{'fields':[_0x5263('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb708=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','uniqueid'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xb708,0xe7));var _0x8b70=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xb708[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x8b70('0x0'));var util=require('util');var logger=require(_0x8b70('0x1'))('api');var moment=require(_0x8b70('0x2'));var BPromise=require(_0x8b70('0x3'));var rp=require(_0x8b70('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b70('0x5'));var config=require(_0x8b70('0x6'));var attributes=require(_0x8b70('0x7'));module['exports']=function(_0x2e991c,_0x3a63fb){return _0x2e991c['define'](_0x8b70('0x8'),attributes,{'tableName':_0x8b70('0x9'),'paranoid':![],'indexes':[{'fields':[_0x8b70('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 5dfd07e..0a133b0 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 _0x3a5d=['request\x20sent','stringify','code','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','body','where','limit','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x1cedf1,_0x18dcb4){var _0x4063ce=function(_0x1ee1ff){while(--_0x1ee1ff){_0x1cedf1['push'](_0x1cedf1['shift']());}};_0x4063ce(++_0x18dcb4);}(_0x3a5d,0x113));var _0xd3a5=function(_0xff1f9d,_0x59087c){_0xff1f9d=_0xff1f9d-0x0;var _0x4e9032=_0x3a5d[_0xff1f9d];return _0x4e9032;};'use strict';var _=require(_0xd3a5('0x0'));var util=require(_0xd3a5('0x1'));var moment=require(_0xd3a5('0x2'));var BPromise=require(_0xd3a5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3a5('0x4'));var db=require(_0xd3a5('0x5'))['db'];var utils=require(_0xd3a5('0x6'));var logger=require(_0xd3a5('0x7'))(_0xd3a5('0x8'));var config=require('../../config/environment');var jayson=require(_0xd3a5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47a2e3,_0x178b7f,_0x34b8e3){return new BPromise(function(_0x6eeed7,_0x5e185d){return client['request'](_0x47a2e3,_0x34b8e3)['then'](function(_0x3120d5){logger[_0xd3a5('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x178b7f,'request\x20sent');logger[_0xd3a5('0xb')](_0xd3a5('0xc'),_0x178b7f,_0xd3a5('0xd'),JSON[_0xd3a5('0xe')](_0x3120d5));if(_0x3120d5['error']){if(_0x3120d5['error'][_0xd3a5('0xf')]===0x1f4){logger[_0xd3a5('0x10')](_0xd3a5('0x11'),_0x178b7f,_0x3120d5[_0xd3a5('0x10')]['message']);return _0x5e185d(_0x3120d5[_0xd3a5('0x10')][_0xd3a5('0x12')]);}logger[_0xd3a5('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x178b7f,_0x3120d5[_0xd3a5('0x10')][_0xd3a5('0x12')]);return _0x6eeed7(_0x3120d5['error'][_0xd3a5('0x12')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x178b7f,_0xd3a5('0xd'));_0x6eeed7(_0x3120d5[_0xd3a5('0x13')][_0xd3a5('0x12')]);}})[_0xd3a5('0x14')](function(_0x3241a3){logger[_0xd3a5('0x10')](_0xd3a5('0x11'),_0x178b7f,_0x3241a3);_0x5e185d(_0x3241a3);});});}exports[_0xd3a5('0x15')]=function(_0x18978b){var _0x2325d0=this;return new Promise(function(_0x2cecb2,_0x2282ff){return db[_0xd3a5('0x16')][_0xd3a5('0x17')](_0x18978b['body'],{'raw':_0x18978b[_0xd3a5('0x18')]?_0x18978b['options'][_0xd3a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xdf7810){logger[_0xd3a5('0xa')]('CreateVoiceDialReport',_0x18978b);logger[_0xd3a5('0xb')](_0xd3a5('0x15'),_0x18978b,JSON[_0xd3a5('0xe')](_0xdf7810));_0x2cecb2(_0xdf7810);})[_0xd3a5('0x14')](function(_0x3fbb7e){logger['error'](_0xd3a5('0x15'),_0x3fbb7e[_0xd3a5('0x12')],_0x18978b);_0x2282ff(_0x2325d0[_0xd3a5('0x10')](0x1f4,_0x3fbb7e[_0xd3a5('0x12')]));});});};exports[_0xd3a5('0x1a')]=function(_0x535aa9){var _0x58df2d=this;return new Promise(function(_0x171178,_0x4aa6ad){return db[_0xd3a5('0x16')][_0xd3a5('0x1b')](_0x535aa9[_0xd3a5('0x1c')],{'raw':_0x535aa9[_0xd3a5('0x18')]?_0x535aa9['options'][_0xd3a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x535aa9[_0xd3a5('0x18')]?_0x535aa9[_0xd3a5('0x18')][_0xd3a5('0x1d')]||null:null,'attributes':_0x535aa9[_0xd3a5('0x18')]?_0x535aa9['options']['attributes']||null:null,'limit':_0x535aa9[_0xd3a5('0x18')]?_0x535aa9['options'][_0xd3a5('0x1e')]||null:null})[_0xd3a5('0x1f')](function(_0x456ef3){logger['info'](_0xd3a5('0x1a'),_0x535aa9);logger[_0xd3a5('0xb')](_0xd3a5('0x1a'),_0x535aa9,JSON[_0xd3a5('0xe')](_0x456ef3));_0x171178(_0x456ef3);})['catch'](function(_0x23c150){logger[_0xd3a5('0x10')](_0xd3a5('0x1a'),_0x23c150['message'],_0x535aa9);_0x4aa6ad(_0x58df2d[_0xd3a5('0x10')](0x1f4,_0x23c150[_0xd3a5('0x12')]));});});}; \ No newline at end of file +var _0x2a9f=['catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x2a9f,0x10b));var _0xf2a9=function(_0x70fe73,_0x435a10){_0x70fe73=_0x70fe73-0x0;var _0x3af159=_0x2a9f[_0x70fe73];return _0x3af159;};'use strict';var _=require(_0xf2a9('0x0'));var util=require(_0xf2a9('0x1'));var moment=require(_0xf2a9('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2a9('0x3'));var fs=require('fs');var Redis=require(_0xf2a9('0x4'));var db=require(_0xf2a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2a9('0x6'))('rpc');var config=require(_0xf2a9('0x7'));var jayson=require(_0xf2a9('0x8'));var client=jayson[_0xf2a9('0x9')][_0xf2a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e3015,_0x575859,_0x24594e){return new BPromise(function(_0x2afce1,_0x1dbcea){return client[_0xf2a9('0xb')](_0x5e3015,_0x24594e)[_0xf2a9('0xc')](function(_0xe95baa){logger[_0xf2a9('0xd')](_0xf2a9('0xe'),_0x575859,_0xf2a9('0xf'));logger[_0xf2a9('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x575859,_0xf2a9('0xf'),JSON[_0xf2a9('0x11')](_0xe95baa));if(_0xe95baa['error']){if(_0xe95baa[_0xf2a9('0x12')]['code']===0x1f4){logger[_0xf2a9('0x12')](_0xf2a9('0xe'),_0x575859,_0xe95baa[_0xf2a9('0x12')][_0xf2a9('0x13')]);return _0x1dbcea(_0xe95baa[_0xf2a9('0x12')][_0xf2a9('0x13')]);}logger[_0xf2a9('0x12')](_0xf2a9('0xe'),_0x575859,_0xe95baa[_0xf2a9('0x12')]['message']);return _0x2afce1(_0xe95baa[_0xf2a9('0x12')]['message']);}else{logger[_0xf2a9('0xd')](_0xf2a9('0xe'),_0x575859,'request\x20sent');_0x2afce1(_0xe95baa[_0xf2a9('0x14')][_0xf2a9('0x13')]);}})[_0xf2a9('0x15')](function(_0x37a369){logger[_0xf2a9('0x12')](_0xf2a9('0xe'),_0x575859,_0x37a369);_0x1dbcea(_0x37a369);});});}exports[_0xf2a9('0x16')]=function(_0x75d315){var _0x3ff2f1=this;return new Promise(function(_0x3b29a2,_0x514678){return db[_0xf2a9('0x17')][_0xf2a9('0x18')](_0x75d315[_0xf2a9('0x19')],{'raw':_0x75d315[_0xf2a9('0x1a')]?_0x75d315['options'][_0xf2a9('0x1b')]===undefined?!![]:![]:!![]})[_0xf2a9('0xc')](function(_0x2b5f5c){logger['info'](_0xf2a9('0x16'),_0x75d315);logger[_0xf2a9('0x10')](_0xf2a9('0x16'),_0x75d315,JSON['stringify'](_0x2b5f5c));_0x3b29a2(_0x2b5f5c);})[_0xf2a9('0x15')](function(_0x5689ff){logger[_0xf2a9('0x12')](_0xf2a9('0x16'),_0x5689ff[_0xf2a9('0x13')],_0x75d315);_0x514678(_0x3ff2f1['error'](0x1f4,_0x5689ff[_0xf2a9('0x13')]));});});};exports[_0xf2a9('0x1c')]=function(_0x34b35b){var _0x29beca=this;return new Promise(function(_0x4cfb52,_0x211c95){return db[_0xf2a9('0x17')][_0xf2a9('0x1d')](_0x34b35b['body'],{'raw':_0x34b35b[_0xf2a9('0x1a')]?_0x34b35b[_0xf2a9('0x1a')][_0xf2a9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34b35b[_0xf2a9('0x1a')]?_0x34b35b[_0xf2a9('0x1a')][_0xf2a9('0x1e')]||null:null,'attributes':_0x34b35b['options']?_0x34b35b[_0xf2a9('0x1a')][_0xf2a9('0x1f')]||null:null,'limit':_0x34b35b[_0xf2a9('0x1a')]?_0x34b35b[_0xf2a9('0x1a')]['limit']||null:null})['then'](function(_0x20c02c){logger[_0xf2a9('0xd')]('UpdateVoiceDialReport',_0x34b35b);logger[_0xf2a9('0x10')](_0xf2a9('0x1c'),_0x34b35b,JSON['stringify'](_0x20c02c));_0x4cfb52(_0x20c02c);})['catch'](function(_0x24ab50){logger[_0xf2a9('0x12')]('UpdateVoiceDialReport',_0x24ab50[_0xf2a9('0x13')],_0x34b35b);_0x211c95(_0x29beca[_0xf2a9('0x12')](0x1f4,_0x24ab50[_0xf2a9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 60bca60..a13b795 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 _0x7121=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','addApplications','update','delete','exports','multer','util','path'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x7121,0x7b));var _0x1712=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7121[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x1712('0x0'));var util=require(_0x1712('0x1'));var path=require(_0x1712('0x2'));var timeout=require(_0x1712('0x3'));var express=require(_0x1712('0x4'));var router=express[_0x1712('0x5')]();var fs_extra=require(_0x1712('0x6'));var auth=require(_0x1712('0x7'));var interaction=require(_0x1712('0x8'));var config=require(_0x1712('0x9'));var controller=require('./voiceExtension.controller');router[_0x1712('0xa')]('/',auth[_0x1712('0xb')](),controller[_0x1712('0xc')]);router[_0x1712('0xa')](_0x1712('0xd'),auth[_0x1712('0xb')](),controller[_0x1712('0xe')]);router[_0x1712('0xf')]('/',auth[_0x1712('0xb')](),controller[_0x1712('0x10')]);router[_0x1712('0xf')]('/:id/applications',auth[_0x1712('0xb')](),controller[_0x1712('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1712('0x12')]);router[_0x1712('0x13')]('/:id',auth[_0x1712('0xb')](),controller['destroy']);module[_0x1712('0x14')]=router; \ No newline at end of file +var _0x4292=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','addApplications','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x12b004,_0x1b2926){var _0x5366f7=function(_0x3b078a){while(--_0x3b078a){_0x12b004['push'](_0x12b004['shift']());}};_0x5366f7(++_0x1b2926);}(_0x4292,0xcc));var _0x2429=function(_0x3495e7,_0x2f6a1f){_0x3495e7=_0x3495e7-0x0;var _0x5cbb6f=_0x4292[_0x3495e7];return _0x5cbb6f;};'use strict';var multer=require(_0x2429('0x0'));var util=require(_0x2429('0x1'));var path=require(_0x2429('0x2'));var timeout=require('connect-timeout');var express=require(_0x2429('0x3'));var router=express[_0x2429('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2429('0x5'));var interaction=require(_0x2429('0x6'));var config=require(_0x2429('0x7'));var controller=require(_0x2429('0x8'));router[_0x2429('0x9')]('/',auth[_0x2429('0xa')](),controller[_0x2429('0xb')]);router['get'](_0x2429('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2429('0xd')]('/',auth[_0x2429('0xa')](),controller[_0x2429('0xe')]);router[_0x2429('0xd')](_0x2429('0xf'),auth['isAuthenticated'](),controller[_0x2429('0x10')]);router['put'](_0x2429('0xc'),auth[_0x2429('0xa')](),controller[_0x2429('0x11')]);router[_0x2429('0x12')](_0x2429('0xc'),auth['isAuthenticated'](),controller[_0x2429('0x13')]);module[_0x2429('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7724ec4..e618926 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x10a889,_0x220612){var _0x3b5ed3=function(_0x4f0137){while(--_0x4f0137){_0x10a889['push'](_0x10a889['shift']());}};_0x3b5ed3(++_0x220612);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0x70e0=['INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x70e0,0x17b));var _0x070e=function(_0x23f1be,_0x124ddd){_0x23f1be=_0x23f1be-0x0;var _0x8fee8e=_0x70e0[_0x23f1be];return _0x8fee8e;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'context':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0x3')},'priority':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x070e('0x3')},'tag':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x070e('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x070e('0x5')]('inbound','outbound','internal',_0x070e('0x6'),_0x070e('0x7'),_0x070e('0x8'),_0x070e('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x070e('0x2')]},'interval':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':_0x070e('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x070e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x070e('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x070e('0xc')]},'recordingFormat':{'type':Sequelize[_0x070e('0x2')],'defaultValue':_0x070e('0xd')},'answer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x070e('0xe')],'get':function(){return this[_0x070e('0xf')](_0x070e('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 711671d..94adcb0 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 _0xa5c4=['fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','VoiceExtension','includeAll','include','findAll','show','keys','options','params','catch','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','outbound','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','destroy','then','get','inbound','InternalRoutes','internal','ignore','value','includes','find','type','name','stack','send','index','rawAttributes','fieldName','map','intersection','query','attributes','model'];(function(_0x14c72c,_0x144c34){var _0x1b293c=function(_0x47f7f8){while(--_0x47f7f8){_0x14c72c['push'](_0x14c72c['shift']());}};_0x1b293c(++_0x144c34);}(_0xa5c4,0x18e));var _0x4a5c=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0xa5c4[_0x5ca5bc];return _0x26ca86;};'use strict';var _=require(_0x4a5c('0x0'));var Redis=require(_0x4a5c('0x1'));var qs=require(_0x4a5c('0x2'));var logger=require(_0x4a5c('0x3'))('api');var config=require(_0x4a5c('0x4'));var db=require(_0x4a5c('0x5'))['db'];config[_0x4a5c('0x6')]=_[_0x4a5c('0x7')](config[_0x4a5c('0x6')],{'host':_0x4a5c('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a5c('0x6')]));require(_0x4a5c('0x9'))[_0x4a5c('0xa')](socket);function respondWithStatusCode(_0x383687,_0x5c004f){_0x5c004f=_0x5c004f||0xcc;return function(_0x36d49d){if(_0x36d49d){return _0x383687[_0x4a5c('0xb')](_0x5c004f);}return _0x383687[_0x4a5c('0xc')](_0x5c004f)[_0x4a5c('0xd')]();};}function respondWithResult(_0x358c7f,_0x4a07d2){_0x4a07d2=_0x4a07d2||0xc8;return function(_0x43dc79){if(_0x43dc79){return _0x358c7f['status'](_0x4a07d2)['json'](_0x43dc79);}};}function respondWithFilteredResult(_0x10302f,_0x2bb0fc){return function(_0x3d5931){if(_0x3d5931){var _0x4c2f3b=typeof _0x2bb0fc[_0x4a5c('0xe')]===_0x4a5c('0xf')&&typeof _0x2bb0fc[_0x4a5c('0x10')]===_0x4a5c('0xf');var _0x4ecb5a=_0x3d5931[_0x4a5c('0x11')];var _0x257cad=_0x4c2f3b?0x0:_0x2bb0fc[_0x4a5c('0xe')];var _0x483e7a=_0x4c2f3b?_0x3d5931[_0x4a5c('0x11')]:_0x2bb0fc[_0x4a5c('0xe')]+_0x2bb0fc[_0x4a5c('0x10')];var _0x59664c;if(_0x483e7a>=_0x4ecb5a){_0x483e7a=_0x4ecb5a;_0x59664c=0xc8;}else{_0x59664c=0xce;}_0x10302f[_0x4a5c('0xc')](_0x59664c);return _0x10302f[_0x4a5c('0x12')]('Content-Range',_0x257cad+'-'+_0x483e7a+'/'+_0x4ecb5a)[_0x4a5c('0x13')](_0x3d5931);}return null;};}function removeEntity(_0x3096d8){return function(_0x258cce){if(_0x258cce){return _0x258cce[_0x4a5c('0x14')]()[_0x4a5c('0x15')](function(){var _0x2c36f0=_0x258cce[_0x4a5c('0x16')]({'plain':!![]});var _0x57289c=[{'name':'InboundRoutes','value':_0x4a5c('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x4a5c('0x18'),'value':_0x4a5c('0x19'),'ignore':![]}];var _0x18b147=_(_0x57289c)['filter'](_0x4a5c('0x1a'))['map'](_0x4a5c('0x1b'))[_0x4a5c('0x1b')]();if(_[_0x4a5c('0x1c')](_0x18b147,_0x2c36f0['type'])){return;}var _0x5c9be8=_[_0x4a5c('0x1d')](_0x57289c,['value',_0x2c36f0[_0x4a5c('0x1e')]])[_0x4a5c('0x1f')];return db['UserProfileResource'][_0x4a5c('0x14')]({'where':{'type':_0x5c9be8,'resourceId':_0x2c36f0['id']}})[_0x4a5c('0x15')](function(){return _0x258cce;});})[_0x4a5c('0x15')](function(){_0x3096d8[_0x4a5c('0xc')](0xcc)[_0x4a5c('0xd')]();});}};}function handleEntityNotFound(_0x5e8040){return function(_0x3025ac){if(!_0x3025ac){_0x5e8040['sendStatus'](0x194);}return _0x3025ac;};}function handleError(_0x5dec75,_0x2ea6c8){_0x2ea6c8=_0x2ea6c8||0x1f4;return function(_0x3edfc8){logger['error'](_0x3edfc8[_0x4a5c('0x20')]);if(_0x3edfc8[_0x4a5c('0x1f')]){delete _0x3edfc8['name'];}_0x5dec75[_0x4a5c('0xc')](_0x2ea6c8)[_0x4a5c('0x21')](_0x3edfc8);};}exports[_0x4a5c('0x22')]=function(_0x559a71,_0x57cc83){var _0x1b8395={},_0x5ef0bb={},_0xba4c3e={'count':0x0,'rows':[]};var _0x197503=_['map'](db['VoiceExtension'][_0x4a5c('0x23')],function(_0xde474){return{'name':_0xde474[_0x4a5c('0x24')],'type':_0xde474['type']['key']};});_0x5ef0bb['model']=_[_0x4a5c('0x25')](_0x197503,_0x4a5c('0x1f'));_0x5ef0bb['query']=_['keys'](_0x559a71['query']);_0x5ef0bb['filters']=_[_0x4a5c('0x26')](_0x5ef0bb['model'],_0x5ef0bb[_0x4a5c('0x27')]);_0x1b8395[_0x4a5c('0x28')]=_[_0x4a5c('0x26')](_0x5ef0bb[_0x4a5c('0x29')],qs[_0x4a5c('0x2a')](_0x559a71['query'][_0x4a5c('0x2a')]));_0x1b8395[_0x4a5c('0x28')]=_0x1b8395['attributes']['length']?_0x1b8395[_0x4a5c('0x28')]:_0x5ef0bb[_0x4a5c('0x29')];if(!_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x2b')](_0x4a5c('0x2c'))){_0x1b8395[_0x4a5c('0x10')]=qs[_0x4a5c('0x10')](_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x10')]);_0x1b8395[_0x4a5c('0xe')]=qs[_0x4a5c('0xe')](_0x559a71[_0x4a5c('0x27')][_0x4a5c('0xe')]);}_0x1b8395['order']=qs[_0x4a5c('0x2d')](_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x2d')]);_0x1b8395['where']=qs[_0x4a5c('0x2e')](_[_0x4a5c('0x2f')](_0x559a71[_0x4a5c('0x27')],_0x5ef0bb[_0x4a5c('0x2e')]),_0x197503);if(_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x30')]){_0x1b8395[_0x4a5c('0x31')]=_['merge'](_0x1b8395['where'],{'$or':_['map'](_0x197503,function(_0x4d6567){if(_0x4d6567[_0x4a5c('0x1e')]!==_0x4a5c('0x32')){var _0x23777c={};_0x23777c[_0x4d6567[_0x4a5c('0x1f')]]={'$like':'%'+_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x30')]+'%'};return _0x23777c;}})});}_0x1b8395=_[_0x4a5c('0x33')]({},_0x1b8395,_0x559a71['options']);var _0x40f101={'where':_0x1b8395[_0x4a5c('0x31')]};return db[_0x4a5c('0x34')][_0x4a5c('0x11')](_0x40f101)[_0x4a5c('0x15')](function(_0x3374bf){_0xba4c3e[_0x4a5c('0x11')]=_0x3374bf;if(_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x35')]){_0x1b8395[_0x4a5c('0x36')]=[{'all':!![]}];}return db[_0x4a5c('0x34')][_0x4a5c('0x37')](_0x1b8395);})['then'](function(_0x1bbc33){_0xba4c3e['rows']=_0x1bbc33;return _0xba4c3e;})[_0x4a5c('0x15')](respondWithFilteredResult(_0x57cc83,_0x1b8395))['catch'](handleError(_0x57cc83,null));};exports[_0x4a5c('0x38')]=function(_0x8f6a82,_0x2037ff){var _0x3efea1={'raw':![],'where':{'id':_0x8f6a82['params']['id']}},_0x80122b={};_0x80122b[_0x4a5c('0x29')]=_['keys'](db[_0x4a5c('0x34')][_0x4a5c('0x23')]);_0x80122b['query']=_[_0x4a5c('0x39')](_0x8f6a82['query']);_0x80122b[_0x4a5c('0x2e')]=_[_0x4a5c('0x26')](_0x80122b[_0x4a5c('0x29')],_0x80122b[_0x4a5c('0x27')]);_0x3efea1[_0x4a5c('0x28')]=_[_0x4a5c('0x26')](_0x80122b['model'],qs[_0x4a5c('0x2a')](_0x8f6a82['query'][_0x4a5c('0x2a')]));_0x3efea1[_0x4a5c('0x28')]=_0x3efea1[_0x4a5c('0x28')]['length']?_0x3efea1['attributes']:_0x80122b[_0x4a5c('0x29')];if(_0x8f6a82['query'][_0x4a5c('0x35')]){_0x3efea1[_0x4a5c('0x36')]=[{'all':!![]}];}_0x3efea1=_[_0x4a5c('0x33')]({},_0x3efea1,_0x8f6a82[_0x4a5c('0x3a')]);return db[_0x4a5c('0x34')][_0x4a5c('0x1d')](_0x3efea1)[_0x4a5c('0x15')](handleEntityNotFound(_0x2037ff,null))[_0x4a5c('0x15')](respondWithResult(_0x2037ff,null))['catch'](handleError(_0x2037ff,null));};exports[_0x4a5c('0x14')]=function(_0x19b43e,_0x304719){return db[_0x4a5c('0x34')][_0x4a5c('0x1d')]({'where':{'id':_0x19b43e[_0x4a5c('0x3b')]['id']}})[_0x4a5c('0x15')](handleEntityNotFound(_0x304719,null))['then'](removeEntity(_0x304719,null))[_0x4a5c('0x3c')](handleError(_0x304719,null));};exports[_0x4a5c('0x3d')]=function(_0x57d883,_0x4164dc){if(_0x57d883[_0x4a5c('0x3e')]['type']==='outbound'&&!_[_0x4a5c('0x3f')](_0x57d883[_0x4a5c('0x3e')][_0x4a5c('0x40')],'_')){_0x57d883[_0x4a5c('0x3e')][_0x4a5c('0x40')]='_'['concat'](_0x57d883[_0x4a5c('0x3e')][_0x4a5c('0x40')]);}return db[_0x4a5c('0x34')][_0x4a5c('0x3d')](_0x57d883['body'],{'raw':![]})[_0x4a5c('0x15')](function(_0x113535){var _0x1c42ba=_0x57d883['user']['get']({'plain':!![]});if(!_0x1c42ba)throw new Error(_0x4a5c('0x41'));if(_0x1c42ba['role']==='user'){var _0x21868c=_0x113535[_0x4a5c('0x16')]({'plain':!![]});var _0x5c9553=[{'name':_0x4a5c('0x42'),'value':_0x4a5c('0x17')},{'name':'OutboundRoutes','value':_0x4a5c('0x43')},{'name':_0x4a5c('0x18'),'value':_0x4a5c('0x19')}];var _0x31c077=_[_0x4a5c('0x1d')](_0x5c9553,[_0x4a5c('0x1b'),_0x21868c[_0x4a5c('0x1e')]])[_0x4a5c('0x1f')];return db[_0x4a5c('0x44')][_0x4a5c('0x1d')]({'where':{'name':_0x31c077,'userProfileId':_0x1c42ba[_0x4a5c('0x45')]},'raw':!![]})['then'](function(_0x2441b2){if(_0x2441b2&&_0x2441b2['autoAssociation']===0x0){return db[_0x4a5c('0x46')][_0x4a5c('0x3d')]({'name':_0x21868c[_0x4a5c('0x1f')],'resourceId':_0x21868c['id'],'type':_0x2441b2['name'],'sectionId':_0x2441b2['id']},{})[_0x4a5c('0x15')](function(){return _0x113535;});}else{return _0x113535;}})[_0x4a5c('0x3c')](function(_0x354746){logger[_0x4a5c('0x47')](_0x4a5c('0x48'),_0x354746);throw _0x354746;});}return _0x113535;})[_0x4a5c('0x15')](respondWithResult(_0x4164dc,0xc9))[_0x4a5c('0x3c')](handleError(_0x4164dc,null));};exports[_0x4a5c('0x49')]=function(_0x4e6ac7,_0x951fac){if(_0x4e6ac7[_0x4a5c('0x3e')]['id']){delete _0x4e6ac7[_0x4a5c('0x3e')]['id'];}return db['VoiceExtension'][_0x4a5c('0x1d')]({'where':{'id':_0x4e6ac7[_0x4a5c('0x3b')]['id']}})[_0x4a5c('0x15')](handleEntityNotFound(_0x951fac,null))[_0x4a5c('0x15')](function(_0x35b52b){if(_0x35b52b){return db['VoiceExtension'][_0x4a5c('0x49')](_[_0x4a5c('0x2f')](_0x4e6ac7[_0x4a5c('0x3e')],[_0x4a5c('0x40'),_0x4a5c('0x4a'),_0x4a5c('0x4b'),_0x4a5c('0x4c'),'cutdigits',_0x4a5c('0x4d'),'alias']),{'where':{'context':_0x35b52b[_0x4a5c('0x4a')],'exten':_0x35b52b[_0x4a5c('0x40')]},'individualHooks':!![]})[_0x4a5c('0x15')](function(_0x368dee){return _0x368dee;});}return null;})[_0x4a5c('0x15')](respondWithStatusCode(_0x951fac,null))[_0x4a5c('0x3c')](handleError(_0x951fac,null));};exports[_0x4a5c('0x4e')]=function(_0x572c29,_0x22510e){var _0x5389f2=_0x572c29[_0x4a5c('0x3b')]['id'];var _0x1c863c=_0x572c29[_0x4a5c('0x3e')];var _0x1d095f=0xc8;var _0x3a9491=null;return db[_0x4a5c('0x4f')]['transaction']({'isolationLevel':db[_0x4a5c('0x4f')]['Transaction'][_0x4a5c('0x50')][_0x4a5c('0x51')]},function(_0x595240){return db['VoiceExtension'][_0x4a5c('0x52')]({'where':{'id':_0x5389f2},'transaction':_0x595240})[_0x4a5c('0x15')](function(_0x52a828){if(_0x52a828){return db[_0x4a5c('0x34')][_0x4a5c('0x14')]({'where':{'VoiceExtensionId':_0x5389f2},'transaction':_0x595240})[_0x4a5c('0x15')](function(){var _0x364713=_[_0x4a5c('0x25')](_0x1c863c,function(_0x11ecd9){_0x11ecd9[_0x4a5c('0x53')]=_0x5389f2;_0x11ecd9[_0x4a5c('0x54')]=!![];return _0x11ecd9;});return _0x52a828['createRouting'](_0x364713);})[_0x4a5c('0x15')](function(_0x1267e9){return db[_0x4a5c('0x34')][_0x4a5c('0x55')](_0x1267e9,{'transaction':_0x595240});});}else{_0x1d095f=0x194;_0x3a9491=[];}});})[_0x4a5c('0x15')](function(){if(_0x1d095f!==0x194){return db[_0x4a5c('0x34')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x5389f2},'order':_0x4a5c('0x56')})['then'](function(_0x5c52a8){_0x3a9491=_0x5c52a8;});}})[_0x4a5c('0x3c')](function(_0x16c282){_0x1d095f=0x1f4;logger[_0x4a5c('0x47')](_0x16c282[_0x4a5c('0x20')]);if(_0x16c282[_0x4a5c('0x1f')]){delete _0x16c282['name'];}_0x3a9491=_0x16c282;})[_0x4a5c('0x57')](function(){if(_0x3a9491===null){_0x22510e['sendStatus'](_0x1d095f);}else{if(_0x1d095f===0x1f4){_0x22510e[_0x4a5c('0xc')](_0x1d095f)[_0x4a5c('0x21')](_0x3a9491);}else{_0x22510e['status'](_0x1d095f)[_0x4a5c('0x13')](_0x3a9491);}}});}; \ No newline at end of file +var _0xb2d5=['merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','startsWith','exten','body','concat','user','role','InboundRoutes','inbound','UserProfileSection','autoAssociation','update','context','recordingFormat','mandatoryDisposition','alias','sequelize','transaction','Transaction','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','then','get','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','type','find','name','UserProfileResource','destroy','sendStatus','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where'];(function(_0x1b35a3,_0x29c081){var _0x5f4dbd=function(_0x1b1aaa){while(--_0x1b1aaa){_0x1b35a3['push'](_0x1b35a3['shift']());}};_0x5f4dbd(++_0x29c081);}(_0xb2d5,0x1f0));var _0x5b2d=function(_0x37c3a3,_0x1cbefb){_0x37c3a3=_0x37c3a3-0x0;var _0x3da024=_0xb2d5[_0x37c3a3];return _0x3da024;};'use strict';var _=require(_0x5b2d('0x0'));var Redis=require('ioredis');var qs=require(_0x5b2d('0x1'));var logger=require(_0x5b2d('0x2'))(_0x5b2d('0x3'));var config=require(_0x5b2d('0x4'));var db=require(_0x5b2d('0x5'))['db'];config['redis']=_[_0x5b2d('0x6')](config['redis'],{'host':_0x5b2d('0x7'),'port':0x18eb});var socket=require(_0x5b2d('0x8'))(new Redis(config[_0x5b2d('0x9')]));require(_0x5b2d('0xa'))[_0x5b2d('0xb')](socket);function respondWithStatusCode(_0x489b6c,_0x3ae99b){_0x3ae99b=_0x3ae99b||0xcc;return function(_0x4f5f8a){if(_0x4f5f8a){return _0x489b6c['sendStatus'](_0x3ae99b);}return _0x489b6c[_0x5b2d('0xc')](_0x3ae99b)[_0x5b2d('0xd')]();};}function respondWithResult(_0x1c9102,_0x5a1f0b){_0x5a1f0b=_0x5a1f0b||0xc8;return function(_0x56aae7){if(_0x56aae7){return _0x1c9102[_0x5b2d('0xc')](_0x5a1f0b)[_0x5b2d('0xe')](_0x56aae7);}};}function respondWithFilteredResult(_0x5a1594,_0x3f1ddd){return function(_0x5e7ce7){if(_0x5e7ce7){var _0x8a1c33=typeof _0x3f1ddd[_0x5b2d('0xf')]===_0x5b2d('0x10')&&typeof _0x3f1ddd['limit']===_0x5b2d('0x10');var _0x5e701e=_0x5e7ce7[_0x5b2d('0x11')];var _0x343f7c=_0x8a1c33?0x0:_0x3f1ddd[_0x5b2d('0xf')];var _0x560484=_0x8a1c33?_0x5e7ce7['count']:_0x3f1ddd[_0x5b2d('0xf')]+_0x3f1ddd[_0x5b2d('0x12')];var _0x23df47;if(_0x560484>=_0x5e701e){_0x560484=_0x5e701e;_0x23df47=0xc8;}else{_0x23df47=0xce;}_0x5a1594[_0x5b2d('0xc')](_0x23df47);return _0x5a1594[_0x5b2d('0x13')](_0x5b2d('0x14'),_0x343f7c+'-'+_0x560484+'/'+_0x5e701e)['json'](_0x5e7ce7);}return null;};}function removeEntity(_0xb556b6){return function(_0x17bc13){if(_0x17bc13){return _0x17bc13['destroy']()[_0x5b2d('0x15')](function(){var _0xec209=_0x17bc13[_0x5b2d('0x16')]({'plain':!![]});var _0xa2eb48=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x5b2d('0x17'),'value':_0x5b2d('0x18'),'ignore':![]},{'name':_0x5b2d('0x19'),'value':_0x5b2d('0x1a'),'ignore':![]}];var _0x2c59a0=_(_0xa2eb48)[_0x5b2d('0x1b')]('ignore')[_0x5b2d('0x1c')](_0x5b2d('0x1d'))[_0x5b2d('0x1d')]();if(_['includes'](_0x2c59a0,_0xec209[_0x5b2d('0x1e')])){return;}var _0x4bd8e4=_[_0x5b2d('0x1f')](_0xa2eb48,[_0x5b2d('0x1d'),_0xec209[_0x5b2d('0x1e')]])[_0x5b2d('0x20')];return db[_0x5b2d('0x21')][_0x5b2d('0x22')]({'where':{'type':_0x4bd8e4,'resourceId':_0xec209['id']}})[_0x5b2d('0x15')](function(){return _0x17bc13;});})[_0x5b2d('0x15')](function(){_0xb556b6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dbeb1){return function(_0x5a46d8){if(!_0x5a46d8){_0x3dbeb1[_0x5b2d('0x23')](0x194);}return _0x5a46d8;};}function handleError(_0x57172a,_0x344848){_0x344848=_0x344848||0x1f4;return function(_0xfd9e51){logger[_0x5b2d('0x24')](_0xfd9e51[_0x5b2d('0x25')]);if(_0xfd9e51['name']){delete _0xfd9e51[_0x5b2d('0x20')];}_0x57172a['status'](_0x344848)[_0x5b2d('0x26')](_0xfd9e51);};}exports['index']=function(_0x503043,_0x5ee0b2){var _0x396f80={},_0xaf0a17={},_0x4f9cc9={'count':0x0,'rows':[]};var _0x28e52d=_[_0x5b2d('0x1c')](db[_0x5b2d('0x27')][_0x5b2d('0x28')],function(_0x42a04e){return{'name':_0x42a04e[_0x5b2d('0x29')],'type':_0x42a04e[_0x5b2d('0x1e')][_0x5b2d('0x2a')]};});_0xaf0a17[_0x5b2d('0x2b')]=_[_0x5b2d('0x1c')](_0x28e52d,'name');_0xaf0a17[_0x5b2d('0x2c')]=_[_0x5b2d('0x2d')](_0x503043[_0x5b2d('0x2c')]);_0xaf0a17['filters']=_['intersection'](_0xaf0a17[_0x5b2d('0x2b')],_0xaf0a17[_0x5b2d('0x2c')]);_0x396f80[_0x5b2d('0x2e')]=_[_0x5b2d('0x2f')](_0xaf0a17[_0x5b2d('0x2b')],qs[_0x5b2d('0x30')](_0x503043[_0x5b2d('0x2c')][_0x5b2d('0x30')]));_0x396f80[_0x5b2d('0x2e')]=_0x396f80['attributes'][_0x5b2d('0x31')]?_0x396f80[_0x5b2d('0x2e')]:_0xaf0a17[_0x5b2d('0x2b')];if(!_0x503043[_0x5b2d('0x2c')]['hasOwnProperty'](_0x5b2d('0x32'))){_0x396f80[_0x5b2d('0x12')]=qs[_0x5b2d('0x12')](_0x503043[_0x5b2d('0x2c')][_0x5b2d('0x12')]);_0x396f80[_0x5b2d('0xf')]=qs['offset'](_0x503043[_0x5b2d('0x2c')][_0x5b2d('0xf')]);}_0x396f80[_0x5b2d('0x33')]=qs[_0x5b2d('0x34')](_0x503043[_0x5b2d('0x2c')]['sort']);_0x396f80['where']=qs[_0x5b2d('0x35')](_[_0x5b2d('0x36')](_0x503043['query'],_0xaf0a17['filters']),_0x28e52d);if(_0x503043[_0x5b2d('0x2c')][_0x5b2d('0x1b')]){_0x396f80[_0x5b2d('0x37')]=_[_0x5b2d('0x38')](_0x396f80['where'],{'$or':_[_0x5b2d('0x1c')](_0x28e52d,function(_0x3f4b41){if(_0x3f4b41[_0x5b2d('0x1e')]!==_0x5b2d('0x39')){var _0x20473f={};_0x20473f[_0x3f4b41[_0x5b2d('0x20')]]={'$like':'%'+_0x503043[_0x5b2d('0x2c')]['filter']+'%'};return _0x20473f;}})});}_0x396f80=_['merge']({},_0x396f80,_0x503043[_0x5b2d('0x3a')]);var _0x1d7ccc={'where':_0x396f80['where']};return db[_0x5b2d('0x27')][_0x5b2d('0x11')](_0x1d7ccc)['then'](function(_0x578bb6){_0x4f9cc9[_0x5b2d('0x11')]=_0x578bb6;if(_0x503043['query']['includeAll']){_0x396f80[_0x5b2d('0x3b')]=[{'all':!![]}];}return db['VoiceExtension'][_0x5b2d('0x3c')](_0x396f80);})[_0x5b2d('0x15')](function(_0x1ef120){_0x4f9cc9[_0x5b2d('0x3d')]=_0x1ef120;return _0x4f9cc9;})[_0x5b2d('0x15')](respondWithFilteredResult(_0x5ee0b2,_0x396f80))[_0x5b2d('0x3e')](handleError(_0x5ee0b2,null));};exports[_0x5b2d('0x3f')]=function(_0x3b4e12,_0x2b217b){var _0x537245={'raw':![],'where':{'id':_0x3b4e12[_0x5b2d('0x40')]['id']}},_0x4218e3={};_0x4218e3[_0x5b2d('0x2b')]=_[_0x5b2d('0x2d')](db[_0x5b2d('0x27')][_0x5b2d('0x28')]);_0x4218e3[_0x5b2d('0x2c')]=_[_0x5b2d('0x2d')](_0x3b4e12[_0x5b2d('0x2c')]);_0x4218e3['filters']=_[_0x5b2d('0x2f')](_0x4218e3[_0x5b2d('0x2b')],_0x4218e3[_0x5b2d('0x2c')]);_0x537245[_0x5b2d('0x2e')]=_['intersection'](_0x4218e3[_0x5b2d('0x2b')],qs[_0x5b2d('0x30')](_0x3b4e12[_0x5b2d('0x2c')][_0x5b2d('0x30')]));_0x537245[_0x5b2d('0x2e')]=_0x537245[_0x5b2d('0x2e')][_0x5b2d('0x31')]?_0x537245[_0x5b2d('0x2e')]:_0x4218e3[_0x5b2d('0x2b')];if(_0x3b4e12[_0x5b2d('0x2c')]['includeAll']){_0x537245[_0x5b2d('0x3b')]=[{'all':!![]}];}_0x537245=_[_0x5b2d('0x38')]({},_0x537245,_0x3b4e12[_0x5b2d('0x3a')]);return db[_0x5b2d('0x27')]['find'](_0x537245)['then'](handleEntityNotFound(_0x2b217b,null))['then'](respondWithResult(_0x2b217b,null))[_0x5b2d('0x3e')](handleError(_0x2b217b,null));};exports['destroy']=function(_0x1bab71,_0x59d7a7){return db[_0x5b2d('0x27')][_0x5b2d('0x1f')]({'where':{'id':_0x1bab71['params']['id']}})[_0x5b2d('0x15')](handleEntityNotFound(_0x59d7a7,null))[_0x5b2d('0x15')](removeEntity(_0x59d7a7,null))[_0x5b2d('0x3e')](handleError(_0x59d7a7,null));};exports[_0x5b2d('0x41')]=function(_0x118774,_0x380996){if(_0x118774['body'][_0x5b2d('0x1e')]===_0x5b2d('0x18')&&!_[_0x5b2d('0x42')](_0x118774['body'][_0x5b2d('0x43')],'_')){_0x118774[_0x5b2d('0x44')][_0x5b2d('0x43')]='_'[_0x5b2d('0x45')](_0x118774['body'][_0x5b2d('0x43')]);}return db[_0x5b2d('0x27')][_0x5b2d('0x41')](_0x118774[_0x5b2d('0x44')],{'raw':![]})[_0x5b2d('0x15')](function(_0x3b5056){var _0x63c28b=_0x118774[_0x5b2d('0x46')][_0x5b2d('0x16')]({'plain':!![]});if(!_0x63c28b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x63c28b[_0x5b2d('0x47')]===_0x5b2d('0x46')){var _0x58410c=_0x3b5056[_0x5b2d('0x16')]({'plain':!![]});var _0xde6909=[{'name':_0x5b2d('0x48'),'value':_0x5b2d('0x49')},{'name':_0x5b2d('0x17'),'value':_0x5b2d('0x18')},{'name':_0x5b2d('0x19'),'value':_0x5b2d('0x1a')}];var _0x2081fe=_['find'](_0xde6909,[_0x5b2d('0x1d'),_0x58410c[_0x5b2d('0x1e')]])[_0x5b2d('0x20')];return db[_0x5b2d('0x4a')][_0x5b2d('0x1f')]({'where':{'name':_0x2081fe,'userProfileId':_0x63c28b['userProfileId']},'raw':!![]})[_0x5b2d('0x15')](function(_0x367ec9){if(_0x367ec9&&_0x367ec9[_0x5b2d('0x4b')]===0x0){return db[_0x5b2d('0x21')][_0x5b2d('0x41')]({'name':_0x58410c[_0x5b2d('0x20')],'resourceId':_0x58410c['id'],'type':_0x367ec9[_0x5b2d('0x20')],'sectionId':_0x367ec9['id']},{})[_0x5b2d('0x15')](function(){return _0x3b5056;});}else{return _0x3b5056;}})[_0x5b2d('0x3e')](function(_0x3b84b5){logger[_0x5b2d('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b84b5);throw _0x3b84b5;});}return _0x3b5056;})['then'](respondWithResult(_0x380996,0xc9))[_0x5b2d('0x3e')](handleError(_0x380996,null));};exports[_0x5b2d('0x4c')]=function(_0x513ac9,_0x20f986){if(_0x513ac9['body']['id']){delete _0x513ac9[_0x5b2d('0x44')]['id'];}return db[_0x5b2d('0x27')][_0x5b2d('0x1f')]({'where':{'id':_0x513ac9['params']['id']}})[_0x5b2d('0x15')](handleEntityNotFound(_0x20f986,null))['then'](function(_0x390d6e){if(_0x390d6e){return db['VoiceExtension'][_0x5b2d('0x4c')](_[_0x5b2d('0x36')](_0x513ac9[_0x5b2d('0x44')],[_0x5b2d('0x43'),_0x5b2d('0x4d'),'description',_0x5b2d('0x4e'),'cutdigits',_0x5b2d('0x4f'),_0x5b2d('0x50')]),{'where':{'context':_0x390d6e[_0x5b2d('0x4d')],'exten':_0x390d6e[_0x5b2d('0x43')]},'individualHooks':!![]})[_0x5b2d('0x15')](function(_0x27b863){return _0x27b863;});}return null;})['then'](respondWithStatusCode(_0x20f986,null))['catch'](handleError(_0x20f986,null));};exports['addApplications']=function(_0xf15bf8,_0x45a593){var _0x114727=_0xf15bf8[_0x5b2d('0x40')]['id'];var _0x3aa3f3=_0xf15bf8[_0x5b2d('0x44')];var _0x480b87=0xc8;var _0x2bb8b2=null;return db[_0x5b2d('0x51')][_0x5b2d('0x52')]({'isolationLevel':db[_0x5b2d('0x51')][_0x5b2d('0x53')]['ISOLATION_LEVELS'][_0x5b2d('0x54')]},function(_0x4727c0){return db[_0x5b2d('0x27')]['findOne']({'where':{'id':_0x114727},'transaction':_0x4727c0})[_0x5b2d('0x15')](function(_0xcfd2d4){if(_0xcfd2d4){return db[_0x5b2d('0x27')]['destroy']({'where':{'VoiceExtensionId':_0x114727},'transaction':_0x4727c0})[_0x5b2d('0x15')](function(){var _0x4fcd4f=_['map'](_0x3aa3f3,function(_0x376544){_0x376544[_0x5b2d('0x55')]=_0x114727;_0x376544[_0x5b2d('0x56')]=!![];return _0x376544;});return _0xcfd2d4[_0x5b2d('0x57')](_0x4fcd4f);})[_0x5b2d('0x15')](function(_0x383c01){return db['VoiceExtension'][_0x5b2d('0x58')](_0x383c01,{'transaction':_0x4727c0});});}else{_0x480b87=0x194;_0x2bb8b2=[];}});})[_0x5b2d('0x15')](function(){if(_0x480b87!==0x194){return db[_0x5b2d('0x27')][_0x5b2d('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x114727},'order':_0x5b2d('0x5a')})[_0x5b2d('0x15')](function(_0x548479){_0x2bb8b2=_0x548479;});}})['catch'](function(_0x5177e0){_0x480b87=0x1f4;logger[_0x5b2d('0x24')](_0x5177e0['stack']);if(_0x5177e0['name']){delete _0x5177e0['name'];}_0x2bb8b2=_0x5177e0;})[_0x5b2d('0x5b')](function(){if(_0x2bb8b2===null){_0x45a593['sendStatus'](_0x480b87);}else{if(_0x480b87===0x1f4){_0x45a593['status'](_0x480b87)['send'](_0x2bb8b2);}else{_0x45a593[_0x5b2d('0xc')](_0x480b87)[_0x5b2d('0xe')](_0x2bb8b2);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6a95dbd..5a5c173 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 _0x7248=['hasOwnProperty','hook','setMaxListeners','update','remove','emit'];(function(_0x4bb1b3,_0x446a44){var _0x6b3651=function(_0x1f0a7b){while(--_0x1f0a7b){_0x4bb1b3['push'](_0x4bb1b3['shift']());}};_0x6b3651(++_0x446a44);}(_0x7248,0x164));var _0x8724=function(_0x597bf3,_0x3a2bd8){_0x597bf3=_0x597bf3-0x0;var _0x4db0db=_0x7248[_0x597bf3];return _0x4db0db;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x8724('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8724('0x1'),'afterDestroy':_0x8724('0x2')};function emitEvent(_0x116f19){return function(_0x21fa72,_0xc79176,_0x49dd3e){VoiceExtensionEvents[_0x8724('0x3')](_0x116f19+':'+_0x21fa72['id'],_0x21fa72);VoiceExtensionEvents[_0x8724('0x3')](_0x116f19,_0x21fa72);_0x49dd3e(null);};}for(var e in events){if(events[_0x8724('0x4')](e)){var event=events[e];VoiceExtension[_0x8724('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x5032=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x5032,0x1cd));var _0x2503=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5032[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x2503('0x0'));var VoiceExtension=require(_0x2503('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2503('0x2')](0x0);var events={'afterCreate':_0x2503('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3562da){return function(_0x1ede21,_0xe704c,_0x54b48b){VoiceExtensionEvents[_0x2503('0x4')](_0x3562da+':'+_0x1ede21['id'],_0x1ede21);VoiceExtensionEvents[_0x2503('0x4')](_0x3562da,_0x1ede21);_0x54b48b(null);};}for(var e in events){if(events[_0x2503('0x5')](e)){var event=events[e];VoiceExtension[_0x2503('0x6')](e,emitEvent(event));}}module[_0x2503('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 42838ce..a598097 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 _0xd468=['splice','GotoIfTime',',${EXTEN},','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','catch','define','VoiceExtension','voice_extensions','get','last','Hangup','exports','models','type','Set','CDR(type)=','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','phone','param','prefix','${EXTEN}','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x3f36ed,_0x38124c){var _0x402a89=function(_0x4d8924){while(--_0x4d8924){_0x3f36ed['push'](_0x3f36ed['shift']());}};_0x402a89(++_0x38124c);}(_0xd468,0x1e7));var _0x8d46=function(_0x46d232,_0x5ac7e5){_0x46d232=_0x46d232-0x0;var _0x52da0f=_0xd468[_0x46d232];return _0x52da0f;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x8d46('0x0')]=function(_0x30702c){var _0x5619bb=_0x30702c[_0x8d46('0x1')];function _0x26a02c(_0x532446){var _0x2b380a=0x2;var _0x1aa77b=[{'type':_0x532446[_0x8d46('0x2')],'app':_0x8d46('0x3'),'appdata':_0x8d46('0x4')+_0x532446[_0x8d46('0x2')],'context':_0x532446[_0x8d46('0x5')],'exten':_0x532446[_0x8d46('0x6')],'priority':_0x2b380a++,'VoiceExtensionId':_0x532446['id']}];if(_0x532446[_0x8d46('0x2')]===_0x8d46('0x7')){_0x1aa77b[_0x8d46('0x8')]({'type':'inbound','app':_0x8d46('0x3'),'appdata':_0x8d46('0x9')+_0x532446['id'],'context':_0x532446['context'],'exten':_0x532446[_0x8d46('0x6')],'priority':_0x2b380a++,'VoiceExtensionId':_0x532446['id']});}_0x1aa77b['push']({'type':_0x532446[_0x8d46('0x2')],'app':_0x8d46('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x532446[_0x8d46('0x5')],'exten':_0x532446[_0x8d46('0x6')],'priority':_0x2b380a++,'VoiceExtensionId':_0x532446['id']},{'type':_0x532446[_0x8d46('0x2')],'app':_0x8d46('0x3'),'appdata':_0x8d46('0xa'),'context':_0x532446[_0x8d46('0x5')],'exten':_0x532446[_0x8d46('0x6')],'priority':_0x2b380a++,'VoiceExtensionId':_0x532446['id']},{'type':_0x532446[_0x8d46('0x2')],'app':_0x8d46('0x3'),'appdata':_0x8d46('0xb'),'context':_0x532446[_0x8d46('0x5')],'exten':_0x532446[_0x8d46('0x6')],'priority':_0x2b380a++,'VoiceExtensionId':_0x532446['id']});return _0x1aa77b;}function _0x4e8483(_0xdde72b){var _0x2ca4e4=0x2;var _0x2bfe32=[{'type':_0x8d46('0xc'),'app':'Set','appdata':_0x8d46('0xd'),'context':_0xdde72b['context'],'exten':_0xdde72b['exten'],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':'Set','appdata':_0x8d46('0xe')+(_0xdde72b[_0x8d46('0xf')]?_0x8d46('0x10')+_0xdde72b[_0x8d46('0xf')]+'}':'${EXTEN}'),'context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':_0x8d46('0x9')+_0xdde72b['id'],'context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b['exten'],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x11'),'appdata':_0x8d46('0x12')+(_0x2ca4e4+0x2)+_0x8d46('0x13')+(_0x2ca4e4+0x1)+')','context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':_0xdde72b[_0x8d46('0xf')]?'CDR(prefix)=${EXTEN:0:'+_0xdde72b[_0x8d46('0xf')]+'}':_0x8d46('0x14'),'context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':_0x8d46('0x15'),'context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':_0x8d46('0xa'),'context':_0xdde72b['context'],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':'outbound','app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':'outboundrouteid='+_0xdde72b['id'],'context':_0xdde72b['context'],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']}];if(_0xdde72b[_0x8d46('0x16')](_0x8d46('0x17'))&&_0xdde72b[_0x8d46('0x17')]!==_0x8d46('0x18')){_0x2bfe32['push']({'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xdde72b['context'],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':_0x8d46('0x19')+_0xdde72b[_0x8d46('0x17')]||_0x8d46('0x1a'),'context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']});}return _0x2bfe32;}function _0x4a13b6(_0x4fde7b,_0x2527f7){var _0x4056cc=[{'name':_0x8d46('0x1b'),'param':0x0},{'name':_0x8d46('0x1c'),'param':0x1},{'name':_0x8d46('0x1d'),'param':0x2},{'name':_0x8d46('0x1e'),'param':0x3}];var _0x40d321={};var _0xbd9018=_0x2527f7[_0x8d46('0x1f')](',');var _0x2ddcaf=[];for(var _0x2ce922=0x0;_0x2ce922<_0x4056cc['length'];_0x2ce922++){switch(_0x4056cc[_0x2ce922]['name']){case _0x8d46('0x1b'):_0x40d321[_0x8d46('0x1b')]=_0xbd9018[_0x4056cc[_0x2ce922]['param']][_0x8d46('0x1f')]('/')[0x1];_0x40d321[_0x8d46('0x20')]=_0xbd9018[_0x4056cc[_0x2ce922][_0x8d46('0x21')]][_0x8d46('0x1f')]('/')[0x2];_0x40d321[_0x8d46('0x22')]=_0x40d321['phone']?_0x40d321[_0x8d46('0x20')][_0x8d46('0x1f')]('$')[0x0]:undefined;_0x40d321[_0x8d46('0x20')]=_0x4fde7b[_0x8d46('0xf')]?(_0x40d321[_0x8d46('0x22')]||'')+_0x8d46('0x10')+_0x4fde7b[_0x8d46('0xf')]+'}':(_0x40d321[_0x8d46('0x22')]||'')+_0x8d46('0x23');_0x2ddcaf[_0x4056cc[_0x2ce922]['param']]=[_0x8d46('0x24'),_0x40d321[_0x8d46('0x1b')],_0x40d321[_0x8d46('0x20')]]['join']('/');break;case _0x8d46('0x1d'):_0x40d321['options']=_0xbd9018[_0x4056cc[_0x2ce922][_0x8d46('0x21')]];if(_0x4fde7b[_0x8d46('0x17')]!==_0x8d46('0x18')){if(_0x40d321['options'][_0x8d46('0x25')]('U(xcally-mixmonitor-context)')<0x0){_0x40d321[_0x8d46('0x1d')]+=_0x8d46('0x26');}}else{_0x40d321['options']=_0x40d321[_0x8d46('0x1d')][_0x8d46('0x27')](_0x8d46('0x26'),'');}_0x2ddcaf[_0x4056cc[_0x2ce922][_0x8d46('0x21')]]=_0x40d321[_0x8d46('0x1d')];break;default:_0x2ddcaf[_0x4056cc[_0x2ce922][_0x8d46('0x21')]]=_0xbd9018[_0x4056cc[_0x2ce922]['param']];}}return _0x2ddcaf[_0x8d46('0x28')](',');}function _0x36821e(_0x547adf,_0x576129,_0xce0cb){return new Promise(function(_0x33e489,_0x104786){var _0x26baba=[];if(_['isEmpty'](_0x576129))return _0x33e489(_0x26baba);_0x5619bb[_0x8d46('0x29')][_0x8d46('0x2a')]({'attributes':['id',_0x8d46('0x2b'),_0x8d46('0x2c')],'raw':!![]})[_0x8d46('0x2d')](function(_0x22fc5b){for(var _0x50b6f8=0x0,_0x441a5c=0x0;_0x50b6f8<_0x576129[_0x8d46('0x2e')];_0x50b6f8++,_0x441a5c=0x0){var _0x46cdba=_0x576129[_0x50b6f8];var _0x39ae73=[];var _0x18d7a6=[];delete _0x46cdba['id'];if(_0x46cdba[_0x8d46('0x2b')]!==_0x8d46('0x2f')){_0x46cdba[_0x8d46('0x30')]=[_0x46cdba[_0x8d46('0x2b')]];}else{_0x46cdba['intervals']=_0x46cdba[_0x8d46('0x2c')]?_[_0x8d46('0x31')](_[_0x8d46('0x32')](_0x22fc5b,{'IntervalId':_0x46cdba[_0x8d46('0x2c')]}),'interval'):[];}_0x46cdba[_0x8d46('0x5')]=_0x547adf['context'];_0x46cdba[_0x8d46('0x6')]=_0x547adf['exten'];if(_0x46cdba['type'])_0x46cdba[_0x8d46('0x2')]=_0x46cdba[_0x8d46('0x2')]['toLowerCase']();if(_0x547adf[_0x8d46('0x2')]===_0x8d46('0xc')){if(_0x46cdba[_0x8d46('0x16')](_0x8d46('0x33'))&&_0x46cdba[_0x8d46('0x33')]&&_0x46cdba[_0x8d46('0x33')]!=='--'){_0x39ae73[_0x8d46('0x8')]({'type':_0x46cdba[_0x8d46('0x2')][_0x8d46('0x34')](),'app':'Set','appdata':_0x8d46('0x35')+_0x46cdba['tag'],'context':_0x547adf[_0x8d46('0x5')],'exten':_0x547adf['exten'],'priority':_0x46cdba[_0x8d46('0x30')][_0x8d46('0x2e')]+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});}_0x39ae73[_0x8d46('0x8')]({'type':_0x46cdba[_0x8d46('0x2')][_0x8d46('0x34')](),'app':_0x8d46('0x11'),'appdata':_0x8d46('0x36')+(_0x46cdba[_0x8d46('0x37')]?_0x8d46('0x38')+_0x46cdba['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x547adf['context'],'exten':_0x547adf[_0x8d46('0x6')],'priority':_0x46cdba[_0x8d46('0x30')]['length']+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});}else{if(_0x46cdba[_0x8d46('0x16')](_0x8d46('0x39'))){if([_0x8d46('0x3a'),_0x8d46('0x3b')][_0x8d46('0x3c')](_0x46cdba['app'][_0x8d46('0x34')]())&&_0x46cdba[_0x8d46('0x3d')]!==_0x8d46('0x3e')){if(_0x46cdba[_0x8d46('0x39')]){_0x39ae73['push']({'type':_0x46cdba[_0x8d46('0x2')][_0x8d46('0x34')](),'app':_0x8d46('0x11'),'appdata':_0x8d46('0x3f'),'context':_0x547adf[_0x8d46('0x5')],'exten':_0x547adf[_0x8d46('0x6')],'priority':_0x46cdba['intervals'][_0x8d46('0x2e')]+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});_0x39ae73[_0x8d46('0x8')]({'type':_0x46cdba[_0x8d46('0x2')][_0x8d46('0x34')](),'app':'Set','appdata':_0x8d46('0x40'),'context':_0x547adf[_0x8d46('0x5')],'exten':_0x547adf[_0x8d46('0x6')],'priority':_0x46cdba['intervals']['length']+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});}else{_0x39ae73[_0x8d46('0x8')]({'type':_0x46cdba['type'][_0x8d46('0x34')](),'app':_0x8d46('0x11'),'appdata':_0x8d46('0x41'),'context':_0x547adf['context'],'exten':_0x547adf['exten'],'priority':_0x46cdba[_0x8d46('0x30')][_0x8d46('0x2e')]+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});_0x39ae73['push']({'type':_0x46cdba[_0x8d46('0x2')][_0x8d46('0x34')](),'app':_0x8d46('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x547adf[_0x8d46('0x5')],'exten':_0x547adf[_0x8d46('0x6')],'priority':_0x46cdba['intervals']['length']+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});}}}}for(var _0x34a03d=0x0;_0x34a03d<_0x46cdba[_0x8d46('0x30')]['length'];_0x34a03d++){var _0x550909=_0xce0cb+_0x46cdba['intervals'][_0x8d46('0x2e')];var _0x4f5b44=_0x34a03d===_0x46cdba[_0x8d46('0x30')][_0x8d46('0x2e')]-0x1?_0xce0cb+_0x39ae73['length']+_0x18d7a6[_0x8d46('0x2e')]+0x2:_0xce0cb+_0x34a03d+0x1;_0x39ae73[_0x8d46('0x42')](_0x34a03d,0x0,{'type':_0x547adf[_0x8d46('0x2')],'app':_0x8d46('0x43'),'appdata':_0x46cdba[_0x8d46('0x30')][_0x34a03d]+'?'+_0x547adf['context']+_0x8d46('0x44')+_0x550909+':'+_0x547adf[_0x8d46('0x5')]+_0x8d46('0x44')+_0x4f5b44,'exten':_0x547adf['exten'],'context':_0x547adf[_0x8d46('0x5')],'priority':_0xce0cb+_0x34a03d,'VoiceExtensionId':_0x547adf['id']});}if(_0x46cdba['appType']==='outboundDial'){_0x46cdba['appdata']=_0x4a13b6(_0x547adf,_0x46cdba['appdata']);}if(_0x46cdba[_0x8d46('0x3d')]==='agi'){_0x39ae73[_0x8d46('0x8')]({'type':_0x46cdba['type'][_0x8d46('0x34')](),'app':_0x8d46('0x3'),'appdata':_0x8d46('0x45'),'context':_0x547adf[_0x8d46('0x5')],'exten':_0x547adf['exten'],'priority':_0x46cdba['intervals'][_0x8d46('0x2e')]+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});}_0x46cdba[_0x8d46('0x46')]=_0x39ae73[_0x8d46('0x2e')]?_['last'](_0x39ae73)[_0x8d46('0x46')]+0x1:_0xce0cb;_0x26baba=_[_0x8d46('0x47')](_0x26baba,_0x39ae73,[_0x46cdba],_0x18d7a6);_0xce0cb=_['last'](_0x26baba)[_0x8d46('0x46')]+0x1;}return _0x33e489(_0x26baba);})[_0x8d46('0x48')](function(_0x536cf2){_0x104786(_0x536cf2);});});}return _0x30702c[_0x8d46('0x49')](_0x8d46('0x4a'),attributes,{'tableName':_0x8d46('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5594d6){var _0x1fbffb=this[_0x8d46('0x4c')]({'plain':!![]});var _0xfd20a7=_0x1fbffb[_0x8d46('0x2')]===_0x8d46('0xc')?_0x4e8483(_0x1fbffb):_0x26a02c(_0x1fbffb);return _0x36821e(_0x1fbffb,_0x5594d6,_[_0x8d46('0x4d')](_0xfd20a7)['priority']+0x1)[_0x8d46('0x2d')](function(_0x43862b){var _0x59a2a3=_[_0x8d46('0x47')](_0xfd20a7,_0x43862b);_0x59a2a3[_0x8d46('0x8')]({'type':_0x1fbffb[_0x8d46('0x2')],'app':_0x8d46('0x4e'),'exten':_0x1fbffb[_0x8d46('0x6')],'context':_0x1fbffb[_0x8d46('0x5')],'priority':_[_0x8d46('0x4d')](_0x59a2a3)[_0x8d46('0x46')]+0x1,'VoiceExtensionId':_0x1fbffb['id']});return _0x59a2a3;});}}});}; \ No newline at end of file +var _0x3c86=['inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','options','url','length','name','trunk','split','phone','param','prefix','${EXTEN:','join','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','priority','last','voice_extensions','get','then','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x3c86,0x123));var _0x63c8=function(_0x4425de,_0xf6c0f7){_0x4425de=_0x4425de-0x0;var _0x1b2a60=_0x3c86[_0x4425de];return _0x1b2a60;};'use strict';var _=require(_0x63c8('0x0'));var attributes=require(_0x63c8('0x1'));module[_0x63c8('0x2')]=function(_0x2191ad){var _0x4259d3=_0x2191ad[_0x63c8('0x3')];function _0x344362(_0x496b47){var _0x16f663=0x2;var _0x200ad1=[{'type':_0x496b47[_0x63c8('0x4')],'app':_0x63c8('0x5'),'appdata':_0x63c8('0x6')+_0x496b47[_0x63c8('0x4')],'context':_0x496b47[_0x63c8('0x7')],'exten':_0x496b47[_0x63c8('0x8')],'priority':_0x16f663++,'VoiceExtensionId':_0x496b47['id']}];if(_0x496b47[_0x63c8('0x4')]===_0x63c8('0x9')){_0x200ad1[_0x63c8('0xa')]({'type':_0x63c8('0x9'),'app':_0x63c8('0x5'),'appdata':'CDR(routeid)='+_0x496b47['id'],'context':_0x496b47[_0x63c8('0x7')],'exten':_0x496b47[_0x63c8('0x8')],'priority':_0x16f663++,'VoiceExtensionId':_0x496b47['id']});}_0x200ad1[_0x63c8('0xa')]({'type':_0x496b47['type'],'app':'Set','appdata':_0x63c8('0xb'),'context':_0x496b47['context'],'exten':_0x496b47[_0x63c8('0x8')],'priority':_0x16f663++,'VoiceExtensionId':_0x496b47['id']},{'type':_0x496b47['type'],'app':_0x63c8('0x5'),'appdata':_0x63c8('0xc'),'context':_0x496b47[_0x63c8('0x7')],'exten':_0x496b47[_0x63c8('0x8')],'priority':_0x16f663++,'VoiceExtensionId':_0x496b47['id']},{'type':_0x496b47[_0x63c8('0x4')],'app':_0x63c8('0x5'),'appdata':_0x63c8('0xd'),'context':_0x496b47[_0x63c8('0x7')],'exten':_0x496b47['exten'],'priority':_0x16f663++,'VoiceExtensionId':_0x496b47['id']});return _0x200ad1;}function _0x58f7b2(_0x1200af){var _0x2d72d5=0x2;var _0x5d8126=[{'type':_0x63c8('0xe'),'app':'Set','appdata':_0x63c8('0xf'),'context':_0x1200af['context'],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':'Set','appdata':_0x63c8('0x10')+(_0x1200af[_0x63c8('0x11')]?'${EXTEN:'+_0x1200af[_0x63c8('0x11')]+'}':_0x63c8('0x12')),'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':'Set','appdata':'CDR(routeid)='+_0x1200af['id'],'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':'outbound','app':_0x63c8('0x13'),'appdata':_0x63c8('0x14')+(_0x2d72d5+0x2)+'):Goto('+(_0x2d72d5+0x1)+')','context':_0x1200af['context'],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':_0x63c8('0x5'),'appdata':_0x1200af[_0x63c8('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x1200af[_0x63c8('0x11')]+'}':'CDR(prefix)=noprefix','context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':'outbound','app':_0x63c8('0x5'),'appdata':_0x63c8('0xb'),'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af['exten'],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':'Set','appdata':_0x63c8('0xc'),'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af['exten'],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':_0x63c8('0x5'),'appdata':_0x63c8('0xd'),'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':'Set','appdata':_0x63c8('0x15')+_0x1200af['id'],'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af['exten'],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']}];if(_0x1200af[_0x63c8('0x16')](_0x63c8('0x17'))&&_0x1200af[_0x63c8('0x17')]!==_0x63c8('0x18')){_0x5d8126[_0x63c8('0xa')]({'type':'outbound','app':'Set','appdata':_0x63c8('0x19'),'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':_0x63c8('0x5'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1200af['recordingFormat']||_0x63c8('0x1a'),'context':_0x1200af['context'],'exten':_0x1200af['exten'],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']});}return _0x5d8126;}function _0x5edc68(_0x5ed26f,_0x147261){var _0x2b2744=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0x63c8('0x1b'),'param':0x2},{'name':_0x63c8('0x1c'),'param':0x3}];var _0x4af451={};var _0x40b08b=_0x147261['split'](',');var _0x2b3d2b=[];for(var _0x24a752=0x0;_0x24a752<_0x2b2744[_0x63c8('0x1d')];_0x24a752++){switch(_0x2b2744[_0x24a752][_0x63c8('0x1e')]){case _0x63c8('0x1f'):_0x4af451[_0x63c8('0x1f')]=_0x40b08b[_0x2b2744[_0x24a752]['param']][_0x63c8('0x20')]('/')[0x1];_0x4af451[_0x63c8('0x21')]=_0x40b08b[_0x2b2744[_0x24a752][_0x63c8('0x22')]][_0x63c8('0x20')]('/')[0x2];_0x4af451[_0x63c8('0x23')]=_0x4af451[_0x63c8('0x21')]?_0x4af451['phone'][_0x63c8('0x20')]('$')[0x0]:undefined;_0x4af451[_0x63c8('0x21')]=_0x5ed26f[_0x63c8('0x11')]?(_0x4af451[_0x63c8('0x23')]||'')+_0x63c8('0x24')+_0x5ed26f[_0x63c8('0x11')]+'}':(_0x4af451['prefix']||'')+_0x63c8('0x12');_0x2b3d2b[_0x2b2744[_0x24a752][_0x63c8('0x22')]]=['SIP',_0x4af451['trunk'],_0x4af451['phone']][_0x63c8('0x25')]('/');break;case _0x63c8('0x1b'):_0x4af451[_0x63c8('0x1b')]=_0x40b08b[_0x2b2744[_0x24a752]['param']];if(_0x5ed26f[_0x63c8('0x17')]!==_0x63c8('0x18')){if(_0x4af451['options']['indexOf'](_0x63c8('0x26'))<0x0){_0x4af451[_0x63c8('0x1b')]+=_0x63c8('0x26');}}else{_0x4af451[_0x63c8('0x1b')]=_0x4af451[_0x63c8('0x1b')]['replace'](_0x63c8('0x26'),'');}_0x2b3d2b[_0x2b2744[_0x24a752][_0x63c8('0x22')]]=_0x4af451[_0x63c8('0x1b')];break;default:_0x2b3d2b[_0x2b2744[_0x24a752][_0x63c8('0x22')]]=_0x40b08b[_0x2b2744[_0x24a752][_0x63c8('0x22')]];}}return _0x2b3d2b[_0x63c8('0x25')](',');}function _0x511d81(_0x1a04a7,_0x27aa90,_0x57447b){return new Promise(function(_0x426114,_0x2e770d){var _0x2a5dd7=[];if(_[_0x63c8('0x27')](_0x27aa90))return _0x426114(_0x2a5dd7);_0x4259d3['Interval'][_0x63c8('0x28')]({'attributes':['id',_0x63c8('0x29'),_0x63c8('0x2a')],'raw':!![]})['then'](function(_0x276420){for(var _0x33937e=0x0,_0x2263c9=0x0;_0x33937e<_0x27aa90['length'];_0x33937e++,_0x2263c9=0x0){var _0x21d520=_0x27aa90[_0x33937e];var _0x1d1f86=[];var _0x47ba28=[];delete _0x21d520['id'];if(_0x21d520[_0x63c8('0x29')]!==_0x63c8('0x2b')){_0x21d520[_0x63c8('0x2c')]=[_0x21d520[_0x63c8('0x29')]];}else{_0x21d520[_0x63c8('0x2c')]=_0x21d520[_0x63c8('0x2a')]?_[_0x63c8('0x2d')](_[_0x63c8('0x2e')](_0x276420,{'IntervalId':_0x21d520[_0x63c8('0x2a')]}),_0x63c8('0x29')):[];}_0x21d520[_0x63c8('0x7')]=_0x1a04a7[_0x63c8('0x7')];_0x21d520[_0x63c8('0x8')]=_0x1a04a7[_0x63c8('0x8')];if(_0x21d520[_0x63c8('0x4')])_0x21d520['type']=_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')]();if(_0x1a04a7['type']===_0x63c8('0xe')){if(_0x21d520[_0x63c8('0x16')](_0x63c8('0x30'))&&_0x21d520[_0x63c8('0x30')]&&_0x21d520[_0x63c8('0x30')]!=='--'){_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520['type']['toLowerCase'](),'app':_0x63c8('0x5'),'appdata':_0x63c8('0x31')+_0x21d520[_0x63c8('0x30')],'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7[_0x63c8('0x8')],'priority':_0x21d520[_0x63c8('0x2c')][_0x63c8('0x1d')]+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});}_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')](),'app':_0x63c8('0x13'),'appdata':_0x63c8('0x32')+(_0x21d520['callerID']?_0x63c8('0x33')+_0x21d520[_0x63c8('0x34')]+')':_0x63c8('0x35')),'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7['exten'],'priority':_0x21d520[_0x63c8('0x2c')][_0x63c8('0x1d')]+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});}else{if(_0x21d520[_0x63c8('0x16')]('answer')){if([_0x63c8('0x36'),_0x63c8('0x37')][_0x63c8('0x38')](_0x21d520['app'][_0x63c8('0x2f')]())&&_0x21d520[_0x63c8('0x39')]!==_0x63c8('0x3a')){if(_0x21d520['answer']){_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')](),'app':_0x63c8('0x13'),'appdata':_0x63c8('0x3b'),'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7[_0x63c8('0x8')],'priority':_0x21d520[_0x63c8('0x2c')]['length']+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')](),'app':_0x63c8('0x5'),'appdata':_0x63c8('0x3c'),'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7[_0x63c8('0x8')],'priority':_0x21d520[_0x63c8('0x2c')][_0x63c8('0x1d')]+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});}else{_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')](),'app':'ExecIf','appdata':_0x63c8('0x3d'),'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7['exten'],'priority':_0x21d520['intervals']['length']+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')](),'app':_0x63c8('0x5'),'appdata':_0x63c8('0x3e'),'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7['exten'],'priority':_0x21d520[_0x63c8('0x2c')][_0x63c8('0x1d')]+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});}}}}for(var _0x28faf3=0x0;_0x28faf3<_0x21d520['intervals'][_0x63c8('0x1d')];_0x28faf3++){var _0xfeb76e=_0x57447b+_0x21d520['intervals'][_0x63c8('0x1d')];var _0xbfcdb1=_0x28faf3===_0x21d520[_0x63c8('0x2c')][_0x63c8('0x1d')]-0x1?_0x57447b+_0x1d1f86[_0x63c8('0x1d')]+_0x47ba28[_0x63c8('0x1d')]+0x2:_0x57447b+_0x28faf3+0x1;_0x1d1f86[_0x63c8('0x3f')](_0x28faf3,0x0,{'type':_0x1a04a7[_0x63c8('0x4')],'app':_0x63c8('0x40'),'appdata':_0x21d520['intervals'][_0x28faf3]+'?'+_0x1a04a7[_0x63c8('0x7')]+',${EXTEN},'+_0xfeb76e+':'+_0x1a04a7[_0x63c8('0x7')]+_0x63c8('0x41')+_0xbfcdb1,'exten':_0x1a04a7[_0x63c8('0x8')],'context':_0x1a04a7[_0x63c8('0x7')],'priority':_0x57447b+_0x28faf3,'VoiceExtensionId':_0x1a04a7['id']});}if(_0x21d520[_0x63c8('0x39')]===_0x63c8('0x42')){_0x21d520['appdata']=_0x5edc68(_0x1a04a7,_0x21d520[_0x63c8('0x43')]);}if(_0x21d520[_0x63c8('0x39')]===_0x63c8('0x44')){_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520['type'][_0x63c8('0x2f')](),'app':_0x63c8('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x1a04a7['context'],'exten':_0x1a04a7[_0x63c8('0x8')],'priority':_0x21d520['intervals'][_0x63c8('0x1d')]+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});}_0x21d520[_0x63c8('0x45')]=_0x1d1f86[_0x63c8('0x1d')]?_[_0x63c8('0x46')](_0x1d1f86)[_0x63c8('0x45')]+0x1:_0x57447b;_0x2a5dd7=_['concat'](_0x2a5dd7,_0x1d1f86,[_0x21d520],_0x47ba28);_0x57447b=_[_0x63c8('0x46')](_0x2a5dd7)[_0x63c8('0x45')]+0x1;}return _0x426114(_0x2a5dd7);})['catch'](function(_0x1af083){_0x2e770d(_0x1af083);});});}return _0x2191ad['define']('VoiceExtension',attributes,{'tableName':_0x63c8('0x47'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xbe0ec1){var _0x2919ef=this[_0x63c8('0x48')]({'plain':!![]});var _0x2c9634=_0x2919ef[_0x63c8('0x4')]==='outbound'?_0x58f7b2(_0x2919ef):_0x344362(_0x2919ef);return _0x511d81(_0x2919ef,_0xbe0ec1,_[_0x63c8('0x46')](_0x2c9634)[_0x63c8('0x45')]+0x1)[_0x63c8('0x49')](function(_0x19c4a1){var _0xc5e9ca=_['concat'](_0x2c9634,_0x19c4a1);_0xc5e9ca[_0x63c8('0xa')]({'type':_0x2919ef[_0x63c8('0x4')],'app':_0x63c8('0x4a'),'exten':_0x2919ef['exten'],'context':_0x2919ef[_0x63c8('0x7')],'priority':_[_0x63c8('0x46')](_0xc5e9ca)[_0x63c8('0x45')]+0x1,'VoiceExtensionId':_0x2919ef['id']});return _0xc5e9ca;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index a29170e..7ec720a 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 _0x448a=['request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','findAll','options','raw','where','attributes','limit','include','model','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./voiceExtension.socket','register','then','VoiceExtension,\x20%s,\x20%s'];(function(_0x1b3773,_0x130c57){var _0x3e79db=function(_0x3c3557){while(--_0x3c3557){_0x1b3773['push'](_0x1b3773['shift']());}};_0x3e79db(++_0x130c57);}(_0x448a,0x1ef));var _0xa448=function(_0x1fb1c1,_0x10dbfe){_0x1fb1c1=_0x1fb1c1-0x0;var _0x48ad0b=_0x448a[_0x1fb1c1];return _0x48ad0b;};'use strict';var _=require('lodash');var util=require(_0xa448('0x0'));var moment=require(_0xa448('0x1'));var BPromise=require('bluebird');var rs=require(_0xa448('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa448('0x3'));var logger=require(_0xa448('0x4'))('rpc');var config=require(_0xa448('0x5'));var jayson=require(_0xa448('0x6'));var client=jayson[_0xa448('0x7')][_0xa448('0x8')]({'port':0x232a});config[_0xa448('0x9')]=_[_0xa448('0xa')](config[_0xa448('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa448('0x9')]));require(_0xa448('0xb'))[_0xa448('0xc')](socket);function respondWithRpcPromise(_0x13db02,_0x2e95bf,_0x81f261){return new BPromise(function(_0x1d8a87,_0x54a4c2){return client['request'](_0x13db02,_0x81f261)[_0xa448('0xd')](function(_0x183569){logger['info'](_0xa448('0xe'),_0x2e95bf,_0xa448('0xf'));logger[_0xa448('0x10')](_0xa448('0x11'),_0x2e95bf,_0xa448('0xf'),JSON[_0xa448('0x12')](_0x183569));if(_0x183569[_0xa448('0x13')]){if(_0x183569[_0xa448('0x13')][_0xa448('0x14')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2e95bf,_0x183569[_0xa448('0x13')][_0xa448('0x15')]);return _0x54a4c2(_0x183569[_0xa448('0x13')][_0xa448('0x15')]);}logger[_0xa448('0x13')](_0xa448('0xe'),_0x2e95bf,_0x183569['error']['message']);return _0x1d8a87(_0x183569['error']['message']);}else{logger[_0xa448('0x16')](_0xa448('0xe'),_0x2e95bf,'request\x20sent');_0x1d8a87(_0x183569[_0xa448('0x17')][_0xa448('0x15')]);}})[_0xa448('0x18')](function(_0x38f0ac){logger[_0xa448('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x2e95bf,_0x38f0ac);_0x54a4c2(_0x38f0ac);});});}exports[_0xa448('0x19')]=function(_0x220fd5){var _0x77722=this;return new Promise(function(_0x28a80b,_0x1b6370){return db['VoiceExtension'][_0xa448('0x1a')]({'raw':_0x220fd5[_0xa448('0x1b')]?_0x220fd5[_0xa448('0x1b')][_0xa448('0x1c')]===undefined?!![]:![]:!![],'where':_0x220fd5[_0xa448('0x1b')]?_0x220fd5[_0xa448('0x1b')][_0xa448('0x1d')]||null:null,'attributes':_0x220fd5[_0xa448('0x1b')]?_0x220fd5[_0xa448('0x1b')][_0xa448('0x1e')]||null:null,'limit':_0x220fd5[_0xa448('0x1b')]?_0x220fd5['options'][_0xa448('0x1f')]||null:null,'include':_0x220fd5[_0xa448('0x1b')]?_0x220fd5[_0xa448('0x1b')][_0xa448('0x20')]?_['map'](_0x220fd5[_0xa448('0x1b')][_0xa448('0x20')],function(_0xc1af15){return{'model':db[_0xc1af15[_0xa448('0x21')]],'as':_0xc1af15['as'],'attributes':_0xc1af15['attributes'],'include':_0xc1af15[_0xa448('0x20')]?_['map'](_0xc1af15[_0xa448('0x20')],function(_0x3e6679){return{'model':db[_0x3e6679[_0xa448('0x21')]],'as':_0x3e6679['as'],'attributes':_0x3e6679[_0xa448('0x1e')],'include':_0x3e6679[_0xa448('0x20')]?_['map'](_0x3e6679[_0xa448('0x20')],function(_0x1d1c43){return{'model':db[_0x1d1c43[_0xa448('0x21')]],'as':_0x1d1c43['as'],'attributes':_0x1d1c43[_0xa448('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa448('0xd')](function(_0x2dc4f3){logger[_0xa448('0x16')](_0xa448('0x19'),_0x220fd5);logger[_0xa448('0x10')](_0xa448('0x19'),_0x220fd5,JSON[_0xa448('0x12')](_0x2dc4f3));_0x28a80b(_0x2dc4f3);})[_0xa448('0x18')](function(_0xe0461c){logger[_0xa448('0x13')]('GetVoiceExtension',_0xe0461c[_0xa448('0x15')],_0x220fd5);_0x1b6370(_0x77722[_0xa448('0x13')](0x1f4,_0xe0461c[_0xa448('0x15')]));});});}; \ No newline at end of file +var _0x158f=['request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register'];(function(_0x27e0ad,_0xd9977d){var _0x4dd2a0=function(_0x40b6c0){while(--_0x40b6c0){_0x27e0ad['push'](_0x27e0ad['shift']());}};_0x4dd2a0(++_0xd9977d);}(_0x158f,0x137));var _0xf158=function(_0x3d09b0,_0x466d6a){_0x3d09b0=_0x3d09b0-0x0;var _0x95e533=_0x158f[_0x3d09b0];return _0x95e533;};'use strict';var _=require('lodash');var util=require(_0xf158('0x0'));var moment=require(_0xf158('0x1'));var BPromise=require(_0xf158('0x2'));var rs=require(_0xf158('0x3'));var fs=require('fs');var Redis=require(_0xf158('0x4'));var db=require(_0xf158('0x5'))['db'];var utils=require(_0xf158('0x6'));var logger=require('../../config/logger')(_0xf158('0x7'));var config=require('../../config/environment');var jayson=require(_0xf158('0x8'));var client=jayson[_0xf158('0x9')][_0xf158('0xa')]({'port':0x232a});config[_0xf158('0xb')]=_[_0xf158('0xc')](config[_0xf158('0xb')],{'host':_0xf158('0xd'),'port':0x18eb});var socket=require(_0xf158('0xe'))(new Redis(config[_0xf158('0xb')]));require(_0xf158('0xf'))[_0xf158('0x10')](socket);function respondWithRpcPromise(_0x1482d6,_0x5c232c,_0x151786){return new BPromise(function(_0x421b24,_0xda1214){return client[_0xf158('0x11')](_0x1482d6,_0x151786)['then'](function(_0x2fb3cd){logger[_0xf158('0x12')](_0xf158('0x13'),_0x5c232c,_0xf158('0x14'));logger[_0xf158('0x15')](_0xf158('0x16'),_0x5c232c,_0xf158('0x14'),JSON['stringify'](_0x2fb3cd));if(_0x2fb3cd[_0xf158('0x17')]){if(_0x2fb3cd['error'][_0xf158('0x18')]===0x1f4){logger[_0xf158('0x17')](_0xf158('0x13'),_0x5c232c,_0x2fb3cd[_0xf158('0x17')][_0xf158('0x19')]);return _0xda1214(_0x2fb3cd['error'][_0xf158('0x19')]);}logger[_0xf158('0x17')](_0xf158('0x13'),_0x5c232c,_0x2fb3cd['error'][_0xf158('0x19')]);return _0x421b24(_0x2fb3cd[_0xf158('0x17')]['message']);}else{logger['info'](_0xf158('0x13'),_0x5c232c,_0xf158('0x14'));_0x421b24(_0x2fb3cd[_0xf158('0x1a')]['message']);}})[_0xf158('0x1b')](function(_0x4d2a1d){logger['error'](_0xf158('0x13'),_0x5c232c,_0x4d2a1d);_0xda1214(_0x4d2a1d);});});}exports[_0xf158('0x1c')]=function(_0x499841){var _0xe22c06=this;return new Promise(function(_0x4edaee,_0xbf88c9){return db[_0xf158('0x1d')][_0xf158('0x1e')]({'raw':_0x499841[_0xf158('0x1f')]?_0x499841[_0xf158('0x1f')][_0xf158('0x20')]===undefined?!![]:![]:!![],'where':_0x499841[_0xf158('0x1f')]?_0x499841[_0xf158('0x1f')][_0xf158('0x21')]||null:null,'attributes':_0x499841[_0xf158('0x1f')]?_0x499841[_0xf158('0x1f')][_0xf158('0x22')]||null:null,'limit':_0x499841[_0xf158('0x1f')]?_0x499841[_0xf158('0x1f')][_0xf158('0x23')]||null:null,'include':_0x499841[_0xf158('0x1f')]?_0x499841['options'][_0xf158('0x24')]?_['map'](_0x499841['options'][_0xf158('0x24')],function(_0xebaaa3){return{'model':db[_0xebaaa3['model']],'as':_0xebaaa3['as'],'attributes':_0xebaaa3[_0xf158('0x22')],'include':_0xebaaa3[_0xf158('0x24')]?_[_0xf158('0x25')](_0xebaaa3[_0xf158('0x24')],function(_0x438bb4){return{'model':db[_0x438bb4[_0xf158('0x26')]],'as':_0x438bb4['as'],'attributes':_0x438bb4[_0xf158('0x22')],'include':_0x438bb4['include']?_[_0xf158('0x25')](_0x438bb4[_0xf158('0x24')],function(_0x4aa0a0){return{'model':db[_0x4aa0a0[_0xf158('0x26')]],'as':_0x4aa0a0['as'],'attributes':_0x4aa0a0[_0xf158('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf158('0x27')](function(_0x4d860c){logger[_0xf158('0x12')](_0xf158('0x1c'),_0x499841);logger[_0xf158('0x15')](_0xf158('0x1c'),_0x499841,JSON[_0xf158('0x28')](_0x4d860c));_0x4edaee(_0x4d860c);})['catch'](function(_0x25ba0e){logger[_0xf158('0x17')](_0xf158('0x1c'),_0x25ba0e[_0xf158('0x19')],_0x499841);_0xbf88c9(_0xe22c06['error'](0x1f4,_0x25ba0e[_0xf158('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 3c6264c..04ec1ff 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 _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x5081a3,_0xe5ad13){var _0x3989fa=function(_0x1b8dc9){while(--_0x1b8dc9){_0x5081a3['push'](_0x5081a3['shift']());}};_0x3989fa(++_0xe5ad13);}(_0xabce,0x103));var _0xeabc=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xabce[_0x1d9aa0];return _0x226868;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x814b,0x1a2));var _0xb814=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0x814b[_0x2850c0];return _0x21e830;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index ecdb3d1..e568487 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11e5=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','/:id/messages','getMessages','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x169a64,_0x5321d1){var _0x31dab5=function(_0x54f08f){while(--_0x54f08f){_0x169a64['push'](_0x169a64['shift']());}};_0x31dab5(++_0x5321d1);}(_0x11e5,0x8b));var _0x511e=function(_0x215797,_0x49d505){_0x215797=_0x215797-0x0;var _0x4a3697=_0x11e5[_0x215797];return _0x4a3697;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')]('/',auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0xf')](_0x511e('0x10'),auth[_0x511e('0x7')](),controller['update']);router[_0x511e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x511e('0x12')]);module[_0x511e('0x13')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/messages','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get'];(function(_0x5a0d9f,_0x3509db){var _0x277ad4=function(_0x5ddb61){while(--_0x5ddb61){_0x5a0d9f['push'](_0x5a0d9f['shift']());}};_0x277ad4(++_0x3509db);}(_0x1261,0x144));var _0x1126=function(_0x4bae1a,_0x5b0916){_0x4bae1a=_0x4bae1a-0x0;var _0x27f6d2=_0x1261[_0x4bae1a];return _0x27f6d2;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['getMessages']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 7328633..3b9899f 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 _0xdfc9=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize'];(function(_0x4fc913,_0x2f0c5f){var _0x378efe=function(_0x2fbc1a){while(--_0x2fbc1a){_0x4fc913['push'](_0x4fc913['shift']());}};_0x378efe(++_0x2f0c5f);}(_0xdfc9,0x1db));var _0x9dfc=function(_0x3d85be,_0x53c96c){_0x3d85be=_0x3d85be-0x0;var _0x41242c=_0xdfc9[_0x3d85be];return _0x41242c;};'use strict';var Sequelize=require(_0x9dfc('0x0'));module[_0x9dfc('0x1')]={'customer_id':{'type':Sequelize[_0x9dfc('0x2')]},'context':{'type':Sequelize[_0x9dfc('0x2')],'defaultValue':_0x9dfc('0x3'),'unique':_0x9dfc('0x4')},'mailbox':{'type':Sequelize[_0x9dfc('0x2')],'defaultValue':'','allowNull':![],'unique':_0x9dfc('0x4')},'password':{'type':Sequelize[_0x9dfc('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9dfc('0x2')],'validate':{'isEmail':!![]},'set':function(_0x450418){this[_0x9dfc('0x5')](_0x9dfc('0x6'),typeof _0x450418==='string'&&_0x450418[_0x9dfc('0x7')]()?_0x450418['trim']():null);}},'pager':{'type':Sequelize[_0x9dfc('0x2')]},'tz':{'type':Sequelize[_0x9dfc('0x2')],'defaultValue':_0x9dfc('0x8')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':_0x9dfc('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9dfc('0x2')]},'callback':{'type':Sequelize[_0x9dfc('0x2')]},'review':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9dfc('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9dfc('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':_0x9dfc('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':_0x9dfc('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x9dfc('0x2')]},'emailbody':{'type':Sequelize[_0x9dfc('0x2')]},'maxsecs':{'type':Sequelize[_0x9dfc('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9dfc('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9dfc('0xc')],'get':function(){return this[_0x9dfc('0xd')](_0x9dfc('0xe'))+_0x9dfc('0xf')+this[_0x9dfc('0xd')](_0x9dfc('0x10'));}}}; \ No newline at end of file +var _0x0a6c=['TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','string','central','ENUM','yes','TINYINT(4)'];(function(_0x31a16a,_0x1d60e3){var _0x21c892=function(_0x5b25f6){while(--_0x5b25f6){_0x31a16a['push'](_0x31a16a['shift']());}};_0x21c892(++_0x1d60e3);}(_0x0a6c,0x17d));var _0xc0a6=function(_0x161872,_0x2d84b2){_0x161872=_0x161872-0x0;var _0x6473df=_0x0a6c[_0x161872];return _0x6473df;};'use strict';var Sequelize=require(_0xc0a6('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc0a6('0x1')],'defaultValue':_0xc0a6('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xc0a6('0x1')],'defaultValue':'','allowNull':![],'unique':_0xc0a6('0x3')},'password':{'type':Sequelize[_0xc0a6('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc0a6('0x1')],'validate':{'isEmail':!![]},'set':function(_0x165f53){this['setDataValue'](_0xc0a6('0x4'),typeof _0x165f53===_0xc0a6('0x5')&&_0x165f53['trim']()?_0x165f53['trim']():null);}},'pager':{'type':Sequelize[_0xc0a6('0x1')]},'tz':{'type':Sequelize[_0xc0a6('0x1')],'defaultValue':_0xc0a6('0x6')},'attach':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':_0xc0a6('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':_0xc0a6('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xc0a6('0x1')]},'review':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc0a6('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':_0xc0a6('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xc0a6('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xc0a6('0xa')},'emailsubject':{'type':Sequelize[_0xc0a6('0x1')]},'emailbody':{'type':Sequelize[_0xc0a6('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc0a6('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc0a6('0xc')],'get':function(){return this['getDataValue'](_0xc0a6('0xd'))+_0xc0a6('0xe')+this[_0xc0a6('0xf')](_0xc0a6('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 5534070..030410f 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 _0xe605=['count','set','Content-Range','apply','save','update','then','destroy','Voicemails','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMail','findAll','rows','show','params','intersection','find','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x181613,_0x43258d){var _0x314e4e=function(_0x35d78e){while(--_0x35d78e){_0x181613['push'](_0x181613['shift']());}};_0x314e4e(++_0x43258d);}(_0xe605,0x92));var _0x5e60=function(_0x1819c9,_0x3614d3){_0x1819c9=_0x1819c9-0x0;var _0x1d407c=_0xe605[_0x1819c9];return _0x1d407c;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){var _0x19f37b=_0x5d2c03['get']({'plain':!![]});var _0x45cb62=_0x5e60('0x28');return db[_0x5e60('0x29')][_0x5e60('0x27')]({'where':{'type':_0x45cb62,'resourceId':_0x19f37b['id']}})['then'](function(){return _0x5d2c03;});})[_0x5e60('0x26')](function(){_0x2a499e['status'](0xcc)[_0x5e60('0x1b')]();});}};}function handleEntityNotFound(_0x221322,_0x4ba727){return function(_0x46691f){if(!_0x46691f){_0x221322[_0x5e60('0x19')](0x194);}return _0x46691f;};}function handleError(_0x5b1b46,_0x1ee931){_0x1ee931=_0x1ee931||0x1f4;return function(_0xac9c7a){logger['error'](_0xac9c7a['stack']);if(_0xac9c7a['name']){delete _0xac9c7a[_0x5e60('0x2a')];}_0x5b1b46[_0x5e60('0x1a')](_0x1ee931)[_0x5e60('0x2b')](_0xac9c7a);};}exports[_0x5e60('0x2c')]=function(_0x3ccfee,_0x558197){var _0x168ce6={},_0x405461={},_0x4d4b55={'count':0x0,'rows':[]};var _0x11fc87=_['map'](db['VoiceMail'][_0x5e60('0x2d')],function(_0x3c4340){return{'name':_0x3c4340[_0x5e60('0x2e')],'type':_0x3c4340[_0x5e60('0x2f')][_0x5e60('0x30')]};});_0x405461[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x11fc87,_0x5e60('0x2a'));_0x405461[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x3ccfee['query']);_0x405461[_0x5e60('0x35')]=_['intersection'](_0x405461['model'],_0x405461[_0x5e60('0x33')]);_0x168ce6[_0x5e60('0x36')]=_['intersection'](_0x405461[_0x5e60('0x31')],qs['fields'](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x37')]));_0x168ce6[_0x5e60('0x36')]=_0x168ce6[_0x5e60('0x36')][_0x5e60('0x38')]?_0x168ce6[_0x5e60('0x36')]:_0x405461[_0x5e60('0x31')];if(!_0x3ccfee[_0x5e60('0x33')]['hasOwnProperty'](_0x5e60('0x39'))){_0x168ce6[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x168ce6[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x3ccfee['query'][_0x5e60('0x1d')]);}_0x168ce6[_0x5e60('0x3a')]=qs['sort'](_0x3ccfee['query'][_0x5e60('0x3b')]);_0x168ce6[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x3ccfee[_0x5e60('0x33')],_0x405461['filters']),_0x11fc87);if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x168ce6[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x168ce6[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x32')](_0x11fc87,function(_0x2b635a){if(_0x2b635a['type']!==_0x5e60('0x40')){var _0x1f95b2={};_0x1f95b2[_0x2b635a['name']]={'$like':'%'+_0x3ccfee['query']['filter']+'%'};return _0x1f95b2;}})});}_0x168ce6=_[_0x5e60('0x3f')]({},_0x168ce6,_0x3ccfee[_0x5e60('0x41')]);var _0x2c6d5b={'where':_0x168ce6[_0x5e60('0x3c')]};return db['VoiceMail'][_0x5e60('0x20')](_0x2c6d5b)[_0x5e60('0x26')](function(_0x4b6192){_0x4d4b55['count']=_0x4b6192;if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x42')]){_0x168ce6[_0x5e60('0x43')]=[{'all':!![]}];}return db[_0x5e60('0x44')][_0x5e60('0x45')](_0x168ce6);})[_0x5e60('0x26')](function(_0x2522d2){_0x4d4b55[_0x5e60('0x46')]=_0x2522d2;return _0x4d4b55;})[_0x5e60('0x26')](respondWithFilteredResult(_0x558197,_0x168ce6))['catch'](handleError(_0x558197,null));};exports[_0x5e60('0x47')]=function(_0x2bb154,_0x59a2eb){var _0x1b1567={'raw':!![],'where':{'id':_0x2bb154[_0x5e60('0x48')]['id']}},_0x4aac07={};_0x4aac07[_0x5e60('0x31')]=_[_0x5e60('0x34')](db['VoiceMail'][_0x5e60('0x2d')]);_0x4aac07[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2bb154[_0x5e60('0x33')]);_0x4aac07['filters']=_['intersection'](_0x4aac07['model'],_0x4aac07[_0x5e60('0x33')]);_0x1b1567[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x4aac07[_0x5e60('0x31')],qs[_0x5e60('0x37')](_0x2bb154[_0x5e60('0x33')]['fields']));_0x1b1567[_0x5e60('0x36')]=_0x1b1567[_0x5e60('0x36')][_0x5e60('0x38')]?_0x1b1567[_0x5e60('0x36')]:_0x4aac07[_0x5e60('0x31')];if(_0x2bb154[_0x5e60('0x33')][_0x5e60('0x42')]){_0x1b1567['include']=[{'all':!![]}];}_0x1b1567=_[_0x5e60('0x3f')]({},_0x1b1567,_0x2bb154[_0x5e60('0x41')]);return db[_0x5e60('0x44')][_0x5e60('0x4a')](_0x1b1567)[_0x5e60('0x26')](handleEntityNotFound(_0x59a2eb,null))[_0x5e60('0x26')](respondWithResult(_0x59a2eb,null))[_0x5e60('0x4b')](handleError(_0x59a2eb,null));};exports[_0x5e60('0x4c')]=function(_0x1518bd,_0x350d6d){return db[_0x5e60('0x44')][_0x5e60('0x4c')](_0x1518bd[_0x5e60('0x4d')],{})[_0x5e60('0x26')](function(_0x1aa381){var _0x176ef3=_0x1518bd[_0x5e60('0x4e')][_0x5e60('0x4f')]({'plain':!![]});if(!_0x176ef3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x176ef3['role']===_0x5e60('0x4e')){var _0x4d3588=_0x1aa381[_0x5e60('0x4f')]({'plain':!![]});var _0x1d247e=_0x5e60('0x28');return db[_0x5e60('0x50')][_0x5e60('0x4a')]({'where':{'name':_0x1d247e,'userProfileId':_0x176ef3[_0x5e60('0x51')]},'raw':!![]})['then'](function(_0x48bea6){if(_0x48bea6&&_0x48bea6[_0x5e60('0x52')]===0x0){return db[_0x5e60('0x29')][_0x5e60('0x4c')]({'name':_0x4d3588['name'],'resourceId':_0x4d3588['id'],'type':_0x48bea6['name'],'sectionId':_0x48bea6['id']},{})[_0x5e60('0x26')](function(){return _0x1aa381;});}else{return _0x1aa381;}})[_0x5e60('0x4b')](function(_0x179cc6){logger['error'](_0x5e60('0x53'),_0x179cc6);throw _0x179cc6;});}return _0x1aa381;})[_0x5e60('0x26')](respondWithResult(_0x350d6d,0xc9))[_0x5e60('0x4b')](handleError(_0x350d6d,null));};exports[_0x5e60('0x25')]=function(_0x17d002,_0x148204){if(_0x17d002['body']['id']){delete _0x17d002[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x44')]['find']({'where':{'id':_0x17d002[_0x5e60('0x48')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x148204,null))[_0x5e60('0x26')](saveUpdates(_0x17d002['body'],null))[_0x5e60('0x26')](respondWithResult(_0x148204,null))[_0x5e60('0x4b')](handleError(_0x148204,null));};exports['destroy']=function(_0x26e129,_0x367208){return db[_0x5e60('0x44')][_0x5e60('0x4a')]({'where':{'id':_0x26e129['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x367208,null))[_0x5e60('0x26')](removeEntity(_0x367208,null))['catch'](handleError(_0x367208,null));};exports[_0x5e60('0x54')]=function(_0x4cb322,_0x8d00b9,_0x5220fc){return db[_0x5e60('0x44')][_0x5e60('0x55')]({'where':{'id':_0x4cb322['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x8d00b9,null))['then'](function(_0x1a2094){var _0x566fc7;var _0x157787={},_0x5b4daa={};_0x5b4daa[_0x5e60('0x31')]=_[_0x5e60('0x34')](db[_0x5e60('0x56')][_0x5e60('0x2d')]);_0x5b4daa[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x4cb322[_0x5e60('0x33')]);_0x5b4daa['filters']=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],_0x5b4daa[_0x5e60('0x33')]);_0x157787[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],qs['fields'](_0x4cb322['query']['fields']));_0x157787[_0x5e60('0x36')]=_0x157787[_0x5e60('0x36')]['length']?_0x157787[_0x5e60('0x36')]:_0x5b4daa[_0x5e60('0x31')];if(!_0x4cb322['query'][_0x5e60('0x57')](_0x5e60('0x39'))){_0x157787[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x157787[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1d')]);}_0x157787[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3b')]);_0x157787[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x4cb322['query'],_0x5b4daa[_0x5e60('0x35')]));if(_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x157787['where']=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'$or':_['map'](_0x157787[_0x5e60('0x36')],function(_0x6f4d2f){var _0x5bbaaf={};_0x5bbaaf[_0x6f4d2f]={'$like':'%'+_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]+'%'};return _0x5bbaaf;})});}_0x157787[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'mailboxuser':_0x1a2094[_0x5e60('0x58')]});_0x157787=_[_0x5e60('0x3f')]({},_0x157787,_0x4cb322[_0x5e60('0x41')]);return db[_0x5e60('0x56')]['findAndCountAll'](_0x157787)[_0x5e60('0x26')](respondWithFilteredResult(_0x8d00b9,_0x157787));})[_0x5e60('0x4b')](handleError(_0x8d00b9,null));}; \ No newline at end of file +var _0x282b=['json','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','end','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','VoiceMail','includeAll','include','findAll','catch','show','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','getMessages','findOne','VoiceMailMessage','pick','mailbox','findAndCountAll','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','sendStatus','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x282b,0xec));var _0xb282=function(_0x5c2d1b,_0x1bd47d){_0x5c2d1b=_0x5c2d1b-0x0;var _0x1a7d56=_0x282b[_0x5c2d1b];return _0x1a7d56;};'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'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){var _0x5e828e=_0x360f15[_0xb282('0x25')]({'plain':!![]});var _0x114f77=_0xb282('0x26');return db[_0xb282('0x27')][_0xb282('0x24')]({'where':{'type':_0x114f77,'resourceId':_0x5e828e['id']}})[_0xb282('0x23')](function(){return _0x360f15;});})['then'](function(){_0x56645f[_0xb282('0x18')](0xcc)[_0xb282('0x28')]();});}};}function handleEntityNotFound(_0x50bd73,_0x22d895){return function(_0x38a1f8){if(!_0x38a1f8){_0x50bd73[_0xb282('0x17')](0x194);}return _0x38a1f8;};}function handleError(_0x280940,_0x59644e){_0x59644e=_0x59644e||0x1f4;return function(_0x1520b1){logger[_0xb282('0x29')](_0x1520b1[_0xb282('0x2a')]);if(_0x1520b1[_0xb282('0x2b')]){delete _0x1520b1[_0xb282('0x2b')];}_0x280940[_0xb282('0x18')](_0x59644e)[_0xb282('0x2c')](_0x1520b1);};}exports['index']=function(_0x1b15b5,_0x1e2861){var _0x3eb294={},_0xd8780b={},_0x42ef75={'count':0x0,'rows':[]};var _0x5f3ddf=_[_0xb282('0x2d')](db['VoiceMail'][_0xb282('0x2e')],function(_0x1bf721){return{'name':_0x1bf721[_0xb282('0x2f')],'type':_0x1bf721['type'][_0xb282('0x30')]};});_0xd8780b['model']=_[_0xb282('0x2d')](_0x5f3ddf,_0xb282('0x2b'));_0xd8780b[_0xb282('0x31')]=_[_0xb282('0x32')](_0x1b15b5[_0xb282('0x31')]);_0xd8780b[_0xb282('0x33')]=_['intersection'](_0xd8780b[_0xb282('0x34')],_0xd8780b[_0xb282('0x31')]);_0x3eb294['attributes']=_['intersection'](_0xd8780b[_0xb282('0x34')],qs[_0xb282('0x35')](_0x1b15b5[_0xb282('0x31')]['fields']));_0x3eb294['attributes']=_0x3eb294['attributes'][_0xb282('0x36')]?_0x3eb294[_0xb282('0x37')]:_0xd8780b[_0xb282('0x34')];if(!_0x1b15b5[_0xb282('0x31')][_0xb282('0x38')](_0xb282('0x39'))){_0x3eb294[_0xb282('0x1b')]=qs['limit'](_0x1b15b5[_0xb282('0x31')]['limit']);_0x3eb294[_0xb282('0x19')]=qs[_0xb282('0x19')](_0x1b15b5[_0xb282('0x31')]['offset']);}_0x3eb294[_0xb282('0x3a')]=qs['sort'](_0x1b15b5[_0xb282('0x31')][_0xb282('0x3b')]);_0x3eb294[_0xb282('0x3c')]=qs[_0xb282('0x33')](_['pick'](_0x1b15b5['query'],_0xd8780b[_0xb282('0x33')]),_0x5f3ddf);if(_0x1b15b5[_0xb282('0x31')][_0xb282('0x3d')]){_0x3eb294[_0xb282('0x3c')]=_['merge'](_0x3eb294[_0xb282('0x3c')],{'$or':_['map'](_0x5f3ddf,function(_0x475895){if(_0x475895[_0xb282('0x3e')]!=='VIRTUAL'){var _0x41f2c4={};_0x41f2c4[_0x475895[_0xb282('0x2b')]]={'$like':'%'+_0x1b15b5[_0xb282('0x31')][_0xb282('0x3d')]+'%'};return _0x41f2c4;}})});}_0x3eb294=_[_0xb282('0x3f')]({},_0x3eb294,_0x1b15b5[_0xb282('0x40')]);var _0x43e87e={'where':_0x3eb294[_0xb282('0x3c')]};return db[_0xb282('0x41')][_0xb282('0x1c')](_0x43e87e)[_0xb282('0x23')](function(_0x91fe43){_0x42ef75[_0xb282('0x1c')]=_0x91fe43;if(_0x1b15b5[_0xb282('0x31')][_0xb282('0x42')]){_0x3eb294[_0xb282('0x43')]=[{'all':!![]}];}return db[_0xb282('0x41')][_0xb282('0x44')](_0x3eb294);})['then'](function(_0x310ad1){_0x42ef75['rows']=_0x310ad1;return _0x42ef75;})[_0xb282('0x23')](respondWithFilteredResult(_0x1e2861,_0x3eb294))[_0xb282('0x45')](handleError(_0x1e2861,null));};exports[_0xb282('0x46')]=function(_0x2f2ce8,_0x197472){var _0x3ddf56={'raw':!![],'where':{'id':_0x2f2ce8['params']['id']}},_0x5a6c0d={};_0x5a6c0d[_0xb282('0x34')]=_['keys'](db[_0xb282('0x41')][_0xb282('0x2e')]);_0x5a6c0d['query']=_[_0xb282('0x32')](_0x2f2ce8[_0xb282('0x31')]);_0x5a6c0d[_0xb282('0x33')]=_['intersection'](_0x5a6c0d['model'],_0x5a6c0d[_0xb282('0x31')]);_0x3ddf56['attributes']=_[_0xb282('0x47')](_0x5a6c0d[_0xb282('0x34')],qs[_0xb282('0x35')](_0x2f2ce8[_0xb282('0x31')][_0xb282('0x35')]));_0x3ddf56[_0xb282('0x37')]=_0x3ddf56['attributes'][_0xb282('0x36')]?_0x3ddf56[_0xb282('0x37')]:_0x5a6c0d[_0xb282('0x34')];if(_0x2f2ce8['query'][_0xb282('0x42')]){_0x3ddf56['include']=[{'all':!![]}];}_0x3ddf56=_[_0xb282('0x3f')]({},_0x3ddf56,_0x2f2ce8['options']);return db[_0xb282('0x41')]['find'](_0x3ddf56)['then'](handleEntityNotFound(_0x197472,null))['then'](respondWithResult(_0x197472,null))[_0xb282('0x45')](handleError(_0x197472,null));};exports[_0xb282('0x48')]=function(_0x42d99f,_0x7a5aa4){return db['VoiceMail']['create'](_0x42d99f['body'],{})[_0xb282('0x23')](function(_0x255ad5){var _0x3bed8d=_0x42d99f[_0xb282('0x49')]['get']({'plain':!![]});if(!_0x3bed8d)throw new Error(_0xb282('0x4a'));if(_0x3bed8d[_0xb282('0x4b')]==='user'){var _0x33bded=_0x255ad5[_0xb282('0x25')]({'plain':!![]});var _0x16f66b=_0xb282('0x26');return db[_0xb282('0x4c')]['find']({'where':{'name':_0x16f66b,'userProfileId':_0x3bed8d[_0xb282('0x4d')]},'raw':!![]})[_0xb282('0x23')](function(_0x465209){if(_0x465209&&_0x465209[_0xb282('0x4e')]===0x0){return db[_0xb282('0x27')][_0xb282('0x48')]({'name':_0x33bded['name'],'resourceId':_0x33bded['id'],'type':_0x465209[_0xb282('0x2b')],'sectionId':_0x465209['id']},{})['then'](function(){return _0x255ad5;});}else{return _0x255ad5;}})[_0xb282('0x45')](function(_0x1e6ade){logger['error'](_0xb282('0x4f'),_0x1e6ade);throw _0x1e6ade;});}return _0x255ad5;})[_0xb282('0x23')](respondWithResult(_0x7a5aa4,0xc9))[_0xb282('0x45')](handleError(_0x7a5aa4,null));};exports['update']=function(_0x51cbb0,_0x1028b9){if(_0x51cbb0[_0xb282('0x50')]['id']){delete _0x51cbb0[_0xb282('0x50')]['id'];}return db['VoiceMail'][_0xb282('0x51')]({'where':{'id':_0x51cbb0['params']['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x1028b9,null))[_0xb282('0x23')](saveUpdates(_0x51cbb0['body'],null))[_0xb282('0x23')](respondWithResult(_0x1028b9,null))['catch'](handleError(_0x1028b9,null));};exports[_0xb282('0x24')]=function(_0x34b31a,_0x2e6eaa){return db[_0xb282('0x41')][_0xb282('0x51')]({'where':{'id':_0x34b31a[_0xb282('0x52')]['id']}})['then'](handleEntityNotFound(_0x2e6eaa,null))[_0xb282('0x23')](removeEntity(_0x2e6eaa,null))['catch'](handleError(_0x2e6eaa,null));};exports[_0xb282('0x53')]=function(_0x34baf2,_0x53d50a,_0x597793){return db[_0xb282('0x41')][_0xb282('0x54')]({'where':{'id':_0x34baf2[_0xb282('0x52')]['id']}})['then'](handleEntityNotFound(_0x53d50a,null))['then'](function(_0x40ae87){var _0x2dbbc4;var _0x3716b0={},_0x5d6a78={};_0x5d6a78[_0xb282('0x34')]=_['keys'](db[_0xb282('0x55')][_0xb282('0x2e')]);_0x5d6a78[_0xb282('0x31')]=_[_0xb282('0x32')](_0x34baf2[_0xb282('0x31')]);_0x5d6a78[_0xb282('0x33')]=_[_0xb282('0x47')](_0x5d6a78['model'],_0x5d6a78[_0xb282('0x31')]);_0x3716b0[_0xb282('0x37')]=_[_0xb282('0x47')](_0x5d6a78['model'],qs['fields'](_0x34baf2[_0xb282('0x31')][_0xb282('0x35')]));_0x3716b0[_0xb282('0x37')]=_0x3716b0['attributes']['length']?_0x3716b0[_0xb282('0x37')]:_0x5d6a78[_0xb282('0x34')];if(!_0x34baf2['query'][_0xb282('0x38')](_0xb282('0x39'))){_0x3716b0[_0xb282('0x1b')]=qs['limit'](_0x34baf2[_0xb282('0x31')][_0xb282('0x1b')]);_0x3716b0['offset']=qs[_0xb282('0x19')](_0x34baf2[_0xb282('0x31')][_0xb282('0x19')]);}_0x3716b0[_0xb282('0x3a')]=qs['sort'](_0x34baf2['query'][_0xb282('0x3b')]);_0x3716b0[_0xb282('0x3c')]=qs['filters'](_[_0xb282('0x56')](_0x34baf2[_0xb282('0x31')],_0x5d6a78[_0xb282('0x33')]));if(_0x34baf2[_0xb282('0x31')][_0xb282('0x3d')]){_0x3716b0[_0xb282('0x3c')]=_[_0xb282('0x3f')](_0x3716b0[_0xb282('0x3c')],{'$or':_['map'](_0x3716b0[_0xb282('0x37')],function(_0xb22721){var _0x18f33d={};_0x18f33d[_0xb22721]={'$like':'%'+_0x34baf2['query'][_0xb282('0x3d')]+'%'};return _0x18f33d;})});}_0x3716b0[_0xb282('0x3c')]=_['merge'](_0x3716b0['where'],{'mailboxuser':_0x40ae87[_0xb282('0x57')]});_0x3716b0=_[_0xb282('0x3f')]({},_0x3716b0,_0x34baf2[_0xb282('0x40')]);return db[_0xb282('0x55')][_0xb282('0x58')](_0x3716b0)[_0xb282('0x23')](respondWithFilteredResult(_0x53d50a,_0x3716b0));})[_0xb282('0x45')](handleError(_0x53d50a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5950e30..b2c3fab 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 _0x1189=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','moment','path','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x1189,0x101));var _0x9118=function(_0x485dda,_0x1f5548){_0x485dda=_0x485dda-0x0;var _0x46c2d3=_0x1189[_0x485dda];return _0x46c2d3;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var logger=require(_0x9118('0x2'))('api');var moment=require(_0x9118('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9118('0x4'));var rimraf=require('rimraf');var config=require(_0x9118('0x5'));var attributes=require(_0x9118('0x6'));module[_0x9118('0x7')]=function(_0x53d156,_0x321df0){return _0x53d156[_0x9118('0x8')](_0x9118('0x9'),attributes,{'tableName':_0x9118('0xa'),'paranoid':![],'indexes':[{'name':_0x9118('0xb'),'fields':[_0x9118('0xc'),_0x9118('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc7f2=['api','moment','bluebird','request-promise','../../config/environment','./voiceMail.attributes','exports','VoiceMail','mailbox','context','lodash','util','../../config/logger'];(function(_0x12e1dd,_0x299547){var _0x4aa850=function(_0x1f541f){while(--_0x1f541f){_0x12e1dd['push'](_0x12e1dd['shift']());}};_0x4aa850(++_0x299547);}(_0xc7f2,0xda));var _0x2c7f=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xc7f2[_0x1db251];return _0x56685a;};'use strict';var _=require(_0x2c7f('0x0'));var util=require(_0x2c7f('0x1'));var logger=require(_0x2c7f('0x2'))(_0x2c7f('0x3'));var moment=require(_0x2c7f('0x4'));var BPromise=require(_0x2c7f('0x5'));var rp=require(_0x2c7f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2c7f('0x7'));var attributes=require(_0x2c7f('0x8'));module[_0x2c7f('0x9')]=function(_0x432bae,_0x3772fb){return _0x432bae['define'](_0x2c7f('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x2c7f('0xb'),_0x2c7f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8d94992..fbafd8d 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 _0x1106=['http','request','then','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x32352e,_0x253a7e){var _0x5646df=function(_0x5d1831){while(--_0x5d1831){_0x32352e['push'](_0x32352e['shift']());}};_0x5646df(++_0x253a7e);}(_0x1106,0x1af));var _0x6110=function(_0x1b416e,_0xe6df76){_0x1b416e=_0x1b416e-0x0;var _0x4d4497=_0x1106[_0x1b416e];return _0x4d4497;};'use strict';var _=require(_0x6110('0x0'));var util=require('util');var moment=require(_0x6110('0x1'));var BPromise=require(_0x6110('0x2'));var rs=require(_0x6110('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6110('0x4'))['db'];var utils=require(_0x6110('0x5'));var logger=require(_0x6110('0x6'))(_0x6110('0x7'));var config=require(_0x6110('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6110('0x9')][_0x6110('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51f4af,_0x3ecd82,_0x5c675b){return new BPromise(function(_0x3fdf04,_0x499152){return client[_0x6110('0xb')](_0x51f4af,_0x5c675b)[_0x6110('0xc')](function(_0x3174f2){logger['info']('VoiceMail,\x20%s,\x20%s',_0x3ecd82,_0x6110('0xd'));logger[_0x6110('0xe')](_0x6110('0xf'),_0x3ecd82,'request\x20sent',JSON['stringify'](_0x3174f2));if(_0x3174f2[_0x6110('0x10')]){if(_0x3174f2[_0x6110('0x10')]['code']===0x1f4){logger[_0x6110('0x10')](_0x6110('0x11'),_0x3ecd82,_0x3174f2['error'][_0x6110('0x12')]);return _0x499152(_0x3174f2[_0x6110('0x10')]['message']);}logger[_0x6110('0x10')](_0x6110('0x11'),_0x3ecd82,_0x3174f2[_0x6110('0x10')][_0x6110('0x12')]);return _0x3fdf04(_0x3174f2[_0x6110('0x10')][_0x6110('0x12')]);}else{logger['info'](_0x6110('0x11'),_0x3ecd82,'request\x20sent');_0x3fdf04(_0x3174f2[_0x6110('0x13')]['message']);}})[_0x6110('0x14')](function(_0x4b6171){logger['error'](_0x6110('0x11'),_0x3ecd82,_0x4b6171);_0x499152(_0x4b6171);});});} \ No newline at end of file +var _0x1dc6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','randomstring','ioredis'];(function(_0x3ca4e7,_0x126d77){var _0x585ea=function(_0x6fdaf1){while(--_0x6fdaf1){_0x3ca4e7['push'](_0x3ca4e7['shift']());}};_0x585ea(++_0x126d77);}(_0x1dc6,0xf3));var _0x61dc=function(_0x3db625,_0x3afd9c){_0x3db625=_0x3db625-0x0;var _0x358bd6=_0x1dc6[_0x3db625];return _0x358bd6;};'use strict';var _=require(_0x61dc('0x0'));var util=require(_0x61dc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x61dc('0x2'));var fs=require('fs');var Redis=require(_0x61dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x61dc('0x4'));var logger=require(_0x61dc('0x5'))('rpc');var config=require(_0x61dc('0x6'));var jayson=require(_0x61dc('0x7'));var client=jayson['client'][_0x61dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a317c,_0x57ba27,_0x4ccb1){return new BPromise(function(_0x1ef24e,_0x5be69b){return client[_0x61dc('0x9')](_0x4a317c,_0x4ccb1)[_0x61dc('0xa')](function(_0xc6135){logger[_0x61dc('0xb')](_0x61dc('0xc'),_0x57ba27,_0x61dc('0xd'));logger[_0x61dc('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x57ba27,'request\x20sent',JSON[_0x61dc('0xf')](_0xc6135));if(_0xc6135['error']){if(_0xc6135[_0x61dc('0x10')]['code']===0x1f4){logger[_0x61dc('0x10')](_0x61dc('0xc'),_0x57ba27,_0xc6135['error'][_0x61dc('0x11')]);return _0x5be69b(_0xc6135[_0x61dc('0x10')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x57ba27,_0xc6135[_0x61dc('0x10')][_0x61dc('0x11')]);return _0x1ef24e(_0xc6135['error']['message']);}else{logger[_0x61dc('0xb')](_0x61dc('0xc'),_0x57ba27,_0x61dc('0xd'));_0x1ef24e(_0xc6135[_0x61dc('0x12')][_0x61dc('0x11')]);}})['catch'](function(_0x243952){logger['error'](_0x61dc('0xc'),_0x57ba27,_0x243952);_0x5be69b(_0x243952);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 82b18c6..0a1b3b3 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 _0x93b7=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','destroy','exports','multer','util'];(function(_0x1ca605,_0x379da4){var _0x44748d=function(_0x2c8438){while(--_0x2c8438){_0x1ca605['push'](_0x1ca605['shift']());}};_0x44748d(++_0x379da4);}(_0x93b7,0x8a));var _0x793b=function(_0x1b3287,_0x15c015){_0x1b3287=_0x1b3287-0x0;var _0x10b1bc=_0x93b7[_0x1b3287];return _0x10b1bc;};'use strict';var multer=require(_0x793b('0x0'));var util=require(_0x793b('0x1'));var path=require(_0x793b('0x2'));var timeout=require(_0x793b('0x3'));var express=require(_0x793b('0x4'));var router=express['Router']();var fs_extra=require(_0x793b('0x5'));var auth=require(_0x793b('0x6'));var interaction=require(_0x793b('0x7'));var config=require('../../config/environment');var controller=require(_0x793b('0x8'));router[_0x793b('0x9')]('/',auth[_0x793b('0xa')](),controller[_0x793b('0xb')]);router[_0x793b('0x9')](_0x793b('0xc'),auth['isAuthenticated'](),controller[_0x793b('0xd')]);router[_0x793b('0x9')]('/:id/download',auth[_0x793b('0xa')](),controller[_0x793b('0xe')]);router[_0x793b('0xf')]('/',auth[_0x793b('0xa')](),controller[_0x793b('0x10')]);router[_0x793b('0x11')]('/:id',auth[_0x793b('0xa')](),controller['update']);router['delete']('/:id',auth[_0x793b('0xa')](),controller[_0x793b('0x12')]);module[_0x793b('0x13')]=router; \ No newline at end of file +var _0xcc30=['get','index','/:id','isAuthenticated','/:id/download','download','post','create','put','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xcc30,0x172));var _0x0cc3=function(_0x591e16,_0x5aefc1){_0x591e16=_0x591e16-0x0;var _0x543b35=_0xcc30[_0x591e16];return _0x543b35;};'use strict';var multer=require(_0x0cc3('0x0'));var util=require(_0x0cc3('0x1'));var path=require(_0x0cc3('0x2'));var timeout=require(_0x0cc3('0x3'));var express=require('express');var router=express[_0x0cc3('0x4')]();var fs_extra=require(_0x0cc3('0x5'));var auth=require(_0x0cc3('0x6'));var interaction=require(_0x0cc3('0x7'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x0cc3('0x8')]('/',auth['isAuthenticated'](),controller[_0x0cc3('0x9')]);router[_0x0cc3('0x8')](_0x0cc3('0xa'),auth[_0x0cc3('0xb')](),controller['show']);router['get'](_0x0cc3('0xc'),auth[_0x0cc3('0xb')](),controller[_0x0cc3('0xd')]);router[_0x0cc3('0xe')]('/',auth['isAuthenticated'](),controller[_0x0cc3('0xf')]);router[_0x0cc3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0cc3('0x11')]);router['delete'](_0x0cc3('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 3dabd74..3d6002a 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 _0x02a6=['literal','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x5002be,_0x5c5ea0){var _0x20b151=function(_0x47747d){while(--_0x47747d){_0x5002be['push'](_0x5002be['shift']());}};_0x20b151(++_0x5c5ea0);}(_0x02a6,0xeb));var _0x602a=function(_0x30bcbf,_0x241d9e){_0x30bcbf=_0x30bcbf-0x0;var _0x3381b7=_0x02a6[_0x30bcbf];return _0x3381b7;};'use strict';var Sequelize=require(_0x602a('0x0'));module['exports']={'name':{'type':Sequelize[_0x602a('0x1')],'get':function(_0x1190e6){return this[_0x602a('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x602a('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x602a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x602a('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x602a('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x602a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x602a('0x5')](_0x602a('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x602a('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x602a('0x7'),'defaultValue':Sequelize[_0x602a('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xec0f=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x4596a4,_0x1a0515){var _0x4c2894=function(_0x398cfc){while(--_0x398cfc){_0x4596a4['push'](_0x4596a4['shift']());}};_0x4c2894(++_0x1a0515);}(_0xec0f,0x80));var _0xfec0=function(_0x5d32ba,_0x26d47e){_0x5d32ba=_0x5d32ba-0x0;var _0x5e7be6=_0xec0f[_0x5d32ba];return _0x5e7be6;};'use strict';var Sequelize=require(_0xfec0('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5d13f1){return this[_0xfec0('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xfec0('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xfec0('0x4')](_0xfec0('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'stamp':{'type':_0xfec0('0x6'),'defaultValue':Sequelize[_0xfec0('0x7')](_0xfec0('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 472f9dd..b0baa8e 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 _0x14f7=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','stack','name','send','index','map','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','VoiceMailMessage','includeAll','rows','show','params','include','find','catch','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x56b222,_0x43f86e){var _0x341af1=function(_0x566c0a){while(--_0x566c0a){_0x56b222['push'](_0x56b222['shift']());}};_0x341af1(++_0x43f86e);}(_0x14f7,0xf4));var _0x714f=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x14f7[_0x122096];return _0x3d1966;};'use strict';var emlformat=require(_0x714f('0x0'));var rimraf=require(_0x714f('0x1'));var zipdir=require(_0x714f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x714f('0x3'));var moment=require(_0x714f('0x4'));var BPromise=require(_0x714f('0x5'));var Mustache=require(_0x714f('0x6'));var util=require(_0x714f('0x7'));var path=require(_0x714f('0x8'));var sox=require(_0x714f('0x9'));var csv=require(_0x714f('0xa'));var ejs=require(_0x714f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x714f('0xc'));var squel=require(_0x714f('0xd'));var crypto=require(_0x714f('0xe'));var jsforce=require(_0x714f('0xf'));var deskjs=require(_0x714f('0x10'));var toCsv=require(_0x714f('0xa'));var querystring=require(_0x714f('0x11'));var Papa=require(_0x714f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x714f('0x13'));var as=require(_0x714f('0x14'));var hardwareService=require(_0x714f('0x15'));var logger=require(_0x714f('0x16'))(_0x714f('0x17'));var utils=require(_0x714f('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e2192,_0x25dd85){_0x25dd85=_0x25dd85||0xcc;return function(_0x572090){if(_0x572090){return _0x2e2192[_0x714f('0x19')](_0x25dd85);}return _0x2e2192[_0x714f('0x1a')](_0x25dd85)[_0x714f('0x1b')]();};}function respondWithResult(_0x877bac,_0x280854){_0x280854=_0x280854||0xc8;return function(_0x54cf43){if(_0x54cf43){return _0x877bac[_0x714f('0x1a')](_0x280854)[_0x714f('0x1c')](_0x54cf43);}};}function respondWithFilteredResult(_0x4c37cc,_0x2e4293){return function(_0x497f9f){if(_0x497f9f){var _0x300fb8=typeof _0x2e4293[_0x714f('0x1d')]===_0x714f('0x1e')&&typeof _0x2e4293[_0x714f('0x1f')]===_0x714f('0x1e');var _0x58d6ee=_0x497f9f[_0x714f('0x20')];var _0x1cf59a=_0x300fb8?0x0:_0x2e4293[_0x714f('0x1d')];var _0x28ff66=_0x300fb8?_0x497f9f[_0x714f('0x20')]:_0x2e4293[_0x714f('0x1d')]+_0x2e4293[_0x714f('0x1f')];var _0x31d1cd;if(_0x28ff66>=_0x58d6ee){_0x28ff66=_0x58d6ee;_0x31d1cd=0xc8;}else{_0x31d1cd=0xce;}_0x4c37cc['status'](_0x31d1cd);return _0x4c37cc[_0x714f('0x21')](_0x714f('0x22'),_0x1cf59a+'-'+_0x28ff66+'/'+_0x58d6ee)[_0x714f('0x1c')](_0x497f9f);}return null;};}function patchUpdates(_0x1369dd){return function(_0x35664a){try{jsonpatch[_0x714f('0x23')](_0x35664a,_0x1369dd,!![]);}catch(_0x54b5fa){return BPromise['reject'](_0x54b5fa);}return _0x35664a['save']();};}function saveUpdates(_0x1e183a,_0x5af44f){return function(_0x450c49){if(_0x450c49){return _0x450c49[_0x714f('0x24')](_0x1e183a)['then'](function(_0x169351){return _0x169351;});}return null;};}function removeEntity(_0x1fd73a,_0x1e9d62){return function(_0x43d5a5){if(_0x43d5a5){return _0x43d5a5[_0x714f('0x25')]()[_0x714f('0x26')](function(){_0x1fd73a[_0x714f('0x1a')](0xcc)[_0x714f('0x1b')]();});}};}function handleEntityNotFound(_0x3a832c,_0x2979fb){return function(_0x4bee06){if(!_0x4bee06){_0x3a832c[_0x714f('0x19')](0x194);}return _0x4bee06;};}function handleError(_0x111b47,_0x2064c0){_0x2064c0=_0x2064c0||0x1f4;return function(_0x2be548){logger['error'](_0x2be548[_0x714f('0x27')]);if(_0x2be548[_0x714f('0x28')]){delete _0x2be548[_0x714f('0x28')];}_0x111b47[_0x714f('0x1a')](_0x2064c0)[_0x714f('0x29')](_0x2be548);};}exports[_0x714f('0x2a')]=function(_0x4379ae,_0x204ff7){var _0x5c7977={},_0x10e784={},_0x2b2c84={'count':0x0,'rows':[]};var _0x2a0cb1=_[_0x714f('0x2b')](db['VoiceMailMessage']['rawAttributes'],function(_0x2af2c3){return{'name':_0x2af2c3[_0x714f('0x2c')],'type':_0x2af2c3['type'][_0x714f('0x2d')]};});_0x10e784[_0x714f('0x2e')]=_[_0x714f('0x2f')](_[_0x714f('0x2b')](_0x2a0cb1,_0x714f('0x28')),['name']);_0x10e784[_0x714f('0x30')]=_[_0x714f('0x31')](_0x4379ae[_0x714f('0x30')]);_0x10e784[_0x714f('0x32')]=_[_0x714f('0x33')](_0x10e784['model'],_0x10e784[_0x714f('0x30')]);_0x5c7977[_0x714f('0x34')]=_[_0x714f('0x33')](_0x10e784[_0x714f('0x2e')],qs[_0x714f('0x35')](_0x4379ae[_0x714f('0x30')][_0x714f('0x35')]));_0x5c7977[_0x714f('0x34')]=_0x5c7977['attributes'][_0x714f('0x36')]?_0x5c7977['attributes']:_0x10e784['model'];if(!_0x4379ae[_0x714f('0x30')][_0x714f('0x37')](_0x714f('0x38'))){_0x5c7977[_0x714f('0x1f')]=qs[_0x714f('0x1f')](_0x4379ae['query'][_0x714f('0x1f')]);_0x5c7977[_0x714f('0x1d')]=qs[_0x714f('0x1d')](_0x4379ae[_0x714f('0x30')][_0x714f('0x1d')]);}_0x5c7977[_0x714f('0x39')]=qs[_0x714f('0x3a')](_0x4379ae[_0x714f('0x30')][_0x714f('0x3a')]);_0x5c7977['where']=qs[_0x714f('0x32')](_['pick'](_0x4379ae[_0x714f('0x30')],_0x10e784[_0x714f('0x32')]),_0x2a0cb1);if(_0x4379ae[_0x714f('0x30')][_0x714f('0x3b')]){_0x5c7977['where']=_[_0x714f('0x3c')](_0x5c7977[_0x714f('0x3d')],{'$or':_['map'](_0x2a0cb1,function(_0x3ab2f8){if(_0x3ab2f8[_0x714f('0x3e')]!==_0x714f('0x3f')){var _0x5cb4d9={};_0x5cb4d9[_0x3ab2f8[_0x714f('0x28')]]={'$like':'%'+_0x4379ae['query'][_0x714f('0x3b')]+'%'};return _0x5cb4d9;}})});}_0x5c7977=_[_0x714f('0x3c')]({},_0x5c7977,_0x4379ae[_0x714f('0x40')]);var _0x34eecc={'where':_0x5c7977[_0x714f('0x3d')]};return db[_0x714f('0x41')][_0x714f('0x20')](_0x34eecc)[_0x714f('0x26')](function(_0x5cb663){_0x2b2c84[_0x714f('0x20')]=_0x5cb663;if(_0x4379ae[_0x714f('0x30')][_0x714f('0x42')]){_0x5c7977['include']=[{'all':!![]}];}return db[_0x714f('0x41')]['findAll'](_0x5c7977);})[_0x714f('0x26')](function(_0x26d501){_0x2b2c84[_0x714f('0x43')]=_0x26d501;return _0x2b2c84;})[_0x714f('0x26')](respondWithFilteredResult(_0x204ff7,_0x5c7977))['catch'](handleError(_0x204ff7,null));};exports[_0x714f('0x44')]=function(_0x268bb1,_0x3c37e1){var _0x2cd639={'raw':!![],'where':{'id':_0x268bb1[_0x714f('0x45')]['id']}},_0x4c732f={};_0x4c732f[_0x714f('0x2e')]=_[_0x714f('0x31')](db[_0x714f('0x41')]['rawAttributes']);_0x4c732f[_0x714f('0x30')]=_['keys'](_0x268bb1['query']);_0x4c732f[_0x714f('0x32')]=_[_0x714f('0x33')](_0x4c732f[_0x714f('0x2e')],_0x4c732f[_0x714f('0x30')]);_0x2cd639['attributes']=_[_0x714f('0x33')](_0x4c732f[_0x714f('0x2e')],qs[_0x714f('0x35')](_0x268bb1[_0x714f('0x30')][_0x714f('0x35')]));_0x2cd639[_0x714f('0x34')]=_0x2cd639[_0x714f('0x34')][_0x714f('0x36')]?_0x2cd639[_0x714f('0x34')]:_0x4c732f[_0x714f('0x2e')];if(_0x268bb1[_0x714f('0x30')][_0x714f('0x42')]){_0x2cd639[_0x714f('0x46')]=[{'all':!![]}];}_0x2cd639=_[_0x714f('0x3c')]({},_0x2cd639,_0x268bb1[_0x714f('0x40')]);return db[_0x714f('0x41')][_0x714f('0x47')](_0x2cd639)[_0x714f('0x26')](handleEntityNotFound(_0x3c37e1,null))['then'](respondWithResult(_0x3c37e1,null))[_0x714f('0x48')](handleError(_0x3c37e1,null));};exports[_0x714f('0x49')]=function(_0x5b9343,_0x1c89bc){return db['VoiceMailMessage'][_0x714f('0x49')](_0x5b9343[_0x714f('0x4a')],{})[_0x714f('0x26')](respondWithResult(_0x1c89bc,0xc9))[_0x714f('0x48')](handleError(_0x1c89bc,null));};exports['update']=function(_0x256033,_0xceba7d){if(_0x256033[_0x714f('0x4a')]['id']){delete _0x256033[_0x714f('0x4a')]['id'];}return db[_0x714f('0x41')][_0x714f('0x47')]({'where':{'id':_0x256033[_0x714f('0x45')]['id']}})[_0x714f('0x26')](handleEntityNotFound(_0xceba7d,null))['then'](saveUpdates(_0x256033[_0x714f('0x4a')],null))[_0x714f('0x26')](respondWithResult(_0xceba7d,null))[_0x714f('0x48')](handleError(_0xceba7d,null));};exports[_0x714f('0x25')]=function(_0x135cc7,_0x468192){return db[_0x714f('0x41')]['find']({'where':{'id':_0x135cc7[_0x714f('0x45')]['id']}})[_0x714f('0x26')](handleEntityNotFound(_0x468192,null))['then'](removeEntity(_0x468192,null))[_0x714f('0x48')](handleError(_0x468192,null));};exports[_0x714f('0x4b')]=function(_0x1191cc,_0x1c26c1,_0x14de77){return db[_0x714f('0x41')]['find']({'where':{'id':_0x1191cc[_0x714f('0x45')]['id']},'attributes':['id',_0x714f('0x4c'),_0x714f('0x4d')]})[_0x714f('0x26')](handleEntityNotFound(_0x1c26c1,null))['then'](function(_0x4aba3c){if(_0x4aba3c){if(!_0x4aba3c[_0x714f('0x4c')]){throw new db[(_0x714f('0x4e'))][(_0x714f('0x4f'))](_0x714f('0x50'));}var _0x29e1d9={'Content-Type':_0x714f('0x51'),'Content-Disposition':_0x714f('0x52')};if(_0x4aba3c[_0x714f('0x4d')]){_0x29e1d9[_0x714f('0x53')]='attachment;\x20filename=\x22'+_0x4aba3c[_0x714f('0x4d')]+_0x714f('0x54');}_0x1c26c1['set'](_0x29e1d9);return _0x1c26c1[_0x714f('0x29')](new Buffer(_0x4aba3c[_0x714f('0x4c')]));}})['catch'](handleError(_0x1c26c1,null));}; \ No newline at end of file +var _0xd1ea=['filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','download','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','send','recording','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','save','update','then','destroy','stack','name','map','VoiceMailMessage','rawAttributes','model','differenceBy','query','keys'];(function(_0x568286,_0x1230df){var _0x3638f3=function(_0x20d354){while(--_0x20d354){_0x568286['push'](_0x568286['shift']());}};_0x3638f3(++_0x1230df);}(_0xd1ea,0x164));var _0xad1e=function(_0x248be1,_0x456ccd){_0x248be1=_0x248be1-0x0;var _0x1bdbde=_0xd1ea[_0x248be1];return _0x1bdbde;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xad1e('0x0'));var rp=require(_0xad1e('0x1'));var moment=require(_0xad1e('0x2'));var BPromise=require(_0xad1e('0x3'));var Mustache=require(_0xad1e('0x4'));var util=require(_0xad1e('0x5'));var path=require(_0xad1e('0x6'));var sox=require(_0xad1e('0x7'));var csv=require(_0xad1e('0x8'));var ejs=require(_0xad1e('0x9'));var fs=require('fs');var fs_extra=require(_0xad1e('0xa'));var _=require(_0xad1e('0xb'));var squel=require(_0xad1e('0xc'));var crypto=require(_0xad1e('0xd'));var jsforce=require(_0xad1e('0xe'));var deskjs=require(_0xad1e('0xf'));var toCsv=require(_0xad1e('0x8'));var querystring=require('querystring');var Papa=require(_0xad1e('0x10'));var Redis=require(_0xad1e('0x11'));var authService=require(_0xad1e('0x12'));var qs=require(_0xad1e('0x13'));var as=require(_0xad1e('0x14'));var hardwareService=require(_0xad1e('0x15'));var logger=require(_0xad1e('0x16'))(_0xad1e('0x17'));var utils=require(_0xad1e('0x18'));var config=require(_0xad1e('0x19'));var licenseUtil=require(_0xad1e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5afd9b,_0x89e7b7){_0x89e7b7=_0x89e7b7||0xcc;return function(_0x4c700c){if(_0x4c700c){return _0x5afd9b[_0xad1e('0x1b')](_0x89e7b7);}return _0x5afd9b['status'](_0x89e7b7)[_0xad1e('0x1c')]();};}function respondWithResult(_0x482c1d,_0x167f8a){_0x167f8a=_0x167f8a||0xc8;return function(_0x2230ce){if(_0x2230ce){return _0x482c1d[_0xad1e('0x1d')](_0x167f8a)[_0xad1e('0x1e')](_0x2230ce);}};}function respondWithFilteredResult(_0x53456c,_0x211642){return function(_0x5935fc){if(_0x5935fc){var _0x2049d3=typeof _0x211642[_0xad1e('0x1f')]===_0xad1e('0x20')&&typeof _0x211642['limit']==='undefined';var _0x22f27b=_0x5935fc['count'];var _0x12f86e=_0x2049d3?0x0:_0x211642['offset'];var _0x3c6ec6=_0x2049d3?_0x5935fc['count']:_0x211642['offset']+_0x211642[_0xad1e('0x21')];var _0x3303b3;if(_0x3c6ec6>=_0x22f27b){_0x3c6ec6=_0x22f27b;_0x3303b3=0xc8;}else{_0x3303b3=0xce;}_0x53456c[_0xad1e('0x1d')](_0x3303b3);return _0x53456c[_0xad1e('0x22')](_0xad1e('0x23'),_0x12f86e+'-'+_0x3c6ec6+'/'+_0x22f27b)[_0xad1e('0x1e')](_0x5935fc);}return null;};}function patchUpdates(_0x5152c5){return function(_0x1a85bd){try{jsonpatch['apply'](_0x1a85bd,_0x5152c5,!![]);}catch(_0x15ce11){return BPromise['reject'](_0x15ce11);}return _0x1a85bd[_0xad1e('0x24')]();};}function saveUpdates(_0x1954e6,_0xa7f833){return function(_0x2930f6){if(_0x2930f6){return _0x2930f6[_0xad1e('0x25')](_0x1954e6)[_0xad1e('0x26')](function(_0x26f8c1){return _0x26f8c1;});}return null;};}function removeEntity(_0x44298f,_0x7663f4){return function(_0x1f9e8f){if(_0x1f9e8f){return _0x1f9e8f[_0xad1e('0x27')]()[_0xad1e('0x26')](function(){_0x44298f[_0xad1e('0x1d')](0xcc)[_0xad1e('0x1c')]();});}};}function handleEntityNotFound(_0x1c7257,_0x4169c5){return function(_0x1c5e69){if(!_0x1c5e69){_0x1c7257[_0xad1e('0x1b')](0x194);}return _0x1c5e69;};}function handleError(_0x44a247,_0x16b41){_0x16b41=_0x16b41||0x1f4;return function(_0x17a706){logger['error'](_0x17a706[_0xad1e('0x28')]);if(_0x17a706['name']){delete _0x17a706[_0xad1e('0x29')];}_0x44a247[_0xad1e('0x1d')](_0x16b41)['send'](_0x17a706);};}exports['index']=function(_0x3c355a,_0x5e005f){var _0x6e5c71={},_0x2b1fab={},_0x1219c2={'count':0x0,'rows':[]};var _0x38cb75=_[_0xad1e('0x2a')](db[_0xad1e('0x2b')][_0xad1e('0x2c')],function(_0x4c96f2){return{'name':_0x4c96f2['fieldName'],'type':_0x4c96f2['type']['key']};});_0x2b1fab[_0xad1e('0x2d')]=_[_0xad1e('0x2e')](_['map'](_0x38cb75,'name'),['name']);_0x2b1fab[_0xad1e('0x2f')]=_[_0xad1e('0x30')](_0x3c355a[_0xad1e('0x2f')]);_0x2b1fab[_0xad1e('0x31')]=_[_0xad1e('0x32')](_0x2b1fab[_0xad1e('0x2d')],_0x2b1fab[_0xad1e('0x2f')]);_0x6e5c71[_0xad1e('0x33')]=_[_0xad1e('0x32')](_0x2b1fab[_0xad1e('0x2d')],qs['fields'](_0x3c355a['query'][_0xad1e('0x34')]));_0x6e5c71['attributes']=_0x6e5c71[_0xad1e('0x33')][_0xad1e('0x35')]?_0x6e5c71['attributes']:_0x2b1fab[_0xad1e('0x2d')];if(!_0x3c355a[_0xad1e('0x2f')]['hasOwnProperty'](_0xad1e('0x36'))){_0x6e5c71['limit']=qs['limit'](_0x3c355a['query'][_0xad1e('0x21')]);_0x6e5c71[_0xad1e('0x1f')]=qs[_0xad1e('0x1f')](_0x3c355a['query'][_0xad1e('0x1f')]);}_0x6e5c71[_0xad1e('0x37')]=qs[_0xad1e('0x38')](_0x3c355a[_0xad1e('0x2f')][_0xad1e('0x38')]);_0x6e5c71['where']=qs[_0xad1e('0x31')](_['pick'](_0x3c355a[_0xad1e('0x2f')],_0x2b1fab[_0xad1e('0x31')]),_0x38cb75);if(_0x3c355a[_0xad1e('0x2f')][_0xad1e('0x39')]){_0x6e5c71[_0xad1e('0x3a')]=_[_0xad1e('0x3b')](_0x6e5c71[_0xad1e('0x3a')],{'$or':_[_0xad1e('0x2a')](_0x38cb75,function(_0x506d9c){if(_0x506d9c[_0xad1e('0x3c')]!=='VIRTUAL'){var _0x452033={};_0x452033[_0x506d9c[_0xad1e('0x29')]]={'$like':'%'+_0x3c355a[_0xad1e('0x2f')][_0xad1e('0x39')]+'%'};return _0x452033;}})});}_0x6e5c71=_['merge']({},_0x6e5c71,_0x3c355a[_0xad1e('0x3d')]);var _0x3ef7d5={'where':_0x6e5c71[_0xad1e('0x3a')]};return db[_0xad1e('0x2b')]['count'](_0x3ef7d5)[_0xad1e('0x26')](function(_0x5ed87d){_0x1219c2[_0xad1e('0x3e')]=_0x5ed87d;if(_0x3c355a[_0xad1e('0x2f')][_0xad1e('0x3f')]){_0x6e5c71[_0xad1e('0x40')]=[{'all':!![]}];}return db[_0xad1e('0x2b')][_0xad1e('0x41')](_0x6e5c71);})['then'](function(_0x54a5a9){_0x1219c2[_0xad1e('0x42')]=_0x54a5a9;return _0x1219c2;})[_0xad1e('0x26')](respondWithFilteredResult(_0x5e005f,_0x6e5c71))[_0xad1e('0x43')](handleError(_0x5e005f,null));};exports['show']=function(_0x2c9f3d,_0x55ee9e){var _0x3bc7b6={'raw':!![],'where':{'id':_0x2c9f3d[_0xad1e('0x44')]['id']}},_0x2ce7ca={};_0x2ce7ca[_0xad1e('0x2d')]=_[_0xad1e('0x30')](db['VoiceMailMessage'][_0xad1e('0x2c')]);_0x2ce7ca[_0xad1e('0x2f')]=_[_0xad1e('0x30')](_0x2c9f3d['query']);_0x2ce7ca[_0xad1e('0x31')]=_[_0xad1e('0x32')](_0x2ce7ca[_0xad1e('0x2d')],_0x2ce7ca[_0xad1e('0x2f')]);_0x3bc7b6['attributes']=_[_0xad1e('0x32')](_0x2ce7ca[_0xad1e('0x2d')],qs['fields'](_0x2c9f3d[_0xad1e('0x2f')]['fields']));_0x3bc7b6[_0xad1e('0x33')]=_0x3bc7b6[_0xad1e('0x33')][_0xad1e('0x35')]?_0x3bc7b6[_0xad1e('0x33')]:_0x2ce7ca[_0xad1e('0x2d')];if(_0x2c9f3d[_0xad1e('0x2f')][_0xad1e('0x3f')]){_0x3bc7b6[_0xad1e('0x40')]=[{'all':!![]}];}_0x3bc7b6=_[_0xad1e('0x3b')]({},_0x3bc7b6,_0x2c9f3d[_0xad1e('0x3d')]);return db[_0xad1e('0x2b')][_0xad1e('0x45')](_0x3bc7b6)['then'](handleEntityNotFound(_0x55ee9e,null))[_0xad1e('0x26')](respondWithResult(_0x55ee9e,null))[_0xad1e('0x43')](handleError(_0x55ee9e,null));};exports['create']=function(_0x4e9ed1,_0x5c6010){return db[_0xad1e('0x2b')][_0xad1e('0x46')](_0x4e9ed1[_0xad1e('0x47')],{})['then'](respondWithResult(_0x5c6010,0xc9))[_0xad1e('0x43')](handleError(_0x5c6010,null));};exports['update']=function(_0x365c66,_0x1129b2){if(_0x365c66[_0xad1e('0x47')]['id']){delete _0x365c66['body']['id'];}return db[_0xad1e('0x2b')][_0xad1e('0x45')]({'where':{'id':_0x365c66[_0xad1e('0x44')]['id']}})[_0xad1e('0x26')](handleEntityNotFound(_0x1129b2,null))[_0xad1e('0x26')](saveUpdates(_0x365c66[_0xad1e('0x47')],null))['then'](respondWithResult(_0x1129b2,null))[_0xad1e('0x43')](handleError(_0x1129b2,null));};exports['destroy']=function(_0x5045d7,_0x12c39f){return db[_0xad1e('0x2b')][_0xad1e('0x45')]({'where':{'id':_0x5045d7[_0xad1e('0x44')]['id']}})[_0xad1e('0x26')](handleEntityNotFound(_0x12c39f,null))[_0xad1e('0x26')](removeEntity(_0x12c39f,null))[_0xad1e('0x43')](handleError(_0x12c39f,null));};exports[_0xad1e('0x48')]=function(_0x157efb,_0x19a1ae,_0x3f7cf1){return db[_0xad1e('0x2b')][_0xad1e('0x45')]({'where':{'id':_0x157efb[_0xad1e('0x44')]['id']},'attributes':['id','recording',_0xad1e('0x49')]})['then'](handleEntityNotFound(_0x19a1ae,null))[_0xad1e('0x26')](function(_0x4dc496){if(_0x4dc496){if(!_0x4dc496['recording']){throw new db[(_0xad1e('0x4a'))][(_0xad1e('0x4b'))](_0xad1e('0x4c'));}var _0x55455d={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x4dc496[_0xad1e('0x49')]){_0x55455d[_0xad1e('0x4d')]=_0xad1e('0x4e')+_0x4dc496[_0xad1e('0x49')]+'.wav\x22';}_0x19a1ae[_0xad1e('0x22')](_0x55455d);return _0x19a1ae[_0xad1e('0x4f')](new Buffer(_0x4dc496[_0xad1e('0x50')]));}})[_0xad1e('0x43')](handleError(_0x19a1ae,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 51d3af1..8de7d75 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 _0xf4b3=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xf4b3,0x130));var _0x3f4b=function(_0x4106bd,_0x2ca0b0){_0x4106bd=_0x4106bd-0x0;var _0x13757f=_0xf4b3[_0x4106bd];return _0x13757f;};'use strict';var _=require(_0x3f4b('0x0'));var util=require(_0x3f4b('0x1'));var logger=require(_0x3f4b('0x2'))(_0x3f4b('0x3'));var moment=require(_0x3f4b('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f4b('0x5'));var fs=require('fs');var path=require(_0x3f4b('0x6'));var rimraf=require('rimraf');var config=require(_0x3f4b('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x3f4b('0x8')]=function(_0x53926d,_0x580aaa){return _0x53926d[_0x3f4b('0x9')](_0x3f4b('0xa'),attributes,{'tableName':_0x3f4b('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x3f4b('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd827=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x57ebed,_0xfac0ac){var _0x3a0874=function(_0x271491){while(--_0x271491){_0x57ebed['push'](_0x57ebed['shift']());}};_0x3a0874(++_0xfac0ac);}(_0xd827,0x76));var _0x7d82=function(_0x25d6ce,_0x30d64a){_0x25d6ce=_0x25d6ce-0x0;var _0x1aef15=_0xd827[_0x25d6ce];return _0x1aef15;};'use strict';var _=require(_0x7d82('0x0'));var util=require(_0x7d82('0x1'));var logger=require('../../config/logger')(_0x7d82('0x2'));var moment=require(_0x7d82('0x3'));var BPromise=require(_0x7d82('0x4'));var rp=require(_0x7d82('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d82('0x6'));var config=require(_0x7d82('0x7'));var attributes=require(_0x7d82('0x8'));module[_0x7d82('0x9')]=function(_0x1c955d,_0x2c5d91){return _0x1c955d[_0x7d82('0xa')](_0x7d82('0xb'),attributes,{'tableName':_0x7d82('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x7d82('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c51ab75..d9f5894 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 _0x4d25=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x4d25,0xa3));var _0x54d2=function(_0x6cf5ec,_0x194d2e){_0x6cf5ec=_0x6cf5ec-0x0;var _0x271c4f=_0x4d25[_0x6cf5ec];return _0x271c4f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x54d2('0x0'));var BPromise=require('bluebird');var rs=require(_0x54d2('0x1'));var fs=require('fs');var Redis=require(_0x54d2('0x2'));var db=require(_0x54d2('0x3'))['db'];var utils=require(_0x54d2('0x4'));var logger=require(_0x54d2('0x5'))(_0x54d2('0x6'));var config=require(_0x54d2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x54d2('0x8')][_0x54d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53b44f,_0xc927a1,_0x3ddbdc){return new BPromise(function(_0x36d7d5,_0x17a15d){return client[_0x54d2('0xa')](_0x53b44f,_0x3ddbdc)[_0x54d2('0xb')](function(_0x319665){logger[_0x54d2('0xc')](_0x54d2('0xd'),_0xc927a1,_0x54d2('0xe'));logger[_0x54d2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0xc927a1,_0x54d2('0xe'),JSON[_0x54d2('0x10')](_0x319665));if(_0x319665[_0x54d2('0x11')]){if(_0x319665[_0x54d2('0x11')]['code']===0x1f4){logger[_0x54d2('0x11')](_0x54d2('0xd'),_0xc927a1,_0x319665[_0x54d2('0x11')][_0x54d2('0x12')]);return _0x17a15d(_0x319665[_0x54d2('0x11')][_0x54d2('0x12')]);}logger[_0x54d2('0x11')](_0x54d2('0xd'),_0xc927a1,_0x319665[_0x54d2('0x11')]['message']);return _0x36d7d5(_0x319665[_0x54d2('0x11')][_0x54d2('0x12')]);}else{logger['info'](_0x54d2('0xd'),_0xc927a1,_0x54d2('0xe'));_0x36d7d5(_0x319665[_0x54d2('0x13')][_0x54d2('0x12')]);}})[_0x54d2('0x14')](function(_0x12d752){logger[_0x54d2('0x11')](_0x54d2('0xd'),_0xc927a1,_0x12d752);_0x17a15d(_0x12d752);});});} \ No newline at end of file +var _0x1be2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x33dad6,_0x708206){var _0x240c8c=function(_0x5caf57){while(--_0x5caf57){_0x33dad6['push'](_0x33dad6['shift']());}};_0x240c8c(++_0x708206);}(_0x1be2,0x12a));var _0x21be=function(_0x301c11,_0x43f7ef){_0x301c11=_0x301c11-0x0;var _0x22994b=_0x1be2[_0x301c11];return _0x22994b;};'use strict';var _=require(_0x21be('0x0'));var util=require(_0x21be('0x1'));var moment=require('moment');var BPromise=require(_0x21be('0x2'));var rs=require(_0x21be('0x3'));var fs=require('fs');var Redis=require(_0x21be('0x4'));var db=require(_0x21be('0x5'))['db'];var utils=require(_0x21be('0x6'));var logger=require(_0x21be('0x7'))(_0x21be('0x8'));var config=require(_0x21be('0x9'));var jayson=require(_0x21be('0xa'));var client=jayson[_0x21be('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x426463,_0x2f8a72,_0x138bda){return new BPromise(function(_0x2d86bf,_0x49b453){return client[_0x21be('0xc')](_0x426463,_0x138bda)[_0x21be('0xd')](function(_0x5a94ae){logger[_0x21be('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x2f8a72,_0x21be('0xf'));logger[_0x21be('0x10')](_0x21be('0x11'),_0x2f8a72,_0x21be('0xf'),JSON[_0x21be('0x12')](_0x5a94ae));if(_0x5a94ae[_0x21be('0x13')]){if(_0x5a94ae[_0x21be('0x13')][_0x21be('0x14')]===0x1f4){logger[_0x21be('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x2f8a72,_0x5a94ae['error'][_0x21be('0x15')]);return _0x49b453(_0x5a94ae[_0x21be('0x13')][_0x21be('0x15')]);}logger[_0x21be('0x13')](_0x21be('0x16'),_0x2f8a72,_0x5a94ae[_0x21be('0x13')][_0x21be('0x15')]);return _0x2d86bf(_0x5a94ae[_0x21be('0x13')][_0x21be('0x15')]);}else{logger[_0x21be('0xe')](_0x21be('0x16'),_0x2f8a72,_0x21be('0xf'));_0x2d86bf(_0x5a94ae[_0x21be('0x17')][_0x21be('0x15')]);}})[_0x21be('0x18')](function(_0x465ccf){logger[_0x21be('0x13')](_0x21be('0x16'),_0x2f8a72,_0x465ccf);_0x49b453(_0x465ccf);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 605501b..f2b65b1 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 _0x848d=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/sounds','getSounds','post','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x848d,0x165));var _0xd848=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x848d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd848('0x0'));var util=require(_0xd848('0x1'));var path=require(_0xd848('0x2'));var timeout=require('connect-timeout');var express=require(_0xd848('0x3'));var router=express[_0xd848('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd848('0x5'));var interaction=require(_0xd848('0x6'));var config=require(_0xd848('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0xd848('0x8')]('/',auth[_0xd848('0x9')](),controller['index']);router[_0xd848('0x8')](_0xd848('0xa'),auth[_0xd848('0x9')](),controller['show']);router[_0xd848('0x8')](_0xd848('0xb'),auth[_0xd848('0x9')](),controller[_0xd848('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd848('0xd')](_0xd848('0xb'),auth[_0xd848('0x9')](),controller['addSound']);router[_0xd848('0xe')]('/:id',auth[_0xd848('0x9')](),controller[_0xd848('0xf')]);router[_0xd848('0x10')]('/:id',auth[_0xd848('0x9')](),controller[_0xd848('0x11')]);router[_0xd848('0x10')](_0xd848('0x12'),auth[_0xd848('0x9')](),controller[_0xd848('0x13')]);module[_0xd848('0x14')]=router; \ No newline at end of file +var _0xd7a5=['removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sounds','post','create','addSound','put','delete','destroy','/:id/sounds/:id2'];(function(_0x4bb32f,_0x2217e){var _0x2dd6e6=function(_0x28cd57){while(--_0x28cd57){_0x4bb32f['push'](_0x4bb32f['shift']());}};_0x2dd6e6(++_0x2217e);}(_0xd7a5,0x182));var _0x5d7a=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0xd7a5[_0x386525];return _0x14d015;};'use strict';var multer=require(_0x5d7a('0x0'));var util=require(_0x5d7a('0x1'));var path=require(_0x5d7a('0x2'));var timeout=require(_0x5d7a('0x3'));var express=require(_0x5d7a('0x4'));var router=express[_0x5d7a('0x5')]();var fs_extra=require(_0x5d7a('0x6'));var auth=require(_0x5d7a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5d7a('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0x5d7a('0x9')]('/',auth[_0x5d7a('0xa')](),controller[_0x5d7a('0xb')]);router[_0x5d7a('0x9')](_0x5d7a('0xc'),auth[_0x5d7a('0xa')](),controller[_0x5d7a('0xd')]);router['get'](_0x5d7a('0xe'),auth[_0x5d7a('0xa')](),controller['getSounds']);router[_0x5d7a('0xf')]('/',auth[_0x5d7a('0xa')](),controller[_0x5d7a('0x10')]);router[_0x5d7a('0xf')](_0x5d7a('0xe'),auth[_0x5d7a('0xa')](),controller[_0x5d7a('0x11')]);router[_0x5d7a('0x12')](_0x5d7a('0xc'),auth[_0x5d7a('0xa')](),controller['update']);router[_0x5d7a('0x13')](_0x5d7a('0xc'),auth[_0x5d7a('0xa')](),controller[_0x5d7a('0x14')]);router[_0x5d7a('0x13')](_0x5d7a('0x15'),auth[_0x5d7a('0xa')](),controller[_0x5d7a('0x16')]);module[_0x5d7a('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c3e9d67..a3e5a3b 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 _0x0a6f=['BOOLEAN','sequelize','exports','STRING','ENUM','custom','files','mp3nb','quietmp3','alpha','TIMESTAMP'];(function(_0x528b7b,_0x11ec67){var _0x20dadf=function(_0x3cedb1){while(--_0x3cedb1){_0x528b7b['push'](_0x528b7b['shift']());}};_0x20dadf(++_0x11ec67);}(_0x0a6f,0x1cf));var _0xf0a6=function(_0x1f2f86,_0x57341c){_0x1f2f86=_0x1f2f86-0x0;var _0x43a6b3=_0x0a6f[_0x1f2f86];return _0x43a6b3;};'use strict';var Sequelize=require(_0xf0a6('0x0'));module[_0xf0a6('0x1')]={'name':{'type':Sequelize[_0xf0a6('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xf0a6('0x3')](_0xf0a6('0x4'),_0xf0a6('0x5'),_0xf0a6('0x6'),'quietmp3nb',_0xf0a6('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0xf0a6('0x5')},'directory':{'type':Sequelize[_0xf0a6('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xf0a6('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf0a6('0x2')],'allowNull':!![],'defaultValue':_0xf0a6('0x8')},'format':{'type':Sequelize[_0xf0a6('0x2')],'allowNull':!![]},'stamp':{'type':_0xf0a6('0x9')},'defaultEntry':{'type':Sequelize[_0xf0a6('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x971c=['quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','name','ENUM','files','quietmp3nb'];(function(_0x3b34cf,_0x153318){var _0x2c91e1=function(_0x42969b){while(--_0x42969b){_0x3b34cf['push'](_0x3b34cf['shift']());}};_0x2c91e1(++_0x153318);}(_0x971c,0x7e));var _0xc971=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x971c[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');module[_0xc971('0x0')]={'name':{'type':Sequelize[_0xc971('0x1')],'allowNull':![],'unique':_0xc971('0x2')},'mode':{'type':Sequelize[_0xc971('0x3')]('custom',_0xc971('0x4'),'mp3nb',_0xc971('0x5'),_0xc971('0x6'),_0xc971('0x7')),'allowNull':!![],'defaultValue':_0xc971('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xc971('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xc971('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc971('0x8')},'format':{'type':Sequelize[_0xc971('0x1')],'allowNull':!![]},'stamp':{'type':_0xc971('0x9')},'defaultEntry':{'type':Sequelize[_0xc971('0xa')],'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 397f473..a11eb1b 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 _0xa4c4=['sendStatus','end','json','offset','undefined','count','limit','status','set','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceMusicOnHold','includeAll','include','findAll','catch','params','length','find','body','sequelize','mode','files','directory','join','root','server/files/moh','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MusicOnHolds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','message','removeSound','id2','createdAt','getSounds','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util'];(function(_0x1e85b2,_0x2ee9ee){var _0x108bdb=function(_0x3436d8){while(--_0x3436d8){_0x1e85b2['push'](_0x1e85b2['shift']());}};_0x108bdb(++_0x2ee9ee);}(_0xa4c4,0x1a6));var _0x4a4c=function(_0x3dd6ab,_0xaa4566){_0x3dd6ab=_0x3dd6ab-0x0;var _0x1e97c1=_0xa4c4[_0x3dd6ab];return _0x1e97c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a4c('0x0'));var zipdir=require(_0x4a4c('0x1'));var jsonpatch=require(_0x4a4c('0x2'));var rp=require('request-promise');var moment=require(_0x4a4c('0x3'));var BPromise=require(_0x4a4c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4a4c('0x5'));var sox=require(_0x4a4c('0x6'));var csv=require(_0x4a4c('0x7'));var ejs=require(_0x4a4c('0x8'));var fs=require('fs');var fs_extra=require(_0x4a4c('0x9'));var _=require(_0x4a4c('0xa'));var squel=require(_0x4a4c('0xb'));var crypto=require(_0x4a4c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4a4c('0xd'));var toCsv=require(_0x4a4c('0x7'));var querystring=require(_0x4a4c('0xe'));var Papa=require(_0x4a4c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4a4c('0x10'));var as=require(_0x4a4c('0x11'));var hardwareService=require(_0x4a4c('0x12'));var logger=require(_0x4a4c('0x13'))(_0x4a4c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4a4c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x537bf6,_0x126e1d){_0x126e1d=_0x126e1d||0xcc;return function(_0x4db003){if(_0x4db003){return _0x537bf6[_0x4a4c('0x16')](_0x126e1d);}return _0x537bf6['status'](_0x126e1d)[_0x4a4c('0x17')]();};}function respondWithResult(_0x90d3b3,_0x446d29){_0x446d29=_0x446d29||0xc8;return function(_0x18a19f){if(_0x18a19f){return _0x90d3b3['status'](_0x446d29)[_0x4a4c('0x18')](_0x18a19f);}};}function respondWithFilteredResult(_0x459cad,_0x18f454){return function(_0x3acd09){if(_0x3acd09){var _0x154659=typeof _0x18f454[_0x4a4c('0x19')]===_0x4a4c('0x1a')&&typeof _0x18f454['limit']==='undefined';var _0xc85b74=_0x3acd09[_0x4a4c('0x1b')];var _0x229e58=_0x154659?0x0:_0x18f454[_0x4a4c('0x19')];var _0x4159de=_0x154659?_0x3acd09[_0x4a4c('0x1b')]:_0x18f454[_0x4a4c('0x19')]+_0x18f454[_0x4a4c('0x1c')];var _0x468923;if(_0x4159de>=_0xc85b74){_0x4159de=_0xc85b74;_0x468923=0xc8;}else{_0x468923=0xce;}_0x459cad[_0x4a4c('0x1d')](_0x468923);return _0x459cad[_0x4a4c('0x1e')]('Content-Range',_0x229e58+'-'+_0x4159de+'/'+_0xc85b74)[_0x4a4c('0x18')](_0x3acd09);}return null;};}function patchUpdates(_0x3dd2ca){return function(_0x3a3727){try{jsonpatch[_0x4a4c('0x1f')](_0x3a3727,_0x3dd2ca,!![]);}catch(_0x582045){return BPromise['reject'](_0x582045);}return _0x3a3727[_0x4a4c('0x20')]();};}function saveUpdates(_0x432244,_0x42a4d4){return function(_0x48f86e){if(_0x48f86e){return _0x48f86e[_0x4a4c('0x21')](_0x432244)[_0x4a4c('0x22')](function(_0x4b6d2d){return _0x4b6d2d;});}return null;};}function removeEntity(_0x3660f9,_0x358029){return function(_0x162e89){if(_0x162e89){return _0x162e89[_0x4a4c('0x23')]()[_0x4a4c('0x22')](function(){var _0xa6567=_0x162e89[_0x4a4c('0x24')]({'plain':!![]});var _0x103eb4='MusicOnHolds';return db[_0x4a4c('0x25')]['destroy']({'where':{'type':_0x103eb4,'resourceId':_0xa6567['id']}})['then'](function(){return _0x162e89;});})['then'](function(){_0x3660f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59b898,_0x36ed78){return function(_0x4f3465){if(!_0x4f3465){_0x59b898[_0x4a4c('0x16')](0x194);}return _0x4f3465;};}function handleError(_0x46c1b1,_0xde31db){_0xde31db=_0xde31db||0x1f4;return function(_0x11dda3){logger[_0x4a4c('0x26')](_0x11dda3[_0x4a4c('0x27')]);if(_0x11dda3[_0x4a4c('0x28')]){delete _0x11dda3['name'];}_0x46c1b1['status'](_0xde31db)[_0x4a4c('0x29')](_0x11dda3);};}exports[_0x4a4c('0x2a')]=function(_0x4baa84,_0x314120){var _0x4688c3={},_0x503201={},_0x3e8257={'count':0x0,'rows':[]};var _0x342edf=_['map'](db['VoiceMusicOnHold'][_0x4a4c('0x2b')],function(_0x12f315){return{'name':_0x12f315[_0x4a4c('0x2c')],'type':_0x12f315[_0x4a4c('0x2d')][_0x4a4c('0x2e')]};});_0x503201[_0x4a4c('0x2f')]=_[_0x4a4c('0x30')](_0x342edf,_0x4a4c('0x28'));_0x503201[_0x4a4c('0x31')]=_[_0x4a4c('0x32')](_0x4baa84[_0x4a4c('0x31')]);_0x503201[_0x4a4c('0x33')]=_[_0x4a4c('0x34')](_0x503201[_0x4a4c('0x2f')],_0x503201['query']);_0x4688c3[_0x4a4c('0x35')]=_[_0x4a4c('0x34')](_0x503201['model'],qs[_0x4a4c('0x36')](_0x4baa84[_0x4a4c('0x31')][_0x4a4c('0x36')]));_0x4688c3['attributes']=_0x4688c3[_0x4a4c('0x35')]['length']?_0x4688c3[_0x4a4c('0x35')]:_0x503201[_0x4a4c('0x2f')];if(!_0x4baa84[_0x4a4c('0x31')]['hasOwnProperty'](_0x4a4c('0x37'))){_0x4688c3[_0x4a4c('0x1c')]=qs[_0x4a4c('0x1c')](_0x4baa84[_0x4a4c('0x31')]['limit']);_0x4688c3['offset']=qs[_0x4a4c('0x19')](_0x4baa84[_0x4a4c('0x31')][_0x4a4c('0x19')]);}_0x4688c3[_0x4a4c('0x38')]=qs[_0x4a4c('0x39')](_0x4baa84[_0x4a4c('0x31')][_0x4a4c('0x39')]);delete _0x4baa84['query'][_0x4a4c('0x39')];_0x4688c3[_0x4a4c('0x3a')]=qs[_0x4a4c('0x33')](_[_0x4a4c('0x3b')](_0x4baa84[_0x4a4c('0x31')],_0x503201[_0x4a4c('0x33')]),_0x342edf);if(_0x4baa84[_0x4a4c('0x31')]['filter']){_0x4688c3[_0x4a4c('0x3a')]=_[_0x4a4c('0x3c')](_0x4688c3[_0x4a4c('0x3a')],{'$or':_['map'](_0x342edf,function(_0xd6cefc){if(_0xd6cefc[_0x4a4c('0x2d')]!==_0x4a4c('0x3d')){var _0x233c5f={};_0x233c5f[_0xd6cefc[_0x4a4c('0x28')]]={'$like':'%'+_0x4baa84[_0x4a4c('0x31')][_0x4a4c('0x3e')]+'%'};return _0x233c5f;}})});}_0x4688c3=_[_0x4a4c('0x3c')]({},_0x4688c3,_0x4baa84[_0x4a4c('0x3f')]);var _0x134e96={'where':_0x4688c3['where']};return db[_0x4a4c('0x40')][_0x4a4c('0x1b')](_0x134e96)['then'](function(_0xb574bf){_0x3e8257[_0x4a4c('0x1b')]=_0xb574bf;if(_0x4baa84[_0x4a4c('0x31')][_0x4a4c('0x41')]){_0x4688c3[_0x4a4c('0x42')]=[{'all':!![]}];}return db[_0x4a4c('0x40')][_0x4a4c('0x43')](_0x4688c3);})[_0x4a4c('0x22')](function(_0x142b5e){_0x3e8257['rows']=_0x142b5e;return _0x3e8257;})[_0x4a4c('0x22')](respondWithFilteredResult(_0x314120,_0x4688c3))[_0x4a4c('0x44')](handleError(_0x314120,null));};exports['show']=function(_0x5464e6,_0x28793e){var _0x4784ef={'raw':![],'where':{'id':_0x5464e6[_0x4a4c('0x45')]['id']}},_0x321d64={};_0x321d64[_0x4a4c('0x2f')]=_[_0x4a4c('0x32')](db[_0x4a4c('0x40')]['rawAttributes']);_0x321d64['query']=_[_0x4a4c('0x32')](_0x5464e6['query']);_0x321d64[_0x4a4c('0x33')]=_[_0x4a4c('0x34')](_0x321d64['model'],_0x321d64[_0x4a4c('0x31')]);_0x4784ef[_0x4a4c('0x35')]=_[_0x4a4c('0x34')](_0x321d64['model'],qs[_0x4a4c('0x36')](_0x5464e6[_0x4a4c('0x31')][_0x4a4c('0x36')]));_0x4784ef[_0x4a4c('0x35')]=_0x4784ef[_0x4a4c('0x35')][_0x4a4c('0x46')]?_0x4784ef['attributes']:_0x321d64[_0x4a4c('0x2f')];if(_0x5464e6[_0x4a4c('0x31')][_0x4a4c('0x41')]){_0x4784ef['include']=[{'all':!![]}];}_0x4784ef=_['merge']({},_0x4784ef,_0x5464e6[_0x4a4c('0x3f')]);return db[_0x4a4c('0x40')][_0x4a4c('0x47')](_0x4784ef)[_0x4a4c('0x22')](handleEntityNotFound(_0x28793e,null))[_0x4a4c('0x22')](respondWithResult(_0x28793e,null))['catch'](handleError(_0x28793e,null));};exports['update']=function(_0x40c50b,_0x11e2f2){if(_0x40c50b[_0x4a4c('0x48')]['id']){delete _0x40c50b[_0x4a4c('0x48')]['id'];}return db[_0x4a4c('0x40')][_0x4a4c('0x47')]({'where':{'id':_0x40c50b['params']['id']}})['then'](handleEntityNotFound(_0x11e2f2,null))[_0x4a4c('0x22')](saveUpdates(_0x40c50b[_0x4a4c('0x48')],null))['then'](respondWithResult(_0x11e2f2,null))[_0x4a4c('0x44')](handleError(_0x11e2f2,null));};exports['create']=function(_0x124750,_0x58a55a,_0x5ce127){return db[_0x4a4c('0x49')]['transaction'](function(_0x11084a){if(_0x124750['body'][_0x4a4c('0x4a')]===_0x4a4c('0x4b')){_0x124750[_0x4a4c('0x48')][_0x4a4c('0x4c')]=path[_0x4a4c('0x4d')](config[_0x4a4c('0x4e')],_0x4a4c('0x4f'),_0x124750['body'][_0x4a4c('0x28')]);}return db['VoiceMusicOnHold'][_0x4a4c('0x50')](_0x124750[_0x4a4c('0x48')],{'transaction':_0x11084a})[_0x4a4c('0x22')](function(_0x204d6c){if(_0x124750[_0x4a4c('0x48')][_0x4a4c('0x4a')]===_0x4a4c('0x4b')){fs[_0x4a4c('0x51')](_0x204d6c['directory'],parseInt(_0x4a4c('0x52'),0x8));}var _0x130006=_0x124750[_0x4a4c('0x53')][_0x4a4c('0x24')]({'plain':!![]});if(!_0x130006)throw new Error(_0x4a4c('0x54'));if(_0x130006[_0x4a4c('0x55')]==='user'){var _0x3adc72=_0x204d6c[_0x4a4c('0x24')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x4a4c('0x56'),'userProfileId':_0x130006['userProfileId']},'raw':!![]})['then'](function(_0x17ae64){if(_0x17ae64&&_0x17ae64[_0x4a4c('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x3adc72['name'],'resourceId':_0x3adc72['id'],'type':_0x17ae64[_0x4a4c('0x28')],'sectionId':_0x17ae64['id']},{})[_0x4a4c('0x22')](function(){return _0x204d6c;});}else{return _0x204d6c;}})[_0x4a4c('0x44')](function(_0x1a4cf8){logger[_0x4a4c('0x26')](_0x4a4c('0x58'),_0x1a4cf8);});}return _0x204d6c;});})[_0x4a4c('0x22')](respondWithResult(_0x58a55a,0xc9))[_0x4a4c('0x44')](handleError(_0x58a55a,null));};exports[_0x4a4c('0x23')]=function(_0x127259,_0x35f3a5,_0x382b66){var _0x3dfb84;return db[_0x4a4c('0x40')][_0x4a4c('0x47')]({'where':{'id':_0x127259[_0x4a4c('0x45')]['id']}})[_0x4a4c('0x22')](function(_0x34ddb6){if(_0x34ddb6){return db[_0x4a4c('0x49')][_0x4a4c('0x59')](function(_0x422e7e){return _0x34ddb6[_0x4a4c('0x23')]({'transaction':_0x422e7e,'raw':!![]})[_0x4a4c('0x22')](function(_0x30daae){if(_0x30daae[_0x4a4c('0x4c')]){fs['readdirSync'](_0x30daae[_0x4a4c('0x4c')])[_0x4a4c('0x5a')](function(_0x4d071b){fs[_0x4a4c('0x5b')](path[_0x4a4c('0x4d')](_0x30daae[_0x4a4c('0x4c')],_0x4d071b));});fs[_0x4a4c('0x5c')](_0x30daae[_0x4a4c('0x4c')]);}return _0x30daae;});})['catch'](function(_0x1c895a){throw new db[(_0x4a4c('0x5d'))][(_0x4a4c('0x5e'))](_0x1c895a['message']);});}})[_0x4a4c('0x22')](handleEntityNotFound(_0x35f3a5,null))['then'](removeEntity(_0x35f3a5,null))[_0x4a4c('0x44')](handleError(_0x35f3a5,null));};exports[_0x4a4c('0x5f')]=function(_0x5acb94,_0x5ad7cf,_0xd8cef5){return db[_0x4a4c('0x49')][_0x4a4c('0x59')](function(_0x5dcb2a){var _0x2f68d8;return db[_0x4a4c('0x40')]['find']({'where':{'id':_0x5acb94['params']['id']}})[_0x4a4c('0x22')](function(_0x63f719){if(_0x63f719){_0x2f68d8=_0x63f719;return _0x63f719['addSound'](_0x5acb94[_0x4a4c('0x48')]['id'],{'transaction':_0x5dcb2a});}})['then'](function(_0x1a908b){if(_0x1a908b){return db[_0x4a4c('0x60')][_0x4a4c('0x61')]({'where':{'id':_0x5acb94[_0x4a4c('0x48')]['id']},'attributes':['id','name',_0x4a4c('0x62'),_0x4a4c('0x63'),'createdAt'],'raw':!![]});}})[_0x4a4c('0x22')](function(_0x3e91cb){if(_0x3e91cb){var _0x2d0cc5=path['join'](config[_0x4a4c('0x4e')],_0x4a4c('0x64'),util[_0x4a4c('0x65')](_0x4a4c('0x66'),path[_0x4a4c('0x67')](_0x3e91cb['save_name'],path[_0x4a4c('0x68')](_0x3e91cb[_0x4a4c('0x62')])),_0x3e91cb[_0x4a4c('0x63')]));var _0x20c910=path[_0x4a4c('0x4d')](config[_0x4a4c('0x4e')],_0x4a4c('0x4f'),_0x2f68d8['name'],util['format'](_0x4a4c('0x66'),_0x3e91cb[_0x4a4c('0x28')],_0x3e91cb[_0x4a4c('0x63')]));fs[_0x4a4c('0x69')](_0x2d0cc5,_0x20c910);return _0x3e91cb;}})[_0x4a4c('0x44')](function(_0x46a63b){throw new db[(_0x4a4c('0x5d'))]['ValidationError'](_0x46a63b[_0x4a4c('0x6a')]);});})[_0x4a4c('0x22')](handleEntityNotFound(_0x5ad7cf,null))[_0x4a4c('0x22')](respondWithResult(_0x5ad7cf,0xc9))['catch'](handleError(_0x5ad7cf,null));};exports[_0x4a4c('0x6b')]=function(_0x1e9cde,_0x944945,_0x220aea){return db[_0x4a4c('0x49')][_0x4a4c('0x59')](function(_0x5ac666){var _0x58cebd;return db[_0x4a4c('0x40')][_0x4a4c('0x61')]({'where':{'id':_0x1e9cde[_0x4a4c('0x45')]['id']}})['then'](handleEntityNotFound(_0x944945,null))['then'](function(_0x2c1fde){if(_0x2c1fde){_0x58cebd=_0x2c1fde;return _0x2c1fde[_0x4a4c('0x6b')](_0x1e9cde[_0x4a4c('0x45')][_0x4a4c('0x6c')]);}})['then'](function(_0x57ebf7){if(_0x57ebf7){return db[_0x4a4c('0x60')]['findOne']({'where':{'id':_0x1e9cde[_0x4a4c('0x45')][_0x4a4c('0x6c')]},'attributes':['id',_0x4a4c('0x28'),_0x4a4c('0x62'),_0x4a4c('0x63'),_0x4a4c('0x6d')],'raw':!![]});}})[_0x4a4c('0x22')](function(_0x2a61d8){if(_0x2a61d8){fs[_0x4a4c('0x5b')](path[_0x4a4c('0x4d')](_0x58cebd[_0x4a4c('0x4c')],util['format']('%s.%s',_0x2a61d8[_0x4a4c('0x28')],_0x2a61d8[_0x4a4c('0x63')])));return _0x2a61d8;}})[_0x4a4c('0x44')](function(_0x198489){throw new db[(_0x4a4c('0x5d'))][(_0x4a4c('0x5e'))](_0x198489[_0x4a4c('0x6a')]);});})[_0x4a4c('0x22')](handleEntityNotFound(_0x944945,null))['then'](respondWithStatusCode(_0x944945,0xcc))['catch'](handleError(_0x944945,null));};exports[_0x4a4c('0x6e')]=function(_0xf769f,_0x57445f,_0xef0f61){var _0x21f6dc={};var _0x5353d5={};var _0x2dead5;var _0x997d80;return db[_0x4a4c('0x40')]['findOne']({'where':{'id':_0xf769f[_0x4a4c('0x45')]['id']}})[_0x4a4c('0x22')](handleEntityNotFound(_0x57445f,null))[_0x4a4c('0x22')](function(_0x333bb0){if(_0x333bb0){_0x2dead5=_0x333bb0;_0x5353d5[_0x4a4c('0x2f')]=_[_0x4a4c('0x32')](db['Sound'][_0x4a4c('0x2b')]);_0x5353d5[_0x4a4c('0x31')]=_[_0x4a4c('0x32')](_0xf769f[_0x4a4c('0x31')]);_0x5353d5[_0x4a4c('0x33')]=_['intersection'](_0x5353d5['model'],_0x5353d5['query']);_0x21f6dc[_0x4a4c('0x35')]=_[_0x4a4c('0x34')](_0x5353d5[_0x4a4c('0x2f')],qs['fields'](_0xf769f[_0x4a4c('0x31')][_0x4a4c('0x36')]));_0x21f6dc['attributes']=_0x21f6dc[_0x4a4c('0x35')][_0x4a4c('0x46')]?_0x21f6dc['attributes']:_0x5353d5[_0x4a4c('0x2f')];_0x21f6dc[_0x4a4c('0x38')]=qs[_0x4a4c('0x39')](_0xf769f[_0x4a4c('0x31')][_0x4a4c('0x39')]);_0x21f6dc['where']=qs[_0x4a4c('0x33')](_[_0x4a4c('0x3b')](_0xf769f[_0x4a4c('0x31')],_0x5353d5[_0x4a4c('0x33')]));if(_0xf769f[_0x4a4c('0x31')][_0x4a4c('0x3e')]){_0x21f6dc['where']=_[_0x4a4c('0x3c')](_0x21f6dc[_0x4a4c('0x3a')],{'$or':_[_0x4a4c('0x30')](_0x21f6dc[_0x4a4c('0x35')],function(_0x4d1696){var _0x1e2978={};_0x1e2978[_0x4d1696]={'$like':'%'+_0xf769f[_0x4a4c('0x31')]['filter']+'%'};return _0x1e2978;})});}_0x21f6dc=_[_0x4a4c('0x3c')]({},_0x21f6dc,_0xf769f['options']);return _0x2dead5[_0x4a4c('0x6e')](_0x21f6dc);}})[_0x4a4c('0x22')](function(_0x183581){if(_0x183581){_0x997d80=_0x183581[_0x4a4c('0x46')];if(!_0xf769f[_0x4a4c('0x31')]['hasOwnProperty'](_0x4a4c('0x37'))){_0x21f6dc[_0x4a4c('0x1c')]=qs[_0x4a4c('0x1c')](_0xf769f[_0x4a4c('0x31')][_0x4a4c('0x1c')]);_0x21f6dc[_0x4a4c('0x19')]=qs[_0x4a4c('0x19')](_0xf769f[_0x4a4c('0x31')][_0x4a4c('0x19')]);}return _0x2dead5[_0x4a4c('0x6e')](_0x21f6dc);}})[_0x4a4c('0x22')](function(_0x3107bc){if(_0x3107bc){return _0x3107bc?{'count':_0x997d80,'rows':_0x3107bc}:null;}})[_0x4a4c('0x22')](respondWithResult(_0x57445f,null))[_0x4a4c('0x44')](handleError(_0x57445f,null));}; \ No newline at end of file +var _0x44eb=['../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','update','body','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','forEach','unlinkSync','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','removeSound','id2','ValidationError','getSounds','order','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','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44eb,0x1bd));var _0xb44e=function(_0x2ddf0c,_0x134849){_0x2ddf0c=_0x2ddf0c-0x0;var _0x1cb3d2=_0x44eb[_0x2ddf0c];return _0x1cb3d2;};'use strict';var emlformat=require(_0xb44e('0x0'));var rimraf=require(_0xb44e('0x1'));var zipdir=require(_0xb44e('0x2'));var jsonpatch=require(_0xb44e('0x3'));var rp=require(_0xb44e('0x4'));var moment=require(_0xb44e('0x5'));var BPromise=require(_0xb44e('0x6'));var Mustache=require(_0xb44e('0x7'));var util=require(_0xb44e('0x8'));var path=require(_0xb44e('0x9'));var sox=require('sox');var csv=require(_0xb44e('0xa'));var ejs=require(_0xb44e('0xb'));var fs=require('fs');var fs_extra=require(_0xb44e('0xc'));var _=require(_0xb44e('0xd'));var squel=require(_0xb44e('0xe'));var crypto=require(_0xb44e('0xf'));var jsforce=require(_0xb44e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb44e('0xa'));var querystring=require(_0xb44e('0x11'));var Papa=require('papaparse');var Redis=require(_0xb44e('0x12'));var authService=require(_0xb44e('0x13'));var qs=require(_0xb44e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb44e('0x15'));var utils=require('../../config/utils');var config=require(_0xb44e('0x16'));var licenseUtil=require(_0xb44e('0x17'));var db=require(_0xb44e('0x18'))['db'];function respondWithStatusCode(_0x36b437,_0x518eb0){_0x518eb0=_0x518eb0||0xcc;return function(_0x32a18c){if(_0x32a18c){return _0x36b437[_0xb44e('0x19')](_0x518eb0);}return _0x36b437[_0xb44e('0x1a')](_0x518eb0)[_0xb44e('0x1b')]();};}function respondWithResult(_0x335d7c,_0x589140){_0x589140=_0x589140||0xc8;return function(_0x354ac2){if(_0x354ac2){return _0x335d7c[_0xb44e('0x1a')](_0x589140)[_0xb44e('0x1c')](_0x354ac2);}};}function respondWithFilteredResult(_0x53129d,_0xac8c2b){return function(_0xb22e11){if(_0xb22e11){var _0x7e022b=typeof _0xac8c2b[_0xb44e('0x1d')]===_0xb44e('0x1e')&&typeof _0xac8c2b['limit']===_0xb44e('0x1e');var _0x3cafff=_0xb22e11[_0xb44e('0x1f')];var _0x1d83d4=_0x7e022b?0x0:_0xac8c2b['offset'];var _0x410ba5=_0x7e022b?_0xb22e11[_0xb44e('0x1f')]:_0xac8c2b[_0xb44e('0x1d')]+_0xac8c2b[_0xb44e('0x20')];var _0x3cb6d6;if(_0x410ba5>=_0x3cafff){_0x410ba5=_0x3cafff;_0x3cb6d6=0xc8;}else{_0x3cb6d6=0xce;}_0x53129d[_0xb44e('0x1a')](_0x3cb6d6);return _0x53129d[_0xb44e('0x21')](_0xb44e('0x22'),_0x1d83d4+'-'+_0x410ba5+'/'+_0x3cafff)[_0xb44e('0x1c')](_0xb22e11);}return null;};}function patchUpdates(_0x40f58c){return function(_0x1cbdd2){try{jsonpatch[_0xb44e('0x23')](_0x1cbdd2,_0x40f58c,!![]);}catch(_0x247ca1){return BPromise[_0xb44e('0x24')](_0x247ca1);}return _0x1cbdd2['save']();};}function saveUpdates(_0x5b5d30,_0x279967){return function(_0x2859ca){if(_0x2859ca){return _0x2859ca['update'](_0x5b5d30)[_0xb44e('0x25')](function(_0x2c453c){return _0x2c453c;});}return null;};}function removeEntity(_0x3a2609,_0x51ec43){return function(_0x4f9161){if(_0x4f9161){return _0x4f9161[_0xb44e('0x26')]()[_0xb44e('0x25')](function(){var _0x5df69e=_0x4f9161[_0xb44e('0x27')]({'plain':!![]});var _0x42b20c=_0xb44e('0x28');return db[_0xb44e('0x29')]['destroy']({'where':{'type':_0x42b20c,'resourceId':_0x5df69e['id']}})[_0xb44e('0x25')](function(){return _0x4f9161;});})['then'](function(){_0x3a2609[_0xb44e('0x1a')](0xcc)[_0xb44e('0x1b')]();});}};}function handleEntityNotFound(_0x3c2a0a,_0x27c36b){return function(_0x33d404){if(!_0x33d404){_0x3c2a0a['sendStatus'](0x194);}return _0x33d404;};}function handleError(_0x14296a,_0x1ec934){_0x1ec934=_0x1ec934||0x1f4;return function(_0x23805d){logger['error'](_0x23805d[_0xb44e('0x2a')]);if(_0x23805d[_0xb44e('0x2b')]){delete _0x23805d[_0xb44e('0x2b')];}_0x14296a['status'](_0x1ec934)[_0xb44e('0x2c')](_0x23805d);};}exports[_0xb44e('0x2d')]=function(_0x4d17b3,_0x5ddf00){var _0x255f07={},_0x223b08={},_0x58c039={'count':0x0,'rows':[]};var _0x5ddcd2=_[_0xb44e('0x2e')](db[_0xb44e('0x2f')]['rawAttributes'],function(_0x5ead30){return{'name':_0x5ead30[_0xb44e('0x30')],'type':_0x5ead30[_0xb44e('0x31')][_0xb44e('0x32')]};});_0x223b08[_0xb44e('0x33')]=_[_0xb44e('0x2e')](_0x5ddcd2,'name');_0x223b08['query']=_[_0xb44e('0x34')](_0x4d17b3[_0xb44e('0x35')]);_0x223b08[_0xb44e('0x36')]=_[_0xb44e('0x37')](_0x223b08['model'],_0x223b08[_0xb44e('0x35')]);_0x255f07[_0xb44e('0x38')]=_[_0xb44e('0x37')](_0x223b08[_0xb44e('0x33')],qs[_0xb44e('0x39')](_0x4d17b3[_0xb44e('0x35')][_0xb44e('0x39')]));_0x255f07[_0xb44e('0x38')]=_0x255f07[_0xb44e('0x38')][_0xb44e('0x3a')]?_0x255f07[_0xb44e('0x38')]:_0x223b08[_0xb44e('0x33')];if(!_0x4d17b3['query'][_0xb44e('0x3b')](_0xb44e('0x3c'))){_0x255f07[_0xb44e('0x20')]=qs[_0xb44e('0x20')](_0x4d17b3[_0xb44e('0x35')]['limit']);_0x255f07[_0xb44e('0x1d')]=qs['offset'](_0x4d17b3[_0xb44e('0x35')][_0xb44e('0x1d')]);}_0x255f07['order']=qs['sort'](_0x4d17b3[_0xb44e('0x35')]['sort']);delete _0x4d17b3[_0xb44e('0x35')][_0xb44e('0x3d')];_0x255f07[_0xb44e('0x3e')]=qs[_0xb44e('0x36')](_[_0xb44e('0x3f')](_0x4d17b3[_0xb44e('0x35')],_0x223b08['filters']),_0x5ddcd2);if(_0x4d17b3['query']['filter']){_0x255f07[_0xb44e('0x3e')]=_['merge'](_0x255f07[_0xb44e('0x3e')],{'$or':_[_0xb44e('0x2e')](_0x5ddcd2,function(_0x258d2e){if(_0x258d2e[_0xb44e('0x31')]!==_0xb44e('0x40')){var _0x7fedeb={};_0x7fedeb[_0x258d2e[_0xb44e('0x2b')]]={'$like':'%'+_0x4d17b3[_0xb44e('0x35')][_0xb44e('0x41')]+'%'};return _0x7fedeb;}})});}_0x255f07=_[_0xb44e('0x42')]({},_0x255f07,_0x4d17b3[_0xb44e('0x43')]);var _0x5d66db={'where':_0x255f07[_0xb44e('0x3e')]};return db[_0xb44e('0x2f')][_0xb44e('0x1f')](_0x5d66db)[_0xb44e('0x25')](function(_0xcf3506){_0x58c039[_0xb44e('0x1f')]=_0xcf3506;if(_0x4d17b3[_0xb44e('0x35')][_0xb44e('0x44')]){_0x255f07['include']=[{'all':!![]}];}return db[_0xb44e('0x2f')][_0xb44e('0x45')](_0x255f07);})[_0xb44e('0x25')](function(_0x36b0ac){_0x58c039[_0xb44e('0x46')]=_0x36b0ac;return _0x58c039;})[_0xb44e('0x25')](respondWithFilteredResult(_0x5ddf00,_0x255f07))[_0xb44e('0x47')](handleError(_0x5ddf00,null));};exports[_0xb44e('0x48')]=function(_0x3c6b69,_0xa20e52){var _0x4bcee0={'raw':![],'where':{'id':_0x3c6b69[_0xb44e('0x49')]['id']}},_0x4afdee={};_0x4afdee[_0xb44e('0x33')]=_[_0xb44e('0x34')](db[_0xb44e('0x2f')][_0xb44e('0x4a')]);_0x4afdee[_0xb44e('0x35')]=_[_0xb44e('0x34')](_0x3c6b69['query']);_0x4afdee[_0xb44e('0x36')]=_[_0xb44e('0x37')](_0x4afdee[_0xb44e('0x33')],_0x4afdee[_0xb44e('0x35')]);_0x4bcee0[_0xb44e('0x38')]=_[_0xb44e('0x37')](_0x4afdee[_0xb44e('0x33')],qs['fields'](_0x3c6b69[_0xb44e('0x35')][_0xb44e('0x39')]));_0x4bcee0[_0xb44e('0x38')]=_0x4bcee0[_0xb44e('0x38')]['length']?_0x4bcee0[_0xb44e('0x38')]:_0x4afdee['model'];if(_0x3c6b69[_0xb44e('0x35')][_0xb44e('0x44')]){_0x4bcee0[_0xb44e('0x4b')]=[{'all':!![]}];}_0x4bcee0=_['merge']({},_0x4bcee0,_0x3c6b69[_0xb44e('0x43')]);return db['VoiceMusicOnHold'][_0xb44e('0x4c')](_0x4bcee0)[_0xb44e('0x25')](handleEntityNotFound(_0xa20e52,null))['then'](respondWithResult(_0xa20e52,null))[_0xb44e('0x47')](handleError(_0xa20e52,null));};exports[_0xb44e('0x4d')]=function(_0x45d412,_0x5a2552){if(_0x45d412['body']['id']){delete _0x45d412[_0xb44e('0x4e')]['id'];}return db[_0xb44e('0x2f')]['find']({'where':{'id':_0x45d412[_0xb44e('0x49')]['id']}})['then'](handleEntityNotFound(_0x5a2552,null))[_0xb44e('0x25')](saveUpdates(_0x45d412[_0xb44e('0x4e')],null))[_0xb44e('0x25')](respondWithResult(_0x5a2552,null))[_0xb44e('0x47')](handleError(_0x5a2552,null));};exports[_0xb44e('0x4f')]=function(_0x8ad304,_0x119076,_0x49de0a){return db['sequelize'][_0xb44e('0x50')](function(_0x1a5ddd){if(_0x8ad304['body'][_0xb44e('0x51')]===_0xb44e('0x52')){_0x8ad304[_0xb44e('0x4e')][_0xb44e('0x53')]=path[_0xb44e('0x54')](config[_0xb44e('0x55')],_0xb44e('0x56'),_0x8ad304[_0xb44e('0x4e')][_0xb44e('0x2b')]);}return db[_0xb44e('0x2f')][_0xb44e('0x4f')](_0x8ad304[_0xb44e('0x4e')],{'transaction':_0x1a5ddd})['then'](function(_0x29b811){if(_0x8ad304[_0xb44e('0x4e')][_0xb44e('0x51')]===_0xb44e('0x52')){fs[_0xb44e('0x57')](_0x29b811[_0xb44e('0x53')],parseInt('0777',0x8));}var _0x30a64a=_0x8ad304['user']['get']({'plain':!![]});if(!_0x30a64a)throw new Error(_0xb44e('0x58'));if(_0x30a64a[_0xb44e('0x59')]===_0xb44e('0x5a')){var _0x1272ae=_0x29b811[_0xb44e('0x27')]({'plain':!![]});return db[_0xb44e('0x5b')][_0xb44e('0x4c')]({'where':{'name':_0xb44e('0x28'),'userProfileId':_0x30a64a['userProfileId']},'raw':!![]})[_0xb44e('0x25')](function(_0x32848c){if(_0x32848c&&_0x32848c['autoAssociation']===0x0){return db[_0xb44e('0x29')][_0xb44e('0x4f')]({'name':_0x1272ae[_0xb44e('0x2b')],'resourceId':_0x1272ae['id'],'type':_0x32848c[_0xb44e('0x2b')],'sectionId':_0x32848c['id']},{})[_0xb44e('0x25')](function(){return _0x29b811;});}else{return _0x29b811;}})[_0xb44e('0x47')](function(_0x466e1a){logger[_0xb44e('0x5c')](_0xb44e('0x5d'),_0x466e1a);});}return _0x29b811;});})['then'](respondWithResult(_0x119076,0xc9))[_0xb44e('0x47')](handleError(_0x119076,null));};exports[_0xb44e('0x26')]=function(_0xf0b91d,_0x5349b6,_0x1cc359){var _0x149be2;return db[_0xb44e('0x2f')]['find']({'where':{'id':_0xf0b91d[_0xb44e('0x49')]['id']}})[_0xb44e('0x25')](function(_0xfaabee){if(_0xfaabee){return db[_0xb44e('0x5e')]['transaction'](function(_0x20a604){return _0xfaabee[_0xb44e('0x26')]({'transaction':_0x20a604,'raw':!![]})[_0xb44e('0x25')](function(_0x57c1b4){if(_0x57c1b4['directory']){fs['readdirSync'](_0x57c1b4[_0xb44e('0x53')])[_0xb44e('0x5f')](function(_0x107742){fs[_0xb44e('0x60')](path['join'](_0x57c1b4[_0xb44e('0x53')],_0x107742));});fs['rmdirSync'](_0x57c1b4['directory']);}return _0x57c1b4;});})[_0xb44e('0x47')](function(_0x17cd44){throw new db['Sequelize']['ValidationError'](_0x17cd44[_0xb44e('0x61')]);});}})[_0xb44e('0x25')](handleEntityNotFound(_0x5349b6,null))[_0xb44e('0x25')](removeEntity(_0x5349b6,null))['catch'](handleError(_0x5349b6,null));};exports[_0xb44e('0x62')]=function(_0x45be3f,_0x269563,_0x196d73){return db[_0xb44e('0x5e')][_0xb44e('0x50')](function(_0x333cf0){var _0x224dd5;return db[_0xb44e('0x2f')][_0xb44e('0x4c')]({'where':{'id':_0x45be3f[_0xb44e('0x49')]['id']}})[_0xb44e('0x25')](function(_0x15c62f){if(_0x15c62f){_0x224dd5=_0x15c62f;return _0x15c62f[_0xb44e('0x62')](_0x45be3f[_0xb44e('0x4e')]['id'],{'transaction':_0x333cf0});}})[_0xb44e('0x25')](function(_0x132431){if(_0x132431){return db[_0xb44e('0x63')][_0xb44e('0x64')]({'where':{'id':_0x45be3f[_0xb44e('0x4e')]['id']},'attributes':['id','name',_0xb44e('0x65'),_0xb44e('0x66'),_0xb44e('0x67')],'raw':!![]});}})['then'](function(_0x5d90ae){if(_0x5d90ae){var _0x147b9b=path[_0xb44e('0x54')](config[_0xb44e('0x55')],_0xb44e('0x68'),util[_0xb44e('0x69')](_0xb44e('0x6a'),path[_0xb44e('0x6b')](_0x5d90ae[_0xb44e('0x65')],path[_0xb44e('0x6c')](_0x5d90ae[_0xb44e('0x65')])),_0x5d90ae[_0xb44e('0x66')]));var _0x923506=path['join'](config[_0xb44e('0x55')],_0xb44e('0x56'),_0x224dd5['name'],util[_0xb44e('0x69')](_0xb44e('0x6a'),_0x5d90ae['name'],_0x5d90ae['converted_format']));fs[_0xb44e('0x6d')](_0x147b9b,_0x923506);return _0x5d90ae;}})[_0xb44e('0x47')](function(_0x295991){throw new db[(_0xb44e('0x6e'))]['ValidationError'](_0x295991[_0xb44e('0x61')]);});})[_0xb44e('0x25')](handleEntityNotFound(_0x269563,null))[_0xb44e('0x25')](respondWithResult(_0x269563,0xc9))['catch'](handleError(_0x269563,null));};exports[_0xb44e('0x6f')]=function(_0x19cda9,_0x1e8735,_0x3057c8){return db[_0xb44e('0x5e')][_0xb44e('0x50')](function(_0x247b1a){var _0x550f9b;return db[_0xb44e('0x2f')]['findOne']({'where':{'id':_0x19cda9['params']['id']}})[_0xb44e('0x25')](handleEntityNotFound(_0x1e8735,null))[_0xb44e('0x25')](function(_0x37807b){if(_0x37807b){_0x550f9b=_0x37807b;return _0x37807b[_0xb44e('0x6f')](_0x19cda9['params'][_0xb44e('0x70')]);}})['then'](function(_0xcf78ca){if(_0xcf78ca){return db[_0xb44e('0x63')][_0xb44e('0x64')]({'where':{'id':_0x19cda9['params'][_0xb44e('0x70')]},'attributes':['id',_0xb44e('0x2b'),'save_name','converted_format',_0xb44e('0x67')],'raw':!![]});}})[_0xb44e('0x25')](function(_0x5bd484){if(_0x5bd484){fs[_0xb44e('0x60')](path['join'](_0x550f9b[_0xb44e('0x53')],util[_0xb44e('0x69')](_0xb44e('0x6a'),_0x5bd484[_0xb44e('0x2b')],_0x5bd484[_0xb44e('0x66')])));return _0x5bd484;}})[_0xb44e('0x47')](function(_0x299b8c){throw new db[(_0xb44e('0x6e'))][(_0xb44e('0x71'))](_0x299b8c[_0xb44e('0x61')]);});})['then'](handleEntityNotFound(_0x1e8735,null))['then'](respondWithStatusCode(_0x1e8735,0xcc))['catch'](handleError(_0x1e8735,null));};exports[_0xb44e('0x72')]=function(_0x54c4e1,_0x31728c,_0x355167){var _0x1c2db0={};var _0x564e06={};var _0x230a93;var _0x2a4c90;return db[_0xb44e('0x2f')][_0xb44e('0x64')]({'where':{'id':_0x54c4e1[_0xb44e('0x49')]['id']}})[_0xb44e('0x25')](handleEntityNotFound(_0x31728c,null))[_0xb44e('0x25')](function(_0x4fccca){if(_0x4fccca){_0x230a93=_0x4fccca;_0x564e06[_0xb44e('0x33')]=_[_0xb44e('0x34')](db['Sound'][_0xb44e('0x4a')]);_0x564e06[_0xb44e('0x35')]=_[_0xb44e('0x34')](_0x54c4e1[_0xb44e('0x35')]);_0x564e06[_0xb44e('0x36')]=_[_0xb44e('0x37')](_0x564e06[_0xb44e('0x33')],_0x564e06[_0xb44e('0x35')]);_0x1c2db0[_0xb44e('0x38')]=_[_0xb44e('0x37')](_0x564e06[_0xb44e('0x33')],qs[_0xb44e('0x39')](_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x39')]));_0x1c2db0[_0xb44e('0x38')]=_0x1c2db0[_0xb44e('0x38')][_0xb44e('0x3a')]?_0x1c2db0[_0xb44e('0x38')]:_0x564e06['model'];_0x1c2db0[_0xb44e('0x73')]=qs[_0xb44e('0x3d')](_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x3d')]);_0x1c2db0[_0xb44e('0x3e')]=qs['filters'](_['pick'](_0x54c4e1[_0xb44e('0x35')],_0x564e06[_0xb44e('0x36')]));if(_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x41')]){_0x1c2db0[_0xb44e('0x3e')]=_[_0xb44e('0x42')](_0x1c2db0['where'],{'$or':_[_0xb44e('0x2e')](_0x1c2db0[_0xb44e('0x38')],function(_0x41aace){var _0x5c57a7={};_0x5c57a7[_0x41aace]={'$like':'%'+_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x41')]+'%'};return _0x5c57a7;})});}_0x1c2db0=_[_0xb44e('0x42')]({},_0x1c2db0,_0x54c4e1[_0xb44e('0x43')]);return _0x230a93['getSounds'](_0x1c2db0);}})[_0xb44e('0x25')](function(_0x3f5007){if(_0x3f5007){_0x2a4c90=_0x3f5007[_0xb44e('0x3a')];if(!_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x3b')](_0xb44e('0x3c'))){_0x1c2db0[_0xb44e('0x20')]=qs[_0xb44e('0x20')](_0x54c4e1[_0xb44e('0x35')]['limit']);_0x1c2db0['offset']=qs[_0xb44e('0x1d')](_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x1d')]);}return _0x230a93[_0xb44e('0x72')](_0x1c2db0);}})['then'](function(_0x254d0d){if(_0x254d0d){return _0x254d0d?{'count':_0x2a4c90,'rows':_0x254d0d}:null;}})[_0xb44e('0x25')](respondWithResult(_0x31728c,null))['catch'](handleError(_0x31728c,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4f91d83..a8346a2 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 _0x965a=['define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','path','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x35c48b,_0x55d8f0){var _0x30b87f=function(_0x550af6){while(--_0x550af6){_0x35c48b['push'](_0x35c48b['shift']());}};_0x30b87f(++_0x55d8f0);}(_0x965a,0x147));var _0xa965=function(_0x5ccefa,_0x427802){_0x5ccefa=_0x5ccefa-0x0;var _0x2bcf8e=_0x965a[_0x5ccefa];return _0x2bcf8e;};'use strict';var _=require(_0xa965('0x0'));var util=require(_0xa965('0x1'));var logger=require('../../config/logger')(_0xa965('0x2'));var moment=require(_0xa965('0x3'));var BPromise=require(_0xa965('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa965('0x5'));var rimraf=require('rimraf');var config=require(_0xa965('0x6'));var attributes=require(_0xa965('0x7'));module[_0xa965('0x8')]=function(_0x243e53,_0x4ecaa5){return _0x243e53[_0xa965('0x9')](_0xa965('0xa'),attributes,{'tableName':_0xa965('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe73a=['exports','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceMusicOnHold.attributes'];(function(_0x146e40,_0x24db42){var _0x4b0ba6=function(_0xc1229b){while(--_0xc1229b){_0x146e40['push'](_0x146e40['shift']());}};_0x4b0ba6(++_0x24db42);}(_0xe73a,0x12b));var _0xae73=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0xe73a[_0x40dd56];return _0x4f850f;};'use strict';var _=require(_0xae73('0x0'));var util=require(_0xae73('0x1'));var logger=require(_0xae73('0x2'))(_0xae73('0x3'));var moment=require(_0xae73('0x4'));var BPromise=require(_0xae73('0x5'));var rp=require(_0xae73('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae73('0x7'));var config=require('../../config/environment');var attributes=require(_0xae73('0x8'));module[_0xae73('0x9')]=function(_0x41c95f,_0x1fcd00){return _0x41c95f['define'](_0xae73('0xa'),attributes,{'tableName':'voice_musiconhold','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 98277d5..4a9b590 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x24212b,_0x19cd79){var _0x5319d7=function(_0x48a80c){while(--_0x48a80c){_0x24212b['push'](_0x24212b['shift']());}};_0x5319d7(++_0x19cd79);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xcb91[_0x111e94];return _0x3de107;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +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(_0x52c0b3,_0x294511){var _0x5d3408=function(_0x38ceb8){while(--_0x38ceb8){_0x52c0b3['push'](_0x52c0b3['shift']());}};_0x5d3408(++_0x294511);}(_0x34e8,0x12c));var _0x834e=function(_0x45d5a8,_0x1dfd1e){_0x45d5a8=_0x45d5a8-0x0;var _0x57733d=_0x34e8[_0x45d5a8];return _0x57733d;};'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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7e7ac10..083e3b3 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 _0x00bb=['describe','/:id','/:id/users','getAgents','create','post','addAgents','addTeams','delete','removeAgents','/:id/teams','removeTeams','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','/describe','isAuthenticated'];(function(_0x3527eb,_0x2a1ddc){var _0x449056=function(_0x3d5b6e){while(--_0x3d5b6e){_0x3527eb['push'](_0x3527eb['shift']());}};_0x449056(++_0x2a1ddc);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var fs_extra=require(_0xb00b('0x4'));var auth=require(_0xb00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x6'));var controller=require(_0xb00b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb00b('0x8')](_0xb00b('0x9'),auth[_0xb00b('0xa')](),controller[_0xb00b('0xb')]);router[_0xb00b('0x8')](_0xb00b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb00b('0x8')](_0xb00b('0xd'),auth[_0xb00b('0xa')](),controller[_0xb00b('0xe')]);router[_0xb00b('0x8')]('/:id/teams',auth[_0xb00b('0xa')](),controller['getTeams']);router['post']('/',auth['isAuthenticated'](),controller[_0xb00b('0xf')]);router[_0xb00b('0x10')](_0xb00b('0xd'),auth[_0xb00b('0xa')](),controller[_0xb00b('0x11')]);router[_0xb00b('0x10')]('/:id/teams',auth[_0xb00b('0xa')](),controller[_0xb00b('0x12')]);router['put'](_0xb00b('0xc'),auth[_0xb00b('0xa')](),controller['update']);router['delete'](_0xb00b('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0xb00b('0x13')](_0xb00b('0xd'),auth[_0xb00b('0xa')](),controller[_0xb00b('0x14')]);router['delete'](_0xb00b('0x15'),auth['isAuthenticated'](),controller[_0xb00b('0x16')]);module['exports']=router; \ No newline at end of file +var _0xea31=['removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','put','update','delete'];(function(_0x245c4f,_0x34b70f){var _0x3157a1=function(_0x18bfc7){while(--_0x18bfc7){_0x245c4f['push'](_0x245c4f['shift']());}};_0x3157a1(++_0x34b70f);}(_0xea31,0x6b));var _0x1ea3=function(_0x414aa8,_0x5e47c7){_0x414aa8=_0x414aa8-0x0;var _0x3a3465=_0xea31[_0x414aa8];return _0x3a3465;};'use strict';var multer=require(_0x1ea3('0x0'));var util=require('util');var path=require(_0x1ea3('0x1'));var timeout=require(_0x1ea3('0x2'));var express=require(_0x1ea3('0x3'));var router=express[_0x1ea3('0x4')]();var fs_extra=require(_0x1ea3('0x5'));var auth=require(_0x1ea3('0x6'));var interaction=require(_0x1ea3('0x7'));var config=require('../../config/environment');var controller=require(_0x1ea3('0x8'));router[_0x1ea3('0x9')]('/',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xb')]);router[_0x1ea3('0x9')]('/describe',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xc')]);router[_0x1ea3('0x9')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xe')]);router['get'](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x10')]);router[_0x1ea3('0x9')](_0x1ea3('0x11'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x12')]);router['post']('/',auth[_0x1ea3('0xa')](),controller['create']);router[_0x1ea3('0x13')](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller['addAgents']);router[_0x1ea3('0x13')](_0x1ea3('0x11'),auth[_0x1ea3('0xa')](),controller['addTeams']);router[_0x1ea3('0x14')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x15')]);router[_0x1ea3('0x16')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller['destroy']);router[_0x1ea3('0x16')](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x17')]);router[_0x1ea3('0x16')]('/:id/teams',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x18')]);module[_0x1ea3('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 956882c..03bd5c8 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 _0x90e7=['exports','STRING','name','getDataValue','INTEGER'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0x90e7,0xc8));var _0x790e=function(_0x5cd5df,_0x5d087c){_0x5cd5df=_0x5cd5df-0x0;var _0x596175=_0x90e7[_0x5cd5df];return _0x596175;};'use strict';var Sequelize=require('sequelize');module[_0x790e('0x0')]={'name':{'type':Sequelize[_0x790e('0x1')],'allowNull':![],'unique':_0x790e('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x34277d){return'system-'+this[_0x790e('0x3')](_0x790e('0x2'))+'-';}},'description':{'type':Sequelize[_0x790e('0x1')]},'callerIdAll':{'type':Sequelize[_0x790e('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x790e('0x4')]}}; \ No newline at end of file +var _0x1867=['name','VIRTUAL','system-','sequelize','exports','STRING'];(function(_0x1a5c37,_0x3ae3fa){var _0x37a7a3=function(_0xa55b92){while(--_0xa55b92){_0x1a5c37['push'](_0x1a5c37['shift']());}};_0x37a7a3(++_0x3ae3fa);}(_0x1867,0x10b));var _0x7186=function(_0x4f216c,_0x90d479){_0x4f216c=_0x4f216c-0x0;var _0x32eca8=_0x1867[_0x4f216c];return _0x32eca8;};'use strict';var Sequelize=require(_0x7186('0x0'));module[_0x7186('0x1')]={'name':{'type':Sequelize[_0x7186('0x2')],'allowNull':![],'unique':_0x7186('0x3')},'prefix':{'type':Sequelize[_0x7186('0x4')],'get':function(_0x4f505d){return _0x7186('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x7186('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 56c2e89..f6e7922 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 _0x1c7c=['isArray','userVoicePrefix:remove','getAgents','findOne','keys','User','order','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoicePrefix','includeAll','findAll','rows','catch','show','include','find','describe','sequelize','transaction','create','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','addAgents','params','omit','ids','emit','userVoicePrefix:save','removeAgents'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c7c,0x164));var _0xc1c7=function(_0x4979f3,_0x4a0182){_0x4979f3=_0x4979f3-0x0;var _0x216d2c=_0x1c7c[_0x4979f3];return _0x216d2c;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];config[_0xc1c7('0x1b')]=_[_0xc1c7('0x1c')](config[_0xc1c7('0x1b')],{'host':_0xc1c7('0x1d'),'port':0x18eb});var socket=require(_0xc1c7('0x1e'))(new Redis(config[_0xc1c7('0x1b')]));require(_0xc1c7('0x1f'))[_0xc1c7('0x20')](socket);function respondWithStatusCode(_0x1b6905,_0x99b874){_0x99b874=_0x99b874||0xcc;return function(_0x34d392){if(_0x34d392){return _0x1b6905['sendStatus'](_0x99b874);}return _0x1b6905[_0xc1c7('0x21')](_0x99b874)[_0xc1c7('0x22')]();};}function respondWithResult(_0x21911c,_0x555b59){_0x555b59=_0x555b59||0xc8;return function(_0x94678a){if(_0x94678a){return _0x21911c[_0xc1c7('0x21')](_0x555b59)[_0xc1c7('0x23')](_0x94678a);}};}function respondWithFilteredResult(_0x39ac54,_0x20439e){return function(_0xb42702){if(_0xb42702){var _0x21758a=typeof _0x20439e[_0xc1c7('0x24')]==='undefined'&&typeof _0x20439e[_0xc1c7('0x25')]===_0xc1c7('0x26');var _0x3ec66a=_0xb42702[_0xc1c7('0x27')];var _0x4b706e=_0x21758a?0x0:_0x20439e[_0xc1c7('0x24')];var _0x4d6171=_0x21758a?_0xb42702[_0xc1c7('0x27')]:_0x20439e[_0xc1c7('0x24')]+_0x20439e['limit'];var _0x5846f0;if(_0x4d6171>=_0x3ec66a){_0x4d6171=_0x3ec66a;_0x5846f0=0xc8;}else{_0x5846f0=0xce;}_0x39ac54[_0xc1c7('0x21')](_0x5846f0);return _0x39ac54[_0xc1c7('0x28')](_0xc1c7('0x29'),_0x4b706e+'-'+_0x4d6171+'/'+_0x3ec66a)['json'](_0xb42702);}return null;};}function patchUpdates(_0x813853){return function(_0x341b41){try{jsonpatch[_0xc1c7('0x2a')](_0x341b41,_0x813853,!![]);}catch(_0x31a0e0){return BPromise[_0xc1c7('0x2b')](_0x31a0e0);}return _0x341b41[_0xc1c7('0x2c')]();};}function saveUpdates(_0x3180fd,_0x120168){return function(_0x22b654){if(_0x22b654){return _0x22b654[_0xc1c7('0x2d')](_0x3180fd)[_0xc1c7('0x2e')](function(_0x363fbc){return _0x363fbc;});}return null;};}function removeEntity(_0x33aac7,_0x260a3f){return function(_0xf1c405){if(_0xf1c405){return _0xf1c405[_0xc1c7('0x2f')]()['then'](function(){var _0xf0ab9c=_0xf1c405[_0xc1c7('0x30')]({'plain':!![]});var _0x4e1721='VoicePrefixes';return db[_0xc1c7('0x31')]['destroy']({'where':{'type':_0x4e1721,'resourceId':_0xf0ab9c['id']}})['then'](function(){return _0xf1c405;});})[_0xc1c7('0x2e')](function(){_0x33aac7[_0xc1c7('0x21')](0xcc)[_0xc1c7('0x22')]();});}};}function handleEntityNotFound(_0x243450,_0x461360){return function(_0x4adb81){if(!_0x4adb81){_0x243450['sendStatus'](0x194);}return _0x4adb81;};}function handleError(_0x1b6f97,_0x4275f9){_0x4275f9=_0x4275f9||0x1f4;return function(_0x9a0ab3){logger[_0xc1c7('0x32')](_0x9a0ab3[_0xc1c7('0x33')]);if(_0x9a0ab3['name']){delete _0x9a0ab3['name'];}_0x1b6f97[_0xc1c7('0x21')](_0x4275f9)[_0xc1c7('0x34')](_0x9a0ab3);};}exports['index']=function(_0x41b154,_0x3cf425){var _0x39b68c={},_0x1f9708={},_0x74b523={'count':0x0,'rows':[]};var _0x2d69d3=_[_0xc1c7('0x35')](db['VoicePrefix'][_0xc1c7('0x36')],function(_0xeac123){return{'name':_0xeac123[_0xc1c7('0x37')],'type':_0xeac123[_0xc1c7('0x38')][_0xc1c7('0x39')]};});_0x1f9708[_0xc1c7('0x3a')]=_[_0xc1c7('0x35')](_0x2d69d3,_0xc1c7('0x3b'));_0x1f9708[_0xc1c7('0x3c')]=_['keys'](_0x41b154['query']);_0x1f9708[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x1f9708[_0xc1c7('0x3a')],_0x1f9708[_0xc1c7('0x3c')]);_0x39b68c[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x1f9708[_0xc1c7('0x3a')],qs[_0xc1c7('0x40')](_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x39b68c[_0xc1c7('0x3f')]=_0x39b68c[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x39b68c[_0xc1c7('0x3f')]:_0x1f9708[_0xc1c7('0x3a')];if(!_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x39b68c[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x41b154[_0xc1c7('0x3c')]['limit']);_0x39b68c['offset']=qs['offset'](_0x41b154[_0xc1c7('0x3c')]['offset']);}_0x39b68c['order']=qs[_0xc1c7('0x44')](_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x44')]);_0x39b68c[_0xc1c7('0x45')]=qs['filters'](_[_0xc1c7('0x46')](_0x41b154[_0xc1c7('0x3c')],_0x1f9708[_0xc1c7('0x3d')]),_0x2d69d3);if(_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x47')]){_0x39b68c[_0xc1c7('0x45')]=_[_0xc1c7('0x48')](_0x39b68c[_0xc1c7('0x45')],{'$or':_[_0xc1c7('0x35')](_0x2d69d3,function(_0x1810c7){if(_0x1810c7[_0xc1c7('0x38')]!==_0xc1c7('0x49')){var _0x23d0b2={};_0x23d0b2[_0x1810c7['name']]={'$like':'%'+_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x47')]+'%'};return _0x23d0b2;}})});}_0x39b68c=_['merge']({},_0x39b68c,_0x41b154[_0xc1c7('0x4a')]);var _0x23b10b={'where':_0x39b68c[_0xc1c7('0x45')]};return db[_0xc1c7('0x4b')][_0xc1c7('0x27')](_0x23b10b)[_0xc1c7('0x2e')](function(_0xd5e06a){_0x74b523[_0xc1c7('0x27')]=_0xd5e06a;if(_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x4c')]){_0x39b68c['include']=[{'all':!![]}];}return db[_0xc1c7('0x4b')][_0xc1c7('0x4d')](_0x39b68c);})['then'](function(_0x4c6834){_0x74b523[_0xc1c7('0x4e')]=_0x4c6834;return _0x74b523;})[_0xc1c7('0x2e')](respondWithFilteredResult(_0x3cf425,_0x39b68c))[_0xc1c7('0x4f')](handleError(_0x3cf425,null));};exports[_0xc1c7('0x50')]=function(_0x429221,_0x51a33f){var _0x1eca39={'raw':![],'where':{'id':_0x429221['params']['id']}},_0x805dac={};_0x805dac['model']=_['keys'](db[_0xc1c7('0x4b')][_0xc1c7('0x36')]);_0x805dac[_0xc1c7('0x3c')]=_['keys'](_0x429221[_0xc1c7('0x3c')]);_0x805dac[_0xc1c7('0x3d')]=_['intersection'](_0x805dac[_0xc1c7('0x3a')],_0x805dac[_0xc1c7('0x3c')]);_0x1eca39[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x805dac[_0xc1c7('0x3a')],qs[_0xc1c7('0x40')](_0x429221[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x1eca39[_0xc1c7('0x3f')]=_0x1eca39[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x1eca39[_0xc1c7('0x3f')]:_0x805dac[_0xc1c7('0x3a')];if(_0x429221[_0xc1c7('0x3c')][_0xc1c7('0x4c')]){_0x1eca39[_0xc1c7('0x51')]=[{'all':!![]}];}_0x1eca39=_[_0xc1c7('0x48')]({},_0x1eca39,_0x429221[_0xc1c7('0x4a')]);return db['VoicePrefix'][_0xc1c7('0x52')](_0x1eca39)['then'](handleEntityNotFound(_0x51a33f,null))[_0xc1c7('0x2e')](respondWithResult(_0x51a33f,null))[_0xc1c7('0x4f')](handleError(_0x51a33f,null));};exports[_0xc1c7('0x2f')]=function(_0x524088,_0x473e8d){return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x524088['params']['id']}})['then'](handleEntityNotFound(_0x473e8d,null))[_0xc1c7('0x2e')](removeEntity(_0x473e8d,null))[_0xc1c7('0x4f')](handleError(_0x473e8d,null));};exports['describe']=function(_0x49542,_0x12a1d2){return db[_0xc1c7('0x4b')][_0xc1c7('0x53')]()[_0xc1c7('0x2e')](respondWithResult(_0x12a1d2,null))[_0xc1c7('0x4f')](handleError(_0x12a1d2,null));};exports['create']=function(_0x259e55,_0x568377){var _0x307b5e;return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x557cb6){return db[_0xc1c7('0x4b')][_0xc1c7('0x56')](_0x259e55[_0xc1c7('0x57')],{'transaction':_0x557cb6})[_0xc1c7('0x2e')](function(_0x1679c5){_0x307b5e=_0x1679c5[_0xc1c7('0x30')]({'plain':!![]});return db[_0xc1c7('0x58')][_0xc1c7('0x52')]({'where':{'id':_0x307b5e['VoiceExtensionId']},'raw':!![]})[_0xc1c7('0x2e')](function(_0x2a8664){return createVoicePrefixExtensions(_0x307b5e,_0x2a8664,_0x557cb6);});});})[_0xc1c7('0x2e')](function(){var _0x575fc5=_0x259e55['user'][_0xc1c7('0x30')]({'plain':!![]});if(!_0x575fc5)throw new Error(_0xc1c7('0x59'));if(_0x575fc5[_0xc1c7('0x5a')]==='user'){var _0x1c636c=_0x307b5e;return db['UserProfileSection'][_0xc1c7('0x52')]({'where':{'name':_0xc1c7('0x5b'),'userProfileId':_0x575fc5[_0xc1c7('0x5c')]},'raw':!![]})[_0xc1c7('0x2e')](function(_0x345a46){if(_0x345a46&&_0x345a46[_0xc1c7('0x5d')]===0x0){return db[_0xc1c7('0x31')]['create']({'name':_0x1c636c[_0xc1c7('0x3b')],'resourceId':_0x1c636c['id'],'type':_0x345a46[_0xc1c7('0x3b')],'sectionId':_0x345a46['id']},{})[_0xc1c7('0x2e')](function(){return _0x307b5e;});}else{return _0x307b5e;}})['catch'](function(_0x24fa71){logger['error'](_0xc1c7('0x5e'),_0x24fa71);throw _0x24fa71;});}return _0x307b5e;})['then'](respondWithResult(_0x568377,null))[_0xc1c7('0x4f')](handleError(_0x568377,null));};function Extension(_0x212d53,_0x314232,_0x3a94fb,_0x156d51){this['context']='from-sip';this['exten']=_0x212d53;this[_0xc1c7('0x5f')]=_0x3a94fb;this[_0xc1c7('0x38')]=_0xc1c7('0x60');this[_0xc1c7('0x61')]=_0xc1c7('0x62');this[_0xc1c7('0x63')]=_0x314232;this['appdata']=_0x156d51;}function createVoicePrefixExtensions(_0x19b8d7,_0xe5882,_0x1c010a){return new BPromise(function(_0x6e300e,_0x5f4f7a){var _0x2e4673=new Extension(formatPrefixName(_0x19b8d7[_0xc1c7('0x64')]),0x1,_0xc1c7('0x65'),'Voice\x20Prefix');_0x2e4673[_0xc1c7('0x66')]=_0x19b8d7['id'];return db[_0xc1c7('0x58')][_0xc1c7('0x56')](_0x2e4673,{'transaction':_0x1c010a})[_0xc1c7('0x2e')](function(_0x58b08b){var _0x552691=_0x58b08b[_0xc1c7('0x30')]({'plain':!![]});var _0x203790=_['map'](addVoicePrefixExtensions(_0x19b8d7,_0xe5882),function(_0x46dc1e){_0x46dc1e[_0xc1c7('0x67')]=_0x552691['id'];_0x46dc1e['VoicePrefixId']=_0x19b8d7['id'];return _0x46dc1e;});return db[_0xc1c7('0x58')][_0xc1c7('0x68')](_0x203790,{'transaction':_0x1c010a})['then'](function(_0x6b9337){if(!_0x6b9337){return _0x5f4f7a(_0xc1c7('0x69'));}else{return _0x6e300e(_0x6b9337);}})[_0xc1c7('0x4f')](function(_0x2b4db2){return _0x5f4f7a(_0x2b4db2);});});;});};function addVoicePrefixExtensions(_0x1087b2,_0x11c9d8){var _0x1ed9fc=[];var _0x33104e=formatPrefixName(_0x1087b2[_0xc1c7('0x64')]);_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x2,_0xc1c7('0x6b'),_0xc1c7('0x6c')+_0x1087b2[_0xc1c7('0x3b')]));if(_0x1087b2[_0xc1c7('0x6d')]){_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x3,_0xc1c7('0x6b'),_0xc1c7('0x6e')+_0x1087b2[_0xc1c7('0x6d')]));}else{_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x3,_0xc1c7('0x65'),_0xc1c7('0x6f')));}_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x4,_0xc1c7('0x70'),_0x11c9d8[_0xc1c7('0x71')]+','+_0xc1c7('0x72')+(0x8+_0x1087b2[_0xc1c7('0x3b')][_0xc1c7('0x41')])+'}'+','+0x1));return _0x1ed9fc;}function formatPrefixName(_0x1448d8){var _0x47d58e='_';for(var _0x8c88c0=0x0;_0x8c88c0<_0x1448d8[_0xc1c7('0x41')];_0x8c88c0++){if(_0x1448d8[_0xc1c7('0x73')](_0x8c88c0)=='-'){_0x47d58e+=_0x1448d8[_0xc1c7('0x73')](_0x8c88c0);}else{_0x47d58e+='['+_0x1448d8[_0xc1c7('0x73')](_0x8c88c0)+']';}}_0x47d58e+='.';return _0x47d58e;}exports[_0xc1c7('0x2d')]=function(_0x1ccd7d,_0x29181f,_0x5f4f50){var _0xbbd4e3=_0x1ccd7d[_0xc1c7('0x57')];_0xbbd4e3[_0xc1c7('0x64')]=_0xc1c7('0x74')+_0xbbd4e3[_0xc1c7('0x3b')]+'-';return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0xa00af6){return db['VoicePrefix'][_0xc1c7('0x2d')](_0xbbd4e3,{'where':{'id':_0xbbd4e3['id']},'transaction':_0xa00af6})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x58')][_0xc1c7('0x2f')]({'where':{'VoicePrefixId':_0xbbd4e3['id']},'transaction':_0xa00af6})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x58')][_0xc1c7('0x52')]({'where':{'id':_0xbbd4e3[_0xc1c7('0x67')]},'raw':!![]})[_0xc1c7('0x2e')](function(_0x125270){return createVoicePrefixExtensions(_0xbbd4e3,_0x125270,_0xa00af6);});});});})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x4b')]['findById'](_0xbbd4e3['id']);})['then'](respondWithResult(_0x29181f,null))[_0xc1c7('0x4f')](handleError(_0x29181f,null));};exports[_0xc1c7('0x75')]=function(_0xc16f09,_0x11fd01,_0x44a24b){return db[_0xc1c7('0x4b')][_0xc1c7('0x52')]({'where':{'id':_0xc16f09[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x11fd01,null))[_0xc1c7('0x2e')](function(_0x180607){if(_0x180607){return _0x180607[_0xc1c7('0x75')](_0xc16f09[_0xc1c7('0x57')]['ids'],_[_0xc1c7('0x77')](_0xc16f09[_0xc1c7('0x57')],[_0xc1c7('0x78'),'id'])||{})['spread'](function(_0x4de022){for(var _0x550c4a=0x0;_0x550c4a<_0xc16f09[_0xc1c7('0x57')][_0xc1c7('0x78')]['length'];_0x550c4a+=0x1){socket[_0xc1c7('0x79')](_0xc1c7('0x7a'),{'UserId':Number(_0xc16f09['body']['ids'][_0x550c4a]),'VoicePrefixId':Number(_0xc16f09['params']['id'])});}return _0x4de022;});}})[_0xc1c7('0x2e')](respondWithResult(_0x11fd01,null))['catch'](handleError(_0x11fd01,null));};exports[_0xc1c7('0x7b')]=function(_0x3bc3aa,_0xf899a,_0x4b7a34){return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x3bc3aa[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0xf899a,null))['then'](function(_0xf7b22e){if(_0xf7b22e){return _0xf7b22e[_0xc1c7('0x7b')](_0x3bc3aa[_0xc1c7('0x3c')][_0xc1c7('0x78')])[_0xc1c7('0x2e')](function(){if(_[_0xc1c7('0x7c')](_0x3bc3aa[_0xc1c7('0x3c')][_0xc1c7('0x78')])){for(var _0x425f3d=0x0;_0x425f3d<_0x3bc3aa[_0xc1c7('0x3c')]['ids'][_0xc1c7('0x41')];_0x425f3d+=0x1){socket[_0xc1c7('0x79')](_0xc1c7('0x7d'),{'UserId':Number(_0x3bc3aa[_0xc1c7('0x3c')]['ids'][_0x425f3d]),'VoicePrefixId':Number(_0x3bc3aa[_0xc1c7('0x76')]['id'])});}}else{socket[_0xc1c7('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x3bc3aa['query'][_0xc1c7('0x78')]),'VoicePrefixId':Number(_0x3bc3aa[_0xc1c7('0x76')]['id'])});}});}})[_0xc1c7('0x2e')](respondWithStatusCode(_0xf899a,null))[_0xc1c7('0x4f')](handleError(_0xf899a,null));};exports[_0xc1c7('0x7e')]=function(_0x176603,_0x48309e,_0x1f0c3f){var _0x2ad4f5={};var _0x5698e9={};var _0x65161e;var _0x32c26e;return db[_0xc1c7('0x4b')][_0xc1c7('0x7f')]({'where':{'id':_0x176603[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x48309e,null))[_0xc1c7('0x2e')](function(_0x175bba){if(_0x175bba){_0x65161e=_0x175bba;_0x5698e9[_0xc1c7('0x3a')]=_[_0xc1c7('0x80')](db[_0xc1c7('0x81')][_0xc1c7('0x36')]);_0x5698e9[_0xc1c7('0x3c')]=_[_0xc1c7('0x80')](_0x176603['query']);_0x5698e9[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x5698e9[_0xc1c7('0x3a')],_0x5698e9[_0xc1c7('0x3c')]);_0x2ad4f5[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x5698e9['model'],qs[_0xc1c7('0x40')](_0x176603[_0xc1c7('0x3c')]['fields']));_0x2ad4f5['attributes']=_0x2ad4f5[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x2ad4f5[_0xc1c7('0x3f')]:_0x5698e9[_0xc1c7('0x3a')];_0x2ad4f5[_0xc1c7('0x82')]=qs[_0xc1c7('0x44')](_0x176603['query'][_0xc1c7('0x44')]);_0x2ad4f5[_0xc1c7('0x45')]=qs[_0xc1c7('0x3d')](_[_0xc1c7('0x46')](_0x176603['query'],_0x5698e9[_0xc1c7('0x3d')]));if(_0x176603['query'][_0xc1c7('0x47')]){_0x2ad4f5['where']=_[_0xc1c7('0x48')](_0x2ad4f5[_0xc1c7('0x45')],{'$or':_['map'](_0x2ad4f5[_0xc1c7('0x3f')],function(_0x30e6ca){var _0x44aee1={};_0x44aee1[_0x30e6ca]={'$like':'%'+_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x47')]+'%'};return _0x44aee1;})});}_0x2ad4f5=_[_0xc1c7('0x48')]({},_0x2ad4f5,_0x176603[_0xc1c7('0x4a')]);return _0x65161e[_0xc1c7('0x7e')](_0x2ad4f5);}})[_0xc1c7('0x2e')](function(_0xe1e5dd){if(_0xe1e5dd){_0x32c26e=_0xe1e5dd[_0xc1c7('0x41')];if(!_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x2ad4f5[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x25')]);_0x2ad4f5[_0xc1c7('0x24')]=qs['offset'](_0x176603['query']['offset']);}return _0x65161e[_0xc1c7('0x7e')](_0x2ad4f5);}})['then'](function(_0x49c29b){if(_0x49c29b){return _0x49c29b?{'count':_0x32c26e,'rows':_0x49c29b}:null;}})['then'](respondWithResult(_0x48309e,null))[_0xc1c7('0x4f')](handleError(_0x48309e,null));};exports[_0xc1c7('0x83')]=function(_0x56cd17,_0x5d60e8,_0x57b04b){var _0x238077={};var _0x454b0d={};var _0x20a948;var _0x18b20f;return db[_0xc1c7('0x4b')][_0xc1c7('0x7f')]({'where':{'id':_0x56cd17['params']['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x5d60e8,null))[_0xc1c7('0x2e')](function(_0x2b9cff){if(_0x2b9cff){_0x20a948=_0x2b9cff;_0x454b0d['model']=_[_0xc1c7('0x80')](db[_0xc1c7('0x84')][_0xc1c7('0x36')]);_0x454b0d['query']=_[_0xc1c7('0x80')](_0x56cd17[_0xc1c7('0x3c')]);_0x454b0d[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x454b0d[_0xc1c7('0x3a')],_0x454b0d[_0xc1c7('0x3c')]);_0x238077[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x454b0d['model'],qs['fields'](_0x56cd17[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x238077[_0xc1c7('0x3f')]=_0x238077['attributes'][_0xc1c7('0x41')]?_0x238077[_0xc1c7('0x3f')]:_0x454b0d[_0xc1c7('0x3a')];_0x238077[_0xc1c7('0x82')]=qs[_0xc1c7('0x44')](_0x56cd17['query'][_0xc1c7('0x44')]);_0x238077[_0xc1c7('0x45')]=qs[_0xc1c7('0x3d')](_[_0xc1c7('0x46')](_0x56cd17[_0xc1c7('0x3c')],_0x454b0d[_0xc1c7('0x3d')]));if(_0x56cd17[_0xc1c7('0x3c')][_0xc1c7('0x47')]){_0x238077[_0xc1c7('0x45')]=_[_0xc1c7('0x48')](_0x238077[_0xc1c7('0x45')],{'$or':_[_0xc1c7('0x35')](_0x238077[_0xc1c7('0x3f')],function(_0x38e932){var _0x265a7a={};_0x265a7a[_0x38e932]={'$like':'%'+_0x56cd17['query'][_0xc1c7('0x47')]+'%'};return _0x265a7a;})});}_0x238077=_[_0xc1c7('0x48')]({},_0x238077,_0x56cd17[_0xc1c7('0x4a')]);return _0x20a948[_0xc1c7('0x83')](_0x238077);}})[_0xc1c7('0x2e')](function(_0x4855ba){if(_0x4855ba){_0x18b20f=_0x4855ba[_0xc1c7('0x41')];if(!_0x56cd17['query'][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x238077[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x56cd17['query'][_0xc1c7('0x25')]);_0x238077['offset']=qs[_0xc1c7('0x24')](_0x56cd17[_0xc1c7('0x3c')]['offset']);}return _0x20a948[_0xc1c7('0x83')](_0x238077);}})[_0xc1c7('0x2e')](function(_0x324a87){if(_0x324a87){return _0x324a87?{'count':_0x18b20f,'rows':_0x324a87}:null;}})['then'](respondWithResult(_0x5d60e8,null))[_0xc1c7('0x4f')](handleError(_0x5d60e8,null));};exports[_0xc1c7('0x85')]=function(_0x2b4a14,_0x18e4c4,_0x27edc3){var _0x4bae45=_0x2b4a14[_0xc1c7('0x57')]['ids'];var _0x183c59;return db['Team'][_0xc1c7('0x4d')]({'where':{'id':_0x4bae45},'attributes':['id'],'include':[{'model':db[_0xc1c7('0x81')],'as':_0xc1c7('0x86'),'attributes':['id','name',_0xc1c7('0x87'),_0xc1c7('0x88'),_0xc1c7('0x89')],'raw':!![]}]})[_0xc1c7('0x2e')](function(_0x4ccff5){if(_0x4ccff5){_0x183c59=_0x4ccff5;var _0x287d57=_[_0xc1c7('0x8a')](_0x4ccff5,function(_0x1732a5){var _0x20dccd=_0x1732a5[_0xc1c7('0x30')]({'plain':!![]});return _0x20dccd[_0xc1c7('0x86')];});return db[_0xc1c7('0x4b')][_0xc1c7('0x52')]({'where':{'id':_0x2b4a14[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](function(_0x45e974){return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x4d78b8){return _0x45e974[_0xc1c7('0x85')](_0x4bae45,{'transaction':_0x4d78b8})[_0xc1c7('0x2e')](function(){return BPromise['each'](_0x183c59,function(_0x125085){return db[_0xc1c7('0x8b')][_0xc1c7('0x8c')]({'TeamId':_0x125085['id'],'VoicePrefixId':_0x2b4a14[_0xc1c7('0x76')]['id']},{'transaction':_0x4d78b8});});})[_0xc1c7('0x2e')](function(){return BPromise[_0xc1c7('0x8d')](_0x287d57,function(_0x846c80){return db['UserVoicePrefix'][_0xc1c7('0x8e')]({'where':{'UserId':_0x846c80['id'],'VoicePrefixId':_0x2b4a14[_0xc1c7('0x76')]['id']},'transaction':_0x4d78b8});});})[_0xc1c7('0x2e')](function(){_0x287d57[_0xc1c7('0x8f')](function(_0x2a5267){socket['emit'](_0xc1c7('0x7a'),{'UserId':_0x2a5267['id'],'VoicePrefixId':_0x45e974['id']});});});});});}})[_0xc1c7('0x2e')](respondWithStatusCode(_0x18e4c4,null))[_0xc1c7('0x4f')](handleError(_0x18e4c4,null));};exports[_0xc1c7('0x90')]=function(_0x1bed9e,_0x39997a,_0x1273ae){return db['Team'][_0xc1c7('0x4d')]({'where':{'id':_0x1bed9e[_0xc1c7('0x3c')][_0xc1c7('0x78')]},'attributes':['id'],'include':[{'model':db[_0xc1c7('0x81')],'as':_0xc1c7('0x86'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x39997a,null))[_0xc1c7('0x2e')](function(_0x1e7149){var _0x23d84c=_[_0xc1c7('0x35')](_0x1e7149,'id');var _0x22052c=[];var _0x2ca2c1=[];var _0x1f926a=squel[_0xc1c7('0x91')]();_0x1f926a['field'](_0xc1c7('0x92'))[_0xc1c7('0x93')](_0xc1c7('0x94'),'tq')['join'](_0xc1c7('0x95'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc1c7('0x45')](_0xc1c7('0x96'),_0x1bed9e[_0xc1c7('0x76')]['id']);for(var _0x146e74=0x0;_0x146e74<_0x1e7149[_0xc1c7('0x41')];_0x146e74+=0x1){let _0x3f10ac=_0x1e7149[_0x146e74];for(var _0x3a5abd=0x0;_0x3a5abd<_0x3f10ac[_0xc1c7('0x86')][_0xc1c7('0x41')];_0x3a5abd+=0x1){let _0x494ba4=_0x3f10ac[_0xc1c7('0x86')][_0x3a5abd];var _0x4fead5=_0x1f926a[_0xc1c7('0x97')]();_0x4fead5[_0xc1c7('0x45')](_0xc1c7('0x98'),_0x494ba4['id']);_0x2ca2c1[_0xc1c7('0x6a')](db[_0xc1c7('0x54')][_0xc1c7('0x3c')](_0x4fead5[_0xc1c7('0x99')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xc1c7('0x2e')](function(_0x198e78){if(_0x198e78[_0xc1c7('0x41')]===0x1){return _0x494ba4['id'];}else{var _0xde9a91=_[_0xc1c7('0x9a')](_['map'](_0x198e78,_0xc1c7('0x9b')),function(_0x3d6078){return _[_0xc1c7('0x9c')](_0x23d84c,_0x3d6078);});if(_0xde9a91){return _0x494ba4['id'];}}}));}}return BPromise[_0xc1c7('0x9d')](_0x2ca2c1)[_0xc1c7('0x2e')](function(_0x3f0e2c){_0x22052c=_(_0x22052c)[_0xc1c7('0x9e')](_0x3f0e2c)['compact']()[_0xc1c7('0x9f')]();return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x1bed9e['params']['id']}})[_0xc1c7('0x2e')](function(_0x2801fb){return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x43c3c3){return _0x2801fb[_0xc1c7('0x90')](_0x1bed9e[_0xc1c7('0x3c')][_0xc1c7('0x78')],{'transaction':_0x43c3c3})[_0xc1c7('0x2e')](function(){if(!_['isEmpty'](_0x22052c)){return _0x2801fb['removeAgents'](_0x22052c,{'transaction':_0x43c3c3});}})[_0xc1c7('0x2e')](function(){_0x22052c['forEach'](function(_0x479d8a){socket[_0xc1c7('0x79')](_0xc1c7('0x7d'),{'UserId':_0x479d8a,'VoicePrefixId':_0x2801fb['id']});});});});});});})[_0xc1c7('0x2e')](respondWithStatusCode(_0x39997a,null))[_0xc1c7('0x4f')](handleError(_0x39997a,null));}; \ No newline at end of file +var _0x4888=['send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','describe','create','sequelize','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','SELECT','every','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','VoicePrefixes','UserProfileResource','error','stack','name'];(function(_0x114bf1,_0x16ac4a){var _0x58072f=function(_0x377d8a){while(--_0x377d8a){_0x114bf1['push'](_0x114bf1['shift']());}};_0x58072f(++_0x16ac4a);}(_0x4888,0x198));var _0x8488=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0x4888[_0x22431e];return _0xd978e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];config[_0x8488('0x17')]=_[_0x8488('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8488('0x19'))(new Redis(config['redis']));require(_0x8488('0x1a'))['register'](socket);function respondWithStatusCode(_0x5161a3,_0x24d0a0){_0x24d0a0=_0x24d0a0||0xcc;return function(_0x3635da){if(_0x3635da){return _0x5161a3[_0x8488('0x1b')](_0x24d0a0);}return _0x5161a3[_0x8488('0x1c')](_0x24d0a0)[_0x8488('0x1d')]();};}function respondWithResult(_0x8d3b3d,_0x165139){_0x165139=_0x165139||0xc8;return function(_0x4e44af){if(_0x4e44af){return _0x8d3b3d[_0x8488('0x1c')](_0x165139)[_0x8488('0x1e')](_0x4e44af);}};}function respondWithFilteredResult(_0x3edfe4,_0x37361d){return function(_0x60ae2f){if(_0x60ae2f){var _0x39775f=typeof _0x37361d[_0x8488('0x1f')]===_0x8488('0x20')&&typeof _0x37361d[_0x8488('0x21')]===_0x8488('0x20');var _0x10bfd6=_0x60ae2f[_0x8488('0x22')];var _0x3dd93e=_0x39775f?0x0:_0x37361d['offset'];var _0x4a1b45=_0x39775f?_0x60ae2f[_0x8488('0x22')]:_0x37361d[_0x8488('0x1f')]+_0x37361d[_0x8488('0x21')];var _0x3c9fc2;if(_0x4a1b45>=_0x10bfd6){_0x4a1b45=_0x10bfd6;_0x3c9fc2=0xc8;}else{_0x3c9fc2=0xce;}_0x3edfe4[_0x8488('0x1c')](_0x3c9fc2);return _0x3edfe4[_0x8488('0x23')](_0x8488('0x24'),_0x3dd93e+'-'+_0x4a1b45+'/'+_0x10bfd6)[_0x8488('0x1e')](_0x60ae2f);}return null;};}function patchUpdates(_0x39dd43){return function(_0x5123d0){try{jsonpatch[_0x8488('0x25')](_0x5123d0,_0x39dd43,!![]);}catch(_0x4e07e1){return BPromise[_0x8488('0x26')](_0x4e07e1);}return _0x5123d0[_0x8488('0x27')]();};}function saveUpdates(_0x290b33,_0x54ecda){return function(_0x577234){if(_0x577234){return _0x577234['update'](_0x290b33)['then'](function(_0x472624){return _0x472624;});}return null;};}function removeEntity(_0x51fe30,_0x58057a){return function(_0x26bdbb){if(_0x26bdbb){return _0x26bdbb[_0x8488('0x28')]()[_0x8488('0x29')](function(){var _0x6ebee0=_0x26bdbb[_0x8488('0x2a')]({'plain':!![]});var _0x503b83=_0x8488('0x2b');return db[_0x8488('0x2c')][_0x8488('0x28')]({'where':{'type':_0x503b83,'resourceId':_0x6ebee0['id']}})[_0x8488('0x29')](function(){return _0x26bdbb;});})[_0x8488('0x29')](function(){_0x51fe30[_0x8488('0x1c')](0xcc)[_0x8488('0x1d')]();});}};}function handleEntityNotFound(_0x296b6c,_0x368f9c){return function(_0x1d9317){if(!_0x1d9317){_0x296b6c[_0x8488('0x1b')](0x194);}return _0x1d9317;};}function handleError(_0x58d0cc,_0x57ce3c){_0x57ce3c=_0x57ce3c||0x1f4;return function(_0x4e3fe2){logger[_0x8488('0x2d')](_0x4e3fe2[_0x8488('0x2e')]);if(_0x4e3fe2[_0x8488('0x2f')]){delete _0x4e3fe2[_0x8488('0x2f')];}_0x58d0cc[_0x8488('0x1c')](_0x57ce3c)[_0x8488('0x30')](_0x4e3fe2);};}exports['index']=function(_0x2292e0,_0x14f378){var _0x208753={},_0x3649f7={},_0x18eb27={'count':0x0,'rows':[]};var _0x501981=_[_0x8488('0x31')](db[_0x8488('0x32')]['rawAttributes'],function(_0x1b0637){return{'name':_0x1b0637[_0x8488('0x33')],'type':_0x1b0637[_0x8488('0x34')][_0x8488('0x35')]};});_0x3649f7[_0x8488('0x36')]=_['map'](_0x501981,_0x8488('0x2f'));_0x3649f7[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2292e0['query']);_0x3649f7[_0x8488('0x39')]=_['intersection'](_0x3649f7[_0x8488('0x36')],_0x3649f7[_0x8488('0x37')]);_0x208753[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x3649f7['model'],qs[_0x8488('0x3c')](_0x2292e0[_0x8488('0x37')][_0x8488('0x3c')]));_0x208753['attributes']=_0x208753[_0x8488('0x3a')][_0x8488('0x3d')]?_0x208753[_0x8488('0x3a')]:_0x3649f7[_0x8488('0x36')];if(!_0x2292e0[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x208753[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2292e0[_0x8488('0x37')][_0x8488('0x21')]);_0x208753['offset']=qs['offset'](_0x2292e0[_0x8488('0x37')][_0x8488('0x1f')]);}_0x208753[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2292e0[_0x8488('0x37')][_0x8488('0x41')]);_0x208753[_0x8488('0x42')]=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x2292e0['query'],_0x3649f7[_0x8488('0x39')]),_0x501981);if(_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]){_0x208753['where']=_[_0x8488('0x45')](_0x208753[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x501981,function(_0x28bc84){if(_0x28bc84[_0x8488('0x34')]!==_0x8488('0x46')){var _0x1aac4b={};_0x1aac4b[_0x28bc84['name']]={'$like':'%'+_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x1aac4b;}})});}_0x208753=_[_0x8488('0x45')]({},_0x208753,_0x2292e0['options']);var _0x3649ae={'where':_0x208753['where']};return db[_0x8488('0x32')][_0x8488('0x22')](_0x3649ae)['then'](function(_0x22a3f3){_0x18eb27[_0x8488('0x22')]=_0x22a3f3;if(_0x2292e0[_0x8488('0x37')][_0x8488('0x47')]){_0x208753[_0x8488('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0x8488('0x49')](_0x208753);})['then'](function(_0x3440ae){_0x18eb27[_0x8488('0x4a')]=_0x3440ae;return _0x18eb27;})[_0x8488('0x29')](respondWithFilteredResult(_0x14f378,_0x208753))[_0x8488('0x4b')](handleError(_0x14f378,null));};exports[_0x8488('0x4c')]=function(_0x3dd1cb,_0x1ae9af){var _0x192617={'raw':![],'where':{'id':_0x3dd1cb[_0x8488('0x4d')]['id']}},_0xfe2e8f={};_0xfe2e8f[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x32')][_0x8488('0x4e')]);_0xfe2e8f[_0x8488('0x37')]=_[_0x8488('0x38')](_0x3dd1cb[_0x8488('0x37')]);_0xfe2e8f['filters']=_[_0x8488('0x3b')](_0xfe2e8f[_0x8488('0x36')],_0xfe2e8f[_0x8488('0x37')]);_0x192617[_0x8488('0x3a')]=_['intersection'](_0xfe2e8f[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x3dd1cb[_0x8488('0x37')][_0x8488('0x3c')]));_0x192617['attributes']=_0x192617[_0x8488('0x3a')][_0x8488('0x3d')]?_0x192617[_0x8488('0x3a')]:_0xfe2e8f[_0x8488('0x36')];if(_0x3dd1cb[_0x8488('0x37')][_0x8488('0x47')]){_0x192617[_0x8488('0x48')]=[{'all':!![]}];}_0x192617=_[_0x8488('0x45')]({},_0x192617,_0x3dd1cb[_0x8488('0x4f')]);return db[_0x8488('0x32')][_0x8488('0x50')](_0x192617)[_0x8488('0x29')](handleEntityNotFound(_0x1ae9af,null))[_0x8488('0x29')](respondWithResult(_0x1ae9af,null))['catch'](handleError(_0x1ae9af,null));};exports['destroy']=function(_0x8267e1,_0x1a66ff){return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x8267e1[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x1a66ff,null))[_0x8488('0x29')](removeEntity(_0x1a66ff,null))[_0x8488('0x4b')](handleError(_0x1a66ff,null));};exports[_0x8488('0x51')]=function(_0x481975,_0x474a0b){return db[_0x8488('0x32')]['describe']()[_0x8488('0x29')](respondWithResult(_0x474a0b,null))[_0x8488('0x4b')](handleError(_0x474a0b,null));};exports[_0x8488('0x52')]=function(_0x1ff9c5,_0x4f80fb){var _0x198328;return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x5c55bf){return db[_0x8488('0x32')][_0x8488('0x52')](_0x1ff9c5[_0x8488('0x55')],{'transaction':_0x5c55bf})[_0x8488('0x29')](function(_0x48caa1){_0x198328=_0x48caa1[_0x8488('0x2a')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x198328[_0x8488('0x56')]},'raw':!![]})['then'](function(_0x3453c7){return createVoicePrefixExtensions(_0x198328,_0x3453c7,_0x5c55bf);});});})[_0x8488('0x29')](function(){var _0x417afa=_0x1ff9c5[_0x8488('0x57')][_0x8488('0x2a')]({'plain':!![]});if(!_0x417afa)throw new Error(_0x8488('0x58'));if(_0x417afa['role']===_0x8488('0x57')){var _0x693741=_0x198328;return db[_0x8488('0x59')][_0x8488('0x50')]({'where':{'name':_0x8488('0x2b'),'userProfileId':_0x417afa['userProfileId']},'raw':!![]})[_0x8488('0x29')](function(_0x5a04d7){if(_0x5a04d7&&_0x5a04d7[_0x8488('0x5a')]===0x0){return db[_0x8488('0x2c')]['create']({'name':_0x693741[_0x8488('0x2f')],'resourceId':_0x693741['id'],'type':_0x5a04d7[_0x8488('0x2f')],'sectionId':_0x5a04d7['id']},{})[_0x8488('0x29')](function(){return _0x198328;});}else{return _0x198328;}})[_0x8488('0x4b')](function(_0x4041e5){logger[_0x8488('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4041e5);throw _0x4041e5;});}return _0x198328;})[_0x8488('0x29')](respondWithResult(_0x4f80fb,null))['catch'](handleError(_0x4f80fb,null));};function Extension(_0x31dcc6,_0x3fa6e2,_0x3c06a4,_0x3fa288){this[_0x8488('0x5b')]=_0x8488('0x5c');this['exten']=_0x31dcc6;this[_0x8488('0x5d')]=_0x3c06a4;this['type']=_0x8488('0x5e');this[_0x8488('0x5f')]=_0x8488('0x60');this[_0x8488('0x61')]=_0x3fa6e2;this[_0x8488('0x62')]=_0x3fa288;}function createVoicePrefixExtensions(_0x24ba2d,_0x4facfb,_0x5755af){return new BPromise(function(_0x5c8310,_0x28ddb0){var _0x1988cf=new Extension(formatPrefixName(_0x24ba2d[_0x8488('0x63')]),0x1,_0x8488('0x64'),_0x8488('0x65'));_0x1988cf[_0x8488('0x66')]=_0x24ba2d['id'];return db[_0x8488('0x67')][_0x8488('0x52')](_0x1988cf,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0xa90a65){var _0x57fdbb=_0xa90a65[_0x8488('0x2a')]({'plain':!![]});var _0x174c57=_[_0x8488('0x31')](addVoicePrefixExtensions(_0x24ba2d,_0x4facfb),function(_0x4ba14e){_0x4ba14e['VoiceExtensionId']=_0x57fdbb['id'];_0x4ba14e[_0x8488('0x66')]=_0x24ba2d['id'];return _0x4ba14e;});return db[_0x8488('0x67')][_0x8488('0x68')](_0x174c57,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0x52bc90){if(!_0x52bc90){return _0x28ddb0('Extensions\x20creation\x20failed');}else{return _0x5c8310(_0x52bc90);}})[_0x8488('0x4b')](function(_0x26e0cc){return _0x28ddb0(_0x26e0cc);});});;});};function addVoicePrefixExtensions(_0x50897,_0x4856fc){var _0x3c3e89=[];var _0x401f4d=formatPrefixName(_0x50897[_0x8488('0x63')]);_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x2,_0x8488('0x6a'),'CDR(prefix)='+_0x50897[_0x8488('0x2f')]));if(_0x50897[_0x8488('0x6b')]){_0x3c3e89['push'](new Extension(_0x401f4d,0x3,_0x8488('0x6a'),_0x8488('0x6c')+_0x50897['callerIdAll']));}else{_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x3,_0x8488('0x64'),_0x8488('0x6d')));}_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x4,_0x8488('0x6e'),_0x4856fc[_0x8488('0x5b')]+','+_0x8488('0x6f')+(0x8+_0x50897['name'][_0x8488('0x3d')])+'}'+','+0x1));return _0x3c3e89;}function formatPrefixName(_0x3b7aa8){var _0x480666='_';for(var _0x49ef10=0x0;_0x49ef10<_0x3b7aa8[_0x8488('0x3d')];_0x49ef10++){if(_0x3b7aa8[_0x8488('0x70')](_0x49ef10)=='-'){_0x480666+=_0x3b7aa8[_0x8488('0x70')](_0x49ef10);}else{_0x480666+='['+_0x3b7aa8['charAt'](_0x49ef10)+']';}}_0x480666+='.';return _0x480666;}exports[_0x8488('0x71')]=function(_0x852e08,_0x56b35a,_0x42b5c5){var _0x59da4a=_0x852e08[_0x8488('0x55')];_0x59da4a[_0x8488('0x63')]=_0x8488('0x72')+_0x59da4a['name']+'-';return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x57955d){return db['VoicePrefix'][_0x8488('0x71')](_0x59da4a,{'where':{'id':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x28')]({'where':{'VoicePrefixId':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x50')]({'where':{'id':_0x59da4a[_0x8488('0x56')]},'raw':!![]})[_0x8488('0x29')](function(_0x1ff111){return createVoicePrefixExtensions(_0x59da4a,_0x1ff111,_0x57955d);});});});})['then'](function(){return db[_0x8488('0x32')]['findById'](_0x59da4a['id']);})[_0x8488('0x29')](respondWithResult(_0x56b35a,null))[_0x8488('0x4b')](handleError(_0x56b35a,null));};exports[_0x8488('0x73')]=function(_0x3349e3,_0x54283a,_0x1b96c5){return db[_0x8488('0x32')]['find']({'where':{'id':_0x3349e3[_0x8488('0x4d')]['id']}})['then'](handleEntityNotFound(_0x54283a,null))[_0x8488('0x29')](function(_0x15b919){if(_0x15b919){return _0x15b919[_0x8488('0x73')](_0x3349e3[_0x8488('0x55')][_0x8488('0x74')],_[_0x8488('0x75')](_0x3349e3[_0x8488('0x55')],[_0x8488('0x74'),'id'])||{})['spread'](function(_0x1ce726){for(var _0x53d87e=0x0;_0x53d87e<_0x3349e3['body'][_0x8488('0x74')][_0x8488('0x3d')];_0x53d87e+=0x1){socket[_0x8488('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x3349e3['body'][_0x8488('0x74')][_0x53d87e]),'VoicePrefixId':Number(_0x3349e3[_0x8488('0x4d')]['id'])});}return _0x1ce726;});}})['then'](respondWithResult(_0x54283a,null))[_0x8488('0x4b')](handleError(_0x54283a,null));};exports[_0x8488('0x77')]=function(_0x924138,_0x173d35,_0x2a3acf){return db[_0x8488('0x32')]['find']({'where':{'id':_0x924138[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x173d35,null))[_0x8488('0x29')](function(_0x4a2fd9){if(_0x4a2fd9){return _0x4a2fd9[_0x8488('0x77')](_0x924138[_0x8488('0x37')][_0x8488('0x74')])['then'](function(){if(_[_0x8488('0x78')](_0x924138[_0x8488('0x37')]['ids'])){for(var _0x48860c=0x0;_0x48860c<_0x924138[_0x8488('0x37')][_0x8488('0x74')]['length'];_0x48860c+=0x1){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':Number(_0x924138['query']['ids'][_0x48860c]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}}else{socket['emit'](_0x8488('0x79'),{'UserId':Number(_0x924138[_0x8488('0x37')][_0x8488('0x74')]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x173d35,null))[_0x8488('0x4b')](handleError(_0x173d35,null));};exports['getAgents']=function(_0x2b2989,_0x4d0d20,_0x2f137a){var _0x1a3a2d={};var _0x267401={};var _0x1e635a;var _0x31ab35;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x2b2989[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x4d0d20,null))[_0x8488('0x29')](function(_0xce1d1a){if(_0xce1d1a){_0x1e635a=_0xce1d1a;_0x267401[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x7b')]['rawAttributes']);_0x267401[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2b2989['query']);_0x267401[_0x8488('0x39')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],_0x267401[_0x8488('0x37')]);_0x1a3a2d[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x2b2989[_0x8488('0x37')][_0x8488('0x3c')]));_0x1a3a2d[_0x8488('0x3a')]=_0x1a3a2d['attributes'][_0x8488('0x3d')]?_0x1a3a2d[_0x8488('0x3a')]:_0x267401['model'];_0x1a3a2d[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2b2989[_0x8488('0x37')][_0x8488('0x41')]);_0x1a3a2d[_0x8488('0x42')]=qs['filters'](_['pick'](_0x2b2989[_0x8488('0x37')],_0x267401[_0x8488('0x39')]));if(_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]){_0x1a3a2d[_0x8488('0x42')]=_[_0x8488('0x45')](_0x1a3a2d[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x1a3a2d[_0x8488('0x3a')],function(_0x167437){var _0x3152d0={};_0x3152d0[_0x167437]={'$like':'%'+_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x3152d0;})});}_0x1a3a2d=_[_0x8488('0x45')]({},_0x1a3a2d,_0x2b2989[_0x8488('0x4f')]);return _0x1e635a['getAgents'](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x5d5234){if(_0x5d5234){_0x31ab35=_0x5d5234['length'];if(!_0x2b2989[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x1a3a2d[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2b2989[_0x8488('0x37')][_0x8488('0x21')]);_0x1a3a2d[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x2b2989[_0x8488('0x37')]['offset']);}return _0x1e635a[_0x8488('0x7c')](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x179637){if(_0x179637){return _0x179637?{'count':_0x31ab35,'rows':_0x179637}:null;}})[_0x8488('0x29')](respondWithResult(_0x4d0d20,null))[_0x8488('0x4b')](handleError(_0x4d0d20,null));};exports[_0x8488('0x7d')]=function(_0x47f7c5,_0x2d7a33,_0x5b0d69){var _0x36f6e4={};var _0x3936b6={};var _0x4be018;var _0x57a4e7;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x47f7c5[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x2d7a33,null))[_0x8488('0x29')](function(_0x5718a7){if(_0x5718a7){_0x4be018=_0x5718a7;_0x3936b6[_0x8488('0x36')]=_[_0x8488('0x38')](db['Team']['rawAttributes']);_0x3936b6[_0x8488('0x37')]=_[_0x8488('0x38')](_0x47f7c5[_0x8488('0x37')]);_0x3936b6['filters']=_['intersection'](_0x3936b6[_0x8488('0x36')],_0x3936b6[_0x8488('0x37')]);_0x36f6e4[_0x8488('0x3a')]=_['intersection'](_0x3936b6[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x3c')]));_0x36f6e4[_0x8488('0x3a')]=_0x36f6e4[_0x8488('0x3a')][_0x8488('0x3d')]?_0x36f6e4[_0x8488('0x3a')]:_0x3936b6[_0x8488('0x36')];_0x36f6e4[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x41')]);_0x36f6e4['where']=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x47f7c5[_0x8488('0x37')],_0x3936b6['filters']));if(_0x47f7c5[_0x8488('0x37')]['filter']){_0x36f6e4[_0x8488('0x42')]=_['merge'](_0x36f6e4['where'],{'$or':_[_0x8488('0x31')](_0x36f6e4['attributes'],function(_0x42f36b){var _0x186e19={};_0x186e19[_0x42f36b]={'$like':'%'+_0x47f7c5[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x186e19;})});}_0x36f6e4=_['merge']({},_0x36f6e4,_0x47f7c5[_0x8488('0x4f')]);return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})[_0x8488('0x29')](function(_0x37ca73){if(_0x37ca73){_0x57a4e7=_0x37ca73['length'];if(!_0x47f7c5[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x36f6e4[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x47f7c5['query']['limit']);_0x36f6e4[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x1f')]);}return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})['then'](function(_0x4806f8){if(_0x4806f8){return _0x4806f8?{'count':_0x57a4e7,'rows':_0x4806f8}:null;}})['then'](respondWithResult(_0x2d7a33,null))[_0x8488('0x4b')](handleError(_0x2d7a33,null));};exports[_0x8488('0x7e')]=function(_0x2bab71,_0x5dacab,_0x30aab3){var _0x6c2e31=_0x2bab71['body'][_0x8488('0x74')];var _0x20cdc8;return db[_0x8488('0x7f')][_0x8488('0x49')]({'where':{'id':_0x6c2e31},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id',_0x8488('0x2f'),_0x8488('0x81'),_0x8488('0x82'),_0x8488('0x83')],'raw':!![]}]})[_0x8488('0x29')](function(_0x13add2){if(_0x13add2){_0x20cdc8=_0x13add2;var _0xa0c692=_['flatMap'](_0x13add2,function(_0x8fc636){var _0x17c6e1=_0x8fc636['get']({'plain':!![]});return _0x17c6e1['Agents'];});return db['VoicePrefix'][_0x8488('0x50')]({'where':{'id':_0x2bab71[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](function(_0x4ba801){return db[_0x8488('0x53')]['transaction'](function(_0x447535){return _0x4ba801[_0x8488('0x7e')](_0x6c2e31,{'transaction':_0x447535})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0x20cdc8,function(_0x1e45ac){return db['TeamVoicePrefix'][_0x8488('0x85')]({'TeamId':_0x1e45ac['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},{'transaction':_0x447535});});})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0xa0c692,function(_0x584f02){return db['UserVoicePrefix'][_0x8488('0x86')]({'where':{'UserId':_0x584f02['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},'transaction':_0x447535});});})[_0x8488('0x29')](function(){_0xa0c692[_0x8488('0x87')](function(_0x2f8191){socket[_0x8488('0x76')](_0x8488('0x88'),{'UserId':_0x2f8191['id'],'VoicePrefixId':_0x4ba801['id']});});});});});}})[_0x8488('0x29')](respondWithStatusCode(_0x5dacab,null))[_0x8488('0x4b')](handleError(_0x5dacab,null));};exports[_0x8488('0x89')]=function(_0x1f5a8b,_0x1e7617,_0x315136){return db[_0x8488('0x7f')]['findAll']({'where':{'id':_0x1f5a8b['query'][_0x8488('0x74')]},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id'],'raw':!![]}]})[_0x8488('0x29')](handleEntityNotFound(_0x1e7617,null))[_0x8488('0x29')](function(_0x22f2de){var _0x280c77=_[_0x8488('0x31')](_0x22f2de,'id');var _0x2a822b=[];var _0x4d611a=[];var _0x46195e=squel[_0x8488('0x8a')]();_0x46195e[_0x8488('0x8b')]('tq.TeamId')[_0x8488('0x8c')](_0x8488('0x8d'),'tq')[_0x8488('0x8e')](_0x8488('0x8f'),'ut',_0x8488('0x90'))[_0x8488('0x42')](_0x8488('0x91'),_0x1f5a8b[_0x8488('0x4d')]['id']);for(var _0x4a7be5=0x0;_0x4a7be5<_0x22f2de['length'];_0x4a7be5+=0x1){let _0x548a7a=_0x22f2de[_0x4a7be5];for(var _0x215d7e=0x0;_0x215d7e<_0x548a7a[_0x8488('0x80')][_0x8488('0x3d')];_0x215d7e+=0x1){let _0x1865f5=_0x548a7a[_0x8488('0x80')][_0x215d7e];var _0x2966ec=_0x46195e['clone']();_0x2966ec[_0x8488('0x42')]('ut.UserId\x20=\x20?',_0x1865f5['id']);_0x4d611a[_0x8488('0x69')](db[_0x8488('0x53')][_0x8488('0x37')](_0x2966ec[_0x8488('0x92')](),{'type':db[_0x8488('0x53')]['QueryTypes'][_0x8488('0x93')]})[_0x8488('0x29')](function(_0x300294){if(_0x300294[_0x8488('0x3d')]===0x1){return _0x1865f5['id'];}else{var _0x14e4a9=_[_0x8488('0x94')](_[_0x8488('0x31')](_0x300294,'TeamId'),function(_0x36600b){return _['includes'](_0x280c77,_0x36600b);});if(_0x14e4a9){return _0x1865f5['id'];}}}));}}return BPromise['all'](_0x4d611a)[_0x8488('0x29')](function(_0x323343){_0x2a822b=_(_0x2a822b)['union'](_0x323343)[_0x8488('0x95')]()[_0x8488('0x96')]();return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x1f5a8b[_0x8488('0x4d')]['id']}})['then'](function(_0x541b76){return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x3e2f85){return _0x541b76[_0x8488('0x89')](_0x1f5a8b[_0x8488('0x37')]['ids'],{'transaction':_0x3e2f85})['then'](function(){if(!_[_0x8488('0x97')](_0x2a822b)){return _0x541b76[_0x8488('0x77')](_0x2a822b,{'transaction':_0x3e2f85});}})[_0x8488('0x29')](function(){_0x2a822b[_0x8488('0x87')](function(_0x258985){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':_0x258985,'VoicePrefixId':_0x541b76['id']});});});});});});})[_0x8488('0x29')](respondWithStatusCode(_0x1e7617,null))[_0x8488('0x4b')](handleError(_0x1e7617,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index d9f1820..e20ddc6 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 _0xe19d=['exports','events','VoicePrefix','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x459240,_0x4c7c29){var _0x2b9388=function(_0x3706a5){while(--_0x3706a5){_0x459240['push'](_0x459240['shift']());}};_0x2b9388(++_0x4c7c29);}(_0xe19d,0x121));var _0xde19=function(_0x299089,_0x3cff81){_0x299089=_0x299089-0x0;var _0x11c91f=_0xe19d[_0x299089];return _0x11c91f;};'use strict';var EventEmitter=require(_0xde19('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xde19('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xde19('0x2')](0x0);var events={'afterCreate':_0xde19('0x3'),'afterUpdate':_0xde19('0x4'),'afterDestroy':'remove'};function emitEvent(_0x45e1c3){return function(_0x2dc41b,_0x256fb2,_0x317327){VoicePrefixEvents[_0xde19('0x5')](_0x45e1c3+':'+_0x2dc41b['id'],_0x2dc41b);VoicePrefixEvents[_0xde19('0x5')](_0x45e1c3,_0x2dc41b);_0x317327(null);};}for(var e in events){if(events[_0xde19('0x6')](e)){var event=events[e];VoicePrefix[_0xde19('0x7')](e,emitEvent(event));}}module[_0xde19('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x6539=['emit','hasOwnProperty','hook','../../mysqldb','VoicePrefix','save','update','remove'];(function(_0x4f38b2,_0x574021){var _0x40f571=function(_0xee31c1){while(--_0xee31c1){_0x4f38b2['push'](_0x4f38b2['shift']());}};_0x40f571(++_0x574021);}(_0x6539,0x8b));var _0x9653=function(_0x25c659,_0x1d2278){_0x25c659=_0x25c659-0x0;var _0x4cad19=_0x6539[_0x25c659];return _0x4cad19;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9653('0x0'))['db'][_0x9653('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9653('0x2'),'afterUpdate':_0x9653('0x3'),'afterDestroy':_0x9653('0x4')};function emitEvent(_0x194048){return function(_0x556003,_0x32c519,_0x102708){VoicePrefixEvents[_0x9653('0x5')](_0x194048+':'+_0x556003['id'],_0x556003);VoicePrefixEvents['emit'](_0x194048,_0x556003);_0x102708(null);};}for(var e in events){if(events[_0x9653('0x6')](e)){var event=events[e];VoicePrefix[_0x9653('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 99a08b0..4218c7b 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 _0x7df9=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define'];(function(_0x1264d8,_0x1a30d2){var _0xdd1abc=function(_0x511b13){while(--_0x511b13){_0x1264d8['push'](_0x1264d8['shift']());}};_0xdd1abc(++_0x1a30d2);}(_0x7df9,0x14c));var _0x97df=function(_0x40b90c,_0x422cee){_0x40b90c=_0x40b90c-0x0;var _0x5d3e08=_0x7df9[_0x40b90c];return _0x5d3e08;};'use strict';var _=require(_0x97df('0x0'));var util=require(_0x97df('0x1'));var logger=require(_0x97df('0x2'))(_0x97df('0x3'));var moment=require(_0x97df('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x97df('0x5'));var rimraf=require(_0x97df('0x6'));var config=require(_0x97df('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x1906f1,_0x342d71){return _0x1906f1[_0x97df('0x8')](_0x97df('0x9'),attributes,{'tableName':_0x97df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7710=['bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','api','moment'];(function(_0x118040,_0x57ccc4){var _0x309a92=function(_0x547100){while(--_0x547100){_0x118040['push'](_0x118040['shift']());}};_0x309a92(++_0x57ccc4);}(_0x7710,0x14e));var _0x0771=function(_0x294cca,_0x2d3b8a){_0x294cca=_0x294cca-0x0;var _0x53054b=_0x7710[_0x294cca];return _0x53054b;};'use strict';var _=require(_0x0771('0x0'));var util=require(_0x0771('0x1'));var logger=require('../../config/logger')(_0x0771('0x2'));var moment=require(_0x0771('0x3'));var BPromise=require(_0x0771('0x4'));var rp=require(_0x0771('0x5'));var fs=require('fs');var path=require(_0x0771('0x6'));var rimraf=require(_0x0771('0x7'));var config=require('../../config/environment');var attributes=require(_0x0771('0x8'));module[_0x0771('0x9')]=function(_0x5ca64f,_0x1fa145){return _0x5ca64f[_0x0771('0xa')](_0x0771('0xb'),attributes,{'tableName':_0x0771('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 32a0759..33b9c57 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 _0x00b3=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0xb5dc8c,_0x1fea21){var _0xcbef5a=function(_0x4ed1dd){while(--_0x4ed1dd){_0xb5dc8c['push'](_0xb5dc8c['shift']());}};_0xcbef5a(++_0x1fea21);}(_0x00b3,0x157));var _0x300b=function(_0x156e26,_0x5b4641){_0x156e26=_0x156e26-0x0;var _0x503abb=_0x00b3[_0x156e26];return _0x503abb;};'use strict';var _=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var moment=require(_0x300b('0x2'));var BPromise=require(_0x300b('0x3'));var rs=require(_0x300b('0x4'));var fs=require('fs');var Redis=require(_0x300b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x300b('0x6'));var logger=require(_0x300b('0x7'))('rpc');var config=require(_0x300b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x300b('0x9')][_0x300b('0xa')]({'port':0x232a});config[_0x300b('0xb')]=_[_0x300b('0xc')](config[_0x300b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x300b('0xd'))(new Redis(config[_0x300b('0xb')]));require(_0x300b('0xe'))[_0x300b('0xf')](socket);function respondWithRpcPromise(_0x1a8749,_0x5d01e0,_0x5c1ded){return new BPromise(function(_0x25f1cc,_0x2272d5){return client['request'](_0x1a8749,_0x5c1ded)[_0x300b('0x10')](function(_0xfc3ee2){logger['info'](_0x300b('0x11'),_0x5d01e0,_0x300b('0x12'));logger[_0x300b('0x13')](_0x300b('0x14'),_0x5d01e0,_0x300b('0x12'),JSON[_0x300b('0x15')](_0xfc3ee2));if(_0xfc3ee2[_0x300b('0x16')]){if(_0xfc3ee2[_0x300b('0x16')][_0x300b('0x17')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x5d01e0,_0xfc3ee2[_0x300b('0x16')][_0x300b('0x18')]);return _0x2272d5(_0xfc3ee2['error']['message']);}logger[_0x300b('0x16')](_0x300b('0x11'),_0x5d01e0,_0xfc3ee2[_0x300b('0x16')][_0x300b('0x18')]);return _0x25f1cc(_0xfc3ee2[_0x300b('0x16')][_0x300b('0x18')]);}else{logger[_0x300b('0x19')](_0x300b('0x11'),_0x5d01e0,'request\x20sent');_0x25f1cc(_0xfc3ee2[_0x300b('0x1a')][_0x300b('0x18')]);}})[_0x300b('0x1b')](function(_0xe804e){logger[_0x300b('0x16')](_0x300b('0x11'),_0x5d01e0,_0xe804e);_0x2272d5(_0xe804e);});});} \ No newline at end of file +var _0x4d49=['then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register'];(function(_0x846ae8,_0x33a70b){var _0x356b00=function(_0xa96f69){while(--_0xa96f69){_0x846ae8['push'](_0x846ae8['shift']());}};_0x356b00(++_0x33a70b);}(_0x4d49,0x141));var _0x94d4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4d49[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x94d4('0x0'));var moment=require('moment');var BPromise=require(_0x94d4('0x1'));var rs=require(_0x94d4('0x2'));var fs=require('fs');var Redis=require(_0x94d4('0x3'));var db=require(_0x94d4('0x4'))['db'];var utils=require(_0x94d4('0x5'));var logger=require(_0x94d4('0x6'))(_0x94d4('0x7'));var config=require(_0x94d4('0x8'));var jayson=require(_0x94d4('0x9'));var client=jayson['client'][_0x94d4('0xa')]({'port':0x232a});config[_0x94d4('0xb')]=_[_0x94d4('0xc')](config[_0x94d4('0xb')],{'host':_0x94d4('0xd'),'port':0x18eb});var socket=require(_0x94d4('0xe'))(new Redis(config['redis']));require(_0x94d4('0xf'))[_0x94d4('0x10')](socket);function respondWithRpcPromise(_0x562265,_0x23ef86,_0x283f63){return new BPromise(function(_0xd7820d,_0x2720dd){return client['request'](_0x562265,_0x283f63)[_0x94d4('0x11')](function(_0xe7f878){logger[_0x94d4('0x12')](_0x94d4('0x13'),_0x23ef86,_0x94d4('0x14'));logger[_0x94d4('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x23ef86,'request\x20sent',JSON['stringify'](_0xe7f878));if(_0xe7f878[_0x94d4('0x16')]){if(_0xe7f878[_0x94d4('0x16')]['code']===0x1f4){logger[_0x94d4('0x16')](_0x94d4('0x13'),_0x23ef86,_0xe7f878['error'][_0x94d4('0x17')]);return _0x2720dd(_0xe7f878['error'][_0x94d4('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x23ef86,_0xe7f878['error'][_0x94d4('0x17')]);return _0xd7820d(_0xe7f878[_0x94d4('0x16')][_0x94d4('0x17')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x23ef86,'request\x20sent');_0xd7820d(_0xe7f878[_0x94d4('0x18')][_0x94d4('0x17')]);}})[_0x94d4('0x19')](function(_0x47b760){logger[_0x94d4('0x16')](_0x94d4('0x13'),_0x23ef86,_0x47b760);_0x2720dd(_0x47b760);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4babb5b..375f7ae 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 _0x4584=['remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0x4584,0x1cf));var _0x4458=function(_0x4766d1,_0x4c5fe6){_0x4766d1=_0x4766d1-0x0;var _0x42d22b=_0x4584[_0x4766d1];return _0x42d22b;};'use strict';var VoicePrefixEvents=require(_0x4458('0x0'));var events=['save',_0x4458('0x1'),_0x4458('0x2')];function createListener(_0x23b438,_0x5340f5){return function(_0x570b9c){_0x5340f5[_0x4458('0x3')](_0x23b438,_0x570b9c);};}function removeListener(_0xde5996,_0x37118c){return function(){VoicePrefixEvents[_0x4458('0x4')](_0xde5996,_0x37118c);};}exports[_0x4458('0x5')]=function(_0xbf85ca){for(var _0x175c2d=0x0,_0x215b2d=events[_0x4458('0x6')];_0x175c2d<_0x215b2d;_0x175c2d++){var _0x51da14=events[_0x175c2d];var _0x14bb0f=createListener(_0x4458('0x7')+_0x51da14,_0xbf85ca);VoicePrefixEvents['on'](_0x51da14,_0x14bb0f);}}; \ No newline at end of file +var _0xfa12=['register','voicePrefix:','./voicePrefix.events','save','update','removeListener'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x24e11e,_0x198fb8){_0x24e11e=_0x24e11e-0x0;var _0x29899e=_0xfa12[_0x24e11e];return _0x29899e;};'use strict';var VoicePrefixEvents=require(_0x2fa1('0x0'));var events=[_0x2fa1('0x1'),'remove',_0x2fa1('0x2')];function createListener(_0x1d3d90,_0x1abe62){return function(_0x877ea9){_0x1abe62['emit'](_0x1d3d90,_0x877ea9);};}function removeListener(_0x2022bf,_0x358fe1){return function(){VoicePrefixEvents[_0x2fa1('0x3')](_0x2022bf,_0x358fe1);};}exports[_0x2fa1('0x4')]=function(_0x4d61b0){for(var _0x166949=0x0,_0x25b233=events['length'];_0x166949<_0x25b233;_0x166949++){var _0x3449c3=events[_0x166949];var _0x30a897=createListener(_0x2fa1('0x5')+_0x3449c3,_0x4d61b0);VoicePrefixEvents['on'](_0x3449c3,_0x30a897);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 595b32d..d524c03 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(_0xf229ea,_0x5d3047){var _0x4b7dac=function(_0x9f3af){while(--_0x9f3af){_0xf229ea['push'](_0xf229ea['shift']());}};_0x4b7dac(++_0x5d3047);}(_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(_0x479722,_0x231cef){var _0x2310fe=function(_0xd96529){while(--_0xd96529){_0x479722['push'](_0x479722['shift']());}};_0x2310fe(++_0x231cef);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a9e4a,_0x585df1){_0x4a9e4a=_0x4a9e4a-0x0;var _0xaa903e=_0xb10b[_0x4a9e4a];return _0xaa903e;};'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 af6418c..834b204 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 _0xe067=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe067,0xf4));var _0x7e06=function(_0x400bd2,_0x50b43c){_0x400bd2=_0x400bd2-0x0;var _0x223cec=_0xe067[_0x400bd2];return _0x223cec;};'use strict';var Sequelize=require(_0x7e06('0x0'));module[_0x7e06('0x1')]={'name':{'type':Sequelize[_0x7e06('0x2')],'allowNull':![],'unique':_0x7e06('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x5'),_0x7e06('0x6')),'allowNull':![],'defaultValue':_0x7e06('0x5')},'musiconhold':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':_0x7e06('0x7')},'announce':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x7e06('0x4')]('rr','ringall',_0x7e06('0x8'),_0x7e06('0x9'),_0x7e06('0xa'),_0x7e06('0xb'),'linear',_0x7e06('0xc'),_0x7e06('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x3ca9d2){this[_0x7e06('0xe')](_0x7e06('0xf'),_0x3ca9d2?_0x3ca9d2:'rrmemory');},'get':function(){var _0x2dc0bb=this[_0x7e06('0x10')](_0x7e06('0x11'));var _0x518c57=this['getDataValue'](_0x7e06('0x12'));var _0x114187=this[_0x7e06('0x10')](_0x7e06('0xf'));if(_0x2dc0bb===_0x7e06('0x6')){if(_0x518c57===_0x7e06('0x13')){return null;}if(_0x518c57===_0x7e06('0x14')&&![_0x7e06('0xb'),_0x7e06('0x15')][_0x7e06('0x16')](_0x114187)){this[_0x7e06('0xe')]('strategy',_0x7e06('0xb'));}}return _0x114187;}},'servicelevel':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7e06('0x17')](0xb)},'timeout':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7e06('0x2')]},'weight':{'type':Sequelize[_0x7e06('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':_0x7e06('0x18')},'autopause':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7e06('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7e06('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x7e06('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7e06('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7e06('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':_0x7e06('0x18')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x7e06('0x18'),'no',_0x7e06('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x7e06('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7e06('0x2')]},'queue_youarenext':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7e06('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7e06('0x2')]},'queue_quantity1':{'type':Sequelize[_0x7e06('0x2')]},'queue_quantity2':{'type':Sequelize[_0x7e06('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x7e06('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x7e06('0x1a')],'set':function(_0x4e3fb1){this[_0x7e06('0xe')]('periodic_announce',_0x4e3fb1?_0x4e3fb1[_0x7e06('0x1b')](','):[]);},'get':function(){return this[_0x7e06('0x10')](_0x7e06('0x1c'))?this[_0x7e06('0x10')]('periodic_announce')[_0x7e06('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':'yes','set':function(_0x25846a){this[_0x7e06('0xe')]('joinempty',_0x25846a?_0x25846a[_0x7e06('0x1b')](','):undefined);},'get':function(){return this[_0x7e06('0x10')]('joinempty')?this[_0x7e06('0x10')](_0x7e06('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x385313){this[_0x7e06('0xe')](_0x7e06('0x1f'),_0x385313?_0x385313['join'](','):undefined);},'get':function(){return this[_0x7e06('0x10')](_0x7e06('0x1f'))?this[_0x7e06('0x10')](_0x7e06('0x1f'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7e06('0x2')]},'description':{'type':Sequelize[_0x7e06('0x2')]},'acw':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':0x0,'set':function(_0x50f7dd){this[_0x7e06('0xe')]('acw',_0x50f7dd);if(_0x50f7dd){if(this[_0x7e06('0x10')](_0x7e06('0x21'))<0x2){this[_0x7e06('0xe')](_0x7e06('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':0x0,'comment':_0x7e06('0x22')},'dialMethod':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x13'),'progressive','power',_0x7e06('0x23'),_0x7e06('0x14')),'defaultValue':_0x7e06('0x24'),'comment':_0x7e06('0x25')},'dialLimitChannel':{'type':Sequelize[_0x7e06('0x17')](0x4)[_0x7e06('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7e06('0x27')},'dialLimitQueue':{'type':Sequelize[_0x7e06('0x17')](0x4)[_0x7e06('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x7e06('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7e06('0x29')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x7e06('0x2a'),_0x7e06('0x2b')),'defaultValue':_0x7e06('0x2b'),'comment':_0x7e06('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7e06('0x28')](0x2)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x7e06('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x7e06('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7e06('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7e06('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':_0x7e06('0x2f'),'comment':_0x7e06('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x31')},'dialQueueProject':{'type':Sequelize[_0x7e06('0x2')],'comment':_0x7e06('0x32')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e06('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x7e06('0x17')](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e06('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':_0x7e06('0x36')},'dialPrefix':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x7e06('0x37'),_0x7e06('0x38'),'onlyIfOpen'),'defaultValue':_0x7e06('0x37')},'dialAMDActive':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':0x0,'comment':_0x7e06('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x7e06('0x17')](0x9)[_0x7e06('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7e06('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x7e06('0x17')](0x9)[_0x7e06('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7e06('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7e06('0x17')](0x9)[_0x7e06('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7e06('0x3b')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7e06('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7e06('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7e06('0x17')](0x9)[_0x7e06('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7e06('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7e06('0x17')](0x9)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7e06('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7e06('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7e06('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7e06('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7e06('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x7e06('0x17')](0x5)[_0x7e06('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7e06('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':0x0,'comment':_0x7e06('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x43'),_0x7e06('0x44')),'defaultValue':_0x7e06('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x7e06('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7e06('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7e06('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7e06('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e06('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x7e06('0x17')](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7e06('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e06('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7e06('0x17')](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e06('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7e06('0x17')],'allowNull':!![],'comment':_0x7e06('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':![],'comment':_0x7e06('0x4d'),'set':function(_0x49179e){if(!_0x49179e)this[_0x7e06('0xe')](_0x7e06('0x4e'),null);this['setDataValue'](_0x7e06('0x4f'),_0x49179e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0xe0e9=['progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','includes','INTEGER','yes','once','periodic_announce','split','joinempty','leavewhenempty','join','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign'];(function(_0x6ec690,_0x962c2a){var _0x54dfcc=function(_0x1240c4){while(--_0x1240c4){_0x6ec690['push'](_0x6ec690['shift']());}};_0x54dfcc(++_0x962c2a);}(_0xe0e9,0x1d1));var _0x9e0e=function(_0x3b814e,_0x74a812){_0x3b814e=_0x3b814e-0x0;var _0x42e72a=_0xe0e9[_0x3b814e];return _0x42e72a;};'use strict';var Sequelize=require(_0x9e0e('0x0'));module[_0x9e0e('0x1')]={'name':{'type':Sequelize[_0x9e0e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x4'),_0x9e0e('0x5')),'allowNull':![],'defaultValue':_0x9e0e('0x4')},'musiconhold':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':_0x9e0e('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x9e0e('0x3')]('rr',_0x9e0e('0x7'),_0x9e0e('0x8'),_0x9e0e('0x9'),_0x9e0e('0xa'),_0x9e0e('0xb'),_0x9e0e('0xc'),'wrandom',_0x9e0e('0xd')),'allowNull':![],'defaultValue':_0x9e0e('0x7'),'set':function(_0x25aefa){this[_0x9e0e('0xe')](_0x9e0e('0xf'),_0x25aefa?_0x25aefa:'rrmemory');},'get':function(){var _0x258578=this[_0x9e0e('0x10')](_0x9e0e('0x11'));var _0x30618f=this[_0x9e0e('0x10')](_0x9e0e('0x12'));var _0x53e3af=this['getDataValue'](_0x9e0e('0xf'));if(_0x258578==='outbound'){if(_0x30618f===_0x9e0e('0x13')){return null;}if(_0x30618f===_0x9e0e('0x14')&&!['rrmemory','roundrobin'][_0x9e0e('0x15')](_0x53e3af)){this['setDataValue']('strategy',_0x9e0e('0xb'));}}return _0x53e3af;}},'servicelevel':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9e0e('0x16')](0xb)},'timeout':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9e0e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defaultValue':_0x9e0e('0x17')},'autopause':{'type':Sequelize[_0x9e0e('0x3')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9e0e('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9e0e('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no',_0x9e0e('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x9e0e('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x9e0e('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9e0e('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9e0e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9e0e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x9e0e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x9e0e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x9e0e('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x1997af){this[_0x9e0e('0xe')](_0x9e0e('0x19'),_0x1997af?_0x1997af['join'](','):[]);},'get':function(){return this['getDataValue'](_0x9e0e('0x19'))?this[_0x9e0e('0x10')](_0x9e0e('0x19'))[_0x9e0e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':'yes','set':function(_0x596e36){this[_0x9e0e('0xe')]('joinempty',_0x596e36?_0x596e36['join'](','):undefined);},'get':function(){return this[_0x9e0e('0x10')]('joinempty')?this[_0x9e0e('0x10')](_0x9e0e('0x1b'))[_0x9e0e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':'no','set':function(_0x1e73ae){this[_0x9e0e('0xe')](_0x9e0e('0x1c'),_0x1e73ae?_0x1e73ae[_0x9e0e('0x1d')](','):undefined);},'get':function(){return this[_0x9e0e('0x10')]('leavewhenempty')?this[_0x9e0e('0x10')](_0x9e0e('0x1c'))[_0x9e0e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9e0e('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9e0e('0x2')]},'description':{'type':Sequelize[_0x9e0e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x54e053){this[_0x9e0e('0xe')]('acw',_0x54e053);if(_0x54e053){if(this[_0x9e0e('0x10')](_0x9e0e('0x1e'))<0x2){this[_0x9e0e('0xe')](_0x9e0e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9e0e('0x1f')],'defaultValue':0x0,'comment':_0x9e0e('0x20')},'dialMethod':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x13'),_0x9e0e('0x21'),_0x9e0e('0x22'),_0x9e0e('0x23'),_0x9e0e('0x14')),'defaultValue':_0x9e0e('0x21'),'comment':_0x9e0e('0x24')},'dialLimitChannel':{'type':Sequelize[_0x9e0e('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9e0e('0x25')},'dialLimitQueue':{'type':Sequelize[_0x9e0e('0x16')](0x4)[_0x9e0e('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x9e0e('0x27')](0x2)[_0x9e0e('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9e0e('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x29'),_0x9e0e('0x2a')),'defaultValue':_0x9e0e('0x2a'),'comment':_0x9e0e('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9e0e('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x9e0e('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9e0e('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9e0e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9e0e('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x9e0e('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':_0x9e0e('0x2f'),'comment':_0x9e0e('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x9e0e('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x35')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x37')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9e0e('0x38')},'dialTimezone':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x9e0e('0x39')},'dialPrefix':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x3a'),'never',_0x9e0e('0x3b')),'defaultValue':_0x9e0e('0x3a')},'dialAMDActive':{'type':Sequelize[_0x9e0e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9e0e('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9e0e('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x9e0e('0x16')](0x9)[_0x9e0e('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9e0e('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9e0e('0x16')](0x9)[_0x9e0e('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9e0e('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x9e0e('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9e0e('0x3f')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9e0e('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9e0e('0x16')](0x9)[_0x9e0e('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9e0e('0x16')](0x9)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9e0e('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x9e0e('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9e0e('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9e0e('0x16')](0x9)[_0x9e0e('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9e0e('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x9e0e('0x1f')],'defaultValue':0x0,'comment':_0x9e0e('0x43')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x9e0e('0x44'),_0x9e0e('0x45')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x9e0e('0x2')],'comment':_0x9e0e('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9e0e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9e0e('0x46')},'dialCutDigit':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9e0e('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9e0e('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9e0e('0x1f')],'defaultValue':![],'comment':_0x9e0e('0x50'),'set':function(_0x1ffe3c){if(!_0x1ffe3c)this[_0x9e0e('0xe')](_0x9e0e('0x51'),null);this[_0x9e0e('0xe')](_0x9e0e('0x52'),_0x1ffe3c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 54b6065..7fc5d2f 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 _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0x1d6441,_0x813592){var _0x2bcda6=function(_0x22dc93){while(--_0x22dc93){_0x1d6441['push'](_0x1d6441['shift']());}};_0x2bcda6(++_0x813592);}(_0x8ef6,0xf2));var _0x68ef=function(_0x422df7,_0x58ad68){_0x422df7=_0x422df7-0x0;var _0x562db2=_0x8ef6[_0x422df7];return _0x562db2;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,null));}; \ No newline at end of file +var _0x008c=['deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','onlyIfOpen','into','fromQuery','COALESCE(phone,\x27\x27)','all','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','json','offset','undefined','count','set','Content-Range','then','inbound','map','value','includes','type','UserProfileResource','destroy','status','send','index','VoiceQueue','rawAttributes','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','model','intersection','fields','attributes','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','VoiceQueues','QueueCampaigns','outbound','name','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','createdAt','updatedAt','autoAssociation','getHoppers','findOne','CmHopper','length','hasOwnProperty','nolimit','limit','sort','pick','VoiceQueueId','filter','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','upsert','isNil','interface','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','union','compact','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','isEmpty','UserVoiceQueueRt','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','cm_contacts'];(function(_0xb5ec30,_0x1da318){var _0x22b248=function(_0x4efdeb){while(--_0x4efdeb){_0xb5ec30['push'](_0xb5ec30['shift']());}};_0x22b248(++_0x1da318);}(_0x008c,0x188));var _0xc008=function(_0x2041a4,_0x55946d){_0x2041a4=_0x2041a4-0x0;var _0x5464b8=_0x008c[_0x2041a4];return _0x5464b8;};'use strict';var moment=require(_0xc008('0x0'));var BPromise=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var _=require(_0xc008('0x3'));var squel=require(_0xc008('0x4'));var Redis=require('ioredis');var qs=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var config=require(_0xc008('0x8'));var db=require(_0xc008('0x9'))['db'];config[_0xc008('0xa')]=_[_0xc008('0xb')](config[_0xc008('0xa')],{'host':_0xc008('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc008('0xa')]));require('./voiceQueue.socket')[_0xc008('0xd')](socket);function respondWithStatusCode(_0x5b64f8,_0x52041f){_0x52041f=_0x52041f||0xcc;return function(_0x27830d){if(_0x27830d){return _0x5b64f8[_0xc008('0xe')](_0x52041f);}return _0x5b64f8['status'](_0x52041f)['end']();};}function respondWithResult(_0x543eb8,_0x1eacfa){_0x1eacfa=_0x1eacfa||0xc8;return function(_0xc881aa){if(_0xc881aa){return _0x543eb8['status'](_0x1eacfa)[_0xc008('0xf')](_0xc881aa);}};}function respondWithFilteredResult(_0x332fd4,_0x2ea200){return function(_0x2a5b4e){if(_0x2a5b4e){var _0x9ffa93=typeof _0x2ea200[_0xc008('0x10')]===_0xc008('0x11')&&typeof _0x2ea200['limit']==='undefined';var _0x33f44c=_0x2a5b4e['count'];var _0x25e13f=_0x9ffa93?0x0:_0x2ea200[_0xc008('0x10')];var _0x2073ef=_0x9ffa93?_0x2a5b4e[_0xc008('0x12')]:_0x2ea200[_0xc008('0x10')]+_0x2ea200['limit'];var _0x5e894e;if(_0x2073ef>=_0x33f44c){_0x2073ef=_0x33f44c;_0x5e894e=0xc8;}else{_0x5e894e=0xce;}_0x332fd4['status'](_0x5e894e);return _0x332fd4[_0xc008('0x13')](_0xc008('0x14'),_0x25e13f+'-'+_0x2073ef+'/'+_0x33f44c)[_0xc008('0xf')](_0x2a5b4e);}return null;};}function saveUpdates(_0x3eb12a){return function(_0x4fe771){if(_0x4fe771){return _0x4fe771['update'](_0x3eb12a)['then'](function(_0x5c2668){return _0x5c2668;});}return null;};}function removeEntity(_0x46042b){return function(_0x462af5){if(_0x462af5){return _0x462af5['destroy']()[_0xc008('0x15')](function(){var _0x5906e6=_0x462af5['get']({'plain':!![]});var _0x543e5d=[{'name':'VoiceQueues','value':_0xc008('0x16'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x590a71=_(_0x543e5d)['filter']('ignore')[_0xc008('0x17')](_0xc008('0x18'))[_0xc008('0x18')]();if(_[_0xc008('0x19')](_0x590a71,_0x5906e6[_0xc008('0x1a')])){return;}var _0x110128=_['find'](_0x543e5d,[_0xc008('0x18'),_0x5906e6['type']])['name'];return db[_0xc008('0x1b')][_0xc008('0x1c')]({'where':{'type':_0x110128,'resourceId':_0x5906e6['id']}})[_0xc008('0x15')](function(){return _0x462af5;});})[_0xc008('0x15')](function(){_0x46042b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de1e9){return function(_0x3f7b07){if(!_0x3f7b07){_0x5de1e9[_0xc008('0xe')](0x194);}return _0x3f7b07;};}function handleError(_0x92c582,_0x2e31c2){_0x2e31c2=_0x2e31c2||0x1f4;return function(_0x5bebd9){logger['error'](_0x5bebd9['stack']);if(_0x5bebd9['name']){delete _0x5bebd9['name'];}_0x92c582[_0xc008('0x1d')](_0x2e31c2)[_0xc008('0x1e')](_0x5bebd9);};}exports[_0xc008('0x1f')]=function(_0x529961,_0x24c14c){var _0x32390d={};var _0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x20')][_0xc008('0x21')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x22')]};});_0x32390d=qs[_0xc008('0x23')](_0x2a7d4f,_0x529961);var _0xf831f2={'where':_0x32390d[_0xc008('0x24')]};return db[_0xc008('0x20')][_0xc008('0x12')](_0xf831f2)[_0xc008('0x15')](function(_0x22d8e8){_0x209591[_0xc008('0x12')]=_0x22d8e8;_0x32390d[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x529961[_0xc008('0x26')]);return db['VoiceQueue'][_0xc008('0x27')](_0x32390d);})[_0xc008('0x15')](function(_0x499754){_0x209591[_0xc008('0x28')]=_0x499754;return _0x209591;})[_0xc008('0x15')](respondWithFilteredResult(_0x24c14c,_0x32390d))[_0xc008('0x29')](handleError(_0x24c14c,null));};exports[_0xc008('0x2a')]=function(_0xd0e05a,_0x3cd878){var _0x7cfbc5={'raw':![],'where':{'id':_0xd0e05a[_0xc008('0x2b')]['id']}},_0x470e79={};_0x470e79['model']=_[_0xc008('0x2c')](db[_0xc008('0x20')][_0xc008('0x21')]);_0x470e79[_0xc008('0x26')]=_[_0xc008('0x2c')](_0xd0e05a[_0xc008('0x26')]);_0x470e79[_0xc008('0x2d')]=_['intersection'](_0x470e79[_0xc008('0x2e')],_0x470e79[_0xc008('0x26')]);_0x7cfbc5['attributes']=_[_0xc008('0x2f')](_0x470e79[_0xc008('0x2e')],qs['fields'](_0xd0e05a[_0xc008('0x26')][_0xc008('0x30')]));_0x7cfbc5[_0xc008('0x31')]=_0x7cfbc5['attributes']['length']?_0x7cfbc5['attributes']:_0x470e79[_0xc008('0x2e')];if(_0xd0e05a['query'][_0xc008('0x32')]){_0x7cfbc5[_0xc008('0x25')]=[{'all':!![]}];}_0x7cfbc5=_[_0xc008('0x33')]({},_0x7cfbc5,_0xd0e05a[_0xc008('0x34')]);return db[_0xc008('0x20')][_0xc008('0x35')](_0x7cfbc5)[_0xc008('0x15')](handleEntityNotFound(_0x3cd878,null))[_0xc008('0x15')](respondWithResult(_0x3cd878,null))[_0xc008('0x29')](handleError(_0x3cd878,null));};exports[_0xc008('0x36')]=function(_0x3ebb83,_0xdfca2e){return db[_0xc008('0x20')][_0xc008('0x36')](_0x3ebb83['body'],{})[_0xc008('0x15')](function(_0x23c4db){var _0x30b7df=_0x3ebb83[_0xc008('0x37')]['get']({'plain':!![]});if(!_0x30b7df)throw new Error(_0xc008('0x38'));if(_0x30b7df[_0xc008('0x39')]===_0xc008('0x37')){var _0x36e7ae=_0x23c4db[_0xc008('0x3a')]({'plain':!![]});var _0x5706bb=[{'name':_0xc008('0x3b'),'value':_0xc008('0x16')},{'name':_0xc008('0x3c'),'value':_0xc008('0x3d')}];var _0x7279e8=_['find'](_0x5706bb,[_0xc008('0x18'),_0x36e7ae[_0xc008('0x1a')]])[_0xc008('0x3e')];return db[_0xc008('0x3f')]['find']({'where':{'name':_0x7279e8,'userProfileId':_0x30b7df[_0xc008('0x40')]},'raw':!![]})[_0xc008('0x15')](function(_0x351d5c){if(_0x351d5c&&_0x351d5c['autoAssociation']===0x0){return db[_0xc008('0x1b')]['create']({'name':_0x36e7ae[_0xc008('0x3e')],'resourceId':_0x36e7ae['id'],'type':_0x351d5c['name'],'sectionId':_0x351d5c['id']},{})[_0xc008('0x15')](function(){return _0x23c4db;});}else{return _0x23c4db;}})[_0xc008('0x29')](function(_0x5a5d85){logger[_0xc008('0x41')](_0xc008('0x42'),_0x5a5d85);throw _0x5a5d85;});}return _0x23c4db;})[_0xc008('0x15')](respondWithResult(_0xdfca2e,0xc9))['catch'](handleError(_0xdfca2e,null));};exports[_0xc008('0x43')]=function(_0x2a9b5c,_0x200469){var _0x44fc5d={'where':{'id':_0x2a9b5c[_0xc008('0x2b')]['id']}},_0x347629={};_0x347629['model']=_['keys'](db['VoiceQueue'][_0xc008('0x21')]);_0x44fc5d[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x347629[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x2a9b5c[_0xc008('0x26')][_0xc008('0x30')]));_0x44fc5d[_0xc008('0x31')]=_0x44fc5d['attributes']['length']?_0x44fc5d['attributes']:_0x347629[_0xc008('0x2e')];if(_0x2a9b5c[_0xc008('0x26')][_0xc008('0x32')]){_0x44fc5d['include']=[{'all':!![]}];}_0x44fc5d=_[_0xc008('0x33')]({},_0x44fc5d,_0x2a9b5c[_0xc008('0x34')]);return db[_0xc008('0x20')][_0xc008('0x35')](_0x44fc5d)[_0xc008('0x15')](handleEntityNotFound(_0x200469,null))[_0xc008('0x15')](function(_0x17ec90){if(_0x17ec90){var _0x405e87=_0x17ec90[_0xc008('0x3a')]({'plain':!![]});_0x405e87=qs[_0xc008('0x44')](_0x405e87,['id','createdAt','updatedAt']);_0x2a9b5c[_0xc008('0x45')]=_['omit'](_0x2a9b5c[_0xc008('0x45')],['id',_0xc008('0x46'),_0xc008('0x47')]);return db['VoiceQueue'][_0xc008('0x36')](_[_0xc008('0x33')](_0x405e87,_0x2a9b5c[_0xc008('0x45')]),{'include':_0x2a9b5c[_0xc008('0x26')][_0xc008('0x32')]?[{'all':!![]}]:undefined})['then'](function(_0x3a7b3b){var _0x27b022=_0x2a9b5c['user'][_0xc008('0x3a')]({'plain':!![]});if(!_0x27b022)throw new Error(_0xc008('0x38'));if(_0x27b022['role']==='user'){var _0x2df905=_0x3a7b3b[_0xc008('0x3a')]({'plain':!![]});var _0x20947b=[{'name':_0xc008('0x3b'),'value':_0xc008('0x16')},{'name':'QueueCampaigns','value':'outbound'}];var _0x34b72a=_['find'](_0x20947b,[_0xc008('0x18'),_0x2df905[_0xc008('0x1a')]])[_0xc008('0x3e')];return db[_0xc008('0x3f')][_0xc008('0x35')]({'where':{'name':_0x34b72a,'userProfileId':_0x27b022[_0xc008('0x40')]},'raw':!![]})['then'](function(_0x2ea742){if(_0x2ea742&&_0x2ea742[_0xc008('0x48')]===0x0){return db[_0xc008('0x1b')][_0xc008('0x36')]({'name':_0x2df905[_0xc008('0x3e')],'resourceId':_0x2df905['id'],'type':_0x2ea742['name'],'sectionId':_0x2ea742['id']},{})[_0xc008('0x15')](function(){return _0x3a7b3b;});}else{return _0x3a7b3b;}})['catch'](function(_0x535e6e){logger['error'](_0xc008('0x42'),_0x535e6e);throw _0x535e6e;});}return _0x3a7b3b;});}})[_0xc008('0x15')](respondWithResult(_0x200469,0xc9))[_0xc008('0x29')](handleError(_0x200469,null));};exports['update']=function(_0x3aeeab,_0x2d8361){if(_0x3aeeab[_0xc008('0x45')]['id']){delete _0x3aeeab['body']['id'];}return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x3aeeab[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x2d8361,null))['then'](saveUpdates(_0x3aeeab[_0xc008('0x45')],null))['then'](respondWithResult(_0x2d8361,null))[_0xc008('0x29')](handleError(_0x2d8361,null));};exports[_0xc008('0x1c')]=function(_0x2ae14e,_0x943c91){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x2ae14e['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x943c91,null))['then'](removeEntity(_0x943c91,null))['catch'](handleError(_0x943c91,null));};exports[_0xc008('0x49')]=function(_0x30aa1e,_0x56e755){var _0xb1befa={'raw':![],'where':{}};var _0xb8ba7={};var _0x3e373e={'count':0x0,'rows':[]};return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x30aa1e[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x56e755,null))['then'](function(_0x16e052){if(_0x16e052){_0xb8ba7[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x4b')][_0xc008('0x21')]);_0xb8ba7[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x30aa1e[_0xc008('0x26')]);_0xb8ba7[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0xb8ba7[_0xc008('0x2e')],_0xb8ba7[_0xc008('0x26')]);_0xb1befa[_0xc008('0x31')]=_[_0xc008('0x2f')](_0xb8ba7['model'],qs[_0xc008('0x30')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x30')]));_0xb1befa['attributes']=_0xb1befa[_0xc008('0x31')][_0xc008('0x4c')]?_0xb1befa['attributes']:_0xb8ba7['model'];if(!_0x30aa1e[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0xb1befa[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x4f')]);_0xb1befa[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x10')]);}_0xb1befa['order']=qs[_0xc008('0x50')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x50')]);_0xb1befa[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x30aa1e['query'],_0xb8ba7[_0xc008('0x2d')]));_0xb1befa[_0xc008('0x24')][_0xc008('0x52')]=_0x16e052['id'];if(_0x30aa1e['query'][_0xc008('0x53')]){_0xb1befa[_0xc008('0x24')]=_[_0xc008('0x33')](_0xb1befa['where'],{'$or':_[_0xc008('0x17')](_0xb1befa['attributes'],function(_0x50ee03){var _0xee7a85={};_0xee7a85[_0x50ee03]={'$like':'%'+_0x30aa1e[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0xee7a85;})});}_0xb1befa=_[_0xc008('0x33')]({},_0xb1befa,_0x30aa1e['options']);return db[_0xc008('0x4b')][_0xc008('0x12')]({'where':_0xb1befa['where']})[_0xc008('0x15')](function(_0x5233bb){_0x3e373e[_0xc008('0x12')]=_0x5233bb;if(_0x30aa1e['query'][_0xc008('0x32')]){_0xb1befa['include']=[{'all':!![]}];}return db[_0xc008('0x4b')][_0xc008('0x27')](_0xb1befa);})[_0xc008('0x15')](function(_0x47337b){_0x3e373e['rows']=_0x47337b;return _0x3e373e;});}})[_0xc008('0x15')](respondWithFilteredResult(_0x56e755,_0xb1befa))[_0xc008('0x29')](handleError(_0x56e755,null));};exports[_0xc008('0x54')]=function(_0x1d49db,_0x321500){var _0x13ef78={'raw':!![],'where':{}};var _0xd9e3fd={};var _0x3b46e4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc008('0x4a')]({'where':{'id':_0x1d49db['params']['id']}})['then'](handleEntityNotFound(_0x321500,null))['then'](function(_0x406ead){if(_0x406ead){_0xd9e3fd[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x55')][_0xc008('0x21')]);_0xd9e3fd[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x1d49db[_0xc008('0x26')]);_0xd9e3fd[_0xc008('0x2d')]=_['intersection'](_0xd9e3fd[_0xc008('0x2e')],_0xd9e3fd[_0xc008('0x26')]);_0x13ef78[_0xc008('0x31')]=_[_0xc008('0x2f')](_0xd9e3fd[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x1d49db[_0xc008('0x26')][_0xc008('0x30')]));_0x13ef78[_0xc008('0x31')]=_0x13ef78[_0xc008('0x31')][_0xc008('0x4c')]?_0x13ef78[_0xc008('0x31')]:_0xd9e3fd['model'];if(!_0x1d49db['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x13ef78[_0xc008('0x4f')]=qs['limit'](_0x1d49db[_0xc008('0x26')][_0xc008('0x4f')]);_0x13ef78['offset']=qs['offset'](_0x1d49db['query'][_0xc008('0x10')]);}_0x13ef78[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x1d49db[_0xc008('0x26')][_0xc008('0x50')]);_0x13ef78[_0xc008('0x24')]=qs[_0xc008('0x2d')](_[_0xc008('0x51')](_0x1d49db[_0xc008('0x26')],_0xd9e3fd[_0xc008('0x2d')]));_0x13ef78['where']['VoiceQueueId']=_0x406ead['id'];if(_0x1d49db[_0xc008('0x26')][_0xc008('0x53')]){_0x13ef78[_0xc008('0x24')]=_[_0xc008('0x33')](_0x13ef78[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x13ef78['attributes'],function(_0x5794fe){var _0x68372f={};_0x68372f[_0x5794fe]={'$like':'%'+_0x1d49db[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x68372f;})});}_0x13ef78=_['merge']({},_0x13ef78,_0x1d49db['options']);return db['CmHopperHistory']['count']({'where':_0x13ef78['where']})['then'](function(_0x276de2){_0x3b46e4['count']=_0x276de2;if(_0x1d49db[_0xc008('0x26')]['includeAll']){_0x13ef78[_0xc008('0x25')]=[{'all':!![]}];}return db[_0xc008('0x55')][_0xc008('0x27')](_0x13ef78);})['then'](function(_0x58f348){_0x3b46e4[_0xc008('0x28')]=_0x58f348;return _0x3b46e4;});}})['then'](respondWithFilteredResult(_0x321500,_0x13ef78))[_0xc008('0x29')](handleError(_0x321500,null));};exports[_0xc008('0x57')]=function(_0x544519,_0x7b7246){var _0x4db90b={'raw':!![],'where':{}};var _0x554cf4={};var _0x23bece={'count':0x0,'rows':[]};return db[_0xc008('0x20')]['findOne']({'where':{'id':_0x544519[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x7b7246,null))[_0xc008('0x15')](function(_0x4bd290){if(_0x4bd290){_0x554cf4[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x58')][_0xc008('0x21')]);_0x554cf4[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x544519['query']);_0x554cf4[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x554cf4[_0xc008('0x2e')],_0x554cf4['query']);_0x4db90b[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x554cf4[_0xc008('0x2e')],qs['fields'](_0x544519['query']['fields']));_0x4db90b[_0xc008('0x31')]=_0x4db90b[_0xc008('0x31')][_0xc008('0x4c')]?_0x4db90b[_0xc008('0x31')]:_0x554cf4[_0xc008('0x2e')];if(!_0x544519[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x4db90b['limit']=qs[_0xc008('0x4f')](_0x544519[_0xc008('0x26')]['limit']);_0x4db90b['offset']=qs[_0xc008('0x10')](_0x544519[_0xc008('0x26')][_0xc008('0x10')]);}_0x4db90b[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x544519['query'][_0xc008('0x50')]);_0x4db90b[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x544519[_0xc008('0x26')],_0x554cf4[_0xc008('0x2d')]));_0x4db90b[_0xc008('0x24')]['VoiceQueueId']=_0x4bd290['id'];if(_0x544519[_0xc008('0x26')][_0xc008('0x53')]){_0x4db90b[_0xc008('0x24')]=_[_0xc008('0x33')](_0x4db90b['where'],{'$or':_[_0xc008('0x17')](_0x4db90b[_0xc008('0x31')],function(_0x57cf19){var _0x555e8a={};_0x555e8a[_0x57cf19]={'$like':'%'+_0x544519[_0xc008('0x26')]['filter']+'%'};return _0x555e8a;})});}_0x4db90b=_[_0xc008('0x33')]({},_0x4db90b,_0x544519[_0xc008('0x34')]);return db['CmHopperFinal'][_0xc008('0x12')]({'where':_0x4db90b[_0xc008('0x24')]})[_0xc008('0x15')](function(_0xbe42a2){_0x23bece[_0xc008('0x12')]=_0xbe42a2;if(_0x544519[_0xc008('0x26')][_0xc008('0x32')]){_0x4db90b[_0xc008('0x25')]=[{'all':!![]}];}return db[_0xc008('0x58')][_0xc008('0x27')](_0x4db90b);})['then'](function(_0x49e6d5){_0x23bece[_0xc008('0x28')]=_0x49e6d5;return _0x23bece;});}})[_0xc008('0x15')](respondWithFilteredResult(_0x7b7246,_0x4db90b))['catch'](handleError(_0x7b7246,null));};exports[_0xc008('0x59')]=function(_0x1bdaa9,_0x698d5c){var _0x5f1e48={'raw':!![],'where':{}};var _0x303cdd={};var _0x38239a={'count':0x0,'rows':[]};return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x1bdaa9[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x698d5c,null))[_0xc008('0x15')](function(_0x5bd010){if(_0x5bd010){_0x303cdd[_0xc008('0x2e')]=_['keys'](db[_0xc008('0x5a')][_0xc008('0x21')]);_0x303cdd[_0xc008('0x26')]=_['keys'](_0x1bdaa9[_0xc008('0x26')]);_0x303cdd[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x303cdd[_0xc008('0x2e')],_0x303cdd[_0xc008('0x26')]);_0x5f1e48[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x303cdd[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x1bdaa9[_0xc008('0x26')]['fields']));_0x5f1e48[_0xc008('0x31')]=_0x5f1e48[_0xc008('0x31')][_0xc008('0x4c')]?_0x5f1e48[_0xc008('0x31')]:_0x303cdd[_0xc008('0x2e')];if(!_0x1bdaa9['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x5f1e48[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x4f')]);_0x5f1e48[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x10')]);}_0x5f1e48[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x50')]);_0x5f1e48[_0xc008('0x24')]=qs['filters'](_['pick'](_0x1bdaa9[_0xc008('0x26')],_0x303cdd[_0xc008('0x2d')]));_0x5f1e48[_0xc008('0x24')][_0xc008('0x52')]=_0x5bd010['id'];if(_0x1bdaa9[_0xc008('0x26')][_0xc008('0x53')]){_0x5f1e48[_0xc008('0x24')]=_[_0xc008('0x33')](_0x5f1e48[_0xc008('0x24')],{'$or':_['map'](_0x5f1e48[_0xc008('0x31')],function(_0x2bbadf){var _0x54fd75={};_0x54fd75[_0x2bbadf]={'$like':'%'+_0x1bdaa9[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x54fd75;})});}_0x5f1e48=_[_0xc008('0x33')]({},_0x5f1e48,_0x1bdaa9[_0xc008('0x34')]);return db[_0xc008('0x5a')][_0xc008('0x12')]({'where':_0x5f1e48['where']})[_0xc008('0x15')](function(_0x321532){_0x38239a[_0xc008('0x12')]=_0x321532;if(_0x1bdaa9[_0xc008('0x26')]['includeAll']){_0x5f1e48[_0xc008('0x25')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc008('0x27')](_0x5f1e48);})[_0xc008('0x15')](function(_0x5b47c3){_0x38239a[_0xc008('0x28')]=_0x5b47c3;return _0x38239a;});}})['then'](respondWithFilteredResult(_0x698d5c,_0x5f1e48))[_0xc008('0x29')](handleError(_0x698d5c,null));};exports['getTeams']=function(_0x5b387d,_0x5351f7){var _0x79dfea={};var _0x402b67={};var _0x48f40f;var _0x4fda8;return db[_0xc008('0x20')]['findOne']({'where':{'id':_0x5b387d[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x5351f7,null))[_0xc008('0x15')](function(_0x5843ee){if(_0x5843ee){_0x48f40f=_0x5843ee;_0x402b67[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x5b')][_0xc008('0x21')]);_0x402b67[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x5b387d[_0xc008('0x26')]);_0x402b67[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x402b67[_0xc008('0x2e')],_0x402b67[_0xc008('0x26')]);_0x79dfea['attributes']=_[_0xc008('0x2f')](_0x402b67[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x5b387d['query'][_0xc008('0x30')]));_0x79dfea[_0xc008('0x31')]=_0x79dfea[_0xc008('0x31')]['length']?_0x79dfea[_0xc008('0x31')]:_0x402b67['model'];_0x79dfea[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x5b387d[_0xc008('0x26')]['sort']);_0x79dfea[_0xc008('0x24')]=qs[_0xc008('0x2d')](_[_0xc008('0x51')](_0x5b387d[_0xc008('0x26')],_0x402b67[_0xc008('0x2d')]));if(_0x5b387d[_0xc008('0x26')][_0xc008('0x53')]){_0x79dfea['where']=_[_0xc008('0x33')](_0x79dfea[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x79dfea[_0xc008('0x31')],function(_0x5a61d6){var _0x46fba5={};_0x46fba5[_0x5a61d6]={'$like':'%'+_0x5b387d['query'][_0xc008('0x53')]+'%'};return _0x46fba5;})});}_0x79dfea=_[_0xc008('0x33')]({},_0x79dfea,_0x5b387d[_0xc008('0x34')]);return _0x48f40f[_0xc008('0x5c')](_0x79dfea);}})[_0xc008('0x15')](function(_0x9f266e){if(_0x9f266e){_0x4fda8=_0x9f266e[_0xc008('0x4c')];if(!_0x5b387d['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x79dfea[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x5b387d['query'][_0xc008('0x4f')]);_0x79dfea['offset']=qs[_0xc008('0x10')](_0x5b387d[_0xc008('0x26')][_0xc008('0x10')]);}return _0x48f40f['getTeams'](_0x79dfea);}})['then'](function(_0x39bfc0){if(_0x39bfc0){return _0x39bfc0?{'count':_0x4fda8,'rows':_0x39bfc0}:null;}})['then'](respondWithResult(_0x5351f7,null))[_0xc008('0x29')](handleError(_0x5351f7,null));};exports[_0xc008('0x5d')]=function(_0x1c2e63,_0xaf3bed){var _0x58ae7b=_0x1c2e63[_0xc008('0x45')][_0xc008('0x5e')];var _0x537e5e=_['map'](_0x58ae7b,'id');return db[_0xc008('0x5b')][_0xc008('0x27')]({'where':{'id':_0x537e5e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc008('0x5f'),'attributes':['id',_0xc008('0x3e'),_0xc008('0x60'),_0xc008('0x61'),'interface'],'raw':!![]}]})[_0xc008('0x15')](function(_0x3721e8){if(_0x3721e8){var _0xc344a7=_[_0xc008('0x62')](_0x3721e8,function(_0x78b833){var _0x177733=_0x78b833[_0xc008('0x3a')]({'plain':!![]});_0x177733[_0xc008('0x5f')][_0xc008('0x63')](function(_0xa332b1){_0xa332b1[_0xc008('0x64')]=_[_0xc008('0x35')](_0x58ae7b,{'id':_0x177733['id']})[_0xc008('0x64')];});return _0x177733['Agents'];});return db['VoiceQueue'][_0xc008('0x35')]({'where':{'id':_0x1c2e63[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](function(_0x4447ba){return db[_0xc008('0x65')][_0xc008('0x66')](function(_0xe5d226){return _0x4447ba['addTeams'](_0x537e5e,{'transaction':_0xe5d226})['then'](function(){return BPromise[_0xc008('0x67')](_0x58ae7b,function(_0x3d33ed){return db[_0xc008('0x68')]['upsert']({'TeamId':_0x3d33ed['id'],'VoiceQueueId':_0x1c2e63[_0xc008('0x2b')]['id'],'penalty':_0x3d33ed[_0xc008('0x64')]},{'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){return BPromise[_0xc008('0x67')](_0xc344a7,function(_0x156ec3){return db[_0xc008('0x69')][_0xc008('0x6a')]({'where':{'UserId':_0x156ec3['id'],'VoiceQueueId':_0x1c2e63[_0xc008('0x2b')]['id']},'defaults':{'penalty':_0x156ec3[_0xc008('0x64')]},'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){return BPromise[_0xc008('0x67')](_[_0xc008('0x53')](_0xc344a7,{'online':!![]}),function(_0x4ffaa3){return db['UserVoiceQueueRt'][_0xc008('0x6b')]({'membername':_0x4ffaa3[_0xc008('0x3e')],'UserId':_0x4ffaa3['id'],'queue_name':_0x4447ba['name'],'VoiceQueueId':_0x4447ba['id'],'interface':_[_0xc008('0x6c')](_0x4ffaa3[_0xc008('0x6d')])?util[_0xc008('0x6e')](_0xc008('0x6f'),_0x4ffaa3[_0xc008('0x3e')]):_0x4ffaa3[_0xc008('0x6d')],'paused':_0x4ffaa3[_0xc008('0x61')]||![],'penalty':_0x4ffaa3[_0xc008('0x64')]},{'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){_0xc344a7['forEach'](function(_0x51b305){socket['emit'](_0xc008('0x70'),{'UserId':_0x51b305['id'],'VoiceQueueId':_0x4447ba['id']});});});});});}})['then'](respondWithStatusCode(_0xaf3bed,null))[_0xc008('0x29')](handleError(_0xaf3bed,null));};exports[_0xc008('0x71')]=function(_0x2c6a48,_0x177e8e){return db[_0xc008('0x5b')][_0xc008('0x27')]({'where':{'id':_0x2c6a48[_0xc008('0x26')][_0xc008('0x72')]},'attributes':['id'],'include':[{'model':db[_0xc008('0x73')],'as':_0xc008('0x5f'),'attributes':['id'],'raw':!![]}]})[_0xc008('0x15')](handleEntityNotFound(_0x177e8e,null))[_0xc008('0x15')](function(_0x1fea74){var _0x304083=_[_0xc008('0x17')](_0x1fea74,'id');var _0x473f44=[];var _0x41d1ea=[];var _0x5c2ca1=squel[_0xc008('0x74')]();_0x5c2ca1['field'](_0xc008('0x75'))[_0xc008('0x76')](_0xc008('0x77'),'tq')['join'](_0xc008('0x78'),'ut',_0xc008('0x79'))[_0xc008('0x24')](_0xc008('0x7a'),_0x2c6a48[_0xc008('0x2b')]['id']);for(var _0x377754=0x0;_0x377754<_0x1fea74[_0xc008('0x4c')];_0x377754+=0x1){let _0x57b8da=_0x1fea74[_0x377754];for(var _0x1cad4b=0x0;_0x1cad4b<_0x57b8da[_0xc008('0x5f')][_0xc008('0x4c')];_0x1cad4b+=0x1){let _0xdb4cef=_0x57b8da['Agents'][_0x1cad4b];var _0x555e8c=_0x5c2ca1['clone']();_0x555e8c['where'](_0xc008('0x7b'),_0xdb4cef['id']);_0x41d1ea[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x555e8c['toString'](),{'type':db[_0xc008('0x65')][_0xc008('0x7d')][_0xc008('0x7e')]})['then'](function(_0x438195){if(_0x438195['length']===0x1){return _0xdb4cef['id'];}else{var _0x3d76b7=_['every'](_[_0xc008('0x17')](_0x438195,_0xc008('0x7f')),function(_0x1aaf89){return _[_0xc008('0x19')](_0x304083,_0x1aaf89);});if(_0x3d76b7){return _0xdb4cef['id'];}}}));}}return BPromise['all'](_0x41d1ea)[_0xc008('0x15')](function(_0x19dcb7){_0x473f44=_(_0x473f44)[_0xc008('0x80')](_0x19dcb7)[_0xc008('0x81')]()[_0xc008('0x18')]();return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x2c6a48['params']['id']}})[_0xc008('0x15')](function(_0x30b6af){return db[_0xc008('0x65')]['transaction'](function(_0x5ba04f){return _0x30b6af[_0xc008('0x71')](_0x2c6a48[_0xc008('0x26')][_0xc008('0x72')],{'transaction':_0x5ba04f})[_0xc008('0x15')](function(){if(!_['isEmpty'](_0x473f44)){return _0x30b6af[_0xc008('0x82')](_0x473f44,{'transaction':_0x5ba04f})[_0xc008('0x15')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2c6a48['params']['id'],'UserId':_0x473f44},'transaction':_0x5ba04f});});}})[_0xc008('0x15')](function(){_0x473f44['forEach'](function(_0x3744e1){socket['emit'](_0xc008('0x83'),{'UserId':_0x3744e1,'VoiceQueueId':_0x30b6af['id']});});});});});});})[_0xc008('0x15')](respondWithStatusCode(_0x177e8e,null))[_0xc008('0x29')](handleError(_0x177e8e,null));};exports[_0xc008('0x84')]=function(_0x5c24cd,_0x5effd6){var _0x23ba7e,_0x274739;return db[_0xc008('0x20')]['find']({'where':{'id':_0x5c24cd[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x5effd6,null))[_0xc008('0x15')](function(_0x272d98){if(_0x272d98){_0x274739=_0x272d98;return _0x272d98[_0xc008('0x84')](_0x5c24cd[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x5c24cd[_0xc008('0x45')],[_0xc008('0x72'),'id'])||{})[_0xc008('0x85')](function(_0x57687f){for(var _0x5ea13a=0x0;_0x5ea13a<_0x5c24cd[_0xc008('0x45')]['ids'][_0xc008('0x4c')];_0x5ea13a+=0x1){socket[_0xc008('0x86')]('userVoiceQueue:save',{'UserId':Number(_0x5c24cd['body'][_0xc008('0x72')][_0x5ea13a]),'VoiceQueueId':Number(_0x5c24cd[_0xc008('0x2b')]['id'])});}return _0x57687f;});}})[_0xc008('0x15')](function(_0x129cbf){_0x23ba7e=_0x129cbf||[];if(_0x274739){return db[_0xc008('0x73')][_0xc008('0x27')]({'where':{'id':_0x5c24cd['body'][_0xc008('0x72')]},'attributes':['id',_0xc008('0x3e'),_0xc008('0x60'),'voicePause',_0xc008('0x6d')],'raw':!![]});}})[_0xc008('0x15')](function(_0xcef0e4){if(!_[_0xc008('0x87')](_0xcef0e4)){var _0x49f92e=[];for(var _0x4ae026=0x0;_0x4ae026<_0xcef0e4[_0xc008('0x4c')];_0x4ae026++){if(_0xcef0e4[_0x4ae026]['online']){_0x49f92e[_0xc008('0x7c')](db[_0xc008('0x88')][_0xc008('0x6b')]({'membername':_0xcef0e4[_0x4ae026][_0xc008('0x3e')],'UserId':_0xcef0e4[_0x4ae026]['id'],'queue_name':_0x274739[_0xc008('0x3e')],'VoiceQueueId':_0x274739['id'],'interface':_['isNil'](_0xcef0e4[_0x4ae026]['interface'])?util[_0xc008('0x6e')](_0xc008('0x6f'),_0xcef0e4[_0x4ae026][_0xc008('0x3e')]):_0xcef0e4[_0x4ae026][_0xc008('0x6d')],'paused':_0xcef0e4[_0x4ae026][_0xc008('0x61')]||![],'penalty':_0x5c24cd[_0xc008('0x45')][_0xc008('0x64')]||0x0}));}}return BPromise['all'](_0x49f92e);}})[_0xc008('0x15')](function(){return _0x23ba7e;})[_0xc008('0x15')](respondWithResult(_0x5effd6,null))[_0xc008('0x29')](handleError(_0x5effd6,null));};exports[_0xc008('0x82')]=function(_0x1afb32,_0x1c2263){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x1afb32[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x1c2263,null))[_0xc008('0x15')](function(_0x328284){if(_0x328284){return _0x328284['removeAgents'](_0x1afb32[_0xc008('0x26')][_0xc008('0x72')])['then'](function(){if(_[_0xc008('0x89')](_0x1afb32[_0xc008('0x26')][_0xc008('0x72')])){for(var _0x2598be=0x0;_0x2598be<_0x1afb32[_0xc008('0x26')][_0xc008('0x72')][_0xc008('0x4c')];_0x2598be+=0x1){socket[_0xc008('0x86')](_0xc008('0x83'),{'UserId':Number(_0x1afb32[_0xc008('0x26')][_0xc008('0x72')][_0x2598be]),'VoiceQueueId':Number(_0x1afb32['params']['id'])});}}else{socket[_0xc008('0x86')](_0xc008('0x83'),{'UserId':Number(_0x1afb32[_0xc008('0x26')][_0xc008('0x72')]),'VoiceQueueId':Number(_0x1afb32[_0xc008('0x2b')]['id'])});}});}})[_0xc008('0x15')](function(_0x12f5d1){return db[_0xc008('0x88')][_0xc008('0x1c')]({'where':{'VoiceQueueId':_0x1afb32[_0xc008('0x2b')]['id'],'UserId':_0x1afb32[_0xc008('0x26')][_0xc008('0x72')]}})[_0xc008('0x15')](function(){return _0x12f5d1;});})[_0xc008('0x15')](respondWithStatusCode(_0x1c2263,null))[_0xc008('0x29')](handleError(_0x1c2263,null));};exports[_0xc008('0x8a')]=function(_0x5c358b,_0x49688b){var _0x51fd86={};var _0x10778f={};var _0x237ffb;var _0x3f80f4;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x5c358b[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x49688b,null))['then'](function(_0x3e7099){if(_0x3e7099){_0x237ffb=_0x3e7099;_0x10778f['model']=_['keys'](db[_0xc008('0x73')][_0xc008('0x21')]);_0x10778f['query']=_[_0xc008('0x2c')](_0x5c358b[_0xc008('0x26')]);_0x10778f[_0xc008('0x2d')]=_['intersection'](_0x10778f[_0xc008('0x2e')],_0x10778f[_0xc008('0x26')]);_0x51fd86[_0xc008('0x31')]=_['intersection'](_0x10778f[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x5c358b[_0xc008('0x26')][_0xc008('0x30')]));_0x51fd86[_0xc008('0x31')]=_0x51fd86[_0xc008('0x31')][_0xc008('0x4c')]?_0x51fd86[_0xc008('0x31')]:_0x10778f['model'];_0x51fd86[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x5c358b[_0xc008('0x26')][_0xc008('0x50')]);_0x51fd86[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x5c358b[_0xc008('0x26')],_0x10778f[_0xc008('0x2d')]));if(_0x5c358b[_0xc008('0x26')][_0xc008('0x53')]){_0x51fd86[_0xc008('0x24')]=_[_0xc008('0x33')](_0x51fd86[_0xc008('0x24')],{'$or':_['map'](_0x51fd86[_0xc008('0x31')],function(_0x231318){var _0x3df369={};_0x3df369[_0x231318]={'$like':'%'+_0x5c358b[_0xc008('0x26')]['filter']+'%'};return _0x3df369;})});}_0x51fd86=_['merge']({},_0x51fd86,_0x5c358b[_0xc008('0x34')]);return _0x237ffb[_0xc008('0x8a')](_0x51fd86);}})['then'](function(_0x30e433){if(_0x30e433){_0x3f80f4=_0x30e433[_0xc008('0x4c')];if(!_0x5c358b[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x51fd86[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x5c358b['query']['limit']);_0x51fd86[_0xc008('0x10')]=qs['offset'](_0x5c358b[_0xc008('0x26')][_0xc008('0x10')]);}return _0x237ffb[_0xc008('0x8a')](_0x51fd86);}})[_0xc008('0x15')](function(_0x2ea1db){if(_0x2ea1db){return _0x2ea1db?{'count':_0x3f80f4,'rows':_0x2ea1db}:null;}})[_0xc008('0x15')](respondWithResult(_0x49688b,null))[_0xc008('0x29')](handleError(_0x49688b,null));};exports[_0xc008('0x8b')]=function(_0x367873,_0x356a82){var _0x368c1f={};var _0x4fd0ff={};var _0x22772e;var _0x39fd43;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x367873[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x356a82,null))[_0xc008('0x15')](function(_0x506dc0){if(_0x506dc0){_0x22772e=_0x506dc0;_0x4fd0ff[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x88')]['rawAttributes']);_0x4fd0ff[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x367873[_0xc008('0x26')]);_0x4fd0ff[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x4fd0ff[_0xc008('0x2e')],_0x4fd0ff['query']);_0x368c1f['attributes']=_[_0xc008('0x2f')](_0x4fd0ff[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x367873[_0xc008('0x26')][_0xc008('0x30')]));_0x368c1f['attributes']=_0x368c1f[_0xc008('0x31')]['length']?_0x368c1f[_0xc008('0x31')]:_0x4fd0ff[_0xc008('0x2e')];_0x368c1f['order']=qs[_0xc008('0x50')](_0x367873[_0xc008('0x26')][_0xc008('0x50')]);_0x368c1f[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x367873[_0xc008('0x26')],_0x4fd0ff[_0xc008('0x2d')]));if(_0x367873[_0xc008('0x26')][_0xc008('0x53')]){_0x368c1f['where']=_[_0xc008('0x33')](_0x368c1f[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x368c1f['attributes'],function(_0x43f96e){var _0x353cd5={};_0x353cd5[_0x43f96e]={'$like':'%'+_0x367873[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x353cd5;})});}_0x368c1f=_['merge']({},_0x368c1f,_0x367873[_0xc008('0x34')]);return _0x22772e[_0xc008('0x8b')](_0x368c1f);}})[_0xc008('0x15')](function(_0x9afcd6){if(_0x9afcd6){_0x39fd43=_0x9afcd6[_0xc008('0x4c')];if(!_0x367873['query'][_0xc008('0x4d')]('nolimit')){_0x368c1f['limit']=qs[_0xc008('0x4f')](_0x367873['query'][_0xc008('0x4f')]);_0x368c1f[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x367873[_0xc008('0x26')][_0xc008('0x10')]);}return _0x22772e[_0xc008('0x8b')](_0x368c1f);}})[_0xc008('0x15')](function(_0x5e9e9c){return _0x5e9e9c?{'count':_0x39fd43,'rows':_0x5e9e9c}:null;})[_0xc008('0x15')](respondWithResult(_0x356a82,null))[_0xc008('0x29')](handleError(_0x356a82,null));};exports[_0xc008('0x8c')]=function(_0x45fe90,_0xc046ce){var _0x46fc75={};var _0x59b5b9={};var _0x3c3ead;var _0x3c8a79;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x45fe90[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0xc046ce,null))[_0xc008('0x15')](function(_0x3aa9b4){if(_0x3aa9b4){_0x3c3ead=_0x3aa9b4;_0x59b5b9['model']=_['keys'](db[_0xc008('0x8d')][_0xc008('0x21')]);_0x59b5b9['query']=_[_0xc008('0x2c')](_0x45fe90['query']);_0x59b5b9[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x59b5b9[_0xc008('0x2e')],_0x59b5b9[_0xc008('0x26')]);_0x46fc75[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x59b5b9[_0xc008('0x2e')],qs['fields'](_0x45fe90[_0xc008('0x26')]['fields']));_0x46fc75[_0xc008('0x31')]=_0x46fc75[_0xc008('0x31')][_0xc008('0x4c')]?_0x46fc75[_0xc008('0x31')]:_0x59b5b9[_0xc008('0x2e')];_0x46fc75[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x45fe90['query'][_0xc008('0x50')]);_0x46fc75[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x45fe90[_0xc008('0x26')],_0x59b5b9[_0xc008('0x2d')]));if(_0x45fe90[_0xc008('0x26')][_0xc008('0x53')]){_0x46fc75[_0xc008('0x24')]=_['merge'](_0x46fc75[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x46fc75[_0xc008('0x31')],function(_0x3e7c19){var _0x47d263={};_0x47d263[_0x3e7c19]={'$like':'%'+_0x45fe90['query']['filter']+'%'};return _0x47d263;})});}_0x46fc75=_[_0xc008('0x33')]({},_0x46fc75,_0x45fe90[_0xc008('0x34')]);return _0x3c3ead['getLists'](_0x46fc75);}})['then'](function(_0x5035ca){if(_0x5035ca){_0x3c8a79=_0x5035ca['length'];if(!_0x45fe90[_0xc008('0x26')][_0xc008('0x4d')]('nolimit')){_0x46fc75[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x45fe90[_0xc008('0x26')][_0xc008('0x4f')]);_0x46fc75[_0xc008('0x10')]=qs['offset'](_0x45fe90['query'][_0xc008('0x10')]);}return _0x3c3ead[_0xc008('0x8c')](_0x46fc75);}})[_0xc008('0x15')](function(_0x46f9ab){if(_0x46f9ab){return _0x46f9ab?{'count':_0x3c8a79,'rows':_0x46f9ab}:null;}})[_0xc008('0x15')](respondWithResult(_0xc046ce,null))[_0xc008('0x29')](handleError(_0xc046ce,null));};exports[_0xc008('0x8e')]=function(_0x5645bb,_0x2ebe07){var _0x3d6f0d=moment()[_0xc008('0x6e')](_0xc008('0x8f'));var _0x3be328,_0x3bcf94;return db[_0xc008('0x20')]['find']({'where':{'id':_0x5645bb['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x2ebe07,null))[_0xc008('0x15')](function(_0x11bcba){if(_0x11bcba){_0x3bcf94=_0x11bcba;return _0x11bcba[_0xc008('0x8e')](_0x5645bb[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x5645bb[_0xc008('0x45')],[_0xc008('0x72'),'id'])||{});}return null;})[_0xc008('0x85')](function(_0xefba5){var _0x202826;_0x3be328=_0xefba5||[];var _0x37e1f2=[];if(_0xefba5){for(var _0x5161f3=0x0;_0x5161f3<_0xefba5['length'];_0x5161f3+=0x1){var _0x43ec81=_0xefba5[_0x5161f3][_0xc008('0x3a')]({'plain':!![]});_0x3bcf94[_0xc008('0x90')]=_0x5645bb[_0xc008('0x45')][_0xc008('0x90')]?_0x5645bb[_0xc008('0x45')][_0xc008('0x90')]:_0x3bcf94['dialCheckDuplicateType'];switch(_0x3bcf94['dialCheckDuplicateType']){case'always':_0x202826=squel[_0xc008('0x91')]()['into']('cm_hopper')['fromQuery']([_0xc008('0x92'),_0xc008('0x93'),_0xc008('0x94'),_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()[_0xc008('0x96')](_0xc008('0x92'),_0xc008('0x92'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','scheduledAt')['field']('id',_0xc008('0x94'))[_0xc008('0x96')](_0x43ec81[_0xc008('0x97')][_0xc008('0x98')](),_0xc008('0x95'))[_0xc008('0x96')](_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')](),'VoiceQueueId')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','createdAt')['field']('\x27'+_0x3d6f0d+'\x27','updatedAt')['from'](_0xc008('0x99'))['where'](_0xc008('0x9a'))[_0xc008('0x24')](_0xc008('0x9b'),_0x43ec81['CmListId']['toString']())[_0xc008('0x24')](_0xc008('0x9c'))['where'](_0xc008('0x9d'),squel[_0xc008('0x74')]()[_0xc008('0x96')](_0xc008('0x9e'))[_0xc008('0x76')](_0xc008('0x9f'))[_0xc008('0x24')](_0xc008('0x7a'),_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')]()))['where'](_0xc008('0x9d'),squel[_0xc008('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0xc008('0x76')](_0xc008('0xa0'))[_0xc008('0x24')]('VoiceQueueId\x20=\x20?',_0x5645bb['params']['id']['toString']())))['toString']();break;case _0xc008('0xa1'):_0x202826=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa0'))[_0xc008('0xa3')]([_0xc008('0x92'),_0xc008('0x93'),'ContactId',_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()['field'](_0xc008('0x92'),_0xc008('0x92'))['field']('\x27'+_0x3d6f0d+'\x27',_0xc008('0x93'))[_0xc008('0x96')]('id',_0xc008('0x94'))[_0xc008('0x96')](_0x43ec81['CmListId'][_0xc008('0x98')](),'ListId')[_0xc008('0x96')](_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')](),_0xc008('0x52'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','createdAt')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x47'))[_0xc008('0x76')](_0xc008('0x99'))['where'](_0xc008('0x9a'))['where']('ListId\x20=\x20?',_0x43ec81[_0xc008('0x97')][_0xc008('0x98')]())[_0xc008('0x24')]('phone\x20IS\x20NOT\x20NULL')[_0xc008('0x24')](_0xc008('0x9d'),squel['select']()[_0xc008('0x96')](_0xc008('0xa4'))['from']('cm_hopper')[_0xc008('0x24')]('VoiceQueueId\x20=\x20?',_0x5645bb['params']['id'][_0xc008('0x98')]())))['toString']();break;default:_0x202826=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa0'))[_0xc008('0xa3')]([_0xc008('0x92'),'scheduledAt','ContactId',_0xc008('0x95'),'VoiceQueueId',_0xc008('0x46'),'updatedAt'],squel['select']()['field'](_0xc008('0x92'),'phone')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x93'))['field']('id','ContactId')[_0xc008('0x96')](_0x43ec81[_0xc008('0x97')][_0xc008('0x98')](),_0xc008('0x95'))['field'](_0x5645bb['params']['id'][_0xc008('0x98')](),'VoiceQueueId')['field']('\x27'+_0x3d6f0d+'\x27',_0xc008('0x46'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','updatedAt')['from']('cm_contacts')[_0xc008('0x24')]('deletedAt\x20IS\x20NULL')[_0xc008('0x24')](_0xc008('0x9b'),_0x43ec81[_0xc008('0x97')][_0xc008('0x98')]())[_0xc008('0x24')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x37e1f2[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x202826));}return BPromise[_0xc008('0xa5')](_0x37e1f2);}})[_0xc008('0x15')](function(){var _0x262b79=[];var _0x15c5a2=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa6'))[_0xc008('0xa3')]([_0xc008('0xa7'),'phone',_0xc008('0xa8'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()['field'](_0xc008('0xa9'))[_0xc008('0x96')](_0xc008('0xaa'))[_0xc008('0x96')](_0xc008('0xab'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x46'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','updatedAt')[_0xc008('0x76')](_0xc008('0xac'),'ci')[_0xc008('0xad')](_0xc008('0xa0'),'h',_0xc008('0xae'))[_0xc008('0x24')](_0xc008('0xaf'),_0x3d6f0d)['where'](_0xc008('0xb0'),'PHONE'))[_0xc008('0x98')]();_0x262b79[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x15c5a2));return BPromise[_0xc008('0xa5')](_0x262b79);})[_0xc008('0x15')](function(){return _0x3be328;})[_0xc008('0x15')](respondWithResult(_0x2ebe07,null))[_0xc008('0x29')](handleError(_0x2ebe07,null));};exports[_0xc008('0xb1')]=function(_0x471780,_0x4fae34){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x471780[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x4fae34,null))[_0xc008('0x15')](function(_0x1cc6a6){if(_0x1cc6a6){return _0x1cc6a6[_0xc008('0xb1')](_0x471780[_0xc008('0x26')][_0xc008('0x72')]);}})[_0xc008('0x15')](function(_0x471618){if(_0x471618){return db[_0xc008('0x4b')][_0xc008('0x1c')]({'where':{'ListId':_0x471780['query'][_0xc008('0x72')],'VoiceQueueId':_0x471780['params']['id']}})[_0xc008('0x15')](function(){return _0x471618;});}})[_0xc008('0x15')](respondWithStatusCode(_0x4fae34,null))[_0xc008('0x29')](handleError(_0x4fae34,null));};exports[_0xc008('0xb2')]=function(_0x370234,_0x3ff7d2){var _0x478794={};var _0x406de6={};var _0x34cbce;var _0x337acd;return db['VoiceQueue']['findOne']({'where':{'id':_0x370234['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x3ff7d2,null))[_0xc008('0x15')](function(_0x2ccfcf){if(_0x2ccfcf){_0x34cbce=_0x2ccfcf;_0x406de6[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x8d')][_0xc008('0x21')]);_0x406de6['query']=_[_0xc008('0x2c')](_0x370234[_0xc008('0x26')]);_0x406de6[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x406de6[_0xc008('0x2e')],_0x406de6['query']);_0x478794[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x406de6[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x370234[_0xc008('0x26')][_0xc008('0x30')]));_0x478794[_0xc008('0x31')]=_0x478794[_0xc008('0x31')][_0xc008('0x4c')]?_0x478794[_0xc008('0x31')]:_0x406de6[_0xc008('0x2e')];_0x478794['order']=qs[_0xc008('0x50')](_0x370234['query'][_0xc008('0x50')]);_0x478794[_0xc008('0x24')]=qs[_0xc008('0x2d')](_['pick'](_0x370234[_0xc008('0x26')],_0x406de6['filters']));if(_0x370234[_0xc008('0x26')][_0xc008('0x53')]){_0x478794[_0xc008('0x24')]=_[_0xc008('0x33')](_0x478794[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x478794[_0xc008('0x31')],function(_0x89601c){var _0x22bb2a={};_0x22bb2a[_0x89601c]={'$like':'%'+_0x370234[_0xc008('0x26')]['filter']+'%'};return _0x22bb2a;})});}_0x478794=_[_0xc008('0x33')]({},_0x478794,_0x370234['options']);return _0x34cbce['getBlackLists'](_0x478794);}})[_0xc008('0x15')](function(_0x55ad1f){if(_0x55ad1f){_0x337acd=_0x55ad1f[_0xc008('0x4c')];if(!_0x370234[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x478794['limit']=qs[_0xc008('0x4f')](_0x370234[_0xc008('0x26')][_0xc008('0x4f')]);_0x478794[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x370234['query'][_0xc008('0x10')]);}return _0x34cbce[_0xc008('0xb2')](_0x478794);}})['then'](function(_0x247e3a){if(_0x247e3a){return _0x247e3a?{'count':_0x337acd,'rows':_0x247e3a}:null;}})[_0xc008('0x15')](respondWithResult(_0x3ff7d2,null))[_0xc008('0x29')](handleError(_0x3ff7d2,null));};exports[_0xc008('0xb3')]=function(_0x252c44,_0x3b46db){var _0x482efd;return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x252c44[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x3b46db,null))[_0xc008('0x15')](function(_0x2f217e){if(_0x2f217e){return _0x2f217e[_0xc008('0xb3')](_0x252c44[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x252c44['body'],[_0xc008('0x72'),'id'])||{});}return null;})[_0xc008('0x85')](function(_0x298783){var _0xe349bd;_0x482efd=_0x298783||[];var _0x50db48=[];if(_0x298783){for(var _0x384f2f=0x0;_0x384f2f<_0x298783[_0xc008('0x4c')];_0x384f2f+=0x1){var _0x367581=_0x298783[_0x384f2f][_0xc008('0x3a')]({'plain':!![]});_0xe349bd=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xb4'))[_0xc008('0xa3')]([_0xc008('0x92'),_0xc008('0x94'),_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel['select']()[_0xc008('0x96')](_0xc008('0x92'),_0xc008('0x92'))[_0xc008('0x96')]('id',_0xc008('0x94'))['field'](_0x367581[_0xc008('0x97')][_0xc008('0x98')](),'ListId')[_0xc008('0x96')](_0x252c44[_0xc008('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('NOW()',_0xc008('0x46'))['field']('NOW()',_0xc008('0x47'))[_0xc008('0x76')](_0xc008('0x99'))['where']('deletedAt\x20IS\x20NULL')[_0xc008('0x24')](_0xc008('0x9b'),_0x367581[_0xc008('0x97')][_0xc008('0x98')]())['where'](_0xc008('0x9c')))[_0xc008('0x98')]();_0x50db48['push'](db[_0xc008('0x65')]['query'](_0xe349bd));}return BPromise['all'](_0x50db48);}})[_0xc008('0x15')](function(){return _0x482efd;})[_0xc008('0x15')](respondWithResult(_0x3b46db,null))['catch'](handleError(_0x3b46db,null));};exports['removeBlackLists']=function(_0x1e3098,_0x9b997d){return db['VoiceQueue'][_0xc008('0x35')]({'where':{'id':_0x1e3098['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x9b997d,null))[_0xc008('0x15')](function(_0x1422ab){if(_0x1422ab){return _0x1422ab[_0xc008('0xb5')](_0x1e3098[_0xc008('0x26')][_0xc008('0x72')]);}})[_0xc008('0x15')](function(_0x41a8a6){if(_0x41a8a6){return db['CmHopperBlack'][_0xc008('0x1c')]({'where':{'ListId':_0x1e3098['query'][_0xc008('0x72')],'VoiceQueueId':_0x1e3098['params']['id']}})['then'](function(){return _0x41a8a6;});}})[_0xc008('0x15')](respondWithStatusCode(_0x9b997d,null))[_0xc008('0x29')](handleError(_0x9b997d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 85b563b..7a2b7ee 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 _0x1293=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1a815d,_0x20cc04){var _0x4b6685=function(_0x41a58a){while(--_0x41a58a){_0x1a815d['push'](_0x1a815d['shift']());}};_0x4b6685(++_0x20cc04);}(_0x1293,0x1d0));var _0x3129=function(_0x5bf578,_0x52abff){_0x5bf578=_0x5bf578-0x0;var _0x2ac394=_0x1293[_0x5bf578];return _0x2ac394;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x3129('0x0'))['db'][_0x3129('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3129('0x2')](0x0);var events={'afterCreate':_0x3129('0x3'),'afterUpdate':_0x3129('0x4'),'afterDestroy':'remove'};function emitEvent(_0x573106){return function(_0x2e5342,_0x16137b,_0x69f87f){VoiceQueueEvents['emit'](_0x573106+':'+_0x2e5342['id'],_0x2e5342);VoiceQueueEvents[_0x3129('0x5')](_0x573106,_0x2e5342);_0x69f87f(null);};}for(var e in events){if(events[_0x3129('0x6')](e)){var event=events[e];VoiceQueue[_0x3129('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xa895=['events','VoiceQueue','setMaxListeners','save','remove','hook','exports'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xa895,0x1ab));var _0x5a89=function(_0x5e17e7,_0x551ed9){_0x5e17e7=_0x5e17e7-0x0;var _0x19a417=_0xa895[_0x5e17e7];return _0x19a417;};'use strict';var EventEmitter=require(_0x5a89('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x5a89('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5a89('0x2')](0x0);var events={'afterCreate':_0x5a89('0x3'),'afterUpdate':'update','afterDestroy':_0x5a89('0x4')};function emitEvent(_0x3a96c0){return function(_0x3b9ca2,_0x3500a3,_0x25da68){VoiceQueueEvents['emit'](_0x3a96c0+':'+_0x3b9ca2['id'],_0x3b9ca2);VoiceQueueEvents['emit'](_0x3a96c0,_0x3b9ca2);_0x25da68(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x5a89('0x5')](e,emitEvent(event));}}module[_0x5a89('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index b8cb0f0..55e65bb 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x3003fc,_0x5ac5de){var _0x22cb43=function(_0x478661){while(--_0x478661){_0x3003fc['push'](_0x3003fc['shift']());}};_0x22cb43(++_0x5ac5de);}(_0x3e74,0x175));var _0x43e7=function(_0x236c8f,_0x808ff3){_0x236c8f=_0x236c8f-0x0;var _0x4366c9=_0x3e74[_0x236c8f];return _0x4366c9;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x308df0,_0x2a5d0f){var _0x2db98a=function(_0x57063d){while(--_0x57063d){_0x308df0['push'](_0x308df0['shift']());}};_0x2db98a(++_0x2a5d0f);}(_0x34e8,0x12c));var _0x834e=function(_0x21cfba,_0x1aa704){_0x21cfba=_0x21cfba-0x0;var _0x468ab8=_0x34e8[_0x21cfba];return _0x468ab8;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 44d7c3a..0d227d8 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 _0x7060=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','raw','options','where','attributes','limit','include','map','model','then','debug','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x6c1312,_0x4a6a7a){var _0x1f986c=function(_0x3367a5){while(--_0x3367a5){_0x6c1312['push'](_0x6c1312['shift']());}};_0x1f986c(++_0x4a6a7a);}(_0x7060,0xca));var _0x0706=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7060[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0706('0x0'));var util=require(_0x0706('0x1'));var moment=require(_0x0706('0x2'));var BPromise=require(_0x0706('0x3'));var rs=require(_0x0706('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0706('0x5'));var logger=require(_0x0706('0x6'))(_0x0706('0x7'));var config=require(_0x0706('0x8'));var jayson=require(_0x0706('0x9'));var client=jayson[_0x0706('0xa')][_0x0706('0xb')]({'port':0x232a});config[_0x0706('0xc')]=_[_0x0706('0xd')](config['redis'],{'host':_0x0706('0xe'),'port':0x18eb});var socket=require(_0x0706('0xf'))(new Redis(config[_0x0706('0xc')]));require(_0x0706('0x10'))[_0x0706('0x11')](socket);function respondWithRpcPromise(_0x13ae32,_0x197168,_0xb62272){return new BPromise(function(_0x5a6801,_0x3acae0){return client[_0x0706('0x12')](_0x13ae32,_0xb62272)['then'](function(_0x628ed1){logger[_0x0706('0x13')](_0x0706('0x14'),_0x197168,_0x0706('0x15'));logger['debug'](_0x0706('0x16'),_0x197168,_0x0706('0x15'),JSON[_0x0706('0x17')](_0x628ed1));if(_0x628ed1['error']){if(_0x628ed1[_0x0706('0x18')][_0x0706('0x19')]===0x1f4){logger[_0x0706('0x18')](_0x0706('0x14'),_0x197168,_0x628ed1[_0x0706('0x18')][_0x0706('0x1a')]);return _0x3acae0(_0x628ed1[_0x0706('0x18')]['message']);}logger['error'](_0x0706('0x14'),_0x197168,_0x628ed1[_0x0706('0x18')][_0x0706('0x1a')]);return _0x5a6801(_0x628ed1[_0x0706('0x18')][_0x0706('0x1a')]);}else{logger[_0x0706('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x197168,_0x0706('0x15'));_0x5a6801(_0x628ed1['result'][_0x0706('0x1a')]);}})[_0x0706('0x1b')](function(_0x193410){logger[_0x0706('0x18')](_0x0706('0x14'),_0x197168,_0x193410);_0x3acae0(_0x193410);});});}exports[_0x0706('0x1c')]=function(_0x410964){var _0x247547=this;return new Promise(function(_0x37f0d5,_0xbebca3){return db[_0x0706('0x1d')][_0x0706('0x1e')]({'raw':_0x410964['options']?_0x410964['options'][_0x0706('0x1f')]===undefined?!![]:![]:!![],'where':_0x410964[_0x0706('0x20')]?_0x410964[_0x0706('0x20')][_0x0706('0x21')]||null:null,'attributes':_0x410964[_0x0706('0x20')]?_0x410964[_0x0706('0x20')][_0x0706('0x22')]||null:null,'limit':_0x410964['options']?_0x410964[_0x0706('0x20')][_0x0706('0x23')]||null:null,'include':_0x410964[_0x0706('0x20')]?_0x410964[_0x0706('0x20')][_0x0706('0x24')]?_[_0x0706('0x25')](_0x410964[_0x0706('0x20')][_0x0706('0x24')],function(_0x3212dc){return{'model':db[_0x3212dc[_0x0706('0x26')]],'as':_0x3212dc['as'],'attributes':_0x3212dc[_0x0706('0x22')],'include':_0x3212dc[_0x0706('0x24')]?_[_0x0706('0x25')](_0x3212dc[_0x0706('0x24')],function(_0x7c2bdd){return{'model':db[_0x7c2bdd['model']],'as':_0x7c2bdd['as'],'attributes':_0x7c2bdd[_0x0706('0x22')],'include':_0x7c2bdd[_0x0706('0x24')]?_['map'](_0x7c2bdd[_0x0706('0x24')],function(_0x349d55){return{'model':db[_0x349d55['model']],'as':_0x349d55['as'],'attributes':_0x349d55[_0x0706('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0706('0x27')](function(_0x4add49){logger[_0x0706('0x13')](_0x0706('0x1c'),_0x410964);logger[_0x0706('0x28')](_0x0706('0x1c'),_0x410964,JSON[_0x0706('0x17')](_0x4add49));_0x37f0d5(_0x4add49);})[_0x0706('0x1b')](function(_0x5582d6){logger[_0x0706('0x18')](_0x0706('0x1c'),_0x5582d6[_0x0706('0x1a')],_0x410964);_0xbebca3(_0x247547[_0x0706('0x18')](0x1f4,_0x5582d6['message']));});});};exports[_0x0706('0x29')]=function(_0x4bc2f4){var _0x404b11=this;return new Promise(function(_0x21baaf,_0x71e9d){return db['VoiceQueue']['find']({'raw':_0x4bc2f4[_0x0706('0x20')]?_0x4bc2f4[_0x0706('0x20')][_0x0706('0x1f')]===undefined?!![]:![]:!![],'where':_0x4bc2f4[_0x0706('0x20')]?_0x4bc2f4[_0x0706('0x20')]['where']||null:null,'attributes':_0x4bc2f4[_0x0706('0x20')]?_0x4bc2f4[_0x0706('0x20')][_0x0706('0x22')]||null:null,'include':_0x4bc2f4[_0x0706('0x20')]?_0x4bc2f4['options'][_0x0706('0x24')]?_['map'](_0x4bc2f4['options'][_0x0706('0x24')],function(_0x681680){return{'model':db[_0x681680[_0x0706('0x26')]],'as':_0x681680['as'],'attributes':_0x681680[_0x0706('0x22')],'include':_0x681680[_0x0706('0x24')]?_[_0x0706('0x25')](_0x681680[_0x0706('0x24')],function(_0x5bce5e){return{'model':db[_0x5bce5e['model']],'as':_0x5bce5e['as'],'attributes':_0x5bce5e['attributes'],'include':_0x5bce5e['include']?_[_0x0706('0x25')](_0x5bce5e[_0x0706('0x24')],function(_0x2a8b45){return{'model':db[_0x2a8b45[_0x0706('0x26')]],'as':_0x2a8b45['as'],'attributes':_0x2a8b45[_0x0706('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0706('0x27')](function(_0x8a698c){logger[_0x0706('0x13')](_0x0706('0x29'),_0x4bc2f4);logger[_0x0706('0x28')](_0x0706('0x29'),_0x4bc2f4,JSON[_0x0706('0x17')](_0x8a698c));_0x21baaf(_0x8a698c);})[_0x0706('0x1b')](function(_0xa1f777){logger['error'](_0x0706('0x29'),_0xa1f777[_0x0706('0x1a')],_0x4bc2f4);_0x71e9d(_0x404b11['error'](0x1f4,_0xa1f777[_0x0706('0x1a')]));});});}; \ No newline at end of file +var _0xd2a4=['options','raw','where','attributes','limit','include','map','model','then','ShowVoiceQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceQueue','VoiceQueue'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xd2a4,0x86));var _0x4d2a=function(_0x52610b,_0x32d0bf){_0x52610b=_0x52610b-0x0;var _0x18ae58=_0xd2a4[_0x52610b];return _0x18ae58;};'use strict';var _=require('lodash');var util=require(_0x4d2a('0x0'));var moment=require('moment');var BPromise=require(_0x4d2a('0x1'));var rs=require(_0x4d2a('0x2'));var fs=require('fs');var Redis=require(_0x4d2a('0x3'));var db=require(_0x4d2a('0x4'))['db'];var utils=require(_0x4d2a('0x5'));var logger=require(_0x4d2a('0x6'))(_0x4d2a('0x7'));var config=require(_0x4d2a('0x8'));var jayson=require(_0x4d2a('0x9'));var client=jayson[_0x4d2a('0xa')][_0x4d2a('0xb')]({'port':0x232a});config[_0x4d2a('0xc')]=_[_0x4d2a('0xd')](config[_0x4d2a('0xc')],{'host':_0x4d2a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4d2a('0xf'))[_0x4d2a('0x10')](socket);function respondWithRpcPromise(_0x28242a,_0x1881ec,_0x424c33){return new BPromise(function(_0x56dc25,_0x4bea92){return client[_0x4d2a('0x11')](_0x28242a,_0x424c33)['then'](function(_0x3302bf){logger['info'](_0x4d2a('0x12'),_0x1881ec,_0x4d2a('0x13'));logger[_0x4d2a('0x14')](_0x4d2a('0x15'),_0x1881ec,'request\x20sent',JSON[_0x4d2a('0x16')](_0x3302bf));if(_0x3302bf[_0x4d2a('0x17')]){if(_0x3302bf[_0x4d2a('0x17')]['code']===0x1f4){logger[_0x4d2a('0x17')](_0x4d2a('0x12'),_0x1881ec,_0x3302bf['error'][_0x4d2a('0x18')]);return _0x4bea92(_0x3302bf[_0x4d2a('0x17')][_0x4d2a('0x18')]);}logger['error'](_0x4d2a('0x12'),_0x1881ec,_0x3302bf[_0x4d2a('0x17')][_0x4d2a('0x18')]);return _0x56dc25(_0x3302bf['error']['message']);}else{logger[_0x4d2a('0x19')](_0x4d2a('0x12'),_0x1881ec,_0x4d2a('0x13'));_0x56dc25(_0x3302bf[_0x4d2a('0x1a')]['message']);}})[_0x4d2a('0x1b')](function(_0x3d9dab){logger[_0x4d2a('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x1881ec,_0x3d9dab);_0x4bea92(_0x3d9dab);});});}exports[_0x4d2a('0x1c')]=function(_0x840eed){var _0xa27e5f=this;return new Promise(function(_0x124481,_0x41ef36){return db[_0x4d2a('0x1d')]['findAll']({'raw':_0x840eed[_0x4d2a('0x1e')]?_0x840eed[_0x4d2a('0x1e')][_0x4d2a('0x1f')]===undefined?!![]:![]:!![],'where':_0x840eed['options']?_0x840eed['options'][_0x4d2a('0x20')]||null:null,'attributes':_0x840eed[_0x4d2a('0x1e')]?_0x840eed[_0x4d2a('0x1e')][_0x4d2a('0x21')]||null:null,'limit':_0x840eed[_0x4d2a('0x1e')]?_0x840eed['options'][_0x4d2a('0x22')]||null:null,'include':_0x840eed[_0x4d2a('0x1e')]?_0x840eed['options'][_0x4d2a('0x23')]?_[_0x4d2a('0x24')](_0x840eed[_0x4d2a('0x1e')][_0x4d2a('0x23')],function(_0x171863){return{'model':db[_0x171863[_0x4d2a('0x25')]],'as':_0x171863['as'],'attributes':_0x171863[_0x4d2a('0x21')],'include':_0x171863[_0x4d2a('0x23')]?_[_0x4d2a('0x24')](_0x171863['include'],function(_0x29ff0e){return{'model':db[_0x29ff0e[_0x4d2a('0x25')]],'as':_0x29ff0e['as'],'attributes':_0x29ff0e[_0x4d2a('0x21')],'include':_0x29ff0e[_0x4d2a('0x23')]?_['map'](_0x29ff0e['include'],function(_0x1e9ac1){return{'model':db[_0x1e9ac1[_0x4d2a('0x25')]],'as':_0x1e9ac1['as'],'attributes':_0x1e9ac1[_0x4d2a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4d2a('0x26')](function(_0x2bab35){logger[_0x4d2a('0x19')](_0x4d2a('0x1c'),_0x840eed);logger['debug'](_0x4d2a('0x1c'),_0x840eed,JSON[_0x4d2a('0x16')](_0x2bab35));_0x124481(_0x2bab35);})['catch'](function(_0x55a488){logger['error'](_0x4d2a('0x1c'),_0x55a488[_0x4d2a('0x18')],_0x840eed);_0x41ef36(_0xa27e5f['error'](0x1f4,_0x55a488[_0x4d2a('0x18')]));});});};exports[_0x4d2a('0x27')]=function(_0x603b96){var _0x8d8958=this;return new Promise(function(_0x266aa9,_0x5eabf3){return db['VoiceQueue'][_0x4d2a('0x28')]({'raw':_0x603b96[_0x4d2a('0x1e')]?_0x603b96[_0x4d2a('0x1e')][_0x4d2a('0x1f')]===undefined?!![]:![]:!![],'where':_0x603b96[_0x4d2a('0x1e')]?_0x603b96['options'][_0x4d2a('0x20')]||null:null,'attributes':_0x603b96[_0x4d2a('0x1e')]?_0x603b96[_0x4d2a('0x1e')][_0x4d2a('0x21')]||null:null,'include':_0x603b96[_0x4d2a('0x1e')]?_0x603b96[_0x4d2a('0x1e')][_0x4d2a('0x23')]?_[_0x4d2a('0x24')](_0x603b96[_0x4d2a('0x1e')][_0x4d2a('0x23')],function(_0x1964c7){return{'model':db[_0x1964c7[_0x4d2a('0x25')]],'as':_0x1964c7['as'],'attributes':_0x1964c7[_0x4d2a('0x21')],'include':_0x1964c7[_0x4d2a('0x23')]?_[_0x4d2a('0x24')](_0x1964c7[_0x4d2a('0x23')],function(_0x232199){return{'model':db[_0x232199[_0x4d2a('0x25')]],'as':_0x232199['as'],'attributes':_0x232199['attributes'],'include':_0x232199[_0x4d2a('0x23')]?_[_0x4d2a('0x24')](_0x232199[_0x4d2a('0x23')],function(_0x55ff99){return{'model':db[_0x55ff99[_0x4d2a('0x25')]],'as':_0x55ff99['as'],'attributes':_0x55ff99['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d2a('0x26')](function(_0x4bfdd5){logger[_0x4d2a('0x19')](_0x4d2a('0x27'),_0x603b96);logger[_0x4d2a('0x14')]('ShowVoiceQueue',_0x603b96,JSON[_0x4d2a('0x16')](_0x4bfdd5));_0x266aa9(_0x4bfdd5);})['catch'](function(_0x2f7c44){logger[_0x4d2a('0x17')](_0x4d2a('0x27'),_0x2f7c44[_0x4d2a('0x18')],_0x603b96);_0x5eabf3(_0x8d8958[_0x4d2a('0x17')](0x1f4,_0x2f7c44['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2ca255f..ce07011 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 _0x473c=['voiceQueue:','./voiceQueue.events','remove','update','emit','removeListener','register','length'];(function(_0x47a84b,_0x1cdcc2){var _0x293309=function(_0x355be4){while(--_0x355be4){_0x47a84b['push'](_0x47a84b['shift']());}};_0x293309(++_0x1cdcc2);}(_0x473c,0x169));var _0xc473=function(_0x628ff8,_0x22f348){_0x628ff8=_0x628ff8-0x0;var _0x35ea03=_0x473c[_0x628ff8];return _0x35ea03;};'use strict';var VoiceQueueEvents=require(_0xc473('0x0'));var events=['save',_0xc473('0x1'),_0xc473('0x2')];function createListener(_0x5aad81,_0x374e08){return function(_0x377736){_0x374e08[_0xc473('0x3')](_0x5aad81,_0x377736);};}function removeListener(_0x338cd1,_0x52fd34){return function(){VoiceQueueEvents[_0xc473('0x4')](_0x338cd1,_0x52fd34);};}exports[_0xc473('0x5')]=function(_0x339d1d){for(var _0x505679=0x0,_0x3653b7=events[_0xc473('0x6')];_0x505679<_0x3653b7;_0x505679++){var _0x21622c=events[_0x505679];var _0x80fc1=createListener(_0xc473('0x7')+_0x21622c,_0x339d1d);VoiceQueueEvents['on'](_0x21622c,_0x80fc1);}}; \ No newline at end of file +var _0x90c9=['./voiceQueue.events','remove','emit','register','length','voiceQueue:'];(function(_0x1e8ac9,_0x1bd0fe){var _0x4c895c=function(_0x3cc2f5){while(--_0x3cc2f5){_0x1e8ac9['push'](_0x1e8ac9['shift']());}};_0x4c895c(++_0x1bd0fe);}(_0x90c9,0x132));var _0x990c=function(_0x3b4455,_0x3e4395){_0x3b4455=_0x3b4455-0x0;var _0x34dd09=_0x90c9[_0x3b4455];return _0x34dd09;};'use strict';var VoiceQueueEvents=require(_0x990c('0x0'));var events=['save',_0x990c('0x1'),'update'];function createListener(_0x1f45b0,_0x29161a){return function(_0x24c8cf){_0x29161a[_0x990c('0x2')](_0x1f45b0,_0x24c8cf);};}function removeListener(_0x3916bc,_0x11da62){return function(){VoiceQueueEvents['removeListener'](_0x3916bc,_0x11da62);};}exports[_0x990c('0x3')]=function(_0x20adb7){for(var _0x3f9b32=0x0,_0x3b3b3b=events[_0x990c('0x4')];_0x3f9b32<_0x3b3b3b;_0x3f9b32++){var _0x197fca=events[_0x3f9b32];var _0x156f3d=createListener(_0x990c('0x5')+_0x197fca,_0x20adb7);VoiceQueueEvents['on'](_0x197fca,_0x156f3d);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 91862a5..9e5b5cb 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 _0xbb9f=['./voiceQueueReport.controller','isAuthenticated','index','get','/describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1820f1,_0x1403e7){var _0x167aed=function(_0x4c89f5){while(--_0x4c89f5){_0x1820f1['push'](_0x1820f1['shift']());}};_0x167aed(++_0x1403e7);}(_0xbb9f,0x116));var _0xfbb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb9f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfbb9('0x0'));var util=require(_0xfbb9('0x1'));var path=require(_0xfbb9('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbb9('0x3'));var router=express[_0xfbb9('0x4')]();var fs_extra=require(_0xfbb9('0x5'));var auth=require(_0xfbb9('0x6'));var interaction=require(_0xfbb9('0x7'));var config=require('../../config/environment');var controller=require(_0xfbb9('0x8'));router['get']('/',auth[_0xfbb9('0x9')](),controller[_0xfbb9('0xa')]);router[_0xfbb9('0xb')](_0xfbb9('0xc'),auth[_0xfbb9('0x9')](),controller['describe']);router[_0xfbb9('0xb')](_0xfbb9('0xd'),auth[_0xfbb9('0x9')](),controller[_0xfbb9('0xe')]);router[_0xfbb9('0xb')](_0xfbb9('0xf'),auth[_0xfbb9('0x9')](),controller[_0xfbb9('0x10')]);router[_0xfbb9('0x11')]('/',auth[_0xfbb9('0x9')](),controller['create']);router[_0xfbb9('0x12')](_0xfbb9('0xf'),auth['isAuthenticated'](),controller[_0xfbb9('0x13')]);router['delete'](_0xfbb9('0xf'),auth[_0xfbb9('0x9')](),controller[_0xfbb9('0x14')]);module[_0xfbb9('0x15')]=router; \ No newline at end of file +var _0xb115=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/index','getVoiceQueuesReport','/:id','show','post','create','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x3dbf57,_0x69ef04){var _0x565737=function(_0x4c37c1){while(--_0x4c37c1){_0x3dbf57['push'](_0x3dbf57['shift']());}};_0x565737(++_0x69ef04);}(_0xb115,0x1c3));var _0x5b11=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb115[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x5b11('0x0'));var util=require(_0x5b11('0x1'));var path=require(_0x5b11('0x2'));var timeout=require(_0x5b11('0x3'));var express=require(_0x5b11('0x4'));var router=express[_0x5b11('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5b11('0x6'));var config=require(_0x5b11('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x5b11('0x8')]('/',auth[_0x5b11('0x9')](),controller[_0x5b11('0xa')]);router[_0x5b11('0x8')]('/describe',auth[_0x5b11('0x9')](),controller['describe']);router['get'](_0x5b11('0xb'),auth[_0x5b11('0x9')](),controller[_0x5b11('0xc')]);router[_0x5b11('0x8')](_0x5b11('0xd'),auth[_0x5b11('0x9')](),controller[_0x5b11('0xe')]);router[_0x5b11('0xf')]('/',auth[_0x5b11('0x9')](),controller[_0x5b11('0x10')]);router['put'](_0x5b11('0xd'),auth[_0x5b11('0x9')](),controller[_0x5b11('0x11')]);router['delete'](_0x5b11('0xd'),auth[_0x5b11('0x9')](),controller[_0x5b11('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 043cdb7..a2acff9 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 _0x267c=['seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x2b0022,_0x321794){var _0x20bea6=function(_0x52c81b){while(--_0x52c81b){_0x2b0022['push'](_0x2b0022['shift']());}};_0x20bea6(++_0x321794);}(_0x267c,0x1b7));var _0xc267=function(_0x3c726f,_0xecdc2d){_0x3c726f=_0x3c726f-0x0;var _0x203ce8=_0x267c[_0x3c726f];return _0x203ce8;};'use strict';var Sequelize=require(_0xc267('0x0'));var moment=require(_0xc267('0x1'));module[_0xc267('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc267('0x3')]},'calleridnum':{'type':Sequelize[_0xc267('0x3')]},'calleridname':{'type':Sequelize[_0xc267('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xc267('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xc267('0x4')],'set':function(_0x20803a){var _0x4db88d=moment(_0x20803a);var _0x2d5a09=moment(this[_0xc267('0x5')]('queuecallerjoinAt'))[_0xc267('0x6')](_0xc267('0x7'));var _0x23b42d=_0x4db88d[_0xc267('0x8')](_0x2d5a09,_0xc267('0x9'));this[_0xc267('0xa')]('queuecallerleaveAt',_0x20803a);this[_0xc267('0xa')]('holdtime',_0x23b42d||null);}},'position':{'type':Sequelize[_0xc267('0xb')]},'count':{'type':Sequelize[_0xc267('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xc267('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc267('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc267('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xc267('0xd')},'originalposition':{'type':Sequelize[_0xc267('0xb')]},'channel':{'type':Sequelize[_0xc267('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc267('0x3')]},'accountcode':{'type':Sequelize[_0xc267('0x3')]},'context':{'type':Sequelize[_0xc267('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xc267('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc267('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xc267('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc267('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xc267('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xc267('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xc267('0xb')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8583=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','diff','seconds','setDataValue','queuecallerleaveAt','holdtime'];(function(_0x23129b,_0x2d13ae){var _0x3b2fe9=function(_0x4cd6b7){while(--_0x4cd6b7){_0x23129b['push'](_0x23129b['shift']());}};_0x3b2fe9(++_0x2d13ae);}(_0x8583,0x1f3));var _0x3858=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8583[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3858('0x0'));var moment=require('moment');module[_0x3858('0x1')]={'type':{'type':Sequelize[_0x3858('0x2')]},'uniqueid':{'type':Sequelize[_0x3858('0x2')]},'calleridnum':{'type':Sequelize[_0x3858('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3858('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x3858('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x3858('0x3')],'set':function(_0x23b5fa){var _0x5d8c86=moment(_0x23b5fa);var _0x198f00=moment(this[_0x3858('0x4')](_0x3858('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x301ed4=_0x5d8c86[_0x3858('0x6')](_0x198f00,_0x3858('0x7'));this[_0x3858('0x8')](_0x3858('0x9'),_0x23b5fa);this[_0x3858('0x8')](_0x3858('0xa'),_0x301ed4||null);}},'position':{'type':Sequelize[_0x3858('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x3858('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3858('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x3858('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3858('0x3')]},'queuecallerexit':{'type':Sequelize[_0x3858('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x3858('0x2')],'comment':_0x3858('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3858('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3858('0x2')]},'connectedlinename':{'type':Sequelize[_0x3858('0x2')]},'accountcode':{'type':Sequelize[_0x3858('0x2')]},'context':{'type':Sequelize[_0x3858('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3858('0x2')]},'holdtime':{'type':Sequelize[_0x3858('0xb')]},'mohtime':{'type':Sequelize[_0x3858('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3858('0x2')]},'transfer':{'type':Sequelize[_0x3858('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3858('0x2')],'comment':_0x3858('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x3858('0x2')]},'disposition':{'type':Sequelize[_0x3858('0x2')]},'secondDisposition':{'type':Sequelize[_0x3858('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3858('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x3858('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x3858('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 38d9460..2d77b9d 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 _0x4a5e=['hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','fields','includeAll','find','create','body','describe','getVoiceQueuesReport','order','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4a5e,0x1c1));var _0xe4a5=function(_0x4c4a8b,_0x402020){_0x4c4a8b=_0x4c4a8b-0x0;var _0x20fa14=_0x4a5e[_0x4c4a8b];return _0x20fa14;};'use strict';var emlformat=require(_0xe4a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4a5('0x1'));var jsonpatch=require(_0xe4a5('0x2'));var rp=require('request-promise');var moment=require(_0xe4a5('0x3'));var BPromise=require(_0xe4a5('0x4'));var Mustache=require(_0xe4a5('0x5'));var util=require(_0xe4a5('0x6'));var path=require(_0xe4a5('0x7'));var sox=require(_0xe4a5('0x8'));var csv=require(_0xe4a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4a5('0xa'));var _=require(_0xe4a5('0xb'));var squel=require(_0xe4a5('0xc'));var crypto=require(_0xe4a5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe4a5('0xe'));var toCsv=require(_0xe4a5('0x9'));var querystring=require(_0xe4a5('0xf'));var Papa=require(_0xe4a5('0x10'));var Redis=require(_0xe4a5('0x11'));var authService=require(_0xe4a5('0x12'));var qs=require(_0xe4a5('0x13'));var as=require(_0xe4a5('0x14'));var hardwareService=require(_0xe4a5('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe4a5('0x16'));var db=require(_0xe4a5('0x17'))['db'];config['redis']=_[_0xe4a5('0x18')](config[_0xe4a5('0x19')],{'host':_0xe4a5('0x1a'),'port':0x18eb});var socket=require(_0xe4a5('0x1b'))(new Redis(config[_0xe4a5('0x19')]));require(_0xe4a5('0x1c'))[_0xe4a5('0x1d')](socket);function respondWithStatusCode(_0x9f018f,_0x56730e){_0x56730e=_0x56730e||0xcc;return function(_0xf61105){if(_0xf61105){return _0x9f018f[_0xe4a5('0x1e')](_0x56730e);}return _0x9f018f[_0xe4a5('0x1f')](_0x56730e)[_0xe4a5('0x20')]();};}function respondWithResult(_0x777c4e,_0x8146e2){_0x8146e2=_0x8146e2||0xc8;return function(_0x37a3ae){if(_0x37a3ae){return _0x777c4e[_0xe4a5('0x1f')](_0x8146e2)['json'](_0x37a3ae);}};}function respondWithFilteredResult(_0x3104be,_0x7db340){return function(_0x1886b2){if(_0x1886b2){var _0x3b04bf=typeof _0x7db340[_0xe4a5('0x21')]===_0xe4a5('0x22')&&typeof _0x7db340[_0xe4a5('0x23')]===_0xe4a5('0x22');var _0x591d14=_0x1886b2[_0xe4a5('0x24')];var _0x456d2d=_0x3b04bf?0x0:_0x7db340[_0xe4a5('0x21')];var _0x25594f=_0x3b04bf?_0x1886b2[_0xe4a5('0x24')]:_0x7db340[_0xe4a5('0x21')]+_0x7db340[_0xe4a5('0x23')];var _0x56c39e;if(_0x25594f>=_0x591d14){_0x25594f=_0x591d14;_0x56c39e=0xc8;}else{_0x56c39e=0xce;}_0x3104be[_0xe4a5('0x1f')](_0x56c39e);return _0x3104be[_0xe4a5('0x25')](_0xe4a5('0x26'),_0x456d2d+'-'+_0x25594f+'/'+_0x591d14)[_0xe4a5('0x27')](_0x1886b2);}return null;};}function patchUpdates(_0x471490){return function(_0x3d6034){try{jsonpatch['apply'](_0x3d6034,_0x471490,!![]);}catch(_0x520fc2){return BPromise[_0xe4a5('0x28')](_0x520fc2);}return _0x3d6034[_0xe4a5('0x29')]();};}function saveUpdates(_0x355948,_0x17a09c){return function(_0x2fcd57){if(_0x2fcd57){return _0x2fcd57[_0xe4a5('0x2a')](_0x355948)[_0xe4a5('0x2b')](function(_0x376300){return _0x376300;});}return null;};}function removeEntity(_0xec2f37,_0x5ac0c6){return function(_0x5a1e7b){if(_0x5a1e7b){return _0x5a1e7b[_0xe4a5('0x2c')]()['then'](function(){_0xec2f37[_0xe4a5('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fbb02,_0xd273c1){return function(_0x148dbd){if(!_0x148dbd){_0x2fbb02[_0xe4a5('0x1e')](0x194);}return _0x148dbd;};}function handleError(_0x27307a,_0xd5db7b){_0xd5db7b=_0xd5db7b||0x1f4;return function(_0x5b8f56){logger[_0xe4a5('0x2d')](_0x5b8f56[_0xe4a5('0x2e')]);if(_0x5b8f56['name']){delete _0x5b8f56[_0xe4a5('0x2f')];}_0x27307a[_0xe4a5('0x1f')](_0xd5db7b)[_0xe4a5('0x30')](_0x5b8f56);};}exports[_0xe4a5('0x31')]=function(_0x4744ed,_0x955bd5){var _0x33690a={},_0x30ad00={},_0x33be67={'count':0x0,'rows':[]};var _0x8bef10=_[_0xe4a5('0x32')](db[_0xe4a5('0x33')][_0xe4a5('0x34')],function(_0x5745c7){return{'name':_0x5745c7[_0xe4a5('0x35')],'type':_0x5745c7[_0xe4a5('0x36')][_0xe4a5('0x37')]};});_0x30ad00[_0xe4a5('0x38')]=_[_0xe4a5('0x32')](_0x8bef10,_0xe4a5('0x2f'));_0x30ad00[_0xe4a5('0x39')]=_['keys'](_0x4744ed[_0xe4a5('0x39')]);_0x30ad00['filters']=_['intersection'](_0x30ad00[_0xe4a5('0x38')],_0x30ad00['query']);_0x33690a['attributes']=_[_0xe4a5('0x3a')](_0x30ad00[_0xe4a5('0x38')],qs['fields'](_0x4744ed['query']['fields']));_0x33690a[_0xe4a5('0x3b')]=_0x33690a['attributes'][_0xe4a5('0x3c')]?_0x33690a['attributes']:_0x30ad00['model'];if(!_0x4744ed[_0xe4a5('0x39')][_0xe4a5('0x3d')](_0xe4a5('0x3e'))){_0x33690a['limit']=qs[_0xe4a5('0x23')](_0x4744ed[_0xe4a5('0x39')]['limit']);_0x33690a['offset']=qs[_0xe4a5('0x21')](_0x4744ed[_0xe4a5('0x39')][_0xe4a5('0x21')]);}_0x33690a['order']=qs[_0xe4a5('0x3f')](_0x4744ed[_0xe4a5('0x39')][_0xe4a5('0x3f')]);_0x33690a[_0xe4a5('0x40')]=qs['filters'](_[_0xe4a5('0x41')](_0x4744ed['query'],_0x30ad00[_0xe4a5('0x42')]),_0x8bef10);if(_0x4744ed[_0xe4a5('0x39')][_0xe4a5('0x43')]){_0x33690a[_0xe4a5('0x40')]=_[_0xe4a5('0x44')](_0x33690a['where'],{'$or':_[_0xe4a5('0x32')](_0x8bef10,function(_0x3beb2b){if(_0x3beb2b[_0xe4a5('0x36')]!==_0xe4a5('0x45')){var _0x37adcb={};_0x37adcb[_0x3beb2b[_0xe4a5('0x2f')]]={'$like':'%'+_0x4744ed[_0xe4a5('0x39')][_0xe4a5('0x43')]+'%'};return _0x37adcb;}})});}_0x33690a=_[_0xe4a5('0x44')]({},_0x33690a,_0x4744ed[_0xe4a5('0x46')]);var _0xa83884={'where':_0x33690a[_0xe4a5('0x40')]};return db[_0xe4a5('0x33')]['count'](_0xa83884)['then'](function(_0x15660c){_0x33be67['count']=_0x15660c;if(_0x4744ed[_0xe4a5('0x39')]['includeAll']){_0x33690a[_0xe4a5('0x47')]=[{'all':!![]}];}return db[_0xe4a5('0x33')][_0xe4a5('0x48')](_0x33690a);})['then'](function(_0x13e464){_0x33be67[_0xe4a5('0x49')]=_0x13e464;return _0x33be67;})[_0xe4a5('0x2b')](respondWithFilteredResult(_0x955bd5,_0x33690a))[_0xe4a5('0x4a')](handleError(_0x955bd5,null));};exports['show']=function(_0x479d4d,_0x440ae4){var _0xaf650a={'raw':![],'where':{'id':_0x479d4d[_0xe4a5('0x4b')]['id']}},_0x53fa97={};_0x53fa97[_0xe4a5('0x38')]=_['keys'](db['VoiceQueueReport'][_0xe4a5('0x34')]);_0x53fa97[_0xe4a5('0x39')]=_[_0xe4a5('0x4c')](_0x479d4d['query']);_0x53fa97[_0xe4a5('0x42')]=_[_0xe4a5('0x3a')](_0x53fa97[_0xe4a5('0x38')],_0x53fa97[_0xe4a5('0x39')]);_0xaf650a[_0xe4a5('0x3b')]=_[_0xe4a5('0x3a')](_0x53fa97[_0xe4a5('0x38')],qs[_0xe4a5('0x4d')](_0x479d4d[_0xe4a5('0x39')]['fields']));_0xaf650a[_0xe4a5('0x3b')]=_0xaf650a[_0xe4a5('0x3b')][_0xe4a5('0x3c')]?_0xaf650a['attributes']:_0x53fa97[_0xe4a5('0x38')];if(_0x479d4d[_0xe4a5('0x39')][_0xe4a5('0x4e')]){_0xaf650a[_0xe4a5('0x47')]=[{'all':!![]}];}_0xaf650a=_[_0xe4a5('0x44')]({},_0xaf650a,_0x479d4d[_0xe4a5('0x46')]);return db[_0xe4a5('0x33')][_0xe4a5('0x4f')](_0xaf650a)[_0xe4a5('0x2b')](handleEntityNotFound(_0x440ae4,null))[_0xe4a5('0x2b')](respondWithResult(_0x440ae4,null))[_0xe4a5('0x4a')](handleError(_0x440ae4,null));};exports[_0xe4a5('0x50')]=function(_0x136423,_0x137be7){return db[_0xe4a5('0x33')]['create'](_0x136423[_0xe4a5('0x51')],{})[_0xe4a5('0x2b')](respondWithResult(_0x137be7,0xc9))[_0xe4a5('0x4a')](handleError(_0x137be7,null));};exports[_0xe4a5('0x2a')]=function(_0x8a1c5e,_0x34ef56){if(_0x8a1c5e['body']['id']){delete _0x8a1c5e[_0xe4a5('0x51')]['id'];}return db[_0xe4a5('0x33')]['find']({'where':{'id':_0x8a1c5e['params']['id']}})[_0xe4a5('0x2b')](handleEntityNotFound(_0x34ef56,null))[_0xe4a5('0x2b')](saveUpdates(_0x8a1c5e['body'],null))[_0xe4a5('0x2b')](respondWithResult(_0x34ef56,null))[_0xe4a5('0x4a')](handleError(_0x34ef56,null));};exports[_0xe4a5('0x2c')]=function(_0x253add,_0x30bd6f){return db['VoiceQueueReport']['find']({'where':{'id':_0x253add['params']['id']}})[_0xe4a5('0x2b')](handleEntityNotFound(_0x30bd6f,null))[_0xe4a5('0x2b')](removeEntity(_0x30bd6f,null))[_0xe4a5('0x4a')](handleError(_0x30bd6f,null));};exports[_0xe4a5('0x52')]=function(_0x4048ff,_0x27d88e){return db[_0xe4a5('0x33')]['describe']()[_0xe4a5('0x2b')](respondWithResult(_0x27d88e,null))['catch'](handleError(_0x27d88e,null));};exports[_0xe4a5('0x53')]=function(_0x5a06f3,_0x1f3a50){var _0x3fd3ee={},_0x383e62={},_0x577d66={'count':0x0,'rows':[]};_0x383e62[_0xe4a5('0x38')]=_[_0xe4a5('0x4c')](db[_0xe4a5('0x33')][_0xe4a5('0x34')]);_0x383e62[_0xe4a5('0x39')]=_[_0xe4a5('0x4c')](_0x5a06f3[_0xe4a5('0x39')]);_0x383e62[_0xe4a5('0x42')]=_[_0xe4a5('0x3a')](_0x383e62[_0xe4a5('0x38')],_0x383e62[_0xe4a5('0x39')]);_0x3fd3ee['attributes']=_[_0xe4a5('0x3a')](_0x383e62[_0xe4a5('0x38')],qs[_0xe4a5('0x4d')](_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x4d')]));_0x3fd3ee[_0xe4a5('0x3b')]=_0x3fd3ee[_0xe4a5('0x3b')][_0xe4a5('0x3c')]?_0x3fd3ee[_0xe4a5('0x3b')]:_0x383e62[_0xe4a5('0x38')];if(!_0x5a06f3['query'][_0xe4a5('0x3d')](_0xe4a5('0x3e'))){_0x3fd3ee[_0xe4a5('0x23')]=qs[_0xe4a5('0x23')](_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x23')]);_0x3fd3ee[_0xe4a5('0x21')]=qs[_0xe4a5('0x21')](_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x21')]);}_0x3fd3ee[_0xe4a5('0x54')]=qs[_0xe4a5('0x3f')](_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x3f')]);_0x3fd3ee[_0xe4a5('0x40')]=qs[_0xe4a5('0x42')](_[_0xe4a5('0x41')](_0x5a06f3[_0xe4a5('0x39')],_0x383e62[_0xe4a5('0x42')]));if(_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x43')]){_0x3fd3ee[_0xe4a5('0x40')]=_['merge'](_0x3fd3ee[_0xe4a5('0x40')],{'$or':_[_0xe4a5('0x32')](_0x3fd3ee[_0xe4a5('0x3b')],function(_0x3cf6bd){var _0x211302={};_0x211302[_0x3cf6bd]={'$like':'%'+_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x43')]+'%'};return _0x211302;})});}_0x3fd3ee=_[_0xe4a5('0x44')]({},_0x3fd3ee,_0x5a06f3['options']);var _0x1415a4={'where':_0x3fd3ee[_0xe4a5('0x40')]};return db[_0xe4a5('0x33')]['count'](_0x1415a4)[_0xe4a5('0x2b')](function(_0x2a4539){_0x577d66[_0xe4a5('0x24')]=_0x2a4539;if(_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x4e')]){_0x3fd3ee['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xe4a5('0x48')](_0x3fd3ee);})[_0xe4a5('0x2b')](function(_0x333309){_0x577d66[_0xe4a5('0x49')]=_0x333309;return _0x577d66;})['then'](respondWithFilteredResult(_0x1f3a50,_0x3fd3ee,_0xe4a5('0x53')))[_0xe4a5('0x4a')](handleError(_0x1f3a50,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x5e99=['update','destroy','then','sendStatus','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','hasOwnProperty','order','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./voiceQueueReport.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x3fbf74,_0x45e0ec){var _0x4d32d8=function(_0x47caa6){while(--_0x47caa6){_0x3fbf74['push'](_0x3fbf74['shift']());}};_0x4d32d8(++_0x45e0ec);}(_0x5e99,0x18d));var _0x95e9=function(_0x20919b,_0x32b866){_0x20919b=_0x20919b-0x0;var _0x3b9092=_0x5e99[_0x20919b];return _0x3b9092;};'use strict';var emlformat=require(_0x95e9('0x0'));var rimraf=require(_0x95e9('0x1'));var zipdir=require(_0x95e9('0x2'));var jsonpatch=require(_0x95e9('0x3'));var rp=require('request-promise');var moment=require(_0x95e9('0x4'));var BPromise=require(_0x95e9('0x5'));var Mustache=require(_0x95e9('0x6'));var util=require(_0x95e9('0x7'));var path=require(_0x95e9('0x8'));var sox=require(_0x95e9('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95e9('0xa'));var _=require(_0x95e9('0xb'));var squel=require(_0x95e9('0xc'));var crypto=require(_0x95e9('0xd'));var jsforce=require(_0x95e9('0xe'));var deskjs=require(_0x95e9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x95e9('0x10'));var Papa=require(_0x95e9('0x11'));var Redis=require(_0x95e9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x95e9('0x13'));var as=require(_0x95e9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95e9('0x15'))(_0x95e9('0x16'));var utils=require('../../config/utils');var config=require(_0x95e9('0x17'));var licenseUtil=require(_0x95e9('0x18'));var db=require(_0x95e9('0x19'))['db'];config['redis']=_[_0x95e9('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x95e9('0x1b'))(new Redis(config[_0x95e9('0x1c')]));require(_0x95e9('0x1d'))[_0x95e9('0x1e')](socket);function respondWithStatusCode(_0x2c7595,_0x5f29c4){_0x5f29c4=_0x5f29c4||0xcc;return function(_0x2bb8a1){if(_0x2bb8a1){return _0x2c7595['sendStatus'](_0x5f29c4);}return _0x2c7595[_0x95e9('0x1f')](_0x5f29c4)[_0x95e9('0x20')]();};}function respondWithResult(_0x21b46e,_0x156338){_0x156338=_0x156338||0xc8;return function(_0x6646c){if(_0x6646c){return _0x21b46e[_0x95e9('0x1f')](_0x156338)[_0x95e9('0x21')](_0x6646c);}};}function respondWithFilteredResult(_0x1367d6,_0x20b005){return function(_0x333fa7){if(_0x333fa7){var _0x1b3a3=typeof _0x20b005[_0x95e9('0x22')]===_0x95e9('0x23')&&typeof _0x20b005[_0x95e9('0x24')]===_0x95e9('0x23');var _0x2994e6=_0x333fa7[_0x95e9('0x25')];var _0x2bb0d9=_0x1b3a3?0x0:_0x20b005[_0x95e9('0x22')];var _0x47ee71=_0x1b3a3?_0x333fa7[_0x95e9('0x25')]:_0x20b005[_0x95e9('0x22')]+_0x20b005[_0x95e9('0x24')];var _0x11017e;if(_0x47ee71>=_0x2994e6){_0x47ee71=_0x2994e6;_0x11017e=0xc8;}else{_0x11017e=0xce;}_0x1367d6[_0x95e9('0x1f')](_0x11017e);return _0x1367d6[_0x95e9('0x26')](_0x95e9('0x27'),_0x2bb0d9+'-'+_0x47ee71+'/'+_0x2994e6)[_0x95e9('0x21')](_0x333fa7);}return null;};}function patchUpdates(_0x5cb9f3){return function(_0x281103){try{jsonpatch[_0x95e9('0x28')](_0x281103,_0x5cb9f3,!![]);}catch(_0x54ea3f){return BPromise[_0x95e9('0x29')](_0x54ea3f);}return _0x281103[_0x95e9('0x2a')]();};}function saveUpdates(_0x5172bc,_0x2edf2c){return function(_0x543a6a){if(_0x543a6a){return _0x543a6a[_0x95e9('0x2b')](_0x5172bc)['then'](function(_0x40d824){return _0x40d824;});}return null;};}function removeEntity(_0x2a1bc5,_0x4c79a6){return function(_0x2bd833){if(_0x2bd833){return _0x2bd833[_0x95e9('0x2c')]()[_0x95e9('0x2d')](function(){_0x2a1bc5[_0x95e9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e0de3,_0x225cc8){return function(_0x4d1c7c){if(!_0x4d1c7c){_0x4e0de3[_0x95e9('0x2e')](0x194);}return _0x4d1c7c;};}function handleError(_0x1004f3,_0x29d053){_0x29d053=_0x29d053||0x1f4;return function(_0x20ca31){logger[_0x95e9('0x2f')](_0x20ca31[_0x95e9('0x30')]);if(_0x20ca31[_0x95e9('0x31')]){delete _0x20ca31[_0x95e9('0x31')];}_0x1004f3[_0x95e9('0x1f')](_0x29d053)[_0x95e9('0x32')](_0x20ca31);};}exports[_0x95e9('0x33')]=function(_0x2016a4,_0x12024e){var _0x9b8502={},_0x1bcb58={},_0x31532a={'count':0x0,'rows':[]};var _0x512dee=_['map'](db[_0x95e9('0x34')][_0x95e9('0x35')],function(_0x57fd0f){return{'name':_0x57fd0f[_0x95e9('0x36')],'type':_0x57fd0f[_0x95e9('0x37')][_0x95e9('0x38')]};});_0x1bcb58[_0x95e9('0x39')]=_[_0x95e9('0x3a')](_0x512dee,_0x95e9('0x31'));_0x1bcb58['query']=_[_0x95e9('0x3b')](_0x2016a4[_0x95e9('0x3c')]);_0x1bcb58[_0x95e9('0x3d')]=_[_0x95e9('0x3e')](_0x1bcb58[_0x95e9('0x39')],_0x1bcb58[_0x95e9('0x3c')]);_0x9b8502[_0x95e9('0x3f')]=_[_0x95e9('0x3e')](_0x1bcb58['model'],qs[_0x95e9('0x40')](_0x2016a4[_0x95e9('0x3c')][_0x95e9('0x40')]));_0x9b8502['attributes']=_0x9b8502[_0x95e9('0x3f')][_0x95e9('0x41')]?_0x9b8502[_0x95e9('0x3f')]:_0x1bcb58[_0x95e9('0x39')];if(!_0x2016a4[_0x95e9('0x3c')]['hasOwnProperty'](_0x95e9('0x42'))){_0x9b8502['limit']=qs['limit'](_0x2016a4[_0x95e9('0x3c')]['limit']);_0x9b8502[_0x95e9('0x22')]=qs['offset'](_0x2016a4[_0x95e9('0x3c')]['offset']);}_0x9b8502['order']=qs[_0x95e9('0x43')](_0x2016a4[_0x95e9('0x3c')]['sort']);_0x9b8502[_0x95e9('0x44')]=qs[_0x95e9('0x3d')](_[_0x95e9('0x45')](_0x2016a4['query'],_0x1bcb58[_0x95e9('0x3d')]),_0x512dee);if(_0x2016a4[_0x95e9('0x3c')][_0x95e9('0x46')]){_0x9b8502['where']=_[_0x95e9('0x47')](_0x9b8502['where'],{'$or':_[_0x95e9('0x3a')](_0x512dee,function(_0x4efd55){if(_0x4efd55[_0x95e9('0x37')]!==_0x95e9('0x48')){var _0x157d7a={};_0x157d7a[_0x4efd55['name']]={'$like':'%'+_0x2016a4[_0x95e9('0x3c')]['filter']+'%'};return _0x157d7a;}})});}_0x9b8502=_[_0x95e9('0x47')]({},_0x9b8502,_0x2016a4[_0x95e9('0x49')]);var _0x1461eb={'where':_0x9b8502[_0x95e9('0x44')]};return db[_0x95e9('0x34')][_0x95e9('0x25')](_0x1461eb)[_0x95e9('0x2d')](function(_0x168ccd){_0x31532a[_0x95e9('0x25')]=_0x168ccd;if(_0x2016a4[_0x95e9('0x3c')][_0x95e9('0x4a')]){_0x9b8502[_0x95e9('0x4b')]=[{'all':!![]}];}return db[_0x95e9('0x34')][_0x95e9('0x4c')](_0x9b8502);})[_0x95e9('0x2d')](function(_0x3a04fd){_0x31532a[_0x95e9('0x4d')]=_0x3a04fd;return _0x31532a;})['then'](respondWithFilteredResult(_0x12024e,_0x9b8502))['catch'](handleError(_0x12024e,null));};exports[_0x95e9('0x4e')]=function(_0x58b2ba,_0xdb5c14){var _0x54b203={'raw':![],'where':{'id':_0x58b2ba[_0x95e9('0x4f')]['id']}},_0x43b7d6={};_0x43b7d6[_0x95e9('0x39')]=_[_0x95e9('0x3b')](db['VoiceQueueReport'][_0x95e9('0x35')]);_0x43b7d6['query']=_[_0x95e9('0x3b')](_0x58b2ba[_0x95e9('0x3c')]);_0x43b7d6[_0x95e9('0x3d')]=_[_0x95e9('0x3e')](_0x43b7d6['model'],_0x43b7d6['query']);_0x54b203[_0x95e9('0x3f')]=_['intersection'](_0x43b7d6[_0x95e9('0x39')],qs['fields'](_0x58b2ba['query'][_0x95e9('0x40')]));_0x54b203[_0x95e9('0x3f')]=_0x54b203[_0x95e9('0x3f')][_0x95e9('0x41')]?_0x54b203[_0x95e9('0x3f')]:_0x43b7d6[_0x95e9('0x39')];if(_0x58b2ba[_0x95e9('0x3c')][_0x95e9('0x4a')]){_0x54b203[_0x95e9('0x4b')]=[{'all':!![]}];}_0x54b203=_[_0x95e9('0x47')]({},_0x54b203,_0x58b2ba[_0x95e9('0x49')]);return db[_0x95e9('0x34')][_0x95e9('0x50')](_0x54b203)[_0x95e9('0x2d')](handleEntityNotFound(_0xdb5c14,null))[_0x95e9('0x2d')](respondWithResult(_0xdb5c14,null))[_0x95e9('0x51')](handleError(_0xdb5c14,null));};exports[_0x95e9('0x52')]=function(_0x110b11,_0x37f426){return db[_0x95e9('0x34')][_0x95e9('0x52')](_0x110b11['body'],{})[_0x95e9('0x2d')](respondWithResult(_0x37f426,0xc9))[_0x95e9('0x51')](handleError(_0x37f426,null));};exports[_0x95e9('0x2b')]=function(_0x339bc4,_0x1d9e69){if(_0x339bc4['body']['id']){delete _0x339bc4[_0x95e9('0x53')]['id'];}return db[_0x95e9('0x34')]['find']({'where':{'id':_0x339bc4['params']['id']}})[_0x95e9('0x2d')](handleEntityNotFound(_0x1d9e69,null))[_0x95e9('0x2d')](saveUpdates(_0x339bc4[_0x95e9('0x53')],null))[_0x95e9('0x2d')](respondWithResult(_0x1d9e69,null))[_0x95e9('0x51')](handleError(_0x1d9e69,null));};exports['destroy']=function(_0x164416,_0xf1ed38){return db['VoiceQueueReport'][_0x95e9('0x50')]({'where':{'id':_0x164416[_0x95e9('0x4f')]['id']}})['then'](handleEntityNotFound(_0xf1ed38,null))[_0x95e9('0x2d')](removeEntity(_0xf1ed38,null))[_0x95e9('0x51')](handleError(_0xf1ed38,null));};exports['describe']=function(_0x4e401a,_0xe4fb9b){return db['VoiceQueueReport'][_0x95e9('0x54')]()[_0x95e9('0x2d')](respondWithResult(_0xe4fb9b,null))[_0x95e9('0x51')](handleError(_0xe4fb9b,null));};exports['getVoiceQueuesReport']=function(_0x323da6,_0x2817f4){var _0x1ad64f={},_0x141bb8={},_0x1a73a5={'count':0x0,'rows':[]};_0x141bb8[_0x95e9('0x39')]=_[_0x95e9('0x3b')](db['VoiceQueueReport'][_0x95e9('0x35')]);_0x141bb8[_0x95e9('0x3c')]=_[_0x95e9('0x3b')](_0x323da6[_0x95e9('0x3c')]);_0x141bb8['filters']=_[_0x95e9('0x3e')](_0x141bb8[_0x95e9('0x39')],_0x141bb8['query']);_0x1ad64f[_0x95e9('0x3f')]=_[_0x95e9('0x3e')](_0x141bb8[_0x95e9('0x39')],qs[_0x95e9('0x40')](_0x323da6[_0x95e9('0x3c')]['fields']));_0x1ad64f['attributes']=_0x1ad64f[_0x95e9('0x3f')][_0x95e9('0x41')]?_0x1ad64f[_0x95e9('0x3f')]:_0x141bb8[_0x95e9('0x39')];if(!_0x323da6['query'][_0x95e9('0x55')](_0x95e9('0x42'))){_0x1ad64f[_0x95e9('0x24')]=qs[_0x95e9('0x24')](_0x323da6[_0x95e9('0x3c')]['limit']);_0x1ad64f['offset']=qs[_0x95e9('0x22')](_0x323da6[_0x95e9('0x3c')][_0x95e9('0x22')]);}_0x1ad64f[_0x95e9('0x56')]=qs[_0x95e9('0x43')](_0x323da6[_0x95e9('0x3c')][_0x95e9('0x43')]);_0x1ad64f[_0x95e9('0x44')]=qs[_0x95e9('0x3d')](_[_0x95e9('0x45')](_0x323da6[_0x95e9('0x3c')],_0x141bb8['filters']));if(_0x323da6[_0x95e9('0x3c')][_0x95e9('0x46')]){_0x1ad64f[_0x95e9('0x44')]=_[_0x95e9('0x47')](_0x1ad64f['where'],{'$or':_[_0x95e9('0x3a')](_0x1ad64f[_0x95e9('0x3f')],function(_0x362da0){var _0x3f33d0={};_0x3f33d0[_0x362da0]={'$like':'%'+_0x323da6[_0x95e9('0x3c')][_0x95e9('0x46')]+'%'};return _0x3f33d0;})});}_0x1ad64f=_[_0x95e9('0x47')]({},_0x1ad64f,_0x323da6[_0x95e9('0x49')]);var _0x3ad1a6={'where':_0x1ad64f['where']};return db[_0x95e9('0x34')]['count'](_0x3ad1a6)[_0x95e9('0x2d')](function(_0x2b4645){_0x1a73a5['count']=_0x2b4645;if(_0x323da6['query'][_0x95e9('0x4a')]){_0x1ad64f[_0x95e9('0x4b')]=[{'all':!![]}];}return db[_0x95e9('0x34')][_0x95e9('0x4c')](_0x1ad64f);})['then'](function(_0x5c9c63){_0x1a73a5[_0x95e9('0x4d')]=_0x5c9c63;return _0x1a73a5;})[_0x95e9('0x2d')](respondWithFilteredResult(_0x2817f4,_0x1ad64f,_0x95e9('0x57')))['catch'](handleError(_0x2817f4,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 bbd465c..4ccd64e 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 _0xf295=['setMaxListeners','remove','hook','events','../../mysqldb'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf295,0x12a));var _0x5f29=function(_0x5cad77,_0x184741){_0x5cad77=_0x5cad77-0x0;var _0x58bbc4=_0xf295[_0x5cad77];return _0x58bbc4;};'use strict';var EventEmitter=require(_0x5f29('0x0'));var VoiceQueueReport=require(_0x5f29('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5f29('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5f29('0x3')};function emitEvent(_0x23709c){return function(_0x1fe2fc,_0x71b445,_0x58cc8d){VoiceQueueReportEvents['emit'](_0x23709c+':'+_0x1fe2fc['id'],_0x1fe2fc);VoiceQueueReportEvents['emit'](_0x23709c,_0x1fe2fc);_0x58cc8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x5f29('0x4')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x60ce=['VoiceQueueReport','setMaxListeners','update','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x32a392,_0x116ac6){var _0x2da3a0=function(_0x4f4b39){while(--_0x4f4b39){_0x32a392['push'](_0x32a392['shift']());}};_0x2da3a0(++_0x116ac6);}(_0x60ce,0x8a));var _0xe60c=function(_0x27d86c,_0x1ae7cc){_0x27d86c=_0x27d86c-0x0;var _0x377bb7=_0x60ce[_0x27d86c];return _0x377bb7;};'use strict';var EventEmitter=require(_0xe60c('0x0'));var VoiceQueueReport=require(_0xe60c('0x1'))['db'][_0xe60c('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe60c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe60c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4c1798){return function(_0x5a9c7b,_0x2fbbd4,_0x3fd600){VoiceQueueReportEvents['emit'](_0x4c1798+':'+_0x5a9c7b['id'],_0x5a9c7b);VoiceQueueReportEvents['emit'](_0x4c1798,_0x5a9c7b);_0x3fd600(null);};}for(var e in events){if(events[_0xe60c('0x5')](e)){var event=events[e];VoiceQueueReport[_0xe60c('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 07652be..9f1fba5 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 _0x5a8b=['calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueueReport'];(function(_0x489a71,_0xb29047){var _0xaf28ac=function(_0x32b3dc){while(--_0x32b3dc){_0x489a71['push'](_0x489a71['shift']());}};_0xaf28ac(++_0xb29047);}(_0x5a8b,0x16d));var _0xb5a8=function(_0x1975a4,_0x278f3c){_0x1975a4=_0x1975a4-0x0;var _0x2c1651=_0x5a8b[_0x1975a4];return _0x2c1651;};'use strict';var _=require('lodash');var util=require(_0xb5a8('0x0'));var logger=require(_0xb5a8('0x1'))(_0xb5a8('0x2'));var moment=require(_0xb5a8('0x3'));var BPromise=require(_0xb5a8('0x4'));var rp=require(_0xb5a8('0x5'));var fs=require('fs');var path=require(_0xb5a8('0x6'));var rimraf=require(_0xb5a8('0x7'));var config=require(_0xb5a8('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0xb5a8('0x9')]=function(_0x1c104c,_0x1b46d3){return _0x1c104c[_0xb5a8('0xa')](_0xb5a8('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xb5a8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0fa0=['path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xfb8cd9,_0x3b7242){var _0x5726a4=function(_0xc2a64){while(--_0xc2a64){_0xfb8cd9['push'](_0xfb8cd9['shift']());}};_0x5726a4(++_0x3b7242);}(_0x0fa0,0x1aa));var _0x00fa=function(_0x216da8,_0x5b611c){_0x216da8=_0x216da8-0x0;var _0x4cf67a=_0x0fa0[_0x216da8];return _0x4cf67a;};'use strict';var _=require(_0x00fa('0x0'));var util=require(_0x00fa('0x1'));var logger=require(_0x00fa('0x2'))(_0x00fa('0x3'));var moment=require('moment');var BPromise=require(_0x00fa('0x4'));var rp=require(_0x00fa('0x5'));var fs=require('fs');var path=require(_0x00fa('0x6'));var rimraf=require(_0x00fa('0x7'));var config=require(_0x00fa('0x8'));var attributes=require(_0x00fa('0x9'));module[_0x00fa('0xa')]=function(_0x360712,_0x15e050){return _0x360712[_0x00fa('0xb')](_0x00fa('0xc'),attributes,{'tableName':_0x00fa('0xd'),'paranoid':![],'indexes':[{'fields':[_0x00fa('0xe')]},{'fields':[_0x00fa('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 6bfd7af..533096f 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 _0x35ac=['CreateVoiceQueueReport','create','raw','UpdateVoiceQueueReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','request\x20sent','debug','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','model','map','stringify'];(function(_0x1c8e50,_0x519d58){var _0x3c402d=function(_0x476aff){while(--_0x476aff){_0x1c8e50['push'](_0x1c8e50['shift']());}};_0x3c402d(++_0x519d58);}(_0x35ac,0x1c8));var _0xc35a=function(_0xa63df9,_0x3d91ed){_0xa63df9=_0xa63df9-0x0;var _0x3428ff=_0x35ac[_0xa63df9];return _0x3428ff;};'use strict';var _=require(_0xc35a('0x0'));var util=require(_0xc35a('0x1'));var moment=require(_0xc35a('0x2'));var BPromise=require(_0xc35a('0x3'));var rs=require(_0xc35a('0x4'));var fs=require('fs');var Redis=require(_0xc35a('0x5'));var db=require(_0xc35a('0x6'))['db'];var utils=require(_0xc35a('0x7'));var logger=require('../../config/logger')(_0xc35a('0x8'));var config=require(_0xc35a('0x9'));var jayson=require(_0xc35a('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xc35a('0xb')]=_[_0xc35a('0xc')](config[_0xc35a('0xb')],{'host':_0xc35a('0xd'),'port':0x18eb});var socket=require(_0xc35a('0xe'))(new Redis(config['redis']));require(_0xc35a('0xf'))[_0xc35a('0x10')](socket);function respondWithRpcPromise(_0x260f60,_0x5334a9,_0x2245f1){return new BPromise(function(_0x454711,_0x45b0fd){return client[_0xc35a('0x11')](_0x260f60,_0x2245f1)[_0xc35a('0x12')](function(_0x17e9bb){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x5334a9,_0xc35a('0x13'));logger[_0xc35a('0x14')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5334a9,'request\x20sent',JSON['stringify'](_0x17e9bb));if(_0x17e9bb['error']){if(_0x17e9bb[_0xc35a('0x15')][_0xc35a('0x16')]===0x1f4){logger[_0xc35a('0x15')](_0xc35a('0x17'),_0x5334a9,_0x17e9bb[_0xc35a('0x15')][_0xc35a('0x18')]);return _0x45b0fd(_0x17e9bb[_0xc35a('0x15')][_0xc35a('0x18')]);}logger[_0xc35a('0x15')](_0xc35a('0x17'),_0x5334a9,_0x17e9bb[_0xc35a('0x15')][_0xc35a('0x18')]);return _0x454711(_0x17e9bb[_0xc35a('0x15')][_0xc35a('0x18')]);}else{logger[_0xc35a('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x5334a9,'request\x20sent');_0x454711(_0x17e9bb[_0xc35a('0x1a')][_0xc35a('0x18')]);}})[_0xc35a('0x1b')](function(_0x4590bd){logger['error'](_0xc35a('0x17'),_0x5334a9,_0x4590bd);_0x45b0fd(_0x4590bd);});});}exports[_0xc35a('0x1c')]=function(_0x1b7712){var _0x33a226=this;return new Promise(function(_0x2744e0,_0x56d353){return db[_0xc35a('0x1d')][_0xc35a('0x1e')]({'raw':_0x1b7712['options']?_0x1b7712['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b7712['options']?_0x1b7712[_0xc35a('0x1f')][_0xc35a('0x20')]||null:null,'attributes':_0x1b7712[_0xc35a('0x1f')]?_0x1b7712[_0xc35a('0x1f')][_0xc35a('0x21')]||null:null,'limit':_0x1b7712[_0xc35a('0x1f')]?_0x1b7712[_0xc35a('0x1f')][_0xc35a('0x22')]||null:null,'include':_0x1b7712[_0xc35a('0x1f')]?_0x1b7712['options'][_0xc35a('0x23')]?_['map'](_0x1b7712[_0xc35a('0x1f')][_0xc35a('0x23')],function(_0x5c9ab4){return{'model':db[_0x5c9ab4[_0xc35a('0x24')]],'as':_0x5c9ab4['as'],'attributes':_0x5c9ab4[_0xc35a('0x21')],'include':_0x5c9ab4[_0xc35a('0x23')]?_[_0xc35a('0x25')](_0x5c9ab4[_0xc35a('0x23')],function(_0x575da9){return{'model':db[_0x575da9[_0xc35a('0x24')]],'as':_0x575da9['as'],'attributes':_0x575da9['attributes'],'include':_0x575da9[_0xc35a('0x23')]?_[_0xc35a('0x25')](_0x575da9['include'],function(_0x4c0427){return{'model':db[_0x4c0427[_0xc35a('0x24')]],'as':_0x4c0427['as'],'attributes':_0x4c0427['attributes']};}):[]};}):[]};}):[]:[]})[_0xc35a('0x12')](function(_0x26990c){logger[_0xc35a('0x19')](_0xc35a('0x1c'),_0x1b7712);logger[_0xc35a('0x14')](_0xc35a('0x1c'),_0x1b7712,JSON[_0xc35a('0x26')](_0x26990c));_0x2744e0(_0x26990c);})[_0xc35a('0x1b')](function(_0x38a992){logger[_0xc35a('0x15')](_0xc35a('0x1c'),_0x38a992['message'],_0x1b7712);_0x56d353(_0x33a226['error'](0x1f4,_0x38a992[_0xc35a('0x18')]));});});};exports[_0xc35a('0x27')]=function(_0xa55716){var _0x11ee8d=this;return new Promise(function(_0x2b4735,_0x5a5202){return db[_0xc35a('0x1d')][_0xc35a('0x28')](_0xa55716['body'],{'raw':_0xa55716[_0xc35a('0x1f')]?_0xa55716[_0xc35a('0x1f')][_0xc35a('0x29')]===undefined?!![]:![]:!![]})[_0xc35a('0x12')](function(_0x610bf0){logger[_0xc35a('0x19')](_0xc35a('0x27'),_0xa55716);logger[_0xc35a('0x14')]('CreateVoiceQueueReport',_0xa55716,JSON[_0xc35a('0x26')](_0x610bf0));_0x2b4735(_0x610bf0);})[_0xc35a('0x1b')](function(_0x1572a3){logger[_0xc35a('0x15')](_0xc35a('0x27'),_0x1572a3[_0xc35a('0x18')],_0xa55716);_0x5a5202(_0x11ee8d[_0xc35a('0x15')](0x1f4,_0x1572a3['message']));});});};exports[_0xc35a('0x2a')]=function(_0x5d3180){var _0x540919=this;return new Promise(function(_0x331f19,_0x132958){return db[_0xc35a('0x1d')][_0xc35a('0x2b')](_0x5d3180[_0xc35a('0x2c')],{'raw':_0x5d3180[_0xc35a('0x1f')]?_0x5d3180['options'][_0xc35a('0x29')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d3180['options']?_0x5d3180[_0xc35a('0x1f')][_0xc35a('0x20')]||null:null,'attributes':_0x5d3180['options']?_0x5d3180[_0xc35a('0x1f')][_0xc35a('0x21')]||null:null,'limit':_0x5d3180[_0xc35a('0x1f')]?_0x5d3180['options'][_0xc35a('0x22')]||null:null})[_0xc35a('0x12')](function(_0x5888b1){logger['info'](_0xc35a('0x2a'),_0x5d3180);logger[_0xc35a('0x14')]('UpdateVoiceQueueReport',_0x5d3180,JSON[_0xc35a('0x26')](_0x5888b1));_0x331f19(_0x5888b1);})[_0xc35a('0x1b')](function(_0x3ed3ca){logger[_0xc35a('0x15')](_0xc35a('0x2a'),_0x3ed3ca[_0xc35a('0x18')],_0x5d3180);_0x132958(_0x540919[_0xc35a('0x15')](0x1f4,_0x3ed3ca[_0xc35a('0x18')]));});});}; \ No newline at end of file +var _0xc5c3=['rpc','../../config/environment','redis','localhost','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x58a418,_0x7f2bfa){var _0x22ddb8=function(_0x37aa77){while(--_0x37aa77){_0x58a418['push'](_0x58a418['shift']());}};_0x22ddb8(++_0x7f2bfa);}(_0xc5c3,0x110));var _0x3c5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3c5c('0x0'));var util=require(_0x3c5c('0x1'));var moment=require(_0x3c5c('0x2'));var BPromise=require(_0x3c5c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c5c('0x4'));var db=require(_0x3c5c('0x5'))['db'];var utils=require(_0x3c5c('0x6'));var logger=require(_0x3c5c('0x7'))(_0x3c5c('0x8'));var config=require(_0x3c5c('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3c5c('0xa')],{'host':_0x3c5c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c5c('0xa')]));require(_0x3c5c('0xc'))['register'](socket);function respondWithRpcPromise(_0x139497,_0x41dc16,_0x12e261){return new BPromise(function(_0x109725,_0x4e29f3){return client[_0x3c5c('0xd')](_0x139497,_0x12e261)[_0x3c5c('0xe')](function(_0x5e7ab9){logger[_0x3c5c('0xf')](_0x3c5c('0x10'),_0x41dc16,_0x3c5c('0x11'));logger[_0x3c5c('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x41dc16,_0x3c5c('0x11'),JSON[_0x3c5c('0x13')](_0x5e7ab9));if(_0x5e7ab9[_0x3c5c('0x14')]){if(_0x5e7ab9[_0x3c5c('0x14')][_0x3c5c('0x15')]===0x1f4){logger[_0x3c5c('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x41dc16,_0x5e7ab9[_0x3c5c('0x14')][_0x3c5c('0x16')]);return _0x4e29f3(_0x5e7ab9['error'][_0x3c5c('0x16')]);}logger[_0x3c5c('0x14')](_0x3c5c('0x10'),_0x41dc16,_0x5e7ab9['error'][_0x3c5c('0x16')]);return _0x109725(_0x5e7ab9['error'][_0x3c5c('0x16')]);}else{logger[_0x3c5c('0xf')](_0x3c5c('0x10'),_0x41dc16,'request\x20sent');_0x109725(_0x5e7ab9[_0x3c5c('0x17')][_0x3c5c('0x16')]);}})['catch'](function(_0x297cb2){logger[_0x3c5c('0x14')](_0x3c5c('0x10'),_0x41dc16,_0x297cb2);_0x4e29f3(_0x297cb2);});});}exports[_0x3c5c('0x18')]=function(_0x282893){var _0x3c50b6=this;return new Promise(function(_0x110e15,_0x5d7941){return db[_0x3c5c('0x19')][_0x3c5c('0x1a')]({'raw':_0x282893['options']?_0x282893[_0x3c5c('0x1b')][_0x3c5c('0x1c')]===undefined?!![]:![]:!![],'where':_0x282893[_0x3c5c('0x1b')]?_0x282893['options'][_0x3c5c('0x1d')]||null:null,'attributes':_0x282893[_0x3c5c('0x1b')]?_0x282893[_0x3c5c('0x1b')][_0x3c5c('0x1e')]||null:null,'limit':_0x282893[_0x3c5c('0x1b')]?_0x282893[_0x3c5c('0x1b')][_0x3c5c('0x1f')]||null:null,'include':_0x282893[_0x3c5c('0x1b')]?_0x282893['options']['include']?_[_0x3c5c('0x20')](_0x282893[_0x3c5c('0x1b')][_0x3c5c('0x21')],function(_0x3252ce){return{'model':db[_0x3252ce[_0x3c5c('0x22')]],'as':_0x3252ce['as'],'attributes':_0x3252ce[_0x3c5c('0x1e')],'include':_0x3252ce[_0x3c5c('0x21')]?_['map'](_0x3252ce[_0x3c5c('0x21')],function(_0x1b9d06){return{'model':db[_0x1b9d06[_0x3c5c('0x22')]],'as':_0x1b9d06['as'],'attributes':_0x1b9d06[_0x3c5c('0x1e')],'include':_0x1b9d06['include']?_['map'](_0x1b9d06[_0x3c5c('0x21')],function(_0xf5cf08){return{'model':db[_0xf5cf08['model']],'as':_0xf5cf08['as'],'attributes':_0xf5cf08['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c5c('0xe')](function(_0x524154){logger[_0x3c5c('0xf')](_0x3c5c('0x18'),_0x282893);logger[_0x3c5c('0x12')](_0x3c5c('0x18'),_0x282893,JSON[_0x3c5c('0x13')](_0x524154));_0x110e15(_0x524154);})[_0x3c5c('0x23')](function(_0x424367){logger[_0x3c5c('0x14')](_0x3c5c('0x18'),_0x424367[_0x3c5c('0x16')],_0x282893);_0x5d7941(_0x3c50b6[_0x3c5c('0x14')](0x1f4,_0x424367[_0x3c5c('0x16')]));});});};exports[_0x3c5c('0x24')]=function(_0x2f0acd){var _0x2a9e15=this;return new Promise(function(_0x5998b2,_0x77903){return db[_0x3c5c('0x19')][_0x3c5c('0x25')](_0x2f0acd[_0x3c5c('0x26')],{'raw':_0x2f0acd['options']?_0x2f0acd[_0x3c5c('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3c5c('0xe')](function(_0x2b0ba7){logger['info'](_0x3c5c('0x24'),_0x2f0acd);logger[_0x3c5c('0x12')](_0x3c5c('0x24'),_0x2f0acd,JSON['stringify'](_0x2b0ba7));_0x5998b2(_0x2b0ba7);})[_0x3c5c('0x23')](function(_0x435550){logger[_0x3c5c('0x14')](_0x3c5c('0x24'),_0x435550[_0x3c5c('0x16')],_0x2f0acd);_0x77903(_0x2a9e15[_0x3c5c('0x14')](0x1f4,_0x435550['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x9481de){var _0x2dd95e=this;return new Promise(function(_0x8ba37b,_0x4c414f){return db[_0x3c5c('0x19')]['update'](_0x9481de[_0x3c5c('0x26')],{'raw':_0x9481de[_0x3c5c('0x1b')]?_0x9481de[_0x3c5c('0x1b')][_0x3c5c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9481de[_0x3c5c('0x1b')]?_0x9481de[_0x3c5c('0x1b')][_0x3c5c('0x1d')]||null:null,'attributes':_0x9481de['options']?_0x9481de[_0x3c5c('0x1b')][_0x3c5c('0x1e')]||null:null,'limit':_0x9481de['options']?_0x9481de['options'][_0x3c5c('0x1f')]||null:null})['then'](function(_0x309404){logger[_0x3c5c('0xf')]('UpdateVoiceQueueReport',_0x9481de);logger[_0x3c5c('0x12')](_0x3c5c('0x27'),_0x9481de,JSON['stringify'](_0x309404));_0x8ba37b(_0x309404);})[_0x3c5c('0x23')](function(_0x19a4bb){logger[_0x3c5c('0x14')](_0x3c5c('0x27'),_0x19a4bb[_0x3c5c('0x16')],_0x9481de);_0x4c414f(_0x2dd95e[_0x3c5c('0x14')](0x1f4,_0x19a4bb[_0x3c5c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index db03d1a..1239dc7 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 _0x8743=['removeListener','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x49de88,_0x3030f2){var _0x4cc5dd=function(_0x24668c){while(--_0x24668c){_0x49de88['push'](_0x49de88['shift']());}};_0x4cc5dd(++_0x3030f2);}(_0x8743,0x7a));var _0x3874=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8743[_0x5447fd];return _0x15b28a;};'use strict';var VoiceQueueReportEvents=require(_0x3874('0x0'));var events=[_0x3874('0x1'),_0x3874('0x2'),'update'];function createListener(_0x12c858,_0x2c398d){return function(_0x4bc542){_0x2c398d['emit'](_0x12c858,_0x4bc542);};}function removeListener(_0x35cd1b,_0x230e06){return function(){VoiceQueueReportEvents[_0x3874('0x3')](_0x35cd1b,_0x230e06);};}exports['register']=function(_0x597a79){for(var _0x4b242a=0x0,_0x8f890a=events['length'];_0x4b242a<_0x8f890a;_0x4b242a++){var _0x2dee29=events[_0x4b242a];var _0x3ecd70=createListener(_0x3874('0x4')+_0x2dee29,_0x597a79);VoiceQueueReportEvents['on'](_0x2dee29,_0x3ecd70);}}; \ No newline at end of file +var _0xe4b8=['save','remove','update','removeListener','register','length','./voiceQueueReport.events'];(function(_0x1e7bbc,_0x260210){var _0x257580=function(_0x33c077){while(--_0x33c077){_0x1e7bbc['push'](_0x1e7bbc['shift']());}};_0x257580(++_0x260210);}(_0xe4b8,0x179));var _0x8e4b=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xe4b8[_0x1203f];return _0x365f0a;};'use strict';var VoiceQueueReportEvents=require(_0x8e4b('0x0'));var events=[_0x8e4b('0x1'),_0x8e4b('0x2'),_0x8e4b('0x3')];function createListener(_0x42c835,_0x365269){return function(_0x1161a8){_0x365269['emit'](_0x42c835,_0x1161a8);};}function removeListener(_0x4fa340,_0x35e679){return function(){VoiceQueueReportEvents[_0x8e4b('0x4')](_0x4fa340,_0x35e679);};}exports[_0x8e4b('0x5')]=function(_0x47e630){for(var _0x2796f8=0x0,_0x4d0472=events[_0x8e4b('0x6')];_0x2796f8<_0x4d0472;_0x2796f8++){var _0x5642a3=events[_0x2796f8];var _0x4e0535=createListener('voiceQueueReport:'+_0x5642a3,_0x47e630);VoiceQueueReportEvents['on'](_0x5642a3,_0x4e0535);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index a121117..5641fd0 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 _0x4092=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x4092,0x1af));var _0x2409=function(_0x179d86,_0x139c2c){_0x179d86=_0x179d86-0x0;var _0x437ec7=_0x4092[_0x179d86];return _0x437ec7;};'use strict';var multer=require('multer');var util=require(_0x2409('0x0'));var path=require(_0x2409('0x1'));var timeout=require(_0x2409('0x2'));var express=require(_0x2409('0x3'));var router=express[_0x2409('0x4')]();var fs_extra=require(_0x2409('0x5'));var auth=require(_0x2409('0x6'));var interaction=require(_0x2409('0x7'));var config=require(_0x2409('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x2409('0x9')]('/',auth[_0x2409('0xa')](),controller[_0x2409('0xb')]);router['get'](_0x2409('0xc'),auth[_0x2409('0xa')](),controller[_0x2409('0xd')]);router[_0x2409('0xe')]('/',auth[_0x2409('0xa')](),controller[_0x2409('0xf')]);router[_0x2409('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2409('0x11')]);router[_0x2409('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2409('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7323=['get','isAuthenticated','index','/:id','show','post','put','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','./voiceQueuesLog.controller'];(function(_0x4c8a67,_0x465097){var _0x433cb5=function(_0x11154c){while(--_0x11154c){_0x4c8a67['push'](_0x4c8a67['shift']());}};_0x433cb5(++_0x465097);}(_0x7323,0x171));var _0x3732=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x7323[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0x3732('0x0'));var util=require(_0x3732('0x1'));var path=require('path');var timeout=require(_0x3732('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3732('0x3'));var auth=require(_0x3732('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3732('0x5'));router[_0x3732('0x6')]('/',auth[_0x3732('0x7')](),controller[_0x3732('0x8')]);router[_0x3732('0x6')](_0x3732('0x9'),auth[_0x3732('0x7')](),controller[_0x3732('0xa')]);router[_0x3732('0xb')]('/',auth[_0x3732('0x7')](),controller['create']);router[_0x3732('0xc')](_0x3732('0x9'),auth[_0x3732('0x7')](),controller['update']);router['delete'](_0x3732('0x9'),auth['isAuthenticated'](),controller[_0x3732('0xd')]);module[_0x3732('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 18a1f17..341a4e8 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 _0x12f4=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x567b28,_0x5a080b){var _0xee2e3a=function(_0x54d966){while(--_0x54d966){_0x567b28['push'](_0x567b28['shift']());}};_0xee2e3a(++_0x5a080b);}(_0x12f4,0x199));var _0x412f=function(_0x1b9e9f,_0x332f73){_0x1b9e9f=_0x1b9e9f-0x0;var _0x245c99=_0x12f4[_0x1b9e9f];return _0x245c99;};'use strict';var Sequelize=require(_0x412f('0x0'));var moment=require(_0x412f('0x1'));module[_0x412f('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x412f('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x412f('0x5')](_0x412f('0x6'))}}; \ No newline at end of file +var _0xf2bc=['literal','moment','exports','STRING','DATE'];(function(_0x338442,_0x1974d1){var _0x11179b=function(_0x5bd177){while(--_0x5bd177){_0x338442['push'](_0x338442['shift']());}};_0x11179b(++_0x1974d1);}(_0xf2bc,0x7e));var _0xcf2b=function(_0x3afc4a,_0x5c6476){_0x3afc4a=_0x3afc4a-0x0;var _0x4de50f=_0xf2bc[_0x3afc4a];return _0x4de50f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcf2b('0x0'));module[_0xcf2b('0x1')]={'time':{'type':Sequelize[_0xcf2b('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xcf2b('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xcf2b('0x4')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 6c4ec74..dd15553 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 _0xbab3=['update','then','sendStatus','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x2dee2f,_0x19572f){var _0x327c18=function(_0x130ec0){while(--_0x130ec0){_0x2dee2f['push'](_0x2dee2f['shift']());}};_0x327c18(++_0x19572f);}(_0xbab3,0x1ae));var _0x3bab=function(_0x2e334b,_0x426b6e){_0x2e334b=_0x2e334b-0x0;var _0x390570=_0xbab3[_0x2e334b];return _0x390570;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bab('0x0'));var zipdir=require(_0x3bab('0x1'));var jsonpatch=require(_0x3bab('0x2'));var rp=require(_0x3bab('0x3'));var moment=require(_0x3bab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3bab('0x5'));var util=require(_0x3bab('0x6'));var path=require('path');var sox=require(_0x3bab('0x7'));var csv=require(_0x3bab('0x8'));var ejs=require(_0x3bab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bab('0xa'));var squel=require(_0x3bab('0xb'));var crypto=require(_0x3bab('0xc'));var jsforce=require(_0x3bab('0xd'));var deskjs=require(_0x3bab('0xe'));var toCsv=require(_0x3bab('0x8'));var querystring=require(_0x3bab('0xf'));var Papa=require(_0x3bab('0x10'));var Redis=require(_0x3bab('0x11'));var authService=require(_0x3bab('0x12'));var qs=require(_0x3bab('0x13'));var as=require(_0x3bab('0x14'));var hardwareService=require(_0x3bab('0x15'));var logger=require(_0x3bab('0x16'))(_0x3bab('0x17'));var utils=require('../../config/utils');var config=require(_0x3bab('0x18'));var licenseUtil=require(_0x3bab('0x19'));var db=require(_0x3bab('0x1a'))['db'];function respondWithStatusCode(_0xec370c,_0x3b0fc3){_0x3b0fc3=_0x3b0fc3||0xcc;return function(_0x1a441a){if(_0x1a441a){return _0xec370c['sendStatus'](_0x3b0fc3);}return _0xec370c['status'](_0x3b0fc3)[_0x3bab('0x1b')]();};}function respondWithResult(_0xdcaefa,_0x108c09){_0x108c09=_0x108c09||0xc8;return function(_0x2bedc9){if(_0x2bedc9){return _0xdcaefa[_0x3bab('0x1c')](_0x108c09)[_0x3bab('0x1d')](_0x2bedc9);}};}function respondWithFilteredResult(_0x3b5cb6,_0x15cc62){return function(_0x52b9b2){if(_0x52b9b2){var _0x4deaa5=typeof _0x15cc62['offset']===_0x3bab('0x1e')&&typeof _0x15cc62[_0x3bab('0x1f')]==='undefined';var _0x437773=_0x52b9b2[_0x3bab('0x20')];var _0x3ae92d=_0x4deaa5?0x0:_0x15cc62['offset'];var _0x1c46f6=_0x4deaa5?_0x52b9b2['count']:_0x15cc62['offset']+_0x15cc62[_0x3bab('0x1f')];var _0x59d206;if(_0x1c46f6>=_0x437773){_0x1c46f6=_0x437773;_0x59d206=0xc8;}else{_0x59d206=0xce;}_0x3b5cb6[_0x3bab('0x1c')](_0x59d206);return _0x3b5cb6[_0x3bab('0x21')](_0x3bab('0x22'),_0x3ae92d+'-'+_0x1c46f6+'/'+_0x437773)[_0x3bab('0x1d')](_0x52b9b2);}return null;};}function patchUpdates(_0x384681){return function(_0x50d529){try{jsonpatch[_0x3bab('0x23')](_0x50d529,_0x384681,!![]);}catch(_0x34b43e){return BPromise[_0x3bab('0x24')](_0x34b43e);}return _0x50d529[_0x3bab('0x25')]();};}function saveUpdates(_0x277220,_0x51d1d6){return function(_0x3a46c7){if(_0x3a46c7){return _0x3a46c7[_0x3bab('0x26')](_0x277220)[_0x3bab('0x27')](function(_0x4c0e76){return _0x4c0e76;});}return null;};}function removeEntity(_0x24d5a4,_0x2fab37){return function(_0x2a7815){if(_0x2a7815){return _0x2a7815['destroy']()[_0x3bab('0x27')](function(){_0x24d5a4[_0x3bab('0x1c')](0xcc)[_0x3bab('0x1b')]();});}};}function handleEntityNotFound(_0x4fc1f0,_0x4c16b1){return function(_0x4aea7c){if(!_0x4aea7c){_0x4fc1f0[_0x3bab('0x28')](0x194);}return _0x4aea7c;};}function handleError(_0x3dc54d,_0x3cdb50){_0x3cdb50=_0x3cdb50||0x1f4;return function(_0x2eedac){logger[_0x3bab('0x29')](_0x2eedac[_0x3bab('0x2a')]);if(_0x2eedac[_0x3bab('0x2b')]){delete _0x2eedac[_0x3bab('0x2b')];}_0x3dc54d[_0x3bab('0x1c')](_0x3cdb50)[_0x3bab('0x2c')](_0x2eedac);};}exports['index']=function(_0x13eec0,_0x135421){var _0x5897aa={},_0x1fff29={},_0x4283c8={'count':0x0,'rows':[]};var _0x248aeb=_[_0x3bab('0x2d')](db[_0x3bab('0x2e')][_0x3bab('0x2f')],function(_0x27fed5){return{'name':_0x27fed5[_0x3bab('0x30')],'type':_0x27fed5[_0x3bab('0x31')][_0x3bab('0x32')]};});_0x1fff29[_0x3bab('0x33')]=_[_0x3bab('0x2d')](_0x248aeb,_0x3bab('0x2b'));_0x1fff29[_0x3bab('0x34')]=_[_0x3bab('0x35')](_0x13eec0[_0x3bab('0x34')]);_0x1fff29[_0x3bab('0x36')]=_[_0x3bab('0x37')](_0x1fff29['model'],_0x1fff29[_0x3bab('0x34')]);_0x5897aa[_0x3bab('0x38')]=_[_0x3bab('0x37')](_0x1fff29[_0x3bab('0x33')],qs['fields'](_0x13eec0[_0x3bab('0x34')][_0x3bab('0x39')]));_0x5897aa['attributes']=_0x5897aa[_0x3bab('0x38')][_0x3bab('0x3a')]?_0x5897aa[_0x3bab('0x38')]:_0x1fff29['model'];if(!_0x13eec0[_0x3bab('0x34')][_0x3bab('0x3b')](_0x3bab('0x3c'))){_0x5897aa[_0x3bab('0x1f')]=qs[_0x3bab('0x1f')](_0x13eec0[_0x3bab('0x34')]['limit']);_0x5897aa['offset']=qs[_0x3bab('0x3d')](_0x13eec0['query']['offset']);}_0x5897aa[_0x3bab('0x3e')]=qs['sort'](_0x13eec0[_0x3bab('0x34')][_0x3bab('0x3f')]);_0x5897aa['where']=qs['filters'](_[_0x3bab('0x40')](_0x13eec0[_0x3bab('0x34')],_0x1fff29[_0x3bab('0x36')]),_0x248aeb);if(_0x13eec0[_0x3bab('0x34')][_0x3bab('0x41')]){_0x5897aa[_0x3bab('0x42')]=_[_0x3bab('0x43')](_0x5897aa[_0x3bab('0x42')],{'$or':_[_0x3bab('0x2d')](_0x248aeb,function(_0x2d6d80){if(_0x2d6d80['type']!=='VIRTUAL'){var _0x46d4cf={};_0x46d4cf[_0x2d6d80[_0x3bab('0x2b')]]={'$like':'%'+_0x13eec0[_0x3bab('0x34')][_0x3bab('0x41')]+'%'};return _0x46d4cf;}})});}_0x5897aa=_[_0x3bab('0x43')]({},_0x5897aa,_0x13eec0[_0x3bab('0x44')]);var _0x5421ef={'where':_0x5897aa[_0x3bab('0x42')]};return db['VoiceQueuesLog'][_0x3bab('0x20')](_0x5421ef)[_0x3bab('0x27')](function(_0xcabac3){_0x4283c8[_0x3bab('0x20')]=_0xcabac3;if(_0x13eec0['query'][_0x3bab('0x45')]){_0x5897aa[_0x3bab('0x46')]=[{'all':!![]}];}return db[_0x3bab('0x2e')]['findAll'](_0x5897aa);})['then'](function(_0x586c1d){_0x4283c8[_0x3bab('0x47')]=_0x586c1d;return _0x4283c8;})[_0x3bab('0x27')](respondWithFilteredResult(_0x135421,_0x5897aa))[_0x3bab('0x48')](handleError(_0x135421,null));};exports[_0x3bab('0x49')]=function(_0x928974,_0x5e4d7a){var _0x43e102={'raw':!![],'where':{'id':_0x928974['params']['id']}},_0x366aff={};_0x366aff['model']=_['keys'](db[_0x3bab('0x2e')][_0x3bab('0x2f')]);_0x366aff[_0x3bab('0x34')]=_[_0x3bab('0x35')](_0x928974['query']);_0x366aff[_0x3bab('0x36')]=_[_0x3bab('0x37')](_0x366aff[_0x3bab('0x33')],_0x366aff[_0x3bab('0x34')]);_0x43e102[_0x3bab('0x38')]=_[_0x3bab('0x37')](_0x366aff[_0x3bab('0x33')],qs['fields'](_0x928974['query'][_0x3bab('0x39')]));_0x43e102['attributes']=_0x43e102[_0x3bab('0x38')]['length']?_0x43e102['attributes']:_0x366aff[_0x3bab('0x33')];if(_0x928974[_0x3bab('0x34')][_0x3bab('0x45')]){_0x43e102['include']=[{'all':!![]}];}_0x43e102=_[_0x3bab('0x43')]({},_0x43e102,_0x928974['options']);return db[_0x3bab('0x2e')][_0x3bab('0x4a')](_0x43e102)[_0x3bab('0x27')](handleEntityNotFound(_0x5e4d7a,null))['then'](respondWithResult(_0x5e4d7a,null))[_0x3bab('0x48')](handleError(_0x5e4d7a,null));};exports[_0x3bab('0x4b')]=function(_0x3b0501,_0x358fa4){return db[_0x3bab('0x2e')]['create'](_0x3b0501[_0x3bab('0x4c')],{})[_0x3bab('0x27')](respondWithResult(_0x358fa4,0xc9))[_0x3bab('0x48')](handleError(_0x358fa4,null));};exports[_0x3bab('0x26')]=function(_0x549841,_0x138175){if(_0x549841[_0x3bab('0x4c')]['id']){delete _0x549841[_0x3bab('0x4c')]['id'];}return db[_0x3bab('0x2e')]['find']({'where':{'id':_0x549841['params']['id']}})['then'](handleEntityNotFound(_0x138175,null))['then'](saveUpdates(_0x549841[_0x3bab('0x4c')],null))[_0x3bab('0x27')](respondWithResult(_0x138175,null))[_0x3bab('0x48')](handleError(_0x138175,null));};exports[_0x3bab('0x4d')]=function(_0x1ebc33,_0x581bb5){return db[_0x3bab('0x2e')][_0x3bab('0x4a')]({'where':{'id':_0x1ebc33['params']['id']}})[_0x3bab('0x27')](handleEntityNotFound(_0x581bb5,null))['then'](removeEntity(_0x581bb5,null))[_0x3bab('0x48')](handleError(_0x581bb5,null));}; \ No newline at end of file +var _0xe7d0=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','VoiceQueuesLog','findAll','rows','catch','show','keys','rawAttributes','includeAll','create','body','find','params','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x26ffb1,_0x1adfdc){var _0x24ac6b=function(_0xe1bba){while(--_0xe1bba){_0x26ffb1['push'](_0x26ffb1['shift']());}};_0x24ac6b(++_0x1adfdc);}(_0xe7d0,0x118));var _0x0e7d=function(_0x31f6c9,_0x589c9f){_0x31f6c9=_0x31f6c9-0x0;var _0x354fee=_0xe7d0[_0x31f6c9];return _0x354fee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e7d('0x0'));var zipdir=require(_0x0e7d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e7d('0x2'));var moment=require(_0x0e7d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0e7d('0x4'));var sox=require(_0x0e7d('0x5'));var csv=require(_0x0e7d('0x6'));var ejs=require(_0x0e7d('0x7'));var fs=require('fs');var fs_extra=require(_0x0e7d('0x8'));var _=require('lodash');var squel=require(_0x0e7d('0x9'));var crypto=require(_0x0e7d('0xa'));var jsforce=require(_0x0e7d('0xb'));var deskjs=require(_0x0e7d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0e7d('0xd'));var Papa=require(_0x0e7d('0xe'));var Redis=require(_0x0e7d('0xf'));var authService=require(_0x0e7d('0x10'));var qs=require(_0x0e7d('0x11'));var as=require(_0x0e7d('0x12'));var hardwareService=require(_0x0e7d('0x13'));var logger=require(_0x0e7d('0x14'))('api');var utils=require(_0x0e7d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e7d('0x16'));var db=require(_0x0e7d('0x17'))['db'];function respondWithStatusCode(_0x4f4625,_0x395804){_0x395804=_0x395804||0xcc;return function(_0x6b5227){if(_0x6b5227){return _0x4f4625[_0x0e7d('0x18')](_0x395804);}return _0x4f4625['status'](_0x395804)[_0x0e7d('0x19')]();};}function respondWithResult(_0x8db8d5,_0x38319d){_0x38319d=_0x38319d||0xc8;return function(_0x53f7f7){if(_0x53f7f7){return _0x8db8d5[_0x0e7d('0x1a')](_0x38319d)[_0x0e7d('0x1b')](_0x53f7f7);}};}function respondWithFilteredResult(_0x2132f4,_0xbd0bce){return function(_0x3fe081){if(_0x3fe081){var _0x55551a=typeof _0xbd0bce[_0x0e7d('0x1c')]==='undefined'&&typeof _0xbd0bce[_0x0e7d('0x1d')]==='undefined';var _0x5e7a97=_0x3fe081[_0x0e7d('0x1e')];var _0xd9a2aa=_0x55551a?0x0:_0xbd0bce['offset'];var _0x498860=_0x55551a?_0x3fe081['count']:_0xbd0bce[_0x0e7d('0x1c')]+_0xbd0bce[_0x0e7d('0x1d')];var _0x561072;if(_0x498860>=_0x5e7a97){_0x498860=_0x5e7a97;_0x561072=0xc8;}else{_0x561072=0xce;}_0x2132f4[_0x0e7d('0x1a')](_0x561072);return _0x2132f4[_0x0e7d('0x1f')](_0x0e7d('0x20'),_0xd9a2aa+'-'+_0x498860+'/'+_0x5e7a97)[_0x0e7d('0x1b')](_0x3fe081);}return null;};}function patchUpdates(_0xa4a600){return function(_0x40e017){try{jsonpatch[_0x0e7d('0x21')](_0x40e017,_0xa4a600,!![]);}catch(_0x58a6a5){return BPromise[_0x0e7d('0x22')](_0x58a6a5);}return _0x40e017['save']();};}function saveUpdates(_0x168c31,_0x2692a2){return function(_0x5412ef){if(_0x5412ef){return _0x5412ef[_0x0e7d('0x23')](_0x168c31)[_0x0e7d('0x24')](function(_0x1a5736){return _0x1a5736;});}return null;};}function removeEntity(_0x585931,_0x3592ba){return function(_0x4a242f){if(_0x4a242f){return _0x4a242f[_0x0e7d('0x25')]()[_0x0e7d('0x24')](function(){_0x585931['status'](0xcc)[_0x0e7d('0x19')]();});}};}function handleEntityNotFound(_0x66c50,_0x1f8ea7){return function(_0x40ed2c){if(!_0x40ed2c){_0x66c50[_0x0e7d('0x18')](0x194);}return _0x40ed2c;};}function handleError(_0x13ff5b,_0x3e005a){_0x3e005a=_0x3e005a||0x1f4;return function(_0x21fede){logger[_0x0e7d('0x26')](_0x21fede['stack']);if(_0x21fede['name']){delete _0x21fede[_0x0e7d('0x27')];}_0x13ff5b[_0x0e7d('0x1a')](_0x3e005a)[_0x0e7d('0x28')](_0x21fede);};}exports[_0x0e7d('0x29')]=function(_0xc95aa,_0x4e730f){var _0x423eef={},_0x418c92={},_0x1d53d1={'count':0x0,'rows':[]};var _0x275198=_[_0x0e7d('0x2a')](db['VoiceQueuesLog']['rawAttributes'],function(_0x5652c4){return{'name':_0x5652c4['fieldName'],'type':_0x5652c4[_0x0e7d('0x2b')][_0x0e7d('0x2c')]};});_0x418c92[_0x0e7d('0x2d')]=_[_0x0e7d('0x2a')](_0x275198,_0x0e7d('0x27'));_0x418c92[_0x0e7d('0x2e')]=_['keys'](_0xc95aa[_0x0e7d('0x2e')]);_0x418c92[_0x0e7d('0x2f')]=_['intersection'](_0x418c92[_0x0e7d('0x2d')],_0x418c92[_0x0e7d('0x2e')]);_0x423eef[_0x0e7d('0x30')]=_[_0x0e7d('0x31')](_0x418c92['model'],qs[_0x0e7d('0x32')](_0xc95aa[_0x0e7d('0x2e')][_0x0e7d('0x32')]));_0x423eef['attributes']=_0x423eef['attributes'][_0x0e7d('0x33')]?_0x423eef[_0x0e7d('0x30')]:_0x418c92[_0x0e7d('0x2d')];if(!_0xc95aa[_0x0e7d('0x2e')][_0x0e7d('0x34')](_0x0e7d('0x35'))){_0x423eef[_0x0e7d('0x1d')]=qs[_0x0e7d('0x1d')](_0xc95aa[_0x0e7d('0x2e')][_0x0e7d('0x1d')]);_0x423eef['offset']=qs[_0x0e7d('0x1c')](_0xc95aa['query'][_0x0e7d('0x1c')]);}_0x423eef[_0x0e7d('0x36')]=qs[_0x0e7d('0x37')](_0xc95aa[_0x0e7d('0x2e')][_0x0e7d('0x37')]);_0x423eef[_0x0e7d('0x38')]=qs[_0x0e7d('0x2f')](_['pick'](_0xc95aa[_0x0e7d('0x2e')],_0x418c92[_0x0e7d('0x2f')]),_0x275198);if(_0xc95aa[_0x0e7d('0x2e')][_0x0e7d('0x39')]){_0x423eef['where']=_[_0x0e7d('0x3a')](_0x423eef[_0x0e7d('0x38')],{'$or':_[_0x0e7d('0x2a')](_0x275198,function(_0xba104a){if(_0xba104a[_0x0e7d('0x2b')]!==_0x0e7d('0x3b')){var _0x3590b6={};_0x3590b6[_0xba104a['name']]={'$like':'%'+_0xc95aa['query']['filter']+'%'};return _0x3590b6;}})});}_0x423eef=_[_0x0e7d('0x3a')]({},_0x423eef,_0xc95aa[_0x0e7d('0x3c')]);var _0x235d85={'where':_0x423eef['where']};return db['VoiceQueuesLog'][_0x0e7d('0x1e')](_0x235d85)['then'](function(_0x5b4eec){_0x1d53d1[_0x0e7d('0x1e')]=_0x5b4eec;if(_0xc95aa[_0x0e7d('0x2e')]['includeAll']){_0x423eef[_0x0e7d('0x3d')]=[{'all':!![]}];}return db[_0x0e7d('0x3e')][_0x0e7d('0x3f')](_0x423eef);})[_0x0e7d('0x24')](function(_0x44ad81){_0x1d53d1[_0x0e7d('0x40')]=_0x44ad81;return _0x1d53d1;})[_0x0e7d('0x24')](respondWithFilteredResult(_0x4e730f,_0x423eef))[_0x0e7d('0x41')](handleError(_0x4e730f,null));};exports[_0x0e7d('0x42')]=function(_0x55e099,_0x1634ce){var _0x2e6ad8={'raw':!![],'where':{'id':_0x55e099['params']['id']}},_0x57024f={};_0x57024f['model']=_[_0x0e7d('0x43')](db[_0x0e7d('0x3e')][_0x0e7d('0x44')]);_0x57024f[_0x0e7d('0x2e')]=_[_0x0e7d('0x43')](_0x55e099[_0x0e7d('0x2e')]);_0x57024f[_0x0e7d('0x2f')]=_[_0x0e7d('0x31')](_0x57024f[_0x0e7d('0x2d')],_0x57024f[_0x0e7d('0x2e')]);_0x2e6ad8['attributes']=_[_0x0e7d('0x31')](_0x57024f[_0x0e7d('0x2d')],qs[_0x0e7d('0x32')](_0x55e099[_0x0e7d('0x2e')]['fields']));_0x2e6ad8[_0x0e7d('0x30')]=_0x2e6ad8[_0x0e7d('0x30')][_0x0e7d('0x33')]?_0x2e6ad8[_0x0e7d('0x30')]:_0x57024f[_0x0e7d('0x2d')];if(_0x55e099[_0x0e7d('0x2e')][_0x0e7d('0x45')]){_0x2e6ad8[_0x0e7d('0x3d')]=[{'all':!![]}];}_0x2e6ad8=_['merge']({},_0x2e6ad8,_0x55e099[_0x0e7d('0x3c')]);return db[_0x0e7d('0x3e')]['find'](_0x2e6ad8)['then'](handleEntityNotFound(_0x1634ce,null))[_0x0e7d('0x24')](respondWithResult(_0x1634ce,null))['catch'](handleError(_0x1634ce,null));};exports['create']=function(_0x5a2137,_0xae683a){return db[_0x0e7d('0x3e')][_0x0e7d('0x46')](_0x5a2137['body'],{})[_0x0e7d('0x24')](respondWithResult(_0xae683a,0xc9))[_0x0e7d('0x41')](handleError(_0xae683a,null));};exports['update']=function(_0x348819,_0x701e15){if(_0x348819['body']['id']){delete _0x348819[_0x0e7d('0x47')]['id'];}return db[_0x0e7d('0x3e')][_0x0e7d('0x48')]({'where':{'id':_0x348819[_0x0e7d('0x49')]['id']}})['then'](handleEntityNotFound(_0x701e15,null))[_0x0e7d('0x24')](saveUpdates(_0x348819[_0x0e7d('0x47')],null))[_0x0e7d('0x24')](respondWithResult(_0x701e15,null))[_0x0e7d('0x41')](handleError(_0x701e15,null));};exports[_0x0e7d('0x25')]=function(_0x150fef,_0x4321b3){return db[_0x0e7d('0x3e')][_0x0e7d('0x48')]({'where':{'id':_0x150fef[_0x0e7d('0x49')]['id']}})['then'](handleEntityNotFound(_0x4321b3,null))['then'](removeEntity(_0x4321b3,null))[_0x0e7d('0x41')](handleError(_0x4321b3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index cef5fa8..a216b9a 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 _0x253c=['VoiceQueuesLog','voice_queues_log','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x2c8d31,_0x50c07f){var _0x3cc5db=function(_0x3fa7db){while(--_0x3fa7db){_0x2c8d31['push'](_0x2c8d31['shift']());}};_0x3cc5db(++_0x50c07f);}(_0x253c,0x13f));var _0xc253=function(_0x45c5f9,_0x1ad8c9){_0x45c5f9=_0x45c5f9-0x0;var _0x22cc60=_0x253c[_0x45c5f9];return _0x22cc60;};'use strict';var _=require(_0xc253('0x0'));var util=require(_0xc253('0x1'));var logger=require(_0xc253('0x2'))(_0xc253('0x3'));var moment=require(_0xc253('0x4'));var BPromise=require(_0xc253('0x5'));var rp=require(_0xc253('0x6'));var fs=require('fs');var path=require(_0xc253('0x7'));var rimraf=require(_0xc253('0x8'));var config=require(_0xc253('0x9'));var attributes=require(_0xc253('0xa'));module['exports']=function(_0xfc59d7,_0x10ef82){return _0xfc59d7['define'](_0xc253('0xb'),attributes,{'tableName':_0xc253('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xc253('0xd'),_0xc253('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xbdd7=['moment','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger'];(function(_0x116c0e,_0xa5cb87){var _0x3fd46a=function(_0x4134cf){while(--_0x4134cf){_0x116c0e['push'](_0x116c0e['shift']());}};_0x3fd46a(++_0xa5cb87);}(_0xbdd7,0xed));var _0x7bdd=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbdd7[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7bdd('0x0'));var util=require(_0x7bdd('0x1'));var logger=require(_0x7bdd('0x2'))('api');var moment=require(_0x7bdd('0x3'));var BPromise=require('bluebird');var rp=require(_0x7bdd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bdd('0x5'));var config=require(_0x7bdd('0x6'));var attributes=require(_0x7bdd('0x7'));module[_0x7bdd('0x8')]=function(_0x4f3324,_0x37587c){return _0x4f3324[_0x7bdd('0x9')](_0x7bdd('0xa'),attributes,{'tableName':_0x7bdd('0xb'),'paranoid':![],'indexes':[{'name':_0x7bdd('0xc'),'fields':[_0x7bdd('0xd'),_0x7bdd('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 4f4e5f7..2cb532d 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 _0xc8de=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util'];(function(_0x423e15,_0x12b2b2){var _0x184279=function(_0x445a68){while(--_0x445a68){_0x423e15['push'](_0x423e15['shift']());}};_0x184279(++_0x12b2b2);}(_0xc8de,0x167));var _0xec8d=function(_0x3849fa,_0x2b6858){_0x3849fa=_0x3849fa-0x0;var _0x570d35=_0xc8de[_0x3849fa];return _0x570d35;};'use strict';var _=require('lodash');var util=require(_0xec8d('0x0'));var moment=require(_0xec8d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec8d('0x2'));var db=require(_0xec8d('0x3'))['db'];var utils=require(_0xec8d('0x4'));var logger=require(_0xec8d('0x5'))(_0xec8d('0x6'));var config=require(_0xec8d('0x7'));var jayson=require(_0xec8d('0x8'));var client=jayson['client'][_0xec8d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55e36c,_0x11308b,_0x596921){return new BPromise(function(_0x37de69,_0x597c70){return client[_0xec8d('0xa')](_0x55e36c,_0x596921)['then'](function(_0x2e028d){logger[_0xec8d('0xb')](_0xec8d('0xc'),_0x11308b,_0xec8d('0xd'));logger[_0xec8d('0xe')](_0xec8d('0xf'),_0x11308b,_0xec8d('0xd'),JSON[_0xec8d('0x10')](_0x2e028d));if(_0x2e028d[_0xec8d('0x11')]){if(_0x2e028d[_0xec8d('0x11')]['code']===0x1f4){logger[_0xec8d('0x11')](_0xec8d('0xc'),_0x11308b,_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);return _0x597c70(_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);}logger[_0xec8d('0x11')](_0xec8d('0xc'),_0x11308b,_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);return _0x37de69(_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);}else{logger['info'](_0xec8d('0xc'),_0x11308b,_0xec8d('0xd'));_0x37de69(_0x2e028d[_0xec8d('0x13')][_0xec8d('0x12')]);}})['catch'](function(_0x2fb24f){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x11308b,_0x2fb24f);_0x597c70(_0x2fb24f);});});} \ No newline at end of file +var _0x44af=['info','request\x20sent','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1b78e5,_0x361288){var _0x216e16=function(_0x560e31){while(--_0x560e31){_0x1b78e5['push'](_0x1b78e5['shift']());}};_0x216e16(++_0x361288);}(_0x44af,0xc5));var _0xf44a=function(_0x331085,_0x46ef3b){_0x331085=_0x331085-0x0;var _0x1547f4=_0x44af[_0x331085];return _0x1547f4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf44a('0x0'));var BPromise=require(_0xf44a('0x1'));var rs=require(_0xf44a('0x2'));var fs=require('fs');var Redis=require(_0xf44a('0x3'));var db=require(_0xf44a('0x4'))['db'];var utils=require(_0xf44a('0x5'));var logger=require('../../config/logger')(_0xf44a('0x6'));var config=require(_0xf44a('0x7'));var jayson=require(_0xf44a('0x8'));var client=jayson[_0xf44a('0x9')][_0xf44a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38c550,_0x971b34,_0x2bf323){return new BPromise(function(_0x4117bf,_0x5b249f){return client[_0xf44a('0xb')](_0x38c550,_0x2bf323)[_0xf44a('0xc')](function(_0x3bda51){logger[_0xf44a('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x971b34,_0xf44a('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x971b34,_0xf44a('0xe'),JSON['stringify'](_0x3bda51));if(_0x3bda51[_0xf44a('0xf')]){if(_0x3bda51['error'][_0xf44a('0x10')]===0x1f4){logger[_0xf44a('0xf')](_0xf44a('0x11'),_0x971b34,_0x3bda51[_0xf44a('0xf')][_0xf44a('0x12')]);return _0x5b249f(_0x3bda51['error'][_0xf44a('0x12')]);}logger[_0xf44a('0xf')](_0xf44a('0x11'),_0x971b34,_0x3bda51[_0xf44a('0xf')][_0xf44a('0x12')]);return _0x4117bf(_0x3bda51['error'][_0xf44a('0x12')]);}else{logger[_0xf44a('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x971b34,'request\x20sent');_0x4117bf(_0x3bda51[_0xf44a('0x13')][_0xf44a('0x12')]);}})[_0xf44a('0x14')](function(_0x3f265b){logger[_0xf44a('0xf')](_0xf44a('0x11'),_0x971b34,_0x3f265b);_0x5b249f(_0x3f265b);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e80928c..702878d 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 _0x40b2=['/:id','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./voiceRecording.controller','get','isAuthenticated','describe'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x40b2,0xf1));var _0x240b=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x40b2[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0x240b('0x0'));var util=require(_0x240b('0x1'));var path=require(_0x240b('0x2'));var timeout=require(_0x240b('0x3'));var express=require(_0x240b('0x4'));var router=express[_0x240b('0x5')]();var fs_extra=require(_0x240b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x240b('0x7'));router[_0x240b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x240b('0x8')]('/describe',auth[_0x240b('0x9')](),controller[_0x240b('0xa')]);router[_0x240b('0x8')](_0x240b('0xb'),auth[_0x240b('0x9')](),controller['show']);router[_0x240b('0x8')](_0x240b('0xc'),auth[_0x240b('0x9')](),controller['download']);router[_0x240b('0x8')](_0x240b('0xd'),controller[_0x240b('0xe')]);router['get'](_0x240b('0xf'),auth[_0x240b('0x9')](),controller[_0x240b('0x10')]);router[_0x240b('0x11')]('/',auth['isAuthenticated'](),controller[_0x240b('0x12')]);router[_0x240b('0x11')]('/:id/transcribe',auth[_0x240b('0x9')](),controller[_0x240b('0x13')]);router['put'](_0x240b('0xb'),auth[_0x240b('0x9')](),controller['update']);router['delete'](_0x240b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x240b('0x14')]=router; \ No newline at end of file +var _0x5dfc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','/:id','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x806301,_0x3e3ad4){var _0x1a8bc5=function(_0x33071f){while(--_0x33071f){_0x806301['push'](_0x806301['shift']());}};_0x1a8bc5(++_0x3e3ad4);}(_0x5dfc,0xdc));var _0xc5df=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0x5dfc[_0x36bfe3];return _0x9b0436;};'use strict';var multer=require(_0xc5df('0x0'));var util=require('util');var path=require(_0xc5df('0x1'));var timeout=require(_0xc5df('0x2'));var express=require(_0xc5df('0x3'));var router=express[_0xc5df('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc5df('0x5'));var interaction=require(_0xc5df('0x6'));var config=require(_0xc5df('0x7'));var controller=require(_0xc5df('0x8'));router[_0xc5df('0x9')]('/',auth[_0xc5df('0xa')](),controller[_0xc5df('0xb')]);router[_0xc5df('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc5df('0xc')]);router[_0xc5df('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xc5df('0xd'),auth['isAuthenticated'](),controller[_0xc5df('0xe')]);router['get'](_0xc5df('0xf'),controller[_0xc5df('0x10')]);router[_0xc5df('0x9')](_0xc5df('0x11'),auth[_0xc5df('0xa')](),controller['downloadTranscribe']);router[_0xc5df('0x12')]('/',auth['isAuthenticated'](),controller[_0xc5df('0x13')]);router[_0xc5df('0x12')]('/:id/transcribe',auth[_0xc5df('0xa')](),controller[_0xc5df('0x14')]);router['put'](_0xc5df('0x15'),auth[_0xc5df('0xa')](),controller[_0xc5df('0x16')]);router[_0xc5df('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc5df('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 36ad799..b2e3e60 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(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 1259b25..adfd495 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 _0x3f81=['[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','bucket','Transcribe\x20not\x20configured','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','aws-sdk','ioredis','../../components/auth/service','../../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','reject','update','then','destroy','error','name','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','download','../../components/encryptor','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','sequelize','MD5','col','uniqueid','$and','push','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob'];(function(_0x38ee89,_0x569ee2){var _0x23c725=function(_0x1644c4){while(--_0x1644c4){_0x38ee89['push'](_0x38ee89['shift']());}};_0x23c725(++_0x569ee2);}(_0x3f81,0xc9));var _0x13f8=function(_0x23e604,_0x4832e9){_0x23e604=_0x23e604-0x0;var _0x3facac=_0x3f81[_0x23e604];return _0x3facac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13f8('0x0'));var zipdir=require(_0x13f8('0x1'));var jsonpatch=require(_0x13f8('0x2'));var rp=require('request-promise');var moment=require(_0x13f8('0x3'));var BPromise=require(_0x13f8('0x4'));var Mustache=require(_0x13f8('0x5'));var util=require(_0x13f8('0x6'));var path=require(_0x13f8('0x7'));var sox=require('sox');var csv=require(_0x13f8('0x8'));var ejs=require(_0x13f8('0x9'));var fs=require('fs');var fs_extra=require(_0x13f8('0xa'));var _=require(_0x13f8('0xb'));var squel=require(_0x13f8('0xc'));var crypto=require('crypto');var jsforce=require(_0x13f8('0xd'));var deskjs=require(_0x13f8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x13f8('0xf'));var Papa=require('papaparse');var AWS=require(_0x13f8('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x13f8('0x11'));var authService=require(_0x13f8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x13f8('0x13'));var hardwareService=require(_0x13f8('0x14'));var logger=require(_0x13f8('0x15'))(_0x13f8('0x16'));var utils=require(_0x13f8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x13f8('0x18'));var db=require(_0x13f8('0x19'))['db'];function respondWithStatusCode(_0x7fd826,_0x1c39b6){_0x1c39b6=_0x1c39b6||0xcc;return function(_0x574ff9){if(_0x574ff9){return _0x7fd826[_0x13f8('0x1a')](_0x1c39b6);}return _0x7fd826[_0x13f8('0x1b')](_0x1c39b6)[_0x13f8('0x1c')]();};}function respondWithResult(_0x42ab1c,_0x59b845){_0x59b845=_0x59b845||0xc8;return function(_0x85eec8){if(_0x85eec8){return _0x42ab1c['status'](_0x59b845)[_0x13f8('0x1d')](_0x85eec8);}};}function respondWithFilteredResult(_0x425f8e,_0x267296){return function(_0x564c25){if(_0x564c25){var _0x242a83=typeof _0x267296[_0x13f8('0x1e')]===_0x13f8('0x1f')&&typeof _0x267296[_0x13f8('0x20')]===_0x13f8('0x1f');var _0x2461ce=_0x564c25[_0x13f8('0x21')];var _0x303a47=_0x242a83?0x0:_0x267296[_0x13f8('0x1e')];var _0x5430ca=_0x242a83?_0x564c25[_0x13f8('0x21')]:_0x267296[_0x13f8('0x1e')]+_0x267296[_0x13f8('0x20')];var _0x423911;if(_0x5430ca>=_0x2461ce){_0x5430ca=_0x2461ce;_0x423911=0xc8;}else{_0x423911=0xce;}_0x425f8e[_0x13f8('0x1b')](_0x423911);return _0x425f8e['set'](_0x13f8('0x22'),_0x303a47+'-'+_0x5430ca+'/'+_0x2461ce)['json'](_0x564c25);}return null;};}function patchUpdates(_0x31fcc3){return function(_0xe5c10c){try{jsonpatch['apply'](_0xe5c10c,_0x31fcc3,!![]);}catch(_0x2adc0c){return BPromise[_0x13f8('0x23')](_0x2adc0c);}return _0xe5c10c['save']();};}function saveUpdates(_0x1b194,_0x297675){return function(_0x5f1919){if(_0x5f1919){return _0x5f1919[_0x13f8('0x24')](_0x1b194)[_0x13f8('0x25')](function(_0x23b98d){return _0x23b98d;});}return null;};}function removeEntity(_0x4ee52b,_0x1a14d9){return function(_0x54cd93){if(_0x54cd93){return _0x54cd93[_0x13f8('0x26')]()['then'](function(){_0x4ee52b['status'](0xcc)[_0x13f8('0x1c')]();});}};}function handleEntityNotFound(_0x5b1962,_0x5b1935){return function(_0x257453){if(!_0x257453){_0x5b1962[_0x13f8('0x1a')](0x194);}return _0x257453;};}function handleError(_0x381b24,_0x49a7c2){_0x49a7c2=_0x49a7c2||0x1f4;return function(_0x551a99){logger[_0x13f8('0x27')](_0x551a99['stack']);if(_0x551a99[_0x13f8('0x28')]){delete _0x551a99[_0x13f8('0x28')];}_0x381b24[_0x13f8('0x1b')](_0x49a7c2)['send'](_0x551a99);};}exports[_0x13f8('0x29')]=function(_0x1616f9,_0xe16481){var _0x36fc58={},_0x1a7e44={},_0xf8e458={'count':0x0,'rows':[]};var _0xc96b9=_[_0x13f8('0x2a')](db[_0x13f8('0x2b')][_0x13f8('0x2c')],function(_0x1ece35){return{'name':_0x1ece35[_0x13f8('0x2d')],'type':_0x1ece35[_0x13f8('0x2e')]['key']};});_0x1a7e44[_0x13f8('0x2f')]=_[_0x13f8('0x30')](_[_0x13f8('0x2a')](_0xc96b9,_0x13f8('0x28')),[_0x13f8('0x31')]);_0x1a7e44[_0x13f8('0x32')]=_[_0x13f8('0x33')](_0x1616f9['query']);_0x1a7e44[_0x13f8('0x34')]=_[_0x13f8('0x35')](_0x1a7e44[_0x13f8('0x2f')],_0x1a7e44['query']);_0x36fc58[_0x13f8('0x36')]=_[_0x13f8('0x35')](_0x1a7e44[_0x13f8('0x2f')],qs[_0x13f8('0x37')](_0x1616f9[_0x13f8('0x32')][_0x13f8('0x37')]));_0x36fc58[_0x13f8('0x36')]=_0x36fc58[_0x13f8('0x36')]['length']?_0x36fc58[_0x13f8('0x36')]:_0x1a7e44[_0x13f8('0x2f')];if(!_0x1616f9[_0x13f8('0x32')][_0x13f8('0x38')]('nolimit')){_0x36fc58[_0x13f8('0x20')]=qs[_0x13f8('0x20')](_0x1616f9['query'][_0x13f8('0x20')]);_0x36fc58[_0x13f8('0x1e')]=qs[_0x13f8('0x1e')](_0x1616f9[_0x13f8('0x32')]['offset']);}_0x36fc58[_0x13f8('0x39')]=qs[_0x13f8('0x3a')](_0x1616f9[_0x13f8('0x32')]['sort']);_0x36fc58[_0x13f8('0x3b')]=qs[_0x13f8('0x34')](_[_0x13f8('0x3c')](_0x1616f9['query'],_0x1a7e44[_0x13f8('0x34')]),_0xc96b9);if(_0x1616f9['query']['filter']){_0x36fc58[_0x13f8('0x3b')]=_['merge'](_0x36fc58['where'],{'$or':_['map'](_0xc96b9,function(_0x464a0d){if(_0x464a0d[_0x13f8('0x2e')]!==_0x13f8('0x3d')){var _0x3901b1={};_0x3901b1[_0x464a0d[_0x13f8('0x28')]]={'$like':'%'+_0x1616f9[_0x13f8('0x32')][_0x13f8('0x3e')]+'%'};return _0x3901b1;}})});}_0x36fc58=_[_0x13f8('0x3f')]({},_0x36fc58,_0x1616f9[_0x13f8('0x40')]);var _0x526f5c={'where':_0x36fc58[_0x13f8('0x3b')]};return db[_0x13f8('0x2b')]['count'](_0x526f5c)[_0x13f8('0x25')](function(_0x3b9308){_0xf8e458[_0x13f8('0x21')]=_0x3b9308;if(_0x1616f9[_0x13f8('0x32')][_0x13f8('0x41')]){_0x36fc58[_0x13f8('0x42')]=[{'all':!![]}];}return db[_0x13f8('0x2b')][_0x13f8('0x43')](_0x36fc58);})[_0x13f8('0x25')](function(_0x41954e){_0xf8e458[_0x13f8('0x44')]=_0x41954e;return _0xf8e458;})['then'](respondWithFilteredResult(_0xe16481,_0x36fc58))[_0x13f8('0x45')](handleError(_0xe16481,null));};exports[_0x13f8('0x46')]=function(_0x5f4207,_0x66e4f6){var _0x15d657={'raw':![],'where':{'id':_0x5f4207['params']['id']}},_0x501499={};_0x501499[_0x13f8('0x2f')]=_['keys'](db[_0x13f8('0x2b')][_0x13f8('0x2c')]);_0x501499[_0x13f8('0x32')]=_[_0x13f8('0x33')](_0x5f4207[_0x13f8('0x32')]);_0x501499[_0x13f8('0x34')]=_[_0x13f8('0x35')](_0x501499[_0x13f8('0x2f')],_0x501499[_0x13f8('0x32')]);_0x15d657[_0x13f8('0x36')]=_[_0x13f8('0x35')](_0x501499['model'],qs[_0x13f8('0x37')](_0x5f4207[_0x13f8('0x32')][_0x13f8('0x37')]));_0x15d657['attributes']=_0x15d657['attributes']['length']?_0x15d657['attributes']:_0x501499[_0x13f8('0x2f')];if(_0x5f4207[_0x13f8('0x32')][_0x13f8('0x41')]){_0x15d657[_0x13f8('0x42')]=[{'all':!![]}];}_0x15d657=_[_0x13f8('0x3f')]({},_0x15d657,_0x5f4207['options']);return db[_0x13f8('0x2b')]['find'](_0x15d657)['then'](handleEntityNotFound(_0x66e4f6,null))[_0x13f8('0x25')](respondWithResult(_0x66e4f6,null))[_0x13f8('0x45')](handleError(_0x66e4f6,null));};exports[_0x13f8('0x47')]=function(_0x380efa,_0x26a617){return db[_0x13f8('0x2b')][_0x13f8('0x47')](_0x380efa['body'],{})[_0x13f8('0x25')](respondWithResult(_0x26a617,0xc9))['catch'](handleError(_0x26a617,null));};exports[_0x13f8('0x24')]=function(_0x2c8189,_0x59f4aa){if(_0x2c8189[_0x13f8('0x48')]['id']){delete _0x2c8189[_0x13f8('0x48')]['id'];}return db[_0x13f8('0x2b')][_0x13f8('0x49')]({'where':{'id':_0x2c8189[_0x13f8('0x4a')]['id']}})[_0x13f8('0x25')](handleEntityNotFound(_0x59f4aa,null))[_0x13f8('0x25')](saveUpdates(_0x2c8189[_0x13f8('0x48')],null))['then'](respondWithResult(_0x59f4aa,null))[_0x13f8('0x45')](handleError(_0x59f4aa,null));};exports[_0x13f8('0x4b')]=function(_0x349c69,_0x34fd7d){return db['VoiceRecording'][_0x13f8('0x4b')]()[_0x13f8('0x25')](respondWithResult(_0x34fd7d,null))['catch'](handleError(_0x34fd7d,null));};exports[_0x13f8('0x4c')]=function(_0x2e4646,_0x5aad9b,_0x7205f7){var _0x5be62f=require(_0x13f8('0x4d'));var _0x18aeab=![];var _0x4818d4={};if(_0x2e4646[_0x13f8('0x32')]['type']&&_0x2e4646[_0x13f8('0x32')]['type']==='uniqueid'){_0x4818d4['uniqueid']=_0x2e4646[_0x13f8('0x4a')]['id'];}else{_0x4818d4['id']=_0x2e4646[_0x13f8('0x4a')]['id'];}return db[_0x13f8('0x2b')][_0x13f8('0x49')]({'where':_0x4818d4,'attributes':['id',_0x13f8('0x4e')],'raw':!![]})[_0x13f8('0x25')](handleEntityNotFound(_0x5aad9b,null))[_0x13f8('0x25')](function(_0x4ed4b3){if(_0x4ed4b3){var _0x47cb4e=_0x4ed4b3[_0x13f8('0x4e')];var _0x3de7d9=util[_0x13f8('0x31')](_0x13f8('0x4f'),_0x47cb4e);if(fs[_0x13f8('0x50')](_0x3de7d9)){_0x18aeab=!![];return _0x5be62f[_0x13f8('0x51')](_0x3de7d9,_0x47cb4e,config[_0x13f8('0x52')][_0x13f8('0x53')])['then'](function(){return _0x4ed4b3;});}return _0x4ed4b3;}})[_0x13f8('0x25')](function(_0x58a8ff){if(_0x58a8ff){var _0x3bf231=_0x58a8ff['value'];if(!fs['existsSync'](_0x3bf231)){throw new db['Sequelize'][(_0x13f8('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x58a8ff[_0x13f8('0x55')]){return _0x5aad9b[_0x13f8('0x4c')](_0x3bf231,_0x58a8ff['filename']+path[_0x13f8('0x56')](_0x3bf231),function(){if(_0x18aeab){fs[_0x13f8('0x57')](_0x3bf231);}});}else{return _0x5aad9b['download'](_0x3bf231,function(_0x59f1f8){if(_0x18aeab){fs['unlink'](_0x3bf231);}});}}})['catch'](function(_0x1214df){if(_0x1214df[_0x13f8('0x58')]===_0x13f8('0x59')){_0x5aad9b['status'](0x194)[_0x13f8('0x5a')](_0x13f8('0x5b'));}else{return handleError(_0x5aad9b,null);}});};exports[_0x13f8('0x5c')]=function(_0xae1d4e,_0x197892,_0x4303c6){var _0x2b3261=require('../../components/encryptor');var _0x4a5b02=![];var _0x5876eb={'$and':[db[_0x13f8('0x5d')][_0x13f8('0x3b')](db[_0x13f8('0x5d')]['fn'](_0x13f8('0x5e'),db[_0x13f8('0x5d')][_0x13f8('0x5f')](_0x13f8('0x60'))),_0xae1d4e['query']['token'])]};if(_0xae1d4e[_0x13f8('0x32')][_0x13f8('0x2e')]&&_0xae1d4e[_0x13f8('0x32')][_0x13f8('0x2e')]===_0x13f8('0x60')){_0x5876eb[_0x13f8('0x61')][_0x13f8('0x62')]({'uniqueid':_0xae1d4e['params']['id']});}else{_0x5876eb[_0x13f8('0x61')]['push']({'id':_0xae1d4e[_0x13f8('0x4a')]['id']});}return db[_0x13f8('0x2b')][_0x13f8('0x49')]({'where':_0x5876eb,'attributes':['id',_0x13f8('0x4e')],'raw':!![]})[_0x13f8('0x25')](handleEntityNotFound(_0x197892,null))[_0x13f8('0x25')](function(_0x1f0ac6){if(_0x1f0ac6){var _0x20c22e=util[_0x13f8('0x31')](_0x13f8('0x4f'),_0x1f0ac6[_0x13f8('0x4e')]);if(fs[_0x13f8('0x50')](_0x20c22e)){_0x4a5b02=!![];return _0x2b3261[_0x13f8('0x51')](_0x20c22e,_0x1f0ac6[_0x13f8('0x4e')],config[_0x13f8('0x52')]['recording'])['then'](function(){return _0x1f0ac6;});}return _0x1f0ac6;}})[_0x13f8('0x25')](function(_0x1c03f3){if(_0x1c03f3){if(!fs['existsSync'](_0x1c03f3[_0x13f8('0x4e')])){throw new db['Sequelize']['ValidationError'](_0x13f8('0x59'));}if(_0x1c03f3[_0x13f8('0x55')]){return _0x197892[_0x13f8('0x4c')](_0x1c03f3[_0x13f8('0x4e')],_0x1c03f3[_0x13f8('0x55')]+path['extname'](_0x1c03f3[_0x13f8('0x4e')]),function(){if(_0x4a5b02){fs[_0x13f8('0x57')](_0x1c03f3[_0x13f8('0x4e')]);}});}else{return _0x197892[_0x13f8('0x4c')](_0x1c03f3[_0x13f8('0x4e')],function(_0x21a444){if(_0x4a5b02){fs[_0x13f8('0x57')](_0x1c03f3[_0x13f8('0x4e')]);}});}}})[_0x13f8('0x45')](handleError(_0x197892,null));};exports[_0x13f8('0x26')]=function(_0x38da56,_0x2b66c7){return db[_0x13f8('0x2b')][_0x13f8('0x49')]({'where':{'id':_0x38da56['params']['id']}})[_0x13f8('0x25')](function(_0x9bdd31){if(_[_0x13f8('0x63')](_0x9bdd31)){throw new ReferenceError('Entity\x20not\x20found');}return _0x9bdd31;})['then'](function(_0x3b6bca){var _0x244a04=_0x3b6bca[_0x13f8('0x4e')];logger[_0x13f8('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x244a04);if(!_[_0x13f8('0x63')](_0x3b6bca['value'])&&fs[_0x13f8('0x50')](_0x244a04)){logger[_0x13f8('0x64')](_0x13f8('0x65')+_0x244a04+_0x13f8('0x66'));fs['unlinkSync'](_0x244a04);}_0x244a04=_0x244a04+_0x13f8('0x67');if(!_[_0x13f8('0x63')](_0x3b6bca[_0x13f8('0x4e')])&&fs['existsSync'](_0x244a04)){logger[_0x13f8('0x64')](_0x13f8('0x65')+_0x244a04+_0x13f8('0x66'));fs[_0x13f8('0x68')](_0x244a04);}return _0x3b6bca;})['then'](function(_0x166cd1){if(!_0x166cd1)throw new InternalError();return _0x166cd1[_0x13f8('0x26')]();})['then'](function(){_0x2b66c7[_0x13f8('0x1b')](0xcc)[_0x13f8('0x1c')]();})[_0x13f8('0x45')](handleError(_0x2b66c7,null));};function getBucketslist(_0xa44fc8,_0x151cec,_0x1007e4){return new Promise(function(_0x5a0071,_0x1f6da1){var _0x3fb5e4=new AWS['S3']({'accessKeyId':_0x151cec,'secretAccessKey':_0xa44fc8,'region':_0x1007e4});_0x3fb5e4[_0x13f8('0x69')]({},function(_0x29cca3,_0x52cb34){if(_0x29cca3){return _0x1f6da1(_0x29cca3);}else{return _0x5a0071(_0x52cb34);}});});}function createBucket(_0x45bb94,_0x2b65d0,_0xca7819,_0x1c6dd4){return new Promise(function(_0x268a19,_0x5023b0){var _0x519a2c=new AWS['S3']({'accessKeyId':_0x2b65d0,'secretAccessKey':_0x45bb94,'region':_0xca7819});_0x519a2c['createBucket']({'Bucket':_0x1c6dd4},function(_0x4e900c,_0x51fe4b){if(_0x4e900c){return _0x5023b0(_0x4e900c);}else{return _0x268a19(_0x51fe4b);}});});}function uploadFile(_0x56a97f,_0x52ed7a,_0x184608,_0x20406c,_0x4e9160,_0x92963){return new Promise(function(_0x11da7a,_0x1d90e1){var _0x2c0820=new AWS['S3']({'accessKeyId':_0x52ed7a,'secretAccessKey':_0x56a97f,'region':_0x184608});_0x2c0820[_0x13f8('0x6a')]({'Bucket':_0x20406c,'Key':_0x4e9160,'Body':_0x92963},function(_0x498df2,_0x19de05){if(_0x498df2){return _0x1d90e1(_0x498df2);}else{return _0x11da7a(_0x19de05);}});});}function startTranscribe(_0x3f227a,_0x261f5f,_0x523eac,_0xceb377,_0x44c11f,_0x5a0e6){return new Promise(function(_0xc7c468,_0x27c32c){var _0x9f1aad=new AWS[(_0x13f8('0x6b'))]({'accessKeyId':_0x261f5f,'secretAccessKey':_0x3f227a,'region':_0x523eac});_0x9f1aad[_0x13f8('0x6c')]({'TranscriptionJobName':_0xceb377,'LanguageCode':_0x44c11f,'Media':{'MediaFileUri':_0x5a0e6}},function(_0x153859,_0xe4e21){if(_0x153859){return _0x27c32c(_0x153859);}else{return _0xc7c468(_0xe4e21);}});});}function transcribe(_0x13560b,_0x323267,_0x1d4d2b,_0xb95c30,_0x547d6e,_0x53c56e,_0x5a7672){return new Promise(function(_0x54350b,_0x1c956c){var _0xfa17c7={};logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x6d'),_0x13560b,_0x547d6e));return uploadFile(_0x323267,_0x1d4d2b,_0xb95c30,_0x547d6e,path[_0x13f8('0x6e')](_0x53c56e),fs[_0x13f8('0x6f')](_0x53c56e))[_0x13f8('0x25')](function(_0x208b14){logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x70'),_0x13560b,_0x547d6e,_0x208b14[_0x13f8('0x71')]));_0xfa17c7['bucket']=_0x208b14[_0x13f8('0x72')];_0xfa17c7[_0x13f8('0x73')]=_0x208b14['Location'];logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x74'),_0x13560b));return startTranscribe(_0x323267,_0x1d4d2b,_0xb95c30,uuidv4(),_0x5a7672,_0x208b14[_0x13f8('0x71')]);})['then'](function(_0x4595bf){logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x75'),_0x13560b,_0x4595bf['TranscriptionJob'][_0x13f8('0x76')]));_0xfa17c7[_0x13f8('0x77')]=_0x4595bf[_0x13f8('0x78')][_0x13f8('0x76')];_0xfa17c7[_0x13f8('0x79')]=_0x4595bf[_0x13f8('0x78')][_0x13f8('0x7a')];return _0x54350b(_0xfa17c7);})[_0x13f8('0x45')](function(_0x1208db){return _0x1c956c(_0x1208db);});});}exports[_0x13f8('0x7b')]=function(_0x573ebf,_0x3e52f4,_0x4b106a){var _0x45d5fa;var _0x5a0baf;var _0x5ea45e;var _0x22eacd=require(_0x13f8('0x4d'));return db[_0x13f8('0x2b')][_0x13f8('0x7c')]({'where':{'id':_0x573ebf[_0x13f8('0x4a')]['id']}})['then'](function(_0x30ab79){if(_0x30ab79){var _0x51d45b=util[_0x13f8('0x31')]('%s.cypher',_0x30ab79['value']);if(fs[_0x13f8('0x50')](_0x51d45b)){cypher=!![];return _0x22eacd['decryptFile'](_0x51d45b,_0x30ab79[_0x13f8('0x4e')],config['secrets'][_0x13f8('0x53')])[_0x13f8('0x25')](function(){return _0x30ab79;});}return _0x30ab79;}})[_0x13f8('0x25')](function(_0x2a4787){if(!_0x2a4787){throw new db[(_0x13f8('0x7d'))][(_0x13f8('0x54'))](_0x13f8('0x7e'));}_0x5a0baf=_0x2a4787;return db[_0x13f8('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x13f8('0x25')](handleEntityNotFound(_0x3e52f4,null))[_0x13f8('0x25')](function(_0xd885fc){if(_0xd885fc){_0x45d5fa=_0xd885fc;if(!_0x45d5fa['transcribe']||!_0x45d5fa['transcribeAccountId']||!_0x45d5fa[_0x13f8('0x80')]||!_0x45d5fa['language']||!_0x45d5fa[_0x13f8('0x81')]){throw new db[(_0x13f8('0x7d'))][(_0x13f8('0x54'))](_0x13f8('0x82'));}if(_0x573ebf[_0x13f8('0x48')]['runSentiment']&&(!_0x45d5fa['sentiment']||!_0x45d5fa[_0x13f8('0x83')]||!_0x45d5fa['sentimentRegion']||!_0x45d5fa[_0x13f8('0x84')]||!_0x45d5fa['bucket'])){throw new db['Sequelize'][(_0x13f8('0x54'))](_0x13f8('0x85'));}return db[_0x13f8('0x86')][_0x13f8('0x7c')]({'where':{'id':_0x45d5fa[_0x13f8('0x87')]}});}})[_0x13f8('0x25')](function(_0x321ffc){if(!_0x321ffc){throw new db[(_0x13f8('0x7d'))][(_0x13f8('0x54'))](_0x13f8('0x88'));}if(!_0x321ffc['data1']||!_0x321ffc[_0x13f8('0x89')]){throw new db[(_0x13f8('0x7d'))][(_0x13f8('0x54'))](_0x13f8('0x8a'));}_0x5ea45e=_0x321ffc;return getBucketslist(_0x5ea45e['data1'],_0x5ea45e[_0x13f8('0x89')],_0x45d5fa[_0x13f8('0x80')]);})[_0x13f8('0x25')](function(_0x7853ba){if(_0x7853ba&&_0x7853ba['Buckets']){var _0x46cd38=_[_0x13f8('0x49')](_0x7853ba[_0x13f8('0x8b')],function(_0xb708dd){return _0xb708dd[_0x13f8('0x8c')]===_0x45d5fa['bucket'];});if(!_0x46cd38){logger[_0x13f8('0x64')](util['format'](_0x13f8('0x8d'),_0x573ebf[_0x13f8('0x4a')]['id'],_0x45d5fa[_0x13f8('0x81')]));return createBucket(_0x5ea45e[_0x13f8('0x8e')],_0x5ea45e[_0x13f8('0x89')],_0x45d5fa[_0x13f8('0x80')],_0x45d5fa['bucket']);}logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x8f'),_0x573ebf[_0x13f8('0x4a')]['id'],_0x45d5fa['bucket']));return;}})[_0x13f8('0x25')](function(_0x47b6e9){if(_0x5a0baf[_0x13f8('0x79')]===_0x13f8('0x90')){return transcribe(_0x573ebf[_0x13f8('0x4a')]['id'],_0x5ea45e['data1'],_0x5ea45e[_0x13f8('0x89')],_0x45d5fa[_0x13f8('0x80')],_0x45d5fa[_0x13f8('0x81')],_0x5a0baf[_0x13f8('0x4e')],_0x45d5fa[_0x13f8('0x84')]);}else{logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x91'),_0x573ebf[_0x13f8('0x4a')]['id']));return{'transcribeStatus':_0x13f8('0x92')};}})['then'](function(_0x3b6fe4){if(_0x3b6fe4){_0x3b6fe4[_0x13f8('0x93')]=_0x573ebf[_0x13f8('0x48')]['runSentiment'];return _0x5a0baf[_0x13f8('0x94')](_0x3b6fe4);}})[_0x13f8('0x25')](respondWithResult(_0x3e52f4,null))['catch'](handleError(_0x3e52f4,null));};function writeFile(_0x42d0e7,_0x2a6525){return new Promise(function(_0x41f924,_0x341087){fs[_0x13f8('0x95')](_0x2a6525,_0x42d0e7,function(_0x46d403,_0x40e05a){if(_0x46d403){return _0x341087(_0x46d403);}else{return _0x41f924(_0x40e05a);}});});}exports[_0x13f8('0x96')]=function(_0x5ba60e,_0x14d892,_0x4c6cbe){return db[_0x13f8('0x2b')][_0x13f8('0x7c')]({'where':{'id':_0x5ba60e['params']['id']}})[_0x13f8('0x25')](handleEntityNotFound(_0x14d892))[_0x13f8('0x25')](function(_0x219d9d){if(_0x219d9d&&_0x219d9d[_0x13f8('0x97')]){var _0x20f32f=_0x219d9d[_0x13f8('0x97')];var _0xb4a635=config[_0x13f8('0x98')]+'/server/files/transcribes/transcribe_'+_0x219d9d['id']+_0x13f8('0x99');if(fs['existsSync'](_0xb4a635)){return _0xb4a635;}return writeFile(_0x20f32f,_0xb4a635)[_0x13f8('0x25')](function(){return _0xb4a635;});}else{throw new db[(_0x13f8('0x7d'))][(_0x13f8('0x54'))](_0x13f8('0x9a'));}})['then'](function(_0x247b18){return _0x14d892['download'](_0x247b18);})[_0x13f8('0x45')](handleError(_0x14d892));}; \ No newline at end of file +var _0x0266=['pick','filter','merge','options','include','findAll','show','params','includeAll','VoiceRecording','find','catch','create','body','download','../../components/encryptor','value','%s.cypher','decryptFile','recording','existsSync','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','uniqueid','$and','push','secrets','Sequelize','ValidationError','extname','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','stack','name','send','map','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x19d1b1,_0x4ac380){var _0x5a8011=function(_0x5ca77a){while(--_0x5ca77a){_0x19d1b1['push'](_0x19d1b1['shift']());}};_0x5a8011(++_0x4ac380);}(_0x0266,0x190));var _0x6026=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x0266[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6026('0x0'));var rp=require(_0x6026('0x1'));var moment=require('moment');var BPromise=require(_0x6026('0x2'));var Mustache=require(_0x6026('0x3'));var util=require(_0x6026('0x4'));var path=require(_0x6026('0x5'));var sox=require('sox');var csv=require(_0x6026('0x6'));var ejs=require(_0x6026('0x7'));var fs=require('fs');var fs_extra=require(_0x6026('0x8'));var _=require(_0x6026('0x9'));var squel=require(_0x6026('0xa'));var crypto=require(_0x6026('0xb'));var jsforce=require(_0x6026('0xc'));var deskjs=require(_0x6026('0xd'));var toCsv=require(_0x6026('0x6'));var querystring=require('querystring');var Papa=require(_0x6026('0xe'));var AWS=require(_0x6026('0xf'));var uuidv4=require(_0x6026('0x10'));var Redis=require('ioredis');var authService=require(_0x6026('0x11'));var qs=require(_0x6026('0x12'));var as=require(_0x6026('0x13'));var hardwareService=require(_0x6026('0x14'));var logger=require(_0x6026('0x15'))(_0x6026('0x16'));var utils=require(_0x6026('0x17'));var config=require(_0x6026('0x18'));var licenseUtil=require(_0x6026('0x19'));var db=require(_0x6026('0x1a'))['db'];function respondWithStatusCode(_0x1b64f1,_0x3901a8){_0x3901a8=_0x3901a8||0xcc;return function(_0x45380a){if(_0x45380a){return _0x1b64f1[_0x6026('0x1b')](_0x3901a8);}return _0x1b64f1['status'](_0x3901a8)[_0x6026('0x1c')]();};}function respondWithResult(_0x5ad7ae,_0x13c8d7){_0x13c8d7=_0x13c8d7||0xc8;return function(_0x44424a){if(_0x44424a){return _0x5ad7ae[_0x6026('0x1d')](_0x13c8d7)[_0x6026('0x1e')](_0x44424a);}};}function respondWithFilteredResult(_0x2433ee,_0x3cc9b4){return function(_0x349273){if(_0x349273){var _0x375bb1=typeof _0x3cc9b4[_0x6026('0x1f')]==='undefined'&&typeof _0x3cc9b4[_0x6026('0x20')]===_0x6026('0x21');var _0x1d1885=_0x349273[_0x6026('0x22')];var _0xc00d56=_0x375bb1?0x0:_0x3cc9b4[_0x6026('0x1f')];var _0x2628d2=_0x375bb1?_0x349273[_0x6026('0x22')]:_0x3cc9b4[_0x6026('0x1f')]+_0x3cc9b4[_0x6026('0x20')];var _0x2a8e2d;if(_0x2628d2>=_0x1d1885){_0x2628d2=_0x1d1885;_0x2a8e2d=0xc8;}else{_0x2a8e2d=0xce;}_0x2433ee['status'](_0x2a8e2d);return _0x2433ee[_0x6026('0x23')]('Content-Range',_0xc00d56+'-'+_0x2628d2+'/'+_0x1d1885)[_0x6026('0x1e')](_0x349273);}return null;};}function patchUpdates(_0x40d991){return function(_0x32d378){try{jsonpatch[_0x6026('0x24')](_0x32d378,_0x40d991,!![]);}catch(_0x263899){return BPromise[_0x6026('0x25')](_0x263899);}return _0x32d378[_0x6026('0x26')]();};}function saveUpdates(_0x263647,_0x4d1afb){return function(_0x40fa27){if(_0x40fa27){return _0x40fa27['update'](_0x263647)[_0x6026('0x27')](function(_0x148240){return _0x148240;});}return null;};}function removeEntity(_0x1c4a3a,_0x347cf6){return function(_0x1797fa){if(_0x1797fa){return _0x1797fa[_0x6026('0x28')]()[_0x6026('0x27')](function(){_0x1c4a3a[_0x6026('0x1d')](0xcc)[_0x6026('0x1c')]();});}};}function handleEntityNotFound(_0x1cb261,_0x207bbc){return function(_0x36dd9a){if(!_0x36dd9a){_0x1cb261['sendStatus'](0x194);}return _0x36dd9a;};}function handleError(_0x59fdb5,_0x406c94){_0x406c94=_0x406c94||0x1f4;return function(_0x486f7a){logger['error'](_0x486f7a[_0x6026('0x29')]);if(_0x486f7a[_0x6026('0x2a')]){delete _0x486f7a[_0x6026('0x2a')];}_0x59fdb5[_0x6026('0x1d')](_0x406c94)[_0x6026('0x2b')](_0x486f7a);};}exports['index']=function(_0xa7ba39,_0x56bbb1){var _0x214ef5={},_0x33881a={},_0xb5b347={'count':0x0,'rows':[]};var _0x2edabf=_[_0x6026('0x2c')](db['VoiceRecording']['rawAttributes'],function(_0x13e7a9){return{'name':_0x13e7a9[_0x6026('0x2d')],'type':_0x13e7a9[_0x6026('0x2e')][_0x6026('0x2f')]};});_0x33881a[_0x6026('0x30')]=_['differenceBy'](_['map'](_0x2edabf,_0x6026('0x2a')),[_0x6026('0x31')]);_0x33881a[_0x6026('0x32')]=_[_0x6026('0x33')](_0xa7ba39[_0x6026('0x32')]);_0x33881a[_0x6026('0x34')]=_[_0x6026('0x35')](_0x33881a['model'],_0x33881a[_0x6026('0x32')]);_0x214ef5[_0x6026('0x36')]=_['intersection'](_0x33881a['model'],qs[_0x6026('0x37')](_0xa7ba39[_0x6026('0x32')][_0x6026('0x37')]));_0x214ef5[_0x6026('0x36')]=_0x214ef5['attributes'][_0x6026('0x38')]?_0x214ef5[_0x6026('0x36')]:_0x33881a[_0x6026('0x30')];if(!_0xa7ba39['query'][_0x6026('0x39')](_0x6026('0x3a'))){_0x214ef5[_0x6026('0x20')]=qs['limit'](_0xa7ba39[_0x6026('0x32')][_0x6026('0x20')]);_0x214ef5['offset']=qs[_0x6026('0x1f')](_0xa7ba39[_0x6026('0x32')][_0x6026('0x1f')]);}_0x214ef5[_0x6026('0x3b')]=qs[_0x6026('0x3c')](_0xa7ba39[_0x6026('0x32')][_0x6026('0x3c')]);_0x214ef5[_0x6026('0x3d')]=qs[_0x6026('0x34')](_[_0x6026('0x3e')](_0xa7ba39['query'],_0x33881a[_0x6026('0x34')]),_0x2edabf);if(_0xa7ba39[_0x6026('0x32')][_0x6026('0x3f')]){_0x214ef5[_0x6026('0x3d')]=_[_0x6026('0x40')](_0x214ef5[_0x6026('0x3d')],{'$or':_[_0x6026('0x2c')](_0x2edabf,function(_0x41c561){if(_0x41c561['type']!=='VIRTUAL'){var _0x2fbec4={};_0x2fbec4[_0x41c561['name']]={'$like':'%'+_0xa7ba39['query'][_0x6026('0x3f')]+'%'};return _0x2fbec4;}})});}_0x214ef5=_[_0x6026('0x40')]({},_0x214ef5,_0xa7ba39[_0x6026('0x41')]);var _0x3f08a4={'where':_0x214ef5[_0x6026('0x3d')]};return db['VoiceRecording'][_0x6026('0x22')](_0x3f08a4)[_0x6026('0x27')](function(_0x4249d4){_0xb5b347['count']=_0x4249d4;if(_0xa7ba39[_0x6026('0x32')]['includeAll']){_0x214ef5[_0x6026('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0x6026('0x43')](_0x214ef5);})['then'](function(_0x12ae45){_0xb5b347['rows']=_0x12ae45;return _0xb5b347;})[_0x6026('0x27')](respondWithFilteredResult(_0x56bbb1,_0x214ef5))['catch'](handleError(_0x56bbb1,null));};exports[_0x6026('0x44')]=function(_0x17ef0d,_0x4367f9){var _0x377e69={'raw':![],'where':{'id':_0x17ef0d[_0x6026('0x45')]['id']}},_0x3f4da7={};_0x3f4da7[_0x6026('0x30')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x3f4da7[_0x6026('0x32')]=_['keys'](_0x17ef0d[_0x6026('0x32')]);_0x3f4da7['filters']=_[_0x6026('0x35')](_0x3f4da7['model'],_0x3f4da7[_0x6026('0x32')]);_0x377e69[_0x6026('0x36')]=_[_0x6026('0x35')](_0x3f4da7['model'],qs[_0x6026('0x37')](_0x17ef0d[_0x6026('0x32')][_0x6026('0x37')]));_0x377e69[_0x6026('0x36')]=_0x377e69['attributes']['length']?_0x377e69['attributes']:_0x3f4da7[_0x6026('0x30')];if(_0x17ef0d[_0x6026('0x32')][_0x6026('0x46')]){_0x377e69[_0x6026('0x42')]=[{'all':!![]}];}_0x377e69=_[_0x6026('0x40')]({},_0x377e69,_0x17ef0d['options']);return db[_0x6026('0x47')][_0x6026('0x48')](_0x377e69)['then'](handleEntityNotFound(_0x4367f9,null))[_0x6026('0x27')](respondWithResult(_0x4367f9,null))[_0x6026('0x49')](handleError(_0x4367f9,null));};exports[_0x6026('0x4a')]=function(_0xc6a388,_0x4258d7){return db['VoiceRecording'][_0x6026('0x4a')](_0xc6a388[_0x6026('0x4b')],{})[_0x6026('0x27')](respondWithResult(_0x4258d7,0xc9))[_0x6026('0x49')](handleError(_0x4258d7,null));};exports['update']=function(_0x163ac1,_0x4ec93e){if(_0x163ac1[_0x6026('0x4b')]['id']){delete _0x163ac1[_0x6026('0x4b')]['id'];}return db[_0x6026('0x47')][_0x6026('0x48')]({'where':{'id':_0x163ac1[_0x6026('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ec93e,null))[_0x6026('0x27')](saveUpdates(_0x163ac1[_0x6026('0x4b')],null))[_0x6026('0x27')](respondWithResult(_0x4ec93e,null))[_0x6026('0x49')](handleError(_0x4ec93e,null));};exports['describe']=function(_0x25be4c,_0x20156b){return db['VoiceRecording']['describe']()[_0x6026('0x27')](respondWithResult(_0x20156b,null))[_0x6026('0x49')](handleError(_0x20156b,null));};exports[_0x6026('0x4c')]=function(_0x222978,_0x451931,_0x39dff2){var _0x38cc6d=require(_0x6026('0x4d'));var _0x1c87bc=![];var _0x2a7249={};if(_0x222978[_0x6026('0x32')]['type']&&_0x222978[_0x6026('0x32')]['type']==='uniqueid'){_0x2a7249['uniqueid']=_0x222978['params']['id'];}else{_0x2a7249['id']=_0x222978['params']['id'];}return db[_0x6026('0x47')][_0x6026('0x48')]({'where':_0x2a7249,'attributes':['id',_0x6026('0x4e')],'raw':!![]})[_0x6026('0x27')](handleEntityNotFound(_0x451931,null))['then'](function(_0x2d90b0){if(_0x2d90b0){var _0x2980b4=_0x2d90b0[_0x6026('0x4e')];var _0x15af4c=util['format'](_0x6026('0x4f'),_0x2980b4);if(fs['existsSync'](_0x15af4c)){_0x1c87bc=!![];return _0x38cc6d[_0x6026('0x50')](_0x15af4c,_0x2980b4,config['secrets'][_0x6026('0x51')])[_0x6026('0x27')](function(){return _0x2d90b0;});}return _0x2d90b0;}})['then'](function(_0x2672ac){if(_0x2672ac){var _0x564e6b=_0x2672ac[_0x6026('0x4e')];if(!fs[_0x6026('0x52')](_0x564e6b)){throw new db['Sequelize']['ValidationError'](_0x6026('0x53'));}if(_0x2672ac[_0x6026('0x54')]){return _0x451931[_0x6026('0x4c')](_0x564e6b,_0x2672ac['filename']+path['extname'](_0x564e6b),function(){if(_0x1c87bc){fs[_0x6026('0x55')](_0x564e6b);}});}else{return _0x451931['download'](_0x564e6b,function(_0x538e2c){if(_0x1c87bc){fs[_0x6026('0x55')](_0x564e6b);}});}}})['catch'](function(_0x3bb44d){if(_0x3bb44d[_0x6026('0x56')]===_0x6026('0x53')){_0x451931[_0x6026('0x1d')](0x194)[_0x6026('0x2b')](_0x6026('0x57'));}else{return handleError(_0x451931,null);}});};exports[_0x6026('0x58')]=function(_0x3c6d2b,_0x1a74c3,_0x4c6563){var _0x2bc477=require(_0x6026('0x4d'));var _0x2c15fd=![];var _0xb51bff={'$and':[db[_0x6026('0x59')][_0x6026('0x3d')](db[_0x6026('0x59')]['fn'](_0x6026('0x5a'),db[_0x6026('0x59')][_0x6026('0x5b')](_0x6026('0x5c'))),_0x3c6d2b[_0x6026('0x32')]['token'])]};if(_0x3c6d2b[_0x6026('0x32')][_0x6026('0x2e')]&&_0x3c6d2b[_0x6026('0x32')][_0x6026('0x2e')]===_0x6026('0x5c')){_0xb51bff[_0x6026('0x5d')][_0x6026('0x5e')]({'uniqueid':_0x3c6d2b[_0x6026('0x45')]['id']});}else{_0xb51bff['$and'][_0x6026('0x5e')]({'id':_0x3c6d2b[_0x6026('0x45')]['id']});}return db[_0x6026('0x47')][_0x6026('0x48')]({'where':_0xb51bff,'attributes':['id',_0x6026('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x1a74c3,null))['then'](function(_0x1f54e7){if(_0x1f54e7){var _0x16d9d1=util['format'](_0x6026('0x4f'),_0x1f54e7[_0x6026('0x4e')]);if(fs[_0x6026('0x52')](_0x16d9d1)){_0x2c15fd=!![];return _0x2bc477[_0x6026('0x50')](_0x16d9d1,_0x1f54e7['value'],config[_0x6026('0x5f')][_0x6026('0x51')])[_0x6026('0x27')](function(){return _0x1f54e7;});}return _0x1f54e7;}})[_0x6026('0x27')](function(_0x3e4de2){if(_0x3e4de2){if(!fs['existsSync'](_0x3e4de2[_0x6026('0x4e')])){throw new db[(_0x6026('0x60'))][(_0x6026('0x61'))](_0x6026('0x53'));}if(_0x3e4de2[_0x6026('0x54')]){return _0x1a74c3['download'](_0x3e4de2[_0x6026('0x4e')],_0x3e4de2[_0x6026('0x54')]+path[_0x6026('0x62')](_0x3e4de2[_0x6026('0x4e')]),function(){if(_0x2c15fd){fs['unlink'](_0x3e4de2[_0x6026('0x4e')]);}});}else{return _0x1a74c3[_0x6026('0x4c')](_0x3e4de2[_0x6026('0x4e')],function(_0x550c36){if(_0x2c15fd){fs['unlink'](_0x3e4de2[_0x6026('0x4e')]);}});}}})[_0x6026('0x49')](handleError(_0x1a74c3,null));};exports[_0x6026('0x28')]=function(_0x556d63,_0x1ce7a0){return db[_0x6026('0x47')]['find']({'where':{'id':_0x556d63[_0x6026('0x45')]['id']}})[_0x6026('0x27')](function(_0x2dcc8c){if(_[_0x6026('0x63')](_0x2dcc8c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2dcc8c;})['then'](function(_0x5bb556){var _0x3a3550=_0x5bb556[_0x6026('0x4e')];logger[_0x6026('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x3a3550);if(!_[_0x6026('0x63')](_0x5bb556['value'])&&fs[_0x6026('0x52')](_0x3a3550)){logger['info'](_0x6026('0x65')+_0x3a3550+_0x6026('0x66'));fs[_0x6026('0x67')](_0x3a3550);}_0x3a3550=_0x3a3550+_0x6026('0x68');if(!_[_0x6026('0x63')](_0x5bb556[_0x6026('0x4e')])&&fs[_0x6026('0x52')](_0x3a3550)){logger[_0x6026('0x64')](_0x6026('0x65')+_0x3a3550+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6026('0x67')](_0x3a3550);}return _0x5bb556;})[_0x6026('0x27')](function(_0x33c5df){if(!_0x33c5df)throw new InternalError();return _0x33c5df[_0x6026('0x28')]();})['then'](function(){_0x1ce7a0[_0x6026('0x1d')](0xcc)[_0x6026('0x1c')]();})[_0x6026('0x49')](handleError(_0x1ce7a0,null));};function getBucketslist(_0x17eb6c,_0x3d2b1c,_0x1de2e9){return new Promise(function(_0x1b95c6,_0x5e446f){var _0x2ce853=new AWS['S3']({'accessKeyId':_0x3d2b1c,'secretAccessKey':_0x17eb6c,'region':_0x1de2e9});_0x2ce853[_0x6026('0x69')]({},function(_0x2f53ca,_0x185776){if(_0x2f53ca){return _0x5e446f(_0x2f53ca);}else{return _0x1b95c6(_0x185776);}});});}function createBucket(_0x10853a,_0x35b597,_0x1f1dfc,_0x444398){return new Promise(function(_0x372e0d,_0xcad6fd){var _0x5d4cf7=new AWS['S3']({'accessKeyId':_0x35b597,'secretAccessKey':_0x10853a,'region':_0x1f1dfc});_0x5d4cf7['createBucket']({'Bucket':_0x444398},function(_0x54f13c,_0x2fcd00){if(_0x54f13c){return _0xcad6fd(_0x54f13c);}else{return _0x372e0d(_0x2fcd00);}});});}function uploadFile(_0x532a10,_0x4c41e3,_0x3d6a23,_0x2681cb,_0x4823f9,_0x2fa561){return new Promise(function(_0x559f27,_0x2954a4){var _0x2790cd=new AWS['S3']({'accessKeyId':_0x4c41e3,'secretAccessKey':_0x532a10,'region':_0x3d6a23});_0x2790cd[_0x6026('0x6a')]({'Bucket':_0x2681cb,'Key':_0x4823f9,'Body':_0x2fa561},function(_0x2930b5,_0x297d97){if(_0x2930b5){return _0x2954a4(_0x2930b5);}else{return _0x559f27(_0x297d97);}});});}function startTranscribe(_0x1f60b7,_0xe125c8,_0x34087e,_0x34ad0e,_0x13c6d1,_0x11ff99){return new Promise(function(_0xd836d,_0x22549c){var _0x134758=new AWS[(_0x6026('0x6b'))]({'accessKeyId':_0xe125c8,'secretAccessKey':_0x1f60b7,'region':_0x34087e});_0x134758[_0x6026('0x6c')]({'TranscriptionJobName':_0x34ad0e,'LanguageCode':_0x13c6d1,'Media':{'MediaFileUri':_0x11ff99}},function(_0x491711,_0x272ca2){if(_0x491711){return _0x22549c(_0x491711);}else{return _0xd836d(_0x272ca2);}});});}function transcribe(_0xa56b36,_0x153d17,_0x48a3c7,_0x47d2a4,_0x338622,_0x4cda40,_0x51e784){return new Promise(function(_0x1b8e5e,_0x1070dd){var _0x33fdb1={};logger[_0x6026('0x64')](util['format'](_0x6026('0x6d'),_0xa56b36,_0x338622));return uploadFile(_0x153d17,_0x48a3c7,_0x47d2a4,_0x338622,path[_0x6026('0x6e')](_0x4cda40),fs[_0x6026('0x6f')](_0x4cda40))['then'](function(_0xbbd4f5){logger[_0x6026('0x64')](util[_0x6026('0x31')](_0x6026('0x70'),_0xa56b36,_0x338622,_0xbbd4f5[_0x6026('0x71')]));_0x33fdb1[_0x6026('0x72')]=_0xbbd4f5[_0x6026('0x73')];_0x33fdb1[_0x6026('0x74')]=_0xbbd4f5[_0x6026('0x71')];logger[_0x6026('0x64')](util[_0x6026('0x31')](_0x6026('0x75'),_0xa56b36));return startTranscribe(_0x153d17,_0x48a3c7,_0x47d2a4,uuidv4(),_0x51e784,_0xbbd4f5[_0x6026('0x71')]);})[_0x6026('0x27')](function(_0x3c7227){logger[_0x6026('0x64')](util[_0x6026('0x31')](_0x6026('0x76'),_0xa56b36,_0x3c7227[_0x6026('0x77')][_0x6026('0x78')]));_0x33fdb1[_0x6026('0x79')]=_0x3c7227[_0x6026('0x77')]['TranscriptionJobName'];_0x33fdb1[_0x6026('0x7a')]=_0x3c7227['TranscriptionJob'][_0x6026('0x7b')];return _0x1b8e5e(_0x33fdb1);})[_0x6026('0x49')](function(_0x127aaa){return _0x1070dd(_0x127aaa);});});}exports[_0x6026('0x7c')]=function(_0x289787,_0xd0a0d8,_0x3e617a){var _0x473f40;var _0x176502;var _0x3a5fa2;var _0x3f6bc6=require('../../components/encryptor');return db[_0x6026('0x47')][_0x6026('0x7d')]({'where':{'id':_0x289787[_0x6026('0x45')]['id']}})[_0x6026('0x27')](function(_0x16d2e5){if(_0x16d2e5){var _0x109feb=util[_0x6026('0x31')](_0x6026('0x4f'),_0x16d2e5[_0x6026('0x4e')]);if(fs['existsSync'](_0x109feb)){cypher=!![];return _0x3f6bc6[_0x6026('0x50')](_0x109feb,_0x16d2e5[_0x6026('0x4e')],config[_0x6026('0x5f')]['recording'])['then'](function(){return _0x16d2e5;});}return _0x16d2e5;}})['then'](function(_0xb33545){if(!_0xb33545){throw new db['Sequelize'][(_0x6026('0x61'))](_0x6026('0x7e'));}_0x176502=_0xb33545;return db[_0x6026('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x6026('0x27')](handleEntityNotFound(_0xd0a0d8,null))['then'](function(_0x50c9b7){if(_0x50c9b7){_0x473f40=_0x50c9b7;if(!_0x473f40[_0x6026('0x80')]||!_0x473f40[_0x6026('0x81')]||!_0x473f40['transcribeRegion']||!_0x473f40['language']||!_0x473f40['bucket']){throw new db[(_0x6026('0x60'))][(_0x6026('0x61'))](_0x6026('0x82'));}if(_0x289787[_0x6026('0x4b')][_0x6026('0x83')]&&(!_0x473f40[_0x6026('0x84')]||!_0x473f40[_0x6026('0x85')]||!_0x473f40['sentimentRegion']||!_0x473f40[_0x6026('0x86')]||!_0x473f40[_0x6026('0x72')])){throw new db['Sequelize']['ValidationError'](_0x6026('0x87'));}return db['CloudProvider'][_0x6026('0x7d')]({'where':{'id':_0x473f40['transcribeAccountId']}});}})[_0x6026('0x27')](function(_0x3b1ef){if(!_0x3b1ef){throw new db[(_0x6026('0x60'))][(_0x6026('0x61'))](_0x6026('0x88'));}if(!_0x3b1ef[_0x6026('0x89')]||!_0x3b1ef[_0x6026('0x8a')]){throw new db[(_0x6026('0x60'))][(_0x6026('0x61'))](_0x6026('0x8b'));}_0x3a5fa2=_0x3b1ef;return getBucketslist(_0x3a5fa2[_0x6026('0x89')],_0x3a5fa2[_0x6026('0x8a')],_0x473f40['transcribeRegion']);})['then'](function(_0x2bf86f){if(_0x2bf86f&&_0x2bf86f['Buckets']){var _0x39752b=_['find'](_0x2bf86f[_0x6026('0x8c')],function(_0x5272f7){return _0x5272f7['Name']===_0x473f40[_0x6026('0x72')];});if(!_0x39752b){logger[_0x6026('0x64')](util[_0x6026('0x31')](_0x6026('0x8d'),_0x289787[_0x6026('0x45')]['id'],_0x473f40[_0x6026('0x72')]));return createBucket(_0x3a5fa2[_0x6026('0x89')],_0x3a5fa2[_0x6026('0x8a')],_0x473f40[_0x6026('0x8e')],_0x473f40['bucket']);}logger[_0x6026('0x64')](util['format'](_0x6026('0x8f'),_0x289787[_0x6026('0x45')]['id'],_0x473f40['bucket']));return;}})['then'](function(_0x51242e){if(_0x176502[_0x6026('0x7a')]===_0x6026('0x90')){return transcribe(_0x289787[_0x6026('0x45')]['id'],_0x3a5fa2['data1'],_0x3a5fa2['data2'],_0x473f40[_0x6026('0x8e')],_0x473f40[_0x6026('0x72')],_0x176502['value'],_0x473f40[_0x6026('0x86')]);}else{logger[_0x6026('0x64')](util[_0x6026('0x31')](_0x6026('0x91'),_0x289787[_0x6026('0x45')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x3100bd){if(_0x3100bd){_0x3100bd[_0x6026('0x92')]=_0x289787[_0x6026('0x4b')]['runSentiment'];return _0x176502['updateAttributes'](_0x3100bd);}})['then'](respondWithResult(_0xd0a0d8,null))[_0x6026('0x49')](handleError(_0xd0a0d8,null));};function writeFile(_0x466bf7,_0x2a8409){return new Promise(function(_0x3a889d,_0x1d4704){fs[_0x6026('0x93')](_0x2a8409,_0x466bf7,function(_0x46f887,_0x4f5d3d){if(_0x46f887){return _0x1d4704(_0x46f887);}else{return _0x3a889d(_0x4f5d3d);}});});}exports[_0x6026('0x94')]=function(_0x2d21ff,_0x3b9b6f,_0x44b54b){return db['VoiceRecording'][_0x6026('0x7d')]({'where':{'id':_0x2d21ff['params']['id']}})[_0x6026('0x27')](handleEntityNotFound(_0x3b9b6f))[_0x6026('0x27')](function(_0x36daa8){if(_0x36daa8&&_0x36daa8[_0x6026('0x95')]){var _0x39e86b=_0x36daa8['fileText'];var _0x25c191=config[_0x6026('0x96')]+_0x6026('0x97')+_0x36daa8['id']+_0x6026('0x98');if(fs[_0x6026('0x52')](_0x25c191)){return _0x25c191;}return writeFile(_0x39e86b,_0x25c191)[_0x6026('0x27')](function(){return _0x25c191;});}else{throw new db[(_0x6026('0x60'))][(_0x6026('0x61'))](_0x6026('0x99'));}})[_0x6026('0x27')](function(_0x14133d){return _0x3b9b6f[_0x6026('0x4c')](_0x14133d);})['catch'](handleError(_0x3b9b6f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 114adf9..1f69606 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 _0xfb30=['define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xfb30,0x88));var _0x0fb3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfb30[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x0fb3('0x0'));module[_0x0fb3('0x1')]=function(_0x5959c9,_0x49d250){return _0x5959c9[_0x0fb3('0x2')]('VoiceRecording',attributes,{'tableName':_0x0fb3('0x3'),'paranoid':![],'indexes':[{'name':_0x0fb3('0x4'),'fields':[_0x0fb3('0x4')]},{'name':_0x0fb3('0x5'),'fields':[_0x0fb3('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bc3=['./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','transcribeStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x4bc3[_0x2d34d6];return _0x1d3d12;};'use strict';var attributes=require(_0x34bc('0x0'));module[_0x34bc('0x1')]=function(_0x4a6fe8,_0x14787d){return _0x4a6fe8[_0x34bc('0x2')]('VoiceRecording',attributes,{'tableName':_0x34bc('0x3'),'paranoid':![],'indexes':[{'name':_0x34bc('0x4'),'fields':[_0x34bc('0x4')]},{'name':_0x34bc('0x5'),'fields':[_0x34bc('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 6a35ebc..9d46940 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 _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x2b904e,_0x38631c){var _0x27bba0=function(_0x1b0195){while(--_0x1b0195){_0x2b904e['push'](_0x2b904e['shift']());}};_0x27bba0(++_0x38631c);}(_0x5430,0x10c));var _0x0543=function(_0x953c45,_0x16a9a0){_0x953c45=_0x953c45-0x0;var _0x10ea03=_0x5430[_0x953c45];return _0x10ea03;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file +var _0xeb3b=['rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','raw','options','attributes','limit','stringify','../../components/encryptor','findOne','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','debug','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x2f2036,_0x11175){var _0x3aaf7e=function(_0x20961b){while(--_0x20961b){_0x2f2036['push'](_0x2f2036['shift']());}};_0x3aaf7e(++_0x11175);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x2d2623,_0x1aaea0){_0x2d2623=_0x2d2623-0x0;var _0x28f6c1=_0xeb3b[_0x2d2623];return _0x28f6c1;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var moment=require(_0xbeb3('0x2'));var BPromise=require(_0xbeb3('0x3'));var rs=require(_0xbeb3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbeb3('0x5'));var logger=require('../../config/logger')(_0xbeb3('0x6'));var config=require('../../config/environment');var jayson=require(_0xbeb3('0x7'));var client=jayson[_0xbeb3('0x8')][_0xbeb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x294cc9,_0x406927,_0x143255){return new BPromise(function(_0x5a6a06,_0x241dbb){return client[_0xbeb3('0xa')](_0x294cc9,_0x143255)[_0xbeb3('0xb')](function(_0x3b61ac){logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,_0xbeb3('0xe'));logger['debug'](_0xbeb3('0xf'),_0x406927,_0xbeb3('0xe'),JSON['stringify'](_0x3b61ac));if(_0x3b61ac[_0xbeb3('0x10')]){if(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x11')]===0x1f4){logger[_0xbeb3('0x10')](_0xbeb3('0xd'),_0x406927,_0x3b61ac[_0xbeb3('0x10')]['message']);return _0x241dbb(_0x3b61ac['error'][_0xbeb3('0x12')]);}logger[_0xbeb3('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x406927,_0x3b61ac['error'][_0xbeb3('0x12')]);return _0x5a6a06(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x12')]);}else{logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,'request\x20sent');_0x5a6a06(_0x3b61ac[_0xbeb3('0x13')]['message']);}})[_0xbeb3('0x14')](function(_0x4e7d99){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x406927,_0x4e7d99);_0x241dbb(_0x4e7d99);});});}exports[_0xbeb3('0x15')]=function(_0x44a4bb){var _0x32275b=this;return new Promise(function(_0x10b15d,_0x5d0689){return db[_0xbeb3('0x16')][_0xbeb3('0x17')](_0x44a4bb[_0xbeb3('0x18')],{'raw':_0x44a4bb['options']?_0x44a4bb['options'][_0xbeb3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44a4bb['options']?_0x44a4bb[_0xbeb3('0x1a')]['where']||null:null,'attributes':_0x44a4bb['options']?_0x44a4bb[_0xbeb3('0x1a')][_0xbeb3('0x1b')]||null:null,'limit':_0x44a4bb[_0xbeb3('0x1a')]?_0x44a4bb['options'][_0xbeb3('0x1c')]||null:null})[_0xbeb3('0xb')](function(_0x5e047e){logger[_0xbeb3('0xc')](_0xbeb3('0x15'),_0x44a4bb);logger['debug'](_0xbeb3('0x15'),_0x44a4bb,JSON[_0xbeb3('0x1d')](_0x5e047e));_0x10b15d(_0x5e047e);})[_0xbeb3('0x14')](function(_0x42c6c3){logger[_0xbeb3('0x10')](_0xbeb3('0x15'),_0x42c6c3[_0xbeb3('0x12')],_0x44a4bb);_0x5d0689(_0x32275b[_0xbeb3('0x10')](0x1f4,_0x42c6c3[_0xbeb3('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x4e695e){var _0x1f36b9=this;return new Promise(function(_0x520116,_0x3e7f7d){var _0xda808c=require(_0xbeb3('0x1e'));var _0x400f65;return db['Setting'][_0xbeb3('0x1f')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xbeb3('0xb')](function(_0xab301c){_0x400f65=_0xab301c;return db['VoiceRecording']['create'](_0x4e695e[_0xbeb3('0x18')]);})['then'](function(_0x51f7ef){if(_0x400f65['callRecordingEncryption']&&fs['existsSync'](_0x51f7ef[_0xbeb3('0x20')])){var _0x4e9a04=util[_0xbeb3('0x21')](_0xbeb3('0x22'),_0x51f7ef[_0xbeb3('0x20')]);return _0xda808c[_0xbeb3('0x23')](_0x51f7ef[_0xbeb3('0x20')],_0x4e9a04,config[_0xbeb3('0x24')][_0xbeb3('0x25')])[_0xbeb3('0xb')](function(){fs[_0xbeb3('0x26')](_0x51f7ef[_0xbeb3('0x20')]);logger['info'](_0xbeb3('0x27'));return _0x51f7ef;});}return _0x51f7ef;})[_0xbeb3('0xb')](function(_0x5821dd){logger[_0xbeb3('0xc')](_0xbeb3('0x28'),_0x4e695e);logger[_0xbeb3('0x29')](_0xbeb3('0x28'),_0x4e695e,JSON['stringify'](_0x5821dd));_0x520116(_0x5821dd);})[_0xbeb3('0x14')](function(_0x18f2be){logger[_0xbeb3('0x10')](_0xbeb3('0x28'),_0x18f2be[_0xbeb3('0x12')],_0x4e695e);_0x3e7f7d(_0x1f36b9[_0xbeb3('0x10')](0x1f4,_0x18f2be[_0xbeb3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 0a64cc3..44ef423 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 _0xeb45=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x22773f,_0x1ea73e){var _0x428a21=function(_0x423ea9){while(--_0x423ea9){_0x22773f['push'](_0x22773f['shift']());}};_0x428a21(++_0x1ea73e);}(_0xeb45,0xe4));var _0x5eb4=function(_0xc94e4,_0x462e59){_0xc94e4=_0xc94e4-0x0;var _0x4c4785=_0xeb45[_0xc94e4];return _0x4c4785;};'use strict';var multer=require('multer');var util=require(_0x5eb4('0x0'));var path=require(_0x5eb4('0x1'));var timeout=require(_0x5eb4('0x2'));var express=require(_0x5eb4('0x3'));var router=express[_0x5eb4('0x4')]();var fs_extra=require(_0x5eb4('0x5'));var auth=require(_0x5eb4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5eb4('0x7'));var controller=require(_0x5eb4('0x8'));router[_0x5eb4('0x9')]('/',auth[_0x5eb4('0xa')](),controller[_0x5eb4('0xb')]);router[_0x5eb4('0x9')](_0x5eb4('0xc'),auth[_0x5eb4('0xa')](),controller['describe']);router[_0x5eb4('0x9')](_0x5eb4('0xd'),auth[_0x5eb4('0xa')](),controller[_0x5eb4('0xe')]);router[_0x5eb4('0xf')]('/',auth[_0x5eb4('0xa')](),controller[_0x5eb4('0x10')]);router[_0x5eb4('0x11')](_0x5eb4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5eb4('0x12')](_0x5eb4('0xd'),auth[_0x5eb4('0xa')](),controller[_0x5eb4('0x13')]);module[_0x5eb4('0x14')]=router; \ No newline at end of file +var _0x8e90=['./voiceTransferReport.controller','get','/describe','describe','/:id','show','post','create','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5acd73,_0x2838d3){var _0x28eb2c=function(_0x16242b){while(--_0x16242b){_0x5acd73['push'](_0x5acd73['shift']());}};_0x28eb2c(++_0x2838d3);}(_0x8e90,0x1da));var _0x08e9=function(_0x52469e,_0x3579c2){_0x52469e=_0x52469e-0x0;var _0x2e6692=_0x8e90[_0x52469e];return _0x2e6692;};'use strict';var multer=require(_0x08e9('0x0'));var util=require(_0x08e9('0x1'));var path=require(_0x08e9('0x2'));var timeout=require(_0x08e9('0x3'));var express=require(_0x08e9('0x4'));var router=express[_0x08e9('0x5')]();var fs_extra=require(_0x08e9('0x6'));var auth=require(_0x08e9('0x7'));var interaction=require(_0x08e9('0x8'));var config=require(_0x08e9('0x9'));var controller=require(_0x08e9('0xa'));router[_0x08e9('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x08e9('0xb')](_0x08e9('0xc'),auth['isAuthenticated'](),controller[_0x08e9('0xd')]);router['get'](_0x08e9('0xe'),auth['isAuthenticated'](),controller[_0x08e9('0xf')]);router[_0x08e9('0x10')]('/',auth['isAuthenticated'](),controller[_0x08e9('0x11')]);router['put'](_0x08e9('0xe'),auth[_0x08e9('0x12')](),controller[_0x08e9('0x13')]);router['delete'](_0x08e9('0xe'),auth[_0x08e9('0x12')](),controller[_0x08e9('0x14')]);module[_0x08e9('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 6ee84fd..c82d4f9 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 _0xfc78=['blind','STRING','Yes','sequelize','exports','ENUM'];(function(_0x1e2bdd,_0xab0204){var _0x525b17=function(_0x797897){while(--_0x797897){_0x1e2bdd['push'](_0x1e2bdd['shift']());}};_0x525b17(++_0xab0204);}(_0xfc78,0xc3));var _0x8fc7=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xfc78[_0x1da04e];return _0xdd8c41;};'use strict';var Sequelize=require(_0x8fc7('0x0'));var moment=require('moment');module[_0x8fc7('0x1')]={'type':{'type':Sequelize[_0x8fc7('0x2')](_0x8fc7('0x3'),'attended')},'result':{'type':Sequelize[_0x8fc7('0x4')]},'transfererchannel':{'type':Sequelize[_0x8fc7('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x8fc7('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x8fc7('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x8fc7('0x4')]},'transfereechannel':{'type':Sequelize[_0x8fc7('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x8fc7('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x8fc7('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8fc7('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x8fc7('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x8fc7('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x8fc7('0x4')]},'isexternal':{'type':Sequelize[_0x8fc7('0x2')](_0x8fc7('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8fc7('0x4')]}}; \ No newline at end of file +var _0xe429=['Yes','ENUM','blind','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe429,0xf1));var _0x9e42=function(_0x42c0ed,_0x5248aa){_0x42c0ed=_0x42c0ed-0x0;var _0x4ad9b0=_0xe429[_0x42c0ed];return _0x4ad9b0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x9e42('0x0')](_0x9e42('0x1'),'attended')},'result':{'type':Sequelize[_0x9e42('0x2')]},'transfererchannel':{'type':Sequelize[_0x9e42('0x2')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x9e42('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0x9e42('0x2')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x9e42('0x2')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x9e42('0x2')]},'transfererlinkedid':{'type':Sequelize[_0x9e42('0x2')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x9e42('0x2')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x9e42('0x2')]},'transfereeconnectedlinename':{'type':Sequelize[_0x9e42('0x2')]},'transfereeaccountcode':{'type':Sequelize[_0x9e42('0x2')]},'transfereecontext':{'type':Sequelize[_0x9e42('0x2')]},'transfereeexten':{'type':Sequelize[_0x9e42('0x2')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x9e42('0x0')](_0x9e42('0x3'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 887d5a7..c1c45f0 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 _0x8877=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','key','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0xd98ca3,_0x38fbd9){var _0x35960d=function(_0x52e8ee){while(--_0x52e8ee){_0xd98ca3['push'](_0xd98ca3['shift']());}};_0x35960d(++_0x38fbd9);}(_0x8877,0x98));var _0x7887=function(_0x5f3df5,_0x1fb80b){_0x5f3df5=_0x5f3df5-0x0;var _0xbd71c0=_0x8877[_0x5f3df5];return _0xbd71c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7887('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7887('0x1'));var rp=require(_0x7887('0x2'));var moment=require(_0x7887('0x3'));var BPromise=require(_0x7887('0x4'));var Mustache=require('mustache');var util=require(_0x7887('0x5'));var path=require(_0x7887('0x6'));var sox=require(_0x7887('0x7'));var csv=require(_0x7887('0x8'));var ejs=require(_0x7887('0x9'));var fs=require('fs');var fs_extra=require(_0x7887('0xa'));var _=require('lodash');var squel=require(_0x7887('0xb'));var crypto=require(_0x7887('0xc'));var jsforce=require(_0x7887('0xd'));var deskjs=require(_0x7887('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7887('0xf'));var Papa=require('papaparse');var Redis=require(_0x7887('0x10'));var authService=require(_0x7887('0x11'));var qs=require(_0x7887('0x12'));var as=require(_0x7887('0x13'));var hardwareService=require(_0x7887('0x14'));var logger=require(_0x7887('0x15'))(_0x7887('0x16'));var utils=require(_0x7887('0x17'));var config=require(_0x7887('0x18'));var licenseUtil=require(_0x7887('0x19'));var db=require(_0x7887('0x1a'))['db'];function respondWithStatusCode(_0x4c3b65,_0x39c10a){_0x39c10a=_0x39c10a||0xcc;return function(_0x43748b){if(_0x43748b){return _0x4c3b65[_0x7887('0x1b')](_0x39c10a);}return _0x4c3b65[_0x7887('0x1c')](_0x39c10a)[_0x7887('0x1d')]();};}function respondWithResult(_0x432ac0,_0x31c1d5){_0x31c1d5=_0x31c1d5||0xc8;return function(_0x78f039){if(_0x78f039){return _0x432ac0['status'](_0x31c1d5)[_0x7887('0x1e')](_0x78f039);}};}function respondWithFilteredResult(_0x2980a4,_0x4a4f99){return function(_0x327d95){if(_0x327d95){var _0x4aa091=typeof _0x4a4f99[_0x7887('0x1f')]===_0x7887('0x20')&&typeof _0x4a4f99['limit']==='undefined';var _0x454f15=_0x327d95[_0x7887('0x21')];var _0xf5bf8d=_0x4aa091?0x0:_0x4a4f99[_0x7887('0x1f')];var _0x1e261a=_0x4aa091?_0x327d95['count']:_0x4a4f99['offset']+_0x4a4f99[_0x7887('0x22')];var _0x2d7000;if(_0x1e261a>=_0x454f15){_0x1e261a=_0x454f15;_0x2d7000=0xc8;}else{_0x2d7000=0xce;}_0x2980a4[_0x7887('0x1c')](_0x2d7000);return _0x2980a4[_0x7887('0x23')](_0x7887('0x24'),_0xf5bf8d+'-'+_0x1e261a+'/'+_0x454f15)[_0x7887('0x1e')](_0x327d95);}return null;};}function patchUpdates(_0x372a27){return function(_0x12cbe6){try{jsonpatch[_0x7887('0x25')](_0x12cbe6,_0x372a27,!![]);}catch(_0x1ac8a3){return BPromise[_0x7887('0x26')](_0x1ac8a3);}return _0x12cbe6[_0x7887('0x27')]();};}function saveUpdates(_0x4eb38,_0xa3230e){return function(_0x584e26){if(_0x584e26){return _0x584e26[_0x7887('0x28')](_0x4eb38)[_0x7887('0x29')](function(_0x110832){return _0x110832;});}return null;};}function removeEntity(_0x4d80c1,_0x1afbbc){return function(_0x724f7c){if(_0x724f7c){return _0x724f7c[_0x7887('0x2a')]()[_0x7887('0x29')](function(){_0x4d80c1[_0x7887('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15c06f,_0x3a7fac){return function(_0xd64d46){if(!_0xd64d46){_0x15c06f[_0x7887('0x1b')](0x194);}return _0xd64d46;};}function handleError(_0x30d51f,_0x3796ed){_0x3796ed=_0x3796ed||0x1f4;return function(_0x286126){logger[_0x7887('0x2b')](_0x286126[_0x7887('0x2c')]);if(_0x286126['name']){delete _0x286126[_0x7887('0x2d')];}_0x30d51f[_0x7887('0x1c')](_0x3796ed)[_0x7887('0x2e')](_0x286126);};}exports[_0x7887('0x2f')]=function(_0x4dc07f,_0x3901b4){var _0x267aae={},_0x4481ca={},_0x1a18dd={'count':0x0,'rows':[]};var _0x297b2a=_[_0x7887('0x30')](db[_0x7887('0x31')][_0x7887('0x32')],function(_0xa0036){return{'name':_0xa0036['fieldName'],'type':_0xa0036['type'][_0x7887('0x33')]};});_0x4481ca['model']=_[_0x7887('0x30')](_0x297b2a,'name');_0x4481ca['query']=_[_0x7887('0x34')](_0x4dc07f[_0x7887('0x35')]);_0x4481ca[_0x7887('0x36')]=_['intersection'](_0x4481ca[_0x7887('0x37')],_0x4481ca[_0x7887('0x35')]);_0x267aae['attributes']=_[_0x7887('0x38')](_0x4481ca[_0x7887('0x37')],qs['fields'](_0x4dc07f[_0x7887('0x35')][_0x7887('0x39')]));_0x267aae[_0x7887('0x3a')]=_0x267aae[_0x7887('0x3a')]['length']?_0x267aae[_0x7887('0x3a')]:_0x4481ca[_0x7887('0x37')];if(!_0x4dc07f[_0x7887('0x35')][_0x7887('0x3b')](_0x7887('0x3c'))){_0x267aae[_0x7887('0x22')]=qs[_0x7887('0x22')](_0x4dc07f[_0x7887('0x35')][_0x7887('0x22')]);_0x267aae[_0x7887('0x1f')]=qs['offset'](_0x4dc07f[_0x7887('0x35')][_0x7887('0x1f')]);}_0x267aae[_0x7887('0x3d')]=qs[_0x7887('0x3e')](_0x4dc07f[_0x7887('0x35')]['sort']);_0x267aae['where']=qs['filters'](_[_0x7887('0x3f')](_0x4dc07f[_0x7887('0x35')],_0x4481ca[_0x7887('0x36')]),_0x297b2a);if(_0x4dc07f[_0x7887('0x35')][_0x7887('0x40')]){_0x267aae[_0x7887('0x41')]=_[_0x7887('0x42')](_0x267aae['where'],{'$or':_['map'](_0x297b2a,function(_0x13233a){if(_0x13233a[_0x7887('0x43')]!==_0x7887('0x44')){var _0xa05826={};_0xa05826[_0x13233a[_0x7887('0x2d')]]={'$like':'%'+_0x4dc07f['query'][_0x7887('0x40')]+'%'};return _0xa05826;}})});}_0x267aae=_[_0x7887('0x42')]({},_0x267aae,_0x4dc07f[_0x7887('0x45')]);var _0x1a4481={'where':_0x267aae[_0x7887('0x41')]};return db[_0x7887('0x31')]['count'](_0x1a4481)[_0x7887('0x29')](function(_0x23b61b){_0x1a18dd['count']=_0x23b61b;if(_0x4dc07f[_0x7887('0x35')][_0x7887('0x46')]){_0x267aae[_0x7887('0x47')]=[{'all':!![]}];}return db[_0x7887('0x31')][_0x7887('0x48')](_0x267aae);})['then'](function(_0x52d1d6){_0x1a18dd[_0x7887('0x49')]=_0x52d1d6;return _0x1a18dd;})[_0x7887('0x29')](respondWithFilteredResult(_0x3901b4,_0x267aae))[_0x7887('0x4a')](handleError(_0x3901b4,null));};exports['show']=function(_0x4ba9a2,_0xcee516){var _0x426677={'raw':!![],'where':{'id':_0x4ba9a2[_0x7887('0x4b')]['id']}},_0x10fa6a={};_0x10fa6a[_0x7887('0x37')]=_[_0x7887('0x34')](db[_0x7887('0x31')][_0x7887('0x32')]);_0x10fa6a[_0x7887('0x35')]=_[_0x7887('0x34')](_0x4ba9a2[_0x7887('0x35')]);_0x10fa6a['filters']=_['intersection'](_0x10fa6a['model'],_0x10fa6a[_0x7887('0x35')]);_0x426677[_0x7887('0x3a')]=_[_0x7887('0x38')](_0x10fa6a[_0x7887('0x37')],qs[_0x7887('0x39')](_0x4ba9a2[_0x7887('0x35')][_0x7887('0x39')]));_0x426677[_0x7887('0x3a')]=_0x426677[_0x7887('0x3a')][_0x7887('0x4c')]?_0x426677[_0x7887('0x3a')]:_0x10fa6a[_0x7887('0x37')];if(_0x4ba9a2['query'][_0x7887('0x46')]){_0x426677['include']=[{'all':!![]}];}_0x426677=_['merge']({},_0x426677,_0x4ba9a2[_0x7887('0x45')]);return db[_0x7887('0x31')][_0x7887('0x4d')](_0x426677)[_0x7887('0x29')](handleEntityNotFound(_0xcee516,null))[_0x7887('0x29')](respondWithResult(_0xcee516,null))['catch'](handleError(_0xcee516,null));};exports['create']=function(_0x222642,_0x5764ad){return db[_0x7887('0x31')]['create'](_0x222642['body'],{})['then'](respondWithResult(_0x5764ad,0xc9))[_0x7887('0x4a')](handleError(_0x5764ad,null));};exports['update']=function(_0x40eaf5,_0x273bd2){if(_0x40eaf5[_0x7887('0x4e')]['id']){delete _0x40eaf5[_0x7887('0x4e')]['id'];}return db[_0x7887('0x31')][_0x7887('0x4d')]({'where':{'id':_0x40eaf5[_0x7887('0x4b')]['id']}})[_0x7887('0x29')](handleEntityNotFound(_0x273bd2,null))[_0x7887('0x29')](saveUpdates(_0x40eaf5[_0x7887('0x4e')],null))[_0x7887('0x29')](respondWithResult(_0x273bd2,null))[_0x7887('0x4a')](handleError(_0x273bd2,null));};exports[_0x7887('0x2a')]=function(_0x343e89,_0xb2e4cf){return db['VoiceTransferReport'][_0x7887('0x4d')]({'where':{'id':_0x343e89[_0x7887('0x4b')]['id']}})[_0x7887('0x29')](handleEntityNotFound(_0xb2e4cf,null))['then'](removeEntity(_0xb2e4cf,null))[_0x7887('0x4a')](handleError(_0xb2e4cf,null));};exports[_0x7887('0x4f')]=function(_0x7e820c,_0x319d6b){return db[_0x7887('0x31')][_0x7887('0x4f')]()[_0x7887('0x29')](respondWithResult(_0x319d6b,null))[_0x7887('0x4a')](handleError(_0x319d6b,null));}; \ No newline at end of file +var _0xa283=['create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','VoiceTransferReport','includeAll','findAll','rows','catch','include','find','then'];(function(_0x4dd870,_0x249a96){var _0x3c0cfa=function(_0x51c40f){while(--_0x51c40f){_0x4dd870['push'](_0x4dd870['shift']());}};_0x3c0cfa(++_0x249a96);}(_0xa283,0x121));var _0x3a28=function(_0x382d62,_0x178f32){_0x382d62=_0x382d62-0x0;var _0x21f224=_0xa283[_0x382d62];return _0x21f224;};'use strict';var emlformat=require(_0x3a28('0x0'));var rimraf=require(_0x3a28('0x1'));var zipdir=require(_0x3a28('0x2'));var jsonpatch=require(_0x3a28('0x3'));var rp=require('request-promise');var moment=require(_0x3a28('0x4'));var BPromise=require(_0x3a28('0x5'));var Mustache=require('mustache');var util=require(_0x3a28('0x6'));var path=require(_0x3a28('0x7'));var sox=require('sox');var csv=require(_0x3a28('0x8'));var ejs=require(_0x3a28('0x9'));var fs=require('fs');var fs_extra=require(_0x3a28('0xa'));var _=require(_0x3a28('0xb'));var squel=require(_0x3a28('0xc'));var crypto=require('crypto');var jsforce=require(_0x3a28('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3a28('0x8'));var querystring=require(_0x3a28('0xe'));var Papa=require(_0x3a28('0xf'));var Redis=require('ioredis');var authService=require(_0x3a28('0x10'));var qs=require(_0x3a28('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a28('0x12'))('api');var utils=require(_0x3a28('0x13'));var config=require(_0x3a28('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a28('0x15'))['db'];function respondWithStatusCode(_0x39fa6e,_0x5569fa){_0x5569fa=_0x5569fa||0xcc;return function(_0x35316e){if(_0x35316e){return _0x39fa6e['sendStatus'](_0x5569fa);}return _0x39fa6e[_0x3a28('0x16')](_0x5569fa)[_0x3a28('0x17')]();};}function respondWithResult(_0x2e1d1d,_0x4fba1a){_0x4fba1a=_0x4fba1a||0xc8;return function(_0x1dfe58){if(_0x1dfe58){return _0x2e1d1d['status'](_0x4fba1a)[_0x3a28('0x18')](_0x1dfe58);}};}function respondWithFilteredResult(_0xfd25cf,_0x24022c){return function(_0x15571b){if(_0x15571b){var _0x410723=typeof _0x24022c[_0x3a28('0x19')]===_0x3a28('0x1a')&&typeof _0x24022c[_0x3a28('0x1b')]===_0x3a28('0x1a');var _0x4b8fb8=_0x15571b['count'];var _0x3cdbaf=_0x410723?0x0:_0x24022c[_0x3a28('0x19')];var _0x79f0b=_0x410723?_0x15571b[_0x3a28('0x1c')]:_0x24022c[_0x3a28('0x19')]+_0x24022c[_0x3a28('0x1b')];var _0x58371d;if(_0x79f0b>=_0x4b8fb8){_0x79f0b=_0x4b8fb8;_0x58371d=0xc8;}else{_0x58371d=0xce;}_0xfd25cf[_0x3a28('0x16')](_0x58371d);return _0xfd25cf['set'](_0x3a28('0x1d'),_0x3cdbaf+'-'+_0x79f0b+'/'+_0x4b8fb8)[_0x3a28('0x18')](_0x15571b);}return null;};}function patchUpdates(_0x2e086b){return function(_0x460ee5){try{jsonpatch[_0x3a28('0x1e')](_0x460ee5,_0x2e086b,!![]);}catch(_0x4a6c85){return BPromise[_0x3a28('0x1f')](_0x4a6c85);}return _0x460ee5[_0x3a28('0x20')]();};}function saveUpdates(_0x1a9e01,_0x593330){return function(_0x4dfc2e){if(_0x4dfc2e){return _0x4dfc2e['update'](_0x1a9e01)['then'](function(_0x143823){return _0x143823;});}return null;};}function removeEntity(_0x581c86,_0x4be774){return function(_0x5a2e1e){if(_0x5a2e1e){return _0x5a2e1e['destroy']()['then'](function(){_0x581c86[_0x3a28('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x155033,_0x39a622){return function(_0x2d2e37){if(!_0x2d2e37){_0x155033[_0x3a28('0x21')](0x194);}return _0x2d2e37;};}function handleError(_0x2318a0,_0x349b22){_0x349b22=_0x349b22||0x1f4;return function(_0x26555b){logger['error'](_0x26555b[_0x3a28('0x22')]);if(_0x26555b[_0x3a28('0x23')]){delete _0x26555b[_0x3a28('0x23')];}_0x2318a0[_0x3a28('0x16')](_0x349b22)[_0x3a28('0x24')](_0x26555b);};}exports[_0x3a28('0x25')]=function(_0x5ba1f5,_0xa3ef1b){var _0xbfc30a={},_0x22cfb8={},_0x3740e6={'count':0x0,'rows':[]};var _0x2f908e=_['map'](db['VoiceTransferReport'][_0x3a28('0x26')],function(_0x435f6e){return{'name':_0x435f6e[_0x3a28('0x27')],'type':_0x435f6e[_0x3a28('0x28')]['key']};});_0x22cfb8[_0x3a28('0x29')]=_[_0x3a28('0x2a')](_0x2f908e,'name');_0x22cfb8[_0x3a28('0x2b')]=_[_0x3a28('0x2c')](_0x5ba1f5[_0x3a28('0x2b')]);_0x22cfb8[_0x3a28('0x2d')]=_[_0x3a28('0x2e')](_0x22cfb8['model'],_0x22cfb8[_0x3a28('0x2b')]);_0xbfc30a[_0x3a28('0x2f')]=_['intersection'](_0x22cfb8[_0x3a28('0x29')],qs[_0x3a28('0x30')](_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x30')]));_0xbfc30a[_0x3a28('0x2f')]=_0xbfc30a['attributes'][_0x3a28('0x31')]?_0xbfc30a[_0x3a28('0x2f')]:_0x22cfb8[_0x3a28('0x29')];if(!_0x5ba1f5[_0x3a28('0x2b')]['hasOwnProperty'](_0x3a28('0x32'))){_0xbfc30a[_0x3a28('0x1b')]=qs[_0x3a28('0x1b')](_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x1b')]);_0xbfc30a['offset']=qs[_0x3a28('0x19')](_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x19')]);}_0xbfc30a[_0x3a28('0x33')]=qs['sort'](_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x34')]);_0xbfc30a['where']=qs['filters'](_[_0x3a28('0x35')](_0x5ba1f5['query'],_0x22cfb8['filters']),_0x2f908e);if(_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x36')]){_0xbfc30a[_0x3a28('0x37')]=_[_0x3a28('0x38')](_0xbfc30a[_0x3a28('0x37')],{'$or':_[_0x3a28('0x2a')](_0x2f908e,function(_0x42f1aa){if(_0x42f1aa[_0x3a28('0x28')]!=='VIRTUAL'){var _0x3fac47={};_0x3fac47[_0x42f1aa['name']]={'$like':'%'+_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x36')]+'%'};return _0x3fac47;}})});}_0xbfc30a=_[_0x3a28('0x38')]({},_0xbfc30a,_0x5ba1f5[_0x3a28('0x39')]);var _0x4f10b2={'where':_0xbfc30a[_0x3a28('0x37')]};return db[_0x3a28('0x3a')][_0x3a28('0x1c')](_0x4f10b2)['then'](function(_0x3be7a2){_0x3740e6[_0x3a28('0x1c')]=_0x3be7a2;if(_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x3b')]){_0xbfc30a['include']=[{'all':!![]}];}return db[_0x3a28('0x3a')][_0x3a28('0x3c')](_0xbfc30a);})['then'](function(_0x1a6752){_0x3740e6[_0x3a28('0x3d')]=_0x1a6752;return _0x3740e6;})['then'](respondWithFilteredResult(_0xa3ef1b,_0xbfc30a))[_0x3a28('0x3e')](handleError(_0xa3ef1b,null));};exports['show']=function(_0x2be2d6,_0x1b862c){var _0x1cdccf={'raw':!![],'where':{'id':_0x2be2d6['params']['id']}},_0x5a765e={};_0x5a765e['model']=_[_0x3a28('0x2c')](db['VoiceTransferReport'][_0x3a28('0x26')]);_0x5a765e[_0x3a28('0x2b')]=_[_0x3a28('0x2c')](_0x2be2d6[_0x3a28('0x2b')]);_0x5a765e['filters']=_[_0x3a28('0x2e')](_0x5a765e[_0x3a28('0x29')],_0x5a765e['query']);_0x1cdccf[_0x3a28('0x2f')]=_[_0x3a28('0x2e')](_0x5a765e[_0x3a28('0x29')],qs[_0x3a28('0x30')](_0x2be2d6[_0x3a28('0x2b')][_0x3a28('0x30')]));_0x1cdccf[_0x3a28('0x2f')]=_0x1cdccf[_0x3a28('0x2f')][_0x3a28('0x31')]?_0x1cdccf['attributes']:_0x5a765e[_0x3a28('0x29')];if(_0x2be2d6[_0x3a28('0x2b')][_0x3a28('0x3b')]){_0x1cdccf[_0x3a28('0x3f')]=[{'all':!![]}];}_0x1cdccf=_[_0x3a28('0x38')]({},_0x1cdccf,_0x2be2d6[_0x3a28('0x39')]);return db[_0x3a28('0x3a')][_0x3a28('0x40')](_0x1cdccf)[_0x3a28('0x41')](handleEntityNotFound(_0x1b862c,null))['then'](respondWithResult(_0x1b862c,null))[_0x3a28('0x3e')](handleError(_0x1b862c,null));};exports[_0x3a28('0x42')]=function(_0x271a34,_0x224fb6){return db[_0x3a28('0x3a')]['create'](_0x271a34[_0x3a28('0x43')],{})[_0x3a28('0x41')](respondWithResult(_0x224fb6,0xc9))['catch'](handleError(_0x224fb6,null));};exports[_0x3a28('0x44')]=function(_0x4676ce,_0x43750b){if(_0x4676ce[_0x3a28('0x43')]['id']){delete _0x4676ce[_0x3a28('0x43')]['id'];}return db[_0x3a28('0x3a')][_0x3a28('0x40')]({'where':{'id':_0x4676ce[_0x3a28('0x45')]['id']}})['then'](handleEntityNotFound(_0x43750b,null))[_0x3a28('0x41')](saveUpdates(_0x4676ce['body'],null))[_0x3a28('0x41')](respondWithResult(_0x43750b,null))['catch'](handleError(_0x43750b,null));};exports['destroy']=function(_0x2a3104,_0x309356){return db[_0x3a28('0x3a')][_0x3a28('0x40')]({'where':{'id':_0x2a3104[_0x3a28('0x45')]['id']}})['then'](handleEntityNotFound(_0x309356,null))['then'](removeEntity(_0x309356,null))[_0x3a28('0x3e')](handleError(_0x309356,null));};exports[_0x3a28('0x46')]=function(_0x575211,_0x1dad44){return db[_0x3a28('0x3a')]['describe']()[_0x3a28('0x41')](respondWithResult(_0x1dad44,null))[_0x3a28('0x3e')](handleError(_0x1dad44,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 4e6d49b..5face45 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 _0x1b51=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x1b51,0x1d9));var _0x11b5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1b51[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x11b5('0x0'))(_0x11b5('0x1'));var moment=require('moment');var BPromise=require(_0x11b5('0x2'));var rp=require(_0x11b5('0x3'));var fs=require('fs');var path=require(_0x11b5('0x4'));var rimraf=require(_0x11b5('0x5'));var config=require(_0x11b5('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x11b5('0x7')]=function(_0x5df773,_0x140438){return _0x5df773[_0x11b5('0x8')](_0x11b5('0x9'),attributes,{'tableName':_0x11b5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8efb=['api','moment','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x8efb,0x176));var _0xb8ef=function(_0x2b9e73,_0x43984c){_0x2b9e73=_0x2b9e73-0x0;var _0x3c874b=_0x8efb[_0x2b9e73];return _0x3c874b;};'use strict';var _=require(_0xb8ef('0x0'));var util=require(_0xb8ef('0x1'));var logger=require(_0xb8ef('0x2'))(_0xb8ef('0x3'));var moment=require(_0xb8ef('0x4'));var BPromise=require('bluebird');var rp=require(_0xb8ef('0x5'));var fs=require('fs');var path=require(_0xb8ef('0x6'));var rimraf=require(_0xb8ef('0x7'));var config=require('../../config/environment');var attributes=require(_0xb8ef('0x8'));module[_0xb8ef('0x9')]=function(_0x43eddd,_0x2241fb){return _0x43eddd[_0xb8ef('0xa')](_0xb8ef('0xb'),attributes,{'tableName':_0xb8ef('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 06c40a0..ad8fd15 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 _0x8987=['util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8987,0x9c));var _0x7898=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x8987[_0x1265ed];return _0x5ac459;};'use strict';var _=require('lodash');var util=require(_0x7898('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7898('0x1'));var fs=require('fs');var Redis=require(_0x7898('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7898('0x3'))(_0x7898('0x4'));var config=require('../../config/environment');var jayson=require(_0x7898('0x5'));var client=jayson[_0x7898('0x6')][_0x7898('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2530f7,_0xe9a684,_0x4b9ed8){return new BPromise(function(_0x1e0c73,_0x31e787){return client[_0x7898('0x8')](_0x2530f7,_0x4b9ed8)['then'](function(_0x3f2405){logger['info'](_0x7898('0x9'),_0xe9a684,'request\x20sent');logger[_0x7898('0xa')](_0x7898('0xb'),_0xe9a684,_0x7898('0xc'),JSON[_0x7898('0xd')](_0x3f2405));if(_0x3f2405['error']){if(_0x3f2405[_0x7898('0xe')][_0x7898('0xf')]===0x1f4){logger['error'](_0x7898('0x9'),_0xe9a684,_0x3f2405['error'][_0x7898('0x10')]);return _0x31e787(_0x3f2405[_0x7898('0xe')][_0x7898('0x10')]);}logger[_0x7898('0xe')](_0x7898('0x9'),_0xe9a684,_0x3f2405[_0x7898('0xe')][_0x7898('0x10')]);return _0x1e0c73(_0x3f2405['error'][_0x7898('0x10')]);}else{logger[_0x7898('0x11')](_0x7898('0x9'),_0xe9a684,_0x7898('0xc'));_0x1e0c73(_0x3f2405['result'][_0x7898('0x10')]);}})[_0x7898('0x12')](function(_0x329c97){logger[_0x7898('0xe')](_0x7898('0x9'),_0xe9a684,_0x329c97);_0x31e787(_0x329c97);});});}exports[_0x7898('0x13')]=function(_0x3bc1a1){var _0x27413e=this;return new Promise(function(_0x20f9a5,_0x48f8d8){return db[_0x7898('0x14')][_0x7898('0x15')](_0x3bc1a1[_0x7898('0x16')],{'raw':_0x3bc1a1[_0x7898('0x17')]?_0x3bc1a1[_0x7898('0x17')][_0x7898('0x18')]===undefined?!![]:![]:!![]})[_0x7898('0x19')](function(_0x8cc876){logger[_0x7898('0x11')](_0x7898('0x13'),_0x3bc1a1);logger['debug'](_0x7898('0x13'),_0x3bc1a1,JSON['stringify'](_0x8cc876));_0x20f9a5(_0x8cc876);})['catch'](function(_0x2b39a8){logger['error'](_0x7898('0x13'),_0x2b39a8[_0x7898('0x10')],_0x3bc1a1);_0x48f8d8(_0x27413e['error'](0x1f4,_0x2b39a8[_0x7898('0x10')]));});});}; \ No newline at end of file +var _0x4bec=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceTransferReport','body','options','raw','CreateVoiceTransferReport','util'];(function(_0x234008,_0x50d1d1){var _0x3bea29=function(_0xe46054){while(--_0xe46054){_0x234008['push'](_0x234008['shift']());}};_0x3bea29(++_0x50d1d1);}(_0x4bec,0x1e5));var _0xc4be=function(_0x143e86,_0x4ab16a){_0x143e86=_0x143e86-0x0;var _0x1d1edb=_0x4bec[_0x143e86];return _0x1d1edb;};'use strict';var _=require('lodash');var util=require(_0xc4be('0x0'));var moment=require(_0xc4be('0x1'));var BPromise=require('bluebird');var rs=require(_0xc4be('0x2'));var fs=require('fs');var Redis=require(_0xc4be('0x3'));var db=require(_0xc4be('0x4'))['db'];var utils=require(_0xc4be('0x5'));var logger=require(_0xc4be('0x6'))(_0xc4be('0x7'));var config=require('../../config/environment');var jayson=require(_0xc4be('0x8'));var client=jayson[_0xc4be('0x9')][_0xc4be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eb7ef,_0x56518b,_0x3057a8){return new BPromise(function(_0x374418,_0x39d637){return client['request'](_0x3eb7ef,_0x3057a8)['then'](function(_0x544daa){logger['info'](_0xc4be('0xb'),_0x56518b,_0xc4be('0xc'));logger[_0xc4be('0xd')](_0xc4be('0xe'),_0x56518b,_0xc4be('0xc'),JSON[_0xc4be('0xf')](_0x544daa));if(_0x544daa[_0xc4be('0x10')]){if(_0x544daa[_0xc4be('0x10')][_0xc4be('0x11')]===0x1f4){logger[_0xc4be('0x10')](_0xc4be('0xb'),_0x56518b,_0x544daa[_0xc4be('0x10')]['message']);return _0x39d637(_0x544daa['error'][_0xc4be('0x12')]);}logger['error'](_0xc4be('0xb'),_0x56518b,_0x544daa['error'][_0xc4be('0x12')]);return _0x374418(_0x544daa['error']['message']);}else{logger[_0xc4be('0x13')](_0xc4be('0xb'),_0x56518b,_0xc4be('0xc'));_0x374418(_0x544daa[_0xc4be('0x14')]['message']);}})[_0xc4be('0x15')](function(_0xaa526b){logger[_0xc4be('0x10')](_0xc4be('0xb'),_0x56518b,_0xaa526b);_0x39d637(_0xaa526b);});});}exports['CreateVoiceTransferReport']=function(_0x1e0b38){var _0x41bff3=this;return new Promise(function(_0x37386a,_0x1e5de2){return db[_0xc4be('0x16')]['create'](_0x1e0b38[_0xc4be('0x17')],{'raw':_0x1e0b38[_0xc4be('0x18')]?_0x1e0b38[_0xc4be('0x18')][_0xc4be('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x20eb7e){logger['info']('CreateVoiceTransferReport',_0x1e0b38);logger[_0xc4be('0xd')](_0xc4be('0x1a'),_0x1e0b38,JSON[_0xc4be('0xf')](_0x20eb7e));_0x37386a(_0x20eb7e);})[_0xc4be('0x15')](function(_0x52c58){logger[_0xc4be('0x10')](_0xc4be('0x1a'),_0x52c58[_0xc4be('0x12')],_0x1e0b38);_0x1e5de2(_0x41bff3[_0xc4be('0x10')](0x1f4,_0x52c58[_0xc4be('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c412bea..74e2c05 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 _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0x91a7,0xe7));var _0x791a=function(_0x2178ad,_0x337cbc){_0x2178ad=_0x2178ad-0x0;var _0x5b30af=_0x91a7[_0x2178ad];return _0x5b30af;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file +var _0xf3cd=['/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','isAuthenticated','hangup','/answer','answer'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0xf3cd[_0x21f931];return _0x3f083c;};'use strict';var express=require(_0xdf3c('0x0'));var router=express[_0xdf3c('0x1')]();var auth=require(_0xdf3c('0x2'));var controller=require(_0xdf3c('0x3'));router[_0xdf3c('0x4')](_0xdf3c('0x5'),auth['isAuthenticated'](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x7')]);router[_0xdf3c('0x4')]('/hangup',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x9')]);router[_0xdf3c('0x4')](_0xdf3c('0xa'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xb')]);router['post']('/hold',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller['hold']);router[_0xdf3c('0x4')](_0xdf3c('0xc'),auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0x4')](_0xdf3c('0xe'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x4')](_0xdf3c('0x10'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index f60ca6c..5ae21e0 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 _0x5fff=['originate','body','length','json','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','validate','userId','format','user:%s','webbar:hangup','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','calls','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','client','http','ioredis','redis','defaults','localhost','socket.io-emitter','number','string','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','send','status','NotFound','request','then','message','result','catch','User','findOne','agent','VoiceChannels','all','rows','sessionId','sessionId\x20','\x20not\x20found!'];(function(_0x35aea3,_0x10de27){var _0x4082ad=function(_0x501260){while(--_0x501260){_0x35aea3['push'](_0x35aea3['shift']());}};_0x4082ad(++_0x10de27);}(_0x5fff,0x194));var _0xf5ff=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x5fff[_0x1deb03];return _0x189fe7;};'use strict';var path=require(_0xf5ff('0x0'));var fs=require('fs');var _=require(_0xf5ff('0x1'));var db=require(_0xf5ff('0x2'))['db'];var config=require(_0xf5ff('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0xf5ff('0x4')][_0xf5ff('0x5')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0xf5ff('0x6'));config[_0xf5ff('0x7')]=_[_0xf5ff('0x8')](config['redis'],{'host':_0xf5ff('0x9'),'port':0x18eb});var io=require(_0xf5ff('0xa'))(new Redis(config[_0xf5ff('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf5ff('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xf5ff('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0xf5ff('0xb'),'required':[!![],_0xf5ff('0xd')]},'sessionId':{'type':_0xf5ff('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf5ff('0xb'),'required':[!![],_0xf5ff('0xd')]},'sessionId':{'type':_0xf5ff('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf5ff('0xb'),'required':[!![],_0xf5ff('0xd')]},'sessionId':{'type':_0xf5ff('0xc'),'required':[!![],_0xf5ff('0xe')]},'transferNumber':{'type':_0xf5ff('0xc'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf5ff('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf5ff('0xd')]},'sessionId':{'type':_0xf5ff('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf5ff('0xb'),'required':[!![],_0xf5ff('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf5ff('0xd')]}});function emit(_0x2f6003,_0x4699a1,_0x1959d3){logger[_0xf5ff('0xf')](_0x2f6003,_0x4699a1,JSON[_0xf5ff('0x10')](_0x1959d3));io['to'](_0x2f6003)[_0xf5ff('0x11')](_0x4699a1,_0x1959d3);}function handleError(_0x150412){return function(_0x5bf469){console[_0xf5ff('0x12')](_0xf5ff('0x13'),_0x5bf469,_0x5bf469 instanceof RangeError);logger[_0xf5ff('0x14')](_0x5bf469[_0xf5ff('0x15')]);if(_0x5bf469 instanceof RangeError){if(_0x5bf469[_0xf5ff('0x16')]){delete _0x5bf469[_0xf5ff('0x16')];}_0x150412['status'](0x194)[_0xf5ff('0x17')](_0x5bf469);}else{if(_0x5bf469[_0xf5ff('0x16')]){delete _0x5bf469[_0xf5ff('0x16')];}_0x150412[_0xf5ff('0x18')](0x1f4)[_0xf5ff('0x17')](_0x5bf469);}};}function checkError(){return function(_0x2849ac){if(!_0x2849ac){throw new RangeError(_0xf5ff('0x19'));}return _0x2849ac;};}function respondWithRpcPromise(_0x42183c,_0x2cd5b7){return new BPromise(function(_0x4ec677,_0x4da404){var _0x4fbb55=amiClient;return _0x4fbb55[_0xf5ff('0x1a')](_0x42183c,_0x2cd5b7)[_0xf5ff('0x1b')](function(_0x328bee){if(_0x328bee[_0xf5ff('0x14')]){if(_0x328bee[_0xf5ff('0x14')]['code']===0x1f4){return _0x4da404(_0x328bee[_0xf5ff('0x14')][_0xf5ff('0x1c')]);}return _0x4ec677(_0x328bee[_0xf5ff('0x14')]['message']);}else{_0x4ec677(_0x328bee[_0xf5ff('0x1d')]);}})[_0xf5ff('0x1e')](function(_0x132f27){_0x4da404(_0x132f27);});});}function getAgent(_0x38af5a){return db[_0xf5ff('0x1f')][_0xf5ff('0x20')]({'where':{'id':_0x38af5a,'role':_0xf5ff('0x21')}})[_0xf5ff('0x1b')](checkError());}function getAgentCheckSession(_0xe8d9a4,_0x43b05a){return new BPromise(function(_0x2240f5,_0x3bec59){var _0x5cc736=respondWithRpcPromise(_0xf5ff('0x22'));var _0x176e9b=getAgent(_0xe8d9a4);Promise[_0xf5ff('0x23')]([_0x5cc736,_0x176e9b])[_0xf5ff('0x1b')](function(_0x22a13d){var _0x915f2b=_0x22a13d[0x0];var _0x2b3926=_0x22a13d[0x1];var _0x393036=_['filter'](_0x915f2b[_0xf5ff('0x24')],function(_0x310150){return _0x310150['UserId']==_0x2b3926['id']&&_0x310150[_0xf5ff('0x25')]==_0x43b05a;});if(_0x393036['length']==0x1){_0x2240f5(_0x2b3926);}else{_0x3bec59(new RangeError(_0xf5ff('0x26')+_0x43b05a+_0xf5ff('0x27')));}});});}exports[_0xf5ff('0x28')]=function(_0x332487,_0x46d118){logger[_0xf5ff('0xf')]('originate\x20fired:',_0x332487[_0xf5ff('0x29')]);var _0x14bd94=originateValidation['validate'](_0x332487[_0xf5ff('0x29')]);if(_0x14bd94[_0xf5ff('0x2a')]>0x0){return _0x46d118[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x14bd94);}var _0x21481d=_0x332487[_0xf5ff('0x29')]['userId'];var _0x45c843=_0x332487['body'][_0xf5ff('0x2c')];var _0x2207f0=_0x332487['body'][_0xf5ff('0x2d')];var _0x5a7f1d=_0x332487[_0xf5ff('0x29')][_0xf5ff('0x2e')];return getAgent(_0x21481d)[_0xf5ff('0x1b')](function(_0xe5b008){logger['info'](_0xf5ff('0x2f'),_0xe5b008['name']);emit(util['format']('user:%s',_0xe5b008[_0xf5ff('0x16')]),_0xf5ff('0x30'),{'callNumber':_0x45c843,'callerId':_0x2207f0,'callbackUrl':_0x5a7f1d});return _0x46d118[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':_0xf5ff('0x31')});})[_0xf5ff('0x1e')](handleError(_0x46d118));};exports[_0xf5ff('0x32')]=function(_0x2ab22f,_0x2f5f24){logger[_0xf5ff('0xf')](_0xf5ff('0x33'),_0x2ab22f[_0xf5ff('0x29')]);var _0x58fd54=hangupValidation[_0xf5ff('0x34')](_0x2ab22f[_0xf5ff('0x29')]);if(_0x58fd54[_0xf5ff('0x2a')]>0x0){return _0x2f5f24[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x58fd54);}var _0x5a8de4=_0x2ab22f[_0xf5ff('0x29')][_0xf5ff('0x35')];var _0x26f043=_0x2ab22f[_0xf5ff('0x29')][_0xf5ff('0x25')];return getAgent(_0x5a8de4)[_0xf5ff('0x1b')](function(_0xbf30b0){logger[_0xf5ff('0xf')]('entityFound:',_0xbf30b0[_0xf5ff('0x16')]);emit(util[_0xf5ff('0x36')](_0xf5ff('0x37'),_0xbf30b0[_0xf5ff('0x16')]),_0xf5ff('0x38'),{'sessionId':_0x26f043});return _0x2f5f24[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':'hangup\x20executed!'});})[_0xf5ff('0x1e')](handleError(_0x2f5f24));};exports['answer']=function(_0x2a9715,_0x5b7778){logger[_0xf5ff('0xf')](_0xf5ff('0x39'),_0x2a9715['body']);var _0x53a0be=answerValidation[_0xf5ff('0x34')](_0x2a9715[_0xf5ff('0x29')]);if(_0x53a0be[_0xf5ff('0x2a')]>0x0){return _0x5b7778[_0xf5ff('0x18')](0x190)['json'](_0x53a0be);}var _0x5be3ea=_0x2a9715[_0xf5ff('0x29')]['userId'];var _0x58e535=_0x2a9715[_0xf5ff('0x29')][_0xf5ff('0x25')];return getAgent(_0x5be3ea)[_0xf5ff('0x1b')](function(_0xa4608){logger[_0xf5ff('0xf')](_0xf5ff('0x2f'),_0xa4608[_0xf5ff('0x16')]);emit(util['format']('user:%s',_0xa4608[_0xf5ff('0x16')]),_0xf5ff('0x3a'),{'sessionId':_0x58e535});return _0x5b7778[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':_0xf5ff('0x3b')});})[_0xf5ff('0x1e')](handleError(_0x5b7778));};exports[_0xf5ff('0x3c')]=function(_0xe0f793,_0x338b5c){logger['info']('hold\x20fired:',_0xe0f793[_0xf5ff('0x29')]);var _0x29adc8=holdValidation[_0xf5ff('0x34')](_0xe0f793[_0xf5ff('0x29')]);if(_0x29adc8['length']>0x0){return _0x338b5c[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x29adc8);}var _0x5a8721=_0xe0f793[_0xf5ff('0x29')]['userId'];var _0x46a48d=_0xe0f793[_0xf5ff('0x29')][_0xf5ff('0x25')];return getAgent(_0x5a8721)[_0xf5ff('0x1b')](function(_0x255233){logger[_0xf5ff('0xf')](_0xf5ff('0x2f'),_0x255233['name']);emit(util['format'](_0xf5ff('0x37'),_0x255233[_0xf5ff('0x16')]),_0xf5ff('0x3d'),{'sessionId':_0x46a48d});return _0x338b5c[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':_0xf5ff('0x3e')});})[_0xf5ff('0x1e')](handleError(_0x338b5c));};exports[_0xf5ff('0x3f')]=function(_0x558846,_0x507478){logger[_0xf5ff('0xf')]('unhold\x20fired:',_0x558846['body']);var _0x27e7fa=unholdValidation['validate'](_0x558846['body']);if(_0x27e7fa[_0xf5ff('0x2a')]>0x0){return _0x507478[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x27e7fa);}var _0x513688=_0x558846[_0xf5ff('0x29')][_0xf5ff('0x35')];var _0x413a1c=_0x558846['body'][_0xf5ff('0x25')];return getAgent(_0x513688)['then'](function(_0x1e675c){logger['info']('entityFound:',_0x1e675c[_0xf5ff('0x16')]);emit(util[_0xf5ff('0x36')](_0xf5ff('0x37'),_0x1e675c[_0xf5ff('0x16')]),'webbar:unhold',{'sessionId':_0x413a1c});return _0x507478[_0xf5ff('0x18')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x507478));};exports[_0xf5ff('0x40')]=function(_0x2fc6fc,_0x4eb687){logger[_0xf5ff('0xf')]('calls\x20fired:',_0x4eb687['body']);var _0x288fba=callsValidation[_0xf5ff('0x34')](_0x2fc6fc[_0xf5ff('0x29')]);if(_0x288fba[_0xf5ff('0x2a')]>0x0){return _0x4eb687[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x288fba);}var _0x9e8975=_0x2fc6fc[_0xf5ff('0x29')][_0xf5ff('0x35')];var _0x14b293=respondWithRpcPromise(_0xf5ff('0x22'));var _0x1bacb9=getAgent(_0x9e8975);return Promise[_0xf5ff('0x23')]([_0x14b293,_0x1bacb9])[_0xf5ff('0x1b')](function(_0x3de657){var _0x5b0977=_0x3de657[0x0];var _0x1b32d5=_0x3de657[0x1];var _0x520731=_['filter'](_0x5b0977[_0xf5ff('0x24')],function(_0x576903){return _0x576903[_0xf5ff('0x41')]==_0x1b32d5['id'];});return _0x4eb687[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'count':_0x520731['length'],'rows':_0x520731});})['catch'](handleError(_0x4eb687));};exports[_0xf5ff('0x42')]=function(_0x38a2b6,_0x4f86f6){logger[_0xf5ff('0xf')](_0xf5ff('0x43'),_0x38a2b6[_0xf5ff('0x29')]);var _0x5bd112=conferenceValidation['validate'](_0x38a2b6['body']);if(_0x5bd112['length']>0x0){return _0x4f86f6[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x5bd112);}var _0xe50f67=_0x38a2b6[_0xf5ff('0x29')]['userId'];return getAgent(_0xe50f67)[_0xf5ff('0x1b')](function(_0x139dce){logger[_0xf5ff('0xf')]('entityFound:',_0x139dce[_0xf5ff('0x16')]);emit(util[_0xf5ff('0x36')](_0xf5ff('0x37'),_0x139dce[_0xf5ff('0x16')]),_0xf5ff('0x44'));return _0x4f86f6[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':_0xf5ff('0x45')});})[_0xf5ff('0x1e')](handleError(_0x4f86f6));};exports[_0xf5ff('0x46')]=function(_0x403dae,_0x1c6504){logger[_0xf5ff('0xf')](_0xf5ff('0x47'),_0x403dae[_0xf5ff('0x29')]);var _0x365a82=transferValidation[_0xf5ff('0x34')](_0x403dae[_0xf5ff('0x29')]);if(_0x365a82[_0xf5ff('0x2a')]>0x0){return _0x1c6504[_0xf5ff('0x18')](0x190)['json'](_0x365a82);}var _0x2d9108=_0x403dae[_0xf5ff('0x29')][_0xf5ff('0x35')];var _0x453c2d=_0x403dae['body'][_0xf5ff('0x25')];var _0x564cc2=_0x403dae[_0xf5ff('0x29')][_0xf5ff('0x48')];return getAgent(_0x2d9108)[_0xf5ff('0x1b')](function(_0x1b9555){logger[_0xf5ff('0xf')](_0xf5ff('0x2f'),_0x1b9555[_0xf5ff('0x16')]);emit(util[_0xf5ff('0x36')]('user:%s',_0x1b9555['name']),'webbar:transfer',{'sessionId':_0x453c2d,'transferNumber':_0x564cc2});return _0x1c6504[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':_0xf5ff('0x49')});})['catch'](handleError(_0x1c6504));}; \ No newline at end of file +var _0x0711=['client','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','send','name','NotFound','then','error','message','result','catch','User','all','rows','UserId','sessionId','length','originate','originate\x20fired:','body','validate','status','json','userId','callNumber','entityFound:','format','webbar:originate','originate\x20executed!','hangup','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','bluebird','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0711,0x1e5));var _0x1071=function(_0xa481cf,_0x1da738){_0xa481cf=_0xa481cf-0x0;var _0x5625fc=_0x0711[_0xa481cf];return _0x5625fc;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x1071('0x0'));var db=require(_0x1071('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x1071('0x2'));var BPromise=require(_0x1071('0x3'));var jayson=require(_0x1071('0x4'));var amiClient=jayson[_0x1071('0x5')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0x1071('0x6'));var Redis=require(_0x1071('0x7'));config['redis']=_[_0x1071('0x8')](config[_0x1071('0x9')],{'host':_0x1071('0xa'),'port':0x18eb});var io=require(_0x1071('0xb'))(new Redis(config[_0x1071('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],_0x1071('0xd')]},'callNumber':{'type':_0x1071('0xe'),'required':[!![],_0x1071('0xf')]},'callerId':{'type':_0x1071('0xe')},'callbackUrl':{'type':_0x1071('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1071('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],_0x1071('0xd')]},'sessionId':{'type':_0x1071('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],_0x1071('0xd')]},'sessionId':{'type':_0x1071('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x1071('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1071('0xd')]},'sessionId':{'type':_0x1071('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1071('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],_0x1071('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1071('0xd')]}});function emit(_0x3882d2,_0x26eb97,_0x30342a){logger[_0x1071('0x11')](_0x3882d2,_0x26eb97,JSON[_0x1071('0x12')](_0x30342a));io['to'](_0x3882d2)[_0x1071('0x13')](_0x26eb97,_0x30342a);}function handleError(_0x3cf2c6){return function(_0x9ecde1){console[_0x1071('0x14')]('handleError:',_0x9ecde1,_0x9ecde1 instanceof RangeError);logger['error'](_0x9ecde1['stack']);if(_0x9ecde1 instanceof RangeError){if(_0x9ecde1['name']){delete _0x9ecde1['name'];}_0x3cf2c6['status'](0x194)[_0x1071('0x15')](_0x9ecde1);}else{if(_0x9ecde1[_0x1071('0x16')]){delete _0x9ecde1[_0x1071('0x16')];}_0x3cf2c6['status'](0x1f4)[_0x1071('0x15')](_0x9ecde1);}};}function checkError(){return function(_0x4e3e3f){if(!_0x4e3e3f){throw new RangeError(_0x1071('0x17'));}return _0x4e3e3f;};}function respondWithRpcPromise(_0x4fe87d,_0x231302){return new BPromise(function(_0x2f4ffa,_0xa2571){var _0x41dd3f=amiClient;return _0x41dd3f['request'](_0x4fe87d,_0x231302)[_0x1071('0x18')](function(_0x38a571){if(_0x38a571[_0x1071('0x19')]){if(_0x38a571[_0x1071('0x19')]['code']===0x1f4){return _0xa2571(_0x38a571[_0x1071('0x19')]['message']);}return _0x2f4ffa(_0x38a571[_0x1071('0x19')][_0x1071('0x1a')]);}else{_0x2f4ffa(_0x38a571[_0x1071('0x1b')]);}})[_0x1071('0x1c')](function(_0x5814d7){_0xa2571(_0x5814d7);});});}function getAgent(_0x2425a0){return db[_0x1071('0x1d')]['findOne']({'where':{'id':_0x2425a0,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x2d7750,_0x486865){return new BPromise(function(_0x5e1750,_0x541707){var _0x4cb21d=respondWithRpcPromise('VoiceChannels');var _0x2462ab=getAgent(_0x2d7750);Promise[_0x1071('0x1e')]([_0x4cb21d,_0x2462ab])[_0x1071('0x18')](function(_0x456be9){var _0x57faa5=_0x456be9[0x0];var _0x996eae=_0x456be9[0x1];var _0x2bf46d=_['filter'](_0x57faa5[_0x1071('0x1f')],function(_0x1f266b){return _0x1f266b[_0x1071('0x20')]==_0x996eae['id']&&_0x1f266b[_0x1071('0x21')]==_0x486865;});if(_0x2bf46d[_0x1071('0x22')]==0x1){_0x5e1750(_0x996eae);}else{_0x541707(new RangeError('sessionId\x20'+_0x486865+'\x20not\x20found!'));}});});}exports[_0x1071('0x23')]=function(_0x4cc2fc,_0x2fd7ea){logger['info'](_0x1071('0x24'),_0x4cc2fc[_0x1071('0x25')]);var _0x45c829=originateValidation[_0x1071('0x26')](_0x4cc2fc[_0x1071('0x25')]);if(_0x45c829['length']>0x0){return _0x2fd7ea[_0x1071('0x27')](0x190)[_0x1071('0x28')](_0x45c829);}var _0x241cb8=_0x4cc2fc['body'][_0x1071('0x29')];var _0x5c6995=_0x4cc2fc[_0x1071('0x25')][_0x1071('0x2a')];var _0x5e578e=_0x4cc2fc[_0x1071('0x25')]['callerId'];var _0x344fc3=_0x4cc2fc[_0x1071('0x25')]['callbackUrl'];return getAgent(_0x241cb8)[_0x1071('0x18')](function(_0xa83950){logger[_0x1071('0x11')](_0x1071('0x2b'),_0xa83950[_0x1071('0x16')]);emit(util[_0x1071('0x2c')]('user:%s',_0xa83950['name']),_0x1071('0x2d'),{'callNumber':_0x5c6995,'callerId':_0x5e578e,'callbackUrl':_0x344fc3});return _0x2fd7ea[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'error':![],'message':_0x1071('0x2e')});})[_0x1071('0x1c')](handleError(_0x2fd7ea));};exports[_0x1071('0x2f')]=function(_0x4686ba,_0x3d545f){logger[_0x1071('0x11')]('hangup\x20fired:',_0x4686ba[_0x1071('0x25')]);var _0x1515d7=hangupValidation['validate'](_0x4686ba['body']);if(_0x1515d7['length']>0x0){return _0x3d545f[_0x1071('0x27')](0x190)[_0x1071('0x28')](_0x1515d7);}var _0x19fbd4=_0x4686ba[_0x1071('0x25')][_0x1071('0x29')];var _0x15a657=_0x4686ba[_0x1071('0x25')]['sessionId'];return getAgent(_0x19fbd4)[_0x1071('0x18')](function(_0x593c99){logger[_0x1071('0x11')](_0x1071('0x2b'),_0x593c99[_0x1071('0x16')]);emit(util[_0x1071('0x2c')](_0x1071('0x30'),_0x593c99[_0x1071('0x16')]),_0x1071('0x31'),{'sessionId':_0x15a657});return _0x3d545f[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'error':![],'message':'hangup\x20executed!'});})[_0x1071('0x1c')](handleError(_0x3d545f));};exports[_0x1071('0x32')]=function(_0x5d15b7,_0x5001bd){logger['info'](_0x1071('0x33'),_0x5d15b7[_0x1071('0x25')]);var _0x1c632c=answerValidation[_0x1071('0x26')](_0x5d15b7[_0x1071('0x25')]);if(_0x1c632c[_0x1071('0x22')]>0x0){return _0x5001bd[_0x1071('0x27')](0x190)['json'](_0x1c632c);}var _0xfcf4fd=_0x5d15b7['body'][_0x1071('0x29')];var _0x2f5190=_0x5d15b7[_0x1071('0x25')][_0x1071('0x21')];return getAgent(_0xfcf4fd)['then'](function(_0x42e308){logger[_0x1071('0x11')]('entityFound:',_0x42e308['name']);emit(util[_0x1071('0x2c')](_0x1071('0x30'),_0x42e308['name']),_0x1071('0x34'),{'sessionId':_0x2f5190});return _0x5001bd['status'](0xc8)[_0x1071('0x28')]({'error':![],'message':_0x1071('0x35')});})[_0x1071('0x1c')](handleError(_0x5001bd));};exports[_0x1071('0x36')]=function(_0x5e082e,_0x400647){logger[_0x1071('0x11')](_0x1071('0x37'),_0x5e082e[_0x1071('0x25')]);var _0x39dfbe=holdValidation[_0x1071('0x26')](_0x5e082e[_0x1071('0x25')]);if(_0x39dfbe[_0x1071('0x22')]>0x0){return _0x400647[_0x1071('0x27')](0x190)[_0x1071('0x28')](_0x39dfbe);}var _0x141822=_0x5e082e['body']['userId'];var _0x4bc3bf=_0x5e082e['body'][_0x1071('0x21')];return getAgent(_0x141822)[_0x1071('0x18')](function(_0x52f218){logger[_0x1071('0x11')]('entityFound:',_0x52f218['name']);emit(util[_0x1071('0x2c')]('user:%s',_0x52f218[_0x1071('0x16')]),_0x1071('0x38'),{'sessionId':_0x4bc3bf});return _0x400647[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'error':![],'message':_0x1071('0x39')});})[_0x1071('0x1c')](handleError(_0x400647));};exports['unhold']=function(_0x5ae9a2,_0x55251b){logger['info']('unhold\x20fired:',_0x5ae9a2[_0x1071('0x25')]);var _0x85d9a3=unholdValidation[_0x1071('0x26')](_0x5ae9a2[_0x1071('0x25')]);if(_0x85d9a3[_0x1071('0x22')]>0x0){return _0x55251b[_0x1071('0x27')](0x190)['json'](_0x85d9a3);}var _0x4120f3=_0x5ae9a2[_0x1071('0x25')][_0x1071('0x29')];var _0x5ea9de=_0x5ae9a2[_0x1071('0x25')][_0x1071('0x21')];return getAgent(_0x4120f3)[_0x1071('0x18')](function(_0x35b39a){logger[_0x1071('0x11')](_0x1071('0x2b'),_0x35b39a[_0x1071('0x16')]);emit(util['format'](_0x1071('0x30'),_0x35b39a[_0x1071('0x16')]),_0x1071('0x3a'),{'sessionId':_0x5ea9de});return _0x55251b[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'error':![],'message':_0x1071('0x3b')});})[_0x1071('0x1c')](handleError(_0x55251b));};exports[_0x1071('0x3c')]=function(_0x343cf3,_0x5a66f1){logger[_0x1071('0x11')](_0x1071('0x3d'),_0x5a66f1[_0x1071('0x25')]);var _0xccf35d=callsValidation[_0x1071('0x26')](_0x343cf3['body']);if(_0xccf35d[_0x1071('0x22')]>0x0){return _0x5a66f1[_0x1071('0x27')](0x190)[_0x1071('0x28')](_0xccf35d);}var _0x47cb65=_0x343cf3['body']['userId'];var _0x52496a=respondWithRpcPromise(_0x1071('0x3e'));var _0x5d5238=getAgent(_0x47cb65);return Promise['all']([_0x52496a,_0x5d5238])[_0x1071('0x18')](function(_0xbc01a2){var _0x23c7ca=_0xbc01a2[0x0];var _0x19b799=_0xbc01a2[0x1];var _0x1fdfe3=_['filter'](_0x23c7ca[_0x1071('0x1f')],function(_0xc62827){return _0xc62827[_0x1071('0x20')]==_0x19b799['id'];});return _0x5a66f1[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'count':_0x1fdfe3[_0x1071('0x22')],'rows':_0x1fdfe3});})[_0x1071('0x1c')](handleError(_0x5a66f1));};exports[_0x1071('0x3f')]=function(_0x5a70a7,_0x587cf8){logger[_0x1071('0x11')](_0x1071('0x40'),_0x5a70a7[_0x1071('0x25')]);var _0x17e142=conferenceValidation[_0x1071('0x26')](_0x5a70a7['body']);if(_0x17e142['length']>0x0){return _0x587cf8[_0x1071('0x27')](0x190)[_0x1071('0x28')](_0x17e142);}var _0x4b5744=_0x5a70a7['body'][_0x1071('0x29')];return getAgent(_0x4b5744)[_0x1071('0x18')](function(_0x2179e7){logger[_0x1071('0x11')](_0x1071('0x2b'),_0x2179e7[_0x1071('0x16')]);emit(util['format']('user:%s',_0x2179e7[_0x1071('0x16')]),'webbar:conference');return _0x587cf8['status'](0xc8)['json']({'error':![],'message':_0x1071('0x41')});})[_0x1071('0x1c')](handleError(_0x587cf8));};exports[_0x1071('0x42')]=function(_0x6f6b22,_0x5a5ff6){logger[_0x1071('0x11')]('transfer\x20fired:',_0x6f6b22[_0x1071('0x25')]);var _0x387311=transferValidation[_0x1071('0x26')](_0x6f6b22['body']);if(_0x387311[_0x1071('0x22')]>0x0){return _0x5a5ff6['status'](0x190)['json'](_0x387311);}var _0x14e7fb=_0x6f6b22['body']['userId'];var _0xae3b8=_0x6f6b22[_0x1071('0x25')][_0x1071('0x21')];var _0x5cd2ae=_0x6f6b22[_0x1071('0x25')][_0x1071('0x43')];return getAgent(_0x14e7fb)[_0x1071('0x18')](function(_0x365447){logger['info'](_0x1071('0x2b'),_0x365447[_0x1071('0x16')]);emit(util[_0x1071('0x2c')](_0x1071('0x30'),_0x365447[_0x1071('0x16')]),_0x1071('0x44'),{'sessionId':_0xae3b8,'transferNumber':_0x5cd2ae});return _0x5a5ff6[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'error':![],'message':_0x1071('0x45')});})[_0x1071('0x1c')](handleError(_0x5a5ff6));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 2240898..93f9fdd 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 _0x12ae=['/describe','describe','/:id','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','exports','util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0x4d1e5c,_0x573b42){var _0x2bb572=function(_0xe8f1ab){while(--_0xe8f1ab){_0x4d1e5c['push'](_0x4d1e5c['shift']());}};_0x2bb572(++_0x573b42);}(_0x12ae,0x15f));var _0xe12a=function(_0x2ac986,_0x1c34e2){_0x2ac986=_0x2ac986-0x0;var _0x28f5fa=_0x12ae[_0x2ac986];return _0x28f5fa;};'use strict';var multer=require('multer');var util=require(_0xe12a('0x0'));var path=require(_0xe12a('0x1'));var timeout=require('connect-timeout');var express=require(_0xe12a('0x2'));var router=express[_0xe12a('0x3')]();var fs_extra=require(_0xe12a('0x4'));var auth=require(_0xe12a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0xe12a('0x6')]('/',auth[_0xe12a('0x7')](),controller[_0xe12a('0x8')]);router[_0xe12a('0x6')](_0xe12a('0x9'),auth[_0xe12a('0x7')](),controller[_0xe12a('0xa')]);router['get'](_0xe12a('0xb'),auth[_0xe12a('0x7')](),controller['show']);router['get']('/:id/dispositions',auth[_0xe12a('0x7')](),controller[_0xe12a('0xc')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xe12a('0xd')]);router['get'](_0xe12a('0xe'),auth[_0xe12a('0x7')](),controller[_0xe12a('0xf')]);router[_0xe12a('0x6')](_0xe12a('0x10'),auth['isAuthenticated'](),controller[_0xe12a('0x11')]);router[_0xe12a('0x12')]('/',auth[_0xe12a('0x7')](),controller[_0xe12a('0x13')]);router[_0xe12a('0x12')](_0xe12a('0x14'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x15')]);router[_0xe12a('0x12')](_0xe12a('0x16'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x17')]);router[_0xe12a('0x12')]('/:id/users',auth[_0xe12a('0x7')](),controller[_0xe12a('0x18')]);router[_0xe12a('0x12')](_0xe12a('0x10'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x19')]);router[_0xe12a('0x12')](_0xe12a('0x1a'),controller[_0xe12a('0x1b')]);router[_0xe12a('0x12')](_0xe12a('0x1c'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x1d')]);router[_0xe12a('0x1e')](_0xe12a('0xb'),auth['isAuthenticated'](),controller[_0xe12a('0x1f')]);router[_0xe12a('0x20')](_0xe12a('0xb'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x21')]);router[_0xe12a('0x20')](_0xe12a('0x14'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x22')]);router[_0xe12a('0x20')](_0xe12a('0x16'),auth[_0xe12a('0x7')](),controller['removeAnswers']);router['delete'](_0xe12a('0xe'),auth[_0xe12a('0x7')](),controller['removeAgents']);module[_0xe12a('0x23')]=router; \ No newline at end of file +var _0xcfdf=['/:id/notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','getApplications','create','post','addDisposition','addAnswer','/:id/users','/:id/applications'];(function(_0x1aa848,_0x394c9f){var _0x1054c5=function(_0x2619bd){while(--_0x2619bd){_0x1aa848['push'](_0x1aa848['shift']());}};_0x1054c5(++_0x394c9f);}(_0xcfdf,0x196));var _0xfcfd=function(_0x448e50,_0x10e622){_0x448e50=_0x448e50-0x0;var _0x1b12e7=_0xcfdf[_0x448e50];return _0x1b12e7;};'use strict';var multer=require('multer');var util=require(_0xfcfd('0x0'));var path=require(_0xfcfd('0x1'));var timeout=require(_0xfcfd('0x2'));var express=require(_0xfcfd('0x3'));var router=express['Router']();var fs_extra=require(_0xfcfd('0x4'));var auth=require(_0xfcfd('0x5'));var interaction=require(_0xfcfd('0x6'));var config=require(_0xfcfd('0x7'));var controller=require(_0xfcfd('0x8'));router[_0xfcfd('0x9')]('/',auth[_0xfcfd('0xa')](),controller['index']);router[_0xfcfd('0x9')](_0xfcfd('0xb'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0xc')]);router[_0xfcfd('0x9')](_0xfcfd('0xd'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0xe')]);router[_0xfcfd('0x9')](_0xfcfd('0xf'),auth['isAuthenticated'](),controller[_0xfcfd('0x10')]);router[_0xfcfd('0x9')](_0xfcfd('0x11'),auth[_0xfcfd('0xa')](),controller['getAnswers']);router['get']('/:id/users',auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x12')]);router[_0xfcfd('0x9')]('/:id/applications',auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x13')]);router['post']('/',auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x14')]);router[_0xfcfd('0x15')]('/:id/dispositions',auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x16')]);router[_0xfcfd('0x15')](_0xfcfd('0x11'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x17')]);router['post'](_0xfcfd('0x18'),auth[_0xfcfd('0xa')](),controller['addAgents']);router[_0xfcfd('0x15')](_0xfcfd('0x19'),auth[_0xfcfd('0xa')](),controller['addApplications']);router['post'](_0xfcfd('0x1a'),controller['notify']);router[_0xfcfd('0x15')](_0xfcfd('0x1b'),auth['isAuthenticated'](),controller[_0xfcfd('0x1c')]);router[_0xfcfd('0x1d')](_0xfcfd('0xd'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x1e')]);router['delete']('/:id',auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x1f')]);router[_0xfcfd('0x20')](_0xfcfd('0xf'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x21')]);router['delete'](_0xfcfd('0x11'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x22')]);router[_0xfcfd('0x20')](_0xfcfd('0x18'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xfcfd('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 054b9a0..5ea9df8 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 _0xed08=['mandatoryDisposition','randomstring','exports','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x2b948f,_0x398e62){var _0x1237bc=function(_0x3c1843){while(--_0x3c1843){_0x2b948f['push'](_0x2b948f['shift']());}};_0x1237bc(++_0x398e62);}(_0xed08,0x67));var _0x8ed0=function(_0x4157d8,_0x418891){_0x4157d8=_0x4157d8-0x0;var _0x28ed08=_0xed08[_0x4157d8];return _0x28ed08;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8ed0('0x0'));module[_0x8ed0('0x1')]={'name':{'type':Sequelize[_0x8ed0('0x2')],'unique':_0x8ed0('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8ed0('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x8ed0('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x8ed0('0x2')],'defaultValue':function(){return rs[_0x8ed0('0x4')]();}},'phone':{'type':Sequelize[_0x8ed0('0x2')]},'type':{'type':Sequelize[_0x8ed0('0x5')](_0x8ed0('0x6'),_0x8ed0('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x8ed0('0x2')]},'authToken':{'type':Sequelize[_0x8ed0('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8ed0('0x8')],'defaultValue':function(){return _0x8ed0('0x9');}},'notificationSound':{'type':Sequelize[_0x8ed0('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8ed0('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8ed0('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8ed0('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8ed0('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8ed0('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8ed0('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8ed0('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x8ed0('0xa')],'defaultValue':![],'comment':_0x8ed0('0xd'),'set':function(_0x3a48ff){if(!_0x3a48ff){this[_0x8ed0('0xe')](_0x8ed0('0xf'),null);}this[_0x8ed0('0xe')](_0x8ed0('0x10'),_0x3a48ff);}},'description':{'type':Sequelize[_0x8ed0('0x2')]}}; \ No newline at end of file +var _0x4bb9=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','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'];(function(_0x339bf6,_0x1bd76c){var _0xe78da3=function(_0x2fe467){while(--_0x2fe467){_0x339bf6['push'](_0x339bf6['shift']());}};_0xe78da3(++_0x1bd76c);}(_0x4bb9,0x1d2));var _0x94bb=function(_0x295e31,_0x2abadf){_0x295e31=_0x295e31-0x0;var _0x601072=_0x4bb9[_0x295e31];return _0x601072;};'use strict';var Sequelize=require(_0x94bb('0x0'));var rs=require(_0x94bb('0x1'));module[_0x94bb('0x2')]={'name':{'type':Sequelize[_0x94bb('0x3')],'unique':_0x94bb('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x94bb('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x94bb('0x3')],'defaultValue':function(){return rs[_0x94bb('0x5')]();}},'phone':{'type':Sequelize[_0x94bb('0x3')]},'type':{'type':Sequelize[_0x94bb('0x6')](_0x94bb('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0x94bb('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x94bb('0x3')]},'notificationTemplate':{'type':Sequelize[_0x94bb('0x8')],'defaultValue':function(){return _0x94bb('0x9');}},'notificationSound':{'type':Sequelize[_0x94bb('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x94bb('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x94bb('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x94bb('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x94bb('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x94bb('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x94bb('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x94bb('0xb')],'comment':_0x94bb('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x94bb('0xd'),'set':function(_0x215a9e){if(!_0x215a9e){this[_0x94bb('0xe')](_0x94bb('0xf'),null);}this[_0x94bb('0xe')]('mandatoryDisposition',_0x215a9e);}},'description':{'type':Sequelize[_0x94bb('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 17fed22..8814e6a 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 _0x6426=['Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','Pause','WhatsappAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows','show','mandatoryDispositionPause','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','pick','findAll','removeDispositions','ids','getAnswers','findOne','CannedAnswer','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','notify','Applications','account','statuses','state','WhatsappMessage','message_id','applications','orderBy','asc','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','mobile','from','From','replace','MessageSid','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','DESC','list','omit','defaults','contact','WhatsappInteraction','interaction','autoclose','unmanaged','*,*,*,*','created','ContactId','UserId','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','unshift','queue','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','twilio','Content-Type','CmList','List','ListId','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set'];(function(_0x5abdcb,_0x448754){var _0x260614=function(_0x2cd054){while(--_0x2cd054){_0x5abdcb['push'](_0x5abdcb['shift']());}};_0x260614(++_0x448754);}(_0x6426,0x15b));var _0x6642=function(_0xbd5190,_0x380f7f){_0xbd5190=_0xbd5190-0x0;var _0xcb49ab=_0x6426[_0xbd5190];return _0xcb49ab;};'use strict';var emlformat=require(_0x6642('0x0'));var rimraf=require(_0x6642('0x1'));var zipdir=require(_0x6642('0x2'));var jsonpatch=require(_0x6642('0x3'));var rp=require(_0x6642('0x4'));var moment=require('moment');var BPromise=require(_0x6642('0x5'));var Mustache=require(_0x6642('0x6'));var util=require('util');var path=require(_0x6642('0x7'));var sox=require(_0x6642('0x8'));var csv=require(_0x6642('0x9'));var ejs=require(_0x6642('0xa'));var fs=require('fs');var fs_extra=require(_0x6642('0xb'));var _=require(_0x6642('0xc'));var squel=require('squel');var crypto=require(_0x6642('0xd'));var jsforce=require(_0x6642('0xe'));var deskjs=require(_0x6642('0xf'));var toCsv=require(_0x6642('0x9'));var querystring=require(_0x6642('0x10'));var Papa=require(_0x6642('0x11'));var Redis=require(_0x6642('0x12'));var authService=require(_0x6642('0x13'));var qs=require(_0x6642('0x14'));var as=require(_0x6642('0x15'));var hardwareService=require(_0x6642('0x16'));var logger=require(_0x6642('0x17'))(_0x6642('0x18'));var utils=require('../../config/utils');var config=require(_0x6642('0x19'));var licenseUtil=require(_0x6642('0x1a'));var db=require(_0x6642('0x1b'))['db'];config['redis']=_['defaults'](config[_0x6642('0x1c')],{'host':_0x6642('0x1d'),'port':0x18eb});var socket=require(_0x6642('0x1e'))(new Redis(config[_0x6642('0x1c')]));require(_0x6642('0x1f'))[_0x6642('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6642('0x21')][_0x6642('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x40421f,_0x7371df,_0x76ea55,_0x4679e1){return new BPromise(function(_0x5c15f8,_0x3146e5){var _0x1fba71=_0x4679e1||client;return _0x1fba71[_0x6642('0x23')](_0x40421f,_0x76ea55)[_0x6642('0x24')](function(_0x4e4f9e){logger[_0x6642('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x7371df,_0x6642('0x26'));logger[_0x6642('0x27')](_0x6642('0x28'),_0x7371df,_0x6642('0x26'),JSON['stringify'](_0x4e4f9e));if(_0x4e4f9e[_0x6642('0x29')]){if(_0x4e4f9e['error']['code']===0x1f4){logger[_0x6642('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x7371df,_0x4e4f9e['error']['message']);return _0x3146e5(_0x4e4f9e['error']['message']);}logger[_0x6642('0x29')](_0x6642('0x2a'),_0x7371df,_0x4e4f9e[_0x6642('0x29')][_0x6642('0x2b')]);return _0x5c15f8(_0x4e4f9e[_0x6642('0x29')][_0x6642('0x2b')]);}else{logger[_0x6642('0x25')](_0x6642('0x2a'),_0x7371df,_0x6642('0x26'));_0x5c15f8(_0x4e4f9e[_0x6642('0x2c')][_0x6642('0x2b')]);}})[_0x6642('0x2d')](function(_0x4187c9){logger[_0x6642('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x7371df,_0x4187c9);_0x3146e5(_0x4187c9);});});}function respondWithStatusCode(_0x2fc6d5,_0xd129fd){_0xd129fd=_0xd129fd||0xcc;return function(_0x354410){if(_0x354410){return _0x2fc6d5[_0x6642('0x2e')](_0xd129fd);}return _0x2fc6d5['status'](_0xd129fd)[_0x6642('0x2f')]();};}function respondWithResult(_0x56fa6f,_0x1ff1fd){_0x1ff1fd=_0x1ff1fd||0xc8;return function(_0x4ecd4c){if(_0x4ecd4c){return _0x56fa6f[_0x6642('0x30')](_0x1ff1fd)[_0x6642('0x31')](_0x4ecd4c);}};}function respondWithFilteredResult(_0x5b8a22,_0x16c096){return function(_0x54406c){if(_0x54406c){var _0x31b623=typeof _0x16c096['offset']===_0x6642('0x32')&&typeof _0x16c096[_0x6642('0x33')]===_0x6642('0x32');var _0x54728f=_0x54406c[_0x6642('0x34')];var _0x5b3216=_0x31b623?0x0:_0x16c096['offset'];var _0x17b098=_0x31b623?_0x54406c['count']:_0x16c096[_0x6642('0x35')]+_0x16c096[_0x6642('0x33')];var _0x1d020c;if(_0x17b098>=_0x54728f){_0x17b098=_0x54728f;_0x1d020c=0xc8;}else{_0x1d020c=0xce;}_0x5b8a22[_0x6642('0x30')](_0x1d020c);return _0x5b8a22[_0x6642('0x36')](_0x6642('0x37'),_0x5b3216+'-'+_0x17b098+'/'+_0x54728f)[_0x6642('0x31')](_0x54406c);}return null;};}function patchUpdates(_0x1b4fdd){return function(_0x2cb478){try{jsonpatch[_0x6642('0x38')](_0x2cb478,_0x1b4fdd,!![]);}catch(_0x4a8148){return BPromise[_0x6642('0x39')](_0x4a8148);}return _0x2cb478[_0x6642('0x3a')]();};}function saveUpdates(_0x27c8d2,_0x40f6bd){return function(_0xf285b8){if(_0xf285b8){return _0xf285b8[_0x6642('0x3b')](_0x27c8d2)[_0x6642('0x24')](function(_0x40a050){return _0x40a050;});}return null;};}function removeEntity(_0x34351b,_0x17d38d){return function(_0x350b1c){if(_0x350b1c){return _0x350b1c[_0x6642('0x3c')]()[_0x6642('0x24')](function(){var _0x3e4c31=_0x350b1c[_0x6642('0x3d')]({'plain':!![]});var _0x50f5af=_0x6642('0x3e');return db[_0x6642('0x3f')][_0x6642('0x3c')]({'where':{'type':_0x50f5af,'resourceId':_0x3e4c31['id']}})['then'](function(){return _0x350b1c;});})[_0x6642('0x24')](function(){_0x34351b[_0x6642('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32493e,_0x43a1ff){return function(_0x55f9c6){if(!_0x55f9c6){_0x32493e[_0x6642('0x2e')](0x194);}return _0x55f9c6;};}function handleError(_0x289290,_0x45c147){_0x45c147=_0x45c147||0x1f4;return function(_0x1aba04){logger[_0x6642('0x29')](_0x1aba04['stack']);if(_0x1aba04['name']){delete _0x1aba04[_0x6642('0x40')];}_0x289290['status'](_0x45c147)[_0x6642('0x41')](_0x1aba04);};}exports['index']=function(_0x9789f9,_0x4983a5){var _0x129eff={'include':[{'model':db[_0x6642('0x42')],'as':'mandatoryDispositionPause'}]},_0x4e8077={},_0x4b9ba5={'count':0x0,'rows':[]};var _0x300377=_['map'](db[_0x6642('0x43')][_0x6642('0x44')],function(_0x108eb7){return{'name':_0x108eb7[_0x6642('0x45')],'type':_0x108eb7[_0x6642('0x46')]['key']};});_0x4e8077[_0x6642('0x47')]=_[_0x6642('0x48')](_0x300377,_0x6642('0x40'));_0x4e8077[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x9789f9['query']);_0x4e8077[_0x6642('0x4b')]=_['intersection'](_0x4e8077[_0x6642('0x47')],_0x4e8077[_0x6642('0x49')]);_0x129eff[_0x6642('0x4c')]=_[_0x6642('0x4d')](_0x4e8077['model'],qs['fields'](_0x9789f9[_0x6642('0x49')][_0x6642('0x4e')]));_0x129eff['attributes']=_0x129eff[_0x6642('0x4c')]['length']?_0x129eff[_0x6642('0x4c')]:_0x4e8077[_0x6642('0x47')];if(!_0x9789f9['query'][_0x6642('0x4f')](_0x6642('0x50'))){_0x129eff[_0x6642('0x33')]=qs[_0x6642('0x33')](_0x9789f9[_0x6642('0x49')]['limit']);_0x129eff[_0x6642('0x35')]=qs[_0x6642('0x35')](_0x9789f9[_0x6642('0x49')][_0x6642('0x35')]);}_0x129eff[_0x6642('0x51')]=qs[_0x6642('0x52')](_0x9789f9['query'][_0x6642('0x52')]);_0x129eff[_0x6642('0x53')]=qs[_0x6642('0x4b')](_['pick'](_0x9789f9[_0x6642('0x49')],_0x4e8077[_0x6642('0x4b')]),_0x300377);if(_0x9789f9[_0x6642('0x49')][_0x6642('0x54')]){_0x129eff['where']=_['merge'](_0x129eff['where'],{'$or':_[_0x6642('0x48')](_0x300377,function(_0x1d7591){if(_0x1d7591[_0x6642('0x46')]!=='VIRTUAL'){var _0x5e635f={};_0x5e635f[_0x1d7591['name']]={'$like':'%'+_0x9789f9[_0x6642('0x49')]['filter']+'%'};return _0x5e635f;}})});}_0x129eff=_[_0x6642('0x55')]({},_0x129eff,_0x9789f9['options']);var _0x5ace28={'where':_0x129eff[_0x6642('0x53')]};return db[_0x6642('0x43')][_0x6642('0x34')](_0x5ace28)[_0x6642('0x24')](function(_0x1a1a67){_0x4b9ba5[_0x6642('0x34')]=_0x1a1a67;if(_0x9789f9['query'][_0x6642('0x56')]){_0x129eff[_0x6642('0x57')]=[{'all':!![]}];}return db[_0x6642('0x43')]['findAll'](_0x129eff);})[_0x6642('0x24')](function(_0x6d47b){_0x4b9ba5[_0x6642('0x58')]=_0x6d47b;return _0x4b9ba5;})[_0x6642('0x24')](respondWithFilteredResult(_0x4983a5,_0x129eff))[_0x6642('0x2d')](handleError(_0x4983a5,null));};exports[_0x6642('0x59')]=function(_0x598451,_0x50f3){var _0x19fee0={'raw':![],'where':{'id':_0x598451['params']['id']},'include':[{'model':db[_0x6642('0x42')],'as':_0x6642('0x5a')}]},_0x3d0dc4={};_0x3d0dc4[_0x6642('0x47')]=_[_0x6642('0x4a')](db[_0x6642('0x43')][_0x6642('0x44')]);_0x3d0dc4[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x598451[_0x6642('0x49')]);_0x3d0dc4[_0x6642('0x4b')]=_[_0x6642('0x4d')](_0x3d0dc4[_0x6642('0x47')],_0x3d0dc4[_0x6642('0x49')]);_0x19fee0[_0x6642('0x4c')]=_[_0x6642('0x4d')](_0x3d0dc4[_0x6642('0x47')],qs[_0x6642('0x4e')](_0x598451[_0x6642('0x49')][_0x6642('0x4e')]));_0x19fee0[_0x6642('0x4c')]=_0x19fee0[_0x6642('0x4c')][_0x6642('0x5b')]?_0x19fee0[_0x6642('0x4c')]:_0x3d0dc4[_0x6642('0x47')];if(_0x598451['query'][_0x6642('0x56')]){_0x19fee0[_0x6642('0x57')]=[{'all':!![]}];}_0x19fee0=_[_0x6642('0x55')]({},_0x19fee0,_0x598451[_0x6642('0x5c')]);return db[_0x6642('0x43')][_0x6642('0x5d')](_0x19fee0)[_0x6642('0x24')](handleEntityNotFound(_0x50f3,null))[_0x6642('0x24')](respondWithResult(_0x50f3,null))['catch'](handleError(_0x50f3,null));};exports['create']=function(_0x4c47a0,_0x5a268e){return db[_0x6642('0x43')][_0x6642('0x5e')](_0x4c47a0['body'],{})[_0x6642('0x24')](function(_0x252c1c){var _0x14a261=_0x4c47a0[_0x6642('0x5f')][_0x6642('0x3d')]({'plain':!![]});if(!_0x14a261)throw new Error(_0x6642('0x60'));if(_0x14a261[_0x6642('0x61')]===_0x6642('0x5f')){var _0x25c734=_0x252c1c[_0x6642('0x3d')]({'plain':!![]});var _0x4d03d7=_0x6642('0x3e');return db[_0x6642('0x62')][_0x6642('0x5d')]({'where':{'name':_0x4d03d7,'userProfileId':_0x14a261[_0x6642('0x63')]},'raw':!![]})[_0x6642('0x24')](function(_0x5283f1){if(_0x5283f1&&_0x5283f1['autoAssociation']===0x0){return db[_0x6642('0x3f')]['create']({'name':_0x25c734[_0x6642('0x40')],'resourceId':_0x25c734['id'],'type':_0x5283f1[_0x6642('0x40')],'sectionId':_0x5283f1['id']},{})[_0x6642('0x24')](function(){return _0x252c1c;});}else{return _0x252c1c;}})[_0x6642('0x2d')](function(_0x53f9f0){logger[_0x6642('0x29')](_0x6642('0x64'),_0x53f9f0);throw _0x53f9f0;});}return _0x252c1c;})['then'](respondWithResult(_0x5a268e,0xc9))[_0x6642('0x2d')](handleError(_0x5a268e,null));};exports[_0x6642('0x3b')]=function(_0x138bed,_0x2f9d07){if(_0x138bed[_0x6642('0x65')]['id']){delete _0x138bed[_0x6642('0x65')]['id'];}return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x138bed[_0x6642('0x66')]['id']},'include':[{'model':db[_0x6642('0x42')],'as':_0x6642('0x5a')}]})[_0x6642('0x24')](handleEntityNotFound(_0x2f9d07,null))[_0x6642('0x24')](saveUpdates(_0x138bed[_0x6642('0x65')],null))[_0x6642('0x24')](respondWithResult(_0x2f9d07,null))['catch'](handleError(_0x2f9d07,null));};exports[_0x6642('0x3c')]=function(_0x24e682,_0x2375ce){return db['WhatsappAccount'][_0x6642('0x5d')]({'where':{'id':_0x24e682[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x2375ce,null))['then'](removeEntity(_0x2375ce,null))[_0x6642('0x2d')](handleError(_0x2375ce,null));};exports['describe']=function(_0x52d679,_0x1226ca){return db[_0x6642('0x43')][_0x6642('0x67')]()[_0x6642('0x24')](respondWithResult(_0x1226ca,null))[_0x6642('0x2d')](handleError(_0x1226ca,null));};exports[_0x6642('0x68')]=function(_0x27a59e,_0x5570be,_0x17abbb){if(_0x27a59e[_0x6642('0x65')]['id']){delete _0x27a59e[_0x6642('0x65')]['id'];}return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x27a59e[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x5570be,null))['then'](function(_0x11fe86){if(_0x11fe86){_0x27a59e[_0x6642('0x65')][_0x6642('0x69')]=_0x11fe86['id'];return db[_0x6642('0x6a')][_0x6642('0x5e')](_0x27a59e[_0x6642('0x65')]);}})[_0x6642('0x24')](respondWithResult(_0x5570be,null))['catch'](handleError(_0x5570be,null));};exports[_0x6642('0x6b')]=function(_0x3c127f,_0x2e4a5d,_0x5666eb){var _0x2bd50a={'raw':![],'where':{}};var _0x25ed44={};var _0x449d92={'count':0x0,'rows':[]};return db[_0x6642('0x43')]['findOne']({'where':{'id':_0x3c127f[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x2e4a5d,null))[_0x6642('0x24')](function(_0x257a73){if(_0x257a73){_0x25ed44[_0x6642('0x47')]=_['keys'](db[_0x6642('0x6a')][_0x6642('0x44')]);_0x25ed44[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x3c127f[_0x6642('0x49')]);_0x25ed44[_0x6642('0x4b')]=_['intersection'](_0x25ed44[_0x6642('0x47')],_0x25ed44['query']);_0x2bd50a[_0x6642('0x4c')]=_['intersection'](_0x25ed44[_0x6642('0x47')],qs['fields'](_0x3c127f[_0x6642('0x49')]['fields']));_0x2bd50a[_0x6642('0x4c')]=_0x2bd50a[_0x6642('0x4c')][_0x6642('0x5b')]?_0x2bd50a[_0x6642('0x4c')]:_0x25ed44[_0x6642('0x47')];if(!_0x3c127f[_0x6642('0x49')][_0x6642('0x4f')](_0x6642('0x50'))){_0x2bd50a[_0x6642('0x33')]=qs[_0x6642('0x33')](_0x3c127f[_0x6642('0x49')][_0x6642('0x33')]);_0x2bd50a[_0x6642('0x35')]=qs[_0x6642('0x35')](_0x3c127f[_0x6642('0x49')][_0x6642('0x35')]);}_0x2bd50a[_0x6642('0x51')]=qs[_0x6642('0x52')](_0x3c127f[_0x6642('0x49')][_0x6642('0x52')]);_0x2bd50a[_0x6642('0x53')]=qs[_0x6642('0x4b')](_[_0x6642('0x6c')](_0x3c127f[_0x6642('0x49')],_0x25ed44[_0x6642('0x4b')]));_0x2bd50a['where']['WhatsappAccountId']=_0x257a73['id'];if(_0x3c127f[_0x6642('0x49')][_0x6642('0x54')]){_0x2bd50a[_0x6642('0x53')]=_[_0x6642('0x55')](_0x2bd50a[_0x6642('0x53')],{'$or':_[_0x6642('0x48')](_0x2bd50a[_0x6642('0x4c')],function(_0x3e59bc){var _0x3bb545={};_0x3bb545[_0x3e59bc]={'$like':'%'+_0x3c127f[_0x6642('0x49')][_0x6642('0x54')]+'%'};return _0x3bb545;})});}_0x2bd50a=_[_0x6642('0x55')]({},_0x2bd50a,_0x3c127f['options']);return db[_0x6642('0x6a')][_0x6642('0x34')]({'where':_0x2bd50a[_0x6642('0x53')]})[_0x6642('0x24')](function(_0x5c469a){_0x449d92[_0x6642('0x34')]=_0x5c469a;if(_0x3c127f[_0x6642('0x49')][_0x6642('0x56')]){_0x2bd50a['include']=[{'all':!![]}];}return db[_0x6642('0x6a')][_0x6642('0x6d')](_0x2bd50a);})[_0x6642('0x24')](function(_0x14fca1){_0x449d92[_0x6642('0x58')]=_0x14fca1;return _0x449d92;});}})['then'](respondWithFilteredResult(_0x2e4a5d,_0x2bd50a))[_0x6642('0x2d')](handleError(_0x2e4a5d,null));};exports[_0x6642('0x6e')]=function(_0x5e8b21,_0xac7f36,_0x53a5d2){return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x5e8b21[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0xac7f36,null))[_0x6642('0x24')](function(_0x10657a){if(_0x10657a){return _0x10657a[_0x6642('0x6e')](_0x5e8b21[_0x6642('0x49')][_0x6642('0x6f')]);}})['then'](respondWithStatusCode(_0xac7f36,null))[_0x6642('0x2d')](handleError(_0xac7f36,null));};exports['addAnswer']=function(_0x33451a,_0x28e1b9,_0x2c12f7){if(_0x33451a['body']['id']){delete _0x33451a[_0x6642('0x65')]['id'];}return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x33451a[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x28e1b9,null))[_0x6642('0x24')](function(_0x1ee5f1){if(_0x1ee5f1){_0x33451a[_0x6642('0x65')]['WhatsappAccountId']=_0x1ee5f1['id'];return db['CannedAnswer'][_0x6642('0x5e')](_0x33451a[_0x6642('0x65')]);}})[_0x6642('0x24')](respondWithResult(_0x28e1b9,null))[_0x6642('0x2d')](handleError(_0x28e1b9,null));};exports[_0x6642('0x70')]=function(_0x4895a,_0x3df5fa,_0xf2e650){var _0x5ac1ab={'raw':![],'where':{}};var _0xbc27f={};var _0x433767={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x6642('0x71')]({'where':{'id':_0x4895a[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x3df5fa,null))[_0x6642('0x24')](function(_0x1a9ac2){if(_0x1a9ac2){_0xbc27f[_0x6642('0x47')]=_[_0x6642('0x4a')](db[_0x6642('0x72')][_0x6642('0x44')]);_0xbc27f[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x4895a['query']);_0xbc27f[_0x6642('0x4b')]=_['intersection'](_0xbc27f[_0x6642('0x47')],_0xbc27f['query']);_0x5ac1ab[_0x6642('0x4c')]=_['intersection'](_0xbc27f['model'],qs['fields'](_0x4895a['query']['fields']));_0x5ac1ab[_0x6642('0x4c')]=_0x5ac1ab[_0x6642('0x4c')][_0x6642('0x5b')]?_0x5ac1ab[_0x6642('0x4c')]:_0xbc27f[_0x6642('0x47')];if(!_0x4895a[_0x6642('0x49')][_0x6642('0x4f')]('nolimit')){_0x5ac1ab[_0x6642('0x33')]=qs[_0x6642('0x33')](_0x4895a[_0x6642('0x49')][_0x6642('0x33')]);_0x5ac1ab['offset']=qs[_0x6642('0x35')](_0x4895a[_0x6642('0x49')]['offset']);}_0x5ac1ab['order']=qs['sort'](_0x4895a[_0x6642('0x49')][_0x6642('0x52')]);_0x5ac1ab[_0x6642('0x53')]=qs[_0x6642('0x4b')](_[_0x6642('0x6c')](_0x4895a[_0x6642('0x49')],_0xbc27f[_0x6642('0x4b')]));_0x5ac1ab[_0x6642('0x53')][_0x6642('0x69')]=_0x1a9ac2['id'];if(_0x4895a['query'][_0x6642('0x54')]){_0x5ac1ab[_0x6642('0x53')]=_[_0x6642('0x55')](_0x5ac1ab['where'],{'$or':_[_0x6642('0x48')](_0x5ac1ab['attributes'],function(_0x4777aa){var _0x269a6c={};_0x269a6c[_0x4777aa]={'$like':'%'+_0x4895a[_0x6642('0x49')][_0x6642('0x54')]+'%'};return _0x269a6c;})});}_0x5ac1ab=_['merge']({},_0x5ac1ab,_0x4895a[_0x6642('0x5c')]);return db[_0x6642('0x72')][_0x6642('0x34')]({'where':_0x5ac1ab[_0x6642('0x53')]})[_0x6642('0x24')](function(_0x2b2071){_0x433767['count']=_0x2b2071;if(_0x4895a['query'][_0x6642('0x56')]){_0x5ac1ab[_0x6642('0x57')]=[{'all':!![]}];}return db[_0x6642('0x72')][_0x6642('0x6d')](_0x5ac1ab);})[_0x6642('0x24')](function(_0x5c4ceb){_0x433767[_0x6642('0x58')]=_0x5c4ceb;return _0x433767;});}})[_0x6642('0x24')](respondWithFilteredResult(_0x3df5fa,_0x5ac1ab))[_0x6642('0x2d')](handleError(_0x3df5fa,null));};exports[_0x6642('0x73')]=function(_0xd2bf75,_0x2a5ab6,_0x54751d){return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0xd2bf75[_0x6642('0x66')]['id']}})['then'](handleEntityNotFound(_0x2a5ab6,null))[_0x6642('0x24')](function(_0x1b106c){if(_0x1b106c){return _0x1b106c[_0x6642('0x73')](_0xd2bf75[_0x6642('0x49')]['ids']);}})['then'](respondWithStatusCode(_0x2a5ab6,null))['catch'](handleError(_0x2a5ab6,null));};exports[_0x6642('0x74')]=function(_0x10db83,_0x905827,_0x56ac5e){return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x10db83[_0x6642('0x66')]['id']}})['then'](handleEntityNotFound(_0x905827,null))['then'](function(_0x4f46cb){if(_0x4f46cb){return _0x4f46cb[_0x6642('0x74')](_0x10db83[_0x6642('0x65')][_0x6642('0x6f')],_['omit'](_0x10db83[_0x6642('0x65')],[_0x6642('0x6f'),'id'])||{})[_0x6642('0x75')](function(_0x4c98b7){for(var _0x5898a6=0x0;_0x5898a6<_0x10db83[_0x6642('0x65')][_0x6642('0x6f')]['length'];_0x5898a6+=0x1){socket[_0x6642('0x76')](_0x6642('0x77'),{'UserId':Number(_0x10db83[_0x6642('0x65')][_0x6642('0x6f')][_0x5898a6]),'WhatsappAccountId':Number(_0x10db83['params']['id'])});}return _0x4c98b7;});}})[_0x6642('0x24')](respondWithResult(_0x905827,null))[_0x6642('0x2d')](handleError(_0x905827,null));};exports['removeAgents']=function(_0x18430e,_0x647d45,_0x4d3ff2){return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x18430e['params']['id']}})['then'](handleEntityNotFound(_0x647d45,null))[_0x6642('0x24')](function(_0x23c373){if(_0x23c373){return _0x23c373['removeAgents'](_0x18430e[_0x6642('0x49')][_0x6642('0x6f')])[_0x6642('0x24')](function(){if(_[_0x6642('0x78')](_0x18430e[_0x6642('0x49')]['ids'])){for(var _0x969f3b=0x0;_0x969f3b<_0x18430e['query'][_0x6642('0x6f')][_0x6642('0x5b')];_0x969f3b+=0x1){socket[_0x6642('0x76')](_0x6642('0x79'),{'UserId':Number(_0x18430e[_0x6642('0x49')]['ids'][_0x969f3b]),'WhatsappAccountId':Number(_0x18430e[_0x6642('0x66')]['id'])});}}else{socket[_0x6642('0x76')](_0x6642('0x79'),{'UserId':Number(_0x18430e[_0x6642('0x49')][_0x6642('0x6f')]),'WhatsappAccountId':Number(_0x18430e[_0x6642('0x66')]['id'])});}});}})[_0x6642('0x24')](respondWithStatusCode(_0x647d45,null))[_0x6642('0x2d')](handleError(_0x647d45,null));};exports['getAgents']=function(_0x5646d1,_0x5f909d,_0x3c0873){var _0x17b1c7={};var _0x1c0c89={};var _0xe7e8f8;var _0x5aa560;return db[_0x6642('0x43')][_0x6642('0x71')]({'where':{'id':_0x5646d1[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x5f909d,null))[_0x6642('0x24')](function(_0x2e9ac6){if(_0x2e9ac6){_0xe7e8f8=_0x2e9ac6;_0x1c0c89[_0x6642('0x47')]=_[_0x6642('0x4a')](db[_0x6642('0x7a')][_0x6642('0x44')]);_0x1c0c89[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x5646d1[_0x6642('0x49')]);_0x1c0c89[_0x6642('0x4b')]=_['intersection'](_0x1c0c89['model'],_0x1c0c89['query']);_0x17b1c7['attributes']=_['intersection'](_0x1c0c89['model'],qs[_0x6642('0x4e')](_0x5646d1['query']['fields']));_0x17b1c7['attributes']=_0x17b1c7['attributes']['length']?_0x17b1c7[_0x6642('0x4c')]:_0x1c0c89[_0x6642('0x47')];_0x17b1c7['order']=qs[_0x6642('0x52')](_0x5646d1[_0x6642('0x49')][_0x6642('0x52')]);_0x17b1c7[_0x6642('0x53')]=qs['filters'](_[_0x6642('0x6c')](_0x5646d1[_0x6642('0x49')],_0x1c0c89['filters']));if(_0x5646d1[_0x6642('0x49')][_0x6642('0x54')]){_0x17b1c7[_0x6642('0x53')]=_[_0x6642('0x55')](_0x17b1c7['where'],{'$or':_['map'](_0x17b1c7[_0x6642('0x4c')],function(_0x3dc261){var _0x59f363={};_0x59f363[_0x3dc261]={'$like':'%'+_0x5646d1['query'][_0x6642('0x54')]+'%'};return _0x59f363;})});}_0x17b1c7=_[_0x6642('0x55')]({},_0x17b1c7,_0x5646d1[_0x6642('0x5c')]);return _0xe7e8f8['getAgents'](_0x17b1c7);}})['then'](function(_0x895bd5){if(_0x895bd5){_0x5aa560=_0x895bd5[_0x6642('0x5b')];if(!_0x5646d1[_0x6642('0x49')][_0x6642('0x4f')](_0x6642('0x50'))){_0x17b1c7[_0x6642('0x33')]=qs[_0x6642('0x33')](_0x5646d1[_0x6642('0x49')]['limit']);_0x17b1c7[_0x6642('0x35')]=qs['offset'](_0x5646d1['query']['offset']);}return _0xe7e8f8[_0x6642('0x7b')](_0x17b1c7);}})[_0x6642('0x24')](function(_0x591cb9){if(_0x591cb9){return _0x591cb9?{'count':_0x5aa560,'rows':_0x591cb9}:null;}})[_0x6642('0x24')](respondWithResult(_0x5f909d,null))['catch'](handleError(_0x5f909d,null));};exports[_0x6642('0x7c')]=function(_0x595282,_0x3a7bf5){var _0x41578c=_0x595282[_0x6642('0x66')]['id'];var _0x5e44d3=_0x595282[_0x6642('0x65')];var _0x52c9a0=0xc8;var _0x4b2531=null;return db[_0x6642('0x7d')][_0x6642('0x7e')]({'isolationLevel':db[_0x6642('0x7d')][_0x6642('0x7f')][_0x6642('0x80')][_0x6642('0x81')]},function(_0x30c640){return db['WhatsappAccount'][_0x6642('0x71')]({'where':{'id':_0x41578c},'transaction':_0x30c640})[_0x6642('0x24')](function(_0x4869e4){if(_0x4869e4){return db[_0x6642('0x82')]['destroy']({'where':{'WhatsappAccountId':_0x41578c},'transaction':_0x30c640})['then'](function(){var _0xf28585=_[_0x6642('0x48')](_0x5e44d3,function(_0x302623){_0x302623['WhatsappAccountId']=_0x41578c;return _0x302623;});return db['WhatsappApplication'][_0x6642('0x83')](_0xf28585,{'transaction':_0x30c640});});}else{_0x52c9a0=0x194;_0x4b2531=[];}});})[_0x6642('0x24')](function(){if(_0x52c9a0!==0x194){return db[_0x6642('0x82')][_0x6642('0x84')]({'where':{'WhatsappAccountId':_0x41578c},'order':_0x6642('0x85')})[_0x6642('0x24')](function(_0x5f12d9){_0x4b2531=_0x5f12d9;});}})[_0x6642('0x2d')](function(_0x903fa5){_0x52c9a0=0x1f4;logger['error'](_0x903fa5[_0x6642('0x86')]);if(_0x903fa5[_0x6642('0x40')]){delete _0x903fa5[_0x6642('0x40')];}_0x4b2531=_0x903fa5;})[_0x6642('0x87')](function(){if(_0x4b2531===null){_0x3a7bf5[_0x6642('0x2e')](_0x52c9a0);}else{if(_0x52c9a0===0x1f4){_0x3a7bf5[_0x6642('0x30')](_0x52c9a0)[_0x6642('0x41')](_0x4b2531);}else{_0x3a7bf5['status'](_0x52c9a0)[_0x6642('0x31')](_0x4b2531);}}});};exports['getApplications']=function(_0x3c5ce8,_0x344925,_0x20afa1){var _0x55d11a={};var _0x367039={};var _0x100b40;var _0x28c264;return db[_0x6642('0x43')]['findOne']({'where':{'id':_0x3c5ce8[_0x6642('0x66')]['id']}})['then'](handleEntityNotFound(_0x344925,null))[_0x6642('0x24')](function(_0x167b96){if(_0x167b96){_0x100b40=_0x167b96;_0x367039[_0x6642('0x47')]=_[_0x6642('0x4a')](db[_0x6642('0x82')][_0x6642('0x44')]);_0x367039[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x3c5ce8[_0x6642('0x49')]);_0x367039[_0x6642('0x4b')]=_['intersection'](_0x367039[_0x6642('0x47')],_0x367039[_0x6642('0x49')]);_0x55d11a['attributes']=_[_0x6642('0x4d')](_0x367039[_0x6642('0x47')],qs['fields'](_0x3c5ce8[_0x6642('0x49')][_0x6642('0x4e')]));_0x55d11a['attributes']=_0x55d11a[_0x6642('0x4c')][_0x6642('0x5b')]?_0x55d11a['attributes']:_0x367039['model'];_0x55d11a[_0x6642('0x51')]=qs[_0x6642('0x52')](_0x3c5ce8[_0x6642('0x49')][_0x6642('0x52')]);_0x55d11a[_0x6642('0x53')]=qs[_0x6642('0x4b')](_[_0x6642('0x6c')](_0x3c5ce8[_0x6642('0x49')],_0x367039[_0x6642('0x4b')]));if(_0x3c5ce8[_0x6642('0x49')][_0x6642('0x54')]){_0x55d11a[_0x6642('0x53')]=_[_0x6642('0x55')](_0x55d11a[_0x6642('0x53')],{'$or':_['map'](_0x55d11a[_0x6642('0x4c')],function(_0x28fb7c){var _0x46233d={};_0x46233d[_0x28fb7c]={'$like':'%'+_0x3c5ce8[_0x6642('0x49')][_0x6642('0x54')]+'%'};return _0x46233d;})});}_0x55d11a=_[_0x6642('0x55')]({},_0x55d11a,_0x3c5ce8['options']);return _0x100b40[_0x6642('0x88')](_0x55d11a);}})[_0x6642('0x24')](function(_0x162b62){if(_0x162b62){_0x28c264=_0x162b62[_0x6642('0x5b')];if(!_0x3c5ce8[_0x6642('0x49')][_0x6642('0x4f')](_0x6642('0x50'))){_0x55d11a['limit']=qs['limit'](_0x3c5ce8['query']['limit']);_0x55d11a[_0x6642('0x35')]=qs['offset'](_0x3c5ce8[_0x6642('0x49')][_0x6642('0x35')]);}return _0x100b40[_0x6642('0x88')](_0x55d11a);}})[_0x6642('0x24')](function(_0x4e824d){if(_0x4e824d){return _0x4e824d?{'count':_0x28c264,'rows':_0x4e824d}:null;}})[_0x6642('0x24')](respondWithResult(_0x344925,null))[_0x6642('0x2d')](handleError(_0x344925,null));};exports[_0x6642('0x89')]=function(_0x5ab151,_0x21c306,_0x22f7ec){var _0x4727b4={'channel':'whatsapp'};var _0x85c56a=[];var _0x180c78=[];var _0x5c3616={};return db['WhatsappAccount'][_0x6642('0x5d')]({'where':{'id':_0x5ab151[_0x6642('0x66')]['id']},'include':[{'model':db[_0x6642('0x82')],'as':_0x6642('0x8a')}]})[_0x6642('0x24')](handleEntityNotFound(_0x21c306,null))[_0x6642('0x24')](function(_0xb80e7e){_0x4727b4['account']=_0xb80e7e;if(_0x4727b4[_0x6642('0x8b')]&&_0x4727b4['account'][_0x6642('0x46')]==='sinch'&&_0x5ab151[_0x6642('0x65')][_0x6642('0x8c')]){if(_0x5ab151['body'][_0x6642('0x8c')][_0x6642('0x5b')]===0x0)return;if(_0x5ab151['body']['statuses'][0x0][_0x6642('0x8d')]!=='read')return;return db[_0x6642('0x8e')][_0x6642('0x3b')]({'read':!![],'readAt':_0x5ab151[_0x6642('0x65')][_0x6642('0x8c')][0x0]['timestamp']},{'where':{'messageId':_0x5ab151[_0x6642('0x65')][_0x6642('0x8c')][0x0][_0x6642('0x8f')]},'individualHooks':!![]})[_0x6642('0x24')](function(_0x44e4d5){return _0x21c306[_0x6642('0x30')](0xc8)[_0x6642('0x31')](_0x44e4d5);});}_0x4727b4[_0x6642('0x90')]=_[_0x6642('0x91')](_0xb80e7e['Applications'],[_0x6642('0x85')],[_0x6642('0x92')]);if(_0x4727b4[_0x6642('0x8b')][_0x6642('0x8a')]){delete _0x4727b4[_0x6642('0x8b')]['Applications'];}return db['CmContact'][_0x6642('0x67')]()[_0x6642('0x24')](function(_0x5867cd){if(!_0x5867cd){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))]('no\x20available\x20attributes');}_0x85c56a=_['difference'](_[_0x6642('0x4a')](_0x5867cd),[_0x6642('0x95'),_0x6642('0x96')]);_0x180c78=_[_0x6642('0x97')](_['keys'](_0x5867cd),[_0x6642('0x95'),_0x6642('0x96'),_0x6642('0x98'),'ListId']);_0x4727b4[_0x6642('0x65')]={'mapKey':_0x6642('0x99')};if(_0x4727b4['account']&&_0x4727b4[_0x6642('0x8b')]['type']==='twilio'){_0x4727b4[_0x6642('0x65')][_0x6642('0x9a')]=_0x5ab151[_0x6642('0x65')][_0x6642('0x9b')][_0x6642('0x9c')]('whatsapp:','');_0x4727b4[_0x6642('0x65')][_0x6642('0x65')]=_0x5ab151[_0x6642('0x65')]['Body'];_0x4727b4[_0x6642('0x65')]['messageId']=_0x5ab151[_0x6642('0x65')][_0x6642('0x9d')];}if(_0x4727b4[_0x6642('0x8b')]&&_0x4727b4[_0x6642('0x8b')][_0x6642('0x46')]==='sinch'){_0x4727b4[_0x6642('0x65')][_0x6642('0x9a')]=_0x5ab151[_0x6642('0x65')][_0x6642('0x9e')][0x0][_0x6642('0x9a')];_0x4727b4['body'][_0x6642('0x65')]=_0x5ab151[_0x6642('0x65')][_0x6642('0x9e')][0x0][_0x6642('0x2b')][_0x6642('0x65')];_0x4727b4[_0x6642('0x65')][_0x6642('0x9f')]=_0x5ab151[_0x6642('0x65')]['notifications'][0x0][_0x6642('0x8f')];}if(_0x4727b4[_0x6642('0x65')]['id']){delete _0x4727b4[_0x6642('0x65')]['id'];}if(_[_0x6642('0xa0')](_0x4727b4[_0x6642('0x65')][_0x6642('0x9a')])){throw new db['Sequelize'][(_0x6642('0x94'))](_0x6642('0xa1'));}if(_[_0x6642('0xa0')](_0x4727b4['body']['body'])||_0x4727b4['body'][_0x6642('0x65')]===''){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))](_0x6642('0xa2'));}if(_['isNil'](_0x4727b4['body'][_0x6642('0xa3')])){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))](_0x6642('0xa4')+_0x180c78);}if(!_[_0x6642('0xa5')](_0x180c78,_0x4727b4[_0x6642('0x65')][_0x6642('0xa3')])){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))](_0x6642('0xa6')+_0x180c78);}_0x5c3616[_0x4727b4[_0x6642('0x65')]['mapKey']]=_0x4727b4[_0x6642('0x65')][_0x6642('0x9a')];return db['CmList'][_0x6642('0x5d')]({'where':{'id':_0x4727b4[_0x6642('0x8b')]['ListId']},'include':[{'model':db[_0x6642('0xa7')],'as':_0x6642('0xa8'),'where':_0x5c3616,'limit':0x1,'order':[['updatedAt',_0x6642('0xa9')]]}]});})['then'](handleEntityNotFound(_0x21c306,null))['then'](function(_0x413ed9){if(_0x413ed9){_0x4727b4[_0x6642('0xaa')]=_[_0x6642('0xab')](_0x413ed9,[_0x6642('0xa8')]);if(_0x413ed9[_0x6642('0xa8')][_0x6642('0x5b')]){return _0x413ed9[_0x6642('0xa8')][0x0];}var _0x127947=_[_0x6642('0xac')](_0x4727b4['body'],{'firstName':_0x4727b4[_0x6642('0x65')]['from'],'ListId':_0x413ed9['id']});_0x127947[_0x4727b4[_0x6642('0x65')][_0x6642('0xa3')]]=_0x4727b4['body'][_0x6642('0x9a')];return db['CmContact']['create'](_0x127947,{'fields':_0x85c56a,'raw':!![]});}})[_0x6642('0x24')](handleEntityNotFound(_0x21c306,null))[_0x6642('0x24')](function(_0x5756cb){if(_0x5756cb){_0x4727b4[_0x6642('0xad')]=_0x5756cb;var _0x20eeed={'ContactId':_0x5756cb['id'],'phone':_0x4727b4['body'][_0x6642('0x9a')],'WhatsappAccountId':_0x5ab151[_0x6642('0x66')]['id']};var _0x29c6f={'ContactId':_0x5756cb['id'],'WhatsappAccountId':_0x5ab151[_0x6642('0x66')]['id'],'closed':![]};return db[_0x6642('0xae')][_0x6642('0x5d')]({'where':_0x29c6f})[_0x6642('0x24')](function(_0x31c5b6){if(_0x31c5b6){return[_0x31c5b6,![]];}return db[_0x6642('0xae')]['create'](_0x20eeed)[_0x6642('0x24')](function(_0x5e98de){return[_0x5e98de,!![]];});});}})[_0x6642('0x75')](function(_0x5a4703,_0x134ec8){_0x4727b4[_0x6642('0xaf')]=_0x5a4703[_0x6642('0x3d')]({'plain':!![]});_0x4727b4[_0x6642('0xaf')]['created']=![];if(_0x134ec8){if(_0x4727b4['account'][_0x6642('0xb0')]){_0x4727b4[_0x6642('0x90')]['push']({'id':0x0,'priority':_0x4727b4['applications'][_0x6642('0x5b')]+0x1,'app':'close','appdata':_0x6642('0xb1'),'interval':_0x6642('0xb2')});}_0x4727b4[_0x6642('0xaf')][_0x6642('0xb3')]=!![];}return db[_0x6642('0x8e')]['create']({'phone':_0x4727b4[_0x6642('0x65')][_0x6642('0x9a')],'messageId':_0x4727b4['body']['messageId'],'body':_0x4727b4['body'][_0x6642('0x65')],'WhatsappAccountId':_0x5ab151[_0x6642('0x66')]['id'],'WhatsappInteractionId':_0x5a4703['id'],'direction':'in','ContactId':_0x5a4703[_0x6642('0xb4')],'AttachmentId':_0x4727b4[_0x6642('0x65')]['AttachmentId']});})[_0x6642('0x24')](function(_0x38d8f2){_0x4727b4[_0x6642('0x2b')]=_0x38d8f2;if(!_0x4727b4[_0x6642('0xaf')][_0x6642('0xb5')])return;return db['User'][_0x6642('0x5d')]({'attributes':['id',_0x6642('0x40')],'where':{'id':_0x4727b4[_0x6642('0xaf')]['UserId']}});})[_0x6642('0x24')](function(_0x473827){if(_0x473827){_0x4727b4['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x6642('0xb6'),'appdata':_0x473827[_0x6642('0x40')]+','+(_0x4727b4['account'][_0x6642('0xb7')]||0xa),'interval':_0x6642('0xb2')});}if(!_0x4727b4['interaction'][_0x6642('0xb8')])return;return db[_0x6642('0xb9')][_0x6642('0x5d')]({'attributes':['id','name'],'where':{'id':_0x4727b4[_0x6642('0xaf')]['queueId']}});})['then'](function(_0x42bcb3){if(_0x42bcb3){_0x4727b4['applications'][_0x6642('0xba')]({'id':0x0,'priority':0x1,'app':_0x6642('0xbb'),'appdata':_0x42bcb3[_0x6642('0x40')]+','+(_0x4727b4[_0x6642('0x8b')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x4727b4);})[_0x6642('0x24')](function(_0xab32df){if(_0xab32df){var _0x266673=0xc8;var _0x1432a3=_0x6642('0xbc');logger[_0x6642('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1432a3,_0x266673,'entity\x20found');logger['debug'](_0x6642('0xbd'),_0x1432a3,_0x266673,_0x6642('0xbe'),JSON[_0x6642('0xbf')](_0xab32df));if(_0x4727b4[_0x6642('0x8b')]['type']===_0x6642('0xc0')){return _0x21c306[_0x6642('0x30')](_0x266673)['set'](_0x6642('0xc1'),'text/xml')[_0x6642('0x41')]('\x0a');}else{return _0x21c306[_0x6642('0x30')](_0x266673)[_0x6642('0x31')](_0xab32df);}}});})[_0x6642('0x2d')](handleError(_0x21c306,null));};exports[_0x6642('0x41')]=function(_0x4998c0,_0x3847ae,_0x5c5fb7){var _0x48991e,_0x3ebb10,_0x1bcb18;if(_['isNil'](_0x4998c0['body']['body'])||_0x4998c0[_0x6642('0x65')][_0x6642('0x65')]===''){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))](_0x6642('0xa2'));}if(_['isNil'](_0x4998c0['body']['to'])){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))]('to\x20is\x20mandatory');}_0x48991e=_0x4998c0['body']['to'];return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x4998c0['params']['id']},'include':[{'model':db[_0x6642('0xc2')],'as':_0x6642('0xc3'),'include':[{'model':db['CmContact'],'as':_0x6642('0xa8'),'where':{'mobile':_0x48991e},'limit':0x1,'order':[[_0x6642('0x96'),'DESC']]}]}]})[_0x6642('0x24')](handleEntityNotFound(_0x3847ae,null))[_0x6642('0x24')](function(_0x356408){if(_0x356408&&_0x356408[_0x6642('0xc3')]){_0x3ebb10=_0x356408[_0x6642('0x3d')]({'plain':!![]});if(_0x3ebb10[_0x6642('0xc3')]&&_0x3ebb10[_0x6642('0xc3')][_0x6642('0xa8')][_0x6642('0x5b')]){return _0x3ebb10['List'][_0x6642('0xa8')][0x0];}return db['CmContact']['create'](_[_0x6642('0xac')](_0x4998c0[_0x6642('0x65')],{'firstName':_0x48991e,'mobile':_0x48991e,'phone':_0x48991e,'ListId':_0x3ebb10[_0x6642('0xc4')]}));}})[_0x6642('0x24')](handleEntityNotFound(_0x3847ae,null))[_0x6642('0x24')](function(_0x4d0e71){if(_0x4d0e71){_0x1bcb18=_0x4d0e71;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x1bcb18['id'],'closed':![],'WhatsappAccountId':_0x3ebb10['id']}})['then'](function(_0x372f51){if(_0x372f51){return[_0x372f51,![]];}return db[_0x6642('0xae')][_0x6642('0x5e')]({'UserId':_0x4998c0[_0x6642('0x5f')]['id'],'ContactId':_0x1bcb18['id'],'WhatsappAccountId':_0x3ebb10['id'],'phone':_0x48991e,'firstMsgDirection':_0x6642('0xc5'),'Messages':[_['merge'](_0x4998c0['body'],{'read':![],'body':_0x4998c0[_0x6642('0x65')][_0x6642('0x65')],'phone':_0x48991e,'WhatsappAccountId':_0x3ebb10['id'],'UserId':_0x4998c0[_0x6642('0x5f')]['id'],'ContactId':_0x1bcb18['id']})]},{'include':[{'model':db[_0x6642('0x8e')],'as':_0x6642('0xc6')}]})['then'](function(_0x243c41){return[_0x243c41,!![]];});});}})[_0x6642('0x75')](function(_0x1424e5,_0x198583){if(_0x198583){return _0x1424e5;}return db[_0x6642('0x8e')][_0x6642('0x5e')](_['merge'](_0x4998c0[_0x6642('0x65')],{'read':![],'body':_0x4998c0['body']['body'],'phone':_0x48991e,'WhatsappAccountId':_0x3ebb10['id'],'WhatsappInteractionId':_0x1424e5['id'],'UserId':_0x4998c0['user']['id'],'ContactId':_0x1bcb18['id']}))[_0x6642('0x24')](function(_0x480cca){_0x1424e5[_0x6642('0xc7')]['Messages']=[];_0x1424e5[_0x6642('0xc7')][_0x6642('0xc6')][_0x6642('0xc8')](_0x480cca['dataValues']);return _0x1424e5;});})[_0x6642('0x24')](respondWithResult(_0x3847ae,null))['catch'](handleError(_0x3847ae,null));}; \ No newline at end of file +var _0x883b=['error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','WhatsappAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','read','message_id','applications','asc','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','type','twilio','from','replace','whatsapp:','messageId','notifications','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','DESC','list','omit','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','defaults','out','WhatsappMessage','Messages','dataValues','rimraf','zip-dir','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/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x97264,_0x5db8a7){var _0x4c3d58=function(_0x16dbc5){while(--_0x16dbc5){_0x97264['push'](_0x97264['shift']());}};_0x4c3d58(++_0x5db8a7);}(_0x883b,0x15d));var _0xb883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb883('0x0'));var zipdir=require(_0xb883('0x1'));var jsonpatch=require(_0xb883('0x2'));var rp=require('request-promise');var moment=require(_0xb883('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb883('0x4'));var util=require(_0xb883('0x5'));var path=require(_0xb883('0x6'));var sox=require(_0xb883('0x7'));var csv=require(_0xb883('0x8'));var ejs=require(_0xb883('0x9'));var fs=require('fs');var fs_extra=require(_0xb883('0xa'));var _=require(_0xb883('0xb'));var squel=require(_0xb883('0xc'));var crypto=require(_0xb883('0xd'));var jsforce=require(_0xb883('0xe'));var deskjs=require(_0xb883('0xf'));var toCsv=require(_0xb883('0x8'));var querystring=require(_0xb883('0x10'));var Papa=require(_0xb883('0x11'));var Redis=require(_0xb883('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb883('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb883('0x14'));var logger=require('../../config/logger')(_0xb883('0x15'));var utils=require(_0xb883('0x16'));var config=require(_0xb883('0x17'));var licenseUtil=require(_0xb883('0x18'));var db=require(_0xb883('0x19'))['db'];config[_0xb883('0x1a')]=_['defaults'](config[_0xb883('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb883('0x1b'))(new Redis(config[_0xb883('0x1a')]));require(_0xb883('0x1c'))[_0xb883('0x1d')](socket);var jayson=require(_0xb883('0x1e'));var client=jayson[_0xb883('0x1f')][_0xb883('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x6aa5e2,_0x199360,_0x1fab0c,_0x4e3433){return new BPromise(function(_0x200018,_0x2f2eea){var _0x62ac91=_0x4e3433||client;return _0x62ac91['request'](_0x6aa5e2,_0x1fab0c)[_0xb883('0x21')](function(_0x4eee2e){logger[_0xb883('0x22')](_0xb883('0x23'),_0x199360,_0xb883('0x24'));logger[_0xb883('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x199360,'request\x20sent',JSON[_0xb883('0x26')](_0x4eee2e));if(_0x4eee2e[_0xb883('0x27')]){if(_0x4eee2e[_0xb883('0x27')]['code']===0x1f4){logger[_0xb883('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x199360,_0x4eee2e['error'][_0xb883('0x28')]);return _0x2f2eea(_0x4eee2e[_0xb883('0x27')][_0xb883('0x28')]);}logger[_0xb883('0x27')](_0xb883('0x23'),_0x199360,_0x4eee2e['error'][_0xb883('0x28')]);return _0x200018(_0x4eee2e[_0xb883('0x27')][_0xb883('0x28')]);}else{logger[_0xb883('0x22')](_0xb883('0x23'),_0x199360,_0xb883('0x24'));_0x200018(_0x4eee2e[_0xb883('0x29')][_0xb883('0x28')]);}})['catch'](function(_0x1e2ba1){logger[_0xb883('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x199360,_0x1e2ba1);_0x2f2eea(_0x1e2ba1);});});}function respondWithStatusCode(_0x575ecd,_0x3d6ea7){_0x3d6ea7=_0x3d6ea7||0xcc;return function(_0x38f138){if(_0x38f138){return _0x575ecd[_0xb883('0x2a')](_0x3d6ea7);}return _0x575ecd[_0xb883('0x2b')](_0x3d6ea7)[_0xb883('0x2c')]();};}function respondWithResult(_0x2fd7f2,_0xa6a70a){_0xa6a70a=_0xa6a70a||0xc8;return function(_0x1defef){if(_0x1defef){return _0x2fd7f2[_0xb883('0x2b')](_0xa6a70a)[_0xb883('0x2d')](_0x1defef);}};}function respondWithFilteredResult(_0x41f97f,_0x5d745a){return function(_0x2d5334){if(_0x2d5334){var _0x5e61f0=typeof _0x5d745a[_0xb883('0x2e')]===_0xb883('0x2f')&&typeof _0x5d745a[_0xb883('0x30')]===_0xb883('0x2f');var _0x43ff90=_0x2d5334[_0xb883('0x31')];var _0x3e84f6=_0x5e61f0?0x0:_0x5d745a[_0xb883('0x2e')];var _0x490b74=_0x5e61f0?_0x2d5334[_0xb883('0x31')]:_0x5d745a['offset']+_0x5d745a[_0xb883('0x30')];var _0x2b148b;if(_0x490b74>=_0x43ff90){_0x490b74=_0x43ff90;_0x2b148b=0xc8;}else{_0x2b148b=0xce;}_0x41f97f[_0xb883('0x2b')](_0x2b148b);return _0x41f97f[_0xb883('0x32')]('Content-Range',_0x3e84f6+'-'+_0x490b74+'/'+_0x43ff90)['json'](_0x2d5334);}return null;};}function patchUpdates(_0x18e0f4){return function(_0x59efed){try{jsonpatch[_0xb883('0x33')](_0x59efed,_0x18e0f4,!![]);}catch(_0x52b9b9){return BPromise[_0xb883('0x34')](_0x52b9b9);}return _0x59efed[_0xb883('0x35')]();};}function saveUpdates(_0x53e8c0,_0x42f665){return function(_0x304552){if(_0x304552){return _0x304552[_0xb883('0x36')](_0x53e8c0)[_0xb883('0x21')](function(_0x68b3a9){return _0x68b3a9;});}return null;};}function removeEntity(_0x497cb7,_0x46fa44){return function(_0x4dafa3){if(_0x4dafa3){return _0x4dafa3[_0xb883('0x37')]()['then'](function(){var _0x331723=_0x4dafa3[_0xb883('0x38')]({'plain':!![]});var _0x5cc80f=_0xb883('0x39');return db[_0xb883('0x3a')][_0xb883('0x37')]({'where':{'type':_0x5cc80f,'resourceId':_0x331723['id']}})[_0xb883('0x21')](function(){return _0x4dafa3;});})[_0xb883('0x21')](function(){_0x497cb7[_0xb883('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f3a26,_0x1bd946){return function(_0x497ade){if(!_0x497ade){_0x5f3a26[_0xb883('0x2a')](0x194);}return _0x497ade;};}function handleError(_0x5b7f52,_0x394563){_0x394563=_0x394563||0x1f4;return function(_0x4af5a5){logger[_0xb883('0x27')](_0x4af5a5[_0xb883('0x3b')]);if(_0x4af5a5[_0xb883('0x3c')]){delete _0x4af5a5[_0xb883('0x3c')];}_0x5b7f52[_0xb883('0x2b')](_0x394563)[_0xb883('0x3d')](_0x4af5a5);};}exports[_0xb883('0x3e')]=function(_0x381606,_0x2554c4){var _0x208199={'include':[{'model':db[_0xb883('0x3f')],'as':'mandatoryDispositionPause'}]},_0x4d8b64={},_0x8abd51={'count':0x0,'rows':[]};var _0x4c564e=_['map'](db[_0xb883('0x40')][_0xb883('0x41')],function(_0x1554f8){return{'name':_0x1554f8['fieldName'],'type':_0x1554f8['type'][_0xb883('0x42')]};});_0x4d8b64[_0xb883('0x43')]=_[_0xb883('0x44')](_0x4c564e,_0xb883('0x3c'));_0x4d8b64[_0xb883('0x45')]=_[_0xb883('0x46')](_0x381606[_0xb883('0x45')]);_0x4d8b64[_0xb883('0x47')]=_[_0xb883('0x48')](_0x4d8b64[_0xb883('0x43')],_0x4d8b64[_0xb883('0x45')]);_0x208199[_0xb883('0x49')]=_['intersection'](_0x4d8b64['model'],qs[_0xb883('0x4a')](_0x381606['query']['fields']));_0x208199[_0xb883('0x49')]=_0x208199[_0xb883('0x49')][_0xb883('0x4b')]?_0x208199[_0xb883('0x49')]:_0x4d8b64[_0xb883('0x43')];if(!_0x381606['query'][_0xb883('0x4c')](_0xb883('0x4d'))){_0x208199['limit']=qs[_0xb883('0x30')](_0x381606[_0xb883('0x45')][_0xb883('0x30')]);_0x208199[_0xb883('0x2e')]=qs[_0xb883('0x2e')](_0x381606[_0xb883('0x45')][_0xb883('0x2e')]);}_0x208199[_0xb883('0x4e')]=qs[_0xb883('0x4f')](_0x381606['query'][_0xb883('0x4f')]);_0x208199[_0xb883('0x50')]=qs[_0xb883('0x47')](_[_0xb883('0x51')](_0x381606[_0xb883('0x45')],_0x4d8b64[_0xb883('0x47')]),_0x4c564e);if(_0x381606['query'][_0xb883('0x52')]){_0x208199[_0xb883('0x50')]=_[_0xb883('0x53')](_0x208199[_0xb883('0x50')],{'$or':_[_0xb883('0x44')](_0x4c564e,function(_0x46848c){if(_0x46848c['type']!=='VIRTUAL'){var _0x3927f4={};_0x3927f4[_0x46848c['name']]={'$like':'%'+_0x381606['query'][_0xb883('0x52')]+'%'};return _0x3927f4;}})});}_0x208199=_['merge']({},_0x208199,_0x381606[_0xb883('0x54')]);var _0x13553b={'where':_0x208199[_0xb883('0x50')]};return db['WhatsappAccount']['count'](_0x13553b)[_0xb883('0x21')](function(_0x42a4a1){_0x8abd51[_0xb883('0x31')]=_0x42a4a1;if(_0x381606[_0xb883('0x45')]['includeAll']){_0x208199[_0xb883('0x55')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xb883('0x56')](_0x208199);})[_0xb883('0x21')](function(_0x1e9f09){_0x8abd51[_0xb883('0x57')]=_0x1e9f09;return _0x8abd51;})[_0xb883('0x21')](respondWithFilteredResult(_0x2554c4,_0x208199))[_0xb883('0x58')](handleError(_0x2554c4,null));};exports[_0xb883('0x59')]=function(_0x3842cd,_0xaabf19){var _0x41253b={'raw':![],'where':{'id':_0x3842cd['params']['id']},'include':[{'model':db[_0xb883('0x3f')],'as':'mandatoryDispositionPause'}]},_0x590cfe={};_0x590cfe[_0xb883('0x43')]=_[_0xb883('0x46')](db[_0xb883('0x40')][_0xb883('0x41')]);_0x590cfe[_0xb883('0x45')]=_[_0xb883('0x46')](_0x3842cd[_0xb883('0x45')]);_0x590cfe['filters']=_['intersection'](_0x590cfe[_0xb883('0x43')],_0x590cfe[_0xb883('0x45')]);_0x41253b['attributes']=_[_0xb883('0x48')](_0x590cfe[_0xb883('0x43')],qs[_0xb883('0x4a')](_0x3842cd[_0xb883('0x45')][_0xb883('0x4a')]));_0x41253b[_0xb883('0x49')]=_0x41253b[_0xb883('0x49')][_0xb883('0x4b')]?_0x41253b[_0xb883('0x49')]:_0x590cfe[_0xb883('0x43')];if(_0x3842cd[_0xb883('0x45')][_0xb883('0x5a')]){_0x41253b[_0xb883('0x55')]=[{'all':!![]}];}_0x41253b=_[_0xb883('0x53')]({},_0x41253b,_0x3842cd['options']);return db['WhatsappAccount']['find'](_0x41253b)[_0xb883('0x21')](handleEntityNotFound(_0xaabf19,null))['then'](respondWithResult(_0xaabf19,null))[_0xb883('0x58')](handleError(_0xaabf19,null));};exports[_0xb883('0x5b')]=function(_0x119887,_0x661786){return db['WhatsappAccount'][_0xb883('0x5b')](_0x119887[_0xb883('0x5c')],{})[_0xb883('0x21')](function(_0x2d61cf){var _0x318778=_0x119887[_0xb883('0x5d')]['get']({'plain':!![]});if(!_0x318778)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x318778['role']===_0xb883('0x5d')){var _0x5066c8=_0x2d61cf['get']({'plain':!![]});var _0x1c772b=_0xb883('0x39');return db[_0xb883('0x5e')][_0xb883('0x5f')]({'where':{'name':_0x1c772b,'userProfileId':_0x318778[_0xb883('0x60')]},'raw':!![]})[_0xb883('0x21')](function(_0x56d7e9){if(_0x56d7e9&&_0x56d7e9[_0xb883('0x61')]===0x0){return db[_0xb883('0x3a')]['create']({'name':_0x5066c8[_0xb883('0x3c')],'resourceId':_0x5066c8['id'],'type':_0x56d7e9[_0xb883('0x3c')],'sectionId':_0x56d7e9['id']},{})['then'](function(){return _0x2d61cf;});}else{return _0x2d61cf;}})[_0xb883('0x58')](function(_0x374d95){logger['error'](_0xb883('0x62'),_0x374d95);throw _0x374d95;});}return _0x2d61cf;})[_0xb883('0x21')](respondWithResult(_0x661786,0xc9))['catch'](handleError(_0x661786,null));};exports[_0xb883('0x36')]=function(_0x328930,_0xfb9e53){if(_0x328930[_0xb883('0x5c')]['id']){delete _0x328930[_0xb883('0x5c')]['id'];}return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x328930[_0xb883('0x63')]['id']},'include':[{'model':db[_0xb883('0x3f')],'as':'mandatoryDispositionPause'}]})[_0xb883('0x21')](handleEntityNotFound(_0xfb9e53,null))[_0xb883('0x21')](saveUpdates(_0x328930[_0xb883('0x5c')],null))['then'](respondWithResult(_0xfb9e53,null))['catch'](handleError(_0xfb9e53,null));};exports['destroy']=function(_0x357b4e,_0x7deda8){return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x357b4e[_0xb883('0x63')]['id']}})['then'](handleEntityNotFound(_0x7deda8,null))[_0xb883('0x21')](removeEntity(_0x7deda8,null))[_0xb883('0x58')](handleError(_0x7deda8,null));};exports[_0xb883('0x64')]=function(_0x45a5a1,_0x536534){return db[_0xb883('0x40')][_0xb883('0x64')]()[_0xb883('0x21')](respondWithResult(_0x536534,null))[_0xb883('0x58')](handleError(_0x536534,null));};exports[_0xb883('0x65')]=function(_0xa1b005,_0x170920,_0x290784){if(_0xa1b005[_0xb883('0x5c')]['id']){delete _0xa1b005[_0xb883('0x5c')]['id'];}return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0xa1b005[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x170920,null))['then'](function(_0xa11cae){if(_0xa11cae){_0xa1b005['body']['WhatsappAccountId']=_0xa11cae['id'];return db[_0xb883('0x66')][_0xb883('0x5b')](_0xa1b005['body']);}})[_0xb883('0x21')](respondWithResult(_0x170920,null))[_0xb883('0x58')](handleError(_0x170920,null));};exports['getDispositions']=function(_0x4a8746,_0x480d5a,_0x526633){var _0x32dc53={'raw':![],'where':{}};var _0x10f380={};var _0x385b94={'count':0x0,'rows':[]};return db[_0xb883('0x40')][_0xb883('0x67')]({'where':{'id':_0x4a8746['params']['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x480d5a,null))[_0xb883('0x21')](function(_0x5bbfb5){if(_0x5bbfb5){_0x10f380[_0xb883('0x43')]=_[_0xb883('0x46')](db[_0xb883('0x66')][_0xb883('0x41')]);_0x10f380[_0xb883('0x45')]=_['keys'](_0x4a8746[_0xb883('0x45')]);_0x10f380[_0xb883('0x47')]=_[_0xb883('0x48')](_0x10f380[_0xb883('0x43')],_0x10f380['query']);_0x32dc53[_0xb883('0x49')]=_[_0xb883('0x48')](_0x10f380[_0xb883('0x43')],qs[_0xb883('0x4a')](_0x4a8746['query'][_0xb883('0x4a')]));_0x32dc53['attributes']=_0x32dc53[_0xb883('0x49')]['length']?_0x32dc53['attributes']:_0x10f380[_0xb883('0x43')];if(!_0x4a8746['query'][_0xb883('0x4c')](_0xb883('0x4d'))){_0x32dc53['limit']=qs[_0xb883('0x30')](_0x4a8746[_0xb883('0x45')][_0xb883('0x30')]);_0x32dc53[_0xb883('0x2e')]=qs[_0xb883('0x2e')](_0x4a8746[_0xb883('0x45')]['offset']);}_0x32dc53[_0xb883('0x4e')]=qs[_0xb883('0x4f')](_0x4a8746['query'][_0xb883('0x4f')]);_0x32dc53[_0xb883('0x50')]=qs[_0xb883('0x47')](_[_0xb883('0x51')](_0x4a8746[_0xb883('0x45')],_0x10f380[_0xb883('0x47')]));_0x32dc53[_0xb883('0x50')][_0xb883('0x68')]=_0x5bbfb5['id'];if(_0x4a8746[_0xb883('0x45')][_0xb883('0x52')]){_0x32dc53['where']=_['merge'](_0x32dc53[_0xb883('0x50')],{'$or':_[_0xb883('0x44')](_0x32dc53[_0xb883('0x49')],function(_0x45116b){var _0x330d38={};_0x330d38[_0x45116b]={'$like':'%'+_0x4a8746[_0xb883('0x45')][_0xb883('0x52')]+'%'};return _0x330d38;})});}_0x32dc53=_[_0xb883('0x53')]({},_0x32dc53,_0x4a8746[_0xb883('0x54')]);return db['Disposition'][_0xb883('0x31')]({'where':_0x32dc53[_0xb883('0x50')]})['then'](function(_0x270da5){_0x385b94[_0xb883('0x31')]=_0x270da5;if(_0x4a8746[_0xb883('0x45')][_0xb883('0x5a')]){_0x32dc53['include']=[{'all':!![]}];}return db[_0xb883('0x66')][_0xb883('0x56')](_0x32dc53);})[_0xb883('0x21')](function(_0x395c0d){_0x385b94['rows']=_0x395c0d;return _0x385b94;});}})[_0xb883('0x21')](respondWithFilteredResult(_0x480d5a,_0x32dc53))[_0xb883('0x58')](handleError(_0x480d5a,null));};exports[_0xb883('0x69')]=function(_0x136b4e,_0xceb527,_0x2fe9f9){return db[_0xb883('0x40')]['find']({'where':{'id':_0x136b4e[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0xceb527,null))[_0xb883('0x21')](function(_0x4ac6df){if(_0x4ac6df){return _0x4ac6df[_0xb883('0x69')](_0x136b4e[_0xb883('0x45')][_0xb883('0x6a')]);}})[_0xb883('0x21')](respondWithStatusCode(_0xceb527,null))[_0xb883('0x58')](handleError(_0xceb527,null));};exports[_0xb883('0x6b')]=function(_0x3763d4,_0x390839,_0x1877af){if(_0x3763d4[_0xb883('0x5c')]['id']){delete _0x3763d4[_0xb883('0x5c')]['id'];}return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x3763d4[_0xb883('0x63')]['id']}})['then'](handleEntityNotFound(_0x390839,null))[_0xb883('0x21')](function(_0x10f9f6){if(_0x10f9f6){_0x3763d4[_0xb883('0x5c')]['WhatsappAccountId']=_0x10f9f6['id'];return db['CannedAnswer'][_0xb883('0x5b')](_0x3763d4['body']);}})[_0xb883('0x21')](respondWithResult(_0x390839,null))[_0xb883('0x58')](handleError(_0x390839,null));};exports['getAnswers']=function(_0x448fe7,_0x1f63fd,_0x5e396c){var _0x3ea7b9={'raw':![],'where':{}};var _0x34458b={};var _0x18d0e2={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xb883('0x67')]({'where':{'id':_0x448fe7[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x1f63fd,null))[_0xb883('0x21')](function(_0x477bc4){if(_0x477bc4){_0x34458b['model']=_[_0xb883('0x46')](db[_0xb883('0x6c')][_0xb883('0x41')]);_0x34458b[_0xb883('0x45')]=_[_0xb883('0x46')](_0x448fe7[_0xb883('0x45')]);_0x34458b[_0xb883('0x47')]=_[_0xb883('0x48')](_0x34458b[_0xb883('0x43')],_0x34458b[_0xb883('0x45')]);_0x3ea7b9[_0xb883('0x49')]=_[_0xb883('0x48')](_0x34458b[_0xb883('0x43')],qs[_0xb883('0x4a')](_0x448fe7[_0xb883('0x45')][_0xb883('0x4a')]));_0x3ea7b9['attributes']=_0x3ea7b9['attributes']['length']?_0x3ea7b9[_0xb883('0x49')]:_0x34458b[_0xb883('0x43')];if(!_0x448fe7[_0xb883('0x45')][_0xb883('0x4c')](_0xb883('0x4d'))){_0x3ea7b9[_0xb883('0x30')]=qs[_0xb883('0x30')](_0x448fe7[_0xb883('0x45')][_0xb883('0x30')]);_0x3ea7b9[_0xb883('0x2e')]=qs[_0xb883('0x2e')](_0x448fe7['query']['offset']);}_0x3ea7b9[_0xb883('0x4e')]=qs['sort'](_0x448fe7[_0xb883('0x45')][_0xb883('0x4f')]);_0x3ea7b9[_0xb883('0x50')]=qs['filters'](_[_0xb883('0x51')](_0x448fe7['query'],_0x34458b['filters']));_0x3ea7b9['where'][_0xb883('0x68')]=_0x477bc4['id'];if(_0x448fe7[_0xb883('0x45')]['filter']){_0x3ea7b9[_0xb883('0x50')]=_[_0xb883('0x53')](_0x3ea7b9[_0xb883('0x50')],{'$or':_[_0xb883('0x44')](_0x3ea7b9[_0xb883('0x49')],function(_0xf6093){var _0x377354={};_0x377354[_0xf6093]={'$like':'%'+_0x448fe7['query'][_0xb883('0x52')]+'%'};return _0x377354;})});}_0x3ea7b9=_['merge']({},_0x3ea7b9,_0x448fe7['options']);return db[_0xb883('0x6c')][_0xb883('0x31')]({'where':_0x3ea7b9[_0xb883('0x50')]})['then'](function(_0x1428f5){_0x18d0e2[_0xb883('0x31')]=_0x1428f5;if(_0x448fe7[_0xb883('0x45')]['includeAll']){_0x3ea7b9[_0xb883('0x55')]=[{'all':!![]}];}return db[_0xb883('0x6c')]['findAll'](_0x3ea7b9);})['then'](function(_0x5851be){_0x18d0e2[_0xb883('0x57')]=_0x5851be;return _0x18d0e2;});}})[_0xb883('0x21')](respondWithFilteredResult(_0x1f63fd,_0x3ea7b9))['catch'](handleError(_0x1f63fd,null));};exports[_0xb883('0x6d')]=function(_0x120998,_0x2102cb,_0x22c64b){return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x120998[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x2102cb,null))[_0xb883('0x21')](function(_0x544263){if(_0x544263){return _0x544263['removeAnswers'](_0x120998[_0xb883('0x45')][_0xb883('0x6a')]);}})[_0xb883('0x21')](respondWithStatusCode(_0x2102cb,null))['catch'](handleError(_0x2102cb,null));};exports[_0xb883('0x6e')]=function(_0x2231ac,_0x3071b8,_0x5ba584){return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x2231ac[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x3071b8,null))[_0xb883('0x21')](function(_0x2e68d3){if(_0x2e68d3){return _0x2e68d3[_0xb883('0x6e')](_0x2231ac['body'][_0xb883('0x6a')],_['omit'](_0x2231ac[_0xb883('0x5c')],[_0xb883('0x6a'),'id'])||{})[_0xb883('0x6f')](function(_0x4e46e5){for(var _0x390808=0x0;_0x390808<_0x2231ac[_0xb883('0x5c')][_0xb883('0x6a')][_0xb883('0x4b')];_0x390808+=0x1){socket[_0xb883('0x70')](_0xb883('0x71'),{'UserId':Number(_0x2231ac[_0xb883('0x5c')][_0xb883('0x6a')][_0x390808]),'WhatsappAccountId':Number(_0x2231ac[_0xb883('0x63')]['id'])});}return _0x4e46e5;});}})['then'](respondWithResult(_0x3071b8,null))[_0xb883('0x58')](handleError(_0x3071b8,null));};exports[_0xb883('0x72')]=function(_0x11131f,_0x57b760,_0x41f224){return db['WhatsappAccount'][_0xb883('0x5f')]({'where':{'id':_0x11131f[_0xb883('0x63')]['id']}})['then'](handleEntityNotFound(_0x57b760,null))[_0xb883('0x21')](function(_0x3d93c5){if(_0x3d93c5){return _0x3d93c5['removeAgents'](_0x11131f['query'][_0xb883('0x6a')])[_0xb883('0x21')](function(){if(_[_0xb883('0x73')](_0x11131f[_0xb883('0x45')][_0xb883('0x6a')])){for(var _0x32f1e6=0x0;_0x32f1e6<_0x11131f[_0xb883('0x45')][_0xb883('0x6a')][_0xb883('0x4b')];_0x32f1e6+=0x1){socket['emit'](_0xb883('0x74'),{'UserId':Number(_0x11131f[_0xb883('0x45')][_0xb883('0x6a')][_0x32f1e6]),'WhatsappAccountId':Number(_0x11131f[_0xb883('0x63')]['id'])});}}else{socket[_0xb883('0x70')](_0xb883('0x74'),{'UserId':Number(_0x11131f[_0xb883('0x45')]['ids']),'WhatsappAccountId':Number(_0x11131f['params']['id'])});}});}})[_0xb883('0x21')](respondWithStatusCode(_0x57b760,null))['catch'](handleError(_0x57b760,null));};exports[_0xb883('0x75')]=function(_0x236910,_0x5e6804,_0x4da4be){var _0x7c402c={};var _0x569dbe={};var _0x49f073;var _0x143a7f;return db[_0xb883('0x40')]['findOne']({'where':{'id':_0x236910[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x5e6804,null))[_0xb883('0x21')](function(_0x4d026c){if(_0x4d026c){_0x49f073=_0x4d026c;_0x569dbe[_0xb883('0x43')]=_[_0xb883('0x46')](db['User'][_0xb883('0x41')]);_0x569dbe[_0xb883('0x45')]=_[_0xb883('0x46')](_0x236910[_0xb883('0x45')]);_0x569dbe['filters']=_['intersection'](_0x569dbe[_0xb883('0x43')],_0x569dbe[_0xb883('0x45')]);_0x7c402c['attributes']=_['intersection'](_0x569dbe[_0xb883('0x43')],qs[_0xb883('0x4a')](_0x236910[_0xb883('0x45')][_0xb883('0x4a')]));_0x7c402c[_0xb883('0x49')]=_0x7c402c[_0xb883('0x49')]['length']?_0x7c402c[_0xb883('0x49')]:_0x569dbe[_0xb883('0x43')];_0x7c402c['order']=qs['sort'](_0x236910[_0xb883('0x45')]['sort']);_0x7c402c['where']=qs[_0xb883('0x47')](_[_0xb883('0x51')](_0x236910[_0xb883('0x45')],_0x569dbe[_0xb883('0x47')]));if(_0x236910['query'][_0xb883('0x52')]){_0x7c402c['where']=_[_0xb883('0x53')](_0x7c402c[_0xb883('0x50')],{'$or':_[_0xb883('0x44')](_0x7c402c[_0xb883('0x49')],function(_0x409cff){var _0x19b9cb={};_0x19b9cb[_0x409cff]={'$like':'%'+_0x236910[_0xb883('0x45')][_0xb883('0x52')]+'%'};return _0x19b9cb;})});}_0x7c402c=_[_0xb883('0x53')]({},_0x7c402c,_0x236910[_0xb883('0x54')]);return _0x49f073['getAgents'](_0x7c402c);}})[_0xb883('0x21')](function(_0x169cc3){if(_0x169cc3){_0x143a7f=_0x169cc3['length'];if(!_0x236910['query'][_0xb883('0x4c')](_0xb883('0x4d'))){_0x7c402c[_0xb883('0x30')]=qs[_0xb883('0x30')](_0x236910[_0xb883('0x45')][_0xb883('0x30')]);_0x7c402c[_0xb883('0x2e')]=qs['offset'](_0x236910[_0xb883('0x45')][_0xb883('0x2e')]);}return _0x49f073[_0xb883('0x75')](_0x7c402c);}})[_0xb883('0x21')](function(_0x318ffd){if(_0x318ffd){return _0x318ffd?{'count':_0x143a7f,'rows':_0x318ffd}:null;}})[_0xb883('0x21')](respondWithResult(_0x5e6804,null))[_0xb883('0x58')](handleError(_0x5e6804,null));};exports['addApplications']=function(_0x5f2839,_0x2139a1){var _0x492522=_0x5f2839[_0xb883('0x63')]['id'];var _0x55284a=_0x5f2839[_0xb883('0x5c')];var _0x5ce28f=0xc8;var _0x2b64fd=null;return db[_0xb883('0x76')][_0xb883('0x77')]({'isolationLevel':db[_0xb883('0x76')][_0xb883('0x78')][_0xb883('0x79')][_0xb883('0x7a')]},function(_0x1f6fda){return db[_0xb883('0x40')][_0xb883('0x67')]({'where':{'id':_0x492522},'transaction':_0x1f6fda})[_0xb883('0x21')](function(_0x39fbf1){if(_0x39fbf1){return db[_0xb883('0x7b')]['destroy']({'where':{'WhatsappAccountId':_0x492522},'transaction':_0x1f6fda})[_0xb883('0x21')](function(){var _0x578316=_[_0xb883('0x44')](_0x55284a,function(_0x3efeca){_0x3efeca['WhatsappAccountId']=_0x492522;return _0x3efeca;});return db[_0xb883('0x7b')][_0xb883('0x7c')](_0x578316,{'transaction':_0x1f6fda});});}else{_0x5ce28f=0x194;_0x2b64fd=[];}});})[_0xb883('0x21')](function(){if(_0x5ce28f!==0x194){return db[_0xb883('0x7b')][_0xb883('0x7d')]({'where':{'WhatsappAccountId':_0x492522},'order':_0xb883('0x7e')})[_0xb883('0x21')](function(_0x3148f5){_0x2b64fd=_0x3148f5;});}})[_0xb883('0x58')](function(_0x47fce0){_0x5ce28f=0x1f4;logger[_0xb883('0x27')](_0x47fce0[_0xb883('0x3b')]);if(_0x47fce0[_0xb883('0x3c')]){delete _0x47fce0['name'];}_0x2b64fd=_0x47fce0;})[_0xb883('0x7f')](function(){if(_0x2b64fd===null){_0x2139a1[_0xb883('0x2a')](_0x5ce28f);}else{if(_0x5ce28f===0x1f4){_0x2139a1[_0xb883('0x2b')](_0x5ce28f)['send'](_0x2b64fd);}else{_0x2139a1[_0xb883('0x2b')](_0x5ce28f)[_0xb883('0x2d')](_0x2b64fd);}}});};exports[_0xb883('0x80')]=function(_0x1e597f,_0x59b776,_0x5b73f0){var _0x29d63a={};var _0x39a150={};var _0xcd5294;var _0xdd1135;return db[_0xb883('0x40')]['findOne']({'where':{'id':_0x1e597f['params']['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x59b776,null))[_0xb883('0x21')](function(_0x4345a5){if(_0x4345a5){_0xcd5294=_0x4345a5;_0x39a150['model']=_['keys'](db[_0xb883('0x7b')][_0xb883('0x41')]);_0x39a150['query']=_[_0xb883('0x46')](_0x1e597f['query']);_0x39a150[_0xb883('0x47')]=_[_0xb883('0x48')](_0x39a150[_0xb883('0x43')],_0x39a150['query']);_0x29d63a[_0xb883('0x49')]=_[_0xb883('0x48')](_0x39a150[_0xb883('0x43')],qs[_0xb883('0x4a')](_0x1e597f['query'][_0xb883('0x4a')]));_0x29d63a[_0xb883('0x49')]=_0x29d63a[_0xb883('0x49')]['length']?_0x29d63a[_0xb883('0x49')]:_0x39a150[_0xb883('0x43')];_0x29d63a['order']=qs[_0xb883('0x4f')](_0x1e597f[_0xb883('0x45')]['sort']);_0x29d63a[_0xb883('0x50')]=qs['filters'](_[_0xb883('0x51')](_0x1e597f[_0xb883('0x45')],_0x39a150[_0xb883('0x47')]));if(_0x1e597f[_0xb883('0x45')][_0xb883('0x52')]){_0x29d63a['where']=_[_0xb883('0x53')](_0x29d63a[_0xb883('0x50')],{'$or':_[_0xb883('0x44')](_0x29d63a[_0xb883('0x49')],function(_0x45ca1a){var _0x2a1584={};_0x2a1584[_0x45ca1a]={'$like':'%'+_0x1e597f[_0xb883('0x45')][_0xb883('0x52')]+'%'};return _0x2a1584;})});}_0x29d63a=_[_0xb883('0x53')]({},_0x29d63a,_0x1e597f[_0xb883('0x54')]);return _0xcd5294[_0xb883('0x80')](_0x29d63a);}})[_0xb883('0x21')](function(_0x1816b5){if(_0x1816b5){_0xdd1135=_0x1816b5[_0xb883('0x4b')];if(!_0x1e597f[_0xb883('0x45')][_0xb883('0x4c')]('nolimit')){_0x29d63a[_0xb883('0x30')]=qs[_0xb883('0x30')](_0x1e597f[_0xb883('0x45')][_0xb883('0x30')]);_0x29d63a[_0xb883('0x2e')]=qs['offset'](_0x1e597f[_0xb883('0x45')][_0xb883('0x2e')]);}return _0xcd5294[_0xb883('0x80')](_0x29d63a);}})[_0xb883('0x21')](function(_0x177c6c){if(_0x177c6c){return _0x177c6c?{'count':_0xdd1135,'rows':_0x177c6c}:null;}})[_0xb883('0x21')](respondWithResult(_0x59b776,null))[_0xb883('0x58')](handleError(_0x59b776,null));};exports[_0xb883('0x81')]=function(_0x4fa7f5,_0x51081c,_0x2d2401){var _0x5f4e8d={'channel':'whatsapp'};var _0x2b5ddc=[];var _0x3063aa=[];var _0x537542={};return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x4fa7f5[_0xb883('0x63')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xb883('0x82')}]})[_0xb883('0x21')](handleEntityNotFound(_0x51081c,null))['then'](function(_0x4fd52f){_0x5f4e8d['account']=_0x4fd52f;if(_0x5f4e8d[_0xb883('0x83')]&&_0x5f4e8d[_0xb883('0x83')]['type']===_0xb883('0x84')&&_0x4fa7f5[_0xb883('0x5c')]['statuses']){if(_0x4fa7f5[_0xb883('0x5c')][_0xb883('0x85')]['length']===0x0)return;if(_0x4fa7f5[_0xb883('0x5c')]['statuses'][0x0]['state']!==_0xb883('0x86'))return;return db['WhatsappMessage'][_0xb883('0x36')]({'read':!![],'readAt':_0x4fa7f5[_0xb883('0x5c')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x4fa7f5[_0xb883('0x5c')][_0xb883('0x85')][0x0][_0xb883('0x87')]},'individualHooks':!![]})['then'](function(_0x3d7374){return _0x51081c[_0xb883('0x2b')](0xc8)[_0xb883('0x2d')](_0x3d7374);});}_0x5f4e8d[_0xb883('0x88')]=_['orderBy'](_0x4fd52f['Applications'],['priority'],[_0xb883('0x89')]);if(_0x5f4e8d['account'][_0xb883('0x82')]){delete _0x5f4e8d['account']['Applications'];}return db['CmContact'][_0xb883('0x64')]()[_0xb883('0x21')](function(_0x5e648e){if(!_0x5e648e){throw new db[(_0xb883('0x8a'))][(_0xb883('0x8b'))]('no\x20available\x20attributes');}_0x2b5ddc=_[_0xb883('0x8c')](_[_0xb883('0x46')](_0x5e648e),['createdAt',_0xb883('0x8d')]);_0x3063aa=_[_0xb883('0x8c')](_['keys'](_0x5e648e),[_0xb883('0x8e'),_0xb883('0x8d'),_0xb883('0x8f'),_0xb883('0x90')]);_0x5f4e8d[_0xb883('0x5c')]={'mapKey':'mobile'};if(_0x5f4e8d[_0xb883('0x83')]&&_0x5f4e8d[_0xb883('0x83')][_0xb883('0x91')]===_0xb883('0x92')){_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x93')]=_0x4fa7f5[_0xb883('0x5c')]['From'][_0xb883('0x94')](_0xb883('0x95'),'');_0x5f4e8d['body'][_0xb883('0x5c')]=_0x4fa7f5[_0xb883('0x5c')]['Body'];_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x96')]=_0x4fa7f5[_0xb883('0x5c')]['MessageSid'];}if(_0x5f4e8d[_0xb883('0x83')]&&_0x5f4e8d[_0xb883('0x83')][_0xb883('0x91')]===_0xb883('0x84')){_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x93')]=_0x4fa7f5[_0xb883('0x5c')]['notifications'][0x0][_0xb883('0x93')];_0x5f4e8d['body'][_0xb883('0x5c')]=_0x4fa7f5[_0xb883('0x5c')][_0xb883('0x97')][0x0][_0xb883('0x28')]['body'];_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x96')]=_0x4fa7f5[_0xb883('0x5c')][_0xb883('0x97')][0x0]['message_id'];}if(_0x5f4e8d[_0xb883('0x5c')]['id']){delete _0x5f4e8d[_0xb883('0x5c')]['id'];}if(_[_0xb883('0x98')](_0x5f4e8d[_0xb883('0x5c')]['from'])){throw new db[(_0xb883('0x8a'))][(_0xb883('0x8b'))](_0xb883('0x99'));}if(_[_0xb883('0x98')](_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x5c')])||_0x5f4e8d[_0xb883('0x5c')]['body']===''){throw new db['Sequelize'][(_0xb883('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5f4e8d[_0xb883('0x5c')]['mapKey'])){throw new db[(_0xb883('0x8a'))]['ValidationError'](_0xb883('0x9a')+_0x3063aa);}if(!_['includes'](_0x3063aa,_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x9b')])){throw new db[(_0xb883('0x8a'))][(_0xb883('0x8b'))](_0xb883('0x9c')+_0x3063aa);}_0x537542[_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x9b')]]=_0x5f4e8d['body'][_0xb883('0x93')];return db['CmList'][_0xb883('0x5f')]({'where':{'id':_0x5f4e8d[_0xb883('0x83')]['ListId']},'include':[{'model':db[_0xb883('0x9d')],'as':'Contacts','where':_0x537542,'limit':0x1,'order':[[_0xb883('0x8d'),_0xb883('0x9e')]]}]});})[_0xb883('0x21')](handleEntityNotFound(_0x51081c,null))[_0xb883('0x21')](function(_0x40f7a8){if(_0x40f7a8){_0x5f4e8d[_0xb883('0x9f')]=_[_0xb883('0xa0')](_0x40f7a8,['Contacts']);if(_0x40f7a8[_0xb883('0xa1')][_0xb883('0x4b')]){return _0x40f7a8[_0xb883('0xa1')][0x0];}var _0x1c4091=_['defaults'](_0x5f4e8d['body'],{'firstName':_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x93')],'ListId':_0x40f7a8['id']});_0x1c4091[_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x9b')]]=_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x93')];return db[_0xb883('0x9d')][_0xb883('0x5b')](_0x1c4091,{'fields':_0x2b5ddc,'raw':!![]});}})[_0xb883('0x21')](handleEntityNotFound(_0x51081c,null))[_0xb883('0x21')](function(_0x1f5ee8){if(_0x1f5ee8){_0x5f4e8d[_0xb883('0xa2')]=_0x1f5ee8;var _0x3a157d={'ContactId':_0x1f5ee8['id'],'phone':_0x5f4e8d['body'][_0xb883('0x93')],'WhatsappAccountId':_0x4fa7f5[_0xb883('0x63')]['id']};var _0x4e417c={'ContactId':_0x1f5ee8['id'],'WhatsappAccountId':_0x4fa7f5[_0xb883('0x63')]['id'],'closed':![]};return db[_0xb883('0xa3')][_0xb883('0x5f')]({'where':_0x4e417c})[_0xb883('0x21')](function(_0x344a9f){if(_0x344a9f){return[_0x344a9f,![]];}return db[_0xb883('0xa3')]['create'](_0x3a157d)['then'](function(_0x1b059e){return[_0x1b059e,!![]];});});}})[_0xb883('0x6f')](function(_0x3e2a2f,_0x322b58){_0x5f4e8d[_0xb883('0xa4')]=_0x3e2a2f[_0xb883('0x38')]({'plain':!![]});_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xa5')]=![];if(_0x322b58){if(_0x5f4e8d[_0xb883('0x83')][_0xb883('0xa6')]){_0x5f4e8d['applications'][_0xb883('0xa7')]({'id':0x0,'priority':_0x5f4e8d[_0xb883('0x88')][_0xb883('0x4b')]+0x1,'app':'close','appdata':_0xb883('0xa8'),'interval':_0xb883('0xa9')});}_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xa5')]=!![];}return db['WhatsappMessage'][_0xb883('0x5b')]({'phone':_0x5f4e8d['body'][_0xb883('0x93')],'messageId':_0x5f4e8d['body'][_0xb883('0x96')],'body':_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x5c')],'WhatsappAccountId':_0x4fa7f5[_0xb883('0x63')]['id'],'WhatsappInteractionId':_0x3e2a2f['id'],'direction':'in','ContactId':_0x3e2a2f[_0xb883('0xaa')],'AttachmentId':_0x5f4e8d['body'][_0xb883('0xab')]});})[_0xb883('0x21')](function(_0x2f9e3a){_0x5f4e8d['message']=_0x2f9e3a;if(!_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xac')])return;return db['User'][_0xb883('0x5f')]({'attributes':['id',_0xb883('0x3c')],'where':{'id':_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xac')]}});})[_0xb883('0x21')](function(_0x2d7a28){if(_0x2d7a28){_0x5f4e8d[_0xb883('0x88')][_0xb883('0xad')]({'id':0x0,'priority':0x0,'app':_0xb883('0xae'),'appdata':_0x2d7a28[_0xb883('0x3c')]+','+(_0x5f4e8d[_0xb883('0x83')][_0xb883('0xaf')]||0xa),'interval':_0xb883('0xa9')});}if(!_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xb0')])return;return db[_0xb883('0xb1')][_0xb883('0x5f')]({'attributes':['id',_0xb883('0x3c')],'where':{'id':_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xb0')]}});})[_0xb883('0x21')](function(_0x301dd2){if(_0x301dd2){_0x5f4e8d[_0xb883('0x88')][_0xb883('0xad')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x301dd2[_0xb883('0x3c')]+','+(_0x5f4e8d[_0xb883('0x83')]['waitForTheAssignedQueue']||0x12c),'interval':_0xb883('0xa9')});}return respondWithRpcPromise(_0xb883('0xb2'),_0xb883('0xb3'),_0x5f4e8d);})[_0xb883('0x21')](function(_0x13e2fc){if(_0x13e2fc){var _0xfecc5a=0xc8;var _0xf20f9d='receiveMessage';logger[_0xb883('0x22')](_0xb883('0xb4'),_0xf20f9d,_0xfecc5a,_0xb883('0xb5'));logger[_0xb883('0x25')](_0xb883('0xb6'),_0xf20f9d,_0xfecc5a,_0xb883('0xb5'),JSON[_0xb883('0x26')](_0x13e2fc));if(_0x5f4e8d[_0xb883('0x83')][_0xb883('0x91')]===_0xb883('0x92')){return _0x51081c[_0xb883('0x2b')](_0xfecc5a)[_0xb883('0x32')](_0xb883('0xb7'),_0xb883('0xb8'))[_0xb883('0x3d')](_0xb883('0xb9'));}else{return _0x51081c[_0xb883('0x2b')](_0xfecc5a)['json'](_0x13e2fc);}}});})[_0xb883('0x58')](handleError(_0x51081c,null));};exports[_0xb883('0x3d')]=function(_0x4e2164,_0x1c6456,_0x475c2a){var _0x2d9ad1,_0x3772e1,_0x5d17d6;if(_['isNil'](_0x4e2164[_0xb883('0x5c')][_0xb883('0x5c')])||_0x4e2164[_0xb883('0x5c')][_0xb883('0x5c')]===''){throw new db[(_0xb883('0x8a'))][(_0xb883('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4e2164[_0xb883('0x5c')]['to'])){throw new db[(_0xb883('0x8a'))][(_0xb883('0x8b'))](_0xb883('0xba'));}_0x2d9ad1=_0x4e2164[_0xb883('0x5c')]['to'];return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x4e2164[_0xb883('0x63')]['id']},'include':[{'model':db[_0xb883('0xbb')],'as':_0xb883('0xbc'),'include':[{'model':db[_0xb883('0x9d')],'as':'Contacts','where':{'mobile':_0x2d9ad1},'limit':0x1,'order':[[_0xb883('0x8d'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1c6456,null))['then'](function(_0x26992a){if(_0x26992a&&_0x26992a[_0xb883('0xbc')]){_0x3772e1=_0x26992a[_0xb883('0x38')]({'plain':!![]});if(_0x3772e1[_0xb883('0xbc')]&&_0x3772e1[_0xb883('0xbc')][_0xb883('0xa1')][_0xb883('0x4b')]){return _0x3772e1[_0xb883('0xbc')]['Contacts'][0x0];}return db['CmContact'][_0xb883('0x5b')](_[_0xb883('0xbd')](_0x4e2164[_0xb883('0x5c')],{'firstName':_0x2d9ad1,'mobile':_0x2d9ad1,'phone':_0x2d9ad1,'ListId':_0x3772e1[_0xb883('0x90')]}));}})['then'](handleEntityNotFound(_0x1c6456,null))[_0xb883('0x21')](function(_0xe9cfd8){if(_0xe9cfd8){_0x5d17d6=_0xe9cfd8;return db[_0xb883('0xa3')][_0xb883('0x5f')]({'where':{'ContactId':_0x5d17d6['id'],'closed':![],'WhatsappAccountId':_0x3772e1['id']}})['then'](function(_0x36ee49){if(_0x36ee49){return[_0x36ee49,![]];}return db[_0xb883('0xa3')][_0xb883('0x5b')]({'UserId':_0x4e2164[_0xb883('0x5d')]['id'],'ContactId':_0x5d17d6['id'],'WhatsappAccountId':_0x3772e1['id'],'phone':_0x2d9ad1,'firstMsgDirection':_0xb883('0xbe'),'Messages':[_['merge'](_0x4e2164[_0xb883('0x5c')],{'read':![],'body':_0x4e2164[_0xb883('0x5c')][_0xb883('0x5c')],'phone':_0x2d9ad1,'WhatsappAccountId':_0x3772e1['id'],'UserId':_0x4e2164[_0xb883('0x5d')]['id'],'ContactId':_0x5d17d6['id']})]},{'include':[{'model':db[_0xb883('0xbf')],'as':_0xb883('0xc0')}]})[_0xb883('0x21')](function(_0x2db8bf){return[_0x2db8bf,!![]];});});}})[_0xb883('0x6f')](function(_0x5b9f0b,_0x1088a9){if(_0x1088a9){return _0x5b9f0b;}return db[_0xb883('0xbf')][_0xb883('0x5b')](_[_0xb883('0x53')](_0x4e2164['body'],{'read':![],'body':_0x4e2164[_0xb883('0x5c')][_0xb883('0x5c')],'phone':_0x2d9ad1,'WhatsappAccountId':_0x3772e1['id'],'WhatsappInteractionId':_0x5b9f0b['id'],'UserId':_0x4e2164[_0xb883('0x5d')]['id'],'ContactId':_0x5d17d6['id']}))[_0xb883('0x21')](function(_0x352214){_0x5b9f0b[_0xb883('0xc1')][_0xb883('0xc0')]=[];_0x5b9f0b['dataValues'][_0xb883('0xc0')][_0xb883('0xa7')](_0x352214['dataValues']);return _0x5b9f0b;});})[_0xb883('0x21')](respondWithResult(_0x1c6456,null))[_0xb883('0x58')](handleError(_0x1c6456,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 3c2a0bf..02dd9a0 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 _0x9fe5=['WhatsappAccount','setMaxListeners','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2bf6be,_0x5b23f1){var _0x532ef4=function(_0x3760df){while(--_0x3760df){_0x2bf6be['push'](_0x2bf6be['shift']());}};_0x532ef4(++_0x5b23f1);}(_0x9fe5,0x1bf));var _0x59fe=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9fe5[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x59fe('0x0'))['db'][_0x59fe('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x59fe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x59fe('0x3')};function emitEvent(_0x22b547){return function(_0x279a56,_0x21230b,_0xbd6033){WhatsappAccountEvents['emit'](_0x22b547+':'+_0x279a56['id'],_0x279a56);WhatsappAccountEvents['emit'](_0x22b547,_0x279a56);_0xbd6033(null);};}for(var e in events){if(events[_0x59fe('0x4')](e)){var event=events[e];WhatsappAccount[_0x59fe('0x5')](e,emitEvent(event));}}module[_0x59fe('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0xf934=['events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x12870e,_0x40960c){var _0x466dbd=function(_0x3bfcdb){while(--_0x3bfcdb){_0x12870e['push'](_0x12870e['shift']());}};_0x466dbd(++_0x40960c);}(_0xf934,0x14a));var _0x4f93=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xf934[_0x1589dd];return _0x1bddd1;};'use strict';var EventEmitter=require(_0x4f93('0x0'));var WhatsappAccount=require(_0x4f93('0x1'))['db'][_0x4f93('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x4f93('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4f93('0x4'),'afterDestroy':_0x4f93('0x5')};function emitEvent(_0x2e7709){return function(_0x32d2b0,_0x98d37f,_0x15f5dc){WhatsappAccountEvents[_0x4f93('0x6')](_0x2e7709+':'+_0x32d2b0['id'],_0x32d2b0);WhatsappAccountEvents[_0x4f93('0x6')](_0x2e7709,_0x32d2b0);_0x15f5dc(null);};}for(var e in events){if(events[_0x4f93('0x7')](e)){var event=events[e];WhatsappAccount[_0x4f93('0x8')](e,emitEvent(event));}}module[_0x4f93('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 8a5fabf..de30f10 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 _0x7ed0=['../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7ed0,0x1a9));var _0x07ed=function(_0x1540e7,_0x516f93){_0x1540e7=_0x1540e7-0x0;var _0xa80081=_0x7ed0[_0x1540e7];return _0xa80081;};'use strict';var _=require(_0x07ed('0x0'));var util=require('util');var logger=require(_0x07ed('0x1'))('api');var moment=require(_0x07ed('0x2'));var BPromise=require(_0x07ed('0x3'));var rp=require(_0x07ed('0x4'));var fs=require('fs');var path=require(_0x07ed('0x5'));var rimraf=require(_0x07ed('0x6'));var config=require(_0x07ed('0x7'));var attributes=require(_0x07ed('0x8'));module[_0x07ed('0x9')]=function(_0x3583d1,_0x1cb2fb){return _0x3583d1[_0x07ed('0xa')]('WhatsappAccount',attributes,{'tableName':_0x07ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0374=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0x0374,0x186));var _0x4037=function(_0x2fde67,_0x340ddb){_0x2fde67=_0x2fde67-0x0;var _0x7093d3=_0x0374[_0x2fde67];return _0x7093d3;};'use strict';var _=require(_0x4037('0x0'));var util=require(_0x4037('0x1'));var logger=require(_0x4037('0x2'))(_0x4037('0x3'));var moment=require('moment');var BPromise=require(_0x4037('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4037('0x5'));var rimraf=require(_0x4037('0x6'));var config=require(_0x4037('0x7'));var attributes=require(_0x4037('0x8'));module[_0x4037('0x9')]=function(_0xcea19c,_0x3a2185){return _0xcea19c['define'](_0x4037('0xa'),attributes,{'tableName':_0x4037('0xb'),'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 c7dbdac..2da3797 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 _0x1126=['where','attributes','include','model','map','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw'];(function(_0x53f608,_0x256def){var _0x495b7d=function(_0x467eab){while(--_0x467eab){_0x53f608['push'](_0x53f608['shift']());}};_0x495b7d(++_0x256def);}(_0x1126,0x177));var _0x6112=function(_0x5e295c,_0x4a2c73){_0x5e295c=_0x5e295c-0x0;var _0x5899aa=_0x1126[_0x5e295c];return _0x5899aa;};'use strict';var _=require(_0x6112('0x0'));var util=require(_0x6112('0x1'));var moment=require(_0x6112('0x2'));var BPromise=require(_0x6112('0x3'));var rs=require(_0x6112('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6112('0x5'))['db'];var utils=require(_0x6112('0x6'));var logger=require(_0x6112('0x7'))(_0x6112('0x8'));var config=require(_0x6112('0x9'));var jayson=require(_0x6112('0xa'));var client=jayson[_0x6112('0xb')][_0x6112('0xc')]({'port':0x232a});config['redis']=_[_0x6112('0xd')](config[_0x6112('0xe')],{'host':_0x6112('0xf'),'port':0x18eb});var socket=require(_0x6112('0x10'))(new Redis(config[_0x6112('0xe')]));require(_0x6112('0x11'))[_0x6112('0x12')](socket);function respondWithRpcPromise(_0x3e07c7,_0x581b93,_0x373142){return new BPromise(function(_0x5a6a69,_0x520d4c){return client[_0x6112('0x13')](_0x3e07c7,_0x373142)['then'](function(_0x316c4d){logger[_0x6112('0x14')](_0x6112('0x15'),_0x581b93,_0x6112('0x16'));logger[_0x6112('0x17')](_0x6112('0x18'),_0x581b93,'request\x20sent',JSON[_0x6112('0x19')](_0x316c4d));if(_0x316c4d[_0x6112('0x1a')]){if(_0x316c4d[_0x6112('0x1a')][_0x6112('0x1b')]===0x1f4){logger['error'](_0x6112('0x15'),_0x581b93,_0x316c4d['error'][_0x6112('0x1c')]);return _0x520d4c(_0x316c4d[_0x6112('0x1a')][_0x6112('0x1c')]);}logger[_0x6112('0x1a')](_0x6112('0x15'),_0x581b93,_0x316c4d[_0x6112('0x1a')]['message']);return _0x5a6a69(_0x316c4d[_0x6112('0x1a')][_0x6112('0x1c')]);}else{logger[_0x6112('0x14')](_0x6112('0x15'),_0x581b93,'request\x20sent');_0x5a6a69(_0x316c4d[_0x6112('0x1d')][_0x6112('0x1c')]);}})['catch'](function(_0x48525a){logger['error'](_0x6112('0x15'),_0x581b93,_0x48525a);_0x520d4c(_0x48525a);});});}exports[_0x6112('0x1e')]=function(_0x4e7fd7){var _0x2cd7ef=this;return new Promise(function(_0x5c142e,_0x205f19){return db[_0x6112('0x1f')][_0x6112('0x20')]({'raw':_0x4e7fd7[_0x6112('0x21')]?_0x4e7fd7[_0x6112('0x21')][_0x6112('0x22')]===undefined?!![]:![]:!![],'where':_0x4e7fd7[_0x6112('0x21')]?_0x4e7fd7[_0x6112('0x21')][_0x6112('0x23')]||null:null,'attributes':_0x4e7fd7[_0x6112('0x21')]?_0x4e7fd7['options'][_0x6112('0x24')]||null:null,'include':_0x4e7fd7['options']?_0x4e7fd7[_0x6112('0x21')][_0x6112('0x25')]?_['map'](_0x4e7fd7[_0x6112('0x21')][_0x6112('0x25')],function(_0x1d12ac){return{'model':db[_0x1d12ac[_0x6112('0x26')]],'as':_0x1d12ac['as'],'attributes':_0x1d12ac[_0x6112('0x24')],'include':_0x1d12ac[_0x6112('0x25')]?_[_0x6112('0x27')](_0x1d12ac[_0x6112('0x25')],function(_0x590924){return{'model':db[_0x590924[_0x6112('0x26')]],'as':_0x590924['as'],'attributes':_0x590924[_0x6112('0x24')],'include':_0x590924['include']?_['map'](_0x590924[_0x6112('0x25')],function(_0x2396db){return{'model':db[_0x2396db[_0x6112('0x26')]],'as':_0x2396db['as'],'attributes':_0x2396db['attributes']};}):[]};}):[]};}):[]:[]})[_0x6112('0x28')](function(_0x1df2fb){logger[_0x6112('0x14')](_0x6112('0x1e'),_0x4e7fd7);logger[_0x6112('0x17')](_0x6112('0x1e'),_0x4e7fd7,JSON[_0x6112('0x19')](_0x1df2fb));_0x5c142e(_0x1df2fb);})['catch'](function(_0x4271e9){logger[_0x6112('0x1a')]('ShowWhatsappAccount',_0x4271e9[_0x6112('0x1c')],_0x4e7fd7);_0x205f19(_0x2cd7ef['error'](0x1f4,_0x4271e9[_0x6112('0x1c')]));});});}; \ No newline at end of file +var _0x2420=['debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowWhatsappAccount','find','options','raw','attributes','map','include','model','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1f32af,_0x1514ef){var _0x64627e=function(_0x5886da){while(--_0x5886da){_0x1f32af['push'](_0x1f32af['shift']());}};_0x64627e(++_0x1514ef);}(_0x2420,0xfd));var _0x0242=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x2420[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0242('0x0'));var util=require(_0x0242('0x1'));var moment=require(_0x0242('0x2'));var BPromise=require(_0x0242('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0242('0x4'));var db=require(_0x0242('0x5'))['db'];var utils=require(_0x0242('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0242('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0242('0x8')]({'port':0x232a});config[_0x0242('0x9')]=_[_0x0242('0xa')](config[_0x0242('0x9')],{'host':_0x0242('0xb'),'port':0x18eb});var socket=require(_0x0242('0xc'))(new Redis(config[_0x0242('0x9')]));require(_0x0242('0xd'))['register'](socket);function respondWithRpcPromise(_0x3add53,_0x5b9032,_0xcad981){return new BPromise(function(_0x3070d1,_0x1be3a2){return client[_0x0242('0xe')](_0x3add53,_0xcad981)[_0x0242('0xf')](function(_0x23c9bc){logger[_0x0242('0x10')](_0x0242('0x11'),_0x5b9032,_0x0242('0x12'));logger[_0x0242('0x13')](_0x0242('0x14'),_0x5b9032,_0x0242('0x12'),JSON[_0x0242('0x15')](_0x23c9bc));if(_0x23c9bc[_0x0242('0x16')]){if(_0x23c9bc[_0x0242('0x16')]['code']===0x1f4){logger['error'](_0x0242('0x11'),_0x5b9032,_0x23c9bc[_0x0242('0x16')][_0x0242('0x17')]);return _0x1be3a2(_0x23c9bc[_0x0242('0x16')][_0x0242('0x17')]);}logger[_0x0242('0x16')](_0x0242('0x11'),_0x5b9032,_0x23c9bc['error'][_0x0242('0x17')]);return _0x3070d1(_0x23c9bc[_0x0242('0x16')][_0x0242('0x17')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5b9032,_0x0242('0x12'));_0x3070d1(_0x23c9bc[_0x0242('0x18')][_0x0242('0x17')]);}})['catch'](function(_0x155df4){logger[_0x0242('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x5b9032,_0x155df4);_0x1be3a2(_0x155df4);});});}exports[_0x0242('0x19')]=function(_0x5ef28a){var _0x11af1a=this;return new Promise(function(_0x4cdfe7,_0x2cf452){return db['WhatsappAccount'][_0x0242('0x1a')]({'raw':_0x5ef28a[_0x0242('0x1b')]?_0x5ef28a[_0x0242('0x1b')][_0x0242('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ef28a[_0x0242('0x1b')]?_0x5ef28a[_0x0242('0x1b')]['where']||null:null,'attributes':_0x5ef28a['options']?_0x5ef28a[_0x0242('0x1b')][_0x0242('0x1d')]||null:null,'include':_0x5ef28a[_0x0242('0x1b')]?_0x5ef28a[_0x0242('0x1b')]['include']?_[_0x0242('0x1e')](_0x5ef28a[_0x0242('0x1b')][_0x0242('0x1f')],function(_0xdbd01c){return{'model':db[_0xdbd01c[_0x0242('0x20')]],'as':_0xdbd01c['as'],'attributes':_0xdbd01c[_0x0242('0x1d')],'include':_0xdbd01c['include']?_['map'](_0xdbd01c[_0x0242('0x1f')],function(_0x28539e){return{'model':db[_0x28539e[_0x0242('0x20')]],'as':_0x28539e['as'],'attributes':_0x28539e[_0x0242('0x1d')],'include':_0x28539e[_0x0242('0x1f')]?_[_0x0242('0x1e')](_0x28539e[_0x0242('0x1f')],function(_0x1e89be){return{'model':db[_0x1e89be[_0x0242('0x20')]],'as':_0x1e89be['as'],'attributes':_0x1e89be['attributes']};}):[]};}):[]};}):[]:[]})[_0x0242('0xf')](function(_0x14232){logger[_0x0242('0x10')](_0x0242('0x19'),_0x5ef28a);logger[_0x0242('0x13')](_0x0242('0x19'),_0x5ef28a,JSON[_0x0242('0x15')](_0x14232));_0x4cdfe7(_0x14232);})[_0x0242('0x21')](function(_0x3abcdc){logger[_0x0242('0x16')]('ShowWhatsappAccount',_0x3abcdc['message'],_0x5ef28a);_0x2cf452(_0x11af1a[_0x0242('0x16')](0x1f4,_0x3abcdc[_0x0242('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b4a6c57..5d55c7d 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 _0xc5db=['removeListener','register','whatsappAccount:','save','remove'];(function(_0x2f8f44,_0x4989a4){var _0x547293=function(_0x2373f6){while(--_0x2373f6){_0x2f8f44['push'](_0x2f8f44['shift']());}};_0x547293(++_0x4989a4);}(_0xc5db,0x10c));var _0xbc5d=function(_0x3825de,_0x5e8189){_0x3825de=_0x3825de-0x0;var _0xc87bd8=_0xc5db[_0x3825de];return _0xc87bd8;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xbc5d('0x0'),_0xbc5d('0x1'),'update'];function createListener(_0x3bff0e,_0x4929c1){return function(_0x5df61e){_0x4929c1['emit'](_0x3bff0e,_0x5df61e);};}function removeListener(_0x1114d0,_0x129267){return function(){WhatsappAccountEvents[_0xbc5d('0x2')](_0x1114d0,_0x129267);};}exports[_0xbc5d('0x3')]=function(_0x5084aa){for(var _0xedc85e=0x0,_0x5a7d35=events['length'];_0xedc85e<_0x5a7d35;_0xedc85e++){var _0x1dc0f6=events[_0xedc85e];var _0x420935=createListener(_0xbc5d('0x4')+_0x1dc0f6,_0x5084aa);WhatsappAccountEvents['on'](_0x1dc0f6,_0x420935);}}; \ No newline at end of file +var _0x2394=['removeListener','length','whatsappAccount:','save','update'];(function(_0x34b7ae,_0x5d3602){var _0x16aac5=function(_0x4943c6){while(--_0x4943c6){_0x34b7ae['push'](_0x34b7ae['shift']());}};_0x16aac5(++_0x5d3602);}(_0x2394,0x1a7));var _0x4239=function(_0x4f7016,_0x4e36b2){_0x4f7016=_0x4f7016-0x0;var _0x4617d9=_0x2394[_0x4f7016];return _0x4617d9;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x4239('0x0'),'remove',_0x4239('0x1')];function createListener(_0x25d1e6,_0x3356f0){return function(_0x262464){_0x3356f0['emit'](_0x25d1e6,_0x262464);};}function removeListener(_0x518924,_0x484584){return function(){WhatsappAccountEvents[_0x4239('0x2')](_0x518924,_0x484584);};}exports['register']=function(_0x4a37ad){for(var _0x385d72=0x0,_0x42b83b=events[_0x4239('0x3')];_0x385d72<_0x42b83b;_0x385d72++){var _0x3e98de=events[_0x385d72];var _0x52b139=createListener(_0x4239('0x4')+_0x3e98de,_0x4a37ad);WhatsappAccountEvents['on'](_0x3e98de,_0x52b139);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 85be9db..0f8c14d 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 _0x4c17=['delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update'];(function(_0xf3c843,_0x8ff24e){var _0x3191c6=function(_0x2f1ef7){while(--_0x2f1ef7){_0xf3c843['push'](_0xf3c843['shift']());}};_0x3191c6(++_0x8ff24e);}(_0x4c17,0x152));var _0x74c1=function(_0x572c81,_0x415049){_0x572c81=_0x572c81-0x0;var _0x5bd14a=_0x4c17[_0x572c81];return _0x5bd14a;};'use strict';var multer=require(_0x74c1('0x0'));var util=require(_0x74c1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x74c1('0x2')]();var fs_extra=require(_0x74c1('0x3'));var auth=require(_0x74c1('0x4'));var interaction=require(_0x74c1('0x5'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x74c1('0x6')]('/',auth[_0x74c1('0x7')](),controller[_0x74c1('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x74c1('0x9')]);router[_0x74c1('0xa')]('/',auth[_0x74c1('0x7')](),controller['create']);router[_0x74c1('0xb')](_0x74c1('0xc'),auth[_0x74c1('0x7')](),controller[_0x74c1('0xd')]);router[_0x74c1('0xe')](_0x74c1('0xc'),auth[_0x74c1('0x7')](),controller['destroy']);module[_0x74c1('0xf')]=router; \ No newline at end of file +var _0xb996=['post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x35eee2,_0x3e19af){var _0xb47b69=function(_0x4f2712){while(--_0x4f2712){_0x35eee2['push'](_0x35eee2['shift']());}};_0xb47b69(++_0x3e19af);}(_0xb996,0x194));var _0x6b99=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb996[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0x6b99('0x0'));var util=require('util');var path=require(_0x6b99('0x1'));var timeout=require(_0x6b99('0x2'));var express=require(_0x6b99('0x3'));var router=express['Router']();var fs_extra=require(_0x6b99('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6b99('0x5'));var config=require(_0x6b99('0x6'));var controller=require(_0x6b99('0x7'));router[_0x6b99('0x8')]('/',auth[_0x6b99('0x9')](),controller['index']);router[_0x6b99('0x8')]('/:id',auth[_0x6b99('0x9')](),controller['show']);router[_0x6b99('0xa')]('/',auth[_0x6b99('0x9')](),controller[_0x6b99('0xb')]);router[_0x6b99('0xc')]('/:id',auth[_0x6b99('0x9')](),controller[_0x6b99('0xd')]);router[_0x6b99('0xe')](_0x6b99('0xf'),auth['isAuthenticated'](),controller[_0x6b99('0x10')]);module[_0x6b99('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index d3864f8..6419f28 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 _0x6d5e=['STRING','*,*,*,*','exports','noop','TEXT'];(function(_0x2f3f09,_0x69d41b){var _0x5df518=function(_0x124516){while(--_0x124516){_0x2f3f09['push'](_0x2f3f09['shift']());}};_0x5df518(++_0x69d41b);}(_0x6d5e,0x7f));var _0xe6d5=function(_0x345896,_0x5a639b){_0x345896=_0x345896-0x0;var _0x4e9b8e=_0x6d5e[_0x345896];return _0x4e9b8e;};'use strict';var Sequelize=require('sequelize');module[_0xe6d5('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe6d5('0x1')},'appdata':{'type':Sequelize[_0xe6d5('0x2')]()},'description':{'type':Sequelize[_0xe6d5('0x3')]},'interval':{'type':Sequelize[_0xe6d5('0x3')],'defaultValue':_0xe6d5('0x4')}}; \ No newline at end of file +var _0x3032=['sequelize','STRING','noop','TEXT','*,*,*,*'];(function(_0xed0571,_0x2b26fc){var _0xef80f3=function(_0x22980b){while(--_0x22980b){_0xed0571['push'](_0xed0571['shift']());}};_0xef80f3(++_0x2b26fc);}(_0x3032,0xcd));var _0x2303=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3032[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2303('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2303('0x1')],'allowNull':![],'defaultValue':_0x2303('0x2')},'appdata':{'type':Sequelize[_0x2303('0x3')]()},'description':{'type':Sequelize[_0x2303('0x1')]},'interval':{'type':Sequelize[_0x2303('0x1')],'defaultValue':_0x2303('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 74ee973..9347902 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 _0x81cb=['model','attributes','fields','length','order','sort','where','pick','filter','merge','options','WhatsappApplication','count','findAll','rows','show','params','includeAll','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x192b0c,_0x38bc7e){var _0x1694d5=function(_0x20aa04){while(--_0x20aa04){_0x192b0c['push'](_0x192b0c['shift']());}};_0x1694d5(++_0x38bc7e);}(_0x81cb,0xaa));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb81c('0x0'));var rimraf=require(_0xb81c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb81c('0x2'));var rp=require(_0xb81c('0x3'));var moment=require('moment');var BPromise=require(_0xb81c('0x4'));var Mustache=require(_0xb81c('0x5'));var util=require(_0xb81c('0x6'));var path=require(_0xb81c('0x7'));var sox=require('sox');var csv=require(_0xb81c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb81c('0x9'));var squel=require(_0xb81c('0xa'));var crypto=require(_0xb81c('0xb'));var jsforce=require(_0xb81c('0xc'));var deskjs=require(_0xb81c('0xd'));var toCsv=require(_0xb81c('0x8'));var querystring=require(_0xb81c('0xe'));var Papa=require(_0xb81c('0xf'));var Redis=require(_0xb81c('0x10'));var authService=require(_0xb81c('0x11'));var qs=require(_0xb81c('0x12'));var as=require(_0xb81c('0x13'));var hardwareService=require(_0xb81c('0x14'));var logger=require(_0xb81c('0x15'))('api');var utils=require(_0xb81c('0x16'));var config=require(_0xb81c('0x17'));var licenseUtil=require(_0xb81c('0x18'));var db=require(_0xb81c('0x19'))['db'];function respondWithStatusCode(_0x2e8242,_0x4b1d98){_0x4b1d98=_0x4b1d98||0xcc;return function(_0x9c3214){if(_0x9c3214){return _0x2e8242['sendStatus'](_0x4b1d98);}return _0x2e8242[_0xb81c('0x1a')](_0x4b1d98)[_0xb81c('0x1b')]();};}function respondWithResult(_0x572945,_0x1bb255){_0x1bb255=_0x1bb255||0xc8;return function(_0x2f50d3){if(_0x2f50d3){return _0x572945['status'](_0x1bb255)[_0xb81c('0x1c')](_0x2f50d3);}};}function respondWithFilteredResult(_0x3942dc,_0x3462bd){return function(_0x56eb92){if(_0x56eb92){var _0x393e11=typeof _0x3462bd[_0xb81c('0x1d')]==='undefined'&&typeof _0x3462bd[_0xb81c('0x1e')]===_0xb81c('0x1f');var _0x32916b=_0x56eb92['count'];var _0x37341d=_0x393e11?0x0:_0x3462bd[_0xb81c('0x1d')];var _0xbcf806=_0x393e11?_0x56eb92['count']:_0x3462bd[_0xb81c('0x1d')]+_0x3462bd[_0xb81c('0x1e')];var _0xfab47b;if(_0xbcf806>=_0x32916b){_0xbcf806=_0x32916b;_0xfab47b=0xc8;}else{_0xfab47b=0xce;}_0x3942dc[_0xb81c('0x1a')](_0xfab47b);return _0x3942dc[_0xb81c('0x20')](_0xb81c('0x21'),_0x37341d+'-'+_0xbcf806+'/'+_0x32916b)[_0xb81c('0x1c')](_0x56eb92);}return null;};}function patchUpdates(_0x4f09d7){return function(_0xc2ba68){try{jsonpatch[_0xb81c('0x22')](_0xc2ba68,_0x4f09d7,!![]);}catch(_0x1aa39a){return BPromise[_0xb81c('0x23')](_0x1aa39a);}return _0xc2ba68['save']();};}function saveUpdates(_0x11a5d3,_0x597547){return function(_0x449ad7){if(_0x449ad7){return _0x449ad7[_0xb81c('0x24')](_0x11a5d3)[_0xb81c('0x25')](function(_0x14650e){return _0x14650e;});}return null;};}function removeEntity(_0x554cc0,_0x5de2ac){return function(_0x12798b){if(_0x12798b){return _0x12798b[_0xb81c('0x26')]()[_0xb81c('0x25')](function(){_0x554cc0[_0xb81c('0x1a')](0xcc)[_0xb81c('0x1b')]();});}};}function handleEntityNotFound(_0x17d176,_0x45dbe5){return function(_0xc1fadb){if(!_0xc1fadb){_0x17d176[_0xb81c('0x27')](0x194);}return _0xc1fadb;};}function handleError(_0x2143ba,_0x253333){_0x253333=_0x253333||0x1f4;return function(_0x132080){logger[_0xb81c('0x28')](_0x132080[_0xb81c('0x29')]);if(_0x132080[_0xb81c('0x2a')]){delete _0x132080[_0xb81c('0x2a')];}_0x2143ba[_0xb81c('0x1a')](_0x253333)['send'](_0x132080);};}exports['index']=function(_0x15f86e,_0x1bb0e5){var _0x5470d3={},_0x3b690b={},_0x331692={'count':0x0,'rows':[]};var _0x545530=_[_0xb81c('0x2b')](db['WhatsappApplication'][_0xb81c('0x2c')],function(_0x5df2df){return{'name':_0x5df2df[_0xb81c('0x2d')],'type':_0x5df2df[_0xb81c('0x2e')][_0xb81c('0x2f')]};});_0x3b690b['model']=_[_0xb81c('0x2b')](_0x545530,'name');_0x3b690b[_0xb81c('0x30')]=_[_0xb81c('0x31')](_0x15f86e['query']);_0x3b690b[_0xb81c('0x32')]=_[_0xb81c('0x33')](_0x3b690b[_0xb81c('0x34')],_0x3b690b['query']);_0x5470d3[_0xb81c('0x35')]=_[_0xb81c('0x33')](_0x3b690b[_0xb81c('0x34')],qs[_0xb81c('0x36')](_0x15f86e[_0xb81c('0x30')][_0xb81c('0x36')]));_0x5470d3[_0xb81c('0x35')]=_0x5470d3[_0xb81c('0x35')][_0xb81c('0x37')]?_0x5470d3[_0xb81c('0x35')]:_0x3b690b['model'];if(!_0x15f86e[_0xb81c('0x30')]['hasOwnProperty']('nolimit')){_0x5470d3[_0xb81c('0x1e')]=qs['limit'](_0x15f86e[_0xb81c('0x30')]['limit']);_0x5470d3[_0xb81c('0x1d')]=qs[_0xb81c('0x1d')](_0x15f86e['query'][_0xb81c('0x1d')]);}_0x5470d3[_0xb81c('0x38')]=qs[_0xb81c('0x39')](_0x15f86e['query'][_0xb81c('0x39')]);_0x5470d3[_0xb81c('0x3a')]=qs[_0xb81c('0x32')](_[_0xb81c('0x3b')](_0x15f86e['query'],_0x3b690b[_0xb81c('0x32')]),_0x545530);if(_0x15f86e[_0xb81c('0x30')][_0xb81c('0x3c')]){_0x5470d3[_0xb81c('0x3a')]=_[_0xb81c('0x3d')](_0x5470d3[_0xb81c('0x3a')],{'$or':_[_0xb81c('0x2b')](_0x545530,function(_0x3284c6){if(_0x3284c6['type']!=='VIRTUAL'){var _0x4962ff={};_0x4962ff[_0x3284c6['name']]={'$like':'%'+_0x15f86e['query'][_0xb81c('0x3c')]+'%'};return _0x4962ff;}})});}_0x5470d3=_['merge']({},_0x5470d3,_0x15f86e[_0xb81c('0x3e')]);var _0x8fced9={'where':_0x5470d3[_0xb81c('0x3a')]};return db[_0xb81c('0x3f')][_0xb81c('0x40')](_0x8fced9)['then'](function(_0x458e22){_0x331692[_0xb81c('0x40')]=_0x458e22;if(_0x15f86e['query']['includeAll']){_0x5470d3['include']=[{'all':!![]}];}return db[_0xb81c('0x3f')][_0xb81c('0x41')](_0x5470d3);})[_0xb81c('0x25')](function(_0x1dff58){_0x331692[_0xb81c('0x42')]=_0x1dff58;return _0x331692;})[_0xb81c('0x25')](respondWithFilteredResult(_0x1bb0e5,_0x5470d3))['catch'](handleError(_0x1bb0e5,null));};exports[_0xb81c('0x43')]=function(_0x5513d0,_0x17dde0){var _0x8ac731={'raw':!![],'where':{'id':_0x5513d0[_0xb81c('0x44')]['id']}},_0x19b752={};_0x19b752['model']=_[_0xb81c('0x31')](db['WhatsappApplication'][_0xb81c('0x2c')]);_0x19b752['query']=_[_0xb81c('0x31')](_0x5513d0[_0xb81c('0x30')]);_0x19b752[_0xb81c('0x32')]=_['intersection'](_0x19b752[_0xb81c('0x34')],_0x19b752['query']);_0x8ac731[_0xb81c('0x35')]=_[_0xb81c('0x33')](_0x19b752[_0xb81c('0x34')],qs['fields'](_0x5513d0[_0xb81c('0x30')][_0xb81c('0x36')]));_0x8ac731[_0xb81c('0x35')]=_0x8ac731[_0xb81c('0x35')][_0xb81c('0x37')]?_0x8ac731[_0xb81c('0x35')]:_0x19b752[_0xb81c('0x34')];if(_0x5513d0[_0xb81c('0x30')][_0xb81c('0x45')]){_0x8ac731['include']=[{'all':!![]}];}_0x8ac731=_[_0xb81c('0x3d')]({},_0x8ac731,_0x5513d0[_0xb81c('0x3e')]);return db[_0xb81c('0x3f')][_0xb81c('0x46')](_0x8ac731)[_0xb81c('0x25')](handleEntityNotFound(_0x17dde0,null))['then'](respondWithResult(_0x17dde0,null))[_0xb81c('0x47')](handleError(_0x17dde0,null));};exports['create']=function(_0x187ec1,_0x4089b0){return db[_0xb81c('0x3f')][_0xb81c('0x48')](_0x187ec1[_0xb81c('0x49')],{})[_0xb81c('0x25')](respondWithResult(_0x4089b0,0xc9))[_0xb81c('0x47')](handleError(_0x4089b0,null));};exports['update']=function(_0x40fbf6,_0x200464){if(_0x40fbf6['body']['id']){delete _0x40fbf6['body']['id'];}return db[_0xb81c('0x3f')][_0xb81c('0x46')]({'where':{'id':_0x40fbf6[_0xb81c('0x44')]['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x200464,null))[_0xb81c('0x25')](saveUpdates(_0x40fbf6[_0xb81c('0x49')],null))[_0xb81c('0x25')](respondWithResult(_0x200464,null))[_0xb81c('0x47')](handleError(_0x200464,null));};exports[_0xb81c('0x26')]=function(_0x2e43a1,_0x512b3b){return db['WhatsappApplication'][_0xb81c('0x46')]({'where':{'id':_0x2e43a1['params']['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x512b3b,null))[_0xb81c('0x25')](removeEntity(_0x512b3b,null))[_0xb81c('0x47')](handleError(_0x512b3b,null));}; \ No newline at end of file +var _0x9e63=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappApplication','includeAll','include','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../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','error','stack','name','index','map','rawAttributes','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e63,0x65));var _0x39e6=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x9e63[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0x39e6('0x0'));var rimraf=require(_0x39e6('0x1'));var zipdir=require(_0x39e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39e6('0x3'));var moment=require(_0x39e6('0x4'));var BPromise=require(_0x39e6('0x5'));var Mustache=require(_0x39e6('0x6'));var util=require(_0x39e6('0x7'));var path=require(_0x39e6('0x8'));var sox=require(_0x39e6('0x9'));var csv=require(_0x39e6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39e6('0xb'));var _=require(_0x39e6('0xc'));var squel=require(_0x39e6('0xd'));var crypto=require('crypto');var jsforce=require(_0x39e6('0xe'));var deskjs=require(_0x39e6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x39e6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x39e6('0x11'));var qs=require(_0x39e6('0x12'));var as=require(_0x39e6('0x13'));var hardwareService=require(_0x39e6('0x14'));var logger=require(_0x39e6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x39e6('0x16'));var licenseUtil=require(_0x39e6('0x17'));var db=require(_0x39e6('0x18'))['db'];function respondWithStatusCode(_0x80f85b,_0x168d1d){_0x168d1d=_0x168d1d||0xcc;return function(_0x57d223){if(_0x57d223){return _0x80f85b[_0x39e6('0x19')](_0x168d1d);}return _0x80f85b[_0x39e6('0x1a')](_0x168d1d)[_0x39e6('0x1b')]();};}function respondWithResult(_0x12253a,_0x4b9fc1){_0x4b9fc1=_0x4b9fc1||0xc8;return function(_0x4ed79d){if(_0x4ed79d){return _0x12253a[_0x39e6('0x1a')](_0x4b9fc1)[_0x39e6('0x1c')](_0x4ed79d);}};}function respondWithFilteredResult(_0xbca4f5,_0x3a4651){return function(_0x30c73e){if(_0x30c73e){var _0x5a86e3=typeof _0x3a4651[_0x39e6('0x1d')]===_0x39e6('0x1e')&&typeof _0x3a4651[_0x39e6('0x1f')]===_0x39e6('0x1e');var _0x18d076=_0x30c73e[_0x39e6('0x20')];var _0x1a3adf=_0x5a86e3?0x0:_0x3a4651['offset'];var _0x24a61c=_0x5a86e3?_0x30c73e[_0x39e6('0x20')]:_0x3a4651[_0x39e6('0x1d')]+_0x3a4651['limit'];var _0x47e94b;if(_0x24a61c>=_0x18d076){_0x24a61c=_0x18d076;_0x47e94b=0xc8;}else{_0x47e94b=0xce;}_0xbca4f5[_0x39e6('0x1a')](_0x47e94b);return _0xbca4f5[_0x39e6('0x21')](_0x39e6('0x22'),_0x1a3adf+'-'+_0x24a61c+'/'+_0x18d076)[_0x39e6('0x1c')](_0x30c73e);}return null;};}function patchUpdates(_0x18031b){return function(_0x5421fd){try{jsonpatch[_0x39e6('0x23')](_0x5421fd,_0x18031b,!![]);}catch(_0x59c532){return BPromise[_0x39e6('0x24')](_0x59c532);}return _0x5421fd[_0x39e6('0x25')]();};}function saveUpdates(_0x4b826a,_0x2884f6){return function(_0x1c626a){if(_0x1c626a){return _0x1c626a[_0x39e6('0x26')](_0x4b826a)[_0x39e6('0x27')](function(_0x314c7d){return _0x314c7d;});}return null;};}function removeEntity(_0x19df42,_0x183f33){return function(_0x4619ee){if(_0x4619ee){return _0x4619ee[_0x39e6('0x28')]()[_0x39e6('0x27')](function(){_0x19df42[_0x39e6('0x1a')](0xcc)[_0x39e6('0x1b')]();});}};}function handleEntityNotFound(_0x3dce4d,_0x5102d8){return function(_0x537462){if(!_0x537462){_0x3dce4d['sendStatus'](0x194);}return _0x537462;};}function handleError(_0x4aa6ee,_0x48fdb){_0x48fdb=_0x48fdb||0x1f4;return function(_0x22b820){logger[_0x39e6('0x29')](_0x22b820[_0x39e6('0x2a')]);if(_0x22b820['name']){delete _0x22b820[_0x39e6('0x2b')];}_0x4aa6ee[_0x39e6('0x1a')](_0x48fdb)['send'](_0x22b820);};}exports[_0x39e6('0x2c')]=function(_0x1a60ae,_0x582c81){var _0x1acc77={},_0x2117d0={},_0xc3c7fe={'count':0x0,'rows':[]};var _0x3e690f=_[_0x39e6('0x2d')](db['WhatsappApplication'][_0x39e6('0x2e')],function(_0x596d6f){return{'name':_0x596d6f[_0x39e6('0x2f')],'type':_0x596d6f[_0x39e6('0x30')][_0x39e6('0x31')]};});_0x2117d0[_0x39e6('0x32')]=_[_0x39e6('0x2d')](_0x3e690f,_0x39e6('0x2b'));_0x2117d0[_0x39e6('0x33')]=_[_0x39e6('0x34')](_0x1a60ae[_0x39e6('0x33')]);_0x2117d0[_0x39e6('0x35')]=_[_0x39e6('0x36')](_0x2117d0[_0x39e6('0x32')],_0x2117d0[_0x39e6('0x33')]);_0x1acc77[_0x39e6('0x37')]=_[_0x39e6('0x36')](_0x2117d0[_0x39e6('0x32')],qs['fields'](_0x1a60ae[_0x39e6('0x33')][_0x39e6('0x38')]));_0x1acc77[_0x39e6('0x37')]=_0x1acc77['attributes'][_0x39e6('0x39')]?_0x1acc77[_0x39e6('0x37')]:_0x2117d0[_0x39e6('0x32')];if(!_0x1a60ae['query'][_0x39e6('0x3a')]('nolimit')){_0x1acc77[_0x39e6('0x1f')]=qs[_0x39e6('0x1f')](_0x1a60ae[_0x39e6('0x33')]['limit']);_0x1acc77[_0x39e6('0x1d')]=qs[_0x39e6('0x1d')](_0x1a60ae[_0x39e6('0x33')][_0x39e6('0x1d')]);}_0x1acc77['order']=qs['sort'](_0x1a60ae[_0x39e6('0x33')][_0x39e6('0x3b')]);_0x1acc77[_0x39e6('0x3c')]=qs[_0x39e6('0x35')](_[_0x39e6('0x3d')](_0x1a60ae[_0x39e6('0x33')],_0x2117d0[_0x39e6('0x35')]),_0x3e690f);if(_0x1a60ae['query'][_0x39e6('0x3e')]){_0x1acc77['where']=_['merge'](_0x1acc77[_0x39e6('0x3c')],{'$or':_[_0x39e6('0x2d')](_0x3e690f,function(_0x34aee8){if(_0x34aee8[_0x39e6('0x30')]!==_0x39e6('0x3f')){var _0x380663={};_0x380663[_0x34aee8[_0x39e6('0x2b')]]={'$like':'%'+_0x1a60ae[_0x39e6('0x33')]['filter']+'%'};return _0x380663;}})});}_0x1acc77=_[_0x39e6('0x40')]({},_0x1acc77,_0x1a60ae[_0x39e6('0x41')]);var _0x2c4ae9={'where':_0x1acc77[_0x39e6('0x3c')]};return db[_0x39e6('0x42')]['count'](_0x2c4ae9)['then'](function(_0x16df4b){_0xc3c7fe[_0x39e6('0x20')]=_0x16df4b;if(_0x1a60ae['query'][_0x39e6('0x43')]){_0x1acc77[_0x39e6('0x44')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x1acc77);})[_0x39e6('0x27')](function(_0xd3342a){_0xc3c7fe['rows']=_0xd3342a;return _0xc3c7fe;})[_0x39e6('0x27')](respondWithFilteredResult(_0x582c81,_0x1acc77))[_0x39e6('0x45')](handleError(_0x582c81,null));};exports[_0x39e6('0x46')]=function(_0x2f3021,_0x3f8b5f){var _0x3bdd55={'raw':!![],'where':{'id':_0x2f3021[_0x39e6('0x47')]['id']}},_0x28397d={};_0x28397d['model']=_[_0x39e6('0x34')](db[_0x39e6('0x42')][_0x39e6('0x2e')]);_0x28397d['query']=_['keys'](_0x2f3021[_0x39e6('0x33')]);_0x28397d[_0x39e6('0x35')]=_[_0x39e6('0x36')](_0x28397d[_0x39e6('0x32')],_0x28397d[_0x39e6('0x33')]);_0x3bdd55[_0x39e6('0x37')]=_[_0x39e6('0x36')](_0x28397d['model'],qs['fields'](_0x2f3021['query'][_0x39e6('0x38')]));_0x3bdd55['attributes']=_0x3bdd55[_0x39e6('0x37')][_0x39e6('0x39')]?_0x3bdd55[_0x39e6('0x37')]:_0x28397d[_0x39e6('0x32')];if(_0x2f3021[_0x39e6('0x33')][_0x39e6('0x43')]){_0x3bdd55[_0x39e6('0x44')]=[{'all':!![]}];}_0x3bdd55=_[_0x39e6('0x40')]({},_0x3bdd55,_0x2f3021[_0x39e6('0x41')]);return db[_0x39e6('0x42')]['find'](_0x3bdd55)[_0x39e6('0x27')](handleEntityNotFound(_0x3f8b5f,null))[_0x39e6('0x27')](respondWithResult(_0x3f8b5f,null))[_0x39e6('0x45')](handleError(_0x3f8b5f,null));};exports[_0x39e6('0x48')]=function(_0x4ea62b,_0x49226f){return db[_0x39e6('0x42')]['create'](_0x4ea62b[_0x39e6('0x49')],{})[_0x39e6('0x27')](respondWithResult(_0x49226f,0xc9))['catch'](handleError(_0x49226f,null));};exports[_0x39e6('0x26')]=function(_0x2300b9,_0xabd04b){if(_0x2300b9[_0x39e6('0x49')]['id']){delete _0x2300b9[_0x39e6('0x49')]['id'];}return db[_0x39e6('0x42')][_0x39e6('0x4a')]({'where':{'id':_0x2300b9[_0x39e6('0x47')]['id']}})[_0x39e6('0x27')](handleEntityNotFound(_0xabd04b,null))[_0x39e6('0x27')](saveUpdates(_0x2300b9[_0x39e6('0x49')],null))[_0x39e6('0x27')](respondWithResult(_0xabd04b,null))[_0x39e6('0x45')](handleError(_0xabd04b,null));};exports[_0x39e6('0x28')]=function(_0x13e478,_0x12ee54){return db[_0x39e6('0x42')]['find']({'where':{'id':_0x13e478[_0x39e6('0x47')]['id']}})['then'](handleEntityNotFound(_0x12ee54,null))['then'](removeEntity(_0x12ee54,null))['catch'](handleError(_0x12ee54,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5889106..61ade45 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 _0x3435=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','WhatsappApplication'];(function(_0x15f19d,_0x1217ba){var _0x4b9e66=function(_0x423301){while(--_0x423301){_0x15f19d['push'](_0x15f19d['shift']());}};_0x4b9e66(++_0x1217ba);}(_0x3435,0xfa));var _0x5343=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x3435[_0x5eef05];return _0x56d4b8;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var logger=require(_0x5343('0x2'))(_0x5343('0x3'));var moment=require(_0x5343('0x4'));var BPromise=require(_0x5343('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5343('0x6'));var rimraf=require(_0x5343('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0x5343('0x8')]=function(_0x28f0f3,_0x4d26b5){return _0x28f0f3['define'](_0x5343('0x9'),attributes,{'tableName':_0x5343('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5343('0xb'),'collate':_0x5343('0xc')});}; \ No newline at end of file +var _0x0f9f=['./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x915353,_0x408188){var _0x20bf34=function(_0x3c7806){while(--_0x3c7806){_0x915353['push'](_0x915353['shift']());}};_0x20bf34(++_0x408188);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0xd27155,_0x730a5a){_0xd27155=_0xd27155-0x0;var _0x4d49c2=_0x0f9f[_0xd27155];return _0x4d49c2;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var logger=require(_0xf0f9('0x1'))(_0xf0f9('0x2'));var moment=require('moment');var BPromise=require(_0xf0f9('0x3'));var rp=require(_0xf0f9('0x4'));var fs=require('fs');var path=require(_0xf0f9('0x5'));var rimraf=require(_0xf0f9('0x6'));var config=require(_0xf0f9('0x7'));var attributes=require(_0xf0f9('0x8'));module[_0xf0f9('0x9')]=function(_0x3eaff3,_0x425fbe){return _0x3eaff3[_0xf0f9('0xa')]('WhatsappApplication',attributes,{'tableName':_0xf0f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf0f9('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index a3be5e3..abf6852 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(_0x3d3e1e,_0x4f5d23){var _0x5115dd=function(_0x7e6041){while(--_0x7e6041){_0x3d3e1e['push'](_0x3d3e1e['shift']());}};_0x5115dd(++_0x4f5d23);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4bd4b5,_0xe3ced7){_0x4bd4b5=_0x4bd4b5-0x0;var _0x5a5cb1=_0x6f0d[_0x4bd4b5];return _0x5a5cb1;};'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 _0xac31=['code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x207aeb,_0x24980f){var _0x3fe650=function(_0x2e3333){while(--_0x2e3333){_0x207aeb['push'](_0x207aeb['shift']());}};_0x3fe650(++_0x24980f);}(_0xac31,0xca));var _0x1ac3=function(_0x12d68d,_0x452a0e){_0x12d68d=_0x12d68d-0x0;var _0xf05f5b=_0xac31[_0x12d68d];return _0xf05f5b;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){return client['request'](_0x2bf9b1,_0x157604)[_0x1ac3('0xb')](function(_0x40b64c){logger[_0x1ac3('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x1be223,_0x1ac3('0xd'));logger[_0x1ac3('0xe')](_0x1ac3('0xf'),_0x1be223,_0x1ac3('0xd'),JSON[_0x1ac3('0x10')](_0x40b64c));if(_0x40b64c[_0x1ac3('0x11')]){if(_0x40b64c['error'][_0x1ac3('0x12')]===0x1f4){logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c[_0x1ac3('0x11')]['message']);return _0x2d17de(_0x40b64c[_0x1ac3('0x11')][_0x1ac3('0x14')]);}logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c['error'][_0x1ac3('0x14')]);return _0x57893c(_0x40b64c[_0x1ac3('0x11')]['message']);}else{logger[_0x1ac3('0xc')](_0x1ac3('0x13'),_0x1be223,_0x1ac3('0xd'));_0x57893c(_0x40b64c['result'][_0x1ac3('0x14')]);}})[_0x1ac3('0x15')](function(_0x23e6e9){logger['error'](_0x1ac3('0x13'),_0x1be223,_0x23e6e9);_0x2d17de(_0x23e6e9);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 999fc75..951fd46 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 _0xd8b1=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','index','/describe','isAuthenticated','describe','get','show','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','exports'];(function(_0xdc02cf,_0x5714cc){var _0x5c1d7d=function(_0x5afd63){while(--_0x5afd63){_0xdc02cf['push'](_0xdc02cf['shift']());}};_0x5c1d7d(++_0x5714cc);}(_0xd8b1,0x105));var _0x1d8b=function(_0x5bd946,_0x3874b0){_0x5bd946=_0x5bd946-0x0;var _0x95b3a4=_0xd8b1[_0x5bd946];return _0x95b3a4;};'use strict';var multer=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var path=require(_0x1d8b('0x2'));var timeout=require(_0x1d8b('0x3'));var express=require(_0x1d8b('0x4'));var router=express['Router']();var fs_extra=require(_0x1d8b('0x5'));var auth=require(_0x1d8b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d8b('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1d8b('0x8')]);router['get'](_0x1d8b('0x9'),auth[_0x1d8b('0xa')](),controller[_0x1d8b('0xb')]);router[_0x1d8b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1d8b('0xd')]);router['get']('/:id/messages',auth[_0x1d8b('0xa')](),controller['getMessages']);router[_0x1d8b('0xc')]('/:id/download',auth[_0x1d8b('0xa')](),controller[_0x1d8b('0xe')]);router[_0x1d8b('0xf')]('/',auth[_0x1d8b('0xa')](),controller[_0x1d8b('0x10')]);router[_0x1d8b('0xf')]('/:id/messages',auth[_0x1d8b('0xa')](),controller[_0x1d8b('0x11')]);router[_0x1d8b('0xf')](_0x1d8b('0x12'),auth[_0x1d8b('0xa')](),interaction[_0x1d8b('0x13')](_0x1d8b('0x14'),_0x1d8b('0x15')),controller['addTags']);router[_0x1d8b('0x16')](_0x1d8b('0x17'),auth[_0x1d8b('0xa')](),interaction[_0x1d8b('0x13')](_0x1d8b('0x14'),_0x1d8b('0x18')),controller[_0x1d8b('0x19')]);router['delete']('/:id',auth[_0x1d8b('0xa')](),interaction[_0x1d8b('0x13')](_0x1d8b('0x14'),_0x1d8b('0x1a')),controller[_0x1d8b('0x1b')]);router['delete'](_0x1d8b('0x12'),auth[_0x1d8b('0xa')](),controller['removeTags']);module[_0x1d8b('0x1c')]=router; \ No newline at end of file +var _0xeff8=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x46dc85,_0x462745){var _0x403918=function(_0xc1f168){while(--_0xc1f168){_0x46dc85['push'](_0x46dc85['shift']());}};_0x403918(++_0x462745);}(_0xeff8,0x186));var _0x8eff=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xeff8[_0xc67528];return _0x38e26d;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get']('/',auth[_0x8eff('0x9')](),controller[_0x8eff('0xa')]);router[_0x8eff('0xb')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xb')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['show']);router['get'](_0x8eff('0xf'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x10')]);router['get'](_0x8eff('0x11'),auth[_0x8eff('0x9')](),controller['download']);router[_0x8eff('0x12')]('/',auth[_0x8eff('0x9')](),controller['create']);router['post'](_0x8eff('0xf'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x13')]);router[_0x8eff('0x12')](_0x8eff('0x14'),auth['isAuthenticated'](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x17')),controller[_0x8eff('0x18')]);router[_0x8eff('0x19')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x1a')),controller[_0x8eff('0x1b')]);router['delete'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x1c')),controller[_0x8eff('0x1d')]);router[_0x8eff('0x1e')](_0x8eff('0x14'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x1f')]);module[_0x8eff('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 26843d9..b20ea99 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 _0x689b=['BOOLEAN','INTEGER','sequelize','exports','STRING','DATE','ENUM','out'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x689b,0x142));var _0xb689=function(_0x3c7af1,_0xa3c89b){_0x3c7af1=_0x3c7af1-0x0;var _0x29c450=_0x689b[_0x3c7af1];return _0x29c450;};'use strict';var Sequelize=require(_0xb689('0x0'));var moment=require('moment');module[_0xb689('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb689('0x2')]},'secondDisposition':{'type':Sequelize[_0xb689('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb689('0x2')]},'note':{'type':Sequelize[_0xb689('0x2')]},'phone':{'type':Sequelize[_0xb689('0x2')]},'read1stAt':{'type':Sequelize[_0xb689('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb689('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb689('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb689('0x4')]('in',_0xb689('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb689('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb689('0x7')]}}; \ No newline at end of file +var _0x288a=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x1b9d3c,_0x3cac1d){var _0x12971e=function(_0x136425){while(--_0x136425){_0x1b9d3c['push'](_0x1b9d3c['shift']());}};_0x12971e(++_0x3cac1d);}(_0x288a,0x188));var _0xa288=function(_0x25ed32,_0x5063db){_0x25ed32=_0x25ed32-0x0;var _0x4a2228=_0x288a[_0x25ed32];return _0x4a2228;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa288('0x0'));module[_0xa288('0x1')]={'closed':{'type':Sequelize[_0xa288('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa288('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa288('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa288('0x4')]},'read1stAt':{'type':Sequelize[_0xa288('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa288('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa288('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa288('0x5')]('in',_0xa288('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa288('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index d7c96eb..b93063a 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 _0xeeb2=['Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','Whatsapp','N.A.','closed','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','json','offset','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','findAll','query','show','params','model','keys','WhatsappInteraction','attributes','intersection','fields','length','include','merge','options','find','create','catch','describe','addMessage','WhatsappMessage','body','omit','ids','getMessages','findOne','filters','hasOwnProperty','sort','pick','where','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','spread','Tag','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName'];(function(_0x571c47,_0x438835){var _0x3b2953=function(_0x5802b9){while(--_0x5802b9){_0x571c47['push'](_0x571c47['shift']());}};_0x3b2953(++_0x438835);}(_0xeeb2,0x117));var _0x2eeb=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0xeeb2[_0x1e2080];return _0x260111;};'use strict';var rimraf=require(_0x2eeb('0x0'));var zipdir=require(_0x2eeb('0x1'));var moment=require(_0x2eeb('0x2'));var BPromise=require('bluebird');var util=require(_0x2eeb('0x3'));var path=require(_0x2eeb('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2eeb('0x5'));var Redis=require(_0x2eeb('0x6'));var interaction=require(_0x2eeb('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x2eeb('0x8'));var logger=require('../../config/logger')('api');var config=require(_0x2eeb('0x9'));var db=require(_0x2eeb('0xa'))['db'];config['redis']=_[_0x2eeb('0xb')](config[_0x2eeb('0xc')],{'host':_0x2eeb('0xd'),'port':0x18eb});var socket=require(_0x2eeb('0xe'))(new Redis(config[_0x2eeb('0xc')]));require(_0x2eeb('0xf'))[_0x2eeb('0x10')](socket);function respondWithStatusCode(_0x2a8258,_0x1fbd95){_0x1fbd95=_0x1fbd95||0xcc;return function(_0x1a5ac3){if(_0x1a5ac3){return _0x2a8258[_0x2eeb('0x11')](_0x1fbd95);}return _0x2a8258['status'](_0x1fbd95)[_0x2eeb('0x12')]();};}function respondWithResult(_0x31453a,_0x41aac3){_0x41aac3=_0x41aac3||0xc8;return function(_0xd6bf32){if(_0xd6bf32){return _0x31453a[_0x2eeb('0x13')](_0x41aac3)[_0x2eeb('0x14')](_0xd6bf32);}};}function respondWithFilteredResult(_0x2d7c0c,_0x22f80e){return function(_0x1fa850){if(_0x1fa850){var _0x420722=typeof _0x22f80e[_0x2eeb('0x15')]==='undefined'&&typeof _0x22f80e['limit']==='undefined';var _0x3a6c73=_0x1fa850[_0x2eeb('0x16')];var _0x263b04=_0x420722?0x0:_0x22f80e['offset'];var _0x3a2634=_0x420722?_0x1fa850[_0x2eeb('0x16')]:_0x22f80e[_0x2eeb('0x15')]+_0x22f80e[_0x2eeb('0x17')];var _0x4110cf;if(_0x3a2634>=_0x3a6c73){_0x3a2634=_0x3a6c73;_0x4110cf=0xc8;}else{_0x4110cf=0xce;}_0x2d7c0c['status'](_0x4110cf);return _0x2d7c0c[_0x2eeb('0x18')](_0x2eeb('0x19'),_0x263b04+'-'+_0x3a2634+'/'+_0x3a6c73)['json'](_0x1fa850);}return null;};}function saveUpdates(_0x2d585e){return function(_0x391871){if(_0x391871){return _0x391871[_0x2eeb('0x1a')](_0x2d585e)[_0x2eeb('0x1b')](function(_0x59ce1f){return _0x59ce1f;});}return null;};}function removeEntity(_0x17165c){return function(_0x5b93e3){if(_0x5b93e3){return _0x5b93e3[_0x2eeb('0x1c')]()[_0x2eeb('0x1b')](function(){_0x17165c[_0x2eeb('0x13')](0xcc)[_0x2eeb('0x12')]();});}};}function handleEntityNotFound(_0xc4784e){return function(_0x1dc9f9){if(!_0x1dc9f9){_0xc4784e[_0x2eeb('0x11')](0x194);}return _0x1dc9f9;};}function handleError(_0x4784d9,_0x52180d){_0x52180d=_0x52180d||0x1f4;return function(_0x4bf9e6){logger[_0x2eeb('0x1d')](_0x4bf9e6[_0x2eeb('0x1e')]);if(_0x4bf9e6[_0x2eeb('0x1f')]){delete _0x4bf9e6[_0x2eeb('0x1f')];}_0x4784d9[_0x2eeb('0x13')](_0x52180d)[_0x2eeb('0x20')](_0x4bf9e6);};}exports[_0x2eeb('0x21')]=function(_0x346c45,_0x15a714){var _0x21f038={};var _0x13d9a1=_[_0x2eeb('0x22')](db['WhatsappInteraction'][_0x2eeb('0x23')],function(_0x415a37){return{'name':_0x415a37[_0x2eeb('0x24')],'type':_0x415a37['type'][_0x2eeb('0x25')]};});_0x21f038=qs[_0x2eeb('0x26')](_0x13d9a1,_0x346c45);return interaction[_0x2eeb('0x27')]('whatsapp',_0x346c45[_0x2eeb('0x28')],_0x346c45['user'],_0x21f038,_0x13d9a1)[_0x2eeb('0x1b')](respondWithFilteredResult(_0x15a714,_0x21f038))['catch'](handleError(_0x15a714,null));};exports[_0x2eeb('0x29')]=function(_0x230688,_0x50e78){var _0x43defa={'raw':![],'where':{'id':_0x230688[_0x2eeb('0x2a')]['id']}},_0x4f908c={};_0x4f908c[_0x2eeb('0x2b')]=_[_0x2eeb('0x2c')](db[_0x2eeb('0x2d')][_0x2eeb('0x23')]);_0x4f908c[_0x2eeb('0x28')]=_[_0x2eeb('0x2c')](_0x230688[_0x2eeb('0x28')]);_0x4f908c['filters']=_['intersection'](_0x4f908c['model'],_0x4f908c[_0x2eeb('0x28')]);_0x43defa[_0x2eeb('0x2e')]=_[_0x2eeb('0x2f')](_0x4f908c[_0x2eeb('0x2b')],qs[_0x2eeb('0x30')](_0x230688[_0x2eeb('0x28')][_0x2eeb('0x30')]));_0x43defa['attributes']=_0x43defa[_0x2eeb('0x2e')][_0x2eeb('0x31')]?_0x43defa[_0x2eeb('0x2e')]:_0x4f908c['model'];if(_0x230688[_0x2eeb('0x28')]['includeAll']){_0x43defa[_0x2eeb('0x32')]=[{'all':!![]}];}_0x43defa=_[_0x2eeb('0x33')]({},_0x43defa,_0x230688[_0x2eeb('0x34')]);return db[_0x2eeb('0x2d')][_0x2eeb('0x35')](_0x43defa)[_0x2eeb('0x1b')](handleEntityNotFound(_0x50e78,null))[_0x2eeb('0x1b')](respondWithResult(_0x50e78,null))['catch'](handleError(_0x50e78,null));};exports[_0x2eeb('0x36')]=function(_0x5e368b,_0x39c9ae){return db[_0x2eeb('0x2d')]['create'](_0x5e368b['body'],{})[_0x2eeb('0x1b')](respondWithResult(_0x39c9ae,0xc9))[_0x2eeb('0x37')](handleError(_0x39c9ae,null));};exports['update']=function(_0x32a4bb,_0x1fbffe){if(_0x32a4bb['body']['id']){delete _0x32a4bb['body']['id'];}return db['WhatsappInteraction'][_0x2eeb('0x35')]({'where':{'id':_0x32a4bb[_0x2eeb('0x2a')]['id']}})[_0x2eeb('0x1b')](handleEntityNotFound(_0x1fbffe,null))['then'](saveUpdates(_0x32a4bb['body'],null))[_0x2eeb('0x1b')](respondWithResult(_0x1fbffe,null))['catch'](handleError(_0x1fbffe,null));};exports['destroy']=function(_0x2de5af,_0x386632){return db['WhatsappInteraction'][_0x2eeb('0x35')]({'where':{'id':_0x2de5af['params']['id']}})['then'](handleEntityNotFound(_0x386632,null))[_0x2eeb('0x1b')](removeEntity(_0x386632,null))[_0x2eeb('0x37')](handleError(_0x386632,null));};exports[_0x2eeb('0x38')]=function(_0x5276b,_0x1a65b9){return db[_0x2eeb('0x2d')][_0x2eeb('0x38')]()[_0x2eeb('0x1b')](respondWithResult(_0x1a65b9,null))['catch'](handleError(_0x1a65b9,null));};exports[_0x2eeb('0x39')]=function(_0x4f8953,_0x8f10fa){return db[_0x2eeb('0x3a')][_0x2eeb('0x35')]({'where':{'id':_0x4f8953['params']['id']}})[_0x2eeb('0x1b')](handleEntityNotFound(_0x8f10fa,null))[_0x2eeb('0x1b')](function(_0x1043d4){if(_0x1043d4){return _0x1043d4[_0x2eeb('0x39')](_0x4f8953[_0x2eeb('0x3b')]['ids'],_[_0x2eeb('0x3c')](_0x4f8953[_0x2eeb('0x3b')],[_0x2eeb('0x3d'),'id'])||{});}})[_0x2eeb('0x1b')](respondWithResult(_0x8f10fa,null))[_0x2eeb('0x37')](handleError(_0x8f10fa,null));};exports[_0x2eeb('0x3e')]=function(_0x4e8f5b,_0x5d5530){var _0x7cc699={'raw':![],'where':{}};var _0x38dbc3={};var _0x561572={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x2eeb('0x3f')]({'where':{'id':_0x4e8f5b[_0x2eeb('0x2a')]['id']}})[_0x2eeb('0x1b')](handleEntityNotFound(_0x5d5530,null))['then'](function(_0x229dad){if(_0x229dad){_0x38dbc3[_0x2eeb('0x2b')]=_[_0x2eeb('0x2c')](db['WhatsappMessage'][_0x2eeb('0x23')]);_0x38dbc3['query']=_[_0x2eeb('0x2c')](_0x4e8f5b[_0x2eeb('0x28')]);_0x38dbc3[_0x2eeb('0x40')]=_[_0x2eeb('0x2f')](_0x38dbc3[_0x2eeb('0x2b')],_0x38dbc3[_0x2eeb('0x28')]);_0x7cc699[_0x2eeb('0x2e')]=_[_0x2eeb('0x2f')](_0x38dbc3[_0x2eeb('0x2b')],qs[_0x2eeb('0x30')](_0x4e8f5b[_0x2eeb('0x28')]['fields']));_0x7cc699['attributes']=_0x7cc699[_0x2eeb('0x2e')]['length']?_0x7cc699['attributes']:_0x38dbc3[_0x2eeb('0x2b')];if(!_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x41')]('nolimit')){_0x7cc699['limit']=qs[_0x2eeb('0x17')](_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x17')]);_0x7cc699[_0x2eeb('0x15')]=qs[_0x2eeb('0x15')](_0x4e8f5b['query'][_0x2eeb('0x15')]);}_0x7cc699['order']=qs[_0x2eeb('0x42')](_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x42')]);_0x7cc699['where']=qs[_0x2eeb('0x40')](_[_0x2eeb('0x43')](_0x4e8f5b[_0x2eeb('0x28')],_0x38dbc3[_0x2eeb('0x40')]));_0x7cc699[_0x2eeb('0x44')][_0x2eeb('0x45')]=_0x229dad['id'];if(_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x46')]){_0x7cc699[_0x2eeb('0x44')]=_[_0x2eeb('0x33')](_0x7cc699[_0x2eeb('0x44')],{'$or':_[_0x2eeb('0x22')](_0x7cc699[_0x2eeb('0x2e')],function(_0x24d17a){var _0x49b906={};_0x49b906[_0x24d17a]={'$like':'%'+_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x46')]+'%'};return _0x49b906;})});}if(_0x4e8f5b['query'][_0x2eeb('0x47')]){var _0x29cff1=_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x47')]['split'](',');var _0xfdb1b5={};_0xfdb1b5[_0x29cff1[0x0]]={'$gte':moment(_0x29cff1[0x1])[_0x2eeb('0x48')](_0x2eeb('0x49'))};_0x7cc699[_0x2eeb('0x44')]=_[_0x2eeb('0x33')](_0x7cc699[_0x2eeb('0x44')],_0xfdb1b5);}_0x7cc699=_[_0x2eeb('0x33')]({},_0x7cc699,_0x4e8f5b[_0x2eeb('0x34')]);return db[_0x2eeb('0x3a')][_0x2eeb('0x16')]({'where':_0x7cc699[_0x2eeb('0x44')]})['then'](function(_0x9daaa6){_0x561572[_0x2eeb('0x16')]=_0x9daaa6;if(_0x4e8f5b['query'][_0x2eeb('0x4a')]){_0x7cc699['include']=[{'all':!![]}];}return db[_0x2eeb('0x3a')][_0x2eeb('0x27')](_0x7cc699);})['then'](function(_0x13f336){_0x561572[_0x2eeb('0x4b')]=_0x13f336;return _0x561572;});}})[_0x2eeb('0x1b')](respondWithFilteredResult(_0x5d5530,_0x7cc699))[_0x2eeb('0x37')](handleError(_0x5d5530,null));};exports[_0x2eeb('0x4c')]=function(_0x3b2285,_0xc7eee6){return db[_0x2eeb('0x2d')]['find']({'where':{'id':_0x3b2285[_0x2eeb('0x2a')]['id']}})[_0x2eeb('0x1b')](handleEntityNotFound(_0xc7eee6,null))['then'](function(_0x391e5d){if(_0x391e5d){return _0x391e5d['setTags'](_0x3b2285[_0x2eeb('0x3b')][_0x2eeb('0x3d')],_['omit'](_0x3b2285[_0x2eeb('0x3b')],[_0x2eeb('0x3d'),'id'])||{})[_0x2eeb('0x4d')](function(){return db[_0x2eeb('0x4e')][_0x2eeb('0x27')]({'attributes':['id',_0x2eeb('0x1f'),'color'],'where':{'id':_0x3b2285[_0x2eeb('0x3b')][_0x2eeb('0x3d')]}});})[_0x2eeb('0x1b')](function(_0x255643){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x3b2285[_0x2eeb('0x2a')]['id']),'tags':_0x255643||[]});return{'id':Number(_0x3b2285[_0x2eeb('0x2a')]['id']),'tags':_0x255643||[]};});}})[_0x2eeb('0x1b')](respondWithResult(_0xc7eee6,null))['catch'](handleError(_0xc7eee6,null));};exports[_0x2eeb('0x4f')]=function(_0x70c0c,_0xb23128){return db['WhatsappInteraction'][_0x2eeb('0x35')]({'where':{'id':_0x70c0c[_0x2eeb('0x2a')]['id']}})[_0x2eeb('0x1b')](handleEntityNotFound(_0xb23128,null))[_0x2eeb('0x1b')](function(_0x1e5bd5){if(_0x1e5bd5){return _0x1e5bd5[_0x2eeb('0x4f')](_0x70c0c['query']['ids']);}})['then'](respondWithStatusCode(_0xb23128,null))[_0x2eeb('0x37')](handleError(_0xb23128,null));};exports[_0x2eeb('0x50')]=function(_0x5965d6,_0x21dd7e){var _0x41aa3b=moment()[_0x2eeb('0x51')]()[_0x2eeb('0x52')]();var _0x8315a1=path[_0x2eeb('0x53')](config[_0x2eeb('0x54')],_0x2eeb('0x55'),_0x2eeb('0x56'),_0x2eeb('0x57'));var _0x17ec2d=path[_0x2eeb('0x53')](config[_0x2eeb('0x54')],'server',_0x2eeb('0x56'),_0x2eeb('0x58'));var _0x32f8f9=path[_0x2eeb('0x53')](_0x8315a1,_0x41aa3b);var _0x312ce7=util['format'](_0x2eeb('0x59'),_0x5965d6['params']['id'],_0x41aa3b);var _0x2bdd27=path[_0x2eeb('0x53')](_0x8315a1,_0x312ce7);var _0x1ce072=[];_0x1ce072[_0x2eeb('0x5a')]({'model':db[_0x2eeb('0x5b')],'as':_0x2eeb('0x5b'),'attributes':['id',_0x2eeb('0x5c')],'raw':!![]});_0x1ce072[_0x2eeb('0x5a')]({'model':db['CmContact'],'as':_0x2eeb('0x5d'),'attributes':['id',_0x2eeb('0x5e'),_0x2eeb('0x5f')],'raw':!![]});if(_0x5965d6[_0x2eeb('0x28')]['attachments']){_0x1ce072[_0x2eeb('0x5a')]({'model':db[_0x2eeb('0x60')],'as':'Attachment','raw':!![]});}var _0x20d318=[{'model':db[_0x2eeb('0x3a')],'as':_0x2eeb('0x61'),'attributes':['id','body',_0x2eeb('0x62'),_0x2eeb('0x63'),_0x2eeb('0x64'),'read'],'include':_0x1ce072}];_0x20d318[_0x2eeb('0x5a')]({'model':db[_0x2eeb('0x65')],'as':_0x2eeb('0x66'),'attributes':['id',_0x2eeb('0x1f')]});_0x20d318[_0x2eeb('0x5a')]({'model':db[_0x2eeb('0x5b')],'as':_0x2eeb('0x67'),'attributes':['id',_0x2eeb('0x5c')]});return db[_0x2eeb('0x2d')][_0x2eeb('0x35')]({'where':{'id':_0x5965d6[_0x2eeb('0x2a')]['id']},'include':_0x20d318})[_0x2eeb('0x1b')](handleEntityNotFound(_0x21dd7e,null))[_0x2eeb('0x1b')](function(_0x236086){if(_0x236086){var _0x318387=_0x236086['get']({'plain':!![]});fs['mkdirSync'](_0x32f8f9);var _0x49dd3c={'channel':_0x2eeb('0x68'),'account':_0x318387[_0x2eeb('0x66')][_0x2eeb('0x1f')],'agent':_0x318387[_0x2eeb('0x67')]?_0x318387[_0x2eeb('0x67')][_0x2eeb('0x5c')]:_0x2eeb('0x69'),'createdAt':moment(_0x318387[_0x2eeb('0x62')])[_0x2eeb('0x48')](_0x2eeb('0x49'))[_0x2eeb('0x52')](),'closedAt':_0x318387[_0x2eeb('0x6a')]?moment(_0x318387['closedAt'])[_0x2eeb('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2eeb('0x52')]():'','disposition':_0x318387[_0x2eeb('0x6b')],'messages':_(_0x318387[_0x2eeb('0x61')])['filter']({'secret':![]})[_0x2eeb('0x22')](function(_0x1740ac){if(_0x1740ac[_0x2eeb('0x60')]){var _0x5f5d58=path[_0x2eeb('0x53')](_0x17ec2d,_0x1740ac[_0x2eeb('0x60')][_0x2eeb('0x6c')]);if(fs[_0x2eeb('0x6d')](_0x5f5d58)){fs[_0x2eeb('0x6e')](_0x5f5d58)[_0x2eeb('0x6f')](fs[_0x2eeb('0x70')](path[_0x2eeb('0x53')](_0x32f8f9,_0x1740ac[_0x2eeb('0x60')][_0x2eeb('0x6c')])));}}return{'date':moment(_0x1740ac[_0x2eeb('0x62')])[_0x2eeb('0x48')](_0x2eeb('0x49'))[_0x2eeb('0x52')](),'sender':_0x1740ac[_0x2eeb('0x63')]===_0x2eeb('0x71')?_0x1740ac['User']?_0x1740ac['User'][_0x2eeb('0x5c')]:_0x2eeb('0x72'):_0x1740ac[_0x2eeb('0x5d')][_0x2eeb('0x5e')]+(_0x1740ac[_0x2eeb('0x5d')][_0x2eeb('0x5f')]?'\x20'+_0x1740ac[_0x2eeb('0x5d')][_0x2eeb('0x5f')]:''),'body':_0x1740ac[_0x2eeb('0x60')]?_0x1740ac['Attachment'][_0x2eeb('0x6c')]:_0x1740ac[_0x2eeb('0x3b')],'direction':_0x1740ac['direction']===_0x2eeb('0x71')?'A':'C','secret':_0x1740ac[_0x2eeb('0x64')],'read':_0x1740ac[_0x2eeb('0x73')],'attachment':_0x1740ac[_0x2eeb('0x60')]};})[_0x2eeb('0x74')]()};return ejs[_0x2eeb('0x75')](path[_0x2eeb('0x53')](config['root'],_0x2eeb('0x55'),_0x2eeb('0x76'),_0x2eeb('0x77')),{'interaction':_0x49dd3c})['then'](function(_0x4d505f){var _0x5ae9ac=path[_0x2eeb('0x53')](_0x32f8f9,_0x2eeb('0x78')+_0x318387['id']+'-'+_0x41aa3b+_0x2eeb('0x79'));var _0x53d4aa={'path':_0x5ae9ac,'channel':'Whatsapp','interactionId':_0x318387['id']};return pdf['createPdfFromHTML'](_0x4d505f,_0x53d4aa);})[_0x2eeb('0x1b')](function(){return new BPromise(function(_0x319dee,_0x2699fd){zipdir(_0x32f8f9,{'saveTo':_0x2bdd27},function(_0x5798a5,_0x25bbea){if(_0x5798a5)return _0x2699fd(_0x5798a5);return _0x319dee(_0x25bbea);});})[_0x2eeb('0x1b')](function(){return new BPromise(function(_0x20db43,_0x59c550){rimraf(_0x32f8f9,function(_0x4a08d4){if(_0x4a08d4)_0x59c550(_0x4a08d4);return _0x20db43();});});})['then'](function(){return _0x21dd7e[_0x2eeb('0x50')](_0x2bdd27,_0x312ce7,function(_0x570598){if(_0x570598){console[_0x2eeb('0x7a')](_0x2eeb('0x7b'),_0x570598);}else{fs[_0x2eeb('0x7c')](_0x2bdd27);}});});});}else{return _0x21dd7e[_0x2eeb('0x11')](0xc8);}})[_0x2eeb('0x37')](handleError(_0x21dd7e,null));}; \ No newline at end of file +var _0xedd7=['redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','catch','show','params','model','keys','WhatsappInteraction','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','describe','WhatsappMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','push','User','fullname','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','closedAt','disposition','basename','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','.pdf','Whatsapp','createPdfFromHTML','download','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment'];(function(_0x553973,_0x37054b){var _0x4d4f40=function(_0x54f2af){while(--_0x54f2af){_0x553973['push'](_0x553973['shift']());}};_0x4d4f40(++_0x37054b);}(_0xedd7,0x6f));var _0x7edd=function(_0xd95a4f,_0x5b2faf){_0xd95a4f=_0xd95a4f-0x0;var _0x913026=_0xedd7[_0xd95a4f];return _0x913026;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7edd('0x0'));var moment=require(_0x7edd('0x1'));var BPromise=require(_0x7edd('0x2'));var util=require(_0x7edd('0x3'));var path=require(_0x7edd('0x4'));var ejs=require(_0x7edd('0x5'));var fs=require('fs');var _=require(_0x7edd('0x6'));var Redis=require('ioredis');var interaction=require(_0x7edd('0x7'));var qs=require(_0x7edd('0x8'));var pdf=require(_0x7edd('0x9'));var logger=require('../../config/logger')(_0x7edd('0xa'));var config=require(_0x7edd('0xb'));var db=require('../../mysqldb')['db'];config[_0x7edd('0xc')]=_[_0x7edd('0xd')](config[_0x7edd('0xc')],{'host':_0x7edd('0xe'),'port':0x18eb});var socket=require(_0x7edd('0xf'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x22e301,_0x47a8b4){_0x47a8b4=_0x47a8b4||0xcc;return function(_0x3eddce){if(_0x3eddce){return _0x22e301[_0x7edd('0x10')](_0x47a8b4);}return _0x22e301[_0x7edd('0x11')](_0x47a8b4)[_0x7edd('0x12')]();};}function respondWithResult(_0x46ef48,_0x1d471e){_0x1d471e=_0x1d471e||0xc8;return function(_0x16ea62){if(_0x16ea62){return _0x46ef48[_0x7edd('0x11')](_0x1d471e)[_0x7edd('0x13')](_0x16ea62);}};}function respondWithFilteredResult(_0x47e451,_0x43ed5c){return function(_0x45c247){if(_0x45c247){var _0x2fc912=typeof _0x43ed5c[_0x7edd('0x14')]===_0x7edd('0x15')&&typeof _0x43ed5c[_0x7edd('0x16')]===_0x7edd('0x15');var _0x4b989f=_0x45c247[_0x7edd('0x17')];var _0x5b207e=_0x2fc912?0x0:_0x43ed5c[_0x7edd('0x14')];var _0x2bdb01=_0x2fc912?_0x45c247[_0x7edd('0x17')]:_0x43ed5c[_0x7edd('0x14')]+_0x43ed5c[_0x7edd('0x16')];var _0x2bfdc9;if(_0x2bdb01>=_0x4b989f){_0x2bdb01=_0x4b989f;_0x2bfdc9=0xc8;}else{_0x2bfdc9=0xce;}_0x47e451[_0x7edd('0x11')](_0x2bfdc9);return _0x47e451[_0x7edd('0x18')](_0x7edd('0x19'),_0x5b207e+'-'+_0x2bdb01+'/'+_0x4b989f)[_0x7edd('0x13')](_0x45c247);}return null;};}function saveUpdates(_0x268950){return function(_0x3c40c8){if(_0x3c40c8){return _0x3c40c8[_0x7edd('0x1a')](_0x268950)[_0x7edd('0x1b')](function(_0x108266){return _0x108266;});}return null;};}function removeEntity(_0x7d62b7){return function(_0x417cb3){if(_0x417cb3){return _0x417cb3[_0x7edd('0x1c')]()[_0x7edd('0x1b')](function(){_0x7d62b7['status'](0xcc)[_0x7edd('0x12')]();});}};}function handleEntityNotFound(_0x8bf7e2){return function(_0x47944f){if(!_0x47944f){_0x8bf7e2['sendStatus'](0x194);}return _0x47944f;};}function handleError(_0x357174,_0x152e78){_0x152e78=_0x152e78||0x1f4;return function(_0x3634e0){logger[_0x7edd('0x1d')](_0x3634e0[_0x7edd('0x1e')]);if(_0x3634e0['name']){delete _0x3634e0[_0x7edd('0x1f')];}_0x357174[_0x7edd('0x11')](_0x152e78)[_0x7edd('0x20')](_0x3634e0);};}exports['index']=function(_0x12cdf5,_0x2945fa){var _0x48c970={};var _0xd953fb=_[_0x7edd('0x21')](db['WhatsappInteraction'][_0x7edd('0x22')],function(_0x5bded1){return{'name':_0x5bded1[_0x7edd('0x23')],'type':_0x5bded1[_0x7edd('0x24')][_0x7edd('0x25')]};});_0x48c970=qs[_0x7edd('0x26')](_0xd953fb,_0x12cdf5);return interaction[_0x7edd('0x27')](_0x7edd('0x28'),_0x12cdf5[_0x7edd('0x29')],_0x12cdf5['user'],_0x48c970,_0xd953fb)['then'](respondWithFilteredResult(_0x2945fa,_0x48c970))[_0x7edd('0x2a')](handleError(_0x2945fa,null));};exports[_0x7edd('0x2b')]=function(_0x37967b,_0x834bad){var _0x4d875b={'raw':![],'where':{'id':_0x37967b[_0x7edd('0x2c')]['id']}},_0x17765f={};_0x17765f[_0x7edd('0x2d')]=_[_0x7edd('0x2e')](db[_0x7edd('0x2f')][_0x7edd('0x22')]);_0x17765f[_0x7edd('0x29')]=_['keys'](_0x37967b[_0x7edd('0x29')]);_0x17765f[_0x7edd('0x30')]=_['intersection'](_0x17765f[_0x7edd('0x2d')],_0x17765f[_0x7edd('0x29')]);_0x4d875b[_0x7edd('0x31')]=_[_0x7edd('0x32')](_0x17765f[_0x7edd('0x2d')],qs[_0x7edd('0x33')](_0x37967b[_0x7edd('0x29')][_0x7edd('0x33')]));_0x4d875b['attributes']=_0x4d875b[_0x7edd('0x31')][_0x7edd('0x34')]?_0x4d875b[_0x7edd('0x31')]:_0x17765f[_0x7edd('0x2d')];if(_0x37967b[_0x7edd('0x29')][_0x7edd('0x35')]){_0x4d875b['include']=[{'all':!![]}];}_0x4d875b=_[_0x7edd('0x36')]({},_0x4d875b,_0x37967b[_0x7edd('0x37')]);return db[_0x7edd('0x2f')][_0x7edd('0x38')](_0x4d875b)[_0x7edd('0x1b')](handleEntityNotFound(_0x834bad,null))[_0x7edd('0x1b')](respondWithResult(_0x834bad,null))[_0x7edd('0x2a')](handleError(_0x834bad,null));};exports[_0x7edd('0x39')]=function(_0x453a43,_0x11ab7c){return db['WhatsappInteraction'][_0x7edd('0x39')](_0x453a43[_0x7edd('0x3a')],{})['then'](respondWithResult(_0x11ab7c,0xc9))[_0x7edd('0x2a')](handleError(_0x11ab7c,null));};exports[_0x7edd('0x1a')]=function(_0x550188,_0x5ba270){if(_0x550188[_0x7edd('0x3a')]['id']){delete _0x550188['body']['id'];}return db[_0x7edd('0x2f')][_0x7edd('0x38')]({'where':{'id':_0x550188[_0x7edd('0x2c')]['id']}})[_0x7edd('0x1b')](handleEntityNotFound(_0x5ba270,null))['then'](saveUpdates(_0x550188[_0x7edd('0x3a')],null))[_0x7edd('0x1b')](respondWithResult(_0x5ba270,null))[_0x7edd('0x2a')](handleError(_0x5ba270,null));};exports[_0x7edd('0x1c')]=function(_0x962e95,_0xe84c98){return db['WhatsappInteraction'][_0x7edd('0x38')]({'where':{'id':_0x962e95[_0x7edd('0x2c')]['id']}})[_0x7edd('0x1b')](handleEntityNotFound(_0xe84c98,null))['then'](removeEntity(_0xe84c98,null))[_0x7edd('0x2a')](handleError(_0xe84c98,null));};exports[_0x7edd('0x3b')]=function(_0x2b0f32,_0x5e7e5b){return db['WhatsappInteraction']['describe']()[_0x7edd('0x1b')](respondWithResult(_0x5e7e5b,null))[_0x7edd('0x2a')](handleError(_0x5e7e5b,null));};exports['addMessage']=function(_0x232614,_0x4d04e1){return db[_0x7edd('0x3c')]['find']({'where':{'id':_0x232614[_0x7edd('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4d04e1,null))[_0x7edd('0x1b')](function(_0x27d82f){if(_0x27d82f){return _0x27d82f['addMessage'](_0x232614[_0x7edd('0x3a')][_0x7edd('0x3d')],_[_0x7edd('0x3e')](_0x232614['body'],['ids','id'])||{});}})[_0x7edd('0x1b')](respondWithResult(_0x4d04e1,null))[_0x7edd('0x2a')](handleError(_0x4d04e1,null));};exports['getMessages']=function(_0x222dcf,_0x1249e9){var _0x193a1f={'raw':![],'where':{}};var _0x18e73e={};var _0x32d77c={'count':0x0,'rows':[]};return db[_0x7edd('0x2f')][_0x7edd('0x3f')]({'where':{'id':_0x222dcf['params']['id']}})[_0x7edd('0x1b')](handleEntityNotFound(_0x1249e9,null))[_0x7edd('0x1b')](function(_0x12ec70){if(_0x12ec70){_0x18e73e[_0x7edd('0x2d')]=_[_0x7edd('0x2e')](db[_0x7edd('0x3c')]['rawAttributes']);_0x18e73e['query']=_[_0x7edd('0x2e')](_0x222dcf[_0x7edd('0x29')]);_0x18e73e['filters']=_[_0x7edd('0x32')](_0x18e73e[_0x7edd('0x2d')],_0x18e73e[_0x7edd('0x29')]);_0x193a1f[_0x7edd('0x31')]=_[_0x7edd('0x32')](_0x18e73e[_0x7edd('0x2d')],qs[_0x7edd('0x33')](_0x222dcf[_0x7edd('0x29')]['fields']));_0x193a1f[_0x7edd('0x31')]=_0x193a1f[_0x7edd('0x31')]['length']?_0x193a1f[_0x7edd('0x31')]:_0x18e73e['model'];if(!_0x222dcf['query'][_0x7edd('0x40')](_0x7edd('0x41'))){_0x193a1f[_0x7edd('0x16')]=qs[_0x7edd('0x16')](_0x222dcf['query'][_0x7edd('0x16')]);_0x193a1f[_0x7edd('0x14')]=qs[_0x7edd('0x14')](_0x222dcf[_0x7edd('0x29')][_0x7edd('0x14')]);}_0x193a1f[_0x7edd('0x42')]=qs[_0x7edd('0x43')](_0x222dcf['query'][_0x7edd('0x43')]);_0x193a1f['where']=qs[_0x7edd('0x30')](_[_0x7edd('0x44')](_0x222dcf[_0x7edd('0x29')],_0x18e73e[_0x7edd('0x30')]));_0x193a1f[_0x7edd('0x45')][_0x7edd('0x46')]=_0x12ec70['id'];if(_0x222dcf[_0x7edd('0x29')][_0x7edd('0x47')]){_0x193a1f['where']=_[_0x7edd('0x36')](_0x193a1f[_0x7edd('0x45')],{'$or':_[_0x7edd('0x21')](_0x193a1f['attributes'],function(_0x4d9a7b){var _0x870977={};_0x870977[_0x4d9a7b]={'$like':'%'+_0x222dcf['query']['filter']+'%'};return _0x870977;})});}if(_0x222dcf[_0x7edd('0x29')][_0x7edd('0x48')]){var _0xc0f825=_0x222dcf['query'][_0x7edd('0x48')][_0x7edd('0x49')](',');var _0x92c775={};_0x92c775[_0xc0f825[0x0]]={'$gte':moment(_0xc0f825[0x1])[_0x7edd('0x4a')](_0x7edd('0x4b'))};_0x193a1f[_0x7edd('0x45')]=_[_0x7edd('0x36')](_0x193a1f['where'],_0x92c775);}_0x193a1f=_[_0x7edd('0x36')]({},_0x193a1f,_0x222dcf['options']);return db[_0x7edd('0x3c')]['count']({'where':_0x193a1f[_0x7edd('0x45')]})[_0x7edd('0x1b')](function(_0x537ce8){_0x32d77c[_0x7edd('0x17')]=_0x537ce8;if(_0x222dcf[_0x7edd('0x29')][_0x7edd('0x35')]){_0x193a1f[_0x7edd('0x4c')]=[{'all':!![]}];}return db[_0x7edd('0x3c')][_0x7edd('0x27')](_0x193a1f);})['then'](function(_0x5634c6){_0x32d77c['rows']=_0x5634c6;return _0x32d77c;});}})['then'](respondWithFilteredResult(_0x1249e9,_0x193a1f))[_0x7edd('0x2a')](handleError(_0x1249e9,null));};exports['addTags']=function(_0x2f7b89,_0x4f05d5){return db[_0x7edd('0x2f')][_0x7edd('0x38')]({'where':{'id':_0x2f7b89['params']['id']}})[_0x7edd('0x1b')](handleEntityNotFound(_0x4f05d5,null))[_0x7edd('0x1b')](function(_0x464d5e){if(_0x464d5e){return _0x464d5e[_0x7edd('0x4d')](_0x2f7b89[_0x7edd('0x3a')][_0x7edd('0x3d')],_['omit'](_0x2f7b89['body'],['ids','id'])||{})[_0x7edd('0x4e')](function(){return db[_0x7edd('0x4f')][_0x7edd('0x27')]({'attributes':['id',_0x7edd('0x1f'),'color'],'where':{'id':_0x2f7b89['body'][_0x7edd('0x3d')]}});})['then'](function(_0x16d089){socket[_0x7edd('0x50')](_0x7edd('0x51'),{'id':Number(_0x2f7b89[_0x7edd('0x2c')]['id']),'tags':_0x16d089||[]});return{'id':Number(_0x2f7b89[_0x7edd('0x2c')]['id']),'tags':_0x16d089||[]};});}})['then'](respondWithResult(_0x4f05d5,null))['catch'](handleError(_0x4f05d5,null));};exports[_0x7edd('0x52')]=function(_0x17ecaa,_0xbde754){return db[_0x7edd('0x2f')][_0x7edd('0x38')]({'where':{'id':_0x17ecaa['params']['id']}})[_0x7edd('0x1b')](handleEntityNotFound(_0xbde754,null))[_0x7edd('0x1b')](function(_0x467136){if(_0x467136){return _0x467136[_0x7edd('0x52')](_0x17ecaa['query']['ids']);}})[_0x7edd('0x1b')](respondWithStatusCode(_0xbde754,null))['catch'](handleError(_0xbde754,null));};exports['download']=function(_0x3a52bd,_0x47058f){var _0x13f8bd=moment()[_0x7edd('0x53')]()[_0x7edd('0x54')]();var _0x23c3ab=path[_0x7edd('0x55')](config[_0x7edd('0x56')],_0x7edd('0x57'),_0x7edd('0x58'),_0x7edd('0x59'));var _0x4dd06b=path[_0x7edd('0x55')](config['root'],_0x7edd('0x57'),_0x7edd('0x58'),'attachments');var _0x434884=path['join'](_0x23c3ab,_0x13f8bd);var _0x642b24=util[_0x7edd('0x4a')]('transcript-%d-%s.zip',_0x3a52bd[_0x7edd('0x2c')]['id'],_0x13f8bd);var _0x40c71a=path[_0x7edd('0x55')](_0x23c3ab,_0x642b24);var _0x94c6b7=[];_0x94c6b7[_0x7edd('0x5a')]({'model':db['User'],'as':_0x7edd('0x5b'),'attributes':['id',_0x7edd('0x5c')],'raw':!![]});_0x94c6b7[_0x7edd('0x5a')]({'model':db['CmContact'],'as':_0x7edd('0x5d'),'attributes':['id',_0x7edd('0x5e'),_0x7edd('0x5f')],'raw':!![]});if(_0x3a52bd[_0x7edd('0x29')][_0x7edd('0x60')]){_0x94c6b7[_0x7edd('0x5a')]({'model':db[_0x7edd('0x61')],'as':'Attachment','raw':!![]});}var _0xddf614=[{'model':db[_0x7edd('0x3c')],'as':_0x7edd('0x62'),'attributes':['id',_0x7edd('0x3a'),_0x7edd('0x63'),_0x7edd('0x64'),_0x7edd('0x65'),'read'],'include':_0x94c6b7}];_0xddf614[_0x7edd('0x5a')]({'model':db[_0x7edd('0x66')],'as':_0x7edd('0x67'),'attributes':['id',_0x7edd('0x1f')]});_0xddf614[_0x7edd('0x5a')]({'model':db[_0x7edd('0x5b')],'as':_0x7edd('0x68'),'attributes':['id',_0x7edd('0x5c')]});return db[_0x7edd('0x2f')][_0x7edd('0x38')]({'where':{'id':_0x3a52bd[_0x7edd('0x2c')]['id']},'include':_0xddf614})[_0x7edd('0x1b')](handleEntityNotFound(_0x47058f,null))[_0x7edd('0x1b')](function(_0x43c56d){if(_0x43c56d){var _0x3f3795=_0x43c56d[_0x7edd('0x69')]({'plain':!![]});fs['mkdirSync'](_0x434884);var _0x173d50={'channel':'Whatsapp','account':_0x3f3795['Account'][_0x7edd('0x1f')],'agent':_0x3f3795[_0x7edd('0x68')]?_0x3f3795['Owner'][_0x7edd('0x5c')]:'N.A.','createdAt':moment(_0x3f3795['createdAt'])[_0x7edd('0x4a')](_0x7edd('0x4b'))[_0x7edd('0x54')](),'closedAt':_0x3f3795['closed']?moment(_0x3f3795[_0x7edd('0x6a')])['format'](_0x7edd('0x4b'))[_0x7edd('0x54')]():'','disposition':_0x3f3795[_0x7edd('0x6b')],'messages':_(_0x3f3795[_0x7edd('0x62')])[_0x7edd('0x47')]({'secret':![]})[_0x7edd('0x21')](function(_0x520185){if(_0x520185[_0x7edd('0x61')]){var _0x4b0ffc=path['join'](_0x4dd06b,_0x520185[_0x7edd('0x61')][_0x7edd('0x6c')]);if(fs['existsSync'](_0x4b0ffc)){fs['createReadStream'](_0x4b0ffc)['pipe'](fs[_0x7edd('0x6d')](path[_0x7edd('0x55')](_0x434884,_0x520185[_0x7edd('0x61')][_0x7edd('0x6c')])));}}return{'date':moment(_0x520185['createdAt'])[_0x7edd('0x4a')](_0x7edd('0x4b'))[_0x7edd('0x54')](),'sender':_0x520185[_0x7edd('0x64')]===_0x7edd('0x6e')?_0x520185[_0x7edd('0x5b')]?_0x520185[_0x7edd('0x5b')]['fullname']:_0x7edd('0x6f'):_0x520185[_0x7edd('0x5d')][_0x7edd('0x5e')]+(_0x520185[_0x7edd('0x5d')]['lastName']?'\x20'+_0x520185[_0x7edd('0x5d')][_0x7edd('0x5f')]:''),'body':_0x520185[_0x7edd('0x61')]?_0x520185[_0x7edd('0x61')][_0x7edd('0x6c')]:_0x520185[_0x7edd('0x3a')],'direction':_0x520185[_0x7edd('0x64')]===_0x7edd('0x6e')?'A':'C','secret':_0x520185['secret'],'read':_0x520185['read'],'attachment':_0x520185[_0x7edd('0x61')]};})[_0x7edd('0x70')]()};return ejs[_0x7edd('0x71')](path['join'](config['root'],'server',_0x7edd('0x72'),_0x7edd('0x73')),{'interaction':_0x173d50})[_0x7edd('0x1b')](function(_0x4f8c65){var _0x499264=path[_0x7edd('0x55')](_0x434884,'transcript-'+_0x3f3795['id']+'-'+_0x13f8bd+_0x7edd('0x74'));var _0x1a59da={'path':_0x499264,'channel':_0x7edd('0x75'),'interactionId':_0x3f3795['id']};return pdf[_0x7edd('0x76')](_0x4f8c65,_0x1a59da);})['then'](function(){return new BPromise(function(_0x1ea842,_0x1df6b5){zipdir(_0x434884,{'saveTo':_0x40c71a},function(_0x2a973f,_0x124a33){if(_0x2a973f)return _0x1df6b5(_0x2a973f);return _0x1ea842(_0x124a33);});})[_0x7edd('0x1b')](function(){return new BPromise(function(_0x191cd8,_0x314347){rimraf(_0x434884,function(_0x29cd03){if(_0x29cd03)_0x314347(_0x29cd03);return _0x191cd8();});});})[_0x7edd('0x1b')](function(){return _0x47058f[_0x7edd('0x77')](_0x40c71a,_0x642b24,function(_0x4d4cb7){if(_0x4d4cb7){console[_0x7edd('0x78')](_0x7edd('0x79'),_0x4d4cb7);}else{fs[_0x7edd('0x7a')](_0x40c71a);}});});});}else{return _0x47058f['sendStatus'](0xc8);}})[_0x7edd('0x2a')](handleError(_0x47058f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 38e90b8..0f1a920 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 _0x342b=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','getUsers','then','setDataValue'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0x342b,0xbc));var _0xb342=function(_0x2c1e2d,_0x2b32f8){_0x2c1e2d=_0x2c1e2d-0x0;var _0x5e699e=_0x342b[_0x2c1e2d];return _0x5e699e;};'use strict';var EventEmitter=require(_0xb342('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xb342('0x1')];var WhatsappMessage=require(_0xb342('0x2'))['db'][_0xb342('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b1604){return function(_0x1ae838,_0x617dea,_0x28bca8){_0x1ae838[_0xb342('0x4')]({'attributes':['id'],'raw':!![]})[_0xb342('0x5')](function(_0x30106f){_0x1ae838[_0xb342('0x6')]('Users',_0x30106f['map'](function(_0x320a07){return{'id':_0x320a07['id']};}));return WhatsappMessage[_0xb342('0x7')]({'where':{'WhatsappInteractionId':_0x1ae838['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x578e36){_0x1ae838[_0xb342('0x6')](_0xb342('0x8'),_0x578e36[_0xb342('0x9')]);WhatsappInteractionEvents[_0xb342('0xa')](_0x1b1604+':'+_0x1ae838['id'],_0x1ae838);WhatsappInteractionEvents[_0xb342('0xa')](_0x1b1604,_0x1ae838);_0x28bca8(null);})[_0xb342('0xb')](_0x28bca8(null));};}for(var e in events){if(events[_0xb342('0xc')](e)){var event=events[e];WhatsappInteraction[_0xb342('0xd')](e,emitEvent(event));}}module[_0xb342('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xc964=['then','Users','map','emit','catch','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','getUsers'];(function(_0x43cf24,_0x2f0cfb){var _0x301158=function(_0x25d79e){while(--_0x25d79e){_0x43cf24['push'](_0x43cf24['shift']());}};_0x301158(++_0x2f0cfb);}(_0xc964,0x7e));var _0x4c96=function(_0x4566e7,_0x5049ef){_0x4566e7=_0x4566e7-0x0;var _0x1a0bcc=_0xc964[_0x4566e7];return _0x1a0bcc;};'use strict';var EventEmitter=require(_0x4c96('0x0'));var WhatsappInteraction=require(_0x4c96('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x4c96('0x1'))['db'][_0x4c96('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4c96('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4c96('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1b0a58){return function(_0x3afa6e,_0x1ab184,_0x2f6461){_0x3afa6e[_0x4c96('0x5')]({'attributes':['id'],'raw':!![]})[_0x4c96('0x6')](function(_0x4070a5){_0x3afa6e['setDataValue'](_0x4c96('0x7'),_0x4070a5[_0x4c96('0x8')](function(_0x135c89){return{'id':_0x135c89['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x3afa6e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4c96('0x6')](function(_0x2ea23f){_0x3afa6e['setDataValue']('unreadMessages',_0x2ea23f['length']);WhatsappInteractionEvents[_0x4c96('0x9')](_0x1b0a58+':'+_0x3afa6e['id'],_0x3afa6e);WhatsappInteractionEvents[_0x4c96('0x9')](_0x1b0a58,_0x3afa6e);_0x2f6461(null);})[_0x4c96('0xa')](_0x2f6461(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x4c96('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 18b5b9c..e8dc3c3 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 _0x205d=['changed','closed','closedAt','format','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x2170cf,_0x20b2e9){var _0x3313d0=function(_0x9cb692){while(--_0x9cb692){_0x2170cf['push'](_0x2170cf['shift']());}};_0x3313d0(++_0x20b2e9);}(_0x205d,0x1f1));var _0xd205=function(_0x4f7a97,_0x14f986){_0x4f7a97=_0x4f7a97-0x0;var _0x2d97cb=_0x205d[_0x4f7a97];return _0x2d97cb;};'use strict';var _=require('lodash');var util=require(_0xd205('0x0'));var logger=require(_0xd205('0x1'))(_0xd205('0x2'));var moment=require('moment');var BPromise=require(_0xd205('0x3'));var rp=require(_0xd205('0x4'));var fs=require('fs');var path=require(_0xd205('0x5'));var rimraf=require(_0xd205('0x6'));var config=require(_0xd205('0x7'));var attributes=require(_0xd205('0x8'));module[_0xd205('0x9')]=function(_0x3c5535,_0x1387d1){return _0x3c5535[_0xd205('0xa')](_0xd205('0xb'),attributes,{'tableName':_0xd205('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31f437,_0xa373da,_0x8b19fe){if(_0x31f437[_0xd205('0xd')](_0xd205('0xe'))){_0x31f437[_0xd205('0xf')]=moment()[_0xd205('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x8b19fe(null,_0x31f437);}}});}; \ No newline at end of file +var _0xf23c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions','changed','closed','closedAt','format'];(function(_0x247bf5,_0x4732ca){var _0x781d4f=function(_0x16aaae){while(--_0x16aaae){_0x247bf5['push'](_0x247bf5['shift']());}};_0x781d4f(++_0x4732ca);}(_0xf23c,0x77));var _0xcf23=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0xf23c[_0x31bab3];return _0x4fd382;};'use strict';var _=require(_0xcf23('0x0'));var util=require(_0xcf23('0x1'));var logger=require(_0xcf23('0x2'))(_0xcf23('0x3'));var moment=require(_0xcf23('0x4'));var BPromise=require(_0xcf23('0x5'));var rp=require(_0xcf23('0x6'));var fs=require('fs');var path=require(_0xcf23('0x7'));var rimraf=require(_0xcf23('0x8'));var config=require(_0xcf23('0x9'));var attributes=require(_0xcf23('0xa'));module[_0xcf23('0xb')]=function(_0x29d89c,_0x208604){return _0x29d89c['define']('WhatsappInteraction',attributes,{'tableName':_0xcf23('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30ecf2,_0x1d2be7,_0x2a2680){if(_0x30ecf2[_0xcf23('0xd')](_0xcf23('0xe'))){_0x30ecf2[_0xcf23('0xf')]=moment()[_0xcf23('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2a2680(null,_0x30ecf2);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 83b7a4e..fbc2d1c 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 _0xaef2=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','attributes','find','where','addTags'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0xaef2,0x14c));var _0x2aef=function(_0xba21d1,_0x5ea074){_0xba21d1=_0xba21d1-0x0;var _0xad42b6=_0xaef2[_0xba21d1];return _0xad42b6;};'use strict';var _=require(_0x2aef('0x0'));var util=require(_0x2aef('0x1'));var moment=require(_0x2aef('0x2'));var BPromise=require(_0x2aef('0x3'));var rs=require(_0x2aef('0x4'));var fs=require('fs');var Redis=require(_0x2aef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aef('0x6'));var logger=require('../../config/logger')(_0x2aef('0x7'));var config=require(_0x2aef('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2aef('0x9')]({'port':0x232a});config[_0x2aef('0xa')]=_[_0x2aef('0xb')](config[_0x2aef('0xa')],{'host':_0x2aef('0xc'),'port':0x18eb});var socket=require(_0x2aef('0xd'))(new Redis(config[_0x2aef('0xa')]));require(_0x2aef('0xe'))[_0x2aef('0xf')](socket);function respondWithRpcPromise(_0x3158fe,_0x299738,_0x312841){return new BPromise(function(_0x4c2708,_0x8960f9){return client[_0x2aef('0x10')](_0x3158fe,_0x312841)[_0x2aef('0x11')](function(_0xad2580){logger[_0x2aef('0x12')](_0x2aef('0x13'),_0x299738,'request\x20sent');logger[_0x2aef('0x14')](_0x2aef('0x15'),_0x299738,'request\x20sent',JSON[_0x2aef('0x16')](_0xad2580));if(_0xad2580['error']){if(_0xad2580[_0x2aef('0x17')][_0x2aef('0x18')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x299738,_0xad2580['error'][_0x2aef('0x19')]);return _0x8960f9(_0xad2580['error'][_0x2aef('0x19')]);}logger[_0x2aef('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x299738,_0xad2580[_0x2aef('0x17')]['message']);return _0x4c2708(_0xad2580['error'][_0x2aef('0x19')]);}else{logger[_0x2aef('0x12')](_0x2aef('0x13'),_0x299738,'request\x20sent');_0x4c2708(_0xad2580[_0x2aef('0x1a')][_0x2aef('0x19')]);}})[_0x2aef('0x1b')](function(_0x29bd77){logger[_0x2aef('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x299738,_0x29bd77);_0x8960f9(_0x29bd77);});});}exports[_0x2aef('0x1c')]=function(_0xa35ead){var _0x4b7aef=this;return new Promise(function(_0x2d6e54,_0x5a1f03){return db[_0x2aef('0x1d')][_0x2aef('0x1e')](_0xa35ead[_0x2aef('0x1f')],{'raw':_0xa35ead['options']?_0xa35ead[_0x2aef('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa35ead[_0x2aef('0x20')]?_0xa35ead[_0x2aef('0x20')]['where']||null:null,'attributes':_0xa35ead['options']?_0xa35ead[_0x2aef('0x20')][_0x2aef('0x21')]||null:null,'limit':_0xa35ead['options']?_0xa35ead[_0x2aef('0x20')]['limit']||null:null})[_0x2aef('0x11')](function(_0x24da54){logger[_0x2aef('0x12')](_0x2aef('0x1c'),_0xa35ead);logger[_0x2aef('0x14')](_0x2aef('0x1c'),_0xa35ead,JSON[_0x2aef('0x16')](_0x24da54));_0x2d6e54(_0x24da54);})['catch'](function(_0x2eb0a1){logger[_0x2aef('0x17')](_0x2aef('0x1c'),_0x2eb0a1[_0x2aef('0x19')],_0xa35ead);_0x5a1f03(_0x4b7aef['error'](0x1f4,_0x2eb0a1[_0x2aef('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x41a0ad){return new Promise(function(_0x3e7f26,_0x384605){return db[_0x2aef('0x1d')][_0x2aef('0x22')]({'where':_0x41a0ad[_0x2aef('0x20')]?_0x41a0ad[_0x2aef('0x20')][_0x2aef('0x23')]||null:null})[_0x2aef('0x11')](function(_0x4a377e){if(_0x4a377e){return _0x4a377e[_0x2aef('0x24')](_0x41a0ad[_0x2aef('0x1f')][_0x2aef('0x25')],_[_0x2aef('0x26')](_0x41a0ad[_0x2aef('0x1f')],['ids','id'])||{});}})[_0x2aef('0x27')](function(_0x833e6d){logger[_0x2aef('0x12')](_0x2aef('0x28'),_0x41a0ad);logger[_0x2aef('0x14')](_0x2aef('0x28'),_0x41a0ad,JSON[_0x2aef('0x16')](_0x833e6d));_0x3e7f26(_0x833e6d);})[_0x2aef('0x1b')](function(_0x1f3230){logger[_0x2aef('0x17')](_0x2aef('0x28'),_0x1f3230[_0x2aef('0x19')],_0x41a0ad);_0x384605(_this[_0x2aef('0x17')](0x1f4,_0x1f3230[_0x2aef('0x19')]));});});}; \ No newline at end of file +var _0xe184=['defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','then','debug','WhatsappInteraction','find','ids','omit','spread','AddTags','catch','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','http','redis'];(function(_0x7d2db1,_0x34145b){var _0x2b4c06=function(_0x552a4e){while(--_0x552a4e){_0x7d2db1['push'](_0x7d2db1['shift']());}};_0x2b4c06(++_0x34145b);}(_0xe184,0x158));var _0x4e18=function(_0x4ab2f4,_0x2f2b40){_0x4ab2f4=_0x4ab2f4-0x0;var _0xbb2b70=_0xe184[_0x4ab2f4];return _0xbb2b70;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4e18('0x0'));var BPromise=require('bluebird');var rs=require(_0x4e18('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4e18('0x2'))('rpc');var config=require(_0x4e18('0x3'));var jayson=require(_0x4e18('0x4'));var client=jayson['client'][_0x4e18('0x5')]({'port':0x232a});config[_0x4e18('0x6')]=_[_0x4e18('0x7')](config[_0x4e18('0x6')],{'host':_0x4e18('0x8'),'port':0x18eb});var socket=require(_0x4e18('0x9'))(new Redis(config[_0x4e18('0x6')]));require(_0x4e18('0xa'))[_0x4e18('0xb')](socket);function respondWithRpcPromise(_0x1c628c,_0x53360c,_0x4bc846){return new BPromise(function(_0x4ed86d,_0x3f6a6e){return client[_0x4e18('0xc')](_0x1c628c,_0x4bc846)['then'](function(_0xe0103e){logger[_0x4e18('0xd')](_0x4e18('0xe'),_0x53360c,_0x4e18('0xf'));logger['debug'](_0x4e18('0x10'),_0x53360c,'request\x20sent',JSON[_0x4e18('0x11')](_0xe0103e));if(_0xe0103e['error']){if(_0xe0103e[_0x4e18('0x12')][_0x4e18('0x13')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x53360c,_0xe0103e[_0x4e18('0x12')][_0x4e18('0x14')]);return _0x3f6a6e(_0xe0103e['error'][_0x4e18('0x14')]);}logger[_0x4e18('0x12')](_0x4e18('0xe'),_0x53360c,_0xe0103e[_0x4e18('0x12')][_0x4e18('0x14')]);return _0x4ed86d(_0xe0103e[_0x4e18('0x12')][_0x4e18('0x14')]);}else{logger[_0x4e18('0xd')]('WhatsappInteraction,\x20%s,\x20%s',_0x53360c,_0x4e18('0xf'));_0x4ed86d(_0xe0103e[_0x4e18('0x15')][_0x4e18('0x14')]);}})['catch'](function(_0x19926a){logger[_0x4e18('0x12')](_0x4e18('0xe'),_0x53360c,_0x19926a);_0x3f6a6e(_0x19926a);});});}exports[_0x4e18('0x16')]=function(_0x4a62bb){var _0x267806=this;return new Promise(function(_0x2bf483,_0x4c3cf1){return db['WhatsappInteraction'][_0x4e18('0x17')](_0x4a62bb[_0x4e18('0x18')],{'raw':_0x4a62bb['options']?_0x4a62bb[_0x4e18('0x19')][_0x4e18('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a62bb[_0x4e18('0x19')]?_0x4a62bb[_0x4e18('0x19')][_0x4e18('0x1b')]||null:null,'attributes':_0x4a62bb[_0x4e18('0x19')]?_0x4a62bb[_0x4e18('0x19')][_0x4e18('0x1c')]||null:null,'limit':_0x4a62bb['options']?_0x4a62bb['options'][_0x4e18('0x1d')]||null:null})[_0x4e18('0x1e')](function(_0x18d53a){logger[_0x4e18('0xd')]('UpdateWhatsappInteraction',_0x4a62bb);logger[_0x4e18('0x1f')]('UpdateWhatsappInteraction',_0x4a62bb,JSON[_0x4e18('0x11')](_0x18d53a));_0x2bf483(_0x18d53a);})['catch'](function(_0x2b6f5e){logger[_0x4e18('0x12')](_0x4e18('0x16'),_0x2b6f5e['message'],_0x4a62bb);_0x4c3cf1(_0x267806[_0x4e18('0x12')](0x1f4,_0x2b6f5e['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x2c71d0){return new Promise(function(_0x305a94,_0x3c7a1b){return db[_0x4e18('0x20')][_0x4e18('0x21')]({'where':_0x2c71d0[_0x4e18('0x19')]?_0x2c71d0[_0x4e18('0x19')][_0x4e18('0x1b')]||null:null})[_0x4e18('0x1e')](function(_0x8e5479){if(_0x8e5479){return _0x8e5479['addTags'](_0x2c71d0['body'][_0x4e18('0x22')],_[_0x4e18('0x23')](_0x2c71d0['body'],[_0x4e18('0x22'),'id'])||{});}})[_0x4e18('0x24')](function(_0x49d35f){logger[_0x4e18('0xd')](_0x4e18('0x25'),_0x2c71d0);logger[_0x4e18('0x1f')](_0x4e18('0x25'),_0x2c71d0,JSON['stringify'](_0x49d35f));_0x305a94(_0x49d35f);})[_0x4e18('0x26')](function(_0x3eb0ca){logger[_0x4e18('0x12')](_0x4e18('0x25'),_0x3eb0ca['message'],_0x2c71d0);_0x3c7a1b(_this[_0x4e18('0x12')](0x1f4,_0x3eb0ca[_0x4e18('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 755cbcb..4c84d6e 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 _0xa364=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3d85b3,_0xdf9751){var _0x1e720f=function(_0x199e1c){while(--_0x199e1c){_0x3d85b3['push'](_0x3d85b3['shift']());}};_0x1e720f(++_0xdf9751);}(_0xa364,0x9a));var _0x4a36=function(_0x21ef7d,_0x525e75){_0x21ef7d=_0x21ef7d-0x0;var _0xdf120=_0xa364[_0x21ef7d];return _0xdf120;};'use strict';var WhatsappInteractionEvents=require(_0x4a36('0x0'));var events=[_0x4a36('0x1'),_0x4a36('0x2'),_0x4a36('0x3')];function createListener(_0x314d85,_0x5bd121){return function(_0x4d295f){_0x5bd121[_0x4a36('0x4')](_0x314d85,_0x4d295f);};}function removeListener(_0x5972cf,_0x15b316){return function(){WhatsappInteractionEvents[_0x4a36('0x5')](_0x5972cf,_0x15b316);};}exports[_0x4a36('0x6')]=function(_0x12c66c){for(var _0x12a005=0x0,_0xc536e1=events[_0x4a36('0x7')];_0x12a005<_0xc536e1;_0x12a005++){var _0x1e3e67=events[_0x12a005];var _0x234994=createListener(_0x4a36('0x8')+_0x1e3e67,_0x12c66c);WhatsappInteractionEvents['on'](_0x1e3e67,_0x234994);}}; \ No newline at end of file +var _0x4829=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','emit','removeListener'];(function(_0x539533,_0x59b89b){var _0x3942f3=function(_0x3b386c){while(--_0x3b386c){_0x539533['push'](_0x539533['shift']());}};_0x3942f3(++_0x59b89b);}(_0x4829,0xdb));var _0x9482=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x4829[_0x5d2803];return _0xdcad2c;};'use strict';var WhatsappInteractionEvents=require(_0x9482('0x0'));var events=[_0x9482('0x1'),_0x9482('0x2'),'update'];function createListener(_0x2e4fab,_0x2c848d){return function(_0x58b652){_0x2c848d[_0x9482('0x3')](_0x2e4fab,_0x58b652);};}function removeListener(_0x365264,_0x1c542c){return function(){WhatsappInteractionEvents[_0x9482('0x4')](_0x365264,_0x1c542c);};}exports['register']=function(_0x7b9e80){for(var _0x483394=0x0,_0x9bfcbe=events[_0x9482('0x5')];_0x483394<_0x9bfcbe;_0x483394++){var _0x55115c=events[_0x483394];var _0x37e238=createListener(_0x9482('0x6')+_0x55115c,_0x7b9e80);WhatsappInteractionEvents['on'](_0x55115c,_0x37e238);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 976b19a..bb6245d 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 _0x3744=['/:id','show','post','tracked','whatsapp','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3744,0x10a));var _0x4374=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3744[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x4374('0x0'));var util=require(_0x4374('0x1'));var path=require(_0x4374('0x2'));var timeout=require(_0x4374('0x3'));var express=require(_0x4374('0x4'));var router=express[_0x4374('0x5')]();var fs_extra=require(_0x4374('0x6'));var auth=require(_0x4374('0x7'));var interaction=require(_0x4374('0x8'));var config=require(_0x4374('0x9'));var controller=require('./whatsappMessage.controller');router[_0x4374('0xa')]('/',auth['isAuthenticated'](),controller[_0x4374('0xb')]);router[_0x4374('0xa')]('/describe',auth[_0x4374('0xc')](),controller[_0x4374('0xd')]);router[_0x4374('0xa')](_0x4374('0xe'),auth[_0x4374('0xc')](),controller[_0x4374('0xf')]);router[_0x4374('0x10')]('/',auth[_0x4374('0xc')](),interaction[_0x4374('0x11')](_0x4374('0x12'),'whatsappmessage:create'),controller[_0x4374('0x13')]);router[_0x4374('0x10')](_0x4374('0x14'),controller[_0x4374('0x15')]);router[_0x4374('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x4374('0x17')]);router[_0x4374('0x16')](_0x4374('0x18'),auth[_0x4374('0xc')](),controller[_0x4374('0x19')]);router['put'](_0x4374('0x1a'),auth[_0x4374('0xc')](),controller['reject']);router[_0x4374('0x1b')](_0x4374('0xe'),auth[_0x4374('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xece7=['show','post','whatsappmessage:create','create','/:id/status','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x295853,_0x343723){var _0x1305bb=function(_0x3de12e){while(--_0x3de12e){_0x295853['push'](_0x295853['shift']());}};_0x1305bb(++_0x343723);}(_0xece7,0x12a));var _0x7ece=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xece7[_0x432fca];return _0x3adba4;};'use strict';var multer=require(_0x7ece('0x0'));var util=require(_0x7ece('0x1'));var path=require(_0x7ece('0x2'));var timeout=require(_0x7ece('0x3'));var express=require('express');var router=express[_0x7ece('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7ece('0x5'));var interaction=require(_0x7ece('0x6'));var config=require(_0x7ece('0x7'));var controller=require(_0x7ece('0x8'));router[_0x7ece('0x9')]('/',auth[_0x7ece('0xa')](),controller['index']);router[_0x7ece('0x9')](_0x7ece('0xb'),auth['isAuthenticated'](),controller[_0x7ece('0xc')]);router['get'](_0x7ece('0xd'),auth[_0x7ece('0xa')](),controller[_0x7ece('0xe')]);router[_0x7ece('0xf')]('/',auth[_0x7ece('0xa')](),interaction['tracked']('whatsapp',_0x7ece('0x10')),controller[_0x7ece('0x11')]);router[_0x7ece('0xf')](_0x7ece('0x12'),controller['status']);router['put'](_0x7ece('0xd'),auth[_0x7ece('0xa')](),controller['update']);router[_0x7ece('0x13')](_0x7ece('0x14'),auth[_0x7ece('0xa')](),controller[_0x7ece('0x15')]);router[_0x7ece('0x13')](_0x7ece('0x16'),auth[_0x7ece('0xa')](),controller[_0x7ece('0x17')]);router['delete']('/:id',auth[_0x7ece('0xa')](),controller[_0x7ece('0x18')]);module[_0x7ece('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index a050b13..2d08fee 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 _0xda9d=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x4ae70a,_0x394fec){var _0x4caed5=function(_0xf40532){while(--_0xf40532){_0x4ae70a['push'](_0x4ae70a['shift']());}};_0x4caed5(++_0x394fec);}(_0xda9d,0x85));var _0xdda9=function(_0xc753c8,_0x5627ff){_0xc753c8=_0xc753c8-0x0;var _0xd02f5c=_0xda9d[_0xc753c8];return _0xd02f5c;};'use strict';var Sequelize=require('sequelize');module[_0xdda9('0x0')]={'body':{'type':Sequelize[_0xdda9('0x1')](_0xdda9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdda9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdda9('0x4')]('in','out'),'defaultValue':_0xdda9('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xdda9('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xdda9('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3b59=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x58e5ce,_0x3f6c43){var _0xbdfe34=function(_0x441652){while(--_0x441652){_0x58e5ce['push'](_0x58e5ce['shift']());}};_0xbdfe34(++_0x3f6c43);}(_0x3b59,0xc0));var _0x93b5=function(_0x22df91,_0x1521d2){_0x22df91=_0x22df91-0x0;var _0x10f330=_0x3b59[_0x22df91];return _0x10f330;};'use strict';var Sequelize=require(_0x93b5('0x0'));module['exports']={'body':{'type':Sequelize[_0x93b5('0x1')](_0x93b5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x93b5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x93b5('0x4')]('in',_0x93b5('0x5')),'defaultValue':_0x93b5('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x93b5('0x6')](0xbe)},'phone':{'type':Sequelize[_0x93b5('0x6')]},'readAt':{'type':Sequelize[_0x93b5('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x93b5('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 8fc384c..cab7fb3 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 _0x17f7=['stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','name','send','index','map','fieldName','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','params','rawAttributes','intersection','find','create','body','describe','accept','whatsapp','acceptMessage','UserId','agent','get','WhatsappInteraction','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','format','SIP/%s','channel','event','reject','EventManager','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','whatsapp-interactions','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x17f7,0x198));var _0x717f=function(_0x29bd3d,_0x295cdf){_0x29bd3d=_0x29bd3d-0x0;var _0x2fda8f=_0x17f7[_0x29bd3d];return _0x2fda8f;};'use strict';var util=require(_0x717f('0x0'));var _=require(_0x717f('0x1'));var Redis=require('ioredis');var interactionService=require(_0x717f('0x2'));var qs=require(_0x717f('0x3'));var logger=require(_0x717f('0x4'))('api');var config=require(_0x717f('0x5'));var db=require(_0x717f('0x6'))['db'];config[_0x717f('0x7')]=_[_0x717f('0x8')](config[_0x717f('0x7')],{'host':_0x717f('0x9'),'port':0x18eb});var socket=require(_0x717f('0xa'))(new Redis(config['redis']));require(_0x717f('0xb'))[_0x717f('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x717f('0xd')]['http']({'port':0x232c});var client9002=jayson[_0x717f('0xd')][_0x717f('0xe')]({'port':0x232a});var interaction_log=require(_0x717f('0x4'))(_0x717f('0xf'));function respondWithRpcPromise(_0x399ae8,_0x526475,_0x49aa91,_0x2a9811){return new Promise(function(_0x2c8aaa,_0x28ac37){var _0x2c7963=_0x2a9811||client;return _0x2c7963['request'](_0x399ae8,_0x49aa91)[_0x717f('0x10')](function(_0x571075){logger[_0x717f('0x11')](_0x717f('0x12'),_0x526475,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x526475,_0x717f('0x13'),JSON[_0x717f('0x14')](_0x571075));if(_0x571075['error']){if(_0x571075[_0x717f('0x15')]['code']===0x1f4){logger[_0x717f('0x15')](_0x717f('0x12'),_0x526475,_0x571075[_0x717f('0x15')][_0x717f('0x16')]);return _0x28ac37(_0x571075['error'][_0x717f('0x16')]);}logger[_0x717f('0x15')](_0x717f('0x12'),_0x526475,_0x571075[_0x717f('0x15')][_0x717f('0x16')]);return _0x2c8aaa(_0x571075[_0x717f('0x15')][_0x717f('0x16')]);}else{logger[_0x717f('0x11')](_0x717f('0x12'),_0x526475,'request\x20sent');_0x2c8aaa(_0x571075[_0x717f('0x17')][_0x717f('0x16')]);}})[_0x717f('0x18')](function(_0x26994b){logger['error'](_0x717f('0x12'),_0x526475,_0x26994b);_0x28ac37(_0x26994b);});});}function respondWithResult(_0x387f12,_0x3758f4){_0x3758f4=_0x3758f4||0xc8;return function(_0x2fe72e){if(_0x2fe72e){return _0x387f12[_0x717f('0x19')](_0x3758f4)[_0x717f('0x1a')](_0x2fe72e);}};}function respondWithFilteredResult(_0x334c05,_0xdf868a){return function(_0x38bd32){if(_0x38bd32){var _0x22e9bf=typeof _0xdf868a[_0x717f('0x1b')]===_0x717f('0x1c')&&typeof _0xdf868a[_0x717f('0x1d')]===_0x717f('0x1c');var _0x572e87=_0x38bd32['count'];var _0x1e1e68=_0x22e9bf?0x0:_0xdf868a[_0x717f('0x1b')];var _0x353ab5=_0x22e9bf?_0x38bd32[_0x717f('0x1e')]:_0xdf868a[_0x717f('0x1b')]+_0xdf868a[_0x717f('0x1d')];var _0xbf00de;if(_0x353ab5>=_0x572e87){_0x353ab5=_0x572e87;_0xbf00de=0xc8;}else{_0xbf00de=0xce;}_0x334c05['status'](_0xbf00de);return _0x334c05[_0x717f('0x1f')](_0x717f('0x20'),_0x1e1e68+'-'+_0x353ab5+'/'+_0x572e87)[_0x717f('0x1a')](_0x38bd32);}return null;};}function saveUpdates(_0x40a32d){return function(_0x1bcd54){if(_0x1bcd54){return _0x1bcd54[_0x717f('0x21')](_0x40a32d)['then'](function(_0x165551){return _0x165551;});}return null;};}function removeEntity(_0x18509c){return function(_0x2605a9){if(_0x2605a9){return _0x2605a9[_0x717f('0x22')]()[_0x717f('0x10')](function(){_0x18509c[_0x717f('0x19')](0xcc)[_0x717f('0x23')]();});}};}function handleEntityNotFound(_0x3cdd4d){return function(_0x132024){if(!_0x132024){_0x3cdd4d[_0x717f('0x24')](0x194);}return _0x132024;};}function handleError(_0x7404ae,_0x4cd270){_0x4cd270=_0x4cd270||0x1f4;return function(_0x9fee60){logger[_0x717f('0x15')](_0x9fee60['stack']);if(_0x9fee60[_0x717f('0x25')]){delete _0x9fee60['name'];}_0x7404ae[_0x717f('0x19')](_0x4cd270)[_0x717f('0x26')](_0x9fee60);};}exports[_0x717f('0x27')]=function(_0x10d3cd,_0x368b55){var _0x2ad681={},_0x395d51={},_0x2b3e6f={'count':0x0,'rows':[]};var _0x1223f3=_[_0x717f('0x28')](db['WhatsappMessage']['rawAttributes'],function(_0x1f8727){return{'name':_0x1f8727[_0x717f('0x29')],'type':_0x1f8727['type']['key']};});_0x395d51[_0x717f('0x2a')]=_[_0x717f('0x28')](_0x1223f3,_0x717f('0x25'));_0x395d51[_0x717f('0x2b')]=_[_0x717f('0x2c')](_0x10d3cd[_0x717f('0x2b')]);_0x395d51['filters']=_['intersection'](_0x395d51[_0x717f('0x2a')],_0x395d51[_0x717f('0x2b')]);_0x2ad681[_0x717f('0x2d')]=_['intersection'](_0x395d51[_0x717f('0x2a')],qs[_0x717f('0x2e')](_0x10d3cd[_0x717f('0x2b')][_0x717f('0x2e')]));_0x2ad681[_0x717f('0x2d')]=_0x2ad681[_0x717f('0x2d')][_0x717f('0x2f')]?_0x2ad681[_0x717f('0x2d')]:_0x395d51['model'];if(!_0x10d3cd[_0x717f('0x2b')][_0x717f('0x30')](_0x717f('0x31'))){_0x2ad681[_0x717f('0x1d')]=qs[_0x717f('0x1d')](_0x10d3cd['query'][_0x717f('0x1d')]);_0x2ad681[_0x717f('0x1b')]=qs[_0x717f('0x1b')](_0x10d3cd[_0x717f('0x2b')][_0x717f('0x1b')]);}_0x2ad681[_0x717f('0x32')]=qs['sort'](_0x10d3cd[_0x717f('0x2b')][_0x717f('0x33')]);_0x2ad681[_0x717f('0x34')]=qs[_0x717f('0x35')](_[_0x717f('0x36')](_0x10d3cd[_0x717f('0x2b')],_0x395d51[_0x717f('0x35')]),_0x1223f3);if(_0x10d3cd[_0x717f('0x2b')][_0x717f('0x37')]){_0x2ad681[_0x717f('0x34')]=_[_0x717f('0x38')](_0x2ad681['where'],{'$or':_[_0x717f('0x28')](_0x1223f3,function(_0x3aaf5a){if(_0x3aaf5a[_0x717f('0x39')]!==_0x717f('0x3a')){var _0x5ef633={};_0x5ef633[_0x3aaf5a[_0x717f('0x25')]]={'$like':'%'+_0x10d3cd[_0x717f('0x2b')]['filter']+'%'};return _0x5ef633;}})});}_0x2ad681=_[_0x717f('0x38')]({},_0x2ad681,_0x10d3cd[_0x717f('0x3b')]);var _0x1d4d55={'where':_0x2ad681['where']};return db[_0x717f('0x3c')][_0x717f('0x1e')](_0x1d4d55)['then'](function(_0x4db714){_0x2b3e6f[_0x717f('0x1e')]=_0x4db714;if(_0x10d3cd['query'][_0x717f('0x3d')]){_0x2ad681[_0x717f('0x3e')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x717f('0x3f')](_0x2ad681);})[_0x717f('0x10')](function(_0xfbff5f){_0x2b3e6f['rows']=_0xfbff5f;return _0x2b3e6f;})['then'](respondWithFilteredResult(_0x368b55,_0x2ad681))[_0x717f('0x18')](handleError(_0x368b55,null));};exports['show']=function(_0x24eea4,_0x541e66){var _0x1dd5a7={'raw':!![],'where':{'id':_0x24eea4[_0x717f('0x40')]['id']}},_0x183177={};_0x183177[_0x717f('0x2a')]=_[_0x717f('0x2c')](db[_0x717f('0x3c')][_0x717f('0x41')]);_0x183177[_0x717f('0x2b')]=_[_0x717f('0x2c')](_0x24eea4['query']);_0x183177[_0x717f('0x35')]=_[_0x717f('0x42')](_0x183177[_0x717f('0x2a')],_0x183177['query']);_0x1dd5a7[_0x717f('0x2d')]=_[_0x717f('0x42')](_0x183177['model'],qs[_0x717f('0x2e')](_0x24eea4[_0x717f('0x2b')][_0x717f('0x2e')]));_0x1dd5a7[_0x717f('0x2d')]=_0x1dd5a7[_0x717f('0x2d')][_0x717f('0x2f')]?_0x1dd5a7[_0x717f('0x2d')]:_0x183177[_0x717f('0x2a')];if(_0x24eea4[_0x717f('0x2b')][_0x717f('0x3d')]){_0x1dd5a7[_0x717f('0x3e')]=[{'all':!![]}];}_0x1dd5a7=_[_0x717f('0x38')]({},_0x1dd5a7,_0x24eea4['options']);return db[_0x717f('0x3c')][_0x717f('0x43')](_0x1dd5a7)[_0x717f('0x10')](handleEntityNotFound(_0x541e66,null))['then'](respondWithResult(_0x541e66,null))[_0x717f('0x18')](handleError(_0x541e66,null));};exports['create']=function(_0x10997a,_0x2b3c3c){return db[_0x717f('0x3c')][_0x717f('0x44')](_0x10997a[_0x717f('0x45')],{})[_0x717f('0x10')](respondWithResult(_0x2b3c3c,0xc9))[_0x717f('0x18')](handleError(_0x2b3c3c,null));};exports['update']=function(_0x1043c2,_0x265cf6){if(_0x1043c2[_0x717f('0x45')]['id']){delete _0x1043c2[_0x717f('0x45')]['id'];}return db[_0x717f('0x3c')][_0x717f('0x43')]({'where':{'id':_0x1043c2[_0x717f('0x40')]['id']}})['then'](handleEntityNotFound(_0x265cf6,null))[_0x717f('0x10')](saveUpdates(_0x1043c2[_0x717f('0x45')],null))[_0x717f('0x10')](respondWithResult(_0x265cf6,null))[_0x717f('0x18')](handleError(_0x265cf6,null));};exports[_0x717f('0x22')]=function(_0x3830e8,_0x2e7fe7){return db[_0x717f('0x3c')]['find']({'where':{'id':_0x3830e8[_0x717f('0x40')]['id']}})[_0x717f('0x10')](handleEntityNotFound(_0x2e7fe7,null))[_0x717f('0x10')](removeEntity(_0x2e7fe7,null))[_0x717f('0x18')](handleError(_0x2e7fe7,null));};exports[_0x717f('0x46')]=function(_0x59a337,_0x5c95f2){return db[_0x717f('0x3c')][_0x717f('0x46')]()['then'](respondWithResult(_0x5c95f2,null))[_0x717f('0x18')](handleError(_0x5c95f2,null));};exports[_0x717f('0x47')]=function(_0x5561da,_0x9c3698){var _0x25dfdd=_0x717f('0x48');return interactionService[_0x717f('0x49')](_0x5561da,_0x25dfdd)[_0x717f('0x10')](respondWithResult(_0x9c3698,null))[_0x717f('0x18')](handleError(_0x9c3698,null));};exports['reject']=function(_0x1a7d29,_0x545f71){var _0x32cdcc={'agent':{},'channel':_0x717f('0x48')};if(_0x1a7d29['body']['id']){delete _0x1a7d29[_0x717f('0x45')]['id'];}_0x1a7d29[_0x717f('0x45')][_0x717f('0x4a')]=_0x1a7d29[_0x717f('0x45')][_0x717f('0x4a')]||_0x1a7d29['user']['id'];_0x32cdcc[_0x717f('0x4b')]['id']=_0x1a7d29[_0x717f('0x45')][_0x717f('0x4a')];return db[_0x717f('0x3c')]['find']({'where':{'id':_0x1a7d29[_0x717f('0x40')]['id'],'UserId':null}})[_0x717f('0x10')](handleEntityNotFound(_0x545f71,null))[_0x717f('0x10')](function(_0x311dbd){if(_0x311dbd){_0x32cdcc[_0x717f('0x16')]=_0x311dbd[_0x717f('0x4c')]({'plain':!![]});return db[_0x717f('0x4d')][_0x717f('0x43')]({'where':{'id':_0x311dbd['WhatsappInteractionId']}});}return null;})[_0x717f('0x10')](handleEntityNotFound(_0x545f71,null))[_0x717f('0x10')](function(_0x479dab){if(_0x479dab){_0x32cdcc[_0x717f('0x4e')]=_0x479dab[_0x717f('0x4c')]({'plain':!![]});interaction_log[_0x717f('0x11')](_0x717f('0x4f'),_0x1a7d29['user']['id'],_0x1a7d29[_0x717f('0x50')][_0x717f('0x25')],_0x1a7d29[_0x717f('0x50')][_0x717f('0x51')],_0x32cdcc[_0x717f('0x4e')]['id'],_0x1a7d29[_0x717f('0x45')]?JSON[_0x717f('0x14')](_0x1a7d29[_0x717f('0x45')]):_0x717f('0x52'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x32cdcc);}return null;})['then'](function(_0x1c9a93){var _0x8d075e=_0x717f('0x53')+_0x1c9a93[_0x717f('0x16')][_0x717f('0x54')];return db['sequelize'][_0x717f('0x2b')](_0x8d075e,{'type':db[_0x717f('0x55')][_0x717f('0x56')][_0x717f('0x57')],'raw':!![]})[_0x717f('0x10')](function(_0x41bcdb){return _0x41bcdb;});})[_0x717f('0x10')](function(_0x65b16){if(_0x65b16){_0x32cdcc['message']['contact']=_0x65b16[0x0];if(!_0x1a7d29[_0x717f('0x45')]['UserId'])return;return db[_0x717f('0x58')][_0x717f('0x43')]({'where':{'id':_0x1a7d29[_0x717f('0x45')]['UserId'],'role':_0x717f('0x4b')},'attributes':['id',_0x717f('0x25'),_0x717f('0x59'),_0x717f('0x5a'),_0x717f('0x5b')],'raw':!![]});}return null;})['then'](function(_0x38057b){if(!_0x38057b)return null;_0x32cdcc[_0x717f('0x16')][_0x717f('0x4b')]=_0x38057b;return _0x32cdcc;})[_0x717f('0x10')](function(_0x58c40b){if(_0x58c40b){_0x58c40b[_0x717f('0x16')]['interface']=util[_0x717f('0x5c')](_0x717f('0x5d'),_0x1a7d29[_0x717f('0x50')]['name']);_0x58c40b[_0x717f('0x16')][_0x717f('0x5e')]=_0x32cdcc[_0x717f('0x5e')];_0x58c40b[_0x717f('0x16')]['motionChannel']=_0x32cdcc[_0x717f('0x5e')];_0x58c40b[_0x717f('0x16')][_0x717f('0x5f')]=_0x717f('0x60');respondWithRpcPromise(_0x717f('0x61'),_0x717f('0x61'),{'event':_0x717f('0x62'),'message':_0x58c40b['message']},client9002);return _0x32cdcc;}return null;})[_0x717f('0x10')](respondWithResult(_0x545f71,null))['catch'](handleError(_0x545f71,null));};exports['status']=function(_0x12863a,_0x219f4b){if(_0x12863a['body']['id']){delete _0x12863a['body']['id'];}var _0xb8c07e;return db[_0x717f('0x3c')][_0x717f('0x43')]({'where':{'id':_0x12863a['params']['id']}})[_0x717f('0x10')](handleEntityNotFound(_0x219f4b,null))[_0x717f('0x10')](function(_0x49007d){if(_0x49007d){_0xb8c07e=_0x49007d;return db[_0x717f('0x63')]['find']({'where':{'id':_0x49007d['WhatsappAccountId']}});}})[_0x717f('0x10')](handleEntityNotFound(_0x219f4b,null))[_0x717f('0x10')](function(_0x3dd48d){if(_0x3dd48d){logger['debug'](_0x717f('0x64'),_0x717f('0x19'),_0x717f('0x65'),_0x3dd48d['type'],util[_0x717f('0x66')](_0x12863a['body'],{'showHidden':![],'depth':null}));switch(_0x3dd48d[_0x717f('0x39')]){case _0x717f('0x67'):if(_0x12863a['body']['MessageSid']&&_0x12863a[_0x717f('0x45')]['MessageSid']===_0xb8c07e[_0x717f('0x68')]&&_0x12863a[_0x717f('0x45')][_0x717f('0x69')]&&_0x12863a[_0x717f('0x45')][_0x717f('0x69')]==='read'){return _0xb8c07e['update']({'read':!![]});}else{logger[_0x717f('0x15')](_0x717f('0x6a'),_0x717f('0x19'),_0x717f('0x67'),util[_0x717f('0x66')](_0x12863a[_0x717f('0x45')],{'showHidden':![],'depth':null}));}break;}return _0xb8c07e;}})[_0x717f('0x10')](respondWithResult(_0x219f4b,null))['catch'](handleError(_0x219f4b,null));}; \ No newline at end of file +var _0x299e=['lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','json','offset','limit','count','status','set','update','end','sendStatus','stack','name','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','findAll','show','includeAll','find','create','body','params','destroy','accept','whatsapp','acceptMessage','reject','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','role','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','util'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x299e,0x69));var _0xe299=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x299e[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xe299('0x0'));var _=require(_0xe299('0x1'));var Redis=require(_0xe299('0x2'));var interactionService=require(_0xe299('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xe299('0x4'))(_0xe299('0x5'));var config=require('../../config/environment');var db=require(_0xe299('0x6'))['db'];config[_0xe299('0x7')]=_[_0xe299('0x8')](config[_0xe299('0x7')],{'host':_0xe299('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe299('0x7')]));require(_0xe299('0xa'))[_0xe299('0xb')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe299('0xc')][_0xe299('0xd')]({'port':0x232c});var client9002=jayson['client'][_0xe299('0xd')]({'port':0x232a});var interaction_log=require('../../config/logger')('whatsapp-interactions');function respondWithRpcPromise(_0x3df7f7,_0x1f346f,_0x571cca,_0x4a0acd){return new Promise(function(_0xd3cf6d,_0x3cfd9d){var _0x590594=_0x4a0acd||client;return _0x590594['request'](_0x3df7f7,_0x571cca)[_0xe299('0xe')](function(_0x2ea9f3){logger['info'](_0xe299('0xf'),_0x1f346f,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1f346f,_0xe299('0x10'),JSON['stringify'](_0x2ea9f3));if(_0x2ea9f3['error']){if(_0x2ea9f3[_0xe299('0x11')][_0xe299('0x12')]===0x1f4){logger[_0xe299('0x11')](_0xe299('0xf'),_0x1f346f,_0x2ea9f3[_0xe299('0x11')][_0xe299('0x13')]);return _0x3cfd9d(_0x2ea9f3[_0xe299('0x11')][_0xe299('0x13')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1f346f,_0x2ea9f3[_0xe299('0x11')][_0xe299('0x13')]);return _0xd3cf6d(_0x2ea9f3[_0xe299('0x11')][_0xe299('0x13')]);}else{logger[_0xe299('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x1f346f,'request\x20sent');_0xd3cf6d(_0x2ea9f3[_0xe299('0x15')]['message']);}})[_0xe299('0x16')](function(_0x29c71e){logger[_0xe299('0x11')](_0xe299('0xf'),_0x1f346f,_0x29c71e);_0x3cfd9d(_0x29c71e);});});}function respondWithResult(_0x118aa1,_0x16536b){_0x16536b=_0x16536b||0xc8;return function(_0x3f845e){if(_0x3f845e){return _0x118aa1['status'](_0x16536b)[_0xe299('0x17')](_0x3f845e);}};}function respondWithFilteredResult(_0x3f7e20,_0x1dbde2){return function(_0x19aea0){if(_0x19aea0){var _0x11f79=typeof _0x1dbde2[_0xe299('0x18')]==='undefined'&&typeof _0x1dbde2[_0xe299('0x19')]==='undefined';var _0x3d1a21=_0x19aea0['count'];var _0x3ccbd6=_0x11f79?0x0:_0x1dbde2[_0xe299('0x18')];var _0x14e035=_0x11f79?_0x19aea0[_0xe299('0x1a')]:_0x1dbde2[_0xe299('0x18')]+_0x1dbde2[_0xe299('0x19')];var _0x29d4b3;if(_0x14e035>=_0x3d1a21){_0x14e035=_0x3d1a21;_0x29d4b3=0xc8;}else{_0x29d4b3=0xce;}_0x3f7e20[_0xe299('0x1b')](_0x29d4b3);return _0x3f7e20[_0xe299('0x1c')]('Content-Range',_0x3ccbd6+'-'+_0x14e035+'/'+_0x3d1a21)[_0xe299('0x17')](_0x19aea0);}return null;};}function saveUpdates(_0x5f0d1d){return function(_0x5a3cdc){if(_0x5a3cdc){return _0x5a3cdc[_0xe299('0x1d')](_0x5f0d1d)[_0xe299('0xe')](function(_0x5c39a3){return _0x5c39a3;});}return null;};}function removeEntity(_0x66329){return function(_0x2f8056){if(_0x2f8056){return _0x2f8056['destroy']()['then'](function(){_0x66329[_0xe299('0x1b')](0xcc)[_0xe299('0x1e')]();});}};}function handleEntityNotFound(_0x5d2efe){return function(_0xeb3fb7){if(!_0xeb3fb7){_0x5d2efe[_0xe299('0x1f')](0x194);}return _0xeb3fb7;};}function handleError(_0x2f7cac,_0x38ef8d){_0x38ef8d=_0x38ef8d||0x1f4;return function(_0x401470){logger[_0xe299('0x11')](_0x401470[_0xe299('0x20')]);if(_0x401470[_0xe299('0x21')]){delete _0x401470[_0xe299('0x21')];}_0x2f7cac[_0xe299('0x1b')](_0x38ef8d)['send'](_0x401470);};}exports[_0xe299('0x22')]=function(_0x56326f,_0x4c21d6){var _0x9dd4e9={},_0xa337b6={},_0x12975d={'count':0x0,'rows':[]};var _0x54c6c8=_[_0xe299('0x23')](db[_0xe299('0x24')]['rawAttributes'],function(_0x4dcc46){return{'name':_0x4dcc46[_0xe299('0x25')],'type':_0x4dcc46[_0xe299('0x26')][_0xe299('0x27')]};});_0xa337b6[_0xe299('0x28')]=_['map'](_0x54c6c8,_0xe299('0x21'));_0xa337b6[_0xe299('0x29')]=_[_0xe299('0x2a')](_0x56326f[_0xe299('0x29')]);_0xa337b6['filters']=_[_0xe299('0x2b')](_0xa337b6[_0xe299('0x28')],_0xa337b6[_0xe299('0x29')]);_0x9dd4e9['attributes']=_[_0xe299('0x2b')](_0xa337b6['model'],qs[_0xe299('0x2c')](_0x56326f[_0xe299('0x29')][_0xe299('0x2c')]));_0x9dd4e9['attributes']=_0x9dd4e9[_0xe299('0x2d')][_0xe299('0x2e')]?_0x9dd4e9[_0xe299('0x2d')]:_0xa337b6[_0xe299('0x28')];if(!_0x56326f['query'][_0xe299('0x2f')](_0xe299('0x30'))){_0x9dd4e9[_0xe299('0x19')]=qs[_0xe299('0x19')](_0x56326f[_0xe299('0x29')]['limit']);_0x9dd4e9[_0xe299('0x18')]=qs[_0xe299('0x18')](_0x56326f[_0xe299('0x29')][_0xe299('0x18')]);}_0x9dd4e9[_0xe299('0x31')]=qs[_0xe299('0x32')](_0x56326f[_0xe299('0x29')]['sort']);_0x9dd4e9['where']=qs[_0xe299('0x33')](_[_0xe299('0x34')](_0x56326f[_0xe299('0x29')],_0xa337b6[_0xe299('0x33')]),_0x54c6c8);if(_0x56326f[_0xe299('0x29')][_0xe299('0x35')]){_0x9dd4e9[_0xe299('0x36')]=_['merge'](_0x9dd4e9[_0xe299('0x36')],{'$or':_['map'](_0x54c6c8,function(_0x1ce7ed){if(_0x1ce7ed[_0xe299('0x26')]!==_0xe299('0x37')){var _0x5a2e0f={};_0x5a2e0f[_0x1ce7ed['name']]={'$like':'%'+_0x56326f['query']['filter']+'%'};return _0x5a2e0f;}})});}_0x9dd4e9=_[_0xe299('0x38')]({},_0x9dd4e9,_0x56326f[_0xe299('0x39')]);var _0x425902={'where':_0x9dd4e9[_0xe299('0x36')]};return db[_0xe299('0x24')][_0xe299('0x1a')](_0x425902)[_0xe299('0xe')](function(_0x39457c){_0x12975d[_0xe299('0x1a')]=_0x39457c;if(_0x56326f['query']['includeAll']){_0x9dd4e9[_0xe299('0x3a')]=[{'all':!![]}];}return db[_0xe299('0x24')][_0xe299('0x3b')](_0x9dd4e9);})['then'](function(_0x187cc0){_0x12975d['rows']=_0x187cc0;return _0x12975d;})['then'](respondWithFilteredResult(_0x4c21d6,_0x9dd4e9))[_0xe299('0x16')](handleError(_0x4c21d6,null));};exports[_0xe299('0x3c')]=function(_0x335511,_0xdbfa5f){var _0x18f87b={'raw':!![],'where':{'id':_0x335511['params']['id']}},_0x260df9={};_0x260df9[_0xe299('0x28')]=_[_0xe299('0x2a')](db[_0xe299('0x24')]['rawAttributes']);_0x260df9[_0xe299('0x29')]=_[_0xe299('0x2a')](_0x335511[_0xe299('0x29')]);_0x260df9[_0xe299('0x33')]=_[_0xe299('0x2b')](_0x260df9['model'],_0x260df9['query']);_0x18f87b['attributes']=_[_0xe299('0x2b')](_0x260df9[_0xe299('0x28')],qs['fields'](_0x335511[_0xe299('0x29')][_0xe299('0x2c')]));_0x18f87b[_0xe299('0x2d')]=_0x18f87b['attributes'][_0xe299('0x2e')]?_0x18f87b[_0xe299('0x2d')]:_0x260df9[_0xe299('0x28')];if(_0x335511[_0xe299('0x29')][_0xe299('0x3d')]){_0x18f87b['include']=[{'all':!![]}];}_0x18f87b=_[_0xe299('0x38')]({},_0x18f87b,_0x335511[_0xe299('0x39')]);return db[_0xe299('0x24')][_0xe299('0x3e')](_0x18f87b)[_0xe299('0xe')](handleEntityNotFound(_0xdbfa5f,null))[_0xe299('0xe')](respondWithResult(_0xdbfa5f,null))['catch'](handleError(_0xdbfa5f,null));};exports[_0xe299('0x3f')]=function(_0x1c1c42,_0x3c7047){return db[_0xe299('0x24')][_0xe299('0x3f')](_0x1c1c42[_0xe299('0x40')],{})[_0xe299('0xe')](respondWithResult(_0x3c7047,0xc9))[_0xe299('0x16')](handleError(_0x3c7047,null));};exports[_0xe299('0x1d')]=function(_0x8e0f25,_0x380a2f){if(_0x8e0f25['body']['id']){delete _0x8e0f25[_0xe299('0x40')]['id'];}return db['WhatsappMessage'][_0xe299('0x3e')]({'where':{'id':_0x8e0f25[_0xe299('0x41')]['id']}})[_0xe299('0xe')](handleEntityNotFound(_0x380a2f,null))[_0xe299('0xe')](saveUpdates(_0x8e0f25['body'],null))[_0xe299('0xe')](respondWithResult(_0x380a2f,null))[_0xe299('0x16')](handleError(_0x380a2f,null));};exports[_0xe299('0x42')]=function(_0xc8b9ea,_0x31daab){return db[_0xe299('0x24')][_0xe299('0x3e')]({'where':{'id':_0xc8b9ea['params']['id']}})[_0xe299('0xe')](handleEntityNotFound(_0x31daab,null))[_0xe299('0xe')](removeEntity(_0x31daab,null))[_0xe299('0x16')](handleError(_0x31daab,null));};exports['describe']=function(_0x52cca3,_0x20416e){return db['WhatsappMessage']['describe']()[_0xe299('0xe')](respondWithResult(_0x20416e,null))[_0xe299('0x16')](handleError(_0x20416e,null));};exports[_0xe299('0x43')]=function(_0x35f321,_0x722e20){var _0x4c115f=_0xe299('0x44');return interactionService[_0xe299('0x45')](_0x35f321,_0x4c115f)[_0xe299('0xe')](respondWithResult(_0x722e20,null))[_0xe299('0x16')](handleError(_0x722e20,null));};exports[_0xe299('0x46')]=function(_0x39c29b,_0x176a25){var _0x257f00={'agent':{},'channel':_0xe299('0x44')};if(_0x39c29b['body']['id']){delete _0x39c29b[_0xe299('0x40')]['id'];}_0x39c29b['body'][_0xe299('0x47')]=_0x39c29b[_0xe299('0x40')]['UserId']||_0x39c29b[_0xe299('0x48')]['id'];_0x257f00[_0xe299('0x49')]['id']=_0x39c29b['body'][_0xe299('0x47')];return db[_0xe299('0x24')][_0xe299('0x3e')]({'where':{'id':_0x39c29b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x176a25,null))[_0xe299('0xe')](function(_0x47015c){if(_0x47015c){_0x257f00[_0xe299('0x13')]=_0x47015c[_0xe299('0x4a')]({'plain':!![]});return db[_0xe299('0x4b')]['find']({'where':{'id':_0x47015c[_0xe299('0x4c')]}});}return null;})[_0xe299('0xe')](handleEntityNotFound(_0x176a25,null))[_0xe299('0xe')](function(_0xb85779){if(_0xb85779){_0x257f00['interaction']=_0xb85779['get']({'plain':!![]});interaction_log[_0xe299('0x14')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x39c29b['user']['id'],_0x39c29b[_0xe299('0x48')][_0xe299('0x21')],_0x39c29b['user'][_0xe299('0x4d')],_0x257f00[_0xe299('0x4e')]['id'],_0x39c29b[_0xe299('0x40')]?JSON['stringify'](_0x39c29b['body']):_0xe299('0x4f'));return respondWithRpcPromise(_0xe299('0x50'),_0xe299('0x51'),_0x257f00);}return null;})[_0xe299('0xe')](function(_0x23336d){var _0x49001a=_0xe299('0x52')+_0x23336d[_0xe299('0x13')][_0xe299('0x53')];return db['sequelize'][_0xe299('0x29')](_0x49001a,{'type':db[_0xe299('0x54')][_0xe299('0x55')][_0xe299('0x56')],'raw':!![]})[_0xe299('0xe')](function(_0x14acad){return _0x14acad;});})[_0xe299('0xe')](function(_0x483569){if(_0x483569){_0x257f00['message'][_0xe299('0x57')]=_0x483569[0x0];if(!_0x39c29b['body'][_0xe299('0x47')])return;return db[_0xe299('0x58')]['find']({'where':{'id':_0x39c29b[_0xe299('0x40')]['UserId'],'role':_0xe299('0x49')},'attributes':['id',_0xe299('0x21'),_0xe299('0x59'),_0xe299('0x5a'),_0xe299('0x5b')],'raw':!![]});}return null;})[_0xe299('0xe')](function(_0x24d176){if(!_0x24d176)return null;_0x257f00[_0xe299('0x13')][_0xe299('0x49')]=_0x24d176;return _0x257f00;})[_0xe299('0xe')](function(_0x48b1aa){if(_0x48b1aa){_0x48b1aa[_0xe299('0x13')][_0xe299('0x5c')]=util['format']('SIP/%s',_0x39c29b[_0xe299('0x48')][_0xe299('0x21')]);_0x48b1aa[_0xe299('0x13')][_0xe299('0x5d')]=_0x257f00[_0xe299('0x5d')];_0x48b1aa[_0xe299('0x13')][_0xe299('0x5e')]=_0x257f00['channel'];_0x48b1aa['message'][_0xe299('0x5f')]=_0xe299('0x46');respondWithRpcPromise(_0xe299('0x60'),'EventManager',{'event':_0xe299('0x61'),'message':_0x48b1aa['message']},client9002);return _0x257f00;}return null;})[_0xe299('0xe')](respondWithResult(_0x176a25,null))[_0xe299('0x16')](handleError(_0x176a25,null));};exports['status']=function(_0x56c017,_0x213036){if(_0x56c017['body']['id']){delete _0x56c017[_0xe299('0x40')]['id'];}var _0x54d8f7;return db[_0xe299('0x24')][_0xe299('0x3e')]({'where':{'id':_0x56c017[_0xe299('0x41')]['id']}})['then'](handleEntityNotFound(_0x213036,null))[_0xe299('0xe')](function(_0x1296a9){if(_0x1296a9){_0x54d8f7=_0x1296a9;return db[_0xe299('0x62')][_0xe299('0x3e')]({'where':{'id':_0x1296a9['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x213036,null))[_0xe299('0xe')](function(_0xfd4c8c){if(_0xfd4c8c){logger['debug'](_0xe299('0x63'),_0xe299('0x1b'),_0xe299('0x64'),_0xfd4c8c[_0xe299('0x26')],util[_0xe299('0x65')](_0x56c017[_0xe299('0x40')],{'showHidden':![],'depth':null}));switch(_0xfd4c8c[_0xe299('0x26')]){case _0xe299('0x66'):if(_0x56c017[_0xe299('0x40')][_0xe299('0x67')]&&_0x56c017[_0xe299('0x40')][_0xe299('0x67')]===_0x54d8f7['messageId']&&_0x56c017[_0xe299('0x40')][_0xe299('0x68')]&&_0x56c017[_0xe299('0x40')][_0xe299('0x68')]===_0xe299('0x69')){return _0x54d8f7[_0xe299('0x1d')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xe299('0x1b'),_0xe299('0x66'),util['inspect'](_0x56c017[_0xe299('0x40')],{'showHidden':![],'depth':null}));}break;}return _0x54d8f7;}})[_0xe299('0xe')](respondWithResult(_0x213036,null))[_0xe299('0x16')](handleError(_0x213036,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 2fa85e6..30bd5e1 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 _0x80df=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update'];(function(_0x2b5d44,_0x2c2aa5){var _0x381b98=function(_0x4d50b6){while(--_0x4d50b6){_0x2b5d44['push'](_0x2b5d44['shift']());}};_0x381b98(++_0x2c2aa5);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xf80d('0x0'));var WhatsappMessage=require(_0xf80d('0x1'))['db'][_0xf80d('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf80d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf80d('0x4'),'afterDestroy':_0xf80d('0x5')};function emitEvent(_0xfd239e){return function(_0x21365c,_0x15d302,_0xa6b1bb){WhatsappMessageEvents[_0xf80d('0x6')](_0xfd239e+':'+_0x21365c['id'],_0x21365c);WhatsappMessageEvents[_0xf80d('0x6')](_0xfd239e,_0x21365c);_0xa6b1bb(null);};}for(var e in events){if(events[_0xf80d('0x7')](e)){var event=events[e];WhatsappMessage[_0xf80d('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x373d=['update','emit','hasOwnProperty','hook','exports','events','WhatsappMessage','setMaxListeners','save'];(function(_0x235d53,_0xd6cf33){var _0x94e7b=function(_0xd2ee8b){while(--_0xd2ee8b){_0x235d53['push'](_0x235d53['shift']());}};_0x94e7b(++_0xd6cf33);}(_0x373d,0x1e2));var _0xd373=function(_0x58926f,_0x4f9633){_0x58926f=_0x58926f-0x0;var _0x19f1fc=_0x373d[_0x58926f];return _0x19f1fc;};'use strict';var EventEmitter=require(_0xd373('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xd373('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd373('0x2')](0x0);var events={'afterCreate':_0xd373('0x3'),'afterUpdate':_0xd373('0x4'),'afterDestroy':'remove'};function emitEvent(_0x151fe9){return function(_0x547fca,_0x2b6e64,_0x598692){WhatsappMessageEvents['emit'](_0x151fe9+':'+_0x547fca['id'],_0x547fca);WhatsappMessageEvents[_0xd373('0x5')](_0x151fe9,_0x547fca);_0x598692(null);};}for(var e in events){if(events[_0xd373('0x6')](e)){var event=events[e];WhatsappMessage[_0xd373('0x7')](e,emitEvent(event));}}module[_0xd373('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c603a25..a424238 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 _0x493d=['secret','isNil','WhatsappInteraction','then','update','createdAt','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','body','Bearer\x20','statuses','message_id','catch','err','WhatsappMessage,\x20%s','finally','utf8mb4','util','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','get','direction','toLowerCase','out'];(function(_0x211c61,_0x5e559e){var _0x20f400=function(_0x12aafb){while(--_0x12aafb){_0x211c61['push'](_0x211c61['shift']());}};_0x20f400(++_0x5e559e);}(_0x493d,0xcd));var _0xd493=function(_0x3ff9bc,_0x51778d){_0x3ff9bc=_0x3ff9bc-0x0;var _0x4017d6=_0x493d[_0x3ff9bc];return _0x4017d6;};'use strict';var _=require('lodash');var util=require(_0xd493('0x0'));var logger=require('../../config/logger')(_0xd493('0x1'));var moment=require(_0xd493('0x2'));var BPromise=require(_0xd493('0x3'));var rp=require(_0xd493('0x4'));var fetch=require(_0xd493('0x5'));var fs=require('fs');var path=require(_0xd493('0x6'));var rimraf=require(_0xd493('0x7'));var config=require(_0xd493('0x8'));var attributes=require(_0xd493('0x9'));module['exports']=function(_0x2ed96a,_0x2c5984){return _0x2ed96a[_0xd493('0xa')](_0xd493('0xb'),attributes,{'tableName':_0xd493('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd493('0xd')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0xd493('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e4cf4,_0x216e5e,_0x4cd7b6){var _0x2fcb18=_0x2ed96a['models'];var _0x2671cd=_0x5e4cf4[_0xd493('0xf')]({'plain':!![]});if(_0x2671cd[_0xd493('0x10')][_0xd493('0x11')]()==='in'||_0x2671cd[_0xd493('0x10')]['toLowerCase']()===_0xd493('0x12')&&!_0x2671cd[_0xd493('0x13')]&&!_[_0xd493('0x14')](_0x2671cd['UserId'])){_0x2fcb18[_0xd493('0x15')]['findOne']({'where':{'id':_0x2671cd['WhatsappInteractionId']}})[_0xd493('0x16')](function(_0x6ea456){if(_0x6ea456){_0x6ea456[_0xd493('0x17')]({'lastMsgAt':_0x2671cd[_0xd493('0x18')],'lastMsgDirection':_0x2671cd[_0xd493('0x10')][_0xd493('0x11')]()});}})['catch'](function(_0x1add45){console['error'](_0x1add45);});}if(_0x2671cd[_0xd493('0x10')]===_0xd493('0x12')&&!_0x2671cd[_0xd493('0x13')]){var _0x29709b;_0x2fcb18['WhatsappAccount'][_0xd493('0x19')]({'where':{'id':_0x2671cd[_0xd493('0x1a')]},'raw':!![]})[_0xd493('0x16')](function(_0x516a75){_0x29709b=_0x516a75;if(_0x29709b&&_0x29709b['type']){switch(_0x29709b[_0xd493('0x1b')]){case _0xd493('0x1c'):var _0x5b49e6=require(_0xd493('0x1c'));if(_0x29709b['accountSid']&&_0x29709b[_0xd493('0x1d')]&&_0x29709b[_0xd493('0x1e')]){var _0x54db13=new _0x5b49e6(_0x29709b[_0xd493('0x1f')],_0x29709b['authToken']);_0x54db13[_0xd493('0x20')][_0xd493('0x21')]({'body':_0x2671cd['body'],'to':_0xd493('0x22')+_0x2671cd[_0xd493('0x1e')],'from':_0xd493('0x22')+_0x29709b['phone'],'statusCallback':_0x29709b['remote']+'/api/whatsapp/messages/'+_0x2671cd['id']+_0xd493('0x23')+_0x29709b[_0xd493('0x24')]})[_0xd493('0x16')](function(_0x18c64a){if(_0x18c64a['sid']){return _0x5e4cf4[_0xd493('0x17')]({'messageId':_0x18c64a[_0xd493('0x25')]});}})['catch'](function(_0x40a47c){logger[_0xd493('0x26')](_0xd493('0x27'),_0xd493('0x28'),_0xd493('0x1c'),util['inspect'](_0x40a47c,{'showHidden':![],'depth':null}));});}else{logger[_0xd493('0x26')](_0xd493('0x27'),_0xd493('0x28'),_0xd493('0x1c'),_0xd493('0x29'));}break;case _0xd493('0x2a'):var _0x594132=_0x29709b[_0xd493('0x1f')];var _0x5a6a28=_0x29709b[_0xd493('0x1d')];var _0x4eb4da=_0x29709b[_0xd493('0x2b')]+_0xd493('0x2c')+_0x594132+_0xd493('0x2d');var _0x717289={'to':[_0x2671cd[_0xd493('0x1e')]],'message':{'type':_0xd493('0x2e'),'text':_0x2671cd[_0xd493('0x2f')]}};var _0xce27af={'method':'POST','uri':_0x4eb4da,'headers':{'Authorization':_0xd493('0x30')+_0x5a6a28,'Content-Type':'application/json'},'body':_0x717289,'json':!![]};rp(_0xce27af)[_0xd493('0x16')](function(_0x5c369d){if(_0x5c369d[_0xd493('0x31')][0x0][_0xd493('0x32')]){return _0x5e4cf4[_0xd493('0x17')]({'messageId':_0x5c369d[_0xd493('0x31')][0x0]['message_id']});}})[_0xd493('0x33')](function(_0x35c5c3){logger[_0xd493('0x34')](_0xd493('0x35'),_0x35c5c3);});break;}}})[_0xd493('0x36')](function(){_0x4cd7b6();});}else{_0x4cd7b6();}}},'charset':_0xd493('0x37'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf3cc=['node-fetch','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','isNil','WhatsappInteractionId','update','catch','error','secret','WhatsappAccount','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','/whatsapp/v1/','/messages/','POST','application/json','message_id','statuses','err','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x38ecda,_0x3b551e){_0x38ecda=_0x38ecda-0x0;var _0x3fa8f3=_0xf3cc[_0x38ecda];return _0x3fa8f3;};'use strict';var _=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var logger=require(_0xcf3c('0x2'))(_0xcf3c('0x3'));var moment=require('moment');var BPromise=require(_0xcf3c('0x4'));var rp=require(_0xcf3c('0x5'));var fetch=require(_0xcf3c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf3c('0x7'));var config=require(_0xcf3c('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0xcf3c('0x9')]=function(_0x2b5cae,_0x35cb18){return _0x2b5cae[_0xcf3c('0xa')](_0xcf3c('0xb'),attributes,{'tableName':_0xcf3c('0xc'),'paranoid':![],'indexes':[{'name':_0xcf3c('0xd'),'fields':[_0xcf3c('0xd')]},{'name':_0xcf3c('0xe'),'fields':[_0xcf3c('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x58fe7b,_0x2c2b70,_0xd4d142){var _0x3022f2=_0x2b5cae[_0xcf3c('0x10')];var _0x46e82c=_0x58fe7b[_0xcf3c('0x11')]({'plain':!![]});if(_0x46e82c[_0xcf3c('0x12')][_0xcf3c('0x13')]()==='in'||_0x46e82c['direction'][_0xcf3c('0x13')]()===_0xcf3c('0x14')&&!_0x46e82c['secret']&&!_[_0xcf3c('0x15')](_0x46e82c['UserId'])){_0x3022f2['WhatsappInteraction']['findOne']({'where':{'id':_0x46e82c[_0xcf3c('0x16')]}})['then'](function(_0x2f387b){if(_0x2f387b){_0x2f387b[_0xcf3c('0x17')]({'lastMsgAt':_0x46e82c['createdAt'],'lastMsgDirection':_0x46e82c[_0xcf3c('0x12')]['toLowerCase']()});}})[_0xcf3c('0x18')](function(_0x1db425){console[_0xcf3c('0x19')](_0x1db425);});}if(_0x46e82c['direction']===_0xcf3c('0x14')&&!_0x46e82c[_0xcf3c('0x1a')]){var _0x395159;_0x3022f2[_0xcf3c('0x1b')]['find']({'where':{'id':_0x46e82c[_0xcf3c('0x1c')]},'raw':!![]})[_0xcf3c('0x1d')](function(_0x25ebf3){_0x395159=_0x25ebf3;if(_0x395159&&_0x395159[_0xcf3c('0x1e')]){switch(_0x395159[_0xcf3c('0x1e')]){case _0xcf3c('0x1f'):var _0xf22c4e=require(_0xcf3c('0x1f'));if(_0x395159[_0xcf3c('0x20')]&&_0x395159[_0xcf3c('0x21')]&&_0x395159[_0xcf3c('0x22')]){var _0x15e346=new _0xf22c4e(_0x395159['accountSid'],_0x395159[_0xcf3c('0x21')]);_0x15e346['messages'][_0xcf3c('0x23')]({'body':_0x46e82c[_0xcf3c('0xf')],'to':'whatsapp:'+_0x46e82c[_0xcf3c('0x22')],'from':_0xcf3c('0x24')+_0x395159[_0xcf3c('0x22')],'statusCallback':_0x395159[_0xcf3c('0x25')]+_0xcf3c('0x26')+_0x46e82c['id']+_0xcf3c('0x27')+_0x395159[_0xcf3c('0x28')]})[_0xcf3c('0x1d')](function(_0x58b8e5){if(_0x58b8e5[_0xcf3c('0x29')]){return _0x58fe7b['update']({'messageId':_0x58b8e5[_0xcf3c('0x29')]});}})[_0xcf3c('0x18')](function(_0x42ce14){logger[_0xcf3c('0x19')](_0xcf3c('0x2a'),_0xcf3c('0x2b'),'twilio',util[_0xcf3c('0x2c')](_0x42ce14,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcf3c('0x2a'),_0xcf3c('0x2b'),_0xcf3c('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xcf3c('0x2d'):var _0x54174a=_0x395159[_0xcf3c('0x20')];var _0xe22e99=_0x395159[_0xcf3c('0x21')];var _0x5bdae3=_0x395159['baseUrl']+_0xcf3c('0x2e')+_0x54174a+_0xcf3c('0x2f');var _0x1f53ee={'to':[_0x46e82c[_0xcf3c('0x22')]],'message':{'type':'text','text':_0x46e82c[_0xcf3c('0xf')]}};var _0x2cf47e={'method':_0xcf3c('0x30'),'uri':_0x5bdae3,'headers':{'Authorization':'Bearer\x20'+_0xe22e99,'Content-Type':_0xcf3c('0x31')},'body':_0x1f53ee,'json':!![]};rp(_0x2cf47e)[_0xcf3c('0x1d')](function(_0x196b02){if(_0x196b02['statuses'][0x0][_0xcf3c('0x32')]){return _0x58fe7b[_0xcf3c('0x17')]({'messageId':_0x196b02[_0xcf3c('0x33')][0x0][_0xcf3c('0x32')]});}})[_0xcf3c('0x18')](function(_0x534f56){logger[_0xcf3c('0x34')]('WhatsappMessage,\x20%s',_0x534f56);});break;}}})[_0xcf3c('0x35')](function(){_0xd4d142();});}else{_0xd4d142();}}},'charset':'utf8mb4','collate':_0xcf3c('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 1e6801e..3d395f6 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 _0x1b8a=['WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappMessage','create','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0x1b8a,0xcd));var _0xa1b8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1b8a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa1b8('0x0'));var util=require(_0xa1b8('0x1'));var moment=require(_0xa1b8('0x2'));var BPromise=require(_0xa1b8('0x3'));var rs=require(_0xa1b8('0x4'));var fs=require('fs');var Redis=require(_0xa1b8('0x5'));var db=require(_0xa1b8('0x6'))['db'];var utils=require(_0xa1b8('0x7'));var logger=require('../../config/logger')(_0xa1b8('0x8'));var config=require(_0xa1b8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa1b8('0xa')][_0xa1b8('0xb')]({'port':0x232a});config[_0xa1b8('0xc')]=_['defaults'](config[_0xa1b8('0xc')],{'host':_0xa1b8('0xd'),'port':0x18eb});var socket=require(_0xa1b8('0xe'))(new Redis(config[_0xa1b8('0xc')]));require(_0xa1b8('0xf'))[_0xa1b8('0x10')](socket);function respondWithRpcPromise(_0x42e12b,_0x5afae8,_0x300000){return new BPromise(function(_0xb982be,_0x36371b){return client['request'](_0x42e12b,_0x300000)[_0xa1b8('0x11')](function(_0x7224d3){logger[_0xa1b8('0x12')](_0xa1b8('0x13'),_0x5afae8,_0xa1b8('0x14'));logger[_0xa1b8('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5afae8,_0xa1b8('0x14'),JSON[_0xa1b8('0x16')](_0x7224d3));if(_0x7224d3[_0xa1b8('0x17')]){if(_0x7224d3[_0xa1b8('0x17')][_0xa1b8('0x18')]===0x1f4){logger[_0xa1b8('0x17')](_0xa1b8('0x13'),_0x5afae8,_0x7224d3[_0xa1b8('0x17')][_0xa1b8('0x19')]);return _0x36371b(_0x7224d3[_0xa1b8('0x17')][_0xa1b8('0x19')]);}logger[_0xa1b8('0x17')](_0xa1b8('0x13'),_0x5afae8,_0x7224d3[_0xa1b8('0x17')][_0xa1b8('0x19')]);return _0xb982be(_0x7224d3['error'][_0xa1b8('0x19')]);}else{logger[_0xa1b8('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x5afae8,'request\x20sent');_0xb982be(_0x7224d3[_0xa1b8('0x1a')]['message']);}})['catch'](function(_0x1782c5){logger[_0xa1b8('0x17')](_0xa1b8('0x13'),_0x5afae8,_0x1782c5);_0x36371b(_0x1782c5);});});}exports[_0xa1b8('0x1b')]=function(_0x3f5bfd){var _0x360903=this;return new Promise(function(_0x362931,_0x590623){return db['WhatsappMessage'][_0xa1b8('0x1c')](_0x3f5bfd['body'],{'raw':_0x3f5bfd['options']?_0x3f5bfd[_0xa1b8('0x1d')][_0xa1b8('0x1e')]===undefined?!![]:![]:!![]})[_0xa1b8('0x11')](function(_0x4492fe){logger[_0xa1b8('0x12')](_0xa1b8('0x1b'),_0x3f5bfd);logger[_0xa1b8('0x15')](_0xa1b8('0x1b'),_0x3f5bfd,JSON[_0xa1b8('0x16')](_0x4492fe));_0x362931(_0x4492fe);})[_0xa1b8('0x1f')](function(_0x5e6cda){logger['error'](_0xa1b8('0x1b'),_0x5e6cda['message'],_0x3f5bfd);_0x590623(_0x360903[_0xa1b8('0x17')](0x1f4,_0x5e6cda[_0xa1b8('0x19')]));});});}; \ No newline at end of file +var _0x43d0=['request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./whatsappMessage.socket','register'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0x43d0,0x1ab));var _0x043d=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0x43d0[_0x3725ee];return _0x399c71;};'use strict';var _=require(_0x043d('0x0'));var util=require('util');var moment=require(_0x043d('0x1'));var BPromise=require(_0x043d('0x2'));var rs=require(_0x043d('0x3'));var fs=require('fs');var Redis=require(_0x043d('0x4'));var db=require(_0x043d('0x5'))['db'];var utils=require(_0x043d('0x6'));var logger=require('../../config/logger')(_0x043d('0x7'));var config=require(_0x043d('0x8'));var jayson=require(_0x043d('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x043d('0xa')]=_[_0x043d('0xb')](config[_0x043d('0xa')],{'host':_0x043d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x043d('0xa')]));require(_0x043d('0xd'))[_0x043d('0xe')](socket);function respondWithRpcPromise(_0xcc04d,_0x461ec3,_0x4ba9c5){return new BPromise(function(_0x33a3bb,_0x13057f){return client[_0x043d('0xf')](_0xcc04d,_0x4ba9c5)[_0x043d('0x10')](function(_0x2a8e4b){logger[_0x043d('0x11')](_0x043d('0x12'),_0x461ec3,_0x043d('0x13'));logger['debug'](_0x043d('0x14'),_0x461ec3,_0x043d('0x13'),JSON[_0x043d('0x15')](_0x2a8e4b));if(_0x2a8e4b[_0x043d('0x16')]){if(_0x2a8e4b[_0x043d('0x16')][_0x043d('0x17')]===0x1f4){logger[_0x043d('0x16')](_0x043d('0x12'),_0x461ec3,_0x2a8e4b[_0x043d('0x16')][_0x043d('0x18')]);return _0x13057f(_0x2a8e4b[_0x043d('0x16')][_0x043d('0x18')]);}logger['error'](_0x043d('0x12'),_0x461ec3,_0x2a8e4b[_0x043d('0x16')][_0x043d('0x18')]);return _0x33a3bb(_0x2a8e4b[_0x043d('0x16')]['message']);}else{logger[_0x043d('0x11')](_0x043d('0x12'),_0x461ec3,_0x043d('0x13'));_0x33a3bb(_0x2a8e4b[_0x043d('0x19')][_0x043d('0x18')]);}})[_0x043d('0x1a')](function(_0x4dd5fd){logger[_0x043d('0x16')](_0x043d('0x12'),_0x461ec3,_0x4dd5fd);_0x13057f(_0x4dd5fd);});});}exports[_0x043d('0x1b')]=function(_0xefdef9){var _0x11cd70=this;return new Promise(function(_0x21c58d,_0x152ad1){return db[_0x043d('0x1c')][_0x043d('0x1d')](_0xefdef9[_0x043d('0x1e')],{'raw':_0xefdef9[_0x043d('0x1f')]?_0xefdef9[_0x043d('0x1f')][_0x043d('0x20')]===undefined?!![]:![]:!![]})[_0x043d('0x10')](function(_0x3f13c0){logger[_0x043d('0x11')]('CreateWhatsappMessage',_0xefdef9);logger[_0x043d('0x21')](_0x043d('0x1b'),_0xefdef9,JSON[_0x043d('0x15')](_0x3f13c0));_0x21c58d(_0x3f13c0);})[_0x043d('0x1a')](function(_0x34b71c){logger[_0x043d('0x16')](_0x043d('0x1b'),_0x34b71c[_0x043d('0x18')],_0xefdef9);_0x152ad1(_0x11cd70[_0x043d('0x16')](0x1f4,_0x34b71c[_0x043d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index c44a548..3f14535 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 _0xa5b6=['length','whatsappMessage:','./whatsappMessage.events','emit','removeListener','register'];(function(_0x398cb9,_0x248897){var _0x1ada14=function(_0xeb5c5a){while(--_0xeb5c5a){_0x398cb9['push'](_0x398cb9['shift']());}};_0x1ada14(++_0x248897);}(_0xa5b6,0x146));var _0x6a5b=function(_0x1073ad,_0x44bf0b){_0x1073ad=_0x1073ad-0x0;var _0x528474=_0xa5b6[_0x1073ad];return _0x528474;};'use strict';var WhatsappMessageEvents=require(_0x6a5b('0x0'));var events=['save','remove','update'];function createListener(_0x2226e6,_0x3afad5){return function(_0x44d9b4){_0x3afad5[_0x6a5b('0x1')](_0x2226e6,_0x44d9b4);};}function removeListener(_0x2de51d,_0x826a8d){return function(){WhatsappMessageEvents[_0x6a5b('0x2')](_0x2de51d,_0x826a8d);};}exports[_0x6a5b('0x3')]=function(_0x3531e3){for(var _0x53a918=0x0,_0x531222=events[_0x6a5b('0x4')];_0x53a918<_0x531222;_0x53a918++){var _0x52f9a1=events[_0x53a918];var _0x16fe01=createListener(_0x6a5b('0x5')+_0x52f9a1,_0x3531e3);WhatsappMessageEvents['on'](_0x52f9a1,_0x16fe01);}}; \ No newline at end of file +var _0x327c=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x5481c0,_0x6a415c){var _0x1046d3=function(_0x1300f4){while(--_0x1300f4){_0x5481c0['push'](_0x5481c0['shift']());}};_0x1046d3(++_0x6a415c);}(_0x327c,0xff));var _0xc327=function(_0x5a1256,_0x43e77b){_0x5a1256=_0x5a1256-0x0;var _0x2057be=_0x327c[_0x5a1256];return _0x2057be;};'use strict';var WhatsappMessageEvents=require(_0xc327('0x0'));var events=[_0xc327('0x1'),_0xc327('0x2'),_0xc327('0x3')];function createListener(_0x4e34db,_0x40f373){return function(_0x3666f2){_0x40f373[_0xc327('0x4')](_0x4e34db,_0x3666f2);};}function removeListener(_0x2674d1,_0x5c482e){return function(){WhatsappMessageEvents[_0xc327('0x5')](_0x2674d1,_0x5c482e);};}exports[_0xc327('0x6')]=function(_0x419b4b){for(var _0x69fdb8=0x0,_0x470798=events[_0xc327('0x7')];_0x69fdb8<_0x470798;_0x69fdb8++){var _0x133959=events[_0x69fdb8];var _0x2d38c3=createListener(_0xc327('0x8')+_0x133959,_0x419b4b);WhatsappMessageEvents['on'](_0x133959,_0x2d38c3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 9104c3c..6aeb5fa 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 _0x09be=['index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated'];(function(_0x7dbc76,_0x64f22d){var _0x3c0ec7=function(_0x4bf00c){while(--_0x4bf00c){_0x7dbc76['push'](_0x7dbc76['shift']());}};_0x3c0ec7(++_0x64f22d);}(_0x09be,0x1cb));var _0xe09b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09be[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe09b('0x0'));var timeout=require(_0xe09b('0x1'));var express=require(_0xe09b('0x2'));var router=express[_0xe09b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe09b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe09b('0x5'));var controller=require(_0xe09b('0x6'));router[_0xe09b('0x7')]('/',auth[_0xe09b('0x8')](),controller[_0xe09b('0x9')]);router['get'](_0xe09b('0xa'),auth['isAuthenticated'](),controller[_0xe09b('0xb')]);router['get'](_0xe09b('0xc'),auth[_0xe09b('0x8')](),controller['show']);router[_0xe09b('0x7')](_0xe09b('0xd'),auth[_0xe09b('0x8')](),controller['getMembers']);router['get'](_0xe09b('0xe'),auth[_0xe09b('0x8')](),controller[_0xe09b('0xf')]);router[_0xe09b('0x7')](_0xe09b('0x10'),auth[_0xe09b('0x8')](),controller[_0xe09b('0x11')]);router[_0xe09b('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe09b('0x12')](_0xe09b('0xe'),auth[_0xe09b('0x8')](),controller[_0xe09b('0x13')]);router['post'](_0xe09b('0x10'),auth[_0xe09b('0x8')](),controller[_0xe09b('0x14')]);router['put'](_0xe09b('0xc'),auth[_0xe09b('0x8')](),controller[_0xe09b('0x15')]);router[_0xe09b('0x16')](_0xe09b('0xc'),auth[_0xe09b('0x8')](),controller[_0xe09b('0x17')]);router[_0xe09b('0x16')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xe09b('0x16')](_0xe09b('0x10'),auth['isAuthenticated'](),controller[_0xe09b('0x18')]);module[_0xe09b('0x19')]=router; \ No newline at end of file +var _0xcaf5=['getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x3b4054,_0x396c72){var _0x1b9722=function(_0xbdf315){while(--_0xbdf315){_0x3b4054['push'](_0x3b4054['shift']());}};_0x1b9722(++_0x396c72);}(_0xcaf5,0xa8));var _0x5caf=function(_0x2e7dae,_0x404f90){_0x2e7dae=_0x2e7dae-0x0;var _0x178c6d=_0xcaf5[_0x2e7dae];return _0x178c6d;};'use strict';var multer=require(_0x5caf('0x0'));var util=require(_0x5caf('0x1'));var path=require(_0x5caf('0x2'));var timeout=require(_0x5caf('0x3'));var express=require(_0x5caf('0x4'));var router=express['Router']();var fs_extra=require(_0x5caf('0x5'));var auth=require(_0x5caf('0x6'));var interaction=require(_0x5caf('0x7'));var config=require(_0x5caf('0x8'));var controller=require('./whatsappQueue.controller');router[_0x5caf('0x9')]('/',auth[_0x5caf('0xa')](),controller['index']);router['get'](_0x5caf('0xb'),auth[_0x5caf('0xa')](),controller[_0x5caf('0xc')]);router[_0x5caf('0x9')](_0x5caf('0xd'),auth[_0x5caf('0xa')](),controller[_0x5caf('0xe')]);router[_0x5caf('0x9')](_0x5caf('0xf'),auth[_0x5caf('0xa')](),controller[_0x5caf('0x10')]);router[_0x5caf('0x9')](_0x5caf('0x11'),auth[_0x5caf('0xa')](),controller[_0x5caf('0x12')]);router['get'](_0x5caf('0x13'),auth[_0x5caf('0xa')](),controller[_0x5caf('0x14')]);router[_0x5caf('0x15')]('/',auth[_0x5caf('0xa')](),controller[_0x5caf('0x16')]);router[_0x5caf('0x15')]('/:id/teams',auth[_0x5caf('0xa')](),controller[_0x5caf('0x17')]);router[_0x5caf('0x15')]('/:id/users',auth[_0x5caf('0xa')](),controller[_0x5caf('0x18')]);router[_0x5caf('0x19')]('/:id',auth[_0x5caf('0xa')](),controller[_0x5caf('0x1a')]);router[_0x5caf('0x1b')](_0x5caf('0xd'),auth[_0x5caf('0xa')](),controller[_0x5caf('0x1c')]);router[_0x5caf('0x1b')]('/:id/teams',auth[_0x5caf('0xa')](),controller['removeTeams']);router['delete'](_0x5caf('0x13'),auth[_0x5caf('0xa')](),controller[_0x5caf('0x1d')]);module[_0x5caf('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 9ab881d..88ad4eb 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 _0xf874=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1f3b7d,_0x36b4d1){var _0x1d356b=function(_0x329898){while(--_0x329898){_0x1f3b7d['push'](_0x1f3b7d['shift']());}};_0x1d356b(++_0x36b4d1);}(_0xf874,0x177));var _0x4f87=function(_0x558686,_0x57bd81){_0x558686=_0x558686-0x0;var _0x4b0393=_0xf874[_0x558686];return _0x4b0393;};'use strict';var Sequelize=require(_0x4f87('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f87('0x1')],'unique':_0x4f87('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4f87('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4f87('0x4')](_0x4f87('0x5'),_0x4f87('0x6'),_0x4f87('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b02=['exports','STRING','name','rrmemory','roundrobin','sequelize'];(function(_0x16c5e1,_0x17b81c){var _0x354f29=function(_0x2d517e){while(--_0x2d517e){_0x16c5e1['push'](_0x16c5e1['shift']());}};_0x354f29(++_0x17b81c);}(_0x5b02,0xe9));var _0x25b0=function(_0x93187e,_0x2f60cb){_0x93187e=_0x93187e-0x0;var _0x15b88e=_0x5b02[_0x93187e];return _0x15b88e;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'name':{'type':Sequelize[_0x25b0('0x2')],'unique':_0x25b0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x25b0('0x4'),'beepall',_0x25b0('0x5'))},'description':{'type':Sequelize[_0x25b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index c0697c1..66b9b31 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 _0x7fda=['Content-Range','then','destroy','get','WhatsappQueues','sendStatus','stack','name','index','map','WhatsappQueue','fieldName','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','rawAttributes','filters','model','attributes','intersection','fields','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','User','findAndCountAll','agent','createdAt','format','%s/%s','whatsappPause','pick','filter','getTeams','length','addTeams','ids','Team','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','end','status','json','offset','undefined','limit','count','set'];(function(_0x21f089,_0x5ebacd){var _0x59c5e7=function(_0x2af336){while(--_0x2af336){_0x21f089['push'](_0x21f089['shift']());}};_0x59c5e7(++_0x5ebacd);}(_0x7fda,0xdb));var _0xa7fd=function(_0x20e33d,_0x524edd){_0x20e33d=_0x20e33d-0x0;var _0x444e99=_0x7fda[_0x20e33d];return _0x444e99;};'use strict';var BPromise=require(_0xa7fd('0x0'));var util=require(_0xa7fd('0x1'));var _=require(_0xa7fd('0x2'));var squel=require('squel');var Redis=require(_0xa7fd('0x3'));var qs=require(_0xa7fd('0x4'));var logger=require(_0xa7fd('0x5'))(_0xa7fd('0x6'));var config=require(_0xa7fd('0x7'));var db=require(_0xa7fd('0x8'))['db'];config[_0xa7fd('0x9')]=_['defaults'](config[_0xa7fd('0x9')],{'host':_0xa7fd('0xa'),'port':0x18eb});var socket=require(_0xa7fd('0xb'))(new Redis(config[_0xa7fd('0x9')]));require(_0xa7fd('0xc'))['register'](socket);function respondWithStatusCode(_0x50203b,_0x1001c5){_0x1001c5=_0x1001c5||0xcc;return function(_0xf9c08d){if(_0xf9c08d){return _0x50203b['sendStatus'](_0x1001c5);}return _0x50203b['status'](_0x1001c5)[_0xa7fd('0xd')]();};}function respondWithResult(_0x21f5eb,_0x20e761){_0x20e761=_0x20e761||0xc8;return function(_0x379709){if(_0x379709){return _0x21f5eb[_0xa7fd('0xe')](_0x20e761)[_0xa7fd('0xf')](_0x379709);}};}function respondWithFilteredResult(_0x17e73c,_0x32bab3){return function(_0x6381e7){if(_0x6381e7){var _0x5553dd=typeof _0x32bab3[_0xa7fd('0x10')]===_0xa7fd('0x11')&&typeof _0x32bab3[_0xa7fd('0x12')]===_0xa7fd('0x11');var _0x2af927=_0x6381e7[_0xa7fd('0x13')];var _0x42dbd8=_0x5553dd?0x0:_0x32bab3[_0xa7fd('0x10')];var _0x217f58=_0x5553dd?_0x6381e7[_0xa7fd('0x13')]:_0x32bab3['offset']+_0x32bab3[_0xa7fd('0x12')];var _0x11b472;if(_0x217f58>=_0x2af927){_0x217f58=_0x2af927;_0x11b472=0xc8;}else{_0x11b472=0xce;}_0x17e73c['status'](_0x11b472);return _0x17e73c[_0xa7fd('0x14')](_0xa7fd('0x15'),_0x42dbd8+'-'+_0x217f58+'/'+_0x2af927)[_0xa7fd('0xf')](_0x6381e7);}return null;};}function saveUpdates(_0x489a00){return function(_0x36557f){if(_0x36557f){return _0x36557f['update'](_0x489a00)[_0xa7fd('0x16')](function(_0x40f206){return _0x40f206;});}return null;};}function removeEntity(_0x5588c0){return function(_0x371e9c){if(_0x371e9c){return _0x371e9c[_0xa7fd('0x17')]()[_0xa7fd('0x16')](function(){var _0x13cf01=_0x371e9c[_0xa7fd('0x18')]({'plain':!![]});var _0x19c040=_0xa7fd('0x19');return db['UserProfileResource'][_0xa7fd('0x17')]({'where':{'type':_0x19c040,'resourceId':_0x13cf01['id']}})[_0xa7fd('0x16')](function(){return _0x371e9c;});})[_0xa7fd('0x16')](function(){_0x5588c0[_0xa7fd('0xe')](0xcc)[_0xa7fd('0xd')]();});}};}function handleEntityNotFound(_0x182c2d){return function(_0x599508){if(!_0x599508){_0x182c2d[_0xa7fd('0x1a')](0x194);}return _0x599508;};}function handleError(_0x9b15bb,_0x3e0457){_0x3e0457=_0x3e0457||0x1f4;return function(_0x2deb51){logger['error'](_0x2deb51[_0xa7fd('0x1b')]);if(_0x2deb51[_0xa7fd('0x1c')]){delete _0x2deb51[_0xa7fd('0x1c')];}_0x9b15bb[_0xa7fd('0xe')](_0x3e0457)['send'](_0x2deb51);};}exports[_0xa7fd('0x1d')]=function(_0x343d32,_0x130fd5){var _0x1fc833={};var _0x402af1={'count':0x0,'rows':[]};var _0x46ed7b=_[_0xa7fd('0x1e')](db[_0xa7fd('0x1f')]['rawAttributes'],function(_0x3f303a){return{'name':_0x3f303a[_0xa7fd('0x20')],'type':_0x3f303a['type'][_0xa7fd('0x21')]};});_0x1fc833=qs[_0xa7fd('0x22')](_0x46ed7b,_0x343d32);var _0x1cee3b={'where':_0x1fc833[_0xa7fd('0x23')]};return db[_0xa7fd('0x1f')][_0xa7fd('0x13')](_0x1cee3b)[_0xa7fd('0x16')](function(_0x102963){_0x402af1[_0xa7fd('0x13')]=_0x102963;_0x1fc833[_0xa7fd('0x24')]=qs[_0xa7fd('0x24')](_0x343d32[_0xa7fd('0x25')]);return db[_0xa7fd('0x1f')][_0xa7fd('0x26')](_0x1fc833);})[_0xa7fd('0x16')](function(_0x59c099){_0x402af1[_0xa7fd('0x27')]=_0x59c099;return _0x402af1;})['then'](respondWithFilteredResult(_0x130fd5,_0x1fc833))[_0xa7fd('0x28')](handleError(_0x130fd5,null));};exports[_0xa7fd('0x29')]=function(_0x562f39,_0x1b5909){var _0x1265d5={'raw':!![],'where':{'id':_0x562f39[_0xa7fd('0x2a')]['id']}},_0xd9eff={};_0xd9eff['model']=_[_0xa7fd('0x2b')](db[_0xa7fd('0x1f')][_0xa7fd('0x2c')]);_0xd9eff[_0xa7fd('0x25')]=_[_0xa7fd('0x2b')](_0x562f39[_0xa7fd('0x25')]);_0xd9eff[_0xa7fd('0x2d')]=_['intersection'](_0xd9eff[_0xa7fd('0x2e')],_0xd9eff['query']);_0x1265d5[_0xa7fd('0x2f')]=_[_0xa7fd('0x30')](_0xd9eff[_0xa7fd('0x2e')],qs['fields'](_0x562f39['query'][_0xa7fd('0x31')]));_0x1265d5['attributes']=_0x1265d5[_0xa7fd('0x2f')]['length']?_0x1265d5['attributes']:_0xd9eff[_0xa7fd('0x2e')];if(_0x562f39['query']['includeAll']){_0x1265d5[_0xa7fd('0x24')]=[{'all':!![]}];}_0x1265d5=_[_0xa7fd('0x32')]({},_0x1265d5,_0x562f39[_0xa7fd('0x33')]);return db[_0xa7fd('0x1f')]['find'](_0x1265d5)[_0xa7fd('0x16')](handleEntityNotFound(_0x1b5909,null))['then'](respondWithResult(_0x1b5909,null))['catch'](handleError(_0x1b5909,null));};exports['create']=function(_0x3fc782,_0x4cb902){return db[_0xa7fd('0x1f')][_0xa7fd('0x34')](_0x3fc782[_0xa7fd('0x35')],{})[_0xa7fd('0x16')](function(_0x1b0d16){var _0x463e2c=_0x3fc782[_0xa7fd('0x36')][_0xa7fd('0x18')]({'plain':!![]});if(!_0x463e2c)throw new Error(_0xa7fd('0x37'));if(_0x463e2c[_0xa7fd('0x38')]===_0xa7fd('0x36')){var _0x5cded9=_0x1b0d16['get']({'plain':!![]});var _0x10bc5a='WhatsappQueues';return db[_0xa7fd('0x39')][_0xa7fd('0x3a')]({'where':{'name':_0x10bc5a,'userProfileId':_0x463e2c[_0xa7fd('0x3b')]},'raw':!![]})[_0xa7fd('0x16')](function(_0xdbcad1){if(_0xdbcad1&&_0xdbcad1[_0xa7fd('0x3c')]===0x0){return db[_0xa7fd('0x3d')][_0xa7fd('0x34')]({'name':_0x5cded9['name'],'resourceId':_0x5cded9['id'],'type':_0xdbcad1[_0xa7fd('0x1c')],'sectionId':_0xdbcad1['id']},{})[_0xa7fd('0x16')](function(){return _0x1b0d16;});}else{return _0x1b0d16;}})['catch'](function(_0x45be97){logger['error'](_0xa7fd('0x3e'),_0x45be97);throw _0x45be97;});}return _0x1b0d16;})[_0xa7fd('0x16')](respondWithResult(_0x4cb902,0xc9))[_0xa7fd('0x28')](handleError(_0x4cb902,null));};exports[_0xa7fd('0x3f')]=function(_0x37c434,_0xd03501){if(_0x37c434[_0xa7fd('0x35')]['id']){delete _0x37c434[_0xa7fd('0x35')]['id'];}return db[_0xa7fd('0x1f')]['find']({'where':{'id':_0x37c434[_0xa7fd('0x2a')]['id']}})['then'](handleEntityNotFound(_0xd03501,null))[_0xa7fd('0x16')](saveUpdates(_0x37c434[_0xa7fd('0x35')],null))[_0xa7fd('0x16')](respondWithResult(_0xd03501,null))[_0xa7fd('0x28')](handleError(_0xd03501,null));};exports[_0xa7fd('0x17')]=function(_0xac5c27,_0x56d3f5){return db[_0xa7fd('0x1f')][_0xa7fd('0x3a')]({'where':{'id':_0xac5c27[_0xa7fd('0x2a')]['id']}})[_0xa7fd('0x16')](handleEntityNotFound(_0x56d3f5,null))['then'](removeEntity(_0x56d3f5,null))[_0xa7fd('0x28')](handleError(_0x56d3f5,null));};exports[_0xa7fd('0x40')]=function(_0x19bac2,_0x35d63b){return db[_0xa7fd('0x1f')][_0xa7fd('0x40')]()[_0xa7fd('0x16')](respondWithResult(_0x35d63b,null))[_0xa7fd('0x28')](handleError(_0x35d63b,null));};exports[_0xa7fd('0x41')]=function(_0xb78172,_0x586ba5){var _0x3dd152={'raw':!![],'where':{}},_0x1b27fb={},_0x3573d3;return db[_0xa7fd('0x1f')][_0xa7fd('0x42')]({'where':{'id':_0xb78172[_0xa7fd('0x2a')]['id']}})[_0xa7fd('0x16')](handleEntityNotFound(_0x586ba5,null))[_0xa7fd('0x16')](function(_0x3424ca){if(_0x3424ca){_0x3573d3=_0x3424ca[_0xa7fd('0x18')]({'plain':!![]});_0x1b27fb[_0xa7fd('0x2e')]=_[_0xa7fd('0x2b')](db[_0xa7fd('0x43')]['rawAttributes']);_0x1b27fb[_0xa7fd('0x25')]=_[_0xa7fd('0x2b')](_0xb78172[_0xa7fd('0x25')]);_0x1b27fb[_0xa7fd('0x2d')]=_[_0xa7fd('0x30')](_0x1b27fb[_0xa7fd('0x2e')],_0x1b27fb[_0xa7fd('0x25')]);_0x3dd152[_0xa7fd('0x2f')]=_[_0xa7fd('0x30')](_0x1b27fb['model'],qs[_0xa7fd('0x31')](_0xb78172[_0xa7fd('0x25')][_0xa7fd('0x31')]));_0x3dd152[_0xa7fd('0x2f')]=_0x3dd152[_0xa7fd('0x2f')]['length']?_0x3dd152[_0xa7fd('0x2f')]:_0x1b27fb[_0xa7fd('0x2e')];if(!_0xb78172[_0xa7fd('0x25')][_0xa7fd('0x44')](_0xa7fd('0x45'))){_0x3dd152[_0xa7fd('0x12')]=qs['limit'](_0xb78172[_0xa7fd('0x25')][_0xa7fd('0x12')]);_0x3dd152[_0xa7fd('0x10')]=qs[_0xa7fd('0x10')](_0xb78172[_0xa7fd('0x25')][_0xa7fd('0x10')]);}_0x3dd152[_0xa7fd('0x46')]=qs[_0xa7fd('0x47')](_0xb78172[_0xa7fd('0x25')][_0xa7fd('0x47')]);_0x3dd152[_0xa7fd('0x23')]=qs[_0xa7fd('0x2d')](_['pick'](_0xb78172[_0xa7fd('0x25')],_0x1b27fb[_0xa7fd('0x2d')]));_0x3dd152[_0xa7fd('0x23')]['WhatsappQueueId']=_0x3424ca['id'];if(_0xb78172[_0xa7fd('0x25')]['filter']){_0x3dd152['where']=_[_0xa7fd('0x32')](_0x3dd152[_0xa7fd('0x23')],{'$or':_[_0xa7fd('0x1e')](_0x3dd152[_0xa7fd('0x2f')],function(_0x10f9a8){var _0x276127={};_0x276127[_0x10f9a8]={'$like':'%'+_0xb78172[_0xa7fd('0x25')]['filter']+'%'};return _0x276127;})});}_0x3dd152=_['merge']({},_0x3dd152,_0xb78172[_0xa7fd('0x33')]);return db[_0xa7fd('0x43')][_0xa7fd('0x26')](_0x3dd152);}})[_0xa7fd('0x16')](function(_0x1fc74e){if(_0x1fc74e){return db[_0xa7fd('0x48')][_0xa7fd('0x49')]({'where':{'id':_[_0xa7fd('0x1e')](_0x1fc74e,'UserId'),'role':_0xa7fd('0x4a')},'attributes':['id','name','whatsappPause','updatedAt',_0xa7fd('0x4b')]});}})[_0xa7fd('0x16')](function(_0x1942f0){if(_0x1942f0){return{'count':_0x1942f0[_0xa7fd('0x13')],'rows':_[_0xa7fd('0x1e')](_0x1942f0[_0xa7fd('0x27')],function(_0xf4a1b7){return{'membername':_0xf4a1b7[_0xa7fd('0x1c')],'UserId':_0xf4a1b7['id'],'queue_name':_0x3573d3[_0xa7fd('0x1c')],'WhatsappQueueId':_0x3573d3['id'],'interface':util[_0xa7fd('0x4c')](_0xa7fd('0x4d'),'SIP',_0xf4a1b7[_0xa7fd('0x1c')]),'penalty':0x0,'paused':_0xf4a1b7[_0xa7fd('0x4e')],'createdAt':_0xf4a1b7[_0xa7fd('0x4b')],'updatedAt':_0xf4a1b7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa7fd('0x16')](respondWithFilteredResult(_0x586ba5,_0x3dd152))[_0xa7fd('0x28')](handleError(_0x586ba5,null));};exports['getTeams']=function(_0x38b913,_0x45b8d9){var _0xb997f8={};var _0x2c68aa={};var _0x14e7b5;var _0x34b047;return db['WhatsappQueue'][_0xa7fd('0x42')]({'where':{'id':_0x38b913['params']['id']}})[_0xa7fd('0x16')](handleEntityNotFound(_0x45b8d9,null))[_0xa7fd('0x16')](function(_0x337775){if(_0x337775){_0x14e7b5=_0x337775;_0x2c68aa[_0xa7fd('0x2e')]=_[_0xa7fd('0x2b')](db['Team'][_0xa7fd('0x2c')]);_0x2c68aa[_0xa7fd('0x25')]=_['keys'](_0x38b913[_0xa7fd('0x25')]);_0x2c68aa['filters']=_[_0xa7fd('0x30')](_0x2c68aa['model'],_0x2c68aa[_0xa7fd('0x25')]);_0xb997f8['attributes']=_[_0xa7fd('0x30')](_0x2c68aa['model'],qs[_0xa7fd('0x31')](_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x31')]));_0xb997f8['attributes']=_0xb997f8['attributes']['length']?_0xb997f8['attributes']:_0x2c68aa[_0xa7fd('0x2e')];_0xb997f8[_0xa7fd('0x46')]=qs['sort'](_0x38b913[_0xa7fd('0x25')]['sort']);_0xb997f8['where']=qs[_0xa7fd('0x2d')](_[_0xa7fd('0x4f')](_0x38b913[_0xa7fd('0x25')],_0x2c68aa[_0xa7fd('0x2d')]));if(_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x50')]){_0xb997f8[_0xa7fd('0x23')]=_[_0xa7fd('0x32')](_0xb997f8[_0xa7fd('0x23')],{'$or':_[_0xa7fd('0x1e')](_0xb997f8[_0xa7fd('0x2f')],function(_0x322a09){var _0x39a30e={};_0x39a30e[_0x322a09]={'$like':'%'+_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x50')]+'%'};return _0x39a30e;})});}_0xb997f8=_[_0xa7fd('0x32')]({},_0xb997f8,_0x38b913[_0xa7fd('0x33')]);return _0x14e7b5[_0xa7fd('0x51')](_0xb997f8);}})[_0xa7fd('0x16')](function(_0x10183e){if(_0x10183e){_0x34b047=_0x10183e[_0xa7fd('0x52')];if(!_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x44')]('nolimit')){_0xb997f8[_0xa7fd('0x12')]=qs[_0xa7fd('0x12')](_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x12')]);_0xb997f8[_0xa7fd('0x10')]=qs[_0xa7fd('0x10')](_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x10')]);}return _0x14e7b5[_0xa7fd('0x51')](_0xb997f8);}})['then'](function(_0x58d7ba){if(_0x58d7ba){return _0x58d7ba?{'count':_0x34b047,'rows':_0x58d7ba}:null;}})[_0xa7fd('0x16')](respondWithResult(_0x45b8d9,null))[_0xa7fd('0x28')](handleError(_0x45b8d9,null));};exports[_0xa7fd('0x53')]=function(_0x594eb1,_0x772ab8){var _0x3c1a9f=_0x594eb1['body'][_0xa7fd('0x54')];return db[_0xa7fd('0x55')][_0xa7fd('0x26')]({'where':{'id':_0x3c1a9f},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa7fd('0x56'),'attributes':['id',_0xa7fd('0x1c'),'online',_0xa7fd('0x57'),_0xa7fd('0x58')],'raw':!![]}]})[_0xa7fd('0x16')](function(_0xd25803){if(_0xd25803){var _0x4b196f=_['flatMap'](_0xd25803,function(_0x193c25){var _0x130409=_0x193c25[_0xa7fd('0x18')]({'plain':!![]});return _0x130409[_0xa7fd('0x56')];});return db[_0xa7fd('0x1f')][_0xa7fd('0x3a')]({'where':{'id':_0x594eb1[_0xa7fd('0x2a')]['id']}})[_0xa7fd('0x16')](function(_0x31f480){return db[_0xa7fd('0x59')][_0xa7fd('0x5a')](function(_0x45b08a){return _0x31f480[_0xa7fd('0x53')](_0x3c1a9f,{'transaction':_0x45b08a})[_0xa7fd('0x16')](function(){return BPromise[_0xa7fd('0x5b')](_0x4b196f,function(_0x34cc3d){return db[_0xa7fd('0x43')][_0xa7fd('0x5c')]({'where':{'UserId':_0x34cc3d['id'],'WhatsappQueueId':_0x594eb1[_0xa7fd('0x2a')]['id']},'transaction':_0x45b08a});});})[_0xa7fd('0x16')](function(){_0x4b196f['forEach'](function(_0x5c986f){socket[_0xa7fd('0x5d')](_0xa7fd('0x5e'),{'UserId':_0x5c986f['id'],'WhatsappQueueId':_0x31f480['id']});});});});});}})['then'](respondWithStatusCode(_0x772ab8,null))[_0xa7fd('0x28')](handleError(_0x772ab8,null));};exports[_0xa7fd('0x5f')]=function(_0x580a5c,_0x21e971){return db[_0xa7fd('0x55')][_0xa7fd('0x26')]({'where':{'id':_0x580a5c['query'][_0xa7fd('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa7fd('0x56'),'attributes':['id'],'raw':!![]}]})[_0xa7fd('0x16')](handleEntityNotFound(_0x21e971,null))['then'](function(_0x345b10){var _0x18f1de=_[_0xa7fd('0x1e')](_0x345b10,'id');var _0x2114f9=[];var _0x39a64f=[];var _0x4fc58a=squel[_0xa7fd('0x60')]();_0x4fc58a['field']('tq.TeamId')[_0xa7fd('0x61')](_0xa7fd('0x62'),'tq')[_0xa7fd('0x63')](_0xa7fd('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa7fd('0x23')](_0xa7fd('0x65'),_0x580a5c['params']['id']);for(var _0x2ecdbe=0x0;_0x2ecdbe<_0x345b10['length'];_0x2ecdbe+=0x1){let _0x5f5823=_0x345b10[_0x2ecdbe];for(var _0x4d929a=0x0;_0x4d929a<_0x5f5823[_0xa7fd('0x56')][_0xa7fd('0x52')];_0x4d929a+=0x1){let _0x5471e1=_0x5f5823[_0xa7fd('0x56')][_0x4d929a];var _0x1891eb=_0x4fc58a[_0xa7fd('0x66')]();_0x1891eb['where'](_0xa7fd('0x67'),_0x5471e1['id']);_0x39a64f['push'](db[_0xa7fd('0x59')][_0xa7fd('0x25')](_0x1891eb['toString'](),{'type':db[_0xa7fd('0x59')]['QueryTypes'][_0xa7fd('0x68')]})[_0xa7fd('0x16')](function(_0x5b3eb1){if(_0x5b3eb1[_0xa7fd('0x52')]===0x1){return _0x5471e1['id'];}else{var _0x441850=_[_0xa7fd('0x69')](_[_0xa7fd('0x1e')](_0x5b3eb1,_0xa7fd('0x6a')),function(_0x33f651){return _[_0xa7fd('0x6b')](_0x18f1de,_0x33f651);});if(_0x441850){return _0x5471e1['id'];}}}));}}return BPromise[_0xa7fd('0x6c')](_0x39a64f)[_0xa7fd('0x16')](function(_0x39732c){_0x2114f9=_(_0x2114f9)['union'](_0x39732c)[_0xa7fd('0x6d')]()[_0xa7fd('0x6e')]();return db[_0xa7fd('0x1f')]['find']({'where':{'id':_0x580a5c[_0xa7fd('0x2a')]['id']}})[_0xa7fd('0x16')](function(_0x89e36e){return db['sequelize']['transaction'](function(_0x562e42){return _0x89e36e[_0xa7fd('0x5f')](_0x580a5c[_0xa7fd('0x25')][_0xa7fd('0x54')],{'transaction':_0x562e42})['then'](function(){if(!_[_0xa7fd('0x6f')](_0x2114f9)){return _0x89e36e[_0xa7fd('0x70')](_0x2114f9,{'transaction':_0x562e42});}})[_0xa7fd('0x16')](function(){_0x2114f9[_0xa7fd('0x71')](function(_0xc85e5b){socket['emit'](_0xa7fd('0x72'),{'UserId':_0xc85e5b,'WhatsappQueueId':_0x89e36e['id']});});});});});});})[_0xa7fd('0x16')](respondWithStatusCode(_0x21e971,null))[_0xa7fd('0x28')](handleError(_0x21e971,null));};exports[_0xa7fd('0x73')]=function(_0x59128f,_0x2bb824){return db[_0xa7fd('0x1f')][_0xa7fd('0x3a')]({'where':{'id':_0x59128f['params']['id']}})[_0xa7fd('0x16')](handleEntityNotFound(_0x2bb824,null))['then'](function(_0x41d09e){if(_0x41d09e){return _0x41d09e['addAgents'](_0x59128f[_0xa7fd('0x35')]['ids'],_[_0xa7fd('0x74')](_0x59128f[_0xa7fd('0x35')],[_0xa7fd('0x54'),'id'])||{})[_0xa7fd('0x75')](function(_0x4e4390){for(var _0xc8357=0x0;_0xc8357<_0x59128f[_0xa7fd('0x35')][_0xa7fd('0x54')][_0xa7fd('0x52')];_0xc8357+=0x1){socket[_0xa7fd('0x5d')]('userWhatsappQueue:save',{'UserId':Number(_0x59128f[_0xa7fd('0x35')]['ids'][_0xc8357]),'WhatsappQueueId':Number(_0x59128f[_0xa7fd('0x2a')]['id'])});}return _0x4e4390;});}})[_0xa7fd('0x16')](respondWithResult(_0x2bb824,null))[_0xa7fd('0x28')](handleError(_0x2bb824,null));};exports['removeAgents']=function(_0x3e7e18,_0x159c88){return db[_0xa7fd('0x1f')]['find']({'where':{'id':_0x3e7e18['params']['id']}})['then'](handleEntityNotFound(_0x159c88,null))['then'](function(_0x282c1a){if(_0x282c1a){return _0x282c1a[_0xa7fd('0x70')](_0x3e7e18[_0xa7fd('0x25')][_0xa7fd('0x54')])[_0xa7fd('0x16')](function(){if(_[_0xa7fd('0x76')](_0x3e7e18[_0xa7fd('0x25')][_0xa7fd('0x54')])){for(var _0x2b7f5d=0x0;_0x2b7f5d<_0x3e7e18[_0xa7fd('0x25')][_0xa7fd('0x54')]['length'];_0x2b7f5d+=0x1){socket[_0xa7fd('0x5d')]('userWhatsappQueue:remove',{'UserId':Number(_0x3e7e18['query'][_0xa7fd('0x54')][_0x2b7f5d]),'WhatsappQueueId':Number(_0x3e7e18[_0xa7fd('0x2a')]['id'])});}}else{socket[_0xa7fd('0x5d')](_0xa7fd('0x72'),{'UserId':Number(_0x3e7e18[_0xa7fd('0x25')][_0xa7fd('0x54')]),'WhatsappQueueId':Number(_0x3e7e18[_0xa7fd('0x2a')]['id'])});}});}})[_0xa7fd('0x16')](respondWithStatusCode(_0x159c88,null))[_0xa7fd('0x28')](handleError(_0x159c88,null));};exports['getAgents']=function(_0x357f50,_0x30dfc8){var _0x4111c2={};var _0x256727={};var _0x503c6c;var _0xae42bc;return db[_0xa7fd('0x1f')][_0xa7fd('0x42')]({'where':{'id':_0x357f50[_0xa7fd('0x2a')]['id']}})[_0xa7fd('0x16')](handleEntityNotFound(_0x30dfc8,null))[_0xa7fd('0x16')](function(_0x4734a0){if(_0x4734a0){_0x503c6c=_0x4734a0;_0x256727[_0xa7fd('0x2e')]=_[_0xa7fd('0x2b')](db['User'][_0xa7fd('0x2c')]);_0x256727[_0xa7fd('0x25')]=_['keys'](_0x357f50['query']);_0x256727[_0xa7fd('0x2d')]=_[_0xa7fd('0x30')](_0x256727[_0xa7fd('0x2e')],_0x256727[_0xa7fd('0x25')]);_0x4111c2[_0xa7fd('0x2f')]=_['intersection'](_0x256727['model'],qs[_0xa7fd('0x31')](_0x357f50['query'][_0xa7fd('0x31')]));_0x4111c2[_0xa7fd('0x2f')]=_0x4111c2[_0xa7fd('0x2f')][_0xa7fd('0x52')]?_0x4111c2[_0xa7fd('0x2f')]:_0x256727[_0xa7fd('0x2e')];_0x4111c2[_0xa7fd('0x46')]=qs['sort'](_0x357f50['query'][_0xa7fd('0x47')]);_0x4111c2['where']=qs[_0xa7fd('0x2d')](_[_0xa7fd('0x4f')](_0x357f50[_0xa7fd('0x25')],_0x256727['filters']));if(_0x357f50['query'][_0xa7fd('0x50')]){_0x4111c2[_0xa7fd('0x23')]=_[_0xa7fd('0x32')](_0x4111c2['where'],{'$or':_[_0xa7fd('0x1e')](_0x4111c2[_0xa7fd('0x2f')],function(_0x4e5286){var _0xc27b13={};_0xc27b13[_0x4e5286]={'$like':'%'+_0x357f50['query'][_0xa7fd('0x50')]+'%'};return _0xc27b13;})});}_0x4111c2=_['merge']({},_0x4111c2,_0x357f50[_0xa7fd('0x33')]);return _0x503c6c[_0xa7fd('0x77')](_0x4111c2);}})[_0xa7fd('0x16')](function(_0x1f9618){if(_0x1f9618){_0xae42bc=_0x1f9618[_0xa7fd('0x52')];if(!_0x357f50[_0xa7fd('0x25')][_0xa7fd('0x44')](_0xa7fd('0x45'))){_0x4111c2[_0xa7fd('0x12')]=qs[_0xa7fd('0x12')](_0x357f50[_0xa7fd('0x25')]['limit']);_0x4111c2[_0xa7fd('0x10')]=qs['offset'](_0x357f50[_0xa7fd('0x25')][_0xa7fd('0x10')]);}return _0x503c6c[_0xa7fd('0x77')](_0x4111c2);}})[_0xa7fd('0x16')](function(_0x5a931e){if(_0x5a931e){return _0x5a931e?{'count':_0xae42bc,'rows':_0x5a931e}:null;}})['then'](respondWithResult(_0x30dfc8,null))['catch'](handleError(_0x30dfc8,null));}; \ No newline at end of file +var _0x05cb=['field','tq.TeamId','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','findOne','order','getAgents','bluebird','util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','catch','show','params','model','keys','filters','attributes','intersection','fields','merge','find','body','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserWhatsappQueue','length','hasOwnProperty','nolimit','sort','filter','options','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','Agents','online','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05cb,0x10f));var _0xb05c=function(_0x45f2f2,_0x4688f1){_0x45f2f2=_0x45f2f2-0x0;var _0xfa119f=_0x05cb[_0x45f2f2];return _0xfa119f;};'use strict';var BPromise=require(_0xb05c('0x0'));var util=require(_0xb05c('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xb05c('0x2'));var qs=require(_0xb05c('0x3'));var logger=require(_0xb05c('0x4'))(_0xb05c('0x5'));var config=require(_0xb05c('0x6'));var db=require('../../mysqldb')['db'];config[_0xb05c('0x7')]=_['defaults'](config[_0xb05c('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xb05c('0x8'))(new Redis(config[_0xb05c('0x7')]));require(_0xb05c('0x9'))[_0xb05c('0xa')](socket);function respondWithStatusCode(_0x4e7af7,_0xad80){_0xad80=_0xad80||0xcc;return function(_0x297cb8){if(_0x297cb8){return _0x4e7af7[_0xb05c('0xb')](_0xad80);}return _0x4e7af7['status'](_0xad80)[_0xb05c('0xc')]();};}function respondWithResult(_0x50d5e9,_0x128305){_0x128305=_0x128305||0xc8;return function(_0x1fb486){if(_0x1fb486){return _0x50d5e9[_0xb05c('0xd')](_0x128305)[_0xb05c('0xe')](_0x1fb486);}};}function respondWithFilteredResult(_0x4c3b36,_0x39993a){return function(_0x266dbd){if(_0x266dbd){var _0x57f602=typeof _0x39993a[_0xb05c('0xf')]===_0xb05c('0x10')&&typeof _0x39993a[_0xb05c('0x11')]===_0xb05c('0x10');var _0x39c6d7=_0x266dbd[_0xb05c('0x12')];var _0x34bbef=_0x57f602?0x0:_0x39993a[_0xb05c('0xf')];var _0x404486=_0x57f602?_0x266dbd['count']:_0x39993a[_0xb05c('0xf')]+_0x39993a['limit'];var _0x5b4776;if(_0x404486>=_0x39c6d7){_0x404486=_0x39c6d7;_0x5b4776=0xc8;}else{_0x5b4776=0xce;}_0x4c3b36[_0xb05c('0xd')](_0x5b4776);return _0x4c3b36['set'](_0xb05c('0x13'),_0x34bbef+'-'+_0x404486+'/'+_0x39c6d7)[_0xb05c('0xe')](_0x266dbd);}return null;};}function saveUpdates(_0x48fa27){return function(_0x24130f){if(_0x24130f){return _0x24130f[_0xb05c('0x14')](_0x48fa27)[_0xb05c('0x15')](function(_0x2f8984){return _0x2f8984;});}return null;};}function removeEntity(_0x11acbf){return function(_0x557015){if(_0x557015){return _0x557015[_0xb05c('0x16')]()[_0xb05c('0x15')](function(){var _0x2cfa16=_0x557015[_0xb05c('0x17')]({'plain':!![]});var _0x5cdc56=_0xb05c('0x18');return db[_0xb05c('0x19')][_0xb05c('0x16')]({'where':{'type':_0x5cdc56,'resourceId':_0x2cfa16['id']}})[_0xb05c('0x15')](function(){return _0x557015;});})['then'](function(){_0x11acbf[_0xb05c('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8b44){return function(_0x17efad){if(!_0x17efad){_0x4e8b44[_0xb05c('0xb')](0x194);}return _0x17efad;};}function handleError(_0x5eeb0c,_0x3b6672){_0x3b6672=_0x3b6672||0x1f4;return function(_0x5100df){logger[_0xb05c('0x1a')](_0x5100df[_0xb05c('0x1b')]);if(_0x5100df[_0xb05c('0x1c')]){delete _0x5100df[_0xb05c('0x1c')];}_0x5eeb0c['status'](_0x3b6672)['send'](_0x5100df);};}exports[_0xb05c('0x1d')]=function(_0xd50b85,_0x4c2391){var _0x21fac0={};var _0x23dc7c={'count':0x0,'rows':[]};var _0x5dcffc=_[_0xb05c('0x1e')](db[_0xb05c('0x1f')][_0xb05c('0x20')],function(_0x7f7a95){return{'name':_0x7f7a95[_0xb05c('0x21')],'type':_0x7f7a95[_0xb05c('0x22')][_0xb05c('0x23')]};});_0x21fac0=qs[_0xb05c('0x24')](_0x5dcffc,_0xd50b85);var _0x15c137={'where':_0x21fac0[_0xb05c('0x25')]};return db[_0xb05c('0x1f')]['count'](_0x15c137)[_0xb05c('0x15')](function(_0x1aa4d5){_0x23dc7c[_0xb05c('0x12')]=_0x1aa4d5;_0x21fac0[_0xb05c('0x26')]=qs[_0xb05c('0x26')](_0xd50b85[_0xb05c('0x27')]);return db[_0xb05c('0x1f')]['findAll'](_0x21fac0);})[_0xb05c('0x15')](function(_0x368d57){_0x23dc7c['rows']=_0x368d57;return _0x23dc7c;})[_0xb05c('0x15')](respondWithFilteredResult(_0x4c2391,_0x21fac0))[_0xb05c('0x28')](handleError(_0x4c2391,null));};exports[_0xb05c('0x29')]=function(_0x1a5eca,_0x144610){var _0x3bbbd9={'raw':!![],'where':{'id':_0x1a5eca[_0xb05c('0x2a')]['id']}},_0xdcb7a5={};_0xdcb7a5[_0xb05c('0x2b')]=_[_0xb05c('0x2c')](db[_0xb05c('0x1f')][_0xb05c('0x20')]);_0xdcb7a5[_0xb05c('0x27')]=_[_0xb05c('0x2c')](_0x1a5eca[_0xb05c('0x27')]);_0xdcb7a5[_0xb05c('0x2d')]=_['intersection'](_0xdcb7a5[_0xb05c('0x2b')],_0xdcb7a5['query']);_0x3bbbd9[_0xb05c('0x2e')]=_[_0xb05c('0x2f')](_0xdcb7a5[_0xb05c('0x2b')],qs['fields'](_0x1a5eca['query'][_0xb05c('0x30')]));_0x3bbbd9['attributes']=_0x3bbbd9['attributes']['length']?_0x3bbbd9[_0xb05c('0x2e')]:_0xdcb7a5['model'];if(_0x1a5eca[_0xb05c('0x27')]['includeAll']){_0x3bbbd9[_0xb05c('0x26')]=[{'all':!![]}];}_0x3bbbd9=_[_0xb05c('0x31')]({},_0x3bbbd9,_0x1a5eca['options']);return db[_0xb05c('0x1f')][_0xb05c('0x32')](_0x3bbbd9)[_0xb05c('0x15')](handleEntityNotFound(_0x144610,null))[_0xb05c('0x15')](respondWithResult(_0x144610,null))['catch'](handleError(_0x144610,null));};exports['create']=function(_0x4fa9a2,_0x290974){return db[_0xb05c('0x1f')]['create'](_0x4fa9a2[_0xb05c('0x33')],{})['then'](function(_0x462624){var _0xcfe8bc=_0x4fa9a2[_0xb05c('0x34')]['get']({'plain':!![]});if(!_0xcfe8bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcfe8bc['role']===_0xb05c('0x34')){var _0x232c4a=_0x462624['get']({'plain':!![]});var _0x5ebfe5=_0xb05c('0x18');return db[_0xb05c('0x35')][_0xb05c('0x32')]({'where':{'name':_0x5ebfe5,'userProfileId':_0xcfe8bc[_0xb05c('0x36')]},'raw':!![]})[_0xb05c('0x15')](function(_0x5d4d46){if(_0x5d4d46&&_0x5d4d46[_0xb05c('0x37')]===0x0){return db[_0xb05c('0x19')][_0xb05c('0x38')]({'name':_0x232c4a[_0xb05c('0x1c')],'resourceId':_0x232c4a['id'],'type':_0x5d4d46[_0xb05c('0x1c')],'sectionId':_0x5d4d46['id']},{})[_0xb05c('0x15')](function(){return _0x462624;});}else{return _0x462624;}})[_0xb05c('0x28')](function(_0x465512){logger['error'](_0xb05c('0x39'),_0x465512);throw _0x465512;});}return _0x462624;})[_0xb05c('0x15')](respondWithResult(_0x290974,0xc9))[_0xb05c('0x28')](handleError(_0x290974,null));};exports[_0xb05c('0x14')]=function(_0x487b56,_0x74ab6c){if(_0x487b56[_0xb05c('0x33')]['id']){delete _0x487b56['body']['id'];}return db['WhatsappQueue'][_0xb05c('0x32')]({'where':{'id':_0x487b56[_0xb05c('0x2a')]['id']}})[_0xb05c('0x15')](handleEntityNotFound(_0x74ab6c,null))['then'](saveUpdates(_0x487b56[_0xb05c('0x33')],null))[_0xb05c('0x15')](respondWithResult(_0x74ab6c,null))['catch'](handleError(_0x74ab6c,null));};exports[_0xb05c('0x16')]=function(_0x19ea74,_0x590623){return db[_0xb05c('0x1f')][_0xb05c('0x32')]({'where':{'id':_0x19ea74[_0xb05c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x590623,null))[_0xb05c('0x15')](removeEntity(_0x590623,null))['catch'](handleError(_0x590623,null));};exports[_0xb05c('0x3a')]=function(_0x3f76f6,_0x3a1487){return db['WhatsappQueue'][_0xb05c('0x3a')]()[_0xb05c('0x15')](respondWithResult(_0x3a1487,null))[_0xb05c('0x28')](handleError(_0x3a1487,null));};exports['getMembers']=function(_0x116bf6,_0x4ad56d){var _0x1b4a13={'raw':!![],'where':{}},_0x3e37fb={},_0x3ea84f;return db[_0xb05c('0x1f')]['findOne']({'where':{'id':_0x116bf6['params']['id']}})[_0xb05c('0x15')](handleEntityNotFound(_0x4ad56d,null))[_0xb05c('0x15')](function(_0x4b57b6){if(_0x4b57b6){_0x3ea84f=_0x4b57b6[_0xb05c('0x17')]({'plain':!![]});_0x3e37fb[_0xb05c('0x2b')]=_[_0xb05c('0x2c')](db[_0xb05c('0x3b')][_0xb05c('0x20')]);_0x3e37fb['query']=_[_0xb05c('0x2c')](_0x116bf6[_0xb05c('0x27')]);_0x3e37fb['filters']=_['intersection'](_0x3e37fb[_0xb05c('0x2b')],_0x3e37fb[_0xb05c('0x27')]);_0x1b4a13[_0xb05c('0x2e')]=_['intersection'](_0x3e37fb['model'],qs['fields'](_0x116bf6[_0xb05c('0x27')][_0xb05c('0x30')]));_0x1b4a13[_0xb05c('0x2e')]=_0x1b4a13[_0xb05c('0x2e')][_0xb05c('0x3c')]?_0x1b4a13[_0xb05c('0x2e')]:_0x3e37fb[_0xb05c('0x2b')];if(!_0x116bf6[_0xb05c('0x27')][_0xb05c('0x3d')](_0xb05c('0x3e'))){_0x1b4a13[_0xb05c('0x11')]=qs['limit'](_0x116bf6[_0xb05c('0x27')]['limit']);_0x1b4a13[_0xb05c('0xf')]=qs[_0xb05c('0xf')](_0x116bf6['query'][_0xb05c('0xf')]);}_0x1b4a13['order']=qs[_0xb05c('0x3f')](_0x116bf6[_0xb05c('0x27')][_0xb05c('0x3f')]);_0x1b4a13['where']=qs[_0xb05c('0x2d')](_['pick'](_0x116bf6['query'],_0x3e37fb[_0xb05c('0x2d')]));_0x1b4a13[_0xb05c('0x25')]['WhatsappQueueId']=_0x4b57b6['id'];if(_0x116bf6[_0xb05c('0x27')][_0xb05c('0x40')]){_0x1b4a13[_0xb05c('0x25')]=_[_0xb05c('0x31')](_0x1b4a13[_0xb05c('0x25')],{'$or':_[_0xb05c('0x1e')](_0x1b4a13[_0xb05c('0x2e')],function(_0x21bfca){var _0x33c924={};_0x33c924[_0x21bfca]={'$like':'%'+_0x116bf6['query'][_0xb05c('0x40')]+'%'};return _0x33c924;})});}_0x1b4a13=_[_0xb05c('0x31')]({},_0x1b4a13,_0x116bf6[_0xb05c('0x41')]);return db[_0xb05c('0x3b')][_0xb05c('0x42')](_0x1b4a13);}})[_0xb05c('0x15')](function(_0x4ca074){if(_0x4ca074){return db[_0xb05c('0x43')][_0xb05c('0x44')]({'where':{'id':_[_0xb05c('0x1e')](_0x4ca074,_0xb05c('0x45')),'role':_0xb05c('0x46')},'attributes':['id',_0xb05c('0x1c'),_0xb05c('0x47'),_0xb05c('0x48'),_0xb05c('0x49')]});}})['then'](function(_0x13bd0f){if(_0x13bd0f){return{'count':_0x13bd0f[_0xb05c('0x12')],'rows':_[_0xb05c('0x1e')](_0x13bd0f[_0xb05c('0x4a')],function(_0x15f841){return{'membername':_0x15f841[_0xb05c('0x1c')],'UserId':_0x15f841['id'],'queue_name':_0x3ea84f[_0xb05c('0x1c')],'WhatsappQueueId':_0x3ea84f['id'],'interface':util[_0xb05c('0x4b')](_0xb05c('0x4c'),_0xb05c('0x4d'),_0x15f841[_0xb05c('0x1c')]),'penalty':0x0,'paused':_0x15f841[_0xb05c('0x47')],'createdAt':_0x15f841[_0xb05c('0x49')],'updatedAt':_0x15f841['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb05c('0x15')](respondWithFilteredResult(_0x4ad56d,_0x1b4a13))[_0xb05c('0x28')](handleError(_0x4ad56d,null));};exports[_0xb05c('0x4e')]=function(_0x129a9a,_0x297910){var _0x4c4e58={};var _0x363321={};var _0x41367d;var _0x2d0012;return db[_0xb05c('0x1f')]['findOne']({'where':{'id':_0x129a9a['params']['id']}})['then'](handleEntityNotFound(_0x297910,null))[_0xb05c('0x15')](function(_0x28de5a){if(_0x28de5a){_0x41367d=_0x28de5a;_0x363321[_0xb05c('0x2b')]=_['keys'](db[_0xb05c('0x4f')]['rawAttributes']);_0x363321['query']=_[_0xb05c('0x2c')](_0x129a9a[_0xb05c('0x27')]);_0x363321[_0xb05c('0x2d')]=_[_0xb05c('0x2f')](_0x363321[_0xb05c('0x2b')],_0x363321['query']);_0x4c4e58[_0xb05c('0x2e')]=_[_0xb05c('0x2f')](_0x363321[_0xb05c('0x2b')],qs['fields'](_0x129a9a[_0xb05c('0x27')][_0xb05c('0x30')]));_0x4c4e58[_0xb05c('0x2e')]=_0x4c4e58['attributes'][_0xb05c('0x3c')]?_0x4c4e58[_0xb05c('0x2e')]:_0x363321[_0xb05c('0x2b')];_0x4c4e58['order']=qs[_0xb05c('0x3f')](_0x129a9a[_0xb05c('0x27')][_0xb05c('0x3f')]);_0x4c4e58['where']=qs[_0xb05c('0x2d')](_[_0xb05c('0x50')](_0x129a9a[_0xb05c('0x27')],_0x363321[_0xb05c('0x2d')]));if(_0x129a9a[_0xb05c('0x27')][_0xb05c('0x40')]){_0x4c4e58[_0xb05c('0x25')]=_['merge'](_0x4c4e58[_0xb05c('0x25')],{'$or':_['map'](_0x4c4e58[_0xb05c('0x2e')],function(_0x4b8188){var _0x191168={};_0x191168[_0x4b8188]={'$like':'%'+_0x129a9a['query'][_0xb05c('0x40')]+'%'};return _0x191168;})});}_0x4c4e58=_[_0xb05c('0x31')]({},_0x4c4e58,_0x129a9a[_0xb05c('0x41')]);return _0x41367d[_0xb05c('0x4e')](_0x4c4e58);}})[_0xb05c('0x15')](function(_0x37b747){if(_0x37b747){_0x2d0012=_0x37b747[_0xb05c('0x3c')];if(!_0x129a9a[_0xb05c('0x27')][_0xb05c('0x3d')](_0xb05c('0x3e'))){_0x4c4e58[_0xb05c('0x11')]=qs[_0xb05c('0x11')](_0x129a9a['query']['limit']);_0x4c4e58[_0xb05c('0xf')]=qs[_0xb05c('0xf')](_0x129a9a[_0xb05c('0x27')]['offset']);}return _0x41367d[_0xb05c('0x4e')](_0x4c4e58);}})['then'](function(_0xe6f1ed){if(_0xe6f1ed){return _0xe6f1ed?{'count':_0x2d0012,'rows':_0xe6f1ed}:null;}})['then'](respondWithResult(_0x297910,null))[_0xb05c('0x28')](handleError(_0x297910,null));};exports[_0xb05c('0x51')]=function(_0x3c04e6,_0x3bdf96){var _0x493a53=_0x3c04e6[_0xb05c('0x33')][_0xb05c('0x52')];return db[_0xb05c('0x4f')]['findAll']({'where':{'id':_0x493a53},'attributes':['id'],'include':[{'model':db[_0xb05c('0x43')],'as':_0xb05c('0x53'),'attributes':['id',_0xb05c('0x1c'),_0xb05c('0x54'),'voicePause',_0xb05c('0x55')],'raw':!![]}]})['then'](function(_0x2859b7){if(_0x2859b7){var _0xdd815b=_['flatMap'](_0x2859b7,function(_0x4dfaee){var _0x222c1b=_0x4dfaee[_0xb05c('0x17')]({'plain':!![]});return _0x222c1b[_0xb05c('0x53')];});return db[_0xb05c('0x1f')][_0xb05c('0x32')]({'where':{'id':_0x3c04e6['params']['id']}})[_0xb05c('0x15')](function(_0x2a77f9){return db[_0xb05c('0x56')][_0xb05c('0x57')](function(_0x52e1a4){return _0x2a77f9[_0xb05c('0x51')](_0x493a53,{'transaction':_0x52e1a4})[_0xb05c('0x15')](function(){return BPromise[_0xb05c('0x58')](_0xdd815b,function(_0x4a175f){return db[_0xb05c('0x3b')][_0xb05c('0x59')]({'where':{'UserId':_0x4a175f['id'],'WhatsappQueueId':_0x3c04e6['params']['id']},'transaction':_0x52e1a4});});})[_0xb05c('0x15')](function(){_0xdd815b[_0xb05c('0x5a')](function(_0x35a4ff){socket[_0xb05c('0x5b')](_0xb05c('0x5c'),{'UserId':_0x35a4ff['id'],'WhatsappQueueId':_0x2a77f9['id']});});});});});}})[_0xb05c('0x15')](respondWithStatusCode(_0x3bdf96,null))[_0xb05c('0x28')](handleError(_0x3bdf96,null));};exports[_0xb05c('0x5d')]=function(_0x498cf8,_0x9be55c){return db[_0xb05c('0x4f')]['findAll']({'where':{'id':_0x498cf8[_0xb05c('0x27')][_0xb05c('0x52')]},'attributes':['id'],'include':[{'model':db[_0xb05c('0x43')],'as':_0xb05c('0x53'),'attributes':['id'],'raw':!![]}]})[_0xb05c('0x15')](handleEntityNotFound(_0x9be55c,null))['then'](function(_0x5672c4){var _0x520c6b=_[_0xb05c('0x1e')](_0x5672c4,'id');var _0x129c02=[];var _0x5a49ac=[];var _0x91a27d=squel[_0xb05c('0x5e')]();_0x91a27d[_0xb05c('0x5f')](_0xb05c('0x60'))['from'](_0xb05c('0x61'),'tq')['join'](_0xb05c('0x62'),'ut',_0xb05c('0x63'))[_0xb05c('0x25')](_0xb05c('0x64'),_0x498cf8[_0xb05c('0x2a')]['id']);for(var _0x3a7e60=0x0;_0x3a7e60<_0x5672c4['length'];_0x3a7e60+=0x1){let _0x247515=_0x5672c4[_0x3a7e60];for(var _0x302e10=0x0;_0x302e10<_0x247515[_0xb05c('0x53')][_0xb05c('0x3c')];_0x302e10+=0x1){let _0xcdaebf=_0x247515[_0xb05c('0x53')][_0x302e10];var _0x1d0804=_0x91a27d[_0xb05c('0x65')]();_0x1d0804[_0xb05c('0x25')]('ut.UserId\x20=\x20?',_0xcdaebf['id']);_0x5a49ac[_0xb05c('0x66')](db['sequelize']['query'](_0x1d0804[_0xb05c('0x67')](),{'type':db[_0xb05c('0x56')][_0xb05c('0x68')][_0xb05c('0x69')]})[_0xb05c('0x15')](function(_0x3c7c00){if(_0x3c7c00[_0xb05c('0x3c')]===0x1){return _0xcdaebf['id'];}else{var _0x87213b=_['every'](_[_0xb05c('0x1e')](_0x3c7c00,_0xb05c('0x6a')),function(_0x25e008){return _[_0xb05c('0x6b')](_0x520c6b,_0x25e008);});if(_0x87213b){return _0xcdaebf['id'];}}}));}}return BPromise[_0xb05c('0x6c')](_0x5a49ac)[_0xb05c('0x15')](function(_0x368fbc){_0x129c02=_(_0x129c02)[_0xb05c('0x6d')](_0x368fbc)[_0xb05c('0x6e')]()[_0xb05c('0x6f')]();return db[_0xb05c('0x1f')][_0xb05c('0x32')]({'where':{'id':_0x498cf8[_0xb05c('0x2a')]['id']}})['then'](function(_0xd711c9){return db['sequelize'][_0xb05c('0x57')](function(_0xf30f14){return _0xd711c9[_0xb05c('0x5d')](_0x498cf8[_0xb05c('0x27')][_0xb05c('0x52')],{'transaction':_0xf30f14})[_0xb05c('0x15')](function(){if(!_[_0xb05c('0x70')](_0x129c02)){return _0xd711c9[_0xb05c('0x71')](_0x129c02,{'transaction':_0xf30f14});}})[_0xb05c('0x15')](function(){_0x129c02[_0xb05c('0x5a')](function(_0x26094f){socket[_0xb05c('0x5b')]('userWhatsappQueue:remove',{'UserId':_0x26094f,'WhatsappQueueId':_0xd711c9['id']});});});});});});})[_0xb05c('0x15')](respondWithStatusCode(_0x9be55c,null))['catch'](handleError(_0x9be55c,null));};exports[_0xb05c('0x72')]=function(_0x205ae3,_0x4d4c8f){return db[_0xb05c('0x1f')][_0xb05c('0x32')]({'where':{'id':_0x205ae3[_0xb05c('0x2a')]['id']}})[_0xb05c('0x15')](handleEntityNotFound(_0x4d4c8f,null))[_0xb05c('0x15')](function(_0x41c224){if(_0x41c224){return _0x41c224['addAgents'](_0x205ae3[_0xb05c('0x33')][_0xb05c('0x52')],_[_0xb05c('0x73')](_0x205ae3[_0xb05c('0x33')],[_0xb05c('0x52'),'id'])||{})[_0xb05c('0x74')](function(_0xbc1c9b){for(var _0x5c8f2b=0x0;_0x5c8f2b<_0x205ae3[_0xb05c('0x33')][_0xb05c('0x52')]['length'];_0x5c8f2b+=0x1){socket[_0xb05c('0x5b')](_0xb05c('0x5c'),{'UserId':Number(_0x205ae3[_0xb05c('0x33')][_0xb05c('0x52')][_0x5c8f2b]),'WhatsappQueueId':Number(_0x205ae3[_0xb05c('0x2a')]['id'])});}return _0xbc1c9b;});}})[_0xb05c('0x15')](respondWithResult(_0x4d4c8f,null))['catch'](handleError(_0x4d4c8f,null));};exports[_0xb05c('0x71')]=function(_0xf5d630,_0x15b7ca){return db[_0xb05c('0x1f')][_0xb05c('0x32')]({'where':{'id':_0xf5d630['params']['id']}})[_0xb05c('0x15')](handleEntityNotFound(_0x15b7ca,null))['then'](function(_0x59af8d){if(_0x59af8d){return _0x59af8d[_0xb05c('0x71')](_0xf5d630[_0xb05c('0x27')]['ids'])[_0xb05c('0x15')](function(){if(_[_0xb05c('0x75')](_0xf5d630[_0xb05c('0x27')][_0xb05c('0x52')])){for(var _0x1e57ff=0x0;_0x1e57ff<_0xf5d630[_0xb05c('0x27')]['ids'][_0xb05c('0x3c')];_0x1e57ff+=0x1){socket[_0xb05c('0x5b')](_0xb05c('0x76'),{'UserId':Number(_0xf5d630[_0xb05c('0x27')][_0xb05c('0x52')][_0x1e57ff]),'WhatsappQueueId':Number(_0xf5d630[_0xb05c('0x2a')]['id'])});}}else{socket['emit'](_0xb05c('0x76'),{'UserId':Number(_0xf5d630['query']['ids']),'WhatsappQueueId':Number(_0xf5d630[_0xb05c('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x15b7ca,null))[_0xb05c('0x28')](handleError(_0x15b7ca,null));};exports['getAgents']=function(_0x38929b,_0x15201a){var _0x295849={};var _0x16d92b={};var _0x1004ca;var _0x746083;return db[_0xb05c('0x1f')][_0xb05c('0x77')]({'where':{'id':_0x38929b[_0xb05c('0x2a')]['id']}})[_0xb05c('0x15')](handleEntityNotFound(_0x15201a,null))['then'](function(_0x81ea4c){if(_0x81ea4c){_0x1004ca=_0x81ea4c;_0x16d92b[_0xb05c('0x2b')]=_[_0xb05c('0x2c')](db[_0xb05c('0x43')][_0xb05c('0x20')]);_0x16d92b['query']=_[_0xb05c('0x2c')](_0x38929b[_0xb05c('0x27')]);_0x16d92b['filters']=_['intersection'](_0x16d92b[_0xb05c('0x2b')],_0x16d92b[_0xb05c('0x27')]);_0x295849['attributes']=_[_0xb05c('0x2f')](_0x16d92b[_0xb05c('0x2b')],qs['fields'](_0x38929b[_0xb05c('0x27')][_0xb05c('0x30')]));_0x295849['attributes']=_0x295849[_0xb05c('0x2e')][_0xb05c('0x3c')]?_0x295849[_0xb05c('0x2e')]:_0x16d92b[_0xb05c('0x2b')];_0x295849[_0xb05c('0x78')]=qs[_0xb05c('0x3f')](_0x38929b[_0xb05c('0x27')][_0xb05c('0x3f')]);_0x295849[_0xb05c('0x25')]=qs['filters'](_[_0xb05c('0x50')](_0x38929b[_0xb05c('0x27')],_0x16d92b[_0xb05c('0x2d')]));if(_0x38929b['query'][_0xb05c('0x40')]){_0x295849[_0xb05c('0x25')]=_[_0xb05c('0x31')](_0x295849[_0xb05c('0x25')],{'$or':_[_0xb05c('0x1e')](_0x295849[_0xb05c('0x2e')],function(_0x1feec1){var _0x5c1fc8={};_0x5c1fc8[_0x1feec1]={'$like':'%'+_0x38929b[_0xb05c('0x27')]['filter']+'%'};return _0x5c1fc8;})});}_0x295849=_[_0xb05c('0x31')]({},_0x295849,_0x38929b[_0xb05c('0x41')]);return _0x1004ca[_0xb05c('0x79')](_0x295849);}})[_0xb05c('0x15')](function(_0x3fa81c){if(_0x3fa81c){_0x746083=_0x3fa81c[_0xb05c('0x3c')];if(!_0x38929b[_0xb05c('0x27')][_0xb05c('0x3d')](_0xb05c('0x3e'))){_0x295849['limit']=qs[_0xb05c('0x11')](_0x38929b[_0xb05c('0x27')][_0xb05c('0x11')]);_0x295849[_0xb05c('0xf')]=qs[_0xb05c('0xf')](_0x38929b['query'][_0xb05c('0xf')]);}return _0x1004ca['getAgents'](_0x295849);}})[_0xb05c('0x15')](function(_0x1b45ec){if(_0x1b45ec){return _0x1b45ec?{'count':_0x746083,'rows':_0x1b45ec}:null;}})['then'](respondWithResult(_0x15201a,null))['catch'](handleError(_0x15201a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 8553412..acac76b 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 _0xa5ab=['events','../../mysqldb','update','remove','emit','hook'];(function(_0x113bd2,_0x135386){var _0x271ceb=function(_0x4c175c){while(--_0x4c175c){_0x113bd2['push'](_0x113bd2['shift']());}};_0x271ceb(++_0x135386);}(_0xa5ab,0x66));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xba5a('0x0'));var WhatsappQueue=require(_0xba5a('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xba5a('0x2'),'afterDestroy':_0xba5a('0x3')};function emitEvent(_0x4a85d8){return function(_0x46ae3d,_0x4235b4,_0x304503){WhatsappQueueEvents[_0xba5a('0x4')](_0x4a85d8+':'+_0x46ae3d['id'],_0x46ae3d);WhatsappQueueEvents[_0xba5a('0x4')](_0x4a85d8,_0x46ae3d);_0x304503(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xba5a('0x5')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x2b9b=['events','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hook'];(function(_0x137b8d,_0x2e8545){var _0x527daf=function(_0x57f818){while(--_0x57f818){_0x137b8d['push'](_0x137b8d['shift']());}};_0x527daf(++_0x2e8545);}(_0x2b9b,0x110));var _0xb2b9=function(_0x3919d4,_0x22b207){_0x3919d4=_0x3919d4-0x0;var _0x285a31=_0x2b9b[_0x3919d4];return _0x285a31;};'use strict';var EventEmitter=require(_0xb2b9('0x0'));var WhatsappQueue=require(_0xb2b9('0x1'))['db'][_0xb2b9('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb2b9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb2b9('0x4'),'afterDestroy':_0xb2b9('0x5')};function emitEvent(_0x5b257d){return function(_0x1fd124,_0x385112,_0x299f65){WhatsappQueueEvents[_0xb2b9('0x6')](_0x5b257d+':'+_0x1fd124['id'],_0x1fd124);WhatsappQueueEvents[_0xb2b9('0x6')](_0x5b257d,_0x1fd124);_0x299f65(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xb2b9('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 8b1066b..46c63df 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 _0x884d=['lodash','../../config/logger','bluebird','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x50db32,_0x32612b){var _0x169007=function(_0x3d8ce1){while(--_0x3d8ce1){_0x50db32['push'](_0x50db32['shift']());}};_0x169007(++_0x32612b);}(_0x884d,0xb8));var _0xd884=function(_0x1d6de3,_0x14df34){_0x1d6de3=_0x1d6de3-0x0;var _0x4fac0a=_0x884d[_0x1d6de3];return _0x4fac0a;};'use strict';var _=require(_0xd884('0x0'));var util=require('util');var logger=require(_0xd884('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd884('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd884('0x3'));var config=require('../../config/environment');var attributes=require(_0xd884('0x4'));module[_0xd884('0x5')]=function(_0x317e43,_0x115965){return _0x317e43[_0xd884('0x6')](_0xd884('0x7'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a9a=['./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3bb991,_0x5cbfa3){var _0x22103c=function(_0x422937){while(--_0x422937){_0x3bb991['push'](_0x3bb991['shift']());}};_0x22103c(++_0x5cbfa3);}(_0x8a9a,0x1a6));var _0xa8a9=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x8a9a[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xa8a9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa8a9('0x1'));var moment=require('moment');var BPromise=require(_0xa8a9('0x2'));var rp=require(_0xa8a9('0x3'));var fs=require('fs');var path=require(_0xa8a9('0x4'));var rimraf=require(_0xa8a9('0x5'));var config=require(_0xa8a9('0x6'));var attributes=require(_0xa8a9('0x7'));module[_0xa8a9('0x8')]=function(_0x1d5674,_0x220f1f){return _0x1d5674[_0xa8a9('0x9')]('WhatsappQueue',attributes,{'tableName':_0xa8a9('0xa'),'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 a039cb9..cad27ca 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 _0x3b5d=['code','message','result','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','include','map','model','catch','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x240b66,_0x5d6ac4){var _0x158df9=function(_0x93d82d){while(--_0x93d82d){_0x240b66['push'](_0x240b66['shift']());}};_0x158df9(++_0x5d6ac4);}(_0x3b5d,0x195));var _0xd3b5=function(_0x36fe9b,_0x518d1b){_0x36fe9b=_0x36fe9b-0x0;var _0x113065=_0x3b5d[_0x36fe9b];return _0x113065;};'use strict';var _=require(_0xd3b5('0x0'));var util=require(_0xd3b5('0x1'));var moment=require('moment');var BPromise=require(_0xd3b5('0x2'));var rs=require(_0xd3b5('0x3'));var fs=require('fs');var Redis=require(_0xd3b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3b5('0x5'));var logger=require(_0xd3b5('0x6'))('rpc');var config=require(_0xd3b5('0x7'));var jayson=require(_0xd3b5('0x8'));var client=jayson[_0xd3b5('0x9')][_0xd3b5('0xa')]({'port':0x232a});config[_0xd3b5('0xb')]=_['defaults'](config[_0xd3b5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd3b5('0xc'))(new Redis(config[_0xd3b5('0xb')]));require(_0xd3b5('0xd'))[_0xd3b5('0xe')](socket);function respondWithRpcPromise(_0x339709,_0x4d65e9,_0x48f195){return new BPromise(function(_0x578ee9,_0x263cab){return client[_0xd3b5('0xf')](_0x339709,_0x48f195)[_0xd3b5('0x10')](function(_0x433279){logger[_0xd3b5('0x11')](_0xd3b5('0x12'),_0x4d65e9,_0xd3b5('0x13'));logger[_0xd3b5('0x14')](_0xd3b5('0x15'),_0x4d65e9,_0xd3b5('0x13'),JSON[_0xd3b5('0x16')](_0x433279));if(_0x433279[_0xd3b5('0x17')]){if(_0x433279[_0xd3b5('0x17')][_0xd3b5('0x18')]===0x1f4){logger[_0xd3b5('0x17')](_0xd3b5('0x12'),_0x4d65e9,_0x433279['error'][_0xd3b5('0x19')]);return _0x263cab(_0x433279[_0xd3b5('0x17')][_0xd3b5('0x19')]);}logger[_0xd3b5('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x4d65e9,_0x433279['error'][_0xd3b5('0x19')]);return _0x578ee9(_0x433279['error'][_0xd3b5('0x19')]);}else{logger[_0xd3b5('0x11')](_0xd3b5('0x12'),_0x4d65e9,_0xd3b5('0x13'));_0x578ee9(_0x433279[_0xd3b5('0x1a')][_0xd3b5('0x19')]);}})['catch'](function(_0x45183c){logger[_0xd3b5('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x4d65e9,_0x45183c);_0x263cab(_0x45183c);});});}exports[_0xd3b5('0x1b')]=function(_0x5ef351){var _0x2c836d=this;return new Promise(function(_0x51d120,_0x59cbd4){return db[_0xd3b5('0x1c')]['findAll']({'raw':_0x5ef351['options']?_0x5ef351[_0xd3b5('0x1d')][_0xd3b5('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ef351[_0xd3b5('0x1d')]?_0x5ef351[_0xd3b5('0x1d')][_0xd3b5('0x1f')]||null:null,'attributes':_0x5ef351[_0xd3b5('0x1d')]?_0x5ef351[_0xd3b5('0x1d')][_0xd3b5('0x20')]||null:null,'limit':_0x5ef351[_0xd3b5('0x1d')]?_0x5ef351[_0xd3b5('0x1d')]['limit']||null:null,'include':_0x5ef351[_0xd3b5('0x1d')]?_0x5ef351[_0xd3b5('0x1d')][_0xd3b5('0x21')]?_[_0xd3b5('0x22')](_0x5ef351[_0xd3b5('0x1d')]['include'],function(_0xd6fcd9){return{'model':db[_0xd6fcd9[_0xd3b5('0x23')]],'as':_0xd6fcd9['as'],'attributes':_0xd6fcd9[_0xd3b5('0x20')],'include':_0xd6fcd9[_0xd3b5('0x21')]?_[_0xd3b5('0x22')](_0xd6fcd9['include'],function(_0x550bb3){return{'model':db[_0x550bb3['model']],'as':_0x550bb3['as'],'attributes':_0x550bb3[_0xd3b5('0x20')],'include':_0x550bb3['include']?_[_0xd3b5('0x22')](_0x550bb3[_0xd3b5('0x21')],function(_0x237827){return{'model':db[_0x237827['model']],'as':_0x237827['as'],'attributes':_0x237827[_0xd3b5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd3b5('0x10')](function(_0x2e352c){logger[_0xd3b5('0x11')](_0xd3b5('0x1b'),_0x5ef351);logger[_0xd3b5('0x14')](_0xd3b5('0x1b'),_0x5ef351,JSON[_0xd3b5('0x16')](_0x2e352c));_0x51d120(_0x2e352c);})[_0xd3b5('0x24')](function(_0x2441ab){logger[_0xd3b5('0x17')](_0xd3b5('0x1b'),_0x2441ab[_0xd3b5('0x19')],_0x5ef351);_0x59cbd4(_0x2c836d[_0xd3b5('0x17')](0x1f4,_0x2441ab[_0xd3b5('0x19')]));});});};exports[_0xd3b5('0x25')]=function(_0x5c5fe2){var _0x5c864f=this;return new Promise(function(_0x309395,_0x1c6652){return db[_0xd3b5('0x1c')][_0xd3b5('0x26')]({'raw':_0x5c5fe2['options']?_0x5c5fe2[_0xd3b5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c5fe2[_0xd3b5('0x1d')]?_0x5c5fe2[_0xd3b5('0x1d')][_0xd3b5('0x1f')]||null:null,'attributes':_0x5c5fe2[_0xd3b5('0x1d')]?_0x5c5fe2[_0xd3b5('0x1d')][_0xd3b5('0x20')]||null:null,'include':_0x5c5fe2[_0xd3b5('0x1d')]?_0x5c5fe2[_0xd3b5('0x1d')]['include']?_['map'](_0x5c5fe2[_0xd3b5('0x1d')]['include'],function(_0x5234cd){return{'model':db[_0x5234cd['model']],'as':_0x5234cd['as'],'attributes':_0x5234cd[_0xd3b5('0x20')],'include':_0x5234cd['include']?_[_0xd3b5('0x22')](_0x5234cd[_0xd3b5('0x21')],function(_0x289333){return{'model':db[_0x289333['model']],'as':_0x289333['as'],'attributes':_0x289333['attributes'],'include':_0x289333[_0xd3b5('0x21')]?_[_0xd3b5('0x22')](_0x289333[_0xd3b5('0x21')],function(_0x42359a){return{'model':db[_0x42359a['model']],'as':_0x42359a['as'],'attributes':_0x42359a[_0xd3b5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd3b5('0x10')](function(_0x56538d){logger['info'](_0xd3b5('0x25'),_0x5c5fe2);logger[_0xd3b5('0x14')](_0xd3b5('0x25'),_0x5c5fe2,JSON['stringify'](_0x56538d));_0x309395(_0x56538d);})[_0xd3b5('0x24')](function(_0x5e281c){logger[_0xd3b5('0x17')]('ShowWhatsappQueue',_0x5e281c[_0xd3b5('0x19')],_0x5c5fe2);_0x1c6652(_0x5c864f['error'](0x1f4,_0x5e281c[_0xd3b5('0x19')]));});});}; \ No newline at end of file +var _0xe370=['then','request\x20sent','debug','error','WhatsappQueue,\x20%s,\x20%s','message','info','result','catch','WhatsappQueue','findAll','options','raw','where','include','model','attributes','map','GetWhatsappQueue','ShowWhatsappQueue','find','stringify','lodash','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request'];(function(_0x4b401b,_0x2ac8d1){var _0x196abd=function(_0x983cc0){while(--_0x983cc0){_0x4b401b['push'](_0x4b401b['shift']());}};_0x196abd(++_0x2ac8d1);}(_0xe370,0x120));var _0x0e37=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0xe370[_0x1deb72];return _0x18bbdf;};'use strict';var _=require(_0x0e37('0x0'));var util=require(_0x0e37('0x1'));var moment=require(_0x0e37('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0e37('0x3'));var logger=require(_0x0e37('0x4'))('rpc');var config=require(_0x0e37('0x5'));var jayson=require(_0x0e37('0x6'));var client=jayson[_0x0e37('0x7')][_0x0e37('0x8')]({'port':0x232a});config['redis']=_[_0x0e37('0x9')](config[_0x0e37('0xa')],{'host':_0x0e37('0xb'),'port':0x18eb});var socket=require(_0x0e37('0xc'))(new Redis(config['redis']));require(_0x0e37('0xd'))[_0x0e37('0xe')](socket);function respondWithRpcPromise(_0xda6c28,_0x225073,_0x39b4bf){return new BPromise(function(_0x124bb7,_0xa6c144){return client[_0x0e37('0xf')](_0xda6c28,_0x39b4bf)[_0x0e37('0x10')](function(_0x426300){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x225073,_0x0e37('0x11'));logger[_0x0e37('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x225073,_0x0e37('0x11'),JSON['stringify'](_0x426300));if(_0x426300[_0x0e37('0x13')]){if(_0x426300['error']['code']===0x1f4){logger[_0x0e37('0x13')](_0x0e37('0x14'),_0x225073,_0x426300[_0x0e37('0x13')]['message']);return _0xa6c144(_0x426300[_0x0e37('0x13')][_0x0e37('0x15')]);}logger[_0x0e37('0x13')](_0x0e37('0x14'),_0x225073,_0x426300[_0x0e37('0x13')]['message']);return _0x124bb7(_0x426300[_0x0e37('0x13')][_0x0e37('0x15')]);}else{logger[_0x0e37('0x16')](_0x0e37('0x14'),_0x225073,_0x0e37('0x11'));_0x124bb7(_0x426300[_0x0e37('0x17')][_0x0e37('0x15')]);}})[_0x0e37('0x18')](function(_0x1251b8){logger[_0x0e37('0x13')](_0x0e37('0x14'),_0x225073,_0x1251b8);_0xa6c144(_0x1251b8);});});}exports['GetWhatsappQueue']=function(_0x4496e2){var _0x1da8b7=this;return new Promise(function(_0x5171f5,_0x6e2679){return db[_0x0e37('0x19')][_0x0e37('0x1a')]({'raw':_0x4496e2[_0x0e37('0x1b')]?_0x4496e2[_0x0e37('0x1b')][_0x0e37('0x1c')]===undefined?!![]:![]:!![],'where':_0x4496e2[_0x0e37('0x1b')]?_0x4496e2[_0x0e37('0x1b')][_0x0e37('0x1d')]||null:null,'attributes':_0x4496e2['options']?_0x4496e2['options']['attributes']||null:null,'limit':_0x4496e2[_0x0e37('0x1b')]?_0x4496e2[_0x0e37('0x1b')]['limit']||null:null,'include':_0x4496e2[_0x0e37('0x1b')]?_0x4496e2[_0x0e37('0x1b')][_0x0e37('0x1e')]?_['map'](_0x4496e2['options'][_0x0e37('0x1e')],function(_0x192001){return{'model':db[_0x192001[_0x0e37('0x1f')]],'as':_0x192001['as'],'attributes':_0x192001[_0x0e37('0x20')],'include':_0x192001[_0x0e37('0x1e')]?_[_0x0e37('0x21')](_0x192001['include'],function(_0x39f6f4){return{'model':db[_0x39f6f4['model']],'as':_0x39f6f4['as'],'attributes':_0x39f6f4['attributes'],'include':_0x39f6f4[_0x0e37('0x1e')]?_['map'](_0x39f6f4['include'],function(_0xdffc49){return{'model':db[_0xdffc49[_0x0e37('0x1f')]],'as':_0xdffc49['as'],'attributes':_0xdffc49['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e37('0x10')](function(_0x481cf6){logger[_0x0e37('0x16')](_0x0e37('0x22'),_0x4496e2);logger['debug']('GetWhatsappQueue',_0x4496e2,JSON['stringify'](_0x481cf6));_0x5171f5(_0x481cf6);})[_0x0e37('0x18')](function(_0x1b193c){logger[_0x0e37('0x13')]('GetWhatsappQueue',_0x1b193c[_0x0e37('0x15')],_0x4496e2);_0x6e2679(_0x1da8b7[_0x0e37('0x13')](0x1f4,_0x1b193c[_0x0e37('0x15')]));});});};exports[_0x0e37('0x23')]=function(_0x132b8a){var _0xad5963=this;return new Promise(function(_0xc8bb70,_0x432f3e){return db[_0x0e37('0x19')][_0x0e37('0x24')]({'raw':_0x132b8a[_0x0e37('0x1b')]?_0x132b8a[_0x0e37('0x1b')][_0x0e37('0x1c')]===undefined?!![]:![]:!![],'where':_0x132b8a[_0x0e37('0x1b')]?_0x132b8a[_0x0e37('0x1b')]['where']||null:null,'attributes':_0x132b8a[_0x0e37('0x1b')]?_0x132b8a['options'][_0x0e37('0x20')]||null:null,'include':_0x132b8a[_0x0e37('0x1b')]?_0x132b8a[_0x0e37('0x1b')][_0x0e37('0x1e')]?_['map'](_0x132b8a['options'][_0x0e37('0x1e')],function(_0x457527){return{'model':db[_0x457527[_0x0e37('0x1f')]],'as':_0x457527['as'],'attributes':_0x457527[_0x0e37('0x20')],'include':_0x457527[_0x0e37('0x1e')]?_[_0x0e37('0x21')](_0x457527['include'],function(_0x17e048){return{'model':db[_0x17e048[_0x0e37('0x1f')]],'as':_0x17e048['as'],'attributes':_0x17e048[_0x0e37('0x20')],'include':_0x17e048[_0x0e37('0x1e')]?_['map'](_0x17e048['include'],function(_0x46e90e){return{'model':db[_0x46e90e['model']],'as':_0x46e90e['as'],'attributes':_0x46e90e[_0x0e37('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0e37('0x10')](function(_0x3fac5f){logger[_0x0e37('0x16')](_0x0e37('0x23'),_0x132b8a);logger[_0x0e37('0x12')](_0x0e37('0x23'),_0x132b8a,JSON[_0x0e37('0x25')](_0x3fac5f));_0xc8bb70(_0x3fac5f);})[_0x0e37('0x18')](function(_0x381c8e){logger[_0x0e37('0x13')](_0x0e37('0x23'),_0x381c8e[_0x0e37('0x15')],_0x132b8a);_0x432f3e(_0xad5963[_0x0e37('0x13')](0x1f4,_0x381c8e[_0x0e37('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index cfd39d9..9a0530a 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 _0xd970=['./whatsappQueue.events','save','remove','update','removeListener','register'];(function(_0x5cd552,_0xab7028){var _0x22af69=function(_0xc2ee38){while(--_0xc2ee38){_0x5cd552['push'](_0x5cd552['shift']());}};_0x22af69(++_0xab7028);}(_0xd970,0x12c));var _0x0d97=function(_0x5d89b6,_0x4393bb){_0x5d89b6=_0x5d89b6-0x0;var _0x513786=_0xd970[_0x5d89b6];return _0x513786;};'use strict';var WhatsappQueueEvents=require(_0x0d97('0x0'));var events=[_0x0d97('0x1'),_0x0d97('0x2'),_0x0d97('0x3')];function createListener(_0x483c1c,_0x5604d4){return function(_0x149a29){_0x5604d4['emit'](_0x483c1c,_0x149a29);};}function removeListener(_0x5a5295,_0x177326){return function(){WhatsappQueueEvents[_0x0d97('0x4')](_0x5a5295,_0x177326);};}exports[_0x0d97('0x5')]=function(_0x10b9b8){for(var _0x233f5e=0x0,_0x20472b=events['length'];_0x233f5e<_0x20472b;_0x233f5e++){var _0x2cbb52=events[_0x233f5e];var _0x11275e=createListener('whatsappQueue:'+_0x2cbb52,_0x10b9b8);WhatsappQueueEvents['on'](_0x2cbb52,_0x11275e);}}; \ No newline at end of file +var _0xe9f4=['removeListener','register','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0x10ae2a,_0x93f6bb){var _0x1a942a=function(_0x23c45c){while(--_0x23c45c){_0x10ae2a['push'](_0x10ae2a['shift']());}};_0x1a942a(++_0x93f6bb);}(_0xe9f4,0xf3));var _0x4e9f=function(_0x281d89,_0x46a6e4){_0x281d89=_0x281d89-0x0;var _0x2f6861=_0xe9f4[_0x281d89];return _0x2f6861;};'use strict';var WhatsappQueueEvents=require(_0x4e9f('0x0'));var events=[_0x4e9f('0x1'),'remove',_0x4e9f('0x2')];function createListener(_0x28700d,_0x230f36){return function(_0x28d1e4){_0x230f36['emit'](_0x28700d,_0x28d1e4);};}function removeListener(_0x4853b7,_0xdb0929){return function(){WhatsappQueueEvents[_0x4e9f('0x3')](_0x4853b7,_0xdb0929);};}exports[_0x4e9f('0x4')]=function(_0x55a834){for(var _0x4d92a1=0x0,_0x1f4570=events['length'];_0x4d92a1<_0x1f4570;_0x4d92a1++){var _0x182deb=events[_0x4d92a1];var _0x44ac07=createListener(_0x4e9f('0x5')+_0x182deb,_0x55a834);WhatsappQueueEvents['on'](_0x182deb,_0x44ac07);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index a968554..2d88db6 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 _0xe7c3=['update','/:id','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','describe','create'];(function(_0x9fbfb7,_0x2b628e){var _0x116172=function(_0x5aeda1){while(--_0x5aeda1){_0x9fbfb7['push'](_0x9fbfb7['shift']());}};_0x116172(++_0x2b628e);}(_0xe7c3,0x1a8));var _0x3e7c=function(_0x590a78,_0x2b9403){_0x590a78=_0x590a78-0x0;var _0x3bd390=_0xe7c3[_0x590a78];return _0x3bd390;};'use strict';var multer=require(_0x3e7c('0x0'));var util=require(_0x3e7c('0x1'));var path=require(_0x3e7c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3e7c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3e7c('0x4'));var config=require(_0x3e7c('0x5'));var controller=require(_0x3e7c('0x6'));router[_0x3e7c('0x7')]('/',auth[_0x3e7c('0x8')](),controller['index']);router['get']('/describe',auth[_0x3e7c('0x8')](),controller[_0x3e7c('0x9')]);router[_0x3e7c('0x7')]('/:id',auth[_0x3e7c('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3e7c('0xa')]);router['put']('/:id',auth[_0x3e7c('0x8')](),controller[_0x3e7c('0xb')]);router['delete'](_0x3e7c('0xc'),auth[_0x3e7c('0x8')](),controller[_0x3e7c('0xd')]);module[_0x3e7c('0xe')]=router; \ No newline at end of file +var _0x52b3=['/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x41180a,_0x5554db){var _0x38936d=function(_0x34b991){while(--_0x34b991){_0x41180a['push'](_0x41180a['shift']());}};_0x38936d(++_0x5554db);}(_0x52b3,0xb3));var _0x352b=function(_0x11c009,_0x7f415b){_0x11c009=_0x11c009-0x0;var _0x59d9a4=_0x52b3[_0x11c009];return _0x59d9a4;};'use strict';var multer=require(_0x352b('0x0'));var util=require(_0x352b('0x1'));var path=require('path');var timeout=require(_0x352b('0x2'));var express=require('express');var router=express[_0x352b('0x3')]();var fs_extra=require(_0x352b('0x4'));var auth=require(_0x352b('0x5'));var interaction=require(_0x352b('0x6'));var config=require(_0x352b('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x352b('0x8')]('/',auth[_0x352b('0x9')](),controller['index']);router[_0x352b('0x8')]('/describe',auth[_0x352b('0x9')](),controller[_0x352b('0xa')]);router[_0x352b('0x8')](_0x352b('0xb'),auth['isAuthenticated'](),controller[_0x352b('0xc')]);router[_0x352b('0xd')]('/',auth[_0x352b('0x9')](),controller[_0x352b('0xe')]);router[_0x352b('0xf')]('/:id',auth[_0x352b('0x9')](),controller[_0x352b('0x10')]);router[_0x352b('0x11')]('/:id',auth[_0x352b('0x9')](),controller['destroy']);module[_0x352b('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index ea75e6a..76b9a31 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0xae6a93,_0x29c305){var _0x3d56cd=function(_0x5341fc){while(--_0x5341fc){_0xae6a93['push'](_0xae6a93['shift']());}};_0x3d56cd(++_0x29c305);}(_0x7a54,0x106));var _0x47a5=function(_0x273b13,_0x18f356){_0x273b13=_0x273b13-0x0;var _0x2b9a1a=_0x7a54[_0x273b13];return _0x2b9a1a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5a6da3,_0x4a701b){var _0x5eb133=function(_0x12e15c){while(--_0x12e15c){_0x5a6da3['push'](_0x5a6da3['shift']());}};_0x5eb133(++_0x4a701b);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 45b888a..54818f1 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 _0x14a0=['mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x14a0,0x8e));var _0x014a=function(_0x47aa0e,_0x1598aa){_0x47aa0e=_0x47aa0e-0x0;var _0x3ee41d=_0x14a0[_0x47aa0e];return _0x3ee41d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];function respondWithStatusCode(_0x43bfeb,_0x1bcd1){_0x1bcd1=_0x1bcd1||0xcc;return function(_0x20cb56){if(_0x20cb56){return _0x43bfeb[_0x014a('0x14')](_0x1bcd1);}return _0x43bfeb[_0x014a('0x15')](_0x1bcd1)[_0x014a('0x16')]();};}function respondWithResult(_0x71535d,_0x45cd80){_0x45cd80=_0x45cd80||0xc8;return function(_0x3c54c8){if(_0x3c54c8){return _0x71535d['status'](_0x45cd80)[_0x014a('0x17')](_0x3c54c8);}};}function respondWithFilteredResult(_0x3cf92f,_0x59f207){return function(_0x3a836f){if(_0x3a836f){var _0x128c46=typeof _0x59f207['offset']===_0x014a('0x18')&&typeof _0x59f207[_0x014a('0x19')]===_0x014a('0x18');var _0x12da95=_0x3a836f[_0x014a('0x1a')];var _0x12d339=_0x128c46?0x0:_0x59f207[_0x014a('0x1b')];var _0x263b07=_0x128c46?_0x3a836f[_0x014a('0x1a')]:_0x59f207[_0x014a('0x1b')]+_0x59f207[_0x014a('0x19')];var _0x89e132;if(_0x263b07>=_0x12da95){_0x263b07=_0x12da95;_0x89e132=0xc8;}else{_0x89e132=0xce;}_0x3cf92f[_0x014a('0x15')](_0x89e132);return _0x3cf92f[_0x014a('0x1c')]('Content-Range',_0x12d339+'-'+_0x263b07+'/'+_0x12da95)[_0x014a('0x17')](_0x3a836f);}return null;};}function patchUpdates(_0x109a9c){return function(_0x11065f){try{jsonpatch[_0x014a('0x1d')](_0x11065f,_0x109a9c,!![]);}catch(_0xc9a563){return BPromise[_0x014a('0x1e')](_0xc9a563);}return _0x11065f[_0x014a('0x1f')]();};}function saveUpdates(_0x3dd2d0,_0x290b86){return function(_0x486e66){if(_0x486e66){return _0x486e66[_0x014a('0x20')](_0x3dd2d0)['then'](function(_0x1a1318){return _0x1a1318;});}return null;};}function removeEntity(_0x26718b,_0x44d921){return function(_0x36d52b){if(_0x36d52b){return _0x36d52b[_0x014a('0x21')]()[_0x014a('0x22')](function(){_0x26718b[_0x014a('0x15')](0xcc)[_0x014a('0x16')]();});}};}function handleEntityNotFound(_0x165a42,_0x4c2627){return function(_0x3b4b92){if(!_0x3b4b92){_0x165a42['sendStatus'](0x194);}return _0x3b4b92;};}function handleError(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0x1f4;return function(_0x4f1c44){logger['error'](_0x4f1c44[_0x014a('0x23')]);if(_0x4f1c44[_0x014a('0x24')]){delete _0x4f1c44[_0x014a('0x24')];}_0x39a432['status'](_0x28701e)[_0x014a('0x25')](_0x4f1c44);};}exports[_0x014a('0x26')]=function(_0x598179,_0x31dc95){var _0x2560a6={},_0x496040={},_0x4f9c1c={'count':0x0,'rows':[]};var _0x397850=_[_0x014a('0x27')](db[_0x014a('0x28')][_0x014a('0x29')],function(_0x4ea00c){return{'name':_0x4ea00c[_0x014a('0x2a')],'type':_0x4ea00c[_0x014a('0x2b')][_0x014a('0x2c')]};});_0x496040[_0x014a('0x2d')]=_[_0x014a('0x27')](_0x397850,_0x014a('0x24'));_0x496040[_0x014a('0x2e')]=_[_0x014a('0x2f')](_0x598179[_0x014a('0x2e')]);_0x496040[_0x014a('0x30')]=_[_0x014a('0x31')](_0x496040['model'],_0x496040[_0x014a('0x2e')]);_0x2560a6[_0x014a('0x32')]=_[_0x014a('0x31')](_0x496040[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x598179[_0x014a('0x2e')][_0x014a('0x33')]));_0x2560a6['attributes']=_0x2560a6[_0x014a('0x32')][_0x014a('0x34')]?_0x2560a6['attributes']:_0x496040[_0x014a('0x2d')];if(!_0x598179[_0x014a('0x2e')][_0x014a('0x35')](_0x014a('0x36'))){_0x2560a6[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x598179[_0x014a('0x2e')][_0x014a('0x19')]);_0x2560a6['offset']=qs[_0x014a('0x1b')](_0x598179[_0x014a('0x2e')][_0x014a('0x1b')]);}_0x2560a6[_0x014a('0x37')]=qs['sort'](_0x598179[_0x014a('0x2e')][_0x014a('0x38')]);_0x2560a6[_0x014a('0x39')]=qs[_0x014a('0x30')](_[_0x014a('0x3a')](_0x598179[_0x014a('0x2e')],_0x496040[_0x014a('0x30')]),_0x397850);if(_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]){_0x2560a6['where']=_[_0x014a('0x3c')](_0x2560a6['where'],{'$or':_[_0x014a('0x27')](_0x397850,function(_0xc11492){if(_0xc11492[_0x014a('0x2b')]!==_0x014a('0x3d')){var _0x43376c={};_0x43376c[_0xc11492['name']]={'$like':'%'+_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]+'%'};return _0x43376c;}})});}_0x2560a6=_['merge']({},_0x2560a6,_0x598179[_0x014a('0x3e')]);var _0x2990df={'where':_0x2560a6[_0x014a('0x39')]};return db[_0x014a('0x28')][_0x014a('0x1a')](_0x2990df)[_0x014a('0x22')](function(_0x17b1b6){_0x4f9c1c[_0x014a('0x1a')]=_0x17b1b6;if(_0x598179[_0x014a('0x2e')]['includeAll']){_0x2560a6[_0x014a('0x3f')]=[{'all':!![]}];}return db[_0x014a('0x28')][_0x014a('0x40')](_0x2560a6);})[_0x014a('0x22')](function(_0x5f1a91){_0x4f9c1c[_0x014a('0x41')]=_0x5f1a91;return _0x4f9c1c;})[_0x014a('0x22')](respondWithFilteredResult(_0x31dc95,_0x2560a6))[_0x014a('0x42')](handleError(_0x31dc95,null));};exports[_0x014a('0x43')]=function(_0x1dc647,_0x430a56){var _0x5f2969={'raw':!![],'where':{'id':_0x1dc647[_0x014a('0x44')]['id']}},_0x361866={};_0x361866['model']=_[_0x014a('0x2f')](db[_0x014a('0x28')][_0x014a('0x29')]);_0x361866['query']=_[_0x014a('0x2f')](_0x1dc647['query']);_0x361866['filters']=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],_0x361866['query']);_0x5f2969[_0x014a('0x32')]=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x1dc647[_0x014a('0x2e')][_0x014a('0x33')]));_0x5f2969['attributes']=_0x5f2969[_0x014a('0x32')][_0x014a('0x34')]?_0x5f2969[_0x014a('0x32')]:_0x361866['model'];if(_0x1dc647['query'][_0x014a('0x45')]){_0x5f2969['include']=[{'all':!![]}];}_0x5f2969=_['merge']({},_0x5f2969,_0x1dc647[_0x014a('0x3e')]);return db['WhatsappQueueReport'][_0x014a('0x46')](_0x5f2969)[_0x014a('0x22')](handleEntityNotFound(_0x430a56,null))[_0x014a('0x22')](respondWithResult(_0x430a56,null))['catch'](handleError(_0x430a56,null));};exports[_0x014a('0x47')]=function(_0x23be18,_0x12cd9b){return db[_0x014a('0x28')][_0x014a('0x47')](_0x23be18[_0x014a('0x48')],{})['then'](respondWithResult(_0x12cd9b,0xc9))[_0x014a('0x42')](handleError(_0x12cd9b,null));};exports[_0x014a('0x20')]=function(_0x5a861c,_0x1a4df9){if(_0x5a861c[_0x014a('0x48')]['id']){delete _0x5a861c[_0x014a('0x48')]['id'];}return db[_0x014a('0x28')][_0x014a('0x46')]({'where':{'id':_0x5a861c[_0x014a('0x44')]['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x1a4df9,null))[_0x014a('0x22')](saveUpdates(_0x5a861c['body'],null))[_0x014a('0x22')](respondWithResult(_0x1a4df9,null))[_0x014a('0x42')](handleError(_0x1a4df9,null));};exports[_0x014a('0x21')]=function(_0x135e7e,_0x312c7a){return db['WhatsappQueueReport'][_0x014a('0x46')]({'where':{'id':_0x135e7e['params']['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x312c7a,null))[_0x014a('0x22')](removeEntity(_0x312c7a,null))[_0x014a('0x42')](handleError(_0x312c7a,null));};exports[_0x014a('0x49')]=function(_0x3caa6e,_0x4f8547){return db['WhatsappQueueReport']['describe']()['then'](respondWithResult(_0x4f8547,null))[_0x014a('0x42')](handleError(_0x4f8547,null));}; \ No newline at end of file +var _0xa902=['ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv'];(function(_0x3da767,_0x64d7b8){var _0x200597=function(_0x45e9ac){while(--_0x45e9ac){_0x3da767['push'](_0x3da767['shift']());}};_0x200597(++_0x64d7b8);}(_0xa902,0x8d));var _0x2a90=function(_0x2b213c,_0x1227ac){_0x2b213c=_0x2b213c-0x0;var _0x3f1c78=_0xa902[_0x2b213c];return _0x3f1c78;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x2a212c,_0x1303d9){return function(_0x29ed73){if(!_0x29ed73){_0x2a212c[_0x2a90('0x17')](0x194);}return _0x29ed73;};}function handleError(_0x48c2f9,_0x27f883){_0x27f883=_0x27f883||0x1f4;return function(_0x17f978){logger[_0x2a90('0x27')](_0x17f978[_0x2a90('0x28')]);if(_0x17f978[_0x2a90('0x29')]){delete _0x17f978['name'];}_0x48c2f9['status'](_0x27f883)[_0x2a90('0x2a')](_0x17f978);};}exports['index']=function(_0x53391e,_0x4969c3){var _0x2d83b3={},_0x3c78f5={},_0x595638={'count':0x0,'rows':[]};var _0x5bd700=_[_0x2a90('0x2b')](db['WhatsappQueueReport'][_0x2a90('0x2c')],function(_0x6892e1){return{'name':_0x6892e1[_0x2a90('0x2d')],'type':_0x6892e1[_0x2a90('0x2e')][_0x2a90('0x2f')]};});_0x3c78f5[_0x2a90('0x30')]=_[_0x2a90('0x2b')](_0x5bd700,'name');_0x3c78f5[_0x2a90('0x31')]=_[_0x2a90('0x32')](_0x53391e[_0x2a90('0x31')]);_0x3c78f5['filters']=_[_0x2a90('0x33')](_0x3c78f5[_0x2a90('0x30')],_0x3c78f5[_0x2a90('0x31')]);_0x2d83b3[_0x2a90('0x34')]=_['intersection'](_0x3c78f5[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x53391e[_0x2a90('0x31')][_0x2a90('0x35')]));_0x2d83b3[_0x2a90('0x34')]=_0x2d83b3[_0x2a90('0x34')]['length']?_0x2d83b3[_0x2a90('0x34')]:_0x3c78f5[_0x2a90('0x30')];if(!_0x53391e[_0x2a90('0x31')][_0x2a90('0x36')]('nolimit')){_0x2d83b3[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x53391e['query'][_0x2a90('0x1d')]);_0x2d83b3[_0x2a90('0x1b')]=qs['offset'](_0x53391e['query'][_0x2a90('0x1b')]);}_0x2d83b3[_0x2a90('0x37')]=qs[_0x2a90('0x38')](_0x53391e['query'][_0x2a90('0x38')]);_0x2d83b3['where']=qs[_0x2a90('0x39')](_['pick'](_0x53391e[_0x2a90('0x31')],_0x3c78f5['filters']),_0x5bd700);if(_0x53391e['query'][_0x2a90('0x3a')]){_0x2d83b3['where']=_[_0x2a90('0x3b')](_0x2d83b3[_0x2a90('0x3c')],{'$or':_[_0x2a90('0x2b')](_0x5bd700,function(_0x573aee){if(_0x573aee[_0x2a90('0x2e')]!==_0x2a90('0x3d')){var _0x3be438={};_0x3be438[_0x573aee['name']]={'$like':'%'+_0x53391e[_0x2a90('0x31')][_0x2a90('0x3a')]+'%'};return _0x3be438;}})});}_0x2d83b3=_[_0x2a90('0x3b')]({},_0x2d83b3,_0x53391e['options']);var _0x1aa096={'where':_0x2d83b3[_0x2a90('0x3c')]};return db['WhatsappQueueReport'][_0x2a90('0x1e')](_0x1aa096)[_0x2a90('0x25')](function(_0x2a6bea){_0x595638[_0x2a90('0x1e')]=_0x2a6bea;if(_0x53391e[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x2d83b3[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x41')](_0x2d83b3);})[_0x2a90('0x25')](function(_0x45b41c){_0x595638[_0x2a90('0x42')]=_0x45b41c;return _0x595638;})[_0x2a90('0x25')](respondWithFilteredResult(_0x4969c3,_0x2d83b3))[_0x2a90('0x43')](handleError(_0x4969c3,null));};exports['show']=function(_0x45cbc2,_0x3a70fe){var _0x528b41={'raw':!![],'where':{'id':_0x45cbc2[_0x2a90('0x44')]['id']}},_0x1045bb={};_0x1045bb[_0x2a90('0x30')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')]['rawAttributes']);_0x1045bb[_0x2a90('0x31')]=_['keys'](_0x45cbc2[_0x2a90('0x31')]);_0x1045bb['filters']=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],_0x1045bb[_0x2a90('0x31')]);_0x528b41[_0x2a90('0x34')]=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x45cbc2['query']['fields']));_0x528b41[_0x2a90('0x34')]=_0x528b41[_0x2a90('0x34')][_0x2a90('0x45')]?_0x528b41[_0x2a90('0x34')]:_0x1045bb[_0x2a90('0x30')];if(_0x45cbc2[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x528b41[_0x2a90('0x3f')]=[{'all':!![]}];}_0x528b41=_['merge']({},_0x528b41,_0x45cbc2[_0x2a90('0x46')]);return db['WhatsappQueueReport'][_0x2a90('0x47')](_0x528b41)[_0x2a90('0x25')](handleEntityNotFound(_0x3a70fe,null))['then'](respondWithResult(_0x3a70fe,null))[_0x2a90('0x43')](handleError(_0x3a70fe,null));};exports[_0x2a90('0x48')]=function(_0x280e63,_0x1d55db){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x280e63[_0x2a90('0x49')],{})['then'](respondWithResult(_0x1d55db,0xc9))['catch'](handleError(_0x1d55db,null));};exports[_0x2a90('0x24')]=function(_0x2611d0,_0x42c890){if(_0x2611d0[_0x2a90('0x49')]['id']){delete _0x2611d0[_0x2a90('0x49')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x2611d0[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x42c890,null))['then'](saveUpdates(_0x2611d0['body'],null))['then'](respondWithResult(_0x42c890,null))[_0x2a90('0x43')](handleError(_0x42c890,null));};exports['destroy']=function(_0x370da3,_0x3dfe72){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x370da3[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3dfe72,null))['then'](removeEntity(_0x3dfe72,null))[_0x2a90('0x43')](handleError(_0x3dfe72,null));};exports[_0x2a90('0x4a')]=function(_0x48d3bc,_0x265769){return db['WhatsappQueueReport']['describe']()[_0x2a90('0x25')](respondWithResult(_0x265769,null))[_0x2a90('0x43')](handleError(_0x265769,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 87db273..f3893ec 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 _0xb046=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f628b,_0x893c50){var _0x4676ad=function(_0x189c71){while(--_0x189c71){_0x2f628b['push'](_0x2f628b['shift']());}};_0x4676ad(++_0x893c50);}(_0xb046,0x1de));var _0x6b04=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0xb046[_0x480bc8];return _0x28c245;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6b04('0x0'));var moment=require('moment');var BPromise=require(_0x6b04('0x1'));var rp=require(_0x6b04('0x2'));var fs=require('fs');var path=require(_0x6b04('0x3'));var rimraf=require(_0x6b04('0x4'));var config=require(_0x6b04('0x5'));var attributes=require(_0x6b04('0x6'));module[_0x6b04('0x7')]=function(_0x66afbd,_0x28e09e){return _0x66afbd[_0x6b04('0x8')](_0x6b04('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6b04('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c17=['../../config/logger','api','moment','bluebird','path','../../config/environment','define','WhatsappQueueReport','uniqueid','lodash','util'];(function(_0x4b46c3,_0x3b506c){var _0x2816c5=function(_0x36a208){while(--_0x36a208){_0x4b46c3['push'](_0x4b46c3['shift']());}};_0x2816c5(++_0x3b506c);}(_0x8c17,0xcf));var _0x78c1=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x8c17[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x78c1('0x0'));var util=require(_0x78c1('0x1'));var logger=require(_0x78c1('0x2'))(_0x78c1('0x3'));var moment=require(_0x78c1('0x4'));var BPromise=require(_0x78c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78c1('0x6'));var rimraf=require('rimraf');var config=require(_0x78c1('0x7'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x3eeb79,_0x2168d3){return _0x3eeb79[_0x78c1('0x8')](_0x78c1('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x78c1('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index ed949df..0086863 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 _0xa973=['UpdateWhatsappQueueReport','update','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','options','raw','then','CreateWhatsappQueueReport','debug'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa973,0x1ef));var _0x3a97=function(_0x9572ff,_0x188aba){_0x9572ff=_0x9572ff-0x0;var _0x398c8a=_0xa973[_0x9572ff];return _0x398c8a;};'use strict';var _=require(_0x3a97('0x0'));var util=require(_0x3a97('0x1'));var moment=require(_0x3a97('0x2'));var BPromise=require(_0x3a97('0x3'));var rs=require(_0x3a97('0x4'));var fs=require('fs');var Redis=require(_0x3a97('0x5'));var db=require(_0x3a97('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a97('0x7'))(_0x3a97('0x8'));var config=require(_0x3a97('0x9'));var jayson=require(_0x3a97('0xa'));var client=jayson[_0x3a97('0xb')][_0x3a97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x167392,_0x3bad8a,_0x33f689){return new BPromise(function(_0x8ce879,_0xb5423d){return client['request'](_0x167392,_0x33f689)['then'](function(_0x71a4c5){logger[_0x3a97('0xd')](_0x3a97('0xe'),_0x3bad8a,_0x3a97('0xf'));logger['debug'](_0x3a97('0x10'),_0x3bad8a,_0x3a97('0xf'),JSON[_0x3a97('0x11')](_0x71a4c5));if(_0x71a4c5[_0x3a97('0x12')]){if(_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x13')]===0x1f4){logger['error'](_0x3a97('0xe'),_0x3bad8a,_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);return _0xb5423d(_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);}logger[_0x3a97('0x12')](_0x3a97('0xe'),_0x3bad8a,_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);return _0x8ce879(_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);}else{logger[_0x3a97('0xd')](_0x3a97('0xe'),_0x3bad8a,_0x3a97('0xf'));_0x8ce879(_0x71a4c5[_0x3a97('0x15')][_0x3a97('0x14')]);}})[_0x3a97('0x16')](function(_0xb3d645){logger[_0x3a97('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3bad8a,_0xb3d645);_0xb5423d(_0xb3d645);});});}exports['CreateWhatsappQueueReport']=function(_0x4fffac){var _0x446344=this;return new Promise(function(_0x28b340,_0x2eaefd){return db[_0x3a97('0x17')][_0x3a97('0x18')](_0x4fffac['body'],{'raw':_0x4fffac[_0x3a97('0x19')]?_0x4fffac[_0x3a97('0x19')][_0x3a97('0x1a')]===undefined?!![]:![]:!![]})[_0x3a97('0x1b')](function(_0xdfe1da){logger[_0x3a97('0xd')](_0x3a97('0x1c'),_0x4fffac);logger[_0x3a97('0x1d')](_0x3a97('0x1c'),_0x4fffac,JSON[_0x3a97('0x11')](_0xdfe1da));_0x28b340(_0xdfe1da);})[_0x3a97('0x16')](function(_0x5b4a0c){logger['error'](_0x3a97('0x1c'),_0x5b4a0c[_0x3a97('0x14')],_0x4fffac);_0x2eaefd(_0x446344[_0x3a97('0x12')](0x1f4,_0x5b4a0c[_0x3a97('0x14')]));});});};exports[_0x3a97('0x1e')]=function(_0x5da384){var _0x42d094=this;return new Promise(function(_0x40aed7,_0x2a58bc){return db[_0x3a97('0x17')][_0x3a97('0x1f')](_0x5da384[_0x3a97('0x20')],{'raw':_0x5da384[_0x3a97('0x19')]?_0x5da384['options'][_0x3a97('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5da384[_0x3a97('0x19')]?_0x5da384[_0x3a97('0x19')][_0x3a97('0x21')]||null:null,'attributes':_0x5da384[_0x3a97('0x19')]?_0x5da384[_0x3a97('0x19')][_0x3a97('0x22')]||null:null,'limit':_0x5da384[_0x3a97('0x19')]?_0x5da384['options']['limit']||null:null})[_0x3a97('0x1b')](function(_0x4e6c50){logger[_0x3a97('0xd')](_0x3a97('0x1e'),_0x5da384);logger[_0x3a97('0x1d')](_0x3a97('0x1e'),_0x5da384,JSON[_0x3a97('0x11')](_0x4e6c50));_0x40aed7(_0x4e6c50);})[_0x3a97('0x16')](function(_0x42e550){logger[_0x3a97('0x12')](_0x3a97('0x1e'),_0x42e550[_0x3a97('0x14')],_0x5da384);_0x2a58bc(_0x42d094[_0x3a97('0x12')](0x1f4,_0x42e550[_0x3a97('0x14')]));});});}; \ No newline at end of file +var _0x791c=['request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','catch','WhatsappQueueReport','create','options','raw','debug','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','body','where','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x1891e2,_0x1dfa71){var _0x18b839=function(_0x2289a6){while(--_0x2289a6){_0x1891e2['push'](_0x1891e2['shift']());}};_0x18b839(++_0x1dfa71);}(_0x791c,0x76));var _0xc791=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x791c[_0x2ff238];return _0x204a56;};'use strict';var _=require('lodash');var util=require(_0xc791('0x0'));var moment=require(_0xc791('0x1'));var BPromise=require(_0xc791('0x2'));var rs=require(_0xc791('0x3'));var fs=require('fs');var Redis=require(_0xc791('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc791('0x5'));var logger=require(_0xc791('0x6'))(_0xc791('0x7'));var config=require(_0xc791('0x8'));var jayson=require(_0xc791('0x9'));var client=jayson['client'][_0xc791('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ad6a3,_0x5c34c1,_0x197b0f){return new BPromise(function(_0x27ce34,_0x2b9b45){return client[_0xc791('0xb')](_0x4ad6a3,_0x197b0f)[_0xc791('0xc')](function(_0x49b27d){logger[_0xc791('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5c34c1,_0xc791('0xe'));logger['debug'](_0xc791('0xf'),_0x5c34c1,_0xc791('0xe'),JSON[_0xc791('0x10')](_0x49b27d));if(_0x49b27d[_0xc791('0x11')]){if(_0x49b27d[_0xc791('0x11')][_0xc791('0x12')]===0x1f4){logger[_0xc791('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5c34c1,_0x49b27d[_0xc791('0x11')][_0xc791('0x13')]);return _0x2b9b45(_0x49b27d[_0xc791('0x11')][_0xc791('0x13')]);}logger[_0xc791('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5c34c1,_0x49b27d[_0xc791('0x11')]['message']);return _0x27ce34(_0x49b27d['error'][_0xc791('0x13')]);}else{logger[_0xc791('0xd')](_0xc791('0x14'),_0x5c34c1,_0xc791('0xe'));_0x27ce34(_0x49b27d['result'][_0xc791('0x13')]);}})[_0xc791('0x15')](function(_0x1c5baf){logger[_0xc791('0x11')](_0xc791('0x14'),_0x5c34c1,_0x1c5baf);_0x2b9b45(_0x1c5baf);});});}exports['CreateWhatsappQueueReport']=function(_0x1f07f3){var _0xbc12db=this;return new Promise(function(_0x495c38,_0x212b74){return db[_0xc791('0x16')][_0xc791('0x17')](_0x1f07f3['body'],{'raw':_0x1f07f3['options']?_0x1f07f3[_0xc791('0x18')][_0xc791('0x19')]===undefined?!![]:![]:!![]})[_0xc791('0xc')](function(_0x2ba1df){logger[_0xc791('0xd')]('CreateWhatsappQueueReport',_0x1f07f3);logger[_0xc791('0x1a')](_0xc791('0x1b'),_0x1f07f3,JSON[_0xc791('0x10')](_0x2ba1df));_0x495c38(_0x2ba1df);})[_0xc791('0x15')](function(_0x36a9cb){logger[_0xc791('0x11')](_0xc791('0x1b'),_0x36a9cb['message'],_0x1f07f3);_0x212b74(_0xbc12db[_0xc791('0x11')](0x1f4,_0x36a9cb[_0xc791('0x13')]));});});};exports[_0xc791('0x1c')]=function(_0x151785){var _0x23f17e=this;return new Promise(function(_0x3b1b3c,_0x311f66){return db[_0xc791('0x16')][_0xc791('0x1d')](_0x151785[_0xc791('0x1e')],{'raw':_0x151785[_0xc791('0x18')]?_0x151785[_0xc791('0x18')][_0xc791('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x151785[_0xc791('0x18')]?_0x151785[_0xc791('0x18')][_0xc791('0x1f')]||null:null,'attributes':_0x151785[_0xc791('0x18')]?_0x151785[_0xc791('0x18')]['attributes']||null:null,'limit':_0x151785['options']?_0x151785[_0xc791('0x18')][_0xc791('0x20')]||null:null})[_0xc791('0xc')](function(_0xe4255d){logger[_0xc791('0xd')](_0xc791('0x1c'),_0x151785);logger[_0xc791('0x1a')](_0xc791('0x1c'),_0x151785,JSON[_0xc791('0x10')](_0xe4255d));_0x3b1b3c(_0xe4255d);})['catch'](function(_0xd82a03){logger[_0xc791('0x11')]('UpdateWhatsappQueueReport',_0xd82a03[_0xc791('0x13')],_0x151785);_0x311f66(_0x23f17e['error'](0x1f4,_0xd82a03[_0xc791('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7518eb9..55fe893 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 _0xad82=['fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x1eca4d,_0x586c37){var _0x3344db=function(_0x13a510){while(--_0x13a510){_0x1eca4d['push'](_0x1eca4d['shift']());}};_0x3344db(++_0x586c37);}(_0xad82,0x19f));var _0x2ad8=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xad82[_0x3430aa];return _0x2ac5c;};'use strict';var multer=require(_0x2ad8('0x0'));var util=require(_0x2ad8('0x1'));var path=require('path');var timeout=require(_0x2ad8('0x2'));var express=require(_0x2ad8('0x3'));var router=express[_0x2ad8('0x4')]();var fs_extra=require(_0x2ad8('0x5'));var auth=require(_0x2ad8('0x6'));var interaction=require(_0x2ad8('0x7'));var config=require('../../config/environment');var controller=require(_0x2ad8('0x8'));router[_0x2ad8('0x9')]('/',auth[_0x2ad8('0xa')](),controller[_0x2ad8('0xb')]);router[_0x2ad8('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2ad8('0x9')](_0x2ad8('0xc'),auth[_0x2ad8('0xa')](),controller[_0x2ad8('0xd')]);router[_0x2ad8('0xe')]('/',auth[_0x2ad8('0xa')](),controller[_0x2ad8('0xf')]);router[_0x2ad8('0x10')](_0x2ad8('0xc'),auth[_0x2ad8('0xa')](),controller[_0x2ad8('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2ad8('0x12')]);module[_0x2ad8('0x13')]=router; \ No newline at end of file +var _0x2ed1=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','create','/:id','update','delete','destroy'];(function(_0x2de341,_0x303a90){var _0x36b35f=function(_0x6831e9){while(--_0x6831e9){_0x2de341['push'](_0x2de341['shift']());}};_0x36b35f(++_0x303a90);}(_0x2ed1,0x1b8));var _0x12ed=function(_0x3fe6da,_0x4c7a66){_0x3fe6da=_0x3fe6da-0x0;var _0x863a5e=_0x2ed1[_0x3fe6da];return _0x863a5e;};'use strict';var multer=require(_0x12ed('0x0'));var util=require(_0x12ed('0x1'));var path=require('path');var timeout=require(_0x12ed('0x2'));var express=require(_0x12ed('0x3'));var router=express[_0x12ed('0x4')]();var fs_extra=require(_0x12ed('0x5'));var auth=require(_0x12ed('0x6'));var interaction=require(_0x12ed('0x7'));var config=require(_0x12ed('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x12ed('0x9')]('/',auth[_0x12ed('0xa')](),controller['index']);router[_0x12ed('0x9')](_0x12ed('0xb'),auth['isAuthenticated'](),controller[_0x12ed('0xc')]);router[_0x12ed('0x9')]('/:id',auth[_0x12ed('0xa')](),controller[_0x12ed('0xd')]);router[_0x12ed('0xe')]('/',auth[_0x12ed('0xa')](),controller[_0x12ed('0xf')]);router['put'](_0x12ed('0x10'),auth[_0x12ed('0xa')](),controller[_0x12ed('0x11')]);router[_0x12ed('0x12')](_0x12ed('0x10'),auth[_0x12ed('0xa')](),controller[_0x12ed('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 390df94..516472d 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 _0x79d7=['queue','DATE','sequelize','STRING','ENUM','account','agent'];(function(_0x2e8cf6,_0x3352f8){var _0x203430=function(_0x2b8d81){while(--_0x2b8d81){_0x2e8cf6['push'](_0x2e8cf6['shift']());}};_0x203430(++_0x3352f8);}(_0x79d7,0x9c));var _0x779d=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x79d7[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0x779d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x779d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x779d('0x2')](_0x779d('0x3'),_0x779d('0x4'),_0x779d('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x779d('0x6')]}}; \ No newline at end of file +var _0x5eb8=['queue','DATE','STRING','ENUM','account','agent'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0x5eb8,0xb0));var _0x85eb=function(_0x463376,_0x13871c){_0x463376=_0x463376-0x0;var _0x336ccd=_0x5eb8[_0x463376];return _0x336ccd;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x85eb('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x85eb('0x1')](_0x85eb('0x2'),_0x85eb('0x3'),_0x85eb('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x85eb('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 24fc02f..6f88152 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 _0xe2cf=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','offset','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe2cf,0x14e));var _0xfe2c=function(_0x1ef48d,_0x19781c){_0x1ef48d=_0x1ef48d-0x0;var _0x25776c=_0xe2cf[_0x1ef48d];return _0x25776c;};'use strict';var emlformat=require(_0xfe2c('0x0'));var rimraf=require(_0xfe2c('0x1'));var zipdir=require(_0xfe2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe2c('0x3'));var moment=require(_0xfe2c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfe2c('0x5'));var util=require(_0xfe2c('0x6'));var path=require('path');var sox=require(_0xfe2c('0x7'));var csv=require(_0xfe2c('0x8'));var ejs=require(_0xfe2c('0x9'));var fs=require('fs');var fs_extra=require(_0xfe2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfe2c('0xb'));var jsforce=require(_0xfe2c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfe2c('0xd'));var Papa=require(_0xfe2c('0xe'));var Redis=require('ioredis');var authService=require(_0xfe2c('0xf'));var qs=require(_0xfe2c('0x10'));var as=require(_0xfe2c('0x11'));var hardwareService=require(_0xfe2c('0x12'));var logger=require(_0xfe2c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xfe2c('0x14'));var licenseUtil=require(_0xfe2c('0x15'));var db=require(_0xfe2c('0x16'))['db'];function respondWithStatusCode(_0x3a89ee,_0x279cab){_0x279cab=_0x279cab||0xcc;return function(_0x2ab263){if(_0x2ab263){return _0x3a89ee[_0xfe2c('0x17')](_0x279cab);}return _0x3a89ee[_0xfe2c('0x18')](_0x279cab)[_0xfe2c('0x19')]();};}function respondWithResult(_0x152b7b,_0x5db79b){_0x5db79b=_0x5db79b||0xc8;return function(_0x53fb79){if(_0x53fb79){return _0x152b7b[_0xfe2c('0x18')](_0x5db79b)[_0xfe2c('0x1a')](_0x53fb79);}};}function respondWithFilteredResult(_0x351bba,_0x94160c){return function(_0x66cb88){if(_0x66cb88){var _0x10cfac=typeof _0x94160c['offset']===_0xfe2c('0x1b')&&typeof _0x94160c[_0xfe2c('0x1c')]==='undefined';var _0x1f82c7=_0x66cb88[_0xfe2c('0x1d')];var _0x193a8a=_0x10cfac?0x0:_0x94160c['offset'];var _0x39e893=_0x10cfac?_0x66cb88[_0xfe2c('0x1d')]:_0x94160c['offset']+_0x94160c['limit'];var _0x54d7df;if(_0x39e893>=_0x1f82c7){_0x39e893=_0x1f82c7;_0x54d7df=0xc8;}else{_0x54d7df=0xce;}_0x351bba['status'](_0x54d7df);return _0x351bba[_0xfe2c('0x1e')](_0xfe2c('0x1f'),_0x193a8a+'-'+_0x39e893+'/'+_0x1f82c7)[_0xfe2c('0x1a')](_0x66cb88);}return null;};}function patchUpdates(_0x39b0fd){return function(_0xfe94){try{jsonpatch['apply'](_0xfe94,_0x39b0fd,!![]);}catch(_0x4ae58b){return BPromise[_0xfe2c('0x20')](_0x4ae58b);}return _0xfe94['save']();};}function saveUpdates(_0x206264,_0x53d2d0){return function(_0x33c169){if(_0x33c169){return _0x33c169[_0xfe2c('0x21')](_0x206264)[_0xfe2c('0x22')](function(_0x562928){return _0x562928;});}return null;};}function removeEntity(_0x310177,_0x11cc12){return function(_0x42ccfa){if(_0x42ccfa){return _0x42ccfa[_0xfe2c('0x23')]()[_0xfe2c('0x22')](function(){_0x310177['status'](0xcc)[_0xfe2c('0x19')]();});}};}function handleEntityNotFound(_0x3ec655,_0x4d5bc6){return function(_0x236be7){if(!_0x236be7){_0x3ec655[_0xfe2c('0x17')](0x194);}return _0x236be7;};}function handleError(_0x308618,_0x309285){_0x309285=_0x309285||0x1f4;return function(_0x507a5f){logger[_0xfe2c('0x24')](_0x507a5f[_0xfe2c('0x25')]);if(_0x507a5f['name']){delete _0x507a5f[_0xfe2c('0x26')];}_0x308618[_0xfe2c('0x18')](_0x309285)['send'](_0x507a5f);};}exports[_0xfe2c('0x27')]=function(_0x2f08c1,_0x48329e){var _0x57b344={},_0x2ade07={},_0x5b4cff={'count':0x0,'rows':[]};var _0x1098f8=_[_0xfe2c('0x28')](db[_0xfe2c('0x29')][_0xfe2c('0x2a')],function(_0x37a2bd){return{'name':_0x37a2bd[_0xfe2c('0x2b')],'type':_0x37a2bd[_0xfe2c('0x2c')]['key']};});_0x2ade07[_0xfe2c('0x2d')]=_['map'](_0x1098f8,_0xfe2c('0x26'));_0x2ade07['query']=_[_0xfe2c('0x2e')](_0x2f08c1[_0xfe2c('0x2f')]);_0x2ade07['filters']=_[_0xfe2c('0x30')](_0x2ade07[_0xfe2c('0x2d')],_0x2ade07[_0xfe2c('0x2f')]);_0x57b344['attributes']=_[_0xfe2c('0x30')](_0x2ade07[_0xfe2c('0x2d')],qs['fields'](_0x2f08c1[_0xfe2c('0x2f')][_0xfe2c('0x31')]));_0x57b344['attributes']=_0x57b344[_0xfe2c('0x32')][_0xfe2c('0x33')]?_0x57b344[_0xfe2c('0x32')]:_0x2ade07[_0xfe2c('0x2d')];if(!_0x2f08c1['query'][_0xfe2c('0x34')]('nolimit')){_0x57b344['limit']=qs['limit'](_0x2f08c1[_0xfe2c('0x2f')][_0xfe2c('0x1c')]);_0x57b344[_0xfe2c('0x35')]=qs[_0xfe2c('0x35')](_0x2f08c1['query'][_0xfe2c('0x35')]);}_0x57b344['order']=qs[_0xfe2c('0x36')](_0x2f08c1[_0xfe2c('0x2f')][_0xfe2c('0x36')]);_0x57b344['where']=qs[_0xfe2c('0x37')](_[_0xfe2c('0x38')](_0x2f08c1['query'],_0x2ade07[_0xfe2c('0x37')]),_0x1098f8);if(_0x2f08c1['query'][_0xfe2c('0x39')]){_0x57b344[_0xfe2c('0x3a')]=_[_0xfe2c('0x3b')](_0x57b344[_0xfe2c('0x3a')],{'$or':_[_0xfe2c('0x28')](_0x1098f8,function(_0x1a6328){if(_0x1a6328[_0xfe2c('0x2c')]!==_0xfe2c('0x3c')){var _0x52d745={};_0x52d745[_0x1a6328[_0xfe2c('0x26')]]={'$like':'%'+_0x2f08c1[_0xfe2c('0x2f')][_0xfe2c('0x39')]+'%'};return _0x52d745;}})});}_0x57b344=_[_0xfe2c('0x3b')]({},_0x57b344,_0x2f08c1[_0xfe2c('0x3d')]);var _0x10b9c4={'where':_0x57b344[_0xfe2c('0x3a')]};return db[_0xfe2c('0x29')][_0xfe2c('0x1d')](_0x10b9c4)[_0xfe2c('0x22')](function(_0x1b5679){_0x5b4cff['count']=_0x1b5679;if(_0x2f08c1[_0xfe2c('0x2f')][_0xfe2c('0x3e')]){_0x57b344[_0xfe2c('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x57b344);})[_0xfe2c('0x22')](function(_0x15e8be){_0x5b4cff[_0xfe2c('0x40')]=_0x15e8be;return _0x5b4cff;})['then'](respondWithFilteredResult(_0x48329e,_0x57b344))[_0xfe2c('0x41')](handleError(_0x48329e,null));};exports[_0xfe2c('0x42')]=function(_0x682254,_0x4b1af8){var _0x4cc1bd={'raw':!![],'where':{'id':_0x682254[_0xfe2c('0x43')]['id']}},_0x34d0d7={};_0x34d0d7[_0xfe2c('0x2d')]=_[_0xfe2c('0x2e')](db[_0xfe2c('0x29')]['rawAttributes']);_0x34d0d7[_0xfe2c('0x2f')]=_[_0xfe2c('0x2e')](_0x682254['query']);_0x34d0d7[_0xfe2c('0x37')]=_[_0xfe2c('0x30')](_0x34d0d7[_0xfe2c('0x2d')],_0x34d0d7[_0xfe2c('0x2f')]);_0x4cc1bd[_0xfe2c('0x32')]=_[_0xfe2c('0x30')](_0x34d0d7[_0xfe2c('0x2d')],qs['fields'](_0x682254[_0xfe2c('0x2f')][_0xfe2c('0x31')]));_0x4cc1bd['attributes']=_0x4cc1bd[_0xfe2c('0x32')][_0xfe2c('0x33')]?_0x4cc1bd[_0xfe2c('0x32')]:_0x34d0d7[_0xfe2c('0x2d')];if(_0x682254[_0xfe2c('0x2f')]['includeAll']){_0x4cc1bd[_0xfe2c('0x3f')]=[{'all':!![]}];}_0x4cc1bd=_[_0xfe2c('0x3b')]({},_0x4cc1bd,_0x682254['options']);return db[_0xfe2c('0x29')][_0xfe2c('0x44')](_0x4cc1bd)['then'](handleEntityNotFound(_0x4b1af8,null))[_0xfe2c('0x22')](respondWithResult(_0x4b1af8,null))[_0xfe2c('0x41')](handleError(_0x4b1af8,null));};exports['create']=function(_0x40556f,_0x2b3cdd){return db[_0xfe2c('0x29')]['create'](_0x40556f[_0xfe2c('0x45')],{})[_0xfe2c('0x22')](respondWithResult(_0x2b3cdd,0xc9))[_0xfe2c('0x41')](handleError(_0x2b3cdd,null));};exports['update']=function(_0x5de8a8,_0x17d5a4){if(_0x5de8a8['body']['id']){delete _0x5de8a8[_0xfe2c('0x45')]['id'];}return db[_0xfe2c('0x29')][_0xfe2c('0x44')]({'where':{'id':_0x5de8a8[_0xfe2c('0x43')]['id']}})[_0xfe2c('0x22')](handleEntityNotFound(_0x17d5a4,null))[_0xfe2c('0x22')](saveUpdates(_0x5de8a8['body'],null))[_0xfe2c('0x22')](respondWithResult(_0x17d5a4,null))[_0xfe2c('0x41')](handleError(_0x17d5a4,null));};exports[_0xfe2c('0x23')]=function(_0x52a802,_0x589e4c){return db['WhatsappTransferReport'][_0xfe2c('0x44')]({'where':{'id':_0x52a802['params']['id']}})[_0xfe2c('0x22')](handleEntityNotFound(_0x589e4c,null))[_0xfe2c('0x22')](removeEntity(_0x589e4c,null))[_0xfe2c('0x41')](handleError(_0x589e4c,null));};exports[_0xfe2c('0x46')]=function(_0x5e8e2f,_0x35e053){return db[_0xfe2c('0x29')][_0xfe2c('0x46')]()[_0xfe2c('0x22')](respondWithResult(_0x35e053,null))['catch'](handleError(_0x35e053,null));}; \ No newline at end of file +var _0x528c=['map','WhatsappTransferReport','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index'];(function(_0x177c8d,_0x15a8af){var _0x2a771b=function(_0x3b2763){while(--_0x3b2763){_0x177c8d['push'](_0x177c8d['shift']());}};_0x2a771b(++_0x15a8af);}(_0x528c,0x65));var _0xc528=function(_0xa1db0,_0x34aa70){_0xa1db0=_0xa1db0-0x0;var _0x239c86=_0x528c[_0xa1db0];return _0x239c86;};'use strict';var emlformat=require(_0xc528('0x0'));var rimraf=require(_0xc528('0x1'));var zipdir=require(_0xc528('0x2'));var jsonpatch=require(_0xc528('0x3'));var rp=require(_0xc528('0x4'));var moment=require(_0xc528('0x5'));var BPromise=require(_0xc528('0x6'));var Mustache=require(_0xc528('0x7'));var util=require(_0xc528('0x8'));var path=require(_0xc528('0x9'));var sox=require('sox');var csv=require(_0xc528('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc528('0xb'));var _=require(_0xc528('0xc'));var squel=require(_0xc528('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc528('0xe'));var toCsv=require(_0xc528('0xa'));var querystring=require(_0xc528('0xf'));var Papa=require(_0xc528('0x10'));var Redis=require(_0xc528('0x11'));var authService=require(_0xc528('0x12'));var qs=require(_0xc528('0x13'));var as=require(_0xc528('0x14'));var hardwareService=require(_0xc528('0x15'));var logger=require(_0xc528('0x16'))(_0xc528('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc528('0x18'));var db=require(_0xc528('0x19'))['db'];function respondWithStatusCode(_0x5b8e0a,_0x37912c){_0x37912c=_0x37912c||0xcc;return function(_0x47ca44){if(_0x47ca44){return _0x5b8e0a[_0xc528('0x1a')](_0x37912c);}return _0x5b8e0a[_0xc528('0x1b')](_0x37912c)['end']();};}function respondWithResult(_0x3b3723,_0x5105ef){_0x5105ef=_0x5105ef||0xc8;return function(_0x4327c8){if(_0x4327c8){return _0x3b3723[_0xc528('0x1b')](_0x5105ef)[_0xc528('0x1c')](_0x4327c8);}};}function respondWithFilteredResult(_0x700537,_0x61418d){return function(_0x1386e4){if(_0x1386e4){var _0x3abc08=typeof _0x61418d[_0xc528('0x1d')]===_0xc528('0x1e')&&typeof _0x61418d[_0xc528('0x1f')]===_0xc528('0x1e');var _0x2fcd20=_0x1386e4[_0xc528('0x20')];var _0x5a6111=_0x3abc08?0x0:_0x61418d['offset'];var _0x4488a7=_0x3abc08?_0x1386e4[_0xc528('0x20')]:_0x61418d[_0xc528('0x1d')]+_0x61418d[_0xc528('0x1f')];var _0x2e6131;if(_0x4488a7>=_0x2fcd20){_0x4488a7=_0x2fcd20;_0x2e6131=0xc8;}else{_0x2e6131=0xce;}_0x700537[_0xc528('0x1b')](_0x2e6131);return _0x700537[_0xc528('0x21')](_0xc528('0x22'),_0x5a6111+'-'+_0x4488a7+'/'+_0x2fcd20)[_0xc528('0x1c')](_0x1386e4);}return null;};}function patchUpdates(_0xf5632c){return function(_0x462f33){try{jsonpatch[_0xc528('0x23')](_0x462f33,_0xf5632c,!![]);}catch(_0x35536d){return BPromise[_0xc528('0x24')](_0x35536d);}return _0x462f33[_0xc528('0x25')]();};}function saveUpdates(_0x8ff4a0,_0x4375ef){return function(_0x57907d){if(_0x57907d){return _0x57907d[_0xc528('0x26')](_0x8ff4a0)[_0xc528('0x27')](function(_0x34ed57){return _0x34ed57;});}return null;};}function removeEntity(_0x557f36,_0x16660b){return function(_0x12d225){if(_0x12d225){return _0x12d225[_0xc528('0x28')]()[_0xc528('0x27')](function(){_0x557f36[_0xc528('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x469dba,_0x5aafa1){return function(_0x734a04){if(!_0x734a04){_0x469dba['sendStatus'](0x194);}return _0x734a04;};}function handleError(_0x42a4d7,_0xc22234){_0xc22234=_0xc22234||0x1f4;return function(_0x219326){logger[_0xc528('0x29')](_0x219326[_0xc528('0x2a')]);if(_0x219326[_0xc528('0x2b')]){delete _0x219326[_0xc528('0x2b')];}_0x42a4d7[_0xc528('0x1b')](_0xc22234)['send'](_0x219326);};}exports[_0xc528('0x2c')]=function(_0x26cbf1,_0x5d7ecf){var _0x560783={},_0xfc0ecf={},_0xd45ad1={'count':0x0,'rows':[]};var _0x1b1774=_[_0xc528('0x2d')](db[_0xc528('0x2e')]['rawAttributes'],function(_0x4dbf3a){return{'name':_0x4dbf3a['fieldName'],'type':_0x4dbf3a[_0xc528('0x2f')]['key']};});_0xfc0ecf[_0xc528('0x30')]=_[_0xc528('0x2d')](_0x1b1774,_0xc528('0x2b'));_0xfc0ecf[_0xc528('0x31')]=_[_0xc528('0x32')](_0x26cbf1['query']);_0xfc0ecf[_0xc528('0x33')]=_['intersection'](_0xfc0ecf[_0xc528('0x30')],_0xfc0ecf[_0xc528('0x31')]);_0x560783[_0xc528('0x34')]=_[_0xc528('0x35')](_0xfc0ecf['model'],qs[_0xc528('0x36')](_0x26cbf1[_0xc528('0x31')][_0xc528('0x36')]));_0x560783['attributes']=_0x560783[_0xc528('0x34')][_0xc528('0x37')]?_0x560783[_0xc528('0x34')]:_0xfc0ecf['model'];if(!_0x26cbf1[_0xc528('0x31')]['hasOwnProperty'](_0xc528('0x38'))){_0x560783[_0xc528('0x1f')]=qs['limit'](_0x26cbf1[_0xc528('0x31')][_0xc528('0x1f')]);_0x560783[_0xc528('0x1d')]=qs[_0xc528('0x1d')](_0x26cbf1[_0xc528('0x31')]['offset']);}_0x560783[_0xc528('0x39')]=qs[_0xc528('0x3a')](_0x26cbf1[_0xc528('0x31')]['sort']);_0x560783['where']=qs[_0xc528('0x33')](_[_0xc528('0x3b')](_0x26cbf1[_0xc528('0x31')],_0xfc0ecf['filters']),_0x1b1774);if(_0x26cbf1[_0xc528('0x31')][_0xc528('0x3c')]){_0x560783[_0xc528('0x3d')]=_[_0xc528('0x3e')](_0x560783[_0xc528('0x3d')],{'$or':_[_0xc528('0x2d')](_0x1b1774,function(_0x220727){if(_0x220727[_0xc528('0x2f')]!=='VIRTUAL'){var _0x4ef1c3={};_0x4ef1c3[_0x220727[_0xc528('0x2b')]]={'$like':'%'+_0x26cbf1[_0xc528('0x31')]['filter']+'%'};return _0x4ef1c3;}})});}_0x560783=_[_0xc528('0x3e')]({},_0x560783,_0x26cbf1[_0xc528('0x3f')]);var _0x5d38be={'where':_0x560783[_0xc528('0x3d')]};return db[_0xc528('0x2e')][_0xc528('0x20')](_0x5d38be)[_0xc528('0x27')](function(_0x14a3c9){_0xd45ad1[_0xc528('0x20')]=_0x14a3c9;if(_0x26cbf1[_0xc528('0x31')][_0xc528('0x40')]){_0x560783['include']=[{'all':!![]}];}return db[_0xc528('0x2e')]['findAll'](_0x560783);})[_0xc528('0x27')](function(_0x11ef49){_0xd45ad1[_0xc528('0x41')]=_0x11ef49;return _0xd45ad1;})[_0xc528('0x27')](respondWithFilteredResult(_0x5d7ecf,_0x560783))[_0xc528('0x42')](handleError(_0x5d7ecf,null));};exports[_0xc528('0x43')]=function(_0x374bde,_0x4a3321){var _0x40b484={'raw':!![],'where':{'id':_0x374bde[_0xc528('0x44')]['id']}},_0x4f5fdd={};_0x4f5fdd[_0xc528('0x30')]=_[_0xc528('0x32')](db[_0xc528('0x2e')]['rawAttributes']);_0x4f5fdd[_0xc528('0x31')]=_[_0xc528('0x32')](_0x374bde[_0xc528('0x31')]);_0x4f5fdd[_0xc528('0x33')]=_['intersection'](_0x4f5fdd[_0xc528('0x30')],_0x4f5fdd['query']);_0x40b484[_0xc528('0x34')]=_[_0xc528('0x35')](_0x4f5fdd['model'],qs['fields'](_0x374bde['query'][_0xc528('0x36')]));_0x40b484[_0xc528('0x34')]=_0x40b484[_0xc528('0x34')][_0xc528('0x37')]?_0x40b484[_0xc528('0x34')]:_0x4f5fdd[_0xc528('0x30')];if(_0x374bde['query']['includeAll']){_0x40b484['include']=[{'all':!![]}];}_0x40b484=_[_0xc528('0x3e')]({},_0x40b484,_0x374bde[_0xc528('0x3f')]);return db[_0xc528('0x2e')][_0xc528('0x45')](_0x40b484)[_0xc528('0x27')](handleEntityNotFound(_0x4a3321,null))[_0xc528('0x27')](respondWithResult(_0x4a3321,null))['catch'](handleError(_0x4a3321,null));};exports[_0xc528('0x46')]=function(_0x17b682,_0x22b1f9){return db[_0xc528('0x2e')][_0xc528('0x46')](_0x17b682[_0xc528('0x47')],{})[_0xc528('0x27')](respondWithResult(_0x22b1f9,0xc9))['catch'](handleError(_0x22b1f9,null));};exports['update']=function(_0x3594c8,_0x2b0c34){if(_0x3594c8[_0xc528('0x47')]['id']){delete _0x3594c8['body']['id'];}return db[_0xc528('0x2e')][_0xc528('0x45')]({'where':{'id':_0x3594c8[_0xc528('0x44')]['id']}})[_0xc528('0x27')](handleEntityNotFound(_0x2b0c34,null))['then'](saveUpdates(_0x3594c8[_0xc528('0x47')],null))['then'](respondWithResult(_0x2b0c34,null))['catch'](handleError(_0x2b0c34,null));};exports[_0xc528('0x28')]=function(_0x130703,_0x233153){return db[_0xc528('0x2e')][_0xc528('0x45')]({'where':{'id':_0x130703[_0xc528('0x44')]['id']}})[_0xc528('0x27')](handleEntityNotFound(_0x233153,null))[_0xc528('0x27')](removeEntity(_0x233153,null))[_0xc528('0x42')](handleError(_0x233153,null));};exports[_0xc528('0x48')]=function(_0x273667,_0x41d837){return db['WhatsappTransferReport'][_0xc528('0x48')]()[_0xc528('0x27')](respondWithResult(_0x41d837,null))[_0xc528('0x42')](handleError(_0x41d837,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 0e4c9d5..5ae8148 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 _0x92aa=['report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x92aa,0xfe));var _0xa92a=function(_0x4a2973,_0x53ec5a){_0x4a2973=_0x4a2973-0x0;var _0x25fc8b=_0x92aa[_0x4a2973];return _0x25fc8b;};'use strict';var _=require(_0xa92a('0x0'));var util=require(_0xa92a('0x1'));var logger=require(_0xa92a('0x2'))(_0xa92a('0x3'));var moment=require(_0xa92a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa92a('0x5'));var rimraf=require('rimraf');var config=require(_0xa92a('0x6'));var attributes=require(_0xa92a('0x7'));module[_0xa92a('0x8')]=function(_0x2b2356,_0x5e4700){return _0x2b2356['define'](_0xa92a('0x9'),attributes,{'tableName':_0xa92a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa92a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ead=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0x0ead,0x175));var _0xd0ea=function(_0x522084,_0x4d98b6){_0x522084=_0x522084-0x0;var _0x519c7c=_0x0ead[_0x522084];return _0x519c7c;};'use strict';var _=require(_0xd0ea('0x0'));var util=require(_0xd0ea('0x1'));var logger=require(_0xd0ea('0x2'))(_0xd0ea('0x3'));var moment=require('moment');var BPromise=require(_0xd0ea('0x4'));var rp=require(_0xd0ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd0ea('0x6'));var attributes=require(_0xd0ea('0x7'));module['exports']=function(_0x2abe39,_0x3b1296){return _0x2abe39[_0xd0ea('0x8')](_0xd0ea('0x9'),attributes,{'tableName':_0xd0ea('0xa'),'paranoid':![],'indexes':[{'name':_0xd0ea('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 9ae9f37..1e8092d 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 _0xa8ce=['stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x5d9fae,_0x172774){var _0x35bd5f=function(_0x5b8d92){while(--_0x5b8d92){_0x5d9fae['push'](_0x5d9fae['shift']());}};_0x35bd5f(++_0x172774);}(_0xa8ce,0x1e8));var _0xea8c=function(_0x27da10,_0x56f876){_0x27da10=_0x27da10-0x0;var _0x47904a=_0xa8ce[_0x27da10];return _0x47904a;};'use strict';var _=require(_0xea8c('0x0'));var util=require(_0xea8c('0x1'));var moment=require(_0xea8c('0x2'));var BPromise=require('bluebird');var rs=require(_0xea8c('0x3'));var fs=require('fs');var Redis=require(_0xea8c('0x4'));var db=require(_0xea8c('0x5'))['db'];var utils=require(_0xea8c('0x6'));var logger=require('../../config/logger')(_0xea8c('0x7'));var config=require(_0xea8c('0x8'));var jayson=require(_0xea8c('0x9'));var client=jayson[_0xea8c('0xa')][_0xea8c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x395a2d,_0x1c4e9a,_0x1e0ac3){return new BPromise(function(_0x113fc0,_0x1557f2){return client[_0xea8c('0xc')](_0x395a2d,_0x1e0ac3)['then'](function(_0x4dcc7c){logger[_0xea8c('0xd')](_0xea8c('0xe'),_0x1c4e9a,_0xea8c('0xf'));logger[_0xea8c('0x10')](_0xea8c('0x11'),_0x1c4e9a,_0xea8c('0xf'),JSON[_0xea8c('0x12')](_0x4dcc7c));if(_0x4dcc7c[_0xea8c('0x13')]){if(_0x4dcc7c[_0xea8c('0x13')]['code']===0x1f4){logger[_0xea8c('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1c4e9a,_0x4dcc7c['error'][_0xea8c('0x14')]);return _0x1557f2(_0x4dcc7c[_0xea8c('0x13')][_0xea8c('0x14')]);}logger[_0xea8c('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1c4e9a,_0x4dcc7c[_0xea8c('0x13')]['message']);return _0x113fc0(_0x4dcc7c['error'][_0xea8c('0x14')]);}else{logger[_0xea8c('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1c4e9a,_0xea8c('0xf'));_0x113fc0(_0x4dcc7c['result'][_0xea8c('0x14')]);}})[_0xea8c('0x15')](function(_0xb777b3){logger[_0xea8c('0x13')](_0xea8c('0xe'),_0x1c4e9a,_0xb777b3);_0x1557f2(_0xb777b3);});});} \ No newline at end of file +var _0x0686=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0686,0x1a3));var _0x6068=function(_0x5b71ef,_0x4e59dd){_0x5b71ef=_0x5b71ef-0x0;var _0x5302cb=_0x0686[_0x5b71ef];return _0x5302cb;};'use strict';var _=require('lodash');var util=require(_0x6068('0x0'));var moment=require(_0x6068('0x1'));var BPromise=require(_0x6068('0x2'));var rs=require(_0x6068('0x3'));var fs=require('fs');var Redis=require(_0x6068('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6068('0x5'));var logger=require(_0x6068('0x6'))(_0x6068('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6068('0x8')][_0x6068('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x248bd3,_0x2eee1d,_0x5dd74a){return new BPromise(function(_0x1cfc71,_0x378630){return client[_0x6068('0xa')](_0x248bd3,_0x5dd74a)[_0x6068('0xb')](function(_0x4297f0){logger[_0x6068('0xc')](_0x6068('0xd'),_0x2eee1d,_0x6068('0xe'));logger['debug'](_0x6068('0xf'),_0x2eee1d,_0x6068('0xe'),JSON[_0x6068('0x10')](_0x4297f0));if(_0x4297f0[_0x6068('0x11')]){if(_0x4297f0[_0x6068('0x11')][_0x6068('0x12')]===0x1f4){logger['error'](_0x6068('0xd'),_0x2eee1d,_0x4297f0['error'][_0x6068('0x13')]);return _0x378630(_0x4297f0[_0x6068('0x11')][_0x6068('0x13')]);}logger[_0x6068('0x11')](_0x6068('0xd'),_0x2eee1d,_0x4297f0[_0x6068('0x11')][_0x6068('0x13')]);return _0x1cfc71(_0x4297f0[_0x6068('0x11')][_0x6068('0x13')]);}else{logger[_0x6068('0xc')](_0x6068('0xd'),_0x2eee1d,_0x6068('0xe'));_0x1cfc71(_0x4297f0[_0x6068('0x14')][_0x6068('0x13')]);}})['catch'](function(_0x337c79){logger[_0x6068('0x11')](_0x6068('0xd'),_0x2eee1d,_0x337c79);_0x378630(_0x337c79);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 4546d39..fcaca35 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd45e=['then','seedDB','default','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','filter','online','name','Offline\x20apps:','status','join','None','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./rpc','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize'];(function(_0x11f310,_0x566f6f){var _0x49012b=function(_0x34b5e5){while(--_0x34b5e5){_0x11f310['push'](_0x11f310['shift']());}};_0x49012b(++_0x566f6f);}(_0xd45e,0x182));var _0xed45=function(_0x1d7f83,_0x3dcb34){_0x1d7f83=_0x1d7f83-0x0;var _0x499360=_0xd45e[_0x1d7f83];return _0x499360;};'use strict';var _=require('lodash');var db=require(_0xed45('0x0'))['db'];var seedDb=require(_0xed45('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xed45('0x2'));var config=require('./config/environment');var logger=require(_0xed45('0x3'))(_0xed45('0x4'));var pm2=require(_0xed45('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xed45('0x6'));var chat=require(_0xed45('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0xed45('0x8'));function main(){return db[_0xed45('0x9')]['sync']()[_0xed45('0xa')](function(){if(config[_0xed45('0xb')]){return seedDb[_0xed45('0xc')]();}})[_0xed45('0xa')](function(){return checkLicense[_0xed45('0xc')]();})[_0xed45('0xa')](function(){return rpc['listen']();})[_0xed45('0xa')](function(_0xded80e){logger[_0xed45('0xd')](_0xded80e);return chat[_0xed45('0xe')]();})[_0xed45('0xa')](function(){return whatsapp[_0xed45('0xe')]();})[_0xed45('0xa')](function(){return schedule['start']();})[_0xed45('0xa')](function(){return transcribe[_0xed45('0xe')]();})[_0xed45('0xa')](function(){return provider[_0xed45('0xe')]();})['then'](function(_0x3f35ef){logger['info'](_0x3f35ef);return pm2[_0xed45('0xe')](pm2Config);})[_0xed45('0xa')](function(_0xd6dcbb){var _0x112873=_0xd6dcbb['filter'](function(_0x292aef){return typeof _0x292aef[_0xed45('0xf')]===_0xed45('0x10')&&_0x292aef['exitCode']>=0x0;});if(_0x112873[_0xed45('0x11')]>0x0){throw new Error(_0x112873['length']+_0xed45('0x12')+_[_0xed45('0x13')](_0x112873,function(_0x3bb5ef){return'\x22'+_0x3bb5ef[_0xed45('0x14')]['name']+'\x22';}));}logger[_0xed45('0xd')]('Online\x20apps:',_['map'](_[_0xed45('0x15')](_0xd6dcbb,{'status':_0xed45('0x16')}),_0xed45('0x17'))['join']());logger['info'](_0xed45('0x18'),_[_0xed45('0x13')](_['filter'](_0xd6dcbb,function(_0x542459){return _0x542459[_0xed45('0x19')]!==_0xed45('0x16');}),_0xed45('0x17'))[_0xed45('0x1a')]()||_0xed45('0x1b'));console[_0xed45('0x1c')]('App\x20Ready!');})['catch'](function(_0x57c103){console['log'](_0xed45('0x1d'),_0x57c103);logger[_0xed45('0x1e')](_0xed45('0x1f'),_0x57c103);process[_0xed45('0x20')](0x1);});}main(); \ No newline at end of file +var _0x503a=['filter','exitCode','number','length','map','pm2_env','name','online','join','Offline\x20apps:','status','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','info','start'];(function(_0x2a8d67,_0x5ed354){var _0xccf6c4=function(_0x16a21e){while(--_0x16a21e){_0x2a8d67['push'](_0x2a8d67['shift']());}};_0xccf6c4(++_0x5ed354);}(_0x503a,0x19d));var _0xa503=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x503a[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xa503('0x0'));var db=require(_0xa503('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xa503('0x2'));var rpc=require('./rpc');var config=require(_0xa503('0x3'));var logger=require(_0xa503('0x4'))(_0xa503('0x5'));var pm2=require(_0xa503('0x6'));var pm2Config=require(_0xa503('0x7'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xa503('0x8'));var provider=require(_0xa503('0x9'));function main(){return db['sequelize'][_0xa503('0xa')]()[_0xa503('0xb')](function(){if(config[_0xa503('0xc')]){return seedDb[_0xa503('0xd')]();}})[_0xa503('0xb')](function(){return checkLicense[_0xa503('0xd')]();})[_0xa503('0xb')](function(){return rpc['listen']();})[_0xa503('0xb')](function(_0x1f85e3){logger[_0xa503('0xe')](_0x1f85e3);return chat['start']();})[_0xa503('0xb')](function(){return whatsapp['start']();})[_0xa503('0xb')](function(){return schedule['start']();})[_0xa503('0xb')](function(){return transcribe[_0xa503('0xf')]();})['then'](function(){return provider['start']();})[_0xa503('0xb')](function(_0x1a84ba){logger[_0xa503('0xe')](_0x1a84ba);return pm2[_0xa503('0xf')](pm2Config);})[_0xa503('0xb')](function(_0x1c1971){var _0xfa3e18=_0x1c1971[_0xa503('0x10')](function(_0x3ae1b0){return typeof _0x3ae1b0[_0xa503('0x11')]===_0xa503('0x12')&&_0x3ae1b0[_0xa503('0x11')]>=0x0;});if(_0xfa3e18[_0xa503('0x13')]>0x0){throw new Error(_0xfa3e18[_0xa503('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xa503('0x14')](_0xfa3e18,function(_0x2a9557){return'\x22'+_0x2a9557[_0xa503('0x15')][_0xa503('0x16')]+'\x22';}));}logger[_0xa503('0xe')]('Online\x20apps:',_[_0xa503('0x14')](_['filter'](_0x1c1971,{'status':_0xa503('0x17')}),_0xa503('0x16'))[_0xa503('0x18')]());logger[_0xa503('0xe')](_0xa503('0x19'),_[_0xa503('0x14')](_[_0xa503('0x10')](_0x1c1971,function(_0x10486f){return _0x10486f[_0xa503('0x1a')]!==_0xa503('0x17');}),_0xa503('0x16'))[_0xa503('0x18')]()||'None');console['log'](_0xa503('0x1b'));})[_0xa503('0x1c')](function(_0x1f7abe){console[_0xa503('0x1d')](_0xa503('0x1e'),_0x1f7abe);logger['error'](_0xa503('0x1f'),_0x1f7abe);process[_0xa503('0x20')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a3eb7c8..bdf8cf9 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 _0x63be=['headers','authorization','startsWith','Basic','find','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','blockDuration','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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.','Sequelize','updatePasswordsHistory','length','encryptString','promisify','sign','secret','secrets','payload','options','verify','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','util','moment','session','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','downloadVoiceRecordings','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','forceDownload','status','unmanaged','json','Forbidden.','catch'];(function(_0x364034,_0x1c91a2){var _0xda68aa=function(_0xa021ae){while(--_0xa021ae){_0x364034['push'](_0x364034['shift']());}};_0xda68aa(++_0x1c91a2);}(_0x63be,0x1dd));var _0xe63b=function(_0x42bde3,_0x5197bc){_0x42bde3=_0x42bde3-0x0;var _0x20355d=_0x63be[_0x42bde3];return _0x20355d;};'use strict';var db=require(_0xe63b('0x0'))['db'];var config=require(_0xe63b('0x1'));var hardwareConf=require(_0xe63b('0x2'));var licenseUtil=require(_0xe63b('0x3'));var encryptor=require(_0xe63b('0x4'));var _=require(_0xe63b('0x5'));var jwt=require(_0xe63b('0x6'));var expressJwt=require(_0xe63b('0x7'));var compose=require(_0xe63b('0x8'));var basicAuth=require('basic-auth');var crypto=require(_0xe63b('0x9'));var BPromise=require('bluebird');var util=require(_0xe63b('0xa'));var moment=require(_0xe63b('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0xe63b('0xc')]});var userAttributes=['id',_0xe63b('0xd'),_0xe63b('0xe'),_0xe63b('0xf'),'internal',_0xe63b('0x10'),_0xe63b('0x11'),_0xe63b('0x12'),_0xe63b('0x13'),_0xe63b('0x14'),_0xe63b('0x15'),_0xe63b('0x16'),_0xe63b('0x17'),_0xe63b('0x18'),_0xe63b('0x19'),'pauseType','showWebBar',_0xe63b('0x1a'),_0xe63b('0x1b'),_0xe63b('0x1c'),_0xe63b('0x1d'),'passwordResetAt','alias',_0xe63b('0x1e'),_0xe63b('0x1f'),_0xe63b('0x20'),_0xe63b('0x21'),_0xe63b('0x22'),'phoneBarEnableSettings',_0xe63b('0x23'),_0xe63b('0x24'),'phoneBarRemoteControl',_0xe63b('0x25'),_0xe63b('0x26'),_0xe63b('0x27'),_0xe63b('0x28'),_0xe63b('0x29'),'settingsEnabled','wssPort',_0xe63b('0x2a'),'downloadOmnichannelInteractions','downloadAttachments',_0xe63b('0x2b'),_0xe63b('0x2c'),'chatAutoanswer',_0xe63b('0x2d'),_0xe63b('0x2e'),_0xe63b('0x2f'),_0xe63b('0x30'),_0xe63b('0x31'),_0xe63b('0x32'),'openchannelAutoanswerDelay','faxAutoanswer',_0xe63b('0x33'),_0xe63b('0x34'),_0xe63b('0x35'),_0xe63b('0x36')];exports[_0xe63b('0x37')]=function(){return this[_0xe63b('0x38')](!![])[_0xe63b('0x39')](function(_0x2a4f5c,_0x3cee2d,_0x196364){if(_0x2a4f5c[_0xe63b('0x3a')]){_0x196364();}else{return db[_0xe63b('0x3b')][_0xe63b('0x3c')]({'where':{'id':_0x2a4f5c[_0xe63b('0x3d')]['id']},'attributes':['id',_0xe63b('0x3e'),_0xe63b('0x3f')],'raw':!![]})[_0xe63b('0x40')](function(_0x22be26){if(_0x22be26&&_0x22be26[_0xe63b('0x3e')]&&!_0x2a4f5c['query'][_0xe63b('0x41')]){return _0x3cee2d[_0xe63b('0x42')](_0x22be26[_0xe63b('0x3f')]===_0xe63b('0x43')?0x195:0x193)[_0xe63b('0x44')]({'message':_0x22be26[_0xe63b('0x3f')]==='unmanaged'?'Unmanaged.':_0xe63b('0x45')});}else{_0x196364();}})[_0xe63b('0x46')](function(_0x1c83f8){_0x196364(_0x1c83f8);});}});};exports[_0xe63b('0x38')]=function isAuthenticated(_0x52c17b){return compose()[_0xe63b('0x39')](function(_0xbb423b,_0x3fffb3,_0x2b8a02){var _0x46698d;if(_0xbb423b[_0xe63b('0x47')][_0xe63b('0x48')]){if(_[_0xe63b('0x49')](_0xbb423b[_0xe63b('0x47')][_0xe63b('0x48')],_0xe63b('0x4a'))){var _0x1420f6=basicAuth(_0xbb423b);db['User'][_0xe63b('0x4b')]({'where':{'name':_0x1420f6[_0xe63b('0xf')]}})[_0xe63b('0x40')](function(_0x257529){if(!_0x257529||!_0x257529[_0xe63b('0x4c')](_0x1420f6[_0xe63b('0x4d')])){return _0x3fffb3[_0xe63b('0x42')](0x191)[_0xe63b('0x44')]({'message':_0xe63b('0x4e')});}_0xbb423b['user']={'id':_0x257529['id']};_0x2b8a02();})[_0xe63b('0x46')](function(_0x105eb3){_0x2b8a02(_0x105eb3);});}else if(_[_0xe63b('0x49')](_0xbb423b[_0xe63b('0x47')][_0xe63b('0x48')],_0xe63b('0x4f'))){validateJwt(_0xbb423b,_0x3fffb3,_0x2b8a02);}else{if(_0x52c17b){_0x2b8a02();}else{return _0x3fffb3['status'](0x193)['json']({'message':_0xe63b('0x50')});}}}else if(_0xbb423b[_0xe63b('0x51')][_0xe63b('0x52')]){try{var _0x23108f={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xe63b('0x53')]()};verifyJwt(_0xbb423b[_0xe63b('0x51')][_0xe63b('0x52')],_0x23108f)[_0xe63b('0x40')](function(_0x1a072f){return db[_0xe63b('0x54')]['find']({'where':{'id':_0x1a072f[_0xe63b('0x55')]}})[_0xe63b('0x40')](function(_0x397d6a){_0x46698d=_0x397d6a;return db['Setting'][_0xe63b('0x3c')]({'where':{'id':0x1},'attributes':[_0xe63b('0x56'),'blockDuration'],'raw':!![]});})[_0xe63b('0x40')](function(_0x109b8d){if(!_0x46698d||!_[_0xe63b('0x57')](_0x46698d[_0xe63b('0x58')],_0x1a072f[_0xe63b('0x59')])){return _0x3fffb3[_0xe63b('0x42')](0x191)[_0xe63b('0x44')]({'message':_0xe63b('0x5a')});}if(_0x46698d[_0xe63b('0x5b')]){return _0x3fffb3[_0xe63b('0x42')](0x191)['json']({'message':_0xe63b('0x5c')});}if(_0x46698d[_0xe63b('0x5d')]){if(_0x109b8d['blockDuration']>0x0){if(moment(_0x46698d[_0xe63b('0x5e')])['add'](_0x109b8d[_0xe63b('0x5f')],'minutes')>moment()){return _0x3fffb3[_0xe63b('0x42')](0x191)[_0xe63b('0x44')]({'message':_0xe63b('0x5c')});}}else{return _0x3fffb3['status'](0x191)[_0xe63b('0x44')]({'message':_0xe63b('0x5c')});}}_0xbb423b[_0xe63b('0x3a')]={'id':_0x46698d['id']};_0x2b8a02();});})[_0xe63b('0x46')](function(){return _0x3fffb3['status'](0x191)[_0xe63b('0x44')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x2f562e){_0x2b8a02(_0x2f562e);}}else if(_0x52c17b){_0x2b8a02();}else{return _0x3fffb3[_0xe63b('0x42')](0x193)['json']({'message':_0xe63b('0x50')});}})[_0xe63b('0x39')](function(_0x1bc4a7,_0x3f07e2,_0x59ed9f){if(_0x1bc4a7[_0xe63b('0x3a')]){db[_0xe63b('0x54')][_0xe63b('0x4b')]({'where':{'id':_0x1bc4a7[_0xe63b('0x3a')]['id']},'attributes':userAttributes})['then'](function(_0x2ca11b){if(!_0x2ca11b){return _0x3f07e2[_0xe63b('0x42')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x1bc4a7[_0xe63b('0x3a')]=_0x2ca11b;_0x59ed9f();})[_0xe63b('0x46')](function(_0x2b0eab){_0x59ed9f(_0x2b0eab);});}else if(_0x52c17b){_0x59ed9f();}else{return _0x3f07e2['status'](0x194)[_0xe63b('0x44')]({'message':_0xe63b('0x60')});}});};exports[_0xe63b('0x61')]=function canUpdate(){return compose()[_0xe63b('0x39')](function(_0x5e6d1c,_0x4600fe,_0x44213b){return licenseUtil[_0xe63b('0x62')]()[_0xe63b('0x40')](function(_0x194594){if(_0x194594[_0xe63b('0x63')]){_0x44213b();}else{return _0x4600fe[_0xe63b('0x42')](0x193)[_0xe63b('0x44')]({'message':_0xe63b('0x64')});}})['catch'](function(_0x28cbb7){_0x44213b(_0x28cbb7);});});};exports[_0xe63b('0x65')]=function isWebrtcLicence(){return compose()[_0xe63b('0x39')](function(_0x39462e,_0x58216a,_0x23b822){return licenseUtil[_0xe63b('0x62')]()['then'](function(_0x5986c6){if(_0x5986c6['webrtc']){_0x23b822();}else{return _0x58216a[_0xe63b('0x42')](0x193)[_0xe63b('0x44')]({'message':_0xe63b('0x64')});}})[_0xe63b('0x46')](function(_0x58745c){_0x23b822(_0x58745c);});});};exports[_0xe63b('0x66')]=function(_0x3dd723,_0x31d270,_0x120c62){_0x3dd723[_0xe63b('0x66')]=!![];return _0x120c62();};exports['signToken']=function signToken(_0x5bdd29){return signJwt(_0x5bdd29);};exports[_0xe63b('0x67')]=function(_0x342e7d,_0x49f741){if(!_0x342e7d[_0xe63b('0x3a')]){return _0x49f741[_0xe63b('0x42')](0x194)[_0xe63b('0x44')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x1fe0f0={'payload':{'id':_0x342e7d[_0xe63b('0x3a')]['id'],'role':_0x342e7d['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x1fe0f0)[_0xe63b('0x40')](function(_0x4140e7){_0x49f741[_0xe63b('0x68')](_0xe63b('0x69'),_0x4140e7);_0x49f741[_0xe63b('0x6a')](_0xe63b('0x6b'));})['catch'](function(_0x22fb3d){return _0x49f741[_0xe63b('0x42')](0x1f4)['send'](_0x22fb3d);});};exports[_0xe63b('0x6c')]=function(_0x3f127b){if(_['isNil'](_0x3f127b[_0xe63b('0x58')])||_['isNil'](_0x3f127b['apiKeyIat'])){return null;}else{return createJwt(_0x3f127b);}};exports[_0xe63b('0x6d')]=function(_0x8268db){_0x8268db[_0xe63b('0x58')]=generateNonce();_0x8268db['apiKeyIat']=generateIssuedAt();return createJwt(_0x8268db);};exports['regenerateApiKey']=function(_0x5224c3,_0x5dac60){var _0xa0d2f8=_0x5224c3[_0xe63b('0x51')][_0xe63b('0x52')];if(_0xa0d2f8){var _0x2946e8={'nonce':_0x5dac60[_0xe63b('0x58')],'iat':_0x5dac60[_0xe63b('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xa0d2f8,_0x2946e8)['then'](function(){return generateApiKey(_0x5dac60);});}else{throw{'message':_0xe63b('0x6f')};}};exports['validatePasswordPattern']=function(_0x3f645f){var _0x227d30=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x227d30[_0xe63b('0x70')](_0x3f645f))throw new db['Sequelize'][(_0xe63b('0x71'))](_0xe63b('0x72'));return;};exports['validatePasswordHistory']=function(_0x3fa93a,_0x5e51fe,_0x455387){var _0x3edf8c=encryptor[_0xe63b('0x73')](_0x5e51fe)[_0xe63b('0x74')](',');for(var _0x285e18=0x0;_0x285e18<_0x455387;_0x285e18++){if(!_0x3edf8c[_0x285e18])break;if(_0x3fa93a[_0xe63b('0x75')]()===_0x3edf8c[_0x285e18]['toLowerCase']()){var _0x5509b3=util[_0xe63b('0x76')](_0xe63b('0x77'),_0x455387);if(_0x455387===0x1){_0x5509b3=_0xe63b('0x78');}throw new db[(_0xe63b('0x79'))][(_0xe63b('0x71'))](_0x5509b3);}}return;};exports[_0xe63b('0x7a')]=function(_0x5d8183,_0x21ae77){var _0x32be92=_0x21ae77?encryptor[_0xe63b('0x73')](_0x21ae77)['split'](','):[];if(_0x32be92[_0xe63b('0x7b')]===0x5){_0x32be92['splice'](-0x1,0x1);}_0x32be92['unshift'](_0x5d8183);return encryptor[_0xe63b('0x7c')](_0x32be92['join'](','));};function signJwt(_0x5e1a5b){var _0x157bb9=BPromise[_0xe63b('0x7d')](jwt[_0xe63b('0x7e')],{'context':jwt});var _0x1f6119=_0x5e1a5b[_0xe63b('0x7f')]||config[_0xe63b('0x80')][_0xe63b('0xc')];return new BPromise(function(_0x2d120b,_0x5e479d){_0x157bb9(_0x5e1a5b[_0xe63b('0x81')],_0x1f6119,_0x5e1a5b[_0xe63b('0x82')])['then'](function(_0x38c5c9){_0x2d120b(_0x38c5c9);})[_0xe63b('0x46')](function(_0x268b64){_0x5e479d(_0x268b64);});});}function verifyJwt(_0x1619f6,_0x5823a8,_0xb52536){var _0x437a02=BPromise[_0xe63b('0x7d')](jwt[_0xe63b('0x83')],{'context':jwt});var _0x96d1d0=_0xb52536||config[_0xe63b('0x80')][_0xe63b('0xc')];return new BPromise(function(_0xea4e09,_0x2b2736){_0x437a02(_0x1619f6,_0x96d1d0,_0x5823a8)[_0xe63b('0x40')](function(_0xcd8010){_0xea4e09(_0xcd8010);})['catch'](function(_0x128178){_0x2b2736(_0x128178);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xe63b('0x84')](_0xe63b('0x85'));}function generateIssuedAt(){return Math[_0xe63b('0x86')](Date[_0xe63b('0x87')]()/0x3e8)[_0xe63b('0x84')]();}function createJwt(_0xb157ce){var _0x33e134={'payload':{'iat':_0xb157ce['apiKeyIat'],'nonce':_0xb157ce[_0xe63b('0x58')]},'options':{'algorithm':_0xe63b('0x88'),'subject':_0xb157ce['id'][_0xe63b('0x84')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xe63b('0x53')]()}};return signJwt(_0x33e134)[_0xe63b('0x40')](function(_0x1f2e47){return{'iat':_0xb157ce[_0xe63b('0x6e')],'nonce':_0xb157ce['apiKeyNonce'],'token':_0x1f2e47};});} \ No newline at end of file +var _0xeb42=['smsAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','ChatInteraction','params','closed','disposition','query','forceDownload','status','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','Basic','find','then','authenticate','pass','json','Wrong\x20credentials.','user','headers','Bearer','apikey','getUuid','User','sub','Setting','findOne','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','options','verify','randomBytes','toString','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer'];(function(_0x3faf98,_0x4bfa5c){var _0x21c141=function(_0x4e556b){while(--_0x4e556b){_0x3faf98['push'](_0x3faf98['shift']());}};_0x21c141(++_0x4bfa5c);}(_0xeb42,0x1f2));var _0x2eb4=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xeb42[_0x455c6c];return _0x488242;};'use strict';var db=require(_0x2eb4('0x0'))['db'];var config=require(_0x2eb4('0x1'));var hardwareConf=require(_0x2eb4('0x2'));var licenseUtil=require(_0x2eb4('0x3'));var encryptor=require(_0x2eb4('0x4'));var _=require(_0x2eb4('0x5'));var jwt=require(_0x2eb4('0x6'));var expressJwt=require('express-jwt');var compose=require(_0x2eb4('0x7'));var basicAuth=require(_0x2eb4('0x8'));var crypto=require('crypto');var BPromise=require(_0x2eb4('0x9'));var util=require(_0x2eb4('0xa'));var moment=require(_0x2eb4('0xb'));var validateJwt=expressJwt({'secret':config[_0x2eb4('0xc')][_0x2eb4('0xd')]});var userAttributes=['id',_0x2eb4('0xe'),_0x2eb4('0xf'),'name',_0x2eb4('0x10'),_0x2eb4('0x11'),_0x2eb4('0x12'),_0x2eb4('0x13'),_0x2eb4('0x14'),_0x2eb4('0x15'),_0x2eb4('0x16'),_0x2eb4('0x17'),_0x2eb4('0x18'),_0x2eb4('0x19'),_0x2eb4('0x1a'),_0x2eb4('0x1b'),_0x2eb4('0x1c'),'lastLoginAt',_0x2eb4('0x1d'),_0x2eb4('0x1e'),_0x2eb4('0x1f'),_0x2eb4('0x20'),'alias',_0x2eb4('0x21'),_0x2eb4('0x22'),_0x2eb4('0x23'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x2eb4('0x24'),_0x2eb4('0x25'),'phoneBarPrefixRequired',_0x2eb4('0x26'),_0x2eb4('0x27'),_0x2eb4('0x28'),_0x2eb4('0x29'),'userProfileId',_0x2eb4('0x2a'),_0x2eb4('0x2b'),_0x2eb4('0x2c'),'downloadVoiceRecordings',_0x2eb4('0x2d'),_0x2eb4('0x2e'),_0x2eb4('0x2f'),_0x2eb4('0x30'),_0x2eb4('0x31'),_0x2eb4('0x32'),_0x2eb4('0x33'),_0x2eb4('0x34'),_0x2eb4('0x35'),_0x2eb4('0x36'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer',_0x2eb4('0x37'),'whatsappAutoanswer',_0x2eb4('0x38'),_0x2eb4('0x39')];exports[_0x2eb4('0x3a')]=function(){return this['isAuthenticated'](!![])[_0x2eb4('0x3b')](function(_0x223456,_0x3b1a70,_0x379e42){if(_0x223456['user']){_0x379e42();}else{return db[_0x2eb4('0x3c')]['findOne']({'where':{'id':_0x223456[_0x2eb4('0x3d')]['id']},'attributes':['id',_0x2eb4('0x3e'),_0x2eb4('0x3f')],'raw':!![]})['then'](function(_0x1aed7f){if(_0x1aed7f&&_0x1aed7f['closed']&&!_0x223456[_0x2eb4('0x40')][_0x2eb4('0x41')]){return _0x3b1a70[_0x2eb4('0x42')](_0x1aed7f[_0x2eb4('0x3f')]===_0x2eb4('0x43')?0x195:0x193)['json']({'message':_0x1aed7f[_0x2eb4('0x3f')]===_0x2eb4('0x43')?_0x2eb4('0x44'):_0x2eb4('0x45')});}else{_0x379e42();}})[_0x2eb4('0x46')](function(_0x45d5ce){_0x379e42(_0x45d5ce);});}});};exports['isAuthenticated']=function isAuthenticated(_0x33748f){return compose()['use'](function(_0x2ceac5,_0xcc049a,_0x2a2500){var _0x18dbcb;if(_0x2ceac5['headers'][_0x2eb4('0x47')]){if(_[_0x2eb4('0x48')](_0x2ceac5['headers'][_0x2eb4('0x47')],_0x2eb4('0x49'))){var _0x1eb5ae=basicAuth(_0x2ceac5);db['User'][_0x2eb4('0x4a')]({'where':{'name':_0x1eb5ae['name']}})[_0x2eb4('0x4b')](function(_0x504c08){if(!_0x504c08||!_0x504c08[_0x2eb4('0x4c')](_0x1eb5ae[_0x2eb4('0x4d')])){return _0xcc049a[_0x2eb4('0x42')](0x191)[_0x2eb4('0x4e')]({'message':_0x2eb4('0x4f')});}_0x2ceac5[_0x2eb4('0x50')]={'id':_0x504c08['id']};_0x2a2500();})[_0x2eb4('0x46')](function(_0x381194){_0x2a2500(_0x381194);});}else if(_[_0x2eb4('0x48')](_0x2ceac5[_0x2eb4('0x51')][_0x2eb4('0x47')],_0x2eb4('0x52'))){validateJwt(_0x2ceac5,_0xcc049a,_0x2a2500);}else{if(_0x33748f){_0x2a2500();}else{return _0xcc049a[_0x2eb4('0x42')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x2ceac5['query'][_0x2eb4('0x53')]){try{var _0x260838={'audience':hardwareConf[_0x2eb4('0x54')](),'issuer':hardwareConf[_0x2eb4('0x54')]()};verifyJwt(_0x2ceac5[_0x2eb4('0x40')]['apikey'],_0x260838)['then'](function(_0x164dcf){return db[_0x2eb4('0x55')][_0x2eb4('0x4a')]({'where':{'id':_0x164dcf[_0x2eb4('0x56')]}})[_0x2eb4('0x4b')](function(_0x459420){_0x18dbcb=_0x459420;return db[_0x2eb4('0x57')][_0x2eb4('0x58')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2eb4('0x59')],'raw':!![]});})[_0x2eb4('0x4b')](function(_0x59587f){if(!_0x18dbcb||!_['isEqual'](_0x18dbcb[_0x2eb4('0x5a')],_0x164dcf[_0x2eb4('0x5b')])){return _0xcc049a[_0x2eb4('0x42')](0x191)['json']({'message':_0x2eb4('0x5c')});}if(_0x18dbcb[_0x2eb4('0x5d')]){return _0xcc049a[_0x2eb4('0x42')](0x191)[_0x2eb4('0x4e')]({'message':_0x2eb4('0x5e')});}if(_0x18dbcb['blocked']){if(_0x59587f['blockDuration']>0x0){if(moment(_0x18dbcb['blockedAt'])['add'](_0x59587f[_0x2eb4('0x59')],'minutes')>moment()){return _0xcc049a['status'](0x191)['json']({'message':_0x2eb4('0x5e')});}}else{return _0xcc049a[_0x2eb4('0x42')](0x191)[_0x2eb4('0x4e')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x2ceac5['user']={'id':_0x18dbcb['id']};_0x2a2500();});})[_0x2eb4('0x46')](function(){return _0xcc049a[_0x2eb4('0x42')](0x191)[_0x2eb4('0x4e')]({'message':_0x2eb4('0x5e')});});}catch(_0x3ab7d8){_0x2a2500(_0x3ab7d8);}}else if(_0x33748f){_0x2a2500();}else{return _0xcc049a[_0x2eb4('0x42')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x2eb4('0x3b')](function(_0x4c32c0,_0x29885d,_0x306aa6){if(_0x4c32c0[_0x2eb4('0x50')]){db['User'][_0x2eb4('0x4a')]({'where':{'id':_0x4c32c0[_0x2eb4('0x50')]['id']},'attributes':userAttributes})[_0x2eb4('0x4b')](function(_0x526e7e){if(!_0x526e7e){return _0x29885d[_0x2eb4('0x42')](0x194)['json']({'message':_0x2eb4('0x5f')});}_0x4c32c0[_0x2eb4('0x50')]=_0x526e7e;_0x306aa6();})[_0x2eb4('0x46')](function(_0x2d47d1){_0x306aa6(_0x2d47d1);});}else if(_0x33748f){_0x306aa6();}else{return _0x29885d['status'](0x194)[_0x2eb4('0x4e')]({'message':_0x2eb4('0x60')});}});};exports[_0x2eb4('0x61')]=function canUpdate(){return compose()[_0x2eb4('0x3b')](function(_0x41404c,_0x33ec9c,_0x1d05cf){return licenseUtil[_0x2eb4('0x62')]()[_0x2eb4('0x4b')](function(_0x350db9){if(_0x350db9[_0x2eb4('0x63')]){_0x1d05cf();}else{return _0x33ec9c['status'](0x193)[_0x2eb4('0x4e')]({'message':'Forbidden'});}})['catch'](function(_0x3ebfeb){_0x1d05cf(_0x3ebfeb);});});};exports[_0x2eb4('0x64')]=function isWebrtcLicence(){return compose()['use'](function(_0x56c706,_0x2fa51f,_0x1a0cfe){return licenseUtil[_0x2eb4('0x62')]()[_0x2eb4('0x4b')](function(_0x5f03a3){if(_0x5f03a3[_0x2eb4('0x65')]){_0x1a0cfe();}else{return _0x2fa51f[_0x2eb4('0x42')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x2b2088){_0x1a0cfe(_0x2b2088);});});};exports[_0x2eb4('0x66')]=function(_0x2283c0,_0x24b6de,_0x40f362){_0x2283c0[_0x2eb4('0x66')]=!![];return _0x40f362();};exports[_0x2eb4('0x67')]=function signToken(_0x5525a9){return signJwt(_0x5525a9);};exports[_0x2eb4('0x68')]=function(_0x39415e,_0x467c54){if(!_0x39415e['user']){return _0x467c54[_0x2eb4('0x42')](0x194)[_0x2eb4('0x4e')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x33e871={'payload':{'id':_0x39415e[_0x2eb4('0x50')]['id'],'role':_0x39415e[_0x2eb4('0x50')][_0x2eb4('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x33e871)[_0x2eb4('0x4b')](function(_0x21e405){_0x467c54[_0x2eb4('0x69')](_0x2eb4('0x6a'),_0x21e405);_0x467c54[_0x2eb4('0x6b')](_0x2eb4('0x6c'));})[_0x2eb4('0x46')](function(_0x5abf6e){return _0x467c54['status'](0x1f4)['send'](_0x5abf6e);});};exports[_0x2eb4('0x6d')]=function(_0x9bee8c){if(_[_0x2eb4('0x6e')](_0x9bee8c['apiKeyNonce'])||_[_0x2eb4('0x6e')](_0x9bee8c['apiKeyIat'])){return null;}else{return createJwt(_0x9bee8c);}};exports[_0x2eb4('0x6f')]=function(_0x5998c8){_0x5998c8[_0x2eb4('0x5a')]=generateNonce();_0x5998c8[_0x2eb4('0x70')]=generateIssuedAt();return createJwt(_0x5998c8);};exports[_0x2eb4('0x71')]=function(_0x70d4db,_0x4a07b8){var _0x47391c=_0x70d4db['query'][_0x2eb4('0x53')];if(_0x47391c){var _0x40893c={'nonce':_0x4a07b8[_0x2eb4('0x5a')],'iat':_0x4a07b8[_0x2eb4('0x70')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x47391c,_0x40893c)['then'](function(){return generateApiKey(_0x4a07b8);});}else{throw{'message':_0x2eb4('0x72')};}};exports[_0x2eb4('0x73')]=function(_0x5652b3){var _0x24606d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x24606d['test'](_0x5652b3))throw new db['Sequelize']['ValidationError'](_0x2eb4('0x74'));return;};exports['validatePasswordHistory']=function(_0x57937e,_0xe6b59,_0xc365){var _0x493f84=encryptor['decryptString'](_0xe6b59)[_0x2eb4('0x75')](',');for(var _0x5d3be0=0x0;_0x5d3be0<_0xc365;_0x5d3be0++){if(!_0x493f84[_0x5d3be0])break;if(_0x57937e[_0x2eb4('0x76')]()===_0x493f84[_0x5d3be0]['toLowerCase']()){var _0x5c6cf5=util[_0x2eb4('0x77')](_0x2eb4('0x78'),_0xc365);if(_0xc365===0x1){_0x5c6cf5=_0x2eb4('0x79');}throw new db[(_0x2eb4('0x7a'))]['ValidationError'](_0x5c6cf5);}}return;};exports[_0x2eb4('0x7b')]=function(_0x125a29,_0x465bc6){var _0x445c8a=_0x465bc6?encryptor['decryptString'](_0x465bc6)[_0x2eb4('0x75')](','):[];if(_0x445c8a[_0x2eb4('0x7c')]===0x5){_0x445c8a[_0x2eb4('0x7d')](-0x1,0x1);}_0x445c8a[_0x2eb4('0x7e')](_0x125a29);return encryptor[_0x2eb4('0x7f')](_0x445c8a[_0x2eb4('0x80')](','));};function signJwt(_0x10d014){var _0x17ebc5=BPromise[_0x2eb4('0x81')](jwt[_0x2eb4('0x82')],{'context':jwt});var _0x4ea9ea=_0x10d014[_0x2eb4('0x83')]||config[_0x2eb4('0xc')][_0x2eb4('0xd')];return new BPromise(function(_0x31ea3e,_0x2035a3){_0x17ebc5(_0x10d014['payload'],_0x4ea9ea,_0x10d014[_0x2eb4('0x84')])[_0x2eb4('0x4b')](function(_0x2fa7f7){_0x31ea3e(_0x2fa7f7);})[_0x2eb4('0x46')](function(_0xa91af6){_0x2035a3(_0xa91af6);});});}function verifyJwt(_0x1c2a6f,_0x120399,_0x54d292){var _0x152263=BPromise[_0x2eb4('0x81')](jwt[_0x2eb4('0x85')],{'context':jwt});var _0x253c84=_0x54d292||config[_0x2eb4('0xc')][_0x2eb4('0xd')];return new BPromise(function(_0x4b7d4e,_0x7ef9a){_0x152263(_0x1c2a6f,_0x253c84,_0x120399)['then'](function(_0x3f4e58){_0x4b7d4e(_0x3f4e58);})[_0x2eb4('0x46')](function(_0x526ccd){_0x7ef9a(_0x526ccd);});});}function generateNonce(){return crypto[_0x2eb4('0x86')](0x10)[_0x2eb4('0x87')]('hex');}function generateIssuedAt(){return Math[_0x2eb4('0x88')](Date[_0x2eb4('0x89')]()/0x3e8)['toString']();}function createJwt(_0x56d5bc){var _0x3f37c5={'payload':{'iat':_0x56d5bc[_0x2eb4('0x70')],'nonce':_0x56d5bc[_0x2eb4('0x5a')]},'options':{'algorithm':'HS512','subject':_0x56d5bc['id'][_0x2eb4('0x87')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x2eb4('0x54')]()}};return signJwt(_0x3f37c5)[_0x2eb4('0x4b')](function(_0x23e3df){return{'iat':_0x56d5bc[_0x2eb4('0x70')],'nonce':_0x56d5bc[_0x2eb4('0x5a')],'token':_0x23e3df};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index e0d4c51..54911e2 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 _0xe92f=['map','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','rows','catch','describe','CmContact','keys','filter','startsWith','cf_','CmCustomField','findOne','all','fieldType','type'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0xe92f,0x91));var _0xfe92=function(_0x5f4ce8,_0x49c119){_0x5f4ce8=_0x5f4ce8-0x0;var _0x1a9f59=_0xe92f[_0x5f4ce8];return _0x1a9f59;};'use strict';var _=require(_0xfe92('0x0'));var sqlUtils=require(_0xfe92('0x1'));var db=require(_0xfe92('0x2'))['db'];exports[_0xfe92('0x3')]=function(_0x5dc5f2,_0x310d6a,_0x17cbe6,_0x1ea13b){var _0x5aaeaf={'count':0x0,'rows':[]};var _0x75cf54=sqlUtils[_0xfe92('0x4')](_0x310d6a,_0x5dc5f2);if(_0x75cf54){return Promise[_0xfe92('0x5')](_0x5aaeaf);}var _0x351572=sqlUtils['getContactsSubquery']();var _0x253a31={};var _0x1029da=![];var _0x107cae=![];return Promise['resolve']()[_0xfe92('0x6')](function(){if(_0x5dc5f2[_0xfe92('0x7')]){return sqlUtils[_0xfe92('0x8')](_0x5dc5f2[_0xfe92('0x7')],_0x1ea13b);}else{return sqlUtils[_0xfe92('0x9')](_0x5dc5f2,_0x1ea13b);}})[_0xfe92('0x6')](function(_0x55091b){_0x351572['where'](_0x55091b[_0xfe92('0xa')]);_0x351572[_0xfe92('0xb')](_0x55091b[_0xfe92('0xc')]);_0x351572[_0xfe92('0xb')](_0x55091b['filter']);_0x351572[_0xfe92('0xb')](_0x55091b[_0xfe92('0xd')]['clause']);_0x253a31=_0x55091b['tags'];_0x107cae=_0x55091b[_0xfe92('0xd')][_0xfe92('0xe')];return sqlUtils[_0xfe92('0xf')](_0x310d6a,_0x5dc5f2,_0x107cae);})[_0xfe92('0x6')](function(_0x121c95){_0x351572[_0xfe92('0xb')](_0x121c95);var _0xacc545=_0x5dc5f2['search']?_0x253a31[_0xfe92('0x10')]:_0x5dc5f2[_0xfe92('0x11')];_0x1029da=_0xacc545?!![]:![];return sqlUtils[_0xfe92('0x12')](_0x351572,_0xacc545);})[_0xfe92('0x6')](function(_0x446761){_0x5aaeaf[_0xfe92('0x13')]=_0x446761;if(_0x5aaeaf[_0xfe92('0x13')]===0x0){return;}if(_0x5dc5f2['User']){_0x107cae=!![];}return sqlUtils[_0xfe92('0x14')](_0x351572,_0x5dc5f2[_0xfe92('0xc')],_0x17cbe6,_0x1029da,_0x253a31[_0xfe92('0x15')],_0x107cae);})[_0xfe92('0x6')](function(_0x2e6fae){if(!_0x2e6fae){return[];}return sqlUtils['getFilteredContacts'](_0x2e6fae,_0x5dc5f2,_0x17cbe6);})[_0xfe92('0x6')](function(_0x4c1587){_0x5aaeaf[_0xfe92('0x16')]=_0x4c1587;return _0x5aaeaf;})[_0xfe92('0x17')](function(_0x51cc03){throw _0x51cc03;});};exports[_0xfe92('0x18')]=function(){var _0x2b59f8={};var _0x5b0c77=[];return db[_0xfe92('0x19')][_0xfe92('0x18')]()[_0xfe92('0x6')](function(_0x3f49da){_0x2b59f8=_0x3f49da;var _0x4ea6f1=Object[_0xfe92('0x1a')](_0x2b59f8)[_0xfe92('0x1b')](function(_0x38b666){return _[_0xfe92('0x1c')](_0x38b666,_0xfe92('0x1d'))?_0x38b666:undefined;});var _0x5071c7=_0x4ea6f1['map'](function(_0xeddb2f){return db[_0xfe92('0x1e')][_0xfe92('0x1f')]({'where':{'id':_0xeddb2f['slice'](0x3)},'raw':!![]});});return Promise[_0xfe92('0x20')](_0x5071c7);})[_0xfe92('0x6')](function(_0xb4ed84){for(var _0x9b8010=0x0;_0x9b8010<_0xb4ed84['length'];_0x9b8010++){if(_0xb4ed84[_0x9b8010]){var _0x28d854=_0xfe92('0x1d')+_0xb4ed84[_0x9b8010]['id'];_0x2b59f8[_0x28d854][_0xfe92('0x21')]=_0xb4ed84[_0x9b8010][_0xfe92('0x22')];}}_0x5b0c77=_[_0xfe92('0x23')](Object[_0xfe92('0x1a')](_0x2b59f8),function(_0x1166ce){return{'name':_0x1166ce,'type':_0x2b59f8[_0x1166ce][_0xfe92('0x22')]};});return _0x5b0c77;})['catch'](function(_0x4543cd){throw _0x4543cd;});}; \ No newline at end of file +var _0xc7e3=['parseQueryParameters','where','default','fields','filter','user','tags','ids','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','catch','describe','CmContact','keys','startsWith','CmCustomField','findOne','slice','length','cf_','type','map','./sql-utils','../../mysqldb','skipContactsQuery','resolve','then','search'];(function(_0x281457,_0x5d9e3c){var _0x2dea1e=function(_0x42aca8){while(--_0x42aca8){_0x281457['push'](_0x281457['shift']());}};_0x2dea1e(++_0x5d9e3c);}(_0xc7e3,0x14f));var _0x3c7e=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0xc7e3[_0x512c83];return _0x1f7f25;};'use strict';var _=require('lodash');var sqlUtils=require(_0x3c7e('0x0'));var db=require(_0x3c7e('0x1'))['db'];exports['findAll']=function(_0x50f16c,_0x102062,_0x1d7032,_0x3f077b){var _0x31b97c={'count':0x0,'rows':[]};var _0x1e77b2=sqlUtils[_0x3c7e('0x2')](_0x102062,_0x50f16c);if(_0x1e77b2){return Promise[_0x3c7e('0x3')](_0x31b97c);}var _0x4636bb=sqlUtils['getContactsSubquery']();var _0x3cefa3={};var _0x58ab7b=![];var _0x3cdf8d=![];return Promise['resolve']()[_0x3c7e('0x4')](function(){if(_0x50f16c[_0x3c7e('0x5')]){return sqlUtils['parseAdvancedSearchFilter'](_0x50f16c[_0x3c7e('0x5')],_0x3f077b);}else{return sqlUtils[_0x3c7e('0x6')](_0x50f16c,_0x3f077b);}})[_0x3c7e('0x4')](function(_0x3ba051){_0x4636bb[_0x3c7e('0x7')](_0x3ba051[_0x3c7e('0x8')]);_0x4636bb[_0x3c7e('0x7')](_0x3ba051[_0x3c7e('0x9')]);_0x4636bb[_0x3c7e('0x7')](_0x3ba051[_0x3c7e('0xa')]);_0x4636bb['where'](_0x3ba051[_0x3c7e('0xb')]['clause']);_0x3cefa3=_0x3ba051[_0x3c7e('0xc')];_0x3cdf8d=_0x3ba051['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x102062,_0x50f16c,_0x3cdf8d);})['then'](function(_0x577d76){_0x4636bb[_0x3c7e('0x7')](_0x577d76);var _0xe1087=_0x50f16c['search']?_0x3cefa3[_0x3c7e('0xd')]:_0x50f16c['tag'];_0x58ab7b=_0xe1087?!![]:![];return sqlUtils[_0x3c7e('0xe')](_0x4636bb,_0xe1087);})['then'](function(_0x3b69bb){_0x31b97c['count']=_0x3b69bb;if(_0x31b97c[_0x3c7e('0xf')]===0x0){return;}if(_0x50f16c['User']){_0x3cdf8d=!![];}return sqlUtils[_0x3c7e('0x10')](_0x4636bb,_0x50f16c[_0x3c7e('0x9')],_0x1d7032,_0x58ab7b,_0x3cefa3[_0x3c7e('0x11')],_0x3cdf8d);})['then'](function(_0x2c3fa2){if(!_0x2c3fa2){return[];}return sqlUtils[_0x3c7e('0x12')](_0x2c3fa2,_0x50f16c,_0x1d7032);})[_0x3c7e('0x4')](function(_0x46c508){_0x31b97c['rows']=_0x46c508;return _0x31b97c;})[_0x3c7e('0x13')](function(_0x5563c2){throw _0x5563c2;});};exports[_0x3c7e('0x14')]=function(){var _0x3dc767={};var _0x16d6b3=[];return db[_0x3c7e('0x15')][_0x3c7e('0x14')]()[_0x3c7e('0x4')](function(_0x3117b7){_0x3dc767=_0x3117b7;var _0xb16615=Object[_0x3c7e('0x16')](_0x3dc767)['filter'](function(_0x28012a){return _[_0x3c7e('0x17')](_0x28012a,'cf_')?_0x28012a:undefined;});var _0x2f9f41=_0xb16615['map'](function(_0x29fd1c){return db[_0x3c7e('0x18')][_0x3c7e('0x19')]({'where':{'id':_0x29fd1c[_0x3c7e('0x1a')](0x3)},'raw':!![]});});return Promise['all'](_0x2f9f41);})[_0x3c7e('0x4')](function(_0x5980ba){for(var _0x36733a=0x0;_0x36733a<_0x5980ba[_0x3c7e('0x1b')];_0x36733a++){if(_0x5980ba[_0x36733a]){var _0x3943c5=_0x3c7e('0x1c')+_0x5980ba[_0x36733a]['id'];_0x3dc767[_0x3943c5]['fieldType']=_0x5980ba[_0x36733a][_0x3c7e('0x1d')];}}_0x16d6b3=_[_0x3c7e('0x1e')](Object['keys'](_0x3dc767),function(_0x27ca31){return{'name':_0x27ca31,'type':_0x3dc767[_0x27ca31]['type']};});return _0x16d6b3;})[_0x3c7e('0x13')](function(_0x1bf6e9){throw _0x1bf6e9;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 3039216..71c4211 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 _0x8780=['updatedAt','deletedAt','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','escapeLIKESpecialChars','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','buildExpression','type','default','text','value','start','end','Tag','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','tag','filter','role','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','order','DESC','color','Sequelize','SELECT','CmContact','sequelize','Tags','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','QueryTypes','query','toString','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','cm_user_has_contacts','uc.CmContactId\x20=\x20','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','subqry','firstName','lastName','phone','mobile','fax','email','createdAt'];(function(_0x4477ba,_0xb8db66){var _0x55021d=function(_0x48e969){while(--_0x48e969){_0x4477ba['push'](_0x4477ba['shift']());}};_0x55021d(++_0xb8db66);}(_0x8780,0x11b));var _0x0878=function(_0x29d3cb,_0x2087ac){_0x29d3cb=_0x29d3cb-0x0;var _0x187e06=_0x8780[_0x29d3cb];return _0x187e06;};'use strict';var _=require('lodash');var squel=require(_0x0878('0x0'));var as=require(_0x0878('0x1'));var qs=require(_0x0878('0x2'));var utils=require('../interaction/utils');var db=require(_0x0878('0x3'))['db'];function skipContactsQuery(_0x4c28a4,_0x659cda){var _0x3c1771=![];if(_0x4c28a4['role']===_0x0878('0x4')&&!_0x659cda[_0x0878('0x5')]&&!_0x659cda[_0x0878('0x6')]&&_0x659cda[_0x0878('0x7')]!==_0x0878('0x8')){_0x3c1771=!![];}return _0x3c1771;}function getContactsSubquery(){return squel[_0x0878('0x9')]()[_0x0878('0xa')](_0x0878('0xb'),'c')[_0x0878('0xc')](_0x0878('0xd'));}function applyJoinClauses(_0x12f367,_0x28a2b2){var _0x921940=_0x28a2b2?'c':'subqry';_0x12f367['left_join'](_0x0878('0xe'),'uc',_0x0878('0xf')+_0x921940+'.id')[_0x0878('0x10')](_0x0878('0x11'),'ct',_0x0878('0x12')+_0x921940+_0x0878('0x13'))[_0x0878('0x10')](_0x0878('0x14'),'t','t.id\x20=\x20ct.TagId');return _0x12f367;}function addFieldsToQuery(_0xb1d6c6,_0x2197ad,_0xe15a6f,_0x3b6b74,_0x34e2f4){var _0xed6b5a=_0x34e2f4?'c':_0x0878('0x15');if(!_0x2197ad){_0x2197ad=['id',_0x0878('0x16'),_0x0878('0x17'),_0x0878('0x18'),_0x0878('0x19'),_0x0878('0x1a'),_0x0878('0x1b'),_0x0878('0x6'),'CompanyId',_0x0878('0x1c'),_0x0878('0x1d'),_0x0878('0x1e'),'TagIds'];}else if(!_0x2197ad['includes']('id')){_0x2197ad[_0x0878('0x1f')]('id');}var _0x2bfd14=_0xe15a6f&&_0x34e2f4||!_0xe15a6f&&!_0x34e2f4;if(_0x3b6b74){_0x2bfd14=_0x3b6b74&&_0x34e2f4||!_0x3b6b74&&!_0x34e2f4;}_0x2197ad[_0x0878('0x20')](function(_0x1d8592){if(_0x1d8592===_0x0878('0x21')){if(_0x2bfd14){_0xb1d6c6[_0x0878('0x22')](_0x0878('0x23'),_0x1d8592);}else if(_0xe15a6f||_0x3b6b74){_0xb1d6c6[_0x0878('0x22')](_0xed6b5a+'.'+_0x1d8592);}}else{_0xb1d6c6['field'](_0xed6b5a+'.'+_0x1d8592);}});return _0xb1d6c6;}function getSqlClauses(){var _0x3a0726={'default':squel['expr'](),'fields':squel[_0x0878('0x24')](),'filter':squel['expr'](),'tags':{'clause':squel[_0x0878('0x24')](),'ids':null},'user':{'clause':squel[_0x0878('0x24')](),'skip':![]}};return _0x3a0726;}function parseTagParameter(_0x3d53e1){var _0x371850=squel['expr']();if(_0x3d53e1){var _0x3cf0f9=utils[_0x0878('0x25')](_0x3d53e1);_0x3cf0f9[_0x0878('0x20')](function(_0x320871){_0x371850['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x320871+',%');});}return _0x371850;}function parseSearchFilter(_0x23c566){var _0x53d684=squel[_0x0878('0x24')]();if(_0x23c566){var _0x3afe70=_0x23c566[_0x0878('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x131822=qs[_0x0878('0x27')](_0x3afe70);if(_0x3afe70[_0x0878('0x28')]('\x20')[_0x0878('0x29')]>0x1){_0x53d684['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0878('0x2a')](_0x3afe70,!![]),null);}else{if(qs[_0x0878('0x2b')](_0x3afe70)){_0x53d684['or'](_0x0878('0x2c'),_0x131822+'%');_0x53d684['or']('c.phone\x20LIKE\x20?',_0x131822+'%');_0x53d684['or']('c.mobile\x20LIKE\x20?',_0x131822+'%');_0x53d684['or'](_0x0878('0x2d'),_0x131822+'%');}else if(qs[_0x0878('0x2e')](_0x3afe70)){_0x53d684['or'](_0x0878('0x2f'),_0x131822+'%');}else{_0x53d684['or']('c.firstName\x20LIKE\x20?','%'+_0x131822+'%');_0x53d684['or'](_0x0878('0x30'),'%'+_0x131822+'%');_0x53d684['or'](_0x0878('0x2f'),'%'+_0x131822+'%');}}}return _0x53d684;}function parseAdvancedSearchFilter(_0xb2283a,_0x4a57c0){var _0x3a8e4a=getSqlClauses();var _0x6acdde=as['parseSearch'](_0xb2283a);var _0xaefb81=_0x6acdde[_0x0878('0x31')];for(var _0x26fef4=0x0;_0x26fef4<_0x6acdde[_0x0878('0x32')][_0x0878('0x29')];_0x26fef4++){var _0x23ec1f=_0x6acdde[_0x0878('0x32')][_0x26fef4];var _0x2bd8a5='c';var _0x5b9da7=_[_0x0878('0x33')](_0x4a57c0,[_0x0878('0x34'),_0x23ec1f[_0x0878('0x22')]]);if(_0x5b9da7){if(_0x23ec1f['field']===_0x0878('0x35')||_0x5b9da7['fieldType']===_0x0878('0x36')){_0x23ec1f[_0x0878('0x37')]='DATE';}var _0x34c4d3=as[_0x0878('0x38')](_0x2bd8a5,_0x5b9da7[_0x0878('0x39')],_0x23ec1f);_0x3a8e4a[_0x0878('0x3a')][_0xaefb81](_0x34c4d3[_0x0878('0x3b')],_0x34c4d3[_0x0878('0x3c')][_0x0878('0x3d')],_0x34c4d3['value'][_0x0878('0x3e')]);}else{if(_0x23ec1f[_0x0878('0x22')]===_0x0878('0x3f')){var _0x139f3e=_0x23ec1f[_0x0878('0x3c')][_0x0878('0x28')](',')[_0x0878('0x40')](function(_0x43a383){return Number(_0x43a383);});var _0x3af590=parseTagParameter(_0x139f3e);_0x3a8e4a[_0x0878('0x41')][_0x0878('0x42')][_0x0878('0x43')](_0x3af590);_0x3a8e4a[_0x0878('0x41')][_0x0878('0x44')]=_0x139f3e;}else if(_0x23ec1f['field']===_0x0878('0x45')){_0x3a8e4a['user'][_0x0878('0x42')]['and'](_0x0878('0x46'),_0x23ec1f['value']);_0x3a8e4a['user']['skip']=!![];}}}return _0x3a8e4a;}function parseModelFields(_0x24c83e,_0x133301){var _0x297d2e=squel[_0x0878('0x24')]();var _0x2086de=_(_0x24c83e)[_0x0878('0x47')]()[_0x0878('0x40')](function(_0xac2a26){return _[_0x0878('0x48')](_0x133301,[_0x0878('0x34'),_0xac2a26])?_0xac2a26:undefined;})[_0x0878('0x49')]()[_0x0878('0x3c')]();if(_0x24c83e['Contact']){_0x2086de[_0x0878('0x1f')](_0x0878('0x4a'));}if(_0x24c83e[_0x0878('0x45')]){_0x2086de['push'](_0x0878('0x45'));}if(_0x2086de[_0x0878('0x29')]>0x0){_0x2086de[_0x0878('0x20')](function(_0x519036){if(_0x519036===_0x0878('0x6')){_0x297d2e[_0x0878('0x43')](_0x0878('0x4b'),[][_0x0878('0x4c')](_0x24c83e[_0x519036]));}else if(_0x519036==='Contact'){var _0x50ab53='%'+_0x24c83e[_0x519036]+'%';_0x297d2e[_0x0878('0x43')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x50ab53);}else if(_0x519036===_0x0878('0x45')){_0x297d2e[_0x0878('0x43')](_0x0878('0x46'),_0x24c83e[_0x519036]);}else{_0x297d2e[_0x0878('0x43')]('c.'+_0x519036+_0x0878('0x4d'),_0x24c83e[_0x519036]);}});}return _0x297d2e;}function parseQueryParameters(_0x5adc0e,_0x99719d){var _0xe2b51f=getSqlClauses();return Promise[_0x0878('0x4e')]()['then'](function(){return parseModelFields(_0x5adc0e,_0x99719d);})[_0x0878('0x4f')](function(_0xc577ea){_0xe2b51f['fields'][_0x0878('0x43')](_0xc577ea);return parseTagParameter(_0x5adc0e[_0x0878('0x50')]);})[_0x0878('0x4f')](function(_0x3688fa){_0xe2b51f['tags'][_0x0878('0x42')][_0x0878('0x43')](_0x3688fa);return parseSearchFilter(_0x5adc0e[_0x0878('0x51')]);})[_0x0878('0x4f')](function(_0x4864ac){_0xe2b51f[_0x0878('0x51')]=_0x4864ac;return _0xe2b51f;});}function checkListsRestrictions(_0x119c0a,_0x4687a0,_0x35eb3d){var _0x3b6e68=squel[_0x0878('0x24')]();return Promise[_0x0878('0x4e')]()[_0x0878('0x4f')](function(){if(_0x4687a0['search']&&_0x119c0a[_0x0878('0x52')]===_0x0878('0x4')&&!_0x35eb3d){return _0x119c0a[_0x0878('0x53')]({'attributes':['id'],'raw':!![]});}})[_0x0878('0x4f')](function(_0x1f483e){if(_0x1f483e){if(_0x1f483e[_0x0878('0x29')]===0x0){_0x3b6e68[_0x0878('0x43')](_0x0878('0x54'));}else{_0x3b6e68[_0x0878('0x43')](_0x0878('0x4b'),_[_0x0878('0x40')](_0x1f483e,'id'));}}})[_0x0878('0x4f')](function(){return _0x3b6e68;});}function buildContactsQuery(_0x265880,_0x5d38e6,_0x36bb0f,_0x1efce8,_0x4e4b78,_0x355330){if(_0x5d38e6){_0x5d38e6=_0x36bb0f[_0x0878('0x55')];}_0x265880=addFieldsToQuery(_0x265880,_0x5d38e6,_0x1efce8,_0x355330,!![]);var _0x5c3176=squel[_0x0878('0x9')]();_0x5c3176=addFieldsToQuery(_0x5c3176,_0x5d38e6,_0x1efce8,_0x355330,![]);if(_0x1efce8||_0x355330){_0x265880=applyJoinClauses(_0x265880,!![]);_0x265880[_0x0878('0x56')]('c.id');if(_0x36bb0f[_0x0878('0x57')]){_0x5c3176[_0x0878('0x57')](_0x36bb0f['limit']);}if(_0x36bb0f[_0x0878('0x58')]){_0x5c3176[_0x0878('0x58')](_0x36bb0f[_0x0878('0x58')]);}}else{_0x5c3176=applyJoinClauses(_0x5c3176,![]);_0x5c3176['group']('subqry.id');if(_0x36bb0f['limit']){_0x265880['limit'](_0x36bb0f[_0x0878('0x57')]);}if(_0x36bb0f[_0x0878('0x58')]){_0x265880[_0x0878('0x58')](_0x36bb0f[_0x0878('0x58')]);}}_0x5c3176['having'](_0x4e4b78);if(_0x36bb0f[_0x0878('0x59')]){_0x36bb0f[_0x0878('0x59')][_0x0878('0x20')](function(_0x10f1e1){_0x265880[_0x0878('0x59')]('c.'+_0x10f1e1[0x0],_0x10f1e1[0x1]==='DESC'?![]:!![]);_0x5c3176[_0x0878('0x59')]('subqry.'+_0x10f1e1[0x0],_0x10f1e1[0x1]===_0x0878('0x5a')?![]:!![]);});}_0x5c3176[_0x0878('0xa')](_0x265880,_0x0878('0x15'));return _0x5c3176;}function getFilteredContacts(_0x4a0e10){var _0xaa2bd=[];return db[_0x0878('0x3f')]['findAll']({'attributes':['id','name',_0x0878('0x5b')],'raw':!![]})[_0x0878('0x4f')](function(_0x56928c){_0xaa2bd=_['keyBy'](_0x56928c,'id');var _0x2db65a={'type':db[_0x0878('0x5c')]['QueryTypes'][_0x0878('0x5d')],'model':db[_0x0878('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x0878('0x5f')]['query'](_0x4a0e10['toString'](),_0x2db65a);})[_0x0878('0x4f')](function(_0x14d07d){_0x14d07d[_0x0878('0x20')](function(_0x17c518){if(_0x17c518[_0x0878('0x21')]){_0x17c518[_0x0878('0x60')]=[];_0x17c518[_0x0878('0x21')][_0x0878('0x28')](',')[_0x0878('0x20')](function(_0x1fed16){_0x17c518['Tags']['push'](_0xaa2bd[_0x1fed16]);});}delete _0x17c518[_0x0878('0x21')];});return _0x14d07d;});}function countFilteredContacts(_0x3e39e5,_0x507424){var _0x900574=_0x3e39e5['clone']();_0x900574[_0x0878('0x22')](_0x0878('0x61'));_0x900574=applyJoinClauses(_0x900574,!![]);_0x3e39e5[_0x0878('0x56')](_0x0878('0x62'));var _0x76a2b0=utils[_0x0878('0x25')](_0x507424);if(!_[_0x0878('0x63')](_0x76a2b0)){_0x900574[_0x0878('0xc')](_0x0878('0x64'),_0x76a2b0);}var _0x3e5c3d={'type':db[_0x0878('0x5c')][_0x0878('0x65')][_0x0878('0x5d')],'raw':!![]};return db[_0x0878('0x5f')][_0x0878('0x66')](_0x900574[_0x0878('0x67')](),_0x3e5c3d)[_0x0878('0x4f')](function(_0x34721b){return _0x34721b[0x0][_0x0878('0x61')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xd09e=['Tag','split','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','some','compact','Contact','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','length','attributes','group','limit','offset','having','order','DESC','subqry.','findAll','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','t.id\x20IN\x20?','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','subqry','firstName','phone','mobile','fax','email','CompanyId','updatedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','end'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd09e,0x9c));var _0xed09=function(_0x380ccf,_0x112e26){_0x380ccf=_0x380ccf-0x0;var _0x5c04a0=_0xd09e[_0x380ccf];return _0x5c04a0;};'use strict';var _=require(_0xed09('0x0'));var squel=require(_0xed09('0x1'));var as=require(_0xed09('0x2'));var qs=require(_0xed09('0x3'));var utils=require(_0xed09('0x4'));var db=require(_0xed09('0x5'))['db'];function skipContactsQuery(_0x575ea1,_0x5e0acc){var _0x451e7e=![];if(_0x575ea1[_0xed09('0x6')]===_0xed09('0x7')&&!_0x5e0acc[_0xed09('0x8')]&&!_0x5e0acc[_0xed09('0x9')]&&_0x5e0acc[_0xed09('0xa')]!==_0xed09('0xb')){_0x451e7e=!![];}return _0x451e7e;}function getContactsSubquery(){return squel[_0xed09('0xc')]()[_0xed09('0xd')]('cm_contacts','c')[_0xed09('0xe')](_0xed09('0xf'));}function applyJoinClauses(_0x2c8999,_0x1d61c1){var _0x47237d=_0x1d61c1?'c':'subqry';_0x2c8999[_0xed09('0x10')](_0xed09('0x11'),'uc','uc.CmContactId\x20=\x20'+_0x47237d+_0xed09('0x12'))[_0xed09('0x10')](_0xed09('0x13'),'ct',_0xed09('0x14')+_0x47237d+_0xed09('0x12'))[_0xed09('0x10')](_0xed09('0x15'),'t','t.id\x20=\x20ct.TagId');return _0x2c8999;}function addFieldsToQuery(_0x21591d,_0x4c3e40,_0x38b2c9,_0x42221d,_0x535d2d){var _0xb993ca=_0x535d2d?'c':_0xed09('0x16');if(!_0x4c3e40){_0x4c3e40=['id',_0xed09('0x17'),'lastName',_0xed09('0x18'),_0xed09('0x19'),_0xed09('0x1a'),_0xed09('0x1b'),'ListId',_0xed09('0x1c'),'createdAt',_0xed09('0x1d'),'deletedAt',_0xed09('0x1e')];}else if(!_0x4c3e40[_0xed09('0x1f')]('id')){_0x4c3e40[_0xed09('0x20')]('id');}var _0x203f0a=_0x38b2c9&&_0x535d2d||!_0x38b2c9&&!_0x535d2d;if(_0x42221d){_0x203f0a=_0x42221d&&_0x535d2d||!_0x42221d&&!_0x535d2d;}_0x4c3e40[_0xed09('0x21')](function(_0x23efea){if(_0x23efea===_0xed09('0x1e')){if(_0x203f0a){_0x21591d['field'](_0xed09('0x22'),_0x23efea);}else if(_0x38b2c9||_0x42221d){_0x21591d[_0xed09('0x23')](_0xb993ca+'.'+_0x23efea);}}else{_0x21591d[_0xed09('0x23')](_0xb993ca+'.'+_0x23efea);}});return _0x21591d;}function getSqlClauses(){var _0x580d74={'default':squel[_0xed09('0x24')](),'fields':squel[_0xed09('0x24')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xed09('0x24')](),'ids':null},'user':{'clause':squel[_0xed09('0x24')](),'skip':![]}};return _0x580d74;}function parseTagParameter(_0x3d6c1c){var _0x3b2c2c=squel[_0xed09('0x24')]();if(_0x3d6c1c){var _0x9aedb6=utils[_0xed09('0x25')](_0x3d6c1c);_0x9aedb6[_0xed09('0x21')](function(_0x20f8b9){_0x3b2c2c['or'](_0xed09('0x26'),'%,'+_0x20f8b9+',%');});}return _0x3b2c2c;}function parseSearchFilter(_0x68c488){var _0x12f2cb=squel[_0xed09('0x24')]();if(_0x68c488){var _0x60f2f5=_0x68c488[_0xed09('0x27')]('\x5c','\x5c\x5c')[_0xed09('0x27')](/'/g,'\x27\x27');var _0x308a8b=qs[_0xed09('0x28')](_0x60f2f5);if(_0x60f2f5['split']('\x20')['length']>0x1){_0x12f2cb['or'](_0xed09('0x29'),qs[_0xed09('0x2a')](_0x60f2f5,!![]),null);}else{if(qs['isNumeric'](_0x60f2f5)){_0x12f2cb['or'](_0xed09('0x2b'),_0x308a8b+'%');_0x12f2cb['or'](_0xed09('0x2c'),_0x308a8b+'%');_0x12f2cb['or'](_0xed09('0x2d'),_0x308a8b+'%');_0x12f2cb['or'](_0xed09('0x2e'),_0x308a8b+'%');}else if(qs[_0xed09('0x2f')](_0x60f2f5)){_0x12f2cb['or'](_0xed09('0x30'),_0x308a8b+'%');}else{_0x12f2cb['or']('c.firstName\x20LIKE\x20?','%'+_0x308a8b+'%');_0x12f2cb['or'](_0xed09('0x31'),'%'+_0x308a8b+'%');_0x12f2cb['or']('c.email\x20LIKE\x20?','%'+_0x308a8b+'%');}}}return _0x12f2cb;}function parseAdvancedSearchFilter(_0x43d94a,_0x25d5ca){var _0x5daf12=getSqlClauses();var _0xc0531e=as['parseSearch'](_0x43d94a);var _0x2a5f09=_0xc0531e[_0xed09('0x32')];for(var _0x123497=0x0;_0x123497<_0xc0531e[_0xed09('0x33')]['length'];_0x123497++){var _0x5a7598=_0xc0531e[_0xed09('0x33')][_0x123497];var _0x285b1f='c';var _0x458a64=_[_0xed09('0x34')](_0x25d5ca,[_0xed09('0x35'),_0x5a7598[_0xed09('0x23')]]);if(_0x458a64){if(_0x5a7598[_0xed09('0x23')]===_0xed09('0x36')||_0x458a64[_0xed09('0x37')]===_0xed09('0x38')){_0x5a7598[_0xed09('0x39')]=_0xed09('0x3a');}var _0x4bfdc7=as[_0xed09('0x3b')](_0x285b1f,_0x458a64[_0xed09('0x3c')],_0x5a7598);_0x5daf12[_0xed09('0x3d')][_0x2a5f09](_0x4bfdc7[_0xed09('0x3e')],_0x4bfdc7[_0xed09('0x3f')][_0xed09('0x40')],_0x4bfdc7[_0xed09('0x3f')][_0xed09('0x41')]);}else{if(_0x5a7598[_0xed09('0x23')]===_0xed09('0x42')){var _0x4f7421=_0x5a7598['value'][_0xed09('0x43')](',')[_0xed09('0x44')](function(_0x36d753){return Number(_0x36d753);});var _0x29de95=parseTagParameter(_0x4f7421);_0x5daf12[_0xed09('0x45')][_0xed09('0x46')][_0xed09('0x47')](_0x29de95);_0x5daf12[_0xed09('0x45')][_0xed09('0x48')]=_0x4f7421;}else if(_0x5a7598['field']===_0xed09('0x49')){_0x5daf12[_0xed09('0x4a')][_0xed09('0x46')][_0xed09('0x47')](_0xed09('0x4b'),_0x5a7598['value']);_0x5daf12['user'][_0xed09('0x4c')]=!![];}}}return _0x5daf12;}function parseModelFields(_0x3d1838,_0x34a178){var _0x182f57=squel[_0xed09('0x24')]();var _0x485ae3=_(_0x3d1838)['keys']()[_0xed09('0x44')](function(_0x20e242){return _[_0xed09('0x4d')](_0x34a178,[_0xed09('0x35'),_0x20e242])?_0x20e242:undefined;})[_0xed09('0x4e')]()[_0xed09('0x3f')]();if(_0x3d1838[_0xed09('0x4f')]){_0x485ae3[_0xed09('0x20')]('Contact');}if(_0x3d1838[_0xed09('0x49')]){_0x485ae3['push'](_0xed09('0x49'));}if(_0x485ae3['length']>0x0){_0x485ae3[_0xed09('0x21')](function(_0x277faa){if(_0x277faa==='ListId'){_0x182f57[_0xed09('0x47')](_0xed09('0x50'),[]['concat'](_0x3d1838[_0x277faa]));}else if(_0x277faa==='Contact'){var _0x3dac93='%'+_0x3d1838[_0x277faa]+'%';_0x182f57[_0xed09('0x47')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x3dac93);}else if(_0x277faa==='User'){_0x182f57['and'](_0xed09('0x4b'),_0x3d1838[_0x277faa]);}else{_0x182f57[_0xed09('0x47')]('c.'+_0x277faa+_0xed09('0x51'),_0x3d1838[_0x277faa]);}});}return _0x182f57;}function parseQueryParameters(_0x53622e,_0x16a38f){var _0x2c44e9=getSqlClauses();return Promise[_0xed09('0x52')]()[_0xed09('0x53')](function(){return parseModelFields(_0x53622e,_0x16a38f);})[_0xed09('0x53')](function(_0x55d21e){_0x2c44e9[_0xed09('0x54')][_0xed09('0x47')](_0x55d21e);return parseTagParameter(_0x53622e[_0xed09('0x55')]);})['then'](function(_0x22831a){_0x2c44e9[_0xed09('0x45')][_0xed09('0x46')][_0xed09('0x47')](_0x22831a);return parseSearchFilter(_0x53622e['filter']);})[_0xed09('0x53')](function(_0x4ac426){_0x2c44e9[_0xed09('0x56')]=_0x4ac426;return _0x2c44e9;});}function checkListsRestrictions(_0x3b8af7,_0x4e5e7c,_0x3eb26c){var _0x16b01f=squel['expr']();return Promise['resolve']()[_0xed09('0x53')](function(){if(_0x4e5e7c[_0xed09('0x8')]&&_0x3b8af7['role']==='agent'&&!_0x3eb26c){return _0x3b8af7[_0xed09('0x57')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x274bfa){if(_0x274bfa){if(_0x274bfa[_0xed09('0x58')]===0x0){_0x16b01f['and']('c.ListId\x20IS\x20NULL');}else{_0x16b01f[_0xed09('0x47')](_0xed09('0x50'),_[_0xed09('0x44')](_0x274bfa,'id'));}}})[_0xed09('0x53')](function(){return _0x16b01f;});}function buildContactsQuery(_0x3ee3ac,_0x556ec7,_0x3edfbe,_0x1cf2e6,_0x30cb24,_0x3f3922){if(_0x556ec7){_0x556ec7=_0x3edfbe[_0xed09('0x59')];}_0x3ee3ac=addFieldsToQuery(_0x3ee3ac,_0x556ec7,_0x1cf2e6,_0x3f3922,!![]);var _0x251603=squel['select']();_0x251603=addFieldsToQuery(_0x251603,_0x556ec7,_0x1cf2e6,_0x3f3922,![]);if(_0x1cf2e6||_0x3f3922){_0x3ee3ac=applyJoinClauses(_0x3ee3ac,!![]);_0x3ee3ac[_0xed09('0x5a')]('c.id');if(_0x3edfbe[_0xed09('0x5b')]){_0x251603[_0xed09('0x5b')](_0x3edfbe[_0xed09('0x5b')]);}if(_0x3edfbe[_0xed09('0x5c')]){_0x251603[_0xed09('0x5c')](_0x3edfbe[_0xed09('0x5c')]);}}else{_0x251603=applyJoinClauses(_0x251603,![]);_0x251603[_0xed09('0x5a')]('subqry.id');if(_0x3edfbe['limit']){_0x3ee3ac[_0xed09('0x5b')](_0x3edfbe[_0xed09('0x5b')]);}if(_0x3edfbe[_0xed09('0x5c')]){_0x3ee3ac[_0xed09('0x5c')](_0x3edfbe['offset']);}}_0x251603[_0xed09('0x5d')](_0x30cb24);if(_0x3edfbe[_0xed09('0x5e')]){_0x3edfbe[_0xed09('0x5e')][_0xed09('0x21')](function(_0x157fa2){_0x3ee3ac[_0xed09('0x5e')]('c.'+_0x157fa2[0x0],_0x157fa2[0x1]===_0xed09('0x5f')?![]:!![]);_0x251603[_0xed09('0x5e')](_0xed09('0x60')+_0x157fa2[0x0],_0x157fa2[0x1]===_0xed09('0x5f')?![]:!![]);});}_0x251603[_0xed09('0xd')](_0x3ee3ac,_0xed09('0x16'));return _0x251603;}function getFilteredContacts(_0x224a4a){var _0x120d43=[];return db[_0xed09('0x42')][_0xed09('0x61')]({'attributes':['id','name','color'],'raw':!![]})[_0xed09('0x53')](function(_0x3befc3){_0x120d43=_[_0xed09('0x62')](_0x3befc3,'id');var _0x3634b2={'type':db[_0xed09('0x63')][_0xed09('0x64')][_0xed09('0x65')],'model':db[_0xed09('0x66')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xed09('0x67')][_0xed09('0x68')](_0x224a4a[_0xed09('0x69')](),_0x3634b2);})[_0xed09('0x53')](function(_0x55a3a6){_0x55a3a6[_0xed09('0x21')](function(_0xf7b55e){if(_0xf7b55e[_0xed09('0x1e')]){_0xf7b55e[_0xed09('0x6a')]=[];_0xf7b55e['TagIds'][_0xed09('0x43')](',')['forEach'](function(_0x417ef9){_0xf7b55e[_0xed09('0x6a')][_0xed09('0x20')](_0x120d43[_0x417ef9]);});}delete _0xf7b55e[_0xed09('0x1e')];});return _0x55a3a6;});}function countFilteredContacts(_0x233e60,_0x28da0b){var _0x2a02ff=_0x233e60[_0xed09('0x6b')]();_0x2a02ff[_0xed09('0x23')]('COUNT(*)');_0x2a02ff=applyJoinClauses(_0x2a02ff,!![]);_0x233e60[_0xed09('0x5a')]('c.id');var _0x5c30ac=utils['getSelectedTags'](_0x28da0b);if(!_['isEmpty'](_0x5c30ac)){_0x2a02ff[_0xed09('0xe')](_0xed09('0x6c'),_0x5c30ac);}var _0x241e87={'type':db[_0xed09('0x63')]['QueryTypes'][_0xed09('0x65')],'raw':!![]};return db['sequelize']['query'](_0x2a02ff['toString'](),_0x241e87)[_0xed09('0x53')](function(_0x9b1784){return _0x9b1784[0x0][_0xed09('0x6d')];});}module[_0xed09('0x6e')]={'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 08df6be..79a6ec8 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 _0xfc80=['createDecipher','final','base64','decryptString','utf8','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','close','unlink','decryptFile'];(function(_0x40aefd,_0x2463a8){var _0x4aab60=function(_0x18cb3e){while(--_0x18cb3e){_0x40aefd['push'](_0x40aefd['shift']());}};_0x4aab60(++_0x2463a8);}(_0xfc80,0x145));var _0x0fc8=function(_0x43185e,_0xe5929c){_0x43185e=_0x43185e-0x0;var _0x17d243=_0xfc80[_0x43185e];return _0x17d243;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x0fc8('0x0'))(_0x0fc8('0x1'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0fc8('0x2')][_0x0fc8('0x3')],'algorithm':_0x0fc8('0x4')};const fileOptions={'algorithm':_0x0fc8('0x5')};if(config[_0x0fc8('0x6')]&&config[_0x0fc8('0x6')][_0x0fc8('0x7')]){var isSupported=isAlgorithmSupported(config[_0x0fc8('0x6')][_0x0fc8('0x7')]);if(isSupported){fileOptions[_0x0fc8('0x7')]=config[_0x0fc8('0x6')][_0x0fc8('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0fc8('0x8')](',\x20');logger[_0x0fc8('0x9')](config[_0x0fc8('0x6')]['algorithm'],_0x0fc8('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x5833ad){return AES_SUPPORTED_RX[_0x0fc8('0xb')](_0x5833ad);}function getSupportedCiphers(){return crypto[_0x0fc8('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x1ea8f1){return getSupportedCiphers()[_0x0fc8('0xd')](_0x1ea8f1)>-0x1;}function combineOptions(_0xd44048){var _0x11824f={};for(var _0x2a70dd in fileOptions){if(fileOptions[_0x0fc8('0xe')](_0x2a70dd)){_0x11824f[_0x2a70dd]=fileOptions[_0x2a70dd];}}if(_0xd44048){for(var _0x5aa6ac in _0xd44048){if(_0xd44048[_0x0fc8('0xe')](_0x5aa6ac)){_0x11824f[_0x5aa6ac]=_0xd44048[_0x5aa6ac];}}}return _0x11824f;}exports[_0x0fc8('0xf')]=function(_0x1079db,_0x254fd8,_0x4ff2ba,_0x3958bb){return new BPromise(function(_0x288917,_0x32f1c6){_0x3958bb=combineOptions(_0x3958bb);var _0x2906ef=new Buffer(_0x4ff2ba);var _0x2e7aa5=fs[_0x0fc8('0x10')](_0x1079db);var _0x11d58a=fs[_0x0fc8('0x11')](_0x254fd8);var _0x192f77=crypto[_0x0fc8('0x12')](_0x3958bb[_0x0fc8('0x7')],_0x2906ef);_0x2e7aa5['on'](_0x0fc8('0x13'),function(_0x1a9a10){var _0x4fb536=new Buffer(_0x192f77[_0x0fc8('0x14')](_0x1a9a10),_0x0fc8('0x15'));_0x11d58a[_0x0fc8('0x16')](_0x4fb536);});_0x2e7aa5['on'](_0x0fc8('0x17'),function(){try{var _0x50d11d=new Buffer(_0x192f77['final']('binary'),_0x0fc8('0x15'));_0x11d58a[_0x0fc8('0x16')](_0x50d11d);_0x11d58a[_0x0fc8('0x17')]();_0x11d58a['on'](_0x0fc8('0x18'),function(){return _0x288917(_0x254fd8);});}catch(_0x30f6cd){fs[_0x0fc8('0x19')](_0x254fd8);return _0x32f1c6(_0x30f6cd);}});});};exports[_0x0fc8('0x1a')]=function(_0x310166,_0x53e7a3,_0x148d69,_0x1fbd79){return new BPromise(function(_0x274c58,_0x175cd1){_0x1fbd79=combineOptions(_0x1fbd79);var _0x582389=new Buffer(_0x148d69);var _0x2346c0=fs['createReadStream'](_0x310166);var _0x531b66=fs[_0x0fc8('0x11')](_0x53e7a3);var _0x58fcb7=crypto[_0x0fc8('0x1b')](_0x1fbd79['algorithm'],_0x582389);_0x2346c0['on'](_0x0fc8('0x13'),function(_0x17fe4f){var _0xfee5a5=new Buffer(_0x58fcb7[_0x0fc8('0x14')](_0x17fe4f),'binary');_0x531b66['write'](_0xfee5a5);});_0x2346c0['on'](_0x0fc8('0x17'),function(){try{var _0x396ea4=new Buffer(_0x58fcb7[_0x0fc8('0x1c')](_0x0fc8('0x15')),_0x0fc8('0x15'));_0x531b66[_0x0fc8('0x16')](_0x396ea4);_0x531b66['end']();_0x531b66['on'](_0x0fc8('0x18'),function(){return _0x274c58(_0x53e7a3);});}catch(_0x3457db){fs['unlink'](_0x53e7a3);return _0x175cd1(_0x3457db);}});});};exports['encryptString']=function(_0x2a5241,_0x5a730f,_0x2e4040){var _0x5053d4=_0x2e4040||stringOptions[_0x0fc8('0x7')];var _0x361eaa=_0x5a730f||stringOptions['secret'];var _0x18bd4b=crypto[_0x0fc8('0x12')](_0x5053d4,_0x361eaa);var _0x457eb5=_0x18bd4b[_0x0fc8('0x14')](_0x2a5241,'utf8',_0x0fc8('0x1d'));_0x457eb5+=_0x18bd4b[_0x0fc8('0x1c')](_0x0fc8('0x1d'));return _0x457eb5;};exports[_0x0fc8('0x1e')]=function(_0x1f918b,_0x851cf0,_0x2970d3){var _0x2ada6e=_0x2970d3||stringOptions[_0x0fc8('0x7')];var _0x1cc776=_0x851cf0||stringOptions['secret'];var _0x4f1ca5=crypto[_0x0fc8('0x1b')](_0x2ada6e,_0x1cc776);var _0x2a13fd=_0x4f1ca5[_0x0fc8('0x14')](_0x1f918b,'base64',_0x0fc8('0x1f'));_0x2a13fd+=_0x4f1ca5[_0x0fc8('0x1c')](_0x0fc8('0x1f'));return _0x2a13fd;}; \ No newline at end of file +var _0x5893=['data','update','binary','write','end','close','unlink','decryptFile','createDecipher','final','encryptString','secret','createCipher','base64','decryptString','utf8','bluebird','../../config/logger','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','encryptFile','createReadStream','createWriteStream'];(function(_0x224f43,_0x3ac2b1){var _0x39a831=function(_0x330450){while(--_0x330450){_0x224f43['push'](_0x224f43['shift']());}};_0x39a831(++_0x3ac2b1);}(_0x5893,0x146));var _0x3589=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5893[_0x4565bf];return _0x5610ba;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x3589('0x0'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x3589('0x1'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x3589('0x2')],'algorithm':_0x3589('0x3')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0x3589('0x4')][_0x3589('0x5')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x3589('0x5')]=config[_0x3589('0x4')][_0x3589('0x5')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3589('0x6')](',\x20');logger[_0x3589('0x7')](config[_0x3589('0x4')][_0x3589('0x5')],_0x3589('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x58a70f){return AES_SUPPORTED_RX[_0x3589('0x9')](_0x58a70f);}function getSupportedCiphers(){return crypto[_0x3589('0xa')]()[_0x3589('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x585d16){return getSupportedCiphers()['indexOf'](_0x585d16)>-0x1;}function combineOptions(_0x5e804e){var _0x3d088e={};for(var _0x3130f0 in fileOptions){if(fileOptions['hasOwnProperty'](_0x3130f0)){_0x3d088e[_0x3130f0]=fileOptions[_0x3130f0];}}if(_0x5e804e){for(var _0x38b26b in _0x5e804e){if(_0x5e804e['hasOwnProperty'](_0x38b26b)){_0x3d088e[_0x38b26b]=_0x5e804e[_0x38b26b];}}}return _0x3d088e;}exports[_0x3589('0xc')]=function(_0x41e8e4,_0x8c0efc,_0x477d59,_0x344904){return new BPromise(function(_0x32df1f,_0x470880){_0x344904=combineOptions(_0x344904);var _0x212958=new Buffer(_0x477d59);var _0x218a38=fs[_0x3589('0xd')](_0x41e8e4);var _0x27b7b7=fs[_0x3589('0xe')](_0x8c0efc);var _0x1cf5be=crypto['createCipher'](_0x344904[_0x3589('0x5')],_0x212958);_0x218a38['on'](_0x3589('0xf'),function(_0x402d12){var _0x258b3c=new Buffer(_0x1cf5be[_0x3589('0x10')](_0x402d12),_0x3589('0x11'));_0x27b7b7[_0x3589('0x12')](_0x258b3c);});_0x218a38['on'](_0x3589('0x13'),function(){try{var _0x22446a=new Buffer(_0x1cf5be['final'](_0x3589('0x11')),_0x3589('0x11'));_0x27b7b7[_0x3589('0x12')](_0x22446a);_0x27b7b7[_0x3589('0x13')]();_0x27b7b7['on'](_0x3589('0x14'),function(){return _0x32df1f(_0x8c0efc);});}catch(_0x2c600d){fs[_0x3589('0x15')](_0x8c0efc);return _0x470880(_0x2c600d);}});});};exports[_0x3589('0x16')]=function(_0x1d0f24,_0x5d564f,_0x14db89,_0xeeb5b2){return new BPromise(function(_0x1a43e7,_0x5330f6){_0xeeb5b2=combineOptions(_0xeeb5b2);var _0xcdbb2b=new Buffer(_0x14db89);var _0x4b5772=fs[_0x3589('0xd')](_0x1d0f24);var _0x3f40cb=fs[_0x3589('0xe')](_0x5d564f);var _0x1cec76=crypto[_0x3589('0x17')](_0xeeb5b2[_0x3589('0x5')],_0xcdbb2b);_0x4b5772['on'](_0x3589('0xf'),function(_0x8e1336){var _0x43c496=new Buffer(_0x1cec76['update'](_0x8e1336),_0x3589('0x11'));_0x3f40cb['write'](_0x43c496);});_0x4b5772['on'](_0x3589('0x13'),function(){try{var _0x20221a=new Buffer(_0x1cec76[_0x3589('0x18')](_0x3589('0x11')),'binary');_0x3f40cb[_0x3589('0x12')](_0x20221a);_0x3f40cb[_0x3589('0x13')]();_0x3f40cb['on'](_0x3589('0x14'),function(){return _0x1a43e7(_0x5d564f);});}catch(_0x5823fd){fs[_0x3589('0x15')](_0x5d564f);return _0x5330f6(_0x5823fd);}});});};exports[_0x3589('0x19')]=function(_0x5a04fb,_0x5eb645,_0x1d4f09){var _0x5c49b4=_0x1d4f09||stringOptions[_0x3589('0x5')];var _0x5ab40c=_0x5eb645||stringOptions[_0x3589('0x1a')];var _0x2e3e38=crypto[_0x3589('0x1b')](_0x5c49b4,_0x5ab40c);var _0x385cbc=_0x2e3e38[_0x3589('0x10')](_0x5a04fb,'utf8',_0x3589('0x1c'));_0x385cbc+=_0x2e3e38[_0x3589('0x18')](_0x3589('0x1c'));return _0x385cbc;};exports[_0x3589('0x1d')]=function(_0x4ec75d,_0x5c63d9,_0x3596cf){var _0xed6f7=_0x3596cf||stringOptions[_0x3589('0x5')];var _0x269037=_0x5c63d9||stringOptions[_0x3589('0x1a')];var _0x231ff7=crypto[_0x3589('0x17')](_0xed6f7,_0x269037);var _0x2fcc70=_0x231ff7[_0x3589('0x10')](_0x4ec75d,'base64',_0x3589('0x1e'));_0x2fcc70+=_0x231ff7['final'](_0x3589('0x1e'));return _0x2fcc70;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 770350f..1dd52e2 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 _0x8c0d=['exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally'];(function(_0x38ef19,_0x2a0114){var _0x3b5f10=function(_0x20129a){while(--_0x20129a){_0x38ef19['push'](_0x38ef19['shift']());}};_0x3b5f10(++_0x2a0114);}(_0x8c0d,0x121));var _0xd8c0=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0x8c0d[_0x584291];return _0x4e7d08;};'use strict';var util=require(_0xd8c0('0x0'));var path=require(_0xd8c0('0x1'));var _=require(_0xd8c0('0x2'));var csv=require(_0xd8c0('0x3'));var fs=require('fs');var BPromise=require(_0xd8c0('0x4'));var zipdir=require(_0xd8c0('0x5'));var rimraf=require(_0xd8c0('0x6'));var db=require(_0xd8c0('0x7'))['db'];var dbH=require(_0xd8c0('0x7'))[_0xd8c0('0x8')];var logger=require(_0xd8c0('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xd8c0('0xa')][0x3];var PATH=process[_0xd8c0('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2528f7,_0x1c7991){var _0x10d824={'status':_0x2528f7};var _0x4bda42={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c7991){_0x10d824['savename']=_0x1c7991;}return db[_0xd8c0('0xb')][_0xd8c0('0xc')](_0x10d824,_0x4bda42);}function main(){var _0x3a7a77=0x1388;var _0x2ebce8;logger[_0xd8c0('0xd')](util[_0xd8c0('0xe')](_0xd8c0('0xf'),EXTRACTED_REPORT_ID,_0xd8c0('0x10')));return db['Setting'][_0xd8c0('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd8c0('0x12')]})['then'](function(_0x4843ff){if(_0x4843ff){_0x2ebce8=_0x4843ff;_0x3a7a77=_0x2ebce8[_0xd8c0('0x12')]||0x1388;}})[_0xd8c0('0x13')](function(){return dbH[_0xd8c0('0x14')][_0xd8c0('0x15')](util['format'](_0xd8c0('0x16'),QUERY),{'type':dbH[_0xd8c0('0x14')][_0xd8c0('0x17')][_0xd8c0('0x18')]});})[_0xd8c0('0x13')](function(_0x20aa61){if(!_0x20aa61[0x0][_0xd8c0('0x19')]){return analyticExtractedReport('Empty');}var _0x245939=[];var _0x5e9091=0x0;if(_0x2ebce8[_0xd8c0('0x1a')]){if(_0x20aa61&&_0x20aa61[_0xd8c0('0x1b')]){var _0xa27c80=_[_0xd8c0('0x1c')](_0x20aa61[0x0][_0xd8c0('0x19')]/_0x3a7a77);var _0x5e2153=Number[_0xd8c0('0x1d')](_0x20aa61[0x0][_0xd8c0('0x19')]/_0x3a7a77)?_0x20aa61[0x0][_0xd8c0('0x19')]%_0x3a7a77:0x0;_0xa27c80[_0xd8c0('0x1e')](function(_0x448246){if(_0x448246>0x0){_0x5e9091+=_0x3a7a77;}_0x245939['push'](dbH[_0xd8c0('0x14')][_0xd8c0('0x15')](util[_0xd8c0('0xe')](_0xd8c0('0x1f'),QUERY,_0x3a7a77,_0x5e9091),{'type':dbH['sequelize'][_0xd8c0('0x17')]['SELECT']}));});if(_0x5e2153>0x0){_0x5e9091+=_0x3a7a77;_0x245939[_0xd8c0('0x20')](dbH[_0xd8c0('0x14')]['query'](util[_0xd8c0('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5e2153,_0x5e9091),{'type':dbH['sequelize'][_0xd8c0('0x17')][_0xd8c0('0x18')]}));}}}else{_0x245939[_0xd8c0('0x20')](dbH[_0xd8c0('0x14')][_0xd8c0('0x15')](QUERY,{'type':dbH['sequelize'][_0xd8c0('0x17')][_0xd8c0('0x18')]}));}var _0x2aa7bf=path['dirname'](PATH);var _0x27835c=path['basename'](PATH,'.csv');var _0x53787b=_0x2ebce8[_0xd8c0('0x1a')]&&_0x245939[_0xd8c0('0x1b')]>0x1;var _0x190291=[];if(!fs[_0xd8c0('0x21')](path[_0xd8c0('0x22')](_0x2aa7bf,_0x27835c))&&_0x53787b){fs['mkdirSync'](path[_0xd8c0('0x22')](_0x2aa7bf,_0x27835c));}return BPromise[_0xd8c0('0x23')](_0x245939,function(_0x2da2f5){_0x190291['push'](_0x2da2f5);})[_0xd8c0('0x13')](function(){for(var _0x1195bd=0x0;_0x1195bd<_0x190291['length'];_0x1195bd+=0x1){var _0x3847f1;var _0x157fd1=_0x190291[_0x1195bd];if(_0x53787b){_0x3847f1=path[_0xd8c0('0x22')](_0x2aa7bf,_0x27835c,util[_0xd8c0('0xe')](_0xd8c0('0x24'),_0x27835c,_0x1195bd,_0xd8c0('0x25')));}else{_0x3847f1=path[_0xd8c0('0x22')](_0x2aa7bf,util[_0xd8c0('0xe')](_0xd8c0('0x26'),_0x27835c,_0xd8c0('0x25')));}fs[_0xd8c0('0x27')](_0x3847f1,csv(_0x157fd1));}})[_0xd8c0('0x13')](function(){if(_0x53787b){return new Promise(function(_0x1b2620){zipdir(path[_0xd8c0('0x22')](_0x2aa7bf,_0x27835c),{'saveTo':path[_0xd8c0('0x22')](_0x2aa7bf,util[_0xd8c0('0xe')](_0xd8c0('0x26'),_0x27835c,_0xd8c0('0x28')))},function(_0x28adfb,_0x2b9c84){rimraf(path['join'](_0x2aa7bf,_0x27835c),function(){});_0x1b2620(_0xd8c0('0x29'));});});}})[_0xd8c0('0x13')](function(){logger[_0xd8c0('0xd')](util[_0xd8c0('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xd8c0('0x2a'),_0x53787b?util[_0xd8c0('0xe')]('%s.%s',_0x27835c,_0x53787b?'zip':_0xd8c0('0x25')):null);});})['catch'](function(_0x45905e){logger[_0xd8c0('0xd')](util[_0xd8c0('0xe')](_0xd8c0('0x2b'),EXTRACTED_REPORT_ID,_0xd8c0('0x10')),util[_0xd8c0('0x2c')](_0x45905e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd8c0('0x2d'));})[_0xd8c0('0x2e')](function(){process[_0xd8c0('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8abf=['zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','inspect','Failed','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeCsv','then','sequelize','query','num','Empty','split','length','range','isInteger','push','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip'];(function(_0x17935c,_0x1a7396){var _0x27cfe7=function(_0x4e35bc){while(--_0x4e35bc){_0x17935c['push'](_0x17935c['shift']());}};_0x27cfe7(++_0x1a7396);}(_0x8abf,0x6c));var _0xf8ab=function(_0x4848af,_0x2f99f2){_0x4848af=_0x4848af-0x0;var _0x125cdf=_0x8abf[_0x4848af];return _0x125cdf;};'use strict';var util=require(_0xf8ab('0x0'));var path=require('path');var _=require(_0xf8ab('0x1'));var csv=require(_0xf8ab('0x2'));var fs=require('fs');var BPromise=require(_0xf8ab('0x3'));var zipdir=require(_0xf8ab('0x4'));var rimraf=require(_0xf8ab('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf8ab('0x6')];var logger=require(_0xf8ab('0x7'))(_0xf8ab('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xf8ab('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x231cc7,_0xe2ad2c){var _0x200bd1={'status':_0x231cc7};var _0x2eaeb9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe2ad2c){_0x200bd1[_0xf8ab('0xa')]=_0xe2ad2c;}return db[_0xf8ab('0xb')][_0xf8ab('0xc')](_0x200bd1,_0x2eaeb9);}function main(){var _0x46c1a1=0x1388;var _0x326404;logger[_0xf8ab('0xd')](util[_0xf8ab('0xe')](_0xf8ab('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xf8ab('0x10')][_0xf8ab('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf8ab('0x12')]})['then'](function(_0x3cc3af){if(_0x3cc3af){_0x326404=_0x3cc3af;_0x46c1a1=_0x326404[_0xf8ab('0x12')]||0x1388;}})[_0xf8ab('0x13')](function(){return dbH[_0xf8ab('0x14')][_0xf8ab('0x15')](util[_0xf8ab('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf8ab('0x14')]['QueryTypes']['SELECT']});})[_0xf8ab('0x13')](function(_0x1832a8){if(!_0x1832a8[0x0][_0xf8ab('0x16')]){return analyticExtractedReport(_0xf8ab('0x17'));}var _0x3f51c2=[];var _0x2be21b=0x0;if(_0x326404[_0xf8ab('0x18')]){if(_0x1832a8&&_0x1832a8[_0xf8ab('0x19')]){var _0xa6d83d=_[_0xf8ab('0x1a')](_0x1832a8[0x0]['num']/_0x46c1a1);var _0x7384cb=Number[_0xf8ab('0x1b')](_0x1832a8[0x0]['num']/_0x46c1a1)?_0x1832a8[0x0][_0xf8ab('0x16')]%_0x46c1a1:0x0;_0xa6d83d['forEach'](function(_0x4231c2){if(_0x4231c2>0x0){_0x2be21b+=_0x46c1a1;}_0x3f51c2[_0xf8ab('0x1c')](dbH[_0xf8ab('0x14')][_0xf8ab('0x15')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x46c1a1,_0x2be21b),{'type':dbH[_0xf8ab('0x14')][_0xf8ab('0x1d')]['SELECT']}));});if(_0x7384cb>0x0){_0x2be21b+=_0x46c1a1;_0x3f51c2['push'](dbH[_0xf8ab('0x14')][_0xf8ab('0x15')](util['format'](_0xf8ab('0x1e'),QUERY,_0x7384cb,_0x2be21b),{'type':dbH['sequelize'][_0xf8ab('0x1d')][_0xf8ab('0x1f')]}));}}}else{_0x3f51c2[_0xf8ab('0x1c')](dbH['sequelize'][_0xf8ab('0x15')](QUERY,{'type':dbH[_0xf8ab('0x14')][_0xf8ab('0x1d')][_0xf8ab('0x1f')]}));}var _0x23df15=path[_0xf8ab('0x20')](PATH);var _0x3780c2=path['basename'](PATH,_0xf8ab('0x21'));var _0x5bd9d7=_0x326404[_0xf8ab('0x18')]&&_0x3f51c2['length']>0x1;var _0x5181c0=[];if(!fs[_0xf8ab('0x22')](path[_0xf8ab('0x23')](_0x23df15,_0x3780c2))&&_0x5bd9d7){fs[_0xf8ab('0x24')](path[_0xf8ab('0x23')](_0x23df15,_0x3780c2));}return BPromise[_0xf8ab('0x25')](_0x3f51c2,function(_0x4840a7){_0x5181c0['push'](_0x4840a7);})['then'](function(){for(var _0x58d010=0x0;_0x58d010<_0x5181c0[_0xf8ab('0x19')];_0x58d010+=0x1){var _0x28e354;var _0x56b247=_0x5181c0[_0x58d010];if(_0x5bd9d7){_0x28e354=path[_0xf8ab('0x23')](_0x23df15,_0x3780c2,util[_0xf8ab('0xe')]('%s%d.%s',_0x3780c2,_0x58d010,_0xf8ab('0x26')));}else{_0x28e354=path[_0xf8ab('0x23')](_0x23df15,util['format'](_0xf8ab('0x27'),_0x3780c2,_0xf8ab('0x26')));}fs[_0xf8ab('0x28')](_0x28e354,csv(_0x56b247));}})[_0xf8ab('0x13')](function(){if(_0x5bd9d7){return new Promise(function(_0x22d0ab){zipdir(path['join'](_0x23df15,_0x3780c2),{'saveTo':path[_0xf8ab('0x23')](_0x23df15,util['format']('%s.%s',_0x3780c2,_0xf8ab('0x29')))},function(_0x5e1c8e,_0x43be74){rimraf(path[_0xf8ab('0x23')](_0x23df15,_0x3780c2),function(){});_0x22d0ab(_0xf8ab('0x2a'));});});}})[_0xf8ab('0x13')](function(){logger[_0xf8ab('0xd')](util['format'](_0xf8ab('0x2b'),EXTRACTED_REPORT_ID,_0xf8ab('0x2c')));return analyticExtractedReport(_0xf8ab('0x2d'),_0x5bd9d7?util[_0xf8ab('0xe')](_0xf8ab('0x27'),_0x3780c2,_0x5bd9d7?'zip':_0xf8ab('0x26')):null);});})[_0xf8ab('0x2e')](function(_0x21fda3){logger[_0xf8ab('0xd')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf8ab('0x2c')),util[_0xf8ab('0x2f')](_0x21fda3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf8ab('0x30'));})['finally'](function(){process[_0xf8ab('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 1dc28c9..011632c 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 _0xfac1=['format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','landscape','\x20/\x20','Arial','black','right','Empty','Setting','find','splitSizePdf','then','range','num','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','.pdf','split','existsSync','join','mkdirSync','flatten','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','toString','center','Interaction\x20Transcript','footer','createWriteStream','finish','end','createPdfFromHTML','createPdfKitDocument','lodash','util','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','value','length','auto','body','push','concat','chunk','keys','forEach'];(function(_0xc73b7a,_0x5043d8){var _0x29b837=function(_0x34b8dd){while(--_0x34b8dd){_0xc73b7a['push'](_0xc73b7a['shift']());}};_0x29b837(++_0x5043d8);}(_0xfac1,0x9b));var _0x1fac=function(_0x1a7691,_0xc6a24c){_0x1a7691=_0x1a7691-0x0;var _0x11d89b=_0xfac1[_0x1a7691];return _0x11d89b;};'use strict';var _=require(_0x1fac('0x0'));var fs=require('fs');var util=require(_0x1fac('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x1fac('0x2'));var PdfPrinter=require(_0x1fac('0x3'));var zipdir=require(_0x1fac('0x4'));var rimraf=require(_0x1fac('0x5'));var JSDOM=require(_0x1fac('0x6'))[_0x1fac('0x7')];var window=new JSDOM('')[_0x1fac('0x8')];var BPromise=require(_0x1fac('0x9'));var db=require(_0x1fac('0xa'))['db'];var dbH=require(_0x1fac('0xa'))[_0x1fac('0xb')];var logger=require('../../config/logger')(_0x1fac('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x1fac('0xd')][0x2]);var QUERY=process[_0x1fac('0xd')][0x3];var PATH=process[_0x1fac('0xd')][0x4];var NAME=process[_0x1fac('0xd')][0x5];var FORMAT=_0x1fac('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xfb2995,_0x54a279){var _0x54b6ed={'status':_0xfb2995};var _0x3ceda6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x54a279){_0x54b6ed[_0x1fac('0xf')]=_0x54a279;}return db[_0x1fac('0x10')][_0x1fac('0x11')](_0x54b6ed,_0x3ceda6);}function getHeaders(_0x1b6b52){return _[_0x1fac('0x12')](_0x1b6b52,function(_0x20807b){return{'text':_0x20807b,'style':_0x1fac('0x13')};});}function getRows(_0x2a7c34,_0x3219d0){return _[_0x1fac('0x12')](_0x3219d0,function(_0x1857e9){return _(_0x1857e9)['pick'](_0x2a7c34)['map'](function(_0x1cf1a8){return _0x1cf1a8?_['toString'](_0x1cf1a8):'';})[_0x1fac('0x14')]();});}function createTable(_0x5f32e8,_0x19bc2d){var _0x1f869a={'widths':_['fill'](Array(_0x5f32e8[_0x1fac('0x15')]),0x91),'heights':function(_0x468342){return _0x468342===0x0?_0x1fac('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2f9695=getHeaders(_0x5f32e8);_0x1f869a[_0x1fac('0x17')][_0x1fac('0x18')](_0x2f9695);var _0x39ddf3=getRows(_0x5f32e8,_0x19bc2d);_0x1f869a[_0x1fac('0x17')]=_0x1f869a[_0x1fac('0x17')][_0x1fac('0x19')](_0x39ddf3);return _0x1f869a;}function createTables(_0x42cf0d){var _0x5426db=[];var _0x5b28a2=_[_0x1fac('0x1a')](Object[_0x1fac('0x1b')](_0x42cf0d[0x0]),0x5);_0x5b28a2[_0x1fac('0x1c')](function(_0x34afff){_0x5426db[_0x1fac('0x18')](createTable(_0x34afff,_0x42cf0d));});return _0x5426db;}function getPDFDocDefinition(_0x49df47){var _0x356625=util[_0x1fac('0x1d')](_0x1fac('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x1fac('0x1f')])[_0x1fac('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x1fac('0x20')])[_0x1fac('0x1d')](FORMAT));var _0x262ebb=[];for(var _0x2c8652=0x0;_0x2c8652<_0x49df47[_0x1fac('0x15')];_0x2c8652++){var _0x22b055=[];if(_0x2c8652===0x0){_0x22b055[_0x1fac('0x18')]({'text':_0x356625,'style':_0x1fac('0x21')});}var _0x4124e1={'table':_0x49df47[_0x2c8652]};if(_0x2c8652>0x0){_0x4124e1[_0x1fac('0x22')]=_0x1fac('0x23');_0x4124e1['margin']=[0x0,0x46,0x0,0x0];}_0x22b055[_0x1fac('0x18')](_0x4124e1);_0x262ebb[_0x1fac('0x18')](_0x22b055);}return{'pageSize':'A4','pageOrientation':_0x1fac('0x24'),'content':_0x262ebb,'footer':function(_0x579dd5,_0x3b9424){return{'text':_0x579dd5['toString']()+_0x1fac('0x25')+_0x3b9424,'style':'footer'};},'defaultStyle':{'font':_0x1fac('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1fac('0x27')},'footer':{'alignment':_0x1fac('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x106b7d){var _0x1cbabd=0x1388;var _0x1b6af6;if(!_0x106b7d[0x0]['num']){return analyticExtractedReport(_0x1fac('0x29'));}return db[_0x1fac('0x2a')][_0x1fac('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1fac('0x2c')]})['then'](function(_0x367288){if(_0x367288){_0x1b6af6=_0x367288;_0x1cbabd=_0x1b6af6[_0x1fac('0x2c')]||0x3e8;}})[_0x1fac('0x2d')](function(){var _0x5d5d70=[];var _0x1f9152=0x0;if(_0x1b6af6['split']){if(_0x106b7d&&_0x106b7d[_0x1fac('0x15')]){var _0x47af09=_[_0x1fac('0x2e')](_0x106b7d[0x0][_0x1fac('0x2f')]/_0x1cbabd);var _0x347838=Number[_0x1fac('0x30')](_0x106b7d[0x0][_0x1fac('0x2f')]/_0x1cbabd)?_0x106b7d[0x0][_0x1fac('0x2f')]%_0x1cbabd:0x0;_0x47af09[_0x1fac('0x1c')](function(_0x1f81c4){if(_0x1f81c4>0x0){_0x1f9152+=_0x1cbabd;}_0x5d5d70[_0x1fac('0x18')](dbH['sequelize'][_0x1fac('0x31')](util[_0x1fac('0x1d')](_0x1fac('0x32'),QUERY,_0x1cbabd,_0x1f9152),{'type':dbH[_0x1fac('0x33')][_0x1fac('0x34')][_0x1fac('0x35')]}));});if(_0x347838>0x0){_0x1f9152+=_0x1cbabd;_0x5d5d70['push'](dbH[_0x1fac('0x33')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x347838,_0x1f9152),{'type':dbH[_0x1fac('0x33')][_0x1fac('0x34')][_0x1fac('0x35')]}));}}}else{_0x5d5d70[_0x1fac('0x18')](dbH[_0x1fac('0x33')]['query'](QUERY,{'type':dbH[_0x1fac('0x33')]['QueryTypes'][_0x1fac('0x35')]}));}var _0x1bed11=path[_0x1fac('0x36')](PATH);var _0x4a980c=path['basename'](PATH,_0x1fac('0x37'));var _0x45ea87=_0x1b6af6[_0x1fac('0x38')]&&_0x5d5d70['length']>0x1;var _0x555239=[];if(!fs[_0x1fac('0x39')](path[_0x1fac('0x3a')](_0x1bed11,_0x4a980c))&&_0x45ea87){fs[_0x1fac('0x3b')](path[_0x1fac('0x3a')](_0x1bed11,_0x4a980c));}return BPromise['each'](_0x5d5d70,function(_0x5119d5){_0x555239[_0x1fac('0x18')](_0x5119d5);})[_0x1fac('0x2d')](function(){var _0x136973=[];for(var _0x297b55=0x0;_0x297b55<_0x555239[_0x1fac('0x15')];_0x297b55+=0x1){var _0x26b839=_0x555239[_0x297b55];var _0x598242=createTables(_[_0x1fac('0x3c')](_0x26b839));var _0x27659c;var _0x3db554=getPDFDocDefinition(_0x598242);var _0x538c44=getPDFPrinter();var _0x302416=_0x538c44['createPdfKitDocument'](_0x3db554);if(_0x45ea87){_0x27659c=path['join'](_0x1bed11,_0x4a980c,util[_0x1fac('0x1d')](_0x1fac('0x3d'),_0x4a980c,_0x297b55,_0x1fac('0x3e')));}else{_0x27659c=path[_0x1fac('0x3a')](_0x1bed11,util['format']('%s.%s',_0x4a980c,_0x1fac('0x3e')));}_0x136973[_0x1fac('0x18')](writePDFDocument(_0x302416,_0x27659c));}return Promise[_0x1fac('0x3f')](_0x136973);})['then'](function(){if(_0x45ea87){return new Promise(function(_0x8c207f){zipdir(path[_0x1fac('0x3a')](_0x1bed11,_0x4a980c),{'saveTo':path[_0x1fac('0x3a')](_0x1bed11,util['format'](_0x1fac('0x40'),_0x4a980c,_0x1fac('0x41')))},function(){rimraf(path['join'](_0x1bed11,_0x4a980c),function(){});_0x8c207f(_0x1fac('0x42'));});});}})[_0x1fac('0x2d')](function(){if(!_0x45ea87)return;rimraf(path[_0x1fac('0x3a')](_0x1bed11,_0x4a980c),function(){});})[_0x1fac('0x2d')](function(){logger[_0x1fac('0x43')](util[_0x1fac('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1fac('0x44')));return analyticExtractedReport(_0x1fac('0x45'),_0x45ea87?util[_0x1fac('0x1d')](_0x1fac('0x40'),_0x4a980c,_0x45ea87?'zip':_0x1fac('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1fac('0x43')](util[_0x1fac('0x1d')](_0x1fac('0x46'),EXTRACTED_REPORT_ID,_0x1fac('0x44')));return db['AnalyticExtractedReport'][_0x1fac('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1fac('0x2d')](function(_0x307e0e){EXTRACTED_REPORT=_0x307e0e;return dbH[_0x1fac('0x33')][_0x1fac('0x31')](util[_0x1fac('0x1d')](_0x1fac('0x48'),QUERY),{'type':dbH[_0x1fac('0x33')][_0x1fac('0x34')][_0x1fac('0x35')]});})[_0x1fac('0x2d')](extractReport)[_0x1fac('0x49')](function(_0x15ea05){logger[_0x1fac('0x43')](util[_0x1fac('0x1d')](_0x1fac('0x4a'),EXTRACTED_REPORT_ID,_0x1fac('0x44')),util[_0x1fac('0x4b')](_0x15ea05,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1fac('0x4c'));})[_0x1fac('0x4d')](function(){process[_0x1fac('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xb5c73c=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x1fac('0x4f'),'bolditalics':__dirname+_0x1fac('0x50')}});return _0xb5c73c;}function getPDFDocDefinitionFromHTML(_0x488df9,_0x33ae6c){var _0x178ccb=util['format']('%s\x20#%d',_0x33ae6c['channel'],_0x33ae6c[_0x1fac('0x51')]);var _0x3c5a60=moment()[_0x1fac('0x1d')](_0x1fac('0x52'))[_0x1fac('0x53')]();var _0x1633c7=htmlToPdfmake(_0x488df9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1633c7],'defaultStyle':{'font':_0x1fac('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1fac('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1fac('0x54')}},'header':function(){return[{'text':_0x1fac('0x55'),'style':'header'}];},'footer':function(_0x4546b8,_0xb64822){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x178ccb,_0x4546b8,_0xb64822,_0x3c5a60),'style':_0x1fac('0x56')}];}};}function writePDFDocument(_0x57c73b,_0x3cd0a4){return new Promise(function(_0x12b06f,_0x36fad1){var _0x1b912e=_0x57c73b['pipe'](fs[_0x1fac('0x57')](_0x3cd0a4));_0x1b912e['on']('finish',function(){_0x12b06f(_0x1fac('0x58'));});_0x1b912e['on']('error',function(_0x47cf83){_0x36fad1(_0x47cf83);});_0x57c73b[_0x1fac('0x59')]();});}exports[_0x1fac('0x5a')]=function(_0x54519e,_0x4ec2a6){var _0x2b5c51=getPDFPrinter();var _0x170d64=getPDFDocDefinitionFromHTML(_0x54519e,_0x4ec2a6);var _0x110337=_0x2b5c51[_0x1fac('0x5b')](_0x170d64);return writePDFDocument(_0x110337,_0x4ec2a6['path'])[_0x1fac('0x49')](function(_0x3b93f6){throw _0x3b93f6;});}; \ No newline at end of file +var _0xbbc1=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','util','path','moment','html-to-pdfmake','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','pick','map','fill','length','auto','push','body','concat','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','header','pageBreak','margin','\x20/\x20','footer','Arial','black','num','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x5e1158,_0x56d622){var _0x3eaa5f=function(_0x408b3d){while(--_0x408b3d){_0x5e1158['push'](_0x5e1158['shift']());}};_0x3eaa5f(++_0x56d622);}(_0xbbc1,0x6e));var _0x1bbc=function(_0x390680,_0x44392b){_0x390680=_0x390680-0x0;var _0x117c4a=_0xbbc1[_0x390680];return _0x117c4a;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x1bbc('0x0'));var path=require(_0x1bbc('0x1'));var moment=require(_0x1bbc('0x2'));var htmlToPdfmake=require(_0x1bbc('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x1bbc('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x1bbc('0x5'))[_0x1bbc('0x6')];var window=new JSDOM('')[_0x1bbc('0x7')];var BPromise=require(_0x1bbc('0x8'));var db=require(_0x1bbc('0x9'))['db'];var dbH=require(_0x1bbc('0x9'))[_0x1bbc('0xa')];var logger=require(_0x1bbc('0xb'))(_0x1bbc('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x1bbc('0xd')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x1bbc('0xd')][0x5];var FORMAT=_0x1bbc('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3af0ec,_0xb0590c){var _0x3147a1={'status':_0x3af0ec};var _0x22181f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb0590c){_0x3147a1[_0x1bbc('0xf')]=_0xb0590c;}return db[_0x1bbc('0x10')][_0x1bbc('0x11')](_0x3147a1,_0x22181f);}function getHeaders(_0x27f1bf){return _['map'](_0x27f1bf,function(_0x39e195){return{'text':_0x39e195,'style':_0x1bbc('0x12')};});}function getRows(_0x3af72b,_0x1c0bca){return _['map'](_0x1c0bca,function(_0x12b7f5){return _(_0x12b7f5)[_0x1bbc('0x13')](_0x3af72b)[_0x1bbc('0x14')](function(_0xce90e0){return _0xce90e0?_['toString'](_0xce90e0):'';})['value']();});}function createTable(_0x3bb9c9,_0x447455){var _0x1c1200={'widths':_[_0x1bbc('0x15')](Array(_0x3bb9c9[_0x1bbc('0x16')]),0x91),'heights':function(_0x2bb93f){return _0x2bb93f===0x0?_0x1bbc('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x52a68c=getHeaders(_0x3bb9c9);_0x1c1200['body'][_0x1bbc('0x18')](_0x52a68c);var _0x5382ae=getRows(_0x3bb9c9,_0x447455);_0x1c1200[_0x1bbc('0x19')]=_0x1c1200[_0x1bbc('0x19')][_0x1bbc('0x1a')](_0x5382ae);return _0x1c1200;}function createTables(_0x34edcc){var _0x1a0702=[];var _0x7ac59c=_['chunk'](Object[_0x1bbc('0x1b')](_0x34edcc[0x0]),0x5);_0x7ac59c[_0x1bbc('0x1c')](function(_0x4726fb){_0x1a0702[_0x1bbc('0x18')](createTable(_0x4726fb,_0x34edcc));});return _0x1a0702;}function getPDFDocDefinition(_0x4bdc61){var _0x3f671b=util['format'](_0x1bbc('0x1d'),NAME,EXTRACTED_REPORT[_0x1bbc('0x1e')],moment(EXTRACTED_REPORT[_0x1bbc('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x1bbc('0x20')](FORMAT));var _0x2b1e61=[];for(var _0x56e5b0=0x0;_0x56e5b0<_0x4bdc61[_0x1bbc('0x16')];_0x56e5b0++){var _0x50ccf1=[];if(_0x56e5b0===0x0){_0x50ccf1[_0x1bbc('0x18')]({'text':_0x3f671b,'style':_0x1bbc('0x21')});}var _0xefe063={'table':_0x4bdc61[_0x56e5b0]};if(_0x56e5b0>0x0){_0xefe063[_0x1bbc('0x22')]='before';_0xefe063[_0x1bbc('0x23')]=[0x0,0x46,0x0,0x0];}_0x50ccf1[_0x1bbc('0x18')](_0xefe063);_0x2b1e61['push'](_0x50ccf1);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x2b1e61,'footer':function(_0x177f02,_0x527291){return{'text':_0x177f02['toString']()+_0x1bbc('0x24')+_0x527291,'style':_0x1bbc('0x25')};},'defaultStyle':{'font':_0x1bbc('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1bbc('0x27')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x563be5){var _0x5f4305=0x1388;var _0x5dd71b;if(!_0x563be5[0x0][_0x1bbc('0x28')]){return analyticExtractedReport('Empty');}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1bbc('0x29'),_0x1bbc('0x2a')]})['then'](function(_0x26e1aa){if(_0x26e1aa){_0x5dd71b=_0x26e1aa;_0x5f4305=_0x5dd71b[_0x1bbc('0x2a')]||0x3e8;}})[_0x1bbc('0x2b')](function(){var _0x1e99aa=[];var _0x128ff0=0x0;if(_0x5dd71b[_0x1bbc('0x29')]){if(_0x563be5&&_0x563be5[_0x1bbc('0x16')]){var _0x57bdca=_[_0x1bbc('0x2c')](_0x563be5[0x0][_0x1bbc('0x28')]/_0x5f4305);var _0x53fdd9=Number[_0x1bbc('0x2d')](_0x563be5[0x0][_0x1bbc('0x28')]/_0x5f4305)?_0x563be5[0x0][_0x1bbc('0x28')]%_0x5f4305:0x0;_0x57bdca[_0x1bbc('0x1c')](function(_0x11a0cf){if(_0x11a0cf>0x0){_0x128ff0+=_0x5f4305;}_0x1e99aa[_0x1bbc('0x18')](dbH[_0x1bbc('0x2e')][_0x1bbc('0x2f')](util[_0x1bbc('0x20')](_0x1bbc('0x30'),QUERY,_0x5f4305,_0x128ff0),{'type':dbH['sequelize'][_0x1bbc('0x31')][_0x1bbc('0x32')]}));});if(_0x53fdd9>0x0){_0x128ff0+=_0x5f4305;_0x1e99aa['push'](dbH[_0x1bbc('0x2e')][_0x1bbc('0x2f')](util[_0x1bbc('0x20')](_0x1bbc('0x30'),QUERY,_0x53fdd9,_0x128ff0),{'type':dbH[_0x1bbc('0x2e')]['QueryTypes'][_0x1bbc('0x32')]}));}}}else{_0x1e99aa[_0x1bbc('0x18')](dbH[_0x1bbc('0x2e')][_0x1bbc('0x2f')](QUERY,{'type':dbH['sequelize'][_0x1bbc('0x31')][_0x1bbc('0x32')]}));}var _0x4dda97=path[_0x1bbc('0x33')](PATH);var _0x48278e=path[_0x1bbc('0x34')](PATH,'.pdf');var _0x11fd19=_0x5dd71b[_0x1bbc('0x29')]&&_0x1e99aa[_0x1bbc('0x16')]>0x1;var _0x1192e2=[];if(!fs[_0x1bbc('0x35')](path['join'](_0x4dda97,_0x48278e))&&_0x11fd19){fs['mkdirSync'](path[_0x1bbc('0x36')](_0x4dda97,_0x48278e));}return BPromise[_0x1bbc('0x37')](_0x1e99aa,function(_0x214326){_0x1192e2['push'](_0x214326);})[_0x1bbc('0x2b')](function(){var _0x539220=[];for(var _0x5698f7=0x0;_0x5698f7<_0x1192e2[_0x1bbc('0x16')];_0x5698f7+=0x1){var _0x540d35=_0x1192e2[_0x5698f7];var _0x4157ed=createTables(_[_0x1bbc('0x38')](_0x540d35));var _0x146c64;var _0x473c29=getPDFDocDefinition(_0x4157ed);var _0x8d6823=getPDFPrinter();var _0x544b3b=_0x8d6823[_0x1bbc('0x39')](_0x473c29);if(_0x11fd19){_0x146c64=path[_0x1bbc('0x36')](_0x4dda97,_0x48278e,util[_0x1bbc('0x20')](_0x1bbc('0x3a'),_0x48278e,_0x5698f7,_0x1bbc('0x3b')));}else{_0x146c64=path[_0x1bbc('0x36')](_0x4dda97,util[_0x1bbc('0x20')](_0x1bbc('0x3c'),_0x48278e,'pdf'));}_0x539220[_0x1bbc('0x18')](writePDFDocument(_0x544b3b,_0x146c64));}return Promise['all'](_0x539220);})['then'](function(){if(_0x11fd19){return new Promise(function(_0x1b9df){zipdir(path[_0x1bbc('0x36')](_0x4dda97,_0x48278e),{'saveTo':path['join'](_0x4dda97,util['format'](_0x1bbc('0x3c'),_0x48278e,'zip'))},function(){rimraf(path['join'](_0x4dda97,_0x48278e),function(){});_0x1b9df('zip\x20finished');});});}})[_0x1bbc('0x2b')](function(){if(!_0x11fd19)return;rimraf(path[_0x1bbc('0x36')](_0x4dda97,_0x48278e),function(){});})[_0x1bbc('0x2b')](function(){logger['info'](util[_0x1bbc('0x20')](_0x1bbc('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x1bbc('0x3e'),_0x11fd19?util[_0x1bbc('0x20')](_0x1bbc('0x3c'),_0x48278e,_0x11fd19?'zip':_0x1bbc('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1bbc('0x3f')](util[_0x1bbc('0x20')](_0x1bbc('0x40'),EXTRACTED_REPORT_ID,_0x1bbc('0x41')));return db[_0x1bbc('0x10')][_0x1bbc('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1ecd4a){EXTRACTED_REPORT=_0x1ecd4a;return dbH[_0x1bbc('0x2e')][_0x1bbc('0x2f')](util[_0x1bbc('0x20')](_0x1bbc('0x43'),QUERY),{'type':dbH[_0x1bbc('0x2e')]['QueryTypes'][_0x1bbc('0x32')]});})['then'](extractReport)[_0x1bbc('0x44')](function(_0x4a58ba){logger[_0x1bbc('0x3f')](util[_0x1bbc('0x20')](_0x1bbc('0x45'),EXTRACTED_REPORT_ID,'PDF'),util[_0x1bbc('0x46')](_0x4a58ba,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1bbc('0x47'));})[_0x1bbc('0x48')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0xf2235b=new PdfPrinter({'Arial':{'normal':__dirname+_0x1bbc('0x49'),'bold':__dirname+_0x1bbc('0x4a'),'italics':__dirname+_0x1bbc('0x4b'),'bolditalics':__dirname+_0x1bbc('0x4c')}});return _0xf2235b;}function getPDFDocDefinitionFromHTML(_0x6104bc,_0x326170){var _0x2e4fd3=util[_0x1bbc('0x20')](_0x1bbc('0x4d'),_0x326170[_0x1bbc('0x4e')],_0x326170[_0x1bbc('0x4f')]);var _0x1b9dcd=moment()[_0x1bbc('0x20')](_0x1bbc('0x50'))['toString']();var _0xeb9f3a=htmlToPdfmake(_0x6104bc,{'window':window,'tableAutoSize':!![]});return{'content':[_0xeb9f3a],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1bbc('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1bbc('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x1bbc('0x52'),'style':_0x1bbc('0x21')}];},'footer':function(_0x4e7351,_0x59a7d5){return[{'text':util[_0x1bbc('0x20')](_0x1bbc('0x53'),_0x2e4fd3,_0x4e7351,_0x59a7d5,_0x1b9dcd),'style':_0x1bbc('0x25')}];}};}function writePDFDocument(_0xe42fda,_0x2bc303){return new Promise(function(_0x3579bc,_0x73569d){var _0x44b740=_0xe42fda[_0x1bbc('0x54')](fs[_0x1bbc('0x55')](_0x2bc303));_0x44b740['on'](_0x1bbc('0x56'),function(){_0x3579bc('finish');});_0x44b740['on'](_0x1bbc('0x57'),function(_0x51cb73){_0x73569d(_0x51cb73);});_0xe42fda['end']();});}exports[_0x1bbc('0x58')]=function(_0x38a96b,_0x1ed429){var _0x264276=getPDFPrinter();var _0x5bd7b9=getPDFDocDefinitionFromHTML(_0x38a96b,_0x1ed429);var _0x2ff684=_0x264276[_0x1bbc('0x39')](_0x5bd7b9);return writePDFDocument(_0x2ff684,_0x1ed429[_0x1bbc('0x1')])[_0x1bbc('0x44')](function(_0x12b154){throw _0x12b154;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 98f6e2d..3c7c653 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 _0xc50c=['QueryTypes','SELECT','num','Empty','length','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','join','mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x1a36b5,_0xd16a33){var _0x48fd2a=function(_0x53d5fe){while(--_0x53d5fe){_0x1a36b5['push'](_0x1a36b5['shift']());}};_0x48fd2a(++_0xd16a33);}(_0xc50c,0x11d));var _0xcc50=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xc50c[_0x12fc8d];return _0x3f9d04;};'use strict';var util=require(_0xcc50('0x0'));var path=require(_0xcc50('0x1'));var _=require(_0xcc50('0x2'));var fs=require('fs');var json2xls=require(_0xcc50('0x3'));var BPromise=require(_0xcc50('0x4'));var zipdir=require(_0xcc50('0x5'));var rimraf=require(_0xcc50('0x6'));var db=require(_0xcc50('0x7'))['db'];var dbH=require(_0xcc50('0x7'))[_0xcc50('0x8')];var logger=require(_0xcc50('0x9'))(_0xcc50('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xcc50('0xb')][0x3];var PATH=process[_0xcc50('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3fd3fb,_0x3175d1){var _0x42e947={'status':_0x3fd3fb};var _0x5a2c2d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3175d1){_0x42e947[_0xcc50('0xc')]=_0x3175d1;}return db[_0xcc50('0xd')][_0xcc50('0xe')](_0x42e947,_0x5a2c2d);}function main(){var _0xf35f35=0x1388;var _0x1af43a;logger[_0xcc50('0xf')](util['format'](_0xcc50('0x10'),EXTRACTED_REPORT_ID,_0xcc50('0x11')));return db[_0xcc50('0x12')][_0xcc50('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcc50('0x14'),_0xcc50('0x15')]})[_0xcc50('0x16')](function(_0x4697f9){if(_0x4697f9){_0x1af43a=_0x4697f9;_0xf35f35=_0x1af43a[_0xcc50('0x15')]||0x1388;}})[_0xcc50('0x16')](function(){return dbH[_0xcc50('0x17')][_0xcc50('0x18')](util[_0xcc50('0x19')](_0xcc50('0x1a'),QUERY),{'type':dbH['sequelize'][_0xcc50('0x1b')][_0xcc50('0x1c')]});})[_0xcc50('0x16')](function(_0x409ca3){if(!_0x409ca3[0x0][_0xcc50('0x1d')]){return analyticExtractedReport(_0xcc50('0x1e'));}var _0x542d16=[];var _0x2df03e=0x0;if(_0x1af43a[_0xcc50('0x14')]){if(_0x409ca3&&_0x409ca3[_0xcc50('0x1f')]){var _0x19f43a=_[_0xcc50('0x20')](_0x409ca3[0x0][_0xcc50('0x1d')]/_0xf35f35);var _0x58cc63=Number['isInteger'](_0x409ca3[0x0][_0xcc50('0x1d')]/_0xf35f35)?_0x409ca3[0x0][_0xcc50('0x1d')]%_0xf35f35:0x0;_0x19f43a[_0xcc50('0x21')](function(_0x4cb566){if(_0x4cb566>0x0){_0x2df03e+=_0xf35f35;}_0x542d16['push'](dbH[_0xcc50('0x17')][_0xcc50('0x18')](util['format'](_0xcc50('0x22'),QUERY,_0xf35f35,_0x2df03e),{'type':dbH[_0xcc50('0x17')][_0xcc50('0x1b')][_0xcc50('0x1c')]}));});if(_0x58cc63>0x0){_0x2df03e+=_0xf35f35;_0x542d16[_0xcc50('0x23')](dbH['sequelize'][_0xcc50('0x18')](util[_0xcc50('0x19')](_0xcc50('0x22'),QUERY,_0x58cc63,_0x2df03e),{'type':dbH['sequelize'][_0xcc50('0x1b')][_0xcc50('0x1c')]}));}}}else{_0x542d16['push'](dbH[_0xcc50('0x17')][_0xcc50('0x18')](QUERY,{'type':dbH[_0xcc50('0x17')][_0xcc50('0x1b')]['SELECT']}));}var _0x41f290=path[_0xcc50('0x24')](PATH);var _0x1e433c=path[_0xcc50('0x25')](PATH,_0xcc50('0x26'));var _0x58afe8=_0x1af43a[_0xcc50('0x14')]&&_0x542d16[_0xcc50('0x1f')]>0x1;var _0x40e731=[];if(!fs['existsSync'](path[_0xcc50('0x27')](_0x41f290,_0x1e433c))&&_0x58afe8){fs[_0xcc50('0x28')](path['join'](_0x41f290,_0x1e433c));}return BPromise['each'](_0x542d16,function(_0x2106c9){_0x40e731[_0xcc50('0x23')](_0x2106c9);})[_0xcc50('0x16')](function(){for(var _0x1f0ead=0x0;_0x1f0ead<_0x40e731[_0xcc50('0x1f')];_0x1f0ead+=0x1){var _0x517c4b;var _0x3e5593=_0x40e731[_0x1f0ead];if(_0x58afe8){_0x517c4b=path[_0xcc50('0x27')](_0x41f290,_0x1e433c,util[_0xcc50('0x19')](_0xcc50('0x29'),_0x1e433c,_0x1f0ead,_0xcc50('0x2a')));}else{_0x517c4b=path[_0xcc50('0x27')](_0x41f290,util[_0xcc50('0x19')](_0xcc50('0x2b'),_0x1e433c,_0xcc50('0x2a')));}fs[_0xcc50('0x2c')](_0x517c4b,json2xls(_0x3e5593),_0xcc50('0x2d'));}})['then'](function(){if(_0x58afe8){return new Promise(function(_0x3ffccb){zipdir(path[_0xcc50('0x27')](_0x41f290,_0x1e433c),{'saveTo':path['join'](_0x41f290,util[_0xcc50('0x19')](_0xcc50('0x2b'),_0x1e433c,_0xcc50('0x2e')))},function(_0x3d5c09,_0x409996){rimraf(path[_0xcc50('0x27')](_0x41f290,_0x1e433c),function(){});_0x3ffccb('zip\x20finished');});});}})['then'](function(){logger[_0xcc50('0xf')](util['format'](_0xcc50('0x2f'),EXTRACTED_REPORT_ID,_0xcc50('0x11')));return analyticExtractedReport(_0xcc50('0x30'),_0x58afe8?util[_0xcc50('0x19')](_0xcc50('0x2b'),_0x1e433c,_0x58afe8?_0xcc50('0x2e'):_0xcc50('0x2a')):null);});})[_0xcc50('0x31')](function(_0x218ff0){logger['info'](util[_0xcc50('0x19')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcc50('0x11')),util[_0xcc50('0x32')](_0x218ff0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xcc50('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe903=['existsSync','join','mkdirSync','each','%s%d.%s','xlsx','zip','zip\x20finished','XLSX','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.xlsx'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0xe903,0x17d));var _0x3e90=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xe903[_0x8de54f];return _0x14cba4;};'use strict';var util=require(_0x3e90('0x0'));var path=require(_0x3e90('0x1'));var _=require(_0x3e90('0x2'));var fs=require('fs');var json2xls=require(_0x3e90('0x3'));var BPromise=require(_0x3e90('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x3e90('0x5'));var db=require(_0x3e90('0x6'))['db'];var dbH=require(_0x3e90('0x6'))[_0x3e90('0x7')];var logger=require(_0x3e90('0x8'))(_0x3e90('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x3e90('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f8b35,_0x59623e){var _0x1c7b00={'status':_0x4f8b35};var _0x3b743f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59623e){_0x1c7b00[_0x3e90('0xb')]=_0x59623e;}return db[_0x3e90('0xc')][_0x3e90('0xd')](_0x1c7b00,_0x3b743f);}function main(){var _0x23580f=0x1388;var _0x6cd33f;logger[_0x3e90('0xe')](util[_0x3e90('0xf')](_0x3e90('0x10'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0x3e90('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3e90('0x12'),_0x3e90('0x13')]})[_0x3e90('0x14')](function(_0x1bcba9){if(_0x1bcba9){_0x6cd33f=_0x1bcba9;_0x23580f=_0x6cd33f[_0x3e90('0x13')]||0x1388;}})[_0x3e90('0x14')](function(){return dbH['sequelize'][_0x3e90('0x15')](util[_0x3e90('0xf')](_0x3e90('0x16'),QUERY),{'type':dbH[_0x3e90('0x17')][_0x3e90('0x18')]['SELECT']});})[_0x3e90('0x14')](function(_0x1a30d0){if(!_0x1a30d0[0x0][_0x3e90('0x19')]){return analyticExtractedReport(_0x3e90('0x1a'));}var _0xfab73b=[];var _0x22556e=0x0;if(_0x6cd33f[_0x3e90('0x12')]){if(_0x1a30d0&&_0x1a30d0[_0x3e90('0x1b')]){var _0x1f9b0e=_[_0x3e90('0x1c')](_0x1a30d0[0x0][_0x3e90('0x19')]/_0x23580f);var _0x2ed204=Number['isInteger'](_0x1a30d0[0x0][_0x3e90('0x19')]/_0x23580f)?_0x1a30d0[0x0][_0x3e90('0x19')]%_0x23580f:0x0;_0x1f9b0e[_0x3e90('0x1d')](function(_0x374ff0){if(_0x374ff0>0x0){_0x22556e+=_0x23580f;}_0xfab73b[_0x3e90('0x1e')](dbH[_0x3e90('0x17')][_0x3e90('0x15')](util[_0x3e90('0xf')](_0x3e90('0x1f'),QUERY,_0x23580f,_0x22556e),{'type':dbH[_0x3e90('0x17')][_0x3e90('0x18')]['SELECT']}));});if(_0x2ed204>0x0){_0x22556e+=_0x23580f;_0xfab73b[_0x3e90('0x1e')](dbH[_0x3e90('0x17')][_0x3e90('0x15')](util[_0x3e90('0xf')](_0x3e90('0x1f'),QUERY,_0x2ed204,_0x22556e),{'type':dbH['sequelize'][_0x3e90('0x18')][_0x3e90('0x20')]}));}}}else{_0xfab73b[_0x3e90('0x1e')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x3e90('0x17')][_0x3e90('0x18')]['SELECT']}));}var _0x2ed350=path['dirname'](PATH);var _0x420eaf=path[_0x3e90('0x21')](PATH,_0x3e90('0x22'));var _0x49900a=_0x6cd33f[_0x3e90('0x12')]&&_0xfab73b[_0x3e90('0x1b')]>0x1;var _0x28b852=[];if(!fs[_0x3e90('0x23')](path[_0x3e90('0x24')](_0x2ed350,_0x420eaf))&&_0x49900a){fs[_0x3e90('0x25')](path['join'](_0x2ed350,_0x420eaf));}return BPromise[_0x3e90('0x26')](_0xfab73b,function(_0x503cf2){_0x28b852[_0x3e90('0x1e')](_0x503cf2);})[_0x3e90('0x14')](function(){for(var _0x4311f8=0x0;_0x4311f8<_0x28b852[_0x3e90('0x1b')];_0x4311f8+=0x1){var _0x4cf016;var _0x28340a=_0x28b852[_0x4311f8];if(_0x49900a){_0x4cf016=path['join'](_0x2ed350,_0x420eaf,util['format'](_0x3e90('0x27'),_0x420eaf,_0x4311f8,_0x3e90('0x28')));}else{_0x4cf016=path[_0x3e90('0x24')](_0x2ed350,util['format']('%s.%s',_0x420eaf,_0x3e90('0x28')));}fs['writeFileSync'](_0x4cf016,json2xls(_0x28340a),'binary');}})[_0x3e90('0x14')](function(){if(_0x49900a){return new Promise(function(_0x35e476){zipdir(path[_0x3e90('0x24')](_0x2ed350,_0x420eaf),{'saveTo':path['join'](_0x2ed350,util[_0x3e90('0xf')]('%s.%s',_0x420eaf,_0x3e90('0x29')))},function(_0x55c4f1,_0x5e07f1){rimraf(path['join'](_0x2ed350,_0x420eaf),function(){});_0x35e476(_0x3e90('0x2a'));});});}})[_0x3e90('0x14')](function(){logger[_0x3e90('0xe')](util[_0x3e90('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3e90('0x2b')));return analyticExtractedReport(_0x3e90('0x2c'),_0x49900a?util[_0x3e90('0xf')](_0x3e90('0x2d'),_0x420eaf,_0x49900a?_0x3e90('0x29'):_0x3e90('0x28')):null);});})[_0x3e90('0x2e')](function(_0x1aa6fc){logger[_0x3e90('0xe')](util[_0x3e90('0xf')](_0x3e90('0x2f'),EXTRACTED_REPORT_ID,_0x3e90('0x2b')),util[_0x3e90('0x30')](_0x1aa6fc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3e90('0x31'));})[_0x3e90('0x32')](function(){process[_0x3e90('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index ba0899c..3e5bd5a 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 _0xf910=['last','Hangup','concat','transaction','VoiceExtension','destroy','sortBy','error','util','findAll','models','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','find','extensions','push','type','format','context','priority','Set','CDR(routeid)=','VoiceExtensionId','outbound','cutdigits','${EXTEN:','ExecIf','):Goto(','extension','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},'];(function(_0x577160,_0x5e857b){var _0x5558fc=function(_0x395a8d){while(--_0x395a8d){_0x577160['push'](_0x577160['shift']());}};_0x5558fc(++_0x5e857b);}(_0xf910,0x114));var _0x0f91=function(_0x188e1e,_0x274da7){_0x188e1e=_0x188e1e-0x0;var _0x3c67e1=_0xf910[_0x188e1e];return _0x3c67e1;};'use strict';var _=require('lodash');var util=require(_0x0f91('0x0'));function rewrite(_0x4c0c5f,_0x59c323){var _0x4873dd=this;return _0x4c0c5f['models']['Interval'][_0x0f91('0x1')]({'raw':!![]})['then'](function(_0x4a6338){_0x4873dd['intervals']=_0x4a6338;return _0x4c0c5f[_0x0f91('0x2')]['VoiceExtension'][_0x0f91('0x1')]({'where':{'IntervalId':_0x59c323[_0x0f91('0x3')]},'raw':!![]});})[_0x0f91('0x4')](function(_0x1320b1){return _0x4c0c5f[_0x0f91('0x2')]['VoiceExtension'][_0x0f91('0x1')]({'where':{'exten':{'$in':_[_0x0f91('0x5')](_[_0x0f91('0x6')](_0x1320b1,_0x0f91('0x7')))}},'order':[{'raw':_0x0f91('0x8')}],'raw':!![]});})['then'](function(_0x100e53){var _0x7edeab=_[_0x0f91('0x9')](_0x100e53,{'priority':'1'});var _0x3ad86b=_[_0x0f91('0x9')](_0x100e53,{'isApp':0x1});var _0x134183=_['groupBy'](_0x3ad86b,_0x0f91('0x7'));var _0x3b086f=['queue',_0x0f91('0xa')];var _0x3ce059=[];var _0x5bf0e7=[];for(var _0x40f6e4 in _0x134183){if(_0x134183[_0x0f91('0xb')](_0x40f6e4)){_0x4873dd['priority']=0x2;_0x4873dd['extensions']=[];_0x4873dd['extension']=_[_0x0f91('0xc')](_0x7edeab,{'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')]});_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':'Set','appdata':util[_0x0f91('0x10')]('CDR(type)=%s',_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')]),'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd[_0x0f91('0x12')]++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0]['VoiceExtensionId']});if(_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')]==='inbound'){_0x4873dd[_0x0f91('0xd')]['push']({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x14')+_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')],'context':_0x134183[_0x40f6e4][0x0]['context'],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});}else if(_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')]===_0x0f91('0x16')){if(_0x4873dd['extension']){_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':'CDR(destination)='+(_0x4873dd['extension'][_0x0f91('0x17')]?_0x0f91('0x18')+_0x4873dd['extension'][_0x0f91('0x17')]+'}':'${EXTEN}'),'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd[_0x0f91('0x12')]++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});}_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x14')+_0x134183[_0x40f6e4][0x0]['VoiceExtensionId'],'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd[_0x0f91('0x12')]++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});var _0x20b17e=_0x4873dd[_0x0f91('0x12')]++;_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x19'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x20b17e+0x2)+_0x0f91('0x1a')+(_0x20b17e+0x1)+')','context':_0x134183[_0x40f6e4][0x0]['context'],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x20b17e,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});if(_0x4873dd[_0x0f91('0x1b')]){_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x4873dd['extension'][_0x0f91('0x17')]?_0x0f91('0x1c')+_0x4873dd[_0x0f91('0x1b')]['cutdigits']+'}':_0x0f91('0x1d'),'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});}_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0]['type'],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x1e')+_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')],'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0]['exten'],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});if(_0x4873dd['extension']&&_0x4873dd[_0x0f91('0x1b')][_0x0f91('0xb')](_0x0f91('0x1f'))&&_0x4873dd[_0x0f91('0x1b')][_0x0f91('0x1f')]!==_0x0f91('0x20')){_0x4873dd['extensions'][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x21'),'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd[_0x0f91('0x12')]++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});_0x4873dd['extensions']['push']({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x22')+_0x4873dd[_0x0f91('0x1b')][_0x0f91('0x1f')]||'wav','context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});}}_0x4873dd[_0x0f91('0xd')]['push']({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':'Set','appdata':_0x0f91('0x23'),'context':_0x134183[_0x40f6e4][0x0]['context'],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd[_0x0f91('0x12')]++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0]['VoiceExtensionId']});_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x24'),'context':_0x134183[_0x40f6e4][0x0]['context'],'exten':_0x134183[_0x40f6e4][0x0]['exten'],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});_0x4873dd['extensions'][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0]['VoiceExtensionId']});for(var _0x163088=0x0,_0x38bc89=0x0;_0x163088<_0x134183[_0x40f6e4]['length'];_0x163088+=0x1,_0x38bc89=0x0){var _0x3d209c=_0x134183[_0x40f6e4][_0x163088];if(_0x3d209c[_0x0f91('0xf')]){_0x3d209c[_0x0f91('0xf')]=_0x3d209c[_0x0f91('0xf')][_0x0f91('0x25')]();}var _0x1ea43c=[];var _0xf4a659=[];delete _0x3d209c['id'];delete _0x3d209c[_0x0f91('0x26')];delete _0x3d209c[_0x0f91('0x27')];var _0x3edc87=_0x3d209c['interval']!==_0x0f91('0x28')?[_0x3d209c['interval']]:_0x3d209c['IntervalId']?_[_0x0f91('0x6')](_[_0x0f91('0x9')](_0x4873dd['intervals'],{'IntervalId':_0x3d209c['IntervalId']}),_0x0f91('0x29')):[];if(_0x3d209c[_0x0f91('0xb')](_0x0f91('0x2a'))){if(_0x3d209c[_0x0f91('0x2a')]&&_0x3d209c[_0x0f91('0x2a')]!=='--'){_0x1ea43c[_0x0f91('0xe')]({'type':_0x3d209c[_0x0f91('0xf')],'app':'Set','appdata':_0x0f91('0x2b')+_0x3d209c[_0x0f91('0x2a')],'context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c[_0x0f91('0x7')],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd[_0x0f91('0x12')]+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});}}if(_0x3d209c[_0x0f91('0xf')]===_0x0f91('0x16')&&_0x3d209c['hasOwnProperty']('callerID')){if(_0x3d209c[_0x0f91('0x2d')]){_0x1ea43c['push']({'type':_0x3d209c[_0x0f91('0xf')],'app':'ExecIf','appdata':_0x0f91('0x2e')+_0x3d209c[_0x0f91('0x2d')]+')','context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c[_0x0f91('0x7')],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd[_0x0f91('0x12')]+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});}else{_0x1ea43c[_0x0f91('0xe')]({'type':_0x3d209c[_0x0f91('0xf')],'app':_0x0f91('0x19'),'appdata':_0x0f91('0x2f'),'context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c[_0x0f91('0x7')],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd['priority']+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});}}if(_0x3d209c[_0x0f91('0xb')](_0x0f91('0x30'))){if(_0x3b086f[_0x0f91('0x31')](_0x3d209c[_0x0f91('0x32')][_0x0f91('0x25')]())>=0x0&&_0x3d209c[_0x0f91('0x33')]!==_0x0f91('0x34')){if(_0x3d209c['answer']){_0x1ea43c[_0x0f91('0xe')]({'type':_0x3d209c['type'],'app':_0x0f91('0x19'),'appdata':_0x0f91('0x35'),'context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c[_0x0f91('0x7')],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd['priority']+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});_0x1ea43c['push']({'type':_0x3d209c[_0x0f91('0xf')],'app':'Set','appdata':_0x0f91('0x36'),'context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c['exten'],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd[_0x0f91('0x12')]+_0x38bc89++,'VoiceExtensionId':_0x3d209c['VoiceExtensionId']});}else{_0x1ea43c['push']({'type':_0x3d209c[_0x0f91('0xf')],'app':'ExecIf','appdata':_0x0f91('0x37'),'context':_0x3d209c['context'],'exten':_0x3d209c['exten'],'priority':_0x3edc87['length']+_0x4873dd[_0x0f91('0x12')]+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});_0x1ea43c[_0x0f91('0xe')]({'type':_0x3d209c[_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x38'),'context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c['exten'],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd[_0x0f91('0x12')]+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});}}}for(var _0x543c41=0x0;_0x543c41<_0x3edc87[_0x0f91('0x2c')];_0x543c41+=0x1){var _0x2bd546=_0x4873dd[_0x0f91('0x12')]+_0x3edc87[_0x0f91('0x2c')];var _0x6f1dec=_0x543c41===_0x3edc87[_0x0f91('0x2c')]-0x1?_0x4873dd['priority']+_0x1ea43c[_0x0f91('0x2c')]+_0xf4a659[_0x0f91('0x2c')]+0x2:_0x4873dd['priority']+_0x543c41+0x1;_0x1ea43c[_0x0f91('0x39')](_0x543c41,0x0,{'type':_0x3d209c[_0x0f91('0xf')],'app':'GotoIfTime','appdata':_0x3edc87[_0x543c41]+'?'+_0x3d209c['context']+_0x0f91('0x3a')+_0x2bd546+':'+_0x3d209c[_0x0f91('0x11')]+_0x0f91('0x3a')+_0x6f1dec,'exten':_0x3d209c[_0x0f91('0x7')],'context':_0x3d209c[_0x0f91('0x11')],'priority':_0x4873dd[_0x0f91('0x12')]+_0x543c41,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});}_0x3d209c['priority']=_0x1ea43c[_0x0f91('0x2c')]?_[_0x0f91('0x3b')](_0x1ea43c)[_0x0f91('0x12')]+0x1:_0x4873dd[_0x0f91('0x12')];_0x4873dd[_0x0f91('0x12')]=(_0xf4a659[_0x0f91('0x2c')]?_['last'](_0xf4a659)[_0x0f91('0x12')]:_0x3d209c[_0x0f91('0x12')])+0x1;_0x4873dd[_0x0f91('0xd')]=_['concat'](_0x4873dd['extensions'],_0x1ea43c,[_0x3d209c],_0xf4a659);}_0x4873dd['extensions'][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x3c'),'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'priority':_0x4873dd[_0x0f91('0x12')],'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});_0x3ce059[_0x0f91('0xe')](_0x134183[_0x40f6e4][0x0]['VoiceExtensionId']);_0x5bf0e7=_[_0x0f91('0x3d')](_0x5bf0e7,_0x4873dd[_0x0f91('0xd')]);}}return _0x4c0c5f[_0x0f91('0x3e')](function(_0x4d9c2b){return _0x4c0c5f[_0x0f91('0x2')][_0x0f91('0x3f')][_0x0f91('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x3ce059}},'transaction':_0x4d9c2b})[_0x0f91('0x4')](function(_0x4c7ed1){return _0x4c0c5f[_0x0f91('0x2')][_0x0f91('0x3f')]['bulkCreate'](_[_0x0f91('0x41')](_0x5bf0e7,_0x0f91('0x12')),{'transaction':_0x4d9c2b});});});})['catch'](function(_0x144e16){console[_0x0f91('0x42')](_0x144e16);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x4fd9=['format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','intervals','hasOwnProperty','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','transaction','destroy','sortBy','error','rewrite','lodash','util','Interval','findAll','VoiceExtension','IntervalId','then','models','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','priority','extensions','extension','push','Set'];(function(_0x30921a,_0x24b33d){var _0x23c23c=function(_0x221575){while(--_0x221575){_0x30921a['push'](_0x30921a['shift']());}};_0x23c23c(++_0x24b33d);}(_0x4fd9,0xb9));var _0x94fd=function(_0x537106,_0x5b7cc0){_0x537106=_0x537106-0x0;var _0x2a7fa9=_0x4fd9[_0x537106];return _0x2a7fa9;};'use strict';var _=require(_0x94fd('0x0'));var util=require(_0x94fd('0x1'));function rewrite(_0x7b0cab,_0x48669c){var _0x2e56ec=this;return _0x7b0cab['models'][_0x94fd('0x2')][_0x94fd('0x3')]({'raw':!![]})['then'](function(_0x23d78c){_0x2e56ec['intervals']=_0x23d78c;return _0x7b0cab['models'][_0x94fd('0x4')][_0x94fd('0x3')]({'where':{'IntervalId':_0x48669c[_0x94fd('0x5')]},'raw':!![]});})[_0x94fd('0x6')](function(_0x171f7a){return _0x7b0cab[_0x94fd('0x7')][_0x94fd('0x4')][_0x94fd('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x94fd('0x8')](_0x171f7a,_0x94fd('0x9')))}},'order':[{'raw':_0x94fd('0xa')}],'raw':!![]});})[_0x94fd('0x6')](function(_0x46396f){var _0x4a6afa=_[_0x94fd('0xb')](_0x46396f,{'priority':'1'});var _0x204141=_['filter'](_0x46396f,{'isApp':0x1});var _0x31e68c=_[_0x94fd('0xc')](_0x204141,'exten');var _0x373be0=[_0x94fd('0xd'),'playback'];var _0x32917b=[];var _0x3b0658=[];for(var _0x54187b in _0x31e68c){if(_0x31e68c['hasOwnProperty'](_0x54187b)){_0x2e56ec[_0x94fd('0xe')]=0x2;_0x2e56ec[_0x94fd('0xf')]=[];_0x2e56ec[_0x94fd('0x10')]=_['find'](_0x4a6afa,{'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')]});_0x2e56ec['extensions'][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0]['type'],'app':_0x94fd('0x12'),'appdata':util[_0x94fd('0x13')](_0x94fd('0x14'),_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')]),'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});if(_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')]===_0x94fd('0x18')){_0x2e56ec['extensions'][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')],'context':_0x31e68c[_0x54187b][0x0]['context'],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});}else if(_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')]===_0x94fd('0x19')){if(_0x2e56ec[_0x94fd('0x10')]){_0x2e56ec[_0x94fd('0xf')]['push']({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Set','appdata':_0x94fd('0x1a')+(_0x2e56ec[_0x94fd('0x10')][_0x94fd('0x1b')]?_0x94fd('0x1c')+_0x2e56ec[_0x94fd('0x10')][_0x94fd('0x1b')]+'}':_0x94fd('0x1d')),'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});}_0x2e56ec['extensions'][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Set','appdata':_0x94fd('0x1e')+_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')],'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});var _0x952a11=_0x2e56ec['priority']++;_0x2e56ec[_0x94fd('0xf')][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':_0x94fd('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x952a11+0x2)+_0x94fd('0x20')+(_0x952a11+0x1)+')','context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x952a11,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});if(_0x2e56ec[_0x94fd('0x10')]){_0x2e56ec[_0x94fd('0xf')][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Set','appdata':_0x2e56ec[_0x94fd('0x10')][_0x94fd('0x1b')]?_0x94fd('0x21')+_0x2e56ec[_0x94fd('0x10')][_0x94fd('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0]['exten'],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});}_0x2e56ec[_0x94fd('0xf')][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x22')+_0x31e68c[_0x54187b][0x0]['VoiceExtensionId'],'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0]['VoiceExtensionId']});if(_0x2e56ec[_0x94fd('0x10')]&&_0x2e56ec[_0x94fd('0x10')]['hasOwnProperty'](_0x94fd('0x23'))&&_0x2e56ec['extension'][_0x94fd('0x23')]!==_0x94fd('0x24')){_0x2e56ec[_0x94fd('0xf')]['push']({'type':_0x31e68c[_0x54187b][0x0]['type'],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x25'),'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});_0x2e56ec[_0x94fd('0xf')][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x26')+_0x2e56ec[_0x94fd('0x10')]['recordingFormat']||_0x94fd('0x27'),'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0]['exten'],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});}}_0x2e56ec[_0x94fd('0xf')][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x28'),'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0]['VoiceExtensionId']});_0x2e56ec['extensions']['push']({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':_0x94fd('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec['priority']++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0]['VoiceExtensionId']});_0x2e56ec[_0x94fd('0xf')]['push']({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Set','appdata':_0x94fd('0x29'),'context':_0x31e68c[_0x54187b][0x0]['context'],'exten':_0x31e68c[_0x54187b][0x0]['exten'],'priority':_0x2e56ec['priority']++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});for(var _0x48b20b=0x0,_0x24fe49=0x0;_0x48b20b<_0x31e68c[_0x54187b][_0x94fd('0x2a')];_0x48b20b+=0x1,_0x24fe49=0x0){var _0x184e61=_0x31e68c[_0x54187b][_0x48b20b];if(_0x184e61['type']){_0x184e61['type']=_0x184e61['type'][_0x94fd('0x2b')]();}var _0x9402da=[];var _0x3ccce7=[];delete _0x184e61['id'];delete _0x184e61['createdAt'];delete _0x184e61[_0x94fd('0x2c')];var _0x7fca50=_0x184e61[_0x94fd('0x2d')]!==_0x94fd('0x2e')?[_0x184e61[_0x94fd('0x2d')]]:_0x184e61['IntervalId']?_[_0x94fd('0x8')](_[_0x94fd('0xb')](_0x2e56ec[_0x94fd('0x2f')],{'IntervalId':_0x184e61[_0x94fd('0x5')]}),'interval'):[];if(_0x184e61[_0x94fd('0x30')](_0x94fd('0x31'))){if(_0x184e61[_0x94fd('0x31')]&&_0x184e61[_0x94fd('0x31')]!=='--'){_0x9402da[_0x94fd('0x11')]({'type':_0x184e61[_0x94fd('0x15')],'app':'Set','appdata':'CDR(tag)='+_0x184e61['tag'],'context':_0x184e61['context'],'exten':_0x184e61['exten'],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});}}if(_0x184e61['type']==='outbound'&&_0x184e61[_0x94fd('0x30')](_0x94fd('0x32'))){if(_0x184e61[_0x94fd('0x32')]){_0x9402da[_0x94fd('0x11')]({'type':_0x184e61[_0x94fd('0x15')],'app':'ExecIf','appdata':_0x94fd('0x33')+_0x184e61[_0x94fd('0x32')]+')','context':_0x184e61['context'],'exten':_0x184e61[_0x94fd('0x9')],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec['priority']+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});}else{_0x9402da[_0x94fd('0x11')]({'type':_0x184e61[_0x94fd('0x15')],'app':'ExecIf','appdata':_0x94fd('0x34'),'context':_0x184e61[_0x94fd('0x16')],'exten':_0x184e61[_0x94fd('0x9')],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});}}if(_0x184e61[_0x94fd('0x30')](_0x94fd('0x35'))){if(_0x373be0[_0x94fd('0x36')](_0x184e61['app'][_0x94fd('0x2b')]())>=0x0&&_0x184e61[_0x94fd('0x37')]!=='custom'){if(_0x184e61[_0x94fd('0x35')]){_0x9402da[_0x94fd('0x11')]({'type':_0x184e61['type'],'app':_0x94fd('0x1f'),'appdata':_0x94fd('0x38'),'context':_0x184e61[_0x94fd('0x16')],'exten':_0x184e61[_0x94fd('0x9')],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});_0x9402da[_0x94fd('0x11')]({'type':_0x184e61['type'],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x39'),'context':_0x184e61['context'],'exten':_0x184e61[_0x94fd('0x9')],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});}else{_0x9402da[_0x94fd('0x11')]({'type':_0x184e61[_0x94fd('0x15')],'app':'ExecIf','appdata':_0x94fd('0x3a'),'context':_0x184e61[_0x94fd('0x16')],'exten':_0x184e61[_0x94fd('0x9')],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});_0x9402da[_0x94fd('0x11')]({'type':_0x184e61[_0x94fd('0x15')],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x3b'),'context':_0x184e61['context'],'exten':_0x184e61['exten'],'priority':_0x7fca50['length']+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61['VoiceExtensionId']});}}}for(var _0x90983e=0x0;_0x90983e<_0x7fca50['length'];_0x90983e+=0x1){var _0x3ff679=_0x2e56ec['priority']+_0x7fca50[_0x94fd('0x2a')];var _0x5acd12=_0x90983e===_0x7fca50[_0x94fd('0x2a')]-0x1?_0x2e56ec[_0x94fd('0xe')]+_0x9402da['length']+_0x3ccce7[_0x94fd('0x2a')]+0x2:_0x2e56ec[_0x94fd('0xe')]+_0x90983e+0x1;_0x9402da['splice'](_0x90983e,0x0,{'type':_0x184e61[_0x94fd('0x15')],'app':'GotoIfTime','appdata':_0x7fca50[_0x90983e]+'?'+_0x184e61[_0x94fd('0x16')]+_0x94fd('0x3c')+_0x3ff679+':'+_0x184e61[_0x94fd('0x16')]+_0x94fd('0x3c')+_0x5acd12,'exten':_0x184e61['exten'],'context':_0x184e61[_0x94fd('0x16')],'priority':_0x2e56ec[_0x94fd('0xe')]+_0x90983e,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});}_0x184e61[_0x94fd('0xe')]=_0x9402da['length']?_[_0x94fd('0x3d')](_0x9402da)[_0x94fd('0xe')]+0x1:_0x2e56ec['priority'];_0x2e56ec[_0x94fd('0xe')]=(_0x3ccce7[_0x94fd('0x2a')]?_['last'](_0x3ccce7)['priority']:_0x184e61[_0x94fd('0xe')])+0x1;_0x2e56ec['extensions']=_[_0x94fd('0x3e')](_0x2e56ec[_0x94fd('0xf')],_0x9402da,[_0x184e61],_0x3ccce7);}_0x2e56ec['extensions']['push']({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Hangup','exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'priority':_0x2e56ec['priority'],'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});_0x32917b[_0x94fd('0x11')](_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]);_0x3b0658=_['concat'](_0x3b0658,_0x2e56ec[_0x94fd('0xf')]);}}return _0x7b0cab[_0x94fd('0x3f')](function(_0x52c487){return _0x7b0cab[_0x94fd('0x7')][_0x94fd('0x4')][_0x94fd('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x32917b}},'transaction':_0x52c487})[_0x94fd('0x6')](function(_0x43f572){return _0x7b0cab[_0x94fd('0x7')][_0x94fd('0x4')]['bulkCreate'](_[_0x94fd('0x41')](_0x3b0658,'priority'),{'transaction':_0x52c487});});});})['catch'](function(_0x45fcde){console[_0x94fd('0x42')](_0x45fcde);});}exports[_0x94fd('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 1925aff..ba8a93f 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 _0x08b8=['CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','toString','insert','str','calleridnum','cm_hopper_final','\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','BlackLists','all','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','pause'];(function(_0x1f2fc3,_0x1f32b2){var _0x1fa293=function(_0x117f76){while(--_0x117f76){_0x1f2fc3['push'](_0x1f2fc3['shift']());}};_0x1fa293(++_0x1f32b2);}(_0x08b8,0xe7));var _0x808b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08b8[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x808b('0x0'));var util=require(_0x808b('0x1'));var _=require(_0x808b('0x2'));var fs=require('fs');var squel=require(_0x808b('0x3'));var Papa=require(_0x808b('0x4'));var Redis=require('ioredis');var db=require(_0x808b('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('api');config[_0x808b('0x6')]=_[_0x808b('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x808b('0x8'))(new Redis(config[_0x808b('0x6')]));require(_0x808b('0x9'))[_0x808b('0xa')](socket);try{if(!process[_0x808b('0xb')][0x2]||process[_0x808b('0xb')][0x2]==='undefined'||process[_0x808b('0xb')][0x2]===_0x808b('0xc')){throw new Error(_0x808b('0xd'));}var FILEPATH=process[_0x808b('0xb')][0x2];if(!process[_0x808b('0xb')][0x3]||process['argv'][0x3]===_0x808b('0xe')||process[_0x808b('0xb')][0x3]==='null'||!process[_0x808b('0xb')][0x4]||process['argv'][0x4]===_0x808b('0xe')||process[_0x808b('0xb')][0x4]===_0x808b('0xc')){throw new Error(_0x808b('0xf'));}var FIELDS=_[_0x808b('0x10')](process['argv'][0x3][_0x808b('0x11')](','),process[_0x808b('0xb')][0x4][_0x808b('0x11')](','));if(!process[_0x808b('0xb')][0x5]||process[_0x808b('0xb')][0x5]==='undefined'||process['argv'][0x5]===_0x808b('0xc')){throw new Error(_0x808b('0x12'));}var LISTID=process[_0x808b('0xb')][0x5];var COMPANYID=process[_0x808b('0xb')][0x6]&&process[_0x808b('0xb')][0x6]!==_0x808b('0xe')&&process[_0x808b('0xb')][0x6]!==_0x808b('0xc')?process[_0x808b('0xb')][0x6]:null;var DUPLICATES=process[_0x808b('0xb')][0x7]&&process[_0x808b('0xb')][0x7]!==_0x808b('0xe')&&process[_0x808b('0xb')][0x7]!==_0x808b('0xc')?process['argv'][0x7]:null;if(!process[_0x808b('0xb')][0x8]||process[_0x808b('0xb')][0x8]===_0x808b('0xe')||process[_0x808b('0xb')][0x8]===_0x808b('0xc')){throw new Error(_0x808b('0x13'));}var SOCKET_TIMESTAMP=process[_0x808b('0xb')][0x8];}catch(_0x12d033){logger[_0x808b('0x14')](_0x12d033);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(_0x1f50e4,_0x5d7a43,_0x42cd49,_0x35fb89){var _0x4e092b={'message':_0x5d7a43};_0x4e092b[_0x1f50e4]=!![];if(_0x42cd49){_0x4e092b[_0x808b('0x15')]=_0x42cd49;}if(_0x35fb89){_0x4e092b[_0x808b('0x16')]=_0x35fb89;}return _0x4e092b;}function isEmail(_0x5166e6){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))*$/[_0x808b('0x17')](_0x5166e6);}function checkRow(_0x24e569,_0x50e27f,_0x2c9684){return new BPromise(function(_0x3f5144,_0x3a51b2){if(_[_0x808b('0x18')](_0x24e569)){return _0x3a51b2(handleCheckRowError('error',_0x808b('0x19'),null,_0x2c9684));}if(_0x24e569['errors']&&_0x24e569[_0x808b('0x1a')]['length']){var _0xf3c34=_[_0x808b('0x1b')](_0x24e569[_0x808b('0x1a')],_0x808b('0x1c'))[_0x808b('0x1d')](';');return _0x3a51b2(handleCheckRowError(_0x808b('0x14'),_0xf3c34,null,_0x2c9684));}var _0x41ff88={};for(var _0x48b9a4 in FIELDS){if(FIELDS[_0x808b('0x1e')](_0x48b9a4)&&FIELDS[_0x48b9a4]){_0x41ff88[_0x48b9a4]=_0x24e569['data'][0x0][FIELDS[_0x48b9a4]]||_0x24e569[_0x808b('0x1f')][0x0]['\ufeff'+FIELDS[_0x48b9a4]];}}if(!_0x41ff88[_0x808b('0x20')]){return _0x3a51b2(handleCheckRowError(_0x808b('0x14'),_0x808b('0x21'),null,_0x2c9684));}if(!_0x41ff88['phone']){return _0x3a51b2(handleCheckRowError(_0x808b('0x14'),_0x808b('0x22'),null,_0x2c9684));}if(_0x41ff88['birthDate']){var _0x1f3c7a=moment(_0x41ff88['birthDate'],'YYYY-MM-DD');if(!_0x1f3c7a[_0x808b('0x23')]()){return _0x3a51b2(handleCheckRowError('error',_0x808b('0x24'),null,_0x2c9684));}}if(_0x41ff88[_0x808b('0x25')]){if(!isEmail(_0x41ff88[_0x808b('0x25')])){return _0x3a51b2(handleCheckRowError(_0x808b('0x14'),_0x808b('0x26'),null,_0x2c9684));}}_0x41ff88[_0x808b('0x27')]=LISTID;_0x41ff88[_0x808b('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x808b('0x29')]&&_0x50e27f){var _0x254db3={};for(var _0x28d150=0x0,_0x5ba725=DUPLICATES['length'];_0x28d150<_0x5ba725;_0x28d150+=0x1){_0x254db3[DUPLICATES[_0x28d150]]=_0x41ff88[DUPLICATES[_0x28d150]];}var _0x4a2fbe=_[_0x808b('0x2a')](_0x50e27f,_0x254db3);if(_0x4a2fbe){return _0x3a51b2(handleCheckRowError(_0x808b('0x2b'),_0x808b('0x2c'),_0x4a2fbe,_0x2c9684));}}return db['CmContact']['create'](_0x41ff88,{'raw':!![],'hooks':![],'fields':_[_0x808b('0x2d')](_0x41ff88)})[_0x808b('0x2e')](function(_0x46dfa6){if(DUPLICATES&&DUPLICATES['length']&&_0x50e27f){_0x50e27f[_0x808b('0x2f')](_[_0x808b('0x30')](_0x41ff88,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x46dfa6['id'];return _0x3f5144();})[_0x808b('0x31')](function(_0x4aefb6){return _0x3a51b2(handleCheckRowError(_0x808b('0x14'),_0x808b('0x32')+(_0x4aefb6['message']||JSON[_0x808b('0x33')](_0x4aefb6)),null,_0x2c9684));});});}function checkHopper(){function _0x3bf4ab(){return function(_0x258771){logger[_0x808b('0x14')](_0x808b('0x34'),_0x808b('0x35'),util[_0x808b('0x36')](_0x258771,{'showHidden':![],'depth':null}));};}var _0x264544=function(_0x3874cd,_0x37f2ab){var _0x87bb09=squel['insert']()[_0x808b('0x37')]('cm_hopper')[_0x808b('0x38')]([_0x808b('0x39'),_0x808b('0x3a'),_0x808b('0x3b'),'ListId',_0x37f2ab,_0x808b('0x3c'),_0x808b('0x3d')],squel[_0x808b('0x3e')]()[_0x808b('0x3f')]('phone',_0x808b('0x39'))[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3a'))[_0x808b('0x3f')]('id','ContactId')[_0x808b('0x3f')](LISTID['toString'](),_0x808b('0x27'))[_0x808b('0x3f')](_0x3874cd['id']['toString'](),_0x37f2ab)[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3c'))['field']('NOW()',_0x808b('0x3d'))['from'](_0x808b('0x41'))[_0x808b('0x42')]('deletedAt\x20IS\x20NULL')[_0x808b('0x42')](_0x808b('0x43'),LISTID['toString']())[_0x808b('0x42')](_0x808b('0x44'))['where'](_0x808b('0x45'),squel['select']()[_0x808b('0x3f')](_0x808b('0x39'))[_0x808b('0x46')](_0x808b('0x47'))[_0x808b('0x42')](_0x37f2ab+'\x20=\x20?',_0x3874cd['id'][_0x808b('0x48')]())))[_0x808b('0x48')]();return _0x87bb09;};var _0xb33688=function(_0x5927fd,_0x690081){var _0x23176c=squel[_0x808b('0x49')]()[_0x808b('0x37')]('cm_hopper')[_0x808b('0x38')]([_0x808b('0x39'),_0x808b('0x3a'),'ContactId',_0x808b('0x27'),_0x690081,_0x808b('0x3c'),_0x808b('0x3d')],squel['select']()['field'](_0x808b('0x39'),_0x808b('0x39'))[_0x808b('0x3f')]('NOW()',_0x808b('0x3a'))[_0x808b('0x3f')]('id','ContactId')['field'](LISTID[_0x808b('0x48')](),_0x808b('0x27'))[_0x808b('0x3f')](_0x5927fd['id'][_0x808b('0x48')](),_0x690081)[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3c'))[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3d'))[_0x808b('0x46')](_0x808b('0x41'))[_0x808b('0x42')]('deletedAt\x20IS\x20NULL')[_0x808b('0x42')](_0x808b('0x43'),LISTID[_0x808b('0x48')]())[_0x808b('0x42')]('id\x20IN\x20?',squel[_0x808b('0x4a')](hopperContacts))[_0x808b('0x42')](_0x808b('0x44'))[_0x808b('0x42')](_0x808b('0x45'),squel['select']()[_0x808b('0x3f')](_0x808b('0x4b'))[_0x808b('0x46')](_0x808b('0x4c'))[_0x808b('0x42')](_0x690081+'\x20=\x20?',_0x5927fd['id'][_0x808b('0x48')]()))[_0x808b('0x42')](_0x808b('0x45'),squel['select']()[_0x808b('0x3f')](_0x808b('0x39'))[_0x808b('0x46')](_0x808b('0x47'))[_0x808b('0x42')](_0x690081+_0x808b('0x4d'),_0x5927fd['id'][_0x808b('0x48')]())))[_0x808b('0x48')]();return _0x23176c;};function _0x7a749a(_0x31621a,_0x5cf472){var _0x139202=squel[_0x808b('0x49')]()[_0x808b('0x37')](_0x808b('0x47'))[_0x808b('0x38')]([_0x808b('0x39'),'scheduledAt',_0x808b('0x3b'),'ListId',_0x5cf472,_0x808b('0x3c'),'updatedAt'],squel[_0x808b('0x3e')]()[_0x808b('0x3f')]('phone','phone')[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3a'))[_0x808b('0x3f')]('id',_0x808b('0x3b'))[_0x808b('0x3f')](LISTID['toString'](),_0x808b('0x27'))['field'](_0x31621a['id'][_0x808b('0x48')](),_0x5cf472)[_0x808b('0x3f')]('NOW()',_0x808b('0x3c'))[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3d'))[_0x808b('0x46')](_0x808b('0x41'))[_0x808b('0x42')](_0x808b('0x4e'))['where'](_0x808b('0x43'),LISTID[_0x808b('0x48')]())[_0x808b('0x42')](_0x808b('0x4f'),squel[_0x808b('0x4a')](hopperContacts))[_0x808b('0x42')](_0x808b('0x44')))[_0x808b('0x48')]();return _0x139202;}function _0x1ab81c(_0x382ee2,_0x348f36){var _0x39d501=squel[_0x808b('0x49')]()['into'](_0x808b('0x50'))[_0x808b('0x38')]([_0x808b('0x39'),'ContactId','ListId',_0x348f36,'createdAt',_0x808b('0x3d')],squel['select']()['field'](_0x808b('0x39'),_0x808b('0x39'))['field']('id',_0x808b('0x3b'))[_0x808b('0x3f')](LISTID[_0x808b('0x48')](),'ListId')[_0x808b('0x3f')](_0x382ee2['id']['toString'](),_0x348f36)[_0x808b('0x3f')]('NOW()',_0x808b('0x3c'))[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3d'))['from'](_0x808b('0x41'))['where']('deletedAt\x20IS\x20NULL')[_0x808b('0x42')]('ListId\x20=\x20?',LISTID['toString']())[_0x808b('0x42')]('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0x808b('0x44')))[_0x808b('0x48')]();return _0x39d501;}return db[_0x808b('0x51')][_0x808b('0x52')]({'where':{'type':_0x808b('0x53')},'attributes':['id',_0x808b('0x54')],'include':[{'model':db[_0x808b('0x55')],'as':'Lists','where':{'id':LISTID}}]})[_0x808b('0x2e')](function(_0x54d5f3){var _0x1909c1=[];if(_0x54d5f3){var _0x5e6124;for(var _0x475e68=0x0,_0x1033e3;_0x475e68<_0x54d5f3[_0x808b('0x29')];_0x475e68+=0x1){_0x1033e3=_0x54d5f3[_0x475e68][_0x808b('0x56')]({'plain':!![]});switch(_0x1033e3['dialCheckDuplicateType']){case _0x808b('0x57'):_0x1909c1[_0x808b('0x2f')](db[_0x808b('0x58')]['query'](_0xb33688(_0x1033e3,_0x808b('0x59')))[_0x808b('0x2e')](function(){})['catch'](_0x3bf4ab()));break;case _0x808b('0x5a'):_0x1909c1[_0x808b('0x2f')](db[_0x808b('0x58')][_0x808b('0x5b')](_0x264544(_0x1033e3,_0x808b('0x59')))[_0x808b('0x2e')](function(){})[_0x808b('0x31')](_0x3bf4ab()));break;default:_0x1909c1[_0x808b('0x2f')](db[_0x808b('0x58')][_0x808b('0x5b')](_0x7a749a(_0x1033e3,'VoiceQueueId'))[_0x808b('0x2e')](function(){})['catch'](_0x3bf4ab()));}}}return _0x1909c1;})['all']()[_0x808b('0x2e')](function(){return db[_0x808b('0x51')][_0x808b('0x52')]({'where':{'type':_0x808b('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x808b('0x5c'),'where':{'id':LISTID}}]})[_0x808b('0x2e')](function(_0x9cf4b4){var _0x54980e=[];if(_0x9cf4b4){var _0x44a82d;for(var _0x408c52=0x0,_0x37dca5;_0x408c52<_0x9cf4b4[_0x808b('0x29')];_0x408c52+=0x1){_0x37dca5=_0x9cf4b4[_0x408c52][_0x808b('0x56')]({'plain':!![]});_0x54980e[_0x808b('0x2f')](db[_0x808b('0x58')][_0x808b('0x5b')](_0x1ab81c(_0x37dca5,'VoiceQueueId'))[_0x808b('0x2e')](function(){})['catch'](_0x3bf4ab()));}}return _0x54980e;})[_0x808b('0x5d')]();})[_0x808b('0x2e')](function(){return db[_0x808b('0x5e')][_0x808b('0x52')]({'attributes':['id',_0x808b('0x54')],'include':[{'model':db[_0x808b('0x55')],'as':_0x808b('0x5f'),'where':{'id':LISTID}}]})[_0x808b('0x2e')](function(_0x453bf4){var _0x14a728=[];if(_0x453bf4){for(var _0xaa083d=0x0,_0x45694a;_0xaa083d<_0x453bf4['length'];_0xaa083d+=0x1){_0x45694a=_0x453bf4[_0xaa083d][_0x808b('0x56')]({'plain':!![]});switch(_0x45694a[_0x808b('0x54')]){case'always':_0x14a728['push'](db[_0x808b('0x58')][_0x808b('0x5b')](_0xb33688(_0x45694a,_0x808b('0x60')))[_0x808b('0x2e')](function(){})['catch'](_0x3bf4ab()));break;case _0x808b('0x5a'):_0x14a728[_0x808b('0x2f')](db[_0x808b('0x58')][_0x808b('0x5b')](_0x264544(_0x45694a,_0x808b('0x60')))[_0x808b('0x2e')](function(){})[_0x808b('0x31')](_0x3bf4ab()));break;default:_0x14a728[_0x808b('0x2f')](db['sequelize'][_0x808b('0x5b')](_0x7a749a(_0x45694a,_0x808b('0x60')))[_0x808b('0x2e')](function(){})['catch'](_0x3bf4ab()));}}}return _0x14a728;})[_0x808b('0x5d')]();})[_0x808b('0x2e')](function(){return db[_0x808b('0x5e')][_0x808b('0x52')]({'attributes':['id'],'include':[{'model':db[_0x808b('0x55')],'as':_0x808b('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x9a384e){var _0x107b2e=[];if(_0x9a384e){for(var _0x378743=0x0,_0x123312;_0x378743<_0x9a384e['length'];_0x378743+=0x1){_0x123312=_0x9a384e[_0x378743][_0x808b('0x56')]({'plain':!![]});_0x107b2e[_0x808b('0x2f')](db['sequelize'][_0x808b('0x5b')](_0x1ab81c(_0x123312,'CampaignId'))['then'](function(){})[_0x808b('0x31')](_0x3bf4ab()));}}return _0x107b2e;})[_0x808b('0x5d')]();})[_0x808b('0x31')](function(_0x6bfeda){logger[_0x808b('0x14')](_0x808b('0x61'),'generalCheckHopper',_0x6bfeda[_0x808b('0x1c')]);});}var processPromises=function(_0x4b0e1a){return BPromise['all'](promises)[_0x808b('0x2e')](function(_0x6513ca){})[_0x808b('0x31')](function(_0x228a67){logger[_0x808b('0x14')](_0x808b('0x62'),JSON[_0x808b('0x33')](_0x228a67));})[_0x808b('0x63')](function(){socket[_0x808b('0x64')](_0x808b('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4b0e1a){return _0x4b0e1a[_0x808b('0x66')]();}});};var endCsv=function(){return BPromise[_0x808b('0x67')]()[_0x808b('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x808b('0x2e')](function(){socket[_0x808b('0x64')](_0x808b('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x143cb3){logger[_0x808b('0x14')](_0x808b('0x68'),JSON[_0x808b('0x33')](_0x143cb3));}finally{process[_0x808b('0x69')](0x0);}});};process['on'](_0x808b('0x6a'),function(){logger[_0x808b('0x6b')](_0x808b('0x6c'));endCsv();});function main(){return BPromise['resolve']()[_0x808b('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x808b('0x6d')][_0x808b('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x808b('0x2e')](function(_0x265ec3){var _0x517240=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x517240,{'header':!![],'skipEmptyLines':!![],'step':function(_0x17653c,_0x3c3446){total+=0x1;var _0x23cc1f=total;promises[_0x808b('0x2f')](checkRow(_0x17653c,_0x265ec3,_0x23cc1f)['then'](function(){success+=0x1;})[_0x808b('0x31')](function(_0x60f5ba){if(_0x60f5ba[_0x808b('0x14')]){errors+=0x1;delete _0x60f5ba[_0x808b('0x14')];}else if(_0x60f5ba['duplicate']){duplicates+=0x1;delete _0x60f5ba[_0x808b('0x2b')];}rows['push'](_0x60f5ba);}));if(total%0xc8===0x0){_0x3c3446[_0x808b('0x6e')]();return processPromises(_0x3c3446);}},'complete':function(){return processPromises()[_0x808b('0x2e')](function(){logger[_0x808b('0x6b')](_0x808b('0x6f'));endCsv();});},'error':function(_0x4f53bd,_0x1f84dd){logger['info'](_0x808b('0x70'),JSON[_0x808b('0x33')](_0x4f53bd));endCsv();}});})[_0x808b('0x31')](function(_0x377e78){logger[_0x808b('0x14')](_0x808b('0x71'),JSON[_0x808b('0x33')](_0x377e78));});}main(); \ No newline at end of file +var _0x599c=['emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','fromQuery','ContactId','createdAt','updatedAt','phone','NOW()','scheduledAt','toString','field','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','select','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','VoiceQueue','BlackLists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','stringify','finally'];(function(_0x450c7f,_0x161fb5){var _0x15239e=function(_0x4cacb2){while(--_0x4cacb2){_0x450c7f['push'](_0x450c7f['shift']());}};_0x15239e(++_0x161fb5);}(_0x599c,0xee));var _0xc599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x599c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xc599('0x0'));var fs=require('fs');var squel=require(_0xc599('0x1'));var Papa=require(_0xc599('0x2'));var Redis=require(_0xc599('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0xc599('0x4'));var logger=require(_0xc599('0x5'))(_0xc599('0x6'));config[_0xc599('0x7')]=_[_0xc599('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc599('0x9'))(new Redis(config[_0xc599('0x7')]));require(_0xc599('0xa'))[_0xc599('0xb')](socket);try{if(!process['argv'][0x2]||process[_0xc599('0xc')][0x2]===_0xc599('0xd')||process[_0xc599('0xc')][0x2]===_0xc599('0xe')){throw new Error(_0xc599('0xf'));}var FILEPATH=process['argv'][0x2];if(!process[_0xc599('0xc')][0x3]||process['argv'][0x3]==='undefined'||process[_0xc599('0xc')][0x3]==='null'||!process[_0xc599('0xc')][0x4]||process['argv'][0x4]===_0xc599('0xd')||process['argv'][0x4]==='null'){throw new Error(_0xc599('0x10'));}var FIELDS=_['zipObject'](process[_0xc599('0xc')][0x3][_0xc599('0x11')](','),process[_0xc599('0xc')][0x4][_0xc599('0x11')](','));if(!process[_0xc599('0xc')][0x5]||process[_0xc599('0xc')][0x5]===_0xc599('0xd')||process[_0xc599('0xc')][0x5]===_0xc599('0xe')){throw new Error(_0xc599('0x12'));}var LISTID=process[_0xc599('0xc')][0x5];var COMPANYID=process[_0xc599('0xc')][0x6]&&process[_0xc599('0xc')][0x6]!==_0xc599('0xd')&&process[_0xc599('0xc')][0x6]!==_0xc599('0xe')?process[_0xc599('0xc')][0x6]:null;var DUPLICATES=process[_0xc599('0xc')][0x7]&&process['argv'][0x7]!==_0xc599('0xd')&&process[_0xc599('0xc')][0x7]!==_0xc599('0xe')?process[_0xc599('0xc')][0x7]:null;if(!process['argv'][0x8]||process[_0xc599('0xc')][0x8]===_0xc599('0xd')||process[_0xc599('0xc')][0x8]===_0xc599('0xe')){throw new Error(_0xc599('0x13'));}var SOCKET_TIMESTAMP=process[_0xc599('0xc')][0x8];}catch(_0x56bdeb){logger[_0xc599('0x14')](_0x56bdeb);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(_0x495d9e,_0x390109,_0x555c1f,_0x28b95b){var _0x4f0835={'message':_0x390109};_0x4f0835[_0x495d9e]=!![];if(_0x555c1f){_0x4f0835[_0xc599('0x15')]=_0x555c1f;}if(_0x28b95b){_0x4f0835['index']=_0x28b95b;}return _0x4f0835;}function isEmail(_0x427409){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))*$/[_0xc599('0x16')](_0x427409);}function checkRow(_0x25d3e6,_0x34c3ce,_0x121379){return new BPromise(function(_0x3413d5,_0x49eb1a){if(_[_0xc599('0x17')](_0x25d3e6)){return _0x49eb1a(handleCheckRowError('error',_0xc599('0x18'),null,_0x121379));}if(_0x25d3e6[_0xc599('0x19')]&&_0x25d3e6[_0xc599('0x19')][_0xc599('0x1a')]){var _0x260353=_['map'](_0x25d3e6[_0xc599('0x19')],_0xc599('0x1b'))[_0xc599('0x1c')](';');return _0x49eb1a(handleCheckRowError(_0xc599('0x14'),_0x260353,null,_0x121379));}var _0x16f7ea={};for(var _0x52742d in FIELDS){if(FIELDS['hasOwnProperty'](_0x52742d)&&FIELDS[_0x52742d]){_0x16f7ea[_0x52742d]=_0x25d3e6[_0xc599('0x1d')][0x0][FIELDS[_0x52742d]]||_0x25d3e6[_0xc599('0x1d')][0x0]['\ufeff'+FIELDS[_0x52742d]];}}if(!_0x16f7ea[_0xc599('0x1e')]){return _0x49eb1a(handleCheckRowError(_0xc599('0x14'),_0xc599('0x1f'),null,_0x121379));}if(!_0x16f7ea['phone']){return _0x49eb1a(handleCheckRowError('error',_0xc599('0x20'),null,_0x121379));}if(_0x16f7ea[_0xc599('0x21')]){var _0x17e93c=moment(_0x16f7ea[_0xc599('0x21')],_0xc599('0x22'));if(!_0x17e93c['isValid']()){return _0x49eb1a(handleCheckRowError(_0xc599('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x121379));}}if(_0x16f7ea[_0xc599('0x23')]){if(!isEmail(_0x16f7ea[_0xc599('0x23')])){return _0x49eb1a(handleCheckRowError('error',_0xc599('0x24'),null,_0x121379));}}_0x16f7ea[_0xc599('0x25')]=LISTID;_0x16f7ea[_0xc599('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x34c3ce){var _0x259f93={};for(var _0x16a46c=0x0,_0x1925af=DUPLICATES[_0xc599('0x1a')];_0x16a46c<_0x1925af;_0x16a46c+=0x1){_0x259f93[DUPLICATES[_0x16a46c]]=_0x16f7ea[DUPLICATES[_0x16a46c]];}var _0x49cdff=_['find'](_0x34c3ce,_0x259f93);if(_0x49cdff){return _0x49eb1a(handleCheckRowError(_0xc599('0x27'),_0xc599('0x28'),_0x49cdff,_0x121379));}}return db[_0xc599('0x29')]['create'](_0x16f7ea,{'raw':!![],'hooks':![],'fields':_[_0xc599('0x2a')](_0x16f7ea)})['then'](function(_0xb98caa){if(DUPLICATES&&DUPLICATES[_0xc599('0x1a')]&&_0x34c3ce){_0x34c3ce[_0xc599('0x2b')](_[_0xc599('0x2c')](_0x16f7ea,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xb98caa['id'];return _0x3413d5();})[_0xc599('0x2d')](function(_0x573eb1){return _0x49eb1a(handleCheckRowError(_0xc599('0x14'),_0xc599('0x2e')+(_0x573eb1[_0xc599('0x1b')]||JSON['stringify'](_0x573eb1)),null,_0x121379));});});}function checkHopper(){function _0x195373(){return function(_0xce5f5b){logger['error'](_0xc599('0x2f'),_0xc599('0x30'),util[_0xc599('0x31')](_0xce5f5b,{'showHidden':![],'depth':null}));};}var _0x16d7de=function(_0x3e2543,_0x10ed7){var _0x5a7bd5=squel[_0xc599('0x32')]()[_0xc599('0x33')]('cm_hopper')[_0xc599('0x34')](['phone','scheduledAt',_0xc599('0x35'),_0xc599('0x25'),_0x10ed7,_0xc599('0x36'),_0xc599('0x37')],squel['select']()['field'](_0xc599('0x38'),_0xc599('0x38'))['field'](_0xc599('0x39'),_0xc599('0x3a'))['field']('id',_0xc599('0x35'))['field'](LISTID[_0xc599('0x3b')](),'ListId')[_0xc599('0x3c')](_0x3e2543['id'][_0xc599('0x3b')](),_0x10ed7)[_0xc599('0x3c')]('NOW()',_0xc599('0x36'))[_0xc599('0x3c')]('NOW()',_0xc599('0x37'))[_0xc599('0x3d')](_0xc599('0x3e'))[_0xc599('0x3f')](_0xc599('0x40'))[_0xc599('0x3f')]('ListId\x20=\x20?',LISTID[_0xc599('0x3b')]())[_0xc599('0x3f')](_0xc599('0x41'))['where'](_0xc599('0x42'),squel['select']()['field'](_0xc599('0x38'))[_0xc599('0x3d')]('cm_hopper')[_0xc599('0x3f')](_0x10ed7+_0xc599('0x43'),_0x3e2543['id'][_0xc599('0x3b')]())))['toString']();return _0x5a7bd5;};var _0x3443ea=function(_0x314e7b,_0x20f7f7){var _0x5157dd=squel[_0xc599('0x32')]()[_0xc599('0x33')]('cm_hopper')[_0xc599('0x34')]([_0xc599('0x38'),_0xc599('0x3a'),_0xc599('0x35'),'ListId',_0x20f7f7,_0xc599('0x36'),'updatedAt'],squel[_0xc599('0x44')]()[_0xc599('0x3c')](_0xc599('0x38'),_0xc599('0x38'))[_0xc599('0x3c')]('NOW()','scheduledAt')['field']('id',_0xc599('0x35'))[_0xc599('0x3c')](LISTID['toString'](),'ListId')['field'](_0x314e7b['id'][_0xc599('0x3b')](),_0x20f7f7)[_0xc599('0x3c')](_0xc599('0x39'),_0xc599('0x36'))['field'](_0xc599('0x39'),'updatedAt')[_0xc599('0x3d')](_0xc599('0x3e'))[_0xc599('0x3f')](_0xc599('0x40'))['where'](_0xc599('0x45'),LISTID['toString']())[_0xc599('0x3f')](_0xc599('0x46'),squel[_0xc599('0x47')](hopperContacts))[_0xc599('0x3f')](_0xc599('0x41'))[_0xc599('0x3f')](_0xc599('0x42'),squel['select']()['field'](_0xc599('0x48'))['from']('cm_hopper_final')[_0xc599('0x3f')](_0x20f7f7+_0xc599('0x43'),_0x314e7b['id']['toString']()))[_0xc599('0x3f')](_0xc599('0x42'),squel[_0xc599('0x44')]()['field'](_0xc599('0x38'))[_0xc599('0x3d')](_0xc599('0x49'))[_0xc599('0x3f')](_0x20f7f7+'\x20=\x20?',_0x314e7b['id']['toString']())))[_0xc599('0x3b')]();return _0x5157dd;};function _0x530771(_0x533401,_0x14bc66){var _0x2e8b2d=squel[_0xc599('0x32')]()[_0xc599('0x33')]('cm_hopper')[_0xc599('0x34')]([_0xc599('0x38'),_0xc599('0x3a'),_0xc599('0x35'),'ListId',_0x14bc66,_0xc599('0x36'),_0xc599('0x37')],squel[_0xc599('0x44')]()[_0xc599('0x3c')](_0xc599('0x38'),_0xc599('0x38'))[_0xc599('0x3c')](_0xc599('0x39'),_0xc599('0x3a'))[_0xc599('0x3c')]('id','ContactId')[_0xc599('0x3c')](LISTID[_0xc599('0x3b')](),'ListId')[_0xc599('0x3c')](_0x533401['id']['toString'](),_0x14bc66)[_0xc599('0x3c')]('NOW()',_0xc599('0x36'))[_0xc599('0x3c')](_0xc599('0x39'),_0xc599('0x37'))[_0xc599('0x3d')]('cm_contacts')[_0xc599('0x3f')](_0xc599('0x40'))['where']('ListId\x20=\x20?',LISTID[_0xc599('0x3b')]())[_0xc599('0x3f')](_0xc599('0x46'),squel['str'](hopperContacts))[_0xc599('0x3f')](_0xc599('0x41')))[_0xc599('0x3b')]();return _0x2e8b2d;}function _0x242e3d(_0x192e51,_0x339e9f){var _0x2031ed=squel[_0xc599('0x32')]()[_0xc599('0x33')](_0xc599('0x4a'))['fromQuery'](['phone',_0xc599('0x35'),'ListId',_0x339e9f,'createdAt',_0xc599('0x37')],squel[_0xc599('0x44')]()[_0xc599('0x3c')](_0xc599('0x38'),'phone')[_0xc599('0x3c')]('id',_0xc599('0x35'))['field'](LISTID[_0xc599('0x3b')](),_0xc599('0x25'))[_0xc599('0x3c')](_0x192e51['id'][_0xc599('0x3b')](),_0x339e9f)[_0xc599('0x3c')](_0xc599('0x39'),_0xc599('0x36'))[_0xc599('0x3c')](_0xc599('0x39'),'updatedAt')[_0xc599('0x3d')]('cm_contacts')[_0xc599('0x3f')](_0xc599('0x40'))['where'](_0xc599('0x45'),LISTID[_0xc599('0x3b')]())[_0xc599('0x3f')](_0xc599('0x46'),squel['str'](hopperContacts))[_0xc599('0x3f')](_0xc599('0x41')))[_0xc599('0x3b')]();return _0x2031ed;}return db['VoiceQueue'][_0xc599('0x4b')]({'where':{'type':_0xc599('0x4c')},'attributes':['id',_0xc599('0x4d')],'include':[{'model':db[_0xc599('0x4e')],'as':_0xc599('0x4f'),'where':{'id':LISTID}}]})[_0xc599('0x50')](function(_0x599a0e){var _0x2f8087=[];if(_0x599a0e){var _0x140b56;for(var _0xb38c09=0x0,_0x43dda2;_0xb38c09<_0x599a0e[_0xc599('0x1a')];_0xb38c09+=0x1){_0x43dda2=_0x599a0e[_0xb38c09][_0xc599('0x51')]({'plain':!![]});switch(_0x43dda2[_0xc599('0x4d')]){case _0xc599('0x52'):_0x2f8087['push'](db[_0xc599('0x53')]['query'](_0x3443ea(_0x43dda2,_0xc599('0x54')))[_0xc599('0x50')](function(){})[_0xc599('0x2d')](_0x195373()));break;case _0xc599('0x55'):_0x2f8087[_0xc599('0x2b')](db[_0xc599('0x53')]['query'](_0x16d7de(_0x43dda2,_0xc599('0x54')))[_0xc599('0x50')](function(){})[_0xc599('0x2d')](_0x195373()));break;default:_0x2f8087[_0xc599('0x2b')](db[_0xc599('0x53')][_0xc599('0x56')](_0x530771(_0x43dda2,_0xc599('0x54')))['then'](function(){})[_0xc599('0x2d')](_0x195373()));}}}return _0x2f8087;})[_0xc599('0x57')]()['then'](function(){return db[_0xc599('0x58')][_0xc599('0x4b')]({'where':{'type':_0xc599('0x4c')},'attributes':['id'],'include':[{'model':db[_0xc599('0x4e')],'as':_0xc599('0x59'),'where':{'id':LISTID}}]})[_0xc599('0x50')](function(_0x4e981f){var _0x186107=[];if(_0x4e981f){var _0x45ff65;for(var _0x1a356b=0x0,_0x245058;_0x1a356b<_0x4e981f[_0xc599('0x1a')];_0x1a356b+=0x1){_0x245058=_0x4e981f[_0x1a356b][_0xc599('0x51')]({'plain':!![]});_0x186107[_0xc599('0x2b')](db[_0xc599('0x53')][_0xc599('0x56')](_0x242e3d(_0x245058,'VoiceQueueId'))[_0xc599('0x50')](function(){})['catch'](_0x195373()));}}return _0x186107;})['all']();})[_0xc599('0x50')](function(){return db['Campaign']['findAll']({'attributes':['id',_0xc599('0x4d')],'include':[{'model':db[_0xc599('0x4e')],'as':_0xc599('0x4f'),'where':{'id':LISTID}}]})[_0xc599('0x50')](function(_0x247280){var _0x4af7e8=[];if(_0x247280){for(var _0x22d02a=0x0,_0x4220c3;_0x22d02a<_0x247280[_0xc599('0x1a')];_0x22d02a+=0x1){_0x4220c3=_0x247280[_0x22d02a][_0xc599('0x51')]({'plain':!![]});switch(_0x4220c3[_0xc599('0x4d')]){case _0xc599('0x52'):_0x4af7e8[_0xc599('0x2b')](db[_0xc599('0x53')][_0xc599('0x56')](_0x3443ea(_0x4220c3,_0xc599('0x5a')))[_0xc599('0x50')](function(){})[_0xc599('0x2d')](_0x195373()));break;case'onlyIfOpen':_0x4af7e8['push'](db[_0xc599('0x53')][_0xc599('0x56')](_0x16d7de(_0x4220c3,_0xc599('0x5a')))['then'](function(){})[_0xc599('0x2d')](_0x195373()));break;default:_0x4af7e8['push'](db[_0xc599('0x53')][_0xc599('0x56')](_0x530771(_0x4220c3,'CampaignId'))[_0xc599('0x50')](function(){})[_0xc599('0x2d')](_0x195373()));}}}return _0x4af7e8;})[_0xc599('0x57')]();})[_0xc599('0x50')](function(){return db[_0xc599('0x5b')][_0xc599('0x4b')]({'attributes':['id'],'include':[{'model':db[_0xc599('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x33cb2f){var _0x39aadf=[];if(_0x33cb2f){for(var _0x48899a=0x0,_0x1c0da6;_0x48899a<_0x33cb2f[_0xc599('0x1a')];_0x48899a+=0x1){_0x1c0da6=_0x33cb2f[_0x48899a]['get']({'plain':!![]});_0x39aadf[_0xc599('0x2b')](db[_0xc599('0x53')][_0xc599('0x56')](_0x242e3d(_0x1c0da6,_0xc599('0x5a')))['then'](function(){})[_0xc599('0x2d')](_0x195373()));}}return _0x39aadf;})['all']();})[_0xc599('0x2d')](function(_0x2be75d){logger[_0xc599('0x14')](_0xc599('0x5c'),'generalCheckHopper',_0x2be75d[_0xc599('0x1b')]);});}var processPromises=function(_0xac170f){return BPromise[_0xc599('0x57')](promises)['then'](function(_0x2debb8){})[_0xc599('0x2d')](function(_0x5a1d39){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0xc599('0x5d')](_0x5a1d39));})[_0xc599('0x5e')](function(){socket[_0xc599('0x5f')](_0xc599('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xac170f){return _0xac170f[_0xc599('0x61')]();}});};var endCsv=function(){return BPromise[_0xc599('0x62')]()[_0xc599('0x50')](function(){if(hopperContacts){return checkHopper();}})[_0xc599('0x50')](function(){socket['emit'](_0xc599('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc599('0x63')](FILEPATH);}catch(_0xe8f18f){logger['error'](_0xc599('0x64'),JSON[_0xc599('0x5d')](_0xe8f18f));}finally{process[_0xc599('0x65')](0x0);}});};process['on'](_0xc599('0x66'),function(){logger['info'](_0xc599('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0xc599('0x50')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xc599('0x29')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x52fa1b){var _0xddcdde=fs[_0xc599('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc599('0x69')](_0xddcdde,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1c5651,_0x63b98b){total+=0x1;var _0x4289e8=total;promises[_0xc599('0x2b')](checkRow(_0x1c5651,_0x52fa1b,_0x4289e8)[_0xc599('0x50')](function(){success+=0x1;})['catch'](function(_0xbf34ed){if(_0xbf34ed[_0xc599('0x14')]){errors+=0x1;delete _0xbf34ed[_0xc599('0x14')];}else if(_0xbf34ed[_0xc599('0x27')]){duplicates+=0x1;delete _0xbf34ed[_0xc599('0x27')];}rows[_0xc599('0x2b')](_0xbf34ed);}));if(total%0xc8===0x0){_0x63b98b[_0xc599('0x6a')]();return processPromises(_0x63b98b);}},'complete':function(){return processPromises()[_0xc599('0x50')](function(){logger[_0xc599('0x6b')](_0xc599('0x6c'));endCsv();});},'error':function(_0x589c68,_0x303b36){logger[_0xc599('0x6b')](_0xc599('0x6d'),JSON[_0xc599('0x5d')](_0x589c68));endCsv();}});})[_0xc599('0x2d')](function(_0x34d2b3){logger['error'](_0xc599('0x6e'),JSON['stringify'](_0x34d2b3));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 2823c1d..825892b 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 _0x285d=['voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','dialTimezone','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','includes','name','_description','parse','createReadStream','data','rows','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','find','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns','affectedRows','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','papaparse','util','bluebird','moment','squel','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','then','AdditionalPhones','split','length','push','all','isNil','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','from','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.ListId','cm_contacts.updatedAt','cm_hopper_black','cm_contacts.ListId\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','createdAt','ListId\x20=\x20?','\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','CmHopperId','OrderBy','cm_contacts','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId'];(function(_0x1fbfd5,_0x4018cc){var _0xf4a988=function(_0x2e885c){while(--_0x2e885c){_0x1fbfd5['push'](_0x1fbfd5['shift']());}};_0xf4a988(++_0x4018cc);}(_0x285d,0x1b7));var _0xd285=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x285d[_0x5c351c];return _0x26f3b3;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xd285('0x0'));var util=require(_0xd285('0x1'));var BPromise=require(_0xd285('0x2'));var moment=require(_0xd285('0x3'));var squel=require(_0xd285('0x4'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xd285('0x5'));var shared=require(_0xd285('0x6'));var logger=require(_0xd285('0x7'))(_0xd285('0x8'));config[_0xd285('0x9')]=_['defaults'](config[_0xd285('0x9')],{'host':_0xd285('0xa'),'port':0x18eb});var socket=require(_0xd285('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xd285('0xc')](_0xd285('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xd285('0xc')](_0xd285('0xd'));function isEmail(_0x22e395){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'](_0x22e395);}function selectNotIn(_0x36e769,_0x30edc9,_0x3ede5a,_0x4d2982,_0x4da73e){return squel[_0xd285('0xe')]()[_0xd285('0xf')](_0xd285('0x10'))['from'](_0x4d2982)['join'](_0x30edc9,null,_0x30edc9+_0xd285('0x11')+_0x4d2982+'.'+_0x3ede5a)[_0xd285('0x12')](_0x4d2982+'.'+_0x3ede5a+'\x20=\x20'+_0x36e769+'.'+_0x3ede5a)[_0xd285('0x12')](_0x30edc9+_0xd285('0x13')+_0x4da73e[_0xd285('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3df6c9,_0x4f2ad0){promisesAdditionalPhones=[];return db[_0xd285('0x15')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xd285('0x16')](function(_0x3c90c2){if(_0x3c90c2!==null){var _0x5a46a8=[];for(var _0x4e0dbf=0x0;_0x4e0dbf<_0x3c90c2['length'];_0x4e0dbf++){var _0x14f5b6=_0x3c90c2[_0x4e0dbf];_0x5a46a8['push'](insertAdditionalPhones(_0x14f5b6));}}Promise['all'](_0x5a46a8)['then'](function(){_0x3df6c9({'val':0x1});});});});}function insertAdditionalPhones(_0x4c642b){return new Promise(function(_0x26b22f,_0x62da3b){var _0x21d5df=_0x4c642b[_0xd285('0x17')];var _0x179ecc=_0x21d5df[_0xd285('0x18')](';');var _0x1132d5=[];orderBy=0x0;for(var _0x5624f7=0x0;_0x5624f7<_0x179ecc[_0xd285('0x19')];_0x5624f7++){_0x1132d5[_0xd285('0x1a')](splitAdditionalPhone(_0x4c642b['id'],_0x179ecc[_0x5624f7]));}Promise[_0xd285('0x1b')](_0x1132d5)['then'](function(){_0x26b22f({'val':_0x179ecc[_0xd285('0x19')]});});});}function splitAdditionalPhone(_0x3297e4,_0x49b476){return new Promise(function(_0x577d0b,_0x51ef30){var _0x6ba1a3=_0x49b476[_0xd285('0x18')](':');var _0x30abd6=_0x6ba1a3[0x0];var _0x5ba7c8=_0x6ba1a3[0x1];if(!_[_0xd285('0x1c')](_0x5ba7c8)){var _0x5c4006=_0x5ba7c8['split']('|');var _0xe3dabc=[];for(var _0x27f54f=0x0;_0x27f54f<_0x5c4006[_0xd285('0x19')];_0x27f54f++){if(_0x5c4006[_0x27f54f]!==''){var _0x19b85a=_[_0xd285('0x1d')](promisesAdditionalPhones,{'contactId':_0x3297e4,'phone':_0x5c4006[_0x27f54f]});if(_0x19b85a[_0xd285('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xd285('0x1a')]({'contactId':_0x3297e4,'contactTypeId':_0x30abd6,'phone':_0x5c4006[_0x27f54f],'orderBy':orderBy});}}}_0x577d0b({'ok':0x1});}else _0x577d0b({'res':0x0});});}function createAdditionalPhone(_0x498b46,_0x2acc31,_0x12e968,_0x29fda2){var _0x451eb6='';var _0x1c4120='';var _0x3c148e=_0x12e968[_0xd285('0x18')]('§');_0x451eb6=_0x3c148e[0x0];if(_0x3c148e[_0xd285('0x19')]==0x2)_0x1c4120=_0x3c148e[0x1];return new Promise(function(_0x344a36,_0x258b13){return db[_0xd285('0x1e')]['findOne']({'where':{'CmContactId':_0x498b46,'item':_0x451eb6}})[_0xd285('0x16')](function(_0x524a3c){if(_0x524a3c){return db[_0xd285('0x1e')][_0xd285('0x1f')]({'ItemTypeId':_0x2acc31,'description':_0x1c4120,'OrderBy':_0x29fda2},{'where':{'CmContactId':_0x498b46,'item':_0x451eb6}})[_0xd285('0x16')](function(_0x5882e0){_0x344a36({'res':_0xd285('0x20')});});}else{return db['CmContactHasItem'][_0xd285('0x21')]({'CmContactId':_0x498b46,'item':_0x451eb6,'description':_0x1c4120,'ItemTypeId':_0x2acc31,'OrderBy':_0x29fda2,'ItemClass':_0xd285('0x22')})['then'](function(_0x14741a){_0x344a36({'res':_0xd285('0x23')});});}});});}function insertCmHopper(_0xa61df6,_0xfe3a3f,_0x3be22f,_0x33c4b7,_0x1346d6){var _0x225a09=[_0xd285('0x24'),_0xd285('0x25'),_0xd285('0x26'),'cm_contacts.ListId',_0xfe3a3f+'.'+_0x33c4b7,_0xd285('0x27'),'cm_contacts.updatedAt',_0xd285('0x28'),_0xd285('0x29'),'\x22'+_0x1346d6+'\x22'];return squel[_0xd285('0x2a')]()[_0xd285('0x2b')](_0xd285('0x2c'))[_0xd285('0x2d')]([_0xd285('0x10'),'scheduledat',_0xd285('0x2e'),_0xd285('0x2f'),_0x33c4b7,'createdAt',_0xd285('0x30'),_0xd285('0x31'),_0xd285('0x32'),_0xd285('0x33')],squel[_0xd285('0xe')]()[_0xd285('0x34')](_0x225a09)[_0xd285('0x35')](_0xfe3a3f)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xfe3a3f+_0xd285('0x36'))['join'](_0x3be22f,null,_0x3be22f+_0xd285('0x11')+_0xfe3a3f+'.'+_0x33c4b7)[_0xd285('0x12')](_0xfe3a3f+_0xd285('0x37'),_0xa61df6)[_0xd285('0x12')](_0xd285('0x38'),NOW)[_0xd285('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xfe3a3f,_0x3be22f,_0x33c4b7,'cm_hopper',[_0xd285('0x39'),_0xd285('0x3a')]))[_0xd285('0x12')](_0xd285('0x3b'),selectNotIn(_0xfe3a3f,_0x3be22f,_0x33c4b7,_0xd285('0x2c'),['\x22always\x22'])))[_0xd285('0x3c')]();}function insertCmHopperBlack(_0x12d45f,_0x3afe9f,_0x4babfc,_0x2dd434){var _0x89b96b=[_0xd285('0x24'),'cm_contacts.id',_0xd285('0x3d'),_0x3afe9f+'.'+_0x2dd434,_0xd285('0x27'),_0xd285('0x3e')];return squel['insert']()[_0xd285('0x2b')](_0xd285('0x3f'))['fromQuery'](['phone',_0xd285('0x2e'),_0xd285('0x2f'),_0x2dd434,'createdAt',_0xd285('0x30')],squel['select']()[_0xd285('0x34')](_0x89b96b)['from'](_0x3afe9f)[_0xd285('0x14')]('cm_contacts',null,_0xd285('0x40')+_0x3afe9f+_0xd285('0x36'))['join'](_0x4babfc,null,_0x4babfc+'.id\x20=\x20'+_0x3afe9f+'.'+_0x2dd434)[_0xd285('0x12')](_0x3afe9f+_0xd285('0x37'),_0x12d45f)[_0xd285('0x12')](_0xd285('0x38'),NOW)[_0xd285('0x12')](_0xd285('0x3b'),squel[_0xd285('0xe')]()[_0xd285('0xf')]('phone')['from'](_0xd285('0x3f'))[_0xd285('0x12')]('ListId\x20=\x20?',_0x12d45f)[_0xd285('0x12')](_0x2dd434+'\x20=\x20'+_0x3afe9f+'.'+_0x2dd434)))[_0xd285('0x3c')]();}function insertTzCmHopper(_0x55f399,_0x860d46,_0x3d010c,_0x390ef9,_0x1c9d7e,_0x20291b){var _0x26761b=[_0xd285('0x24'),_0xd285('0x41')+_0x20291b+_0xd285('0x42'),_0xd285('0x26'),'cm_contacts.ListId',_0x860d46+'.'+_0x390ef9,_0xd285('0x27'),_0xd285('0x3e'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x1c9d7e+'\x22'];var _0x3d6389=squel[_0xd285('0x2a')]()[_0xd285('0x2b')](_0xd285('0x2c'))[_0xd285('0x2d')]([_0xd285('0x10'),_0xd285('0x43'),'ContactId',_0xd285('0x2f'),_0x390ef9,'createdAt',_0xd285('0x30'),_0xd285('0x31'),_0xd285('0x32'),_0xd285('0x33')],squel[_0xd285('0xe')]()[_0xd285('0x34')](_0x26761b)[_0xd285('0x35')](_0x860d46)[_0xd285('0x14')]('cm_contacts',null,_0xd285('0x40')+_0x860d46+_0xd285('0x36'))['join'](_0x3d010c,null,_0x3d010c+_0xd285('0x11')+_0x860d46+'.'+_0x390ef9)[_0xd285('0x14')](_0x20291b,null,_0x20291b+_0xd285('0x11')+_0x860d46+'.'+_0x390ef9)[_0xd285('0x12')](_0x860d46+_0xd285('0x37'),_0x55f399)[_0xd285('0x12')](_0xd285('0x38'),NOW)['where'](_0xd285('0x3b'),selectNotIn(_0x860d46,_0x3d010c,_0x390ef9,_0xd285('0x2c'),[_0xd285('0x39'),'\x22onlyIfOpen\x22']))[_0xd285('0x12')](_0xd285('0x3b'),selectNotIn(_0x860d46,_0x3d010c,_0x390ef9,_0xd285('0x2c'),[_0xd285('0x39')])))['toString']();return _0x3d6389;}function insertTzCmHopperBlack(_0xfef1ef,_0x2ff288,_0x2d7c60,_0x821e90){var _0x295fcb=[_0xd285('0x24'),_0xd285('0x26'),_0xd285('0x3d'),_0x2ff288+'.'+_0x821e90,_0xd285('0x27'),_0xd285('0x3e')];return squel[_0xd285('0x2a')]()[_0xd285('0x2b')](_0xd285('0x3f'))['fromQuery']([_0xd285('0x10'),_0xd285('0x2e'),_0xd285('0x2f'),_0x821e90,_0xd285('0x44'),_0xd285('0x30')],squel[_0xd285('0xe')]()[_0xd285('0x34')](_0x295fcb)['from'](_0x2ff288)['join']('cm_contacts',null,_0xd285('0x40')+_0x2ff288+_0xd285('0x36'))[_0xd285('0x14')](_0x2d7c60,null,_0x2d7c60+_0xd285('0x11')+_0x2ff288+'.'+_0x821e90)[_0xd285('0x12')](_0x2ff288+_0xd285('0x37'),_0xfef1ef)[_0xd285('0x12')](_0xd285('0x38'),NOW)[_0xd285('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xd285('0xe')]()[_0xd285('0xf')]('phone')['from']('cm_hopper_black')[_0xd285('0x12')](_0xd285('0x45'),_0xfef1ef)[_0xd285('0x12')](_0x821e90+_0xd285('0x46')+_0x2ff288+'.'+_0x821e90)))['toString']();}function insertCmHopperAdditionalPhones(_0x373662){var _0x5c9b66=[_0xd285('0x47'),_0xd285('0x48'),'cm_contact_has_items.OrderBy',_0xd285('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0xd285('0x2a')]()['into']('cm_hopper_additional_phones')[_0xd285('0x2d')]([_0xd285('0x4a'),_0xd285('0x10'),_0xd285('0x4b'),'createdAt',_0xd285('0x30')],squel[_0xd285('0xe')]()[_0xd285('0x34')](_0x5c9b66)[_0xd285('0x35')]('cm_hopper')['join'](_0xd285('0x4c'),null,_0xd285('0x4d'))['join'](_0xd285('0x4e'),null,_0xd285('0x4f'))[_0xd285('0x12')]('cm_hopper.ListId\x20=\x20?',_0x373662)[_0xd285('0x12')](_0xd285('0x38'),NOW))[_0xd285('0x3c')]();}function insertCmContact(_0x15c8c6,_0x543c27,_0x10931c,_0x3ab8b7){var _0x3756cc=_[_0xd285('0x50')](_[_0xd285('0x51')](_0x3ab8b7),['ListId',_0xd285('0x52'),_0xd285('0x44'),_0xd285('0x30'),_0xd285('0x53')]);return squel[_0xd285('0x2a')]()[_0xd285('0x2b')](_0xd285('0x4c'))[_0xd285('0x2d')](_0x3756cc,squel['select']()['fields'](_0x3756cc)[_0xd285('0x35')](_0x543c27)[_0xd285('0x12')]('('+_0x10931c[_0xd285('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0xd285('0xe')]()['fields'](_0x10931c)['from'](_0xd285('0x4c'))[_0xd285('0x12')](_0xd285('0x45'),_0x15c8c6)['where'](_0xd285('0x54')))[_0xd285('0x12')](_0xd285('0x55'),squel[_0xd285('0xe')]()[_0xd285('0xf')](_0xd285('0x56'),_0xd285('0x57'))['from'](_0x543c27)[_0xd285('0x58')](_0x10931c[_0xd285('0x14')](','))))[_0xd285('0x3c')]();}function handleStop(){logger[_0xd285('0x59')](_0xd285('0x5a'));stopped=!![];}function handleUncaughtException(_0x14b52d){logger[_0xd285('0x5b')](_0x14b52d[_0xd285('0x5c')]);process[_0xd285('0x5d')](0x1);}function handleError(_0x4520a2,_0x200dd1){stats[_0xd285('0x5e')][_0xd285('0x1a')]({'name':_0x200dd1[_0xd285('0x5f')],'message':_0x200dd1[_0xd285('0x5c')],'row':_0x4520a2});}function handleQuery(_0x25aae0){logger[_0xd285('0x59')](_0x25aae0);return db[_0xd285('0x60')][_0xd285('0x61')](_0x25aae0)[_0xd285('0x62')](function(_0x316019){results[_0xd285('0x1a')](_0x316019);})[_0xd285('0x63')](function(_0x511b1a){logger[_0xd285('0x5b')](_0x511b1a['message']);});}function updateTzCampaigns(_0x4f3396){return new Promise(function(_0x5198c6,_0xa36aee){var _0x138cf8=squel['select']()[_0xd285('0x34')]([_0xd285('0x64'),_0xd285('0x65')])['from']('campaigns')[_0xd285('0x14')](_0xd285('0x66'),null,_0xd285('0x67'))[_0xd285('0x12')](_0xd285('0x68')+_0x4f3396);db[_0xd285('0x60')][_0xd285('0x61')](_0x138cf8[_0xd285('0x3c')]())[_0xd285('0x62')](function(_0xc8dfb8){var _0x5b35a3=[];for(var _0x1e7e17=0x0;_0x1e7e17<_0xc8dfb8[_0xd285('0x19')];_0x1e7e17++){_0x5b35a3[_0xd285('0x1a')](getTimezoneData(_0xc8dfb8[_0x1e7e17],tmp_campaigns));}BPromise[_0xd285('0x1b')](_0x5b35a3)[_0xd285('0x16')](function(){_0x5198c6({'val':0x1});});})['catch'](function(_0x11d922){logger[_0xd285('0x5b')](_0x11d922['message']);_0x5198c6({'val':0x0});});});}function updateTzVoiceQueues(_0x55ad17){return new Promise(function(_0x1e48a4,_0xacf21f){var _0x1953e9=squel[_0xd285('0xe')]()[_0xd285('0x34')]([_0xd285('0x69'),_0xd285('0x6a')])['from'](_0xd285('0x6b'))[_0xd285('0x14')](_0xd285('0x6c'),null,_0xd285('0x6d'))[_0xd285('0x12')](_0xd285('0x6e')+_0x55ad17);db[_0xd285('0x60')]['query'](_0x1953e9[_0xd285('0x3c')]())['spread'](function(_0x573ec3){var _0x52e32d=[];for(var _0x378239=0x0;_0x378239<_0x573ec3[_0xd285('0x19')];_0x378239++){_0x52e32d[_0xd285('0x1a')](getTimezoneData(_0x573ec3[_0x378239],tmp_voice_queues));}BPromise[_0xd285('0x1b')](_0x52e32d)[_0xd285('0x16')](function(){_0x1e48a4({'val':0x1});});})['catch'](function(_0x118a99){logger[_0xd285('0x5b')](_0x118a99[_0xd285('0x5c')]);_0x1e48a4({'val':0x0});});});}function getTimezoneData(_0x463593,_0x4bb1a6){return new Promise(function(_0x2cbd87,_0x5ee33c){var _0x21930c=shared[_0xd285('0x6f')];var _0x477bec=_0x21930c[_0x463593['dialTimezone']];if(_[_0xd285('0x1c')](_0x477bec)){_0x2cbd87({'ret':0x1});}else{var _0xc1bc48=_0x477bec[_0xd285('0x70')];var _0x46b188=squel[_0xd285('0x2a')]()[_0xd285('0x2b')](_0x4bb1a6)[_0xd285('0x71')]('id',_0x463593['id'])['set']('offset',_0xc1bc48)[_0xd285('0x71')](_0xd285('0x72'),_0x463593[_0xd285('0x72')])[_0xd285('0x3c')]();return db[_0xd285('0x60')][_0xd285('0x61')](_0x46b188)[_0xd285('0x62')](function(_0x2e056b){_0x2cbd87({'ret':0x1});})[_0xd285('0x63')](function(_0x35ea86){logger[_0xd285('0x5b')](_0x35ea86[_0xd285('0x5c')]);_0x5ee33c({'ret':0x1});});}});}function handleTZQuery(_0x5d960a){logger['info'](_0x5d960a);return db[_0xd285('0x60')][_0xd285('0x61')](_0x5d960a)[_0xd285('0x62')](function(_0x2286f7){})[_0xd285('0x63')](function(_0x8d2b4a){logger[_0xd285('0x5b')](_0x8d2b4a[_0xd285('0x5c')]);});}function main(_0x525fa6,_0xbe900a,_0x289c0d,_0x4709d7){logger[_0xd285('0x59')](_0xd285('0x73'),_0x525fa6,JSON[_0xd285('0x74')](_0xbe900a));process[_0xd285('0x75')](_0xd285('0x76'));var _0x27777e=_0xbe900a[_0xd285('0x77')];var _0x9ead39=_[_0xd285('0x78')](_0x27777e);var _0x14e80c=_0xbe900a[_0xd285('0x79')];var _0x551c8b=path['join'](config[_0xd285('0x7a')],_0xd285('0x7b'),_0x14e80c+'.csv');hasTZ=_[_0xd285('0x51')](_0x27777e)[_0xd285('0x7c')]('dialTimezone');var _0x1eef75=_['keys'](_0x27777e)[_0xd285('0x14')]();logger[_0xd285('0x59')]('header',_0x1eef75);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id','name']})[_0xd285('0x16')](function(_0x1283db){for(var _0x39068d=0x0;_0x39068d<_0x1283db[_0xd285('0x19')];_0x39068d++){if(_0x1283db[_0x39068d][_0xd285('0x7d')]in _0x27777e){contactItemTypes[_0xd285('0x1a')](_0x1283db[_0x39068d]);delete _0x9ead39[_0x1283db[_0x39068d][_0xd285('0x7d')]];hasAdditionalPhones=!![];}for(var _0x174a4e in _0x27777e){if(_0x1283db[_0x39068d][_0xd285('0x7d')]+_0xd285('0x7e')===_0x174a4e){phoneDescriptions[_0xd285('0x1a')]({'itemTypeId':_0x1283db[_0x39068d]['id'],'description':_0x174a4e});delete _0x9ead39[_0x174a4e];}}}if(hasAdditionalPhones)_0x9ead39[_0xd285('0x17')]='';var _0x32f30a=_[_0xd285('0x51')](_0x9ead39)[_0xd285('0x14')]();logger['info']('header',_0x32f30a);fs['writeFileSync'](_0x551c8b,_0x32f30a+'\x0a');Papa[_0xd285('0x7f')](fs[_0xd285('0x80')](_0x525fa6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5ddcdd,_0x384e2e){try{for(var _0x3fb7a7=0x0,_0x1d5539=[];_0x3fb7a7<_0x5ddcdd[_0xd285('0x81')][_0xd285('0x19')];_0x3fb7a7++){stats[_0xd285('0x82')]+=0x1;if(_0x5ddcdd[_0xd285('0x5e')][_0x3fb7a7]){handleError(_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7],_0x5ddcdd[_0xd285('0x5e')][_0x3fb7a7]);}else{var _0x30f101=[];var _0x37ae80=[];var _0x160f7d={};for(var _0x376c9a in _0x27777e){let _0x557cb4=contactItemTypes['find'](_0x532ceb=>_0x532ceb[_0xd285('0x7d')]===_0x376c9a);let _0x55a8f8=contactItemTypes['find'](_0x12791b=>_0x12791b[_0xd285('0x7d')]+_0xd285('0x7e')===_0x376c9a);if(_[_0xd285('0x1c')](_0x557cb4)&&_[_0xd285('0x1c')](_0x55a8f8)){if(_0x27777e['hasOwnProperty'](_0x376c9a)){if(_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7][_0x27777e[_0x376c9a]]){var _0x2ef8b7=_[_0xd285('0x83')](_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7][_0x27777e[_0x376c9a]][_0xd285('0x84')](/"/g,'\x27'));switch(_0x376c9a){case _0xd285('0x43'):var _0x5a1dbd=moment(_0x2ef8b7,_0xd285('0xd'),!![]);if(_0x5a1dbd[_0xd285('0x85')]()){_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2ef8b7+'\x22');}else{_0x30f101[_0xd285('0x1a')](_0xd285('0x86'));}break;case _0xd285('0x31'):var _0x4278f3=parseInt(_0x2ef8b7);_0x2ef8b7=_[_0xd285('0x87')](_0x4278f3)||_0x4278f3<0x0||_0x4278f3>0x4?_0x4709d7?0x3:0x2:_0x4278f3;_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2ef8b7+'\x22');break;case _0xd285('0x32'):var _0x4285f0=parseInt(_0x2ef8b7);if(_[_0xd285('0x88')](_0x4285f0)&&_[_0xd285('0x7c')](_0x289c0d,_0x4285f0)){_0x1d5539[_0xd285('0x1a')]('\x22'+_0x4285f0+'\x22');}else{_0x30f101['push'](_0xd285('0x89'));}break;case _0xd285('0x8a'):if(isEmail(_0x2ef8b7)){_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2ef8b7+'\x22');}else{_0x30f101[_0xd285('0x1a')]('email\x20wrong\x20format');}break;case _0xd285('0x8b'):var _0x4f8dc5=moment(_0x2ef8b7,'YYYY-MM-DD',!![]);if(_0x4f8dc5[_0xd285('0x85')]()){_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2ef8b7+'\x22');}else{_0x30f101[_0xd285('0x1a')](_0xd285('0x8c'));}break;case _0xd285('0x72'):var _0x416e33=shared[_0xd285('0x6f')];var _0x43878f=_0x416e33[_0x2ef8b7];if(!_[_0xd285('0x1c')](_0x43878f)){var _0x2b0872=_0x43878f[_0xd285('0x70')];_0x1d5539['push']('\x22'+_0x2ef8b7+'\x22');_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2b0872+'\x22');}break;default:_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2ef8b7+'\x22');}}else{switch(_0x376c9a){case'firstName':case _0xd285('0x10'):_0x30f101['push'](_0x376c9a+_0xd285('0x8d'));break;default:_0x1d5539[_0xd285('0x1a')]('\x22\x22');}}}}else{var _0x267ff3='';if(!_[_0xd285('0x1c')](_0x557cb4)){if(!_0x160f7d['hasOwnProperty'](_0x557cb4['id'])){if(!_[_0xd285('0x1c')](_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7][_0x27777e[_0x376c9a]])){var _0x2ef8b7=_[_0xd285('0x83')](_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7][_0x27777e[_0x376c9a]][_0xd285('0x84')](/"/g,'\x27'));var _0x2a9b39=phoneDescriptions[_0xd285('0x8e')](_0x19394e=>_0x19394e['itemTypeId']===_0x557cb4['id']);if(!_[_0xd285('0x1c')](_0x2a9b39)){var _0x5bdab4=_['trim'](_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7][_0x27777e[_0x2a9b39[_0xd285('0x8f')]]][_0xd285('0x84')](/"/g,'\x27'));if(!_['isNil'](_0x5bdab4))_0x2ef8b7=_0x2ef8b7+'§'+_0x5bdab4;}if(_0x267ff3=='')_0x267ff3=_0x2ef8b7;else _0x267ff3+='|'+_0x2ef8b7;}_0x37ae80['push'](_0x557cb4['id']+':'+_0x267ff3);_0x160f7d[_0x557cb4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d5539[_0xd285('0x1a')]('\x22'+_0x37ae80[_0xd285('0x14')](';')+'\x22');}if(_0x30f101[_0xd285('0x19')]){handleError(_0x5ddcdd['data'][_0x3fb7a7],{'code':_0xd285('0x90'),'message':_0x30f101[_0xd285('0x14')]()});}else{fs[_0xd285('0x91')](_0x551c8b,_0x1d5539[_0xd285('0x14')]()+'\x0a');}_0x1d5539=[];}if(!(stats[_0xd285('0x82')]%0xc8)){socket[_0xd285('0x92')](_0xd285('0x93')+_0x14e80c,stats);stats['errors']=[];}}if(stopped){logger['info'](_0xd285('0x94'));_0x384e2e[_0xd285('0x95')]();}}catch(_0x4612d5){handleError(_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7],{'code':_0xd285('0x96'),'message':_0x4612d5['message']});logger[_0xd285('0x5b')](_0xd285('0x97'),_0x4612d5['message']);}},'complete':function(){try{var _0x253a7c=[];var _0x14aa54=[];var _0x56fdff=_0xd285('0x4c');if(_0xbe900a[_0xd285('0x98')]&&_0xbe900a[_0xd285('0x98')][_0xd285('0x19')]){_0x56fdff=_0xd285('0x99')+_0x14e80c;_0x253a7c[_0xd285('0x1a')]('CREATE\x20TABLE\x20'+_0x56fdff+_0xd285('0x9a'));}tmp_campaigns=_0xd285('0x9b')+_0x14e80c;tmp_voice_queues=_0xd285('0x9c')+_0x14e80c;_0x14aa54['push'](_0xd285('0x9d')+tmp_campaigns+_0xd285('0x9e'));_0x14aa54['push'](_0xd285('0x9d')+tmp_voice_queues+_0xd285('0x9e'));BPromise[_0xd285('0x9f')](_0x14aa54,handleTZQuery)[_0xd285('0x16')](function(_0x497e12){updateTzCampaigns(_0xbe900a[_0xd285('0x2f')])[_0xd285('0x16')](function(_0xcdb8e8){updateTzVoiceQueues(_0xbe900a[_0xd285('0x2f')])['then'](function(_0x1d8f86){if(hasTZ)_0x32f30a=_0x32f30a[_0xd285('0x84')]('dialTimezone',_0xd285('0xa0'));var _0xaf4642=util[_0xd285('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x551c8b,_0x56fdff,_0x32f30a,_0xbe900a[_0xd285('0x2f')],_0xbe900a[_0xd285('0x52')]||null,NOW,NOW);if(_[_0xd285('0x1c')](_0x27777e['scheduledat'])){_0xaf4642+=_0xd285('0xa1');}_0x253a7c['push'](_0xaf4642);if(_0xbe900a[_0xd285('0x98')]&&_0xbe900a[_0xd285('0x98')]['length']){_0x253a7c[_0xd285('0x1a')](insertCmContact(_0xbe900a['ListId'],_0x56fdff,_0xbe900a[_0xd285('0x98')],_0x27777e));_0x253a7c['push'](_0xd285('0xa2')+_0x56fdff+';');}BPromise[_0xd285('0x9f')](_0x253a7c,handleQuery)[_0xd285('0x16')](function(_0x1d6c31){BPromise[_0xd285('0x1b')]([handleAdditionalPhones()])[_0xd285('0x16')](function(){_0x253a7c=[];for(var _0x44a7bd=0x0;_0x44a7bd\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','CmContact','findAll','AdditionalPhones','then','push','all','split','length','isNil','CmContactHasItem','update','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','phone','ContactId','ListId','createdAt','updatedAt','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.createdAt','cm_contacts.ListId\x20=\x20','cm_hopper_black'];(function(_0x4f34c9,_0x33bdb1){var _0x4e27f0=function(_0x1a4df2){while(--_0x1a4df2){_0x4f34c9['push'](_0x4f34c9['shift']());}};_0x4e27f0(++_0x33bdb1);}(_0xee45,0x126));var _0x5ee4=function(_0x487ace,_0x1966df){_0x487ace=_0x487ace-0x0;var _0xe3725a=_0xee45[_0x487ace];return _0xe3725a;};'use strict';var fs=require('fs');var path=require(_0x5ee4('0x0'));var _=require(_0x5ee4('0x1'));var Papa=require(_0x5ee4('0x2'));var util=require(_0x5ee4('0x3'));var BPromise=require(_0x5ee4('0x4'));var moment=require(_0x5ee4('0x5'));var squel=require(_0x5ee4('0x6'));var Redis=require(_0x5ee4('0x7'));var db=require(_0x5ee4('0x8'))['db'];var config=require(_0x5ee4('0x9'));var shared=require(_0x5ee4('0xa'));var logger=require('../../../config/logger')('import');config[_0x5ee4('0xb')]=_[_0x5ee4('0xc')](config[_0x5ee4('0xb')],{'host':_0x5ee4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x5ee4('0xe')](_0x5ee4('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x5ee4('0xe')](_0x5ee4('0xf'));function isEmail(_0x3455f5){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))*$/[_0x5ee4('0x10')](_0x3455f5);}function selectNotIn(_0x1e4718,_0x1f79e2,_0x589e43,_0x486dcc,_0x344438){return squel[_0x5ee4('0x11')]()[_0x5ee4('0x12')]('phone')[_0x5ee4('0x13')](_0x486dcc)[_0x5ee4('0x14')](_0x1f79e2,null,_0x1f79e2+_0x5ee4('0x15')+_0x486dcc+'.'+_0x589e43)[_0x5ee4('0x16')](_0x486dcc+'.'+_0x589e43+'\x20=\x20'+_0x1e4718+'.'+_0x589e43)[_0x5ee4('0x16')](_0x1f79e2+'.dialCheckDuplicateType\x20IN\x20('+_0x344438['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4e1776,_0xbaaa86){promisesAdditionalPhones=[];return db[_0x5ee4('0x17')][_0x5ee4('0x18')]({'raw':!![],'attributes':['id',_0x5ee4('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5ee4('0x1a')](function(_0x581577){if(_0x581577!==null){var _0x11fd9f=[];for(var _0x3a851c=0x0;_0x3a851c<_0x581577['length'];_0x3a851c++){var _0x584e54=_0x581577[_0x3a851c];_0x11fd9f[_0x5ee4('0x1b')](insertAdditionalPhones(_0x584e54));}}Promise[_0x5ee4('0x1c')](_0x11fd9f)['then'](function(){_0x4e1776({'val':0x1});});});});}function insertAdditionalPhones(_0x295bc1){return new Promise(function(_0x45dc63,_0x3a1c7a){var _0x521214=_0x295bc1[_0x5ee4('0x19')];var _0x3ae6f5=_0x521214[_0x5ee4('0x1d')](';');var _0x2c02bc=[];orderBy=0x0;for(var _0x365018=0x0;_0x365018<_0x3ae6f5[_0x5ee4('0x1e')];_0x365018++){_0x2c02bc[_0x5ee4('0x1b')](splitAdditionalPhone(_0x295bc1['id'],_0x3ae6f5[_0x365018]));}Promise['all'](_0x2c02bc)[_0x5ee4('0x1a')](function(){_0x45dc63({'val':_0x3ae6f5[_0x5ee4('0x1e')]});});});}function splitAdditionalPhone(_0x1b926c,_0x3832dd){return new Promise(function(_0x1f90c6,_0x296a6f){var _0x57718d=_0x3832dd[_0x5ee4('0x1d')](':');var _0x5a597e=_0x57718d[0x0];var _0x30e70e=_0x57718d[0x1];if(!_[_0x5ee4('0x1f')](_0x30e70e)){var _0x1eb5b7=_0x30e70e[_0x5ee4('0x1d')]('|');var _0x3ca56b=[];for(var _0x104217=0x0;_0x104217<_0x1eb5b7['length'];_0x104217++){if(_0x1eb5b7[_0x104217]!==''){var _0x4d1464=_['filter'](promisesAdditionalPhones,{'contactId':_0x1b926c,'phone':_0x1eb5b7[_0x104217]});if(_0x4d1464[_0x5ee4('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x5ee4('0x1b')]({'contactId':_0x1b926c,'contactTypeId':_0x5a597e,'phone':_0x1eb5b7[_0x104217],'orderBy':orderBy});}}}_0x1f90c6({'ok':0x1});}else _0x1f90c6({'res':0x0});});}function createAdditionalPhone(_0x403f6d,_0x491885,_0x491311,_0x4d9218){var _0x40b02b='';var _0x62b002='';var _0x45d02c=_0x491311[_0x5ee4('0x1d')]('§');_0x40b02b=_0x45d02c[0x0];if(_0x45d02c['length']==0x2)_0x62b002=_0x45d02c[0x1];return new Promise(function(_0x3cc764,_0x2b62fa){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x403f6d,'item':_0x40b02b}})[_0x5ee4('0x1a')](function(_0x295b89){if(_0x295b89){return db[_0x5ee4('0x20')][_0x5ee4('0x21')]({'ItemTypeId':_0x491885,'description':_0x62b002,'OrderBy':_0x4d9218},{'where':{'CmContactId':_0x403f6d,'item':_0x40b02b}})[_0x5ee4('0x1a')](function(_0x459f4a){_0x3cc764({'res':_0x5ee4('0x22')});});}else{return db[_0x5ee4('0x20')][_0x5ee4('0x23')]({'CmContactId':_0x403f6d,'item':_0x40b02b,'description':_0x62b002,'ItemTypeId':_0x491885,'OrderBy':_0x4d9218,'ItemClass':_0x5ee4('0x24')})[_0x5ee4('0x1a')](function(_0x4cc8c7){_0x3cc764({'res':'inserted'});});}});});}function insertCmHopper(_0x38d55c,_0x2f8fca,_0x4a8758,_0x5728e4,_0x67f58c){var _0x381bac=[_0x5ee4('0x25'),_0x5ee4('0x26'),_0x5ee4('0x27'),_0x5ee4('0x28'),_0x2f8fca+'.'+_0x5728e4,'cm_contacts.createdAt',_0x5ee4('0x29'),_0x5ee4('0x2a'),_0x5ee4('0x2b'),'\x22'+_0x67f58c+'\x22'];return squel[_0x5ee4('0x2c')]()[_0x5ee4('0x2d')]('cm_hopper')[_0x5ee4('0x2e')]([_0x5ee4('0x2f'),'scheduledat',_0x5ee4('0x30'),_0x5ee4('0x31'),_0x5728e4,_0x5ee4('0x32'),_0x5ee4('0x33'),'priority','UserId',_0x5ee4('0x34')],squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')](_0x381bac)[_0x5ee4('0x13')](_0x2f8fca)[_0x5ee4('0x14')](_0x5ee4('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x2f8fca+_0x5ee4('0x37'))[_0x5ee4('0x14')](_0x4a8758,null,_0x4a8758+_0x5ee4('0x15')+_0x2f8fca+'.'+_0x5728e4)[_0x5ee4('0x16')](_0x2f8fca+_0x5ee4('0x38'),_0x38d55c)[_0x5ee4('0x16')](_0x5ee4('0x39'),NOW)[_0x5ee4('0x16')](_0x5ee4('0x3a'),selectNotIn(_0x2f8fca,_0x4a8758,_0x5728e4,_0x5ee4('0x3b'),['\x22always\x22',_0x5ee4('0x3c')]))['where'](_0x5ee4('0x3a'),selectNotIn(_0x2f8fca,_0x4a8758,_0x5728e4,_0x5ee4('0x3b'),[_0x5ee4('0x3d')])))[_0x5ee4('0x3e')]();}function insertCmHopperBlack(_0x3ab828,_0x2bf29f,_0x80773f,_0x5456ce){var _0x882a55=[_0x5ee4('0x25'),_0x5ee4('0x27'),_0x5ee4('0x28'),_0x2bf29f+'.'+_0x5456ce,_0x5ee4('0x3f'),_0x5ee4('0x29')];return squel['insert']()[_0x5ee4('0x2d')]('cm_hopper_black')['fromQuery']([_0x5ee4('0x2f'),_0x5ee4('0x30'),'ListId',_0x5456ce,_0x5ee4('0x32'),'updatedAt'],squel['select']()['fields'](_0x882a55)[_0x5ee4('0x13')](_0x2bf29f)[_0x5ee4('0x14')](_0x5ee4('0x36'),null,_0x5ee4('0x40')+_0x2bf29f+_0x5ee4('0x37'))[_0x5ee4('0x14')](_0x80773f,null,_0x80773f+'.id\x20=\x20'+_0x2bf29f+'.'+_0x5456ce)[_0x5ee4('0x16')](_0x2bf29f+_0x5ee4('0x38'),_0x3ab828)[_0x5ee4('0x16')](_0x5ee4('0x39'),NOW)['where'](_0x5ee4('0x3a'),squel['select']()[_0x5ee4('0x12')]('phone')['from'](_0x5ee4('0x41'))['where'](_0x5ee4('0x42'),_0x3ab828)[_0x5ee4('0x16')](_0x5456ce+'\x20=\x20'+_0x2bf29f+'.'+_0x5456ce)))[_0x5ee4('0x3e')]();}function insertTzCmHopper(_0x2571dd,_0x3f2d9c,_0x56a9c2,_0x238131,_0x53c52f,_0x451ccf){var _0x152efb=[_0x5ee4('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x451ccf+_0x5ee4('0x43'),_0x5ee4('0x27'),'cm_contacts.ListId',_0x3f2d9c+'.'+_0x238131,_0x5ee4('0x3f'),_0x5ee4('0x29'),'cm_contacts.priority',_0x5ee4('0x2b'),'\x22'+_0x53c52f+'\x22'];var _0x528cee=squel[_0x5ee4('0x2c')]()[_0x5ee4('0x2d')]('cm_hopper')[_0x5ee4('0x2e')]([_0x5ee4('0x2f'),_0x5ee4('0x44'),'ContactId',_0x5ee4('0x31'),_0x238131,_0x5ee4('0x32'),_0x5ee4('0x33'),'priority',_0x5ee4('0x45'),_0x5ee4('0x34')],squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')](_0x152efb)[_0x5ee4('0x13')](_0x3f2d9c)[_0x5ee4('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x3f2d9c+'.CmListId')[_0x5ee4('0x14')](_0x56a9c2,null,_0x56a9c2+'.id\x20=\x20'+_0x3f2d9c+'.'+_0x238131)['join'](_0x451ccf,null,_0x451ccf+_0x5ee4('0x15')+_0x3f2d9c+'.'+_0x238131)['where'](_0x3f2d9c+'.CmListId\x20=\x20?',_0x2571dd)['where'](_0x5ee4('0x39'),NOW)[_0x5ee4('0x16')](_0x5ee4('0x3a'),selectNotIn(_0x3f2d9c,_0x56a9c2,_0x238131,_0x5ee4('0x3b'),['\x22always\x22',_0x5ee4('0x3c')]))['where'](_0x5ee4('0x3a'),selectNotIn(_0x3f2d9c,_0x56a9c2,_0x238131,_0x5ee4('0x3b'),[_0x5ee4('0x3d')])))[_0x5ee4('0x3e')]();return _0x528cee;}function insertTzCmHopperBlack(_0x22b8d9,_0x585c75,_0x209c4f,_0x475094){var _0x11050c=[_0x5ee4('0x25'),_0x5ee4('0x27'),_0x5ee4('0x28'),_0x585c75+'.'+_0x475094,_0x5ee4('0x3f'),_0x5ee4('0x29')];return squel[_0x5ee4('0x2c')]()[_0x5ee4('0x2d')](_0x5ee4('0x41'))[_0x5ee4('0x2e')]([_0x5ee4('0x2f'),_0x5ee4('0x30'),_0x5ee4('0x31'),_0x475094,'createdAt',_0x5ee4('0x33')],squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')](_0x11050c)['from'](_0x585c75)[_0x5ee4('0x14')](_0x5ee4('0x36'),null,_0x5ee4('0x40')+_0x585c75+_0x5ee4('0x37'))[_0x5ee4('0x14')](_0x209c4f,null,_0x209c4f+_0x5ee4('0x15')+_0x585c75+'.'+_0x475094)[_0x5ee4('0x16')](_0x585c75+_0x5ee4('0x38'),_0x22b8d9)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5ee4('0x16')](_0x5ee4('0x3a'),squel[_0x5ee4('0x11')]()[_0x5ee4('0x12')](_0x5ee4('0x2f'))[_0x5ee4('0x13')](_0x5ee4('0x41'))['where']('ListId\x20=\x20?',_0x22b8d9)['where'](_0x475094+'\x20=\x20'+_0x585c75+'.'+_0x475094)))[_0x5ee4('0x3e')]();}function insertCmHopperAdditionalPhones(_0x981520){var _0x306b68=[_0x5ee4('0x46'),'cm_contact_has_items.item',_0x5ee4('0x47'),_0x5ee4('0x48'),_0x5ee4('0x49')];return squel[_0x5ee4('0x2c')]()[_0x5ee4('0x2d')](_0x5ee4('0x4a'))[_0x5ee4('0x2e')]([_0x5ee4('0x4b'),_0x5ee4('0x2f'),'OrderBy',_0x5ee4('0x32'),_0x5ee4('0x33')],squel['select']()[_0x5ee4('0x35')](_0x306b68)[_0x5ee4('0x13')](_0x5ee4('0x3b'))[_0x5ee4('0x14')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x5ee4('0x14')](_0x5ee4('0x4c'),null,_0x5ee4('0x4d'))['where']('cm_hopper.ListId\x20=\x20?',_0x981520)[_0x5ee4('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0xa30236,_0x4b7ad6,_0x501718,_0xaee4c3){var _0x42fc2e=_['concat'](_[_0x5ee4('0x4e')](_0xaee4c3),[_0x5ee4('0x31'),_0x5ee4('0x4f'),_0x5ee4('0x32'),_0x5ee4('0x33'),_0x5ee4('0x50')]);return squel[_0x5ee4('0x2c')]()[_0x5ee4('0x2d')](_0x5ee4('0x36'))[_0x5ee4('0x2e')](_0x42fc2e,squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')](_0x42fc2e)[_0x5ee4('0x13')](_0x4b7ad6)[_0x5ee4('0x16')]('('+_0x501718['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x5ee4('0x11')]()['fields'](_0x501718)[_0x5ee4('0x13')](_0x5ee4('0x36'))['where']('ListId\x20=\x20?',_0xa30236)[_0x5ee4('0x16')](_0x5ee4('0x51')))[_0x5ee4('0x16')]('id\x20IN\x20?',squel[_0x5ee4('0x11')]()[_0x5ee4('0x12')]('MIN(id)',_0x5ee4('0x52'))[_0x5ee4('0x13')](_0x4b7ad6)['group'](_0x501718[_0x5ee4('0x14')](','))))[_0x5ee4('0x3e')]();}function handleStop(){logger[_0x5ee4('0x53')](_0x5ee4('0x54'));stopped=!![];}function handleUncaughtException(_0x5e413c){logger[_0x5ee4('0x55')](_0x5e413c[_0x5ee4('0x56')]);process['exit'](0x1);}function handleError(_0x18fc35,_0x5df6af){stats[_0x5ee4('0x57')]['push']({'name':_0x5df6af[_0x5ee4('0x58')],'message':_0x5df6af['message'],'row':_0x18fc35});}function handleQuery(_0x17a1b5){logger[_0x5ee4('0x53')](_0x17a1b5);return db[_0x5ee4('0x59')][_0x5ee4('0x5a')](_0x17a1b5)['spread'](function(_0xe8924){results[_0x5ee4('0x1b')](_0xe8924);})[_0x5ee4('0x5b')](function(_0x5e8914){logger[_0x5ee4('0x55')](_0x5e8914['message']);});}function updateTzCampaigns(_0x1294ed){return new Promise(function(_0x1ea77f,_0x424fa9){var _0x2efbc8=squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')]([_0x5ee4('0x5c'),_0x5ee4('0x5d')])[_0x5ee4('0x13')](_0x5ee4('0x5e'))['join'](_0x5ee4('0x5f'),null,_0x5ee4('0x60'))[_0x5ee4('0x16')]('campaigns_has_cm_lists.CmListId='+_0x1294ed);db['sequelize']['query'](_0x2efbc8[_0x5ee4('0x3e')]())[_0x5ee4('0x61')](function(_0x2c451b){var _0x3bdb56=[];for(var _0x5dfde3=0x0;_0x5dfde3<_0x2c451b[_0x5ee4('0x1e')];_0x5dfde3++){_0x3bdb56[_0x5ee4('0x1b')](getTimezoneData(_0x2c451b[_0x5dfde3],tmp_campaigns));}BPromise[_0x5ee4('0x1c')](_0x3bdb56)['then'](function(){_0x1ea77f({'val':0x1});});})[_0x5ee4('0x5b')](function(_0x5ab1d6){logger['error'](_0x5ab1d6['message']);_0x1ea77f({'val':0x0});});});}function updateTzVoiceQueues(_0x5e7891){return new Promise(function(_0x34018b,_0x5abeb2){var _0x8d9b92=squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')]([_0x5ee4('0x62'),_0x5ee4('0x63')])[_0x5ee4('0x13')]('voice_queues')['join']('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x5ee4('0x16')]('voice_queues_has_cm_lists.CmListId='+_0x5e7891);db[_0x5ee4('0x59')][_0x5ee4('0x5a')](_0x8d9b92[_0x5ee4('0x3e')]())[_0x5ee4('0x61')](function(_0x1e6a9d){var _0x581787=[];for(var _0xe19f52=0x0;_0xe19f52<_0x1e6a9d[_0x5ee4('0x1e')];_0xe19f52++){_0x581787['push'](getTimezoneData(_0x1e6a9d[_0xe19f52],tmp_voice_queues));}BPromise[_0x5ee4('0x1c')](_0x581787)['then'](function(){_0x34018b({'val':0x1});});})[_0x5ee4('0x5b')](function(_0x27b164){logger[_0x5ee4('0x55')](_0x27b164[_0x5ee4('0x56')]);_0x34018b({'val':0x0});});});}function getTimezoneData(_0x37ecfc,_0x1739e0){return new Promise(function(_0x3f6e8f,_0x1bc7ca){var _0x13ab5c=shared[_0x5ee4('0x64')];var _0x91a619=_0x13ab5c[_0x37ecfc['dialTimezone']];if(_[_0x5ee4('0x1f')](_0x91a619)){_0x3f6e8f({'ret':0x1});}else{var _0x2c568e=_0x91a619[_0x5ee4('0x65')];var _0x5c5944=squel[_0x5ee4('0x2c')]()['into'](_0x1739e0)[_0x5ee4('0x66')]('id',_0x37ecfc['id'])['set'](_0x5ee4('0x67'),_0x2c568e)[_0x5ee4('0x66')](_0x5ee4('0x68'),_0x37ecfc[_0x5ee4('0x68')])[_0x5ee4('0x3e')]();return db[_0x5ee4('0x59')][_0x5ee4('0x5a')](_0x5c5944)['spread'](function(_0x14a7dd){_0x3f6e8f({'ret':0x1});})[_0x5ee4('0x5b')](function(_0x2994c4){logger[_0x5ee4('0x55')](_0x2994c4[_0x5ee4('0x56')]);_0x1bc7ca({'ret':0x1});});}});}function handleTZQuery(_0x4715e2){logger[_0x5ee4('0x53')](_0x4715e2);return db[_0x5ee4('0x59')]['query'](_0x4715e2)[_0x5ee4('0x61')](function(_0x28d945){})['catch'](function(_0x1ce312){logger[_0x5ee4('0x55')](_0x1ce312[_0x5ee4('0x56')]);});}function main(_0x178653,_0xb07cef,_0x15536d,_0x2bd583){logger['info']('main',_0x178653,JSON[_0x5ee4('0x69')](_0xb07cef));process['send'](_0x5ee4('0x6a'));var _0x3875b4=_0xb07cef[_0x5ee4('0x6b')];var _0x6552b4=_['clone'](_0x3875b4);var _0x3ac3b3=_0xb07cef[_0x5ee4('0x6c')];var _0x37194a=path['join'](config['root'],_0x5ee4('0x6d'),_0x3ac3b3+_0x5ee4('0x6e'));hasTZ=_['keys'](_0x3875b4)[_0x5ee4('0x6f')](_0x5ee4('0x68'));var _0x54e4ee=_[_0x5ee4('0x4e')](_0x3875b4)['join']();logger['info'](_0x5ee4('0x70'),_0x54e4ee);db[_0x5ee4('0x71')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x5ee4('0x1a')](function(_0xb5bc67){for(var _0x27e618=0x0;_0x27e618<_0xb5bc67['length'];_0x27e618++){if(_0xb5bc67[_0x27e618]['name']in _0x3875b4){contactItemTypes[_0x5ee4('0x1b')](_0xb5bc67[_0x27e618]);delete _0x6552b4[_0xb5bc67[_0x27e618]['name']];hasAdditionalPhones=!![];}for(var _0x4f33ed in _0x3875b4){if(_0xb5bc67[_0x27e618]['name']+_0x5ee4('0x72')===_0x4f33ed){phoneDescriptions['push']({'itemTypeId':_0xb5bc67[_0x27e618]['id'],'description':_0x4f33ed});delete _0x6552b4[_0x4f33ed];}}}if(hasAdditionalPhones)_0x6552b4[_0x5ee4('0x19')]='';var _0x5c1bdb=_[_0x5ee4('0x4e')](_0x6552b4)[_0x5ee4('0x14')]();logger[_0x5ee4('0x53')](_0x5ee4('0x70'),_0x5c1bdb);fs[_0x5ee4('0x73')](_0x37194a,_0x5c1bdb+'\x0a');Papa[_0x5ee4('0x74')](fs[_0x5ee4('0x75')](_0x178653),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d654a,_0x51ff20){try{for(var _0x300375=0x0,_0x5c5696=[];_0x300375<_0x5d654a['data'][_0x5ee4('0x1e')];_0x300375++){stats[_0x5ee4('0x76')]+=0x1;if(_0x5d654a[_0x5ee4('0x57')][_0x300375]){handleError(_0x5d654a[_0x5ee4('0x77')][_0x300375],_0x5d654a[_0x5ee4('0x57')][_0x300375]);}else{var _0x3f7f23=[];var _0x190ff8=[];var _0x1be7f9={};for(var _0x384edc in _0x3875b4){let _0x1e0d13=contactItemTypes[_0x5ee4('0x78')](_0x48c8ba=>_0x48c8ba[_0x5ee4('0x79')]===_0x384edc);let _0x58416b=contactItemTypes[_0x5ee4('0x78')](_0x3d85ec=>_0x3d85ec['name']+_0x5ee4('0x72')===_0x384edc);if(_['isNil'](_0x1e0d13)&&_[_0x5ee4('0x1f')](_0x58416b)){if(_0x3875b4[_0x5ee4('0x7a')](_0x384edc)){if(_0x5d654a['data'][_0x300375][_0x3875b4[_0x384edc]]){var _0x3ec9eb=_[_0x5ee4('0x7b')](_0x5d654a[_0x5ee4('0x77')][_0x300375][_0x3875b4[_0x384edc]][_0x5ee4('0x7c')](/"/g,'\x27'));switch(_0x384edc){case _0x5ee4('0x44'):var _0x30ad4b=moment(_0x3ec9eb,_0x5ee4('0xf'),!![]);if(_0x30ad4b[_0x5ee4('0x7d')]()){_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x3ec9eb+'\x22');}else{_0x3f7f23[_0x5ee4('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x31cb66=parseInt(_0x3ec9eb);_0x3ec9eb=_[_0x5ee4('0x7e')](_0x31cb66)||_0x31cb66<0x0||_0x31cb66>0x4?_0x2bd583?0x3:0x2:_0x31cb66;_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x3ec9eb+'\x22');break;case'UserId':var _0x2c790f=parseInt(_0x3ec9eb);if(_[_0x5ee4('0x7f')](_0x2c790f)&&_['includes'](_0x15536d,_0x2c790f)){_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x2c790f+'\x22');}else{_0x3f7f23[_0x5ee4('0x1b')]('agent\x20not\x20exists');}break;case _0x5ee4('0x80'):if(isEmail(_0x3ec9eb)){_0x5c5696['push']('\x22'+_0x3ec9eb+'\x22');}else{_0x3f7f23['push'](_0x5ee4('0x81'));}break;case'dateOfBirth':var _0xdb68c=moment(_0x3ec9eb,_0x5ee4('0x82'),!![]);if(_0xdb68c[_0x5ee4('0x7d')]()){_0x5c5696['push']('\x22'+_0x3ec9eb+'\x22');}else{_0x3f7f23['push'](_0x5ee4('0x83'));}break;case _0x5ee4('0x68'):var _0x2a4d94=shared[_0x5ee4('0x64')];var _0x1e20f2=_0x2a4d94[_0x3ec9eb];if(!_[_0x5ee4('0x1f')](_0x1e20f2)){var _0x3d1f12=_0x1e20f2[_0x5ee4('0x65')];_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x3ec9eb+'\x22');_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x3d1f12+'\x22');}break;default:_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x3ec9eb+'\x22');}}else{switch(_0x384edc){case _0x5ee4('0x84'):case _0x5ee4('0x2f'):_0x3f7f23[_0x5ee4('0x1b')](_0x384edc+_0x5ee4('0x85'));break;default:_0x5c5696[_0x5ee4('0x1b')]('\x22\x22');}}}}else{var _0x37db36='';if(!_[_0x5ee4('0x1f')](_0x1e0d13)){if(!_0x1be7f9['hasOwnProperty'](_0x1e0d13['id'])){if(!_[_0x5ee4('0x1f')](_0x5d654a[_0x5ee4('0x77')][_0x300375][_0x3875b4[_0x384edc]])){var _0x3ec9eb=_[_0x5ee4('0x7b')](_0x5d654a[_0x5ee4('0x77')][_0x300375][_0x3875b4[_0x384edc]]['replace'](/"/g,'\x27'));var _0x220e6d=phoneDescriptions[_0x5ee4('0x78')](_0x14b5dd=>_0x14b5dd[_0x5ee4('0x86')]===_0x1e0d13['id']);if(!_[_0x5ee4('0x1f')](_0x220e6d)){var _0xa3537d=_[_0x5ee4('0x7b')](_0x5d654a[_0x5ee4('0x77')][_0x300375][_0x3875b4[_0x220e6d[_0x5ee4('0x87')]]][_0x5ee4('0x7c')](/"/g,'\x27'));if(!_[_0x5ee4('0x1f')](_0xa3537d))_0x3ec9eb=_0x3ec9eb+'§'+_0xa3537d;}if(_0x37db36=='')_0x37db36=_0x3ec9eb;else _0x37db36+='|'+_0x3ec9eb;}_0x190ff8[_0x5ee4('0x1b')](_0x1e0d13['id']+':'+_0x37db36);_0x1be7f9[_0x1e0d13['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x190ff8[_0x5ee4('0x14')](';')+'\x22');}if(_0x3f7f23['length']){handleError(_0x5d654a[_0x5ee4('0x77')][_0x300375],{'code':_0x5ee4('0x88'),'message':_0x3f7f23[_0x5ee4('0x14')]()});}else{fs[_0x5ee4('0x89')](_0x37194a,_0x5c5696['join']()+'\x0a');}_0x5c5696=[];}if(!(stats[_0x5ee4('0x76')]%0xc8)){socket[_0x5ee4('0x8a')](_0x5ee4('0x8b')+_0x3ac3b3,stats);stats['errors']=[];}}if(stopped){logger[_0x5ee4('0x53')](_0x5ee4('0x8c'));_0x51ff20[_0x5ee4('0x8d')]();}}catch(_0x167833){handleError(_0x5d654a[_0x5ee4('0x77')][_0x300375],{'code':_0x5ee4('0x8e'),'message':_0x167833[_0x5ee4('0x56')]});logger[_0x5ee4('0x55')](_0x5ee4('0x8f'),_0x167833[_0x5ee4('0x56')]);}},'complete':function(){try{var _0x1ec7f2=[];var _0x3a7de7=[];var _0x52aadd=_0x5ee4('0x36');if(_0xb07cef['duplicates']&&_0xb07cef['duplicates']['length']){_0x52aadd=_0x5ee4('0x90')+_0x3ac3b3;_0x1ec7f2[_0x5ee4('0x1b')]('CREATE\x20TABLE\x20'+_0x52aadd+_0x5ee4('0x91'));}tmp_campaigns=_0x5ee4('0x92')+_0x3ac3b3;tmp_voice_queues=_0x5ee4('0x93')+_0x3ac3b3;_0x3a7de7[_0x5ee4('0x1b')](_0x5ee4('0x94')+tmp_campaigns+_0x5ee4('0x95'));_0x3a7de7[_0x5ee4('0x1b')](_0x5ee4('0x94')+tmp_voice_queues+_0x5ee4('0x95'));BPromise['each'](_0x3a7de7,handleTZQuery)[_0x5ee4('0x1a')](function(_0x17537d){updateTzCampaigns(_0xb07cef['ListId'])[_0x5ee4('0x1a')](function(_0x4e673e){updateTzVoiceQueues(_0xb07cef[_0x5ee4('0x31')])[_0x5ee4('0x1a')](function(_0x1b6a9b){if(hasTZ)_0x5c1bdb=_0x5c1bdb['replace']('dialTimezone',_0x5ee4('0x96'));var _0x477589=util[_0x5ee4('0xe')](_0x5ee4('0x97'),_0x37194a,_0x52aadd,_0x5c1bdb,_0xb07cef[_0x5ee4('0x31')],_0xb07cef[_0x5ee4('0x4f')]||null,NOW,NOW);if(_[_0x5ee4('0x1f')](_0x3875b4['scheduledat'])){_0x477589+=_0x5ee4('0x98');}_0x1ec7f2['push'](_0x477589);if(_0xb07cef[_0x5ee4('0x99')]&&_0xb07cef[_0x5ee4('0x99')][_0x5ee4('0x1e')]){_0x1ec7f2[_0x5ee4('0x1b')](insertCmContact(_0xb07cef['ListId'],_0x52aadd,_0xb07cef['duplicates'],_0x3875b4));_0x1ec7f2[_0x5ee4('0x1b')](_0x5ee4('0x9a')+_0x52aadd+';');}BPromise[_0x5ee4('0x9b')](_0x1ec7f2,handleQuery)[_0x5ee4('0x1a')](function(_0x30449c){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x1ec7f2=[];for(var _0x5867d8=0x0;_0x5867d8\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format'];(function(_0x51ccab,_0x2cfc15){var _0x2af691=function(_0x1cf9de){while(--_0x1cf9de){_0x51ccab['push'](_0x51ccab['shift']());}};_0x2af691(++_0x2cfc15);}(_0xdf5d,0x126));var _0xddf5=function(_0x3a146c,_0x49d661){_0x3a146c=_0x3a146c-0x0;var _0x53d06f=_0xdf5d[_0x3a146c];return _0x53d06f;};'use strict';var fs=require('fs');var path=require(_0xddf5('0x0'));var _=require(_0xddf5('0x1'));var Papa=require(_0xddf5('0x2'));var util=require(_0xddf5('0x3'));var BPromise=require(_0xddf5('0x4'));var moment=require(_0xddf5('0x5'));var squel=require(_0xddf5('0x6'));var Redis=require(_0xddf5('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0xddf5('0x8'));var logger=require(_0xddf5('0x9'))(_0xddf5('0xa'));config[_0xddf5('0xb')]=_[_0xddf5('0xc')](config[_0xddf5('0xb')],{'host':_0xddf5('0xd'),'port':0x18eb});var socket=require(_0xddf5('0xe'))(new Redis(config[_0xddf5('0xb')]));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()[_0xddf5('0xf')](_0xddf5('0x10'));var tempTableName=_0xddf5('0x11')+moment()[_0xddf5('0xf')](_0xddf5('0x12'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x10191b){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))*$/[_0xddf5('0x13')](_0x10191b);}function selectNotIn(_0x5a4f45,_0x161973,_0x3d3fc3,_0x72f146,_0x10245f){return squel[_0xddf5('0x14')]()[_0xddf5('0x15')](_0xddf5('0x16'))[_0xddf5('0x17')](_0x72f146)['join'](_0x161973,null,_0x161973+'.id\x20=\x20'+_0x72f146+'.'+_0x3d3fc3)[_0xddf5('0x18')](_0x72f146+'.'+_0x3d3fc3+_0xddf5('0x19')+_0x5a4f45+'.'+_0x3d3fc3)[_0xddf5('0x18')](_0x161973+_0xddf5('0x1a')+_0x10245f[_0xddf5('0x1b')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x149fef,_0x2ecea5){promisesAdditionalPhones=[];promisesContact=[];return db[_0xddf5('0x1c')]['query'](_0xddf5('0x1d')+tempTableName)[_0xddf5('0x1e')](function(_0x3dd408){if(_0x3dd408!==null){var _0x1c0c30=[];for(var _0x19a039=0x0;_0x19a039<_0x3dd408['length'];_0x19a039++){var _0x3a9263=_0x3dd408[_0x19a039];if(!_['isNil'](_0x3a9263[_0xddf5('0x16')])){if(!_['isNil'](_0x3a9263[_0xddf5('0x1f')]))_0x1c0c30[_0xddf5('0x20')](insertAdditionalPhones(_0x3a9263));promisesContact[_0xddf5('0x20')]({'contact':_0x3a9263});}}}Promise[_0xddf5('0x21')](_0x1c0c30)['then'](function(){_0x149fef({'val':0x1});});})['catch'](function(_0x1b085b){logger[_0xddf5('0x22')](_0x1b085b[_0xddf5('0x23')]);});});}function insertAdditionalPhones(_0x1abfb2){return new Promise(function(_0x5e5537,_0x52ecdb){var _0x3f3194=_0x1abfb2[_0xddf5('0x1f')];if(_[_0xddf5('0x24')](_0x3f3194))_0x52ecdb({'val':0x0});else{var _0x497805=_0x3f3194[_0xddf5('0x25')](';');var _0x39212c=[];orderBy=0x0;for(var _0x21c68b=0x0;_0x21c68b<_0x497805[_0xddf5('0x26')];_0x21c68b++){_0x39212c['push'](splitAdditionalPhone(_0x1abfb2['id'],_0x497805[_0x21c68b]));}Promise[_0xddf5('0x21')](_0x39212c)[_0xddf5('0x27')](function(){_0x5e5537({'val':_0x497805['length']});});}});}function splitAdditionalPhone(_0x300923,_0x4267aa){return new Promise(function(_0x34539e,_0x12ece7){var _0x49c381=_0x4267aa[_0xddf5('0x25')](':');var _0xc75eb8=_0x49c381[0x0];var _0x256ff0=_0x49c381[0x1];if(_0x256ff0!==''){var _0x1eca6a=_0x256ff0[_0xddf5('0x25')]('|');var _0x4caa12=[];for(var _0x2caa8f=0x0;_0x2caa8f<_0x1eca6a[_0xddf5('0x26')];_0x2caa8f++){if(_0x1eca6a[_0x2caa8f]!==''){var _0x5c0451=_['filter'](promisesAdditionalPhones,{'contactId':_0x300923,'phone':_0x1eca6a[_0x2caa8f]});if(_0x5c0451[_0xddf5('0x26')]==0x0){orderBy++;promisesAdditionalPhones[_0xddf5('0x20')]({'contactId':_0x300923,'contactTypeId':_0xc75eb8,'phone':_0x1eca6a[_0x2caa8f],'orderBy':orderBy});}}}_0x34539e({'ok':0x1});}else _0x34539e({'res':0x0});});}function createAdditionalPhone(_0x1d493e,_0x174cd7,_0x3be6f4,_0x1a476d){var _0x5a3548='';var _0x26f43c='';var _0x228073=_0x3be6f4['split']('§');_0x5a3548=_0x228073[0x0];if(_0x228073[_0xddf5('0x26')]==0x2)_0x26f43c=_0x228073[0x1];return new Promise(function(_0x3ac1e8,_0x281307){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x1d493e,'item':_0x5a3548}})['then'](function(_0xdc764b){if(_0xdc764b){return db[_0xddf5('0x28')][_0xddf5('0x29')]({'ItemTypeId':_0x174cd7,'description':_0x26f43c,'OrderBy':_0x1a476d},{'where':{'CmContactId':_0x1d493e,'item':_0x5a3548}})['then'](function(_0x3d1c7a){_0x3ac1e8({'res':'updated'});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x1d493e,'item':_0x5a3548,'ItemTypeId':_0x174cd7,'description':_0x26f43c,'OrderBy':_0x1a476d,'ItemClass':_0xddf5('0x2a')})[_0xddf5('0x27')](function(_0x2a4b2e){_0x3ac1e8({'res':_0xddf5('0x2b')});});}});});}function updateContact(_0x11cee5){return new Promise(function(_0x49e5a9,_0x1eca4e){var _0x53e916=_0x11cee5['id'];delete _0x11cee5['id'];return db[_0xddf5('0x2c')][_0xddf5('0x29')](_0x11cee5,{'where':{'id':_0x53e916}})['then'](function(_0xf355f4){updatedRows+=0x1;return db[_0xddf5('0x2d')][_0xddf5('0x29')]({'phone':_0x11cee5[_0xddf5('0x16')]},{'where':{'ContactId':_0x53e916}})[_0xddf5('0x27')](function(_0x4e0b6f){_0x49e5a9({'ret':'OK'});});});});}function insertCmHopper(_0x873d16,_0x5478cf,_0x2874f8,_0x45a373,_0x50240c){var _0x1be090=['cm_contacts.phone',_0xddf5('0x2e'),'cm_contacts.id','cm_contacts.ListId',_0x5478cf+'.'+_0x45a373,_0xddf5('0x2f'),'cm_contacts.updatedAt',_0xddf5('0x30'),_0xddf5('0x31'),'\x22'+_0x50240c+'\x22'];return squel[_0xddf5('0x32')]()[_0xddf5('0x33')](_0xddf5('0x34'))[_0xddf5('0x35')]([_0xddf5('0x16'),_0xddf5('0x36'),_0xddf5('0x37'),_0xddf5('0x38'),_0x45a373,_0xddf5('0x39'),_0xddf5('0x3a'),_0xddf5('0x3b'),_0xddf5('0x3c'),_0xddf5('0x3d')],squel[_0xddf5('0x14')]()[_0xddf5('0x3e')](_0x1be090)[_0xddf5('0x17')](_0x5478cf)['join'](_0xddf5('0x3f'),null,_0xddf5('0x40')+_0x5478cf+_0xddf5('0x41'))[_0xddf5('0x1b')](_0x2874f8,null,_0x2874f8+_0xddf5('0x42')+_0x5478cf+'.'+_0x45a373)['where'](_0x5478cf+'.CmListId\x20=\x20?',_0x873d16)['where'](_0xddf5('0x43'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5478cf,_0x2874f8,_0x45a373,_0xddf5('0x34'),[_0xddf5('0x44'),_0xddf5('0x45')]))[_0xddf5('0x18')](_0xddf5('0x46'),selectNotIn(_0x5478cf,_0x2874f8,_0x45a373,_0xddf5('0x34'),[_0xddf5('0x44')])))[_0xddf5('0x47')]();}function insertCmHopperBlack(_0x490a14,_0xd5c63d,_0x5b4817,_0x5654c2){var _0x2858f3=[_0xddf5('0x48'),'cm_contacts.id','cm_contacts.ListId',_0xd5c63d+'.'+_0x5654c2,_0xddf5('0x2f'),_0xddf5('0x49')];return squel[_0xddf5('0x32')]()[_0xddf5('0x33')]('cm_hopper_black')['fromQuery']([_0xddf5('0x16'),_0xddf5('0x37'),'ListId',_0x5654c2,_0xddf5('0x39'),_0xddf5('0x3a')],squel['select']()[_0xddf5('0x3e')](_0x2858f3)['from'](_0xd5c63d)[_0xddf5('0x1b')](_0xddf5('0x3f'),null,_0xddf5('0x40')+_0xd5c63d+'.CmListId')[_0xddf5('0x1b')](_0x5b4817,null,_0x5b4817+_0xddf5('0x42')+_0xd5c63d+'.'+_0x5654c2)[_0xddf5('0x18')](_0xd5c63d+_0xddf5('0x4a'),_0x490a14)[_0xddf5('0x18')](_0xddf5('0x43'),NOW)['where'](_0xddf5('0x46'),squel[_0xddf5('0x14')]()[_0xddf5('0x15')](_0xddf5('0x16'))['from'](_0xddf5('0x4b'))[_0xddf5('0x18')](_0xddf5('0x4c'),_0x490a14)[_0xddf5('0x18')](_0x5654c2+'\x20=\x20?',_0xd5c63d+'.'+_0x5654c2)))[_0xddf5('0x47')]();}function insertCmHopperAdditionalPhones(_0x50fe){var _0x549404=[_0xddf5('0x4d'),'cm_contact_has_items.item',_0xddf5('0x4e'),_0xddf5('0x4f'),_0xddf5('0x50')];return squel[_0xddf5('0x32')]()['into'](_0xddf5('0x51'))[_0xddf5('0x35')](['CmHopperId',_0xddf5('0x16'),'OrderBy','createdAt',_0xddf5('0x3a')],squel[_0xddf5('0x14')]()[_0xddf5('0x3e')](_0x549404)[_0xddf5('0x17')](_0xddf5('0x34'))[_0xddf5('0x1b')]('cm_contacts',null,_0xddf5('0x52'))[_0xddf5('0x1b')](_0xddf5('0x53'),null,_0xddf5('0x54'))['where'](_0xddf5('0x55'),_0x50fe)[_0xddf5('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xddf5('0x47')]();}function insertCmContact(_0x2ae7dd,_0x4af9f5,_0x28dc81,_0x5be225){var _0x1aa19e=_['concat'](_['keys'](_0x5be225),['ListId',_0xddf5('0x56'),_0xddf5('0x39'),_0xddf5('0x3a')]);return squel[_0xddf5('0x32')]()[_0xddf5('0x33')](_0xddf5('0x3f'))[_0xddf5('0x35')](_0x1aa19e,squel[_0xddf5('0x14')]()[_0xddf5('0x3e')](_0x1aa19e)[_0xddf5('0x17')](_0x4af9f5)['where']('('+_0x28dc81[_0xddf5('0x1b')](',')+_0xddf5('0x57'),squel[_0xddf5('0x14')]()[_0xddf5('0x3e')](_0x28dc81)[_0xddf5('0x17')]('cm_contacts')[_0xddf5('0x18')]('ListId\x20=\x20?',_0x2ae7dd))[_0xddf5('0x18')](_0xddf5('0x58'),squel['select']()[_0xddf5('0x15')]('MIN(id)',_0xddf5('0x59'))['from'](_0x4af9f5)['group'](_0x28dc81[_0xddf5('0x1b')](','))))[_0xddf5('0x47')]();}function handleStop(){logger[_0xddf5('0x5a')](_0xddf5('0x5b'));stopped=!![];}function handleUncaughtException(_0xb62de0){logger[_0xddf5('0x22')](_0xb62de0['message']);process[_0xddf5('0x5c')](0x1);}function handleError(_0x9d3d33,_0x120ba8){stats[_0xddf5('0x5d')]['push']({'name':_0x120ba8[_0xddf5('0x5e')],'message':_0x120ba8[_0xddf5('0x23')],'row':_0x9d3d33});}function handleQuery(_0x24cc45){logger['info'](_0x24cc45);return db[_0xddf5('0x1c')][_0xddf5('0x5f')](_0x24cc45)[_0xddf5('0x1e')](function(_0x3e256c){results[_0xddf5('0x20')](_0x3e256c);})[_0xddf5('0x60')](function(_0x1d6ed0){logger[_0xddf5('0x22')](_0x1d6ed0[_0xddf5('0x23')]);});}function main(_0x337186,_0x320afb,_0x46bbd7,_0xb7ed5c){logger['info'](_0xddf5('0x61'),_0x337186,JSON['stringify'](_0x320afb));process[_0xddf5('0x62')](_0xddf5('0x63'));var _0xdbce2a=_0x320afb[_0xddf5('0x64')];var _0x59df27=_[_0xddf5('0x65')](_0xdbce2a);var _0x4c3aa9=_0x320afb[_0xddf5('0x66')];var _0x22018e=path[_0xddf5('0x1b')](config[_0xddf5('0x67')],_0xddf5('0x68'),_0x4c3aa9+'.csv');logger['info'](_0xddf5('0x69'),_0x320afb);db[_0xddf5('0x6a')][_0xddf5('0x6b')]({'raw':!![],'attributes':['id',_0xddf5('0x6c')]})['then'](function(_0x50c8c8){for(var _0x20bea2=0x0;_0x20bea2<_0x50c8c8[_0xddf5('0x26')];_0x20bea2++){if(_0x50c8c8[_0x20bea2][_0xddf5('0x6c')]in _0xdbce2a){contactItemTypes[_0xddf5('0x20')](_0x50c8c8[_0x20bea2]);delete _0x59df27[_0x50c8c8[_0x20bea2][_0xddf5('0x6c')]];hasAdditionalPhones=!![];}for(var _0x1a006d in _0xdbce2a){if(_0x50c8c8[_0x20bea2][_0xddf5('0x6c')]+'_description'===_0x1a006d){phoneDescriptions['push']({'itemTypeId':_0x50c8c8[_0x20bea2]['id'],'description':_0x1a006d});delete _0x59df27[_0x1a006d];}}}if(hasAdditionalPhones)_0x59df27['AdditionalPhones']='';var _0x200ab4=_[_0xddf5('0x6d')](_0x59df27)[_0xddf5('0x1b')]();logger[_0xddf5('0x5a')](_0xddf5('0x6e'),_0x200ab4);fs[_0xddf5('0x6f')](_0x22018e,_0x200ab4+'\x0a');Papa[_0xddf5('0x70')](fs['createReadStream'](_0x337186),{'header':!![],'skipEmptyLines':!![],'step':function(_0x43a461,_0x30c640){try{for(var _0x5d50c2=0x0,_0x3e2f87=[];_0x5d50c2<_0x43a461[_0xddf5('0x71')][_0xddf5('0x26')];_0x5d50c2++){stats[_0xddf5('0x72')]+=0x1;if(_0x43a461['errors'][_0x5d50c2]){handleError(_0x43a461[_0xddf5('0x71')][_0x5d50c2],_0x43a461[_0xddf5('0x5d')][_0x5d50c2]);}else{var _0x10c4ad=[];var _0xf9d67=[];var _0x22463b={};for(var _0x3f7c95 in _0xdbce2a){let _0x551666=contactItemTypes[_0xddf5('0x73')](_0x5151f6=>_0x5151f6['name']===_0x3f7c95);let _0x2f064b=contactItemTypes['find'](_0x372026=>_0x372026[_0xddf5('0x6c')]+_0xddf5('0x74')===_0x3f7c95);if(_[_0xddf5('0x24')](_0x551666)&&_['isNil'](_0x2f064b)){if(_0xdbce2a[_0xddf5('0x75')](_0x3f7c95)){if(_0x43a461[_0xddf5('0x71')][_0x5d50c2][_0xdbce2a[_0x3f7c95]]){var _0x1244ec=_[_0xddf5('0x76')](_0x43a461['data'][_0x5d50c2][_0xdbce2a[_0x3f7c95]][_0xddf5('0x77')](/"/g,'\x27'));switch(_0x3f7c95){case'scheduledat':var _0x38ae00=moment(_0x1244ec,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x38ae00[_0xddf5('0x78')]()){_0x3e2f87[_0xddf5('0x20')]('\x22'+_0x1244ec+'\x22');}else{_0x10c4ad[_0xddf5('0x20')](_0xddf5('0x79'));}break;case'priority':var _0x5bae97=parseInt(_0x1244ec);_0x1244ec=_['isNaN'](_0x5bae97)||_0x5bae97<0x0||_0x5bae97>0x4?_0xb7ed5c?0x3:0x2:_0x5bae97;_0x3e2f87[_0xddf5('0x20')]('\x22'+_0x1244ec+'\x22');break;case _0xddf5('0x3c'):var _0x12c23a=parseInt(_0x1244ec);if(_[_0xddf5('0x7a')](_0x12c23a)&&_[_0xddf5('0x7b')](_0x46bbd7,_0x12c23a)){_0x3e2f87[_0xddf5('0x20')]('\x22'+_0x12c23a+'\x22');}else{_0x10c4ad[_0xddf5('0x20')]('agent\x20not\x20exists');}break;case _0xddf5('0x7c'):if(isEmail(_0x1244ec)){_0x3e2f87[_0xddf5('0x20')]('\x22'+_0x1244ec+'\x22');}else{_0x10c4ad['push'](_0xddf5('0x7d'));}break;case _0xddf5('0x7e'):var _0x673df9=moment(_0x1244ec,_0xddf5('0x7f'),!![]);if(_0x673df9['isValid']()){_0x3e2f87['push']('\x22'+_0x1244ec+'\x22');}else{_0x10c4ad['push'](_0xddf5('0x80'));}break;default:_0x3e2f87['push']('\x22'+_0x1244ec+'\x22');}}else{switch(_0x3f7c95){case'firstName':case _0xddf5('0x16'):_0x10c4ad[_0xddf5('0x20')](_0x3f7c95+_0xddf5('0x81'));break;default:_0x3e2f87[_0xddf5('0x20')]('\x22\x22');}}}}else{var _0x1ff22e='';if(!_[_0xddf5('0x24')](_0x551666)){if(!_0x22463b[_0xddf5('0x75')](_0x551666['id'])){for(var _0x480dee=0x0;_0x480dee<_0xdbce2a[_0x3f7c95]['length'];_0x480dee++){var _0x1244ec=_[_0xddf5('0x76')](_0x43a461['data'][_0x5d50c2][_0xdbce2a[_0x3f7c95][_0x480dee]][_0xddf5('0x77')](/"/g,'\x27'));var _0x5962b4=phoneDescriptions[_0xddf5('0x73')](_0x3bf028=>_0x3bf028['itemTypeId']===_0x551666['id']);if(!_['isNil'](_0x5962b4)){var _0x2ab5c3=_[_0xddf5('0x76')](_0x43a461[_0xddf5('0x71')][_0x5d50c2][_0xdbce2a[_0x5962b4[_0xddf5('0x82')]][0x0]][_0xddf5('0x77')](/"/g,'\x27'));if(!_[_0xddf5('0x24')](_0x2ab5c3))_0x1244ec=_0x1244ec+'§'+_0x2ab5c3;}if(_0x1ff22e=='')_0x1ff22e=_0x1244ec;else _0x1ff22e+='|'+_0x1244ec;}_0xf9d67[_0xddf5('0x20')](_0x551666['id']+':'+_0x1ff22e);_0x22463b[_0x551666['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3e2f87['push']('\x22'+_0xf9d67[_0xddf5('0x1b')](';')+'\x22');}if(_0x10c4ad[_0xddf5('0x26')]){handleError(_0x43a461[_0xddf5('0x71')][_0x5d50c2],{'code':'SystemRow','message':_0x10c4ad['join']()});}else{fs['appendFileSync'](_0x22018e,_0x3e2f87['join']()+'\x0a');}_0x3e2f87=[];}if(!(stats[_0xddf5('0x72')]%0xc8)){socket[_0xddf5('0x83')]('contact:import:'+_0x4c3aa9,stats);stats[_0xddf5('0x5d')]=[];}}if(stopped){logger[_0xddf5('0x5a')]('Abort\x20parser');_0x30c640[_0xddf5('0x84')]();}}catch(_0xedf2d){handleError(_0x43a461[_0xddf5('0x71')][_0x5d50c2],{'code':'SystemError','message':_0xedf2d[_0xddf5('0x23')]});logger[_0xddf5('0x22')]('step',_0xedf2d[_0xddf5('0x23')]);}},'complete':function(){try{var _0x2af6a4=[];var _0x44c26e=tempTableName;_0x2af6a4[_0xddf5('0x20')](_0xddf5('0x85')+_0x44c26e+'\x20LIKE\x20cm_contacts;');logger[_0xddf5('0x5a')](_0xddf5('0x86'),contactItemTypes[_0xddf5('0x26')]);var _0x386a5c=util[_0xddf5('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',_0x22018e,_0x44c26e,_0x200ab4,_0x320afb[_0xddf5('0x38')],_0x320afb['CompanyId']||null,NOW,NOW);if(_[_0xddf5('0x24')](_0xdbce2a[_0xddf5('0x36')])){_0x386a5c+=_0xddf5('0x87');}_0x2af6a4[_0xddf5('0x20')](_0x386a5c);BPromise[_0xddf5('0x88')](_0x2af6a4,handleQuery)[_0xddf5('0x27')](function(_0x4427dd){BPromise[_0xddf5('0x21')]([handleAdditionalPhones()])[_0xddf5('0x27')](function(){_0x2af6a4=[];for(var _0x1798f3=0x0;_0x1798f3\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','ioredis','import','redis','defaults','localhost'];(function(_0x2745a7,_0x3f7774){var _0x310459=function(_0x5b875f){while(--_0x5b875f){_0x2745a7['push'](_0x2745a7['shift']());}};_0x310459(++_0x3f7774);}(_0xeeeb,0x1bb));var _0xbeee=function(_0x36bd0e,_0x4999a2){_0x36bd0e=_0x36bd0e-0x0;var _0x54231d=_0xeeeb[_0x36bd0e];return _0x54231d;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xbeee('0x0'));var Papa=require(_0xbeee('0x1'));var util=require(_0xbeee('0x2'));var BPromise=require(_0xbeee('0x3'));var moment=require(_0xbeee('0x4'));var squel=require('squel');var Redis=require(_0xbeee('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xbeee('0x6'));config[_0xbeee('0x7')]=_[_0xbeee('0x8')](config[_0xbeee('0x7')],{'host':_0xbeee('0x9'),'port':0x18eb});var socket=require(_0xbeee('0xa'))(new Redis(config['redis']));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()[_0xbeee('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0xbeee('0xb')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x582450){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))*$/[_0xbeee('0xc')](_0x582450);}function selectNotIn(_0x2e2269,_0x5a3b0e,_0x3b4a9d,_0x535404,_0x33314f){return squel[_0xbeee('0xd')]()[_0xbeee('0xe')](_0xbeee('0xf'))[_0xbeee('0x10')](_0x535404)[_0xbeee('0x11')](_0x5a3b0e,null,_0x5a3b0e+_0xbeee('0x12')+_0x535404+'.'+_0x3b4a9d)['where'](_0x535404+'.'+_0x3b4a9d+_0xbeee('0x13')+_0x2e2269+'.'+_0x3b4a9d)[_0xbeee('0x14')](_0x5a3b0e+'.dialCheckDuplicateType\x20IN\x20('+_0x33314f[_0xbeee('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4b7b6d,_0x13b691){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xbeee('0x15')](_0xbeee('0x16')+tempTableName)[_0xbeee('0x17')](function(_0x377a78){if(_0x377a78!==null){var _0x4fcea7=[];for(var _0x48d0b3=0x0;_0x48d0b3<_0x377a78[_0xbeee('0x18')];_0x48d0b3++){var _0x122992=_0x377a78[_0x48d0b3];if(!_['isNil'](_0x122992['phone'])){if(!_[_0xbeee('0x19')](_0x122992[_0xbeee('0x1a')]))_0x4fcea7[_0xbeee('0x1b')](insertAdditionalPhones(_0x122992));promisesContact[_0xbeee('0x1b')]({'contact':_0x122992});}}}Promise[_0xbeee('0x1c')](_0x4fcea7)[_0xbeee('0x1d')](function(){_0x4b7b6d({'val':0x1});});})[_0xbeee('0x1e')](function(_0x438e8c){logger[_0xbeee('0x1f')](_0x438e8c['message']);});});}function insertAdditionalPhones(_0x41ca56){return new Promise(function(_0x48bf0d,_0x5c882c){var _0x2d2c79=_0x41ca56['AdditionalPhones'];if(_[_0xbeee('0x19')](_0x2d2c79))_0x5c882c({'val':0x0});else{var _0x554e59=_0x2d2c79[_0xbeee('0x20')](';');var _0x32fa75=[];orderBy=0x0;for(var _0x522ce2=0x0;_0x522ce2<_0x554e59['length'];_0x522ce2++){_0x32fa75[_0xbeee('0x1b')](splitAdditionalPhone(_0x41ca56['id'],_0x554e59[_0x522ce2]));}Promise[_0xbeee('0x1c')](_0x32fa75)[_0xbeee('0x1d')](function(){_0x48bf0d({'val':_0x554e59[_0xbeee('0x18')]});});}});}function splitAdditionalPhone(_0x2953a4,_0xf60f9b){return new Promise(function(_0x3787cd,_0x404e38){var _0x947a83=_0xf60f9b[_0xbeee('0x20')](':');var _0x2e6610=_0x947a83[0x0];var _0x4fd3e7=_0x947a83[0x1];if(_0x4fd3e7!==''){var _0x541846=_0x4fd3e7['split']('|');var _0x240677=[];for(var _0x8cafc7=0x0;_0x8cafc7<_0x541846[_0xbeee('0x18')];_0x8cafc7++){if(_0x541846[_0x8cafc7]!==''){var _0x379c81=_[_0xbeee('0x21')](promisesAdditionalPhones,{'contactId':_0x2953a4,'phone':_0x541846[_0x8cafc7]});if(_0x379c81['length']==0x0){orderBy++;promisesAdditionalPhones[_0xbeee('0x1b')]({'contactId':_0x2953a4,'contactTypeId':_0x2e6610,'phone':_0x541846[_0x8cafc7],'orderBy':orderBy});}}}_0x3787cd({'ok':0x1});}else _0x3787cd({'res':0x0});});}function createAdditionalPhone(_0x3593d1,_0x2472db,_0x11d692,_0x56c852){var _0x851c90='';var _0x51bfe2='';var _0x5d19c6=_0x11d692[_0xbeee('0x20')]('§');_0x851c90=_0x5d19c6[0x0];if(_0x5d19c6[_0xbeee('0x18')]==0x2)_0x51bfe2=_0x5d19c6[0x1];return new Promise(function(_0x24a946,_0x2813a5){return db[_0xbeee('0x22')]['findOne']({'where':{'CmContactId':_0x3593d1,'item':_0x851c90}})[_0xbeee('0x1d')](function(_0x37a90d){if(_0x37a90d){return db[_0xbeee('0x22')][_0xbeee('0x23')]({'ItemTypeId':_0x2472db,'description':_0x51bfe2,'OrderBy':_0x56c852},{'where':{'CmContactId':_0x3593d1,'item':_0x851c90}})[_0xbeee('0x1d')](function(_0x4a7085){_0x24a946({'res':_0xbeee('0x24')});});}else{return db[_0xbeee('0x22')][_0xbeee('0x25')]({'CmContactId':_0x3593d1,'item':_0x851c90,'ItemTypeId':_0x2472db,'description':_0x51bfe2,'OrderBy':_0x56c852,'ItemClass':'PHONE'})['then'](function(_0x3af937){_0x24a946({'res':_0xbeee('0x26')});});}});});}function updateContact(_0x3d142d){return new Promise(function(_0x4dd9dc,_0x125c62){var _0x14cafe=_0x3d142d['id'];delete _0x3d142d['id'];return db[_0xbeee('0x27')][_0xbeee('0x23')](_0x3d142d,{'where':{'id':_0x14cafe}})[_0xbeee('0x1d')](function(_0x26dd3f){updatedRows+=0x1;return db[_0xbeee('0x28')][_0xbeee('0x23')]({'phone':_0x3d142d[_0xbeee('0xf')]},{'where':{'ContactId':_0x14cafe}})['then'](function(_0x8dc7b2){_0x4dd9dc({'ret':'OK'});});});});}function insertCmHopper(_0x7c2055,_0x42ef5e,_0x1cc84b,_0x4fa13c,_0x5874a0){var _0x2383fd=[_0xbeee('0x29'),_0xbeee('0x2a'),'cm_contacts.id','cm_contacts.ListId',_0x42ef5e+'.'+_0x4fa13c,_0xbeee('0x2b'),_0xbeee('0x2c'),'cm_contacts.priority',_0xbeee('0x2d'),'\x22'+_0x5874a0+'\x22'];return squel[_0xbeee('0x2e')]()[_0xbeee('0x2f')](_0xbeee('0x30'))[_0xbeee('0x31')](['phone',_0xbeee('0x32'),_0xbeee('0x33'),'ListId',_0x4fa13c,_0xbeee('0x34'),'updatedAt',_0xbeee('0x35'),_0xbeee('0x36'),'recallme'],squel[_0xbeee('0xd')]()[_0xbeee('0x37')](_0x2383fd)[_0xbeee('0x10')](_0x42ef5e)[_0xbeee('0x11')](_0xbeee('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x42ef5e+_0xbeee('0x39'))[_0xbeee('0x11')](_0x1cc84b,null,_0x1cc84b+_0xbeee('0x12')+_0x42ef5e+'.'+_0x4fa13c)[_0xbeee('0x14')](_0x42ef5e+_0xbeee('0x3a'),_0x7c2055)['where'](_0xbeee('0x3b'),NOW)[_0xbeee('0x14')](_0xbeee('0x3c'),selectNotIn(_0x42ef5e,_0x1cc84b,_0x4fa13c,_0xbeee('0x30'),[_0xbeee('0x3d'),_0xbeee('0x3e')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x42ef5e,_0x1cc84b,_0x4fa13c,_0xbeee('0x30'),['\x22always\x22'])))[_0xbeee('0x3f')]();}function insertCmHopperBlack(_0x545cd8,_0xb76244,_0x4d76cd,_0x1f6cb6){var _0x254e53=[_0xbeee('0x29'),_0xbeee('0x40'),_0xbeee('0x41'),_0xb76244+'.'+_0x1f6cb6,_0xbeee('0x2b'),_0xbeee('0x2c')];return squel[_0xbeee('0x2e')]()[_0xbeee('0x2f')](_0xbeee('0x42'))['fromQuery']([_0xbeee('0xf'),_0xbeee('0x33'),_0xbeee('0x43'),_0x1f6cb6,_0xbeee('0x34'),_0xbeee('0x44')],squel[_0xbeee('0xd')]()[_0xbeee('0x37')](_0x254e53)['from'](_0xb76244)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xb76244+_0xbeee('0x39'))['join'](_0x4d76cd,null,_0x4d76cd+'.id\x20=\x20'+_0xb76244+'.'+_0x1f6cb6)[_0xbeee('0x14')](_0xb76244+_0xbeee('0x3a'),_0x545cd8)[_0xbeee('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbeee('0x14')](_0xbeee('0x3c'),squel[_0xbeee('0xd')]()[_0xbeee('0xe')](_0xbeee('0xf'))['from'](_0xbeee('0x42'))[_0xbeee('0x14')](_0xbeee('0x45'),_0x545cd8)['where'](_0x1f6cb6+_0xbeee('0x46'),_0xb76244+'.'+_0x1f6cb6)))[_0xbeee('0x3f')]();}function insertCmHopperAdditionalPhones(_0x3b0e97){var _0x5239f9=[_0xbeee('0x47'),_0xbeee('0x48'),_0xbeee('0x49'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xbeee('0x2e')]()[_0xbeee('0x2f')](_0xbeee('0x4a'))[_0xbeee('0x31')](['CmHopperId',_0xbeee('0xf'),_0xbeee('0x4b'),_0xbeee('0x34'),_0xbeee('0x44')],squel[_0xbeee('0xd')]()[_0xbeee('0x37')](_0x5239f9)[_0xbeee('0x10')](_0xbeee('0x30'))[_0xbeee('0x11')](_0xbeee('0x38'),null,_0xbeee('0x4c'))[_0xbeee('0x11')](_0xbeee('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xbeee('0x14')](_0xbeee('0x4e'),_0x3b0e97)['where'](_0xbeee('0x3b'),NOW))[_0xbeee('0x3f')]();}function insertCmContact(_0x5552b9,_0x1bdcb3,_0x311bfd,_0x3970aa){var _0x909c7c=_[_0xbeee('0x4f')](_[_0xbeee('0x50')](_0x3970aa),[_0xbeee('0x43'),_0xbeee('0x51'),_0xbeee('0x34'),_0xbeee('0x44')]);return squel[_0xbeee('0x2e')]()['into']('cm_contacts')['fromQuery'](_0x909c7c,squel['select']()['fields'](_0x909c7c)['from'](_0x1bdcb3)[_0xbeee('0x14')]('('+_0x311bfd[_0xbeee('0x11')](',')+_0xbeee('0x52'),squel[_0xbeee('0xd')]()[_0xbeee('0x37')](_0x311bfd)[_0xbeee('0x10')]('cm_contacts')[_0xbeee('0x14')]('ListId\x20=\x20?',_0x5552b9))[_0xbeee('0x14')](_0xbeee('0x53'),squel[_0xbeee('0xd')]()[_0xbeee('0xe')](_0xbeee('0x54'),'min_id')[_0xbeee('0x10')](_0x1bdcb3)[_0xbeee('0x55')](_0x311bfd[_0xbeee('0x11')](','))))[_0xbeee('0x3f')]();}function handleStop(){logger[_0xbeee('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x154ac0){logger['error'](_0x154ac0[_0xbeee('0x57')]);process['exit'](0x1);}function handleError(_0x3e9f6a,_0xab960c){stats[_0xbeee('0x58')][_0xbeee('0x1b')]({'name':_0xab960c[_0xbeee('0x59')],'message':_0xab960c['message'],'row':_0x3e9f6a});}function handleQuery(_0x464481){logger[_0xbeee('0x56')](_0x464481);return db[_0xbeee('0x5a')]['query'](_0x464481)[_0xbeee('0x17')](function(_0x3baac7){results[_0xbeee('0x1b')](_0x3baac7);})[_0xbeee('0x1e')](function(_0x7ee14){logger['error'](_0x7ee14['message']);});}function main(_0xa88b64,_0x5de4f5,_0x2c2ff3,_0x354c48){logger[_0xbeee('0x56')](_0xbeee('0x5b'),_0xa88b64,JSON[_0xbeee('0x5c')](_0x5de4f5));process['send'](_0xbeee('0x5d'));var _0x2e954c=_0x5de4f5[_0xbeee('0x5e')];var _0x1e82ed=_[_0xbeee('0x5f')](_0x2e954c);var _0x3aba49=_0x5de4f5['socket_timestamp'];var _0x28f2f2=path['join'](config[_0xbeee('0x60')],_0xbeee('0x61'),_0x3aba49+'.csv');logger[_0xbeee('0x56')](_0xbeee('0x62'),_0x5de4f5);db[_0xbeee('0x63')][_0xbeee('0x64')]({'raw':!![],'attributes':['id',_0xbeee('0x65')]})[_0xbeee('0x1d')](function(_0x2499b1){for(var _0x4c11f9=0x0;_0x4c11f9<_0x2499b1[_0xbeee('0x18')];_0x4c11f9++){if(_0x2499b1[_0x4c11f9][_0xbeee('0x65')]in _0x2e954c){contactItemTypes[_0xbeee('0x1b')](_0x2499b1[_0x4c11f9]);delete _0x1e82ed[_0x2499b1[_0x4c11f9][_0xbeee('0x65')]];hasAdditionalPhones=!![];}for(var _0x206688 in _0x2e954c){if(_0x2499b1[_0x4c11f9][_0xbeee('0x65')]+_0xbeee('0x66')===_0x206688){phoneDescriptions['push']({'itemTypeId':_0x2499b1[_0x4c11f9]['id'],'description':_0x206688});delete _0x1e82ed[_0x206688];}}}if(hasAdditionalPhones)_0x1e82ed[_0xbeee('0x1a')]='';var _0x2c2888=_[_0xbeee('0x50')](_0x1e82ed)[_0xbeee('0x11')]();logger[_0xbeee('0x56')]('header',_0x2c2888);fs[_0xbeee('0x67')](_0x28f2f2,_0x2c2888+'\x0a');Papa[_0xbeee('0x68')](fs[_0xbeee('0x69')](_0xa88b64),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5242c6,_0x823520){try{for(var _0x4457b4=0x0,_0x2714be=[];_0x4457b4<_0x5242c6[_0xbeee('0x6a')][_0xbeee('0x18')];_0x4457b4++){stats[_0xbeee('0x6b')]+=0x1;if(_0x5242c6['errors'][_0x4457b4]){handleError(_0x5242c6['data'][_0x4457b4],_0x5242c6[_0xbeee('0x58')][_0x4457b4]);}else{var _0x1e23b4=[];var _0x5c8322=[];var _0x28caea={};for(var _0x18016d in _0x2e954c){let _0x50f5d2=contactItemTypes[_0xbeee('0x6c')](_0x3e6f5c=>_0x3e6f5c[_0xbeee('0x65')]===_0x18016d);let _0x3f2cd5=contactItemTypes[_0xbeee('0x6c')](_0x1b3035=>_0x1b3035['name']+_0xbeee('0x66')===_0x18016d);if(_[_0xbeee('0x19')](_0x50f5d2)&&_[_0xbeee('0x19')](_0x3f2cd5)){if(_0x2e954c['hasOwnProperty'](_0x18016d)){if(_0x5242c6[_0xbeee('0x6a')][_0x4457b4][_0x2e954c[_0x18016d]]){var _0x57e2fb=_[_0xbeee('0x6d')](_0x5242c6[_0xbeee('0x6a')][_0x4457b4][_0x2e954c[_0x18016d]]['replace'](/"/g,'\x27'));switch(_0x18016d){case'scheduledat':var _0xf58d50=moment(_0x57e2fb,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xf58d50[_0xbeee('0x6e')]()){_0x2714be[_0xbeee('0x1b')]('\x22'+_0x57e2fb+'\x22');}else{_0x1e23b4[_0xbeee('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xbeee('0x35'):var _0x53ba44=parseInt(_0x57e2fb);_0x57e2fb=_[_0xbeee('0x6f')](_0x53ba44)||_0x53ba44<0x0||_0x53ba44>0x4?_0x354c48?0x3:0x2:_0x53ba44;_0x2714be[_0xbeee('0x1b')]('\x22'+_0x57e2fb+'\x22');break;case _0xbeee('0x36'):var _0x330a56=parseInt(_0x57e2fb);if(_[_0xbeee('0x70')](_0x330a56)&&_['includes'](_0x2c2ff3,_0x330a56)){_0x2714be[_0xbeee('0x1b')]('\x22'+_0x330a56+'\x22');}else{_0x1e23b4[_0xbeee('0x1b')]('agent\x20not\x20exists');}break;case _0xbeee('0x71'):if(isEmail(_0x57e2fb)){_0x2714be[_0xbeee('0x1b')]('\x22'+_0x57e2fb+'\x22');}else{_0x1e23b4[_0xbeee('0x1b')](_0xbeee('0x72'));}break;case _0xbeee('0x73'):var _0x112405=moment(_0x57e2fb,'YYYY-MM-DD',!![]);if(_0x112405['isValid']()){_0x2714be[_0xbeee('0x1b')]('\x22'+_0x57e2fb+'\x22');}else{_0x1e23b4['push'](_0xbeee('0x74'));}break;default:_0x2714be[_0xbeee('0x1b')]('\x22'+_0x57e2fb+'\x22');}}else{switch(_0x18016d){case'firstName':case _0xbeee('0xf'):_0x1e23b4[_0xbeee('0x1b')](_0x18016d+_0xbeee('0x75'));break;default:_0x2714be[_0xbeee('0x1b')]('\x22\x22');}}}}else{var _0x1fa1b6='';if(!_['isNil'](_0x50f5d2)){if(!_0x28caea[_0xbeee('0x76')](_0x50f5d2['id'])){for(var _0xaefa78=0x0;_0xaefa78<_0x2e954c[_0x18016d][_0xbeee('0x18')];_0xaefa78++){var _0x57e2fb=_[_0xbeee('0x6d')](_0x5242c6[_0xbeee('0x6a')][_0x4457b4][_0x2e954c[_0x18016d][_0xaefa78]][_0xbeee('0x77')](/"/g,'\x27'));var _0x1221e6=phoneDescriptions[_0xbeee('0x6c')](_0x3e8fae=>_0x3e8fae[_0xbeee('0x78')]===_0x50f5d2['id']);if(!_['isNil'](_0x1221e6)){var _0x3b4380=_[_0xbeee('0x6d')](_0x5242c6[_0xbeee('0x6a')][_0x4457b4][_0x2e954c[_0x1221e6['description']][0x0]][_0xbeee('0x77')](/"/g,'\x27'));if(!_['isNil'](_0x3b4380))_0x57e2fb=_0x57e2fb+'§'+_0x3b4380;}if(_0x1fa1b6=='')_0x1fa1b6=_0x57e2fb;else _0x1fa1b6+='|'+_0x57e2fb;}_0x5c8322[_0xbeee('0x1b')](_0x50f5d2['id']+':'+_0x1fa1b6);_0x28caea[_0x50f5d2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2714be['push']('\x22'+_0x5c8322[_0xbeee('0x11')](';')+'\x22');}if(_0x1e23b4[_0xbeee('0x18')]){handleError(_0x5242c6[_0xbeee('0x6a')][_0x4457b4],{'code':_0xbeee('0x79'),'message':_0x1e23b4[_0xbeee('0x11')]()});}else{fs[_0xbeee('0x7a')](_0x28f2f2,_0x2714be[_0xbeee('0x11')]()+'\x0a');}_0x2714be=[];}if(!(stats['rows']%0xc8)){socket[_0xbeee('0x7b')](_0xbeee('0x7c')+_0x3aba49,stats);stats[_0xbeee('0x58')]=[];}}if(stopped){logger[_0xbeee('0x56')](_0xbeee('0x7d'));_0x823520[_0xbeee('0x7e')]();}}catch(_0x41e111){handleError(_0x5242c6['data'][_0x4457b4],{'code':_0xbeee('0x7f'),'message':_0x41e111['message']});logger[_0xbeee('0x1f')](_0xbeee('0x80'),_0x41e111['message']);}},'complete':function(){try{var _0x6b8ce7=[];var _0x2cc52c=tempTableName;_0x6b8ce7[_0xbeee('0x1b')](_0xbeee('0x81')+_0x2cc52c+'\x20LIKE\x20cm_contacts;');logger[_0xbeee('0x56')](_0xbeee('0x82'),contactItemTypes[_0xbeee('0x18')]);var _0x4e7450=util[_0xbeee('0xb')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x28f2f2,_0x2cc52c,_0x2c2888,_0x5de4f5[_0xbeee('0x43')],_0x5de4f5[_0xbeee('0x51')]||null,NOW,NOW);if(_[_0xbeee('0x19')](_0x2e954c[_0xbeee('0x32')])){_0x4e7450+=_0xbeee('0x83');}_0x6b8ce7[_0xbeee('0x1b')](_0x4e7450);BPromise[_0xbeee('0x84')](_0x6b8ce7,handleQuery)['then'](function(_0x58288a){BPromise[_0xbeee('0x1c')]([handleAdditionalPhones()])[_0xbeee('0x1d')](function(){_0x6b8ce7=[];for(var _0x3bfceb=0x0;_0x3bfceb\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','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','all','clone','where','t.id\x20IN\x20?','Sequelize','QueryTypes','lodash','squel','../parsers/advancedSearch','updateInteraction','./utils','getAccountFK','role','agent','search','select','field','name','color','getInteractionFK','user_has_','_interactions','u.id','u.fullname','from','left_join','users','u.id\x20=\x20ui.UserId','length','ui.','\x20IN\x20?','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','interactionsTags','it.','\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','whatsapp','includes','fax','i.fax\x20LIKE\x20?','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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','start','end','unreadMessages','read','and','Contact','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','buildExpression','plainBody','body','some','compact','createdAt','parse','$gte','$lte','null','resolve','then','fields','tag','tags','clause','filter','get','Websites','Accounts','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','SELECT','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt'];(function(_0x1cbbeb,_0x4a8586){var _0x23320a=function(_0x5c0436){while(--_0x5c0436){_0x1cbbeb['push'](_0x1cbbeb['shift']());}};_0x23320a(++_0x4a8586);}(_0x67f3,0xc4));var _0x367f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x67f3[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x367f('0x0'));var squel=require(_0x367f('0x1'));var as=require(_0x367f('0x2'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x367f('0x3')];var utils=require(_0x367f('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x517b87,_0x26dbf2,_0x155bc9){var _0x2c2d57=![];var _0x83fd72=utils[_0x367f('0x5')](_0x517b87);if(_0x26dbf2[_0x367f('0x6')]===_0x367f('0x7')&&!_0x155bc9[_0x367f('0x8')]&&!_0x155bc9[_0x83fd72]){_0x2c2d57=!![];}return _0x2c2d57;}function getTagsQuery(){return squel[_0x367f('0x9')]()[_0x367f('0xa')]('id')[_0x367f('0xa')](_0x367f('0xb'))[_0x367f('0xa')](_0x367f('0xc'))['from']('tools_tags');}function getUsersQuery(_0x2b50b3,_0x4e42cb){var _0xe66f5e=utils[_0x367f('0xd')](_0x2b50b3);var _0x54751b=_0x367f('0xe')+_0x2b50b3+_0x367f('0xf');var _0x16441d=squel['select']()['field'](_0x367f('0x10'))[_0x367f('0xa')](_0x367f('0x11'))['field']('ui.'+_0xe66f5e)[_0x367f('0x12')](_0x54751b,'ui')[_0x367f('0x13')](_0x367f('0x14'),'u',_0x367f('0x15'));if(_0x4e42cb[_0x367f('0x16')]>0x0){_0x16441d['where'](_0x367f('0x17')+_0xe66f5e+_0x367f('0x18'),_[_0x367f('0x19')](_0x4e42cb,'id'));}return _0x16441d;}function getInteractionsQuery(_0x386885){var _0x1ad94=utils[_0x367f('0x1a')](_0x386885);var _0x1fbb32=utils[_0x367f('0x5')](_0x386885);var _0x2c49c7=utils[_0x367f('0xd')](_0x386885);return squel[_0x367f('0x9')]()[_0x367f('0x12')](_0x1ad94[_0x367f('0x1b')],'i')['left_join']('cm_contacts','c',_0x367f('0x1c'))[_0x367f('0x13')]('users','o','o.id\x20=\x20i.UserId')[_0x367f('0x13')](_0x1ad94[_0x367f('0x1d')],'a',_0x367f('0x1e')+_0x1fbb32)[_0x367f('0x13')](_0x1ad94[_0x367f('0x1f')],'me','me.'+_0x2c49c7+'\x20=\x20i.id')[_0x367f('0x13')](_0x1ad94[_0x367f('0x20')],'it',_0x367f('0x21')+_0x2c49c7+_0x367f('0x22'))[_0x367f('0x13')](_0x367f('0x23'),'t',_0x367f('0x24'));}function getSqlClauses(){var _0x2ce71f={'body':squel[_0x367f('0x25')](),'contact':squel[_0x367f('0x25')](),'default':squel['expr'](),'fields':squel[_0x367f('0x25')](),'filter':squel['expr'](),'read':squel[_0x367f('0x25')](),'tags':{'clause':squel[_0x367f('0x25')](),'ids':null},'user':squel[_0x367f('0x25')]()};return _0x2ce71f;}function parseTagParameter(_0x428319){var _0x352e68=squel[_0x367f('0x25')]();if(_0x428319){var _0x5e4db6=utils[_0x367f('0x26')](_0x428319);_0x5e4db6[_0x367f('0x27')](function(_0x23e7a1){_0x352e68['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x23e7a1+',%');});}return _0x352e68;}function parseReadParameter(_0x383f78){var _0x3f7ded='';if(_0x383f78){_0x3f7ded=_0x367f('0x28');if(_0x383f78==='1'){_0x3f7ded=_0x3f7ded[_0x367f('0x29')](_0x367f('0x2a'),'=');}else{_0x3f7ded=_0x3f7ded['replace']('{OPERATOR}','>');}}return _0x3f7ded;}function parseSearchFilter(_0x306e9a,_0x447853){var _0x18c398=squel[_0x367f('0x25')]();if(_0x447853){var _0x4dd32c=_0x447853[_0x367f('0x29')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x3970c4=qs['escapeLIKESpecialChars'](_0x4dd32c);if(qs['isNumeric'](_0x4dd32c)){_0x18c398['or'](_0x367f('0x2b'),_0x3970c4+'%');if(['sms',_0x367f('0x2c')][_0x367f('0x2d')](_0x306e9a)){_0x18c398['or']('i.phone\x20LIKE\x20?',_0x3970c4+'%');}else if(_0x306e9a===_0x367f('0x2e')){_0x18c398['or'](_0x367f('0x2f'),_0x3970c4+'%');}else if(_0x306e9a===_0x367f('0x30')){_0x18c398['or']('i.from\x20LIKE\x20?',_0x3970c4+'%');}}else if(_0x306e9a===_0x367f('0x31')&&qs[_0x367f('0x32')](_0x4dd32c)){_0x18c398['or'](_0x367f('0x33'),_0x3970c4+'%');}else{if(_0x306e9a===_0x367f('0x31')){_0x18c398['or'](_0x367f('0x34'),qs[_0x367f('0x35')](_0x4dd32c,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x367f('0x35')](_0x4dd32c));}else if(_0x306e9a!==_0x367f('0x2e')){_0x18c398['or'](_0x367f('0x36'),qs[_0x367f('0x35')](_0x4dd32c));}_0x18c398['or'](_0x367f('0x37'),qs['getFullTextValue'](_0x4dd32c,!![]),null);}}return _0x18c398;}function parseAdvancedSearchFilter(_0x45a8ad,_0x3d2940){var _0xa2fe7b=getSqlClauses();var _0x4f441c=as[_0x367f('0x38')](_0x45a8ad);var _0x285a78=_0x4f441c[_0x367f('0x39')];for(var _0x4c4e18=0x0;_0x4c4e18<_0x4f441c[_0x367f('0x3a')][_0x367f('0x16')];_0x4c4e18++){var _0x2ca5b8=_0x4f441c[_0x367f('0x3a')][_0x4c4e18];var _0x3537d6='i';var _0x46e639=_[_0x367f('0x3b')](_0x3d2940,['name',_0x2ca5b8[_0x367f('0xa')]]);if(_0x46e639){var _0x27db48=as['buildExpression'](_0x3537d6,_0x46e639[_0x367f('0x3c')],_0x2ca5b8);_0xa2fe7b[_0x367f('0x3d')][_0x285a78](_0x27db48[_0x367f('0x3e')],_0x27db48[_0x367f('0x3f')][_0x367f('0x40')],_0x27db48[_0x367f('0x3f')][_0x367f('0x41')]);}else{switch(_0x2ca5b8[_0x367f('0xa')]){case _0x367f('0x42'):var _0x1b21d9=parseReadParameter(_0x2ca5b8[_0x367f('0x3f')]);_0xa2fe7b[_0x367f('0x43')][_0x367f('0x44')](_0x1b21d9);break;case _0x367f('0x45'):if(_0x2ca5b8['operator']===_0x367f('0x46')){if(_0x2ca5b8['value'][_0x367f('0x47')]('\x20')[_0x367f('0x16')]>0x1){_0xa2fe7b[_0x367f('0x48')][_0x285a78]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2ca5b8[_0x367f('0x3f')],!![]),null);}else{var _0x49b927='%'+_0x2ca5b8[_0x367f('0x3f')]+'%';_0xa2fe7b[_0x367f('0x48')][_0x285a78](_0x367f('0x49'),_0x49b927,_0x49b927,_0x49b927);}}else{_0x46e639=_[_0x367f('0x3b')](_0x3d2940,['name',_0x367f('0x4a')]);_0x2ca5b8[_0x367f('0xa')]=_0x367f('0x4a');_0x27db48=as['buildExpression'](_0x3537d6,_0x46e639[_0x367f('0x3c')],_0x2ca5b8);_0xa2fe7b[_0x367f('0x48')][_0x285a78](_0x27db48[_0x367f('0x3e')],_0x27db48[_0x367f('0x3f')]['start'],_0x27db48[_0x367f('0x3f')][_0x367f('0x41')]);}break;case _0x367f('0x4b'):var _0x3a173=_0x2ca5b8[_0x367f('0x3f')][_0x367f('0x47')](',')['map'](function(_0x3549f1){return Number(_0x3549f1);});var _0x2b8af4=parseTagParameter(_0x3a173);_0xa2fe7b['tags']['clause'][_0x367f('0x44')](_0x2b8af4);_0xa2fe7b['tags'][_0x367f('0x4c')]=_0x3a173;break;case _0x367f('0x4d'):if(_0x2ca5b8['operator']===_0x367f('0x46')){_0xa2fe7b[_0x367f('0x4e')][_0x285a78](_0x367f('0x4f'),'%'+_0x2ca5b8[_0x367f('0x3f')]+'%',null);}else{_0x46e639=_[_0x367f('0x3b')](_0x3d2940,['name',_0x367f('0x50')]);_0x2ca5b8[_0x367f('0xa')]='UserId';_0x27db48=as[_0x367f('0x51')](_0x3537d6,_0x46e639[_0x367f('0x3c')],_0x2ca5b8);_0xa2fe7b[_0x367f('0x4e')][_0x285a78](_0x27db48[_0x367f('0x3e')],_0x27db48[_0x367f('0x3f')]['start'],_0x27db48[_0x367f('0x3f')]['end']);}break;case'body':case _0x367f('0x52'):_0x27db48=as['buildExpression']('me',null,_0x2ca5b8);_0xa2fe7b[_0x367f('0x53')][_0x285a78](_0x27db48[_0x367f('0x3e')],_0x27db48['value']['start'],_0x27db48['value'][_0x367f('0x41')]);break;}}}return _0xa2fe7b;}function parseModelFields(_0x8b1187,_0x40e070,_0x21a4bc){var _0x288cbc=utils['getAccountFK'](_0x8b1187);var _0x33dca5=squel[_0x367f('0x25')]();var _0x4564f8=_(_0x40e070)['keys']()[_0x367f('0x19')](function(_0x25e543){return _[_0x367f('0x54')](_0x21a4bc,[_0x367f('0xb'),_0x25e543])?_0x25e543:undefined;})[_0x367f('0x55')]()[_0x367f('0x3f')]();if(_0x4564f8[_0x367f('0x16')]>0x0){_0x4564f8[_0x367f('0x27')](function(_0x87f153){if(_0x87f153===_0x288cbc){_0x33dca5[_0x367f('0x44')]('i.'+_0x288cbc+_0x367f('0x18'),[]['concat'](_0x40e070[_0x87f153]));}else if(_0x87f153===_0x367f('0x56')){var _0x36a35e=JSON[_0x367f('0x57')](_0x40e070[_0x87f153])[_0x367f('0x58')];var _0x648ee2=JSON[_0x367f('0x57')](_0x40e070[_0x87f153])[_0x367f('0x59')];_0x33dca5[_0x367f('0x44')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x36a35e,_0x648ee2);}else{if(_0x40e070[_0x87f153]===_0x367f('0x5a')){_0x33dca5[_0x367f('0x44')]('i.'+_0x87f153+'\x20IS\x20NULL');}else{_0x33dca5[_0x367f('0x44')]('i.'+_0x87f153+'\x20=\x20?',_0x40e070[_0x87f153]);}}});}return _0x33dca5;}function parseQueryParameters(_0x5d220f,_0x1a95d5,_0x1ca482){var _0x2e0265=getSqlClauses();return Promise[_0x367f('0x5b')]()['then'](function(){return parseModelFields(_0x5d220f,_0x1a95d5,_0x1ca482);})[_0x367f('0x5c')](function(_0x4ba10c){_0x2e0265[_0x367f('0x5d')]['and'](_0x4ba10c);return parseReadParameter(_0x1a95d5[_0x367f('0x43')]);})['then'](function(_0x27b0fb){_0x2e0265[_0x367f('0x43')]['and'](_0x27b0fb);return parseTagParameter(_0x1a95d5[_0x367f('0x5e')]);})[_0x367f('0x5c')](function(_0x518f22){_0x2e0265[_0x367f('0x5f')][_0x367f('0x60')][_0x367f('0x44')](_0x518f22);return parseSearchFilter(_0x5d220f,_0x1a95d5[_0x367f('0x61')]);})[_0x367f('0x5c')](function(_0x50b128){_0x2e0265[_0x367f('0x61')]=_0x50b128;return _0x2e0265;});}function checkAccountsRestrictions(_0x4a1122,_0x3fd545,_0x319ee0){var _0x34d21e=utils[_0x367f('0x5')](_0x4a1122);var _0x255a9b=_0x367f('0x62')+_['capitalize'](_0x4a1122)+(_0x4a1122==='chat'?_0x367f('0x63'):_0x367f('0x64'));var _0x4110ad=squel['expr']();return Promise[_0x367f('0x5b')]()[_0x367f('0x5c')](function(){if(_0x319ee0[_0x367f('0x8')]&&_0x3fd545['role']===_0x367f('0x7')){return _0x3fd545[_0x255a9b]({'attributes':['id'],'raw':!![]});}})[_0x367f('0x5c')](function(_0x1c0fd6){if(_0x1c0fd6){if(_0x1c0fd6[_0x367f('0x16')]===0x0){_0x4110ad[_0x367f('0x44')]('i.'+_0x34d21e+_0x367f('0x65'));}else{_0x4110ad[_0x367f('0x44')]('i.'+_0x34d21e+_0x367f('0x18'),_[_0x367f('0x19')](_0x1c0fd6,'id'));}}else if(!_0x319ee0[_0x34d21e]){_0x4110ad['and']('i.'+_0x34d21e+_0x367f('0x66'));}})[_0x367f('0x5c')](function(){return _0x4110ad;});}function getClosedOrderClause(_0x50c16b,_0x5d4537){var _0x163c61='';var _0x448045=['i.thirdDisposition',_0x367f('0x67'),_0x367f('0x68')];if(_0x50c16b==='mail'){_0x448045[_0x367f('0x69')]('i.substatus');}if(_0x5d4537['closed']==='0'&&_0x50c16b===_0x367f('0x31')){_0x163c61=_0x367f('0x6a');}else{if(_0x5d4537[_0x367f('0x6b')]==='1'){_0x448045['shift']();}_0x163c61=_0x367f('0x6c')+_0x448045[_0x367f('0x6d')](',\x20')+')';}return _0x163c61;}function getFilteredInteractions(_0x2ea4c1,_0x3185b9,_0x1ee5c4,_0x1aa33f){var _0x3ae070=utils[_0x367f('0xd')](_0x2ea4c1);var _0x2354a8=_['capitalize'](_0x2ea4c1)+_0x367f('0x6e');var _0x50e18d=[];var _0x5ee61c=getTagsQuery();var _0x130ba6={'type':db['Sequelize']['QueryTypes'][_0x367f('0x6f')],'raw':!![]};var _0x40a082=[];var _0x11822f=[];return db[_0x367f('0x70')][_0x367f('0x71')](_0x5ee61c[_0x367f('0x72')](),_0x130ba6)[_0x367f('0x5c')](function(_0x454010){_0x50e18d=_[_0x367f('0x73')](_0x454010,'id');_0x130ba6=_[_0x367f('0x74')](_0x130ba6,{'model':db[_0x2354a8],'mapToModel':!![],'nest':!![]});if(_0x1ee5c4['fields']){_0x1aa33f['attributes']['forEach'](function(_0x370925){_0x3185b9[_0x367f('0xa')]('i.'+_0x370925);});}else{_0x3185b9[_0x367f('0xa')](_0x367f('0x75'),_0x367f('0x42'));_0x3185b9[_0x367f('0xa')]('a.key',_0x367f('0x76'));_0x3185b9[_0x367f('0xa')](_0x367f('0x77'),_0x367f('0x78'));if(_0x2ea4c1===_0x367f('0x31')){_0x3185b9[_0x367f('0xa')](_0x367f('0x79'),_0x367f('0x7a'));_0x3185b9['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x367f('0x7b'));_0x3185b9[_0x367f('0xa')](_0x367f('0x7c'));_0x3185b9['field'](_0x367f('0x7d'));_0x3185b9['field']('i.updatedAt');_0x3185b9[_0x367f('0xa')](_0x367f('0x7e'));_0x3185b9[_0x367f('0xa')](_0x367f('0x7f'));_0x3185b9[_0x367f('0xa')](_0x367f('0x80'));_0x3185b9['field'](_0x367f('0x81'));_0x3185b9[_0x367f('0xa')](_0x367f('0x82'));_0x3185b9[_0x367f('0xa')](_0x367f('0x83'));_0x3185b9[_0x367f('0xa')]('i.disposition');_0x3185b9[_0x367f('0xa')](_0x367f('0x67'));_0x3185b9['field']('i.thirdDisposition');_0x3185b9[_0x367f('0xa')]('i.substatus');_0x3185b9[_0x367f('0xa')](_0x367f('0x84'));_0x3185b9['field'](_0x367f('0x85'));_0x3185b9[_0x367f('0xa')]('i.MailAccountId');_0x3185b9[_0x367f('0xa')](_0x367f('0x86'));}else if(_0x2ea4c1===_0x367f('0x30')){_0x3185b9[_0x367f('0xa')](_0x367f('0x87'),'contactName');}else{_0x3185b9[_0x367f('0xa')](_0x367f('0x88'),_0x367f('0x7b'));}if(_0x2ea4c1!==_0x367f('0x31')){_0x3185b9[_0x367f('0xa')](_0x367f('0x89'));}_0x3185b9['field'](_0x367f('0x8a'),_0x367f('0x8b'));_0x3185b9['field']('c.lastName',_0x367f('0x8c'));_0x3185b9[_0x367f('0xa')](_0x367f('0x8d'),'Contact.email');_0x3185b9[_0x367f('0xa')](_0x367f('0x8e'),_0x367f('0x8f'));_0x3185b9['field']('c.mobile',_0x367f('0x90'));_0x3185b9[_0x367f('0xa')](_0x367f('0x91'),_0x367f('0x92'));_0x3185b9[_0x367f('0xa')](_0x367f('0x93'),_0x367f('0x94'));_0x3185b9['field'](_0x367f('0x95'),_0x367f('0x96'));_0x3185b9[_0x367f('0xa')](_0x367f('0x97'),_0x367f('0x98'));}if(_0x1aa33f[_0x367f('0x99')]){_0x3185b9[_0x367f('0x99')](_0x1aa33f[_0x367f('0x99')]);}if(_0x1aa33f[_0x367f('0x9a')]){_0x3185b9[_0x367f('0x9a')](_0x1aa33f[_0x367f('0x9a')]);}return db[_0x367f('0x70')][_0x367f('0x71')](_0x3185b9[_0x367f('0x72')](),_0x130ba6);})['then'](function(_0x335e6f){_0x40a082=_0x335e6f;var _0x1086c4=getUsersQuery(_0x2ea4c1,_0x40a082);return db[_0x367f('0x70')]['query'](_0x1086c4['toString'](),_0x130ba6);})[_0x367f('0x5c')](function(_0x1dfaa3){_0x11822f=_[_0x367f('0x9b')](_0x1dfaa3,_0x3ae070);if(_0x2ea4c1==='mail'){return db[_0x367f('0x9c')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x59890e){var _0x56b12d=_0x59890e?_0x59890e['enableEmailPreview']:undefined;var _0xf2bd6d=_0x40a082[_0x367f('0x19')](function(_0x1bf8a0){return updateInteraction(_0x1bf8a0,_0x50e18d,_0x11822f,_0x56b12d);});return Promise[_0x367f('0x9d')](_0xf2bd6d);});}function countFilteredInteractions(_0x15d230,_0x138c39){var _0x9938d0=_0x15d230[_0x367f('0x9e')]();_0x9938d0[_0x367f('0xa')]('COUNT(*)');_0x9938d0[_0x367f('0xa')](_0x367f('0x75'),'unreadMessages');var _0x2b9923=utils[_0x367f('0x26')](_0x138c39);if(!_['isEmpty'](_0x2b9923)){_0x9938d0[_0x367f('0x9f')](_0x367f('0xa0'),_0x2b9923);}var _0x31c945={'type':db[_0x367f('0xa1')][_0x367f('0xa2')]['SELECT'],'raw':!![]};return db[_0x367f('0x70')]['query'](_0x9938d0[_0x367f('0x72')](),_0x31c945);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x4227=['i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','toString','findOne','enableEmailPreview','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','QueryTypes','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','role','agent','select','field','name','color','from','getInteractionFK','_interactions','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','buildExpression','type','default','text','start','value','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','map','tags','clause','ids','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','some','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','search','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','SELECT','query','keyBy','merge','attributes','forEach','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName'];(function(_0x1676a8,_0x538b74){var _0x1cee50=function(_0x33cf95){while(--_0x33cf95){_0x1676a8['push'](_0x1676a8['shift']());}};_0x1cee50(++_0x538b74);}(_0x4227,0xcf));var _0x7422=function(_0x91e16e,_0x298e3f){_0x91e16e=_0x91e16e-0x0;var _0x36798f=_0x4227[_0x91e16e];return _0x36798f;};'use strict';var _=require(_0x7422('0x0'));var squel=require(_0x7422('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x7422('0x2'));var updateInteraction=require(_0x7422('0x3'))[_0x7422('0x4')];var utils=require(_0x7422('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x117ad2,_0x24e8cb,_0x46dcf0){var _0xa8a04c=![];var _0x400cda=utils[_0x7422('0x6')](_0x117ad2);if(_0x24e8cb[_0x7422('0x7')]===_0x7422('0x8')&&!_0x46dcf0['search']&&!_0x46dcf0[_0x400cda]){_0xa8a04c=!![];}return _0xa8a04c;}function getTagsQuery(){return squel[_0x7422('0x9')]()[_0x7422('0xa')]('id')[_0x7422('0xa')](_0x7422('0xb'))[_0x7422('0xa')](_0x7422('0xc'))[_0x7422('0xd')]('tools_tags');}function getUsersQuery(_0x118f28,_0x3a49a0){var _0x4b3ae0=utils[_0x7422('0xe')](_0x118f28);var _0x366f1='user_has_'+_0x118f28+_0x7422('0xf');var _0x24a0d1=squel[_0x7422('0x9')]()['field'](_0x7422('0x10'))['field']('u.fullname')[_0x7422('0xa')](_0x7422('0x11')+_0x4b3ae0)[_0x7422('0xd')](_0x366f1,'ui')[_0x7422('0x12')](_0x7422('0x13'),'u',_0x7422('0x14'));if(_0x3a49a0[_0x7422('0x15')]>0x0){_0x24a0d1[_0x7422('0x16')]('ui.'+_0x4b3ae0+_0x7422('0x17'),_['map'](_0x3a49a0,'id'));}return _0x24a0d1;}function getInteractionsQuery(_0x18d576){var _0x44b7cc=utils[_0x7422('0x18')](_0x18d576);var _0x4afce6=utils[_0x7422('0x6')](_0x18d576);var _0x30cbe4=utils[_0x7422('0xe')](_0x18d576);return squel[_0x7422('0x9')]()['from'](_0x44b7cc['interactions'],'i')[_0x7422('0x12')](_0x7422('0x19'),'c',_0x7422('0x1a'))[_0x7422('0x12')](_0x7422('0x13'),'o','o.id\x20=\x20i.UserId')[_0x7422('0x12')](_0x44b7cc[_0x7422('0x1b')],'a',_0x7422('0x1c')+_0x4afce6)[_0x7422('0x12')](_0x44b7cc[_0x7422('0x1d')],'me',_0x7422('0x1e')+_0x30cbe4+_0x7422('0x1f'))['left_join'](_0x44b7cc[_0x7422('0x20')],'it',_0x7422('0x21')+_0x30cbe4+_0x7422('0x1f'))['left_join'](_0x7422('0x22'),'t',_0x7422('0x23'));}function getSqlClauses(){var _0x5191b4={'body':squel[_0x7422('0x24')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0x7422('0x24')](),'filter':squel['expr'](),'read':squel[_0x7422('0x24')](),'tags':{'clause':squel[_0x7422('0x24')](),'ids':null},'user':squel[_0x7422('0x24')]()};return _0x5191b4;}function parseTagParameter(_0x301e18){var _0x55e961=squel[_0x7422('0x24')]();if(_0x301e18){var _0x4fc550=utils[_0x7422('0x25')](_0x301e18);_0x4fc550['forEach'](function(_0x625ebe){_0x55e961['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x625ebe+',%');});}return _0x55e961;}function parseReadParameter(_0x4bc0d1){var _0x256d35='';if(_0x4bc0d1){_0x256d35=_0x7422('0x26');if(_0x4bc0d1==='1'){_0x256d35=_0x256d35['replace'](_0x7422('0x27'),'=');}else{_0x256d35=_0x256d35[_0x7422('0x28')](_0x7422('0x27'),'>');}}return _0x256d35;}function parseSearchFilter(_0x2ed16c,_0x556015){var _0x3396c3=squel[_0x7422('0x24')]();if(_0x556015){var _0x3c9243=_0x556015['replace']('\x5c','\x5c\x5c')[_0x7422('0x28')](/'/g,'\x27\x27');var _0x504399=qs['escapeLIKESpecialChars'](_0x3c9243);if(qs['isNumeric'](_0x3c9243)){_0x3396c3['or'](_0x7422('0x29'),_0x504399+'%');if([_0x7422('0x2a'),_0x7422('0x2b')][_0x7422('0x2c')](_0x2ed16c)){_0x3396c3['or'](_0x7422('0x2d'),_0x504399+'%');}else if(_0x2ed16c===_0x7422('0x2e')){_0x3396c3['or'](_0x7422('0x2f'),_0x504399+'%');}else if(_0x2ed16c===_0x7422('0x30')){_0x3396c3['or'](_0x7422('0x31'),_0x504399+'%');}}else if(_0x2ed16c==='mail'&&qs['isEmail'](_0x3c9243)){_0x3396c3['or'](_0x7422('0x32'),_0x504399+'%');}else{if(_0x2ed16c===_0x7422('0x33')){_0x3396c3['or'](_0x7422('0x34'),qs[_0x7422('0x35')](_0x3c9243,!![]))['or'](_0x7422('0x36'),qs[_0x7422('0x35')](_0x3c9243));}else if(_0x2ed16c!=='fax'){_0x3396c3['or'](_0x7422('0x37'),qs['getFullTextValue'](_0x3c9243));}_0x3396c3['or'](_0x7422('0x38'),qs[_0x7422('0x35')](_0x3c9243,!![]),null);}}return _0x3396c3;}function parseAdvancedSearchFilter(_0x235243,_0x4132d8){var _0x195563=getSqlClauses();var _0x18e224=as[_0x7422('0x39')](_0x235243);var _0x5ee799=_0x18e224['sqlOperator'];for(var _0x3ef693=0x0;_0x3ef693<_0x18e224[_0x7422('0x3a')][_0x7422('0x15')];_0x3ef693++){var _0x387755=_0x18e224['conditions'][_0x3ef693];var _0x23e5a8='i';var _0x39c218=_[_0x7422('0x3b')](_0x4132d8,[_0x7422('0xb'),_0x387755[_0x7422('0xa')]]);if(_0x39c218){var _0xa14089=as[_0x7422('0x3c')](_0x23e5a8,_0x39c218[_0x7422('0x3d')],_0x387755);_0x195563[_0x7422('0x3e')][_0x5ee799](_0xa14089[_0x7422('0x3f')],_0xa14089['value'][_0x7422('0x40')],_0xa14089[_0x7422('0x41')][_0x7422('0x42')]);}else{switch(_0x387755['field']){case _0x7422('0x43'):var _0x18d78d=parseReadParameter(_0x387755[_0x7422('0x41')]);_0x195563[_0x7422('0x44')][_0x7422('0x45')](_0x18d78d);break;case _0x7422('0x46'):if(_0x387755[_0x7422('0x47')]===_0x7422('0x48')){if(_0x387755[_0x7422('0x41')][_0x7422('0x49')]('\x20')[_0x7422('0x15')]>0x1){_0x195563[_0x7422('0x4a')][_0x5ee799](_0x7422('0x38'),qs[_0x7422('0x35')](_0x387755[_0x7422('0x41')],!![]),null);}else{var _0x514d13='%'+_0x387755[_0x7422('0x41')]+'%';_0x195563[_0x7422('0x4a')][_0x5ee799](_0x7422('0x4b'),_0x514d13,_0x514d13,_0x514d13);}}else{_0x39c218=_[_0x7422('0x3b')](_0x4132d8,[_0x7422('0xb'),_0x7422('0x4c')]);_0x387755[_0x7422('0xa')]=_0x7422('0x4c');_0xa14089=as[_0x7422('0x3c')](_0x23e5a8,_0x39c218['type'],_0x387755);_0x195563[_0x7422('0x4a')][_0x5ee799](_0xa14089[_0x7422('0x3f')],_0xa14089[_0x7422('0x41')]['start'],_0xa14089[_0x7422('0x41')][_0x7422('0x42')]);}break;case _0x7422('0x4d'):var _0x3d7831=_0x387755[_0x7422('0x41')][_0x7422('0x49')](',')[_0x7422('0x4e')](function(_0x3f4fe4){return Number(_0x3f4fe4);});var _0x59d828=parseTagParameter(_0x3d7831);_0x195563[_0x7422('0x4f')][_0x7422('0x50')][_0x7422('0x45')](_0x59d828);_0x195563[_0x7422('0x4f')][_0x7422('0x51')]=_0x3d7831;break;case'User':if(_0x387755[_0x7422('0x47')]===_0x7422('0x48')){_0x195563['user'][_0x5ee799](_0x7422('0x52'),'%'+_0x387755[_0x7422('0x41')]+'%',null);}else{_0x39c218=_[_0x7422('0x3b')](_0x4132d8,[_0x7422('0xb'),_0x7422('0x53')]);_0x387755[_0x7422('0xa')]=_0x7422('0x53');_0xa14089=as[_0x7422('0x3c')](_0x23e5a8,_0x39c218['type'],_0x387755);_0x195563['user'][_0x5ee799](_0xa14089[_0x7422('0x3f')],_0xa14089[_0x7422('0x41')]['start'],_0xa14089[_0x7422('0x41')][_0x7422('0x42')]);}break;case _0x7422('0x54'):case'plainBody':_0xa14089=as[_0x7422('0x3c')]('me',null,_0x387755);_0x195563[_0x7422('0x54')][_0x5ee799](_0xa14089['text'],_0xa14089[_0x7422('0x41')][_0x7422('0x40')],_0xa14089[_0x7422('0x41')][_0x7422('0x42')]);break;}}}return _0x195563;}function parseModelFields(_0x4d16fb,_0x5045cb,_0x54e6d0){var _0x38d7da=utils[_0x7422('0x6')](_0x4d16fb);var _0x160b1c=squel[_0x7422('0x24')]();var _0x349697=_(_0x5045cb)['keys']()['map'](function(_0x50a016){return _[_0x7422('0x55')](_0x54e6d0,[_0x7422('0xb'),_0x50a016])?_0x50a016:undefined;})[_0x7422('0x56')]()[_0x7422('0x41')]();if(_0x349697['length']>0x0){_0x349697['forEach'](function(_0x5af035){if(_0x5af035===_0x38d7da){_0x160b1c[_0x7422('0x45')]('i.'+_0x38d7da+_0x7422('0x17'),[][_0x7422('0x57')](_0x5045cb[_0x5af035]));}else if(_0x5af035===_0x7422('0x58')){var _0x41f7c3=JSON[_0x7422('0x59')](_0x5045cb[_0x5af035])[_0x7422('0x5a')];var _0x2df829=JSON['parse'](_0x5045cb[_0x5af035])[_0x7422('0x5b')];_0x160b1c[_0x7422('0x45')](_0x7422('0x5c'),_0x41f7c3,_0x2df829);}else{if(_0x5045cb[_0x5af035]===_0x7422('0x5d')){_0x160b1c[_0x7422('0x45')]('i.'+_0x5af035+'\x20IS\x20NULL');}else{_0x160b1c[_0x7422('0x45')]('i.'+_0x5af035+_0x7422('0x5e'),_0x5045cb[_0x5af035]);}}});}return _0x160b1c;}function parseQueryParameters(_0x44c337,_0x5ca4fe,_0x1f7ab6){var _0x30b39e=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x44c337,_0x5ca4fe,_0x1f7ab6);})[_0x7422('0x5f')](function(_0xc8f201){_0x30b39e[_0x7422('0x60')][_0x7422('0x45')](_0xc8f201);return parseReadParameter(_0x5ca4fe[_0x7422('0x44')]);})[_0x7422('0x5f')](function(_0x18915a){_0x30b39e[_0x7422('0x44')][_0x7422('0x45')](_0x18915a);return parseTagParameter(_0x5ca4fe[_0x7422('0x61')]);})[_0x7422('0x5f')](function(_0x3b55e0){_0x30b39e[_0x7422('0x4f')][_0x7422('0x50')][_0x7422('0x45')](_0x3b55e0);return parseSearchFilter(_0x44c337,_0x5ca4fe[_0x7422('0x62')]);})[_0x7422('0x5f')](function(_0x90292c){_0x30b39e[_0x7422('0x62')]=_0x90292c;return _0x30b39e;});}function checkAccountsRestrictions(_0x3f7b26,_0x9427f2,_0x185e50){var _0x5d1c77=utils['getAccountFK'](_0x3f7b26);var _0x1525ed=_0x7422('0x63')+_[_0x7422('0x64')](_0x3f7b26)+(_0x3f7b26===_0x7422('0x65')?_0x7422('0x66'):_0x7422('0x67'));var _0x437341=squel[_0x7422('0x24')]();return Promise['resolve']()['then'](function(){if(_0x185e50[_0x7422('0x68')]&&_0x9427f2[_0x7422('0x7')]==='agent'){return _0x9427f2[_0x1525ed]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x1b9ba9){if(_0x1b9ba9){if(_0x1b9ba9['length']===0x0){_0x437341[_0x7422('0x45')]('i.'+_0x5d1c77+'\x20IS\x20NULL');}else{_0x437341[_0x7422('0x45')]('i.'+_0x5d1c77+_0x7422('0x17'),_[_0x7422('0x4e')](_0x1b9ba9,'id'));}}else if(!_0x185e50[_0x5d1c77]){_0x437341['and']('i.'+_0x5d1c77+_0x7422('0x69'));}})['then'](function(){return _0x437341;});}function getClosedOrderClause(_0x3d4c03,_0x5ecd2f){var _0x1a8885='';var _0x54a4fd=[_0x7422('0x6a'),_0x7422('0x6b'),_0x7422('0x6c')];if(_0x3d4c03===_0x7422('0x33')){_0x54a4fd['unshift']('i.substatus');}if(_0x5ecd2f['closed']==='0'&&_0x3d4c03===_0x7422('0x33')){_0x1a8885=_0x7422('0x6d');}else{if(_0x5ecd2f[_0x7422('0x6e')]==='1'){_0x54a4fd[_0x7422('0x6f')]();}_0x1a8885=_0x7422('0x70')+_0x54a4fd[_0x7422('0x71')](',\x20')+')';}return _0x1a8885;}function getFilteredInteractions(_0x6c40ed,_0x5343d9,_0x31f29e,_0x2f8eb5){var _0x38ab52=utils['getInteractionFK'](_0x6c40ed);var _0x971606=_[_0x7422('0x64')](_0x6c40ed)+_0x7422('0x72');var _0x262d0e=[];var _0x312476=getTagsQuery();var _0x3f6c9e={'type':db[_0x7422('0x73')]['QueryTypes'][_0x7422('0x74')],'raw':!![]};var _0x1ebc0e=[];var _0xfcb4f5=[];return db['sequelize'][_0x7422('0x75')](_0x312476['toString'](),_0x3f6c9e)[_0x7422('0x5f')](function(_0x28532c){_0x262d0e=_[_0x7422('0x76')](_0x28532c,'id');_0x3f6c9e=_[_0x7422('0x77')](_0x3f6c9e,{'model':db[_0x971606],'mapToModel':!![],'nest':!![]});if(_0x31f29e[_0x7422('0x60')]){_0x2f8eb5[_0x7422('0x78')][_0x7422('0x79')](function(_0x224afd){_0x5343d9[_0x7422('0xa')]('i.'+_0x224afd);});}else{_0x5343d9['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x5343d9[_0x7422('0xa')](_0x7422('0x7a'),_0x7422('0x7b'));_0x5343d9['field'](_0x7422('0x7c'),_0x7422('0x7d'));if(_0x6c40ed===_0x7422('0x33')){_0x5343d9[_0x7422('0xa')](_0x7422('0x7e'),'Account.email');_0x5343d9[_0x7422('0xa')](_0x7422('0x7f'),_0x7422('0x80'));_0x5343d9[_0x7422('0xa')](_0x7422('0x81'));_0x5343d9[_0x7422('0xa')](_0x7422('0x82'));_0x5343d9[_0x7422('0xa')](_0x7422('0x83'));_0x5343d9[_0x7422('0xa')](_0x7422('0x84'));_0x5343d9[_0x7422('0xa')](_0x7422('0x85'));_0x5343d9[_0x7422('0xa')](_0x7422('0x86'));_0x5343d9['field'](_0x7422('0x87'));_0x5343d9[_0x7422('0xa')](_0x7422('0x88'));_0x5343d9['field'](_0x7422('0x89'));_0x5343d9[_0x7422('0xa')](_0x7422('0x6c'));_0x5343d9[_0x7422('0xa')]('i.secondDisposition');_0x5343d9[_0x7422('0xa')](_0x7422('0x6a'));_0x5343d9[_0x7422('0xa')](_0x7422('0x6d'));_0x5343d9[_0x7422('0xa')](_0x7422('0x8a'));_0x5343d9[_0x7422('0xa')](_0x7422('0x8b'));_0x5343d9[_0x7422('0xa')](_0x7422('0x8c'));_0x5343d9[_0x7422('0xa')](_0x7422('0x8d'));}else if(_0x6c40ed===_0x7422('0x30')){_0x5343d9[_0x7422('0xa')](_0x7422('0x8e'),_0x7422('0x80'));}else{_0x5343d9[_0x7422('0xa')](_0x7422('0x8f'),_0x7422('0x80'));}if(_0x6c40ed!==_0x7422('0x33')){_0x5343d9['field'](_0x7422('0x90'));}_0x5343d9['field'](_0x7422('0x91'),_0x7422('0x92'));_0x5343d9[_0x7422('0xa')](_0x7422('0x93'),'Contact.lastName');_0x5343d9[_0x7422('0xa')](_0x7422('0x94'),_0x7422('0x95'));_0x5343d9[_0x7422('0xa')]('c.phone','Contact.phone');_0x5343d9[_0x7422('0xa')](_0x7422('0x96'),'Contact.mobile');_0x5343d9[_0x7422('0xa')](_0x7422('0x97'),'Contact.fax');_0x5343d9[_0x7422('0xa')](_0x7422('0x98'),_0x7422('0x99'));_0x5343d9[_0x7422('0xa')]('o.internal',_0x7422('0x9a'));_0x5343d9[_0x7422('0xa')](_0x7422('0x9b'),_0x7422('0x9c'));}if(_0x2f8eb5[_0x7422('0x9d')]){_0x5343d9['limit'](_0x2f8eb5[_0x7422('0x9d')]);}if(_0x2f8eb5[_0x7422('0x9e')]){_0x5343d9[_0x7422('0x9e')](_0x2f8eb5[_0x7422('0x9e')]);}return db[_0x7422('0x9f')][_0x7422('0x75')](_0x5343d9[_0x7422('0xa0')](),_0x3f6c9e);})[_0x7422('0x5f')](function(_0x2b7d28){_0x1ebc0e=_0x2b7d28;var _0x5cffc9=getUsersQuery(_0x6c40ed,_0x1ebc0e);return db['sequelize'][_0x7422('0x75')](_0x5cffc9['toString'](),_0x3f6c9e);})[_0x7422('0x5f')](function(_0x237283){_0xfcb4f5=_['groupBy'](_0x237283,_0x38ab52);if(_0x6c40ed==='mail'){return db['Setting'][_0x7422('0xa1')]({'attributes':[_0x7422('0xa2')],'raw':!![]});}})[_0x7422('0x5f')](function(_0x42bcb2){var _0x1f7adc=_0x42bcb2?_0x42bcb2[_0x7422('0xa2')]:undefined;var _0x1d1e72=_0x1ebc0e['map'](function(_0x12bd72){return updateInteraction(_0x12bd72,_0x262d0e,_0xfcb4f5,_0x1f7adc);});return Promise['all'](_0x1d1e72);});}function countFilteredInteractions(_0x5704e4,_0x52c2f1){var _0x56f82e=_0x5704e4['clone']();_0x56f82e['field'](_0x7422('0xa3'));_0x56f82e['field'](_0x7422('0xa4'),'unreadMessages');var _0x3dca07=utils[_0x7422('0x25')](_0x52c2f1);if(!_[_0x7422('0xa5')](_0x3dca07)){_0x56f82e[_0x7422('0x16')](_0x7422('0xa6'),_0x3dca07);}var _0x5c915d={'type':db[_0x7422('0x73')][_0x7422('0xa7')]['SELECT'],'raw':!![]};return db[_0x7422('0x9f')][_0x7422('0x75')](_0x56f82e[_0x7422('0xa0')](),_0x5c915d);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index de5414c..2f93bfc 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 _0x1167=['Users','TagIds','Tags','catch','lodash','../../mysqldb','map','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','-id','then','lastMsgText','trimStart','plainBody','updateInteraction'];(function(_0x39442c,_0x5da9ad){var _0x200a0c=function(_0x1a79c1){while(--_0x1a79c1){_0x39442c['push'](_0x39442c['shift']());}};_0x200a0c(++_0x5da9ad);}(_0x1167,0x199));var _0x7116=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1167[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7116('0x0'));var db=require(_0x7116('0x1'))['db'];function getInteractionUsers(_0x13b369,_0x36fd62){return new Promise(function(_0x2aed6b,_0x5b5368){try{var _0x5ae153=[];if(_0x36fd62[_0x13b369]){_0x5ae153=_0x36fd62[_0x13b369][_0x7116('0x2')](function(_0x1c7781){return{'id':_0x1c7781['id'],'fullname':_0x1c7781['fullname']};});}return _0x2aed6b(_0x5ae153);}catch(_0x231ff7){_0x5b5368(_0x231ff7);}});}function getInteractionTags(_0x4d5825,_0x239a4d){var _0x1ae84c=[];if(_0x4d5825){_0x4d5825[_0x7116('0x3')](',')[_0x7116('0x4')](function(_0x3edf2c){_0x1ae84c[_0x7116('0x5')](_0x239a4d[_0x3edf2c]);});}return _0x1ae84c;}function updateWaitingCounter(_0x2fa2b4){if(_0x2fa2b4[_0x7116('0x6')]){_0x2fa2b4[_0x7116('0x6')]-=0x1;}}function updateInteractionCounters(_0x11e4e4){_0x11e4e4[_0x7116('0x6')]=0x0;_0x11e4e4[_0x7116('0x7')]=0x0;_0x11e4e4[_0x7116('0x8')]=0x0;_0x11e4e4[_0x7116('0x9')]=0x0;_0x11e4e4[_0x7116('0xa')]=0x0;_0x11e4e4[_0x7116('0xb')]=0x0;if(_0x11e4e4[_0x7116('0xc')]){if(_0x11e4e4[_0x7116('0xd')]===_0x7116('0xa')){_0x11e4e4[_0x7116('0xa')]+=0x1;updateWaitingCounter(_0x11e4e4);}if(_0x11e4e4[_0x7116('0xe')]){_0x11e4e4[_0x7116('0x8')]+=0x1;if(_0x11e4e4[_0x7116('0x7')]){_0x11e4e4['talking']-=0x1;}}else{if(_0x11e4e4[_0x7116('0xd')]){_0x11e4e4[_0x7116('0x9')]+=0x1;updateWaitingCounter(_0x11e4e4);}}}else{if(!_0x11e4e4[_0x7116('0xe')]){_0x11e4e4['waiting']+=0x1;}if(_0x11e4e4[_0x7116('0xe')]){_0x11e4e4[_0x7116('0x7')]+=0x1;updateWaitingCounter(_0x11e4e4);}}_0x11e4e4[_0x7116('0xb')]+=0x1;return _0x11e4e4;}function getLastMessageText(_0x53fbd3){return db[_0x7116('0xf')][_0x7116('0x10')]({'where':{'$and':[{'MailInteractionId':_0x53fbd3['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x7116('0x11'),'raw':!![]})[_0x7116('0x12')](function(_0x577a8d){if(_0x577a8d&&_0x577a8d['plainBody']){_0x53fbd3[_0x7116('0x13')]=_[_0x7116('0x14')](_0x577a8d[_0x7116('0x15')]);}return _0x53fbd3;})['catch'](function(_0x532495){throw _0x532495;});}exports[_0x7116('0x16')]=function(_0x385aa4,_0xbb83e6,_0x4637d2,_0x5270f8){return new Promise(function(_0xb2b3db,_0x170ba6){return getInteractionUsers(_0x385aa4['id'],_0x4637d2)[_0x7116('0x12')](function(_0x34083c){_0x385aa4[_0x7116('0x17')]=_0x34083c;return getInteractionTags(_0x385aa4[_0x7116('0x18')],_0xbb83e6);})['then'](function(_0x3afec6){_0x385aa4[_0x7116('0x19')]=_0x3afec6;delete _0x385aa4[_0x7116('0x18')];return updateInteractionCounters(_0x385aa4);})['then'](function(_0x3f64fe){if(_0x5270f8){return getLastMessageText(_0x3f64fe);}else{return _0x3f64fe;}})[_0x7116('0x12')](function(_0x4d9928){_0xb2b3db(_0x4d9928);})[_0x7116('0x1a')](function(_0x5a4333){_0x170ba6(_0x5a4333);});});}; \ No newline at end of file +var _0x7db5=['then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','map','fullname','split','forEach','push','waiting','talking','answered','unmanaged','total','closed','disposition','abandoned','UserId','MailMessage','findOne','out','plainBody','-id'];(function(_0x2b186f,_0x3addfa){var _0x569ebd=function(_0x1df920){while(--_0x1df920){_0x2b186f['push'](_0x2b186f['shift']());}};_0x569ebd(++_0x3addfa);}(_0x7db5,0x13c));var _0x57db=function(_0x55659c,_0x56a592){_0x55659c=_0x55659c-0x0;var _0x5f198c=_0x7db5[_0x55659c];return _0x5f198c;};'use strict';var _=require(_0x57db('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x578a46,_0x12406c){return new Promise(function(_0x4104b1,_0x256a7b){try{var _0x50f153=[];if(_0x12406c[_0x578a46]){_0x50f153=_0x12406c[_0x578a46][_0x57db('0x1')](function(_0x55106d){return{'id':_0x55106d['id'],'fullname':_0x55106d[_0x57db('0x2')]};});}return _0x4104b1(_0x50f153);}catch(_0x318220){_0x256a7b(_0x318220);}});}function getInteractionTags(_0x5b0b4c,_0x8e4e99){var _0x58ff14=[];if(_0x5b0b4c){_0x5b0b4c[_0x57db('0x3')](',')[_0x57db('0x4')](function(_0x5a2597){_0x58ff14[_0x57db('0x5')](_0x8e4e99[_0x5a2597]);});}return _0x58ff14;}function updateWaitingCounter(_0x381eda){if(_0x381eda[_0x57db('0x6')]){_0x381eda[_0x57db('0x6')]-=0x1;}}function updateInteractionCounters(_0xc100d9){_0xc100d9[_0x57db('0x6')]=0x0;_0xc100d9[_0x57db('0x7')]=0x0;_0xc100d9[_0x57db('0x8')]=0x0;_0xc100d9[_0x57db('0x9')]=0x0;_0xc100d9['abandoned']=0x0;_0xc100d9[_0x57db('0xa')]=0x0;if(_0xc100d9[_0x57db('0xb')]){if(_0xc100d9[_0x57db('0xc')]===_0x57db('0xd')){_0xc100d9[_0x57db('0xd')]+=0x1;updateWaitingCounter(_0xc100d9);}if(_0xc100d9[_0x57db('0xe')]){_0xc100d9['answered']+=0x1;if(_0xc100d9[_0x57db('0x7')]){_0xc100d9[_0x57db('0x7')]-=0x1;}}else{if(_0xc100d9[_0x57db('0xc')]){_0xc100d9['unmanaged']+=0x1;updateWaitingCounter(_0xc100d9);}}}else{if(!_0xc100d9[_0x57db('0xe')]){_0xc100d9[_0x57db('0x6')]+=0x1;}if(_0xc100d9[_0x57db('0xe')]){_0xc100d9[_0x57db('0x7')]+=0x1;updateWaitingCounter(_0xc100d9);}}_0xc100d9[_0x57db('0xa')]+=0x1;return _0xc100d9;}function getLastMessageText(_0x1bc5d2){return db[_0x57db('0xf')][_0x57db('0x10')]({'where':{'$and':[{'MailInteractionId':_0x1bc5d2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x57db('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x57db('0x12')],'order':_0x57db('0x13'),'raw':!![]})[_0x57db('0x14')](function(_0x1b5b03){if(_0x1b5b03&&_0x1b5b03[_0x57db('0x12')]){_0x1bc5d2[_0x57db('0x15')]=_[_0x57db('0x16')](_0x1b5b03[_0x57db('0x12')]);}return _0x1bc5d2;})[_0x57db('0x17')](function(_0x482361){throw _0x482361;});}exports[_0x57db('0x18')]=function(_0x5b4cdf,_0x36cf9f,_0x4135b3,_0x510a8f){return new Promise(function(_0x482f72,_0x247ddb){return getInteractionUsers(_0x5b4cdf['id'],_0x4135b3)[_0x57db('0x14')](function(_0x2d2784){_0x5b4cdf[_0x57db('0x19')]=_0x2d2784;return getInteractionTags(_0x5b4cdf[_0x57db('0x1a')],_0x36cf9f);})[_0x57db('0x14')](function(_0x155873){_0x5b4cdf[_0x57db('0x1b')]=_0x155873;delete _0x5b4cdf[_0x57db('0x1a')];return updateInteractionCounters(_0x5b4cdf);})[_0x57db('0x14')](function(_0x35e0fe){if(_0x510a8f){return getLastMessageText(_0x35e0fe);}else{return _0x35e0fe;}})['then'](function(_0x5bc299){_0x482f72(_0x5bc299);})[_0x57db('0x17')](function(_0x4fdbb4){_0x247ddb(_0x4fdbb4);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index c3062ba..5c6bf6c 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 _0x7f9c=['Interaction','findOne','then','update','info','error','name','stringify','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20body=','lodash','../../mysqldb','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','toUpperCase','role','null'];(function(_0x51b973,_0x26c0f6){var _0x37ac06=function(_0x221ab6){while(--_0x221ab6){_0x51b973['push'](_0x51b973['shift']());}};_0x37ac06(++_0x26c0f6);}(_0x7f9c,0x174));var _0xc7f9=function(_0x1f1c27,_0x3d5a0b){_0x1f1c27=_0x1f1c27-0x0;var _0x334749=_0x7f9c[_0x1f1c27];return _0x334749;};'use strict';var _=require(_0xc7f9('0x0'));var db=require(_0xc7f9('0x1'))['db'];var loggers={'openchannel':require(_0xc7f9('0x2'))('openchannel-interactions'),'mail':require(_0xc7f9('0x2'))('mail-interactions'),'fax':require(_0xc7f9('0x2'))(_0xc7f9('0x3')),'sms':require(_0xc7f9('0x2'))(_0xc7f9('0x4')),'chat':require(_0xc7f9('0x2'))(_0xc7f9('0x5')),'whatsapp':require(_0xc7f9('0x2'))(_0xc7f9('0x6'))};function getAccountFK(_0x59ba28){return _[_0xc7f9('0x7')](_0x59ba28)+(_0x59ba28===_0xc7f9('0x8')?_0xc7f9('0x9'):_0xc7f9('0xa'))+'Id';}function getInteractionFK(_0x427253){return _[_0xc7f9('0x7')](_0x427253)+'InteractionId';}function getInteractionId(_0x51ca8f,_0x501fe8,_0x53c227){if(_0x51ca8f&&_0x51ca8f[_[_0xc7f9('0xb')](_0x53c227)+_0xc7f9('0xc')]){return _0x51ca8f[_[_0xc7f9('0xb')](_0x53c227)+'InteractionId'];}else if(_0x51ca8f&&_0x51ca8f['id']){return _0x51ca8f['id'];}else if(_0x501fe8&&_0x501fe8['id']){return _0x501fe8['id'];}else{return _0xc7f9('0xd');}}function getInteractionsTables(_0xf86771){return{'accounts':_0xf86771+'_'+(_0xf86771===_0xc7f9('0x8')?_0xc7f9('0xe'):_0xc7f9('0xf')),'interactions':_0xf86771+_0xc7f9('0x10'),'interactionsTags':_0xf86771+_0xc7f9('0x11'),'messages':_0xf86771+_0xc7f9('0x12'),'userInteractions':'user_has_'+_0xf86771+_0xc7f9('0x10')};}function getSelectedTags(_0x1b0d79){var _0x11a7ed=[];if(_0x1b0d79){_0x11a7ed=Array[_0xc7f9('0x13')](_0x1b0d79)?_0x1b0d79:[_0x1b0d79];}return _0x11a7ed;}function log(_0x50022a,_0x45ec8c,_0x603246,_0x5a3006,_0x3372dd,_0x4650cc){loggers[_0x3372dd[_0xc7f9('0x14')]()][_0x50022a]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4650cc[_0xc7f9('0x15')](),_0x45ec8c?_0x45ec8c['id']:null,_0x45ec8c?_0x45ec8c['name']:null,_0x45ec8c?_0x45ec8c[_0xc7f9('0x16')]:null,getInteractionId(_0x603246,_0x5a3006,_0x3372dd),_0x603246?JSON['stringify'](_0x603246):_0xc7f9('0x17'));}function updateUser(_0x2e32ec,_0x58ca53,_0x343e42,_0x5de9e8,_0x1db7d7){db[_[_0xc7f9('0xb')](_0x5de9e8)+_0xc7f9('0x18')][_0xc7f9('0x19')]({'where':{'id':getInteractionId(_0x58ca53,_0x343e42,_0x5de9e8)}})[_0xc7f9('0x1a')](function(_0x5348e6){if(_0x5348e6){return _0x5348e6[_0xc7f9('0x1b')]({'UserId':_0x2e32ec?_0x2e32ec['id']:null});}})[_0xc7f9('0x1a')](function(_0x4d37cb){if(_0x4d37cb){log(_0xc7f9('0x1c'),_0x2e32ec,_0x58ca53,_0x343e42,_0x5de9e8,_0x1db7d7);}})['catch'](function(){log(_0xc7f9('0x1d'),_0x2e32ec,_0x58ca53,_0x343e42,_0x5de9e8,_0x1db7d7);});}function logAcceptMessage(_0x2de59a,_0x46c8e4,_0x5b7643,_0x4253bc){var _0x5d3083=loggers[_0x2de59a[_0xc7f9('0x14')]()];var _0x57cccb=_0x46c8e4['id'];var _0x1f6244=_0x46c8e4[_0xc7f9('0x1e')];var _0x10e6dd=_0x46c8e4['role'];var _0x2a20fb=JSON[_0xc7f9('0x1f')](_0x4253bc||null);_0x5d3083['info']('['+_0x2de59a[_0xc7f9('0x15')]()+_0xc7f9('0x20')+_0x57cccb+_0xc7f9('0x21')+_0x1f6244+_0xc7f9('0x22')+_0x10e6dd+'\x20interaction='+_0x5b7643+_0xc7f9('0x23')+_0x2a20fb);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x929f=['websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','null','Interaction','findOne','then','info','catch','error','toLowerCase','name','role','\x20role=','\x20interaction=','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst'];(function(_0x31e1a9,_0x5ce674){var _0x5ec9d3=function(_0x48440c){while(--_0x48440c){_0x31e1a9['push'](_0x31e1a9['shift']());}};_0x5ec9d3(++_0x5ce674);}(_0x929f,0x193));var _0xf929=function(_0x58b9d6,_0x3100d5){_0x58b9d6=_0x58b9d6-0x0;var _0x1ee77e=_0x929f[_0x58b9d6];return _0x1ee77e;};'use strict';var _=require(_0xf929('0x0'));var db=require(_0xf929('0x1'))['db'];var loggers={'openchannel':require(_0xf929('0x2'))(_0xf929('0x3')),'mail':require(_0xf929('0x2'))(_0xf929('0x4')),'fax':require(_0xf929('0x2'))(_0xf929('0x5')),'sms':require(_0xf929('0x2'))(_0xf929('0x6')),'chat':require(_0xf929('0x2'))(_0xf929('0x7')),'whatsapp':require(_0xf929('0x2'))(_0xf929('0x8'))};function getAccountFK(_0x4fb6f0){return _[_0xf929('0x9')](_0x4fb6f0)+(_0x4fb6f0===_0xf929('0xa')?_0xf929('0xb'):_0xf929('0xc'))+'Id';}function getInteractionFK(_0x453edc){return _[_0xf929('0x9')](_0x453edc)+_0xf929('0xd');}function getInteractionId(_0x3f5969,_0x35fb91,_0x1aa196){if(_0x3f5969&&_0x3f5969[_[_0xf929('0xe')](_0x1aa196)+_0xf929('0xd')]){return _0x3f5969[_['upperFirst'](_0x1aa196)+_0xf929('0xd')];}else if(_0x3f5969&&_0x3f5969['id']){return _0x3f5969['id'];}else if(_0x35fb91&&_0x35fb91['id']){return _0x35fb91['id'];}else{return'unknown';}}function getInteractionsTables(_0xc941a2){return{'accounts':_0xc941a2+'_'+(_0xc941a2===_0xf929('0xa')?_0xf929('0xf'):_0xf929('0x10')),'interactions':_0xc941a2+_0xf929('0x11'),'interactionsTags':_0xc941a2+_0xf929('0x12'),'messages':_0xc941a2+_0xf929('0x13'),'userInteractions':_0xf929('0x14')+_0xc941a2+'_interactions'};}function getSelectedTags(_0x3b01d3){var _0x41eae3=[];if(_0x3b01d3){_0x41eae3=Array[_0xf929('0x15')](_0x3b01d3)?_0x3b01d3:[_0x3b01d3];}return _0x41eae3;}function log(_0x36ddb9,_0x1187f4,_0x268e8e,_0x5b6f2f,_0x619ca5,_0x296e47){loggers[_0x619ca5['toLowerCase']()][_0x36ddb9](_0xf929('0x16'),_0x296e47[_0xf929('0x17')](),_0x1187f4?_0x1187f4['id']:null,_0x1187f4?_0x1187f4['name']:null,_0x1187f4?_0x1187f4['role']:null,getInteractionId(_0x268e8e,_0x5b6f2f,_0x619ca5),_0x268e8e?JSON[_0xf929('0x18')](_0x268e8e):_0xf929('0x19'));}function updateUser(_0x1e0704,_0x242d00,_0x4326f1,_0x1c0926,_0x362eee){db[_[_0xf929('0xe')](_0x1c0926)+_0xf929('0x1a')][_0xf929('0x1b')]({'where':{'id':getInteractionId(_0x242d00,_0x4326f1,_0x1c0926)}})[_0xf929('0x1c')](function(_0x1eeecb){if(_0x1eeecb){return _0x1eeecb['update']({'UserId':_0x1e0704?_0x1e0704['id']:null});}})[_0xf929('0x1c')](function(_0x12ccc7){if(_0x12ccc7){log(_0xf929('0x1d'),_0x1e0704,_0x242d00,_0x4326f1,_0x1c0926,_0x362eee);}})[_0xf929('0x1e')](function(){log(_0xf929('0x1f'),_0x1e0704,_0x242d00,_0x4326f1,_0x1c0926,_0x362eee);});}function logAcceptMessage(_0x26b020,_0x3d9f41,_0x1a367e,_0x49b299){var _0x34d36b=loggers[_0x26b020[_0xf929('0x20')]()];var _0x4cdecd=_0x3d9f41['id'];var _0x113b71=_0x3d9f41[_0xf929('0x21')];var _0x59b973=_0x3d9f41[_0xf929('0x22')];var _0x513183=JSON[_0xf929('0x18')](_0x49b299||null);_0x34d36b[_0xf929('0x1d')]('['+_0x26b020[_0xf929('0x17')]()+'MESSAGE:ACCEPT]\x20id='+_0x4cdecd+'\x20name='+_0x113b71+_0xf929('0x23')+_0x59b973+_0xf929('0x24')+_0x1a367e+'\x20body='+_0x513183);}module[_0xf929('0x25')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 7c4ff45..0fc17a6 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 _0xcd06=['admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','use','License','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users'];(function(_0x1f3ff7,_0x59ce30){var _0x4b41ff=function(_0x5857d9){while(--_0x5857d9){_0x1f3ff7['push'](_0x1f3ff7['shift']());}};_0x4b41ff(++_0x59ce30);}(_0xcd06,0x1b3));var _0x6cd0=function(_0x4a040f,_0x26c250){_0x4a040f=_0x4a040f-0x0;var _0xa67cb0=_0xcd06[_0x4a040f];return _0xa67cb0;};'use strict';var crypto=require(_0x6cd0('0x0'));var util=require(_0x6cd0('0x1'));var compose=require(_0x6cd0('0x2'));var db=require(_0x6cd0('0x3'))['db'];var config=require(_0x6cd0('0x4'));function getValueFromLicense(_0x35f0cc,_0xe8d48c){if(_0x35f0cc&&_0xe8d48c){if(_0xe8d48c[_0x6cd0('0x5')]&&_0xe8d48c['license']){var _0x1b4268=_0xe8d48c[_0x6cd0('0x5')];var _0x48d8c6=_0xe8d48c[_0x6cd0('0x6')];var _0x523419=_0x1b4268[_0x6cd0('0x7')]('-')[0x4];var _0x50cb97=_0x1b4268[_0x6cd0('0x7')]('-')[0x0];var _0x41b131=crypto[_0x6cd0('0x8')]('aes-256-ctr',util[_0x6cd0('0x9')](_0x6cd0('0xa'),_0x523419,_0x1b4268,_0x50cb97));var _0x1bad23=_0x41b131[_0x6cd0('0xb')](_0x48d8c6,_0x6cd0('0xc'),'utf8');_0x1bad23+=_0x41b131[_0x6cd0('0xd')](_0x6cd0('0xe'));var _0x306dd8=JSON[_0x6cd0('0xf')](_0x1bad23);return _0x306dd8[_0x6cd0('0x10')](_0x35f0cc)?_0x306dd8[_0x35f0cc]:null;}}return null;}function isLimit(_0x4456e6,_0x4d2318,_0xc8ed39,_0x7621fe){var _0x517c8f=_0x4d2318;return compose()[_0x6cd0('0x11')](function(_0x6164a5,_0x4319c8,_0x21a3b0){return db[_0x6cd0('0x12')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1ce821){var _0x1ddab0=getValueFromLicense(_0x4456e6,_0x1ce821);return _0x1ddab0?_0x1ddab0:_0x517c8f;})[_0x6cd0('0x13')](function(_0x4929bf){_0x517c8f=_0x4929bf;return _0xc8ed39[_0x6cd0('0x14')](_0x7621fe);})[_0x6cd0('0x13')](function(_0x3cfd0d){if(_0x3cfd0d>=_0x517c8f){return _0x4319c8['status'](0x193)['json']({'message':util[_0x6cd0('0x9')](_0x6cd0('0x15'),_0x4456e6)});}_0x21a3b0();})[_0x6cd0('0x16')](function(_0x11c4f5){_0x21a3b0(_0x11c4f5);});});}function isUserLimit(){return isLimit(_0x6cd0('0x17'),0x1,db['User'],{'where':{'$or':[{'role':_0x6cd0('0x18')},{'role':_0x6cd0('0x19')}]}});}exports[_0x6cd0('0x1a')]=isUserLimit; \ No newline at end of file +var _0xac47=['count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','update','base64','utf8','parse','use','then'];(function(_0x41a45d,_0x1e61c3){var _0x24b1d6=function(_0x5d1f8b){while(--_0x5d1f8b){_0x41a45d['push'](_0x41a45d['shift']());}};_0x24b1d6(++_0x1e61c3);}(_0xac47,0x11c));var _0x7ac4=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0xac47[_0x5a7d41];return _0x98d8fa;};'use strict';var crypto=require('crypto');var util=require(_0x7ac4('0x0'));var compose=require(_0x7ac4('0x1'));var db=require(_0x7ac4('0x2'))['db'];var config=require(_0x7ac4('0x3'));function getValueFromLicense(_0x550e08,_0x55336a){if(_0x550e08&&_0x55336a){if(_0x55336a[_0x7ac4('0x4')]&&_0x55336a[_0x7ac4('0x5')]){var _0x10e258=_0x55336a[_0x7ac4('0x4')];var _0x1b6d5c=_0x55336a[_0x7ac4('0x5')];var _0x19f29b=_0x10e258[_0x7ac4('0x6')]('-')[0x4];var _0x361523=_0x10e258['split']('-')[0x0];var _0x48f935=crypto['createDecipher'](_0x7ac4('0x7'),util[_0x7ac4('0x8')]('%s:%s:%s',_0x19f29b,_0x10e258,_0x361523));var _0x43f353=_0x48f935[_0x7ac4('0x9')](_0x1b6d5c,_0x7ac4('0xa'),'utf8');_0x43f353+=_0x48f935['final'](_0x7ac4('0xb'));var _0x3a0d2b=JSON[_0x7ac4('0xc')](_0x43f353);return _0x3a0d2b['hasOwnProperty'](_0x550e08)?_0x3a0d2b[_0x550e08]:null;}}return null;}function isLimit(_0x1af264,_0x16c5c8,_0x596af5,_0x464704){var _0x34f8a8=_0x16c5c8;return compose()[_0x7ac4('0xd')](function(_0x478765,_0x179ebc,_0x551f59){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0x7ac4('0xe')](function(_0x55bafe){var _0x1b1bbc=getValueFromLicense(_0x1af264,_0x55bafe);return _0x1b1bbc?_0x1b1bbc:_0x34f8a8;})[_0x7ac4('0xe')](function(_0x107df1){_0x34f8a8=_0x107df1;return _0x596af5[_0x7ac4('0xf')](_0x464704);})[_0x7ac4('0xe')](function(_0x3efa56){if(_0x3efa56>=_0x34f8a8){return _0x179ebc[_0x7ac4('0x10')](0x193)[_0x7ac4('0x11')]({'message':util[_0x7ac4('0x8')](_0x7ac4('0x12'),_0x1af264)});}_0x551f59();})['catch'](function(_0x291546){_0x551f59(_0x291546);});});}function isUserLimit(){return isLimit(_0x7ac4('0x13'),0x1,db['User'],{'where':{'$or':[{'role':_0x7ac4('0x14')},{'role':_0x7ac4('0x15')}]}});}exports[_0x7ac4('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ad06bbb..07de19a 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 _0xc19f=['split','slice','shift','match','forEach','indexOf','map','conditions','push','buildExpression','DATE','$eq','$between','value','includes','operator','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$lte','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]'];(function(_0x308cdf,_0xfbdffe){var _0x1619fd=function(_0x25dc02){while(--_0x25dc02){_0x308cdf['push'](_0x308cdf['shift']());}};_0x1619fd(++_0xfbdffe);}(_0xc19f,0x110));var _0xfc19=function(_0x2d17ec,_0x54eb4d){_0x2d17ec=_0x2d17ec-0x0;var _0x162002=_0xc19f[_0x2d17ec];return _0x162002;};'use strict';var _=require(_0xfc19('0x0'));var moment=require(_0xfc19('0x1'));exports['parseSearch']=function(_0x199cf4){var _0x57997b={'conditions':[]};_0x57997b[_0xfc19('0x2')]=_[_0xfc19('0x3')](_0x199cf4,_0xfc19('0x4'))?'or':_0xfc19('0x5');var _0x219d82=_0x199cf4[_0xfc19('0x6')](_0xfc19('0x7'),'')['replace'](_0xfc19('0x4'),'')[_0xfc19('0x8')]('||');for(var _0x4e50e9=0x0;_0x4e50e9<_0x219d82['length'];_0x4e50e9++){var _0x54453b=_0x219d82[_0x4e50e9][_0xfc19('0x8')](':=');var _0x2fc6c8=_0x54453b[0x0];var _0x1b232d=_0x54453b[_0xfc19('0x9')](0x1);_0x1b232d['forEach'](function(_0x450f6f){var _0x31b943=_0x450f6f[_0xfc19('0x8')]('[')[_0xfc19('0xa')]();var _0x45caeb=_0x450f6f[_0xfc19('0xb')](/\[(.*?)\]/g);_0x45caeb[_0xfc19('0xc')](function(_0x5666c3){var _0x3a7f12=_0x5666c3[_0xfc19('0x8')]('[')['filter'](function(_0x8853c5){return _0x8853c5[_0xfc19('0xd')](']')>-0x1;})[_0xfc19('0xe')](function(_0x1d3ec2){return _0x1d3ec2[_0xfc19('0x8')](']')[0x0];})[0x0];_0x57997b[_0xfc19('0xf')][_0xfc19('0x10')]({'field':_0x2fc6c8,'operator':_0x31b943,'value':_0x3a7f12});});});}return _0x57997b;};exports[_0xfc19('0x11')]=function(_0x7c5354,_0x13a9a2,_0x1ebdd4){var _0x78a6c6={};if(_0x13a9a2===_0xfc19('0x12')){if(_0x1ebdd4['operator']===_0xfc19('0x13')){_0x1ebdd4['operator']=_0xfc19('0x14');_0x1ebdd4[_0xfc19('0x15')]+=','+_0x1ebdd4[_0xfc19('0x15')];}else if(_[_0xfc19('0x16')](['$gt','$lte'],_0x1ebdd4[_0xfc19('0x17')])){_0x1ebdd4['value']=moment(_0x1ebdd4[_0xfc19('0x15')])[_0xfc19('0x18')](0x1,'days')[_0xfc19('0x19')](_0xfc19('0x1a'));}}if(_0x1ebdd4[_0xfc19('0x1b')]){_0x13a9a2=_0x1ebdd4[_0xfc19('0x1b')];_0x78a6c6[_0xfc19('0x1c')]=_0xfc19('0x1d')+_0x7c5354+'.'+_0x1ebdd4[_0xfc19('0x1e')]+_0xfc19('0x1f')+_0x1ebdd4[_0xfc19('0x1b')]+')\x20'+parseOperator(_0x1ebdd4[_0xfc19('0x17')]);}else{_0x78a6c6[_0xfc19('0x1c')]=_0x7c5354+'.'+_0x1ebdd4[_0xfc19('0x1e')]+'\x20'+parseOperator(_0x1ebdd4[_0xfc19('0x17')]);}if(_[_0xfc19('0x16')]([_0xfc19('0x20'),_0xfc19('0x21')],_0x1ebdd4[_0xfc19('0x17')]))_0x78a6c6[_0xfc19('0x1c')]='('+_0x78a6c6[_0xfc19('0x1c')]+_0xfc19('0x22')+_0x7c5354+'.'+_0x1ebdd4[_0xfc19('0x1e')]+_0xfc19('0x23');_0x78a6c6['value']=parseValue(_0x13a9a2,_0x1ebdd4[_0xfc19('0x17')],_0x1ebdd4[_0xfc19('0x15')]);return _0x78a6c6;};function parseOperator(_0x2b3a54){var _0x66e0ac;switch(_0x2b3a54){case _0xfc19('0x24'):_0x66e0ac=_0xfc19('0x25');break;case _0xfc19('0x21'):_0x66e0ac='NOT\x20IN\x20?';break;case'$eq':_0x66e0ac=_0xfc19('0x26');break;case'$ne':_0x66e0ac=_0xfc19('0x27');break;case _0xfc19('0x28'):case _0xfc19('0x29'):case _0xfc19('0x2a'):_0x66e0ac=_0xfc19('0x2b');break;case _0xfc19('0x2c'):_0x66e0ac=_0xfc19('0x2d');break;case _0xfc19('0x2e'):_0x66e0ac=_0xfc19('0x2f');break;case _0xfc19('0x30'):_0x66e0ac='<=\x20?';break;case _0xfc19('0x31'):_0x66e0ac=_0xfc19('0x32');break;case _0xfc19('0x14'):_0x66e0ac=_0xfc19('0x33');break;}return _0x66e0ac;}function parseValue(_0x47adb3,_0x446ebe,_0x42aaa8){var _0x362e0e={'start':undefined,'end':undefined};switch(_0x446ebe){case'$in':case _0xfc19('0x21'):_0x362e0e['start']=_0x42aaa8[_0xfc19('0x8')](',');break;case'$substring':_0x362e0e[_0xfc19('0x34')]='%'+_0x42aaa8+'%';break;case _0xfc19('0x29'):_0x362e0e[_0xfc19('0x34')]=_0x42aaa8+'%';break;case'$endsWith':_0x362e0e['start']='%'+_0x42aaa8;break;case _0xfc19('0x14'):var _0x104a5f=_0x42aaa8[_0xfc19('0x8')](',');var _0x42aaa8=_0x104a5f[_0xfc19('0xa')]();var _0x390d1d=_0x104a5f[_0xfc19('0x35')]();if(_0x47adb3===_0xfc19('0x12')){_0x42aaa8=moment(_0x42aaa8)[_0xfc19('0x36')](0x0,!![])[_0xfc19('0x19')]();_0x390d1d=moment(_0x390d1d)[_0xfc19('0x36')](0x0,!![])[_0xfc19('0x18')](0x17,_0xfc19('0x37'))[_0xfc19('0x18')](0x3b,'minutes')['add'](0x3b,'seconds')['format']();}_0x362e0e={'start':_0x42aaa8,'end':_0x390d1d};break;default:_0x362e0e['start']=_0x42aaa8;break;}return _0x362e0e;} \ No newline at end of file +var _0x1c06=['<>\x20?','$substring','$endsWith','$lt','<\x20?','>\x20?','$lte','>=\x20?','start','$startsWith','utcOffset','add','hours','minutes','parseSearch','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','filter','indexOf','conditions','push','DATE','$eq','$between','value','includes','$gt','operator','days','format','YYYY-MM-DD','castTo','CAST(','field','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x1c06,0x19e));var _0x61c0=function(_0x2cdec6,_0x39d4c8){_0x2cdec6=_0x2cdec6-0x0;var _0xa36703=_0x1c06[_0x2cdec6];return _0xa36703;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0x61c0('0x0')]=function(_0x4b19d2){var _0x571957={'conditions':[]};_0x571957['sqlOperator']=_[_0x61c0('0x1')](_0x4b19d2,_0x61c0('0x2'))?'or':_0x61c0('0x3');var _0x499bf8=_0x4b19d2[_0x61c0('0x4')](_0x61c0('0x5'),'')[_0x61c0('0x4')](_0x61c0('0x2'),'')[_0x61c0('0x6')]('||');for(var _0x4d4e6f=0x0;_0x4d4e6f<_0x499bf8['length'];_0x4d4e6f++){var _0x33bda4=_0x499bf8[_0x4d4e6f][_0x61c0('0x6')](':=');var _0x421a50=_0x33bda4[0x0];var _0x10bbfc=_0x33bda4[_0x61c0('0x7')](0x1);_0x10bbfc[_0x61c0('0x8')](function(_0x5ed2b4){var _0x18ba86=_0x5ed2b4[_0x61c0('0x6')]('[')[_0x61c0('0x9')]();var _0x4a67a7=_0x5ed2b4['match'](/\[(.*?)\]/g);_0x4a67a7[_0x61c0('0x8')](function(_0x5e5016){var _0x1c9601=_0x5e5016[_0x61c0('0x6')]('[')[_0x61c0('0xa')](function(_0x3dbf51){return _0x3dbf51[_0x61c0('0xb')](']')>-0x1;})['map'](function(_0x17f159){return _0x17f159[_0x61c0('0x6')](']')[0x0];})[0x0];_0x571957[_0x61c0('0xc')][_0x61c0('0xd')]({'field':_0x421a50,'operator':_0x18ba86,'value':_0x1c9601});});});}return _0x571957;};exports['buildExpression']=function(_0xc24315,_0xe6f4a6,_0x3306ec){var _0x45e6c5={};if(_0xe6f4a6===_0x61c0('0xe')){if(_0x3306ec['operator']===_0x61c0('0xf')){_0x3306ec['operator']=_0x61c0('0x10');_0x3306ec[_0x61c0('0x11')]+=','+_0x3306ec[_0x61c0('0x11')];}else if(_[_0x61c0('0x12')]([_0x61c0('0x13'),'$lte'],_0x3306ec[_0x61c0('0x14')])){_0x3306ec[_0x61c0('0x11')]=moment(_0x3306ec[_0x61c0('0x11')])['add'](0x1,_0x61c0('0x15'))[_0x61c0('0x16')](_0x61c0('0x17'));}}if(_0x3306ec[_0x61c0('0x18')]){_0xe6f4a6=_0x3306ec[_0x61c0('0x18')];_0x45e6c5['text']=_0x61c0('0x19')+_0xc24315+'.'+_0x3306ec[_0x61c0('0x1a')]+'\x20AS\x20'+_0x3306ec[_0x61c0('0x18')]+')\x20'+parseOperator(_0x3306ec[_0x61c0('0x14')]);}else{_0x45e6c5[_0x61c0('0x1b')]=_0xc24315+'.'+_0x3306ec[_0x61c0('0x1a')]+'\x20'+parseOperator(_0x3306ec[_0x61c0('0x14')]);}if(_[_0x61c0('0x12')]([_0x61c0('0x1c'),_0x61c0('0x1d')],_0x3306ec['operator']))_0x45e6c5[_0x61c0('0x1b')]='('+_0x45e6c5[_0x61c0('0x1b')]+_0x61c0('0x1e')+_0xc24315+'.'+_0x3306ec['field']+_0x61c0('0x1f');_0x45e6c5[_0x61c0('0x11')]=parseValue(_0xe6f4a6,_0x3306ec[_0x61c0('0x14')],_0x3306ec[_0x61c0('0x11')]);return _0x45e6c5;};function parseOperator(_0x5f121f){var _0x6fb20f;switch(_0x5f121f){case _0x61c0('0x20'):_0x6fb20f=_0x61c0('0x21');break;case _0x61c0('0x1d'):_0x6fb20f=_0x61c0('0x22');break;case _0x61c0('0xf'):_0x6fb20f=_0x61c0('0x23');break;case _0x61c0('0x1c'):_0x6fb20f=_0x61c0('0x24');break;case _0x61c0('0x25'):case'$startsWith':case _0x61c0('0x26'):_0x6fb20f='LIKE\x20?';break;case _0x61c0('0x27'):_0x6fb20f=_0x61c0('0x28');break;case _0x61c0('0x13'):_0x6fb20f=_0x61c0('0x29');break;case _0x61c0('0x2a'):_0x6fb20f='<=\x20?';break;case'$gte':_0x6fb20f=_0x61c0('0x2b');break;case'$between':_0x6fb20f='BETWEEN\x20?\x20AND\x20?';break;}return _0x6fb20f;}function parseValue(_0x21d6e5,_0x4cff90,_0x5bf967){var _0x188ddc={'start':undefined,'end':undefined};switch(_0x4cff90){case _0x61c0('0x20'):case _0x61c0('0x1d'):_0x188ddc[_0x61c0('0x2c')]=_0x5bf967[_0x61c0('0x6')](',');break;case _0x61c0('0x25'):_0x188ddc['start']='%'+_0x5bf967+'%';break;case _0x61c0('0x2d'):_0x188ddc[_0x61c0('0x2c')]=_0x5bf967+'%';break;case _0x61c0('0x26'):_0x188ddc[_0x61c0('0x2c')]='%'+_0x5bf967;break;case'$between':var _0x43405b=_0x5bf967['split'](',');var _0x5bf967=_0x43405b[_0x61c0('0x9')]();var _0x2c8b4c=_0x43405b['pop']();if(_0x21d6e5==='DATE'){_0x5bf967=moment(_0x5bf967)[_0x61c0('0x2e')](0x0,!![])['format']();_0x2c8b4c=moment(_0x2c8b4c)['utcOffset'](0x0,!![])[_0x61c0('0x2f')](0x17,_0x61c0('0x30'))[_0x61c0('0x2f')](0x3b,_0x61c0('0x31'))[_0x61c0('0x2f')](0x3b,'seconds')[_0x61c0('0x16')]();}_0x188ddc={'start':_0x5bf967,'end':_0x2c8b4c};break;default:_0x188ddc[_0x61c0('0x2c')]=_0x5bf967;break;}return _0x188ddc;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 63cd69f..86ef96e 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 _0xe431=['forOwn','find','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','cast','col','priority','DESC','unsigned','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','replace','trim','forEach','{EXPR}','query','$id','intersection','attributes','nolimit','order','pick','filter','object','columns','value','where','merge','lower','options','include','push','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model','alias','fields','split','filters','isEmpty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe431,0x147));var _0x1e43=function(_0x2fa0d4,_0x3b971e){_0x2fa0d4=_0x2fa0d4-0x0;var _0x512f3d=_0xe431[_0x2fa0d4];return _0x512f3d;};'use strict';var _=require(_0x1e43('0x0'));var sequelize=require(_0x1e43('0x1'));var moment=require(_0x1e43('0x2'));var db=require(_0x1e43('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x14b374){var _0x309216=['ne'];try{var _0x2bfdd0=JSON[_0x1e43('0x4')](_0x14b374);var _0x1640f2=Object[_0x1e43('0x5')](_0x2bfdd0)[0x0];return _0x309216[_0x1e43('0x6')](_0x1640f2);}catch(_0x5dc4fa){return![];}}function getOperatorValue(_0x3b71be){var _0x4564d5=JSON[_0x1e43('0x4')](_0x3b71be);var _0x8608f5=Object[_0x1e43('0x5')](_0x4564d5)[0x0];var _0x2f5d69=_0x4564d5[_0x8608f5];return{['$'+_0x8608f5]:_0x2f5d69};}function parseIncludeModel(_0x2f8aab){var _0x4c0156=JSON['parse'](_0x2f8aab);return{'model':db[_0x4c0156[_0x1e43('0x7')]],'as':_0x4c0156[_0x1e43('0x8')],'attributes':_0x4c0156[_0x1e43('0x9')],'raw':_0x4c0156['raw']};}exports[_0x1e43('0x9')]=function(_0x394280){var _0x3002c1=null;if(_0x394280){_0x3002c1=_0x394280[_0x1e43('0xa')](',');}return _0x3002c1;};exports[_0x1e43('0xb')]=function(_0xa6d403,_0x7dd702){var _0xd11836={};if(!_[_0x1e43('0xc')](_0xa6d403)){_[_0x1e43('0xd')](_0xa6d403,function(_0x5cea1c,_0x57e34f){try{if(_0x7dd702){var _0x45b538=_[_0x1e43('0xe')](_0x7dd702,{'name':_0x57e34f})||{};if(hasSequelizeOperator(_0x5cea1c)){_0xd11836[_0x57e34f]=getOperatorValue(_0x5cea1c);}else if(_0x45b538['type']==='DATE'&&_[_0x1e43('0xf')](_0x5cea1c)){var _0x1a4746=JSON['parse'](_0x5cea1c);var _0xdefb96={'$gte':moment(moment(_0x1a4746[_0x1e43('0x10')])[_0x1e43('0x11')](_0x1e43('0x12')))['utc']()[_0x1e43('0x11')](),'$lte':moment(moment(_0x1a4746['$lte'])['format']('YYYY-MM-DD'))[_0x1e43('0x13')]()[_0x1e43('0x14')](0x1,'s')[_0x1e43('0x11')]()};_0xd11836[_0x57e34f]=_0xdefb96;}else if(_0x45b538[_0x1e43('0x15')]===_0x1e43('0x16')){_0xd11836[_0x57e34f]=_0x5cea1c;}else{_0xd11836[_0x57e34f]=_[_0x1e43('0x17')](_0x5cea1c)?_0x5cea1c:JSON['parse'](_0x5cea1c);}}else{_0xd11836[_0x57e34f]=_[_0x1e43('0x17')](_0x5cea1c)?_0x5cea1c:JSON['parse'](_0x5cea1c);}}catch(_0xfd5ece){_0xd11836[_0x57e34f]=_0x5cea1c[_0x1e43('0xa')](',');}});}return _0xd11836;};exports[_0x1e43('0x18')]=function(_0x338766){_0x338766=parseInt(_0x338766,0xa);if(!_0x338766||_0x338766<0x0){_0x338766=LIMIT_VALUE;}return _0x338766;};exports[_0x1e43('0x19')]=function(_0x5b6f57){_0x5b6f57=parseInt(_0x5b6f57,0xa);if(!_0x5b6f57||_0x5b6f57<0x0){_0x5b6f57=0x0;}return _0x5b6f57;};exports[_0x1e43('0x1a')]=function(_0x13a6b2){var _0x2fdc82,_0x3a7908=null;if(_0x13a6b2){_0x2fdc82=_0x13a6b2[_0x1e43('0xa')](',');_0x3a7908=_[_0x1e43('0x1b')](_0x2fdc82,function(_0x571188){if(_0x571188[_0x1e43('0x1c')]('-')===0x0){return[_0x571188==='priority'?sequelize[_0x1e43('0x1d')](sequelize[_0x1e43('0x1e')](_0x1e43('0x1f')),'unsigned'):_0x571188['substr'](0x1),_0x1e43('0x20')];}else{return[_0x571188===_0x1e43('0x1f')?sequelize[_0x1e43('0x1d')](sequelize[_0x1e43('0x1e')]('priority'),_0x1e43('0x21')):_0x571188,_0x1e43('0x22')];}});}return _0x3a7908;};exports[_0x1e43('0x23')]=function(_0x51531f,_0xa5d944){if(_[_0x1e43('0xc')](_0x51531f)){return _0x51531f;}if(_[_0x1e43('0x17')](_0x51531f)){for(var _0xf63005=0x0;_0xf63005<_0x51531f[_0x1e43('0x24')];_0xf63005+=0x1){_0x51531f[_0xf63005]=this[_0x1e43('0x23')](_0x51531f[_0xf63005],_0xa5d944);}return _0x51531f;}if(!_[_0x1e43('0x25')](_0x51531f)){return _0x51531f;}if(_[_0x1e43('0x26')](_0xa5d944)){_0xa5d944=[_0xa5d944];}if(!_[_0x1e43('0x17')](_0xa5d944)){return _0x51531f;}for(var _0x519e22=0x0;_0x519e22<_0xa5d944[_0x1e43('0x24')];_0x519e22+=0x1){_[_0x1e43('0x27')](_0x51531f,_0xa5d944[_0x519e22]);}for(var _0x2a9d6a in _0x51531f){if(_0x51531f[_0x1e43('0x28')](_0x2a9d6a)){_0x51531f[_0x2a9d6a]=this[_0x1e43('0x23')](_0x51531f[_0x2a9d6a],_0xa5d944);}}return _0x51531f;};exports[_0x1e43('0x29')]=function(_0x1d33fb){return _0x1d33fb[_0x1e43('0x2a')](RegExp(_0x1e43('0x2b')))?!![]:![];};exports[_0x1e43('0x2c')]=function(_0x437f14){return _0x437f14[_0x1e43('0x2a')](/^\S+@\S+$/)?!![]:![];};exports[_0x1e43('0x2d')]=function(_0x355b90,_0x3219d8){var _0x5772de=[];var _0x1c0d87=/([^:]")"+/g;var _0x26ec9c=/[*<>~@-]/g;var _0x118a5e=/[ `!@#$%^&*()_\-?~<>]/;var _0x4904ea=/[ ,]+/;var _0x1c3e87=_0x3219d8?_0x1e43('0x2e'):'{EXPR}';if(_0x3219d8){_0x355b90=_0x355b90[_0x1e43('0x2f')](_0x26ec9c,'\x20')[_0x1e43('0x30')]();}_0x355b90['split'](_0x4904ea)[_0x1e43('0x31')](function(_0x381c0a){_0x381c0a=_0x381c0a[_0x1e43('0x2f')](_0x1c0d87,'$1');_0x381c0a='+'+_0x381c0a+'*';var _0x120a48=_0x381c0a[_0x1e43('0x2a')](_0x118a5e);if(_0x120a48){_0x381c0a='\x22'+_0x381c0a+'\x22';}_0x5772de['push'](_0x381c0a);});_0x1c3e87=_0x1c3e87[_0x1e43('0x2f')](_0x1e43('0x32'),_0x5772de['join']('\x20'));return _0x1c3e87;};exports['getOptions']=function(_0x3a0386,_0x31ebfe,_0x152073){var _0x47fb1c={},_0x195800={};if(_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x34')]){_0x31ebfe[_0x1e43('0x33')]['id']=_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x34')];delete _0x31ebfe['query'][_0x1e43('0x34')];}_0x47fb1c['model']=_['map'](_0x3a0386,_0x1e43('0x15'));_0x47fb1c[_0x1e43('0x33')]=_['keys'](_0x31ebfe['query']);_0x47fb1c['filters']=_[_0x1e43('0x35')](_0x47fb1c[_0x1e43('0x7')],_0x47fb1c[_0x1e43('0x33')]);_0x195800[_0x1e43('0x36')]=_[_0x1e43('0x35')](_0x47fb1c[_0x1e43('0x7')],this[_0x1e43('0x9')](_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x9')]));_0x195800['attributes']=_0x195800['attributes'][_0x1e43('0x24')]?_0x195800[_0x1e43('0x36')]:_0x47fb1c[_0x1e43('0x7')];if(!_0x31ebfe[_0x1e43('0x33')]['hasOwnProperty'](_0x1e43('0x37'))){_0x195800[_0x1e43('0x18')]=this['limit'](_0x31ebfe[_0x1e43('0x33')]['limit']);_0x195800[_0x1e43('0x19')]=this['offset'](_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x19')]);}_0x195800[_0x1e43('0x38')]=this['sort'](_0x31ebfe[_0x1e43('0x33')]['sort']);_0x195800['where']=this[_0x1e43('0xb')](_[_0x1e43('0x39')](_0x31ebfe[_0x1e43('0x33')],_0x47fb1c[_0x1e43('0xb')]),_0x3a0386);if(_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x3a')]){var _0x4f38f2=_0x3a0386;var _0x186cf9=_0x31ebfe[_0x1e43('0x33')]['filter'];if(typeof _0x186cf9===_0x1e43('0x3b')){_0x4f38f2=_['filter'](_0x3a0386,function(_0x2eb0d8){return _[_0x1e43('0x6')](_0x186cf9[_0x1e43('0x3c')],_0x2eb0d8[_0x1e43('0x15')]);});_0x186cf9=_0x186cf9[_0x1e43('0x3d')];}_0x195800[_0x1e43('0x3e')]=_[_0x1e43('0x3f')](_0x195800['where'],{'$or':_[_0x1e43('0x1b')](_0x4f38f2,function(_0x234d60){if(_0x234d60['type']!=='VIRTUAL'){if(_0x152073){return sequelize[_0x1e43('0x3e')](sequelize['fn'](_0x1e43('0x40'),sequelize[_0x1e43('0x1e')](_0x234d60[_0x1e43('0x15')])),{'$like':sequelize['fn'](_0x1e43('0x40'),'%'+_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x3a')]+'%')});}else{var _0x4e8b0c={};_0x4e8b0c[_0x234d60[_0x1e43('0x15')]]={'$like':'%'+_0x31ebfe['query'][_0x1e43('0x3a')]+'%'};return _0x4e8b0c;}}})});}_0x195800=_['merge']({},_0x195800,_0x31ebfe[_0x1e43('0x41')]);return _0x195800;};exports[_0x1e43('0x42')]=function(_0xca502e){var _0x1a08d9=[];if(_0xca502e['includeAll']){_0x1a08d9[_0x1e43('0x43')]({'all':!![]});}else if(_0xca502e[_0x1e43('0x42')]){if(Array[_0x1e43('0x17')](_0xca502e[_0x1e43('0x42')])){_0x1a08d9=Object['keys'](_0xca502e['include'])[_0x1e43('0x1b')](function(_0x4d066b){return parseIncludeModel(_0xca502e[_0x1e43('0x42')][_0x4d066b]);});}else{var _0x279c31=parseIncludeModel(_0xca502e[_0x1e43('0x42')]);_0x1a08d9[_0x1e43('0x43')](_0x279c31);}}return _0x1a08d9;};exports['escapeLIKESpecialChars']=function(_0x175abe){return _0x175abe[_0x1e43('0x2f')](/[%_^-]/g,function(_0x161af2){return'\x5c'+_0x161af2;});}; \ No newline at end of file +var _0x44ed=['options','include','escapeLIKESpecialChars','lodash','sequelize','moment','../../mysqldb','keys','parse','model','alias','fields','split','filters','isEmpty','forOwn','find','$gte','YYYY-MM-DD','utc','format','$lte','name','uniqueid','isArray','offset','sort','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','match','{EXPR}','replace','trim','forEach','push','query','$id','map','intersection','attributes','nolimit','limit','order','where','filter','object','type','VIRTUAL','lower','merge'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x44ed,0x1c3));var _0xd44e=function(_0x34e51c,_0x1f46b0){_0x34e51c=_0x34e51c-0x0;var _0x31643c=_0x44ed[_0x34e51c];return _0x31643c;};'use strict';var _=require(_0xd44e('0x0'));var sequelize=require(_0xd44e('0x1'));var moment=require(_0xd44e('0x2'));var db=require(_0xd44e('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x15c555){var _0x2e58c3=['ne'];try{var _0x569bb0=JSON['parse'](_0x15c555);var _0x5ed0bd=Object[_0xd44e('0x4')](_0x569bb0)[0x0];return _0x2e58c3['includes'](_0x5ed0bd);}catch(_0x5b03ad){return![];}}function getOperatorValue(_0x5660e5){var _0x135276=JSON[_0xd44e('0x5')](_0x5660e5);var _0x27b9fb=Object[_0xd44e('0x4')](_0x135276)[0x0];var _0xefee65=_0x135276[_0x27b9fb];return{['$'+_0x27b9fb]:_0xefee65};}function parseIncludeModel(_0x2a7843){var _0x338082=JSON[_0xd44e('0x5')](_0x2a7843);return{'model':db[_0x338082[_0xd44e('0x6')]],'as':_0x338082[_0xd44e('0x7')],'attributes':_0x338082['fields'],'raw':_0x338082['raw']};}exports[_0xd44e('0x8')]=function(_0x155027){var _0xd57e85=null;if(_0x155027){_0xd57e85=_0x155027[_0xd44e('0x9')](',');}return _0xd57e85;};exports[_0xd44e('0xa')]=function(_0x17daff,_0x59a1e7){var _0x5b4ae1={};if(!_[_0xd44e('0xb')](_0x17daff)){_[_0xd44e('0xc')](_0x17daff,function(_0x8a5147,_0x2b43e4){try{if(_0x59a1e7){var _0xf804d1=_[_0xd44e('0xd')](_0x59a1e7,{'name':_0x2b43e4})||{};if(hasSequelizeOperator(_0x8a5147)){_0x5b4ae1[_0x2b43e4]=getOperatorValue(_0x8a5147);}else if(_0xf804d1['type']==='DATE'&&_['isPlainObject'](_0x8a5147)){var _0x27ed9b=JSON['parse'](_0x8a5147);var _0x1b9081={'$gte':moment(moment(_0x27ed9b[_0xd44e('0xe')])['format'](_0xd44e('0xf')))[_0xd44e('0x10')]()[_0xd44e('0x11')](),'$lte':moment(moment(_0x27ed9b[_0xd44e('0x12')])['format']('YYYY-MM-DD'))[_0xd44e('0x10')]()['subtract'](0x1,'s')[_0xd44e('0x11')]()};_0x5b4ae1[_0x2b43e4]=_0x1b9081;}else if(_0xf804d1[_0xd44e('0x13')]===_0xd44e('0x14')){_0x5b4ae1[_0x2b43e4]=_0x8a5147;}else{_0x5b4ae1[_0x2b43e4]=_[_0xd44e('0x15')](_0x8a5147)?_0x8a5147:JSON[_0xd44e('0x5')](_0x8a5147);}}else{_0x5b4ae1[_0x2b43e4]=_[_0xd44e('0x15')](_0x8a5147)?_0x8a5147:JSON[_0xd44e('0x5')](_0x8a5147);}}catch(_0x11a909){_0x5b4ae1[_0x2b43e4]=_0x8a5147[_0xd44e('0x9')](',');}});}return _0x5b4ae1;};exports['limit']=function(_0x6e9870){_0x6e9870=parseInt(_0x6e9870,0xa);if(!_0x6e9870||_0x6e9870<0x0){_0x6e9870=LIMIT_VALUE;}return _0x6e9870;};exports[_0xd44e('0x16')]=function(_0x56c60d){_0x56c60d=parseInt(_0x56c60d,0xa);if(!_0x56c60d||_0x56c60d<0x0){_0x56c60d=0x0;}return _0x56c60d;};exports[_0xd44e('0x17')]=function(_0x2eeafc){var _0x46a9dd,_0xd6d1b=null;if(_0x2eeafc){_0x46a9dd=_0x2eeafc[_0xd44e('0x9')](',');_0xd6d1b=_['map'](_0x46a9dd,function(_0x4719fe){if(_0x4719fe[_0xd44e('0x18')]('-')===0x0){return[_0x4719fe===_0xd44e('0x19')?sequelize['cast'](sequelize[_0xd44e('0x1a')](_0xd44e('0x19')),_0xd44e('0x1b')):_0x4719fe[_0xd44e('0x1c')](0x1),_0xd44e('0x1d')];}else{return[_0x4719fe===_0xd44e('0x19')?sequelize[_0xd44e('0x1e')](sequelize[_0xd44e('0x1a')](_0xd44e('0x19')),_0xd44e('0x1b')):_0x4719fe,_0xd44e('0x1f')];}});}return _0xd6d1b;};exports[_0xd44e('0x20')]=function(_0x42800f,_0x1ab1c8){if(_[_0xd44e('0xb')](_0x42800f)){return _0x42800f;}if(_[_0xd44e('0x15')](_0x42800f)){for(var _0x31a1af=0x0;_0x31a1af<_0x42800f[_0xd44e('0x21')];_0x31a1af+=0x1){_0x42800f[_0x31a1af]=this['omit'](_0x42800f[_0x31a1af],_0x1ab1c8);}return _0x42800f;}if(!_[_0xd44e('0x22')](_0x42800f)){return _0x42800f;}if(_[_0xd44e('0x23')](_0x1ab1c8)){_0x1ab1c8=[_0x1ab1c8];}if(!_[_0xd44e('0x15')](_0x1ab1c8)){return _0x42800f;}for(var _0x48a905=0x0;_0x48a905<_0x1ab1c8['length'];_0x48a905+=0x1){_[_0xd44e('0x24')](_0x42800f,_0x1ab1c8[_0x48a905]);}for(var _0x55a943 in _0x42800f){if(_0x42800f[_0xd44e('0x25')](_0x55a943)){_0x42800f[_0x55a943]=this[_0xd44e('0x20')](_0x42800f[_0x55a943],_0x1ab1c8);}}return _0x42800f;};exports[_0xd44e('0x26')]=function(_0x4f7b3f){return _0x4f7b3f['match'](RegExp(_0xd44e('0x27')))?!![]:![];};exports['isEmail']=function(_0x26d62f){return _0x26d62f[_0xd44e('0x28')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x1cfbb5,_0x4b3882){var _0x17529b=[];var _0x42041f=/([^:]")"+/g;var _0x5c3dfd=/[*<>~@-]/g;var _0x34f016=/[ `!@#$%^&*()_\-?~<>]/;var _0x5d6163=/[ ,]+/;var _0xf6c1ab=_0x4b3882?'\x22{EXPR}\x22':_0xd44e('0x29');if(_0x4b3882){_0x1cfbb5=_0x1cfbb5[_0xd44e('0x2a')](_0x5c3dfd,'\x20')[_0xd44e('0x2b')]();}_0x1cfbb5[_0xd44e('0x9')](_0x5d6163)[_0xd44e('0x2c')](function(_0x5112b7){_0x5112b7=_0x5112b7['replace'](_0x42041f,'$1');_0x5112b7='+'+_0x5112b7+'*';var _0x7b1c57=_0x5112b7[_0xd44e('0x28')](_0x34f016);if(_0x7b1c57){_0x5112b7='\x22'+_0x5112b7+'\x22';}_0x17529b[_0xd44e('0x2d')](_0x5112b7);});_0xf6c1ab=_0xf6c1ab[_0xd44e('0x2a')]('{EXPR}',_0x17529b['join']('\x20'));return _0xf6c1ab;};exports['getOptions']=function(_0x4de487,_0x310431,_0xe6e327){var _0x2a4e64={},_0x1ce2fa={};if(_0x310431[_0xd44e('0x2e')][_0xd44e('0x2f')]){_0x310431[_0xd44e('0x2e')]['id']=_0x310431[_0xd44e('0x2e')][_0xd44e('0x2f')];delete _0x310431['query']['$id'];}_0x2a4e64[_0xd44e('0x6')]=_[_0xd44e('0x30')](_0x4de487,'name');_0x2a4e64[_0xd44e('0x2e')]=_[_0xd44e('0x4')](_0x310431['query']);_0x2a4e64[_0xd44e('0xa')]=_[_0xd44e('0x31')](_0x2a4e64['model'],_0x2a4e64[_0xd44e('0x2e')]);_0x1ce2fa[_0xd44e('0x32')]=_['intersection'](_0x2a4e64[_0xd44e('0x6')],this[_0xd44e('0x8')](_0x310431[_0xd44e('0x2e')][_0xd44e('0x8')]));_0x1ce2fa[_0xd44e('0x32')]=_0x1ce2fa[_0xd44e('0x32')][_0xd44e('0x21')]?_0x1ce2fa[_0xd44e('0x32')]:_0x2a4e64['model'];if(!_0x310431['query'][_0xd44e('0x25')](_0xd44e('0x33'))){_0x1ce2fa[_0xd44e('0x34')]=this[_0xd44e('0x34')](_0x310431[_0xd44e('0x2e')]['limit']);_0x1ce2fa[_0xd44e('0x16')]=this[_0xd44e('0x16')](_0x310431['query'][_0xd44e('0x16')]);}_0x1ce2fa[_0xd44e('0x35')]=this[_0xd44e('0x17')](_0x310431[_0xd44e('0x2e')][_0xd44e('0x17')]);_0x1ce2fa[_0xd44e('0x36')]=this[_0xd44e('0xa')](_['pick'](_0x310431[_0xd44e('0x2e')],_0x2a4e64['filters']),_0x4de487);if(_0x310431[_0xd44e('0x2e')][_0xd44e('0x37')]){var _0x15b9b5=_0x4de487;var _0x1c40b7=_0x310431['query']['filter'];if(typeof _0x1c40b7===_0xd44e('0x38')){_0x15b9b5=_[_0xd44e('0x37')](_0x4de487,function(_0x325dfe){return _['includes'](_0x1c40b7['columns'],_0x325dfe['name']);});_0x1c40b7=_0x1c40b7['value'];}_0x1ce2fa[_0xd44e('0x36')]=_['merge'](_0x1ce2fa[_0xd44e('0x36')],{'$or':_['map'](_0x15b9b5,function(_0x5bad37){if(_0x5bad37[_0xd44e('0x39')]!==_0xd44e('0x3a')){if(_0xe6e327){return sequelize[_0xd44e('0x36')](sequelize['fn'](_0xd44e('0x3b'),sequelize[_0xd44e('0x1a')](_0x5bad37['name'])),{'$like':sequelize['fn'](_0xd44e('0x3b'),'%'+_0x310431[_0xd44e('0x2e')]['filter']+'%')});}else{var _0x3f0a1e={};_0x3f0a1e[_0x5bad37[_0xd44e('0x13')]]={'$like':'%'+_0x310431[_0xd44e('0x2e')]['filter']+'%'};return _0x3f0a1e;}}})});}_0x1ce2fa=_[_0xd44e('0x3c')]({},_0x1ce2fa,_0x310431[_0xd44e('0x3d')]);return _0x1ce2fa;};exports[_0xd44e('0x3e')]=function(_0x24a0d3){var _0xbce919=[];if(_0x24a0d3['includeAll']){_0xbce919[_0xd44e('0x2d')]({'all':!![]});}else if(_0x24a0d3[_0xd44e('0x3e')]){if(Array[_0xd44e('0x15')](_0x24a0d3[_0xd44e('0x3e')])){_0xbce919=Object[_0xd44e('0x4')](_0x24a0d3[_0xd44e('0x3e')])[_0xd44e('0x30')](function(_0x9040ac){return parseIncludeModel(_0x24a0d3[_0xd44e('0x3e')][_0x9040ac]);});}else{var _0x38e724=parseIncludeModel(_0x24a0d3[_0xd44e('0x3e')]);_0xbce919[_0xd44e('0x2d')](_0x38e724);}}return _0xbce919;};exports[_0xd44e('0x3f')]=function(_0x57c9de){return _0x57c9de[_0xd44e('0x2a')](/[%_^-]/g,function(_0x2ffc14){return'\x5c'+_0x2ffc14;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index d2d76e6..d256160 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 _0xf9e5=['sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','openchannelPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','openchannelStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','filterAgentAttributes','role','faxCurrentCapacity','whatsappCurrentCapacity','lodash','jayson/promise','../../mysqldb','client','http','faxPause','smsPause','voicePause','every','length','unknown','unavailable','ringing','isNil','idle','voiceStatus','pause','chatStatus','faxStatus','smsStatus','whatsappStatus','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','*pause','busy','getAgentStatus','startCase','map','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','chatPause','mailPause','whatsappPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','fields','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','indexOf','validateSortParameter'];(function(_0x4b2037,_0x41055c){var _0x48599b=function(_0x251da3){while(--_0x251da3){_0x4b2037['push'](_0x4b2037['shift']());}};_0x48599b(++_0x41055c);}(_0xf9e5,0x89));var _0x5f9e=function(_0x1e8ced,_0x3bea5f){_0x1e8ced=_0x1e8ced-0x0;var _0x1b596a=_0xf9e5[_0x1e8ced];return _0x1b596a;};'use strict';var _=require(_0x5f9e('0x0'));var jayson=require(_0x5f9e('0x1'));var db=require(_0x5f9e('0x2'))['db'];var amiClient=jayson[_0x5f9e('0x3')][_0x5f9e('0x4')]({'port':0x232a});var routingClient=jayson[_0x5f9e('0x3')][_0x5f9e('0x4')]({'port':0x232c});function isAgentPaused(_0x4e7665,_0x15b4ed){var _0x25c34c=[_0x4e7665['chatPause'],_0x4e7665[_0x5f9e('0x5')],_0x4e7665['mailPause'],_0x4e7665['openchannelPause'],_0x4e7665[_0x5f9e('0x6')],_0x4e7665[_0x5f9e('0x7')],_0x4e7665['whatsappPause']];if(!_0x15b4ed)return _[_0x5f9e('0x8')](_0x25c34c);var _0x3cebf5=_['filter'](_0x25c34c);return _0x3cebf5['length']>0x0&&_0x3cebf5['length']<_0x25c34c[_0x5f9e('0x9')]?!![]:![];}function isIdle(_0x25ad8f){return _0x25ad8f==='idle'||_0x25ad8f===_0x5f9e('0xa')||_0x25ad8f===_0x5f9e('0xb')||_0x25ad8f===_0x5f9e('0xc')||_[_0x5f9e('0xd')](_0x25ad8f);}function isAgentIdle(_0x303828){if(_0x303828['voiceStatus']!==_0x5f9e('0xe')&&_0x303828[_0x5f9e('0x7')]){_0x303828[_0x5f9e('0xf')]=_0x5f9e('0x10');return![];}return _['every']([_0x303828[_0x5f9e('0x11')],_0x303828[_0x5f9e('0x12')],_0x303828['mailStatus'],_0x303828['openchannelStatus'],_0x303828[_0x5f9e('0x13')],_0x303828[_0x5f9e('0xf')],_0x303828[_0x5f9e('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x5f9e('0x15'),{})[_0x5f9e('0x16')](function(_0x395d9a){if(_0x395d9a[_0x5f9e('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x449b52=_0x395d9a[_0x5f9e('0x18')];return routingClient['request']('Agents',{})[_0x5f9e('0x16')](function(_0x5891a2){if(_0x5891a2['error']){throw new Error(_0x5f9e('0x19'));}var _0x816c4c=_0x5891a2['result'];return _[_0x5f9e('0x1a')]({},_0x449b52,_0x816c4c);});})['catch'](function(_0x26a26d){throw _0x26a26d;});}exports[_0x5f9e('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x53a2f2){var _0xc2786f=_0x5f9e('0xa');if(isAgentPaused(_0x53a2f2))_0xc2786f=_0x5f9e('0x10');else if(isAgentPaused(_0x53a2f2,!![]))_0xc2786f=_0x5f9e('0x1c');else if(isAgentIdle(_0x53a2f2))_0xc2786f=_0x5f9e('0xe');else _0xc2786f=_0x5f9e('0x1d');return _0xc2786f;}exports[_0x5f9e('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x496bf3,_0x3d0cca){var _0x2465ae=_['isArray'](_0x496bf3)?_0x496bf3:[_0x496bf3];var _0x54c375=_[_0x5f9e('0x1f')](_0x3d0cca)+'Queue';var _0x346732=_[_0x5f9e('0x20')](_0x2465ae,function(_0x4c91cf){return db[_0x54c375]['findOne']({'where':{'id':_0x4c91cf}})['then'](function(_0x4aebea){if(!_0x4aebea)return[];return _0x4aebea[_0x5f9e('0x21')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x5f9e('0x22')](_0x346732)['then'](function(_0x53557e){var _0x4102a5=_(_0x53557e)[_0x5f9e('0x23')]()[_0x5f9e('0x20')]('id')[_0x5f9e('0x24')]()[_0x5f9e('0x25')]();return _0x4102a5;});}exports[_0x5f9e('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0xfde2d4,_0x5e53bd,_0x2ec2b8){try{if(_0x5e53bd[_0x5f9e('0x9')]>0x0){_0xfde2d4=_0xfde2d4[_0x5f9e('0x27')](function(_0x10e8bf){return _0x5e53bd[_0x5f9e('0x28')](_0x10e8bf['id']);});}var _0x420525=_0xfde2d4['filter'](function(_0x4bde22){var _0x14a762='busy';if(isAgentIdle(_0x4bde22)){_0x14a762='idle';}return _0x14a762===_0x2ec2b8;});return _[_0x5f9e('0x20')](_0x420525,'id');}catch(_0x5a7594){throw _0x5a7594;}}exports[_0x5f9e('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1d51bf,_0x5d35a5,_0x1dd402){return Promise[_0x5f9e('0x2a')]()[_0x5f9e('0x16')](function(){if(_0x5d35a5['length']>0x0){_0x1d51bf=_0x1d51bf[_0x5f9e('0x27')](function(_0x51155c){return _0x5d35a5[_0x5f9e('0x28')](_0x51155c['id']);});}return _0x1d51bf;})[_0x5f9e('0x16')](function(){return db['User'][_0x5f9e('0x2b')]({'attributes':['id',_0x5f9e('0x2c'),_0x5f9e('0x2d'),_0x5f9e('0x2e'),_0x5f9e('0x5'),_0x5f9e('0x2f'),'openchannelPause',_0x5f9e('0x6'),_0x5f9e('0x7'),_0x5f9e('0x30'),_0x5f9e('0x31')],'where':{'id':{'$in':_[_0x5f9e('0x20')](_0x1d51bf,'id')}},'raw':!![]});})['then'](function(_0x38210d){return _0x38210d[_0x5f9e('0x20')](function(_0x4a1071){var _0x99afda=_[_0x5f9e('0x32')](_0x1d51bf,['id',_0x4a1071['id']]);var _0x425217=filterAgentAttributes(_0x99afda);_[_0x5f9e('0x1a')](_0x4a1071,_0x425217);_0x4a1071[_0x5f9e('0x33')]=getAgentStatus(_0x4a1071);return _0x4a1071;});})[_0x5f9e('0x16')](function(_0x4968ec){var _0x207a57=sortAgentsByStatus(_0x4968ec,_0x1dd402);return _[_0x5f9e('0x20')](_0x207a57,'id');})['catch'](function(_0x2ca1a7){throw _0x2ca1a7;});}exports[_0x5f9e('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x6be9e0){var _0x2facfc={'fields':[],'order':null};var _0x21981d=_0x6be9e0['split'](',');_0x2facfc[_0x5f9e('0x35')]=_[_0x5f9e('0x27')](_0x21981d,function(_0x3c5002){if(!_0x3c5002['includes'](_0x5f9e('0x33'))){return!![];}_0x2facfc['order']=_[_0x5f9e('0x36')](_0x3c5002,'-')?'DESC':_0x5f9e('0x37');return![];});return _0x2facfc;}exports[_0x5f9e('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x43ee1d){if(!_0x43ee1d){_0x43ee1d=_0x5f9e('0x39');}if(_0x43ee1d[_0x5f9e('0x28')](_0x5f9e('0x2d'))&&!_0x43ee1d[_0x5f9e('0x28')](_0x5f9e('0x3a'))){var _0x3d0a92=_0x43ee1d['substring'](0x0,_0x43ee1d[_0x5f9e('0x3b')](_0x5f9e('0x2d')));_0x43ee1d+=','+_0x3d0a92+_0x5f9e('0x3a');}return _0x43ee1d;}exports[_0x5f9e('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0xae055,_0xc500c3){var _0x2d2b28=_0xae055[_0x5f9e('0x3d')](function(_0x55f677,_0x22df8c){if(_0x55f677[_0x5f9e('0x33')]===_0x22df8c[_0x5f9e('0x33')]){if(_0x55f677['globalStatus']===_0x5f9e('0x10')){if(_0xc500c3===_0x5f9e('0x3e')){return(_0x55f677[_0x5f9e('0x31')]||'')<(_0x22df8c['pauseType']||'')||_0x55f677['fullname'][_0x5f9e('0x3f')]()>_0x22df8c['fullname'][_0x5f9e('0x3f')]()?0x1:-0x1;}else{return(_0x55f677[_0x5f9e('0x31')]||'')<(_0x22df8c[_0x5f9e('0x31')]||'')||_0x55f677[_0x5f9e('0x2d')]['toLowerCase']()>_0x22df8c[_0x5f9e('0x2d')][_0x5f9e('0x3f')]()?-0x1:0x1;}}else{if(_0xc500c3==='DESC'){return _0x55f677[_0x5f9e('0x2d')][_0x5f9e('0x3f')]()<_0x22df8c[_0x5f9e('0x2d')]['toLowerCase']()?0x1:-0x1;}else{return _0x55f677[_0x5f9e('0x2d')]['toLowerCase']()<_0x22df8c[_0x5f9e('0x2d')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0xc500c3===_0x5f9e('0x3e')){return _0x55f677[_0x5f9e('0x33')]<_0x22df8c['globalStatus']?0x1:-0x1;}else{return _0x55f677[_0x5f9e('0x33')]<_0x22df8c[_0x5f9e('0x33')]?-0x1:0x1;}}});return _0x2d2b28;}exports[_0x5f9e('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0x5e9146){var _0x4a8e8f=[_0x5f9e('0x41'),_0x5f9e('0x42'),_0x5f9e('0x43'),_0x5f9e('0x44'),_0x5f9e('0x31'),_0x5f9e('0x44'),_0x5f9e('0x3a'),_0x5f9e('0x45'),_0x5f9e('0x2e'),_0x5f9e('0x46'),'mailPause','smsPause','whatsappPause','faxPause',_0x5f9e('0x7'),_0x5f9e('0x47'),_0x5f9e('0x48'),_0x5f9e('0x49'),_0x5f9e('0x4a'),_0x5f9e('0x4b'),_0x5f9e('0x4c'),_0x5f9e('0x4d'),_0x5f9e('0x4e'),_0x5f9e('0x4f'),_0x5f9e('0x50'),'whatsappCurrentCapacity','faxCurrentCapacity',_0x5f9e('0x11'),_0x5f9e('0x51'),_0x5f9e('0x52'),_0x5f9e('0x13'),'whatsappStatus',_0x5f9e('0x12'),_0x5f9e('0xf'),_0x5f9e('0x53'),_0x5f9e('0x54'),_0x5f9e('0x55'),_0x5f9e('0x56'),_0x5f9e('0x57'),_0x5f9e('0x58'),'voiceStatusTime',_0x5f9e('0x59'),_0x5f9e('0x5a'),_0x5f9e('0x5b'),_0x5f9e('0x5c'),_0x5f9e('0x5d')];var _0x2fdb00=[_0x5f9e('0x2e'),_0x5f9e('0x46'),'mailPause','smsPause',_0x5f9e('0x30'),_0x5f9e('0x5'),_0x5f9e('0x7'),_0x5f9e('0x42')];var _0x6537f5=_(_0x5e9146)[_0x5f9e('0x5e')](_0x2fdb00)['pick'](_0x4a8e8f)[_0x5f9e('0x25')]();return _0x6537f5;}exports[_0x5f9e('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x5f9e('0x2d'),_0x5f9e('0x60'),_0x5f9e('0x3a'),'online','globalStatus','userpic',_0x5f9e('0x43'),_0x5f9e('0x31'),_0x5f9e('0x44'),_0x5f9e('0x5'),_0x5f9e('0x2e'),_0x5f9e('0x2f'),'openchannelPause',_0x5f9e('0x6'),_0x5f9e('0x7'),_0x5f9e('0x30'),_0x5f9e('0x11'),_0x5f9e('0x12'),_0x5f9e('0x52'),_0x5f9e('0x51'),_0x5f9e('0x13'),_0x5f9e('0xf'),_0x5f9e('0x14'),_0x5f9e('0x53'),_0x5f9e('0x58'),'mailStatusTime',_0x5f9e('0x54'),_0x5f9e('0x56'),'voiceStatusTime','whatsappStatusTime',_0x5f9e('0x47'),'faxCapacity',_0x5f9e('0x49'),_0x5f9e('0x48'),'smsCapacity',_0x5f9e('0x4b'),'chatCurrentCapacity',_0x5f9e('0x61'),_0x5f9e('0x4f'),_0x5f9e('0x4e'),_0x5f9e('0x50'),_0x5f9e('0x62'),_0x5f9e('0x5c'),'phoneBarEnableAutomaticScreenRecording',_0x5f9e('0x5a'),'onhold',_0x5f9e('0x59'),_0x5f9e('0x5b')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x8f4c=['catch','getRealtimeAgents','*pause','busy','getAgentStatus','startCase','Queue','getAgents','all','flatten','map','value','getAgentIdsByQueues','includes','resolve','User','findAll','name','chatPause','openchannelPause','smsPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','fullname','substring','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','mailPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','whatsappPause','pick','filterAgentAttributes','role','lastLoginAt','whatsappCapacity','phoneBarEnableAutomaticScreenRecording','lodash','jayson/promise','../../mysqldb','client','http','faxPause','voicePause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge'];(function(_0x2380f5,_0x47fe0e){var _0x544e32=function(_0x2d71bb){while(--_0x2d71bb){_0x2380f5['push'](_0x2380f5['shift']());}};_0x544e32(++_0x47fe0e);}(_0x8f4c,0x113));var _0xc8f4=function(_0x335ef5,_0x1a74a9){_0x335ef5=_0x335ef5-0x0;var _0xc51af9=_0x8f4c[_0x335ef5];return _0xc51af9;};'use strict';var _=require(_0xc8f4('0x0'));var jayson=require(_0xc8f4('0x1'));var db=require(_0xc8f4('0x2'))['db'];var amiClient=jayson[_0xc8f4('0x3')][_0xc8f4('0x4')]({'port':0x232a});var routingClient=jayson[_0xc8f4('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x26b969,_0x47350d){var _0x133764=[_0x26b969['chatPause'],_0x26b969[_0xc8f4('0x5')],_0x26b969['mailPause'],_0x26b969['openchannelPause'],_0x26b969['smsPause'],_0x26b969[_0xc8f4('0x6')],_0x26b969['whatsappPause']];if(!_0x47350d)return _[_0xc8f4('0x7')](_0x133764);var _0x3a9ab1=_[_0xc8f4('0x8')](_0x133764);return _0x3a9ab1[_0xc8f4('0x9')]>0x0&&_0x3a9ab1[_0xc8f4('0x9')]<_0x133764['length']?!![]:![];}function isIdle(_0x38c41b){return _0x38c41b===_0xc8f4('0xa')||_0x38c41b===_0xc8f4('0xb')||_0x38c41b===_0xc8f4('0xc')||_0x38c41b==='ringing'||_[_0xc8f4('0xd')](_0x38c41b);}function isAgentIdle(_0x52c699){if(_0x52c699[_0xc8f4('0xe')]!==_0xc8f4('0xa')&&_0x52c699[_0xc8f4('0x6')]){_0x52c699[_0xc8f4('0xe')]=_0xc8f4('0xf');return![];}return _['every']([_0x52c699[_0xc8f4('0x10')],_0x52c699[_0xc8f4('0x11')],_0x52c699[_0xc8f4('0x12')],_0x52c699[_0xc8f4('0x13')],_0x52c699[_0xc8f4('0x14')],_0x52c699[_0xc8f4('0xe')],_0x52c699['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xc8f4('0x15')](_0xc8f4('0x16'),{})[_0xc8f4('0x17')](function(_0x46ac15){if(_0x46ac15[_0xc8f4('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0xac45d5=_0x46ac15['result'];return routingClient['request'](_0xc8f4('0x16'),{})[_0xc8f4('0x17')](function(_0x108076){if(_0x108076[_0xc8f4('0x18')]){throw new Error(_0xc8f4('0x19'));}var _0x374761=_0x108076[_0xc8f4('0x1a')];return _[_0xc8f4('0x1b')]({},_0xac45d5,_0x374761);});})[_0xc8f4('0x1c')](function(_0x1a7bac){throw _0x1a7bac;});}exports[_0xc8f4('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3126e5){var _0x22236c='unknown';if(isAgentPaused(_0x3126e5))_0x22236c=_0xc8f4('0xf');else if(isAgentPaused(_0x3126e5,!![]))_0x22236c=_0xc8f4('0x1e');else if(isAgentIdle(_0x3126e5))_0x22236c=_0xc8f4('0xa');else _0x22236c=_0xc8f4('0x1f');return _0x22236c;}exports[_0xc8f4('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x3b42ee,_0xaeee7d){var _0x43eb57=_['isArray'](_0x3b42ee)?_0x3b42ee:[_0x3b42ee];var _0x4463aa=_[_0xc8f4('0x21')](_0xaeee7d)+_0xc8f4('0x22');var _0x1d159e=_['map'](_0x43eb57,function(_0x39174f){return db[_0x4463aa]['findOne']({'where':{'id':_0x39174f}})[_0xc8f4('0x17')](function(_0x540b25){if(!_0x540b25)return[];return _0x540b25[_0xc8f4('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xc8f4('0x24')](_0x1d159e)['then'](function(_0x41f4de){var _0x21062f=_(_0x41f4de)[_0xc8f4('0x25')]()[_0xc8f4('0x26')]('id')['uniq']()[_0xc8f4('0x27')]();return _0x21062f;});}exports[_0xc8f4('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5db666,_0x190f61,_0x37957c){try{if(_0x190f61[_0xc8f4('0x9')]>0x0){_0x5db666=_0x5db666[_0xc8f4('0x8')](function(_0x24bef0){return _0x190f61[_0xc8f4('0x29')](_0x24bef0['id']);});}var _0x4a25da=_0x5db666[_0xc8f4('0x8')](function(_0x24bb78){var _0x1ea3d9='busy';if(isAgentIdle(_0x24bb78)){_0x1ea3d9=_0xc8f4('0xa');}return _0x1ea3d9===_0x37957c;});return _[_0xc8f4('0x26')](_0x4a25da,'id');}catch(_0x5ab6cb){throw _0x5ab6cb;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4d6c43,_0x2717ff,_0x323432){return Promise[_0xc8f4('0x2a')]()[_0xc8f4('0x17')](function(){if(_0x2717ff[_0xc8f4('0x9')]>0x0){_0x4d6c43=_0x4d6c43[_0xc8f4('0x8')](function(_0x3181af){return _0x2717ff[_0xc8f4('0x29')](_0x3181af['id']);});}return _0x4d6c43;})['then'](function(){return db[_0xc8f4('0x2b')][_0xc8f4('0x2c')]({'attributes':['id',_0xc8f4('0x2d'),'fullname',_0xc8f4('0x2e'),_0xc8f4('0x5'),'mailPause',_0xc8f4('0x2f'),_0xc8f4('0x30'),_0xc8f4('0x6'),'whatsappPause',_0xc8f4('0x31')],'where':{'id':{'$in':_[_0xc8f4('0x26')](_0x4d6c43,'id')}},'raw':!![]});})[_0xc8f4('0x17')](function(_0x498a84){return _0x498a84[_0xc8f4('0x26')](function(_0x45a356){var _0x4764b3=_[_0xc8f4('0x32')](_0x4d6c43,['id',_0x45a356['id']]);var _0x215203=filterAgentAttributes(_0x4764b3);_[_0xc8f4('0x1b')](_0x45a356,_0x215203);_0x45a356[_0xc8f4('0x33')]=getAgentStatus(_0x45a356);return _0x45a356;});})[_0xc8f4('0x17')](function(_0x2da6ab){var _0x2b0ee1=sortAgentsByStatus(_0x2da6ab,_0x323432);return _[_0xc8f4('0x26')](_0x2b0ee1,'id');})[_0xc8f4('0x1c')](function(_0x255888){throw _0x255888;});}exports[_0xc8f4('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x200b25){var _0x453640={'fields':[],'order':null};var _0x520c16=_0x200b25[_0xc8f4('0x35')](',');_0x453640['fields']=_[_0xc8f4('0x8')](_0x520c16,function(_0x51bfe6){if(!_0x51bfe6[_0xc8f4('0x29')](_0xc8f4('0x33'))){return!![];}_0x453640[_0xc8f4('0x36')]=_[_0xc8f4('0x37')](_0x51bfe6,'-')?_0xc8f4('0x38'):_0xc8f4('0x39');return![];});return _0x453640;}exports[_0xc8f4('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x51915d){if(!_0x51915d){_0x51915d=_0xc8f4('0x3b');}if(_0x51915d[_0xc8f4('0x29')](_0xc8f4('0x3c'))&&!_0x51915d[_0xc8f4('0x29')]('internal')){var _0x172836=_0x51915d[_0xc8f4('0x3d')](0x0,_0x51915d[_0xc8f4('0x3e')](_0xc8f4('0x3c')));_0x51915d+=','+_0x172836+_0xc8f4('0x3f');}return _0x51915d;}exports[_0xc8f4('0x40')]=validateSortParameter;function sortAgentsByStatus(_0xca3cc,_0x330a08){var _0x1eebbd=_0xca3cc[_0xc8f4('0x41')](function(_0x211aca,_0xd56415){if(_0x211aca['globalStatus']===_0xd56415[_0xc8f4('0x33')]){if(_0x211aca[_0xc8f4('0x33')]===_0xc8f4('0xf')){if(_0x330a08===_0xc8f4('0x38')){return(_0x211aca['pauseType']||'')<(_0xd56415['pauseType']||'')||_0x211aca[_0xc8f4('0x3c')][_0xc8f4('0x42')]()>_0xd56415['fullname'][_0xc8f4('0x42')]()?0x1:-0x1;}else{return(_0x211aca[_0xc8f4('0x31')]||'')<(_0xd56415['pauseType']||'')||_0x211aca['fullname'][_0xc8f4('0x42')]()>_0xd56415[_0xc8f4('0x3c')][_0xc8f4('0x42')]()?-0x1:0x1;}}else{if(_0x330a08===_0xc8f4('0x38')){return _0x211aca[_0xc8f4('0x3c')][_0xc8f4('0x42')]()<_0xd56415['fullname']['toLowerCase']()?0x1:-0x1;}else{return _0x211aca[_0xc8f4('0x3c')][_0xc8f4('0x42')]()<_0xd56415[_0xc8f4('0x3c')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x330a08==='DESC'){return _0x211aca['globalStatus']<_0xd56415['globalStatus']?0x1:-0x1;}else{return _0x211aca['globalStatus']<_0xd56415[_0xc8f4('0x33')]?-0x1:0x1;}}});return _0x1eebbd;}exports[_0xc8f4('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x3523ab){var _0x2781b5=[_0xc8f4('0x44'),_0xc8f4('0x45'),'lastLoginAt',_0xc8f4('0x46'),_0xc8f4('0x31'),'lastPauseAt','internal',_0xc8f4('0x47'),_0xc8f4('0x2e'),_0xc8f4('0x2f'),_0xc8f4('0x48'),'smsPause','whatsappPause',_0xc8f4('0x5'),_0xc8f4('0x6'),_0xc8f4('0x49'),_0xc8f4('0x4a'),_0xc8f4('0x4b'),_0xc8f4('0x4c'),'whatsappCapacity','faxCapacity',_0xc8f4('0x4d'),_0xc8f4('0x4e'),_0xc8f4('0x4f'),_0xc8f4('0x50'),_0xc8f4('0x51'),_0xc8f4('0x52'),_0xc8f4('0x10'),_0xc8f4('0x13'),_0xc8f4('0x12'),'smsStatus','whatsappStatus',_0xc8f4('0x11'),_0xc8f4('0xe'),_0xc8f4('0x53'),_0xc8f4('0x54'),_0xc8f4('0x55'),_0xc8f4('0x56'),_0xc8f4('0x57'),_0xc8f4('0x58'),_0xc8f4('0x59'),_0xc8f4('0x5a'),_0xc8f4('0x5b'),_0xc8f4('0x5c'),_0xc8f4('0x5d'),'phoneBarEnableAutomaticScreenRecording'];var _0x3d291b=[_0xc8f4('0x2e'),_0xc8f4('0x2f'),_0xc8f4('0x48'),'smsPause',_0xc8f4('0x5e'),_0xc8f4('0x5'),'voicePause','online'];var _0x405391=_(_0x3523ab)['omit'](_0x3d291b)[_0xc8f4('0x5f')](_0x2781b5)[_0xc8f4('0x27')]();return _0x405391;}exports[_0xc8f4('0x60')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xc8f4('0x2d'),_0xc8f4('0x3c'),_0xc8f4('0x61'),_0xc8f4('0x3f'),_0xc8f4('0x45'),_0xc8f4('0x33'),_0xc8f4('0x44'),_0xc8f4('0x62'),'pauseType',_0xc8f4('0x46'),_0xc8f4('0x5'),_0xc8f4('0x2e'),_0xc8f4('0x48'),'openchannelPause',_0xc8f4('0x30'),'voicePause','whatsappPause',_0xc8f4('0x10'),_0xc8f4('0x11'),_0xc8f4('0x12'),_0xc8f4('0x13'),_0xc8f4('0x14'),_0xc8f4('0xe'),'whatsappStatus','chatStatusTime',_0xc8f4('0x58'),_0xc8f4('0x55'),_0xc8f4('0x54'),_0xc8f4('0x56'),_0xc8f4('0x59'),_0xc8f4('0x57'),_0xc8f4('0x49'),'faxCapacity',_0xc8f4('0x4b'),_0xc8f4('0x4a'),'smsCapacity',_0xc8f4('0x63'),_0xc8f4('0x4d'),_0xc8f4('0x52'),_0xc8f4('0x4f'),_0xc8f4('0x4e'),_0xc8f4('0x50'),_0xc8f4('0x51'),'phoneBarEnableScreenRecordingByAgent',_0xc8f4('0x64'),_0xc8f4('0x5b'),'onhold','queue',_0xc8f4('0x5c')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 180a5cb..921dfe9 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 _0x50b5=['loggedIn','paused','waiting','busy','loggedInDb','notInUse','onHold','ringing','ringInUse','unknown','originated','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','concat','outbound','get','talking','merge','lodash','jayson/promise','util','client','http','available'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x50b5,0x143));var _0x550b=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x50b5[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x550b('0x0'));var jayson=require(_0x550b('0x1'));var util=require(_0x550b('0x2'));var amiClient=jayson[_0x550b('0x3')][_0x550b('0x4')]({'port':0x232a});var routingClient=jayson[_0x550b('0x3')][_0x550b('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x550b('0x5'),_0x550b('0x6'),_0x550b('0x7'),_0x550b('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x550b('0x9'),'inUse','invalid',_0x550b('0xa'),_0x550b('0xb'),_0x550b('0xc'),_0x550b('0xd'),_0x550b('0xe'),'talking','unavailable',_0x550b('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x550b('0x10'),'message',_0x550b('0x11'),_0x550b('0x12'),_0x550b('0x13'),_0x550b('0x14'),_0x550b('0x15'),_0x550b('0x16'),_0x550b('0x17'),_0x550b('0x18'),'erlangAbandonmentRate','erlangBusyFactor',_0x550b('0x19'),'dialPredictiveIntervalMaxThreshold',_0x550b('0x1a'),_0x550b('0x1b'),'predictiveIntervalTotalCalls',_0x550b('0x1c'),_0x550b('0x1d'),_0x550b('0x1e'),_0x550b('0x1f'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x3726de,_0x3fae37){var _0x31bbb0=_0x3fae37==='voice'?amiClient:routingClient;return _0x31bbb0[_0x550b('0x20')](_[_0x550b('0x21')](_0x3fae37)+_0x550b('0x22'),_0x3726de)[_0x550b('0x23')](function(_0x2fc476){if(_0x2fc476['error'])throw new Error(util[_0x550b('0x24')](_0x550b('0x25'),_0x3fae37));return _0x2fc476[_0x550b('0x26')];})[_0x550b('0x27')](function(_0x57827a){throw _0x57827a;});}exports[_0x550b('0x28')]=getRealtimeQueues;function initializeQueues(_0x1b45a8,_0x12aa8b,_0x595e8e,_0x34a8b9){var _0x26bed0=DEFAULT_QUEUE_ATTRIBUTES;if(_0x595e8e===_0x550b('0x29')){if(_0x34a8b9==='inbound'){_0x26bed0=_0x26bed0[_0x550b('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x34a8b9===_0x550b('0x2b')){_0x26bed0=_0x26bed0['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1b45a8['map'](function(_0x2cb720){var _0x52f002=_0x2cb720[_0x550b('0x2c')]({'plain':!![]});_0x52f002[_0x550b('0x7')]=0x0;_0x52f002[_0x550b('0xa')]=0x0;_0x52f002['loggedIn']=0x0;_0x52f002[_0x550b('0x5')]=0x0;_0x52f002[_0x550b('0x8')]=0x0;if(_0x595e8e===_0x550b('0x29')){_0x52f002[_0x550b('0x2d')]=0x0;_0x52f002[_0x550b('0x9')]=0x0;if(_0x34a8b9===_0x550b('0x2b')){_0x52f002['pTalking']=0x0;_0x52f002['originated']=0x0;}}var _0x78f4e2=_['find'](_0x12aa8b,['id',_0x52f002['id']]);if(_0x78f4e2){_[_0x550b('0x2e')](_0x52f002,_['pick'](_0x78f4e2,_0x26bed0));}return _0x52f002;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x738a=['message','statusMessage','dialActive','dialMethod','startPredictive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','concat','map','get','paused','voice','busy','find','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','waiting','inUse','invalid','notInUse','ringing','talking','unavailable','pTalking','originated'];(function(_0xa46ae9,_0x1344b8){var _0x199641=function(_0x18fe65){while(--_0x18fe65){_0xa46ae9['push'](_0xa46ae9['shift']());}};_0x199641(++_0x1344b8);}(_0x738a,0x185));var _0xa738=function(_0x550651,_0x32926b){_0x550651=_0x550651-0x0;var _0x53edcf=_0x738a[_0x550651];return _0x53edcf;};'use strict';var _=require(_0xa738('0x0'));var jayson=require(_0xa738('0x1'));var util=require(_0xa738('0x2'));var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0xa738('0x3')][_0xa738('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xa738('0x5'),_0xa738('0x6'),'paused',_0xa738('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xa738('0x8'),_0xa738('0x9'),'loggedInDb',_0xa738('0xa'),'onHold',_0xa738('0xb'),'ringInUse',_0xa738('0xc'),_0xa738('0xd'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xa738('0xe'),_0xa738('0xf'),_0xa738('0x10'),_0xa738('0x11'),_0xa738('0x12'),_0xa738('0x13'),'Trunk',_0xa738('0x14'),'startProgressive','erlangCalls',_0xa738('0x15'),'erlangAbandonmentRate',_0xa738('0x16'),_0xa738('0x17'),_0xa738('0x18'),_0xa738('0x19'),'predictiveIntervalAvailable',_0xa738('0x1a'),_0xa738('0x1b'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x3d282f,_0x157483){var _0x598b6c=_0x157483==='voice'?amiClient:routingClient;return _0x598b6c['request'](_[_0xa738('0x1c')](_0x157483)+_0xa738('0x1d'),_0x3d282f)[_0xa738('0x1e')](function(_0x30dffc){if(_0x30dffc[_0xa738('0x1f')])throw new Error(util[_0xa738('0x20')](_0xa738('0x21'),_0x157483));return _0x30dffc[_0xa738('0x22')];})[_0xa738('0x23')](function(_0x249fcc){throw _0x249fcc;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x2b1f06,_0x150927,_0x3536fe,_0x334549){var _0x5aa211=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3536fe==='voice'){if(_0x334549==='inbound'){_0x5aa211=_0x5aa211[_0xa738('0x24')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x334549==='outbound'){_0x5aa211=_0x5aa211[_0xa738('0x24')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2b1f06[_0xa738('0x25')](function(_0x4d7671){var _0x8d4206=_0x4d7671[_0xa738('0x26')]({'plain':!![]});_0x8d4206[_0xa738('0x27')]=0x0;_0x8d4206['loggedInDb']=0x0;_0x8d4206['loggedIn']=0x0;_0x8d4206[_0xa738('0x5')]=0x0;_0x8d4206[_0xa738('0x7')]=0x0;if(_0x3536fe===_0xa738('0x28')){_0x8d4206[_0xa738('0xc')]=0x0;_0x8d4206[_0xa738('0x29')]=0x0;if(_0x334549==='outbound'){_0x8d4206['pTalking']=0x0;_0x8d4206[_0xa738('0xf')]=0x0;}}var _0x4d8b28=_[_0xa738('0x2a')](_0x150927,['id',_0x8d4206['id']]);if(_0x4d8b28){_['merge'](_0x8d4206,_[_0xa738('0x2b')](_0x4d8b28,_0x5aa211));}return _0x8d4206;});}exports[_0xa738('0x2c')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index d4a0840..5fd0d32 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(_0x527228,_0x2bf9d1){var _0x18fc82=function(_0x301e4f){while(--_0x301e4f){_0x527228['push'](_0x527228['shift']());}};_0x18fc82(++_0x2bf9d1);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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(_0x129a57,_0x330d03){var _0xa7147c=function(_0x4e6c1f){while(--_0x4e6c1f){_0x129a57['push'](_0x129a57['shift']());}};_0xa7147c(++_0x330d03);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 39c7852..fa7db81 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 _0x1edb=['update','digest','hex','getUuid','platform','licenseToken','win32','replace','hostname','ipAddress','substring','crypto','child_process','execSync','../environment','networkInterfaces','keys','length','filter','IPv4','internal','concat','head','mac','address','getFirstInterface','orderBy','map','model','md5'];(function(_0x34b610,_0x48191b){var _0x1b9864=function(_0x43e7c3){while(--_0x43e7c3){_0x34b610['push'](_0x34b610['shift']());}};_0x1b9864(++_0x48191b);}(_0x1edb,0x119));var _0xb1ed=function(_0x3ca57f,_0x33a1e5){_0x3ca57f=_0x3ca57f-0x0;var _0x32c24b=_0x1edb[_0x3ca57f];return _0x32c24b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xb1ed('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0xb1ed('0x1'))[_0xb1ed('0x2')];var config=require(_0xb1ed('0x3'));function getInterfaces(){var _0x138388=[];var _0x36d72b=os[_0xb1ed('0x4')]();var _0x8c1f7d=_['orderBy'](_[_0xb1ed('0x5')](_0x36d72b));for(var _0x324099=0x0;_0x324099<_0x8c1f7d[_0xb1ed('0x6')];_0x324099++){var _0x455abb=_0x36d72b[_0x8c1f7d[_0x324099]][_0xb1ed('0x7')](function(_0x2ac358){return _0x2ac358['family']===_0xb1ed('0x8')&&_0x2ac358[_0xb1ed('0x9')]===![];});_0x138388=_0x138388[_0xb1ed('0xa')](_0x455abb);}return _0x138388;}function getFirstInterface(){var _0x291b7d=_[_0xb1ed('0xb')](getInterfaces());return{'macAddress':_0x291b7d&&_0x291b7d[_0xb1ed('0xc')]?_0x291b7d[_0xb1ed('0xc')]:'00:00:00:00:00:00','ipAddress':_0x291b7d&&_0x291b7d['address']?_0x291b7d[_0xb1ed('0xd')]:'127.0.0.1'};}exports[_0xb1ed('0xe')]=getFirstInterface;function getCPUhash(){var _0x2d02ba=_[_0xb1ed('0xf')](os['cpus']()[_0xb1ed('0x10')](function(_0x24257b){return _0x24257b[_0xb1ed('0x11')];}))['join'](':');return crypto['createHash'](_0xb1ed('0x12'))[_0xb1ed('0x13')](_0x2d02ba)[_0xb1ed('0x14')](_0xb1ed('0x15'));}exports[_0xb1ed('0x16')]=function(){var _0x1896a7=os[_0xb1ed('0x17')]();var _0x12a99e=/[0-9a-f-]{36}/;if(config[_0xb1ed('0x18')]&&_0x12a99e['test'](config[_0xb1ed('0x18')])){return config[_0xb1ed('0x18')];}else if(_0x1896a7===_0xb1ed('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xb1ed('0x1a')]('\x0d\x0a','');}else{var _0x5bcd37=getFirstInterface();var _0x3e974a=getCPUhash();var _0xa5b535=_0x3e974a+'|'+os[_0xb1ed('0x1b')]()+'|'+_0x5bcd37['macAddress']+'|'+_0x5bcd37[_0xb1ed('0x1c')];var _0x2c7fec=crypto['createHash'](_0xb1ed('0x12'))[_0xb1ed('0x13')](_0xa5b535)[_0xb1ed('0x14')](_0xb1ed('0x15'));return _0x2c7fec[_0xb1ed('0x1d')](0x0,0x8)+'-'+_0x2c7fec[_0xb1ed('0x1d')](0x8,0xc)+'-'+_0x2c7fec['substring'](0xc,0x10)+'-'+_0x2c7fec[_0xb1ed('0x1d')](0x10,0x14)+'-'+_0x2c7fec['substring'](0x14);}}; \ No newline at end of file +var _0x5c58=['dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','createHash','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','join','md5','digest','hex','getUuid','platform','licenseToken','test','win32'];(function(_0x3035a1,_0x39f021){var _0x279691=function(_0x1cc873){while(--_0x1cc873){_0x3035a1['push'](_0x3035a1['shift']());}};_0x279691(++_0x39f021);}(_0x5c58,0x1e3));var _0x85c5=function(_0x14374a,_0x138abb){_0x14374a=_0x14374a-0x0;var _0x37217e=_0x5c58[_0x14374a];return _0x37217e;};'use strict';var _=require(_0x85c5('0x0'));var os=require('os');var crypto=require(_0x85c5('0x1'));var machine=require(_0x85c5('0x2'));var exec=require(_0x85c5('0x3'))[_0x85c5('0x4')];var config=require(_0x85c5('0x5'));function getInterfaces(){var _0x2cb8e1=[];var _0x44e180=os[_0x85c5('0x6')]();var _0x217e15=_[_0x85c5('0x7')](_['keys'](_0x44e180));for(var _0x9b7a4d=0x0;_0x9b7a4d<_0x217e15[_0x85c5('0x8')];_0x9b7a4d++){var _0x2a0168=_0x44e180[_0x217e15[_0x9b7a4d]][_0x85c5('0x9')](function(_0xf7dfab){return _0xf7dfab[_0x85c5('0xa')]==='IPv4'&&_0xf7dfab['internal']===![];});_0x2cb8e1=_0x2cb8e1[_0x85c5('0xb')](_0x2a0168);}return _0x2cb8e1;}function getFirstInterface(){var _0x1ba2cb=_[_0x85c5('0xc')](getInterfaces());return{'macAddress':_0x1ba2cb&&_0x1ba2cb[_0x85c5('0xd')]?_0x1ba2cb[_0x85c5('0xd')]:_0x85c5('0xe'),'ipAddress':_0x1ba2cb&&_0x1ba2cb[_0x85c5('0xf')]?_0x1ba2cb['address']:_0x85c5('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x582172=_[_0x85c5('0x7')](os[_0x85c5('0x11')]()['map'](function(_0x1dd7e0){return _0x1dd7e0['model'];}))[_0x85c5('0x12')](':');return crypto['createHash'](_0x85c5('0x13'))['update'](_0x582172)[_0x85c5('0x14')](_0x85c5('0x15'));}exports[_0x85c5('0x16')]=function(){var _0x4af6c6=os[_0x85c5('0x17')]();var _0x15167d=/[0-9a-f-]{36}/;if(config[_0x85c5('0x18')]&&_0x15167d[_0x85c5('0x19')](config[_0x85c5('0x18')])){return config[_0x85c5('0x18')];}else if(_0x4af6c6===_0x85c5('0x1a')){return exec(_0x85c5('0x1b'),{'encoding':_0x85c5('0x1c')})['replace']('\x0d\x0a','');}else{var _0x151662=getFirstInterface();var _0x57eec9=getCPUhash();var _0x501b18=_0x57eec9+'|'+os['hostname']()+'|'+_0x151662[_0x85c5('0x1d')]+'|'+_0x151662[_0x85c5('0x1e')];var _0x482847=crypto[_0x85c5('0x1f')](_0x85c5('0x13'))[_0x85c5('0x20')](_0x501b18)[_0x85c5('0x14')]('hex');return _0x482847[_0x85c5('0x21')](0x0,0x8)+'-'+_0x482847[_0x85c5('0x21')](0x8,0xc)+'-'+_0x482847[_0x85c5('0x21')](0xc,0x10)+'-'+_0x482847[_0x85c5('0x21')](0x10,0x14)+'-'+_0x482847[_0x85c5('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 73e31a1..76a68cf 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 _0x3424=['License','findOrCreate','spread','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','YYYY-MM-DD\x20HH:mm','diff','days','error','message','finally','getUuid'];(function(_0x348048,_0x1acb73){var _0x2eb2c8=function(_0x304761){while(--_0x304761){_0x348048['push'](_0x348048['shift']());}};_0x2eb2c8(++_0x1acb73);}(_0x3424,0x79));var _0x4342=function(_0x434e88,_0x1b52ed){_0x434e88=_0x434e88-0x0;var _0xeebdb1=_0x3424[_0x434e88];return _0xeebdb1;};'use strict';var util=require(_0x4342('0x0'));var moment=require(_0x4342('0x1'));var rp=require(_0x4342('0x2'));var BPromise=require(_0x4342('0x3'));var pkginfo=require(_0x4342('0x4'))(module,_0x4342('0x5'));var db=require(_0x4342('0x6'))['db'];var encryptor=require(_0x4342('0x7'));var hardware=require(_0x4342('0x8'));var logger=require(_0x4342('0x9'))(_0x4342('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x44fee7){return new BPromise(function(_0x18f91c,_0x528756){var _0x3071bc=util[_0x4342('0xb')](_0x4342('0xc'),HOST,_0x44fee7,module[_0x4342('0xd')][_0x4342('0x5')]);if(oldToken){_0x3071bc=util['format'](_0x4342('0xe'),HOST,_0x44fee7,module[_0x4342('0xd')]['version'],oldToken);}var _0x25a4db={'uri':_0x3071bc,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x25a4db)[_0x4342('0xf')](function(_0x2b7366){_0x18f91c(_0x2b7366);})[_0x4342('0x10')](function(_0x127c67){_0x528756(_0x127c67);});});}function manageLicense(_0x50e00d,_0x531b56){var _0x271d0f=_0x531b56[_0x4342('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x271d0f['data1']!==_0x50e00d&&!_0x271d0f[_0x4342('0x12')]){oldToken=_0x271d0f[_0x4342('0x13')];}httpRequest(_0x50e00d)['then'](function(_0x310ba0){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x310ba0[_0x4342('0x14')]){isOldTokenSent=![];if(!_0x271d0f[_0x4342('0xa')]&&_0x271d0f[_0x4342('0xa')]!=_0x310ba0[_0x4342('0xa')]||_0x271d0f[_0x4342('0xa')]&&_0x271d0f['data2']){logger['info'](_0x4342('0x15'));}if(_0x271d0f[_0x4342('0xa')]&&!_0x271d0f['data2']&&_0x271d0f['license']!=_0x310ba0[_0x4342('0xa')]){logger[_0x4342('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x271d0f[_0x4342('0xa')]&&!_0x271d0f[_0x4342('0x12')]&&_0x271d0f['license']==_0x310ba0['license']){return _0x531b56;}return _0x531b56[_0x4342('0x17')]({'data1':_0x50e00d,'data2':null,'license':_0x310ba0[_0x4342('0xa')]});}else{if(_0x310ba0[_0x4342('0xa')]||_0x271d0f['license']){if(!_0x271d0f['data2']){if(_0x271d0f[_0x4342('0x13')]==_0x50e00d){GRAY_PERIOD_REASON=_0x4342('0x18');logger[_0x4342('0x16')](_0x4342('0x19'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x4342('0x16')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x271d0f[_0x4342('0x13')],_0x50e00d);}logger[_0x4342('0x16')](_0x4342('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x531b56[_0x4342('0x17')]({'data2':encryptor[_0x4342('0x1b')](moment()[_0x4342('0xb')](_0x4342('0x1c')))});}else{if(moment()[_0x4342('0x1d')](encryptor['decryptString'](_0x271d0f[_0x4342('0x12')]),_0x4342('0x1e'))>DAYS){logger[_0x4342('0x16')]('DEMO\x20START\x20AT\x20%s',moment()[_0x4342('0xb')](_0x4342('0x1c')));isOldTokenSent=![];return _0x531b56[_0x4342('0x17')]({'data1':_0x50e00d,'data2':null,'license':null});}}}else{if(_0x271d0f[_0x4342('0x13')]!=_0x50e00d){logger[_0x4342('0x16')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x271d0f[_0x4342('0x13')],_0x50e00d);return _0x531b56[_0x4342('0x17')]({'data1':_0x50e00d,'data2':null,'license':null});}}}return _0x531b56;})[_0x4342('0xf')](function(_0x238d3f){_0x531b56=_0x238d3f;})['catch'](function(_0x66b5e9){logger[_0x4342('0x1f')](_0x66b5e9[_0x4342('0x20')]);})[_0x4342('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x4342('0x22')](),_0x531b56);},TIME);});}function defaultLicense(){var _0x135c2b=hardware[_0x4342('0x22')]();if(_0x135c2b){return db[_0x4342('0x23')][_0x4342('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x135c2b}})[_0x4342('0x25')](function(_0x16ebba,_0xc84ef1){logger[_0x4342('0x16')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x135c2b);manageLicense(_0x135c2b,_0x16ebba);})['catch'](function(_0x5cab4a){logger[_0x4342('0x1f')](_0x5cab4a['message']);});}}exports[_0x4342('0x26')]=defaultLicense; \ No newline at end of file +var _0x3c88=['message','finally','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','then'];(function(_0x4066ac,_0x33f50e){var _0x3ce385=function(_0x152a26){while(--_0x152a26){_0x4066ac['push'](_0x4066ac['shift']());}};_0x3ce385(++_0x33f50e);}(_0x3c88,0x1f3));var _0x83c8=function(_0x159663,_0x222e4d){_0x159663=_0x159663-0x0;var _0x39d088=_0x3c88[_0x159663];return _0x39d088;};'use strict';var util=require(_0x83c8('0x0'));var moment=require(_0x83c8('0x1'));var rp=require(_0x83c8('0x2'));var BPromise=require(_0x83c8('0x3'));var pkginfo=require(_0x83c8('0x4'))(module,_0x83c8('0x5'));var db=require(_0x83c8('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x83c8('0x7'));var logger=require(_0x83c8('0x8'))(_0x83c8('0x9'));var HOST=_0x83c8('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xdf80a6){return new BPromise(function(_0x34bde5,_0x58bb61){var _0x451996=util[_0x83c8('0xb')](_0x83c8('0xc'),HOST,_0xdf80a6,module[_0x83c8('0xd')][_0x83c8('0x5')]);if(oldToken){_0x451996=util[_0x83c8('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0xdf80a6,module[_0x83c8('0xd')][_0x83c8('0x5')],oldToken);}var _0x4e713e={'uri':_0x451996,'method':_0x83c8('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x4e713e)['then'](function(_0x1214c3){_0x34bde5(_0x1214c3);})[_0x83c8('0xf')](function(_0x2b90f5){_0x58bb61(_0x2b90f5);});});}function manageLicense(_0x26fbf3,_0x37b7c4){var _0x4a6db7=_0x37b7c4['get']({'plain':!![]});if(!isOldTokenSent&&_0x4a6db7[_0x83c8('0x10')]!==_0x26fbf3&&!_0x4a6db7[_0x83c8('0x11')]){oldToken=_0x4a6db7[_0x83c8('0x10')];}httpRequest(_0x26fbf3)['then'](function(_0x4663df){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4663df[_0x83c8('0x12')]){isOldTokenSent=![];if(!_0x4a6db7[_0x83c8('0x9')]&&_0x4a6db7[_0x83c8('0x9')]!=_0x4663df[_0x83c8('0x9')]||_0x4a6db7[_0x83c8('0x9')]&&_0x4a6db7[_0x83c8('0x11')]){logger[_0x83c8('0x13')](_0x83c8('0x14'));}if(_0x4a6db7[_0x83c8('0x9')]&&!_0x4a6db7['data2']&&_0x4a6db7['license']!=_0x4663df[_0x83c8('0x9')]){logger[_0x83c8('0x13')](_0x83c8('0x15'));}if(_0x4a6db7[_0x83c8('0x9')]&&!_0x4a6db7[_0x83c8('0x11')]&&_0x4a6db7[_0x83c8('0x9')]==_0x4663df[_0x83c8('0x9')]){return _0x37b7c4;}return _0x37b7c4[_0x83c8('0x16')]({'data1':_0x26fbf3,'data2':null,'license':_0x4663df[_0x83c8('0x9')]});}else{if(_0x4663df[_0x83c8('0x9')]||_0x4a6db7['license']){if(!_0x4a6db7[_0x83c8('0x11')]){if(_0x4a6db7[_0x83c8('0x10')]==_0x26fbf3){GRAY_PERIOD_REASON=_0x83c8('0x17');logger[_0x83c8('0x13')](_0x83c8('0x18'));}else{GRAY_PERIOD_REASON=_0x83c8('0x19');logger[_0x83c8('0x13')](_0x83c8('0x1a'),_0x4a6db7[_0x83c8('0x10')],_0x26fbf3);}logger[_0x83c8('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x83c8('0x1b')](),moment()[_0x83c8('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x37b7c4[_0x83c8('0x16')]({'data2':encryptor[_0x83c8('0x1c')](moment()[_0x83c8('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x83c8('0x1d')](_0x4a6db7[_0x83c8('0x11')]),_0x83c8('0x1e'))>DAYS){logger['info'](_0x83c8('0x1f'),moment()[_0x83c8('0xb')](_0x83c8('0x20')));isOldTokenSent=![];return _0x37b7c4[_0x83c8('0x16')]({'data1':_0x26fbf3,'data2':null,'license':null});}}}else{if(_0x4a6db7[_0x83c8('0x10')]!=_0x26fbf3){logger[_0x83c8('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4a6db7[_0x83c8('0x10')],_0x26fbf3);return _0x37b7c4[_0x83c8('0x16')]({'data1':_0x26fbf3,'data2':null,'license':null});}}}return _0x37b7c4;})[_0x83c8('0x21')](function(_0x890903){_0x37b7c4=_0x890903;})[_0x83c8('0xf')](function(_0x4e3202){logger['error'](_0x4e3202[_0x83c8('0x22')]);})[_0x83c8('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x37b7c4);},TIME);});}function defaultLicense(){var _0x443116=hardware['getUuid']();if(_0x443116){return db[_0x83c8('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x443116}})[_0x83c8('0x25')](function(_0x35ae7d,_0xae6abe){logger[_0x83c8('0x13')](_0x83c8('0x26'),_0x443116);manageLicense(_0x443116,_0x35ae7d);})['catch'](function(_0x310515){logger[_0x83c8('0x27')](_0x310515['message']);});}}exports[_0x83c8('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 2914cec..9367306 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 _0x8742=['User','role','sequelize','COUNT','count','telephone','users','telephones','forEach','admin','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','parse','machineUuid','decryptString','gray','deadline','add','grayReason','disabled','message'];(function(_0x5f58da,_0x1f9d4a){var _0x4f667c=function(_0x195c41){while(--_0x195c41){_0x5f58da['push'](_0x5f58da['shift']());}};_0x4f667c(++_0x1f9d4a);}(_0x8742,0x1e6));var _0x2874=function(_0x280bec,_0x3278b1){_0x280bec=_0x280bec-0x0;var _0x4c5ec7=_0x8742[_0x280bec];return _0x4c5ec7;};'use strict';var util=require(_0x2874('0x0'));var _=require(_0x2874('0x1'));var moment=require(_0x2874('0x2'));var BPromise=require(_0x2874('0x3'));var hardware=require(_0x2874('0x4'));var encryptor=require(_0x2874('0x5'));var db=require(_0x2874('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2874('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x2874('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2874('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x2874('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x40bf5d){return new BPromise(function(_0x257058,_0xb4e3c0){return db['License'][_0x2874('0xa')](_[_0x2874('0xb')](_0x40bf5d,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4eaa0c){return checkLicense(_0x4eaa0c,null);})[_0x2874('0xc')](function(_0x3262a4){_0x257058(_0x3262a4);return;})[_0x2874('0xd')](function(_0x561061){_0xb4e3c0(_0x561061);});});}function checkLicense(_0x2d7b39,_0x2d3be2){if(!_0x2d7b39){demoLicense[_0x2874('0xe')]=_0x2d7b39[_0x2874('0xf')];return demoLicense;}try{var _0x1426cc=_0x2d3be2||_0x2d7b39[_0x2874('0x10')];if(_[_0x2874('0x11')](_0x1426cc)){throw new Error(_0x2874('0x12'));}var _0x205015=_0x2d7b39[_0x2874('0xf')];var _0x577b2b=_0x2d7b39[_0x2874('0x13')];var _0x5f8cc3=_0x205015['split']('-')[0x4];var _0xc58c6b=_0x205015[_0x2874('0x14')]('-')[0x0];var _0x1ce701=encryptor['decryptString'](_0x1426cc,util['format'](_0x2874('0x15'),_0x5f8cc3,_0x205015,_0xc58c6b));var _0x4e2ccd=JSON[_0x2874('0x16')](_0x1ce701);_0x4e2ccd['demo']=![];_0x4e2ccd[_0x2874('0xe')]=_0x205015;_0x4e2ccd[_0x2874('0x17')]=hardware['getUuid']();if(_0x577b2b){var _0x4e9444=encryptor[_0x2874('0x18')](_0x577b2b);_0x4e2ccd[_0x2874('0x19')]=_0x4e9444;_0x4e2ccd[_0x2874('0x1a')]=moment(_0x4e9444)[_0x2874('0x1b')](0x7,'days')['format']();_0x4e2ccd[_0x2874('0x1c')]=_0x4e2ccd[_0x2874('0xe')]!=_0x4e2ccd[_0x2874('0x17')]?'changed':_0x2874('0x1d');}return _0x4e2ccd;}catch(_0x1d80f1){breakingLicense[_0x2874('0xe')]=_0x2d7b39[_0x2874('0xf')];breakingLicense[_0x2874('0x1e')]=_0x1d80f1[_0x2874('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4e9b2a,_0x5c1873){getLicense()[_0x2874('0xc')](function(_0x172564){return db[_0x2874('0x1f')]['findAll']({'attributes':[_0x2874('0x20'),[db[_0x2874('0x21')]['fn'](_0x2874('0x22'),db[_0x2874('0x21')]['col'](_0x2874('0x20'))),_0x2874('0x23')]],'group':_0x2874('0x20'),'where':{'role':{'$or':['admin','user',_0x2874('0x24')]}},'raw':!![]})[_0x2874('0xc')](function(_0x150e4c){var _0x4811ce={'user':_0x172564[_0x2874('0x25')]||0x0,'telephone':_0x172564[_0x2874('0x26')]||0x0};_0x150e4c[_0x2874('0x27')](function(_0x22a624){var _0x47546a=_0x22a624[_0x2874('0x20')]===_0x2874('0x28')?_0x2874('0x29'):_0x22a624[_0x2874('0x20')];_0x4811ce[_0x47546a]-=_0x22a624[_0x2874('0x23')];if(_0x4811ce[_0x47546a]<0x0)_0x4811ce[_0x47546a]=0x0;});_0x4e9b2a(_0x4811ce);return;});})[_0x2874('0xd')](function(_0x83aa78){_0x5c1873(_0x83aa78);});});}function checkUserLimits(_0x5cd2ca){return new BPromise(function(_0x5ee776,_0x2fb2c9){getLimits()[_0x2874('0xc')](function(_0x1ee6d5){var _0x1e7865=_[_0x2874('0x2a')](_[_0x2874('0x2b')](_0x5cd2ca,'role'),['admin','user',_0x2874('0x24')]);var _0x1aea8a=(_0x1e7865[_0x2874('0x28')]||0x0)+(_0x1e7865['user']||0x0);var _0x5e0f29=_0x1e7865[_0x2874('0x24')]||0x0;if(_0x1aea8a>_0x1ee6d5[_0x2874('0x29')])return _0x2fb2c9(_0x2874('0x2c'));if(_0x5e0f29>_0x1ee6d5[_0x2874('0x24')])return _0x2fb2c9(_0x2874('0x2d'));return _0x5ee776();})['catch'](function(_0x3dc8ee){_0x2fb2c9(_0x3dc8ee);});});}module[_0x2874('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xc4e3=['./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','license','isEmpty','split','decryptString','format','%s:%s:%s','parse','machineUuid','gray','add','grayReason','changed','disabled','message','findAll','role','sequelize','COUNT','col','admin','telephone','users','telephones','forEach','user','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird'];(function(_0x1bbf9e,_0x2efe4b){var _0x3741eb=function(_0x5a8bf0){while(--_0x5a8bf0){_0x1bbf9e['push'](_0x1bbf9e['shift']());}};_0x3741eb(++_0x2efe4b);}(_0xc4e3,0x1dd));var _0x3c4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4e3[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x3c4e('0x0'));var moment=require(_0x3c4e('0x1'));var BPromise=require(_0x3c4e('0x2'));var hardware=require(_0x3c4e('0x3'));var encryptor=require(_0x3c4e('0x4'));var db=require(_0x3c4e('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3c4e('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3c4e('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3c4e('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3c4e('0x8'),'machineUuid':hardware[_0x3c4e('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xc32a25){return new BPromise(function(_0x971fd8,_0x3ffdcb){return db[_0x3c4e('0xa')][_0x3c4e('0xb')](_[_0x3c4e('0xc')](_0xc32a25,{'raw':!![],'where':{'id':0x1}}))[_0x3c4e('0xd')](function(_0x17bf7f){return checkLicense(_0x17bf7f,null);})['then'](function(_0xf45df7){_0x971fd8(_0xf45df7);return;})[_0x3c4e('0xe')](function(_0x496185){_0x3ffdcb(_0x496185);});});}function checkLicense(_0x4aa416,_0x2c92a7){if(!_0x4aa416){demoLicense[_0x3c4e('0xf')]=_0x4aa416[_0x3c4e('0x10')];return demoLicense;}try{var _0x231691=_0x2c92a7||_0x4aa416[_0x3c4e('0x11')];if(_[_0x3c4e('0x12')](_0x231691)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x2d4940=_0x4aa416[_0x3c4e('0x10')];var _0x41bf8d=_0x4aa416['data2'];var _0x15d132=_0x2d4940[_0x3c4e('0x13')]('-')[0x4];var _0x4b9152=_0x2d4940[_0x3c4e('0x13')]('-')[0x0];var _0x1bb8a6=encryptor[_0x3c4e('0x14')](_0x231691,util[_0x3c4e('0x15')](_0x3c4e('0x16'),_0x15d132,_0x2d4940,_0x4b9152));var _0x1ee6c=JSON[_0x3c4e('0x17')](_0x1bb8a6);_0x1ee6c['demo']=![];_0x1ee6c[_0x3c4e('0xf')]=_0x2d4940;_0x1ee6c[_0x3c4e('0x18')]=hardware['getUuid']();if(_0x41bf8d){var _0x3d2ea8=encryptor[_0x3c4e('0x14')](_0x41bf8d);_0x1ee6c[_0x3c4e('0x19')]=_0x3d2ea8;_0x1ee6c['deadline']=moment(_0x3d2ea8)[_0x3c4e('0x1a')](0x7,'days')[_0x3c4e('0x15')]();_0x1ee6c[_0x3c4e('0x1b')]=_0x1ee6c['uuid']!=_0x1ee6c[_0x3c4e('0x18')]?_0x3c4e('0x1c'):_0x3c4e('0x1d');}return _0x1ee6c;}catch(_0x296c7c){breakingLicense[_0x3c4e('0xf')]=_0x4aa416['data1'];breakingLicense[_0x3c4e('0x1e')]=_0x296c7c[_0x3c4e('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4a3218,_0x418993){getLicense()[_0x3c4e('0xd')](function(_0x183b01){return db['User'][_0x3c4e('0x1f')]({'attributes':[_0x3c4e('0x20'),[db[_0x3c4e('0x21')]['fn'](_0x3c4e('0x22'),db['sequelize'][_0x3c4e('0x23')](_0x3c4e('0x20'))),'count']],'group':'role','where':{'role':{'$or':[_0x3c4e('0x24'),'user',_0x3c4e('0x25')]}},'raw':!![]})['then'](function(_0x382914){var _0x82c3a1={'user':_0x183b01[_0x3c4e('0x26')]||0x0,'telephone':_0x183b01[_0x3c4e('0x27')]||0x0};_0x382914[_0x3c4e('0x28')](function(_0x49e48b){var _0x2c5743=_0x49e48b[_0x3c4e('0x20')]===_0x3c4e('0x24')?_0x3c4e('0x29'):_0x49e48b[_0x3c4e('0x20')];_0x82c3a1[_0x2c5743]-=_0x49e48b[_0x3c4e('0x2a')];if(_0x82c3a1[_0x2c5743]<0x0)_0x82c3a1[_0x2c5743]=0x0;});_0x4a3218(_0x82c3a1);return;});})[_0x3c4e('0xe')](function(_0x149295){_0x418993(_0x149295);});});}function checkUserLimits(_0x162eea){return new BPromise(function(_0x24c8f7,_0x3351d1){getLimits()['then'](function(_0x21038c){var _0x4e3eb4=_[_0x3c4e('0x2b')](_[_0x3c4e('0x2c')](_0x162eea,_0x3c4e('0x20')),['admin',_0x3c4e('0x29'),_0x3c4e('0x25')]);var _0x165e73=(_0x4e3eb4['admin']||0x0)+(_0x4e3eb4[_0x3c4e('0x29')]||0x0);var _0x78486=_0x4e3eb4[_0x3c4e('0x25')]||0x0;if(_0x165e73>_0x21038c[_0x3c4e('0x29')])return _0x3351d1(_0x3c4e('0x2d'));if(_0x78486>_0x21038c[_0x3c4e('0x25')])return _0x3351d1(_0x3c4e('0x2e'));return _0x24c8f7();})['catch'](function(_0x317200){_0x3351d1(_0x317200);});});}module[_0x3c4e('0x2f')]={'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 4755e26..af16a77 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 _0xbbbc=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x1eed28,_0x15a59b){var _0x55e0f5=function(_0x29787a){while(--_0x29787a){_0x1eed28['push'](_0x1eed28['shift']());}};_0x55e0f5(++_0x15a59b);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x295df8,_0x1f9924){_0x295df8=_0x295df8-0x0;var _0x1c4b61=_0xbbbc[_0x295df8];return _0x1c4b61;};'use strict';module[_0xcbbb('0x0')]={'DOMAIN':_0xcbbb('0x1'),'SESSION_SECRET':_0xcbbb('0x2'),'GOOGLE_ID':_0xcbbb('0x3'),'GOOGLE_SECRET':_0xcbbb('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x5b12=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0x291443,_0x2a03aa){var _0x42c01b=function(_0x3ae538){while(--_0x3ae538){_0x291443['push'](_0x291443['shift']());}};_0x42c01b(++_0x2a03aa);}(_0x5b12,0xa3));var _0x25b1=function(_0x2e7248,_0x30be45){_0x2e7248=_0x2e7248-0x0;var _0x3848f5=_0x5b12[_0x2e7248];return _0x3848f5;};'use strict';module[_0x25b1('0x0')]={'DOMAIN':_0x25b1('0x1'),'SESSION_SECRET':_0x25b1('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x25b1('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 97dbb7e..f1e30d0 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7636=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7636,0x11d));var _0x6763=function(_0x434543,_0x2fd498){_0x434543=_0x434543-0x0;var _0x3e6749=_0x7636[_0x434543];return _0x3e6749;};'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module[_0x6763('0x0')]=fileLogger; \ No newline at end of file +var _0xedcc=['../utils/loggers'];(function(_0x28dfa7,_0x821042){var _0x5d02b9=function(_0x161d72){while(--_0x161d72){_0x28dfa7['push'](_0x28dfa7['shift']());}};_0x5d02b9(++_0x821042);}(_0xedcc,0x137));var _0xcedc=function(_0x5d2d37,_0x1901dd){_0x5d2d37=_0x5d2d37-0x0;var _0x6374f6=_0xedcc[_0x5d2d37];return _0x6374f6;};'use strict';var fileLogger=require(_0xcedc('0x0'))['fileLogger'];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 9e017b1..5fa1163 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 _0xfde2=['xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js'];(function(_0x340e5f,_0x5b5642){var _0x40974c=function(_0xf25a32){while(--_0xf25a32){_0x340e5f['push'](_0x340e5f['shift']());}};_0x40974c(++_0x5b5642);}(_0xfde2,0x69));var _0x2fde=function(_0x35731c,_0x5ab1d1){_0x35731c=_0x35731c-0x0;var _0x2f2957=_0xfde2[_0x35731c];return _0x2f2957;};'use strict';var path=require(_0x2fde('0x0'));var cfg=require(_0x2fde('0x1'));var env={'NODE_PATH':path[_0x2fde('0x2')](path[_0x2fde('0x3')](cfg[_0x2fde('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x2fde('0x5'),'script':path[_0x2fde('0x3')](__dirname,_0x2fde('0x6')),'env':env},{'name':_0x2fde('0x7'),'script':path[_0x2fde('0x3')](__dirname,_0x2fde('0x8')),'env':env},{'name':_0x2fde('0x9'),'script':path['join'](__dirname,_0x2fde('0xa')),'env':env},{'name':_0x2fde('0xb'),'script':path[_0x2fde('0x3')](__dirname,_0x2fde('0xc')),'env':env},{'name':'routing','script':path[_0x2fde('0x3')](__dirname,_0x2fde('0xd')),'env':env},{'name':_0x2fde('0xe'),'script':path[_0x2fde('0x3')](__dirname,_0x2fde('0xf')),'env':env}]};module[_0x2fde('0x10')]=pm2config; \ No newline at end of file +var _0xed42=['../../services/xdr/index.js','exports','path','../../config/environment','join','express','../../services/express/index.js','ami','agi','email','routing','../../services/routing/index.js','xdr'];(function(_0x4912ca,_0x1345b0){var _0x1b8006=function(_0x232d71){while(--_0x232d71){_0x4912ca['push'](_0x4912ca['shift']());}};_0x1b8006(++_0x1345b0);}(_0xed42,0x154));var _0x2ed4=function(_0x548961,_0x5a13d0){_0x548961=_0x548961-0x0;var _0x31593d=_0xed42[_0x548961];return _0x31593d;};'use strict';var path=require(_0x2ed4('0x0'));var cfg=require(_0x2ed4('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x2ed4('0x2')](cfg['root'],'legacy-libs'))};var pm2config={'apps':[{'name':_0x2ed4('0x3'),'script':path['join'](__dirname,_0x2ed4('0x4')),'env':env},{'name':_0x2ed4('0x5'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x2ed4('0x6'),'script':path[_0x2ed4('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x2ed4('0x7'),'script':path[_0x2ed4('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x2ed4('0x8'),'script':path[_0x2ed4('0x2')](__dirname,_0x2ed4('0x9')),'env':env},{'name':_0x2ed4('0xa'),'script':path[_0x2ed4('0x2')](__dirname,_0x2ed4('0xb')),'env':env}]};module[_0x2ed4('0xc')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index a537935..4776e4a 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 _0xc325=['connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0xc325,0x1a2));var _0x5c32=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc325[_0x501510];return _0x1e6ee5;};'use strict';var pm2=require(_0x5c32('0x0'));var BPromise=require('bluebird');var config=require(_0x5c32('0x1'));function connect(){return new BPromise(function(_0x137003,_0x3db1f1){return pm2[_0x5c32('0x2')](function(_0x5bd5af){if(_0x5bd5af){return _0x3db1f1(_0x5bd5af);}return _0x137003(_0x5c32('0x3'));});});};exports[_0x5c32('0x4')]=function(_0x230626){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x2adf39,_0x282596){return pm2[_0x5c32('0x4')](_0x230626,function(_0x488345,_0x256792){if(_0x488345){return _0x282596(_0x488345);}pm2[_0x5c32('0x6')]();return _0x2adf39(_0x256792);});});});};exports[_0x5c32('0x7')]=function(_0x1955ac){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x1c2d40,_0x3d6cff){return pm2[_0x5c32('0x7')](_0x1955ac,function(_0x32a895,_0xc1cb74){if(_0x32a895){return _0x3d6cff(_0x32a895);}pm2[_0x5c32('0x6')]();return _0x1c2d40(_0xc1cb74);});});});};exports[_0x5c32('0x8')]=function(_0x11db00){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x3c55c7,_0x57e6fe){return pm2[_0x5c32('0x8')](_0x11db00,function(_0x4894c7,_0x2d5630){if(_0x4894c7){return _0x57e6fe(_0x4894c7);}pm2['disconnect']();return _0x3c55c7(_0x2d5630);});});});};exports[_0x5c32('0x9')]=function(){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x301d9c,_0x39288e){return pm2['list'](function(_0x246ef4,_0x5a5d28){if(_0x246ef4){return _0x39288e(_0x246ef4);}pm2[_0x5c32('0x6')]();return _0x301d9c(_0x5a5d28);});});});};exports[_0x5c32('0xa')]=function(_0x583888){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x5821af,_0x4081ce){return pm2[_0x5c32('0xa')](_0x583888,function(_0x5be43d,_0xda5e7d){if(_0x5be43d){return _0x4081ce(_0x5be43d);}pm2[_0x5c32('0x6')]();return _0x5821af(_0xda5e7d);});});});};exports[_0x5c32('0xb')]=function(_0x30484e){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x1dc8c4,_0x1f0e8b){return pm2['delete'](_0x30484e,function(_0x5bdd0a,_0x2ec9df){if(_0x5bdd0a){return _0x1f0e8b(_0x5bdd0a);}pm2[_0x5c32('0x6')]();return _0x1dc8c4(_0x2ec9df);});});});};exports[_0x5c32('0xc')]=function(){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x3803d5,_0x246851){return pm2[_0x5c32('0xc')](function(_0xd6aa78){if(_0xd6aa78){return _0x246851(_0xd6aa78);}return _0x3803d5(_0x5c32('0xd'));});});});}; \ No newline at end of file +var _0xf9e3=['pm2','connect','connected','start','disconnect','stop','then','list','describe','delete','dump','saved'];(function(_0x21eb10,_0x4837ee){var _0x2be61d=function(_0xfa6769){while(--_0xfa6769){_0x21eb10['push'](_0x21eb10['shift']());}};_0x2be61d(++_0x4837ee);}(_0xf9e3,0x108));var _0x3f9e=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xf9e3[_0x2aecb2];return _0x3ebb80;};'use strict';var pm2=require(_0x3f9e('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x40557f,_0x48b066){return pm2[_0x3f9e('0x1')](function(_0x283965){if(_0x283965){return _0x48b066(_0x283965);}return _0x40557f(_0x3f9e('0x2'));});});};exports[_0x3f9e('0x3')]=function(_0x7538bd){return connect()['then'](function(){return new BPromise(function(_0xfd5e95,_0x1a6e4c){return pm2['start'](_0x7538bd,function(_0x3aa9bb,_0x2fc601){if(_0x3aa9bb){return _0x1a6e4c(_0x3aa9bb);}pm2[_0x3f9e('0x4')]();return _0xfd5e95(_0x2fc601);});});});};exports[_0x3f9e('0x5')]=function(_0x20486b){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0x5cc591,_0x3f60a0){return pm2[_0x3f9e('0x5')](_0x20486b,function(_0x353dff,_0xa024b5){if(_0x353dff){return _0x3f60a0(_0x353dff);}pm2['disconnect']();return _0x5cc591(_0xa024b5);});});});};exports['restart']=function(_0x12a161){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0x22856c,_0x223457){return pm2['restart'](_0x12a161,function(_0x212116,_0xdb84cb){if(_0x212116){return _0x223457(_0x212116);}pm2[_0x3f9e('0x4')]();return _0x22856c(_0xdb84cb);});});});};exports[_0x3f9e('0x7')]=function(){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0xa5793a,_0x4066ff){return pm2[_0x3f9e('0x7')](function(_0x5d0577,_0x4616e4){if(_0x5d0577){return _0x4066ff(_0x5d0577);}pm2['disconnect']();return _0xa5793a(_0x4616e4);});});});};exports[_0x3f9e('0x8')]=function(_0x4b37d3){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0x427f6a,_0x2b98ad){return pm2[_0x3f9e('0x8')](_0x4b37d3,function(_0x553125,_0x41dd9c){if(_0x553125){return _0x2b98ad(_0x553125);}pm2['disconnect']();return _0x427f6a(_0x41dd9c);});});});};exports[_0x3f9e('0x9')]=function(_0x240099){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0x565a5f,_0x4936d7){return pm2[_0x3f9e('0x9')](_0x240099,function(_0x265bbf,_0x32682c){if(_0x265bbf){return _0x4936d7(_0x265bbf);}pm2[_0x3f9e('0x4')]();return _0x565a5f(_0x32682c);});});});};exports[_0x3f9e('0xa')]=function(){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0x2fed,_0x47bdec){return pm2[_0x3f9e('0xa')](function(_0x3fbb0d){if(_0x3fbb0d){return _0x47bdec(_0x3fbb0d);}return _0x2fed(_0x3f9e('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 7f62523..fb1b22f 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 _0xd7da=['YYYY-MM-DD\x20HH:mm:ss','info','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xd7da,0xc7));var _0xad7d=function(_0x509d2e,_0x307fde){_0x509d2e=_0x509d2e-0x0;var _0x292a85=_0xd7da[_0x509d2e];return _0x292a85;};'use strict';var _=require('lodash');var moment=require(_0xad7d('0x0'));var Redis=require(_0xad7d('0x1'));var util=require(_0xad7d('0x2'));var config=require(_0xad7d('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xad7d('0x4'));config['redis']=_[_0xad7d('0x5')](config[_0xad7d('0x6')],{'host':_0xad7d('0x7'),'port':0x18eb});var io=require(_0xad7d('0x8'))(new Redis(config[_0xad7d('0x6')]));function closeInteractions(){var _0x128638=0x0;var _0x2b481d=[];return db[_0xad7d('0x9')][_0xad7d('0xa')]({'raw':!![],'attributes':['id',_0xad7d('0xb')],'where':{'id':0x1}})[_0xad7d('0xc')](function(_0xe852a7){_0x128638=_0xe852a7[_0xad7d('0xb')];if(_0x128638){return db[_0xad7d('0xd')][_0xad7d('0xe')]({'raw':!![],'attributes':['id',_0xad7d('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xad7d('0x10')](_0xe852a7[_0xad7d('0xb')],_0xad7d('0x11'))}}});}else{return[];}})['then'](function(_0x1af9a4){if(_0x1af9a4&&_0x1af9a4[_0xad7d('0x12')]){_0x2b481d=_[_0xad7d('0x13')](_0x1af9a4||[],'id');logger['info'](_0xad7d('0x14'),_0x2b481d[_0xad7d('0x15')]());return db['ChatInteraction'][_0xad7d('0x16')]({'closeReason':'system','disposition':_0xad7d('0x17'),'closed':!![],'closedAt':moment()[_0xad7d('0x18')](_0xad7d('0x19'))},{'where':{'id':_0x2b481d}});}})[_0xad7d('0xc')](function(){if(_0x2b481d&&_0x2b481d[_0xad7d('0x12')]){logger[_0xad7d('0x1a')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2b481d[_0xad7d('0x15')]());for(var _0x456519=0x0;_0x456519<_0x2b481d['length'];_0x456519++){io['emit'](_0xad7d('0x1b'),{'id':_0x2b481d[_0x456519],'closed':!![]});}}})['catch'](function(_0x136903){logger[_0xad7d('0x1c')](_0xad7d('0x1d'),_0x136903?util[_0xad7d('0x1e')](_0x136903,{'showHidden':![],'depth':null}):'');});}exports[_0xad7d('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6a66=['Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','info','[CHAT]\x20Interactions\x20to\x20close:','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','socket.io-emitter'];(function(_0x3213b7,_0x6789ca){var _0xb960bf=function(_0x2f7f04){while(--_0x2f7f04){_0x3213b7['push'](_0x3213b7['shift']());}};_0xb960bf(++_0x6789ca);}(_0x6a66,0xa0));var _0x66a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a66[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x66a6('0x0'));var util=require(_0x66a6('0x1'));var config=require(_0x66a6('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x66a6('0x3'))(_0x66a6('0x4'));config[_0x66a6('0x5')]=_[_0x66a6('0x6')](config[_0x66a6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x66a6('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x51ac41=0x0;var _0x41ed3a=[];return db[_0x66a6('0x8')][_0x66a6('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x66a6('0xa')](function(_0x2147ff){_0x51ac41=_0x2147ff[_0x66a6('0xb')];if(_0x51ac41){return db[_0x66a6('0xc')][_0x66a6('0xd')]({'raw':!![],'attributes':['id',_0x66a6('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x66a6('0xf')](_0x2147ff[_0x66a6('0xb')],'minutes')}}});}else{return[];}})[_0x66a6('0xa')](function(_0x43a0c6){if(_0x43a0c6&&_0x43a0c6['length']){_0x41ed3a=_['map'](_0x43a0c6||[],'id');logger[_0x66a6('0x10')](_0x66a6('0x11'),_0x41ed3a['join']());return db[_0x66a6('0xc')]['update']({'closeReason':_0x66a6('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x66a6('0x13')](_0x66a6('0x14'))},{'where':{'id':_0x41ed3a}});}})['then'](function(){if(_0x41ed3a&&_0x41ed3a['length']){logger[_0x66a6('0x10')](_0x66a6('0x15'),_0x41ed3a['join']());for(var _0x7fa519=0x0;_0x7fa519<_0x41ed3a[_0x66a6('0x16')];_0x7fa519++){io['emit'](_0x66a6('0x17'),{'id':_0x41ed3a[_0x7fa519],'closed':!![]});}}})[_0x66a6('0x18')](function(_0xcaeaac){logger[_0x66a6('0x19')](_0x66a6('0x1a'),_0xcaeaac?util['inspect'](_0xcaeaac,{'showHidden':![],'depth':null}):'');});}exports[_0x66a6('0x1b')]=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 83c218a..a839f19 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 _0x15e6=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x8d1a10,_0x543d92){var _0x53661e=function(_0x357374){while(--_0x357374){_0x8d1a10['push'](_0x8d1a10['shift']());}};_0x53661e(++_0x543d92);}(_0x15e6,0xf6));var _0x615e=function(_0x4f7418,_0x1755cc){_0x4f7418=_0x4f7418-0x0;var _0x4afe7e=_0x15e6[_0x4f7418];return _0x4afe7e;};'use strict';function start(){var _0x29ae57=require(_0x615e('0x0'));return _0x29ae57['startAllRefreshIntervals']();}module[_0x615e('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +'use strict';function start(){var _0x3e8ca0=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x3e8ca0['startAllRefreshIntervals']();}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 4ba4ffe..af6ceae 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 _0xa6e7=['request','SendMail','email\x20sent','case\x20loading','currentAttempt','retryOptions','retries','job','data','stop','operation','still\x20loading','case\x20completed','case\x20failed','Unrecognized\x20status:','entity','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','run\x20job','cron','active','isBetween','endAt','add','add\x20cron','stop\x20cron','startAt','update','update\x20cron','run','util','path','lodash','moment','bluebird','../logger','schedule','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','findOne','then','catch','error','info','MailAccount','getSmtpOptions','format','name','email','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','status','Sent','attachments','message','stringify','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','text','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'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa6e7,0x191));var _0x7a6e=function(_0x1c709d,_0x5ec06f){_0x1c709d=_0x1c709d-0x0;var _0x4976a4=_0xa6e7[_0x1c709d];return _0x4976a4;};'use strict';var fs=require('fs');var util=require(_0x7a6e('0x0'));var path=require(_0x7a6e('0x1'));var _=require(_0x7a6e('0x2'));var moment=require(_0x7a6e('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x7a6e('0x4'));var logger=require(_0x7a6e('0x5'))(_0x7a6e('0x6'));var db=require('../../mysqldb')['db'];const retry=require(_0x7a6e('0x7'));var analyticCustomReportController=require(_0x7a6e('0x8'));var analyticDefaultReportController=require(_0x7a6e('0x9'));var client=jayson[_0x7a6e('0xa')][_0x7a6e('0xb')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x55c353){const _0x46ecaa={};if(typeof _0x55c353===_0x7a6e('0xc')){_0x46ecaa['id']=_0x55c353;}return db['AnalyticExtractedReport'][_0x7a6e('0xd')]({'where':_0x46ecaa})[_0x7a6e('0xe')](function(_0x455d9d){return _0x455d9d;})[_0x7a6e('0xf')](function(_0x510716){logger[_0x7a6e('0x10')](_0x510716);});}function handleSendEmail(_0x169e1e,_0x3cf480){logger[_0x7a6e('0x11')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x169e1e['email']);var _0x2fc5aa=!![];var _0x5162bf=_0x169e1e[_0x7a6e('0x12')][_0x7a6e('0x13')]();var _0x4c8f34={'account':_0x5162bf,'message':{'from':util[_0x7a6e('0x14')]('\x22%s\x22\x20<%s>',_0x169e1e[_0x7a6e('0x12')][_0x7a6e('0x15')],_0x169e1e[_0x7a6e('0x12')][_0x7a6e('0x16')]||_0x169e1e['MailAccount'][_0x7a6e('0x17')][_0x7a6e('0x18')]),'to':_0x169e1e[_0x7a6e('0x16')],'cc':_0x169e1e['cc'],'bcc':_0x169e1e[_0x7a6e('0x19')],'subject':util[_0x7a6e('0x14')](_0x7a6e('0x1a'),_0x3cf480[_0x7a6e('0x15')],_0x169e1e[_0x7a6e('0x1b')],_0x169e1e[_0x7a6e('0x1c')])}};var _0x4e26e4=path[_0x7a6e('0x1d')](__dirname,_0x7a6e('0x1e'));var _0x31dbc7=_0x3cf480[_0x7a6e('0x1f')];var _0x4ffcac=util[_0x7a6e('0x14')](_0x7a6e('0x20'),path[_0x7a6e('0x21')](_0x3cf480['savename'],path[_0x7a6e('0x22')](_0x3cf480[_0x7a6e('0x1f')])),'zip');var _0x583ec2=path[_0x7a6e('0x1d')](_0x4e26e4,_0x31dbc7);var _0x597945=path[_0x7a6e('0x1d')](_0x4e26e4,_0x4ffcac);if(fs[_0x7a6e('0x23')](_0x583ec2)){_0x3cf480[_0x7a6e('0x24')]=_0x7a6e('0x25');_0x4c8f34['message'][_0x7a6e('0x26')]=[{'filename':_0x31dbc7,'path':_0x583ec2}];_0x4c8f34[_0x7a6e('0x27')]['text']=util[_0x7a6e('0x14')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x7a6e('0x28')](_0x3cf480,null,0x2));}else if(fs[_0x7a6e('0x23')](_0x597945)){_0x3cf480[_0x7a6e('0x24')]=_0x7a6e('0x25');_0x4c8f34['message'][_0x7a6e('0x26')]=[{'filename':_0x4ffcac,'path':_0x597945}];}else{if(_0x3cf480['status']===_0x7a6e('0x29')){_0x4c8f34[_0x7a6e('0x27')]['text']=_0x7a6e('0x2a');if(!_0x169e1e[_0x7a6e('0x2b')]){_0x2fc5aa=![];logger['info'](_0x7a6e('0x2c'));}}else if(_0x3cf480['status']===_0x7a6e('0x2d')){_0x4c8f34[_0x7a6e('0x27')][_0x7a6e('0x2e')]=_0x7a6e('0x2f');}else if(_0x3cf480['status']===_0x7a6e('0x30')){_0x4c8f34[_0x7a6e('0x27')][_0x7a6e('0x2e')]=_0x7a6e('0x31');}else if(_0x3cf480[_0x7a6e('0x24')]==='Failed'){_0x4c8f34['message'][_0x7a6e('0x2e')]=_0x7a6e('0x32');}else{logger[_0x7a6e('0x10')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x3cf480['status']);}}if(_0x2fc5aa){return client[_0x7a6e('0x33')](_0x7a6e('0x34'),_0x4c8f34)[_0x7a6e('0xe')](function(_0x387685){if(_0x387685[_0x7a6e('0x10')]){return logger[_0x7a6e('0x10')]('error\x20mail',JSON['stringify'](_0x387685));}return logger[_0x7a6e('0x11')](_0x7a6e('0x35'));})[_0x7a6e('0xf')](function(_0x3e1adc){return logger[_0x7a6e('0x10')]('error\x20mail',JSON[_0x7a6e('0x28')](_0x3e1adc));});}}function handleError(){return function(_0x1ed41d){return logger[_0x7a6e('0x10')](JSON[_0x7a6e('0x28')](_0x1ed41d));};}function loading(_0x26cdd2){logger['info'](_0x7a6e('0x36'));if(_0x26cdd2[_0x7a6e('0x37')]===_0x26cdd2[_0x7a6e('0x38')][_0x7a6e('0x39')]){handleSendEmail(_0x26cdd2[_0x7a6e('0x3a')],_0x26cdd2[_0x7a6e('0x3b')]);_0x26cdd2['operation'][_0x7a6e('0x3c')]();}else{_0x26cdd2[_0x7a6e('0x3d')][_0x7a6e('0x7')](_0x7a6e('0x3e'));}}function completed(_0x3da072){logger['info'](_0x7a6e('0x3f'));handleSendEmail(_0x3da072[_0x7a6e('0x3a')],_0x3da072[_0x7a6e('0x3b')]);_0x3da072[_0x7a6e('0x3d')]['stop']();}function empty(_0x5b745c){logger['info']('case\x20empty');handleSendEmail(_0x5b745c[_0x7a6e('0x3a')],_0x5b745c[_0x7a6e('0x3b')]);_0x5b745c['operation'][_0x7a6e('0x3c')]();}function failed(_0x551972){logger[_0x7a6e('0x11')](_0x7a6e('0x40'));handleSendEmail(_0x551972[_0x7a6e('0x3a')],_0x551972[_0x7a6e('0x3b')]);_0x551972[_0x7a6e('0x3d')]['stop']();}function urecognized(_0xf3ed30){logger['error'](_0x7a6e('0x41'),_0xf3ed30[_0x7a6e('0x42')][_0x7a6e('0x43')][_0x7a6e('0x24')]);_0xf3ed30['operation'][_0x7a6e('0x3c')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x5d1c6a,_0x23a353){const _0x52b1dc={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x5a3737=retry['operation'](_0x52b1dc);_0x5a3737[_0x7a6e('0x44')](_0x2f506c=>{logger[_0x7a6e('0x11')](_0x7a6e('0x45')+_0x5d1c6a['id']+_0x7a6e('0x46')+_0x2f506c);try{getReportData(_0x23a353['id'])[_0x7a6e('0xe')](function(_0x401fe8){_0x23a353=_0x401fe8;logger[_0x7a6e('0x11')](_0x7a6e('0x47'),_0x401fe8['dataValues'][_0x7a6e('0x24')]);if(!reportStatusStrategies[_0x401fe8[_0x7a6e('0x43')][_0x7a6e('0x24')]]){logger['error']('report\x20status:',_0x401fe8['dataValues'][_0x7a6e('0x24')]);_0x5a3737[_0x7a6e('0x7')]();}reportStatusStrategies[_0x401fe8[_0x7a6e('0x43')]['status']]({'operation':_0x5a3737,'currentAttempt':_0x2f506c,'retryOptions':_0x52b1dc,'job':_0x5d1c6a,'data':_0x23a353,'entity':_0x401fe8});});}catch(_0x14ced8){_0x5a3737[_0x7a6e('0x7')](_0x14ced8);}});}function handleResult(_0x40b157){return function(_0x5d3da4){if(_0x40b157[_0x7a6e('0x48')]&&_0x40b157['MailAccount']&&_0x40b157[_0x7a6e('0x12')][_0x7a6e('0x17')]&&!_['isNil'](_0x40b157[_0x7a6e('0x16')])){retryer(_0x40b157,_0x5d3da4);}};}function handleJob(_0x1ff71d){return function(){try{if(_[_0x7a6e('0x49')](_0x1ff71d['subtractNumber'])){return logger[_0x7a6e('0x11')](_0x7a6e('0x4a'));}if(_[_0x7a6e('0x49')](_0x1ff71d[_0x7a6e('0x1c')])){return logger[_0x7a6e('0x11')](_0x7a6e('0x4b'));}var _0x50a628={'startDate':moment()[_0x7a6e('0x4c')](_0x1ff71d['subtractNumber'],_0x1ff71d[_0x7a6e('0x1c')])[_0x7a6e('0x14')](_0x7a6e('0x4d')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x7a6e('0x4e'),'output':_0x1ff71d[_0x7a6e('0x4f')],'name':_0x1ff71d['name']};if(!_[_0x7a6e('0x49')](_0x1ff71d['DefaultReportId'])){logger[_0x7a6e('0x11')](_0x7a6e('0x50'),_0x1ff71d[_0x7a6e('0x51')]);return analyticDefaultReportController[_0x7a6e('0x52')]({'id':_0x1ff71d['DefaultReportId']},_0x50a628)['then'](handleResult(_0x1ff71d))[_0x7a6e('0xf')](handleError());}if(!_[_0x7a6e('0x49')](_0x1ff71d[_0x7a6e('0x53')])){logger['info'](_0x7a6e('0x54'),_0x1ff71d[_0x7a6e('0x53')]);return analyticCustomReportController['runReport']({'id':_0x1ff71d[_0x7a6e('0x53')]},_0x50a628)[_0x7a6e('0xe')](handleResult(_0x1ff71d))[_0x7a6e('0xf')](handleError());}}catch(_0xef5757){logger[_0x7a6e('0x10')](JSON[_0x7a6e('0x28')](_0xef5757));}return logger[_0x7a6e('0x11')](_0x7a6e('0x55'));};}function getJobs(_0x4844ad){var _0x5307ca={};if(_0x4844ad){_0x5307ca['id']=_0x4844ad;}return db[_0x7a6e('0x56')][_0x7a6e('0x57')]({'where':_0x5307ca,'include':[{'model':db[_0x7a6e('0x12')],'attributes':['id','name',_0x7a6e('0x16')],'include':[{'model':db[_0x7a6e('0x58')],'as':_0x7a6e('0x17'),'include':[{'model':db['CloudProvider'],'as':_0x7a6e('0x59')}]}]}]})[_0x7a6e('0xe')](function(_0x5718e1){var _0x4820b7=_['keys'](manager[_0x7a6e('0x5a')]);var _0x424323=_[_0x7a6e('0x5b')](_0x5718e1,function(_0x364d94){return _0x364d94['id'][_0x7a6e('0x5c')]();});var _0x44c71e=_[_0x7a6e('0x5d')](_0x5718e1,function(_0x211c0b){return _0x211c0b['id'][_0x7a6e('0x5c')]();});var _0x391cae=_0x4844ad?_0x424323:_[_0x7a6e('0x5e')](_0x424323,_0x4820b7);var _0x9f3fa6=_[_0x7a6e('0x5f')](_0x424323,_0x4820b7);var _0x57d24f=_['difference'](_0x4820b7,_0x424323);var _0x1c3e56;var _0x3c51ad;for(_0x1c3e56=0x0;_0x1c3e56<_0x57d24f[_0x7a6e('0x60')]&&!_0x4844ad;_0x1c3e56+=0x1){_0x3c51ad=_0x57d24f[_0x1c3e56][_0x7a6e('0x5c')]();if(manager[_0x7a6e('0x61')](_0x3c51ad)){manager[_0x7a6e('0x3c')](_0x3c51ad);manager[_0x7a6e('0x62')](_0x3c51ad);logger['info'](_0x7a6e('0x63'),_0x3c51ad);}}logger[_0x7a6e('0x11')](_0x7a6e('0x64'),JSON[_0x7a6e('0x28')](_0x391cae));for(_0x1c3e56=0x0;_0x1c3e56<_0x391cae['length'];_0x1c3e56+=0x1){_0x3c51ad=_0x391cae[_0x1c3e56]['toString']();if(_0x4844ad){logger[_0x7a6e('0x11')](JSON[_0x7a6e('0x28')](_0x44c71e[_0x3c51ad]));BPromise['resolve']()[_0x7a6e('0xe')](handleJob(_0x44c71e[_0x3c51ad]));logger[_0x7a6e('0x11')](_0x7a6e('0x65'),_0x44c71e[_0x3c51ad][_0x7a6e('0x15')],_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]);}else if(_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]&&_0x44c71e[_0x3c51ad][_0x7a6e('0x67')]&&moment()[_0x7a6e('0x68')](_0x44c71e[_0x3c51ad]['startAt'],_0x44c71e[_0x3c51ad][_0x7a6e('0x69')])){manager[_0x7a6e('0x6a')](_0x3c51ad,_0x44c71e[_0x3c51ad][_0x7a6e('0x66')],handleJob(_0x44c71e[_0x3c51ad]));manager['start'](_0x3c51ad);logger['info'](_0x7a6e('0x6b'),_0x44c71e[_0x3c51ad][_0x7a6e('0x15')],_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]);}else if(manager[_0x7a6e('0x61')](_0x3c51ad)){manager[_0x7a6e('0x3c')](_0x3c51ad);manager[_0x7a6e('0x62')](_0x3c51ad);logger[_0x7a6e('0x11')](_0x7a6e('0x6c'),_0x44c71e[_0x3c51ad][_0x7a6e('0x15')],_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]);}}for(_0x1c3e56=0x0,_0x3c51ad;_0x1c3e56<_0x9f3fa6[_0x7a6e('0x60')]&&!_0x4844ad;_0x1c3e56+=0x1){_0x3c51ad=_0x9f3fa6[_0x1c3e56][_0x7a6e('0x5c')]();if(manager[_0x7a6e('0x61')](_0x3c51ad)){if(_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]&&_0x44c71e[_0x3c51ad]['active']&&moment()[_0x7a6e('0x68')](_0x44c71e[_0x3c51ad][_0x7a6e('0x6d')],_0x44c71e[_0x3c51ad][_0x7a6e('0x69')])){manager[_0x7a6e('0x6e')](_0x3c51ad,_0x44c71e[_0x3c51ad][_0x7a6e('0x66')],handleJob(_0x44c71e[_0x3c51ad]));logger[_0x7a6e('0x11')](_0x7a6e('0x6f'),_0x44c71e[_0x3c51ad][_0x7a6e('0x15')],_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]);}else{manager[_0x7a6e('0x3c')](_0x3c51ad);manager[_0x7a6e('0x62')](_0x3c51ad);logger[_0x7a6e('0x11')](_0x7a6e('0x6c'),_0x44c71e[_0x3c51ad][_0x7a6e('0x15')],_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]);}}}})[_0x7a6e('0xf')](function(_0x23f3df){logger[_0x7a6e('0x10')](JSON[_0x7a6e('0x28')](_0x23f3df));});}exports[_0x7a6e('0x70')]=function(_0x74c143){return getJobs(_0x74c143);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x79e7=['stop','still\x20loading','case\x20completed','data','case\x20empty','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','map','difference','intersection','length','toString','exists','deleteJob','delete\x20cron','resolve','cron','active','isBetween','startAt','add','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','\x22%s\x22\x20<%s>','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','status','message','attachments','text','stringify','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','Failed','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','case\x20loading','retryOptions','job','operation'];(function(_0x578fd7,_0x12660f){var _0x5e8c73=function(_0x35fa21){while(--_0x35fa21){_0x578fd7['push'](_0x578fd7['shift']());}};_0x5e8c73(++_0x12660f);}(_0x79e7,0x14c));var _0x779e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x79e7[_0xfae23b];return _0x200640;};'use strict';var fs=require('fs');var util=require(_0x779e('0x0'));var path=require(_0x779e('0x1'));var _=require(_0x779e('0x2'));var moment=require(_0x779e('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x779e('0x4'));var BPromise=require(_0x779e('0x5'));var logger=require(_0x779e('0x6'))('schedule');var db=require('../../mysqldb')['db'];const retry=require(_0x779e('0x7'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x779e('0x8'));var client=jayson[_0x779e('0x9')][_0x779e('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x1b2b9d){const _0x4a1303={};if(typeof _0x1b2b9d==='number'){_0x4a1303['id']=_0x1b2b9d;}return db['AnalyticExtractedReport']['findOne']({'where':_0x4a1303})[_0x779e('0xb')](function(_0x11a8bd){return _0x11a8bd;})[_0x779e('0xc')](function(_0x55f992){logger[_0x779e('0xd')](_0x55f992);});}function handleSendEmail(_0x1e5c37,_0x180f25){logger[_0x779e('0xe')](_0x779e('0xf'),_0x1e5c37[_0x779e('0x10')]);var _0x42f41e=!![];var _0x5b587d=_0x1e5c37[_0x779e('0x11')]['getSmtpOptions']();var _0x3fe9b5={'account':_0x5b587d,'message':{'from':util['format'](_0x779e('0x12'),_0x1e5c37[_0x779e('0x11')]['name'],_0x1e5c37[_0x779e('0x11')]['email']||_0x1e5c37[_0x779e('0x11')][_0x779e('0x13')][_0x779e('0x14')]),'to':_0x1e5c37[_0x779e('0x10')],'cc':_0x1e5c37['cc'],'bcc':_0x1e5c37[_0x779e('0x15')],'subject':util[_0x779e('0x16')](_0x779e('0x17'),_0x180f25[_0x779e('0x18')],_0x1e5c37[_0x779e('0x19')],_0x1e5c37['subtractUnit'])}};var _0x23c2c1=path['join'](__dirname,_0x779e('0x1a'));var _0x419ed3=_0x180f25[_0x779e('0x1b')];var _0x460773=util[_0x779e('0x16')](_0x779e('0x1c'),path[_0x779e('0x1d')](_0x180f25[_0x779e('0x1b')],path[_0x779e('0x1e')](_0x180f25[_0x779e('0x1b')])),_0x779e('0x1f'));var _0x36b66e=path['join'](_0x23c2c1,_0x419ed3);var _0x33e766=path[_0x779e('0x20')](_0x23c2c1,_0x460773);if(fs[_0x779e('0x21')](_0x36b66e)){_0x180f25[_0x779e('0x22')]='Sent';_0x3fe9b5[_0x779e('0x23')][_0x779e('0x24')]=[{'filename':_0x419ed3,'path':_0x36b66e}];_0x3fe9b5[_0x779e('0x23')][_0x779e('0x25')]=util[_0x779e('0x16')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x779e('0x26')](_0x180f25,null,0x2));}else if(fs[_0x779e('0x21')](_0x33e766)){_0x180f25['status']='Sent';_0x3fe9b5['message'][_0x779e('0x24')]=[{'filename':_0x460773,'path':_0x33e766}];}else{if(_0x180f25[_0x779e('0x22')]==='Empty'){_0x3fe9b5[_0x779e('0x23')][_0x779e('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x1e5c37['sendIfEmpty']){_0x42f41e=![];logger[_0x779e('0xe')](_0x779e('0x27'));}}else if(_0x180f25[_0x779e('0x22')]===_0x779e('0x28')){_0x3fe9b5[_0x779e('0x23')][_0x779e('0x25')]=_0x779e('0x29');}else if(_0x180f25[_0x779e('0x22')]===_0x779e('0x2a')){_0x3fe9b5[_0x779e('0x23')][_0x779e('0x25')]='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(_0x180f25['status']===_0x779e('0x2b')){_0x3fe9b5[_0x779e('0x23')]['text']='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['error'](_0x779e('0x2c'),_0x180f25['status']);}}if(_0x42f41e){return client[_0x779e('0x2d')](_0x779e('0x2e'),_0x3fe9b5)['then'](function(_0x2c71c5){if(_0x2c71c5[_0x779e('0xd')]){return logger[_0x779e('0xd')](_0x779e('0x2f'),JSON['stringify'](_0x2c71c5));}return logger[_0x779e('0xe')]('email\x20sent');})['catch'](function(_0x4bae9a){return logger[_0x779e('0xd')]('error\x20mail',JSON[_0x779e('0x26')](_0x4bae9a));});}}function handleError(){return function(_0x239d56){return logger['error'](JSON[_0x779e('0x26')](_0x239d56));};}function loading(_0x113c1c){logger[_0x779e('0xe')](_0x779e('0x30'));if(_0x113c1c['currentAttempt']===_0x113c1c[_0x779e('0x31')]['retries']){handleSendEmail(_0x113c1c[_0x779e('0x32')],_0x113c1c['data']);_0x113c1c[_0x779e('0x33')][_0x779e('0x34')]();}else{_0x113c1c[_0x779e('0x33')]['retry'](_0x779e('0x35'));}}function completed(_0x3b8941){logger['info'](_0x779e('0x36'));handleSendEmail(_0x3b8941[_0x779e('0x32')],_0x3b8941[_0x779e('0x37')]);_0x3b8941[_0x779e('0x33')]['stop']();}function empty(_0x1a2a72){logger[_0x779e('0xe')](_0x779e('0x38'));handleSendEmail(_0x1a2a72[_0x779e('0x32')],_0x1a2a72[_0x779e('0x37')]);_0x1a2a72[_0x779e('0x33')]['stop']();}function failed(_0x29f7ea){logger[_0x779e('0xe')]('case\x20failed');handleSendEmail(_0x29f7ea[_0x779e('0x32')],_0x29f7ea[_0x779e('0x37')]);_0x29f7ea[_0x779e('0x33')][_0x779e('0x34')]();}function urecognized(_0x4bafd6){logger['error']('Unrecognized\x20status:',_0x4bafd6['entity'][_0x779e('0x39')][_0x779e('0x22')]);_0x4bafd6[_0x779e('0x33')][_0x779e('0x34')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x4aede8,_0xcc51e8){const _0x504a2a={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x4692f9=retry[_0x779e('0x33')](_0x504a2a);_0x4692f9[_0x779e('0x3a')](_0xc30c0a=>{logger[_0x779e('0xe')](_0x779e('0x3b')+_0x4aede8['id']+_0x779e('0x3c')+_0xc30c0a);try{getReportData(_0xcc51e8['id'])['then'](function(_0x3c2919){_0xcc51e8=_0x3c2919;logger['info']('report\x20status:',_0x3c2919[_0x779e('0x39')][_0x779e('0x22')]);if(!reportStatusStrategies[_0x3c2919[_0x779e('0x39')]['status']]){logger[_0x779e('0xd')]('report\x20status:',_0x3c2919[_0x779e('0x39')][_0x779e('0x22')]);_0x4692f9[_0x779e('0x7')]();}reportStatusStrategies[_0x3c2919[_0x779e('0x39')]['status']]({'operation':_0x4692f9,'currentAttempt':_0xc30c0a,'retryOptions':_0x504a2a,'job':_0x4aede8,'data':_0xcc51e8,'entity':_0x3c2919});});}catch(_0x2f9572){_0x4692f9[_0x779e('0x7')](_0x2f9572);}});}function handleResult(_0x1e2a11){return function(_0x610844){if(_0x1e2a11[_0x779e('0x3d')]&&_0x1e2a11[_0x779e('0x11')]&&_0x1e2a11[_0x779e('0x11')][_0x779e('0x13')]&&!_[_0x779e('0x3e')](_0x1e2a11['email'])){retryer(_0x1e2a11,_0x610844);}};}function handleJob(_0x4a561a){return function(){try{if(_[_0x779e('0x3e')](_0x4a561a['subtractNumber'])){return logger[_0x779e('0xe')](_0x779e('0x3f'));}if(_['isNil'](_0x4a561a[_0x779e('0x40')])){return logger['info'](_0x779e('0x41'));}var _0xb76dd={'startDate':moment()['subtract'](_0x4a561a[_0x779e('0x19')],_0x4a561a[_0x779e('0x40')])[_0x779e('0x16')](_0x779e('0x42')),'endDate':moment()[_0x779e('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x4a561a[_0x779e('0x43')],'name':_0x4a561a[_0x779e('0x18')]};if(!_['isNil'](_0x4a561a[_0x779e('0x44')])){logger[_0x779e('0xe')](_0x779e('0x45'),_0x4a561a[_0x779e('0x44')]);return analyticDefaultReportController[_0x779e('0x46')]({'id':_0x4a561a[_0x779e('0x44')]},_0xb76dd)[_0x779e('0xb')](handleResult(_0x4a561a))[_0x779e('0xc')](handleError());}if(!_[_0x779e('0x3e')](_0x4a561a['CustomReportId'])){logger[_0x779e('0xe')](_0x779e('0x47'),_0x4a561a[_0x779e('0x48')]);return analyticCustomReportController[_0x779e('0x46')]({'id':_0x4a561a[_0x779e('0x48')]},_0xb76dd)[_0x779e('0xb')](handleResult(_0x4a561a))[_0x779e('0xc')](handleError());}}catch(_0x2dcf58){logger['error'](JSON[_0x779e('0x26')](_0x2dcf58));}return logger[_0x779e('0xe')]('no\x20report\x20id');};}function getJobs(_0x27647a){var _0x3cec87={};if(_0x27647a){_0x3cec87['id']=_0x27647a;}return db[_0x779e('0x49')][_0x779e('0x4a')]({'where':_0x3cec87,'include':[{'model':db[_0x779e('0x11')],'attributes':['id',_0x779e('0x18'),'email'],'include':[{'model':db[_0x779e('0x4b')],'as':_0x779e('0x13'),'include':[{'model':db['CloudProvider'],'as':_0x779e('0x4c')}]}]}]})[_0x779e('0xb')](function(_0x417b95){var _0x2287e9=_['keys'](manager['jobs']);var _0xcfa63b=_[_0x779e('0x4d')](_0x417b95,function(_0x3787d7){return _0x3787d7['id']['toString']();});var _0x150a12=_['keyBy'](_0x417b95,function(_0x243815){return _0x243815['id']['toString']();});var _0x516a32=_0x27647a?_0xcfa63b:_[_0x779e('0x4e')](_0xcfa63b,_0x2287e9);var _0x30f1ed=_[_0x779e('0x4f')](_0xcfa63b,_0x2287e9);var _0xdddcec=_[_0x779e('0x4e')](_0x2287e9,_0xcfa63b);var _0x590372;var _0x4f5014;for(_0x590372=0x0;_0x590372<_0xdddcec[_0x779e('0x50')]&&!_0x27647a;_0x590372+=0x1){_0x4f5014=_0xdddcec[_0x590372][_0x779e('0x51')]();if(manager[_0x779e('0x52')](_0x4f5014)){manager[_0x779e('0x34')](_0x4f5014);manager[_0x779e('0x53')](_0x4f5014);logger[_0x779e('0xe')](_0x779e('0x54'),_0x4f5014);}}logger[_0x779e('0xe')]('toRun',JSON[_0x779e('0x26')](_0x516a32));for(_0x590372=0x0;_0x590372<_0x516a32['length'];_0x590372+=0x1){_0x4f5014=_0x516a32[_0x590372][_0x779e('0x51')]();if(_0x27647a){logger[_0x779e('0xe')](JSON[_0x779e('0x26')](_0x150a12[_0x4f5014]));BPromise[_0x779e('0x55')]()[_0x779e('0xb')](handleJob(_0x150a12[_0x4f5014]));logger[_0x779e('0xe')]('run\x20job',_0x150a12[_0x4f5014][_0x779e('0x18')],_0x150a12[_0x4f5014][_0x779e('0x56')]);}else if(_0x150a12[_0x4f5014]['cron']&&_0x150a12[_0x4f5014][_0x779e('0x57')]&&moment()[_0x779e('0x58')](_0x150a12[_0x4f5014][_0x779e('0x59')],_0x150a12[_0x4f5014]['endAt'])){manager[_0x779e('0x5a')](_0x4f5014,_0x150a12[_0x4f5014][_0x779e('0x56')],handleJob(_0x150a12[_0x4f5014]));manager['start'](_0x4f5014);logger[_0x779e('0xe')](_0x779e('0x5b'),_0x150a12[_0x4f5014][_0x779e('0x18')],_0x150a12[_0x4f5014][_0x779e('0x56')]);}else if(manager['exists'](_0x4f5014)){manager['stop'](_0x4f5014);manager[_0x779e('0x53')](_0x4f5014);logger[_0x779e('0xe')](_0x779e('0x5c'),_0x150a12[_0x4f5014][_0x779e('0x18')],_0x150a12[_0x4f5014][_0x779e('0x56')]);}}for(_0x590372=0x0,_0x4f5014;_0x590372<_0x30f1ed[_0x779e('0x50')]&&!_0x27647a;_0x590372+=0x1){_0x4f5014=_0x30f1ed[_0x590372]['toString']();if(manager[_0x779e('0x52')](_0x4f5014)){if(_0x150a12[_0x4f5014]['cron']&&_0x150a12[_0x4f5014]['active']&&moment()[_0x779e('0x58')](_0x150a12[_0x4f5014][_0x779e('0x59')],_0x150a12[_0x4f5014]['endAt'])){manager[_0x779e('0x5d')](_0x4f5014,_0x150a12[_0x4f5014][_0x779e('0x56')],handleJob(_0x150a12[_0x4f5014]));logger[_0x779e('0xe')](_0x779e('0x5e'),_0x150a12[_0x4f5014][_0x779e('0x18')],_0x150a12[_0x4f5014][_0x779e('0x56')]);}else{manager[_0x779e('0x34')](_0x4f5014);manager['deleteJob'](_0x4f5014);logger[_0x779e('0xe')]('stop\x20cron',_0x150a12[_0x4f5014][_0x779e('0x18')],_0x150a12[_0x4f5014][_0x779e('0x56')]);}}}})[_0x779e('0xc')](function(_0x4e24cd){logger[_0x779e('0xd')](JSON[_0x779e('0x26')](_0x4e24cd));});}exports[_0x779e('0x5f')]=function(_0x24d32a){return getJobs(_0x24d32a);};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 2e652b1..f3ca5e7 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 _0x9189=['forEach','push','catch','error','inspect','start','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','language','ValidationError','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','Mixed','name','SequelizeValidationError','VoiceRecording','Setting','Settings\x20not\x20available','transcribeAccountId','bucket','Transcribe\x20not\x20configured'];(function(_0x19c66d,_0xe8b995){var _0x481b75=function(_0x4b7674){while(--_0x4b7674){_0x19c66d['push'](_0x19c66d['shift']());}};_0x481b75(++_0xe8b995);}(_0x9189,0x1b0));var _0x9918=function(_0x364f11,_0x29e4f9){_0x364f11=_0x364f11-0x0;var _0x572994=_0x9189[_0x364f11];return _0x572994;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x9918('0x0'));var util=require(_0x9918('0x1'));var BPromise=require(_0x9918('0x2'));var db=require(_0x9918('0x3'))['db'];var logger=require('../../config/logger')(_0x9918('0x4'));function getTranscriptionJob(_0x568567,_0x4cb5a2,_0xfd91d2,_0x325957){return new Promise(function(_0x4a47d4,_0x3ba4a8){var _0x3cb556=new AWS[(_0x9918('0x5'))]({'accessKeyId':_0x4cb5a2,'secretAccessKey':_0x568567,'region':_0xfd91d2});_0x3cb556['getTranscriptionJob']({'TranscriptionJobName':_0x325957},function(_0x5a0552,_0x50a534){if(_0x5a0552){return _0x3ba4a8(_0x5a0552);}else{return _0x4a47d4(_0x50a534);}});});}function sentiment(_0x46bef9,_0x29daaa,_0x553c75,_0x21f0ff,_0x5c5853){return new Promise(function(_0xdf3f27,_0x1a3395){var _0x107c89=new AWS[(_0x9918('0x6'))]({'accessKeyId':_0x29daaa,'secretAccessKey':_0x46bef9,'region':_0x553c75});_0x107c89[_0x9918('0x7')]({'Text':_0x21f0ff,'LanguageCode':_0x5c5853[_0x9918('0x8')](0x0,0x2)},function(_0x911a98,_0x5175b1){if(_0x911a98){return _0x1a3395(_0x911a98);}else{return _0xdf3f27(_0x5175b1);}});});}function checkTranscribeJob(_0x334b55,_0x1a8f69,_0x548f67){var _0x511a2c;return new BPromise(function(_0x43fc75,_0x4b1833){logger['info'](util[_0x9918('0x9')](_0x9918('0xa'),_0x334b55['id'],_0x334b55['transcribeName']));return getTranscriptionJob(_0x548f67[_0x9918('0xb')],_0x548f67['data2'],_0x1a8f69[_0x9918('0xc')],_0x334b55[_0x9918('0xd')])[_0x9918('0xe')](function(_0x420db0){logger[_0x9918('0xf')](util[_0x9918('0x9')](_0x9918('0x10'),_0x334b55['id'],_0x334b55[_0x9918('0xd')],_0x420db0[_0x9918('0x11')][_0x9918('0x12')]));if(!_0x334b55[_0x9918('0x13')]){switch(_0x420db0[_0x9918('0x11')][_0x9918('0x12')]){case _0x9918('0x14'):var _0x1b6ea2={'transcribeStatus':_0x420db0[_0x9918('0x11')][_0x9918('0x12')],'fileUri':_0x420db0[_0x9918('0x11')][_0x9918('0x15')][_0x9918('0x16')]};logger[_0x9918('0xf')](util[_0x9918('0x9')](_0x9918('0x17'),_0x334b55['id']));return rp({'uri':_0x420db0[_0x9918('0x11')][_0x9918('0x15')][_0x9918('0x16')],'json':!![]})['then'](function(_0x2dc468){logger[_0x9918('0xf')](util[_0x9918('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x334b55['id']));if(_0x2dc468&&_0x2dc468[_0x9918('0x18')]&&_0x2dc468[_0x9918('0x18')][_0x9918('0x19')]&&_0x2dc468[_0x9918('0x18')][_0x9918('0x19')][_0x9918('0x1a')]){_0x1b6ea2[_0x9918('0x13')]='';for(var _0x216cc1=0x0;_0x216cc1<_0x2dc468[_0x9918('0x18')][_0x9918('0x19')][_0x9918('0x1a')];_0x216cc1++){_0x1b6ea2[_0x9918('0x13')]+=_0x2dc468[_0x9918('0x18')]['transcripts'][_0x216cc1][_0x9918('0x1b')]+'';}}return _0x334b55[_0x9918('0x1c')](_0x1b6ea2);})[_0x9918('0xe')](function(){logger[_0x9918('0xf')](util[_0x9918('0x9')](_0x9918('0x1d'),_0x334b55['id']));if(!_0x334b55[_0x9918('0x1e')]){throw new db[(_0x9918('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1a8f69[_0x9918('0x20')]||!_0x1a8f69['sentimentAccountId']||!_0x1a8f69['sentimentRegion']||!_0x1a8f69[_0x9918('0x21')]||!_0x1a8f69['bucket']){throw new db[(_0x9918('0x1f'))][(_0x9918('0x22'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1b6ea2['fileText']){throw new Error(_0x9918('0x23'));}if(_0x1a8f69[_0x9918('0x24')]===_0x548f67['id']){return _0x548f67;}else{return db[_0x9918('0x25')][_0x9918('0x26')]({'where':{'id':_settings[_0x9918('0x24')]}});}})['then'](function(_0x11d053){if(!_0x11d053){throw new db[(_0x9918('0x1f'))][(_0x9918('0x22'))](_0x9918('0x27'));}if(!_0x11d053[_0x9918('0xb')]||!_0x11d053['data2']){throw new db[(_0x9918('0x1f'))]['ValidationError'](_0x9918('0x28'));}_0x511a2c=_0x11d053;logger['info'](util[_0x9918('0x9')](_0x9918('0x29'),_0x334b55['id']));return sentiment(_0x511a2c[_0x9918('0xb')],_0x511a2c[_0x9918('0x2a')],_0x1a8f69[_0x9918('0x2b')],_0x1b6ea2[_0x9918('0x13')],_0x1a8f69[_0x9918('0x21')]);})[_0x9918('0xe')](function(_0x287459){logger['info'](util[_0x9918('0x9')](_0x9918('0x2c'),_0x334b55['id']));return _0x334b55[_0x9918('0x1c')]({'sentiment':_0x287459[_0x9918('0x2d')],'sPositive':_0x287459[_0x9918('0x2e')][_0x9918('0x2f')],'sNegative':_0x287459[_0x9918('0x2e')][_0x9918('0x30')],'sMixed':_0x287459['SentimentScore']['Mixed'],'sNeutral':_0x287459[_0x9918('0x2e')][_0x9918('0x31')]});})[_0x9918('0xe')](function(){logger[_0x9918('0xf')](util['format'](_0x9918('0x1d'),_0x334b55['id']));_0x43fc75();});case'FAILED':return _0x334b55[_0x9918('0x1c')]({'transcribeStatus':_0x9918('0x32'),'failureReason':_0x420db0[_0x9918('0x11')][_0x9918('0x33')]})['then'](function(){logger['info'](util[_0x9918('0x9')](_0x9918('0x1d'),_0x334b55['id']));_0x43fc75();});default:logger['info'](util[_0x9918('0x9')](_0x9918('0x34'),_0x334b55['id']));break;}}else{return BPromise[_0x9918('0x35')]()[_0x9918('0xe')](function(){if(!_0x334b55[_0x9918('0x1e')]){throw new db['Sequelize'][(_0x9918('0x22'))](_0x9918('0x36'));}if(!_0x1a8f69[_0x9918('0x20')]||!_0x1a8f69[_0x9918('0x24')]||!_0x1a8f69[_0x9918('0x2b')]||!_0x1a8f69[_0x9918('0x21')]||!_0x1a8f69['bucket']){throw new db[(_0x9918('0x1f'))][(_0x9918('0x22'))](_0x9918('0x37'));}if(!_0x334b55[_0x9918('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x1a8f69[_0x9918('0x24')]===_0x548f67['id']){return _0x548f67;}else{return db[_0x9918('0x25')][_0x9918('0x26')]({'where':{'id':_settings[_0x9918('0x24')]}});}})['then'](function(_0x852651){if(!_0x852651){throw new db['Sequelize'][(_0x9918('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x852651[_0x9918('0xb')]||!_0x852651[_0x9918('0x2a')]){throw new db['Sequelize'][(_0x9918('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x511a2c=_0x852651;logger[_0x9918('0xf')](util[_0x9918('0x9')](_0x9918('0x29'),_0x334b55['id']));return sentiment(_0x511a2c[_0x9918('0xb')],_0x511a2c[_0x9918('0x2a')],_0x1a8f69[_0x9918('0x2b')],_0x334b55['fileText'],_0x1a8f69[_0x9918('0x21')]);})[_0x9918('0xe')](function(_0x4db569){logger[_0x9918('0xf')](util[_0x9918('0x9')](_0x9918('0x2c'),_0x334b55['id']));return _0x334b55[_0x9918('0x1c')]({'sentiment':_0x4db569[_0x9918('0x2d')],'sPositive':_0x4db569['SentimentScore'][_0x9918('0x2f')],'sNegative':_0x4db569[_0x9918('0x2e')][_0x9918('0x30')],'sMixed':_0x4db569[_0x9918('0x2e')][_0x9918('0x38')],'sNeutral':_0x4db569[_0x9918('0x2e')][_0x9918('0x31')],'transcribeStatus':_0x9918('0x14')});})['then'](function(){logger[_0x9918('0xf')](util[_0x9918('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x334b55['id']));_0x43fc75();});}})['catch'](function(_0x49086c){if(_0x49086c){if(!_0x49086c[_0x9918('0x39')]||_0x49086c[_0x9918('0x39')]!==_0x9918('0x3a')){logger['error'](util[_0x9918('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x334b55['id']),util['inspect'](_0x49086c,{'showHidden':![],'depth':null}));}}_0x43fc75();});});}function checkTranscribe(){var _0xbb3800;var _0x5209a7;var _0x5ca79e;return db[_0x9918('0x3b')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x9918('0xe')](function(_0x3f94bf){if(!_0x3f94bf||!_0x3f94bf[_0x9918('0x1a')]){throw new db['Sequelize']['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0xbb3800=_0x3f94bf;return db[_0x9918('0x3c')][_0x9918('0x26')]({'where':{'id':0x1}});})[_0x9918('0xe')](function(_0x3a1106){if(!_0x3a1106){throw new db[(_0x9918('0x1f'))][(_0x9918('0x22'))](_0x9918('0x3d'));}_0x5209a7=_0x3a1106;if(!_0x5209a7[_0x9918('0x4')]||!_0x5209a7[_0x9918('0x3e')]||!_0x5209a7[_0x9918('0xc')]||!_0x5209a7[_0x9918('0x21')]||!_0x5209a7[_0x9918('0x3f')]){throw new db['Sequelize'][(_0x9918('0x22'))](_0x9918('0x40'));}return db[_0x9918('0x25')]['findOne']({'where':{'id':_0x5209a7[_0x9918('0x3e')]}});})[_0x9918('0xe')](function(_0x458c00){if(!_0x458c00){throw new db[(_0x9918('0x1f'))][(_0x9918('0x22'))](_0x9918('0x27'));}if(!_0x458c00[_0x9918('0xb')]||!_0x458c00['data2']){throw new db['Sequelize'][(_0x9918('0x22'))](_0x9918('0x28'));}_0x5ca79e=_0x458c00;var _0x4ee8dd=[];_0xbb3800[_0x9918('0x41')](function(_0x401abf){_0x4ee8dd[_0x9918('0x42')](checkTranscribeJob(_0x401abf,_0x5209a7,_0x5ca79e));});return BPromise['all'](_0x4ee8dd);})[_0x9918('0x43')](function(_0x1ec4f0){if(_0x1ec4f0){if(!_0x1ec4f0[_0x9918('0x39')]||_0x1ec4f0[_0x9918('0x39')]!=='SequelizeValidationError'){logger[_0x9918('0x44')](util[_0x9918('0x45')](_0x1ec4f0,{'showHidden':![],'depth':null}));}}});}exports[_0x9918('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xcd31=['TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','info','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','sentiment','sentimentRegion','findOne','Mixed','catch','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','forEach','push','all','name','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','fileText','TranscriptionJob'];(function(_0x4c7250,_0x286624){var _0x16e46d=function(_0x5069e5){while(--_0x5069e5){_0x4c7250['push'](_0x4c7250['shift']());}};_0x16e46d(++_0x286624);}(_0xcd31,0x15d));var _0x1cd3=function(_0x38ccb4,_0x1897b8){_0x38ccb4=_0x38ccb4-0x0;var _0x4bc3db=_0xcd31[_0x38ccb4];return _0x4bc3db;};var _=require('lodash');var AWS=require(_0x1cd3('0x0'));var rp=require(_0x1cd3('0x1'));var util=require(_0x1cd3('0x2'));var BPromise=require('bluebird');var db=require(_0x1cd3('0x3'))['db'];var logger=require(_0x1cd3('0x4'))(_0x1cd3('0x5'));function getTranscriptionJob(_0x28c67f,_0x295933,_0xf9f49b,_0x5bc77d){return new Promise(function(_0x26ffcb,_0x1ca151){var _0xedb6d1=new AWS['TranscribeService']({'accessKeyId':_0x295933,'secretAccessKey':_0x28c67f,'region':_0xf9f49b});_0xedb6d1[_0x1cd3('0x6')]({'TranscriptionJobName':_0x5bc77d},function(_0x11b139,_0x124659){if(_0x11b139){return _0x1ca151(_0x11b139);}else{return _0x26ffcb(_0x124659);}});});}function sentiment(_0x4a2204,_0x1af2c4,_0x3953d3,_0x17d5c8,_0xb3159f){return new Promise(function(_0x406bc8,_0x3eb8af){var _0x7e5c1a=new AWS['Comprehend']({'accessKeyId':_0x1af2c4,'secretAccessKey':_0x4a2204,'region':_0x3953d3});_0x7e5c1a[_0x1cd3('0x7')]({'Text':_0x17d5c8,'LanguageCode':_0xb3159f[_0x1cd3('0x8')](0x0,0x2)},function(_0x2e460d,_0x44010d){if(_0x2e460d){return _0x3eb8af(_0x2e460d);}else{return _0x406bc8(_0x44010d);}});});}function checkTranscribeJob(_0x5102af,_0xfe288e,_0x4c9c6d){var _0x41016f;return new BPromise(function(_0x35a9ae,_0x3fcc45){logger['info'](util['format'](_0x1cd3('0x9'),_0x5102af['id'],_0x5102af[_0x1cd3('0xa')]));return getTranscriptionJob(_0x4c9c6d[_0x1cd3('0xb')],_0x4c9c6d['data2'],_0xfe288e[_0x1cd3('0xc')],_0x5102af[_0x1cd3('0xa')])[_0x1cd3('0xd')](function(_0x418da3){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5102af['id'],_0x5102af['transcribeName'],_0x418da3['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x5102af[_0x1cd3('0xe')]){switch(_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x10')]){case _0x1cd3('0x11'):var _0x359899={'transcribeStatus':_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x10')],'fileUri':_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x12')][_0x1cd3('0x13')]};logger['info'](util[_0x1cd3('0x14')](_0x1cd3('0x15'),_0x5102af['id']));return rp({'uri':_0x418da3['TranscriptionJob'][_0x1cd3('0x12')][_0x1cd3('0x13')],'json':!![]})['then'](function(_0x20cda5){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x17'),_0x5102af['id']));if(_0x20cda5&&_0x20cda5['results']&&_0x20cda5['results'][_0x1cd3('0x18')]&&_0x20cda5[_0x1cd3('0x19')]['transcripts']['length']){_0x359899[_0x1cd3('0xe')]='';for(var _0x44b162=0x0;_0x44b162<_0x20cda5['results']['transcripts'][_0x1cd3('0x1a')];_0x44b162++){_0x359899[_0x1cd3('0xe')]+=_0x20cda5['results']['transcripts'][_0x44b162][_0x1cd3('0x1b')]+'';}}return _0x5102af[_0x1cd3('0x1c')](_0x359899);})[_0x1cd3('0xd')](function(){logger['info'](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));if(!_0x5102af['tempSentiment']){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x20'));}if(!_0xfe288e['sentiment']||!_0xfe288e[_0x1cd3('0x21')]||!_0xfe288e['sentimentRegion']||!_0xfe288e[_0x1cd3('0x22')]||!_0xfe288e[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError'](_0x1cd3('0x24'));}if(!_0x359899[_0x1cd3('0xe')]){throw new Error(_0x1cd3('0x25'));}if(_0xfe288e[_0x1cd3('0x21')]===_0x4c9c6d['id']){return _0x4c9c6d;}else{return db[_0x1cd3('0x26')]['findOne']({'where':{'id':_settings[_0x1cd3('0x21')]}});}})[_0x1cd3('0xd')](function(_0x1412cb){if(!_0x1412cb){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x27'));}if(!_0x1412cb['data1']||!_0x1412cb[_0x1cd3('0x28')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x41016f=_0x1412cb;logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x29'),_0x5102af['id']));return sentiment(_0x41016f[_0x1cd3('0xb')],_0x41016f[_0x1cd3('0x28')],_0xfe288e['sentimentRegion'],_0x359899[_0x1cd3('0xe')],_0xfe288e['language']);})['then'](function(_0x1633af){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x2a'),_0x5102af['id']));return _0x5102af['update']({'sentiment':_0x1633af[_0x1cd3('0x2b')],'sPositive':_0x1633af['SentimentScore'][_0x1cd3('0x2c')],'sNegative':_0x1633af[_0x1cd3('0x2d')][_0x1cd3('0x2e')],'sMixed':_0x1633af[_0x1cd3('0x2d')]['Mixed'],'sNeutral':_0x1633af['SentimentScore'][_0x1cd3('0x2f')]});})['then'](function(){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});case _0x1cd3('0x30'):return _0x5102af[_0x1cd3('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x418da3['TranscriptionJob']['FailureReason']})['then'](function(){logger[_0x1cd3('0x16')](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});default:logger['info'](util[_0x1cd3('0x14')](_0x1cd3('0x31'),_0x5102af['id']));break;}}else{return BPromise['resolve']()[_0x1cd3('0xd')](function(){if(!_0x5102af[_0x1cd3('0x32')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xfe288e[_0x1cd3('0x33')]||!_0xfe288e[_0x1cd3('0x21')]||!_0xfe288e[_0x1cd3('0x34')]||!_0xfe288e[_0x1cd3('0x22')]||!_0xfe288e[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x24'));}if(!_0x5102af[_0x1cd3('0xe')]){throw new Error('Transcript\x20not\x20available');}if(_0xfe288e['sentimentAccountId']===_0x4c9c6d['id']){return _0x4c9c6d;}else{return db['CloudProvider'][_0x1cd3('0x35')]({'where':{'id':_settings[_0x1cd3('0x21')]}});}})['then'](function(_0x2eeea6){if(!_0x2eeea6){throw new db['Sequelize'][(_0x1cd3('0x1f'))](_0x1cd3('0x27'));}if(!_0x2eeea6[_0x1cd3('0xb')]||!_0x2eeea6[_0x1cd3('0x28')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x41016f=_0x2eeea6;logger[_0x1cd3('0x16')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5102af['id']));return sentiment(_0x41016f[_0x1cd3('0xb')],_0x41016f['data2'],_0xfe288e[_0x1cd3('0x34')],_0x5102af[_0x1cd3('0xe')],_0xfe288e[_0x1cd3('0x22')]);})[_0x1cd3('0xd')](function(_0x326a80){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x2a'),_0x5102af['id']));return _0x5102af['update']({'sentiment':_0x326a80[_0x1cd3('0x2b')],'sPositive':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x2c')],'sNegative':_0x326a80['SentimentScore']['Negative'],'sMixed':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x36')],'sNeutral':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x2f')],'transcribeStatus':_0x1cd3('0x11')});})[_0x1cd3('0xd')](function(){logger[_0x1cd3('0x16')](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});}})[_0x1cd3('0x37')](function(_0xbc7fbe){if(_0xbc7fbe){if(!_0xbc7fbe['name']||_0xbc7fbe['name']!==_0x1cd3('0x38')){logger[_0x1cd3('0x39')](util[_0x1cd3('0x14')](_0x1cd3('0x3a'),_0x5102af['id']),util[_0x1cd3('0x3b')](_0xbc7fbe,{'showHidden':![],'depth':null}));}}_0x35a9ae();});});}function checkTranscribe(){var _0x4e746b;var _0x5da126;var _0x500fcf;return db[_0x1cd3('0x3c')][_0x1cd3('0x3d')]({'where':{'transcribeStatus':_0x1cd3('0x3e')}})[_0x1cd3('0xd')](function(_0x1ae177){if(!_0x1ae177||!_0x1ae177['length']){throw new db['Sequelize'][(_0x1cd3('0x1f'))](_0x1cd3('0x3f'));}_0x4e746b=_0x1ae177;return db['Setting'][_0x1cd3('0x35')]({'where':{'id':0x1}});})[_0x1cd3('0xd')](function(_0x2542f6){if(!_0x2542f6){throw new db['Sequelize']['ValidationError'](_0x1cd3('0x40'));}_0x5da126=_0x2542f6;if(!_0x5da126['transcribe']||!_0x5da126[_0x1cd3('0x41')]||!_0x5da126[_0x1cd3('0xc')]||!_0x5da126[_0x1cd3('0x22')]||!_0x5da126[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x42'));}return db[_0x1cd3('0x26')]['findOne']({'where':{'id':_0x5da126[_0x1cd3('0x41')]}});})[_0x1cd3('0xd')](function(_0xbd4ea2){if(!_0xbd4ea2){throw new db[(_0x1cd3('0x1e'))]['ValidationError'](_0x1cd3('0x27'));}if(!_0xbd4ea2[_0x1cd3('0xb')]||!_0xbd4ea2[_0x1cd3('0x28')]){throw new db['Sequelize']['ValidationError'](_0x1cd3('0x43'));}_0x500fcf=_0xbd4ea2;var _0x5e31b2=[];_0x4e746b[_0x1cd3('0x44')](function(_0x233ef5){_0x5e31b2[_0x1cd3('0x45')](checkTranscribeJob(_0x233ef5,_0x5da126,_0x500fcf));});return BPromise[_0x1cd3('0x46')](_0x5e31b2);})['catch'](function(_0x12a2d0){if(_0x12a2d0){if(!_0x12a2d0[_0x1cd3('0x47')]||_0x12a2d0[_0x1cd3('0x47')]!==_0x1cd3('0x38')){logger['error'](util[_0x1cd3('0x3b')](_0x12a2d0,{'showHidden':![],'depth':null}));}}});}exports[_0x1cd3('0x48')]=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 ca5cc9c..2eb63c7 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 _0xf893=['error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','socket.io-emitter','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf893,0xf3));var _0x3f89=function(_0x289e5c,_0x2a08fb){_0x289e5c=_0x289e5c-0x0;var _0x464cb8=_0xf893[_0x289e5c];return _0x464cb8;};'use strict';var _=require(_0x3f89('0x0'));var moment=require(_0x3f89('0x1'));var Redis=require(_0x3f89('0x2'));var util=require(_0x3f89('0x3'));var config=require(_0x3f89('0x4'));var db=require(_0x3f89('0x5'))['db'];var logger=require(_0x3f89('0x6'))(_0x3f89('0x7'));config['redis']=_[_0x3f89('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3f89('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x117f1c=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x3f89('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x3f89('0xb')](0x18,_0x3f89('0xc'))}}})[_0x3f89('0xd')](function(_0x1c6cae){if(_0x1c6cae&&_0x1c6cae[_0x3f89('0xe')]){_0x117f1c=_[_0x3f89('0xf')](_0x1c6cae||[],'id');logger[_0x3f89('0x10')](_0x3f89('0x11'),_0x117f1c[_0x3f89('0x12')]());return db[_0x3f89('0x13')]['update']({'closeReason':_0x3f89('0x14'),'disposition':_0x3f89('0x15'),'closed':!![],'closedAt':moment()[_0x3f89('0x16')](_0x3f89('0x17'))},{'where':{'id':_0x117f1c}});}})[_0x3f89('0xd')](function(){if(_0x117f1c&&_0x117f1c['length']){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x117f1c[_0x3f89('0x12')]());for(var _0x3de146=0x0;_0x3de146<_0x117f1c['length'];_0x3de146++){io[_0x3f89('0x18')](_0x3f89('0x19'),{'id':_0x117f1c[_0x3de146],'closed':!![]});}}})[_0x3f89('0x1a')](function(_0x152799){logger[_0x3f89('0x1b')](_0x3f89('0x1c'),_0x152799?util[_0x3f89('0x1d')](_0x152799,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x53f3=['map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','start','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','lastMsgAt','subtract','hours','then'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x53f3,0x10a));var _0x353f=function(_0x418c14,_0x47039e){_0x418c14=_0x418c14-0x0;var _0x5a1918=_0x53f3[_0x418c14];return _0x5a1918;};'use strict';var _=require('lodash');var moment=require(_0x353f('0x0'));var Redis=require('ioredis');var util=require(_0x353f('0x1'));var config=require(_0x353f('0x2'));var db=require(_0x353f('0x3'))['db'];var logger=require(_0x353f('0x4'))(_0x353f('0x5'));config[_0x353f('0x6')]=_[_0x353f('0x7')](config[_0x353f('0x6')],{'host':_0x353f('0x8'),'port':0x18eb});var io=require(_0x353f('0x9'))(new Redis(config[_0x353f('0x6')]));function closeInteractions(){var _0x557695=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x353f('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x353f('0xb')](0x18,_0x353f('0xc'))}}})[_0x353f('0xd')](function(_0x2c0b44){if(_0x2c0b44&&_0x2c0b44['length']){_0x557695=_[_0x353f('0xe')](_0x2c0b44||[],'id');logger[_0x353f('0xf')](_0x353f('0x10'),_0x557695[_0x353f('0x11')]());return db['WhatsappInteraction'][_0x353f('0x12')]({'closeReason':_0x353f('0x13'),'disposition':_0x353f('0x14'),'closed':!![],'closedAt':moment()['format'](_0x353f('0x15'))},{'where':{'id':_0x557695}});}})[_0x353f('0xd')](function(){if(_0x557695&&_0x557695[_0x353f('0x16')]){logger[_0x353f('0xf')](_0x353f('0x17'),_0x557695[_0x353f('0x11')]());for(var _0x22c539=0x0;_0x22c539<_0x557695[_0x353f('0x16')];_0x22c539++){io[_0x353f('0x18')](_0x353f('0x19'),{'id':_0x557695[_0x22c539],'closed':!![]});}}})[_0x353f('0x1a')](function(_0x2498bf){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2498bf?util['inspect'](_0x2498bf,{'showHidden':![],'depth':null}):'');});}exports[_0x353f('0x1b')]=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 a52bade..6cce9e5 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ae=['@xcally.com','now','Biondo','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','catch','util','push','Innocenzo','innocenzo.biondo'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x54ae,0xf8));var _0xe54a=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x54ae[_0x1147ab];return _0x55cb5a;};'use strict';var util=require(_0xe54a('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe54a('0x1')]({'id':i,'firstName':_0xe54a('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xe54a('0x3')+i+_0xe54a('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe54a('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe54a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe54a('0x5')](),'updatedAt':Date[_0xe54a('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe54a('0x1')]({'id':i,'firstName':_0xe54a('0x2')+i,'lastName':_0xe54a('0x6')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe54a('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xe54a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe54a('0x5')](),'updatedAt':Date['now']()});}db[_0xe54a('0x7')][_0xe54a('0x8')]({'where':{}})[_0xe54a('0x9')](function(){return db[_0xe54a('0x7')][_0xe54a('0xa')](contacts);})['then'](function(){console['log'](_0xe54a('0xb'),_0xe54a('0xc'));return db[_0xe54a('0xd')][_0xe54a('0x8')]({'where':{}});})[_0xe54a('0x9')](function(){return db[_0xe54a('0xd')][_0xe54a('0xa')](hopper);})['then'](function(){console[_0xe54a('0xe')](_0xe54a('0xb'),_0xe54a('0xf'));return db['CmContact'][_0xe54a('0xa')](contacts2);})[_0xe54a('0x9')](function(){console[_0xe54a('0xe')]('finished\x20populating',_0xe54a('0x10'));return db['CmHopper'][_0xe54a('0xa')](hopper2);})['then'](function(){console[_0xe54a('0xe')](_0xe54a('0xb'),'hopper2');})[_0xe54a('0x11')](function(_0x5f55fa){console[_0xe54a('0xe')](_0x5f55fa);}); \ No newline at end of file +var _0xae72=['util','../mysqldb','Biondo','@xcally.com','push','now','Innocenzo','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper2'];(function(_0x5312b8,_0x332153){var _0x44f5f7=function(_0x47aaed){while(--_0x47aaed){_0x5312b8['push'](_0x5312b8['shift']());}};_0x44f5f7(++_0x332153);}(_0xae72,0x110));var _0x2ae7=function(_0xa6a3b1,_0x5ccc11){_0xa6a3b1=_0xa6a3b1-0x0;var _0x4054ff=_0xae72[_0xa6a3b1];return _0x4054ff;};'use strict';var util=require(_0x2ae7('0x0'));var db=require(_0x2ae7('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x2ae7('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x2ae7('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2ae7('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x2ae7('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2ae7('0x5')](),'updatedAt':Date[_0x2ae7('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2ae7('0x4')]({'id':i,'firstName':_0x2ae7('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2ae7('0x7')+i+_0x2ae7('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2ae7('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x2ae7('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2ae7('0x5')](),'updatedAt':Date[_0x2ae7('0x5')]()});}db[_0x2ae7('0x8')][_0x2ae7('0x9')]({'where':{}})[_0x2ae7('0xa')](function(){return db['CmContact'][_0x2ae7('0xb')](contacts);})[_0x2ae7('0xa')](function(){console[_0x2ae7('0xc')](_0x2ae7('0xd'),_0x2ae7('0xe'));return db[_0x2ae7('0xf')]['destroy']({'where':{}});})[_0x2ae7('0xa')](function(){return db[_0x2ae7('0xf')][_0x2ae7('0xb')](hopper);})[_0x2ae7('0xa')](function(){console[_0x2ae7('0xc')]('finished\x20populating','hopper1');return db['CmContact'][_0x2ae7('0xb')](contacts2);})[_0x2ae7('0xa')](function(){console['log'](_0x2ae7('0xd'),'contacts2');return db[_0x2ae7('0xf')][_0x2ae7('0xb')](hopper2);})[_0x2ae7('0xa')](function(){console[_0x2ae7('0xc')](_0x2ae7('0xd'),_0x2ae7('0x10'));})['catch'](function(_0x4602b6){console['log'](_0x4602b6);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 9a5bced..5cd39c3 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc364=['add\x20user','util','push','format','%s%s','agent','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xc364,0x86));var _0x4c36=function(_0x1a69df,_0xaad1db){_0x1a69df=_0x1a69df-0x0;var _0xb82082=_0xc364[_0x1a69df];return _0xb82082;};'use strict';var util=require(_0x4c36('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x4c36('0x1')]({'name':util[_0x4c36('0x2')](_0x4c36('0x3'),'agent',i),'fullname':util[_0x4c36('0x2')]('%s%s',_0x4c36('0x4'),i),'email':util[_0x4c36('0x2')]('%s%s@xcally.com','agent',i),'role':_0x4c36('0x4'),'password':_0x4c36('0x5'),'internal':0xfa0+i,'type':_0x4c36('0x6'),'transport':[_0x4c36('0x7'),'ws',_0x4c36('0x8')],'disallow':['all'],'allow':[_0x4c36('0x9')],'defaultuser':util[_0x4c36('0x2')]('%s%s','agent',i),'encryption':_0x4c36('0xa'),'avpf':_0x4c36('0xa'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x4c36('0xa'),'dtlsverify':'no','dtlscertfile':_0x4c36('0xb'),'dtlsprivatekey':_0x4c36('0xc'),'dtlssetup':_0x4c36('0xd'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x4c36('0x2')](_0x4c36('0x3'),_0x4c36('0x4'),i),0xfa0+i)});}db[_0x4c36('0xe')][_0x4c36('0xf')](users)[_0x4c36('0x10')](function(){console[_0x4c36('0x11')](_0x4c36('0x12'));})['catch'](function(_0x3530c7){console['log'](_0x3530c7);}); \ No newline at end of file +var _0x5485=['%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','then','log','../mysqldb','push','format','%s%s','agent'];(function(_0x2aa0f0,_0x21a1c4){var _0x54014a=function(_0x569952){while(--_0x569952){_0x2aa0f0['push'](_0x2aa0f0['shift']());}};_0x54014a(++_0x21a1c4);}(_0x5485,0x1f3));var _0x5548=function(_0x456b90,_0x42844b){_0x456b90=_0x456b90-0x0;var _0x402b71=_0x5485[_0x456b90];return _0x402b71;};'use strict';var util=require('util');var db=require(_0x5548('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5548('0x1')]({'name':util[_0x5548('0x2')](_0x5548('0x3'),_0x5548('0x4'),i),'fullname':util['format'](_0x5548('0x3'),'agent',i),'email':util[_0x5548('0x2')](_0x5548('0x5'),_0x5548('0x4'),i),'role':_0x5548('0x4'),'password':_0x5548('0x6'),'internal':0xfa0+i,'type':_0x5548('0x7'),'transport':[_0x5548('0x8'),'ws',_0x5548('0x9')],'disallow':['all'],'allow':[_0x5548('0xa')],'defaultuser':util[_0x5548('0x2')](_0x5548('0x3'),'agent',i),'encryption':_0x5548('0xb'),'avpf':_0x5548('0xb'),'force_avp':_0x5548('0xb'),'icesupport':_0x5548('0xb'),'dtlsenable':_0x5548('0xb'),'dtlsverify':'no','dtlscertfile':_0x5548('0xc'),'dtlsprivatekey':_0x5548('0xd'),'dtlssetup':_0x5548('0xe'),'callerid':util[_0x5548('0x2')]('\x22%s\x22\x20<%s>',util[_0x5548('0x2')](_0x5548('0x3'),_0x5548('0x4'),i),0xfa0+i)});}db[_0x5548('0xf')]['bulkCreate'](users)[_0x5548('0x10')](function(){console[_0x5548('0x11')]('add\x20user');})['catch'](function(_0x5dd8df){console[_0x5548('0x11')](_0x5dd8df);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 34d032c..82a9e60 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00b3=['whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','user_has_chat_interactions:remove','MailInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remoteAddress','request','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','agent','telephone','ivr','UserProfileSection','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','role','Campaign','type','then','format','%s:queue:%s','Agents','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','Trunk','user','VoiceQueues','MailQueue','OpenchannelQueue','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','sms','mail','openchannel'];(function(_0x13c0c2,_0x3195f6){var _0x4bb6f9=function(_0x55bdac){while(--_0x55bdac){_0x13c0c2['push'](_0x13c0c2['shift']());}};_0x4bb6f9(++_0x3195f6);}(_0x00b3,0x157));var _0x300b=function(_0xe4184a,_0x4393fc){_0xe4184a=_0xe4184a-0x0;var _0x1a318a=_0x00b3[_0xe4184a];return _0x1a318a;};'use strict';var _=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var db=require(_0x300b('0x3'))['db'];var config=require(_0x300b('0x4'));var queryQueues={'attributes':['id',_0x300b('0x5')],'include':[{'as':'Agents','model':db[_0x300b('0x6')],'attributes':['id',_0x300b('0x5'),'role'],'raw':!![],'where':{'role':_0x300b('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x300b('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x300b('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x300b('0x5')],'where':{'role':_0x300b('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x300b('0x5'),'type'],'where':{'type':_0x300b('0x9')}};function getAssociatedResources(_0x2646db,_0x4379cd,_0xe6e730){return db[_0x300b('0xa')]['findOne']({'where':{'name':_0x2646db,'userProfileId':_0x4379cd},'raw':!![]})['then'](function(_0x25f1cc){if(_0x25f1cc){if(_0x25f1cc[_0x300b('0xb')]){switch(_0x2646db){case'VoiceQueues':case _0x300b('0xc'):case _0x300b('0xd'):case'SmsQueues':case _0x300b('0xe'):case _0x300b('0xf'):case _0x300b('0x10'):return db[_0xe6e730][_0x300b('0x11')](queryQueues);case _0x300b('0x12'):return db[_0xe6e730][_0x300b('0x11')](queryTelephones);case _0x300b('0x13'):return db[_0xe6e730][_0x300b('0x11')](queryTrunks);case _0x300b('0x14'):return db[_0xe6e730]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0x300b('0x11')]({'attributes':[_0x300b('0x15')],'where':{'sectionId':_0x25f1cc['id']},'raw':!![]})['then'](function(_0x4c0cac){if(_0x4c0cac){var _0x2958ac={'where':{'id':_[_0x300b('0x16')](_0x4c0cac,_0x300b('0x15'))},'raw':!![]};switch(_0xe6e730){case _0x300b('0x6'):_0x2958ac[_0x300b('0x17')][_0x300b('0x18')]=_0x300b('0x8');break;case _0x300b('0x19'):_0x2958ac['where'][_0x300b('0x1a')]=_0x300b('0x9');break;}return db[_0xe6e730][_0x300b('0x11')](_0x2958ac);}else{return[];}});}}else{return[];}})[_0x300b('0x1b')](function(_0x310b2c){return _0x310b2c;});}function joinOrLeaveQueues(_0x333916,_0x5e02ad,_0x585113,_0x4831c5){_0x333916[_0x5e02ad](util[_0x300b('0x1c')](_0x300b('0x1d'),_0x585113,_0x4831c5['name']));if(_0x4831c5[_0x300b('0x1e')]){for(var _0x5e1895=0x0;_0x5e1895<_0x4831c5[_0x300b('0x1e')]['length'];_0x5e1895+=0x1){_0x333916[_0x5e02ad](util[_0x300b('0x1c')](_0x300b('0x1f'),_0x4831c5['Agents'][_0x5e1895][_0x300b('0x5')]));}}}function joinOrLeave(_0x3bcbee,_0x532980,_0x6c122c){var _0x516c25;if(_0x3bcbee[_0x300b('0x20')][_0x300b('0x21')]['id']){db[_0x300b('0x6')][_0x300b('0x22')]({'attributes':['id',_0x300b('0x5'),_0x300b('0x18'),_0x300b('0x23')],'where':{'id':_0x3bcbee['handshake'][_0x300b('0x21')]['id']},'include':[{'model':db[_0x300b('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x300b('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x300b('0x26')],'as':_0x300b('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x300b('0x28')],'as':_0x300b('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x300b('0x2a')],'as':_0x300b('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x300b('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x300b('0x1b')](function(_0x395066){if(_0x395066){_0x516c25=_0x395066;_0x3bcbee[_0x532980](util[_0x300b('0x1c')](_0x300b('0x1f'),_0x395066[_0x300b('0x5')]));var _0x3475b6=[];switch(_0x395066['role']){case _0x300b('0x2d'):_0x3bcbee[_0x532980](_0x300b('0x2e'));_0x3bcbee[_0x532980](_0x300b('0x2f'));if(queryQueues[_0x300b('0x30')](_0x300b('0x31'))){delete queryQueues['include'];}_0x3475b6[_0x300b('0x32')](db[_0x300b('0x33')][_0x300b('0x11')](queryQueues));_0x3475b6[_0x300b('0x32')](db[_0x300b('0x34')]['findAll'](queryQueues));_0x3475b6[_0x300b('0x32')](db[_0x300b('0x35')][_0x300b('0x11')](queryQueues));_0x3475b6[_0x300b('0x32')](db[_0x300b('0x36')][_0x300b('0x11')](queryQueues));_0x3475b6[_0x300b('0x32')](db['MailQueue']['findAll'](queryQueues));_0x3475b6[_0x300b('0x32')](db['OpenchannelQueue'][_0x300b('0x11')](queryQueues));_0x3475b6['push'](db['WhatsappQueue'][_0x300b('0x11')](queryQueues));_0x3475b6[_0x300b('0x32')](db['User'][_0x300b('0x11')](queryTelephones));_0x3475b6['push'](db[_0x300b('0x37')][_0x300b('0x11')](queryTrunks));_0x3475b6['push'](db[_0x300b('0x19')]['findAll'](queryCampaigns));_0x3475b6['push'](db[_0x300b('0x6')]['findAll'](queryAgents));break;case _0x300b('0x38'):_0x3bcbee[_0x532980](_0x300b('0x2e'));_0x3bcbee[_0x532980](_0x300b('0x2f'));_0x3475b6[_0x300b('0x32')](getAssociatedResources(_0x300b('0x39'),_0x395066['userProfileId'],_0x300b('0x33')));_0x3475b6['push'](getAssociatedResources(_0x300b('0xc'),_0x395066['userProfileId'],_0x300b('0x34')));_0x3475b6[_0x300b('0x32')](getAssociatedResources('FaxQueues',_0x395066[_0x300b('0x23')],_0x300b('0x35')));_0x3475b6['push'](getAssociatedResources('SmsQueues',_0x395066[_0x300b('0x23')],_0x300b('0x36')));_0x3475b6[_0x300b('0x32')](getAssociatedResources('MailQueues',_0x395066[_0x300b('0x23')],_0x300b('0x3a')));_0x3475b6[_0x300b('0x32')](getAssociatedResources(_0x300b('0xf'),_0x395066['userProfileId'],_0x300b('0x3b')));_0x3475b6['push'](getAssociatedResources(_0x300b('0x10'),_0x395066[_0x300b('0x23')],_0x300b('0x3c')));_0x3475b6[_0x300b('0x32')](getAssociatedResources(_0x300b('0x12'),_0x395066[_0x300b('0x23')],'User'));_0x3475b6[_0x300b('0x32')](getAssociatedResources(_0x300b('0x13'),_0x395066[_0x300b('0x23')],_0x300b('0x37')));_0x3475b6[_0x300b('0x32')](getAssociatedResources('IvrCampaigns',_0x395066[_0x300b('0x23')],_0x300b('0x19')));_0x3475b6[_0x300b('0x32')](db['User'][_0x300b('0x11')](queryAgents));break;case _0x300b('0x7'):_0x3bcbee[_0x532980](_0x300b('0x2e'));_0x3bcbee[_0x532980](_0x300b('0x2f'));_0x3475b6['push'](_0x395066[_0x300b('0x3d')]({'attributes':['id','name']}));_0x3475b6[_0x300b('0x32')](_0x395066[_0x300b('0x3e')]({'attributes':['id',_0x300b('0x5')]}));_0x3475b6[_0x300b('0x32')](_0x395066[_0x300b('0x3f')]({'attributes':['id',_0x300b('0x5')]}));_0x3475b6[_0x300b('0x32')](_0x395066[_0x300b('0x40')]({'attributes':['id',_0x300b('0x5')]}));_0x3475b6['push'](_0x395066[_0x300b('0x41')]({'attributes':['id',_0x300b('0x5')]}));_0x3475b6[_0x300b('0x32')](_0x395066['getOpenchannelQueues']({'attributes':['id','name']}));_0x3475b6[_0x300b('0x32')](_0x395066[_0x300b('0x42')]({'attributes':['id',_0x300b('0x5')]}));break;}return BPromise[_0x300b('0x43')](_0x3475b6);}})[_0x300b('0x1b')](function(_0x284d11){if(_0x284d11&&_0x284d11[_0x300b('0x44')]){for(var _0x2ba658=0x0;_0x2ba658<_0x284d11['length'];_0x2ba658+=0x1){for(var _0x1c401d=0x0;_0x1c401d<_0x284d11[_0x2ba658][_0x300b('0x44')];_0x1c401d+=0x1){switch(_0x2ba658){case 0x0:joinOrLeaveQueues(_0x3bcbee,_0x532980,_0x300b('0x45'),_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x1:joinOrLeaveQueues(_0x3bcbee,_0x532980,'chat',_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x2:joinOrLeaveQueues(_0x3bcbee,_0x532980,'fax',_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x3:joinOrLeaveQueues(_0x3bcbee,_0x532980,_0x300b('0x46'),_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x4:joinOrLeaveQueues(_0x3bcbee,_0x532980,_0x300b('0x47'),_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x5:joinOrLeaveQueues(_0x3bcbee,_0x532980,_0x300b('0x48'),_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x6:joinOrLeaveQueues(_0x3bcbee,_0x532980,_0x300b('0x49'),_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x7:if(_0x516c25[_0x300b('0x18')]!==_0x300b('0x7'))_0x3bcbee[_0x532980](util['format'](_0x300b('0x4a'),_0x284d11[_0x2ba658][_0x1c401d][_0x300b('0x5')]));break;case 0x8:if(_0x516c25[_0x300b('0x18')]!==_0x300b('0x7'))_0x3bcbee[_0x532980](util[_0x300b('0x1c')](_0x300b('0x4b'),_0x284d11[_0x2ba658][_0x1c401d][_0x300b('0x5')]));break;case 0x9:if(_0x516c25[_0x300b('0x18')]!==_0x300b('0x7'))_0x3bcbee[_0x532980](util[_0x300b('0x1c')](_0x300b('0x4c'),_0x284d11[_0x2ba658][_0x1c401d]['type'],_0x284d11[_0x2ba658][_0x1c401d][_0x300b('0x5')]));break;case 0xa:_0x3bcbee[_0x532980](util[_0x300b('0x1c')](_0x300b('0x1f'),_0x284d11[_0x2ba658][_0x1c401d][_0x300b('0x5')]));break;}}}}})[_0x300b('0x1b')](function(){if(_0x532980===_0x300b('0x4d')){var _0x2847bc=_[_0x300b('0x16')](_0x516c25[_0x300b('0x4e')],'id');return _0x516c25['removeChatInteractions'](_0x2847bc)[_0x300b('0x1b')](function(){for(var _0x40ec3d=0x0;_0x40ec3d<_0x2847bc[_0x300b('0x44')];_0x40ec3d+=0x1){_0x6c122c['emit'](_0x300b('0x4f'),{'ChatInteractionId':Number(_0x2847bc[_0x40ec3d]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x1b')](function(){if(_0x532980===_0x300b('0x4d')){var _0x2865a7=_[_0x300b('0x16')](_0x516c25[_0x300b('0x50')],'id');return _0x516c25['removeMailInteractions'](_0x2865a7)[_0x300b('0x1b')](function(){for(var _0xa414be=0x0;_0xa414be<_0x2865a7[_0x300b('0x44')];_0xa414be+=0x1){_0x6c122c[_0x300b('0x51')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x2865a7[_0xa414be]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x1b')](function(){if(_0x532980==='leave'){var _0x4b0ffb=_[_0x300b('0x16')](_0x516c25[_0x300b('0x27')],'id');return _0x516c25['removeFaxInteractions'](_0x4b0ffb)[_0x300b('0x1b')](function(){for(var _0xcbb9b7=0x0;_0xcbb9b7<_0x4b0ffb[_0x300b('0x44')];_0xcbb9b7+=0x1){_0x6c122c['emit'](_0x300b('0x52'),{'FaxInteractionId':Number(_0x4b0ffb[_0xcbb9b7]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x1b')](function(){if(_0x532980===_0x300b('0x4d')){var _0x1ee1e6=_[_0x300b('0x16')](_0x516c25[_0x300b('0x29')],'id');return _0x516c25[_0x300b('0x53')](_0x1ee1e6)[_0x300b('0x1b')](function(){for(var _0x240693=0x0;_0x240693<_0x1ee1e6['length'];_0x240693+=0x1){_0x6c122c[_0x300b('0x51')](_0x300b('0x54'),{'SmsInteractionId':Number(_0x1ee1e6[_0x240693]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x1b')](function(){if(_0x532980===_0x300b('0x4d')){var _0x30ad1c=_[_0x300b('0x16')](_0x516c25[_0x300b('0x2b')],'id');return _0x516c25[_0x300b('0x55')](_0x30ad1c)[_0x300b('0x1b')](function(){for(var _0x123820=0x0;_0x123820<_0x30ad1c[_0x300b('0x44')];_0x123820+=0x1){_0x6c122c[_0x300b('0x51')](_0x300b('0x56'),{'OpenchannelInteractionId':Number(_0x30ad1c[_0x123820]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x1b')](function(){if(_0x532980==='leave'){var _0x59a501=_[_0x300b('0x16')](_0x516c25[_0x300b('0x57')],'id');return _0x516c25[_0x300b('0x58')](_0x59a501)['then'](function(){for(var _0x10ad48=0x0;_0x10ad48<_0x59a501[_0x300b('0x44')];_0x10ad48+=0x1){_0x6c122c[_0x300b('0x51')](_0x300b('0x59'),{'WhatsappInteractionId':Number(_0x59a501[_0x10ad48]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x5a')](function(_0x41ff87){_0x3bcbee['log'](_0x41ff87);});}}function onDisconnect(_0x57e597,_0x2f0920){joinOrLeave(_0x57e597,'leave',_0x2f0920);}function onConnect(_0x771380){joinOrLeave(_0x771380,_0x300b('0x5b'));}exports[_0x300b('0x5c')]=function(_0x1f7952){_0x1f7952['on'](_0x300b('0x5d'),function(_0x458df4){_0x458df4[_0x300b('0x5e')](0x0);_0x458df4[_0x300b('0x5f')]=_0x458df4['request'][_0x300b('0x5d')][_0x300b('0x60')]+':'+_0x458df4[_0x300b('0x61')][_0x300b('0x5d')]['remotePort'];_0x458df4['connectedAt']=new Date();_0x458df4[_0x300b('0x62')]=function(_0x9bbcec){console[_0x300b('0x62')](_0x300b('0x63')+_0x458df4[_0x300b('0x64')][_0x300b('0x5')]+'['+_0x458df4[_0x300b('0x5f')]+']',_0x9bbcec);};_0x458df4['on'](_0x300b('0x65'),function(){onDisconnect(_0x458df4,_0x1f7952);_0x458df4[_0x300b('0x62')](_0x300b('0x66'));});onConnect(_0x458df4);_0x458df4[_0x300b('0x62')](_0x300b('0x67'));});}; \ No newline at end of file +var _0x93e9=['user_has_whatsapp_interactions:remove','log','join','default','connection','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','OpenchannelQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','Campaign','type','format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','WhatsappQueue','Trunk','user','ChatQueues','ChatQueue','FaxQueues','OpenchannelQueue','WhatsappQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions'];(function(_0x5713f2,_0x40ef5f){var _0x52232b=function(_0x3b30f1){while(--_0x3b30f1){_0x5713f2['push'](_0x5713f2['shift']());}};_0x52232b(++_0x40ef5f);}(_0x93e9,0xcc));var _0x993e=function(_0x4a8c66,_0xaa36a3){_0x4a8c66=_0x4a8c66-0x0;var _0x55eeea=_0x93e9[_0x4a8c66];return _0x55eeea;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var BPromise=require(_0x993e('0x2'));var db=require(_0x993e('0x3'))['db'];var config=require(_0x993e('0x4'));var queryQueues={'attributes':['id',_0x993e('0x5')],'include':[{'as':_0x993e('0x6'),'model':db['User'],'attributes':['id','name',_0x993e('0x7')],'raw':!![],'where':{'role':_0x993e('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x993e('0x5')],'where':{'role':_0x993e('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x993e('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x993e('0x5')],'where':{'role':_0x993e('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x993e('0x5'),'type'],'where':{'type':_0x993e('0xa')}};function getAssociatedResources(_0x69ff1,_0x15d774,_0x280291){return db[_0x993e('0xb')][_0x993e('0xc')]({'where':{'name':_0x69ff1,'userProfileId':_0x15d774},'raw':!![]})[_0x993e('0xd')](function(_0x48291a){if(_0x48291a){if(_0x48291a[_0x993e('0xe')]){switch(_0x69ff1){case _0x993e('0xf'):case'ChatQueues':case'FaxQueues':case _0x993e('0x10'):case'MailQueues':case _0x993e('0x11'):case'WhatsappQueues':return db[_0x280291]['findAll'](queryQueues);case _0x993e('0x12'):return db[_0x280291][_0x993e('0x13')](queryTelephones);case _0x993e('0x14'):return db[_0x280291][_0x993e('0x13')](queryTrunks);case _0x993e('0x15'):return db[_0x280291][_0x993e('0x13')](queryCampaigns);}}else{return db[_0x993e('0x16')][_0x993e('0x13')]({'attributes':[_0x993e('0x17')],'where':{'sectionId':_0x48291a['id']},'raw':!![]})[_0x993e('0xd')](function(_0x1a7726){if(_0x1a7726){var _0x135771={'where':{'id':_[_0x993e('0x18')](_0x1a7726,_0x993e('0x17'))},'raw':!![]};switch(_0x280291){case _0x993e('0x19'):_0x135771[_0x993e('0x1a')][_0x993e('0x7')]='telephone';break;case _0x993e('0x1b'):_0x135771[_0x993e('0x1a')][_0x993e('0x1c')]=_0x993e('0xa');break;}return db[_0x280291][_0x993e('0x13')](_0x135771);}else{return[];}});}}else{return[];}})[_0x993e('0xd')](function(_0x5f3205){return _0x5f3205;});}function joinOrLeaveQueues(_0x11cd41,_0xc00010,_0x1eaf57,_0x22390e){_0x11cd41[_0xc00010](util[_0x993e('0x1d')](_0x993e('0x1e'),_0x1eaf57,_0x22390e[_0x993e('0x5')]));if(_0x22390e[_0x993e('0x6')]){for(var _0x4bbe9c=0x0;_0x4bbe9c<_0x22390e[_0x993e('0x6')]['length'];_0x4bbe9c+=0x1){_0x11cd41[_0xc00010](util[_0x993e('0x1d')](_0x993e('0x1f'),_0x22390e[_0x993e('0x6')][_0x4bbe9c]['name']));}}}function joinOrLeave(_0x2353d4,_0x13db4e,_0xfba00f){var _0x1c52fd;if(_0x2353d4[_0x993e('0x20')][_0x993e('0x21')]['id']){db[_0x993e('0x19')][_0x993e('0x22')]({'attributes':['id',_0x993e('0x5'),_0x993e('0x7'),_0x993e('0x23')],'where':{'id':_0x2353d4[_0x993e('0x20')]['query']['id']},'include':[{'model':db[_0x993e('0x24')],'as':_0x993e('0x25'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x993e('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x993e('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x993e('0x28')],'as':_0x993e('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x993e('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x993e('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x993e('0xd')](function(_0x4a4f00){if(_0x4a4f00){_0x1c52fd=_0x4a4f00;_0x2353d4[_0x13db4e](util[_0x993e('0x1d')](_0x993e('0x1f'),_0x4a4f00[_0x993e('0x5')]));var _0x4c5ee3=[];switch(_0x4a4f00[_0x993e('0x7')]){case _0x993e('0x2c'):_0x2353d4[_0x13db4e](_0x993e('0x2d'));_0x2353d4[_0x13db4e](_0x993e('0x2e'));if(queryQueues[_0x993e('0x2f')]('include')){delete queryQueues[_0x993e('0x30')];}_0x4c5ee3['push'](db[_0x993e('0x31')]['findAll'](queryQueues));_0x4c5ee3[_0x993e('0x32')](db['ChatQueue'][_0x993e('0x13')](queryQueues));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x33')][_0x993e('0x13')](queryQueues));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x34')]['findAll'](queryQueues));_0x4c5ee3[_0x993e('0x32')](db['MailQueue']['findAll'](queryQueues));_0x4c5ee3[_0x993e('0x32')](db['OpenchannelQueue'][_0x993e('0x13')](queryQueues));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x35')][_0x993e('0x13')](queryQueues));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x19')][_0x993e('0x13')](queryTelephones));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x36')][_0x993e('0x13')](queryTrunks));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x1b')][_0x993e('0x13')](queryCampaigns));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x19')]['findAll'](queryAgents));break;case _0x993e('0x37'):_0x2353d4[_0x13db4e](_0x993e('0x2d'));_0x2353d4[_0x13db4e](_0x993e('0x2e'));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources(_0x993e('0xf'),_0x4a4f00[_0x993e('0x23')],_0x993e('0x31')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources(_0x993e('0x38'),_0x4a4f00['userProfileId'],_0x993e('0x39')));_0x4c5ee3['push'](getAssociatedResources(_0x993e('0x3a'),_0x4a4f00[_0x993e('0x23')],_0x993e('0x33')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources(_0x993e('0x10'),_0x4a4f00[_0x993e('0x23')],_0x993e('0x34')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources('MailQueues',_0x4a4f00[_0x993e('0x23')],'MailQueue'));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources('OpenchannelQueues',_0x4a4f00[_0x993e('0x23')],_0x993e('0x3b')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources(_0x993e('0x3c'),_0x4a4f00[_0x993e('0x23')],_0x993e('0x35')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources(_0x993e('0x12'),_0x4a4f00['userProfileId'],_0x993e('0x19')));_0x4c5ee3['push'](getAssociatedResources('Trunks',_0x4a4f00[_0x993e('0x23')],_0x993e('0x36')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources('IvrCampaigns',_0x4a4f00[_0x993e('0x23')],_0x993e('0x1b')));_0x4c5ee3[_0x993e('0x32')](db['User']['findAll'](queryAgents));break;case'agent':_0x2353d4[_0x13db4e](_0x993e('0x2d'));_0x2353d4[_0x13db4e](_0x993e('0x2e'));_0x4c5ee3[_0x993e('0x32')](_0x4a4f00['getVoiceQueues']({'attributes':['id',_0x993e('0x5')]}));_0x4c5ee3[_0x993e('0x32')](_0x4a4f00['getChatQueues']({'attributes':['id',_0x993e('0x5')]}));_0x4c5ee3[_0x993e('0x32')](_0x4a4f00['getFaxQueues']({'attributes':['id',_0x993e('0x5')]}));_0x4c5ee3[_0x993e('0x32')](_0x4a4f00[_0x993e('0x3d')]({'attributes':['id','name']}));_0x4c5ee3['push'](_0x4a4f00['getMailQueues']({'attributes':['id',_0x993e('0x5')]}));_0x4c5ee3[_0x993e('0x32')](_0x4a4f00[_0x993e('0x3e')]({'attributes':['id',_0x993e('0x5')]}));_0x4c5ee3['push'](_0x4a4f00[_0x993e('0x3f')]({'attributes':['id',_0x993e('0x5')]}));break;}return BPromise[_0x993e('0x40')](_0x4c5ee3);}})[_0x993e('0xd')](function(_0x3f7664){if(_0x3f7664&&_0x3f7664[_0x993e('0x41')]){for(var _0x52f148=0x0;_0x52f148<_0x3f7664['length'];_0x52f148+=0x1){for(var _0x189a3b=0x0;_0x189a3b<_0x3f7664[_0x52f148][_0x993e('0x41')];_0x189a3b+=0x1){switch(_0x52f148){case 0x0:joinOrLeaveQueues(_0x2353d4,_0x13db4e,'voice',_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x1:joinOrLeaveQueues(_0x2353d4,_0x13db4e,'chat',_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x2:joinOrLeaveQueues(_0x2353d4,_0x13db4e,_0x993e('0x42'),_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x3:joinOrLeaveQueues(_0x2353d4,_0x13db4e,_0x993e('0x43'),_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x4:joinOrLeaveQueues(_0x2353d4,_0x13db4e,_0x993e('0x44'),_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x5:joinOrLeaveQueues(_0x2353d4,_0x13db4e,_0x993e('0x45'),_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x6:joinOrLeaveQueues(_0x2353d4,_0x13db4e,_0x993e('0x46'),_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x7:if(_0x1c52fd[_0x993e('0x7')]!=='agent')_0x2353d4[_0x13db4e](util[_0x993e('0x1d')]('telephone:%s',_0x3f7664[_0x52f148][_0x189a3b][_0x993e('0x5')]));break;case 0x8:if(_0x1c52fd[_0x993e('0x7')]!==_0x993e('0x8'))_0x2353d4[_0x13db4e](util[_0x993e('0x1d')](_0x993e('0x47'),_0x3f7664[_0x52f148][_0x189a3b][_0x993e('0x5')]));break;case 0x9:if(_0x1c52fd[_0x993e('0x7')]!==_0x993e('0x8'))_0x2353d4[_0x13db4e](util['format'](_0x993e('0x48'),_0x3f7664[_0x52f148][_0x189a3b][_0x993e('0x1c')],_0x3f7664[_0x52f148][_0x189a3b][_0x993e('0x5')]));break;case 0xa:_0x2353d4[_0x13db4e](util['format'](_0x993e('0x1f'),_0x3f7664[_0x52f148][_0x189a3b]['name']));break;}}}}})[_0x993e('0xd')](function(){if(_0x13db4e===_0x993e('0x49')){var _0x5cd41a=_[_0x993e('0x18')](_0x1c52fd[_0x993e('0x25')],'id');return _0x1c52fd['removeChatInteractions'](_0x5cd41a)[_0x993e('0xd')](function(){for(var _0x207e27=0x0;_0x207e27<_0x5cd41a[_0x993e('0x41')];_0x207e27+=0x1){_0xfba00f[_0x993e('0x4a')](_0x993e('0x4b'),{'ChatInteractionId':Number(_0x5cd41a[_0x207e27]),'UserId':Number(_0x1c52fd['id'])});}});}})['then'](function(){if(_0x13db4e==='leave'){var _0x5ad215=_[_0x993e('0x18')](_0x1c52fd[_0x993e('0x26')],'id');return _0x1c52fd[_0x993e('0x4c')](_0x5ad215)[_0x993e('0xd')](function(){for(var _0x1f7813=0x0;_0x1f7813<_0x5ad215[_0x993e('0x41')];_0x1f7813+=0x1){_0xfba00f['emit'](_0x993e('0x4d'),{'MailInteractionId':Number(_0x5ad215[_0x1f7813]),'UserId':Number(_0x1c52fd['id'])});}});}})[_0x993e('0xd')](function(){if(_0x13db4e===_0x993e('0x49')){var _0x5224a7=_[_0x993e('0x18')](_0x1c52fd['FaxInteractions'],'id');return _0x1c52fd['removeFaxInteractions'](_0x5224a7)[_0x993e('0xd')](function(){for(var _0x37d7b1=0x0;_0x37d7b1<_0x5224a7['length'];_0x37d7b1+=0x1){_0xfba00f[_0x993e('0x4a')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5224a7[_0x37d7b1]),'UserId':Number(_0x1c52fd['id'])});}});}})[_0x993e('0xd')](function(){if(_0x13db4e===_0x993e('0x49')){var _0x4a0dbd=_['map'](_0x1c52fd[_0x993e('0x29')],'id');return _0x1c52fd[_0x993e('0x4e')](_0x4a0dbd)[_0x993e('0xd')](function(){for(var _0x43b224=0x0;_0x43b224<_0x4a0dbd[_0x993e('0x41')];_0x43b224+=0x1){_0xfba00f[_0x993e('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x4a0dbd[_0x43b224]),'UserId':Number(_0x1c52fd['id'])});}});}})[_0x993e('0xd')](function(){if(_0x13db4e===_0x993e('0x49')){var _0x493719=_[_0x993e('0x18')](_0x1c52fd[_0x993e('0x4f')],'id');return _0x1c52fd[_0x993e('0x50')](_0x493719)['then'](function(){for(var _0x426341=0x0;_0x426341<_0x493719[_0x993e('0x41')];_0x426341+=0x1){_0xfba00f[_0x993e('0x4a')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x493719[_0x426341]),'UserId':Number(_0x1c52fd['id'])});}});}})[_0x993e('0xd')](function(){if(_0x13db4e===_0x993e('0x49')){var _0x110a04=_['map'](_0x1c52fd['WhatsappInteractions'],'id');return _0x1c52fd['removeWhatsappInteractions'](_0x110a04)[_0x993e('0xd')](function(){for(var _0x98d16c=0x0;_0x98d16c<_0x110a04[_0x993e('0x41')];_0x98d16c+=0x1){_0xfba00f[_0x993e('0x4a')](_0x993e('0x51'),{'WhatsappInteractionId':Number(_0x110a04[_0x98d16c]),'UserId':Number(_0x1c52fd['id'])});}});}})['catch'](function(_0x18367f){_0x2353d4[_0x993e('0x52')](_0x18367f);});}}function onDisconnect(_0x1344de,_0x522cb3){joinOrLeave(_0x1344de,_0x993e('0x49'),_0x522cb3);}function onConnect(_0x2ec170){joinOrLeave(_0x2ec170,_0x993e('0x53'));}exports[_0x993e('0x54')]=function(_0x5e4ab1){_0x5e4ab1['on'](_0x993e('0x55'),function(_0x3d8c0d){_0x3d8c0d['setMaxListeners'](0x0);_0x3d8c0d['address']=_0x3d8c0d[_0x993e('0x56')][_0x993e('0x55')][_0x993e('0x57')]+':'+_0x3d8c0d[_0x993e('0x56')][_0x993e('0x55')][_0x993e('0x58')];_0x3d8c0d[_0x993e('0x59')]=new Date();_0x3d8c0d[_0x993e('0x52')]=function(_0x380751){console[_0x993e('0x52')](_0x993e('0x5a')+_0x3d8c0d[_0x993e('0x5b')][_0x993e('0x5')]+'['+_0x3d8c0d[_0x993e('0x5c')]+']',_0x380751);};_0x3d8c0d['on'](_0x993e('0x5d'),function(){onDisconnect(_0x3d8c0d,_0x5e4ab1);_0x3d8c0d[_0x993e('0x52')]('DISCONNECTED');});onConnect(_0x3d8c0d);_0x3d8c0d[_0x993e('0x52')](_0x993e('0x5e'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 28a02da..658b9b0 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 _0x9e82=['hasOwnProperty','model','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','Chat','ChatInteraction','afterUpdate','ChatMessage','newmessage','afterCreate','SmsInteraction','newinteraction','Sms','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','EventManager','error','code','Trigger,\x20%s','catch','get','channel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','format','SIP/%s','agent','incomingmessage','outgoingmessage','motionChannel','offlineMessage','opened','interface','AfterCreate','changed','closed','substatus','name','AfterUpdate','User','find','fullname','email','internal','length'];(function(_0x1ab313,_0x12bccc){var _0x2d73f4=function(_0x225f28){while(--_0x225f28){_0x1ab313['push'](_0x1ab313['shift']());}};_0x2d73f4(++_0x12bccc);}(_0x9e82,0x1c6));var _0x29e8=function(_0x505ae7,_0x19a6b6){_0x505ae7=_0x505ae7-0x0;var _0x3d403c=_0x9e82[_0x505ae7];return _0x3d403c;};'use strict';var util=require(_0x29e8('0x0'));var db=require(_0x29e8('0x1'))['db'];var jayson=require(_0x29e8('0x2'));var logger=require(_0x29e8('0x3'))(_0x29e8('0x4'));var client=jayson['client']['http']({'port':0x232a});var triggers=[{'channel':_0x29e8('0x5'),'model':_0x29e8('0x6'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0x29e8('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x29e8('0x5'),'model':_0x29e8('0x8'),'event':'afterCreate','condition':_0x29e8('0x9'),'callback':afterCreateMessage},{'channel':'Chat','model':'ChatOfflineMessage','event':_0x29e8('0xa'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x29e8('0xb'),'event':_0x29e8('0xa'),'condition':_0x29e8('0xc'),'callback':afterCreate},{'channel':_0x29e8('0xd'),'model':'SmsInteraction','event':'afterUpdate','condition':_0x29e8('0xe'),'callback':afterUpdate},{'channel':_0x29e8('0xd'),'model':_0x29e8('0xf'),'event':_0x29e8('0xa'),'condition':_0x29e8('0x9'),'callback':afterCreateMessage},{'channel':_0x29e8('0x10'),'model':_0x29e8('0x11'),'event':_0x29e8('0xa'),'condition':_0x29e8('0xc'),'callback':afterCreate},{'channel':_0x29e8('0x10'),'model':_0x29e8('0x11'),'event':_0x29e8('0x7'),'condition':_0x29e8('0xe'),'callback':afterUpdate},{'channel':_0x29e8('0x10'),'model':_0x29e8('0x12'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x29e8('0x13'),'model':_0x29e8('0x14'),'event':_0x29e8('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x29e8('0x13'),'model':_0x29e8('0x14'),'event':_0x29e8('0x7'),'condition':_0x29e8('0xe'),'callback':afterUpdate},{'channel':_0x29e8('0x13'),'model':_0x29e8('0x15'),'event':_0x29e8('0xa'),'condition':_0x29e8('0x9'),'callback':afterCreateMessage},{'channel':_0x29e8('0x16'),'model':_0x29e8('0x17'),'event':'afterCreate','condition':_0x29e8('0xc'),'callback':afterCreate},{'channel':_0x29e8('0x16'),'model':'MailInteraction','event':_0x29e8('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x29e8('0x16'),'model':'MailMessage','event':'afterCreate','condition':_0x29e8('0x9'),'callback':afterCreateMessage},{'channel':_0x29e8('0x18'),'model':_0x29e8('0x19'),'event':_0x29e8('0xa'),'condition':_0x29e8('0xc'),'callback':afterCreate},{'channel':_0x29e8('0x18'),'model':_0x29e8('0x19'),'event':_0x29e8('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x29e8('0x18'),'model':_0x29e8('0x1a'),'event':'afterCreate','condition':_0x29e8('0x9'),'callback':afterCreateMessage}];function request(_0x29c116){return client[_0x29e8('0x1b')]('EventManager',_0x29c116)[_0x29e8('0x1c')](function(_0x4c4496){logger[_0x29e8('0x1d')]('Trigger,\x20%s',_0x29e8('0x1e'),_0x4c4496);if(_0x4c4496[_0x29e8('0x1f')]){if(_0x4c4496[_0x29e8('0x1f')][_0x29e8('0x20')]===0x1f4){logger[_0x29e8('0x1f')](_0x29e8('0x21'),_0x29e8('0x1e'),_0x4c4496['error']);}}})[_0x29e8('0x22')](function(_0x480cf4){logger['error'](_0x29e8('0x21'),'EventManager',_0x480cf4);});}function afterCreateMessage(_0x1069bb){return function(_0x311d19){_0x311d19=_0x311d19[_0x29e8('0x23')]({'plain':!![]});_0x311d19[_0x29e8('0x24')]=_0x1069bb;_0x311d19['motionChannel']=_0x1069bb;_0x311d19[_0x29e8('0x25')]=_0x311d19[_0x29e8('0x26')];Promise[_0x29e8('0x27')]()[_0x29e8('0x1c')](function(){if(typeof _0x311d19[_0x29e8('0x28')]===_0x29e8('0x29'))return null;var _0xe3e982=_0x29e8('0x2a')+_0x311d19[_0x29e8('0x28')];return db[_0x29e8('0x2b')][_0x29e8('0x2c')](_0xe3e982,{'type':db[_0x29e8('0x2d')][_0x29e8('0x2e')][_0x29e8('0x2f')],'raw':!![]});})[_0x29e8('0x1c')](function(_0x4f9d8d){if(_0x4f9d8d){_0x311d19[_0x29e8('0x30')]=_0x4f9d8d[0x0];}if(typeof _0x311d19[_0x29e8('0x31')]===_0x29e8('0x29'))return;return getAgent(_0x311d19[_0x29e8('0x31')]);})[_0x29e8('0x1c')](function(_0xcb7511){if(_0xcb7511){_0x311d19['interface']=util[_0x29e8('0x32')](_0x29e8('0x33'),_0xcb7511['name']);_0x311d19[_0x29e8('0x34')]=_0xcb7511;_0x311d19[_0x29e8('0x24')]=_0x1069bb;return request({'event':_0x29e8('0x35'),'message':_0x311d19});}else{return request({'event':_0x29e8('0x36'),'message':_0x311d19});}})[_0x29e8('0x22')](function(_0x17c9c1){logger[_0x29e8('0x1f')](_0x29e8('0x21'),'AfterCreateMessage',_0x17c9c1);});};}function afterCreateOfflineMessage(_0x12596b){return function(_0x2457ab){_0x2457ab=_0x2457ab[_0x29e8('0x23')]({'plain':!![]});_0x2457ab[_0x29e8('0x24')]=_0x12596b;_0x2457ab[_0x29e8('0x37')]=_0x12596b;_0x2457ab[_0x29e8('0x25')]=_0x29e8('0x38');return request({'event':_0x2457ab[_0x29e8('0x25')],'message':_0x2457ab});};}function afterCreate(_0x569037,_0x4005ab){return function(_0x4eb295){var _0x373570=_0x4eb295[_0x29e8('0x23')]({'plain':!![]});_0x373570[_0x29e8('0x24')]=_0x569037;_0x373570[_0x29e8('0x37')]=_0x569037;_0x373570[_0x29e8('0x25')]=_0x29e8('0x39');Promise[_0x29e8('0x27')]()[_0x29e8('0x1c')](function(){var _0x508569=_0x29e8('0x2a')+_0x373570[_0x29e8('0x28')];return db[_0x29e8('0x2b')]['query'](_0x508569,{'type':db[_0x29e8('0x2d')][_0x29e8('0x2e')]['SELECT'],'raw':!![]});})[_0x29e8('0x1c')](function(_0x156f8f){if(_0x156f8f){_0x373570[_0x29e8('0x30')]=_0x156f8f[0x0];}if(_0x373570[_0x29e8('0x31')]){return getAgent(_0x373570[_0x29e8('0x31')]);}return;})[_0x29e8('0x1c')](function(_0xada0fa){if(_0xada0fa){_0x373570[_0x29e8('0x3a')]=util['format'](_0x29e8('0x33'),_0xada0fa['name']);_0x373570[_0x29e8('0x34')]=_0xada0fa;}return request({'event':_0x4005ab,'message':_0x373570});})[_0x29e8('0x22')](function(_0x55d13d){logger[_0x29e8('0x1f')]('Trigger,\x20%s',_0x29e8('0x3b'),_0x55d13d);});};}function afterUpdate(_0x2fe52f){return function(_0x14fa0b){var _0x59ba95=_0x14fa0b[_0x29e8('0x3c')](_0x29e8('0x3d'))&&_0x14fa0b[_0x29e8('0x3d')];var _0x15329d=_0x14fa0b[_0x29e8('0x3c')](_0x29e8('0x3e'));if(_0x59ba95||_0x15329d){var _0x4193f5=_0x59ba95?_0x29e8('0xe'):'substatus';var _0x2055f8=_0x14fa0b['get']({'plain':!![]});_0x2055f8[_0x29e8('0x24')]=_0x2fe52f;_0x2055f8[_0x29e8('0x37')]=_0x2fe52f;_0x2055f8[_0x29e8('0x25')]=_0x59ba95?_0x29e8('0x3d'):'substatus';var _0x1697c4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2055f8[_0x29e8('0x28')];return db[_0x29e8('0x2b')]['query'](_0x1697c4,{'type':db['Sequelize']['QueryTypes'][_0x29e8('0x2f')],'raw':!![]})[_0x29e8('0x1c')](function(_0x315a79){if(_0x315a79){_0x2055f8['contact']=_0x315a79[0x0];}if(typeof _0x2055f8[_0x29e8('0x31')]===_0x29e8('0x29'))return;return getAgent(_0x2055f8['UserId']);})[_0x29e8('0x1c')](function(_0x50cf12){if(_0x50cf12){_0x2055f8[_0x29e8('0x3a')]=util[_0x29e8('0x32')](_0x29e8('0x33'),_0x50cf12[_0x29e8('0x3f')]);_0x2055f8[_0x29e8('0x34')]=_0x50cf12;}return request({'event':_0x4193f5,'message':_0x2055f8});})[_0x29e8('0x22')](function(_0x29c874){logger[_0x29e8('0x1f')](_0x29e8('0x21'),_0x29e8('0x40'),_0x29c874);});}};}function getAgent(_0x7efe7a){return db[_0x29e8('0x41')][_0x29e8('0x42')]({'where':{'id':_0x7efe7a},'attributes':['id','name',_0x29e8('0x43'),_0x29e8('0x44'),_0x29e8('0x45')],'raw':!![]})[_0x29e8('0x1c')](function(_0x2565d0){return _0x2565d0;});}exports['default']=function(){for(var _0x5a9f8b=0x0;_0x5a9f8b=_0x264ea9[_0xeff1('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x13b7d9(_0x515ee2);})[_0xeff1('0x15')](function(_0x191e0d){_0x1bd9df(_0x191e0d);});});}; \ No newline at end of file +var _0xef53=['agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','toLowerCase','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent','count','then'];(function(_0x527a18,_0xba4171){var _0x430d04=function(_0x423d9f){while(--_0x423d9f){_0x527a18['push'](_0x527a18['shift']());}};_0x430d04(++_0xba4171);}(_0xef53,0xd5));var _0x3ef5=function(_0x582d5a,_0x3b57c0){_0x582d5a=_0x582d5a-0x0;var _0x5625ef=_0xef53[_0x582d5a];return _0x5625ef;};'use strict';var _=require('lodash');var BPromise=require(_0x3ef5('0x0'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=[_0x3ef5('0x1'),_0x3ef5('0x2'),_0x3ef5('0x3'),_0x3ef5('0x4'),_0x3ef5('0x5'),_0x3ef5('0x6'),_0x3ef5('0x7')];exports[_0x3ef5('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x3a1c8d){_0x3a1c8d=_0x3a1c8d[_0x3ef5('0x9')]();return _['includes'](channels,_0x3a1c8d);};exports[_0x3ef5('0xa')]=function(_0x4b7cce,_0x203db0,_0x22056c,_0x310f90){var _0x1b1cec={'loginAttempts':_0x203db0,'blocked':_0x22056c};if(!_[_0x3ef5('0xb')](_0x310f90)){_0x1b1cec['blockedAt']=_0x310f90;}return _0x4b7cce[_0x3ef5('0xc')](_0x1b1cec);};exports[_0x3ef5('0xd')]=function(_0x438e8d){return new BPromise(function(_0x47e128,_0x45c560){var _0x2524a7=0x0;if(_0x438e8d[_0x3ef5('0xe')]!==_0x3ef5('0xf')){_0x47e128(_0x438e8d);}db['User'][_0x3ef5('0x10')]({'where':{'role':_0x3ef5('0xf'),'online':!![],'id':{'$ne':_0x438e8d['id']}}})[_0x3ef5('0x11')](function(_0x4ce0b7){_0x2524a7=_0x4ce0b7;return util[_0x3ef5('0xd')]();})[_0x3ef5('0x11')](function(_0x2f6b37){if(_0x2f6b37&&_0x2f6b37[_0x3ef5('0x12')]&&_0x2524a7>=_0x2f6b37[_0x3ef5('0x12')]){throw Error(_0x3ef5('0x13'));}_0x47e128(_0x438e8d);})[_0x3ef5('0x14')](function(_0x3b9c09){_0x45c560(_0x3b9c09);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 396768c..facc179 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf36e=['Message\x20sent\x20outside\x20a\x20valid\x20interval','details','OutOfInterval','Resource\x20Conflict','Conflict','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found'];(function(_0x5c3f56,_0x22971d){var _0x2d3405=function(_0x24ebad){while(--_0x24ebad){_0x5c3f56['push'](_0x5c3f56['shift']());}};_0x2d3405(++_0x22971d);}(_0xf36e,0xfd));var _0xef36=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf36e[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xef36('0x0'));var logger=require(_0xef36('0x1'))(_0xef36('0x2'));var APIError=function(_0x4ada6a,_0x18e7a8){this[_0xef36('0x3')]=_0x4ada6a||_0xef36('0x4');this[_0xef36('0x5')]=_0x18e7a8||'Error';util[_0xef36('0x6')](APIError,Error);};var APIBadRequestError=function(_0x1d200a){this[_0xef36('0x3')]=_0x1d200a||_0xef36('0x7');this[_0xef36('0x5')]=_0xef36('0x7');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3b1556){this[_0xef36('0x3')]=_0x3b1556||_0xef36('0x8');this[_0xef36('0x5')]=_0xef36('0x8');util[_0xef36('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x335d3d){this[_0xef36('0x3')]=_0x335d3d||_0xef36('0x9');this[_0xef36('0x5')]=_0xef36('0xa');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x1d1dc1){this[_0xef36('0x3')]=_0x1d1dc1||_0xef36('0xb');this[_0xef36('0x5')]='Out\x20Of\x20Interval';this['code']=0x193;this[_0xef36('0xc')]={'type':_0xef36('0xd')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0xde56fb){this[_0xef36('0x3')]=_0xde56fb||_0xef36('0xe');this['name']=_0xef36('0xf');util[_0xef36('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x3cd83e){switch(_0x3cd83e){case _0xef36('0x7'):return 0x190;case _0xef36('0x8'),'Out\x20Of\x20Interval':return 0x193;case _0xef36('0xa'):return 0x194;case _0xef36('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x104f73){if(_0x104f73==='Out\x20Of\x20Interval')return _0x104f73;return null;}function handleError(_0x12201a){return function(_0x408c4f){logger[_0xef36('0x10')](_0x408c4f[_0xef36('0x11')]);var _0x1be44d=getStatusCode(_0x408c4f[_0xef36('0x5')]);var _0x22755b=getCustomStatusMessage(_0x408c4f[_0xef36('0x5')]);if(_0x408c4f[_0xef36('0x5')]){delete _0x408c4f[_0xef36('0x5')];}if(_0x22755b){_0x12201a[_0xef36('0x12')]=_0x22755b;}return _0x12201a[_0xef36('0x13')](_0x1be44d)[_0xef36('0x14')](_0x408c4f);};}module[_0xef36('0x15')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x01f1=['Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','Conflict','Not\x20Found','error','status','send','exports','util','api','name','Error','Bad\x20Request','inherits','Forbidden','message'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x01f1,0x76));var _0x101f=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0x01f1[_0x525b28];return _0x180178;};'use strict';var util=require(_0x101f('0x0'));var logger=require('../config/logger')(_0x101f('0x1'));var APIError=function(_0x1e97b4,_0x58b137){this['message']=_0x1e97b4||'Internal\x20Server\x20Error';this[_0x101f('0x2')]=_0x58b137||_0x101f('0x3');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x20256d){this['message']=_0x20256d||_0x101f('0x4');this[_0x101f('0x2')]='Bad\x20Request';util[_0x101f('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x39a702){this['message']=_0x39a702||_0x101f('0x6');this['name']=_0x101f('0x6');util[_0x101f('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x30514d){this[_0x101f('0x7')]=_0x30514d||'Entity\x20not\x20found';this[_0x101f('0x2')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x3aa9ab){this[_0x101f('0x7')]=_0x3aa9ab||_0x101f('0x8');this[_0x101f('0x2')]=_0x101f('0x9');this[_0x101f('0xa')]=0x193;this[_0x101f('0xb')]={'type':'OutOfInterval'};util[_0x101f('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x761233){this['message']=_0x761233||'Resource\x20Conflict';this[_0x101f('0x2')]=_0x101f('0xc');util[_0x101f('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x110daa){switch(_0x110daa){case _0x101f('0x4'):return 0x190;case _0x101f('0x6'),'Out\x20Of\x20Interval':return 0x193;case _0x101f('0xd'):return 0x194;case _0x101f('0xc'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x3fd24b){if(_0x3fd24b===_0x101f('0x9'))return _0x3fd24b;return null;}function handleError(_0x2f8079){return function(_0x2add05){logger[_0x101f('0xe')](_0x2add05['stack']);var _0xc33174=getStatusCode(_0x2add05[_0x101f('0x2')]);var _0x3a822d=getCustomStatusMessage(_0x2add05[_0x101f('0x2')]);if(_0x2add05[_0x101f('0x2')]){delete _0x2add05[_0x101f('0x2')];}if(_0x3a822d){_0x2f8079['statusMessage']=_0x3a822d;}return _0x2f8079[_0x101f('0xf')](_0xc33174)[_0x101f('0x10')](_0x2add05);};}module[_0x101f('0x11')]={'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 f6534d4..b8f3c75 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc715=['send','exports','status','json'];(function(_0x2b459a,_0x85add){var _0x2676d2=function(_0x3f4e75){while(--_0x3f4e75){_0x2b459a['push'](_0x2b459a['shift']());}};_0x2676d2(++_0x85add);}(_0xc715,0x1a5));var _0x5c71=function(_0x42f2f9,_0x5d1cfb){_0x42f2f9=_0x42f2f9-0x0;var _0x306b0a=_0xc715[_0x42f2f9];return _0x306b0a;};'use strict';module[_0x5c71('0x0')][0x194]=function pageNotFound(_0x3c88b4,_0x5f4251){var _0x3ae5c2='404';var _0x225019=0x194;var _0xc4d6d={'status':_0x225019};_0x5f4251[_0x5c71('0x1')](_0xc4d6d[_0x5c71('0x1')]);_0x5f4251['render'](_0x3ae5c2,{},function(_0x35f16a,_0x455001){if(_0x35f16a){return _0x5f4251[_0x5c71('0x1')](_0xc4d6d[_0x5c71('0x1')])[_0x5c71('0x2')](_0xc4d6d);}_0x5f4251[_0x5c71('0x3')](_0x455001);});}; \ No newline at end of file +var _0xa8b1=['json','exports','404','render','status'];(function(_0x296c14,_0x232f57){var _0x5454bc=function(_0x434973){while(--_0x434973){_0x296c14['push'](_0x296c14['shift']());}};_0x5454bc(++_0x232f57);}(_0xa8b1,0x182));var _0x1a8b=function(_0xffde61,_0x559c33){_0xffde61=_0xffde61-0x0;var _0x22cc1d=_0xa8b1[_0xffde61];return _0x22cc1d;};'use strict';module[_0x1a8b('0x0')][0x194]=function pageNotFound(_0x30c0aa,_0x1a339f){var _0x3003e6=_0x1a8b('0x1');var _0x2bf605=0x194;var _0xd654e6={'status':_0x2bf605};_0x1a339f['status'](_0xd654e6['status']);_0x1a339f[_0x1a8b('0x2')](_0x3003e6,{},function(_0xd117a2,_0x57eaa3){if(_0xd117a2){return _0x1a339f[_0x1a8b('0x3')](_0xd654e6[_0x1a8b('0x3')])[_0x1a8b('0x4')](_0xd654e6);}_0x1a339f['send'](_0x57eaa3);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 3d39204..7ed14e7 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a95=['ChatOfflineMessageId','TagId','ListId','Items','Dispositions','FaxAccountId','Interactions','FaxApplication','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Users','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','user_has_sms_accounts','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatWebsiteId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','ChatProactiveAction','CompanyId','Phones','CmContactId','CmHopperHistory','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','OwnerId','Automation','All','OneAny','Actions','AutomationId','Intervals','Extensions','DefaultReportId','CustomReportId','ContactItemType','ItemType','ItemTypeId','Hopper','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','SalesforceField','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','SugarcrmField','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerAccount','ServicenowAccount','ServicenowField','Dynamics365Account','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','VoiceQueues','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','CampaignId','SquareProject','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','CustomFields','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','sequelize','lodash','jstz','determine','defaultsDeep','motion2','mysql','utf8mb4','name','utf8','sequelizeHistory','127.0.0.1','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','MailServerOut','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','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','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','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','userSetting','cascade','UserId','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','UserWhatsappQueue','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','VoiceCallReport','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','List','TemplateId','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','Tags','user_has_mail_interactions','Attachments','Interaction','MailInteractionId'];(function(_0x5486e7,_0x580d02){var _0xa9ec8f=function(_0x46852c){while(--_0x46852c){_0x5486e7['push'](_0x5486e7['shift']());}};_0xa9ec8f(++_0x580d02);}(_0x4a95,0x91));var _0x54a9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4a95[_0x3947c9];return _0x2e7871;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x54a9('0x0'));var _=require(_0x54a9('0x1'));var jstz=require(_0x54a9('0x2'));var timezone=jstz[_0x54a9('0x3')]();config['sequelize']=_[_0x54a9('0x4')](config[_0x54a9('0x0')],{'database':_0x54a9('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x54a9('0x6'),'dialectOptions':{'charset':_0x54a9('0x7')},'logging':![],'timezone':timezone[_0x54a9('0x8')](),'define':{'charset':_0x54a9('0x9'),'collate':'utf8_general_ci'}}});config[_0x54a9('0xa')]=_[_0x54a9('0x4')](config[_0x54a9('0xa')],{'database':_0x54a9('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x54a9('0xb'),'port':0xcea,'dialect':_0x54a9('0x6'),'dialectOptions':{'charset':_0x54a9('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x54a9('0x9'),'collate':_0x54a9('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x54a9('0x0')][_0x54a9('0xd')],config['sequelize'][_0x54a9('0xe')],config[_0x54a9('0x0')][_0x54a9('0xf')],config[_0x54a9('0x0')][_0x54a9('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x54a9('0xd')],config[_0x54a9('0xa')]['username'],config[_0x54a9('0xa')][_0x54a9('0xf')],config['sequelizeHistory'][_0x54a9('0x10')])};db[_0x54a9('0x11')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x13'));db['VoiceChanSpy']=db[_0x54a9('0x0')]['import'](_0x54a9('0x14'));db['VoiceContext']=db[_0x54a9('0x0')]['import']('../api/voiceContext/voiceContext.model');db[_0x54a9('0x15')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x16'));db[_0x54a9('0x17')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x18'));db[_0x54a9('0x19')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x1a'));db[_0x54a9('0x1b')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x1c'));db[_0x54a9('0x1d')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x1e'));db[_0x54a9('0x1f')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x20'));db['VoiceDialReport']=db[_0x54a9('0x0')]['import'](_0x54a9('0x21'));db[_0x54a9('0x22')]=db[_0x54a9('0x0')]['import'](_0x54a9('0x23'));db[_0x54a9('0x24')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x25'));db[_0x54a9('0x26')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/memberReport/memberReport.model');db[_0x54a9('0x27')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x28'));db['VoiceTransferReport']=db['sequelize']['import'](_0x54a9('0x29'));db[_0x54a9('0x2a')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x2b'));db[_0x54a9('0x2c')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x54a9('0x2d')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x2e'));db['UserMailQueue']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x2f'));db[_0x54a9('0x30')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0x54a9('0x31')]=db[_0x54a9('0x0')]['import']('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x32'));db['UserWhatsappQueue']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x54a9('0x33')]=db['sequelize']['import']('../api/mailServerIn/mailServerIn.model');db[_0x54a9('0x34')]=db[_0x54a9('0x0')]['import']('../api/mailServerOut/mailServerOut.model');db[_0x54a9('0x35')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x36'));db[_0x54a9('0x37')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x38'));db[_0x54a9('0x39')]=db[_0x54a9('0x0')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x54a9('0x3a')]=db[_0x54a9('0x0')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x54a9('0x3b')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x3c'));db[_0x54a9('0x3d')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x3e'));db[_0x54a9('0x3f')]=db['sequelize']['import'](_0x54a9('0x40'));db[_0x54a9('0x41')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x42'));db['DashboardItem']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/dashboardItem/dashboardItem.model');db[_0x54a9('0x43')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x44'));db['FaxApplication']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x45'));db[_0x54a9('0x46')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x47'));db[_0x54a9('0x48')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/faxMessage/faxMessage.model');db[_0x54a9('0x49')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x4a'));db[_0x54a9('0x4b')]=db[_0x54a9('0x0')]['import'](_0x54a9('0x4c'));db[_0x54a9('0x4d')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x4e'));db['SmsApplication']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/smsApplication/smsApplication.model');db[_0x54a9('0x4f')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x50'));db['SmsMessage']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/smsMessage/smsMessage.model');db[_0x54a9('0x51')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/smsQueue/smsQueue.model');db[_0x54a9('0x52')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x53'));db[_0x54a9('0x54')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0x54a9('0x55')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x56'));db[_0x54a9('0x57')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/openchannelMessage/openchannelMessage.model');db[_0x54a9('0x58')]=db['sequelize'][_0x54a9('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x54a9('0x59')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x5a'));db[_0x54a9('0x5b')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x5c'));db['ChatApplication']=db[_0x54a9('0x0')]['import'](_0x54a9('0x5d'));db[_0x54a9('0x5e')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/chatInteraction/chatInteraction.model');db[_0x54a9('0x5f')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/chatMessage/chatMessage.model');db[_0x54a9('0x60')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x61'));db[_0x54a9('0x62')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x63'));db[_0x54a9('0x64')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x65'));db['ChatProactiveAction']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x66'));db[_0x54a9('0x67')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x68'));db['CmContact']=db[_0x54a9('0x0')]['import'](_0x54a9('0x69'));db[_0x54a9('0x6a')]=db[_0x54a9('0x0')]['import']('../api/cmHopper/cmHopper.model');db[_0x54a9('0x6b')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x6c'));db[_0x54a9('0x6d')]=db[_0x54a9('0x0')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x6e'));db[_0x54a9('0x6f')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x70'));db[_0x54a9('0x71')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x72'));db[_0x54a9('0x73')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x74'));db['Automation']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x75'));db[_0x54a9('0x76')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x77'));db[_0x54a9('0x78')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x79'));db[_0x54a9('0x7a')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x7b'));db[_0x54a9('0x7c')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x7d'));db['Pause']=db[_0x54a9('0x0')]['import'](_0x54a9('0x7e'));db[_0x54a9('0x7f')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x80'));db['VoiceQueuesLog']=db[_0x54a9('0x0')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x54a9('0x81')]=db[_0x54a9('0x0')]['import'](_0x54a9('0x82'));db[_0x54a9('0x83')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x84'));db[_0x54a9('0x85')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x86'));db['ContactItemType']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/contactItemType/contactItemType.model');db[_0x54a9('0x87')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x88'));db[_0x54a9('0x89')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x54a9('0x8a')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/template/template.model');db[_0x54a9('0x8b')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/trigger/trigger.model');db[_0x54a9('0x8c')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x8d'));db[_0x54a9('0x8e')]=db[_0x54a9('0x0')]['import'](_0x54a9('0x8f'));db['IntegrationReport']=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x90'));db[_0x54a9('0x91')]=db[_0x54a9('0x0')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x54a9('0x92')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x54a9('0x93')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x94'));db[_0x54a9('0x95')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x96'));db[_0x54a9('0x97')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x98'));db[_0x54a9('0x99')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x9a'));db['SalesforceAccount']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x9b'));db[_0x54a9('0x9c')]=db[_0x54a9('0x0')]['import'](_0x54a9('0x9d'));db['SalesforceField']=db['sequelize']['import']('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x54a9('0x0')]['import'](_0x54a9('0x9e'));db[_0x54a9('0x9f')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xa0'));db['SugarcrmField']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xa1'));db[_0x54a9('0xa2')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xa3'));db['DeskConfiguration']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x54a9('0xa4')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xa5'));db['ZohoAccount']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xa6'));db['ZohoConfiguration']=db[_0x54a9('0x0')]['import'](_0x54a9('0xa7'));db[_0x54a9('0xa8')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xa9'));db[_0x54a9('0xaa')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xab'));db[_0x54a9('0xac')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize']['import'](_0x54a9('0xad'));db[_0x54a9('0xae')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xaf'));db[_0x54a9('0xb0')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xb1'));db[_0x54a9('0xb2')]=db['sequelize'][_0x54a9('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xb3'));db['VtigerConfiguration']=db[_0x54a9('0x0')]['import'](_0x54a9('0xb4'));db[_0x54a9('0xb5')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xb6'));db['ServicenowAccount']=db['sequelize'][_0x54a9('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x54a9('0xb7')]=db['sequelize']['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db['sequelize'][_0x54a9('0x12')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xb8'));db[_0x54a9('0xb9')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xba'));db[_0x54a9('0xbb')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xbc'));db[_0x54a9('0xbd')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xbe'));db[_0x54a9('0xbf')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xc0'));db['FreshsalesField']=db['sequelize']['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0x54a9('0x8e')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x8f'));db[_0x54a9('0xc1')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xc2'));db[_0x54a9('0xc3')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xc4'));db['ChatInternalMessage']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xc5'));db[_0x54a9('0xc6')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xc7'));db['JscriptyQuestionReport']=db[_0x54a9('0x0')]['import'](_0x54a9('0xc8'));db[_0x54a9('0xc9')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xca'));db[_0x54a9('0xcb')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0xcc'));db[_0x54a9('0xcd')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xce'));db[_0x54a9('0xcf')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xd0'));db[_0x54a9('0xd1')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xd2'));db[_0x54a9('0xd3')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xd4'));db['SquareOdbc']=db['sequelize'][_0x54a9('0x12')](_0x54a9('0xd5'));db['SquareProject']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x54a9('0x0')]['import']('../api/squareRecording/squareRecording.model');db[_0x54a9('0xd6')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xd7'));db[_0x54a9('0xd8')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xd9'));db[_0x54a9('0xda')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xdb'));db[_0x54a9('0xdc')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xdd'));db['Migration']=db[_0x54a9('0x0')]['import']('../api/migration/migration.model');db[_0x54a9('0xde')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xdf'));db['Plugin']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/plugin/plugin.model');db[_0x54a9('0xe0')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0xe1'));db[_0x54a9('0xe2')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xe3'));db[_0x54a9('0xe4')]=db['sequelize']['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x54a9('0xe5')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0xe6'));db['SmsTransferReport']=db['sequelize'][_0x54a9('0x12')](_0x54a9('0xe7'));db[_0x54a9('0xe8')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xe9'));db[_0x54a9('0xea')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x54a9('0xeb')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xec'));db['UserProfileSection']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x54a9('0xed')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xee'));db[_0x54a9('0xef')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xf0'));db[_0x54a9('0xf1')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xf2'));db[_0x54a9('0xf3')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xf4'));db['WhatsappInteraction']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x54a9('0xf5')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xf6'));db[_0x54a9('0xf7')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0x54a9('0x0')]['import'](_0x54a9('0xf8'));db[_0x54a9('0xf9')]=db['sequelize'][_0x54a9('0x12')]('../api/whatsappQueue/whatsappQueue.model');db[_0x54a9('0xfa')]=db['sequelize']['import'](_0x54a9('0xfb'));db['TeamVoiceQueue']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xfc'));db[_0x54a9('0xfd')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xfe'));db[_0x54a9('0xff')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x54a9('0x100')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x101'));db[_0x54a9('0x102')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x103'));db[_0x54a9('0x11')]['hasOne'](db[_0x54a9('0x1d')],{'as':_0x54a9('0x1d'),'onDelete':'cascade','foreignKey':'UserId'});db['User'][_0x54a9('0x104')](db['UserSetting'],{'as':_0x54a9('0x105'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x1b')],{'as':'Recordings','foreignKey':_0x54a9('0x107')});db['User'][_0x54a9('0x108')](db[_0x54a9('0x2a')],{'as':_0x54a9('0x109'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x15')],{'as':'Extensions','onDelete':_0x54a9('0x106'),'hooks':!![]});db['User'][_0x54a9('0x108')](db[_0x54a9('0x6d')],{'as':_0x54a9('0x10a'),'foreignKey':'UserId'});db['User'][_0x54a9('0x108')](db['CmHopperHistory'],{'as':_0x54a9('0x10b'),'foreignKey':_0x54a9('0x107')});db['User'][_0x54a9('0x108')](db[_0x54a9('0x6f')],{'as':_0x54a9('0x6f'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x55')],{'as':_0x54a9('0x10c'),'foreignKey':'UserId'});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x5e')],{'as':_0x54a9('0x10d'),'foreignKey':_0x54a9('0x107')});db['User'][_0x54a9('0x108')](db[_0x54a9('0x4f')],{'as':_0x54a9('0x10e'),'foreignKey':_0x54a9('0x107')});db['User'][_0x54a9('0x108')](db[_0x54a9('0x46')],{'as':_0x54a9('0x10f'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x11')]['hasMany'](db[_0x54a9('0x3a')],{'as':_0x54a9('0x110'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x111')],{'as':_0x54a9('0x112'),'foreignKey':_0x54a9('0x107')});db['User'][_0x54a9('0x108')](db[_0x54a9('0xef')],{'as':_0x54a9('0x113'),'foreignKey':'SenderId'});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x6a')],{'as':_0x54a9('0x114'),'foreignKey':_0x54a9('0x107'),'onDelete':_0x54a9('0x115')});db['User'][_0x54a9('0x116')](db['UserProfile'],{'as':_0x54a9('0xeb'),'foreignKey':_0x54a9('0x117')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x64')],{'as':_0x54a9('0x119'),'through':_0x54a9('0x11a')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x11b')],{'as':_0x54a9('0x11c'),'through':_0x54a9('0x11d')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0xe8')],{'as':'Lists','through':_0x54a9('0x11e')});db['User']['belongsToMany'](db['Team'],{'through':_0x54a9('0x11f')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x3a')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x5e')],{'as':'ChatInteractions','through':_0x54a9('0x120')});db[_0x54a9('0x11')]['belongsToMany'](db[_0x54a9('0x46')],{'as':_0x54a9('0x10f'),'through':'user_has_fax_interactions'});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x4f')],{'as':_0x54a9('0x10e'),'through':_0x54a9('0x121')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x55')],{'as':'OpenchannelInteractions','through':_0x54a9('0x122')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x111')],{'as':_0x54a9('0x112'),'through':_0x54a9('0x123')});db[_0x54a9('0x11')]['belongsToMany'](db[_0x54a9('0x19')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0xea')],{'as':_0x54a9('0x124'),'through':'UserVoicePrefix','required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x37')],{'as':_0x54a9('0x125'),'through':_0x54a9('0x126'),'required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x62')],{'as':_0x54a9('0x127'),'through':_0x54a9('0x2d'),'required':![],'hooks':!![]});db[_0x54a9('0x11')]['belongsToMany'](db[_0x54a9('0x49')],{'as':'FaxQueues','through':_0x54a9('0x30'),'required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x51')],{'as':_0x54a9('0x128'),'through':_0x54a9('0x31'),'required':![]});db[_0x54a9('0x11')]['belongsToMany'](db[_0x54a9('0x58')],{'as':_0x54a9('0x129'),'through':_0x54a9('0x12a'),'required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0xf9')],{'as':_0x54a9('0x12b'),'through':_0x54a9('0x12c'),'required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db['CmList'],{'through':'cm_user_has_lists'});db['User'][_0x54a9('0x118')](db[_0x54a9('0x59')],{'as':_0x54a9('0x12d'),'through':_0x54a9('0x12e')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x43')],{'as':_0x54a9('0x12f'),'through':'user_has_fax_accounts'});db['User'][_0x54a9('0x118')](db[_0x54a9('0x35')],{'as':_0x54a9('0x130'),'through':'user_has_mail_accounts'});db[_0x54a9('0x11')][_0x54a9('0x118')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x54a9('0x131')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x4d')],{'as':_0x54a9('0x132'),'through':'user_has_sms_accounts'});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0xf1')],{'as':_0x54a9('0x133'),'through':'user_has_whatsapp_accounts'});db['VoiceChanSpy'][_0x54a9('0x108')](db[_0x54a9('0x15')],{'as':_0x54a9('0x134'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x135')});db['VoiceContext'][_0x54a9('0x108')](db[_0x54a9('0x15')],{'onDelete':'cascade'});db[_0x54a9('0x15')][_0x54a9('0x108')](db['VoiceExtension'],{'as':_0x54a9('0x136'),'onDelete':_0x54a9('0x106')});db['VoiceMusicOnHold'][_0x54a9('0x118')](db[_0x54a9('0x83')],{'as':_0x54a9('0x137'),'through':_0x54a9('0x138')});db[_0x54a9('0x19')]['hasMany'](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x54a9('0x19')][_0x54a9('0x108')](db[_0x54a9('0x6a')],{'as':_0x54a9('0x114'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x54a9('0x6d')],{'as':_0x54a9('0x10a'),'foreignKey':_0x54a9('0x139')});db['VoiceQueue'][_0x54a9('0x108')](db['CmHopperHistory'],{'as':_0x54a9('0x13a'),'foreignKey':_0x54a9('0x139')});db[_0x54a9('0x19')][_0x54a9('0x108')](db['ReportAgentPreview'],{'as':_0x54a9('0x6f'),'foreignKey':_0x54a9('0x139')});db[_0x54a9('0x19')][_0x54a9('0x108')](db[_0x54a9('0x6b')],{'as':_0x54a9('0x13b'),'foreignKey':_0x54a9('0x139')});db['VoiceQueue'][_0x54a9('0x108')](db['JscriptySessionReport'],{'as':_0x54a9('0x13c'),'foreignKey':_0x54a9('0x139')});db[_0x54a9('0x19')][_0x54a9('0x116')](db[_0x54a9('0x27')],{'as':'Trunk','foreignKey':_0x54a9('0x13d')});db['VoiceQueue']['belongsTo'](db[_0x54a9('0x27')],{'as':_0x54a9('0x13e'),'foreignKey':_0x54a9('0x13f')});db['VoiceQueue']['belongsTo'](db[_0x54a9('0x7c')],{'as':_0x54a9('0x7c'),'foreignKey':_0x54a9('0x140')});db[_0x54a9('0x19')][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':_0x54a9('0x142'),'foreignKey':_0x54a9('0x143')});db[_0x54a9('0x19')][_0x54a9('0x118')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x144'),'through':_0x54a9('0x145')});db[_0x54a9('0x19')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x2c')});db[_0x54a9('0x19')][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'as':_0x54a9('0x147'),'through':_0x54a9('0x148')});db['VoiceQueue'][_0x54a9('0x118')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x149'),'through':_0x54a9('0x14a')});db[_0x54a9('0x1b')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x11'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x14b')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x11'),'foreignKey':'UserId'});db[_0x54a9('0x1d')][_0x54a9('0x108')](db['VoiceMailMessage'],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':'mailboxuser','sourceKey':_0x54a9('0x14d')});db[_0x54a9('0x1f')][_0x54a9('0x116')](db['VoiceMail'],{'foreignKey':_0x54a9('0x14e'),'targetKey':_0x54a9('0x14d')});db['VoiceCallReport'][_0x54a9('0x108')](db['VoiceQueueReport'],{'as':_0x54a9('0x14f'),'foreignKey':_0x54a9('0x150'),'constraints':![]});db[_0x54a9('0x151')]['hasMany'](db['VoiceAgentReport'],{'as':_0x54a9('0x152'),'foreignKey':_0x54a9('0x150'),'constraints':![]});db[_0x54a9('0x151')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':'User','foreignKey':_0x54a9('0x107')});db['VoiceCallReport']['belongsTo'](db[_0x54a9('0x11b')],{'as':_0x54a9('0x153'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x33')]['belongsTo'](db[_0x54a9('0x35')],{'as':_0x54a9('0x35'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x33')][_0x54a9('0x116')](db[_0x54a9('0xfa')],{'as':'CloudProvider','foreignKey':_0x54a9('0x156'),'onDelete':'restrict'});db[_0x54a9('0x34')][_0x54a9('0x116')](db['MailAccount'],{'as':_0x54a9('0x35'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x34')][_0x54a9('0x116')](db[_0x54a9('0xfa')],{'as':_0x54a9('0xfa'),'foreignKey':'CloudProviderId','onDelete':_0x54a9('0x157')});db[_0x54a9('0x35')][_0x54a9('0x104')](db[_0x54a9('0x33')],{'as':_0x54a9('0x158'),'onDelete':'cascade'});db[_0x54a9('0x35')][_0x54a9('0x104')](db[_0x54a9('0x34')],{'as':_0x54a9('0x159'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x35')]['hasMany'](db[_0x54a9('0x78')],{'as':'Dispositions','foreignKey':_0x54a9('0x155'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x35')]['hasMany'](db[_0x54a9('0x76')],{'as':_0x54a9('0x15a'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x35')][_0x54a9('0x108')](db[_0x54a9('0x3b')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x54a9('0x35')][_0x54a9('0x108')](db[_0x54a9('0x3a')],{'as':'Interactions'});db[_0x54a9('0x35')][_0x54a9('0x108')](db[_0x54a9('0x3d')],{'as':_0x54a9('0x136'),'foreignKey':'MailAccountId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x35')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':'ListId'});db['MailAccount'][_0x54a9('0x116')](db[_0x54a9('0x8a')],{'as':_0x54a9('0x8a'),'foreignKey':_0x54a9('0x15c')});db[_0x54a9('0x35')][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':_0x54a9('0x142'),'foreignKey':_0x54a9('0x143')});db[_0x54a9('0x35')]['belongsToMany'](db['User'],{'as':_0x54a9('0x146'),'through':'user_has_mail_accounts'});db[_0x54a9('0x37')][_0x54a9('0x118')](db['User'],{'as':_0x54a9('0x146'),'through':_0x54a9('0x126')});db[_0x54a9('0x37')][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'through':_0x54a9('0x15d'),'as':_0x54a9('0x147')});db[_0x54a9('0x3a')]['hasMany'](db['MailMessage'],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':'MailInteractionId'});db[_0x54a9('0x3a')][_0x54a9('0x116')](db['MailAccount'],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x3a')][_0x54a9('0x116')](db['CmContact'],{'as':'Contact','foreignKey':_0x54a9('0x154')});db[_0x54a9('0x3a')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x15f'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x3a')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x160'),'as':_0x54a9('0x161')});db[_0x54a9('0x3a')]['belongsToMany'](db[_0x54a9('0x85')],{'through':_0x54a9('0x160'),'as':'ThroughTags'});db['MailInteraction'][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':'Users','through':_0x54a9('0x162'),'foreignKey':'MailInteractionId'});db[_0x54a9('0x3b')][_0x54a9('0x108')](db[_0x54a9('0xde')],{'as':_0x54a9('0x163'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x3b')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x11')});db['MailMessage'][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x153')});db['MailMessage'][_0x54a9('0x116')](db['MailInteraction'],{'as':_0x54a9('0x164'),'foreignKey':_0x54a9('0x165')});db[_0x54a9('0x3b')][_0x54a9('0x116')](db[_0x54a9('0x35')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x3b')][_0x54a9('0x116')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0x54a9('0x3b')][_0x54a9('0x116')](db[_0x54a9('0x60')],{'as':_0x54a9('0x60'),'foreignKey':_0x54a9('0x166')});db[_0x54a9('0x3d')][_0x54a9('0x116')](db['User'],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x3d')][_0x54a9('0x116')](db[_0x54a9('0x37')],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x3d')][_0x54a9('0x116')](db[_0x54a9('0x35')],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x3d')][_0x54a9('0x116')](db[_0x54a9('0x7c')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x140')});db['MailApplication'][_0x54a9('0x116')](db[_0x54a9('0x85')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x167')});db[_0x54a9('0x3f')]['belongsTo'](db[_0x54a9('0x35')],{});db[_0x54a9('0x3f')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db['MailQueueReport'][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':_0x54a9('0x153'),'foreignKey':'ContactId'});db[_0x54a9('0x3f')][_0x54a9('0x116')](db['MailInteraction'],{});db[_0x54a9('0x3f')][_0x54a9('0x116')](db['MailMessage'],{});db[_0x54a9('0x3f')]['belongsTo'](db[_0x54a9('0x11')],{});db['MailQueueReport']['belongsTo'](db[_0x54a9('0x37')],{});db['Dashboard']['hasMany'](db['DashboardItem'],{'as':_0x54a9('0x169'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x43')][_0x54a9('0x108')](db[_0x54a9('0x78')],{'as':_0x54a9('0x16a'),'foreignKey':_0x54a9('0x16b'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x43')][_0x54a9('0x108')](db[_0x54a9('0x76')],{'as':_0x54a9('0x15a'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0x54a9('0x108')](db['FaxInteraction'],{'as':_0x54a9('0x16c')});db[_0x54a9('0x43')][_0x54a9('0x108')](db[_0x54a9('0x16d')],{'as':'Applications','foreignKey':_0x54a9('0x16b'),'onDelete':'cascade'});db[_0x54a9('0x43')][_0x54a9('0x108')](db['VoiceExtension'],{'as':_0x54a9('0x16e'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x43')][_0x54a9('0x108')](db[_0x54a9('0x48')],{'as':_0x54a9('0x14c')});db[_0x54a9('0x43')][_0x54a9('0x116')](db['Trunk'],{'as':_0x54a9('0x27')});db['FaxAccount'][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db['FaxAccount'][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':'mandatoryDispositionPause','foreignKey':_0x54a9('0x143')});db[_0x54a9('0x43')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':'Agents','through':_0x54a9('0x16f')});db[_0x54a9('0x16d')]['belongsTo'](db['User'],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x16d')]['belongsTo'](db[_0x54a9('0x49')],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x16d')][_0x54a9('0x116')](db[_0x54a9('0x43')],{'onDelete':_0x54a9('0x157')});db['FaxApplication'][_0x54a9('0x116')](db[_0x54a9('0x85')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x167')});db['FaxInteraction']['hasMany'](db['FaxMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x54a9('0x170')});db[_0x54a9('0x46')][_0x54a9('0x116')](db[_0x54a9('0x43')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x16b')});db[_0x54a9('0x46')][_0x54a9('0x116')](db['CmContact'],{'as':'Contact','foreignKey':_0x54a9('0x154')});db[_0x54a9('0x46')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x15f'),'foreignKey':'UserId'});db[_0x54a9('0x46')][_0x54a9('0x118')](db['Tag'],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x54a9('0x46')]['belongsToMany'](db[_0x54a9('0x85')],{'through':_0x54a9('0x171'),'as':_0x54a9('0x172')});db[_0x54a9('0x46')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x173'),'through':_0x54a9('0x174'),'foreignKey':_0x54a9('0x170')});db[_0x54a9('0x48')][_0x54a9('0x116')](db['User'],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x11')});db[_0x54a9('0x48')][_0x54a9('0x116')](db[_0x54a9('0x46')],{'as':_0x54a9('0x164'),'foreignKey':_0x54a9('0x170')});db[_0x54a9('0x48')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x153')});db['FaxMessage'][_0x54a9('0x116')](db[_0x54a9('0xde')],{'as':_0x54a9('0xde'),'foreignKey':_0x54a9('0x175')});db[_0x54a9('0x48')][_0x54a9('0x116')](db[_0x54a9('0x43')],{'as':_0x54a9('0x15e'),'foreignKey':'FaxAccountId'});db[_0x54a9('0x49')]['belongsToMany'](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x30')});db[_0x54a9('0x49')][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'through':_0x54a9('0x176'),'as':'Teams'});db['FaxQueueReport'][_0x54a9('0x116')](db[_0x54a9('0x43')],{});db[_0x54a9('0x4b')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db[_0x54a9('0x4b')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':_0x54a9('0x154')});db[_0x54a9('0x4b')][_0x54a9('0x116')](db[_0x54a9('0x46')],{});db[_0x54a9('0x4b')][_0x54a9('0x116')](db[_0x54a9('0x48')],{});db[_0x54a9('0x4b')][_0x54a9('0x116')](db[_0x54a9('0x11')],{});db['FaxQueueReport']['belongsTo'](db[_0x54a9('0x49')],{});db['SmsAccount'][_0x54a9('0x108')](db[_0x54a9('0x78')],{'as':_0x54a9('0x16a'),'foreignKey':_0x54a9('0x177'),'onDelete':'cascade'});db[_0x54a9('0x4d')]['hasMany'](db[_0x54a9('0x76')],{'as':'Answers','foreignKey':_0x54a9('0x177')});db[_0x54a9('0x4d')]['hasMany'](db['SmsMessage'],{'as':'Messages','foreignKey':_0x54a9('0x177')});db['SmsAccount'][_0x54a9('0x108')](db[_0x54a9('0x4f')],{'as':_0x54a9('0x16c')});db['SmsAccount']['hasMany'](db[_0x54a9('0x178')],{'as':_0x54a9('0x136'),'foreignKey':_0x54a9('0x177'),'onDelete':'cascade'});db[_0x54a9('0x4d')]['belongsTo'](db[_0x54a9('0xe8')],{'as':'List','foreignKey':_0x54a9('0x168')});db[_0x54a9('0x4d')][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':_0x54a9('0x142'),'foreignKey':_0x54a9('0x143')});db['SmsAccount'][_0x54a9('0x118')](db['User'],{'as':'Agents','through':_0x54a9('0x179')});db['SmsApplication'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'onDelete':'restrict'});db[_0x54a9('0x178')][_0x54a9('0x116')](db['SmsQueue'],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x178')][_0x54a9('0x116')](db['SmsAccount'],{'onDelete':_0x54a9('0x157')});db['SmsApplication'][_0x54a9('0x116')](db[_0x54a9('0x7c')],{'onDelete':'restrict','foreignKey':_0x54a9('0x140')});db[_0x54a9('0x178')][_0x54a9('0x116')](db[_0x54a9('0x85')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x167')});db[_0x54a9('0x4f')]['hasMany'](db[_0x54a9('0x17a')],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x17b')});db[_0x54a9('0x4f')][_0x54a9('0x116')](db['SmsAccount'],{'as':'Account','foreignKey':_0x54a9('0x177')});db[_0x54a9('0x4f')]['belongsTo'](db[_0x54a9('0x11b')],{'as':_0x54a9('0x153'),'foreignKey':'ContactId'});db[_0x54a9('0x4f')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':'Owner','foreignKey':'UserId'});db[_0x54a9('0x4f')]['belongsToMany'](db[_0x54a9('0x85')],{'through':_0x54a9('0x17c'),'as':_0x54a9('0x161')});db[_0x54a9('0x4f')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x17c'),'as':_0x54a9('0x172')});db[_0x54a9('0x4f')]['belongsToMany'](db[_0x54a9('0x11')],{'as':_0x54a9('0x173'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x11')});db['SmsMessage'][_0x54a9('0x116')](db['CmContact'],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x153')});db[_0x54a9('0x17a')][_0x54a9('0x116')](db[_0x54a9('0x4f')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x164'),'foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db['SmsAccount'],{'as':_0x54a9('0x15e'),'foreignKey':'SmsAccountId'});db[_0x54a9('0x51')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x54a9('0x17d')});db[_0x54a9('0x51')]['belongsToMany'](db['Team'],{'through':_0x54a9('0x17e'),'as':'Teams'});db[_0x54a9('0x52')]['hasMany'](db[_0x54a9('0x78')],{'as':_0x54a9('0x16a'),'foreignKey':'OpenchannelAccountId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x52')][_0x54a9('0x108')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x54a9('0x17f')});db['OpenchannelAccount']['hasMany'](db[_0x54a9('0x55')],{'as':'Interactions','foreignKey':_0x54a9('0x17f')});db[_0x54a9('0x52')][_0x54a9('0x108')](db[_0x54a9('0x57')],{'as':_0x54a9('0x14c'),'foreignKey':_0x54a9('0x17f')});db[_0x54a9('0x52')]['hasMany'](db[_0x54a9('0x54')],{'as':_0x54a9('0x136'),'foreignKey':_0x54a9('0x17f'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x52')][_0x54a9('0x116')](db['CmList'],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db[_0x54a9('0x52')][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':_0x54a9('0x142'),'foreignKey':_0x54a9('0x143')});db['OpenchannelAccount'][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x131')});db['OpenchannelApplication']['belongsTo'](db[_0x54a9('0x11')],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x54')]['belongsTo'](db[_0x54a9('0x58')],{'onDelete':'restrict','foreignKey':_0x54a9('0x180')});db[_0x54a9('0x54')][_0x54a9('0x116')](db['OpenchannelAccount'],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x17f')});db[_0x54a9('0x54')][_0x54a9('0x116')](db[_0x54a9('0x7c')],{'onDelete':_0x54a9('0x157'),'foreignKey':'IntervalId'});db[_0x54a9('0x54')][_0x54a9('0x116')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x54a9('0x167')});db['OpenchannelInteraction']['hasMany'](db[_0x54a9('0x57')],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':'OpenchannelInteractionId'});db[_0x54a9('0x55')][_0x54a9('0x116')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x54a9('0x17f')});db[_0x54a9('0x55')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':_0x54a9('0x154')});db[_0x54a9('0x55')]['belongsTo'](db[_0x54a9('0x11')],{'as':_0x54a9('0x15f'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x55')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':'openchannel_interaction_has_tags','as':_0x54a9('0x161')});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0x54a9('0x181'),'as':_0x54a9('0x172')});db[_0x54a9('0x55')][_0x54a9('0x118')](db['User'],{'as':_0x54a9('0x173'),'through':_0x54a9('0x122'),'foreignKey':_0x54a9('0x182')});db[_0x54a9('0x57')]['belongsTo'](db[_0x54a9('0x11')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x11')});db[_0x54a9('0x57')][_0x54a9('0x116')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x54a9('0x57')][_0x54a9('0x116')](db[_0x54a9('0x55')],{'onDelete':'cascade','as':_0x54a9('0x164'),'foreignKey':_0x54a9('0x182')});db[_0x54a9('0x57')][_0x54a9('0x116')](db[_0x54a9('0xde')],{'as':_0x54a9('0xde'),'foreignKey':'AttachmentId'});db[_0x54a9('0x57')][_0x54a9('0x116')](db[_0x54a9('0x52')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x17f')});db[_0x54a9('0x58')][_0x54a9('0x118')](db['User'],{'as':_0x54a9('0x146'),'through':'UserOpenchannelQueue','foreignKey':_0x54a9('0x180')});db['OpenchannelQueue'][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'through':'team_has_openchannel_queues','as':_0x54a9('0x147')});db[_0x54a9('0x59')][_0x54a9('0x108')](db[_0x54a9('0x78')],{'as':_0x54a9('0x16a'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x54a9('0x59')][_0x54a9('0x108')](db[_0x54a9('0x76')],{'as':_0x54a9('0x15a'),'foreignKey':'ChatWebsiteId'});db[_0x54a9('0x59')][_0x54a9('0x108')](db['ChatProactiveAction'],{'as':_0x54a9('0x183')});db[_0x54a9('0x59')]['hasMany'](db['ChatInteraction'],{'as':_0x54a9('0x16c')});db[_0x54a9('0x59')]['hasMany'](db['ChatApplication'],{'as':'Applications','foreignKey':'ChatWebsiteId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x59')][_0x54a9('0x108')](db[_0x54a9('0x5f')],{'as':_0x54a9('0x14c')});db[_0x54a9('0x59')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db['ChatWebsite'][_0x54a9('0x116')](db['Interval'],{'as':_0x54a9('0x7c'),'foreignKey':_0x54a9('0x140')});db['ChatWebsite'][_0x54a9('0x116')](db[_0x54a9('0x35')],{'as':_0x54a9('0x35'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x59')][_0x54a9('0x116')](db['Pause'],{'as':_0x54a9('0x142'),'foreignKey':_0x54a9('0x143')});db[_0x54a9('0x59')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x12e')});db[_0x54a9('0x5b')][_0x54a9('0x116')](db['OpenchannelAccount'],{});db[_0x54a9('0x5b')]['belongsTo'](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':'ListId'});db[_0x54a9('0x5b')]['belongsTo'](db['CmContact'],{'as':_0x54a9('0x153'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x5b')][_0x54a9('0x116')](db[_0x54a9('0x55')],{});db[_0x54a9('0x5b')][_0x54a9('0x116')](db['OpenchannelMessage'],{});db[_0x54a9('0x5b')]['belongsTo'](db[_0x54a9('0x11')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x54a9('0x58')],{});db[_0x54a9('0x184')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x185'),'foreignKey':_0x54a9('0x107'),'onDelete':_0x54a9('0x157')});db['ChatApplication'][_0x54a9('0x116')](db[_0x54a9('0x62')],{'as':_0x54a9('0x186'),'foreignKey':_0x54a9('0x187'),'onDelete':'restrict'});db[_0x54a9('0x184')][_0x54a9('0x116')](db['ChatWebsite'],{'as':_0x54a9('0x188'),'foreignKey':_0x54a9('0x189'),'onDelete':'restrict'});db[_0x54a9('0x184')]['belongsTo'](db[_0x54a9('0x85')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x167')});db[_0x54a9('0x5e')]['hasMany'](db[_0x54a9('0x5f')],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x18a')});db['ChatInteraction'][_0x54a9('0x116')](db[_0x54a9('0x59')],{'as':'Account','foreignKey':_0x54a9('0x189')});db[_0x54a9('0x5e')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':'ContactId'});db['ChatInteraction'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x15f'),'foreignKey':'UserId'});db[_0x54a9('0x5e')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x18b'),'as':_0x54a9('0x161')});db[_0x54a9('0x5e')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x18b'),'as':'ThroughTags'});db[_0x54a9('0x5e')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x173'),'through':_0x54a9('0x120'),'foreignKey':_0x54a9('0x18a')});db[_0x54a9('0x5f')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x11')});db[_0x54a9('0x5f')][_0x54a9('0x116')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0x54a9('0x154')});db['ChatMessage'][_0x54a9('0x116')](db[_0x54a9('0x5e')],{'onDelete':_0x54a9('0x106'),'as':'Interaction','foreignKey':_0x54a9('0x18a')});db[_0x54a9('0x5f')][_0x54a9('0x116')](db[_0x54a9('0xde')],{'as':'Attachment','foreignKey':_0x54a9('0x175')});db['ChatMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x54a9('0x15e'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x54a9('0x108')](db[_0x54a9('0xde')],{'as':'Attachments','foreignKey':_0x54a9('0x166'),'onDelete':_0x54a9('0x106'),'hooks':!![]});db[_0x54a9('0x60')]['belongsTo'](db[_0x54a9('0x11b')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x153'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x60')][_0x54a9('0x116')](db[_0x54a9('0x59')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x54a9('0x62')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x2d'),'hooks':!![]});db[_0x54a9('0x62')][_0x54a9('0x118')](db['Team'],{'through':_0x54a9('0x18c'),'as':_0x54a9('0x147')});db['ChatGroup']['hasMany'](db[_0x54a9('0x18d')],{'as':_0x54a9('0x14c'),'foreignKey':_0x54a9('0x18e'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x64')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x18f'),'through':_0x54a9('0x11a')});db[_0x54a9('0x190')][_0x54a9('0x116')](db[_0x54a9('0x59')],{'as':'Website','foreignKey':_0x54a9('0x189')});db[_0x54a9('0x67')][_0x54a9('0x108')](db[_0x54a9('0x11b')],{'as':_0x54a9('0x11c'),'foreignKey':_0x54a9('0x191')});db['CmContact'][_0x54a9('0x108')](db[_0x54a9('0x87')],{'as':_0x54a9('0x192'),'foreignKey':_0x54a9('0x193')});db[_0x54a9('0x11b')][_0x54a9('0x108')](db[_0x54a9('0x6a')],{'as':_0x54a9('0x114'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x11b')][_0x54a9('0x108')](db[_0x54a9('0x6d')],{'as':_0x54a9('0x10a'),'foreignKey':'ContactId'});db[_0x54a9('0x11b')]['hasMany'](db[_0x54a9('0x194')],{'as':_0x54a9('0x13a'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x11b')][_0x54a9('0x108')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x54a9('0x11b')][_0x54a9('0x108')](db[_0x54a9('0xc9')],{'as':_0x54a9('0x13c'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x11b')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x54a9('0x11b')][_0x54a9('0x108')](db[_0x54a9('0x5e')],{'as':_0x54a9('0x10d'),'foreignKey':_0x54a9('0x154'),'onDelete':'restrict'});db[_0x54a9('0x11b')][_0x54a9('0x108')](db['SmsInteraction'],{'as':_0x54a9('0x10e'),'foreignKey':_0x54a9('0x154'),'onDelete':_0x54a9('0x157')});db[_0x54a9('0x11b')]['hasMany'](db[_0x54a9('0x46')],{'as':_0x54a9('0x10f'),'foreignKey':'ContactId','onDelete':_0x54a9('0x157')});db['CmContact']['hasMany'](db['MailInteraction'],{'as':_0x54a9('0x110'),'foreignKey':_0x54a9('0x154'),'onDelete':_0x54a9('0x157')});db[_0x54a9('0x11b')][_0x54a9('0x116')](db[_0x54a9('0x67')],{'as':_0x54a9('0x195'),'foreignKey':'CompanyId'});db[_0x54a9('0x11b')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168'),'onDelete':_0x54a9('0x106')});db['CmContact'][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':'Users','through':_0x54a9('0x11d')});db[_0x54a9('0x11b')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'as':'Tags','through':_0x54a9('0x196')});db[_0x54a9('0x11b')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x196'),'as':_0x54a9('0x172')});db[_0x54a9('0x6a')][_0x54a9('0x108')](db[_0x54a9('0x89')],{'as':_0x54a9('0x197'),'foreignKey':_0x54a9('0x198')});db[_0x54a9('0x6a')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':_0x54a9('0x154'),'onDelete':_0x54a9('0x106')});db['CmHopper']['belongsTo'](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168'),'onDelete':'cascade'});db[_0x54a9('0x6a')]['belongsTo'](db['User'],{'as':'Agent','foreignKey':_0x54a9('0x107')});db[_0x54a9('0x6a')][_0x54a9('0x116')](db[_0x54a9('0x19')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x6a')][_0x54a9('0x116')](db[_0x54a9('0xdc')],{'as':_0x54a9('0xdc'),'foreignKey':'CampaignId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x6a')]['belongsTo'](db[_0x54a9('0x11')],{'as':_0x54a9('0x15f'),'foreignKey':_0x54a9('0x199')});db[_0x54a9('0x6b')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':_0x54a9('0x153'),'foreignKey':_0x54a9('0x154'),'onDelete':'cascade'});db[_0x54a9('0x6b')][_0x54a9('0x116')](db['CmList'],{'as':'List','foreignKey':_0x54a9('0x168'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x6b')][_0x54a9('0x116')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x54a9('0x139'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0x54a9('0xdc')],{'as':_0x54a9('0xdc'),'foreignKey':'CampaignId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x19a')][_0x54a9('0x108')](db['Condition'],{'as':{'plural':_0x54a9('0x19b'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db['Automation']['hasMany'](db['Condition'],{'as':{'plural':'Any','singular':_0x54a9('0x19c')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x54a9('0x19a')]['hasMany'](db[_0x54a9('0x73')],{'as':_0x54a9('0x19d'),'foreignKey':_0x54a9('0x19e'),'onDelete':'cascade','hooks':!![]});db[_0x54a9('0x78')]['hasMany'](db[_0x54a9('0x78')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x7c')][_0x54a9('0x108')](db[_0x54a9('0x7c')],{'as':_0x54a9('0x19f'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x54a9('0x7c')][_0x54a9('0x108')](db['VoiceExtension'],{'as':_0x54a9('0x1a0'),'foreignKey':_0x54a9('0x140'),'onDelete':_0x54a9('0x157')});db[_0x54a9('0x7c')][_0x54a9('0x108')](db[_0x54a9('0x3d')],{'as':'MailApplications','foreignKey':_0x54a9('0x140')});db[_0x54a9('0x7c')][_0x54a9('0x108')](db[_0x54a9('0x184')],{'as':'ChatApplications','foreignKey':_0x54a9('0x140')});db[_0x54a9('0x7c')][_0x54a9('0x108')](db[_0x54a9('0x16d')],{'as':'FaxApplications','foreignKey':_0x54a9('0x140')});db[_0x54a9('0x7c')][_0x54a9('0x108')](db[_0x54a9('0x178')],{'as':'SmsApplications','foreignKey':_0x54a9('0x140')});db['Schedule']['belongsTo'](db['MailAccount'],{});db[_0x54a9('0x81')]['belongsTo'](db[_0x54a9('0x92')],{'foreignKey':_0x54a9('0x1a1')});db[_0x54a9('0x81')][_0x54a9('0x116')](db[_0x54a9('0x91')],{'foreignKey':_0x54a9('0x1a2')});db['Sound']['belongsToMany'](db[_0x54a9('0x17')],{'as':'Mohs','through':_0x54a9('0x138'),'onDelete':'restrict'});db[_0x54a9('0x85')][_0x54a9('0x118')](db[_0x54a9('0x11b')],{'through':_0x54a9('0x196')});db[_0x54a9('0x85')][_0x54a9('0x118')](db[_0x54a9('0x5e')],{'through':_0x54a9('0x18b')});db[_0x54a9('0x85')][_0x54a9('0x118')](db[_0x54a9('0x3a')],{'through':_0x54a9('0x160')});db[_0x54a9('0x85')][_0x54a9('0x118')](db[_0x54a9('0x4f')],{'through':'sms_interaction_has_tags'});db[_0x54a9('0x85')][_0x54a9('0x118')](db[_0x54a9('0x46')],{'through':_0x54a9('0x171')});db['Tag'][_0x54a9('0x118')](db[_0x54a9('0x55')],{'through':_0x54a9('0x181')});db['Tag'][_0x54a9('0x118')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db['CmContactHasItem']['belongsTo'](db[_0x54a9('0x1a3')],{'as':_0x54a9('0x1a4'),'foreignKey':_0x54a9('0x1a5')});db['CmHopperAdditionalPhone'][_0x54a9('0x116')](db[_0x54a9('0x6a')],{'as':_0x54a9('0x1a6'),'foreignKey':_0x54a9('0x198')});db[_0x54a9('0x87')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':_0x54a9('0x153'),'foreignKey':'CmContactId'});db[_0x54a9('0x8b')][_0x54a9('0x108')](db[_0x54a9('0x7a')],{'as':{'plural':'AllConditions','singular':_0x54a9('0x1a7')},'foreignKey':_0x54a9('0x1a8'),'onDelete':_0x54a9('0x106'),'hooks':!![]});db[_0x54a9('0x8b')][_0x54a9('0x108')](db[_0x54a9('0x7a')],{'as':{'plural':_0x54a9('0x1a9'),'singular':'AnyCondition'},'foreignKey':_0x54a9('0x1aa'),'onDelete':_0x54a9('0x106'),'hooks':!![]});db[_0x54a9('0x8b')][_0x54a9('0x108')](db[_0x54a9('0x73')],{'as':_0x54a9('0x19d'),'foreignKey':_0x54a9('0x1ab'),'onDelete':_0x54a9('0x106'),'hooks':!![]});db['AnalyticCustomReport'][_0x54a9('0x108')](db[_0x54a9('0x97')],{'as':_0x54a9('0x1ac'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1a2'),'hooks':!![]});db[_0x54a9('0x92')][_0x54a9('0x108')](db['AnalyticFieldReport'],{'as':_0x54a9('0x1ac'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1a1')});db[_0x54a9('0x95')][_0x54a9('0x108')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x54a9('0x1ad')});db[_0x54a9('0x97')][_0x54a9('0x116')](db['AnalyticMetric'],{'foreignKey':_0x54a9('0x1ad')});db[_0x54a9('0x1ae')][_0x54a9('0x108')](db['SalesforceConfiguration'],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x9c')][_0x54a9('0x108')](db['SalesforceField'],{'as':_0x54a9('0x1b1'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x9c')][_0x54a9('0x108')](db[_0x54a9('0x1b3')],{'as':_0x54a9('0x1b4'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x9c')][_0x54a9('0x108')](db[_0x54a9('0x1b3')],{'as':_0x54a9('0x1ac'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x9c')][_0x54a9('0x116')](db[_0x54a9('0x1ae')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x1b3')]['hasMany'](db[_0x54a9('0x1b3')],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db['SalesforceField'][_0x54a9('0x108')](db['SalesforceField'],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x1b3')][_0x54a9('0x108')](db[_0x54a9('0x1b3')],{'as':_0x54a9('0x1b9'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x1b3')][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':_0x54a9('0x8c'),'foreignKey':_0x54a9('0x1ba')});db[_0x54a9('0x1bb')][_0x54a9('0x108')](db[_0x54a9('0x9f')],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x9f')]['hasMany'](db['SugarcrmField'],{'as':_0x54a9('0x1b1'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b2')});db['SugarcrmConfiguration'][_0x54a9('0x108')](db[_0x54a9('0x1bc')],{'as':_0x54a9('0x1b4'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x9f')][_0x54a9('0x108')](db['SugarcrmField'],{'as':_0x54a9('0x1ac'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x9f')][_0x54a9('0x116')](db[_0x54a9('0x1bb')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db['SugarcrmField'][_0x54a9('0x108')](db[_0x54a9('0x1bc')],{'as':'Subject','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1bc')][_0x54a9('0x108')](db['SugarcrmField'],{'as':'Description','foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x1bc')]['hasMany'](db[_0x54a9('0x1bc')],{'as':'Field','foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x1bc')]['belongsTo'](db['Variable'],{'as':_0x54a9('0x8c'),'foreignKey':_0x54a9('0x1ba')});db[_0x54a9('0xa2')][_0x54a9('0x108')](db[_0x54a9('0x1bd')],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':'AccountId'});db[_0x54a9('0x1bd')]['hasMany'](db[_0x54a9('0xa4')],{'as':_0x54a9('0x1b1'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1bd')][_0x54a9('0x108')](db['DeskField'],{'as':_0x54a9('0x1b4'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x1bd')]['hasMany'](db[_0x54a9('0xa4')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x1bd')][_0x54a9('0x116')](db[_0x54a9('0xa2')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x1bd')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x1be')});db[_0x54a9('0xa4')][_0x54a9('0x108')](db[_0x54a9('0xa4')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x54a9('0xa4')]['hasMany'](db[_0x54a9('0xa4')],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0xa4')][_0x54a9('0x108')](db[_0x54a9('0xa4')],{'as':'Field','foreignKey':_0x54a9('0x1b6')});db['DeskField'][_0x54a9('0x116')](db['Variable'],{'as':_0x54a9('0x8c'),'foreignKey':'VariableId'});db[_0x54a9('0x1bf')][_0x54a9('0x108')](db['ZohoConfiguration'],{'as':_0x54a9('0x1af'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x1c0')][_0x54a9('0x108')](db['ZohoField'],{'as':_0x54a9('0x1b1'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1c0')][_0x54a9('0x108')](db[_0x54a9('0xa8')],{'as':_0x54a9('0x1b4'),'onDelete':_0x54a9('0x106'),'foreignKey':'DescriptionId'});db[_0x54a9('0x1c0')][_0x54a9('0x108')](db['ZohoField'],{'as':_0x54a9('0x1ac'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b6')});db['ZohoConfiguration'][_0x54a9('0x116')](db[_0x54a9('0x1bf')],{'as':'Account','foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xa8')]['hasMany'](db[_0x54a9('0xa8')],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db['ZohoField'][_0x54a9('0x108')](db[_0x54a9('0xa8')],{'as':'Field','foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0xa8')]['belongsTo'](db[_0x54a9('0x8c')],{'as':'Variable','foreignKey':_0x54a9('0x1ba')});db['ZendeskAccount']['hasMany'](db['ZendeskConfiguration'],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xac')]['hasMany'](db[_0x54a9('0x1c1')],{'as':'Subjects','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0xac')][_0x54a9('0x108')](db[_0x54a9('0x1c1')],{'as':_0x54a9('0x1b4'),'foreignKey':_0x54a9('0x1b5')});db['ZendeskConfiguration']['hasMany'](db[_0x54a9('0x1c1')],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x54a9('0x116')](db[_0x54a9('0xaa')],{'as':'Account','foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xac')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x1c2')});db[_0x54a9('0x1c1')]['hasMany'](db[_0x54a9('0x1c1')],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1c1')][_0x54a9('0x108')](db[_0x54a9('0x1c1')],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x1c1')][_0x54a9('0x108')](db['ZendeskField'],{'as':'Field','foreignKey':_0x54a9('0x1b6')});db['ZendeskField'][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':'Variable','foreignKey':_0x54a9('0x1ba')});db[_0x54a9('0xae')]['hasMany'](db[_0x54a9('0xb0')],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x54a9('0x1b1'),'onDelete':_0x54a9('0x106'),'foreignKey':'SubjectId'});db[_0x54a9('0xb0')]['hasMany'](db[_0x54a9('0xb2')],{'as':_0x54a9('0x1b4'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0xb0')][_0x54a9('0x108')](db[_0x54a9('0xb2')],{'as':_0x54a9('0x1ac'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x54a9('0xb0')][_0x54a9('0x116')](db[_0x54a9('0xae')],{'as':'Account','foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xb0')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x1c3')});db[_0x54a9('0xb2')][_0x54a9('0x108')](db[_0x54a9('0xb2')],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db['FreshdeskField'][_0x54a9('0x108')](db[_0x54a9('0xb2')],{'as':'Description','foreignKey':_0x54a9('0x1b5')});db['FreshdeskField']['hasMany'](db[_0x54a9('0xb2')],{'as':'Field','foreignKey':'FieldId'});db[_0x54a9('0xb2')][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':_0x54a9('0x8c'),'foreignKey':_0x54a9('0x1ba')});db['VtigerAccount']['hasMany'](db['VtigerConfiguration'],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x1c4')]['hasMany'](db[_0x54a9('0xb5')],{'as':_0x54a9('0x1b1'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1c4')][_0x54a9('0x108')](db[_0x54a9('0xb5')],{'as':'Descriptions','foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x1c4')]['hasMany'](db['VtigerField'],{'as':_0x54a9('0x1ac'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x1c4')][_0x54a9('0x116')](db[_0x54a9('0x1c5')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xb5')][_0x54a9('0x108')](db[_0x54a9('0xb5')],{'as':'Subject','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0xb5')][_0x54a9('0x108')](db[_0x54a9('0xb5')],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db['VtigerField'][_0x54a9('0x108')](db[_0x54a9('0xb5')],{'as':_0x54a9('0x1b9'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0xb5')][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':_0x54a9('0x8c'),'foreignKey':_0x54a9('0x1ba')});db[_0x54a9('0x1c6')][_0x54a9('0x108')](db['ServicenowConfiguration'],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':'AccountId'});db[_0x54a9('0xb7')][_0x54a9('0x108')](db[_0x54a9('0x1c7')],{'as':_0x54a9('0x1b1'),'foreignKey':'SubjectId'});db[_0x54a9('0xb7')][_0x54a9('0x108')](db[_0x54a9('0x1c7')],{'as':_0x54a9('0x1b4'),'foreignKey':'DescriptionId'});db[_0x54a9('0xb7')][_0x54a9('0x108')](db[_0x54a9('0x1c7')],{'as':_0x54a9('0x1ac'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0xb7')][_0x54a9('0x116')](db[_0x54a9('0x1c6')],{'as':'Account','foreignKey':'AccountId'});db[_0x54a9('0x1c7')][_0x54a9('0x108')](db['ServicenowField'],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1c7')][_0x54a9('0x108')](db[_0x54a9('0x1c7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x54a9('0x1c7')][_0x54a9('0x108')](db[_0x54a9('0x1c7')],{'as':_0x54a9('0x1b9'),'foreignKey':_0x54a9('0x1b6')});db['ServicenowField'][_0x54a9('0x116')](db['Variable'],{'as':_0x54a9('0x8c'),'foreignKey':_0x54a9('0x1ba')});db[_0x54a9('0x1c8')][_0x54a9('0x108')](db[_0x54a9('0xb9')],{'as':'Configurations','onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db['Dynamics365Account']['belongsTo'](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x54a9('0x156')});db[_0x54a9('0xb9')]['hasMany'](db[_0x54a9('0xbb')],{'as':_0x54a9('0x1b1'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0xb9')]['hasMany'](db[_0x54a9('0xbb')],{'as':_0x54a9('0x1b4'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b5')});db['Dynamics365Configuration'][_0x54a9('0x108')](db['Dynamics365Field'],{'as':_0x54a9('0x1ac'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0xb9')][_0x54a9('0x116')](db[_0x54a9('0x1c8')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xbb')]['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0xbb')][_0x54a9('0x108')](db[_0x54a9('0xbb')],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0xbb')][_0x54a9('0x108')](db[_0x54a9('0xbb')],{'as':_0x54a9('0x1b9'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0xbb')][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':_0x54a9('0x8c'),'foreignKey':'VariableId'});db[_0x54a9('0xbd')][_0x54a9('0x108')](db[_0x54a9('0xbf')],{'as':_0x54a9('0x1af'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b0')});db['FreshsalesConfiguration'][_0x54a9('0x108')](db[_0x54a9('0x1c9')],{'as':'Subjects','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0xbf')][_0x54a9('0x108')](db[_0x54a9('0x1c9')],{'as':_0x54a9('0x1b4'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0xbf')][_0x54a9('0x108')](db[_0x54a9('0x1c9')],{'as':'Fields','foreignKey':'FieldId'});db[_0x54a9('0xbf')][_0x54a9('0x116')](db[_0x54a9('0xbd')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x1c9')][_0x54a9('0x108')](db[_0x54a9('0x1c9')],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1c9')][_0x54a9('0x108')](db['FreshsalesField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x54a9('0x1c9')][_0x54a9('0x108')](db[_0x54a9('0x1c9')],{'as':'Field','foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x1c9')][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':'Variable','foreignKey':'VariableId'});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0x59')],{});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':_0x54a9('0x154')});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0x5e')],{});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0x5f')],{});db[_0x54a9('0xc3')]['belongsTo'](db[_0x54a9('0x11')],{});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0x62')],{});db[_0x54a9('0x18d')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'onDelete':'cascade','foreignKey':_0x54a9('0x1ca')});db[_0x54a9('0x18d')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1cb')});db[_0x54a9('0xc9')]['hasMany'](db[_0x54a9('0x1cc')],{'foreignKey':'SessionId','onDelete':_0x54a9('0x106')});db[_0x54a9('0xc9')][_0x54a9('0x108')](db[_0x54a9('0xc6')],{'foreignKey':_0x54a9('0x1cd'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0xcb')]['belongsTo'](db['SmsAccount'],{});db[_0x54a9('0xcb')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db[_0x54a9('0xcb')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':_0x54a9('0x154')});db['SmsQueueReport']['belongsTo'](db[_0x54a9('0x4f')],{});db[_0x54a9('0xcb')][_0x54a9('0x116')](db[_0x54a9('0x17a')],{});db[_0x54a9('0xcb')][_0x54a9('0x116')](db[_0x54a9('0x11')],{});db['SmsQueueReport'][_0x54a9('0x116')](db['SmsQueue'],{});db[_0x54a9('0xd1')][_0x54a9('0x108')](db[_0x54a9('0xc9')],{'foreignKey':_0x54a9('0x1ce')});db[_0x54a9('0xd1')][_0x54a9('0x108')](db[_0x54a9('0x1cc')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x54a9('0x108')](db[_0x54a9('0xc6')],{'foreignKey':_0x54a9('0x1ce')});db[_0x54a9('0xd8')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x11f')});db[_0x54a9('0xd8')]['belongsToMany'](db[_0x54a9('0x19')],{'through':_0x54a9('0x148'),'as':_0x54a9('0x1cf')});db[_0x54a9('0xd8')][_0x54a9('0x118')](db[_0x54a9('0x37')],{'through':_0x54a9('0x15d'),'as':_0x54a9('0x125')});db[_0x54a9('0xd8')]['belongsToMany'](db[_0x54a9('0x62')],{'through':'team_has_chat_queues','as':_0x54a9('0x127')});db[_0x54a9('0xd8')][_0x54a9('0x118')](db[_0x54a9('0x49')],{'through':'team_has_fax_queues','as':_0x54a9('0x1d0')});db[_0x54a9('0xd8')][_0x54a9('0x118')](db[_0x54a9('0x51')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0x54a9('0xd8')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0x54a9('0x1d1'),'as':_0x54a9('0x129')});db[_0x54a9('0xd8')]['belongsToMany'](db[_0x54a9('0xf9')],{'through':_0x54a9('0x1d2'),'as':_0x54a9('0x12b')});db[_0x54a9('0xd8')][_0x54a9('0x118')](db[_0x54a9('0xea')],{'through':_0x54a9('0xfd'),'as':_0x54a9('0x124')});db[_0x54a9('0xdc')][_0x54a9('0x108')](db[_0x54a9('0x6a')],{'as':_0x54a9('0x114'),'foreignKey':_0x54a9('0x1d3')});db[_0x54a9('0xdc')][_0x54a9('0x108')](db['CmHopperFinal'],{'as':_0x54a9('0x10a'),'foreignKey':'CampaignId'});db[_0x54a9('0xdc')][_0x54a9('0x108')](db[_0x54a9('0x194')],{'as':_0x54a9('0x13a'),'foreignKey':_0x54a9('0x1d3')});db[_0x54a9('0xdc')][_0x54a9('0x108')](db[_0x54a9('0x6b')],{'as':_0x54a9('0x13b'),'foreignKey':_0x54a9('0x1d3')});db[_0x54a9('0xdc')]['belongsTo'](db[_0x54a9('0x27')],{'as':_0x54a9('0x27'),'foreignKey':_0x54a9('0x13d')});db[_0x54a9('0xdc')][_0x54a9('0x116')](db[_0x54a9('0x27')],{'as':_0x54a9('0x13e'),'foreignKey':_0x54a9('0x13f')});db['Campaign'][_0x54a9('0x116')](db['Interval'],{'as':_0x54a9('0x7c'),'foreignKey':'IntervalId'});db['Campaign']['belongsTo'](db[_0x54a9('0x1d4')],{'as':_0x54a9('0x1d4'),'foreignKey':'SquareProjectId'});db[_0x54a9('0xdc')][_0x54a9('0x118')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x144'),'through':'campaigns_has_cm_lists'});db[_0x54a9('0xdc')]['belongsToMany'](db[_0x54a9('0xe8')],{'as':_0x54a9('0x149'),'through':_0x54a9('0x1d5')});db['Attachment'][_0x54a9('0x116')](db[_0x54a9('0x60')],{'as':_0x54a9('0x60'),'foreignKey':_0x54a9('0x166')});db[_0x54a9('0xe0')][_0x54a9('0x116')](db['MailMessage'],{});db[_0x54a9('0xe0')]['belongsTo'](db[_0x54a9('0x3a')],{});db[_0x54a9('0xe0')]['belongsTo'](db[_0x54a9('0x35')],{'foreignKey':_0x54a9('0x1d6'),'as':_0x54a9('0x1d7')});db['MailTransferReport']['belongsTo'](db[_0x54a9('0x11')],{'foreignKey':'FromUserId','as':_0x54a9('0x1d8')});db['MailTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1d9'),'as':_0x54a9('0x1da')});db[_0x54a9('0xe0')][_0x54a9('0x116')](db[_0x54a9('0x37')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db['MailTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x35')],{'foreignKey':_0x54a9('0x1db'),'as':_0x54a9('0x1dc')});db[_0x54a9('0xe2')][_0x54a9('0x116')](db['ChatMessage'],{});db['ChatTransferReport']['belongsTo'](db[_0x54a9('0x5e')],{});db[_0x54a9('0xe2')]['belongsTo'](db[_0x54a9('0x59')],{'foreignKey':_0x54a9('0x1dd'),'as':_0x54a9('0x1d7')});db[_0x54a9('0xe2')]['belongsTo'](db['User'],{'foreignKey':_0x54a9('0x1de'),'as':_0x54a9('0x1d8')});db[_0x54a9('0xe2')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1d9'),'as':'ToAgent'});db[_0x54a9('0xe2')][_0x54a9('0x116')](db[_0x54a9('0x62')],{'foreignKey':_0x54a9('0x1df'),'as':'ToQueue'});db[_0x54a9('0xe2')][_0x54a9('0x116')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x54a9('0x1dc')});db[_0x54a9('0xe4')]['belongsTo'](db[_0x54a9('0x48')],{});db[_0x54a9('0xe4')][_0x54a9('0x116')](db['FaxInteraction'],{});db[_0x54a9('0xe4')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x54a9('0x1e0'),'as':_0x54a9('0x1d7')});db[_0x54a9('0xe4')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':'FromUserId','as':_0x54a9('0x1d8')});db['FaxTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1d9'),'as':_0x54a9('0x1da')});db[_0x54a9('0xe4')]['belongsTo'](db[_0x54a9('0x49')],{'foreignKey':_0x54a9('0x1e1'),'as':_0x54a9('0x1e2')});db[_0x54a9('0xe4')][_0x54a9('0x116')](db[_0x54a9('0x43')],{'foreignKey':'ToFaxAccountId','as':_0x54a9('0x1dc')});db[_0x54a9('0xe5')]['belongsTo'](db[_0x54a9('0x57')],{});db[_0x54a9('0xe5')][_0x54a9('0x116')](db[_0x54a9('0x55')],{});db['OpenchannelTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x52')],{'foreignKey':_0x54a9('0x1e3'),'as':_0x54a9('0x1d7')});db['OpenchannelTransferReport']['belongsTo'](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1de'),'as':_0x54a9('0x1d8')});db[_0x54a9('0xe5')]['belongsTo'](db['User'],{'foreignKey':_0x54a9('0x1d9'),'as':_0x54a9('0x1da')});db['OpenchannelTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x58')],{'foreignKey':_0x54a9('0x1e4'),'as':_0x54a9('0x1e2')});db[_0x54a9('0xe5')]['belongsTo'](db[_0x54a9('0x52')],{'foreignKey':_0x54a9('0x1e5'),'as':'ToAccount'});db[_0x54a9('0x1e6')][_0x54a9('0x116')](db[_0x54a9('0x17a')],{});db['SmsTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x4f')],{});db[_0x54a9('0x1e6')][_0x54a9('0x116')](db[_0x54a9('0x4d')],{'foreignKey':'FromSmsAccountId','as':_0x54a9('0x1d7')});db[_0x54a9('0x1e6')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1de'),'as':_0x54a9('0x1d8')});db[_0x54a9('0x1e6')][_0x54a9('0x116')](db['User'],{'foreignKey':_0x54a9('0x1d9'),'as':_0x54a9('0x1da')});db['SmsTransferReport']['belongsTo'](db[_0x54a9('0x51')],{'foreignKey':_0x54a9('0x1e7'),'as':_0x54a9('0x1e2')});db[_0x54a9('0x1e6')][_0x54a9('0x116')](db[_0x54a9('0x4d')],{'foreignKey':'ToSmsAccountId','as':_0x54a9('0x1dc')});db[_0x54a9('0xe8')][_0x54a9('0x108')](db[_0x54a9('0x78')],{'as':_0x54a9('0x16a'),'foreignKey':'ListId','onDelete':_0x54a9('0x106')});db[_0x54a9('0xe8')][_0x54a9('0x108')](db[_0x54a9('0x71')],{'as':_0x54a9('0x1e8'),'foreignKey':_0x54a9('0x168')});db[_0x54a9('0xe8')]['hasMany'](db[_0x54a9('0x11b')],{'as':_0x54a9('0x11c'),'onDelete':'cascade','foreignKey':_0x54a9('0x168')});db[_0x54a9('0xe8')][_0x54a9('0x108')](db[_0x54a9('0x6d')],{'as':_0x54a9('0x10a'),'foreignKey':_0x54a9('0x168')});db['CmList'][_0x54a9('0x108')](db['CmHopperHistory'],{'as':_0x54a9('0x10b'),'foreignKey':'ListId'});db[_0x54a9('0xe8')][_0x54a9('0x108')](db[_0x54a9('0x6f')],{'as':_0x54a9('0x6f'),'foreignKey':'ListId'});db[_0x54a9('0xe8')]['belongsToMany'](db[_0x54a9('0x19')],{'as':_0x54a9('0x1e9'),'through':_0x54a9('0x145')});db['CmList']['belongsToMany'](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x11e')});db[_0x54a9('0xea')][_0x54a9('0x108')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x54a9('0x106')});db[_0x54a9('0xea')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0xff')});db[_0x54a9('0xea')][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'through':_0x54a9('0xfd'),'as':_0x54a9('0x147')});db['UserProfile']['hasMany'](db[_0x54a9('0x11')],{'as':_0x54a9('0x173'),'foreignKey':_0x54a9('0x117')});db[_0x54a9('0xeb')][_0x54a9('0x108')](db[_0x54a9('0x1ea')],{'as':_0x54a9('0x1eb'),'foreignKey':_0x54a9('0x117'),'onDelete':_0x54a9('0x106')});db['UserProfileSection'][_0x54a9('0x108')](db[_0x54a9('0xed')],{'as':_0x54a9('0x1ec'),'foreignKey':_0x54a9('0x1ed'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0xf1')][_0x54a9('0x108')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x54a9('0x1ee'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0xf1')][_0x54a9('0x108')](db['CannedAnswer'],{'as':_0x54a9('0x15a'),'foreignKey':_0x54a9('0x1ee')});db['WhatsappAccount'][_0x54a9('0x108')](db[_0x54a9('0xf5')],{'as':_0x54a9('0x14c'),'foreignKey':_0x54a9('0x1ee')});db[_0x54a9('0xf1')][_0x54a9('0x108')](db[_0x54a9('0x111')],{'as':_0x54a9('0x16c')});db[_0x54a9('0xf1')]['hasMany'](db[_0x54a9('0xf3')],{'as':_0x54a9('0x136'),'foreignKey':_0x54a9('0x1ee'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0xf1')][_0x54a9('0x116')](db['CmList'],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db['WhatsappAccount'][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':'mandatoryDispositionPause','foreignKey':_0x54a9('0x143')});db[_0x54a9('0xf1')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':'user_has_whatsapp_accounts'});db[_0x54a9('0xf3')]['belongsTo'](db[_0x54a9('0x11')],{'onDelete':'restrict'});db[_0x54a9('0xf3')][_0x54a9('0x116')](db[_0x54a9('0xf9')],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0xf3')][_0x54a9('0x116')](db['WhatsappAccount'],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0xf3')][_0x54a9('0x116')](db['Interval'],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x140')});db[_0x54a9('0xf3')][_0x54a9('0x116')](db[_0x54a9('0x85')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x167')});db[_0x54a9('0x111')][_0x54a9('0x108')](db[_0x54a9('0xf5')],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1ef')});db['WhatsappInteraction']['belongsTo'](db[_0x54a9('0xf1')],{'as':'Account','foreignKey':_0x54a9('0x1ee')});db[_0x54a9('0x111')][_0x54a9('0x116')](db['CmContact'],{'as':_0x54a9('0x153'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x111')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':'Owner','foreignKey':_0x54a9('0x107')});db['WhatsappInteraction'][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x1f0'),'as':'Tags'});db[_0x54a9('0x111')]['belongsToMany'](db[_0x54a9('0x85')],{'through':_0x54a9('0x1f0'),'as':_0x54a9('0x172')});db[_0x54a9('0x111')][_0x54a9('0x118')](db['User'],{'as':'Users','through':_0x54a9('0x123'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x54a9('0x116')](db['User'],{'as':_0x54a9('0x11')});db[_0x54a9('0xf5')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'onDelete':_0x54a9('0x106'),'as':'Contact'});db[_0x54a9('0xf5')][_0x54a9('0x116')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x54a9('0x164'),'foreignKey':'WhatsappInteractionId'});db[_0x54a9('0xf5')][_0x54a9('0x116')](db[_0x54a9('0xf1')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1ee')});db[_0x54a9('0xf7')]['belongsTo'](db[_0x54a9('0xf1')],{});db['WhatsappQueueReport'][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':'ListId'});db[_0x54a9('0xf7')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':'ContactId'});db[_0x54a9('0xf7')][_0x54a9('0x116')](db['WhatsappInteraction'],{});db[_0x54a9('0xf7')][_0x54a9('0x116')](db[_0x54a9('0xf9')],{});db[_0x54a9('0xf7')][_0x54a9('0x116')](db[_0x54a9('0xf5')],{});db[_0x54a9('0xf7')][_0x54a9('0x116')](db[_0x54a9('0x11')],{});db[_0x54a9('0x1f1')][_0x54a9('0x116')](db[_0x54a9('0xf5')],{});db[_0x54a9('0x1f1')]['belongsTo'](db[_0x54a9('0x111')],{});db['WhatsappTransferReport'][_0x54a9('0x116')](db[_0x54a9('0xf1')],{'foreignKey':_0x54a9('0x1f2'),'as':'FromAccount'});db[_0x54a9('0x1f1')]['belongsTo'](db[_0x54a9('0xf1')],{'foreignKey':_0x54a9('0x1f3'),'as':_0x54a9('0x1dc')});db[_0x54a9('0x1f1')][_0x54a9('0x116')](db[_0x54a9('0xf9')],{'foreignKey':_0x54a9('0x1f4'),'as':_0x54a9('0x1e2')});db['WhatsappTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1de'),'as':_0x54a9('0x1d8')});db[_0x54a9('0x1f1')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1d9'),'as':_0x54a9('0x1da')});db[_0x54a9('0xf9')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x12c'),'foreignKey':_0x54a9('0x1f5')});db[_0x54a9('0xf9')][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'through':_0x54a9('0x1d2'),'as':_0x54a9('0x147')});db[_0x54a9('0x100')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x1f6'),'foreignKey':_0x54a9('0x107'),'onDelete':'cascade','hooks':!![]});db['CloudProvider'][_0x54a9('0x104')](db[_0x54a9('0x1c8')],{'as':_0x54a9('0x1c8'),'onDelete':'restrict'});db[_0x54a9('0xfa')][_0x54a9('0x104')](db['MailServerIn'],{'as':_0x54a9('0x158'),'onDelete':_0x54a9('0x157')});db[_0x54a9('0xfa')][_0x54a9('0x104')](db[_0x54a9('0x34')],{'as':_0x54a9('0x159'),'onDelete':_0x54a9('0x157')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x5098=['ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Contacts','CompanyId','Phones','CmContactId','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Campaign','AutomationAllId','Any','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','AnalyticCustomReport','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','Fields','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','DeskConfiguration','ZendeskConfiguration','ZendeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowConfiguration','ChatQueueReport','FromId','ToId','SessionId','ProjectId','JscriptyProject','TeamVoiceQueue','team_has_chat_queues','team_has_sms_queues','WhatsappQueues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToQueue','ToMailAccountId','ToAccount','FromAgent','ToAgent','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileResource','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','../config/environment','lodash','jstz','determine','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/action/action.model','Automation','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','Interval','../api/interval/interval.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Variable','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','VoiceMail','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ChatInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','VoiceChanSpy','SpiedAgents','Applications','VoiceMusicOnHold','moh_has_sounds','Members','HopperHistories','VoiceQueueId','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceMailMessage','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','MailMessage','Interactions','ListId','user_has_mail_accounts','team_has_mail_queues','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','MailQueueReport','List','Dashboard','Items','FaxAccountId','CannedAnswer','Exntensions','FaxMessage','FaxInteractionId','Users','AttachmentId','team_has_fax_queues','SmsAccount','SmsAccountId','Pause','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatMessage'];(function(_0x18b033,_0x1507fd){var _0x21c86d=function(_0x13f300){while(--_0x13f300){_0x18b033['push'](_0x18b033['shift']());}};_0x21c86d(++_0x1507fd);}(_0x5098,0x6a));var _0x8509=function(_0x50b789,_0xc2c9bb){_0x50b789=_0x50b789-0x0;var _0x91eea6=_0x5098[_0x50b789];return _0x91eea6;};'use strict';var config=require(_0x8509('0x0'));var Sequelize=require('sequelize');var _=require(_0x8509('0x1'));var jstz=require(_0x8509('0x2'));var timezone=jstz[_0x8509('0x3')]();config[_0x8509('0x4')]=_['defaultsDeep'](config[_0x8509('0x4')],{'database':_0x8509('0x5'),'username':_0x8509('0x6'),'password':_0x8509('0x7'),'options':{'host':_0x8509('0x8'),'port':0xcea,'dialect':_0x8509('0x9'),'dialectOptions':{'charset':_0x8509('0xa')},'logging':![],'timezone':timezone[_0x8509('0xb')](),'define':{'charset':_0x8509('0xc'),'collate':'utf8_general_ci'}}});config[_0x8509('0xd')]=_['defaultsDeep'](config[_0x8509('0xd')],{'database':_0x8509('0x5'),'username':_0x8509('0x6'),'password':'xC@LL1234','options':{'host':_0x8509('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x8509('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8509('0x4')][_0x8509('0xe')],config[_0x8509('0x4')][_0x8509('0xf')],config[_0x8509('0x4')][_0x8509('0x10')],config[_0x8509('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8509('0xd')][_0x8509('0xe')],config['sequelizeHistory'][_0x8509('0xf')],config[_0x8509('0xd')][_0x8509('0x10')],config['sequelizeHistory'][_0x8509('0x11')])};db[_0x8509('0x12')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x14'));db['VoiceChanSpy']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x8509('0x15')]=db[_0x8509('0x4')]['import'](_0x8509('0x16'));db[_0x8509('0x17')]=db[_0x8509('0x4')]['import'](_0x8509('0x18'));db['VoiceMusicOnHold']=db['sequelize'][_0x8509('0x13')](_0x8509('0x19'));db[_0x8509('0x1a')]=db[_0x8509('0x4')]['import'](_0x8509('0x1b'));db[_0x8509('0x1c')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x1d'));db['ScreenRecording']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x1e'));db['VoiceMail']=db['sequelize'][_0x8509('0x13')](_0x8509('0x1f'));db['VoiceMailMessage']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x8509('0x20')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x21'));db[_0x8509('0x22')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x23'));db['VoiceAgentReport']=db[_0x8509('0x4')]['import'](_0x8509('0x24'));db[_0x8509('0x25')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x26'));db[_0x8509('0x27')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x28'));db[_0x8509('0x29')]=db['sequelize']['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db['sequelize'][_0x8509('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x8509('0x2a')]=db[_0x8509('0x4')]['import'](_0x8509('0x2b'));db[_0x8509('0x2c')]=db['sequelize'][_0x8509('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x8509('0x2d')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x2e'));db[_0x8509('0x2f')]=db[_0x8509('0x4')]['import'](_0x8509('0x30'));db[_0x8509('0x31')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x32'));db['UserSmsQueue']=db[_0x8509('0x4')]['import'](_0x8509('0x33'));db[_0x8509('0x34')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x35'));db[_0x8509('0x36')]=db['sequelize']['import'](_0x8509('0x37'));db[_0x8509('0x38')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x39'));db[_0x8509('0x3a')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x3b'));db[_0x8509('0x3c')]=db[_0x8509('0x4')]['import'](_0x8509('0x3d'));db[_0x8509('0x3e')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x3f'));db['MailSubstatus']=db[_0x8509('0x4')]['import'](_0x8509('0x40'));db[_0x8509('0x41')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x42'));db['MailMessage']=db[_0x8509('0x4')]['import'](_0x8509('0x43'));db[_0x8509('0x44')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x45'));db['MailQueueReport']=db[_0x8509('0x4')]['import'](_0x8509('0x46'));db['Dashboard']=db[_0x8509('0x4')]['import'](_0x8509('0x47'));db[_0x8509('0x48')]=db[_0x8509('0x4')]['import'](_0x8509('0x49'));db[_0x8509('0x4a')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/faxAccount/faxAccount.model');db[_0x8509('0x4b')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x4c'));db[_0x8509('0x4d')]=db[_0x8509('0x4')]['import'](_0x8509('0x4e'));db['FaxMessage']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/faxMessage/faxMessage.model');db[_0x8509('0x4f')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x50'));db[_0x8509('0x51')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x52'));db['SmsAccount']=db['sequelize'][_0x8509('0x13')]('../api/smsAccount/smsAccount.model');db[_0x8509('0x53')]=db['sequelize'][_0x8509('0x13')]('../api/smsApplication/smsApplication.model');db[_0x8509('0x54')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x55'));db[_0x8509('0x56')]=db[_0x8509('0x4')]['import']('../api/smsMessage/smsMessage.model');db[_0x8509('0x57')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x58'));db[_0x8509('0x59')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x5a'));db[_0x8509('0x5b')]=db[_0x8509('0x4')]['import'](_0x8509('0x5c'));db[_0x8509('0x5d')]=db[_0x8509('0x4')]['import'](_0x8509('0x5e'));db[_0x8509('0x5f')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x60'));db[_0x8509('0x61')]=db[_0x8509('0x4')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0x8509('0x62')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x63'));db[_0x8509('0x64')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x65'));db[_0x8509('0x66')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x8509('0x4')]['import'](_0x8509('0x67'));db['ChatMessage']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x68'));db['ChatOfflineMessage']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x69'));db[_0x8509('0x6a')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x6b'));db[_0x8509('0x6c')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x6d'));db[_0x8509('0x6e')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x6f'));db['CmContact']=db[_0x8509('0x4')]['import'](_0x8509('0x70'));db[_0x8509('0x71')]=db[_0x8509('0x4')]['import'](_0x8509('0x72'));db[_0x8509('0x73')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x74'));db[_0x8509('0x75')]=db[_0x8509('0x4')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x8509('0x76')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x77'));db[_0x8509('0x78')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x79'));db[_0x8509('0x7a')]=db['sequelize'][_0x8509('0x13')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x7b'));db[_0x8509('0x7c')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/automation/automation.model');db['CannedAnswer']=db['sequelize'][_0x8509('0x13')](_0x8509('0x7d'));db[_0x8509('0x7e')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/disposition/disposition.model');db[_0x8509('0x7f')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/condition/condition.model');db[_0x8509('0x80')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x81'));db['Pause']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/pause/pause.model');db[_0x8509('0x82')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x83'));db[_0x8509('0x84')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x85'));db['Schedule']=db[_0x8509('0x4')]['import'](_0x8509('0x86'));db[_0x8509('0x87')]=db['sequelize']['import'](_0x8509('0x88'));db['Tag']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/tag/tag.model');db[_0x8509('0x89')]=db[_0x8509('0x4')]['import'](_0x8509('0x8a'));db[_0x8509('0x8b')]=db[_0x8509('0x4')]['import'](_0x8509('0x8c'));db['CmHopperAdditionalPhone']=db['sequelize'][_0x8509('0x13')](_0x8509('0x8d'));db[_0x8509('0x8e')]=db[_0x8509('0x4')]['import'](_0x8509('0x8f'));db['Trigger']=db['sequelize'][_0x8509('0x13')]('../api/trigger/trigger.model');db[_0x8509('0x90')]=db['sequelize'][_0x8509('0x13')]('../api/variable/variable.model');db['Integration']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x91'));db[_0x8509('0x92')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x93'));db['AnalyticCustomReport']=db[_0x8509('0x4')]['import'](_0x8509('0x94'));db[_0x8509('0x95')]=db[_0x8509('0x4')]['import'](_0x8509('0x96'));db[_0x8509('0x97')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x98'));db[_0x8509('0x99')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x9a'));db[_0x8509('0x9b')]=db['sequelize']['import'](_0x8509('0x9c'));db[_0x8509('0x9d')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x8509('0x9e')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x9f'));db[_0x8509('0xa0')]=db[_0x8509('0x4')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db['sequelize']['import'](_0x8509('0xa1'));db['SugarcrmAccount']=db[_0x8509('0x4')]['import'](_0x8509('0xa2'));db[_0x8509('0xa3')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x8509('0xa4')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xa5'));db[_0x8509('0xa6')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x8509('0x4')]['import'](_0x8509('0xa7'));db[_0x8509('0xa8')]=db[_0x8509('0x4')]['import'](_0x8509('0xa9'));db[_0x8509('0xaa')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xab'));db[_0x8509('0xac')]=db[_0x8509('0x4')]['import'](_0x8509('0xad'));db[_0x8509('0xae')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xaf'));db[_0x8509('0xb0')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xb1'));db['ZendeskConfiguration']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xb2'));db['ZendeskField']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xb3'));db[_0x8509('0xb4')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xb5'));db[_0x8509('0xb6')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xb7'));db[_0x8509('0xb8')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xb9'));db['VtigerConfiguration']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xba'));db[_0x8509('0xbb')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xbc'));db['ServicenowConfiguration']=db['sequelize'][_0x8509('0x13')](_0x8509('0xbd'));db[_0x8509('0xbe')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xbf'));db[_0x8509('0xc0')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xc1'));db[_0x8509('0xc2')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xc3'));db[_0x8509('0xc4')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xc5'));db[_0x8509('0xc6')]=db[_0x8509('0x4')]['import'](_0x8509('0xc7'));db[_0x8509('0xc8')]=db[_0x8509('0x4')]['import'](_0x8509('0xc9'));db[_0x8509('0xca')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xcb'));db[_0x8509('0xcc')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x91'));db[_0x8509('0xcd')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xce'));db['ChatQueueReport']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xcf'));db[_0x8509('0xd0')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x8509('0xd1')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xd2'));db[_0x8509('0xd3')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xd4'));db['JscriptySessionReport']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x8509('0xd5')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xd6'));db[_0x8509('0xd7')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xd8'));db[_0x8509('0xd9')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xda'));db['JscriptyProject']=db['sequelize'][_0x8509('0x13')](_0x8509('0xdb'));db[_0x8509('0xdc')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xdd'));db['SquareOdbc']=db['sequelize'][_0x8509('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x8509('0xde')]=db[_0x8509('0x4')]['import'](_0x8509('0xdf'));db[_0x8509('0xe0')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xe1'));db[_0x8509('0xe2')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xe3'));db[_0x8509('0xe4')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xe5'));db['License']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xe6'));db['Campaign']=db['sequelize'][_0x8509('0x13')](_0x8509('0xe7'));db[_0x8509('0xe8')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xe9'));db[_0x8509('0xea')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xeb'));db[_0x8509('0xec')]=db[_0x8509('0x4')]['import'](_0x8509('0xed'));db['MailTransferReport']=db['sequelize']['import'](_0x8509('0xee'));db[_0x8509('0xef')]=db[_0x8509('0x4')]['import'](_0x8509('0xf0'));db[_0x8509('0xf1')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xf2'));db[_0x8509('0xf3')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xf4'));db[_0x8509('0xf5')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xf6'));db[_0x8509('0xf7')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xf8'));db[_0x8509('0xf9')]=db[_0x8509('0x4')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x8509('0xfa')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/userProfile/userProfile.model');db[_0x8509('0xfb')]=db[_0x8509('0x4')]['import']('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db['sequelize']['import']('../api/userProfileResource/userProfileResource.model');db[_0x8509('0xfc')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xfd'));db['WhatsappAccount']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xfe'));db[_0x8509('0xff')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db['sequelize']['import'](_0x8509('0x100'));db[_0x8509('0x101')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x8509('0x102')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x103'));db[_0x8509('0x104')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x105'));db[_0x8509('0x106')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x107'));db['CloudProvider']=db['sequelize'][_0x8509('0x13')](_0x8509('0x108'));db['TeamVoiceQueue']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x109'));db[_0x8509('0x10a')]=db[_0x8509('0x4')]['import'](_0x8509('0x10b'));db[_0x8509('0x10c')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x8509('0x10d')]=db['sequelize']['import'](_0x8509('0x10e'));db[_0x8509('0x10f')]=db[_0x8509('0x4')]['import'](_0x8509('0x110'));db['User'][_0x8509('0x111')](db['VoiceMail'],{'as':_0x8509('0x112'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x111')](db[_0x8509('0x10d')],{'as':_0x8509('0x115'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x1c')],{'as':_0x8509('0x117'),'foreignKey':'UserId'});db[_0x8509('0x12')][_0x8509('0x116')](db['UserVoiceQueueRt'],{'as':_0x8509('0x118'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x17')],{'as':_0x8509('0x119'),'onDelete':_0x8509('0x113'),'hooks':!![]});db['User']['hasMany'](db[_0x8509('0x75')],{'as':_0x8509('0x11a'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x116')](db['CmHopperHistory'],{'as':_0x8509('0x11b'),'foreignKey':'UserId'});db[_0x8509('0x12')][_0x8509('0x116')](db['ReportAgentPreview'],{'as':_0x8509('0x78'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x5d')],{'as':'OpenchannelInteractions','foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x11c')],{'as':'ChatInteractions','foreignKey':_0x8509('0x114')});db[_0x8509('0x12')]['hasMany'](db[_0x8509('0x54')],{'as':_0x8509('0x11d'),'foreignKey':'UserId'});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x4d')],{'as':_0x8509('0x11e'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')]['hasMany'](db[_0x8509('0x41')],{'as':_0x8509('0x11f'),'foreignKey':_0x8509('0x114')});db['User'][_0x8509('0x116')](db[_0x8509('0x120')],{'as':_0x8509('0x121'),'foreignKey':_0x8509('0x114')});db['User']['hasMany'](db[_0x8509('0xfc')],{'as':_0x8509('0x122'),'foreignKey':'SenderId'});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x71')],{'as':_0x8509('0x123'),'foreignKey':_0x8509('0x114'),'onDelete':_0x8509('0x124')});db[_0x8509('0x12')][_0x8509('0x125')](db[_0x8509('0xfa')],{'as':'UserProfile','foreignKey':_0x8509('0x126')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x6c')],{'as':_0x8509('0x128'),'through':_0x8509('0x129')});db['User'][_0x8509('0x127')](db[_0x8509('0x12a')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x8509('0x12')][_0x8509('0x127')](db['CmList'],{'as':_0x8509('0x12b'),'through':_0x8509('0x12c')});db['User'][_0x8509('0x127')](db[_0x8509('0xe4')],{'through':_0x8509('0x12d')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x41')],{'as':_0x8509('0x11f'),'through':_0x8509('0x12e')});db[_0x8509('0x12')]['belongsToMany'](db['ChatInteraction'],{'as':_0x8509('0x12f'),'through':_0x8509('0x130')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x4d')],{'as':_0x8509('0x11e'),'through':_0x8509('0x131')});db[_0x8509('0x12')]['belongsToMany'](db[_0x8509('0x54')],{'as':'SmsInteractions','through':_0x8509('0x132')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x5d')],{'as':_0x8509('0x133'),'through':_0x8509('0x134')});db['User'][_0x8509('0x127')](db[_0x8509('0x120')],{'as':_0x8509('0x121'),'through':_0x8509('0x135')});db['User'][_0x8509('0x127')](db['VoiceQueue'],{'as':_0x8509('0x136'),'through':'UserVoiceQueue','required':![]});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0xf9')],{'as':_0x8509('0x137'),'through':_0x8509('0x10c'),'required':![]});db[_0x8509('0x12')]['belongsToMany'](db[_0x8509('0x3e')],{'as':_0x8509('0x138'),'through':_0x8509('0x2f'),'required':![]});db['User']['belongsToMany'](db[_0x8509('0x6a')],{'as':_0x8509('0x139'),'through':_0x8509('0x2d'),'required':![],'hooks':!![]});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x4f')],{'as':_0x8509('0x13a'),'through':'UserFaxQueue','required':![]});db['User'][_0x8509('0x127')](db[_0x8509('0x57')],{'as':_0x8509('0x13b'),'through':_0x8509('0x13c'),'required':![]});db['User']['belongsToMany'](db[_0x8509('0x61')],{'as':_0x8509('0x13d'),'through':'UserOpenchannelQueue','required':![]});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x106')],{'as':'WhatsappQueues','through':_0x8509('0x36'),'required':![]});db[_0x8509('0x12')]['belongsToMany'](db['CmList'],{'through':_0x8509('0x12c')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x62')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x4a')],{'as':_0x8509('0x13e'),'through':_0x8509('0x13f')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x3c')],{'as':_0x8509('0x140'),'through':'user_has_mail_accounts'});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x59')],{'as':_0x8509('0x141'),'through':'user_has_openchannel_accounts'});db[_0x8509('0x12')][_0x8509('0x127')](db['SmsAccount'],{'as':_0x8509('0x142'),'through':_0x8509('0x143')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x144')],{'as':_0x8509('0x145'),'through':'user_has_whatsapp_accounts'});db[_0x8509('0x146')]['hasMany'](db[_0x8509('0x17')],{'as':_0x8509('0x147'),'onDelete':_0x8509('0x113'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0x8509('0x116')](db[_0x8509('0x17')],{'onDelete':'cascade'});db['VoiceExtension']['hasMany'](db['VoiceExtension'],{'as':_0x8509('0x148'),'onDelete':_0x8509('0x113')});db[_0x8509('0x149')][_0x8509('0x127')](db['Sound'],{'as':'Sounds','through':_0x8509('0x14a')});db[_0x8509('0x1a')][_0x8509('0x116')](db[_0x8509('0x2a')],{'as':_0x8509('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x8509('0x1a')][_0x8509('0x116')](db[_0x8509('0x71')],{'as':_0x8509('0x123'),'foreignKey':'VoiceQueueId'});db[_0x8509('0x1a')][_0x8509('0x116')](db['CmHopperFinal'],{'as':_0x8509('0x11a'),'foreignKey':'VoiceQueueId'});db[_0x8509('0x1a')][_0x8509('0x116')](db['CmHopperHistory'],{'as':_0x8509('0x14c'),'foreignKey':_0x8509('0x14d')});db[_0x8509('0x1a')][_0x8509('0x116')](db[_0x8509('0x78')],{'as':_0x8509('0x78'),'foreignKey':'VoiceQueueId'});db[_0x8509('0x1a')]['hasMany'](db[_0x8509('0x73')],{'as':_0x8509('0x14e'),'foreignKey':_0x8509('0x14d')});db[_0x8509('0x1a')][_0x8509('0x116')](db[_0x8509('0x14f')],{'as':_0x8509('0x150'),'foreignKey':_0x8509('0x14d')});db[_0x8509('0x1a')]['belongsTo'](db[_0x8509('0x29')],{'as':_0x8509('0x29'),'foreignKey':_0x8509('0x151')});db['VoiceQueue'][_0x8509('0x125')](db[_0x8509('0x29')],{'as':_0x8509('0x152'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x8509('0x125')](db[_0x8509('0x80')],{'as':_0x8509('0x80'),'foreignKey':_0x8509('0x153')});db[_0x8509('0x1a')]['belongsTo'](db['Pause'],{'as':_0x8509('0x154'),'foreignKey':_0x8509('0x155')});db[_0x8509('0x1a')][_0x8509('0x127')](db[_0x8509('0xf7')],{'as':'Lists','through':_0x8509('0x156')});db[_0x8509('0x1a')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x2c')});db[_0x8509('0x1a')][_0x8509('0x127')](db[_0x8509('0xe4')],{'as':_0x8509('0x158'),'through':'TeamVoiceQueue'});db[_0x8509('0x1a')][_0x8509('0x127')](db[_0x8509('0xf7')],{'as':_0x8509('0x159'),'through':'voice_queues_has_cm_blacklists'});db[_0x8509('0x1c')][_0x8509('0x125')](db[_0x8509('0x12')],{'as':'User','foreignKey':_0x8509('0x114')});db[_0x8509('0x15a')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x12'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x112')][_0x8509('0x116')](db['VoiceMailMessage'],{'as':_0x8509('0x15b'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x15c'),'sourceKey':_0x8509('0x15d')});db[_0x8509('0x15e')][_0x8509('0x125')](db[_0x8509('0x112')],{'foreignKey':_0x8509('0x15c'),'targetKey':_0x8509('0x15d')});db['VoiceCallReport'][_0x8509('0x116')](db[_0x8509('0x25')],{'as':_0x8509('0x15f'),'foreignKey':_0x8509('0x160'),'constraints':![]});db[_0x8509('0x20')]['hasMany'](db[_0x8509('0x161')],{'as':_0x8509('0x162'),'foreignKey':_0x8509('0x160'),'constraints':![]});db[_0x8509('0x20')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x12'),'foreignKey':'UserId'});db[_0x8509('0x20')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db[_0x8509('0x38')][_0x8509('0x125')](db[_0x8509('0x3c')],{'as':'MailAccount','foreignKey':_0x8509('0x165')});db[_0x8509('0x38')]['belongsTo'](db[_0x8509('0x166')],{'as':_0x8509('0x166'),'foreignKey':_0x8509('0x167'),'onDelete':_0x8509('0x168')});db[_0x8509('0x3a')]['belongsTo'](db[_0x8509('0x3c')],{'as':_0x8509('0x3c'),'foreignKey':_0x8509('0x165')});db[_0x8509('0x3a')][_0x8509('0x125')](db[_0x8509('0x166')],{'as':'CloudProvider','foreignKey':_0x8509('0x167'),'onDelete':_0x8509('0x168')});db['MailAccount'][_0x8509('0x111')](db[_0x8509('0x38')],{'as':_0x8509('0x169'),'onDelete':_0x8509('0x113')});db['MailAccount'][_0x8509('0x111')](db[_0x8509('0x3a')],{'as':_0x8509('0x16a'),'onDelete':_0x8509('0x113')});db[_0x8509('0x3c')][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':'MailAccountId','onDelete':_0x8509('0x113')});db[_0x8509('0x3c')][_0x8509('0x116')](db['CannedAnswer'],{'as':_0x8509('0x16c'),'foreignKey':'MailAccountId'});db[_0x8509('0x3c')][_0x8509('0x116')](db[_0x8509('0x16d')],{'as':'Messages','foreignKey':_0x8509('0x165')});db[_0x8509('0x3c')]['hasMany'](db['MailInteraction'],{'as':_0x8509('0x16e')});db[_0x8509('0x3c')][_0x8509('0x116')](db[_0x8509('0x44')],{'as':_0x8509('0x148'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x8509('0x3c')][_0x8509('0x125')](db['CmList'],{'as':'List','foreignKey':_0x8509('0x16f')});db['MailAccount'][_0x8509('0x125')](db['Template'],{'as':_0x8509('0x8e'),'foreignKey':'TemplateId'});db['MailAccount']['belongsTo'](db['Pause'],{'as':_0x8509('0x154'),'foreignKey':_0x8509('0x155')});db[_0x8509('0x3c')]['belongsToMany'](db['User'],{'as':_0x8509('0x157'),'through':_0x8509('0x170')});db[_0x8509('0x3e')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':'UserMailQueue'});db[_0x8509('0x3e')][_0x8509('0x127')](db[_0x8509('0xe4')],{'through':_0x8509('0x171'),'as':_0x8509('0x158')});db['MailInteraction']['hasMany'](db[_0x8509('0x16d')],{'as':_0x8509('0x15b'),'onDelete':_0x8509('0x113'),'foreignKey':'MailInteractionId'});db[_0x8509('0x41')][_0x8509('0x125')](db[_0x8509('0x3c')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x165')});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db['MailInteraction'][_0x8509('0x125')](db[_0x8509('0x12')],{'as':_0x8509('0x173'),'foreignKey':'UserId'});db[_0x8509('0x41')]['belongsToMany'](db[_0x8509('0x174')],{'through':_0x8509('0x175'),'as':_0x8509('0x176')});db[_0x8509('0x41')]['belongsToMany'](db['Tag'],{'through':_0x8509('0x175'),'as':_0x8509('0x177')});db[_0x8509('0x41')][_0x8509('0x127')](db['User'],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0x8509('0x178')});db['MailMessage'][_0x8509('0x116')](db['Attachment'],{'as':_0x8509('0x179'),'onDelete':_0x8509('0x113')});db['MailMessage'][_0x8509('0x125')](db['User'],{'as':'User'});db[_0x8509('0x16d')]['belongsTo'](db[_0x8509('0x12a')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x163')});db[_0x8509('0x16d')]['belongsTo'](db[_0x8509('0x41')],{'as':_0x8509('0x17a'),'foreignKey':_0x8509('0x178')});db[_0x8509('0x16d')][_0x8509('0x125')](db[_0x8509('0x3c')],{'as':'Account','foreignKey':_0x8509('0x165')});db[_0x8509('0x16d')]['belongsTo'](db[_0x8509('0x62')],{'as':_0x8509('0x62'),'foreignKey':_0x8509('0x17b')});db[_0x8509('0x16d')][_0x8509('0x125')](db['ChatOfflineMessage'],{'as':_0x8509('0x17c'),'foreignKey':_0x8509('0x17d')});db[_0x8509('0x44')]['belongsTo'](db[_0x8509('0x12')],{'onDelete':_0x8509('0x168')});db[_0x8509('0x44')][_0x8509('0x125')](db[_0x8509('0x3e')],{'onDelete':_0x8509('0x168')});db[_0x8509('0x44')][_0x8509('0x125')](db[_0x8509('0x3c')],{'onDelete':_0x8509('0x168')});db['MailApplication'][_0x8509('0x125')](db[_0x8509('0x80')],{'onDelete':'restrict','foreignKey':_0x8509('0x153')});db['MailApplication'][_0x8509('0x125')](db[_0x8509('0x174')],{'onDelete':'restrict','foreignKey':_0x8509('0x17e')});db[_0x8509('0x17f')][_0x8509('0x125')](db[_0x8509('0x3c')],{});db[_0x8509('0x17f')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f')});db['MailQueueReport'][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':'Contact','foreignKey':'ContactId'});db['MailQueueReport'][_0x8509('0x125')](db['MailInteraction'],{});db[_0x8509('0x17f')][_0x8509('0x125')](db['MailMessage'],{});db[_0x8509('0x17f')][_0x8509('0x125')](db['User'],{});db[_0x8509('0x17f')]['belongsTo'](db[_0x8509('0x3e')],{});db[_0x8509('0x181')][_0x8509('0x116')](db[_0x8509('0x48')],{'as':_0x8509('0x182'),'onDelete':_0x8509('0x113')});db['FaxAccount'][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':_0x8509('0x183'),'onDelete':'cascade'});db[_0x8509('0x4a')][_0x8509('0x116')](db[_0x8509('0x184')],{'as':_0x8509('0x16c'),'foreignKey':_0x8509('0x183')});db[_0x8509('0x4a')][_0x8509('0x116')](db[_0x8509('0x4d')],{'as':_0x8509('0x16e')});db[_0x8509('0x4a')][_0x8509('0x116')](db[_0x8509('0x4b')],{'as':_0x8509('0x148'),'foreignKey':_0x8509('0x183'),'onDelete':_0x8509('0x113')});db['FaxAccount'][_0x8509('0x116')](db['VoiceExtension'],{'as':_0x8509('0x185'),'onDelete':_0x8509('0x113')});db[_0x8509('0x4a')][_0x8509('0x116')](db[_0x8509('0x186')],{'as':_0x8509('0x15b')});db[_0x8509('0x4a')][_0x8509('0x125')](db['Trunk'],{'as':_0x8509('0x29')});db[_0x8509('0x4a')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0x8509('0x4a')][_0x8509('0x125')](db['Pause'],{'as':_0x8509('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8509('0x4a')][_0x8509('0x127')](db['User'],{'as':'Agents','through':_0x8509('0x13f')});db[_0x8509('0x4b')][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':_0x8509('0x168')});db['FaxApplication'][_0x8509('0x125')](db[_0x8509('0x4f')],{'onDelete':_0x8509('0x168')});db['FaxApplication'][_0x8509('0x125')](db['FaxAccount'],{'onDelete':_0x8509('0x168')});db[_0x8509('0x4b')][_0x8509('0x125')](db['Tag'],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x17e')});db[_0x8509('0x4d')]['hasMany'](db[_0x8509('0x186')],{'as':_0x8509('0x15b'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x187')});db['FaxInteraction'][_0x8509('0x125')](db[_0x8509('0x4a')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x183')});db[_0x8509('0x4d')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':'Contact','foreignKey':_0x8509('0x164')});db[_0x8509('0x4d')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x173'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x4d')][_0x8509('0x127')](db[_0x8509('0x174')],{'through':'fax_interaction_has_tags','as':_0x8509('0x176')});db[_0x8509('0x4d')]['belongsToMany'](db[_0x8509('0x174')],{'through':'fax_interaction_has_tags','as':_0x8509('0x177')});db[_0x8509('0x4d')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'through':'user_has_fax_interactions','foreignKey':_0x8509('0x187')});db['FaxMessage'][_0x8509('0x125')](db['User'],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x12')});db[_0x8509('0x186')][_0x8509('0x125')](db[_0x8509('0x4d')],{'as':_0x8509('0x17a'),'foreignKey':_0x8509('0x187')});db[_0x8509('0x186')][_0x8509('0x125')](db[_0x8509('0x12a')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x163')});db[_0x8509('0x186')][_0x8509('0x125')](db[_0x8509('0xea')],{'as':_0x8509('0xea'),'foreignKey':_0x8509('0x189')});db['FaxMessage'][_0x8509('0x125')](db[_0x8509('0x4a')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x183')});db['FaxQueue'][_0x8509('0x127')](db[_0x8509('0x12')],{'as':'Agents','through':_0x8509('0x31')});db[_0x8509('0x4f')][_0x8509('0x127')](db[_0x8509('0xe4')],{'through':_0x8509('0x18a'),'as':_0x8509('0x158')});db[_0x8509('0x51')][_0x8509('0x125')](db['FaxAccount'],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':_0x8509('0x180'),'foreignKey':'ListId'});db[_0x8509('0x51')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8509('0x51')]['belongsTo'](db[_0x8509('0x4d')],{});db[_0x8509('0x51')][_0x8509('0x125')](db[_0x8509('0x186')],{});db[_0x8509('0x51')][_0x8509('0x125')](db[_0x8509('0x12')],{});db[_0x8509('0x51')][_0x8509('0x125')](db['FaxQueue'],{});db[_0x8509('0x18b')]['hasMany'](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':_0x8509('0x18c'),'onDelete':_0x8509('0x113')});db[_0x8509('0x18b')][_0x8509('0x116')](db[_0x8509('0x184')],{'as':_0x8509('0x16c'),'foreignKey':_0x8509('0x18c')});db[_0x8509('0x18b')]['hasMany'](db['SmsMessage'],{'as':_0x8509('0x15b'),'foreignKey':_0x8509('0x18c')});db['SmsAccount'][_0x8509('0x116')](db[_0x8509('0x54')],{'as':'Interactions'});db['SmsAccount'][_0x8509('0x116')](db['SmsApplication'],{'as':_0x8509('0x148'),'foreignKey':_0x8509('0x18c'),'onDelete':_0x8509('0x113')});db['SmsAccount']['belongsTo'](db[_0x8509('0xf7')],{'as':'List','foreignKey':_0x8509('0x16f')});db[_0x8509('0x18b')][_0x8509('0x125')](db[_0x8509('0x18d')],{'as':'mandatoryDispositionPause','foreignKey':_0x8509('0x155')});db['SmsAccount'][_0x8509('0x127')](db[_0x8509('0x12')],{'as':'Agents','through':_0x8509('0x143')});db[_0x8509('0x53')]['belongsTo'](db[_0x8509('0x12')],{'onDelete':_0x8509('0x168')});db[_0x8509('0x53')][_0x8509('0x125')](db['SmsQueue'],{'onDelete':_0x8509('0x168')});db[_0x8509('0x53')][_0x8509('0x125')](db['SmsAccount'],{'onDelete':_0x8509('0x168')});db[_0x8509('0x53')][_0x8509('0x125')](db[_0x8509('0x80')],{'onDelete':_0x8509('0x168'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x8509('0x125')](db[_0x8509('0x174')],{'onDelete':_0x8509('0x168'),'foreignKey':'TagId'});db[_0x8509('0x54')][_0x8509('0x116')](db[_0x8509('0x56')],{'as':_0x8509('0x15b'),'onDelete':'cascade','foreignKey':_0x8509('0x18e')});db[_0x8509('0x54')][_0x8509('0x125')](db[_0x8509('0x18b')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x18c')});db['SmsInteraction'][_0x8509('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x8509('0x164')});db[_0x8509('0x54')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x8509('0x114')});db[_0x8509('0x54')][_0x8509('0x127')](db[_0x8509('0x174')],{'through':_0x8509('0x18f'),'as':_0x8509('0x176')});db[_0x8509('0x54')][_0x8509('0x127')](db[_0x8509('0x174')],{'through':'sms_interaction_has_tags','as':_0x8509('0x177')});db[_0x8509('0x54')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'through':_0x8509('0x132'),'foreignKey':_0x8509('0x18e')});db[_0x8509('0x56')][_0x8509('0x125')](db['User'],{'as':_0x8509('0x12')});db['SmsMessage'][_0x8509('0x125')](db[_0x8509('0x12a')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x163')});db['SmsMessage'][_0x8509('0x125')](db[_0x8509('0x54')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x17a'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x8509('0x125')](db[_0x8509('0x18b')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x18c')});db[_0x8509('0x57')][_0x8509('0x127')](db['User'],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x8509('0x190')});db['SmsQueue'][_0x8509('0x127')](db['Team'],{'through':'team_has_sms_queues','as':_0x8509('0x158')});db['OpenchannelAccount'][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':'OpenchannelAccountId','onDelete':_0x8509('0x113')});db[_0x8509('0x59')][_0x8509('0x116')](db[_0x8509('0x184')],{'as':_0x8509('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0x8509('0x59')][_0x8509('0x116')](db[_0x8509('0x5d')],{'as':_0x8509('0x16e'),'foreignKey':_0x8509('0x191')});db['OpenchannelAccount'][_0x8509('0x116')](db[_0x8509('0x5f')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x8509('0x59')][_0x8509('0x116')](db['OpenchannelApplication'],{'as':_0x8509('0x148'),'foreignKey':_0x8509('0x191'),'onDelete':_0x8509('0x113')});db[_0x8509('0x59')][_0x8509('0x125')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x8509('0x59')][_0x8509('0x125')](db[_0x8509('0x18d')],{'as':_0x8509('0x154'),'foreignKey':_0x8509('0x155')});db[_0x8509('0x59')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x192')});db['OpenchannelApplication'][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':_0x8509('0x168')});db[_0x8509('0x5b')][_0x8509('0x125')](db[_0x8509('0x61')],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x193')});db['OpenchannelApplication'][_0x8509('0x125')](db['OpenchannelAccount'],{'onDelete':_0x8509('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x8509('0x5b')][_0x8509('0x125')](db[_0x8509('0x80')],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x153')});db[_0x8509('0x5b')][_0x8509('0x125')](db[_0x8509('0x174')],{'onDelete':'restrict','foreignKey':_0x8509('0x17e')});db[_0x8509('0x5d')][_0x8509('0x116')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x8509('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0x8509('0x5d')][_0x8509('0x125')](db[_0x8509('0x59')],{'as':_0x8509('0x172'),'foreignKey':'OpenchannelAccountId'});db[_0x8509('0x5d')]['belongsTo'](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db['OpenchannelInteraction'][_0x8509('0x125')](db[_0x8509('0x12')],{'as':_0x8509('0x173'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x5d')][_0x8509('0x127')](db[_0x8509('0x174')],{'through':_0x8509('0x194'),'as':_0x8509('0x176')});db['OpenchannelInteraction']['belongsToMany'](db[_0x8509('0x174')],{'through':_0x8509('0x194'),'as':'ThroughTags'});db[_0x8509('0x5d')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'through':_0x8509('0x134'),'foreignKey':'OpenchannelInteractionId'});db[_0x8509('0x5f')][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':'cascade','as':_0x8509('0x12')});db[_0x8509('0x5f')][_0x8509('0x125')](db['CmContact'],{'onDelete':'cascade','as':_0x8509('0x163')});db[_0x8509('0x5f')][_0x8509('0x125')](db[_0x8509('0x5d')],{'onDelete':_0x8509('0x113'),'as':'Interaction','foreignKey':_0x8509('0x195')});db[_0x8509('0x5f')][_0x8509('0x125')](db[_0x8509('0xea')],{'as':_0x8509('0xea'),'foreignKey':_0x8509('0x189')});db[_0x8509('0x5f')][_0x8509('0x125')](db[_0x8509('0x59')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x191')});db[_0x8509('0x61')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x34'),'foreignKey':_0x8509('0x193')});db['OpenchannelQueue']['belongsToMany'](db[_0x8509('0xe4')],{'through':_0x8509('0x196'),'as':_0x8509('0x158')});db['ChatWebsite'][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':_0x8509('0x17b'),'onDelete':_0x8509('0x113')});db[_0x8509('0x62')][_0x8509('0x116')](db[_0x8509('0x184')],{'as':_0x8509('0x16c'),'foreignKey':'ChatWebsiteId'});db[_0x8509('0x62')]['hasMany'](db[_0x8509('0x197')],{'as':_0x8509('0x198')});db[_0x8509('0x62')]['hasMany'](db[_0x8509('0x11c')],{'as':_0x8509('0x16e')});db[_0x8509('0x62')][_0x8509('0x116')](db[_0x8509('0x66')],{'as':_0x8509('0x148'),'foreignKey':_0x8509('0x17b'),'onDelete':'cascade'});db[_0x8509('0x62')][_0x8509('0x116')](db['ChatMessage'],{'as':_0x8509('0x15b')});db[_0x8509('0x62')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':'List','foreignKey':'ListId'});db['ChatWebsite'][_0x8509('0x125')](db[_0x8509('0x80')],{'as':_0x8509('0x80'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0x8509('0x125')](db[_0x8509('0x3c')],{'as':_0x8509('0x3c'),'foreignKey':_0x8509('0x165')});db[_0x8509('0x62')]['belongsTo'](db[_0x8509('0x18d')],{'as':_0x8509('0x154'),'foreignKey':_0x8509('0x155')});db[_0x8509('0x62')][_0x8509('0x127')](db['User'],{'as':_0x8509('0x157'),'through':_0x8509('0x199')});db[_0x8509('0x64')][_0x8509('0x125')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x8509('0xf7')],{'as':'List','foreignKey':_0x8509('0x16f')});db[_0x8509('0x64')][_0x8509('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x8509('0x164')});db[_0x8509('0x64')][_0x8509('0x125')](db[_0x8509('0x5d')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelMessage'],{});db[_0x8509('0x64')]['belongsTo'](db[_0x8509('0x12')],{});db[_0x8509('0x64')][_0x8509('0x125')](db[_0x8509('0x61')],{});db[_0x8509('0x66')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x19a'),'foreignKey':_0x8509('0x114'),'onDelete':'restrict'});db[_0x8509('0x66')][_0x8509('0x125')](db[_0x8509('0x6a')],{'as':_0x8509('0x19b'),'foreignKey':_0x8509('0x19c'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0x8509('0x62')],{'as':_0x8509('0x19d'),'foreignKey':_0x8509('0x17b'),'onDelete':_0x8509('0x168')});db[_0x8509('0x66')]['belongsTo'](db[_0x8509('0x174')],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x17e')});db[_0x8509('0x11c')][_0x8509('0x116')](db[_0x8509('0x19e')],{'as':_0x8509('0x15b'),'onDelete':'cascade','foreignKey':_0x8509('0x19f')});db[_0x8509('0x11c')][_0x8509('0x125')](db[_0x8509('0x62')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x17b')});db[_0x8509('0x11c')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db[_0x8509('0x11c')][_0x8509('0x125')](db['User'],{'as':_0x8509('0x173'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x11c')][_0x8509('0x127')](db['Tag'],{'through':_0x8509('0x1a0'),'as':_0x8509('0x176')});db[_0x8509('0x11c')][_0x8509('0x127')](db[_0x8509('0x174')],{'through':_0x8509('0x1a0'),'as':_0x8509('0x177')});db['ChatInteraction'][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'through':_0x8509('0x130'),'foreignKey':_0x8509('0x19f')});db[_0x8509('0x19e')][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x12')});db[_0x8509('0x19e')]['belongsTo'](db[_0x8509('0x12a')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x163'),'foreignKey':'ContactId'});db[_0x8509('0x19e')][_0x8509('0x125')](db[_0x8509('0x11c')],{'onDelete':_0x8509('0x113'),'as':'Interaction','foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x8509('0x125')](db[_0x8509('0xea')],{'as':_0x8509('0xea'),'foreignKey':_0x8509('0x189')});db[_0x8509('0x19e')]['belongsTo'](db[_0x8509('0x62')],{'as':_0x8509('0x172'),'foreignKey':'ChatWebsiteId'});db[_0x8509('0x17c')][_0x8509('0x116')](db[_0x8509('0xea')],{'as':'Attachments','foreignKey':_0x8509('0x17d'),'onDelete':_0x8509('0x113'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x8509('0x113'),'as':'Contact','foreignKey':_0x8509('0x164')});db['ChatOfflineMessage'][_0x8509('0x125')](db[_0x8509('0x62')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x8509('0x6a')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x2d'),'hooks':!![]});db['ChatQueue'][_0x8509('0x127')](db['Team'],{'through':'team_has_chat_queues','as':_0x8509('0x158')});db[_0x8509('0x6c')][_0x8509('0x116')](db[_0x8509('0xd0')],{'as':'Messages','foreignKey':_0x8509('0x1a1'),'onDelete':'cascade'});db[_0x8509('0x6c')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x14b'),'through':'chat_group_has_users'});db[_0x8509('0x197')]['belongsTo'](db[_0x8509('0x62')],{'as':_0x8509('0x19d'),'foreignKey':_0x8509('0x17b')});db[_0x8509('0x6e')]['hasMany'](db['CmContact'],{'as':_0x8509('0x1a2'),'foreignKey':_0x8509('0x1a3')});db[_0x8509('0x12a')]['hasMany'](db[_0x8509('0x8b')],{'as':_0x8509('0x1a4'),'foreignKey':_0x8509('0x1a5')});db[_0x8509('0x12a')][_0x8509('0x116')](db[_0x8509('0x71')],{'as':_0x8509('0x123'),'foreignKey':'ContactId'});db['CmContact'][_0x8509('0x116')](db[_0x8509('0x75')],{'as':_0x8509('0x11a'),'foreignKey':_0x8509('0x164')});db[_0x8509('0x12a')][_0x8509('0x116')](db[_0x8509('0x76')],{'as':'HopperHistories','foreignKey':_0x8509('0x164')});db[_0x8509('0x12a')][_0x8509('0x116')](db[_0x8509('0x78')],{'as':_0x8509('0x78'),'foreignKey':_0x8509('0x164')});db['CmContact'][_0x8509('0x116')](db[_0x8509('0x14f')],{'as':'JscriptySessions','foreignKey':_0x8509('0x164')});db[_0x8509('0x12a')][_0x8509('0x116')](db['OpenchannelInteraction'],{'as':_0x8509('0x133'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x8509('0x12a')][_0x8509('0x116')](db['ChatInteraction'],{'as':_0x8509('0x12f'),'foreignKey':'ContactId','onDelete':_0x8509('0x168')});db[_0x8509('0x12a')]['hasMany'](db[_0x8509('0x54')],{'as':_0x8509('0x11d'),'foreignKey':_0x8509('0x164'),'onDelete':'restrict'});db[_0x8509('0x12a')]['hasMany'](db[_0x8509('0x4d')],{'as':_0x8509('0x11e'),'foreignKey':_0x8509('0x164'),'onDelete':_0x8509('0x168')});db['CmContact'][_0x8509('0x116')](db[_0x8509('0x41')],{'as':_0x8509('0x11f'),'foreignKey':_0x8509('0x164'),'onDelete':_0x8509('0x168')});db[_0x8509('0x12a')][_0x8509('0x125')](db[_0x8509('0x6e')],{'as':_0x8509('0x1a6'),'foreignKey':_0x8509('0x1a3')});db[_0x8509('0x12a')][_0x8509('0x125')](db['CmList'],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f'),'onDelete':'cascade'});db[_0x8509('0x12a')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'through':_0x8509('0x1a7')});db[_0x8509('0x12a')][_0x8509('0x127')](db[_0x8509('0x174')],{'as':_0x8509('0x176'),'through':_0x8509('0x1a8')});db[_0x8509('0x12a')]['belongsToMany'](db[_0x8509('0x174')],{'through':_0x8509('0x1a8'),'as':'ThroughTags'});db[_0x8509('0x71')][_0x8509('0x116')](db[_0x8509('0x1a9')],{'as':_0x8509('0x1aa'),'foreignKey':_0x8509('0x1ab')});db[_0x8509('0x71')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164'),'onDelete':_0x8509('0x113')});db[_0x8509('0x71')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f'),'onDelete':'cascade'});db[_0x8509('0x71')][_0x8509('0x125')](db[_0x8509('0x12')],{'as':'Agent','foreignKey':'UserId'});db[_0x8509('0x71')][_0x8509('0x125')](db[_0x8509('0x1a')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x8509('0x113')});db[_0x8509('0x71')][_0x8509('0x125')](db['Campaign'],{'as':'Campaign','foreignKey':_0x8509('0x1ac'),'onDelete':'cascade'});db[_0x8509('0x71')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x173'),'foreignKey':_0x8509('0x1ad')});db[_0x8509('0x73')]['belongsTo'](db[_0x8509('0x12a')],{'as':'Contact','foreignKey':_0x8509('0x164'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0x8509('0xf7')],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f'),'onDelete':_0x8509('0x113')});db[_0x8509('0x73')][_0x8509('0x125')](db['VoiceQueue'],{'as':_0x8509('0x19b'),'foreignKey':_0x8509('0x14d'),'onDelete':_0x8509('0x113')});db[_0x8509('0x73')][_0x8509('0x125')](db[_0x8509('0x1ae')],{'as':_0x8509('0x1ae'),'foreignKey':_0x8509('0x1ac'),'onDelete':_0x8509('0x113')});db[_0x8509('0x7c')]['hasMany'](db[_0x8509('0x7f')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x8509('0x1af'),'onDelete':_0x8509('0x113'),'hooks':!![]});db['Automation'][_0x8509('0x116')](db['Condition'],{'as':{'plural':_0x8509('0x1b0'),'singular':'OneAny'},'foreignKey':_0x8509('0x1b1'),'onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x7c')]['hasMany'](db[_0x8509('0x1b2')],{'as':_0x8509('0x1b3'),'foreignKey':_0x8509('0x1b4'),'onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x7e')][_0x8509('0x116')](db['Disposition'],{'as':_0x8509('0x16b'),'foreignKey':_0x8509('0x1b5'),'onDelete':_0x8509('0x113')});db[_0x8509('0x80')]['hasMany'](db[_0x8509('0x80')],{'as':_0x8509('0x1b6'),'foreignKey':_0x8509('0x153'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x8509('0x80')][_0x8509('0x116')](db[_0x8509('0x17')],{'as':_0x8509('0x119'),'foreignKey':_0x8509('0x153'),'onDelete':_0x8509('0x168')});db[_0x8509('0x80')][_0x8509('0x116')](db[_0x8509('0x44')],{'as':_0x8509('0x1b7'),'foreignKey':_0x8509('0x153')});db[_0x8509('0x80')][_0x8509('0x116')](db[_0x8509('0x66')],{'as':'ChatApplications','foreignKey':_0x8509('0x153')});db['Interval']['hasMany'](db[_0x8509('0x4b')],{'as':_0x8509('0x1b8'),'foreignKey':_0x8509('0x153')});db[_0x8509('0x80')]['hasMany'](db[_0x8509('0x53')],{'as':_0x8509('0x1b9'),'foreignKey':_0x8509('0x153')});db[_0x8509('0x1ba')][_0x8509('0x125')](db[_0x8509('0x3c')],{});db[_0x8509('0x1ba')][_0x8509('0x125')](db['AnalyticDefaultReport'],{'foreignKey':_0x8509('0x1bb')});db[_0x8509('0x1ba')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x8509('0x1bc')});db['Sound']['belongsToMany'](db[_0x8509('0x149')],{'as':_0x8509('0x1bd'),'through':_0x8509('0x14a'),'onDelete':'restrict'});db[_0x8509('0x174')]['belongsToMany'](db[_0x8509('0x12a')],{'through':'cm_contact_has_tags'});db[_0x8509('0x174')][_0x8509('0x127')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x8509('0x41')],{'through':_0x8509('0x175')});db['Tag'][_0x8509('0x127')](db['SmsInteraction'],{'through':_0x8509('0x18f')});db['Tag'][_0x8509('0x127')](db[_0x8509('0x4d')],{'through':'fax_interaction_has_tags'});db[_0x8509('0x174')][_0x8509('0x127')](db[_0x8509('0x5d')],{'through':'openchannel_interaction_has_tags'});db[_0x8509('0x174')]['belongsToMany'](db[_0x8509('0x120')],{'through':_0x8509('0x1be')});db['CmContactHasItem'][_0x8509('0x125')](db[_0x8509('0x89')],{'as':_0x8509('0x1bf'),'foreignKey':_0x8509('0x1c0')});db[_0x8509('0x1a9')][_0x8509('0x125')](db['CmHopper'],{'as':'Hopper','foreignKey':_0x8509('0x1ab')});db[_0x8509('0x8b')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':'CmContactId'});db[_0x8509('0x1c1')][_0x8509('0x116')](db[_0x8509('0x7f')],{'as':{'plural':_0x8509('0x1c2'),'singular':_0x8509('0x1c3')},'foreignKey':_0x8509('0x1c4'),'onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x1c1')][_0x8509('0x116')](db['Condition'],{'as':{'plural':_0x8509('0x1c5'),'singular':_0x8509('0x1c6')},'foreignKey':'TriggerAnyId','onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x1c1')][_0x8509('0x116')](db[_0x8509('0x1b2')],{'as':_0x8509('0x1b3'),'foreignKey':_0x8509('0x1c7'),'onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x1c8')][_0x8509('0x116')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1bc'),'hooks':!![]});db[_0x8509('0x95')][_0x8509('0x116')](db[_0x8509('0x9b')],{'as':'Fields','onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1bb')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8509('0x1c9')});db['AnalyticFieldReport']['belongsTo'](db[_0x8509('0x99')],{'foreignKey':_0x8509('0x1c9')});db[_0x8509('0x9e')][_0x8509('0x116')](db[_0x8509('0xa0')],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1cb')});db[_0x8509('0xa0')][_0x8509('0x116')](db[_0x8509('0x1cc')],{'as':_0x8509('0x1cd'),'onDelete':'cascade','foreignKey':_0x8509('0x1ce')});db[_0x8509('0xa0')][_0x8509('0x116')](db[_0x8509('0x1cc')],{'as':_0x8509('0x1cf'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xa0')][_0x8509('0x116')](db[_0x8509('0x1cc')],{'as':_0x8509('0x1d1'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xa0')]['belongsTo'](db[_0x8509('0x9e')],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db[_0x8509('0x1cc')][_0x8509('0x116')](db[_0x8509('0x1cc')],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0x1cc')][_0x8509('0x116')](db['SalesforceField'],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0x1cc')][_0x8509('0x116')](db[_0x8509('0x1cc')],{'as':_0x8509('0x1d5'),'foreignKey':_0x8509('0x1d2')});db['SalesforceField']['belongsTo'](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0x1d7')][_0x8509('0x116')](db[_0x8509('0xa3')],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1cb')});db['SugarcrmConfiguration'][_0x8509('0x116')](db[_0x8509('0xa4')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x8509('0x1ce')});db['SugarcrmConfiguration'][_0x8509('0x116')](db[_0x8509('0xa4')],{'as':_0x8509('0x1cf'),'onDelete':'cascade','foreignKey':_0x8509('0x1d0')});db[_0x8509('0xa3')]['hasMany'](db[_0x8509('0xa4')],{'as':_0x8509('0x1d1'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xa3')][_0x8509('0x125')](db[_0x8509('0x1d7')],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x8509('0x116')](db[_0x8509('0xa4')],{'as':'Subject','foreignKey':_0x8509('0x1ce')});db[_0x8509('0xa4')][_0x8509('0x116')](db[_0x8509('0xa4')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xa4')]['hasMany'](db[_0x8509('0xa4')],{'as':_0x8509('0x1d5'),'foreignKey':'FieldId'});db[_0x8509('0xa4')][_0x8509('0x125')](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0xa6')][_0x8509('0x116')](db[_0x8509('0x1d8')],{'as':_0x8509('0x1ca'),'onDelete':'cascade','foreignKey':_0x8509('0x1cb')});db[_0x8509('0x1d8')]['hasMany'](db[_0x8509('0xa8')],{'as':_0x8509('0x1cd'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1ce')});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':_0x8509('0x1cf'),'onDelete':'cascade','foreignKey':_0x8509('0x1d0')});db['DeskConfiguration'][_0x8509('0x116')](db[_0x8509('0xa8')],{'as':'Fields','onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d2')});db['DeskConfiguration'][_0x8509('0x125')](db[_0x8509('0xa6')],{'as':'Account','foreignKey':_0x8509('0x1cb')});db['DeskConfiguration'][_0x8509('0x127')](db[_0x8509('0x174')],{'through':'int_desk_configuration_has_tags'});db[_0x8509('0xa8')][_0x8509('0x116')](db[_0x8509('0xa8')],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0xa8')]['hasMany'](db[_0x8509('0xa8')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xa8')][_0x8509('0x116')](db[_0x8509('0xa8')],{'as':'Field','foreignKey':_0x8509('0x1d2')});db[_0x8509('0xa8')][_0x8509('0x125')](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0xaa')][_0x8509('0x116')](db[_0x8509('0xac')],{'as':_0x8509('0x1ca'),'onDelete':'cascade','foreignKey':_0x8509('0x1cb')});db[_0x8509('0xac')][_0x8509('0x116')](db[_0x8509('0xae')],{'as':_0x8509('0x1cd'),'onDelete':_0x8509('0x113'),'foreignKey':'SubjectId'});db[_0x8509('0xac')]['hasMany'](db['ZohoField'],{'as':_0x8509('0x1cf'),'onDelete':_0x8509('0x113'),'foreignKey':'DescriptionId'});db[_0x8509('0xac')][_0x8509('0x116')](db[_0x8509('0xae')],{'as':_0x8509('0x1d1'),'onDelete':'cascade','foreignKey':_0x8509('0x1d2')});db[_0x8509('0xac')][_0x8509('0x125')](db['ZohoAccount'],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db[_0x8509('0xae')][_0x8509('0x116')](db[_0x8509('0xae')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x8509('0xae')]['hasMany'](db[_0x8509('0xae')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xae')][_0x8509('0x116')](db[_0x8509('0xae')],{'as':_0x8509('0x1d5'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xae')]['belongsTo'](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':'VariableId'});db[_0x8509('0xb0')]['hasMany'](db[_0x8509('0x1d9')],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x8509('0x116')](db[_0x8509('0x1da')],{'as':_0x8509('0x1cd'),'foreignKey':_0x8509('0x1ce')});db['ZendeskConfiguration']['hasMany'](db[_0x8509('0x1da')],{'as':_0x8509('0x1cf'),'foreignKey':_0x8509('0x1d0')});db['ZendeskConfiguration'][_0x8509('0x116')](db['ZendeskField'],{'as':'Fields','foreignKey':_0x8509('0x1d2')});db[_0x8509('0x1d9')][_0x8509('0x125')](db[_0x8509('0xb0')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x1cb')});db[_0x8509('0x1d9')][_0x8509('0x127')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x8509('0x1da')][_0x8509('0x116')](db[_0x8509('0x1da')],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0x1da')][_0x8509('0x116')](db[_0x8509('0x1da')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0x1da')][_0x8509('0x116')](db[_0x8509('0x1da')],{'as':_0x8509('0x1d5'),'foreignKey':'FieldId'});db[_0x8509('0x1da')][_0x8509('0x125')](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0x1db')][_0x8509('0x116')](db[_0x8509('0xb4')],{'as':_0x8509('0x1ca'),'onDelete':'cascade','foreignKey':_0x8509('0x1cb')});db[_0x8509('0xb4')][_0x8509('0x116')](db[_0x8509('0xb6')],{'as':_0x8509('0x1cd'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x8509('0xb4')][_0x8509('0x116')](db[_0x8509('0xb6')],{'as':'Descriptions','onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d0')});db['FreshdeskConfiguration']['hasMany'](db[_0x8509('0xb6')],{'as':_0x8509('0x1d1'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xb4')][_0x8509('0x125')](db[_0x8509('0x1db')],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x8509('0x127')](db[_0x8509('0x174')],{'through':_0x8509('0x1dc')});db[_0x8509('0xb6')][_0x8509('0x116')](db[_0x8509('0xb6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x8509('0xb6')][_0x8509('0x116')](db[_0x8509('0xb6')],{'as':_0x8509('0x1d4'),'foreignKey':'DescriptionId'});db[_0x8509('0xb6')]['hasMany'](db[_0x8509('0xb6')],{'as':_0x8509('0x1d5'),'foreignKey':_0x8509('0x1d2')});db['FreshdeskField']['belongsTo'](db[_0x8509('0x90')],{'as':'Variable','foreignKey':'VariableId'});db['VtigerAccount'][_0x8509('0x116')](db[_0x8509('0x1dd')],{'as':_0x8509('0x1ca'),'onDelete':'cascade','foreignKey':_0x8509('0x1cb')});db[_0x8509('0x1dd')][_0x8509('0x116')](db['VtigerField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x8509('0x1dd')][_0x8509('0x116')](db['VtigerField'],{'as':_0x8509('0x1cf'),'foreignKey':'DescriptionId'});db[_0x8509('0x1dd')][_0x8509('0x116')](db['VtigerField'],{'as':'Fields','foreignKey':_0x8509('0x1d2')});db[_0x8509('0x1dd')]['belongsTo'](db['VtigerAccount'],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db[_0x8509('0x1de')]['hasMany'](db[_0x8509('0x1de')],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0x1de')]['hasMany'](db[_0x8509('0x1de')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0x1de')]['hasMany'](db[_0x8509('0x1de')],{'as':_0x8509('0x1d5'),'foreignKey':'FieldId'});db[_0x8509('0x1de')]['belongsTo'](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0xbb')][_0x8509('0x116')](db['ServicenowConfiguration'],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0x8509('0x116')](db[_0x8509('0xbe')],{'as':_0x8509('0x1cd'),'foreignKey':'SubjectId'});db['ServicenowConfiguration']['hasMany'](db[_0x8509('0xbe')],{'as':'Descriptions','foreignKey':_0x8509('0x1d0')});db[_0x8509('0x1df')]['hasMany'](db[_0x8509('0xbe')],{'as':_0x8509('0x1d1'),'foreignKey':_0x8509('0x1d2')});db['ServicenowConfiguration'][_0x8509('0x125')](db[_0x8509('0xbb')],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db[_0x8509('0xbe')][_0x8509('0x116')](db['ServicenowField'],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db['ServicenowField'][_0x8509('0x116')](db['ServicenowField'],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xbe')][_0x8509('0x116')](db[_0x8509('0xbe')],{'as':'Field','foreignKey':_0x8509('0x1d2')});db['ServicenowField'][_0x8509('0x125')](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0xc0')]['hasMany'](db[_0x8509('0xc2')],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1cb')});db[_0x8509('0xc0')][_0x8509('0x125')](db['CloudProvider'],{'as':_0x8509('0x166'),'foreignKey':_0x8509('0x167')});db[_0x8509('0xc2')][_0x8509('0x116')](db[_0x8509('0xc4')],{'as':_0x8509('0x1cd'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0xc2')][_0x8509('0x116')](db['Dynamics365Field'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x8509('0x1d0')});db['Dynamics365Configuration'][_0x8509('0x116')](db[_0x8509('0xc4')],{'as':_0x8509('0x1d1'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xc2')]['belongsTo'](db[_0x8509('0xc0')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x1cb')});db['Dynamics365Field'][_0x8509('0x116')](db[_0x8509('0xc4')],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0xc4')][_0x8509('0x116')](db[_0x8509('0xc4')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db['Dynamics365Field'][_0x8509('0x116')](db[_0x8509('0xc4')],{'as':'Field','foreignKey':_0x8509('0x1d2')});db[_0x8509('0xc4')]['belongsTo'](db[_0x8509('0x90')],{'as':'Variable','foreignKey':_0x8509('0x1d6')});db[_0x8509('0xc6')][_0x8509('0x116')](db['FreshsalesConfiguration'],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':'AccountId'});db[_0x8509('0xc8')][_0x8509('0x116')](db[_0x8509('0xca')],{'as':_0x8509('0x1cd'),'foreignKey':'SubjectId'});db[_0x8509('0xc8')][_0x8509('0x116')](db['FreshsalesField'],{'as':_0x8509('0x1cf'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xc8')][_0x8509('0x116')](db[_0x8509('0xca')],{'as':_0x8509('0x1d1'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xc8')]['belongsTo'](db[_0x8509('0xc6')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x1cb')});db['FreshsalesField'][_0x8509('0x116')](db[_0x8509('0xca')],{'as':_0x8509('0x1d3'),'foreignKey':'SubjectId'});db[_0x8509('0xca')][_0x8509('0x116')](db[_0x8509('0xca')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xca')]['hasMany'](db[_0x8509('0xca')],{'as':_0x8509('0x1d5'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xca')][_0x8509('0x125')](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':'VariableId'});db[_0x8509('0x1e0')][_0x8509('0x125')](db[_0x8509('0x62')],{});db[_0x8509('0x1e0')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f')});db[_0x8509('0x1e0')]['belongsTo'](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db[_0x8509('0x1e0')][_0x8509('0x125')](db['ChatInteraction'],{});db[_0x8509('0x1e0')]['belongsTo'](db['ChatMessage'],{});db[_0x8509('0x1e0')][_0x8509('0x125')](db[_0x8509('0x12')],{});db[_0x8509('0x1e0')][_0x8509('0x125')](db[_0x8509('0x6a')],{});db[_0x8509('0xd0')]['belongsTo'](db[_0x8509('0x12')],{'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1e1')});db['ChatInternalMessage'][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1e2')});db['JscriptySessionReport'][_0x8509('0x116')](db[_0x8509('0xd3')],{'foreignKey':_0x8509('0x1e3'),'onDelete':_0x8509('0x113')});db['JscriptySessionReport'][_0x8509('0x116')](db['JscriptyAnswerReport'],{'foreignKey':_0x8509('0x1e3'),'onDelete':_0x8509('0x113')});db[_0x8509('0xd5')][_0x8509('0x125')](db[_0x8509('0x18b')],{});db[_0x8509('0xd5')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f')});db[_0x8509('0xd5')][_0x8509('0x125')](db['CmContact'],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db[_0x8509('0xd5')][_0x8509('0x125')](db[_0x8509('0x54')],{});db[_0x8509('0xd5')][_0x8509('0x125')](db['SmsMessage'],{});db[_0x8509('0xd5')][_0x8509('0x125')](db['User'],{});db[_0x8509('0xd5')]['belongsTo'](db[_0x8509('0x57')],{});db['JscriptyProject'][_0x8509('0x116')](db[_0x8509('0x14f')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x8509('0x116')](db['JscriptyQuestionReport'],{'foreignKey':_0x8509('0x1e4')});db[_0x8509('0x1e5')][_0x8509('0x116')](db[_0x8509('0xd1')],{'foreignKey':'ProjectId'});db[_0x8509('0xe4')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':'user_has_teams'});db[_0x8509('0xe4')][_0x8509('0x127')](db['VoiceQueue'],{'through':_0x8509('0x1e6'),'as':'VoiceQueues'});db[_0x8509('0xe4')][_0x8509('0x127')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0x8509('0x138')});db[_0x8509('0xe4')][_0x8509('0x127')](db[_0x8509('0x6a')],{'through':_0x8509('0x1e7'),'as':_0x8509('0x139')});db['Team']['belongsToMany'](db[_0x8509('0x4f')],{'through':'team_has_fax_queues','as':_0x8509('0x13a')});db[_0x8509('0xe4')]['belongsToMany'](db[_0x8509('0x57')],{'through':_0x8509('0x1e8'),'as':'SmsQueues'});db[_0x8509('0xe4')][_0x8509('0x127')](db[_0x8509('0x61')],{'through':'team_has_openchannel_queues','as':_0x8509('0x13d')});db[_0x8509('0xe4')][_0x8509('0x127')](db[_0x8509('0x106')],{'through':'team_has_whatsapp_queues','as':_0x8509('0x1e9')});db[_0x8509('0xe4')][_0x8509('0x127')](db[_0x8509('0xf9')],{'through':_0x8509('0x10a'),'as':_0x8509('0x137')});db[_0x8509('0x1ae')][_0x8509('0x116')](db[_0x8509('0x71')],{'as':'Hoppers','foreignKey':_0x8509('0x1ac')});db[_0x8509('0x1ae')][_0x8509('0x116')](db[_0x8509('0x75')],{'as':_0x8509('0x11a'),'foreignKey':_0x8509('0x1ac')});db['Campaign'][_0x8509('0x116')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x8509('0x1ac')});db[_0x8509('0x1ae')][_0x8509('0x116')](db[_0x8509('0x73')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign'][_0x8509('0x125')](db['Trunk'],{'as':_0x8509('0x29'),'foreignKey':_0x8509('0x151')});db[_0x8509('0x1ae')]['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x8509('0x1ea')});db[_0x8509('0x1ae')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':_0x8509('0x153')});db[_0x8509('0x1ae')][_0x8509('0x125')](db[_0x8509('0xde')],{'as':_0x8509('0xde'),'foreignKey':_0x8509('0x1eb')});db[_0x8509('0x1ae')][_0x8509('0x127')](db[_0x8509('0xf7')],{'as':_0x8509('0x12b'),'through':_0x8509('0x1ec')});db[_0x8509('0x1ae')][_0x8509('0x127')](db[_0x8509('0xf7')],{'as':'BlackLists','through':_0x8509('0x1ed')});db['Attachment'][_0x8509('0x125')](db[_0x8509('0x17c')],{'as':_0x8509('0x17c'),'foreignKey':'ChatOfflineMessageId'});db[_0x8509('0x1ee')][_0x8509('0x125')](db[_0x8509('0x16d')],{});db[_0x8509('0x1ee')][_0x8509('0x125')](db['MailInteraction'],{});db[_0x8509('0x1ee')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x8509('0x1ef'),'as':_0x8509('0x1f0')});db[_0x8509('0x1ee')]['belongsTo'](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f1'),'as':'FromAgent'});db[_0x8509('0x1ee')][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f2'),'as':'ToAgent'});db['MailTransferReport'][_0x8509('0x125')](db[_0x8509('0x3e')],{'foreignKey':'ToMailQueueId','as':_0x8509('0x1f3')});db[_0x8509('0x1ee')][_0x8509('0x125')](db[_0x8509('0x3c')],{'foreignKey':_0x8509('0x1f4'),'as':_0x8509('0x1f5')});db[_0x8509('0xef')][_0x8509('0x125')](db[_0x8509('0x19e')],{});db[_0x8509('0xef')]['belongsTo'](db['ChatInteraction'],{});db[_0x8509('0xef')][_0x8509('0x125')](db[_0x8509('0x62')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x8509('0xef')][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f1'),'as':_0x8509('0x1f6')});db[_0x8509('0xef')][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f2'),'as':_0x8509('0x1f7')});db[_0x8509('0xef')][_0x8509('0x125')](db['ChatQueue'],{'foreignKey':_0x8509('0x1f8'),'as':_0x8509('0x1f3')});db[_0x8509('0xef')]['belongsTo'](db[_0x8509('0x62')],{'foreignKey':'ToChatWebsiteId','as':_0x8509('0x1f5')});db[_0x8509('0xf1')][_0x8509('0x125')](db['FaxMessage'],{});db[_0x8509('0xf1')][_0x8509('0x125')](db[_0x8509('0x4d')],{});db[_0x8509('0xf1')]['belongsTo'](db[_0x8509('0x4a')],{'foreignKey':_0x8509('0x1f9'),'as':'FromAccount'});db['FaxTransferReport'][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f1'),'as':_0x8509('0x1f6')});db[_0x8509('0xf1')][_0x8509('0x125')](db['User'],{'foreignKey':'ToUserId','as':_0x8509('0x1f7')});db[_0x8509('0xf1')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x8509('0x1fa'),'as':_0x8509('0x1f3')});db['FaxTransferReport'][_0x8509('0x125')](db[_0x8509('0x4a')],{'foreignKey':'ToFaxAccountId','as':_0x8509('0x1f5')});db[_0x8509('0xf3')][_0x8509('0x125')](db[_0x8509('0x5f')],{});db[_0x8509('0xf3')]['belongsTo'](db[_0x8509('0x5d')],{});db[_0x8509('0xf3')][_0x8509('0x125')](db[_0x8509('0x59')],{'foreignKey':'FromOpenchannelAccountId','as':_0x8509('0x1f0')});db[_0x8509('0xf3')][_0x8509('0x125')](db['User'],{'foreignKey':_0x8509('0x1f1'),'as':_0x8509('0x1f6')});db[_0x8509('0xf3')][_0x8509('0x125')](db['User'],{'foreignKey':_0x8509('0x1f2'),'as':_0x8509('0x1f7')});db[_0x8509('0xf3')][_0x8509('0x125')](db[_0x8509('0x61')],{'foreignKey':'ToOpenchannelQueueId','as':_0x8509('0x1f3')});db[_0x8509('0xf3')]['belongsTo'](db[_0x8509('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport'][_0x8509('0x125')](db[_0x8509('0x56')],{});db[_0x8509('0xf5')][_0x8509('0x125')](db['SmsInteraction'],{});db[_0x8509('0xf5')][_0x8509('0x125')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x8509('0x1f0')});db[_0x8509('0xf5')][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f1'),'as':_0x8509('0x1f6')});db['SmsTransferReport'][_0x8509('0x125')](db['User'],{'foreignKey':'ToUserId','as':_0x8509('0x1f7')});db[_0x8509('0xf5')]['belongsTo'](db[_0x8509('0x57')],{'foreignKey':_0x8509('0x1fb'),'as':_0x8509('0x1f3')});db[_0x8509('0xf5')][_0x8509('0x125')](db['SmsAccount'],{'foreignKey':_0x8509('0x1fc'),'as':_0x8509('0x1f5')});db[_0x8509('0xf7')][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':_0x8509('0x16f'),'onDelete':_0x8509('0x113')});db['CmList'][_0x8509('0x116')](db[_0x8509('0x7a')],{'as':_0x8509('0x1fd'),'foreignKey':_0x8509('0x16f')});db[_0x8509('0xf7')][_0x8509('0x116')](db[_0x8509('0x12a')],{'as':_0x8509('0x1a2'),'onDelete':'cascade','foreignKey':_0x8509('0x16f')});db['CmList'][_0x8509('0x116')](db[_0x8509('0x75')],{'as':'HopperFinals','foreignKey':_0x8509('0x16f')});db[_0x8509('0xf7')][_0x8509('0x116')](db[_0x8509('0x76')],{'as':_0x8509('0x11b'),'foreignKey':_0x8509('0x16f')});db['CmList']['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x8509('0x16f')});db['CmList'][_0x8509('0x127')](db[_0x8509('0x1a')],{'as':_0x8509('0x1fe'),'through':_0x8509('0x156')});db[_0x8509('0xf7')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':'cm_user_has_lists'});db[_0x8509('0xf9')][_0x8509('0x116')](db[_0x8509('0x17')],{'as':_0x8509('0x119'),'onDelete':_0x8509('0x113')});db[_0x8509('0xf9')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x10c')});db[_0x8509('0xf9')][_0x8509('0x127')](db[_0x8509('0xe4')],{'through':_0x8509('0x10a'),'as':_0x8509('0x158')});db[_0x8509('0xfa')][_0x8509('0x116')](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'foreignKey':'userProfileId'});db[_0x8509('0xfa')][_0x8509('0x116')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x8509('0x126'),'onDelete':_0x8509('0x113')});db[_0x8509('0xfb')][_0x8509('0x116')](db[_0x8509('0x1ff')],{'as':'Resources','foreignKey':_0x8509('0x200'),'onDelete':'cascade'});db[_0x8509('0x144')][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':'WhatsappAccountId','onDelete':_0x8509('0x113')});db[_0x8509('0x144')][_0x8509('0x116')](db['CannedAnswer'],{'as':_0x8509('0x16c'),'foreignKey':_0x8509('0x201')});db[_0x8509('0x144')][_0x8509('0x116')](db[_0x8509('0x101')],{'as':_0x8509('0x15b'),'foreignKey':_0x8509('0x201')});db['WhatsappAccount']['hasMany'](db[_0x8509('0x120')],{'as':_0x8509('0x16e')});db[_0x8509('0x144')][_0x8509('0x116')](db[_0x8509('0xff')],{'as':_0x8509('0x148'),'foreignKey':_0x8509('0x201'),'onDelete':_0x8509('0x113')});db[_0x8509('0x144')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':'List','foreignKey':_0x8509('0x16f')});db['WhatsappAccount'][_0x8509('0x125')](db['Pause'],{'as':_0x8509('0x154'),'foreignKey':_0x8509('0x155')});db[_0x8509('0x144')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':'Agents','through':_0x8509('0x202')});db['WhatsappApplication'][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':_0x8509('0x168')});db[_0x8509('0xff')][_0x8509('0x125')](db[_0x8509('0x106')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x8509('0x125')](db[_0x8509('0x144')],{'onDelete':'restrict'});db[_0x8509('0xff')][_0x8509('0x125')](db['Interval'],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x153')});db[_0x8509('0xff')]['belongsTo'](db[_0x8509('0x174')],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x17e')});db[_0x8509('0x120')][_0x8509('0x116')](db[_0x8509('0x101')],{'as':_0x8509('0x15b'),'onDelete':'cascade','foreignKey':_0x8509('0x203')});db['WhatsappInteraction']['belongsTo'](db[_0x8509('0x144')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x8509('0x120')]['belongsTo'](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db['WhatsappInteraction'][_0x8509('0x125')](db[_0x8509('0x12')],{'as':_0x8509('0x173'),'foreignKey':_0x8509('0x114')});db['WhatsappInteraction'][_0x8509('0x127')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x8509('0x176')});db[_0x8509('0x120')]['belongsToMany'](db[_0x8509('0x174')],{'through':_0x8509('0x1be'),'as':_0x8509('0x177')});db[_0x8509('0x120')][_0x8509('0x127')](db['User'],{'as':_0x8509('0x188'),'through':_0x8509('0x135'),'foreignKey':_0x8509('0x203')});db[_0x8509('0x101')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x12')});db[_0x8509('0x101')][_0x8509('0x125')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x8509('0x101')][_0x8509('0x125')](db[_0x8509('0x120')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x8509('0x203')});db[_0x8509('0x101')][_0x8509('0x125')](db[_0x8509('0x144')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x201')});db[_0x8509('0x102')]['belongsTo'](db[_0x8509('0x144')],{});db['WhatsappQueueReport']['belongsTo'](db['CmList'],{'as':_0x8509('0x180'),'foreignKey':'ListId'});db['WhatsappQueueReport']['belongsTo'](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db[_0x8509('0x102')][_0x8509('0x125')](db[_0x8509('0x120')],{});db[_0x8509('0x102')]['belongsTo'](db['WhatsappQueue'],{});db[_0x8509('0x102')][_0x8509('0x125')](db[_0x8509('0x101')],{});db[_0x8509('0x102')]['belongsTo'](db['User'],{});db['WhatsappTransferReport'][_0x8509('0x125')](db[_0x8509('0x101')],{});db['WhatsappTransferReport'][_0x8509('0x125')](db[_0x8509('0x120')],{});db[_0x8509('0x104')][_0x8509('0x125')](db[_0x8509('0x144')],{'foreignKey':_0x8509('0x204'),'as':_0x8509('0x1f0')});db[_0x8509('0x104')][_0x8509('0x125')](db[_0x8509('0x144')],{'foreignKey':_0x8509('0x205'),'as':_0x8509('0x1f5')});db[_0x8509('0x104')][_0x8509('0x125')](db['WhatsappQueue'],{'foreignKey':_0x8509('0x206'),'as':_0x8509('0x1f3')});db[_0x8509('0x104')][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x8509('0x104')][_0x8509('0x125')](db['User'],{'foreignKey':_0x8509('0x1f2'),'as':_0x8509('0x1f7')});db[_0x8509('0x106')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x36'),'foreignKey':_0x8509('0x207')});db[_0x8509('0x106')][_0x8509('0x127')](db[_0x8509('0xe4')],{'through':_0x8509('0x208'),'as':_0x8509('0x158')});db['UserSetting'][_0x8509('0x125')](db[_0x8509('0x12')],{'as':'user','foreignKey':'UserId','onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x166')]['hasOne'](db['Dynamics365Account'],{'as':_0x8509('0xc0'),'onDelete':_0x8509('0x168')});db[_0x8509('0x166')][_0x8509('0x111')](db[_0x8509('0x38')],{'as':_0x8509('0x169'),'onDelete':_0x8509('0x168')});db[_0x8509('0x166')][_0x8509('0x111')](db[_0x8509('0x3a')],{'as':'Smtp','onDelete':_0x8509('0x168')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 064925c..b976919 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77d4=['/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./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/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/canned_answers','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/fields','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareMessage','/api/teams','./api/team','/api/license','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','./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/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','get','appPath','/index.html','express','./config/environment','setupLoggers','./api/client-side-logs','then','use','/api/users','./api/user','/api/voice/chanspy'];(function(_0x255ba3,_0x122f02){var _0xc0ba9b=function(_0x147de6){while(--_0x147de6){_0x255ba3['push'](_0x255ba3['shift']());}};_0xc0ba9b(++_0x122f02);}(_0x77d4,0x108));var _0x477d=function(_0x41d3e0,_0x3e52a7){_0x41d3e0=_0x41d3e0-0x0;var _0x5c058c=_0x77d4[_0x41d3e0];return _0x5c058c;};'use strict';var path=require('path');var express=require(_0x477d('0x0'));var errors=require('./errors');var config=require(_0x477d('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0x477d('0x2')];var clientSideLogs=require(_0x477d('0x3'));exports['default']=function(_0x53e1b8){return setupLoggers(_0x53e1b8)[_0x477d('0x4')](function(){_0x53e1b8[_0x477d('0x5')](_0x477d('0x6'),require(_0x477d('0x7')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x8'),require('./api/voiceChanSpy'));_0x53e1b8['use'](_0x477d('0x9'),require('./api/voiceContext'));_0x53e1b8['use'](_0x477d('0xa'),require(_0x477d('0xb')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xc'),require(_0x477d('0xd')));_0x53e1b8['use'](_0x477d('0xe'),require('./api/voiceQueue'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf'),require('./api/voiceRecording'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x10'),require('./api/screenRecording'));_0x53e1b8['use'](_0x477d('0x11'),require(_0x477d('0x12')));_0x53e1b8['use'](_0x477d('0x13'),require(_0x477d('0x14')));_0x53e1b8['use']('/api/voice/calls/reports',require(_0x477d('0x15')));_0x53e1b8['use'](_0x477d('0x16'),require(_0x477d('0x17')));_0x53e1b8[_0x477d('0x5')]('/api/voice/agents/reports',require(_0x477d('0x18')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x19'),require(_0x477d('0x1a')));_0x53e1b8['use'](_0x477d('0x1b'),require('./api/memberReport'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x1c'),require(_0x477d('0x1d')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x1e'),require(_0x477d('0x1f')));_0x53e1b8['use'](_0x477d('0x20'),require('./api/mailServerOut'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x21'),require(_0x477d('0x22')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x23'),require(_0x477d('0x24')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x25'),require(_0x477d('0x26')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x27'),require(_0x477d('0x28')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x29'),require('./api/mailMessage'));_0x53e1b8[_0x477d('0x5')]('/api/mail/applications',require(_0x477d('0x2a')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x2b'),require(_0x477d('0x2c')));_0x53e1b8['use'](_0x477d('0x2d'),require(_0x477d('0x2e')));_0x53e1b8[_0x477d('0x5')]('/api/dashboards/items',require('./api/dashboardItem'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x2f'),require(_0x477d('0x30')));_0x53e1b8['use'](_0x477d('0x31'),require(_0x477d('0x32')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x33'),require(_0x477d('0x34')));_0x53e1b8['use'](_0x477d('0x35'),require(_0x477d('0x36')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x37'),require(_0x477d('0x38')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x39'),require(_0x477d('0x3a')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x3b'),require(_0x477d('0x3c')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x3d'),require(_0x477d('0x3e')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x3f'),require(_0x477d('0x40')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x41'),require(_0x477d('0x42')));_0x53e1b8['use'](_0x477d('0x43'),require('./api/smsQueue'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x44'),require(_0x477d('0x45')));_0x53e1b8['use'](_0x477d('0x46'),require(_0x477d('0x47')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x48'),require(_0x477d('0x49')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x4a'),require(_0x477d('0x4b')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x4c'),require('./api/openchannelQueue'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x4d'),require(_0x477d('0x4e')));_0x53e1b8['use'](_0x477d('0x4f'),require(_0x477d('0x50')));_0x53e1b8[_0x477d('0x5')]('/api/chat/applications',require('./api/chatApplication'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x51'),require(_0x477d('0x52')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x53'),require('./api/chatMessage'));_0x53e1b8[_0x477d('0x5')]('/api/chat/offline_messages',require(_0x477d('0x54')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x55'),require('./api/chatQueue'));_0x53e1b8['use'](_0x477d('0x56'),require(_0x477d('0x57')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x58'),require('./api/chatProactiveAction'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x59'),require(_0x477d('0x5a')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x5b'),require('./api/cmContact'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x5c'),require('./api/cmHopper'));_0x53e1b8[_0x477d('0x5')]('/api/cm/hopper_black',require(_0x477d('0x5d')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x5e'),require(_0x477d('0x5f')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x60'),require(_0x477d('0x61')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x62'),require('./api/cmCustomField'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x63'),require(_0x477d('0x64')));_0x53e1b8[_0x477d('0x5')]('/api/automations',require('./api/automation'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x65'),require('./api/cannedAnswer'));_0x53e1b8[_0x477d('0x5')]('/api/dispositions',require('./api/disposition'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x66'),require(_0x477d('0x67')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x68'),require(_0x477d('0x69')));_0x53e1b8['use'](_0x477d('0x6a'),require(_0x477d('0x6b')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x6c'),require(_0x477d('0x6d')));_0x53e1b8['use']('/api/voiceQueuesLog',require(_0x477d('0x6e')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x6f'),require('./api/schedule'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x70'),require(_0x477d('0x71')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x72'),require(_0x477d('0x73')));_0x53e1b8[_0x477d('0x5')]('/api/contact_item_types',require(_0x477d('0x74')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x75'),require(_0x477d('0x76')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x77'),require(_0x477d('0x78')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x79'),require(_0x477d('0x7a')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x7b'),require(_0x477d('0x7c')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x7d'),require('./api/variable'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x7e'),require('./api/integration'));_0x53e1b8['use']('/api/integrations/reports',require(_0x477d('0x7f')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x80'),require(_0x477d('0x81')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x82'),require(_0x477d('0x83')));_0x53e1b8[_0x477d('0x5')]('/api/analytics/extracted_reports',require(_0x477d('0x84')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x85'),require(_0x477d('0x86')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x87'),require(_0x477d('0x88')));_0x53e1b8[_0x477d('0x5')]('/api/analytics/tree_reports',require(_0x477d('0x89')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x8a'),require(_0x477d('0x8b')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/salesforce/configurations',require(_0x477d('0x8c')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x8d'),require(_0x477d('0x8e')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x8f'),require(_0x477d('0x90')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x91'),require(_0x477d('0x92')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x93'),require('./api/intDeskAccount'));_0x53e1b8['use']('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x53e1b8['use'](_0x477d('0x94'),require('./api/intDeskField'));_0x53e1b8[_0x477d('0x5')]('/api/integrations/zoho/accounts',require(_0x477d('0x95')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/zoho/configurations',require(_0x477d('0x96')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x97'),require(_0x477d('0x98')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/zendesk/accounts',require(_0x477d('0x99')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/zendesk/configurations',require(_0x477d('0x9a')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x9b'),require(_0x477d('0x9c')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x9d'),require('./api/intFreshdeskConfiguration'));_0x53e1b8[_0x477d('0x5')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x9e'),require(_0x477d('0x9f')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xa0'),require('./api/intVtigerConfiguration'));_0x53e1b8['use'](_0x477d('0xa1'),require(_0x477d('0xa2')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xa3'),require(_0x477d('0xa4')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xa5'),require(_0x477d('0xa6')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x53e1b8[_0x477d('0x5')]('/api/integrations/dynamics365/accounts',require(_0x477d('0xa7')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xa8'),require('./api/intDynamics365Configuration'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xa9'),require('./api/intDynamics365Field'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xaa'),require(_0x477d('0xab')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xac'),require(_0x477d('0xad')));_0x53e1b8['use'](_0x477d('0xae'),require(_0x477d('0xaf')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xb0'),require('./api/network'));_0x53e1b8[_0x477d('0x5')]('/api/chat/reports/queue',require(_0x477d('0xb1')));_0x53e1b8[_0x477d('0x5')]('/api/chat/internal/messages',require(_0x477d('0xb2')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xb3'),require('./api/jscriptyAnswerReport'));_0x53e1b8['use'](_0x477d('0xb4'),require(_0x477d('0xb5')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xb6'),require('./api/jscriptySessionReport'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xb7'),require('./api/smsQueueReport'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xb8'),require(_0x477d('0xb9')));_0x53e1b8['use'](_0x477d('0xba'),require(_0x477d('0xbb')));_0x53e1b8[_0x477d('0x5')]('/api/jscripty/projects',require(_0x477d('0xbc')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xbd'),require(_0x477d('0xbe')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xbf'),require(_0x477d('0xc0')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xc1'),require('./api/squareProject'));_0x53e1b8['use'](_0x477d('0xc2'),require('./api/squareRecording'));_0x53e1b8[_0x477d('0x5')]('/api/square/messages',require(_0x477d('0xc3')));_0x53e1b8['use'](_0x477d('0xc4'),require(_0x477d('0xc5')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xc6'),require('./api/license'));_0x53e1b8['use']('/api/campaigns',require('./api/campaign'));_0x53e1b8['use'](_0x477d('0xc7'),require(_0x477d('0xc8')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xc9'),require(_0x477d('0xca')));_0x53e1b8[_0x477d('0x5')]('/api/plugins',require(_0x477d('0xcb')));_0x53e1b8['use']('/api/mail/reports/transfer',require(_0x477d('0xcc')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xcd'),require(_0x477d('0xce')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xcf'),require('./api/faxTransferReport'));_0x53e1b8['use'](_0x477d('0xd0'),require(_0x477d('0xd1')));_0x53e1b8[_0x477d('0x5')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xd2'),require(_0x477d('0xd3')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xd4'),require(_0x477d('0xd5')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xd6'),require(_0x477d('0xd7')));_0x53e1b8['use'](_0x477d('0xd8'),require(_0x477d('0xd9')));_0x53e1b8['use'](_0x477d('0xda'),require(_0x477d('0xdb')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xdc'),require(_0x477d('0xdd')));_0x53e1b8['use'](_0x477d('0xde'),require('./api/whatsappAccount'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xdf'),require('./api/whatsappApplication'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe0'),require('./api/whatsappInteraction'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe1'),require('./api/whatsappMessage'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe2'),require(_0x477d('0xe3')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe4'),require(_0x477d('0xe5')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe6'),require(_0x477d('0xe7')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe8'),require(_0x477d('0xe9')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xea'),require(_0x477d('0xeb')));_0x53e1b8['use'](_0x477d('0xec'),require('./api/user-setting'));_0x53e1b8['use'](_0x477d('0xed'),require(_0x477d('0xee')));_0x53e1b8['use'](_0x477d('0xef'),require(_0x477d('0xf0')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf1'),require(_0x477d('0xf2')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf3'),require('./api/authActiveDirectory'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf4'),require('./api/jira'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf5'),require(_0x477d('0xf6')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf7'),require(_0x477d('0xf8')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf9'),require(_0x477d('0xfa')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xfb'),require(_0x477d('0xfc')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xfd'),require(_0x477d('0xfe')));_0x53e1b8[_0x477d('0x5')]('/api/logs',clientSideLogs);_0x53e1b8['use'](_0x477d('0xff'),express['static'](path['join'](config['root'],_0x477d('0xff'))));_0x53e1b8[_0x477d('0x5')]('/www',express[_0x477d('0x100')](path[_0x477d('0x101')](config[_0x477d('0x102')],_0x477d('0x103'))));_0x53e1b8[_0x477d('0x5')]('/demo',express['static'](path[_0x477d('0x101')](config[_0x477d('0x102')],_0x477d('0x104'))));_0x53e1b8[_0x477d('0x5')](_0x477d('0x105'),express['static'](path['join'](config['root'],_0x477d('0x106'),_0x477d('0x107'))));_0x53e1b8['use'](_0x477d('0x108'),express[_0x477d('0x100')](path[_0x477d('0x101')](config[_0x477d('0x102')],_0x477d('0x109'))));_0x53e1b8[_0x477d('0x10a')](_0x477d('0x10b'))['get'](errors[0x194]);_0x53e1b8[_0x477d('0x10a')]('/*')['get'](function(_0x43d598,_0xae98cc){_0xae98cc[_0x477d('0x10c')](path[_0x477d('0x10d')](_0x53e1b8[_0x477d('0x10e')](_0x477d('0x10f'))+_0x477d('0x110')));});return _0x53e1b8;});}; \ No newline at end of file +var _0x3d04=['./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/projects','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./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/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','3.13.0','/plugins','/server/files/plugins','get','route','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailQueueReport','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var path=require(_0x43d0('0x0'));var express=require(_0x43d0('0x1'));var errors=require(_0x43d0('0x2'));var config=require(_0x43d0('0x3'));var setupLoggers=require(_0x43d0('0x4'))[_0x43d0('0x5')];var clientSideLogs=require(_0x43d0('0x6'));exports[_0x43d0('0x7')]=function(_0x5a9e1d){return setupLoggers(_0x5a9e1d)[_0x43d0('0x8')](function(){_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xa'),require(_0x43d0('0xb')));_0x5a9e1d['use']('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x5a9e1d['use'](_0x43d0('0xc'),require(_0x43d0('0xd')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xe'),require(_0x43d0('0xf')));_0x5a9e1d['use']('/api/voice/mohs',require(_0x43d0('0x10')));_0x5a9e1d['use']('/api/voice/queues',require(_0x43d0('0x11')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x12'),require(_0x43d0('0x13')));_0x5a9e1d['use'](_0x43d0('0x14'),require(_0x43d0('0x15')));_0x5a9e1d['use'](_0x43d0('0x16'),require(_0x43d0('0x17')));_0x5a9e1d[_0x43d0('0x9')]('/api/voice/mails/messages',require(_0x43d0('0x18')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x19'),require('./api/voiceCallReport'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x1a'),require(_0x43d0('0x1b')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x1c'),require('./api/voiceAgentReport'));_0x5a9e1d['use'](_0x43d0('0x1d'),require(_0x43d0('0x1e')));_0x5a9e1d[_0x43d0('0x9')]('/api/members/reports',require(_0x43d0('0x1f')));_0x5a9e1d['use'](_0x43d0('0x20'),require(_0x43d0('0x21')));_0x5a9e1d[_0x43d0('0x9')]('/api/voice/transfers/reports',require(_0x43d0('0x22')));_0x5a9e1d[_0x43d0('0x9')]('/api/mail/out_servers',require(_0x43d0('0x23')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x24'),require(_0x43d0('0x25')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x26'),require(_0x43d0('0x27')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x28'),require(_0x43d0('0x29')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x2a'),require(_0x43d0('0x2b')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x2c'),require('./api/mailMessage'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x2d'),require('./api/mailApplication'));_0x5a9e1d[_0x43d0('0x9')]('/api/mail/reports/queue',require(_0x43d0('0x2e')));_0x5a9e1d[_0x43d0('0x9')]('/api/dashboards',require(_0x43d0('0x2f')));_0x5a9e1d[_0x43d0('0x9')]('/api/dashboards/items',require(_0x43d0('0x30')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x31'),require('./api/faxAccount'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x32'),require(_0x43d0('0x33')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x34'),require(_0x43d0('0x35')));_0x5a9e1d[_0x43d0('0x9')]('/api/fax/messages',require(_0x43d0('0x36')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x37'),require('./api/faxQueue'));_0x5a9e1d['use']('/api/fax/reports/queue',require(_0x43d0('0x38')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x39'),require(_0x43d0('0x3a')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x3b'),require('./api/smsApplication'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x3c'),require(_0x43d0('0x3d')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x3e'),require(_0x43d0('0x3f')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x40'),require(_0x43d0('0x41')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x42'),require('./api/openchannelAccount'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x43'),require(_0x43d0('0x44')));_0x5a9e1d[_0x43d0('0x9')]('/api/openchannel/interactions',require(_0x43d0('0x45')));_0x5a9e1d['use'](_0x43d0('0x46'),require(_0x43d0('0x47')));_0x5a9e1d['use'](_0x43d0('0x48'),require(_0x43d0('0x49')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x4a'),require(_0x43d0('0x4b')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x4c'),require(_0x43d0('0x4d')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x4e'),require(_0x43d0('0x4f')));_0x5a9e1d['use'](_0x43d0('0x50'),require(_0x43d0('0x51')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x52'),require(_0x43d0('0x53')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x54'),require(_0x43d0('0x55')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x56'),require(_0x43d0('0x57')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x58'),require(_0x43d0('0x59')));_0x5a9e1d['use'](_0x43d0('0x5a'),require(_0x43d0('0x5b')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x5c'),require(_0x43d0('0x5d')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x5e'),require(_0x43d0('0x5f')));_0x5a9e1d['use']('/api/cm/hopper',require(_0x43d0('0x60')));_0x5a9e1d['use']('/api/cm/hopper_black',require(_0x43d0('0x61')));_0x5a9e1d['use'](_0x43d0('0x62'),require('./api/cmHopperFinal'));_0x5a9e1d[_0x43d0('0x9')]('/api/cm/hopper_history',require(_0x43d0('0x63')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x64'),require('./api/cmCustomField'));_0x5a9e1d[_0x43d0('0x9')]('/api/actions',require(_0x43d0('0x65')));_0x5a9e1d['use']('/api/automations',require(_0x43d0('0x66')));_0x5a9e1d[_0x43d0('0x9')]('/api/canned_answers',require(_0x43d0('0x67')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x68'),require(_0x43d0('0x69')));_0x5a9e1d[_0x43d0('0x9')]('/api/conditions',require(_0x43d0('0x6a')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x6b'),require(_0x43d0('0x6c')));_0x5a9e1d['use'](_0x43d0('0x6d'),require(_0x43d0('0x6e')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x6f'),require(_0x43d0('0x70')));_0x5a9e1d['use'](_0x43d0('0x71'),require(_0x43d0('0x72')));_0x5a9e1d['use'](_0x43d0('0x73'),require(_0x43d0('0x74')));_0x5a9e1d[_0x43d0('0x9')]('/api/sounds',require(_0x43d0('0x75')));_0x5a9e1d['use'](_0x43d0('0x76'),require('./api/tag'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x77'),require(_0x43d0('0x78')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x79'),require('./api/cmContactHasItem'));_0x5a9e1d[_0x43d0('0x9')]('/api/cm_hopper_additional_phones',require(_0x43d0('0x7a')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x7b'),require(_0x43d0('0x7c')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x7d'),require(_0x43d0('0x7e')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x7f'),require(_0x43d0('0x80')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x81'),require('./api/integration'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x82'),require(_0x43d0('0x83')));_0x5a9e1d['use'](_0x43d0('0x84'),require('./api/analyticCustomReport'));_0x5a9e1d['use'](_0x43d0('0x85'),require(_0x43d0('0x86')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x87'),require(_0x43d0('0x88')));_0x5a9e1d['use']('/api/analytics/metrics',require(_0x43d0('0x89')));_0x5a9e1d['use'](_0x43d0('0x8a'),require(_0x43d0('0x8b')));_0x5a9e1d['use']('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x8c'),require(_0x43d0('0x8d')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x8e'),require(_0x43d0('0x8f')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x90'),require(_0x43d0('0x91')));_0x5a9e1d['use'](_0x43d0('0x92'),require(_0x43d0('0x93')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x94'),require(_0x43d0('0x95')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x96'),require(_0x43d0('0x97')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x98'),require('./api/intDeskAccount'));_0x5a9e1d['use'](_0x43d0('0x99'),require(_0x43d0('0x9a')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x9b'),require(_0x43d0('0x9c')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x9d'),require(_0x43d0('0x9e')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x9f'),require(_0x43d0('0xa0')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xa1'),require(_0x43d0('0xa2')));_0x5a9e1d[_0x43d0('0x9')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x5a9e1d['use'](_0x43d0('0xa3'),require(_0x43d0('0xa4')));_0x5a9e1d[_0x43d0('0x9')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x5a9e1d['use'](_0x43d0('0xa5'),require('./api/intFreshdeskAccount'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xa6'),require(_0x43d0('0xa7')));_0x5a9e1d['use'](_0x43d0('0xa8'),require(_0x43d0('0xa9')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xaa'),require(_0x43d0('0xab')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xac'),require(_0x43d0('0xad')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xae'),require('./api/intVtigerField'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xaf'),require(_0x43d0('0xb0')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xb1'),require(_0x43d0('0xb2')));_0x5a9e1d['use'](_0x43d0('0xb3'),require(_0x43d0('0xb4')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xb5'),require(_0x43d0('0xb6')));_0x5a9e1d[_0x43d0('0x9')]('/api/integrations/dynamics365/configurations',require(_0x43d0('0xb7')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xb8'),require(_0x43d0('0xb9')));_0x5a9e1d['use'](_0x43d0('0xba'),require(_0x43d0('0xbb')));_0x5a9e1d[_0x43d0('0x9')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xbc'),require('./api/intFreshsalesField'));_0x5a9e1d['use'](_0x43d0('0xbd'),require(_0x43d0('0xbe')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xbf'),require(_0x43d0('0xc0')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xc1'),require(_0x43d0('0xc2')));_0x5a9e1d['use'](_0x43d0('0xc3'),require(_0x43d0('0xc4')));_0x5a9e1d['use']('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xc5'),require(_0x43d0('0xc6')));_0x5a9e1d['use'](_0x43d0('0xc7'),require(_0x43d0('0xc8')));_0x5a9e1d['use'](_0x43d0('0xc9'),require(_0x43d0('0xca')));_0x5a9e1d['use'](_0x43d0('0xcb'),require('./api/squareReportDetail'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xcc'),require('./api/jscriptyProject'));_0x5a9e1d['use'](_0x43d0('0xcd'),require(_0x43d0('0xce')));_0x5a9e1d[_0x43d0('0x9')]('/api/square/odbc',require('./api/squareOdbc'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xcf'),require('./api/squareProject'));_0x5a9e1d[_0x43d0('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd0'),require(_0x43d0('0xd1')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd2'),require(_0x43d0('0xd3')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd4'),require(_0x43d0('0xd5')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd6'),require('./api/campaign'));_0x5a9e1d[_0x43d0('0x9')]('/api/migrations',require('./api/migration'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd7'),require('./api/attachment'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd8'),require(_0x43d0('0xd9')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xda'),require(_0x43d0('0xdb')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xdc'),require(_0x43d0('0xdd')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xde'),require(_0x43d0('0xdf')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xe0'),require(_0x43d0('0xe1')));_0x5a9e1d['use'](_0x43d0('0xe2'),require(_0x43d0('0xe3')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xe4'),require(_0x43d0('0xe5')));_0x5a9e1d[_0x43d0('0x9')]('/api/voice/prefixes',require(_0x43d0('0xe6')));_0x5a9e1d['use'](_0x43d0('0xe7'),require(_0x43d0('0xe8')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xe9'),require(_0x43d0('0xea')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xeb'),require('./api/userProfileResource'));_0x5a9e1d['use'](_0x43d0('0xec'),require(_0x43d0('0xed')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xee'),require(_0x43d0('0xef')));_0x5a9e1d[_0x43d0('0x9')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x5a9e1d[_0x43d0('0x9')]('/api/whatsapp/interactions',require(_0x43d0('0xf0')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xf1'),require(_0x43d0('0xf2')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xf3'),require(_0x43d0('0xf4')));_0x5a9e1d['use'](_0x43d0('0xf5'),require(_0x43d0('0xf6')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xf7'),require(_0x43d0('0xf8')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xf9'),require(_0x43d0('0xfa')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xfb'),require(_0x43d0('0xfc')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xfd'),require(_0x43d0('0xfe')));_0x5a9e1d['use']('/api/mail_interaction_has_tags',require('./api/mailInteractionHasTag'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xff'),require(_0x43d0('0x100')));_0x5a9e1d[_0x43d0('0x9')]('/api/auth/google',require(_0x43d0('0x101')));_0x5a9e1d['use'](_0x43d0('0x102'),require(_0x43d0('0x103')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x104'),require(_0x43d0('0x105')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x106'),require('./api/rpc'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x107'),require(_0x43d0('0x108')));_0x5a9e1d[_0x43d0('0x9')]('/api/system',require(_0x43d0('0x109')));_0x5a9e1d['use'](_0x43d0('0x10a'),require('./api/pm2'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x10b'),require(_0x43d0('0x10c')));_0x5a9e1d['use'](_0x43d0('0x10d'),clientSideLogs);_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x10e'),express[_0x43d0('0x10f')](path['join'](config[_0x43d0('0x110')],_0x43d0('0x10e'))));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x111'),express[_0x43d0('0x10f')](path[_0x43d0('0x112')](config[_0x43d0('0x110')],_0x43d0('0x111'))));_0x5a9e1d['use'](_0x43d0('0x113'),express['static'](path[_0x43d0('0x112')](config[_0x43d0('0x110')],'/demo')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x114'),express[_0x43d0('0x10f')](path[_0x43d0('0x112')](config[_0x43d0('0x110')],'snippet',_0x43d0('0x115'))));_0x5a9e1d['use'](_0x43d0('0x116'),express['static'](path[_0x43d0('0x112')](config['root'],_0x43d0('0x117'))));_0x5a9e1d['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x43d0('0x118')](errors[0x194]);_0x5a9e1d[_0x43d0('0x119')]('/*')[_0x43d0('0x118')](function(_0xa016ad,_0x2f9ef9){_0x2f9ef9[_0x43d0('0x11a')](path[_0x43d0('0x11b')](_0x5a9e1d[_0x43d0('0x118')](_0x43d0('0x11c'))+_0x43d0('0x11d')));});return _0x5a9e1d;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 0ec98ff..6a1f7e5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa37=['../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','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/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/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.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'];(function(_0x5b2b34,_0xe14d30){var _0x31db59=function(_0xfdb941){while(--_0xfdb941){_0x5b2b34['push'](_0x5b2b34['shift']());}};_0x31db59(++_0xe14d30);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xaa37[_0x422905];return _0x33dc6c;};'use strict';var jayson=require(_0x7aa3('0x0'));var _=require(_0x7aa3('0x1'));var config=require(_0x7aa3('0x2'));exports[_0x7aa3('0x3')]=function(){return new Promise(function(_0x4dcf7a,_0xa0e7e9){var _0x27adcf={};_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x5')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x6')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/voiceQueue/voiceQueue.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x7')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x8')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x9')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0xa')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0xb')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0xc')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/trunk/trunk.rpc'));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0xd')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0xe')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/mailServerIn/mailServerIn.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0xf')));_0x27adcf=_['merge'](_0x27adcf,require('../api/mailQueue/mailQueue.rpc'));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x10')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x11')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x12')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x13')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x14')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/faxApplication/faxApplication.rpc'));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x15')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x16')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/faxQueue/faxQueue.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x17')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x18')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/smsInteraction/smsInteraction.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x19')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x1a')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x1b')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x1c')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x1d')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x1e')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x1f')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x20')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x21')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x22')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x23')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x24')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x25')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x26')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x27')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x28')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/interval/interval.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x29')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/sound/sound.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x2a')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x2b')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x2c')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x2d')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x2e')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x2f')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x30')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x31')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x32')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x33')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x34')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x35')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x36')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x37')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x38')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x39')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x3a')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x3b')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x3c')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x3d')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x3e')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x3f')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x40')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x41')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x42')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/plugin/plugin.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x43')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x44')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x45')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x46')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x47')));var _0x1177b4=jayson[_0x7aa3('0x48')](_0x27adcf)[_0x7aa3('0x49')]();var _0x123031=config[_0x7aa3('0x4a')][_0x7aa3('0x4b')]||config[_0x7aa3('0x4b')]+0x1;var _0x5ee53c=config[_0x7aa3('0x4a')]['ip']||_0x7aa3('0x4c');_0x1177b4['on'](_0x7aa3('0x4d'),function(_0x11111a){return _0xa0e7e9(_0x11111a);});_0x1177b4[_0x7aa3('0x3')](_0x123031,_0x5ee53c,function(){console[_0x7aa3('0x4e')](_0x7aa3('0x4f'),_0x5ee53c,_0x123031);require(_0x7aa3('0x50'))[_0x7aa3('0x51')]();return _0x4dcf7a(_0x7aa3('0x52')+_0x5ee53c+':'+_0x123031);});});}; \ No newline at end of file +var _0x6d19=['../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6d19,0x160));var _0x96d1=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x6d19[_0x45d55e];return _0x29812a;};'use strict';var jayson=require(_0x96d1('0x0'));var _=require(_0x96d1('0x1'));var config=require(_0x96d1('0x2'));exports[_0x96d1('0x3')]=function(){return new Promise(function(_0x874fcb,_0x31518c){var _0x36405d={};_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x4')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x6')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/voiceQueue/voiceQueue.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x7')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x8')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x9')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0xa')));_0x36405d=_['merge'](_0x36405d,require('../api/memberReport/memberReport.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0xb')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0xc')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0xd')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0xe')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0xf')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/mailQueue/mailQueue.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x10')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x11')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/mailApplication/mailApplication.rpc'));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x12')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x13')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x14')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x15')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x16')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x17')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x18')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x19')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x1a')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x1b')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/smsQueue/smsQueue.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x1c')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x1d')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x1e')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x1f')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x20')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x21')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/chatQueue/chatQueue.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x22')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/cmHopper/cmHopper.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x23')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x24')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x25')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x26')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x27')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x28')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x29')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x2a')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x2b')));_0x36405d=_['merge'](_0x36405d,require('../api/variable/variable.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x2c')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x2d')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x2e')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x2f')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x30')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x31')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x32')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x33')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x34')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x35')));_0x36405d=_['merge'](_0x36405d,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x36')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x37')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x38')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x39')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x3a')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x3b')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/squareMessage/squareMessage.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x3c')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x3d')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x3e')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x3f')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x40')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x41')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x42')));var _0x4110ce=jayson['server'](_0x36405d)[_0x96d1('0x43')]();var _0x26439c=config[_0x96d1('0x44')][_0x96d1('0x45')]||config['port']+0x1;var _0x192099=config['rpc']['ip']||'localhost';_0x4110ce['on'](_0x96d1('0x46'),function(_0x3e10f3){return _0x31518c(_0x3e10f3);});_0x4110ce['listen'](_0x26439c,_0x192099,function(){console['log'](_0x96d1('0x47'),_0x192099,_0x26439c);require('../config/triggers')[_0x96d1('0x48')]();return _0x874fcb('RPC\x20listening\x20on\x20'+_0x192099+':'+_0x26439c);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 3c20fc9..78e7600 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 _0xe3da=['function','no\x20code','replace','result=','indexOf','startsWith','split','length','match','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','WAIT','error','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','emit','substring','search','520\x20End\x20of\x20proper'];(function(_0x149731,_0x54c49a){var _0x4fd34c=function(_0x103533){while(--_0x103533){_0x149731['push'](_0x149731['shift']());}};_0x4fd34c(++_0x54c49a);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var util=require(_0xae3d('0x0'));var _=require(_0xae3d('0x1'));var EventEmitter=require(_0xae3d('0x2'))[_0xae3d('0x3')];var AGIReply=require(_0xae3d('0x4'));var AGIError=require(_0xae3d('0x5'));function AGIChannel(_0x109dca){var _0x17952f=this,_0xb2dfd3=new AGIReply(),_0x22bacf=![],_0x1b9397={};EventEmitter[_0xae3d('0x6')](_0x17952f);_0x109dca[_0xae3d('0x7')](_0xae3d('0x8'));_0x109dca[_0xae3d('0x9')](0x8*0x3c*0x3c*0x3e8);_0xb2dfd3[_0xae3d('0x7')]('utf8');_0xb2dfd3['on'](_0xae3d('0xa'),function(_0x3d6650){for(var _0x5544fa in _0x3d6650){_0x17952f[_0x5544fa]=_0x3d6650[_0x5544fa];}_0x17952f['emit'](_0xae3d('0xb'));});_0xb2dfd3['on'](_0xae3d('0xc'),function(_0x420e28){if(_0x420e28[_0xae3d('0xd')]()==_0xae3d('0xe')){_0x17952f[_0xae3d('0xf')]('hangup');return;}if(_0x420e28[_0xae3d('0x10')](0x0,0xb)=='520-Invalid'){_0x22bacf=!![];}if(_0x22bacf){_0x1b9397['rx']+=_0x420e28+'\x0a';if(_0x420e28[_0xae3d('0x11')](_0xae3d('0x12'))!=-0x1){_0x22bacf=![];}}else{_0x1b9397['rx']=_0x420e28;}if(_0x22bacf){return;}if(typeof _0x1b9397['cb']==_0xae3d('0x13')){var _0x172f7a=_0x1b9397['rx'][_0xae3d('0x10')](0x0,0x3),_0x48aa74=null,_0xfb7869=null;_0x172f7a=parseInt(_0x172f7a);if(isNaN(_0x172f7a)){_0x1b9397['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xae3d('0x14')});return;}if(_0x172f7a!=0xc8){_0x1b9397['cb'](null,{'code':_0x172f7a,'result':-0x1,'extra':'KO'});return;}_0x48aa74=_0x1b9397['rx'][_0xae3d('0x10')](0x4)[_0xae3d('0x15')](_0xae3d('0x16'),'');if(_0x48aa74[_0xae3d('0x17')]('\x20')!=-0x1){_0x48aa74=_0x48aa74['substr'](0x0,_0x48aa74[_0xae3d('0x17')]('\x20'));}if(_[_0xae3d('0x18')](_0x48aa74,'-1')){_0x48aa74=parseInt(_0x48aa74);}_0xfb7869=_0x1b9397['rx'][_0xae3d('0x19')]('\x20');if(_0xfb7869[_0xae3d('0x1a')]==0x3){_0xfb7869=_0xfb7869[0x2][_0xae3d('0x10')](0x1,_0xfb7869[0x2][_0xae3d('0x1a')]-0x1);}else if(_0xfb7869['length']>0x3){var _0xe925fd=/\((.+)\)/;var _0x33449a=_0x1b9397['rx'][_0xae3d('0x1b')](_0xe925fd);if(_0x33449a){_0xfb7869=_0x33449a[0x1];}else{_0xfb7869=null;}}else{_0xfb7869=null;}_0x1b9397['cb'](null,{'code':_0x172f7a,'result':_0x48aa74,'extra':_0xfb7869});}});_0x109dca['on']('error',function(_0x3f8cf9){_0x17952f[_0xae3d('0xf')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x3f8cf9[_0xae3d('0x1c')]));});_0x109dca['on'](_0xae3d('0x1d'),function(){_0x17952f[_0xae3d('0xf')](_0xae3d('0x1d'),new AGIError(_0xae3d('0x1e')));});_0x109dca['on']('timeout',function(){_0x17952f[_0xae3d('0xf')]('timeout',new AGIError(_0xae3d('0x1f')));_0x109dca[_0xae3d('0x20')]();});_0x109dca[_0xae3d('0x21')](_0xb2dfd3);this[_0xae3d('0x22')]=function(_0x1facc1,_0x3e7afc){var _0x1facc1=_0x1facc1||'',_0x3e7afc=typeof _0x3e7afc==_0xae3d('0x13')?_0x3e7afc:new Function();_0x1b9397={'tx':_0x1facc1,'rx':'','cb':_0x3e7afc};_0x109dca[_0xae3d('0x23')](_0x1facc1+'\x0a');},this[_0xae3d('0x1d')]=function(){_0x109dca[_0xae3d('0x20')]();};}util[_0xae3d('0x24')](AGIChannel,EventEmitter);AGIChannel[_0xae3d('0x25')][_0xae3d('0x26')]=function(_0x1fe90f){return this[_0xae3d('0x22')][_0xae3d('0x27')](this,_0x1fe90f);};AGIChannel[_0xae3d('0x25')][_0xae3d('0x28')]=function(){return this['sendRequest'](_0xae3d('0x29'));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x2a')]=function(_0x52df0f,_0x256bd0,_0x4391db){_0x52df0f=_0x52df0f===undefined?_0xae3d('0x2b'):_0x52df0f;_0x256bd0=_0x256bd0===undefined?'5':_0x256bd0;_0x4391db=_0x4391db===undefined?'1':_0x4391db;return this['sendRequest'](util['format'](_0xae3d('0x2c'),_0x52df0f,_0x256bd0*0x3e8,_0x4391db));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x2d')]=function(_0x3114f9){_0x3114f9=_0x3114f9||_0xae3d('0x2e');return this['sendRequest'](util[_0xae3d('0x2f')](_0xae3d('0x30'),_0x3114f9));};AGIChannel['prototype'][_0xae3d('0x31')]=function(_0x323715,_0x2cf750){if(_[_0xae3d('0x32')](_0x2cf750)){return this[_0xae3d('0x26')](util[_0xae3d('0x2f')]('EXEC\x20%s\x20%s',_0x323715,_0x2cf750['join'](',')));}return this['sendRequest'](util[_0xae3d('0x2f')](_0xae3d('0x33'),_0x323715,_0x2cf750));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x34')]=function(_0x54a75c){return this[_0xae3d('0x26')](util[_0xae3d('0x2f')](_0xae3d('0x35'),_0x54a75c));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x36')]=function(_0x166631){return this[_0xae3d('0x26')](util['format'](_0xae3d('0x37'),_0x166631));};AGIChannel['prototype']['setPriority']=function(_0x1cd957){return this['sendRequest'](util[_0xae3d('0x2f')]('SET\x20PRIORITY\x20%s',_0x1cd957));};AGIChannel['prototype'][_0xae3d('0xe')]=function(){return this[_0xae3d('0x26')](_0xae3d('0x38'));};AGIChannel['prototype'][_0xae3d('0x39')]=function(_0x58ea2f,_0xce647f){var _0x136ab5=_[_0xae3d('0x3a')](_0xce647f)||_[_0xae3d('0x3b')](_0xce647f)?_0xce647f[_0xae3d('0x3c')]():_0xce647f;return this[_0xae3d('0x26')](util[_0xae3d('0x2f')](_0xae3d('0x3d'),_0x58ea2f,_0x136ab5?_0x136ab5[_0xae3d('0x3c')]()[_0xae3d('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xae3d('0x25')]['sayNumber']=function(_0x544269,_0x3992eb){return this['sendRequest'](util[_0xae3d('0x2f')](_0xae3d('0x3e'),_0x544269,_0x3992eb));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x3f')]=function(_0x2c2892,_0x35db44){return this[_0xae3d('0x26')](util[_0xae3d('0x2f')](_0xae3d('0x40'),_0x2c2892,_0x35db44));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x41')]=function(_0x549db8,_0xa09b64){return this[_0xae3d('0x26')](util[_0xae3d('0x2f')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x549db8,_0xa09b64));};AGIChannel['prototype'][_0xae3d('0x42')]=function(_0x190dd4,_0x524cf2,_0x308c2f){_0x524cf2=_0x524cf2||this[_0xae3d('0x43')];_0x308c2f=_0x308c2f||0x1;this[_0xae3d('0x34')](_0x190dd4);this[_0xae3d('0x36')](_0x524cf2);this[_0xae3d('0x44')](_0x308c2f);return this[_0xae3d('0x2d')](util['format'](_0xae3d('0x45'),_0x190dd4,_0x524cf2,_0x308c2f));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x46')]=function(_0x938811){return this[_0xae3d('0x26')](util['format'](_0xae3d('0x47'),_0x938811));};AGIChannel['prototype'][_0xae3d('0x48')]=function(_0x38e966,_0x599d1a,_0x1fc88f,_0x5e31d4,_0x52da45,_0x5e924b){_0x599d1a=_0x599d1a||_0xae3d('0x49');_0x1fc88f=_0x1fc88f||'';_0x5e31d4=_0x5e31d4===undefined?-0x1:_0x5e31d4==='-1'?-0x1:_0x5e31d4*0x3e8;_0x52da45=_0x52da45===undefined?'':'s='+_0x52da45;_0x5e924b=_0x5e924b?_0xae3d('0x4a'):'';return this['sendRequest'](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x38e966,_0x599d1a,_0x1fc88f,_0x5e31d4,_0x5e924b,_0x52da45));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x4b')]=function(_0x394ad0,_0x1d410e){_0x1d410e=_0x1d410e||'';return this[_0xae3d('0x26')](util[_0xae3d('0x2f')](_0xae3d('0x4c'),_0x394ad0,_0x1d410e));};AGIChannel['prototype']['agi']=function(_0x560f66){return this[_0xae3d('0x31')]('AGI',_0x560f66);};AGIChannel[_0xae3d('0x25')][_0xae3d('0x4d')]=function(_0x41cb63){return this[_0xae3d('0x31')](_0xae3d('0x4e'),_0x41cb63);};AGIChannel[_0xae3d('0x25')][_0xae3d('0x4f')]=function(_0x2a00b1,_0x38f92d){this[_0xae3d('0x2d')](util[_0xae3d('0x2f')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x2a00b1['id'],_0x2a00b1['label'],_0x38f92d));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xb9f4=['wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','EventEmitter','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile'];(function(_0x404bda,_0x1c2365){var _0x4b5a6e=function(_0xe9ec47){while(--_0xe9ec47){_0x404bda['push'](_0x404bda['shift']());}};_0x4b5a6e(++_0x1c2365);}(_0xb9f4,0xf4));var _0x4b9f=function(_0x5eacc3,_0x2ef066){_0x5eacc3=_0x5eacc3-0x0;var _0x410cfa=_0xb9f4[_0x5eacc3];return _0x410cfa;};'use strict';var util=require('util');var _=require(_0x4b9f('0x0'));var EventEmitter=require('events')[_0x4b9f('0x1')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x4372ef){var _0x5bad5c=this,_0x34ae00=new AGIReply(),_0x1df6ea=![],_0x51f5aa={};EventEmitter[_0x4b9f('0x2')](_0x5bad5c);_0x4372ef[_0x4b9f('0x3')](_0x4b9f('0x4'));_0x4372ef[_0x4b9f('0x5')](0x8*0x3c*0x3c*0x3e8);_0x34ae00[_0x4b9f('0x3')](_0x4b9f('0x4'));_0x34ae00['on'](_0x4b9f('0x6'),function(_0x395cec){for(var _0x34c8ed in _0x395cec){_0x5bad5c[_0x34c8ed]=_0x395cec[_0x34c8ed];}_0x5bad5c['emit'](_0x4b9f('0x7'));});_0x34ae00['on'](_0x4b9f('0x8'),function(_0x32b87d){if(_0x32b87d[_0x4b9f('0x9')]()==_0x4b9f('0xa')){_0x5bad5c[_0x4b9f('0xb')]('hangup');return;}if(_0x32b87d[_0x4b9f('0xc')](0x0,0xb)==_0x4b9f('0xd')){_0x1df6ea=!![];}if(_0x1df6ea){_0x51f5aa['rx']+=_0x32b87d+'\x0a';if(_0x32b87d[_0x4b9f('0xe')](_0x4b9f('0xf'))!=-0x1){_0x1df6ea=![];}}else{_0x51f5aa['rx']=_0x32b87d;}if(_0x1df6ea){return;}if(typeof _0x51f5aa['cb']==_0x4b9f('0x10')){var _0x3c51ae=_0x51f5aa['rx'][_0x4b9f('0xc')](0x0,0x3),_0x171e52=null,_0xf5f1cd=null;_0x3c51ae=parseInt(_0x3c51ae);if(isNaN(_0x3c51ae)){_0x51f5aa['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4b9f('0x11')});return;}if(_0x3c51ae!=0xc8){_0x51f5aa['cb'](null,{'code':_0x3c51ae,'result':-0x1,'extra':'KO'});return;}_0x171e52=_0x51f5aa['rx'][_0x4b9f('0xc')](0x4)[_0x4b9f('0x12')]('result=','');if(_0x171e52[_0x4b9f('0x13')]('\x20')!=-0x1){_0x171e52=_0x171e52['substr'](0x0,_0x171e52[_0x4b9f('0x13')]('\x20'));}if(_[_0x4b9f('0x14')](_0x171e52,'-1')){_0x171e52=parseInt(_0x171e52);}_0xf5f1cd=_0x51f5aa['rx'][_0x4b9f('0x15')]('\x20');if(_0xf5f1cd[_0x4b9f('0x16')]==0x3){_0xf5f1cd=_0xf5f1cd[0x2][_0x4b9f('0xc')](0x1,_0xf5f1cd[0x2][_0x4b9f('0x16')]-0x1);}else if(_0xf5f1cd['length']>0x3){var _0x4b2e8b=/\((.+)\)/;var _0x354e26=_0x51f5aa['rx']['match'](_0x4b2e8b);if(_0x354e26){_0xf5f1cd=_0x354e26[0x1];}else{_0xf5f1cd=null;}}else{_0xf5f1cd=null;}_0x51f5aa['cb'](null,{'code':_0x3c51ae,'result':_0x171e52,'extra':_0xf5f1cd});}});_0x4372ef['on']('error',function(_0x1d3856){_0x5bad5c['emit'](_0x4b9f('0x17'),new AGIError(_0x4b9f('0x18'),_0x1d3856[_0x4b9f('0x19')]));});_0x4372ef['on'](_0x4b9f('0x1a'),function(){_0x5bad5c[_0x4b9f('0xb')](_0x4b9f('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4372ef['on'](_0x4b9f('0x1b'),function(){_0x5bad5c[_0x4b9f('0xb')](_0x4b9f('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4372ef[_0x4b9f('0x1c')]();});_0x4372ef[_0x4b9f('0x1d')](_0x34ae00);this[_0x4b9f('0x1e')]=function(_0x451cbb,_0x551227){var _0x451cbb=_0x451cbb||'',_0x551227=typeof _0x551227==_0x4b9f('0x10')?_0x551227:new Function();_0x51f5aa={'tx':_0x451cbb,'rx':'','cb':_0x551227};_0x4372ef[_0x4b9f('0x1f')](_0x451cbb+'\x0a');},this[_0x4b9f('0x1a')]=function(){_0x4372ef[_0x4b9f('0x1c')]();};}util[_0x4b9f('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x22')]=function(_0x1c6d92){return this[_0x4b9f('0x1e')][_0x4b9f('0x23')](this,_0x1c6d92);};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x24')]=function(){return this[_0x4b9f('0x22')](_0x4b9f('0x25'));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x26')]=function(_0x269a4a,_0x14f92c,_0xb5387d){_0x269a4a=_0x269a4a===undefined?_0x4b9f('0x27'):_0x269a4a;_0x14f92c=_0x14f92c===undefined?'5':_0x14f92c;_0xb5387d=_0xb5387d===undefined?'1':_0xb5387d;return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x29'),_0x269a4a,_0x14f92c*0x3e8,_0xb5387d));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x2a')]=function(_0x3958f8){_0x3958f8=_0x3958f8||_0x4b9f('0x2b');return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x2c'),_0x3958f8));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x2d')]=function(_0x350a41,_0x150241){if(_[_0x4b9f('0x2e')](_0x150241)){return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x2f'),_0x350a41,_0x150241[_0x4b9f('0x30')](',')));}return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x2f'),_0x350a41,_0x150241));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x31')]=function(_0x41b540){return this[_0x4b9f('0x22')](util['format'](_0x4b9f('0x32'),_0x41b540));};AGIChannel['prototype'][_0x4b9f('0x33')]=function(_0x124273){return this['sendRequest'](util['format'](_0x4b9f('0x34'),_0x124273));};AGIChannel['prototype'][_0x4b9f('0x35')]=function(_0x226fc3){return this[_0x4b9f('0x22')](util['format'](_0x4b9f('0x36'),_0x226fc3));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0xa')]=function(){return this[_0x4b9f('0x22')](_0x4b9f('0x37'));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x38')]=function(_0xee07a2,_0x56ebb9){var _0xafdaa3=_['isBoolean'](_0x56ebb9)||_[_0x4b9f('0x39')](_0x56ebb9)?_0x56ebb9[_0x4b9f('0x3a')]():_0x56ebb9;return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x3b'),_0xee07a2,_0xafdaa3?_0xafdaa3[_0x4b9f('0x3a')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x3c')]=function(_0x23d54e,_0x5b1824){return this['sendRequest'](util[_0x4b9f('0x28')](_0x4b9f('0x3d'),_0x23d54e,_0x5b1824));};AGIChannel[_0x4b9f('0x21')]['sayDigits']=function(_0x5eb388,_0x286be3){return this['sendRequest'](util[_0x4b9f('0x28')](_0x4b9f('0x3e'),_0x5eb388,_0x286be3));};AGIChannel['prototype']['sayPhonetic']=function(_0x3d98e,_0x411916){return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x3f'),_0x3d98e,_0x411916));};AGIChannel['prototype'][_0x4b9f('0x40')]=function(_0x1ee35f,_0x33536a,_0x4d53e2){_0x33536a=_0x33536a||this['extension'];_0x4d53e2=_0x4d53e2||0x1;this[_0x4b9f('0x31')](_0x1ee35f);this['setExtension'](_0x33536a);this[_0x4b9f('0x35')](_0x4d53e2);return this[_0x4b9f('0x2a')](util['format'](_0x4b9f('0x41'),_0x1ee35f,_0x33536a,_0x4d53e2));};AGIChannel[_0x4b9f('0x21')]['getVariable']=function(_0x39d35e){return this[_0x4b9f('0x22')](util['format'](_0x4b9f('0x42'),_0x39d35e));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x43')]=function(_0x5669a4,_0x4a96ac,_0x1fa88d,_0x212d6e,_0x1ccab7,_0x5cef86){_0x4a96ac=_0x4a96ac||_0x4b9f('0x44');_0x1fa88d=_0x1fa88d||'';_0x212d6e=_0x212d6e===undefined?-0x1:_0x212d6e==='-1'?-0x1:_0x212d6e*0x3e8;_0x1ccab7=_0x1ccab7===undefined?'':'s='+_0x1ccab7;_0x5cef86=_0x5cef86?_0x4b9f('0x45'):'';return this['sendRequest'](util[_0x4b9f('0x28')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x5669a4,_0x4a96ac,_0x1fa88d,_0x212d6e,_0x5cef86,_0x1ccab7));};AGIChannel['prototype'][_0x4b9f('0x46')]=function(_0x98cc73,_0x1ad998){_0x1ad998=_0x1ad998||'';return this['sendRequest'](util[_0x4b9f('0x28')](_0x4b9f('0x47'),_0x98cc73,_0x1ad998));};AGIChannel[_0x4b9f('0x21')]['agi']=function(_0xd2c083){return this[_0x4b9f('0x2d')](_0x4b9f('0x48'),_0xd2c083);};AGIChannel['prototype'][_0x4b9f('0x49')]=function(_0x564ef7){return this[_0x4b9f('0x2d')](_0x4b9f('0x4a'),_0x564ef7);};AGIChannel['prototype'][_0x4b9f('0x17')]=function(_0x2f79ad,_0x165fc7){this[_0x4b9f('0x2a')](util[_0x4b9f('0x28')](_0x4b9f('0x4b'),_0x2f79ad['id'],_0x2f79ad[_0x4b9f('0x4c')],_0x165fc7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4b9f('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 697d361..a244591 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 _0x911c=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x5a2ccb,_0x4e11be){var _0x3c0045=function(_0xe182af){while(--_0xe182af){_0x5a2ccb['push'](_0x5a2ccb['shift']());}};_0x3c0045(++_0x4e11be);}(_0x911c,0x139));var _0xc911=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x911c[_0x5b64a1];return _0x4b6f55;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xc911('0x0'),'E_AGI_ARGUMENT_PORT':_0xc911('0x1'),'E_AGI_SERVER_ERROR':_0xc911('0x2'),'E_AGI_SERVER_CLOSE':_0xc911('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xc911('0x4'),'E_AGI_SOCKET_ERROR':_0xc911('0x5'),'E_AGI_SOCKET_CLOSE':_0xc911('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xc911('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc911('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x49e8ec){var _0x49e8ec=_0x49e8ec||null,_0x127af4=_0x127af4||[],_0x5e2019=0x1,_0x5e9cd2='';if(!error[_0x49e8ec]){_0x49e8ec=_0xc911('0x9');}_0x127af4[_0xc911('0xa')](error[_0x49e8ec]);while(arguments[_0x5e2019]){_0x127af4[_0xc911('0xa')](arguments[_0x5e2019]);_0x5e2019++;}_0x5e9cd2=util['format'][_0xc911('0xb')](util,_0x127af4);this[_0xc911('0xc')]=_0x5e9cd2;this[_0xc911('0xd')]=_0x49e8ec;}module[_0xc911('0xe')]=AGIError; \ No newline at end of file +var _0xcb10=['name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x4e7fa9,_0x29d247){var _0x401f9e=function(_0x2f6a12){while(--_0x2f6a12){_0x4e7fa9['push'](_0x4e7fa9['shift']());}};_0x401f9e(++_0x29d247);}(_0xcb10,0x1a6));var _0x0cb1=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcb10[_0x13d07a];return _0x5ee0ee;};'use strict';var util=require(_0x0cb1('0x0'));var error={'E_AGI_UNDEFINED':_0x0cb1('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x0cb1('0x2'),'E_AGI_SERVER_CLOSE':_0x0cb1('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x0cb1('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x0cb1('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x0cb1('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0cb1('0x7')};function AGIError(_0x1efaac){var _0x1efaac=_0x1efaac||null,_0x747a90=_0x747a90||[],_0x4df5ad=0x1,_0x4b5af5='';if(!error[_0x1efaac]){_0x1efaac=_0x0cb1('0x8');}_0x747a90[_0x0cb1('0x9')](error[_0x1efaac]);while(arguments[_0x4df5ad]){_0x747a90[_0x0cb1('0x9')](arguments[_0x4df5ad]);_0x4df5ad++;}_0x4b5af5=util[_0x0cb1('0xa')][_0x0cb1('0xb')](util,_0x747a90);this[_0x0cb1('0xc')]=_0x4b5af5;this[_0x0cb1('0xd')]=_0x1efaac;}module[_0x0cb1('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 3652a06..5d05c01 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 _0xfae6=['defaults','localhost','subscribe','agi','emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','EventEmitter','ioredis','redis'];(function(_0x8fcd9,_0x45135d){var _0x17ea74=function(_0x2e224b){while(--_0x2e224b){_0x8fcd9['push'](_0x8fcd9['shift']());}};_0x17ea74(++_0x45135d);}(_0xfae6,0x1eb));var _0x6fae=function(_0x5d269d,_0x3c8fc9){_0x5d269d=_0x5d269d-0x0;var _0x2e25c7=_0xfae6[_0x5d269d];return _0x2e25c7;};'use strict';var _=require(_0x6fae('0x0'));var EventEmitter=require('events')[_0x6fae('0x1')];var Redis=require(_0x6fae('0x2'));var AGIError=require('./error');var config=require('../../config/environment');config[_0x6fae('0x3')]=_[_0x6fae('0x4')](config[_0x6fae('0x3')],{'host':_0x6fae('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x6fae('0x3')]);sub[_0x6fae('0x6')](_0x6fae('0x7'),function(_0x3bb40d){if(_0x3bb40d)return eventEmitter[_0x6fae('0x8')](_0x6fae('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x3bb40d));});sub['on'](_0x6fae('0xa'),function(_0x3bb838,_0x2702a5){if(_0x3bb838!=='agi')return;try{var _0x27a47e=JSON[_0x6fae('0xb')](_0x2702a5);eventEmitter[_0x6fae('0x8')](_0x6fae('0xc'),_0x27a47e);}catch(_0xa715e2){eventEmitter['emit']('error',new AGIError(_0x6fae('0xd'),_0xa715e2));}});module[_0x6fae('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xdf01=['exports','lodash','events','EventEmitter','ioredis','./error','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','parse'];(function(_0x3fc017,_0x288faf){var _0x542e8c=function(_0x42438c){while(--_0x42438c){_0x3fc017['push'](_0x3fc017['shift']());}};_0x542e8c(++_0x288faf);}(_0xdf01,0x1e1));var _0x1df0=function(_0x4c9a16,_0x253693){_0x4c9a16=_0x4c9a16-0x0;var _0x528969=_0xdf01[_0x4c9a16];return _0x528969;};'use strict';var _=require(_0x1df0('0x0'));var EventEmitter=require(_0x1df0('0x1'))[_0x1df0('0x2')];var Redis=require(_0x1df0('0x3'));var AGIError=require(_0x1df0('0x4'));var config=require('../../config/environment');config[_0x1df0('0x5')]=_[_0x1df0('0x6')](config[_0x1df0('0x5')],{'host':_0x1df0('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x1df0('0x5')]);sub[_0x1df0('0x8')]('agi',function(_0x6960d9){if(_0x6960d9)return eventEmitter[_0x1df0('0x9')](_0x1df0('0xa'),new AGIError(_0x1df0('0xb'),_0x6960d9));});sub['on'](_0x1df0('0xc'),function(_0x4de577,_0x55b47e){if(_0x4de577!=='agi')return;try{var _0x56d05e=JSON[_0x1df0('0xd')](_0x55b47e);eventEmitter['emit']('projectUpdate',_0x56d05e);}catch(_0x1eeda7){eventEmitter['emit'](_0x1df0('0xa'),new AGIError(_0x1df0('0xb'),_0x1eeda7));}});module[_0x1df0('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 9959b42..1c0e1d9 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 _0xd894=['getVertex','traverseBFS','info','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','menu','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','agi','getdigits','getsecretdigits','vertices','numberOfEdges','addVertex','prototype','addEdge','edges','push','size','relations'];(function(_0xd229de,_0x2c3bab){var _0x1a4362=function(_0x1f68e2){while(--_0x1f68e2){_0xd229de['push'](_0xd229de['shift']());}};_0x1a4362(++_0x2c3bab);}(_0xd894,0x10c));var _0x4d89=function(_0x22cfdb,_0x31b3f7){_0x22cfdb=_0x22cfdb-0x0;var _0x1aa30c=_0xd894[_0x22cfdb];return _0x1aa30c;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x4d89('0x0'));var verticesWithRetry=['menu',_0x4d89('0x1'),_0x4d89('0x2')];var Graph=function(){this[_0x4d89('0x3')]={};this['edges']={};this[_0x4d89('0x4')]=0x0;};Graph['prototype'][_0x4d89('0x5')]=function(_0x1a9520){this['vertices'][_0x1a9520['id']]=_0x1a9520;this['edges'][_0x1a9520['id']]=[];};Graph[_0x4d89('0x6')][_0x4d89('0x7')]=function(_0x5ab5d9,_0x2a8feb,_0x44d629){this[_0x4d89('0x8')][_0x5ab5d9][_0x4d89('0x9')]({'target':_0x2a8feb,'condition':_0x44d629});this[_0x4d89('0x4')]+=0x1;};Graph['prototype'][_0x4d89('0xa')]=function(){return _[_0x4d89('0xa')](this[_0x4d89('0x3')]);};Graph[_0x4d89('0x6')][_0x4d89('0xb')]=function(){return this[_0x4d89('0x4')];};Graph[_0x4d89('0x6')][_0x4d89('0xc')]=function(_0x463b56){return this[_0x4d89('0x3')][_0x463b56];};Graph[_0x4d89('0x6')][_0x4d89('0xd')]=function(_0x492fe8,_0x4f5b87){if(!this['vertices'][_0x492fe8]){return logger[_0x4d89('0xe')]('no\x20vertex\x20found');}var _0xc7d421=_0x4f5b87(this[_0x4d89('0x3')][_0x492fe8]);if(!_0xc7d421){return logger[_0x4d89('0xe')](_0x4d89('0xf'));}if(this[_0x4d89('0x8')][_0x492fe8][_0x4d89('0x10')]===0x0){return logger[_0x4d89('0xe')]('no\x20edge/s\x20available');}for(var _0x543ed0=0x0,_0x364468=[],_0x57f4f2=![];_0x543ed0\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','indexOf','agi_','debug','close','timeout','hangup','find','handleNotFound','handleUnpublished','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','lodash','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','findIndex','deleted','splice','push','error','stack','env','production'];(function(_0x56039b,_0x3de8d8){var _0xc90792=function(_0x300c35){while(--_0x300c35){_0x56039b['push'](_0x56039b['shift']());}};_0xc90792(++_0x3de8d8);}(_0x8eab,0x95));var _0xb8ea=function(_0x591758,_0x4f8d57){_0x591758=_0x591758-0x0;var _0x4be23f=_0x8eab[_0x591758];return _0x4be23f;};'use strict';var _=require(_0xb8ea('0x0'));var syncho=require(_0xb8ea('0x1'));var util=require('util');var config=require(_0xb8ea('0x2'));var logger=require(_0xb8ea('0x3'))(_0xb8ea('0x4'));var utilLicense=require(_0xb8ea('0x5'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0xb8ea('0x6'))[_0xb8ea('0x7')];var projects=[];config[_0xb8ea('0x4')]=_[_0xb8ea('0x8')](config[_0xb8ea('0x4')],{'ip':_0xb8ea('0x9'),'port':0x11dd});AGIEmitter['on'](_0xb8ea('0xa'),projectUpdateHandler);function connectionHandler(_0x538e9b){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x538e9b);agiHandler(_0x538e9b);}catch(_0x1a3792){logger['error'](_0x1a3792['stack']);}});});}function projectUpdateHandler(_0x1b76b7){try{var _0x2eb46c=_[_0xb8ea('0xb')](projects,['id',_0x1b76b7['id']]);if(_0x2eb46c>-0x1){if(_0x1b76b7[_0xb8ea('0xc')]===!![]){projects[_0xb8ea('0xd')](_0x2eb46c,0x1);}else{projects[_0x2eb46c]=_0x1b76b7;}}else{projects[_0xb8ea('0xe')](_0x1b76b7);}}catch(_0x305c32){logger[_0xb8ea('0xf')](_0x305c32[_0xb8ea('0x10')]);}}function listeningHandler(){var _0x485699=config[_0xb8ea('0x11')]===_0xb8ea('0x12')||![];console[_0xb8ea('0x13')](_0xb8ea('0x14'),config['agi'][_0xb8ea('0x15')]);logger[_0xb8ea('0x16')](util[_0xb8ea('0x17')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0x485699?config['agi']['ip']:_0xb8ea('0x18'),config[_0xb8ea('0x4')]['port']));}function errorHandler(_0xed20a1){if(_0xed20a1&&_0xed20a1[_0xb8ea('0x19')]&&_0xed20a1[_0xb8ea('0x1a')]){logger[_0xb8ea('0xf')](util[_0xb8ea('0x17')]('[%s]\x20%s',_0xed20a1[_0xb8ea('0x19')],_0xed20a1['message']));}else{logger[_0xb8ea('0xf')](util[_0xb8ea('0x17')](_0xb8ea('0x1b'),_0xed20a1['stack']));}}function closeHandler(){logger[_0xb8ea('0x16')](util[_0xb8ea('0x17')](_0xb8ea('0x1c'),this[_0xb8ea('0x1d')],this[_0xb8ea('0x1e')],this[_0xb8ea('0x1f')],this['dnid'],this[_0xb8ea('0x20')]));try{createSquareReport(this);}catch(_0x46a8e5){logger[_0xb8ea('0xf')](_0x46a8e5[_0xb8ea('0x10')]);}}function timeoutHandler(){logger['info'](util[_0xb8ea('0x17')](_0xb8ea('0x21'),this[_0xb8ea('0x1d')],this[_0xb8ea('0x1e')],this[_0xb8ea('0x1f')],this[_0xb8ea('0x22')],this[_0xb8ea('0x20')]));}function hangupHandler(){logger['info'](util[_0xb8ea('0x17')](_0xb8ea('0x23'),this[_0xb8ea('0x1d')],this[_0xb8ea('0x1e')],this[_0xb8ea('0x1f')],this[_0xb8ea('0x22')],this[_0xb8ea('0x20')]));this[_0xb8ea('0x24')]=!![];}function createSquareReport(_0x1169e6,_0x1b584c){rpc[_0xb8ea('0x25')](_0x1169e6)[_0xb8ea('0x26')](function(_0x2cf13a){if(_0x1b584c){_0x1b584c(null,_0x2cf13a);}})[_0xb8ea('0x27')](function(_0xab4a96){if(_0x1b584c){_0x1b584c(null,_0xab4a96);}});}function setChannelVariables(_0xd8039d){for(var _0x507845 in _0xd8039d){if(_0xd8039d['hasOwnProperty'](_0x507845)){if(_0x507845[_0xb8ea('0x28')](_0xb8ea('0x29'))===0x0){_0xd8039d[_0x507845['substring'](0x4)]=_0xd8039d[_0x507845];delete _0xd8039d[_0x507845];}}}}function agiHandler(_0xc1a5f9){logger[_0xb8ea('0x2a')]('variables',JSON['stringify'](_0xc1a5f9,null,0x2));logger[_0xb8ea('0x16')](util[_0xb8ea('0x17')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xc1a5f9[_0xb8ea('0x1d')],_0xc1a5f9['calleridname'],_0xc1a5f9['callerid'],_0xc1a5f9[_0xb8ea('0x22')],_0xc1a5f9[_0xb8ea('0x20')]));_0xc1a5f9['on'](_0xb8ea('0xf'),errorHandler);_0xc1a5f9['on'](_0xb8ea('0x2b'),closeHandler);_0xc1a5f9['on'](_0xb8ea('0x2c'),timeoutHandler);_0xc1a5f9[_0xb8ea('0x24')]=![];_0xc1a5f9['on'](_0xb8ea('0x2d'),hangupHandler);var _0x54d8ae=_[_0xb8ea('0x2e')](projects,[_0xb8ea('0x19'),_0xc1a5f9[_0xb8ea('0x1d')]]);if(!_0x54d8ae)return Project[_0xb8ea('0x2f')](_0xc1a5f9);if(!_0x54d8ae[_0xb8ea('0x12')])return Project[_0xb8ea('0x30')](_0xc1a5f9);return Project['initialize'](_0x54d8ae,_0xc1a5f9);}function main(){var _0x372a26;return utilLicense['getLicense']()[_0xb8ea('0x26')](function(_0x2f2de9){if(!_0x2f2de9)return;if(_0x2f2de9['voice']){if(_0x2f2de9[_0xb8ea('0x31')]&&_0x2f2de9['callysquare']>0x0){logger[_0xb8ea('0x16')](util[_0xb8ea('0x17')](_0xb8ea('0x32'),_0x2f2de9[_0xb8ea('0x31')]));_0x372a26=_0x2f2de9[_0xb8ea('0x31')];}else{logger[_0xb8ea('0x16')](_0xb8ea('0x33'));}}else{logger[_0xb8ea('0x16')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x372a26=-0x1;}})[_0xb8ea('0x26')](function(){return Project['getAll']();})[_0xb8ea('0x26')](function(_0x3e2fca){projects=_0x3e2fca;return;})['catch'](function(_0x344a66){logger[_0xb8ea('0xf')](_0xb8ea('0x34'),_0x344a66[_0xb8ea('0x10')]);})['finally'](function(){var _0x1a59e5=require(_0xb8ea('0x35'))(config[_0xb8ea('0x4')]['port'],config[_0xb8ea('0x4')]['ip'],_0x372a26);_0x1a59e5['on'](_0xb8ea('0xf'),errorHandler);_0x1a59e5['on'](_0xb8ea('0x36'),listeningHandler);_0x1a59e5['on'](_0xb8ea('0x37'),connectionHandler);_0x1a59e5['on'](_0xb8ea('0x2b'),closeHandler);});}main(); \ No newline at end of file +var _0x35ba=['getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection','lodash','util','../../config/environment','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','projectUpdate','nextTick','error','stack','findIndex','splice','env','production','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','name','message','format','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','timeout','hangup','handleNotFound'];(function(_0x48e4a4,_0x120886){var _0x2c7b56=function(_0x1d5ea6){while(--_0x1d5ea6){_0x48e4a4['push'](_0x48e4a4['shift']());}};_0x2c7b56(++_0x120886);}(_0x35ba,0x1d3));var _0xa35b=function(_0x440464,_0xb7afd8){_0x440464=_0x440464-0x0;var _0x2f4043=_0x35ba[_0x440464];return _0x2f4043;};'use strict';var _=require(_0xa35b('0x0'));var syncho=require('syncho');var util=require(_0xa35b('0x1'));var config=require(_0xa35b('0x2'));var logger=require('../../config/logger')(_0xa35b('0x3'));var utilLicense=require(_0xa35b('0x4'));var rpc=require(_0xa35b('0x5'));var Project=require('./project');var AGIEmitter=require(_0xa35b('0x6'))[_0xa35b('0x7')];var projects=[];config[_0xa35b('0x3')]=_[_0xa35b('0x8')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xa35b('0x9'),projectUpdateHandler);function connectionHandler(_0x32e4e8){process[_0xa35b('0xa')](function(){syncho(function(){try{setChannelVariables(_0x32e4e8);agiHandler(_0x32e4e8);}catch(_0x3300d5){logger[_0xa35b('0xb')](_0x3300d5[_0xa35b('0xc')]);}});});}function projectUpdateHandler(_0x471978){try{var _0x2e4340=_[_0xa35b('0xd')](projects,['id',_0x471978['id']]);if(_0x2e4340>-0x1){if(_0x471978['deleted']===!![]){projects[_0xa35b('0xe')](_0x2e4340,0x1);}else{projects[_0x2e4340]=_0x471978;}}else{projects['push'](_0x471978);}}catch(_0x19565b){logger['error'](_0x19565b['stack']);}}function listeningHandler(){var _0x1d5fd9=config[_0xa35b('0xf')]===_0xa35b('0x10')||![];console[_0xa35b('0x11')](_0xa35b('0x12'),config[_0xa35b('0x3')][_0xa35b('0x13')]);logger[_0xa35b('0x14')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0x1d5fd9?config[_0xa35b('0x3')]['ip']:'host.docker.internal',config['agi']['port']));}function errorHandler(_0x2154b1){if(_0x2154b1&&_0x2154b1[_0xa35b('0x15')]&&_0x2154b1[_0xa35b('0x16')]){logger['error'](util[_0xa35b('0x17')]('[%s]\x20%s',_0x2154b1[_0xa35b('0x15')],_0x2154b1[_0xa35b('0x16')]));}else{logger[_0xa35b('0xb')](util[_0xa35b('0x17')](_0xa35b('0x18'),_0x2154b1['stack']));}}function closeHandler(){logger[_0xa35b('0x14')](util[_0xa35b('0x17')](_0xa35b('0x19'),this[_0xa35b('0x1a')],this[_0xa35b('0x1b')],this['callerid'],this['dnid'],this[_0xa35b('0x1c')]));try{createSquareReport(this);}catch(_0x478c21){logger[_0xa35b('0xb')](_0x478c21['stack']);}}function timeoutHandler(){logger[_0xa35b('0x14')](util[_0xa35b('0x17')](_0xa35b('0x1d'),this['arg_1'],this['calleridname'],this[_0xa35b('0x1e')],this[_0xa35b('0x1f')],this['uniqueid']));}function hangupHandler(){logger['info'](util['format'](_0xa35b('0x20'),this[_0xa35b('0x1a')],this[_0xa35b('0x1b')],this['callerid'],this[_0xa35b('0x1f')],this[_0xa35b('0x1c')]));this['evtHangup']=!![];}function createSquareReport(_0x53f5f7,_0x3f5848){rpc['createSquareReport'](_0x53f5f7)[_0xa35b('0x21')](function(_0x4d01e2){if(_0x3f5848){_0x3f5848(null,_0x4d01e2);}})[_0xa35b('0x22')](function(_0xa0b74b){if(_0x3f5848){_0x3f5848(null,_0xa0b74b);}});}function setChannelVariables(_0x3878f5){for(var _0x28a23f in _0x3878f5){if(_0x3878f5[_0xa35b('0x23')](_0x28a23f)){if(_0x28a23f[_0xa35b('0x24')](_0xa35b('0x25'))===0x0){_0x3878f5[_0x28a23f[_0xa35b('0x26')](0x4)]=_0x3878f5[_0x28a23f];delete _0x3878f5[_0x28a23f];}}}}function agiHandler(_0x3f19ec){logger[_0xa35b('0x27')](_0xa35b('0x28'),JSON[_0xa35b('0x29')](_0x3f19ec,null,0x2));logger['info'](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3f19ec[_0xa35b('0x1a')],_0x3f19ec[_0xa35b('0x1b')],_0x3f19ec[_0xa35b('0x1e')],_0x3f19ec[_0xa35b('0x1f')],_0x3f19ec[_0xa35b('0x1c')]));_0x3f19ec['on'](_0xa35b('0xb'),errorHandler);_0x3f19ec['on'](_0xa35b('0x2a'),closeHandler);_0x3f19ec['on'](_0xa35b('0x2b'),timeoutHandler);_0x3f19ec['evtHangup']=![];_0x3f19ec['on'](_0xa35b('0x2c'),hangupHandler);var _0x9cfaf7=_['find'](projects,[_0xa35b('0x15'),_0x3f19ec[_0xa35b('0x1a')]]);if(!_0x9cfaf7)return Project[_0xa35b('0x2d')](_0x3f19ec);if(!_0x9cfaf7['production'])return Project['handleUnpublished'](_0x3f19ec);return Project['initialize'](_0x9cfaf7,_0x3f19ec);}function main(){var _0x5f4a37;return utilLicense[_0xa35b('0x2e')]()['then'](function(_0x5d25a3){if(!_0x5d25a3)return;if(_0x5d25a3[_0xa35b('0x2f')]){if(_0x5d25a3[_0xa35b('0x30')]&&_0x5d25a3[_0xa35b('0x30')]>0x0){logger[_0xa35b('0x14')](util[_0xa35b('0x17')](_0xa35b('0x31'),_0x5d25a3[_0xa35b('0x30')]));_0x5f4a37=_0x5d25a3[_0xa35b('0x30')];}else{logger[_0xa35b('0x14')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xa35b('0x14')](_0xa35b('0x32'));_0x5f4a37=-0x1;}})[_0xa35b('0x21')](function(){return Project[_0xa35b('0x33')]();})['then'](function(_0xfbf254){projects=_0xfbf254;return;})[_0xa35b('0x22')](function(_0x1cd60f){logger[_0xa35b('0xb')](_0xa35b('0x34'),_0x1cd60f['stack']);})[_0xa35b('0x35')](function(){var _0xeedf64=require(_0xa35b('0x36'))(config['agi'][_0xa35b('0x13')],config[_0xa35b('0x3')]['ip'],_0x5f4a37);_0xeedf64['on'](_0xa35b('0xb'),errorHandler);_0xeedf64['on'](_0xa35b('0x37'),listeningHandler);_0xeedf64['on'](_0xa35b('0x38'),connectionHandler);_0xeedf64['on'](_0xa35b('0x2a'),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 099b95d..134cce3 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 _0x4f1a=['message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','request','then','error'];(function(_0x2a47e4,_0x1e728a){var _0x513b94=function(_0x3ade7e){while(--_0x3ade7e){_0x2a47e4['push'](_0x2a47e4['shift']());}};_0x513b94(++_0x1e728a);}(_0x4f1a,0xa5));var _0xa4f1=function(_0x2627c5,_0x3a0394){_0x2627c5=_0x2627c5-0x0;var _0x4f11fd=_0x4f1a[_0x2627c5];return _0x4f11fd;};'use strict';var BPromise=require(_0xa4f1('0x0'));var jayson=require(_0xa4f1('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x5af28f,_0x52fd87){return new BPromise(function(_0x4db40b,_0x5a45e0){return client[_0xa4f1('0x2')](_0x5af28f,_0x52fd87)[_0xa4f1('0x3')](function(_0x3941ee){if(_0x3941ee[_0xa4f1('0x4')]){return _0x5a45e0(_0x3941ee[_0xa4f1('0x4')][_0xa4f1('0x5')]);}else{return _0x4db40b(_0x3941ee[_0xa4f1('0x6')]);}})[_0xa4f1('0x7')](function(_0x4b94db){return _0x5a45e0(_0x4b94db);});});}exports[_0xa4f1('0x8')]=function(_0x15206a,_0x249d61){return request(_0xa4f1('0x9'),{'account':_0x15206a,'message':_0x249d61});}; \ No newline at end of file +var _0x3c2e=['request','then','error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0x5223bf,_0x109da4){var _0x181da4=function(_0x5d7047){while(--_0x5d7047){_0x5223bf['push'](_0x5223bf['shift']());}};_0x181da4(++_0x109da4);}(_0x3c2e,0x9d));var _0xe3c2=function(_0x574286,_0x306381){_0x574286=_0x574286-0x0;var _0x46a860=_0x3c2e[_0x574286];return _0x46a860;};'use strict';var BPromise=require(_0xe3c2('0x0'));var jayson=require(_0xe3c2('0x1'));var client=jayson['client'][_0xe3c2('0x2')]({'port':0x232b});function request(_0x290d42,_0x21ec6a){return new BPromise(function(_0xeb4d08,_0x5f519e){return client[_0xe3c2('0x3')](_0x290d42,_0x21ec6a)[_0xe3c2('0x4')](function(_0x3e73d1){if(_0x3e73d1[_0xe3c2('0x5')]){return _0x5f519e(_0x3e73d1['error'][_0xe3c2('0x6')]);}else{return _0xeb4d08(_0x3e73d1['result']);}})[_0xe3c2('0x7')](function(_0x36ae7d){return _0x5f519e(_0x36ae7d);});});}exports[_0xe3c2('0x8')]=function(_0x302dc3,_0x1b7c3e){return request(_0xe3c2('0x9'),{'account':_0x302dc3,'message':_0x1b7c3e});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 97066bf..4fc485e 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 _0x1f82=['gotoc','info','context','extension','priority','result','response','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','util','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','value','toJson','mxGraphModel','root','inspect','start','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','traverseBFS','clear','vertex','stringify'];(function(_0xf4a280,_0xdeedbc){var _0x15cbcc=function(_0x2d367b){while(--_0x2d367b){_0xf4a280['push'](_0xf4a280['shift']());}};_0x15cbcc(++_0xdeedbc);}(_0x1f82,0x179));var _0x21f8=function(_0x58b5d7,_0x79ca8a){_0x58b5d7=_0x58b5d7-0x0;var _0x817269=_0x1f82[_0x58b5d7];return _0x817269;};'use strict';var _=require(_0x21f8('0x0'));var moment=require(_0x21f8('0x1'));var parser=require('xml2json');var util=require(_0x21f8('0x2'));var logger=require(_0x21f8('0x3'))(_0x21f8('0x4'));var rpc=require('./rpc');var mailRpc=require(_0x21f8('0x5'));var Graph=require(_0x21f8('0x6'));var Vertices=require(_0x21f8('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x21f8('0x8')]()[_0x21f8('0x9')](function(_0x3a25fa){logger[_0x21f8('0xa')](_0x21f8('0xb'),_0x3a25fa[_0x21f8('0xc')]);return[];});}function addVertex(_0x531a38,_0x2ec946,_0x4ac0e4){_0x2ec946[_0x21f8('0xd')]=_0x4ac0e4;if(_0x2ec946[_0x21f8('0xe')](_0x21f8('0xf'))){_0x2ec946[_0x21f8('0x10')]=parseInt(_0x2ec946['retry'],0xa);}_0x531a38[_0x21f8('0x11')](_['omit'](_0x2ec946,_0x21f8('0x12')));}function initGraph(_0x121c51,_0x1d7073){var _0x2924fb=new Graph();for(var _0x532f0a in _0x121c51){if(_0x121c51[_0x21f8('0xe')](_0x532f0a)){if(_[_0x21f8('0x13')](_0x121c51[_0x532f0a])){for(var _0x2cc5fc=0x0;_0x2cc5fc<_0x121c51[_0x532f0a][_0x21f8('0x14')];_0x2cc5fc+=0x1){addVertex(_0x2924fb,_0x121c51[_0x532f0a][_0x2cc5fc],_0x532f0a);}}else{addVertex(_0x2924fb,_0x121c51[_0x532f0a],_0x532f0a);}}}for(var _0xd2760e=0x0;_0xd2760e<_0x1d7073[_0x21f8('0x14')];_0xd2760e+=0x1){if(_0x1d7073[_0xd2760e][_0x21f8('0x15')]&&_0x1d7073[_0xd2760e][_0x21f8('0x16')]){_0x2924fb['addEdge'](_0x1d7073[_0xd2760e][_0x21f8('0x15')],_0x1d7073[_0xd2760e]['target'],_0x1d7073[_0xd2760e][_0x21f8('0x17')]);}}return _0x2924fb;}function getRoot(_0x51f196){return parser[_0x21f8('0x18')](_0x51f196,{'object':!![]})[_0x21f8('0x19')][_0x21f8('0x1a')];}function inspect(_0x473f49){return util[_0x21f8('0x1b')](_0x473f49,{'showHidden':![],'depth':null});}function initialize(_0x14ef1a,_0x39a598){var _0x5e8e64=getRoot(_0x14ef1a['production']);if(!_0x5e8e64||!_0x5e8e64[_0x21f8('0x1c')])return;var _0x421f12,_0x3cd2c6,_0x32f061;logger[_0x21f8('0x1d')](_0x21f8('0x1a'),JSON['stringify'](_0x5e8e64,null,0x2));_0x39a598[_0x21f8('0x1e')]=moment()[_0x21f8('0x1f')](_0x21f8('0x20'));_0x421f12=initGraph(_[_0x21f8('0x21')](_0x5e8e64,_0x21f8('0x12')),_0x5e8e64['mxCell']);_0x3cd2c6=new Vertices(_0x39a598,rpc,mailRpc);logger['info'](util[_0x21f8('0x1f')](_0x21f8('0x22'),_0x39a598[_0x21f8('0x23')],_0x39a598[_0x21f8('0x24')],_0x39a598[_0x21f8('0x25')],_0x39a598[_0x21f8('0x26')],_0x39a598['uniqueid']));_0x421f12[_0x21f8('0x27')](_0x5e8e64[_0x21f8('0x1c')]['id'],function(_0x5a0411){try{_0x5a0411=_0x3cd2c6[_0x21f8('0x28')](_0x5a0411);logger[_0x21f8('0x1d')](_0x21f8('0x29'),JSON[_0x21f8('0x2a')](_0x5a0411,null,0x2));if(_0x5a0411[_0x21f8('0xd')]===_0x21f8('0x2b')){logger[_0x21f8('0x2c')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x39a598[_0x21f8('0x2d')]=_0x5a0411[_0x21f8('0x2d')]||_0x39a598['context'];_0x39a598['extension']=_0x5a0411[_0x21f8('0x2e')];_0x39a598[_0x21f8('0x2f')]=_0x5a0411[_0x21f8('0x2f')]?_0x5a0411[_0x21f8('0x2f')]-0x1:0x1;return null;}else if(_0x5a0411&&_0x3cd2c6[_0x5a0411['agicommand']]){_0x32f061=_0x3cd2c6[_0x5a0411[_0x21f8('0xd')]](_0x5a0411);logger[_0x21f8('0x2c')]('response',JSON[_0x21f8('0x2a')](_0x32f061,null,0x2));if(_0x32f061&&_0x32f061['code']===AGI_CODE_SUCCESS&&_0x32f061[_0x21f8('0x30')]!==AGI_RESULT_ERROR&&!_0x39a598['evtHangup']){logger[_0x21f8('0x1d')](_0x21f8('0x31'),inspect(_0x32f061));return _['isUndefined'](_0x32f061[_0x21f8('0x30')])?null:_0x32f061[_0x21f8('0x30')]['toString']();}else{logger['error'](_0x21f8('0x31'),inspect(_0x32f061));return null;}}else{logger[_0x21f8('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x47439d){logger['error'](_0x47439d[_0x21f8('0xc')]);return null;}});if(_0x5e8e64['finally']){logger[_0x21f8('0x2c')](util[_0x21f8('0x1f')](_0x21f8('0x32'),_0x39a598[_0x21f8('0x23')],_0x39a598[_0x21f8('0x24')],_0x39a598[_0x21f8('0x25')],_0x39a598['dnid'],_0x39a598['uniqueid']));_0x421f12[_0x21f8('0x27')](_0x5e8e64['finally']['id'],function(_0xa0d474){try{_0xa0d474=_0x3cd2c6[_0x21f8('0x28')](_0xa0d474);logger[_0x21f8('0x1d')](_0x21f8('0x29'),JSON[_0x21f8('0x2a')](_0xa0d474,null,0x2));if(_0xa0d474&&_0x3cd2c6[_0xa0d474[_0x21f8('0xd')]]){_0x32f061=_0x3cd2c6[_0xa0d474[_0x21f8('0xd')]](_0xa0d474);if(_0x32f061){logger[_0x21f8('0x1d')]('response',inspect(_0x32f061));return _[_0x21f8('0x33')](_0x32f061[_0x21f8('0x30')])?null:_0x32f061[_0x21f8('0x30')][_0x21f8('0x34')]();}else{logger[_0x21f8('0xa')](_0x21f8('0x31'),inspect(_0x32f061));return null;}}else{logger['error'](_0x21f8('0x35'));return null;}}catch(_0x3a8570){logger[_0x21f8('0xa')](_0x3a8570['stack']);return null;}});}logger[_0x21f8('0x2c')](util['format'](_0x21f8('0x36'),_0x39a598[_0x21f8('0x23')],_0x39a598['calleridname'],_0x39a598['callerid'],_0x39a598['dnid'],_0x39a598['uniqueid']));logger[_0x21f8('0x2c')](util[_0x21f8('0x1f')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x39a598[_0x21f8('0x2d')],_0x39a598[_0x21f8('0x2e')],parseInt(_0x39a598[_0x21f8('0x2f')],0xa)+0x1));_0x39a598['continueAt'](_0x39a598[_0x21f8('0x2d')],_0x39a598[_0x21f8('0x2e')],parseInt(_0x39a598['priority'],0xa)+0x1);_0x39a598[_0x21f8('0x37')]();}function handleNotFound(_0x4a9c2a){logger[_0x21f8('0xa')](util[_0x21f8('0x1f')](_0x21f8('0x38'),_0x4a9c2a[_0x21f8('0x23')]));_0x4a9c2a[_0x21f8('0x39')](_0x4a9c2a['context'],_0x4a9c2a[_0x21f8('0x2e')],parseInt(_0x4a9c2a['priority'],0xa)+0x1);_0x4a9c2a[_0x21f8('0x37')]();}function handleUnpublished(_0x4b2412){logger[_0x21f8('0xa')](util[_0x21f8('0x1f')](_0x21f8('0x3a'),_0x4b2412[_0x21f8('0x23')]));_0x4b2412[_0x21f8('0x39')](_0x4b2412[_0x21f8('0x2d')],_0x4b2412['extension'],parseInt(_0x4b2412[_0x21f8('0x2f')],0xa)+0x1);_0x4b2412[_0x21f8('0x37')]();}module[_0x21f8('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x5762=['context','extension','response','code','evtHangup','isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[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','priority','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','moment','xml2json','util','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','error','stack','agicommand','hasOwnProperty','retry','addVertex','omit','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','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','dnid','uniqueid','traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x3cb62c,_0x92f62f){var _0x1bda2b=function(_0x38e569){while(--_0x38e569){_0x3cb62c['push'](_0x3cb62c['shift']());}};_0x1bda2b(++_0x92f62f);}(_0x5762,0x8c));var _0x2576=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x5762[_0x1911ed];return _0x11edaa;};'use strict';var _=require(_0x2576('0x0'));var moment=require(_0x2576('0x1'));var parser=require(_0x2576('0x2'));var util=require(_0x2576('0x3'));var logger=require('../../config/logger')('agi');var rpc=require(_0x2576('0x4'));var mailRpc=require(_0x2576('0x5'));var Graph=require(_0x2576('0x6'));var Vertices=require(_0x2576('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x2576('0x8')]()['catch'](function(_0x141b84){logger[_0x2576('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x141b84[_0x2576('0xa')]);return[];});}function addVertex(_0x14e66e,_0x5c489e,_0xfdf38d){_0x5c489e[_0x2576('0xb')]=_0xfdf38d;if(_0x5c489e[_0x2576('0xc')](_0x2576('0xd'))){_0x5c489e['maxRetry']=parseInt(_0x5c489e[_0x2576('0xd')],0xa);}_0x14e66e[_0x2576('0xe')](_[_0x2576('0xf')](_0x5c489e,'mxCell'));}function initGraph(_0x435d3a,_0x483a48){var _0x3352bd=new Graph();for(var _0x4614c3 in _0x435d3a){if(_0x435d3a[_0x2576('0xc')](_0x4614c3)){if(_['isArray'](_0x435d3a[_0x4614c3])){for(var _0x3482aa=0x0;_0x3482aa<_0x435d3a[_0x4614c3][_0x2576('0x10')];_0x3482aa+=0x1){addVertex(_0x3352bd,_0x435d3a[_0x4614c3][_0x3482aa],_0x4614c3);}}else{addVertex(_0x3352bd,_0x435d3a[_0x4614c3],_0x4614c3);}}}for(var _0x43d526=0x0;_0x43d526<_0x483a48[_0x2576('0x10')];_0x43d526+=0x1){if(_0x483a48[_0x43d526][_0x2576('0x11')]&&_0x483a48[_0x43d526][_0x2576('0x12')]){_0x3352bd[_0x2576('0x13')](_0x483a48[_0x43d526][_0x2576('0x11')],_0x483a48[_0x43d526][_0x2576('0x12')],_0x483a48[_0x43d526][_0x2576('0x14')]);}}return _0x3352bd;}function getRoot(_0x5aed38){return parser[_0x2576('0x15')](_0x5aed38,{'object':!![]})[_0x2576('0x16')][_0x2576('0x17')];}function inspect(_0x284d03){return util[_0x2576('0x18')](_0x284d03,{'showHidden':![],'depth':null});}function initialize(_0x28272b,_0xe04c48){var _0x2cd194=getRoot(_0x28272b[_0x2576('0x19')]);if(!_0x2cd194||!_0x2cd194[_0x2576('0x1a')])return;var _0x29d6c2,_0x1e59a2,_0x598b5e;logger[_0x2576('0x1b')](_0x2576('0x17'),JSON[_0x2576('0x1c')](_0x2cd194,null,0x2));_0xe04c48[_0x2576('0x1d')]=moment()[_0x2576('0x1e')](_0x2576('0x1f'));_0x29d6c2=initGraph(_[_0x2576('0xf')](_0x2cd194,_0x2576('0x20')),_0x2cd194[_0x2576('0x20')]);_0x1e59a2=new Vertices(_0xe04c48,rpc,mailRpc);logger[_0x2576('0x21')](util[_0x2576('0x1e')](_0x2576('0x22'),_0xe04c48[_0x2576('0x23')],_0xe04c48[_0x2576('0x24')],_0xe04c48['callerid'],_0xe04c48[_0x2576('0x25')],_0xe04c48[_0x2576('0x26')]));_0x29d6c2[_0x2576('0x27')](_0x2cd194[_0x2576('0x1a')]['id'],function(_0x11ee65){try{_0x11ee65=_0x1e59a2[_0x2576('0x28')](_0x11ee65);logger[_0x2576('0x1b')](_0x2576('0x29'),JSON[_0x2576('0x1c')](_0x11ee65,null,0x2));if(_0x11ee65['agicommand']==='gotoc'){logger[_0x2576('0x21')](_0x2576('0x2a'));_0xe04c48[_0x2576('0x2b')]=_0x11ee65['context']||_0xe04c48[_0x2576('0x2b')];_0xe04c48[_0x2576('0x2c')]=_0x11ee65[_0x2576('0x2c')];_0xe04c48['priority']=_0x11ee65['priority']?_0x11ee65['priority']-0x1:0x1;return null;}else if(_0x11ee65&&_0x1e59a2[_0x11ee65[_0x2576('0xb')]]){_0x598b5e=_0x1e59a2[_0x11ee65[_0x2576('0xb')]](_0x11ee65);logger[_0x2576('0x21')](_0x2576('0x2d'),JSON[_0x2576('0x1c')](_0x598b5e,null,0x2));if(_0x598b5e&&_0x598b5e[_0x2576('0x2e')]===AGI_CODE_SUCCESS&&_0x598b5e['result']!==AGI_RESULT_ERROR&&!_0xe04c48[_0x2576('0x2f')]){logger[_0x2576('0x1b')](_0x2576('0x2d'),inspect(_0x598b5e));return _[_0x2576('0x30')](_0x598b5e['result'])?null:_0x598b5e[_0x2576('0x31')][_0x2576('0x32')]();}else{logger[_0x2576('0x9')](_0x2576('0x2d'),inspect(_0x598b5e));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x4fb025){logger[_0x2576('0x9')](_0x4fb025[_0x2576('0xa')]);return null;}});if(_0x2cd194[_0x2576('0x33')]){logger[_0x2576('0x21')](util['format'](_0x2576('0x34'),_0xe04c48[_0x2576('0x23')],_0xe04c48[_0x2576('0x24')],_0xe04c48[_0x2576('0x35')],_0xe04c48[_0x2576('0x25')],_0xe04c48[_0x2576('0x26')]));_0x29d6c2[_0x2576('0x27')](_0x2cd194[_0x2576('0x33')]['id'],function(_0x13537c){try{_0x13537c=_0x1e59a2[_0x2576('0x28')](_0x13537c);logger[_0x2576('0x1b')]('vertex',JSON['stringify'](_0x13537c,null,0x2));if(_0x13537c&&_0x1e59a2[_0x13537c[_0x2576('0xb')]]){_0x598b5e=_0x1e59a2[_0x13537c['agicommand']](_0x13537c);if(_0x598b5e){logger[_0x2576('0x1b')]('response',inspect(_0x598b5e));return _[_0x2576('0x30')](_0x598b5e[_0x2576('0x31')])?null:_0x598b5e[_0x2576('0x31')][_0x2576('0x32')]();}else{logger[_0x2576('0x9')]('response',inspect(_0x598b5e));return null;}}else{logger[_0x2576('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0xe3dfcc){logger[_0x2576('0x9')](_0xe3dfcc[_0x2576('0xa')]);return null;}});}logger[_0x2576('0x21')](util['format'](_0x2576('0x36'),_0xe04c48[_0x2576('0x23')],_0xe04c48[_0x2576('0x24')],_0xe04c48[_0x2576('0x35')],_0xe04c48[_0x2576('0x25')],_0xe04c48[_0x2576('0x26')]));logger['info'](util[_0x2576('0x1e')](_0x2576('0x37'),_0xe04c48[_0x2576('0x2b')],_0xe04c48[_0x2576('0x2c')],parseInt(_0xe04c48[_0x2576('0x38')],0xa)+0x1));_0xe04c48[_0x2576('0x39')](_0xe04c48[_0x2576('0x2b')],_0xe04c48[_0x2576('0x2c')],parseInt(_0xe04c48[_0x2576('0x38')],0xa)+0x1);_0xe04c48[_0x2576('0x3a')]();}function handleNotFound(_0x5914bb){logger[_0x2576('0x9')](util[_0x2576('0x1e')](_0x2576('0x3b'),_0x5914bb[_0x2576('0x23')]));_0x5914bb[_0x2576('0x39')](_0x5914bb[_0x2576('0x2b')],_0x5914bb[_0x2576('0x2c')],parseInt(_0x5914bb[_0x2576('0x38')],0xa)+0x1);_0x5914bb[_0x2576('0x3a')]();}function handleUnpublished(_0x55a36b){logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x55a36b[_0x2576('0x23')]));_0x55a36b['continueAt'](_0x55a36b[_0x2576('0x2b')],_0x55a36b[_0x2576('0x2c')],parseInt(_0x55a36b['priority'],0xa)+0x1);_0x55a36b[_0x2576('0x3a')]();}module[_0x2576('0x3c')]={'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 41f85ed..c846bd1 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 _0x4f20=['indexOf','substring','length','slice','trim','emit','headers','exports','stream','Transform','call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_localBuffer'];(function(_0x4aeb9a,_0x7c223d){var _0x3113ee=function(_0x119ad5){while(--_0x119ad5){_0x4aeb9a['push'](_0x4aeb9a['shift']());}};_0x3113ee(++_0x7c223d);}(_0x4f20,0x86));var _0x04f2=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4f20[_0x618414];return _0x21c19a;};'use strict';var util=require('util');var Transform=require(_0x04f2('0x0'))[_0x04f2('0x1')];function AGIReply(_0x45ff97){Transform[_0x04f2('0x2')](this,_0x45ff97);this['_localBuffer']='';this[_0x04f2('0x3')]=![];}util[_0x04f2('0x4')](AGIReply,Transform);AGIReply[_0x04f2('0x5')][_0x04f2('0x6')]=function(_0x20de45,_0x194568,_0x4ea8e0){var _0x2436b4='\x0a',_0xbd87f=['\x0a\x0a',_0x04f2('0x7')],_0xf9f124=-0x1,_0x586a0d=-0x1,_0x3d2827='',_0x5e8cb2=0x0,_0x52cde6='',_0x410a75='';this['_localBuffer']+=_0x20de45[_0x04f2('0x8')]();_0x52cde6=this[_0x04f2('0x9')];if(!this[_0x04f2('0x3')]){_0x5e8cb2=0x0;while(_0xbd87f[_0x5e8cb2]){while((_0x586a0d=_0x52cde6[_0x04f2('0xa')](_0xbd87f[_0x5e8cb2]))!=-0x1){_0x3d2827=_0xbd87f[_0x5e8cb2];_0x410a75=_0x52cde6[_0x04f2('0xb')](0x0,_0x586a0d);_0x52cde6=_0x52cde6['substring'](_0x586a0d+_0x3d2827[_0x04f2('0xc')]);var _0x4fa248=_0x410a75['split'](_0x2436b4),_0x484db0=0x0,_0x461bc2={},_0x2207cc='',_0x5c20b2='',_0x560a34=-0x1;while(_0x4fa248[_0x484db0]){_0x560a34=_0x4fa248[_0x484db0][_0x04f2('0xa')](':');if(_0x560a34!=-0x1){_0x2207cc=_0x4fa248[_0x484db0][_0x04f2('0xd')](0x0,_0x560a34)['trim']();_0x5c20b2=_0x4fa248[_0x484db0][_0x04f2('0xd')](_0x560a34+0x1)[_0x04f2('0xe')]();if(_0x2207cc['length']>0x0){_0x461bc2[_0x2207cc]=_0x5c20b2;}}else{}_0x484db0++;}this[_0x04f2('0xf')](_0x04f2('0x10'),_0x461bc2);this[_0x04f2('0x3')]=!![];}_0x5e8cb2++;}this['_localBuffer']=_0x52cde6;}else{while((_0xf9f124=_0x52cde6[_0x04f2('0xa')](_0x2436b4))!=-0x1){_0x410a75=_0x52cde6['substring'](0x0,_0xf9f124);this[_0x04f2('0xf')]('line',_0x410a75);_0x52cde6=_0x52cde6[_0x04f2('0xb')](_0xf9f124+_0x2436b4['length']);}this[_0x04f2('0x9')]=_0x52cde6;}_0x4ea8e0();};module[_0x04f2('0x11')]=AGIReply; \ No newline at end of file +var _0xd433=['_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','length','split','indexOf','slice','trim','emit','headers','line','substring','exports','util','stream','call','_localBuffer'];(function(_0x3cc751,_0x38b8ff){var _0x3956a2=function(_0x237cbc){while(--_0x237cbc){_0x3cc751['push'](_0x3cc751['shift']());}};_0x3956a2(++_0x38b8ff);}(_0xd433,0x1c8));var _0x3d43=function(_0x370bc4,_0x118300){_0x370bc4=_0x370bc4-0x0;var _0x53df59=_0xd433[_0x370bc4];return _0x53df59;};'use strict';var util=require(_0x3d43('0x0'));var Transform=require(_0x3d43('0x1'))['Transform'];function AGIReply(_0x23a6c4){Transform[_0x3d43('0x2')](this,_0x23a6c4);this[_0x3d43('0x3')]='';this[_0x3d43('0x4')]=![];}util[_0x3d43('0x5')](AGIReply,Transform);AGIReply[_0x3d43('0x6')][_0x3d43('0x7')]=function(_0x4509ba,_0x28f693,_0x17cbda){var _0x4f90fd='\x0a',_0x3d5ad4=['\x0a\x0a',_0x3d43('0x8')],_0x25900a=-0x1,_0x41ecb8=-0x1,_0x3e6af2='',_0x5eeefb=0x0,_0x16f08d='',_0x1edbf3='';this[_0x3d43('0x3')]+=_0x4509ba[_0x3d43('0x9')]();_0x16f08d=this[_0x3d43('0x3')];if(!this[_0x3d43('0x4')]){_0x5eeefb=0x0;while(_0x3d5ad4[_0x5eeefb]){while((_0x41ecb8=_0x16f08d['indexOf'](_0x3d5ad4[_0x5eeefb]))!=-0x1){_0x3e6af2=_0x3d5ad4[_0x5eeefb];_0x1edbf3=_0x16f08d['substring'](0x0,_0x41ecb8);_0x16f08d=_0x16f08d['substring'](_0x41ecb8+_0x3e6af2[_0x3d43('0xa')]);var _0x12fc91=_0x1edbf3[_0x3d43('0xb')](_0x4f90fd),_0x3e6c15=0x0,_0x504f77={},_0x294dbf='',_0x2c13bd='',_0x28e23e=-0x1;while(_0x12fc91[_0x3e6c15]){_0x28e23e=_0x12fc91[_0x3e6c15][_0x3d43('0xc')](':');if(_0x28e23e!=-0x1){_0x294dbf=_0x12fc91[_0x3e6c15][_0x3d43('0xd')](0x0,_0x28e23e)[_0x3d43('0xe')]();_0x2c13bd=_0x12fc91[_0x3e6c15][_0x3d43('0xd')](_0x28e23e+0x1)[_0x3d43('0xe')]();if(_0x294dbf['length']>0x0){_0x504f77[_0x294dbf]=_0x2c13bd;}}else{}_0x3e6c15++;}this[_0x3d43('0xf')](_0x3d43('0x10'),_0x504f77);this[_0x3d43('0x4')]=!![];}_0x5eeefb++;}this[_0x3d43('0x3')]=_0x16f08d;}else{while((_0x25900a=_0x16f08d['indexOf'](_0x4f90fd))!=-0x1){_0x1edbf3=_0x16f08d['substring'](0x0,_0x25900a);this['emit'](_0x3d43('0x11'),_0x1edbf3);_0x16f08d=_0x16f08d[_0x3d43('0x12')](_0x25900a+_0x4f90fd[_0x3d43('0xa')]);}this[_0x3d43('0x3')]=_0x16f08d;}_0x17cbda();};module[_0x3d43('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 026b64c..fcfc9d0 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 _0x6f0d=['client','http','request','then','error','message','result','catch','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise'];(function(_0x46904f,_0x21ffea){var _0x1d7c03=function(_0x402cfc){while(--_0x402cfc){_0x46904f['push'](_0x46904f['shift']());}};_0x1d7c03(++_0x21ffea);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x5debbd,_0x4c0b8e){_0x5debbd=_0x5debbd-0x0;var _0x1014d2=_0x6f0d[_0x5debbd];return _0x1014d2;};'use strict';var _=require('lodash');var moment=require(_0xd6f0('0x0'));var jayson=require(_0xd6f0('0x1'));var client=jayson[_0xd6f0('0x2')][_0xd6f0('0x3')]({'port':0x2329});function request(_0x573473,_0x275230){return new Promise(function(_0x135a93,_0x2f78fb){return client[_0xd6f0('0x4')](_0x573473,_0x275230)[_0xd6f0('0x5')](function(_0x59f5d2){if(_0x59f5d2[_0xd6f0('0x6')]){return _0x2f78fb(_0x59f5d2['error'][_0xd6f0('0x7')]);}else{return _0x135a93(_0x59f5d2[_0xd6f0('0x8')]);}})[_0xd6f0('0x9')](function(_0x1a48a0){return _0x2f78fb(_0x1a48a0);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xd6f0('0xa'),_0xd6f0('0xb')]}});};exports[_0xd6f0('0xc')]=function(_0x382a2e){return request(_0xd6f0('0xd'),{'options':{'raw':![],'where':{'name':_0x382a2e},'attributes':['production']}});};exports[_0xd6f0('0xe')]=function(_0xee144c){return request(_0xd6f0('0xf'),{'options':{'raw':![],'where':{'id':_0xee144c},'include':[{'model':_0xd6f0('0x10'),'as':'Smtp','include':[{'model':_0xd6f0('0x11'),'as':_0xd6f0('0x11')}]}],'attributes':['id',_0xd6f0('0xa'),_0xd6f0('0x12')],'smtp':!![]}});};exports[_0xd6f0('0x13')]=function(_0x409549){return request(_0xd6f0('0xd'),{'options':{'where':{'id':_0x409549},'attributes':[_0xd6f0('0xa')]}});};exports[_0xd6f0('0x14')]=function(_0x4ab979){return request(_0xd6f0('0x15'),{'options':{'where':{'id':_0x4ab979},'attributes':[_0xd6f0('0xa')]}});};exports['getVariableById']=function(_0x419b7e){return request('ShowVariable',{'options':{'where':{'id':_0x419b7e},'attributes':[_0xd6f0('0xa')]}});};exports[_0xd6f0('0x16')]=function(_0x41bd99){return request(_0xd6f0('0x17'),{'options':{'where':{'id':_0x41bd99},'attributes':[_0xd6f0('0x18')]}});};exports[_0xd6f0('0x19')]=function(_0x25da0c){return request(_0xd6f0('0x1a'),{'options':{'where':{'id':_0x25da0c},'attributes':[_0xd6f0('0xa')]}});};exports[_0xd6f0('0x1b')]=function(_0x23ab6c){return request(_0xd6f0('0x1c'),{'options':{'where':{'phone':_0x23ab6c[_0xd6f0('0x1d')]},'attributes':['id']}});};exports[_0xd6f0('0x1e')]=function(_0x1f43d7){return request(_0xd6f0('0x1f'),{'options':{'where':{'id':_0x1f43d7},'attributes':['name']}});};exports['getSoundById']=function(_0x3939aa){return request(_0xd6f0('0x20'),{'options':{'where':{'id':_0x3939aa},'attributes':[_0xd6f0('0x21')]}});};exports['getIntervalById']=function(_0x67afa7){return request(_0xd6f0('0x22'),{'options':{'raw':![],'where':{'id':_0x67afa7},'include':[{'model':'Interval','as':_0xd6f0('0x23')}]}});};exports['getSmsAccountById']=function(_0x1ee584){return request(_0xd6f0('0x24'),{'options':{'where':{'id':_0x1ee584},'attributes':['id','name']}});};exports[_0xd6f0('0x25')]=function(_0x45e99c){return request('CreateSmsMessage',{'body':_0x45e99c});};exports[_0xd6f0('0x26')]=function(_0x402070){return request(_0xd6f0('0x27'),{'body':_0x402070});};exports['createSquareReport']=function(_0x2ca8bb){return request(_0xd6f0('0x28'),{'body':_['merge'](_0x2ca8bb,{'project_name':_0x2ca8bb[_0xd6f0('0x29')],'prev_project_name':_0x2ca8bb['arg_2']||'','is_subproject':_0x2ca8bb[_0xd6f0('0x2a')]?!![]:![],'leaveAt':moment()[_0xd6f0('0x2b')](_0xd6f0('0x2c'))})});};exports[_0xd6f0('0x2d')]=function(_0x4101bd){return request(_0xd6f0('0x2e'),{'body':_0x4101bd});};exports[_0xd6f0('0x2f')]=function(_0x26799c){return request('CreateSquareMessage',{'body':_0x26799c});};exports[_0xd6f0('0x30')]=function(_0x1982d3){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x1982d3[_0xd6f0('0x1d')],'ListId':_0x1982d3[_0xd6f0('0x31')]}}})[_0xd6f0('0x5')](function(_0xb61222){if(_0xb61222){return _0xb61222;}return request(_0xd6f0('0x32'),{'body':_0x1982d3});});};exports[_0xd6f0('0x33')]=function(_0x351fda){return request(_0xd6f0('0x34'),{'options':{'where':{'id':_0x351fda},'attributes':[_0xd6f0('0xa')]}});};exports[_0xd6f0('0x35')]=function(_0x1dff9b,_0x3e913a){return request(_0xd6f0('0x36'),{'body':{'interface':_0x3e913a},'options':{'where':_0x1dff9b}});};exports[_0xd6f0('0x37')]=function(_0xbdd223,_0x2d7c90,_0x31c493){return request(_0xd6f0('0x38'),{'body':{'type':_0x2d7c90,'uniqueid':_0x31c493},'options':{'where':_0xbdd223}});};exports[_0xd6f0('0x39')]=function(_0x180e5f){return request(_0xd6f0('0x3a'),{'body':{},'options':{'where':_0x180e5f}});};exports[_0xd6f0('0x3b')]=function(_0x4a8ebe){return request(_0xd6f0('0x3c'),{'body':{},'options':{'where':_0x4a8ebe}});}; \ No newline at end of file +var _0x758e=['ShowVariable','ShowSquareOdbc','ShowUser','getContactByPhone','GetContactByPhone','ShowTrunk','getSoundById','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','agentPause','agentLogout','LogoutUser','lodash','client','http','request','then','error','message','result','getSquareProjects','ShowSquareProject','production','MailServerOut','Smtp','CloudProvider','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById'];(function(_0x1d5677,_0x342d27){var _0x274227=function(_0x5ead9c){while(--_0x5ead9c){_0x1d5677['push'](_0x1d5677['shift']());}};_0x274227(++_0x342d27);}(_0x758e,0x1af));var _0xe758=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x758e[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xe758('0x0'));var moment=require('moment');var jayson=require('jayson/promise');var client=jayson[_0xe758('0x1')][_0xe758('0x2')]({'port':0x2329});function request(_0xbc060d,_0x4b7512){return new Promise(function(_0x5e7714,_0x31641f){return client[_0xe758('0x3')](_0xbc060d,_0x4b7512)[_0xe758('0x4')](function(_0x2d60f4){if(_0x2d60f4['error']){return _0x31641f(_0x2d60f4[_0xe758('0x5')][_0xe758('0x6')]);}else{return _0x5e7714(_0x2d60f4[_0xe758('0x7')]);}})['catch'](function(_0x4c03ba){return _0x31641f(_0x4c03ba);});});}exports[_0xe758('0x8')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name','production']}});};exports['getSquareProject']=function(_0x314577){return request(_0xe758('0x9'),{'options':{'raw':![],'where':{'name':_0x314577},'attributes':[_0xe758('0xa')]}});};exports['getMailAccountById']=function(_0x3971f7){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3971f7},'include':[{'model':_0xe758('0xb'),'as':_0xe758('0xc'),'include':[{'model':_0xe758('0xd'),'as':'CloudProvider'}]}],'attributes':['id',_0xe758('0xe'),'email'],'smtp':!![]}});};exports[_0xe758('0xf')]=function(_0x279b93){return request(_0xe758('0x9'),{'options':{'where':{'id':_0x279b93},'attributes':[_0xe758('0xe')]}});};exports[_0xe758('0x10')]=function(_0x27517f){return request(_0xe758('0x11'),{'options':{'where':{'id':_0x27517f},'attributes':[_0xe758('0xe')]}});};exports[_0xe758('0x12')]=function(_0x509431){return request(_0xe758('0x13'),{'options':{'where':{'id':_0x509431},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x425d74){return request(_0xe758('0x14'),{'options':{'where':{'id':_0x425d74},'attributes':['dsn']}});};exports['getUserById']=function(_0x7ed4e9){return request(_0xe758('0x15'),{'options':{'where':{'id':_0x7ed4e9},'attributes':[_0xe758('0xe')]}});};exports[_0xe758('0x16')]=function(_0x3fe7e8){return request(_0xe758('0x17'),{'options':{'where':{'phone':_0x3fe7e8['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x44a6db){return request(_0xe758('0x18'),{'options':{'where':{'id':_0x44a6db},'attributes':[_0xe758('0xe')]}});};exports[_0xe758('0x19')]=function(_0x938a56){return request('ShowSound',{'options':{'where':{'id':_0x938a56},'attributes':['save_name']}});};exports[_0xe758('0x1a')]=function(_0xc7afba){return request(_0xe758('0x1b'),{'options':{'raw':![],'where':{'id':_0xc7afba},'include':[{'model':_0xe758('0x1c'),'as':'Intervals'}]}});};exports[_0xe758('0x1d')]=function(_0x39fbb2){return request(_0xe758('0x1e'),{'options':{'where':{'id':_0x39fbb2},'attributes':['id',_0xe758('0xe')]}});};exports[_0xe758('0x1f')]=function(_0x992bb5){return request(_0xe758('0x20'),{'body':_0x992bb5});};exports['createSquareDetailsReport']=function(_0x5a54df){return request('CreateSquareDetailsReport',{'body':_0x5a54df});};exports['createSquareReport']=function(_0x3efeb9){return request(_0xe758('0x21'),{'body':_[_0xe758('0x22')](_0x3efeb9,{'project_name':_0x3efeb9[_0xe758('0x23')],'prev_project_name':_0x3efeb9['arg_2']||'','is_subproject':_0x3efeb9[_0xe758('0x24')]?!![]:![],'leaveAt':moment()['format'](_0xe758('0x25'))})});};exports['createSquareRecording']=function(_0x5befbe){return request(_0xe758('0x26'),{'body':_0x5befbe});};exports[_0xe758('0x27')]=function(_0x2051f0){return request(_0xe758('0x28'),{'body':_0x2051f0});};exports['createCmContact']=function(_0xf00ed6){return request(_0xe758('0x29'),{'options':{'raw':![],'where':{'phone':_0xf00ed6[_0xe758('0x2a')],'ListId':_0xf00ed6[_0xe758('0x2b')]}}})['then'](function(_0x3a7e96){if(_0x3a7e96){return _0x3a7e96;}return request('CreateCmContact',{'body':_0xf00ed6});});};exports[_0xe758('0x2c')]=function(_0x3979cd){return request(_0xe758('0x2d'),{'options':{'where':{'id':_0x3979cd},'attributes':[_0xe758('0xe')]}});};exports[_0xe758('0x2e')]=function(_0x5be009,_0x4d7e4a){return request('LoginUser',{'body':{'interface':_0x4d7e4a},'options':{'where':_0x5be009}});};exports[_0xe758('0x2f')]=function(_0x53a413,_0x44f767,_0x1ee099){return request('PauseUser',{'body':{'type':_0x44f767,'uniqueid':_0x1ee099},'options':{'where':_0x53a413}});};exports['agentUnpause']=function(_0x401e51){return request('UnpauseUser',{'body':{},'options':{'where':_0x401e51}});};exports[_0xe758('0x30')]=function(_0x1d853c){return request(_0xe758('0x31'),{'body':{},'options':{'where':_0x1d853c}});}; \ 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 e4c2357..1a493e4 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 _0x9b69=['exports','./polly','./lex'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b69,0xa3));var _0x99b6=function(_0x1dd1cc,_0x159da6){_0x1dd1cc=_0x1dd1cc-0x0;var _0x4c9599=_0x9b69[_0x1dd1cc];return _0x4c9599;};var polly=require(_0x99b6('0x0'));var lex=require(_0x99b6('0x1'));module[_0x99b6('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x2bd8=['./polly','exports'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2bd8,0x130));var _0x82bd=function(_0x32ff9a,_0x187823){_0x32ff9a=_0x32ff9a-0x0;var _0x1c515b=_0x2bd8[_0x32ff9a];return _0x1c515b;};var polly=require(_0x82bd('0x0'));var lex=require('./lex');module[_0x82bd('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index c791b9f..0fba17f 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 _0x6324=['./lib/api','exports'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x6324,0x142));var _0x4632=function(_0x1d1722,_0x759c36){_0x1d1722=_0x1d1722-0x0;var _0x100055=_0x6324[_0x1d1722];return _0x100055;};'use strict';var lex=require(_0x4632('0x0'));module[_0x4632('0x1')]=function(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40){return lex(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40);}; \ No newline at end of file +var _0x668b=['./lib/api','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x668b,0x140));var _0xb668=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0x668b[_0x11a962];return _0x55d423;};'use strict';var lex=require(_0xb668('0x0'));module[_0xb668('0x1')]=function(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83){return lex(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83);}; \ 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 78be8b7..5bd3bb6 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(_0xbd201,_0x2d26d0){var _0x103c69=function(_0x1dc5c6){while(--_0x1dc5c6){_0xbd201['push'](_0xbd201['shift']());}};_0x103c69(++_0x2d26d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x389b0f,_0x3faa3e){var _0x175c1f=function(_0x8c6b8c){while(--_0x8c6b8c){_0x389b0f['push'](_0x389b0f['shift']());}};_0x175c1f(++_0x3faa3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 06963c8..e702022 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 _0xd4c4=['./lib/api','exports'];(function(_0x471b24,_0x1e00b1){var _0x16e841=function(_0x295677){while(--_0x295677){_0x471b24['push'](_0x471b24['shift']());}};_0x16e841(++_0x1e00b1);}(_0xd4c4,0xf8));var _0x4d4c=function(_0x533676,_0x2be01c){_0x533676=_0x533676-0x0;var _0x32f7bd=_0xd4c4[_0x533676];return _0x32f7bd;};'use strict';var polly=require(_0x4d4c('0x0'));module[_0x4d4c('0x1')]=function(_0xa34732,_0x1d1d05,_0xfea337,_0x5d5341,_0x2f3ef2,_0x3ead3e,_0x388342){return polly(_0xa34732,_0x1d1d05,_0xfea337,_0x5d5341,_0x2f3ef2,_0x3ead3e,_0x388342);}; \ No newline at end of file +var _0xd456=['exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd456,0x1da));var _0x6d45=function(_0x3edfec,_0x2d0038){_0x3edfec=_0x3edfec-0x0;var _0x29f9ab=_0xd456[_0x3edfec];return _0x29f9ab;};'use strict';var polly=require('./lib/api');module[_0x6d45('0x0')]=function(_0x3ec0b4,_0x21318d,_0x252d26,_0x48acd9,_0x1f1e0b,_0x1bcab3,_0x2510f1){return polly(_0x3ec0b4,_0x21318d,_0x252d26,_0x48acd9,_0x1f1e0b,_0x1bcab3,_0x2510f1);}; \ 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 7d49a17..17a238c 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 _0x9684=['mp3','path','bluebird','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x1655a4,_0x4f4e0a){var _0x4f9faf=function(_0x1679ab){while(--_0x1679ab){_0x1655a4['push'](_0x1655a4['shift']());}};_0x4f9faf(++_0x4f4e0a);}(_0x9684,0x12a));var _0x4968=function(_0x53d0cd,_0xb4a9b4){_0x53d0cd=_0x53d0cd-0x0;var _0x24e01f=_0x9684[_0x53d0cd];return _0x24e01f;};'use strict';var fs=require('fs');var path=require(_0x4968('0x0'));var BPromise=require(_0x4968('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x1b862f,_0x283912,_0x893b17){return new BPromise(function(_0x48a8ae,_0x53a320){_0x1b862f[_0x4968('0x2')](_0x283912,function(_0x4d607a,_0x4c774c){if(_0x4d607a){_0x53a320(_0x4d607a);}else if(_0x4c774c){if(_0x4c774c[_0x4968('0x3')]instanceof Buffer){fs[_0x4968('0x4')](_0x893b17,_0x4c774c['AudioStream'],function(_0x12080b){if(_0x12080b){_0x53a320(_0x12080b);}else{_0x48a8ae();}});}else{_0x53a320(new Error(_0x4968('0x5')));}}else{_0x53a320(new Error(_0x4968('0x6')));}});});}module[_0x4968('0x7')]=function(_0xed3f6,_0x379e9f,_0x2336ea,_0x22361e,_0x30dec6,_0x465a6e,_0x35b7ca){var _0x109b4b=new AWS[(_0x4968('0x8'))]({'accessKeyId':_0xed3f6,'secretAccessKey':_0x379e9f,'region':_0x2336ea});var _0x554a82={'Text':_0x30dec6,'TextType':_0x465a6e||_0x4968('0x9'),'OutputFormat':_0x4968('0xa'),'VoiceId':_0x22361e};return pollyResult(_0x109b4b,_0x554a82,_0x35b7ca);}; \ No newline at end of file +var _0x4843=['bluebird','randomstring','aws-sdk','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path'];(function(_0x511b14,_0x475bf1){var _0x9e1937=function(_0x1ec7aa){while(--_0x1ec7aa){_0x511b14['push'](_0x511b14['shift']());}};_0x9e1937(++_0x475bf1);}(_0x4843,0x107));var _0x3484=function(_0x4e2fef,_0x304017){_0x4e2fef=_0x4e2fef-0x0;var _0x30d08a=_0x4843[_0x4e2fef];return _0x30d08a;};'use strict';var fs=require('fs');var path=require(_0x3484('0x0'));var BPromise=require(_0x3484('0x1'));var rs=require(_0x3484('0x2'));var AWS=require(_0x3484('0x3'));function pollyResult(_0x6ad648,_0x5465d7,_0x2ec2eb){return new BPromise(function(_0x42142f,_0x13e891){_0x6ad648['synthesizeSpeech'](_0x5465d7,function(_0x223f88,_0x565dec){if(_0x223f88){_0x13e891(_0x223f88);}else if(_0x565dec){if(_0x565dec['AudioStream']instanceof Buffer){fs[_0x3484('0x4')](_0x2ec2eb,_0x565dec[_0x3484('0x5')],function(_0x5e2587){if(_0x5e2587){_0x13e891(_0x5e2587);}else{_0x42142f();}});}else{_0x13e891(new Error(_0x3484('0x6')));}}else{_0x13e891(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x3484('0x7')]=function(_0x27cce2,_0x11ab94,_0x9736ca,_0x2a3453,_0x298370,_0x1449e8,_0x4925b2){var _0x5e192d=new AWS[(_0x3484('0x8'))]({'accessKeyId':_0x27cce2,'secretAccessKey':_0x11ab94,'region':_0x9736ca});var _0x111ec4={'Text':_0x298370,'TextType':_0x1449e8||_0x3484('0x9'),'OutputFormat':_0x3484('0xa'),'VoiceId':_0x2a3453};return pollyResult(_0x5e192d,_0x111ec4,_0x4925b2);}; \ 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 3fe7a35..cb0da90 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 _0xd549=['./lib/api','exports'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0xd549,0x142));var _0x9d54=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xd549[_0x1d1779];return _0x2377e9;};'use strict';var asr=require(_0x9d54('0x0'));module[_0x9d54('0x1')]=function(_0x95aa4c,_0x4c1c02,_0x11a11e,_0x55348d){return asr(_0x95aa4c,_0x4c1c02,_0x11a11e);}; \ No newline at end of file +var _0x81ef=['./lib/api'];(function(_0x11930d,_0x1c69f0){var _0x23e47b=function(_0x1c802e){while(--_0x1c802e){_0x11930d['push'](_0x11930d['shift']());}};_0x23e47b(++_0x1c69f0);}(_0x81ef,0x90));var _0xf81e=function(_0x890769,_0x1c8085){_0x890769=_0x890769-0x0;var _0x46ece3=_0x81ef[_0x890769];return _0x46ece3;};'use strict';var asr=require(_0xf81e('0x0'));module['exports']=function(_0x429a13,_0x25b572,_0x9f6af1,_0xf48d3b){return asr(_0x429a13,_0x25b572,_0x9f6af1);}; \ 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 6eb7d13..bf34e0f 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 _0xc6d8=['lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x4be730,_0x341fe4){_0x4be730=_0x4be730-0x0;var _0x54bbe5=_0xc6d8[_0x4be730];return _0x54bbe5;};'use strict';var url=require(_0x8c6d('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x8c6d('0x1');module['exports']=function(_0x3b88d1,_0x5974d3,_0x292852){return new BPromise(function(_0x4fa8a4,_0x5b6b04){var _0x352b8c;if(typeof _0x3b88d1!==_0x8c6d('0x2')||_0x3b88d1[_0x8c6d('0x3')]===0x0){return _0x5b6b04(_0x8c6d('0x4'));}if(typeof _0x5974d3!==_0x8c6d('0x2')||_0x5974d3[_0x8c6d('0x3')]===0x0){return _0x5b6b04(_0x8c6d('0x5'));}if(typeof _0x292852!=='undefined'&&(typeof _0x292852!==_0x8c6d('0x2')||_0x292852[_0x8c6d('0x3')]===0x0)){return _0x5b6b04(_0x8c6d('0x6'));}try{_0x352b8c=fs['readFileSync'](_0x3b88d1)[_0x8c6d('0x7')](_0x8c6d('0x8'));}catch(_0x45e50e){return _0x5b6b04(_0x45e50e);}return _0x4fa8a4({'method':_0x8c6d('0x9'),'uri':host+_0x8c6d('0xa')+_0x5974d3,'body':{'config':{'encoding':_0x8c6d('0xb'),'sampleRateHertz':_0x8c6d('0xc'),'languageCode':_0x292852},'audio':{'content':_0x352b8c}},'json':!![]});});}; \ No newline at end of file +var _0xdab2=['lang\x20should\x20be\x20a\x20string','readFileSync','POST','/v1/speech:recognize?key=','url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x45ad8b,_0x4a8017){var _0x2da38a=function(_0x2c84c2){while(--_0x2c84c2){_0x45ad8b['push'](_0x45ad8b['shift']());}};_0x2da38a(++_0x4a8017);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var url=require(_0x2dab('0x0'));var BPromise=require(_0x2dab('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x2dab('0x2')]=function(_0x2aa420,_0x37079c,_0x16ac06){return new BPromise(function(_0x56a9cc,_0x2078be){var _0x2480cb;if(typeof _0x2aa420!==_0x2dab('0x3')||_0x2aa420[_0x2dab('0x4')]===0x0){return _0x2078be(_0x2dab('0x5'));}if(typeof _0x37079c!==_0x2dab('0x3')||_0x37079c[_0x2dab('0x4')]===0x0){return _0x2078be(_0x2dab('0x6'));}if(typeof _0x16ac06!==_0x2dab('0x7')&&(typeof _0x16ac06!==_0x2dab('0x3')||_0x16ac06[_0x2dab('0x4')]===0x0)){return _0x2078be(_0x2dab('0x8'));}try{_0x2480cb=fs[_0x2dab('0x9')](_0x2aa420)['toString']('base64');}catch(_0x26852f){return _0x2078be(_0x26852f);}return _0x56a9cc({'method':_0x2dab('0xa'),'uri':host+_0x2dab('0xb')+_0x37079c,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x16ac06},'audio':{'content':_0x2480cb}},'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 90c2cd4..e6f67d0 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 _0x6035=['./asr'];(function(_0x15d2e7,_0x575e70){var _0x2341c8=function(_0x2b0e62){while(--_0x2b0e62){_0x15d2e7['push'](_0x15d2e7['shift']());}};_0x2341c8(++_0x575e70);}(_0x6035,0xad));var _0x5603=function(_0x49abd5,_0x177adb){_0x49abd5=_0x49abd5-0x0;var _0x1a2a58=_0x6035[_0x49abd5];return _0x1a2a58;};var asr=require(_0x5603('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x4eae=['./asr'];(function(_0x295e6d,_0xeb1975){var _0x20edfa=function(_0x3ce783){while(--_0x3ce783){_0x295e6d['push'](_0x295e6d['shift']());}};_0x20edfa(++_0xeb1975);}(_0x4eae,0xdc));var _0xe4ea=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x4eae[_0x4b91c4];return _0x25cb80;};var asr=require(_0xe4ea('0x0'));module['exports']={'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 e4ea39e..cfc4986 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 _0xdf2e=['agi','https://api.ispeech.org/api/rest','protocol','host','path','WHAT_EVER','get','statusCode','request\x20to\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','error','download\x20error','pipe','end','https:','\x20failed,\x20status\x20code\x20=\x20','data','transcode','error\x20convert','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','then','unlink','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','writeFile','chmodSync','tmp','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','catch','googleDialogflow','textRequest','result','resolvedQuery','actionIncomplete','fulfillment','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','name','intent','displayName','isFallback','languageCode','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','awsPolly','polly','lex','ispeechTTS','format','ispeechASR','model=%s','freeform=3','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xdf2e,0xf5));var _0xedf2=function(_0x537501,_0x1509e4){_0x537501=_0x537501-0x0;var _0x54bfc2=_0xdf2e[_0x537501];return _0x54bfc2;};'use strict';var apiai=require(_0xedf2('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xedf2('0x1'));var fs=require('fs');var http=require(_0xedf2('0x2'));var https=require(_0xedf2('0x3'));var md5=require(_0xedf2('0x4'));var path=require('path');var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0xedf2('0x5'));var sox=require(_0xedf2('0x6'));var tts=require(_0xedf2('0x7'));var urlParse=require('url')[_0xedf2('0x8')];var util=require(_0xedf2('0x9'));var aws=require(_0xedf2('0xa'));var google=require(_0xedf2('0xb'));var sestek=require(_0xedf2('0xc'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0xedf2('0xd'));var ISPEECH_API=_0xedf2('0xe');function downloadFile(_0x4f6ac6,_0x3ddb30){return new BPromise(function(_0x206721,_0x14ccea){var _0x119700=urlParse(_0x4f6ac6);var _0x77a867=_0x119700[_0xedf2('0xf')]==='https:'?https:http;var _0x4e3a10={'host':_0x119700[_0xedf2('0x10')],'path':_0x119700[_0xedf2('0x11')],'headers':{'user-agent':_0xedf2('0x12')}};_0x77a867[_0xedf2('0x13')](_0x4e3a10,function(_0x13ffe3){if(_0x13ffe3[_0xedf2('0x14')]!==0xc8){logger['error'](_0xedf2('0x15')+_0x4f6ac6+'\x20failed,\x20status\x20code\x20=\x20'+_0x13ffe3['statusCode']+'\x20('+_0x13ffe3[_0xedf2('0x16')]+')');_0x14ccea(new Error(_0xedf2('0x15')+_0x4f6ac6+'\x20failed,\x20status\x20code\x20=\x20'+_0x13ffe3[_0xedf2('0x14')]+'\x20('+_0x13ffe3[_0xedf2('0x16')]+')'));return;}var _0x1241fd=fs[_0xedf2('0x17')](_0x3ddb30);_0x1241fd['on'](_0xedf2('0x18'),function(){logger[_0xedf2('0x19')](_0xedf2('0x1a'));_0x1241fd['close'](_0x206721);});_0x1241fd['on']('error',function(_0x27fed1){fs['unlink'](_0x3ddb30);logger[_0xedf2('0x1b')](_0xedf2('0x1c'),_0x27fed1);_0x14ccea(_0x27fed1);});_0x13ffe3[_0xedf2('0x1d')](_0x1241fd);})['on'](_0xedf2('0x1b'),function(_0x26a164){logger[_0xedf2('0x1b')](_0x26a164);_0x14ccea(_0x26a164);})[_0xedf2('0x1e')]();});}function uploadFile(_0xb94639){return new BPromise(function(_0x4c600e,_0x5dd15d){var _0x15ea59=urlParse(_0xb94639);var _0x3bed7a=_0x15ea59[_0xedf2('0xf')]===_0xedf2('0x1f')?https:http;var _0x57c8ac={'host':_0x15ea59['host'],'path':_0x15ea59['path'],'headers':{'user-agent':_0xedf2('0x12')}};_0x3bed7a[_0xedf2('0x13')](_0x57c8ac,function(_0x425c79){if(_0x425c79['statusCode']!==0xc8){_0x5dd15d(new Error(_0xedf2('0x15')+_0xb94639+_0xedf2('0x20')+_0x425c79['statusCode']+'\x20('+_0x425c79['statusMessage']+')'));return;}var _0xb959cf='';_0x425c79['on'](_0xedf2('0x21'),function(_0x31529a){_0xb959cf+=_0x31529a;});_0x425c79['on']('end',function(){_0x4c600e(_0xb959cf);});})['on'](_0xedf2('0x1b'),function(_0x470847){_0x5dd15d(_0x470847);})[_0xedf2('0x1e')]();});}function convertFile(_0x364584,_0x15cb35){return new BPromise(function(_0xf2c2b9,_0x4a2c22){var _0x21153f=sox[_0xedf2('0x22')](_0x364584,_0x15cb35,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21153f['on'](_0xedf2('0x1b'),function(_0x47d1dc){logger[_0xedf2('0x1b')](_0xedf2('0x23'),_0x47d1dc);_0x4a2c22(_0x47d1dc);});_0x21153f['on'](_0xedf2('0x1e'),function(){logger[_0xedf2('0x19')](_0xedf2('0x24'));_0xf2c2b9();});_0x21153f['start']();});}function base64Decode(_0x35ed5f,_0x350814){var _0x506d54=path[_0xedf2('0x25')](__dirname,'tmp',rs[_0xedf2('0x26')](0x4)+_0xedf2('0x27'));fs[_0xedf2('0x28')](_0x506d54,_0x35ed5f,_0xedf2('0x29'));return convertFile(_0x506d54,_0x350814)[_0xedf2('0x2a')](function(){try{fs[_0xedf2('0x2b')](_0x506d54);fs['chmodSync'](_0x350814,_0xedf2('0x2c'));}catch(_0x8db4ff){logger[_0xedf2('0x1b')](_0x8db4ff);}return _0x350814[_0xedf2('0x2d')]('.')[0x0];});}function base64Encode(_0x4edfd1){var _0x2a8f41=fs['readFileSync'](_0x4edfd1);return new Buffer(_0x2a8f41)[_0xedf2('0x2e')]('base64');}exports[_0xedf2('0x2f')]=function(_0x1f769a,_0x2f7f76,_0x169e7d,_0x34a799,_0x270f89,_0x492081){var _0x349c40,_0xe3ea81;var _0xa0034b=_0xedf2('0x30');var _0x2157cc=_0xedf2('0x31')+_0x1f769a;var _0x2483ae={};if(_0x2f7f76==='ssml'){_0x2483ae[_0xedf2('0x32')]={'ssml':_0x169e7d};}else{_0x2483ae[_0xedf2('0x32')]={'text':_0x169e7d};};_0x2483ae[_0xedf2('0x33')]={'languageCode':_0x34a799,'ssmlGender':_0x270f89};_0x2483ae[_0xedf2('0x34')]={'audioEncoding':_0xedf2('0x35'),'sampleRateHertz':0x1f40};var _0x2a1cb1={'url':_0xa0034b+_0xedf2('0x36')+_0x2157cc,'method':_0xedf2('0x37'),'json':!![],'body':_0x2483ae};return rp(_0x2a1cb1)[_0xedf2('0x2a')](function(_0x19cf4f){return new BPromise(function(_0x2833e3,_0x4a327d){_0x349c40=path['resolve'](__dirname,'tmp',rs[_0xedf2('0x26')](0x4)+_0xedf2('0x38'));var _0x3e1075=Buffer[_0xedf2('0x39')](_0x19cf4f['audioContent'],_0xedf2('0x29'));return fs[_0xedf2('0x3a')](_0x349c40,_0x3e1075,function(_0x3a13d6){_0x4a327d(_0x3a13d6);},function(_0x1178b9){fs[_0xedf2('0x3b')](_0x349c40,_0xedf2('0x2c'));_0x2833e3(_0x1178b9);});});})['then'](function(_0x1d1528){_0xe3ea81=path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs[_0xedf2('0x26')](0x4)+_0xedf2('0x27'));return convertFile(_0x349c40,_0xe3ea81);})[_0xedf2('0x2a')](function(){try{fs[_0xedf2('0x2b')](_0x349c40);fs[_0xedf2('0x3b')](_0xe3ea81,_0xedf2('0x2c'));}catch(_0x50c074){logger[_0xedf2('0x1b')](_0x50c074);}logger[_0xedf2('0x19')](_0xedf2('0x3d'),_0xe3ea81[_0xedf2('0x2d')]('.')[0x0]);return _0xe3ea81[_0xedf2('0x2d')]('.')[0x0];});};exports['googleTTS']=function(_0x3cd215,_0x5193c7){var _0x5d1948=_0xedf2('0x3e');var _0x358a6c,_0x3f858b;var _0x30ef7c;var _0x1120a2={'encoding':_0xedf2('0x3f'),'method':_0xedf2('0x37'),'timeout':0x2710,'url':_0x5d1948,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0xedf2('0x40')]([[[_0xedf2('0x41'),JSON[_0xedf2('0x40')]([_0x3cd215,_0x5193c7||'en',![],_0xedf2('0x42')]),null,_0xedf2('0x43')]]]))};return rp(_0x1120a2)[_0xedf2('0x2a')](function(_0x1751c7){try{_0x30ef7c=eval(_0x1751c7[_0xedf2('0x44')](0x5))[0x0][0x2];}catch(_0x56b573){throw new Error(_0xedf2('0x45')+_0x1751c7[_0xedf2('0x21')]);}if(!_0x30ef7c){if(_0x3cd215[_0xedf2('0x46')]>0xc8){throw new Error(_0xedf2('0x47'));}else{throw new Error(_0xedf2('0x48')+_0x5193c7+'\x22\x20might\x20not\x20exist');}}try{_0x30ef7c=eval(_0x30ef7c)[0x0];}catch(_0xb29229){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xedf2('0x21')]);}const _0x277b07=_0x30ef7c;_0x358a6c=path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs[_0xedf2('0x26')](0x4)+_0xedf2('0x38'));fs[_0xedf2('0x28')](_0x358a6c,_0x30ef7c,{'encoding':'base64'});_0x3f858b=path['resolve'](__dirname,_0xedf2('0x3c'),rs[_0xedf2('0x26')](0x4)+_0xedf2('0x27'));return convertFile(_0x358a6c,_0x3f858b);})[_0xedf2('0x2a')](function(){try{fs['unlink'](_0x358a6c);fs[_0xedf2('0x3b')](_0x3f858b,_0xedf2('0x2c'));}catch(_0x66f531){logger['error'](_0x66f531);}logger[_0xedf2('0x19')](_0xedf2('0x49'),_0x3f858b[_0xedf2('0x2d')]('.')[0x0]);return _0x3f858b['split']('.')[0x0];});};exports['googleASR']=function(_0x87ece6,_0x3067ce,_0x30cc82){return google['asr'](_0x87ece6,_0x3067ce,_0x30cc82)['then'](function(_0x44f488){logger[_0xedf2('0x19')](_0x44f488[_0xedf2('0x4a')]);return rp(_0x44f488);})[_0xedf2('0x2a')](function(_0x2eb2e8){var _0x1085b2='';var _0x4a1ee7=0x0;try{fs['unlink'](_0x87ece6);}catch(_0x35d6a4){logger['error'](_0x35d6a4);}if(_0x2eb2e8&&_0x2eb2e8[_0xedf2('0x4b')]){_0x1085b2=_0x2eb2e8[_0xedf2('0x4b')][_0xedf2('0x4c')](function(_0x21dc5c){return _0x21dc5c&&_0x21dc5c[_0xedf2('0x4d')][0x0]&&_0x21dc5c[_0xedf2('0x4d')][0x0]['transcript']?_0x21dc5c['alternatives'][0x0][_0xedf2('0x4e')]:'';})['join']('\x0a');_0x4a1ee7=_0x2eb2e8[_0xedf2('0x4b')][_0xedf2('0x4c')](function(_0x27a194){return _0x27a194&&_0x27a194['alternatives'][0x0]&&_0x27a194[_0xedf2('0x4d')][0x0][_0xedf2('0x4f')]?_0x27a194['alternatives'][0x0][_0xedf2('0x4f')]:0x0;})[_0xedf2('0x50')]('\x0a');}logger[_0xedf2('0x19')](_0xedf2('0x51'),_0x1085b2);logger['info']('googleASR\x20confidence',_0x4a1ee7);return{'transcript':_0x1085b2,'confidence':_0x4a1ee7};})[_0xedf2('0x52')](function(_0x6fc7f6){logger[_0xedf2('0x1b')]('[%s]\x20%s:%s',_0x6fc7f6[_0xedf2('0x14')],_0x6fc7f6['name'],_0x6fc7f6['message']);});};exports[_0xedf2('0x53')]=function(_0x1c54e1,_0x23585a,_0x2cf6cd,_0x3b82dd){var _0x481509=apiai(_0x23585a,{'language':_0x3b82dd||'en'});return _0x481509[_0xedf2('0x54')](_0x2cf6cd,{'sessionId':md5(_0x1c54e1)})[_0xedf2('0x2a')](function(_0x47b00b){logger[_0xedf2('0x19')](JSON[_0xedf2('0x40')](_0x47b00b));return{'source':_0x47b00b[_0xedf2('0x55')]['source'],'resolvedQuery':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x56')],'action':_0x47b00b[_0xedf2('0x55')]['action'],'actionIncomplete':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x57')],'speech':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x58')]['speech'],'score':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x59')],'statusCode':_0x47b00b[_0xedf2('0x5a')][_0xedf2('0x5b')],'endConversation':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x5c')]['endConversation']||![],'isFallbackIntent':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x5c')][_0xedf2('0x5d')]};});};exports[_0xedf2('0x5e')]=function(_0x12cd94,_0x76b3f5,_0xd1377b,_0x2b29d,_0x231977,_0x724640){var _0x4ac967=_0x2b29d[_0xedf2('0x5f')](/\\n/g,'\x0a');var _0x146498={'credentials':{'private_key':_0x4ac967,'client_email':_0xd1377b}};var _0x209824=new dialogflow[(_0xedf2('0x60'))](_0x146498);var _0x54d95a=_0x209824[_0xedf2('0x61')](_0x76b3f5,md5(_0x12cd94));var _0x3bf078={'session':_0x54d95a,'queryInput':{'text':{'text':_0x231977,'languageCode':_0x724640}}};return _0x209824[_0xedf2('0x62')](_0x3bf078)[_0xedf2('0x2a')](function(_0x4f57a0){if(_0x4f57a0&&_0x4f57a0['length']){logger['info'](_0xedf2('0x63'),JSON[_0xedf2('0x40')](_0x4f57a0));var _0x40c433=_0x4f57a0[0x0];if(_0x40c433){var _0x42b7cc={'action':_0x40c433[_0xedf2('0x64')]['action'],'allRequiredParamsPresent':_0x40c433['queryResult'][_0xedf2('0x65')],'endConversation':_0x40c433['queryResult'][_0xedf2('0x66')]&&_0x40c433['queryResult'][_0xedf2('0x66')][_0xedf2('0x67')]?_0x40c433[_0xedf2('0x64')][_0xedf2('0x66')][_0xedf2('0x67')]['end_conversation'][_0xedf2('0x68')]:![],'fulfillmentText':_0x40c433[_0xedf2('0x64')][_0xedf2('0x69')],'intentName':_0x40c433['queryResult']['intent'][_0xedf2('0x6a')],'intentDisplayName':_0x40c433[_0xedf2('0x64')][_0xedf2('0x6b')][_0xedf2('0x6c')],'isFallbackIntent':_0x40c433[_0xedf2('0x64')][_0xedf2('0x6b')][_0xedf2('0x6d')],'languageCode':_0x40c433[_0xedf2('0x64')][_0xedf2('0x6e')],'queryText':_0x40c433['queryResult']['queryText'],'responseId':_0x40c433['responseId'],'score':_0x40c433[_0xedf2('0x64')][_0xedf2('0x6f')],'speech':_0x40c433[_0xedf2('0x64')][_0xedf2('0x69')],'providerResponse':JSON['stringify'](_0x4f57a0)};return _0x42b7cc;}}});};exports[_0xedf2('0x70')]=function(_0x340b53,_0x1a0746,_0x3a4ca9,_0x412052){return tilde[_0xedf2('0x71')](_0x340b53,_0x1a0746,_0x3a4ca9,_0x412052)[_0xedf2('0x2a')](function(_0x339751){try{fs['unlink'](_0x340b53);}catch(_0x35fd5f){logger[_0xedf2('0x1b')](_0x35fd5f);}logger[_0xedf2('0x19')](_0xedf2('0x72'),_0x339751[_0xedf2('0x4e')]);logger[_0xedf2('0x19')]('Tilde\x20ASR\x20confidence',_0x339751['confidence']);return _0x339751;});};exports[_0xedf2('0x73')]=function(_0x228339,_0x1301d4,_0x266517,_0x5a1033,_0xb34b77,_0x257f8f){var _0x2ca0e0=path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs['generate'](0x4)+_0xedf2('0x38'));var _0x596d8d;return aws[_0xedf2('0x74')](_0x228339,_0x1301d4,_0x266517,_0x5a1033,_0xb34b77,_0x257f8f,_0x2ca0e0)[_0xedf2('0x2a')](function(){_0x596d8d=path[_0xedf2('0x25')](__dirname,'tmp',rs[_0xedf2('0x26')](0x4)+_0xedf2('0x27'));return convertFile(_0x2ca0e0,_0x596d8d);})[_0xedf2('0x2a')](function(){try{fs[_0xedf2('0x2b')](_0x2ca0e0);fs[_0xedf2('0x3b')](_0x596d8d,_0xedf2('0x2c'));}catch(_0x53778d){logger[_0xedf2('0x1b')](_0x53778d);}return _0x596d8d['split']('.')[0x0];});};exports['awsLex']=function(_0x5ce888,_0x206723,_0xecb2b2,_0x520532,_0x500e72,_0x23b855){return aws[_0xedf2('0x75')](_0x5ce888,_0x206723,_0xecb2b2,_0x520532,_0x500e72,_0x23b855)['then'](function(_0xf36d18){logger['info'](JSON[_0xedf2('0x40')](_0xf36d18));return _0xf36d18;});};exports[_0xedf2('0x76')]=function(_0x24798b,_0x3f1620,_0x447994,_0x3eb919){var _0x4875f7=util[_0xedf2('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x24798b,encodeURIComponent(_0x3f1620),_0x447994,_0x3eb919);var _0x35db3f=path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs[_0xedf2('0x26')](0x4)+'.mp3');var _0xcd314e;return downloadFile(_0x4875f7,_0x35db3f)[_0xedf2('0x2a')](function(){_0xcd314e=path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs[_0xedf2('0x26')](0x4)+_0xedf2('0x27'));return convertFile(_0x35db3f,_0xcd314e);})['then'](function(){try{fs[_0xedf2('0x2b')](_0x35db3f);fs[_0xedf2('0x3b')](_0xcd314e,_0xedf2('0x2c'));}catch(_0xad692a){logger[_0xedf2('0x1b')](_0xad692a);}return _0xcd314e[_0xedf2('0x2d')]('.')[0x0];});};exports[_0xedf2('0x78')]=function(_0x56b660,_0x14ab2a,_0x3ea724,_0x2af5bd){var _0x3c4cde=util[_0xedf2('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x14ab2a,_0x3ea724,base64Encode(_0x56b660),_0x2af5bd?util['format'](_0xedf2('0x79'),encodeURIComponent(_0x2af5bd)):_0xedf2('0x7a'));return uploadFile(_0x3c4cde)['then'](function(_0x243781){return querystring['parse'](_0x243781);});};exports['sestekNDA']=function(_0x574137,_0x5ece8b){return sestek['nda'](_0x574137,_0x5ece8b)[_0xedf2('0x2a')](function(_0x33a315){logger[_0xedf2('0x19')](JSON[_0xedf2('0x40')](_0x33a315));var _0x32d1e9={'speech':_0x33a315['text'],'action':_0x33a315[_0xedf2('0x7b')]?_0x33a315['channelData']['CustomAction']:undefined,'actiondata':_0x33a315[_0xedf2('0x7b')]?_0x33a315[_0xedf2('0x7b')][_0xedf2('0x7c')]:undefined};if(_0x33a315['channelData']&&_0x33a315[_0xedf2('0x7b')][_0xedf2('0x7d')]){return base64Decode(_0x33a315['channelData']['AudioFromTts'][_0xedf2('0x7e')],path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs['generate'](0x4)+_0xedf2('0x27')))['then'](function(_0x23e70c){_0x32d1e9[_0xedf2('0x7f')]=_0x23e70c;return _0x32d1e9;});}return _0x32d1e9;});};exports[_0xedf2('0x80')]=function(){return __dirname;}; \ No newline at end of file +var _0x161b=['boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS','%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','nda','text','channelData','AudioFromTts','audiofile','dirName','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','info','finish\x20download\x20file','close','unlink','pipe','end','WHAT_EVER','data','transcode','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','.mp3','from','audioContent','then','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','[%s]\x20%s:%s','name','message','textRequest','result','resolvedQuery','action','fulfillment','score','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields'];(function(_0x3b2d98,_0xaa0b26){var _0x256bf1=function(_0x1fe933){while(--_0x1fe933){_0x3b2d98['push'](_0x3b2d98['shift']());}};_0x256bf1(++_0xaa0b26);}(_0x161b,0x19d));var _0xb161=function(_0x1f1bda,_0x49bf67){_0x1f1bda=_0x1f1bda-0x0;var _0x357549=_0x161b[_0x1f1bda];return _0x357549;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xb161('0x0'));var dialogflow=require(_0xb161('0x1'));var fs=require('fs');var http=require(_0xb161('0x2'));var https=require(_0xb161('0x3'));var md5=require(_0xb161('0x4'));var path=require(_0xb161('0x5'));var querystring=require(_0xb161('0x6'));var rp=require('request-promise');var rs=require(_0xb161('0x7'));var sox=require(_0xb161('0x8'));var tts=require(_0xb161('0x9'));var urlParse=require(_0xb161('0xa'))[_0xb161('0xb')];var util=require(_0xb161('0xc'));var aws=require('./aws');var google=require(_0xb161('0xd'));var sestek=require('./sestek');var tilde=require(_0xb161('0xe'));var logger=require(_0xb161('0xf'))(_0xb161('0x10'));var ISPEECH_API=_0xb161('0x11');function downloadFile(_0x5db0dc,_0x438827){return new BPromise(function(_0x607e64,_0x3cb09c){var _0x519749=urlParse(_0x5db0dc);var _0x3c7cb6=_0x519749[_0xb161('0x12')]===_0xb161('0x13')?https:http;var _0x1df433={'host':_0x519749[_0xb161('0x14')],'path':_0x519749[_0xb161('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x3c7cb6[_0xb161('0x15')](_0x1df433,function(_0x4b38b7){if(_0x4b38b7['statusCode']!==0xc8){logger[_0xb161('0x16')](_0xb161('0x17')+_0x5db0dc+_0xb161('0x18')+_0x4b38b7['statusCode']+'\x20('+_0x4b38b7['statusMessage']+')');_0x3cb09c(new Error(_0xb161('0x17')+_0x5db0dc+_0xb161('0x18')+_0x4b38b7[_0xb161('0x19')]+'\x20('+_0x4b38b7[_0xb161('0x1a')]+')'));return;}var _0x39465d=fs['createWriteStream'](_0x438827);_0x39465d['on'](_0xb161('0x1b'),function(){logger[_0xb161('0x1c')](_0xb161('0x1d'));_0x39465d[_0xb161('0x1e')](_0x607e64);});_0x39465d['on'](_0xb161('0x16'),function(_0x32035a){fs[_0xb161('0x1f')](_0x438827);logger[_0xb161('0x16')]('download\x20error',_0x32035a);_0x3cb09c(_0x32035a);});_0x4b38b7[_0xb161('0x20')](_0x39465d);})['on']('error',function(_0x1c10ae){logger[_0xb161('0x16')](_0x1c10ae);_0x3cb09c(_0x1c10ae);})[_0xb161('0x21')]();});}function uploadFile(_0x3e2188){return new BPromise(function(_0xfc865c,_0x16908e){var _0x560fd3=urlParse(_0x3e2188);var _0x27dc51=_0x560fd3['protocol']===_0xb161('0x13')?https:http;var _0x101e6f={'host':_0x560fd3[_0xb161('0x14')],'path':_0x560fd3['path'],'headers':{'user-agent':_0xb161('0x22')}};_0x27dc51[_0xb161('0x15')](_0x101e6f,function(_0x43169c){if(_0x43169c[_0xb161('0x19')]!==0xc8){_0x16908e(new Error(_0xb161('0x17')+_0x3e2188+_0xb161('0x18')+_0x43169c[_0xb161('0x19')]+'\x20('+_0x43169c['statusMessage']+')'));return;}var _0x1c434d='';_0x43169c['on'](_0xb161('0x23'),function(_0x423f94){_0x1c434d+=_0x423f94;});_0x43169c['on'](_0xb161('0x21'),function(){_0xfc865c(_0x1c434d);});})['on'](_0xb161('0x16'),function(_0x40e599){_0x16908e(_0x40e599);})[_0xb161('0x21')]();});}function convertFile(_0x450bff,_0x163431){return new BPromise(function(_0x4badc1,_0x2c3a0d){var _0x13fb86=sox[_0xb161('0x24')](_0x450bff,_0x163431,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x13fb86['on'](_0xb161('0x16'),function(_0x423a2f){logger['error']('error\x20convert',_0x423a2f);_0x2c3a0d(_0x423a2f);});_0x13fb86['on'](_0xb161('0x21'),function(){logger[_0xb161('0x1c')](_0xb161('0x25'));_0x4badc1();});_0x13fb86[_0xb161('0x26')]();});}function base64Decode(_0x3e57c0,_0x4024ed){var _0x4fb368=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+_0xb161('0x2a'));fs[_0xb161('0x2b')](_0x4fb368,_0x3e57c0,_0xb161('0x2c'));return convertFile(_0x4fb368,_0x4024ed)['then'](function(){try{fs[_0xb161('0x1f')](_0x4fb368);fs[_0xb161('0x2d')](_0x4024ed,_0xb161('0x2e'));}catch(_0x1b364a){logger['error'](_0x1b364a);}return _0x4024ed[_0xb161('0x2f')]('.')[0x0];});}function base64Encode(_0xc8a153){var _0x4e3049=fs[_0xb161('0x30')](_0xc8a153);return new Buffer(_0x4e3049)[_0xb161('0x31')]('base64');}exports[_0xb161('0x32')]=function(_0x557055,_0x1e8974,_0x2753d7,_0x54e084,_0x1dd331,_0x55bfa7){var _0x27f0fc,_0x4a2d4c;var _0x565059=_0xb161('0x33');var _0x246675=_0xb161('0x34')+_0x557055;var _0x399d47={};if(_0x1e8974===_0xb161('0x35')){_0x399d47[_0xb161('0x36')]={'ssml':_0x2753d7};}else{_0x399d47[_0xb161('0x36')]={'text':_0x2753d7};};_0x399d47[_0xb161('0x37')]={'languageCode':_0x54e084,'ssmlGender':_0x1dd331};_0x399d47[_0xb161('0x38')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5eedb0={'url':_0x565059+_0xb161('0x39')+_0x246675,'method':_0xb161('0x3a'),'json':!![],'body':_0x399d47};return rp(_0x5eedb0)['then'](function(_0x4cacd6){return new BPromise(function(_0x229f8c,_0x487089){_0x27f0fc=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+_0xb161('0x3b'));var _0x1a9c18=Buffer[_0xb161('0x3c')](_0x4cacd6[_0xb161('0x3d')],'base64');return fs['writeFile'](_0x27f0fc,_0x1a9c18,function(_0x3bf39a){_0x487089(_0x3bf39a);},function(_0x6324f2){fs[_0xb161('0x2d')](_0x27f0fc,_0xb161('0x2e'));_0x229f8c(_0x6324f2);});});})['then'](function(_0xff1302){_0x4a2d4c=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+_0xb161('0x2a'));return convertFile(_0x27f0fc,_0x4a2d4c);})[_0xb161('0x3e')](function(){try{fs[_0xb161('0x1f')](_0x27f0fc);fs[_0xb161('0x2d')](_0x4a2d4c,_0xb161('0x2e'));}catch(_0x22f0ff){logger[_0xb161('0x16')](_0x22f0ff);}logger[_0xb161('0x1c')]('googleCloudTTS\x20path',_0x4a2d4c[_0xb161('0x2f')]('.')[0x0]);return _0x4a2d4c[_0xb161('0x2f')]('.')[0x0];});};exports[_0xb161('0x3f')]=function(_0xbb2979,_0x3dc130){var _0x2ebf79='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x448552,_0x5f5e17;var _0xcafcc5;var _0x286f06={'encoding':_0xb161('0x40'),'method':_0xb161('0x3a'),'timeout':0x2710,'url':_0x2ebf79,'headers':{'Content-Type':_0xb161('0x41')},'body':_0xb161('0x42')+encodeURIComponent(JSON[_0xb161('0x43')]([[[_0xb161('0x44'),JSON['stringify']([_0xbb2979,_0x3dc130||'en',![],_0xb161('0x45')]),null,_0xb161('0x46')]]]))};return rp(_0x286f06)[_0xb161('0x3e')](function(_0x54c24e){try{_0xcafcc5=eval(_0x54c24e[_0xb161('0x47')](0x5))[0x0][0x2];}catch(_0x1b57c2){throw new Error('parse\x20response\x20failed:\x0a'+_0x54c24e[_0xb161('0x23')]);}if(!_0xcafcc5){if(_0xbb2979[_0xb161('0x48')]>0xc8){throw new Error(_0xb161('0x49'));}else{throw new Error(_0xb161('0x4a')+_0x3dc130+_0xb161('0x4b'));}}try{_0xcafcc5=eval(_0xcafcc5)[0x0];}catch(_0x229f51){throw new Error(_0xb161('0x4c')+res[_0xb161('0x23')]);}const _0xf475a9=_0xcafcc5;_0x448552=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+'.mp3');fs[_0xb161('0x2b')](_0x448552,_0xcafcc5,{'encoding':_0xb161('0x2c')});_0x5f5e17=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+_0xb161('0x2a'));return convertFile(_0x448552,_0x5f5e17);})['then'](function(){try{fs['unlink'](_0x448552);fs[_0xb161('0x2d')](_0x5f5e17,_0xb161('0x2e'));}catch(_0xb5d513){logger[_0xb161('0x16')](_0xb5d513);}logger[_0xb161('0x1c')](_0xb161('0x4d'),_0x5f5e17[_0xb161('0x2f')]('.')[0x0]);return _0x5f5e17[_0xb161('0x2f')]('.')[0x0];});};exports['googleASR']=function(_0x140de1,_0x2f60d3,_0x5249c8){return google[_0xb161('0x4e')](_0x140de1,_0x2f60d3,_0x5249c8)[_0xb161('0x3e')](function(_0x1b64d1){logger[_0xb161('0x1c')](_0x1b64d1[_0xb161('0x4f')]);return rp(_0x1b64d1);})['then'](function(_0x305608){var _0x319210='';var _0x500109=0x0;try{fs['unlink'](_0x140de1);}catch(_0x33fac7){logger['error'](_0x33fac7);}if(_0x305608&&_0x305608[_0xb161('0x50')]){_0x319210=_0x305608[_0xb161('0x50')][_0xb161('0x51')](function(_0x4e827a){return _0x4e827a&&_0x4e827a[_0xb161('0x52')][0x0]&&_0x4e827a['alternatives'][0x0][_0xb161('0x53')]?_0x4e827a[_0xb161('0x52')][0x0][_0xb161('0x53')]:'';})[_0xb161('0x54')]('\x0a');_0x500109=_0x305608[_0xb161('0x50')][_0xb161('0x51')](function(_0x4b9261){return _0x4b9261&&_0x4b9261['alternatives'][0x0]&&_0x4b9261['alternatives'][0x0][_0xb161('0x55')]?_0x4b9261[_0xb161('0x52')][0x0]['confidence']:0x0;})[_0xb161('0x54')]('\x0a');}logger[_0xb161('0x1c')]('googleASR\x20transcription',_0x319210);logger[_0xb161('0x1c')]('googleASR\x20confidence',_0x500109);return{'transcript':_0x319210,'confidence':_0x500109};})['catch'](function(_0x3d103d){logger['error'](_0xb161('0x56'),_0x3d103d[_0xb161('0x19')],_0x3d103d[_0xb161('0x57')],_0x3d103d[_0xb161('0x58')]);});};exports['googleDialogflow']=function(_0x1c7399,_0x37af74,_0x2a5384,_0x5dff61){var _0x4c3253=apiai(_0x37af74,{'language':_0x5dff61||'en'});return _0x4c3253[_0xb161('0x59')](_0x2a5384,{'sessionId':md5(_0x1c7399)})['then'](function(_0x38b4c7){logger[_0xb161('0x1c')](JSON[_0xb161('0x43')](_0x38b4c7));return{'source':_0x38b4c7['result']['source'],'resolvedQuery':_0x38b4c7[_0xb161('0x5a')][_0xb161('0x5b')],'action':_0x38b4c7['result'][_0xb161('0x5c')],'actionIncomplete':_0x38b4c7[_0xb161('0x5a')]['actionIncomplete'],'speech':_0x38b4c7[_0xb161('0x5a')][_0xb161('0x5d')]['speech'],'score':_0x38b4c7[_0xb161('0x5a')][_0xb161('0x5e')],'statusCode':_0x38b4c7['status'][_0xb161('0x5f')],'endConversation':_0x38b4c7[_0xb161('0x5a')][_0xb161('0x60')][_0xb161('0x61')]||![],'isFallbackIntent':_0x38b4c7[_0xb161('0x5a')][_0xb161('0x60')]['isFallbackIntent']};});};exports[_0xb161('0x62')]=function(_0x399d42,_0xca4278,_0x31d986,_0x51819c,_0x230321,_0x5dc200){var _0xe20b53=_0x51819c[_0xb161('0x63')](/\\n/g,'\x0a');var _0x11e12e={'credentials':{'private_key':_0xe20b53,'client_email':_0x31d986}};var _0x1af657=new dialogflow[(_0xb161('0x64'))](_0x11e12e);var _0x3d520d=_0x1af657[_0xb161('0x65')](_0xca4278,md5(_0x399d42));var _0x5773cf={'session':_0x3d520d,'queryInput':{'text':{'text':_0x230321,'languageCode':_0x5dc200}}};return _0x1af657[_0xb161('0x66')](_0x5773cf)[_0xb161('0x3e')](function(_0x5ac283){if(_0x5ac283&&_0x5ac283[_0xb161('0x48')]){logger[_0xb161('0x1c')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x5ac283));var _0x3bda6f=_0x5ac283[0x0];if(_0x3bda6f){var _0x2a54a4={'action':_0x3bda6f['queryResult']['action'],'allRequiredParamsPresent':_0x3bda6f[_0xb161('0x67')][_0xb161('0x68')],'endConversation':_0x3bda6f[_0xb161('0x67')][_0xb161('0x69')]&&_0x3bda6f[_0xb161('0x67')][_0xb161('0x69')][_0xb161('0x6a')]?_0x3bda6f[_0xb161('0x67')][_0xb161('0x69')][_0xb161('0x6a')]['end_conversation'][_0xb161('0x6b')]:![],'fulfillmentText':_0x3bda6f['queryResult'][_0xb161('0x6c')],'intentName':_0x3bda6f[_0xb161('0x67')][_0xb161('0x6d')][_0xb161('0x57')],'intentDisplayName':_0x3bda6f['queryResult'][_0xb161('0x6d')][_0xb161('0x6e')],'isFallbackIntent':_0x3bda6f[_0xb161('0x67')]['intent'][_0xb161('0x6f')],'languageCode':_0x3bda6f[_0xb161('0x67')][_0xb161('0x70')],'queryText':_0x3bda6f[_0xb161('0x67')][_0xb161('0x71')],'responseId':_0x3bda6f[_0xb161('0x72')],'score':_0x3bda6f[_0xb161('0x67')][_0xb161('0x73')],'speech':_0x3bda6f[_0xb161('0x67')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x5ac283)};return _0x2a54a4;}}});};exports[_0xb161('0x74')]=function(_0x267c48,_0xf04027,_0x2ade8f,_0x4f8777){return tilde['asr'](_0x267c48,_0xf04027,_0x2ade8f,_0x4f8777)[_0xb161('0x3e')](function(_0x4763ca){try{fs[_0xb161('0x1f')](_0x267c48);}catch(_0x3b9ea1){logger[_0xb161('0x16')](_0x3b9ea1);}logger[_0xb161('0x1c')]('Tilde\x20ASR\x20transcription',_0x4763ca[_0xb161('0x53')]);logger[_0xb161('0x1c')](_0xb161('0x75'),_0x4763ca['confidence']);return _0x4763ca;});};exports[_0xb161('0x76')]=function(_0x5f0c2c,_0x3f9bae,_0x5aab86,_0x348ff6,_0x1a3836,_0x1863d9){var _0xfc6e49=path[_0xb161('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xb161('0x3b'));var _0x10afc9;return aws[_0xb161('0x77')](_0x5f0c2c,_0x3f9bae,_0x5aab86,_0x348ff6,_0x1a3836,_0x1863d9,_0xfc6e49)[_0xb161('0x3e')](function(){_0x10afc9=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+'.wav');return convertFile(_0xfc6e49,_0x10afc9);})[_0xb161('0x3e')](function(){try{fs[_0xb161('0x1f')](_0xfc6e49);fs[_0xb161('0x2d')](_0x10afc9,_0xb161('0x2e'));}catch(_0x355861){logger[_0xb161('0x16')](_0x355861);}return _0x10afc9[_0xb161('0x2f')]('.')[0x0];});};exports['awsLex']=function(_0x536eef,_0x561bcb,_0x20ec5e,_0x3713b5,_0x3b6461,_0xf0af6a){return aws['lex'](_0x536eef,_0x561bcb,_0x20ec5e,_0x3713b5,_0x3b6461,_0xf0af6a)[_0xb161('0x3e')](function(_0x23ee94){logger[_0xb161('0x1c')](JSON[_0xb161('0x43')](_0x23ee94));return _0x23ee94;});};exports[_0xb161('0x78')]=function(_0x104b20,_0xad490c,_0x5f2b61,_0x25031c){var _0x5e6d33=util['format'](_0xb161('0x79'),ISPEECH_API,_0x104b20,encodeURIComponent(_0xad490c),_0x5f2b61,_0x25031c);var _0x578b37=path['resolve'](__dirname,_0xb161('0x28'),rs['generate'](0x4)+_0xb161('0x3b'));var _0x825f7f;return downloadFile(_0x5e6d33,_0x578b37)[_0xb161('0x3e')](function(){_0x825f7f=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+_0xb161('0x2a'));return convertFile(_0x578b37,_0x825f7f);})['then'](function(){try{fs['unlink'](_0x578b37);fs[_0xb161('0x2d')](_0x825f7f,_0xb161('0x2e'));}catch(_0x4f4ce7){logger['error'](_0x4f4ce7);}return _0x825f7f['split']('.')[0x0];});};exports[_0xb161('0x7a')]=function(_0x5e6ede,_0x445a82,_0x53e269,_0x57e009){var _0x20253d=util['format'](_0xb161('0x7b'),ISPEECH_API,_0x445a82,_0x53e269,base64Encode(_0x5e6ede),_0x57e009?util['format']('model=%s',encodeURIComponent(_0x57e009)):'freeform=3');return uploadFile(_0x20253d)['then'](function(_0x2bebe1){return querystring[_0xb161('0xb')](_0x2bebe1);});};exports['sestekNDA']=function(_0x2bba23,_0x3c440d){return sestek[_0xb161('0x7c')](_0x2bba23,_0x3c440d)[_0xb161('0x3e')](function(_0x34a88a){logger['info'](JSON[_0xb161('0x43')](_0x34a88a));var _0x3e084c={'speech':_0x34a88a[_0xb161('0x7d')],'action':_0x34a88a[_0xb161('0x7e')]?_0x34a88a['channelData']['CustomAction']:undefined,'actiondata':_0x34a88a[_0xb161('0x7e')]?_0x34a88a[_0xb161('0x7e')]['CustomActionData']:undefined};if(_0x34a88a[_0xb161('0x7e')]&&_0x34a88a[_0xb161('0x7e')][_0xb161('0x7f')]){return base64Decode(_0x34a88a[_0xb161('0x7e')][_0xb161('0x7f')]['Data'],path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs['generate'](0x4)+_0xb161('0x2a')))[_0xb161('0x3e')](function(_0x198eaa){_0x3e084c[_0xb161('0x80')]=_0x198eaa;return _0x3e084c;});}return _0x3e084c;});};exports[_0xb161('0x81')]=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 30a885a..8f34e03 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 _0x8abb=['./nda','exports'];(function(_0x3db212,_0xf526ed){var _0x27a933=function(_0x20b9e4){while(--_0x20b9e4){_0x3db212['push'](_0x3db212['shift']());}};_0x27a933(++_0xf526ed);}(_0x8abb,0x118));var _0xb8ab=function(_0x2b7dc8,_0x1f71d9){_0x2b7dc8=_0x2b7dc8-0x0;var _0x3a4d7f=_0x8abb[_0x2b7dc8];return _0x3a4d7f;};var nda=require(_0xb8ab('0x0'));module[_0xb8ab('0x1')]={'nda':nda}; \ No newline at end of file +var nda=require('./nda');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 142bf00..ecdbe1b 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 _0x9090=['Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','/token','password','username','then','ndassistant_url','ndaactivity_type'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9090,0x17f));var _0x0909=function(_0x51b8c0,_0x28c15a){_0x51b8c0=_0x51b8c0-0x0;var _0x7f853c=_0x9090[_0x51b8c0];return _0x7f853c;};'use strict';var rp=require(_0x0909('0x0'));var url=require(_0x0909('0x1'));var logger=require(_0x0909('0x2'))(_0x0909('0x3'));module[_0x0909('0x4')]=function(_0x5466c8,_0x51923f){var _0x2c02f0={'method':_0x0909('0x5'),'uri':url[_0x0909('0x6')](_0x51923f['ndauth_url'],_0x0909('0x7')),'form':{'grant_type':_0x0909('0x8'),'username':_0x51923f[_0x0909('0x9')],'password':_0x51923f[_0x0909('0x8')]},'json':!![]};return rp(_0x2c02f0)[_0x0909('0xa')](function(_0x32bf48){var _0x1755ee={'method':'POST','uri':url[_0x0909('0x6')](_0x51923f[_0x0909('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x51923f[_0x0909('0xc')]||'message','channelId':_0x0909('0xd'),'conversation':{'id':_0x5466c8[_0x0909('0xe')]},'from':{'id':_0x5466c8[_0x0909('0xf')],'name':_0x5466c8[_0x0909('0x10')]},'recipient':{'id':_0x5466c8['dnid'],'name':_0x5466c8[_0x0909('0x11')]},'text':_0x51923f[_0x0909('0x12')],'channelData':{}},'headers':{'Authorization':_0x0909('0x13')+_0x32bf48[_0x0909('0x14')]},'json':!![]};if(_0x51923f['project']){_0x1755ee[_0x0909('0x15')][_0x0909('0x16')][_0x0909('0x17')]=_0x51923f[_0x0909('0x18')];}if(_0x51923f[_0x0909('0x19')]=='1'){_0x1755ee[_0x0909('0x15')][_0x0909('0x16')][_0x0909('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0909('0x1b')};}if(_0x51923f[_0x0909('0x1c')]){_0x1755ee['body'][_0x0909('0x16')][_0x0909('0x1d')]=_0x51923f[_0x0909('0x1c')];if(_0x51923f[_0x0909('0x1e')]){_0x1755ee[_0x0909('0x15')][_0x0909('0x16')][_0x0909('0x1f')]=_0x51923f[_0x0909('0x1e')];}}logger['info'](JSON[_0x0909('0x20')](_0x1755ee));return rp(_0x1755ee);});}; \ No newline at end of file +var _0xd136=['CustomActionData','info','stringify','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','Nda','uniqueid','callerid','extension','text','Bearer\x20','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data'];(function(_0x526793,_0x46037a){var _0x590a86=function(_0x38eeee){while(--_0x38eeee){_0x526793['push'](_0x526793['shift']());}};_0x590a86(++_0x46037a);}(_0xd136,0x94));var _0x6d13=function(_0x484277,_0x3aa7cc){_0x484277=_0x484277-0x0;var _0x59df04=_0xd136[_0x484277];return _0x59df04;};'use strict';var rp=require('request-promise');var url=require(_0x6d13('0x0'));var logger=require(_0x6d13('0x1'))('agi');module[_0x6d13('0x2')]=function(_0x2d8f30,_0x12b9d6){var _0x2a3702={'method':_0x6d13('0x3'),'uri':url[_0x6d13('0x4')](_0x12b9d6[_0x6d13('0x5')],_0x6d13('0x6')),'form':{'grant_type':_0x6d13('0x7'),'username':_0x12b9d6['username'],'password':_0x12b9d6[_0x6d13('0x7')]},'json':!![]};return rp(_0x2a3702)[_0x6d13('0x8')](function(_0x4c563a){var _0x598021={'method':_0x6d13('0x3'),'uri':url[_0x6d13('0x4')](_0x12b9d6[_0x6d13('0x9')],_0x6d13('0xa')),'body':{'type':_0x12b9d6['ndaactivity_type']||'message','channelId':_0x6d13('0xb'),'conversation':{'id':_0x2d8f30[_0x6d13('0xc')]},'from':{'id':_0x2d8f30[_0x6d13('0xd')],'name':_0x2d8f30['calleridname']},'recipient':{'id':_0x2d8f30['dnid'],'name':_0x2d8f30[_0x6d13('0xe')]},'text':_0x12b9d6[_0x6d13('0xf')],'channelData':{}},'headers':{'Authorization':_0x6d13('0x10')+_0x4c563a['access_token']},'json':!![]};if(_0x12b9d6[_0x6d13('0x11')]){_0x598021[_0x6d13('0x12')][_0x6d13('0x13')][_0x6d13('0x14')]=_0x12b9d6['project'];}if(_0x12b9d6['ndagenerate_audio']=='1'){_0x598021['body'][_0x6d13('0x13')][_0x6d13('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6d13('0x16')};}if(_0x12b9d6[_0x6d13('0x17')]){_0x598021[_0x6d13('0x12')]['channelData'][_0x6d13('0x18')]=_0x12b9d6[_0x6d13('0x17')];if(_0x12b9d6[_0x6d13('0x19')]){_0x598021[_0x6d13('0x12')][_0x6d13('0x13')][_0x6d13('0x1a')]=_0x12b9d6[_0x6d13('0x19')];}}logger[_0x6d13('0x1b')](JSON[_0x6d13('0x1c')](_0x598021));return rp(_0x598021);});}; \ 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 a83db4f..1c54e31 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 _0x8d7f=['exports','./lib/api'];(function(_0x1ce9ea,_0x32e6f4){var _0x2a95b9=function(_0x1a0496){while(--_0x1a0496){_0x1ce9ea['push'](_0x1ce9ea['shift']());}};_0x2a95b9(++_0x32e6f4);}(_0x8d7f,0x1cb));var _0xf8d7=function(_0x28d09d,_0x525b43){_0x28d09d=_0x28d09d-0x0;var _0x2c49e3=_0x8d7f[_0x28d09d];return _0x2c49e3;};'use strict';var asr=require(_0xf8d7('0x0'));module[_0xf8d7('0x1')]=function(_0x38d578,_0x28c820,_0x47a18e,_0x1b984d){return asr(_0x38d578,_0x28c820,_0x47a18e,_0x1b984d);}; \ No newline at end of file +var _0x9b2c=['exports'];(function(_0x2da853,_0x3f8748){var _0x514abe=function(_0x53b550){while(--_0x53b550){_0x2da853['push'](_0x2da853['shift']());}};_0x514abe(++_0x3f8748);}(_0x9b2c,0x189));var _0xc9b2=function(_0xf973b7,_0x46699f){_0xf973b7=_0xf973b7-0x0;var _0x499087=_0x9b2c[_0xf973b7];return _0x499087;};'use strict';var asr=require('./lib/api');module[_0xc9b2('0x0')]=function(_0x644700,_0x4b4bdd,_0x140704,_0x54dbb1){return asr(_0x644700,_0x4b4bdd,_0x140704,_0x54dbb1);}; \ 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 6201065..966c981 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 _0x714f=['stringify','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','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','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send'];(function(_0x2267fa,_0x3dcf1b){var _0x4d1788=function(_0x3b7ebc){while(--_0x3b7ebc){_0x2267fa['push'](_0x2267fa['shift']());}};_0x4d1788(++_0x3dcf1b);}(_0x714f,0x1c6));var _0xf714=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x714f[_0xf168d3];return _0x17fb54;};'use strict';var BPromise=require(_0xf714('0x0'));var _=require(_0xf714('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf714('0x2'));var crypto=require(_0xf714('0x3'));var logger=require(_0xf714('0x4'))('agi');module['exports']=function(_0x532578,_0x337db0,_0x4d2c79,_0x3d3e12){return new BPromise(function(_0x20d61,_0x53b84e){logger['info']('Tilde\x20URI',_0x3d3e12||_0xf714('0x5'));var _0x21f65a=new WebSocket(_0x3d3e12||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4d78a4='';var _0x2d27ec='0';var _0x36bdf9='1';var _0x2af467=_0xf714('0x6');function _0x3d7881(_0x329866){var _0x5e5055=crypto[_0xf714('0x7')](_0xf714('0x8'));_0x5e5055['update'](_0x329866);return _0x5e5055['digest'](_0xf714('0x9'));}function _0x1c1100(){try{logger[_0xf714('0xa')](_0xf714('0xb'));var _0x249938=moment()[_0xf714('0xc')]();var _0x1db008=_0x3d7881(_0x249938+_0x337db0+_0x4d2c79);_0x21f65a[_0xf714('0xd')](JSON[_0xf714('0xe')]({'appID':_0x337db0,'timestamp':_0x249938,'appKey':_0x1db008}));var _0x21339f=fs['createReadStream'](_0x532578);_0x21339f['on']('data',function(_0x12fc79){_0x21f65a[_0xf714('0xd')](_0x12fc79);});_0x21339f['on']('close',function(){_0x21f65a[_0xf714('0xd')]('EOS');});}catch(_0x5a711b){logger[_0xf714('0xf')](_0xf714('0x10'),JSON[_0xf714('0xe')](_0x5a711b));_0x21f65a[_0xf714('0x11')]();}}function _0x5401ab(_0x1e1237){try{if(_0x1e1237){var _0x31718c=JSON['parse'](_0x1e1237);switch(_0x31718c[_0xf714('0x12')]){case 0x0:if(_0x31718c[_0xf714('0x13')]){if(_0x31718c[_0xf714('0x13')][_0xf714('0x14')]){logger[_0xf714('0xa')](_0xf714('0x15'),JSON[_0xf714('0xe')](_0x31718c['result']['hypotheses']));_0x4d78a4=_0x31718c[_0xf714('0x13')][_0xf714('0x16')][0x0][_0xf714('0x17')];_0x2d27ec=_0x31718c[_0xf714('0x13')]['hypotheses'][0x0][_0xf714('0x18')];_0x36bdf9='0';_0x2af467=_0xf714('0x19');_0x21f65a[_0xf714('0x11')]();}}break;case 0x1:logger['info'](_0xf714('0x6'));_0x36bdf9='1';_0x2af467='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xf714('0xa')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x36bdf9='2';_0x2af467=_0xf714('0x1a');break;case 0x9:logger[_0xf714('0xa')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x36bdf9='9';_0x2af467=_0xf714('0x1b');break;case 0xa:logger[_0xf714('0xa')](_0xf714('0x1c'));_0x36bdf9='10';_0x2af467=_0xf714('0x1c');break;case 0xb:logger[_0xf714('0xa')](_0xf714('0x1d'));_0x36bdf9='11';_0x2af467=_0xf714('0x1d');}}}catch(_0x332046){logger['error'](_0xf714('0x1e'),JSON[_0xf714('0xe')](_0x332046));_0x21f65a['terminate']();}}function _0x1287ce(){logger[_0xf714('0xa')](_0xf714('0x1f'));_0x20d61({'transcript':_0x4d78a4,'confidence':_0x2d27ec,'status':_0x36bdf9,'status_message':_0x2af467});}function _0x531aab(_0x3d8f94){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xf714('0x20')](_0x3d8f94)){logger[_0xf714('0xf')](_[_0xf714('0x21')](_0x3d8f94)?JSON['stringify'](_0x3d8f94):_0x3d8f94);}}_0x21f65a['on'](_0xf714('0x22'),_0x1c1100);_0x21f65a['on']('message',_0x5401ab);_0x21f65a['on'](_0xf714('0x23'),_0x1287ce);_0x21f65a['on'](_0xf714('0xf'),_0x531aab);});}; \ No newline at end of file +var _0x3f42=['Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','moment','../../../../../../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','digest','unix','send','stringify','createReadStream','close','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket'];(function(_0x3b81a,_0x56c527){var _0x17c6a7=function(_0x5c6f17){while(--_0x5c6f17){_0x3b81a['push'](_0x3b81a['shift']());}};_0x17c6a7(++_0x56c527);}(_0x3f42,0x1d8));var _0x23f4=function(_0x3cce76,_0xbd4607){_0x3cce76=_0x3cce76-0x0;var _0xbc6055=_0x3f42[_0x3cce76];return _0xbc6055;};'use strict';var BPromise=require(_0x23f4('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x23f4('0x1'));var crypto=require('crypto');var logger=require(_0x23f4('0x2'))(_0x23f4('0x3'));module[_0x23f4('0x4')]=function(_0x473539,_0x245143,_0x42746c,_0x360b6d){return new BPromise(function(_0x560c66,_0x5b43aa){logger[_0x23f4('0x5')](_0x23f4('0x6'),_0x360b6d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x160b8b=new WebSocket(_0x360b6d||_0x23f4('0x7'),{'perMessageDeflate':![]});var _0x71838d='';var _0x13198a='0';var _0x2ffb0e='1';var _0x985383=_0x23f4('0x8');function _0x2dcb35(_0x5ace37){var _0x1396db=crypto[_0x23f4('0x9')]('sha1');_0x1396db['update'](_0x5ace37);return _0x1396db[_0x23f4('0xa')]('hex');}function _0xb5b2f(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x46684c=moment()[_0x23f4('0xb')]();var _0x37c02d=_0x2dcb35(_0x46684c+_0x245143+_0x42746c);_0x160b8b[_0x23f4('0xc')](JSON[_0x23f4('0xd')]({'appID':_0x245143,'timestamp':_0x46684c,'appKey':_0x37c02d}));var _0x585299=fs[_0x23f4('0xe')](_0x473539);_0x585299['on']('data',function(_0xb5208e){_0x160b8b[_0x23f4('0xc')](_0xb5208e);});_0x585299['on'](_0x23f4('0xf'),function(){_0x160b8b['send']('EOS');});}catch(_0x587ea8){logger[_0x23f4('0x10')]('Tilde\x20ASR\x20send\x20error',JSON[_0x23f4('0xd')](_0x587ea8));_0x160b8b[_0x23f4('0x11')]();}}function _0x30184f(_0x3ca6c0){try{if(_0x3ca6c0){var _0x4295c7=JSON[_0x23f4('0x12')](_0x3ca6c0);switch(_0x4295c7[_0x23f4('0x13')]){case 0x0:if(_0x4295c7[_0x23f4('0x14')]){if(_0x4295c7[_0x23f4('0x14')][_0x23f4('0x15')]){logger[_0x23f4('0x5')](_0x23f4('0x16'),JSON[_0x23f4('0xd')](_0x4295c7[_0x23f4('0x14')][_0x23f4('0x17')]));_0x71838d=_0x4295c7['result'][_0x23f4('0x17')][0x0][_0x23f4('0x18')];_0x13198a=_0x4295c7[_0x23f4('0x14')][_0x23f4('0x17')][0x0][_0x23f4('0x19')];_0x2ffb0e='0';_0x985383='Success.';_0x160b8b[_0x23f4('0x11')]();}}break;case 0x1:logger[_0x23f4('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2ffb0e='1';_0x985383=_0x23f4('0x8');break;case 0x2:logger[_0x23f4('0x5')](_0x23f4('0x1a'));_0x2ffb0e='2';_0x985383=_0x23f4('0x1a');break;case 0x9:logger[_0x23f4('0x5')](_0x23f4('0x1b'));_0x2ffb0e='9';_0x985383=_0x23f4('0x1b');break;case 0xa:logger['info'](_0x23f4('0x1c'));_0x2ffb0e='10';_0x985383='Authentication\x20failed.';break;case 0xb:logger[_0x23f4('0x5')](_0x23f4('0x1d'));_0x2ffb0e='11';_0x985383=_0x23f4('0x1d');}}}catch(_0x2ced50){logger[_0x23f4('0x10')](_0x23f4('0x1e'),JSON[_0x23f4('0xd')](_0x2ced50));_0x160b8b[_0x23f4('0x11')]();}}function _0x131dcf(){logger['info'](_0x23f4('0x1f'));_0x560c66({'transcript':_0x71838d,'confidence':_0x13198a,'status':_0x2ffb0e,'status_message':_0x985383});}function _0x6a69d3(_0x10ef42){logger[_0x23f4('0x10')](_0x23f4('0x20'));if(!_['isNil'](_0x10ef42)){logger[_0x23f4('0x10')](_[_0x23f4('0x21')](_0x10ef42)?JSON[_0x23f4('0xd')](_0x10ef42):_0x10ef42);}}_0x160b8b['on'](_0x23f4('0x22'),_0xb5b2f);_0x160b8b['on'](_0x23f4('0x23'),_0x30184f);_0x160b8b['on'](_0x23f4('0xf'),_0x131dcf);_0x160b8b['on'](_0x23f4('0x10'),_0x6a69d3);});}; \ 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 cfe97da..a06964e 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 _0x3967=['exports','./asr'];(function(_0xc67563,_0x5d40fb){var _0x420434=function(_0x5ec1e2){while(--_0x5ec1e2){_0xc67563['push'](_0xc67563['shift']());}};_0x420434(++_0x5d40fb);}(_0x3967,0x91));var _0x7396=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0x3967[_0x1344d6];return _0xf45b24;};var asr=require(_0x7396('0x0'));module[_0x7396('0x1')]={'asr':asr}; \ No newline at end of file +var _0x2c30=['./asr'];(function(_0x15bc31,_0x14f70c){var _0x1989fe=function(_0x35b7d9){while(--_0x35b7d9){_0x15bc31['push'](_0x15bc31['shift']());}};_0x1989fe(++_0x14f70c);}(_0x2c30,0x1a7));var _0x02c3=function(_0x309885,_0x59dae9){_0x309885=_0x309885-0x0;var _0x5bded5=_0x2c30[_0x309885];return _0x5bded5;};var asr=require(_0x02c3('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 711e7e2..5d9df84 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x481bdf,_0x231538){var _0x281a12=function(_0x264b18){while(--_0x264b18){_0x481bdf['push'](_0x481bdf['shift']());}};_0x281a12(++_0x231538);}(_0xe706,0xa3));var _0x6e70=function(_0x4bedce,_0x265ebf){_0x4bedce=_0x4bedce-0x0;var _0x4fd2fb=_0xe706[_0x4bedce];return _0x4fd2fb;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 9aa6bf4..7357eb2 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 _0xf3cd=['SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','%s/recordings/%s','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','%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:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','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','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','IntervalId','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','agentPause','agentUnpause','agent','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','MALE','MP3','googleTTS','google_tts_language','url','timeout','number','POST','method','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','aws_polly_voice','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','agicommand','hasOwnProperty','isString','replaceAllVariables','isPlainObject','isArray','length','saveRestApiResult','setVariable','%s.%s','replaceObjectAllVariables','recursiveNodeIndex','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','sestekasr'];(function(_0x41a7f9,_0x195088){var _0x4def25=function(_0x19bdf8){while(--_0x19bdf8){_0x41a7f9['push'](_0x41a7f9['shift']());}};_0x4def25(++_0x195088);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf3cd[_0x3947c9];return _0x2e7871;};'use strict';var fs=require('fs');var util=require(_0xdf3c('0x0'));var _=require(_0xdf3c('0x1'));var sh=require(_0xdf3c('0x2'));var odbc=require(_0xdf3c('0x3'))();var rs=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var Mustache=require('mustache');var rp=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var scripts=require(_0xdf3c('0x9'));var FILES_PATH=_0xdf3c('0xa');var recursiveMapAttributes=[_0xdf3c('0xb'),_0xdf3c('0xc')];var verticesWithRetry=[_0xdf3c('0xd'),_0xdf3c('0xe'),'getsecretdigits'];var AGIVertices=function(_0x15705d,_0x52cf30,_0x52f855){this[_0xdf3c('0xf')]=_0x15705d;this[_0xdf3c('0x10')]=_0x52cf30;this['mailRpc']=_0x52f855;};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x12')]=function(_0x2d420c,_0x21a6e5){this[_0xdf3c('0x10')][_0xdf3c('0x13')](_0x2d420c)[_0xdf3c('0x14')](function(_0x32d2db){_0x21a6e5(null,_0x32d2db?_0x32d2db['name']:![]);})[_0xdf3c('0x15')](function(_0x166ae5){_0x21a6e5(_0x166ae5);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x16')]=function(_0x59e431,_0x2ae4ad){this[_0xdf3c('0x10')][_0xdf3c('0x17')](_0x59e431)['then'](function(_0x18aafa){_0x2ae4ad(null,_0x18aafa?_0x18aafa[_0xdf3c('0x18')]:![]);})[_0xdf3c('0x15')](function(_0x4274fd){_0x2ae4ad(_0x4274fd);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x19')]=function(_0x305ea5,_0x92008b){this[_0xdf3c('0x10')][_0xdf3c('0x1a')](_0x305ea5)['then'](function(_0x13b0e6){_0x92008b(null,_0x13b0e6?_0x13b0e6[_0xdf3c('0x18')]:![]);})[_0xdf3c('0x15')](function(_0x18d4ec){_0x92008b(_0x18d4ec);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1b')]=function(_0x16b02b,_0x3ee0af){this[_0xdf3c('0x10')][_0xdf3c('0x1c')](_0x16b02b)[_0xdf3c('0x14')](function(_0x3d14cc){_0x3ee0af(null,_0x3d14cc?_0x3d14cc[_0xdf3c('0x1d')]:![]);})['catch'](function(_0x4d620f){_0x3ee0af(_0x4d620f);});};AGIVertices[_0xdf3c('0x11')]['getUser']=function(_0x15776c,_0x40e7ec){this[_0xdf3c('0x10')][_0xdf3c('0x1e')](_0x15776c)[_0xdf3c('0x14')](function(_0x36ba1c){_0x40e7ec(null,_0x36ba1c?_0x36ba1c['name']:![]);})[_0xdf3c('0x15')](function(_0x213d75){_0x40e7ec(_0x213d75);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1f')]=function(_0x40032a,_0x3b5371){this[_0xdf3c('0x10')][_0xdf3c('0x20')](_0x40032a)[_0xdf3c('0x14')](function(_0x1adee4){_0x3b5371(null,_0x1adee4?_0x1adee4['name']:![]);})[_0xdf3c('0x15')](function(_0x153daa){_0x3b5371(_0x153daa);});};AGIVertices['prototype'][_0xdf3c('0x21')]=function(_0x59659e,_0x4eaced){var _0x508be9=this;this[_0xdf3c('0x10')][_0xdf3c('0x22')](_0x59659e)['then'](function(_0x5c3b5a){_0x4eaced(null,_0x5c3b5a?_0x508be9[_0xdf3c('0x23')](_0x5c3b5a[_0xdf3c('0x24')]):![]);})[_0xdf3c('0x15')](function(_0x1ccdd4){_0x4eaced(_0x1ccdd4);});};AGIVertices['prototype'][_0xdf3c('0x25')]=function(_0x2a2d94,_0x5386bf){this['rpc'][_0xdf3c('0x26')](_0x2a2d94)[_0xdf3c('0x14')](function(_0x36937e){_0x5386bf(null,_0x36937e?_0x36937e:![]);})['catch'](function(_0x2355f6){_0x5386bf(_0x2355f6);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x27')]=function(_0x10099e,_0x575ae1,_0xda0de0){this[_0xdf3c('0x28')]['sendMailMessage'](_0x10099e,_0x575ae1)[_0xdf3c('0x14')](function(){_0xda0de0(null);})[_0xdf3c('0x15')](function(_0x217a65){_0xda0de0(_0x217a65);});};AGIVertices[_0xdf3c('0x11')]['getIntervals']=function(_0x33632f,_0x360d5c){this[_0xdf3c('0x10')][_0xdf3c('0x29')](_0x33632f)['then'](function(_0x474564){if(_0x474564){if(_0x474564[_0xdf3c('0x2a')]){_0x360d5c(null,[_0x474564['interval']]);}else{_0x360d5c(null,_['map'](_0x474564[_0xdf3c('0x2b')],'interval'));}}else{_0x360d5c(null,![]);}})[_0xdf3c('0x15')](function(_0x5e8130){_0x360d5c(_0x5e8130);});};AGIVertices['prototype']['getSoundPath']=function(_0x44a478){return util[_0xdf3c('0x2c')](_0xdf3c('0x2d'),FILES_PATH,_0x44a478);};AGIVertices[_0xdf3c('0x11')]['getQueryOdbc']=function(_0x49f147,_0x3d8557,_0x49d0f0){odbc[_0xdf3c('0x2e')](_0x49f147,function(_0x17b502){if(_0x17b502){logger[_0xdf3c('0x2f')](_0xdf3c('0x30'),_0x17b502);_0x49d0f0(_0x17b502);}else{logger[_0xdf3c('0x31')](_0xdf3c('0x32'));odbc[_0xdf3c('0x33')](_0x3d8557,function(_0x809f3d,_0x398c76){if(_0x809f3d){logger['info'](_0xdf3c('0x34'),_0x3d8557);_0x49d0f0(_0x809f3d);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x3d8557);odbc[_0xdf3c('0x35')](function(_0x47f760){if(_0x47f760){logger[_0xdf3c('0x2f')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x47f760);}_0x49d0f0(null,_0x398c76);});}});}});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x36')]=function(_0x1c6dee,_0x1349a4){this[_0xdf3c('0x10')][_0xdf3c('0x37')](_0x1c6dee)[_0xdf3c('0x14')](function(_0x3d47fb){_0x1349a4(null,_0x3d47fb?_0x3d47fb:![]);})[_0xdf3c('0x15')](function(_0xa65478){_0x1349a4(_0xa65478);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x38')]=function(_0x57e0ab,_0x5be92d){this[_0xdf3c('0x10')]['createSmsMessage'](_0x57e0ab)[_0xdf3c('0x14')](function(_0x14d8e1){_0x5be92d(null,_0x14d8e1);})[_0xdf3c('0x15')](function(_0x328b18){_0x5be92d(_0x328b18);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x335c1b,_0x33edab,_0x106975){this['rpc'][_0xdf3c('0x39')]({'uniqueid':this[_0xdf3c('0xf')][_0xdf3c('0x3a')],'node':_0x335c1b[_0xdf3c('0x3b')],'application':_0x335c1b['agicommand'],'data':_0x33edab||null,'project_name':this[_0xdf3c('0xf')][_0xdf3c('0x3c')],'callerid':this[_0xdf3c('0xf')][_0xdf3c('0x3d')]})[_0xdf3c('0x14')](function(_0x55849e){if(_0x106975){_0x106975(null,_0x55849e);}})[_0xdf3c('0x15')](function(_0x286b72){if(_0x106975){_0x106975(_0x286b72);}});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x3e')]=function(_0x36962d,_0x344f1e,_0x555389,_0x4d6349){this[_0xdf3c('0x10')][_0xdf3c('0x3e')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0xdf3c('0xf')][_0xdf3c('0x3d')],'calleridname':this[_0xdf3c('0xf')][_0xdf3c('0x3f')],'context':this[_0xdf3c('0xf')][_0xdf3c('0x40')],'extension':this[_0xdf3c('0xf')][_0xdf3c('0x41')],'priority':this[_0xdf3c('0xf')]['priority'],'accountcode':this[_0xdf3c('0xf')][_0xdf3c('0x42')],'dnid':this[_0xdf3c('0xf')][_0xdf3c('0x43')],'projectName':this[_0xdf3c('0xf')][_0xdf3c('0x3c')],'saveName':_0x344f1e,'filename':_0x36962d[_0xdf3c('0x44')]||_0x344f1e,'savePath':_0x555389})['then'](function(_0x1751a8){_0x4d6349(null,_0x1751a8);})['catch'](function(_0xa4e137){_0x4d6349(_0xa4e137);});};AGIVertices['prototype'][_0xdf3c('0x45')]=function(_0x28144f,_0x2ec575,_0x94c5b9,_0x5eef94,_0x55da0f){this['rpc'][_0xdf3c('0x45')]({'uniqueid':this['channel'][_0xdf3c('0x3a')],'body':_0x28144f,'direction':_0x2ec575,'providerName':_0x94c5b9,'providerResponse':_0x5eef94})[_0xdf3c('0x14')](function(_0x446713){if(_0x55da0f){_0x55da0f(null,_0x446713);}})[_0xdf3c('0x15')](function(_0x3b17d9){if(_0x55da0f){_0x55da0f(_0x3b17d9);}});};AGIVertices['prototype']['createCmContact']=function(_0x2371aa,_0x27a541){this['rpc'][_0xdf3c('0x46')]({'firstName':_[_0xdf3c('0x47')](_0x2371aa[_0xdf3c('0x18')])||_[_0xdf3c('0x48')](_0x2371aa[_0xdf3c('0x18')])?_0xdf3c('0x49')+Math[_0xdf3c('0x4a')]():_0x2371aa['name'],'lastName':_['isEmpty'](_0x2371aa[_0xdf3c('0x4b')])||_[_0xdf3c('0x48')](_0x2371aa[_0xdf3c('0x4b')])?null:_0x2371aa[_0xdf3c('0x4b')],'phone':_0x2371aa[_0xdf3c('0x4c')],'ListId':_0x2371aa[_0xdf3c('0x4d')],'scheduledat':_0x2371aa[_0xdf3c('0x4e')],'callbackUniqueid':this[_0xdf3c('0xf')][_0xdf3c('0x3a')],'tags':_0xdf3c('0x4f'),'description':_0xdf3c('0x50')+_0x2371aa['scheduledAt'][_0xdf3c('0x51')](),'priority':_0x2371aa['callback_priority']})['then'](function(_0x5052d5){_0x27a541(null,_0x5052d5);})['catch'](function(_0x541c57){_0x27a541(_0x541c57);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x52')]=function(_0x5c53cd,_0x4257c4){this[_0xdf3c('0x10')]['getPauseById'](_0x5c53cd)[_0xdf3c('0x14')](function(_0x28f935){_0x4257c4(null,_0x28f935?_0x28f935[_0xdf3c('0x18')]:![]);})[_0xdf3c('0x15')](function(_0x396461){_0x4257c4(_0x396461);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x53')]=function(_0xdc859,_0x42efa2,_0xa05518){var _0x55e29b={'role':'agent'};_0x55e29b[_0xdc859]=this[_0xdf3c('0xf')][_0xdf3c('0x3d')];this[_0xdf3c('0x10')]['agentPause'](_0x55e29b,_0x42efa2,this[_0xdf3c('0xf')][_0xdf3c('0x3a')])[_0xdf3c('0x14')](function(_0x552264){_0xa05518(null,_[_0xdf3c('0x48')](_0x552264)?![]:!![]);})[_0xdf3c('0x15')](function(_0x5ca218){logger[_0xdf3c('0x2f')](_0x5ca218);_0xa05518(null,![]);});};AGIVertices['prototype'][_0xdf3c('0x54')]=function(_0x1b03e7,_0x163adc){var _0x3de07e={'role':_0xdf3c('0x55')};_0x3de07e[_0x1b03e7]=this[_0xdf3c('0xf')][_0xdf3c('0x3d')];this[_0xdf3c('0x10')][_0xdf3c('0x54')](_0x3de07e)[_0xdf3c('0x14')](function(_0x283be2){_0x163adc(null,_[_0xdf3c('0x48')](_0x283be2)?![]:!![]);})[_0xdf3c('0x15')](function(_0x206a18){logger[_0xdf3c('0x2f')](_0x206a18);_0x163adc(null,![]);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x56')]=function(_0x510538,_0x4dade5){var _0x2e8511={'role':_0xdf3c('0x55')};_0x2e8511[_0x510538]=this[_0xdf3c('0xf')]['callerid'];this[_0xdf3c('0x10')]['agentLogout'](_0x2e8511)['then'](function(_0x184952){_0x4dade5(null,_[_0xdf3c('0x48')](_0x184952)?![]:!![]);})[_0xdf3c('0x15')](function(_0x373a3e){logger[_0xdf3c('0x2f')](_0x373a3e);_0x4dade5(null,![]);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x57')]=function(_0x3ec03a,_0x3dbf6e){var _0x17b9b6={'role':_0xdf3c('0x55')};_0x17b9b6[_0x3ec03a]=this[_0xdf3c('0xf')][_0xdf3c('0x3d')];var _0x4be79a=_0x3ec03a!=_0xdf3c('0x58')?util[_0xdf3c('0x2c')](_0xdf3c('0x59'),_0xdf3c('0x5a'),this[_0xdf3c('0xf')]['callerid']):undefined;this[_0xdf3c('0x10')][_0xdf3c('0x57')](_0x17b9b6,_0x4be79a)[_0xdf3c('0x14')](function(_0x12d791){_0x3dbf6e(null,_[_0xdf3c('0x48')](_0x12d791)?![]:!![]);})[_0xdf3c('0x15')](function(_0x3c0a8d){logger[_0xdf3c('0x2f')](_0x3c0a8d);_0x3dbf6e(null,![]);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x5b')]=function(_0x55010b,_0xb867a1){sh[_0xdf3c('0x5c')](_[_0xdf3c('0x5d')](_0x55010b),function(_0x1de114,_0x165afb){var _0x128187=_0x165afb[_0xdf3c('0x5e')](/(\r\n|\n|\r)/gm,'');_0xb867a1(null,_0x128187);});};AGIVertices['prototype'][_0xdf3c('0x5f')]=function(_0x662fd5,_0x4e1b77){scripts['googleCloudTTS'](_0x662fd5[_0xdf3c('0x60')],_0x662fd5[_0xdf3c('0x61')]||_0xdf3c('0x62'),_0x662fd5[_0xdf3c('0x62')],_0x662fd5[_0xdf3c('0x63')]||_0xdf3c('0x64'),_0x662fd5[_0xdf3c('0x65')]||_0xdf3c('0x66'),_0x662fd5['audioEncoding']||_0xdf3c('0x67'))[_0xdf3c('0x14')](function(_0x41ab61){_0x4e1b77(null,_0x41ab61);})['catch'](function(_0x44a249){_0x4e1b77(_0x44a249);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x68')]=function(_0x4ff52a,_0x11c5a5){scripts[_0xdf3c('0x68')](_0x4ff52a[_0xdf3c('0x62')],_0x4ff52a[_0xdf3c('0x69')]||'en',0x1)[_0xdf3c('0x14')](function(_0x12f737){_0x11c5a5(null,_0x12f737);})['catch'](function(_0x50753f){_0x11c5a5(_0x50753f);});};AGIVertices['prototype']['restAPI']=function(_0x59c505,_0x2a4e4c){var _0x3f43a0={'uri':_0x59c505[_0xdf3c('0x6a')],'method':_0x59c505['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x59c505[_0xdf3c('0x6b')])===_0xdf3c('0x6c')&&parseInt(_0x59c505[_0xdf3c('0x6b')])>=0x1?parseInt(_0x59c505['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xdf3c('0x6d'),'PUT'],_0x3f43a0[_0xdf3c('0x6e')]['toUpperCase']())){try{_0x3f43a0[_0xdf3c('0x6f')]=_0x59c505[_0xdf3c('0xc')]?JSON[_0xdf3c('0x70')](_0x59c505[_0xdf3c('0xc')]):{};}catch(_0x5316ef){logger['error'](_0xdf3c('0x71'),_0x5316ef);}}try{_0x3f43a0[_0xdf3c('0x72')]=_0x59c505[_0xdf3c('0xb')]?JSON[_0xdf3c('0x70')](_0x59c505[_0xdf3c('0xb')]):{};}catch(_0xa5773a){logger['error'](_0xdf3c('0x73'),_0xa5773a);}if(_0x59c505['computedVariables']){try{var _0x40c8fc=require(_0x59c505[_0xdf3c('0x74')])[_0xdf3c('0x75')](this,_0x3f43a0);_0x3f43a0[_0xdf3c('0x76')]=Mustache[_0xdf3c('0x77')](_0x59c505['url'],_0x40c8fc,{},['$$','$$']);if(_0x3f43a0[_0xdf3c('0x72')]){_0x3f43a0[_0xdf3c('0x72')]=JSON[_0xdf3c('0x70')](Mustache['render'](JSON['stringify'](_0x3f43a0['headers']),_0x40c8fc,{},['$$','$$']));}if(_0x3f43a0['body']){_0x3f43a0[_0xdf3c('0x6f')]=JSON[_0xdf3c('0x70')](Mustache[_0xdf3c('0x77')](JSON[_0xdf3c('0x78')](_0x3f43a0[_0xdf3c('0x6f')]),_0x40c8fc,{},['$$','$$']));}}catch(_0x32573c){logger['error'](_0xdf3c('0x79'),_0x32573c);}}rp(_0x3f43a0)['then'](function(_0x42df23){var _0x389708={'statusCode':_0x42df23[_0xdf3c('0x7a')]||0xc8,'statusMessage':_0x42df23[_0xdf3c('0x7b')]||'OK','headers':_0x42df23[_0xdf3c('0x72')]||{},'body':_0x42df23[_0xdf3c('0x6f')]||{}};_0x2a4e4c(null,_0x389708);})[_0xdf3c('0x15')](function(_0x3eece1){var _0x32d09d={'statusCode':_0x3eece1[_0xdf3c('0x7a')]||0x1f4,'statusMessage':_0x3eece1[_0xdf3c('0x7c')]||_0xdf3c('0x7d'),'headers':_0x3eece1[_0xdf3c('0x7e')][_0xdf3c('0x72')]||{},'body':_0x3eece1['options'][_0xdf3c('0x6f')]||{}};_0x2a4e4c(null,_0x32d09d);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x7f')]=function(_0x137d9a,_0x5bbe5c){scripts[_0xdf3c('0x7f')](this[_0xdf3c('0xf')]['uniqueid'],_0x137d9a['key'],_0x137d9a[_0xdf3c('0x62')],_0x137d9a[_0xdf3c('0x80')]||'en')[_0xdf3c('0x14')](function(_0x1aaf8b){_0x5bbe5c(null,_0x1aaf8b);})[_0xdf3c('0x15')](function(_0x56fc77){_0x5bbe5c(_0x56fc77);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x81')]=function(_0x620c5f,_0x2b6d2b){scripts[_0xdf3c('0x81')](this[_0xdf3c('0xf')]['uniqueid'],_0x620c5f[_0xdf3c('0x82')],_0x620c5f[_0xdf3c('0x83')],_0x620c5f[_0xdf3c('0x84')],_0x620c5f[_0xdf3c('0x62')],_0x620c5f[_0xdf3c('0x85')]||'en')['then'](function(_0x4bedde){_0x2b6d2b(null,_0x4bedde);})['catch'](function(_0x3ff479){_0x2b6d2b(_0x3ff479);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x86')]=function(_0x3de4e6,_0x115f11){scripts[_0xdf3c('0x86')](this[_0xdf3c('0xf')],_0x3de4e6)[_0xdf3c('0x14')](function(_0x5c52e2){_0x115f11(null,_0x5c52e2);})[_0xdf3c('0x15')](function(_0x3eaddd){_0x115f11(_0x3eaddd);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x87')]=function(_0xf04b92,_0x46dd4e){scripts['ispeechTTS'](_0xf04b92[_0xdf3c('0x88')],_0xf04b92[_0xdf3c('0x62')],_0xf04b92['ispeech_tts_language']||'en-US',_0xf04b92[_0xdf3c('0x89')])['then'](function(_0x404e6e){_0x46dd4e(null,_0x404e6e);})[_0xdf3c('0x15')](function(_0x4e917f){_0x46dd4e(_0x4e917f);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x8a')]=function(_0x296fc0,_0x73d18a,_0xa326c9){scripts[_0xdf3c('0x8a')](_0x73d18a,_0x296fc0['key'],_0x296fc0[_0xdf3c('0x8b')]||_0xdf3c('0x64'),this[_0xdf3c('0x8c')](_0x296fc0[_0xdf3c('0x8d')])?_0x296fc0[_0xdf3c('0x8d')]:undefined)[_0xdf3c('0x14')](function(_0x3deacb){_0xa326c9(null,_0x3deacb);})['catch'](function(_0x5b1d3d){_0xa326c9(_0x5b1d3d);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x8e')]=function(_0x1f6f9b,_0x5b6419){scripts[_0xdf3c('0x8e')](_0x1f6f9b['aws_access_key_id'],_0x1f6f9b['aws_secret_access_key'],_0x1f6f9b[_0xdf3c('0x8f')],_0x1f6f9b[_0xdf3c('0x90')]||'Amy',_0x1f6f9b[_0xdf3c('0x62')],_0x1f6f9b['aws_text_type']||_0xdf3c('0x62'))['then'](function(_0x12b135){_0x5b6419(null,_0x12b135);})[_0xdf3c('0x15')](function(_0x284635){_0x5b6419(_0x284635);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x91')]=function(_0x87e942,_0x2790cd){scripts[_0xdf3c('0x91')](this[_0xdf3c('0xf')][_0xdf3c('0x3a')],_0x87e942[_0xdf3c('0x92')],_0x87e942[_0xdf3c('0x93')],_0x87e942[_0xdf3c('0x94')],_0x87e942[_0xdf3c('0x62')],_0x87e942['aws_bot_name'])[_0xdf3c('0x14')](function(_0x22bacf){_0x2790cd(null,_0x22bacf);})[_0xdf3c('0x15')](function(_0x5b959b){_0x2790cd(_0x5b959b);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x95')]=function(_0x32cd2f,_0x6e1899,_0x3da55b){scripts[_0xdf3c('0x95')](_0x6e1899,_0x32cd2f[_0xdf3c('0x88')],_0x32cd2f[_0xdf3c('0x96')]||_0xdf3c('0x64'))[_0xdf3c('0x14')](function(_0x258578){_0x3da55b(null,_0x258578);})['catch'](function(_0x3bc3c9){_0x3da55b(_0x3bc3c9);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x97')]=function(_0x9777ae,_0x70370c,_0x50b0f1){scripts[_0xdf3c('0x97')](_0x70370c,_0x9777ae[_0xdf3c('0x98')],_0x9777ae[_0xdf3c('0x99')],_0x9777ae[_0xdf3c('0x76')])[_0xdf3c('0x14')](function(_0xbe4411){_0x50b0f1(null,_0xbe4411);})['catch'](function(_0x6627){_0x50b0f1(_0x6627);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x9a')]=function(_0x23aa73){var _0x310f21=_[_0xdf3c('0x9b')](verticesWithRetry,_0x23aa73[_0xdf3c('0x9c')])?_0x23aa73:_['clone'](_0x23aa73);for(var _0x396b19 in _0x310f21){if(_0x310f21[_0xdf3c('0x9d')](_0x396b19)){if(_0x310f21[_0x396b19]&&_[_0xdf3c('0x9e')](_0x310f21[_0x396b19])){if(_[_0xdf3c('0x9b')](recursiveMapAttributes,_0x396b19)){_0x310f21[_0x396b19]=this['replaceObjectAllVariables'](_0x310f21[_0x396b19]);}else{_0x310f21[_0x396b19]=this[_0xdf3c('0x9f')](_0x310f21[_0x396b19]);}}}}return _0x310f21;};AGIVertices[_0xdf3c('0x11')]['recursiveNodeIndex']=function(_0x33c2ad){for(var _0x4a1bc4 in _0x33c2ad){if(_0x33c2ad[_0xdf3c('0x9d')](_0x4a1bc4)){if(_[_0xdf3c('0xa0')](_0x33c2ad[_0x4a1bc4])){this['recursiveNodeIndex'](_0x33c2ad[_0x4a1bc4]);}else if(_[_0xdf3c('0xa1')](_0x33c2ad[_0x4a1bc4])){for(var _0x106d32=0x0;_0x106d32<_0x33c2ad[_0x4a1bc4][_0xdf3c('0xa2')];_0x106d32++){this['recursiveNodeIndex'](_0x33c2ad[_0x4a1bc4][_0x106d32]);}}else if(_['isString'](_0x33c2ad[_0x4a1bc4])){_0x33c2ad[_0x4a1bc4]=this[_0xdf3c('0x9f')](_0x33c2ad[_0x4a1bc4]);}}}};AGIVertices['prototype'][_0xdf3c('0xa3')]=function(_0x82225d,_0x161604){for(var _0x91dd6e in _0x82225d){if(_0x82225d['hasOwnProperty'](_0x91dd6e)){if(_[_0xdf3c('0xa0')](_0x82225d[_0x91dd6e])){if(!_[_0xdf3c('0x47')](_0x82225d[_0x91dd6e])){this['saveRestApiResult'](_0x82225d[_0x91dd6e],util[_0xdf3c('0x2c')]('%s.%s',_0x161604,_0x91dd6e));}}else if(_[_0xdf3c('0xa1')](_0x82225d[_0x91dd6e])){for(var _0x1f1f09=0x0;_0x1f1f09<_0x82225d[_0x91dd6e]['length'];_0x1f1f09++){this['saveRestApiResult'](_0x82225d[_0x91dd6e][_0x1f1f09],util[_0xdf3c('0x2c')]('%s.%s',_0x161604,_0x91dd6e+'['+_0x1f1f09+']'));}}else{if(!_[_0xdf3c('0x48')](_0x82225d[_0x91dd6e])){this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0xa5'),_0x161604,_0x91dd6e),_0x82225d[_0x91dd6e]);}}}}};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xa6')]=function(_0x1d95d9){try{var _0x42ae0a=JSON[_0xdf3c('0x70')](_0x1d95d9);this[_0xdf3c('0xa7')](_0x42ae0a);return JSON['stringify'](_0x42ae0a);}catch(_0x4299d1){return this[_0xdf3c('0x9f')](_0x1d95d9);}};AGIVertices['prototype'][_0xdf3c('0x9f')]=function(_0x367e4d){var _0x21c508=_0x367e4d[_0xdf3c('0xa8')]('{');for(var _0x7e5769=0x1;_0x7e5769<_0x21c508[_0xdf3c('0xa2')];_0x7e5769+=0x1){var _0x5e92f0=_0x21c508[_0x7e5769][_0xdf3c('0xa8')]('}');if(_0x5e92f0['length']>0x1){_0x367e4d=_0x367e4d[_0xdf3c('0xa9')]('{'+_0x5e92f0[0x0]+'}',this[_0xdf3c('0xf')][_0xdf3c('0x12')](_0x5e92f0[0x0])[_0xdf3c('0xaa')]||_0x5e92f0[0x0]);}}if(_0x21c508[_0xdf3c('0xa2')]===0x1){return _0x367e4d[_0xdf3c('0x51')]();}return this['replaceAllVariables'](_0x367e4d);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xab')]=function(_0x5b4e32,_0x2ad761){var _0x2501e4=this[_0xdf3c('0xf')][_0xdf3c('0x12')](_0x5b4e32);if(_0x2501e4[_0xdf3c('0xac')]===-0x1){return _0x2501e4;}logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xad'),_0x2ad761,_0x2501e4['extra']));return this['channel'][_0xdf3c('0xa4')](_0x2ad761,_0x2501e4[_0xdf3c('0xaa')]);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x8c')]=function(_0x47afe4){return _0x47afe4&&_0x47afe4!=='0'&&_0x47afe4!=='-1'&&_0x47afe4!=='';};AGIVertices['prototype'][_0xdf3c('0xae')]=function(_0x5c15d3){this[_0xdf3c('0x39')]['sync'](this,_0x5c15d3,'-');_0x5c15d3[_0xdf3c('0xaf')]=_0x5c15d3[_0xdf3c('0xae')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xdf3c('0x11')]['mrcpsynth']=function(_0x292798){logger[_0xdf3c('0x31')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x292798[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x292798[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}var _0x1d76ed='\x22'+_0x292798['text']+'\x22';if(this['isConfigured'](_0x292798[_0xdf3c('0x7e')])){_0x1d76ed+=','+_0x292798[_0xdf3c('0x7e')];}var _0x2efe5b=this[_0xdf3c('0xf')][_0xdf3c('0x5c')](_0xdf3c('0xb2'),_0x1d76ed);if(_0x2efe5b[_0xdf3c('0xac')]===-0x1){return _0x2efe5b;}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xb3'),_0x1d76ed));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xb4')]=function(_0x42a160){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xb5'),_0x42a160[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x42a160['grammar'])){return this['channel'][_0xdf3c('0xb0')]('no\x20grammar\x20configured');}var _0x4c3df3=_0x42a160[_0xdf3c('0xb6')];if(this['isConfigured'](_0x42a160[_0xdf3c('0x7e')])){_0x4c3df3+=','+_0x42a160[_0xdf3c('0x7e')];}var _0x5e1366=this['channel']['exec'](_0xdf3c('0xb7'),_0x4c3df3);if(_0x5e1366[_0xdf3c('0xac')]===-0x1){return _0x5e1366;}var _0x11de00=this['getAndSetVariable'](_0xdf3c('0xb8'),'MRCP_RECOG_CONFIDENCE');if(_0x11de00[_0xdf3c('0xac')]===-0x1){return _0x11de00;}var _0x4ba88f=this['getAndSetVariable'](_0xdf3c('0xb9'),_0xdf3c('0xba'));if(_0x4ba88f[_0xdf3c('0xac')]===-0x1){return _0x4ba88f;}var _0x1aa490=this[_0xdf3c('0xab')](_0xdf3c('0xbb'),'MRCP_RECOG_INSTANCE');if(_0x1aa490['result']===-0x1){return _0x1aa490;}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0xbc'),_0x4c3df3));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x8')]=function(_0x2d3f44){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2d3f44['label']));return this[_0xdf3c('0xf')][_0xdf3c('0x8')]([_0x2d3f44[_0xdf3c('0xbd')],_0x2d3f44[_0xdf3c('0xbe')]]);};AGIVertices['prototype'][_0xdf3c('0xbf')]=function(_0x364b5e){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xc0'),_0x364b5e[_0xdf3c('0x3b')]));if(this['isConfigured'](_0x364b5e[_0xdf3c('0x6b')])){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0xc1'),_0x364b5e[_0xdf3c('0x6b')]));var _0xe5f939=this['channel'][_0xdf3c('0xc2')](_0x364b5e[_0xdf3c('0x6b')]);if(_0xe5f939[_0xdf3c('0xac')]===-0x1){return _0xe5f939;}}return this[_0xdf3c('0xf')][_0xdf3c('0xbf')]();};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x4f')]=function(_0x12ffd3){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0xc3'),_0x12ffd3['label']));if(!this[_0xdf3c('0x8c')](_0x12ffd3[_0xdf3c('0x4d')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x12ffd3,_0xdf3c('0xc4'));}_0x12ffd3[_0xdf3c('0x4e')]=moment();if(this[_0xdf3c('0x8c')](_0x12ffd3[_0xdf3c('0xc5')])){_0x12ffd3[_0xdf3c('0x4e')]=moment()[_0xdf3c('0xc6')](_0x12ffd3[_0xdf3c('0xc5')],'minutes');}if(!this[_0xdf3c('0x8c')](_0x12ffd3[_0xdf3c('0xc7')])){_0x12ffd3['callback_priority']=0x2;}this[_0xdf3c('0x46')][_0xdf3c('0x75')](this,_0x12ffd3);return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0xc8'),_0x12ffd3[_0xdf3c('0x4c')],_0x12ffd3[_0xdf3c('0x4d')],_0x12ffd3['scheduledAt']));};AGIVertices['prototype']['custom_app']=function(_0x157b7a){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xc9'),_0x157b7a[_0xdf3c('0x3b')]));var _0x33132b=this[_0xdf3c('0xf')][_0xdf3c('0x5c')](_0x157b7a['application'],_0x157b7a[_0xdf3c('0x7e')]);if(_0x33132b['result']===-0x1){return _0x33132b;}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xca'),_0x157b7a[_0xdf3c('0xcb')],_0x157b7a[_0xdf3c('0x7e')]));};AGIVertices['prototype'][_0xdf3c('0xcc')]=function(_0x116ac9){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0xcd'),_0x116ac9[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x116ac9['text'])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0xb1'));}var _0x138797='\x22'+_0x116ac9[_0xdf3c('0x62')]+'\x22';if(this[_0xdf3c('0x8c')](_0x116ac9[_0xdf3c('0x7e')])){_0x138797+=','+_0x116ac9[_0xdf3c('0x7e')];}var _0x5be97e=this['channel']['exec'](_0xdf3c('0xb2'),_0x138797);if(_0x5be97e[_0xdf3c('0xac')]===-0x1){return _0x5be97e;}return this['channel']['noop'](util[_0xdf3c('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x138797));};AGIVertices['prototype']['sestektts']=function(_0x3d8d41){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3d8d41[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0x3d8d41[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}var _0x119e04='\x22'+_0x3d8d41[_0xdf3c('0x62')]+'\x22';if(this[_0xdf3c('0x8c')](_0x3d8d41[_0xdf3c('0x7e')])){_0x119e04+=','+_0x3d8d41[_0xdf3c('0x7e')];}var _0x5a527a=this[_0xdf3c('0xf')][_0xdf3c('0x5c')]('MRCPSynth',_0x119e04);if(_0x5a527a[_0xdf3c('0xac')]===-0x1){return _0x5a527a;}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x119e04));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xce')]=function(_0x3ea47d){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xcf'),_0x3ea47d[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x3ea47d[_0xdf3c('0xb6')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xd0'));}var _0x2a4dbf=_0x3ea47d[_0xdf3c('0xb6')];if(this[_0xdf3c('0x8c')](_0x3ea47d[_0xdf3c('0x7e')])){_0x2a4dbf+=','+_0x3ea47d['options'];}var _0x3176cd=this[_0xdf3c('0xf')]['exec'](_0xdf3c('0xb7'),_0x2a4dbf);if(_0x3176cd[_0xdf3c('0xac')]===-0x1){return _0x3176cd;}var _0x162d56=this[_0xdf3c('0xab')]('RECOG_CONFIDENCE()',_0xdf3c('0xd1'));if(_0x162d56[_0xdf3c('0xac')]===-0x1){return _0x162d56;}var _0x5b25d7=this[_0xdf3c('0xab')](_0xdf3c('0xb9'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x5b25d7['result']===-0x1){return _0x5b25d7;}var _0x14b70a=this[_0xdf3c('0xab')](_0xdf3c('0xbb'),'LUMENVOX_ASR_INSTANCE');if(_0x14b70a[_0xdf3c('0xac')]===-0x1){return _0x14b70a;}return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xbc'),_0x2a4dbf));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xd2')]=function(_0x27f90e){logger['info'](util[_0xdf3c('0x2c')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x27f90e[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x27f90e[_0xdf3c('0xb6')])){return this['channel'][_0xdf3c('0xb0')]('no\x20grammar\x20configured');}var _0x3cba40=_0x27f90e[_0xdf3c('0xb6')];if(this['isConfigured'](_0x27f90e[_0xdf3c('0x7e')])){_0x3cba40+=','+_0x27f90e[_0xdf3c('0x7e')];}var _0x2c3655=this[_0xdf3c('0xf')]['exec'](_0xdf3c('0xb7'),_0x3cba40);if(_0x2c3655[_0xdf3c('0xac')]===-0x1){return _0x2c3655;}var _0xa61c3f=this[_0xdf3c('0xab')](_0xdf3c('0xb8'),_0xdf3c('0xd3'));if(_0xa61c3f[_0xdf3c('0xac')]===-0x1){return _0xa61c3f;}var _0x5a0ad8=this[_0xdf3c('0xab')](_0xdf3c('0xb9'),_0xdf3c('0xd4'));if(_0x5a0ad8[_0xdf3c('0xac')]===-0x1){return _0x5a0ad8;}var _0x16d755=this[_0xdf3c('0xab')](_0xdf3c('0xbb'),_0xdf3c('0xd5'));if(_0x16d755[_0xdf3c('0xac')]===-0x1){return _0x16d755;}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0xbc'),_0x3cba40));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xd6')]=function(_0x4e822b){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xd7'),_0x4e822b[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x4e822b['odbc_id'])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x4e822b,'no\x20database\x20selected');}var _0x2a0943=this[_0xdf3c('0x1b')][_0xdf3c('0x75')](this,_0x4e822b[_0xdf3c('0xd8')]);if(!_0x2a0943){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x4e822b,_0xdf3c('0xd9'));}if(!this[_0xdf3c('0x8c')](_0x4e822b[_0xdf3c('0x33')])){return this['channel'][_0xdf3c('0x2f')](_0x4e822b,_0xdf3c('0xda'));}var _0x4fcb83=_0x4e822b[_0xdf3c('0x33')][_0xdf3c('0x5e')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0xdb'),_0x4fcb83));var _0x2c6ae1=this[_0xdf3c('0xdc')][_0xdf3c('0x75')](this,_0x2a0943,_0x4fcb83);this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x4e822b,_0x4fcb83);if(!this[_0xdf3c('0x8c')](_0x4e822b['variable_id'])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xdd'));}var _0x28bc25=this['getVariable'][_0xdf3c('0x75')](this,_0x4e822b[_0xdf3c('0xde')]);if(!_0x28bc25){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x4e822b,'no\x20variable\x20found');}var _0x42d291=this;_0x2c6ae1[_0xdf3c('0xdf')](function(_0x1c3c6d,_0x58bc3a){Object['keys'](_0x1c3c6d)[_0xdf3c('0xdf')](function(_0xcaea00){_0x42d291[_0xdf3c('0xf')]['setVariable'](util[_0xdf3c('0x2c')](_0xdf3c('0xe0'),_0x28bc25,_0x58bc3a,_0xcaea00),_0x1c3c6d[_0xcaea00]);});});this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')]('%s_ROWS_COUNT',_0x28bc25),_0x2c6ae1['length']);return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0xe1'),_0x28bc25));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xe2')]=function(_0x3b55c2){logger[_0xdf3c('0xe3')](util['format'](_0xdf3c('0xe4'),_0x3b55c2[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x3b55c2[_0xdf3c('0xe5')])){return this['channel'][_0xdf3c('0x2f')](_0x3b55c2,_0xdf3c('0xe6'));}var _0x234c08=this['getUser']['sync'](this,_0x3b55c2[_0xdf3c('0xe5')]);if(!_0x234c08){return this[_0xdf3c('0xf')]['error'](_0x3b55c2,_0xdf3c('0xe7'));}var _0x5eebe3=this[_0xdf3c('0xf')][_0xdf3c('0x5c')](_0xdf3c('0xe8'),[util[_0xdf3c('0x2c')](_0xdf3c('0xe9'),_0x234c08),_0x3b55c2[_0xdf3c('0x6b')],_0x3b55c2['opts'],_0x3b55c2[_0xdf3c('0x6a')]]);if(_0x5eebe3[_0xdf3c('0xac')]===-0x1){return _0x5eebe3;}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xea'),_0xdf3c('0xe8')));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xeb')]=function(_0x127bfb){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0xec'),_0x127bfb[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0x127bfb[_0xdf3c('0x88')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xed'));}if(!this[_0xdf3c('0x8c')](_0x127bfb['text'])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}this[_0xdf3c('0xf')][_0xdf3c('0xee')]=!![];this[_0xdf3c('0x39')](_0x127bfb);this[_0xdf3c('0x45')](_0x127bfb[_0xdf3c('0x62')],'in','','');this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xef'),_0x127bfb[_0xdf3c('0x62')]));var _0x4c7e12=this[_0xdf3c('0x7f')][_0xdf3c('0x75')](this,_0x127bfb);if(_0x4c7e12){for(var _0x5a1c3a in _0x4c7e12){if(_0x4c7e12[_0xdf3c('0x9d')](_0x5a1c3a)){this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0xf0'),_0x5a1c3a[_0xdf3c('0xf1')]()),_0x4c7e12[_0x5a1c3a]);}}this[_0xdf3c('0x45')](_0x4c7e12[_0xdf3c('0xf2')],_0xdf3c('0xf3'),_0xdf3c('0xeb'),'');return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')]('Dialogflow\x20Result\x20%s',_0x4c7e12[_0xdf3c('0xf2')]));}return this['channel'][_0xdf3c('0x2f')](_0x127bfb,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xdf3c('0x11')]['dialogflowV2']=function(_0x474b7f){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xf4'),_0x474b7f[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x474b7f[_0xdf3c('0x82')])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0xf5'));}if(!this[_0xdf3c('0x8c')](_0x474b7f[_0xdf3c('0x83')])){return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0xf6'));}if(!this[_0xdf3c('0x8c')](_0x474b7f[_0xdf3c('0x84')])){return this['channel']['noop']('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x474b7f[_0xdf3c('0x85')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xf7'));}if(!this[_0xdf3c('0x8c')](_0x474b7f[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0xb1'));}this['channel'][_0xdf3c('0xee')]=!![];this[_0xdf3c('0x39')](_0x474b7f);this[_0xdf3c('0x45')](_0x474b7f[_0xdf3c('0x62')],'in','','');this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xf8'),_0x474b7f['text']));var _0xc2698=this[_0xdf3c('0x81')][_0xdf3c('0x75')](this,_0x474b7f);if(_0xc2698){for(var _0x75285d in _0xc2698){if(_0xc2698[_0xdf3c('0x9d')](_0x75285d)){if(_0x75285d!=='providerResponse'){this['channel'][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0xf0'),_0x75285d[_0xdf3c('0xf1')]()),_0xc2698[_0x75285d]);}}}this[_0xdf3c('0x45')](_0xc2698[_0xdf3c('0xf2')],_0xdf3c('0xf3'),_0xdf3c('0xf9'),_0xc2698[_0xdf3c('0xfa')]);return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0xfb'),_0xc2698[_0xdf3c('0xf2')]));}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x474b7f,_0xdf3c('0xfc'));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xfd')]=function(_0x4e8ad8){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0xfe'),_0x4e8ad8['label']));if(!this[_0xdf3c('0x8c')](_0x4e8ad8[_0xdf3c('0xff')])){return this['channel']['noop'](_0xdf3c('0x100'));}if(!this[_0xdf3c('0x8c')](_0x4e8ad8[_0xdf3c('0x101')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')]('no\x20username\x20configured');}if(!this[_0xdf3c('0x8c')](_0x4e8ad8[_0xdf3c('0x102')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0x103'));}if(!this['isConfigured'](_0x4e8ad8[_0xdf3c('0x104')])){return this['channel'][_0xdf3c('0xb0')]('no\x20text\x20configured');}this['channel'][_0xdf3c('0xee')]=!![];this[_0xdf3c('0x39')](_0x4e8ad8);this[_0xdf3c('0x45')](_0x4e8ad8[_0xdf3c('0x62')],'in','','');this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x105'),_0x4e8ad8['text']));var _0xc68c84=this[_0xdf3c('0x86')][_0xdf3c('0x75')](this,_0x4e8ad8);if(_0xc68c84){for(var _0x386a3b in _0xc68c84){if(_0xc68c84[_0xdf3c('0x9d')](_0x386a3b)){this['channel'][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0x106'),_0x386a3b[_0xdf3c('0xf1')]()),_0xc68c84[_0x386a3b]);}}this[_0xdf3c('0x45')](_0xc68c84['speech'],_0xdf3c('0xf3'),_0xdf3c('0xfd'),'');if(_0xc68c84[_0xdf3c('0x107')]){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x108'),_0xc68c84[_0xdf3c('0x107')]));var _0xb2e933=this[_0xdf3c('0xf')][_0xdf3c('0x109')](_0xc68c84[_0xdf3c('0x107')]);try{fs[_0xdf3c('0x10a')](_0xc68c84[_0xdf3c('0x107')]+_0xdf3c('0x10b'));}catch(_0x2be6c7){logger[_0xdf3c('0x2f')](_0x2be6c7);}return _0xb2e933;}else{return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x10c'),_0xc68c84[_0xdf3c('0xf2')]));}}return this['channel'][_0xdf3c('0x2f')](_0x4e8ad8,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xdf3c('0x11')]['end']=function(_0x425ddb){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x10d'),_0x425ddb[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0x10e'));};AGIVertices[_0xdf3c('0x11')]['ext_dial']=function(_0x3ef6db){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x10f'),_0x3ef6db['label']));var _0x5d5945='';if(_0x3ef6db[_0xdf3c('0x110')]){if(!this[_0xdf3c('0x8c')](_0x3ef6db[_0xdf3c('0x110')])){return this[_0xdf3c('0xf')]['error'](_0x3ef6db,_0xdf3c('0x111'));}else{var _0x5bc20a=parseInt(_0x3ef6db['trunk_id'],0xa);if(isNaN(_0x5bc20a)){_0x5d5945=_0x3ef6db[_0xdf3c('0x110')];}else{_0x5d5945=this[_0xdf3c('0x1f')]['sync'](this,_0x3ef6db[_0xdf3c('0x110')]);if(!_0x5d5945){return this[_0xdf3c('0xf')]['error'](_0x3ef6db,_0xdf3c('0x112'));}}}}else if(_0x3ef6db[_0xdf3c('0x113')]){_0x5d5945=_0x3ef6db['trunk_name'];}else{return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x3ef6db,_0xdf3c('0x111'));}var _0x41796d=this[_0xdf3c('0xf')][_0xdf3c('0x5c')]('DIAL',[util['format'](_0xdf3c('0x114'),_0x5d5945,_0x3ef6db[_0xdf3c('0x4c')]),_0x3ef6db[_0xdf3c('0x6b')],_0x3ef6db[_0xdf3c('0x115')],_0x3ef6db[_0xdf3c('0x6a')]]);if(_0x41796d[_0xdf3c('0xac')]===-0x1){return _0x41796d;}return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xea'),_0xdf3c('0xe8')));};AGIVertices['prototype'][_0xdf3c('0x116')]=function(_0x324940){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x117'),_0x324940[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0x116'));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xe')]=function(_0x216d47){logger['info'](util['format'](_0xdf3c('0x118'),_0x216d47[_0xdf3c('0x3b')]));if(_0x216d47[_0xdf3c('0xaf')]===0x0){return this[_0xdf3c('0xae')](_0x216d47);}_0x216d47[_0xdf3c('0xaf')]-=0x1;if(!this[_0xdf3c('0x8c')](_0x216d47[_0xdf3c('0x119')])){return this[_0xdf3c('0xf')]['error'](_0x216d47,_0xdf3c('0x11a'));}var _0x4765d2=this['getSound'][_0xdf3c('0x75')](this,_0x216d47[_0xdf3c('0x119')]);if(!_0x4765d2){return this['channel'][_0xdf3c('0x2f')](_0x216d47,'no\x20file\x20audio\x20found');}if(!this[_0xdf3c('0x8c')](_0x216d47[_0xdf3c('0xde')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4ae409=this['channel'][_0xdf3c('0x11b')](_0x4765d2,_0x216d47[_0xdf3c('0x11c')],_0x216d47[_0xdf3c('0x11d')]);var _0x22cb17=_0x4ae409[_0xdf3c('0xac')]?_0x4ae409[_0xdf3c('0xac')][_0xdf3c('0x51')]():'';logger['info'](_0xdf3c('0x11e'),JSON[_0xdf3c('0x78')](_0x4ae409));if(_0x4ae409['result']===-0x1){this[_0xdf3c('0x39')]['sync'](this,_0x216d47,_0x22cb17);return _0x4ae409;}else if(_0x4ae409[_0xdf3c('0xaa')]===_0xdf3c('0x6b')){_0x4ae409[_0xdf3c('0xac')]=_0x22cb17['length']>=parseInt(_0x216d47[_0xdf3c('0x11f')])?'x':'i';}else{_0x4ae409[_0xdf3c('0xac')]=_0x22cb17[_0xdf3c('0xa2')]>=parseInt(_0x216d47[_0xdf3c('0x11f')])&&_0x22cb17[_0xdf3c('0xa2')]<=parseInt(_0x216d47['maxdigit'])?'x':'i';}var _0xa16b7f=this[_0xdf3c('0x12')][_0xdf3c('0x75')](this,_0x216d47[_0xdf3c('0xde')]);if(!_0xa16b7f){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x216d47,_0xdf3c('0x120'));}this['channel'][_0xdf3c('0xa4')](_0xa16b7f,_0x22cb17);if(this[_0xdf3c('0x8c')](_0x216d47[_0xdf3c('0x121')])){var _0x4ecd66=parseInt(_0x216d47[_0xdf3c('0x121')],0xa);var _0x58dd62=rs[_0xdf3c('0x122')]({'charset':'*','length':_0x4ecd66});var _0x42d103=_0x22cb17['length'];if(_0x42d103>0x0){if(_0x42d103>_0x4ecd66){this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x216d47,_0x216d47[_0xdf3c('0x123')]===_0xdf3c('0x124')?_0x58dd62+_0x22cb17[_0xdf3c('0x125')](_0x4ecd66):_0x22cb17[_0xdf3c('0x125')](0x0,_0x42d103-_0x4ecd66)+_0x58dd62);}else{this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x216d47,rs[_0xdf3c('0x122')]({'charset':'*','length':_0x42d103}));}}else{this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x216d47,'');}}else{this[_0xdf3c('0x39')]['sync'](this,_0x216d47,_0x22cb17);}return _0x4ae409;};AGIVertices[_0xdf3c('0x11')]['getsecretdigits']=function(_0x57e693){logger['info'](util['format'](_0xdf3c('0x126'),_0x57e693[_0xdf3c('0x3b')]));return this[_0xdf3c('0xe')](_0x57e693);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x127')]=function(_0x3f44b7){logger['info'](util[_0xdf3c('0x2c')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x3f44b7[_0xdf3c('0x3b')]));this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x3f44b7,_0x3f44b7[_0xdf3c('0x128')]);return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x129'),_0x3f44b7[_0xdf3c('0x128')]));};AGIVertices['prototype'][_0xdf3c('0x12a')]=function(_0x258b2d){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x258b2d['label']));if(!this[_0xdf3c('0x8c')](_0x258b2d[_0xdf3c('0x92')])||!this[_0xdf3c('0x8c')](_0x258b2d[_0xdf3c('0x93')])){return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0x12b'));}if(!this[_0xdf3c('0x8c')](_0x258b2d[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x12c'),_0x258b2d[_0xdf3c('0x62')]));var _0x367df9=this[_0xdf3c('0x8e')]['sync'](this,_0x258b2d);if(_0x367df9){this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x12d'),_0x367df9));var _0x1b2961=this[_0xdf3c('0xf')]['streamFile'](_0x367df9);try{fs[_0xdf3c('0x10a')](_0x367df9+_0xdf3c('0x10b'));}catch(_0x376002){logger[_0xdf3c('0x2f')](_0x376002);}return _0x1b2961;}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x258b2d,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x12e')]=function(_0x5eb960){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x12f'),_0x5eb960[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x5eb960[_0xdf3c('0x92')])||!this['isConfigured'](_0x5eb960['aws_secret_access_key'])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0x12b'));}if(!this[_0xdf3c('0x8c')](_0x5eb960[_0xdf3c('0x130')])){return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0x131'));}if(!this[_0xdf3c('0x8c')](_0x5eb960[_0xdf3c('0x62')])){return this['channel']['noop'](_0xdf3c('0xb1'));}this['channel'][_0xdf3c('0xee')]=!![];this[_0xdf3c('0x39')](_0x5eb960);this[_0xdf3c('0x45')](_0x5eb960[_0xdf3c('0x62')],'in','','');this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x132'),_0x5eb960[_0xdf3c('0x62')]));var _0x5a44f1=this[_0xdf3c('0x91')][_0xdf3c('0x75')](this,_0x5eb960);if(_0x5a44f1){for(var _0x8f769e in _0x5a44f1){if(_0x5a44f1[_0xdf3c('0x9d')](_0x8f769e)&&_[_0xdf3c('0x9e')](_0x5a44f1[_0x8f769e])){this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util['format']('AWS_LEX_%s',_0x8f769e[_0xdf3c('0xf1')]()),_0x5a44f1[_0x8f769e]);}}if(_['isNil'](_0x5a44f1[_0xdf3c('0x7c')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0x133'));}else{this['createSquareMessage'](_0x5a44f1[_0xdf3c('0x7c')],'out',_0xdf3c('0x134'),'');return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x135'),_0x5a44f1[_0xdf3c('0x7c')]));}}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x5eb960,_0xdf3c('0x136'));};AGIVertices['prototype'][_0xdf3c('0x137')]=function(_0x42f305){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x42f305[_0xdf3c('0x3b')],_0x42f305[_0xdf3c('0x6b')]));if(!this[_0xdf3c('0x8c')](_0x42f305[_0xdf3c('0x88')])){return this[_0xdf3c('0xf')]['noop']('no\x20key\x20configured');}var _0x54a06b=_0xdf3c('0x138');var _0x47bef6=util[_0xdf3c('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0xdf3c('0x122')](0x4));var _0x2160ff=util[_0xdf3c('0x2c')]('%s.%s',_0x47bef6,_0x54a06b);var _0x47d44e=!![];if(_0x42f305['beep']===_0xdf3c('0x139')){_0x47d44e=![];}var _0xeecefd=this['channel'][_0xdf3c('0x13a')](_0x47bef6,_0x54a06b,_0x42f305[_0xdf3c('0x13b')],_0x42f305[_0xdf3c('0x6b')],undefined,_0x47d44e);if(_0xeecefd[_0xdf3c('0xac')]!==-0x1){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x13c'),_0x2160ff));var _0x5797ff=this[_0xdf3c('0x95')][_0xdf3c('0x75')](this,_0x42f305,_0x2160ff);if(_0x5797ff){for(var _0x37e578 in _0x5797ff){if(_0x5797ff[_0xdf3c('0x9d')](_0x37e578)){this[_0xdf3c('0xf')]['setVariable'](util[_0xdf3c('0x2c')](_0xdf3c('0x13d'),_0x37e578[_0xdf3c('0xf1')]()),_0x5797ff[_0x37e578]);}}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')]('GoogleASR\x20Result\x20%s',JSON[_0xdf3c('0x78')](_0x5797ff)));}}return _0xeecefd;};AGIVertices['prototype'][_0xdf3c('0x13e')]=function(_0x418d6b){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x13f'),_0x418d6b[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x418d6b[_0xdf3c('0x98')])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0x140'));}if(!this[_0xdf3c('0x8c')](_0x418d6b[_0xdf3c('0x99')])){return this['channel'][_0xdf3c('0xb0')]('no\x20appsecret\x20configured');}var _0xddf03e=_0xdf3c('0x138');var _0x22b00b=util[_0xdf3c('0x2c')](_0xdf3c('0x141'),FILES_PATH,rs[_0xdf3c('0x122')](0x4));var _0x311098=util[_0xdf3c('0x2c')](_0xdf3c('0xa5'),_0x22b00b,_0xddf03e);var _0x33230c=!![];if(_0x418d6b[_0xdf3c('0x142')]===_0xdf3c('0x139')){_0x33230c=![];}var _0x597a56=this['channel']['recordFile'](_0x22b00b,_0xddf03e,_0x418d6b[_0xdf3c('0x13b')],_0x418d6b[_0xdf3c('0x6b')],undefined,_0x33230c);if(_0x597a56[_0xdf3c('0xac')]!==-0x1){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x143'),_0x311098));var _0x46f737=this[_0xdf3c('0x97')][_0xdf3c('0x75')](this,_0x418d6b,_0x311098);if(_0x46f737){for(var _0x38aedd in _0x46f737){if(_0x46f737[_0xdf3c('0x9d')](_0x38aedd)){this[_0xdf3c('0xf')]['setVariable'](util['format'](_0xdf3c('0x144'),_0x38aedd[_0xdf3c('0xf1')]()),_0x46f737[_0x38aedd]);}}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')]('TildeASR\x20Result\x20%s',JSON[_0xdf3c('0x78')](_0x46f737)));}}return _0x597a56;};AGIVertices[_0xdf3c('0x11')]['gotoc']=function(_0xabf05c){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x145'),_0xabf05c[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')][_0xdf3c('0x146')](_0xabf05c[_0xdf3c('0x40')],_0xabf05c['extension'],_0xabf05c[_0xdf3c('0x147')]);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x148')]=function(_0x458e39){logger['info'](util['format'](_0xdf3c('0x149'),_0x458e39[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x458e39[_0xdf3c('0x14a')])){return this['channel']['error'](_0x458e39,_0xdf3c('0x14b'));}try{var _0x1b0ad5=eval(_0x458e39[_0xdf3c('0x14a')])?'true':_0xdf3c('0x14c');this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x14d'),_0x458e39['condition'],_0x1b0ad5));return{'code':0xc8,'result':_0x1b0ad5};}catch(_0x5ef9d0){return{'code':0xc8,'result':_0xdf3c('0x14c')};}};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x14e')]=function(_0x539721){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x539721[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x539721[_0xdf3c('0x14f')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x539721,_0xdf3c('0x150'));}var _0x1d61c5=this[_0xdf3c('0x151')][_0xdf3c('0x75')](this,_0x539721[_0xdf3c('0x14f')]);if(!_0x1d61c5){return this[_0xdf3c('0xf')]['error'](_0x539721,_0xdf3c('0x152'));}for(var _0x176fe=0x0;_0x176fe<_0x1d61c5[_0xdf3c('0xa2')];_0x176fe+=0x1){var _0x4b9541=this[_0xdf3c('0xf')][_0xdf3c('0x12')](util[_0xdf3c('0x2c')](_0xdf3c('0x153'),_0x1d61c5[_0x176fe]));if(_0x4b9541['result']===-0x1){return _0x4b9541;}logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x154'),_0x1d61c5[_0x176fe],_0x4b9541[_0xdf3c('0xaa')]));if(_0x4b9541[_0xdf3c('0xaa')]===_0xdf3c('0x155')){logger['info'](util[_0xdf3c('0x2c')]('IFTIME\x20%s\x20%s',_0x1d61c5[_0x176fe],_0xdf3c('0x155')));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x154'),_0x1d61c5[_0x176fe],_0xdf3c('0x155')));return{'code':0xc8,'result':_0xdf3c('0x155')};}else{logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x154'),_0x1d61c5[_0x176fe],'false'));this[_0xdf3c('0xf')]['noop'](util['format'](_0xdf3c('0x154'),_0x1d61c5[_0x176fe],_0xdf3c('0x14c')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xdf3c('0x11')]['hangup']=function(_0x5e1d8b){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x156'),_0x5e1d8b[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')][_0xdf3c('0x157')]();};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x158')]=function(_0x4c82c4){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x159'),_0x4c82c4[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x4c82c4[_0xdf3c('0x88')])){return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0xed'));}var _0x178d3e=_0xdf3c('0x138');var _0x5857e7=util['format'](_0xdf3c('0x141'),FILES_PATH,rs['generate'](0x4));var _0x7f3f0b=util['format'](_0xdf3c('0xa5'),_0x5857e7,_0x178d3e);var _0x209c4f=!![];if(_0x4c82c4['beep']===_0xdf3c('0x139')){_0x209c4f=![];}var _0x2a37bc=this[_0xdf3c('0xf')][_0xdf3c('0x13a')](_0x5857e7,_0x178d3e,_0x4c82c4[_0xdf3c('0x13b')],_0x4c82c4[_0xdf3c('0x6b')],undefined,_0x209c4f);if(_0x2a37bc['result']!==-0x1){this['channel'][_0xdf3c('0xb0')](util['format'](_0xdf3c('0x15a'),_0x7f3f0b));var _0x1af97a=this[_0xdf3c('0x8a')][_0xdf3c('0x75')](this,_0x4c82c4,_0x7f3f0b);if(_0x1af97a){for(var _0x1263bf in _0x1af97a){if(_0x1af97a[_0xdf3c('0x9d')](_0x1263bf)){this['channel']['setVariable'](util['format'](_0xdf3c('0x15b'),_0x1263bf['toUpperCase']()),_0x1af97a[_0x1263bf]);}}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0x15c'),JSON[_0xdf3c('0x78')](_0x1af97a)));}}return _0x2a37bc;};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x15d')]=function(_0x2beff1){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x15e'),_0x2beff1['label']));if(!this[_0xdf3c('0x8c')](_0x2beff1[_0xdf3c('0x88')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xed'));}if(!this[_0xdf3c('0x8c')](_0x2beff1[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x15f'),_0x2beff1[_0xdf3c('0x62')]));var _0x516aa3=this[_0xdf3c('0x87')]['sync'](this,_0x2beff1);if(_0x516aa3){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0x15a'),_0x516aa3));var _0x23fad4=this['channel'][_0xdf3c('0x109')](_0x516aa3,_0x2beff1[_0xdf3c('0x13b')]);try{fs[_0xdf3c('0x10a')](_0x516aa3+_0xdf3c('0x10b'));}catch(_0x5add00){logger['error'](_0x5add00);}return _0x23fad4;}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x2beff1,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x160')]=function(_0x78ff07){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x161'),_0x78ff07[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x78ff07['findBy'])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x78ff07,_0xdf3c('0x162'));}logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x163'),this[_0xdf3c('0xf')]['callerid'],_0x78ff07[_0xdf3c('0x164')]));var _0x118a21=this[_0xdf3c('0x57')][_0xdf3c('0x75')](this,_0x78ff07[_0xdf3c('0x164')]);if(_0x118a21){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x78ff07['findBy']));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x78ff07[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x166')};}else{logger['info'](util['format'](_0xdf3c('0x167'),this['channel'][_0xdf3c('0x3d')],_0x78ff07[_0xdf3c('0x164')]));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x78ff07[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x168')};}};AGIVertices[_0xdf3c('0x11')]['logout']=function(_0x4fcf64){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x169'),_0x4fcf64[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x4fcf64[_0xdf3c('0x164')])){return this['channel'][_0xdf3c('0x2f')](_0x4fcf64,_0xdf3c('0x162'));}logger[_0xdf3c('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xdf3c('0xf')]['callerid'],_0x4fcf64['findBy']));var _0x136935=this[_0xdf3c('0x56')]['sync'](this,_0x4fcf64[_0xdf3c('0x164')]);if(_0x136935){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x4fcf64[_0xdf3c('0x164')]));this['channel']['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x4fcf64[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x166')};}else{logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x167'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x4fcf64[_0xdf3c('0x164')]));this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x167'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x4fcf64[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x168')};}};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x16a')]=function(_0x243447){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x16b'),_0x243447[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0x243447[_0xdf3c('0x16c')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x243447,_0xdf3c('0x16d'));}this['channel'][_0xdf3c('0xb0')](util['format'](_0xdf3c('0x16e'),_0x243447[_0xdf3c('0x16c')]));var _0x4a9157=eval(_0x243447[_0xdf3c('0x16c')]);if(!this[_0xdf3c('0x8c')](_0x243447[_0xdf3c('0xde')])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0xdd'));}var _0x172b7c=this['getVariable'][_0xdf3c('0x75')](this,_0x243447['variable_id']);if(!_0x172b7c){return this[_0xdf3c('0xf')]['error'](_0x243447,_0xdf3c('0x120'));}if(_[_0xdf3c('0xa1')](_0x4a9157)){var _0x56d4db=this;_0x4a9157[_0xdf3c('0xdf')](function(_0x5c8dcc,_0x399564){_0x56d4db[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0x16f'),_0x172b7c,_0x399564),_0x5c8dcc);});return this[_0xdf3c('0xf')]['noop'](util['format'](_0xdf3c('0x170'),_0x172b7c));}else{return this['channel'][_0xdf3c('0xa4')](_0x172b7c,_0x4a9157);}};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xd')]=function(_0x53ccf7){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x53ccf7['label']));if(_0x53ccf7[_0xdf3c('0xaf')]===0x0){return this['maxRetry'](_0x53ccf7);}_0x53ccf7[_0xdf3c('0xaf')]-=0x1;if(!this[_0xdf3c('0x8c')](_0x53ccf7[_0xdf3c('0x119')])){return this[_0xdf3c('0xf')]['error'](_0x53ccf7,'no\x20file\x20audio\x20selected');}var _0xc7732c=this[_0xdf3c('0x21')][_0xdf3c('0x75')](this,_0x53ccf7[_0xdf3c('0x119')]);if(!_0xc7732c){return this[_0xdf3c('0xf')]['error'](_0x53ccf7,_0xdf3c('0x171'));}var _0x242fc1=this[_0xdf3c('0xf')][_0xdf3c('0x11b')](_0xc7732c,_0x53ccf7[_0xdf3c('0x11c')],_0x53ccf7[_0xdf3c('0x172')]);var _0x5c0853=_0x242fc1[_0xdf3c('0xac')];if(_0x242fc1['result']===-0x1){this[_0xdf3c('0x39')]['sync'](this,_0x53ccf7,'-1');return _0x242fc1;}else if(_0x242fc1[_0xdf3c('0xaa')]===_0xdf3c('0x6b')){_0x242fc1['result']=_0x242fc1[_0xdf3c('0xac')]['length']>0x0?_0x242fc1[_0xdf3c('0xac')]:'t';}else if(_[_0xdf3c('0x47')](_0x242fc1[_0xdf3c('0xac')])){_0x242fc1[_0xdf3c('0xac')]='#';_0x5c0853='#';}if(!this[_0xdf3c('0x8c')](_0x53ccf7[_0xdf3c('0xde')])){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xdd'));}else{var _0xfa1485=this[_0xdf3c('0x12')][_0xdf3c('0x75')](this,_0x53ccf7[_0xdf3c('0xde')]);if(!_0xfa1485){return this['channel'][_0xdf3c('0x2f')](_0x53ccf7,_0xdf3c('0x120'));}this[_0xdf3c('0xf')][_0xdf3c('0xa4')](_0xfa1485,_0x5c0853);}this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x53ccf7,_0x5c0853);return _0x242fc1;};AGIVertices['prototype']['noop']=function(_0x3c98b1){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x173'),_0x3c98b1['label']));return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0x3c98b1[_0xdf3c('0x174')]||_0x3c98b1['label']);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x175')]=function(_0x353039){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x176'),_0x353039[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x353039[_0xdf3c('0x164')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x353039,'no\x20find\x20by\x20configured');}logger[_0xdf3c('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x353039[_0xdf3c('0x164')]));var _0x193f32=this[_0xdf3c('0x52')][_0xdf3c('0x75')](this,_0x353039['pause_id']);var _0xa1c12d=this['agentPause'][_0xdf3c('0x75')](this,_0x353039[_0xdf3c('0x164')],_0x193f32);if(_0xa1c12d){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')]['callerid'],_0x353039[_0xdf3c('0x164')]));this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x353039[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x166')};}else{logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x167'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x353039[_0xdf3c('0x164')]));this[_0xdf3c('0xf')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x353039[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x168')};}};AGIVertices['prototype'][_0xdf3c('0x177')]=function(_0x337ffb){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x178'),_0x337ffb[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0x337ffb[_0xdf3c('0x119')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x337ffb,'no\x20file\x20audio\x20selected');}var _0x37915a=this['getSound']['sync'](this,_0x337ffb[_0xdf3c('0x119')]);if(!_0x37915a){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x337ffb,_0xdf3c('0x171'));}var _0x396ef2=this[_0xdf3c('0xf')][_0xdf3c('0x5c')](_0xdf3c('0x179'),[_0x37915a,_0x337ffb[_0xdf3c('0x115')]]);if(_0x396ef2['result']===-0x1){return _0x396ef2;}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0xca'),_0xdf3c('0x179'),_0x37915a));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x17a')]=function(_0xeeba72){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x17b'),_0xeeba72[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0xeeba72[_0xdf3c('0x17c')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0xeeba72,_0xdf3c('0x17d'));}var _0xb0062b='';var _0x29c058=parseInt(_0xeeba72[_0xdf3c('0x17c')],0xa);if(isNaN(_0x29c058)){_0xb0062b=_0xeeba72[_0xdf3c('0x17c')];}else{_0xb0062b=this[_0xdf3c('0x16')][_0xdf3c('0x75')](this,_0xeeba72['queue_id']);if(!_0xb0062b){return this[_0xdf3c('0xf')]['error'](_0xeeba72,_0xdf3c('0x17e'));}}var _0x5199cc='';if(this[_0xdf3c('0x8c')](_0xeeba72['file_id'])){var _0x36fc26=this['getSound'][_0xdf3c('0x75')](this,_0xeeba72['file_id']);if(_0x36fc26){_0x5199cc=_0x36fc26;}}this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0xeeba72,_0xb0062b);if(_0xeeba72[_0xdf3c('0x115')]['indexOf']('x')<0x0){_0xeeba72[_0xdf3c('0x115')]+='x';}if(_0xeeba72['opts'][_0xdf3c('0x17f')]('X')<0x0){_0xeeba72[_0xdf3c('0x115')]+='X';}this[_0xdf3c('0xf')][_0xdf3c('0xa4')](_0xdf3c('0x180'),_0xb0062b?_0xb0062b[_0xdf3c('0x181')]():'');var _0x159cb2=this[_0xdf3c('0xf')][_0xdf3c('0x5c')](_0xdf3c('0x182'),[_0xb0062b,_0xeeba72[_0xdf3c('0x115')],_0xeeba72[_0xdf3c('0x6a')],_0x5199cc,_0xeeba72[_0xdf3c('0x6b')],_0xeeba72[_0xdf3c('0x8')],_0xeeba72[_0xdf3c('0x183')],_0xeeba72[_0xdf3c('0x184')],'',_0xeeba72['position']]);if(_0x159cb2[_0xdf3c('0xac')]===-0x1){return _0x159cb2;}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0xca'),'QUEUE',_0xb0062b));};AGIVertices['prototype'][_0xdf3c('0x185')]=function(_0x2bf18c){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x2bf18c[_0xdf3c('0x3b')]));var _0x7a9747=_0x2bf18c['recordingFormat']||'wav';var _0x58465d=util['format'](_0xdf3c('0x186'),this[_0xdf3c('0xf')]['uniqueid'],rs[_0xdf3c('0x122')](0x5));var _0x4c3e3d=util[_0xdf3c('0x2c')](_0xdf3c('0x187'),FILES_PATH,_0x58465d,_0x7a9747);var _0x5b0483=util[_0xdf3c('0x2c')](_0xdf3c('0x141'),FILES_PATH,_0x58465d);this['createSquareRecording'][_0xdf3c('0x75')](this,_0x2bf18c,_0x58465d,_0x4c3e3d);this[_0xdf3c('0xf')]['setVariable'](_0xdf3c('0x188'),_0x58465d);logger[_0xdf3c('0x31')](_0xdf3c('0x189'),_0x5b0483,_0x7a9747,_0x2bf18c[_0xdf3c('0x18a')],_0x2bf18c[_0xdf3c('0x6b')]);return this[_0xdf3c('0xf')][_0xdf3c('0x13a')](_0x5b0483,_0x7a9747,_0x2bf18c[_0xdf3c('0x18a')],_0x2bf18c['timeout'],undefined,!![]);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x18b')]=function(_0x1009c6){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x18c'),_0x1009c6[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x1009c6['url'])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0x18d'));}var _0x4fb97e=this['restAPI'][_0xdf3c('0x75')](this,_0x1009c6);logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x18e'),util['inspect'](_0x4fb97e,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1009c6['variable_id'])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0x18f'));}var _0x517e73=this['getVariable'][_0xdf3c('0x75')](this,_0x1009c6['variable_id']);if(!_0x517e73){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x1009c6,'no\x20variable\x20found');}this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0x190'),_0x517e73),_0x4fb97e[_0xdf3c('0x7a')]?_0x4fb97e['statusCode']:_0xdf3c('0x191'));this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0x192'),_0x517e73),_0x4fb97e[_0xdf3c('0x7b')]?_0x4fb97e[_0xdf3c('0x7b')]:'OK');if(_0x4fb97e['body']){try{this['saveRestApiResult'](_0x4fb97e[_0xdf3c('0x6f')],_0x517e73);}catch(_0x439d2e){logger[_0xdf3c('0x2f')](util[_0xdf3c('0x2c')](_0xdf3c('0x193'),_0x517e73));}}return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xe1'),_0x517e73));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x194')]=function(_0x3696b8){logger['info'](util['format'](_0xdf3c('0x195'),_0x3696b8[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')]['sayDigits'](_0x3696b8[_0xdf3c('0x196')][_0xdf3c('0x5e')](/\s+/g,''),_0x3696b8[_0xdf3c('0x18a')]);};AGIVertices['prototype'][_0xdf3c('0x197')]=function(_0x1c56e0){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x198'),_0x1c56e0[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')][_0xdf3c('0x199')](_0x1c56e0[_0xdf3c('0x6c')][_0xdf3c('0x5e')](/\s+/g,''),_0x1c56e0[_0xdf3c('0x18a')]);};AGIVertices['prototype'][_0xdf3c('0x19a')]=function(_0x4ec4cd){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x19b'),_0x4ec4cd[_0xdf3c('0x3b')]));return this['channel']['sayPhonetic'](_0x4ec4cd['text'],_0x4ec4cd[_0xdf3c('0x18a')]);};AGIVertices['prototype'][_0xdf3c('0x19c')]=function(_0x5120ed){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x19d'),_0x5120ed[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x5120ed[_0xdf3c('0x19e')])){return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0x19f'));}var _0xff480=this['getMailAccount']['sync'](this,_0x5120ed['account_id']);if(!_0xff480||!_0xff480['Smtp']){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x5120ed,'no\x20mail\x20account\x20found');}var _0x53a9c2={'from':util['format'](_0xdf3c('0x1a0'),_0xff480[_0xdf3c('0x18')],_0xff480[_0xdf3c('0x1a1')]||_0xff480[_0xdf3c('0x1a2')][_0xdf3c('0x1a3')]),'to':_0x5120ed['to']||'','cc':_0x5120ed['cc']||'','bcc':_0x5120ed[_0xdf3c('0x1a4')]||'','subject':_0x5120ed[_0xdf3c('0x1a5')],'html':_0x5120ed['text'],'text':_0x5120ed[_0xdf3c('0x62')]};if(this[_0xdf3c('0x8c')](_0x5120ed[_0xdf3c('0x1a6')])){}logger[_0xdf3c('0xe3')](_0xdf3c('0x1a7'),JSON[_0xdf3c('0x78')](_0x53a9c2));this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x5120ed,_0x5120ed['account_id']);this['channel']['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x1a8'),_0xff480[_0xdf3c('0x18')]));this['sendMailMessage'][_0xdf3c('0x75')](this,_0xff480[_0xdf3c('0x1a9')],_0x53a9c2);return this[_0xdf3c('0xf')][_0xdf3c('0xb0')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1aa')]=function(_0x3a2c6a){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x1ab'),_0x3a2c6a[_0xdf3c('0x3b')]));return this['channel']['noop'](_0xdf3c('0x1ac'));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1ad')]=function(_0x5420de){logger[_0xdf3c('0x31')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5420de[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0x5420de[_0xdf3c('0x1ae')])){return this['channel'][_0xdf3c('0xb0')]('no\x20sms\x20account\x20configured');}var _0x5a5def=this[_0xdf3c('0x36')][_0xdf3c('0x75')](this,_0x5420de[_0xdf3c('0x1ae')]);if(!_0x5a5def){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x5420de,_0xdf3c('0x1af'));}var _0x2c4484={'body':_0x5420de['sms_text'],'phone':_0x5420de['to']||'','SmsAccountId':_0x5a5def['id']};logger['debug'](_0xdf3c('0x1b0'),JSON['stringify'](_0x2c4484));this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x5420de,_0x5420de[_0xdf3c('0x1ae')]);this['channel']['noop'](util['format'](_0xdf3c('0x1b1'),_0x5a5def['name']));this[_0xdf3c('0x38')][_0xdf3c('0x75')](this,_0x2c4484);return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0x1b2'));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1b3')]=function(_0x56807d){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x1b4'),_0x56807d['label']));if(!this['isConfigured'](_0x56807d[_0xdf3c('0xde')])){return this['channel'][_0xdf3c('0x2f')](_0x56807d,'no\x20variable\x20selected');}var _0x452f92=this[_0xdf3c('0x12')][_0xdf3c('0x75')](this,_0x56807d[_0xdf3c('0xde')]);if(!_0x452f92){return this[_0xdf3c('0xf')]['error'](_0x56807d,_0xdf3c('0x120'));}return this[_0xdf3c('0xf')][_0xdf3c('0xa4')](_0x452f92,_0x56807d[_0xdf3c('0x1b5')]);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1b6')]=function(_0x2401a0){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2401a0['label']));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0x1b7'));var _0x32b937=this[_0xdf3c('0xf')]['getVariable'](_0xdf3c('0x1b8'));if(!_[_0xdf3c('0x47')](_0x32b937[_0xdf3c('0xaa')])){this[_0xdf3c('0xf')]['uniqueid']=_0x32b937[_0xdf3c('0xaa')];}if(_0x2401a0[_0xdf3c('0xbf')]===_0xdf3c('0x1b9')){this[_0xdf3c('0xf')][_0xdf3c('0xb0')]('Answer');return this['channel'][_0xdf3c('0xbf')]();}return this[_0xdf3c('0xf')]['noop']('Skipped\x20Answer');};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1ba')]=function(_0x5074e0){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x1bb'),_0x5074e0['label']));if(!this[_0xdf3c('0x8c')](_0x5074e0['project_id'])){return this['channel'][_0xdf3c('0x2f')](_0x5074e0,'no\x20subproject\x20selected');}var _0x29b827=this[_0xdf3c('0x19')]['sync'](this,_0x5074e0['project_id']);if(!this[_0xdf3c('0x8c')](_0x29b827)){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x5074e0,util[_0xdf3c('0x2c')](_0xdf3c('0x1bc'),_0x5074e0['project_id']));}if(_0x29b827===this[_0xdf3c('0xf')]['arg_1']){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x5074e0,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x5074e0,_0x29b827);var _0x1dd6bb=this[_0xdf3c('0xf')]['exec'](_0xdf3c('0x1bd'),util[_0xdf3c('0x2c')](_0xdf3c('0x1be'),config[_0xdf3c('0x8')][_0xdf3c('0x1bf')]||_0xdf3c('0x1c0'),_0x29b827,this[_0xdf3c('0xf')][_0xdf3c('0x3c')]));if(_0x1dd6bb[_0xdf3c('0xac')]===-0x1){return _0x1dd6bb;}return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xca'),_0xdf3c('0x1bd'),_0x29b827));};AGIVertices['prototype'][_0xdf3c('0x1c1')]=function(_0x3344b8){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x3344b8[_0xdf3c('0x3b')]));var _0x36fa48=this[_0xdf3c('0x5b')]['sync'](this,_0x3344b8[_0xdf3c('0xbd')]);this['createSquareDetailsReport'][_0xdf3c('0x75')](this,_0x3344b8,_0x3344b8[_0xdf3c('0xbd')]);if(this[_0xdf3c('0x8c')](_0x3344b8[_0xdf3c('0xde')])){var _0x3c669f=this[_0xdf3c('0x12')]['sync'](this,_0x3344b8[_0xdf3c('0xde')]);if(_0x3c669f){this[_0xdf3c('0xf')][_0xdf3c('0xa4')](_0x3c669f,_0x36fa48);return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0x1c2'),_0x3344b8[_0xdf3c('0xbd')],_0x3c669f));}}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x1c3'),_0x3344b8[_0xdf3c('0xbd')]));};AGIVertices['prototype'][_0xdf3c('0x1c4')]=function(_0xbd6cd8){logger['info'](util[_0xdf3c('0x2c')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0xbd6cd8[_0xdf3c('0x3b')]));_0xbd6cd8['text']=_0xbd6cd8[_0xdf3c('0x62')][_0xdf3c('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xdf3c('0x8c')](_0xbd6cd8[_0xdf3c('0x60')])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0x1c5'));}if(!this['isConfigured'](_0xbd6cd8['text'])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x1c6'),_0xbd6cd8['text']));var _0x247aea=this['googleCloudTTS'][_0xdf3c('0x75')](this,_0xbd6cd8);if(_0x247aea){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x1c7'),_0x247aea));var _0xca74ea=this['channel'][_0xdf3c('0x109')](_0x247aea);try{fs[_0xdf3c('0x10a')](_0x247aea+'.wav');}catch(_0x2d3153){logger[_0xdf3c('0x2f')](_0x2d3153);}return _0xca74ea;}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0xbd6cd8,_0xdf3c('0x1c8'));};AGIVertices['prototype']['tts']=function(_0x1db828){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1db828[_0xdf3c('0x3b')]));_0x1db828[_0xdf3c('0x62')]=_0x1db828[_0xdf3c('0x62')][_0xdf3c('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1db828[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')]['noop']('no\x20text\x20configured');}this['channel']['noop'](util[_0xdf3c('0x2c')]('Trying\x20Google\x20TTS\x20%s',_0x1db828[_0xdf3c('0x62')]));var _0x2cf3a1=this['googleTTS']['sync'](this,_0x1db828);if(_0x2cf3a1){this[_0xdf3c('0xf')]['noop'](util['format'](_0xdf3c('0x1c9'),_0x2cf3a1));var _0x4b8c41=this['channel']['streamFile'](_0x2cf3a1);try{fs[_0xdf3c('0x10a')](_0x2cf3a1+'.wav');}catch(_0xc6f51f){logger[_0xdf3c('0x2f')](_0xc6f51f);}return _0x4b8c41;}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x1db828,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1ca')]=function(_0x2a6deb){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x1cb'),_0x2a6deb['label']));if(!this[_0xdf3c('0x8c')](_0x2a6deb[_0xdf3c('0x164')])){return this['channel'][_0xdf3c('0x2f')](_0x2a6deb,_0xdf3c('0x162'));}logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x163'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x2a6deb[_0xdf3c('0x164')]));var _0x33c73e=this[_0xdf3c('0x54')][_0xdf3c('0x75')](this,_0x2a6deb['findBy']);if(_0x33c73e){logger['info'](util[_0xdf3c('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x2a6deb['findBy']));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x2a6deb[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x166')};}else{logger[_0xdf3c('0x31')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xdf3c('0x3d')],_0x2a6deb[_0xdf3c('0x164')]));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x167'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x2a6deb[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x168')};}};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1cc')]=function(_0x9ba122){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x9ba122[_0xdf3c('0x3b')]));var _0x56d351=this[_0xdf3c('0xf')][_0xdf3c('0x5c')]('VOICEMAIL',[_0x9ba122[_0xdf3c('0x1cd')],_0x9ba122[_0xdf3c('0x7e')]]);if(_0x56d351[_0xdf3c('0xac')]===-0x1){return _0x56d351;}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0xca'),_0xdf3c('0x1ce'),_0x9ba122['mailbox']));};AGIVertices[_0xdf3c('0x11')]['vswitch']=function(_0x47b291){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x1cf'),_0x47b291[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x47b291[_0xdf3c('0xde')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x47b291,_0xdf3c('0x1d0'));}var _0x134616=this[_0xdf3c('0x12')][_0xdf3c('0x75')](this,_0x47b291[_0xdf3c('0xde')]);if(!_0x134616){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x47b291,'no\x20variable\x20found');}var _0x282c92=this['channel'][_0xdf3c('0x12')](_0x134616);return{'code':0xc8,'result':_0x282c92[_0xdf3c('0xaa')]?_0x282c92['extra']:'-'};};String[_0xdf3c('0x11')][_0xdf3c('0xa9')]=function(_0x13d361,_0x3559e9){return this[_0xdf3c('0xa8')](_0x13d361)['join'](_0x3559e9);};module['exports']=AGIVertices; \ No newline at end of file +var _0x98d3=['An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','ispeechTTS','en-US','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_lex_region','aws_bot_name','googleASR','tildeASR','appid','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','length','isPlainObject','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','options','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','no\x20list\x20selected','scheduledAt','add','delay','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','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','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','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','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','account_id','Smtp','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','sendMail\x20message','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','sms_account_id','no\x20sms\x20account\x20configured','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','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','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','odbc','moment','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','save_name','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','callerid','createSquareRecording','calleridname','context','extension','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','shellCommand','googleCloudTTS','apiKey','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','url','timeout','POST','PUT','method','toUpperCase','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse'];(function(_0x2a7ed9,_0x5bb4bc){var _0xb194dc=function(_0x108212){while(--_0x108212){_0x2a7ed9['push'](_0x2a7ed9['shift']());}};_0xb194dc(++_0x5bb4bc);}(_0x98d3,0x173));var _0x398d=function(_0x39149,_0x548a65){_0x39149=_0x39149-0x0;var _0x5a0f05=_0x98d3[_0x39149];return _0x5a0f05;};'use strict';var fs=require('fs');var util=require(_0x398d('0x0'));var _=require(_0x398d('0x1'));var sh=require('shelljs');var odbc=require(_0x398d('0x2'))();var rs=require('randomstring');var moment=require(_0x398d('0x3'));var Mustache=require('mustache');var rp=require(_0x398d('0x4'));var logger=require(_0x398d('0x5'))('agi');var config=require('../../config/environment');var scripts=require(_0x398d('0x6'));var FILES_PATH=_0x398d('0x7');var recursiveMapAttributes=[_0x398d('0x8'),'rawBody'];var verticesWithRetry=[_0x398d('0x9'),_0x398d('0xa'),_0x398d('0xb')];var AGIVertices=function(_0x399598,_0x2f654c,_0x54c349){this[_0x398d('0xc')]=_0x399598;this[_0x398d('0xd')]=_0x2f654c;this[_0x398d('0xe')]=_0x54c349;};AGIVertices[_0x398d('0xf')][_0x398d('0x10')]=function(_0x1b144a,_0x37eb46){this[_0x398d('0xd')]['getVariableById'](_0x1b144a)[_0x398d('0x11')](function(_0x1f25e4){_0x37eb46(null,_0x1f25e4?_0x1f25e4[_0x398d('0x12')]:![]);})[_0x398d('0x13')](function(_0x15a424){_0x37eb46(_0x15a424);});};AGIVertices[_0x398d('0xf')][_0x398d('0x14')]=function(_0x162d55,_0x3bf2a2){this[_0x398d('0xd')][_0x398d('0x15')](_0x162d55)['then'](function(_0x50a3f9){_0x3bf2a2(null,_0x50a3f9?_0x50a3f9[_0x398d('0x12')]:![]);})[_0x398d('0x13')](function(_0x347508){_0x3bf2a2(_0x347508);});};AGIVertices[_0x398d('0xf')][_0x398d('0x16')]=function(_0x4099a5,_0x3ff03c){this[_0x398d('0xd')]['getSquareProjectById'](_0x4099a5)[_0x398d('0x11')](function(_0x54e717){_0x3ff03c(null,_0x54e717?_0x54e717[_0x398d('0x12')]:![]);})[_0x398d('0x13')](function(_0x297768){_0x3ff03c(_0x297768);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x4e574b,_0x28b124){this[_0x398d('0xd')][_0x398d('0x17')](_0x4e574b)[_0x398d('0x11')](function(_0x15f024){_0x28b124(null,_0x15f024?_0x15f024[_0x398d('0x18')]:![]);})[_0x398d('0x13')](function(_0x552411){_0x28b124(_0x552411);});};AGIVertices['prototype']['getUser']=function(_0x16e580,_0x3b275a){this[_0x398d('0xd')][_0x398d('0x19')](_0x16e580)[_0x398d('0x11')](function(_0x557df7){_0x3b275a(null,_0x557df7?_0x557df7['name']:![]);})[_0x398d('0x13')](function(_0x497ad1){_0x3b275a(_0x497ad1);});};AGIVertices['prototype'][_0x398d('0x1a')]=function(_0x38d8da,_0x5ae3b4){this['rpc']['getTrunkById'](_0x38d8da)[_0x398d('0x11')](function(_0x2cc4ef){_0x5ae3b4(null,_0x2cc4ef?_0x2cc4ef[_0x398d('0x12')]:![]);})[_0x398d('0x13')](function(_0x2a1f4d){_0x5ae3b4(_0x2a1f4d);});};AGIVertices[_0x398d('0xf')][_0x398d('0x1b')]=function(_0x17318c,_0x4f4466){var _0x35bd19=this;this['rpc']['getSoundById'](_0x17318c)[_0x398d('0x11')](function(_0x27bc6e){_0x4f4466(null,_0x27bc6e?_0x35bd19['getSoundPath'](_0x27bc6e[_0x398d('0x1c')]):![]);})['catch'](function(_0x3ae172){_0x4f4466(_0x3ae172);});};AGIVertices[_0x398d('0xf')]['getMailAccount']=function(_0x5681d0,_0x410db2){this[_0x398d('0xd')]['getMailAccountById'](_0x5681d0)[_0x398d('0x11')](function(_0x2fbcce){_0x410db2(null,_0x2fbcce?_0x2fbcce:![]);})[_0x398d('0x13')](function(_0x353cd7){_0x410db2(_0x353cd7);});};AGIVertices[_0x398d('0xf')][_0x398d('0x1d')]=function(_0x490bee,_0x5a9f61,_0x347c8a){this[_0x398d('0xe')][_0x398d('0x1d')](_0x490bee,_0x5a9f61)[_0x398d('0x11')](function(){_0x347c8a(null);})[_0x398d('0x13')](function(_0x27ed5b){_0x347c8a(_0x27ed5b);});};AGIVertices[_0x398d('0xf')][_0x398d('0x1e')]=function(_0x1827be,_0x5411c5){this[_0x398d('0xd')][_0x398d('0x1f')](_0x1827be)[_0x398d('0x11')](function(_0x557f83){if(_0x557f83){if(_0x557f83['IntervalId']){_0x5411c5(null,[_0x557f83[_0x398d('0x20')]]);}else{_0x5411c5(null,_[_0x398d('0x21')](_0x557f83[_0x398d('0x22')],_0x398d('0x20')));}}else{_0x5411c5(null,![]);}})[_0x398d('0x13')](function(_0x321a49){_0x5411c5(_0x321a49);});};AGIVertices[_0x398d('0xf')][_0x398d('0x23')]=function(_0x28318f){return util[_0x398d('0x24')](_0x398d('0x25'),FILES_PATH,_0x28318f);};AGIVertices[_0x398d('0xf')][_0x398d('0x26')]=function(_0x1c7859,_0x306c30,_0x302314){odbc[_0x398d('0x27')](_0x1c7859,function(_0x24cd9b){if(_0x24cd9b){logger[_0x398d('0x28')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x24cd9b);_0x302314(_0x24cd9b);}else{logger[_0x398d('0x29')](_0x398d('0x2a'));odbc[_0x398d('0x2b')](_0x306c30,function(_0x17de78,_0x209c2b){if(_0x17de78){logger[_0x398d('0x29')](_0x398d('0x2c'),_0x306c30);_0x302314(_0x17de78);}else{logger['info'](_0x398d('0x2d'),_0x306c30);odbc[_0x398d('0x2e')](function(_0x165d26){if(_0x165d26){logger[_0x398d('0x28')](_0x398d('0x2f'),_0x165d26);}_0x302314(null,_0x209c2b);});}});}});};AGIVertices[_0x398d('0xf')][_0x398d('0x30')]=function(_0x3dddcf,_0x518e7c){this[_0x398d('0xd')][_0x398d('0x31')](_0x3dddcf)[_0x398d('0x11')](function(_0x2d0a82){_0x518e7c(null,_0x2d0a82?_0x2d0a82:![]);})[_0x398d('0x13')](function(_0x5229c2){_0x518e7c(_0x5229c2);});};AGIVertices[_0x398d('0xf')][_0x398d('0x32')]=function(_0x484410,_0x4541c7){this[_0x398d('0xd')][_0x398d('0x32')](_0x484410)[_0x398d('0x11')](function(_0x217fc0){_0x4541c7(null,_0x217fc0);})[_0x398d('0x13')](function(_0x3c78a0){_0x4541c7(_0x3c78a0);});};AGIVertices[_0x398d('0xf')][_0x398d('0x33')]=function(_0x5d7d33,_0x2760f2,_0x28defa){this[_0x398d('0xd')][_0x398d('0x33')]({'uniqueid':this[_0x398d('0xc')][_0x398d('0x34')],'node':_0x5d7d33['label'],'application':_0x5d7d33[_0x398d('0x35')],'data':_0x2760f2||null,'project_name':this[_0x398d('0xc')]['arg_1'],'callerid':this[_0x398d('0xc')][_0x398d('0x36')]})[_0x398d('0x11')](function(_0x49fd99){if(_0x28defa){_0x28defa(null,_0x49fd99);}})[_0x398d('0x13')](function(_0x19dabb){if(_0x28defa){_0x28defa(_0x19dabb);}});};AGIVertices[_0x398d('0xf')][_0x398d('0x37')]=function(_0xe87d16,_0x4a024a,_0x3db9ff,_0x1d75a8){this[_0x398d('0xd')]['createSquareRecording']({'uniqueid':this[_0x398d('0xc')][_0x398d('0x34')],'callerid':this['channel'][_0x398d('0x36')],'calleridname':this[_0x398d('0xc')][_0x398d('0x38')],'context':this[_0x398d('0xc')][_0x398d('0x39')],'extension':this[_0x398d('0xc')][_0x398d('0x3a')],'priority':this[_0x398d('0xc')]['priority'],'accountcode':this[_0x398d('0xc')][_0x398d('0x3b')],'dnid':this['channel']['dnid'],'projectName':this[_0x398d('0xc')][_0x398d('0x3c')],'saveName':_0x4a024a,'filename':_0xe87d16[_0x398d('0x3d')]||_0x4a024a,'savePath':_0x3db9ff})[_0x398d('0x11')](function(_0x49a6de){_0x1d75a8(null,_0x49a6de);})[_0x398d('0x13')](function(_0x4826b2){_0x1d75a8(_0x4826b2);});};AGIVertices[_0x398d('0xf')]['createSquareMessage']=function(_0x3c27a1,_0x588548,_0x53fc9c,_0x4a1384,_0x38604a){this[_0x398d('0xd')][_0x398d('0x3e')]({'uniqueid':this[_0x398d('0xc')]['uniqueid'],'body':_0x3c27a1,'direction':_0x588548,'providerName':_0x53fc9c,'providerResponse':_0x4a1384})['then'](function(_0x339f55){if(_0x38604a){_0x38604a(null,_0x339f55);}})[_0x398d('0x13')](function(_0x1615ee){if(_0x38604a){_0x38604a(_0x1615ee);}});};AGIVertices['prototype'][_0x398d('0x3f')]=function(_0x2fcb61,_0x2376c3){this[_0x398d('0xd')][_0x398d('0x3f')]({'firstName':_[_0x398d('0x40')](_0x2fcb61['name'])||_[_0x398d('0x41')](_0x2fcb61[_0x398d('0x12')])?_0x398d('0x42')+Math[_0x398d('0x43')]():_0x2fcb61['name'],'lastName':_[_0x398d('0x40')](_0x2fcb61[_0x398d('0x44')])||_[_0x398d('0x41')](_0x2fcb61[_0x398d('0x44')])?null:_0x2fcb61['lastName'],'phone':_0x2fcb61['phone'],'ListId':_0x2fcb61[_0x398d('0x45')],'scheduledat':_0x2fcb61['scheduledAt'],'callbackUniqueid':this[_0x398d('0xc')][_0x398d('0x34')],'tags':'callback','description':_0x398d('0x46')+_0x2fcb61['scheduledAt'][_0x398d('0x47')](),'priority':_0x2fcb61[_0x398d('0x48')]})[_0x398d('0x11')](function(_0x1c4c38){_0x2376c3(null,_0x1c4c38);})[_0x398d('0x13')](function(_0x3aed8b){_0x2376c3(_0x3aed8b);});};AGIVertices[_0x398d('0xf')][_0x398d('0x49')]=function(_0x16f014,_0x3b4eaf){this[_0x398d('0xd')][_0x398d('0x4a')](_0x16f014)[_0x398d('0x11')](function(_0x783c74){_0x3b4eaf(null,_0x783c74?_0x783c74[_0x398d('0x12')]:![]);})[_0x398d('0x13')](function(_0x20b5e1){_0x3b4eaf(_0x20b5e1);});};AGIVertices[_0x398d('0xf')][_0x398d('0x4b')]=function(_0xb25709,_0x7f4acb,_0xcd2b9d){var _0x5453b6={'role':_0x398d('0x4c')};_0x5453b6[_0xb25709]=this[_0x398d('0xc')][_0x398d('0x36')];this[_0x398d('0xd')][_0x398d('0x4b')](_0x5453b6,_0x7f4acb,this[_0x398d('0xc')][_0x398d('0x34')])[_0x398d('0x11')](function(_0xe6cf33){_0xcd2b9d(null,_[_0x398d('0x41')](_0xe6cf33)?![]:!![]);})[_0x398d('0x13')](function(_0x5a64a2){logger[_0x398d('0x28')](_0x5a64a2);_0xcd2b9d(null,![]);});};AGIVertices[_0x398d('0xf')]['agentUnpause']=function(_0x362471,_0x548a8a){var _0x4832f5={'role':'agent'};_0x4832f5[_0x362471]=this[_0x398d('0xc')][_0x398d('0x36')];this['rpc'][_0x398d('0x4d')](_0x4832f5)[_0x398d('0x11')](function(_0x422b03){_0x548a8a(null,_['isNil'](_0x422b03)?![]:!![]);})[_0x398d('0x13')](function(_0x6e9484){logger[_0x398d('0x28')](_0x6e9484);_0x548a8a(null,![]);});};AGIVertices['prototype'][_0x398d('0x4e')]=function(_0x542e3b,_0x2755c6){var _0x5a7de6={'role':_0x398d('0x4c')};_0x5a7de6[_0x542e3b]=this['channel'][_0x398d('0x36')];this[_0x398d('0xd')][_0x398d('0x4e')](_0x5a7de6)[_0x398d('0x11')](function(_0x2938d7){_0x2755c6(null,_['isNil'](_0x2938d7)?![]:!![]);})[_0x398d('0x13')](function(_0x4446d7){logger[_0x398d('0x28')](_0x4446d7);_0x2755c6(null,![]);});};AGIVertices[_0x398d('0xf')][_0x398d('0x4f')]=function(_0x12d76f,_0x187d18){var _0x5b073c={'role':_0x398d('0x4c')};_0x5b073c[_0x12d76f]=this[_0x398d('0xc')][_0x398d('0x36')];var _0x5085f4=_0x12d76f!='internal'?util[_0x398d('0x24')](_0x398d('0x50'),'LOCAL',this['channel'][_0x398d('0x36')]):undefined;this['rpc'][_0x398d('0x4f')](_0x5b073c,_0x5085f4)['then'](function(_0x359f5d){_0x187d18(null,_['isNil'](_0x359f5d)?![]:!![]);})['catch'](function(_0x4e1bbf){logger[_0x398d('0x28')](_0x4e1bbf);_0x187d18(null,![]);});};AGIVertices[_0x398d('0xf')][_0x398d('0x51')]=function(_0xef2db4,_0x459976){sh['exec'](_['trim'](_0xef2db4),function(_0x5b0ec5,_0x57267a){var _0x423232=_0x57267a['replace'](/(\r\n|\n|\r)/gm,'');_0x459976(null,_0x423232);});};AGIVertices[_0x398d('0xf')][_0x398d('0x52')]=function(_0x6fc4e3,_0x324436){scripts[_0x398d('0x52')](_0x6fc4e3[_0x398d('0x53')],_0x6fc4e3['google_cloud_tts_text_type']||'text',_0x6fc4e3[_0x398d('0x54')],_0x6fc4e3[_0x398d('0x55')]||'en-US',_0x6fc4e3[_0x398d('0x56')]||'MALE',_0x6fc4e3[_0x398d('0x57')]||_0x398d('0x58'))[_0x398d('0x11')](function(_0xaa4021){_0x324436(null,_0xaa4021);})['catch'](function(_0x22961e){_0x324436(_0x22961e);});};AGIVertices[_0x398d('0xf')][_0x398d('0x59')]=function(_0x28144d,_0x18e1de){scripts['googleTTS'](_0x28144d[_0x398d('0x54')],_0x28144d['google_tts_language']||'en',0x1)[_0x398d('0x11')](function(_0x918e5b){_0x18e1de(null,_0x918e5b);})[_0x398d('0x13')](function(_0x56a134){_0x18e1de(_0x56a134);});};AGIVertices[_0x398d('0xf')][_0x398d('0x5a')]=function(_0x5492b6,_0x37c9e2){var _0x36801f={'uri':_0x5492b6[_0x398d('0x5b')],'method':_0x5492b6['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5492b6['timeout'])==='number'&&parseInt(_0x5492b6['timeout'])>=0x1?parseInt(_0x5492b6[_0x398d('0x5c')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x398d('0x5d'),_0x398d('0x5e')],_0x36801f[_0x398d('0x5f')][_0x398d('0x60')]())){try{_0x36801f[_0x398d('0x61')]=_0x5492b6[_0x398d('0x62')]?JSON['parse'](_0x5492b6[_0x398d('0x62')]):{};}catch(_0x3e0b01){logger['error'](_0x398d('0x63'),_0x3e0b01);}}try{_0x36801f[_0x398d('0x64')]=_0x5492b6[_0x398d('0x8')]?JSON[_0x398d('0x65')](_0x5492b6[_0x398d('0x8')]):{};}catch(_0x352b6d){logger[_0x398d('0x28')](_0x398d('0x66'),_0x352b6d);}if(_0x5492b6[_0x398d('0x67')]){try{var _0x1721aa=require(_0x5492b6['computedVariables'])[_0x398d('0x68')](this,_0x36801f);_0x36801f[_0x398d('0x69')]=Mustache[_0x398d('0x6a')](_0x5492b6['url'],_0x1721aa,{},['$$','$$']);if(_0x36801f[_0x398d('0x64')]){_0x36801f[_0x398d('0x64')]=JSON[_0x398d('0x65')](Mustache[_0x398d('0x6a')](JSON[_0x398d('0x6b')](_0x36801f[_0x398d('0x64')]),_0x1721aa,{},['$$','$$']));}if(_0x36801f[_0x398d('0x61')]){_0x36801f[_0x398d('0x61')]=JSON['parse'](Mustache[_0x398d('0x6a')](JSON[_0x398d('0x6b')](_0x36801f[_0x398d('0x61')]),_0x1721aa,{},['$$','$$']));}}catch(_0x46e7e0){logger[_0x398d('0x28')](_0x398d('0x6c'),_0x46e7e0);}}rp(_0x36801f)['then'](function(_0x5ea815){var _0xc8f67a={'statusCode':_0x5ea815[_0x398d('0x6d')]||0xc8,'statusMessage':_0x5ea815[_0x398d('0x6e')]||'OK','headers':_0x5ea815[_0x398d('0x64')]||{},'body':_0x5ea815['body']||{}};_0x37c9e2(null,_0xc8f67a);})['catch'](function(_0xd90e93){var _0x2b6281={'statusCode':_0xd90e93[_0x398d('0x6d')]||0x1f4,'statusMessage':_0xd90e93[_0x398d('0x6f')]||_0x398d('0x70'),'headers':_0xd90e93['options']['headers']||{},'body':_0xd90e93['options'][_0x398d('0x61')]||{}};_0x37c9e2(null,_0x2b6281);});};AGIVertices[_0x398d('0xf')][_0x398d('0x71')]=function(_0xc6066a,_0x2bed67){scripts[_0x398d('0x71')](this[_0x398d('0xc')][_0x398d('0x34')],_0xc6066a[_0x398d('0x72')],_0xc6066a[_0x398d('0x54')],_0xc6066a[_0x398d('0x73')]||'en')[_0x398d('0x11')](function(_0x3a65e3){_0x2bed67(null,_0x3a65e3);})[_0x398d('0x13')](function(_0x752d2a){_0x2bed67(_0x752d2a);});};AGIVertices[_0x398d('0xf')][_0x398d('0x74')]=function(_0x34142f,_0x551b72){scripts['googleDialogflowV2'](this[_0x398d('0xc')][_0x398d('0x34')],_0x34142f[_0x398d('0x75')],_0x34142f['client_email'],_0x34142f[_0x398d('0x76')],_0x34142f[_0x398d('0x54')],_0x34142f[_0x398d('0x77')]||'en')[_0x398d('0x11')](function(_0x3a022d){_0x551b72(null,_0x3a022d);})[_0x398d('0x13')](function(_0x320444){_0x551b72(_0x320444);});};AGIVertices[_0x398d('0xf')]['sestekNDA']=function(_0x1c09e9,_0xad3fd1){scripts['sestekNDA'](this[_0x398d('0xc')],_0x1c09e9)[_0x398d('0x11')](function(_0x4ad08e){_0xad3fd1(null,_0x4ad08e);})['catch'](function(_0x47766c){_0xad3fd1(_0x47766c);});};AGIVertices[_0x398d('0xf')][_0x398d('0x78')]=function(_0x10076f,_0x30ec49){scripts[_0x398d('0x78')](_0x10076f[_0x398d('0x72')],_0x10076f[_0x398d('0x54')],_0x10076f['ispeech_tts_language']||_0x398d('0x79'),_0x10076f[_0x398d('0x7a')])[_0x398d('0x11')](function(_0x45de5d){_0x30ec49(null,_0x45de5d);})[_0x398d('0x13')](function(_0x2002c3){_0x30ec49(_0x2002c3);});};AGIVertices['prototype'][_0x398d('0x7b')]=function(_0x4f7d04,_0x33f491,_0x4ce9d4){scripts[_0x398d('0x7b')](_0x33f491,_0x4f7d04[_0x398d('0x72')],_0x4f7d04[_0x398d('0x7c')]||_0x398d('0x79'),this[_0x398d('0x7d')](_0x4f7d04['model'])?_0x4f7d04[_0x398d('0x7e')]:undefined)[_0x398d('0x11')](function(_0x560fb0){_0x4ce9d4(null,_0x560fb0);})[_0x398d('0x13')](function(_0x305b92){_0x4ce9d4(_0x305b92);});};AGIVertices[_0x398d('0xf')][_0x398d('0x7f')]=function(_0x204f40,_0x18efa9){scripts[_0x398d('0x7f')](_0x204f40[_0x398d('0x80')],_0x204f40[_0x398d('0x81')],_0x204f40[_0x398d('0x82')],_0x204f40[_0x398d('0x83')]||_0x398d('0x84'),_0x204f40[_0x398d('0x54')],_0x204f40[_0x398d('0x85')]||_0x398d('0x54'))[_0x398d('0x11')](function(_0x2a1ed8){_0x18efa9(null,_0x2a1ed8);})[_0x398d('0x13')](function(_0x861f13){_0x18efa9(_0x861f13);});};AGIVertices[_0x398d('0xf')][_0x398d('0x86')]=function(_0x45ccc4,_0x5cb4eb){scripts[_0x398d('0x86')](this['channel']['uniqueid'],_0x45ccc4['aws_access_key_id'],_0x45ccc4[_0x398d('0x81')],_0x45ccc4[_0x398d('0x87')],_0x45ccc4[_0x398d('0x54')],_0x45ccc4[_0x398d('0x88')])[_0x398d('0x11')](function(_0x43207f){_0x5cb4eb(null,_0x43207f);})[_0x398d('0x13')](function(_0x5c266f){_0x5cb4eb(_0x5c266f);});};AGIVertices[_0x398d('0xf')][_0x398d('0x89')]=function(_0x26dd69,_0x4a8ca6,_0xf1772d){scripts[_0x398d('0x89')](_0x4a8ca6,_0x26dd69['key'],_0x26dd69['google_asr_language']||'en-US')[_0x398d('0x11')](function(_0x57086e){_0xf1772d(null,_0x57086e);})[_0x398d('0x13')](function(_0x12269a){_0xf1772d(_0x12269a);});};AGIVertices['prototype'][_0x398d('0x8a')]=function(_0x16e130,_0x171c00,_0x508d68){scripts[_0x398d('0x8a')](_0x171c00,_0x16e130[_0x398d('0x8b')],_0x16e130['appsecret'],_0x16e130[_0x398d('0x69')])[_0x398d('0x11')](function(_0x1df628){_0x508d68(null,_0x1df628);})['catch'](function(_0x35117b){_0x508d68(_0x35117b);});};AGIVertices[_0x398d('0xf')]['clear']=function(_0x6868a9){var _0x370c2a=_[_0x398d('0x8c')](verticesWithRetry,_0x6868a9[_0x398d('0x35')])?_0x6868a9:_[_0x398d('0x8d')](_0x6868a9);for(var _0x212a0e in _0x370c2a){if(_0x370c2a[_0x398d('0x8e')](_0x212a0e)){if(_0x370c2a[_0x212a0e]&&_[_0x398d('0x8f')](_0x370c2a[_0x212a0e])){if(_[_0x398d('0x8c')](recursiveMapAttributes,_0x212a0e)){_0x370c2a[_0x212a0e]=this[_0x398d('0x90')](_0x370c2a[_0x212a0e]);}else{_0x370c2a[_0x212a0e]=this[_0x398d('0x91')](_0x370c2a[_0x212a0e]);}}}}return _0x370c2a;};AGIVertices[_0x398d('0xf')][_0x398d('0x92')]=function(_0x50da80){for(var _0x4cb8d4 in _0x50da80){if(_0x50da80[_0x398d('0x8e')](_0x4cb8d4)){if(_['isPlainObject'](_0x50da80[_0x4cb8d4])){this[_0x398d('0x92')](_0x50da80[_0x4cb8d4]);}else if(_['isArray'](_0x50da80[_0x4cb8d4])){for(var _0x35a47b=0x0;_0x35a47b<_0x50da80[_0x4cb8d4][_0x398d('0x93')];_0x35a47b++){this[_0x398d('0x92')](_0x50da80[_0x4cb8d4][_0x35a47b]);}}else if(_['isString'](_0x50da80[_0x4cb8d4])){_0x50da80[_0x4cb8d4]=this[_0x398d('0x91')](_0x50da80[_0x4cb8d4]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0xd895cd,_0x550a1b){for(var _0x4980d6 in _0xd895cd){if(_0xd895cd['hasOwnProperty'](_0x4980d6)){if(_[_0x398d('0x94')](_0xd895cd[_0x4980d6])){if(!_[_0x398d('0x40')](_0xd895cd[_0x4980d6])){this[_0x398d('0x95')](_0xd895cd[_0x4980d6],util[_0x398d('0x24')]('%s.%s',_0x550a1b,_0x4980d6));}}else if(_['isArray'](_0xd895cd[_0x4980d6])){for(var _0x175206=0x0;_0x175206<_0xd895cd[_0x4980d6][_0x398d('0x93')];_0x175206++){this[_0x398d('0x95')](_0xd895cd[_0x4980d6][_0x175206],util[_0x398d('0x24')](_0x398d('0x96'),_0x550a1b,_0x4980d6+'['+_0x175206+']'));}}else{if(!_[_0x398d('0x41')](_0xd895cd[_0x4980d6])){this[_0x398d('0xc')][_0x398d('0x97')](util['format'](_0x398d('0x96'),_0x550a1b,_0x4980d6),_0xd895cd[_0x4980d6]);}}}}};AGIVertices[_0x398d('0xf')][_0x398d('0x90')]=function(_0x4a5fce){try{var _0x1906d3=JSON[_0x398d('0x65')](_0x4a5fce);this[_0x398d('0x92')](_0x1906d3);return JSON[_0x398d('0x6b')](_0x1906d3);}catch(_0x55adf5){return this[_0x398d('0x91')](_0x4a5fce);}};AGIVertices['prototype']['replaceAllVariables']=function(_0xa25bdd){var _0x4312c3=_0xa25bdd[_0x398d('0x98')]('{');for(var _0x3d7064=0x1;_0x3d7064<_0x4312c3[_0x398d('0x93')];_0x3d7064+=0x1){var _0x1544e6=_0x4312c3[_0x3d7064][_0x398d('0x98')]('}');if(_0x1544e6[_0x398d('0x93')]>0x1){_0xa25bdd=_0xa25bdd[_0x398d('0x99')]('{'+_0x1544e6[0x0]+'}',this['channel'][_0x398d('0x10')](_0x1544e6[0x0])['extra']||_0x1544e6[0x0]);}}if(_0x4312c3[_0x398d('0x93')]===0x1){return _0xa25bdd[_0x398d('0x47')]();}return this[_0x398d('0x91')](_0xa25bdd);};AGIVertices[_0x398d('0xf')][_0x398d('0x9a')]=function(_0x309db6,_0x50cbba){var _0x30db44=this[_0x398d('0xc')][_0x398d('0x10')](_0x309db6);if(_0x30db44[_0x398d('0x9b')]===-0x1){return _0x30db44;}logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x9c'),_0x50cbba,_0x30db44[_0x398d('0x9d')]));return this['channel'][_0x398d('0x97')](_0x50cbba,_0x30db44[_0x398d('0x9d')]);};AGIVertices[_0x398d('0xf')][_0x398d('0x7d')]=function(_0x36515f){return _0x36515f&&_0x36515f!=='0'&&_0x36515f!=='-1'&&_0x36515f!=='';};AGIVertices['prototype'][_0x398d('0x9e')]=function(_0x1aef07){this[_0x398d('0x33')][_0x398d('0x68')](this,_0x1aef07,'-');_0x1aef07[_0x398d('0x9f')]=_0x1aef07['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x398d('0xf')][_0x398d('0xa0')]=function(_0x116db8){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xa1'),_0x116db8[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x116db8['text'])){return this[_0x398d('0xc')]['noop'](_0x398d('0xa3'));}var _0x132a4a='\x22'+_0x116db8[_0x398d('0x54')]+'\x22';if(this[_0x398d('0x7d')](_0x116db8[_0x398d('0xa4')])){_0x132a4a+=','+_0x116db8['options'];}var _0x2d7d4e=this[_0x398d('0xc')]['exec'](_0x398d('0xa5'),_0x132a4a);if(_0x2d7d4e['result']===-0x1){return _0x2d7d4e;}return this[_0x398d('0xc')]['noop'](util[_0x398d('0x24')](_0x398d('0xa6'),_0x132a4a));};AGIVertices[_0x398d('0xf')]['mrcprecog']=function(_0x2fab60){logger['info'](util[_0x398d('0x24')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x2fab60['label']));if(!this['isConfigured'](_0x2fab60[_0x398d('0xa7')])){return this[_0x398d('0xc')]['noop'](_0x398d('0xa8'));}var _0x486252=_0x2fab60['grammar'];if(this[_0x398d('0x7d')](_0x2fab60['options'])){_0x486252+=','+_0x2fab60['options'];}var _0x32e551=this[_0x398d('0xc')]['exec']('MRCPRecog',_0x486252);if(_0x32e551['result']===-0x1){return _0x32e551;}var _0x6a2960=this[_0x398d('0x9a')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x6a2960[_0x398d('0x9b')]===-0x1){return _0x6a2960;}var _0x522c5c=this[_0x398d('0x9a')](_0x398d('0xa9'),_0x398d('0xaa'));if(_0x522c5c[_0x398d('0x9b')]===-0x1){return _0x522c5c;}var _0x11f9f4=this[_0x398d('0x9a')](_0x398d('0xab'),_0x398d('0xac'));if(_0x11f9f4[_0x398d('0x9b')]===-0x1){return _0x11f9f4;}return this['channel']['noop'](util[_0x398d('0x24')](_0x398d('0xad'),_0x486252));};AGIVertices[_0x398d('0xf')][_0x398d('0xae')]=function(_0x4ac3f9){logger[_0x398d('0x29')](util['format'](_0x398d('0xaf'),_0x4ac3f9[_0x398d('0xa2')]));return this['channel'][_0x398d('0xae')]([_0x4ac3f9[_0x398d('0xb0')],_0x4ac3f9[_0x398d('0xb1')]]);};AGIVertices[_0x398d('0xf')][_0x398d('0xb2')]=function(_0x1a7cf1){logger[_0x398d('0x29')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1a7cf1[_0x398d('0xa2')]));if(this['isConfigured'](_0x1a7cf1['timeout'])){logger['info'](util[_0x398d('0x24')](_0x398d('0xb3'),_0x1a7cf1['timeout']));var _0x233ffe=this[_0x398d('0xc')][_0x398d('0xb4')](_0x1a7cf1['timeout']);if(_0x233ffe['result']===-0x1){return _0x233ffe;}}return this['channel']['answer']();};AGIVertices[_0x398d('0xf')][_0x398d('0xb5')]=function(_0x134167){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x134167[_0x398d('0xa2')]));if(!this['isConfigured'](_0x134167[_0x398d('0x45')])){return this[_0x398d('0xc')]['error'](_0x134167,_0x398d('0xb6'));}_0x134167[_0x398d('0xb7')]=moment();if(this[_0x398d('0x7d')](_0x134167['delay'])){_0x134167[_0x398d('0xb7')]=moment()[_0x398d('0xb8')](_0x134167[_0x398d('0xb9')],'minutes');}if(!this[_0x398d('0x7d')](_0x134167[_0x398d('0x48')])){_0x134167['callback_priority']=0x2;}this[_0x398d('0x3f')][_0x398d('0x68')](this,_0x134167);return this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xbb'),_0x134167[_0x398d('0xbc')],_0x134167[_0x398d('0x45')],_0x134167[_0x398d('0xb7')]));};AGIVertices[_0x398d('0xf')][_0x398d('0xbd')]=function(_0x51ee0b){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xbe'),_0x51ee0b[_0x398d('0xa2')]));var _0x498e8d=this[_0x398d('0xc')][_0x398d('0xbf')](_0x51ee0b[_0x398d('0xc0')],_0x51ee0b[_0x398d('0xa4')]);if(_0x498e8d[_0x398d('0x9b')]===-0x1){return _0x498e8d;}return this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xc1'),_0x51ee0b['application'],_0x51ee0b[_0x398d('0xa4')]));};AGIVertices[_0x398d('0xf')]['lumenvoxtts']=function(_0x3e94a1){logger['info'](util[_0x398d('0x24')](_0x398d('0xc2'),_0x3e94a1[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x3e94a1['text'])){return this['channel'][_0x398d('0xba')](_0x398d('0xa3'));}var _0x17de53='\x22'+_0x3e94a1[_0x398d('0x54')]+'\x22';if(this[_0x398d('0x7d')](_0x3e94a1['options'])){_0x17de53+=','+_0x3e94a1[_0x398d('0xa4')];}var _0x406aeb=this[_0x398d('0xc')][_0x398d('0xbf')](_0x398d('0xa5'),_0x17de53);if(_0x406aeb['result']===-0x1){return _0x406aeb;}return this[_0x398d('0xc')]['noop'](util[_0x398d('0x24')](_0x398d('0xa6'),_0x17de53));};AGIVertices[_0x398d('0xf')]['sestektts']=function(_0x522417){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xc3'),_0x522417['label']));if(!this[_0x398d('0x7d')](_0x522417[_0x398d('0x54')])){return this['channel'][_0x398d('0xba')](_0x398d('0xa3'));}var _0x4f8765='\x22'+_0x522417[_0x398d('0x54')]+'\x22';if(this[_0x398d('0x7d')](_0x522417[_0x398d('0xa4')])){_0x4f8765+=','+_0x522417['options'];}var _0xe655d0=this['channel'][_0x398d('0xbf')](_0x398d('0xa5'),_0x4f8765);if(_0xe655d0['result']===-0x1){return _0xe655d0;}return this['channel']['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x4f8765));};AGIVertices[_0x398d('0xf')][_0x398d('0xc4')]=function(_0x37ffaa){logger[_0x398d('0x29')](util['format'](_0x398d('0xc5'),_0x37ffaa[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x37ffaa[_0x398d('0xa7')])){return this[_0x398d('0xc')][_0x398d('0xba')]('no\x20grammar\x20configured');}var _0x5c0733=_0x37ffaa[_0x398d('0xa7')];if(this[_0x398d('0x7d')](_0x37ffaa[_0x398d('0xa4')])){_0x5c0733+=','+_0x37ffaa[_0x398d('0xa4')];}var _0x29c65=this[_0x398d('0xc')]['exec'](_0x398d('0xc6'),_0x5c0733);if(_0x29c65[_0x398d('0x9b')]===-0x1){return _0x29c65;}var _0x504f83=this[_0x398d('0x9a')]('RECOG_CONFIDENCE()',_0x398d('0xc7'));if(_0x504f83[_0x398d('0x9b')]===-0x1){return _0x504f83;}var _0x3e9579=this['getAndSetVariable'](_0x398d('0xa9'),_0x398d('0xc8'));if(_0x3e9579[_0x398d('0x9b')]===-0x1){return _0x3e9579;}var _0x247691=this[_0x398d('0x9a')](_0x398d('0xab'),_0x398d('0xc9'));if(_0x247691['result']===-0x1){return _0x247691;}return this['channel']['noop'](util[_0x398d('0x24')](_0x398d('0xad'),_0x5c0733));};AGIVertices[_0x398d('0xf')][_0x398d('0xca')]=function(_0x203943){logger[_0x398d('0x29')](util['format'](_0x398d('0xcb'),_0x203943['label']));if(!this['isConfigured'](_0x203943['grammar'])){return this[_0x398d('0xc')]['noop'](_0x398d('0xa8'));}var _0x538765=_0x203943['grammar'];if(this[_0x398d('0x7d')](_0x203943['options'])){_0x538765+=','+_0x203943['options'];}var _0x5a4ff7=this['channel'][_0x398d('0xbf')](_0x398d('0xc6'),_0x538765);if(_0x5a4ff7[_0x398d('0x9b')]===-0x1){return _0x5a4ff7;}var _0x57fee9=this[_0x398d('0x9a')](_0x398d('0xcc'),_0x398d('0xcd'));if(_0x57fee9[_0x398d('0x9b')]===-0x1){return _0x57fee9;}var _0x5d25cd=this[_0x398d('0x9a')](_0x398d('0xa9'),_0x398d('0xce'));if(_0x5d25cd[_0x398d('0x9b')]===-0x1){return _0x5d25cd;}var _0x22409d=this[_0x398d('0x9a')](_0x398d('0xab'),_0x398d('0xcf'));if(_0x22409d[_0x398d('0x9b')]===-0x1){return _0x22409d;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xad'),_0x538765));};AGIVertices[_0x398d('0xf')]['database']=function(_0x319273){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xd0'),_0x319273['label']));if(!this[_0x398d('0x7d')](_0x319273[_0x398d('0xd1')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x319273,_0x398d('0xd2'));}var _0x15b777=this[_0x398d('0xd3')][_0x398d('0x68')](this,_0x319273[_0x398d('0xd1')]);if(!_0x15b777){return this['channel'][_0x398d('0x28')](_0x319273,'no\x20odbc\x20database\x20found');}if(!this[_0x398d('0x7d')](_0x319273[_0x398d('0x2b')])){return this['channel'][_0x398d('0x28')](_0x319273,_0x398d('0xd4'));}var _0x5a63e0=_0x319273['query'][_0x398d('0xd5')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xd6'),_0x5a63e0));var _0x2b6952=this['getQueryOdbc']['sync'](this,_0x15b777,_0x5a63e0);this[_0x398d('0x33')][_0x398d('0x68')](this,_0x319273,_0x5a63e0);if(!this[_0x398d('0x7d')](_0x319273[_0x398d('0xd7')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xd8'));}var _0x3d4c68=this[_0x398d('0x10')][_0x398d('0x68')](this,_0x319273[_0x398d('0xd7')]);if(!_0x3d4c68){return this[_0x398d('0xc')][_0x398d('0x28')](_0x319273,_0x398d('0xd9'));}var _0x42ad1d=this;_0x2b6952[_0x398d('0xda')](function(_0x4a8f95,_0xe717e6){Object[_0x398d('0xdb')](_0x4a8f95)[_0x398d('0xda')](function(_0x52fe40){_0x42ad1d['channel'][_0x398d('0x97')](util['format'](_0x398d('0xdc'),_0x3d4c68,_0xe717e6,_0x52fe40),_0x4a8f95[_0x52fe40]);});});this[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')](_0x398d('0xdd'),_0x3d4c68),_0x2b6952[_0x398d('0x93')]);return this['channel'][_0x398d('0xba')](util[_0x398d('0x24')]('variable\x20%s\x20set',_0x3d4c68));};AGIVertices[_0x398d('0xf')][_0x398d('0xde')]=function(_0x2a8ea6){logger[_0x398d('0xdf')](util[_0x398d('0x24')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2a8ea6['label']));if(!this[_0x398d('0x7d')](_0x2a8ea6[_0x398d('0xe0')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x2a8ea6,_0x398d('0xe1'));}var _0x44a86e=this[_0x398d('0xe2')]['sync'](this,_0x2a8ea6[_0x398d('0xe0')]);if(!_0x44a86e){return this['channel'][_0x398d('0x28')](_0x2a8ea6,_0x398d('0xe3'));}var _0x2bb8b9=this['channel']['exec']('DIAL',[util[_0x398d('0x24')](_0x398d('0xe4'),_0x44a86e),_0x2a8ea6[_0x398d('0x5c')],_0x2a8ea6[_0x398d('0xe5')],_0x2a8ea6[_0x398d('0x5b')]]);if(_0x2bb8b9[_0x398d('0x9b')]===-0x1){return _0x2bb8b9;}return this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xe6'),_0x398d('0xe7')));};AGIVertices[_0x398d('0xf')][_0x398d('0xe8')]=function(_0x472bda){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xe9'),_0x472bda['label']));if(!this['isConfigured'](_0x472bda[_0x398d('0x72')])){return this[_0x398d('0xc')][_0x398d('0xba')]('no\x20key\x20configured');}if(!this[_0x398d('0x7d')](_0x472bda[_0x398d('0x54')])){return this[_0x398d('0xc')]['noop'](_0x398d('0xa3'));}this[_0x398d('0xc')][_0x398d('0xea')]=!![];this['createSquareDetailsReport'](_0x472bda);this[_0x398d('0x3e')](_0x472bda[_0x398d('0x54')],'in','','');this['channel'][_0x398d('0xba')](util[_0x398d('0x24')]('Trying\x20Dialogflow:\x20%s',_0x472bda[_0x398d('0x54')]));var _0x145c84=this[_0x398d('0x71')][_0x398d('0x68')](this,_0x472bda);if(_0x145c84){for(var _0x365a08 in _0x145c84){if(_0x145c84['hasOwnProperty'](_0x365a08)){this[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')]('DIALOGFLOW_%s',_0x365a08[_0x398d('0x60')]()),_0x145c84[_0x365a08]);}}this[_0x398d('0x3e')](_0x145c84[_0x398d('0xeb')],'out',_0x398d('0xe8'),'');return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xec'),_0x145c84[_0x398d('0xeb')]));}return this[_0x398d('0xc')][_0x398d('0x28')](_0x472bda,_0x398d('0xed'));};AGIVertices['prototype'][_0x398d('0xee')]=function(_0x4ba606){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xef'),_0x4ba606[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x4ba606[_0x398d('0x75')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xf0'));}if(!this[_0x398d('0x7d')](_0x4ba606[_0x398d('0xf1')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xf2'));}if(!this[_0x398d('0x7d')](_0x4ba606['private_key'])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xf3'));}if(!this['isConfigured'](_0x4ba606[_0x398d('0x77')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xf4'));}if(!this[_0x398d('0x7d')](_0x4ba606[_0x398d('0x54')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xa3'));}this[_0x398d('0xc')]['bot']=!![];this[_0x398d('0x33')](_0x4ba606);this[_0x398d('0x3e')](_0x4ba606[_0x398d('0x54')],'in','','');this['channel'][_0x398d('0xba')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x4ba606['text']));var _0x320b4c=this[_0x398d('0x74')][_0x398d('0x68')](this,_0x4ba606);if(_0x320b4c){for(var _0x6d6fbe in _0x320b4c){if(_0x320b4c[_0x398d('0x8e')](_0x6d6fbe)){if(_0x6d6fbe!==_0x398d('0xf5')){this[_0x398d('0xc')]['setVariable'](util[_0x398d('0x24')](_0x398d('0xf6'),_0x6d6fbe[_0x398d('0x60')]()),_0x320b4c[_0x6d6fbe]);}}}this[_0x398d('0x3e')](_0x320b4c[_0x398d('0xeb')],_0x398d('0xf7'),'dialogflowV2',_0x320b4c[_0x398d('0xf5')]);return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xf8'),_0x320b4c[_0x398d('0xeb')]));}return this[_0x398d('0xc')]['error'](_0x4ba606,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x398d('0xf')][_0x398d('0xf9')]=function(_0x547d86){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x547d86[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x547d86[_0x398d('0xfa')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xfb'));}if(!this['isConfigured'](_0x547d86[_0x398d('0xfc')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xfd'));}if(!this['isConfigured'](_0x547d86[_0x398d('0xfe')])){return this['channel'][_0x398d('0xba')](_0x398d('0xff'));}if(!this[_0x398d('0x7d')](_0x547d86[_0x398d('0x100')])){return this['channel']['noop'](_0x398d('0xa3'));}this['channel']['bot']=!![];this[_0x398d('0x33')](_0x547d86);this['createSquareMessage'](_0x547d86[_0x398d('0x54')],'in','','');this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x101'),_0x547d86[_0x398d('0x54')]));var _0xabc93c=this[_0x398d('0x102')][_0x398d('0x68')](this,_0x547d86);if(_0xabc93c){for(var _0xd8fa1 in _0xabc93c){if(_0xabc93c['hasOwnProperty'](_0xd8fa1)){this[_0x398d('0xc')]['setVariable'](util[_0x398d('0x24')](_0x398d('0x103'),_0xd8fa1[_0x398d('0x60')]()),_0xabc93c[_0xd8fa1]);}}this[_0x398d('0x3e')](_0xabc93c[_0x398d('0xeb')],_0x398d('0xf7'),_0x398d('0xf9'),'');if(_0xabc93c['audiofile']){this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x104'),_0xabc93c['audiofile']));var _0xd5925=this[_0x398d('0xc')][_0x398d('0x105')](_0xabc93c[_0x398d('0x106')]);try{fs[_0x398d('0x107')](_0xabc93c[_0x398d('0x106')]+_0x398d('0x108'));}catch(_0xea47b5){logger[_0x398d('0x28')](_0xea47b5);}return _0xd5925;}else{return this['channel']['noop'](util[_0x398d('0x24')](_0x398d('0x109'),_0xabc93c[_0x398d('0xeb')]));}}return this[_0x398d('0xc')]['error'](_0x547d86,_0x398d('0x10a'));};AGIVertices['prototype'][_0x398d('0x10b')]=function(_0x20bc91){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x10c'),_0x20bc91['label']));return this[_0x398d('0xc')][_0x398d('0xba')]('end');};AGIVertices['prototype']['ext_dial']=function(_0x57032e){logger[_0x398d('0x29')](util['format'](_0x398d('0x10d'),_0x57032e[_0x398d('0xa2')]));var _0x1459e0='';if(_0x57032e[_0x398d('0x10e')]){if(!this[_0x398d('0x7d')](_0x57032e[_0x398d('0x10e')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x57032e,'no\x20trunk\x20selected');}else{var _0x2f2434=parseInt(_0x57032e[_0x398d('0x10e')],0xa);if(isNaN(_0x2f2434)){_0x1459e0=_0x57032e[_0x398d('0x10e')];}else{_0x1459e0=this[_0x398d('0x1a')][_0x398d('0x68')](this,_0x57032e[_0x398d('0x10e')]);if(!_0x1459e0){return this[_0x398d('0xc')][_0x398d('0x28')](_0x57032e,'no\x20trunk\x20found');}}}}else if(_0x57032e['trunk_name']){_0x1459e0=_0x57032e[_0x398d('0x10f')];}else{return this['channel'][_0x398d('0x28')](_0x57032e,_0x398d('0x110'));}var _0x3c776b=this[_0x398d('0xc')][_0x398d('0xbf')](_0x398d('0xe7'),[util[_0x398d('0x24')](_0x398d('0x111'),_0x1459e0,_0x57032e[_0x398d('0xbc')]),_0x57032e[_0x398d('0x5c')],_0x57032e[_0x398d('0xe5')],_0x57032e[_0x398d('0x5b')]]);if(_0x3c776b[_0x398d('0x9b')]===-0x1){return _0x3c776b;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xe6'),_0x398d('0xe7')));};AGIVertices[_0x398d('0xf')][_0x398d('0x112')]=function(_0x4c1f39){logger[_0x398d('0x29')](util['format'](_0x398d('0x113'),_0x4c1f39['label']));return this[_0x398d('0xc')]['noop'](_0x398d('0x112'));};AGIVertices['prototype'][_0x398d('0xa')]=function(_0xd91015){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x114'),_0xd91015['label']));if(_0xd91015[_0x398d('0x9f')]===0x0){return this['maxRetry'](_0xd91015);}_0xd91015[_0x398d('0x9f')]-=0x1;if(!this[_0x398d('0x7d')](_0xd91015[_0x398d('0x115')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0xd91015,_0x398d('0x116'));}var _0x433d2b=this[_0x398d('0x1b')]['sync'](this,_0xd91015['file_id']);if(!_0x433d2b){return this[_0x398d('0xc')][_0x398d('0x28')](_0xd91015,_0x398d('0x117'));}if(!this[_0x398d('0x7d')](_0xd91015[_0x398d('0xd7')])){return this[_0x398d('0xc')]['error'](_0x398d('0xd8'));}var _0x54ac9b=this['channel'][_0x398d('0x118')](_0x433d2b,_0xd91015[_0x398d('0x119')],_0xd91015[_0x398d('0x11a')]);var _0x1ea60c=_0x54ac9b[_0x398d('0x9b')]?_0x54ac9b[_0x398d('0x9b')][_0x398d('0x47')]():'';logger[_0x398d('0x29')](_0x398d('0x11b'),JSON[_0x398d('0x6b')](_0x54ac9b));if(_0x54ac9b[_0x398d('0x9b')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0xd91015,_0x1ea60c);return _0x54ac9b;}else if(_0x54ac9b[_0x398d('0x9d')]==='timeout'){_0x54ac9b[_0x398d('0x9b')]=_0x1ea60c[_0x398d('0x93')]>=parseInt(_0xd91015[_0x398d('0x11c')])?'x':'i';}else{_0x54ac9b['result']=_0x1ea60c['length']>=parseInt(_0xd91015['mindigit'])&&_0x1ea60c['length']<=parseInt(_0xd91015['maxdigit'])?'x':'i';}var _0x562cf6=this['getVariable'][_0x398d('0x68')](this,_0xd91015[_0x398d('0xd7')]);if(!_0x562cf6){return this[_0x398d('0xc')][_0x398d('0x28')](_0xd91015,_0x398d('0xd9'));}this[_0x398d('0xc')][_0x398d('0x97')](_0x562cf6,_0x1ea60c);if(this[_0x398d('0x7d')](_0xd91015[_0x398d('0x11d')])){var _0x46fcf4=parseInt(_0xd91015['hiddendigitsnum'],0xa);var _0x1be1ec=rs[_0x398d('0x11e')]({'charset':'*','length':_0x46fcf4});var _0x17014c=_0x1ea60c[_0x398d('0x93')];if(_0x17014c>0x0){if(_0x17014c>_0x46fcf4){this[_0x398d('0x33')][_0x398d('0x68')](this,_0xd91015,_0xd91015[_0x398d('0x11f')]===_0x398d('0x120')?_0x1be1ec+_0x1ea60c[_0x398d('0x121')](_0x46fcf4):_0x1ea60c[_0x398d('0x121')](0x0,_0x17014c-_0x46fcf4)+_0x1be1ec);}else{this['createSquareDetailsReport'][_0x398d('0x68')](this,_0xd91015,rs['generate']({'charset':'*','length':_0x17014c}));}}else{this[_0x398d('0x33')]['sync'](this,_0xd91015,'');}}else{this[_0x398d('0x33')]['sync'](this,_0xd91015,_0x1ea60c);}return _0x54ac9b;};AGIVertices[_0x398d('0xf')]['getsecretdigits']=function(_0x40e178){logger['info'](util[_0x398d('0x24')](_0x398d('0x122'),_0x40e178[_0x398d('0xa2')]));return this[_0x398d('0xa')](_0x40e178);};AGIVertices['prototype'][_0x398d('0x123')]=function(_0x4eb228){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x124'),_0x4eb228[_0x398d('0xa2')]));this[_0x398d('0x33')][_0x398d('0x68')](this,_0x4eb228,_0x4eb228['goalname']);return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x125'),_0x4eb228[_0x398d('0x126')]));};AGIVertices[_0x398d('0xf')][_0x398d('0x127')]=function(_0x5bc3f8){logger[_0x398d('0x29')](util[_0x398d('0x24')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x5bc3f8[_0x398d('0xa2')]));if(!this['isConfigured'](_0x5bc3f8['aws_access_key_id'])||!this[_0x398d('0x7d')](_0x5bc3f8[_0x398d('0x81')])){return this[_0x398d('0xc')]['noop'](_0x398d('0x128'));}if(!this[_0x398d('0x7d')](_0x5bc3f8[_0x398d('0x54')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xa3'));}this[_0x398d('0xc')]['noop'](util[_0x398d('0x24')]('Trying\x20aws\x20Polly\x20%s',_0x5bc3f8['text']));var _0x54c9fd=this[_0x398d('0x7f')][_0x398d('0x68')](this,_0x5bc3f8);if(_0x54c9fd){this[_0x398d('0xc')]['noop'](util['format'](_0x398d('0x129'),_0x54c9fd));var _0x1e001a=this[_0x398d('0xc')]['streamFile'](_0x54c9fd);try{fs[_0x398d('0x107')](_0x54c9fd+_0x398d('0x108'));}catch(_0x4ad78b){logger[_0x398d('0x28')](_0x4ad78b);}return _0x1e001a;}return this[_0x398d('0xc')][_0x398d('0x28')](_0x5bc3f8,_0x398d('0x12a'));};AGIVertices['prototype'][_0x398d('0x12b')]=function(_0x3f8f07){logger['info'](util[_0x398d('0x24')](_0x398d('0x12c'),_0x3f8f07[_0x398d('0xa2')]));if(!this['isConfigured'](_0x3f8f07[_0x398d('0x80')])||!this[_0x398d('0x7d')](_0x3f8f07['aws_secret_access_key'])){return this[_0x398d('0xc')]['noop'](_0x398d('0x128'));}if(!this[_0x398d('0x7d')](_0x3f8f07[_0x398d('0x88')])){return this[_0x398d('0xc')][_0x398d('0xba')]('no\x20bot\x20name\x20configured');}if(!this[_0x398d('0x7d')](_0x3f8f07[_0x398d('0x54')])){return this['channel']['noop'](_0x398d('0xa3'));}this[_0x398d('0xc')][_0x398d('0xea')]=!![];this[_0x398d('0x33')](_0x3f8f07);this['createSquareMessage'](_0x3f8f07[_0x398d('0x54')],'in','','');this[_0x398d('0xc')][_0x398d('0xba')](util['format'](_0x398d('0x12d'),_0x3f8f07[_0x398d('0x54')]));var _0x1da18f=this[_0x398d('0x86')][_0x398d('0x68')](this,_0x3f8f07);if(_0x1da18f){for(var _0x2d1d12 in _0x1da18f){if(_0x1da18f['hasOwnProperty'](_0x2d1d12)&&_[_0x398d('0x8f')](_0x1da18f[_0x2d1d12])){this[_0x398d('0xc')][_0x398d('0x97')](util['format'](_0x398d('0x12e'),_0x2d1d12[_0x398d('0x60')]()),_0x1da18f[_0x2d1d12]);}}if(_[_0x398d('0x41')](_0x1da18f[_0x398d('0x6f')])){return this['channel'][_0x398d('0xba')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x398d('0x3e')](_0x1da18f[_0x398d('0x6f')],_0x398d('0xf7'),_0x398d('0x12f'),'');return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x130'),_0x1da18f['message']));}}return this[_0x398d('0xc')]['error'](_0x3f8f07,_0x398d('0x131'));};AGIVertices[_0x398d('0xf')][_0x398d('0x132')]=function(_0x3488cc){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x133'),_0x3488cc['label'],_0x3488cc[_0x398d('0x5c')]));if(!this[_0x398d('0x7d')](_0x3488cc[_0x398d('0x72')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x134'));}var _0x57eb17=_0x398d('0x135');var _0x3f850a=util[_0x398d('0x24')](_0x398d('0x136'),FILES_PATH,rs[_0x398d('0x11e')](0x4));var _0x4d3069=util[_0x398d('0x24')](_0x398d('0x96'),_0x3f850a,_0x57eb17);var _0x27b39b=!![];if(_0x3488cc[_0x398d('0x137')]===_0x398d('0x138')){_0x27b39b=![];}var _0x49d460=this[_0x398d('0xc')][_0x398d('0x139')](_0x3f850a,_0x57eb17,_0x3488cc[_0x398d('0x13a')],_0x3488cc[_0x398d('0x5c')],undefined,_0x27b39b);if(_0x49d460[_0x398d('0x9b')]!==-0x1){this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('google\x20%s\x20file\x20created',_0x4d3069));var _0x176cd9=this[_0x398d('0x89')][_0x398d('0x68')](this,_0x3488cc,_0x4d3069);if(_0x176cd9){for(var _0x2b0df8 in _0x176cd9){if(_0x176cd9['hasOwnProperty'](_0x2b0df8)){this[_0x398d('0xc')]['setVariable'](util['format']('GOOGLE_ASR_%s',_0x2b0df8['toUpperCase']()),_0x176cd9[_0x2b0df8]);}}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x13b'),JSON[_0x398d('0x6b')](_0x176cd9)));}}return _0x49d460;};AGIVertices[_0x398d('0xf')][_0x398d('0x13c')]=function(_0x28c122){logger['info'](util[_0x398d('0x24')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x28c122['label']));if(!this[_0x398d('0x7d')](_0x28c122['appid'])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x13d'));}if(!this[_0x398d('0x7d')](_0x28c122[_0x398d('0x13e')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x13f'));}var _0x3d005c='wav';var _0xa8c2e8=util[_0x398d('0x24')]('%s/recordings/%s',FILES_PATH,rs[_0x398d('0x11e')](0x4));var _0x37ff49=util['format'](_0x398d('0x96'),_0xa8c2e8,_0x3d005c);var _0x4ed02a=!![];if(_0x28c122[_0x398d('0x137')]===_0x398d('0x138')){_0x4ed02a=![];}var _0x49bb3d=this[_0x398d('0xc')]['recordFile'](_0xa8c2e8,_0x3d005c,_0x28c122[_0x398d('0x13a')],_0x28c122['timeout'],undefined,_0x4ed02a);if(_0x49bb3d[_0x398d('0x9b')]!==-0x1){this[_0x398d('0xc')][_0x398d('0xba')](util['format'](_0x398d('0x140'),_0x37ff49));var _0x1093d6=this['tildeASR'][_0x398d('0x68')](this,_0x28c122,_0x37ff49);if(_0x1093d6){for(var _0x1acd33 in _0x1093d6){if(_0x1093d6[_0x398d('0x8e')](_0x1acd33)){this[_0x398d('0xc')][_0x398d('0x97')](util['format'](_0x398d('0x141'),_0x1acd33[_0x398d('0x60')]()),_0x1093d6[_0x1acd33]);}}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x142'),JSON[_0x398d('0x6b')](_0x1093d6)));}}return _0x49bb3d;};AGIVertices[_0x398d('0xf')]['gotoc']=function(_0x4bb6b3){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x143'),_0x4bb6b3[_0x398d('0xa2')]));return this[_0x398d('0xc')][_0x398d('0x144')](_0x4bb6b3[_0x398d('0x39')],_0x4bb6b3[_0x398d('0x3a')],_0x4bb6b3[_0x398d('0x145')]);};AGIVertices[_0x398d('0xf')][_0x398d('0x146')]=function(_0x28fefd){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x147'),_0x28fefd[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x28fefd[_0x398d('0x148')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x28fefd,_0x398d('0x149'));}try{var _0x453b07=eval(_0x28fefd[_0x398d('0x148')])?_0x398d('0x14a'):_0x398d('0x14b');this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x14c'),_0x28fefd[_0x398d('0x148')],_0x453b07));return{'code':0xc8,'result':_0x453b07};}catch(_0x478b17){return{'code':0xc8,'result':_0x398d('0x14b')};}};AGIVertices[_0x398d('0xf')]['gotoiftime']=function(_0x489b5d){logger[_0x398d('0x29')](util['format'](_0x398d('0x14d'),_0x489b5d[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x489b5d[_0x398d('0x14e')])){return this[_0x398d('0xc')]['error'](_0x489b5d,_0x398d('0x14f'));}var _0x12d670=this[_0x398d('0x1e')][_0x398d('0x68')](this,_0x489b5d[_0x398d('0x14e')]);if(!_0x12d670){return this['channel']['error'](_0x489b5d,_0x398d('0x150'));}for(var _0x206e0b=0x0;_0x206e0b<_0x12d670['length'];_0x206e0b+=0x1){var _0x55d2df=this[_0x398d('0xc')][_0x398d('0x10')](util['format'](_0x398d('0x151'),_0x12d670[_0x206e0b]));if(_0x55d2df['result']===-0x1){return _0x55d2df;}logger['info'](util[_0x398d('0x24')](_0x398d('0x152'),_0x12d670[_0x206e0b],_0x55d2df[_0x398d('0x9d')]));if(_0x55d2df[_0x398d('0x9d')]===_0x398d('0x14a')){logger[_0x398d('0x29')](util['format'](_0x398d('0x152'),_0x12d670[_0x206e0b],_0x398d('0x14a')));this[_0x398d('0xc')]['noop'](util[_0x398d('0x24')](_0x398d('0x152'),_0x12d670[_0x206e0b],_0x398d('0x14a')));return{'code':0xc8,'result':_0x398d('0x14a')};}else{logger[_0x398d('0x29')](util['format'](_0x398d('0x152'),_0x12d670[_0x206e0b],_0x398d('0x14b')));this[_0x398d('0xc')]['noop'](util['format'](_0x398d('0x152'),_0x12d670[_0x206e0b],'false'));}}return{'code':0xc8,'result':_0x398d('0x14b')};};AGIVertices[_0x398d('0xf')][_0x398d('0x153')]=function(_0x3318de){logger[_0x398d('0x29')](util['format'](_0x398d('0x154'),_0x3318de['label']));return this[_0x398d('0xc')][_0x398d('0x153')]();};AGIVertices[_0x398d('0xf')][_0x398d('0x155')]=function(_0x18a70b){logger[_0x398d('0x29')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x18a70b[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x18a70b[_0x398d('0x72')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x134'));}var _0x333c7d=_0x398d('0x135');var _0x564f2a=util[_0x398d('0x24')](_0x398d('0x136'),FILES_PATH,rs[_0x398d('0x11e')](0x4));var _0x5dda21=util[_0x398d('0x24')]('%s.%s',_0x564f2a,_0x333c7d);var _0x5a4e7d=!![];if(_0x18a70b[_0x398d('0x137')]===_0x398d('0x138')){_0x5a4e7d=![];}var _0x1f8075=this[_0x398d('0xc')][_0x398d('0x139')](_0x564f2a,_0x333c7d,_0x18a70b[_0x398d('0x13a')],_0x18a70b[_0x398d('0x5c')],undefined,_0x5a4e7d);if(_0x1f8075[_0x398d('0x9b')]!==-0x1){this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x156'),_0x5dda21));var _0x196646=this[_0x398d('0x7b')][_0x398d('0x68')](this,_0x18a70b,_0x5dda21);if(_0x196646){for(var _0x59db17 in _0x196646){if(_0x196646['hasOwnProperty'](_0x59db17)){this[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')](_0x398d('0x157'),_0x59db17[_0x398d('0x60')]()),_0x196646[_0x59db17]);}}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x158'),JSON[_0x398d('0x6b')](_0x196646)));}}return _0x1f8075;};AGIVertices['prototype'][_0x398d('0x159')]=function(_0x380c7f){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x15a'),_0x380c7f[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x380c7f['key'])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x134'));}if(!this[_0x398d('0x7d')](_0x380c7f[_0x398d('0x54')])){return this[_0x398d('0xc')][_0x398d('0xba')]('no\x20text\x20configured');}this['channel']['noop'](util['format'](_0x398d('0x15b'),_0x380c7f['text']));var _0x36a1be=this[_0x398d('0x78')]['sync'](this,_0x380c7f);if(_0x36a1be){this[_0x398d('0xc')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x36a1be));var _0x21ec33=this[_0x398d('0xc')][_0x398d('0x105')](_0x36a1be,_0x380c7f[_0x398d('0x13a')]);try{fs['unlink'](_0x36a1be+_0x398d('0x108'));}catch(_0x1a46c9){logger[_0x398d('0x28')](_0x1a46c9);}return _0x21ec33;}return this[_0x398d('0xc')]['error'](_0x380c7f,_0x398d('0x15c'));};AGIVertices[_0x398d('0xf')]['login']=function(_0x5b452f){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x15d'),_0x5b452f['label']));if(!this[_0x398d('0x7d')](_0x5b452f[_0x398d('0x15e')])){return this['channel'][_0x398d('0x28')](_0x5b452f,_0x398d('0x15f'));}logger[_0x398d('0x29')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x398d('0xc')][_0x398d('0x36')],_0x5b452f[_0x398d('0x15e')]));var _0x5af9d5=this[_0x398d('0x4f')][_0x398d('0x68')](this,_0x5b452f[_0x398d('0x15e')]);if(_0x5af9d5){logger['info'](util[_0x398d('0x24')](_0x398d('0x160'),this[_0x398d('0xc')][_0x398d('0x36')],_0x5b452f[_0x398d('0x15e')]));this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x398d('0xc')][_0x398d('0x36')],_0x5b452f['findBy']));return{'code':0xc8,'result':_0x398d('0x161')};}else{logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x162'),this[_0x398d('0xc')][_0x398d('0x36')],_0x5b452f['findBy']));this['channel'][_0x398d('0xba')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x398d('0x36')],_0x5b452f[_0x398d('0x15e')]));return{'code':0xc8,'result':_0x398d('0x163')};}};AGIVertices[_0x398d('0xf')][_0x398d('0x164')]=function(_0x4c2c31){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x165'),_0x4c2c31[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x4c2c31[_0x398d('0x15e')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x4c2c31,_0x398d('0x15f'));}logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x166'),this[_0x398d('0xc')][_0x398d('0x36')],_0x4c2c31[_0x398d('0x15e')]));var _0x1eac9c=this[_0x398d('0x4e')][_0x398d('0x68')](this,_0x4c2c31[_0x398d('0x15e')]);if(_0x1eac9c){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x160'),this['channel'][_0x398d('0x36')],_0x4c2c31[_0x398d('0x15e')]));this['channel'][_0x398d('0xba')](util[_0x398d('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x398d('0x36')],_0x4c2c31[_0x398d('0x15e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x162'),this[_0x398d('0xc')]['callerid'],_0x4c2c31[_0x398d('0x15e')]));this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x398d('0xc')][_0x398d('0x36')],_0x4c2c31[_0x398d('0x15e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x398d('0x167')]=function(_0x46ef8b){logger[_0x398d('0x29')](util['format'](_0x398d('0x168'),_0x46ef8b['label']));if(!this['isConfigured'](_0x46ef8b[_0x398d('0x169')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x46ef8b,_0x398d('0x16a'));}this[_0x398d('0xc')][_0x398d('0xba')](util['format'](_0x398d('0x16b'),_0x46ef8b[_0x398d('0x169')]));var _0x4ff77a=eval(_0x46ef8b[_0x398d('0x169')]);if(!this[_0x398d('0x7d')](_0x46ef8b[_0x398d('0xd7')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xd8'));}var _0x3b61bd=this[_0x398d('0x10')][_0x398d('0x68')](this,_0x46ef8b['variable_id']);if(!_0x3b61bd){return this['channel']['error'](_0x46ef8b,'no\x20variable\x20found');}if(_[_0x398d('0x16c')](_0x4ff77a)){var _0x4d9ef5=this;_0x4ff77a['forEach'](function(_0x38544f,_0x4236fe){_0x4d9ef5[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')](_0x398d('0x16d'),_0x3b61bd,_0x4236fe),_0x38544f);});return this[_0x398d('0xc')][_0x398d('0xba')](util['format'](_0x398d('0x16e'),_0x3b61bd));}else{return this[_0x398d('0xc')][_0x398d('0x97')](_0x3b61bd,_0x4ff77a);}};AGIVertices['prototype']['menu']=function(_0x55c9b7){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x55c9b7['label']));if(_0x55c9b7[_0x398d('0x9f')]===0x0){return this['maxRetry'](_0x55c9b7);}_0x55c9b7[_0x398d('0x9f')]-=0x1;if(!this['isConfigured'](_0x55c9b7['file_id'])){return this['channel'][_0x398d('0x28')](_0x55c9b7,'no\x20file\x20audio\x20selected');}var _0x4c12e2=this['getSound']['sync'](this,_0x55c9b7[_0x398d('0x115')]);if(!_0x4c12e2){return this[_0x398d('0xc')][_0x398d('0x28')](_0x55c9b7,_0x398d('0x117'));}var _0x22839d=this[_0x398d('0xc')][_0x398d('0x118')](_0x4c12e2,_0x55c9b7['response'],_0x55c9b7[_0x398d('0x16f')]);var _0xe1c3c6=_0x22839d[_0x398d('0x9b')];if(_0x22839d[_0x398d('0x9b')]===-0x1){this[_0x398d('0x33')][_0x398d('0x68')](this,_0x55c9b7,'-1');return _0x22839d;}else if(_0x22839d[_0x398d('0x9d')]===_0x398d('0x5c')){_0x22839d[_0x398d('0x9b')]=_0x22839d['result'][_0x398d('0x93')]>0x0?_0x22839d['result']:'t';}else if(_['isEmpty'](_0x22839d[_0x398d('0x9b')])){_0x22839d[_0x398d('0x9b')]='#';_0xe1c3c6='#';}if(!this[_0x398d('0x7d')](_0x55c9b7[_0x398d('0xd7')])){this['channel']['noop'](_0x398d('0xd8'));}else{var _0x483fff=this[_0x398d('0x10')][_0x398d('0x68')](this,_0x55c9b7[_0x398d('0xd7')]);if(!_0x483fff){return this[_0x398d('0xc')][_0x398d('0x28')](_0x55c9b7,'no\x20variable\x20found');}this[_0x398d('0xc')]['setVariable'](_0x483fff,_0xe1c3c6);}this[_0x398d('0x33')]['sync'](this,_0x55c9b7,_0xe1c3c6);return _0x22839d;};AGIVertices['prototype'][_0x398d('0xba')]=function(_0xc4c224){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x170'),_0xc4c224['label']));return this[_0x398d('0xc')][_0x398d('0xba')](_0xc4c224['output']||_0xc4c224['label']);};AGIVertices[_0x398d('0xf')][_0x398d('0x171')]=function(_0x262a46){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x262a46['label']));if(!this[_0x398d('0x7d')](_0x262a46[_0x398d('0x15e')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x262a46,_0x398d('0x15f'));}logger[_0x398d('0x29')](util[_0x398d('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x262a46[_0x398d('0x15e')]));var _0x3e725e=this[_0x398d('0x49')][_0x398d('0x68')](this,_0x262a46[_0x398d('0x172')]);var _0x3c647b=this[_0x398d('0x4b')][_0x398d('0x68')](this,_0x262a46[_0x398d('0x15e')],_0x3e725e);if(_0x3c647b){logger[_0x398d('0x29')](util[_0x398d('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x398d('0xc')][_0x398d('0x36')],_0x262a46[_0x398d('0x15e')]));this[_0x398d('0xc')]['noop'](util['format'](_0x398d('0x160'),this['channel'][_0x398d('0x36')],_0x262a46[_0x398d('0x15e')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x398d('0x24')](_0x398d('0x162'),this[_0x398d('0xc')]['callerid'],_0x262a46[_0x398d('0x15e')]));this[_0x398d('0xc')][_0x398d('0xba')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x398d('0xc')][_0x398d('0x36')],_0x262a46[_0x398d('0x15e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x398d('0xf')]['playback']=function(_0x5f8bf2){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x173'),_0x5f8bf2[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x5f8bf2['file_id'])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x5f8bf2,_0x398d('0x116'));}var _0x498100=this[_0x398d('0x1b')][_0x398d('0x68')](this,_0x5f8bf2[_0x398d('0x115')]);if(!_0x498100){return this[_0x398d('0xc')][_0x398d('0x28')](_0x5f8bf2,_0x398d('0x117'));}var _0x3da9ac=this[_0x398d('0xc')][_0x398d('0xbf')]('PLAYBACK',[_0x498100,_0x5f8bf2['opts']]);if(_0x3da9ac[_0x398d('0x9b')]===-0x1){return _0x3da9ac;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('Executed\x20command\x20%s\x20%s',_0x398d('0x174'),_0x498100));};AGIVertices[_0x398d('0xf')][_0x398d('0x175')]=function(_0x47dc21){logger[_0x398d('0x29')](util['format'](_0x398d('0x176'),_0x47dc21['label']));if(!this[_0x398d('0x7d')](_0x47dc21[_0x398d('0x177')])){return this[_0x398d('0xc')]['error'](_0x47dc21,_0x398d('0x178'));}var _0x5f17cc='';var _0x697906=parseInt(_0x47dc21['queue_id'],0xa);if(isNaN(_0x697906)){_0x5f17cc=_0x47dc21['queue_id'];}else{_0x5f17cc=this['getVoiceQueue'][_0x398d('0x68')](this,_0x47dc21['queue_id']);if(!_0x5f17cc){return this['channel'][_0x398d('0x28')](_0x47dc21,_0x398d('0x179'));}}var _0x440cd9='';if(this[_0x398d('0x7d')](_0x47dc21[_0x398d('0x115')])){var _0xc4ee5c=this[_0x398d('0x1b')][_0x398d('0x68')](this,_0x47dc21[_0x398d('0x115')]);if(_0xc4ee5c){_0x440cd9=_0xc4ee5c;}}this[_0x398d('0x33')][_0x398d('0x68')](this,_0x47dc21,_0x5f17cc);if(_0x47dc21[_0x398d('0xe5')]['indexOf']('x')<0x0){_0x47dc21[_0x398d('0xe5')]+='x';}if(_0x47dc21[_0x398d('0xe5')][_0x398d('0x17a')]('X')<0x0){_0x47dc21['opts']+='X';}this[_0x398d('0xc')][_0x398d('0x97')](_0x398d('0x17b'),_0x5f17cc?_0x5f17cc[_0x398d('0x17c')]():'');var _0x554a64=this[_0x398d('0xc')][_0x398d('0xbf')](_0x398d('0x17d'),[_0x5f17cc,_0x47dc21['opts'],_0x47dc21[_0x398d('0x5b')],_0x440cd9,_0x47dc21['timeout'],_0x47dc21[_0x398d('0xae')],_0x47dc21[_0x398d('0x17e')],_0x47dc21['gosub'],'',_0x47dc21[_0x398d('0x17f')]]);if(_0x554a64['result']===-0x1){return _0x554a64;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xc1'),'QUEUE',_0x5f17cc));};AGIVertices[_0x398d('0xf')]['record']=function(_0x399265){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x180'),_0x399265['label']));var _0x4b16ec=_0x399265[_0x398d('0x181')]||_0x398d('0x135');var _0x5f0d08=util[_0x398d('0x24')](_0x398d('0x182'),this[_0x398d('0xc')][_0x398d('0x34')],rs['generate'](0x5));var _0x3fbbf0=util[_0x398d('0x24')](_0x398d('0x183'),FILES_PATH,_0x5f0d08,_0x4b16ec);var _0x9f3b19=util[_0x398d('0x24')](_0x398d('0x136'),FILES_PATH,_0x5f0d08);this['createSquareRecording'][_0x398d('0x68')](this,_0x399265,_0x5f0d08,_0x3fbbf0);this[_0x398d('0xc')]['setVariable'](_0x398d('0x184'),_0x5f0d08);logger[_0x398d('0x29')](_0x398d('0x185'),_0x9f3b19,_0x4b16ec,_0x399265[_0x398d('0x186')],_0x399265[_0x398d('0x5c')]);return this['channel'][_0x398d('0x139')](_0x9f3b19,_0x4b16ec,_0x399265[_0x398d('0x186')],_0x399265[_0x398d('0x5c')],undefined,!![]);};AGIVertices['prototype'][_0x398d('0x187')]=function(_0x41ad5d){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x41ad5d[_0x398d('0xa2')]));if(!this['isConfigured'](_0x41ad5d[_0x398d('0x5b')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x188'));}var _0x53535d=this['restAPI'][_0x398d('0x68')](this,_0x41ad5d);logger['info'](util['format'](_0x398d('0x189'),util[_0x398d('0x18a')](_0x53535d,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x41ad5d[_0x398d('0xd7')])){return this['channel']['noop'](_0x398d('0x18b'));}var _0x1cdd5d=this[_0x398d('0x10')][_0x398d('0x68')](this,_0x41ad5d[_0x398d('0xd7')]);if(!_0x1cdd5d){return this[_0x398d('0xc')]['error'](_0x41ad5d,_0x398d('0xd9'));}this[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')](_0x398d('0x18c'),_0x1cdd5d),_0x53535d['statusCode']?_0x53535d[_0x398d('0x6d')]:'200');this[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')](_0x398d('0x18d'),_0x1cdd5d),_0x53535d[_0x398d('0x6e')]?_0x53535d[_0x398d('0x6e')]:'OK');if(_0x53535d[_0x398d('0x61')]){try{this[_0x398d('0x95')](_0x53535d[_0x398d('0x61')],_0x1cdd5d);}catch(_0x1a3f5b){logger[_0x398d('0x28')](util[_0x398d('0x24')](_0x398d('0x18e'),_0x1cdd5d));}}return this['channel']['noop'](util[_0x398d('0x24')]('variable\x20%s\x20set',_0x1cdd5d));};AGIVertices[_0x398d('0xf')][_0x398d('0x18f')]=function(_0xd3880e){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0xd3880e[_0x398d('0xa2')]));return this['channel']['sayDigits'](_0xd3880e[_0x398d('0x190')][_0x398d('0xd5')](/\s+/g,''),_0xd3880e[_0x398d('0x186')]);};AGIVertices[_0x398d('0xf')][_0x398d('0x191')]=function(_0x144cbb){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x192'),_0x144cbb[_0x398d('0xa2')]));return this[_0x398d('0xc')][_0x398d('0x193')](_0x144cbb[_0x398d('0x194')][_0x398d('0xd5')](/\s+/g,''),_0x144cbb['escape_digits']);};AGIVertices[_0x398d('0xf')][_0x398d('0x195')]=function(_0x7bef9e){logger['info'](util[_0x398d('0x24')](_0x398d('0x196'),_0x7bef9e[_0x398d('0xa2')]));return this[_0x398d('0xc')][_0x398d('0x197')](_0x7bef9e['text'],_0x7bef9e[_0x398d('0x186')]);};AGIVertices['prototype'][_0x398d('0x198')]=function(_0x731c96){logger[_0x398d('0x29')](util['format'](_0x398d('0x199'),_0x731c96['label']));if(!this[_0x398d('0x7d')](_0x731c96['account_id'])){return this['channel'][_0x398d('0xba')](_0x398d('0x19a'));}var _0x4ba2a2=this[_0x398d('0x19b')]['sync'](this,_0x731c96[_0x398d('0x19c')]);if(!_0x4ba2a2||!_0x4ba2a2[_0x398d('0x19d')]){return this[_0x398d('0xc')]['error'](_0x731c96,'no\x20mail\x20account\x20found');}var _0x34bf92={'from':util['format'](_0x398d('0x19e'),_0x4ba2a2[_0x398d('0x12')],_0x4ba2a2['email']||_0x4ba2a2['Smtp'][_0x398d('0x19f')]),'to':_0x731c96['to']||'','cc':_0x731c96['cc']||'','bcc':_0x731c96[_0x398d('0x1a0')]||'','subject':_0x731c96[_0x398d('0x1a1')],'html':_0x731c96[_0x398d('0x54')],'text':_0x731c96[_0x398d('0x54')]};if(this[_0x398d('0x7d')](_0x731c96[_0x398d('0x1a2')])){}logger[_0x398d('0xdf')](_0x398d('0x1a3'),JSON[_0x398d('0x6b')](_0x34bf92));this[_0x398d('0x33')][_0x398d('0x68')](this,_0x731c96,_0x731c96[_0x398d('0x19c')]);this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1a4'),_0x4ba2a2[_0x398d('0x12')]));this[_0x398d('0x1d')][_0x398d('0x68')](this,_0x4ba2a2['smtpOptions'],_0x34bf92);return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x1a5'));};AGIVertices[_0x398d('0xf')]['sendFax']=function(_0x5c830b){logger[_0x398d('0x29')](util['format'](_0x398d('0x1a6'),_0x5c830b[_0x398d('0xa2')]));return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x1a7'));};AGIVertices[_0x398d('0xf')][_0x398d('0x1a8')]=function(_0x899bda){logger['info'](util[_0x398d('0x24')](_0x398d('0x1a9'),_0x899bda[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x899bda[_0x398d('0x1aa')])){return this['channel']['noop'](_0x398d('0x1ab'));}var _0x287e28=this[_0x398d('0x30')][_0x398d('0x68')](this,_0x899bda[_0x398d('0x1aa')]);if(!_0x287e28){return this['channel']['error'](_0x899bda,'no\x20sms\x20account\x20found');}var _0x260b42={'body':_0x899bda[_0x398d('0x1ac')],'phone':_0x899bda['to']||'','SmsAccountId':_0x287e28['id']};logger[_0x398d('0xdf')]('sendSMS\x20message',JSON[_0x398d('0x6b')](_0x260b42));this[_0x398d('0x33')]['sync'](this,_0x899bda,_0x899bda['sms_account_id']);this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1ad'),_0x287e28[_0x398d('0x12')]));this[_0x398d('0x32')][_0x398d('0x68')](this,_0x260b42);return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x1ae'));};AGIVertices[_0x398d('0xf')][_0x398d('0x1af')]=function(_0x53d4b3){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x1b0'),_0x53d4b3[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x53d4b3[_0x398d('0xd7')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x53d4b3,_0x398d('0x1b1'));}var _0x139040=this['getVariable']['sync'](this,_0x53d4b3[_0x398d('0xd7')]);if(!_0x139040){return this[_0x398d('0xc')][_0x398d('0x28')](_0x53d4b3,_0x398d('0xd9'));}return this[_0x398d('0xc')][_0x398d('0x97')](_0x139040,_0x53d4b3['variable_value']);};AGIVertices['prototype'][_0x398d('0x1b2')]=function(_0x3b71cc){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x1b3'),_0x3b71cc[_0x398d('0xa2')]));this['channel']['noop'](_0x398d('0x1b4'));var _0x1a1e08=this[_0x398d('0xc')]['getVariable'](_0x398d('0x1b5'));if(!_[_0x398d('0x40')](_0x1a1e08[_0x398d('0x9d')])){this[_0x398d('0xc')]['uniqueid']=_0x1a1e08['extra'];}if(_0x3b71cc['answer']===_0x398d('0x1b6')){this['channel'][_0x398d('0xba')](_0x398d('0x1b7'));return this['channel'][_0x398d('0xb2')]();}return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x1b8'));};AGIVertices[_0x398d('0xf')][_0x398d('0x1b9')]=function(_0x186ce8){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x1ba'),_0x186ce8[_0x398d('0xa2')]));if(!this['isConfigured'](_0x186ce8[_0x398d('0x1bb')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x186ce8,_0x398d('0x1bc'));}var _0x543dd6=this['getSquareProject'][_0x398d('0x68')](this,_0x186ce8[_0x398d('0x1bb')]);if(!this[_0x398d('0x7d')](_0x543dd6)){return this[_0x398d('0xc')]['error'](_0x186ce8,util[_0x398d('0x24')](_0x398d('0x1bd'),_0x186ce8[_0x398d('0x1bb')]));}if(_0x543dd6===this[_0x398d('0xc')]['arg_1']){return this[_0x398d('0xc')][_0x398d('0x28')](_0x186ce8,_0x398d('0x1be'));}this[_0x398d('0x33')][_0x398d('0x68')](this,_0x186ce8,_0x543dd6);var _0x28be59=this[_0x398d('0xc')][_0x398d('0xbf')](_0x398d('0x1bf'),util[_0x398d('0x24')](_0x398d('0x1c0'),config['agi'][_0x398d('0x1c1')]||_0x398d('0x1c2'),_0x543dd6,this['channel'][_0x398d('0x3c')]));if(_0x28be59[_0x398d('0x9b')]===-0x1){return _0x28be59;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('Executed\x20command\x20%s\x20%s',_0x398d('0x1bf'),_0x543dd6));};AGIVertices[_0x398d('0xf')][_0x398d('0x1c3')]=function(_0x28da59){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x28da59[_0x398d('0xa2')]));var _0x354cc5=this[_0x398d('0x51')][_0x398d('0x68')](this,_0x28da59[_0x398d('0xb0')]);this[_0x398d('0x33')]['sync'](this,_0x28da59,_0x28da59[_0x398d('0xb0')]);if(this[_0x398d('0x7d')](_0x28da59[_0x398d('0xd7')])){var _0x536ba9=this[_0x398d('0x10')][_0x398d('0x68')](this,_0x28da59[_0x398d('0xd7')]);if(_0x536ba9){this[_0x398d('0xc')][_0x398d('0x97')](_0x536ba9,_0x354cc5);return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1c4'),_0x28da59[_0x398d('0xb0')],_0x536ba9));}}return this[_0x398d('0xc')][_0x398d('0xba')](util['format'](_0x398d('0x1c5'),_0x28da59[_0x398d('0xb0')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x613732){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x1c6'),_0x613732['label']));_0x613732['text']=_0x613732['text'][_0x398d('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x398d('0x7d')](_0x613732[_0x398d('0x53')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x1c7'));}if(!this[_0x398d('0x7d')](_0x613732['text'])){return this[_0x398d('0xc')][_0x398d('0xba')]('no\x20text\x20configured');}this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1c8'),_0x613732['text']));var _0x1346a8=this[_0x398d('0x52')][_0x398d('0x68')](this,_0x613732);if(_0x1346a8){this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1c9'),_0x1346a8));var _0x5d76d8=this[_0x398d('0xc')][_0x398d('0x105')](_0x1346a8);try{fs['unlink'](_0x1346a8+'.wav');}catch(_0x43739d){logger[_0x398d('0x28')](_0x43739d);}return _0x5d76d8;}return this[_0x398d('0xc')][_0x398d('0x28')](_0x613732,_0x398d('0x1ca'));};AGIVertices['prototype'][_0x398d('0x1cb')]=function(_0x1a2e26){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1a2e26[_0x398d('0xa2')]));_0x1a2e26[_0x398d('0x54')]=_0x1a2e26['text'][_0x398d('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x398d('0x7d')](_0x1a2e26['text'])){return this[_0x398d('0xc')]['noop'](_0x398d('0xa3'));}this['channel']['noop'](util[_0x398d('0x24')](_0x398d('0x1cc'),_0x1a2e26[_0x398d('0x54')]));var _0x2b5de5=this[_0x398d('0x59')]['sync'](this,_0x1a2e26);if(_0x2b5de5){this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1cd'),_0x2b5de5));var _0x49181c=this[_0x398d('0xc')]['streamFile'](_0x2b5de5);try{fs[_0x398d('0x107')](_0x2b5de5+'.wav');}catch(_0x39d391){logger[_0x398d('0x28')](_0x39d391);}return _0x49181c;}return this[_0x398d('0xc')]['error'](_0x1a2e26,_0x398d('0x1ce'));};AGIVertices[_0x398d('0xf')][_0x398d('0x1cf')]=function(_0x242012){logger[_0x398d('0x29')](util['format'](_0x398d('0x1d0'),_0x242012['label']));if(!this['isConfigured'](_0x242012['findBy'])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x242012,_0x398d('0x15f'));}logger['info'](util[_0x398d('0x24')](_0x398d('0x166'),this[_0x398d('0xc')]['callerid'],_0x242012[_0x398d('0x15e')]));var _0x14a94e=this[_0x398d('0x4d')][_0x398d('0x68')](this,_0x242012[_0x398d('0x15e')]);if(_0x14a94e){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x160'),this[_0x398d('0xc')][_0x398d('0x36')],_0x242012['findBy']));this[_0x398d('0xc')]['noop'](util[_0x398d('0x24')](_0x398d('0x160'),this[_0x398d('0xc')][_0x398d('0x36')],_0x242012[_0x398d('0x15e')]));return{'code':0xc8,'result':_0x398d('0x161')};}else{logger['info'](util[_0x398d('0x24')](_0x398d('0x162'),this['channel']['callerid'],_0x242012[_0x398d('0x15e')]));this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x398d('0x36')],_0x242012[_0x398d('0x15e')]));return{'code':0xc8,'result':_0x398d('0x163')};}};AGIVertices['prototype'][_0x398d('0x1d1')]=function(_0xaceb3){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x1d2'),_0xaceb3[_0x398d('0xa2')]));var _0x15e0d8=this[_0x398d('0xc')][_0x398d('0xbf')](_0x398d('0x1d3'),[_0xaceb3[_0x398d('0x1d4')],_0xaceb3['options']]);if(_0x15e0d8[_0x398d('0x9b')]===-0x1){return _0x15e0d8;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xc1'),_0x398d('0x1d3'),_0xaceb3['mailbox']));};AGIVertices[_0x398d('0xf')][_0x398d('0x1d5')]=function(_0x1cab1f){logger['info'](util[_0x398d('0x24')](_0x398d('0x1d6'),_0x1cab1f[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x1cab1f['variable_id'])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x1cab1f,_0x398d('0x1b1'));}var _0x48dda7=this['getVariable'][_0x398d('0x68')](this,_0x1cab1f[_0x398d('0xd7')]);if(!_0x48dda7){return this[_0x398d('0xc')]['error'](_0x1cab1f,_0x398d('0xd9'));}var _0x48249e=this[_0x398d('0xc')][_0x398d('0x10')](_0x48dda7);return{'code':0xc8,'result':_0x48249e['extra']?_0x48249e[_0x398d('0x9d')]:'-'};};String['prototype']['replaceAll']=function(_0x58bc18,_0x4aa1c8){return this['split'](_0x58bc18)[_0x398d('0x1d7')](_0x4aa1c8);};module[_0x398d('0x1d8')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 601372c..bfd2e81 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 _0x13e9=['lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','lastPauseAt','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','startAcw','channels','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','paused','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports'];(function(_0x7432bd,_0x152fd5){var _0x4ad91c=function(_0xf686f5){while(--_0xf686f5){_0x7432bd['push'](_0x7432bd['shift']());}};_0x4ad91c(++_0x152fd5);}(_0x13e9,0xc0));var _0x913e=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x13e9[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x913e('0x0'));var moment=require(_0x913e('0x1'));var ami=require(_0x913e('0x2'));var logger=require(_0x913e('0x3'))('acw');var RpcUser=require(_0x913e('0x4'));var RpcVoiceAgentReport=require(_0x913e('0x5'));function Acw(_0x3dc3c9){this['voiceQueues']=_0x3dc3c9[_0x913e('0x6')];this[_0x913e('0x7')]=_0x3dc3c9['agents'];this[_0x913e('0x8')]=_0x3dc3c9[_0x913e('0x8')];this['channels']={};ami['on']('agentconnect',this[_0x913e('0x9')][_0x913e('0xa')](this));ami['on'](_0x913e('0xb'),this['syncHangupRequest'][_0x913e('0xa')](this));ami['on'](_0x913e('0xc'),this[_0x913e('0xd')][_0x913e('0xa')](this));ami['on'](_0x913e('0xe'),this[_0x913e('0xf')][_0x913e('0xa')](this));ami['on'](_0x913e('0x10'),this[_0x913e('0x11')][_0x913e('0xa')](this));ami['on'](_0x913e('0x12'),this[_0x913e('0x13')][_0x913e('0xa')](this));ami['on'](_0x913e('0x14'),this[_0x913e('0x15')][_0x913e('0xa')](this));}function getDiff(_0x3d5b4e){var _0x4e5d2d=moment()[_0x913e('0x16')](0x0);var _0x1fc91f=moment(_0x3d5b4e)[_0x913e('0x16')](0x0);return _0x4e5d2d[_0x913e('0x17')](_0x1fc91f,_0x913e('0x18'));}Acw[_0x913e('0x19')]['updateAcw']=function(_0x3c16d8,_0x27d8ea){var _0xa1f50e=this;var _0x23e0a0=getDiff(_0xa1f50e['timers'][_0x3c16d8][_0x913e('0x1a')]);clearTimeout(_0xa1f50e[_0x913e('0x8')][_0x3c16d8]['timer']);_0xa1f50e['timers'][_0x3c16d8][_0x913e('0x1b')]=![];return RpcVoiceAgentReport[_0x913e('0x1c')]({'acwtime':_0x23e0a0},_0xa1f50e[_0x913e('0x8')][_0x3c16d8][_0x913e('0x1d')],_0x3c16d8)['then'](function(_0x4f1fd5){logger[_0x913e('0x1e')](_0x913e('0x1f'),_0x27d8ea,_0x23e0a0,_0x4f1fd5);})[_0x913e('0x20')](function(_0x59800f){logger['error'](_0x913e('0x21'),_0x27d8ea,_0x59800f);})['finally'](function(){delete _0xa1f50e[_0x913e('0x8')][_0x3c16d8];});};Acw['prototype'][_0x913e('0x22')]=function(_0x7b56e7){try{var _0xe0245c=this;var _0x7f9231=this[_0x913e('0x23')][_0x7b56e7][_0x913e('0x24')];var _0xc27aa5=this[_0x913e('0x23')][_0x7b56e7][_0x913e('0x25')];var _0x3cbea7=this[_0x913e('0x6')][_0xc27aa5];var _0xd19205=![];var _0x8cc39a=_0x913e('0x26');if(_0x3cbea7['mandatoryDisposition']&&_0x3cbea7[_0x913e('0x27')][_0x913e('0x28')]){_0xd19205=!![];_0x8cc39a=_0x3cbea7[_0x913e('0x27')]['name'];}return ami[_0x913e('0x29')]({'action':_0x913e('0x2a'),'interface':_0x7f9231,'paused':!![],'reason':_0x8cc39a})[_0x913e('0x2b')](function(){if(_0xe0245c['agents'][_0x7f9231]){return RpcUser[_0x913e('0x2c')](_0xe0245c[_0x913e('0x7')][_0x7f9231]['id'])[_0x913e('0x2b')](function(_0x3bd4c2){if(!_0x3bd4c2||_0x3bd4c2[_0x913e('0x2d')]){logger['info'](_0x913e('0x2e'),_0x7b56e7,_0x7f9231,_0xc27aa5);return;}logger[_0x913e('0x1e')](_0x913e('0x2f'),_0x7b56e7,_0x7f9231,_0xc27aa5);var _0x54896b=_0xe0245c[_0x913e('0x23')][_0x7b56e7]['attended']&&_0xe0245c[_0x913e('0x23')][_0x7b56e7]['destlinkedid']?_0xe0245c[_0x913e('0x23')][_0x7b56e7][_0x913e('0x30')]:_0x7b56e7;return RpcUser[_0x913e('0x31')](_0xe0245c[_0x913e('0x7')][_0x7f9231],_0x8cc39a,_0x54896b)[_0x913e('0x2b')](function(_0x15ce4f){_0xe0245c[_0x913e('0x6')][_0xc27aa5][_0x913e('0x32')]-=0x1;_0xe0245c[_0x913e('0x6')][_0xc27aa5][_0x913e('0x33')]+=0x1;return _0x15ce4f;});})[_0x913e('0x2b')](function(_0x3a9b6b){if(_0xd19205||!_0x3a9b6b){return;}_0xe0245c['timers'][_0x7f9231]={};logger[_0x913e('0x1e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x7b56e7,_0xe0245c[_0x913e('0x6')][_0xc27aa5][_0x913e('0x34')],_0x7f9231,_0xc27aa5);_0xe0245c[_0x913e('0x8')][_0x7f9231]['timer']=setTimeout(_0xe0245c[_0x913e('0x35')][_0x913e('0xa')](_0xe0245c,_0x7f9231),_0xe0245c[_0x913e('0x6')][_0xc27aa5][_0x913e('0x34')]*0x3e8);_0xe0245c[_0x913e('0x8')][_0x7f9231][_0x913e('0x1a')]=moment()[_0x913e('0x36')](_0x913e('0x37'));_0xe0245c[_0x913e('0x8')][_0x7f9231]['uniqueid']=_0x7b56e7;_0xe0245c[_0x913e('0x8')][_0x7f9231]['queue']=_0xc27aa5;_0xe0245c['timers'][_0x7f9231][_0x913e('0x38')]=_0xe0245c['updateAcw'][_0x913e('0xa')](_0xe0245c,_0x7f9231,_0x7b56e7);});}})[_0x913e('0x20')](function(){logger['error'](_0x913e('0x39'),_0x7b56e7,_0xe0245c['voiceQueues'][_0xc27aa5][_0x913e('0x34')],_0x7f9231,_0xc27aa5);})['finally'](function(){delete _0xe0245c[_0x913e('0x23')][_0x7b56e7];});}catch(_0x3a0ee6){logger[_0x913e('0x3a')](_0x913e('0x3b'),_0x3a0ee6[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')]['stopAcw']=function(_0x5b39ed){try{var _0x16bf39=this;if(_0x16bf39[_0x913e('0x8')][_0x5b39ed]){_0x16bf39['timers'][_0x5b39ed][_0x913e('0x1b')]=![];var _0xca45ac=_0x16bf39[_0x913e('0x8')][_0x5b39ed][_0x913e('0x1d')];var _0x3117da=_0x16bf39[_0x913e('0x8')][_0x5b39ed][_0x913e('0x25')];var _0x4558fd=_0x16bf39[_0x913e('0x6')][_0x3117da][_0x913e('0x34')];logger[_0x913e('0x1e')](_0x913e('0x3d'),_0xca45ac,_0x5b39ed);RpcUser['getAgent'](this[_0x913e('0x7')][_0x5b39ed]['id'])['then'](function(_0x1b983b){if(_0x1b983b['pauseType']===_0x913e('0x26')){return RpcUser[_0x913e('0x3e')](_0x16bf39[_0x913e('0x7')][_0x5b39ed]);}});RpcVoiceAgentReport[_0x913e('0x1c')]({'acwtime':_0x4558fd,'agentacw':!![]},_0xca45ac,_0x5b39ed)['then'](function(_0x4f30a1){logger[_0x913e('0x1e')](_0x913e('0x1f'),_0xca45ac,_0x4558fd,_0x4f30a1);})[_0x913e('0x20')](function(_0x457d11){logger[_0x913e('0x3a')](_0x913e('0x21'),_0xca45ac,_0x457d11);});}else{logger[_0x913e('0x3a')](_0x913e('0x3f'),_0x5b39ed);if(_0x16bf39['timers']){logger[_0x913e('0x1e')](_0x913e('0x40'),JSON[_0x913e('0x41')](_0x16bf39[_0x913e('0x8')]));}}}catch(_0x2df025){logger[_0x913e('0x3a')]('[ACW][STOP]\x20%s',_0x2df025['message']);}};Acw[_0x913e('0x19')][_0x913e('0x9')]=function(_0x4f7723){try{if(this[_0x913e('0x6')][_0x4f7723[_0x913e('0x25')]]&&(this[_0x913e('0x6')][_0x4f7723[_0x913e('0x25')]]['acw']||this[_0x913e('0x6')][_0x4f7723['queue']][_0x913e('0x42')])){if(this[_0x913e('0x7')][_0x4f7723['interface']]){this[_0x913e('0x23')][_0x4f7723[_0x913e('0x1d')]]={'queue':_0x4f7723[_0x913e('0x25')],'interface':_0x4f7723['interface'],'destlinkedid':_0x4f7723['destlinkedid']};}}}catch(_0x397fe9){logger['error'](_0x913e('0x43'),_0x397fe9[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')][_0x913e('0x15')]=function(_0x5620f6){try{if(this[_0x913e('0x6')][_0x5620f6[_0x913e('0x25')]]&&(this['voiceQueues'][_0x5620f6[_0x913e('0x25')]]['acw']||this['voiceQueues'][_0x5620f6[_0x913e('0x25')]][_0x913e('0x42')])){if(this['agents'][_0x5620f6['interface']]){this[_0x913e('0x23')][_0x5620f6[_0x913e('0x1d')]]={'queue':_0x5620f6['queue'],'interface':_0x5620f6[_0x913e('0x24')]};}}}catch(_0x1f85d0){logger[_0x913e('0x3a')](_0x913e('0x44'),_0x1f85d0['message']);}};Acw[_0x913e('0x19')][_0x913e('0x45')]=function(_0x4e9ffb){try{if(this[_0x913e('0x23')][_0x4e9ffb['uniqueid']]&&_['isUndefined'](this[_0x913e('0x23')][_0x4e9ffb[_0x913e('0x1d')]]['attended'])){logger[_0x913e('0x1e')](_0x913e('0x46'),_0x4e9ffb[_0x913e('0x1d')]);this[_0x913e('0x22')](_0x4e9ffb['uniqueid']);}else if(this[_0x913e('0x23')][_0x4e9ffb[_0x913e('0x47')]]&&_[_0x913e('0x48')](this[_0x913e('0x23')][_0x4e9ffb[_0x913e('0x47')]][_0x913e('0x49')])){logger[_0x913e('0x1e')](_0x913e('0x4a'),_0x4e9ffb[_0x913e('0x47')]);this[_0x913e('0x22')](_0x4e9ffb[_0x913e('0x47')]);}}catch(_0x352442){logger[_0x913e('0x3a')](_0x913e('0x4b'),_0x352442['message']);}};Acw['prototype'][_0x913e('0xd')]=function(_0x271d0a){try{if(this[_0x913e('0x23')][_0x271d0a[_0x913e('0x1d')]]&&this[_0x913e('0x23')][_0x271d0a[_0x913e('0x1d')]]['attended']){logger[_0x913e('0x1e')](_0x913e('0x4c'),_0x271d0a[_0x913e('0x1d')]);this[_0x913e('0x22')](_0x271d0a[_0x913e('0x1d')]);}else if(this[_0x913e('0x23')][_0x271d0a[_0x913e('0x47')]]&&this[_0x913e('0x23')][_0x271d0a[_0x913e('0x47')]][_0x913e('0x49')]){logger['info'](_0x913e('0x4d'),_0x271d0a[_0x913e('0x47')]);this[_0x913e('0x22')](_0x271d0a[_0x913e('0x47')]);}}catch(_0x99a2da){logger[_0x913e('0x3a')]('[ACW][syncHangup]\x20%s',_0x99a2da[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')]['syncAttendedTransfer']=function(_0x523d74){try{if(!_['isNil'](this[_0x913e('0x23')][_0x523d74[_0x913e('0x4e')]])){this[_0x913e('0x22')](_0x523d74[_0x913e('0x4e')]);if(this[_0x913e('0x23')][_0x523d74['secondtransfereruniqueid']]){this[_0x913e('0x23')][_0x523d74[_0x913e('0x4f')]][_0x913e('0x49')]=!![];this[_0x913e('0x23')][_0x523d74[_0x913e('0x50')]]=this['channels'][_0x523d74['secondtransfereruniqueid']];this[_0x913e('0x51')](_0x523d74[_0x913e('0x4f')]);}}else if(!_[_0x913e('0x52')](this[_0x913e('0x23')][_0x523d74[_0x913e('0x50')]])){this[_0x913e('0x22')](_0x523d74[_0x913e('0x50')]);if(this['channels'][_0x523d74[_0x913e('0x53')]]){this[_0x913e('0x23')][_0x523d74[_0x913e('0x53')]][_0x913e('0x49')]=!![];this[_0x913e('0x23')][_0x523d74['transfereeuniqueid']]=this[_0x913e('0x23')][_0x523d74[_0x913e('0x53')]];this[_0x913e('0x51')](_0x523d74[_0x913e('0x53')]);}}}catch(_0x23fd2f){logger['error'](_0x913e('0x54'),_0x23fd2f[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')]['syncBlindTransfer']=function(_0x4d3753){try{if(this[_0x913e('0x23')][_0x4d3753[_0x913e('0x55')]]){logger[_0x913e('0x1e')](_0x913e('0x56'),JSON[_0x913e('0x41')](_0x4d3753[_0x913e('0x55')]));this['startAcw'](_0x4d3753[_0x913e('0x55')]);}else if(this[_0x913e('0x23')][_0x4d3753['transfererlinkedid']]){logger['info'](_0x913e('0x57'),JSON[_0x913e('0x41')](_0x4d3753[_0x913e('0x58')]));this[_0x913e('0x22')](_0x4d3753[_0x913e('0x58')]);}}catch(_0x9aa2d3){logger[_0x913e('0x3a')](_0x913e('0x59'),_0x9aa2d3[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')][_0x913e('0xf')]=function(_0x35b4be){try{if(this[_0x913e('0x6')][_0x35b4be[_0x913e('0x25')]]&&this['voiceQueues'][_0x35b4be[_0x913e('0x25')]][_0x913e('0x5a')]===_0x913e('0x5b')){if(this['agents'][_0x35b4be['interface']]){logger[_0x913e('0x1e')](_0x913e('0x5c'),_0x35b4be[_0x913e('0x1d')],_0x35b4be[_0x913e('0x24')],_0x35b4be[_0x913e('0x25')]);return RpcUser[_0x913e('0x31')](this[_0x913e('0x7')][_0x35b4be[_0x913e('0x24')]],_0x913e('0x5d'),_0x35b4be[_0x913e('0x1d')]);}}}catch(_0x3c06ba){logger[_0x913e('0x3a')](_0x913e('0x5e'),_0x3c06ba[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')][_0x913e('0x51')]=function(_0x2e2ae5,_0x4d13b5=0x2710){if(this[_0x913e('0x23')][_0x2e2ae5]){setTimeout(()=>{delete this[_0x913e('0x23')][_0x2e2ae5];},_0x4d13b5);}};module[_0x913e('0x5f')]=Acw; \ No newline at end of file +var _0xb63a=['[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','acwTimeout','format','uniqueid','updateAcw','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','attended','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','channels','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','timers','update','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb63a,0x83));var _0xab63=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0xb63a[_0x57014b];return _0x2b258a;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require(_0xab63('0x0'));var logger=require(_0xab63('0x1'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xab63('0x2'));function Acw(_0x5e5358){this[_0xab63('0x3')]=_0x5e5358[_0xab63('0x3')];this[_0xab63('0x4')]=_0x5e5358[_0xab63('0x4')];this['timers']=_0x5e5358['timers'];this[_0xab63('0x5')]={};ami['on']('agentconnect',this[_0xab63('0x6')][_0xab63('0x7')](this));ami['on'](_0xab63('0x8'),this['syncHangupRequest'][_0xab63('0x7')](this));ami['on'](_0xab63('0x9'),this[_0xab63('0xa')][_0xab63('0x7')](this));ami['on'](_0xab63('0xb'),this[_0xab63('0xc')][_0xab63('0x7')](this));ami['on'](_0xab63('0xd'),this['syncAttendedTransfer'][_0xab63('0x7')](this));ami['on']('blindtransfer',this[_0xab63('0xe')][_0xab63('0x7')](this));ami['on'](_0xab63('0xf'),this[_0xab63('0x10')][_0xab63('0x7')](this));}function getDiff(_0x3a8aa1){var _0x3d964a=moment()['milliseconds'](0x0);var _0x3bed13=moment(_0x3a8aa1)[_0xab63('0x11')](0x0);return _0x3d964a[_0xab63('0x12')](_0x3bed13,_0xab63('0x13'));}Acw['prototype']['updateAcw']=function(_0x5e0b37,_0x27cec7){var _0xdc16f2=this;var _0x21f50b=getDiff(_0xdc16f2[_0xab63('0x14')][_0x5e0b37]['lastPauseAt']);clearTimeout(_0xdc16f2[_0xab63('0x14')][_0x5e0b37]['timer']);_0xdc16f2[_0xab63('0x14')][_0x5e0b37]['timer']=![];return RpcVoiceAgentReport[_0xab63('0x15')]({'acwtime':_0x21f50b},_0xdc16f2[_0xab63('0x14')][_0x5e0b37]['uniqueid'],_0x5e0b37)[_0xab63('0x16')](function(_0x3d3032){logger[_0xab63('0x17')](_0xab63('0x18'),_0x27cec7,_0x21f50b,_0x3d3032);})[_0xab63('0x19')](function(_0x3cc0b9){logger[_0xab63('0x1a')](_0xab63('0x1b'),_0x27cec7,_0x3cc0b9);})['finally'](function(){delete _0xdc16f2['timers'][_0x5e0b37];});};Acw[_0xab63('0x1c')][_0xab63('0x1d')]=function(_0x3a1e93){try{var _0x29f7df=this;var _0x5e05b4=this[_0xab63('0x5')][_0x3a1e93][_0xab63('0x1e')];var _0x4e851d=this[_0xab63('0x5')][_0x3a1e93][_0xab63('0x1f')];var _0x4ea550=this[_0xab63('0x3')][_0x4e851d];var _0x323d12=![];var _0x107db6=_0xab63('0x20');if(_0x4ea550[_0xab63('0x21')]&&_0x4ea550[_0xab63('0x22')][_0xab63('0x23')]){_0x323d12=!![];_0x107db6=_0x4ea550[_0xab63('0x22')]['name'];}return ami[_0xab63('0x24')]({'action':_0xab63('0x25'),'interface':_0x5e05b4,'paused':!![],'reason':_0x107db6})[_0xab63('0x16')](function(){if(_0x29f7df[_0xab63('0x4')][_0x5e05b4]){return RpcUser[_0xab63('0x26')](_0x29f7df[_0xab63('0x4')][_0x5e05b4]['id'])[_0xab63('0x16')](function(_0x4d268e){if(!_0x4d268e||_0x4d268e['voicePause']){logger['info'](_0xab63('0x27'),_0x3a1e93,_0x5e05b4,_0x4e851d);return;}logger['info'](_0xab63('0x28'),_0x3a1e93,_0x5e05b4,_0x4e851d);var _0x320353=_0x29f7df['channels'][_0x3a1e93]['attended']&&_0x29f7df[_0xab63('0x5')][_0x3a1e93][_0xab63('0x29')]?_0x29f7df[_0xab63('0x5')][_0x3a1e93][_0xab63('0x29')]:_0x3a1e93;return RpcUser[_0xab63('0x2a')](_0x29f7df['agents'][_0x5e05b4],_0x107db6,_0x320353)[_0xab63('0x16')](function(_0x190a5e){_0x29f7df[_0xab63('0x3')][_0x4e851d][_0xab63('0x2b')]-=0x1;_0x29f7df[_0xab63('0x3')][_0x4e851d][_0xab63('0x2c')]+=0x1;return _0x190a5e;});})['then'](function(_0x40c17d){if(_0x323d12||!_0x40c17d){return;}_0x29f7df['timers'][_0x5e05b4]={};logger[_0xab63('0x17')](_0xab63('0x2d'),_0x3a1e93,_0x29f7df['voiceQueues'][_0x4e851d]['acwTimeout'],_0x5e05b4,_0x4e851d);_0x29f7df[_0xab63('0x14')][_0x5e05b4][_0xab63('0x2e')]=setTimeout(_0x29f7df['stopAcw'][_0xab63('0x7')](_0x29f7df,_0x5e05b4),_0x29f7df[_0xab63('0x3')][_0x4e851d][_0xab63('0x2f')]*0x3e8);_0x29f7df[_0xab63('0x14')][_0x5e05b4]['lastPauseAt']=moment()[_0xab63('0x30')]('YYYY-MM-DD\x20HH:mm:ss');_0x29f7df[_0xab63('0x14')][_0x5e05b4][_0xab63('0x31')]=_0x3a1e93;_0x29f7df[_0xab63('0x14')][_0x5e05b4]['queue']=_0x4e851d;_0x29f7df[_0xab63('0x14')][_0x5e05b4][_0xab63('0x32')]=_0x29f7df['updateAcw'][_0xab63('0x7')](_0x29f7df,_0x5e05b4,_0x3a1e93);});}})[_0xab63('0x19')](function(){logger[_0xab63('0x1a')](_0xab63('0x2d'),_0x3a1e93,_0x29f7df[_0xab63('0x3')][_0x4e851d]['acwTimeout'],_0x5e05b4,_0x4e851d);})[_0xab63('0x33')](function(){delete _0x29f7df['channels'][_0x3a1e93];});}catch(_0x2d2582){logger[_0xab63('0x1a')](_0xab63('0x34'),_0x2d2582[_0xab63('0x35')]);}};Acw['prototype']['stopAcw']=function(_0x1d68a3){try{var _0x366bd9=this;if(_0x366bd9[_0xab63('0x14')][_0x1d68a3]){_0x366bd9[_0xab63('0x14')][_0x1d68a3][_0xab63('0x2e')]=![];var _0x4d0720=_0x366bd9[_0xab63('0x14')][_0x1d68a3][_0xab63('0x31')];var _0x18c461=_0x366bd9[_0xab63('0x14')][_0x1d68a3][_0xab63('0x1f')];var _0x50b1a2=_0x366bd9[_0xab63('0x3')][_0x18c461][_0xab63('0x2f')];logger[_0xab63('0x17')](_0xab63('0x36'),_0x4d0720,_0x1d68a3);RpcUser[_0xab63('0x26')](this['agents'][_0x1d68a3]['id'])[_0xab63('0x16')](function(_0x52b1da){if(_0x52b1da['pauseType']==='ACW'){return RpcUser['saveUnpause'](_0x366bd9[_0xab63('0x4')][_0x1d68a3]);}});RpcVoiceAgentReport[_0xab63('0x15')]({'acwtime':_0x50b1a2,'agentacw':!![]},_0x4d0720,_0x1d68a3)['then'](function(_0xd15b56){logger[_0xab63('0x17')]('[%s][UPDATE][ACWTIME:%s]',_0x4d0720,_0x50b1a2,_0xd15b56);})[_0xab63('0x19')](function(_0x18bf44){logger[_0xab63('0x1a')](_0xab63('0x1b'),_0x4d0720,_0x18bf44);});}else{logger[_0xab63('0x1a')](_0xab63('0x37'),_0x1d68a3);if(_0x366bd9[_0xab63('0x14')]){logger['info'](_0xab63('0x38'),JSON['stringify'](_0x366bd9[_0xab63('0x14')]));}}}catch(_0x2acf4e){logger[_0xab63('0x1a')](_0xab63('0x39'),_0x2acf4e[_0xab63('0x35')]);}};Acw['prototype'][_0xab63('0x6')]=function(_0x703a3d){try{if(this[_0xab63('0x3')][_0x703a3d[_0xab63('0x1f')]]&&(this[_0xab63('0x3')][_0x703a3d[_0xab63('0x1f')]][_0xab63('0x3a')]||this[_0xab63('0x3')][_0x703a3d[_0xab63('0x1f')]][_0xab63('0x21')])){if(this[_0xab63('0x4')][_0x703a3d[_0xab63('0x1e')]]){this[_0xab63('0x5')][_0x703a3d['uniqueid']]={'queue':_0x703a3d[_0xab63('0x1f')],'interface':_0x703a3d[_0xab63('0x1e')],'destlinkedid':_0x703a3d[_0xab63('0x29')]};}}}catch(_0xedb69e){logger[_0xab63('0x1a')](_0xab63('0x3b'),_0xedb69e['message']);}};Acw[_0xab63('0x1c')][_0xab63('0x10')]=function(_0x255a40){try{if(this[_0xab63('0x3')][_0x255a40[_0xab63('0x1f')]]&&(this['voiceQueues'][_0x255a40[_0xab63('0x1f')]][_0xab63('0x3a')]||this[_0xab63('0x3')][_0x255a40[_0xab63('0x1f')]][_0xab63('0x21')])){if(this[_0xab63('0x4')][_0x255a40[_0xab63('0x1e')]]){this[_0xab63('0x5')][_0x255a40[_0xab63('0x31')]]={'queue':_0x255a40['queue'],'interface':_0x255a40[_0xab63('0x1e')]};}}}catch(_0x44a64b){logger['error'](_0xab63('0x3c'),_0x44a64b['message']);}};Acw[_0xab63('0x1c')][_0xab63('0x3d')]=function(_0x209b9f){try{if(this[_0xab63('0x5')][_0x209b9f['uniqueid']]&&_[_0xab63('0x3e')](this[_0xab63('0x5')][_0x209b9f[_0xab63('0x31')]][_0xab63('0x3f')])){logger[_0xab63('0x17')]('[%s][HANGUP:UNIQUEID]',_0x209b9f[_0xab63('0x31')]);this[_0xab63('0x1d')](_0x209b9f[_0xab63('0x31')]);}else if(this[_0xab63('0x5')][_0x209b9f['linkedid']]&&_['isUndefined'](this['channels'][_0x209b9f[_0xab63('0x40')]][_0xab63('0x3f')])){logger[_0xab63('0x17')]('[%s][HANGUP:LINKEDID]',_0x209b9f[_0xab63('0x40')]);this[_0xab63('0x1d')](_0x209b9f[_0xab63('0x40')]);}}catch(_0x3328c3){logger[_0xab63('0x1a')](_0xab63('0x41'),_0x3328c3[_0xab63('0x35')]);}};Acw[_0xab63('0x1c')][_0xab63('0xa')]=function(_0x38f669){try{if(this['channels'][_0x38f669[_0xab63('0x31')]]&&this[_0xab63('0x5')][_0x38f669[_0xab63('0x31')]][_0xab63('0x3f')]){logger['info'](_0xab63('0x42'),_0x38f669['uniqueid']);this['startAcw'](_0x38f669['uniqueid']);}else if(this['channels'][_0x38f669[_0xab63('0x40')]]&&this[_0xab63('0x5')][_0x38f669[_0xab63('0x40')]]['attended']){logger['info'](_0xab63('0x43'),_0x38f669['linkedid']);this[_0xab63('0x1d')](_0x38f669[_0xab63('0x40')]);}}catch(_0x4b11ee){logger[_0xab63('0x1a')](_0xab63('0x44'),_0x4b11ee[_0xab63('0x35')]);}};Acw[_0xab63('0x1c')]['syncAttendedTransfer']=function(_0x47f6af){try{if(!_[_0xab63('0x45')](this[_0xab63('0x5')][_0x47f6af[_0xab63('0x46')]])){this[_0xab63('0x1d')](_0x47f6af['transfereeuniqueid']);if(this[_0xab63('0x5')][_0x47f6af[_0xab63('0x47')]]){this[_0xab63('0x5')][_0x47f6af[_0xab63('0x47')]][_0xab63('0x3f')]=!![];this[_0xab63('0x5')][_0x47f6af[_0xab63('0x48')]]=this[_0xab63('0x5')][_0x47f6af[_0xab63('0x47')]];this[_0xab63('0x49')](_0x47f6af['secondtransfereruniqueid']);}}else if(!_[_0xab63('0x45')](this[_0xab63('0x5')][_0x47f6af['transfertargetuniqueid']])){this['startAcw'](_0x47f6af[_0xab63('0x48')]);if(this['channels'][_0x47f6af[_0xab63('0x4a')]]){this[_0xab63('0x5')][_0x47f6af[_0xab63('0x4a')]]['attended']=!![];this[_0xab63('0x5')][_0x47f6af[_0xab63('0x46')]]=this[_0xab63('0x5')][_0x47f6af[_0xab63('0x4a')]];this[_0xab63('0x49')](_0x47f6af[_0xab63('0x4a')]);}}}catch(_0xb4f8cf){logger[_0xab63('0x1a')](_0xab63('0x4b'),_0xb4f8cf[_0xab63('0x35')]);}};Acw[_0xab63('0x1c')][_0xab63('0xe')]=function(_0x2a7c1f){try{if(this['channels'][_0x2a7c1f[_0xab63('0x4c')]]){logger['info'](_0xab63('0x4d'),JSON[_0xab63('0x4e')](_0x2a7c1f['transfereruniqueid']));this[_0xab63('0x1d')](_0x2a7c1f['transfereruniqueid']);}else if(this[_0xab63('0x5')][_0x2a7c1f[_0xab63('0x4f')]]){logger[_0xab63('0x17')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xab63('0x4e')](_0x2a7c1f[_0xab63('0x4f')]));this[_0xab63('0x1d')](_0x2a7c1f[_0xab63('0x4f')]);}}catch(_0x2892bd){logger[_0xab63('0x1a')](_0xab63('0x50'),_0x2892bd[_0xab63('0x35')]);}};Acw[_0xab63('0x1c')][_0xab63('0xc')]=function(_0x211e6f){try{if(this[_0xab63('0x3')][_0x211e6f[_0xab63('0x1f')]]&&this[_0xab63('0x3')][_0x211e6f[_0xab63('0x1f')]][_0xab63('0x51')]===_0xab63('0x52')){if(this[_0xab63('0x4')][_0x211e6f[_0xab63('0x1e')]]){logger['info'](_0xab63('0x53'),_0x211e6f['uniqueid'],_0x211e6f['interface'],_0x211e6f['queue']);return RpcUser[_0xab63('0x2a')](this[_0xab63('0x4')][_0x211e6f[_0xab63('0x1e')]],'Auto-Pause',_0x211e6f['uniqueid']);}}}catch(_0x3846ca){logger[_0xab63('0x1a')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x3846ca[_0xab63('0x35')]);}};Acw[_0xab63('0x1c')][_0xab63('0x49')]=function(_0x368acb,_0x1b5d30=0x2710){if(this[_0xab63('0x5')][_0x368acb]){setTimeout(()=>{delete this[_0xab63('0x5')][_0x368acb];},_0x1b5d30);}};module[_0xab63('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 01797bd..f2301c2 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 _0x75c8=['error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionSipPeerStatus','Action','sippeerstatus','actionQueueSummary','queuesummary','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','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','actionDeviceStateList','then','catch','exports','bluebird','util','../../config/environment','port','asterisk','username','password','action'];(function(_0x90c9bd,_0x239952){var _0x33d18b=function(_0x4e0788){while(--_0x4e0788){_0x90c9bd['push'](_0x90c9bd['shift']());}};_0x33d18b(++_0x239952);}(_0x75c8,0x121));var _0x875c=function(_0x1bc294,_0x3121ba){_0x1bc294=_0x1bc294-0x0;var _0x591cef=_0x75c8[_0x1bc294];return _0x591cef;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x875c('0x0'));var util=require(_0x875c('0x1'));var logger=require('../../config/logger')('ami');var config=require(_0x875c('0x2'));var ami=new Manager(config['asterisk'][_0x875c('0x3')],config[_0x875c('0x4')]['ip'],config[_0x875c('0x4')][_0x875c('0x5')],config['asterisk'][_0x875c('0x6')],!![]);ami['keepConnected']();ami['Action']=BPromise['promisify'](ami[_0x875c('0x7')]);function error(_0x1ac9f7){logger[_0x875c('0x8')](util[_0x875c('0x9')](_0x875c('0xa'),config[_0x875c('0x4')]['username'],config[_0x875c('0x4')]['ip'],config[_0x875c('0x4')][_0x875c('0x3')],util['inspect'](_0x1ac9f7,![],null)));}function close(){logger[_0x875c('0x8')](util[_0x875c('0x9')](_0x875c('0xb'),config[_0x875c('0x4')][_0x875c('0x5')],config[_0x875c('0x4')]['ip'],config[_0x875c('0x4')][_0x875c('0x3')]));}ami[_0x875c('0xc')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x875c('0xd')]=function(){return function(){return ami[_0x875c('0xe')]({'action':_0x875c('0xf')});};};ami[_0x875c('0x10')]=function(){return function(){return ami['Action']({'action':_0x875c('0x11')});};};ami[_0x875c('0x12')]=function(){return function(){return ami[_0x875c('0xe')]({'action':_0x875c('0x13')});};};function connect(){logger['info'](util[_0x875c('0x9')](_0x875c('0x14'),config['asterisk'][_0x875c('0x5')],config[_0x875c('0x4')]['ip'],config[_0x875c('0x4')][_0x875c('0x3')]));ami[_0x875c('0x15')]('error',error);ami[_0x875c('0x15')](_0x875c('0x16'),close);}ami['on']('connect',connect);ami['on'](_0x875c('0x17'),function(_0x3bb9f0){logger[_0x875c('0x18')](util['format'](_0x875c('0x19'),config[_0x875c('0x4')][_0x875c('0x5')],config['asterisk']['ip'],config[_0x875c('0x4')][_0x875c('0x3')],util[_0x875c('0x1a')](_0x3bb9f0,![],null)));});ami['on'](_0x875c('0x1b'),function(){logger['info'](util[_0x875c('0x9')](_0x875c('0x1c'),config[_0x875c('0x4')][_0x875c('0x5')],config[_0x875c('0x4')]['ip'],config[_0x875c('0x4')][_0x875c('0x3')]));return Promise['resolve']()['then'](ami[_0x875c('0xc')]())['then'](ami[_0x875c('0x1d')]())[_0x875c('0x1e')](ami[_0x875c('0xd')]())[_0x875c('0x1e')](ami[_0x875c('0x10')]())[_0x875c('0x1e')](ami[_0x875c('0x12')]())[_0x875c('0x1f')](function(_0x182225){logger[_0x875c('0x8')]('[ami.js][fullybooted]',util[_0x875c('0x1a')](_0x182225,{'showHidden':![],'depth':null}));});});ami[_0x875c('0x15')](_0x875c('0x8'),error);ami['once'](_0x875c('0x16'),close);module[_0x875c('0x20')]=ami; \ No newline at end of file +var _0xc564=['info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','inspect','exports','asterisk-manager','bluebird','ami','asterisk','port','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','actionQueueSummary','actionCoreShowChannels','coreshowchannels'];(function(_0x6522af,_0x200962){var _0x39f7de=function(_0x2da9f7){while(--_0x2da9f7){_0x6522af['push'](_0x6522af['shift']());}};_0x39f7de(++_0x200962);}(_0xc564,0xcd));var _0x4c56=function(_0x4ad00c,_0x1dccc7){_0x4ad00c=_0x4ad00c-0x0;var _0x39b511=_0xc564[_0x4ad00c];return _0x39b511;};'use strict';var Manager=require(_0x4c56('0x0'));var BPromise=require(_0x4c56('0x1'));var util=require('util');var logger=require('../../config/logger')(_0x4c56('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0x4c56('0x3')][_0x4c56('0x4')],config[_0x4c56('0x3')]['ip'],config[_0x4c56('0x3')]['username'],config['asterisk'][_0x4c56('0x5')],!![]);ami[_0x4c56('0x6')]();ami[_0x4c56('0x7')]=BPromise['promisify'](ami[_0x4c56('0x8')]);function error(_0x17595e){logger[_0x4c56('0x9')](util[_0x4c56('0xa')](_0x4c56('0xb'),config[_0x4c56('0x3')][_0x4c56('0xc')],config[_0x4c56('0x3')]['ip'],config['asterisk'][_0x4c56('0x4')],util['inspect'](_0x17595e,![],null)));}function close(){logger['error'](util[_0x4c56('0xa')](_0x4c56('0xd'),config['asterisk'][_0x4c56('0xc')],config['asterisk']['ip'],config[_0x4c56('0x3')][_0x4c56('0x4')]));}ami[_0x4c56('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x4c56('0xf')]=function(){return function(){return ami[_0x4c56('0x7')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x4c56('0x7')]({'action':'sippeerstatus'});};};ami[_0x4c56('0x10')]=function(){return function(){return ami[_0x4c56('0x7')]({'action':'queuesummary'});};};ami[_0x4c56('0x11')]=function(){return function(){return ami['Action']({'action':_0x4c56('0x12')});};};function connect(){logger[_0x4c56('0x13')](util[_0x4c56('0xa')](_0x4c56('0x14'),config['asterisk'][_0x4c56('0xc')],config[_0x4c56('0x3')]['ip'],config[_0x4c56('0x3')][_0x4c56('0x4')]));ami[_0x4c56('0x15')](_0x4c56('0x9'),error);ami['once'](_0x4c56('0x16'),close);}ami['on'](_0x4c56('0x17'),connect);ami['on']('shutdown',function(_0xce395a){logger['info'](util[_0x4c56('0xa')](_0x4c56('0x18'),config[_0x4c56('0x3')][_0x4c56('0xc')],config[_0x4c56('0x3')]['ip'],config[_0x4c56('0x3')][_0x4c56('0x4')],util['inspect'](_0xce395a,![],null)));});ami['on'](_0x4c56('0x19'),function(){logger[_0x4c56('0x13')](util[_0x4c56('0xa')](_0x4c56('0x1a'),config[_0x4c56('0x3')][_0x4c56('0xc')],config[_0x4c56('0x3')]['ip'],config[_0x4c56('0x3')][_0x4c56('0x4')]));return Promise[_0x4c56('0x1b')]()['then'](ami[_0x4c56('0xe')]())[_0x4c56('0x1c')](ami[_0x4c56('0xf')]())[_0x4c56('0x1c')](ami['actionSipPeerStatus']())[_0x4c56('0x1c')](ami[_0x4c56('0x10')]())[_0x4c56('0x1c')](ami['actionCoreShowChannels']())[_0x4c56('0x1d')](function(_0x3563d7){logger[_0x4c56('0x9')]('[ami.js][fullybooted]',util[_0x4c56('0x1e')](_0x3563d7,{'showHidden':![],'depth':null}));});});ami['once'](_0x4c56('0x9'),error);ami[_0x4c56('0x15')](_0x4c56('0x16'),close);module[_0x4c56('0x1f')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 896c671..0f25831 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 _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x70e0,0x17b));var _0x070e=function(_0x26570a,_0xf75270){_0x26570a=_0x26570a-0x0;var _0x19a7f7=_0x70e0[_0x26570a];return _0x19a7f7;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x70e0,0x17b));var _0x070e=function(_0x35b649,_0x23d618){_0x35b649=_0x35b649-0x0;var _0x36d6d8=_0x70e0[_0x35b649];return _0x36d6d8;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('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 ad9ef4c..bd54a1b 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 _0x530a=['nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalHitRate','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','getVoiceQueueRtPauses','loggedIn','outboundQueuePauses','agentBusyFactor','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','run','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','getContactDialer','[actionOriginate]\x20','[handlePower]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','checkIsBlackList','[actionOriginatePredictive]','--------\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','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','interval\x20=\x20','exports','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','booked','predictiveCalls','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/agentComplete','./models/hangup','env','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','startPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','debug','error','stack','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','queueStatusComplete','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20deactivated','[ifTime][Action]','Error','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','isTrunkReachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','ifTime','\x20Timezone\x20unknow\x20','length','push','command','iftime\x20%s,%s','interval','content','then','indexOf','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','predictive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueId','uniqueid','ivr','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','decrementOriginate','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','countdropretry','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','stateinterface','queueBooked','idHopper','finally','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','paused','unlockRR','[booked][RR]','pick','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','response','Success','callProgressDetecting','variable','exten','xcally-motion-dialer','dialAMDActive','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','value','MACHINE','outboundAnswerCallsDay','AMD','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','emit','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','[rescheduleContact][Machine]','[syncHangup]','cause-txt','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangup2]','Normal\x20Clearing','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','syncQueueSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','[syncQueueSummary]','queueSummaryCountersUpdated','assign','syncQueueSummaryComplete','filter','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','Action','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','user:%s','launchHandleIvr','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','Trunk','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','dialOriginateCallerIdName','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','substring','dialCutDigit','SIP/%s/%s%s','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][Abandoned]','dialMachineMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x530a,0x81));var _0xa530=function(_0x47a1b7,_0x5ca3ef){_0x47a1b7=_0x47a1b7-0x0;var _0x2d2767=_0x530a[_0x47a1b7];return _0x2d2767;};'use strict';var util=require('util');var _=require(_0xa530('0x0'));var uuid=require(_0xa530('0x1'));var moment=require(_0xa530('0x2'));var rr=require('rr');var Redis=require(_0xa530('0x3'));var utils=require(_0xa530('0x4'));var hopperUtils=require(_0xa530('0x5'));var ut=require('../preview/util/util');var config=require(_0xa530('0x6'));var logger=require(_0xa530('0x7'))('dialer');var loggerBooked=require('../../../config/logger')(_0xa530('0x8'));var loggerPredictive=require(_0xa530('0x7'))('predictive');var loggerPredictiveCalls=require(_0xa530('0x7'))(_0xa530('0x9'));var loggerSyncQueueSummary=require(_0xa530('0x7'))('syncQueueSummary');var ami=require(_0xa530('0xa'));config[_0xa530('0xb')]=_[_0xa530('0xc')](config[_0xa530('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xa530('0xd'))(new Redis(config['redis']));var cmHopper=require(_0xa530('0xe'));var voiceQueueRt=require(_0xa530('0xf'));var RpcSetting=require(_0xa530('0x10'));var Interval=require(_0xa530('0x11'));var Action=require('./models/action');var History=require(_0xa530('0x12'));var Final=require('./models/final');var AgentComplete=require(_0xa530('0x13'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0xa530('0x14'));var ipAgi=process[_0xa530('0x15')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xa530('0x16')][_0xa530('0x17')]=function(_0x31c88a){this[_0xa530('0x18')]=this[_0xa530('0x18')]?this['tail']['finally'](_0x31c88a):_0x31c88a();};function Dialer(_0x5ca62a,_0x27f3d1){this['sequence']=new Sequence();this[_0xa530('0x19')]=_0x27f3d1;this[_0xa530('0x1a')]=_0x5ca62a[_0xa530('0x1a')];this[_0xa530('0x1b')]=_0x5ca62a[_0xa530('0x1b')];this[_0xa530('0x1c')]=_0x5ca62a[_0xa530('0x1c')];this[_0xa530('0x1d')]=_0x5ca62a['trunks'];this[_0xa530('0x1e')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0xa530('0x1f')]={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this[_0xa530('0x20')]={};this[_0xa530('0x21')]={};this[_0xa530('0x22')]={};this['queueBooked']={};this[_0xa530('0x23')]={};this[_0xa530('0x24')]={};ami['on'](_0xa530('0x25'),this['syncAgentConnect'][_0xa530('0x26')](this));ami['on'](_0xa530('0x27'),this[_0xa530('0x28')][_0xa530('0x26')](this));ami['on'](_0xa530('0x29'),this[_0xa530('0x2a')][_0xa530('0x26')](this));ami['on'](_0xa530('0x2b'),this[_0xa530('0x2c')][_0xa530('0x26')](this));ami['on'](_0xa530('0x2d'),this['syncQueueSummary'][_0xa530('0x26')](this));ami['on'](_0xa530('0x2e'),this['syncQueueSummaryComplete'][_0xa530('0x26')](this));ami['on']('hangup',this[_0xa530('0x2f')][_0xa530('0x26')](this));ami['on'](_0xa530('0x30'),this[_0xa530('0x31')][_0xa530('0x26')](this));ami['on'](_0xa530('0x32'),this[_0xa530('0x33')][_0xa530('0x26')](this));ami['on'](_0xa530('0x34'),this[_0xa530('0x35')]['bind'](this));ami['on'](_0xa530('0x36'),this[_0xa530('0x37')][_0xa530('0x26')](this));this[_0xa530('0x38')]();this[_0xa530('0x39')]();RpcSetting[_0xa530('0x3a')]()['then'](function(_0x124534){previewRecallmeReminderInterval=_0x124534[_0xa530('0x3b')];});}function isNotNull(_0x5d4fad){return _0x5d4fad!==null&&!_[_0xa530('0x3c')](_0x5d4fad);}function msgResponse(_0xd86a0e,_0x333aed,_0x2c69c2){return{'action':_0xd86a0e,'response':_0x333aed,'message':_0x2c69c2,'stack':_0x2c69c2};}function emit(_0x579e99,_0x4798a2,_0x43d8cd){io['to'](_0x579e99)['emit'](_0x4798a2,_0x43d8cd);}function emitOutboundVoiceQueueSummary(_0x56e571){if(_0x56e571[_0xa530('0x3d')]===_0xa530('0x3e')){logger['debug'](_0xa530('0x3f'),util[_0xa530('0x40')](_0x56e571,{'showHidden':![],'depth':null}));emit(util['format'](_0xa530('0x41'),_0x56e571[_0xa530('0x42')]),_0xa530('0x43'),_0x56e571);}}function checkGetDataPredictive(_0x3c9035){if(isNotNull(_0x3c9035)&&!_[_0xa530('0x44')](_0x3c9035)){loggerPredictive[_0xa530('0x45')](_0xa530('0x46'));loggerPredictive[_0xa530('0x45')](_0xa530('0x47'),_0x3c9035[_0xa530('0x48')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x49'),_0x3c9035['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xa530('0x45')](_0xa530('0x4a'),_0x3c9035[_0xa530('0x4b')]);loggerPredictive['info'](_0xa530('0x4c'),_0x3c9035[_0xa530('0x4d')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x4e'),_0x3c9035['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xa530('0x45')](_0xa530('0x4f'),_0x3c9035[_0xa530('0x50')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x51'));if(_0x3c9035[_0xa530('0x48')]>0x0){if(!_['isUndefined'](_0x3c9035[_0xa530('0x50')])&&_0x3c9035[_0xa530('0x50')]>0x0){return!![];}loggerPredictive[_0xa530('0x45')](_0xa530('0x52'));if(!_[_0xa530('0x3c')](_0x3c9035['predictiveIntervalAvgHoldtime'])&&_0x3c9035[_0xa530('0x53')]>0x0){return!![];}loggerPredictive[_0xa530('0x45')](_0xa530('0x54'));}else{loggerPredictive['info'](_0xa530('0x55'));}}else{loggerPredictive[_0xa530('0x45')](_0xa530('0x56'));}return![];}function mergeDataErlangB(_0x62c765){return function(_0x19ede2){loggerPredictive[_0xa530('0x45')](_0xa530('0x57'));loggerPredictive[_0xa530('0x45')](_0xa530('0x58'),_0x19ede2[_0xa530('0x59')]);loggerPredictive[_0xa530('0x45')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19ede2[_0xa530('0x5a')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x5b'),_0x19ede2[_0xa530('0x5c')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x5d'),_0x19ede2['erlangBusyFactor']);loggerPredictive[_0xa530('0x45')](_0xa530('0x5b'),_0x19ede2[_0xa530('0x5c')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x51'));_[_0xa530('0x5e')](_0x62c765,_0x19ede2);};}function ifInterval(_0x2546a0,_0x3e3f74){if(_['isUndefined'](_0x3e3f74)){return![];}return utils[_0xa530('0x5f')](undefined,_0x3e3f74)<_0x2546a0*0x3c;}function clearPredictiveAttributes(_0x20e54f){if(_0x20e54f[_0xa530('0x21')]){_0x20e54f['startProgressive']=undefined;loggerPredictive['debug'](_0x20e54f[_0xa530('0x42')],_0xa530('0x60'));}if(_0x20e54f[_0xa530('0x20')]){_0x20e54f['startPredictive']=undefined;loggerPredictive['debug'](_0x20e54f[_0xa530('0x42')],_0xa530('0x61'));}if(_0x20e54f[_0xa530('0x62')]){clearInterval(_0x20e54f[_0xa530('0x62')]);_0x20e54f[_0xa530('0x62')]=undefined;loggerPredictive[_0xa530('0x63')](_0x20e54f['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x5009d4,_0x474439){return function(_0x356548){loggerPredictive[_0xa530('0x64')](_0x474439[_0xa530('0x42')],_0x5009d4);loggerPredictive[_0xa530('0x64')](_0x356548[_0xa530('0x65')]);clearPredictiveAttributes(_0x474439);};}function loggerCatch(_0x2b9b22){return function(_0x36a4a4){logger[_0xa530('0x64')](_0x2b9b22,util[_0xa530('0x40')](_0x36a4a4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x281bc3){return function(_0xb9a906){if(isNotNull(_0xb9a906)&&isNotNull(_0xb9a906[0x0])){if(_0xb9a906[0x0][_0xa530('0x66')]>0x0){_0x281bc3[_0xa530('0x67')]=utils['CAMPAIGN_STATUS'][_0xa530('0x68')];logger[_0xa530('0x45')](_0xa530('0x69')+_0x281bc3[_0xa530('0x42')],_0xb9a906[0x0][_0xa530('0x66')],_0xa530('0x6a'));}else{_0x281bc3[_0xa530('0x67')]=utils[_0xa530('0x6b')][_0xa530('0x6c')];logger[_0xa530('0x45')]('[getContactDialer2][Empty]'+_0x281bc3[_0xa530('0x42')]);}}};}function createObjHistory(_0x29adc0,_0x39b625,_0x1ad448,_0x3062c5,_0x2c4595){_0x29adc0[_0xa530('0x67')]=_0x1ad448;var _0x200dbc=new Action(_0x29adc0,_0x39b625);var _0x345ee4=new History(_0x200dbc);_0x345ee4[_0xa530('0x6d')]=_0x3062c5;_0x345ee4[_0xa530('0x6e')]=_0x2c4595;_0x345ee4[_0xa530('0x6f')]=_0x200dbc['starttime'];return _0x345ee4;}function unlockQueueStatus(_0x17ef6b,_0x281f69){setTimeout(function(){if(_['isUndefined'](_0x17ef6b['queueStatusComplete'])){loggerBooked[_0xa530('0x64')](_0xa530('0x70'),_0x281f69);}_0x17ef6b['queueStatusComplete']=!![];loggerBooked['info'](_0xa530('0x71'),_0x281f69,JSON[_0xa530('0x72')](_['pick'](_0x17ef6b,[_0xa530('0x42'),_0xa530('0x73')])));},0x1f3);}function checkInterval(_0x831fe1){return function(){if(!isNotNull(_0x831fe1[_0xa530('0x74')])){_0x831fe1['message']=utils['CAMPAIGN_STATUS'][_0xa530('0x75')];throw _0x831fe1[_0xa530('0x42')]+_0xa530('0x76');}if(!isNotNull(_0x831fe1['Interval']['Intervals'])){_0x831fe1[_0xa530('0x67')]=utils['CAMPAIGN_STATUS'][_0xa530('0x75')];throw _0x831fe1[_0xa530('0x42')]+_0xa530('0x76');}if(!isNotNull(_[_0xa530('0x44')](_0x831fe1[_0xa530('0x74')][_0xa530('0x77')]))){_0x831fe1['message']=utils[_0xa530('0x6b')][_0xa530('0x75')];throw _0x831fe1[_0xa530('0x42')]+_0xa530('0x76');}};}function checkIsIVRCampaignActive(_0x2f14cd){return function(){if(!utils['isIVRCampaignActive'](_0x2f14cd)){_0x2f14cd[_0xa530('0x67')]=utils[_0xa530('0x6b')][_0xa530('0x78')];throw _0x2f14cd[_0xa530('0x42')]+_0xa530('0x79');}};}function emitCampaignSummary(_0x5e2e65){if(utils[_0xa530('0x7a')](_0x5e2e65)){emit(util[_0xa530('0x7b')](_0xa530('0x7c'),_0x5e2e65[_0xa530('0x42')]),_0xa530('0x7d'),_0x5e2e65);}}function loggerCatchQueueSummary(_0x1d199c,_0x454ce0){return function(_0x31ec9a){clearPredictiveAttributes(_0x454ce0);emitCampaignSummary(_0x454ce0);loggerSyncQueueSummary[_0xa530('0x63')](_0x1d199c,util[_0xa530('0x40')](_0x31ec9a,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x272710){if(_0x272710[_0xa530('0x7e')]){if(_0x272710[_0xa530('0x7f')]===0x0){_0x272710[_0xa530('0x7e')]=![];_0x272710[_0xa530('0x67')]=utils['CAMPAIGN_STATUS'][_0xa530('0x78')];loggerSyncQueueSummary[_0xa530('0x63')](_0xa530('0x80'),_0x272710['name'],'is\x20not\x20active');}else{_0x272710['message']=utils[_0xa530('0x6b')]['DISACTIVED'];loggerSyncQueueSummary['debug'](_0xa530('0x80'),_0x272710['name'],_0xa530('0x81'));}emitCampaignSummary(_0x272710);}}function myreject(_0x580356){return function(_0x4a6981){return _0x580356(msgResponse(_0xa530('0x82'),_0xa530('0x83'),JSON[_0xa530('0x72')](_0x4a6981)));};}Dialer[_0xa530('0x16')]['isTrunkReachable']=function(_0x5c75b5){return!_[_0xa530('0x3c')](_0x5c75b5)&&_0x5c75b5&&!_[_0xa530('0x3c')](_0x5c75b5[_0xa530('0x42')])&&!_[_0xa530('0x3c')](_0x5c75b5['active'])&&_0x5c75b5[_0xa530('0x84')]&&(this[_0xa530('0x1d')][util['format'](_0xa530('0x85'),_0x5c75b5['name'])][_0xa530('0x86')]===_0xa530('0x87')||this['trunks'][util[_0xa530('0x7b')](_0xa530('0x85'),_0x5c75b5[_0xa530('0x42')])][_0xa530('0x86')]===_0xa530('0x88'));};Dialer[_0xa530('0x16')][_0xa530('0x89')]=function(_0x18febe){var _0x4ca799=this;return function(){if(!_0x4ca799['isTrunkReachable'](_0x18febe['Trunk'])){if(!_0x4ca799[_0xa530('0x8a')](_0x18febe['TrunkBackup'])){_0x18febe[_0xa530('0x67')]=utils[_0xa530('0x6b')]['TRUNK_NOT_REACHABLE'];throw _0x18febe[_0xa530('0x42')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0xa530('0x8b')]=function(_0x529517,_0x981af,_0x380308,_0x561837){var _0x5ad7c3=this;return function(){var _0x3de147=!![];return _0x5ad7c3['ifTimeIvr'](_0x529517,_0x981af,_0x380308,_0x561837,_0x3de147);};};Dialer['prototype'][_0xa530('0x8c')]=function(_0x3e5d22,_0x5ddaa7,_0x51b681,_0x4e6edc){var _0x492fb3=this;return function(){var _0x317320=![];return _0x492fb3[_0xa530('0x8d')](_0x3e5d22[_0xa530('0x77')],_0x5ddaa7,_0x51b681,_0x4e6edc,_0x317320);};};Dialer[_0xa530('0x16')][_0xa530('0x8d')]=function(_0x49a92f,_0x523090,_0x3e03fc,_0x382677,_0x2c9c68){var _0x13cac1=[];return new Promise(function(_0x4869b0,_0x470c0b){if(!isNotNull(_0x49a92f)){_0x382677['message']=utils['CAMPAIGN_STATUS'][_0xa530('0x75')];return _0x470c0b(msgResponse('ifTime',_0xa530('0x8e'),_0x3e03fc+_0xa530('0x8f')));}if(_[_0xa530('0x44')](_0x49a92f)){_0x382677[_0xa530('0x67')]=utils[_0xa530('0x6b')][_0xa530('0x90')];return _0x470c0b(msgResponse('ifTime',_0xa530('0x8e'),_0x3e03fc+_0xa530('0x91')));}if(_0x523090&&_[_0xa530('0x3c')](config[_0xa530('0x92')][_0x523090])){_0x382677['message']=utils['CAMPAIGN_STATUS'][_0xa530('0x93')];return _0x470c0b(msgResponse(_0xa530('0x94'),'Failure',_0x3e03fc+_0xa530('0x95')+_0x523090));}if(_['isArray'](_0x49a92f)){for(var _0xbd4fa6=0x0;_0xbd4fa6<_0x49a92f[_0xa530('0x96')];_0xbd4fa6+=0x1){_0x13cac1[_0xa530('0x97')](ami['Action']({'action':_0xa530('0x98'),'command':util['format'](_0xa530('0x99'),_0x49a92f[_0xbd4fa6][_0xa530('0x9a')],!_[_0xa530('0x3c')](config[_0xa530('0x92')][_0x523090])?_0x523090:'')})['then'](function(_0x5869d1){return _0x5869d1[_0xa530('0x9b')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x470c0b)));}}else{_0x13cac1[_0xa530('0x97')](ami['Action']({'action':'command','command':util[_0xa530('0x7b')](_0xa530('0x99'),_0x49a92f,!_[_0xa530('0x3c')](config['timezones'][_0x523090])?_0x523090:'')})[_0xa530('0x9c')](function(_0x144cf0){return _0x144cf0['content'][_0xa530('0x9d')](_0xa530('0x9e'))>=0x0;})[_0xa530('0x9f')](myreject(_0x470c0b)));}Promise[_0xa530('0xa0')](_0x13cac1)['then'](function(_0x45ad26){var _0x16b21a=_[_0xa530('0xa1')](_0x45ad26);if(_0x16b21a){return _0x4869b0(_0x16b21a);}else{_0x382677[_0xa530('0x67')]=_0x2c9c68?utils['CAMPAIGN_STATUS'][_0xa530('0xa2')]:utils[_0xa530('0x6b')][_0xa530('0xa3')];return _0x470c0b(msgResponse(_0xa530('0xa4'),_0xa530('0x8e'),_0xa530('0xa5')+_0x2c9c68+'\x20'+_0x3e03fc+_0xa530('0xa6')+util['inspect'](_0x49a92f,{'showHidden':![],'depth':null})+_0xa530('0xa7')+_0x523090));}})[_0xa530('0x9f')](function(_0x121033){return _0x470c0b(msgResponse(_0xa530('0x94'),_0xa530('0x8e'),JSON['stringify'](_0x121033)));});});};Dialer[_0xa530('0x16')][_0xa530('0x38')]=function(){var _0x478426=this;return cmHopper[_0xa530('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0xa530('0x9c')](function(){setInterval(function(){_0x478426[_0xa530('0xa9')]();},0x3e8);});};Dialer[_0xa530('0x16')]['syncCampaigns']=function(){var _0x52069d=this;var _0x4e72eb;for(var _0x5597fc in this['campaigns']){if(typeof this['campaigns'][_0x5597fc]!==_0xa530('0xaa')){_0x4e72eb=this['campaigns'][_0x5597fc];if(utils[_0xa530('0x7a')](_0x4e72eb)&&utils['isIVRCampaignActive'](_0x4e72eb)){_0x4e72eb[_0xa530('0x7e')]=!![];Promise['resolve']()[_0xa530('0x9c')](checkIsIVRCampaignActive(_0x4e72eb))[_0xa530('0x9c')](checkInterval(_0x4e72eb))['then'](_0x52069d[_0xa530('0x89')](_0x4e72eb))[_0xa530('0x9c')](_0x52069d[_0xa530('0x8b')](_0x4e72eb[_0xa530('0xab')],_0x4e72eb[_0xa530('0xac')],_0x4e72eb[_0xa530('0x42')],_0x4e72eb))[_0xa530('0x9c')](_0x52069d[_0xa530('0x8c')](_0x4e72eb[_0xa530('0x74')],_0x4e72eb[_0xa530('0xac')],_0x4e72eb[_0xa530('0x42')],_0x4e72eb))[_0xa530('0x9c')](_0x52069d['launchHandleIvr'](_0x4e72eb))[_0xa530('0x9f')](loggerCatchQueueSummary(_0xa530('0xad'),_0x4e72eb));}else{notSendMessagesCampaign(_0x4e72eb);}}}};Dialer[_0xa530('0x16')][_0xa530('0xae')]=function(_0x303a09){if(_0x303a09[_0xa530('0xaf')]!==_0xa530('0xb0')){clearPredictiveAttributes(_0x303a09);}switch(_0x303a09[_0xa530('0xaf')]){case'progressive':this[_0xa530('0xb1')](_0x303a09,0x1);break;case _0xa530('0xb2'):this[_0xa530('0xb1')](_0x303a09,_0x303a09[_0xa530('0xb3')]);break;case'predictive':this['predictive'](_0x303a09);break;case _0xa530('0x8'):this['handlePower'](_0x303a09,0x1);break;default:logger[_0xa530('0x64')](_0xa530('0xb4'),_0x303a09['name'],_0xa530('0xb5'));}};Dialer['prototype'][_0xa530('0x94')]=function(_0x551db0,_0x1751ff){var _0x206a24=_0x551db0[_0xa530('0xac')];var _0x8a49f4=_0x1751ff?_0x551db0[_0xa530('0xab')]:_0x551db0[_0xa530('0x74')][_0xa530('0x77')];logger[_0xa530('0xb6')]('Dialer::ifTime()',_0x8a49f4,_0x206a24,_0x551db0[_0xa530('0x42')],util[_0xa530('0x7b')](_0xa530('0xb7'),_0x551db0[_0xa530('0x42')],_0x551db0['id']));var _0xe2ac01=null;return Interval['intervalIftime'](_0x8a49f4,_0x206a24)[_0xa530('0x9c')](function(_0x4c23a0){if(_0x4c23a0===!![]){return _0x4c23a0;}else{_0x551db0[_0xa530('0x67')]=_0x1751ff?utils[_0xa530('0x6b')][_0xa530('0xa2')]:utils[_0xa530('0x6b')][_0xa530('0xa3')];_0xe2ac01=msgResponse(_0xa530('0xa4'),_0xa530('0x8e'),'Global:\x20'+_0x1751ff+'\x20'+_0x551db0[_0xa530('0x42')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0xa530('0x40')](_0x8a49f4,{'showHidden':![],'depth':null})+_0xa530('0xa7')+_0x206a24);}if(_0xe2ac01!==null){logger[_0xa530('0xb6')](_0xa530('0xb8'),_0xe2ac01);_0xe2ac01[_0xa530('0xb9')]=_0x1751ff;throw _0xe2ac01;}})[_0xa530('0x9f')](function(_0x2d7f34){logger[_0xa530('0x64')](_0xa530('0xba'),_0x2d7f34);throw msgResponse(_0xa530('0x82'),_0xa530('0x83'),util[_0xa530('0x40')](_0x2d7f34,{'showHidden':![],'depth':null}));});};Dialer[_0xa530('0x16')][_0xa530('0xbb')]=function(_0x2baeaf){if(this[_0xa530('0x1a')][_0x2baeaf[_0xa530('0xbc')]]){if(this[_0xa530('0xbd')][_0x2baeaf[_0xa530('0xbe')]]&&this[_0xa530('0xbd')][_0x2baeaf[_0xa530('0xbe')]]['type']!==_0xa530('0xbf')){utils['decrementOriginate'](this[_0xa530('0x1a')][_0x2baeaf[_0xa530('0xbc')]],_0xa530('0xc0'));this[_0xa530('0xbd')][_0x2baeaf[_0xa530('0xbe')]][_0xa530('0xc1')]=moment()[_0xa530('0x7b')](_0xa530('0xc2'));}}};Dialer[_0xa530('0x16')][_0xa530('0x2c')]=function(_0x5570a6){var _0x57e968=this[_0xa530('0xbd')][_0x5570a6[_0xa530('0xbe')]];if(this[_0xa530('0x1a')][_0x5570a6[_0xa530('0xbc')]]){if(_0x57e968&&_0x57e968[_0xa530('0x3d')]!==_0xa530('0xbf')){delete this['uniqueId'][_0x5570a6[_0xa530('0xbe')]];this[_0xa530('0x1a')][_0x5570a6[_0xa530('0xbc')]]['outboundAnswerCallsDay']+=0x1;var _0x4ed67a=new AgentComplete(_0x57e968,_0x5570a6);if(_0x5570a6[_0xa530('0xc3')]===_0xa530('0xc4')){_0x4ed67a[_0xa530('0xc5')]=this[_0xa530('0x1a')][_0x5570a6[_0xa530('0xbc')]][_0xa530('0xc6')]&&this[_0xa530('0x1a')][_0x5570a6['queue']][_0xa530('0xc7')]?moment()[_0xa530('0x7b')](_0xa530('0xc2')):undefined;}hopperUtils[_0xa530('0xc8')](_0x4ed67a)[_0xa530('0x9f')](loggerCatch(_0xa530('0xc9')));hopperUtils[_0xa530('0xca')](_0x4ed67a)[_0xa530('0x9f')](loggerCatch(_0xa530('0xcb')));}}};Dialer[_0xa530('0x16')][_0xa530('0x28')]=function(_0x266c5f){var _0x3c63f2=this['uniqueId'][_0x266c5f['uniqueid']];var _0x29b77a=this;var _0x1772ec=![];var _0x4ea4aa;var _0x3f8e7d;if(this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]]){if(_0x3c63f2&&_0x3c63f2['type']!=='ivr'){delete this[_0xa530('0xbd')][_0x266c5f[_0xa530('0xbe')]];utils[_0xa530('0xcc')](this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]],_0xa530('0xcd'));_0x3c63f2[_0xa530('0xce')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x3b8947=new QueueCallerAbandon(_0x3c63f2,_0x266c5f);if(utils[_0xa530('0x5f')](_0x3c63f2[_0xa530('0xce')],_0x3c63f2[_0xa530('0xcf')])>=_0x3c63f2[_0xa530('0xd0')]){this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xa530('0x1a')][_0x266c5f['queue']][_0xa530('0xd1')]+=0x1;this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x3b8947[_0xa530('0x6d')]=0xa;_0x3b8947[_0xa530('0x6e')]=_0xa530('0xd2');_0x3b8947[_0xa530('0xd3')]=_0xa530('0xd4');_0x3b8947[_0xa530('0xc5')]=this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xc6')]?moment()[_0xa530('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x3b8947[_0xa530('0xd5')]+=0x1;_0x3b8947['countglobal']+=0x1;_0x4ea4aa=this['voiceQueues'][_0x266c5f[_0xa530('0xbc')]]['dialDropRetryFrequency'];_0x3f8e7d=this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xd6')];hopperUtils[_0xa530('0xd7')](_0x3b8947,_0x3b8947[_0xa530('0x6d')],_0x3c63f2[_0xa530('0xd8')])[_0xa530('0x9c')](function(_0x24ab6a){_0x1772ec=_0x24ab6a[_0xa530('0xd9')]==0x1;if(_0x3b8947[_0xa530('0xd5')]>=_0x29b77a['voiceQueues'][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xda')]){_0x29b77a[_0xa530('0xdb')](_0x3b8947,_0x24ab6a[_0xa530('0xd9')]);}else{hopperUtils[_0xa530('0xdc')]({'active':![],'countdropretry':_0x3b8947[_0xa530('0xd5')],'scheduledat':moment()[_0xa530('0xdd')](_0x29b77a[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xde')],_0xa530('0xdf'))[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x3c63f2[_0xa530('0xe0')],'ListId':_0x3c63f2[_0xa530('0xe1')],'VoiceQueueId':_0x3c63f2[_0xa530('0xe2')]||undefined,'CampaignId':_0x3c63f2[_0xa530('0xe3')]||undefined})['catch'](loggerCatch(_0xa530('0xe4')));var _0x2308b5=new History(_0x3b8947);_0x2308b5['state']=0xa;_0x2308b5[_0xa530('0x6e')]=_0xa530('0xd2');_0x2308b5[_0xa530('0xe5')]=moment()[_0xa530('0x7b')](_0xa530('0xc2'));_0x2308b5[_0xa530('0x6f')]=_0x2308b5[_0xa530('0xe5')];_0x2308b5['calleridname']=_0x3b8947[_0xa530('0xe6')];_0x2308b5['calleridnum']=_0x3b8947[_0xa530('0xe7')];hopperUtils[_0xa530('0xc8')](_0x2308b5)['catch'](loggerCatch(_0xa530('0xe8')));}})[_0xa530('0x9c')](function(){if(_0x1772ec)hopperUtils[_0xa530('0xe9')](_0x3b8947,_0x4ea4aa,_0x3f8e7d)['then'](function(){return 0x1;});});}else{this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0x4d')]+=0x1;this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xea')]+=0x1;_0x3b8947['state']=0xb;_0x3b8947[_0xa530('0x6e')]=_0xa530('0xeb');_0x3b8947[_0xa530('0xd3')]=_0xa530('0xec');_0x3b8947[_0xa530('0xed')]+=0x1;_0x3b8947[_0xa530('0xee')]+=0x1;_0x4ea4aa=this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xef')];_0x3f8e7d=this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xd6')];hopperUtils[_0xa530('0xd7')](_0x3b8947,_0x3b8947[_0xa530('0x6d')],_0x3c63f2[_0xa530('0xd8')])[_0xa530('0x9c')](function(_0x41d251){if(_0x3b8947[_0xa530('0xed')]>=_0x29b77a['voiceQueues'][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xf0')]){_0x29b77a[_0xa530('0xdb')](_0x3b8947,_0x41d251[_0xa530('0xd9')]);}else{hopperUtils[_0xa530('0xdc')]({'active':![],'countabandonedretry':_0x3b8947[_0xa530('0xed')],'scheduledat':moment()['add'](_0x29b77a[_0xa530('0x1a')][_0x266c5f['queue']][_0xa530('0xef')],_0xa530('0xdf'))[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x3c63f2[_0xa530('0xe0')],'ListId':_0x3c63f2[_0xa530('0xe1')],'VoiceQueueId':_0x3c63f2[_0xa530('0xe2')]||undefined,'CampaignId':_0x3c63f2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4c2921=new History(_0x3b8947);_0x4c2921[_0xa530('0x6d')]=0xb;_0x4c2921[_0xa530('0x6e')]=_0xa530('0xeb');_0x4c2921[_0xa530('0xe5')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4c2921[_0xa530('0x6f')]=_0x4c2921[_0xa530('0xe5')];_0x4c2921[_0xa530('0xe6')]=_0x3b8947[_0xa530('0xe6')];_0x4c2921['calleridnum']=_0x3b8947[_0xa530('0xe7')];hopperUtils[_0xa530('0xc8')](_0x4c2921)[_0xa530('0x9f')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xa530('0x9c')](function(){if(_0x1772ec)hopperUtils['swapAdditionalPhones'](_0x3b8947,_0x4ea4aa,_0x3f8e7d)[_0xa530('0x9c')](function(){return 0x1;});});}}}};Dialer[_0xa530('0x16')][_0xa530('0x31')]=function(_0x36b881){if(this[_0xa530('0x1f')][_0x36b881['uniqueid']]){this[_0xa530('0x1f')][_0x36b881[_0xa530('0xbe')]][_0xa530('0xf1')]=_0x36b881['channel'];}if(this['uniqueId'][_0x36b881[_0xa530('0xbe')]]){this[_0xa530('0xbd')][_0x36b881[_0xa530('0xbe')]][_0xa530('0xf1')]=_0x36b881[_0xa530('0xf1')];}};Dialer[_0xa530('0x16')]['syncQueueMember']=function(_0x53a0dd){if(!this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]]){return;}var _0x188be2=this['voiceQueues'][this['actions'][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xbc')]][_0xa530('0xf3')]||_0xa530('0xf4');if(_0x188be2===_0xa530('0xf5')){if(this['actions'][_0x53a0dd[_0xa530('0xf2')]]&&_[_0xa530('0xf6')](this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xf7')])&&_0x53a0dd['status']==='1'&&_0x53a0dd['paused']==='0'){if(this[_0xa530('0x1c')][_0x53a0dd[_0xa530('0xf8')]]){if(!this['agents'][_0x53a0dd[_0xa530('0xf8')]]['locked']){this['agents'][_0x53a0dd[_0xa530('0xf8')]][_0xa530('0xf7')]=!![];this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xf7')]=!![];this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xf8')]=_0x53a0dd[_0xa530('0xf8')];}}}}else if(_0x188be2===_0xa530('0xf4')){if(this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]]){if(this['agents'][_0x53a0dd[_0xa530('0xf8')]]){this['actions'][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xf8')]=_0x53a0dd[_0xa530('0xf8')];if(_['isNil'](this[_0xa530('0xf9')][this['actions'][_0x53a0dd['actionid']][_0xa530('0xbc')]])){this['queueBooked'][this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xbc')]]=[];}this[_0xa530('0xf9')][this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xbc')]][_0xa530('0x97')](_['merge'](_['pick'](this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]],[_0xa530('0xfa'),_0xa530('0xf8')]),{'status':_0x53a0dd[_0xa530('0x86')],'paused':_0x53a0dd['paused']}));}}}};Dialer[_0xa530('0x16')]['syncQueueStatusComplete']=function(_0x514155){if(!this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]]){return;}var _0x565b5d=this;var _0x4f861f=this[_0xa530('0x1a')][this['actions'][_0x514155[_0xa530('0xf2')]]['queue']];var _0x3f0cd6=_0x4f861f[_0xa530('0xf3')]||'rrmemory';if(_0x3f0cd6===_0xa530('0xf5')){if(this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]]&&this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xf8')]){this[_0xa530('0x19')]['run'](this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xfa')],this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xf8')])['catch'](function(_0x5241ef){logger[_0xa530('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xa530('0x40')](_0x5241ef,{'showHidden':![],'depth':null}));})[_0xa530('0xfb')](function(){utils[_0xa530('0xcc')](_0x565b5d[_0xa530('0x1a')][_0x565b5d[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]],_0xa530('0xfc'));_0x565b5d[_0xa530('0x1c')][_0x565b5d[_0xa530('0x1f')][_0x514155['actionid']][_0xa530('0xf8')]][_0xa530('0xf7')]=![];delete _0x565b5d['actions'][_0x514155['actionid']];unlockQueueStatus(_0x4f861f);});}else{utils[_0xa530('0xcc')](this[_0xa530('0x1a')][this[_0xa530('0x1f')][_0x514155['actionid']][_0xa530('0xbc')]],_0xa530('0xfc'));hopperUtils[_0xa530('0xdc')]({'active':![],'ContactId':this[_0xa530('0x1f')][_0x514155['actionid']]['ContactId'],'ListId':this[_0xa530('0x1f')][_0x514155['actionid']]['ListId'],'VoiceQueueId':this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xe2')]||undefined,'CampaignId':this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0xfd')));delete this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]];unlockQueueStatus(_0x4f861f);}}else if(_0x3f0cd6===_0xa530('0xf4')){var _0xfc7c18;if(this['actions'][_0x514155[_0xa530('0xf2')]]&&!_[_0xa530('0x44')](this['queueBooked'][this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]])){if(this[_0xa530('0x23')][_0x565b5d[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]]['queue']]){this[_0xa530('0x23')][_0x565b5d[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]]=this['queueBookedRR'][this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]]?this[_0xa530('0x23')][this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]]:this['queueBooked'][this[_0xa530('0x1f')][_0x514155['actionid']][_0xa530('0xbc')]]?this[_0xa530('0xf9')][this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]][_0xa530('0xfe')]||0x0:0x0;}this[_0xa530('0xf9')][this['actions'][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]][_0xa530('0xfe')]=this['queueBookedRR'][this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]];for(var _0x228dfe=0x0;_0x228dfe=_0x5b5516[_0xa530('0x126')]){_0x41d187[_0xa530('0x127')](_0x23eda3,_0x1cf858,_0x157803,_0xa530('0x128'));}else{if(_0x23eda3[_0xa530('0x120')]>=_0x5b5516['dialMachineMaxRetry']){_0x41d187[_0xa530('0x129')](_0x23eda3,_0x1cf858,_0x157803,_0xa530('0x12a'));}else{hopperUtils[_0xa530('0xdc')]({'active':![],'countmachineretry':_0x23eda3[_0xa530('0x120')],'scheduledat':moment()[_0xa530('0xdd')](_0x5b5516[_0xa530('0x12b')],_0xa530('0xdf'))[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x23eda3['ContactId'],'ListId':_0x23eda3['ListId'],'VoiceQueueId':_0x23eda3['VoiceQueueId']||undefined,'CampaignId':_0x23eda3[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch('[rescheduleContact][Machine]'));_0x1cf858({'reschedule':0x1});}}});}if(_0x4bcf46['type']===_0xa530('0xbf')&&this[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]][_0xa530('0x111')]&&_0x5e3121[_0xa530('0x11c')]==='HANGUP'){delete this['uniqueId'][_0x5e3121[_0xa530('0xbe')]];utils[_0xa530('0xcc')](this[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]],_0xa530('0x113'));_0x30b680=new Hangup(_0x4bcf46,_0x5e3121);_0x30b680[_0xa530('0x6d')]=0x12;_0x30b680[_0xa530('0x6e')]=_0xa530('0x115');_0x30b680[_0xa530('0x116')]=_0xa530('0x11f');ami[_0xa530('0x12c')](_0xa530('0x117'),ut[_0xa530('0x118')](_0x30b680,_0xa530('0x119')));this[_0xa530('0x11a')](_0x30b680,_0xa530('0x12d'),_0xa530('0x12e'));}if(_0x4bcf46['type']==='ivr'&&this[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]][_0xa530('0x111')]&&_0x5e3121[_0xa530('0x11c')]===_0xa530('0x11d')){return new Promise(function(_0x12af1d,_0x1ecc38){delete _0x41d187[_0xa530('0xbd')][_0x5e3121[_0xa530('0xbe')]];utils['decrementOriginate'](_0x41d187[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]],_0xa530('0x113'));_0x41d187[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]]['outboundAnswerCallsDay']+=0x1;_0x41d187[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]][_0xa530('0x114')]+=0x1;var _0x5d0450=_0x41d187['campaigns'][_0x4bcf46[_0xa530('0xbc')]];var _0x14ac5a=new Hangup(_0x4bcf46,_0x5e3121);_0x14ac5a['state']=0x13;_0x14ac5a[_0xa530('0x6e')]='Machine';_0x14ac5a[_0xa530('0x116')]=_0xa530('0x11f');_0x14ac5a[_0xa530('0x120')]+=0x1;_0x14ac5a['countglobal']+=0x1;_0x14ac5a[_0xa530('0x119')]=!![];ami[_0xa530('0x12c')]('custom:amd',ut[_0xa530('0x118')](_0x14ac5a,'amd'));hopperUtils[_0xa530('0xc8')](_0x14ac5a)[_0xa530('0x9f')](loggerCatch(_0xa530('0x12f')));if(_0x14ac5a[_0xa530('0x121')]+_0x14ac5a[_0xa530('0x122')]+_0x14ac5a[_0xa530('0x123')]+_0x14ac5a[_0xa530('0x124')]+_0x14ac5a[_0xa530('0xd5')]+_0x14ac5a[_0xa530('0xed')]+_0x14ac5a[_0xa530('0x120')]+_0x14ac5a[_0xa530('0x125')]>=_0x5d0450[_0xa530('0x126')]){_0x41d187[_0xa530('0x127')](_0x14ac5a,_0x12af1d,_0x1ecc38,'reason19\x20machine....');}else{if(_0x14ac5a[_0xa530('0x120')]>=_0x5d0450['dialMachineMaxRetry']){_0x41d187['createStateFinal'](_0x14ac5a,_0x12af1d,_0x1ecc38,_0xa530('0x12a'));}else{hopperUtils[_0xa530('0xdc')]({'active':![],'countmachineretry':_0x14ac5a['countmachineretry'],'scheduledat':moment()[_0xa530('0xdd')](_0x5d0450['dialMachineRetryFrequency'],_0xa530('0xdf'))[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x14ac5a['ContactId'],'ListId':_0x14ac5a[_0xa530('0xe1')],'VoiceQueueId':_0x14ac5a[_0xa530('0xe2')]||undefined,'CampaignId':_0x14ac5a[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x130')));_0x12af1d({'reschedule':0x1});}}});}}};Dialer[_0xa530('0x16')][_0xa530('0x2f')]=function(_0x46b26){var _0x6fe97b=this[_0xa530('0xbd')][_0x46b26[_0xa530('0xbe')]];var _0x24ba83;if(!_0x6fe97b){return;}if(_0x6fe97b['type']==='ivr'){delete this[_0xa530('0xbd')][_0x46b26[_0xa530('0xbe')]];utils[_0xa530('0xcc')](this[_0xa530('0x1b')][_0x6fe97b[_0xa530('0xbc')]],_0xa530('0x131'));this[_0xa530('0x1b')][_0x6fe97b[_0xa530('0xbc')]]['ivrAnswerCallsDay']+=0x1;if(_0x46b26[_0xa530('0x132')]==='Normal\x20Clearing'){const _0x122816=new AgentComplete(_0x6fe97b,_0x46b26);_0x122816['CampaignId']=this[_0xa530('0x1b')][_0x6fe97b[_0xa530('0xbc')]]['id'];hopperUtils['createHistory'](_0x122816)[_0xa530('0x9f')](loggerCatch(_0xa530('0x133')));hopperUtils[_0xa530('0xca')](_0x122816)[_0xa530('0x9f')](loggerCatch(_0xa530('0x134')));}else{_0x24ba83=new Hangup(_0x6fe97b,_0x46b26);hopperUtils[_0xa530('0xc8')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x135')));hopperUtils[_0xa530('0xca')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x136')));}}else{if(isNotNull(this['voiceQueues'][_0x6fe97b[_0xa530('0xbc')]][_0xa530('0x137')])){delete this[_0xa530('0xbd')][_0x46b26[_0xa530('0xbe')]];utils[_0xa530('0xcc')](this[_0xa530('0x1a')][_0x6fe97b[_0xa530('0xbc')]],'[syncHangup]');this[_0xa530('0x1a')][_0x6fe97b[_0xa530('0xbc')]][_0xa530('0x11e')]+=0x1;this['voiceQueues'][_0x6fe97b['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x24ba83=new Hangup(_0x6fe97b,_0x46b26);_0x24ba83['state']=0x10;_0x24ba83['statedesc']=_0xa530('0x138');_0x24ba83['membername']=_0xa530('0x139');hopperUtils[_0xa530('0xc8')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x135')));hopperUtils[_0xa530('0xca')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x136')));}else{delete this['uniqueId'][_0x46b26['uniqueid']];utils[_0xa530('0xcc')](this[_0xa530('0x1a')][_0x6fe97b[_0xa530('0xbc')]],_0xa530('0x13a'));if(_0x46b26[_0xa530('0x132')]===_0xa530('0x13b')){this[_0xa530('0x1a')][_0x6fe97b['queue']]['outboundAnswerCallsDay']+=0x1;const _0x2d7926=new AgentComplete(_0x6fe97b,_0x46b26);_0x2d7926[_0xa530('0xe2')]=this['voiceQueues'][_0x6fe97b[_0xa530('0xbc')]]['id'];hopperUtils[_0xa530('0xc8')](_0x2d7926)[_0xa530('0x9f')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xa530('0xca')](_0x2d7926)[_0xa530('0x9f')](loggerCatch(_0xa530('0xcb')));}else{this['voiceQueues'][_0x6fe97b[_0xa530('0xbc')]][_0xa530('0x13c')]+=0x1;_0x24ba83=new Hangup(_0x6fe97b,_0x46b26);_0x24ba83['state']=0xc;_0x24ba83['statedesc']=_0x46b26['cause-txt'];_0x24ba83[_0xa530('0x116')]=_0xa530('0x13d');hopperUtils[_0xa530('0xc8')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x13e')));hopperUtils[_0xa530('0xca')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x131')));}}}};Dialer['prototype'][_0xa530('0x13f')]=function(_0x56dbf6){var _0xd43b73=this;if(!_0xd43b73[_0xa530('0x24')][_0x56dbf6[_0xa530('0x42')]]){_0xd43b73[_0xa530('0x24')][_0x56dbf6['name']]={'running':![]};}else if(_0xd43b73[_0xa530('0x24')][_0x56dbf6[_0xa530('0x42')]][_0xa530('0x140')]===!![]){return;}else if(_0xd43b73[_0xa530('0x24')][_0x56dbf6[_0xa530('0x42')]][_0xa530('0x140')]===![]){_0xd43b73[_0xa530('0x24')][_0x56dbf6['name']][_0xa530('0x140')]=!![];}var _0x5e89b2=_0xd43b73[_0xa530('0x1a')][_0x56dbf6[_0xa530('0x42')]];var _0x19f73a=_0x5e89b2['message']!==utils['CAMPAIGN_STATUS'][_0xa530('0x78')];var _0x35426d=utils[_0xa530('0x141')](_0x5e89b2);_0x5e89b2[_0xa530('0x142')]=utils[_0xa530('0x143')](_0x5e89b2,_0xd43b73[_0xa530('0x1d')]);Promise[_0xa530('0x144')]()['then'](function(){if(_0x5e89b2[_0xa530('0x142')]===utils[_0xa530('0x6b')][_0xa530('0x78')]){if(_0x19f73a){clearPredictiveAttributes(_0x5e89b2);_0x56dbf6[_0xa530('0x20')]=undefined;_0x56dbf6[_0xa530('0x21')]=undefined;}if(_0x5e89b2[_0xa530('0x142')]===utils[_0xa530('0x6b')][_0xa530('0x78')]){_0x56dbf6[_0xa530('0x145')]=0x0;_0x56dbf6[_0xa530('0xff')]=0x0;_0x56dbf6[_0xa530('0x146')]=0x0;_0x56dbf6[_0xa530('0x147')]=0x0;_0x56dbf6[_0xa530('0x148')]=0x0;}}else if(_0x5e89b2['statusMessage']===utils[_0xa530('0x6b')]['ACTIVE']&&!_0x35426d){return _0xd43b73[_0xa530('0x94')](_0x5e89b2,!![])[_0xa530('0x9c')](function(){return _0xd43b73[_0xa530('0x94')](_0x5e89b2,![]);})[_0xa530('0x9c')](function(){return _0xd43b73[_0xa530('0xae')](_0x5e89b2);})[_0xa530('0x9f')](function(_0x130b75){loggerSyncQueueSummary['debug'](_0xa530('0x149'),util[_0xa530('0x40')](_0x130b75,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5e89b2);});}else{clearPredictiveAttributes(_0x5e89b2);}})[_0xa530('0x9c')](function(){var _0x3676c2=_0x56dbf6['compareToOutboundQueue'](_0x5e89b2);if(_0x3676c2||_0x5e89b2['queueSummaryCountersUpdated']){_0x5e89b2[_0xa530('0x14a')]=![];_0x56dbf6['updateReportFromOutboundQueue'](_0x5e89b2);Object[_0xa530('0x14b')](_0x5e89b2,_0x56dbf6);emitOutboundVoiceQueueSummary(_0x56dbf6);}_0xd43b73['queuesSummary'][_0x5e89b2[_0xa530('0x42')]][_0xa530('0x140')]=![];})['catch'](function(_0x3c3f76){logger['error'](_0xa530('0x149'),util[_0xa530('0x40')](_0x3c3f76,{'showHidden':![],'depth':null}));_0xd43b73[_0xa530('0x24')][_0x5e89b2[_0xa530('0x42')]]['running']=![];});};Dialer['prototype'][_0xa530('0x14c')]=_['throttle'](function(){var _0x31315c=_[_0xa530('0x14d')](this['voiceQueues'],function(_0x4a4cdb){return _0x4a4cdb['dialPreviewRecallmeReminder'];});var _0x710ccb=_[_0xa530('0x14d')](this[_0xa530('0x1c')],function(_0x23effd){return _0x23effd['online']&&_0x23effd[_0xa530('0x86')]==='reachable';});if(_0x31315c[_0xa530('0x96')]>0x0&&_0x710ccb['length']>0x0){return Promise[_0xa530('0x144')]()[_0xa530('0x9c')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x31315c,'id'),previewRecallmeReminderInterval,_[_0xa530('0x14e')](_0x710ccb,'id')))['then'](function(_0x420a52){for(var _0x1477fc=0x0;_0x1477fc<_0x420a52[_0xa530('0x96')];_0x1477fc++){var _0x19f87d=_0x420a52[_0x1477fc][_0xa530('0x14f')][_0xa530('0x42')];if(_0x19f87d)io['to'](util[_0xa530('0x7b')]('user:%s',_0x19f87d))['emit'](_0xa530('0x150'),{'hopper':_0x420a52[_0x1477fc]});}})[_0xa530('0x9f')](function(_0x503ae7){logger[_0xa530('0x64')](_0xa530('0x151'),_0x503ae7);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xa530('0x16')][_0xa530('0x39')]=function(){var _0x41f9f0=this;setInterval(function(){_0x41f9f0[_0xa530('0x152')](_0x41f9f0[_0xa530('0xbd')],'[uniqueid]');_0x41f9f0[_0xa530('0x152')](_0x41f9f0[_0xa530('0x1f')],'[actions]');},0x32c8);};Dialer[_0xa530('0x16')][_0xa530('0x152')]=function(_0x410f05,_0x26a71a){var _0x4a0865=this;for(var _0x46cfcd in _0x410f05){if(typeof _0x410f05[_0x46cfcd]!==_0xa530('0xaa')){this['sequence']['enqueue'](function(){if(!_[_0xa530('0xf6')](_0x410f05[_0x46cfcd])){return ami[_0xa530('0x153')]({'action':_0xa530('0x86'),'channel':_0x410f05[_0x46cfcd][_0xa530('0xf1')]})[_0xa530('0x9f')](function(_0x596a1e){if(_0x596a1e[_0xa530('0x67')]===_0xa530('0x154')){setTimeout(function(){if(_0x410f05[_0x46cfcd]&&_0x410f05[_0x46cfcd][_0xa530('0x3d')]!==_0xa530('0xbf')){utils[_0xa530('0xcc')](_0x4a0865[_0xa530('0x1a')][_0x410f05[_0x46cfcd][_0xa530('0xbc')]],_0xa530('0x155'));logger[_0xa530('0x64')](_0xa530('0x156'),_0x26a71a,_0x46cfcd,_0x410f05[_0x46cfcd][_0xa530('0xbc')]);delete _0x410f05[_0x46cfcd];}if(_0x410f05[_0x46cfcd]&&_0x410f05[_0x46cfcd]['type']===_0xa530('0xbf')){utils['decrementOriginate'](_0x4a0865['campaigns'][_0x410f05[_0x46cfcd][_0xa530('0xbc')]],_0xa530('0x155'));logger[_0xa530('0x64')]('[Dialer][checkChannel][ivr]',_0x26a71a,_0x46cfcd,_0x410f05[_0x46cfcd]['queue']);delete _0x410f05[_0x46cfcd];}},0x2328);}});}});}}};Dialer[_0xa530('0x16')]['getVoiceQueueRtPauses']=function(_0x8ea0e0){return Promise[_0xa530('0x144')]()[_0xa530('0x9c')](voiceQueueRt['getVoiceQueueRtPauses'](_0x8ea0e0))['catch'](loggerCatch(_0xa530('0x157')));};Dialer[_0xa530('0x16')][_0xa530('0x158')]=function(_0x1e782c,_0x267db2,_0x50c5db){var _0x5e175={'state':0x19,'statedesc':_0xa530('0x159')};utils[_0xa530('0xcc')](_0x267db2,_0xa530('0x15a')+_0x1e782c);this['saveInDb'](_[_0xa530('0x5e')](_0x5e175,_[_0xa530('0x102')](_0x50c5db,['ContactId',_0xa530('0xe1'),_0xa530('0x15b'),_0xa530('0xe2'),_0xa530('0xe3')])),_0xa530('0x15c'),_0xa530('0x15a'));logger['error'](_0x1e782c);};Dialer[_0xa530('0x16')]['saveInDb']=function(_0x105016,_0x1ebe7a,_0x3b5ac9){hopperUtils[_0xa530('0xc8')](_0x105016)['catch'](loggerCatch(_0x1ebe7a));hopperUtils[_0xa530('0xca')](_0x105016)[_0xa530('0x9f')](loggerCatch(_0x3b5ac9));};Dialer[_0xa530('0x16')][_0xa530('0xdb')]=function(_0xf95f8c,_0x2b3d89){hopperUtils['createHistory'](_0xf95f8c)[_0xa530('0x9f')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x2b3d89==0x0){hopperUtils[_0xa530('0xca')](_0xf95f8c)[_0xa530('0x9f')](loggerCatch(_0xa530('0x15d')));}};Dialer[_0xa530('0x16')][_0xa530('0x151')]=function(_0x2fc94a){return Promise[_0xa530('0x144')]()[_0xa530('0x9c')](cmHopper['handlePreviewRecallNotifications'](_0x2fc94a['id'],previewRecallmeReminderInterval))[_0xa530('0x9c')](function(_0x287e4c){for(var _0x1405bb=0x0;_0x1405bb<_0x287e4c[_0xa530('0x96')];_0x1405bb++){var _0xdc794c=_0x287e4c[_0x1405bb][_0xa530('0x14f')][_0xa530('0x42')];if(_0xdc794c)io['to'](util[_0xa530('0x7b')](_0xa530('0x15e'),_0xdc794c))['emit'](_0xa530('0x150'),{'hopper':_0x287e4c[_0x1405bb]});}})[_0xa530('0x9f')](function(){});};Dialer[_0xa530('0x16')][_0xa530('0x15f')]=function(_0xdeef2){var _0x4d862b=this;return function(){_0x4d862b[_0xa530('0x160')](_0xdeef2);};};Dialer[_0xa530('0x16')][_0xa530('0x161')]=function(_0x25fea5,_0x5e4974){var _0x4cd8d2=this;var _0x162828=uuid['v4']();this['actions'][_0x162828]=new Action(_0x25fea5,_0x5e4974,_0x162828);return new Promise(function(_0x1e4866,_0x361a0a){if(_[_0xa530('0x3c')](_0x25fea5)&&typeof _0x25fea5!==_0xa530('0x162')){return _0x361a0a(msgResponse(_0xa530('0x163'),'Failure',_0xa530('0x164')));}if(_[_0xa530('0x3c')](_0x5e4974[_0xa530('0x165')])||_0x5e4974[_0xa530('0x165')]===null){return _0x361a0a(msgResponse(_0xa530('0x163'),'Failure',_0xa530('0x166')));}var _0x436d42={'XMD-CALLERID':_0x4cd8d2[_0xa530('0x1f')][_0x162828][_0xa530('0x167')](),'XMD-AGI':_0x25fea5[_0xa530('0x137')]?util[_0xa530('0x7b')](_0xa530('0x168'),ipAgi,_0x25fea5[_0xa530('0x137')]):_0xa530('0x169'),'XMD-AGIAFTER':_0x25fea5[_0xa530('0xc6')]?util[_0xa530('0x7b')](_0xa530('0x168'),ipAgi,_0x25fea5[_0xa530('0xc6')]):_0xa530('0x169'),'XMD-QUEUE':utils[_0xa530('0x16a')](_0x25fea5)?util[_0xa530('0x7b')](_0xa530('0x16b'),_0x25fea5['name'],_0x25fea5[_0xa530('0x16c')]||'',_0x25fea5['dialAgiAfterHangupAgent']?'c':'',_0x25fea5[_0xa530('0xd0')]||0x3):_0xa530('0x169'),'XMD-CONTACTID':_0x5e4974[_0xa530('0xe0')],'XMD-CDRTYPE':_0xa530('0x16d'),'CALLERID(all)':_0x4cd8d2[_0xa530('0x1f')][_0x162828]['getCaller'](),'XMD-AMD':_0x25fea5[_0xa530('0x111')]?_0xa530('0x16e'):_0xa530('0x169'),'XMD-DESTINATION':_0xa530('0x110')};if(_0x25fea5['dialAMDActive']){_0x436d42['XMD-AMDINITIALSILENCE']=_0x25fea5['dialAMDInitialSilence']||0x9c4;_0x436d42['XMD-AMDGREETING']=_0x25fea5[_0xa530('0x16f')]||0x5dc;_0x436d42[_0xa530('0x170')]=_0x25fea5[_0xa530('0x171')]||0x320;_0x436d42[_0xa530('0x172')]=_0x25fea5[_0xa530('0x173')]||0x1388;_0x436d42['XMD-AMDMINWORDLENGTH']=_0x25fea5[_0xa530('0x174')]||0x64;_0x436d42[_0xa530('0x175')]=_0x25fea5['dialAMDBetweenWordsSilence']||0x32;_0x436d42[_0xa530('0x176')]=_0x25fea5['dialAMDMaximumNumberOfWords']||0x3;_0x436d42[_0xa530('0x177')]=_0x25fea5[_0xa530('0x178')]||0x100;_0x436d42[_0xa530('0x179')]=_0x25fea5[_0xa530('0x17a')]||0x1388;}if(utils[_0xa530('0x16a')](_0x25fea5)){_0x436d42[_0xa530('0x17b')]=_0x5e4974[_0xa530('0xe2')];}else{_0x436d42[_0xa530('0x17c')]=_0x5e4974[_0xa530('0xe3')];}var _0x3812a9=utils[_0xa530('0x17d')](_0x5e4974[_0xa530('0x17e')]);Object[_0xa530('0x14b')](_0x436d42,_0x3812a9);var _0x1120ee=_0x4cd8d2[_0xa530('0x8a')](_0x25fea5[_0xa530('0x17f')])?utils['getCallerId'](_0x25fea5[_0xa530('0x17f')][_0xa530('0x180')],_0x25fea5['dialOriginateCallerIdName'],_0x25fea5[_0xa530('0x181')]>0x0?utils[_0xa530('0x182')](_0x25fea5['dialOriginateCallerIdNumber'],_0x25fea5['dialRandomLastDigitCallerIdNumber']):_0x25fea5[_0xa530('0x183')]):utils[_0xa530('0x184')](_[_0xa530('0xf6')](_0x25fea5['TrunkBackup'])?_0x25fea5[_0xa530('0x17f')][_0xa530('0x180')]:_0x25fea5[_0xa530('0x185')][_0xa530('0x180')],_0x25fea5[_0xa530('0x186')],_0x25fea5['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xa530('0x182')](_0x25fea5[_0xa530('0x183')],_0x25fea5[_0xa530('0x181')]):_0x25fea5['dialOriginateCallerIdNumber']);if(_0x1120ee){_0x436d42['XMD-ORIGINATECALLERIDNAME']=_0x4cd8d2[_0xa530('0x1f')][_0x162828]['originatecalleridname']=utils[_0xa530('0x187')](_0x1120ee);_0x436d42[_0xa530('0x188')]=_0x5e4974[_0xa530('0x165')];}_0x25fea5[_0xa530('0x189')]=_0x436d42;return ami['Action']({'actionid':_0x162828,'action':_0xa530('0x163'),'channel':_0x4cd8d2[_0xa530('0x8a')](_0x25fea5['Trunk'])?util['format']('SIP/%s/%s%s',_0x25fea5[_0xa530('0x17f')][_0xa530('0x42')],isNotNull(_0x25fea5[_0xa530('0x18a')])?_0x25fea5[_0xa530('0x18a')][_0xa530('0x18b')]()||'':'',_0x25fea5['dialCutDigit']>0x0?_0x5e4974[_0xa530('0x165')][_0xa530('0x18c')](_0x25fea5[_0xa530('0x18d')]):_0x5e4974[_0xa530('0x165')]):util[_0xa530('0x7b')](_0xa530('0x18e'),_['isNil'](_0x25fea5[_0xa530('0x185')])?_0x25fea5[_0xa530('0x17f')][_0xa530('0x42')]:_0x25fea5[_0xa530('0x185')][_0xa530('0x42')],isNotNull(_0x25fea5[_0xa530('0x18a')])?_0x25fea5['dialPrefix'][_0xa530('0x18b')]()||'':'',_0x25fea5[_0xa530('0x18d')]>0x0?_0x5e4974[_0xa530('0x165')]['substring'](_0x25fea5[_0xa530('0x18d')]):_0x5e4974[_0xa530('0x165')]),'callerid':_0x1120ee,'Exten':_0xa530('0x110'),'Context':_0xa530('0x18f'),'Priority':'1','variable':_0x436d42,'timeout':(_0x25fea5['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x162828})[_0xa530('0x9c')](function(_0x5d2c7c){return _0x1e4866(_0x5d2c7c);})['catch'](function(_0x28edfd){_0x25fea5['outboundOriginateFailureCallsDay']+=0x1;var _0xf5c805=new History(_0x4cd8d2[_0xa530('0x1f')][_0x162828]);logger[_0xa530('0x64')](util['format']('[originateError]:\x20%s',JSON[_0xa530('0x72')](_0x28edfd)));_0xf5c805[_0xa530('0x6d')]=0xe;_0xf5c805['statedesc']=_0xa530('0x190');_0xf5c805[_0xa530('0xe5')]=moment()['format'](_0xa530('0xc2'));_0xf5c805[_0xa530('0x6f')]=_0xf5c805['starttime'];hopperUtils[_0xa530('0xc8')](_0xf5c805)['catch'](loggerCatch(_0xa530('0x191')));_0x4cd8d2[_0xa530('0xca')](_0xf5c805)['catch'](loggerCatch(_0xa530('0x191')))[_0xa530('0xfb')](function(){delete _0x4cd8d2[_0xa530('0x1f')][_0x162828];return _0x361a0a(msgResponse(_0xa530('0x163'),'Error',_0xa530('0x192')));});});});};Dialer[_0xa530('0x16')][_0xa530('0x193')]=function(_0x4aa097,_0x225409,_0x153d6f){var _0x6bfff2=new History(_0x225409);if(_0x6bfff2[_0xa530('0x121')]+_0x6bfff2[_0xa530('0x122')]+_0x6bfff2[_0xa530('0x123')]+_0x6bfff2[_0xa530('0x124')]+_0x6bfff2['countdropretry']+_0x6bfff2['countabandonedretry']+_0x6bfff2[_0xa530('0x120')]+_0x6bfff2[_0xa530('0x125')]>=_0x153d6f['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4aa097){case 0x3:if(_0x6bfff2[_0xa530('0x123')]>=_0x153d6f['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x6bfff2[_0xa530('0x123')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f[_0xa530('0x194')],_0xa530('0xdf'))['format'](_0xa530('0xc2')),'ContactId':_0x6bfff2[_0xa530('0xe0')],'ListId':_0x6bfff2[_0xa530('0xe1')],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})['catch'](loggerCatch(_0xa530('0x195')));break;case 0x5:if(_0x6bfff2[_0xa530('0x121')]>=_0x153d6f['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x6bfff2[_0xa530('0x121')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f[_0xa530('0x196')],_0xa530('0xdf'))[_0xa530('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6bfff2['ContactId'],'ListId':_0x6bfff2[_0xa530('0xe1')],'VoiceQueueId':_0x6bfff2['VoiceQueueId']||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x197')));break;case 0x8:if(_0x6bfff2[_0xa530('0x122')]>=_0x153d6f[_0xa530('0x198')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x6bfff2[_0xa530('0x122')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f[_0xa530('0x199')],_0xa530('0xdf'))[_0xa530('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6bfff2['ContactId'],'ListId':_0x6bfff2[_0xa530('0xe1')],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x19a')));break;case 0x0:if(_0x6bfff2[_0xa530('0x124')]>=_0x153d6f[_0xa530('0x19b')]-0x1){return!![];}else{hopperUtils[_0xa530('0xdc')]({'active':![],'countnosuchnumberretry':_0x6bfff2['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x153d6f['dialNoSuchNumberRetryFrequency'],_0xa530('0xdf'))[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x6bfff2['ContactId'],'ListId':_0x6bfff2[_0xa530('0xe1')],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x6bfff2[_0xa530('0xd5')]>=_0x153d6f['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0xa530('0xdc')]({'active':![],'countdropretry':_0x6bfff2[_0xa530('0xd5')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f[_0xa530('0xde')],'minutes')[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x6bfff2[_0xa530('0xe0')],'ListId':_0x6bfff2['ListId'],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x6bfff2['countabandonedretry']>=_0x153d6f['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xa530('0xdc')]({'active':![],'countabandonedretry':_0x6bfff2[_0xa530('0xed')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f[_0xa530('0xef')],_0xa530('0xdf'))[_0xa530('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6bfff2[_0xa530('0xe0')],'ListId':_0x6bfff2[_0xa530('0xe1')],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2['CampaignId']||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x19c')));break;case 0x13:if(_0x6bfff2[_0xa530('0x120')]>=_0x153d6f[_0xa530('0x19d')]-0x1){return!![];}hopperUtils[_0xa530('0xdc')]({'active':![],'countmachineretry':_0x6bfff2[_0xa530('0x120')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f['dialMachineRetryFrequency'],_0xa530('0xdf'))['format'](_0xa530('0xc2')),'ContactId':_0x6bfff2[_0xa530('0xe0')],'ListId':_0x6bfff2['ListId'],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x6bfff2['countagentrejectretry']>=_0x153d6f[_0xa530('0x19e')]-0x1){return!![];}hopperUtils[_0xa530('0xdc')]({'active':![],'countagentrejectretry':_0x6bfff2[_0xa530('0x125')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f['dialAgentRejectRetryFrequency'],_0xa530('0xdf'))['format'](_0xa530('0xc2')),'ContactId':_0x6bfff2['ContactId'],'ListId':_0x6bfff2['ListId'],'VoiceQueueId':_0x6bfff2['VoiceQueueId']||undefined,'CampaignId':_0x6bfff2['CampaignId']||undefined})['catch'](loggerCatch(_0xa530('0x19f')));break;default:return!![];}};Dialer[_0xa530('0x16')][_0xa530('0x10d')]=function(_0x572cde,_0x1df90b,_0x5ce76f){var _0x354b75=this;var _0x13c791=new History(_0x572cde);var _0x4eca8a=![];var _0x3708b7;var _0x169391;return new Promise(function(_0xae239a,_0x145fd2){if(_[_0xa530('0x3c')](_0x1df90b)&&typeof _0x1df90b!==_0xa530('0x162')){return _0x145fd2(msgResponse(_0xa530('0x1a0'),'Failure','entity\x20is\x20undefine'));}if(_['isUndefined'](_0x5ce76f)&&typeof _0x5ce76f!=='object'){return _0x145fd2(msgResponse(_0xa530('0x1a0'),'Failure',_0xa530('0x1a1')));}hopperUtils[_0xa530('0xd7')](_0x13c791,_0x5ce76f[_0xa530('0xc3')],_0x1df90b)[_0xa530('0x9c')](function(_0x47edb3){if(_0x47edb3['additional']==0x1)_0x4eca8a=!![];switch(_0x5ce76f[_0xa530('0xc3')]){case'0':_0x1df90b[_0xa530('0x1a2')]+=0x1;_0x13c791[_0xa530('0x6d')]=0x0;_0x13c791[_0xa530('0x6e')]=_0xa530('0x1a3');_0x13c791[_0xa530('0x124')]+=0x1;_0x13c791[_0xa530('0xee')]+=0x1;ami['emit'](_0xa530('0x1a4'),ut['buildObj'](_0x572cde,_0xa530('0x1a5')));_0x3708b7=_0x1df90b[_0xa530('0x1a6')];_0x169391=_0x1df90b[_0xa530('0xd6')];hopperUtils[_0xa530('0xc8')](_0x13c791)[_0xa530('0x9f')](loggerCatch(_0xa530('0x12f')));if(_0x354b75[_0xa530('0x193')](0x0,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0x124')]>=_0x1df90b[_0xa530('0x19b')]){_0x354b75['createStateFinal'](_0x13c791,_0xae239a,_0x145fd2,'reason\x200\x20no\x20such\x20number....');}else{_0x354b75['stateGlobal'](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1a7'));}}break;case'3':_0x1df90b[_0xa530('0x1a8')]+=0x1;_0x13c791[_0xa530('0x6d')]=0x3;_0x13c791[_0xa530('0x6e')]='NoAnswer';_0x13c791[_0xa530('0x123')]+=0x1;_0x13c791['countglobal']+=0x1;var _0x38bc3a=ut[_0xa530('0x1a9')](_0x572cde,_0x1df90b);ami['emit'](_0xa530('0x1aa'),_0x38bc3a);_0x3708b7=_0x1df90b[_0xa530('0x194')];_0x169391=_0x1df90b[_0xa530('0xd6')];hopperUtils[_0xa530('0xc8')](_0x13c791)[_0xa530('0x9f')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x354b75[_0xa530('0x193')](0x3,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0x123')]>=_0x1df90b[_0xa530('0x1ab')]){_0x354b75['createStateFinal'](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1ac'));}else{_0x354b75[_0xa530('0x127')](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1ac'));}}break;case'5':_0x1df90b[_0xa530('0x1ad')]+=0x1;_0x13c791[_0xa530('0x6d')]=0x5;_0x13c791['statedesc']='Busy';_0x13c791[_0xa530('0x121')]+=0x1;_0x13c791['countglobal']+=0x1;ami['emit'](_0xa530('0x1ae'),ut[_0xa530('0x118')](_0x572cde,_0xa530('0x1af')));_0x3708b7=_0x1df90b['dialBusyRetryFrequency'];_0x169391=_0x1df90b['callAdditionalPhoneAfterMin'];hopperUtils[_0xa530('0xc8')](_0x13c791)['catch'](loggerCatch(_0xa530('0x1b0')));if(_0x354b75['checkRetriveMax'](0x5,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0x121')]>=_0x1df90b[_0xa530('0x1b1')]){_0x354b75['createStateFinal'](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1b2'));}else{_0x354b75['stateGlobal'](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1b2'));}}break;case'8':_0x1df90b['outboundCongestionCallsDay']+=0x1;_0x13c791[_0xa530('0x6d')]=0x8;_0x13c791[_0xa530('0x6e')]='Congestion';_0x13c791[_0xa530('0x122')]+=0x1;_0x13c791[_0xa530('0xee')]+=0x1;_0x3708b7=_0x1df90b[_0xa530('0x199')];_0x169391=_0x1df90b[_0xa530('0xd6')];ami[_0xa530('0x12c')](_0xa530('0x1b3'),ut['buildObj'](_0x572cde,'congestion'));hopperUtils[_0xa530('0xc8')](_0x13c791)[_0xa530('0x9f')](loggerCatch(_0xa530('0x1b4')));if(_0x354b75[_0xa530('0x193')](0x8,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0x122')]>=_0x1df90b['dialCongestionMaxRetry']){_0x354b75[_0xa530('0x129')](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1b5'));}else{_0x354b75[_0xa530('0x127')](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1b5'));}}break;case'11':_0x1df90b[_0xa530('0x1b6')]+=0x1;_0x13c791['state']=0xb;_0x13c791[_0xa530('0x6e')]=_0xa530('0xeb');_0x13c791[_0xa530('0xed')]+=0x1;_0x13c791[_0xa530('0xee')]+=0x1;_0x3708b7=_0x1df90b[_0xa530('0xef')];_0x169391=_0x1df90b[_0xa530('0xd6')];hopperUtils[_0xa530('0xc8')](_0x13c791)['catch'](loggerCatch(_0xa530('0x1b7')));if(_0x354b75[_0xa530('0x193')](0xb,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0xed')]>=_0x1df90b[_0xa530('0xf0')]){_0x354b75['createStateFinal'](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1b8'));}else{_0x354b75[_0xa530('0x127')](_0x13c791,_0xae239a,_0x145fd2,'reason\x2011\x20abandoned');}}break;case'20':_0x1df90b['outboundRejectCallsDay']+=0x1;_0x13c791[_0xa530('0x6d')]=0x14;_0x13c791[_0xa530('0x6e')]=_0xa530('0x1b9');_0x13c791['countagentrejectretry']+=0x1;_0x13c791[_0xa530('0xee')]+=0x1;_0x3708b7=_0x1df90b[_0xa530('0x1ba')];_0x169391=_0x1df90b[_0xa530('0xd6')];ami[_0xa530('0x12c')](_0xa530('0x1bb'),ut['buildObj'](_0x572cde,_0xa530('0x1bc')));hopperUtils[_0xa530('0xc8')](_0x13c791)[_0xa530('0x9f')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x354b75['checkRetriveMax'](0x14,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791['countagentrejectretry']>=_0x1df90b[_0xa530('0x19e')]){_0x354b75['createStateFinal'](_0x13c791,_0xae239a,_0x145fd2,'reason\x2020\x20agentreject');}else{_0x354b75[_0xa530('0x127')](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1bd'));}}break;default:_0x1df90b[_0xa530('0x13c')]+=0x1;_0x13c791[_0xa530('0x6d')]=0xc;_0x13c791['statedesc']=_0x5ce76f[_0xa530('0xc3')];_0x3708b7=_0x1df90b[_0xa530('0x1ba')];_0x169391=_0x1df90b[_0xa530('0xd6')];hopperUtils[_0xa530('0xc8')](_0x13c791)['catch'](loggerCatch(_0xa530('0x1be')));if(_0x354b75[_0xa530('0x193')](_0x5ce76f[_0xa530('0xc3')],_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0x121')]+_0x13c791['countcongestionretry']+_0x13c791[_0xa530('0x123')]+_0x13c791[_0xa530('0x124')]+_0x13c791[_0xa530('0xd5')]+_0x13c791['countabandonedretry']+_0x13c791['countmachineretry']+_0x13c791[_0xa530('0x125')]>=_0x1df90b[_0xa530('0x126')]){_0x354b75[_0xa530('0x127')](_0x13c791,_0xae239a,_0x145fd2,_0x5ce76f[_0xa530('0xc3')]);}else{_0x354b75[_0xa530('0x129')](_0x13c791,_0xae239a,_0x145fd2,_0x5ce76f['reason']);}}}})[_0xa530('0x9c')](function(){if(_0x4eca8a){hopperUtils[_0xa530('0xe9')](_0x13c791,_0x3708b7,_0x169391)[_0xa530('0x9c')](function(){return _0xae239a(0x1);});}});});};Dialer[_0xa530('0x16')][_0xa530('0x127')]=function(_0x55731a,_0x41ee66,_0x3a32fa,_0x164a9b){var _0x111445=new Final(_0x55731a);_0x111445[_0xa530('0x6d')]=0xf;_0x111445[_0xa530('0x6e')]=_0xa530('0x1bf');this[_0xa530('0x129')](_0x111445,_0x41ee66,_0x3a32fa,_0x164a9b);};Dialer[_0xa530('0x16')]['createStateFinal']=function(_0x17bfb6,_0x33cefa,_0x444ec5,_0x465dbe){hopperUtils[_0xa530('0xca')](_0x17bfb6)['then'](function(){return _0x33cefa(msgResponse('[callProgressDetecting]','Success',_0x465dbe));})['catch'](function(){return _0x444ec5(msgResponse('[moveContactManagedDialer][0]',_0xa530('0x8e'),_0xa530('0x1c0')));});};Dialer['prototype'][_0xa530('0xb0')]=function(_0x3798e3){var _0x7cd96f=_0x3798e3[_0xa530('0x1c1')]/0x64;var _0x305596=_0x3798e3[_0xa530('0xd1')]/(_0x3798e3[_0xa530('0xd1')]+_0x3798e3[_0xa530('0x11e')]);var _0x334c90=Math[_0xa530('0x1c2')](_0x3798e3[_0xa530('0x1c3')]*(_0x3798e3[_0xa530('0x1c4')]/0x64));var _0x3c1ea0=Math['round'](_0x3798e3[_0xa530('0x1c3')]*(_0x3798e3['predictiveIntervalMinThreshold']/0x64));var _0xd5c93=_0x3798e3['available']+_0x3798e3[_0xa530('0x147')];var _0x53e0dc=Math[_0xa530('0x1c5')](_0x3798e3[_0xa530('0x59')]*_0x3798e3['erlangAbandonmentRate']*_0x3798e3['predictiveIntervalHitRate']*_0x3798e3['predictiveIntervalMultiplicativeFactor']);if(_[_0xa530('0x3c')](_0x3798e3[_0xa530('0x21')])){if(!_['isUndefined'](_0x3798e3[_0xa530('0x20')])){_0x3798e3[_0xa530('0x20')]=undefined;loggerPredictive['error'](_0xa530('0x1c6'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xa530('0x3c')](_0x3798e3[_0xa530('0x62')])){loggerPredictive[_0xa530('0x64')](_0xa530('0x1c6'),_0xa530('0x1c7'));clearInterval(_0x3798e3[_0xa530('0x62')]);_0x3798e3[_0xa530('0x62')]=undefined;}_0x3798e3[_0xa530('0x21')]=moment()[_0xa530('0x7b')](_0xa530('0xc2'));loggerPredictive[_0xa530('0x45')](_0x3798e3[_0xa530('0x42')],'collection\x20data\x20in\x20progressive\x20at',_0x3798e3['startProgressive']);this[_0xa530('0xb1')](_0x3798e3,0x1);}else if(ifInterval(_0x3798e3[_0xa530('0x1c8')],_0x3798e3['startProgressive'])){this['handlePower'](_0x3798e3,0x1);loggerPredictiveCalls['info'](_0xa530('0x1c9'),_0x3798e3[_0xa530('0x21')],_0x3798e3[_0xa530('0x42')]);_0x3798e3['erlangCalls']=0x0;_0x3798e3[_0xa530('0x1ca')]=0x0;}else if(_0x7cd96f<_0x305596&&_0x3798e3[_0xa530('0x1cb')]===_0xa530('0x1cc')){clearPredictiveAttributes(_0x3798e3);loggerPredictive[_0xa530('0x45')](_0xa530('0x1cd'),_0xa530('0x1ce'),_0x305596,_0xa530('0x21'),_0x3798e3['name']);}else if(_0x53e0dc<_0x3798e3['predictiveIntervalErlangCallsDroppedCalls']&&_0x3798e3['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x3798e3);loggerPredictive[_0xa530('0x45')](_0xa530('0x1cf'),_0xa530('0x1d0'),_0x53e0dc,_0xa530('0x1d1'),_0x3798e3[_0xa530('0x1ca')],'startProgressive',_0x3798e3[_0xa530('0x42')]);}else if(!ifInterval(_0x3798e3[_0xa530('0x1c8')],_0x3798e3[_0xa530('0x21')])&&_['isUndefined'](_0x3798e3['startPredictive'])&&!_['isUndefined'](_0x3798e3[_0xa530('0x21')])){_0x3798e3[_0xa530('0x20')]=moment()[_0xa530('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa530('0x45')](_0x3798e3[_0xa530('0x42')],'started\x20in\x20predictive\x20at',_0x3798e3[_0xa530('0x20')]);hopperUtils[_0xa530('0x1d2')](_0x3798e3[_0xa530('0x1c8')])[_0xa530('0x9c')](this[_0xa530('0x1d3')](_0x3798e3))[_0xa530('0x9c')](mergeDataErlangB(_0x3798e3))[_0xa530('0x9c')](this[_0xa530('0x1d4')](_0x3798e3))[_0xa530('0x9f')](loggerCatchPredictive(_0xa530('0x1d5'),_0x3798e3));}else if(!ifInterval(_0x3798e3[_0xa530('0x1c8')],_0x3798e3['startPredictive'])){_0x3798e3['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x3798e3[_0xa530('0x20')]=moment()[_0xa530('0x7b')](_0xa530('0xc2'));loggerPredictive[_0xa530('0x45')](_0x3798e3[_0xa530('0x42')],_0xa530('0x1d6'),_0x3798e3[_0xa530('0x20')]);clearInterval(_0x3798e3[_0xa530('0x62')]);_0x3798e3[_0xa530('0x62')]=undefined;hopperUtils[_0xa530('0x1d2')](_0x3798e3['dialPredictiveInterval'])['then'](this[_0xa530('0x1d3')](_0x3798e3))['then'](mergeDataErlangB(_0x3798e3))['then'](this[_0xa530('0x1d4')](_0x3798e3))[_0xa530('0x9f')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3798e3));}else if(_0x3798e3[_0xa530('0x1c3')]&&_0xd5c93<_0x3798e3[_0xa530('0x1c3')]-_0x3c1ea0){clearPredictiveAttributes(_0x3798e3);loggerPredictive[_0xa530('0x45')](_0x3798e3[_0xa530('0x42')],_0xa530('0x1d7'),_0xd5c93,_0xa530('0x1d8'),_0x3798e3[_0xa530('0x1c3')],'-',_0x3c1ea0,'=',_0x3798e3[_0xa530('0x1c3')]-_0x3c1ea0,')');}else if(_0x3798e3['predictiveIntervalAvailable']&&_0xd5c93>_0x3798e3[_0xa530('0x1c3')]+_0x334c90){clearPredictiveAttributes(_0x3798e3);loggerPredictive[_0xa530('0x45')](_0x3798e3[_0xa530('0x42')],_0xa530('0x1d7'),_0xd5c93,')\x20are\x20more\x20than\x20threshold\x20(',_0x3798e3[_0xa530('0x1c3')],'+',_0x334c90,'=',_0x3798e3[_0xa530('0x1c3')]+_0x334c90,')');}};Dialer[_0xa530('0x16')][_0xa530('0x1d3')]=function(_0x21fa8e){var _0xa970ee=this;return function(_0x272da3){return new Promise(function(_0x92a0f5,_0x5edfb5){_[_0xa530('0x5e')](_0x21fa8e,_0x272da3[0x0]);if(checkGetDataPredictive(_0x272da3[0x0])){var _0xea4ad5=_0x21fa8e['predictiveIntervalAvailable']=_0x21fa8e[_0xa530('0x147')]+_0x21fa8e['available'];var _0x4b463b=_0x21fa8e[_0xa530('0x1c8')]*0x3c;var _0x21b294=_0x272da3[0x0][_0xa530('0x50')]+_0x272da3[0x0]['predictiveIntervalAvgHoldtime'];var _0x289cd8=(_0x272da3[0x0][_0xa530('0x1d9')]+_0x272da3[0x0][_0xa530('0x4b')]+_0x272da3[0x0][_0xa530('0x4d')])/_0x272da3[0x0][_0xa530('0x48')];_0x21fa8e[_0xa530('0x1da')]=_0x289cd8>0x0?_0x289cd8:0x1;switch(_0x21fa8e['dialPredictiveOptimization']){case _0xa530('0x1cc'):var _0x2cd364=_0x21fa8e[_0xa530('0x1c1')]/0x64;return _0xa970ee[_0xa530('0x1db')](_0xea4ad5,_0x4b463b,_0x21b294,_0x289cd8,_0x2cd364)[_0xa530('0x9c')](function(_0x4b3f1a){return _0x92a0f5(_0x4b3f1a);});case'agentBusyFactor':var _0x1c062f=_0x21fa8e[_0xa530('0x1c1')]/0x64;return _0xa970ee[_0xa530('0x1dc')](_0xea4ad5,_0x4b463b,_0x21b294,_0x289cd8,_0x1c062f)[_0xa530('0x9c')](function(_0x4e9829){return _0x92a0f5(_0x4e9829);});default:return _0x5edfb5(msgResponse(_0xa530('0x1dd'),_0xa530('0x8e'),_0xa530('0x1de')));}}else{return _0x5edfb5(msgResponse(_0xa530('0x1dd'),'Failure',_0xa530('0x1df')));}});};};Dialer[_0xa530('0x16')][_0xa530('0x1e0')]=function(_0x2184a9){var _0x488a1b=this;return function(_0x5e8d19){return new Promise(function(_0x5511d8,_0x57470d){_[_0xa530('0x5e')](_0x2184a9,_0x5e8d19[0x0]);if(checkGetDataPredictive(_0x5e8d19[0x0])){loggerPredictive[_0xa530('0x45')](JSON[_0xa530('0x72')](_0x5e8d19[0x0]));if(_0x2184a9[_0xa530('0x1cb')]===_0xa530('0x1cc')){return _0x488a1b[_0xa530('0x1e1')](_0x2184a9['id'])[_0xa530('0x9c')](function(_0x53a64d){var _0x41f1f6=_0x2184a9[_0xa530('0x1e2')]-_0x53a64d[0x0][_0xa530('0x1e3')];var _0x4d68e1=_0x2184a9[_0xa530('0x1c8')]*0x3c;var _0x221673=_0x5e8d19[0x0][_0xa530('0x50')]+_0x5e8d19[0x0]['predictiveIntervalAvgHoldtime'];var _0x4a406b=(_0x5e8d19[0x0][_0xa530('0x1d9')]+_0x5e8d19[0x0][_0xa530('0x4b')]+_0x5e8d19[0x0][_0xa530('0x4d')])/_0x5e8d19[0x0][_0xa530('0x48')];var _0x1b9b82=_0x2184a9[_0xa530('0x1c1')]/0x64;_0x2184a9['predictiveIntervalPauses']=_0x53a64d[0x0][_0xa530('0x1e3')]||0x0;_0x2184a9[_0xa530('0x1da')]=_0x4a406b>0x0?_0x4a406b:0x1;return _0x488a1b['abandonmentRate'](_0x41f1f6,_0x4d68e1,_0x221673,_0x4a406b,_0x1b9b82);})['then'](function(_0x562c4c){return _0x5511d8(_0x562c4c);})['catch'](function(_0x4edf6f){return _0x57470d(msgResponse('[CatchErlangB]','Failure',JSON[_0xa530('0x72')](_0x4edf6f)));});}if(_0x2184a9[_0xa530('0x1cb')]===_0xa530('0x1e4')){return _0x488a1b[_0xa530('0x1e1')](_0x2184a9['id'])['then'](function(_0x4ac8aa){var _0x2bfbab=_0x2184a9[_0xa530('0x1e2')]-_0x4ac8aa[0x0][_0xa530('0x1e3')];var _0x2ed806=_0x2184a9[_0xa530('0x1c8')]*0x3c;var _0x53d02d=_0x5e8d19[0x0]['predictiveIntervalAvgTalktime']+_0x5e8d19[0x0][_0xa530('0x53')];var _0x2a0c34=(_0x5e8d19[0x0][_0xa530('0x1d9')]+_0x5e8d19[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5e8d19[0x0][_0xa530('0x4d')])/_0x5e8d19[0x0][_0xa530('0x48')];var _0xd7c099=_0x2184a9['dialPredictiveOptimizationPercentage']/0x64;_0x2184a9['predictiveIntervalPauses']=_0x4ac8aa[0x0][_0xa530('0x1e3')]||0x0;_0x2184a9[_0xa530('0x1da')]=_0x2a0c34>0x0?_0x2a0c34:0x1;return _0x488a1b['busyFactor'](_0x2bfbab,_0x2ed806,_0x53d02d,_0x2a0c34,_0xd7c099);})[_0xa530('0x9c')](function(_0x4011a3){return _0x5511d8(_0x4011a3);})[_0xa530('0x9f')](function(_0x3ae4b5){return _0x57470d(msgResponse(_0xa530('0x1e5'),_0xa530('0x8e'),JSON[_0xa530('0x72')](_0x3ae4b5)));});}}else{return _0x57470d(msgResponse('[getDataPredictive]',_0xa530('0x8e'),_0xa530('0x1df')));}});};};Dialer[_0xa530('0x16')][_0xa530('0x1d4')]=function(_0x53e8fd){var _0x5eeb18=this;return function(){var _0x1b7b25=0x0;var _0x56a61e=Math[_0xa530('0x1c5')](_0x53e8fd[_0xa530('0x5a')]*0x3e8);if(_0x56a61e>0x0){_0x56a61e=_0x56a61e<0x64?0x64:_0x56a61e;loggerPredictive[_0xa530('0x45')](_0x53e8fd[_0xa530('0x42')],_0xa530('0x1e6'),_0x56a61e,_0xa530('0x1e7'));_0x53e8fd['handlePredictive']=setInterval(function(){_0x5eeb18[_0xa530('0x62')](_0x53e8fd);loggerPredictiveCalls['info'](_0xa530('0x1e8'),_0x1b7b25+=0x1);},_0x56a61e);}else{loggerPredictive[_0xa530('0x45')](_0x53e8fd[_0xa530('0x42')],_0xa530('0x1e9'));}};};Dialer[_0xa530('0x16')]['checkContactBlack']=function(_0x2c400a,_0x472392){var _0x1d6fc7=this;return function(_0x15f589){if(_[_0xa530('0x44')](_0x15f589)){if(_['isNil'](_0x472392[_0xa530('0x15b')])||!_0x472392[_0xa530('0x1ea')]){if(_0x2c400a[_0xa530('0xaf')]===_0xa530('0x8')){_0x2c400a[_0xa530('0x73')]=_[_0xa530('0x3c')](_0x2c400a[_0xa530('0x73')])?!![]:_0x2c400a[_0xa530('0x73')];var _0x152943=uuid['v4']();_0x1d6fc7['actions'][_0x152943]=new Action(_0x2c400a,_0x472392,_0x152943);loggerBooked['info'](_0xa530('0x1eb'),_0x152943,_0xa530('0x1ec'),JSON[_0xa530('0x72')](_0x2c400a[_0xa530('0x73')]),_0xa530('0x1ed'),_0x2c400a[_0xa530('0x42')]);if(_0x2c400a[_0xa530('0x73')]){_0x2c400a[_0xa530('0x73')]=![];_0x1d6fc7[_0xa530('0xf9')][_0x1d6fc7[_0xa530('0x1f')][_0x152943][_0xa530('0xbc')]]=[];ami[_0xa530('0x153')]({'actionid':_0x152943,'action':_0xa530('0x1ee'),'queue':_0x2c400a[_0xa530('0x42')]})[_0xa530('0x9f')](function(){utils[_0xa530('0xcc')](_0x2c400a,_0xa530('0x1ef'));hopperUtils[_0xa530('0xdc')]({'active':![],'ContactId':_0x1d6fc7['actions'][_0x152943][_0xa530('0xe0')],'ListId':_0x1d6fc7[_0xa530('0x1f')][_0x152943]['ListId'],'VoiceQueueId':_0x1d6fc7[_0xa530('0x1f')][_0x152943][_0xa530('0xe2')]||undefined,'CampaignId':_0x1d6fc7['actions'][_0x152943][_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x1f0')));delete _0x1d6fc7[_0xa530('0x1f')][_0x152943];});}else{loggerBooked[_0xa530('0x45')](_0xa530('0x1f1'),JSON[_0xa530('0x72')](_0x2c400a[_0xa530('0x73')]),_0xa530('0x1ed'),_0x2c400a[_0xa530('0x42')]);utils[_0xa530('0xcc')](_0x2c400a,'[checkContactBlack]');hopperUtils[_0xa530('0xdc')]({'active':![],'ContactId':_0x1d6fc7[_0xa530('0x1f')][_0x152943][_0xa530('0xe0')],'ListId':_0x1d6fc7[_0xa530('0x1f')][_0x152943][_0xa530('0xe1')],'VoiceQueueId':_0x1d6fc7[_0xa530('0x1f')][_0x152943][_0xa530('0xe2')]||undefined,'CampaignId':_0x1d6fc7['actions'][_0x152943][_0xa530('0xe3')]||undefined})['catch'](loggerCatch(_0xa530('0x1f0')));delete _0x1d6fc7['actions'][_0x152943];}}else{return _0x1d6fc7[_0xa530('0x161')](_0x2c400a,_0x472392);}}else{if(utils[_0xa530('0x5f')](undefined,_0x472392[_0xa530('0x1f2')])<_0x2c400a[_0xa530('0x1f3')]*0x3c){if(_0x472392[_0xa530('0x14f')]&&!_0x472392['Agent']['voicePause']){_0x1d6fc7['preview'][_0xa530('0x1f4')](_0x472392['id'])[_0xa530('0xfb')](function(){utils[_0xa530('0xcc')](_0x2c400a,_0xa530('0x1ef'));});}else{hopperUtils[_0xa530('0x1f5')]({'active':![]},_0x472392['id'],0x1)['finally'](function(){utils[_0xa530('0xcc')](_0x2c400a,_0xa530('0x1ef'));});}}else{_0x2c400a[_0xa530('0x1f6')]+=0x1;utils[_0xa530('0xcc')](_0x2c400a,_0xa530('0x1ef'));if(_0x2c400a[_0xa530('0x1f7')]){hopperUtils[_0xa530('0xdc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x472392[_0xa530('0xe0')],'ListId':_0x472392[_0xa530('0xe1')],'VoiceQueueId':_0x472392[_0xa530('0xe2')]||undefined,'CampaignId':_0x472392[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x1f8')));hopperUtils[_0xa530('0xc8')](createObjHistory(_0x2c400a,_0x472392,utils[_0xa530('0x6b')][_0xa530('0x1f9')],0x17,'RecallInQueue'))[_0xa530('0x9f')](loggerCatch(_0xa530('0x1fa')));}else{_0x1d6fc7[_0xa530('0x11a')](createObjHistory(_0x2c400a,_0x472392,utils['CAMPAIGN_STATUS'][_0xa530('0x1fb')],0x16,_0xa530('0x1fc')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x2c400a[_0xa530('0x1fd')]+=0x1;_0x1d6fc7[_0xa530('0x11a')](createObjHistory(_0x2c400a,_0x472392,utils[_0xa530('0x6b')][_0xa530('0x1fe')],0xd,_0xa530('0x1ff')),_0xa530('0x200'),'[Originate][MoveBlacklist]');throw _0xa530('0x201');}};};Dialer[_0xa530('0x16')][_0xa530('0x160')]=function(_0x2b9f40){var _0x4aa6c4=this;var _0x3d4823=_0x2b9f40[_0xa530('0x202')]-_0x2b9f40['originated'];emitCampaignSummary(_0x2b9f40);if(_0x3d4823>0x0&&_0x2b9f40['temp']==0x0){if(_0x3d4823>this['maxNumberOriginate']){_0x3d4823=this['maxNumberOriginate'];}_0x2b9f40[_0xa530('0x203')]=0x1;hopperUtils[_0xa530('0x204')](_0x2b9f40,_0x3d4823)['then'](function(_0x56d858){_0x2b9f40['temp']=0x0;if(_0x56d858){if(!utils[_0xa530('0x205')](_0x56d858)){_0x2b9f40['message']=utils[_0xa530('0x6b')]['NO_AVAILABLE_CONTACTS'];logger['info']('[getContactCampaign2][Empty]'+_0x2b9f40[_0xa530('0x42')]);}else{_0x2b9f40['originated']+=_0x56d858[_0xa530('0x96')];_0x2b9f40[_0xa530('0x67')]=utils[_0xa530('0x6b')][_0xa530('0x206')];for(var _0x56d688=0x0;_0x56d688<_0x56d858[_0xa530('0x96')];_0x56d688+=0x1){_0x2b9f40[_0xa530('0x207')]+=0x1;if(_[_0xa530('0xf6')](_0x56d858[_0x56d688])||_[_0xa530('0xf6')](_0x56d858[_0x56d688][_0xa530('0x17e')])||_[_0xa530('0xf6')](_0x56d858[_0x56d688]['phone'])){_0x4aa6c4[_0xa530('0x158')]('[actionOriginate]\x20',_0x2b9f40,_0x56d858[_0x56d688]);}else{hopperUtils[_0xa530('0x208')](_['pick'](_0x56d858[_0x56d688],[_0xa530('0xe3'),_0xa530('0x165')]))[_0xa530('0x9c')](_0x4aa6c4[_0xa530('0x209')](_0x2b9f40,_0x56d858[_0x56d688]))[_0xa530('0x9f')](function(_0x46e255){logger[_0xa530('0x64')](_0xa530('0x20a'),_0x46e255);utils[_0xa530('0xcc')](_0x2b9f40,_0xa530('0x20b'));});}}}}})['catch'](function(_0x5b5bb6){_0x2b9f40[_0xa530('0x203')]=0x0;logger[_0xa530('0x64')](_0xa530('0x20c'),_0x5b5bb6);});}};Dialer[_0xa530('0x16')]['handlePower']=function(_0x43700c,_0x26e9f6){var _0x28603f=this;var _0xb482a2=[];if(_0x26e9f6<0x1||_0x43700c[_0xa530('0xaf')]===_0xa530('0x8')){_0x26e9f6=0x1;}var _0x9224d8=Math[_0xa530('0x1c5')](_0x43700c['available']*_0x26e9f6)-_0x43700c[_0xa530('0x7f')];if(_0x43700c[_0xa530('0x20d')]>0x0){var _0x1bf2ef=_0x43700c[_0xa530('0x20d')]-_0x43700c[_0xa530('0x7f')]-_0x43700c['talking']-_0x43700c[_0xa530('0x148')];if(_0x9224d8>_0x1bf2ef){_0x9224d8=_0x1bf2ef;}}if(_0x9224d8>0x0&&_0x43700c[_0xa530('0x203')]==0x0){if(_0x43700c[_0xa530('0xaf')]===_0xa530('0x8')){_0x9224d8=0x1;}if(_0x9224d8>this['maxNumberOriginate']){_0x9224d8=this[_0xa530('0x1e')];}for(var _0x4c757d in this['agents']){if(typeof this['agents'][_0x4c757d]!==_0xa530('0xaa')){if(this[_0xa530('0x1c')][_0x4c757d][_0xa530('0x6d')]==='not_inuse'&&this['agents'][_0x4c757d][_0xa530('0x86')]===_0xa530('0x87')){_0xb482a2[_0xa530('0x97')](this[_0xa530('0x1c')][_0x4c757d]['id']);}}}_0x43700c[_0xa530('0x203')]=0x1;hopperUtils[_0xa530('0x20e')](_0x43700c,_0xb482a2,_0x9224d8)[_0xa530('0x9c')](function(_0x47288d){_0x43700c[_0xa530('0x203')]=0x0;if(_0x47288d){if(!utils[_0xa530('0x205')](_0x47288d)){hopperUtils['countReScheduled'](_0x43700c)[_0xa530('0x9c')](sendMessageReschedule(_0x43700c))[_0xa530('0x9f')](loggerCatch('[countReScheduled]\x20'));}else{_0x43700c[_0xa530('0x7f')]+=_0x47288d[_0xa530('0x96')];_0x43700c[_0xa530('0x67')]=_0x43700c[_0xa530('0xaf')]===_0xa530('0x8')?utils[_0xa530('0x6b')][_0xa530('0x16e')]:utils[_0xa530('0x6b')][_0xa530('0x206')];for(var _0x5e8efd=0x0;_0x5e8efd<_0x47288d[_0xa530('0x96')];_0x5e8efd+=0x1){if(_[_0xa530('0xf6')](_0x47288d[_0x5e8efd])||_[_0xa530('0xf6')](_0x47288d[_0x5e8efd]['Contact'])||_[_0xa530('0xf6')](_0x47288d[_0x5e8efd][_0xa530('0x165')])){_0x28603f[_0xa530('0x158')](_0xa530('0x20f'),_0x43700c,_0x47288d[_0x5e8efd]);}else{hopperUtils['checkIsBlackList'](_[_0xa530('0x102')](_0x47288d[_0x5e8efd],[_0xa530('0xe2'),_0xa530('0x165')]))[_0xa530('0x9c')](_0x28603f[_0xa530('0x209')](_0x43700c,_0x47288d[_0x5e8efd]))['catch'](function(_0x5a7968){logger['error']('[actionOriginate]',_0x5a7968);utils['decrementOriginate'](_0x43700c,_0xa530('0x210'));});}}}}})[_0xa530('0x9f')](function(_0x327cf4){_0x43700c[_0xa530('0x203')]=0x0;logger[_0xa530('0x64')](_0xa530('0x20c'),_0x327cf4);});}};Dialer[_0xa530('0x16')]['handlePredictive']=function(_0x1d0662){if(_0x1d0662['dialLimitQueue']>0x0){var _0x5c42cf=_0x1d0662[_0xa530('0x20d')]-_0x1d0662[_0xa530('0x7f')]-_0x1d0662[_0xa530('0x147')];if(_0x5c42cf>0x0&&_0x1d0662[_0xa530('0x203')]==0x0){this['tryOriginatePredictive'](_0x1d0662);}else{loggerPredictiveCalls[_0xa530('0x45')](_0xa530('0x211'));}}else{this[_0xa530('0x212')](_0x1d0662);}};Dialer['prototype'][_0xa530('0x212')]=function(_0x2b4df5){var _0x5ce1f8=this;var _0x33e3e4=[];_0x2b4df5['originated']+=0x1;for(var _0x25f62b in this[_0xa530('0x1c')]){if(typeof this['agents'][_0x25f62b]!=='undefined'){if(this[_0xa530('0x1c')][_0x25f62b][_0xa530('0x6d')]===_0xa530('0x213')&&this[_0xa530('0x1c')][_0x25f62b][_0xa530('0x86')]===_0xa530('0x87')){_0x33e3e4['push'](this[_0xa530('0x1c')][_0x25f62b]['id']);}}}_0x2b4df5['temp']=0x1;return this[_0xa530('0x20e')](_0x2b4df5['id'],_0x33e3e4,0x1,_0x2b4df5[_0xa530('0x214')],_0x2b4df5)[_0xa530('0x9c')](function(_0xd3118b){_0x2b4df5['temp']=0x1;if(_0xd3118b){if(!utils[_0xa530('0x205')](_0xd3118b)){utils['checkContactLowerLimitOriginate'](_0x2b4df5,0x1,0x0);return hopperUtils['countReScheduled'](_0x2b4df5)['then'](sendMessageReschedule(_0x2b4df5))['catch'](loggerCatch(_0xa530('0x215')));}else{_0x2b4df5[_0xa530('0x67')]=utils[_0xa530('0x6b')][_0xa530('0x206')];if(_[_0xa530('0xf6')](_0xd3118b[0x0])||_[_0xa530('0xf6')](_0xd3118b[0x0][_0xa530('0x17e')])||_[_0xa530('0xf6')](_0xd3118b[0x0][_0xa530('0x165')])){_0x5ce1f8[_0xa530('0x158')](_0xa530('0x20f'),_0x2b4df5,_0xd3118b[0x0]);}else{return hopperUtils[_0xa530('0x216')](_[_0xa530('0x102')](_0xd3118b[0x0],[_0xa530('0xe2'),'phone']))[_0xa530('0x9c')](_0x5ce1f8[_0xa530('0x209')](_0x2b4df5,_0xd3118b[0x0]))[_0xa530('0x9f')](function(_0xb80bce){logger[_0xa530('0x64')](_0xa530('0x217'),_0xb80bce);utils[_0xa530('0xcc')](_0x2b4df5,_0xa530('0x217'));});}}}})['catch'](function(_0x2c76a2){_0x2b4df5[_0xa530('0x203')]=0x0;logger[_0xa530('0x64')](_0xa530('0x20c'),_0x2c76a2);});};Dialer[_0xa530('0x16')][_0xa530('0x1db')]=function(_0x1b9938,_0x42a190,_0x131493,_0x3be4c1,_0x447f5f,_0x4b205f){loggerPredictive[_0xa530('0x45')](_0xa530('0x218'));loggerPredictive[_0xa530('0x45')](_0xa530('0x219'),_0x1b9938);loggerPredictive[_0xa530('0x45')](_0xa530('0x21a'),_0x42a190);loggerPredictive[_0xa530('0x45')](_0xa530('0x21b'),_0x131493);loggerPredictive[_0xa530('0x45')](_0xa530('0x21c'),_0x3be4c1);loggerPredictive[_0xa530('0x45')](_0xa530('0x21d'),_0x447f5f);loggerPredictive[_0xa530('0x45')](_0xa530('0x51'));return new Promise(function(_0x1407a7,_0x1c36d9){if(_0x1b9938<=0x0||isNaN(_0x1b9938)){return _0x1c36d9(msgResponse(_0xa530('0x21e'),_0xa530('0x83'),'m\x20=\x20'+_0x1b9938));}if(_0x131493<=0x0||isNaN(_0x131493)){return _0x1c36d9(msgResponse('[abandonmentRate]','Error',_0xa530('0x21f')+_0x131493));}if(_0x3be4c1<=0x0||isNaN(_0x3be4c1)){return _0x1c36d9(msgResponse(_0xa530('0x21e'),_0xa530('0x83'),_0xa530('0x220')+_0x3be4c1));}if(_0x42a190<=0x0||isNaN(_0x42a190)){return _0x1c36d9(msgResponse(_0xa530('0x21e'),'Error','interval\x20=\x20'+_0x42a190));}if(_0x447f5f<=0x0||isNaN(_0x447f5f)){return _0x1c36d9(msgResponse(_0xa530('0x21e'),_0xa530('0x83'),'Amax\x20=\x20'+_0x447f5f));}_0x4b205f=_0x4b205f||0x0;var _0xc101ed=0x1/_0x131493;var _0x35e857=0x0;var _0x4bd675=0x0;var _0x1f8abe=0x0;var _0x79bdc8=0x0;for(var _0x4757a7=0x0;_0x1f8abe<_0x447f5f;_0x4757a7+=0x1){_0x4bd675=_0x4757a7/_0x42a190;_0x35e857=(_0x3be4c1*_0x4bd675+_0x4b205f)/_0xc101ed;_0x1f8abe=utils[_0xa530('0x221')](_0x35e857,_0x1b9938);_0x79bdc8=_0x35e857/_0x1b9938*(0x1-utils['erlangb'](_0x35e857,_0x1b9938));}return _0x1407a7({'erlangCalls':_0x4757a7,'erlangCallToSecond':_0x42a190/_0x4757a7,'erlangAbandonmentRate':_0x1f8abe,'erlangBusyFactor':_0x79bdc8});});};Dialer[_0xa530('0x16')][_0xa530('0x1dc')]=function(_0x415fdc,_0x579a9e,_0x2cef55,_0x38f4d6,_0x6707ea,_0x367c0b){loggerPredictive[_0xa530('0x45')](_0xa530('0x222'));loggerPredictive[_0xa530('0x45')](_0xa530('0x219'),_0x415fdc);loggerPredictive['info'](_0xa530('0x21a'),_0x579a9e);loggerPredictive[_0xa530('0x45')](_0xa530('0x21b'),_0x2cef55);loggerPredictive[_0xa530('0x45')](_0xa530('0x21c'),_0x38f4d6);loggerPredictive[_0xa530('0x45')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6707ea);loggerPredictive[_0xa530('0x45')](_0xa530('0x51'));return new Promise(function(_0x477f35,_0x5c2f28){if(_0x415fdc<=0x0||isNaN(_0x415fdc)){return _0x5c2f28(msgResponse(_0xa530('0x223'),_0xa530('0x83'),'m\x20=\x20'+_0x415fdc));}if(_0x2cef55<=0x0||isNaN(_0x2cef55)){return _0x5c2f28(msgResponse('[busyFactor]',_0xa530('0x83'),'Ts\x20=\x20'+_0x2cef55));}if(_0x38f4d6<=0x0||isNaN(_0x38f4d6)){return _0x5c2f28(msgResponse(_0xa530('0x223'),'Error','p\x20=\x20'+_0x38f4d6));}if(_0x579a9e<=0x0||isNaN(_0x579a9e)){return _0x5c2f28(msgResponse('[busyFactor]','Error',_0xa530('0x224')+_0x579a9e));}if(_0x6707ea<=0x0||isNaN(_0x6707ea)){return _0x5c2f28(msgResponse('[busyFactor]','Error','Umin\x20=\x20'+_0x6707ea));}_0x367c0b=_0x367c0b||0x0;var _0x772328=0x1/_0x2cef55;var _0x506f15=0x0;var _0x2a7d46=0x0;var _0x1efae5=0x0;var _0x36c1f0=0x0;for(var _0x58d2c0=0x0;_0x36c1f0<_0x6707ea;_0x58d2c0+=0x1){_0x2a7d46=_0x58d2c0/_0x579a9e;_0x506f15=(_0x38f4d6*_0x2a7d46+_0x367c0b)/_0x772328;_0x1efae5=utils[_0xa530('0x221')](_0x506f15,_0x415fdc);_0x36c1f0=_0x506f15/_0x415fdc*(0x1-utils[_0xa530('0x221')](_0x506f15,_0x415fdc));}return _0x477f35({'erlangCalls':_0x58d2c0,'erlangCallToSecond':_0x579a9e/_0x58d2c0,'erlangAbandonmentRate':_0x1efae5,'erlangBusyFactor':_0x36c1f0});});};module[_0xa530('0x225')]=Dialer; \ No newline at end of file +var _0xb66c=['Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','\x20Interval\x20is\x20overtime:\x20','silly','AMI\x20IfTime','queue','uniqueId','uniqueid','[syncAgentConnect]','answertime','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','ivr','[syncQueueCallerAbandon]','droptime','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','CampaignId','channel','actionid','roundrobin','isNil','locked','paused','stateinterface','queueBooked','strategy','rrmemory','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','decrementOriginate','[syncQueueStatusComplete]','VoiceQueueId','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','countnoanswerretry','countnosuchnumberretry','createStateFinal','reason\x2019\x20machine....','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','[syncHangup2]','[syncHangup][createHistory]','queuesSummary','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','queueSummaryCountersUpdated','assign','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','enqueue','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','Agent','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','getCaller','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','TrunkBackup','dialOriginateCallerIdName','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','object','reason','outboundNoSuchCallsDay','NoSuchNumber','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','agentBusyFactor','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','checkIsBlackList','[actionOriginate]','[handlePower]','[handlePredictive][limitChannel]','tryOriginatePredictive','getContactDialer','checkContactLowerLimitOriginate','Contact','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','interval\x20=\x20','Amax\x20=\x20','busyFactor','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','p\x20=\x20','Umin\x20=\x20','erlangb','util','uuid','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','getSettings','previewRecallmeReminderInterval','emit','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','predictiveIntervalTotalCalls','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','erlangAbandonmentRate','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','isIVRCampaignActive','isIVRCampaign','campaign:save','originated','sendMessageOneNotActive','INACTIVE','is\x20not\x20active','DISACTIVED','is\x20deactivated','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','then','content','true','catch','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','power','booked','Queue','method\x20not\x20recognized','dialTimezone','Dialer::ifTime()'];(function(_0x3563fc,_0x73403c){var _0x40bb72=function(_0x3882be){while(--_0x3882be){_0x3563fc['push'](_0x3563fc['shift']());}};_0x40bb72(++_0x73403c);}(_0xb66c,0x175));var _0xcb66=function(_0x90db76,_0x2ed8ff){_0x90db76=_0x90db76-0x0;var _0x1bb292=_0xb66c[_0x90db76];return _0x1bb292;};'use strict';var util=require(_0xcb66('0x0'));var _=require('lodash');var uuid=require(_0xcb66('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require(_0xcb66('0x2'));var utils=require(_0xcb66('0x3'));var hopperUtils=require(_0xcb66('0x4'));var ut=require('../preview/util/util');var config=require(_0xcb66('0x5'));var logger=require(_0xcb66('0x6'))(_0xcb66('0x7'));var loggerBooked=require(_0xcb66('0x6'))('booked');var loggerPredictive=require('../../../config/logger')(_0xcb66('0x8'));var loggerPredictiveCalls=require(_0xcb66('0x6'))(_0xcb66('0x9'));var loggerSyncQueueSummary=require(_0xcb66('0x6'))(_0xcb66('0xa'));var ami=require('../ami');config[_0xcb66('0xb')]=_[_0xcb66('0xc')](config[_0xcb66('0xb')],{'host':_0xcb66('0xd'),'port':0x18eb});var io=require(_0xcb66('0xe'))(new Redis(config['redis']));var cmHopper=require(_0xcb66('0xf'));var voiceQueueRt=require(_0xcb66('0x10'));var RpcSetting=require(_0xcb66('0x11'));var Interval=require(_0xcb66('0x12'));var Action=require('./models/action');var History=require(_0xcb66('0x13'));var Final=require(_0xcb66('0x14'));var AgentComplete=require(_0xcb66('0x15'));var QueueCallerAbandon=require(_0xcb66('0x16'));var Hangup=require('./models/hangup');var ipAgi=process[_0xcb66('0x17')][_0xcb66('0x18')]||_0xcb66('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xcb66('0x1a')]['enqueue']=function(_0x19072b){this['tail']=this[_0xcb66('0x1b')]?this['tail'][_0xcb66('0x1c')](_0x19072b):_0x19072b();};function Dialer(_0x573dc7,_0x4bef09){this[_0xcb66('0x1d')]=new Sequence();this[_0xcb66('0x1e')]=_0x4bef09;this[_0xcb66('0x1f')]=_0x573dc7[_0xcb66('0x1f')];this['campaigns']=_0x573dc7[_0xcb66('0x20')];this[_0xcb66('0x21')]=_0x573dc7[_0xcb66('0x21')];this['trunks']=_0x573dc7[_0xcb66('0x22')];this['maxNumberOriginate']=config[_0xcb66('0x23')]||0x2;this[_0xcb66('0x24')]={};this[_0xcb66('0x25')]={};this[_0xcb66('0x26')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0xcb66('0x27')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xcb66('0x28')]={};this['queuesSummary']={};ami['on'](_0xcb66('0x29'),this[_0xcb66('0x2a')][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x2c'),this[_0xcb66('0x2d')][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x2e'),this['syncOriginateResponse'][_0xcb66('0x2b')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x2f'),this[_0xcb66('0xa')]['bind'](this));ami['on'](_0xcb66('0x30'),this[_0xcb66('0x31')][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x32'),this['syncHangup'][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x33'),this[_0xcb66('0x34')][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x35'),this[_0xcb66('0x36')][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x37'),this[_0xcb66('0x38')][_0xcb66('0x2b')](this));ami['on']('queuestatuscomplete',this[_0xcb66('0x39')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting[_0xcb66('0x3a')]()['then'](function(_0xb135e3){previewRecallmeReminderInterval=_0xb135e3[_0xcb66('0x3b')];});}function isNotNull(_0x1b8a79){return _0x1b8a79!==null&&!_['isUndefined'](_0x1b8a79);}function msgResponse(_0x123787,_0x1df50e,_0x266862){return{'action':_0x123787,'response':_0x1df50e,'message':_0x266862,'stack':_0x266862};}function emit(_0x311ede,_0xa411e3,_0x375636){io['to'](_0x311ede)[_0xcb66('0x3c')](_0xa411e3,_0x375636);}function emitOutboundVoiceQueueSummary(_0x36dfe3){if(_0x36dfe3[_0xcb66('0x3d')]===_0xcb66('0x3e')){logger['debug'](_0xcb66('0x3f'),util[_0xcb66('0x40')](_0x36dfe3,{'showHidden':![],'depth':null}));emit(util[_0xcb66('0x41')](_0xcb66('0x42'),_0x36dfe3[_0xcb66('0x43')]),_0xcb66('0x44'),_0x36dfe3);}}function checkGetDataPredictive(_0xec4052){if(isNotNull(_0xec4052)&&!_['isEmpty'](_0xec4052)){loggerPredictive[_0xcb66('0x45')](_0xcb66('0x46'));loggerPredictive[_0xcb66('0x45')](_0xcb66('0x47'),_0xec4052['predictiveIntervalTotalCalls']);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x48'),_0xec4052[_0xcb66('0x49')]);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x4a'),_0xec4052[_0xcb66('0x4b')]);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x4c'),_0xec4052[_0xcb66('0x4d')]);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x4e'),_0xec4052[_0xcb66('0x4f')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xec4052['predictiveIntervalAvgTalktime']);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x50'));if(_0xec4052[_0xcb66('0x51')]>0x0){if(!_[_0xcb66('0x52')](_0xec4052[_0xcb66('0x53')])&&_0xec4052[_0xcb66('0x53')]>0x0){return!![];}loggerPredictive['info'](_0xcb66('0x54'));if(!_['isUndefined'](_0xec4052['predictiveIntervalAvgHoldtime'])&&_0xec4052['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xcb66('0x45')](_0xcb66('0x55'));}else{loggerPredictive[_0xcb66('0x45')](_0xcb66('0x56'));}}else{loggerPredictive[_0xcb66('0x45')](_0xcb66('0x57'));}return![];}function mergeDataErlangB(_0x3422b6){return function(_0x1c119e){loggerPredictive[_0xcb66('0x45')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xcb66('0x45')](_0xcb66('0x58'),_0x1c119e[_0xcb66('0x59')]);loggerPredictive['info'](_0xcb66('0x5a'),_0x1c119e[_0xcb66('0x5b')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c119e[_0xcb66('0x5c')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c119e[_0xcb66('0x5d')]);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x5e'),_0x1c119e[_0xcb66('0x5c')]);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x50'));_[_0xcb66('0x5f')](_0x3422b6,_0x1c119e);};}function ifInterval(_0xff5ce5,_0x1b8f2e){if(_['isUndefined'](_0x1b8f2e)){return![];}return utils['getSeconds'](undefined,_0x1b8f2e)<_0xff5ce5*0x3c;}function clearPredictiveAttributes(_0x4e364d){if(_0x4e364d[_0xcb66('0x27')]){_0x4e364d['startProgressive']=undefined;loggerPredictive[_0xcb66('0x60')](_0x4e364d['name'],_0xcb66('0x61'));}if(_0x4e364d[_0xcb66('0x62')]){_0x4e364d[_0xcb66('0x62')]=undefined;loggerPredictive[_0xcb66('0x60')](_0x4e364d[_0xcb66('0x43')],_0xcb66('0x63'));}if(_0x4e364d['handlePredictive']){clearInterval(_0x4e364d['handlePredictive']);_0x4e364d[_0xcb66('0x64')]=undefined;loggerPredictive[_0xcb66('0x60')](_0x4e364d[_0xcb66('0x43')],_0xcb66('0x65'));}}function loggerCatchPredictive(_0xf2c532,_0x1c149b){return function(_0x1465df){loggerPredictive[_0xcb66('0x66')](_0x1c149b[_0xcb66('0x43')],_0xf2c532);loggerPredictive['error'](_0x1465df[_0xcb66('0x67')]);clearPredictiveAttributes(_0x1c149b);};}function loggerCatch(_0x29dd1f){return function(_0x4370ff){logger[_0xcb66('0x66')](_0x29dd1f,util['inspect'](_0x4370ff,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x18ec73){return function(_0x2f9fb5){if(isNotNull(_0x2f9fb5)&&isNotNull(_0x2f9fb5[0x0])){if(_0x2f9fb5[0x0][_0xcb66('0x68')]>0x0){_0x18ec73['message']=utils[_0xcb66('0x69')][_0xcb66('0x6a')];logger[_0xcb66('0x45')](_0xcb66('0x6b')+_0x18ec73['name'],_0x2f9fb5[0x0][_0xcb66('0x68')],_0xcb66('0x6c'));}else{_0x18ec73[_0xcb66('0x6d')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0xcb66('0x45')]('[getContactDialer2][Empty]'+_0x18ec73[_0xcb66('0x43')]);}}};}function createObjHistory(_0x55c6e4,_0x184653,_0x416448,_0x1bb017,_0x5c07c3){_0x55c6e4[_0xcb66('0x6d')]=_0x416448;var _0x5f01a2=new Action(_0x55c6e4,_0x184653);var _0x228504=new History(_0x5f01a2);_0x228504[_0xcb66('0x6e')]=_0x1bb017;_0x228504[_0xcb66('0x6f')]=_0x5c07c3;_0x228504[_0xcb66('0x70')]=_0x5f01a2[_0xcb66('0x71')];return _0x228504;}function unlockQueueStatus(_0x5369f8,_0x9017f4){setTimeout(function(){if(_['isUndefined'](_0x5369f8[_0xcb66('0x72')])){loggerBooked[_0xcb66('0x66')](_0xcb66('0x73'),_0x9017f4);}_0x5369f8['queueStatusComplete']=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x9017f4,JSON[_0xcb66('0x74')](_[_0xcb66('0x75')](_0x5369f8,[_0xcb66('0x43'),_0xcb66('0x72')])));},0x1f3);}function checkInterval(_0x196ffe){return function(){if(!isNotNull(_0x196ffe[_0xcb66('0x76')])){_0x196ffe[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x77')];throw _0x196ffe[_0xcb66('0x43')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x196ffe[_0xcb66('0x76')][_0xcb66('0x78')])){_0x196ffe[_0xcb66('0x6d')]=utils[_0xcb66('0x69')]['NULL_INTERVAL'];throw _0x196ffe['name']+_0xcb66('0x79');}if(!isNotNull(_[_0xcb66('0x7a')](_0x196ffe[_0xcb66('0x76')][_0xcb66('0x78')]))){_0x196ffe[_0xcb66('0x6d')]=utils[_0xcb66('0x69')]['NULL_INTERVAL'];throw _0x196ffe[_0xcb66('0x43')]+_0xcb66('0x79');}};}function checkIsIVRCampaignActive(_0x83b627){return function(){if(!utils[_0xcb66('0x7b')](_0x83b627)){_0x83b627['message']=utils[_0xcb66('0x69')]['INACTIVE'];throw _0x83b627[_0xcb66('0x43')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x11e42d){if(utils[_0xcb66('0x7c')](_0x11e42d)){emit(util[_0xcb66('0x41')]('campaign:ivr:%s',_0x11e42d['name']),_0xcb66('0x7d'),_0x11e42d);}}function loggerCatchQueueSummary(_0x3ebc9a,_0x55ab08){return function(_0x557819){clearPredictiveAttributes(_0x55ab08);emitCampaignSummary(_0x55ab08);loggerSyncQueueSummary[_0xcb66('0x60')](_0x3ebc9a,util['inspect'](_0x557819,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3c9106){if(_0x3c9106['sendMessageOneNotActive']){if(_0x3c9106[_0xcb66('0x7e')]===0x0){_0x3c9106[_0xcb66('0x7f')]=![];_0x3c9106[_0xcb66('0x6d')]=utils['CAMPAIGN_STATUS'][_0xcb66('0x80')];loggerSyncQueueSummary[_0xcb66('0x60')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3c9106[_0xcb66('0x43')],_0xcb66('0x81'));}else{_0x3c9106[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x82')];loggerSyncQueueSummary[_0xcb66('0x60')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3c9106[_0xcb66('0x43')],_0xcb66('0x83'));}emitCampaignSummary(_0x3c9106);}}function myreject(_0x20466b){return function(_0x22438d){return _0x20466b(msgResponse(_0xcb66('0x84'),_0xcb66('0x85'),JSON[_0xcb66('0x74')](_0x22438d)));};}Dialer[_0xcb66('0x1a')][_0xcb66('0x86')]=function(_0x4ac2d1){return!_[_0xcb66('0x52')](_0x4ac2d1)&&_0x4ac2d1&&!_[_0xcb66('0x52')](_0x4ac2d1[_0xcb66('0x43')])&&!_[_0xcb66('0x52')](_0x4ac2d1[_0xcb66('0x87')])&&_0x4ac2d1[_0xcb66('0x87')]&&(this['trunks'][util[_0xcb66('0x41')](_0xcb66('0x88'),_0x4ac2d1['name'])][_0xcb66('0x89')]===_0xcb66('0x8a')||this[_0xcb66('0x22')][util[_0xcb66('0x41')]('SIP/%s',_0x4ac2d1[_0xcb66('0x43')])][_0xcb66('0x89')]===_0xcb66('0x8b'));};Dialer[_0xcb66('0x1a')][_0xcb66('0x8c')]=function(_0x16dc20){var _0x265534=this;return function(){if(!_0x265534[_0xcb66('0x86')](_0x16dc20[_0xcb66('0x8d')])){if(!_0x265534[_0xcb66('0x86')](_0x16dc20['TrunkBackup'])){_0x16dc20[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x8e')];throw _0x16dc20[_0xcb66('0x43')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0xcb66('0x1a')][_0xcb66('0x8f')]=function(_0x3f2605,_0x1c0533,_0x183381,_0x30d02f){var _0x185363=this;return function(){var _0x49f0b7=!![];return _0x185363['ifTimeIvr'](_0x3f2605,_0x1c0533,_0x183381,_0x30d02f,_0x49f0b7);};};Dialer[_0xcb66('0x1a')][_0xcb66('0x90')]=function(_0x17782a,_0x43fb09,_0xaef77,_0x11072c){var _0x5678a3=this;return function(){var _0x166372=![];return _0x5678a3[_0xcb66('0x91')](_0x17782a[_0xcb66('0x78')],_0x43fb09,_0xaef77,_0x11072c,_0x166372);};};Dialer[_0xcb66('0x1a')][_0xcb66('0x91')]=function(_0x16e0ec,_0x5eb8a8,_0x3bf094,_0x28b205,_0x28ad40){var _0x1fc4ac=[];return new Promise(function(_0xfddd73,_0x37051c){if(!isNotNull(_0x16e0ec)){_0x28b205[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x77')];return _0x37051c(msgResponse(_0xcb66('0x92'),_0xcb66('0x93'),_0x3bf094+_0xcb66('0x94')));}if(_[_0xcb66('0x7a')](_0x16e0ec)){_0x28b205[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x95')];return _0x37051c(msgResponse(_0xcb66('0x92'),_0xcb66('0x93'),_0x3bf094+_0xcb66('0x96')));}if(_0x5eb8a8&&_['isUndefined'](config[_0xcb66('0x97')][_0x5eb8a8])){_0x28b205['message']=utils[_0xcb66('0x69')]['UNKNOWN_TIMEZONE'];return _0x37051c(msgResponse(_0xcb66('0x92'),_0xcb66('0x93'),_0x3bf094+_0xcb66('0x98')+_0x5eb8a8));}if(_[_0xcb66('0x99')](_0x16e0ec)){for(var _0x1e13f0=0x0;_0x1e13f0<_0x16e0ec[_0xcb66('0x9a')];_0x1e13f0+=0x1){_0x1fc4ac[_0xcb66('0x9b')](ami[_0xcb66('0x9c')]({'action':_0xcb66('0x9d'),'command':util[_0xcb66('0x41')](_0xcb66('0x9e'),_0x16e0ec[_0x1e13f0][_0xcb66('0x9f')],!_[_0xcb66('0x52')](config['timezones'][_0x5eb8a8])?_0x5eb8a8:'')})[_0xcb66('0xa0')](function(_0x45b25e){return _0x45b25e[_0xcb66('0xa1')]['indexOf'](_0xcb66('0xa2'))>=0x0;})[_0xcb66('0xa3')](myreject(_0x37051c)));}}else{_0x1fc4ac[_0xcb66('0x9b')](ami['Action']({'action':_0xcb66('0x9d'),'command':util[_0xcb66('0x41')](_0xcb66('0x9e'),_0x16e0ec,!_[_0xcb66('0x52')](config[_0xcb66('0x97')][_0x5eb8a8])?_0x5eb8a8:'')})[_0xcb66('0xa0')](function(_0x49fe07){return _0x49fe07[_0xcb66('0xa1')]['indexOf'](_0xcb66('0xa2'))>=0x0;})['catch'](myreject(_0x37051c)));}Promise[_0xcb66('0xa4')](_0x1fc4ac)['then'](function(_0x3b4c30){var _0x20fb30=_[_0xcb66('0xa5')](_0x3b4c30);if(_0x20fb30){return _0xfddd73(_0x20fb30);}else{_0x28b205['message']=_0x28ad40?utils[_0xcb66('0x69')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xcb66('0x69')][_0xcb66('0xa6')];return _0x37051c(msgResponse(_0xcb66('0xa7'),_0xcb66('0x93'),_0xcb66('0xa8')+_0x28ad40+'\x20'+_0x3bf094+'\x20Interval\x20is\x20overtime:\x20'+util[_0xcb66('0x40')](_0x16e0ec,{'showHidden':![],'depth':null})+_0xcb66('0xa9')+_0x5eb8a8));}})[_0xcb66('0xa3')](function(_0x456bea){return _0x37051c(msgResponse('ifTime',_0xcb66('0x93'),JSON[_0xcb66('0x74')](_0x456bea)));});});};Dialer['prototype'][_0xcb66('0xaa')]=function(){var _0x30b941=this;return cmHopper[_0xcb66('0xab')]({'active':![]},{'where':{'active':!![]}})[_0xcb66('0xa0')](function(){setInterval(function(){_0x30b941['syncCampaigns']();},0x3e8);});};Dialer[_0xcb66('0x1a')][_0xcb66('0xac')]=function(){var _0x2a7063=this;var _0x25ae78;for(var _0x2f6d70 in this['campaigns']){if(typeof this[_0xcb66('0x20')][_0x2f6d70]!==_0xcb66('0xad')){_0x25ae78=this[_0xcb66('0x20')][_0x2f6d70];if(utils[_0xcb66('0x7c')](_0x25ae78)&&utils[_0xcb66('0x7b')](_0x25ae78)){_0x25ae78[_0xcb66('0x7f')]=!![];Promise[_0xcb66('0xae')]()['then'](checkIsIVRCampaignActive(_0x25ae78))['then'](checkInterval(_0x25ae78))['then'](_0x2a7063[_0xcb66('0x8c')](_0x25ae78))[_0xcb66('0xa0')](_0x2a7063['checkIfTime'](_0x25ae78[_0xcb66('0xaf')],_0x25ae78['dialTimezone'],_0x25ae78[_0xcb66('0x43')],_0x25ae78))[_0xcb66('0xa0')](_0x2a7063[_0xcb66('0x90')](_0x25ae78[_0xcb66('0x76')],_0x25ae78['dialTimezone'],_0x25ae78[_0xcb66('0x43')],_0x25ae78))[_0xcb66('0xa0')](_0x2a7063[_0xcb66('0xb0')](_0x25ae78))[_0xcb66('0xa3')](loggerCatchQueueSummary(_0xcb66('0xb1'),_0x25ae78));}else{notSendMessagesCampaign(_0x25ae78);}}}};Dialer['prototype']['checkDialMethod']=function(_0x198c13){if(_0x198c13['dialMethod']!==_0xcb66('0x8')){clearPredictiveAttributes(_0x198c13);}switch(_0x198c13[_0xcb66('0xb2')]){case _0xcb66('0xb3'):this[_0xcb66('0xb4')](_0x198c13,0x1);break;case _0xcb66('0xb5'):this[_0xcb66('0xb4')](_0x198c13,_0x198c13['dialPowerLevel']);break;case _0xcb66('0x8'):this['predictive'](_0x198c13);break;case _0xcb66('0xb6'):this[_0xcb66('0xb4')](_0x198c13,0x1);break;default:logger[_0xcb66('0x66')](_0xcb66('0xb7'),_0x198c13[_0xcb66('0x43')],_0xcb66('0xb8'));}};Dialer['prototype'][_0xcb66('0x92')]=function(_0x2b73e3,_0x3980fa){var _0x2803d1=_0x2b73e3[_0xcb66('0xb9')];var _0x3f92c5=_0x3980fa?_0x2b73e3[_0xcb66('0xaf')]:_0x2b73e3[_0xcb66('0x76')]['Intervals'];logger['silly'](_0xcb66('0xba'),_0x3f92c5,_0x2803d1,_0x2b73e3[_0xcb66('0x43')],util['format'](_0xcb66('0xbb'),_0x2b73e3[_0xcb66('0x43')],_0x2b73e3['id']));var _0x5e6799=null;return Interval[_0xcb66('0xbc')](_0x3f92c5,_0x2803d1)['then'](function(_0x2c7884){if(_0x2c7884===!![]){return _0x2c7884;}else{_0x2b73e3[_0xcb66('0x6d')]=_0x3980fa?utils[_0xcb66('0x69')][_0xcb66('0xbd')]:utils[_0xcb66('0x69')]['OVERTIME_INTERVAL'];_0x5e6799=msgResponse('[ifTime][promiseAll]',_0xcb66('0x93'),_0xcb66('0xa8')+_0x3980fa+'\x20'+_0x2b73e3[_0xcb66('0x43')]+_0xcb66('0xbe')+util[_0xcb66('0x40')](_0x3f92c5,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x2803d1);}if(_0x5e6799!==null){logger[_0xcb66('0xbf')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x5e6799);_0x5e6799['isGlobal']=_0x3980fa;throw _0x5e6799;}})[_0xcb66('0xa3')](function(_0x565f6c){logger['error'](_0xcb66('0xc0'),_0x565f6c);throw msgResponse(_0xcb66('0x84'),'Error',util[_0xcb66('0x40')](_0x565f6c,{'showHidden':![],'depth':null}));});};Dialer[_0xcb66('0x1a')][_0xcb66('0x2a')]=function(_0x3acdeb){if(this[_0xcb66('0x1f')][_0x3acdeb[_0xcb66('0xc1')]]){if(this[_0xcb66('0xc2')][_0x3acdeb[_0xcb66('0xc3')]]&&this[_0xcb66('0xc2')][_0x3acdeb[_0xcb66('0xc3')]][_0xcb66('0x3d')]!=='ivr'){utils['decrementOriginate'](this[_0xcb66('0x1f')][_0x3acdeb[_0xcb66('0xc1')]],_0xcb66('0xc4'));this[_0xcb66('0xc2')][_0x3acdeb[_0xcb66('0xc3')]][_0xcb66('0xc5')]=moment()[_0xcb66('0x41')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xcb66('0x1a')]['syncAgentComplete']=function(_0x4f30c2){var _0x590640=this[_0xcb66('0xc2')][_0x4f30c2[_0xcb66('0xc3')]];if(this[_0xcb66('0x1f')][_0x4f30c2['queue']]){if(_0x590640&&_0x590640[_0xcb66('0x3d')]!=='ivr'){delete this['uniqueId'][_0x4f30c2[_0xcb66('0xc3')]];this[_0xcb66('0x1f')][_0x4f30c2[_0xcb66('0xc1')]][_0xcb66('0xc6')]+=0x1;var _0x2668f2=new AgentComplete(_0x590640,_0x4f30c2);if(_0x4f30c2['reason']===_0xcb66('0xc7')){_0x2668f2[_0xcb66('0xc8')]=this[_0xcb66('0x1f')][_0x4f30c2[_0xcb66('0xc1')]][_0xcb66('0xc9')]&&this[_0xcb66('0x1f')][_0x4f30c2[_0xcb66('0xc1')]]['dialAgiAfterHangupAgent']?moment()[_0xcb66('0x41')](_0xcb66('0xca')):undefined;}hopperUtils[_0xcb66('0xcb')](_0x2668f2)['catch'](loggerCatch(_0xcb66('0xcc')));hopperUtils[_0xcb66('0xcd')](_0x2668f2)['catch'](loggerCatch(_0xcb66('0xce')));}}};Dialer[_0xcb66('0x1a')][_0xcb66('0x2d')]=function(_0x4eef77){var _0x2b398b=this[_0xcb66('0xc2')][_0x4eef77[_0xcb66('0xc3')]];var _0x20870d=this;var _0x25f06c=![];var _0x5b2e1d;var _0x1a175a;if(this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]]){if(_0x2b398b&&_0x2b398b[_0xcb66('0x3d')]!==_0xcb66('0xcf')){delete this[_0xcb66('0xc2')][_0x4eef77['uniqueid']];utils['decrementOriginate'](this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]],_0xcb66('0xd0'));_0x2b398b[_0xcb66('0xd1')]=moment()[_0xcb66('0x41')](_0xcb66('0xca'));var _0x5d84cb=new QueueCallerAbandon(_0x2b398b,_0x4eef77);if(utils[_0xcb66('0xd2')](_0x2b398b[_0xcb66('0xd1')],_0x2b398b[_0xcb66('0xd3')])>=_0x2b398b[_0xcb66('0xd4')]){this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0x4b')]+=0x1;this['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xd5')]+=0x1;this[_0xcb66('0x1f')][_0x4eef77['queue']][_0xcb66('0xd6')]+=0x1;_0x5d84cb[_0xcb66('0x6e')]=0xa;_0x5d84cb['statedesc']='Drop';_0x5d84cb[_0xcb66('0xd7')]=_0xcb66('0xd8');_0x5d84cb[_0xcb66('0xc8')]=this['voiceQueues'][_0x4eef77['queue']][_0xcb66('0xc9')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x5d84cb[_0xcb66('0xd9')]+=0x1;_0x5d84cb['countglobal']+=0x1;_0x5b2e1d=this['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xda')];_0x1a175a=this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xdb')];hopperUtils[_0xcb66('0xdc')](_0x5d84cb,_0x5d84cb[_0xcb66('0x6e')],_0x2b398b[_0xcb66('0xdd')])['then'](function(_0x12f0b3){_0x25f06c=_0x12f0b3[_0xcb66('0xde')]==0x1;if(_0x5d84cb[_0xcb66('0xd9')]>=_0x20870d[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xdf')]){_0x20870d[_0xcb66('0xe0')](_0x5d84cb,_0x12f0b3[_0xcb66('0xde')]);}else{hopperUtils[_0xcb66('0xe1')]({'active':![],'countdropretry':_0x5d84cb[_0xcb66('0xd9')],'scheduledat':moment()[_0xcb66('0xe2')](_0x20870d[_0xcb66('0x1f')][_0x4eef77['queue']][_0xcb66('0xda')],_0xcb66('0xe3'))[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0x2b398b[_0xcb66('0xe4')],'ListId':_0x2b398b[_0xcb66('0xe5')],'VoiceQueueId':_0x2b398b['VoiceQueueId']||undefined,'CampaignId':_0x2b398b['CampaignId']||undefined})['catch'](loggerCatch(_0xcb66('0xe6')));var _0x5ab121=new History(_0x5d84cb);_0x5ab121['state']=0xa;_0x5ab121[_0xcb66('0x6f')]=_0xcb66('0xe7');_0x5ab121[_0xcb66('0x71')]=moment()[_0xcb66('0x41')](_0xcb66('0xca'));_0x5ab121[_0xcb66('0x70')]=_0x5ab121[_0xcb66('0x71')];_0x5ab121[_0xcb66('0xe8')]=_0x5d84cb['calleridname'];_0x5ab121[_0xcb66('0xe9')]=_0x5d84cb[_0xcb66('0xe9')];hopperUtils[_0xcb66('0xcb')](_0x5ab121)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0xea')));}})[_0xcb66('0xa0')](function(){if(_0x25f06c)hopperUtils[_0xcb66('0xeb')](_0x5d84cb,_0x5b2e1d,_0x1a175a)[_0xcb66('0xa0')](function(){return 0x1;});});}else{this['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0x4d')]+=0x1;this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xec')]+=0x1;_0x5d84cb[_0xcb66('0x6e')]=0xb;_0x5d84cb[_0xcb66('0x6f')]=_0xcb66('0xed');_0x5d84cb[_0xcb66('0xd7')]='CALLEREXIT';_0x5d84cb[_0xcb66('0xee')]+=0x1;_0x5d84cb[_0xcb66('0xef')]+=0x1;_0x5b2e1d=this['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xf0')];_0x1a175a=this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xdb')];hopperUtils[_0xcb66('0xdc')](_0x5d84cb,_0x5d84cb[_0xcb66('0x6e')],_0x2b398b['voiceQueue'])[_0xcb66('0xa0')](function(_0x55f652){if(_0x5d84cb['countabandonedretry']>=_0x20870d['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xf1')]){_0x20870d[_0xcb66('0xe0')](_0x5d84cb,_0x55f652[_0xcb66('0xde')]);}else{hopperUtils[_0xcb66('0xe1')]({'active':![],'countabandonedretry':_0x5d84cb[_0xcb66('0xee')],'scheduledat':moment()[_0xcb66('0xe2')](_0x20870d['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xf0')],_0xcb66('0xe3'))[_0xcb66('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b398b[_0xcb66('0xe4')],'ListId':_0x2b398b['ListId'],'VoiceQueueId':_0x2b398b['VoiceQueueId']||undefined,'CampaignId':_0x2b398b[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x459977=new History(_0x5d84cb);_0x459977[_0xcb66('0x6e')]=0xb;_0x459977[_0xcb66('0x6f')]=_0xcb66('0xed');_0x459977['starttime']=moment()[_0xcb66('0x41')](_0xcb66('0xca'));_0x459977[_0xcb66('0x70')]=_0x459977[_0xcb66('0x71')];_0x459977['calleridname']=_0x5d84cb[_0xcb66('0xe8')];_0x459977['calleridnum']=_0x5d84cb[_0xcb66('0xe9')];hopperUtils[_0xcb66('0xcb')](_0x459977)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x25f06c)hopperUtils[_0xcb66('0xeb')](_0x5d84cb,_0x5b2e1d,_0x1a175a)[_0xcb66('0xa0')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xcb66('0x34')]=function(_0x2b8f94){if(this['actions'][_0x2b8f94[_0xcb66('0xc3')]]){this[_0xcb66('0x25')][_0x2b8f94[_0xcb66('0xc3')]][_0xcb66('0xf3')]=_0x2b8f94[_0xcb66('0xf3')];}if(this[_0xcb66('0xc2')][_0x2b8f94[_0xcb66('0xc3')]]){this[_0xcb66('0xc2')][_0x2b8f94['uniqueid']][_0xcb66('0xf3')]=_0x2b8f94[_0xcb66('0xf3')];}};Dialer[_0xcb66('0x1a')][_0xcb66('0x38')]=function(_0x22c74e){if(!this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]]){return;}var _0x5b8d8d=this[_0xcb66('0x1f')][this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xc1')]]['strategy']||'rrmemory';if(_0x5b8d8d===_0xcb66('0xf5')){if(this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]]&&_[_0xcb66('0xf6')](this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xf7')])&&_0x22c74e[_0xcb66('0x89')]==='1'&&_0x22c74e[_0xcb66('0xf8')]==='0'){if(this[_0xcb66('0x21')][_0x22c74e[_0xcb66('0xf9')]]){if(!this[_0xcb66('0x21')][_0x22c74e['stateinterface']]['locked']){this['agents'][_0x22c74e[_0xcb66('0xf9')]][_0xcb66('0xf7')]=!![];this[_0xcb66('0x25')][_0x22c74e['actionid']][_0xcb66('0xf7')]=!![];this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xf9')]=_0x22c74e['stateinterface'];}}}}else if(_0x5b8d8d==='rrmemory'){if(this[_0xcb66('0x25')][_0x22c74e['actionid']]){if(this[_0xcb66('0x21')][_0x22c74e[_0xcb66('0xf9')]]){this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xf9')]=_0x22c74e[_0xcb66('0xf9')];if(_[_0xcb66('0xf6')](this['queueBooked'][this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xc1')]])){this[_0xcb66('0xfa')][this['actions'][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xc1')]]=[];}this[_0xcb66('0xfa')][this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xc1')]][_0xcb66('0x9b')](_[_0xcb66('0x5f')](_[_0xcb66('0x75')](this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]],['idHopper',_0xcb66('0xf9')]),{'status':_0x22c74e[_0xcb66('0x89')],'paused':_0x22c74e[_0xcb66('0xf8')]}));}}}};Dialer[_0xcb66('0x1a')][_0xcb66('0x39')]=function(_0x6d4f38){if(!this['actions'][_0x6d4f38[_0xcb66('0xf4')]]){return;}var _0xf593ec=this;var _0x53a4d1=this[_0xcb66('0x1f')][this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]]['queue']];var _0x4ef54f=_0x53a4d1[_0xcb66('0xfb')]||_0xcb66('0xfc');if(_0x4ef54f==='roundrobin'){if(this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]]&&this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xf9')]){this['preview'][_0xcb66('0xfd')](this[_0xcb66('0x25')][_0x6d4f38['actionid']][_0xcb66('0xfe')],this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xf9')])[_0xcb66('0xa3')](function(_0x46eb02){logger['error'](_0xcb66('0xff'),util['inspect'](_0x46eb02,{'showHidden':![],'depth':null}));})[_0xcb66('0x1c')](function(){utils[_0xcb66('0x100')](_0xf593ec['voiceQueues'][_0xf593ec[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]],'[syncQueueStatusComplete]');_0xf593ec[_0xcb66('0x21')][_0xf593ec[_0xcb66('0x25')][_0x6d4f38['actionid']][_0xcb66('0xf9')]][_0xcb66('0xf7')]=![];delete _0xf593ec[_0xcb66('0x25')][_0x6d4f38['actionid']];unlockQueueStatus(_0x53a4d1);});}else{utils[_0xcb66('0x100')](this[_0xcb66('0x1f')][this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]],_0xcb66('0x101'));hopperUtils[_0xcb66('0xe1')]({'active':![],'ContactId':this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xe4')],'ListId':this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xe5')],'VoiceQueueId':this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0x102')]||undefined,'CampaignId':this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xcb66('0x25')][_0x6d4f38['actionid']];unlockQueueStatus(_0x53a4d1);}}else if(_0x4ef54f===_0xcb66('0xfc')){var _0x14d72b;if(this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]]&&!_[_0xcb66('0x7a')](this[_0xcb66('0xfa')][this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]])){if(this[_0xcb66('0x28')][_0xf593ec['actions'][_0x6d4f38[_0xcb66('0xf4')]]['queue']]){this['queueBookedRR'][_0xf593ec[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]]=this[_0xcb66('0x28')][this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]]?this['queueBookedRR'][this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]]:this[_0xcb66('0xfa')][this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]]?this[_0xcb66('0xfa')][this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]][_0xcb66('0x103')]||0x0:0x0;}this[_0xcb66('0xfa')][this['actions'][_0x6d4f38[_0xcb66('0xf4')]]['queue']][_0xcb66('0x103')]=this[_0xcb66('0x28')][this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]];for(var _0xe99299=0x0;_0xe99299=_0x4a719a[_0xcb66('0x12b')]){_0x7290b5[_0xcb66('0x12c')](_0x5c5b35,_0x42684a,_0x2cb3b3,_0xcb66('0x12d'));}else{if(_0x5c5b35[_0xcb66('0x125')]>=_0x4a719a[_0xcb66('0x12e')]){_0x7290b5['createStateFinal'](_0x5c5b35,_0x42684a,_0x2cb3b3,'reason\x2019\x20machine....');}else{hopperUtils[_0xcb66('0xe1')]({'active':![],'countmachineretry':_0x5c5b35['countmachineretry'],'scheduledat':moment()[_0xcb66('0xe2')](_0x4a719a[_0xcb66('0x12f')],'minutes')[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0x5c5b35['ContactId'],'ListId':_0x5c5b35[_0xcb66('0xe5')],'VoiceQueueId':_0x5c5b35[_0xcb66('0x102')]||undefined,'CampaignId':_0x5c5b35[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x130')));_0x42684a({'reschedule':0x1});}}});}if(_0x28727c[_0xcb66('0x3d')]===_0xcb66('0xcf')&&this['campaigns'][_0x28727c[_0xcb66('0xc1')]][_0xcb66('0x118')]&&_0xec6e1d[_0xcb66('0x119')]==='HANGUP'){delete this['uniqueId'][_0xec6e1d[_0xcb66('0xc3')]];utils['decrementOriginate'](this[_0xcb66('0x20')][_0x28727c[_0xcb66('0xc1')]],_0xcb66('0x11b'));_0x307f7e=new Hangup(_0x28727c,_0xec6e1d);_0x307f7e['state']=0x12;_0x307f7e[_0xcb66('0x6f')]=_0xcb66('0x11d');_0x307f7e['membername']=_0xcb66('0x11f');ami[_0xcb66('0x3c')]('custom:amd',ut[_0xcb66('0x126')](_0x307f7e,_0xcb66('0x121')));this[_0xcb66('0x122')](_0x307f7e,_0xcb66('0x131'),_0xcb66('0x132'));}if(_0x28727c[_0xcb66('0x3d')]===_0xcb66('0xcf')&&this[_0xcb66('0x20')][_0x28727c[_0xcb66('0xc1')]][_0xcb66('0x118')]&&_0xec6e1d['value']===_0xcb66('0x133')){return new Promise(function(_0x3757db,_0x339346){delete _0x7290b5['uniqueId'][_0xec6e1d[_0xcb66('0xc3')]];utils[_0xcb66('0x100')](_0x7290b5[_0xcb66('0x20')][_0x28727c['queue']],_0xcb66('0x11b'));_0x7290b5[_0xcb66('0x20')][_0x28727c[_0xcb66('0xc1')]][_0xcb66('0xc6')]+=0x1;_0x7290b5[_0xcb66('0x20')][_0x28727c[_0xcb66('0xc1')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x2a380e=_0x7290b5[_0xcb66('0x20')][_0x28727c['queue']];var _0x49ccd2=new Hangup(_0x28727c,_0xec6e1d);_0x49ccd2[_0xcb66('0x6e')]=0x13;_0x49ccd2[_0xcb66('0x6f')]=_0xcb66('0x134');_0x49ccd2[_0xcb66('0x11e')]=_0xcb66('0x11f');_0x49ccd2[_0xcb66('0x125')]+=0x1;_0x49ccd2['countglobal']+=0x1;_0x49ccd2[_0xcb66('0x121')]=!![];ami[_0xcb66('0x3c')]('custom:amd',ut[_0xcb66('0x126')](_0x49ccd2,'amd'));hopperUtils['createHistory'](_0x49ccd2)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x127')));if(_0x49ccd2[_0xcb66('0x128')]+_0x49ccd2[_0xcb66('0x129')]+_0x49ccd2[_0xcb66('0x135')]+_0x49ccd2[_0xcb66('0x136')]+_0x49ccd2[_0xcb66('0xd9')]+_0x49ccd2[_0xcb66('0xee')]+_0x49ccd2[_0xcb66('0x125')]+_0x49ccd2[_0xcb66('0x12a')]>=_0x2a380e[_0xcb66('0x12b')]){_0x7290b5['stateGlobal'](_0x49ccd2,_0x3757db,_0x339346,_0xcb66('0x12d'));}else{if(_0x49ccd2[_0xcb66('0x125')]>=_0x2a380e[_0xcb66('0x12e')]){_0x7290b5[_0xcb66('0x137')](_0x49ccd2,_0x3757db,_0x339346,_0xcb66('0x138'));}else{hopperUtils[_0xcb66('0xe1')]({'active':![],'countmachineretry':_0x49ccd2[_0xcb66('0x125')],'scheduledat':moment()[_0xcb66('0xe2')](_0x2a380e['dialMachineRetryFrequency'],_0xcb66('0xe3'))[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0x49ccd2[_0xcb66('0xe4')],'ListId':_0x49ccd2['ListId'],'VoiceQueueId':_0x49ccd2[_0xcb66('0x102')]||undefined,'CampaignId':_0x49ccd2[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x130')));_0x3757db({'reschedule':0x1});}}});}}};Dialer[_0xcb66('0x1a')]['syncHangup']=function(_0x5b9d36){var _0x566401=this[_0xcb66('0xc2')][_0x5b9d36[_0xcb66('0xc3')]];var _0x119ebf;if(!_0x566401){return;}if(_0x566401[_0xcb66('0x3d')]===_0xcb66('0xcf')){delete this[_0xcb66('0xc2')][_0x5b9d36[_0xcb66('0xc3')]];utils[_0xcb66('0x100')](this['campaigns'][_0x566401['queue']],_0xcb66('0x139'));this[_0xcb66('0x20')][_0x566401[_0xcb66('0xc1')]][_0xcb66('0x13a')]+=0x1;if(_0x5b9d36[_0xcb66('0x13b')]===_0xcb66('0x13c')){const _0x447169=new AgentComplete(_0x566401,_0x5b9d36);_0x447169['CampaignId']=this['campaigns'][_0x566401[_0xcb66('0xc1')]]['id'];hopperUtils[_0xcb66('0xcb')](_0x447169)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x13d')));hopperUtils[_0xcb66('0xcd')](_0x447169)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x13e')));}else{_0x119ebf=new Hangup(_0x566401,_0x5b9d36);hopperUtils['createHistory'](_0x119ebf)['catch'](loggerCatch(_0xcb66('0x13f')));hopperUtils[_0xcb66('0xcd')](_0x119ebf)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x140')));}}else{if(isNotNull(this['voiceQueues'][_0x566401[_0xcb66('0xc1')]]['dialQueueProject'])){delete this[_0xcb66('0xc2')][_0x5b9d36[_0xcb66('0xc3')]];utils[_0xcb66('0x100')](this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]],_0xcb66('0x139'));this['voiceQueues'][_0x566401[_0xcb66('0xc1')]][_0xcb66('0xc6')]+=0x1;this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x119ebf=new Hangup(_0x566401,_0x5b9d36);_0x119ebf['state']=0x10;_0x119ebf[_0xcb66('0x6f')]=_0xcb66('0x141');_0x119ebf['membername']=_0xcb66('0x142');hopperUtils[_0xcb66('0xcb')](_0x119ebf)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xcb66('0xcd')](_0x119ebf)[_0xcb66('0xa3')](loggerCatch('[syncHangupIvr]'));}else{delete this[_0xcb66('0xc2')][_0x5b9d36[_0xcb66('0xc3')]];utils[_0xcb66('0x100')](this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]],_0xcb66('0x143'));if(_0x5b9d36[_0xcb66('0x13b')]===_0xcb66('0x13c')){this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]][_0xcb66('0xc6')]+=0x1;const _0x31604a=new AgentComplete(_0x566401,_0x5b9d36);_0x31604a[_0xcb66('0x102')]=this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]]['id'];hopperUtils[_0xcb66('0xcb')](_0x31604a)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x31604a)['catch'](loggerCatch(_0xcb66('0xce')));}else{this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]]['outboundUnknownCallsDay']+=0x1;_0x119ebf=new Hangup(_0x566401,_0x5b9d36);_0x119ebf[_0xcb66('0x6e')]=0xc;_0x119ebf[_0xcb66('0x6f')]=_0x5b9d36[_0xcb66('0x13b')];_0x119ebf[_0xcb66('0x11e')]='Unknown';hopperUtils[_0xcb66('0xcb')](_0x119ebf)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x144')));hopperUtils[_0xcb66('0xcd')](_0x119ebf)['catch'](loggerCatch('[syncHangup]'));}}}};Dialer[_0xcb66('0x1a')]['syncQueueSummary']=function(_0xfb644a){var _0x454967=this;if(!_0x454967[_0xcb66('0x145')][_0xfb644a['name']]){_0x454967[_0xcb66('0x145')][_0xfb644a['name']]={'running':![]};}else if(_0x454967[_0xcb66('0x145')][_0xfb644a[_0xcb66('0x43')]][_0xcb66('0x146')]===!![]){return;}else if(_0x454967[_0xcb66('0x145')][_0xfb644a[_0xcb66('0x43')]][_0xcb66('0x146')]===![]){_0x454967[_0xcb66('0x145')][_0xfb644a['name']]['running']=!![];}var _0x2c703f=_0x454967[_0xcb66('0x1f')][_0xfb644a[_0xcb66('0x43')]];var _0x5112db=_0x2c703f[_0xcb66('0x6d')]!==utils[_0xcb66('0x69')][_0xcb66('0x80')];var _0x19f853=utils[_0xcb66('0x147')](_0x2c703f);_0x2c703f['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x2c703f,_0x454967['trunks']);Promise[_0xcb66('0xae')]()['then'](function(){if(_0x2c703f[_0xcb66('0x148')]===utils[_0xcb66('0x69')][_0xcb66('0x80')]){if(_0x5112db){clearPredictiveAttributes(_0x2c703f);_0xfb644a[_0xcb66('0x62')]=undefined;_0xfb644a[_0xcb66('0x27')]=undefined;}if(_0x2c703f[_0xcb66('0x148')]===utils[_0xcb66('0x69')][_0xcb66('0x80')]){_0xfb644a[_0xcb66('0x149')]=0x0;_0xfb644a[_0xcb66('0xf8')]=0x0;_0xfb644a[_0xcb66('0x14a')]=0x0;_0xfb644a[_0xcb66('0x14b')]=0x0;_0xfb644a[_0xcb66('0x14c')]=0x0;}}else if(_0x2c703f[_0xcb66('0x148')]===utils[_0xcb66('0x69')][_0xcb66('0x14d')]&&!_0x19f853){return _0x454967[_0xcb66('0x92')](_0x2c703f,!![])[_0xcb66('0xa0')](function(){return _0x454967[_0xcb66('0x92')](_0x2c703f,![]);})[_0xcb66('0xa0')](function(){return _0x454967[_0xcb66('0x14e')](_0x2c703f);})['catch'](function(_0x5377e1){loggerSyncQueueSummary[_0xcb66('0x60')](_0xcb66('0x14f'),util[_0xcb66('0x40')](_0x5377e1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2c703f);});}else{clearPredictiveAttributes(_0x2c703f);}})[_0xcb66('0xa0')](function(){var _0x1ca355=_0xfb644a['compareToOutboundQueue'](_0x2c703f);if(_0x1ca355||_0x2c703f[_0xcb66('0x150')]){_0x2c703f[_0xcb66('0x150')]=![];_0xfb644a['updateReportFromOutboundQueue'](_0x2c703f);Object[_0xcb66('0x151')](_0x2c703f,_0xfb644a);emitOutboundVoiceQueueSummary(_0xfb644a);}_0x454967[_0xcb66('0x145')][_0x2c703f[_0xcb66('0x43')]][_0xcb66('0x146')]=![];})[_0xcb66('0xa3')](function(_0x2a1e08){logger[_0xcb66('0x66')](_0xcb66('0x14f'),util[_0xcb66('0x40')](_0x2a1e08,{'showHidden':![],'depth':null}));_0x454967['queuesSummary'][_0x2c703f['name']][_0xcb66('0x146')]=![];});};Dialer['prototype'][_0xcb66('0x31')]=_[_0xcb66('0x152')](function(){var _0x51190a=_[_0xcb66('0x153')](this[_0xcb66('0x1f')],function(_0x2151dd){return _0x2151dd[_0xcb66('0x154')];});var _0x2b51bc=_[_0xcb66('0x153')](this[_0xcb66('0x21')],function(_0x24c5b4){return _0x24c5b4['online']&&_0x24c5b4[_0xcb66('0x89')]===_0xcb66('0x8a');});if(_0x51190a[_0xcb66('0x9a')]>0x0&&_0x2b51bc['length']>0x0){return Promise['resolve']()[_0xcb66('0xa0')](cmHopper[_0xcb66('0x155')](_[_0xcb66('0x156')](_0x51190a,'id'),previewRecallmeReminderInterval,_[_0xcb66('0x156')](_0x2b51bc,'id')))[_0xcb66('0xa0')](function(_0x2f4f75){for(var _0x4fc594=0x0;_0x4fc594<_0x2f4f75[_0xcb66('0x9a')];_0x4fc594++){var _0x5dcb2d=_0x2f4f75[_0x4fc594]['Agent'][_0xcb66('0x43')];if(_0x5dcb2d)io['to'](util[_0xcb66('0x41')](_0xcb66('0x157'),_0x5dcb2d))['emit'](_0xcb66('0x158'),{'hopper':_0x2f4f75[_0x4fc594]});}})[_0xcb66('0xa3')](function(_0x10c99f){logger[_0xcb66('0x66')](_0xcb66('0x159'),_0x10c99f);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xcb66('0x1a')][_0xcb66('0x15a')]=function(){var _0x23147e=this;setInterval(function(){_0x23147e[_0xcb66('0x15b')](_0x23147e[_0xcb66('0xc2')],_0xcb66('0x15c'));_0x23147e[_0xcb66('0x15b')](_0x23147e[_0xcb66('0x25')],_0xcb66('0x15d'));},0x32c8);};Dialer[_0xcb66('0x1a')][_0xcb66('0x15b')]=function(_0x44dce9,_0x192a6f){var _0x379c77=this;for(var _0x543d62 in _0x44dce9){if(typeof _0x44dce9[_0x543d62]!==_0xcb66('0xad')){this[_0xcb66('0x1d')][_0xcb66('0x15e')](function(){if(!_['isNil'](_0x44dce9[_0x543d62])){return ami['Action']({'action':'status','channel':_0x44dce9[_0x543d62][_0xcb66('0xf3')]})[_0xcb66('0xa3')](function(_0x19a1a2){if(_0x19a1a2[_0xcb66('0x6d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x44dce9[_0x543d62]&&_0x44dce9[_0x543d62][_0xcb66('0x3d')]!==_0xcb66('0xcf')){utils['decrementOriginate'](_0x379c77[_0xcb66('0x1f')][_0x44dce9[_0x543d62][_0xcb66('0xc1')]],_0xcb66('0x15f'));logger['error'](_0xcb66('0x160'),_0x192a6f,_0x543d62,_0x44dce9[_0x543d62][_0xcb66('0xc1')]);delete _0x44dce9[_0x543d62];}if(_0x44dce9[_0x543d62]&&_0x44dce9[_0x543d62][_0xcb66('0x3d')]===_0xcb66('0xcf')){utils['decrementOriginate'](_0x379c77['campaigns'][_0x44dce9[_0x543d62][_0xcb66('0xc1')]],_0xcb66('0x15f'));logger[_0xcb66('0x66')](_0xcb66('0x161'),_0x192a6f,_0x543d62,_0x44dce9[_0x543d62][_0xcb66('0xc1')]);delete _0x44dce9[_0x543d62];}},0x2328);}});}});}}};Dialer[_0xcb66('0x1a')]['getVoiceQueueRtPauses']=function(_0x333048){return Promise[_0xcb66('0xae')]()['then'](voiceQueueRt[_0xcb66('0x162')](_0x333048))[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x163')));};Dialer[_0xcb66('0x1a')][_0xcb66('0x164')]=function(_0xacb3cf,_0x1aad4a,_0x262542){var _0x27a88d={'state':0x19,'statedesc':'notFound'};utils[_0xcb66('0x100')](_0x1aad4a,_0xcb66('0x165')+_0xacb3cf);this['saveInDb'](_['merge'](_0x27a88d,_[_0xcb66('0x75')](_0x262542,[_0xcb66('0xe4'),'ListId',_0xcb66('0x166'),_0xcb66('0x102'),_0xcb66('0xf2')])),_0xcb66('0x167'),_0xcb66('0x165'));logger[_0xcb66('0x66')](_0xacb3cf);};Dialer[_0xcb66('0x1a')][_0xcb66('0x122')]=function(_0x515755,_0x1ba4b7,_0x3724e9){hopperUtils['createHistory'](_0x515755)[_0xcb66('0xa3')](loggerCatch(_0x1ba4b7));hopperUtils[_0xcb66('0xcd')](_0x515755)[_0xcb66('0xa3')](loggerCatch(_0x3724e9));};Dialer[_0xcb66('0x1a')]['queueCallerAbandonCreateState']=function(_0x90f15,_0x561fa5){hopperUtils['createHistory'](_0x90f15)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0xcc')));if(_0x561fa5==0x0){hopperUtils[_0xcb66('0xcd')](_0x90f15)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x168')));}};Dialer[_0xcb66('0x1a')][_0xcb66('0x159')]=function(_0x421fec){return Promise[_0xcb66('0xae')]()[_0xcb66('0xa0')](cmHopper[_0xcb66('0x155')](_0x421fec['id'],previewRecallmeReminderInterval))[_0xcb66('0xa0')](function(_0x29ade2){for(var _0x1aaf57=0x0;_0x1aaf57<_0x29ade2[_0xcb66('0x9a')];_0x1aaf57++){var _0x589489=_0x29ade2[_0x1aaf57][_0xcb66('0x169')]['name'];if(_0x589489)io['to'](util[_0xcb66('0x41')](_0xcb66('0x157'),_0x589489))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x29ade2[_0x1aaf57]});}})[_0xcb66('0xa3')](function(){});};Dialer[_0xcb66('0x1a')]['launchHandleIvr']=function(_0x4cde41){var _0x164e16=this;return function(){_0x164e16[_0xcb66('0x16a')](_0x4cde41);};};Dialer['prototype'][_0xcb66('0x16b')]=function(_0x3946f7,_0xa89cf3){var _0x28826b=this;var _0x724c71=uuid['v4']();this[_0xcb66('0x25')][_0x724c71]=new Action(_0x3946f7,_0xa89cf3,_0x724c71);return new Promise(function(_0x5d63e7,_0xcc67c1){if(_[_0xcb66('0x52')](_0x3946f7)&&typeof _0x3946f7!=='object'){return _0xcc67c1(msgResponse(_0xcb66('0x16c'),'Failure',_0xcb66('0x16d')));}if(_[_0xcb66('0x52')](_0xa89cf3[_0xcb66('0x16e')])||_0xa89cf3['phone']===null){return _0xcc67c1(msgResponse(_0xcb66('0x16c'),_0xcb66('0x93'),'contact\x20is\x20undefine'));}var _0x10c0f1={'XMD-CALLERID':_0x28826b[_0xcb66('0x25')][_0x724c71]['getCaller'](),'XMD-AGI':_0x3946f7['dialQueueProject']?util[_0xcb66('0x41')](_0xcb66('0x16f'),ipAgi,_0x3946f7[_0xcb66('0x170')]):_0xcb66('0x171'),'XMD-AGIAFTER':_0x3946f7['dialQueueProject2']?util[_0xcb66('0x41')](_0xcb66('0x16f'),ipAgi,_0x3946f7['dialQueueProject2']):_0xcb66('0x171'),'XMD-QUEUE':utils[_0xcb66('0x172')](_0x3946f7)?util['format'](_0xcb66('0x173'),_0x3946f7[_0xcb66('0x43')],_0x3946f7['dialQueueOptions']||'',_0x3946f7[_0xcb66('0x174')]?'c':'',_0x3946f7[_0xcb66('0xd4')]||0x3):_0xcb66('0x171'),'XMD-CONTACTID':_0xa89cf3[_0xcb66('0xe4')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x28826b[_0xcb66('0x25')][_0x724c71][_0xcb66('0x175')](),'XMD-AMD':_0x3946f7[_0xcb66('0x118')]?_0xcb66('0x14d'):'NONE','XMD-DESTINATION':_0xcb66('0x117')};if(_0x3946f7['dialAMDActive']){_0x10c0f1[_0xcb66('0x176')]=_0x3946f7['dialAMDInitialSilence']||0x9c4;_0x10c0f1[_0xcb66('0x177')]=_0x3946f7[_0xcb66('0x178')]||0x5dc;_0x10c0f1[_0xcb66('0x179')]=_0x3946f7[_0xcb66('0x17a')]||0x320;_0x10c0f1[_0xcb66('0x17b')]=_0x3946f7[_0xcb66('0x17c')]||0x1388;_0x10c0f1[_0xcb66('0x17d')]=_0x3946f7[_0xcb66('0x17e')]||0x64;_0x10c0f1[_0xcb66('0x17f')]=_0x3946f7[_0xcb66('0x180')]||0x32;_0x10c0f1[_0xcb66('0x181')]=_0x3946f7[_0xcb66('0x182')]||0x3;_0x10c0f1[_0xcb66('0x183')]=_0x3946f7['dialAMDSilenceThreshold']||0x100;_0x10c0f1[_0xcb66('0x184')]=_0x3946f7[_0xcb66('0x185')]||0x1388;}if(utils[_0xcb66('0x172')](_0x3946f7)){_0x10c0f1[_0xcb66('0x186')]=_0xa89cf3['VoiceQueueId'];}else{_0x10c0f1[_0xcb66('0x187')]=_0xa89cf3['CampaignId'];}var _0x8e395=utils['setXMDContactVariables'](_0xa89cf3['Contact']);Object[_0xcb66('0x151')](_0x10c0f1,_0x8e395);var _0x5a07ca=_0x28826b['isTrunkReachable'](_0x3946f7['Trunk'])?utils[_0xcb66('0x188')](_0x3946f7[_0xcb66('0x8d')][_0xcb66('0x189')],_0x3946f7['dialOriginateCallerIdName'],_0x3946f7[_0xcb66('0x18a')]>0x0?utils[_0xcb66('0x18b')](_0x3946f7['dialOriginateCallerIdNumber'],_0x3946f7[_0xcb66('0x18a')]):_0x3946f7['dialOriginateCallerIdNumber']):utils[_0xcb66('0x188')](_[_0xcb66('0xf6')](_0x3946f7[_0xcb66('0x18c')])?_0x3946f7[_0xcb66('0x8d')]['callerid']:_0x3946f7['TrunkBackup']['callerid'],_0x3946f7[_0xcb66('0x18d')],_0x3946f7[_0xcb66('0x18a')]>0x0?utils[_0xcb66('0x18b')](_0x3946f7[_0xcb66('0x18e')],_0x3946f7[_0xcb66('0x18a')]):_0x3946f7['dialOriginateCallerIdNumber']);if(_0x5a07ca){_0x10c0f1['XMD-ORIGINATECALLERIDNAME']=_0x28826b[_0xcb66('0x25')][_0x724c71][_0xcb66('0x18f')]=utils[_0xcb66('0x190')](_0x5a07ca);_0x10c0f1['XMD-ORIGINATECALLERIDNUM']=_0xa89cf3[_0xcb66('0x16e')];}_0x3946f7[_0xcb66('0x191')]=_0x10c0f1;return ami['Action']({'actionid':_0x724c71,'action':_0xcb66('0x16c'),'channel':_0x28826b[_0xcb66('0x86')](_0x3946f7['Trunk'])?util[_0xcb66('0x41')](_0xcb66('0x192'),_0x3946f7['Trunk']['name'],isNotNull(_0x3946f7['dialPrefix'])?_0x3946f7[_0xcb66('0x193')]['trim']()||'':'',_0x3946f7['dialCutDigit']>0x0?_0xa89cf3['phone'][_0xcb66('0x194')](_0x3946f7[_0xcb66('0x195')]):_0xa89cf3[_0xcb66('0x16e')]):util[_0xcb66('0x41')]('SIP/%s/%s%s',_[_0xcb66('0xf6')](_0x3946f7[_0xcb66('0x18c')])?_0x3946f7[_0xcb66('0x8d')][_0xcb66('0x43')]:_0x3946f7['TrunkBackup'][_0xcb66('0x43')],isNotNull(_0x3946f7['dialPrefix'])?_0x3946f7['dialPrefix'][_0xcb66('0x196')]()||'':'',_0x3946f7[_0xcb66('0x195')]>0x0?_0xa89cf3[_0xcb66('0x16e')][_0xcb66('0x194')](_0x3946f7[_0xcb66('0x195')]):_0xa89cf3['phone']),'callerid':_0x5a07ca,'Exten':_0xcb66('0x117'),'Context':_0xcb66('0x197'),'Priority':'1','variable':_0x10c0f1,'timeout':(_0x3946f7['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x724c71})[_0xcb66('0xa0')](function(_0x359702){return _0x5d63e7(_0x359702);})[_0xcb66('0xa3')](function(_0x3ceaeb){_0x3946f7['outboundOriginateFailureCallsDay']+=0x1;var _0x184526=new History(_0x28826b[_0xcb66('0x25')][_0x724c71]);logger[_0xcb66('0x66')](util[_0xcb66('0x41')](_0xcb66('0x198'),JSON[_0xcb66('0x74')](_0x3ceaeb)));_0x184526[_0xcb66('0x6e')]=0xe;_0x184526[_0xcb66('0x6f')]='OriginateError';_0x184526['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x184526[_0xcb66('0x70')]=_0x184526['starttime'];hopperUtils['createHistory'](_0x184526)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x199')));_0x28826b[_0xcb66('0xcd')](_0x184526)['catch'](loggerCatch(_0xcb66('0x199')))[_0xcb66('0x1c')](function(){delete _0x28826b['actions'][_0x724c71];return _0xcc67c1(msgResponse('originate',_0xcb66('0x85'),_0xcb66('0x19a')));});});});};Dialer['prototype'][_0xcb66('0x19b')]=function(_0x124e04,_0x54e3a4,_0x788ec6){var _0xbff938=new History(_0x54e3a4);if(_0xbff938[_0xcb66('0x128')]+_0xbff938[_0xcb66('0x129')]+_0xbff938['countnoanswerretry']+_0xbff938[_0xcb66('0x136')]+_0xbff938[_0xcb66('0xd9')]+_0xbff938['countabandonedretry']+_0xbff938['countmachineretry']+_0xbff938['countagentrejectretry']>=_0x788ec6[_0xcb66('0x12b')]-0x1){return!![];}switch(_0x124e04){case 0x3:if(_0xbff938[_0xcb66('0x135')]>=_0x788ec6['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xcb66('0xe1')]({'active':![],'countnoanswerretry':_0xbff938[_0xcb66('0x135')]+=0x1,'scheduledat':moment()[_0xcb66('0xe2')](_0x788ec6['dialNoAnswerRetryFrequency'],_0xcb66('0xe3'))['format'](_0xcb66('0xca')),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938['ListId'],'VoiceQueueId':_0xbff938[_0xcb66('0x102')]||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x19c')));break;case 0x5:if(_0xbff938[_0xcb66('0x128')]>=_0x788ec6['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xcb66('0xe1')]({'active':![],'countbusyretry':_0xbff938['countbusyretry']+=0x1,'scheduledat':moment()[_0xcb66('0xe2')](_0x788ec6['dialBusyRetryFrequency'],_0xcb66('0xe3'))['format'](_0xcb66('0xca')),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938[_0xcb66('0xe5')],'VoiceQueueId':_0xbff938[_0xcb66('0x102')]||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x19d')));break;case 0x8:if(_0xbff938['countcongestionretry']>=_0x788ec6[_0xcb66('0x19e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0xbff938[_0xcb66('0x129')]+=0x1,'scheduledat':moment()[_0xcb66('0xe2')](_0x788ec6[_0xcb66('0x19f')],_0xcb66('0xe3'))[_0xcb66('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938[_0xcb66('0xe5')],'VoiceQueueId':_0xbff938[_0xcb66('0x102')]||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})['catch'](loggerCatch(_0xcb66('0x1a0')));break;case 0x0:if(_0xbff938[_0xcb66('0x136')]>=_0x788ec6[_0xcb66('0x1a1')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0xbff938[_0xcb66('0x136')]+=0x1,'scheduledat':moment()['add'](_0x788ec6[_0xcb66('0x1a2')],_0xcb66('0xe3'))['format'](_0xcb66('0xca')),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938[_0xcb66('0xe5')],'VoiceQueueId':_0xbff938['VoiceQueueId']||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1a3')));}break;case 0xa:if(_0xbff938['countdropretry']>=_0x788ec6[_0xcb66('0xdf')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xbff938[_0xcb66('0xd9')]+=0x1,'scheduledat':moment()['add'](_0x788ec6[_0xcb66('0xda')],_0xcb66('0xe3'))[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0xbff938['ContactId'],'ListId':_0xbff938[_0xcb66('0xe5')],'VoiceQueueId':_0xbff938[_0xcb66('0x102')]||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})['catch'](loggerCatch(_0xcb66('0xe6')));break;case 0xb:if(_0xbff938['countabandonedretry']>=_0x788ec6[_0xcb66('0xf1')]-0x1){return!![];}hopperUtils[_0xcb66('0xe1')]({'active':![],'countabandonedretry':_0xbff938['countabandonedretry']+=0x1,'scheduledat':moment()[_0xcb66('0xe2')](_0x788ec6['dialAbandonedRetryFrequency'],_0xcb66('0xe3'))[_0xcb66('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938[_0xcb66('0xe5')],'VoiceQueueId':_0xbff938['VoiceQueueId']||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1a4')));break;case 0x13:if(_0xbff938[_0xcb66('0x125')]>=_0x788ec6[_0xcb66('0x12e')]-0x1){return!![];}hopperUtils[_0xcb66('0xe1')]({'active':![],'countmachineretry':_0xbff938['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x788ec6['dialMachineRetryFrequency'],_0xcb66('0xe3'))[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938['ListId'],'VoiceQueueId':_0xbff938[_0xcb66('0x102')]||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x130')));break;case 0x14:if(_0xbff938[_0xcb66('0x12a')]>=_0x788ec6[_0xcb66('0x1a5')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0xbff938[_0xcb66('0x12a')]+=0x1,'scheduledat':moment()[_0xcb66('0xe2')](_0x788ec6[_0xcb66('0x1a6')],_0xcb66('0xe3'))[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938['ListId'],'VoiceQueueId':_0xbff938['VoiceQueueId']||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1a7')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x893ea8,_0x1c712d,_0x59acc1){var _0x2d77d0=this;var _0x39c476=new History(_0x893ea8);var _0x5cf95b=![];var _0x42327a;var _0x63b689;return new Promise(function(_0x1ae85f,_0x5ae852){if(_[_0xcb66('0x52')](_0x1c712d)&&typeof _0x1c712d!=='object'){return _0x5ae852(msgResponse(_0xcb66('0x1a8'),_0xcb66('0x93'),_0xcb66('0x1a9')));}if(_['isUndefined'](_0x59acc1)&&typeof _0x59acc1!==_0xcb66('0x1aa')){return _0x5ae852(msgResponse(_0xcb66('0x1a8'),_0xcb66('0x93'),'evt\x20is\x20undefine'));}hopperUtils[_0xcb66('0xdc')](_0x39c476,_0x59acc1[_0xcb66('0x1ab')],_0x1c712d)['then'](function(_0xdcc52d){if(_0xdcc52d[_0xcb66('0xde')]==0x1)_0x5cf95b=!![];switch(_0x59acc1[_0xcb66('0x1ab')]){case'0':_0x1c712d[_0xcb66('0x1ac')]+=0x1;_0x39c476['state']=0x0;_0x39c476['statedesc']=_0xcb66('0x1ad');_0x39c476['countnosuchnumberretry']+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x893ea8,'nosuchnumber'));_0x42327a=_0x1c712d[_0xcb66('0x1a2')];_0x63b689=_0x1c712d[_0xcb66('0xdb')];hopperUtils[_0xcb66('0xcb')](_0x39c476)[_0xcb66('0xa3')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2d77d0[_0xcb66('0x19b')](0x0,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x136')]>=_0x1c712d['dialNoSuchNumberMaxRetry']){_0x2d77d0[_0xcb66('0x137')](_0x39c476,_0x1ae85f,_0x5ae852,'reason\x200\x20no\x20such\x20number....');}else{_0x2d77d0[_0xcb66('0x12c')](_0x39c476,_0x1ae85f,_0x5ae852,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1c712d[_0xcb66('0x1ae')]+=0x1;_0x39c476['state']=0x3;_0x39c476[_0xcb66('0x6f')]=_0xcb66('0x1af');_0x39c476[_0xcb66('0x135')]+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;var _0xb38e4e=ut[_0xcb66('0x1b0')](_0x893ea8,_0x1c712d);ami[_0xcb66('0x3c')](_0xcb66('0x1b1'),_0xb38e4e);_0x42327a=_0x1c712d['dialNoAnswerRetryFrequency'];_0x63b689=_0x1c712d[_0xcb66('0xdb')];hopperUtils[_0xcb66('0xcb')](_0x39c476)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1b2')));if(_0x2d77d0['checkRetriveMax'](0x3,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x135')]>=_0x1c712d['dialNoAnswerMaxRetry']){_0x2d77d0[_0xcb66('0x137')](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1b3'));}else{_0x2d77d0['stateGlobal'](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1b3'));}}break;case'5':_0x1c712d[_0xcb66('0x1b4')]+=0x1;_0x39c476[_0xcb66('0x6e')]=0x5;_0x39c476[_0xcb66('0x6f')]='Busy';_0x39c476[_0xcb66('0x128')]+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;ami[_0xcb66('0x3c')](_0xcb66('0x1b5'),ut[_0xcb66('0x126')](_0x893ea8,_0xcb66('0x1b6')));_0x42327a=_0x1c712d[_0xcb66('0x1b7')];_0x63b689=_0x1c712d['callAdditionalPhoneAfterMin'];hopperUtils[_0xcb66('0xcb')](_0x39c476)['catch'](loggerCatch(_0xcb66('0x1b8')));if(_0x2d77d0['checkRetriveMax'](0x5,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x128')]>=_0x1c712d['dialBusyMaxRetry']){_0x2d77d0[_0xcb66('0x137')](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1b9'));}else{_0x2d77d0['stateGlobal'](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1b9'));}}break;case'8':_0x1c712d[_0xcb66('0x1ba')]+=0x1;_0x39c476[_0xcb66('0x6e')]=0x8;_0x39c476['statedesc']='Congestion';_0x39c476['countcongestionretry']+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;_0x42327a=_0x1c712d[_0xcb66('0x19f')];_0x63b689=_0x1c712d[_0xcb66('0xdb')];ami[_0xcb66('0x3c')](_0xcb66('0x1bb'),ut[_0xcb66('0x126')](_0x893ea8,_0xcb66('0x1bc')));hopperUtils[_0xcb66('0xcb')](_0x39c476)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1bd')));if(_0x2d77d0['checkRetriveMax'](0x8,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x129')]>=_0x1c712d[_0xcb66('0x19e')]){_0x2d77d0[_0xcb66('0x137')](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1be'));}else{_0x2d77d0[_0xcb66('0x12c')](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1be'));}}break;case'11':_0x1c712d['outboundAbandonedCallsDay']+=0x1;_0x39c476[_0xcb66('0x6e')]=0xb;_0x39c476['statedesc']='Abandoned';_0x39c476[_0xcb66('0xee')]+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;_0x42327a=_0x1c712d[_0xcb66('0xf0')];_0x63b689=_0x1c712d['callAdditionalPhoneAfterMin'];hopperUtils[_0xcb66('0xcb')](_0x39c476)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2d77d0['checkRetriveMax'](0xb,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0xee')]>=_0x1c712d[_0xcb66('0xf1')]){_0x2d77d0['createStateFinal'](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1bf'));}else{_0x2d77d0[_0xcb66('0x12c')](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1bf'));}}break;case'20':_0x1c712d['outboundRejectCallsDay']+=0x1;_0x39c476[_0xcb66('0x6e')]=0x14;_0x39c476[_0xcb66('0x6f')]=_0xcb66('0x1c0');_0x39c476[_0xcb66('0x12a')]+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;_0x42327a=_0x1c712d[_0xcb66('0x1a6')];_0x63b689=_0x1c712d['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0xcb66('0x126')](_0x893ea8,_0xcb66('0x1c1')));hopperUtils['createHistory'](_0x39c476)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1c2')));if(_0x2d77d0[_0xcb66('0x19b')](0x14,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x12a')]>=_0x1c712d['dialAgentRejectMaxRetry']){_0x2d77d0['createStateFinal'](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1c3'));}else{_0x2d77d0['stateGlobal'](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1c3'));}}break;default:_0x1c712d[_0xcb66('0x1c4')]+=0x1;_0x39c476['state']=0xc;_0x39c476[_0xcb66('0x6f')]=_0x59acc1[_0xcb66('0x1ab')];_0x42327a=_0x1c712d[_0xcb66('0x1a6')];_0x63b689=_0x1c712d[_0xcb66('0xdb')];hopperUtils[_0xcb66('0xcb')](_0x39c476)['catch'](loggerCatch(_0xcb66('0x1c5')));if(_0x2d77d0[_0xcb66('0x19b')](_0x59acc1[_0xcb66('0x1ab')],_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x128')]+_0x39c476['countcongestionretry']+_0x39c476['countnoanswerretry']+_0x39c476[_0xcb66('0x136')]+_0x39c476[_0xcb66('0xd9')]+_0x39c476[_0xcb66('0xee')]+_0x39c476['countmachineretry']+_0x39c476[_0xcb66('0x12a')]>=_0x1c712d['dialGlobalMaxRetry']){_0x2d77d0[_0xcb66('0x12c')](_0x39c476,_0x1ae85f,_0x5ae852,_0x59acc1['reason']);}else{_0x2d77d0['createStateFinal'](_0x39c476,_0x1ae85f,_0x5ae852,_0x59acc1[_0xcb66('0x1ab')]);}}}})['then'](function(){if(_0x5cf95b){hopperUtils[_0xcb66('0xeb')](_0x39c476,_0x42327a,_0x63b689)[_0xcb66('0xa0')](function(){return _0x1ae85f(0x1);});}});});};Dialer[_0xcb66('0x1a')]['stateGlobal']=function(_0x476337,_0x1974c3,_0x460e8e,_0x292033){var _0xa72050=new Final(_0x476337);_0xa72050['state']=0xf;_0xa72050[_0xcb66('0x6f')]=_0xcb66('0x1c6');this[_0xcb66('0x137')](_0xa72050,_0x1974c3,_0x460e8e,_0x292033);};Dialer['prototype']['createStateFinal']=function(_0x29d222,_0x2a184b,_0x10c629,_0x122e25){hopperUtils[_0xcb66('0xcd')](_0x29d222)[_0xcb66('0xa0')](function(){return _0x2a184b(msgResponse(_0xcb66('0x1a8'),'Success',_0x122e25));})[_0xcb66('0xa3')](function(){return _0x10c629(msgResponse(_0xcb66('0x1c7'),_0xcb66('0x93'),_0xcb66('0x1c8')));});};Dialer[_0xcb66('0x1a')][_0xcb66('0x8')]=function(_0x36933b){var _0x2e983b=_0x36933b[_0xcb66('0x1c9')]/0x64;var _0x21214d=_0x36933b[_0xcb66('0xd5')]/(_0x36933b[_0xcb66('0xd5')]+_0x36933b['outboundAnswerCallsDay']);var _0x3ac785=Math[_0xcb66('0x1ca')](_0x36933b[_0xcb66('0x1cb')]*(_0x36933b[_0xcb66('0x1cc')]/0x64));var _0x5d21a6=Math[_0xcb66('0x1ca')](_0x36933b[_0xcb66('0x1cb')]*(_0x36933b[_0xcb66('0x1cd')]/0x64));var _0x88d747=_0x36933b[_0xcb66('0x149')]+_0x36933b[_0xcb66('0x14b')];var _0x570b57=Math[_0xcb66('0x1ce')](_0x36933b[_0xcb66('0x59')]*_0x36933b[_0xcb66('0x5c')]*_0x36933b[_0xcb66('0x1cf')]*_0x36933b[_0xcb66('0x1d0')]);if(_[_0xcb66('0x52')](_0x36933b[_0xcb66('0x27')])){if(!_[_0xcb66('0x52')](_0x36933b['startPredictive'])){_0x36933b['startPredictive']=undefined;loggerPredictive[_0xcb66('0x66')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x36933b[_0xcb66('0x64')])){loggerPredictive[_0xcb66('0x66')](_0xcb66('0x1d1'),_0xcb66('0x1d2'));clearInterval(_0x36933b[_0xcb66('0x64')]);_0x36933b['handlePredictive']=undefined;}_0x36933b[_0xcb66('0x27')]=moment()[_0xcb66('0x41')](_0xcb66('0xca'));loggerPredictive[_0xcb66('0x45')](_0x36933b[_0xcb66('0x43')],_0xcb66('0x1d3'),_0x36933b[_0xcb66('0x27')]);this['handlePower'](_0x36933b,0x1);}else if(ifInterval(_0x36933b[_0xcb66('0x1d4')],_0x36933b[_0xcb66('0x27')])){this['handlePower'](_0x36933b,0x1);loggerPredictiveCalls[_0xcb66('0x45')](_0xcb66('0x1d5'),_0x36933b[_0xcb66('0x27')],_0x36933b[_0xcb66('0x43')]);_0x36933b[_0xcb66('0x59')]=0x0;_0x36933b[_0xcb66('0xd6')]=0x0;}else if(_0x2e983b<_0x21214d&&_0x36933b['dialPredictiveOptimization']===_0xcb66('0x1d6')){clearPredictiveAttributes(_0x36933b);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x1d7'),_0xcb66('0x1d8'),_0x21214d,_0xcb66('0x27'),_0x36933b[_0xcb66('0x43')]);}else if(_0x570b57<_0x36933b[_0xcb66('0xd6')]&&_0x36933b[_0xcb66('0x1d9')]===_0xcb66('0x1d6')){clearPredictiveAttributes(_0x36933b);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x1da'),_0xcb66('0x1db'),_0x570b57,'Drop\x20in\x20this\x20interval',_0x36933b[_0xcb66('0xd6')],_0xcb66('0x27'),_0x36933b[_0xcb66('0x43')]);}else if(!ifInterval(_0x36933b[_0xcb66('0x1d4')],_0x36933b[_0xcb66('0x27')])&&_[_0xcb66('0x52')](_0x36933b[_0xcb66('0x62')])&&!_[_0xcb66('0x52')](_0x36933b[_0xcb66('0x27')])){_0x36933b['startPredictive']=moment()[_0xcb66('0x41')](_0xcb66('0xca'));loggerPredictive[_0xcb66('0x45')](_0x36933b[_0xcb66('0x43')],_0xcb66('0x1dc'),_0x36933b[_0xcb66('0x62')]);hopperUtils[_0xcb66('0x1dd')](_0x36933b[_0xcb66('0x1d4')])['then'](this['getDataPredictive'](_0x36933b))[_0xcb66('0xa0')](mergeDataErlangB(_0x36933b))[_0xcb66('0xa0')](this['startMethodPredictive'](_0x36933b))[_0xcb66('0xa3')](loggerCatchPredictive(_0xcb66('0x1de'),_0x36933b));}else if(!ifInterval(_0x36933b[_0xcb66('0x1d4')],_0x36933b[_0xcb66('0x62')])){_0x36933b[_0xcb66('0xd6')]=0x0;_0x36933b[_0xcb66('0x62')]=moment()[_0xcb66('0x41')](_0xcb66('0xca'));loggerPredictive[_0xcb66('0x45')](_0x36933b['name'],_0xcb66('0x1df'),_0x36933b[_0xcb66('0x62')]);clearInterval(_0x36933b[_0xcb66('0x64')]);_0x36933b[_0xcb66('0x64')]=undefined;hopperUtils[_0xcb66('0x1dd')](_0x36933b['dialPredictiveInterval'])[_0xcb66('0xa0')](this[_0xcb66('0x1e0')](_0x36933b))['then'](mergeDataErlangB(_0x36933b))['then'](this[_0xcb66('0x1e1')](_0x36933b))[_0xcb66('0xa3')](loggerCatchPredictive(_0xcb66('0x1e2'),_0x36933b));}else if(_0x36933b[_0xcb66('0x1cb')]&&_0x88d747<_0x36933b['predictiveIntervalAvailable']-_0x5d21a6){clearPredictiveAttributes(_0x36933b);loggerPredictive['info'](_0x36933b['name'],_0xcb66('0x1e3'),_0x88d747,_0xcb66('0x1e4'),_0x36933b[_0xcb66('0x1cb')],'-',_0x5d21a6,'=',_0x36933b['predictiveIntervalAvailable']-_0x5d21a6,')');}else if(_0x36933b[_0xcb66('0x1cb')]&&_0x88d747>_0x36933b['predictiveIntervalAvailable']+_0x3ac785){clearPredictiveAttributes(_0x36933b);loggerPredictive[_0xcb66('0x45')](_0x36933b['name'],_0xcb66('0x1e3'),_0x88d747,_0xcb66('0x1e5'),_0x36933b[_0xcb66('0x1cb')],'+',_0x3ac785,'=',_0x36933b['predictiveIntervalAvailable']+_0x3ac785,')');}};Dialer['prototype'][_0xcb66('0x1e0')]=function(_0x8ecc2a){var _0x52135e=this;return function(_0x25a82a){return new Promise(function(_0x288188,_0x2fafbb){_[_0xcb66('0x5f')](_0x8ecc2a,_0x25a82a[0x0]);if(checkGetDataPredictive(_0x25a82a[0x0])){var _0x928773=_0x8ecc2a[_0xcb66('0x1cb')]=_0x8ecc2a[_0xcb66('0x14b')]+_0x8ecc2a['available'];var _0x1e4528=_0x8ecc2a[_0xcb66('0x1d4')]*0x3c;var _0x3473ce=_0x25a82a[0x0][_0xcb66('0x53')]+_0x25a82a[0x0]['predictiveIntervalAvgHoldtime'];var _0x454a22=(_0x25a82a[0x0][_0xcb66('0x49')]+_0x25a82a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x25a82a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x25a82a[0x0]['predictiveIntervalTotalCalls'];_0x8ecc2a[_0xcb66('0x1cf')]=_0x454a22>0x0?_0x454a22:0x1;switch(_0x8ecc2a[_0xcb66('0x1d9')]){case'dropRate':var _0x487bd2=_0x8ecc2a[_0xcb66('0x1c9')]/0x64;return _0x52135e[_0xcb66('0x1e6')](_0x928773,_0x1e4528,_0x3473ce,_0x454a22,_0x487bd2)[_0xcb66('0xa0')](function(_0x2d1dcd){return _0x288188(_0x2d1dcd);});case'agentBusyFactor':var _0x33c25d=_0x8ecc2a['dialPredictiveOptimizationPercentage']/0x64;return _0x52135e['busyFactor'](_0x928773,_0x1e4528,_0x3473ce,_0x454a22,_0x33c25d)[_0xcb66('0xa0')](function(_0x4baf16){return _0x288188(_0x4baf16);});default:return _0x2fafbb(msgResponse(_0xcb66('0x1e7'),'Failure',_0xcb66('0x1e8')));}}else{return _0x2fafbb(msgResponse(_0xcb66('0x1e7'),'Failure',_0xcb66('0x1e9')));}});};};Dialer[_0xcb66('0x1a')][_0xcb66('0x1ea')]=function(_0x4d13f2){var _0x35ef1b=this;return function(_0x1fb96c){return new Promise(function(_0x155be9,_0x5c13db){_[_0xcb66('0x5f')](_0x4d13f2,_0x1fb96c[0x0]);if(checkGetDataPredictive(_0x1fb96c[0x0])){loggerPredictive['info'](JSON[_0xcb66('0x74')](_0x1fb96c[0x0]));if(_0x4d13f2['dialPredictiveOptimization']===_0xcb66('0x1d6')){return _0x35ef1b['getVoiceQueueRtPauses'](_0x4d13f2['id'])[_0xcb66('0xa0')](function(_0x4f27ce){var _0x55c4f7=_0x4d13f2[_0xcb66('0x1eb')]-_0x4f27ce[0x0][_0xcb66('0x1ec')];var _0x197804=_0x4d13f2[_0xcb66('0x1d4')]*0x3c;var _0x3b4f93=_0x1fb96c[0x0][_0xcb66('0x53')]+_0x1fb96c[0x0]['predictiveIntervalAvgHoldtime'];var _0x87335b=(_0x1fb96c[0x0][_0xcb66('0x49')]+_0x1fb96c[0x0][_0xcb66('0x4b')]+_0x1fb96c[0x0][_0xcb66('0x4d')])/_0x1fb96c[0x0][_0xcb66('0x51')];var _0x38d9e5=_0x4d13f2[_0xcb66('0x1c9')]/0x64;_0x4d13f2[_0xcb66('0x1ed')]=_0x4f27ce[0x0][_0xcb66('0x1ec')]||0x0;_0x4d13f2[_0xcb66('0x1cf')]=_0x87335b>0x0?_0x87335b:0x1;return _0x35ef1b[_0xcb66('0x1e6')](_0x55c4f7,_0x197804,_0x3b4f93,_0x87335b,_0x38d9e5);})['then'](function(_0x2d4fd9){return _0x155be9(_0x2d4fd9);})[_0xcb66('0xa3')](function(_0x4c210f){return _0x5c13db(msgResponse('[CatchErlangB]',_0xcb66('0x93'),JSON['stringify'](_0x4c210f)));});}if(_0x4d13f2[_0xcb66('0x1d9')]===_0xcb66('0x1ee')){return _0x35ef1b['getVoiceQueueRtPauses'](_0x4d13f2['id'])[_0xcb66('0xa0')](function(_0x2e6a2b){var _0x589849=_0x4d13f2[_0xcb66('0x1eb')]-_0x2e6a2b[0x0][_0xcb66('0x1ec')];var _0x203ee0=_0x4d13f2[_0xcb66('0x1d4')]*0x3c;var _0x5074bc=_0x1fb96c[0x0][_0xcb66('0x53')]+_0x1fb96c[0x0][_0xcb66('0x4f')];var _0x578e03=(_0x1fb96c[0x0]['predictiveIntervalAnsweredCalls']+_0x1fb96c[0x0][_0xcb66('0x4b')]+_0x1fb96c[0x0][_0xcb66('0x4d')])/_0x1fb96c[0x0][_0xcb66('0x51')];var _0x8ddbb1=_0x4d13f2['dialPredictiveOptimizationPercentage']/0x64;_0x4d13f2[_0xcb66('0x1ed')]=_0x2e6a2b[0x0][_0xcb66('0x1ec')]||0x0;_0x4d13f2[_0xcb66('0x1cf')]=_0x578e03>0x0?_0x578e03:0x1;return _0x35ef1b['busyFactor'](_0x589849,_0x203ee0,_0x5074bc,_0x578e03,_0x8ddbb1);})[_0xcb66('0xa0')](function(_0x297eb0){return _0x155be9(_0x297eb0);})[_0xcb66('0xa3')](function(_0x4d6578){return _0x5c13db(msgResponse('[CatchErlangB]',_0xcb66('0x93'),JSON['stringify'](_0x4d6578)));});}}else{return _0x5c13db(msgResponse('[getDataPredictive]','Failure',_0xcb66('0x1e9')));}});};};Dialer[_0xcb66('0x1a')][_0xcb66('0x1e1')]=function(_0x57a726){var _0x5d9b1b=this;return function(){var _0x5674ad=0x0;var _0x4878f0=Math[_0xcb66('0x1ce')](_0x57a726[_0xcb66('0x5b')]*0x3e8);if(_0x4878f0>0x0){_0x4878f0=_0x4878f0<0x64?0x64:_0x4878f0;loggerPredictive['info'](_0x57a726[_0xcb66('0x43')],_0xcb66('0x1ef'),_0x4878f0,_0xcb66('0x1f0'));_0x57a726[_0xcb66('0x64')]=setInterval(function(){_0x5d9b1b[_0xcb66('0x64')](_0x57a726);loggerPredictiveCalls['info']('[handlePredictive]',_0x5674ad+=0x1);},_0x4878f0);}else{loggerPredictive[_0xcb66('0x45')](_0x57a726[_0xcb66('0x43')],_0xcb66('0x1f1'));}};};Dialer[_0xcb66('0x1a')][_0xcb66('0x1f2')]=function(_0x461438,_0x255171){var _0x54b42c=this;return function(_0x99abc1){if(_[_0xcb66('0x7a')](_0x99abc1)){if(_[_0xcb66('0xf6')](_0x255171[_0xcb66('0x166')])||!_0x255171[_0xcb66('0x1f3')]){if(_0x461438[_0xcb66('0xb2')]===_0xcb66('0xb6')){_0x461438[_0xcb66('0x72')]=_[_0xcb66('0x52')](_0x461438['queueStatusComplete'])?!![]:_0x461438['queueStatusComplete'];var _0xe5af90=uuid['v4']();_0x54b42c[_0xcb66('0x25')][_0xe5af90]=new Action(_0x461438,_0x255171,_0xe5af90);loggerBooked['info']('[booked][checkContactBlack]',_0xe5af90,_0xcb66('0x1f4'),JSON[_0xcb66('0x74')](_0x461438[_0xcb66('0x72')]),'Queue:\x20',_0x461438['name']);if(_0x461438['queueStatusComplete']){_0x461438[_0xcb66('0x72')]=![];_0x54b42c[_0xcb66('0xfa')][_0x54b42c[_0xcb66('0x25')][_0xe5af90]['queue']]=[];ami['Action']({'actionid':_0xe5af90,'action':_0xcb66('0x1f5'),'queue':_0x461438['name']})[_0xcb66('0xa3')](function(){utils[_0xcb66('0x100')](_0x461438,_0xcb66('0x1f6'));hopperUtils[_0xcb66('0xe1')]({'active':![],'ContactId':_0x54b42c[_0xcb66('0x25')][_0xe5af90][_0xcb66('0xe4')],'ListId':_0x54b42c[_0xcb66('0x25')][_0xe5af90]['ListId'],'VoiceQueueId':_0x54b42c['actions'][_0xe5af90][_0xcb66('0x102')]||undefined,'CampaignId':_0x54b42c['actions'][_0xe5af90][_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1f7')));delete _0x54b42c[_0xcb66('0x25')][_0xe5af90];});}else{loggerBooked['info'](_0xcb66('0x1f8'),JSON[_0xcb66('0x74')](_0x461438[_0xcb66('0x72')]),_0xcb66('0x1f9'),_0x461438[_0xcb66('0x43')]);utils['decrementOriginate'](_0x461438,_0xcb66('0x1f6'));hopperUtils[_0xcb66('0xe1')]({'active':![],'ContactId':_0x54b42c[_0xcb66('0x25')][_0xe5af90]['ContactId'],'ListId':_0x54b42c[_0xcb66('0x25')][_0xe5af90][_0xcb66('0xe5')],'VoiceQueueId':_0x54b42c[_0xcb66('0x25')][_0xe5af90][_0xcb66('0x102')]||undefined,'CampaignId':_0x54b42c[_0xcb66('0x25')][_0xe5af90][_0xcb66('0xf2')]||undefined})['catch'](loggerCatch(_0xcb66('0x1f7')));delete _0x54b42c[_0xcb66('0x25')][_0xe5af90];}}else{return _0x54b42c['actionOriginate'](_0x461438,_0x255171);}}else{if(utils[_0xcb66('0xd2')](undefined,_0x255171[_0xcb66('0x1fa')])<_0x461438[_0xcb66('0x1fb')]*0x3c){if(_0x255171[_0xcb66('0x169')]&&!_0x255171[_0xcb66('0x169')]['voicePause']){_0x54b42c['preview'][_0xcb66('0xfd')](_0x255171['id'])[_0xcb66('0x1c')](function(){utils[_0xcb66('0x100')](_0x461438,_0xcb66('0x1f6'));});}else{hopperUtils[_0xcb66('0x1fc')]({'active':![]},_0x255171['id'],0x1)[_0xcb66('0x1c')](function(){utils[_0xcb66('0x100')](_0x461438,'[checkContactBlack]');});}}else{_0x461438[_0xcb66('0x1fd')]+=0x1;utils[_0xcb66('0x100')](_0x461438,_0xcb66('0x1f6'));if(_0x461438[_0xcb66('0x1fe')]){hopperUtils[_0xcb66('0xe1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x255171['ContactId'],'ListId':_0x255171[_0xcb66('0xe5')],'VoiceQueueId':_0x255171[_0xcb66('0x102')]||undefined,'CampaignId':_0x255171['CampaignId']||undefined})['catch'](loggerCatch(_0xcb66('0x1ff')));hopperUtils[_0xcb66('0xcb')](createObjHistory(_0x461438,_0x255171,utils[_0xcb66('0x69')]['QUEUE_RECALL'],0x17,_0xcb66('0x200')))['catch'](loggerCatch(_0xcb66('0x201')));}else{_0x54b42c[_0xcb66('0x122')](createObjHistory(_0x461438,_0x255171,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0xcb66('0x202')),_0xcb66('0x203'),'[Originate][HistoryRecallClose]');}}}}else{_0x461438['outboundBlacklistCallsDay']+=0x1;_0x54b42c[_0xcb66('0x122')](createObjHistory(_0x461438,_0x255171,utils[_0xcb66('0x69')][_0xcb66('0x204')],0xd,_0xcb66('0x205')),_0xcb66('0x206'),_0xcb66('0x207'));throw'inBlackList';}};};Dialer[_0xcb66('0x1a')][_0xcb66('0x16a')]=function(_0x4a8d80){var _0x1518b8=this;var _0x357a5a=_0x4a8d80[_0xcb66('0x208')]-_0x4a8d80[_0xcb66('0x7e')];emitCampaignSummary(_0x4a8d80);if(_0x357a5a>0x0&&_0x4a8d80['temp']==0x0){if(_0x357a5a>this[_0xcb66('0x23')]){_0x357a5a=this['maxNumberOriginate'];}_0x4a8d80[_0xcb66('0x209')]=0x1;hopperUtils[_0xcb66('0x20a')](_0x4a8d80,_0x357a5a)['then'](function(_0x2f0935){_0x4a8d80['temp']=0x0;if(_0x2f0935){if(!utils[_0xcb66('0x20b')](_0x2f0935)){_0x4a8d80[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x20c')];logger[_0xcb66('0x45')](_0xcb66('0x20d')+_0x4a8d80['name']);}else{_0x4a8d80[_0xcb66('0x7e')]+=_0x2f0935['length'];_0x4a8d80[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x20e')];for(var _0x34f780=0x0;_0x34f780<_0x2f0935[_0xcb66('0x9a')];_0x34f780+=0x1){_0x4a8d80[_0xcb66('0x20f')]+=0x1;if(_['isNil'](_0x2f0935[_0x34f780])||_['isNil'](_0x2f0935[_0x34f780]['Contact'])||_['isNil'](_0x2f0935[_0x34f780][_0xcb66('0x16e')])){_0x1518b8['emptyContact']('[actionOriginate]\x20',_0x4a8d80,_0x2f0935[_0x34f780]);}else{hopperUtils[_0xcb66('0x210')](_[_0xcb66('0x75')](_0x2f0935[_0x34f780],['CampaignId',_0xcb66('0x16e')]))[_0xcb66('0xa0')](_0x1518b8[_0xcb66('0x1f2')](_0x4a8d80,_0x2f0935[_0x34f780]))[_0xcb66('0xa3')](function(_0x43af13){logger[_0xcb66('0x66')](_0xcb66('0x211'),_0x43af13);utils[_0xcb66('0x100')](_0x4a8d80,_0xcb66('0x212'));});}}}}})[_0xcb66('0xa3')](function(_0x10b6e8){_0x4a8d80[_0xcb66('0x209')]=0x0;logger['error'](_0xcb66('0x213'),_0x10b6e8);});}};Dialer[_0xcb66('0x1a')][_0xcb66('0xb4')]=function(_0x39127d,_0x3ea5bd){var _0x2b6271=this;var _0x54408e=[];if(_0x3ea5bd<0x1||_0x39127d[_0xcb66('0xb2')]==='booked'){_0x3ea5bd=0x1;}var _0x3574b2=Math['floor'](_0x39127d['available']*_0x3ea5bd)-_0x39127d[_0xcb66('0x7e')];if(_0x39127d[_0xcb66('0x214')]>0x0){var _0x43b942=_0x39127d[_0xcb66('0x214')]-_0x39127d[_0xcb66('0x7e')]-_0x39127d[_0xcb66('0x14b')]-_0x39127d[_0xcb66('0x14c')];if(_0x3574b2>_0x43b942){_0x3574b2=_0x43b942;}}if(_0x3574b2>0x0&&_0x39127d[_0xcb66('0x209')]==0x0){if(_0x39127d[_0xcb66('0xb2')]===_0xcb66('0xb6')){_0x3574b2=0x1;}if(_0x3574b2>this[_0xcb66('0x23')]){_0x3574b2=this['maxNumberOriginate'];}for(var _0x39bffa in this['agents']){if(typeof this[_0xcb66('0x21')][_0x39bffa]!=='undefined'){if(this['agents'][_0x39bffa][_0xcb66('0x6e')]===_0xcb66('0x215')&&this[_0xcb66('0x21')][_0x39bffa][_0xcb66('0x89')]==='reachable'){_0x54408e[_0xcb66('0x9b')](this['agents'][_0x39bffa]['id']);}}}_0x39127d['temp']=0x1;hopperUtils['getContactDialer'](_0x39127d,_0x54408e,_0x3574b2)['then'](function(_0x147060){_0x39127d[_0xcb66('0x209')]=0x0;if(_0x147060){if(!utils['checkContactEmpty'](_0x147060)){hopperUtils[_0xcb66('0x216')](_0x39127d)[_0xcb66('0xa0')](sendMessageReschedule(_0x39127d))[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x217')));}else{_0x39127d[_0xcb66('0x7e')]+=_0x147060[_0xcb66('0x9a')];_0x39127d[_0xcb66('0x6d')]=_0x39127d[_0xcb66('0xb2')]===_0xcb66('0xb6')?utils[_0xcb66('0x69')][_0xcb66('0x14d')]:utils['CAMPAIGN_STATUS'][_0xcb66('0x20e')];for(var _0x3d8b99=0x0;_0x3d8b99<_0x147060['length'];_0x3d8b99+=0x1){if(_[_0xcb66('0xf6')](_0x147060[_0x3d8b99])||_['isNil'](_0x147060[_0x3d8b99]['Contact'])||_[_0xcb66('0xf6')](_0x147060[_0x3d8b99][_0xcb66('0x16e')])){_0x2b6271[_0xcb66('0x164')](_0xcb66('0x218'),_0x39127d,_0x147060[_0x3d8b99]);}else{hopperUtils[_0xcb66('0x219')](_['pick'](_0x147060[_0x3d8b99],[_0xcb66('0x102'),_0xcb66('0x16e')]))[_0xcb66('0xa0')](_0x2b6271['checkContactBlack'](_0x39127d,_0x147060[_0x3d8b99]))['catch'](function(_0xd3f7e8){logger[_0xcb66('0x66')](_0xcb66('0x21a'),_0xd3f7e8);utils[_0xcb66('0x100')](_0x39127d,_0xcb66('0x21b'));});}}}}})[_0xcb66('0xa3')](function(_0x26b033){_0x39127d[_0xcb66('0x209')]=0x0;logger[_0xcb66('0x66')](_0xcb66('0x213'),_0x26b033);});}};Dialer[_0xcb66('0x1a')][_0xcb66('0x64')]=function(_0x31e621){if(_0x31e621[_0xcb66('0x214')]>0x0){var _0x41464d=_0x31e621[_0xcb66('0x214')]-_0x31e621[_0xcb66('0x7e')]-_0x31e621[_0xcb66('0x14b')];if(_0x41464d>0x0&&_0x31e621[_0xcb66('0x209')]==0x0){this['tryOriginatePredictive'](_0x31e621);}else{loggerPredictiveCalls['info'](_0xcb66('0x21c'));}}else{this[_0xcb66('0x21d')](_0x31e621);}};Dialer['prototype'][_0xcb66('0x21d')]=function(_0x4f6cec){var _0x15e1f2=this;var _0x4f92ec=[];_0x4f6cec['originated']+=0x1;for(var _0x1009b7 in this['agents']){if(typeof this[_0xcb66('0x21')][_0x1009b7]!==_0xcb66('0xad')){if(this[_0xcb66('0x21')][_0x1009b7][_0xcb66('0x6e')]===_0xcb66('0x215')&&this['agents'][_0x1009b7][_0xcb66('0x89')]===_0xcb66('0x8a')){_0x4f92ec[_0xcb66('0x9b')](this[_0xcb66('0x21')][_0x1009b7]['id']);}}}_0x4f6cec[_0xcb66('0x209')]=0x1;return this[_0xcb66('0x21e')](_0x4f6cec['id'],_0x4f92ec,0x1,_0x4f6cec['dialOrderByScheduledAt'],_0x4f6cec)[_0xcb66('0xa0')](function(_0x5463a6){_0x4f6cec[_0xcb66('0x209')]=0x1;if(_0x5463a6){if(!utils['checkContactEmpty'](_0x5463a6)){utils[_0xcb66('0x21f')](_0x4f6cec,0x1,0x0);return hopperUtils[_0xcb66('0x216')](_0x4f6cec)[_0xcb66('0xa0')](sendMessageReschedule(_0x4f6cec))[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x217')));}else{_0x4f6cec['message']=utils['CAMPAIGN_STATUS'][_0xcb66('0x20e')];if(_[_0xcb66('0xf6')](_0x5463a6[0x0])||_[_0xcb66('0xf6')](_0x5463a6[0x0][_0xcb66('0x220')])||_[_0xcb66('0xf6')](_0x5463a6[0x0][_0xcb66('0x16e')])){_0x15e1f2[_0xcb66('0x164')]('[actionOriginate]\x20',_0x4f6cec,_0x5463a6[0x0]);}else{return hopperUtils[_0xcb66('0x219')](_[_0xcb66('0x75')](_0x5463a6[0x0],[_0xcb66('0x102'),_0xcb66('0x16e')]))[_0xcb66('0xa0')](_0x15e1f2['checkContactBlack'](_0x4f6cec,_0x5463a6[0x0]))[_0xcb66('0xa3')](function(_0x563d69){logger[_0xcb66('0x66')]('[actionOriginatePredictive]',_0x563d69);utils[_0xcb66('0x100')](_0x4f6cec,'[actionOriginatePredictive]');});}}}})[_0xcb66('0xa3')](function(_0x5849a9){_0x4f6cec[_0xcb66('0x209')]=0x0;logger[_0xcb66('0x66')](_0xcb66('0x213'),_0x5849a9);});};Dialer[_0xcb66('0x1a')][_0xcb66('0x1e6')]=function(_0x5c1341,_0x56ace3,_0x3c2f2d,_0x39b409,_0x5d37c9,_0x3f011a){loggerPredictive[_0xcb66('0x45')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info']('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',_0x5c1341);loggerPredictive['info'](_0xcb66('0x221'),_0x56ace3);loggerPredictive[_0xcb66('0x45')]('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',_0x3c2f2d);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x222'),_0x39b409);loggerPredictive[_0xcb66('0x45')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d37c9);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x50'));return new Promise(function(_0x152508,_0x571f30){if(_0x5c1341<=0x0||isNaN(_0x5c1341)){return _0x571f30(msgResponse(_0xcb66('0x223'),'Error',_0xcb66('0x224')+_0x5c1341));}if(_0x3c2f2d<=0x0||isNaN(_0x3c2f2d)){return _0x571f30(msgResponse('[abandonmentRate]',_0xcb66('0x85'),'Ts\x20=\x20'+_0x3c2f2d));}if(_0x39b409<=0x0||isNaN(_0x39b409)){return _0x571f30(msgResponse('[abandonmentRate]',_0xcb66('0x85'),'p\x20=\x20'+_0x39b409));}if(_0x56ace3<=0x0||isNaN(_0x56ace3)){return _0x571f30(msgResponse('[abandonmentRate]',_0xcb66('0x85'),_0xcb66('0x225')+_0x56ace3));}if(_0x5d37c9<=0x0||isNaN(_0x5d37c9)){return _0x571f30(msgResponse('[abandonmentRate]',_0xcb66('0x85'),_0xcb66('0x226')+_0x5d37c9));}_0x3f011a=_0x3f011a||0x0;var _0x5ebfd2=0x1/_0x3c2f2d;var _0x303bb8=0x0;var _0x561cc9=0x0;var _0x4e3f85=0x0;var _0x946339=0x0;for(var _0x2bb371=0x0;_0x4e3f85<_0x5d37c9;_0x2bb371+=0x1){_0x561cc9=_0x2bb371/_0x56ace3;_0x303bb8=(_0x39b409*_0x561cc9+_0x3f011a)/_0x5ebfd2;_0x4e3f85=utils['erlangb'](_0x303bb8,_0x5c1341);_0x946339=_0x303bb8/_0x5c1341*(0x1-utils['erlangb'](_0x303bb8,_0x5c1341));}return _0x152508({'erlangCalls':_0x2bb371,'erlangCallToSecond':_0x56ace3/_0x2bb371,'erlangAbandonmentRate':_0x4e3f85,'erlangBusyFactor':_0x946339});});};Dialer[_0xcb66('0x1a')][_0xcb66('0x227')]=function(_0x48b026,_0x18c56a,_0x4607a0,_0x284d5e,_0x1ccfab,_0x288747){loggerPredictive[_0xcb66('0x45')](_0xcb66('0x228'));loggerPredictive['info']('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',_0x48b026);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x221'),_0x18c56a);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x229'),_0x4607a0);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x222'),_0x284d5e);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x22a'),_0x1ccfab);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x50'));return new Promise(function(_0x57fd15,_0x279db6){if(_0x48b026<=0x0||isNaN(_0x48b026)){return _0x279db6(msgResponse('[busyFactor]','Error',_0xcb66('0x224')+_0x48b026));}if(_0x4607a0<=0x0||isNaN(_0x4607a0)){return _0x279db6(msgResponse(_0xcb66('0x22b'),_0xcb66('0x85'),_0xcb66('0x22c')+_0x4607a0));}if(_0x284d5e<=0x0||isNaN(_0x284d5e)){return _0x279db6(msgResponse(_0xcb66('0x22b'),_0xcb66('0x85'),_0xcb66('0x22d')+_0x284d5e));}if(_0x18c56a<=0x0||isNaN(_0x18c56a)){return _0x279db6(msgResponse(_0xcb66('0x22b'),_0xcb66('0x85'),_0xcb66('0x225')+_0x18c56a));}if(_0x1ccfab<=0x0||isNaN(_0x1ccfab)){return _0x279db6(msgResponse('[busyFactor]','Error',_0xcb66('0x22e')+_0x1ccfab));}_0x288747=_0x288747||0x0;var _0x5eeb26=0x1/_0x4607a0;var _0x57e479=0x0;var _0x4234c7=0x0;var _0x1bedc3=0x0;var _0x4cabc2=0x0;for(var _0x18c05e=0x0;_0x4cabc2<_0x1ccfab;_0x18c05e+=0x1){_0x4234c7=_0x18c05e/_0x18c56a;_0x57e479=(_0x284d5e*_0x4234c7+_0x288747)/_0x5eeb26;_0x1bedc3=utils[_0xcb66('0x22f')](_0x57e479,_0x48b026);_0x4cabc2=_0x57e479/_0x48b026*(0x1-utils['erlangb'](_0x57e479,_0x48b026));}return _0x57fd15({'erlangCalls':_0x18c05e,'erlangCallToSecond':_0x18c56a/_0x18c05e,'erlangAbandonmentRate':_0x1bedc3,'erlangBusyFactor':_0x4cabc2});});};module['exports']=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 260a02d..07d257e 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 _0x14a1=['originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','number','getQueue','exports','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x3f9a79,_0x240a33){var _0x2dfcc3=function(_0x2bb6f5){while(--_0x2bb6f5){_0x3f9a79['push'](_0x3f9a79['shift']());}};_0x2dfcc3(++_0x240a33);}(_0x14a1,0x168));var _0x114a=function(_0x30c80a,_0x8d6289){_0x30c80a=_0x30c80a-0x0;var _0x3c9c12=_0x14a1[_0x30c80a];return _0x3c9c12;};'use strict';var util=require('util');var _=require(_0x114a('0x0'));var moment=require('moment');function checkNameSurname(_0x521ad9,_0x3f7329,_0x2049c1){var _0x2e3f09='';if(!_[_0x114a('0x1')](_0x3f7329)&&'string'===typeof _0x3f7329){_0x2e3f09+=_0x3f7329;}if(!_[_0x114a('0x1')](_0x2049c1)&&_0x114a('0x2')===typeof _0x2049c1){_0x2e3f09+='\x20'+_0x2049c1;}if(_0x2e3f09!==''){return _0x2e3f09;}return _0x521ad9;}function Action(_0x5a460c,_0x103a31,_0x3cf757){this[_0x114a('0x3')]=_0x5a460c;this[_0x114a('0x4')]=_0x3cf757||undefined;this[_0x114a('0x5')]=checkNameSurname(_0x103a31[_0x114a('0x6')][_0x114a('0x7')],_0x103a31[_0x114a('0x6')][_0x114a('0x8')],_0x103a31[_0x114a('0x6')]['lastName']);this['number']=_0x103a31[_0x114a('0x7')];this[_0x114a('0x9')]=_0x5a460c['name'];this[_0x114a('0xa')]=_0x103a31['active']||![];this['type']=_0x5a460c[_0x114a('0xb')];this[_0x114a('0xc')]=_0x5a460c[_0x114a('0xc')]||0x3;this[_0x114a('0xd')]=_0x103a31[_0x114a('0xd')];this[_0x114a('0xe')]=_0x103a31[_0x114a('0xe')];this[_0x114a('0xf')]=_0x103a31[_0x114a('0xf')];this[_0x114a('0x10')]=_0x103a31[_0x114a('0x10')];this[_0x114a('0x11')]=_0x103a31[_0x114a('0x11')];this[_0x114a('0x12')]=_0x103a31[_0x114a('0x12')];this[_0x114a('0x13')]=_0x103a31['countabandonedretry'];this[_0x114a('0x14')]=_0x103a31[_0x114a('0x14')];this[_0x114a('0x15')]=_0x103a31[_0x114a('0x15')];this[_0x114a('0x16')]=_0x103a31['ContactId'];this[_0x114a('0x17')]=_0x103a31[_0x114a('0x17')];this['UserId']=_0x103a31[_0x114a('0x18')];this[_0x114a('0x19')]=_0x103a31[_0x114a('0x19')];this[_0x114a('0x1a')]=_0x103a31['CampaignId'];this[_0x114a('0x1b')]=_0x103a31['id'];this[_0x114a('0x1c')]=_0x103a31[_0x114a('0x6')]['firstName']||'';this[_0x114a('0x1d')]=moment()[_0x114a('0x1e')](_0x114a('0x1f'));this[_0x114a('0x20')]=_0x103a31['callback'];this[_0x114a('0x21')]=_0x103a31[_0x114a('0x21')];this['callbackat']=_0x103a31[_0x114a('0x22')];this[_0x114a('0x23')]=_0x103a31[_0x114a('0x23')];this[_0x114a('0x24')]='';this[_0x114a('0x25')]='';}Action[_0x114a('0x26')][_0x114a('0x27')]=function(){return util[_0x114a('0x1e')]('\x22%s\x22\x20<%s>',this['name'],this[_0x114a('0x3')][_0x114a('0x28')]>0x0?this[_0x114a('0x29')]['substring'](this[_0x114a('0x3')]['dialCutDigit']):this[_0x114a('0x29')]);};Action['prototype'][_0x114a('0x2a')]=function(){return this[_0x114a('0x9')];};module[_0x114a('0x2b')]=Action; \ No newline at end of file +var _0xa76d=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','util','lodash','moment','isNil','string','voiceQueue','Contact','firstName','lastName','number','phone','queue','name','active','type','dialQueueTimeout'];(function(_0x121f6d,_0x515797){var _0x4dd075=function(_0x53a4e6){while(--_0x53a4e6){_0x121f6d['push'](_0x121f6d['shift']());}};_0x4dd075(++_0x515797);}(_0xa76d,0x1b3));var _0xda76=function(_0x5c0370,_0x15d3a0){_0x5c0370=_0x5c0370-0x0;var _0x2c94d8=_0xa76d[_0x5c0370];return _0x2c94d8;};'use strict';var util=require(_0xda76('0x0'));var _=require(_0xda76('0x1'));var moment=require(_0xda76('0x2'));function checkNameSurname(_0xc5902a,_0x267b31,_0x29b5ed){var _0x173547='';if(!_['isNil'](_0x267b31)&&'string'===typeof _0x267b31){_0x173547+=_0x267b31;}if(!_[_0xda76('0x3')](_0x29b5ed)&&_0xda76('0x4')===typeof _0x29b5ed){_0x173547+='\x20'+_0x29b5ed;}if(_0x173547!==''){return _0x173547;}return _0xc5902a;}function Action(_0x2a6be2,_0x806cab,_0x257995){this[_0xda76('0x5')]=_0x2a6be2;this['uniqueid']=_0x257995||undefined;this['name']=checkNameSurname(_0x806cab[_0xda76('0x6')]['phone'],_0x806cab[_0xda76('0x6')][_0xda76('0x7')],_0x806cab[_0xda76('0x6')][_0xda76('0x8')]);this[_0xda76('0x9')]=_0x806cab[_0xda76('0xa')];this[_0xda76('0xb')]=_0x2a6be2[_0xda76('0xc')];this[_0xda76('0xd')]=_0x806cab[_0xda76('0xd')]||![];this['type']=_0x2a6be2[_0xda76('0xe')];this[_0xda76('0xf')]=_0x2a6be2[_0xda76('0xf')]||0x3;this['scheduledat']=_0x806cab['scheduledat'];this[_0xda76('0x10')]=_0x806cab[_0xda76('0x10')];this[_0xda76('0x11')]=_0x806cab[_0xda76('0x11')];this['countnoanswerretry']=_0x806cab[_0xda76('0x12')];this[_0xda76('0x13')]=_0x806cab[_0xda76('0x13')];this[_0xda76('0x14')]=_0x806cab[_0xda76('0x14')];this[_0xda76('0x15')]=_0x806cab['countabandonedretry'];this[_0xda76('0x16')]=_0x806cab[_0xda76('0x16')];this[_0xda76('0x17')]=_0x806cab[_0xda76('0x17')];this[_0xda76('0x18')]=_0x806cab['ContactId'];this['ListId']=_0x806cab[_0xda76('0x19')];this[_0xda76('0x1a')]=_0x806cab[_0xda76('0x1a')];this['VoiceQueueId']=_0x806cab[_0xda76('0x1b')];this[_0xda76('0x1c')]=_0x806cab[_0xda76('0x1c')];this[_0xda76('0x1d')]=_0x806cab['id'];this[_0xda76('0x1e')]=_0x806cab[_0xda76('0x6')][_0xda76('0x7')]||'';this['starttime']=moment()[_0xda76('0x1f')](_0xda76('0x20'));this[_0xda76('0x21')]=_0x806cab[_0xda76('0x21')];this[_0xda76('0x22')]=_0x806cab[_0xda76('0x22')];this[_0xda76('0x23')]=_0x806cab[_0xda76('0x23')];this['recallme']=_0x806cab['recallme'];this[_0xda76('0x24')]='';this['originatecalleridname']='';}Action[_0xda76('0x25')]['getCaller']=function(){return util[_0xda76('0x1f')](_0xda76('0x26'),this['name'],this[_0xda76('0x5')][_0xda76('0x27')]>0x0?this[_0xda76('0x9')]['substring'](this[_0xda76('0x5')]['dialCutDigit']):this[_0xda76('0x9')]);};Action[_0xda76('0x25')][_0xda76('0x28')]=function(){return this[_0xda76('0xb')];};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 93f1d84..9875ac7 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 _0x514c=['countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x5915e3,_0x27cc50){var _0xd6e25e=function(_0x1c3c92){while(--_0x1c3c92){_0x5915e3['push'](_0x5915e3['shift']());}};_0xd6e25e(++_0x27cc50);}(_0x514c,0xf5));var _0xc514=function(_0x40975a,_0x30bf2c){_0x40975a=_0x40975a-0x0;var _0x52f241=_0x514c[_0x40975a];return _0x52f241;};'use strict';var moment=require(_0xc514('0x0'));var utils=require('../utils');function AgentComplete(_0x2a499c,_0x5e362f){this[_0xc514('0x1')]=0x4;this[_0xc514('0x2')]=_0xc514('0x3');this[_0xc514('0x4')]=_0x2a499c['scheduledat'];this[_0xc514('0x5')]=_0x2a499c[_0xc514('0x5')];this[_0xc514('0x6')]=_0x2a499c['type']==='outbound'?_0xc514('0x7'):_0x2a499c[_0xc514('0x5')];this['countbusyretry']=_0x2a499c[_0xc514('0x8')];this[_0xc514('0x9')]=_0x2a499c[_0xc514('0x9')];this[_0xc514('0xa')]=_0x2a499c[_0xc514('0xa')];this[_0xc514('0xb')]=_0x2a499c[_0xc514('0x8')]+_0x2a499c[_0xc514('0x9')]+_0x2a499c[_0xc514('0xa')]+_0x2a499c[_0xc514('0xc')]+_0x2a499c[_0xc514('0xd')]+_0x2a499c['countabandonedretry']+_0x2a499c[_0xc514('0xe')]+_0x2a499c['countagentrejectretry'];this[_0xc514('0xc')]=_0x2a499c['countnosuchnumberretry'];this[_0xc514('0xd')]=_0x2a499c[_0xc514('0xd')];this[_0xc514('0xf')]=_0x2a499c[_0xc514('0xf')];this[_0xc514('0xe')]=_0x2a499c[_0xc514('0xe')];this[_0xc514('0x10')]=_0x2a499c[_0xc514('0x10')];this[_0xc514('0x11')]=_0x5e362f[_0xc514('0x11')];this['calleridname']=_0x2a499c[_0xc514('0x12')];this[_0xc514('0x13')]=_0x2a499c[_0xc514('0x14')];this[_0xc514('0x15')]=_0x2a499c['starttime'];this[_0xc514('0x16')]=_0x2a499c[_0xc514('0x16')];this[_0xc514('0x17')]=_0x2a499c['answertime'];this['endtime']=moment()[_0xc514('0x18')](_0xc514('0x19'));this['ringtime']=utils[_0xc514('0x1a')](_0x2a499c[_0xc514('0x16')],_0x2a499c['starttime']);this[_0xc514('0x1b')]=utils['getSeconds'](_0x2a499c['answertime'],_0x2a499c[_0xc514('0x16')]);this[_0xc514('0x1c')]=utils[_0xc514('0x1a')](this['endtime'],_0x2a499c[_0xc514('0x17')]);this['queue']=_0x5e362f[_0xc514('0x7')];this[_0xc514('0x1d')]=_0x5e362f[_0xc514('0x1d')];this[_0xc514('0x1e')]=_0x5e362f[_0xc514('0x1e')];this['callback']=_0x2a499c[_0xc514('0x1f')];this[_0xc514('0x20')]=_0x2a499c[_0xc514('0x20')];this[_0xc514('0x21')]=_0x2a499c[_0xc514('0x21')];this['recallme']=_0x2a499c[_0xc514('0x22')];this[_0xc514('0x23')]=_0x2a499c[_0xc514('0x23')];this[_0xc514('0x24')]=_0x2a499c['ListId'];this[_0xc514('0x25')]=_0x2a499c[_0xc514('0x25')];this[_0xc514('0x26')]=_0x2a499c[_0xc514('0x26')];this['CampaignId']=_0x2a499c[_0xc514('0x27')];this[_0xc514('0x28')]=_0x2a499c[_0xc514('0x28')]||'';this['originatecalleridname']=_0x2a499c[_0xc514('0x29')]||'';this[_0xc514('0x2a')]=_0x2a499c[_0xc514('0x2a')];}module['exports']=AgentComplete; \ No newline at end of file +var _0xa26c=['responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa26c,0xed));var _0xca26=function(_0x3ee5b3,_0x2a1b5e){_0x3ee5b3=_0x3ee5b3-0x0;var _0x1e753e=_0xa26c[_0x3ee5b3];return _0x1e753e;};'use strict';var moment=require(_0xca26('0x0'));var utils=require(_0xca26('0x1'));function AgentComplete(_0x52050b,_0x2aebf5){this[_0xca26('0x2')]=0x4;this[_0xca26('0x3')]=_0xca26('0x4');this['scheduledat']=_0x52050b['scheduledat'];this[_0xca26('0x5')]=_0x52050b[_0xca26('0x5')];this[_0xca26('0x6')]=_0x52050b[_0xca26('0x5')]===_0xca26('0x7')?_0xca26('0x8'):_0x52050b['type'];this['countbusyretry']=_0x52050b[_0xca26('0x9')];this[_0xca26('0xa')]=_0x52050b['countcongestionretry'];this['countnoanswerretry']=_0x52050b[_0xca26('0xb')];this['countglobal']=_0x52050b[_0xca26('0x9')]+_0x52050b[_0xca26('0xa')]+_0x52050b[_0xca26('0xb')]+_0x52050b[_0xca26('0xc')]+_0x52050b[_0xca26('0xd')]+_0x52050b[_0xca26('0xe')]+_0x52050b[_0xca26('0xf')]+_0x52050b[_0xca26('0x10')];this[_0xca26('0xc')]=_0x52050b[_0xca26('0xc')];this[_0xca26('0xd')]=_0x52050b[_0xca26('0xd')];this[_0xca26('0xe')]=_0x52050b[_0xca26('0xe')];this['countmachineretry']=_0x52050b[_0xca26('0xf')];this['countagentrejectretry']=_0x52050b[_0xca26('0x10')];this[_0xca26('0x11')]=_0x2aebf5[_0xca26('0x11')];this[_0xca26('0x12')]=_0x52050b['name'];this[_0xca26('0x13')]=_0x52050b['number'];this[_0xca26('0x14')]=_0x52050b[_0xca26('0x14')];this['responsetime']=_0x52050b[_0xca26('0x15')];this[_0xca26('0x16')]=_0x52050b['answertime'];this[_0xca26('0x17')]=moment()[_0xca26('0x18')](_0xca26('0x19'));this[_0xca26('0x1a')]=utils['getSeconds'](_0x52050b[_0xca26('0x15')],_0x52050b[_0xca26('0x14')]);this[_0xca26('0x1b')]=utils[_0xca26('0x1c')](_0x52050b[_0xca26('0x16')],_0x52050b[_0xca26('0x15')]);this['talktime']=utils[_0xca26('0x1c')](this['endtime'],_0x52050b[_0xca26('0x16')]);this['queue']=_0x2aebf5['queue'];this[_0xca26('0x1d')]=_0x2aebf5['membername'];this['reason']=_0x2aebf5[_0xca26('0x1e')];this[_0xca26('0x1f')]=_0x52050b[_0xca26('0x1f')];this[_0xca26('0x20')]=_0x52050b[_0xca26('0x20')];this['callbackat']=_0x52050b[_0xca26('0x21')];this[_0xca26('0x22')]=_0x52050b[_0xca26('0x22')];this[_0xca26('0x23')]=_0x52050b['ContactId'];this[_0xca26('0x24')]=_0x52050b[_0xca26('0x24')];this[_0xca26('0x25')]=_0x52050b[_0xca26('0x25')];this[_0xca26('0x26')]=_0x52050b[_0xca26('0x26')];this[_0xca26('0x27')]=_0x52050b[_0xca26('0x27')];this[_0xca26('0x28')]=_0x52050b[_0xca26('0x28')]||'';this[_0xca26('0x29')]=_0x52050b[_0xca26('0x29')]||'';this[_0xca26('0x2a')]=_0x52050b[_0xca26('0x2a')];}module['exports']=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 d267650..d0d4131 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 _0xa353=['callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime'];(function(_0x1df308,_0x1ffea0){var _0x412321=function(_0x37f53f){while(--_0x37f53f){_0x1df308['push'](_0x1df308['shift']());}};_0x412321(++_0x1ffea0);}(_0xa353,0xf3));var _0x3a35=function(_0x1fcdc7,_0x56de24){_0x1fcdc7=_0x1fcdc7-0x0;var _0x4547a0=_0xa353[_0x1fcdc7];return _0x4547a0;};'use strict';function Final(_0x46362b){this[_0x3a35('0x0')]=_0x46362b[_0x3a35('0x0')];this[_0x3a35('0x1')]=_0x46362b['scheduledat'];this['type']=_0x46362b[_0x3a35('0x2')];this[_0x3a35('0x3')]=_0x46362b[_0x3a35('0x2')]===_0x3a35('0x4')?_0x3a35('0x5'):_0x46362b['type'];this[_0x3a35('0x6')]=_0x46362b[_0x3a35('0x6')];this[_0x3a35('0x7')]=_0x46362b[_0x3a35('0x7')];this['countnoanswerretry']=_0x46362b[_0x3a35('0x8')];this[_0x3a35('0x9')]=_0x46362b['countbusyretry']+_0x46362b[_0x3a35('0x7')]+_0x46362b[_0x3a35('0x8')]+_0x46362b[_0x3a35('0xa')]+_0x46362b[_0x3a35('0xb')]+_0x46362b[_0x3a35('0xc')]+_0x46362b[_0x3a35('0xd')]+_0x46362b[_0x3a35('0xe')];this[_0x3a35('0xa')]=_0x46362b[_0x3a35('0xa')];this[_0x3a35('0xb')]=_0x46362b[_0x3a35('0xb')];this[_0x3a35('0xc')]=_0x46362b[_0x3a35('0xc')];this[_0x3a35('0xd')]=_0x46362b[_0x3a35('0xd')];this[_0x3a35('0xe')]=_0x46362b['countagentrejectretry'];this[_0x3a35('0x5')]=_0x46362b['queue'];this[_0x3a35('0xf')]=_0x46362b[_0x3a35('0xf')];this[_0x3a35('0x10')]=_0x46362b[_0x3a35('0x10')];this[_0x3a35('0x11')]=_0x46362b[_0x3a35('0x11')];this[_0x3a35('0x12')]=_0x46362b['responsetime'];this['endtime']=_0x46362b[_0x3a35('0x12')];this[_0x3a35('0x13')]=_0x46362b['ringtime']||0x0;this['holdtime']=_0x46362b[_0x3a35('0x14')]||0x0;this['talktime']=_0x46362b['talktime']||0x0;this[_0x3a35('0x15')]=_0x46362b['callback'];this['callbackuniqueid']=_0x46362b['callbackuniqueid'];this['callbackat']=_0x46362b[_0x3a35('0x16')];this[_0x3a35('0x17')]=_0x46362b[_0x3a35('0x17')];this[_0x3a35('0x18')]=_0x46362b[_0x3a35('0x18')];this[_0x3a35('0x19')]=_0x46362b[_0x3a35('0x19')];this['UserId']=_0x46362b[_0x3a35('0x1a')];this['VoiceQueueId']=_0x46362b[_0x3a35('0x1b')];this[_0x3a35('0x1c')]=_0x46362b['CampaignId'];this['originatecalleridnum']=_0x46362b['originatecalleridnum']||'';this[_0x3a35('0x1d')]=_0x46362b[_0x3a35('0x1d')]||'';this[_0x3a35('0x1e')]=_0x46362b['state'];this[_0x3a35('0x1f')]=_0x46362b[_0x3a35('0x1f')];}module[_0x3a35('0x20')]=Final; \ No newline at end of file +var _0x06f0=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime'];(function(_0x3b9bc0,_0x1c48df){var _0x9eeb03=function(_0x7fb47d){while(--_0x7fb47d){_0x3b9bc0['push'](_0x3b9bc0['shift']());}};_0x9eeb03(++_0x1c48df);}(_0x06f0,0x1d7));var _0x006f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06f0[_0x3dd15e];return _0x231fd0;};'use strict';function Final(_0xd1de49){this[_0x006f('0x0')]=_0xd1de49[_0x006f('0x0')];this[_0x006f('0x1')]=_0xd1de49[_0x006f('0x1')];this[_0x006f('0x2')]=_0xd1de49[_0x006f('0x2')];this[_0x006f('0x3')]=_0xd1de49[_0x006f('0x2')]==='outbound'?'queue':_0xd1de49['type'];this[_0x006f('0x4')]=_0xd1de49[_0x006f('0x4')];this[_0x006f('0x5')]=_0xd1de49['countcongestionretry'];this[_0x006f('0x6')]=_0xd1de49[_0x006f('0x6')];this[_0x006f('0x7')]=_0xd1de49[_0x006f('0x4')]+_0xd1de49['countcongestionretry']+_0xd1de49['countnoanswerretry']+_0xd1de49[_0x006f('0x8')]+_0xd1de49[_0x006f('0x9')]+_0xd1de49[_0x006f('0xa')]+_0xd1de49[_0x006f('0xb')]+_0xd1de49[_0x006f('0xc')];this[_0x006f('0x8')]=_0xd1de49[_0x006f('0x8')];this['countdropretry']=_0xd1de49[_0x006f('0x9')];this[_0x006f('0xa')]=_0xd1de49[_0x006f('0xa')];this[_0x006f('0xb')]=_0xd1de49[_0x006f('0xb')];this[_0x006f('0xc')]=_0xd1de49[_0x006f('0xc')];this[_0x006f('0xd')]=_0xd1de49[_0x006f('0xd')];this[_0x006f('0xe')]=_0xd1de49[_0x006f('0xe')];this[_0x006f('0xf')]=_0xd1de49[_0x006f('0xf')];this[_0x006f('0x10')]=_0xd1de49[_0x006f('0x10')];this[_0x006f('0x11')]=_0xd1de49['responsetime'];this['endtime']=_0xd1de49[_0x006f('0x11')];this[_0x006f('0x12')]=_0xd1de49[_0x006f('0x12')]||0x0;this[_0x006f('0x13')]=_0xd1de49[_0x006f('0x13')]||0x0;this[_0x006f('0x14')]=_0xd1de49[_0x006f('0x14')]||0x0;this['callback']=_0xd1de49[_0x006f('0x15')];this[_0x006f('0x16')]=_0xd1de49[_0x006f('0x16')];this[_0x006f('0x17')]=_0xd1de49[_0x006f('0x17')];this[_0x006f('0x18')]=_0xd1de49[_0x006f('0x18')];this['ContactId']=_0xd1de49[_0x006f('0x19')];this[_0x006f('0x1a')]=_0xd1de49[_0x006f('0x1a')];this['UserId']=_0xd1de49[_0x006f('0x1b')];this[_0x006f('0x1c')]=_0xd1de49['VoiceQueueId'];this[_0x006f('0x1d')]=_0xd1de49[_0x006f('0x1d')];this[_0x006f('0x1e')]=_0xd1de49[_0x006f('0x1e')]||'';this['originatecalleridname']=_0xd1de49[_0x006f('0x1f')]||'';this[_0x006f('0x20')]=_0xd1de49[_0x006f('0x20')];this['statedesc']=_0xd1de49[_0x006f('0x21')];}module[_0x006f('0x22')]=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 0f6730b..f603868 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 _0x8912=['UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x44aa71,_0x4b254d){var _0x322ef9=function(_0xf219a6){while(--_0xf219a6){_0x44aa71['push'](_0x44aa71['shift']());}};_0x322ef9(++_0x4b254d);}(_0x8912,0xef));var _0x2891=function(_0x233692,_0x3f1d70){_0x233692=_0x233692-0x0;var _0x43330f=_0x8912[_0x233692];return _0x43330f;};'use strict';var moment=require(_0x2891('0x0'));var utils=require(_0x2891('0x1'));function Hangup(_0x1c3df5,_0x4538a4){this[_0x2891('0x2')]=0x4;this[_0x2891('0x3')]=_0x2891('0x4');this['scheduledat']=_0x1c3df5[_0x2891('0x5')];this[_0x2891('0x6')]=_0x1c3df5[_0x2891('0x6')];this[_0x2891('0x7')]=_0x1c3df5[_0x2891('0x6')]===_0x2891('0x8')?_0x2891('0x9'):_0x1c3df5[_0x2891('0x6')];this['amd']=_0x1c3df5[_0x2891('0xa')]||![];this[_0x2891('0xb')]=_0x1c3df5[_0x2891('0xb')];this[_0x2891('0xc')]=_0x1c3df5[_0x2891('0xc')];this[_0x2891('0xd')]=_0x1c3df5[_0x2891('0xd')];this[_0x2891('0xe')]=_0x1c3df5[_0x2891('0xb')]+_0x1c3df5['countcongestionretry']+_0x1c3df5['countnoanswerretry']+_0x1c3df5[_0x2891('0xf')]+_0x1c3df5['countdropretry']+_0x1c3df5['countabandonedretry']+_0x1c3df5[_0x2891('0x10')]+_0x1c3df5[_0x2891('0x11')];this[_0x2891('0xf')]=_0x1c3df5[_0x2891('0xf')];this[_0x2891('0x12')]=_0x1c3df5[_0x2891('0x12')];this[_0x2891('0x13')]=_0x1c3df5[_0x2891('0x13')];this[_0x2891('0x10')]=_0x1c3df5[_0x2891('0x10')];this[_0x2891('0x11')]=_0x1c3df5['countagentrejectretry'];this[_0x2891('0x14')]=_0x4538a4[_0x2891('0x14')];this[_0x2891('0x15')]=_0x1c3df5[_0x2891('0x16')];this[_0x2891('0x17')]=_0x1c3df5[_0x2891('0x18')];this[_0x2891('0x19')]=_0x1c3df5[_0x2891('0x19')];this['responsetime']=_0x1c3df5[_0x2891('0x1a')];this[_0x2891('0x1b')]=moment()[_0x2891('0x1c')](_0x2891('0x1d'));this[_0x2891('0x1e')]=utils[_0x2891('0x1f')](_0x1c3df5[_0x2891('0x1a')],_0x1c3df5[_0x2891('0x19')]);this[_0x2891('0x20')]=0x0;this[_0x2891('0x21')]=utils[_0x2891('0x1f')](this[_0x2891('0x1b')],_0x1c3df5['responsetime']);this[_0x2891('0x9')]=_0x1c3df5['queue'];this['membername']=_0x2891('0x22');this[_0x2891('0x23')]=_0x4538a4[_0x2891('0x24')];this['callback']=_0x1c3df5[_0x2891('0x25')];this[_0x2891('0x26')]=_0x1c3df5[_0x2891('0x26')];this[_0x2891('0x27')]=_0x1c3df5['callbackat'];this[_0x2891('0x28')]=_0x1c3df5[_0x2891('0x28')];this[_0x2891('0x29')]=_0x1c3df5[_0x2891('0x29')];this[_0x2891('0x2a')]=_0x1c3df5[_0x2891('0x2a')];this[_0x2891('0x2b')]=_0x1c3df5[_0x2891('0x2b')];this[_0x2891('0x2c')]=_0x1c3df5['VoiceQueueId'];this[_0x2891('0x2d')]=_0x1c3df5[_0x2891('0x2d')];}module[_0x2891('0x2e')]=Hangup; \ No newline at end of file +var _0x93da=['responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','queue','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridnum','number','starttime'];(function(_0x42968e,_0x3bea04){var _0xe76974=function(_0x2115a1){while(--_0x2115a1){_0x42968e['push'](_0x42968e['shift']());}};_0xe76974(++_0x3bea04);}(_0x93da,0x8b));var _0xa93d=function(_0xf73a39,_0x222a74){_0xf73a39=_0xf73a39-0x0;var _0x244f68=_0x93da[_0xf73a39];return _0x244f68;};'use strict';var moment=require(_0xa93d('0x0'));var utils=require(_0xa93d('0x1'));function Hangup(_0x51b754,_0x151558){this['state']=0x4;this['statedesc']=_0xa93d('0x2');this['scheduledat']=_0x51b754[_0xa93d('0x3')];this[_0xa93d('0x4')]=_0x51b754[_0xa93d('0x4')];this[_0xa93d('0x5')]=_0x51b754['type']===_0xa93d('0x6')?'queue':_0x51b754[_0xa93d('0x4')];this[_0xa93d('0x7')]=_0x51b754[_0xa93d('0x7')]||![];this[_0xa93d('0x8')]=_0x51b754[_0xa93d('0x8')];this[_0xa93d('0x9')]=_0x51b754[_0xa93d('0x9')];this['countnoanswerretry']=_0x51b754['countnoanswerretry'];this[_0xa93d('0xa')]=_0x51b754[_0xa93d('0x8')]+_0x51b754[_0xa93d('0x9')]+_0x51b754[_0xa93d('0xb')]+_0x51b754[_0xa93d('0xc')]+_0x51b754[_0xa93d('0xd')]+_0x51b754['countabandonedretry']+_0x51b754[_0xa93d('0xe')]+_0x51b754[_0xa93d('0xf')];this[_0xa93d('0xc')]=_0x51b754[_0xa93d('0xc')];this['countdropretry']=_0x51b754[_0xa93d('0xd')];this[_0xa93d('0x10')]=_0x51b754['countabandonedretry'];this[_0xa93d('0xe')]=_0x51b754['countmachineretry'];this[_0xa93d('0xf')]=_0x51b754[_0xa93d('0xf')];this[_0xa93d('0x11')]=_0x151558['uniqueid'];this['calleridname']=_0x51b754['name'];this[_0xa93d('0x12')]=_0x51b754[_0xa93d('0x13')];this[_0xa93d('0x14')]=_0x51b754[_0xa93d('0x14')];this[_0xa93d('0x15')]=_0x51b754[_0xa93d('0x15')];this[_0xa93d('0x16')]=moment()[_0xa93d('0x17')](_0xa93d('0x18'));this[_0xa93d('0x19')]=utils[_0xa93d('0x1a')](_0x51b754[_0xa93d('0x15')],_0x51b754[_0xa93d('0x14')]);this['holdtime']=0x0;this['talktime']=utils[_0xa93d('0x1a')](this[_0xa93d('0x16')],_0x51b754['responsetime']);this['queue']=_0x51b754[_0xa93d('0x1b')];this[_0xa93d('0x1c')]='IVR';this[_0xa93d('0x1d')]=_0x151558[_0xa93d('0x1e')];this[_0xa93d('0x1f')]=_0x51b754[_0xa93d('0x1f')];this[_0xa93d('0x20')]=_0x51b754[_0xa93d('0x20')];this[_0xa93d('0x21')]=_0x51b754[_0xa93d('0x21')];this[_0xa93d('0x22')]=_0x51b754['recallme'];this['ContactId']=_0x51b754['ContactId'];this['ListId']=_0x51b754[_0xa93d('0x23')];this[_0xa93d('0x24')]=_0x51b754[_0xa93d('0x24')];this[_0xa93d('0x25')]=_0x51b754[_0xa93d('0x25')];this[_0xa93d('0x26')]=_0x51b754[_0xa93d('0x26')];}module[_0xa93d('0x27')]=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 4a943af..2799141 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 _0x8825=['name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry'];(function(_0x5e3811,_0xfa8c1c){var _0x349cef=function(_0x3f4bf0){while(--_0x3f4bf0){_0x5e3811['push'](_0x5e3811['shift']());}};_0x349cef(++_0xfa8c1c);}(_0x8825,0x85));var _0x5882=function(_0x429581,_0x2dee24){_0x429581=_0x429581-0x0;var _0x3f8080=_0x8825[_0x429581];return _0x3f8080;};'use strict';var utils=require('../utils');function History(_0x57f261){this[_0x5882('0x0')]=_0x57f261[_0x5882('0x0')];this[_0x5882('0x1')]=_0x57f261[_0x5882('0x1')]||undefined;this[_0x5882('0x2')]=_0x57f261[_0x5882('0x2')];this[_0x5882('0x3')]=_0x57f261[_0x5882('0x2')]===_0x5882('0x4')?_0x5882('0x5'):_0x57f261[_0x5882('0x2')];this[_0x5882('0x6')]=_0x57f261[_0x5882('0x6')];this['countcongestionretry']=_0x57f261[_0x5882('0x7')];this[_0x5882('0x8')]=_0x57f261[_0x5882('0x8')];this[_0x5882('0x9')]=_0x57f261[_0x5882('0x6')]+_0x57f261[_0x5882('0x7')]+_0x57f261[_0x5882('0x8')]+_0x57f261[_0x5882('0xa')]+_0x57f261['countdropretry']+_0x57f261[_0x5882('0xb')]+_0x57f261[_0x5882('0xc')]+_0x57f261[_0x5882('0xd')];this[_0x5882('0xa')]=_0x57f261['countnosuchnumberretry'];this['countdropretry']=_0x57f261[_0x5882('0xe')];this[_0x5882('0xb')]=_0x57f261[_0x5882('0xb')];this[_0x5882('0xc')]=_0x57f261[_0x5882('0xc')];this[_0x5882('0xd')]=_0x57f261[_0x5882('0xd')];this[_0x5882('0x5')]=_0x57f261[_0x5882('0x5')];this['calleridname']=_0x57f261[_0x5882('0xf')];this[_0x5882('0x10')]=_0x57f261[_0x5882('0x11')];this[_0x5882('0x12')]=_0x57f261[_0x5882('0x12')];this[_0x5882('0x13')]=_0x57f261['responsetime'];this[_0x5882('0x14')]=_0x57f261[_0x5882('0x13')];this['ringtime']=utils[_0x5882('0x15')](_0x57f261['responsetime'],_0x57f261[_0x5882('0x12')]);this[_0x5882('0x16')]=0x0;this['talktime']=0x0;this[_0x5882('0x17')]=_0x57f261[_0x5882('0x17')];this[_0x5882('0x18')]=_0x57f261[_0x5882('0x18')];this[_0x5882('0x19')]=_0x57f261[_0x5882('0x19')];this[_0x5882('0x1a')]=_0x57f261[_0x5882('0x1a')];this['ContactId']=_0x57f261[_0x5882('0x1b')];this['ListId']=_0x57f261[_0x5882('0x1c')];this[_0x5882('0x1d')]=_0x57f261[_0x5882('0x1d')];this[_0x5882('0x1e')]=_0x57f261[_0x5882('0x1e')];this[_0x5882('0x1f')]=_0x57f261['CampaignId'];this['originatecalleridnum']=_0x57f261[_0x5882('0x20')]||'';this[_0x5882('0x21')]=_0x57f261[_0x5882('0x21')]||'';this['state']=_0x57f261[_0x5882('0x22')];this['statedesc']=_0x57f261[_0x5882('0x23')];}module[_0x5882('0x24')]=History; \ No newline at end of file +var _0x6467=['responsetime','endtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','../utils','uniqueid','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime'];(function(_0x46021c,_0x5890eb){var _0x33aabe=function(_0x4bdeb0){while(--_0x4bdeb0){_0x46021c['push'](_0x46021c['shift']());}};_0x33aabe(++_0x5890eb);}(_0x6467,0x179));var _0x7646=function(_0x461004,_0xe15a6){_0x461004=_0x461004-0x0;var _0x370ca6=_0x6467[_0x461004];return _0x370ca6;};'use strict';var utils=require(_0x7646('0x0'));function History(_0x3d0207){this['uniqueid']=_0x3d0207[_0x7646('0x1')];this['scheduledat']=_0x3d0207[_0x7646('0x2')]||undefined;this['type']=_0x3d0207['type'];this['campaigntype']=_0x3d0207[_0x7646('0x3')]==='outbound'?'queue':_0x3d0207[_0x7646('0x3')];this[_0x7646('0x4')]=_0x3d0207['countbusyretry'];this['countcongestionretry']=_0x3d0207[_0x7646('0x5')];this[_0x7646('0x6')]=_0x3d0207[_0x7646('0x6')];this[_0x7646('0x7')]=_0x3d0207['countbusyretry']+_0x3d0207[_0x7646('0x5')]+_0x3d0207[_0x7646('0x6')]+_0x3d0207['countnosuchnumberretry']+_0x3d0207[_0x7646('0x8')]+_0x3d0207[_0x7646('0x9')]+_0x3d0207['countmachineretry']+_0x3d0207['countagentrejectretry'];this[_0x7646('0xa')]=_0x3d0207[_0x7646('0xa')];this[_0x7646('0x8')]=_0x3d0207[_0x7646('0x8')];this[_0x7646('0x9')]=_0x3d0207[_0x7646('0x9')];this[_0x7646('0xb')]=_0x3d0207[_0x7646('0xb')];this['countagentrejectretry']=_0x3d0207[_0x7646('0xc')];this[_0x7646('0xd')]=_0x3d0207[_0x7646('0xd')];this[_0x7646('0xe')]=_0x3d0207[_0x7646('0xf')];this[_0x7646('0x10')]=_0x3d0207[_0x7646('0x11')];this[_0x7646('0x12')]=_0x3d0207['starttime'];this[_0x7646('0x13')]=_0x3d0207[_0x7646('0x13')];this[_0x7646('0x14')]=_0x3d0207[_0x7646('0x13')];this['ringtime']=utils[_0x7646('0x15')](_0x3d0207[_0x7646('0x13')],_0x3d0207[_0x7646('0x12')]);this[_0x7646('0x16')]=0x0;this['talktime']=0x0;this[_0x7646('0x17')]=_0x3d0207[_0x7646('0x17')];this[_0x7646('0x18')]=_0x3d0207[_0x7646('0x18')];this[_0x7646('0x19')]=_0x3d0207[_0x7646('0x19')];this['recallme']=_0x3d0207[_0x7646('0x1a')];this['ContactId']=_0x3d0207[_0x7646('0x1b')];this['ListId']=_0x3d0207[_0x7646('0x1c')];this['UserId']=_0x3d0207[_0x7646('0x1d')];this[_0x7646('0x1e')]=_0x3d0207[_0x7646('0x1e')];this[_0x7646('0x1f')]=_0x3d0207[_0x7646('0x1f')];this[_0x7646('0x20')]=_0x3d0207[_0x7646('0x20')]||'';this['originatecalleridname']=_0x3d0207['originatecalleridname']||'';this[_0x7646('0x21')]=_0x3d0207[_0x7646('0x21')];this['statedesc']=_0x3d0207[_0x7646('0x22')];}module[_0x7646('0x23')]=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 94425e4..8e690cd 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 _0xf107=['talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','starttime','responsetime','droptime','dropreason','endtime','getSeconds'];(function(_0x20e718,_0x24a497){var _0x486d38=function(_0x5aa3d4){while(--_0x5aa3d4){_0x20e718['push'](_0x20e718['shift']());}};_0x486d38(++_0x24a497);}(_0xf107,0xf5));var _0x7f10=function(_0x2da634,_0x545707){_0x2da634=_0x2da634-0x0;var _0x18855f=_0xf107[_0x2da634];return _0x18855f;};'use strict';var utils=require(_0x7f10('0x0'));function QueueCallerAbandon(_0x5312d5,_0x97f535){this[_0x7f10('0x1')]=_0x5312d5['scheduledat'];this[_0x7f10('0x2')]=_0x5312d5[_0x7f10('0x2')];this[_0x7f10('0x3')]=_0x5312d5['type']===_0x7f10('0x4')?'queue':_0x5312d5[_0x7f10('0x2')];this[_0x7f10('0x5')]=_0x5312d5[_0x7f10('0x5')];this[_0x7f10('0x6')]=_0x5312d5['countcongestionretry'];this[_0x7f10('0x7')]=_0x5312d5['countnoanswerretry'];this['countglobal']=_0x5312d5[_0x7f10('0x5')]+_0x5312d5[_0x7f10('0x6')]+_0x5312d5[_0x7f10('0x7')]+_0x5312d5['countnosuchnumberretry']+_0x5312d5[_0x7f10('0x8')]+_0x5312d5[_0x7f10('0x9')]+_0x5312d5[_0x7f10('0xa')]+_0x5312d5[_0x7f10('0xb')];this[_0x7f10('0xc')]=_0x5312d5[_0x7f10('0xc')];this[_0x7f10('0x8')]=_0x5312d5[_0x7f10('0x8')];this[_0x7f10('0x9')]=_0x5312d5[_0x7f10('0x9')];this[_0x7f10('0xa')]=_0x5312d5['countmachineretry'];this[_0x7f10('0xb')]=_0x5312d5[_0x7f10('0xb')];this['uniqueid']=_0x97f535[_0x7f10('0xd')];this[_0x7f10('0xe')]=_0x5312d5['name'];this['calleridnum']=_0x5312d5['number'];this[_0x7f10('0xf')]=_0x5312d5[_0x7f10('0xf')];this['responsetime']=_0x5312d5[_0x7f10('0x10')];this[_0x7f10('0x11')]=_0x5312d5[_0x7f10('0x11')];this[_0x7f10('0x12')]=_0x5312d5['dropreason'];this[_0x7f10('0x13')]=this['droptime'];this['ringtime']=utils['getSeconds'](_0x5312d5[_0x7f10('0x10')],_0x5312d5['starttime']);this['holdtime']=utils[_0x7f10('0x14')](this['droptime'],_0x5312d5[_0x7f10('0x10')]);this[_0x7f10('0x15')]=0x0;this[_0x7f10('0x16')]=_0x97f535[_0x7f10('0x16')];this[_0x7f10('0x17')]=_0x97f535['connectedlinename'];this['reason']=_0x97f535[_0x7f10('0x18')];this[_0x7f10('0x19')]=_0x5312d5[_0x7f10('0x19')];this[_0x7f10('0x1a')]=_0x5312d5[_0x7f10('0x1a')];this[_0x7f10('0x1b')]=_0x5312d5[_0x7f10('0x1b')];this[_0x7f10('0x1c')]=_0x5312d5[_0x7f10('0x1c')];this[_0x7f10('0x1d')]=_0x5312d5['ContactId'];this[_0x7f10('0x1e')]=_0x5312d5[_0x7f10('0x1e')];this[_0x7f10('0x1f')]=_0x5312d5[_0x7f10('0x1f')];this[_0x7f10('0x20')]=_0x5312d5[_0x7f10('0x20')];this[_0x7f10('0x21')]=_0x5312d5[_0x7f10('0x21')];this[_0x7f10('0x22')]=_0x5312d5[_0x7f10('0x22')]||'';this['originatecalleridname']=_0x5312d5[_0x7f10('0x23')]||'';this['agiafterat']=_0x5312d5['agiafterat'];this[_0x7f10('0x24')]=_0x5312d5[_0x7f10('0x24')];this['statedesc']=_0x5312d5['statedesc'];}module[_0x7f10('0x25')]=QueueCallerAbandon; \ No newline at end of file +var _0x2883=['exports','../utils','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state'];(function(_0xd9b4b7,_0x288556){var _0x22445d=function(_0x1dbe57){while(--_0x1dbe57){_0xd9b4b7['push'](_0xd9b4b7['shift']());}};_0x22445d(++_0x288556);}(_0x2883,0xfd));var _0x3288=function(_0x54b59a,_0x42ed59){_0x54b59a=_0x54b59a-0x0;var _0x6c4407=_0x2883[_0x54b59a];return _0x6c4407;};'use strict';var utils=require(_0x3288('0x0'));function QueueCallerAbandon(_0x552dac,_0x47b6bf){this[_0x3288('0x1')]=_0x552dac[_0x3288('0x1')];this[_0x3288('0x2')]=_0x552dac[_0x3288('0x2')];this['campaigntype']=_0x552dac[_0x3288('0x2')]==='outbound'?'queue':_0x552dac[_0x3288('0x2')];this['countbusyretry']=_0x552dac[_0x3288('0x3')];this[_0x3288('0x4')]=_0x552dac[_0x3288('0x4')];this[_0x3288('0x5')]=_0x552dac['countnoanswerretry'];this['countglobal']=_0x552dac[_0x3288('0x3')]+_0x552dac[_0x3288('0x4')]+_0x552dac[_0x3288('0x5')]+_0x552dac[_0x3288('0x6')]+_0x552dac['countdropretry']+_0x552dac[_0x3288('0x7')]+_0x552dac[_0x3288('0x8')]+_0x552dac['countagentrejectretry'];this[_0x3288('0x6')]=_0x552dac[_0x3288('0x6')];this[_0x3288('0x9')]=_0x552dac[_0x3288('0x9')];this[_0x3288('0x7')]=_0x552dac[_0x3288('0x7')];this[_0x3288('0x8')]=_0x552dac[_0x3288('0x8')];this[_0x3288('0xa')]=_0x552dac[_0x3288('0xa')];this[_0x3288('0xb')]=_0x47b6bf[_0x3288('0xb')];this[_0x3288('0xc')]=_0x552dac[_0x3288('0xd')];this[_0x3288('0xe')]=_0x552dac[_0x3288('0xf')];this['starttime']=_0x552dac[_0x3288('0x10')];this[_0x3288('0x11')]=_0x552dac[_0x3288('0x11')];this[_0x3288('0x12')]=_0x552dac[_0x3288('0x12')];this[_0x3288('0x13')]=_0x552dac['dropreason'];this[_0x3288('0x14')]=this['droptime'];this[_0x3288('0x15')]=utils[_0x3288('0x16')](_0x552dac[_0x3288('0x11')],_0x552dac['starttime']);this['holdtime']=utils[_0x3288('0x16')](this[_0x3288('0x12')],_0x552dac['responsetime']);this[_0x3288('0x17')]=0x0;this['queue']=_0x47b6bf[_0x3288('0x18')];this[_0x3288('0x19')]=_0x47b6bf[_0x3288('0x1a')];this[_0x3288('0x1b')]=_0x47b6bf[_0x3288('0x1b')];this['callback']=_0x552dac[_0x3288('0x1c')];this[_0x3288('0x1d')]=_0x552dac[_0x3288('0x1d')];this[_0x3288('0x1e')]=_0x552dac[_0x3288('0x1e')];this[_0x3288('0x1f')]=_0x552dac[_0x3288('0x1f')];this[_0x3288('0x20')]=_0x552dac[_0x3288('0x20')];this[_0x3288('0x21')]=_0x552dac[_0x3288('0x21')];this[_0x3288('0x22')]=_0x552dac[_0x3288('0x22')];this['VoiceQueueId']=_0x552dac[_0x3288('0x23')];this[_0x3288('0x24')]=_0x552dac[_0x3288('0x24')];this[_0x3288('0x25')]=_0x552dac[_0x3288('0x25')]||'';this[_0x3288('0x26')]=_0x552dac[_0x3288('0x26')]||'';this[_0x3288('0x27')]=_0x552dac[_0x3288('0x27')];this[_0x3288('0x28')]=_0x552dac[_0x3288('0x28')];this['statedesc']=_0x552dac['statedesc'];}module[_0x3288('0x29')]=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 62d3cde..52f5dd3 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 _0x9a5a=['../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[avgHandleTime]','createHistory','util'];(function(_0x4631eb,_0x55649e){var _0x562eca=function(_0x25a436){while(--_0x25a436){_0x4631eb['push'](_0x4631eb['shift']());}};_0x562eca(++_0x55649e);}(_0x9a5a,0x194));var _0xa9a5=function(_0x4d36d9,_0x3cf6d5){_0x4d36d9=_0x4d36d9-0x0;var _0x17f4c2=_0x9a5a[_0x4d36d9];return _0x17f4c2;};'use strict';var util=require(_0xa9a5('0x0'));var logger=require(_0xa9a5('0x1'))(_0xa9a5('0x2'));var cmHopper=require(_0xa9a5('0x3'));var cmHopperAdditionalPhone=require(_0xa9a5('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xa9a5('0x5'));function inspectError(_0x1e6fb1){return util[_0xa9a5('0x6')](_0x1e6fb1,{'showHidden':![],'depth':null});}function getContactDialer(_0x1080a9,_0x31e823,_0x1ae623){return cmHopper['getContactDialer'](_0x1080a9['id'],_0x31e823,_0x1ae623,_0x1080a9[_0xa9a5('0x7')])[_0xa9a5('0x8')](function(_0x20bbe8){_0x1080a9[_0xa9a5('0x9')]=0x0;logger[_0xa9a5('0xa')]('[getContactDialer]',inspectError(_0x20bbe8));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x57d90b,_0xc95120){return cmHopper[_0xa9a5('0xb')](_0x57d90b['id'],_0xc95120,_0x57d90b[_0xa9a5('0x7')])[_0xa9a5('0x8')](function(_0x158317){_0x57d90b[_0xa9a5('0x9')]=0x0;logger[_0xa9a5('0xa')]('[getContactDialerIvr]',inspectError(_0x158317));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x56f162){return cmHopper[_0xa9a5('0xc')](_0x56f162)[_0xa9a5('0x8')](function(_0x3a5084){logger[_0xa9a5('0xa')](_0xa9a5('0xd'),inspectError(_0x3a5084));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0xe6a34b){return cmHopper[_0xa9a5('0xe')](_0xe6a34b)[_0xa9a5('0x8')](function(_0x453b49){logger[_0xa9a5('0xa')](_0xa9a5('0xf'),inspectError(_0x453b49));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x30a479,_0x25c458,_0x476843){return cmHopper[_0xa9a5('0x10')](_0x30a479,_0x25c458,_0x476843)['catch'](function(_0x3353ca){logger[_0xa9a5('0xa')](_0xa9a5('0x11'),inspectError(_0x3353ca));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x3c505b){return cmHopper['moveContactManagedDialer'](_0x3c505b)['catch'](function(_0x2fb6bc){logger[_0xa9a5('0xa')]('[moveContactManagedDialer]',inspectError(_0x2fb6bc));});}exports[_0xa9a5('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x5d05d5){return cmHopperBlack[_0xa9a5('0x13')](_0x5d05d5)[_0xa9a5('0x8')](function(_0x3bd8e9){logger[_0xa9a5('0xa')](_0xa9a5('0x14'),inspectError(_0x3bd8e9));});}exports[_0xa9a5('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x21ea08){return cmHopperBlack[_0xa9a5('0x15')](_0x21ea08)[_0xa9a5('0x8')](function(_0x19d619){logger[_0xa9a5('0xa')](_0xa9a5('0x16'),inspectError(_0x19d619));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5c8314,_0x59b37c,_0x43017d){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x5c8314,_0x59b37c,_0x43017d)[_0xa9a5('0x8')](function(_0x198821){logger[_0xa9a5('0xa')]('[verifyAdditionalPhone]',inspectError(_0x198821));});}exports[_0xa9a5('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0xb37bcb,_0x341723,_0x4f1076){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xb37bcb,_0x341723,_0x4f1076)[_0xa9a5('0x8')](function(_0x19ccbd){logger[_0xa9a5('0xa')]('[swapAdditionalPhone]',inspectError(_0x19ccbd));});}exports[_0xa9a5('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x45afca){return cmHopperHistory['avgHandleTime'](_0x45afca)[_0xa9a5('0x8')](function(_0x474671){logger['error'](_0xa9a5('0x19'),inspectError(_0x474671));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x11366f){return cmHopperHistory['createHistory'](_0x11366f)[_0xa9a5('0x8')](function(_0x3b271d){logger['error']('[createHistory]',inspectError(_0x3b271d));});}exports[_0xa9a5('0x1a')]=createHistory; \ No newline at end of file +var _0xc4aa=['temp','error','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','getContactDialer','dialOrderByScheduledAt','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xc4aa[_0x2e4aa2];return _0x5e6092;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var cmHopper=require(_0xac4a('0x3'));var cmHopperAdditionalPhone=require(_0xac4a('0x4'));var cmHopperBlack=require(_0xac4a('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x5cda73){return util['inspect'](_0x5cda73,{'showHidden':![],'depth':null});}function getContactDialer(_0x2f48ed,_0x15b967,_0x730a38){return cmHopper[_0xac4a('0x6')](_0x2f48ed['id'],_0x15b967,_0x730a38,_0x2f48ed[_0xac4a('0x7')])[_0xac4a('0x8')](function(_0x3ef77c){_0x2f48ed[_0xac4a('0x9')]=0x0;logger['error']('[getContactDialer]',inspectError(_0x3ef77c));});}exports[_0xac4a('0x6')]=getContactDialer;function getContactDialerIvr(_0x2a4d53,_0x26ec84){return cmHopper['getContactDialerIvr'](_0x2a4d53['id'],_0x26ec84,_0x2a4d53[_0xac4a('0x7')])[_0xac4a('0x8')](function(_0x3e64f5){_0x2a4d53['temp']=0x0;logger[_0xac4a('0xa')]('[getContactDialerIvr]',inspectError(_0x3e64f5));});}exports[_0xac4a('0xb')]=getContactDialerIvr;function countReScheduled(_0x4855b6){return cmHopper[_0xac4a('0xc')](_0x4855b6)[_0xac4a('0x8')](function(_0x24291d){logger['error'](_0xac4a('0xd'),inspectError(_0x24291d));});}exports[_0xac4a('0xc')]=countReScheduled;function rescheduleContact(_0x247b78){return cmHopper[_0xac4a('0xe')](_0x247b78)[_0xac4a('0x8')](function(_0x3b71c0){logger[_0xac4a('0xa')](_0xac4a('0xf'),inspectError(_0x3b71c0));});}exports[_0xac4a('0xe')]=rescheduleContact;function unlockContact(_0x42c7fc,_0x11e101,_0x26dbb8){return cmHopper['unlockContact'](_0x42c7fc,_0x11e101,_0x26dbb8)[_0xac4a('0x8')](function(_0x34d797){logger[_0xac4a('0xa')](_0xac4a('0x10'),inspectError(_0x34d797));});}exports[_0xac4a('0x11')]=unlockContact;function moveContactManagedDialer(_0x387a54){return cmHopper[_0xac4a('0x12')](_0x387a54)[_0xac4a('0x8')](function(_0x546c5d){logger['error'](_0xac4a('0x13'),inspectError(_0x546c5d));});}exports[_0xac4a('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x39b691){return cmHopperBlack['checkIsBlackList'](_0x39b691)[_0xac4a('0x8')](function(_0x15c223){logger[_0xac4a('0xa')](_0xac4a('0x14'),inspectError(_0x15c223));});}exports[_0xac4a('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x3e829c){return cmHopperBlack[_0xac4a('0x16')](_0x3e829c)[_0xac4a('0x8')](function(_0x534092){logger[_0xac4a('0xa')](_0xac4a('0x17'),inspectError(_0x534092));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3d7ce0,_0x4169c0,_0x3eacd3){return cmHopperAdditionalPhone[_0xac4a('0x18')](_0x3d7ce0,_0x4169c0,_0x3eacd3)['catch'](function(_0x1b7998){logger[_0xac4a('0xa')](_0xac4a('0x19'),inspectError(_0x1b7998));});}exports[_0xac4a('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x594f36,_0x2b0dc2,_0x222507){return cmHopperAdditionalPhone[_0xac4a('0x1a')](_0x594f36,_0x2b0dc2,_0x222507)[_0xac4a('0x8')](function(_0x3bc318){logger[_0xac4a('0xa')](_0xac4a('0x1b'),inspectError(_0x3bc318));});}exports[_0xac4a('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x472c57){return cmHopperHistory[_0xac4a('0x1c')](_0x472c57)[_0xac4a('0x8')](function(_0x4e17ce){logger[_0xac4a('0xa')](_0xac4a('0x1d'),inspectError(_0x4e17ce));});}exports[_0xac4a('0x1c')]=avgHandleTime;function createHistory(_0x2772fe){return cmHopperHistory[_0xac4a('0x1e')](_0x2772fe)['catch'](function(_0x47f49c){logger[_0xac4a('0xa')](_0xac4a('0x1f'),inspectError(_0x47f49c));});}exports[_0xac4a('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 1d2de9e..35170e6 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 _0x1f06=['unmonitored','name','includes','status','TrunkBackup','ACTIVE','INACTIVE','waiting','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22\x22\x20<>','getCallerId','\x5cw{0,','replace','random','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','createdAt','tags','updatedAt','description','toUpperCase','toString','substring','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','BLACKLIST','RESCHEDULED_CONTACTS','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','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','inUse','originated','Trunk','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','dialGlobalInterval','SIP/','reachable'];(function(_0x3f3b53,_0x3d035f){var _0x3fa180=function(_0x194ff3){while(--_0x194ff3){_0x3f3b53['push'](_0x3f3b53['shift']());}};_0x3fa180(++_0x3d035f);}(_0x1f06,0x187));var _0x61f0=function(_0x561b49,_0x391670){_0x561b49=_0x561b49-0x0;var _0x353509=_0x1f06[_0x561b49];return _0x353509;};'use strict';var _=require(_0x61f0('0x0'));var moment=require(_0x61f0('0x1'));var util=require(_0x61f0('0x2'));var logger=require(_0x61f0('0x3'))(_0x61f0('0x4'));var timezones=require('../../../../config/environment/shared')['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x61f0('0x5'),'CONTACTS_RESCHEDULED':_0x61f0('0x6'),'DEACTIVATED':_0x61f0('0x7'),'DISACTIVED':_0x61f0('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x61f0('0x9'),'NO_AGENTS_LOGGED':_0x61f0('0xa'),'NO_AVAILABLE_CONTACTS':_0x61f0('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x61f0('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x61f0('0xd'),'QUEUE_RECALL':_0x61f0('0xe'),'RECALL_TIMEOUT':_0x61f0('0xf'),'RUNNING':_0x61f0('0x10'),'UNKNOWN_TIMEZONE':_0x61f0('0x11'),'UNREACHABLE_TRUNK':_0x61f0('0x12')};exports[_0x61f0('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x581520){return _0x581520[_0x61f0('0x14')]===_0x61f0('0x15');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x2538d4){return _0x2538d4[_0x61f0('0x16')]===_0x61f0('0x17');}exports[_0x61f0('0x18')]=isIVRCampaign;function isOutboundQueue(_0x2c2665){return _0x2c2665['type']===_0x61f0('0x19');}exports[_0x61f0('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x38489c){return _0x38489c[_0x61f0('0x1b')];}exports[_0x61f0('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5730af){return _0x5730af[_0x61f0('0x1d')];}exports[_0x61f0('0x1e')]=isIVRCampaignActive;function getSeconds(_0x1f21a8,_0x3a2fb4){var _0x4108db=moment(_0x1f21a8)['milliseconds'](0x0);var _0x3ad4ee=moment(_0x3a2fb4)[_0x61f0('0x1f')](0x0);return _0x4108db[_0x61f0('0x20')](_0x3ad4ee,'seconds');}exports[_0x61f0('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x2d1983,_0x15df5e){var _0x174b97=![];var _0x116988=_0x2d1983[_0x61f0('0x14')]!==_0x15df5e[_0x61f0('0x14')]||_0x2d1983[_0x61f0('0x1b')]!==_0x15df5e[_0x61f0('0x1b')]||_0x2d1983[_0x61f0('0x22')]!==_0x15df5e['message'];var _0x4a735a=_0x2d1983[_0x61f0('0x23')]!==_0x15df5e['available']||_0x2d1983[_0x61f0('0x24')]!==_0x15df5e['loggedIn']||_0x2d1983['loggedInDb']!==_0x15df5e[_0x61f0('0x25')]||_0x2d1983[_0x61f0('0x26')]!==_0x15df5e[_0x61f0('0x26')]||_0x2d1983[_0x61f0('0x27')]!==_0x15df5e[_0x61f0('0x27')]||_0x2d1983[_0x61f0('0x28')]!==_0x15df5e[_0x61f0('0x28')]||_0x2d1983['waiting']!==_0x15df5e['waiting']||_0x2d1983[_0x61f0('0x29')]!==_0x15df5e[_0x61f0('0x29')]||_0x2d1983[_0x61f0('0x2a')]!==_0x15df5e[_0x61f0('0x2a')];if(_0x2d1983[_0x61f0('0x2b')]&&_0x15df5e['Trunk']){_0x174b97=_0x2d1983[_0x61f0('0x2b')]['name']!==_0x15df5e[_0x61f0('0x2b')]['name']||_0x2d1983[_0x61f0('0x2b')][_0x61f0('0x1d')]!==_0x15df5e[_0x61f0('0x2b')][_0x61f0('0x1d')];}return _0x116988||_0x4a735a||_0x174b97;}exports[_0x61f0('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x67c514){var _0x17c4c9=null;var _0xd3da53=_0x67c514[_0x61f0('0x2d')];if(_['isNil'](_0x67c514['dialGlobalInterval'])||_[_0x61f0('0x2e')](_0x67c514[_0x61f0('0x2f')])||_[_0x61f0('0x2e')](_0x67c514['Interval'][_0x61f0('0x30')])){_0x17c4c9=CAMPAIGN_STATUS[_0x61f0('0x31')];}else if(_[_0x61f0('0x32')](_0x67c514[_0x61f0('0x33')])||_[_0x61f0('0x32')](_0x67c514['Interval'][_0x61f0('0x30')])){_0x17c4c9=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0xd3da53&&!timezones[_0xd3da53]){_0x17c4c9=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x17c4c9;}function checkAnyValidTrunk(_0x1b7b24,_0x4655f4){var _0x1074f8=null;var _0x12e40d=_0x61f0('0x34');var _0x43a683=[_0x61f0('0x35'),_0x61f0('0x36')];var _0x2317f6=!![];if(_0x1b7b24[_0x61f0('0x2b')]&&_0x1b7b24[_0x61f0('0x2b')][_0x61f0('0x1d')]){_0x12e40d+=_0x1b7b24[_0x61f0('0x2b')][_0x61f0('0x37')];_0x1074f8=_0x4655f4[_0x12e40d];_0x2317f6=_0x43a683[_0x61f0('0x38')](_0x1074f8[_0x61f0('0x39')]);}else if(_0x1b7b24['TrunkBackup']&&_0x1b7b24[_0x61f0('0x3a')][_0x61f0('0x1d')]){_0x12e40d+=_0x1b7b24[_0x61f0('0x3a')][_0x61f0('0x37')];_0x1074f8=_0x4655f4[_0x12e40d];_0x2317f6=_0x43a683['includes'](_0x1074f8[_0x61f0('0x39')]);}return _0x2317f6;}function getQueueCampaignStatusMessage(_0x328316,_0x4a8c6e){var _0x4cafa4=CAMPAIGN_STATUS[_0x61f0('0x3b')];var _0x1102fe=isPreviewCampaign(_0x328316);if(!isQueueCampaignActive(_0x328316)){if(_0x1102fe){_0x4cafa4=CAMPAIGN_STATUS[_0x61f0('0x3c')];}else{if(_0x328316[_0x61f0('0x2a')]===0x0&&_0x328316['talking']===0x0&&_0x328316[_0x61f0('0x3d')]===0x0&&(_0x328316['pTalking']||0x0)===0x0){_0x4cafa4=CAMPAIGN_STATUS[_0x61f0('0x3c')];}else{_0x4cafa4=CAMPAIGN_STATUS[_0x61f0('0x3e')];}}}else if(_0x328316['loggedIn']===0x0){_0x4cafa4=CAMPAIGN_STATUS[_0x61f0('0x3f')];}else if(!checkAnyValidTrunk(_0x328316,_0x4a8c6e)){_0x4cafa4=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x328316)){var _0x120826=checkAnyValidQueueCampaignInterval(_0x328316);if(_0x120826){_0x4cafa4=_0x120826;}}return _0x4cafa4;}exports[_0x61f0('0x40')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2a80e2){var _0x562a90=CAMPAIGN_STATUS[_0x61f0('0x3e')];if(_0x2a80e2[_0x61f0('0x2a')]===0x0&&_0x2a80e2['talking']===0x0&&_0x2a80e2[_0x61f0('0x3d')]===0x0&&(_0x2a80e2['pTalking']||0x0)===0x0){_0x562a90=CAMPAIGN_STATUS[_0x61f0('0x3c')];}return _0x562a90;}exports[_0x61f0('0x41')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x49de91){var _0x9955d5=_0x49de91[_0x61f0('0x42')](/"(.*?)"/);return _0x9955d5?_0x9955d5[0x1]:_0x49de91;}exports[_0x61f0('0x43')]=extractCalleridName;function getCallerId(_0x2173ff,_0x3a020f,_0x5baa95){if(!_[_0x61f0('0x44')](_0x5baa95)&&typeof _0x5baa95===_0x61f0('0x45')&&!_['isEmpty'](_0x5baa95)){if(!_[_0x61f0('0x44')](_0x3a020f)&&typeof _0x3a020f==='string'&&!_[_0x61f0('0x32')](_0x3a020f)){return util[_0x61f0('0x46')]('\x22%s\x22\x20<%s>',_0x3a020f,_0x5baa95);}return util[_0x61f0('0x46')]('\x22%s\x22\x20<%s>',_0x5baa95,_0x5baa95);}if(!_['isUndefined'](_0x2173ff)&&typeof _0x2173ff===_0x61f0('0x45')&&!_['isEmpty'](_0x2173ff)){return _0x2173ff;}return _0x61f0('0x47');}exports[_0x61f0('0x48')]=getCallerId;function getCallerIdRandom(_0x370b7c,_0x2b4c2e){var _0xb07e2;var _0x27eab4;var _0x588288;if(_0x2b4c2e<=0x0){_0x2b4c2e=0x1;}_0xb07e2=new RegExp(_0x61f0('0x49')+_0x2b4c2e+'}$');_0x27eab4=Math['pow'](0xa,_0x2b4c2e-0x1);_0x588288=Math['pow'](0xa,_0x2b4c2e)-0x1;return util[_0x61f0('0x46')]('%s',_[_0x61f0('0x4a')](_0x370b7c,_0xb07e2,_[_0x61f0('0x4b')](_0x27eab4,_0x588288)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x58f04a,_0x1ef1ef){if(_0x58f04a['originated']&&_0x58f04a[_0x61f0('0x2a')]>0x0){_0x58f04a[_0x61f0('0x2a')]-=0x1;}else{logger['error']('[decrementOriginate]\x20queue\x20originate\x20value',_0x1ef1ef);}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x370873){return _0x370873&&_0x370873[_0x61f0('0x4c')]>0x0;}exports[_0x61f0('0x4d')]=checkContactEmpty;function erlangb(_0x1edf73,_0x1af7ff){if(_0x1af7ff===0x0){return 0x0;}var _0x2b8ca2=0x1;for(var _0x7b62bf=0x1;_0x7b62bf<=_0x1af7ff;_0x7b62bf+=0x1){_0x2b8ca2=0x1+_0x2b8ca2*_0x7b62bf/_0x1edf73;}return 0x1/_0x2b8ca2;}exports[_0x61f0('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x148a9b,_0x81f7a2,_0x1cf7dd){if(_0x81f7a2>_0x1cf7dd){for(var _0xc80a35=0x0;_0xc80a35<_0x81f7a2-_0x1cf7dd;_0xc80a35+=0x1){decrementOriginate(_0x148a9b,_0x61f0('0x4f'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x7dcf78){var _0x5d085b={};var _0x226fd2=['id',_0x61f0('0x50'),_0x61f0('0x51'),_0x61f0('0x52')];const _0x32adde=0xfa;if(_0x7dcf78){for(var _0x1a501b in _0x7dcf78){if(typeof _0x7dcf78[_0x1a501b]!=='undefined'){if(!_['isNil'](_0x7dcf78[_0x1a501b])&&!_0x226fd2[_0x61f0('0x38')](_0x1a501b)){if(_0x1a501b===_0x61f0('0x53')&&_0x7dcf78[_0x1a501b][_0x61f0('0x4c')]>_0x32adde){_0x5d085b['XMD-'+_0x1a501b[_0x61f0('0x54')]()]=_0x7dcf78[_0x1a501b][_0x61f0('0x55')]()[_0x61f0('0x56')](0x0,_0x32adde);}else{_0x5d085b[_0x61f0('0x57')+_0x1a501b[_0x61f0('0x54')]()]=_0x7dcf78[_0x1a501b];}}}}}return _0x5d085b;}exports[_0x61f0('0x58')]=setXMDContactVariables; \ No newline at end of file +var _0x396e=['dialMethod','isPreviewCampaign','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','dialGlobalInterval','Intervals','isEmpty','Interval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','\x22%s\x22\x20<%s>','format','string','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','moment','util','dialer','../../../../config/environment/shared','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x396e,0x10e));var _0xe396=function(_0x55b2d9,_0x8d8130){_0x55b2d9=_0x55b2d9-0x0;var _0x2ebe76=_0x396e[_0x55b2d9];return _0x2ebe76;};'use strict';var _=require(_0xe396('0x0'));var moment=require(_0xe396('0x1'));var util=require(_0xe396('0x2'));var logger=require('../../../../config/logger')(_0xe396('0x3'));var timezones=require(_0xe396('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xe396('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xe396('0x6'),'DEACTIVATED':_0xe396('0x7'),'DISACTIVED':_0xe396('0x8'),'EMPTY_INTERVAL':_0xe396('0x9'),'INACTIVE':_0xe396('0xa'),'NO_AGENTS_LOGGED':_0xe396('0xb'),'NO_AVAILABLE_CONTACTS':_0xe396('0xc'),'NULL_INTERVAL':_0xe396('0xd'),'OVERTIME_INTERVAL':_0xe396('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0xe396('0xf'),'QUEUE_RECALL':_0xe396('0x10'),'RECALL_TIMEOUT':_0xe396('0x11'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xe396('0x12'),'UNREACHABLE_TRUNK':_0xe396('0x13')};exports[_0xe396('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x78e566){return _0x78e566[_0xe396('0x15')]==='preview';}exports[_0xe396('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x29b780){return _0x29b780[_0xe396('0x17')]===_0xe396('0x18');}exports[_0xe396('0x19')]=isIVRCampaign;function isOutboundQueue(_0x17a313){return _0x17a313[_0xe396('0x17')]===_0xe396('0x1a');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x18a072){return _0x18a072[_0xe396('0x1b')];}exports[_0xe396('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2c0c27){return _0x2c0c27[_0xe396('0x1d')];}exports[_0xe396('0x1e')]=isIVRCampaignActive;function getSeconds(_0xedc6cd,_0x4e4d05){var _0x1db0bc=moment(_0xedc6cd)[_0xe396('0x1f')](0x0);var _0x13cb8d=moment(_0x4e4d05)['milliseconds'](0x0);return _0x1db0bc[_0xe396('0x20')](_0x13cb8d,_0xe396('0x21'));}exports[_0xe396('0x22')]=getSeconds;function hasQueueCampaignDataChanged(_0x515b1d,_0x3ee9e8){var _0x5b5fd1=![];var _0x2088ac=_0x515b1d[_0xe396('0x15')]!==_0x3ee9e8[_0xe396('0x15')]||_0x515b1d[_0xe396('0x1b')]!==_0x3ee9e8['dialActive']||_0x515b1d[_0xe396('0x23')]!==_0x3ee9e8[_0xe396('0x23')];var _0x2b6516=_0x515b1d[_0xe396('0x24')]!==_0x3ee9e8[_0xe396('0x24')]||_0x515b1d[_0xe396('0x25')]!==_0x3ee9e8[_0xe396('0x25')]||_0x515b1d[_0xe396('0x26')]!==_0x3ee9e8[_0xe396('0x26')]||_0x515b1d[_0xe396('0x27')]!==_0x3ee9e8['paused']||_0x515b1d[_0xe396('0x28')]!==_0x3ee9e8[_0xe396('0x28')]||_0x515b1d[_0xe396('0x29')]!==_0x3ee9e8[_0xe396('0x29')]||_0x515b1d[_0xe396('0x2a')]!==_0x3ee9e8[_0xe396('0x2a')]||_0x515b1d[_0xe396('0x2b')]!==_0x3ee9e8[_0xe396('0x2b')]||_0x515b1d[_0xe396('0x2c')]!==_0x3ee9e8[_0xe396('0x2c')];if(_0x515b1d[_0xe396('0x2d')]&&_0x3ee9e8[_0xe396('0x2d')]){_0x5b5fd1=_0x515b1d[_0xe396('0x2d')][_0xe396('0x2e')]!==_0x3ee9e8[_0xe396('0x2d')][_0xe396('0x2e')]||_0x515b1d[_0xe396('0x2d')][_0xe396('0x1d')]!==_0x3ee9e8['Trunk'][_0xe396('0x1d')];}return _0x2088ac||_0x2b6516||_0x5b5fd1;}exports[_0xe396('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x450c85){var _0xc4a78e=null;var _0x2b76b1=_0x450c85[_0xe396('0x30')];if(_[_0xe396('0x31')](_0x450c85[_0xe396('0x32')])||_[_0xe396('0x31')](_0x450c85['Interval'])||_[_0xe396('0x31')](_0x450c85['Interval'][_0xe396('0x33')])){_0xc4a78e=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xe396('0x34')](_0x450c85[_0xe396('0x32')])||_['isEmpty'](_0x450c85[_0xe396('0x35')]['Intervals'])){_0xc4a78e=CAMPAIGN_STATUS[_0xe396('0x36')];}else if(_0x2b76b1&&!timezones[_0x2b76b1]){_0xc4a78e=CAMPAIGN_STATUS[_0xe396('0x37')];}return _0xc4a78e;}function checkAnyValidTrunk(_0x5687dd,_0x31fc53){var _0xdfb7c=null;var _0x3fd16b=_0xe396('0x38');var _0xc54f99=[_0xe396('0x39'),'unmonitored'];var _0x1c0c04=!![];if(_0x5687dd[_0xe396('0x2d')]&&_0x5687dd['Trunk'][_0xe396('0x1d')]){_0x3fd16b+=_0x5687dd['Trunk'][_0xe396('0x2e')];_0xdfb7c=_0x31fc53[_0x3fd16b];_0x1c0c04=_0xc54f99[_0xe396('0x3a')](_0xdfb7c[_0xe396('0x3b')]);}else if(_0x5687dd[_0xe396('0x3c')]&&_0x5687dd[_0xe396('0x3c')][_0xe396('0x1d')]){_0x3fd16b+=_0x5687dd[_0xe396('0x3c')]['name'];_0xdfb7c=_0x31fc53[_0x3fd16b];_0x1c0c04=_0xc54f99['includes'](_0xdfb7c[_0xe396('0x3b')]);}return _0x1c0c04;}function getQueueCampaignStatusMessage(_0x4284af,_0x57935b){var _0x2168e2=CAMPAIGN_STATUS['ACTIVE'];var _0x343e58=isPreviewCampaign(_0x4284af);if(!isQueueCampaignActive(_0x4284af)){if(_0x343e58){_0x2168e2=CAMPAIGN_STATUS[_0xe396('0x3d')];}else{if(_0x4284af[_0xe396('0x2c')]===0x0&&_0x4284af[_0xe396('0x28')]===0x0&&_0x4284af[_0xe396('0x2a')]===0x0&&(_0x4284af[_0xe396('0x29')]||0x0)===0x0){_0x2168e2=CAMPAIGN_STATUS[_0xe396('0x3d')];}else{_0x2168e2=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x4284af[_0xe396('0x25')]===0x0){_0x2168e2=CAMPAIGN_STATUS[_0xe396('0x3e')];}else if(!checkAnyValidTrunk(_0x4284af,_0x57935b)){_0x2168e2=CAMPAIGN_STATUS[_0xe396('0x3f')];}else if(!isPreviewCampaign(_0x4284af)){var _0x480ded=checkAnyValidQueueCampaignInterval(_0x4284af);if(_0x480ded){_0x2168e2=_0x480ded;}}return _0x2168e2;}exports[_0xe396('0x40')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x31dffa){var _0x4173da=CAMPAIGN_STATUS[_0xe396('0x41')];if(_0x31dffa[_0xe396('0x2c')]===0x0&&_0x31dffa[_0xe396('0x28')]===0x0&&_0x31dffa[_0xe396('0x2a')]===0x0&&(_0x31dffa[_0xe396('0x29')]||0x0)===0x0){_0x4173da=CAMPAIGN_STATUS[_0xe396('0x3d')];}return _0x4173da;}exports[_0xe396('0x42')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x708c27){var _0x3b3aef=_0x708c27[_0xe396('0x43')](/"(.*?)"/);return _0x3b3aef?_0x3b3aef[0x1]:_0x708c27;}exports[_0xe396('0x44')]=extractCalleridName;function getCallerId(_0x3c2e87,_0x51d438,_0x3f2975){if(!_[_0xe396('0x45')](_0x3f2975)&&typeof _0x3f2975==='string'&&!_[_0xe396('0x34')](_0x3f2975)){if(!_[_0xe396('0x45')](_0x51d438)&&typeof _0x51d438==='string'&&!_[_0xe396('0x34')](_0x51d438)){return util['format'](_0xe396('0x46'),_0x51d438,_0x3f2975);}return util[_0xe396('0x47')](_0xe396('0x46'),_0x3f2975,_0x3f2975);}if(!_[_0xe396('0x45')](_0x3c2e87)&&typeof _0x3c2e87===_0xe396('0x48')&&!_[_0xe396('0x34')](_0x3c2e87)){return _0x3c2e87;}return _0xe396('0x49');}exports[_0xe396('0x4a')]=getCallerId;function getCallerIdRandom(_0x654999,_0x5e25c2){var _0x44e819;var _0x223fb5;var _0x85ca1;if(_0x5e25c2<=0x0){_0x5e25c2=0x1;}_0x44e819=new RegExp(_0xe396('0x4b')+_0x5e25c2+'}$');_0x223fb5=Math['pow'](0xa,_0x5e25c2-0x1);_0x85ca1=Math[_0xe396('0x4c')](0xa,_0x5e25c2)-0x1;return util[_0xe396('0x47')]('%s',_[_0xe396('0x4d')](_0x654999,_0x44e819,_[_0xe396('0x4e')](_0x223fb5,_0x85ca1)[_0xe396('0x4f')]()));}exports[_0xe396('0x50')]=getCallerIdRandom;function decrementOriginate(_0x4ed420,_0x4f91e4){if(_0x4ed420[_0xe396('0x2c')]&&_0x4ed420[_0xe396('0x2c')]>0x0){_0x4ed420[_0xe396('0x2c')]-=0x1;}else{logger[_0xe396('0x51')](_0xe396('0x52'),_0x4f91e4);}}exports[_0xe396('0x53')]=decrementOriginate;function checkContactEmpty(_0x3c5fc8){return _0x3c5fc8&&_0x3c5fc8[_0xe396('0x54')]>0x0;}exports[_0xe396('0x55')]=checkContactEmpty;function erlangb(_0x18f106,_0x335cba){if(_0x335cba===0x0){return 0x0;}var _0x4921d6=0x1;for(var _0xd8fb77=0x1;_0xd8fb77<=_0x335cba;_0xd8fb77+=0x1){_0x4921d6=0x1+_0x4921d6*_0xd8fb77/_0x18f106;}return 0x1/_0x4921d6;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x2ab7f5,_0x470ed6,_0x3caab3){if(_0x470ed6>_0x3caab3){for(var _0x3ce0f6=0x0;_0x3ce0f6<_0x470ed6-_0x3caab3;_0x3ce0f6+=0x1){decrementOriginate(_0x2ab7f5,_0xe396('0x56'));}}}exports[_0xe396('0x57')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4344d2){var _0xad47ae={};var _0x2067ee=['id',_0xe396('0x58'),_0xe396('0x59'),_0xe396('0x5a')];const _0x540501=0xfa;if(_0x4344d2){for(var _0x3434f7 in _0x4344d2){if(typeof _0x4344d2[_0x3434f7]!==_0xe396('0x5b')){if(!_['isNil'](_0x4344d2[_0x3434f7])&&!_0x2067ee[_0xe396('0x3a')](_0x3434f7)){if(_0x3434f7===_0xe396('0x5c')&&_0x4344d2[_0x3434f7][_0xe396('0x54')]>_0x540501){_0xad47ae[_0xe396('0x5d')+_0x3434f7[_0xe396('0x5e')]()]=_0x4344d2[_0x3434f7]['toString']()[_0xe396('0x5f')](0x0,_0x540501);}else{_0xad47ae['XMD-'+_0x3434f7[_0xe396('0x5e')]()]=_0x4344d2[_0x3434f7];}}}}}return _0xad47ae;}exports[_0xe396('0x60')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index ed4fb68..2149d55 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(_0x45d233,_0x37eb5b){var _0x352de3=function(_0x1edc91){while(--_0x1edc91){_0x45d233['push'](_0x45d233['shift']());}};_0x352de3(++_0x37eb5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x88861,_0x36baae){var _0x195361=function(_0x290b4e){while(--_0x290b4e){_0x88861['push'](_0x88861['shift']());}};_0x195361(++_0x36baae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 70a6a63..84496d5 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 _0xa88d=['isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','stringify','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','channel','channels','uniqueid','name','\x20syncNewchannel\x20','actions','info','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','Fax\x20failed','checkAfterSend','checkTrunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction'];(function(_0x18b6e8,_0x56c263){var _0x291ff5=function(_0x16984a){while(--_0x16984a){_0x18b6e8['push'](_0x18b6e8['shift']());}};_0x291ff5(++_0x56c263);}(_0xa88d,0x15d));var _0xda88=function(_0x384412,_0x6ad830){_0x384412=_0x384412-0x0;var _0x4c3e4f=_0xa88d[_0x384412];return _0x4c3e4f;};'use strict';var util=require(_0xda88('0x0'));var _=require(_0xda88('0x1'));var BPromise=require(_0xda88('0x2'));var uuid=require(_0xda88('0x3'));var moment=require('moment');var path=require(_0xda88('0x4'));var tiff2pdf=require(_0xda88('0x5'));var gs=require(_0xda88('0x6'));var logger=require(_0xda88('0x7'))(_0xda88('0x8'));var ami=require(_0xda88('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0xda88('0xa'));var ut=require(_0xda88('0xb'));var Action=require(_0xda88('0xc'));var faxAccount=require(_0xda88('0xd'));var attachment=require(_0xda88('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x436bdf){this['channels']={};this[_0xda88('0xf')]=_0x436bdf['faxAccounts'];this[_0xda88('0x10')]=_0x436bdf[_0xda88('0x10')];this['actions']={};ami['on']('newchannel',this[_0xda88('0x11')][_0xda88('0x12')](this));ami['on']('varset',this[_0xda88('0x13')][_0xda88('0x12')](this));ami['on']('newstate',this[_0xda88('0x14')]['bind'](this));ami['on'](_0xda88('0x15'),this[_0xda88('0x16')][_0xda88('0x12')](this));ami['on'](_0xda88('0x17'),this[_0xda88('0x18')][_0xda88('0x12')](this));ami['on'](_0xda88('0x19'),this['syncReceiveFax'][_0xda88('0x12')](this));ami['on'](_0xda88('0x1a'),this['syncHangup'][_0xda88('0x12')](this));ami['on'](_0xda88('0x1b'),this['syncOriginateResponse'][_0xda88('0x12')](this));}Fax[_0xda88('0x1c')][_0xda88('0x11')]=function(_0x3690ad){if(_0x3690ad[_0xda88('0x1d')]===_0xda88('0x1e')){for(var _0x4b0353 in this['faxAccounts']){if(this['faxAccounts'][_0xda88('0x1f')](_0x4b0353)){if(_0x3690ad[_0xda88('0x20')]===this[_0xda88('0xf')][_0x4b0353]['localstationid']){this['channels'][_0x3690ad['uniqueid']]={};this['channels'][_0x3690ad['uniqueid']][_0xda88('0x21')]=_0x3690ad[_0xda88('0x21')];this[_0xda88('0x22')][_0x3690ad[_0xda88('0x23')]]['id']=this['faxAccounts'][_0x4b0353]['id'];this[_0xda88('0x22')][_0x3690ad[_0xda88('0x23')]][_0xda88('0x24')]=this[_0xda88('0xf')][_0x4b0353][_0xda88('0x24')];logger['info'](_0x3690ad[_0xda88('0x23')],_0xda88('0x25'));}}}}if(this[_0xda88('0x26')][_0x3690ad[_0xda88('0x23')]]){this[_0xda88('0x22')][_0x3690ad[_0xda88('0x23')]]={};this['channels'][_0x3690ad['uniqueid']]['channel']=_0x3690ad[_0xda88('0x21')];logger[_0xda88('0x27')](_0x3690ad[_0xda88('0x23')],_0xda88('0x25'));}};Fax[_0xda88('0x1c')][_0xda88('0x13')]=function(_0x4d4b1d){if(this[_0xda88('0x22')][_0x4d4b1d[_0xda88('0x23')]]){for(var _0x31c473 in _0x4d4b1d[_0xda88('0x28')]){if(_0x4d4b1d[_0xda88('0x28')][_0xda88('0x1f')](_0x31c473)){this[_0xda88('0x22')][_0x4d4b1d[_0xda88('0x23')]][_0x31c473]=_0x4d4b1d[_0xda88('0x29')];}}}};Fax[_0xda88('0x1c')][_0xda88('0x14')]=function(_0x33bdf0){if(this[_0xda88('0x22')][_0x33bdf0['uniqueid']]){this[_0xda88('0x22')][_0x33bdf0[_0xda88('0x23')]][_0xda88('0x2a')]=_0x33bdf0['channelstate'];this[_0xda88('0x22')][_0x33bdf0[_0xda88('0x23')]]['channelstatedesc']=_0x33bdf0[_0xda88('0x2b')];}};Fax[_0xda88('0x1c')][_0xda88('0x16')]=function(_0x3b770b){if(this['channels'][_0x3b770b['uniqueid']]){for(var _0x38c721 in _0x3b770b[_0xda88('0x28')]){if(_0x3b770b[_0xda88('0x28')]['hasOwnProperty'](_0x38c721)){this[_0xda88('0x22')][_0x3b770b[_0xda88('0x23')]][_0x38c721]=_0x3b770b['value'];}}}};Fax[_0xda88('0x1c')]['syncFaxStatus']=function(_0x2a8bfe){if(this[_0xda88('0x22')][_0x2a8bfe[_0xda88('0x23')]]){this['channels'][_0x2a8bfe[_0xda88('0x23')]][_0xda88('0x2c')]=_0x2a8bfe[_0xda88('0x2c')];this[_0xda88('0x22')][_0x2a8bfe[_0xda88('0x23')]][_0xda88('0x2d')]=_0x2a8bfe[_0xda88('0x2d')];this[_0xda88('0x22')][_0x2a8bfe[_0xda88('0x23')]][_0xda88('0x2e')]=_0x2a8bfe[_0xda88('0x2e')];this[_0xda88('0x22')][_0x2a8bfe[_0xda88('0x23')]][_0xda88('0x2f')]=_0x2a8bfe[_0xda88('0x2f')];logger[_0xda88('0x27')](_0x2a8bfe[_0xda88('0x23')],_0xda88('0x30'));}};Fax[_0xda88('0x1c')][_0xda88('0x31')]=function(_0x1f63d7){var _0xa92071=this;if(this['channels'][_0x1f63d7[_0xda88('0x23')]]){var _0x1ba192=this['channels'][_0x1f63d7[_0xda88('0x23')]]['id'];this[_0xda88('0x22')][_0x1f63d7['uniqueid']][_0xda88('0x32')]=_0x1f63d7[_0xda88('0x32')];this[_0xda88('0x22')][_0x1f63d7[_0xda88('0x23')]]['pagestransferred']=_0x1f63d7[_0xda88('0x33')];this['channels'][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x2e')]=_0x1f63d7[_0xda88('0x2e')];this['channels'][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x34')]=_0x1f63d7[_0xda88('0x34')];this[_0xda88('0x22')][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x35')]=_0x1f63d7[_0xda88('0x35')];this[_0xda88('0x22')][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x2f')]=_0x1f63d7[_0xda88('0x2f')];this[_0xda88('0x22')][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x36')]=_0x1f63d7['calleridnum'];if(this[_0xda88('0x22')][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x33')]>0x0){tiff2pdf(_0x1f63d7[_0xda88('0x2f')],_0xda88('0x37'),function(_0xd178bb){logger['info'](_0x1f63d7['uniqueid'],_0xda88('0x38'),_0xd178bb[_0xda88('0x39')]);attachment[_0xda88('0x3a')]({'name':path[_0xda88('0x3b')](_0x1f63d7[_0xda88('0x2f')])[_0xda88('0x24')],'basename':path[_0xda88('0x3b')](_0x1f63d7[_0xda88('0x2f')])[_0xda88('0x24')]+_0xda88('0x3c'),'type':'application/pdf'})[_0xda88('0x3d')](function(_0x8706d9){faxAccount[_0xda88('0x3e')](_0x1ba192,{'from':_0x1f63d7['calleridnum'],'mapKey':_0xda88('0x8'),'body':path[_0xda88('0x3b')](_0x1f63d7[_0xda88('0x2f')])[_0xda88('0x24')]+_0xda88('0x3c'),'AttachmentId':_0x8706d9['id']})[_0xda88('0x3f')](function(_0x1fab74){logger['error'](_0x1f63d7[_0xda88('0x23')],'\x20notify\x20',JSON['stringify'](_0x1fab74));});})[_0xda88('0x3f')](function(_0x519656){logger[_0xda88('0x40')](_0x1f63d7[_0xda88('0x23')],_0xda88('0x41'),JSON['stringify'](_0x519656));});});}logger[_0xda88('0x27')](_0x1f63d7['uniqueid'],_0xda88('0x41'));}};Fax['prototype'][_0xda88('0x42')]=function(_0x27b358){if(this[_0xda88('0x26')][_0x27b358[_0xda88('0x23')]]){_[_0xda88('0x43')](this[_0xda88('0x22')][_0x27b358['uniqueid']],_[_0xda88('0x44')](_0x27b358,[_0xda88('0x45'),'reason']));}};function updateStatus(_0x5a8c20){if(_0x5a8c20['AttachmentId']){faxMessage['update'](_0x5a8c20[_0xda88('0x46')],{'failMessage':_0xda88('0x47')})[_0xda88('0x3d')](function(_0x5b3379){ut[_0xda88('0x48')](_0xda88('0x49'),_0x5b3379);})[_0xda88('0x3f')](function(_0x15f10d){ut[_0xda88('0x48')](_0xda88('0x4a'),_0x15f10d);});}else{ut[_0xda88('0x48')](_0xda88('0x4b'));}}Fax[_0xda88('0x1c')]['updateStatus']=function(_0x5984e6,_0x5286ba,_0x48992b){var _0x2a1060=this;var _0x2382d0={};if(_0x5286ba){_0x2382d0={'read':_0x5286ba};}else{_0x2382d0={'failMessage':_0x48992b};}if(this[_0xda88('0x26')][_0x5984e6][_0xda88('0x46')]){faxMessage['update'](this[_0xda88('0x26')][_0x5984e6][_0xda88('0x46')],_0x2382d0)[_0xda88('0x3d')](function(_0x8feb4c){ut['logger'](_0xda88('0x4c'),_0x8feb4c);})[_0xda88('0x3f')](function(_0x24501e){ut[_0xda88('0x48')](_0xda88('0x4d'),_0x24501e);})['finally'](function(){delete _0x2a1060['channels'][_0x5984e6];delete _0x2a1060[_0xda88('0x26')][_0x5984e6];});}else{ut[_0xda88('0x48')]('[Fax][Message][NoUpdate2]');this['deleteChannelAfterTimeout'](_0x5984e6);delete this[_0xda88('0x26')][_0x5984e6];}};Fax[_0xda88('0x1c')][_0xda88('0x4e')]=function(_0x583cdb){var _0x2f29fd=this;if(this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]]){if(this[_0xda88('0x26')][_0x583cdb[_0xda88('0x23')]]){this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]]['id']=this[_0xda88('0x26')][_0x583cdb['uniqueid']]['id'];this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]][_0xda88('0x24')]=this['actions'][_0x583cdb[_0xda88('0x23')]][_0xda88('0x24')];}logger['info'](_0x583cdb[_0xda88('0x23')],this[_0xda88('0x26')][_0x583cdb[_0xda88('0x23')]]?_0xda88('0x4f'):_0xda88('0x50'),JSON['stringify'](this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]]));if(this[_0xda88('0x26')][_0x583cdb[_0xda88('0x23')]]){if(this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]]['faxpages']>0x0&&this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]][_0xda88('0x17')]===_0xda88('0x51')){this['updateStatus'](_0x583cdb[_0xda88('0x23')],!![]);}else{this['updateStatus'](_0x583cdb['uniqueid'],![],this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]][_0xda88('0x52')]?_0xda88('0x53')+this['channels'][_0x583cdb[_0xda88('0x23')]][_0xda88('0x52')]:'SENDING\x20FAILED');}}}};Fax[_0xda88('0x1c')][_0xda88('0x54')]=function(_0x27eec1){var _0x88d208=this;return new BPromise(function(_0x3f0aea,_0x5be506){_0x88d208[_0xda88('0x55')](_0x27eec1,_0x88d208['faxAccounts'][_0x27eec1[_0xda88('0x56')]])[_0xda88('0x3d')](function(_0x217f35){ut['logger']('[Fax][execOriginate][success]',_0x217f35);_0x3f0aea(ut[_0xda88('0x39')]('Fax\x20received'));})[_0xda88('0x3f')](function(_0x5bad5a){ut[_0xda88('0x48')]('[Fax][execOriginate][failure]',_0x5bad5a);updateStatus(_0x27eec1);_0x5be506(ut[_0xda88('0x39')](_0xda88('0x57')));});});};Fax[_0xda88('0x1c')][_0xda88('0x58')]=function(_0x3ea2d1){var _0x3a05ff=this;return new BPromise(function(_0x41d0c4,_0x228570){var _0x835b10=_0x3a05ff[_0xda88('0x59')](_0x3a05ff['faxAccounts'][_0x3ea2d1[_0xda88('0x56')]]['Trunk'],_0x3ea2d1);if(_0x835b10['isValid']){_0x41d0c4(ut['message'](_0xda88('0x5a')));}else{_0x228570(ut[_0xda88('0x39')](_0x835b10[_0xda88('0x39')]));}});};function originate(_0x19b8ae,_0x490624,_0x18bede){return new BPromise(function(_0x8d050b,_0x29f3db){if(_0x18bede){var _0x2f4b9a=util[_0xda88('0x5b')](_0xda88('0x5c'),path[_0xda88('0x3b')](_0x19b8ae['path'])['name'],_0x19b8ae[_0xda88('0x4')]);gs['execute'](_0x2f4b9a)[_0xda88('0x3d')](function(){_0x19b8ae[_0xda88('0x4')]=util[_0xda88('0x5b')](_0xda88('0x5d'),path[_0xda88('0x3b')](_0x19b8ae[_0xda88('0x4')])[_0xda88('0x5e')],path[_0xda88('0x3b')](_0x19b8ae['path'])['name']);_0x490624[_0xda88('0x5f')]=_0x19b8ae[_0xda88('0x4')];ut[_0xda88('0x48')](_0xda88('0x60'),'');ami[_0xda88('0x61')](ut[_0xda88('0x62')](_0x19b8ae,_0x490624))['then'](function(_0x3c6d32){_0x8d050b(_0x3c6d32);})[_0xda88('0x3f')](function(_0x5b1b5e){_0x29f3db(_0x5b1b5e);});})[_0xda88('0x3f')](function(_0x586ff6){_0x29f3db(_0x586ff6);});}else{ami[_0xda88('0x61')](ut[_0xda88('0x62')](_0x19b8ae,_0x490624))[_0xda88('0x3d')](function(_0x3a59a9){_0x8d050b(_0x3a59a9);})['catch'](function(_0x14393c){_0x29f3db(_0x14393c);});}});}Fax[_0xda88('0x1c')][_0xda88('0x55')]=function(_0xdb2571,_0x38c589){var _0x334399=this;return new BPromise(function(_0x47dabc,_0x5a2649){var _0x524f12=uuid['v4']();var _0x477b33=ut['addVariables'](_0xdb2571,_0x38c589);_0x334399['actions'][_0x524f12]=new Action(_0x524f12,_0x38c589,_0xdb2571);var _0x3a1178=_0x334399[_0xda88('0x26')][_0x524f12];if(path[_0xda88('0x3b')](_0xdb2571[_0xda88('0x4')])['ext']===_0xda88('0x3c')){originate(_0x3a1178,_0x477b33,!![])[_0xda88('0x3d')](function(_0x50431e){_0x47dabc(_0x50431e);})[_0xda88('0x3f')](function(_0x50d462){_0x5a2649(_0x50d462);});}else{originate(_0x3a1178,_0x477b33,![])[_0xda88('0x3d')](function(_0x4eaf95){_0x47dabc(_0x4eaf95);})[_0xda88('0x3f')](function(_0x65e84e){_0x5a2649(_0x65e84e);});}});};Fax[_0xda88('0x1c')]['isTrunkReachable']=function(_0x319904){return!_['isNil'](_0x319904)&&!_['isNil'](_0x319904[_0xda88('0x24')])&&!_[_0xda88('0x63')](_0x319904['active'])&&_0x319904[_0xda88('0x64')]&&!_[_0xda88('0x63')](this[_0xda88('0x10')][util[_0xda88('0x5b')](_0xda88('0x65'),_0x319904[_0xda88('0x24')])])&&!_[_0xda88('0x63')](this[_0xda88('0x10')][util['format']('SIP/%s',_0x319904[_0xda88('0x24')])]['status'])&&(this[_0xda88('0x10')][util[_0xda88('0x5b')](_0xda88('0x65'),_0x319904['name'])]['status']===_0xda88('0x66')||this[_0xda88('0x10')][util[_0xda88('0x5b')](_0xda88('0x65'),_0x319904[_0xda88('0x24')])][_0xda88('0x2d')]===_0xda88('0x67'));};Fax['prototype'][_0xda88('0x59')]=function(_0x525c33,_0x4b8981){if(!this[_0xda88('0x68')](_0x525c33)){ut['logger'](_0xda88('0x69'),_['isNil'](_0x525c33)?'':_0x525c33[_0xda88('0x24')]+_0xda88('0x6a'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xda88('0x63')](_0x4b8981[_0xda88('0x8')])){ut[_0xda88('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xda88('0x6b')](_0x4b8981));return{'isValid':![],'message':_0xda88('0x6c')};}if(_[_0xda88('0x63')](_0x4b8981['path'])){ut[_0xda88('0x48')](_0xda88('0x6d'),JSON[_0xda88('0x6b')](_0x4b8981));return{'isValid':![],'message':_0xda88('0x6e')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0xda88('0x1c')]['deleteChannelAfterTimeout']=function(_0x2ad128,_0x41ca59=0x2710){if(this[_0xda88('0x22')][_0x2ad128]){setTimeout(()=>{delete this[_0xda88('0x22')][_0x2ad128];},_0x41ca59);}};module[_0xda88('0x6f')]=Fax; \ No newline at end of file +var _0xa124=['value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','notify','error','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','update','AttachmentId','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','tiff2pdf','./util/gs','fax','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','syncNewchannel','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa124,0x19e));var _0x4a12=function(_0x196e1b,_0x55fa06){_0x196e1b=_0x196e1b-0x0;var _0x5e1f18=_0xa124[_0x196e1b];return _0x5e1f18;};'use strict';var util=require('util');var _=require(_0x4a12('0x0'));var BPromise=require(_0x4a12('0x1'));var uuid=require(_0x4a12('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x4a12('0x3'));var gs=require(_0x4a12('0x4'));var logger=require('../../../config/logger')(_0x4a12('0x5'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x4a12('0x6'));var ut=require('./util/util');var Action=require(_0x4a12('0x7'));var faxAccount=require(_0x4a12('0x8'));var attachment=require(_0x4a12('0x9'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2a68d5){this[_0x4a12('0xa')]={};this[_0x4a12('0xb')]=_0x2a68d5['faxAccounts'];this[_0x4a12('0xc')]=_0x2a68d5[_0x4a12('0xc')];this[_0x4a12('0xd')]={};ami['on'](_0x4a12('0xe'),this['syncNewchannel'][_0x4a12('0xf')](this));ami['on'](_0x4a12('0x10'),this[_0x4a12('0x11')][_0x4a12('0xf')](this));ami['on'](_0x4a12('0x12'),this[_0x4a12('0x13')][_0x4a12('0xf')](this));ami['on'](_0x4a12('0x14'),this[_0x4a12('0x15')][_0x4a12('0xf')](this));ami['on'](_0x4a12('0x16'),this[_0x4a12('0x17')][_0x4a12('0xf')](this));ami['on']('receivefax',this[_0x4a12('0x18')][_0x4a12('0xf')](this));ami['on']('hangup',this[_0x4a12('0x19')][_0x4a12('0xf')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x4a12('0xf')](this));}Fax['prototype'][_0x4a12('0x1a')]=function(_0x220177){if(_0x220177[_0x4a12('0x1b')]==='from-voip-provider'){for(var _0x10a99a in this[_0x4a12('0xb')]){if(this[_0x4a12('0xb')][_0x4a12('0x1c')](_0x10a99a)){if(_0x220177[_0x4a12('0x1d')]===this[_0x4a12('0xb')][_0x10a99a][_0x4a12('0x1e')]){this['channels'][_0x220177[_0x4a12('0x1f')]]={};this['channels'][_0x220177[_0x4a12('0x1f')]][_0x4a12('0x20')]=_0x220177[_0x4a12('0x20')];this[_0x4a12('0xa')][_0x220177[_0x4a12('0x1f')]]['id']=this[_0x4a12('0xb')][_0x10a99a]['id'];this[_0x4a12('0xa')][_0x220177[_0x4a12('0x1f')]]['name']=this[_0x4a12('0xb')][_0x10a99a][_0x4a12('0x21')];logger[_0x4a12('0x22')](_0x220177[_0x4a12('0x1f')],_0x4a12('0x23'));}}}}if(this[_0x4a12('0xd')][_0x220177[_0x4a12('0x1f')]]){this['channels'][_0x220177[_0x4a12('0x1f')]]={};this[_0x4a12('0xa')][_0x220177[_0x4a12('0x1f')]][_0x4a12('0x20')]=_0x220177[_0x4a12('0x20')];logger['info'](_0x220177['uniqueid'],_0x4a12('0x23'));}};Fax[_0x4a12('0x24')][_0x4a12('0x11')]=function(_0x1e3def){if(this['channels'][_0x1e3def['uniqueid']]){for(var _0x57b431 in _0x1e3def[_0x4a12('0x25')]){if(_0x1e3def['variable'][_0x4a12('0x1c')](_0x57b431)){this[_0x4a12('0xa')][_0x1e3def['uniqueid']][_0x57b431]=_0x1e3def[_0x4a12('0x26')];}}}};Fax['prototype']['syncNewState']=function(_0x5aa195){if(this[_0x4a12('0xa')][_0x5aa195[_0x4a12('0x1f')]]){this[_0x4a12('0xa')][_0x5aa195[_0x4a12('0x1f')]][_0x4a12('0x27')]=_0x5aa195['channelstate'];this[_0x4a12('0xa')][_0x5aa195['uniqueid']][_0x4a12('0x28')]=_0x5aa195[_0x4a12('0x28')];}};Fax[_0x4a12('0x24')]['syncNewExten']=function(_0x40de87){if(this[_0x4a12('0xa')][_0x40de87[_0x4a12('0x1f')]]){for(var _0x2d8307 in _0x40de87[_0x4a12('0x25')]){if(_0x40de87[_0x4a12('0x25')][_0x4a12('0x1c')](_0x2d8307)){this['channels'][_0x40de87[_0x4a12('0x1f')]][_0x2d8307]=_0x40de87[_0x4a12('0x26')];}}}};Fax[_0x4a12('0x24')]['syncFaxStatus']=function(_0x354c35){if(this[_0x4a12('0xa')][_0x354c35['uniqueid']]){this[_0x4a12('0xa')][_0x354c35[_0x4a12('0x1f')]][_0x4a12('0x29')]=_0x354c35[_0x4a12('0x29')];this[_0x4a12('0xa')][_0x354c35[_0x4a12('0x1f')]][_0x4a12('0x2a')]=_0x354c35['status'];this[_0x4a12('0xa')][_0x354c35['uniqueid']]['localstationid']=_0x354c35['localstationid'];this[_0x4a12('0xa')][_0x354c35[_0x4a12('0x1f')]][_0x4a12('0x2b')]=_0x354c35['filename'];logger[_0x4a12('0x22')](_0x354c35['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x4a12('0x24')][_0x4a12('0x18')]=function(_0x3d4d2b){var _0x242de4=this;if(this['channels'][_0x3d4d2b[_0x4a12('0x1f')]]){var _0x4ed351=this['channels'][_0x3d4d2b[_0x4a12('0x1f')]]['id'];this[_0x4a12('0xa')][_0x3d4d2b[_0x4a12('0x1f')]]['remotestationid']=_0x3d4d2b[_0x4a12('0x2c')];this[_0x4a12('0xa')][_0x3d4d2b[_0x4a12('0x1f')]]['pagestransferred']=_0x3d4d2b[_0x4a12('0x2d')];this['channels'][_0x3d4d2b[_0x4a12('0x1f')]]['localstationid']=_0x3d4d2b['localstationid'];this['channels'][_0x3d4d2b[_0x4a12('0x1f')]][_0x4a12('0x2e')]=_0x3d4d2b[_0x4a12('0x2e')];this[_0x4a12('0xa')][_0x3d4d2b[_0x4a12('0x1f')]][_0x4a12('0x2f')]=_0x3d4d2b[_0x4a12('0x2f')];this[_0x4a12('0xa')][_0x3d4d2b[_0x4a12('0x1f')]][_0x4a12('0x2b')]=_0x3d4d2b['filename'];this[_0x4a12('0xa')][_0x3d4d2b['uniqueid']][_0x4a12('0x30')]=_0x3d4d2b[_0x4a12('0x30')];if(this[_0x4a12('0xa')][_0x3d4d2b['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x3d4d2b[_0x4a12('0x2b')],_0x4a12('0x31'),function(_0x40b33e){logger[_0x4a12('0x22')](_0x3d4d2b[_0x4a12('0x1f')],'\x20result\x20conversion\x20file\x20',_0x40b33e['message']);attachment[_0x4a12('0x32')]({'name':path['parse'](_0x3d4d2b['filename'])[_0x4a12('0x21')],'basename':path[_0x4a12('0x33')](_0x3d4d2b[_0x4a12('0x2b')])['name']+_0x4a12('0x34'),'type':_0x4a12('0x35')})['then'](function(_0x5854f4){faxAccount[_0x4a12('0x36')](_0x4ed351,{'from':_0x3d4d2b[_0x4a12('0x30')],'mapKey':_0x4a12('0x5'),'body':path['parse'](_0x3d4d2b[_0x4a12('0x2b')])['name']+_0x4a12('0x34'),'AttachmentId':_0x5854f4['id']})['catch'](function(_0x5eb316){logger[_0x4a12('0x37')](_0x3d4d2b[_0x4a12('0x1f')],'\x20notify\x20',JSON[_0x4a12('0x38')](_0x5eb316));});})[_0x4a12('0x39')](function(_0x4a0392){logger[_0x4a12('0x37')](_0x3d4d2b['uniqueid'],_0x4a12('0x3a'),JSON[_0x4a12('0x38')](_0x4a0392));});});}logger[_0x4a12('0x22')](_0x3d4d2b[_0x4a12('0x1f')],_0x4a12('0x3a'));}};Fax[_0x4a12('0x24')][_0x4a12('0x3b')]=function(_0x58dd75){if(this[_0x4a12('0xd')][_0x58dd75[_0x4a12('0x1f')]]){_[_0x4a12('0x3c')](this[_0x4a12('0xa')][_0x58dd75['uniqueid']],_[_0x4a12('0x3d')](_0x58dd75,[_0x4a12('0x3e'),'reason']));}};function updateStatus(_0x22b494){if(_0x22b494['AttachmentId']){faxMessage[_0x4a12('0x3f')](_0x22b494[_0x4a12('0x40')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x4a12('0x41')](function(_0x8c8b5a){ut[_0x4a12('0x42')](_0x4a12('0x43'),_0x8c8b5a);})[_0x4a12('0x39')](function(_0x4502c5){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x4502c5);});}else{ut['logger'](_0x4a12('0x44'));}}Fax[_0x4a12('0x24')][_0x4a12('0x45')]=function(_0x1b2ec5,_0x461707,_0x285205){var _0x3f20ea=this;var _0x38bc8e={};if(_0x461707){_0x38bc8e={'read':_0x461707};}else{_0x38bc8e={'failMessage':_0x285205};}if(this[_0x4a12('0xd')][_0x1b2ec5][_0x4a12('0x40')]){faxMessage[_0x4a12('0x3f')](this['actions'][_0x1b2ec5][_0x4a12('0x40')],_0x38bc8e)['then'](function(_0x483413){ut['logger']('[Fax][Message][Updated]',_0x483413);})[_0x4a12('0x39')](function(_0x5a47f5){ut[_0x4a12('0x42')]('[Fax][Message][NoUpdate1]',_0x5a47f5);})['finally'](function(){delete _0x3f20ea[_0x4a12('0xa')][_0x1b2ec5];delete _0x3f20ea[_0x4a12('0xd')][_0x1b2ec5];});}else{ut[_0x4a12('0x42')](_0x4a12('0x46'));this[_0x4a12('0x47')](_0x1b2ec5);delete this['actions'][_0x1b2ec5];}};Fax[_0x4a12('0x24')][_0x4a12('0x19')]=function(_0x1c01f6){var _0x44d99a=this;if(this['channels'][_0x1c01f6[_0x4a12('0x1f')]]){if(this[_0x4a12('0xd')][_0x1c01f6[_0x4a12('0x1f')]]){this[_0x4a12('0xa')][_0x1c01f6['uniqueid']]['id']=this[_0x4a12('0xd')][_0x1c01f6['uniqueid']]['id'];this[_0x4a12('0xa')][_0x1c01f6[_0x4a12('0x1f')]][_0x4a12('0x21')]=this[_0x4a12('0xd')][_0x1c01f6[_0x4a12('0x1f')]][_0x4a12('0x21')];}logger[_0x4a12('0x22')](_0x1c01f6['uniqueid'],this[_0x4a12('0xd')][_0x1c01f6[_0x4a12('0x1f')]]?_0x4a12('0x48'):_0x4a12('0x49'),JSON[_0x4a12('0x38')](this['channels'][_0x1c01f6[_0x4a12('0x1f')]]));if(this[_0x4a12('0xd')][_0x1c01f6[_0x4a12('0x1f')]]){if(this['channels'][_0x1c01f6[_0x4a12('0x1f')]][_0x4a12('0x4a')]>0x0&&this['channels'][_0x1c01f6[_0x4a12('0x1f')]]['faxstatus']==='SUCCESS'){this[_0x4a12('0x45')](_0x1c01f6[_0x4a12('0x1f')],!![]);}else{this['updateStatus'](_0x1c01f6[_0x4a12('0x1f')],![],this['channels'][_0x1c01f6[_0x4a12('0x1f')]][_0x4a12('0x4b')]?'SENDING\x20FAILED:\x20'+this[_0x4a12('0xa')][_0x1c01f6[_0x4a12('0x1f')]][_0x4a12('0x4b')]:_0x4a12('0x4c'));}}}};Fax[_0x4a12('0x24')][_0x4a12('0x4d')]=function(_0x1a36ff){var _0x405d67=this;return new BPromise(function(_0x2420a7,_0xff786b){_0x405d67['execOriginate'](_0x1a36ff,_0x405d67[_0x4a12('0xb')][_0x1a36ff[_0x4a12('0x4e')]])[_0x4a12('0x41')](function(_0x5e3e49){ut[_0x4a12('0x42')](_0x4a12('0x4f'),_0x5e3e49);_0x2420a7(ut[_0x4a12('0x50')](_0x4a12('0x51')));})[_0x4a12('0x39')](function(_0x1895e9){ut[_0x4a12('0x42')](_0x4a12('0x52'),_0x1895e9);updateStatus(_0x1a36ff);_0xff786b(ut[_0x4a12('0x50')](_0x4a12('0x53')));});});};Fax['prototype'][_0x4a12('0x54')]=function(_0x39d141){var _0x1ee958=this;return new BPromise(function(_0x34e1b6,_0x1e7795){var _0x5e8d04=_0x1ee958[_0x4a12('0x55')](_0x1ee958[_0x4a12('0xb')][_0x39d141[_0x4a12('0x4e')]][_0x4a12('0x56')],_0x39d141);if(_0x5e8d04[_0x4a12('0x57')]){_0x34e1b6(ut[_0x4a12('0x50')](_0x4a12('0x58')));}else{_0x1e7795(ut['message'](_0x5e8d04[_0x4a12('0x50')]));}});};function originate(_0x5b3802,_0x13f81f,_0x467f2b){return new BPromise(function(_0x3e8c7a,_0xb41fc3){if(_0x467f2b){var _0x4af16c=util[_0x4a12('0x59')](_0x4a12('0x5a'),path[_0x4a12('0x33')](_0x5b3802['path'])['name'],_0x5b3802['path']);gs['execute'](_0x4af16c)[_0x4a12('0x41')](function(){_0x5b3802[_0x4a12('0x5b')]=util[_0x4a12('0x59')](_0x4a12('0x5c'),path['parse'](_0x5b3802[_0x4a12('0x5b')])['dir'],path[_0x4a12('0x33')](_0x5b3802[_0x4a12('0x5b')])['name']);_0x13f81f[_0x4a12('0x5d')]=_0x5b3802[_0x4a12('0x5b')];ut[_0x4a12('0x42')](_0x4a12('0x5e'),'');ami[_0x4a12('0x5f')](ut[_0x4a12('0x60')](_0x5b3802,_0x13f81f))[_0x4a12('0x41')](function(_0x48a625){_0x3e8c7a(_0x48a625);})[_0x4a12('0x39')](function(_0x13a07b){_0xb41fc3(_0x13a07b);});})['catch'](function(_0xb6694){_0xb41fc3(_0xb6694);});}else{ami[_0x4a12('0x5f')](ut[_0x4a12('0x60')](_0x5b3802,_0x13f81f))[_0x4a12('0x41')](function(_0x3df964){_0x3e8c7a(_0x3df964);})[_0x4a12('0x39')](function(_0x5c1aab){_0xb41fc3(_0x5c1aab);});}});}Fax['prototype'][_0x4a12('0x61')]=function(_0x402eab,_0x235a49){var _0x3484e3=this;return new BPromise(function(_0x1104f0,_0x353e2){var _0x341cb4=uuid['v4']();var _0x98d48e=ut[_0x4a12('0x62')](_0x402eab,_0x235a49);_0x3484e3[_0x4a12('0xd')][_0x341cb4]=new Action(_0x341cb4,_0x235a49,_0x402eab);var _0x1bd3b8=_0x3484e3[_0x4a12('0xd')][_0x341cb4];if(path[_0x4a12('0x33')](_0x402eab['path'])[_0x4a12('0x63')]===_0x4a12('0x34')){originate(_0x1bd3b8,_0x98d48e,!![])[_0x4a12('0x41')](function(_0xb4e8cb){_0x1104f0(_0xb4e8cb);})['catch'](function(_0x333182){_0x353e2(_0x333182);});}else{originate(_0x1bd3b8,_0x98d48e,![])[_0x4a12('0x41')](function(_0x24aa3b){_0x1104f0(_0x24aa3b);})[_0x4a12('0x39')](function(_0x51d22d){_0x353e2(_0x51d22d);});}});};Fax['prototype'][_0x4a12('0x64')]=function(_0x5d11db){return!_[_0x4a12('0x65')](_0x5d11db)&&!_[_0x4a12('0x65')](_0x5d11db[_0x4a12('0x21')])&&!_[_0x4a12('0x65')](_0x5d11db[_0x4a12('0x66')])&&_0x5d11db[_0x4a12('0x66')]&&!_[_0x4a12('0x65')](this[_0x4a12('0xc')][util['format']('SIP/%s',_0x5d11db[_0x4a12('0x21')])])&&!_[_0x4a12('0x65')](this[_0x4a12('0xc')][util[_0x4a12('0x59')](_0x4a12('0x67'),_0x5d11db[_0x4a12('0x21')])][_0x4a12('0x2a')])&&(this[_0x4a12('0xc')][util[_0x4a12('0x59')](_0x4a12('0x67'),_0x5d11db[_0x4a12('0x21')])][_0x4a12('0x2a')]===_0x4a12('0x68')||this['trunks'][util[_0x4a12('0x59')]('SIP/%s',_0x5d11db[_0x4a12('0x21')])][_0x4a12('0x2a')]===_0x4a12('0x69'));};Fax[_0x4a12('0x24')][_0x4a12('0x55')]=function(_0x416904,_0x1952a0){if(!this[_0x4a12('0x64')](_0x416904)){ut[_0x4a12('0x42')](_0x4a12('0x6a'),_[_0x4a12('0x65')](_0x416904)?'':_0x416904['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x4a12('0x6b')};}if(_[_0x4a12('0x65')](_0x1952a0[_0x4a12('0x5')])){ut['logger'](_0x4a12('0x6c'),JSON['stringify'](_0x1952a0));return{'isValid':![],'message':_0x4a12('0x6d')};}if(_[_0x4a12('0x65')](_0x1952a0['path'])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x4a12('0x38')](_0x1952a0));return{'isValid':![],'message':_0x4a12('0x6e')};}return{'isValid':!![],'message':_0x4a12('0x6f')};};Fax[_0x4a12('0x24')][_0x4a12('0x47')]=function(_0x33d2b4,_0x23b915=0x2710){if(this[_0x4a12('0xa')][_0x33d2b4]){setTimeout(()=>{delete this['channels'][_0x33d2b4];},_0x23b915);}};module[_0x4a12('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index a140eb3..9e91544 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 _0xc495=['util','bluebird','lodash','../rpc/faxAccount','notify','then','catch','[Notify]\x20'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xc495,0x1d0));var _0x5c49=function(_0x323385,_0x14f678){_0x323385=_0x323385-0x0;var _0x160def=_0xc495[_0x323385];return _0x160def;};'use strict';var util=require(_0x5c49('0x0'));var BPromise=require(_0x5c49('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x5c49('0x2'));var faxAccount=require(_0x5c49('0x3'));function loggerCatch(_0x1eb5c7){return function(_0x537831){logger['error'](_0x1eb5c7,util['inspect'](_0x537831,{'showHidden':![],'depth':null}));};}exports[_0x5c49('0x4')]=function(_0x5eb922,_0x57e3b3){return BPromise['resolve']()[_0x5c49('0x5')](faxAccount[_0x5c49('0x4')](_0x5eb922,_0x57e3b3))[_0x5c49('0x6')](loggerCatch(_0x5c49('0x7')));}; \ No newline at end of file +var _0x1ca4=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','notify','resolve','then','catch'];(function(_0x57cd68,_0x8378c9){var _0x39ddfb=function(_0x201864){while(--_0x201864){_0x57cd68['push'](_0x57cd68['shift']());}};_0x39ddfb(++_0x8378c9);}(_0x1ca4,0x114));var _0x41ca=function(_0x2bc67c,_0x141396){_0x2bc67c=_0x2bc67c-0x0;var _0x4de5ac=_0x1ca4[_0x2bc67c];return _0x4de5ac;};'use strict';var util=require(_0x41ca('0x0'));var BPromise=require(_0x41ca('0x1'));var logger=require(_0x41ca('0x2'))(_0x41ca('0x3'));var _=require(_0x41ca('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x36144e){return function(_0x14e36c){logger[_0x41ca('0x5')](_0x36144e,util['inspect'](_0x14e36c,{'showHidden':![],'depth':null}));};}exports[_0x41ca('0x6')]=function(_0x3bf317,_0x1cb659){return BPromise[_0x41ca('0x7')]()[_0x41ca('0x8')](faxAccount['notify'](_0x3bf317,_0x1cb659))[_0x41ca('0x9')](loggerCatch(_0x41ca('0xa')));}; \ 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 5c3b382..e37f2d4 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 _0x2bf8=['bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2bf8,0x11f));var _0x82bf=function(_0x40c99a,_0x56f60e){_0x40c99a=_0x40c99a-0x0;var _0x3d1d0a=_0x2bf8[_0x40c99a];return _0x3d1d0a;};'use strict';var util=require(_0x82bf('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x82bf('0x1'));var exec=require(_0x82bf('0x2'))[_0x82bf('0x3')];exports[_0x82bf('0x4')]=function(_0x30d322){return new BPromise(function(_0x5d0121,_0x1cc7ff){exec(_0x30d322,function(_0x47b022,_0x52d833,_0x15bf9d){logger[_0x82bf('0x5')](_0x82bf('0x6'),_0x52d833);if(_0x47b022){logger[_0x82bf('0x5')](_0x82bf('0x6'),_0x82bf('0x7'),util[_0x82bf('0x8')](_0x47b022,{'showHidden':![],'depth':null}),_0x52d833,_0x15bf9d);_0x1cc7ff(_0x47b022);}_0x5d0121(_0x52d833);});});}; \ No newline at end of file +var _0xe357=['Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','child_process','exec','info'];(function(_0x52812a,_0x38cc57){var _0x83cfa9=function(_0x596897){while(--_0x596897){_0x52812a['push'](_0x52812a['shift']());}};_0x83cfa9(++_0x38cc57);}(_0xe357,0xf6));var _0x7e35=function(_0x216bb8,_0x103b3b){_0x216bb8=_0x216bb8-0x0;var _0x5756ad=_0xe357[_0x216bb8];return _0x5756ad;};'use strict';var util=require(_0x7e35('0x0'));var logger=require('../../../../config/logger')(_0x7e35('0x1'));var BPromise=require(_0x7e35('0x2'));var exec=require(_0x7e35('0x3'))[_0x7e35('0x4')];exports['execute']=function(_0x3b291c){return new BPromise(function(_0x502328,_0x587133){exec(_0x3b291c,function(_0x1b345c,_0x5f32c4,_0x4be580){logger[_0x7e35('0x5')]('Exec\x20gs',_0x5f32c4);if(_0x1b345c){logger[_0x7e35('0x5')](_0x7e35('0x6'),_0x7e35('0x7'),util[_0x7e35('0x8')](_0x1b345c,{'showHidden':![],'depth':null}),_0x5f32c4,_0x4be580);_0x587133(_0x1b345c);}_0x502328(_0x5f32c4);});});}; \ 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 5daba9e..3395a1a 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 _0x09dc=['from-sip','\x22%s\x22\x20<%s>','moment','../../../../config/logger','fax','logger','inspect','addVariables','headerinfo','minrate','maxrate','format','modem','gateway','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax'];(function(_0x2972d6,_0x2cf4fb){var _0x3a4e7f=function(_0x2dd5b4){while(--_0x2dd5b4){_0x2972d6['push'](_0x2972d6['shift']());}};_0x3a4e7f(++_0x2cf4fb);}(_0x09dc,0xd4));var _0xc09d=function(_0x3653c7,_0xadb356){_0x3653c7=_0x3653c7-0x0;var _0x58a021=_0x09dc[_0x3653c7];return _0x58a021;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xc09d('0x0'));var logger=require(_0xc09d('0x1'))(_0xc09d('0x2'));exports['message']=function(_0x3c6801){return{'message':_0x3c6801};};exports[_0xc09d('0x3')]=function(_0x5f4ad6,_0x7d04db){logger['info'](_0x5f4ad6,util[_0xc09d('0x4')](_0x7d04db,{'showHidden':![],'depth':null}));};exports[_0xc09d('0x5')]=function(_0x1c3e1f,_0x225676){var _0x3b2581={'XMF-ECM':_0x225676['ecm'],'XMF-HEADERINFO':_0x225676[_0xc09d('0x6')],'XMF-MINRATE':_0x225676[_0xc09d('0x7')],'XMF-MAXRATE':_0x225676[_0xc09d('0x8')],'XMF-MODEM':util[_0xc09d('0x9')]('\x22%s\x22',_0x225676[_0xc09d('0xa')]),'XMF-GATEWAY':_0x225676[_0xc09d('0xb')],'XMF-FAXDETECT':_0x225676['faxdetect'],'XMF-T38TIMEOUT':_0x225676[_0xc09d('0xc')],'XMF-LOCALSTATIONID':_0x225676['localstationid'],'XMF-PATH':_0x1c3e1f[_0xc09d('0xd')]};return _0x3b2581;};exports[_0xc09d('0xe')]=function(_0x1b41df,_0x35d98e){return{'actionid':_0x1b41df[_0xc09d('0xf')],'action':_0xc09d('0x10'),'channel':_0x1b41df[_0xc09d('0x11')],'Exten':_0xc09d('0x12'),'Context':_0xc09d('0x13'),'Priority':'1','callerid':util[_0xc09d('0x9')](_0xc09d('0x14'),_0x1b41df[_0xc09d('0x6')]?_0x1b41df[_0xc09d('0x6')]:'',_0x1b41df['localstationid']),'variable':_0x35d98e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1b41df[_0xc09d('0xf')]};}; \ No newline at end of file +var _0xcd4d=['info','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','headerinfo','util','lodash','moment','../../../../config/logger','fax','message','logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcd4d,0xda));var _0xdcd4=function(_0xa4b76a,_0x2b92c0){_0xa4b76a=_0xa4b76a-0x0;var _0x3bb6ef=_0xcd4d[_0xa4b76a];return _0x3bb6ef;};'use strict';var util=require(_0xdcd4('0x0'));var _=require(_0xdcd4('0x1'));var moment=require(_0xdcd4('0x2'));var logger=require(_0xdcd4('0x3'))(_0xdcd4('0x4'));exports[_0xdcd4('0x5')]=function(_0x27dde0){return{'message':_0x27dde0};};exports[_0xdcd4('0x6')]=function(_0x4a949c,_0x48c4e4){logger[_0xdcd4('0x7')](_0x4a949c,util['inspect'](_0x48c4e4,{'showHidden':![],'depth':null}));};exports[_0xdcd4('0x8')]=function(_0x2f9197,_0xa4e6ac){var _0x1b51a1={'XMF-ECM':_0xa4e6ac[_0xdcd4('0x9')],'XMF-HEADERINFO':_0xa4e6ac['headerinfo'],'XMF-MINRATE':_0xa4e6ac[_0xdcd4('0xa')],'XMF-MAXRATE':_0xa4e6ac[_0xdcd4('0xb')],'XMF-MODEM':util[_0xdcd4('0xc')](_0xdcd4('0xd'),_0xa4e6ac['modem']),'XMF-GATEWAY':_0xa4e6ac[_0xdcd4('0xe')],'XMF-FAXDETECT':_0xa4e6ac[_0xdcd4('0xf')],'XMF-T38TIMEOUT':_0xa4e6ac[_0xdcd4('0x10')],'XMF-LOCALSTATIONID':_0xa4e6ac[_0xdcd4('0x11')],'XMF-PATH':_0x2f9197[_0xdcd4('0x12')]};return _0x1b51a1;};exports[_0xdcd4('0x13')]=function(_0x220eb5,_0x37c3c0){return{'actionid':_0x220eb5[_0xdcd4('0x14')],'action':_0xdcd4('0x15'),'channel':_0x220eb5['channel'],'Exten':_0xdcd4('0x16'),'Context':_0xdcd4('0x17'),'Priority':'1','callerid':util[_0xdcd4('0xc')]('\x22%s\x22\x20<%s>',_0x220eb5['headerinfo']?_0x220eb5[_0xdcd4('0x18')]:'',_0x220eb5[_0xdcd4('0x11')]),'variable':_0x37c3c0,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x220eb5[_0xdcd4('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index abf592a..f476cd5 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 _0xd9cb=['get','hour','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','moment','./server','./realtime','./report','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger'];(function(_0x4c501c,_0x1c447d){var _0xd1c273=function(_0x58e285){while(--_0x58e285){_0x4c501c['push'](_0x4c501c['shift']());}};_0xd1c273(++_0x1c447d);}(_0xd9cb,0x6f));var _0xbd9c=function(_0x5bc1ea,_0xb4b383){_0x5bc1ea=_0x5bc1ea-0x0;var _0xf3d5b9=_0xd9cb[_0x5bc1ea];return _0xf3d5b9;};'use strict';var util=require('util');var moment=require(_0xbd9c('0x0'));var server=require(_0xbd9c('0x1'));var Realtime=require(_0xbd9c('0x2'));var Report=require(_0xbd9c('0x3'));var Acw=require(_0xbd9c('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xbd9c('0x5'));var Preview=require(_0xbd9c('0x6'));var Fax=require('./fax');var user=require(_0xbd9c('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xbd9c('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xbd9c('0x9'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xbd9c('0xa'));var voiceExtension=require(_0xbd9c('0xb'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xbd9c('0xc'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xbd9c('0xd'));var desk=require(_0xbd9c('0xe'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xbd9c('0xf'));var servicenow=require(_0xbd9c('0x10'));var dynamics365=require(_0xbd9c('0x11'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xbd9c('0x12'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xbd9c('0x13')](_0xbd9c('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xbd9c('0x13')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xbd9c('0x15')](user[_0xbd9c('0x16')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x17')]())[_0xbd9c('0x15')](user['getTelephones']())['then'](realtime[_0xbd9c('0x18')]())[_0xbd9c('0x15')](trunk[_0xbd9c('0x19')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x1a')]())['then'](voiceQueue[_0xbd9c('0x1b')]())[_0xbd9c('0x15')](realtime['initVoiceQueues']())['then'](trigger[_0xbd9c('0x1c')]())[_0xbd9c('0x15')](realtime['initTriggers']())['then'](template[_0xbd9c('0x1d')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x1e')]())[_0xbd9c('0x15')](zendesk[_0xbd9c('0x1f')]())[_0xbd9c('0x15')](realtime['initZendeskAccounts']())[_0xbd9c('0x15')](salesforce[_0xbd9c('0x20')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x21')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0xbd9c('0x15')](realtime[_0xbd9c('0x22')]())[_0xbd9c('0x15')](freshdesk[_0xbd9c('0x23')]())['then'](realtime[_0xbd9c('0x24')]())['then'](desk[_0xbd9c('0x25')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x26')]())[_0xbd9c('0x15')](zoho[_0xbd9c('0x27')]())[_0xbd9c('0x15')](realtime['initZohoAccounts']())['then'](vtiger[_0xbd9c('0x28')]())['then'](realtime[_0xbd9c('0x29')]())[_0xbd9c('0x15')](freshsales[_0xbd9c('0x2a')]())[_0xbd9c('0x15')](realtime['initFreshsalesAccounts']())[_0xbd9c('0x15')](servicenow[_0xbd9c('0x2b')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x2c')]())[_0xbd9c('0x15')](dynamics365[_0xbd9c('0x2d')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x2e')]())[_0xbd9c('0x15')](campaign[_0xbd9c('0x2f')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x30')]())[_0xbd9c('0x15')](voiceExtension['getVoiceExtensions']())[_0xbd9c('0x15')](realtime[_0xbd9c('0x31')]())[_0xbd9c('0x15')](faxAccount[_0xbd9c('0x32')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x33')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0xbd9c('0x34')]()[_0xbd9c('0x15')](voiceQueueReport['getVoiceQueueReports']())[_0xbd9c('0x15')](realtime[_0xbd9c('0x35')]())['then'](cmHopperHistory[_0xbd9c('0x36')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x37')]())['then'](cmHopperHistory[_0xbd9c('0x38')]())[_0xbd9c('0x15')](realtime['initCampaignHopperHistory']())[_0xbd9c('0x15')](voiceCallReport[_0xbd9c('0x39')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x3a')]())[_0xbd9c('0x3b')](function(_0x55dd64){logger[_0xbd9c('0x3c')]('[index.js][initParams]',util[_0xbd9c('0x3d')](_0x55dd64,{'showHidden':![],'depth':null}));});}function main(){return server[_0xbd9c('0x3e')](realtime,preview,fax)[_0xbd9c('0x15')](function(){return initRealtime();})[_0xbd9c('0x15')](function(){return initParams();})[_0xbd9c('0x15')](function(){report[_0xbd9c('0x3f')]();setInterval(initRealtime,0x1388);})[_0xbd9c('0x3b')](function(_0x4066df){logger[_0xbd9c('0x3c')](_0xbd9c('0x40'),util['inspect'](_0x4066df,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xba47=['initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','inspect','util','moment','./realtime','./acw','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','then','getTrunks','initTrunks','getVoiceQueues','initTriggers','initTemplates','getZendeskAccounts'];(function(_0x43d440,_0x3e352e){var _0x19be0e=function(_0x1694ba){while(--_0x1694ba){_0x43d440['push'](_0x43d440['shift']());}};_0x19be0e(++_0x3e352e);}(_0xba47,0xb1));var _0x7ba4=function(_0x4f5948,_0x576931){_0x4f5948=_0x4f5948-0x0;var _0x5a5da8=_0xba47[_0x4f5948];return _0x5a5da8;};'use strict';var util=require(_0x7ba4('0x0'));var moment=require(_0x7ba4('0x1'));var server=require('./server');var Realtime=require(_0x7ba4('0x2'));var Report=require('./report');var Acw=require(_0x7ba4('0x3'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x7ba4('0x4'));var Fax=require(_0x7ba4('0x5'));var user=require(_0x7ba4('0x6'));var voiceQueue=require(_0x7ba4('0x7'));var voiceQueueReport=require(_0x7ba4('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x7ba4('0x9'));var trigger=require(_0x7ba4('0xa'));var template=require(_0x7ba4('0xb'));var cmHopperHistory=require(_0x7ba4('0xc'));var campaign=require(_0x7ba4('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x7ba4('0xe'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x7ba4('0xf'));var freshdesk=require(_0x7ba4('0x10'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x7ba4('0x11'));var vtiger=require(_0x7ba4('0x12'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7ba4('0x13'));var dynamics365=require(_0x7ba4('0x14'));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(_0x7ba4('0x15'))(_0x7ba4('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x7ba4('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7ba4('0x18')](_0x7ba4('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x7ba4('0x19')]()[_0x7ba4('0x1a')](user['getAgents']())[_0x7ba4('0x1a')](realtime['initAgents']())[_0x7ba4('0x1a')](user['getTelephones']())['then'](realtime['initTelephones']())['then'](trunk[_0x7ba4('0x1b')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x1c')]())[_0x7ba4('0x1a')](voiceQueue[_0x7ba4('0x1d')]())['then'](realtime['initVoiceQueues']())['then'](trigger['getTriggers']())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x1e')]())[_0x7ba4('0x1a')](template['getTemplates']())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x1f')]())[_0x7ba4('0x1a')](zendesk[_0x7ba4('0x20')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x21')]())[_0x7ba4('0x1a')](salesforce[_0x7ba4('0x22')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x23')]())[_0x7ba4('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x24')]())[_0x7ba4('0x1a')](freshdesk[_0x7ba4('0x25')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x26')]())['then'](desk[_0x7ba4('0x27')]())['then'](realtime[_0x7ba4('0x28')]())[_0x7ba4('0x1a')](zoho[_0x7ba4('0x29')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x2a')]())['then'](vtiger[_0x7ba4('0x2b')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x2c')]())[_0x7ba4('0x1a')](freshsales[_0x7ba4('0x2d')]())[_0x7ba4('0x1a')](realtime['initFreshsalesAccounts']())[_0x7ba4('0x1a')](servicenow[_0x7ba4('0x2e')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x2f')]())[_0x7ba4('0x1a')](dynamics365[_0x7ba4('0x30')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x31')]())[_0x7ba4('0x1a')](campaign[_0x7ba4('0x32')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x33')]())[_0x7ba4('0x1a')](voiceExtension[_0x7ba4('0x34')]())['then'](realtime[_0x7ba4('0x35')]())[_0x7ba4('0x1a')](faxAccount[_0x7ba4('0x36')]())['then'](realtime[_0x7ba4('0x37')]())[_0x7ba4('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x7ba4('0x19')]()[_0x7ba4('0x1a')](voiceQueueReport[_0x7ba4('0x38')]())[_0x7ba4('0x1a')](realtime['initVoiceQueueReports']())[_0x7ba4('0x1a')](cmHopperHistory[_0x7ba4('0x39')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x3a')]())[_0x7ba4('0x1a')](cmHopperHistory[_0x7ba4('0x3b')]())['then'](realtime[_0x7ba4('0x3c')]())[_0x7ba4('0x1a')](voiceCallReport[_0x7ba4('0x3d')]())['then'](realtime[_0x7ba4('0x3e')]())[_0x7ba4('0x3f')](function(_0xb5d053){logger[_0x7ba4('0x40')](_0x7ba4('0x41'),util['inspect'](_0xb5d053,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7ba4('0x42')](realtime,preview,fax)[_0x7ba4('0x1a')](function(){return initRealtime();})[_0x7ba4('0x1a')](function(){return initParams();})[_0x7ba4('0x1a')](function(){report[_0x7ba4('0x43')]();setInterval(initRealtime,0x1388);})[_0x7ba4('0x3f')](function(_0x193677){logger[_0x7ba4('0x40')](_0x7ba4('0x44'),util[_0x7ba4('0x45')](_0x193677,{'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 bebe467..b3b114d 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 _0x2d62=['stringify','user:%s','emit','user:ami:update','omit','exports','lodash','util','moment','ioredis','../../../config/environment','defaults','redis','name','email','accountcode','fullname','state','unknown','stateTime','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','not_inuse','idle','inuse','talking','statePause','toNumber','format','status'];(function(_0x5746a3,_0x3cc07d){var _0x30139e=function(_0x267950){while(--_0x267950){_0x5746a3['push'](_0x5746a3['shift']());}};_0x30139e(++_0x3cc07d);}(_0x2d62,0x146));var _0x22d6=function(_0x222c2b,_0x546501){_0x222c2b=_0x222c2b-0x0;var _0xe3adf0=_0x2d62[_0x222c2b];return _0xe3adf0;};'use strict';var _=require(_0x22d6('0x0'));var util=require(_0x22d6('0x1'));var moment=require(_0x22d6('0x2'));var md5=require('md5');var Redis=require(_0x22d6('0x3'));var config=require(_0x22d6('0x4'));config['redis']=_[_0x22d6('0x5')](config[_0x22d6('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x22d6('0x6')]));function Agent(_0x54557f){this['id']=_0x54557f['id']||0x0;this['name']=_0x54557f[_0x22d6('0x7')]||'';this[_0x22d6('0x8')]=_0x54557f[_0x22d6('0x8')]||'';this[_0x22d6('0x9')]=_0x54557f[_0x22d6('0x9')]||'';this[_0x22d6('0xa')]=_0x54557f[_0x22d6('0xa')]||'';this[_0x22d6('0xb')]=_0x22d6('0xc');this[_0x22d6('0xd')]=0x0;this['status']=_0x22d6('0xc');this[_0x22d6('0xe')]='';this['phone']='';this[_0x22d6('0xf')]='';this[_0x22d6('0x10')]='';this[_0x22d6('0x11')]=_0x54557f[_0x22d6('0x11')]||![];this[_0x22d6('0x12')]='unknown';this[_0x22d6('0x13')]=0x0;this[_0x22d6('0x14')]='';this[_0x22d6('0x15')]='';this[_0x22d6('0x16')]=![];this['local']=![];this[_0x22d6('0x17')]='';}Agent[_0x22d6('0x18')][_0x22d6('0x19')]=function(_0x2ec3aa){var _0x5b5838;if(_0x2ec3aa&&_0x2ec3aa['state']){_0x5b5838=_0x2ec3aa[_0x22d6('0xb')]['toLowerCase']();switch(_0x5b5838){case _0x22d6('0x1a'):_0x5b5838=_0x22d6('0x1b');break;case _0x22d6('0x1c'):_0x5b5838=_0x22d6('0x1d');break;}}if(_0x5b5838&&this[_0x22d6('0x12')]!==_0x5b5838||_0x2ec3aa[_0x22d6('0x1e')]){this['voiceStatusTime']=_[_0x22d6('0x1f')](moment()[_0x22d6('0x20')]('x'));}if(_0x5b5838){this[_0x22d6('0x12')]=_0x5b5838;}var _0x223b4c={'id':this['id'],'name':this[_0x22d6('0x7')],'email':this[_0x22d6('0x8')],'accountcode':this[_0x22d6('0x9')],'fullname':this[_0x22d6('0xa')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0x22d6('0x21')],'address':this[_0x22d6('0xe')],'online':this[_0x22d6('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x22d6('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x22d6('0x10')],'onhold':this['onhold']};var _0x5bf4c3=md5(JSON[_0x22d6('0x22')](_0x223b4c));if(this[_0x22d6('0x17')]!==_0x5bf4c3){this[_0x22d6('0x17')]=_0x5bf4c3;io['to'](util[_0x22d6('0x20')](_0x22d6('0x23'),_0x223b4c[_0x22d6('0x7')]))[_0x22d6('0x24')](_0x22d6('0x25'),_[_0x22d6('0x26')](_0x223b4c,[_0x22d6('0x11')]));io['emit']('user:presence',_0x223b4c);}};module[_0x22d6('0x27')]=Agent; \ No newline at end of file +var _0x22c4=['not_inuse','inuse','talking','statePause','toNumber','format','user:%s','user:ami:update','omit','emit','user:presence','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase'];(function(_0x5aff15,_0x1d7463){var _0xd355bf=function(_0x5b3d8c){while(--_0x5b3d8c){_0x5aff15['push'](_0x5aff15['shift']());}};_0xd355bf(++_0x1d7463);}(_0x22c4,0x81));var _0x422c=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x22c4[_0x387dc1];return _0x17567c;};'use strict';var _=require(_0x422c('0x0'));var util=require('util');var moment=require(_0x422c('0x1'));var md5=require(_0x422c('0x2'));var Redis=require(_0x422c('0x3'));var config=require(_0x422c('0x4'));config[_0x422c('0x5')]=_[_0x422c('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x422c('0x7'))(new Redis(config[_0x422c('0x5')]));function Agent(_0x1db2da){this['id']=_0x1db2da['id']||0x0;this[_0x422c('0x8')]=_0x1db2da['name']||'';this[_0x422c('0x9')]=_0x1db2da['email']||'';this[_0x422c('0xa')]=_0x1db2da['accountcode']||'';this[_0x422c('0xb')]=_0x1db2da[_0x422c('0xb')]||'';this[_0x422c('0xc')]=_0x422c('0xd');this[_0x422c('0xe')]=0x0;this[_0x422c('0xf')]=_0x422c('0xd');this[_0x422c('0x10')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x1db2da[_0x422c('0x11')]||![];this[_0x422c('0x12')]='unknown';this[_0x422c('0x13')]=0x0;this[_0x422c('0x14')]='';this[_0x422c('0x15')]='';this[_0x422c('0x16')]=![];this[_0x422c('0x17')]=![];this[_0x422c('0x2')]='';}Agent[_0x422c('0x18')][_0x422c('0x19')]=function(_0x2749fe){var _0x41bc1a;if(_0x2749fe&&_0x2749fe['state']){_0x41bc1a=_0x2749fe[_0x422c('0xc')][_0x422c('0x1a')]();switch(_0x41bc1a){case _0x422c('0x1b'):_0x41bc1a='idle';break;case _0x422c('0x1c'):_0x41bc1a=_0x422c('0x1d');break;}}if(_0x41bc1a&&this[_0x422c('0x12')]!==_0x41bc1a||_0x2749fe[_0x422c('0x1e')]){this[_0x422c('0x13')]=_[_0x422c('0x1f')](moment()[_0x422c('0x20')]('x'));}if(_0x41bc1a){this[_0x422c('0x12')]=_0x41bc1a;}var _0x4d0750={'id':this['id'],'name':this[_0x422c('0x8')],'email':this[_0x422c('0x9')],'accountcode':this[_0x422c('0xa')],'fullname':this[_0x422c('0xb')],'state':this['state'],'stateTime':this[_0x422c('0xe')],'status':this[_0x422c('0xf')],'address':this[_0x422c('0x10')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this['onhold']};var _0x40bcb9=md5(JSON['stringify'](_0x4d0750));if(this['md5']!==_0x40bcb9){this[_0x422c('0x2')]=_0x40bcb9;io['to'](util[_0x422c('0x20')](_0x422c('0x21'),_0x4d0750['name']))['emit'](_0x422c('0x22'),_[_0x422c('0x23')](_0x4d0750,[_0x422c('0x11')]));io[_0x422c('0x24')](_0x422c('0x25'),_0x4d0750);}};module[_0x422c('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 502ea1e..23717b0 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 _0x3668=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x3688e8,_0x5e1826){var _0x33c03d=function(_0x1a59e7){while(--_0x1a59e7){_0x3688e8['push'](_0x3688e8['shift']());}};_0x33c03d(++_0x5e1826);}(_0x3668,0x79));var _0x8366=function(_0x210796,_0x4a84ec){_0x210796=_0x210796-0x0;var _0x1b338e=_0x3668[_0x210796];return _0x1b338e;};'use strict';function Campaign(_0x1b3263){this['id']=_0x1b3263['id']||0x0;this[_0x8366('0x0')]=_0x1b3263[_0x8366('0x0')]||'';this[_0x8366('0x1')]=_0x1b3263['type']||_0x8366('0x2');this[_0x8366('0x3')]=0x0;this[_0x8366('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x8366('0x5')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x1b3263[_0x8366('0x6')];this[_0x8366('0x7')]=_0x1b3263[_0x8366('0x7')];this['dialTimezone']=_0x1b3263[_0x8366('0x8')]||null;this[_0x8366('0x9')]=_0x1b3263[_0x8366('0x9')]?_0x1b3263[_0x8366('0x9')]:null;this[_0x8366('0xa')]=_0x1b3263[_0x8366('0xa')];this[_0x8366('0xb')]=_0x1b3263[_0x8366('0xb')];this[_0x8366('0xc')]=_0x1b3263[_0x8366('0xc')]||0x1e;this[_0x8366('0xd')]=_0x1b3263[_0x8366('0xd')];this[_0x8366('0xe')]=_0x1b3263[_0x8366('0xe')];this[_0x8366('0xf')]=_0x1b3263['dialBusyMaxRetry'];this[_0x8366('0x10')]=_0x1b3263[_0x8366('0x10')];this[_0x8366('0x11')]=_0x1b3263[_0x8366('0x11')];this[_0x8366('0x12')]=_0x1b3263[_0x8366('0x12')];this[_0x8366('0x13')]=_0x1b3263[_0x8366('0x13')];this[_0x8366('0x14')]=_0x1b3263[_0x8366('0x14')]||0x3;this[_0x8366('0x15')]=_0x1b3263[_0x8366('0x15')]||0x96;this[_0x8366('0x16')]=_0x1b3263[_0x8366('0x16')]||0x3;this['dialDropRetryFrequency']=_0x1b3263[_0x8366('0x17')]||0x96;this[_0x8366('0x18')]=_0x1b3263[_0x8366('0x18')]||0x3;this[_0x8366('0x19')]=_0x1b3263[_0x8366('0x19')]||0x96;this[_0x8366('0x1a')]=_0x1b3263['dialMachineMaxRetry']||0x3;this[_0x8366('0x1b')]=_0x1b3263['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x1b3263[_0x8366('0x1c')]||0x3;this[_0x8366('0x1d')]=_0x1b3263[_0x8366('0x1d')]||0x96;this[_0x8366('0x1e')]=_0x1b3263[_0x8366('0x1e')]||_0x8366('0x1f');this['dialPrefix']=_0x1b3263[_0x8366('0x20')]||undefined;this[_0x8366('0x21')]=_0x1b3263['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x8366('0x22')]=_0x1b3263[_0x8366('0x22')]||undefined;this[_0x8366('0x23')]=_0x1b3263['TrunkBackup']?_0x1b3263[_0x8366('0x23')]:undefined;this[_0x8366('0x24')]=_0x1b3263[_0x8366('0x24')]?_0x1b3263[_0x8366('0x24')]:undefined;this[_0x8366('0x25')]=_0x1b3263[_0x8366('0x25')]?_0x1b3263[_0x8366('0x25')]:undefined;this['SquareProject']=_0x1b3263[_0x8366('0x26')]?_0x1b3263[_0x8366('0x26')]:undefined;this[_0x8366('0x27')]=_0x1b3263['SquareProject']?_0x1b3263['SquareProject']['name']:undefined;this[_0x8366('0x28')]=_0x1b3263[_0x8366('0x28')]||![];this[_0x8366('0x29')]=_0x1b3263[_0x8366('0x29')];this['dialAMDGreeting']=_0x1b3263['dialAMDGreeting'];this[_0x8366('0x2a')]=_0x1b3263['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x1b3263[_0x8366('0x2b')];this['dialAMDMinWordLength']=_0x1b3263[_0x8366('0x2c')];this[_0x8366('0x2d')]=_0x1b3263[_0x8366('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x1b3263[_0x8366('0x2e')];this[_0x8366('0x2f')]=_0x1b3263[_0x8366('0x2f')];this[_0x8366('0x30')]=_0x1b3263[_0x8366('0x30')];}module['exports']=Campaign; \ No newline at end of file +var _0xe930=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x2bff01,_0x53f6ee){var _0x5aef33=function(_0x2be952){while(--_0x2be952){_0x2bff01['push'](_0x2bff01['shift']());}};_0x5aef33(++_0x53f6ee);}(_0xe930,0xb4));var _0x0e93=function(_0x2c0ded,_0x3de22c){_0x2c0ded=_0x2c0ded-0x0;var _0x4473e5=_0xe930[_0x2c0ded];return _0x4473e5;};'use strict';function Campaign(_0x5c83e0){this['id']=_0x5c83e0['id']||0x0;this[_0x0e93('0x0')]=_0x5c83e0['name']||'';this[_0x0e93('0x1')]=_0x5c83e0[_0x0e93('0x1')]||'campaign';this[_0x0e93('0x2')]=0x0;this['temp']=0x0;this[_0x0e93('0x3')]=0x0;this[_0x0e93('0x4')]=0x0;this[_0x0e93('0x5')]='';this[_0x0e93('0x6')]=!![];this[_0x0e93('0x7')]=_0x5c83e0[_0x0e93('0x7')];this['limitCalls']=_0x5c83e0[_0x0e93('0x8')];this[_0x0e93('0x9')]=_0x5c83e0[_0x0e93('0x9')]||null;this['dialGlobalInterval']=_0x5c83e0[_0x0e93('0xa')]?_0x5c83e0[_0x0e93('0xa')]:null;this[_0x0e93('0xb')]=_0x5c83e0['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x5c83e0[_0x0e93('0xc')];this[_0x0e93('0xd')]=_0x5c83e0['dialOriginateTimeout']||0x1e;this[_0x0e93('0xe')]=_0x5c83e0[_0x0e93('0xe')];this['dialCongestionRetryFrequency']=_0x5c83e0[_0x0e93('0xf')];this[_0x0e93('0x10')]=_0x5c83e0[_0x0e93('0x10')];this['dialBusyRetryFrequency']=_0x5c83e0['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x5c83e0[_0x0e93('0x11')];this['dialNoAnswerRetryFrequency']=_0x5c83e0[_0x0e93('0x12')];this['dialGlobalMaxRetry']=_0x5c83e0[_0x0e93('0x13')];this[_0x0e93('0x14')]=_0x5c83e0['dialNoSuchNumberMaxRetry']||0x3;this[_0x0e93('0x15')]=_0x5c83e0[_0x0e93('0x15')]||0x96;this[_0x0e93('0x16')]=_0x5c83e0[_0x0e93('0x16')]||0x3;this['dialDropRetryFrequency']=_0x5c83e0[_0x0e93('0x17')]||0x96;this[_0x0e93('0x18')]=_0x5c83e0['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x5c83e0[_0x0e93('0x19')]||0x96;this[_0x0e93('0x1a')]=_0x5c83e0[_0x0e93('0x1a')]||0x3;this[_0x0e93('0x1b')]=_0x5c83e0[_0x0e93('0x1b')]||0x96;this[_0x0e93('0x1c')]=_0x5c83e0[_0x0e93('0x1c')]||0x3;this[_0x0e93('0x1d')]=_0x5c83e0[_0x0e93('0x1d')]||0x96;this[_0x0e93('0x1e')]=_0x5c83e0[_0x0e93('0x1e')]||_0x0e93('0x1f');this[_0x0e93('0x20')]=_0x5c83e0[_0x0e93('0x20')]||undefined;this[_0x0e93('0x21')]=_0x5c83e0[_0x0e93('0x21')]||undefined;this['dialCutDigit']=_0x5c83e0[_0x0e93('0x22')]||undefined;this[_0x0e93('0x23')]=_0x5c83e0[_0x0e93('0x23')]?_0x5c83e0[_0x0e93('0x23')]:undefined;this[_0x0e93('0x24')]=_0x5c83e0[_0x0e93('0x24')]?_0x5c83e0[_0x0e93('0x24')]:undefined;this[_0x0e93('0x25')]=_0x5c83e0[_0x0e93('0x25')]?_0x5c83e0[_0x0e93('0x25')]:undefined;this[_0x0e93('0x26')]=_0x5c83e0[_0x0e93('0x26')]?_0x5c83e0['SquareProject']:undefined;this[_0x0e93('0x27')]=_0x5c83e0[_0x0e93('0x26')]?_0x5c83e0['SquareProject'][_0x0e93('0x0')]:undefined;this[_0x0e93('0x28')]=_0x5c83e0[_0x0e93('0x28')]||![];this[_0x0e93('0x29')]=_0x5c83e0['dialAMDInitialSilence'];this[_0x0e93('0x2a')]=_0x5c83e0[_0x0e93('0x2a')];this[_0x0e93('0x2b')]=_0x5c83e0[_0x0e93('0x2b')];this[_0x0e93('0x2c')]=_0x5c83e0[_0x0e93('0x2c')];this['dialAMDMinWordLength']=_0x5c83e0[_0x0e93('0x2d')];this[_0x0e93('0x2e')]=_0x5c83e0[_0x0e93('0x2e')];this[_0x0e93('0x2f')]=_0x5c83e0['dialAMDMaximumNumberOfWords'];this[_0x0e93('0x30')]=_0x5c83e0[_0x0e93('0x30')];this[_0x0e93('0x31')]=_0x5c83e0[_0x0e93('0x31')];}module[_0x0e93('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2730c6c..e5fc3c5 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 _0x6a18=['calleridname','connectedlinenum','connectedlinename','accountcode','linkedid','exten','answered','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum'];(function(_0x5e55c5,_0xf3d8ab){var _0x227355=function(_0x2d6c74){while(--_0x2d6c74){_0x5e55c5['push'](_0x5e55c5['shift']());}};_0x227355(++_0xf3d8ab);}(_0x6a18,0x114));var _0x86a1=function(_0x113828,_0x377874){_0x113828=_0x113828-0x0;var _0x3a930a=_0x6a18[_0x113828];return _0x3a930a;};'use strict';function Channel(){this[_0x86a1('0x0')]=null;this[_0x86a1('0x1')]='';this[_0x86a1('0x2')]='';this[_0x86a1('0x3')]=0x0;this[_0x86a1('0x4')]='';this[_0x86a1('0x5')]=undefined;this[_0x86a1('0x6')]=undefined;this[_0x86a1('0x7')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x86a1('0x8')]=0x0;this[_0x86a1('0x9')]=0x0;this[_0x86a1('0xa')]=![];this['answertime']=null;this[_0x86a1('0xb')]=null;this[_0x86a1('0xc')]=![];this[_0x86a1('0xd')]=![];this['lastapplication']='';this[_0x86a1('0xe')]='';this[_0x86a1('0xf')]=0x0;this[_0x86a1('0x10')]=0x0;this[_0x86a1('0x11')]=0x0;this[_0x86a1('0x12')]=null;this[_0x86a1('0x13')]=null;this['disposition']=null;this[_0x86a1('0x14')]=![];this[_0x86a1('0x15')]=null;this[_0x86a1('0x16')]=null;this[_0x86a1('0x17')]=[];this[_0x86a1('0x18')]=undefined;this[_0x86a1('0x19')]=undefined;this[_0x86a1('0x1a')]=undefined;this[_0x86a1('0x1b')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x2272=['exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','type','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context'];(function(_0x480b14,_0x397259){var _0x271f62=function(_0x3a47a1){while(--_0x3a47a1){_0x480b14['push'](_0x480b14['shift']());}};_0x271f62(++_0x397259);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';function Channel(){this[_0x2227('0x0')]=null;this[_0x2227('0x1')]='';this[_0x2227('0x2')]='';this[_0x2227('0x3')]=0x0;this[_0x2227('0x4')]='';this['connectedlinenum']=undefined;this[_0x2227('0x5')]=undefined;this[_0x2227('0x6')]=0x0;this[_0x2227('0x7')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x2227('0x8')]=0x0;this[_0x2227('0x9')]=![];this[_0x2227('0xa')]=null;this[_0x2227('0xb')]=null;this[_0x2227('0xc')]=![];this[_0x2227('0xd')]=![];this[_0x2227('0xe')]='';this[_0x2227('0xf')]='';this[_0x2227('0x10')]=0x0;this[_0x2227('0x11')]=0x0;this['holdtime']=0x0;this[_0x2227('0x12')]=null;this['tag']=null;this[_0x2227('0x13')]=null;this[_0x2227('0x14')]=![];this[_0x2227('0x15')]=null;this[_0x2227('0x16')]=null;this[_0x2227('0x17')]=[];this['transfercalleridnum']=undefined;this[_0x2227('0x18')]=undefined;this[_0x2227('0x19')]=undefined;this[_0x2227('0x1a')]=0x0;}module[_0x2227('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 18603f1..944fb92 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 _0x5c4e=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x3362c2,_0x4d56ed){var _0x47c09f=function(_0x368a54){while(--_0x368a54){_0x3362c2['push'](_0x3362c2['shift']());}};_0x47c09f(++_0x4d56ed);}(_0x5c4e,0x18e));var _0xe5c4=function(_0x1548fa,_0x190c7f){_0x1548fa=_0x1548fa-0x0;var _0x3c473b=_0x5c4e[_0x1548fa];return _0x3c473b;};'use strict';function DeskAccount(_0xb11a){this['id']=_0xb11a['id']||0x0;this[_0xe5c4('0x0')]=_0xb11a[_0xe5c4('0x0')]||'';this['username']=_0xb11a[_0xe5c4('0x1')]||'';this[_0xe5c4('0x2')]=_0xb11a['remoteUri']||'';this[_0xe5c4('0x3')]=_0xb11a[_0xe5c4('0x3')]||'';this[_0xe5c4('0x4')]=_0xb11a[_0xe5c4('0x4')]||'';this[_0xe5c4('0x5')]=_0xb11a[_0xe5c4('0x5')]||'';this[_0xe5c4('0x6')]=_0xb11a[_0xe5c4('0x6')]||'';this['token']=_0xb11a[_0xe5c4('0x7')]||'';this[_0xe5c4('0x8')]=_0xb11a[_0xe5c4('0x8')]||'';this[_0xe5c4('0x9')]=_0xb11a[_0xe5c4('0x9')]||'';this[_0xe5c4('0xa')]=_0xb11a[_0xe5c4('0xa')]||'';this['Configurations']=_0xb11a[_0xe5c4('0xb')]||{};}module[_0xe5c4('0xc')]=DeskAccount; \ No newline at end of file +var _0xec6c=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','exports','name'];(function(_0x3c7122,_0x175c9d){var _0x3fc088=function(_0xf7512a){while(--_0xf7512a){_0x3c7122['push'](_0x3c7122['shift']());}};_0x3fc088(++_0x175c9d);}(_0xec6c,0x17f));var _0xcec6=function(_0x412018,_0x32c87e){_0x412018=_0x412018-0x0;var _0x442d9b=_0xec6c[_0x412018];return _0x442d9b;};'use strict';function DeskAccount(_0x174697){this['id']=_0x174697['id']||0x0;this[_0xcec6('0x0')]=_0x174697[_0xcec6('0x0')]||'';this[_0xcec6('0x1')]=_0x174697[_0xcec6('0x1')]||'';this['remoteUri']=_0x174697[_0xcec6('0x2')]||'';this[_0xcec6('0x3')]=_0x174697[_0xcec6('0x3')]||'';this[_0xcec6('0x4')]=_0x174697[_0xcec6('0x4')]||'';this[_0xcec6('0x5')]=_0x174697['consumerKey']||'';this[_0xcec6('0x6')]=_0x174697[_0xcec6('0x6')]||'';this[_0xcec6('0x7')]=_0x174697[_0xcec6('0x7')]||'';this['tokenSecret']=_0x174697[_0xcec6('0x8')]||'';this[_0xcec6('0x9')]=_0x174697[_0xcec6('0x9')]||'';this['serverUrl']=_0x174697['serverUrl']||'';this['Configurations']=_0x174697[_0xcec6('0xa')]||{};}module[_0xcec6('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 afccea1..ca8efb2 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 _0x4397=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId'];(function(_0x23f5fe,_0x59d8f4){var _0x223184=function(_0x472dec){while(--_0x472dec){_0x23f5fe['push'](_0x23f5fe['shift']());}};_0x223184(++_0x59d8f4);}(_0x4397,0x157));var _0x7439=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x4397[_0x13ce0c];return _0x4388fb;};'use strict';function Dynamics365Account(_0xa34273){this['id']=_0xa34273['id']||0x0;this[_0x7439('0x0')]=_0xa34273[_0x7439('0x0')]||'';this[_0x7439('0x1')]=_0xa34273[_0x7439('0x1')]||'';this['password']=_0xa34273[_0x7439('0x2')]||'';this[_0x7439('0x3')]=_0xa34273[_0x7439('0x3')]||'';this[_0x7439('0x4')]=_0xa34273[_0x7439('0x4')]||'';this[_0x7439('0x5')]=_0xa34273[_0x7439('0x5')]||'';this[_0x7439('0x6')]=_0xa34273[_0x7439('0x6')]||{};this[_0x7439('0x7')]=_0xa34273[_0x7439('0x7')]||'';this[_0x7439('0x8')]=_0xa34273['modernAuthentication']||![];this[_0x7439('0x9')]=_0xa34273[_0x7439('0x9')]||{};this[_0x7439('0xa')]=_0xa34273['CloudProvider']||{};}module[_0x7439('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x2af8=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x415b04,_0x3ab6cb){var _0x468fc9=function(_0x536ebc){while(--_0x536ebc){_0x415b04['push'](_0x415b04['shift']());}};_0x468fc9(++_0x3ab6cb);}(_0x2af8,0x154));var _0x82af=function(_0x1a24f3,_0x59a629){_0x1a24f3=_0x1a24f3-0x0;var _0x4edf11=_0x2af8[_0x1a24f3];return _0x4edf11;};'use strict';function Dynamics365Account(_0x1d2e73){this['id']=_0x1d2e73['id']||0x0;this[_0x82af('0x0')]=_0x1d2e73[_0x82af('0x0')]||'';this[_0x82af('0x1')]=_0x1d2e73[_0x82af('0x1')]||'';this[_0x82af('0x2')]=_0x1d2e73[_0x82af('0x2')]||'';this[_0x82af('0x3')]=_0x1d2e73[_0x82af('0x3')]||'';this['tenantId']=_0x1d2e73[_0x82af('0x4')]||'';this[_0x82af('0x5')]=_0x1d2e73['clientId']||'';this[_0x82af('0x6')]=_0x1d2e73[_0x82af('0x6')]||{};this[_0x82af('0x7')]=_0x1d2e73[_0x82af('0x7')]||'';this[_0x82af('0x8')]=_0x1d2e73[_0x82af('0x8')]||![];this[_0x82af('0x9')]=_0x1d2e73[_0x82af('0x9')]||{};this[_0x82af('0xa')]=_0x1d2e73['CloudProvider']||{};}module[_0x82af('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 d6f1ee7..586db11 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 _0xaf21=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo'];(function(_0x33c622,_0x385ca9){var _0x8282d1=function(_0x19c9be){while(--_0x19c9be){_0x33c622['push'](_0x33c622['shift']());}};_0x8282d1(++_0x385ca9);}(_0xaf21,0x1a5));var _0x1af2=function(_0x368af8,_0xe79de0){_0x368af8=_0x368af8-0x0;var _0x2bb2a8=_0xaf21[_0x368af8];return _0x2bb2a8;};'use strict';function FaxAccount(_0x4afa02){this['id']=_0x4afa02['id']||0x0;this[_0x1af2('0x0')]=_0x4afa02[_0x1af2('0x0')]||'';this[_0x1af2('0x1')]=_0x4afa02[_0x1af2('0x1')];this['ecm']=_0x4afa02[_0x1af2('0x2')];this[_0x1af2('0x3')]=_0x4afa02[_0x1af2('0x3')];this[_0x1af2('0x4')]=_0x4afa02[_0x1af2('0x4')];this['minrate']=_0x4afa02[_0x1af2('0x5')]||0x960;this['maxrate']=_0x4afa02[_0x1af2('0x6')]||0x3840;this[_0x1af2('0x7')]=_0x4afa02['modem']||_0x1af2('0x8');this[_0x1af2('0x9')]=_0x4afa02['gateway']||'no';this['faxdetect']=_0x4afa02[_0x1af2('0xa')]||'no';this[_0x1af2('0xb')]=_0x4afa02['t38timeout']||0x1388;this[_0x1af2('0xc')]=_0x4afa02[_0x1af2('0xc')]||_0x1af2('0xd');this[_0x1af2('0xe')]=_0x4afa02[_0x1af2('0xe')]?_0x4afa02['Trunk']:undefined;this[_0x1af2('0xf')]=_0x4afa02[_0x1af2('0xf')];this[_0x1af2('0x10')]=_0x4afa02[_0x1af2('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x1a81=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x57b9e0,_0x2fffc9){var _0x104561=function(_0x3f8157){while(--_0x3f8157){_0x57b9e0['push'](_0x57b9e0['shift']());}};_0x104561(++_0x2fffc9);}(_0x1a81,0x19b));var _0x11a8=function(_0x50aca8,_0x30cd2b){_0x50aca8=_0x50aca8-0x0;var _0x2a0c87=_0x1a81[_0x50aca8];return _0x2a0c87;};'use strict';function FaxAccount(_0x3d4f6a){this['id']=_0x3d4f6a['id']||0x0;this[_0x11a8('0x0')]=_0x3d4f6a[_0x11a8('0x0')]||'';this[_0x11a8('0x1')]=_0x3d4f6a[_0x11a8('0x1')];this[_0x11a8('0x2')]=_0x3d4f6a[_0x11a8('0x2')];this[_0x11a8('0x3')]=_0x3d4f6a[_0x11a8('0x3')];this[_0x11a8('0x4')]=_0x3d4f6a[_0x11a8('0x4')];this[_0x11a8('0x5')]=_0x3d4f6a[_0x11a8('0x5')]||0x960;this[_0x11a8('0x6')]=_0x3d4f6a[_0x11a8('0x6')]||0x3840;this[_0x11a8('0x7')]=_0x3d4f6a['modem']||_0x11a8('0x8');this['gateway']=_0x3d4f6a[_0x11a8('0x9')]||'no';this[_0x11a8('0xa')]=_0x3d4f6a[_0x11a8('0xa')]||'no';this['t38timeout']=_0x3d4f6a[_0x11a8('0xb')]||0x1388;this[_0x11a8('0xc')]=_0x3d4f6a[_0x11a8('0xc')]||_0x11a8('0xd');this[_0x11a8('0xe')]=_0x3d4f6a[_0x11a8('0xe')]?_0x3d4f6a[_0x11a8('0xe')]:undefined;this[_0x11a8('0xf')]=_0x3d4f6a['ListId'];this[_0x11a8('0x10')]=_0x3d4f6a['key'];}module[_0x11a8('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 23a9ffa..117691c 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 _0x6fe2=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x57d0d5,_0x54673a){var _0x26f844=function(_0x352b0f){while(--_0x352b0f){_0x57d0d5['push'](_0x57d0d5['shift']());}};_0x26f844(++_0x54673a);}(_0x6fe2,0x104));var _0x26fe=function(_0xbbcb0b,_0x5cebd6){_0xbbcb0b=_0xbbcb0b-0x0;var _0x3b3d01=_0x6fe2[_0xbbcb0b];return _0x3b3d01;};'use strict';function FreshdeskAccount(_0x332a79){this['id']=_0x332a79['id']||0x0;this[_0x26fe('0x0')]=_0x332a79[_0x26fe('0x0')]||'';this[_0x26fe('0x1')]=_0x332a79[_0x26fe('0x1')]||'';this[_0x26fe('0x2')]=_0x332a79[_0x26fe('0x3')]||'';this['remoteUri']=_0x332a79[_0x26fe('0x4')]||'';this[_0x26fe('0x5')]=_0x332a79[_0x26fe('0x5')]||'';this[_0x26fe('0x6')]=_0x332a79[_0x26fe('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x7212=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1f4ff0,_0x2077a1){var _0x36ed56=function(_0xf1d4ae){while(--_0xf1d4ae){_0x1f4ff0['push'](_0x1f4ff0['shift']());}};_0x36ed56(++_0x2077a1);}(_0x7212,0x1be));var _0x2721=function(_0x20233b,_0x42beca){_0x20233b=_0x20233b-0x0;var _0x199546=_0x7212[_0x20233b];return _0x199546;};'use strict';function FreshdeskAccount(_0x137448){this['id']=_0x137448['id']||0x0;this[_0x2721('0x0')]=_0x137448[_0x2721('0x0')]||'';this[_0x2721('0x1')]=_0x137448[_0x2721('0x1')]||'';this[_0x2721('0x2')]=_0x137448['token']||'';this[_0x2721('0x3')]=_0x137448[_0x2721('0x3')]||'';this[_0x2721('0x4')]=_0x137448['serverUrl']||'';this[_0x2721('0x5')]=_0x137448[_0x2721('0x5')]||{};}module[_0x2721('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 49827fd..6d2ef56 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 _0xae35=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x373ae5,_0x5d2f48){var _0x33791e=function(_0x24c361){while(--_0x24c361){_0x373ae5['push'](_0x373ae5['shift']());}};_0x33791e(++_0x5d2f48);}(_0xae35,0x172));var _0x5ae3=function(_0xdabeaa,_0x32b44c){_0xdabeaa=_0xdabeaa-0x0;var _0x277065=_0xae35[_0xdabeaa];return _0x277065;};'use strict';function FreshsalesAccount(_0x5db315){this['id']=_0x5db315['id']||0x0;this[_0x5ae3('0x0')]=_0x5db315[_0x5ae3('0x0')]||'';this[_0x5ae3('0x1')]=_0x5db315[_0x5ae3('0x1')]||'';this[_0x5ae3('0x2')]=_0x5db315[_0x5ae3('0x3')]||'';this[_0x5ae3('0x4')]=_0x5db315['remoteUri']||'';this[_0x5ae3('0x5')]=_0x5db315['serverUrl']||'';this[_0x5ae3('0x6')]=_0x5db315[_0x5ae3('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x33c5=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x33c5,0xe6));var _0x533c=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x33c5[_0x454165];return _0x56db53;};'use strict';function FreshsalesAccount(_0x3e6081){this['id']=_0x3e6081['id']||0x0;this[_0x533c('0x0')]=_0x3e6081[_0x533c('0x0')]||'';this['username']=_0x3e6081[_0x533c('0x1')]||'';this[_0x533c('0x2')]=_0x3e6081[_0x533c('0x3')]||'';this[_0x533c('0x4')]=_0x3e6081[_0x533c('0x4')]||'';this['serverUrl']=_0x3e6081[_0x533c('0x5')]||'';this[_0x533c('0x6')]=_0x3e6081[_0x533c('0x6')]||{};}module[_0x533c('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 5a7a53a..9a48e1c 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 _0xc3aa=['voice','mohtime','variables','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','assigned','motionChannel'];(function(_0x4af636,_0x223ee5){var _0x26c7f2=function(_0x5ccb3e){while(--_0x5ccb3e){_0x4af636['push'](_0x4af636['shift']());}};_0x26c7f2(++_0x223ee5);}(_0xc3aa,0xff));var _0xac3a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc3aa[_0x59ee6f];return _0x4c0979;};'use strict';function QueueReport(){this[_0xac3a('0x0')]='inbound';this[_0xac3a('0x1')]='';this[_0xac3a('0x2')]='';this[_0xac3a('0x3')]='';this[_0xac3a('0x4')]='';this['queuecallerjoinAt']=null;this[_0xac3a('0x5')]=null;this[_0xac3a('0x6')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xac3a('0x7')]=![];this['queuecallercompleteAt']=null;this[_0xac3a('0x8')]=![];this[_0xac3a('0x9')]=null;this[_0xac3a('0xa')]=0x1;this[_0xac3a('0xb')]='';this[_0xac3a('0xc')]='';this[_0xac3a('0xd')]='';this['accountcode']='';this[_0xac3a('0xe')]='';this[_0xac3a('0xf')]='';this['priority']='';this['holdtime']=0x0;this[_0xac3a('0x10')]=![];this['lastAssignedTo']='';this[_0xac3a('0x11')]=_0xac3a('0x12');this[_0xac3a('0x13')]=0x0;this[_0xac3a('0x14')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x622b=['mohtime','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','exten','priority','holdtime','assigned','motionChannel','voice'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x622b,0x1aa));var _0xb622=function(_0x92dda1,_0x5348ca){_0x92dda1=_0x92dda1-0x0;var _0x17dee2=_0x622b[_0x92dda1];return _0x17dee2;};'use strict';function QueueReport(){this[_0xb622('0x0')]=_0xb622('0x1');this[_0xb622('0x2')]='';this[_0xb622('0x3')]='';this[_0xb622('0x4')]='';this[_0xb622('0x5')]='';this[_0xb622('0x6')]=null;this[_0xb622('0x7')]=null;this[_0xb622('0x8')]=0x1;this[_0xb622('0x9')]=0x1;this[_0xb622('0xa')]=![];this[_0xb622('0xb')]=null;this[_0xb622('0xc')]=![];this[_0xb622('0xd')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xb622('0xe')]=0x1;this[_0xb622('0xf')]='';this[_0xb622('0x10')]='';this[_0xb622('0x11')]='';this['accountcode']='';this['context']='';this[_0xb622('0x12')]='';this[_0xb622('0x13')]='';this[_0xb622('0x14')]=0x0;this[_0xb622('0x15')]=![];this['lastAssignedTo']='';this[_0xb622('0x16')]=_0xb622('0x17');this[_0xb622('0x18')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 5a49bae..f7a16ab 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 _0x2c5e=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x4f5c40,_0x404350){var _0x37c6a5=function(_0x4542ad){while(--_0x4542ad){_0x4f5c40['push'](_0x4f5c40['shift']());}};_0x37c6a5(++_0x404350);}(_0x2c5e,0x139));var _0xe2c5=function(_0xc782ea,_0x403582){_0xc782ea=_0xc782ea-0x0;var _0x16d7c2=_0x2c5e[_0xc782ea];return _0x16d7c2;};'use strict';function SalesforceAccount(_0x3ec76a){this['id']=_0x3ec76a['id']||0x0;this[_0xe2c5('0x0')]=_0x3ec76a[_0xe2c5('0x0')]||'';this[_0xe2c5('0x1')]=_0x3ec76a[_0xe2c5('0x1')]||'';this[_0xe2c5('0x2')]=_0x3ec76a[_0xe2c5('0x2')]||'';this[_0xe2c5('0x3')]=_0x3ec76a['password']||'';this[_0xe2c5('0x4')]=_0x3ec76a[_0xe2c5('0x4')]||'';this[_0xe2c5('0x5')]=_0x3ec76a[_0xe2c5('0x5')]||'';this[_0xe2c5('0x6')]=_0x3ec76a[_0xe2c5('0x6')]||'';this[_0xe2c5('0x7')]=_0x3ec76a[_0xe2c5('0x7')]||_0xe2c5('0x8');this[_0xe2c5('0x9')]=_0x3ec76a[_0xe2c5('0x9')]||'';this[_0xe2c5('0xa')]=_0x3ec76a[_0xe2c5('0xa')]||{};}module[_0xe2c5('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xe3cc=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0xa8bd51,_0x51b538){var _0x1ef2e5=function(_0x37f31c){while(--_0x37f31c){_0xa8bd51['push'](_0xa8bd51['shift']());}};_0x1ef2e5(++_0x51b538);}(_0xe3cc,0x8b));var _0xce3c=function(_0x4efaae,_0x3073d1){_0x4efaae=_0x4efaae-0x0;var _0x1e43af=_0xe3cc[_0x4efaae];return _0x1e43af;};'use strict';function SalesforceAccount(_0x8e2f2b){this['id']=_0x8e2f2b['id']||0x0;this[_0xce3c('0x0')]=_0x8e2f2b[_0xce3c('0x0')]||'';this[_0xce3c('0x1')]=_0x8e2f2b[_0xce3c('0x1')]||'';this[_0xce3c('0x2')]=_0x8e2f2b[_0xce3c('0x2')]||'';this[_0xce3c('0x3')]=_0x8e2f2b[_0xce3c('0x3')]||'';this['clientId']=_0x8e2f2b['clientId']||'';this[_0xce3c('0x4')]=_0x8e2f2b['clientSecret']||'';this['securityToken']=_0x8e2f2b[_0xce3c('0x5')]||'';this['type']=_0x8e2f2b[_0xce3c('0x6')]||_0xce3c('0x7');this[_0xce3c('0x8')]=_0x8e2f2b[_0xce3c('0x8')]||'';this[_0xce3c('0x9')]=_0x8e2f2b[_0xce3c('0x9')]||{};}module[_0xce3c('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 4fee33e..18bf490 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 _0x7257=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1e11ac,_0x594f8d){var _0x2dd8cb=function(_0x3699a8){while(--_0x3699a8){_0x1e11ac['push'](_0x1e11ac['shift']());}};_0x2dd8cb(++_0x594f8d);}(_0x7257,0x17d));var _0x7725=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0x7257[_0x43fdf8];return _0x1160c6;};'use strict';function ServicenowAccount(_0x5534d4){this['id']=_0x5534d4['id']||0x0;this['name']=_0x5534d4[_0x7725('0x0')]||'';this[_0x7725('0x1')]=_0x5534d4[_0x7725('0x1')]||'';this[_0x7725('0x2')]=_0x5534d4[_0x7725('0x2')]||'';this[_0x7725('0x3')]=_0x5534d4['remoteUri']||'';this['serverUrl']=_0x5534d4[_0x7725('0x4')]||'';this[_0x7725('0x5')]=_0x5534d4[_0x7725('0x5')]||{};}module[_0x7725('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xca37=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xca37,0x17b));var _0x7ca3=function(_0x36f197,_0x1d6ab1){_0x36f197=_0x36f197-0x0;var _0x35585c=_0xca37[_0x36f197];return _0x35585c;};'use strict';function ServicenowAccount(_0x5ba0e2){this['id']=_0x5ba0e2['id']||0x0;this[_0x7ca3('0x0')]=_0x5ba0e2[_0x7ca3('0x0')]||'';this[_0x7ca3('0x1')]=_0x5ba0e2[_0x7ca3('0x1')]||'';this[_0x7ca3('0x2')]=_0x5ba0e2[_0x7ca3('0x2')]||'';this[_0x7ca3('0x3')]=_0x5ba0e2[_0x7ca3('0x3')]||'';this[_0x7ca3('0x4')]=_0x5ba0e2[_0x7ca3('0x4')]||'';this[_0x7ca3('0x5')]=_0x5ba0e2[_0x7ca3('0x5')]||{};}module[_0x7ca3('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 2bf9591..705bfac 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 _0x5f1e=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x3b3687,_0xe0142b){var _0x371563=function(_0x316846){while(--_0x316846){_0x3b3687['push'](_0x3b3687['shift']());}};_0x371563(++_0xe0142b);}(_0x5f1e,0x1cf));var _0xe5f1=function(_0x4f7331,_0x3b64a9){_0x4f7331=_0x4f7331-0x0;var _0x4d3f32=_0x5f1e[_0x4f7331];return _0x4d3f32;};'use strict';function SugarcrmAccount(_0x569b10){this['id']=_0x569b10['id']||0x0;this['name']=_0x569b10[_0xe5f1('0x0')]||'';this[_0xe5f1('0x1')]=_0x569b10[_0xe5f1('0x1')]||'';this[_0xe5f1('0x2')]=_0x569b10[_0xe5f1('0x2')]||'';this[_0xe5f1('0x3')]=_0x569b10['remoteUri']||'';this[_0xe5f1('0x4')]=_0x569b10[_0xe5f1('0x4')]||'';this[_0xe5f1('0x5')]=_0x569b10[_0xe5f1('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xd3d4=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4c851b,_0x447ec0){var _0x413380=function(_0x44d27e){while(--_0x44d27e){_0x4c851b['push'](_0x4c851b['shift']());}};_0x413380(++_0x447ec0);}(_0xd3d4,0x1b4));var _0x4d3d=function(_0x81bf2f,_0x2a705e){_0x81bf2f=_0x81bf2f-0x0;var _0x447f8e=_0xd3d4[_0x81bf2f];return _0x447f8e;};'use strict';function SugarcrmAccount(_0x1eed0e){this['id']=_0x1eed0e['id']||0x0;this[_0x4d3d('0x0')]=_0x1eed0e[_0x4d3d('0x0')]||'';this[_0x4d3d('0x1')]=_0x1eed0e['username']||'';this[_0x4d3d('0x2')]=_0x1eed0e[_0x4d3d('0x2')]||'';this[_0x4d3d('0x3')]=_0x1eed0e[_0x4d3d('0x3')]||'';this[_0x4d3d('0x4')]=_0x1eed0e[_0x4d3d('0x4')]||'';this[_0x4d3d('0x5')]=_0x1eed0e[_0x4d3d('0x5')]||{};}module[_0x4d3d('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 50ee033..2169010 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 _0xa8e2=['stateTime','status','unknown','address','exports','name','accountcode'];(function(_0x4430e7,_0x5387a1){var _0x24953a=function(_0x3308ac){while(--_0x3308ac){_0x4430e7['push'](_0x4430e7['shift']());}};_0x24953a(++_0x5387a1);}(_0xa8e2,0xa6));var _0x2a8e=function(_0x46e8a9,_0x1bd946){_0x46e8a9=_0x46e8a9-0x0;var _0x48a221=_0xa8e2[_0x46e8a9];return _0x48a221;};'use strict';function Telephone(_0x158cef){this['id']=_0x158cef['id']||0x0;this[_0x2a8e('0x0')]=_0x158cef[_0x2a8e('0x0')]||'';this[_0x2a8e('0x1')]=_0x158cef[_0x2a8e('0x1')]||'';this['state']='unknown';this[_0x2a8e('0x2')]=0x0;this[_0x2a8e('0x3')]=_0x2a8e('0x4');this[_0x2a8e('0x5')]='';}module[_0x2a8e('0x6')]=Telephone; \ No newline at end of file +var _0xd3d3=['unknown','exports','name','accountcode','stateTime','status'];(function(_0x1bdd2c,_0x34c99a){var _0x1dc9ef=function(_0x217f38){while(--_0x217f38){_0x1bdd2c['push'](_0x1bdd2c['shift']());}};_0x1dc9ef(++_0x34c99a);}(_0xd3d3,0x19a));var _0x3d3d=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xd3d3[_0x4fde08];return _0x12e725;};'use strict';function Telephone(_0x48c2ec){this['id']=_0x48c2ec['id']||0x0;this['name']=_0x48c2ec[_0x3d3d('0x0')]||'';this[_0x3d3d('0x1')]=_0x48c2ec['accountcode']||'';this['state']='unknown';this[_0x3d3d('0x2')]=0x0;this[_0x3d3d('0x3')]=_0x3d3d('0x4');this['address']='';}module[_0x3d3d('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 7d50a41..3a0eff8 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(_0x579c62,_0x1c4311){var _0x543436=function(_0x4ef593){while(--_0x4ef593){_0x579c62['push'](_0x579c62['shift']());}};_0x543436(++_0x1c4311);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x37f1c1,_0x4c2b7a){var _0x41884c=function(_0x2f4b5b){while(--_0x2f4b5b){_0x37f1c1['push'](_0x37f1c1['shift']());}};_0x41884c(++_0x4c2b7a);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e7c2,_0x3b3347){_0x4e7c2=_0x4e7c2-0x0;var _0x84bb35=_0xb10b[_0x4e7c2];return _0x84bb35;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 1b30d75..d758905 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x1b7eb4,_0x3612b7){var _0x156791=function(_0x5ecfdf){while(--_0x5ecfdf){_0x1b7eb4['push'](_0x1b7eb4['shift']());}};_0x156791(++_0x3612b7);}(_0x8603,0x190));var _0x3860=function(_0x221d0f,_0x37c51d){_0x221d0f=_0x221d0f-0x0;var _0x178f23=_0x8603[_0x221d0f];return _0x178f23;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x4e7a58,_0x5104d9){var _0x22e4b6=function(_0x44fffe){while(--_0x44fffe){_0x4e7a58['push'](_0x4e7a58['shift']());}};_0x22e4b6(++_0x5104d9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xb7e7[_0x3c4737];return _0x2bb926;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index b69dfa8..ab72600 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 _0x63b9=['port','domain','refresh','stateRegistry','registrationtime','exports','active','name','unknown','stateTime','status','registry','indexOf','split','host'];(function(_0x246708,_0x480368){var _0x241f8c=function(_0x1c19bc){while(--_0x1c19bc){_0x246708['push'](_0x246708['shift']());}};_0x241f8c(++_0x480368);}(_0x63b9,0x1e6));var _0x963b=function(_0x3a486b,_0x2e2d67){_0x3a486b=_0x3a486b-0x0;var _0x15ab31=_0x63b9[_0x3a486b];return _0x15ab31;};'use strict';function Trunk(_0x4c3c6c){this['id']=_0x4c3c6c['id']||0x0;this['active']=_0x4c3c6c[_0x963b('0x0')]||![];this[_0x963b('0x1')]=_0x4c3c6c[_0x963b('0x1')]||'';this['state']=_0x963b('0x2');this[_0x963b('0x3')]=0x0;this[_0x963b('0x4')]='unknown';this['registry']=_0x4c3c6c['registry']&&_0x4c3c6c[_0x963b('0x5')][_0x963b('0x6')](':')?_0x4c3c6c[_0x963b('0x5')][_0x963b('0x7')](':')[0x0]:'';this[_0x963b('0x8')]='';this[_0x963b('0x9')]='';this[_0x963b('0xa')]='';this['domainport']='';this[_0x963b('0xb')]='';this[_0x963b('0xc')]=_0x963b('0x2');this[_0x963b('0xd')]='';this['address']='';this['defaultuser']=_0x4c3c6c['defaultuser']||'';}module[_0x963b('0xe')]=Trunk; \ No newline at end of file +var _0x2679=['host','port','domainport','registrationtime','defaultuser','exports','active','name','state','unknown','status','registry','indexOf'];(function(_0x38441d,_0x12e5f5){var _0x23c0a0=function(_0xa360c8){while(--_0xa360c8){_0x38441d['push'](_0x38441d['shift']());}};_0x23c0a0(++_0x12e5f5);}(_0x2679,0x165));var _0x9267=function(_0x45d1b1,_0x328cb0){_0x45d1b1=_0x45d1b1-0x0;var _0x313c30=_0x2679[_0x45d1b1];return _0x313c30;};'use strict';function Trunk(_0x31acef){this['id']=_0x31acef['id']||0x0;this[_0x9267('0x0')]=_0x31acef[_0x9267('0x0')]||![];this[_0x9267('0x1')]=_0x31acef[_0x9267('0x1')]||'';this[_0x9267('0x2')]=_0x9267('0x3');this['stateTime']=0x0;this[_0x9267('0x4')]=_0x9267('0x3');this[_0x9267('0x5')]=_0x31acef[_0x9267('0x5')]&&_0x31acef[_0x9267('0x5')][_0x9267('0x6')](':')?_0x31acef[_0x9267('0x5')]['split'](':')[0x0]:'';this[_0x9267('0x7')]='';this[_0x9267('0x8')]='';this['domain']='';this[_0x9267('0x9')]='';this['refresh']='';this['stateRegistry']=_0x9267('0x3');this[_0x9267('0xa')]='';this['address']='';this[_0x9267('0xb')]=_0x31acef['defaultuser']||'';}module[_0x9267('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4bdb0a2..e54f8b7 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 _0x623a=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x1be6b9,_0x344c66){var _0x1d516b=function(_0x18cf2d){while(--_0x18cf2d){_0x1be6b9['push'](_0x1be6b9['shift']());}};_0x1d516b(++_0x344c66);}(_0x623a,0x131));var _0xa623=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x623a[_0xdea41a];return _0x15d0d8;};'use strict';function voiceExtension(_0xa9f86b){this['id']=_0xa9f86b['id']||0x0;this[_0xa623('0x0')]=_0xa9f86b[_0xa623('0x0')]||'';this[_0xa623('0x1')]=_0xa9f86b[_0xa623('0x1')]||'none';this[_0xa623('0x2')]=_0xa9f86b[_0xa623('0x2')]||![];}module[_0xa623('0x3')]=voiceExtension; \ No newline at end of file +var _0x8791=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0x8791,0x7a));var _0x1879=function(_0x4bbf7c,_0x1fda40){_0x4bbf7c=_0x4bbf7c-0x0;var _0x4bb91e=_0x8791[_0x4bbf7c];return _0x4bb91e;};'use strict';function voiceExtension(_0x3e2753){this['id']=_0x3e2753['id']||0x0;this[_0x1879('0x0')]=_0x3e2753['exten']||'';this[_0x1879('0x1')]=_0x3e2753['recordingFormat']||_0x1879('0x2');this[_0x1879('0x3')]=_0x3e2753[_0x1879('0x3')]||![];}module[_0x1879('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 8a9c44e..e21f66d 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 _0x535d=['type','waiting','total','answered','sumDuration','sumBillable','unmanaged','abandoned','available','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','ringall','roundrobin','rrmemory','rrordered','wrandom','monitor_format'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x535d,0xe8));var _0xd535=function(_0x139b59,_0x3d3687){_0x139b59=_0x139b59-0x0;var _0x96ea21=_0x535d[_0x139b59];return _0x96ea21;};'use strict';var monitorFormat={'wav':_0xd535('0x0'),'wav49':_0xd535('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xd535('0x2'),'leastrecent':_0xd535('0x3'),'linear':'linear','random':'random','ringall':_0xd535('0x4'),'rr':_0xd535('0x5'),'rrmemory':_0xd535('0x6'),'rrordered':_0xd535('0x7'),'wrandom':_0xd535('0x8')};function VoiceQueue(_0xa9d48d){this['id']=_0xa9d48d['id']||0x0;this['name']=_0xa9d48d['name']||'';this[_0xd535('0x9')]=_0xa9d48d[_0xd535('0x9')]||'';this['type']=_0xa9d48d[_0xd535('0xa')]||'inbound';this[_0xd535('0xb')]=0x0;this[_0xd535('0xc')]=0x0;this[_0xd535('0xd')]=0x0;this[_0xd535('0xe')]=0x0;this['sumHoldTime']=0x0;this[_0xd535('0xf')]=0x0;this[_0xd535('0x10')]=0x0;this[_0xd535('0x11')]=0x0;this[_0xd535('0x12')]=0x0;this['busy']=0x0;this[_0xd535('0x13')]=0x0;this[_0xd535('0x14')]=0x0;this[_0xd535('0x15')]=0x0;this[_0xd535('0x16')]=0x0;this[_0xd535('0x17')]=0x0;this[_0xd535('0x18')]=0x0;this[_0xd535('0x19')]=0x0;this['ringInUse']=0x0;this[_0xd535('0x1a')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this[_0xd535('0x1b')]=_0xa9d48d[_0xd535('0x1b')]||![];this['acwTimeout']=_0xa9d48d[_0xd535('0x1c')]||0xa;this[_0xd535('0x1d')]=_0xa9d48d[_0xd535('0x1d')]||'no';this[_0xd535('0x1e')]=!![];this['message']='';this[_0xd535('0x1f')]='';this[_0xd535('0x20')]=0x0;this[_0xd535('0x21')]=0x0;this[_0xd535('0x22')]=_0xa9d48d['dialTimezone']||null;this[_0xd535('0x23')]=_0xa9d48d['dialGlobalInterval']?_0xa9d48d[_0xd535('0x23')]:null;this['dialActive']=_0xa9d48d[_0xd535('0x24')];this['dialMethod']=_0xa9d48d[_0xd535('0x25')]||_0xd535('0x26');this[_0xd535('0x27')]=_0xa9d48d[_0xd535('0x27')]||0x0;this['dialLimitQueue']=_0xa9d48d['dialLimitQueue']||0x0;this[_0xd535('0x28')]=_0xa9d48d['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0xa9d48d[_0xd535('0x29')]||_0xd535('0x2a');this[_0xd535('0x2b')]=_0xa9d48d[_0xd535('0x2b')]||0.03;this[_0xd535('0x2c')]=_0xa9d48d[_0xd535('0x2c')]||0x258;this['dialOriginateCallerIdName']=_0xa9d48d[_0xd535('0x2d')]||_0xd535('0x2e');this[_0xd535('0x2f')]=_0xa9d48d[_0xd535('0x2f')]||_0xd535('0x2e');this['dialOriginateTimeout']=_0xa9d48d['dialOriginateTimeout']||0x1e;this[_0xd535('0x30')]=_0xa9d48d[_0xd535('0x30')]||'tTxX';this['dialQueueTimeout']=_0xa9d48d[_0xd535('0x31')]||0x3;this[_0xd535('0x32')]=_0xa9d48d[_0xd535('0x32')]||undefined;this['dialCongestionMaxRetry']=_0xa9d48d['dialCongestionMaxRetry']||0x3;this[_0xd535('0x33')]=_0xa9d48d[_0xd535('0x33')]||0x96;this[_0xd535('0x34')]=_0xa9d48d[_0xd535('0x34')]||0x3;this[_0xd535('0x35')]=_0xa9d48d[_0xd535('0x35')]||0x96;this[_0xd535('0x36')]=_0xa9d48d['dialNoAnswerMaxRetry']||0x3;this[_0xd535('0x37')]=_0xa9d48d[_0xd535('0x37')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xa9d48d['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0xa9d48d[_0xd535('0x38')]||0x96;this[_0xd535('0x39')]=_0xa9d48d[_0xd535('0x39')]||0x3;this[_0xd535('0x3a')]=_0xa9d48d[_0xd535('0x3a')]||0x96;this['dialAbandonedMaxRetry']=_0xa9d48d['dialAbandonedMaxRetry']||0x3;this[_0xd535('0x3b')]=_0xa9d48d[_0xd535('0x3b')]||0x96;this[_0xd535('0x3c')]=_0xa9d48d[_0xd535('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0xa9d48d[_0xd535('0x3d')]||0x96;this[_0xd535('0x3e')]=_0xa9d48d[_0xd535('0x3e')]||0x3;this[_0xd535('0x3f')]=_0xa9d48d[_0xd535('0x3f')]||0x96;this[_0xd535('0x40')]=_0xa9d48d['callAdditionalPhoneAfterMin']||0x3;this[_0xd535('0x41')]=_0xa9d48d[_0xd535('0x41')]||0x4;this[_0xd535('0x42')]=_0xa9d48d['Trunk']?_0xa9d48d[_0xd535('0x42')]:undefined;this[_0xd535('0x43')]=_0xa9d48d[_0xd535('0x43')]?_0xa9d48d[_0xd535('0x43')]:undefined;this[_0xd535('0x44')]=_0xa9d48d['dialPrefix']||undefined;this['Interval']=_0xa9d48d['Interval']?_0xa9d48d[_0xd535('0x45')]:undefined;this[_0xd535('0x46')]=_0xa9d48d[_0xd535('0x46')]||_0xd535('0x47');this[_0xd535('0x48')]=_0xa9d48d[_0xd535('0x48')]||undefined;this['dialCutDigit']=_0xa9d48d['dialCutDigit']||undefined;this[_0xd535('0x49')]=strategy[_0xa9d48d['strategy']];this[_0xd535('0x4a')]=!![];this['dialAMDActive']=_0xa9d48d[_0xd535('0x4b')]||![];this['dialAMDInitialSilence']=_0xa9d48d[_0xd535('0x4c')];this['dialAMDGreeting']=_0xa9d48d[_0xd535('0x4d')];this[_0xd535('0x4e')]=_0xa9d48d[_0xd535('0x4e')];this[_0xd535('0x4f')]=_0xa9d48d['dialAMDTotalAnalysisTime'];this[_0xd535('0x50')]=_0xa9d48d[_0xd535('0x50')];this['dialAMDBetweenWordsSilence']=_0xa9d48d[_0xd535('0x51')];this[_0xd535('0x52')]=_0xa9d48d[_0xd535('0x52')];this[_0xd535('0x53')]=_0xa9d48d[_0xd535('0x53')];this[_0xd535('0x54')]=_0xa9d48d[_0xd535('0x54')];this[_0xd535('0x55')]=0x0;this[_0xd535('0x56')]=0x0;this[_0xd535('0x57')]=_0xa9d48d['timeout'];this[_0xd535('0x58')]=0x0;this[_0xd535('0x59')]=0x0;this[_0xd535('0x5a')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xd535('0x5b')]=0x0;this[_0xd535('0x5c')]=0x0;this[_0xd535('0x5d')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xd535('0x5e')]=0x0;this[_0xd535('0x5f')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xd535('0x60')]=0x0;this['outboundReCallsDay']=0x0;this[_0xd535('0x61')]=0x0;this[_0xd535('0x62')]=undefined;this[_0xd535('0x63')]=undefined;this[_0xd535('0x64')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xd535('0x65')]=0x0;this[_0xd535('0x66')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xd535('0x67')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xd535('0x68')]=_0xa9d48d[_0xd535('0x69')]||0x14;this['predictiveIntervalMinThreshold']=_0xa9d48d['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xd535('0x6a')]=0x0;this[_0xd535('0x6b')]=0x0;this[_0xd535('0x6c')]=0x1;this['erlangCalls']=0x0;this[_0xd535('0x6d')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xd535('0x6e')]=0x0;this[_0xd535('0x6f')]=_0xa9d48d[_0xd535('0x6f')]||0x1e;this[_0xd535('0x70')]=_0xa9d48d[_0xd535('0x70')]||![];this[_0xd535('0x71')]=!!_0xa9d48d[_0xd535('0x71')]||![];this['dialPreviewRecallmeReminder']=!!_0xa9d48d['dialPreviewRecallmeReminder']||![];this[_0xd535('0x72')]=_0xa9d48d[_0xd535('0x72')]||undefined;this[_0xd535('0x73')]=_0xa9d48d['dialAgiAfterHangupClient']||![];this[_0xd535('0x74')]=_0xa9d48d['dialAgiAfterHangupAgent']||![];this[_0xd535('0x9')]=monitorFormat[_0xa9d48d[_0xd535('0x9')]]?monitorFormat[_0xa9d48d[_0xd535('0x9')]]:undefined;this[_0xd535('0x75')]=_0xa9d48d['mandatoryDisposition']||![];this[_0xd535('0x76')]=_0xa9d48d[_0xd535('0x76')]?_0xa9d48d[_0xd535('0x76')]:undefined;this[_0xd535('0x77')]=![];}module[_0xd535('0x78')]=VoiceQueue; \ No newline at end of file +var _0x21b7=['loggedIn','paused','ringInUse','talking','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','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','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','fewestcalls','leastrecent','linear','random','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','busy','inUse','invalid'];(function(_0x12b4d4,_0x26c1a7){var _0x4845a6=function(_0x55fad9){while(--_0x55fad9){_0x12b4d4['push'](_0x12b4d4['shift']());}};_0x4845a6(++_0x26c1a7);}(_0x21b7,0xef));var _0x721b=function(_0x2dd942,_0x36175e){_0x2dd942=_0x2dd942-0x0;var _0xb6787d=_0x21b7[_0x2dd942];return _0xb6787d;};'use strict';var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':_0x721b('0x0'),'leastrecent':_0x721b('0x1'),'linear':_0x721b('0x2'),'random':_0x721b('0x3'),'ringall':'ringall','rr':'roundrobin','rrmemory':_0x721b('0x4'),'rrordered':_0x721b('0x5'),'wrandom':_0x721b('0x6')};function VoiceQueue(_0x343cd3){this['id']=_0x343cd3['id']||0x0;this[_0x721b('0x7')]=_0x343cd3[_0x721b('0x7')]||'';this['monitor_format']=_0x343cd3[_0x721b('0x8')]||'';this[_0x721b('0x9')]=_0x343cd3['type']||'inbound';this[_0x721b('0xa')]=0x0;this[_0x721b('0xb')]=0x0;this[_0x721b('0xc')]=0x0;this[_0x721b('0xd')]=0x0;this[_0x721b('0xe')]=0x0;this['sumBillable']=0x0;this[_0x721b('0xf')]=0x0;this[_0x721b('0x10')]=0x0;this[_0x721b('0x11')]=0x0;this[_0x721b('0x12')]=0x0;this[_0x721b('0x13')]=0x0;this[_0x721b('0x14')]=0x0;this[_0x721b('0x15')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x721b('0x16')]=0x0;this['ringing']=0x0;this[_0x721b('0x17')]=0x0;this[_0x721b('0x18')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this[_0x721b('0x19')]=_0x343cd3[_0x721b('0x19')]||![];this[_0x721b('0x1a')]=_0x343cd3[_0x721b('0x1a')]||0xa;this[_0x721b('0x1b')]=_0x343cd3[_0x721b('0x1b')]||'no';this[_0x721b('0x1c')]=!![];this[_0x721b('0x1d')]='';this[_0x721b('0x1e')]='';this[_0x721b('0x1f')]=0x0;this[_0x721b('0x20')]=0x0;this[_0x721b('0x21')]=_0x343cd3[_0x721b('0x21')]||null;this[_0x721b('0x22')]=_0x343cd3['dialGlobalInterval']?_0x343cd3[_0x721b('0x22')]:null;this[_0x721b('0x23')]=_0x343cd3[_0x721b('0x23')];this[_0x721b('0x24')]=_0x343cd3[_0x721b('0x24')]||_0x721b('0x25');this[_0x721b('0x26')]=_0x343cd3['dialLimitChannel']||0x0;this[_0x721b('0x27')]=_0x343cd3[_0x721b('0x27')]||0x0;this[_0x721b('0x28')]=_0x343cd3[_0x721b('0x28')]||0x1;this[_0x721b('0x29')]=_0x343cd3[_0x721b('0x29')]||_0x721b('0x2a');this[_0x721b('0x2b')]=_0x343cd3[_0x721b('0x2b')]||0.03;this[_0x721b('0x2c')]=_0x343cd3['dialPredictiveInterval']||0x258;this[_0x721b('0x2d')]=_0x343cd3[_0x721b('0x2d')]||_0x721b('0x2e');this['dialOriginateCallerIdNumber']=_0x343cd3['dialOriginateCallerIdNumber']||_0x721b('0x2e');this[_0x721b('0x2f')]=_0x343cd3[_0x721b('0x2f')]||0x1e;this[_0x721b('0x30')]=_0x343cd3[_0x721b('0x30')]||_0x721b('0x31');this['dialQueueTimeout']=_0x343cd3[_0x721b('0x32')]||0x3;this[_0x721b('0x33')]=_0x343cd3['dialQueueProject']||undefined;this[_0x721b('0x34')]=_0x343cd3[_0x721b('0x34')]||0x3;this[_0x721b('0x35')]=_0x343cd3['dialCongestionRetryFrequency']||0x96;this[_0x721b('0x36')]=_0x343cd3['dialBusyMaxRetry']||0x3;this[_0x721b('0x37')]=_0x343cd3[_0x721b('0x37')]||0x96;this[_0x721b('0x38')]=_0x343cd3['dialNoAnswerMaxRetry']||0x3;this[_0x721b('0x39')]=_0x343cd3[_0x721b('0x39')]||0x96;this[_0x721b('0x3a')]=_0x343cd3['dialNoSuchNumberMaxRetry']||0x3;this[_0x721b('0x3b')]=_0x343cd3['dialNoSuchNumberRetryFrequency']||0x96;this[_0x721b('0x3c')]=_0x343cd3[_0x721b('0x3c')]||0x3;this['dialDropRetryFrequency']=_0x343cd3[_0x721b('0x3d')]||0x96;this[_0x721b('0x3e')]=_0x343cd3[_0x721b('0x3e')]||0x3;this['dialAbandonedRetryFrequency']=_0x343cd3[_0x721b('0x3f')]||0x96;this[_0x721b('0x40')]=_0x343cd3[_0x721b('0x40')]||0x3;this['dialMachineRetryFrequency']=_0x343cd3[_0x721b('0x41')]||0x96;this[_0x721b('0x42')]=_0x343cd3[_0x721b('0x42')]||0x3;this[_0x721b('0x43')]=_0x343cd3['dialAgentRejectRetryFrequency']||0x96;this[_0x721b('0x44')]=_0x343cd3[_0x721b('0x44')]||0x3;this[_0x721b('0x45')]=_0x343cd3[_0x721b('0x45')]||0x4;this[_0x721b('0x46')]=_0x343cd3[_0x721b('0x46')]?_0x343cd3[_0x721b('0x46')]:undefined;this[_0x721b('0x47')]=_0x343cd3[_0x721b('0x47')]?_0x343cd3[_0x721b('0x47')]:undefined;this[_0x721b('0x48')]=_0x343cd3[_0x721b('0x48')]||undefined;this[_0x721b('0x49')]=_0x343cd3[_0x721b('0x49')]?_0x343cd3[_0x721b('0x49')]:undefined;this[_0x721b('0x4a')]=_0x343cd3[_0x721b('0x4a')]||_0x721b('0x4b');this[_0x721b('0x4c')]=_0x343cd3[_0x721b('0x4c')]||undefined;this[_0x721b('0x4d')]=_0x343cd3[_0x721b('0x4d')]||undefined;this['strategy']=strategy[_0x343cd3[_0x721b('0x4e')]];this[_0x721b('0x4f')]=!![];this[_0x721b('0x50')]=_0x343cd3[_0x721b('0x50')]||![];this[_0x721b('0x51')]=_0x343cd3[_0x721b('0x51')];this[_0x721b('0x52')]=_0x343cd3[_0x721b('0x52')];this[_0x721b('0x53')]=_0x343cd3[_0x721b('0x53')];this[_0x721b('0x54')]=_0x343cd3[_0x721b('0x54')];this[_0x721b('0x55')]=_0x343cd3[_0x721b('0x55')];this[_0x721b('0x56')]=_0x343cd3[_0x721b('0x56')];this[_0x721b('0x57')]=_0x343cd3[_0x721b('0x57')];this[_0x721b('0x58')]=_0x343cd3['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x343cd3[_0x721b('0x59')];this[_0x721b('0x5a')]=0x0;this[_0x721b('0x5b')]=0x0;this[_0x721b('0x5c')]=_0x343cd3[_0x721b('0x5c')];this[_0x721b('0x5d')]=0x0;this[_0x721b('0x5e')]=0x0;this[_0x721b('0x5f')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x721b('0x60')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x721b('0x61')]=0x0;this[_0x721b('0x62')]=0x0;this[_0x721b('0x63')]=0x0;this[_0x721b('0x64')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x721b('0x65')]=0x0;this[_0x721b('0x66')]=0x0;this['startProgressive']=undefined;this[_0x721b('0x67')]=undefined;this[_0x721b('0x68')]=undefined;this[_0x721b('0x69')]=1.05;this[_0x721b('0x6a')]=0x0;this[_0x721b('0x6b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x721b('0x6c')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x721b('0x6d')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x721b('0x6e')]=0x0;this[_0x721b('0x6f')]=_0x343cd3['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x721b('0x70')]=_0x343cd3[_0x721b('0x71')]||0xa;this[_0x721b('0x72')]=0x0;this[_0x721b('0x73')]=0x0;this[_0x721b('0x74')]=0x1;this[_0x721b('0x75')]=0x0;this['erlangCallToSecond']=0x0;this[_0x721b('0x76')]=0x0;this[_0x721b('0x77')]=0x0;this['dialRecallMeTimeout']=_0x343cd3[_0x721b('0x78')]||0x1e;this[_0x721b('0x79')]=_0x343cd3[_0x721b('0x79')]||![];this[_0x721b('0x7a')]=!!_0x343cd3[_0x721b('0x7a')]||![];this[_0x721b('0x7b')]=!!_0x343cd3['dialPreviewRecallmeReminder']||![];this[_0x721b('0x7c')]=_0x343cd3[_0x721b('0x7c')]||undefined;this[_0x721b('0x7d')]=_0x343cd3['dialAgiAfterHangupClient']||![];this[_0x721b('0x7e')]=_0x343cd3[_0x721b('0x7e')]||![];this[_0x721b('0x8')]=monitorFormat[_0x343cd3['monitor_format']]?monitorFormat[_0x343cd3[_0x721b('0x8')]]:undefined;this['mandatoryDisposition']=_0x343cd3[_0x721b('0x7f')]||![];this[_0x721b('0x80')]=_0x343cd3['mandatoryDispositionPause']?_0x343cd3[_0x721b('0x80')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x721b('0x81')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 9350cdd..acb1e05 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 _0x1bce=['erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','unavailable','callers','length','SIP/','online','incall','status','booked','keys','dialer','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','paused','ringing','talking','waiting','answered','inUse','loggedInDb','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate'];(function(_0x54df1f,_0x163295){var _0x43c97a=function(_0x152598){while(--_0x152598){_0x54df1f['push'](_0x54df1f['shift']());}};_0x43c97a(++_0x163295);}(_0x1bce,0x73));var _0xe1bc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1bce[_0x2641f9];return _0x585741;};'use strict';var INBOUND_COUNTERS=[_0xe1bc('0x0'),_0xe1bc('0x1'),'loggedInDb',_0xe1bc('0x2'),_0xe1bc('0x3'),_0xe1bc('0x4'),_0xe1bc('0x5')];var OUTBOUND_COUNTERS=[_0xe1bc('0x0'),_0xe1bc('0x6'),_0xe1bc('0x7'),_0xe1bc('0x1'),_0xe1bc('0x8'),'originated','outboundAbandonedCallsDay',_0xe1bc('0x9'),_0xe1bc('0xa'),_0xe1bc('0xb'),_0xe1bc('0xc'),_0xe1bc('0xd'),_0xe1bc('0xe'),'outboundReCallsDay',_0xe1bc('0xf'),'outboundUnknownCallsDay',_0xe1bc('0x2'),_0xe1bc('0x10'),_0xe1bc('0x4'),'sumBillable',_0xe1bc('0x11'),_0xe1bc('0x12'),'waiting'];function VoiceQueueSummary(_0x44a556){this['id']=_0x44a556['id'];this[_0xe1bc('0x13')]=_0x44a556['name'];this['strategy']=_0x44a556[_0xe1bc('0x14')];this[_0xe1bc('0x15')]=_0x44a556[_0xe1bc('0x15')]||0x0;this['answered']=_0x44a556['answered']||0x0;this[_0xe1bc('0x0')]=_0x44a556[_0xe1bc('0x0')]||0x0;this[_0xe1bc('0x16')]=_0x44a556['busy']||0x0;this[_0xe1bc('0x7')]=_0x44a556[_0xe1bc('0x7')]||0x0;this[_0xe1bc('0x17')]=_0x44a556[_0xe1bc('0x17')]||0x0;this['loggedIn']=_0x44a556[_0xe1bc('0x1')]||0x0;this['loggedInDb']=_0x44a556[_0xe1bc('0x8')]||0x0;this[_0xe1bc('0x18')]=_0x44a556['onHold']||0x0;this[_0xe1bc('0x19')]=_0x44a556[_0xe1bc('0x19')]||0x0;this[_0xe1bc('0x2')]=_0x44a556[_0xe1bc('0x2')]||0x0;this[_0xe1bc('0x3')]=_0x44a556[_0xe1bc('0x3')]||0x0;this['ringInUse']=_0x44a556[_0xe1bc('0x1a')];this['sumBillable']=_0x44a556[_0xe1bc('0x1b')];this[_0xe1bc('0x11')]=_0x44a556[_0xe1bc('0x11')];this[_0xe1bc('0x1c')]=_0x44a556[_0xe1bc('0x1c')]||0x0;this['talking']=_0x44a556[_0xe1bc('0x4')]||0x0;this['total']=_0x44a556['total']||0x0;this[_0xe1bc('0x1d')]=_0x44a556[_0xe1bc('0x1d')];this['unavailable']=_0x44a556['unavailable']||0x0;this[_0xe1bc('0x1e')]=_0x44a556[_0xe1bc('0x1e')]||0x0;this[_0xe1bc('0x1f')]=_0x44a556[_0xe1bc('0x1f')]||0x0;this[_0xe1bc('0x5')]=_0x44a556[_0xe1bc('0x5')]||0x0;if(_0x44a556[_0xe1bc('0x1d')]===_0xe1bc('0x20')){this[_0xe1bc('0x10')]=_0x44a556[_0xe1bc('0x10')]||0x0;this[_0xe1bc('0x21')]=_0x44a556[_0xe1bc('0x21')];this[_0xe1bc('0x22')]=_0x44a556['dialMethod'];this['dialOriginateCallerIdName']=_0x44a556[_0xe1bc('0x23')];this['dialOriginateCallerIdNumber']=_0x44a556[_0xe1bc('0x24')];this['dialOriginateTimeout']=_0x44a556[_0xe1bc('0x25')];this['dialPrefix']=_0x44a556['dialPrefix'];this[_0xe1bc('0x26')]=_0x44a556[_0xe1bc('0x26')];this['outboundAnswerAgiCallsDay']=_0x44a556['outboundAnswerAgiCallsDay'];this[_0xe1bc('0x9')]=_0x44a556[_0xe1bc('0x9')];this[_0xe1bc('0xa')]=_0x44a556[_0xe1bc('0xa')];this[_0xe1bc('0xb')]=_0x44a556[_0xe1bc('0xb')];this[_0xe1bc('0xc')]=_0x44a556[_0xe1bc('0xc')];this[_0xe1bc('0x27')]=_0x44a556['outboundDropCallsDayACS'];this[_0xe1bc('0x28')]=_0x44a556[_0xe1bc('0x28')];this[_0xe1bc('0x29')]=_0x44a556['outboundDropCallsDayTimeout'];this[_0xe1bc('0xd')]=_0x44a556[_0xe1bc('0xd')];this[_0xe1bc('0xe')]=_0x44a556[_0xe1bc('0xe')];this[_0xe1bc('0x2a')]=_0x44a556['outboundOriginateFailureCallsDay'];this[_0xe1bc('0x2b')]=_0x44a556['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x44a556[_0xe1bc('0xf')];this[_0xe1bc('0x2c')]=_0x44a556[_0xe1bc('0x2c')];this['predictiveIntervalAnsweredCalls']=_0x44a556[_0xe1bc('0x2d')];this[_0xe1bc('0x2e')]=_0x44a556['predictiveIntervalAvgHoldtime'];this[_0xe1bc('0x2f')]=_0x44a556[_0xe1bc('0x2f')];this[_0xe1bc('0x30')]=_0x44a556[_0xe1bc('0x30')];this[_0xe1bc('0x31')]=_0x44a556[_0xe1bc('0x31')];this['predictiveIntervalErlangCalls']=_0x44a556[_0xe1bc('0x32')];this[_0xe1bc('0x33')]=_0x44a556['predictiveIntervalErlangCallsDroppedCalls'];this[_0xe1bc('0x34')]=_0x44a556['predictiveIntervalHitRate'];this[_0xe1bc('0x35')]=_0x44a556[_0xe1bc('0x35')];this[_0xe1bc('0x36')]=_0x44a556[_0xe1bc('0x36')];this['predictiveIntervalAvailable']=_0x44a556[_0xe1bc('0x37')];this[_0xe1bc('0x38')]=_0x44a556[_0xe1bc('0x38')];this[_0xe1bc('0x39')]=_0x44a556[_0xe1bc('0x39')];this[_0xe1bc('0x3a')]=_0x44a556[_0xe1bc('0x3a')];this[_0xe1bc('0x3b')]=_0x44a556[_0xe1bc('0x3b')];this[_0xe1bc('0x3c')]=_0x44a556[_0xe1bc('0x3c')];this[_0xe1bc('0x3d')]=_0x44a556[_0xe1bc('0x3d')];this[_0xe1bc('0x3e')]=_0x44a556['startPredictive'];this[_0xe1bc('0x3f')]=_0x44a556[_0xe1bc('0x3f')];this['message']=_0x44a556[_0xe1bc('0x40')];this['statusMessage']=_0x44a556[_0xe1bc('0x41')];}if(_0x44a556[_0xe1bc('0x42')]){this[_0xe1bc('0x42')]={'id':_0x44a556[_0xe1bc('0x42')]['id'],'name':_0x44a556[_0xe1bc('0x42')]['name'],'active':_0x44a556['Trunk'][_0xe1bc('0x43')],'callerid':_0x44a556[_0xe1bc('0x42')][_0xe1bc('0x44')]};}}VoiceQueueSummary[_0xe1bc('0x45')][_0xe1bc('0x46')]=function(_0xbe9e0e,_0x4e1479,_0x16d64c,_0x22bfd7){this[_0xe1bc('0x8')]=0x0;this['talking']=0x0;this[_0xe1bc('0x2')]=0x0;this['unknown']=0x0;this[_0xe1bc('0x19')]=0x0;this[_0xe1bc('0x7')]=0x0;this[_0xe1bc('0x16')]=0x0;this['invalid']=0x0;this[_0xe1bc('0x47')]=0x0;this[_0xe1bc('0x3')]=0x0;this[_0xe1bc('0x1a')]=0x0;this['onHold']=0x0;if(_0x16d64c){if(_0x16d64c[_0xe1bc('0x0')]){this['available']=Number(_0x16d64c['available']);}if(_0x16d64c['loggedin']){this['loggedIn']=Number(_0x16d64c['loggedin']);}if(_0x16d64c['callers']){this[_0xe1bc('0x5')]=Number(_0x16d64c[_0xe1bc('0x48')]);}}for(var _0x594ab5=0x0;_0x594ab5<_0xbe9e0e[_0xe1bc('0x49')];_0x594ab5++){var _0x3a2e0b=_0x4e1479[_0xe1bc('0x4a')+_0xbe9e0e[_0x594ab5]['name']];if(_0x3a2e0b&&_0x3a2e0b[_0xe1bc('0x4b')]){this[_0xe1bc('0x8')]+=0x1;}if(_0xbe9e0e[_0x594ab5][_0xe1bc('0x4c')]==='1'){this[_0xe1bc('0x4')]+=0x1;}if(_0xbe9e0e[_0x594ab5][_0xe1bc('0x2')]==='1'&&!['2','7','8']['includes'](_0xbe9e0e[_0x594ab5][_0xe1bc('0x4d')])){this[_0xe1bc('0x2')]+=0x1;}switch(_0xbe9e0e[_0x594ab5]['status']){case'0':this[_0xe1bc('0x1e')]+=0x1;break;case'1':this[_0xe1bc('0x19')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xe1bc('0x16')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xe1bc('0x47')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xe1bc('0x18')]+=0x1;break;}}if(this[_0xe1bc('0x22')]===_0xe1bc('0x4e')){var _0x1198d6=Object[_0xe1bc('0x4f')](_0x22bfd7);for(var _0x2dccb7=0x0;_0x2dccb7<_0x1198d6['length'];_0x2dccb7++){var _0x324740=_0x1198d6[_0x2dccb7];var _0x33c18e=_0x22bfd7[_0x324740];if(_0x33c18e['queue']===this[_0xe1bc('0x13')]&&_0x33c18e['type']===_0xe1bc('0x50')&&_0x33c18e['exten']===_0xe1bc('0x51')){this[_0xe1bc('0x4')]+=0x1;}}if(this[_0xe1bc('0x4')]>this['inUse']){this[_0xe1bc('0x4')]=this['inUse'];}this[_0xe1bc('0x10')]=0x0;}return this;};VoiceQueueSummary[_0xe1bc('0x45')][_0xe1bc('0x52')]=function(_0x58c3a9){var _0x167dd2=![];if(_0x58c3a9){_0x167dd2=INBOUND_COUNTERS['some'](function(_0x274131){return this[_0x274131]!==_0x58c3a9[_0x274131];},this);}return _0x167dd2;};VoiceQueueSummary[_0xe1bc('0x45')]['compareToOutboundQueue']=function(_0xca01ae){var _0x51d349=![];var _0x210b66=![];var _0x1c3b9c=![];if(_0xca01ae){_0x51d349=this['dialMethod']!==_0xca01ae[_0xe1bc('0x22')]||this[_0xe1bc('0x21')]!==_0xca01ae[_0xe1bc('0x21')]||this[_0xe1bc('0x40')]!==_0xca01ae[_0xe1bc('0x40')]||this[_0xe1bc('0x41')]!==_0xca01ae[_0xe1bc('0x41')];_0x210b66=OUTBOUND_COUNTERS[_0xe1bc('0x53')](function(_0x3edfb0){return this[_0x3edfb0]!==_0xca01ae[_0x3edfb0];},this);if(this['Trunk']&&_0xca01ae['Trunk']){_0x1c3b9c=this[_0xe1bc('0x42')][_0xe1bc('0x13')]!==_0xca01ae[_0xe1bc('0x42')][_0xe1bc('0x13')]||this[_0xe1bc('0x42')][_0xe1bc('0x43')]!==_0xca01ae['Trunk'][_0xe1bc('0x43')];}}return _0x51d349||_0x210b66||_0x1c3b9c;};VoiceQueueSummary[_0xe1bc('0x45')][_0xe1bc('0x54')]=function(_0x104d5f){this['answered']=_0x104d5f[_0xe1bc('0x6')];this[_0xe1bc('0x40')]=_0x104d5f[_0xe1bc('0x40')];this[_0xe1bc('0x41')]=_0x104d5f['statusMessage'];this[_0xe1bc('0x39')]=_0x104d5f['originated'];this[_0xe1bc('0x55')]=_0x104d5f['outboundAbandonedCallsDay'];this[_0xe1bc('0x9')]=_0x104d5f[_0xe1bc('0x9')];this[_0xe1bc('0xa')]=_0x104d5f[_0xe1bc('0xa')];this[_0xe1bc('0xb')]=_0x104d5f['outboundBusyCallsDay'];this[_0xe1bc('0xc')]=_0x104d5f['outboundCongestionCallsDay'];this[_0xe1bc('0xd')]=_0x104d5f[_0xe1bc('0xd')];this[_0xe1bc('0xe')]=_0x104d5f[_0xe1bc('0xe')];this[_0xe1bc('0x2b')]=_0x104d5f[_0xe1bc('0x2b')];this[_0xe1bc('0xf')]=_0x104d5f[_0xe1bc('0xf')];this[_0xe1bc('0x2c')]=_0x104d5f[_0xe1bc('0x2c')];this[_0xe1bc('0x1b')]=_0x104d5f['sumBillable'];this[_0xe1bc('0x11')]=_0x104d5f['sumDuration'];this[_0xe1bc('0x12')]=_0x104d5f[_0xe1bc('0x12')];if(this[_0xe1bc('0x22')]===_0xe1bc('0x56')){this[_0xe1bc('0x10')]=_0x104d5f['pTalking'];}};module[_0xe1bc('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0x029b=['status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','preview','exports','available','loggedIn','paused','ringing','waiting','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','talking','sumDuration','total','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','notInUse','loggedin','callers','length','SIP/','includes'];(function(_0x3b541e,_0x14a851){var _0x1b54ae=function(_0x408dd9){while(--_0x408dd9){_0x3b541e['push'](_0x3b541e['shift']());}};_0x1b54ae(++_0x14a851);}(_0x029b,0x66));var _0xb029=function(_0x3b9143,_0x527f5b){_0x3b9143=_0x3b9143-0x0;var _0x2189a8=_0x029b[_0x3b9143];return _0x2189a8;};'use strict';var INBOUND_COUNTERS=[_0xb029('0x0'),_0xb029('0x1'),'loggedInDb',_0xb029('0x2'),_0xb029('0x3'),'talking',_0xb029('0x4')];var OUTBOUND_COUNTERS=[_0xb029('0x0'),'answered','inUse',_0xb029('0x1'),_0xb029('0x5'),_0xb029('0x6'),_0xb029('0x7'),_0xb029('0x8'),'outboundBlacklistCallsDay',_0xb029('0x9'),'outboundCongestionCallsDay',_0xb029('0xa'),'outboundNoSuchCallsDay',_0xb029('0xb'),'outboundRejectCallsDay',_0xb029('0xc'),'paused',_0xb029('0xd'),_0xb029('0xe'),'sumBillable',_0xb029('0xf'),_0xb029('0x10'),_0xb029('0x4')];function VoiceQueueSummary(_0x3abf90){this['id']=_0x3abf90['id'];this[_0xb029('0x11')]=_0x3abf90['name'];this[_0xb029('0x12')]=_0x3abf90['strategy'];this[_0xb029('0x13')]=_0x3abf90[_0xb029('0x13')]||0x0;this[_0xb029('0x14')]=_0x3abf90[_0xb029('0x14')]||0x0;this['available']=_0x3abf90[_0xb029('0x0')]||0x0;this[_0xb029('0x15')]=_0x3abf90[_0xb029('0x15')]||0x0;this['inUse']=_0x3abf90[_0xb029('0x16')]||0x0;this[_0xb029('0x17')]=_0x3abf90[_0xb029('0x17')]||0x0;this[_0xb029('0x1')]=_0x3abf90[_0xb029('0x1')]||0x0;this[_0xb029('0x5')]=_0x3abf90[_0xb029('0x5')]||0x0;this[_0xb029('0x18')]=_0x3abf90[_0xb029('0x18')]||0x0;this['notInUse']=_0x3abf90['notInUse']||0x0;this[_0xb029('0x2')]=_0x3abf90['paused']||0x0;this[_0xb029('0x3')]=_0x3abf90[_0xb029('0x3')]||0x0;this[_0xb029('0x19')]=_0x3abf90['ringInUse'];this['sumBillable']=_0x3abf90[_0xb029('0x1a')];this[_0xb029('0xf')]=_0x3abf90[_0xb029('0xf')];this[_0xb029('0x1b')]=_0x3abf90[_0xb029('0x1b')]||0x0;this[_0xb029('0xe')]=_0x3abf90['talking']||0x0;this['total']=_0x3abf90['total']||0x0;this['type']=_0x3abf90[_0xb029('0x1c')];this[_0xb029('0x1d')]=_0x3abf90[_0xb029('0x1d')]||0x0;this[_0xb029('0x1e')]=_0x3abf90['unknown']||0x0;this[_0xb029('0x1f')]=_0x3abf90[_0xb029('0x1f')]||0x0;this[_0xb029('0x4')]=_0x3abf90[_0xb029('0x4')]||0x0;if(_0x3abf90[_0xb029('0x1c')]===_0xb029('0x20')){this[_0xb029('0xd')]=_0x3abf90[_0xb029('0xd')]||0x0;this[_0xb029('0x21')]=_0x3abf90[_0xb029('0x21')];this[_0xb029('0x22')]=_0x3abf90[_0xb029('0x22')];this[_0xb029('0x23')]=_0x3abf90['dialOriginateCallerIdName'];this[_0xb029('0x24')]=_0x3abf90[_0xb029('0x24')];this['dialOriginateTimeout']=_0x3abf90['dialOriginateTimeout'];this[_0xb029('0x25')]=_0x3abf90[_0xb029('0x25')];this[_0xb029('0x26')]=_0x3abf90[_0xb029('0x26')];this[_0xb029('0x27')]=_0x3abf90['outboundAnswerAgiCallsDay'];this[_0xb029('0x8')]=_0x3abf90['outboundAnswerCallsDay'];this[_0xb029('0x28')]=_0x3abf90[_0xb029('0x28')];this[_0xb029('0x9')]=_0x3abf90['outboundBusyCallsDay'];this[_0xb029('0x29')]=_0x3abf90[_0xb029('0x29')];this['outboundDropCallsDayACS']=_0x3abf90[_0xb029('0x2a')];this['outboundDropCallsDayCallersExit']=_0x3abf90[_0xb029('0x2b')];this['outboundDropCallsDayTimeout']=_0x3abf90[_0xb029('0x2c')];this[_0xb029('0xa')]=_0x3abf90[_0xb029('0xa')];this[_0xb029('0x2d')]=_0x3abf90[_0xb029('0x2d')];this[_0xb029('0x2e')]=_0x3abf90[_0xb029('0x2e')];this[_0xb029('0xb')]=_0x3abf90['outboundReCallsDay'];this[_0xb029('0x2f')]=_0x3abf90[_0xb029('0x2f')];this[_0xb029('0xc')]=_0x3abf90['outboundUnknownCallsDay'];this[_0xb029('0x30')]=_0x3abf90[_0xb029('0x30')];this['predictiveIntervalAvgHoldtime']=_0x3abf90[_0xb029('0x31')];this['predictiveIntervalAvgTalktime']=_0x3abf90[_0xb029('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x3abf90[_0xb029('0x33')];this[_0xb029('0x34')]=_0x3abf90[_0xb029('0x34')];this[_0xb029('0x35')]=_0x3abf90[_0xb029('0x35')];this[_0xb029('0x36')]=_0x3abf90[_0xb029('0x36')];this['predictiveIntervalHitRate']=_0x3abf90[_0xb029('0x37')];this[_0xb029('0x38')]=_0x3abf90['predictiveIntervalMultiplicativeFactor'];this[_0xb029('0x39')]=_0x3abf90[_0xb029('0x39')];this[_0xb029('0x3a')]=_0x3abf90[_0xb029('0x3a')];this['predictiveIntervalTotalCalls']=_0x3abf90[_0xb029('0x3b')];this[_0xb029('0x6')]=_0x3abf90[_0xb029('0x6')];this['erlangCalls']=_0x3abf90[_0xb029('0x3c')];this[_0xb029('0x3d')]=_0x3abf90[_0xb029('0x3d')];this[_0xb029('0x3e')]=_0x3abf90[_0xb029('0x3e')];this[_0xb029('0x3f')]=_0x3abf90[_0xb029('0x3f')];this[_0xb029('0x40')]=_0x3abf90[_0xb029('0x40')];this[_0xb029('0x41')]=_0x3abf90['startProgressive'];this[_0xb029('0x42')]=_0x3abf90[_0xb029('0x42')];this[_0xb029('0x43')]=_0x3abf90['statusMessage'];}if(_0x3abf90['Trunk']){this['Trunk']={'id':_0x3abf90[_0xb029('0x44')]['id'],'name':_0x3abf90[_0xb029('0x44')]['name'],'active':_0x3abf90[_0xb029('0x44')][_0xb029('0x45')],'callerid':_0x3abf90[_0xb029('0x44')][_0xb029('0x46')]};}}VoiceQueueSummary[_0xb029('0x47')]['createReport']=function(_0x2f5599,_0x935a15,_0x584b8a,_0x2edce2){this[_0xb029('0x5')]=0x0;this[_0xb029('0xe')]=0x0;this['paused']=0x0;this[_0xb029('0x1e')]=0x0;this[_0xb029('0x48')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0xb029('0x17')]=0x0;this[_0xb029('0x1d')]=0x0;this[_0xb029('0x3')]=0x0;this[_0xb029('0x19')]=0x0;this['onHold']=0x0;if(_0x584b8a){if(_0x584b8a['available']){this[_0xb029('0x0')]=Number(_0x584b8a['available']);}if(_0x584b8a[_0xb029('0x49')]){this['loggedIn']=Number(_0x584b8a[_0xb029('0x49')]);}if(_0x584b8a[_0xb029('0x4a')]){this[_0xb029('0x4')]=Number(_0x584b8a[_0xb029('0x4a')]);}}for(var _0x45a7d5=0x0;_0x45a7d5<_0x2f5599[_0xb029('0x4b')];_0x45a7d5++){var _0x5f294b=_0x935a15[_0xb029('0x4c')+_0x2f5599[_0x45a7d5]['name']];if(_0x5f294b&&_0x5f294b['online']){this[_0xb029('0x5')]+=0x1;}if(_0x2f5599[_0x45a7d5]['incall']==='1'){this[_0xb029('0xe')]+=0x1;}if(_0x2f5599[_0x45a7d5]['paused']==='1'&&!['2','7','8'][_0xb029('0x4d')](_0x2f5599[_0x45a7d5][_0xb029('0x4e')])){this[_0xb029('0x2')]+=0x1;}switch(_0x2f5599[_0x45a7d5][_0xb029('0x4e')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xb029('0x48')]+=0x1;break;case'2':this[_0xb029('0x16')]+=0x1;break;case'3':this[_0xb029('0x15')]+=0x1;break;case'4':this[_0xb029('0x17')]+=0x1;break;case'5':this[_0xb029('0x1d')]+=0x1;break;case'6':this[_0xb029('0x3')]+=0x1;break;case'7':this[_0xb029('0x19')]+=0x1;break;case'8':this[_0xb029('0x18')]+=0x1;break;}}if(this[_0xb029('0x22')]===_0xb029('0x4f')){var _0x593dd9=Object[_0xb029('0x50')](_0x2edce2);for(var _0x2345cd=0x0;_0x2345cd<_0x593dd9[_0xb029('0x4b')];_0x2345cd++){var _0x3172a2=_0x593dd9[_0x2345cd];var _0x4845ab=_0x2edce2[_0x3172a2];if(_0x4845ab[_0xb029('0x51')]===this['name']&&_0x4845ab[_0xb029('0x1c')]===_0xb029('0x52')&&_0x4845ab[_0xb029('0x53')]===_0xb029('0x54')){this[_0xb029('0xe')]+=0x1;}}if(this['talking']>this['inUse']){this[_0xb029('0xe')]=this[_0xb029('0x16')];}this[_0xb029('0xd')]=0x0;}return this;};VoiceQueueSummary[_0xb029('0x47')][_0xb029('0x55')]=function(_0x32cceb){var _0x505538=![];if(_0x32cceb){_0x505538=INBOUND_COUNTERS[_0xb029('0x56')](function(_0x1b584d){return this[_0x1b584d]!==_0x32cceb[_0x1b584d];},this);}return _0x505538;};VoiceQueueSummary[_0xb029('0x47')]['compareToOutboundQueue']=function(_0x5a0178){var _0x10b4f7=![];var _0x538722=![];var _0x36ee76=![];if(_0x5a0178){_0x10b4f7=this[_0xb029('0x22')]!==_0x5a0178[_0xb029('0x22')]||this['dialActive']!==_0x5a0178[_0xb029('0x21')]||this[_0xb029('0x42')]!==_0x5a0178['message']||this[_0xb029('0x43')]!==_0x5a0178[_0xb029('0x43')];_0x538722=OUTBOUND_COUNTERS[_0xb029('0x56')](function(_0x50fa99){return this[_0x50fa99]!==_0x5a0178[_0x50fa99];},this);if(this[_0xb029('0x44')]&&_0x5a0178[_0xb029('0x44')]){_0x36ee76=this[_0xb029('0x44')][_0xb029('0x11')]!==_0x5a0178['Trunk'][_0xb029('0x11')]||this[_0xb029('0x44')][_0xb029('0x45')]!==_0x5a0178['Trunk'][_0xb029('0x45')];}}return _0x10b4f7||_0x538722||_0x36ee76;};VoiceQueueSummary['prototype'][_0xb029('0x57')]=function(_0x391d1a){this[_0xb029('0x14')]=_0x391d1a[_0xb029('0x14')];this[_0xb029('0x42')]=_0x391d1a[_0xb029('0x42')];this[_0xb029('0x43')]=_0x391d1a['statusMessage'];this['originated']=_0x391d1a['originated'];this[_0xb029('0x7')]=_0x391d1a[_0xb029('0x7')];this[_0xb029('0x8')]=_0x391d1a[_0xb029('0x8')];this[_0xb029('0x28')]=_0x391d1a['outboundBlacklistCallsDay'];this[_0xb029('0x9')]=_0x391d1a[_0xb029('0x9')];this[_0xb029('0x29')]=_0x391d1a[_0xb029('0x29')];this['outboundNoAnswerCallsDay']=_0x391d1a[_0xb029('0xa')];this[_0xb029('0x2d')]=_0x391d1a[_0xb029('0x2d')];this[_0xb029('0xb')]=_0x391d1a[_0xb029('0xb')];this[_0xb029('0x2f')]=_0x391d1a[_0xb029('0x2f')];this[_0xb029('0xc')]=_0x391d1a['outboundUnknownCallsDay'];this[_0xb029('0x1a')]=_0x391d1a[_0xb029('0x1a')];this['sumDuration']=_0x391d1a[_0xb029('0xf')];this[_0xb029('0x10')]=_0x391d1a[_0xb029('0x10')];if(this[_0xb029('0x22')]===_0xb029('0x58')){this[_0xb029('0xd')]=_0x391d1a[_0xb029('0xd')];}};module[_0xb029('0x59')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 46f9eae..5a52d26 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 _0x2709=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2709,0x7c));var _0x9270=function(_0x176182,_0x1ea0f9){_0x176182=_0x176182-0x0;var _0x3ca33a=_0x2709[_0x176182];return _0x3ca33a;};'use strict';function VtigerAccount(_0x3a16eb){this['id']=_0x3a16eb['id']||0x0;this[_0x9270('0x0')]=_0x3a16eb[_0x9270('0x0')]||'';this[_0x9270('0x1')]=_0x3a16eb['username']||'';this[_0x9270('0x2')]=_0x3a16eb[_0x9270('0x2')]||'';this[_0x9270('0x3')]=_0x3a16eb[_0x9270('0x3')]||'';this['serverUrl']=_0x3a16eb[_0x9270('0x4')]||'';this[_0x9270('0x5')]=_0x3a16eb['Configurations']||{};}module[_0x9270('0x6')]=VtigerAccount; \ No newline at end of file +var _0x0dee=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x5f2913,_0x208c1f){var _0x5f0071=function(_0x4a8103){while(--_0x4a8103){_0x5f2913['push'](_0x5f2913['shift']());}};_0x5f0071(++_0x208c1f);}(_0x0dee,0xf7));var _0xe0de=function(_0x2d219d,_0x12e626){_0x2d219d=_0x2d219d-0x0;var _0x3a6f07=_0x0dee[_0x2d219d];return _0x3a6f07;};'use strict';function VtigerAccount(_0x2d297c){this['id']=_0x2d297c['id']||0x0;this[_0xe0de('0x0')]=_0x2d297c['name']||'';this[_0xe0de('0x1')]=_0x2d297c['username']||'';this[_0xe0de('0x2')]=_0x2d297c[_0xe0de('0x2')]||'';this['remoteUri']=_0x2d297c[_0xe0de('0x3')]||'';this[_0xe0de('0x4')]=_0x2d297c[_0xe0de('0x4')]||'';this['Configurations']=_0x2d297c[_0xe0de('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 c515068..196cdcc 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 _0xb760=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x2d1bb6,_0x143353){var _0x163b98=function(_0x8a31df){while(--_0x8a31df){_0x2d1bb6['push'](_0x2d1bb6['shift']());}};_0x163b98(++_0x143353);}(_0xb760,0xd9));var _0x0b76=function(_0x159aac,_0x29ed63){_0x159aac=_0x159aac-0x0;var _0x3a8b01=_0xb760[_0x159aac];return _0x3a8b01;};'use strict';function ZendeskAccount(_0x172994){this['id']=_0x172994['id']||0x0;this[_0x0b76('0x0')]=_0x172994['name']||'';this[_0x0b76('0x1')]=_0x172994[_0x0b76('0x1')]||'';this[_0x0b76('0x2')]=_0x172994['password']||'';this[_0x0b76('0x3')]=_0x172994[_0x0b76('0x3')]||'';this[_0x0b76('0x4')]=_0x172994['remoteUri']||'';this['authType']=_0x172994[_0x0b76('0x5')]||'';this[_0x0b76('0x6')]=_0x172994['type']||_0x0b76('0x7');this[_0x0b76('0x8')]=_0x172994[_0x0b76('0x8')]||'';this[_0x0b76('0x9')]=_0x172994[_0x0b76('0x9')]||{};}module[_0x0b76('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xfeae=['password','remoteUri','authType','type','serverUrl','Configurations','name','username'];(function(_0x2e5d2f,_0x5c6b91){var _0x2d20c0=function(_0x4ca478){while(--_0x4ca478){_0x2e5d2f['push'](_0x2e5d2f['shift']());}};_0x2d20c0(++_0x5c6b91);}(_0xfeae,0x11e));var _0xefea=function(_0x3808dc,_0x40ac14){_0x3808dc=_0x3808dc-0x0;var _0x51ef36=_0xfeae[_0x3808dc];return _0x51ef36;};'use strict';function ZendeskAccount(_0x932be5){this['id']=_0x932be5['id']||0x0;this['name']=_0x932be5[_0xefea('0x0')]||'';this[_0xefea('0x1')]=_0x932be5['username']||'';this['password']=_0x932be5[_0xefea('0x2')]||'';this['token']=_0x932be5['token']||'';this[_0xefea('0x3')]=_0x932be5[_0xefea('0x3')]||'';this['authType']=_0x932be5[_0xefea('0x4')]||'';this[_0xefea('0x5')]=_0x932be5[_0xefea('0x5')]||'integrationTab';this[_0xefea('0x6')]=_0x932be5[_0xefea('0x6')]||'';this[_0xefea('0x7')]=_0x932be5[_0xefea('0x7')]||{};}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 855a154..3b45788 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 _0xed63=['serverUrl','code','refreshToken','Configurations','exports','name','description','clientId','clientSecret'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xed63,0xf8));var _0x3ed6=function(_0xa9ca64,_0x5c2421){_0xa9ca64=_0xa9ca64-0x0;var _0x3b798b=_0xed63[_0xa9ca64];return _0x3b798b;};'use strict';function ZohoAccount(_0x3ffce9){this['id']=_0x3ffce9['id']||0x0;this[_0x3ed6('0x0')]=_0x3ffce9[_0x3ed6('0x0')]||'';this[_0x3ed6('0x1')]=_0x3ffce9[_0x3ed6('0x1')]||'';this['host']=_0x3ffce9['host']||'';this['zone']=_0x3ffce9['zone']||'';this['clientId']=_0x3ffce9[_0x3ed6('0x2')]||'';this['clientSecret']=_0x3ffce9[_0x3ed6('0x3')]||'';this[_0x3ed6('0x4')]=_0x3ffce9[_0x3ed6('0x4')]||'';this[_0x3ed6('0x5')]=_0x3ffce9[_0x3ed6('0x5')]||'';this['refreshToken']=_0x3ffce9[_0x3ed6('0x6')]||'';this[_0x3ed6('0x7')]=_0x3ffce9[_0x3ed6('0x7')]||{};}module[_0x3ed6('0x8')]=ZohoAccount; \ No newline at end of file +var _0xd66e=['clientId','serverUrl','code','refreshToken','Configurations','exports','name','host','zone'];(function(_0x313bac,_0xd06cca){var _0x225fa7=function(_0x536ca8){while(--_0x536ca8){_0x313bac['push'](_0x313bac['shift']());}};_0x225fa7(++_0xd06cca);}(_0xd66e,0x192));var _0xed66=function(_0x3a1953,_0x440442){_0x3a1953=_0x3a1953-0x0;var _0x51c757=_0xd66e[_0x3a1953];return _0x51c757;};'use strict';function ZohoAccount(_0x5aa6ef){this['id']=_0x5aa6ef['id']||0x0;this[_0xed66('0x0')]=_0x5aa6ef[_0xed66('0x0')]||'';this['description']=_0x5aa6ef['description']||'';this[_0xed66('0x1')]=_0x5aa6ef[_0xed66('0x1')]||'';this[_0xed66('0x2')]=_0x5aa6ef['zone']||'';this[_0xed66('0x3')]=_0x5aa6ef[_0xed66('0x3')]||'';this['clientSecret']=_0x5aa6ef['clientSecret']||'';this['serverUrl']=_0x5aa6ef[_0xed66('0x4')]||'';this[_0xed66('0x5')]=_0x5aa6ef['code']||'';this[_0xed66('0x6')]=_0x5aa6ef[_0xed66('0x6')]||'';this[_0xed66('0x7')]=_0x5aa6ef[_0xed66('0x7')]||{};}module[_0xed66('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 2b4b79b..38e2143 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 _0x4991=['ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','SIP/%s','calleridname','Contact','phone','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x5327c1,_0x207fe9){var _0x1a8bf9=function(_0x319cac){while(--_0x319cac){_0x5327c1['push'](_0x5327c1['shift']());}};_0x1a8bf9(++_0x207fe9);}(_0x4991,0xf7));var _0x1499=function(_0xe2de87,_0x5cf8b0){_0xe2de87=_0xe2de87-0x0;var _0x710203=_0x4991[_0xe2de87];return _0x710203;};'use strict';var util=require(_0x1499('0x0'));var _=require('lodash');var moment=require(_0x1499('0x1'));function checkNameSurname(_0x5bd577,_0x30d640,_0x256e41){var _0x16ac22='';if(!_[_0x1499('0x2')](_0x30d640)&&_0x1499('0x3')===typeof _0x30d640){_0x16ac22+=_0x30d640;}if(!_[_0x1499('0x2')](_0x256e41)&&_0x1499('0x3')===typeof _0x256e41){_0x16ac22+='\x20'+_0x256e41;}if(_0x16ac22!==''){return _0x16ac22;}return _0x5bd577;}function Action(_0x209616,_0x4b6154,_0x2a8e96,_0x1c3bd7,_0x1c65c3){this[_0x1499('0x4')]=_0x2a8e96||undefined;this[_0x1499('0x5')]=_0x209616['id'];this[_0x1499('0x6')]=_0x4b6154[_0x1499('0x7')];this[_0x1499('0x8')]=_0x4b6154['type'];this[_0x1499('0x9')]=_0x1499('0x6');this['dialAnswer']=![];this[_0x1499('0xa')]=_[_0x1499('0x2')](_0x209616['Agent'])?undefined:_0x209616[_0x1499('0xb')][_0x1499('0x7')];this['channelAgent']=this['membername']?util['format'](_0x1499('0xc'),this[_0x1499('0xa')]):_0x1c3bd7||undefined;this[_0x1499('0xd')]=checkNameSurname(_0x209616[_0x1499('0xe')][_0x1499('0xf')],_0x209616['Contact']['firstName'],_0x209616[_0x1499('0xe')]['lastName']);this[_0x1499('0x10')]=_0x209616[_0x1499('0x10')]||![];this[_0x1499('0x11')]=_0x209616[_0x1499('0xf')];this['scheduledat']=_0x209616[_0x1499('0x12')];this[_0x1499('0x13')]=_0x209616['countbusyretry']||0x0;this[_0x1499('0x14')]=_0x209616[_0x1499('0x14')]||0x0;this[_0x1499('0x15')]=_0x209616[_0x1499('0x15')]||0x0;this[_0x1499('0x16')]=(_0x209616[_0x1499('0x13')]||0x0)+(_0x209616['countcongestionretry']||0x0)+(_0x209616['countnoanswerretry']||0x0)+(_0x209616['countnosuchnumberretry']||0x0)+(_0x209616[_0x1499('0x17')]||0x0)+(_0x209616[_0x1499('0x18')]||0x0)+(_0x209616['countmachineretry']||0x0)+(_0x209616[_0x1499('0x19')]||0x0);this[_0x1499('0x1a')]=_0x209616[_0x1499('0x1a')]||0x0;this[_0x1499('0x17')]=_0x209616[_0x1499('0x17')]||0x0;this[_0x1499('0x18')]=_0x209616[_0x1499('0x18')]||0x0;this[_0x1499('0x1b')]=_0x209616[_0x1499('0x1b')]||0x0;this[_0x1499('0x19')]=_0x209616[_0x1499('0x19')]||0x0;this[_0x1499('0x1c')]=_0x209616[_0x1499('0x1c')];this[_0x1499('0x1d')]=_0x209616[_0x1499('0x1d')];this[_0x1499('0x1e')]=_0x209616[_0x1499('0x1e')];this['recallme']=_0x209616[_0x1499('0x1f')];this[_0x1499('0x20')]=_0x209616[_0x1499('0x20')];this[_0x1499('0x21')]=_0x209616[_0x1499('0x21')];this[_0x1499('0x22')]=_['isNil'](_0x209616['Agent'])?_0x209616[_0x1499('0x22')]:_0x209616[_0x1499('0xb')]['id'];this[_0x1499('0x23')]=_0x209616[_0x1499('0x23')];this[_0x1499('0x24')]='';this['originatecalleridname']='';}Action[_0x1499('0x25')]['getCaller']=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x1499('0xd')],this[_0x1499('0x26')]);};module[_0x1499('0x27')]=Action; \ No newline at end of file +var _0xb016=['countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','idContact','type','campaigntype','queue','dialAnswer','Agent','name','membername','Contact','phone','firstName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xb016,0x159));var _0x6b01=function(_0x44d27c,_0x2dca6b){_0x44d27c=_0x44d27c-0x0;var _0x109d45=_0xb016[_0x44d27c];return _0x109d45;};'use strict';var util=require(_0x6b01('0x0'));var _=require(_0x6b01('0x1'));var moment=require('moment');function checkNameSurname(_0x57ecae,_0xf74fa1,_0x531b6a){var _0x160a7d='';if(!_[_0x6b01('0x2')](_0xf74fa1)&&_0x6b01('0x3')===typeof _0xf74fa1){_0x160a7d+=_0xf74fa1;}if(!_[_0x6b01('0x2')](_0x531b6a)&&'string'===typeof _0x531b6a){_0x160a7d+='\x20'+_0x531b6a;}if(_0x160a7d!==''){return _0x160a7d;}return _0x57ecae;}function Action(_0x1b7dd6,_0x65407a,_0x192b2d,_0x5759a1,_0x5c5bfb){this[_0x6b01('0x4')]=_0x192b2d||undefined;this[_0x6b01('0x5')]=_0x1b7dd6['id'];this['queue']=_0x65407a['name'];this[_0x6b01('0x6')]=_0x65407a[_0x6b01('0x6')];this[_0x6b01('0x7')]=_0x6b01('0x8');this[_0x6b01('0x9')]=![];this['membername']=_['isNil'](_0x1b7dd6[_0x6b01('0xa')])?undefined:_0x1b7dd6[_0x6b01('0xa')][_0x6b01('0xb')];this['channelAgent']=this[_0x6b01('0xc')]?util['format']('SIP/%s',this[_0x6b01('0xc')]):_0x5759a1||undefined;this['calleridname']=checkNameSurname(_0x1b7dd6[_0x6b01('0xd')][_0x6b01('0xe')],_0x1b7dd6['Contact'][_0x6b01('0xf')],_0x1b7dd6['Contact']['lastName']);this['active']=_0x1b7dd6[_0x6b01('0x10')]||![];this['calleridnum']=_0x1b7dd6['phone'];this[_0x6b01('0x11')]=_0x1b7dd6[_0x6b01('0x11')];this[_0x6b01('0x12')]=_0x1b7dd6[_0x6b01('0x12')]||0x0;this[_0x6b01('0x13')]=_0x1b7dd6[_0x6b01('0x13')]||0x0;this[_0x6b01('0x14')]=_0x1b7dd6[_0x6b01('0x14')]||0x0;this[_0x6b01('0x15')]=(_0x1b7dd6[_0x6b01('0x12')]||0x0)+(_0x1b7dd6[_0x6b01('0x13')]||0x0)+(_0x1b7dd6['countnoanswerretry']||0x0)+(_0x1b7dd6[_0x6b01('0x16')]||0x0)+(_0x1b7dd6[_0x6b01('0x17')]||0x0)+(_0x1b7dd6[_0x6b01('0x18')]||0x0)+(_0x1b7dd6[_0x6b01('0x19')]||0x0)+(_0x1b7dd6[_0x6b01('0x1a')]||0x0);this[_0x6b01('0x16')]=_0x1b7dd6[_0x6b01('0x16')]||0x0;this[_0x6b01('0x17')]=_0x1b7dd6['countdropretry']||0x0;this[_0x6b01('0x18')]=_0x1b7dd6[_0x6b01('0x18')]||0x0;this[_0x6b01('0x19')]=_0x1b7dd6[_0x6b01('0x19')]||0x0;this[_0x6b01('0x1a')]=_0x1b7dd6[_0x6b01('0x1a')]||0x0;this[_0x6b01('0x1b')]=_0x1b7dd6['callback'];this[_0x6b01('0x1c')]=_0x1b7dd6[_0x6b01('0x1c')];this[_0x6b01('0x1d')]=_0x1b7dd6['callbackat'];this[_0x6b01('0x1e')]=_0x1b7dd6[_0x6b01('0x1e')];this[_0x6b01('0x1f')]=_0x1b7dd6[_0x6b01('0x1f')];this[_0x6b01('0x20')]=_0x1b7dd6[_0x6b01('0x20')];this[_0x6b01('0x21')]=_[_0x6b01('0x2')](_0x1b7dd6[_0x6b01('0xa')])?_0x1b7dd6[_0x6b01('0x21')]:_0x1b7dd6[_0x6b01('0xa')]['id'];this[_0x6b01('0x22')]=_0x1b7dd6[_0x6b01('0x22')];this['originatecalleridnum']='';this[_0x6b01('0x23')]='';}Action[_0x6b01('0x24')][_0x6b01('0x25')]=function(){return util[_0x6b01('0x26')](_0x6b01('0x27'),this['calleridname'],this['number']);};module[_0x6b01('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index ab784ac..180778c 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 _0x9cee=['answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','createAgentHistory','logAgent','NoAnswer','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','Contact','phone','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','disableContact','getContactPreview','recallme','isValid','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','starttime','[syncHangup][talking]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','unlockContact','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','syncVarSet','filterKey','keys','variable','addVariable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','sendMessageOneNotActive','originated','pTalking','available','message','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','prototype','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','pick','contactId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','dialActive','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime'];(function(_0x50de1a,_0x33ae09){var _0x4bada5=function(_0x3cdf0e){while(--_0x3cdf0e){_0x50de1a['push'](_0x50de1a['shift']());}};_0x4bada5(++_0x33ae09);}(_0x9cee,0x1f0));var _0xe9ce=function(_0x122a28,_0x42eab3){_0x122a28=_0x122a28-0x0;var _0x3710a6=_0x9cee[_0x122a28];return _0x3710a6;};'use strict';var util=require(_0xe9ce('0x0'));var _=require(_0xe9ce('0x1'));var uuid=require(_0xe9ce('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0xe9ce('0x3'));var logger=require('../../../config/logger')(_0xe9ce('0x4'));var loggerAction=require(_0xe9ce('0x5'))(_0xe9ce('0x6'));var ami=require(_0xe9ce('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xe9ce('0x8'));var Action=require(_0xe9ce('0x9'));var ut=require(_0xe9ce('0xa'));var utils=require(_0xe9ce('0xb'));config[_0xe9ce('0xc')]=_['defaults'](config[_0xe9ce('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xe9ce('0xd'))(new Redis(config[_0xe9ce('0xc')]));var Sequence=function(){};Sequence['prototype'][_0xe9ce('0xe')]=function(_0x2693dc){this['tail']=this['tail']?this[_0xe9ce('0xf')][_0xe9ce('0x10')](_0x2693dc):_0x2693dc();};function Preview(_0x9b486a){this[_0xe9ce('0x11')]=new Sequence();this[_0xe9ce('0x12')]=_0x9b486a['voiceQueues'];this[_0xe9ce('0x13')]=_0x9b486a[_0xe9ce('0x13')];this['actions']={};this['agents']=_0x9b486a[_0xe9ce('0x14')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xe9ce('0x15')](this));ami['on']('hangup',this[_0xe9ce('0x16')][_0xe9ce('0x15')](this));ami['on'](_0xe9ce('0x17'),this['syncHangupRequest']['bind'](this));ami['on'](_0xe9ce('0x18'),this[_0xe9ce('0x19')][_0xe9ce('0x15')](this));ami['on'](_0xe9ce('0x1a'),this[_0xe9ce('0x1b')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0xe9ce('0x15')](this));ami['on'](_0xe9ce('0x1c'),this[_0xe9ce('0x1d')][_0xe9ce('0x15')](this));ami['on'](_0xe9ce('0x1e'),this['syncBlindTransfer']['bind'](this));this[_0xe9ce('0x1f')](this[_0xe9ce('0x12')]);}function emit(_0x4937b0,_0x340d60,_0x3a3865){io['to'](_0x4937b0)['emit'](_0x340d60,_0x3a3865);}function emitVoiceQueueChannelRemove(_0x203ee2){logger[_0xe9ce('0x20')](_0xe9ce('0x21'),JSON[_0xe9ce('0x22')](_0x203ee2));emit(util[_0xe9ce('0x23')](_0xe9ce('0x24'),_0x203ee2[_0xe9ce('0x25')]),'voice_queue_channel:remove',_0x203ee2);io['emit']('voice_queue_presence:remove',_0x203ee2);}function notSendMessagesQueue(_0x3b6812){if(_0x3b6812[_0xe9ce('0x26')]){if(_0x3b6812[_0xe9ce('0x27')]===0x0&&_0x3b6812[_0xe9ce('0x28')]===0x0){_0x3b6812[_0xe9ce('0x26')]=![];_0x3b6812[_0xe9ce('0x29')]=0x0;_0x3b6812['paused']=0x0;_0x3b6812[_0xe9ce('0x2a')]=utils[_0xe9ce('0x2b')]['INACTIVE'];ut[_0xe9ce('0x2c')](_0xe9ce('0x2d'),_0x3b6812[_0xe9ce('0x25')]+_0xe9ce('0x2e'));}else{_0x3b6812['message']=utils[_0xe9ce('0x2b')]['DEACTIVATED'];ut[_0xe9ce('0x2c')](_0xe9ce('0x2d'),_0x3b6812[_0xe9ce('0x25')]+_0xe9ce('0x2f'));}}}Preview[_0xe9ce('0x30')][_0xe9ce('0x1f')]=function(){var _0xbea253=this;setInterval(function(){_0xbea253['syncCampaigns']();},0x7cf);};Preview[_0xe9ce('0x30')][_0xe9ce('0x31')]=function(){var _0x3e8837=this[_0xe9ce('0x12')];this[_0xe9ce('0x32')]+=0x1;for(var _0x3a17ba in _0x3e8837){if(_0x3e8837[_0xe9ce('0x33')](_0x3a17ba)&&(_0x3e8837[_0x3a17ba][_0xe9ce('0x34')]===_0xe9ce('0x4')||_0x3e8837[_0x3a17ba][_0xe9ce('0x34')]===_0xe9ce('0x35'))&&_0x3e8837[_0x3a17ba][_0xe9ce('0x36')]===_0xe9ce('0x37')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xe9ce('0x38')]();}}if(_0x3e8837[_0xe9ce('0x33')](_0x3a17ba)&&_0x3e8837[_0x3a17ba][_0xe9ce('0x34')]===_0xe9ce('0x4')&&_0x3e8837[_0x3a17ba][_0xe9ce('0x36')]===_0xe9ce('0x37')){if(_0x3e8837[_0x3a17ba]['dialActive']){this[_0xe9ce('0x39')](_0x3e8837[_0x3a17ba]);if(_0x3e8837[_0x3a17ba][_0xe9ce('0x3a')])this[_0xe9ce('0x3b')](_0x3e8837[_0x3a17ba]);}else{notSendMessagesQueue(_0x3e8837[_0x3a17ba]);}}}};Preview[_0xe9ce('0x30')]['clearZombieChannel']=function(_0x48c5de){var _0x26e69e=this;this[_0xe9ce('0x11')][_0xe9ce('0xe')](function(){if(!_[_0xe9ce('0x3c')](_0x26e69e[_0xe9ce('0x3d')][_0x48c5de])){loggerAction['info'](_0xe9ce('0x3e'),_0x48c5de,_0xe9ce('0x3f'),_0x26e69e['actions'][_0x48c5de][_0xe9ce('0x40')],_0xe9ce('0x41'),JSON['stringify'](_0x26e69e[_0xe9ce('0x12')][_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x40')]][_0xe9ce('0x27')]),'pTalking:\x20',JSON[_0xe9ce('0x22')](_0x26e69e[_0xe9ce('0x12')][_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x40')]][_0xe9ce('0x28')]),JSON[_0xe9ce('0x22')](_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x42')]),JSON['stringify'](_[_0xe9ce('0x43')](_0x26e69e[_0xe9ce('0x3d')][_0x48c5de],[_0xe9ce('0x44'),'UserId',_0xe9ce('0x45'),'ListId'])));return ami[_0xe9ce('0x46')]({'action':_0xe9ce('0x47'),'channel':_0x26e69e['actions'][_0x48c5de][_0xe9ce('0x48')]})[_0xe9ce('0x49')](function(_0x254eb8){if(_0x254eb8[_0xe9ce('0x2a')]===_0xe9ce('0x4a')){setTimeout(function(){if(_0x26e69e[_0xe9ce('0x3d')][_0x48c5de]){utils[_0xe9ce('0x4b')](_0x26e69e[_0xe9ce('0x12')][_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x40')]],_0xe9ce('0x4c'));if(_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x42')]===!![]){ut[_0xe9ce('0x4d')](_0x26e69e['campaignsPreview'][_0x26e69e['actions'][_0x48c5de]['queue']],_0xe9ce('0x4c'));ut[_0xe9ce('0x4e')]('[Dialer][checkChannel][pTalking][Preview]'+_0x48c5de,_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x40')]);}ut[_0xe9ce('0x4e')](_0xe9ce('0x4f')+_0x48c5de,_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x40')]);delete _0x26e69e[_0xe9ce('0x3d')][_0x48c5de];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0xcf0549=this;loggerAction[_0xe9ce('0x20')]('[action]',_['size'](this[_0xe9ce('0x3d')]));for(var _0x47914e in this[_0xe9ce('0x3d')]){if(_0xcf0549[_0xe9ce('0x3d')][_0xe9ce('0x33')](_0x47914e)){_0xcf0549[_0xe9ce('0x50')](_0x47914e);}}};Preview[_0xe9ce('0x30')][_0xe9ce('0x3b')]=function(_0x24aa96){var _0x3f2068=this;rpcDb[_0xe9ce('0x51')](_0x24aa96['id'],ut[_0xe9ce('0x52')](this[_0xe9ce('0x14')]))[_0xe9ce('0x53')](function(_0x2a9065){if(!_[_0xe9ce('0x3c')](_0x2a9065)){for(var _0x1769ec=0x0;_0x1769ec<_0x2a9065[_0xe9ce('0x54')];_0x1769ec+=0x1){if(ut[_0xe9ce('0x55')](_0x2a9065[_0x1769ec][_0xe9ce('0x56')])<_0x24aa96[_0xe9ce('0x57')]*0x3c){if(_0x2a9065[_0x1769ec][_0xe9ce('0x58')]&&!_0x2a9065[_0x1769ec][_0xe9ce('0x58')]['voicePause']){_0x3f2068[_0xe9ce('0x59')](_0x2a9065[_0x1769ec]['id'])[_0xe9ce('0x53')](ut[_0xe9ce('0x5a')]('[RecallMe]'))[_0xe9ce('0x49')](ut[_0xe9ce('0x5a')](_0xe9ce('0x5b')));}else{rpcDb['disableContact'](_0x2a9065[_0x1769ec]['id']);}}else{var _0x3fd4ff=new Action(_0x2a9065[_0x1769ec],_0x24aa96);_0x3fd4ff['starttime']=moment()['format'](_0xe9ce('0x5c'));_0x24aa96[_0xe9ce('0x5d')]+=0x1;ut[_0xe9ce('0x5e')](_0x3fd4ff,0x17,'RecallInQueue');if(_0x24aa96[_0xe9ce('0x5f')]){rpcDb[_0xe9ce('0x60')](ut[_0xe9ce('0x61')](_0x2a9065[_0x1769ec]));rpcDb['createCustomerHistory'](_0x3fd4ff,_0xe9ce('0x62'));}else{ut['logCustomer'](_0x3fd4ff,0x16,_0xe9ce('0x63'));rpcDb[_0xe9ce('0x64')](_0x3fd4ff,_0xe9ce('0x65'));rpcDb[_0xe9ce('0x66')](_0x3fd4ff,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xe9ce('0x5a')](_0xe9ce('0x67')));};Preview['prototype'][_0xe9ce('0x39')]=function(_0x5c209e){_0x5c209e[_0xe9ce('0x26')]=!![];if(ut[_0xe9ce('0x68')](_0x5c209e[_0xe9ce('0x69')])){_0x5c209e[_0xe9ce('0x2a')]=utils[_0xe9ce('0x2b')][_0xe9ce('0x6a')];}else if(!ut[_0xe9ce('0x6b')](_0x5c209e[_0xe9ce('0x6c')])){_0x5c209e['message']=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0xe9ce('0x6d')](_0x5c209e[_0xe9ce('0x6e')])){if(!this[_0xe9ce('0x6d')](_0x5c209e[_0xe9ce('0x6f')])){_0x5c209e[_0xe9ce('0x2a')]=utils[_0xe9ce('0x2b')]['UNREACHABLE_TRUNK'];}else{_0x5c209e['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0x5c209e[_0xe9ce('0x2a')]=utils[_0xe9ce('0x2b')][_0xe9ce('0x70')];}};Preview[_0xe9ce('0x30')]['callProgressDetectingCustomer']=function(_0x113421,_0x23b204,_0x4c1de0){var _0x272650=this;var _0x1e7b32=this[_0xe9ce('0x3d')][_0x23b204];var _0x20c63=this[_0xe9ce('0x12')][_0x1e7b32[_0xe9ce('0x40')]];var _0x44e46f;var _0x29db83=![];var _0x18fcd4=0x2;var _0x2b3620=0x3;if(_0x20c63){switch(_0x4c1de0){case'1':_0x20c63['outboundNoSuchCallsDay']+=0x1;_0x1e7b32[_0xe9ce('0x71')]+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x0,_0xe9ce('0x74'));ami[_0xe9ce('0x75')](_0xe9ce('0x76'),ut[_0xe9ce('0x77')](_0x1e7b32,'nosuchnumber'));rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0x78'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'0',_0x20c63)[_0xe9ce('0x53')](function(_0x237c30){_0x29db83=_0x237c30[_0xe9ce('0x7a')]==0x1;_0x18fcd4=_0x20c63[_0xe9ce('0x7b')];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63['dialGlobalMaxRetry']){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,_0xe9ce('0x7f'));}else{if(_0x1e7b32[_0xe9ce('0x71')]>=_0x20c63[_0xe9ce('0x80')]){rpcDb[_0xe9ce('0x66')](_0x1e7b32,_0xe9ce('0x7f'));}else{rpcDb[_0xe9ce('0x81')](ut['scheduledAt'](_0x1e7b32,'countnosuchnumberretry',_0x20c63[_0xe9ce('0x7b')]),_0x1e7b32['unlockAgent'],_0x1e7b32[_0xe9ce('0x82')]);}}delete this['actions'][_0x113421[_0xe9ce('0x83')]];}else{_0x1e7b32[_0xe9ce('0x71')]++;logger['info'](_0xe9ce('0x84'),_0x1e7b32['countnosuchnumberretry']);logger[_0xe9ce('0x20')]('id',_0x1e7b32['idContact']);_0x272650[_0xe9ce('0x85')]({'id':_0x1e7b32[_0xe9ce('0x86')],'field':{'countnosuchnumberretry':_0x1e7b32[_0xe9ce('0x71')]}})[_0xe9ce('0x53')](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});break;case _0xe9ce('0x88'):var _0x4575a5=moment()[_0xe9ce('0x23')](_0xe9ce('0x5c'));_0x1e7b32[_0xe9ce('0x89')]=_0x4575a5;_0x1e7b32[_0xe9ce('0x8a')]=_0x4575a5;_0x1e7b32['dialAnswer']=!![];_0x20c63[_0xe9ce('0x28')]+=0x1;logger[_0xe9ce('0x20')](_0xe9ce('0x8b'),_0x1e7b32[_0xe9ce('0x8c')],_0xe9ce('0x8d'),_0x20c63[_0xe9ce('0x25')],_0xe9ce('0x8e'),_0x20c63['pTalking']);ami['emit']('custom:agentconnect',ut[_0xe9ce('0x77')](_0x1e7b32,_0xe9ce('0x8f'),this[_0xe9ce('0x12')][_0x1e7b32[_0xe9ce('0x40')]]));if(_0x20c63[_0xe9ce('0x90')]||_0x20c63[_0xe9ce('0x91')]){ami[_0xe9ce('0x75')](_0xe9ce('0x92'),{'queue':_0x1e7b32['queue'],'interface':_0x1e7b32[_0xe9ce('0x93')],'uniqueid':_0x1e7b32['uniqueid']});}break;case'16':ami[_0xe9ce('0x75')](_0xe9ce('0x94'),ut[_0xe9ce('0x77')](_0x1e7b32,_0xe9ce('0x95'),this[_0xe9ce('0x12')][_0x1e7b32['queue']]));emitVoiceQueueChannelRemove(ut[_0xe9ce('0x77')](_0x1e7b32,_0xe9ce('0x95')));_0x20c63[_0xe9ce('0x96')]+=0x1;_0x20c63['total']+=0x1;_0x20c63[_0xe9ce('0x97')]+=0x1;ut['decrementTalking'](_0x20c63,'[16]');_0x1e7b32['countglobal']=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x4,_0xe9ce('0x98'));rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0x99'));rpcDb[_0xe9ce('0x66')](_0x1e7b32,_0xe9ce('0x9a'));rpcDb['crateCustomerReportQueue'](_0x1e7b32);_0x20c63[_0xe9ce('0x9b')]+=_0x1e7b32[_0xe9ce('0x9c')];_0x20c63[_0xe9ce('0x9d')]+=_0x1e7b32[_0xe9ce('0x9c')];logger[_0xe9ce('0x20')](_0xe9ce('0x9e'),_0x1e7b32[_0xe9ce('0x8c')],_0xe9ce('0x8d'),_0x20c63['name'],'pTalking:\x20',_0x20c63['pTalking']);delete this[_0xe9ce('0x3d')][_0x113421[_0xe9ce('0x83')]];break;case _0xe9ce('0x9f'):_0x20c63[_0xe9ce('0xa0')]+=0x1;_0x1e7b32[_0xe9ce('0xa1')]+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x5,_0xe9ce('0xa2'));_0x18fcd4=_0x20c63[_0xe9ce('0xa3')];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];ami[_0xe9ce('0x75')](_0xe9ce('0xa4'),ut[_0xe9ce('0x77')](_0x1e7b32,'busy'));rpcDb[_0xe9ce('0x64')](_0x1e7b32,'[callProgressDetectingCustomer][logBusy]');_0x272650['verifyAdditionalPhones'](_0x1e7b32,'5',_0x20c63)['then'](function(_0x1fd1c2){_0x29db83=_0x1fd1c2[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63[_0xe9ce('0xa5')]){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,'Global');rpcDb[_0xe9ce('0x66')](_0x44e46f,_0xe9ce('0xa6'));}else{if(_0x1e7b32[_0xe9ce('0xa1')]>=_0x20c63[_0xe9ce('0xa7')]){rpcDb[_0xe9ce('0x66')](_0x1e7b32,_0xe9ce('0xa8'));}else{rpcDb[_0xe9ce('0x81')](ut[_0xe9ce('0xa9')](_0x1e7b32,'countbusyretry',_0x20c63['dialBusyRetryFrequency']),_0x1e7b32[_0xe9ce('0xaa')],_0x1e7b32[_0xe9ce('0x82')]);}}}else{_0x1e7b32['countbusyretry']++;_0x272650['incrementPreviewCounters']({'id':_0x1e7b32['idContact'],'field':{'countbusyretry':_0x1e7b32[_0xe9ce('0xa1')]}})['then'](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});break;case _0xe9ce('0xab'):_0x20c63[_0xe9ce('0xac')]+=0x1;_0x1e7b32[_0xe9ce('0xad')]+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut['logCustomer'](_0x1e7b32,0x3,'NoAnswer');_0x18fcd4=_0x20c63[_0xe9ce('0xae')];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];var _0x59ebd2=ut[_0xe9ce('0xaf')](_0x1e7b32,_0x20c63);ami[_0xe9ce('0x75')](_0xe9ce('0xb0'),_0x59ebd2);rpcDb[_0xe9ce('0x64')](_0x1e7b32,'[callProgressDetectingCustomer][logNoAnswer]');_0x272650[_0xe9ce('0x79')](_0x1e7b32,'3',_0x20c63)[_0xe9ce('0x53')](function(_0x3df2db){_0x29db83=_0x3df2db[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63[_0xe9ce('0xa5')]){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x1e7b32['countnoanswerretry']>=_0x20c63[_0xe9ce('0xb1')]){rpcDb['createCustomerFinal'](_0x1e7b32,_0xe9ce('0xb2'));}else{rpcDb[_0xe9ce('0x81')](ut[_0xe9ce('0xa9')](_0x1e7b32,_0xe9ce('0xad'),_0x20c63['dialNoAnswerRetryFrequency']),_0x1e7b32[_0xe9ce('0xaa')],_0x1e7b32[_0xe9ce('0x82')]);}}}else{_0x1e7b32[_0xe9ce('0xad')]++;_0x272650['incrementPreviewCounters']({'id':_0x1e7b32['idContact'],'field':{'countnoanswerretry':_0x1e7b32[_0xe9ce('0xad')]}})[_0xe9ce('0x53')](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});break;case'CONGESTION':_0x20c63[_0xe9ce('0xb3')]+=0x1;_0x1e7b32[_0xe9ce('0xb4')]+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x8,_0xe9ce('0xb5'));_0x18fcd4=_0x20c63['dialCongestionRetryFrequency'];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];ami[_0xe9ce('0x75')](_0xe9ce('0xb6'),ut['buildObj'](_0x1e7b32,_0xe9ce('0xb7')));rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0xb8'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'8',_0x20c63)[_0xe9ce('0x53')](function(_0x2223f5){_0x29db83=_0x2223f5[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut['totalGlobal'](_0x1e7b32)>=_0x20c63['dialGlobalMaxRetry']){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,_0xe9ce('0xb9'));}else{if(_0x1e7b32['countcongestionretry']>=_0x20c63[_0xe9ce('0xba')]){rpcDb['createCustomerFinal'](_0x1e7b32,_0xe9ce('0xb8'));}else{rpcDb[_0xe9ce('0x81')](ut[_0xe9ce('0xa9')](_0x1e7b32,'countcongestionretry',_0x20c63[_0xe9ce('0xa3')]),_0x1e7b32['unlockAgent'],_0x1e7b32[_0xe9ce('0x82')]);}}}else{_0x1e7b32['countcongestionretry']++;_0x272650['incrementPreviewCounters']({'id':_0x1e7b32[_0xe9ce('0x86')],'field':{'countcongestionretry':_0x1e7b32[_0xe9ce('0xb4')]}})[_0xe9ce('0x53')](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)['then'](function(){});});}});break;case _0xe9ce('0xbb'):_0x20c63['outboundRejectCallsDay']+=0x1;_0x1e7b32[_0xe9ce('0xbc')]+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut['totalGlobal'](_0x1e7b32);ut['logCustomer'](_0x1e7b32,0x14,'AgentReject');_0x18fcd4=_0x20c63[_0xe9ce('0xbd')];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];ami['emit']('custom:agentreject',ut['buildObj'](_0x1e7b32,_0xe9ce('0xbe')));rpcDb['createCustomerHistory'](_0x1e7b32,_0xe9ce('0xbf'));_0x272650['verifyAdditionalPhones'](_0x1e7b32,'20',_0x20c63)[_0xe9ce('0x53')](function(_0x25d12d){_0x29db83=_0x25d12d['additional']==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63[_0xe9ce('0xa5')]){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0x14,_0xe9ce('0xc0'));rpcDb['createCustomerFinal'](_0x44e46f,_0xe9ce('0xc1'));}else{if(_0x1e7b32[_0xe9ce('0xbc')]>=_0x20c63[_0xe9ce('0xc2')]){rpcDb['createCustomerFinal'](_0x1e7b32,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0xe9ce('0xa9')](_0x1e7b32,_0xe9ce('0xbc'),_0x20c63[_0xe9ce('0xbd')]),_0x1e7b32['unlockAgent'],_0x1e7b32[_0xe9ce('0x82')]);}}}else{_0x1e7b32[_0xe9ce('0xad')]++;_0x272650['incrementPreviewCounters']({'id':_0x1e7b32[_0xe9ce('0x86')],'field':{'countnoanswerretry':_0x1e7b32[_0xe9ce('0xad')]}})[_0xe9ce('0x53')](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});break;case'ABANDONED':_0x20c63[_0xe9ce('0xc3')]+=0x1;_0x1e7b32[_0xe9ce('0xc4')]+=0x1;_0x1e7b32['countglobal']=ut['totalGlobal'](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0xb,'Abandoned');rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0xc5'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'11',_0x20c63)[_0xe9ce('0x53')](function(_0x2baf96){_0x29db83=_0x2baf96[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63[_0xe9ce('0xa5')]){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1e7b32[_0xe9ce('0xc6')]>=_0x20c63[_0xe9ce('0xc7')]){rpcDb[_0xe9ce('0x66')](_0x1e7b32,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0xe9ce('0xa9')](_0x1e7b32,_0xe9ce('0xc4'),_0x20c63[_0xe9ce('0xc8')]),_0x1e7b32[_0xe9ce('0xaa')],_0x1e7b32[_0xe9ce('0x82')]);}}}else{_0x1e7b32[_0xe9ce('0xad')]++;_0x272650[_0xe9ce('0x85')]({'id':_0x1e7b32[_0xe9ce('0x86')],'field':{'countnoanswerretry':_0x1e7b32[_0xe9ce('0xad')]}})[_0xe9ce('0x53')](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});break;case'18':_0x20c63[_0xe9ce('0xc9')]+=0x1;_0x1e7b32['countmachineretry']+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x12,_0x113421[_0xe9ce('0xca')]||_0x113421[_0xe9ce('0xcb')]);ami[_0xe9ce('0x75')](_0xe9ce('0xcc'),ut['buildObj'](_0x1e7b32,_0xe9ce('0xcd')));rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0xce'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'18',_0x20c63)['then'](function(_0x30100e){_0x29db83=_0x30100e[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63[_0xe9ce('0xa5')]){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0x12,'Global');rpcDb['createCustomerFinal'](_0x44e46f,_0xe9ce('0xce'));}else{rpcDb[_0xe9ce('0x66')](_0x1e7b32,_0xe9ce('0xce'));}}else{_0x1e7b32[_0xe9ce('0xad')]++;_0x272650[_0xe9ce('0x85')]({'id':_0x1e7b32[_0xe9ce('0x86')],'field':{'countnoanswerretry':_0x1e7b32['countnoanswerretry']}})[_0xe9ce('0x53')](function(){_0x272650['swapAdditionalPhones'](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});delete this['actions'][_0x113421[_0xe9ce('0x83')]];break;case'19':_0x20c63[_0xe9ce('0xc9')]+=0x1;_0x1e7b32['countglobal']=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x13,_0x113421[_0xe9ce('0xca')]||_0x113421[_0xe9ce('0xcb')]);ami[_0xe9ce('0x75')]('custom:amd',ut[_0xe9ce('0x77')](_0x1e7b32,_0xe9ce('0xcd')));rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0xcf'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'18',_0x20c63)[_0xe9ce('0x53')](function(_0x5388d3){_0x29db83=_0x5388d3[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63['dialGlobalMaxRetry']){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xe9ce('0x66')](_0x1e7b32,'[callProgressDetectingCustomer][machine]');}}else{_0x1e7b32[_0xe9ce('0xad')]++;_0x272650[_0xe9ce('0x85')]({'id':_0x1e7b32['idContact'],'field':{'countnoanswerretry':_0x1e7b32[_0xe9ce('0xad')]}})[_0xe9ce('0x53')](function(){_0x272650['swapAdditionalPhones'](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});delete this[_0xe9ce('0x3d')][_0x113421['linkedid']];break;default:if(_0x1e7b32['dialAnswer']){ut[_0xe9ce('0x4d')](_0x20c63,'[default]');ut[_0xe9ce('0x4e')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0x20c63[_0xe9ce('0x25')],_0x113421);}_0x20c63['outboundUnknownCallsDay']+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0xc,_0x113421[_0xe9ce('0xca')]||_0x113421[_0xe9ce('0xcb')]);_0x18fcd4=_0x20c63[_0xe9ce('0xbd')];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0xd0'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'20',_0x20c63)[_0xe9ce('0x53')](function(_0x412b26){_0x29db83=_0x412b26[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63['dialGlobalMaxRetry']){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,_0xe9ce('0xd1'));}else{rpcDb[_0xe9ce('0x66')](_0x1e7b32,_0xe9ce('0xd1'));}delete this[_0xe9ce('0x3d')][_0x113421['linkedid']];}else{_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});}});}if(!(_0x1e7b32[_0xe9ce('0x42')]&&_0x4c1de0==='16')){utils[_0xe9ce('0x4b')](_0x20c63,_0xe9ce('0xd2'));logger[_0xe9ce('0x20')](_0xe9ce('0xd3'),_0x1e7b32[_0xe9ce('0x8c')],_0xe9ce('0x8d'),_0x20c63[_0xe9ce('0x25')],'originated:\x20',_0x20c63[_0xe9ce('0x27')]);}if(_0x4c1de0!==_0xe9ce('0x88')){delete this[_0xe9ce('0x3d')][_0x113421[_0xe9ce('0x83')]];delete this['actions'][_0x113421[_0xe9ce('0xd4')]];}_0x20c63[_0xe9ce('0xd5')]=!![];}};Preview[_0xe9ce('0x30')][_0xe9ce('0xd6')]=function(_0x2fb4d6,_0x1445ce,_0xb81a2f){if(_['isUndefined'](_0x1445ce)&&_0xe9ce('0xd7')!==typeof _0x1445ce){return;}if(_[_0xe9ce('0xd8')](_0xb81a2f)&&_0xe9ce('0xd7')!==typeof _0xb81a2f){return;}switch(_0xb81a2f[_0xe9ce('0xd9')]){case'0':ut['logAgent'](_0x2fb4d6,0x0,'NoSuchNumber');rpcDb[_0xe9ce('0xda')](_0x2fb4d6,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xe9ce('0xdb')](_0x2fb4d6,0x3,_0xe9ce('0xdc'));rpcDb[_0xe9ce('0xda')](_0x2fb4d6,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xe9ce('0xdb')](_0x2fb4d6,0x5,_0xe9ce('0xa2'));rpcDb[_0xe9ce('0xda')](_0x2fb4d6,_0xe9ce('0xdd'));break;case'8':ut[_0xe9ce('0xdb')](_0x2fb4d6,0x8,_0xe9ce('0xb5'));rpcDb[_0xe9ce('0xda')](_0x2fb4d6,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xe9ce('0xdb')](_0x2fb4d6,0x16,_0xe9ce('0xde'));rpcDb[_0xe9ce('0xda')](_0x2fb4d6,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x2fb4d6,0xc,_0xb81a2f['reason']);rpcDb[_0xe9ce('0xda')](_0x2fb4d6,_0xe9ce('0xdf'));}utils[_0xe9ce('0x4b')](_0x1445ce,_0xe9ce('0xe0'));logger[_0xe9ce('0x20')](_0xe9ce('0xe1'),_0x2fb4d6[_0xe9ce('0x8c')],_0xe9ce('0x8d'),_0x1445ce['name'],_0xe9ce('0x41'),_0x1445ce[_0xe9ce('0x27')]);delete this['actions'][_0x2fb4d6[_0xe9ce('0x8c')]];};Preview[_0xe9ce('0x30')]['verifyAdditionalPhones']=function(_0x31c6c2,_0x3293a1,_0x2b4eaa){return cmHopperAdditionalPhone[_0xe9ce('0x79')](_0x31c6c2,_0x3293a1,_0x2b4eaa)[_0xe9ce('0x49')](logger[_0xe9ce('0x20')](_0xe9ce('0xe2')));};Preview['prototype'][_0xe9ce('0x87')]=function(_0x13e0ae,_0x1197dc,_0x5a5d28){return cmHopperAdditionalPhone[_0xe9ce('0x87')](_0x13e0ae,_0x1197dc,_0x5a5d28)[_0xe9ce('0x49')](logger[_0xe9ce('0x20')]('[swapAdditionalPhone]\x20'));};Preview[_0xe9ce('0x30')][_0xe9ce('0x85')]=function(_0x5d13ef){return Promise['resolve']()[_0xe9ce('0x53')](cmHopperAdditionalPhone[_0xe9ce('0x85')](_0x5d13ef))['catch'](logger[_0xe9ce('0x20')]('[incrementPreviewCounters]\x20'));};Preview[_0xe9ce('0x30')]['checkInBlack']=function(_0x10def0,_0x10e37d,_0x158989,_0x385d5b,_0x1aed2f){var _0x9ef10=this;return new Promise(function(_0x66bf90,_0xafaade){if(_[_0xe9ce('0x3c')](_0x10e37d)||_['isNil'](_0x10e37d[_0xe9ce('0xe3')])||_[_0xe9ce('0x3c')](_0x10e37d[_0xe9ce('0xe4')])||_[_0xe9ce('0x3c')](_0x10e37d['VoiceQueueId'])){_0xafaade(ut['message']('Contact\x20is\x20undefined',_0x385d5b,_0x1aed2f));return;}var _0x309a97=uuid['v4']();var _0x184273=_0x9ef10[_0xe9ce('0x12')][_0x10e37d['Queue'][_0xe9ce('0x25')]];var _0x5f4867=_0x158989?_0x9ef10[_0xe9ce('0x14')][_0x158989]['id']:undefined;_0x9ef10['actions'][_0x309a97]=new Action(_0x10e37d,_0x184273,_0x309a97,_0x158989,_0x5f4867);var _0x5270b5=_0x9ef10[_0xe9ce('0x3d')][_0x309a97];_0x5270b5[_0xe9ce('0xaa')]=_0x385d5b;_0x5270b5['activeContact']=_0x1aed2f;_0x5270b5[_0xe9ce('0xe5')]=_0x158989;if(_[_0xe9ce('0xe6')](_0x10def0)){_0x9ef10[_0xe9ce('0xe7')](_0x5270b5,_0x184273,_0x10e37d,_0x158989)[_0xe9ce('0x53')](function(_0x1e654d){logger['info']('[Preview][execCall][success]',_0xe9ce('0xe8')+_0x5270b5[_0xe9ce('0x40')]+_0xe9ce('0xe9')+_0x5270b5[_0xe9ce('0x86')],JSON[_0xe9ce('0x22')](_0x1e654d));ami[_0xe9ce('0x75')](_0xe9ce('0xea'),ut[_0xe9ce('0x77')](_0x5270b5,'called',_0x9ef10[_0xe9ce('0x12')][_0x5270b5[_0xe9ce('0x40')]]));_0x66bf90(ut[_0xe9ce('0x2a')](_0xe9ce('0xeb')));})['catch'](function(_0x2b6120){ut[_0xe9ce('0x2c')](_0xe9ce('0xec'),_0x2b6120);_0xafaade(ut[_0xe9ce('0x2a')]('Call\x20failed',_0x385d5b,_0x1aed2f));});}else{_0x184273[_0xe9ce('0xed')]+=0x1;ut[_0xe9ce('0xee')](_0x5270b5);rpcDb[_0xe9ce('0xef')](_0x5270b5,_0xe9ce('0xf0'));delete _0x9ef10[_0xe9ce('0x3d')][_0x309a97];_0xafaade(ut[_0xe9ce('0x2a')](_0xe9ce('0xf1'),_0x385d5b,_0x1aed2f));}});};Preview['prototype'][_0xe9ce('0x6d')]=function(_0x58612d){return!_[_0xe9ce('0x3c')](_0x58612d)&&!_['isNil'](_0x58612d['name'])&&!_[_0xe9ce('0x3c')](_0x58612d['active'])&&_0x58612d[_0xe9ce('0xf2')]&&!_[_0xe9ce('0x3c')](this['trunks'][util[_0xe9ce('0x23')]('SIP/%s',_0x58612d['name'])])&&!_[_0xe9ce('0x3c')](this[_0xe9ce('0x13')][util[_0xe9ce('0x23')](_0xe9ce('0xf3'),_0x58612d[_0xe9ce('0x25')])][_0xe9ce('0x47')])&&(this[_0xe9ce('0x13')][util[_0xe9ce('0x23')]('SIP/%s',_0x58612d['name'])]['status']==='reachable'||this[_0xe9ce('0x13')][util[_0xe9ce('0x23')](_0xe9ce('0xf3'),_0x58612d['name'])][_0xe9ce('0x47')]===_0xe9ce('0xf4'));};Preview[_0xe9ce('0x30')]['run']=function(_0x307e73,_0x504848){return this[_0xe9ce('0xf5')](_0x307e73,_0x504848)[_0xe9ce('0x53')](function(_0x2b17da){return _[_0xe9ce('0x43')](_0x2b17da,[_0xe9ce('0x2a')]);})['catch'](function(_0x47cfdd){if(_0x47cfdd['unlock']){rpcDb['unlockContact'](_0x307e73);}if(_0x47cfdd[_0xe9ce('0xf2')]){rpcDb[_0xe9ce('0xf6')](_0x307e73);}throw _[_0xe9ce('0x43')](_0x47cfdd,[_0xe9ce('0x2a')]);});};Preview['prototype'][_0xe9ce('0xf5')]=function(_0x2fc33e,_0x2c1190){var _0x391560=this;var _0xc1f0ae,_0x284c67;return rpcDb[_0xe9ce('0xf7')](_0x2fc33e)[_0xe9ce('0x53')](function(_0x2f0c83){if(!_[_0xe9ce('0x3c')](_0x2f0c83[0x0])){_0x284c67=_0x2f0c83[0x0][_0xe9ce('0xf8')]?![]:!![];_0xc1f0ae=_0x2f0c83[0x0][_0xe9ce('0xf8')]?!![]:![];_0xc1f0ae=_0x2c1190?!![]:_0xc1f0ae;}var _0x2b1dce=_0x391560['validateContact'](_0x2f0c83);if(_0x2b1dce[_0xe9ce('0xf9')]){rpcDb['checkIsBlackList'](_[_0xe9ce('0x43')](_0x2f0c83[0x0],[_0xe9ce('0x45'),'phone']))[_0xe9ce('0x53')](function(_0x3db8b0){_0x391560[_0xe9ce('0xfa')](_0x3db8b0,_0x2f0c83[0x0],_0x2c1190,_0x284c67,_0xc1f0ae)[_0xe9ce('0x53')](function(_0x34a663){return _0x34a663;})['catch'](function(_0x1b2607){throw _0x1b2607;});})[_0xe9ce('0x49')](function(_0x528bfd){ut[_0xe9ce('0x2c')](_0xe9ce('0xfb'),_0x528bfd);throw ut[_0xe9ce('0x2a')](_0xe9ce('0xfc'),_0x284c67,_0xc1f0ae);});}else{throw ut[_0xe9ce('0x2a')](_0x2b1dce[_0xe9ce('0x2a')],_0x284c67,_0xc1f0ae);}})['catch'](function(_0x59f1d3){ut['logger'](_0xe9ce('0xfd'),_0x59f1d3);throw ut[_0xe9ce('0x2a')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xe9ce('0x30')][_0xe9ce('0xfe')]=function(_0x12c450){if(_[_0xe9ce('0x3c')](_0x12c450)||_['isEmpty'](_0x12c450)||!_[_0xe9ce('0x3c')](_0x12c450[0x0][_0xe9ce('0x58')])&&_[_0xe9ce('0x3c')](_0x12c450[0x0]['Agent'][_0xe9ce('0x25')])){ut['logger'](_0xe9ce('0xff'),_0x12c450);return{'isValid':![],'message':_0xe9ce('0x100')};}var _0x555e38=this[_0xe9ce('0x12')][_0x12c450[0x0][_0xe9ce('0x3f')][_0xe9ce('0x25')]];_0x555e38[_0xe9ce('0x2a')]=utils[_0xe9ce('0x2b')][_0xe9ce('0x70')];if(_[_0xe9ce('0x3c')](_0x555e38)){ut[_0xe9ce('0x2c')]('[Preview][validateContact][Empty\x20Campaign]',_0x555e38);return{'isValid':![],'message':_0xe9ce('0x101')};}if(!this[_0xe9ce('0x6d')](_0x555e38[_0xe9ce('0x6e')])){ut[_0xe9ce('0x2c')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xe9ce('0x102')+_0x555e38['name']+_0xe9ce('0x103'));if(!this['isTrunkReachable'](_0x555e38[_0xe9ce('0x6f')])){ut[_0xe9ce('0x2c')](_0xe9ce('0x104'),_0x555e38[_0xe9ce('0x25')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe9ce('0x105')};}}if(!ut[_0xe9ce('0x6b')](_0x555e38[_0xe9ce('0x6c')])){ut[_0xe9ce('0x2c')]('[Preview][validateContact][Campaign\x20Active]',_0x555e38[_0xe9ce('0x25')]+_0xe9ce('0x106'));return{'isValid':![],'message':_0xe9ce('0x102')+_0x555e38['name']+_0xe9ce('0x106')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype']['execCall']=function(_0x526bbc,_0x5927a2,_0x261c4e,_0x3f40f7){var _0x19773c=this;return new Promise(function(_0x20d21d,_0x4a9c17){var _0x52be93=_0x526bbc['uniqueid'];var _0x5395ce=_0x19773c['isTrunkReachable'](_0x5927a2[_0xe9ce('0x6e')])?util[_0xe9ce('0x23')](_0xe9ce('0x107'),_0x5927a2['Trunk']['name'],_['isNil'](_0x5927a2[_0xe9ce('0x108')])?'':_0x5927a2[_0xe9ce('0x108')]['trim']()||'',_0x5927a2[_0xe9ce('0x109')]>0x0?_0x261c4e[_0xe9ce('0xe4')][_0xe9ce('0x10a')](_0x5927a2[_0xe9ce('0x109')]):_0x261c4e[_0xe9ce('0xe4')]):util['format'](_0xe9ce('0x107'),_['isNil'](_0x5927a2['TrunkBackup'])?_0x5927a2[_0xe9ce('0x6e')][_0xe9ce('0x25')]:_0x5927a2['TrunkBackup'][_0xe9ce('0x25')],_[_0xe9ce('0x3c')](_0x5927a2[_0xe9ce('0x108')])?'':_0x5927a2['dialPrefix'][_0xe9ce('0x10b')]()||'',_0x5927a2[_0xe9ce('0x109')]>0x0?_0x261c4e[_0xe9ce('0xe4')]['substring'](_0x5927a2[_0xe9ce('0x109')]):_0x261c4e[_0xe9ce('0xe4')]);var _0xf6e8bc=_0x19773c['isTrunkReachable'](_0x5927a2[_0xe9ce('0x6e')])?ut[_0xe9ce('0x10c')](_0x5927a2['Trunk'][_0xe9ce('0x10d')],_0x5927a2[_0xe9ce('0x10e')],_0x5927a2[_0xe9ce('0x10f')]>0x0?ut['getCallerIdRandom'](_0x5927a2[_0xe9ce('0x110')],_0x5927a2['dialRandomLastDigitCallerIdNumber']):_0x5927a2[_0xe9ce('0x110')]):ut[_0xe9ce('0x10c')](_['isNil'](_0x5927a2[_0xe9ce('0x6f')])?_0x5927a2[_0xe9ce('0x6e')][_0xe9ce('0x10d')]:_0x5927a2['TrunkBackup'][_0xe9ce('0x10d')],_0x5927a2['dialOriginateCallerIdName'],_0x5927a2[_0xe9ce('0x10f')]>0x0?ut[_0xe9ce('0x111')](_0x5927a2[_0xe9ce('0x110')],_0x5927a2['dialRandomLastDigitCallerIdNumber']):_0x5927a2[_0xe9ce('0x110')]);if(_0xf6e8bc){_0x526bbc['originatecalleridname']=ut[_0xe9ce('0x112')](_0xf6e8bc);_0x526bbc[_0xe9ce('0x113')]=ut['extractCalleridNumber'](_0xf6e8bc);}var _0x50ab03=ut['addVariables'](_0x5927a2,_0x261c4e,_0x5395ce,_0xf6e8bc,_0x52be93,_0x526bbc);var _0x2114f5=utils[_0xe9ce('0x114')](_0x261c4e[_0xe9ce('0xe3')]);Object[_0xe9ce('0x115')](_0x50ab03,_0x2114f5);_[_0xe9ce('0x116')](_0x526bbc,ut[_0xe9ce('0x117')](_0x50ab03));_0x526bbc['starttime']=moment()[_0xe9ce('0x23')]('YYYY-MM-DD\x20HH:mm:ss');_0x5927a2[_0xe9ce('0x118')]=_0x50ab03;var _0x451f9e=ut[_0xe9ce('0x119')](_0x526bbc,_0x5927a2,_0x50ab03,_0x526bbc[_0xe9ce('0x82')],_0x3f40f7);return ami[_0xe9ce('0x46')](_0x451f9e)[_0xe9ce('0x53')](function(_0x49006e){_0x5927a2[_0xe9ce('0x27')]+=0x1;logger[_0xe9ce('0x20')](_0xe9ce('0x11a'),_0x52be93,'\x20Queue',_0x5927a2[_0xe9ce('0x25')],'originated:\x20',_0x5927a2[_0xe9ce('0x27')]);_0x20d21d(_0x49006e);})[_0xe9ce('0x49')](function(_0x4a5180){ut[_0xe9ce('0xdb')](_0x526bbc,0xe,_0xe9ce('0x11b'));rpcDb[_0xe9ce('0xda')](_0x526bbc,_0xe9ce('0x11c'));_0x4a9c17(_0x4a5180);});});};Preview[_0xe9ce('0x30')]['syncNewExten']=function(_0x1998b1){if(this[_0xe9ce('0x3d')][_0x1998b1[_0xe9ce('0x83')]]){this[_0xe9ce('0x3d')][_0x1998b1[_0xe9ce('0x83')]]['channel']=_0x1998b1[_0xe9ce('0x48')];}};Preview[_0xe9ce('0x30')][_0xe9ce('0x11d')]=function(_0x15818a){var _0x160e1f=this;var _0x2640d1=this[_0xe9ce('0x3d')][_0x15818a[_0xe9ce('0x11e')]];if(_0x2640d1){if(_0x2640d1[_0xe9ce('0xe5')]&&this[_0xe9ce('0x14')][_0x2640d1['lookAgent']]){ut[_0xe9ce('0x11f')](_0x2640d1,this[_0xe9ce('0x14')][_0x2640d1[_0xe9ce('0xe5')]]['name'],this[_0xe9ce('0x14')][_0x2640d1[_0xe9ce('0xe5')]]['id']);}var _0x2e9926=_[_0xe9ce('0x120')](_0x2640d1);_0x2e9926[_0xe9ce('0x89')]=moment()['format'](_0xe9ce('0x5c'));var _0x3379a1=_0x160e1f[_0xe9ce('0x12')][_0x2640d1[_0xe9ce('0x40')]];if(ut[_0xe9ce('0x121')](_0x15818a[_0xe9ce('0x122')])){if(_0x2640d1[_0xe9ce('0xaa')]){rpcDb['unlockContact'](_0x2640d1[_0xe9ce('0x86')]);}if(_0x2640d1[_0xe9ce('0x82')]){rpcDb[_0xe9ce('0xf6')](_0x2640d1[_0xe9ce('0x86')]);}ami[_0xe9ce('0x75')](_0xe9ce('0x123'),ut[_0xe9ce('0x77')](_0x2640d1,_0xe9ce('0x124'),this[_0xe9ce('0x12')][_0x2640d1[_0xe9ce('0x40')]]));this[_0xe9ce('0xd6')](_0x2e9926,_0x3379a1,_0x15818a);}else{_0x2640d1[_0xe9ce('0x125')]=moment()[_0xe9ce('0x23')](_0xe9ce('0x5c'));ut[_0xe9ce('0xdb')](_0x2e9926,0x4,'Answer');rpcDb[_0xe9ce('0xda')](_0x2e9926,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xe9ce('0x30')][_0xe9ce('0x16')]=function(_0x21caba){var _0x558a1d=this[_0xe9ce('0x3d')][_0x21caba[_0xe9ce('0x83')]];var _0x38ae12;if(_0x558a1d){_0x38ae12=this[_0xe9ce('0x12')][_0x558a1d[_0xe9ce('0x40')]];logger[_0xe9ce('0x20')](_0xe9ce('0x126'),_0x21caba['linkedid'],_0xe9ce('0x8d'),_0x38ae12[_0xe9ce('0x25')],_0xe9ce('0x8e'),_0x38ae12[_0xe9ce('0x28')]);}if(this[_0xe9ce('0x3d')][_0x21caba['linkedid']]&&_0x21caba[_0xe9ce('0x83')]!==_0x21caba[_0xe9ce('0x8c')]){if(_0x21caba['cause']==='16'&&this[_0xe9ce('0x3d')][_0x21caba[_0xe9ce('0x83')]][_0xe9ce('0x42')]){this[_0xe9ce('0x127')](_0x21caba,_0x21caba[_0xe9ce('0x83')],_0x21caba[_0xe9ce('0x128')]);}else if(this[_0xe9ce('0x3d')][_0x21caba[_0xe9ce('0x83')]][_0xe9ce('0x42')]){logger[_0xe9ce('0x20')](_0xe9ce('0x129'),_0x21caba['linkedid'],_0x21caba['cause'],_0xe9ce('0x8d'),_0x38ae12[_0xe9ce('0x25')],_0xe9ce('0x8e'),_0x38ae12[_0xe9ce('0x28')]);this['callProgressDetectingCustomer'](_0x21caba,_0x21caba[_0xe9ce('0x83')],_0x21caba['cause']);}}else if(_0x558a1d&&_['isNil'](_0x558a1d[_0xe9ce('0x12a')])&&_0x38ae12[_0xe9ce('0x12b')]&&_0x21caba[_0xe9ce('0x83')]===_0x21caba['uniqueid']&&_['isNil'](_0x21caba[_0xe9ce('0xd9')])&&_0x21caba['cause']==='16'&&_0x21caba['channelstate']==='6'&&_['isUndefined'](_0x558a1d[_0xe9ce('0x12c')])){if(_0x558a1d[_0xe9ce('0xaa')]){rpcDb[_0xe9ce('0x12d')](_0x558a1d[_0xe9ce('0x86')]);}if(_0x558a1d[_0xe9ce('0x82')]){rpcDb[_0xe9ce('0xf6')](_0x558a1d['idContact']);}_0x21caba[_0xe9ce('0xd9')]='22';this[_0xe9ce('0xd6')](_0x558a1d,_0x38ae12,_0x21caba);}else if(_0x558a1d&&_0x558a1d['transfer']){if(_0x21caba[_0xe9ce('0x128')]==='16'&&this['actions'][_0x21caba['linkedid']][_0xe9ce('0x42')]){logger['info'](_0xe9ce('0x12e'),_0x21caba['linkedid'],_0x21caba[_0xe9ce('0x128')],_0xe9ce('0x8d'),_0x38ae12[_0xe9ce('0x25')],'pTalking:\x20',_0x38ae12[_0xe9ce('0x28')]);this[_0xe9ce('0x127')](_0x21caba,_0x21caba[_0xe9ce('0x83')],_0x21caba[_0xe9ce('0x128')]);}else if(this['actions'][_0x21caba[_0xe9ce('0x83')]][_0xe9ce('0x42')]){logger[_0xe9ce('0x20')](_0xe9ce('0x129'),_0x21caba[_0xe9ce('0x83')],_0x21caba['cause'],_0xe9ce('0x8d'),_0x38ae12[_0xe9ce('0x25')],'pTalking:\x20',_0x38ae12[_0xe9ce('0x28')]);this[_0xe9ce('0x127')](_0x21caba,_0x21caba[_0xe9ce('0x83')],_0x21caba[_0xe9ce('0x128')]);}}};Preview[_0xe9ce('0x30')]['syncDialEnd']=function(_0x5ce23b){if(this['actions'][_0x5ce23b[_0xe9ce('0xd4')]]&&_0x5ce23b[_0xe9ce('0xd4')]!==_0x5ce23b[_0xe9ce('0x12f')]){this[_0xe9ce('0x127')](_0x5ce23b,_0x5ce23b[_0xe9ce('0xd4')],_0x5ce23b[_0xe9ce('0xcb')]);}};Preview[_0xe9ce('0x30')][_0xe9ce('0x130')]=function(_0x425fc2){if(this[_0xe9ce('0x3d')][_0x425fc2[_0xe9ce('0x83')]]&&_0x425fc2[_0xe9ce('0x83')]!==_0x425fc2[_0xe9ce('0x8c')]&&!this['actions'][_0x425fc2[_0xe9ce('0x83')]][_0xe9ce('0x42')]){if(_0x425fc2['cause']==='1'){this[_0xe9ce('0x127')](_0x425fc2,_0x425fc2[_0xe9ce('0x83')],_0x425fc2[_0xe9ce('0x128')]);}}};Preview['prototype']['addVariable']=function(_0x26bbe,_0x5972e7,_0xd5cbaf){if(this[_0xe9ce('0x3d')][_0x26bbe]){if(_[_0xe9ce('0x3c')](this[_0xe9ce('0x3d')][_0x26bbe]['variables'])){this[_0xe9ce('0x3d')][_0x26bbe][_0xe9ce('0x118')]={};}this[_0xe9ce('0x3d')][_0x26bbe][_0xe9ce('0x118')][_0x5972e7]=_0xd5cbaf;}};Preview['prototype'][_0xe9ce('0x131')]=function(_0x2a354b){try{if(!_[_0xe9ce('0x3c')](_0x2a354b)){if(ut[_0xe9ce('0x132')](_[_0xe9ce('0x133')](_0x2a354b[_0xe9ce('0x134')])[0x0])){this[_0xe9ce('0x135')](_0x2a354b[_0xe9ce('0x8c')],_[_0xe9ce('0x133')](_0x2a354b['variable'])[0x0],_0x2a354b['value']);}}}catch(_0x6c0c88){logger[_0xe9ce('0x136')](_0xe9ce('0x137'),util[_0xe9ce('0x138')](_0x6c0c88,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x5523e0){if(_0x5523e0){if(this[_0xe9ce('0x3d')][_0x5523e0[_0xe9ce('0x139')]]){this['actions'][_0x5523e0['transfertargetlinkedid']][_0xe9ce('0x12c')]=!![];}}};Preview[_0xe9ce('0x30')][_0xe9ce('0x13a')]=function(_0x13ad13){if(_0x13ad13){if(this[_0xe9ce('0x3d')][_0x13ad13[_0xe9ce('0x13b')]]){this['actions'][_0x13ad13['transfererlinkedid']][_0xe9ce('0x12c')]=!![];}}};module[_0xe9ce('0x13c')]=Preview; \ No newline at end of file +var _0x69c4=['INACTIVE','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','linkedid','actioncountonusuch','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','uniqueid','\x20Queue','custom:agentconnect','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','idContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','activeContact','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','callAdditionalPhoneAfterMin','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','decrementOriginate','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','resolve','[incrementPreviewCounters]\x20','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','dialCutDigit','trim','substring','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','callerid','originatecalleridname','originatecalleridnum','addVariables','setXMDContactVariables','merge','toLowerVariables','variables','variablesAction','actionid','logLookAgent','clone','responsetime','isFailure','custom:agentringnoanswer','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','[syncHangup][talking][transfer]','destuniqueid','addVariable','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','transfer','exports','uuid','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','message','CAMPAIGN_STATUS','logger','name','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','type','clearZombieChannels','outbound','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','pick','contactId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','recallMe','getContactRecallMe','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','dialActive'];(function(_0x638e6b,_0x55ac87){var _0x1f4dbf=function(_0x3e3bdc){while(--_0x3e3bdc){_0x638e6b['push'](_0x638e6b['shift']());}};_0x1f4dbf(++_0x55ac87);}(_0x69c4,0xcd));var _0x469c=function(_0x348532,_0x380509){_0x348532=_0x348532-0x0;var _0x26e33d=_0x69c4[_0x348532];return _0x26e33d;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x469c('0x0'));var moment=require('moment');var Redis=require(_0x469c('0x1'));var config=require(_0x469c('0x2'));var logger=require(_0x469c('0x3'))(_0x469c('0x4'));var loggerAction=require(_0x469c('0x3'))(_0x469c('0x5'));var ami=require(_0x469c('0x6'));var rpcDb=require(_0x469c('0x7'));var cmHopperAdditionalPhone=require(_0x469c('0x8'));var Action=require(_0x469c('0x9'));var ut=require(_0x469c('0xa'));var utils=require(_0x469c('0xb'));config[_0x469c('0xc')]=_[_0x469c('0xd')](config[_0x469c('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x469c('0xe')][_0x469c('0xf')]=function(_0x19e9f2){this[_0x469c('0x10')]=this['tail']?this['tail'][_0x469c('0x11')](_0x19e9f2):_0x19e9f2();};function Preview(_0x46031c){this[_0x469c('0x12')]=new Sequence();this[_0x469c('0x13')]=_0x46031c['voiceQueues'];this[_0x469c('0x14')]=_0x46031c['trunks'];this['actions']={};this[_0x469c('0x15')]=_0x46031c['agents'];this[_0x469c('0x16')]=0x0;ami['on'](_0x469c('0x17'),this[_0x469c('0x18')][_0x469c('0x19')](this));ami['on'](_0x469c('0x1a'),this['syncHangup']['bind'](this));ami['on']('hanguprequest',this[_0x469c('0x1b')][_0x469c('0x19')](this));ami['on'](_0x469c('0x1c'),this[_0x469c('0x1d')]['bind'](this));ami['on'](_0x469c('0x1e'),this[_0x469c('0x1f')][_0x469c('0x19')](this));ami['on']('varset',this['syncVarSet'][_0x469c('0x19')](this));ami['on'](_0x469c('0x20'),this[_0x469c('0x21')][_0x469c('0x19')](this));ami['on'](_0x469c('0x22'),this['syncBlindTransfer'][_0x469c('0x19')](this));this[_0x469c('0x23')](this[_0x469c('0x13')]);}function emit(_0x5c7a14,_0x439ada,_0x1ddb95){io['to'](_0x5c7a14)[_0x469c('0x24')](_0x439ada,_0x1ddb95);}function emitVoiceQueueChannelRemove(_0x4ad460){logger[_0x469c('0x25')](_0x469c('0x26'),JSON[_0x469c('0x27')](_0x4ad460));emit(util[_0x469c('0x28')](_0x469c('0x29'),_0x4ad460['name']),_0x469c('0x2a'),_0x4ad460);io[_0x469c('0x24')](_0x469c('0x2b'),_0x4ad460);}function notSendMessagesQueue(_0x4ef32f){if(_0x4ef32f[_0x469c('0x2c')]){if(_0x4ef32f[_0x469c('0x2d')]===0x0&&_0x4ef32f['pTalking']===0x0){_0x4ef32f[_0x469c('0x2c')]=![];_0x4ef32f[_0x469c('0x2e')]=0x0;_0x4ef32f[_0x469c('0x2f')]=0x0;_0x4ef32f[_0x469c('0x30')]=utils[_0x469c('0x31')]['INACTIVE'];ut[_0x469c('0x32')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4ef32f[_0x469c('0x33')]+'\x20is\x20not\x20active');}else{_0x4ef32f[_0x469c('0x30')]=utils[_0x469c('0x31')][_0x469c('0x34')];ut['logger'](_0x469c('0x35'),_0x4ef32f[_0x469c('0x33')]+_0x469c('0x36'));}}}Preview[_0x469c('0xe')][_0x469c('0x23')]=function(){var _0x254530=this;setInterval(function(){_0x254530[_0x469c('0x37')]();},0x7cf);};Preview[_0x469c('0xe')][_0x469c('0x37')]=function(){var _0x24f674=this[_0x469c('0x13')];this[_0x469c('0x16')]+=0x1;for(var _0x15be7e in _0x24f674){if(_0x24f674[_0x469c('0x38')](_0x15be7e)&&(_0x24f674[_0x15be7e]['dialMethod']===_0x469c('0x4')||_0x24f674[_0x15be7e]['dialMethod']==='booked')&&_0x24f674[_0x15be7e][_0x469c('0x39')]==='outbound'){if(this[_0x469c('0x16')]>0x7){this[_0x469c('0x16')]=0x0;this[_0x469c('0x3a')]();}}if(_0x24f674[_0x469c('0x38')](_0x15be7e)&&_0x24f674[_0x15be7e]['dialMethod']===_0x469c('0x4')&&_0x24f674[_0x15be7e]['type']===_0x469c('0x3b')){if(_0x24f674[_0x15be7e]['dialActive']){this[_0x469c('0x3c')](_0x24f674[_0x15be7e]);if(_0x24f674[_0x15be7e][_0x469c('0x3d')])this['recallMe'](_0x24f674[_0x15be7e]);}else{notSendMessagesQueue(_0x24f674[_0x15be7e]);}}}};Preview[_0x469c('0xe')][_0x469c('0x3e')]=function(_0x3c14f9){var _0x1045e9=this;this[_0x469c('0x12')]['enqueue'](function(){if(!_[_0x469c('0x3f')](_0x1045e9[_0x469c('0x40')][_0x3c14f9])){loggerAction['info'](_0x469c('0x41'),_0x3c14f9,_0x469c('0x42'),_0x1045e9[_0x469c('0x40')][_0x3c14f9][_0x469c('0x43')],_0x469c('0x44'),JSON['stringify'](_0x1045e9['campaignsPreview'][_0x1045e9['actions'][_0x3c14f9][_0x469c('0x43')]][_0x469c('0x2d')]),_0x469c('0x45'),JSON[_0x469c('0x27')](_0x1045e9[_0x469c('0x13')][_0x1045e9[_0x469c('0x40')][_0x3c14f9]['queue']][_0x469c('0x46')]),JSON[_0x469c('0x27')](_0x1045e9['actions'][_0x3c14f9][_0x469c('0x47')]),JSON[_0x469c('0x27')](_[_0x469c('0x48')](_0x1045e9['actions'][_0x3c14f9],[_0x469c('0x49'),'UserId',_0x469c('0x4a'),'ListId'])));return ami[_0x469c('0x4b')]({'action':_0x469c('0x4c'),'channel':_0x1045e9[_0x469c('0x40')][_0x3c14f9][_0x469c('0x4d')]})[_0x469c('0x4e')](function(_0xaf049e){if(_0xaf049e[_0x469c('0x30')]===_0x469c('0x4f')){setTimeout(function(){if(_0x1045e9['actions'][_0x3c14f9]){utils['decrementOriginate'](_0x1045e9['campaignsPreview'][_0x1045e9['actions'][_0x3c14f9]['queue']],_0x469c('0x50'));if(_0x1045e9[_0x469c('0x40')][_0x3c14f9][_0x469c('0x47')]===!![]){ut[_0x469c('0x51')](_0x1045e9[_0x469c('0x13')][_0x1045e9[_0x469c('0x40')][_0x3c14f9]['queue']],_0x469c('0x50'));ut[_0x469c('0x52')](_0x469c('0x53')+_0x3c14f9,_0x1045e9[_0x469c('0x40')][_0x3c14f9]['queue']);}ut[_0x469c('0x52')]('[Dialer][checkChannel][Preview]'+_0x3c14f9,_0x1045e9[_0x469c('0x40')][_0x3c14f9]['queue']);delete _0x1045e9[_0x469c('0x40')][_0x3c14f9];}},0x2328);}});}});};Preview[_0x469c('0xe')][_0x469c('0x3a')]=function(){var _0xdd48b=this;loggerAction[_0x469c('0x25')](_0x469c('0x54'),_['size'](this[_0x469c('0x40')]));for(var _0x38339a in this[_0x469c('0x40')]){if(_0xdd48b[_0x469c('0x40')][_0x469c('0x38')](_0x38339a)){_0xdd48b[_0x469c('0x3e')](_0x38339a);}}};Preview[_0x469c('0xe')][_0x469c('0x55')]=function(_0x56ecbd){var _0x3552d7=this;rpcDb[_0x469c('0x56')](_0x56ecbd['id'],ut['agentReadyId'](this[_0x469c('0x15')]))[_0x469c('0x57')](function(_0x348866){if(!_[_0x469c('0x3f')](_0x348866)){for(var _0x4a7cc9=0x0;_0x4a7cc9<_0x348866[_0x469c('0x58')];_0x4a7cc9+=0x1){if(ut[_0x469c('0x59')](_0x348866[_0x4a7cc9]['scheduledat'])<_0x56ecbd[_0x469c('0x5a')]*0x3c){if(_0x348866[_0x4a7cc9][_0x469c('0x5b')]&&!_0x348866[_0x4a7cc9][_0x469c('0x5b')][_0x469c('0x5c')]){_0x3552d7[_0x469c('0x5d')](_0x348866[_0x4a7cc9]['id'])[_0x469c('0x57')](ut[_0x469c('0x5e')](_0x469c('0x5f')))[_0x469c('0x4e')](ut[_0x469c('0x5e')](_0x469c('0x5f')));}else{rpcDb[_0x469c('0x60')](_0x348866[_0x4a7cc9]['id']);}}else{var _0x452075=new Action(_0x348866[_0x4a7cc9],_0x56ecbd);_0x452075[_0x469c('0x61')]=moment()[_0x469c('0x28')](_0x469c('0x62'));_0x56ecbd[_0x469c('0x63')]+=0x1;ut[_0x469c('0x64')](_0x452075,0x17,'RecallInQueue');if(_0x56ecbd['dialRecallInQueue']){rpcDb[_0x469c('0x65')](ut[_0x469c('0x66')](_0x348866[_0x4a7cc9]));rpcDb[_0x469c('0x67')](_0x452075,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x452075,0x16,_0x469c('0x68'));rpcDb['createCustomerHistory'](_0x452075,_0x469c('0x69'));rpcDb[_0x469c('0x6a')](_0x452075,_0x469c('0x69'));}}}}})['catch'](ut[_0x469c('0x5e')](_0x469c('0x6b')));};Preview['prototype']['setMessage']=function(_0x119b97){_0x119b97[_0x469c('0x2c')]=!![];if(ut[_0x469c('0x6c')](_0x119b97['loggedIn'])){_0x119b97[_0x469c('0x30')]=utils[_0x469c('0x31')][_0x469c('0x6d')];}else if(!ut['isActive'](_0x119b97[_0x469c('0x6e')])){_0x119b97['message']=utils['CAMPAIGN_STATUS'][_0x469c('0x6f')];}else if(!this[_0x469c('0x70')](_0x119b97[_0x469c('0x71')])){if(!this[_0x469c('0x70')](_0x119b97[_0x469c('0x72')])){_0x119b97[_0x469c('0x30')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x119b97['message']=utils[_0x469c('0x31')][_0x469c('0x73')];}}else{_0x119b97[_0x469c('0x30')]=utils[_0x469c('0x31')]['ACTIVE'];}};Preview[_0x469c('0xe')]['callProgressDetectingCustomer']=function(_0x633209,_0x5e78d3,_0x1b4604){var _0x50af71=this;var _0x2ae992=this[_0x469c('0x40')][_0x5e78d3];var _0x597fee=this[_0x469c('0x13')][_0x2ae992[_0x469c('0x43')]];var _0x14de92;var _0x15f617=![];var _0x27216e=0x2;var _0x3a6bed=0x3;if(_0x597fee){switch(_0x1b4604){case'1':_0x597fee['outboundNoSuchCallsDay']+=0x1;_0x2ae992[_0x469c('0x74')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x0,'NoSuchNumber');ami['emit'](_0x469c('0x77'),ut[_0x469c('0x78')](_0x2ae992,'nosuchnumber'));rpcDb[_0x469c('0x67')](_0x2ae992,'[callProgressDetectingCustomer][logNoSuch]');_0x50af71[_0x469c('0x79')](_0x2ae992,'0',_0x597fee)[_0x469c('0x57')](function(_0x57332e){_0x15f617=_0x57332e[_0x469c('0x7a')]==0x1;_0x27216e=_0x597fee[_0x469c('0x7b')];_0x3a6bed=_0x597fee['callAdditionalPhoneAfterMin'];if(!_0x15f617){if(ut['totalGlobal'](_0x2ae992)>=_0x597fee['dialGlobalMaxRetry']){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,_0x469c('0x7d'));rpcDb[_0x469c('0x6a')](_0x14de92,_0x469c('0x7e'));}else{if(_0x2ae992[_0x469c('0x74')]>=_0x597fee[_0x469c('0x7f')]){rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0x7e'));}else{rpcDb['rescheduleContact'](ut[_0x469c('0x80')](_0x2ae992,'countnosuchnumberretry',_0x597fee[_0x469c('0x7b')]),_0x2ae992[_0x469c('0x81')],_0x2ae992['activeContact']);}}delete this[_0x469c('0x40')][_0x633209[_0x469c('0x82')]];}else{_0x2ae992[_0x469c('0x74')]++;logger[_0x469c('0x25')](_0x469c('0x83'),_0x2ae992[_0x469c('0x74')]);logger[_0x469c('0x25')]('id',_0x2ae992['idContact']);_0x50af71[_0x469c('0x84')]({'id':_0x2ae992['idContact'],'field':{'countnosuchnumberretry':_0x2ae992[_0x469c('0x74')]}})[_0x469c('0x57')](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)['then'](function(){});});}});break;case _0x469c('0x86'):var _0x28b8ae=moment()[_0x469c('0x28')](_0x469c('0x62'));_0x2ae992['responsetime']=_0x28b8ae;_0x2ae992[_0x469c('0x87')]=_0x28b8ae;_0x2ae992[_0x469c('0x47')]=!![];_0x597fee[_0x469c('0x46')]+=0x1;logger[_0x469c('0x25')]('[syncHangup][talking][increment]',_0x2ae992[_0x469c('0x88')],_0x469c('0x89'),_0x597fee[_0x469c('0x33')],_0x469c('0x45'),_0x597fee['pTalking']);ami[_0x469c('0x24')](_0x469c('0x8a'),ut[_0x469c('0x78')](_0x2ae992,'connect',this[_0x469c('0x13')][_0x2ae992[_0x469c('0x43')]]));if(_0x597fee['acw']||_0x597fee[_0x469c('0x8b')]){ami[_0x469c('0x24')](_0x469c('0x8c'),{'queue':_0x2ae992['queue'],'interface':_0x2ae992[_0x469c('0x8d')],'uniqueid':_0x2ae992[_0x469c('0x88')]});}break;case'16':ami[_0x469c('0x24')](_0x469c('0x8e'),ut[_0x469c('0x78')](_0x2ae992,_0x469c('0x8f'),this[_0x469c('0x13')][_0x2ae992['queue']]));emitVoiceQueueChannelRemove(ut[_0x469c('0x78')](_0x2ae992,'complete'));_0x597fee[_0x469c('0x90')]+=0x1;_0x597fee[_0x469c('0x91')]+=0x1;_0x597fee[_0x469c('0x92')]+=0x1;ut[_0x469c('0x51')](_0x597fee,_0x469c('0x93'));_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x4,_0x469c('0x94'));rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0x95'));rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0x96'));rpcDb['crateCustomerReportQueue'](_0x2ae992);_0x597fee[_0x469c('0x97')]+=_0x2ae992[_0x469c('0x98')];_0x597fee[_0x469c('0x99')]+=_0x2ae992[_0x469c('0x98')];logger[_0x469c('0x25')](_0x469c('0x9a'),_0x2ae992[_0x469c('0x88')],'\x20Queue',_0x597fee[_0x469c('0x33')],'pTalking:\x20',_0x597fee[_0x469c('0x46')]);delete this[_0x469c('0x40')][_0x633209[_0x469c('0x82')]];break;case _0x469c('0x9b'):_0x597fee[_0x469c('0x9c')]+=0x1;_0x2ae992[_0x469c('0x9d')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut['logCustomer'](_0x2ae992,0x5,'Busy');_0x27216e=_0x597fee[_0x469c('0x9e')];_0x3a6bed=_0x597fee['callAdditionalPhoneAfterMin'];ami['emit'](_0x469c('0x9f'),ut[_0x469c('0x78')](_0x2ae992,_0x469c('0xa0')));rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xa1'));_0x50af71[_0x469c('0x79')](_0x2ae992,'5',_0x597fee)[_0x469c('0x57')](function(_0xd6d071){_0x15f617=_0xd6d071[_0x469c('0x7a')]==0x1;if(!_0x15f617){if(ut['totalGlobal'](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,_0x469c('0x7d'));rpcDb[_0x469c('0x6a')](_0x14de92,_0x469c('0xa3'));}else{if(_0x2ae992[_0x469c('0x9d')]>=_0x597fee[_0x469c('0xa4')]){rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xa1'));}else{rpcDb[_0x469c('0xa5')](ut[_0x469c('0x80')](_0x2ae992,_0x469c('0x9d'),_0x597fee[_0x469c('0x9e')]),_0x2ae992[_0x469c('0x81')],_0x2ae992['activeContact']);}}}else{_0x2ae992[_0x469c('0x9d')]++;_0x50af71[_0x469c('0x84')]({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countbusyretry':_0x2ae992[_0x469c('0x9d')]}})[_0x469c('0x57')](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});});}});break;case _0x469c('0xa7'):_0x597fee[_0x469c('0xa8')]+=0x1;_0x2ae992[_0x469c('0xa9')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x3,_0x469c('0xaa'));_0x27216e=_0x597fee['dialNoAnswerRetryFrequency'];_0x3a6bed=_0x597fee['callAdditionalPhoneAfterMin'];var _0x59326a=ut[_0x469c('0xab')](_0x2ae992,_0x597fee);ami[_0x469c('0x24')]('custom:agentnoanswer',_0x59326a);rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xac'));_0x50af71['verifyAdditionalPhones'](_0x2ae992,'3',_0x597fee)['then'](function(_0x24c556){_0x15f617=_0x24c556[_0x469c('0x7a')]==0x1;if(!_0x15f617){if(ut['totalGlobal'](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut['cloneAction'](_0x2ae992,0xf,_0x469c('0x7d'));rpcDb[_0x469c('0x6a')](_0x14de92,_0x469c('0xad'));}else{if(_0x2ae992['countnoanswerretry']>=_0x597fee['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x2ae992,_0x469c('0xac'));}else{rpcDb[_0x469c('0xa5')](ut[_0x469c('0x80')](_0x2ae992,_0x469c('0xa9'),_0x597fee[_0x469c('0xae')]),_0x2ae992[_0x469c('0x81')],_0x2ae992[_0x469c('0xaf')]);}}}else{_0x2ae992['countnoanswerretry']++;_0x50af71[_0x469c('0x84')]({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countnoanswerretry':_0x2ae992[_0x469c('0xa9')]}})['then'](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});});}});break;case'CONGESTION':_0x597fee[_0x469c('0xb0')]+=0x1;_0x2ae992[_0x469c('0xb1')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut['totalGlobal'](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x8,_0x469c('0xb2'));_0x27216e=_0x597fee[_0x469c('0xb3')];_0x3a6bed=_0x597fee['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut[_0x469c('0x78')](_0x2ae992,_0x469c('0xb4')));rpcDb[_0x469c('0x67')](_0x2ae992,'[callProgressDetectingCustomer][logCongestion]');_0x50af71[_0x469c('0x79')](_0x2ae992,'8',_0x597fee)[_0x469c('0x57')](function(_0x53f6f7){_0x15f617=_0x53f6f7[_0x469c('0x7a')]==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee['dialGlobalMaxRetry']){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,'Global');rpcDb[_0x469c('0x6a')](_0x14de92,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x2ae992[_0x469c('0xb1')]>=_0x597fee[_0x469c('0xb5')]){rpcDb[_0x469c('0x6a')](_0x2ae992,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2ae992,_0x469c('0xb1'),_0x597fee['dialBusyRetryFrequency']),_0x2ae992[_0x469c('0x81')],_0x2ae992['activeContact']);}}}else{_0x2ae992[_0x469c('0xb1')]++;_0x50af71['incrementPreviewCounters']({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countcongestionretry':_0x2ae992[_0x469c('0xb1')]}})[_0x469c('0x57')](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)['then'](function(){});});}});break;case _0x469c('0xb6'):_0x597fee[_0x469c('0xb7')]+=0x1;_0x2ae992[_0x469c('0xb8')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x14,_0x469c('0xb9'));_0x27216e=_0x597fee[_0x469c('0xba')];_0x3a6bed=_0x597fee['callAdditionalPhoneAfterMin'];ami[_0x469c('0x24')](_0x469c('0xbb'),ut[_0x469c('0x78')](_0x2ae992,_0x469c('0xbc')));rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xbd'));_0x50af71[_0x469c('0x79')](_0x2ae992,'20',_0x597fee)[_0x469c('0x57')](function(_0x29b074){_0x15f617=_0x29b074[_0x469c('0x7a')]==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x14de92,_0x469c('0xbe'));}else{if(_0x2ae992[_0x469c('0xb8')]>=_0x597fee[_0x469c('0xbf')]){rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xbe'));}else{rpcDb[_0x469c('0xa5')](ut['scheduledAt'](_0x2ae992,_0x469c('0xb8'),_0x597fee['dialAgentRejectRetryFrequency']),_0x2ae992[_0x469c('0x81')],_0x2ae992[_0x469c('0xaf')]);}}}else{_0x2ae992[_0x469c('0xa9')]++;_0x50af71[_0x469c('0x84')]({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countnoanswerretry':_0x2ae992['countnoanswerretry']}})[_0x469c('0x57')](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});});}});break;case'ABANDONED':_0x597fee[_0x469c('0xc0')]+=0x1;_0x2ae992[_0x469c('0xc1')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut['totalGlobal'](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0xb,_0x469c('0xc2'));rpcDb['createCustomerHistory'](_0x2ae992,_0x469c('0xc3'));_0x50af71[_0x469c('0x79')](_0x2ae992,'11',_0x597fee)['then'](function(_0x5ab789){_0x15f617=_0x5ab789['additional']==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,'Global');rpcDb['createCustomerFinal'](_0x14de92,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2ae992[_0x469c('0xc4')]>=_0x597fee[_0x469c('0xc5')]){rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xc3'));}else{rpcDb[_0x469c('0xa5')](ut[_0x469c('0x80')](_0x2ae992,_0x469c('0xc1'),_0x597fee['dialAbandonedRetryFrequency']),_0x2ae992[_0x469c('0x81')],_0x2ae992[_0x469c('0xaf')]);}}}else{_0x2ae992[_0x469c('0xa9')]++;_0x50af71[_0x469c('0x84')]({'id':_0x2ae992['idContact'],'field':{'countnoanswerretry':_0x2ae992[_0x469c('0xa9')]}})[_0x469c('0x57')](function(){_0x50af71['swapAdditionalPhones'](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});});}});break;case'18':_0x597fee[_0x469c('0xc6')]+=0x1;_0x2ae992[_0x469c('0xc7')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x12,_0x633209[_0x469c('0xc8')]||_0x633209[_0x469c('0xc9')]);ami['emit'](_0x469c('0xca'),ut[_0x469c('0x78')](_0x2ae992,_0x469c('0xcb')));rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xcc'));_0x50af71[_0x469c('0x79')](_0x2ae992,'18',_0x597fee)['then'](function(_0x34afbd){_0x15f617=_0x34afbd['additional']==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee['dialGlobalMaxRetry']){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0x12,_0x469c('0x7d'));rpcDb[_0x469c('0x6a')](_0x14de92,_0x469c('0xcc'));}else{rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xcc'));}}else{_0x2ae992['countnoanswerretry']++;_0x50af71[_0x469c('0x84')]({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countnoanswerretry':_0x2ae992['countnoanswerretry']}})[_0x469c('0x57')](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});});}});delete this[_0x469c('0x40')][_0x633209['linkedid']];break;case'19':_0x597fee[_0x469c('0xc6')]+=0x1;_0x2ae992['countglobal']=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x13,_0x633209[_0x469c('0xc8')]||_0x633209[_0x469c('0xc9')]);ami['emit'](_0x469c('0xca'),ut['buildObj'](_0x2ae992,_0x469c('0xcb')));rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xcd'));_0x50af71['verifyAdditionalPhones'](_0x2ae992,'18',_0x597fee)[_0x469c('0x57')](function(_0x3f6dac){_0x15f617=_0x3f6dac[_0x469c('0x7a')]==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,_0x469c('0x7d'));rpcDb['createCustomerFinal'](_0x14de92,_0x469c('0xcd'));}else{rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xcd'));}}else{_0x2ae992[_0x469c('0xa9')]++;_0x50af71['incrementPreviewCounters']({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countnoanswerretry':_0x2ae992[_0x469c('0xa9')]}})[_0x469c('0x57')](function(){_0x50af71['swapAdditionalPhones'](_0x2ae992,_0x27216e,_0x3a6bed)['then'](function(){});});}});delete this[_0x469c('0x40')][_0x633209['linkedid']];break;default:if(_0x2ae992[_0x469c('0x47')]){ut[_0x469c('0x51')](_0x597fee,_0x469c('0xce'));ut[_0x469c('0x52')](_0x469c('0xcf')+_0x597fee[_0x469c('0x33')],_0x633209);}_0x597fee[_0x469c('0xc6')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0xc,_0x633209['cause-txt']||_0x633209[_0x469c('0xc9')]);_0x27216e=_0x597fee[_0x469c('0xba')];_0x3a6bed=_0x597fee[_0x469c('0xd0')];rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xd1'));_0x50af71[_0x469c('0x79')](_0x2ae992,'20',_0x597fee)[_0x469c('0x57')](function(_0x33f947){_0x15f617=_0x33f947['additional']==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,_0x469c('0x7d'));rpcDb[_0x469c('0x6a')](_0x14de92,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xd2'));}delete this['actions'][_0x633209[_0x469c('0x82')]];}else{_0x50af71['swapAdditionalPhones'](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});}});}if(!(_0x2ae992[_0x469c('0x47')]&&_0x1b4604==='16')){utils[_0x469c('0xd3')](_0x597fee,'[callProgressDetectingCustomer]');logger[_0x469c('0x25')](_0x469c('0xd4'),_0x2ae992[_0x469c('0x88')],'\x20Queue',_0x597fee['name'],_0x469c('0x44'),_0x597fee[_0x469c('0x2d')]);}if(_0x1b4604!==_0x469c('0x86')){delete this[_0x469c('0x40')][_0x633209['linkedid']];delete this[_0x469c('0x40')][_0x633209[_0x469c('0xd5')]];}_0x597fee[_0x469c('0xd6')]=!![];}};Preview[_0x469c('0xe')][_0x469c('0xd7')]=function(_0x3b1ab5,_0x37369d,_0x441d0e){if(_[_0x469c('0xd8')](_0x37369d)&&_0x469c('0xd9')!==typeof _0x37369d){return;}if(_[_0x469c('0xd8')](_0x441d0e)&&_0x469c('0xd9')!==typeof _0x441d0e){return;}switch(_0x441d0e[_0x469c('0xda')]){case'0':ut[_0x469c('0xdb')](_0x3b1ab5,0x0,_0x469c('0xdc'));rpcDb[_0x469c('0xdd')](_0x3b1ab5,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x469c('0xdb')](_0x3b1ab5,0x3,_0x469c('0xaa'));rpcDb[_0x469c('0xdd')](_0x3b1ab5,_0x469c('0xde'));break;case'5':ut[_0x469c('0xdb')](_0x3b1ab5,0x5,_0x469c('0xdf'));rpcDb[_0x469c('0xdd')](_0x3b1ab5,_0x469c('0xe0'));break;case'8':ut[_0x469c('0xdb')](_0x3b1ab5,0x8,'Congestion');rpcDb[_0x469c('0xdd')](_0x3b1ab5,_0x469c('0xe1'));break;case'22':ut[_0x469c('0xdb')](_0x3b1ab5,0x16,_0x469c('0xe2'));rpcDb['createAgentHistory'](_0x3b1ab5,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x469c('0xdb')](_0x3b1ab5,0xc,_0x441d0e[_0x469c('0xda')]);rpcDb[_0x469c('0xdd')](_0x3b1ab5,_0x469c('0xe1'));}utils['decrementOriginate'](_0x37369d,'[callProgressDetectingAgent]');logger['info'](_0x469c('0xe3'),_0x3b1ab5[_0x469c('0x88')],_0x469c('0x89'),_0x37369d[_0x469c('0x33')],_0x469c('0x44'),_0x37369d[_0x469c('0x2d')]);delete this['actions'][_0x3b1ab5[_0x469c('0x88')]];};Preview['prototype'][_0x469c('0x79')]=function(_0x1a9ee5,_0x3e9d05,_0x432b97){return cmHopperAdditionalPhone[_0x469c('0x79')](_0x1a9ee5,_0x3e9d05,_0x432b97)[_0x469c('0x4e')](logger[_0x469c('0x25')]('[verifyAdditionalPhone]\x20'));};Preview[_0x469c('0xe')][_0x469c('0x85')]=function(_0x37d9ed,_0x2fa44d,_0x4f5574){return cmHopperAdditionalPhone[_0x469c('0x85')](_0x37d9ed,_0x2fa44d,_0x4f5574)['catch'](logger[_0x469c('0x25')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0x469c('0x84')]=function(_0x59346b){return Promise[_0x469c('0xe4')]()[_0x469c('0x57')](cmHopperAdditionalPhone[_0x469c('0x84')](_0x59346b))[_0x469c('0x4e')](logger[_0x469c('0x25')](_0x469c('0xe5')));};Preview['prototype']['checkInBlack']=function(_0x42e324,_0x13e6ff,_0x1065ce,_0x1f1f56,_0xcc233a){var _0x541ec5=this;return new Promise(function(_0x533505,_0x3116af){if(_['isNil'](_0x13e6ff)||_[_0x469c('0x3f')](_0x13e6ff[_0x469c('0xe6')])||_[_0x469c('0x3f')](_0x13e6ff[_0x469c('0xe7')])||_['isNil'](_0x13e6ff[_0x469c('0x4a')])){_0x3116af(ut['message'](_0x469c('0xe8'),_0x1f1f56,_0xcc233a));return;}var _0x8dde=uuid['v4']();var _0x4d6d18=_0x541ec5[_0x469c('0x13')][_0x13e6ff[_0x469c('0x42')]['name']];var _0x5e3cb6=_0x1065ce?_0x541ec5['agents'][_0x1065ce]['id']:undefined;_0x541ec5[_0x469c('0x40')][_0x8dde]=new Action(_0x13e6ff,_0x4d6d18,_0x8dde,_0x1065ce,_0x5e3cb6);var _0x2825dd=_0x541ec5['actions'][_0x8dde];_0x2825dd[_0x469c('0x81')]=_0x1f1f56;_0x2825dd['activeContact']=_0xcc233a;_0x2825dd[_0x469c('0xe9')]=_0x1065ce;if(_[_0x469c('0xea')](_0x42e324)){_0x541ec5[_0x469c('0xeb')](_0x2825dd,_0x4d6d18,_0x13e6ff,_0x1065ce)['then'](function(_0x3d0c44){logger[_0x469c('0x25')](_0x469c('0xec'),_0x469c('0xed')+_0x2825dd['queue']+'\x20IdHopper:\x20'+_0x2825dd[_0x469c('0xa6')],JSON[_0x469c('0x27')](_0x3d0c44));ami[_0x469c('0x24')]('custom:agentcalled',ut[_0x469c('0x78')](_0x2825dd,_0x469c('0xee'),_0x541ec5['campaignsPreview'][_0x2825dd[_0x469c('0x43')]]));_0x533505(ut['message'](_0x469c('0xef')));})[_0x469c('0x4e')](function(_0x50dde8){ut[_0x469c('0x32')](_0x469c('0xf0'),_0x50dde8);_0x3116af(ut[_0x469c('0x30')]('Call\x20failed',_0x1f1f56,_0xcc233a));});}else{_0x4d6d18[_0x469c('0xf1')]+=0x1;ut[_0x469c('0xf2')](_0x2825dd);rpcDb[_0x469c('0xf3')](_0x2825dd,_0x469c('0xf4'));delete _0x541ec5[_0x469c('0x40')][_0x8dde];_0x3116af(ut[_0x469c('0x30')](_0x469c('0xf5'),_0x1f1f56,_0xcc233a));}});};Preview[_0x469c('0xe')][_0x469c('0x70')]=function(_0x2daf1a){return!_[_0x469c('0x3f')](_0x2daf1a)&&!_[_0x469c('0x3f')](_0x2daf1a[_0x469c('0x33')])&&!_[_0x469c('0x3f')](_0x2daf1a[_0x469c('0xf6')])&&_0x2daf1a[_0x469c('0xf6')]&&!_[_0x469c('0x3f')](this[_0x469c('0x14')][util[_0x469c('0x28')]('SIP/%s',_0x2daf1a[_0x469c('0x33')])])&&!_['isNil'](this[_0x469c('0x14')][util[_0x469c('0x28')](_0x469c('0xf7'),_0x2daf1a[_0x469c('0x33')])]['status'])&&(this[_0x469c('0x14')][util['format'](_0x469c('0xf7'),_0x2daf1a[_0x469c('0x33')])][_0x469c('0x4c')]===_0x469c('0xf8')||this[_0x469c('0x14')][util['format'](_0x469c('0xf7'),_0x2daf1a[_0x469c('0x33')])][_0x469c('0x4c')]===_0x469c('0xf9'));};Preview['prototype'][_0x469c('0x5d')]=function(_0x39d688,_0x5c058d){return this['execRun'](_0x39d688,_0x5c058d)[_0x469c('0x57')](function(_0x559823){return _[_0x469c('0x48')](_0x559823,['message']);})[_0x469c('0x4e')](function(_0x22d1c1){if(_0x22d1c1[_0x469c('0xfa')]){rpcDb[_0x469c('0xfb')](_0x39d688);}if(_0x22d1c1['active']){rpcDb[_0x469c('0x60')](_0x39d688);}throw _['pick'](_0x22d1c1,[_0x469c('0x30')]);});};Preview[_0x469c('0xe')][_0x469c('0xfc')]=function(_0x32a0bc,_0x1112bf){var _0x432b9e=this;var _0x59c1d9,_0x4186da;return rpcDb[_0x469c('0xfd')](_0x32a0bc)[_0x469c('0x57')](function(_0x5e4501){if(!_[_0x469c('0x3f')](_0x5e4501[0x0])){_0x4186da=_0x5e4501[0x0]['recallme']?![]:!![];_0x59c1d9=_0x5e4501[0x0][_0x469c('0xfe')]?!![]:![];_0x59c1d9=_0x1112bf?!![]:_0x59c1d9;}var _0x3ca9ad=_0x432b9e[_0x469c('0xff')](_0x5e4501);if(_0x3ca9ad[_0x469c('0x100')]){rpcDb[_0x469c('0x101')](_['pick'](_0x5e4501[0x0],[_0x469c('0x4a'),'phone']))[_0x469c('0x57')](function(_0x5c4382){_0x432b9e[_0x469c('0x102')](_0x5c4382,_0x5e4501[0x0],_0x1112bf,_0x4186da,_0x59c1d9)['then'](function(_0x236113){return _0x236113;})[_0x469c('0x4e')](function(_0x5d0e49){throw _0x5d0e49;});})[_0x469c('0x4e')](function(_0xb73c9f){ut[_0x469c('0x32')]('[Preview][checkIsBlackList]',_0xb73c9f);throw ut[_0x469c('0x30')](_0x469c('0x103'),_0x4186da,_0x59c1d9);});}else{throw ut[_0x469c('0x30')](_0x3ca9ad['message'],_0x4186da,_0x59c1d9);}})[_0x469c('0x4e')](function(_0x4a91b2){ut[_0x469c('0x32')](_0x469c('0x104'),_0x4a91b2);throw ut['message'](_0x469c('0x103'),![],!![]);});};Preview[_0x469c('0xe')][_0x469c('0xff')]=function(_0x500c35){if(_[_0x469c('0x3f')](_0x500c35)||_[_0x469c('0xea')](_0x500c35)||!_[_0x469c('0x3f')](_0x500c35[0x0][_0x469c('0x5b')])&&_[_0x469c('0x3f')](_0x500c35[0x0][_0x469c('0x5b')][_0x469c('0x33')])){ut[_0x469c('0x32')]('[Preview][validateContact][Empty\x20Contact]',_0x500c35);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2ed208=this[_0x469c('0x13')][_0x500c35[0x0]['Queue'][_0x469c('0x33')]];_0x2ed208['message']=utils[_0x469c('0x31')][_0x469c('0x73')];if(_['isNil'](_0x2ed208)){ut['logger'](_0x469c('0x105'),_0x2ed208);return{'isValid':![],'message':_0x469c('0x106')};}if(!this['isTrunkReachable'](_0x2ed208[_0x469c('0x71')])){ut[_0x469c('0x32')](_0x469c('0x107'),'campaign\x20Name:\x20'+_0x2ed208[_0x469c('0x33')]+_0x469c('0x108'));if(!this['isTrunkReachable'](_0x2ed208['TrunkBackup'])){ut['logger'](_0x469c('0x107'),_0x2ed208[_0x469c('0x33')]+_0x469c('0x109'));return{'isValid':![],'message':_0x469c('0x10a')};}}if(!ut[_0x469c('0x10b')](_0x2ed208[_0x469c('0x6e')])){ut['logger'](_0x469c('0x10c'),_0x2ed208[_0x469c('0x33')]+_0x469c('0x10d'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2ed208[_0x469c('0x33')]+_0x469c('0x10d')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x469c('0xe')]['execCall']=function(_0x423b2f,_0x2ca937,_0x617126,_0x5e0653){var _0x3ab2f0=this;return new Promise(function(_0x13eab2,_0x49606){var _0x2885d7=_0x423b2f[_0x469c('0x88')];var _0x188775=_0x3ab2f0[_0x469c('0x70')](_0x2ca937['Trunk'])?util['format'](_0x469c('0x10e'),_0x2ca937[_0x469c('0x71')]['name'],_[_0x469c('0x3f')](_0x2ca937[_0x469c('0x10f')])?'':_0x2ca937[_0x469c('0x10f')]['trim']()||'',_0x2ca937[_0x469c('0x110')]>0x0?_0x617126[_0x469c('0xe7')]['substring'](_0x2ca937[_0x469c('0x110')]):_0x617126[_0x469c('0xe7')]):util[_0x469c('0x28')]('SIP/%s/%s%s',_[_0x469c('0x3f')](_0x2ca937['TrunkBackup'])?_0x2ca937[_0x469c('0x71')][_0x469c('0x33')]:_0x2ca937[_0x469c('0x72')]['name'],_[_0x469c('0x3f')](_0x2ca937[_0x469c('0x10f')])?'':_0x2ca937['dialPrefix'][_0x469c('0x111')]()||'',_0x2ca937[_0x469c('0x110')]>0x0?_0x617126[_0x469c('0xe7')][_0x469c('0x112')](_0x2ca937['dialCutDigit']):_0x617126[_0x469c('0xe7')]);var _0x110789=_0x3ab2f0['isTrunkReachable'](_0x2ca937[_0x469c('0x71')])?ut['getCallerId'](_0x2ca937[_0x469c('0x71')]['callerid'],_0x2ca937[_0x469c('0x113')],_0x2ca937['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x469c('0x114')](_0x2ca937[_0x469c('0x115')],_0x2ca937['dialRandomLastDigitCallerIdNumber']):_0x2ca937[_0x469c('0x115')]):ut[_0x469c('0x116')](_['isNil'](_0x2ca937[_0x469c('0x72')])?_0x2ca937[_0x469c('0x71')][_0x469c('0x117')]:_0x2ca937[_0x469c('0x72')][_0x469c('0x117')],_0x2ca937[_0x469c('0x113')],_0x2ca937['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x469c('0x114')](_0x2ca937[_0x469c('0x115')],_0x2ca937['dialRandomLastDigitCallerIdNumber']):_0x2ca937[_0x469c('0x115')]);if(_0x110789){_0x423b2f[_0x469c('0x118')]=ut['extractCalleridName'](_0x110789);_0x423b2f[_0x469c('0x119')]=ut['extractCalleridNumber'](_0x110789);}var _0x148581=ut[_0x469c('0x11a')](_0x2ca937,_0x617126,_0x188775,_0x110789,_0x2885d7,_0x423b2f);var _0x1d94f8=utils[_0x469c('0x11b')](_0x617126[_0x469c('0xe6')]);Object['assign'](_0x148581,_0x1d94f8);_[_0x469c('0x11c')](_0x423b2f,ut[_0x469c('0x11d')](_0x148581));_0x423b2f[_0x469c('0x61')]=moment()[_0x469c('0x28')](_0x469c('0x62'));_0x2ca937[_0x469c('0x11e')]=_0x148581;var _0x2aefe8=ut[_0x469c('0x11f')](_0x423b2f,_0x2ca937,_0x148581,_0x423b2f[_0x469c('0xaf')],_0x5e0653);return ami[_0x469c('0x4b')](_0x2aefe8)[_0x469c('0x57')](function(_0x4adc65){_0x2ca937['originated']+=0x1;logger[_0x469c('0x25')]('[originated][increment]',_0x2885d7,_0x469c('0x89'),_0x2ca937['name'],_0x469c('0x44'),_0x2ca937[_0x469c('0x2d')]);_0x13eab2(_0x4adc65);})[_0x469c('0x4e')](function(_0x1cb8f0){ut[_0x469c('0xdb')](_0x423b2f,0xe,'OriginateError');rpcDb[_0x469c('0xdd')](_0x423b2f,'[originateFailure][logOriginateFailure]');_0x49606(_0x1cb8f0);});});};Preview[_0x469c('0xe')]['syncNewExten']=function(_0x22cee9){if(this['actions'][_0x22cee9[_0x469c('0x82')]]){this[_0x469c('0x40')][_0x22cee9[_0x469c('0x82')]][_0x469c('0x4d')]=_0x22cee9['channel'];}};Preview['prototype'][_0x469c('0x18')]=function(_0x2670cb){var _0x30d1d8=this;var _0x34fa51=this['actions'][_0x2670cb[_0x469c('0x120')]];if(_0x34fa51){if(_0x34fa51['lookAgent']&&this['agents'][_0x34fa51['lookAgent']]){ut[_0x469c('0x121')](_0x34fa51,this['agents'][_0x34fa51['lookAgent']][_0x469c('0x33')],this[_0x469c('0x15')][_0x34fa51[_0x469c('0xe9')]]['id']);}var _0x2c8f61=_[_0x469c('0x122')](_0x34fa51);_0x2c8f61[_0x469c('0x123')]=moment()[_0x469c('0x28')](_0x469c('0x62'));var _0x2fbc01=_0x30d1d8[_0x469c('0x13')][_0x34fa51[_0x469c('0x43')]];if(ut[_0x469c('0x124')](_0x2670cb['response'])){if(_0x34fa51[_0x469c('0x81')]){rpcDb['unlockContact'](_0x34fa51[_0x469c('0xa6')]);}if(_0x34fa51['activeContact']){rpcDb['disableContact'](_0x34fa51[_0x469c('0xa6')]);}ami[_0x469c('0x24')](_0x469c('0x125'),ut[_0x469c('0x78')](_0x34fa51,'rejected',this[_0x469c('0x13')][_0x34fa51[_0x469c('0x43')]]));this['callProgressDetectingAgent'](_0x2c8f61,_0x2fbc01,_0x2670cb);}else{_0x34fa51[_0x469c('0x61')]=moment()[_0x469c('0x28')](_0x469c('0x62'));ut[_0x469c('0xdb')](_0x2c8f61,0x4,_0x469c('0x94'));rpcDb[_0x469c('0xdd')](_0x2c8f61,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x469c('0xe')]['syncHangup']=function(_0x44cd13){var _0x5c2d6d=this['actions'][_0x44cd13[_0x469c('0x82')]];var _0x2ca196;if(_0x5c2d6d){_0x2ca196=this[_0x469c('0x13')][_0x5c2d6d[_0x469c('0x43')]];logger['info'](_0x469c('0x126'),_0x44cd13[_0x469c('0x82')],_0x469c('0x89'),_0x2ca196[_0x469c('0x33')],_0x469c('0x45'),_0x2ca196[_0x469c('0x46')]);}if(this[_0x469c('0x40')][_0x44cd13['linkedid']]&&_0x44cd13[_0x469c('0x82')]!==_0x44cd13[_0x469c('0x88')]){if(_0x44cd13[_0x469c('0x127')]==='16'&&this[_0x469c('0x40')][_0x44cd13[_0x469c('0x82')]][_0x469c('0x47')]){this[_0x469c('0x128')](_0x44cd13,_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')]);}else if(this[_0x469c('0x40')][_0x44cd13[_0x469c('0x82')]]['dialAnswer']){logger[_0x469c('0x25')]('[syncHangup][talking][cause]',_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')],'\x20Queue',_0x2ca196['name'],_0x469c('0x45'),_0x2ca196[_0x469c('0x46')]);this[_0x469c('0x128')](_0x44cd13,_0x44cd13['linkedid'],_0x44cd13[_0x469c('0x127')]);}}else if(_0x5c2d6d&&_[_0x469c('0x3f')](_0x5c2d6d[_0x469c('0x129')])&&_0x2ca196[_0x469c('0x12a')]&&_0x44cd13[_0x469c('0x82')]===_0x44cd13[_0x469c('0x88')]&&_['isNil'](_0x44cd13[_0x469c('0xda')])&&_0x44cd13['cause']==='16'&&_0x44cd13[_0x469c('0x12b')]==='6'&&_[_0x469c('0xd8')](_0x5c2d6d['transfer'])){if(_0x5c2d6d[_0x469c('0x81')]){rpcDb[_0x469c('0xfb')](_0x5c2d6d[_0x469c('0xa6')]);}if(_0x5c2d6d[_0x469c('0xaf')]){rpcDb['disableContact'](_0x5c2d6d[_0x469c('0xa6')]);}_0x44cd13[_0x469c('0xda')]='22';this[_0x469c('0xd7')](_0x5c2d6d,_0x2ca196,_0x44cd13);}else if(_0x5c2d6d&&_0x5c2d6d['transfer']){if(_0x44cd13[_0x469c('0x127')]==='16'&&this['actions'][_0x44cd13[_0x469c('0x82')]]['dialAnswer']){logger[_0x469c('0x25')](_0x469c('0x12c'),_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')],'\x20Queue',_0x2ca196['name'],_0x469c('0x45'),_0x2ca196['pTalking']);this[_0x469c('0x128')](_0x44cd13,_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')]);}else if(this['actions'][_0x44cd13[_0x469c('0x82')]][_0x469c('0x47')]){logger[_0x469c('0x25')]('[syncHangup][talking][cause]',_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')],_0x469c('0x89'),_0x2ca196[_0x469c('0x33')],_0x469c('0x45'),_0x2ca196[_0x469c('0x46')]);this[_0x469c('0x128')](_0x44cd13,_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')]);}}};Preview[_0x469c('0xe')][_0x469c('0x1d')]=function(_0x3aa548){if(this[_0x469c('0x40')][_0x3aa548[_0x469c('0xd5')]]&&_0x3aa548[_0x469c('0xd5')]!==_0x3aa548[_0x469c('0x12d')]){this[_0x469c('0x128')](_0x3aa548,_0x3aa548[_0x469c('0xd5')],_0x3aa548[_0x469c('0xc9')]);}};Preview[_0x469c('0xe')]['syncHangupRequest']=function(_0x542eb4){if(this[_0x469c('0x40')][_0x542eb4['linkedid']]&&_0x542eb4['linkedid']!==_0x542eb4[_0x469c('0x88')]&&!this[_0x469c('0x40')][_0x542eb4[_0x469c('0x82')]][_0x469c('0x47')]){if(_0x542eb4[_0x469c('0x127')]==='1'){this[_0x469c('0x128')](_0x542eb4,_0x542eb4[_0x469c('0x82')],_0x542eb4[_0x469c('0x127')]);}}};Preview[_0x469c('0xe')][_0x469c('0x12e')]=function(_0x30e97c,_0x2863d6,_0x537b4f){if(this['actions'][_0x30e97c]){if(_['isNil'](this[_0x469c('0x40')][_0x30e97c][_0x469c('0x11e')])){this['actions'][_0x30e97c][_0x469c('0x11e')]={};}this[_0x469c('0x40')][_0x30e97c][_0x469c('0x11e')][_0x2863d6]=_0x537b4f;}};Preview[_0x469c('0xe')][_0x469c('0x12f')]=function(_0xde7253){try{if(!_['isNil'](_0xde7253)){if(ut[_0x469c('0x130')](_[_0x469c('0x131')](_0xde7253[_0x469c('0x132')])[0x0])){this[_0x469c('0x12e')](_0xde7253[_0x469c('0x88')],_[_0x469c('0x131')](_0xde7253['variable'])[0x0],_0xde7253[_0x469c('0x133')]);}}}catch(_0x5461a3){logger[_0x469c('0x134')](_0x469c('0x135'),util[_0x469c('0x136')](_0x5461a3,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x469c('0x21')]=function(_0xffe076){if(_0xffe076){if(this[_0x469c('0x40')][_0xffe076[_0x469c('0x137')]]){this[_0x469c('0x40')][_0xffe076['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x469c('0xe')][_0x469c('0x138')]=function(_0x52968e){if(_0x52968e){if(this['actions'][_0x52968e[_0x469c('0x139')]]){this[_0x469c('0x40')][_0x52968e[_0x469c('0x139')]][_0x469c('0x13a')]=!![];}}};module[_0x469c('0x13b')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 2f457a2..de3293c 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 _0x3b7a=['../rpc/agentReportPreview','error','inspect','createHistory','catch','[createHistory]\x20','resolve','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0x3b7a,0x10e));var _0xa3b7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3b7a[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xa3b7('0x0'));var BPromise=require('bluebird');var logger=require(_0xa3b7('0x1'))(_0xa3b7('0x2'));var cmHopper=require(_0xa3b7('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa3b7('0x4'));var agentReportPreview=require(_0xa3b7('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2b9e8a){return function(_0x2a3f42){logger[_0xa3b7('0x6')](_0x2b9e8a,util[_0xa3b7('0x7')](_0x2a3f42,{'showHidden':![],'depth':null}));};}function create(_0xe14882){return cmHopperHistory[_0xa3b7('0x8')](_0xe14882)[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0xa')));}function createAgent(_0x50143d){return BPromise[_0xa3b7('0xb')]()['then'](agentReportPreview['createHistory'](_0x50143d))[_0xa3b7('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x126f94){return cmHopper['moveContactManagedDialer'](_0x126f94,!![])[_0xa3b7('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xa3b7('0xc')]=function(_0x32480e){return cmHopperBlack[_0xa3b7('0xc')](_0x32480e)[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0xd')));};exports[_0xa3b7('0xe')]=function(_0x22745f){return BPromise['resolve']()[_0xa3b7('0xf')](cmHopper[_0xa3b7('0xe')](_0x22745f))[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x10')));};exports[_0xa3b7('0x8')]=function(_0x2949f1,_0x483496){create(_0x2949f1)[_0xa3b7('0x9')](loggerCatch(_0x483496));moveContact(_0x2949f1)[_0xa3b7('0x9')](loggerCatch(_0x483496));};exports[_0xa3b7('0x11')]=function(_0x2a183c,_0x5095da){createAgent(_0x2a183c)[_0xa3b7('0x9')](loggerCatch(_0x5095da));};exports[_0xa3b7('0x12')]=function(_0x8983b,_0x87bc91){create(_0x8983b)[_0xa3b7('0x9')](loggerCatch(_0x87bc91));};exports['createCustomerFinal']=function(_0x288450,_0x13f165){moveContact(_0x288450)['catch'](loggerCatch(_0x13f165));};exports[_0xa3b7('0x13')]=function(_0x5d632c,_0x1bb86d,_0x49be42){if(_0x1bb86d){_0x5d632c[_0xa3b7('0x14')]=null;}if(_0x49be42){_0x5d632c[_0xa3b7('0x15')]=![];}return cmHopper[_0xa3b7('0x13')](_0x5d632c)[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x16')));};exports[_0xa3b7('0x17')]=function(_0x35b980){return cmHopper[_0xa3b7('0x17')](_0x35b980)[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x18')));};exports[_0xa3b7('0x19')]=function(_0x5ef4c3){return cmHopper['unlockContact']({'UserId':null},_0x5ef4c3,0x1)['catch'](loggerCatch(_0xa3b7('0x1a')));};exports['disableContact']=function(_0x6a1a06){return cmHopper[_0xa3b7('0x19')]({'active':![]},_0x6a1a06,0x1)[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x1b')));};exports[_0xa3b7('0x1c')]=function(_0x43554c){var _0x414a4e={};_0x414a4e[_0xa3b7('0x1d')]=_0x43554c[_0xa3b7('0x1d')];_0x414a4e[_0xa3b7('0x1e')]=_0x43554c['uniqueid'];_0x414a4e['calleridnum']=_0x43554c[_0xa3b7('0x1f')];_0x414a4e[_0xa3b7('0x20')]=_0x43554c['calleridname'];_0x414a4e[_0xa3b7('0x21')]=_0x43554c[_0xa3b7('0x21')];_0x414a4e[_0xa3b7('0x22')]=_0x43554c[_0xa3b7('0x23')];_0x414a4e['queuecallerleaveAt']=_0x43554c[_0xa3b7('0x23')];_0x414a4e[_0xa3b7('0x24')]=0x1;_0x414a4e[_0xa3b7('0x25')]=_0x43554c[_0xa3b7('0x26')];_0x414a4e[_0xa3b7('0x27')]=_0x43554c[_0xa3b7('0x28')];_0x414a4e[_0xa3b7('0x29')]=_0xa3b7('0x2a');_0x414a4e[_0xa3b7('0x2b')]=_0xa3b7('0x2c');_0x414a4e[_0xa3b7('0x2d')]=0x0;_0x414a4e[_0xa3b7('0x2e')]=0x1;_0x414a4e[_0xa3b7('0x2f')]=_0x43554c[_0xa3b7('0x28')];_0x414a4e[_0xa3b7('0x30')]=_0xa3b7('0x31');return BPromise[_0xa3b7('0xb')]()[_0xa3b7('0xf')](voiceQueueReport['create'](_0x414a4e))[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x32')));};exports[_0xa3b7('0x33')]=function(_0x2b6ba8,_0x37b90f){return BPromise[_0xa3b7('0xb')]()[_0xa3b7('0xf')](cmHopper[_0xa3b7('0x33')](_0x2b6ba8,_0x37b90f))[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x34')));};exports[_0xa3b7('0x35')]=function(_0x118746){return cmHopper['rescheduleContact'](_0x118746,!![],!![])[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x36')));}; \ No newline at end of file +var _0x949c=['from-sip','xcally-motion-preview','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername'];(function(_0xa2ad96,_0x46aaac){var _0x3113c7=function(_0x4153cc){while(--_0x4153cc){_0xa2ad96['push'](_0xa2ad96['shift']());}};_0x3113c7(++_0x46aaac);}(_0x949c,0x1b2));var _0xc949=function(_0x329397,_0x102228){_0x329397=_0x329397-0x0;var _0x126bf9=_0x949c[_0x329397];return _0x126bf9;};'use strict';var util=require(_0xc949('0x0'));var BPromise=require(_0xc949('0x1'));var logger=require(_0xc949('0x2'))(_0xc949('0x3'));var cmHopper=require(_0xc949('0x4'));var cmHopperHistory=require(_0xc949('0x5'));var cmHopperBlack=require(_0xc949('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xc949('0x7'));function loggerCatch(_0x31bcb8){return function(_0x213505){logger['error'](_0x31bcb8,util[_0xc949('0x8')](_0x213505,{'showHidden':![],'depth':null}));};}function create(_0x230807){return cmHopperHistory[_0xc949('0x9')](_0x230807)[_0xc949('0xa')](loggerCatch(_0xc949('0xb')));}function createAgent(_0x3a0065){return BPromise[_0xc949('0xc')]()['then'](agentReportPreview[_0xc949('0x9')](_0x3a0065))[_0xc949('0xa')](loggerCatch(_0xc949('0xb')));}function moveContact(_0x545a2f){return cmHopper[_0xc949('0xd')](_0x545a2f,!![])[_0xc949('0xa')](loggerCatch(_0xc949('0xe')));}exports[_0xc949('0xf')]=function(_0x1b0773){return cmHopperBlack[_0xc949('0xf')](_0x1b0773)['catch'](loggerCatch(_0xc949('0x10')));};exports[_0xc949('0x11')]=function(_0x508514){return BPromise[_0xc949('0xc')]()[_0xc949('0x12')](cmHopper['getContactPreview'](_0x508514))[_0xc949('0xa')](loggerCatch(_0xc949('0x13')));};exports[_0xc949('0x9')]=function(_0x16872a,_0x39a6e1){create(_0x16872a)[_0xc949('0xa')](loggerCatch(_0x39a6e1));moveContact(_0x16872a)[_0xc949('0xa')](loggerCatch(_0x39a6e1));};exports[_0xc949('0x14')]=function(_0x2f046c,_0x3cb315){createAgent(_0x2f046c)['catch'](loggerCatch(_0x3cb315));};exports[_0xc949('0x15')]=function(_0x2c9d7b,_0x25b7f9){create(_0x2c9d7b)[_0xc949('0xa')](loggerCatch(_0x25b7f9));};exports[_0xc949('0x16')]=function(_0x3e8b98,_0x4f0c68){moveContact(_0x3e8b98)[_0xc949('0xa')](loggerCatch(_0x4f0c68));};exports[_0xc949('0x17')]=function(_0x577fb3,_0x165090,_0x4fee81){if(_0x165090){_0x577fb3[_0xc949('0x18')]=null;}if(_0x4fee81){_0x577fb3['active']=![];}return cmHopper[_0xc949('0x17')](_0x577fb3)[_0xc949('0xa')](loggerCatch(_0xc949('0x19')));};exports[_0xc949('0x1a')]=function(_0x35efd1){return cmHopper['countReScheduled'](_0x35efd1)[_0xc949('0xa')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x24eddd){return cmHopper[_0xc949('0x1b')]({'UserId':null},_0x24eddd,0x1)[_0xc949('0xa')](loggerCatch(_0xc949('0x1c')));};exports[_0xc949('0x1d')]=function(_0x353466){return cmHopper[_0xc949('0x1b')]({'active':![]},_0x353466,0x1)[_0xc949('0xa')](loggerCatch(_0xc949('0x1e')));};exports[_0xc949('0x1f')]=function(_0x3f0d19){var _0x445250={};_0x445250['type']=_0x3f0d19['type'];_0x445250[_0xc949('0x20')]=_0x3f0d19[_0xc949('0x20')];_0x445250[_0xc949('0x21')]=_0x3f0d19[_0xc949('0x21')];_0x445250[_0xc949('0x22')]=_0x3f0d19[_0xc949('0x22')];_0x445250['queue']=_0x3f0d19[_0xc949('0x23')];_0x445250[_0xc949('0x24')]=_0x3f0d19[_0xc949('0x25')];_0x445250[_0xc949('0x26')]=_0x3f0d19['answertime'];_0x445250[_0xc949('0x27')]=0x1;_0x445250['queuecallercompleteAt']=_0x3f0d19[_0xc949('0x28')];_0x445250[_0xc949('0x29')]=_0x3f0d19[_0xc949('0x2a')];_0x445250['context']=_0xc949('0x2b');_0x445250['exten']=_0xc949('0x2c');_0x445250['holdtime']=0x0;_0x445250[_0xc949('0x2d')]=0x1;_0x445250[_0xc949('0x2e')]=_0x3f0d19[_0xc949('0x2a')];_0x445250['queuecallerexitreason']=_0xc949('0x2f');return BPromise['resolve']()['then'](voiceQueueReport[_0xc949('0x30')](_0x445250))[_0xc949('0xa')](loggerCatch(_0xc949('0x31')));};exports[_0xc949('0x32')]=function(_0x5bd01a,_0x14a933){return BPromise[_0xc949('0xc')]()[_0xc949('0x12')](cmHopper[_0xc949('0x32')](_0x5bd01a,_0x14a933))[_0xc949('0xa')](loggerCatch(_0xc949('0x33')));};exports['rescheduleContactInQueue']=function(_0x5f420d){return cmHopper[_0xc949('0x17')](_0x5f420d,!![],!![])['catch'](loggerCatch(_0xc949('0x34')));}; \ 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 c3f0caa..edaea4a 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 _0x36e3=['\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','variablesAction','BOOKED','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalking','pTalking','IsNotLoggedIn','lastevent','name','queue','mandatoryDisposition','agentReadyId','state','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','countbusyretry','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0x36e3,0xf2));var _0x336e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x36e3[_0x37bd26];return _0xe83dc4;};'use strict';var util=require(_0x336e('0x0'));var _=require(_0x336e('0x1'));var moment=require(_0x336e('0x2'));var logger=require(_0x336e('0x3'))('preview');var ipAgi=process[_0x336e('0x4')][_0x336e('0x5')]||_0x336e('0x6');var utils=require('../../dialer/utils');exports[_0x336e('0x7')]=function(_0x4eeffe){return function(_0x46b2ea){logger[_0x336e('0x8')](_0x4eeffe,util[_0x336e('0x9')](_0x46b2ea,{'showHidden':![],'depth':null}));};};exports[_0x336e('0xa')]=function(_0x31dd86,_0x2bd6ba){logger[_0x336e('0xb')](_0x31dd86,util[_0x336e('0x9')](_0x2bd6ba,{'showHidden':![],'depth':null}));};exports[_0x336e('0xc')]=function(_0x26a153,_0x25ad06){logger[_0x336e('0x8')](_0x26a153,util[_0x336e('0x9')](_0x25ad06,{'showHidden':![],'depth':null}));};exports[_0x336e('0xd')]=function(_0x48ddf3){return function(_0x1ffdd6){logger[_0x336e('0xb')](_0x48ddf3,util[_0x336e('0x9')](_0x1ffdd6,{'showHidden':![],'depth':null}));};};exports[_0x336e('0xe')]=function(_0x3b9a48,_0x2547f5,_0x19dcf5){return{'message':_0x3b9a48,'unlock':_0x2547f5,'active':_0x19dcf5};};exports[_0x336e('0xf')]=function(_0x42f8ee,_0x51516a,_0x318007){if(!_[_0x336e('0x10')](_0x318007)&&_0x336e('0x11')===typeof _0x318007&&!_[_0x336e('0x12')](_0x318007)){if(!_[_0x336e('0x10')](_0x51516a)&&_0x336e('0x11')===typeof _0x51516a&&!_[_0x336e('0x12')](_0x51516a)){return util[_0x336e('0x13')]('\x22%s\x22\x20<%s>',_0x51516a,_0x318007);}return util[_0x336e('0x13')](_0x336e('0x14'),_0x318007,_0x318007);}if(!_[_0x336e('0x10')](_0x42f8ee)&&_0x336e('0x11')===typeof _0x42f8ee&&!_[_0x336e('0x12')](_0x42f8ee)){return _0x42f8ee;}return _0x336e('0x15');};exports[_0x336e('0x16')]=function(_0x3cc216){if(_[_0x336e('0x17')](_0x3cc216)){return![];}return _0x3cc216;};exports[_0x336e('0x18')]=function(_0x4dda06,_0x3ae5ed,_0x192234,_0x48b086,_0x6b5172,_0x2d056e){var _0x23ee3a={'XMD-QUEUE':_0x3ae5ed[_0x336e('0x19')]?_0x3ae5ed[_0x336e('0x19')]['name']:'','XMD-CALLERID':_0x48b086,'XMD-CALLERID-PREVIEW':_0x2d056e?util[_0x336e('0x13')](_0x336e('0x14'),_0x2d056e[_0x336e('0x1a')],_0x2d056e[_0x336e('0x1b')]):_0x48b086,'XMD-DIALID':_0x6b5172,'XMD-CONTACTID':_0x3ae5ed['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x48b086,'XMD-VOICEQUEUEID':_0x3ae5ed[_0x336e('0x1c')],'XMD-DIALCHANNEL':_0x192234,'XMD-DIALTIMEOUT':_0x4dda06[_0x336e('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x336e('0x13')](_0x336e('0x1e'),_0x4dda06[_0x336e('0x1f')]?'g':'',_['isEmpty'](_0x4dda06[_0x336e('0x20')])?'':_0x336e('0x21')),'XMD-DIALURL':_0x4dda06[_0x336e('0x22')]||'','XMD-AGI':_0x4dda06[_0x336e('0x23')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4dda06['dialQueueProject']):_0x336e('0x24'),'XMD-AGIAFTER':_0x4dda06[_0x336e('0x1f')]?util['format'](_0x336e('0x25'),ipAgi,_0x4dda06[_0x336e('0x1f')]):_0x336e('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x2d056e?_0x2d056e['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2d056e?_0x2d056e[_0x336e('0x26')]:'','XMD-DESTINATION':_0x336e('0x27'),'SIPADDHEADER':_0x336e('0x28')};if(!_[_0x336e('0x12')](_0x4dda06[_0x336e('0x20')])){_0x23ee3a[util['format']('%s',_0x336e('0x29'))]=_0x4dda06[_0x336e('0x20')];_0x23ee3a[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x6b5172;}return _0x23ee3a;};exports[_0x336e('0x2a')]=function(_0x2910f3){var _0x2e86f3={};for(var _0x47d1f0 in _0x2910f3){if(_0x2910f3[_0x336e('0x2b')](_0x47d1f0)){_0x2e86f3[util['format']('%s',_[_0x336e('0x2c')](_0x47d1f0))]=_0x2910f3[_0x47d1f0];}}return{'variables':_0x2e86f3};};exports['logBlacklist']=function(_0x21a189){var _0x21e369=moment()[_0x336e('0x13')](_0x336e('0x2d'));_0x21a189['state']=0xd;_0x21a189[_0x336e('0x2e')]=_0x336e('0x2f');_0x21a189[_0x336e('0x30')]=_0x21e369;_0x21a189[_0x336e('0x31')]=_0x21e369;_0x21a189['endtime']=_0x21e369;};exports['logAgent']=function(_0x449209,_0x50fb,_0x3485be){var _0x469e53=moment()[_0x336e('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x449209['state']=_0x50fb;_0x449209['statedesc']=_0x3485be;_0x449209['responsetime']=_0x469e53;_0x449209[_0x336e('0x32')]=utils[_0x336e('0x33')](_0x449209[_0x336e('0x31')],_0x449209[_0x336e('0x30')]);};exports[_0x336e('0x34')]=function(_0x257976,_0x21e7c8,_0xaa59cb){_0x257976[_0x336e('0x35')]=_0x21e7c8;_0x257976[_0x336e('0x36')]=_0xaa59cb;};exports[_0x336e('0x37')]=function(_0x59a14d,_0x4f968c,_0x1d0d57){var _0x5422eb=moment()[_0x336e('0x13')](_0x336e('0x2d'));_0x59a14d['state']=_0x4f968c;_0x59a14d['statedesc']=_0x1d0d57;_0x59a14d['responsetime']=_0x59a14d[_0x336e('0x31')]?_0x59a14d['responsetime']:_0x5422eb;_0x59a14d[_0x336e('0x38')]=_0x59a14d[_0x336e('0x38')]?_0x59a14d[_0x336e('0x38')]:_0x5422eb;_0x59a14d[_0x336e('0x32')]=utils[_0x336e('0x33')](_0x59a14d['responsetime']||0x0,_0x59a14d[_0x336e('0x30')]||0x0);_0x59a14d[_0x336e('0x39')]=_0x59a14d[_0x336e('0x3a')]?utils[_0x336e('0x33')](_0x59a14d[_0x336e('0x38')],_0x59a14d[_0x336e('0x3a')]):0x0;};exports['isFailure']=function(_0x572389){return _0x572389==='Failure';};exports[_0x336e('0x3b')]=function(_0x216513,_0x368ed2,_0x158f58,_0x3ca87c,_0x5ca513){var _0xa49777=_0x3ca87c?'RECALL':_0x216513[_0x336e('0x1a')];_0xa49777=_0x5ca513?_0x336e('0x3c'):_0xa49777;return{'actionid':_0x216513[_0x336e('0x3d')],'action':'originate','channel':_0x216513[_0x336e('0x3e')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0xa49777,_0x216513[_0x336e('0x1b')]),'Exten':_0x336e('0x27'),'Context':_0x336e('0x3f'),'Priority':'1','variable':_0x158f58,'timeout':(_0x368ed2[_0x336e('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x216513[_0x336e('0x3d')]};};exports[_0x336e('0x41')]=function(_0x467cc1){return _0x467cc1['countbusyretry']+_0x467cc1[_0x336e('0x42')]+_0x467cc1[_0x336e('0x43')]+_0x467cc1[_0x336e('0x44')]+_0x467cc1['countnosuchnumberretry'];};exports[_0x336e('0x45')]=function(_0x41d435){var _0x3cff43=_['clone'](_0x41d435);_0x3cff43['state']=0xf;_0x3cff43['statedesc']=_0x336e('0x46');return _0x3cff43;};exports[_0x336e('0x47')]=function(_0x42e4fb,_0x52222e,_0x5c60bc){var _0x296522={};_0x296522[_0x52222e]=_0x42e4fb[_0x52222e];_0x296522[_0x336e('0x48')]=![];_0x296522[_0x336e('0x49')]=moment()[_0x336e('0x4a')](_0x5c60bc,_0x336e('0x4b'))[_0x336e('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x296522[_0x336e('0x4c')]=_0x42e4fb[_0x336e('0x4c')];_0x296522[_0x336e('0x4d')]=_0x42e4fb['ListId'];_0x296522['VoiceQueueId']=_0x42e4fb[_0x336e('0x1c')]||undefined;return _0x296522;};exports[_0x336e('0x4e')]=function(_0x2b5f0c,_0x5eea72){if(!_[_0x336e('0x17')](_0x2b5f0c)){if(_0x2b5f0c[_0x336e('0x4f')]>0x0){_0x2b5f0c['pTalking']-=0x1;}else{logger[_0x336e('0xb')](_0x5eea72,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x5eea72,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports[_0x336e('0x50')]=function(_0x4bff0c){if(_0x4bff0c<=0x0){return!![];}return![];};function buildObj(_0x29fff5,_0x350f03,_0xf7a742){_0x29fff5[_0x336e('0x51')]=_0x350f03;_0x29fff5[_0x336e('0x52')]=_0x29fff5[_0x336e('0x53')];_0x29fff5['interface']=_0x29fff5[_0x336e('0x3e')];_0x29fff5['motionChannel']='voice';if(_0xf7a742){_0x29fff5['mandatoryDisposition']=_0xf7a742[_0x336e('0x54')];}return _0x29fff5;}exports['buildObj']=buildObj;exports[_0x336e('0x55')]=function(_0x124450){var _0x40502c=[];for(var _0x2219f7 in _0x124450){if(_0x124450['hasOwnProperty'](_0x2219f7)){if(!_[_0x336e('0x17')](_0x124450[_0x2219f7])&&_0x124450[_0x2219f7][_0x336e('0x56')]==='not_inuse'&&_0x124450[_0x2219f7][_0x336e('0x57')]===_0x336e('0x58')){_0x40502c[_0x336e('0x59')](_0x124450[_0x2219f7]['id']);}}}return _0x40502c;};exports['getDiff']=function(_0x257f28){var _0x50f9af=moment()['milliseconds'](0x0);var _0x3cf1bb=moment(_0x257f28)[_0x336e('0x5a')](0x0);return _0x50f9af[_0x336e('0x5b')](_0x3cf1bb,_0x336e('0x5c'));};exports[_0x336e('0x5d')]=function(_0x41f8d1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x41f8d1[_0x336e('0x4c')],'ListId':_0x41f8d1['ListId'],'VoiceQueueId':_0x41f8d1['VoiceQueueId']||undefined,'CampaignId':_0x41f8d1[_0x336e('0x5e')]||undefined};};exports[_0x336e('0x5f')]=function(_0x462cc5){if(_0x462cc5===_0x336e('0x3d')||_0x462cc5===_0x336e('0x60')||_0x462cc5==='queue'||_0x462cc5===_0x336e('0x61')||_0x462cc5==='campaigntype'||_0x462cc5===_0x336e('0x62')||_0x462cc5===_0x336e('0x35')||_0x462cc5===_0x336e('0x3e')||_0x462cc5===_0x336e('0x1a')||_0x462cc5===_0x336e('0x48')||_0x462cc5===_0x336e('0x1b')||_0x462cc5==='scheduledat'||_0x462cc5===_0x336e('0x63')||_0x462cc5==='countcongestionretry'||_0x462cc5==='countnoanswerretry'||_0x462cc5===_0x336e('0x64')||_0x462cc5===_0x336e('0x65')||_0x462cc5==='callbackuniqueid'||_0x462cc5===_0x336e('0x66')||_0x462cc5===_0x336e('0x67')||_0x462cc5===_0x336e('0x4c')||_0x462cc5==='ListId'||_0x462cc5===_0x336e('0x36')||_0x462cc5===_0x336e('0x1c')||_0x462cc5===_0x336e('0x68')||_0x462cc5===_0x336e('0x69')||_0x462cc5===_0x336e('0x6a')||_0x462cc5===_0x336e('0x6b')||_0x462cc5==='xmd-listid'||_0x462cc5===_0x336e('0x6c')||_0x462cc5===_0x336e('0x6d')||_0x462cc5===_0x336e('0x6e')||_0x462cc5==='xmd-dialid'||_0x462cc5===_0x336e('0x6f')||_0x462cc5===_0x336e('0x70')||_0x462cc5===_0x336e('0x71')||_0x462cc5===_0x336e('0x72')||_0x462cc5==='xmd-agiafter'||_0x462cc5==='xmd-agi'||_0x462cc5==='rtpaudioqos'||_0x462cc5===_0x336e('0x73')||_0x462cc5==='rtpaudioqosjitter'||_0x462cc5===_0x336e('0x74')||_0x462cc5===_0x336e('0x75')||_0x462cc5===_0x336e('0x76')||_0x462cc5==='rtpaudioqosrtt'||_0x462cc5==='rtpaudioqosrttbridged'||_0x462cc5==='rtpaudioqos'||_0x462cc5==='rtpaudioqosbridged'||_0x462cc5==='rtpaudioqosjitter'||_0x462cc5===_0x336e('0x74')||_0x462cc5===_0x336e('0x75')||_0x462cc5===_0x336e('0x76')||_0x462cc5===_0x336e('0x77')||_0x462cc5===_0x336e('0x78')||_0x462cc5===_0x336e('0x79')||_0x462cc5===_0x336e('0x7a')||_0x462cc5==='state'||_0x462cc5==='statedesc'){return![];}return!![];};exports[_0x336e('0x7b')]=function(_0x2f2fe8,_0xe7aced){var _0x1502c1,_0x310532,_0x572cbf;if(_0xe7aced<=0x0){_0xe7aced=0x1;}_0x1502c1=new RegExp(_0x336e('0x7c')+_0xe7aced+'}$');_0x310532=Math['pow'](0xa,_0xe7aced-0x1);_0x572cbf=Math[_0x336e('0x7d')](0xa,_0xe7aced)-0x1;return util['format']('%s',_[_0x336e('0x7e')](_0x2f2fe8,_0x1502c1,_['random'](_0x310532,_0x572cbf)));};exports[_0x336e('0x7f')]=function(_0x45cfe6){var _0x3d74b5=_0x45cfe6[_0x336e('0x80')](/"(.*?)"/);return _0x3d74b5?_0x3d74b5[0x1]:_0x45cfe6;};exports[_0x336e('0x81')]=function(_0x5e6127){var _0x55ad56=_0x5e6127['match'](/<(.*?)>/);return _0x55ad56?_0x55ad56[0x1]:_0x5e6127;};function buildNoAnswerEventPayload(_0x1e4501,_0x50a7e7){var _0x17848a=buildObj(_0x1e4501,_0x336e('0x82'));if(!_[_0x336e('0x12')](_0x50a7e7['variables'])){Object[_0x336e('0x83')](_0x50a7e7[_0x336e('0x84')])[_0x336e('0x85')](function(_0x28a920){_0x17848a[_0x28a920[_0x336e('0x86')]()]=_0x50a7e7[_0x336e('0x84')][_0x28a920];});}return _0x17848a;}exports[_0x336e('0x87')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xcca9=['YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','statedesc','ringtime','getSeconds','logLookAgent','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','uniqueid','originate','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','active','scheduledat','add','ListId','isNil','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','channelAgent','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','dialAnswer','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridNumber','variables','forEach','toLowerCase','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','logBlacklist'];(function(_0x19925b,_0x2454d7){var _0x3b2c8e=function(_0x4fee09){while(--_0x4fee09){_0x19925b['push'](_0x19925b['shift']());}};_0x3b2c8e(++_0x2454d7);}(_0xcca9,0x160));var _0x9cca=function(_0x5c3891,_0x284f4c){_0x5c3891=_0x5c3891-0x0;var _0x34ecda=_0xcca9[_0x5c3891];return _0x34ecda;};'use strict';var util=require(_0x9cca('0x0'));var _=require(_0x9cca('0x1'));var moment=require(_0x9cca('0x2'));var logger=require(_0x9cca('0x3'))(_0x9cca('0x4'));var ipAgi=process[_0x9cca('0x5')][_0x9cca('0x6')]||_0x9cca('0x7');var utils=require(_0x9cca('0x8'));exports['loggerCatch']=function(_0x7cb36f){return function(_0x4748fd){logger[_0x9cca('0x9')](_0x7cb36f,util[_0x9cca('0xa')](_0x4748fd,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5a2a60,_0x7ccded){logger[_0x9cca('0xb')](_0x5a2a60,util[_0x9cca('0xa')](_0x7ccded,{'showHidden':![],'depth':null}));};exports[_0x9cca('0xc')]=function(_0x4591d0,_0x44739f){logger[_0x9cca('0x9')](_0x4591d0,util[_0x9cca('0xa')](_0x44739f,{'showHidden':![],'depth':null}));};exports[_0x9cca('0xd')]=function(_0x4b7cb2){return function(_0x3d11b2){logger[_0x9cca('0xb')](_0x4b7cb2,util['inspect'](_0x3d11b2,{'showHidden':![],'depth':null}));};};exports[_0x9cca('0xe')]=function(_0x4de285,_0xfdfd38,_0x2d5551){return{'message':_0x4de285,'unlock':_0xfdfd38,'active':_0x2d5551};};exports[_0x9cca('0xf')]=function(_0x107981,_0x63eceb,_0x410272){if(!_[_0x9cca('0x10')](_0x410272)&&_0x9cca('0x11')===typeof _0x410272&&!_['isEmpty'](_0x410272)){if(!_[_0x9cca('0x10')](_0x63eceb)&&_0x9cca('0x11')===typeof _0x63eceb&&!_[_0x9cca('0x12')](_0x63eceb)){return util[_0x9cca('0x13')]('\x22%s\x22\x20<%s>',_0x63eceb,_0x410272);}return util['format'](_0x9cca('0x14'),_0x410272,_0x410272);}if(!_[_0x9cca('0x10')](_0x107981)&&'string'===typeof _0x107981&&!_['isEmpty'](_0x107981)){return _0x107981;}return _0x9cca('0x15');};exports['isActive']=function(_0x656ff2){if(_['isNil'](_0x656ff2)){return![];}return _0x656ff2;};exports['addVariables']=function(_0x4d23d9,_0x1f9654,_0x32f2e6,_0x226544,_0x4284e7,_0x236148){var _0x18fd28={'XMD-QUEUE':_0x1f9654[_0x9cca('0x16')]?_0x1f9654[_0x9cca('0x16')][_0x9cca('0x17')]:'','XMD-CALLERID':_0x226544,'XMD-CALLERID-PREVIEW':_0x236148?util[_0x9cca('0x13')]('\x22%s\x22\x20<%s>',_0x236148[_0x9cca('0x18')],_0x236148[_0x9cca('0x19')]):_0x226544,'XMD-DIALID':_0x4284e7,'XMD-CONTACTID':_0x1f9654[_0x9cca('0x1a')],'XMD-CDRTYPE':_0x9cca('0x1b'),'CALLERID(all)':_0x226544,'XMD-VOICEQUEUEID':_0x1f9654[_0x9cca('0x1c')],'XMD-DIALCHANNEL':_0x32f2e6,'XMD-DIALTIMEOUT':_0x4d23d9[_0x9cca('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x9cca('0x1e'),_0x4d23d9[_0x9cca('0x1f')]?'g':'',_[_0x9cca('0x12')](_0x4d23d9[_0x9cca('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4d23d9['dialPreviewUrl']||'','XMD-AGI':_0x4d23d9[_0x9cca('0x21')]?util[_0x9cca('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4d23d9[_0x9cca('0x21')]):_0x9cca('0x22'),'XMD-AGIAFTER':_0x4d23d9[_0x9cca('0x1f')]?util['format'](_0x9cca('0x23'),ipAgi,_0x4d23d9[_0x9cca('0x1f')]):_0x9cca('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x236148?_0x236148[_0x9cca('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x236148?_0x236148[_0x9cca('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x9cca('0x26')};if(!_[_0x9cca('0x12')](_0x4d23d9[_0x9cca('0x20')])){_0x18fd28[util['format']('%s',_0x9cca('0x27'))]=_0x4d23d9[_0x9cca('0x20')];_0x18fd28[util[_0x9cca('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4284e7;}return _0x18fd28;};exports[_0x9cca('0x28')]=function(_0xa8f73d){var _0x2b06cf={};for(var _0x38a7dc in _0xa8f73d){if(_0xa8f73d[_0x9cca('0x29')](_0x38a7dc)){_0x2b06cf[util[_0x9cca('0x13')]('%s',_[_0x9cca('0x2a')](_0x38a7dc))]=_0xa8f73d[_0x38a7dc];}}return{'variables':_0x2b06cf};};exports[_0x9cca('0x2b')]=function(_0x42a2b6){var _0xdaf086=moment()[_0x9cca('0x13')](_0x9cca('0x2c'));_0x42a2b6[_0x9cca('0x2d')]=0xd;_0x42a2b6['statedesc']=_0x9cca('0x2e');_0x42a2b6[_0x9cca('0x2f')]=_0xdaf086;_0x42a2b6[_0x9cca('0x30')]=_0xdaf086;_0x42a2b6[_0x9cca('0x31')]=_0xdaf086;};exports['logAgent']=function(_0xf75b15,_0x3cc442,_0x2a68f3){var _0x22c99e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xf75b15[_0x9cca('0x2d')]=_0x3cc442;_0xf75b15[_0x9cca('0x32')]=_0x2a68f3;_0xf75b15[_0x9cca('0x30')]=_0x22c99e;_0xf75b15[_0x9cca('0x33')]=utils[_0x9cca('0x34')](_0xf75b15[_0x9cca('0x30')],_0xf75b15[_0x9cca('0x2f')]);};exports[_0x9cca('0x35')]=function(_0x5d9af6,_0x54a3d6,_0x113c7e){_0x5d9af6['membername']=_0x54a3d6;_0x5d9af6['UserId']=_0x113c7e;};exports[_0x9cca('0x36')]=function(_0x24aeaa,_0x52147e,_0x4c2435){var _0x46d489=moment()['format'](_0x9cca('0x2c'));_0x24aeaa['state']=_0x52147e;_0x24aeaa[_0x9cca('0x32')]=_0x4c2435;_0x24aeaa['responsetime']=_0x24aeaa[_0x9cca('0x30')]?_0x24aeaa['responsetime']:_0x46d489;_0x24aeaa[_0x9cca('0x31')]=_0x24aeaa['endtime']?_0x24aeaa['endtime']:_0x46d489;_0x24aeaa['ringtime']=utils[_0x9cca('0x34')](_0x24aeaa[_0x9cca('0x30')]||0x0,_0x24aeaa[_0x9cca('0x2f')]||0x0);_0x24aeaa[_0x9cca('0x37')]=_0x24aeaa['answertime']?utils[_0x9cca('0x34')](_0x24aeaa['endtime'],_0x24aeaa[_0x9cca('0x38')]):0x0;};exports[_0x9cca('0x39')]=function(_0x9532a9){return _0x9532a9===_0x9cca('0x3a');};exports[_0x9cca('0x3b')]=function(_0x3241ae,_0x1c49fa,_0x370d1a,_0x43d301,_0x2e8ae6){var _0x32b89e=_0x43d301?'RECALL':_0x3241ae[_0x9cca('0x18')];_0x32b89e=_0x2e8ae6?'BOOKED':_0x32b89e;return{'actionid':_0x3241ae[_0x9cca('0x3c')],'action':_0x9cca('0x3d'),'channel':_0x3241ae['channelAgent'],'callerid':util[_0x9cca('0x13')](_0x9cca('0x14'),_0x32b89e,_0x3241ae[_0x9cca('0x19')]),'Exten':_0x9cca('0x3e'),'Context':_0x9cca('0x3f'),'Priority':'1','variable':_0x370d1a,'timeout':(_0x1c49fa[_0x9cca('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3241ae[_0x9cca('0x3c')]};};exports[_0x9cca('0x41')]=function(_0x5ecc2f){return _0x5ecc2f[_0x9cca('0x42')]+_0x5ecc2f[_0x9cca('0x43')]+_0x5ecc2f[_0x9cca('0x44')]+_0x5ecc2f[_0x9cca('0x45')]+_0x5ecc2f[_0x9cca('0x46')];};exports['cloneAction']=function(_0x168e5f){var _0x3289c5=_['clone'](_0x168e5f);_0x3289c5['state']=0xf;_0x3289c5['statedesc']=_0x9cca('0x47');return _0x3289c5;};exports[_0x9cca('0x48')]=function(_0x52a7ea,_0xcb372d,_0x2244c4){var _0x456e55={};_0x456e55[_0xcb372d]=_0x52a7ea[_0xcb372d];_0x456e55[_0x9cca('0x49')]=![];_0x456e55[_0x9cca('0x4a')]=moment()[_0x9cca('0x4b')](_0x2244c4,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x456e55[_0x9cca('0x1a')]=_0x52a7ea['ContactId'];_0x456e55[_0x9cca('0x4c')]=_0x52a7ea['ListId'];_0x456e55[_0x9cca('0x1c')]=_0x52a7ea[_0x9cca('0x1c')]||undefined;return _0x456e55;};exports['decrementTalking']=function(_0x11cb02,_0x472b5d){if(!_[_0x9cca('0x4d')](_0x11cb02)){if(_0x11cb02[_0x9cca('0x4e')]>0x0){_0x11cb02[_0x9cca('0x4e')]-=0x1;}else{logger[_0x9cca('0xb')](_0x472b5d,_0x9cca('0x4f'));}}else{logger['error'](_0x472b5d,_0x9cca('0x50'));}};exports[_0x9cca('0x51')]=function(_0x586297){if(_0x586297<=0x0){return!![];}return![];};function buildObj(_0x574619,_0x58317f,_0x3ee87c){_0x574619[_0x9cca('0x52')]=_0x58317f;_0x574619[_0x9cca('0x17')]=_0x574619[_0x9cca('0x53')];_0x574619['interface']=_0x574619[_0x9cca('0x54')];_0x574619['motionChannel']=_0x9cca('0x55');if(_0x3ee87c){_0x574619[_0x9cca('0x56')]=_0x3ee87c[_0x9cca('0x56')];}return _0x574619;}exports[_0x9cca('0x57')]=buildObj;exports[_0x9cca('0x58')]=function(_0x50eac7){var _0x4cb160=[];for(var _0x1c3c09 in _0x50eac7){if(_0x50eac7[_0x9cca('0x29')](_0x1c3c09)){if(!_[_0x9cca('0x4d')](_0x50eac7[_0x1c3c09])&&_0x50eac7[_0x1c3c09][_0x9cca('0x2d')]===_0x9cca('0x59')&&_0x50eac7[_0x1c3c09]['status']==='reachable'){_0x4cb160[_0x9cca('0x5a')](_0x50eac7[_0x1c3c09]['id']);}}}return _0x4cb160;};exports[_0x9cca('0x5b')]=function(_0x5bc5f1){var _0x583f68=moment()[_0x9cca('0x5c')](0x0);var _0x2cb4ef=moment(_0x5bc5f1)[_0x9cca('0x5c')](0x0);return _0x583f68[_0x9cca('0x5d')](_0x2cb4ef,_0x9cca('0x5e'));};exports['createBody']=function(_0x111c01){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x111c01[_0x9cca('0x1a')],'ListId':_0x111c01[_0x9cca('0x4c')],'VoiceQueueId':_0x111c01[_0x9cca('0x1c')]||undefined,'CampaignId':_0x111c01[_0x9cca('0x5f')]||undefined};};exports[_0x9cca('0x60')]=function(_0x5dd502){if(_0x5dd502===_0x9cca('0x3c')||_0x5dd502===_0x9cca('0x61')||_0x5dd502===_0x9cca('0x53')||_0x5dd502==='type'||_0x5dd502==='campaigntype'||_0x5dd502===_0x9cca('0x62')||_0x5dd502===_0x9cca('0x63')||_0x5dd502===_0x9cca('0x54')||_0x5dd502===_0x9cca('0x18')||_0x5dd502===_0x9cca('0x49')||_0x5dd502===_0x9cca('0x19')||_0x5dd502==='scheduledat'||_0x5dd502===_0x9cca('0x42')||_0x5dd502==='countcongestionretry'||_0x5dd502===_0x9cca('0x44')||_0x5dd502===_0x9cca('0x64')||_0x5dd502===_0x9cca('0x65')||_0x5dd502===_0x9cca('0x66')||_0x5dd502===_0x9cca('0x67')||_0x5dd502===_0x9cca('0x68')||_0x5dd502===_0x9cca('0x1a')||_0x5dd502===_0x9cca('0x4c')||_0x5dd502==='UserId'||_0x5dd502===_0x9cca('0x1c')||_0x5dd502==='sipcallid'||_0x5dd502==='xmd-voicequeueid'||_0x5dd502===_0x9cca('0x69')||_0x5dd502===_0x9cca('0x6a')||_0x5dd502===_0x9cca('0x6b')||_0x5dd502===_0x9cca('0x6c')||_0x5dd502===_0x9cca('0x6d')||_0x5dd502===_0x9cca('0x6e')||_0x5dd502==='xmd-dialid'||_0x5dd502==='xmd-dialchannel'||_0x5dd502===_0x9cca('0x6f')||_0x5dd502===_0x9cca('0x70')||_0x5dd502===_0x9cca('0x71')||_0x5dd502===_0x9cca('0x72')||_0x5dd502==='xmd-agi'||_0x5dd502===_0x9cca('0x73')||_0x5dd502===_0x9cca('0x74')||_0x5dd502==='rtpaudioqosjitter'||_0x5dd502===_0x9cca('0x75')||_0x5dd502===_0x9cca('0x76')||_0x5dd502==='rtpaudioqoslossbridged'||_0x5dd502==='rtpaudioqosrtt'||_0x5dd502===_0x9cca('0x77')||_0x5dd502===_0x9cca('0x73')||_0x5dd502===_0x9cca('0x74')||_0x5dd502===_0x9cca('0x78')||_0x5dd502===_0x9cca('0x75')||_0x5dd502===_0x9cca('0x76')||_0x5dd502===_0x9cca('0x79')||_0x5dd502===_0x9cca('0x7a')||_0x5dd502===_0x9cca('0x77')||_0x5dd502===_0x9cca('0x7b')||_0x5dd502==='bridgepvtcallid'||_0x5dd502===_0x9cca('0x2d')||_0x5dd502===_0x9cca('0x32')){return![];}return!![];};exports[_0x9cca('0x7c')]=function(_0x174a53,_0x2429b3){var _0x1b855c,_0x1fed25,_0x3ad272;if(_0x2429b3<=0x0){_0x2429b3=0x1;}_0x1b855c=new RegExp(_0x9cca('0x7d')+_0x2429b3+'}$');_0x1fed25=Math[_0x9cca('0x7e')](0xa,_0x2429b3-0x1);_0x3ad272=Math[_0x9cca('0x7e')](0xa,_0x2429b3)-0x1;return util[_0x9cca('0x13')]('%s',_[_0x9cca('0x7f')](_0x174a53,_0x1b855c,_['random'](_0x1fed25,_0x3ad272)));};exports['extractCalleridName']=function(_0x1f5b56){var _0x2f0560=_0x1f5b56['match'](/"(.*?)"/);return _0x2f0560?_0x2f0560[0x1]:_0x1f5b56;};exports[_0x9cca('0x80')]=function(_0x552d68){var _0x3a528d=_0x552d68['match'](/<(.*?)>/);return _0x3a528d?_0x3a528d[0x1]:_0x552d68;};function buildNoAnswerEventPayload(_0x442c30,_0x409b5c){var _0x159a80=buildObj(_0x442c30,'noanswer');if(!_['isEmpty'](_0x409b5c[_0x9cca('0x81')])){Object['keys'](_0x409b5c[_0x9cca('0x81')])[_0x9cca('0x82')](function(_0x2de978){_0x159a80[_0x2de978[_0x9cca('0x83')]()]=_0x409b5c[_0x9cca('0x81')][_0x2de978];});}return _0x159a80;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index c6f1342..8d5308b 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 _0x1c59=['voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1c59,0x160));var _0x91c5=function(_0x48cbbd,_0x5268fb){_0x48cbbd=_0x48cbbd-0x0;var _0x552b46=_0x1c59[_0x48cbbd];return _0x552b46;};'use strict';exports[_0x91c5('0x0')]={'queue':{'type':_0x91c5('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x91c5('0x1'),'required':!![]},'penalty':{'type':_0x91c5('0x2'),'required':![]},'paused':{'type':_0x91c5('0x3'),'required':![]}};exports[_0x91c5('0x4')]={'queue':{'type':_0x91c5('0x1'),'required':!![]},'interface':{'type':_0x91c5('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x91c5('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x91c5('0x1'),'required':![]}};exports[_0x91c5('0x5')]={'uniqueid':{'type':_0x91c5('0x1'),'required':!![]}};exports[_0x91c5('0x6')]={'uniqueid':{'type':_0x91c5('0x1'),'required':!![]},'filename':{'type':_0x91c5('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x91c5('0x1')}};exports[_0x91c5('0x7')]={'uniqueid':{'type':_0x91c5('0x1'),'required':!![]}};exports[_0x91c5('0x8')]={'uniqueid':{'type':_0x91c5('0x1'),'required':!![]},'exten':{'type':_0x91c5('0x1'),'required':!![]},'context':{'type':_0x91c5('0x1')}}; \ No newline at end of file +var _0x7b0d=['string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicequeuechannelredirect','queueadd'];(function(_0x2834c7,_0xf21164){var _0x5538b1=function(_0x58b277){while(--_0x58b277){_0x2834c7['push'](_0x2834c7['shift']());}};_0x5538b1(++_0xf21164);}(_0x7b0d,0x182));var _0xd7b0=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7b0d[_0xbb091];return _0x467a04;};'use strict';exports[_0xd7b0('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xd7b0('0x1'),'required':!![]},'penalty':{'type':_0xd7b0('0x2'),'required':![]},'paused':{'type':_0xd7b0('0x3'),'required':![]}};exports[_0xd7b0('0x4')]={'queue':{'type':_0xd7b0('0x1'),'required':!![]},'interface':{'type':_0xd7b0('0x1'),'required':!![]}};exports[_0xd7b0('0x5')]={'interface':{'type':_0xd7b0('0x1'),'required':!![]},'paused':{'type':_0xd7b0('0x3')},'reason':{'type':'string','required':![]}};exports[_0xd7b0('0x6')]={'module':{'type':'string','required':![]}};exports[_0xd7b0('0x7')]={'uniqueid':{'type':_0xd7b0('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xd7b0('0x1'),'required':!![]},'filename':{'type':_0xd7b0('0x1')},'format':{'type':_0xd7b0('0x1')},'mixmonitorid':{'type':_0xd7b0('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0xd7b0('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xd7b0('0x1'),'required':!![]},'context':{'type':_0xd7b0('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index d54264f..01fd6a3 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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5a148f,_0x114dfa){_0x5a148f=_0x5a148f-0x0;var _0x5af2d4=_0x0b0e[_0x5a148f];return _0x5af2d4;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x924737,_0x2f5242){var _0x9a5c86=function(_0xa7bbd5){while(--_0xa7bbd5){_0x924737['push'](_0x924737['shift']());}};_0x9a5c86(++_0x2f5242);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index c4b7132..f75b15a 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 _0xc646=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x2ce8ac,_0x4c8c7b){var _0x565333=function(_0x4b9086){while(--_0x4b9086){_0x2ce8ac['push'](_0x2ce8ac['shift']());}};_0x565333(++_0x4c8c7b);}(_0xc646,0x1d1));var _0x6c64=function(_0x314bb5,_0x476e6a){_0x314bb5=_0x314bb5-0x0;var _0x32c85e=_0xc646[_0x314bb5];return _0x32c85e;};'use strict';function mergeDBDataToRealtime(_0x28a535,_0x345847){var _0x3825fe=Object[_0x6c64('0x0')]({},_0x28a535);for(var _0x136b0c in _0x345847){if(_0x3825fe[_0x6c64('0x1')](_0x136b0c)){_0x3825fe[_0x136b0c]=_0x345847[_0x136b0c];}}return _0x3825fe;}exports[_0x6c64('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x1cfa=['assign','hasOwnProperty'];(function(_0x13c5bf,_0x336fca){var _0x242af1=function(_0xe19740){while(--_0xe19740){_0x13c5bf['push'](_0x13c5bf['shift']());}};_0x242af1(++_0x336fca);}(_0x1cfa,0x1de));var _0xa1cf=function(_0x47cb68,_0x3ac3d7){_0x47cb68=_0x47cb68-0x0;var _0x3cecb3=_0x1cfa[_0x47cb68];return _0x3cecb3;};'use strict';function mergeDBDataToRealtime(_0x37aef0,_0x1a6e61){var _0x2f3b73=Object[_0xa1cf('0x0')]({},_0x37aef0);for(var _0x125c41 in _0x1a6e61){if(_0x2f3b73[_0xa1cf('0x1')](_0x125c41)){_0x2f3b73[_0x125c41]=_0x1a6e61[_0x125c41];}}return _0x2f3b73;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index a1b036c..ccceeb8 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 _0x3024=['voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','keys','getCallType','channel','split','getAgentByInternal','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones','prototype','sync','xdr','disabled'];(function(_0xd0362f,_0x5e2b91){var _0x441f12=function(_0x548b49){while(--_0x548b49){_0xd0362f['push'](_0xd0362f['shift']());}};_0x441f12(++_0x5e2b91);}(_0x3024,0xab));var _0x4302=function(_0x13a832,_0x514084){_0x13a832=_0x13a832-0x0;var _0x18143e=_0x3024[_0x13a832];return _0x18143e;};'use strict';var _=require('lodash');var moment=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var config=require(_0x4302('0x2'));var ami=require(_0x4302('0x3'));var RpcVoiceAgentReport=require(_0x4302('0x4'));var RpcVoiceCallReport=require(_0x4302('0x5'));var RpcVoiceDialReport=require(_0x4302('0x6'));var RpcMemberReport=require(_0x4302('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x4302('0x8'));var VoiceQueueReport=require(_0x4302('0x9'));var VoiceCallReport=require(_0x4302('0xa'));var VoiceAgentReport=require(_0x4302('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x2e8895){this[_0x4302('0xc')]=_0x2e8895;this[_0x4302('0xd')]=_0x2e8895['agents'];this[_0x4302('0xe')]=_0x2e8895[_0x4302('0xe')];}Report[_0x4302('0xf')][_0x4302('0x10')]=function(_0x4db34a){var _0xcb42da=new VoiceQueueReport(this[_0x4302('0xc')]);var _0x1df8dd=new VoiceAgentReport(this[_0x4302('0xc')]);var _0x511424=new VoiceDialReport(this['realtime']);var _0x57fb78=new VoiceCallReport(this[_0x4302('0xc')]);var _0x28cc8d=new UserReport(this[_0x4302('0xc')]);if(config[_0x4302('0x11')]&&config['xdr'][_0x4302('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x4302('0x13')]['bind'](this));ami['on'](_0x4302('0x14'),this[_0x4302('0x15')][_0x4302('0x16')](this));ami['on'](_0x4302('0x17'),this['voiceAgentReport']['bind'](this));ami['on']('custom:voiceDialReport',this[_0x4302('0x18')][_0x4302('0x16')](this));ami['on'](_0x4302('0x19'),this[_0x4302('0x1a')][_0x4302('0x16')](this));ami['on'](_0x4302('0x1b'),this[_0x4302('0x1c')][_0x4302('0x16')](this));}};Report[_0x4302('0xf')][_0x4302('0x1d')]=function(_0x4ac965){var _0x386c59;_0x386c59=_[_0x4302('0x1e')](this[_0x4302('0xd')],function(_0x53bc1b){return _0x53bc1b[_0x4302('0x1f')]==_0x4ac965||_0x53bc1b[_0x4302('0x20')]==_0x4ac965;});if(_[_0x4302('0x21')](_0x386c59)){var _0x1a3d51=_[_0x4302('0x1e')](this[_0x4302('0xe')],function(_0x4165d8){return _0x4165d8[_0x4302('0x1f')]==_0x4ac965||_0x4165d8[_0x4302('0x20')]==_0x4ac965;});if(_0x1a3d51){_0x386c59=_['find'](this[_0x4302('0xd')],function(_0x427ff1){return _0x427ff1['interface']==util[_0x4302('0x22')](_0x4302('0x23'),_0x1a3d51[_0x4302('0x20')]);});}}return _0x386c59;};Report['prototype'][_0x4302('0x13')]=function(_0x16125d){for(var _0x30ff04=0x0;_0x30ff04<_0x16125d[_0x4302('0x24')];_0x30ff04+=0x1){var _0x2c3dcd=this[_0x4302('0x1d')](_0x16125d[_0x30ff04][_0x4302('0x25')]);if(_0x2c3dcd){_0x16125d[_0x30ff04][_0x4302('0x1f')]=_0x2c3dcd[_0x4302('0x1f')];_0x16125d[_0x30ff04][_0x4302('0x26')]=!![];_0x16125d[_0x30ff04][_0x4302('0x27')]=_0x2c3dcd[_0x4302('0x20')];_0x16125d[_0x30ff04][_0x4302('0x28')]=_[_0x4302('0x21')](_0x2c3dcd[_0x4302('0x28')])?util[_0x4302('0x22')](_0x4302('0x23'),_0x2c3dcd[_0x4302('0x20')]):_0x2c3dcd[_0x4302('0x28')];if(_0x16125d[_0x30ff04][_0x4302('0x29')]){_0x16125d[_0x30ff04]['queuecallercompleteAt']=moment()[_0x4302('0x22')](_0x4302('0x2a'));}if(_0x16125d[_0x30ff04][_0x4302('0x2b')]){_0x16125d[_0x30ff04]['queuecallerexitAt']=moment()[_0x4302('0x22')](_0x4302('0x2a'));}RpcMemberReport[_0x4302('0x13')](_0x16125d[_0x30ff04]);}RpcVoiceQueueReport[_0x4302('0x2c')](_0x16125d[_0x30ff04]);}};function extractCalleridNumber(_0x5f05ca){var _0x5960a9=_0x5f05ca[_0x4302('0x2d')](/<(.*?)>/);return _0x5960a9?_0x5960a9[0x1]:_0x5f05ca;}Report[_0x4302('0xf')]['getAgentByInternal']=function(_0x3b90be){for(var _0x4fe1a1=0x0;_0x4fe1a1','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile'];(function(_0x242f38,_0x1c8cca){var _0x59a1f2=function(_0x3a234b){while(--_0x3a234b){_0x242f38['push'](_0x242f38['shift']());}};_0x59a1f2(++_0x1c8cca);}(_0x2c6e,0x181));var _0xe2c6=function(_0x2a8797,_0x501b74){_0x2a8797=_0x2a8797-0x0;var _0x52fa1d=_0x2c6e[_0x2a8797];return _0x52fa1d;};'use strict';var _=require('lodash');var moment=require(_0xe2c6('0x0'));var util=require('util');var config=require(_0xe2c6('0x1'));var ami=require(_0xe2c6('0x2'));var RpcVoiceAgentReport=require(_0xe2c6('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xe2c6('0x4'));var RpcVoiceQueueReport=require(_0xe2c6('0x5'));var RpcVoiceRecording=require(_0xe2c6('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xe2c6('0x7'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xe2c6('0x8'));var VoiceDialReport=require(_0xe2c6('0x9'));var UserReport=require(_0xe2c6('0xa'));function Report(_0x30ea19){this[_0xe2c6('0xb')]=_0x30ea19;this[_0xe2c6('0xc')]=_0x30ea19[_0xe2c6('0xc')];this[_0xe2c6('0xd')]=_0x30ea19[_0xe2c6('0xd')];}Report[_0xe2c6('0xe')][_0xe2c6('0xf')]=function(_0x93cbe5){var _0x43266c=new VoiceQueueReport(this[_0xe2c6('0xb')]);var _0x24bde7=new VoiceAgentReport(this[_0xe2c6('0xb')]);var _0x4acd44=new VoiceDialReport(this['realtime']);var _0x3cec4f=new VoiceCallReport(this['realtime']);var _0x315062=new UserReport(this[_0xe2c6('0xb')]);if(config[_0xe2c6('0x10')]&&config['xdr'][_0xe2c6('0x11')]){ami['on'](_0xe2c6('0x12'),this[_0xe2c6('0x13')][_0xe2c6('0x14')](this));ami['on'](_0xe2c6('0x15'),this[_0xe2c6('0x16')]['bind'](this));ami['on'](_0xe2c6('0x17'),this['voiceAgentReport'][_0xe2c6('0x14')](this));ami['on'](_0xe2c6('0x18'),this['voiceDialReport']['bind'](this));ami['on'](_0xe2c6('0x19'),this[_0xe2c6('0x1a')]['bind'](this));ami['on'](_0xe2c6('0x1b'),this['attendedTransfer']['bind'](this));}};Report['prototype'][_0xe2c6('0x1c')]=function(_0x3f4492){var _0x40979e;_0x40979e=_[_0xe2c6('0x1d')](this[_0xe2c6('0xc')],function(_0x5017a3){return _0x5017a3[_0xe2c6('0x1e')]==_0x3f4492||_0x5017a3[_0xe2c6('0x1f')]==_0x3f4492;});if(_['isNil'](_0x40979e)){var _0x3f3efe=_[_0xe2c6('0x1d')](this[_0xe2c6('0xd')],function(_0x46b06a){return _0x46b06a[_0xe2c6('0x1e')]==_0x3f4492||_0x46b06a[_0xe2c6('0x1f')]==_0x3f4492;});if(_0x3f3efe){_0x40979e=_['find'](this['agents'],function(_0x3cc422){return _0x3cc422[_0xe2c6('0x20')]==util[_0xe2c6('0x21')](_0xe2c6('0x22'),_0x3f3efe[_0xe2c6('0x1f')]);});}}return _0x40979e;};Report[_0xe2c6('0xe')][_0xe2c6('0x13')]=function(_0x37d24a){for(var _0x5151f2=0x0;_0x5151f2<_0x37d24a[_0xe2c6('0x23')];_0x5151f2+=0x1){var _0xf40e26=this[_0xe2c6('0x1c')](_0x37d24a[_0x5151f2]['connectedlinenum']);if(_0xf40e26){_0x37d24a[_0x5151f2]['accountcode']=_0xf40e26['accountcode'];_0x37d24a[_0x5151f2]['assigned']=!![];_0x37d24a[_0x5151f2][_0xe2c6('0x24')]=_0xf40e26[_0xe2c6('0x1f')];_0x37d24a[_0x5151f2][_0xe2c6('0x20')]=_[_0xe2c6('0x25')](_0xf40e26[_0xe2c6('0x20')])?util[_0xe2c6('0x21')]('SIP/%s',_0xf40e26['name']):_0xf40e26['interface'];if(_0x37d24a[_0x5151f2][_0xe2c6('0x26')]){_0x37d24a[_0x5151f2][_0xe2c6('0x27')]=moment()['format'](_0xe2c6('0x28'));}if(_0x37d24a[_0x5151f2][_0xe2c6('0x29')]){_0x37d24a[_0x5151f2][_0xe2c6('0x2a')]=moment()[_0xe2c6('0x21')](_0xe2c6('0x28'));}RpcMemberReport[_0xe2c6('0x13')](_0x37d24a[_0x5151f2]);}RpcVoiceQueueReport[_0xe2c6('0x2b')](_0x37d24a[_0x5151f2]);}};function extractCalleridNumber(_0xa22f99){var _0x2fe5e0=_0xa22f99['match'](/<(.*?)>/);return _0x2fe5e0?_0x2fe5e0[0x1]:_0xa22f99;}Report[_0xe2c6('0xe')][_0xe2c6('0x2c')]=function(_0x5248eb){for(var _0xa7b068=0x0;_0xa7b068{delete this['channels'][_0x2cad50];},_0x5c91ff);}};module[_0xf848('0xa2')]=VoiceAgentReport; \ No newline at end of file +var _0x7a0b=['syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','info','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','called','mandatoryDisposition','type','assign','event','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','queue','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','destchannelstate','destchannelstatedesc','lastevent','merge','interface','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:agentconnect','[%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','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acw','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','seconds','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x7a0b,0x85));var _0xb7a0=function(_0x3ab39f,_0xa6b62a){_0x3ab39f=_0x3ab39f-0x0;var _0x4435ed=_0x7a0b[_0x3ab39f];return _0x4435ed;};'use strict';var _=require(_0xb7a0('0x0'));var moment=require(_0xb7a0('0x1'));var util=require(_0xb7a0('0x2'));var Redis=require('ioredis');var config=require(_0xb7a0('0x3'));var logger=require(_0xb7a0('0x4'))(_0xb7a0('0x5'));var ami=require('../ami');config[_0xb7a0('0x6')]=_[_0xb7a0('0x7')](config[_0xb7a0('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb7a0('0x8'))(new Redis(config[_0xb7a0('0x6')]));function VoiceAgentReport(_0x39176b){this[_0xb7a0('0x9')]={};this['voiceChannels']=_0x39176b['channels'];this[_0xb7a0('0xa')]=_0x39176b[_0xb7a0('0xa')];this['agents']=_0x39176b[_0xb7a0('0xb')];this[_0xb7a0('0xc')]={};ami['on'](_0xb7a0('0xd'),this[_0xb7a0('0xe')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x10'),this[_0xb7a0('0x11')]['bind'](this));ami['on'](_0xb7a0('0x12'),this[_0xb7a0('0x13')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x14'),this[_0xb7a0('0x15')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x16'),this[_0xb7a0('0x17')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x18'),this[_0xb7a0('0x19')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x1a'),this[_0xb7a0('0x1b')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x1c'),this[_0xb7a0('0x1d')]['bind'](this));ami['on'](_0xb7a0('0x1e'),this[_0xb7a0('0x1f')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x20'),this['syncAttendedTransfer'][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x21'),this[_0xb7a0('0x22')][_0xb7a0('0xf')](this));}VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x24')]=function(_0x43cd45,_0x27236e,_0x3364e){io['to'](_0x43cd45)[_0xb7a0('0x24')](_0x27236e,_0x3364e);};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x25')]=function(_0x4fcd7d){return _0x4fcd7d!==null&&!_['isUndefined'](_0x4fcd7d);};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0xe')]=function(_0xa863a7){try{if(this[_0xb7a0('0x25')](_0xa863a7)){logger[_0xb7a0('0x26')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xa863a7[_0xb7a0('0x27')],_0xa863a7[_0xb7a0('0x28')],_0xa863a7[_0xb7a0('0x29')]);logger['debug'](_0xb7a0('0x2a'),_0xa863a7[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0xa863a7,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0xa863a7['uniqueid']])){this['channels'][_0xa863a7[_0xb7a0('0x27')]]={};}var _0x581bb4=this[_0xb7a0('0xb')][_0xa863a7['interface']];var _0x339bb0=this[_0xb7a0('0x9')][_0xa863a7['uniqueid']][_0xa863a7[_0xb7a0('0x29')]];var _0x4ea148=this['voiceQueues'][_0xa863a7['queue']];var _0x76a129=this[_0xb7a0('0xc')][_0xa863a7['uniqueid']];if(_[_0xb7a0('0x2c')](_0x339bb0)){_0x339bb0={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xb7a0('0x2d'),'mandatoryDisposition':_0x4ea148&&_0x4ea148['mandatoryDisposition']?_0x4ea148[_0xb7a0('0x2e')]:![],'type':_0x4ea148&&_0x4ea148[_0xb7a0('0x2f')]?_0x4ea148[_0xb7a0('0x2f')]:'inbound','variables':_0x76a129,'motionChannel':'voice'};}Object[_0xb7a0('0x30')](_0x339bb0,_['omit'](_0xa863a7,[_0xb7a0('0x31'),'privilege']));this[_0xb7a0('0x9')][_0xa863a7[_0xb7a0('0x27')]][_0xa863a7[_0xb7a0('0x29')]]=_0x339bb0;logger[_0xb7a0('0x32')](_0xb7a0('0x33'),_0xa863a7['uniqueid'],util[_0xb7a0('0x2b')](_0x339bb0,{'showHidden':![],'depth':null}));ami['emit'](_0xb7a0('0x34'),_0x339bb0);var _0x5134d2={'id':_0x581bb4['id'],'calleridnum':_0x339bb0[_0xb7a0('0x35')],'queue':_0x339bb0[_0xb7a0('0x36')],'variables':_0x339bb0[_0xb7a0('0xc')],'uniqueid':_0xa863a7[_0xb7a0('0x27')]};logger['debug'](_0xb7a0('0x37'),_0xa863a7[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x5134d2,{'showHidden':![],'depth':null}));this['emit'](util[_0xb7a0('0x38')](_0xb7a0('0x39'),_0xa863a7['membername']),_0xb7a0('0x3a'),_0x5134d2);}}catch(_0x1eb23e){logger['error'](_0xb7a0('0x3b'),_0xa863a7[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x1eb23e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x11')]=function(_0x3b350c){try{if(this[_0xb7a0('0x25')](_0x3b350c)){if(this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]]){for(var _0x467316 in this['channels'][_0x3b350c[_0xb7a0('0x27')]]){if(this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0xb7a0('0x3c')](_0x467316)){if(_0x3b350c[_0xb7a0('0x29')]===_0x467316){logger[_0xb7a0('0x26')](_0xb7a0('0x3d'),_0x3b350c[_0xb7a0('0x27')],_0x3b350c[_0xb7a0('0x28')],_0x3b350c[_0xb7a0('0x29')]);this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316][_0xb7a0('0x3e')]=moment()[_0xb7a0('0x38')](_0xb7a0('0x3f'));this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316][_0xb7a0('0x40')]=_0x3b350c[_0xb7a0('0x40')];this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316]['connectedlinenum']=_0x3b350c['connectedlinenum'];this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316][_0xb7a0('0x41')]=_0x3b350c['destchannelstate'];this['channels'][_0x3b350c[_0xb7a0('0x27')]][_0x467316]['destchannelstatedesc']=_0x3b350c[_0xb7a0('0x42')];this['channels'][_0x3b350c[_0xb7a0('0x27')]][_0x467316]['holdtime']=_0x3b350c['holdtime'];this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316][_0xb7a0('0x43')]='connect';_[_0xb7a0('0x44')](this[_0xb7a0('0xb')][_0x3b350c[_0xb7a0('0x45')]],_[_0xb7a0('0x46')](_0x3b350c,['queue',_0xb7a0('0x47')]));var _0x4374b8=this['agents'][_0x3b350c[_0xb7a0('0x45')]];var _0x2807b7={'id':_0x4374b8['id'],'name':_0x4374b8[_0xb7a0('0x48')],'agentconnected':!![],'destaccountcode':_0x4374b8[_0xb7a0('0x49')],'destconnectedlinenum':this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x3b350c[_0xb7a0('0x29')]][_0xb7a0('0x4a')],'queue':this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x3b350c[_0xb7a0('0x29')]][_0xb7a0('0x36')],'uniqueid':this['channels'][_0x3b350c[_0xb7a0('0x27')]][_0x3b350c[_0xb7a0('0x29')]][_0xb7a0('0x27')]};ami['emit'](_0xb7a0('0x4b'),this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x3b350c[_0xb7a0('0x29')]]);this[_0xb7a0('0x24')](util[_0xb7a0('0x38')](_0xb7a0('0x39'),_0x3b350c['membername']),_0xb7a0('0x4c'),_0x2807b7);}else if(!this['channels'][_0x3b350c[_0xb7a0('0x27')]][_0x467316][_0xb7a0('0x12')]&&!this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316][_0xb7a0('0x16')]){logger[_0xb7a0('0x26')](_0xb7a0('0x4d'),_0x3b350c[_0xb7a0('0x27')],this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316]['membername'],_0x467316);this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316]['agentringnoanswer']=!![];this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316][_0xb7a0('0x4e')]=moment()[_0xb7a0('0x38')](_0xb7a0('0x3f'));this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316][_0xb7a0('0x4f')]=_0x3b350c[_0xb7a0('0x29')];this['channels'][_0x3b350c[_0xb7a0('0x27')]][_0x467316][_0xb7a0('0x50')]=_0x3b350c[_0xb7a0('0x28')];this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316]['lastevent']=_0xb7a0('0x51');this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316][_0xb7a0('0x52')]=_0xb7a0('0x51');logger[_0xb7a0('0x32')](_0xb7a0('0x53'),_0x3b350c[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316],{'showHidden':![],'depth':null}));ami[_0xb7a0('0x24')](_0xb7a0('0x54'),this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316]);}else{logger[_0xb7a0('0x32')](_0xb7a0('0x55'),_0x3b350c[_0xb7a0('0x27')]);}}}}}}catch(_0x4b403f){logger[_0xb7a0('0x56')](_0xb7a0('0x57'),_0x3b350c[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x4b403f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x13')]=function(_0x5f180b){try{if(this[_0xb7a0('0x25')](_0x5f180b)){logger[_0xb7a0('0x32')](_0xb7a0('0x58'),_0x5f180b['uniqueid'],util[_0xb7a0('0x2b')](_0x5f180b,{'showHidden':![],'depth':null}));if(this[_0xb7a0('0x9')][_0x5f180b[_0xb7a0('0x27')]]&&this[_0xb7a0('0x9')][_0x5f180b[_0xb7a0('0x27')]][_0x5f180b[_0xb7a0('0x29')]]){logger[_0xb7a0('0x26')](_0xb7a0('0x59'),_0x5f180b['uniqueid'],_0x5f180b[_0xb7a0('0x28')],_0x5f180b['destuniqueid']);var _0x39a308=this['agents'][_0x5f180b[_0xb7a0('0x45')]];var _0x3bc7fe=this[_0xb7a0('0x9')][_0x5f180b[_0xb7a0('0x27')]][_0x5f180b[_0xb7a0('0x29')]];_0x3bc7fe[_0xb7a0('0x12')]=!![];_0x3bc7fe[_0xb7a0('0x4e')]=moment()[_0xb7a0('0x38')](_0xb7a0('0x3f'));_0x3bc7fe['lastevent']=_0xb7a0('0x5a');_0x3bc7fe['reason']=_0xb7a0('0x5a');var _0x2f2739={'id':_0x39a308['id'],'name':_0x39a308[_0xb7a0('0x48')],'queue':_0x3bc7fe[_0xb7a0('0x36')],'uniqueid':_0x3bc7fe[_0xb7a0('0x27')]};logger[_0xb7a0('0x32')](_0xb7a0('0x5b'),_0x5f180b[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x2f2739,{'showHidden':![],'depth':null}));this[_0xb7a0('0x24')](util[_0xb7a0('0x38')](_0xb7a0('0x39'),_0x39a308[_0xb7a0('0x48')]),_0xb7a0('0x5c'),_0x2f2739);ami[_0xb7a0('0x24')](_0xb7a0('0x5d'),_0x3bc7fe);this[_0xb7a0('0x9')][_0x5f180b[_0xb7a0('0x27')]][_0x5f180b[_0xb7a0('0x29')]]=Object['assign']({},_0x3bc7fe);}}}catch(_0x239eda){logger[_0xb7a0('0x56')](_0xb7a0('0x5e'),_0x5f180b['uniqueid'],util[_0xb7a0('0x2b')](_0x239eda,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x15')]=function(_0x1d143f){try{if(this['isNotNull'](_0x1d143f)){logger[_0xb7a0('0x32')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x1d143f[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x1d143f,{'showHidden':![],'depth':null}));if(this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]]){for(var _0xcc89f1 in this[_0xb7a0('0x9')][_0x1d143f['uniqueid']]){if(this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]][_0xb7a0('0x3c')](_0xcc89f1)&&!this['channels'][_0x1d143f['uniqueid']][_0xcc89f1]['agentringnoanswer']&&!this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1][_0xb7a0('0x16')]){logger[_0xb7a0('0x26')](_0xb7a0('0x5f'),_0x1d143f[_0xb7a0('0x27')],this[_0xb7a0('0x9')][_0x1d143f['uniqueid']][_0xcc89f1][_0xb7a0('0x28')],_0xcc89f1);this['channels'][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1][_0xb7a0('0x12')]=!![];this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1][_0xb7a0('0x4e')]=moment()[_0xb7a0('0x38')](_0xb7a0('0x3f'));this['channels'][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1][_0xb7a0('0x43')]='abandoned';this[_0xb7a0('0x9')][_0x1d143f['uniqueid']][_0xcc89f1]['reason']=_0xb7a0('0x60');logger[_0xb7a0('0x32')](_0xb7a0('0x61'),_0x1d143f[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1],{'showHidden':![],'depth':null}));ami[_0xb7a0('0x24')]('custom:agentqueuecallerabandon',this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1]);}}}}}catch(_0x55458f){logger[_0xb7a0('0x56')](_0xb7a0('0x62'),_0x1d143f[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x55458f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb7a0('0x17')]=function(_0x36f9da){try{if(this[_0xb7a0('0x25')](_0x36f9da)){logger[_0xb7a0('0x32')](_0xb7a0('0x63'),_0x36f9da['uniqueid'],util[_0xb7a0('0x2b')](_0x36f9da,{'showHidden':![],'depth':null}));if(this['channels'][_0x36f9da[_0xb7a0('0x27')]]){for(var _0x3b5e39 in this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]]){if(this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0xb7a0('0x3c')](_0x3b5e39)){if(this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x3e')]&&!this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x16')]){logger[_0xb7a0('0x26')](_0xb7a0('0x64'),_0x36f9da['uniqueid'],this['channels'][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39]['membername'],_0x3b5e39);this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39]['agentcomplete']=!![];this['channels'][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x65')]=moment()[_0xb7a0('0x38')](_0xb7a0('0x3f'));this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x43')]='complete';this['channels'][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x52')]=_0x36f9da['reason']==_0xb7a0('0x66')?_0xb7a0('0x67'):_0x36f9da[_0xb7a0('0x52')];this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39]['talktime']=_0x36f9da[_0xb7a0('0x68')];if(this[_0xb7a0('0xa')][_0x36f9da['queue']]&&this[_0xb7a0('0xa')][_0x36f9da[_0xb7a0('0x36')]][_0xb7a0('0x69')]){this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39]['acwtime']=this[_0xb7a0('0xa')][_0x36f9da['queue']]['acwTimeout'];this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x6a')]=!![];}this['agents'][_0x36f9da[_0xb7a0('0x45')]]=_['omit'](this[_0xb7a0('0xb')][_0x36f9da['interface']],[_0xb7a0('0x36'),_0xb7a0('0x47')]);logger[_0xb7a0('0x32')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x36f9da['uniqueid'],util[_0xb7a0('0x2b')](this['channels'][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39],{'showHidden':![],'depth':null}));ami[_0xb7a0('0x24')](_0xb7a0('0x6b'),this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39]);logger[_0xb7a0('0x32')](_0xb7a0('0x6c'),_0x36f9da[_0xb7a0('0x27')],util[_0xb7a0('0x2b')]({'id':this[_0xb7a0('0xb')][_0x36f9da[_0xb7a0('0x45')]]['id'],'destaccountcode':_0x36f9da[_0xb7a0('0x6d')]},{'showHidden':![],'depth':null}));this[_0xb7a0('0x24')](util[_0xb7a0('0x38')]('user:%s',_0x36f9da[_0xb7a0('0x28')]),'user:agentcomplete',{'id':this[_0xb7a0('0xb')][_0x36f9da[_0xb7a0('0x45')]]['id'],'destaccountcode':Number(_0x36f9da[_0xb7a0('0x6d')])});}}}}}}catch(_0x40e419){logger[_0xb7a0('0x56')](_0xb7a0('0x6e'),_0x36f9da[_0xb7a0('0x27')],util['inspect'](_0x40e419,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')]['syncVarSet']=function(_0x44a800){try{if(this[_0xb7a0('0x25')](_0x44a800)){logger[_0xb7a0('0x32')](_0xb7a0('0x6f'),_0x44a800[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x44a800,{'showHidden':![],'depth':null}));this[_0xb7a0('0x70')](_0x44a800[_0xb7a0('0x27')],_[_0xb7a0('0x71')](_0x44a800[_0xb7a0('0x72')])[0x0],_0x44a800[_0xb7a0('0x73')]);if(this['channels'][_0x44a800[_0xb7a0('0x27')]]){for(var _0x278885 in this[_0xb7a0('0x9')][_0x44a800[_0xb7a0('0x27')]]){if(this[_0xb7a0('0x9')][_0x44a800['uniqueid']][_0xb7a0('0x3c')](_0x278885)){logger[_0xb7a0('0x26')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x44a800[_0xb7a0('0x27')],_0x278885,_[_0xb7a0('0x71')](_0x44a800[_0xb7a0('0x72')])[0x0],_0x44a800[_0xb7a0('0x73')]);if(_[_0xb7a0('0x2c')](this[_0xb7a0('0x9')][_0x44a800['uniqueid']][_0x278885]['variables'])){this[_0xb7a0('0x9')][_0x44a800[_0xb7a0('0x27')]][_0x278885][_0xb7a0('0xc')]={};}this[_0xb7a0('0x9')][_0x44a800[_0xb7a0('0x27')]][_0x278885]['variables']=this[_0xb7a0('0xc')][_0x44a800['uniqueid']];}}}}}catch(_0x54dc0b){logger[_0xb7a0('0x56')](_0xb7a0('0x74'),_0x44a800[_0xb7a0('0x27')],util['inspect'](_0x54dc0b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb7a0('0x70')]=function(_0x2b14f9,_0x4e56f5,_0xb68bcc){var _0x1276d6=['rtpaudioqos',_0xb7a0('0x75'),_0xb7a0('0x76'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0xb7a0('0x77'),'bridgepeer',_0xb7a0('0x78'),'membercalls',_0xb7a0('0x79'),_0xb7a0('0x7a'),_0xb7a0('0x7b'),_0xb7a0('0x28'),_0xb7a0('0x7c'),_0xb7a0('0x7d')];if(!_[_0xb7a0('0x7e')](_0x4e56f5)&&!_['includes'](_0x1276d6,_0x4e56f5)){if(_[_0xb7a0('0x2c')](this[_0xb7a0('0xc')][_0x2b14f9])){this['variables'][_0x2b14f9]={};}this[_0xb7a0('0xc')][_0x2b14f9][_0x4e56f5]=_0xb68bcc;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x53c809){try{if(this[_0xb7a0('0x25')](_0x53c809)){logger[_0xb7a0('0x32')]('[%s][voiceAgentReport][hangup]\x20event:',_0x53c809[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x53c809,{'showHidden':![],'depth':null}));if(this[_0xb7a0('0x9')][_0x53c809[_0xb7a0('0x27')]]){for(var _0x548a72 in this['channels'][_0x53c809[_0xb7a0('0x27')]]){if(this[_0xb7a0('0x9')][_0x53c809[_0xb7a0('0x27')]][_0xb7a0('0x3c')](_0x548a72)){if(this[_0xb7a0('0x9')][_0x53c809['uniqueid']][_0x548a72][_0xb7a0('0x52')]==_0xb7a0('0x66')&&this[_0xb7a0('0x9')][_0x53c809[_0xb7a0('0x27')]][_0x548a72][_0xb7a0('0x16')]){logger[_0xb7a0('0x26')](_0xb7a0('0x7f'),_0x53c809['uniqueid'],_0x548a72);this[_0xb7a0('0x9')][_0x53c809['uniqueid']][_0x548a72][_0xb7a0('0x65')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xb7a0('0x32')](_0xb7a0('0x80'),_0x53c809[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_['values'](this[_0xb7a0('0x9')][_0x53c809[_0xb7a0('0x27')]]),{'showHidden':![],'depth':null}));ami[_0xb7a0('0x24')](_0xb7a0('0x81'),_['values'](this['channels'][_0x53c809[_0xb7a0('0x27')]]));this[_0xb7a0('0x82')](_0x53c809[_0xb7a0('0x27')]);}if(this['variables'][_0x53c809['uniqueid']]){delete this['variables'][_0x53c809['uniqueid']];}}}catch(_0x315fb4){logger[_0xb7a0('0x56')](_0xb7a0('0x83'),_0x53c809[_0xb7a0('0x27')],util['inspect'](_0x315fb4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')]['syncAttendedTransfer']=function(_0x69061a){try{if(this['isNotNull'](_0x69061a)){logger[_0xb7a0('0x32')](_0xb7a0('0x84'),_0x69061a[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x69061a,{'showHidden':![],'depth':null}));if(this[_0xb7a0('0x9')][_0x69061a['transfereeuniqueid']]){for(var _0x57f0b8 in this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x85')]]){if(this['channels'][_0x69061a[_0xb7a0('0x85')]][_0xb7a0('0x3c')](_0x57f0b8)){if(_0x69061a['origtransfereruniqueid']===_0x57f0b8){logger[_0xb7a0('0x26')](_0xb7a0('0x86'),_0x69061a['uniqueid'],this['channels'][_0x69061a['transfereeuniqueid']][_0x57f0b8][_0xb7a0('0x28')],_0x57f0b8);var _0x3ac983=moment();this[_0xb7a0('0x9')][_0x69061a['transfereeuniqueid']][_0x57f0b8][_0xb7a0('0x16')]=!![];this['channels'][_0x69061a[_0xb7a0('0x85')]][_0x57f0b8][_0xb7a0('0x65')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x85')]][_0x57f0b8]['lastevent']='complete';this['channels'][_0x69061a[_0xb7a0('0x85')]][_0x57f0b8][_0xb7a0('0x52')]='transfer';this['channels'][_0x69061a['transfereeuniqueid']][_0x57f0b8]['talktime']=_0x3ac983[_0xb7a0('0x87')](this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x85')]][_0x57f0b8]['agentconnectAt'],'seconds');}}}}if(this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x88')]]){var _0x5b1292=this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x88')]];this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x88')]]=this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x85')]];this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x85')]]=_0x5b1292;}}}catch(_0x1a1913){logger[_0xb7a0('0x56')](_0xb7a0('0x89'),_0x69061a[_0xb7a0('0x27')],util['inspect'](_0x1a1913,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')]['syncBlindTransfer']=function(_0x5d4831){try{if(this[_0xb7a0('0x25')](_0x5d4831)){logger[_0xb7a0('0x32')](_0xb7a0('0x8a'),_0x5d4831[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x5d4831,{'showHidden':![],'depth':null}));if(this[_0xb7a0('0x9')][_0x5d4831['transfereeuniqueid']]){for(var _0x18c091 in this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]]){if(this[_0xb7a0('0x9')][_0x5d4831['transfereeuniqueid']][_0xb7a0('0x3c')](_0x18c091)){if(_0x5d4831[_0xb7a0('0x8b')]===_0x18c091){logger[_0xb7a0('0x26')](_0xb7a0('0x8c'),_0x5d4831[_0xb7a0('0x27')],this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091][_0xb7a0('0x28')],_0x18c091);var _0x2d5694=moment();this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091]['agentcomplete']=!![];this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091]['agentcompleteAt']=_0x2d5694;this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091]['lastevent']=_0xb7a0('0x8d');this['channels'][_0x5d4831[_0xb7a0('0x85')]][_0x18c091][_0xb7a0('0x52')]=_0xb7a0('0x66');this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091][_0xb7a0('0x68')]=_0x2d5694[_0xb7a0('0x87')](this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091]['agentconnectAt'],_0xb7a0('0x8e'));}}}}}}catch(_0x325129){logger[_0xb7a0('0x56')]('[%s][voiceAgentReport][blindtransfer]',_0x5d4831[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x325129,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x1d')]=function(_0x842ff3){var _0x167bd5='';try{if(this[_0xb7a0('0x25')](_0x842ff3)){logger[_0xb7a0('0x32')](_0xb7a0('0x8f'),_0x842ff3[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x842ff3,{'showHidden':![],'depth':null}));if(_0x842ff3['channel']){_0x167bd5=_0x842ff3[_0xb7a0('0x90')][_0xb7a0('0x91')](0x0,_0x842ff3['channel'][_0xb7a0('0x92')]('-'));if(this[_0xb7a0('0xb')][_0x167bd5]){logger[_0xb7a0('0x26')](_0xb7a0('0x93'),_0x842ff3[_0xb7a0('0x27')],_0x167bd5);this[_0xb7a0('0xb')][_0x167bd5][_0xb7a0('0x94')]=!![];}}}}catch(_0x55021f){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x842ff3[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x55021f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')]['syncMusicOnHoldStop']=function(_0x22272f){var _0x24da9c='';try{if(this[_0xb7a0('0x25')](_0x22272f)){logger[_0xb7a0('0x32')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x22272f[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x22272f,{'showHidden':![],'depth':null}));if(_0x22272f[_0xb7a0('0x90')]){_0x24da9c=_0x22272f['channel'][_0xb7a0('0x91')](0x0,_0x22272f[_0xb7a0('0x90')][_0xb7a0('0x92')]('-'));if(this['agents'][_0x24da9c]){logger[_0xb7a0('0x26')](_0xb7a0('0x95'),_0x22272f[_0xb7a0('0x27')],_0x24da9c);this[_0xb7a0('0xb')][_0x24da9c][_0xb7a0('0x94')]=![];}}}}catch(_0x166ec1){logger[_0xb7a0('0x56')](_0xb7a0('0x96'),_0x22272f[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x166ec1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x82')]=function(_0x2bcbc3,_0x2922d9=0x2710){if(this[_0xb7a0('0x9')][_0x2bcbc3]){setTimeout(()=>{delete this['channels'][_0x2bcbc3];},_0x2922d9);}};module[_0xb7a0('0x97')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 377f3c0..355e6fe 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 _0x8a3a=['[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','info','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','from-sip','undefined','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','queue','toLowerCase','duration','subtract','seconds','disposition','includes','lastapplication','lastdata','startsWith','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','membername','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','push','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','user:agentcomplete','length','transferType','resolve','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','set','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','agents','coreshowchannel','syncNewExten','bind','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstop','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','channels','pick','keys','context','channel','split','destconnectedlinenum','connectedlinenum','format','user:%s','user:agentconnect','accountcode'];(function(_0x5ba581,_0x5d632e){var _0x4a30b2=function(_0x3ebe3d){while(--_0x3ebe3d){_0x5ba581['push'](_0x5ba581['shift']());}};_0x4a30b2(++_0x5d632e);}(_0x8a3a,0x155));var _0xa8a3=function(_0xa85d47,_0x386a18){_0xa85d47=_0xa85d47-0x0;var _0x1b8387=_0x8a3a[_0xa85d47];return _0x1b8387;};'use strict';var _=require(_0xa8a3('0x0'));var moment=require(_0xa8a3('0x1'));var util=require(_0xa8a3('0x2'));var path=require(_0xa8a3('0x3'));var Redis=require(_0xa8a3('0x4'));var config=require(_0xa8a3('0x5'));var logger=require(_0xa8a3('0x6'))(_0xa8a3('0x7'));var ami=require(_0xa8a3('0x8'));var Channel=require(_0xa8a3('0x9'));var RpcSetting=require('../rpc/setting');var applications=[_0xa8a3('0xa'),'queue',_0xa8a3('0xb'),_0xa8a3('0xc'),'playback',_0xa8a3('0xd')];var dispositions=[_0xa8a3('0xe'),_0xa8a3('0xf'),_0xa8a3('0xf'),'NO\x20ANSWER',_0xa8a3('0xe'),_0xa8a3('0xe'),_0xa8a3('0x10'),_0xa8a3('0x11'),_0xa8a3('0xf'),'FAILED','FAILED'];config[_0xa8a3('0x12')]=_[_0xa8a3('0x13')](config['redis'],{'host':_0xa8a3('0x14'),'port':0x18eb});var io=require(_0xa8a3('0x15'))(new Redis(config[_0xa8a3('0x12')]));function VoiceCallReport(_0x3d8e8f){this['channels']=_0x3d8e8f['channels'];this['agents']=_0x3d8e8f[_0xa8a3('0x16')];this['blindTransfers']={};ami['on'](_0xa8a3('0x17'),this[_0xa8a3('0x18')][_0xa8a3('0x19')](this));ami['on']('newexten',this[_0xa8a3('0x18')][_0xa8a3('0x19')](this));ami['on'](_0xa8a3('0x1a'),this['syncNewChannel'][_0xa8a3('0x19')](this));ami['on'](_0xa8a3('0x1b'),this[_0xa8a3('0x1c')][_0xa8a3('0x19')](this));ami['on'](_0xa8a3('0x1d'),this[_0xa8a3('0x1e')]['bind'](this));ami['on'](_0xa8a3('0x1f'),this[_0xa8a3('0x20')][_0xa8a3('0x19')](this));ami['on'](_0xa8a3('0x21'),this[_0xa8a3('0x22')]['bind'](this));ami['on'](_0xa8a3('0x23'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xa8a3('0x24'),this[_0xa8a3('0x25')][_0xa8a3('0x19')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xa8a3('0x19')](this));ami['on'](_0xa8a3('0x26'),this['syncMusicOnHoldStop'][_0xa8a3('0x19')](this));try{logger['info']('[voiceCallReport][coreshowchannels]\x20started');ami[_0xa8a3('0x27')]();}catch(_0x526e16){logger[_0xa8a3('0x28')](_0xa8a3('0x29'),util[_0xa8a3('0x2a')](_0x526e16,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa8a3('0x2b')][_0xa8a3('0x2c')]=function(_0x436fe8){return _0x436fe8!==null&&!_[_0xa8a3('0x2d')](_0x436fe8);};VoiceCallReport[_0xa8a3('0x2b')][_0xa8a3('0x2e')]=function(_0x591bd3,_0x3a47e5,_0x5c4b74){io['to'](_0x591bd3)[_0xa8a3('0x2e')](_0x3a47e5,_0x5c4b74);};VoiceCallReport[_0xa8a3('0x2b')][_0xa8a3('0x22')]=function(_0x17b319){try{if(this[_0xa8a3('0x2c')](_0x17b319)){logger['info'](_0xa8a3('0x2f'),_0x17b319[_0xa8a3('0x30')],_0x17b319[_0xa8a3('0x31')],_0x17b319[_0xa8a3('0x32')]);logger[_0xa8a3('0x33')](_0xa8a3('0x34'),_0x17b319[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x17b319,{'showHidden':![],'depth':null}));if(_0x17b319[_0xa8a3('0x30')]===_0x17b319[_0xa8a3('0x35')]){if(!_[_0xa8a3('0x2d')](this['channels'][_0x17b319[_0xa8a3('0x30')]])){_[_0xa8a3('0x36')](this[_0xa8a3('0x37')][_0x17b319[_0xa8a3('0x30')]],_[_0xa8a3('0x38')](_0x17b319,_[_0xa8a3('0x39')](this[_0xa8a3('0x37')][_0x17b319['uniqueid']])));}}if(_0x17b319[_0xa8a3('0x3a')]==='from-sip'){var _0x233247=this[_0xa8a3('0x16')][_0x17b319[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]];if(_0x233247){if(_0x17b319['exten']=='xcally-motion-preview'){_0x233247[_0xa8a3('0x3d')]=_0x17b319[_0xa8a3('0x3e')];this[_0xa8a3('0x2e')](util[_0xa8a3('0x3f')](_0xa8a3('0x40'),_0x233247['name']),_0xa8a3('0x41'),{'id':_0x233247['id'],'destaccountcode':_0x233247[_0xa8a3('0x42')],'destconnectedlinenum':_0x17b319[_0xa8a3('0x3e')]});}}}}}catch(_0x1ed8b9){logger['error'](_0xa8a3('0x43'),_0x17b319[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x1ed8b9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa8a3('0x2b')]['syncNewChannel']=function(_0x317f46){try{if(this[_0xa8a3('0x2c')](_0x317f46)){logger[_0xa8a3('0x33')](_0xa8a3('0x44'),_0x317f46['uniqueid'],util[_0xa8a3('0x2a')](_0x317f46,{'showHidden':![],'depth':null}));if(this[_0xa8a3('0x37')][_0x317f46[_0xa8a3('0x30')]]){return;}if(_0x317f46['channel']===_0xa8a3('0x45')){return;}if(_0x317f46['uniqueid']!==_0x317f46['linkedid']&&!this[_0xa8a3('0x46')][_0x317f46[_0xa8a3('0x35')]]){return;}logger[_0xa8a3('0x47')](_0xa8a3('0x48'),_0x317f46[_0xa8a3('0x30')],_0x317f46[_0xa8a3('0x3a')],_0x317f46[_0xa8a3('0x49')]);this[_0xa8a3('0x37')][_0x317f46[_0xa8a3('0x30')]]=new Channel();this[_0xa8a3('0x37')][_0x317f46[_0xa8a3('0x30')]][_0xa8a3('0x4a')]=moment()['format'](_0xa8a3('0x4b'));this['channels'][_0x317f46[_0xa8a3('0x30')]]['disposition']=dispositions[_[_0xa8a3('0x4c')](_0x317f46['channelstate'])];_[_0xa8a3('0x36')](this[_0xa8a3('0x37')][_0x317f46[_0xa8a3('0x30')]],_[_0xa8a3('0x38')](_0x317f46,_[_0xa8a3('0x39')](this[_0xa8a3('0x37')][_0x317f46['uniqueid']])));if(_0x317f46[_0xa8a3('0x3a')]===_0xa8a3('0x4d')){var _0x1e85b8=this['agents'][_0x317f46[_0xa8a3('0x3b')]['split']('-')[0x0]];if(_0x1e85b8&&typeof _0x1e85b8[_0xa8a3('0x3d')]===_0xa8a3('0x4e')){_0x1e85b8[_0xa8a3('0x3d')]=_0x317f46[_0xa8a3('0x49')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x317f46[_0xa8a3('0x30')],util['inspect']({'id':_0x1e85b8['id'],'destaccountcode':_0x1e85b8[_0xa8a3('0x42')],'destconnectedlinenum':_0x317f46['exten']},{'showHidden':![],'depth':null}));this[_0xa8a3('0x2e')](util[_0xa8a3('0x3f')](_0xa8a3('0x40'),_0x1e85b8[_0xa8a3('0x4f')]),_0xa8a3('0x41'),{'id':_0x1e85b8['id'],'destaccountcode':_0x1e85b8['accountcode'],'destconnectedlinenum':_0x317f46[_0xa8a3('0x49')]});}}}}catch(_0x4c03ac){logger[_0xa8a3('0x28')](_0xa8a3('0x50'),_0x317f46['uniqueid'],util['inspect'](_0x4c03ac,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x2d3c90){try{if(this[_0xa8a3('0x2c')](_0x2d3c90)){logger[_0xa8a3('0x33')](_0xa8a3('0x51'),_0x2d3c90[_0xa8a3('0x30')],util['inspect'](_0x2d3c90,{'showHidden':![],'depth':null}));if(_0x2d3c90[_0xa8a3('0x3b')]==='OutgoingSpoolFailed'||_0x2d3c90[_0xa8a3('0x49')]==='h')return;if(_0x2d3c90['uniqueid']===_0x2d3c90[_0xa8a3('0x35')]||this[_0xa8a3('0x46')][_0x2d3c90[_0xa8a3('0x35')]]){_0x2d3c90[_0xa8a3('0x52')]=_0x2d3c90[_0xa8a3('0x52')]?_0x2d3c90[_0xa8a3('0x52')]['toLowerCase']():undefined;_0x2d3c90[_0xa8a3('0x53')]=_0x2d3c90[_0xa8a3('0x54')]||_0x2d3c90[_0xa8a3('0x53')];if(_0x2d3c90[_0xa8a3('0x54')]&&_0x2d3c90[_0xa8a3('0x52')]!==_0xa8a3('0x55')){_0x2d3c90['applicationdata']=_0x2d3c90[_0xa8a3('0x53')][_0xa8a3('0x56')]();}logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2d3c90[_0xa8a3('0x30')],_0x2d3c90[_0xa8a3('0x52')],_0x2d3c90['applicationdata']);if(_[_0xa8a3('0x2d')](this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]])){this['channels'][_0x2d3c90[_0xa8a3('0x30')]]=new Channel();this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]][_0xa8a3('0x4a')]=_0x2d3c90[_0xa8a3('0x57')]?moment()[_0xa8a3('0x58')](moment[_0xa8a3('0x57')](_0x2d3c90[_0xa8a3('0x57')])[_0xa8a3('0x59')](),_0xa8a3('0x59'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xa8a3('0x3f')](_0xa8a3('0x4b'));this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]][_0xa8a3('0x5a')]='NO\x20ANSWER';}_[_0xa8a3('0x36')](this[_0xa8a3('0x37')][_0x2d3c90['uniqueid']],_['pick'](_0x2d3c90,_[_0xa8a3('0x39')](this[_0xa8a3('0x37')][_0x2d3c90['uniqueid']])));if(_[_0xa8a3('0x5b')](applications,_0x2d3c90[_0xa8a3('0x52')])){this['channels'][_0x2d3c90[_0xa8a3('0x30')]][_0xa8a3('0x5c')]=_0x2d3c90[_0xa8a3('0x52')];this[_0xa8a3('0x37')][_0x2d3c90['uniqueid']][_0xa8a3('0x5d')]=_0x2d3c90[_0xa8a3('0x53')];if(_0x2d3c90[_0xa8a3('0x52')]===_0xa8a3('0xa')&&_[_0xa8a3('0x5e')](_0x2d3c90['applicationdata'][_0xa8a3('0x56')](),_0xa8a3('0x5f'))){var _0xace0de=_0x2d3c90[_0xa8a3('0x53')][_0xa8a3('0x3c')]('=');var _0x326e25=_0xace0de[0x0][_0xa8a3('0x56')]()['match'](/cdr\((.*)\)/);if(_0x326e25){if(_0x326e25[0x1]==='type'&&!_['isNil'](this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]][_0x326e25[0x1]]))return;this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]][_0x326e25[0x1]]=_0xace0de[0x1];}}else if(_0x2d3c90['application']==='queue'){this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]][_0xa8a3('0x55')]=_0x2d3c90[_0xa8a3('0x53')][_0xa8a3('0x3c')](',')[0x0];}}}}}catch(_0x4925c2){logger[_0xa8a3('0x28')](_0xa8a3('0x60'),_0x2d3c90[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x4925c2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa8a3('0x2b')]['syncNewState']=function(_0x471411){try{if(this[_0xa8a3('0x2c')](_0x471411)){logger['info'](_0xa8a3('0x61'),_0x471411[_0xa8a3('0x30')],_0x471411['linkedid'],_0x471411[_0xa8a3('0x31')],_0x471411[_0xa8a3('0x32')]);logger[_0xa8a3('0x33')]('[%s][voiceCallReport][newstate]\x20event:',_0x471411[_0xa8a3('0x30')],util['inspect'](_0x471411,{'showHidden':![],'depth':null}));if(_0x471411[_0xa8a3('0x62')]!=='6')return;var _0x1fa304=this[_0xa8a3('0x16')][_0x471411[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]];if(_0x471411['uniqueid']!==_0x471411[_0xa8a3('0x35')]){var _0x35fc7f=moment();if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]){if(!this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]][_0xa8a3('0x63')]){this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]['answered']=!![];this['channels'][_0x471411['linkedid']][_0xa8a3('0x64')]=_0x35fc7f[_0xa8a3('0x3f')](_0xa8a3('0x4b'));if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]][_0xa8a3('0x4a')]){this[_0xa8a3('0x37')][_0x471411['linkedid']][_0xa8a3('0x65')]=_0x35fc7f[_0xa8a3('0x66')](this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]][_0xa8a3('0x4a')],_0xa8a3('0x59'));}}this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]['linkedid']=_0x471411['uniqueid'];if(_0x471411[_0xa8a3('0x32')]!==_0xa8a3('0x67')){this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]['connectedlinenum']=_0x471411[_0xa8a3('0x32')];}this['channels'][_0x471411[_0xa8a3('0x35')]][_0xa8a3('0x68')]=_0x471411['calleridname'];this[_0xa8a3('0x37')][_0x471411['linkedid']][_0xa8a3('0x69')]=_0x471411[_0xa8a3('0x3b')];this['channels'][_0x471411['linkedid']]['disposition']=dispositions[_[_0xa8a3('0x4c')](_0x471411['channelstate'])];if(_0x1fa304){this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]['UserId']=_0x1fa304['id'];this[_0xa8a3('0x37')][_0x471411['linkedid']][_0xa8a3('0x6a')]=_0x1fa304[_0xa8a3('0x4f')];}}if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]){if(!this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]][_0xa8a3('0x63')]){this['channels'][_0x471411[_0xa8a3('0x30')]][_0xa8a3('0x63')]=!![];this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]['answertime']=_0x35fc7f['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]['starttime']){this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]][_0xa8a3('0x65')]=_0x35fc7f[_0xa8a3('0x66')](this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]][_0xa8a3('0x4a')],_0xa8a3('0x59'));}}if(_0x471411[_0xa8a3('0x32')]!==_0xa8a3('0x67')){this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]['connectedlinenum']=_0x471411[_0xa8a3('0x32')];}this['channels'][_0x471411[_0xa8a3('0x30')]][_0xa8a3('0x68')]=_0x471411[_0xa8a3('0x31')];this['channels'][_0x471411[_0xa8a3('0x30')]]['destinationchannel']=_0x471411[_0xa8a3('0x3b')];this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]['disposition']=dispositions[_[_0xa8a3('0x4c')](_0x471411[_0xa8a3('0x62')])];}}else{if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]){if(_0x1fa304){this['channels'][_0x471411[_0xa8a3('0x30')]]['UserId']=_0x1fa304['id'];this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]['membername']=_0x1fa304[_0xa8a3('0x4f')];}}}if(_0x471411['context']===_0xa8a3('0x4d')){if(_0x1fa304){_0x1fa304[_0xa8a3('0x3d')]=_0x471411[_0xa8a3('0x49')];var _0x38e1e5;if(this['channels'][_0x471411[_0xa8a3('0x30')]]){_0x38e1e5=this[_0xa8a3('0x37')][_0x471411['uniqueid']][_0xa8a3('0x55')];}else if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]){_0x38e1e5=this[_0xa8a3('0x37')][_0x471411['linkedid']][_0xa8a3('0x55')];}_0x1fa304[_0xa8a3('0x55')]=_0x38e1e5;var _0x503a13={'id':_0x1fa304['id'],'name':_0x1fa304[_0xa8a3('0x4f')],'agentconnected':!![],'destaccountcode':_0x1fa304[_0xa8a3('0x42')],'destconnectedlinenum':_0x471411['exten'],'queue':_0x38e1e5||undefined,'uniqueid':_0x471411[_0xa8a3('0x35')]};logger['debug'](_0xa8a3('0x6b'),_0x471411[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x503a13,{'showHidden':![],'depth':null}));this[_0xa8a3('0x2e')](util[_0xa8a3('0x3f')](_0xa8a3('0x40'),_0x1fa304[_0xa8a3('0x4f')]),_0xa8a3('0x41'),_0x503a13);}}}}catch(_0x179e77){logger[_0xa8a3('0x28')]('[%s][voiceCallReport][newstate]',_0x471411[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x179e77,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa8a3('0x2b')]['syncMixMonitorFilename']=function(_0x484164,_0x4cb025){try{if(this[_0xa8a3('0x37')][_0x484164]){logger[_0xa8a3('0x47')](_0xa8a3('0x6c'),_0x484164,_0x4cb025);this[_0xa8a3('0x37')][_0x484164][_0xa8a3('0x6d')]=!![];if(_[_0xa8a3('0x6e')](_0x4cb025,_0xa8a3('0x6f'))){_0x4cb025=_0x4cb025[_0xa8a3('0x70')](_0xa8a3('0x6f'),_0xa8a3('0x71'));}this['channels'][_0x484164][_0xa8a3('0x72')]=_0x4cb025;var _0x2acc15=_['find'](this[_0xa8a3('0x37')][_0x484164][_0xa8a3('0x73')],{'filename':_0x4cb025});if(_['isNil'](_0x2acc15)){this[_0xa8a3('0x37')][_0x484164][_0xa8a3('0x73')][_0xa8a3('0x74')]({'filename':_0x4cb025,'createdAt':moment()[_0xa8a3('0x3f')](_0xa8a3('0x4b')),'mixmonitorid':'','status':'rec'});}}}catch(_0x3d6f64){logger[_0xa8a3('0x28')]('[%s][voiceCallReport][mixMonitorFilename]',_0x484164,util[_0xa8a3('0x2a')](_0x3d6f64,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa8a3('0x1e')]=function(_0x2beffa){try{if(this[_0xa8a3('0x2c')](_0x2beffa)){logger['debug'](_0xa8a3('0x75'),_0x2beffa['uniqueid'],util[_0xa8a3('0x2a')](_0x2beffa,{'showHidden':![],'depth':null}));if(this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]]&&_0x2beffa[_0xa8a3('0x3b')]!=_0xa8a3('0x45')){if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')])){if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x77')])){logger[_0xa8a3('0x47')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x79')](_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);}else if(this['isNotNull'](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x7a')])){logger[_0xa8a3('0x47')](_0xa8a3('0x7b'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x32')]=_0x2beffa[_0xa8a3('0x78')];}else if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x7c')])){logger[_0xa8a3('0x47')](_0xa8a3('0x7d'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x7e')]=_0x2beffa['value'];}else if(this[_0xa8a3('0x2c')](_0x2beffa['variable'][_0xa8a3('0x7f')])){logger[_0xa8a3('0x47')](_0xa8a3('0x80'),_0x2beffa['uniqueid'],_0x2beffa[_0xa8a3('0x78')]);this['channels'][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x81')]=_0x2beffa[_0xa8a3('0x78')];}else if(this['isNotNull'](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x82')])){logger['info'](_0xa8a3('0x83'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]['split'](',')[0x0]);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x55')]=_0x2beffa[_0xa8a3('0x78')][_0xa8a3('0x3c')](',')[0x0];}else if(this['isNotNull'](_0x2beffa[_0xa8a3('0x76')]['xmd-originatecalleridnum'])){logger[_0xa8a3('0x47')](_0xa8a3('0x84'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa['value']);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x85')]=_0x2beffa['value'];}else if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x86')])){logger['info'](_0xa8a3('0x87'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa['value']);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x88')]=_0x2beffa[_0xa8a3('0x78')];}else if(this[_0xa8a3('0x2c')](_0x2beffa['variable'][_0xa8a3('0x89')])){logger[_0xa8a3('0x47')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]]['calleridpreview']=_0x2beffa['value'];}else if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x8a')])){logger[_0xa8a3('0x47')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]]['queue']=_0x2beffa['value'];}else if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x8b')])){logger[_0xa8a3('0x47')](_0xa8a3('0x8c'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa['value']);this[_0xa8a3('0x37')][_0x2beffa['uniqueid']][_0xa8a3('0x8d')]=_0x2beffa[_0xa8a3('0x78')];}}}else if(this['isNotNull'](_0x2beffa['variable'][_0xa8a3('0x77')])){if(_0x2beffa[_0xa8a3('0x78')]){var _0x40a7de=path[_0xa8a3('0x8e')](_0x2beffa[_0xa8a3('0x78')])[_0xa8a3('0x4f')];logger[_0xa8a3('0x47')](_0xa8a3('0x8f'),_0x40a7de,_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x79')](_0x40a7de,_0x2beffa['value']);}}else if(this[_0xa8a3('0x37')][_0x2beffa['linkedid']]){if(this['isNotNull'](_0x2beffa[_0xa8a3('0x76')])){if(this[_0xa8a3('0x2c')](_0x2beffa['variable'][_0xa8a3('0x8b')])){logger[_0xa8a3('0x47')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x2beffa[_0xa8a3('0x35')],_0x2beffa['value']);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x35')]][_0xa8a3('0x90')]=_0x2beffa[_0xa8a3('0x78')];}}}}}catch(_0x32b980){logger[_0xa8a3('0x28')](_0xa8a3('0x91'),_0x2beffa[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x32b980,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa8a3('0x2b')]['syncHangup']=function(_0x2cfb00){try{if(this[_0xa8a3('0x2c')](_0x2cfb00)){logger[_0xa8a3('0x33')](_0xa8a3('0x92'),_0x2cfb00[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x2cfb00,{'showHidden':![],'depth':null}));if(this[_0xa8a3('0x46')][_0x2cfb00['linkedid']]){if(this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]]){this['channels'][this['blindTransfers'][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]][_0xa8a3('0x30')]=_0x2cfb00[_0xa8a3('0x30')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]]['linkedid']]['answered']=this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x63')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]][_0xa8a3('0x64')]=this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x64')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x35')]][_0xa8a3('0x69')]=this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]]['channel'];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]][_0xa8a3('0x5a')]=this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x5a')];this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]]=this['channels'][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]];this[_0xa8a3('0x93')](this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x35')]);}else if(this['channels'][this['blindTransfers'][_0x2cfb00['linkedid']]['uniqueid']]){this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]]['uniqueid']=[this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x30')]][_0xa8a3('0x35')],this[_0xa8a3('0x37')][this['blindTransfers'][_0x2cfb00[_0xa8a3('0x35')]]['uniqueid']][_0xa8a3('0x35')]=this[_0xa8a3('0x37')][this['blindTransfers'][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]]['uniqueid']][0x0];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]][_0xa8a3('0x63')]=this['channels'][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x63')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x30')]]['answertime']=this['channels'][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x64')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]]['destinationchannel']=this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x30')]][_0xa8a3('0x3b')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]][_0xa8a3('0x5a')]=this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x5a')];this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]]=this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]];this[_0xa8a3('0x93')](this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x30')]);}}if(this['channels'][_0x2cfb00[_0xa8a3('0x30')]]){logger[_0xa8a3('0x47')](_0xa8a3('0x94'),_0x2cfb00[_0xa8a3('0x30')],_0x2cfb00['cause-txt']);var _0x39aabe=moment();this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x95')]=_0x39aabe[_0xa8a3('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x57')]=_0x39aabe[_0xa8a3('0x66')](this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]]['starttime'],'seconds');if(this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x63')]){this['channels'][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x96')]=_0x39aabe[_0xa8a3('0x66')](this[_0xa8a3('0x37')][_0x2cfb00['uniqueid']][_0xa8a3('0x64')],_0xa8a3('0x59'));this['channels'][_0x2cfb00[_0xa8a3('0x30')]]['holdtime']=this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x57')]-this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x96')];}if(_0x2cfb00[_0xa8a3('0x3a')]===_0xa8a3('0x4d')){if(this['agents'][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]]){this['agents'][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]]=_[_0xa8a3('0x97')](this['agents'][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]],[_0xa8a3('0x3d')]);logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x2cfb00[_0xa8a3('0x30')],util[_0xa8a3('0x2a')]({'id':this[_0xa8a3('0x16')][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xa8a3('0x16')][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]][_0xa8a3('0x42')]},{'showHidden':![],'depth':null}));this[_0xa8a3('0x2e')](util[_0xa8a3('0x3f')](_0xa8a3('0x40'),this[_0xa8a3('0x16')][_0x2cfb00[_0xa8a3('0x3b')]['split']('-')[0x0]][_0xa8a3('0x4f')]),_0xa8a3('0x98'),{'id':this[_0xa8a3('0x16')][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xa8a3('0x16')][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]][_0xa8a3('0x42')]});for(var _0x3c2265=0x0;_0x3c2265{delete this[_0xa8a3('0x37')][_0x2615fd];},_0x1fb287);}};module[_0xa8a3('0xcb')]=VoiceCallReport; \ No newline at end of file +var _0x35df=['[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','transferToInternal','isEmpty','monitors','getSettings','stopRecordingOnTransfer','resolve','then','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%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][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','transfereecalleridnum','transfereruniqueid','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','lodash','moment','path','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','pick','keys','context','from-sip','channel','exten','connectedlinenum','format','user:%s','name','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','destconnectedlinenum','undefined','user:agentconnect','[%s][voiceCallReport][newchannel]','application','applicationdata','appdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','lastapplication','startsWith','cdr(','split','match','type','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','membername','xcally-motion-preview','UserId','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','push','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','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','cause-txt','endtime','billableseconds','omit'];(function(_0x2dfd28,_0x153b3c){var _0x49c016=function(_0x1cfb4d){while(--_0x1cfb4d){_0x2dfd28['push'](_0x2dfd28['shift']());}};_0x49c016(++_0x153b3c);}(_0x35df,0xff));var _0xf35d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x35df[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xf35d('0x0'));var moment=require(_0xf35d('0x1'));var util=require('util');var path=require(_0xf35d('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xf35d('0x3'))(_0xf35d('0x4'));var ami=require(_0xf35d('0x5'));var Channel=require(_0xf35d('0x6'));var RpcSetting=require(_0xf35d('0x7'));var applications=[_0xf35d('0x8'),_0xf35d('0x9'),_0xf35d('0xa'),_0xf35d('0xb'),_0xf35d('0xc'),_0xf35d('0xd')];var dispositions=['NO\x20ANSWER',_0xf35d('0xe'),_0xf35d('0xe'),_0xf35d('0xf'),_0xf35d('0xf'),'NO\x20ANSWER',_0xf35d('0x10'),'BUSY','FAILED',_0xf35d('0xe'),_0xf35d('0xe')];config[_0xf35d('0x11')]=_[_0xf35d('0x12')](config[_0xf35d('0x11')],{'host':_0xf35d('0x13'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf35d('0x11')]));function VoiceCallReport(_0x48b82d){this['channels']=_0x48b82d[_0xf35d('0x14')];this[_0xf35d('0x15')]=_0x48b82d[_0xf35d('0x15')];this[_0xf35d('0x16')]={};ami['on'](_0xf35d('0x17'),this[_0xf35d('0x18')][_0xf35d('0x19')](this));ami['on']('newexten',this[_0xf35d('0x18')]['bind'](this));ami['on']('newchannel',this['syncNewChannel'][_0xf35d('0x19')](this));ami['on']('newstate',this['syncNewState'][_0xf35d('0x19')](this));ami['on'](_0xf35d('0x1a'),this[_0xf35d('0x1b')][_0xf35d('0x19')](this));ami['on'](_0xf35d('0x1c'),this[_0xf35d('0x1d')][_0xf35d('0x19')](this));ami['on'](_0xf35d('0x1e'),this[_0xf35d('0x1f')][_0xf35d('0x19')](this));ami['on'](_0xf35d('0x20'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xf35d('0x21'),this[_0xf35d('0x22')]['bind'](this));ami['on'](_0xf35d('0x23'),this[_0xf35d('0x24')]['bind'](this));ami['on']('musiconholdstop',this[_0xf35d('0x25')][_0xf35d('0x19')](this));try{logger[_0xf35d('0x26')](_0xf35d('0x27'));ami[_0xf35d('0x28')]();}catch(_0x22853b){logger['error'](_0xf35d('0x29'),util[_0xf35d('0x2a')](_0x22853b,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf35d('0x2b')][_0xf35d('0x2c')]=function(_0x350619){return _0x350619!==null&&!_[_0xf35d('0x2d')](_0x350619);};VoiceCallReport[_0xf35d('0x2b')][_0xf35d('0x2e')]=function(_0x2e27f7,_0x45483f,_0x401600){io['to'](_0x2e27f7)[_0xf35d('0x2e')](_0x45483f,_0x401600);};VoiceCallReport['prototype'][_0xf35d('0x1f')]=function(_0x3bd1eb){try{if(this[_0xf35d('0x2c')](_0x3bd1eb)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x3bd1eb[_0xf35d('0x2f')],_0x3bd1eb['calleridname'],_0x3bd1eb[_0xf35d('0x30')]);logger[_0xf35d('0x31')](_0xf35d('0x32'),_0x3bd1eb[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x3bd1eb,{'showHidden':![],'depth':null}));if(_0x3bd1eb[_0xf35d('0x2f')]===_0x3bd1eb['linkedid']){if(!_[_0xf35d('0x2d')](this[_0xf35d('0x14')][_0x3bd1eb[_0xf35d('0x2f')]])){_[_0xf35d('0x33')](this[_0xf35d('0x14')][_0x3bd1eb[_0xf35d('0x2f')]],_[_0xf35d('0x34')](_0x3bd1eb,_[_0xf35d('0x35')](this['channels'][_0x3bd1eb[_0xf35d('0x2f')]])));}}if(_0x3bd1eb[_0xf35d('0x36')]===_0xf35d('0x37')){var _0x326c25=this[_0xf35d('0x15')][_0x3bd1eb[_0xf35d('0x38')]['split']('-')[0x0]];if(_0x326c25){if(_0x3bd1eb[_0xf35d('0x39')]=='xcally-motion-preview'){_0x326c25['destconnectedlinenum']=_0x3bd1eb[_0xf35d('0x3a')];this[_0xf35d('0x2e')](util[_0xf35d('0x3b')](_0xf35d('0x3c'),_0x326c25[_0xf35d('0x3d')]),'user:agentconnect',{'id':_0x326c25['id'],'destaccountcode':_0x326c25[_0xf35d('0x3e')],'destconnectedlinenum':_0x3bd1eb[_0xf35d('0x3a')]});}}}}}catch(_0x40b75b){logger[_0xf35d('0x3f')](_0xf35d('0x40'),_0x3bd1eb[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x40b75b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf35d('0x2b')]['syncNewChannel']=function(_0x311adf){try{if(this['isNotNull'](_0x311adf)){logger['debug'](_0xf35d('0x41'),_0x311adf[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x311adf,{'showHidden':![],'depth':null}));if(this[_0xf35d('0x14')][_0x311adf[_0xf35d('0x2f')]]){return;}if(_0x311adf['channel']===_0xf35d('0x42')){return;}if(_0x311adf[_0xf35d('0x2f')]!==_0x311adf[_0xf35d('0x43')]&&!this[_0xf35d('0x16')][_0x311adf[_0xf35d('0x43')]]){return;}logger[_0xf35d('0x26')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x311adf[_0xf35d('0x2f')],_0x311adf[_0xf35d('0x36')],_0x311adf[_0xf35d('0x39')]);this[_0xf35d('0x14')][_0x311adf[_0xf35d('0x2f')]]=new Channel();this[_0xf35d('0x14')][_0x311adf['uniqueid']][_0xf35d('0x44')]=moment()['format'](_0xf35d('0x45'));this[_0xf35d('0x14')][_0x311adf['uniqueid']][_0xf35d('0x46')]=dispositions[_[_0xf35d('0x47')](_0x311adf[_0xf35d('0x48')])];_[_0xf35d('0x33')](this['channels'][_0x311adf[_0xf35d('0x2f')]],_[_0xf35d('0x34')](_0x311adf,_[_0xf35d('0x35')](this['channels'][_0x311adf[_0xf35d('0x2f')]])));if(_0x311adf['context']===_0xf35d('0x37')){var _0x2235a0=this[_0xf35d('0x15')][_0x311adf['channel']['split']('-')[0x0]];if(_0x2235a0&&typeof _0x2235a0[_0xf35d('0x49')]===_0xf35d('0x4a')){_0x2235a0[_0xf35d('0x49')]=_0x311adf[_0xf35d('0x39')];logger[_0xf35d('0x31')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x311adf[_0xf35d('0x2f')],util[_0xf35d('0x2a')]({'id':_0x2235a0['id'],'destaccountcode':_0x2235a0[_0xf35d('0x3e')],'destconnectedlinenum':_0x311adf[_0xf35d('0x39')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xf35d('0x3b')](_0xf35d('0x3c'),_0x2235a0[_0xf35d('0x3d')]),_0xf35d('0x4b'),{'id':_0x2235a0['id'],'destaccountcode':_0x2235a0[_0xf35d('0x3e')],'destconnectedlinenum':_0x311adf[_0xf35d('0x39')]});}}}}catch(_0x20cea9){logger[_0xf35d('0x3f')](_0xf35d('0x4c'),_0x311adf[_0xf35d('0x2f')],util['inspect'](_0x20cea9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf35d('0x2b')][_0xf35d('0x18')]=function(_0x1a2f45){try{if(this[_0xf35d('0x2c')](_0x1a2f45)){logger[_0xf35d('0x31')]('[%s][voiceCallReport][newexten]\x20event:',_0x1a2f45[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x1a2f45,{'showHidden':![],'depth':null}));if(_0x1a2f45['channel']===_0xf35d('0x42')||_0x1a2f45[_0xf35d('0x39')]==='h')return;if(_0x1a2f45['uniqueid']===_0x1a2f45[_0xf35d('0x43')]||this[_0xf35d('0x16')][_0x1a2f45[_0xf35d('0x43')]]){_0x1a2f45[_0xf35d('0x4d')]=_0x1a2f45[_0xf35d('0x4d')]?_0x1a2f45[_0xf35d('0x4d')]['toLowerCase']():undefined;_0x1a2f45[_0xf35d('0x4e')]=_0x1a2f45[_0xf35d('0x4f')]||_0x1a2f45[_0xf35d('0x4e')];if(_0x1a2f45[_0xf35d('0x4f')]&&_0x1a2f45[_0xf35d('0x4d')]!==_0xf35d('0x9')){_0x1a2f45[_0xf35d('0x4e')]=_0x1a2f45[_0xf35d('0x4e')][_0xf35d('0x50')]();}logger[_0xf35d('0x26')](_0xf35d('0x51'),_0x1a2f45[_0xf35d('0x2f')],_0x1a2f45['application'],_0x1a2f45[_0xf35d('0x4e')]);if(_[_0xf35d('0x2d')](this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]])){this[_0xf35d('0x14')][_0x1a2f45['uniqueid']]=new Channel();this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]]['starttime']=_0x1a2f45[_0xf35d('0x52')]?moment()[_0xf35d('0x53')](moment[_0xf35d('0x52')](_0x1a2f45[_0xf35d('0x52')])['seconds'](),_0xf35d('0x54'))['format'](_0xf35d('0x45')):moment()[_0xf35d('0x3b')](_0xf35d('0x45'));this['channels'][_0x1a2f45['uniqueid']][_0xf35d('0x46')]=_0xf35d('0xf');}_[_0xf35d('0x33')](this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]],_[_0xf35d('0x34')](_0x1a2f45,_[_0xf35d('0x35')](this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]])));if(_['includes'](applications,_0x1a2f45[_0xf35d('0x4d')])){this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]][_0xf35d('0x55')]=_0x1a2f45[_0xf35d('0x4d')];this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]]['lastdata']=_0x1a2f45[_0xf35d('0x4e')];if(_0x1a2f45[_0xf35d('0x4d')]===_0xf35d('0x8')&&_[_0xf35d('0x56')](_0x1a2f45[_0xf35d('0x4e')][_0xf35d('0x50')](),_0xf35d('0x57'))){var _0xe30798=_0x1a2f45[_0xf35d('0x4e')][_0xf35d('0x58')]('=');var _0x103bbb=_0xe30798[0x0]['toLowerCase']()[_0xf35d('0x59')](/cdr\((.*)\)/);if(_0x103bbb){if(_0x103bbb[0x1]===_0xf35d('0x5a')&&!_['isNil'](this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]][_0x103bbb[0x1]]))return;this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]][_0x103bbb[0x1]]=_0xe30798[0x1];}}else if(_0x1a2f45[_0xf35d('0x4d')]===_0xf35d('0x9')){this['channels'][_0x1a2f45[_0xf35d('0x2f')]][_0xf35d('0x9')]=_0x1a2f45[_0xf35d('0x4e')][_0xf35d('0x58')](',')[0x0];}}}}}catch(_0x50fe17){logger[_0xf35d('0x3f')](_0xf35d('0x5b'),_0x1a2f45[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x50fe17,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf35d('0x5c')]=function(_0x1fae33){try{if(this[_0xf35d('0x2c')](_0x1fae33)){logger[_0xf35d('0x26')](_0xf35d('0x5d'),_0x1fae33[_0xf35d('0x2f')],_0x1fae33['linkedid'],_0x1fae33[_0xf35d('0x5e')],_0x1fae33[_0xf35d('0x30')]);logger[_0xf35d('0x31')](_0xf35d('0x5f'),_0x1fae33[_0xf35d('0x2f')],util['inspect'](_0x1fae33,{'showHidden':![],'depth':null}));if(_0x1fae33[_0xf35d('0x48')]!=='6')return;var _0x4be9d9=this[_0xf35d('0x15')][_0x1fae33[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]];if(_0x1fae33['uniqueid']!==_0x1fae33[_0xf35d('0x43')]){var _0x557650=moment();if(this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]]){if(!this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x60')]){this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]]['answered']=!![];this['channels'][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x61')]=_0x557650['format'](_0xf35d('0x45'));if(this[_0xf35d('0x14')][_0x1fae33['linkedid']][_0xf35d('0x44')]){this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x62')]=_0x557650[_0xf35d('0x63')](this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x44')],_0xf35d('0x54'));}}this[_0xf35d('0x14')][_0x1fae33['linkedid']][_0xf35d('0x43')]=_0x1fae33['uniqueid'];if(_0x1fae33[_0xf35d('0x30')]!=='xcally-motion-preview'){this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x3a')]=_0x1fae33['calleridnum'];}this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x64')]=_0x1fae33[_0xf35d('0x5e')];this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x65')]=_0x1fae33['channel'];this[_0xf35d('0x14')][_0x1fae33['linkedid']][_0xf35d('0x46')]=dispositions[_[_0xf35d('0x47')](_0x1fae33[_0xf35d('0x48')])];if(_0x4be9d9){this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]]['UserId']=_0x4be9d9['id'];this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x66')]=_0x4be9d9[_0xf35d('0x3d')];}}if(this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]]){if(!this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x60')]){this[_0xf35d('0x14')][_0x1fae33['uniqueid']][_0xf35d('0x60')]=!![];this['channels'][_0x1fae33['uniqueid']][_0xf35d('0x61')]=_0x557650[_0xf35d('0x3b')](_0xf35d('0x45'));if(this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x44')]){this['channels'][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x62')]=_0x557650[_0xf35d('0x63')](this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x44')],_0xf35d('0x54'));}}if(_0x1fae33['calleridnum']!==_0xf35d('0x67')){this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x3a')]=_0x1fae33['calleridnum'];}this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x64')]=_0x1fae33[_0xf35d('0x5e')];this[_0xf35d('0x14')][_0x1fae33['uniqueid']]['destinationchannel']=_0x1fae33['channel'];this['channels'][_0x1fae33[_0xf35d('0x2f')]]['disposition']=dispositions[_[_0xf35d('0x47')](_0x1fae33[_0xf35d('0x48')])];}}else{if(this[_0xf35d('0x14')][_0x1fae33['uniqueid']]){if(_0x4be9d9){this['channels'][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x68')]=_0x4be9d9['id'];this[_0xf35d('0x14')][_0x1fae33['uniqueid']][_0xf35d('0x66')]=_0x4be9d9[_0xf35d('0x3d')];}}}if(_0x1fae33[_0xf35d('0x36')]==='from-sip'){if(_0x4be9d9){_0x4be9d9[_0xf35d('0x49')]=_0x1fae33['exten'];var _0xf2490;if(this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]]){_0xf2490=this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x9')];}else if(this[_0xf35d('0x14')][_0x1fae33['linkedid']]){_0xf2490=this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x9')];}_0x4be9d9[_0xf35d('0x9')]=_0xf2490;var _0x9f57d2={'id':_0x4be9d9['id'],'name':_0x4be9d9[_0xf35d('0x3d')],'agentconnected':!![],'destaccountcode':_0x4be9d9[_0xf35d('0x3e')],'destconnectedlinenum':_0x1fae33[_0xf35d('0x39')],'queue':_0xf2490||undefined,'uniqueid':_0x1fae33[_0xf35d('0x43')]};logger[_0xf35d('0x31')](_0xf35d('0x69'),_0x1fae33['uniqueid'],util[_0xf35d('0x2a')](_0x9f57d2,{'showHidden':![],'depth':null}));this[_0xf35d('0x2e')](util[_0xf35d('0x3b')](_0xf35d('0x3c'),_0x4be9d9[_0xf35d('0x3d')]),'user:agentconnect',_0x9f57d2);}}}}catch(_0x3a56d1){logger[_0xf35d('0x3f')](_0xf35d('0x6a'),_0x1fae33[_0xf35d('0x2f')],util['inspect'](_0x3a56d1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf35d('0x6b')]=function(_0x3ea4e6,_0x17fe0f){try{if(this['channels'][_0x3ea4e6]){logger[_0xf35d('0x26')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x3ea4e6,_0x17fe0f);this[_0xf35d('0x14')][_0x3ea4e6][_0xf35d('0x6c')]=!![];if(_[_0xf35d('0x6d')](_0x17fe0f,_0xf35d('0x6e'))){_0x17fe0f=_0x17fe0f[_0xf35d('0x6f')](_0xf35d('0x6e'),_0xf35d('0x70'));}this['channels'][_0x3ea4e6][_0xf35d('0x71')]=_0x17fe0f;var _0x274fbb=_['find'](this[_0xf35d('0x14')][_0x3ea4e6]['monitors'],{'filename':_0x17fe0f});if(_['isNil'](_0x274fbb)){this['channels'][_0x3ea4e6]['monitors'][_0xf35d('0x72')]({'filename':_0x17fe0f,'createdAt':moment()[_0xf35d('0x3b')](_0xf35d('0x45')),'mixmonitorid':'','status':_0xf35d('0x73')});}}}catch(_0x3976c6){logger['error'](_0xf35d('0x74'),_0x3ea4e6,util[_0xf35d('0x2a')](_0x3976c6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf35d('0x1b')]=function(_0x5a34e9){try{if(this[_0xf35d('0x2c')](_0x5a34e9)){logger[_0xf35d('0x31')]('[%s][voiceCallReport][varset]\x20event:',_0x5a34e9[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x5a34e9,{'showHidden':![],'depth':null}));if(this[_0xf35d('0x14')][_0x5a34e9['uniqueid']]&&_0x5a34e9[_0xf35d('0x38')]!=_0xf35d('0x42')){if(this[_0xf35d('0x2c')](_0x5a34e9['variable'])){if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x76')])){logger[_0xf35d('0x26')](_0xf35d('0x77'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x6b')](_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x79')])){logger['info'](_0xf35d('0x7a'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9['uniqueid']][_0xf35d('0x30')]=_0x5a34e9['value'];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x7b')])){logger['info'](_0xf35d('0x7c'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9['value']);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x7d')]=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x7e')])){logger[_0xf35d('0x26')](_0xf35d('0x7f'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]]['type']=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x80')])){logger[_0xf35d('0x26')](_0xf35d('0x81'),_0x5a34e9['uniqueid'],_0x5a34e9[_0xf35d('0x78')][_0xf35d('0x58')](',')[0x0]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x9')]=_0x5a34e9[_0xf35d('0x78')][_0xf35d('0x58')](',')[0x0];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x82')])){logger[_0xf35d('0x26')](_0xf35d('0x83'),_0x5a34e9['uniqueid'],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x84')]=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9['variable']['xmd-destination'])){logger[_0xf35d('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x85')]=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')]['xmd-callerid-preview'])){logger['info'](_0xf35d('0x86'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this['channels'][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x87')]=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9['variable'][_0xf35d('0x88')])){logger[_0xf35d('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x9')]=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x89')])){logger[_0xf35d('0x26')](_0xf35d('0x8a'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x8b')]=_0x5a34e9['value'];}}}else if(this['isNotNull'](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x76')])){if(_0x5a34e9[_0xf35d('0x78')]){var _0x197d88=path[_0xf35d('0x8c')](_0x5a34e9[_0xf35d('0x78')])[_0xf35d('0x3d')];logger[_0xf35d('0x26')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x197d88,_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x6b')](_0x197d88,_0x5a34e9['value']);}}else if(this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x43')]]){if(this[_0xf35d('0x2c')](_0x5a34e9['variable'])){if(this[_0xf35d('0x2c')](_0x5a34e9['variable']['sipcallid'])){logger[_0xf35d('0x26')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5a34e9[_0xf35d('0x43')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9['linkedid']][_0xf35d('0x8d')]=_0x5a34e9['value'];}}}}}catch(_0x3e3982){logger['error'](_0xf35d('0x8e'),_0x5a34e9[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x3e3982,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf35d('0x2b')][_0xf35d('0x1d')]=function(_0x5f29c0){try{if(this[_0xf35d('0x2c')](_0x5f29c0)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x5f29c0[_0xf35d('0x2f')],util['inspect'](_0x5f29c0,{'showHidden':![],'depth':null}));if(this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]){if(this['channels'][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x43')]]){this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0['linkedid']][_0xf35d('0x43')]][_0xf35d('0x2f')]=_0x5f29c0['uniqueid'];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['linkedid']][_0xf35d('0x60')]=this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x60')];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['linkedid']][_0xf35d('0x61')]=this[_0xf35d('0x14')][_0x5f29c0['uniqueid']][_0xf35d('0x61')];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x43')]][_0xf35d('0x65')]=this['channels'][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x43')]][_0xf35d('0x38')];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['linkedid']][_0xf35d('0x46')]=this[_0xf35d('0x14')][_0x5f29c0['uniqueid']][_0xf35d('0x46')];this['channels'][_0x5f29c0[_0xf35d('0x2f')]]=this[_0xf35d('0x14')][this['blindTransfers'][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x43')]];this[_0xf35d('0x8f')](this['blindTransfers'][_0x5f29c0['linkedid']]['linkedid']);}else if(this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]]){this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['uniqueid']][_0xf35d('0x2f')]=[this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0['linkedid']]['uniqueid']]['linkedid'],this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]][_0xf35d('0x43')]=this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['uniqueid']][_0xf35d('0x2f')]][0x0];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['uniqueid']][_0xf35d('0x60')]=this['channels'][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x60')];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]][_0xf35d('0x61')]=this['channels'][_0x5f29c0[_0xf35d('0x2f')]]['answertime'];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]][_0xf35d('0x65')]=this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0['linkedid']][_0xf35d('0x2f')]][_0xf35d('0x38')];this[_0xf35d('0x14')][this['blindTransfers'][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]][_0xf35d('0x46')]=this[_0xf35d('0x14')][_0x5f29c0['uniqueid']][_0xf35d('0x46')];this['channels'][_0x5f29c0[_0xf35d('0x2f')]]=this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['uniqueid']];this['deleteChannelAfterTimeout'](this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]);}}if(this[_0xf35d('0x14')][_0x5f29c0['uniqueid']]){logger[_0xf35d('0x26')](_0xf35d('0x90'),_0x5f29c0[_0xf35d('0x2f')],_0x5f29c0[_0xf35d('0x91')]);var _0x431654=moment();this[_0xf35d('0x14')][_0x5f29c0['uniqueid']][_0xf35d('0x92')]=_0x431654['format'](_0xf35d('0x45'));this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]]['duration']=_0x431654['diff'](this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x44')],_0xf35d('0x54'));if(this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x60')]){this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x93')]=_0x431654[_0xf35d('0x63')](this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x61')],_0xf35d('0x54'));this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x62')]=this['channels'][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x52')]-this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]]['billableseconds'];}if(_0x5f29c0[_0xf35d('0x36')]===_0xf35d('0x37')){if(this[_0xf35d('0x15')][_0x5f29c0[_0xf35d('0x38')]['split']('-')[0x0]]){this['agents'][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]]=_[_0xf35d('0x94')](this[_0xf35d('0x15')][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]],[_0xf35d('0x49')]);logger['debug'](_0xf35d('0x95'),_0x5f29c0[_0xf35d('0x2f')],util[_0xf35d('0x2a')]({'id':this[_0xf35d('0x15')][_0x5f29c0['channel'][_0xf35d('0x58')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xf35d('0x2e')](util[_0xf35d('0x3b')]('user:%s',this['agents'][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]][_0xf35d('0x3d')]),_0xf35d('0x96'),{'id':this[_0xf35d('0x15')][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]]['id'],'destaccountcode':this[_0xf35d('0x15')][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]]['accountcode']});for(var _0x4571a3=0x0;_0x4571a3{delete this['channels'][_0x2846cb];},_0x1fa830);}};module[_0xf35d('0xc9')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 2e7fcea..b6b847b 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 _0x0360=['[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','keys','variable','outboundrouteid','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','starttime','total','answered','holdtime','diff','seconds','sumHoldTime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','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]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','match','exports','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','bind','dialend','syncDialEnd','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','substring'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0360,0xae));var _0x0036=function(_0x5e6676,_0x219aa4){_0x5e6676=_0x5e6676-0x0;var _0x26199b=_0x0360[_0x5e6676];return _0x26199b;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require(_0x0036('0x0'));var config=require(_0x0036('0x1'));var logger=require(_0x0036('0x2'))(_0x0036('0x3'));var ami=require('../ami');config[_0x0036('0x4')]=_[_0x0036('0x5')](config[_0x0036('0x4')],{'host':_0x0036('0x6'),'port':0x18eb});var io=require(_0x0036('0x7'))(new Redis(config[_0x0036('0x4')]));function VoiceDialReport(_0x29e43a){this[_0x0036('0x8')]=_0x29e43a[_0x0036('0x9')];this[_0x0036('0xa')]=_0x29e43a[_0x0036('0xa')];this[_0x0036('0xb')]={};this[_0x0036('0xc')]={};ami['on']('dialbegin',this['syncDialBegin'][_0x0036('0xd')](this));ami['on'](_0x0036('0xe'),this[_0x0036('0xf')]['bind'](this));ami['on'](_0x0036('0x10'),this['syncVarSet'][_0x0036('0xd')](this));ami['on'](_0x0036('0x11'),this[_0x0036('0x12')][_0x0036('0xd')](this));}VoiceDialReport[_0x0036('0x13')][_0x0036('0x14')]=function(_0x66f9ac){return _0x66f9ac!==null&&!_[_0x0036('0x15')](_0x66f9ac);};VoiceDialReport['prototype'][_0x0036('0x16')]=function(_0x1ddd1e,_0xf6a60e,_0x145faa){io['to'](_0x1ddd1e)[_0x0036('0x16')](_0xf6a60e,_0x145faa);};VoiceDialReport[_0x0036('0x13')]['syncDialBegin']=function(_0x4e4eba){try{if(this[_0x0036('0x14')](_0x4e4eba)){logger[_0x0036('0x17')](_0x0036('0x18'),_0x4e4eba[_0x0036('0x19')],util[_0x0036('0x1a')](_0x4e4eba,{'showHidden':![],'depth':null}));if(this[_0x0036('0x8')][_0x4e4eba[_0x0036('0x19')]]){_[_0x0036('0x1b')](this['channels'][_0x4e4eba[_0x0036('0x19')]],{'starttime':moment()[_0x0036('0x1c')](_0x0036('0x1d')),'lastevent':_0x0036('0x1e'),'interface':_0x4e4eba['channel']['substring'](0x0,_0x4e4eba[_0x0036('0x1f')][_0x0036('0x20')]('-')),'membername':_0x4e4eba[_0x0036('0x1f')]['substring'](_0x4e4eba['channel'][_0x0036('0x20')]('/')+0x1,_0x4e4eba[_0x0036('0x1f')][_0x0036('0x20')]('-'))},_[_0x0036('0x21')](_0x4e4eba,[_0x0036('0x22'),_0x0036('0x23')]));logger[_0x0036('0x24')](_0x0036('0x25'),_0x4e4eba['uniqueid'],this[_0x0036('0x8')][_0x4e4eba['uniqueid']][_0x0036('0x26')],this['channels'][_0x4e4eba[_0x0036('0x19')]]['interface']);logger[_0x0036('0x17')](_0x0036('0x27'),_0x4e4eba[_0x0036('0x19')],util[_0x0036('0x1a')](this[_0x0036('0x8')][_0x4e4eba['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x0036('0xb')][_0x4e4eba[_0x0036('0x19')]])_['merge'](this[_0x0036('0x8')][_0x4e4eba[_0x0036('0x19')]],this[_0x0036('0xb')][_0x4e4eba[_0x0036('0x19')]]);this[_0x0036('0x16')](_0x0036('0x28'),_0x0036('0x29'),this[_0x0036('0x8')][_0x4e4eba[_0x0036('0x19')]]);logger[_0x0036('0x17')](_0x0036('0x2a'),_0x4e4eba[_0x0036('0x19')],util[_0x0036('0x1a')](this['channels'][_0x4e4eba[_0x0036('0x19')]],{'showHidden':![],'depth':null}));ami[_0x0036('0x16')](_0x0036('0x2b'),this[_0x0036('0x8')][_0x4e4eba['uniqueid']]);}}}catch(_0x36b9c3){logger[_0x0036('0x2c')](_0x0036('0x2d'),_0x4e4eba[_0x0036('0x19')],util[_0x0036('0x1a')](_0x36b9c3,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0036('0xf')]=function(_0x7ddd10){try{if(this[_0x0036('0x14')](_0x7ddd10)){logger[_0x0036('0x17')](_0x0036('0x2e'),_0x7ddd10[_0x0036('0x19')],util[_0x0036('0x1a')](_0x7ddd10,{'showHidden':![],'depth':null}));if(this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]]){this['channels'][_0x7ddd10['uniqueid']][_0x0036('0x2f')]=_0x7ddd10[_0x0036('0x2f')];if(_0x7ddd10[_0x0036('0x2f')]==='ANSWER'){this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]][_0x0036('0x30')]=_0x7ddd10[_0x0036('0x30')];this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]]['connectedlinename']=_0x7ddd10['connectedlinename'];this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]][_0x0036('0x31')]=moment()[_0x0036('0x1c')](_0x0036('0x1d'));this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]][_0x0036('0x32')]=_0x0036('0x33');logger['info'](_0x0036('0x34'),_0x7ddd10[_0x0036('0x19')],_0x7ddd10[_0x0036('0x1f')][_0x0036('0x35')](_0x7ddd10[_0x0036('0x1f')][_0x0036('0x20')]('/')+0x1,_0x7ddd10[_0x0036('0x1f')][_0x0036('0x20')]('-')));logger[_0x0036('0x17')](_0x0036('0x36'),_0x7ddd10[_0x0036('0x19')],util['inspect'](this[_0x0036('0x8')][_0x7ddd10['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]]);}logger[_0x0036('0x17')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x7ddd10[_0x0036('0x19')],util[_0x0036('0x1a')](this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]],{'showHidden':![],'depth':null}));this[_0x0036('0x16')]('voice:outbound',_0x0036('0x29'),this['channels'][_0x7ddd10[_0x0036('0x19')]]);}}}catch(_0x93b04f){logger[_0x0036('0x2c')](_0x0036('0x37'),_0x7ddd10[_0x0036('0x19')],util[_0x0036('0x1a')](_0x93b04f,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0036('0x38')]=function(_0x26f47b){try{if(this[_0x0036('0x14')](_0x26f47b)){logger['debug'](_0x0036('0x39'),_0x26f47b[_0x0036('0x19')],util[_0x0036('0x1a')](_0x26f47b,{'showHidden':![],'depth':null}));this['addVariable'](_0x26f47b['uniqueid'],_[_0x0036('0x3a')](_0x26f47b['variable'])[0x0],_0x26f47b['value']);if(this[_0x0036('0x14')](_0x26f47b['variable'])&&this[_0x0036('0x14')](_0x26f47b[_0x0036('0x3b')][_0x0036('0x3c')])){if(_[_0x0036('0x15')](this['channels'][_0x26f47b['uniqueid']])){this[_0x0036('0x8')][_0x26f47b[_0x0036('0x19')]]={'routeId':_0x26f47b[_0x0036('0x3d')],'variables':this['variables'][_0x26f47b[_0x0036('0x19')]],'motionChannel':_0x0036('0x3e')};logger['info'](_0x0036('0x3f'),_0x26f47b[_0x0036('0x19')],_0x26f47b[_0x0036('0x3b')][_0x0036('0x3c')],_['keys'](_0x26f47b['variable'])[0x0],_0x26f47b['value']);logger['debug'](_0x0036('0x40'),_0x26f47b[_0x0036('0x19')],util[_0x0036('0x1a')](this[_0x0036('0x8')][_0x26f47b[_0x0036('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0x0036('0x28'),_0x0036('0x29'),this[_0x0036('0x8')][_0x26f47b[_0x0036('0x19')]]);}}}}catch(_0x2afae1){logger['error']('[%s][voiceDialReport][varset]',_0x26f47b[_0x0036('0x19')],util[_0x0036('0x1a')](_0x2afae1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0036('0x13')][_0x0036('0x41')]=function(_0x3861df,_0x465830,_0x213a09){var _0x1d99c1=[_0x0036('0x42'),_0x0036('0x43'),_0x0036('0x44'),'rtpaudioqosjitterbridged',_0x0036('0x45'),_0x0036('0x46'),_0x0036('0x47'),_0x0036('0x48'),_0x0036('0x49'),'sipuri','bridgepeer',_0x0036('0x4a'),_0x0036('0x4b'),_0x0036('0x4c'),_0x0036('0x4d'),'memberlastcall',_0x0036('0x26'),_0x0036('0x4e'),_0x0036('0x4f')];if(!_[_0x0036('0x50')](_0x465830)&&!_['includes'](_0x1d99c1,_0x465830)){if(_[_0x0036('0x15')](this['variables'][_0x3861df])){this[_0x0036('0xc')][_0x3861df]={};}this[_0x0036('0xc')][_0x3861df][_0x465830]=_0x213a09;}};VoiceDialReport[_0x0036('0x13')][_0x0036('0x12')]=function(_0x3a3c6e){try{if(this[_0x0036('0x14')](_0x3a3c6e)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x3a3c6e[_0x0036('0x19')],util[_0x0036('0x1a')](_0x3a3c6e,{'showHidden':![],'depth':null}));if(this[_0x0036('0x8')][_0x3a3c6e['uniqueid']]){logger[_0x0036('0x24')](_0x0036('0x51'),_0x3a3c6e['uniqueid'],_0x3a3c6e['cause-txt']);this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x52')]=moment()[_0x0036('0x1c')](_0x0036('0x1d'));this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x53')]=moment(this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x52')])['diff'](this['channels'][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x54')],'seconds');this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x32')]='complete';this[_0x0036('0xa')][_0x0036('0x55')]+=0x1;if(this['channels'][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x31')]){this[_0x0036('0xa')][_0x0036('0x56')]+=0x1;this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x57')]=moment(this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]]['answertime'])[_0x0036('0x58')](this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x54')],_0x0036('0x59'));this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]]['billableseconds']=moment(this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x52')])[_0x0036('0x58')](this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x31')],_0x0036('0x59'));this[_0x0036('0xa')][_0x0036('0x5a')]+=this['channels'][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x57')]||0x0;this[_0x0036('0xa')][_0x0036('0x5b')]+=this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x5c')];}this[_0x0036('0xa')][_0x0036('0x5d')]+=this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]]['duration'];logger[_0x0036('0x17')](_0x0036('0x5e'),_0x3a3c6e['uniqueid'],util[_0x0036('0x1a')](this['channels'][_0x3a3c6e[_0x0036('0x19')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceDialReport',this['channels'][_0x3a3c6e[_0x0036('0x19')]]);logger[_0x0036('0x17')](_0x0036('0x5f'),_0x3a3c6e[_0x0036('0x19')],util[_0x0036('0x1a')](this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0036('0x60'),this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]]);logger[_0x0036('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x3a3c6e[_0x0036('0x19')],util[_0x0036('0x1a')](this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x0036('0x61'),this[_0x0036('0xa')]);logger[_0x0036('0x24')](_0x0036('0x62'),JSON[_0x0036('0x63')](this['channels'][_0x3a3c6e['uniqueid']]));logger[_0x0036('0x17')](_0x0036('0x64'),_0x3a3c6e[_0x0036('0x19')],util['inspect'](this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0x0036('0x28'),_0x0036('0x65'),this['channels'][_0x3a3c6e['uniqueid']]);this[_0x0036('0x66')](_0x3a3c6e[_0x0036('0x19')]);}else if(this['channels'][_0x3a3c6e['linkedid']]){this['channels'][_0x3a3c6e[_0x0036('0x67')]][_0x0036('0x19')]=this['channels'][_0x3a3c6e[_0x0036('0x67')]][_0x0036('0x68')];}if(this['variables'][_0x3a3c6e['uniqueid']]){delete this[_0x0036('0xc')][_0x3a3c6e[_0x0036('0x19')]];}}}catch(_0x4de4dd){logger[_0x0036('0x2c')](_0x0036('0x69'),_0x3a3c6e[_0x0036('0x19')],util[_0x0036('0x1a')](_0x4de4dd,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0036('0x13')][_0x0036('0x6a')]=function(_0x2c71fa){try{if(this[_0x0036('0x14')](_0x2c71fa)){logger[_0x0036('0x17')](_0x0036('0x6b'),_0x2c71fa[_0x0036('0x19')],util[_0x0036('0x1a')](_0x2c71fa,{'showHidden':![],'depth':null}));if(_0x2c71fa[_0x0036('0x6c')][_0x0036('0x6d')]()===_0x0036('0x6e')){_0x2c71fa['applicationdata']=(_0x2c71fa['appdata']||_0x2c71fa[_0x0036('0x6f')])['toLowerCase']();if(_['startsWith'](_0x2c71fa[_0x0036('0x6f')],'cdr(')){if(_['isUndefined'](this['applications'][_0x2c71fa[_0x0036('0x19')]]))this[_0x0036('0xb')][_0x2c71fa['uniqueid']]={};logger[_0x0036('0x24')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x2c71fa[_0x0036('0x19')],_0x2c71fa[_0x0036('0x6c')],_0x2c71fa[_0x0036('0x6f')]);var _0x410570=_0x2c71fa['applicationdata']['split']('=');var _0x487084=_0x410570[0x0][_0x0036('0x70')](/cdr\((.*)\)/);if(_0x487084)this['applications'][_0x2c71fa['uniqueid']][_0x487084[0x1]]=_0x410570[0x1];}}}}catch(_0x486dbb){logger[_0x0036('0x2c')]('[%s][voiceDialReport][newexten]',_0x2c71fa[_0x0036('0x19')],util[_0x0036('0x1a')](_0x486dbb,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0036('0x66')]=function(_0x5b2b88,_0x367e4f=0x2710){if(this[_0x0036('0x8')][_0x5b2b88]){setTimeout(()=>{delete this['channels'][_0x5b2b88];},_0x367e4f);}};module[_0x0036('0x71')]=VoiceDialReport; \ No newline at end of file +var _0x3565=['syncDialBegin','bind','syncDialEnd','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','format','called','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','applications','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','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','keys','value','variable','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','complete','total','answered','holdtime','answertime','seconds','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','appdata','startsWith','applicationdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','match','[%s][voiceDialReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','channels','outbound','variables','dialbegin'];(function(_0x504416,_0x15e991){var _0x18322a=function(_0x2a7d34){while(--_0x2a7d34){_0x504416['push'](_0x504416['shift']());}};_0x18322a(++_0x15e991);}(_0x3565,0x158));var _0x5356=function(_0x375bcf,_0x3aadd5){_0x375bcf=_0x375bcf-0x0;var _0x36a753=_0x3565[_0x375bcf];return _0x36a753;};'use strict';var _=require('lodash');var moment=require(_0x5356('0x0'));var util=require(_0x5356('0x1'));var Redis=require(_0x5356('0x2'));var config=require(_0x5356('0x3'));var logger=require(_0x5356('0x4'))('ami');var ami=require(_0x5356('0x5'));config[_0x5356('0x6')]=_['defaults'](config[_0x5356('0x6')],{'host':_0x5356('0x7'),'port':0x18eb});var io=require(_0x5356('0x8'))(new Redis(config[_0x5356('0x6')]));function VoiceDialReport(_0x1355bc){this[_0x5356('0x9')]=_0x1355bc['outboundChannels'];this[_0x5356('0xa')]=_0x1355bc['outbound'];this['applications']={};this[_0x5356('0xb')]={};ami['on'](_0x5356('0xc'),this[_0x5356('0xd')][_0x5356('0xe')](this));ami['on']('dialend',this[_0x5356('0xf')][_0x5356('0xe')](this));ami['on'](_0x5356('0x10'),this['syncVarSet'][_0x5356('0xe')](this));ami['on'](_0x5356('0x11'),this[_0x5356('0x12')][_0x5356('0xe')](this));}VoiceDialReport[_0x5356('0x13')][_0x5356('0x14')]=function(_0xa5c9be){return _0xa5c9be!==null&&!_[_0x5356('0x15')](_0xa5c9be);};VoiceDialReport[_0x5356('0x13')][_0x5356('0x16')]=function(_0x3552ae,_0x14bf20,_0xae83f9){io['to'](_0x3552ae)[_0x5356('0x16')](_0x14bf20,_0xae83f9);};VoiceDialReport[_0x5356('0x13')][_0x5356('0xd')]=function(_0x561c0b){try{if(this[_0x5356('0x14')](_0x561c0b)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x561c0b['uniqueid'],util['inspect'](_0x561c0b,{'showHidden':![],'depth':null}));if(this['channels'][_0x561c0b[_0x5356('0x17')]]){_['merge'](this[_0x5356('0x9')][_0x561c0b[_0x5356('0x17')]],{'starttime':moment()[_0x5356('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x5356('0x19'),'interface':_0x561c0b[_0x5356('0x1a')][_0x5356('0x1b')](0x0,_0x561c0b[_0x5356('0x1a')][_0x5356('0x1c')]('-')),'membername':_0x561c0b[_0x5356('0x1a')][_0x5356('0x1b')](_0x561c0b[_0x5356('0x1a')][_0x5356('0x1c')]('/')+0x1,_0x561c0b[_0x5356('0x1a')][_0x5356('0x1c')]('-'))},_[_0x5356('0x1d')](_0x561c0b,[_0x5356('0x1e'),'privilege']));logger[_0x5356('0x1f')](_0x5356('0x20'),_0x561c0b[_0x5356('0x17')],this[_0x5356('0x9')][_0x561c0b[_0x5356('0x17')]][_0x5356('0x21')],this[_0x5356('0x9')][_0x561c0b[_0x5356('0x17')]][_0x5356('0x22')]);logger[_0x5356('0x23')](_0x5356('0x24'),_0x561c0b[_0x5356('0x17')],util[_0x5356('0x25')](this['channels'][_0x561c0b[_0x5356('0x17')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x561c0b[_0x5356('0x17')]])_['merge'](this['channels'][_0x561c0b['uniqueid']],this[_0x5356('0x26')][_0x561c0b[_0x5356('0x17')]]);this['emit'](_0x5356('0x27'),_0x5356('0x28'),this[_0x5356('0x9')][_0x561c0b[_0x5356('0x17')]]);logger[_0x5356('0x23')](_0x5356('0x29'),_0x561c0b[_0x5356('0x17')],util[_0x5356('0x25')](this[_0x5356('0x9')][_0x561c0b[_0x5356('0x17')]],{'showHidden':![],'depth':null}));ami[_0x5356('0x16')](_0x5356('0x2a'),this['channels'][_0x561c0b['uniqueid']]);}}}catch(_0x267db6){logger[_0x5356('0x2b')](_0x5356('0x2c'),_0x561c0b[_0x5356('0x17')],util['inspect'](_0x267db6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5356('0x13')]['syncDialEnd']=function(_0x18210f){try{if(this[_0x5356('0x14')](_0x18210f)){logger[_0x5356('0x23')](_0x5356('0x2d'),_0x18210f[_0x5356('0x17')],util['inspect'](_0x18210f,{'showHidden':![],'depth':null}));if(this[_0x5356('0x9')][_0x18210f['uniqueid']]){this['channels'][_0x18210f[_0x5356('0x17')]][_0x5356('0x2e')]=_0x18210f[_0x5356('0x2e')];if(_0x18210f['dialstatus']===_0x5356('0x2f')){this[_0x5356('0x9')][_0x18210f[_0x5356('0x17')]][_0x5356('0x30')]=_0x18210f[_0x5356('0x30')];this[_0x5356('0x9')][_0x18210f[_0x5356('0x17')]][_0x5356('0x31')]=_0x18210f[_0x5356('0x31')];this['channels'][_0x18210f[_0x5356('0x17')]]['answertime']=moment()['format'](_0x5356('0x32'));this[_0x5356('0x9')][_0x18210f['uniqueid']][_0x5356('0x33')]=_0x5356('0x34');logger[_0x5356('0x1f')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x18210f[_0x5356('0x17')],_0x18210f[_0x5356('0x1a')][_0x5356('0x1b')](_0x18210f[_0x5356('0x1a')][_0x5356('0x1c')]('/')+0x1,_0x18210f[_0x5356('0x1a')][_0x5356('0x1c')]('-')));logger[_0x5356('0x23')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x18210f[_0x5356('0x17')],util[_0x5356('0x25')](this['channels'][_0x18210f['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x5356('0x35'),this[_0x5356('0x9')][_0x18210f['uniqueid']]);}logger[_0x5356('0x23')](_0x5356('0x36'),_0x18210f[_0x5356('0x17')],util['inspect'](this[_0x5356('0x9')][_0x18210f['uniqueid']],{'showHidden':![],'depth':null}));this[_0x5356('0x16')](_0x5356('0x27'),'voice_outbound_channel:save',this[_0x5356('0x9')][_0x18210f[_0x5356('0x17')]]);}}}catch(_0xf57505){logger['error'](_0x5356('0x37'),_0x18210f[_0x5356('0x17')],util[_0x5356('0x25')](_0xf57505,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5356('0x13')][_0x5356('0x38')]=function(_0x34655d){try{if(this[_0x5356('0x14')](_0x34655d)){logger[_0x5356('0x23')](_0x5356('0x39'),_0x34655d[_0x5356('0x17')],util[_0x5356('0x25')](_0x34655d,{'showHidden':![],'depth':null}));this['addVariable'](_0x34655d[_0x5356('0x17')],_[_0x5356('0x3a')](_0x34655d['variable'])[0x0],_0x34655d[_0x5356('0x3b')]);if(this[_0x5356('0x14')](_0x34655d[_0x5356('0x3c')])&&this[_0x5356('0x14')](_0x34655d[_0x5356('0x3c')][_0x5356('0x3d')])){if(_['isUndefined'](this[_0x5356('0x9')][_0x34655d[_0x5356('0x17')]])){this[_0x5356('0x9')][_0x34655d[_0x5356('0x17')]]={'routeId':_0x34655d['value'],'variables':this['variables'][_0x34655d[_0x5356('0x17')]],'motionChannel':'voice'};logger[_0x5356('0x1f')](_0x5356('0x3e'),_0x34655d[_0x5356('0x17')],_0x34655d[_0x5356('0x3c')][_0x5356('0x3d')],_['keys'](_0x34655d[_0x5356('0x3c')])[0x0],_0x34655d[_0x5356('0x3b')]);logger['debug'](_0x5356('0x3f'),_0x34655d[_0x5356('0x17')],util['inspect'](this[_0x5356('0x9')][_0x34655d[_0x5356('0x17')]],{'showHidden':![],'depth':null}));this[_0x5356('0x16')](_0x5356('0x27'),_0x5356('0x28'),this[_0x5356('0x9')][_0x34655d[_0x5356('0x17')]]);}}}}catch(_0x34f1e0){logger[_0x5356('0x2b')](_0x5356('0x40'),_0x34655d['uniqueid'],util[_0x5356('0x25')](_0x34f1e0,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x5356('0x41')]=function(_0x1d9c67,_0x2b5496,_0x7cce19){var _0x2070d0=[_0x5356('0x42'),'rtpaudioqosbridged',_0x5356('0x43'),'rtpaudioqosjitterbridged',_0x5356('0x44'),'rtpaudioqoslossbridged',_0x5356('0x45'),_0x5356('0x46'),_0x5356('0x47'),_0x5356('0x48'),_0x5356('0x49'),_0x5356('0x4a'),_0x5356('0x4b'),_0x5356('0x4c'),_0x5356('0x4d'),'memberlastcall',_0x5356('0x21'),_0x5356('0x4e'),_0x5356('0x4f')];if(!_[_0x5356('0x50')](_0x2b5496)&&!_[_0x5356('0x51')](_0x2070d0,_0x2b5496)){if(_['isUndefined'](this[_0x5356('0xb')][_0x1d9c67])){this[_0x5356('0xb')][_0x1d9c67]={};}this[_0x5356('0xb')][_0x1d9c67][_0x2b5496]=_0x7cce19;}};VoiceDialReport[_0x5356('0x13')]['syncHangup']=function(_0x704251){try{if(this[_0x5356('0x14')](_0x704251)){logger[_0x5356('0x23')](_0x5356('0x52'),_0x704251['uniqueid'],util[_0x5356('0x25')](_0x704251,{'showHidden':![],'depth':null}));if(this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]){logger[_0x5356('0x1f')](_0x5356('0x53'),_0x704251[_0x5356('0x17')],_0x704251[_0x5356('0x54')]);this[_0x5356('0x9')][_0x704251['uniqueid']]['endtime']=moment()[_0x5356('0x18')](_0x5356('0x32'));this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]['duration']=moment(this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x55')])[_0x5356('0x56')](this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x57')],'seconds');this['channels'][_0x704251['uniqueid']][_0x5356('0x33')]=_0x5356('0x58');this[_0x5356('0xa')][_0x5356('0x59')]+=0x1;if(this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]['answertime']){this[_0x5356('0xa')][_0x5356('0x5a')]+=0x1;this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x5b')]=moment(this[_0x5356('0x9')][_0x704251['uniqueid']][_0x5356('0x5c')])['diff'](this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x57')],_0x5356('0x5d'));this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x5e')]=moment(this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x55')])[_0x5356('0x56')](this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x5c')],_0x5356('0x5d'));this[_0x5356('0xa')][_0x5356('0x5f')]+=this[_0x5356('0x9')][_0x704251['uniqueid']][_0x5356('0x5b')]||0x0;this[_0x5356('0xa')][_0x5356('0x60')]+=this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x5e')];}this[_0x5356('0xa')][_0x5356('0x61')]+=this[_0x5356('0x9')][_0x704251['uniqueid']]['duration'];logger[_0x5356('0x23')](_0x5356('0x62'),_0x704251[_0x5356('0x17')],util[_0x5356('0x25')](this['channels'][_0x704251[_0x5356('0x17')]],{'showHidden':![],'depth':null}));ami[_0x5356('0x16')](_0x5356('0x63'),this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]);logger[_0x5356('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x704251[_0x5356('0x17')],util['inspect'](this['channels'][_0x704251[_0x5356('0x17')]],{'showHidden':![],'depth':null}));ami[_0x5356('0x16')](_0x5356('0x64'),this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]);logger[_0x5356('0x23')](_0x5356('0x65'),_0x704251[_0x5356('0x17')],util[_0x5356('0x25')](this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0x5356('0x27'),'voice_outbound:save',this['outbound']);logger[_0x5356('0x1f')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this['channels'][_0x704251['uniqueid']]));logger[_0x5356('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x704251[_0x5356('0x17')],util[_0x5356('0x25')](this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0x5356('0x27'),_0x5356('0x66'),this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]);this[_0x5356('0x67')](_0x704251['uniqueid']);}else if(this[_0x5356('0x9')][_0x704251[_0x5356('0x68')]]){this[_0x5356('0x9')][_0x704251[_0x5356('0x68')]]['uniqueid']=this[_0x5356('0x9')][_0x704251[_0x5356('0x68')]]['destuniqueid'];}if(this['variables'][_0x704251[_0x5356('0x17')]]){delete this[_0x5356('0xb')][_0x704251['uniqueid']];}}}catch(_0x1ea659){logger['error'](_0x5356('0x69'),_0x704251['uniqueid'],util[_0x5356('0x25')](_0x1ea659,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5356('0x13')][_0x5356('0x6a')]=function(_0x623697){try{if(this[_0x5356('0x14')](_0x623697)){logger[_0x5356('0x23')](_0x5356('0x6b'),_0x623697[_0x5356('0x17')],util[_0x5356('0x25')](_0x623697,{'showHidden':![],'depth':null}));if(_0x623697['application'][_0x5356('0x6c')]()===_0x5356('0x6d')){_0x623697['applicationdata']=(_0x623697[_0x5356('0x6e')]||_0x623697['applicationdata'])[_0x5356('0x6c')]();if(_[_0x5356('0x6f')](_0x623697[_0x5356('0x70')],_0x5356('0x71'))){if(_[_0x5356('0x15')](this[_0x5356('0x26')][_0x623697[_0x5356('0x17')]]))this[_0x5356('0x26')][_0x623697[_0x5356('0x17')]]={};logger[_0x5356('0x1f')](_0x5356('0x72'),_0x623697[_0x5356('0x17')],_0x623697[_0x5356('0x73')],_0x623697['applicationdata']);var _0x436c23=_0x623697['applicationdata']['split']('=');var _0xefd25b=_0x436c23[0x0][_0x5356('0x74')](/cdr\((.*)\)/);if(_0xefd25b)this[_0x5356('0x26')][_0x623697[_0x5356('0x17')]][_0xefd25b[0x1]]=_0x436c23[0x1];}}}}catch(_0x413dd2){logger[_0x5356('0x2b')](_0x5356('0x75'),_0x623697[_0x5356('0x17')],util[_0x5356('0x25')](_0x413dd2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5356('0x13')][_0x5356('0x67')]=function(_0x4e321c,_0x502776=0x2710){if(this[_0x5356('0x9')][_0x4e321c]){setTimeout(()=>{delete this[_0x5356('0x9')][_0x4e321c];},_0x502776);}};module[_0x5356('0x76')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 47c41ba..e37835b 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 _0x7789=['queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','lastAssignedTo','membername','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','add','FORWARDTRANSFER','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','keys','value','variable','CONTINUE','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberrealtime','includes','length','seconds','COMPLETEDBYAGENT','milliseconds','diff','total','answered','sumBillable','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:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','syncHangup','[%s][voiceQueueReport][hangup]','handleHangup','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','origtransfererexten','origtransfereruniqueid','transfertargetuniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','BlindTransfer','context','transfererchannel','syncMusicOnHoldStart','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceQueueReport][newexten]','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','queuesummary','bind','queuesummarycomplete','syncQueueMember','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','isEmpty','hasOwnProperty','originated','talking','waiting','unlockRR','queuecallerexit','queuecallerabandon','queuecallercomplete','prototype','clearZombieChannels','switch','enqueue','isNil','Action','channel','catch','message','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','isNotNull','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','summary','then','actionid','isRunning','queuestatus','[voiceQueueReport][queuesummary]','createReport','createQueueSummaryReport','statusRequests','syncQueueSummaryComplete','push','syncQueueSummary','[voiceQueueReport][queuesummary]\x20event:','completeEvent','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','assign','pick','last','queuecallercompleteAt','holdtime','originalposition','ABANDONED','info','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x7789,0x164));var _0x9778=function(_0x18614d,_0x5b87c1){_0x18614d=_0x18614d-0x0;var _0x394a51=_0x7789[_0x18614d];return _0x394a51;};'use strict';var _=require(_0x9778('0x0'));var moment=require(_0x9778('0x1'));var util=require(_0x9778('0x2'));var Redis=require(_0x9778('0x3'));var config=require('../../../config/environment');var logger=require(_0x9778('0x4'))(_0x9778('0x5'));var ami=require(_0x9778('0x6'));var QueueReport=require(_0x9778('0x7'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config[_0x9778('0x8')]=_[_0x9778('0x9')](config[_0x9778('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9778('0x8')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x381be4){this['tail']=this['tail']?this[_0x9778('0xa')][_0x9778('0xb')](_0x381be4):_0x381be4();};function VoiceQueueReport(_0x25bc25){this[_0x9778('0xc')]=new Sequence();this[_0x9778('0xd')]={};this[_0x9778('0xe')]=_0x25bc25;this['agents']=_0x25bc25[_0x9778('0xf')];this[_0x9778('0x10')]=_0x25bc25[_0x9778('0x11')];this[_0x9778('0x12')]=_0x25bc25['voiceQueues'];this[_0x9778('0x13')]=_0x25bc25[_0x9778('0x13')];this['summary']=initializeSummary();this['variables']={};ami['on'](_0x9778('0x14'),this['syncQueueSummary'][_0x9778('0x15')](this));ami['on'](_0x9778('0x16'),this['syncQueueSummaryComplete']['bind'](this));ami['on']('queuemember',this[_0x9778('0x17')][_0x9778('0x15')](this));ami['on']('queuestatuscomplete',this[_0x9778('0x18')][_0x9778('0x15')](this));ami['on'](_0x9778('0x19'),this[_0x9778('0x1a')][_0x9778('0x15')](this));ami['on']('queuecallerabandon',this[_0x9778('0x1b')][_0x9778('0x15')](this));ami['on'](_0x9778('0x1c'),this[_0x9778('0x1d')]['bind'](this));ami['on'](_0x9778('0x1e'),this[_0x9778('0x1f')][_0x9778('0x15')](this));ami['on'](_0x9778('0x20'),this[_0x9778('0x21')]['bind'](this));ami['on']('varset',this[_0x9778('0x22')][_0x9778('0x15')](this));ami['on'](_0x9778('0x23'),this['syncHangup'][_0x9778('0x15')](this));ami['on'](_0x9778('0x24'),this[_0x9778('0x25')][_0x9778('0x15')](this));ami['on'](_0x9778('0x26'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x9778('0x27'),this['syncMusicOnHoldStop'][_0x9778('0x15')](this));ami['on']('attendedtransfer',this[_0x9778('0x28')]['bind'](this));ami['on'](_0x9778('0x29'),this[_0x9778('0x2a')]['bind'](this));this['loopQueueSummary']();this['loopQueueShow']();}function clearChannels(_0x27219d){if(!_[_0x9778('0x2b')](_0x27219d)){for(var _0x536bd3 in _0x27219d){if(_0x27219d[_0x9778('0x2c')](_0x536bd3)){delete _0x27219d[_0x536bd3];}}}}function clearCampaigns(_0x40a2fd){if(!_[_0x9778('0x2b')](_0x40a2fd)){for(var _0xa4827a in _0x40a2fd){if(_0x40a2fd[_0x9778('0x2c')](_0xa4827a)){_0x40a2fd[_0xa4827a][_0x9778('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x261828){if(!_[_0x9778('0x2b')](_0x261828)){for(var _0x2da0d9 in _0x261828){if(_0x261828[_0x9778('0x2c')](_0x2da0d9)){_0x261828[_0x2da0d9][_0x9778('0x2d')]=0x0;_0x261828[_0x2da0d9][_0x9778('0x2e')]=0x0;_0x261828[_0x2da0d9]['pTalking']=0x0;_0x261828[_0x2da0d9][_0x9778('0x2f')]=0x0;_0x261828[_0x2da0d9]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x2b695f){if(!_['isEmpty'](_0x2b695f)){for(var _0x275944 in _0x2b695f){if(_0x2b695f[_0x9778('0x2c')](_0x275944)){_0x2b695f[_0x275944][_0x9778('0x30')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x24e97c){return _0x24e97c[_0x9778('0x31')]||_0x24e97c[_0x9778('0x32')]||_0x24e97c[_0x9778('0x33')];}VoiceQueueReport[_0x9778('0x34')][_0x9778('0x35')]=function(){var _0x9dc29a=this;for(var _0x7bf96d in this['channels']){if(this[_0x9778('0x10')][_0x9778('0x2c')](_0x7bf96d)&&!this[_0x9778('0x10')][_0x7bf96d][_0x9778('0x36')]){this[_0x9778('0xc')][_0x9778('0x37')](function(){if(!_[_0x9778('0x38')](_0x9dc29a[_0x9778('0x10')][_0x7bf96d])){return ami[_0x9778('0x39')]({'action':'status','channel':_0x9dc29a['channels'][_0x7bf96d][_0x9778('0x3a')]})[_0x9778('0x3b')](function(_0xdf7994){if(_0xdf7994[_0x9778('0x3c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x9dc29a[_0x9778('0x10')][_0x7bf96d]){delete _0x9dc29a[_0x9778('0x10')][_0x7bf96d];logger[_0x9778('0x3d')](_0x9778('0x3e'),_0x7bf96d,util[_0x9778('0x3f')](_0xdf7994,{'showHidden':![],'depth':null}));}if(_0x9dc29a[_0x9778('0xd')][_0x7bf96d]){delete _0x9dc29a['queueReports'][_0x7bf96d];logger[_0x9778('0x3d')](_0x9778('0x40'),_0x7bf96d,util[_0x9778('0x3f')](_0xdf7994,{'showHidden':![],'depth':null}));}if(_0x9dc29a[_0x9778('0x41')][_0x7bf96d]){delete _0x9dc29a['variables'][_0x7bf96d];logger['error']('[%s][voiceQueueReport][checkVariables]',_0x7bf96d,util[_0x9778('0x3f')](_0xdf7994,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0x9778('0x3d')](_0x9778('0x42'));clearChannels(this['channels']);this[_0x9778('0x43')](this[_0x9778('0xd')]);clearAgentBooked(this[_0x9778('0xf')]);clearVoiceQueues(this[_0x9778('0x12')]);clearCampaigns(this[_0x9778('0x13')]);this['summary']=initializeSummary();};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x43')]=function(_0xa6714c){var _0x55be23=this;if(!_[_0x9778('0x2b')](_0xa6714c)){for(var _0x5dea89 in _0xa6714c){if(_0xa6714c[_0x9778('0x2c')](_0x5dea89)){_0x55be23[_0x9778('0x44')](_0xa6714c[_0x5dea89],'clearqueuereport');delete _0xa6714c[_0x5dea89];}}}};VoiceQueueReport[_0x9778('0x34')]['emit']=function(_0x273969,_0x5b55be,_0x23a616){io['to'](_0x273969)[_0x9778('0x45')](_0x5b55be,_0x23a616);};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x46')]=function(_0xd95146,_0x9fb73a){logger['debug'](_0x9778('0x47')+_0x9fb73a+']\x20sending\x20voice_queue_channel:save\x20event:',_0xd95146[_0x9778('0x48')],util[_0x9778('0x3f')](_0xd95146,{'showHidden':![],'depth':null}));this['emit'](util[_0x9778('0x49')](_0x9778('0x4a'),_0xd95146[_0x9778('0x4b')]),_0x9778('0x4c'),_0xd95146);io[_0x9778('0x45')]('voice_queue_presence:save',_0xd95146);};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x44')]=function(_0x221900,_0x208015){logger['debug'](_0x9778('0x47')+_0x208015+_0x9778('0x4d'),_0x221900['uniqueid'],util[_0x9778('0x3f')](_0x221900,{'showHidden':![],'depth':null}));if(_0x221900[_0x9778('0x4e')]===_0x9778('0x4f')){return;}this[_0x9778('0x45')](util[_0x9778('0x49')](_0x9778('0x4a'),_0x221900[_0x9778('0x4b')]),_0x9778('0x50'),_0x221900);io[_0x9778('0x45')](_0x9778('0x51'),_0x221900);};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x52')]=function(_0x2dc68d){if(_0x2dc68d[_0x9778('0x53')]==='inbound'){logger[_0x9778('0x54')](_0x9778('0x55'),util[_0x9778('0x3f')](_0x2dc68d,{'showHidden':![],'depth':null}));this[_0x9778('0x45')](util[_0x9778('0x49')](_0x9778('0x4a'),_0x2dc68d[_0x9778('0x56')]),'voice_queue:save',_0x2dc68d);}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x57')]=function(_0x25edb4){return _0x25edb4!==null&&!_[_0x9778('0x58')](_0x25edb4);};VoiceQueueReport['prototype'][_0x9778('0x59')]=function(){var _0x3924d6=this;setInterval(function(){_0x3924d6[_0x9778('0x35')]();ami[_0x9778('0x39')]({'action':_0x9778('0x5a')})['catch'](function(_0x1c100e){logger[_0x9778('0x3d')](_0x9778('0x5b'),util['inspect'](_0x1c100e,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x9778('0x34')]['loopQueueSummary']=function(){var _0x5f1dc5=this;setInterval(function(){if(!_0x5f1dc5[_0x9778('0x5c')]['isRunning']){return ami[_0x9778('0x39')]({'action':_0x9778('0x14')})[_0x9778('0x5d')](function(_0x254ce3){_0x5f1dc5['summary']['id']=_0x254ce3[_0x9778('0x5e')];_0x5f1dc5[_0x9778('0x5c')][_0x9778('0x5f')]=!![];_0x5f1dc5['summary'][_0x9778('0x60')][_0x254ce3[_0x9778('0x5e')]]={};})[_0x9778('0x3b')](function(_0x51f353){logger['error'](_0x9778('0x61'),util[_0x9778('0x3f')](_0x51f353,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x9778('0x34')]['createQueueSummaryReport']=function(_0x738d44,_0x44d60d){var _0x1f7eaf;if(this['summary']&&this[_0x9778('0x5c')]['queues']&&this['summary'][_0x9778('0x5a')][_0x738d44[_0x9778('0x56')]]){_0x1f7eaf=this[_0x9778('0x5c')][_0x9778('0x5a')][_0x738d44[_0x9778('0x56')]]['summaryEvent'];}var _0x4c55dc=new VoiceQueueSummary(_0x738d44);return _0x4c55dc[_0x9778('0x62')](_0x44d60d['agents'],this[_0x9778('0xf')],_0x1f7eaf,this['realtime'][_0x9778('0x10')]);};VoiceQueueReport[_0x9778('0x34')]['handleInboundQueueSummaryReport']=function(_0xac36a1,_0x3438b7){var _0x950844=this[_0x9778('0x63')](_0xac36a1,_0x3438b7);var _0x2d9a3f=![];_0x2d9a3f=_0x950844['compareToInboundQueue'](_0xac36a1);if(_0x2d9a3f){Object['assign'](_0xac36a1,_0x950844);this['realtime'][_0x9778('0x12')][_0xac36a1[_0x9778('0x56')]]=_0xac36a1;this[_0x9778('0x52')](_0x950844);}};VoiceQueueReport['prototype'][_0x9778('0x18')]=function(_0x8bfeff){var _0x7aed81=null;var _0x2c3494=this[_0x9778('0x5c')]['id'];if(this[_0x9778('0x5c')]['queuestatus'][_0x2c3494]){_0x7aed81=this['summary'][_0x9778('0x60')][_0x2c3494][_0x8bfeff[_0x9778('0x5e')]];}if(!_0x7aed81){this[_0x9778('0x5c')]=initializeSummary();return;}var _0x46ac98=this[_0x9778('0x12')][_0x7aed81[_0x9778('0x4b')]];if(_0x46ac98['type']==='inbound'){this['handleInboundQueueSummaryReport'](_0x46ac98,_0x7aed81);}else if(_0x46ac98[_0x9778('0x53')]==='outbound'){var _0xfa49d5=this[_0x9778('0x63')](_0x46ac98,_0x7aed81);ami['emit']('custom:queuesummary',_0xfa49d5);}this[_0x9778('0x5c')][_0x9778('0x64')]-=0x1;var _0x8ce2e9=this[_0x9778('0x5c')]['statusRequests']>0x0?!![]:![];if(!_0x8ce2e9){return this[_0x9778('0x65')](this[_0x9778('0x5c')]['completeEvent']);}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x17')]=function(_0xa84b3e){var _0x30de2e=this[_0x9778('0x5c')]['id'];if(this[_0x9778('0x5c')]['queuestatus'][_0x30de2e]&&this['summary'][_0x9778('0x60')][_0x30de2e][_0xa84b3e[_0x9778('0x5e')]]){this[_0x9778('0x5c')][_0x9778('0x60')][_0x30de2e][_0xa84b3e[_0x9778('0x5e')]][_0x9778('0xf')][_0x9778('0x66')](_0xa84b3e);}};VoiceQueueReport['prototype'][_0x9778('0x67')]=function(_0x5b0030){var _0x4f038b=this;try{if(this[_0x9778('0x57')](_0x5b0030)&&this['isNotNull'](_0x5b0030[_0x9778('0x4b')])){logger[_0x9778('0x54')](_0x9778('0x68'),util['inspect'](_0x5b0030,{'showHidden':![],'depth':null}));var _0x43420e=this[_0x9778('0x12')][_0x5b0030['queue']];if(_0x43420e){logger[_0x9778('0x54')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x43420e['name']);this[_0x9778('0x5c')]['queues'][_0x43420e[_0x9778('0x56')]]={'summaryEvent':_0x5b0030};this['summary'][_0x9778('0x64')]+=0x1;return ami[_0x9778('0x39')]({'action':_0x9778('0x60'),'queue':_0x43420e['name']})[_0x9778('0x5d')](function(_0x395c61){if(!_0x4f038b[_0x9778('0x5c')]['queuestatus'][_0x5b0030[_0x9778('0x5e')]]){_0x4f038b[_0x9778('0x5c')][_0x9778('0x60')][_0x5b0030[_0x9778('0x5e')]]={};}_0x4f038b[_0x9778('0x5c')][_0x9778('0x60')][_0x5b0030[_0x9778('0x5e')]][_0x395c61['actionid']]={'queue':_0x43420e[_0x9778('0x56')],'agents':[]};})[_0x9778('0x3b')](function(_0x415407){throw _0x415407;});}}}catch(_0x3dfc92){logger[_0x9778('0x3d')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x3dfc92,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')]['syncQueueSummaryComplete']=function(_0x4e3b54){if(this['summary']['statusRequests']>0x0){this[_0x9778('0x5c')][_0x9778('0x69')]=_0x4e3b54;return;}logger['debug'](_0x9778('0x6a'),util[_0x9778('0x3f')](_0x4e3b54,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x9778('0x45')](_0x9778('0x6b'),{});};VoiceQueueReport[_0x9778('0x34')]['syncQueueCallerJoin']=function(_0x13a630){try{if(this[_0x9778('0x57')](_0x13a630)){logger[_0x9778('0x54')](_0x9778('0x6c'),_0x13a630[_0x9778('0x48')],util[_0x9778('0x3f')](_0x13a630,{'showHidden':![],'depth':null}));if(_[_0x9778('0x58')](this[_0x9778('0xd')][_0x13a630[_0x9778('0x48')]])){this[_0x9778('0xd')][_0x13a630['uniqueid']]=[];}if(_[_0x9778('0x58')](this['channels'][_0x13a630['uniqueid']])){this['channels'][_0x13a630[_0x9778('0x48')]]={};}var _0x55554e=new QueueReport();_0x55554e[_0x9778('0x4b')]=_0x13a630[_0x9778('0x4b')];_0x55554e[_0x9778('0x53')]=this[_0x9778('0x12')][_0x55554e[_0x9778('0x4b')]]&&this['voiceQueues'][_0x55554e['queue']][_0x9778('0x53')]?this[_0x9778('0x12')][_0x55554e['queue']][_0x9778('0x53')]||'inbound':_0x9778('0x6d');_0x55554e[_0x9778('0x6e')]=moment()['format'](_0x9778('0x6f'));_0x55554e[_0x9778('0x70')]=_0x13a630['position'];_0x55554e[_0x9778('0x71')]=_0x13a630[_0x9778('0x71')];_0x55554e[_0x9778('0x48')]=_0x13a630[_0x9778('0x48')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x55554e['queue'],_0x55554e[_0x9778('0x53')]);Object[_0x9778('0x72')](_0x55554e,_[_0x9778('0x73')](_0x13a630,_['keys'](_0x55554e)));this['queueReports'][_0x13a630[_0x9778('0x48')]][_0x9778('0x66')](_0x55554e);this[_0x9778('0x10')][_0x13a630[_0x9778('0x48')]]=_0x55554e;this[_0x9778('0x46')](_0x55554e,_0x9778('0x19'));}}catch(_0x2ee939){logger[_0x9778('0x3d')](_0x9778('0x6c'),_0x13a630[_0x9778('0x48')],util[_0x9778('0x3f')](_0x2ee939,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x1b')]=function(_0x393bd5){try{if(this['isNotNull'](_0x393bd5)){logger[_0x9778('0x54')]('[%s][voiceQueueReport][queuecallerabandon]',_0x393bd5[_0x9778('0x48')],util['inspect'](_0x393bd5,{'showHidden':![],'depth':null}));if(this[_0x9778('0xd')][_0x393bd5[_0x9778('0x48')]]){var _0x1997d0=_[_0x9778('0x74')](this[_0x9778('0xd')][_0x393bd5[_0x9778('0x48')]]);_0x1997d0[_0x9778('0x33')]=![];_0x1997d0[_0x9778('0x75')]=null;_0x1997d0[_0x9778('0x76')]=_0x393bd5[_0x9778('0x76')];_0x1997d0[_0x9778('0x77')]=_0x393bd5[_0x9778('0x77')];_0x1997d0[_0x9778('0x32')]=!![];_0x1997d0['queuecallerabandonAt']=moment()[_0x9778('0x49')](_0x9778('0x6f'));_0x1997d0['queuecallerexitreason']=_0x9778('0x78');_0x1997d0['lastAssignedTo']=null;logger[_0x9778('0x79')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1997d0['queue'],_0x1997d0['type']);this['channels'][_0x393bd5['uniqueid']]=_0x1997d0;this[_0x9778('0x44')](_0x1997d0,'queuecallerabandon');}}}catch(_0x4fd356){logger[_0x9778('0x3d')](_0x9778('0x7a'),_0x393bd5['uniqueid'],util[_0x9778('0x3f')](_0x4fd356,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')]['syncQueueCallerLeave']=function(_0x2ceced){try{if(this[_0x9778('0x57')](_0x2ceced)){logger[_0x9778('0x54')](_0x9778('0x7b'),_0x2ceced['uniqueid'],util['inspect'](_0x2ceced,{'showHidden':![],'depth':null}));if(this[_0x9778('0xd')][_0x2ceced[_0x9778('0x48')]]){var _0x1e87c6=_[_0x9778('0x74')](this['queueReports'][_0x2ceced['uniqueid']]);_0x1e87c6[_0x9778('0x7c')]=moment()[_0x9778('0x49')](_0x9778('0x6f'));_0x1e87c6[_0x9778('0x7d')]=_0x2ceced['connectedlinenum'];_0x1e87c6[_0x9778('0x7e')]=_0x2ceced['connectedlinename'];logger[_0x9778('0x79')](_0x9778('0x7f'),_0x1e87c6[_0x9778('0x4b')],_0x1e87c6[_0x9778('0x53')],_0x2ceced[_0x9778('0x7d')],_0x2ceced[_0x9778('0x7e')]);this[_0x9778('0x10')][_0x2ceced['uniqueid']]=_0x1e87c6;this[_0x9778('0x46')](_0x1e87c6,_0x9778('0x1c'));}}}catch(_0x341aae){logger[_0x9778('0x3d')](_0x9778('0x7b'),_0x2ceced['uniqueid'],util[_0x9778('0x3f')](_0x341aae,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x21')]=function(_0x2aa7b6){try{if(this[_0x9778('0x57')](_0x2aa7b6)){logger[_0x9778('0x54')]('[%s][voiceQueueReport][agentconnect]',_0x2aa7b6[_0x9778('0x48')],util[_0x9778('0x3f')](_0x2aa7b6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2aa7b6[_0x9778('0x48')]]){var _0x1da151=_['last'](this['queueReports'][_0x2aa7b6[_0x9778('0x48')]]);_0x1da151[_0x9778('0x33')]=!![];_0x1da151[_0x9778('0x4e')]='COMPLETEDBYAGENT';logger[_0x9778('0x79')](_0x9778('0x80'),_0x1da151[_0x9778('0x4b')],_0x1da151['type']);}}}catch(_0x2939b0){logger[_0x9778('0x3d')](_0x9778('0x81'),_0x2aa7b6['uniqueid'],util[_0x9778('0x3f')](_0x2939b0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x1f')]=function(_0x3b17df){try{if(this[_0x9778('0x57')](_0x3b17df)){logger['debug'](_0x9778('0x82'),_0x3b17df[_0x9778('0x48')],util[_0x9778('0x3f')](_0x3b17df,{'showHidden':![],'depth':null}));if(this[_0x9778('0xd')][_0x3b17df[_0x9778('0x48')]]){var _0x23c8fe=_['last'](this[_0x9778('0xd')][_0x3b17df[_0x9778('0x48')]]);_0x23c8fe[_0x9778('0x32')]=![];_0x23c8fe[_0x9778('0x83')]=null;_0x23c8fe[_0x9778('0x84')]=!![];_0x23c8fe[_0x9778('0x85')]=_0x3b17df[_0x9778('0x86')];_0x23c8fe['holdtime']=_0x3b17df[_0x9778('0x76')];_0x23c8fe['queuecallercomplete']=!![];_0x23c8fe[_0x9778('0x31')]=![];_0x23c8fe[_0x9778('0x87')]=null;if(!_0x23c8fe[_0x9778('0x88')]){if(_0x3b17df[_0x9778('0x89')]=='transfer'){_0x23c8fe[_0x9778('0x4e')]=_0x9778('0x8a');logger[_0x9778('0x79')](_0x9778('0x8b'),_0x23c8fe[_0x9778('0x4b')],_0x23c8fe['type']);}else{if(_['startsWith'](_0x3b17df['channel'][_0x9778('0x8c')](),_0x9778('0x8d'))){if(this[_0x9778('0xd')][_0x3b17df[_0x9778('0x8e')]]){var _0x26195f=_['last'](this[_0x9778('0xd')][_0x3b17df[_0x9778('0x8e')]]);_0x26195f[_0x9778('0x33')]=![];_0x26195f[_0x9778('0x31')]=!![];_0x26195f[_0x9778('0x87')]=moment(_0x23c8fe[_0x9778('0x6e')])[_0x9778('0x8f')](_0x3b17df[_0x9778('0x76')],'seconds')[_0x9778('0x49')](_0x9778('0x6f'));_0x26195f[_0x9778('0x4e')]=_0x9778('0x90');_0x26195f[_0x9778('0x88')]=!![];_0x26195f['transfertype']='FORWARD';_0x26195f[_0x9778('0x91')]=_0x3b17df[_0x9778('0x92')];_0x26195f[_0x9778('0x93')]=_0x3b17df[_0x9778('0x48')];logger[_0x9778('0x79')](_0x9778('0x94'),_0x26195f['queue'],_0x26195f[_0x9778('0x53')]);var _0x5985d0=this['queueReports'][_0x3b17df['linkedid']];this[_0x9778('0xd')][_0x3b17df[_0x9778('0x8e')]]=this[_0x9778('0xd')][_0x3b17df['uniqueid']];this[_0x9778('0xd')][_0x3b17df[_0x9778('0x48')]]=_0x5985d0;}}else{_0x23c8fe[_0x9778('0x4e')]=_0x9778('0x95')+_0x3b17df['reason'][_0x9778('0x96')]();logger[_0x9778('0x79')](_0x9778('0x97'),_0x23c8fe[_0x9778('0x4b')],_0x23c8fe[_0x9778('0x53')],_0x23c8fe[_0x9778('0x4e')]);}}}this[_0x9778('0x10')][_0x3b17df['uniqueid']]=_0x23c8fe;}}}catch(_0x1ecf5f){logger[_0x9778('0x3d')](_0x9778('0x82'),_0x3b17df[_0x9778('0x48')],util['inspect'](_0x1ecf5f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x22')]=function(_0x19750d){try{if(this[_0x9778('0x57')](_0x19750d)){logger[_0x9778('0x54')](_0x9778('0x98'),_0x19750d[_0x9778('0x48')],util[_0x9778('0x3f')](_0x19750d,{'showHidden':![],'depth':null}));this['addVariable'](_0x19750d[_0x9778('0x48')],_[_0x9778('0x99')](_0x19750d['variable'])[0x0],_0x19750d[_0x9778('0x9a')]);if(this['queueReports'][_0x19750d[_0x9778('0x48')]]){var _0x575a89=_[_0x9778('0x74')](this[_0x9778('0xd')][_0x19750d[_0x9778('0x48')]]);if(_0x575a89){if(this['isNotNull'](_0x19750d['variable'])&&this[_0x9778('0x57')](_0x19750d[_0x9778('0x9b')]['queuestatus'])){switch(_0x19750d[_0x9778('0x9a')]){case _0x9778('0x9c'):_0x575a89[_0x9778('0x31')]=![];_0x575a89['queuecallerexitAt']=null;break;case'TIMEOUT':_0x575a89[_0x9778('0x9d')]=_0x9778('0x9e');_0x575a89[_0x9778('0x31')]=!![];_0x575a89[_0x9778('0x87')]=moment()[_0x9778('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x575a89[_0x9778('0x7c')]=moment()[_0x9778('0x49')](_0x9778('0x6f'));logger['debug'](_0x9778('0x9f'),_0x19750d[_0x9778('0x48')],util[_0x9778('0x3f')](_0x575a89,{'showHidden':![],'depth':null}));ami[_0x9778('0x45')](_0x9778('0xa0'),_0x575a89);break;default:_0x575a89[_0x9778('0x31')]=!![];_0x575a89[_0x9778('0x87')]=moment()[_0x9778('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x575a89['queuecallerleaveAt']=moment()[_0x9778('0x49')](_0x9778('0x6f'));}_0x575a89[_0x9778('0x32')]=![];_0x575a89['queuecallerabandonAt']=null;_0x575a89[_0x9778('0x4e')]=_0x19750d[_0x9778('0x9a')];this['channels'][_0x19750d[_0x9778('0x48')]]=_0x575a89;this['emitVoiceQueueChannelRemove'](_0x575a89,_0x9778('0xa1'));}else if(this[_0x9778('0x57')](_0x19750d[_0x9778('0x9b')])&&this[_0x9778('0x57')](_0x19750d[_0x9778('0x9b')][_0x9778('0xa2')])){if(!_0x575a89['queuecallerabandon']){_0x575a89[_0x9778('0x31')]=!![];_0x575a89[_0x9778('0x87')]=moment()[_0x9778('0x49')](_0x9778('0x6f'));_0x575a89['queuecallerexitreason']=_0x9778('0xa3');_0x575a89[_0x9778('0x7c')]=moment()[_0x9778('0x49')](_0x9778('0x6f'));this['channels'][_0x19750d['uniqueid']]=_0x575a89;}}logger[_0x9778('0x79')](_0x9778('0xa4'),_0x19750d[_0x9778('0x48')],_0x575a89['queue'],_0x575a89['type'],_[_0x9778('0x99')](_0x19750d['variable'])[0x0],_0x19750d[_0x9778('0x9a')]);_0x575a89[_0x9778('0x41')]=this[_0x9778('0x41')][_0x19750d[_0x9778('0x48')]];}}}}catch(_0x28d814){logger[_0x9778('0x3d')](_0x9778('0x98'),_0x19750d[_0x9778('0x48')],util[_0x9778('0x3f')](_0x28d814,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9778('0xa5')]=function(_0x348e0d,_0x4faa34,_0x184e99){var _0x5831ae=[_0x9778('0xa6'),_0x9778('0xa7'),_0x9778('0xa8'),_0x9778('0xa9'),'rtpaudioqosloss',_0x9778('0xaa'),_0x9778('0xab'),_0x9778('0xac'),'sipcallid',_0x9778('0xad'),_0x9778('0xae'),_0x9778('0xaf'),_0x9778('0xb0'),'memberdynamic','memberinterface',_0x9778('0xb1'),_0x9778('0x86'),'memberpenalty',_0x9778('0xb2')];if(!_[_0x9778('0x38')](_0x4faa34)&&!_[_0x9778('0xb3')](_0x5831ae,_0x4faa34)){if(_['isUndefined'](this['variables'][_0x348e0d])){this[_0x9778('0x41')][_0x348e0d]={};}this[_0x9778('0x41')][_0x348e0d][_0x4faa34]=_0x184e99;}};VoiceQueueReport[_0x9778('0x34')]['handleHangup']=function(_0x4c8df8,_0x1bc60c,_0x230d2f){try{var _0x3b31bd={};if(this[_0x9778('0xd')][_0x4c8df8]){for(var _0x1a650c=0x0;_0x1a650c{delete this[_0x9778('0x10')][_0x59c52a];},_0x590daa);}};module['exports']=VoiceQueueReport; \ No newline at end of file +var _0xcb5e=['syncAttendedTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queuecallerexit','queuecallercomplete','clearZombieChannels','switch','enqueue','Action','status','channel','catch','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','[FullyBooted]\x20clear\x20realtime','clearQueueReport','summary','emitVoiceQueueChannelRemove','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','emit','voice_queue_presence:save','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','ATTENDEDTRANSFER','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','queues','name','summaryEvent','createReport','handleInboundQueueSummaryReport','syncQueueStatusComplete','outbound','custom:queuesummary','statusRequests','completeEvent','push','syncQueueSummary','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','assign','pick','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerabandon','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','info','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','local/','seconds','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','linkedid','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','keys','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','membername','memberrealtime','isNil','includes','length','diff','total','answered','sumBillable','milliseconds','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','custom:queuecallerabandon','sumDuration','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','deleteChannelAfterTimeout','syncHangup','[%s][voiceQueueReport][hangup]','cause','handleHangup','transferid','cause-txt','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','secondtransfererexten','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','BlindTransfer','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xcb5e,0x1a6));var _0xecb5=function(_0x5eb833,_0x2d4515){_0x5eb833=_0x5eb833-0x0;var _0x1678d4=_0xcb5e[_0x5eb833];return _0x1678d4;};'use strict';var _=require(_0xecb5('0x0'));var moment=require(_0xecb5('0x1'));var util=require('util');var Redis=require(_0xecb5('0x2'));var config=require(_0xecb5('0x3'));var logger=require(_0xecb5('0x4'))(_0xecb5('0x5'));var ami=require(_0xecb5('0x6'));var QueueReport=require(_0xecb5('0x7'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config[_0xecb5('0x8')]=_['defaults'](config[_0xecb5('0x8')],{'host':_0xecb5('0x9'),'port':0x18eb});var io=require(_0xecb5('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xecb5('0xb')]['enqueue']=function(_0x36a9d0){this['tail']=this[_0xecb5('0xc')]?this[_0xecb5('0xc')][_0xecb5('0xd')](_0x36a9d0):_0x36a9d0();};function VoiceQueueReport(_0x18f374){this[_0xecb5('0xe')]=new Sequence();this[_0xecb5('0xf')]={};this[_0xecb5('0x10')]=_0x18f374;this[_0xecb5('0x11')]=_0x18f374[_0xecb5('0x11')];this[_0xecb5('0x12')]=_0x18f374[_0xecb5('0x13')];this[_0xecb5('0x14')]=_0x18f374[_0xecb5('0x14')];this[_0xecb5('0x15')]=_0x18f374[_0xecb5('0x15')];this['summary']=initializeSummary();this[_0xecb5('0x16')]={};ami['on'](_0xecb5('0x17'),this['syncQueueSummary'][_0xecb5('0x18')](this));ami['on']('queuesummarycomplete',this[_0xecb5('0x19')]['bind'](this));ami['on'](_0xecb5('0x1a'),this[_0xecb5('0x1b')][_0xecb5('0x18')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x1c'),this[_0xecb5('0x1d')]['bind'](this));ami['on']('queuecallerabandon',this[_0xecb5('0x1e')][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x1f'),this[_0xecb5('0x20')][_0xecb5('0x18')](this));ami['on']('agentcomplete',this[_0xecb5('0x21')]['bind'](this));ami['on'](_0xecb5('0x22'),this[_0xecb5('0x23')][_0xecb5('0x18')](this));ami['on']('varset',this[_0xecb5('0x24')][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x25'),this['syncHangup'][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x26'),this[_0xecb5('0x27')][_0xecb5('0x18')](this));ami['on']('musiconholdstart',this[_0xecb5('0x28')][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x29'),this[_0xecb5('0x2a')][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x2b'),this[_0xecb5('0x2c')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xecb5('0x18')](this));this['loopQueueSummary']();this[_0xecb5('0x2d')]();}function clearChannels(_0x3f140b){if(!_[_0xecb5('0x2e')](_0x3f140b)){for(var _0x4864a0 in _0x3f140b){if(_0x3f140b['hasOwnProperty'](_0x4864a0)){delete _0x3f140b[_0x4864a0];}}}}function clearCampaigns(_0xe557a1){if(!_[_0xecb5('0x2e')](_0xe557a1)){for(var _0x300945 in _0xe557a1){if(_0xe557a1[_0xecb5('0x2f')](_0x300945)){_0xe557a1[_0x300945][_0xecb5('0x30')]=0x0;}}}}function clearVoiceQueues(_0x1b86ce){if(!_['isEmpty'](_0x1b86ce)){for(var _0x287be8 in _0x1b86ce){if(_0x1b86ce[_0xecb5('0x2f')](_0x287be8)){_0x1b86ce[_0x287be8][_0xecb5('0x30')]=0x0;_0x1b86ce[_0x287be8][_0xecb5('0x31')]=0x0;_0x1b86ce[_0x287be8][_0xecb5('0x32')]=0x0;_0x1b86ce[_0x287be8][_0xecb5('0x33')]=0x0;_0x1b86ce[_0x287be8]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x4608c7){if(!_['isEmpty'](_0x4608c7)){for(var _0x3b8d58 in _0x4608c7){if(_0x4608c7[_0xecb5('0x2f')](_0x3b8d58)){_0x4608c7[_0x3b8d58]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x178115){return _0x178115[_0xecb5('0x34')]||_0x178115['queuecallerabandon']||_0x178115[_0xecb5('0x35')];}VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x36')]=function(){var _0x57b487=this;for(var _0x366625 in this[_0xecb5('0x12')]){if(this[_0xecb5('0x12')]['hasOwnProperty'](_0x366625)&&!this['channels'][_0x366625][_0xecb5('0x37')]){this['sequence'][_0xecb5('0x38')](function(){if(!_['isNil'](_0x57b487[_0xecb5('0x12')][_0x366625])){return ami[_0xecb5('0x39')]({'action':_0xecb5('0x3a'),'channel':_0x57b487[_0xecb5('0x12')][_0x366625][_0xecb5('0x3b')]})[_0xecb5('0x3c')](function(_0xca0c0){if(_0xca0c0['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x57b487[_0xecb5('0x12')][_0x366625]){delete _0x57b487[_0xecb5('0x12')][_0x366625];logger[_0xecb5('0x3d')](_0xecb5('0x3e'),_0x366625,util['inspect'](_0xca0c0,{'showHidden':![],'depth':null}));}if(_0x57b487[_0xecb5('0xf')][_0x366625]){delete _0x57b487[_0xecb5('0xf')][_0x366625];logger[_0xecb5('0x3d')](_0xecb5('0x3f'),_0x366625,util[_0xecb5('0x40')](_0xca0c0,{'showHidden':![],'depth':null}));}if(_0x57b487['variables'][_0x366625]){delete _0x57b487[_0xecb5('0x16')][_0x366625];logger[_0xecb5('0x3d')]('[%s][voiceQueueReport][checkVariables]',_0x366625,util[_0xecb5('0x40')](_0xca0c0,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xecb5('0xb')]['syncFullyBooted']=function(){logger['error'](_0xecb5('0x41'));clearChannels(this['channels']);this[_0xecb5('0x42')](this['queueReports']);clearAgentBooked(this[_0xecb5('0x11')]);clearVoiceQueues(this[_0xecb5('0x14')]);clearCampaigns(this[_0xecb5('0x15')]);this[_0xecb5('0x43')]=initializeSummary();};VoiceQueueReport['prototype'][_0xecb5('0x42')]=function(_0x10f347){var _0x2c3859=this;if(!_[_0xecb5('0x2e')](_0x10f347)){for(var _0x1f9d11 in _0x10f347){if(_0x10f347[_0xecb5('0x2f')](_0x1f9d11)){_0x2c3859[_0xecb5('0x44')](_0x10f347[_0x1f9d11],'clearqueuereport');delete _0x10f347[_0x1f9d11];}}}};VoiceQueueReport[_0xecb5('0xb')]['emit']=function(_0x112dc9,_0x198fe0,_0x3f0399){io['to'](_0x112dc9)['emit'](_0x198fe0,_0x3f0399);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x45')]=function(_0x44ae8c,_0x22b8c1){logger['debug']('[%s][voiceQueueReport]['+_0x22b8c1+_0xecb5('0x46'),_0x44ae8c[_0xecb5('0x47')],util['inspect'](_0x44ae8c,{'showHidden':![],'depth':null}));this['emit'](util[_0xecb5('0x48')](_0xecb5('0x49'),_0x44ae8c[_0xecb5('0x4a')]),'voice_queue_channel:save',_0x44ae8c);io[_0xecb5('0x4b')](_0xecb5('0x4c'),_0x44ae8c);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x44')]=function(_0x25e091,_0x16ec50){logger[_0xecb5('0x4d')](_0xecb5('0x4e')+_0x16ec50+_0xecb5('0x4f'),_0x25e091[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x25e091,{'showHidden':![],'depth':null}));if(_0x25e091['queuecallerexitreason']===_0xecb5('0x50')){return;}this[_0xecb5('0x4b')](util['format'](_0xecb5('0x49'),_0x25e091['queue']),'voice_queue_channel:remove',_0x25e091);io['emit'](_0xecb5('0x51'),_0x25e091);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x52')]=function(_0x4b18a6){if(_0x4b18a6[_0xecb5('0x53')]===_0xecb5('0x54')){logger[_0xecb5('0x4d')](_0xecb5('0x55'),util[_0xecb5('0x40')](_0x4b18a6,{'showHidden':![],'depth':null}));this[_0xecb5('0x4b')](util[_0xecb5('0x48')]('voice:queue:%s',_0x4b18a6['name']),_0xecb5('0x56'),_0x4b18a6);}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x57')]=function(_0xb752ba){return _0xb752ba!==null&&!_[_0xecb5('0x58')](_0xb752ba);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x2d')]=function(){var _0x522b12=this;setInterval(function(){_0x522b12[_0xecb5('0x36')]();ami['Action']({'action':'queues'})[_0xecb5('0x3c')](function(_0x2f5b9f){logger[_0xecb5('0x3d')](_0xecb5('0x59'),util[_0xecb5('0x40')](_0x2f5b9f,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xecb5('0xb')]['loopQueueSummary']=function(){var _0x556c8d=this;setInterval(function(){if(!_0x556c8d[_0xecb5('0x43')][_0xecb5('0x5a')]){return ami[_0xecb5('0x39')]({'action':'queuesummary'})[_0xecb5('0x5b')](function(_0x24a360){_0x556c8d[_0xecb5('0x43')]['id']=_0x24a360[_0xecb5('0x5c')];_0x556c8d[_0xecb5('0x43')]['isRunning']=!![];_0x556c8d['summary'][_0xecb5('0x5d')][_0x24a360[_0xecb5('0x5c')]]={};})[_0xecb5('0x3c')](function(_0x39551b){logger[_0xecb5('0x3d')](_0xecb5('0x5e'),util[_0xecb5('0x40')](_0x39551b,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x5f')]=function(_0x2570fd,_0x5c3ae6){var _0x4c1b2a;if(this[_0xecb5('0x43')]&&this[_0xecb5('0x43')][_0xecb5('0x60')]&&this[_0xecb5('0x43')][_0xecb5('0x60')][_0x2570fd['name']]){_0x4c1b2a=this[_0xecb5('0x43')]['queues'][_0x2570fd[_0xecb5('0x61')]][_0xecb5('0x62')];}var _0x3a036e=new VoiceQueueSummary(_0x2570fd);return _0x3a036e[_0xecb5('0x63')](_0x5c3ae6[_0xecb5('0x11')],this[_0xecb5('0x11')],_0x4c1b2a,this['realtime'][_0xecb5('0x12')]);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x64')]=function(_0x38baf3,_0x3e7c2f){var _0x33d1c5=this['createQueueSummaryReport'](_0x38baf3,_0x3e7c2f);var _0x366e14=![];_0x366e14=_0x33d1c5['compareToInboundQueue'](_0x38baf3);if(_0x366e14){Object['assign'](_0x38baf3,_0x33d1c5);this[_0xecb5('0x10')][_0xecb5('0x14')][_0x38baf3[_0xecb5('0x61')]]=_0x38baf3;this[_0xecb5('0x52')](_0x33d1c5);}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x65')]=function(_0x3cf029){var _0x4fda12=null;var _0x5973db=this[_0xecb5('0x43')]['id'];if(this[_0xecb5('0x43')][_0xecb5('0x5d')][_0x5973db]){_0x4fda12=this['summary']['queuestatus'][_0x5973db][_0x3cf029[_0xecb5('0x5c')]];}if(!_0x4fda12){this[_0xecb5('0x43')]=initializeSummary();return;}var _0x5d0162=this['voiceQueues'][_0x4fda12['queue']];if(_0x5d0162[_0xecb5('0x53')]===_0xecb5('0x54')){this['handleInboundQueueSummaryReport'](_0x5d0162,_0x4fda12);}else if(_0x5d0162[_0xecb5('0x53')]===_0xecb5('0x66')){var _0x33c45e=this['createQueueSummaryReport'](_0x5d0162,_0x4fda12);ami[_0xecb5('0x4b')](_0xecb5('0x67'),_0x33c45e);}this[_0xecb5('0x43')][_0xecb5('0x68')]-=0x1;var _0x921cbe=this[_0xecb5('0x43')][_0xecb5('0x68')]>0x0?!![]:![];if(!_0x921cbe){return this[_0xecb5('0x19')](this[_0xecb5('0x43')][_0xecb5('0x69')]);}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x1b')]=function(_0x263210){var _0x591fd9=this[_0xecb5('0x43')]['id'];if(this[_0xecb5('0x43')][_0xecb5('0x5d')][_0x591fd9]&&this['summary']['queuestatus'][_0x591fd9][_0x263210[_0xecb5('0x5c')]]){this[_0xecb5('0x43')][_0xecb5('0x5d')][_0x591fd9][_0x263210[_0xecb5('0x5c')]][_0xecb5('0x11')][_0xecb5('0x6a')](_0x263210);}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x6b')]=function(_0x33a407){var _0x291be3=this;try{if(this[_0xecb5('0x57')](_0x33a407)&&this[_0xecb5('0x57')](_0x33a407['queue'])){logger[_0xecb5('0x4d')](_0xecb5('0x6c'),util[_0xecb5('0x40')](_0x33a407,{'showHidden':![],'depth':null}));var _0xa22e1b=this['voiceQueues'][_0x33a407[_0xecb5('0x4a')]];if(_0xa22e1b){logger[_0xecb5('0x4d')](_0xecb5('0x6d'),_0xa22e1b[_0xecb5('0x61')]);this['summary'][_0xecb5('0x60')][_0xa22e1b[_0xecb5('0x61')]]={'summaryEvent':_0x33a407};this[_0xecb5('0x43')]['statusRequests']+=0x1;return ami[_0xecb5('0x39')]({'action':_0xecb5('0x5d'),'queue':_0xa22e1b[_0xecb5('0x61')]})[_0xecb5('0x5b')](function(_0x43648a){if(!_0x291be3['summary']['queuestatus'][_0x33a407[_0xecb5('0x5c')]]){_0x291be3['summary'][_0xecb5('0x5d')][_0x33a407[_0xecb5('0x5c')]]={};}_0x291be3[_0xecb5('0x43')]['queuestatus'][_0x33a407[_0xecb5('0x5c')]][_0x43648a[_0xecb5('0x5c')]]={'queue':_0xa22e1b['name'],'agents':[]};})[_0xecb5('0x3c')](function(_0xe33ddb){throw _0xe33ddb;});}}}catch(_0x3181e7){logger[_0xecb5('0x3d')](_0xecb5('0x5e'),util[_0xecb5('0x40')](_0x3181e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xecb5('0x19')]=function(_0x1cb429){if(this['summary'][_0xecb5('0x68')]>0x0){this['summary']['completeEvent']=_0x1cb429;return;}logger[_0xecb5('0x4d')](_0xecb5('0x6e'),util[_0xecb5('0x40')](_0x1cb429,{'showHidden':![],'depth':null}));this[_0xecb5('0x43')]=initializeSummary();ami[_0xecb5('0x4b')](_0xecb5('0x6f'),{});};VoiceQueueReport[_0xecb5('0xb')]['syncQueueCallerJoin']=function(_0x409d6b){try{if(this[_0xecb5('0x57')](_0x409d6b)){logger[_0xecb5('0x4d')](_0xecb5('0x70'),_0x409d6b['uniqueid'],util[_0xecb5('0x40')](_0x409d6b,{'showHidden':![],'depth':null}));if(_[_0xecb5('0x58')](this[_0xecb5('0xf')][_0x409d6b['uniqueid']])){this['queueReports'][_0x409d6b[_0xecb5('0x47')]]=[];}if(_[_0xecb5('0x58')](this[_0xecb5('0x12')][_0x409d6b[_0xecb5('0x47')]])){this[_0xecb5('0x12')][_0x409d6b[_0xecb5('0x47')]]={};}var _0x54c2cc=new QueueReport();_0x54c2cc['queue']=_0x409d6b[_0xecb5('0x4a')];_0x54c2cc['type']=this[_0xecb5('0x14')][_0x54c2cc['queue']]&&this[_0xecb5('0x14')][_0x54c2cc['queue']][_0xecb5('0x53')]?this[_0xecb5('0x14')][_0x54c2cc[_0xecb5('0x4a')]]['type']||_0xecb5('0x54'):_0xecb5('0x54');_0x54c2cc[_0xecb5('0x71')]=moment()[_0xecb5('0x48')](_0xecb5('0x72'));_0x54c2cc[_0xecb5('0x73')]=_0x409d6b['position'];_0x54c2cc['count']=_0x409d6b[_0xecb5('0x74')];_0x54c2cc[_0xecb5('0x47')]=_0x409d6b[_0xecb5('0x47')];logger['info'](_0xecb5('0x75'),_0x54c2cc['queue'],_0x54c2cc[_0xecb5('0x53')]);Object[_0xecb5('0x76')](_0x54c2cc,_[_0xecb5('0x77')](_0x409d6b,_['keys'](_0x54c2cc)));this[_0xecb5('0xf')][_0x409d6b[_0xecb5('0x47')]][_0xecb5('0x6a')](_0x54c2cc);this[_0xecb5('0x12')][_0x409d6b[_0xecb5('0x47')]]=_0x54c2cc;this[_0xecb5('0x45')](_0x54c2cc,_0xecb5('0x1c'));}}catch(_0x3e4000){logger[_0xecb5('0x3d')]('[%s][voiceQueueReport][queuecallerjoin]',_0x409d6b[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x3e4000,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x1e')]=function(_0x5683f5){try{if(this[_0xecb5('0x57')](_0x5683f5)){logger[_0xecb5('0x4d')](_0xecb5('0x78'),_0x5683f5['uniqueid'],util[_0xecb5('0x40')](_0x5683f5,{'showHidden':![],'depth':null}));if(this[_0xecb5('0xf')][_0x5683f5[_0xecb5('0x47')]]){var _0x580159=_[_0xecb5('0x79')](this['queueReports'][_0x5683f5['uniqueid']]);_0x580159['queuecallercomplete']=![];_0x580159[_0xecb5('0x7a')]=null;_0x580159[_0xecb5('0x7b')]=_0x5683f5[_0xecb5('0x7b')];_0x580159[_0xecb5('0x7c')]=_0x5683f5[_0xecb5('0x7c')];_0x580159['queuecallerabandon']=!![];_0x580159[_0xecb5('0x7d')]=moment()[_0xecb5('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x580159[_0xecb5('0x7e')]=_0xecb5('0x7f');_0x580159['lastAssignedTo']=null;logger['info'](_0xecb5('0x80'),_0x580159[_0xecb5('0x4a')],_0x580159[_0xecb5('0x53')]);this['channels'][_0x5683f5[_0xecb5('0x47')]]=_0x580159;this[_0xecb5('0x44')](_0x580159,_0xecb5('0x81'));}}}catch(_0x5b91d1){logger[_0xecb5('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5683f5[_0xecb5('0x47')],util['inspect'](_0x5b91d1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x20')]=function(_0x1b0096){try{if(this[_0xecb5('0x57')](_0x1b0096)){logger[_0xecb5('0x4d')](_0xecb5('0x82'),_0x1b0096['uniqueid'],util[_0xecb5('0x40')](_0x1b0096,{'showHidden':![],'depth':null}));if(this[_0xecb5('0xf')][_0x1b0096['uniqueid']]){var _0x2ec6c9=_[_0xecb5('0x79')](this[_0xecb5('0xf')][_0x1b0096[_0xecb5('0x47')]]);_0x2ec6c9[_0xecb5('0x83')]=moment()[_0xecb5('0x48')](_0xecb5('0x72'));_0x2ec6c9[_0xecb5('0x84')]=_0x1b0096[_0xecb5('0x84')];_0x2ec6c9[_0xecb5('0x85')]=_0x1b0096[_0xecb5('0x85')];logger[_0xecb5('0x86')](_0xecb5('0x87'),_0x2ec6c9[_0xecb5('0x4a')],_0x2ec6c9[_0xecb5('0x53')],_0x1b0096[_0xecb5('0x84')],_0x1b0096[_0xecb5('0x85')]);this[_0xecb5('0x12')][_0x1b0096[_0xecb5('0x47')]]=_0x2ec6c9;this[_0xecb5('0x45')](_0x2ec6c9,_0xecb5('0x1f'));}}}catch(_0x277bdc){logger['error'](_0xecb5('0x82'),_0x1b0096[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x277bdc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')]['syncAgentConnect']=function(_0x3e6750){try{if(this['isNotNull'](_0x3e6750)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x3e6750[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x3e6750,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3e6750[_0xecb5('0x47')]]){var _0x4076a4=_[_0xecb5('0x79')](this['queueReports'][_0x3e6750[_0xecb5('0x47')]]);_0x4076a4[_0xecb5('0x35')]=!![];_0x4076a4[_0xecb5('0x7e')]=_0xecb5('0x88');logger[_0xecb5('0x86')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x4076a4[_0xecb5('0x4a')],_0x4076a4['type']);}}}catch(_0x1568eb){logger['error'](_0xecb5('0x89'),_0x3e6750['uniqueid'],util['inspect'](_0x1568eb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x21')]=function(_0x59223d){try{if(this[_0xecb5('0x57')](_0x59223d)){logger[_0xecb5('0x4d')](_0xecb5('0x8a'),_0x59223d[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x59223d,{'showHidden':![],'depth':null}));if(this[_0xecb5('0xf')][_0x59223d[_0xecb5('0x47')]]){var _0x572145=_[_0xecb5('0x79')](this[_0xecb5('0xf')][_0x59223d[_0xecb5('0x47')]]);_0x572145[_0xecb5('0x81')]=![];_0x572145['queuecallerabandonAt']=null;_0x572145[_0xecb5('0x8b')]=!![];_0x572145['lastAssignedTo']=_0x59223d['membername'];_0x572145[_0xecb5('0x7b')]=_0x59223d['holdtime'];_0x572145[_0xecb5('0x35')]=!![];_0x572145[_0xecb5('0x34')]=![];_0x572145[_0xecb5('0x8c')]=null;if(!_0x572145['transfer']){if(_0x59223d[_0xecb5('0x8d')]==_0xecb5('0x8e')){_0x572145[_0xecb5('0x7e')]=_0xecb5('0x8f');logger['info'](_0xecb5('0x90'),_0x572145[_0xecb5('0x4a')],_0x572145[_0xecb5('0x53')]);}else{if(_['startsWith'](_0x59223d['channel']['toLowerCase'](),_0xecb5('0x91'))){if(this['queueReports'][_0x59223d['linkedid']]){var _0x1ee4f4=_['last'](this['queueReports'][_0x59223d['linkedid']]);_0x1ee4f4[_0xecb5('0x35')]=![];_0x1ee4f4[_0xecb5('0x34')]=!![];_0x1ee4f4[_0xecb5('0x8c')]=moment(_0x572145[_0xecb5('0x71')])['add'](_0x59223d[_0xecb5('0x7b')],_0xecb5('0x92'))[_0xecb5('0x48')](_0xecb5('0x72'));_0x1ee4f4[_0xecb5('0x7e')]='FORWARDTRANSFER';_0x1ee4f4['transfer']=!![];_0x1ee4f4[_0xecb5('0x93')]=_0xecb5('0x94');_0x1ee4f4[_0xecb5('0x95')]=_0x59223d[_0xecb5('0x96')];_0x1ee4f4[_0xecb5('0x97')]=_0x59223d['uniqueid'];logger[_0xecb5('0x86')](_0xecb5('0x98'),_0x1ee4f4[_0xecb5('0x4a')],_0x1ee4f4[_0xecb5('0x53')]);var _0x5bb847=this['queueReports'][_0x59223d[_0xecb5('0x99')]];this[_0xecb5('0xf')][_0x59223d[_0xecb5('0x99')]]=this[_0xecb5('0xf')][_0x59223d['uniqueid']];this['queueReports'][_0x59223d[_0xecb5('0x47')]]=_0x5bb847;}}else{_0x572145[_0xecb5('0x7e')]=_0xecb5('0x9a')+_0x59223d['reason']['toUpperCase']();logger[_0xecb5('0x86')](_0xecb5('0x9b'),_0x572145[_0xecb5('0x4a')],_0x572145[_0xecb5('0x53')],_0x572145['queuecallerexitreason']);}}}this[_0xecb5('0x12')][_0x59223d[_0xecb5('0x47')]]=_0x572145;}}}catch(_0x427752){logger[_0xecb5('0x3d')](_0xecb5('0x8a'),_0x59223d[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x427752,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')]['syncVarSet']=function(_0x406e95){try{if(this[_0xecb5('0x57')](_0x406e95)){logger[_0xecb5('0x4d')](_0xecb5('0x9c'),_0x406e95[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x406e95,{'showHidden':![],'depth':null}));this[_0xecb5('0x9d')](_0x406e95[_0xecb5('0x47')],_['keys'](_0x406e95[_0xecb5('0x9e')])[0x0],_0x406e95[_0xecb5('0x9f')]);if(this[_0xecb5('0xf')][_0x406e95[_0xecb5('0x47')]]){var _0x1fecb3=_[_0xecb5('0x79')](this[_0xecb5('0xf')][_0x406e95['uniqueid']]);if(_0x1fecb3){if(this[_0xecb5('0x57')](_0x406e95[_0xecb5('0x9e')])&&this[_0xecb5('0x57')](_0x406e95[_0xecb5('0x9e')]['queuestatus'])){switch(_0x406e95[_0xecb5('0x9f')]){case _0xecb5('0xa0'):_0x1fecb3['queuecallerexit']=![];_0x1fecb3[_0xecb5('0x8c')]=null;break;case _0xecb5('0xa1'):_0x1fecb3[_0xecb5('0xa2')]=_0xecb5('0xa3');_0x1fecb3[_0xecb5('0x34')]=!![];_0x1fecb3['queuecallerexitAt']=moment()[_0xecb5('0x48')](_0xecb5('0x72'));_0x1fecb3[_0xecb5('0x83')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xecb5('0x4d')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x406e95['uniqueid'],util[_0xecb5('0x40')](_0x1fecb3,{'showHidden':![],'depth':null}));ami[_0xecb5('0x4b')](_0xecb5('0xa4'),_0x1fecb3);break;default:_0x1fecb3[_0xecb5('0x34')]=!![];_0x1fecb3[_0xecb5('0x8c')]=moment()[_0xecb5('0x48')](_0xecb5('0x72'));_0x1fecb3[_0xecb5('0x83')]=moment()[_0xecb5('0x48')](_0xecb5('0x72'));}_0x1fecb3[_0xecb5('0x81')]=![];_0x1fecb3[_0xecb5('0x7d')]=null;_0x1fecb3[_0xecb5('0x7e')]=_0x406e95['value'];this[_0xecb5('0x12')][_0x406e95[_0xecb5('0x47')]]=_0x1fecb3;this[_0xecb5('0x44')](_0x1fecb3,'varset');}else if(this['isNotNull'](_0x406e95['variable'])&&this['isNotNull'](_0x406e95[_0xecb5('0x9e')]['queueposition'])){if(!_0x1fecb3[_0xecb5('0x81')]){_0x1fecb3[_0xecb5('0x34')]=!![];_0x1fecb3[_0xecb5('0x8c')]=moment()[_0xecb5('0x48')](_0xecb5('0x72'));_0x1fecb3[_0xecb5('0x7e')]='EXITWITHKEY';_0x1fecb3[_0xecb5('0x83')]=moment()[_0xecb5('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xecb5('0x12')][_0x406e95[_0xecb5('0x47')]]=_0x1fecb3;}}logger[_0xecb5('0x86')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x406e95['uniqueid'],_0x1fecb3['queue'],_0x1fecb3[_0xecb5('0x53')],_[_0xecb5('0xa5')](_0x406e95[_0xecb5('0x9e')])[0x0],_0x406e95[_0xecb5('0x9f')]);_0x1fecb3[_0xecb5('0x16')]=this['variables'][_0x406e95[_0xecb5('0x47')]];}}}}catch(_0x2fc040){logger['error'](_0xecb5('0x9c'),_0x406e95['uniqueid'],util[_0xecb5('0x40')](_0x2fc040,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x9d')]=function(_0x4a5670,_0x193ba5,_0xe73429){var _0x386cf6=[_0xecb5('0xa6'),_0xecb5('0xa7'),_0xecb5('0xa8'),_0xecb5('0xa9'),_0xecb5('0xaa'),'rtpaudioqoslossbridged',_0xecb5('0xab'),_0xecb5('0xac'),_0xecb5('0xad'),_0xecb5('0xae'),_0xecb5('0xaf'),_0xecb5('0xb0'),_0xecb5('0xb1'),'memberdynamic','memberinterface','memberlastcall',_0xecb5('0xb2'),'memberpenalty',_0xecb5('0xb3')];if(!_[_0xecb5('0xb4')](_0x193ba5)&&!_[_0xecb5('0xb5')](_0x386cf6,_0x193ba5)){if(_[_0xecb5('0x58')](this[_0xecb5('0x16')][_0x4a5670])){this[_0xecb5('0x16')][_0x4a5670]={};}this[_0xecb5('0x16')][_0x4a5670][_0x193ba5]=_0xe73429;}};VoiceQueueReport[_0xecb5('0xb')]['handleHangup']=function(_0x24daa4,_0x1515c8,_0x5cda45){try{var _0x30e679={};if(this['queueReports'][_0x24daa4]){for(var _0xd12950=0x0;_0xd12950{delete this[_0xecb5('0x12')][_0x39f1eb];},_0x1a2ae6);}};module['exports']=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index e387aa8..842f295 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 _0xce88=['queue','Request','CreateReportAgentPreview','../client','campaign'];(function(_0x1c101f,_0x52141d){var _0xe02ee4=function(_0x1d9034){while(--_0x1d9034){_0x1c101f['push'](_0x1c101f['shift']());}};_0xe02ee4(++_0x52141d);}(_0xce88,0x189));var _0x8ce8=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xce88[_0x4709c0];return _0x13348b;};'use strict';var client=require(_0x8ce8('0x0'));exports['createHistory']=function(_0x3e487d){return function(){_0x3e487d[_0x8ce8('0x1')]=_0x3e487d[_0x8ce8('0x2')];return client[_0x8ce8('0x3')](_0x8ce8('0x4'),{'body':_0x3e487d,'log':_0x8ce8('0x4')});};}; \ No newline at end of file +var _0x37f8=['campaign','queue','Request','CreateReportAgentPreview','../client','createHistory'];(function(_0x54f906,_0x5abb23){var _0x12de98=function(_0x6da4b5){while(--_0x6da4b5){_0x54f906['push'](_0x54f906['shift']());}};_0x12de98(++_0x5abb23);}(_0x37f8,0x1f0));var _0x837f=function(_0x35ccf7,_0x12dc1e){_0x35ccf7=_0x35ccf7-0x0;var _0x2ffbf8=_0x37f8[_0x35ccf7];return _0x2ffbf8;};'use strict';var client=require(_0x837f('0x0'));exports[_0x837f('0x1')]=function(_0x32c141){return function(){_0x32c141[_0x837f('0x2')]=_0x32c141[_0x837f('0x3')];return client[_0x837f('0x4')](_0x837f('0x5'),{'body':_0x32c141,'log':_0x837f('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 3d9847f..bfca223 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 _0xbe75=['CreateAttachment','../client','Request'];(function(_0x67f1b3,_0x57c488){var _0x2186a2=function(_0x28e716){while(--_0x28e716){_0x67f1b3['push'](_0x67f1b3['shift']());}};_0x2186a2(++_0x57c488);}(_0xbe75,0x193));var _0x5be7=function(_0xacc9f4,_0x3e2618){_0xacc9f4=_0xacc9f4-0x0;var _0x194c0c=_0xbe75[_0xacc9f4];return _0x194c0c;};'use strict';var client=require(_0x5be7('0x0'));exports['create']=function(_0x1befb1){return client[_0x5be7('0x1')](_0x5be7('0x2'),{'body':_0x1befb1,'log':_0x5be7('0x2')});}; \ No newline at end of file +var _0x6f12=['Request','CreateAttachment','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f12,0x86));var _0x26f1=function(_0x2e28a3,_0x4678c2){_0x2e28a3=_0x2e28a3-0x0;var _0x54ec2e=_0x6f12[_0x2e28a3];return _0x54ec2e;};'use strict';var client=require(_0x26f1('0x0'));exports['create']=function(_0x3b6007){return client[_0x26f1('0x1')](_0x26f1('0x2'),{'body':_0x3b6007,'log':_0x26f1('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 7adb11b..d890a63 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 _0x2ef3=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','active','TrunkBackup','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0x2ef3,0xba));var _0x32ef=function(_0x410dd7,_0x3c8de2){_0x410dd7=_0x410dd7-0x0;var _0x5abe4c=_0x2ef3[_0x410dd7];return _0x5abe4c;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),_0x32ef('0x5'),'active',_0x32ef('0x6'),_0x32ef('0x7'),'dialOriginateCallerIdNumber',_0x32ef('0x8'),_0x32ef('0x9'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'dialAMDActive',_0x32ef('0x18'),'dialAMDGreeting',_0x32ef('0x19'),'dialAMDTotalAnalysisTime',_0x32ef('0x1a'),_0x32ef('0x1b'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x32ef('0x1c'),'dialOrderByScheduledAt',_0x32ef('0x1d'),_0x32ef('0x1e'),_0x32ef('0x1f')],'include':[{'model':_0x32ef('0x20'),'as':'Trunk','attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x20'),'as':_0x32ef('0x22'),'attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x23'),'as':_0x32ef('0x23'),'attributes':['id','name'],'include':[{'model':_0x32ef('0x23'),'as':_0x32ef('0x24'),'attributes':['id','name',_0x32ef('0x25')]}]},{'model':_0x32ef('0x26'),'as':_0x32ef('0x26'),'attributes':['id',_0x32ef('0x4')]}]},'log':_0x32ef('0x27')});};}; \ No newline at end of file +var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x270f18,_0x8155e9){var _0x39d745=function(_0x294bdd){while(--_0x294bdd){_0x270f18['push'](_0x270f18['shift']());}};_0x39d745(++_0x8155e9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc4aa[_0xfae23b];return _0x200640;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index d5c84a5..38ae327 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 _0x2045=['CreateCmContact','getContacts','GetCmContact','Request'];(function(_0x314009,_0x228147){var _0x8c8955=function(_0x3ca44b){while(--_0x3ca44b){_0x314009['push'](_0x314009['shift']());}};_0x8c8955(++_0x228147);}(_0x2045,0x177));var _0x5204=function(_0x3b9c71,_0x52bd2f){_0x3b9c71=_0x3b9c71-0x0;var _0x419087=_0x2045[_0x3b9c71];return _0x419087;};'use strict';var client=require('../client');exports['createContact']=function(_0x349c4d){return function(){return client[_0x5204('0x0')](_0x5204('0x1'),{'body':_0x349c4d,'log':_0x5204('0x1')});};};exports[_0x5204('0x2')]=function(_0x420041){return function(){return client[_0x5204('0x0')](_0x5204('0x3'),{'options':_0x420041,'log':'GetCmContact'});};}; \ No newline at end of file +var _0x9bfb=['../client','createContact','Request','CreateCmContact','GetCmContact'];(function(_0x436a4a,_0x6430c1){var _0x591a73=function(_0x3a951e){while(--_0x3a951e){_0x436a4a['push'](_0x436a4a['shift']());}};_0x591a73(++_0x6430c1);}(_0x9bfb,0x1b8));var _0xb9bf=function(_0x21d383,_0x71056d){_0x21d383=_0x21d383-0x0;var _0x3ea4a5=_0x9bfb[_0x21d383];return _0x3ea4a5;};'use strict';var client=require(_0xb9bf('0x0'));exports[_0xb9bf('0x1')]=function(_0x27e353){return function(){return client[_0xb9bf('0x2')](_0xb9bf('0x3'),{'body':_0x27e353,'log':'CreateCmContact'});};};exports['getContacts']=function(_0x39e297){return function(){return client[_0xb9bf('0x2')](_0xb9bf('0x4'),{'options':_0x39e297,'log':_0xb9bf('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index e5157d4..135d16d 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 _0xff3c=['moment','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','Request','ContactId','ListId','VoiceQueueId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','format','DESC','ASC','getContactDialerIvr','scheduledat','moveContactManagedDialer','queue','MoveContactManagedDialer','countReScheduled','GetCmHopperPreview','Agent','VoiceQueue','Queue','name','unlockContact','getContactRecallMe','GetContactRecallMe','priority','User','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client'];(function(_0x5d82e6,_0x7bbef7){var _0x464c67=function(_0x254ae0){while(--_0x254ae0){_0x5d82e6['push'](_0x5d82e6['shift']());}};_0x464c67(++_0x7bbef7);}(_0xff3c,0x179));var _0xcff3=function(_0x30df14,_0x5034f4){_0x30df14=_0x30df14-0x0;var _0x3795c0=_0xff3c[_0x30df14];return _0x3795c0;};'use strict';var client=require(_0xcff3('0x0'));var moment=require(_0xcff3('0x1'));exports['getContacts']=function(_0x1c3482,_0x832575){return function(){return client['Request']('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x1c3482},'include':[{'model':_0xcff3('0x2'),'as':_0xcff3('0x3')}],'limit':_0x832575,'raw':![]},'log':_0xcff3('0x4')});};};exports[_0xcff3('0x5')]=function(_0x1279e5,_0x308a82,_0x47b899){return function(){return client['Request'](_0xcff3('0x6'),{'body':_0x1279e5,'options':{'where':{'VoiceQueueId':_0x308a82,'scheduledat':{'$lte':moment()['format'](_0xcff3('0x7'))}},'limit':_0x47b899},'log':'UpdateCmHopper'});};};exports[_0xcff3('0x8')]=function(_0x3d9aec){return client[_0xcff3('0x9')](_0xcff3('0x6'),{'body':_0x3d9aec,'options':{'where':{'ContactId':_0x3d9aec[_0xcff3('0xa')],'ListId':_0x3d9aec[_0xcff3('0xb')],'VoiceQueueId':_0x3d9aec[_0xcff3('0xc')],'CampaignId':_0x3d9aec['CampaignId']}},'log':'rescheduleContact'});};exports[_0xcff3('0xd')]=function(_0x26ce90,_0x3e5fbc,_0x3da4ca){return function(){return client[_0xcff3('0x9')](_0xcff3('0xe'),{'options':{'where':{'VoiceQueueId':_0x26ce90,'ListId':_0x3e5fbc,'ContactId':_0x3da4ca}},'log':_0xcff3('0xe')});};};exports[_0xcff3('0xf')]=function(_0xc7d33d,_0x3674cc,_0x2ac0fc,_0x155309){return client[_0xcff3('0x9')](_0xcff3('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xc7d33d,'active':![],'scheduledat':{'$lte':moment()[_0xcff3('0x11')](_0xcff3('0x7'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x3674cc}}]},'order':[['priority',_0xcff3('0x12')],['scheduledat',_0x155309],['id',_0xcff3('0x13')]],'raw':!![],'limit':_0x2ac0fc},'log':_0xcff3('0x10')});};exports[_0xcff3('0x14')]=function(_0x5d923e,_0xa95fcd,_0xb9df6e){return client['Request'](_0xcff3('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5d923e,'active':![],'scheduledat':{'$lte':moment()['format'](_0xcff3('0x7'))}},'include':[{'model':_0xcff3('0x2'),'as':_0xcff3('0x3')}],'order':[['priority','DESC'],[_0xcff3('0x15'),_0xb9df6e],['id',_0xcff3('0x13')]],'raw':!![],'limit':_0xa95fcd},'log':'GetContactDialerIvr'});};exports[_0xcff3('0x16')]=function(_0x517f33,_0x2a90d3){_0x517f33['campaign']=_0x517f33[_0xcff3('0x17')];return client['Request'](_0xcff3('0x18'),{'body':_0x517f33,'options':{'where':{'ContactId':_0x517f33['ContactId'],'ListId':_0x517f33[_0xcff3('0xb')],'VoiceQueueId':_0x517f33[_0xcff3('0xc')],'CampaignId':_0x517f33['CampaignId'],'active':_0x2a90d3?undefined:!![]}},'log':_0xcff3('0x18')});};exports[_0xcff3('0x19')]=function(_0x8025c2){return client[_0xcff3('0x9')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x8025c2['id']?_0x8025c2['id']||null:null}},'log':_0xcff3('0x19')});};exports['getContactPreview']=function(_0x51a872){return function(){return client[_0xcff3('0x9')](_0xcff3('0x1a'),{'options':{'where':{'id':_0x51a872},'include':[{'model':_0xcff3('0x2'),'as':_0xcff3('0x3')},{'model':'User','as':_0xcff3('0x1b'),'attributes':['id','name']},{'model':_0xcff3('0x1c'),'as':_0xcff3('0x1d'),'attributes':['id',_0xcff3('0x1e')]}],'raw':!![]},'log':_0xcff3('0x4')});};};exports[_0xcff3('0x1f')]=function(_0x145ac6,_0x4557d0,_0xb9c78b){return client[_0xcff3('0x9')](_0xcff3('0x6'),{'body':_0x145ac6,'options':{'where':{'id':_0x4557d0},'limit':_0xb9c78b},'log':_0xcff3('0x6')});};exports[_0xcff3('0x20')]=function(_0x400982,_0x3d1b5d){return function(){return client[_0xcff3('0x9')](_0xcff3('0x21'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x400982,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xcff3('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x3d1b5d}},'order':[[_0xcff3('0x22'),_0xcff3('0x12')],['scheduledat',_0xcff3('0x12')],['id','ASC']],'include':[{'model':_0xcff3('0x2'),'as':_0xcff3('0x3')},{'model':_0xcff3('0x23'),'as':_0xcff3('0x1b'),'attributes':['id',_0xcff3('0x1e'),_0xcff3('0x24')]}],'group':_0xcff3('0x25'),'raw':!![]},'log':_0xcff3('0x10')});};};exports[_0xcff3('0x26')]=function(_0x57c761,_0x142799){return client['Request'](_0xcff3('0x27'),{'body':_0x57c761,'options':_0x142799||{},'log':'ResetActiveCalls'});};exports[_0xcff3('0x28')]=function(_0x57af6b,_0x5f551a,_0x28152b){return function(){return client[_0xcff3('0x9')](_0xcff3('0x29'),{'body':{'where':{'voiceQueueIds':_0x57af6b,'interval':_0x5f551a,'availableAgentsIds':_0x28152b}},'log':_0xcff3('0x28')});};}; \ No newline at end of file +var _0xfc9b=['YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','getContactDialerIvr','CmContact','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','ContactId','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','VoiceQueue','Queue','getCmHopper','getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','Contact','updateContacts','UpdateCmHopper','format','ListId','VoiceQueueId','CampaignId','rescheduleContact','destroyContact','DestroyCmHopper','GetContactDialer'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xfc9b,0x74));var _0xbfc9=function(_0x4548b7,_0x1133e2){_0x4548b7=_0x4548b7-0x0;var _0x12fdc9=_0xfc9b[_0x4548b7];return _0x12fdc9;};'use strict';var client=require(_0xbfc9('0x0'));var moment=require(_0xbfc9('0x1'));exports[_0xbfc9('0x2')]=function(_0x38f482,_0x29639e){return function(){return client[_0xbfc9('0x3')](_0xbfc9('0x4'),{'options':{'where':{'VoiceQueueId':_0x38f482},'include':[{'model':'CmContact','as':_0xbfc9('0x5')}],'limit':_0x29639e,'raw':![]},'log':'getCmHopper'});};};exports[_0xbfc9('0x6')]=function(_0x1f1a3f,_0x523ff1,_0x1dbece){return function(){return client[_0xbfc9('0x3')](_0xbfc9('0x7'),{'body':_0x1f1a3f,'options':{'where':{'VoiceQueueId':_0x523ff1,'scheduledat':{'$lte':moment()[_0xbfc9('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x1dbece},'log':_0xbfc9('0x7')});};};exports['rescheduleContact']=function(_0x32bee5){return client['Request'](_0xbfc9('0x7'),{'body':_0x32bee5,'options':{'where':{'ContactId':_0x32bee5['ContactId'],'ListId':_0x32bee5[_0xbfc9('0x9')],'VoiceQueueId':_0x32bee5[_0xbfc9('0xa')],'CampaignId':_0x32bee5[_0xbfc9('0xb')]}},'log':_0xbfc9('0xc')});};exports[_0xbfc9('0xd')]=function(_0x20ded8,_0x540738,_0x1776a5){return function(){return client[_0xbfc9('0x3')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x20ded8,'ListId':_0x540738,'ContactId':_0x1776a5}},'log':_0xbfc9('0xe')});};};exports['getContactDialer']=function(_0x40500b,_0x259940,_0x128af6,_0x2a5c78){return client['Request'](_0xbfc9('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x40500b,'active':![],'scheduledat':{'$lte':moment()[_0xbfc9('0x8')](_0xbfc9('0x10'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x259940}}]},'order':[[_0xbfc9('0x11'),_0xbfc9('0x12')],[_0xbfc9('0x13'),_0x2a5c78],['id',_0xbfc9('0x14')]],'raw':!![],'limit':_0x128af6},'log':_0xbfc9('0xf')});};exports[_0xbfc9('0x15')]=function(_0x42cacd,_0x3dd866,_0x1b6218){return client[_0xbfc9('0x3')](_0xbfc9('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x42cacd,'active':![],'scheduledat':{'$lte':moment()[_0xbfc9('0x8')](_0xbfc9('0x10'))}},'include':[{'model':_0xbfc9('0x16'),'as':_0xbfc9('0x5')}],'order':[[_0xbfc9('0x11'),_0xbfc9('0x12')],[_0xbfc9('0x13'),_0x1b6218],['id',_0xbfc9('0x14')]],'raw':!![],'limit':_0x3dd866},'log':'GetContactDialerIvr'});};exports[_0xbfc9('0x17')]=function(_0x1217f4,_0x237897){_0x1217f4[_0xbfc9('0x18')]=_0x1217f4[_0xbfc9('0x19')];return client[_0xbfc9('0x3')](_0xbfc9('0x1a'),{'body':_0x1217f4,'options':{'where':{'ContactId':_0x1217f4[_0xbfc9('0x1b')],'ListId':_0x1217f4[_0xbfc9('0x9')],'VoiceQueueId':_0x1217f4[_0xbfc9('0xa')],'CampaignId':_0x1217f4[_0xbfc9('0xb')],'active':_0x237897?undefined:!![]}},'log':_0xbfc9('0x1a')});};exports[_0xbfc9('0x1c')]=function(_0x7012e0){return client['Request'](_0xbfc9('0x1d'),{'options':{'where':{'VoiceQueueId':_0x7012e0['id']?_0x7012e0['id']||null:null}},'log':_0xbfc9('0x1c')});};exports[_0xbfc9('0x1e')]=function(_0x2ba7d6){return function(){return client[_0xbfc9('0x3')]('GetCmHopperPreview',{'options':{'where':{'id':_0x2ba7d6},'include':[{'model':_0xbfc9('0x16'),'as':_0xbfc9('0x5')},{'model':_0xbfc9('0x1f'),'as':_0xbfc9('0x20'),'attributes':['id',_0xbfc9('0x21')]},{'model':_0xbfc9('0x22'),'as':_0xbfc9('0x23'),'attributes':['id',_0xbfc9('0x21')]}],'raw':!![]},'log':_0xbfc9('0x24')});};};exports['unlockContact']=function(_0x5185e5,_0x555cf1,_0x1a02e3){return client['Request']('UpdateCmHopper',{'body':_0x5185e5,'options':{'where':{'id':_0x555cf1},'limit':_0x1a02e3},'log':_0xbfc9('0x7')});};exports[_0xbfc9('0x25')]=function(_0xfa1abc,_0x14e1ac){return function(){return client[_0xbfc9('0x3')](_0xbfc9('0x26'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xfa1abc,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xbfc9('0x8')](_0xbfc9('0x10'))},'UserId':{'$in':_0x14e1ac}},'order':[[_0xbfc9('0x11'),'DESC'],[_0xbfc9('0x13'),_0xbfc9('0x12')],['id',_0xbfc9('0x14')]],'include':[{'model':'CmContact','as':_0xbfc9('0x5')},{'model':_0xbfc9('0x1f'),'as':_0xbfc9('0x20'),'attributes':['id',_0xbfc9('0x21'),_0xbfc9('0x27')]}],'group':_0xbfc9('0x28'),'raw':!![]},'log':_0xbfc9('0xf')});};};exports[_0xbfc9('0x29')]=function(_0x23f96f,_0x157dd9){return client['Request']('ResetActiveCalls',{'body':_0x23f96f,'options':_0x157dd9||{},'log':_0xbfc9('0x2a')});};exports[_0xbfc9('0x2b')]=function(_0x3c1838,_0x1e2a10,_0x38bbd9){return function(){return client[_0xbfc9('0x3')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x3c1838,'interval':_0x1e2a10,'availableAgentsIds':_0x38bbd9}},'log':_0xbfc9('0x2b')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 62772b1..1ec7a9f 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 _0x940d=['swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones'];(function(_0x522f2b,_0x95c3c1){var _0x2bb579=function(_0x1a0c88){while(--_0x1a0c88){_0x522f2b['push'](_0x522f2b['shift']());}};_0x2bb579(++_0x95c3c1);}(_0x940d,0x74));var _0xd940=function(_0x16086d,_0x275617){_0x16086d=_0x16086d-0x0;var _0x350bfa=_0x940d[_0x16086d];return _0x350bfa;};'use strict';var client=require(_0xd940('0x0'));exports[_0xd940('0x1')]=function(_0x12c71f,_0x1f567d,_0x143ced){return client[_0xd940('0x2')](_0xd940('0x3'),{'body':_0x12c71f,'reason':_0x1f567d,'entity':_0x143ced,'log':'VerifyAdditionalPhones'});};exports[_0xd940('0x4')]=function(_0x59933d,_0x76d1d9,_0x15c017){return client[_0xd940('0x2')](_0xd940('0x5'),{'body':_0x59933d,'duration':_0x76d1d9,'waitTime':_0x15c017,'log':_0xd940('0x5')});};exports[_0xd940('0x6')]=function(_0x5602b4){return function(){return client[_0xd940('0x2')]('IncrementPreviewCounters',{'body':_0x5602b4,'log':_0xd940('0x7')});};}; \ No newline at end of file +var _0x26e5=['swapAdditionalPhones','Request','SwapAdditionalPhones','IncrementPreviewCounters','../client','verifyAdditionalPhones','VerifyAdditionalPhones'];(function(_0x336a6e,_0x4c454f){var _0x4c0b21=function(_0x3590a0){while(--_0x3590a0){_0x336a6e['push'](_0x336a6e['shift']());}};_0x4c0b21(++_0x4c454f);}(_0x26e5,0xc8));var _0x526e=function(_0x46b1c9,_0x169f87){_0x46b1c9=_0x46b1c9-0x0;var _0x17569c=_0x26e5[_0x46b1c9];return _0x17569c;};'use strict';var client=require(_0x526e('0x0'));exports[_0x526e('0x1')]=function(_0x547571,_0x58ad0b,_0x1aaddb){return client['Request'](_0x526e('0x2'),{'body':_0x547571,'reason':_0x58ad0b,'entity':_0x1aaddb,'log':'VerifyAdditionalPhones'});};exports[_0x526e('0x3')]=function(_0x771c7e,_0x521a75,_0x36e017){return client[_0x526e('0x4')](_0x526e('0x5'),{'body':_0x771c7e,'duration':_0x521a75,'waitTime':_0x36e017,'log':_0x526e('0x5')});};exports['incrementPreviewCounters']=function(_0x3b48b4){return function(){return client['Request'](_0x526e('0x6'),{'body':_0x3b48b4,'log':_0x526e('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 092b119..b53eea6 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 _0xcdcc=['../client','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','GetCmHopperBlackIvr'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xcdcc,0x138));var _0xccdc=function(_0x14ca78,_0x284b65){_0x14ca78=_0x14ca78-0x0;var _0x22b766=_0xcdcc[_0x14ca78];return _0x22b766;};'use strict';var client=require(_0xccdc('0x0'));exports[_0xccdc('0x1')]=function(_0x230b72){return client[_0xccdc('0x2')](_0xccdc('0x3'),{'options':{'where':{'VoiceQueueId':_0x230b72[_0xccdc('0x4')],'phone':_0x230b72[_0xccdc('0x5')]},'raw':![]},'log':_0xccdc('0x3')});};exports[_0xccdc('0x6')]=function(_0x213dd6){return client[_0xccdc('0x2')](_0xccdc('0x3'),{'options':{'where':{'CampaignId':_0x213dd6['CampaignId'],'phone':_0x213dd6[_0xccdc('0x5')]},'raw':![]},'log':_0xccdc('0x7')});}; \ No newline at end of file +var _0xba20=['Request','phone','GetCmHopperBlack','GetCmHopperBlackIvr','checkIsBlackList'];(function(_0x323759,_0xb30675){var _0x4dab95=function(_0x44443f){while(--_0x44443f){_0x323759['push'](_0x323759['shift']());}};_0x4dab95(++_0xb30675);}(_0xba20,0x18f));var _0x0ba2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba20[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x0ba2('0x0')]=function(_0xa38a3f){return client[_0x0ba2('0x1')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0xa38a3f['VoiceQueueId'],'phone':_0xa38a3f[_0x0ba2('0x2')]},'raw':![]},'log':_0x0ba2('0x3')});};exports['checkIsBlackListIvr']=function(_0x23e997){return client[_0x0ba2('0x1')](_0x0ba2('0x3'),{'options':{'where':{'CampaignId':_0x23e997['CampaignId'],'phone':_0x23e997[_0x0ba2('0x2')]},'raw':![]},'log':_0x0ba2('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index d63e80e..2a253a6 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 _0xfd6a=['Request','CreateCmHopperFinal','../client','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd6a,0x156));var _0xafd6=function(_0x5a2c9b,_0x4b27fb){_0x5a2c9b=_0x5a2c9b-0x0;var _0x5f5927=_0xfd6a[_0x5a2c9b];return _0x5f5927;};'use strict';var client=require(_0xafd6('0x0'));exports['createContact']=function(_0x37ff4f){return function(){_0x37ff4f['campaign']=_0x37ff4f[_0xafd6('0x1')];return client[_0xafd6('0x2')](_0xafd6('0x3'),{'body':_0x37ff4f,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file +var _0xce71=['Request','CreateCmHopperFinal','../client','createContact','campaign'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xce71,0x93));var _0x1ce7=function(_0x54b074,_0x595ad7){_0x54b074=_0x54b074-0x0;var _0x176513=_0xce71[_0x54b074];return _0x176513;};'use strict';var client=require(_0x1ce7('0x0'));exports[_0x1ce7('0x1')]=function(_0x1a59b3){return function(){_0x1a59b3[_0x1ce7('0x2')]=_0x1a59b3['queue'];return client[_0x1ce7('0x3')]('CreateCmHopperFinal',{'body':_0x1a59b3,'log':_0x1ce7('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index f0525e9..f6445b3 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 _0xf418=['queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetVoiceQueueHopperHistory','startOf','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','day','ivr','../client','createHistory','campaign'];(function(_0x47b7cb,_0x59ea30){var _0x1a8954=function(_0x55252d){while(--_0x55252d){_0x47b7cb['push'](_0x47b7cb['shift']());}};_0x1a8954(++_0x59ea30);}(_0xf418,0x1e3));var _0x8f41=function(_0x1836a3,_0x451c85){_0x1836a3=_0x1836a3-0x0;var _0x5af435=_0xf418[_0x1836a3];return _0x5af435;};'use strict';var client=require(_0x8f41('0x0'));var moment=require('moment');exports[_0x8f41('0x1')]=function(_0x5afe5c){_0x5afe5c[_0x8f41('0x2')]=_0x5afe5c[_0x8f41('0x3')];return client[_0x8f41('0x4')](_0x8f41('0x5'),{'body':_0x5afe5c,'log':'CreateCmHopperHistory'});};exports[_0x8f41('0x6')]=function(_0x1627bd){return client[_0x8f41('0x4')](_0x8f41('0x7'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x1627bd,_0x8f41('0x8'))[_0x8f41('0x9')](_0x8f41('0xa')),moment()[_0x8f41('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':'GetCmHopperHistory'});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0x8f41('0x4')](_0x8f41('0xb'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x8f41('0xc')]('day')[_0x8f41('0x9')](_0x8f41('0xa')),moment()[_0x8f41('0xd')]('day')[_0x8f41('0x9')](_0x8f41('0xa'))]},'campaigntype':_0x8f41('0x3')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x8f41('0xe')]=function(){return function(){return client[_0x8f41('0x4')](_0x8f41('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x8f41('0xc')](_0x8f41('0x10'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x8f41('0x9')](_0x8f41('0xa'))]},'campaigntype':_0x8f41('0x11')},'raw':![]},'log':_0x8f41('0xf')});};}; \ No newline at end of file +var _0x8801=['format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','day','endOf','GetCampaignHopperHistory','ivr','../client','moment','createHistory','queue','Request','CreateCmHopperHistory','avgHandleTime','minutes'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x8801,0xf7));var _0x1880=function(_0x3b8c6b,_0x52dff9){_0x3b8c6b=_0x3b8c6b-0x0;var _0x36b9d6=_0x8801[_0x3b8c6b];return _0x36b9d6;};'use strict';var client=require(_0x1880('0x0'));var moment=require(_0x1880('0x1'));exports[_0x1880('0x2')]=function(_0x3e8699){_0x3e8699['campaign']=_0x3e8699[_0x1880('0x3')];return client[_0x1880('0x4')](_0x1880('0x5'),{'body':_0x3e8699,'log':_0x1880('0x5')});};exports[_0x1880('0x6')]=function(_0x270947){return client[_0x1880('0x4')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x270947,_0x1880('0x7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x1880('0x8')](_0x1880('0x9'))]}},'raw':![]},'log':_0x1880('0xa')});};exports[_0x1880('0xb')]=function(){return function(){return client['Request'](_0x1880('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x1880('0xd'))['format'](_0x1880('0x9')),moment()[_0x1880('0xe')](_0x1880('0xd'))[_0x1880('0x8')](_0x1880('0x9'))]},'campaigntype':_0x1880('0x3')},'raw':![]},'log':_0x1880('0xc')});};};exports['getCampaignHopperHistory']=function(){return function(){return client['Request'](_0x1880('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x1880('0xd'))[_0x1880('0x8')](_0x1880('0x9')),moment()[_0x1880('0xe')](_0x1880('0xd'))[_0x1880('0x8')](_0x1880('0x9'))]},'campaigntype':_0x1880('0x10')},'raw':![]},'log':_0x1880('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index b6365ea..25140e1 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 _0x937d=['headerinfo','localstationid','minrate','modem','gateway','faxdetect','tech','TrunkId','key','Trunk','callerid','getFaxAccount','Request','NotifyFaxAccount','../client','name','description','ecm'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x937d,0x1f4));var _0xd937=function(_0x1a96dc,_0x2eb8ff){_0x1a96dc=_0x1a96dc-0x0;var _0x53c749=_0x937d[_0x1a96dc];return _0x53c749;};'use strict';var client=require(_0xd937('0x0'));exports['getFaxAccounts']=function(){return function(){return client['Request']('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0xd937('0x1'),_0xd937('0x2'),_0xd937('0x3'),_0xd937('0x4'),_0xd937('0x5'),_0xd937('0x6'),'maxrate',_0xd937('0x7'),_0xd937('0x8'),_0xd937('0x9'),'t38timeout',_0xd937('0xa'),_0xd937('0xb'),'ListId',_0xd937('0xc')],'include':[{'model':_0xd937('0xd'),'as':_0xd937('0xd'),'attributes':['id',_0xd937('0x1'),_0xd937('0xe'),'active']}]},'log':_0xd937('0xf')});};};exports['notify']=function(_0xd8f575,_0x4db1e1){return client[_0xd937('0x10')](_0xd937('0x11'),{'account':{'id':_0xd8f575},'body':_0x4db1e1,'log':_0xd937('0x11')});}; \ No newline at end of file +var _0x02a7=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','faxdetect','tech','TrunkId','callerid','getFaxAccount','notify','NotifyFaxAccount','getFaxAccounts','Request','GetFaxAccount'];(function(_0x4abcd2,_0x3a7538){var _0x3e072f=function(_0x345749){while(--_0x345749){_0x4abcd2['push'](_0x4abcd2['shift']());}};_0x3e072f(++_0x3a7538);}(_0x02a7,0x1a6));var _0x702a=function(_0x1f2e84,_0x43bfb1){_0x1f2e84=_0x1f2e84-0x0;var _0x52700c=_0x02a7[_0x1f2e84];return _0x52700c;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return function(){return client[_0x702a('0x1')](_0x702a('0x2'),{'options':{'raw':![],'attributes':['id',_0x702a('0x3'),_0x702a('0x4'),_0x702a('0x5'),_0x702a('0x6'),_0x702a('0x7'),_0x702a('0x8'),_0x702a('0x9'),'modem','gateway',_0x702a('0xa'),'t38timeout',_0x702a('0xb'),_0x702a('0xc'),'ListId','key'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x702a('0x3'),_0x702a('0xd'),'active']}]},'log':_0x702a('0xe')});};};exports[_0x702a('0xf')]=function(_0xebee92,_0x25920c){return client[_0x702a('0x1')](_0x702a('0x10'),{'account':{'id':_0xebee92},'body':_0x25920c,'log':_0x702a('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index c95cc69..38eae8d 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 _0x20f1=['../client','update','Request','UpdateFaxMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x20f1,0x74));var _0x120f=function(_0x5aaf45,_0x2a0aed){_0x5aaf45=_0x5aaf45-0x0;var _0x44c6b5=_0x20f1[_0x5aaf45];return _0x44c6b5;};'use strict';var client=require(_0x120f('0x0'));exports[_0x120f('0x1')]=function(_0xaa5cfc,_0x68b5f1){return client[_0x120f('0x2')]('UpdateFaxMessage',{'body':_0x68b5f1,'options':{'where':{'AttachmentId':_0xaa5cfc}},'log':_0x120f('0x3')});}; \ No newline at end of file +var _0x34f4=['update','Request','UpdateFaxMessage','../client'];(function(_0x1b8326,_0x44c46a){var _0x408488=function(_0x52e696){while(--_0x52e696){_0x1b8326['push'](_0x1b8326['shift']());}};_0x408488(++_0x44c46a);}(_0x34f4,0xeb));var _0x434f=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x34f4[_0xb0f7c3];return _0x28ea68;};'use strict';var client=require(_0x434f('0x0'));exports[_0x434f('0x1')]=function(_0x23b23b,_0x5bd970){return client[_0x434f('0x2')](_0x434f('0x3'),{'body':_0x5bd970,'options':{'where':{'AttachmentId':_0x23b23b}},'log':'UpdateFaxMessage'});}; \ 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 3f2a783..10e14f3 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 _0x0698=['name','description','username','password','remoteUri','type','serverUrl','DeskConfiguration','DeskField','Subjects','content','variableName','Variable','key','keyType','keyContent','Fields','idField','nameField','customField','Tag','../../client','getDeskAccounts','Request','GetDeskAccount'];(function(_0xb07df9,_0x327abe){var _0x5187f0=function(_0x4ec973){while(--_0x4ec973){_0xb07df9['push'](_0xb07df9['shift']());}};_0x5187f0(++_0x327abe);}(_0x0698,0xf6));var _0x8069=function(_0x303766,_0x55bdd2){_0x303766=_0x303766-0x0;var _0x184ea9=_0x0698[_0x303766];return _0x184ea9;};'use strict';var client=require(_0x8069('0x0'));exports[_0x8069('0x1')]=function(){return function(_0x533ec6){return client[_0x8069('0x2')](_0x8069('0x3'),{'options':{'raw':![],'attributes':['id',_0x8069('0x4'),_0x8069('0x5'),_0x8069('0x6'),_0x8069('0x7'),_0x8069('0x8'),'authType',_0x8069('0x9'),_0x8069('0xa')],'include':[{'model':_0x8069('0xb'),'as':'Configurations','attributes':['id',_0x8069('0x4')],'include':[{'model':_0x8069('0xc'),'as':_0x8069('0xd'),'attributes':['id',_0x8069('0x9'),_0x8069('0xe'),_0x8069('0xf')],'include':[{'model':_0x8069('0x10'),'as':_0x8069('0x10'),'attributes':['id',_0x8069('0x4')]}]},{'model':_0x8069('0xc'),'as':'Descriptions','attributes':['id',_0x8069('0x9'),_0x8069('0xe'),_0x8069('0x11'),_0x8069('0x12'),_0x8069('0x13'),'variableName'],'include':[{'model':_0x8069('0x10'),'as':'Variable','attributes':['id',_0x8069('0x4')]}]},{'model':'DeskField','as':_0x8069('0x14'),'attributes':['id',_0x8069('0x9'),_0x8069('0xe'),_0x8069('0x15'),_0x8069('0x16'),_0x8069('0x17'),'variableName'],'include':[{'model':_0x8069('0x10'),'as':_0x8069('0x10'),'attributes':['id',_0x8069('0x4')]}]},{'model':_0x8069('0x18'),'as':'Tags','attributes':['id',_0x8069('0x4')]}]}]},'log':_0x8069('0x3')});};}; \ No newline at end of file +var _0x2611=['Tag','Tags','../../client','getDeskAccounts','Request','GetDeskAccount','username','password','remoteUri','authType','type','serverUrl','DeskField','Subjects','content','variableName','Variable','name','key','keyContent','Fields','idField','customField'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x2611,0x12d));var _0x1261=function(_0xcdf816,_0x21b6f){_0xcdf816=_0xcdf816-0x0;var _0x4bdf3d=_0x2611[_0xcdf816];return _0x4bdf3d;};'use strict';var client=require(_0x1261('0x0'));exports[_0x1261('0x1')]=function(){return function(_0x2d83bc){return client[_0x1261('0x2')](_0x1261('0x3'),{'options':{'raw':![],'attributes':['id','name','description',_0x1261('0x4'),_0x1261('0x5'),_0x1261('0x6'),_0x1261('0x7'),_0x1261('0x8'),_0x1261('0x9')],'include':[{'model':'DeskConfiguration','as':'Configurations','attributes':['id','name'],'include':[{'model':_0x1261('0xa'),'as':_0x1261('0xb'),'attributes':['id','type',_0x1261('0xc'),_0x1261('0xd')],'include':[{'model':_0x1261('0xe'),'as':_0x1261('0xe'),'attributes':['id',_0x1261('0xf')]}]},{'model':'DeskField','as':'Descriptions','attributes':['id',_0x1261('0x8'),'content',_0x1261('0x10'),'keyType',_0x1261('0x11'),_0x1261('0xd')],'include':[{'model':_0x1261('0xe'),'as':_0x1261('0xe'),'attributes':['id',_0x1261('0xf')]}]},{'model':_0x1261('0xa'),'as':_0x1261('0x12'),'attributes':['id',_0x1261('0x8'),_0x1261('0xc'),_0x1261('0x13'),'nameField',_0x1261('0x14'),'variableName'],'include':[{'model':_0x1261('0xe'),'as':_0x1261('0xe'),'attributes':['id',_0x1261('0xf')]}]},{'model':_0x1261('0x15'),'as':_0x1261('0x16'),'attributes':['id',_0x1261('0xf')]}]}]},'log':_0x1261('0x3')});};}; \ 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 72e661d..463bce9 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 _0xd7d1=['Fields','nameField','customField','CloudProvider','data5','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','variableName','Variable','Descriptions','content','keyContent'];(function(_0x31ed12,_0x2a38f9){var _0x1afd40=function(_0x23a8ca){while(--_0x23a8ca){_0x31ed12['push'](_0x31ed12['shift']());}};_0x1afd40(++_0x2a38f9);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x10090c,_0xa5d83a){_0x10090c=_0x10090c-0x0;var _0x4c2fe6=_0xd7d1[_0x10090c];return _0x4c2fe6;};'use strict';var client=require(_0x1d7d('0x0'));exports[_0x1d7d('0x1')]=function(){return function(_0xce4540){return client[_0x1d7d('0x2')](_0x1d7d('0x3'),{'options':{'raw':![],'attributes':['id',_0x1d7d('0x4'),_0x1d7d('0x5'),_0x1d7d('0x6'),_0x1d7d('0x7'),_0x1d7d('0x8'),_0x1d7d('0x9'),_0x1d7d('0xa'),_0x1d7d('0xb'),'description',_0x1d7d('0xc')],'include':[{'model':_0x1d7d('0xd'),'as':_0x1d7d('0xe'),'attributes':['id',_0x1d7d('0x4'),_0x1d7d('0xf'),_0x1d7d('0x10'),_0x1d7d('0x11'),_0x1d7d('0x12')],'include':[{'model':_0x1d7d('0x13'),'as':_0x1d7d('0x14'),'attributes':['id',_0x1d7d('0x15'),'content',_0x1d7d('0x16')],'include':[{'model':'Variable','as':_0x1d7d('0x17'),'attributes':['id',_0x1d7d('0x4')]}]},{'model':_0x1d7d('0x13'),'as':_0x1d7d('0x18'),'attributes':['id','type',_0x1d7d('0x19'),'key','keyType',_0x1d7d('0x1a'),_0x1d7d('0x16')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x1d7d('0x4')]}]},{'model':_0x1d7d('0x13'),'as':_0x1d7d('0x1b'),'attributes':['id',_0x1d7d('0x15'),_0x1d7d('0x19'),'idField',_0x1d7d('0x1c'),_0x1d7d('0x1d'),'variableName'],'include':[{'model':_0x1d7d('0x17'),'as':_0x1d7d('0x17'),'attributes':['id',_0x1d7d('0x4')]}]}]},{'model':_0x1d7d('0x1e'),'as':_0x1d7d('0x1e'),'attributes':['id','data2',_0x1d7d('0x1f'),_0x1d7d('0x20')]}]},'log':'GetDynamics365Account'});};}; \ No newline at end of file +var _0xefe2=['../../client','getDynamics365Accounts','Request','GetDynamics365Account','username','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Dynamics365Configuration','Configurations','name','moduleCreate','additionalSearchContact','openNewTab','type','Variable','Dynamics365Field','Descriptions','content','key','keyType','keyContent','idField','nameField','variableName','data2','data5','data7'];(function(_0x1589f8,_0x14d0e3){var _0x2f89e1=function(_0x707386){while(--_0x707386){_0x1589f8['push'](_0x1589f8['shift']());}};_0x2f89e1(++_0x14d0e3);}(_0xefe2,0xd9));var _0x2efe=function(_0x21b831,_0x2de10a){_0x21b831=_0x21b831-0x0;var _0x31354f=_0xefe2[_0x21b831];return _0x31354f;};'use strict';var client=require(_0x2efe('0x0'));exports[_0x2efe('0x1')]=function(){return function(_0x521ca2){return client[_0x2efe('0x2')](_0x2efe('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2efe('0x4'),'password',_0x2efe('0x5'),_0x2efe('0x6'),_0x2efe('0x7'),_0x2efe('0x8'),_0x2efe('0x9'),'description',_0x2efe('0xa')],'include':[{'model':_0x2efe('0xb'),'as':_0x2efe('0xc'),'attributes':['id',_0x2efe('0xd'),'ticketType',_0x2efe('0xe'),_0x2efe('0xf'),_0x2efe('0x10')],'include':[{'model':'Dynamics365Field','as':'Subjects','attributes':['id',_0x2efe('0x11'),'content','variableName'],'include':[{'model':_0x2efe('0x12'),'as':_0x2efe('0x12'),'attributes':['id',_0x2efe('0xd')]}]},{'model':_0x2efe('0x13'),'as':_0x2efe('0x14'),'attributes':['id',_0x2efe('0x11'),_0x2efe('0x15'),_0x2efe('0x16'),_0x2efe('0x17'),_0x2efe('0x18'),'variableName'],'include':[{'model':'Variable','as':_0x2efe('0x12'),'attributes':['id',_0x2efe('0xd')]}]},{'model':'Dynamics365Field','as':'Fields','attributes':['id',_0x2efe('0x11'),'content',_0x2efe('0x19'),_0x2efe('0x1a'),'customField',_0x2efe('0x1b')],'include':[{'model':_0x2efe('0x12'),'as':'Variable','attributes':['id',_0x2efe('0xd')]}]}]},{'model':'CloudProvider','as':'CloudProvider','attributes':['id',_0x2efe('0x1c'),_0x2efe('0x1d'),_0x2efe('0x1e')]}]},'log':_0x2efe('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 9325acf..9db4b4a 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 _0x2bb0=['serverUrl','FreshdeskConfiguration','Configurations','name','Tag','FreshdeskField','type','content','variableName','Variable','Descriptions','key','keyType','idField','customField','../../client','getFreshdeskAccounts','GetFreshdeskAccount','apiKey'];(function(_0x190140,_0x3cd521){var _0x5de288=function(_0x42a9e7){while(--_0x42a9e7){_0x190140['push'](_0x190140['shift']());}};_0x5de288(++_0x3cd521);}(_0x2bb0,0xf3));var _0x02bb=function(_0x306cb2,_0x49693f){_0x306cb2=_0x306cb2-0x0;var _0x5b744e=_0x2bb0[_0x306cb2];return _0x5b744e;};'use strict';var client=require(_0x02bb('0x0'));exports[_0x02bb('0x1')]=function(){return function(_0x3cad3f){return client['Request'](_0x02bb('0x2'),{'options':{'raw':![],'attributes':['id','name','username',_0x02bb('0x3'),'remoteUri',_0x02bb('0x4')],'include':[{'model':_0x02bb('0x5'),'as':_0x02bb('0x6'),'attributes':['id',_0x02bb('0x7')],'include':[{'model':_0x02bb('0x8'),'attributes':['id',_0x02bb('0x7')]},{'model':_0x02bb('0x9'),'as':'Subjects','attributes':['id',_0x02bb('0xa'),_0x02bb('0xb'),_0x02bb('0xc')],'include':[{'model':'Variable','as':_0x02bb('0xd'),'attributes':['id','name']}]},{'model':_0x02bb('0x9'),'as':_0x02bb('0xe'),'attributes':['id','type',_0x02bb('0xb'),_0x02bb('0xf'),_0x02bb('0x10'),'keyContent',_0x02bb('0xc')],'include':[{'model':'Variable','as':_0x02bb('0xd'),'attributes':['id',_0x02bb('0x7')]}]},{'model':_0x02bb('0x9'),'as':'Fields','attributes':['id',_0x02bb('0xa'),_0x02bb('0xb'),_0x02bb('0x11'),'nameField',_0x02bb('0x12'),'variableName'],'include':[{'model':_0x02bb('0xd'),'as':_0x02bb('0xd'),'attributes':['id',_0x02bb('0x7')]}]}]}]},'log':_0x02bb('0x2')});};}; \ No newline at end of file +var _0x9bc3=['FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','Fields','customField','../../client','getFreshdeskAccounts','GetFreshdeskAccount','name','username','apiKey','serverUrl','FreshdeskConfiguration','Configurations'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0x9bc3,0x137));var _0x39bc=function(_0x4bbabf,_0x3e3454){_0x4bbabf=_0x4bbabf-0x0;var _0x159343=_0x9bc3[_0x4bbabf];return _0x159343;};'use strict';var client=require(_0x39bc('0x0'));exports[_0x39bc('0x1')]=function(){return function(_0x3a68f5){return client['Request'](_0x39bc('0x2'),{'options':{'raw':![],'attributes':['id',_0x39bc('0x3'),_0x39bc('0x4'),_0x39bc('0x5'),'remoteUri',_0x39bc('0x6')],'include':[{'model':_0x39bc('0x7'),'as':_0x39bc('0x8'),'attributes':['id',_0x39bc('0x3')],'include':[{'model':'Tag','attributes':['id',_0x39bc('0x3')]},{'model':_0x39bc('0x9'),'as':_0x39bc('0xa'),'attributes':['id',_0x39bc('0xb'),_0x39bc('0xc'),_0x39bc('0xd')],'include':[{'model':_0x39bc('0xe'),'as':_0x39bc('0xe'),'attributes':['id','name']}]},{'model':_0x39bc('0x9'),'as':_0x39bc('0xf'),'attributes':['id',_0x39bc('0xb'),_0x39bc('0xc'),_0x39bc('0x10'),_0x39bc('0x11'),'keyContent','variableName'],'include':[{'model':_0x39bc('0xe'),'as':_0x39bc('0xe'),'attributes':['id','name']}]},{'model':_0x39bc('0x9'),'as':_0x39bc('0x12'),'attributes':['id',_0x39bc('0xb'),'content','idField','nameField',_0x39bc('0x13'),'variableName'],'include':[{'model':'Variable','as':_0x39bc('0xe'),'attributes':['id',_0x39bc('0x3')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ 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 6515d01..c1d9506 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 _0x2d72=['GetFreshsalesAccount','name','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','type','content','Variable','key','keyType','keyContent','variableName','../../client','getFreshsalesAccounts','Request'];(function(_0x50093e,_0x50faf9){var _0x99d09f=function(_0x19cb0d){while(--_0x19cb0d){_0x50093e['push'](_0x50093e['shift']());}};_0x99d09f(++_0x50faf9);}(_0x2d72,0xa8));var _0x22d7=function(_0x2e62da,_0x2b1d64){_0x2e62da=_0x2e62da-0x0;var _0x23941e=_0x2d72[_0x2e62da];return _0x23941e;};'use strict';var client=require(_0x22d7('0x0'));exports[_0x22d7('0x1')]=function(){return function(_0x11448){return client[_0x22d7('0x2')](_0x22d7('0x3'),{'options':{'raw':![],'attributes':['id',_0x22d7('0x4'),_0x22d7('0x5'),_0x22d7('0x6'),_0x22d7('0x7'),_0x22d7('0x8')],'include':[{'model':_0x22d7('0x9'),'as':_0x22d7('0xa'),'attributes':['id',_0x22d7('0x4')],'include':[{'model':_0x22d7('0xb'),'as':'Subjects','attributes':['id',_0x22d7('0xc'),_0x22d7('0xd'),'variableName'],'include':[{'model':_0x22d7('0xe'),'as':_0x22d7('0xe'),'attributes':['id',_0x22d7('0x4')]}]},{'model':_0x22d7('0xb'),'as':'Descriptions','attributes':['id','type',_0x22d7('0xd'),_0x22d7('0xf'),_0x22d7('0x10'),_0x22d7('0x11'),_0x22d7('0x12')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x22d7('0x4')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0xbd0a=['Subjects','content','variableName','Variable','Descriptions','type','key','keyContent','GetFreshsalesccount','../../client','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','name','FreshsalesField'];(function(_0x244e21,_0x3298c6){var _0x34f9a0=function(_0x596c86){while(--_0x596c86){_0x244e21['push'](_0x244e21['shift']());}};_0x34f9a0(++_0x3298c6);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x73ce95,_0x40506e){_0x73ce95=_0x73ce95-0x0;var _0x2d3bdb=_0xbd0a[_0x73ce95];return _0x2d3bdb;};'use strict';var client=require(_0xabd0('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x3b0fc0){return client['Request']('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id','name',_0xabd0('0x1'),_0xabd0('0x2'),_0xabd0('0x3'),_0xabd0('0x4')],'include':[{'model':_0xabd0('0x5'),'as':_0xabd0('0x6'),'attributes':['id',_0xabd0('0x7')],'include':[{'model':_0xabd0('0x8'),'as':_0xabd0('0x9'),'attributes':['id','type',_0xabd0('0xa'),_0xabd0('0xb')],'include':[{'model':_0xabd0('0xc'),'as':'Variable','attributes':['id',_0xabd0('0x7')]}]},{'model':'FreshsalesField','as':_0xabd0('0xd'),'attributes':['id',_0xabd0('0xe'),_0xabd0('0xa'),_0xabd0('0xf'),'keyType',_0xabd0('0x10'),'variableName'],'include':[{'model':_0xabd0('0xc'),'as':_0xabd0('0xc'),'attributes':['id',_0xabd0('0x7')]}]}]}]},'log':_0xabd0('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 7af7af1..ee28f62 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 _0xbee0=['name','username','password','remoteUri','serverUrl','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','Fields','getSalesforceAccounts','Request','GetSalesforceAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbee0,0x147));var _0x0bee=function(_0x4b22fd,_0x529a06){_0x4b22fd=_0x4b22fd-0x0;var _0x371fb4=_0xbee0[_0x4b22fd];return _0x371fb4;};'use strict';var client=require('../../client');exports[_0x0bee('0x0')]=function(){return function(_0x258133){return client[_0x0bee('0x1')](_0x0bee('0x2'),{'options':{'raw':![],'attributes':['id',_0x0bee('0x3'),_0x0bee('0x4'),_0x0bee('0x5'),_0x0bee('0x6'),'clientId','clientSecret','securityToken',_0x0bee('0x7'),_0x0bee('0x8')],'include':[{'model':_0x0bee('0x9'),'as':_0x0bee('0xa'),'attributes':['id','name',_0x0bee('0xb'),_0x0bee('0xc'),_0x0bee('0xd'),_0x0bee('0xe'),'additionalSearchAccount',_0x0bee('0xf'),_0x0bee('0x10')],'include':[{'model':_0x0bee('0x11'),'as':_0x0bee('0x12'),'include':[{'model':_0x0bee('0x13'),'as':_0x0bee('0x13'),'attributes':['id',_0x0bee('0x3')]}]},{'model':'SalesforceField','as':_0x0bee('0x14'),'include':[{'model':'Variable','as':_0x0bee('0x13'),'attributes':['id',_0x0bee('0x3')]}]},{'model':_0x0bee('0x11'),'as':_0x0bee('0x15'),'include':[{'model':_0x0bee('0x13'),'as':_0x0bee('0x13'),'attributes':['id','name']}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file +var _0x48bc=['GetSalesforceAccount','name','username','password','remoteUri','clientId','clientSecret','serverUrl','SalesforceConfiguration','Configurations','moduleSearch','ticketType','leadId','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','Fields','../../client','getSalesforceAccounts'];(function(_0x2b082b,_0x3f64d2){var _0x4ceb4c=function(_0xc98350){while(--_0xc98350){_0x2b082b['push'](_0x2b082b['shift']());}};_0x4ceb4c(++_0x3f64d2);}(_0x48bc,0x1b6));var _0xc48b=function(_0x17e458,_0x2f5e63){_0x17e458=_0x17e458-0x0;var _0x2c5f02=_0x48bc[_0x17e458];return _0x2c5f02;};'use strict';var client=require(_0xc48b('0x0'));exports[_0xc48b('0x1')]=function(){return function(_0x11f046){return client['Request'](_0xc48b('0x2'),{'options':{'raw':![],'attributes':['id',_0xc48b('0x3'),_0xc48b('0x4'),_0xc48b('0x5'),_0xc48b('0x6'),_0xc48b('0x7'),_0xc48b('0x8'),'securityToken',_0xc48b('0x9'),'type'],'include':[{'model':_0xc48b('0xa'),'as':_0xc48b('0xb'),'attributes':['id','name',_0xc48b('0xc'),'moduleCreate',_0xc48b('0xd'),_0xc48b('0xe'),'additionalSearchAccount',_0xc48b('0xf'),_0xc48b('0x10')],'include':[{'model':_0xc48b('0x11'),'as':_0xc48b('0x12'),'include':[{'model':_0xc48b('0x13'),'as':_0xc48b('0x13'),'attributes':['id',_0xc48b('0x3')]}]},{'model':_0xc48b('0x11'),'as':_0xc48b('0x14'),'include':[{'model':_0xc48b('0x13'),'as':_0xc48b('0x13'),'attributes':['id',_0xc48b('0x3')]}]},{'model':'SalesforceField','as':_0xc48b('0x15'),'include':[{'model':_0xc48b('0x13'),'as':_0xc48b('0x13'),'attributes':['id','name']}]}]}]},'log':_0xc48b('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 47c2f1a..077b53c 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 _0x4975=['Descriptions','content','key','keyType','Fields','idField','nameField','customField','GetServicenowkAccount','../../client','Request','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','type','variableName','Variable'];(function(_0x328ff3,_0x361087){var _0x15c765=function(_0x5c4e3e){while(--_0x5c4e3e){_0x328ff3['push'](_0x328ff3['shift']());}};_0x15c765(++_0x361087);}(_0x4975,0x86));var _0x5497=function(_0x1ce895,_0x737de0){_0x1ce895=_0x1ce895-0x0;var _0x12ef0c=_0x4975[_0x1ce895];return _0x12ef0c;};'use strict';var client=require(_0x5497('0x0'));exports['getServicenowAccounts']=function(){return function(_0x474989){return client[_0x5497('0x1')](_0x5497('0x2'),{'options':{'raw':![],'attributes':['id',_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9')],'include':[{'model':'ServicenowConfiguration','as':_0x5497('0xa'),'attributes':['id','name'],'include':[{'model':_0x5497('0xb'),'as':_0x5497('0xc'),'attributes':['id',_0x5497('0xd'),'content',_0x5497('0xe')],'include':[{'model':'Variable','as':_0x5497('0xf'),'attributes':['id',_0x5497('0x3')]}]},{'model':_0x5497('0xb'),'as':_0x5497('0x10'),'attributes':['id',_0x5497('0xd'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),'keyContent','variableName'],'include':[{'model':'Variable','as':_0x5497('0xf'),'attributes':['id',_0x5497('0x3')]}]},{'model':_0x5497('0xb'),'as':_0x5497('0x14'),'attributes':['id',_0x5497('0xd'),_0x5497('0x11'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),_0x5497('0xe')],'include':[{'model':'Variable','as':_0x5497('0xf'),'attributes':['id','name']}]}]}]},'log':_0x5497('0x18')});};}; \ No newline at end of file +var _0x31f0=['remoteUri','Subjects','type','content','variableName','Variable','ServicenowField','Descriptions','key','keyType','Fields','idField','nameField','customField','GetServicenowkAccount','../../client','GetServicenowAccount','name','description','username','email'];(function(_0x2092d7,_0x13840a){var _0x5a67ba=function(_0x1db31d){while(--_0x1db31d){_0x2092d7['push'](_0x2092d7['shift']());}};_0x5a67ba(++_0x13840a);}(_0x31f0,0xb7));var _0x031f=function(_0x1d4269,_0x5cb030){_0x1d4269=_0x1d4269-0x0;var _0x342d45=_0x31f0[_0x1d4269];return _0x342d45;};'use strict';var client=require(_0x031f('0x0'));exports['getServicenowAccounts']=function(){return function(_0xc4ca54){return client['Request'](_0x031f('0x1'),{'options':{'raw':![],'attributes':['id',_0x031f('0x2'),_0x031f('0x3'),_0x031f('0x4'),'password',_0x031f('0x5'),_0x031f('0x6'),'serverUrl'],'include':[{'model':'ServicenowConfiguration','as':'Configurations','attributes':['id',_0x031f('0x2')],'include':[{'model':'ServicenowField','as':_0x031f('0x7'),'attributes':['id',_0x031f('0x8'),_0x031f('0x9'),_0x031f('0xa')],'include':[{'model':'Variable','as':_0x031f('0xb'),'attributes':['id',_0x031f('0x2')]}]},{'model':_0x031f('0xc'),'as':_0x031f('0xd'),'attributes':['id',_0x031f('0x8'),_0x031f('0x9'),_0x031f('0xe'),_0x031f('0xf'),'keyContent',_0x031f('0xa')],'include':[{'model':_0x031f('0xb'),'as':_0x031f('0xb'),'attributes':['id',_0x031f('0x2')]}]},{'model':_0x031f('0xc'),'as':_0x031f('0x10'),'attributes':['id',_0x031f('0x8'),'content',_0x031f('0x11'),_0x031f('0x12'),_0x031f('0x13'),_0x031f('0xa')],'include':[{'model':_0x031f('0xb'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0x031f('0x14')});};}; \ 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 56d152a..83a094e 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 _0x7a54=['nameField','customField','../../client','getSugarcrmAccounts','GetSugarcrmAccount','name','password','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','type','content','Variable','Descriptions','key','variableName','Fields','idField'];(function(_0x3e05e1,_0x535808){var _0x3741bd=function(_0x5d36d6){while(--_0x5d36d6){_0x3e05e1['push'](_0x3e05e1['shift']());}};_0x3741bd(++_0x535808);}(_0x7a54,0x106));var _0x47a5=function(_0x466b73,_0x2fda11){_0x466b73=_0x466b73-0x0;var _0x32cc2e=_0x7a54[_0x466b73];return _0x32cc2e;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(_0x44b31e){return client['Request'](_0x47a5('0x2'),{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),'username',_0x47a5('0x4'),_0x47a5('0x5'),_0x47a5('0x6')],'include':[{'model':_0x47a5('0x7'),'as':_0x47a5('0x8'),'attributes':['id','name'],'include':[{'model':_0x47a5('0x9'),'as':'Subjects','attributes':['id',_0x47a5('0xa'),_0x47a5('0xb'),'variableName'],'include':[{'model':_0x47a5('0xc'),'as':'Variable','attributes':['id','name']}]},{'model':'SugarcrmField','as':_0x47a5('0xd'),'attributes':['id',_0x47a5('0xa'),'content',_0x47a5('0xe'),'keyType','keyContent',_0x47a5('0xf')],'include':[{'model':_0x47a5('0xc'),'as':_0x47a5('0xc'),'attributes':['id',_0x47a5('0x3')]}]},{'model':_0x47a5('0x9'),'as':_0x47a5('0x10'),'attributes':['id',_0x47a5('0xa'),'content',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0xf')],'include':[{'model':_0x47a5('0xc'),'as':_0x47a5('0xc'),'attributes':['id',_0x47a5('0x3')]}]}]}]},'log':_0x47a5('0x2')});};}; \ No newline at end of file +var _0x2032=['GetSugarcrmAccount','getSugarcrmAccounts','Request','name','username','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','key','keyContent','customField'];(function(_0x26c15d,_0xdeb587){var _0x237b0d=function(_0x2442f8){while(--_0x2442f8){_0x26c15d['push'](_0x26c15d['shift']());}};_0x237b0d(++_0xdeb587);}(_0x2032,0xd9));var _0x2203=function(_0x1c2ceb,_0x2b27eb){_0x1c2ceb=_0x1c2ceb-0x0;var _0x179b92=_0x2032[_0x1c2ceb];return _0x179b92;};'use strict';var client=require('../../client');exports[_0x2203('0x0')]=function(){return function(_0x1e103d){return client[_0x2203('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id',_0x2203('0x2'),_0x2203('0x3'),'password',_0x2203('0x4'),_0x2203('0x5')],'include':[{'model':_0x2203('0x6'),'as':_0x2203('0x7'),'attributes':['id',_0x2203('0x2')],'include':[{'model':_0x2203('0x8'),'as':_0x2203('0x9'),'attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc')],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id','name']}]},{'model':_0x2203('0x8'),'as':'Descriptions','attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xe'),'keyType',_0x2203('0xf'),'variableName'],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id',_0x2203('0x2')]}]},{'model':_0x2203('0x8'),'as':'Fields','attributes':['id','type','content','idField','nameField',_0x2203('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x2203('0xd'),'attributes':['id',_0x2203('0x2')]}]}]}]},'log':_0x2203('0x11')});};}; \ 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 a14c526..aee2e04 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 _0xae04=['GetVtigerAccount','name','description','remoteUri','VtigerConfiguration','Configurations','Subjects','type','Variable','VtigerField','Descriptions','keyContent','variableName','Fields','content','idField','nameField','../../client','getVtigerAccounts','Request'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xae04,0x151));var _0x4ae0=function(_0x58c50e,_0x573495){_0x58c50e=_0x58c50e-0x0;var _0x4a8199=_0xae04[_0x58c50e];return _0x4a8199;};'use strict';var client=require(_0x4ae0('0x0'));exports[_0x4ae0('0x1')]=function(){return function(_0xbab8cb){return client[_0x4ae0('0x2')](_0x4ae0('0x3'),{'options':{'raw':![],'attributes':['id',_0x4ae0('0x4'),_0x4ae0('0x5'),'username','accessKey',_0x4ae0('0x6'),'serverUrl'],'include':[{'model':_0x4ae0('0x7'),'as':_0x4ae0('0x8'),'attributes':['id',_0x4ae0('0x4')],'include':[{'model':'VtigerField','as':_0x4ae0('0x9'),'attributes':['id',_0x4ae0('0xa'),'content','variableName'],'include':[{'model':_0x4ae0('0xb'),'as':_0x4ae0('0xb'),'attributes':['id',_0x4ae0('0x4')]}]},{'model':_0x4ae0('0xc'),'as':_0x4ae0('0xd'),'attributes':['id',_0x4ae0('0xa'),'content','key','keyType',_0x4ae0('0xe'),_0x4ae0('0xf')],'include':[{'model':_0x4ae0('0xb'),'as':'Variable','attributes':['id','name']}]},{'model':_0x4ae0('0xc'),'as':_0x4ae0('0x10'),'attributes':['id',_0x4ae0('0xa'),_0x4ae0('0x11'),_0x4ae0('0x12'),_0x4ae0('0x13'),'customField',_0x4ae0('0xf')],'include':[{'model':_0x4ae0('0xb'),'as':_0x4ae0('0xb'),'attributes':['id',_0x4ae0('0x4')]}]}]}]},'log':_0x4ae0('0x3')});};}; \ No newline at end of file +var _0xc2c7=['keyContent','idField','nameField','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey','serverUrl','VtigerConfiguration','VtigerField','content','variableName','Variable','Descriptions','type','key','keyType'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0xc2c7,0x72));var _0x7c2c=function(_0x4bcdfb,_0x4bfa8e){_0x4bcdfb=_0x4bcdfb-0x0;var _0x403181=_0xc2c7[_0x4bcdfb];return _0x403181;};'use strict';var client=require(_0x7c2c('0x0'));exports[_0x7c2c('0x1')]=function(){return function(_0x6aac1c){return client[_0x7c2c('0x2')](_0x7c2c('0x3'),{'options':{'raw':![],'attributes':['id',_0x7c2c('0x4'),_0x7c2c('0x5'),_0x7c2c('0x6'),_0x7c2c('0x7'),'remoteUri',_0x7c2c('0x8')],'include':[{'model':_0x7c2c('0x9'),'as':'Configurations','attributes':['id',_0x7c2c('0x4')],'include':[{'model':_0x7c2c('0xa'),'as':'Subjects','attributes':['id','type',_0x7c2c('0xb'),_0x7c2c('0xc')],'include':[{'model':_0x7c2c('0xd'),'as':_0x7c2c('0xd'),'attributes':['id',_0x7c2c('0x4')]}]},{'model':'VtigerField','as':_0x7c2c('0xe'),'attributes':['id',_0x7c2c('0xf'),_0x7c2c('0xb'),_0x7c2c('0x10'),_0x7c2c('0x11'),_0x7c2c('0x12'),'variableName'],'include':[{'model':_0x7c2c('0xd'),'as':_0x7c2c('0xd'),'attributes':['id',_0x7c2c('0x4')]}]},{'model':_0x7c2c('0xa'),'as':'Fields','attributes':['id',_0x7c2c('0xf'),_0x7c2c('0xb'),_0x7c2c('0x13'),_0x7c2c('0x14'),_0x7c2c('0x15'),'variableName'],'include':[{'model':_0x7c2c('0xd'),'as':'Variable','attributes':['id',_0x7c2c('0x4')]}]}]}]},'log':_0x7c2c('0x3')});};}; \ 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 064af9b..c1fc03b 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 _0x8ebe=['username','password','token','remoteUri','serverUrl','type','Configurations','Tag','ZendeskField','variableName','Variable','Descriptions','content','key','keyType','keyContent','Fields','idField','nameField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name'];(function(_0x387784,_0x371269){var _0x4d8ac9=function(_0x409860){while(--_0x409860){_0x387784['push'](_0x387784['shift']());}};_0x4d8ac9(++_0x371269);}(_0x8ebe,0x103));var _0xe8eb=function(_0x55257d,_0x3998ec){_0x55257d=_0x55257d-0x0;var _0x4d296d=_0x8ebe[_0x55257d];return _0x4d296d;};'use strict';var client=require(_0xe8eb('0x0'));exports[_0xe8eb('0x1')]=function(){return function(_0x4f37f4){return client[_0xe8eb('0x2')](_0xe8eb('0x3'),{'options':{'raw':![],'attributes':['id',_0xe8eb('0x4'),_0xe8eb('0x5'),_0xe8eb('0x6'),_0xe8eb('0x7'),_0xe8eb('0x8'),'authType',_0xe8eb('0x9'),_0xe8eb('0xa')],'include':[{'model':'ZendeskConfiguration','as':_0xe8eb('0xb'),'attributes':['id',_0xe8eb('0x4')],'include':[{'model':_0xe8eb('0xc'),'attributes':['id','name']},{'model':_0xe8eb('0xd'),'as':'Subjects','attributes':['id','type','content',_0xe8eb('0xe')],'include':[{'model':_0xe8eb('0xf'),'as':_0xe8eb('0xf'),'attributes':['id',_0xe8eb('0x4')]}]},{'model':_0xe8eb('0xd'),'as':_0xe8eb('0x10'),'attributes':['id',_0xe8eb('0xa'),_0xe8eb('0x11'),_0xe8eb('0x12'),_0xe8eb('0x13'),_0xe8eb('0x14'),_0xe8eb('0xe')],'include':[{'model':'Variable','as':_0xe8eb('0xf'),'attributes':['id',_0xe8eb('0x4')]}]},{'model':_0xe8eb('0xd'),'as':_0xe8eb('0x15'),'attributes':['id',_0xe8eb('0xa'),_0xe8eb('0x11'),_0xe8eb('0x16'),_0xe8eb('0x17'),'customField',_0xe8eb('0xe')],'include':[{'model':_0xe8eb('0xf'),'as':_0xe8eb('0xf'),'attributes':['id','name']}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file +var _0xcdf9=['Descriptions','key','keyType','idField','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','password','token','serverUrl','type','ZendeskConfiguration','Tag','ZendeskField','Subjects','content','variableName','Variable'];(function(_0xb9e378,_0x2ba0ef){var _0x43b381=function(_0x3a466b){while(--_0x3a466b){_0xb9e378['push'](_0xb9e378['shift']());}};_0x43b381(++_0x2ba0ef);}(_0xcdf9,0x1be));var _0x9cdf=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xcdf9[_0x4e1d03];return _0x362d4b;};'use strict';var client=require(_0x9cdf('0x0'));exports[_0x9cdf('0x1')]=function(){return function(_0x4c1e19){return client[_0x9cdf('0x2')](_0x9cdf('0x3'),{'options':{'raw':![],'attributes':['id',_0x9cdf('0x4'),'username',_0x9cdf('0x5'),_0x9cdf('0x6'),'remoteUri','authType',_0x9cdf('0x7'),_0x9cdf('0x8')],'include':[{'model':_0x9cdf('0x9'),'as':'Configurations','attributes':['id',_0x9cdf('0x4')],'include':[{'model':_0x9cdf('0xa'),'attributes':['id',_0x9cdf('0x4')]},{'model':_0x9cdf('0xb'),'as':_0x9cdf('0xc'),'attributes':['id',_0x9cdf('0x8'),_0x9cdf('0xd'),_0x9cdf('0xe')],'include':[{'model':'Variable','as':_0x9cdf('0xf'),'attributes':['id',_0x9cdf('0x4')]}]},{'model':_0x9cdf('0xb'),'as':_0x9cdf('0x10'),'attributes':['id','type',_0x9cdf('0xd'),_0x9cdf('0x11'),_0x9cdf('0x12'),'keyContent',_0x9cdf('0xe')],'include':[{'model':_0x9cdf('0xf'),'as':'Variable','attributes':['id',_0x9cdf('0x4')]}]},{'model':_0x9cdf('0xb'),'as':'Fields','attributes':['id',_0x9cdf('0x8'),_0x9cdf('0xd'),_0x9cdf('0x13'),_0x9cdf('0x14'),_0x9cdf('0x15'),_0x9cdf('0xe')],'include':[{'model':_0x9cdf('0xf'),'as':'Variable','attributes':['id',_0x9cdf('0x4')]}]}]}]},'log':_0x9cdf('0x3')});};}; \ 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 b7f6ace..ab4a2f9 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 _0xa0d6=['Configurations','moduleSearch','ZohoField','Subjects','type','content','Variable','Descriptions','keyType','variableName','Fields','idField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','name','description','zone','code','refreshToken','ZohoConfiguration'];(function(_0x304bd5,_0xea943d){var _0x2bcd87=function(_0x53d3c5){while(--_0x53d3c5){_0x304bd5['push'](_0x304bd5['shift']());}};_0x2bcd87(++_0xea943d);}(_0xa0d6,0x1d9));var _0x6a0d=function(_0x1a11c2,_0x485a96){_0x1a11c2=_0x1a11c2-0x0;var _0x266cdf=_0xa0d6[_0x1a11c2];return _0x266cdf;};'use strict';var client=require(_0x6a0d('0x0'));exports[_0x6a0d('0x1')]=function(){return function(_0x10c206){return client[_0x6a0d('0x2')](_0x6a0d('0x3'),{'options':{'raw':![],'attributes':['id',_0x6a0d('0x4'),_0x6a0d('0x5'),'host',_0x6a0d('0x6'),'clientId','clientSecret','serverUrl',_0x6a0d('0x7'),_0x6a0d('0x8')],'include':[{'model':_0x6a0d('0x9'),'as':_0x6a0d('0xa'),'attributes':['id',_0x6a0d('0x4'),'moduleCreate',_0x6a0d('0xb'),'description'],'include':[{'model':_0x6a0d('0xc'),'as':_0x6a0d('0xd'),'attributes':['id',_0x6a0d('0xe'),_0x6a0d('0xf'),'variableName'],'include':[{'model':_0x6a0d('0x10'),'as':_0x6a0d('0x10'),'attributes':['id','name']}]},{'model':_0x6a0d('0xc'),'as':_0x6a0d('0x11'),'attributes':['id','type',_0x6a0d('0xf'),'key',_0x6a0d('0x12'),'keyContent',_0x6a0d('0x13')],'include':[{'model':_0x6a0d('0x10'),'as':_0x6a0d('0x10'),'attributes':['id',_0x6a0d('0x4')]}]},{'model':_0x6a0d('0xc'),'as':_0x6a0d('0x14'),'attributes':['id',_0x6a0d('0xe'),_0x6a0d('0xf'),_0x6a0d('0x15'),'nameField',_0x6a0d('0x16'),'variableName'],'include':[{'model':'Variable','as':_0x6a0d('0x10'),'attributes':['id','name']}]}]}]},'log':_0x6a0d('0x3')});};}; \ No newline at end of file +var _0x08b9=['Configurations','moduleCreate','moduleSearch','Subjects','type','Variable','ZohoField','content','key','keyType','keyContent','variableName','Fields','idField','nameField','customField','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientId','clientSecret','code','refreshToken','ZohoConfiguration'];(function(_0x4655e0,_0x59e0d6){var _0x46e632=function(_0x58b770){while(--_0x58b770){_0x4655e0['push'](_0x4655e0['shift']());}};_0x46e632(++_0x59e0d6);}(_0x08b9,0x160));var _0x908b=function(_0x436641,_0x4afca2){_0x436641=_0x436641-0x0;var _0x29e38f=_0x08b9[_0x436641];return _0x29e38f;};'use strict';var client=require('../../client');exports[_0x908b('0x0')]=function(){return function(_0x390414){return client[_0x908b('0x1')](_0x908b('0x2'),{'options':{'raw':![],'attributes':['id',_0x908b('0x3'),_0x908b('0x4'),_0x908b('0x5'),_0x908b('0x6'),_0x908b('0x7'),_0x908b('0x8'),'serverUrl',_0x908b('0x9'),_0x908b('0xa')],'include':[{'model':_0x908b('0xb'),'as':_0x908b('0xc'),'attributes':['id',_0x908b('0x3'),_0x908b('0xd'),_0x908b('0xe'),_0x908b('0x4')],'include':[{'model':'ZohoField','as':_0x908b('0xf'),'attributes':['id',_0x908b('0x10'),'content','variableName'],'include':[{'model':_0x908b('0x11'),'as':_0x908b('0x11'),'attributes':['id','name']}]},{'model':_0x908b('0x12'),'as':'Descriptions','attributes':['id',_0x908b('0x10'),_0x908b('0x13'),_0x908b('0x14'),_0x908b('0x15'),_0x908b('0x16'),_0x908b('0x17')],'include':[{'model':'Variable','as':_0x908b('0x11'),'attributes':['id',_0x908b('0x3')]}]},{'model':_0x908b('0x12'),'as':_0x908b('0x18'),'attributes':['id','type',_0x908b('0x13'),_0x908b('0x19'),_0x908b('0x1a'),_0x908b('0x1b'),_0x908b('0x17')],'include':[{'model':_0x908b('0x11'),'as':_0x908b('0x11'),'attributes':['id',_0x908b('0x3')]}]}]}]},'log':_0x908b('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 6724a34..c362ec6 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 _0xbce8=['IntervalIftime','intervalIftime','../../../config/logger','../client','stack','replace','intervalIftime\x20called\x20with','isArray','length','resolve','every','number','string','map','interval','concat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbce8,0x192));var _0x8bce=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xbce8[_0x38eb23];return _0x48506a;};var logger=require(_0x8bce('0x0'))('dialer');var client=require(_0x8bce('0x1'));function intervalIftime(_0x44f71d,_0x1c67ec){const _0x189b76=new Error()[_0x8bce('0x2')][_0x8bce('0x3')](/^Error/,'')['trim']();logger['silly'](_0x8bce('0x4'),_0x44f71d,_0x1c67ec,_0x189b76);const _0x37f0e3=Array[_0x8bce('0x5')](_0x44f71d);if(!_0x44f71d||_0x37f0e3&&_0x44f71d[_0x8bce('0x6')]===0x0){return Promise[_0x8bce('0x7')](![]);}else{var _0x126126=[];var _0x296ac9=[];var _0x3d976c=_0x37f0e3?_0x44f71d:[_0x44f71d];var _0x1aa380=_0x3d976c[_0x8bce('0x8')](function(_0x564a5d){return typeof _0x564a5d===_0x8bce('0x9');});var _0x54efbe=_0x3d976c[_0x8bce('0x8')](function(_0x18e1af){return typeof _0x18e1af===_0x8bce('0xa');});if(!_0x1aa380&&!_0x54efbe){_0x126126=_0x3d976c[_0x8bce('0xb')](function(_0x48c03d){return _0x48c03d['id'];});if(_0x126126[_0x8bce('0x6')]===0x0){_0x296ac9=_0x3d976c[_0x8bce('0xb')](function(_0x22f2e7){return _0x22f2e7[_0x8bce('0xc')];});}}else{if(_0x1aa380){_0x126126=_0x126126[_0x8bce('0xd')](_0x3d976c);}if(_0x54efbe){_0x296ac9=_0x296ac9[_0x8bce('0xd')](_0x3d976c);}}return client['Request']('IntervalIftime',{'intervalIds':_0x126126,'intervals':_0x296ac9,'timezone':_0x1c67ec,'log':_0x8bce('0xe')});}}exports[_0x8bce('0xf')]=intervalIftime; \ No newline at end of file +var _0x023b=['isArray','resolve','every','number','string','length','map','interval','concat','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','replace','trim','silly','intervalIftime\x20called\x20with'];(function(_0xb459b4,_0xf36423){var _0x51921a=function(_0x489db7){while(--_0x489db7){_0xb459b4['push'](_0xb459b4['shift']());}};_0x51921a(++_0xf36423);}(_0x023b,0xad));var _0xb023=function(_0x445941,_0xc5de89){_0x445941=_0x445941-0x0;var _0x3497f1=_0x023b[_0x445941];return _0x3497f1;};var logger=require(_0xb023('0x0'))(_0xb023('0x1'));var client=require(_0xb023('0x2'));function intervalIftime(_0x51d840,_0x7cc4bf){const _0x4df559=new Error()['stack'][_0xb023('0x3')](/^Error/,'')[_0xb023('0x4')]();logger[_0xb023('0x5')](_0xb023('0x6'),_0x51d840,_0x7cc4bf,_0x4df559);const _0x3351a6=Array[_0xb023('0x7')](_0x51d840);if(!_0x51d840||_0x3351a6&&_0x51d840['length']===0x0){return Promise[_0xb023('0x8')](![]);}else{var _0x48fac4=[];var _0x1e9749=[];var _0x47f4e3=_0x3351a6?_0x51d840:[_0x51d840];var _0x3dc99c=_0x47f4e3[_0xb023('0x9')](function(_0x343be6){return typeof _0x343be6===_0xb023('0xa');});var _0x4d58ed=_0x47f4e3[_0xb023('0x9')](function(_0x3e4c6a){return typeof _0x3e4c6a===_0xb023('0xb');});if(!_0x3dc99c&&!_0x4d58ed){_0x48fac4=_0x47f4e3['map'](function(_0x4e7226){return _0x4e7226['id'];});if(_0x48fac4[_0xb023('0xc')]===0x0){_0x1e9749=_0x47f4e3[_0xb023('0xd')](function(_0x4e0f7d){return _0x4e0f7d[_0xb023('0xe')];});}}else{if(_0x3dc99c){_0x48fac4=_0x48fac4[_0xb023('0xf')](_0x47f4e3);}if(_0x4d58ed){_0x1e9749=_0x1e9749[_0xb023('0xf')](_0x47f4e3);}}return client['Request'](_0xb023('0x10'),{'intervalIds':_0x48fac4,'intervals':_0x1e9749,'timezone':_0x7cc4bf,'log':_0xb023('0x10')});}}exports[_0xb023('0x11')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 532d609..67579db 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 _0x514e=['seconds','inbound','exten','agent','toNumber','accountcode','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','moment','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','interface','format','SIP/%s','lastAssignedTo','diff'];(function(_0x59307b,_0x34ed0e){var _0x5d722d=function(_0x392642){while(--_0x392642){_0x59307b['push'](_0x59307b['shift']());}};_0x5d722d(++_0x34ed0e);}(_0x514e,0x106));var _0xe514=function(_0x527266,_0x4ed87c){_0x527266=_0x527266-0x0;var _0x47ca88=_0x514e[_0x527266];return _0x47ca88;};'use strict';var moment=require(_0xe514('0x0'));var _=require('lodash');var util=require(_0xe514('0x1'));var client=require(_0xe514('0x2'));exports[_0xe514('0x3')]=function(_0x38a4a2){var _0x2b30bd=_0x38a4a2[_0xe514('0x4')]||_0x38a4a2['queuecallerexitAt'];return client[_0xe514('0x5')](_0xe514('0x6'),{'body':{'channel':_0xe514('0x7'),'membername':_0x38a4a2['lastAssignedTo'],'interface':_['isNil'](_0x38a4a2[_0xe514('0x8')])?util[_0xe514('0x9')](_0xe514('0xa'),_0x38a4a2[_0xe514('0xb')]):_0x38a4a2[_0xe514('0x8')],'type':'TALKING','enterAt':_0x38a4a2['queuecallerleaveAt'],'exitAt':_0x2b30bd,'duration':moment(_0x2b30bd)[_0xe514('0xc')](_0x38a4a2['queuecallerleaveAt'],_0xe514('0xd')),'data1':_0xe514('0xe'),'data2':_0x38a4a2['calleridnum'],'data3':_0x38a4a2[_0xe514('0xf')],'data4':null,'data5':_0x38a4a2['queue'],'role':_0xe514('0x10'),'internal':_0x38a4a2['accountcode']?_[_0xe514('0x11')](_0x38a4a2[_0xe514('0x12')]):undefined,'uniqueid':_0x38a4a2[_0xe514('0x13')]},'log':_0xe514('0x6')});};exports[_0xe514('0x14')]=function(_0x15c8b0){return client[_0xe514('0x5')](_0xe514('0x6'),{'body':{'channel':_0xe514('0x7'),'membername':_0x15c8b0[_0xe514('0x15')],'interface':_0x15c8b0[_0xe514('0x8')],'type':_0xe514('0x16'),'enterAt':_0x15c8b0[_0xe514('0x17')],'exitAt':_0x15c8b0[_0xe514('0x18')],'duration':moment(_0x15c8b0[_0xe514('0x18')])['diff'](_0x15c8b0[_0xe514('0x17')],_0xe514('0xd'))>=0x0?moment(_0x15c8b0[_0xe514('0x18')])[_0xe514('0xc')](_0x15c8b0[_0xe514('0x17')],_0xe514('0xd')):null,'data1':'outbound','data2':_0x15c8b0[_0xe514('0x12')],'data3':_0x15c8b0[_0xe514('0xf')],'data4':_0x15c8b0['dialstring']||null,'role':_0xe514('0x10'),'internal':_0x15c8b0[_0xe514('0x12')]?_['toNumber'](_0x15c8b0[_0xe514('0x12')]):undefined,'uniqueid':_0x15c8b0[_0xe514('0x13')]},'log':_0xe514('0x6')});}; \ No newline at end of file +var _0x1753=['uniqueid','CreateMemberReport','membername','endtime','starttime','outbound','dialstring','toNumber','moment','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','voice','isNil','interface','format','lastAssignedTo','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','agent','accountcode'];(function(_0x150e62,_0x1b584d){var _0xa25c4b=function(_0x106f2a){while(--_0x106f2a){_0x150e62['push'](_0x150e62['shift']());}};_0xa25c4b(++_0x1b584d);}(_0x1753,0xa4));var _0x3175=function(_0xfc357e,_0x21f04f){_0xfc357e=_0xfc357e-0x0;var _0x4e0cd7=_0x1753[_0xfc357e];return _0x4e0cd7;};'use strict';var moment=require(_0x3175('0x0'));var _=require('lodash');var util=require(_0x3175('0x1'));var client=require('../client');exports[_0x3175('0x2')]=function(_0x10ce63){var _0x2967f1=_0x10ce63[_0x3175('0x3')]||_0x10ce63[_0x3175('0x4')];return client['Request']('CreateMemberReport',{'body':{'channel':_0x3175('0x5'),'membername':_0x10ce63['lastAssignedTo'],'interface':_[_0x3175('0x6')](_0x10ce63[_0x3175('0x7')])?util[_0x3175('0x8')]('SIP/%s',_0x10ce63[_0x3175('0x9')]):_0x10ce63[_0x3175('0x7')],'type':_0x3175('0xa'),'enterAt':_0x10ce63['queuecallerleaveAt'],'exitAt':_0x2967f1,'duration':moment(_0x2967f1)['diff'](_0x10ce63[_0x3175('0xb')],_0x3175('0xc')),'data1':_0x3175('0xd'),'data2':_0x10ce63[_0x3175('0xe')],'data3':_0x10ce63[_0x3175('0xf')],'data4':null,'data5':_0x10ce63['queue'],'role':_0x3175('0x10'),'internal':_0x10ce63[_0x3175('0x11')]?_['toNumber'](_0x10ce63['accountcode']):undefined,'uniqueid':_0x10ce63[_0x3175('0x12')]},'log':_0x3175('0x13')});};exports['voiceDialReport']=function(_0x573e28){return client['Request']('CreateMemberReport',{'body':{'channel':_0x3175('0x5'),'membername':_0x573e28[_0x3175('0x14')],'interface':_0x573e28['interface'],'type':'TALKING','enterAt':_0x573e28['starttime'],'exitAt':_0x573e28[_0x3175('0x15')],'duration':moment(_0x573e28[_0x3175('0x15')])['diff'](_0x573e28[_0x3175('0x16')],_0x3175('0xc'))>=0x0?moment(_0x573e28[_0x3175('0x15')])['diff'](_0x573e28['starttime'],'seconds'):null,'data1':_0x3175('0x17'),'data2':_0x573e28[_0x3175('0x11')],'data3':_0x573e28['exten'],'data4':_0x573e28[_0x3175('0x18')]||null,'role':'agent','internal':_0x573e28[_0x3175('0x11')]?_[_0x3175('0x19')](_0x573e28[_0x3175('0x11')]):undefined,'uniqueid':_0x573e28['uniqueid']},'log':_0x3175('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 7a1cccc..7b7dc08 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 _0xade9=['GetSettings','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x25d849,_0x5e9271){var _0x2e6886=function(_0x642ae9){while(--_0x642ae9){_0x25d849['push'](_0x25d849['shift']());}};_0x2e6886(++_0x5e9271);}(_0xade9,0x1e7));var _0x9ade=function(_0x4d3924,_0x327b56){_0x4d3924=_0x4d3924-0x0;var _0x844555=_0xade9[_0x4d3924];return _0x844555;};'use strict';var client=require('../client');exports[_0x9ade('0x0')]=function(){return client[_0x9ade('0x1')](_0x9ade('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9ade('0x3'),_0x9ade('0x4')]},'log':_0x9ade('0x5')});}; \ No newline at end of file +var _0x1f3c=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x1aea8c,_0x4bf3f3){var _0x4fb9bb=function(_0x53bc83){while(--_0x53bc83){_0x1aea8c['push'](_0x1aea8c['shift']());}};_0x4fb9bb(++_0x4bf3f3);}(_0x1f3c,0xd7));var _0xc1f3=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x1f3c[_0x5f0089];return _0x193892;};'use strict';var client=require(_0xc1f3('0x0'));exports[_0xc1f3('0x1')]=function(){return client[_0xc1f3('0x2')](_0xc1f3('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc1f3('0x4'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9e1ee05..6aa1e03 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 _0x8bf1=['html','../client','Request','GetTemplate','name'];(function(_0x5bf86f,_0x318ec1){var _0x53069c=function(_0x57b268){while(--_0x57b268){_0x5bf86f['push'](_0x5bf86f['shift']());}};_0x53069c(++_0x318ec1);}(_0x8bf1,0x65));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x18bf('0x0'));exports['getTemplates']=function(_0x3d7fa8){return function(_0x1d04b3){return client[_0x18bf('0x1')](_0x18bf('0x2'),{'options':{'raw':!![],'attributes':['id',_0x18bf('0x3'),_0x18bf('0x4')]},'log':_0x18bf('0x2')});};}; \ No newline at end of file +var _0x2d94=['name','html','Request','GetTemplate'];(function(_0x85d7a5,_0x106bb8){var _0x2c066d=function(_0x59c4f9){while(--_0x59c4f9){_0x85d7a5['push'](_0x85d7a5['shift']());}};_0x2c066d(++_0x106bb8);}(_0x2d94,0x86));var _0x42d9=function(_0x57fe11,_0x1878f7){_0x57fe11=_0x57fe11-0x0;var _0xef425a=_0x2d94[_0x57fe11];return _0xef425a;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x237fa2){return function(_0xe875ba){return client[_0x42d9('0x0')](_0x42d9('0x1'),{'options':{'raw':!![],'attributes':['id',_0x42d9('0x2'),_0x42d9('0x3')]},'log':_0x42d9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b66cc81..22f4b7f 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 _0x0c38=['Request','GetTrigger','channel','status','AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions','action','data1','data2','data4','data5','data6','../client','getTriggers'];(function(_0x2e0ab6,_0x414625){var _0x123553=function(_0x4bddfb){while(--_0x4bddfb){_0x2e0ab6['push'](_0x2e0ab6['shift']());}};_0x123553(++_0x414625);}(_0x0c38,0x1ca));var _0x80c3=function(_0x25dc22,_0x2df570){_0x25dc22=_0x25dc22-0x0;var _0x27c746=_0x0c38[_0x25dc22];return _0x27c746;};'use strict';var client=require(_0x80c3('0x0'));exports[_0x80c3('0x1')]=function(_0x2b9fcd){return function(_0x53e3f8){return client[_0x80c3('0x2')](_0x80c3('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x80c3('0x4'),_0x80c3('0x5')],'include':[{'model':'Condition','as':_0x80c3('0x6'),'attributes':['id',_0x80c3('0x7'),_0x80c3('0x8'),_0x80c3('0x9')]},{'model':_0x80c3('0xa'),'as':_0x80c3('0xb'),'attributes':['id',_0x80c3('0x7'),_0x80c3('0x8'),_0x80c3('0x9')]},{'model':_0x80c3('0xc'),'as':_0x80c3('0xd'),'attributes':['id',_0x80c3('0xe'),_0x80c3('0xf'),_0x80c3('0x10'),'data3',_0x80c3('0x11'),_0x80c3('0x12'),_0x80c3('0x13'),'data7']}]},'log':_0x80c3('0x3')});};}; \ No newline at end of file +var _0xd771=['Request','GetTrigger','name','AllConditions','field','operator','value','Condition','Action','Actions','data1','data2','data3','data5','data6','data7','../client','getTriggers'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0xd771,0x10c));var _0x1d77=function(_0x40e29d,_0x4c28f8){_0x40e29d=_0x40e29d-0x0;var _0x24520d=_0xd771[_0x40e29d];return _0x24520d;};'use strict';var client=require(_0x1d77('0x0'));exports[_0x1d77('0x1')]=function(_0x1f53eb){return function(_0x31fc71){return client[_0x1d77('0x2')](_0x1d77('0x3'),{'options':{'raw':![],'attributes':['id',_0x1d77('0x4'),'channel','status'],'include':[{'model':'Condition','as':_0x1d77('0x5'),'attributes':['id',_0x1d77('0x6'),_0x1d77('0x7'),_0x1d77('0x8')]},{'model':_0x1d77('0x9'),'as':'AnyConditions','attributes':['id','field',_0x1d77('0x7'),_0x1d77('0x8')]},{'model':_0x1d77('0xa'),'as':_0x1d77('0xb'),'attributes':['id','action',_0x1d77('0xc'),_0x1d77('0xd'),_0x1d77('0xe'),'data4',_0x1d77('0xf'),_0x1d77('0x10'),_0x1d77('0x11')]}]},'log':_0x1d77('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c7121ca..ebfd01e 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 _0xf150=['Request','registry','defaultuser','GetTrunk','../client','getTrunks'];(function(_0x2fab3f,_0x198503){var _0x5cb4ce=function(_0x312023){while(--_0x312023){_0x2fab3f['push'](_0x2fab3f['shift']());}};_0x5cb4ce(++_0x198503);}(_0xf150,0x196));var _0x0f15=function(_0x52ae7c,_0x238fc5){_0x52ae7c=_0x52ae7c-0x0;var _0xaddb28=_0xf150[_0x52ae7c];return _0xaddb28;};'use strict';var client=require(_0x0f15('0x0'));exports[_0x0f15('0x1')]=function(_0x315b37){return function(_0x360011){return client[_0x0f15('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x0f15('0x3'),_0x0f15('0x4')]},'log':_0x0f15('0x5')});};}; \ No newline at end of file +var _0x177a=['Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x3836ae,_0x33dcdb){var _0x4d4a64=function(_0x58810e){while(--_0x58810e){_0x3836ae['push'](_0x3836ae['shift']());}};_0x4d4a64(++_0x33dcdb);}(_0x177a,0xdd));var _0xa177=function(_0x3c5b89,_0x47a2ae){_0x3c5b89=_0x3c5b89-0x0;var _0x15063d=_0x177a[_0x3c5b89];return _0x15063d;};'use strict';var client=require(_0xa177('0x0'));exports['getTrunks']=function(_0x5ce606){return function(_0x3c21e0){return client[_0xa177('0x1')](_0xa177('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa177('0x3'),_0xa177('0x4'),_0xa177('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 1187acd..4a4077b 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x4163ff,_0x4b9d78){var _0x59e164=function(_0x464da4){while(--_0x464da4){_0x4163ff['push'](_0x4163ff['shift']());}};_0x59e164(++_0x4b9d78);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x28306d,_0xe38571){var _0x212384=function(_0x287265){while(--_0x287265){_0x28306d['push'](_0x28306d['shift']());}};_0x212384(++_0xe38571);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 4e38e10..bd96e62 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 _0x1b5c=['CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b5c,0x12a));var _0xc1b5=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x1b5c[_0x36c6eb];return _0x30675b;};'use strict';var client=require(_0xc1b5('0x0'));exports[_0xc1b5('0x1')]=function(_0x14415d){return client['Request'](_0xc1b5('0x2'),{'body':_0x14415d,'log':_0xc1b5('0x2')});};exports['update']=function(_0x1c441f,_0x587981,_0x2befc6){return client[_0xc1b5('0x3')](_0xc1b5('0x4'),{'body':_0x1c441f,'options':{'where':{'uniqueid':_0x587981,'interface':_0x2befc6,'agentcomplete':!![]}},'log':_0xc1b5('0x4')});}; \ No newline at end of file +var _0x1bd1=['../client','create','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x3b085,_0x250543){var _0x476a57=function(_0x480941){while(--_0x480941){_0x3b085['push'](_0x3b085['shift']());}};_0x476a57(++_0x250543);}(_0x1bd1,0x140));var _0x11bd=function(_0x4c29f7,_0x820749){_0x4c29f7=_0x4c29f7-0x0;var _0x2edc8e=_0x1bd1[_0x4c29f7];return _0x2edc8e;};'use strict';var client=require(_0x11bd('0x0'));exports[_0x11bd('0x1')]=function(_0x3cd890){return client['Request'](_0x11bd('0x2'),{'body':_0x3cd890,'log':_0x11bd('0x2')});};exports[_0x11bd('0x3')]=function(_0x39fb4a,_0x595387,_0x359029){return client['Request'](_0x11bd('0x4'),{'body':_0x39fb4a,'options':{'where':{'uniqueid':_0x595387,'interface':_0x359029,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index e51ff5c..48d16f0 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 _0xf41c=['getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','type','billableseconds','GetVoiceCallReports','moment','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION'];(function(_0x2b81a8,_0x30b798){var _0x131a94=function(_0x480239){while(--_0x480239){_0x2b81a8['push'](_0x2b81a8['shift']());}};_0x131a94(++_0x30b798);}(_0xf41c,0x186));var _0xcf41=function(_0x146a71,_0x302112){_0x146a71=_0x146a71-0x0;var _0x5a6387=_0xf41c[_0x146a71];return _0x5a6387;};'use strict';var moment=require(_0xcf41('0x0'));var util=require('util');var _=require('lodash');var client=require(_0xcf41('0x1'));exports['create']=function(_0x35c7d6){return client[_0xcf41('0x2')](_0xcf41('0x3'),{'body':_[_0xcf41('0x4')](_0x35c7d6,{'source':_0x35c7d6[_0xcf41('0x5')],'destinationcontext':_0x35c7d6[_0xcf41('0x6')],'callerid':_0x35c7d6[_0xcf41('0x7')],'amaflags':_0xcf41('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0xcf41('0x9')]=function(){return function(){return client[_0xcf41('0x2')](_0xcf41('0xa'),{'options':{'where':{'type':[_0xcf41('0xb')],'createdAt':{'$between':[moment()[_0xcf41('0xc')](_0xcf41('0xd'))['format'](_0xcf41('0xe')),moment()[_0xcf41('0xf')](_0xcf41('0xd'))['format'](_0xcf41('0xe'))]}},'attributes':[_0xcf41('0x10'),'disposition','duration',_0xcf41('0x11')]},'log':_0xcf41('0x12')});};}; \ No newline at end of file +var _0x6d59=['create','Request','CreateVoiceCallReport','merge','context','DOCUMENTATION','getVoiceCallReports','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client'];(function(_0x546176,_0x2d3f51){var _0x25217e=function(_0x17fe6e){while(--_0x17fe6e){_0x546176['push'](_0x546176['shift']());}};_0x25217e(++_0x2d3f51);}(_0x6d59,0x14c));var _0x96d5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x6d59[_0x465a0c];return _0x1e202e;};'use strict';var moment=require(_0x96d5('0x0'));var util=require(_0x96d5('0x1'));var _=require(_0x96d5('0x2'));var client=require(_0x96d5('0x3'));exports[_0x96d5('0x4')]=function(_0x200299){return client[_0x96d5('0x5')](_0x96d5('0x6'),{'body':_[_0x96d5('0x7')](_0x200299,{'source':_0x200299['calleridnum'],'destinationcontext':_0x200299[_0x96d5('0x8')],'callerid':_0x200299['callerid'],'amaflags':_0x96d5('0x9')}),'log':_0x96d5('0x6')});};exports[_0x96d5('0xa')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x96d5('0xb')],'createdAt':{'$between':[moment()[_0x96d5('0xc')]('day')[_0x96d5('0xd')](_0x96d5('0xe')),moment()[_0x96d5('0xf')](_0x96d5('0x10'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x96d5('0x11'),_0x96d5('0x12'),_0x96d5('0x13')]},'log':_0x96d5('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f97bbdd..49047d9 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 _0x8b29=['CreateVoiceDialReport','../client','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8b29,0x1b1));var _0x98b2=function(_0x52fbe3,_0x1d5719){_0x52fbe3=_0x52fbe3-0x0;var _0x46b33c=_0x8b29[_0x52fbe3];return _0x46b33c;};'use strict';var client=require(_0x98b2('0x0'));exports[_0x98b2('0x1')]=function(_0x1125cb){return client['Request'](_0x98b2('0x2'),{'body':_0x1125cb,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xb144=['../client','create','Request','CreateVoiceDialReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb144,0x108));var _0x4b14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb144[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x4b14('0x0'));exports[_0x4b14('0x1')]=function(_0x5edb76){return client[_0x4b14('0x2')](_0x4b14('0x3'),{'body':_0x5edb76,'log':_0x4b14('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e35fe53..0424afe 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 _0x0102=['GetVoiceExtension','exten','getVoiceExtensions','Request'];(function(_0x4b5a7d,_0x1a4bad){var _0x4c8c23=function(_0x2e180d){while(--_0x2e180d){_0x4b5a7d['push'](_0x4b5a7d['shift']());}};_0x4c8c23(++_0x1a4bad);}(_0x0102,0x186));var _0x2010=function(_0x1ce8df,_0x40eea1){_0x1ce8df=_0x1ce8df-0x0;var _0x4b6b7a=_0x0102[_0x1ce8df];return _0x4b6b7a;};'use strict';var client=require('../client');exports[_0x2010('0x0')]=function(){return function(){return client[_0x2010('0x1')](_0x2010('0x2'),{'options':{'raw':!![],'attributes':['id',_0x2010('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x750a=['exten','recordingFormat','getVoiceExtensions'];(function(_0x401427,_0x439c91){var _0x906dd0=function(_0x3673d0){while(--_0x3673d0){_0x401427['push'](_0x401427['shift']());}};_0x906dd0(++_0x439c91);}(_0x750a,0x140));var _0xa750=function(_0x5c506f,_0xb7fed4){_0x5c506f=_0x5c506f-0x0;var _0x204474=_0x750a[_0x5c506f];return _0x204474;};'use strict';var client=require('../client');exports[_0xa750('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xa750('0x1'),_0xa750('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xa750('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index d310987..d7bb2ac 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 _0xdc40=['dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold'];(function(_0x393327,_0x6c6934){var _0x35e528=function(_0x2fcaaa){while(--_0x2fcaaa){_0x393327['push'](_0x393327['shift']());}};_0x35e528(++_0x6c6934);}(_0xdc40,0x118));var _0x0dc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc40[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0dc4('0x0'));exports[_0x0dc4('0x1')]=function(){return function(){return client[_0x0dc4('0x2')](_0x0dc4('0x3'),{'options':{'raw':![],'attributes':['id',_0x0dc4('0x4'),_0x0dc4('0x5'),_0x0dc4('0x6'),_0x0dc4('0x7'),_0x0dc4('0x8'),'type',_0x0dc4('0x9'),_0x0dc4('0xa'),_0x0dc4('0xb'),_0x0dc4('0xc'),_0x0dc4('0xd'),'dialPredictiveOptimization',_0x0dc4('0xe'),_0x0dc4('0xf'),_0x0dc4('0x10'),_0x0dc4('0x11'),'dialOriginateTimeout',_0x0dc4('0x12'),_0x0dc4('0x13'),'dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x0dc4('0x14'),'dialBusyRetryFrequency',_0x0dc4('0x15'),_0x0dc4('0x16'),_0x0dc4('0x17'),_0x0dc4('0x18'),'dialGlobalInterval',_0x0dc4('0x19'),'dialCheckDuplicateType',_0x0dc4('0x1a'),_0x0dc4('0x1b'),_0x0dc4('0x1c'),_0x0dc4('0x1d'),_0x0dc4('0x1e'),_0x0dc4('0x1f'),_0x0dc4('0x20'),_0x0dc4('0x21'),_0x0dc4('0x22'),_0x0dc4('0x23'),_0x0dc4('0x24'),_0x0dc4('0x25'),_0x0dc4('0x26'),_0x0dc4('0x27'),'dialAgiAfterHangupAgent',_0x0dc4('0x28'),_0x0dc4('0x29'),_0x0dc4('0x8'),_0x0dc4('0x2a'),_0x0dc4('0x2b'),_0x0dc4('0x2c'),_0x0dc4('0x2d'),_0x0dc4('0x2e'),_0x0dc4('0x2f'),'dialDropRetryFrequency',_0x0dc4('0x30'),_0x0dc4('0x31'),_0x0dc4('0x32'),_0x0dc4('0x33'),_0x0dc4('0x34'),_0x0dc4('0x35'),'mandatoryDisposition',_0x0dc4('0x36'),_0x0dc4('0x37'),_0x0dc4('0x38'),_0x0dc4('0x39')],'include':[{'model':_0x0dc4('0x3a'),'as':_0x0dc4('0x3a'),'attributes':['id',_0x0dc4('0x4'),_0x0dc4('0x3b'),_0x0dc4('0x3c')]},{'model':_0x0dc4('0x3d'),'as':_0x0dc4('0x3e'),'attributes':['id','name']},{'model':_0x0dc4('0x3a'),'as':_0x0dc4('0x3f'),'attributes':['id',_0x0dc4('0x4'),_0x0dc4('0x3b'),_0x0dc4('0x3c')]},{'model':'Interval','as':_0x0dc4('0x40'),'attributes':['id',_0x0dc4('0x4')],'include':[{'model':_0x0dc4('0x40'),'as':_0x0dc4('0x41'),'attributes':['id','name',_0x0dc4('0x42')]}]}]},'log':_0x0dc4('0x1')});};}; \ No newline at end of file +var _0xea26=['strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt'];(function(_0x470e46,_0x33c2e3){var _0x52b31b=function(_0x4db791){while(--_0x4db791){_0x470e46['push'](_0x470e46['shift']());}};_0x52b31b(++_0x33c2e3);}(_0xea26,0x170));var _0x6ea2=function(_0x230af5,_0x5cb0e6){_0x230af5=_0x230af5-0x0;var _0x24e019=_0xea26[_0x230af5];return _0x24e019;};'use strict';var client=require(_0x6ea2('0x0'));exports[_0x6ea2('0x1')]=function(){return function(){return client[_0x6ea2('0x2')](_0x6ea2('0x3'),{'options':{'raw':![],'attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x5'),'acwTimeout',_0x6ea2('0x6'),'monitor_format','type',_0x6ea2('0x7'),_0x6ea2('0x8'),_0x6ea2('0x9'),'dialLimitQueue',_0x6ea2('0xa'),_0x6ea2('0xb'),_0x6ea2('0xc'),'dialPredictiveInterval',_0x6ea2('0xd'),'dialOriginateCallerIdNumber',_0x6ea2('0xe'),'dialQueueOptions',_0x6ea2('0xf'),_0x6ea2('0x10'),_0x6ea2('0x11'),_0x6ea2('0x12'),_0x6ea2('0x13'),_0x6ea2('0x14'),_0x6ea2('0x15'),_0x6ea2('0x16'),_0x6ea2('0x17'),_0x6ea2('0x18'),_0x6ea2('0x19'),_0x6ea2('0x1a'),_0x6ea2('0x1b'),'dialAMDActive',_0x6ea2('0x1c'),'dialAMDGreeting',_0x6ea2('0x1d'),_0x6ea2('0x1e'),_0x6ea2('0x1f'),_0x6ea2('0x20'),_0x6ea2('0x21'),_0x6ea2('0x22'),'dialAMDMaximumWordLength',_0x6ea2('0x23'),'dialRecallMeTimeout',_0x6ea2('0x24'),_0x6ea2('0x25'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format',_0x6ea2('0x26'),_0x6ea2('0x27'),_0x6ea2('0x28'),_0x6ea2('0x29'),'dialNoSuchNumberRetryFrequency',_0x6ea2('0x2a'),'dialDropRetryFrequency',_0x6ea2('0x2b'),_0x6ea2('0x2c'),_0x6ea2('0x2d'),_0x6ea2('0x2e'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x6ea2('0x2f'),_0x6ea2('0x30'),_0x6ea2('0x31')],'include':[{'model':_0x6ea2('0x32'),'as':_0x6ea2('0x32'),'attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x33'),_0x6ea2('0x34')]},{'model':_0x6ea2('0x35'),'as':_0x6ea2('0x36'),'attributes':['id',_0x6ea2('0x4')]},{'model':_0x6ea2('0x32'),'as':_0x6ea2('0x37'),'attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x33'),_0x6ea2('0x34')]},{'model':_0x6ea2('0x38'),'as':_0x6ea2('0x38'),'attributes':['id',_0x6ea2('0x4')],'include':[{'model':_0x6ea2('0x38'),'as':'Intervals','attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x39')]}]}]},'log':_0x6ea2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index fcbd978..2110417 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(_0x285bba,_0x2e2ad7){var _0x206af0=function(_0x5445f1){while(--_0x5445f1){_0x285bba['push'](_0x285bba['shift']());}};_0x206af0(++_0x2e2ad7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x5c7f47,_0x36f874){var _0x39e8a9=function(_0x270bce){while(--_0x270bce){_0x5c7f47['push'](_0x5c7f47['shift']());}};_0x39e8a9(++_0x36f874);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 e25c768..54b15d9 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 _0x1a4b=['Request','../client'];(function(_0x492000,_0x2aaffb){var _0x341d28=function(_0x26e7cd){while(--_0x26e7cd){_0x492000['push'](_0x492000['shift']());}};_0x341d28(++_0x2aaffb);}(_0x1a4b,0x177));var _0xb1a4=function(_0x33b9be,_0x138040){_0x33b9be=_0x33b9be-0x0;var _0x497455=_0x1a4b[_0x33b9be];return _0x497455;};'use strict';var client=require(_0xb1a4('0x0'));exports['getVoiceQueueRtPauses']=function(_0x38871f){return function(){return client[_0xb1a4('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x38871f,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x73a5=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x73a5,0x134));var _0x573a=function(_0x58fec5,_0x4eaa73){_0x58fec5=_0x58fec5-0x0;var _0x36f512=_0x73a5[_0x58fec5];return _0x36f512;};'use strict';var client=require(_0x573a('0x0'));exports[_0x573a('0x1')]=function(_0x5076de){return function(){return client[_0x573a('0x2')](_0x573a('0x3'),{'options':{'where':{'VoiceQueueId':_0x5076de,'paused':!![]},'raw':!![]},'log':_0x573a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 846a8c7..d628011 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x130f1e,_0x574358){var _0x3d0a77=function(_0x200968){while(--_0x200968){_0x130f1e['push'](_0x130f1e['shift']());}};_0x3d0a77(++_0x574358);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x58a632,_0x1d8a91){var _0x4b99eb=function(_0x1a31b1){while(--_0x1a31b1){_0x58a632['push'](_0x58a632['shift']());}};_0x4b99eb(++_0x1d8a91);}(_0x7a54,0x106));var _0x47a5=function(_0x329732,_0x442458){_0x329732=_0x329732-0x0;var _0x52596c=_0x7a54[_0x329732];return _0x52596c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index a07c73f..9e7be02 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 _0xd7dc=['transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','isexternal','blind','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten'];(function(_0x27d503,_0x2402d8){var _0x61179c=function(_0x53eecb){while(--_0x53eecb){_0x27d503['push'](_0x27d503['shift']());}};_0x61179c(++_0x2402d8);}(_0xd7dc,0x1cb));var _0xcd7d=function(_0x37ace5,_0x5546de){_0x37ace5=_0x37ace5-0x0;var _0x235299=_0xd7dc[_0x37ace5];return _0x235299;};'use strict';var client=require('../client');exports[_0xcd7d('0x0')]={};exports['blindTransfer']=function(_0x189155){return client['Request'](_0xcd7d('0x1'),{'body':{'result':_0x189155['result'],'transfererchannel':_0x189155[_0xcd7d('0x2')],'transferercalleridnum':_0x189155[_0xcd7d('0x3')],'transferercalleridname':_0x189155[_0xcd7d('0x4')],'transfererconnectedlinenum':_0x189155['transfererconnectedlinenum'],'transfererconnectedlinename':_0x189155[_0xcd7d('0x5')],'transfereraccountcode':_0x189155[_0xcd7d('0x6')],'transferercontext':_0x189155[_0xcd7d('0x7')],'transfererexten':_0x189155['transfererexten'],'transfererlinkedid':_0x189155[_0xcd7d('0x8')],'transfereechannel':_0x189155[_0xcd7d('0x9')],'transfereecalleridnum':_0x189155[_0xcd7d('0xa')],'transfereecalleridname':_0x189155[_0xcd7d('0xb')],'transfereeconnectedlinenum':_0x189155[_0xcd7d('0xc')],'transfereeconnectedlinename':_0x189155[_0xcd7d('0xd')],'transfereeaccountcode':_0x189155['transfereeaccountcode'],'transfereecontext':_0x189155[_0xcd7d('0xe')],'transfereeexten':_0x189155['transfereeexten'],'transfereelinkedid':_0x189155['transfereelinkedid'],'isexternal':_0x189155[_0xcd7d('0xf')],'context':_0x189155['context'],'extension':_0x189155['extension'],'type':_0xcd7d('0x10')},'log':_0xcd7d('0x1')});};exports[_0xcd7d('0x11')]=function(_0x194de9){return client[_0xcd7d('0x12')](_0xcd7d('0x1'),{'body':{'result':_0x194de9[_0xcd7d('0x13')],'transfererchannel':_0x194de9[_0xcd7d('0x14')],'transferercalleridnum':_0x194de9['origtransferercalleridnum'],'transferercalleridname':_0x194de9[_0xcd7d('0x15')],'transfererconnectedlinenum':_0x194de9[_0xcd7d('0x16')],'transfererconnectedlinename':_0x194de9[_0xcd7d('0x17')],'transfereraccountcode':_0x194de9[_0xcd7d('0x18')],'transferercontext':_0x194de9[_0xcd7d('0x19')],'transfererexten':_0x194de9[_0xcd7d('0x1a')],'transfererlinkedid':_0x194de9[_0xcd7d('0x1b')],'transfereechannel':_0x194de9['transfertargetchannel'],'transfereecalleridnum':_0x194de9['transfertargetcalleridnum'],'transfereecalleridname':_0x194de9['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x194de9['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x194de9[_0xcd7d('0x1c')],'transfereeaccountcode':_0x194de9[_0xcd7d('0x1d')],'transfereecontext':_0x194de9['transfertargetcontext'],'transfereeexten':_0x194de9[_0xcd7d('0x1e')],'transfereelinkedid':_0x194de9[_0xcd7d('0x1f')],'isexternal':_0x194de9['isexternal'],'context':_0x194de9[_0xcd7d('0x20')],'extension':_0x194de9[_0xcd7d('0x21')],'type':_0xcd7d('0x22')},'log':_0xcd7d('0x1')});}; \ No newline at end of file +var _0x8e1b=['transfereecontext','transfereeexten','context','extension','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename'];(function(_0xccbfa1,_0x4b6790){var _0xc4c856=function(_0x9100cb){while(--_0x9100cb){_0xccbfa1['push'](_0xccbfa1['shift']());}};_0xc4c856(++_0x4b6790);}(_0x8e1b,0x6f));var _0xb8e1=function(_0x46e252,_0x137bbc){_0x46e252=_0x46e252-0x0;var _0x2d4c80=_0x8e1b[_0x46e252];return _0x2d4c80;};'use strict';var client=require(_0xb8e1('0x0'));exports[_0xb8e1('0x1')]={};exports[_0xb8e1('0x2')]=function(_0x55c777){return client[_0xb8e1('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x55c777[_0xb8e1('0x4')],'transfererchannel':_0x55c777[_0xb8e1('0x5')],'transferercalleridnum':_0x55c777[_0xb8e1('0x6')],'transferercalleridname':_0x55c777[_0xb8e1('0x7')],'transfererconnectedlinenum':_0x55c777[_0xb8e1('0x8')],'transfererconnectedlinename':_0x55c777[_0xb8e1('0x9')],'transfereraccountcode':_0x55c777[_0xb8e1('0xa')],'transferercontext':_0x55c777[_0xb8e1('0xb')],'transfererexten':_0x55c777[_0xb8e1('0xc')],'transfererlinkedid':_0x55c777[_0xb8e1('0xd')],'transfereechannel':_0x55c777[_0xb8e1('0xe')],'transfereecalleridnum':_0x55c777[_0xb8e1('0xf')],'transfereecalleridname':_0x55c777[_0xb8e1('0x10')],'transfereeconnectedlinenum':_0x55c777['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x55c777[_0xb8e1('0x11')],'transfereeaccountcode':_0x55c777['transfereeaccountcode'],'transfereecontext':_0x55c777[_0xb8e1('0x12')],'transfereeexten':_0x55c777[_0xb8e1('0x13')],'transfereelinkedid':_0x55c777['transfereelinkedid'],'isexternal':_0x55c777['isexternal'],'context':_0x55c777[_0xb8e1('0x14')],'extension':_0x55c777[_0xb8e1('0x15')],'type':'blind'},'log':_0xb8e1('0x16')});};exports[_0xb8e1('0x17')]=function(_0x15b4cb){return client[_0xb8e1('0x3')](_0xb8e1('0x16'),{'body':{'result':_0x15b4cb['result'],'transfererchannel':_0x15b4cb[_0xb8e1('0x18')],'transferercalleridnum':_0x15b4cb[_0xb8e1('0x19')],'transferercalleridname':_0x15b4cb[_0xb8e1('0x1a')],'transfererconnectedlinenum':_0x15b4cb['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x15b4cb[_0xb8e1('0x1b')],'transfereraccountcode':_0x15b4cb[_0xb8e1('0x1c')],'transferercontext':_0x15b4cb[_0xb8e1('0x1d')],'transfererexten':_0x15b4cb[_0xb8e1('0x1e')],'transfererlinkedid':_0x15b4cb[_0xb8e1('0x1f')],'transfereechannel':_0x15b4cb[_0xb8e1('0x20')],'transfereecalleridnum':_0x15b4cb['transfertargetcalleridnum'],'transfereecalleridname':_0x15b4cb[_0xb8e1('0x21')],'transfereeconnectedlinenum':_0x15b4cb[_0xb8e1('0x22')],'transfereeconnectedlinename':_0x15b4cb[_0xb8e1('0x23')],'transfereeaccountcode':_0x15b4cb[_0xb8e1('0x24')],'transfereecontext':_0x15b4cb[_0xb8e1('0x25')],'transfereeexten':_0x15b4cb[_0xb8e1('0x26')],'transfereelinkedid':_0x15b4cb['transfertargetlinkedid'],'isexternal':_0x15b4cb[_0xb8e1('0x27')],'context':_0x15b4cb[_0xb8e1('0x28')],'extension':_0x15b4cb[_0xb8e1('0x29')],'type':_0xb8e1('0x2a')},'log':_0xb8e1('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d9a9245..be46322 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(_0xa65403,_0x19b508){var _0x2363b3=function(_0xe4e947){while(--_0xe4e947){_0xa65403['push'](_0xa65403['shift']());}};_0x2363b3(++_0x19b508);}(_0x7a54,0x106));var _0x47a5=function(_0xf91d73,_0x428090){_0xf91d73=_0xf91d73-0x0;var _0x42f0e1=_0x7a54[_0xf91d73];return _0x42f0e1;};'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(_0x586663,_0x5229bf){var _0x32d797=function(_0x3de852){while(--_0x3de852){_0x586663['push'](_0x586663['shift']());}};_0x32d797(++_0x5229bf);}(_0xb10b,0x12a));var _0xbb10=function(_0xdfdeb7,_0x29649c){_0xdfdeb7=_0xdfdeb7-0x0;var _0x1db931=_0xb10b[_0xdfdeb7];return _0x1db931;};'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 b4c3121..92dfb32 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 _0x5a7e=['then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','destcalleridnum','calleridname','','destcalleridname','Unknown','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','util','../../../../config/environment','../../../../config/logger','trigger','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts'];(function(_0x46d73e,_0x5dcde4){var _0x5025fa=function(_0x3b9eba){while(--_0x3b9eba){_0x46d73e['push'](_0x46d73e['shift']());}};_0x5025fa(++_0x5dcde4);}(_0x5a7e,0x8a));var _0xe5a7=function(_0x3c166e,_0x4b3e17){_0x3c166e=_0x3c166e-0x0;var _0x3a1a3c=_0x5a7e[_0x3c166e];return _0x3a1a3c;};'use strict';var _=require(_0xe5a7('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require(_0xe5a7('0x1'));var config=require(_0xe5a7('0x2'));var logger=require(_0xe5a7('0x3'))(_0xe5a7('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0xe5a7('0x5')]=_['defaults'](config['redis'],{'host':_0xe5a7('0x6'),'port':0x18eb});var io=require(_0xe5a7('0x7'))(new Redis(config[_0xe5a7('0x5')]));function emit(_0x19adac,_0x262c9b,_0x519916,_0x2290a2,_0x3946b8){logger[_0xe5a7('0x8')](_0xe5a7('0x9'),_0x19adac,_0x262c9b['id'],_0x519916,_0x2290a2,JSON[_0xe5a7('0xa')](_0x3946b8));io['to'](_0x519916)['emit'](_0x2290a2,_0x3946b8);}exports[_0xe5a7('0xb')]=function(_0x589d84,_0x5eb582,_0x4217ad,_0x3355b1){var _0x345ddc,_0x618353;var _0x3d69ad={};var _0x292ebb;var _0x2b52dd=Number(_0x4217ad[_0xe5a7('0xc')]);var _0x2ee2cd=_0x4217ad[_0xe5a7('0xd')]?Boolean(Number(_0x4217ad['data2'])):![];var _0x3b95ff;var _0x2d682e=![];if(!_['isNil'](_0x4217ad[_0xe5a7('0xe')])){if(_0x4217ad[_0xe5a7('0xe')]=='1')_0x2d682e=!![];}if(!_0x2d682e){if(_0x3355b1[_0xe5a7('0xf')]){_0x3d69ad['id']=_0x3355b1[_0xe5a7('0xf')];}}if(!_0x3d69ad['id']){_0x3d69ad[_0xe5a7('0x10')]=_0x2b52dd;_0x3b95ff=_0x4217ad[_0xe5a7('0x11')]&&_0x4217ad[_0xe5a7('0x11')]!=='0'?_0x4217ad[_0xe5a7('0x11')][_0xe5a7('0x12')](','):[_0xe5a7('0x13')];_0x3d69ad['$or']=_[_0xe5a7('0x14')](_0x3b95ff,function(_0x5bf443){var _0x52a288={};_0x52a288[_0x5bf443]=_0x3355b1[_0xe5a7('0x15')]?_0x3355b1['destcalleridnum']:_0x3355b1[_0xe5a7('0x16')];return _0x52a288;});_0x292ebb=_0x3355b1[_0xe5a7('0x15')]?_0x3355b1['destcalleridnum']:_0x3355b1[_0xe5a7('0x16')];}var _0x10b9f8=['id',_0xe5a7('0x17'),_0xe5a7('0x18'),_0xe5a7('0x13'),_0xe5a7('0x19'),_0xe5a7('0x1a'),'ListId',_0xe5a7('0x1b'),_0xe5a7('0x1c'),_0xe5a7('0x1d')];var _0x45cd85=_[_0xe5a7('0x1e')](_0x10b9f8,_0x3b95ff);BPromise[_0xe5a7('0x1f')]()['then'](cmContactRpc[_0xe5a7('0x20')]({'attributes':_0x45cd85,'where':_0x3d69ad,'phone':_0x292ebb}))[_0xe5a7('0x21')](function(_0x55428c){_0x618353=_0x55428c;if(!_[_0xe5a7('0x22')](_0x618353)){if(_0x618353[_0xe5a7('0x23')]===0x1){_0x345ddc=_0x618353[0x0];logger[_0xe5a7('0x8')](_0xe5a7('0x24'),_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id'],_0x345ddc['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id'],_[_0xe5a7('0x14')](_0x618353,'id')[_0xe5a7('0x26')](','));}return;}else{logger[_0xe5a7('0x8')](_0xe5a7('0x27'),_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id']);var _0x4472a2={'ListId':_0x2b52dd};var _0x5452f6=_0x4217ad[_0xe5a7('0x28')]&&_0x4217ad['data4']!=='0'?_0x4217ad[_0xe5a7('0x28')]:_0xe5a7('0x13');if(_0x2ee2cd){logger[_0xe5a7('0x8')](_0xe5a7('0x29'),_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id']);_0x4472a2[_0x5452f6]=_[_0xe5a7('0x2a')](_0x3355b1[_0xe5a7('0x15')])?_0x3355b1['calleridnum']:_0x3355b1[_0xe5a7('0x2b')];if(_[_0xe5a7('0x2a')](_0x3355b1[_0xe5a7('0x15')])){_0x4472a2[_0xe5a7('0x17')]=_0x3355b1[_0xe5a7('0x2c')]&&_0x3355b1['calleridname']!==_0xe5a7('0x2d')?_0x3355b1[_0xe5a7('0x2c')]:'Unknown';}else{_0x4472a2[_0xe5a7('0x17')]=_0x3355b1[_0xe5a7('0x2e')]&&_0x3355b1[_0xe5a7('0x2e')]!==_0xe5a7('0x2d')?_0x3355b1['destcalleridname']:_0xe5a7('0x2f');}return BPromise[_0xe5a7('0x1f')]()[_0xe5a7('0x21')](cmContactRpc['createContact'](_0x4472a2))['then'](function(_0x180aaa){_0x345ddc=_0x180aaa;_0x618353[_0xe5a7('0x30')](_0x180aaa);if(_0x345ddc){logger[_0xe5a7('0x8')](_0xe5a7('0x31'),_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id'],_0x345ddc['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id']);_0x4472a2[_0x5452f6]=_[_0xe5a7('0x2a')](_0x3355b1[_0xe5a7('0x15')])?_0x3355b1[_0xe5a7('0x16')]:_0x3355b1[_0xe5a7('0x2b')];if(_[_0xe5a7('0x2a')](_0x3355b1[_0xe5a7('0x15')])){_0x4472a2[_0xe5a7('0x17')]=_0x3355b1[_0xe5a7('0x2c')]&&_0x3355b1['calleridname']!==_0xe5a7('0x2d')?_0x3355b1[_0xe5a7('0x2c')]:'Unknown';}else{_0x4472a2[_0xe5a7('0x17')]=_0x3355b1[_0xe5a7('0x2e')]&&_0x3355b1['destcalleridname']!==_0xe5a7('0x2d')?_0x3355b1[_0xe5a7('0x2e')]:_0xe5a7('0x2f');}_0x345ddc=_0x4472a2;_0x618353[_0xe5a7('0x30')](_0x4472a2);return;}}})[_0xe5a7('0x21')](function(){if(_0x589d84){emit(_0x3355b1[_0xe5a7('0x25')],_0x5eb582,util[_0xe5a7('0x32')](_0xe5a7('0x33'),_0x589d84[_0xe5a7('0x34')]),util[_0xe5a7('0x32')](_0xe5a7('0x35'),_0x4217ad[_0xe5a7('0x36')][_0xe5a7('0x37')]()),{'evt':_[_0xe5a7('0x38')](_0x3355b1,{'autoCreate':_0x2ee2cd}),'contact':_0x345ddc===undefined?{}:_0x345ddc,'contacts':_0x618353[_0xe5a7('0x23')]===0x0?undefined:_0x618353});}});}; \ No newline at end of file +var _0xe495=['exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','phone','fax','createdAt','scheduledAt','updatedAt','resolve','then','isEmpty','length','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','merge','lodash','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe495,0xfe));var _0x5e49=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe495[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5e49('0x0'));var BPromise=require('bluebird');var Redis=require(_0x5e49('0x1'));var util=require(_0x5e49('0x2'));var config=require('../../../../config/environment');var logger=require(_0x5e49('0x3'))(_0x5e49('0x4'));var cmContactRpc=require(_0x5e49('0x5'));config['redis']=_[_0x5e49('0x6')](config[_0x5e49('0x7')],{'host':_0x5e49('0x8'),'port':0x18eb});var io=require(_0x5e49('0x9'))(new Redis(config[_0x5e49('0x7')]));function emit(_0xae637a,_0x53d14e,_0x5d45be,_0x246c9e,_0x153761){logger['info']('[CM][%s][%s]',_0xae637a,_0x53d14e['id'],_0x5d45be,_0x246c9e,JSON[_0x5e49('0xa')](_0x153761));io['to'](_0x5d45be)['emit'](_0x246c9e,_0x153761);}exports[_0x5e49('0xb')]=function(_0x1fdfbe,_0x1a2913,_0x59de55,_0x294ec1){var _0x3b49d1,_0x21184a;var _0xd757b0={};var _0xb0c2b1;var _0x526d73=Number(_0x59de55[_0x5e49('0xc')]);var _0x1c8bac=_0x59de55[_0x5e49('0xd')]?Boolean(Number(_0x59de55[_0x5e49('0xd')])):![];var _0x30843b;var _0x5415bf=![];if(!_[_0x5e49('0xe')](_0x59de55['data5'])){if(_0x59de55[_0x5e49('0xf')]=='1')_0x5415bf=!![];}if(!_0x5415bf){if(_0x294ec1[_0x5e49('0x10')]){_0xd757b0['id']=_0x294ec1[_0x5e49('0x10')];}}if(!_0xd757b0['id']){_0xd757b0[_0x5e49('0x11')]=_0x526d73;_0x30843b=_0x59de55[_0x5e49('0x12')]&&_0x59de55[_0x5e49('0x12')]!=='0'?_0x59de55['data3'][_0x5e49('0x13')](','):['phone'];_0xd757b0[_0x5e49('0x14')]=_[_0x5e49('0x15')](_0x30843b,function(_0x43c424){var _0x42518d={};_0x42518d[_0x43c424]=_0x294ec1[_0x5e49('0x16')]?_0x294ec1[_0x5e49('0x17')]:_0x294ec1['calleridnum'];return _0x42518d;});_0xb0c2b1=_0x294ec1[_0x5e49('0x16')]?_0x294ec1[_0x5e49('0x17')]:_0x294ec1[_0x5e49('0x18')];}var _0xd2d53a=['id',_0x5e49('0x19'),'lastName',_0x5e49('0x1a'),'mobile',_0x5e49('0x1b'),'ListId',_0x5e49('0x1c'),_0x5e49('0x1d'),_0x5e49('0x1e')];var _0x5c4ef4=_['union'](_0xd2d53a,_0x30843b);BPromise[_0x5e49('0x1f')]()[_0x5e49('0x20')](cmContactRpc['getContacts']({'attributes':_0x5c4ef4,'where':_0xd757b0,'phone':_0xb0c2b1}))[_0x5e49('0x20')](function(_0x125933){_0x21184a=_0x125933;if(!_[_0x5e49('0x21')](_0x21184a)){if(_0x21184a[_0x5e49('0x22')]===0x1){_0x3b49d1=_0x21184a[0x0];logger[_0x5e49('0x23')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x294ec1['uniqueid'],_0x1a2913['id'],_0x3b49d1['id']);}else{logger[_0x5e49('0x23')](_0x5e49('0x24'),_0x294ec1[_0x5e49('0x25')],_0x1a2913['id'],_[_0x5e49('0x15')](_0x21184a,'id')[_0x5e49('0x26')](','));}return;}else{logger['info'](_0x5e49('0x27'),_0x294ec1[_0x5e49('0x25')],_0x1a2913['id']);var _0x501c13={'ListId':_0x526d73};var _0x30d461=_0x59de55[_0x5e49('0x28')]&&_0x59de55[_0x5e49('0x28')]!=='0'?_0x59de55[_0x5e49('0x28')]:_0x5e49('0x1a');if(_0x1c8bac){logger[_0x5e49('0x23')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x294ec1[_0x5e49('0x25')],_0x1a2913['id']);_0x501c13[_0x30d461]=_[_0x5e49('0xe')](_0x294ec1['routeId'])?_0x294ec1[_0x5e49('0x18')]:_0x294ec1[_0x5e49('0x17')];if(_['isNil'](_0x294ec1[_0x5e49('0x16')])){_0x501c13[_0x5e49('0x19')]=_0x294ec1['calleridname']&&_0x294ec1[_0x5e49('0x29')]!==_0x5e49('0x2a')?_0x294ec1['calleridname']:_0x5e49('0x2b');}else{_0x501c13[_0x5e49('0x19')]=_0x294ec1[_0x5e49('0x2c')]&&_0x294ec1[_0x5e49('0x2c')]!==_0x5e49('0x2a')?_0x294ec1[_0x5e49('0x2c')]:'Unknown';}return BPromise[_0x5e49('0x1f')]()[_0x5e49('0x20')](cmContactRpc[_0x5e49('0x2d')](_0x501c13))[_0x5e49('0x20')](function(_0x117ea1){_0x3b49d1=_0x117ea1;_0x21184a[_0x5e49('0x2e')](_0x117ea1);if(_0x3b49d1){logger[_0x5e49('0x23')](_0x5e49('0x2f'),_0x294ec1[_0x5e49('0x25')],_0x1a2913['id'],_0x3b49d1['id']);}return;});}else{logger[_0x5e49('0x23')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x294ec1['uniqueid'],_0x1a2913['id']);_0x501c13[_0x30d461]=_[_0x5e49('0xe')](_0x294ec1[_0x5e49('0x16')])?_0x294ec1[_0x5e49('0x18')]:_0x294ec1[_0x5e49('0x17')];if(_[_0x5e49('0xe')](_0x294ec1[_0x5e49('0x16')])){_0x501c13[_0x5e49('0x19')]=_0x294ec1['calleridname']&&_0x294ec1[_0x5e49('0x29')]!==_0x5e49('0x2a')?_0x294ec1[_0x5e49('0x29')]:'Unknown';}else{_0x501c13[_0x5e49('0x19')]=_0x294ec1[_0x5e49('0x2c')]&&_0x294ec1[_0x5e49('0x2c')]!==_0x5e49('0x2a')?_0x294ec1['destcalleridname']:_0x5e49('0x2b');}_0x3b49d1=_0x501c13;_0x21184a[_0x5e49('0x2e')](_0x501c13);return;}}})[_0x5e49('0x20')](function(){if(_0x1fdfbe){emit(_0x294ec1[_0x5e49('0x25')],_0x1a2913,util[_0x5e49('0x30')](_0x5e49('0x31'),_0x1fdfbe[_0x5e49('0x32')]),util[_0x5e49('0x30')](_0x5e49('0x33'),_0x59de55['action']['toLowerCase']()),{'evt':_[_0x5e49('0x34')](_0x294ec1,{'autoCreate':_0x1c8bac}),'contact':_0x3b49d1===undefined?{}:_0x3b49d1,'contacts':_0x21184a[_0x5e49('0x22')]===0x0?undefined:_0x21184a});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 5f2122b..86d6d2c 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 _0x165f=['winApplication','winArguments','format','user:%s','jscripty','trigger:%s','toLowerCase','name','exec','integration','queue','voiceExtensions','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','AnyConditions','checkConditions','checkTrigger:\x20trigger','inspect','evt','field','account','chat','operator','value','ChatWebsiteId','upperFirst','AccountId','event','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','exports','util','lodash','url','mustache','ioredis','./cmContact','./script','../../../config/environment','../../../config/logger','redis','defaults','popup','winapp','triggers','agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','stringify','clone','motionChannel','undefined','voice','debug','interface','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location','windowWidth','data5','800','windowHeight','data6','600'];(function(_0x22eca5,_0x3fa0e5){var _0x384d73=function(_0x139588){while(--_0x139588){_0x22eca5['push'](_0x22eca5['shift']());}};_0x384d73(++_0x3fa0e5);}(_0x165f,0x12a));var _0xf165=function(_0xa028b8,_0xce3ed){_0xa028b8=_0xa028b8-0x0;var _0x1ed82e=_0x165f[_0xa028b8];return _0x1ed82e;};'use strict';var util=require(_0xf165('0x0'));var _=require(_0xf165('0x1'));var url=require(_0xf165('0x2'));var Mustache=require(_0xf165('0x3'));var Redis=require(_0xf165('0x4'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require(_0xf165('0x5'));var script=require(_0xf165('0x6'));var config=require(_0xf165('0x7'));var logger=require(_0xf165('0x8'))('trigger');var ami=require('../ami');config[_0xf165('0x9')]=_[_0xf165('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf165('0x9')]));var operators={'equals':function(_0x5f120f,_0x2274ee){return _0x5f120f==_0x2274ee;},'not_equals':function(_0x72e527,_0x3dfd73){return _0x72e527!=_0x3dfd73;}};var barAndWebActions=[_0xf165('0xb'),_0xf165('0x2'),_0xf165('0xc')];function Trigger(_0x2184ef){this['triggers']=_0x2184ef[_0xf165('0xd')];this[_0xf165('0xe')]=_0x2184ef['agents'];this['voiceQueues']=_0x2184ef[_0xf165('0xf')];this[_0xf165('0x10')]=_0x2184ef['templates'];this['voiceExtensions']=_0x2184ef['voiceExtensions'];this[_0xf165('0x11')]=_0x2184ef[_0xf165('0x11')];this[_0xf165('0x12')]=_0x2184ef[_0xf165('0x12')];this[_0xf165('0x13')]=_0x2184ef[_0xf165('0x13')];this[_0xf165('0x14')]=_0x2184ef[_0xf165('0x14')];this[_0xf165('0x15')]=_0x2184ef['zohoAccounts'];this['deskAccounts']=_0x2184ef['deskAccounts'];this[_0xf165('0x16')]=_0x2184ef['vtigerAccounts'];this[_0xf165('0x17')]=_0x2184ef[_0xf165('0x17')];this[_0xf165('0x18')]=_0x2184ef[_0xf165('0x18')];this[_0xf165('0x19')]=_0x2184ef['freshsalesAccounts'];this[_0xf165('0x1a')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xf165('0x13')],'freshdesk':this[_0xf165('0x12')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xf165('0x15')],'desk':this[_0xf165('0x1b')],'vtiger':this[_0xf165('0x16')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xf165('0x19')],'servicenow':this[_0xf165('0x17')]};ami['on'](_0xf165('0x1c'),this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on'](_0xf165('0x1f'),this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on'](_0xf165('0x20'),this['syncCustomEvent'][_0xf165('0x1e')](this));ami['on'](_0xf165('0x21'),this['syncCustomEvent'][_0xf165('0x1e')](this));ami['on'](_0xf165('0x22'),this['syncCustomEvent']['bind'](this));ami['on'](_0xf165('0x23'),this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on']('custom:agentbusy',this[_0xf165('0x1d')]['bind'](this));ami['on']('custom:agentcongestion',this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on']('custom:agentreject',this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on'](_0xf165('0x24'),this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on'](_0xf165('0x25'),this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on']('custom:timeout',this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on'](_0xf165('0x26'),this[_0xf165('0x27')][_0xf165('0x1e')](this));ami['on'](_0xf165('0x28'),this[_0xf165('0x27')][_0xf165('0x1e')](this));ami['on']('custom:dialend',this[_0xf165('0x27')]['bind'](this));ami['on'](_0xf165('0x29'),this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on'](_0xf165('0x2a'),this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on'](_0xf165('0x2b'),this[_0xf165('0x1d')]['bind'](this));ami['on'](_0xf165('0x2c'),this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on']('custom:outgoingmessage',this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on'](_0xf165('0x2d'),this[_0xf165('0x1d')][_0xf165('0x1e')](this));ami['on'](_0xf165('0x2e'),this['syncCustomEvent']['bind'](this));ami['on']('custom:offlineMessage',this[_0xf165('0x1d')][_0xf165('0x1e')](this));}Trigger[_0xf165('0x2f')][_0xf165('0x30')]=function(_0x5635f1,_0x45e0d6,_0x2dd11a){logger['info'](_0x5635f1,_0x45e0d6,JSON[_0xf165('0x31')](_0x2dd11a));io['to'](_0x5635f1)[_0xf165('0x30')](_0x45e0d6,_0x2dd11a);};Trigger[_0xf165('0x2f')][_0xf165('0x1d')]=function(_0x222e62){var _0x9b752d=_[_0xf165('0x32')](_0x222e62);if(typeof _0x9b752d[_0xf165('0x33')]===_0xf165('0x34')){_0x9b752d[_0xf165('0x33')]=_0xf165('0x35');}logger[_0xf165('0x36')](_0xf165('0x1d'),util['inspect'](_0x9b752d,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x9b752d);};Trigger[_0xf165('0x2f')][_0xf165('0x27')]=function(_0xe7799){if(this[_0xf165('0xe')][_0xe7799[_0xf165('0x37')]]){this['syncCustomEvent'](_0xe7799);}};Trigger[_0xf165('0x2f')][_0xf165('0x38')]=function(_0x18f4fa){var _0x4c4463;for(var _0x1f3b1a in this[_0xf165('0xd')]){if(this[_0xf165('0xd')][_0xf165('0x39')](_0x1f3b1a)){if(this['triggers'][_0x1f3b1a][_0xf165('0x3a')]){_0x4c4463=this[_0xf165('0x3b')](this['triggers'][_0x1f3b1a],_0x18f4fa);if(_0x4c4463){_[_0xf165('0x3c')](_0x18f4fa,_0x18f4fa[_0xf165('0x3d')]);for(var _0x23f86b=0x0,_0x8ad1c3,_0x31a99c,_0xf79a28;_0x23f86b0x0){_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 _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x326f,0xd1));var _0xf326=function(_0x461627,_0x6406be){_0x461627=_0x461627-0x0;var _0x2fefd6=_0x326f[_0x461627];return _0x2fefd6;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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 83a96c0..477312e 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 _0xe249=[']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','message','toLowerCase','outbound','calleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contacts?$select=','&$filter=','replace','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','length','includes','picklist','type','nameField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','callDirection','queue','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','then','access_token','catch','error',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid'];(function(_0x2a0439,_0x5c45bb){var _0x21c22a=function(_0x505299){while(--_0x505299){_0x2a0439['push'](_0x2a0439['shift']());}};_0x21c22a(++_0x5c45bb);}(_0xe249,0x195));var _0x9e24=function(_0x5d4d09,_0x436d6e){_0x5d4d09=_0x5d4d09-0x0;var _0xebe078=_0xe249[_0x5d4d09];return _0xebe078;};'use strict';var _=require(_0x9e24('0x0'));var rp=require(_0x9e24('0x1'));var util=require(_0x9e24('0x2'));var intUtil=require('./util');var md5=require(_0x9e24('0x3'));var Redis=require(_0x9e24('0x4'));var logger=require(_0x9e24('0x5'))(_0x9e24('0x6'));var config=require(_0x9e24('0x7'));config['redis']=_[_0x9e24('0x8')](config[_0x9e24('0x9')],{'host':_0x9e24('0xa'),'port':0x18eb});var io=require(_0x9e24('0xb'))(new Redis(config[_0x9e24('0x9')]));function getAuthToken(_0x36d018,_0x296481,_0x37e5f4){if(_0x36d018[_0x9e24('0xc')]){_0x36d018[_0x9e24('0xd')]=_0x36d018[_0x9e24('0xe')][_0x9e24('0xf')];_0x36d018[_0x9e24('0x10')]=_0x36d018[_0x9e24('0xe')][_0x9e24('0x11')];return Promise[_0x9e24('0x12')](_0x36d018[_0x9e24('0xe')][_0x9e24('0x13')]);}var _0x1290c2={'method':_0x9e24('0x14'),'uri':_0x296481,'form':{'client_id':_0x36d018[_0x9e24('0x15')],'resource':_0x36d018['remoteUri'],'username':_0x36d018[_0x9e24('0x16')],'password':_0x36d018['password'],'grant_type':_0x9e24('0x17'),'client_secret':_0x36d018['clientSecret']},'json':!![]};return rp(_0x1290c2)[_0x9e24('0x18')](function(_0x64c2cb){return _0x64c2cb[_0x9e24('0x19')];})[_0x9e24('0x1a')](function(_0x331cd2){logger[_0x9e24('0x1b')]('['+[_0x37e5f4['toUpperCase']()]+_0x9e24('0x1c'));return _0x331cd2['message'];});}function getUser(_0x2f006a,_0x5d79ee,_0x581ffd,_0x1e4de0,_0x397366,_0xbf60ea){return new Promise(function(_0x3c38bc,_0x2e6724){return getAuthToken(_0x5d79ee,_0x1e4de0,_0xbf60ea)[_0x9e24('0x18')](function(_0x3c1106){var _0x3e134c={'method':_0x9e24('0x1d'),'uri':_0x397366+_0x9e24('0x1e'),'headers':{'Authorization':_0x9e24('0x1f')+_0x3c1106,'OData-Version':_0x9e24('0x20')},'json':!![]};return rp(_0x3e134c);})['then'](function(_0x4ccf27){var _0x426e01=_0x4ccf27[_0x9e24('0x21')];var _0x2b750e=![];var _0x3f8e9d=null;if(!_['isNil'](_0x581ffd)){if(intUtil[_0x9e24('0x22')](_0x581ffd[_0x9e24('0x23')])){_0x2f006a[_0x9e24('0x24')]=_0x581ffd[_0x9e24('0x23')];for(_0x3f8e9d=0x0;_0x3f8e9d<_0x426e01['length'];_0x3f8e9d++){if(_0x426e01[_0x3f8e9d]['internalemailaddress']===_0x581ffd[_0x9e24('0x23')]&&!_0x426e01[_0x3f8e9d][_0x9e24('0x25')]){_0x2b750e=!![];logger[_0x9e24('0x26')]('['+[_0xbf60ea[_0x9e24('0x27')]()]+_0x9e24('0x28')+_0x426e01[_0x3f8e9d]['systemuserid']+'!');_0x2f006a[_0x9e24('0x29')]=_0x426e01[_0x3f8e9d][_0x9e24('0x2a')];}}}}if(!_0x2b750e){logger[_0x9e24('0x26')]('['+[_0xbf60ea[_0x9e24('0x27')]()]+_0x9e24('0x2b'));_0x2f006a[_0x9e24('0x24')]=_0x5d79ee[_0x9e24('0x16')];for(_0x3f8e9d=0x0;_0x3f8e9d<_0x426e01['length'];_0x3f8e9d++){if(_0x426e01[_0x3f8e9d][_0x9e24('0x2c')]===_0x5d79ee['username']){_0x2f006a[_0x9e24('0x29')]=_0x426e01[_0x3f8e9d][_0x9e24('0x2a')];}}}_0x3c38bc(_0x2f006a);})['catch'](function(_0x494f08){_0x2e6724(_0x494f08[_0x9e24('0x2d')]);});});}function createEndUser(_0x1a03f4,_0x4b7370,_0x39b47e,_0x5ab8be,_0x185bbe,_0x3fc63c,_0x54e40e){return new Promise(function(_0x506e8f,_0x114ed8){return getAuthToken(_0x4b7370,_0x39b47e,_0x3fc63c)[_0x9e24('0x18')](function(_0x4b61a5){var _0x2bb34b=_0x3fc63c[_0x9e24('0x2e')]()===_0x9e24('0x2f')?_0x185bbe['destcalleridnum']:_0x185bbe[_0x9e24('0x30')];var _0x37b8a0={'method':_0x9e24('0x14'),'uri':_0x5ab8be+'contacts','body':{'fullname':_0x2bb34b,'firstname':_0x2bb34b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x9e24('0x31')+_0x1a03f4[_0x9e24('0x29')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4b61a5,'OData-Version':_0x9e24('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x37b8a0[_0x9e24('0x32')][_0x54e40e]=_0x2bb34b;return rp(_0x37b8a0);})[_0x9e24('0x18')](function(_0x34052d){var _0x20d4c2=_0x34052d[_0x9e24('0x33')][_0x9e24('0x34')];var _0x4c6c98=_0x20d4c2[_0x9e24('0x35')](_0x20d4c2['lastIndexOf']('(')+0x1,_0x20d4c2[_0x9e24('0x36')](')'));_0x1a03f4[_0x9e24('0x37')]=_0x4c6c98;_0x506e8f(_0x1a03f4);})[_0x9e24('0x1a')](function(_0x4306d0){_0x114ed8(_0x4306d0[_0x9e24('0x2d')]);});});}function getEndUser(_0x494fe2,_0x1e70d4,_0x3c1830,_0x510d3e,_0x503e4e,_0x31ff73,_0x329b17,_0x2da9ce){var _0x292d18=_0x31ff73[_0x9e24('0x2e')]()==='outbound'?_0x503e4e[_0x9e24('0x38')]:_0x503e4e[_0x9e24('0x30')];return getAuthToken(_0x1e70d4,_0x3c1830,_0x31ff73)['then'](function(_0x5dc3e5){_0x2da9ce=_0x2da9ce?_0x2da9ce:_0x9e24('0x39');var _0x40b529={'method':_0x9e24('0x1d'),'uri':_0x510d3e+_0x9e24('0x3a')+_0x2da9ce+_0x9e24('0x3b')+_0x2da9ce+'\x20eq\x20\x27'+_0x292d18[_0x9e24('0x3c')]('+','%2b')+'\x27','headers':{'Authorization':_0x9e24('0x1f')+_0x5dc3e5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x40b529);})[_0x9e24('0x18')](function(_0x29acc9){var _0x35a3bc=![];if(!_0x29acc9)return _0x35a3bc;var _0x3faf69=_0x29acc9['value'];for(var _0x2b0e87=0x0;_0x2b0e87<_0x3faf69['length'];_0x2b0e87++){if(_0x3faf69[_0x2b0e87][_0x2da9ce]===_0x292d18){_0x35a3bc=!![];_0x494fe2[_0x9e24('0x37')]=_0x3faf69[_0x2b0e87][_0x9e24('0x3d')];}}return _0x35a3bc;})['then'](function(_0x277d65){if(_0x277d65)return _0x494fe2;if(_0x329b17==='nothing'){logger['info']('['+[_0x31ff73[_0x9e24('0x27')]()]+_0x9e24('0x3e'));return _0x494fe2;}return createEndUser(_0x494fe2,_0x1e70d4,_0x3c1830,_0x510d3e,_0x503e4e,_0x31ff73,_0x2da9ce)[_0x9e24('0x18')](function(_0xd6b4a8){logger[_0x9e24('0x26')]('['+[_0x31ff73[_0x9e24('0x27')]()]+']\x20Enduser\x20created!',_0xd6b4a8[_0x9e24('0x37')]);return _0xd6b4a8;});});}function getCustomFields(_0x52a389,_0x80baf4,_0x276ebc){var _0x18acd8={};if(_0x52a389[_0x9e24('0x3f')]>0x0){_['forEach'](_0x52a389,function(_0x5961f6){if(_[_0x9e24('0x40')](['string',_0x9e24('0x41')],_0x5961f6[_0x9e24('0x42')])&&_0x5961f6[_0x9e24('0x43')]&&!_0x5961f6['customField']){var _0x569dbd=_0x5961f6[_0x9e24('0x44')][_0x9e24('0x2e')]();var _0x36a0bd=_0x569dbd[_0x9e24('0x35')](0x0,_0x569dbd[_0x9e24('0x45')]('_'));var _0x2505a9=_0x569dbd[_0x9e24('0x35')](_0x569dbd[_0x9e24('0x45')]('_')+0x1);if(_0x36a0bd===_0x276ebc){_0x18acd8[_0x2505a9]=_0x5961f6[_0x9e24('0x46')];}}});}return _0x18acd8;}function getTicket(_0x4b1492,_0x28104a,_0x5edcf0,_0x6e5e88,_0x2ef6a5,_0x448d9d,_0x27096f){return new Promise(function(_0x3c408b,_0x5e34ed){var _0x4009bf;return getAuthToken(_0x28104a,_0x5edcf0,_0x27096f)[_0x9e24('0x18')](function(_0x3bb2b1){if(_0x448d9d[_0x9e24('0x47')]==='incident'){_0x4009bf={'method':_0x9e24('0x14'),'uri':_0x6e5e88+_0x9e24('0x48'),'body':Object[_0x9e24('0x49')]({},{'title':intUtil[_0x9e24('0x4a')](_0x448d9d[_0x9e24('0x4b')],_0x2ef6a5,'\x20'),'description':intUtil['getString'](_0x448d9d[_0x9e24('0x4c')],_0x2ef6a5,'\x0a'),'customerid_contact@odata.bind':_0x4b1492[_0x9e24('0x37')]?_0x9e24('0x4d')+_0x4b1492[_0x9e24('0x37')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4b1492[_0x9e24('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x448d9d[_0x9e24('0x4e')],_0x2ef6a5,_0x448d9d['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x3bb2b1,'OData-Version':_0x9e24('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x448d9d[_0x9e24('0x47')]==='phonecall'){var _0x313136=_0x4b1492[_0x9e24('0x37')]?[{'partyid_systemuser@odata.bind':_0x9e24('0x31')+_0x4b1492[_0x9e24('0x29')]+')','participationtypemask':_0x4b1492[_0x9e24('0x4f')]===_0x9e24('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0x9e24('0x4d')+_0x4b1492[_0x9e24('0x37')]+')','participationtypemask':_0x4b1492['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x9e24('0x31')+_0x4b1492[_0x9e24('0x29')]+')','participationtypemask':_0x4b1492[_0x9e24('0x4f')]==='queue'?0x2:0x1}];_0x4009bf={'method':'POST','uri':_0x6e5e88+_0x9e24('0x51'),'body':Object['assign']({},{'subject':intUtil[_0x9e24('0x4a')](_0x448d9d[_0x9e24('0x4b')],_0x2ef6a5,'\x20'),'phonenumber':String(_0x2ef6a5['calleridnum']),'description':intUtil['getString'](_0x448d9d[_0x9e24('0x4c')],_0x2ef6a5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4b1492['enduserId']?'/contacts('+_0x4b1492['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4b1492[_0x9e24('0x29')]+')','directioncode':_0x4b1492[_0x9e24('0x4f')]==='queue'?![]:!![],'phonecall_activity_parties':_0x313136},getCustomFields(_0x448d9d[_0x9e24('0x4e')],_0x2ef6a5,_0x448d9d['ticketType'])),'headers':{'Authorization':_0x9e24('0x1f')+_0x3bb2b1,'OData-Version':_0x9e24('0x20')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4009bf);})['then'](function(_0x2401c5){var _0x40a783=_0x2401c5[_0x9e24('0x33')]['odata-entityid'];var _0x2d71f8=_0x40a783[_0x9e24('0x35')](_0x40a783['lastIndexOf']('(')+0x1,_0x40a783[_0x9e24('0x36')](')'));_0x4b1492[_0x9e24('0x52')]=_0x2d71f8;_0x3c408b(_0x4b1492);})[_0x9e24('0x1a')](function(_0x3e440b){_0x5e34ed(_0x3e440b['message']);});});}function emit(_0x362020,_0x21a3c3,_0x36a781,_0x27eaf3){var _0x5ad14a={'uri':util[_0x9e24('0x53')](_0x9e24('0x54'),_0x362020,_0x36a781,_0x27eaf3)};io['to'](util['format'](_0x9e24('0x55'),_0x21a3c3))[_0x9e24('0x56')](_0x9e24('0x57'),_0x5ad14a);}exports['cs']=function(_0x4a9377,_0x5788cd,_0x932cd4,_0x46cd18,_0x11d2a5,_0x167d8f,_0x53b0e6,_0x3dedf8){var _0x563779={};_0x167d8f['remoteUri']=_0x167d8f[_0x9e24('0xc')]?intUtil['stripTrailingSlash'](_0x167d8f[_0x9e24('0xe')][_0x9e24('0xf')]):intUtil[_0x9e24('0x58')](_0x167d8f[_0x9e24('0xd')]);_0x167d8f[_0x9e24('0x59')]=intUtil[_0x9e24('0x58')](_0x167d8f[_0x9e24('0x59')]);_0x563779['callDirection']=_0x3dedf8===_0x9e24('0x50')||_0x3dedf8===_0x9e24('0x5a')?_0x9e24('0x50'):'outbound';var _0x5a5516=_0x167d8f[_0x9e24('0xc')]?util['format'](_0x9e24('0x5b'),_0x167d8f[_0x9e24('0xe')]['data7']):util['format'](_0x9e24('0x5b'),_0x167d8f[_0x9e24('0xd')]);var _0x311dde=util['format'](_0x9e24('0x5c'),_0x167d8f['tenantId']);var _0x1df6c5=util['format'](_0x9e24('0x5d'),_0x167d8f[_0x9e24('0x59')],_0x5788cd[_0x9e24('0x5e')],md5(_0x5788cd['uniqueid']));if(_0x11d2a5&&_0x11d2a5[_0x9e24('0x5f')]){logger[_0x9e24('0x26')](_0x9e24('0x60'),_0x9e24('0x61'));_0x5788cd[_0x9e24('0x62')]=_0x1df6c5;}else if(_0x53b0e6&&_0x53b0e6['recordingFormat']&&_0x53b0e6[_0x9e24('0x63')]!==_0x9e24('0x64')){logger[_0x9e24('0x26')]('[OUTBOUND]',_0x9e24('0x61'));_0x5788cd['recordingURL']=_0x1df6c5;}else{_0x5788cd[_0x9e24('0x62')]='';}return getUser(_0x563779,_0x167d8f,_0x46cd18,_0x311dde,_0x5a5516,_0x3dedf8)[_0x9e24('0x18')](function(_0x3146ab){logger['info']('['+_0x3dedf8[_0x9e24('0x27')]()+_0x9e24('0x65'),_0x3146ab[_0x9e24('0x29')]);logger[_0x9e24('0x26')]('['+_0x3dedf8[_0x9e24('0x27')]()+_0x9e24('0x66'),_0x3146ab[_0x9e24('0x24')]);return getEndUser(_0x3146ab,_0x167d8f,_0x311dde,_0x5a5516,_0x5788cd,_0x3dedf8,_0x932cd4[_0x9e24('0x67')],_0x932cd4[_0x9e24('0x68')]);})[_0x9e24('0x18')](function(_0x3536b7){logger[_0x9e24('0x26')]('['+_0x3dedf8[_0x9e24('0x27')]()+_0x9e24('0x69'),_0x3536b7[_0x9e24('0x37')]);logger['info']('['+_0x3dedf8[_0x9e24('0x27')]()+_0x9e24('0x6a'),_0x5788cd[_0x9e24('0x30')]);return getTicket(_0x3536b7,_0x167d8f,_0x311dde,_0x5a5516,_0x5788cd,_0x932cd4,_0x3dedf8);})[_0x9e24('0x18')](function(_0x46179e){logger[_0x9e24('0x26')](util[_0x9e24('0x53')]('['+_0x3dedf8[_0x9e24('0x27')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x932cd4[_0x9e24('0x47')],_0x46179e[_0x9e24('0x52')]));logger['info'](util[_0x9e24('0x53')]('['+_0x3dedf8[_0x9e24('0x27')]()+_0x9e24('0x6b'),_0x3dedf8));if(_0x3dedf8!==_0x9e24('0x5a')&&_0x932cd4[_0x9e24('0x6c')]){logger['info']('['+_0x3dedf8['toUpperCase']()+']',_0x9e24('0x6d'));emit(_0x167d8f[_0x9e24('0xd')],_0x46cd18[_0x9e24('0x6e')],_0x932cd4[_0x9e24('0x47')],_0x46179e['ticketId']);}})[_0x9e24('0x1a')](function(_0x872ac4){logger['error']('['+_0x3dedf8[_0x9e24('0x27')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x872ac4['message']);console[_0x9e24('0x1b')](_0x9e24('0x6f'),_0x872ac4);});}; \ No newline at end of file +var _0x1dce=[']\x20Enduser\x20created!','forEach','includes','string','type','nameField','toLowerCase','substring','indexOf','content','ticketType','incidents','assign','getString','Subjects','/contacts(','phonecall','queue','callDirection','phonecalls','Descriptions','Fields','ticketId','format','user:%s','emit','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','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','md5','ioredis','dynamics365','redis','defaults','localhost','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','data5','clientId','username','password','clientSecret','then','access_token','catch','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','email','internalemailaddress','isdisabled','info','systemuserid','userId','length','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','body','headers','odata-entityid','lastIndexOf','enduserId','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing'];(function(_0x2c360d,_0x4889f1){var _0x14c7f0=function(_0x5182de){while(--_0x5182de){_0x2c360d['push'](_0x2c360d['shift']());}};_0x14c7f0(++_0x4889f1);}(_0x1dce,0x106));var _0xe1dc=function(_0x18c977,_0x5aaec9){_0x18c977=_0x18c977-0x0;var _0x38a276=_0x1dce[_0x18c977];return _0x38a276;};'use strict';var _=require(_0xe1dc('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require('./util');var md5=require(_0xe1dc('0x1'));var Redis=require(_0xe1dc('0x2'));var logger=require('../../../../config/logger')(_0xe1dc('0x3'));var config=require('../../../../config/environment');config[_0xe1dc('0x4')]=_[_0xe1dc('0x5')](config[_0xe1dc('0x4')],{'host':_0xe1dc('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x517871,_0x4d5df7,_0x156bab){if(_0x517871[_0xe1dc('0x7')]){_0x517871[_0xe1dc('0x8')]=_0x517871[_0xe1dc('0x9')]['data7'];_0x517871[_0xe1dc('0xa')]=_0x517871[_0xe1dc('0x9')][_0xe1dc('0xb')];return Promise['resolve'](_0x517871[_0xe1dc('0x9')][_0xe1dc('0xc')]);}var _0x32d9f5={'method':'POST','uri':_0x4d5df7,'form':{'client_id':_0x517871[_0xe1dc('0xd')],'resource':_0x517871[_0xe1dc('0x8')],'username':_0x517871[_0xe1dc('0xe')],'password':_0x517871[_0xe1dc('0xf')],'grant_type':'password','client_secret':_0x517871[_0xe1dc('0x10')]},'json':!![]};return rp(_0x32d9f5)[_0xe1dc('0x11')](function(_0x417d9d){return _0x417d9d[_0xe1dc('0x12')];})[_0xe1dc('0x13')](function(_0x35e4f){logger['error']('['+[_0x156bab[_0xe1dc('0x14')]()]+']\x20Wrong\x20credentials!');return _0x35e4f[_0xe1dc('0x15')];});}function getUser(_0x207813,_0xa0d751,_0x1f5e3a,_0x47cff2,_0x23f960,_0x658c3c){return new Promise(function(_0x38ceff,_0x4a66a6){return getAuthToken(_0xa0d751,_0x47cff2,_0x658c3c)['then'](function(_0x744f73){var _0x19208e={'method':_0xe1dc('0x16'),'uri':_0x23f960+_0xe1dc('0x17'),'headers':{'Authorization':_0xe1dc('0x18')+_0x744f73,'OData-Version':_0xe1dc('0x19')},'json':!![]};return rp(_0x19208e);})[_0xe1dc('0x11')](function(_0x575580){var _0x5e8b49=_0x575580[_0xe1dc('0x1a')];var _0x562e1f=![];var _0x13a39c=null;if(!_[_0xe1dc('0x1b')](_0x1f5e3a)){if(intUtil[_0xe1dc('0x1c')](_0x1f5e3a['email'])){_0x207813[_0xe1dc('0x1d')]=_0x1f5e3a[_0xe1dc('0x1e')];for(_0x13a39c=0x0;_0x13a39c<_0x5e8b49['length'];_0x13a39c++){if(_0x5e8b49[_0x13a39c][_0xe1dc('0x1f')]===_0x1f5e3a[_0xe1dc('0x1e')]&&!_0x5e8b49[_0x13a39c][_0xe1dc('0x20')]){_0x562e1f=!![];logger[_0xe1dc('0x21')]('['+[_0x658c3c[_0xe1dc('0x14')]()]+']\x20Agent\x20found\x20'+_0x5e8b49[_0x13a39c][_0xe1dc('0x22')]+'!');_0x207813[_0xe1dc('0x23')]=_0x5e8b49[_0x13a39c]['systemuserid'];}}}}if(!_0x562e1f){logger[_0xe1dc('0x21')]('['+[_0x658c3c[_0xe1dc('0x14')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x207813[_0xe1dc('0x1d')]=_0xa0d751[_0xe1dc('0xe')];for(_0x13a39c=0x0;_0x13a39c<_0x5e8b49[_0xe1dc('0x24')];_0x13a39c++){if(_0x5e8b49[_0x13a39c][_0xe1dc('0x1f')]===_0xa0d751[_0xe1dc('0xe')]){_0x207813[_0xe1dc('0x23')]=_0x5e8b49[_0x13a39c][_0xe1dc('0x22')];}}}_0x38ceff(_0x207813);})[_0xe1dc('0x13')](function(_0x3a3a60){_0x4a66a6(_0x3a3a60[_0xe1dc('0x15')]);});});}function createEndUser(_0x7c13db,_0x33c52a,_0x2e9622,_0x403380,_0x3dcd99,_0x363420,_0x201b5e){return new Promise(function(_0x2f506a,_0x267805){return getAuthToken(_0x33c52a,_0x2e9622,_0x363420)[_0xe1dc('0x11')](function(_0x4207d4){var _0x51d605=_0x363420['toLowerCase']()===_0xe1dc('0x25')?_0x3dcd99[_0xe1dc('0x26')]:_0x3dcd99[_0xe1dc('0x27')];var _0x3c6662={'method':_0xe1dc('0x28'),'uri':_0x403380+_0xe1dc('0x29'),'body':{'fullname':_0x51d605,'firstname':_0x51d605,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe1dc('0x2a')+_0x7c13db[_0xe1dc('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4207d4,'OData-Version':_0xe1dc('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x3c6662[_0xe1dc('0x2b')][_0x201b5e]=_0x51d605;return rp(_0x3c6662);})['then'](function(_0x2bb4d4){var _0x262b41=_0x2bb4d4[_0xe1dc('0x2c')][_0xe1dc('0x2d')];var _0x5a8767=_0x262b41['substring'](_0x262b41[_0xe1dc('0x2e')]('(')+0x1,_0x262b41['lastIndexOf'](')'));_0x7c13db[_0xe1dc('0x2f')]=_0x5a8767;_0x2f506a(_0x7c13db);})[_0xe1dc('0x13')](function(_0x331da3){_0x267805(_0x331da3[_0xe1dc('0x15')]);});});}function getEndUser(_0x792a67,_0x27161d,_0x1e4b23,_0x1449cf,_0x2e18de,_0x2f7d26,_0x28a23e,_0x2e4554){var _0x4fb450=_0x2f7d26['toLowerCase']()==='outbound'?_0x2e18de[_0xe1dc('0x26')]:_0x2e18de[_0xe1dc('0x27')];return getAuthToken(_0x27161d,_0x1e4b23,_0x2f7d26)[_0xe1dc('0x11')](function(_0x27c702){_0x2e4554=_0x2e4554?_0x2e4554:_0xe1dc('0x30');var _0x37936e={'method':'GET','uri':_0x1449cf+'contacts?$select='+_0x2e4554+_0xe1dc('0x31')+_0x2e4554+_0xe1dc('0x32')+_0x4fb450[_0xe1dc('0x33')]('+',_0xe1dc('0x34'))+'\x27','headers':{'Authorization':_0xe1dc('0x18')+_0x27c702,'If-None-Match':null,'OData-Version':_0xe1dc('0x19')},'json':!![]};return rp(_0x37936e);})[_0xe1dc('0x11')](function(_0x143c01){var _0x445fec=![];if(!_0x143c01)return _0x445fec;var _0x323392=_0x143c01[_0xe1dc('0x1a')];for(var _0x587d4d=0x0;_0x587d4d<_0x323392[_0xe1dc('0x24')];_0x587d4d++){if(_0x323392[_0x587d4d][_0x2e4554]===_0x4fb450){_0x445fec=!![];_0x792a67[_0xe1dc('0x2f')]=_0x323392[_0x587d4d][_0xe1dc('0x35')];}}return _0x445fec;})[_0xe1dc('0x11')](function(_0x3f4192){if(_0x3f4192)return _0x792a67;if(_0x28a23e===_0xe1dc('0x36')){logger[_0xe1dc('0x21')]('['+[_0x2f7d26[_0xe1dc('0x14')]()]+_0xe1dc('0x37'));return _0x792a67;}return createEndUser(_0x792a67,_0x27161d,_0x1e4b23,_0x1449cf,_0x2e18de,_0x2f7d26,_0x2e4554)['then'](function(_0x4a9ca9){logger[_0xe1dc('0x21')]('['+[_0x2f7d26[_0xe1dc('0x14')]()]+_0xe1dc('0x38'),_0x4a9ca9[_0xe1dc('0x2f')]);return _0x4a9ca9;});});}function getCustomFields(_0x29a3d0,_0x551e9e,_0x50020a){var _0x27c71={};if(_0x29a3d0['length']>0x0){_[_0xe1dc('0x39')](_0x29a3d0,function(_0x39dd63){if(_[_0xe1dc('0x3a')]([_0xe1dc('0x3b'),'picklist'],_0x39dd63[_0xe1dc('0x3c')])&&_0x39dd63[_0xe1dc('0x3d')]&&!_0x39dd63['customField']){var _0x234920=_0x39dd63['idField'][_0xe1dc('0x3e')]();var _0xf84e5d=_0x234920[_0xe1dc('0x3f')](0x0,_0x234920['indexOf']('_'));var _0x5cec84=_0x234920[_0xe1dc('0x3f')](_0x234920[_0xe1dc('0x40')]('_')+0x1);if(_0xf84e5d===_0x50020a){_0x27c71[_0x5cec84]=_0x39dd63[_0xe1dc('0x41')];}}});}return _0x27c71;}function getTicket(_0x4383f3,_0x3f9766,_0x3b20ab,_0x51a656,_0x5f464f,_0x5c69dc,_0xd6879a){return new Promise(function(_0x35cd4d,_0x588222){var _0x4784a8;return getAuthToken(_0x3f9766,_0x3b20ab,_0xd6879a)[_0xe1dc('0x11')](function(_0x495520){if(_0x5c69dc[_0xe1dc('0x42')]==='incident'){_0x4784a8={'method':'POST','uri':_0x51a656+_0xe1dc('0x43'),'body':Object[_0xe1dc('0x44')]({},{'title':intUtil[_0xe1dc('0x45')](_0x5c69dc[_0xe1dc('0x46')],_0x5f464f,'\x20'),'description':intUtil[_0xe1dc('0x45')](_0x5c69dc['Descriptions'],_0x5f464f,'\x0a'),'customerid_contact@odata.bind':_0x4383f3[_0xe1dc('0x2f')]?_0xe1dc('0x47')+_0x4383f3[_0xe1dc('0x2f')]+')':undefined,'ownerid@odata.bind':_0xe1dc('0x2a')+_0x4383f3['userId']+')','caseorigincode':'1'},getCustomFields(_0x5c69dc['Fields'],_0x5f464f,_0x5c69dc[_0xe1dc('0x42')])),'headers':{'Authorization':_0xe1dc('0x18')+_0x495520,'OData-Version':_0xe1dc('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5c69dc['ticketType']===_0xe1dc('0x48')){var _0x550cb7=_0x4383f3[_0xe1dc('0x2f')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4383f3[_0xe1dc('0x23')]+')','participationtypemask':_0x4383f3['callDirection']===_0xe1dc('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0xe1dc('0x47')+_0x4383f3[_0xe1dc('0x2f')]+')','participationtypemask':_0x4383f3[_0xe1dc('0x4a')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe1dc('0x2a')+_0x4383f3[_0xe1dc('0x23')]+')','participationtypemask':_0x4383f3[_0xe1dc('0x4a')]===_0xe1dc('0x49')?0x2:0x1}];_0x4784a8={'method':_0xe1dc('0x28'),'uri':_0x51a656+_0xe1dc('0x4b'),'body':Object[_0xe1dc('0x44')]({},{'subject':intUtil[_0xe1dc('0x45')](_0x5c69dc[_0xe1dc('0x46')],_0x5f464f,'\x20'),'phonenumber':String(_0x5f464f[_0xe1dc('0x27')]),'description':intUtil[_0xe1dc('0x45')](_0x5c69dc[_0xe1dc('0x4c')],_0x5f464f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4383f3['enduserId']?_0xe1dc('0x47')+_0x4383f3[_0xe1dc('0x2f')]+')':undefined,'ownerid@odata.bind':_0xe1dc('0x2a')+_0x4383f3[_0xe1dc('0x23')]+')','directioncode':_0x4383f3[_0xe1dc('0x4a')]==='queue'?![]:!![],'phonecall_activity_parties':_0x550cb7},getCustomFields(_0x5c69dc[_0xe1dc('0x4d')],_0x5f464f,_0x5c69dc['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x495520,'OData-Version':_0xe1dc('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4784a8);})[_0xe1dc('0x11')](function(_0x178ee8){var _0x1d14c4=_0x178ee8[_0xe1dc('0x2c')][_0xe1dc('0x2d')];var _0x486ada=_0x1d14c4[_0xe1dc('0x3f')](_0x1d14c4[_0xe1dc('0x2e')]('(')+0x1,_0x1d14c4[_0xe1dc('0x2e')](')'));_0x4383f3[_0xe1dc('0x4e')]=_0x486ada;_0x35cd4d(_0x4383f3);})[_0xe1dc('0x13')](function(_0x1181da){_0x588222(_0x1181da['message']);});});}function emit(_0x58710a,_0x2b9342,_0x23cd99,_0x12caa1){var _0x1a4034={'uri':util[_0xe1dc('0x4f')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x58710a,_0x23cd99,_0x12caa1)};io['to'](util[_0xe1dc('0x4f')](_0xe1dc('0x50'),_0x2b9342))[_0xe1dc('0x51')](_0xe1dc('0x52'),_0x1a4034);}exports['cs']=function(_0x306970,_0x2d41d5,_0x56ba61,_0x246fd8,_0x5a489e,_0x1f613d,_0x10568a,_0x387c93){var _0x529316={};_0x1f613d['remoteUri']=_0x1f613d[_0xe1dc('0x7')]?intUtil[_0xe1dc('0x53')](_0x1f613d['CloudProvider'][_0xe1dc('0x54')]):intUtil['stripTrailingSlash'](_0x1f613d[_0xe1dc('0x8')]);_0x1f613d[_0xe1dc('0x55')]=intUtil[_0xe1dc('0x53')](_0x1f613d['serverUrl']);_0x529316[_0xe1dc('0x4a')]=_0x387c93===_0xe1dc('0x49')||_0x387c93===_0xe1dc('0x56')?_0xe1dc('0x49'):'outbound';var _0xd45073=_0x1f613d[_0xe1dc('0x7')]?util[_0xe1dc('0x4f')]('%s/api/data/v9.0/',_0x1f613d[_0xe1dc('0x9')][_0xe1dc('0x54')]):util[_0xe1dc('0x4f')](_0xe1dc('0x57'),_0x1f613d[_0xe1dc('0x8')]);var _0x280aad=util[_0xe1dc('0x4f')]('https://login.microsoftonline.com/%s/oauth2/token',_0x1f613d['tenantId']);var _0x102f5e=util[_0xe1dc('0x4f')](_0xe1dc('0x58'),_0x1f613d['serverUrl'],_0x2d41d5['uniqueid'],md5(_0x2d41d5[_0xe1dc('0x59')]));if(_0x5a489e&&_0x5a489e[_0xe1dc('0x5a')]){logger[_0xe1dc('0x21')](_0xe1dc('0x5b'),'Recording\x20is\x20enabled!');_0x2d41d5[_0xe1dc('0x5c')]=_0x102f5e;}else if(_0x10568a&&_0x10568a['recordingFormat']&&_0x10568a[_0xe1dc('0x5d')]!==_0xe1dc('0x5e')){logger[_0xe1dc('0x21')]('[OUTBOUND]',_0xe1dc('0x5f'));_0x2d41d5['recordingURL']=_0x102f5e;}else{_0x2d41d5['recordingURL']='';}return getUser(_0x529316,_0x1f613d,_0x246fd8,_0x280aad,_0xd45073,_0x387c93)[_0xe1dc('0x11')](function(_0x3474e8){logger['info']('['+_0x387c93[_0xe1dc('0x14')]()+_0xe1dc('0x60'),_0x3474e8[_0xe1dc('0x23')]);logger[_0xe1dc('0x21')]('['+_0x387c93[_0xe1dc('0x14')]()+_0xe1dc('0x61'),_0x3474e8[_0xe1dc('0x1d')]);return getEndUser(_0x3474e8,_0x1f613d,_0x280aad,_0xd45073,_0x2d41d5,_0x387c93,_0x56ba61[_0xe1dc('0x62')],_0x56ba61['additionalSearchContact']);})[_0xe1dc('0x11')](function(_0x10b3ba){logger['info']('['+_0x387c93['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x10b3ba[_0xe1dc('0x2f')]);logger[_0xe1dc('0x21')]('['+_0x387c93[_0xe1dc('0x14')]()+_0xe1dc('0x63'),_0x2d41d5['calleridnum']);return getTicket(_0x10b3ba,_0x1f613d,_0x280aad,_0xd45073,_0x2d41d5,_0x56ba61,_0x387c93);})[_0xe1dc('0x11')](function(_0x1bd69b){logger['info'](util[_0xe1dc('0x4f')]('['+_0x387c93[_0xe1dc('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x56ba61[_0xe1dc('0x42')],_0x1bd69b[_0xe1dc('0x4e')]));logger['info'](util[_0xe1dc('0x4f')]('['+_0x387c93[_0xe1dc('0x14')]()+_0xe1dc('0x64'),_0x387c93));if(_0x387c93!==_0xe1dc('0x56')&&_0x56ba61['openNewTab']){logger[_0xe1dc('0x21')]('['+_0x387c93[_0xe1dc('0x14')]()+']',_0xe1dc('0x65'));emit(_0x1f613d[_0xe1dc('0x8')],_0x246fd8[_0xe1dc('0x66')],_0x56ba61[_0xe1dc('0x42')],_0x1bd69b[_0xe1dc('0x4e')]);}})['catch'](function(_0x308139){logger[_0xe1dc('0x67')]('['+_0x387c93[_0xe1dc('0x14')]()+_0xe1dc('0x68'),_0x308139[_0xe1dc('0x15')]);console[_0xe1dc('0x67')](_0xe1dc('0x69'),_0x308139);});}; \ 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 3dddc8c..8e78a05 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 _0x56b0=['request-promise','md5','ioredis','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','Subjects','getString','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','format','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','idField','variable','variableName','push','Variable','name','toLowerCase','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','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','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','catch','error','lastevent','lodash'];(function(_0x58d97a,_0x34ecfd){var _0x64558f=function(_0x103cba){while(--_0x103cba){_0x58d97a['push'](_0x58d97a['shift']());}};_0x64558f(++_0x34ecfd);}(_0x56b0,0x16f));var _0x056b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x056b('0x0'));var rp=require(_0x056b('0x1'));var md5=require(_0x056b('0x2'));var util=require('util');var Redis=require(_0x056b('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x056b('0x4'));config['redis']=_[_0x056b('0x5')](config[_0x056b('0x6')],{'host':_0x056b('0x7'),'port':0x18eb});var io=require(_0x056b('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0x056b('0x9'),'Accept':_0x056b('0x9')};function emit(_0xb0cd17,_0x8b4121,_0xc876f5){io['to'](_0xb0cd17)[_0x056b('0xa')](_0x8b4121,_0xc876f5);}function getTicket(_0x26d082,_0x53dde8,_0x36135f,_0x403ac8,_0x15a8d0){logger[_0x056b('0xb')](_0x056b('0xc'));var _0x1bec67=_[_0x056b('0xd')]({'responder_id':_0x53dde8['id'],'requester_id':_0x36135f['id'],'name':util['format'](_0x056b('0xe'),_0x15a8d0['calleridname']),'phone':_0x15a8d0[_0x056b('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x403ac8[_0x056b('0x10')],_0x15a8d0,'\x20'),'description':intUtil[_0x056b('0x11')](_0x403ac8[_0x056b('0x12')],_0x15a8d0,_0x056b('0x13')),'tags':getTags(_0x403ac8[_0x056b('0x14')],'name')},getCustomFields(_0x403ac8[_0x056b('0x15')],_0x15a8d0));_0x1bec67[_0x056b('0x16')]=_[_0x056b('0x17')](_[_0x056b('0x18')](_0x1bec67[_0x056b('0x16')],'id'),_0x056b('0x19'));return request({'uri':util[_0x056b('0x1a')]('%s/api/v2/tickets',_0x26d082[_0x056b('0x1b')]),'method':_0x056b('0x1c'),'body':_0x1bec67})['then'](function(_0x3e5ede){logger[_0x056b('0xb')](_0x056b('0x1d'));return _0x3e5ede;});}function getUser(_0x274f27,_0x134c3f){if(intUtil[_0x056b('0x1e')](_0x134c3f)){return request({'uri':util[_0x056b('0x1a')](_0x056b('0x1f'),_0x274f27[_0x056b('0x1b')]),'qs':{'email':_0x134c3f}})['then'](function(_0x563f7c){if(_0x563f7c[_0x056b('0x20')]){logger['info'](_0x056b('0x21'));return _[_0x056b('0x22')](_0x563f7c,function(_0xfc8c3b){return _0xfc8c3b[_0x056b('0x23')][_0x056b('0x24')]===_0x134c3f;});}else{logger[_0x056b('0xb')](_0x056b('0x25'));return request({'uri':util[_0x056b('0x1a')](_0x056b('0x26'),_0x274f27[_0x056b('0x1b')])})[_0x056b('0x27')](function(_0x23b890){logger[_0x056b('0xb')](_0x056b('0x28'));return _0x23b890;});}});}else{logger[_0x056b('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x056b('0x26'),_0x274f27[_0x056b('0x1b')])})[_0x056b('0x27')](function(_0x3cd65b){logger[_0x056b('0xb')](_0x056b('0x28'));return _0x3cd65b;});}}function getEndUser(_0x950da2,_0x28b8ac,_0x9dcb07){logger[_0x056b('0xb')](_0x056b('0x29'),_0x9dcb07);return request({'uri':util[_0x056b('0x1a')](_0x056b('0x2a'),_0x950da2['remoteUri']),'qs':{'phone':_0x9dcb07}})[_0x056b('0x27')](function(_0x47a7f9){if(_0x47a7f9[_0x056b('0x20')]){logger[_0x056b('0xb')]('Enduser\x20found!');return _['find'](_0x47a7f9,{'phone':_0x9dcb07});}else{logger[_0x056b('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x056b('0x1a')](_0x056b('0x2a'),_0x950da2[_0x056b('0x1b')]),'method':_0x056b('0x1c'),'body':{'name':_0x28b8ac,'phone':_0x9dcb07}})[_0x056b('0x27')](function(_0x3c15c8){logger[_0x056b('0xb')](_0x056b('0x2b'));return _0x3c15c8;});}});}function getAuth(_0x4873ed){return util['format'](_0x056b('0x2c'),new Buffer(_0x4873ed[_0x056b('0x2d')]+':X')[_0x056b('0x2e')](_0x056b('0x2f')));}function request(_0x378b4c){logger[_0x056b('0x30')](_0x056b('0x31'),JSON[_0x056b('0x32')](_0x378b4c));return rp(_[_0x056b('0x5')](_0x378b4c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x33630d,_0x2677a4){var _0x4bdce0=[];if(_0x33630d&&_0x33630d['length']>0x0){_0x4bdce0=_[_0x056b('0x33')](_0x33630d,_0x2677a4);}return _0x4bdce0;}function getCustomFields(_0x59fcfd,_0x473d5c){var _0x3187df=[];var _0x3bff3d={'custom_fields':[]};if(_0x59fcfd['length']>0x0){_[_0x056b('0x34')](_0x59fcfd,function(_0x44d072){if(_[_0x056b('0x35')]([_0x056b('0x36'),_0x056b('0x37')],_0x44d072[_0x056b('0x38')])&&_0x44d072[_0x056b('0x39')]&&!_0x44d072[_0x056b('0x3a')]){_0x3bff3d[_0x44d072[_0x056b('0x39')]['toLowerCase']()]=_0x44d072['content'][_0x056b('0x2e')]();}else if(_[_0x056b('0x35')]([_0x056b('0x36'),_0x056b('0x37')],_0x44d072['type'])&&_0x44d072[_0x056b('0x3b')]&&_0x44d072[_0x056b('0x3a')]){_0x3bff3d[_0x056b('0x16')]['push']({'id':_0x44d072['idField'],'value':_0x44d072['content'][_0x056b('0x2e')]()});}else if(_0x44d072['type']===_0x056b('0x3c')&&_0x44d072['variableName']&&_0x44d072[_0x056b('0x3b')]&&_0x44d072[_0x056b('0x3a')]){_0x473d5c[_0x44d072[_0x056b('0x3d')]]&&_0x3bff3d[_0x056b('0x16')][_0x056b('0x3e')]({'id':_0x44d072['idField'],'value':_0x473d5c[_0x44d072[_0x056b('0x3d')]]['toString']()});}else if(_0x44d072[_0x056b('0x38')]==='customVariable'&&_0x44d072[_0x056b('0x3f')]&&_0x44d072[_0x056b('0x3f')][_0x056b('0x40')]&&_0x44d072['idField']&&_0x44d072[_0x056b('0x3a')]){_0x473d5c[_0x44d072['Variable'][_0x056b('0x40')][_0x056b('0x41')]()]&&_0x3bff3d[_0x056b('0x16')]['push']({'id':_0x44d072[_0x056b('0x3b')],'value':_0x473d5c[_0x44d072[_0x056b('0x3f')][_0x056b('0x40')][_0x056b('0x41')]()][_0x056b('0x2e')]()});}});}return _0x3bff3d;}exports['queue']=function(_0x5a1dab,_0x3de3de,_0x54c163,_0xaabc19,_0x2bc66d,_0x2a167e){var _0x59a03b,_0x3898f8;_0x2a167e[_0x056b('0x1b')]=intUtil['stripTrailingSlash'](_0x2a167e['remoteUri']);_0x2a167e[_0x056b('0x42')]=intUtil[_0x056b('0x43')](_0x2a167e[_0x056b('0x42')]);if(_0x2bc66d&&_0x2bc66d[_0x056b('0x44')]){logger[_0x056b('0xb')](_0x056b('0x45'),'Recording\x20is\x20enabled!');_0x3de3de[_0x056b('0x46')]=util[_0x056b('0x1a')](_0x056b('0x47'),_0x2a167e[_0x056b('0x42')],_0x3de3de[_0x056b('0x48')],md5(_0x3de3de['uniqueid']));}else{_0x3de3de[_0x056b('0x46')]='';}headers[_0x056b('0x49')]=getAuth(_0x2a167e);return getUser(_0x2a167e,_0xaabc19[_0x056b('0x24')])[_0x056b('0x27')](function(_0x4a73a8){_0x59a03b=_0x4a73a8;logger['info'](_0x056b('0x4a'),_0x59a03b['id']);return getEndUser(_0x2a167e,_0x3de3de[_0x056b('0x4b')],_0x3de3de[_0x056b('0xf')]);})[_0x056b('0x27')](function(_0x1b4ecb){_0x3898f8=_0x1b4ecb;logger[_0x056b('0xb')](_0x056b('0x4c'),_0x3898f8['id']);return getTicket(_0x2a167e,_0x59a03b,_0x3898f8,_0x54c163,_0x3de3de);})['then'](function(_0x2ed93b){if(_0x2ed93b&&_0x2ed93b['id']){logger['info']('Ticket\x20created!');logger[_0x056b('0xb')](_0x056b('0x4d'),_0x2ed93b['id']);logger['info'](_0x056b('0x45'),_0x056b('0x4e'));emit(util[_0x056b('0x1a')](_0x056b('0x4f'),_0xaabc19[_0x056b('0x40')]),_0x056b('0x50'),{'uri':util[_0x056b('0x1a')](_0x056b('0x51'),_0x2a167e[_0x056b('0x1b')],_0x2ed93b['id'])});}})['catch'](function(_0x6f58ca){logger['error'](_0x056b('0x45'),JSON[_0x056b('0x32')](_0x6f58ca));});};exports[_0x056b('0x52')]=function(_0x242d78,_0x58f410,_0x48172f,_0x33d9de,_0x38c6a0,_0x17ea15,_0x42c38f){var _0x25541f,_0x6908c7;_0x17ea15['remoteUri']=intUtil[_0x056b('0x43')](_0x17ea15[_0x056b('0x1b')]);_0x17ea15['serverUrl']=intUtil[_0x056b('0x43')](_0x17ea15[_0x056b('0x42')]);if(_0x42c38f&&_0x42c38f[_0x056b('0x53')]&&_0x42c38f[_0x056b('0x53')]!==_0x056b('0x54')){logger[_0x056b('0xb')](_0x056b('0x55'),_0x056b('0x56'));_0x58f410['recordingURL']=util[_0x056b('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x17ea15['serverUrl'],_0x58f410[_0x056b('0x48')],md5(_0x58f410[_0x056b('0x48')]));}headers[_0x056b('0x49')]=getAuth(_0x17ea15);return getUser(_0x17ea15,_0x33d9de[_0x056b('0x24')])['then'](function(_0x2d92a3){_0x25541f=_0x2d92a3;logger[_0x056b('0xb')](_0x056b('0x4a'),_0x25541f['id']);return getEndUser(_0x17ea15,_0x58f410[_0x056b('0x57')],_0x58f410[_0x056b('0x58')]);})[_0x056b('0x27')](function(_0x386495){_0x6908c7=_0x386495;logger[_0x056b('0xb')](_0x056b('0x4c'),_0x6908c7['id']);return getTicket(_0x17ea15,_0x25541f,_0x6908c7,_0x48172f,_0x58f410);})['then'](function(_0x34800a){if(_0x34800a&&_0x34800a['id']){logger[_0x056b('0xb')](_0x056b('0x1d'));logger[_0x056b('0xb')]('The\x20Ticket\x20ID\x20is:',_0x34800a['id']);logger['info'](_0x056b('0x55'),_0x056b('0x4e'));emit(util['format'](_0x056b('0x4f'),_0x33d9de[_0x056b('0x40')]),_0x056b('0x50'),{'uri':util[_0x056b('0x1a')](_0x056b('0x51'),_0x17ea15[_0x056b('0x1b')],_0x34800a['id'])});}})[_0x056b('0x59')](function(_0x1c70aa){logger[_0x056b('0x5a')]('[OUTBOUND]',JSON[_0x056b('0x32')](_0x1c70aa));});};exports['unmanaged']=function(_0x43cea0,_0x181c80,_0x2a90b2,_0x32cef5,_0x1cdb14,_0x5c6d6d){var _0x1a5b38,_0x14b004;_0x5c6d6d['remoteUri']=intUtil['stripTrailingSlash'](_0x5c6d6d[_0x056b('0x1b')]);_0x5c6d6d['serverUrl']=intUtil[_0x056b('0x43')](_0x5c6d6d[_0x056b('0x42')]);if(_0x1cdb14&&_0x1cdb14[_0x056b('0x44')]){logger[_0x056b('0xb')]('['+_0x181c80[_0x056b('0x5b')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x181c80['recordingURL']=util['format'](_0x056b('0x47'),_0x5c6d6d[_0x056b('0x42')],_0x181c80[_0x056b('0x48')],md5(_0x181c80[_0x056b('0x48')]));}else{_0x181c80[_0x056b('0x46')]='';}headers['Authorization']=getAuth(_0x5c6d6d);return getUser(_0x5c6d6d,'')[_0x056b('0x27')](function(_0xbb4614){_0x1a5b38=_0xbb4614;logger[_0x056b('0xb')](_0x056b('0x4a'),_0x1a5b38['id']);return getEndUser(_0x5c6d6d,_0x181c80[_0x056b('0x4b')],_0x181c80[_0x056b('0xf')]);})[_0x056b('0x27')](function(_0x3f5aab){_0x14b004=_0x3f5aab;logger[_0x056b('0xb')](_0x056b('0x4c'),_0x14b004['id']);return getTicket(_0x5c6d6d,_0x1a5b38,_0x14b004,_0x2a90b2,_0x181c80);})[_0x056b('0x27')](function(_0x309451){if(_0x309451){logger['info'](_0x056b('0x1d'));logger[_0x056b('0xb')](_0x056b('0x4d'),_0x309451['id']);}})['catch'](function(_0x4fd797){logger[_0x056b('0x5a')]('['+_0x181c80['lastevent']['toUpperCase']()+']',JSON[_0x056b('0x32')](_0x4fd797));});}; \ No newline at end of file +var _0x3cb7=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','lodash','request-promise','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridnum','Subjects','getString','
','Tags','name','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','stringify','map','forEach','includes','string','picklist','nameField','customField','content','idField','type','variable','variableName','push','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x3cb7,0x11e));var _0x73cb=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x3cb7[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0x73cb('0x0'));var rp=require(_0x73cb('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x73cb('0x2'));var intUtil=require(_0x73cb('0x3'));var config=require('../../../../config/environment');var logger=require(_0x73cb('0x4'))(_0x73cb('0x5'));config[_0x73cb('0x6')]=_[_0x73cb('0x7')](config['redis'],{'host':_0x73cb('0x8'),'port':0x18eb});var io=require(_0x73cb('0x9'))(new Redis(config[_0x73cb('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x73cb('0xa')};function emit(_0x21b8f0,_0x54ea24,_0x2e04ca){io['to'](_0x21b8f0)[_0x73cb('0xb')](_0x54ea24,_0x2e04ca);}function getTicket(_0x4216c0,_0x2ae33b,_0x1242ce,_0x23d44f,_0xd968c5){logger[_0x73cb('0xc')](_0x73cb('0xd'));var _0x40606b=_['merge']({'responder_id':_0x2ae33b['id'],'requester_id':_0x1242ce['id'],'name':util['format'](_0x73cb('0xe'),_0xd968c5['calleridname']),'phone':_0xd968c5[_0x73cb('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x23d44f[_0x73cb('0x10')],_0xd968c5,'\x20'),'description':intUtil[_0x73cb('0x11')](_0x23d44f['Descriptions'],_0xd968c5,_0x73cb('0x12')),'tags':getTags(_0x23d44f[_0x73cb('0x13')],_0x73cb('0x14'))},getCustomFields(_0x23d44f['Fields'],_0xd968c5));_0x40606b[_0x73cb('0x15')]=_[_0x73cb('0x16')](_[_0x73cb('0x17')](_0x40606b[_0x73cb('0x15')],'id'),_0x73cb('0x18'));return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x1a'),_0x4216c0[_0x73cb('0x1b')]),'method':_0x73cb('0x1c'),'body':_0x40606b})['then'](function(_0x130031){logger[_0x73cb('0xc')](_0x73cb('0x1d'));return _0x130031;});}function getUser(_0x1b4526,_0x1439f7){if(intUtil[_0x73cb('0x1e')](_0x1439f7)){return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x1f'),_0x1b4526[_0x73cb('0x1b')]),'qs':{'email':_0x1439f7}})[_0x73cb('0x20')](function(_0x158355){if(_0x158355[_0x73cb('0x21')]){logger['info'](_0x73cb('0x22'));return _[_0x73cb('0x23')](_0x158355,function(_0x240a04){return _0x240a04[_0x73cb('0x24')][_0x73cb('0x25')]===_0x1439f7;});}else{logger[_0x73cb('0xc')](_0x73cb('0x26'));return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x27'),_0x1b4526[_0x73cb('0x1b')])})[_0x73cb('0x20')](function(_0x153367){logger[_0x73cb('0xc')]('Admin\x20account\x20selected.');return _0x153367;});}});}else{logger[_0x73cb('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x27'),_0x1b4526['remoteUri'])})[_0x73cb('0x20')](function(_0x2f7240){logger[_0x73cb('0xc')](_0x73cb('0x28'));return _0x2f7240;});}}function getEndUser(_0x195de2,_0x25ae8d,_0x325b0e){logger[_0x73cb('0xc')](_0x73cb('0x29'),_0x325b0e);return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x2a'),_0x195de2['remoteUri']),'qs':{'phone':_0x325b0e}})[_0x73cb('0x20')](function(_0x2fef25){if(_0x2fef25[_0x73cb('0x21')]){logger['info']('Enduser\x20found!');return _['find'](_0x2fef25,{'phone':_0x325b0e});}else{logger[_0x73cb('0xc')](_0x73cb('0x2b'));return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x2a'),_0x195de2[_0x73cb('0x1b')]),'method':_0x73cb('0x1c'),'body':{'name':_0x25ae8d,'phone':_0x325b0e}})['then'](function(_0x168f7f){logger[_0x73cb('0xc')](_0x73cb('0x2c'));return _0x168f7f;});}});}function getAuth(_0x2f8c6c){return util[_0x73cb('0x19')]('Basic\x20%s',new Buffer(_0x2f8c6c[_0x73cb('0x2d')]+':X')[_0x73cb('0x2e')]('base64'));}function request(_0x38cbf7){logger['debug']('[HTTP]',JSON[_0x73cb('0x2f')](_0x38cbf7));return rp(_[_0x73cb('0x7')](_0x38cbf7,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1eae76,_0xb2aa15){var _0x2921e3=[];if(_0x1eae76&&_0x1eae76[_0x73cb('0x21')]>0x0){_0x2921e3=_[_0x73cb('0x30')](_0x1eae76,_0xb2aa15);}return _0x2921e3;}function getCustomFields(_0x38b0c1,_0x28d95b){var _0x5756fe=[];var _0x1eed8d={'custom_fields':[]};if(_0x38b0c1[_0x73cb('0x21')]>0x0){_[_0x73cb('0x31')](_0x38b0c1,function(_0x5480ce){if(_[_0x73cb('0x32')]([_0x73cb('0x33'),_0x73cb('0x34')],_0x5480ce['type'])&&_0x5480ce[_0x73cb('0x35')]&&!_0x5480ce[_0x73cb('0x36')]){_0x1eed8d[_0x5480ce[_0x73cb('0x35')]['toLowerCase']()]=_0x5480ce[_0x73cb('0x37')][_0x73cb('0x2e')]();}else if(_[_0x73cb('0x32')]([_0x73cb('0x33'),_0x73cb('0x34')],_0x5480ce['type'])&&_0x5480ce['idField']&&_0x5480ce[_0x73cb('0x36')]){_0x1eed8d[_0x73cb('0x15')]['push']({'id':_0x5480ce[_0x73cb('0x38')],'value':_0x5480ce['content'][_0x73cb('0x2e')]()});}else if(_0x5480ce[_0x73cb('0x39')]===_0x73cb('0x3a')&&_0x5480ce[_0x73cb('0x3b')]&&_0x5480ce[_0x73cb('0x38')]&&_0x5480ce[_0x73cb('0x36')]){_0x28d95b[_0x5480ce['variableName']]&&_0x1eed8d[_0x73cb('0x15')][_0x73cb('0x3c')]({'id':_0x5480ce['idField'],'value':_0x28d95b[_0x5480ce['variableName']][_0x73cb('0x2e')]()});}else if(_0x5480ce['type']==='customVariable'&&_0x5480ce[_0x73cb('0x3d')]&&_0x5480ce[_0x73cb('0x3d')]['name']&&_0x5480ce[_0x73cb('0x38')]&&_0x5480ce[_0x73cb('0x36')]){_0x28d95b[_0x5480ce['Variable'][_0x73cb('0x14')][_0x73cb('0x3e')]()]&&_0x1eed8d['custom_fields']['push']({'id':_0x5480ce['idField'],'value':_0x28d95b[_0x5480ce['Variable']['name'][_0x73cb('0x3e')]()][_0x73cb('0x2e')]()});}});}return _0x1eed8d;}exports[_0x73cb('0x3f')]=function(_0x4040ff,_0x18f07e,_0x3b4184,_0x206a58,_0x331cbe,_0x103597){var _0x114df8,_0x5ddf8f;_0x103597[_0x73cb('0x1b')]=intUtil[_0x73cb('0x40')](_0x103597['remoteUri']);_0x103597[_0x73cb('0x41')]=intUtil[_0x73cb('0x40')](_0x103597[_0x73cb('0x41')]);if(_0x331cbe&&_0x331cbe[_0x73cb('0x42')]){logger[_0x73cb('0xc')](_0x73cb('0x43'),_0x73cb('0x44'));_0x18f07e[_0x73cb('0x45')]=util[_0x73cb('0x19')](_0x73cb('0x46'),_0x103597['serverUrl'],_0x18f07e[_0x73cb('0x47')],md5(_0x18f07e[_0x73cb('0x47')]));}else{_0x18f07e['recordingURL']='';}headers[_0x73cb('0x48')]=getAuth(_0x103597);return getUser(_0x103597,_0x206a58[_0x73cb('0x25')])[_0x73cb('0x20')](function(_0x4cf743){_0x114df8=_0x4cf743;logger['info'](_0x73cb('0x49'),_0x114df8['id']);return getEndUser(_0x103597,_0x18f07e[_0x73cb('0x4a')],_0x18f07e[_0x73cb('0xf')]);})['then'](function(_0x50d074){_0x5ddf8f=_0x50d074;logger['info'](_0x73cb('0x4b'),_0x5ddf8f['id']);return getTicket(_0x103597,_0x114df8,_0x5ddf8f,_0x3b4184,_0x18f07e);})['then'](function(_0x1ea6cf){if(_0x1ea6cf&&_0x1ea6cf['id']){logger['info']('Ticket\x20created!');logger[_0x73cb('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1ea6cf['id']);logger['info'](_0x73cb('0x43'),_0x73cb('0x4c'));emit(util[_0x73cb('0x19')](_0x73cb('0x4d'),_0x206a58['name']),_0x73cb('0x4e'),{'uri':util['format'](_0x73cb('0x4f'),_0x103597[_0x73cb('0x1b')],_0x1ea6cf['id'])});}})['catch'](function(_0x5a9ddb){logger[_0x73cb('0x50')]('[QUEUE]',JSON['stringify'](_0x5a9ddb));});};exports[_0x73cb('0x51')]=function(_0x393abd,_0x3fa95e,_0x199719,_0x4d120,_0x55a2be,_0x3ffdaa,_0x322a86){var _0x5b4ada,_0x5d425b;_0x3ffdaa[_0x73cb('0x1b')]=intUtil[_0x73cb('0x40')](_0x3ffdaa[_0x73cb('0x1b')]);_0x3ffdaa[_0x73cb('0x41')]=intUtil['stripTrailingSlash'](_0x3ffdaa[_0x73cb('0x41')]);if(_0x322a86&&_0x322a86[_0x73cb('0x52')]&&_0x322a86[_0x73cb('0x52')]!=='none'){logger[_0x73cb('0xc')](_0x73cb('0x53'),_0x73cb('0x44'));_0x3fa95e[_0x73cb('0x45')]=util[_0x73cb('0x19')](_0x73cb('0x46'),_0x3ffdaa[_0x73cb('0x41')],_0x3fa95e[_0x73cb('0x47')],md5(_0x3fa95e[_0x73cb('0x47')]));}headers[_0x73cb('0x48')]=getAuth(_0x3ffdaa);return getUser(_0x3ffdaa,_0x4d120[_0x73cb('0x25')])[_0x73cb('0x20')](function(_0x231a1c){_0x5b4ada=_0x231a1c;logger['info'](_0x73cb('0x49'),_0x5b4ada['id']);return getEndUser(_0x3ffdaa,_0x3fa95e[_0x73cb('0x54')],_0x3fa95e[_0x73cb('0x55')]);})[_0x73cb('0x20')](function(_0x2a6d5b){_0x5d425b=_0x2a6d5b;logger[_0x73cb('0xc')]('The\x20Enduser\x20ID\x20is:',_0x5d425b['id']);return getTicket(_0x3ffdaa,_0x5b4ada,_0x5d425b,_0x199719,_0x3fa95e);})[_0x73cb('0x20')](function(_0x4cc6a9){if(_0x4cc6a9&&_0x4cc6a9['id']){logger['info']('Ticket\x20created!');logger['info'](_0x73cb('0x56'),_0x4cc6a9['id']);logger[_0x73cb('0xc')]('[OUTBOUND]',_0x73cb('0x4c'));emit(util['format'](_0x73cb('0x4d'),_0x4d120['name']),'trigger:browser:url',{'uri':util[_0x73cb('0x19')](_0x73cb('0x4f'),_0x3ffdaa[_0x73cb('0x1b')],_0x4cc6a9['id'])});}})['catch'](function(_0x2a5ee8){logger['error']('[OUTBOUND]',JSON[_0x73cb('0x2f')](_0x2a5ee8));});};exports[_0x73cb('0x57')]=function(_0x12bdc1,_0xb7d0e4,_0x4a80d2,_0x2398e3,_0x28bd5b,_0x1b7583){var _0x99be76,_0x530cd6;_0x1b7583[_0x73cb('0x1b')]=intUtil[_0x73cb('0x40')](_0x1b7583[_0x73cb('0x1b')]);_0x1b7583['serverUrl']=intUtil[_0x73cb('0x40')](_0x1b7583[_0x73cb('0x41')]);if(_0x28bd5b&&_0x28bd5b[_0x73cb('0x42')]){logger['info']('['+_0xb7d0e4['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xb7d0e4['recordingURL']=util[_0x73cb('0x19')](_0x73cb('0x46'),_0x1b7583[_0x73cb('0x41')],_0xb7d0e4[_0x73cb('0x47')],md5(_0xb7d0e4[_0x73cb('0x47')]));}else{_0xb7d0e4['recordingURL']='';}headers[_0x73cb('0x48')]=getAuth(_0x1b7583);return getUser(_0x1b7583,'')['then'](function(_0x2694aa){_0x99be76=_0x2694aa;logger[_0x73cb('0xc')](_0x73cb('0x49'),_0x99be76['id']);return getEndUser(_0x1b7583,_0xb7d0e4[_0x73cb('0x4a')],_0xb7d0e4[_0x73cb('0xf')]);})[_0x73cb('0x20')](function(_0x1890de){_0x530cd6=_0x1890de;logger[_0x73cb('0xc')]('The\x20Enduser\x20ID\x20is:',_0x530cd6['id']);return getTicket(_0x1b7583,_0x99be76,_0x530cd6,_0x4a80d2,_0xb7d0e4);})[_0x73cb('0x20')](function(_0x389710){if(_0x389710){logger[_0x73cb('0xc')]('Ticket\x20created!');logger[_0x73cb('0xc')](_0x73cb('0x56'),_0x389710['id']);}})['catch'](function(_0x3c53bc){logger[_0x73cb('0x50')]('['+_0xb7d0e4[_0x73cb('0x58')]['toUpperCase']()+']',JSON[_0x73cb('0x2f')](_0x3c53bc));});}; \ 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 34ffc01..9acf005 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 _0x368c=['defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','agentEmail','userEmail','email','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','find','contacts','format','contactNumber','mobile_number','endUserId','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis'];(function(_0x26234e,_0x5f35da){var _0x547c65=function(_0x3dad57){while(--_0x3dad57){_0x26234e['push'](_0x26234e['shift']());}};_0x547c65(++_0x5f35da);}(_0x368c,0x8f));var _0xc368=function(_0x20717d,_0x5b0cbf){_0x20717d=_0x20717d-0x0;var _0x444002=_0x368c[_0x20717d];return _0x444002;};'use strict';var _=require(_0xc368('0x0'));var rp=require(_0xc368('0x1'));var md5=require(_0xc368('0x2'));var util=require(_0xc368('0x3'));var moment=require(_0xc368('0x4'));var Promise=require(_0xc368('0x5'));var Redis=require(_0xc368('0x6'));var intUtil=require(_0xc368('0x7'));var config=require('../../../../config/environment');var logger=require(_0xc368('0x8'))(_0xc368('0x9'));config[_0xc368('0xa')]=_[_0xc368('0xb')](config['redis'],{'host':_0xc368('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc368('0xa')]));function getAdminId(_0x691481,_0x3ff25f,_0x5e6c9f,_0x57c637){return new Promise(function(_0x265555,_0x48d172){var _0x4dca5a=![];var _0x3a7949={'method':_0xc368('0xd'),'uri':_0x57c637+_0xc368('0xe'),'json':!![]};_0x3a7949[_0xc368('0xf')]=_0x5e6c9f;logger[_0xc368('0x10')](_0xc368('0x11'));return rp(_0x3a7949)[_0xc368('0x12')](function(_0x18a883){if(_0x18a883){var _0x3f5248=_0x18a883[_0xc368('0x13')];var _0x153590=null;for(_0x153590=0x0;_0x153590<_0x3f5248[_0xc368('0x14')];_0x153590++){if(_0x3f5248[_0x153590]['email']===_0x691481[_0xc368('0x15')]){_0x691481[_0xc368('0x16')]=_0x3f5248[_0x153590]['id'];_0x4dca5a=!![];}}if(_0x4dca5a){logger[_0xc368('0x10')](_0xc368('0x17'),_0x691481[_0xc368('0x16')]);_0x265555(_0x691481);}else{_0x48d172({'statusCode':0x194,'message':_0xc368('0x18')});}}else{_0x48d172({'statusCode':0x194,'message':_0xc368('0x18')});}})[_0xc368('0x19')](function(_0x3ef846){logger[_0xc368('0x1a')]('['+[_0x3ff25f[_0xc368('0x1b')]()]+']',_0x3ef846[_0xc368('0x1c')]);_0x48d172(_0x3ef846);});});}function getUser(_0x58e142,_0x33e621,_0x2e28ab){return function(_0x3abc2e){return new Promise(function(_0x504733,_0x46a1c1){var _0x489f27={'method':'GET','uri':_0x2e28ab+_0xc368('0xe'),'json':!![]};_0x489f27['headers']=_0x33e621;logger[_0xc368('0x10')]('Getting\x20user\x20list');return rp(_0x489f27)[_0xc368('0x12')](function(_0x55b898){if(_0x55b898){var _0x7d9840=_0x55b898[_0xc368('0x13')];var _0x27e36f=![];var _0x3843df=null;if(_0x3abc2e[_0xc368('0x1d')]!==null){logger[_0xc368('0x10')]('Getting\x20user\x20with\x20email',_0x3abc2e[_0xc368('0x1d')]);_0x3abc2e[_0xc368('0x1e')]=_0x3abc2e[_0xc368('0x1d')];for(_0x3843df=0x0;_0x3843df<_0x7d9840[_0xc368('0x14')];_0x3843df++){if(_0x7d9840[_0x3843df][_0xc368('0x1f')]===_0x3abc2e[_0xc368('0x1d')]){_0x27e36f=!![];_0x3abc2e['userId']=_0x7d9840[_0x3843df]['id'];logger[_0xc368('0x10')](_0xc368('0x20'),_0x3abc2e[_0xc368('0x21')]);}}}if(!_0x27e36f){logger['info'](_0xc368('0x22'));_0x3abc2e['userEmail']=_0x3abc2e['adminEmail'];_0x3abc2e[_0xc368('0x21')]=_0x3abc2e['adminId'];_0x27e36f=!![];}if(_0x27e36f){_0x504733(_0x3abc2e);}else{_0x46a1c1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x46a1c1({'statusCode':0x194,'message':_0xc368('0x18')});}})[_0xc368('0x19')](function(_0x361143){logger[_0xc368('0x1a')]('['+[_0x58e142[_0xc368('0x1b')]()]+']',_0x361143[_0xc368('0x1c')]);_0x46a1c1(_0x361143);});});};}function searchContact(_0x3c2f21,_0x16df1b,_0x212e5c,_0x4c8c3a){return new Promise(function(_0x4e1b99,_0x50d99b){var _0x4cd825={'method':_0xc368('0xd'),'headers':_0x16df1b,'uri':_0x3c2f21+_0xc368('0x23')+_0x4c8c3a+'&f='+_0x212e5c+'&entities=contact','json':!![]};rp(_0x4cd825)['then'](function(_0xb251f6){var _0x1f38b7=_[_0xc368('0x24')](_0xb251f6[_0xc368('0x25')][_0xc368('0x25')],[_0x212e5c,_0x4c8c3a]);_0x4e1b99(_0x1f38b7);})[_0xc368('0x19')](function(_0x54426c){_0x50d99b(_0x54426c);});});}function getEndUser(_0x2e22ee,_0x52a056,_0xd208f){return function(_0x51ed9e){return new Promise(function(_0x157a24,_0x399783){logger[_0xc368('0x10')](util[_0xc368('0x26')]('Searching\x20contact\x20with\x20phone\x20%s',_0x51ed9e[_0xc368('0x27')]));searchContact(_0xd208f,_0x52a056,_0xc368('0x28'),_0x51ed9e['contactNumber'])[_0xc368('0x12')](function(_0x263278){if(_0x263278){_0x51ed9e[_0xc368('0x29')]=_0x263278['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x51ed9e[_0xc368('0x29')]);return _0x157a24(_0x51ed9e);}searchContact(_0xd208f,_0x52a056,_0xc368('0x2a'),_0x51ed9e[_0xc368('0x27')])[_0xc368('0x12')](function(_0x1a43ee){if(_0x1a43ee){_0x51ed9e[_0xc368('0x29')]=_0x1a43ee['id'];logger[_0xc368('0x10')]('Contact\x20found\x20work_number:',_0x51ed9e[_0xc368('0x29')]);return _0x157a24(_0x51ed9e);}createEndUser(_0x51ed9e,_0x2e22ee,_0x52a056,_0xd208f)[_0xc368('0x12')](function(_0x1d4a67){logger['info'](_0xc368('0x2b'),_0x1d4a67[_0xc368('0x29')]);return _0x157a24(_0x1d4a67);});});})[_0xc368('0x19')](function(_0x567441){_0x399783(_0x567441);});});};}function createEndUser(_0x463200,_0x4568a0,_0x35c589,_0x36f46b){return new Promise(function(_0x5e64f1,_0x4eeb62){var _0x2caf01=moment();var _0xb390ca={'method':_0xc368('0x2c'),'uri':_0x36f46b+_0xc368('0x2d'),'body':{'contact':{'last_name':_0x463200['contactNumber'],'work_number':_0x463200['contactNumber'],'mobile_number':_0x463200[_0xc368('0x27')],'owner_id':_0x463200[_0xc368('0x21')],'created_at':_0x2caf01[_0xc368('0x26')](_0xc368('0x2e'))}},'json':!![]};_0xb390ca[_0xc368('0xf')]=_0x35c589;logger['info'](_0xc368('0x2f'));return rp(_0xb390ca)[_0xc368('0x12')](function(_0x48390b){_0x463200['endUserId']=_0x48390b['contact']['id'];_0x5e64f1(_0x463200);})['catch'](function(_0x58a1fe){logger[_0xc368('0x1a')]('['+[_0x4568a0[_0xc368('0x1b')]()]+']',_0x58a1fe[_0xc368('0x1c')]);_0x4eeb62(_0x58a1fe['message']);});});}function getTicket(_0x63538,_0x10d648,_0x40c651,_0xed3a33,_0x531c55){return function(_0x427760){logger[_0xc368('0x10')](_0xc368('0x30'));return new Promise(function(_0x38f90e,_0x51e9c7){var _0x1802cf=moment();var _0x44a069={'method':_0xc368('0x2c'),'uri':_0x40c651+_0xc368('0x31'),'body':{'title':intUtil[_0xc368('0x32')](_0xed3a33[_0xc368('0x33')],_0x531c55,'\x20'),'description':intUtil['getString'](_0xed3a33[_0xc368('0x34')],_0x531c55,'\x0a'),'owner_id':_0x427760[_0xc368('0x21')],'creater_id':_0x427760[_0xc368('0x16')],'targetable_id':_0x427760[_0xc368('0x29')],'targetable_type':'Contact','created_at':_0x1802cf[_0xc368('0x26')](_0xc368('0x2e')),'due_date':_0x1802cf[_0xc368('0x35')](0x1e,'m')['format'](_0xc368('0x2e'))},'json':!![]};_0x44a069[_0xc368('0xf')]=_0x10d648;return rp(_0x44a069)['then'](function(_0x4b7d74){_0x427760[_0xc368('0x36')]=_0x4b7d74[_0xc368('0x37')]['id'];logger[_0xc368('0x10')](_0xc368('0x38'),_0x427760[_0xc368('0x36')]);_0x38f90e(_0x427760);})[_0xc368('0x19')](function(_0xa67c3e){logger['error']('['+[_0x63538['toUpperCase']()]+']',_0xa67c3e['message']);_0x51e9c7(_0xa67c3e[_0xc368('0x1c')]);});});};}function emit(_0x35abb4,_0x313fab,_0x7030e6){var _0x5152af={'uri':_0x35abb4+'/contacts/'+_0x7030e6};io['to'](util[_0xc368('0x26')]('user:%s',_0x313fab))[_0xc368('0x39')](_0xc368('0x3a'),_0x5152af);}exports['cs']=function(_0x5166d2,_0x4e71b2,_0x525eac,_0x59c5f6,_0x42aece,_0x3998b2,_0x13fd2e,_0x49cced){var _0x5e1563={};var _0x30a509={'Authorization':'Token\x20token='+_0x3998b2['apiKey']};_0x3998b2[_0xc368('0x3b')]=intUtil[_0xc368('0x3c')](_0x3998b2['remoteUri']);_0x3998b2[_0xc368('0x3d')]=intUtil[_0xc368('0x3c')](_0x3998b2['serverUrl']);var _0xbd15be=_0x3998b2[_0xc368('0x3b')];_0x5e1563[_0xc368('0x15')]=_0x3998b2[_0xc368('0x3e')];_0x5e1563['contactNumber']=_0x49cced[_0xc368('0x3f')]()===_0xc368('0x40')?_0x4e71b2['destcalleridnum']:_0x4e71b2['calleridnum'];_0x5e1563[_0xc368('0x41')]=_0x49cced===_0xc368('0x42')||_0x49cced===_0xc368('0x43')?_0xc368('0x42'):'outbound';if(_0x59c5f6){_0x5e1563[_0xc368('0x1d')]=_0x59c5f6['email'];}var _0x49619f=util[_0xc368('0x26')](_0xc368('0x44'),_0x3998b2[_0xc368('0x3d')],_0x4e71b2[_0xc368('0x45')],md5(_0x4e71b2[_0xc368('0x45')]));if(_0x42aece&&_0x42aece[_0xc368('0x46')]){logger[_0xc368('0x10')]('[QUEUE]',_0xc368('0x47'));_0x4e71b2['recordingURL']=_0x49619f;}else if(_0x13fd2e&&_0x13fd2e[_0xc368('0x48')]&&_0x13fd2e[_0xc368('0x48')]!==_0xc368('0x49')){logger['info'](_0xc368('0x4a'),_0xc368('0x47'));_0x4e71b2['recordingURL']=_0x49619f;}else{_0x4e71b2['recordingURL']='';}return getAdminId(_0x5e1563,_0x49cced,_0x30a509,_0xbd15be)[_0xc368('0x12')](getUser(_0x49cced,_0x30a509,_0xbd15be))[_0xc368('0x12')](getEndUser(_0x49cced,_0x30a509,_0xbd15be))['then'](getTicket(_0x49cced,_0x30a509,_0xbd15be,_0x525eac,_0x4e71b2))['then'](function(_0x2352c0){logger[_0xc368('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x2352c0[_0xc368('0x36')]));if(_0x49cced!==_0xc368('0x43')){logger[_0xc368('0x10')]('['+[_0x49cced[_0xc368('0x1b')]()]+']',_0xc368('0x4b'));emit(_0xbd15be,_0x59c5f6['name'],_0x2352c0['endUserId']);}})['catch'](function(_0x2ff44f){logger[_0xc368('0x1a')]('['+[_0x49cced[_0xc368('0x1b')]()]+_0xc368('0x4c'),util['inspect'](_0x2ff44f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9ae8=['Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','message','/api/lookup?q=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Contact','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]'];(function(_0x5a9a42,_0x5ee951){var _0x247f61=function(_0x3744d5){while(--_0x3744d5){_0x5a9a42['push'](_0x5a9a42['shift']());}};_0x247f61(++_0x5ee951);}(_0x9ae8,0x1b6));var _0x89ae=function(_0x3a293e,_0x5c56f5){_0x3a293e=_0x3a293e-0x0;var _0x18a51a=_0x9ae8[_0x3a293e];return _0x18a51a;};'use strict';var _=require(_0x89ae('0x0'));var rp=require('request-promise');var md5=require(_0x89ae('0x1'));var util=require(_0x89ae('0x2'));var moment=require(_0x89ae('0x3'));var Promise=require('bluebird');var Redis=require(_0x89ae('0x4'));var intUtil=require(_0x89ae('0x5'));var config=require(_0x89ae('0x6'));var logger=require(_0x89ae('0x7'))(_0x89ae('0x8'));config[_0x89ae('0x9')]=_['defaults'](config[_0x89ae('0x9')],{'host':_0x89ae('0xa'),'port':0x18eb});var io=require(_0x89ae('0xb'))(new Redis(config[_0x89ae('0x9')]));function getAdminId(_0x1d7eed,_0x14c085,_0x4f6645,_0x5a00ac){return new Promise(function(_0x2af70f,_0x3512c0){var _0x32466b=![];var _0x460766={'method':_0x89ae('0xc'),'uri':_0x5a00ac+'/api/selector/owners','json':!![]};_0x460766[_0x89ae('0xd')]=_0x4f6645;logger[_0x89ae('0xe')](_0x89ae('0xf'));return rp(_0x460766)[_0x89ae('0x10')](function(_0x5808cf){if(_0x5808cf){var _0x4b0edb=_0x5808cf[_0x89ae('0x11')];var _0x2cb57f=null;for(_0x2cb57f=0x0;_0x2cb57f<_0x4b0edb[_0x89ae('0x12')];_0x2cb57f++){if(_0x4b0edb[_0x2cb57f][_0x89ae('0x13')]===_0x1d7eed[_0x89ae('0x14')]){_0x1d7eed[_0x89ae('0x15')]=_0x4b0edb[_0x2cb57f]['id'];_0x32466b=!![];}}if(_0x32466b){logger['info'](_0x89ae('0x16'),_0x1d7eed['adminId']);_0x2af70f(_0x1d7eed);}else{_0x3512c0({'statusCode':0x194,'message':_0x89ae('0x17')});}}else{_0x3512c0({'statusCode':0x194,'message':_0x89ae('0x17')});}})[_0x89ae('0x18')](function(_0x3fd86f){logger[_0x89ae('0x19')]('['+[_0x14c085[_0x89ae('0x1a')]()]+']',_0x3fd86f['message']);_0x3512c0(_0x3fd86f);});});}function getUser(_0x321979,_0x5b8fda,_0x375582){return function(_0x4770a1){return new Promise(function(_0xc328ca,_0x2c8b1b){var _0x4e15af={'method':_0x89ae('0xc'),'uri':_0x375582+_0x89ae('0x1b'),'json':!![]};_0x4e15af[_0x89ae('0xd')]=_0x5b8fda;logger[_0x89ae('0xe')](_0x89ae('0x1c'));return rp(_0x4e15af)['then'](function(_0x30585e){if(_0x30585e){var _0x6919d8=_0x30585e[_0x89ae('0x11')];var _0x42c3f3=![];var _0x19cd7b=null;if(_0x4770a1[_0x89ae('0x1d')]!==null){logger[_0x89ae('0xe')](_0x89ae('0x1e'),_0x4770a1[_0x89ae('0x1d')]);_0x4770a1[_0x89ae('0x1f')]=_0x4770a1[_0x89ae('0x1d')];for(_0x19cd7b=0x0;_0x19cd7b<_0x6919d8[_0x89ae('0x12')];_0x19cd7b++){if(_0x6919d8[_0x19cd7b][_0x89ae('0x13')]===_0x4770a1[_0x89ae('0x1d')]){_0x42c3f3=!![];_0x4770a1[_0x89ae('0x20')]=_0x6919d8[_0x19cd7b]['id'];logger[_0x89ae('0xe')](_0x89ae('0x21'),_0x4770a1[_0x89ae('0x20')]);}}}if(!_0x42c3f3){logger[_0x89ae('0xe')](_0x89ae('0x22'));_0x4770a1[_0x89ae('0x1f')]=_0x4770a1[_0x89ae('0x14')];_0x4770a1[_0x89ae('0x20')]=_0x4770a1[_0x89ae('0x15')];_0x42c3f3=!![];}if(_0x42c3f3){_0xc328ca(_0x4770a1);}else{_0x2c8b1b({'statusCode':0x194,'message':_0x89ae('0x17')});}}else{_0x2c8b1b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x89ae('0x18')](function(_0x78b00){logger[_0x89ae('0x19')]('['+[_0x321979[_0x89ae('0x1a')]()]+']',_0x78b00[_0x89ae('0x23')]);_0x2c8b1b(_0x78b00);});});};}function searchContact(_0x2d5155,_0x50cc27,_0x3fe33d,_0x2fc4a3){return new Promise(function(_0x5537ed,_0x34a76a){var _0x5c93d1={'method':_0x89ae('0xc'),'headers':_0x50cc27,'uri':_0x2d5155+_0x89ae('0x24')+_0x2fc4a3+'&f='+_0x3fe33d+'&entities=contact','json':!![]};rp(_0x5c93d1)['then'](function(_0x3b5f52){var _0x2d1322=_[_0x89ae('0x25')](_0x3b5f52[_0x89ae('0x26')][_0x89ae('0x26')],[_0x3fe33d,_0x2fc4a3]);_0x5537ed(_0x2d1322);})[_0x89ae('0x18')](function(_0x577d1a){_0x34a76a(_0x577d1a);});});}function getEndUser(_0x27aabe,_0x2e5c91,_0x3db1fa){return function(_0x484385){return new Promise(function(_0x651e7,_0x401309){logger['info'](util['format'](_0x89ae('0x27'),_0x484385[_0x89ae('0x28')]));searchContact(_0x3db1fa,_0x2e5c91,_0x89ae('0x29'),_0x484385['contactNumber'])[_0x89ae('0x10')](function(_0x5f5da5){if(_0x5f5da5){_0x484385[_0x89ae('0x2a')]=_0x5f5da5['id'];logger[_0x89ae('0xe')](_0x89ae('0x2b'),_0x484385['endUserId']);return _0x651e7(_0x484385);}searchContact(_0x3db1fa,_0x2e5c91,'work_number',_0x484385['contactNumber'])['then'](function(_0x45edc8){if(_0x45edc8){_0x484385[_0x89ae('0x2a')]=_0x45edc8['id'];logger['info'](_0x89ae('0x2c'),_0x484385[_0x89ae('0x2a')]);return _0x651e7(_0x484385);}createEndUser(_0x484385,_0x27aabe,_0x2e5c91,_0x3db1fa)[_0x89ae('0x10')](function(_0x4304dd){logger[_0x89ae('0xe')](_0x89ae('0x2d'),_0x4304dd[_0x89ae('0x2a')]);return _0x651e7(_0x4304dd);});});})[_0x89ae('0x18')](function(_0x59cef2){_0x401309(_0x59cef2);});});};}function createEndUser(_0xeccd50,_0x5178df,_0x1aedab,_0x1d1c21){return new Promise(function(_0x2da14c,_0x1c26a2){var _0x1c3ba9=moment();var _0x50c506={'method':_0x89ae('0x2e'),'uri':_0x1d1c21+_0x89ae('0x2f'),'body':{'contact':{'last_name':_0xeccd50[_0x89ae('0x28')],'work_number':_0xeccd50[_0x89ae('0x28')],'mobile_number':_0xeccd50['contactNumber'],'owner_id':_0xeccd50[_0x89ae('0x20')],'created_at':_0x1c3ba9[_0x89ae('0x30')](_0x89ae('0x31'))}},'json':!![]};_0x50c506[_0x89ae('0xd')]=_0x1aedab;logger[_0x89ae('0xe')](_0x89ae('0x32'));return rp(_0x50c506)[_0x89ae('0x10')](function(_0x2508ee){_0xeccd50[_0x89ae('0x2a')]=_0x2508ee[_0x89ae('0x33')]['id'];_0x2da14c(_0xeccd50);})[_0x89ae('0x18')](function(_0x531e85){logger[_0x89ae('0x19')]('['+[_0x5178df['toUpperCase']()]+']',_0x531e85[_0x89ae('0x23')]);_0x1c26a2(_0x531e85[_0x89ae('0x23')]);});});}function getTicket(_0x5ae42f,_0x46cfe9,_0x2a8774,_0x33602b,_0xe7fb4d){return function(_0x200dea){logger[_0x89ae('0xe')](_0x89ae('0x34'));return new Promise(function(_0x594449,_0x4a5219){var _0x58b4e0=moment();var _0x2fc8d4={'method':_0x89ae('0x2e'),'uri':_0x2a8774+'/api/tasks','body':{'title':intUtil[_0x89ae('0x35')](_0x33602b[_0x89ae('0x36')],_0xe7fb4d,'\x20'),'description':intUtil['getString'](_0x33602b['Descriptions'],_0xe7fb4d,'\x0a'),'owner_id':_0x200dea[_0x89ae('0x20')],'creater_id':_0x200dea[_0x89ae('0x15')],'targetable_id':_0x200dea[_0x89ae('0x2a')],'targetable_type':_0x89ae('0x37'),'created_at':_0x58b4e0['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x58b4e0[_0x89ae('0x38')](0x1e,'m')[_0x89ae('0x30')](_0x89ae('0x31'))},'json':!![]};_0x2fc8d4[_0x89ae('0xd')]=_0x46cfe9;return rp(_0x2fc8d4)[_0x89ae('0x10')](function(_0x33d2d2){_0x200dea[_0x89ae('0x39')]=_0x33d2d2[_0x89ae('0x3a')]['id'];logger['info']('Task\x20created:',_0x200dea[_0x89ae('0x39')]);_0x594449(_0x200dea);})[_0x89ae('0x18')](function(_0x3d7063){logger[_0x89ae('0x19')]('['+[_0x5ae42f['toUpperCase']()]+']',_0x3d7063[_0x89ae('0x23')]);_0x4a5219(_0x3d7063[_0x89ae('0x23')]);});});};}function emit(_0x632411,_0x4f9338,_0x413f85){var _0x4d93df={'uri':_0x632411+_0x89ae('0x3b')+_0x413f85};io['to'](util[_0x89ae('0x30')](_0x89ae('0x3c'),_0x4f9338))[_0x89ae('0x3d')](_0x89ae('0x3e'),_0x4d93df);}exports['cs']=function(_0x5af158,_0x3a2d1f,_0x588c8b,_0x19cddd,_0x4e15fb,_0x184580,_0x4d8651,_0x35d060){var _0x22db58={};var _0xa8987c={'Authorization':_0x89ae('0x3f')+_0x184580['apiKey']};_0x184580[_0x89ae('0x40')]=intUtil[_0x89ae('0x41')](_0x184580[_0x89ae('0x40')]);_0x184580[_0x89ae('0x42')]=intUtil[_0x89ae('0x41')](_0x184580[_0x89ae('0x42')]);var _0x1e67f1=_0x184580[_0x89ae('0x40')];_0x22db58[_0x89ae('0x14')]=_0x184580[_0x89ae('0x43')];_0x22db58[_0x89ae('0x28')]=_0x35d060['toLowerCase']()==='outbound'?_0x3a2d1f[_0x89ae('0x44')]:_0x3a2d1f[_0x89ae('0x45')];_0x22db58[_0x89ae('0x46')]=_0x35d060===_0x89ae('0x47')||_0x35d060===_0x89ae('0x48')?_0x89ae('0x47'):_0x89ae('0x49');if(_0x19cddd){_0x22db58[_0x89ae('0x1d')]=_0x19cddd[_0x89ae('0x13')];}var _0x69187=util['format'](_0x89ae('0x4a'),_0x184580['serverUrl'],_0x3a2d1f[_0x89ae('0x4b')],md5(_0x3a2d1f[_0x89ae('0x4b')]));if(_0x4e15fb&&_0x4e15fb[_0x89ae('0x4c')]){logger['info'](_0x89ae('0x4d'),_0x89ae('0x4e'));_0x3a2d1f[_0x89ae('0x4f')]=_0x69187;}else if(_0x4d8651&&_0x4d8651[_0x89ae('0x50')]&&_0x4d8651[_0x89ae('0x50')]!=='none'){logger[_0x89ae('0xe')](_0x89ae('0x51'),_0x89ae('0x4e'));_0x3a2d1f['recordingURL']=_0x69187;}else{_0x3a2d1f[_0x89ae('0x4f')]='';}return getAdminId(_0x22db58,_0x35d060,_0xa8987c,_0x1e67f1)[_0x89ae('0x10')](getUser(_0x35d060,_0xa8987c,_0x1e67f1))[_0x89ae('0x10')](getEndUser(_0x35d060,_0xa8987c,_0x1e67f1))[_0x89ae('0x10')](getTicket(_0x35d060,_0xa8987c,_0x1e67f1,_0x588c8b,_0x3a2d1f))[_0x89ae('0x10')](function(_0x227c7f){logger['info'](util[_0x89ae('0x30')](_0x89ae('0x52'),_0x227c7f[_0x89ae('0x39')]));if(_0x35d060!==_0x89ae('0x48')){logger[_0x89ae('0xe')]('['+[_0x35d060[_0x89ae('0x1a')]()]+']',_0x89ae('0x53'));emit(_0x1e67f1,_0x19cddd[_0x89ae('0x54')],_0x227c7f[_0x89ae('0x2a')]);}})[_0x89ae('0x18')](function(_0x179d9c){logger['error']('['+[_0x35d060[_0x89ae('0x1a')]()]+_0x89ae('0x55'),util['inspect'](_0x179d9c,{'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 018499e..fb8064b 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 _0xfae7=['freshsales','servicenow','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','unknown\x20integration','../../../../config/logger','toLowerCase','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365'];(function(_0x5a636f,_0x3fec2b){var _0x6a8cfb=function(_0x20e6ca){while(--_0x20e6ca){_0x5a636f['push'](_0x5a636f['shift']());}};_0x6a8cfb(++_0x3fec2b);}(_0xfae7,0x120));var _0x7fae=function(_0x43db89,_0x225a65){_0x43db89=_0x43db89-0x0;var _0x285936=_0xfae7[_0x43db89];return _0x285936;};'use strict';var _=require(_0x7fae('0x0'));var util=require(_0x7fae('0x1'));var zendesk=require(_0x7fae('0x2'));var salesforce=require(_0x7fae('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x7fae('0x4'));var zoho=require(_0x7fae('0x5'));var desk=require(_0x7fae('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x7fae('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x7fae('0x8'));var integrations=['zendesk',_0x7fae('0x9'),_0x7fae('0xa'),_0x7fae('0xb'),_0x7fae('0xc'),_0x7fae('0xd'),_0x7fae('0xe'),_0x7fae('0xf'),_0x7fae('0x10'),_0x7fae('0x11')];exports['exec']=function(_0x3c63e9,_0x491ee6,_0x25be2f,_0x1bebd8,_0x4b3a9a,_0x5f01bc){if(_0x25be2f){if(_['includes'](integrations,_0x3c63e9[_0x7fae('0x12')]['toLowerCase']())){try{var _0x596063=null;var _0x1184fb='';var _0x211ecc=_0x25be2f[_0x3c63e9['data1']['toLowerCase']()];if(_0x211ecc){var _0x104937=_0x211ecc[_0x3c63e9[_0x7fae('0x13')]];if(_0x104937){var _0x497bf3=_[_0x7fae('0x14')](_0x104937[_0x7fae('0x15')],{'id':parseInt(_0x3c63e9[_0x7fae('0x16')],0xa)});if(_0x497bf3){if(_0x1bebd8){if(_0x4b3a9a&&_0x491ee6[_0x7fae('0x17')]){_0x1184fb=_0x7fae('0x17');}else if(_0x491ee6[_0x7fae('0x18')]){_0x1184fb=_0x7fae('0x19');}else{console[_0x7fae('0x1a')](_0x7fae('0x1b'),_0x491ee6);}}else{_0x1184fb=_0x7fae('0x1c');}switch(_0x3c63e9[_0x7fae('0x12')]['toLowerCase']()){case _0x7fae('0x1d'):zendesk[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case _0x7fae('0x9'):salesforce[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case _0x7fae('0xa'):sugarcrm[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case _0x7fae('0xb'):freshdesk[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case'zoho':zoho[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case'desk':desk[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case _0x7fae('0xe'):vtiger[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case _0x7fae('0x10'):freshsales['cs'](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc,_0x1184fb);break;case _0x7fae('0x11'):servicenow['cs'](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc,_0x1184fb);break;case'dynamics365':dynamics365['cs'](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc,_0x1184fb);break;default:console[_0x7fae('0x1a')](_0x7fae('0x1e'));}}else{_0x596063=require(_0x7fae('0x1f'))(_0x3c63e9['data1'][_0x7fae('0x20')]());_0x596063['error'](_0x7fae('0x21'),util[_0x7fae('0x22')](_0x7fae('0x23'),_0x3c63e9[_0x7fae('0x12')][_0x7fae('0x20')](),_0x3c63e9[_0x7fae('0x16')]));}}else{_0x596063=require('../../../../config/logger')(_0x3c63e9[_0x7fae('0x12')][_0x7fae('0x20')]());_0x596063[_0x7fae('0x24')](_0x7fae('0x21'),util[_0x7fae('0x22')](_0x7fae('0x25'),_0x3c63e9[_0x7fae('0x12')][_0x7fae('0x20')](),_0x3c63e9[_0x7fae('0x13')]));}}else{}}catch(_0x172943){console[_0x7fae('0x24')](_0x172943);}}}}; \ No newline at end of file +var _0xfce5=['servicenow','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','log','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xfce5,0xff));var _0x5fce=function(_0x589274,_0xa3f1bd){_0x589274=_0x589274-0x0;var _0x21814b=_0xfce5[_0x589274];return _0x21814b;};'use strict';var _=require(_0x5fce('0x0'));var util=require(_0x5fce('0x1'));var zendesk=require(_0x5fce('0x2'));var salesforce=require(_0x5fce('0x3'));var sugarcrm=require(_0x5fce('0x4'));var freshdesk=require(_0x5fce('0x5'));var zoho=require(_0x5fce('0x6'));var desk=require(_0x5fce('0x7'));var vtiger=require(_0x5fce('0x8'));var servicenow=require('./servicenow');var dynamics365=require(_0x5fce('0x9'));var freshsales=require(_0x5fce('0xa'));var integrations=['zendesk',_0x5fce('0xb'),_0x5fce('0xc'),_0x5fce('0xd'),_0x5fce('0xe'),_0x5fce('0xf'),_0x5fce('0x10'),'dynamics365',_0x5fce('0x11'),_0x5fce('0x12')];exports['exec']=function(_0x341b53,_0x437548,_0xc100f9,_0x310633,_0x999d68,_0x256860){if(_0xc100f9){if(_['includes'](integrations,_0x341b53[_0x5fce('0x13')]['toLowerCase']())){try{var _0x129199=null;var _0x4181d8='';var _0xf2d767=_0xc100f9[_0x341b53[_0x5fce('0x13')][_0x5fce('0x14')]()];if(_0xf2d767){var _0x21adfd=_0xf2d767[_0x341b53[_0x5fce('0x15')]];if(_0x21adfd){var _0x38d940=_[_0x5fce('0x16')](_0x21adfd[_0x5fce('0x17')],{'id':parseInt(_0x341b53[_0x5fce('0x18')],0xa)});if(_0x38d940){if(_0x310633){if(_0x999d68&&_0x437548[_0x5fce('0x19')]){_0x4181d8=_0x5fce('0x19');}else if(_0x437548[_0x5fce('0x1a')]){_0x4181d8=_0x5fce('0x1b');}else{console['log'](_0x5fce('0x1c'),_0x437548);}}else{_0x4181d8=_0x5fce('0x1d');}switch(_0x341b53[_0x5fce('0x13')][_0x5fce('0x14')]()){case _0x5fce('0x1e'):zendesk[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case _0x5fce('0xb'):salesforce[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case _0x5fce('0xc'):sugarcrm[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case'freshdesk':freshdesk[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case _0x5fce('0xe'):zoho[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case _0x5fce('0xf'):desk[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case _0x5fce('0x10'):vtiger[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case'freshsales':freshsales['cs'](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860,_0x4181d8);break;case _0x5fce('0x12'):servicenow['cs'](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860,_0x4181d8);break;case'dynamics365':dynamics365['cs'](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860,_0x4181d8);break;default:console[_0x5fce('0x1f')](_0x5fce('0x20'));}}else{_0x129199=require(_0x5fce('0x21'))(_0x341b53[_0x5fce('0x13')][_0x5fce('0x14')]());_0x129199['error'](_0x5fce('0x22'),util[_0x5fce('0x23')](_0x5fce('0x24'),_0x341b53[_0x5fce('0x13')][_0x5fce('0x14')](),_0x341b53[_0x5fce('0x18')]));}}else{_0x129199=require(_0x5fce('0x21'))(_0x341b53[_0x5fce('0x13')]['toLowerCase']());_0x129199[_0x5fce('0x25')](_0x5fce('0x22'),util[_0x5fce('0x23')](_0x5fce('0x26'),_0x341b53[_0x5fce('0x13')][_0x5fce('0x14')](),_0x341b53[_0x5fce('0x15')]));}}else{}}catch(_0x2fac85){console[_0x5fce('0x25')](_0x2fac85);}}}}; \ 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 56f8ccf..7aa577a 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 _0x5d29=['account','AccountId','leadId','sobject','create','validateEmail','find','then','length','Email','info','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Name','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','string','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','monitor_format','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','ContactId'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x5d29,0x15f));var _0x95d2=function(_0x1ab097,_0x4e4c94){_0x1ab097=_0x1ab097-0x0;var _0x2232f4=_0x5d29[_0x1ab097];return _0x2232f4;};'use strict';var _=require(_0x95d2('0x0'));var rp=require(_0x95d2('0x1'));var moment=require(_0x95d2('0x2'));var BPromise=require(_0x95d2('0x3'));var md5=require('md5');var jsforce=require(_0x95d2('0x4'));var util=require('util');var Redis=require(_0x95d2('0x5'));var intUtil=require('./util');var config=require(_0x95d2('0x6'));var logger=require(_0x95d2('0x7'))(_0x95d2('0x8'));config[_0x95d2('0x9')]=_['defaults'](config[_0x95d2('0x9')],{'host':_0x95d2('0xa'),'port':0x18eb});var io=require(_0x95d2('0xb'))(new Redis(config[_0x95d2('0x9')]));function emit(_0x5ae79b,_0x458f48,_0x2a4c9f){io['to'](_0x5ae79b)[_0x95d2('0xc')](_0x458f48,_0x2a4c9f);}function getTicket(_0x1fe1d1,_0x35a514,_0x1c3429,_0x2a0fb8,_0x8deb6e,_0x25bb9e,_0x58bb3a,_0xb08772){var _0x37c85b=Object[_0x95d2('0xd')]({},{'OwnerId':_0x35a514['id'],'Subject':intUtil[_0x95d2('0xe')](_0x2a0fb8[_0x95d2('0xf')],_0x8deb6e,'\x20'),'Description':intUtil[_0x95d2('0xe')](_0x2a0fb8[_0x95d2('0x10')],_0x8deb6e,'\x0a')},getCustomFields(_0x25bb9e,_0x8deb6e));if(_0x1c3429){if(_0x2a0fb8[_0x95d2('0x11')]===_0x95d2('0x12')){_0x37c85b[_0x95d2('0x13')]=moment['utc']();_0x37c85b['IsReminderSet']=![];_0x37c85b[_0x95d2('0x14')]=![];if(_0x1c3429[_0x95d2('0x15')]===_0x95d2('0x16')||_0x1c3429[_0x95d2('0x15')]===_0x95d2('0x17')){_0x37c85b[_0x95d2('0x18')]=_0x1c3429['id'];}else if(_0x1c3429[_0x95d2('0x15')]==='account'){_0x37c85b[_0x95d2('0x19')]=_0x1c3429['id'];}}else if(_0x2a0fb8[_0x95d2('0x11')]==='Case'){if(_0x1c3429[_0x95d2('0x15')]===_0x95d2('0x16')){_0x37c85b[_0x95d2('0x1a')]=_0x1c3429['id'];}else if(_0x1c3429[_0x95d2('0x15')]===_0x95d2('0x1b')){_0x37c85b[_0x95d2('0x1c')]=_0x1c3429['id'];}else if(_0x1c3429[_0x95d2('0x15')]===_0x95d2('0x17')&&_0x2a0fb8[_0x95d2('0x1d')]){_0x37c85b[_0x2a0fb8[_0x95d2('0x1d')]]=_0x1c3429['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x58bb3a[_0x95d2('0x1e')](_0x2a0fb8[_0x95d2('0x11')])[_0x95d2('0x1f')](_0x37c85b);}function getUser(_0x3cbee4,_0x21551d,_0x543ef9){if(!_['isNil'](_0x21551d)&&intUtil[_0x95d2('0x20')](_0x21551d)){var _0x1d7612={'Email':_0x21551d};var _0x5834e3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x543ef9[_0x95d2('0x1e')]('User')[_0x95d2('0x21')](_0x1d7612,_0x5834e3)['execute']()[_0x95d2('0x22')](function(_0x312881){if(_0x312881[_0x95d2('0x23')]){var _0x3323d1=_['find'](_0x312881,function(_0xeaa6e9){return _0xeaa6e9[_0x95d2('0x24')]===_0x21551d;});if(_0x3323d1){logger[_0x95d2('0x25')]('Agent\x20%s\x20found.',_0x21551d);return BPromise[_0x95d2('0x26')]({'id':_0x3323d1['Id'],'name':_0x3323d1['Name']});}}else{logger[_0x95d2('0x25')](_0x95d2('0x27'),_0x21551d);return _0x543ef9[_0x95d2('0x28')]()['then'](function(_0x21928e){return BPromise[_0x95d2('0x26')]({'id':_0x21928e[_0x95d2('0x29')],'name':_0x21928e[_0x95d2('0x2a')]});});}});}else{logger[_0x95d2('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x21551d);return _0x543ef9[_0x95d2('0x28')]()[_0x95d2('0x22')](function(_0x2ea27f){return BPromise[_0x95d2('0x26')]({'id':_0x2ea27f[_0x95d2('0x29')],'name':_0x2ea27f[_0x95d2('0x2a')]});});}}function getEndUser(_0x250112,_0x586eb9,_0x3c13d0,_0x258401,_0x5af7d7){var _0x4c7f7e={'$or':{'Phone':_0x258401}};var _0x13a3ae={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x95d2('0x26')]()['then'](function(){logger[_0x95d2('0x25')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x258401,_0x586eb9['moduleSearch']);switch(_0x586eb9[_0x95d2('0x2b')]){case _0x95d2('0x2c'):var _0x13230a=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x2e')]){var _0x253d30={};_0x253d30[_0x586eb9['additionalSearchContact']]=_0x258401;_[_0x95d2('0x2f')](_0x13230a[_0x95d2('0x30')],_0x253d30);}return _0x5af7d7[_0x95d2('0x1e')](_0x95d2('0x31'))[_0x95d2('0x21')](_0x13230a,_0x13a3ae)[_0x95d2('0x32')]()[_0x95d2('0x22')](function(_0x5090fb){if(_0x5090fb&&_0x5090fb[_0x95d2('0x23')]){return _0x5090fb;}else{var _0x57322a=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x33')]){var _0x503dfb={};_0x503dfb[_0x586eb9[_0x95d2('0x33')]]=_0x258401;_[_0x95d2('0x2f')](_0x57322a[_0x95d2('0x30')],_0x503dfb);}return _0x5af7d7[_0x95d2('0x1e')](_0x95d2('0x34'))[_0x95d2('0x21')](_0x57322a,_0x13a3ae);}});case _0x95d2('0x35'):var _0x5dd1e6=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9['additionalSearchAccount']){var _0x253d30={};_0x253d30[_0x586eb9[_0x95d2('0x36')]]=_0x258401;_[_0x95d2('0x2f')](_0x5dd1e6[_0x95d2('0x30')],_0x253d30);}return _0x5af7d7['sobject'](_0x95d2('0x37'))[_0x95d2('0x21')](_0x5dd1e6,_0x13a3ae)['execute']()[_0x95d2('0x22')](function(_0x168fc6){if(_0x168fc6&&_0x168fc6['length']){return _0x168fc6;}else{var _0x34f9bf=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x2e')]){var _0x1e834f={};_0x1e834f[_0x586eb9[_0x95d2('0x2e')]]=_0x258401;_[_0x95d2('0x2f')](_0x34f9bf['$or'],_0x1e834f);}return _0x5af7d7['sobject']('Contact')[_0x95d2('0x21')](_0x34f9bf,_0x13a3ae)[_0x95d2('0x22')](function(_0x53ba67){if(_0x53ba67&&_0x53ba67['length']){return _0x53ba67;}else{var _0x539de2=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x33')]){var _0x8a6361={};_0x8a6361[_0x586eb9['additionalSearchLead']]=_0x258401;_['merge'](_0x539de2[_0x95d2('0x30')],_0x8a6361);}return _0x5af7d7[_0x95d2('0x1e')](_0x95d2('0x34'))[_0x95d2('0x21')](_0x539de2,_0x13a3ae);}});}});case'contact':var _0x13230a=_['cloneDeep'](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x2e')]){var _0x253d30={};_0x253d30[_0x586eb9[_0x95d2('0x2e')]]=_0x258401;_[_0x95d2('0x2f')](_0x13230a[_0x95d2('0x30')],_0x253d30);}return _0x5af7d7[_0x95d2('0x1e')](_0x95d2('0x31'))['find'](_0x13230a,_0x13a3ae)['execute']();case _0x95d2('0x17'):var _0x33daf9=_['cloneDeep'](_0x4c7f7e);if(_0x586eb9['additionalSearchLead']){var _0x253d30={};_0x253d30[_0x586eb9['additionalSearchLead']]=_0x258401;_[_0x95d2('0x2f')](_0x33daf9[_0x95d2('0x30')],_0x253d30);}return _0x5af7d7[_0x95d2('0x1e')](_0x95d2('0x34'))[_0x95d2('0x21')](_0x33daf9,_0x13a3ae);case _0x95d2('0x1b'):var _0x5dd1e6=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x36')]){var _0x253d30={};_0x253d30[_0x586eb9[_0x95d2('0x36')]]=_0x258401;_[_0x95d2('0x2f')](_0x5dd1e6[_0x95d2('0x30')],_0x253d30);}return _0x5af7d7[_0x95d2('0x1e')]('Account')['find'](_0x5dd1e6,_0x13a3ae);default:return null;}})[_0x95d2('0x22')](function(_0x10e1f1){if(_0x10e1f1&&_0x10e1f1[_0x95d2('0x23')]){var _0x520cdc=_['first'](_0x10e1f1);if(_0x520cdc){return BPromise['resolve']({'id':_0x520cdc['Id'],'name':_0x520cdc[_0x95d2('0x38')],'phone':_0x520cdc[_0x95d2('0x39')],'endUserType':_0x520cdc['attributes'][_0x95d2('0x3a')][_0x95d2('0x3b')]()});}}})['then'](function(_0x2229fa){if(_0x2229fa){logger[_0x95d2('0x25')](_0x95d2('0x3c'),_0x2229fa[_0x95d2('0x15')],_0x258401);return BPromise[_0x95d2('0x26')](_0x2229fa);}else{logger['info'](_0x95d2('0x3d'),_0x258401);var _0x53e80b={'Phone':_0x258401};if(_0x586eb9[_0x95d2('0x3e')]){if(_0x586eb9[_0x95d2('0x3e')]==='contact'){logger['info'](_0x95d2('0x3f'),_0x258401,_0x586eb9[_0x95d2('0x3e')]);_0x53e80b[_0x95d2('0x40')]=_0x3c13d0!==_0x95d2('0x41')?_0x3c13d0:util[_0x95d2('0x42')](_0x95d2('0x43'),_0x258401);}else if(_0x586eb9[_0x95d2('0x3e')]===_0x95d2('0x17')){logger[_0x95d2('0x25')](_0x95d2('0x3f'),_0x258401,_0x586eb9[_0x95d2('0x3e')]);_0x53e80b[_0x95d2('0x40')]=_0x3c13d0!==_0x95d2('0x41')?_0x3c13d0:util[_0x95d2('0x42')](_0x95d2('0x43'),_0x258401);_0x53e80b[_0x95d2('0x44')]=_0x95d2('0x45');}else if(_0x586eb9[_0x95d2('0x3e')]===_0x95d2('0x1b')){logger[_0x95d2('0x25')](_0x95d2('0x3f'),_0x258401,_0x586eb9[_0x95d2('0x3e')]);_0x53e80b['Name']=_0x3c13d0!==''?_0x3c13d0:util[_0x95d2('0x42')](_0x95d2('0x43'),_0x258401);}else{return null;}}return _0x5af7d7[_0x95d2('0x1e')](_[_0x95d2('0x46')](_0x586eb9['moduleCreate']))[_0x95d2('0x1f')](_0x53e80b)[_0x95d2('0x22')](function(_0x546659){return BPromise['resolve']({'id':_0x546659['id'],'endUserType':_0x586eb9['moduleCreate']});});}});}function getCustomFields(_0xb7f7e9,_0x3638ad){var _0x30c73e={};if(_0xb7f7e9[_0x95d2('0x23')]>0x0){_[_0x95d2('0x47')](_0xb7f7e9,function(_0xef72bf){if(_['includes']([_0x95d2('0x48'),'picklist'],_0xef72bf[_0x95d2('0x3a')])&&_0xef72bf['idField']){_0x30c73e[_0xef72bf[_0x95d2('0x49')]]=_0xef72bf['content'][_0x95d2('0x4a')]();}else if(_0xef72bf[_0x95d2('0x3a')]===_0x95d2('0x4b')&&_0xef72bf[_0x95d2('0x4c')]&&_0xef72bf['idField']){_0x3638ad[_0xef72bf['variableName']]&&(_0x30c73e[_0xef72bf[_0x95d2('0x49')]]=_0x3638ad[_0xef72bf[_0x95d2('0x4c')]][_0x95d2('0x4a')]());}else if(_0xef72bf[_0x95d2('0x3a')]===_0x95d2('0x4d')&&_0xef72bf[_0x95d2('0x4e')]&&_0xef72bf[_0x95d2('0x4e')][_0x95d2('0x4f')]&&_0xef72bf[_0x95d2('0x49')]){_0x3638ad[_0xef72bf[_0x95d2('0x4e')][_0x95d2('0x4f')][_0x95d2('0x3b')]()]&&(_0x30c73e[_0xef72bf[_0x95d2('0x49')]]=_0x3638ad[_0xef72bf['Variable']['name'][_0x95d2('0x3b')]()][_0x95d2('0x4a')]());}});}return _0x30c73e;}function getConnection(_0x38d663){var _0xf70ae7=_0x38d663[_0x95d2('0x50')][_0x95d2('0x51')](_0x38d663['securityToken']);var _0xc8820b=new jsforce[(_0x95d2('0x52'))]({'oauth2':{'loginUrl':_0x38d663[_0x95d2('0x53')]||'https://login.salesforce.com','clientId':_0x38d663[_0x95d2('0x54')],'clientSecret':_0x38d663[_0x95d2('0x55')]}});return _0xc8820b[_0x95d2('0x56')](_0x38d663[_0x95d2('0x57')],_0xf70ae7)[_0x95d2('0x22')](function(){logger[_0x95d2('0x25')](_0x95d2('0x58'));return _0xc8820b;});}exports[_0x95d2('0x59')]=function(_0x52d89c,_0x1af2fb,_0x203fbd,_0x36e608,_0x3a5ad0,_0x3b819a){var _0x1fc646,_0x3bcbea,_0x3448e9,_0x33e948;_0x3b819a[_0x95d2('0x5a')]=intUtil[_0x95d2('0x5b')](_0x3b819a[_0x95d2('0x5a')]);_0x3b819a[_0x95d2('0x53')]=intUtil[_0x95d2('0x5b')](_0x3b819a[_0x95d2('0x53')]);if(_0x3a5ad0&&_0x3a5ad0['monitor_format']){logger[_0x95d2('0x25')](_0x95d2('0x5c'),_0x95d2('0x5d'));_0x1af2fb['recordingURL']=util[_0x95d2('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b819a[_0x95d2('0x5a')],_0x1af2fb[_0x95d2('0x5e')],md5(_0x1af2fb[_0x95d2('0x5e')]));}else{_0x1af2fb['recordingURL']='';}return getConnection(_0x3b819a)[_0x95d2('0x22')](function(_0x34bac9){_0x33e948=_0x34bac9;return getUser(_0x3b819a,_0x36e608['email'],_0x33e948);})[_0x95d2('0x22')](function(_0x3066c5){_0x1fc646=_0x3066c5;return getEndUser(_0x3b819a,_0x203fbd,_0x1af2fb[_0x95d2('0x5f')],_0x1af2fb[_0x95d2('0x60')],_0x33e948);})[_0x95d2('0x22')](function(_0x37c124){_0x3bcbea=_0x37c124;return getTicket(_0x3b819a,_0x1fc646,_0x3bcbea,_0x203fbd,_0x1af2fb,_0x203fbd[_0x95d2('0x61')],_0x33e948,_0x95d2('0x59'));})['then'](function(_0x30b7f0){_0x3448e9=_0x30b7f0;logger[_0x95d2('0x25')](_0x95d2('0x62'),_0x3448e9['id']);logger[_0x95d2('0x25')](_0x95d2('0x63'),_0x3448e9['id'],_0x36e608[_0x95d2('0x4f')],_0x3b819a[_0x95d2('0x3a')]);switch(_0x3b819a[_0x95d2('0x3a')]){case _0x95d2('0x64'):emit(util['format']('user:%s',_0x36e608['name']),_0x95d2('0x65'),{'recordId':_0x3448e9['id']});break;case'newTab':emit(util['format'](_0x95d2('0x66'),_0x36e608[_0x95d2('0x4f')]),'trigger:browser:url',{'uri':util[_0x95d2('0x42')](_0x95d2('0x67'),_0x33e948[_0x95d2('0x68')],_0x3448e9['id'])});break;default:logger[_0x95d2('0x69')](_0x95d2('0x6a'));}})[_0x95d2('0x6b')](function(_0x367789){logger['error'](_0x95d2('0x5c'),_0x367789);});};exports[_0x95d2('0x6c')]=function(_0x1cd593,_0x2b20f2,_0x3a9133,_0x252f1f,_0x382bf6,_0x1e841b,_0x16f09f){var _0x4bc865,_0x2edc7e,_0x36bb22,_0x1662e9;_0x1e841b[_0x95d2('0x5a')]=intUtil[_0x95d2('0x5b')](_0x1e841b[_0x95d2('0x5a')]);_0x1e841b['remoteUri']=intUtil['stripTrailingSlash'](_0x1e841b[_0x95d2('0x53')]);if(_0x16f09f&&_0x16f09f[_0x95d2('0x6d')]&&_0x16f09f[_0x95d2('0x6d')]!==_0x95d2('0x6e')){logger[_0x95d2('0x25')](_0x95d2('0x6f'),'Recording\x20is\x20enabled!');_0x2b20f2[_0x95d2('0x70')]=util[_0x95d2('0x42')](_0x95d2('0x71'),_0x1e841b[_0x95d2('0x5a')],_0x2b20f2[_0x95d2('0x5e')],md5(_0x2b20f2[_0x95d2('0x5e')]));}return getConnection(_0x1e841b)['then'](function(_0x27f840){_0x1662e9=_0x27f840;return getUser(_0x1e841b,_0x252f1f[_0x95d2('0x72')],_0x1662e9);})['then'](function(_0x4d9a4d){_0x4bc865=_0x4d9a4d;return getEndUser(_0x1e841b,_0x3a9133,_0x2b20f2[_0x95d2('0x73')],_0x2b20f2[_0x95d2('0x74')],_0x1662e9);})[_0x95d2('0x22')](function(_0x330b09){_0x2edc7e=_0x330b09;return getTicket(_0x1e841b,_0x4bc865,_0x2edc7e,_0x3a9133,_0x2b20f2,_0x3a9133[_0x95d2('0x61')],_0x1662e9,_0x95d2('0x6c'));})[_0x95d2('0x22')](function(_0xdcc52e){_0x36bb22=_0xdcc52e;logger[_0x95d2('0x25')](_0x95d2('0x75'),_0x36bb22['id']);logger[_0x95d2('0x25')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x36bb22['id'],_0x252f1f[_0x95d2('0x4f')],_0x1e841b['type']);switch(_0x1e841b[_0x95d2('0x3a')]){case'integrationTab':emit(util[_0x95d2('0x42')](_0x95d2('0x66'),_0x252f1f[_0x95d2('0x4f')]),_0x95d2('0x65'),{'recordId':_0x36bb22['id']});break;case'newTab':emit(util[_0x95d2('0x42')](_0x95d2('0x66'),_0x252f1f[_0x95d2('0x4f')]),_0x95d2('0x76'),{'uri':util[_0x95d2('0x42')]('%s/%s/e',_0x1662e9[_0x95d2('0x68')],_0x36bb22['id'])});break;default:logger['error'](_0x95d2('0x6f'),_0x95d2('0x77'));}})[_0x95d2('0x6b')](function(_0x35000c){logger[_0x95d2('0x69')]('[OUTBOUND]',_0x35000c);});};exports['unmanaged']=function(_0x381ab6,_0x2d5f53,_0x4bbac1,_0x191059,_0x30f59c,_0x15ac42){var _0x55d7f5,_0x534c06,_0x140c7b,_0x2b04a2;_0x15ac42[_0x95d2('0x5a')]=intUtil[_0x95d2('0x5b')](_0x15ac42['serverUrl']);_0x15ac42[_0x95d2('0x53')]=intUtil[_0x95d2('0x5b')](_0x15ac42[_0x95d2('0x53')]);if(_0x30f59c&&_0x30f59c[_0x95d2('0x78')]){logger['info']('['+_0x2d5f53[_0x95d2('0x79')][_0x95d2('0x7a')]()+']',_0x95d2('0x5d'));_0x2d5f53['recordingURL']=util[_0x95d2('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x15ac42[_0x95d2('0x5a')],_0x2d5f53['uniqueid'],md5(_0x2d5f53['uniqueid']));}else{_0x2d5f53[_0x95d2('0x70')]='';}return getConnection(_0x15ac42)[_0x95d2('0x22')](function(_0x51af08){_0x2b04a2=_0x51af08;if(!_[_0x95d2('0x7b')](_0x191059)){return getUser(_0x15ac42,_0x191059[_0x95d2('0x4f')],_0x2b04a2);}else{return getUser(_0x15ac42,null,_0x2b04a2);}})[_0x95d2('0x22')](function(_0x1f1304){_0x55d7f5=_0x1f1304;return getEndUser(_0x15ac42,_0x4bbac1,_0x2d5f53['calleridname'],_0x2d5f53[_0x95d2('0x60')],_0x2b04a2);})[_0x95d2('0x22')](function(_0x3b57f8){_0x534c06=_0x3b57f8;return getTicket(_0x15ac42,_0x55d7f5,_0x534c06,_0x4bbac1,_0x2d5f53,_0x4bbac1['Fields'],_0x2b04a2);})[_0x95d2('0x22')](function(_0x540eda){_0x140c7b=_0x540eda;logger[_0x95d2('0x25')]('['+_0x2d5f53[_0x95d2('0x79')][_0x95d2('0x7a')]()+_0x95d2('0x7c'),_0x140c7b['id']);logger[_0x95d2('0x25')]('['+_0x2d5f53[_0x95d2('0x79')][_0x95d2('0x7a')]()+_0x95d2('0x7d'),_0x15ac42[_0x95d2('0x3a')]);})['catch'](function(_0x2e8cd9){logger['error']('['+_0x2d5f53[_0x95d2('0x79')][_0x95d2('0x7a')]()+']',_0x2e8cd9);});}; \ No newline at end of file +var _0x007a=['account_contact_lead','additionalSearchAccount','Account','Lead','Contact','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','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','No\x20Company','upperFirst','picklist','idField','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','email','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','uniqueid','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','ioredis','./util','../../../../config/environment','salesforce','redis','localhost','socket.io-emitter','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','Case','ContactId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','then','length','Email','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','execute','additionalSearchLead','$or'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0x007a,0xc2));var _0xa007=function(_0x22708b,_0x2bee57){_0x22708b=_0x22708b-0x0;var _0x3e0055=_0x007a[_0x22708b];return _0x3e0055;};'use strict';var _=require(_0xa007('0x0'));var rp=require('request-promise');var moment=require(_0xa007('0x1'));var BPromise=require('bluebird');var md5=require(_0xa007('0x2'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0xa007('0x3'));var intUtil=require(_0xa007('0x4'));var config=require(_0xa007('0x5'));var logger=require('../../../../config/logger')(_0xa007('0x6'));config[_0xa007('0x7')]=_['defaults'](config['redis'],{'host':_0xa007('0x8'),'port':0x18eb});var io=require(_0xa007('0x9'))(new Redis(config[_0xa007('0x7')]));function emit(_0x3c5385,_0x218f01,_0x109d1c){io['to'](_0x3c5385)['emit'](_0x218f01,_0x109d1c);}function getTicket(_0x3cddae,_0x4dfe22,_0x2835d8,_0x5add69,_0x838cfb,_0x22eee0,_0x4dde1c,_0x3ec7e2){var _0x3eca07=Object['assign']({},{'OwnerId':_0x4dfe22['id'],'Subject':intUtil['getString'](_0x5add69[_0xa007('0xa')],_0x838cfb,'\x20'),'Description':intUtil[_0xa007('0xb')](_0x5add69[_0xa007('0xc')],_0x838cfb,'\x0a')},getCustomFields(_0x22eee0,_0x838cfb));if(_0x2835d8){if(_0x5add69[_0xa007('0xd')]===_0xa007('0xe')){_0x3eca07[_0xa007('0xf')]=moment['utc']();_0x3eca07[_0xa007('0x10')]=![];_0x3eca07[_0xa007('0x11')]=![];if(_0x2835d8[_0xa007('0x12')]===_0xa007('0x13')||_0x2835d8[_0xa007('0x12')]==='lead'){_0x3eca07[_0xa007('0x14')]=_0x2835d8['id'];}else if(_0x2835d8[_0xa007('0x12')]===_0xa007('0x15')){_0x3eca07[_0xa007('0x16')]=_0x2835d8['id'];}}else if(_0x5add69[_0xa007('0xd')]===_0xa007('0x17')){if(_0x2835d8[_0xa007('0x12')]==='contact'){_0x3eca07[_0xa007('0x18')]=_0x2835d8['id'];}else if(_0x2835d8[_0xa007('0x12')]===_0xa007('0x15')){_0x3eca07['AccountId']=_0x2835d8['id'];}else if(_0x2835d8[_0xa007('0x12')]===_0xa007('0x19')&&_0x5add69[_0xa007('0x1a')]){_0x3eca07[_0x5add69['leadId']]=_0x2835d8['id'];}else{logger[_0xa007('0x1b')](_0xa007('0x1c'));}}}return _0x4dde1c[_0xa007('0x1d')](_0x5add69[_0xa007('0xd')])[_0xa007('0x1e')](_0x3eca07);}function getUser(_0x337a01,_0x839e3d,_0x2b8cc2){if(!_['isNil'](_0x839e3d)&&intUtil[_0xa007('0x1f')](_0x839e3d)){var _0x3392fd={'Email':_0x839e3d};var _0x16250a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2b8cc2['sobject'](_0xa007('0x20'))[_0xa007('0x21')](_0x3392fd,_0x16250a)['execute']()[_0xa007('0x22')](function(_0x57bed9){if(_0x57bed9[_0xa007('0x23')]){var _0x1c32c1=_['find'](_0x57bed9,function(_0x1cf6e8){return _0x1cf6e8[_0xa007('0x24')]===_0x839e3d;});if(_0x1c32c1){logger[_0xa007('0x1b')]('Agent\x20%s\x20found.',_0x839e3d);return BPromise[_0xa007('0x25')]({'id':_0x1c32c1['Id'],'name':_0x1c32c1['Name']});}}else{logger[_0xa007('0x1b')](_0xa007('0x26'),_0x839e3d);return _0x2b8cc2[_0xa007('0x27')]()['then'](function(_0x5a66fa){return BPromise[_0xa007('0x25')]({'id':_0x5a66fa[_0xa007('0x28')],'name':_0x5a66fa[_0xa007('0x29')]});});}});}else{logger['info'](_0xa007('0x26'),_0x839e3d);return _0x2b8cc2[_0xa007('0x27')]()[_0xa007('0x22')](function(_0x27c482){return BPromise[_0xa007('0x25')]({'id':_0x27c482['user_id'],'name':_0x27c482[_0xa007('0x29')]});});}}function getEndUser(_0xc6dcf,_0x4ffc86,_0x37cc29,_0x4d8baf,_0x5041fb){var _0x2e6b00={'$or':{'Phone':_0x4d8baf}};var _0x1bdfb3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa007('0x25')]()[_0xa007('0x22')](function(){logger['info'](_0xa007('0x2a'),_0x4d8baf,_0x4ffc86[_0xa007('0x2b')]);switch(_0x4ffc86[_0xa007('0x2b')]){case'contact_lead':var _0x19e671=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86[_0xa007('0x2d')]){var _0x47b8ee={};_0x47b8ee[_0x4ffc86[_0xa007('0x2d')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x19e671['$or'],_0x47b8ee);}return _0x5041fb['sobject']('Contact')[_0xa007('0x21')](_0x19e671,_0x1bdfb3)[_0xa007('0x2f')]()[_0xa007('0x22')](function(_0x560cbd){if(_0x560cbd&&_0x560cbd[_0xa007('0x23')]){return _0x560cbd;}else{var _0x5682ee=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86['additionalSearchLead']){var _0x1df024={};_0x1df024[_0x4ffc86[_0xa007('0x30')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x5682ee[_0xa007('0x31')],_0x1df024);}return _0x5041fb[_0xa007('0x1d')]('Lead')[_0xa007('0x21')](_0x5682ee,_0x1bdfb3);}});case _0xa007('0x32'):var _0x926438=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86[_0xa007('0x33')]){var _0x47b8ee={};_0x47b8ee[_0x4ffc86[_0xa007('0x33')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x926438[_0xa007('0x31')],_0x47b8ee);}return _0x5041fb[_0xa007('0x1d')](_0xa007('0x34'))[_0xa007('0x21')](_0x926438,_0x1bdfb3)[_0xa007('0x2f')]()[_0xa007('0x22')](function(_0x1f3d2d){if(_0x1f3d2d&&_0x1f3d2d['length']){return _0x1f3d2d;}else{var _0x237a5b=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86['additionalSearchContact']){var _0x419d11={};_0x419d11[_0x4ffc86[_0xa007('0x2d')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x237a5b[_0xa007('0x31')],_0x419d11);}return _0x5041fb[_0xa007('0x1d')]('Contact')[_0xa007('0x21')](_0x237a5b,_0x1bdfb3)[_0xa007('0x22')](function(_0x1cacbf){if(_0x1cacbf&&_0x1cacbf[_0xa007('0x23')]){return _0x1cacbf;}else{var _0x24ec0a=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86['additionalSearchLead']){var _0x5684e6={};_0x5684e6[_0x4ffc86[_0xa007('0x30')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x24ec0a['$or'],_0x5684e6);}return _0x5041fb[_0xa007('0x1d')](_0xa007('0x35'))['find'](_0x24ec0a,_0x1bdfb3);}});}});case _0xa007('0x13'):var _0x19e671=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86['additionalSearchContact']){var _0x47b8ee={};_0x47b8ee[_0x4ffc86[_0xa007('0x2d')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x19e671['$or'],_0x47b8ee);}return _0x5041fb[_0xa007('0x1d')](_0xa007('0x36'))[_0xa007('0x21')](_0x19e671,_0x1bdfb3)['execute']();case'lead':var _0x3456ea=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86[_0xa007('0x30')]){var _0x47b8ee={};_0x47b8ee[_0x4ffc86[_0xa007('0x30')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x3456ea['$or'],_0x47b8ee);}return _0x5041fb['sobject'](_0xa007('0x35'))[_0xa007('0x21')](_0x3456ea,_0x1bdfb3);case _0xa007('0x15'):var _0x926438=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86[_0xa007('0x33')]){var _0x47b8ee={};_0x47b8ee[_0x4ffc86['additionalSearchAccount']]=_0x4d8baf;_[_0xa007('0x2e')](_0x926438['$or'],_0x47b8ee);}return _0x5041fb[_0xa007('0x1d')](_0xa007('0x34'))[_0xa007('0x21')](_0x926438,_0x1bdfb3);default:return null;}})['then'](function(_0x4a2fd9){if(_0x4a2fd9&&_0x4a2fd9[_0xa007('0x23')]){var _0x2a03a7=_['first'](_0x4a2fd9);if(_0x2a03a7){return BPromise[_0xa007('0x25')]({'id':_0x2a03a7['Id'],'name':_0x2a03a7[_0xa007('0x37')],'phone':_0x2a03a7[_0xa007('0x38')],'endUserType':_0x2a03a7[_0xa007('0x39')][_0xa007('0x3a')][_0xa007('0x3b')]()});}}})[_0xa007('0x22')](function(_0x27f917){if(_0x27f917){logger['info'](_0xa007('0x3c'),_0x27f917[_0xa007('0x12')],_0x4d8baf);return BPromise[_0xa007('0x25')](_0x27f917);}else{logger[_0xa007('0x1b')](_0xa007('0x3d'),_0x4d8baf);var _0x2abfef={'Phone':_0x4d8baf};if(_0x4ffc86[_0xa007('0x3e')]){if(_0x4ffc86['moduleCreate']==='contact'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4d8baf,_0x4ffc86[_0xa007('0x3e')]);_0x2abfef[_0xa007('0x3f')]=_0x37cc29!==_0xa007('0x40')?_0x37cc29:util[_0xa007('0x41')](_0xa007('0x42'),_0x4d8baf);}else if(_0x4ffc86[_0xa007('0x3e')]===_0xa007('0x19')){logger[_0xa007('0x1b')](_0xa007('0x43'),_0x4d8baf,_0x4ffc86['moduleCreate']);_0x2abfef[_0xa007('0x3f')]=_0x37cc29!==_0xa007('0x40')?_0x37cc29:util[_0xa007('0x41')]('Caller\x20-\x20%s',_0x4d8baf);_0x2abfef[_0xa007('0x44')]=_0xa007('0x45');}else if(_0x4ffc86['moduleCreate']===_0xa007('0x15')){logger[_0xa007('0x1b')](_0xa007('0x43'),_0x4d8baf,_0x4ffc86[_0xa007('0x3e')]);_0x2abfef[_0xa007('0x37')]=_0x37cc29!==_0xa007('0x40')?_0x37cc29:util[_0xa007('0x41')]('Caller\x20-\x20%s',_0x4d8baf);}else{return null;}}return _0x5041fb['sobject'](_[_0xa007('0x46')](_0x4ffc86['moduleCreate']))[_0xa007('0x1e')](_0x2abfef)[_0xa007('0x22')](function(_0x55d374){return BPromise[_0xa007('0x25')]({'id':_0x55d374['id'],'endUserType':_0x4ffc86[_0xa007('0x3e')]});});}});}function getCustomFields(_0x4ebbde,_0x36b512){var _0x584104={};if(_0x4ebbde['length']>0x0){_['forEach'](_0x4ebbde,function(_0x38bf9a){if(_['includes'](['string',_0xa007('0x47')],_0x38bf9a[_0xa007('0x3a')])&&_0x38bf9a[_0xa007('0x48')]){_0x584104[_0x38bf9a[_0xa007('0x48')]]=_0x38bf9a['content'][_0xa007('0x49')]();}else if(_0x38bf9a[_0xa007('0x3a')]===_0xa007('0x4a')&&_0x38bf9a[_0xa007('0x4b')]&&_0x38bf9a[_0xa007('0x48')]){_0x36b512[_0x38bf9a[_0xa007('0x4b')]]&&(_0x584104[_0x38bf9a[_0xa007('0x48')]]=_0x36b512[_0x38bf9a[_0xa007('0x4b')]]['toString']());}else if(_0x38bf9a[_0xa007('0x3a')]===_0xa007('0x4c')&&_0x38bf9a[_0xa007('0x4d')]&&_0x38bf9a['Variable'][_0xa007('0x4e')]&&_0x38bf9a[_0xa007('0x48')]){_0x36b512[_0x38bf9a['Variable'][_0xa007('0x4e')]['toLowerCase']()]&&(_0x584104[_0x38bf9a['idField']]=_0x36b512[_0x38bf9a['Variable'][_0xa007('0x4e')][_0xa007('0x3b')]()][_0xa007('0x49')]());}});}return _0x584104;}function getConnection(_0x487a50){var _0x5aab4a=_0x487a50['password'][_0xa007('0x4f')](_0x487a50[_0xa007('0x50')]);var _0x1be743=new jsforce['Connection']({'oauth2':{'loginUrl':_0x487a50[_0xa007('0x51')]||_0xa007('0x52'),'clientId':_0x487a50[_0xa007('0x53')],'clientSecret':_0x487a50['clientSecret']}});return _0x1be743[_0xa007('0x54')](_0x487a50[_0xa007('0x55')],_0x5aab4a)[_0xa007('0x22')](function(){logger[_0xa007('0x1b')](_0xa007('0x56'));return _0x1be743;});}exports['queue']=function(_0x43cca7,_0x31ccac,_0x34251e,_0x3d948a,_0x45f1d1,_0x239269){var _0x186b6d,_0x4c829f,_0x59bae5,_0x2cdde9;_0x239269[_0xa007('0x57')]=intUtil[_0xa007('0x58')](_0x239269[_0xa007('0x57')]);_0x239269[_0xa007('0x51')]=intUtil[_0xa007('0x58')](_0x239269[_0xa007('0x51')]);if(_0x45f1d1&&_0x45f1d1[_0xa007('0x59')]){logger[_0xa007('0x1b')](_0xa007('0x5a'),_0xa007('0x5b'));_0x31ccac['recordingURL']=util[_0xa007('0x41')](_0xa007('0x5c'),_0x239269[_0xa007('0x57')],_0x31ccac['uniqueid'],md5(_0x31ccac['uniqueid']));}else{_0x31ccac[_0xa007('0x5d')]='';}return getConnection(_0x239269)[_0xa007('0x22')](function(_0x22a1b2){_0x2cdde9=_0x22a1b2;return getUser(_0x239269,_0x3d948a[_0xa007('0x5e')],_0x2cdde9);})[_0xa007('0x22')](function(_0x385f40){_0x186b6d=_0x385f40;return getEndUser(_0x239269,_0x34251e,_0x31ccac['calleridname'],_0x31ccac[_0xa007('0x5f')],_0x2cdde9);})[_0xa007('0x22')](function(_0x4ce95f){_0x4c829f=_0x4ce95f;return getTicket(_0x239269,_0x186b6d,_0x4c829f,_0x34251e,_0x31ccac,_0x34251e[_0xa007('0x60')],_0x2cdde9,_0xa007('0x61'));})[_0xa007('0x22')](function(_0x1184fa){_0x59bae5=_0x1184fa;logger[_0xa007('0x1b')](_0xa007('0x62'),_0x59bae5['id']);logger[_0xa007('0x1b')](_0xa007('0x63'),_0x59bae5['id'],_0x3d948a[_0xa007('0x4e')],_0x239269[_0xa007('0x3a')]);switch(_0x239269[_0xa007('0x3a')]){case _0xa007('0x64'):emit(util[_0xa007('0x41')](_0xa007('0x65'),_0x3d948a[_0xa007('0x4e')]),_0xa007('0x66'),{'recordId':_0x59bae5['id']});break;case _0xa007('0x67'):emit(util[_0xa007('0x41')]('user:%s',_0x3d948a[_0xa007('0x4e')]),_0xa007('0x68'),{'uri':util['format']('%s/%s/e',_0x2cdde9[_0xa007('0x69')],_0x59bae5['id'])});break;default:logger[_0xa007('0x6a')](_0xa007('0x6b'));}})[_0xa007('0x6c')](function(_0x3302fa){logger[_0xa007('0x6a')](_0xa007('0x5a'),_0x3302fa);});};exports[_0xa007('0x6d')]=function(_0x394ebb,_0x2fe9e0,_0x4efdf8,_0x562b1d,_0x357456,_0x4566dd,_0x130361){var _0x3e23d7,_0x31ab0e,_0x342e4f,_0x4d1f44;_0x4566dd[_0xa007('0x57')]=intUtil[_0xa007('0x58')](_0x4566dd[_0xa007('0x57')]);_0x4566dd[_0xa007('0x51')]=intUtil[_0xa007('0x58')](_0x4566dd['remoteUri']);if(_0x130361&&_0x130361[_0xa007('0x6e')]&&_0x130361[_0xa007('0x6e')]!==_0xa007('0x6f')){logger[_0xa007('0x1b')]('[OUTBOUND]',_0xa007('0x5b'));_0x2fe9e0['recordingURL']=util[_0xa007('0x41')](_0xa007('0x5c'),_0x4566dd[_0xa007('0x57')],_0x2fe9e0[_0xa007('0x70')],md5(_0x2fe9e0[_0xa007('0x70')]));}return getConnection(_0x4566dd)[_0xa007('0x22')](function(_0x1d05f4){_0x4d1f44=_0x1d05f4;return getUser(_0x4566dd,_0x562b1d[_0xa007('0x5e')],_0x4d1f44);})[_0xa007('0x22')](function(_0x2a032f){_0x3e23d7=_0x2a032f;return getEndUser(_0x4566dd,_0x4efdf8,_0x2fe9e0['destcalleridname'],_0x2fe9e0[_0xa007('0x71')],_0x4d1f44);})[_0xa007('0x22')](function(_0x1d41f5){_0x31ab0e=_0x1d41f5;return getTicket(_0x4566dd,_0x3e23d7,_0x31ab0e,_0x4efdf8,_0x2fe9e0,_0x4efdf8[_0xa007('0x60')],_0x4d1f44,'outbound');})[_0xa007('0x22')](function(_0x35a248){_0x342e4f=_0x35a248;logger[_0xa007('0x1b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x342e4f['id']);logger[_0xa007('0x1b')](_0xa007('0x72'),_0x342e4f['id'],_0x562b1d[_0xa007('0x4e')],_0x4566dd[_0xa007('0x3a')]);switch(_0x4566dd[_0xa007('0x3a')]){case _0xa007('0x64'):emit(util[_0xa007('0x41')](_0xa007('0x65'),_0x562b1d[_0xa007('0x4e')]),'trigger:salesforce:display',{'recordId':_0x342e4f['id']});break;case _0xa007('0x67'):emit(util['format']('user:%s',_0x562b1d[_0xa007('0x4e')]),_0xa007('0x68'),{'uri':util[_0xa007('0x41')](_0xa007('0x73'),_0x4d1f44[_0xa007('0x69')],_0x342e4f['id'])});break;default:logger[_0xa007('0x6a')](_0xa007('0x74'),_0xa007('0x75'));}})[_0xa007('0x6c')](function(_0x324f0f){logger['error']('[OUTBOUND]',_0x324f0f);});};exports['unmanaged']=function(_0x3f7541,_0x2549c2,_0x2576f4,_0x6f7cbb,_0x10ec12,_0x1dafe0){var _0x5a2d45,_0x2ac298,_0x90c4df,_0xf82419;_0x1dafe0[_0xa007('0x57')]=intUtil[_0xa007('0x58')](_0x1dafe0[_0xa007('0x57')]);_0x1dafe0[_0xa007('0x51')]=intUtil['stripTrailingSlash'](_0x1dafe0[_0xa007('0x51')]);if(_0x10ec12&&_0x10ec12[_0xa007('0x59')]){logger[_0xa007('0x1b')]('['+_0x2549c2[_0xa007('0x76')][_0xa007('0x77')]()+']',_0xa007('0x5b'));_0x2549c2[_0xa007('0x5d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1dafe0[_0xa007('0x57')],_0x2549c2[_0xa007('0x70')],md5(_0x2549c2[_0xa007('0x70')]));}else{_0x2549c2[_0xa007('0x5d')]='';}return getConnection(_0x1dafe0)[_0xa007('0x22')](function(_0x4cbbcd){_0xf82419=_0x4cbbcd;if(!_['isNil'](_0x6f7cbb)){return getUser(_0x1dafe0,_0x6f7cbb['name'],_0xf82419);}else{return getUser(_0x1dafe0,null,_0xf82419);}})[_0xa007('0x22')](function(_0x1c2144){_0x5a2d45=_0x1c2144;return getEndUser(_0x1dafe0,_0x2576f4,_0x2549c2['calleridname'],_0x2549c2[_0xa007('0x5f')],_0xf82419);})[_0xa007('0x22')](function(_0x32fbb1){_0x2ac298=_0x32fbb1;return getTicket(_0x1dafe0,_0x5a2d45,_0x2ac298,_0x2576f4,_0x2549c2,_0x2576f4[_0xa007('0x60')],_0xf82419);})[_0xa007('0x22')](function(_0x2484c8){_0x90c4df=_0x2484c8;logger[_0xa007('0x1b')]('['+_0x2549c2['lastevent'][_0xa007('0x77')]()+_0xa007('0x78'),_0x90c4df['id']);logger[_0xa007('0x1b')]('['+_0x2549c2[_0xa007('0x76')][_0xa007('0x77')]()+_0xa007('0x79'),_0x1dafe0[_0xa007('0x3a')]);})[_0xa007('0x6c')](function(_0x5d6e0f){logger[_0xa007('0x6a')]('['+_0x2549c2[_0xa007('0x76')][_0xa007('0x77')]()+']',_0x5d6e0f);});}; \ 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 a0db89e..589127a 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 _0x18a6=['localhost','redis','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','],\x20getUser\x20input\x20crm','validateEmail','GET','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','],\x20getUser\x20crm','adminEmail','POST','endUserNumber','user','System','then','],\x20EndUser\x20schema','endUserId','error','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','toString','variable','variableName','customVariable','Variable','name','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','ticketNumber','push','all','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','userEmail','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','defaults'];(function(_0x4cb1a9,_0x384b63){var _0x26c2fe=function(_0xb559e7){while(--_0xb559e7){_0x4cb1a9['push'](_0x4cb1a9['shift']());}};_0x26c2fe(++_0x384b63);}(_0x18a6,0x12d));var _0x618a=function(_0x5d7339,_0x3d01f6){_0x5d7339=_0x5d7339-0x0;var _0x8580ec=_0x18a6[_0x5d7339];return _0x8580ec;};'use strict';var _=require(_0x618a('0x0'));var Promise=require('bluebird');var rp=require(_0x618a('0x1'));var util=require('util');var md5=require(_0x618a('0x2'));var Redis=require(_0x618a('0x3'));var intUtil=require('./util');var config=require(_0x618a('0x4'));var logger=require(_0x618a('0x5'))(_0x618a('0x6'));config['redis']=_[_0x618a('0x7')](config['redis'],{'host':_0x618a('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x618a('0x9')]));function getAdminUser(_0x2ad2cc,_0xb555ab,_0x9cc3d,_0x2faf65,_0x734c38,_0x3e341e){return new Promise(function(_0x321e94,_0x5bdef1){var _0x126f38={'method':'GET','uri':_0x2faf65+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x734c38+'&'+_0x3e341e,'auth':_0xb555ab,'json':!![]};return rp(_0x126f38)['then'](function(_0x1a5945){if(_0x1a5945[_0x618a('0xa')]['length']>0x0){_0x9cc3d[_0x618a('0xb')]=_0x1a5945[_0x618a('0xa')][0x0][_0x618a('0xc')];}logger['info']('['+[_0x2ad2cc[_0x618a('0xd')]()]+_0x618a('0xe'),_0x9cc3d);_0x321e94(_0x9cc3d);})[_0x618a('0xf')](function(_0x3999d1){logger['error']('['+[_0x2ad2cc[_0x618a('0xd')]()]+']',_0x3999d1[_0x618a('0x10')]);_0x5bdef1(_0x3999d1['message']);});});}function getUser(_0x4f01ee,_0x4b6391,_0x5b9cd2,_0x53cfcc,_0x55255c){return function(_0x5808f6){logger[_0x618a('0x11')]('['+[_0x4f01ee[_0x618a('0xd')]()]+_0x618a('0x12'),_0x5808f6);return new Promise(function(_0x4bc1cd,_0x1c636e){if(intUtil[_0x618a('0x13')](_0x5808f6['userEmail'])){var _0x3de506={'method':_0x618a('0x14'),'uri':_0x5b9cd2+'sys_user?sysparm_query=email%3D'+_0x5808f6['userEmail']+'&'+_0x53cfcc+'&'+_0x55255c,'auth':_0x4b6391,'json':!![]};logger['info']('['+[_0x4f01ee[_0x618a('0xd')]()]+_0x618a('0x15'),_0x3de506);return rp(_0x3de506)['then'](function(_0x12cf88){logger['info']('['+[_0x4f01ee[_0x618a('0xd')]()]+_0x618a('0x16'),_0x12cf88);if(_0x12cf88['result'][_0x618a('0x17')]>0x0&&String(_0x12cf88[_0x618a('0xa')][0x0]['active'])===_0x618a('0x18')){_0x5808f6['userId']=_0x12cf88[_0x618a('0xa')][0x0][_0x618a('0xc')];}else{_0x5808f6[_0x618a('0x19')]=_0x5808f6[_0x618a('0xb')];_0x5808f6['userEmail']=_0x5808f6['adminEmail'];}logger[_0x618a('0x11')]('['+[_0x4f01ee[_0x618a('0xd')]()]+_0x618a('0x1a'),_0x5808f6);_0x4bc1cd(_0x5808f6);})['catch'](function(_0x48b075){logger['error']('['+[_0x4f01ee[_0x618a('0xd')]()]+']',_0x48b075['message']);_0x1c636e(_0x48b075[_0x618a('0x10')]);});}else{logger[_0x618a('0x11')]('['+[_0x4f01ee[_0x618a('0xd')]()]+']\x20using\x20admin\x20profile');_0x5808f6[_0x618a('0x19')]=_0x5808f6[_0x618a('0xb')];_0x5808f6['userEmail']=_0x5808f6[_0x618a('0x1b')];_0x4bc1cd(_0x5808f6);}});};}function createEndUser(_0x1e93a4,_0x5bbc5d,_0x513dc0,_0x29c98a,_0x4b3d94){logger[_0x618a('0x11')]('['+[_0x1e93a4['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x513dc0);return new Promise(function(_0x5def0f,_0x2104e6){var _0x241f77={'method':_0x618a('0x1c'),'uri':_0x29c98a+'sys_user?'+_0x4b3d94,'body':{'user_name':_0x513dc0[_0x618a('0x1d')],'roles':_0x618a('0x1e'),'first_name':_0x513dc0[_0x618a('0x1d')],'active':_0x618a('0x18'),'date_format':_0x618a('0x1f'),'phone':_0x513dc0[_0x618a('0x1d')]},'auth':_0x5bbc5d,'json':!![]};return rp(_0x241f77)[_0x618a('0x20')](function(_0x68458d){logger[_0x618a('0x11')]('['+[_0x1e93a4['toUpperCase']()]+_0x618a('0x21'),_0x68458d[_0x618a('0xa')]);_0x513dc0[_0x618a('0x22')]=_0x68458d[_0x618a('0xa')][_0x618a('0xc')];_0x5def0f(_0x513dc0);})[_0x618a('0xf')](function(_0x46ed83){logger[_0x618a('0x23')]('['+[_0x1e93a4[_0x618a('0xd')]()]+']',_0x46ed83[_0x618a('0x10')]);_0x2104e6(_0x46ed83[_0x618a('0x10')]);});});}function getEndUser(_0x5cfda3,_0x3775cc,_0x1f54a6,_0x37cebe,_0x490800){return function(_0x3a2c60){logger[_0x618a('0x11')]('['+[_0x5cfda3[_0x618a('0xd')]()]+_0x618a('0x24'),_0x3a2c60);return new Promise(function(_0x54f9a5,_0x3adb5d){var _0x566fd9={'method':'GET','uri':_0x1f54a6+_0x618a('0x25')+_0x3a2c60[_0x618a('0x1d')]+'&'+_0x37cebe+'&'+_0x490800,'auth':_0x3775cc,'json':!![]};return rp(_0x566fd9)[_0x618a('0x20')](function(_0x33850b){if(_0x33850b[_0x618a('0xa')][_0x618a('0x17')]>0x0){_0x3a2c60['endUserId']=_0x33850b[_0x618a('0xa')][0x0]['sys_id'];logger[_0x618a('0x11')]('['+[_0x5cfda3[_0x618a('0xd')]()]+_0x618a('0x26'),_0x3a2c60);_0x54f9a5(_0x3a2c60);}else{return createEndUser(_0x5cfda3,_0x3775cc,_0x3a2c60,_0x1f54a6,_0x37cebe)[_0x618a('0x20')](function(_0x56a43b){logger[_0x618a('0x11')]('['+[_0x5cfda3[_0x618a('0xd')]()]+_0x618a('0x27'),_0x56a43b);_0x54f9a5(_0x56a43b);});}})[_0x618a('0xf')](function(_0x4967de){logger['error']('['+[_0x5cfda3[_0x618a('0xd')]()]+']',_0x4967de[_0x618a('0x10')]);_0x3adb5d(_0x4967de[_0x618a('0x10')]);});});};}function getCustomFields(_0x42ac3f,_0x375a9b){var _0x2d7f2b={};if(_0x42ac3f[_0x618a('0x17')]>0x0){_[_0x618a('0x28')](_0x42ac3f,function(_0xd887aa){if(_[_0x618a('0x29')]([_0x618a('0x2a'),_0x618a('0x2b')],_0xd887aa[_0x618a('0x2c')])&&_0xd887aa[_0x618a('0x2d')]&&!_0xd887aa[_0x618a('0x2e')]){_0x2d7f2b[_0xd887aa['nameField'][_0x618a('0x2f')]()]=_0xd887aa[_0x618a('0x30')]['toString']();}else if(_[_0x618a('0x29')]([_0x618a('0x2a'),_0x618a('0x2b')],_0xd887aa['type'])&&_0xd887aa[_0x618a('0x31')]&&_0xd887aa[_0x618a('0x2e')]){_0x2d7f2b[_0xd887aa[_0x618a('0x31')][_0x618a('0x2f')]()]=_0xd887aa[_0x618a('0x30')][_0x618a('0x32')]();}else if(_0xd887aa[_0x618a('0x2c')]===_0x618a('0x33')&&_0xd887aa[_0x618a('0x34')]&&_0xd887aa[_0x618a('0x31')]&&_0xd887aa[_0x618a('0x2e')]){_0x2d7f2b[_0xd887aa[_0x618a('0x31')][_0x618a('0x2f')]()]=_0x375a9b[_0xd887aa[_0x618a('0x34')]][_0x618a('0x32')]();}else if(_0xd887aa['type']===_0x618a('0x35')&&_0xd887aa[_0x618a('0x36')]&&_0xd887aa[_0x618a('0x36')]['name']&&_0xd887aa[_0x618a('0x31')]&&_0xd887aa[_0x618a('0x2e')]){_0x2d7f2b[_0xd887aa['idField'][_0x618a('0x2f')]()]=_0x375a9b[_0xd887aa['Variable'][_0x618a('0x37')][_0x618a('0x2f')]()][_0x618a('0x32')]();}});}return _0x2d7f2b;}function getTicket(_0x3eed45,_0x3e0509,_0x3b09e4,_0x57a407,_0xa77a0,_0x12f614){return function(_0x509837){logger[_0x618a('0x11')]('['+[_0x3eed45[_0x618a('0xd')]()]+']\x20getTicket\x20input\x20crm',_0x509837);return new Promise(function(_0x22178c,_0x2362ae){var _0x2ae496=_0x3eed45[_0x618a('0x2f')]()===_0x618a('0x38')?_0x509837[_0x618a('0x19')]:_0x509837[_0x618a('0x22')];var _0x2087d0={'method':_0x618a('0x1c'),'uri':_0x3b09e4+_0x618a('0x39')+'?'+_0x12f614,'body':Object['assign']({},{'active':_0x618a('0x18'),'caller_id':_0x2ae496,'assigned_to':_0x509837[_0x618a('0x19')],'short_description':intUtil[_0x618a('0x3a')](_0x57a407['Subjects'],_0xa77a0,'\x20'),'description':intUtil[_0x618a('0x3a')](_0x57a407[_0x618a('0x3b')],_0xa77a0,'\x0a')},getCustomFields(_0x57a407[_0x618a('0x3c')],_0xa77a0)),'auth':_0x3e0509,'json':!![]};return rp(_0x2087d0)[_0x618a('0x20')](function(_0x416b20){logger[_0x618a('0x11')]('['+[_0x3eed45[_0x618a('0xd')]()]+_0x618a('0x3d'),_0x416b20[_0x618a('0xa')]);_0x509837['ticketId']=_0x416b20[_0x618a('0xa')][_0x618a('0xc')];_0x509837['ticketNumber']=_0x416b20[_0x618a('0xa')][_0x618a('0x3e')];logger[_0x618a('0x11')]('['+[_0x3eed45[_0x618a('0xd')]()]+_0x618a('0x3f'),_0x509837);_0x22178c(_0x509837);})[_0x618a('0xf')](function(_0x1b0fbe){logger['error']('['+[_0x3eed45[_0x618a('0xd')]()]+']',_0x1b0fbe[_0x618a('0x10')]);_0x2362ae(_0x1b0fbe['message']);});});};}function createRemoteTag(_0x2aa03e,_0x3809ab,_0x1579ae,_0x206375){return new Promise(function(_0x2e70d1,_0x19c155){var _0x5f1d5c={'method':_0x618a('0x1c'),'uri':_0x1579ae+'label'+'?'+_0x206375,'body':{'short_description':_0x2aa03e,'global':!![],'active':!![],'name':_0x2aa03e},'auth':_0x3809ab,'json':!![]};return rp(_0x5f1d5c)['then'](function(_0x381ad0){var _0x5da97b=_0x381ad0[_0x618a('0xa')][_0x618a('0xc')];_0x2e70d1(_0x5da97b);});});}function getRemoteTag(_0xdfafc,_0xf27f61,_0x3a426a,_0x185031,_0x9c0b9c){return new Promise(function(_0x5e382b,_0xd3d657){var _0xe16536={'method':_0x618a('0x14'),'uri':_0x3a426a+_0x618a('0x40')+_0x618a('0x41')+_0xdfafc+'&'+_0x185031,'auth':_0xf27f61,'json':!![]};return rp(_0xe16536)['then'](function(_0x6c0de){if(_0x6c0de[_0x618a('0xa')]['length']>0x0){var _0x2de299=_0x6c0de[_0x618a('0xa')][0x0]['sys_id'];_0x5e382b(_0x2de299);}else{return createRemoteTag(_0xdfafc,_0xf27f61,_0x3a426a,_0x185031)[_0x618a('0x20')](function(_0x4e2433){_0x5e382b(_0x4e2433);});}});});}function assignTagToIncident(_0x2e238a,_0x4bfdd3,_0x5aa0c9,_0x21dfea,_0x2c3df2){return new Promise(function(_0x40504f,_0x56a24d){var _0x3ec66c={'method':_0x618a('0x1c'),'uri':_0x5aa0c9+'label_entry'+'?'+_0x2c3df2,'body':{'label':_0x2e238a,'table':_0x618a('0x39'),'id_type':'Incident','table_key':_0x21dfea['ticketId'],'title':_0x618a('0x42')+_0x21dfea[_0x618a('0x43')],'id_display':_0x21dfea[_0x618a('0x43')]},'auth':_0x4bfdd3,'json':!![]};return rp(_0x3ec66c)[_0x618a('0x20')](function(_0x5d7bf7){_0x40504f();})[_0x618a('0xf')](function(){_0x40504f();});});}function manageTags(_0x4d3c81,_0x29fe94,_0x483760,_0x16f5d3,_0x3b62c0,_0x14d7e9,_0x327c00){return new Promise(function(_0x4728f2,_0x56c3fb){var _0x45bfd8=[];_0x29fe94[_0x618a('0x28')](function(_0x5c3bd6){_0x45bfd8[_0x618a('0x44')](getRemoteTag(_0x5c3bd6,_0x483760,_0x16f5d3,_0x14d7e9,_0x327c00));});return Promise[_0x618a('0x45')](_0x45bfd8)[_0x618a('0x20')](function(_0x230e53){if(_0x230e53[_0x618a('0x17')]){logger['info']('['+[_0x4d3c81[_0x618a('0xd')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x230e53);var _0x42f551=[];_0x230e53[_0x618a('0x28')](function(_0x2e066a){_0x42f551[_0x618a('0x44')](assignTagToIncident(_0x2e066a,_0x483760,_0x16f5d3,_0x3b62c0,_0x14d7e9));});return Promise[_0x618a('0x45')](_0x42f551)[_0x618a('0x20')](function(){_0x4728f2();})[_0x618a('0xf')](function(){_0x4728f2();});}else{_0x4728f2();}});});}function getTags(_0x2cccf6,_0x4d87f0,_0x5f3c79,_0x4ca58e,_0x6b9b0,_0x18d9c7){return function(_0x5d6f1b){return new Promise(function(_0xc45c38,_0x4acbe6){var _0x49a039=[];var _0x3432bc=_0x4ca58e['Tags'];if(_0x3432bc&&_0x3432bc['length']>0x0){_0x49a039=_['map'](_0x3432bc,'name');}if(_0x49a039[_0x618a('0x17')]>0x0){return manageTags(_0x2cccf6,_0x49a039,_0x4d87f0,_0x5f3c79,_0x5d6f1b,_0x6b9b0,_0x18d9c7)[_0x618a('0x20')](function(){_0xc45c38(_0x5d6f1b);});}else{_0xc45c38(_0x5d6f1b);}});};}function emit(_0xbcaab7,_0x4a46a1,_0x3bf359){var _0x2432a5='%26sysparm_record_target%3Dincident'+_0x618a('0x46')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x618a('0x47');var _0x427da3={'uri':_0xbcaab7+_0x618a('0x48')+_0x3bf359+_0x2432a5};io['to'](util['format'](_0x618a('0x49'),_0x4a46a1))[_0x618a('0x4a')](_0x618a('0x4b'),_0x427da3);}exports['cs']=function(_0x2a3549,_0x196fec,_0x59294a,_0x3e60fc,_0x3e92c0,_0x50c354,_0x33473e,_0x2a8a22){var _0x1c92d0={};var _0x7ae920={'user':_0x50c354[_0x618a('0x4c')],'pass':_0x50c354[_0x618a('0x4d')]};var _0x4c68d8=_0x618a('0x4e');var _0x25f2ac=_0x618a('0x4f');_0x50c354[_0x618a('0x50')]=intUtil[_0x618a('0x51')](_0x50c354['remoteUri']);_0x50c354[_0x618a('0x52')]=intUtil[_0x618a('0x51')](_0x50c354[_0x618a('0x52')]);var _0x5dd5a6=util[_0x618a('0x53')](_0x618a('0x54'),_0x50c354[_0x618a('0x50')]);_0x1c92d0[_0x618a('0x55')]=!_['isNil'](_0x3e60fc)?_0x3e60fc[_0x618a('0x56')]:null;_0x1c92d0[_0x618a('0x1b')]=_0x50c354[_0x618a('0x56')];_0x1c92d0[_0x618a('0x1d')]=_0x2a8a22[_0x618a('0x2f')]()===_0x618a('0x38')?_0x196fec[_0x618a('0x57')]:_0x196fec[_0x618a('0x58')];_0x1c92d0[_0x618a('0x59')]=_0x2a8a22==='queue'||_0x2a8a22==='unmanaged'?_0x618a('0x5a'):_0x618a('0x38');var _0x5d8443=util[_0x618a('0x53')](_0x618a('0x5b'),_0x50c354[_0x618a('0x52')],_0x196fec[_0x618a('0x5c')],md5(_0x196fec[_0x618a('0x5c')]));if(_0x3e92c0&&_0x3e92c0['monitor_format']){logger[_0x618a('0x11')]('[QUEUE]',_0x618a('0x5d'));_0x196fec[_0x618a('0x5e')]=_0x5d8443;}else if(_0x33473e&&_0x33473e[_0x618a('0x5f')]&&_0x33473e[_0x618a('0x5f')]!=='none'){logger[_0x618a('0x11')](_0x618a('0x60'),'Recording\x20is\x20enabled!');_0x196fec[_0x618a('0x5e')]=_0x5d8443;}else{_0x196fec[_0x618a('0x5e')]='';}return getAdminUser(_0x2a8a22,_0x7ae920,_0x1c92d0,_0x5dd5a6,_0x25f2ac,_0x4c68d8)[_0x618a('0x20')](getUser(_0x2a8a22,_0x7ae920,_0x5dd5a6,_0x25f2ac,_0x4c68d8))[_0x618a('0x20')](getEndUser(_0x2a8a22,_0x7ae920,_0x5dd5a6,_0x25f2ac,_0x4c68d8))[_0x618a('0x20')](getTicket(_0x2a8a22,_0x7ae920,_0x5dd5a6,_0x59294a,_0x196fec,_0x25f2ac))[_0x618a('0x20')](function(_0x546af5){logger[_0x618a('0x11')](util[_0x618a('0x53')](_0x618a('0x61'),_0x546af5[_0x618a('0x62')]));logger[_0x618a('0x11')](util['format'](_0x618a('0x63'),_0x2a8a22));if(_0x2a8a22!==_0x618a('0x64')){logger['info']('['+[_0x2a8a22[_0x618a('0xd')]()]+']',_0x618a('0x65'));emit(_0x50c354[_0x618a('0x50')],_0x3e60fc[_0x618a('0x37')],_0x546af5['ticketId']);}})[_0x618a('0xf')](function(_0x2d0d41){logger[_0x618a('0x23')]('['+[_0x2a8a22[_0x618a('0xd')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x618a('0x66')](_0x2d0d41,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2bd3=['unmanaged','queue','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20rp\x20obj','true','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','type','customField','nameField','toLowerCase','toString','idField','variable','variableName','customVariable','Variable','name','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','incident','Incident\x20-\x20','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','outbound','destcalleridnum','callDirection'];(function(_0x363e98,_0x36f200){var _0x566bdb=function(_0x2713a4){while(--_0x2713a4){_0x363e98['push'](_0x363e98['shift']());}};_0x566bdb(++_0x36f200);}(_0x2bd3,0x1a0));var _0x32bd=function(_0x1bdfe7,_0x5c062c){_0x1bdfe7=_0x1bdfe7-0x0;var _0x6dc98e=_0x2bd3[_0x1bdfe7];return _0x6dc98e;};'use strict';var _=require(_0x32bd('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0x32bd('0x1'));var md5=require(_0x32bd('0x2'));var Redis=require(_0x32bd('0x3'));var intUtil=require(_0x32bd('0x4'));var config=require(_0x32bd('0x5'));var logger=require(_0x32bd('0x6'))(_0x32bd('0x7'));config['redis']=_[_0x32bd('0x8')](config[_0x32bd('0x9')],{'host':_0x32bd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32bd('0x9')]));function getAdminUser(_0x15f955,_0x1da8e0,_0x6abe74,_0x7a4cff,_0x562960,_0x385a6c){return new Promise(function(_0x5352a8,_0x3f86d7){var _0x2d09b0={'method':_0x32bd('0xb'),'uri':_0x7a4cff+_0x32bd('0xc')+'&'+_0x562960+'&'+_0x385a6c,'auth':_0x1da8e0,'json':!![]};return rp(_0x2d09b0)[_0x32bd('0xd')](function(_0x31031a){if(_0x31031a[_0x32bd('0xe')][_0x32bd('0xf')]>0x0){_0x6abe74['adminId']=_0x31031a['result'][0x0][_0x32bd('0x10')];}logger[_0x32bd('0x11')]('['+[_0x15f955[_0x32bd('0x12')]()]+_0x32bd('0x13'),_0x6abe74);_0x5352a8(_0x6abe74);})[_0x32bd('0x14')](function(_0xeb11f8){logger[_0x32bd('0x15')]('['+[_0x15f955[_0x32bd('0x12')]()]+']',_0xeb11f8[_0x32bd('0x16')]);_0x3f86d7(_0xeb11f8['message']);});});}function getUser(_0xea3a29,_0x245e58,_0x14d9bc,_0x3521b0,_0x6ff3b7){return function(_0x542619){logger[_0x32bd('0x11')]('['+[_0xea3a29[_0x32bd('0x12')]()]+_0x32bd('0x17'),_0x542619);return new Promise(function(_0x40264b,_0x2cfeb5){if(intUtil['validateEmail'](_0x542619[_0x32bd('0x18')])){var _0x1fb731={'method':_0x32bd('0xb'),'uri':_0x14d9bc+'sys_user?sysparm_query=email%3D'+_0x542619[_0x32bd('0x18')]+'&'+_0x3521b0+'&'+_0x6ff3b7,'auth':_0x245e58,'json':!![]};logger[_0x32bd('0x11')]('['+[_0xea3a29[_0x32bd('0x12')]()]+_0x32bd('0x19'),_0x1fb731);return rp(_0x1fb731)[_0x32bd('0xd')](function(_0x218fff){logger['info']('['+[_0xea3a29[_0x32bd('0x12')]()]+'],\x20getUser\x20entity',_0x218fff);if(_0x218fff[_0x32bd('0xe')][_0x32bd('0xf')]>0x0&&String(_0x218fff[_0x32bd('0xe')][0x0]['active'])===_0x32bd('0x1a')){_0x542619[_0x32bd('0x1b')]=_0x218fff[_0x32bd('0xe')][0x0][_0x32bd('0x10')];}else{_0x542619[_0x32bd('0x1b')]=_0x542619[_0x32bd('0x1c')];_0x542619[_0x32bd('0x18')]=_0x542619[_0x32bd('0x1d')];}logger[_0x32bd('0x11')]('['+[_0xea3a29[_0x32bd('0x12')]()]+_0x32bd('0x1e'),_0x542619);_0x40264b(_0x542619);})[_0x32bd('0x14')](function(_0x54ab7f){logger['error']('['+[_0xea3a29[_0x32bd('0x12')]()]+']',_0x54ab7f[_0x32bd('0x16')]);_0x2cfeb5(_0x54ab7f[_0x32bd('0x16')]);});}else{logger[_0x32bd('0x11')]('['+[_0xea3a29[_0x32bd('0x12')]()]+_0x32bd('0x1f'));_0x542619[_0x32bd('0x1b')]=_0x542619[_0x32bd('0x1c')];_0x542619[_0x32bd('0x18')]=_0x542619[_0x32bd('0x1d')];_0x40264b(_0x542619);}});};}function createEndUser(_0x31611c,_0x3678c7,_0x4a9b30,_0x5e3add,_0x21940c){logger[_0x32bd('0x11')]('['+[_0x31611c[_0x32bd('0x12')]()]+_0x32bd('0x20'),_0x4a9b30);return new Promise(function(_0x234557,_0x1e474b){var _0x1cce65={'method':_0x32bd('0x21'),'uri':_0x5e3add+'sys_user?'+_0x21940c,'body':{'user_name':_0x4a9b30[_0x32bd('0x22')],'roles':_0x32bd('0x23'),'first_name':_0x4a9b30['endUserNumber'],'active':'true','date_format':'System','phone':_0x4a9b30[_0x32bd('0x22')]},'auth':_0x3678c7,'json':!![]};return rp(_0x1cce65)[_0x32bd('0xd')](function(_0x2999c8){logger['info']('['+[_0x31611c['toUpperCase']()]+_0x32bd('0x24'),_0x2999c8['result']);_0x4a9b30[_0x32bd('0x25')]=_0x2999c8[_0x32bd('0xe')][_0x32bd('0x10')];_0x234557(_0x4a9b30);})['catch'](function(_0x20a4da){logger['error']('['+[_0x31611c[_0x32bd('0x12')]()]+']',_0x20a4da[_0x32bd('0x16')]);_0x1e474b(_0x20a4da[_0x32bd('0x16')]);});});}function getEndUser(_0x469327,_0x57f08c,_0x4f2a76,_0x393510,_0x2bffa7){return function(_0x585e4d){logger[_0x32bd('0x11')]('['+[_0x469327[_0x32bd('0x12')]()]+_0x32bd('0x26'),_0x585e4d);return new Promise(function(_0x5b9186,_0x3ec15b){var _0x414d03={'method':_0x32bd('0xb'),'uri':_0x4f2a76+_0x32bd('0x27')+_0x585e4d[_0x32bd('0x22')]+'&'+_0x393510+'&'+_0x2bffa7,'auth':_0x57f08c,'json':!![]};return rp(_0x414d03)[_0x32bd('0xd')](function(_0x5923f5){if(_0x5923f5[_0x32bd('0xe')][_0x32bd('0xf')]>0x0){_0x585e4d[_0x32bd('0x25')]=_0x5923f5[_0x32bd('0xe')][0x0]['sys_id'];logger[_0x32bd('0x11')]('['+[_0x469327[_0x32bd('0x12')]()]+_0x32bd('0x28'),_0x585e4d);_0x5b9186(_0x585e4d);}else{return createEndUser(_0x469327,_0x57f08c,_0x585e4d,_0x4f2a76,_0x393510)[_0x32bd('0xd')](function(_0x4c518e){logger[_0x32bd('0x11')]('['+[_0x469327[_0x32bd('0x12')]()]+'],\x20createEndUser\x20crm',_0x4c518e);_0x5b9186(_0x4c518e);});}})[_0x32bd('0x14')](function(_0x34f9d7){logger[_0x32bd('0x15')]('['+[_0x469327[_0x32bd('0x12')]()]+']',_0x34f9d7['message']);_0x3ec15b(_0x34f9d7['message']);});});};}function getCustomFields(_0x3d840c,_0xef878b){var _0x3353db={};if(_0x3d840c[_0x32bd('0xf')]>0x0){_[_0x32bd('0x29')](_0x3d840c,function(_0x557537){if(_[_0x32bd('0x2a')]([_0x32bd('0x2b'),'picklist'],_0x557537[_0x32bd('0x2c')])&&_0x557537['nameField']&&!_0x557537[_0x32bd('0x2d')]){_0x3353db[_0x557537[_0x32bd('0x2e')][_0x32bd('0x2f')]()]=_0x557537['content'][_0x32bd('0x30')]();}else if(_[_0x32bd('0x2a')](['string','picklist'],_0x557537[_0x32bd('0x2c')])&&_0x557537[_0x32bd('0x31')]&&_0x557537[_0x32bd('0x2d')]){_0x3353db[_0x557537['idField'][_0x32bd('0x2f')]()]=_0x557537['content'][_0x32bd('0x30')]();}else if(_0x557537[_0x32bd('0x2c')]===_0x32bd('0x32')&&_0x557537[_0x32bd('0x33')]&&_0x557537[_0x32bd('0x31')]&&_0x557537[_0x32bd('0x2d')]){_0x3353db[_0x557537[_0x32bd('0x31')][_0x32bd('0x2f')]()]=_0xef878b[_0x557537[_0x32bd('0x33')]][_0x32bd('0x30')]();}else if(_0x557537['type']===_0x32bd('0x34')&&_0x557537[_0x32bd('0x35')]&&_0x557537[_0x32bd('0x35')][_0x32bd('0x36')]&&_0x557537[_0x32bd('0x31')]&&_0x557537[_0x32bd('0x2d')]){_0x3353db[_0x557537['idField'][_0x32bd('0x2f')]()]=_0xef878b[_0x557537[_0x32bd('0x35')][_0x32bd('0x36')][_0x32bd('0x2f')]()][_0x32bd('0x30')]();}});}return _0x3353db;}function getTicket(_0x59d44a,_0x20701d,_0x27bda7,_0x33a13d,_0x390e14,_0x15f87f){return function(_0x3e8669){logger[_0x32bd('0x11')]('['+[_0x59d44a[_0x32bd('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x3e8669);return new Promise(function(_0x3489d8,_0x1bca6a){var _0x5abd2d=_0x59d44a[_0x32bd('0x2f')]()==='outbound'?_0x3e8669[_0x32bd('0x1b')]:_0x3e8669['endUserId'];var _0x326318={'method':_0x32bd('0x21'),'uri':_0x27bda7+'incident'+'?'+_0x15f87f,'body':Object['assign']({},{'active':_0x32bd('0x1a'),'caller_id':_0x5abd2d,'assigned_to':_0x3e8669['userId'],'short_description':intUtil[_0x32bd('0x37')](_0x33a13d[_0x32bd('0x38')],_0x390e14,'\x20'),'description':intUtil[_0x32bd('0x37')](_0x33a13d[_0x32bd('0x39')],_0x390e14,'\x0a')},getCustomFields(_0x33a13d[_0x32bd('0x3a')],_0x390e14)),'auth':_0x20701d,'json':!![]};return rp(_0x326318)['then'](function(_0x51f74f){logger['info']('['+[_0x59d44a[_0x32bd('0x12')]()]+_0x32bd('0x3b'),_0x51f74f[_0x32bd('0xe')]);_0x3e8669[_0x32bd('0x3c')]=_0x51f74f['result']['sys_id'];_0x3e8669['ticketNumber']=_0x51f74f[_0x32bd('0xe')][_0x32bd('0x3d')];logger[_0x32bd('0x11')]('['+[_0x59d44a[_0x32bd('0x12')]()]+_0x32bd('0x3e'),_0x3e8669);_0x3489d8(_0x3e8669);})['catch'](function(_0x27eaaa){logger[_0x32bd('0x15')]('['+[_0x59d44a[_0x32bd('0x12')]()]+']',_0x27eaaa[_0x32bd('0x16')]);_0x1bca6a(_0x27eaaa[_0x32bd('0x16')]);});});};}function createRemoteTag(_0x214ffb,_0x26830b,_0x339162,_0x328150){return new Promise(function(_0x447436,_0xef76df){var _0x12a07a={'method':_0x32bd('0x21'),'uri':_0x339162+'label'+'?'+_0x328150,'body':{'short_description':_0x214ffb,'global':!![],'active':!![],'name':_0x214ffb},'auth':_0x26830b,'json':!![]};return rp(_0x12a07a)[_0x32bd('0xd')](function(_0x16fb75){var _0x35b457=_0x16fb75[_0x32bd('0xe')]['sys_id'];_0x447436(_0x35b457);});});}function getRemoteTag(_0x73a5b7,_0x4abccb,_0x36eff7,_0x3aee7b,_0x353d71){return new Promise(function(_0x3abd7a,_0x26a032){var _0x85a19f={'method':_0x32bd('0xb'),'uri':_0x36eff7+'label'+_0x32bd('0x3f')+_0x73a5b7+'&'+_0x3aee7b,'auth':_0x4abccb,'json':!![]};return rp(_0x85a19f)['then'](function(_0x11617e){if(_0x11617e['result'][_0x32bd('0xf')]>0x0){var _0x4b208e=_0x11617e[_0x32bd('0xe')][0x0][_0x32bd('0x10')];_0x3abd7a(_0x4b208e);}else{return createRemoteTag(_0x73a5b7,_0x4abccb,_0x36eff7,_0x3aee7b)[_0x32bd('0xd')](function(_0xd04dd1){_0x3abd7a(_0xd04dd1);});}});});}function assignTagToIncident(_0x3525a9,_0x4277d9,_0x2deb6b,_0x187c0a,_0x17ce2c){return new Promise(function(_0x4702f7,_0x116a21){var _0x46271a={'method':'POST','uri':_0x2deb6b+_0x32bd('0x40')+'?'+_0x17ce2c,'body':{'label':_0x3525a9,'table':_0x32bd('0x41'),'id_type':'Incident','table_key':_0x187c0a[_0x32bd('0x3c')],'title':_0x32bd('0x42')+_0x187c0a[_0x32bd('0x43')],'id_display':_0x187c0a[_0x32bd('0x43')]},'auth':_0x4277d9,'json':!![]};return rp(_0x46271a)[_0x32bd('0xd')](function(_0x32a854){_0x4702f7();})[_0x32bd('0x14')](function(){_0x4702f7();});});}function manageTags(_0x311973,_0x32f4c9,_0x2552b9,_0x1fa1c8,_0x5cd2d7,_0x3c1589,_0x2af041){return new Promise(function(_0x2bf2e5,_0x12cfa7){var _0x2ab7ae=[];_0x32f4c9[_0x32bd('0x29')](function(_0x5ef2db){_0x2ab7ae['push'](getRemoteTag(_0x5ef2db,_0x2552b9,_0x1fa1c8,_0x3c1589,_0x2af041));});return Promise['all'](_0x2ab7ae)[_0x32bd('0xd')](function(_0x2c2820){if(_0x2c2820[_0x32bd('0xf')]){logger[_0x32bd('0x11')]('['+[_0x311973['toUpperCase']()]+_0x32bd('0x44'),_0x2c2820);var _0xb735a6=[];_0x2c2820[_0x32bd('0x29')](function(_0x238d3b){_0xb735a6[_0x32bd('0x45')](assignTagToIncident(_0x238d3b,_0x2552b9,_0x1fa1c8,_0x5cd2d7,_0x3c1589));});return Promise[_0x32bd('0x46')](_0xb735a6)[_0x32bd('0xd')](function(){_0x2bf2e5();})[_0x32bd('0x14')](function(){_0x2bf2e5();});}else{_0x2bf2e5();}});});}function getTags(_0x32b485,_0x268d17,_0x47e27e,_0xe32ed3,_0x1c7534,_0x2f1fb2){return function(_0x190a93){return new Promise(function(_0x34da5e,_0x5484cd){var _0xd58e6c=[];var _0x4ad6ac=_0xe32ed3[_0x32bd('0x47')];if(_0x4ad6ac&&_0x4ad6ac['length']>0x0){_0xd58e6c=_[_0x32bd('0x48')](_0x4ad6ac,_0x32bd('0x36'));}if(_0xd58e6c['length']>0x0){return manageTags(_0x32b485,_0xd58e6c,_0x268d17,_0x47e27e,_0x190a93,_0x1c7534,_0x2f1fb2)['then'](function(){_0x34da5e(_0x190a93);});}else{_0x34da5e(_0x190a93);}});};}function emit(_0x504466,_0x388434,_0xfc21ed){var _0x18aefa='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x32bd('0x49')+_0x32bd('0x4a');var _0x32ccfb={'uri':_0x504466+_0x32bd('0x4b')+_0xfc21ed+_0x18aefa};io['to'](util[_0x32bd('0x4c')](_0x32bd('0x4d'),_0x388434))[_0x32bd('0x4e')]('trigger:browser:url',_0x32ccfb);}exports['cs']=function(_0x5bbd42,_0x585b5e,_0x549433,_0x3936d5,_0x187701,_0x4666bc,_0x98a780,_0x73d762){var _0x4bd26e={};var _0x100bec={'user':_0x4666bc['username'],'pass':_0x4666bc['password']};var _0x34ab8a=_0x32bd('0x4f');var _0x4e90a4=_0x32bd('0x50');_0x4666bc[_0x32bd('0x51')]=intUtil[_0x32bd('0x52')](_0x4666bc[_0x32bd('0x51')]);_0x4666bc['serverUrl']=intUtil['stripTrailingSlash'](_0x4666bc['serverUrl']);var _0x1c220c=util[_0x32bd('0x4c')](_0x32bd('0x53'),_0x4666bc['remoteUri']);_0x4bd26e[_0x32bd('0x18')]=!_[_0x32bd('0x54')](_0x3936d5)?_0x3936d5['email']:null;_0x4bd26e[_0x32bd('0x1d')]=_0x4666bc[_0x32bd('0x55')];_0x4bd26e['endUserNumber']=_0x73d762[_0x32bd('0x2f')]()===_0x32bd('0x56')?_0x585b5e[_0x32bd('0x57')]:_0x585b5e['calleridnum'];_0x4bd26e[_0x32bd('0x58')]=_0x73d762==='queue'||_0x73d762===_0x32bd('0x59')?_0x32bd('0x5a'):_0x32bd('0x56');var _0x5a6d6e=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4666bc[_0x32bd('0x5b')],_0x585b5e[_0x32bd('0x5c')],md5(_0x585b5e[_0x32bd('0x5c')]));if(_0x187701&&_0x187701[_0x32bd('0x5d')]){logger[_0x32bd('0x11')](_0x32bd('0x5e'),_0x32bd('0x5f'));_0x585b5e[_0x32bd('0x60')]=_0x5a6d6e;}else if(_0x98a780&&_0x98a780[_0x32bd('0x61')]&&_0x98a780['recordingFormat']!=='none'){logger[_0x32bd('0x11')]('[OUTBOUND]',_0x32bd('0x5f'));_0x585b5e[_0x32bd('0x60')]=_0x5a6d6e;}else{_0x585b5e[_0x32bd('0x60')]='';}return getAdminUser(_0x73d762,_0x100bec,_0x4bd26e,_0x1c220c,_0x4e90a4,_0x34ab8a)[_0x32bd('0xd')](getUser(_0x73d762,_0x100bec,_0x1c220c,_0x4e90a4,_0x34ab8a))[_0x32bd('0xd')](getEndUser(_0x73d762,_0x100bec,_0x1c220c,_0x4e90a4,_0x34ab8a))[_0x32bd('0xd')](getTicket(_0x73d762,_0x100bec,_0x1c220c,_0x549433,_0x585b5e,_0x4e90a4))[_0x32bd('0xd')](function(_0x956560){logger[_0x32bd('0x11')](util[_0x32bd('0x4c')](_0x32bd('0x62'),_0x956560[_0x32bd('0x3c')]));logger[_0x32bd('0x11')](util[_0x32bd('0x4c')](_0x32bd('0x63'),_0x73d762));if(_0x73d762!==_0x32bd('0x59')){logger[_0x32bd('0x11')]('['+[_0x73d762[_0x32bd('0x12')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4666bc[_0x32bd('0x51')],_0x3936d5[_0x32bd('0x36')],_0x956560[_0x32bd('0x3c')]);}})[_0x32bd('0x14')](function(_0x3aaae5){logger[_0x32bd('0x15')]('['+[_0x73d762[_0x32bd('0x12')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x32bd('0x64')](_0x3aaae5,{'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 a0c5a8a..9c42415 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 _0x2d37=['getString','Subjects','created_by','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','set_entry','JSON','format','Basic\x20%s','toString','base64','get_server_info','stringify','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','idField','variableName','Variable','POST','login','username','password','set_relationship','Calls','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','lodash','md5','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name'];(function(_0x4cf8bb,_0x12c8fe){var _0x555be3=function(_0x31c2e8){while(--_0x31c2e8){_0x4cf8bb['push'](_0x4cf8bb['shift']());}};_0x555be3(++_0x12c8fe);}(_0x2d37,0xe0));var _0x72d3=function(_0x39b552,_0x2949ea){_0x39b552=_0x39b552-0x0;var _0x35d4d1=_0x2d37[_0x39b552];return _0x35d4d1;};'use strict';var _=require(_0x72d3('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x72d3('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x72d3('0x2'));var config=require(_0x72d3('0x3'));var logger=require(_0x72d3('0x4'))('sugarcrm');config[_0x72d3('0x5')]=_['defaults'](config[_0x72d3('0x5')],{'host':_0x72d3('0x6'),'port':0x18eb});var io=require(_0x72d3('0x7'))(new Redis(config[_0x72d3('0x5')]));var def={'method':'POST','json':!![]};function emit(_0x17e907,_0x72dba8,_0x3f3503){io['to'](_0x17e907)[_0x72d3('0x8')](_0x72dba8,_0x3f3503);}function getTicket(_0x5da36a,_0x5b511a,_0x3f9a85,_0xf7710c,_0x333b2e,_0x36fd57,_0x3f8701,_0x1f5d65){logger[_0x72d3('0x9')](_0x72d3('0xa'));var _0x36bc1=new Date();var _0x1e770b=[{'name':_0x72d3('0xb'),'value':intUtil[_0x72d3('0xc')](_0xf7710c[_0x72d3('0xd')],_0x333b2e,'\x20')},{'name':'assigned_user_id','value':_0x5b511a['id']},{'name':_0x72d3('0xe'),'value':_0x5b511a['id']},{'name':'description','value':intUtil[_0x72d3('0xc')](_0xf7710c[_0x72d3('0xf')],_0x333b2e,'\x0a')},{'name':_0x72d3('0x10'),'value':_0x36bc1['toISOString']()[_0x72d3('0x11')](0x0,0x13)[_0x72d3('0x12')]('T','\x20')},{'name':_0x72d3('0x13'),'value':'0'},{'name':_0x72d3('0x14'),'value':'15'},{'name':_0x72d3('0x15'),'value':_0x3f9a85['id']},{'name':_0x72d3('0x16'),'value':_0x72d3('0x17')},{'name':_0x72d3('0x18'),'value':_0x3f9a85[_0x72d3('0xb')]},{'name':_0x72d3('0x19'),'value':_0x1f5d65}];if(_0x36fd57[_0x72d3('0x1a')]){_[_0x72d3('0x1b')](_0x36fd57,function(_0x28af10){if(_0x333b2e[_0x28af10['variableName']]){_0x1e770b[_0x72d3('0x1c')]({'name':_0x28af10['idField'],'value':_0x333b2e[_0x28af10['variableName']]});}});}return request({'form':{'method':_0x72d3('0x1d'),'input_type':'JSON','response_type':_0x72d3('0x1e'),'rest_data':JSON['stringify']({'session':_0x3f8701['id'],'module_name':'Calls','name_value_list':_0x1e770b})}});}function getAuth(_0x40e399){return util[_0x72d3('0x1f')](_0x72d3('0x20'),new Buffer(_0x40e399['apiKey']+':X')[_0x72d3('0x21')](_0x72d3('0x22')));}function getServerInfo(_0x45fd45){return request({'form':{'method':_0x72d3('0x23'),'input_type':'JSON','response_type':_0x72d3('0x1e'),'rest_data':JSON[_0x72d3('0x24')]({'session':_0x45fd45['id']})}});}function getUser(_0x4e9406,_0x391998,_0x30295e){if(!_['isNil'](_0x391998)){logger['info'](_0x72d3('0x25'),_0x391998);return request({'form':{'method':_0x72d3('0x26'),'input_type':_0x72d3('0x1e'),'response_type':_0x72d3('0x1e'),'rest_data':JSON['stringify']({'session':_0x30295e['id'],'module_name':_0x72d3('0x27'),'query':util['format'](_0x72d3('0x28'),_0x391998),'order_by':'','offset':'0','select_fields':['id','name',_0x72d3('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x72d3('0x2a')](function(_0xaafe53){if(_0xaafe53[_0x72d3('0x2b')][_0x72d3('0x1a')]){var _0x33fc64=_[_0x72d3('0x2c')](_0xaafe53[_0x72d3('0x2b')],function(_0x3be408){return _0x3be408[_0x72d3('0x2d')][_0x72d3('0x29')]['value']===_0x391998;});if(_0x33fc64){logger[_0x72d3('0x9')](_0x72d3('0x2e'));return BPromise[_0x72d3('0x2f')]({'id':_0x33fc64[_0x72d3('0x2d')]['id'][_0x72d3('0x30')],'name':_0x33fc64[_0x72d3('0x2d')][_0x72d3('0xb')][_0x72d3('0x30')]});}}logger[_0x72d3('0x9')](_0x72d3('0x31'));return BPromise[_0x72d3('0x2f')]({'id':_0x30295e[_0x72d3('0x2d')]['user_id']['value'],'name':_0x30295e['name_value_list'][_0x72d3('0x29')]['value']});});}else{logger[_0x72d3('0x9')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x30295e[_0x72d3('0x2d')][_0x72d3('0x32')][_0x72d3('0x30')],'name':_0x30295e[_0x72d3('0x2d')][_0x72d3('0x29')][_0x72d3('0x30')]});}}function getEndUser(_0x48d306,_0x935a7d,_0x6ba79d,_0x1beddc){logger[_0x72d3('0x9')](_0x72d3('0x33'),_0x6ba79d);return request({'form':{'method':_0x72d3('0x26'),'input_type':'JSON','response_type':_0x72d3('0x1e'),'rest_data':JSON['stringify']({'session':_0x1beddc['id'],'module_name':'Contacts','query':util['format'](_0x72d3('0x34'),_0x6ba79d),'order_by':'','offset':'0','select_fields':['id','name',_0x72d3('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x865ce){if(_0x865ce[_0x72d3('0x2b')][_0x72d3('0x1a')]){var _0x575e4c=_[_0x72d3('0x2c')](_0x865ce[_0x72d3('0x2b')],function(_0xd67a08){return _0xd67a08[_0x72d3('0x2d')][_0x72d3('0x35')][_0x72d3('0x30')]===_0x6ba79d;});if(_0x575e4c){logger[_0x72d3('0x9')](_0x72d3('0x36'));return BPromise[_0x72d3('0x2f')]({'id':_0x575e4c['name_value_list']['id'][_0x72d3('0x30')],'name':_0x575e4c[_0x72d3('0x2d')][_0x72d3('0xb')]['value'],'phone':_0x575e4c[_0x72d3('0x2d')][_0x72d3('0x35')][_0x72d3('0x30')]});}}else{logger[_0x72d3('0x9')](_0x72d3('0x37'));return request({'form':{'method':_0x72d3('0x1d'),'input_type':_0x72d3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x72d3('0x24')]({'session':_0x1beddc['id'],'module_name':_0x72d3('0x17'),'name_value_list':[{'name':_0x72d3('0x38'),'value':_0x935a7d!==_0x72d3('0x39')?_0x935a7d:util['format'](_0x72d3('0x3a'),_0x6ba79d)},{'name':_0x72d3('0x35'),'value':_0x6ba79d}]})}})[_0x72d3('0x2a')](function(_0xe2cc52){logger[_0x72d3('0x9')](_0x72d3('0x3b'));return BPromise[_0x72d3('0x2f')]({'id':_0xe2cc52['id'],'name':_0xe2cc52[_0x72d3('0x2b')]['first_name'][_0x72d3('0x30')],'phone':_0xe2cc52['entry_list'][_0x72d3('0x35')][_0x72d3('0x30')]});});}});}function request(_0x47905f){logger[_0x72d3('0x3c')](_0x72d3('0x3d'),JSON[_0x72d3('0x24')](_0x47905f));return rp(_[_0x72d3('0x3e')](def,_0x47905f));}function getTags(_0x10874c,_0x14be40){var _0x4f766e=[];if(_0x10874c&&_0x10874c['length']>0x0){_0x4f766e=_[_0x72d3('0x3f')](_0x10874c,_0x14be40);}return _0x4f766e;}function getCustomFields(_0xf1b214,_0x27be34){var _0x5bde4a=[];var _0x4442b9={'custom_fields':[]};if(_0xf1b214[_0x72d3('0x1a')]>0x0){_[_0x72d3('0x1b')](_0xf1b214,function(_0x41d5aa){if(_0x41d5aa[_0x72d3('0x40')]===_0x72d3('0x41')&&_0x41d5aa[_0x72d3('0x42')]&&!_0x41d5aa[_0x72d3('0x43')]){_0x4442b9[_0x41d5aa[_0x72d3('0x42')][_0x72d3('0x44')]()]=_0x41d5aa[_0x72d3('0x45')][_0x72d3('0x21')]();}else if(_0x41d5aa['type']==='string'&&_0x41d5aa[_0x72d3('0x46')]&&_0x41d5aa[_0x72d3('0x43')]){_0x4442b9['custom_fields']['push']({'id':_0x41d5aa['idField'],'value':_0x41d5aa[_0x72d3('0x45')][_0x72d3('0x21')]()});}else if(_0x41d5aa['type']==='variable'&&_0x41d5aa['variableName']&&_0x41d5aa[_0x72d3('0x46')]&&_0x41d5aa['customField']){_0x27be34[_0x41d5aa[_0x72d3('0x47')]]&&_0x4442b9['custom_fields']['push']({'id':_0x41d5aa[_0x72d3('0x46')],'value':_0x27be34[_0x41d5aa['variableName']][_0x72d3('0x21')]()});}else if(_0x41d5aa[_0x72d3('0x40')]==='customVariable'&&_0x41d5aa['Variable']&&_0x41d5aa[_0x72d3('0x48')][_0x72d3('0xb')]&&_0x41d5aa[_0x72d3('0x46')]&&_0x41d5aa[_0x72d3('0x43')]){_0x27be34[_0x41d5aa[_0x72d3('0x48')][_0x72d3('0xb')][_0x72d3('0x44')]()]&&_0x4442b9['custom_fields'][_0x72d3('0x1c')]({'id':_0x41d5aa[_0x72d3('0x46')],'value':_0x27be34[_0x41d5aa[_0x72d3('0x48')]['name'][_0x72d3('0x44')]()][_0x72d3('0x21')]()});}});}return _0x4442b9;}function getConnection(_0x168f3a){return request({'method':_0x72d3('0x49'),'form':{'method':_0x72d3('0x4a'),'input_type':_0x72d3('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x168f3a[_0x72d3('0x4b')],'password':_0x168f3a[_0x72d3('0x4c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x72d3('0x2a')](function(_0x32810a){var _0x523fc4=_0x32810a;if(_0x523fc4['id']){def['sessionID']=_0x523fc4['id'];return BPromise[_0x72d3('0x2f')](_0x523fc4);}else{throw new Error(util[_0x72d3('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x168f3a['id']));}});}function setRelationship(_0x5cae47,_0x40de4e,_0x2061f1,_0x973243){return request({'form':{'method':_0x72d3('0x4d'),'input_type':_0x72d3('0x1e'),'response_type':_0x72d3('0x1e'),'rest_data':JSON[_0x72d3('0x24')]({'session':_0x5cae47['id'],'module_name':_0x72d3('0x4e'),'module_id':_0x2061f1['id'],'link_field_name':_0x973243,'related_ids':[_0x40de4e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x72d3('0x4f')]=function(_0x3b6a19,_0x119c74,_0x112633,_0x38ca23,_0x206b66,_0x1950a5){var _0x54f3b5,_0x5e2f23,_0x48cf67,_0x448c24;_0x1950a5['remoteUri']=intUtil[_0x72d3('0x50')](_0x1950a5[_0x72d3('0x51')]);_0x1950a5[_0x72d3('0x52')]=intUtil[_0x72d3('0x50')](_0x1950a5[_0x72d3('0x52')]);def[_0x72d3('0x53')]=util['format'](_0x72d3('0x54'),_0x1950a5[_0x72d3('0x51')]);if(_0x206b66&&_0x206b66[_0x72d3('0x55')]){logger['info'](_0x72d3('0x56'),_0x72d3('0x57'));_0x119c74[_0x72d3('0x58')]=util[_0x72d3('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1950a5[_0x72d3('0x52')],_0x119c74[_0x72d3('0x59')],md5(_0x119c74[_0x72d3('0x59')]));}else{_0x119c74[_0x72d3('0x58')]='';}return getConnection(_0x1950a5)[_0x72d3('0x2a')](function(_0x60cd04){_0x448c24=_0x60cd04;return getUser(_0x1950a5,_0x38ca23[_0x72d3('0xb')],_0x448c24);})[_0x72d3('0x2a')](function(_0x29da50){_0x54f3b5=_0x29da50;logger['info'](_0x72d3('0x5a'),_0x54f3b5['id']);return getEndUser(_0x1950a5,_0x119c74[_0x72d3('0x5b')],_0x119c74[_0x72d3('0x5c')],_0x448c24);})[_0x72d3('0x2a')](function(_0x4c9657){_0x5e2f23=_0x4c9657;logger[_0x72d3('0x9')](_0x72d3('0x5d'),_0x5e2f23['id']);return getTicket(_0x1950a5,_0x54f3b5,_0x5e2f23,_0x112633,_0x119c74,_0x112633[_0x72d3('0x5e')],_0x448c24,_0x72d3('0x5f'));})[_0x72d3('0x2a')](function(_0xd25de5){_0x48cf67=_0xd25de5;logger[_0x72d3('0x9')](_0x72d3('0x60'));logger[_0x72d3('0x9')](_0x72d3('0x61'),_0x48cf67['id']);return setRelationship(_0x448c24,_0x54f3b5,_0x48cf67,_0x72d3('0x62'));})['then'](function(){return setRelationship(_0x448c24,_0x5e2f23,_0x48cf67,_0x72d3('0x63'));})[_0x72d3('0x2a')](function(){return getServerInfo(_0x448c24);})['then'](function(_0x577415){var _0x30d2b9=parseInt(_0x577415[_0x72d3('0x64')][_0x72d3('0x65')](0x0));var _0x4dba58=util[_0x72d3('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1950a5[_0x72d3('0x51')],_0x48cf67['id']);if(_0x30d2b9>0x6){_0x4dba58=util[_0x72d3('0x1f')](_0x72d3('0x66'),_0x1950a5[_0x72d3('0x51')],_0x48cf67['id']);}logger[_0x72d3('0x9')](_0x72d3('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x72d3('0x67'),_0x38ca23[_0x72d3('0xb')]),_0x72d3('0x68'),{'uri':_0x4dba58});})[_0x72d3('0x69')](function(_0x5041e6){logger[_0x72d3('0x6a')](_0x72d3('0x56'),JSON['stringify'](_0x5041e6));});};exports[_0x72d3('0x6b')]=function(_0x5ebd5e,_0x2a0fc0,_0xd9e252,_0x12cca8,_0x5243b2,_0x201980,_0x2cc9d0){var _0x56b27a,_0x40279d,_0x3c3d25,_0x1bda1c;_0x201980[_0x72d3('0x51')]=intUtil[_0x72d3('0x50')](_0x201980[_0x72d3('0x51')]);_0x201980[_0x72d3('0x52')]=intUtil[_0x72d3('0x50')](_0x201980['serverUrl']);def[_0x72d3('0x53')]=util[_0x72d3('0x1f')]('%s/service/v4_1/rest.php',_0x201980[_0x72d3('0x51')]);if(_0x2cc9d0&&_0x2cc9d0[_0x72d3('0x6c')]&&_0x2cc9d0['recordingFormat']!==_0x72d3('0x6d')){logger[_0x72d3('0x9')]('[OUTBOUND]',_0x72d3('0x57'));_0x2a0fc0[_0x72d3('0x58')]=util[_0x72d3('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x201980[_0x72d3('0x52')],_0x2a0fc0[_0x72d3('0x59')],md5(_0x2a0fc0[_0x72d3('0x59')]));}return getConnection(_0x201980)['then'](function(_0x119d61){_0x1bda1c=_0x119d61;return getUser(_0x201980,_0x12cca8[_0x72d3('0xb')],_0x1bda1c);})[_0x72d3('0x2a')](function(_0x359cfc){_0x56b27a=_0x359cfc;logger[_0x72d3('0x9')]('The\x20User\x20ID\x20is:',_0x56b27a['id']);return getEndUser(_0x201980,_0x2a0fc0['destcalleridname'],_0x2a0fc0[_0x72d3('0x6e')],_0x1bda1c);})[_0x72d3('0x2a')](function(_0x340875){_0x40279d=_0x340875;logger[_0x72d3('0x9')](_0x72d3('0x5d'),_0x40279d['id']);return getTicket(_0x201980,_0x56b27a,_0x40279d,_0xd9e252,_0x2a0fc0,_0xd9e252['Fields'],_0x1bda1c,_0x72d3('0x6f'));})[_0x72d3('0x2a')](function(_0x2f59b8){_0x3c3d25=_0x2f59b8;logger[_0x72d3('0x9')](_0x72d3('0x60'));logger[_0x72d3('0x9')](_0x72d3('0x61'),_0x3c3d25['id']);return setRelationship(_0x1bda1c,_0x56b27a,_0x3c3d25,_0x72d3('0x62'));})[_0x72d3('0x2a')](function(){return setRelationship(_0x1bda1c,_0x40279d,_0x3c3d25,_0x72d3('0x63'));})[_0x72d3('0x2a')](function(){return getServerInfo(_0x1bda1c);})[_0x72d3('0x2a')](function(_0x4d9056){var _0xa94e0b=parseInt(_0x4d9056[_0x72d3('0x64')][_0x72d3('0x65')](0x0));var _0x1ab9d4=util[_0x72d3('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x201980['remoteUri'],_0x3c3d25['id']);if(_0xa94e0b>0x6){_0x1ab9d4=util[_0x72d3('0x1f')](_0x72d3('0x66'),_0x201980[_0x72d3('0x51')],_0x3c3d25['id']);}logger[_0x72d3('0x9')](_0x72d3('0x70'),_0x72d3('0x71'));emit(util[_0x72d3('0x1f')](_0x72d3('0x67'),_0x12cca8[_0x72d3('0xb')]),_0x72d3('0x68'),{'uri':_0x1ab9d4});})['catch'](function(_0x46798a){logger['error'](_0x72d3('0x70'),JSON[_0x72d3('0x24')](_0x46798a));});};exports['unmanaged']=function(_0x2594fe,_0x39c665,_0x532f2a,_0x3427b2,_0x5a8f0d,_0x474d21){var _0x4e3c6c,_0xa80d57,_0x444559,_0x25ebcb;_0x474d21[_0x72d3('0x51')]=intUtil[_0x72d3('0x50')](_0x474d21[_0x72d3('0x51')]);_0x474d21['serverUrl']=intUtil['stripTrailingSlash'](_0x474d21['serverUrl']);def[_0x72d3('0x53')]=util[_0x72d3('0x1f')](_0x72d3('0x54'),_0x474d21[_0x72d3('0x51')]);if(_0x5a8f0d&&_0x5a8f0d[_0x72d3('0x55')]){logger[_0x72d3('0x9')]('['+_0x39c665[_0x72d3('0x72')][_0x72d3('0x73')]()+']',_0x72d3('0x57'));_0x39c665[_0x72d3('0x58')]=util[_0x72d3('0x1f')](_0x72d3('0x74'),_0x474d21['serverUrl'],_0x39c665[_0x72d3('0x59')],md5(_0x39c665['uniqueid']));}else{_0x39c665[_0x72d3('0x58')]='';}return getConnection(_0x474d21)[_0x72d3('0x2a')](function(_0x543730){_0x25ebcb=_0x543730;if(!_[_0x72d3('0x75')](_0x3427b2)){return getUser(_0x474d21,_0x3427b2[_0x72d3('0xb')],_0x25ebcb);}else{return getUser(_0x474d21,null,_0x25ebcb);}})['then'](function(_0x417ca0){_0x4e3c6c=_0x417ca0;logger[_0x72d3('0x9')]('The\x20User\x20ID\x20is:',_0x4e3c6c['id']);return getEndUser(_0x474d21,_0x39c665['calleridname'],_0x39c665[_0x72d3('0x5c')],_0x25ebcb);})[_0x72d3('0x2a')](function(_0x18aa03){_0xa80d57=_0x18aa03;logger[_0x72d3('0x9')](_0x72d3('0x5d'),_0xa80d57['id']);return getTicket(_0x474d21,_0x4e3c6c,_0xa80d57,_0x532f2a,_0x39c665,_0x532f2a['Fields'],_0x25ebcb,'Inbound');})[_0x72d3('0x2a')](function(_0x1ca762){_0x444559=_0x1ca762;logger[_0x72d3('0x9')](_0x72d3('0x60'));logger[_0x72d3('0x9')]('The\x20Ticket\x20ID\x20is:',_0x444559['id']);return setRelationship(_0x25ebcb,_0x4e3c6c,_0x444559,'users');})[_0x72d3('0x2a')](function(){return setRelationship(_0x25ebcb,_0xa80d57,_0x444559,_0x72d3('0x63'));})[_0x72d3('0x2a')](function(){return getServerInfo(_0x25ebcb);})[_0x72d3('0x69')](function(_0x15d097){logger[_0x72d3('0x6a')]('['+_0x39c665[_0x72d3('0x72')][_0x72d3('0x73')]()+']',JSON[_0x72d3('0x24')](_0x15d097));});}; \ No newline at end of file +var _0xf219=['%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','unmanaged','uri','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','Subjects','getString','toISOString','replace','duration_hours','duration_minutes','Contacts','name','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','push','content','variable','customField','custom_fields','Variable','toLowerCase','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','charAt'];(function(_0x9f9ed5,_0x56f438){var _0xbc71e3=function(_0x1de828){while(--_0x1de828){_0x9f9ed5['push'](_0x9f9ed5['shift']());}};_0xbc71e3(++_0x56f438);}(_0xf219,0x171));var _0x9f21=function(_0x36bbbb,_0x3f6709){_0x36bbbb=_0x36bbbb-0x0;var _0x3ca0eb=_0xf219[_0x36bbbb];return _0x3ca0eb;};'use strict';var _=require(_0x9f21('0x0'));var rp=require(_0x9f21('0x1'));var BPromise=require(_0x9f21('0x2'));var md5=require(_0x9f21('0x3'));var util=require(_0x9f21('0x4'));var Redis=require(_0x9f21('0x5'));var intUtil=require('./util');var config=require(_0x9f21('0x6'));var logger=require(_0x9f21('0x7'))(_0x9f21('0x8'));config['redis']=_[_0x9f21('0x9')](config[_0x9f21('0xa')],{'host':_0x9f21('0xb'),'port':0x18eb});var io=require(_0x9f21('0xc'))(new Redis(config[_0x9f21('0xa')]));var def={'method':'POST','json':!![]};function emit(_0x4f7610,_0x1b8262,_0xa9683){io['to'](_0x4f7610)[_0x9f21('0xd')](_0x1b8262,_0xa9683);}function getTicket(_0xf50977,_0x394e49,_0xe637a1,_0x113b0f,_0xd9e129,_0xb54d04,_0x227687,_0x1a28cc){logger[_0x9f21('0xe')](_0x9f21('0xf'));var _0x4b22b2=new Date();var _0x3313e2=[{'name':'name','value':intUtil['getString'](_0x113b0f[_0x9f21('0x10')],_0xd9e129,'\x20')},{'name':'assigned_user_id','value':_0x394e49['id']},{'name':'created_by','value':_0x394e49['id']},{'name':'description','value':intUtil[_0x9f21('0x11')](_0x113b0f['Descriptions'],_0xd9e129,'\x0a')},{'name':'date_start','value':_0x4b22b2[_0x9f21('0x12')]()['slice'](0x0,0x13)[_0x9f21('0x13')]('T','\x20')},{'name':_0x9f21('0x14'),'value':'0'},{'name':_0x9f21('0x15'),'value':'15'},{'name':'parent_id','value':_0xe637a1['id']},{'name':'parent_type','value':_0x9f21('0x16')},{'name':'parent_name','value':_0xe637a1[_0x9f21('0x17')]},{'name':'direction','value':_0x1a28cc}];if(_0xb54d04[_0x9f21('0x18')]){_[_0x9f21('0x19')](_0xb54d04,function(_0x164faf){if(_0xd9e129[_0x164faf[_0x9f21('0x1a')]]){_0x3313e2['push']({'name':_0x164faf[_0x9f21('0x1b')],'value':_0xd9e129[_0x164faf['variableName']]});}});}return request({'form':{'method':_0x9f21('0x1c'),'input_type':'JSON','response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'session':_0x227687['id'],'module_name':_0x9f21('0x1f'),'name_value_list':_0x3313e2})}});}function getAuth(_0x4c1a96){return util[_0x9f21('0x20')]('Basic\x20%s',new Buffer(_0x4c1a96[_0x9f21('0x21')]+':X')[_0x9f21('0x22')](_0x9f21('0x23')));}function getServerInfo(_0x506b0e){return request({'form':{'method':_0x9f21('0x24'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9f21('0x1e')]({'session':_0x506b0e['id']})}});}function getUser(_0x4c8f42,_0x53e0b5,_0x55344e){if(!_['isNil'](_0x53e0b5)){logger[_0x9f21('0xe')](_0x9f21('0x25'),_0x53e0b5);return request({'form':{'method':_0x9f21('0x26'),'input_type':'JSON','response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'session':_0x55344e['id'],'module_name':_0x9f21('0x27'),'query':util[_0x9f21('0x20')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x53e0b5),'order_by':'','offset':'0','select_fields':['id',_0x9f21('0x17'),_0x9f21('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9f21('0x29')](function(_0xb023ad){if(_0xb023ad[_0x9f21('0x2a')][_0x9f21('0x18')]){var _0x496db9=_['find'](_0xb023ad[_0x9f21('0x2a')],function(_0x47fe4d){return _0x47fe4d[_0x9f21('0x2b')][_0x9f21('0x28')][_0x9f21('0x2c')]===_0x53e0b5;});if(_0x496db9){logger['info'](_0x9f21('0x2d'));return BPromise[_0x9f21('0x2e')]({'id':_0x496db9[_0x9f21('0x2b')]['id'][_0x9f21('0x2c')],'name':_0x496db9[_0x9f21('0x2b')][_0x9f21('0x17')][_0x9f21('0x2c')]});}}logger[_0x9f21('0xe')](_0x9f21('0x2f'));return BPromise[_0x9f21('0x2e')]({'id':_0x55344e[_0x9f21('0x2b')][_0x9f21('0x30')][_0x9f21('0x2c')],'name':_0x55344e['name_value_list'][_0x9f21('0x28')]['value']});});}else{logger[_0x9f21('0xe')](_0x9f21('0x31'));return BPromise[_0x9f21('0x2e')]({'id':_0x55344e[_0x9f21('0x2b')]['user_id']['value'],'name':_0x55344e['name_value_list'][_0x9f21('0x28')][_0x9f21('0x2c')]});}}function getEndUser(_0x37765f,_0x5f127d,_0x2430e8,_0x1f78f5){logger[_0x9f21('0xe')](_0x9f21('0x32'),_0x2430e8);return request({'form':{'method':_0x9f21('0x26'),'input_type':_0x9f21('0x1d'),'response_type':_0x9f21('0x1d'),'rest_data':JSON['stringify']({'session':_0x1f78f5['id'],'module_name':_0x9f21('0x16'),'query':util[_0x9f21('0x20')](_0x9f21('0x33'),_0x2430e8),'order_by':'','offset':'0','select_fields':['id',_0x9f21('0x17'),_0x9f21('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9f21('0x29')](function(_0x1dd06c){if(_0x1dd06c[_0x9f21('0x2a')]['length']){var _0x4c1d07=_[_0x9f21('0x35')](_0x1dd06c[_0x9f21('0x2a')],function(_0x1e813a){return _0x1e813a[_0x9f21('0x2b')]['phone_home'][_0x9f21('0x2c')]===_0x2430e8;});if(_0x4c1d07){logger[_0x9f21('0xe')](_0x9f21('0x36'));return BPromise[_0x9f21('0x2e')]({'id':_0x4c1d07[_0x9f21('0x2b')]['id'][_0x9f21('0x2c')],'name':_0x4c1d07[_0x9f21('0x2b')][_0x9f21('0x17')][_0x9f21('0x2c')],'phone':_0x4c1d07[_0x9f21('0x2b')][_0x9f21('0x34')][_0x9f21('0x2c')]});}}else{logger[_0x9f21('0xe')](_0x9f21('0x37'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9f21('0x1e')]({'session':_0x1f78f5['id'],'module_name':'Contacts','name_value_list':[{'name':_0x9f21('0x38'),'value':_0x5f127d!==_0x9f21('0x39')?_0x5f127d:util['format'](_0x9f21('0x3a'),_0x2430e8)},{'name':_0x9f21('0x34'),'value':_0x2430e8}]})}})[_0x9f21('0x29')](function(_0x354c97){logger[_0x9f21('0xe')](_0x9f21('0x3b'));return BPromise[_0x9f21('0x2e')]({'id':_0x354c97['id'],'name':_0x354c97[_0x9f21('0x2a')][_0x9f21('0x38')]['value'],'phone':_0x354c97['entry_list'][_0x9f21('0x34')][_0x9f21('0x2c')]});});}});}function request(_0x4e2fb1){logger[_0x9f21('0x3c')](_0x9f21('0x3d'),JSON[_0x9f21('0x1e')](_0x4e2fb1));return rp(_[_0x9f21('0x3e')](def,_0x4e2fb1));}function getTags(_0x4f36f3,_0x5b4198){var _0x4b12b2=[];if(_0x4f36f3&&_0x4f36f3[_0x9f21('0x18')]>0x0){_0x4b12b2=_[_0x9f21('0x3f')](_0x4f36f3,_0x5b4198);}return _0x4b12b2;}function getCustomFields(_0x236f1a,_0x29fdf3){var _0x25805d=[];var _0x4eddfc={'custom_fields':[]};if(_0x236f1a[_0x9f21('0x18')]>0x0){_['forEach'](_0x236f1a,function(_0x38ac68){if(_0x38ac68[_0x9f21('0x40')]===_0x9f21('0x41')&&_0x38ac68[_0x9f21('0x42')]&&!_0x38ac68['customField']){_0x4eddfc[_0x38ac68[_0x9f21('0x42')]['toLowerCase']()]=_0x38ac68['content'][_0x9f21('0x22')]();}else if(_0x38ac68[_0x9f21('0x40')]===_0x9f21('0x41')&&_0x38ac68['idField']&&_0x38ac68['customField']){_0x4eddfc['custom_fields'][_0x9f21('0x43')]({'id':_0x38ac68[_0x9f21('0x1b')],'value':_0x38ac68[_0x9f21('0x44')][_0x9f21('0x22')]()});}else if(_0x38ac68[_0x9f21('0x40')]===_0x9f21('0x45')&&_0x38ac68[_0x9f21('0x1a')]&&_0x38ac68['idField']&&_0x38ac68[_0x9f21('0x46')]){_0x29fdf3[_0x38ac68[_0x9f21('0x1a')]]&&_0x4eddfc[_0x9f21('0x47')][_0x9f21('0x43')]({'id':_0x38ac68[_0x9f21('0x1b')],'value':_0x29fdf3[_0x38ac68['variableName']][_0x9f21('0x22')]()});}else if(_0x38ac68[_0x9f21('0x40')]==='customVariable'&&_0x38ac68[_0x9f21('0x48')]&&_0x38ac68[_0x9f21('0x48')][_0x9f21('0x17')]&&_0x38ac68[_0x9f21('0x1b')]&&_0x38ac68['customField']){_0x29fdf3[_0x38ac68[_0x9f21('0x48')][_0x9f21('0x17')][_0x9f21('0x49')]()]&&_0x4eddfc['custom_fields'][_0x9f21('0x43')]({'id':_0x38ac68[_0x9f21('0x1b')],'value':_0x29fdf3[_0x38ac68[_0x9f21('0x48')][_0x9f21('0x17')][_0x9f21('0x49')]()]['toString']()});}});}return _0x4eddfc;}function getConnection(_0x205b62){return request({'method':_0x9f21('0x4a'),'form':{'method':_0x9f21('0x4b'),'input_type':_0x9f21('0x1d'),'response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'user_auth':{'user_name':_0x205b62[_0x9f21('0x4c')],'password':_0x205b62[_0x9f21('0x4d')],'encryption':_0x9f21('0x4e')},'application':_0x9f21('0x4f')})}})[_0x9f21('0x29')](function(_0x4ec90e){var _0x2c82a9=_0x4ec90e;if(_0x2c82a9['id']){def[_0x9f21('0x50')]=_0x2c82a9['id'];return BPromise[_0x9f21('0x2e')](_0x2c82a9);}else{throw new Error(util[_0x9f21('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x205b62['id']));}});}function setRelationship(_0x260aef,_0x15ce1a,_0x19f7ba,_0x23ed68){return request({'form':{'method':_0x9f21('0x51'),'input_type':'JSON','response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'session':_0x260aef['id'],'module_name':_0x9f21('0x1f'),'module_id':_0x19f7ba['id'],'link_field_name':_0x23ed68,'related_ids':[_0x15ce1a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9f21('0x52')]=function(_0x411800,_0x19165e,_0x37d088,_0x49feac,_0x14c6ec,_0x222c88){var _0xba34cd,_0x35ba71,_0xd84602,_0x34b483;_0x222c88[_0x9f21('0x53')]=intUtil[_0x9f21('0x54')](_0x222c88[_0x9f21('0x53')]);_0x222c88[_0x9f21('0x55')]=intUtil[_0x9f21('0x54')](_0x222c88['serverUrl']);def['uri']=util[_0x9f21('0x20')](_0x9f21('0x56'),_0x222c88['remoteUri']);if(_0x14c6ec&&_0x14c6ec[_0x9f21('0x57')]){logger[_0x9f21('0xe')](_0x9f21('0x58'),'Recording\x20is\x20enabled!');_0x19165e[_0x9f21('0x59')]=util['format'](_0x9f21('0x5a'),_0x222c88[_0x9f21('0x55')],_0x19165e[_0x9f21('0x5b')],md5(_0x19165e[_0x9f21('0x5b')]));}else{_0x19165e[_0x9f21('0x59')]='';}return getConnection(_0x222c88)['then'](function(_0x15ea57){_0x34b483=_0x15ea57;return getUser(_0x222c88,_0x49feac[_0x9f21('0x17')],_0x34b483);})[_0x9f21('0x29')](function(_0x4edc0b){_0xba34cd=_0x4edc0b;logger[_0x9f21('0xe')]('The\x20User\x20ID\x20is:',_0xba34cd['id']);return getEndUser(_0x222c88,_0x19165e[_0x9f21('0x5c')],_0x19165e[_0x9f21('0x5d')],_0x34b483);})[_0x9f21('0x29')](function(_0x4e383d){_0x35ba71=_0x4e383d;logger[_0x9f21('0xe')](_0x9f21('0x5e'),_0x35ba71['id']);return getTicket(_0x222c88,_0xba34cd,_0x35ba71,_0x37d088,_0x19165e,_0x37d088['Fields'],_0x34b483,_0x9f21('0x5f'));})[_0x9f21('0x29')](function(_0x4a0116){_0xd84602=_0x4a0116;logger[_0x9f21('0xe')](_0x9f21('0x60'));logger['info'](_0x9f21('0x61'),_0xd84602['id']);return setRelationship(_0x34b483,_0xba34cd,_0xd84602,_0x9f21('0x62'));})[_0x9f21('0x29')](function(){return setRelationship(_0x34b483,_0x35ba71,_0xd84602,_0x9f21('0x63'));})['then'](function(){return getServerInfo(_0x34b483);})['then'](function(_0xcbe297){var _0x148729=parseInt(_0xcbe297[_0x9f21('0x64')]['charAt'](0x0));var _0xd802c2=util[_0x9f21('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x222c88[_0x9f21('0x53')],_0xd84602['id']);if(_0x148729>0x6){_0xd802c2=util[_0x9f21('0x20')](_0x9f21('0x65'),_0x222c88[_0x9f21('0x53')],_0xd84602['id']);}logger[_0x9f21('0xe')](_0x9f21('0x58'),_0x9f21('0x66'));emit(util[_0x9f21('0x20')](_0x9f21('0x67'),_0x49feac[_0x9f21('0x17')]),_0x9f21('0x68'),{'uri':_0xd802c2});})[_0x9f21('0x69')](function(_0x4ceae1){logger[_0x9f21('0x6a')](_0x9f21('0x58'),JSON[_0x9f21('0x1e')](_0x4ceae1));});};exports[_0x9f21('0x6b')]=function(_0x229a31,_0x5aa435,_0x1c13cd,_0x1da687,_0x3d65b7,_0x18db16,_0x32b0f5){var _0x5bf96d,_0x2214cb,_0x3777fc,_0xcd8d01;_0x18db16[_0x9f21('0x53')]=intUtil[_0x9f21('0x54')](_0x18db16[_0x9f21('0x53')]);_0x18db16[_0x9f21('0x55')]=intUtil['stripTrailingSlash'](_0x18db16['serverUrl']);def['uri']=util[_0x9f21('0x20')](_0x9f21('0x56'),_0x18db16[_0x9f21('0x53')]);if(_0x32b0f5&&_0x32b0f5['recordingFormat']&&_0x32b0f5[_0x9f21('0x6c')]!=='none'){logger[_0x9f21('0xe')]('[OUTBOUND]',_0x9f21('0x6d'));_0x5aa435['recordingURL']=util['format'](_0x9f21('0x5a'),_0x18db16[_0x9f21('0x55')],_0x5aa435[_0x9f21('0x5b')],md5(_0x5aa435['uniqueid']));}return getConnection(_0x18db16)[_0x9f21('0x29')](function(_0x4a1b39){_0xcd8d01=_0x4a1b39;return getUser(_0x18db16,_0x1da687[_0x9f21('0x17')],_0xcd8d01);})[_0x9f21('0x29')](function(_0x1b8d0f){_0x5bf96d=_0x1b8d0f;logger[_0x9f21('0xe')](_0x9f21('0x6e'),_0x5bf96d['id']);return getEndUser(_0x18db16,_0x5aa435[_0x9f21('0x6f')],_0x5aa435[_0x9f21('0x70')],_0xcd8d01);})['then'](function(_0x5bad7d){_0x2214cb=_0x5bad7d;logger['info'](_0x9f21('0x5e'),_0x2214cb['id']);return getTicket(_0x18db16,_0x5bf96d,_0x2214cb,_0x1c13cd,_0x5aa435,_0x1c13cd[_0x9f21('0x71')],_0xcd8d01,'Outbound');})[_0x9f21('0x29')](function(_0x19c1ae){_0x3777fc=_0x19c1ae;logger['info'](_0x9f21('0x60'));logger['info'](_0x9f21('0x61'),_0x3777fc['id']);return setRelationship(_0xcd8d01,_0x5bf96d,_0x3777fc,'users');})['then'](function(){return setRelationship(_0xcd8d01,_0x2214cb,_0x3777fc,_0x9f21('0x63'));})[_0x9f21('0x29')](function(){return getServerInfo(_0xcd8d01);})[_0x9f21('0x29')](function(_0x3d53d6){var _0x1c59c0=parseInt(_0x3d53d6[_0x9f21('0x64')][_0x9f21('0x72')](0x0));var _0x55f3c5=util[_0x9f21('0x20')](_0x9f21('0x73'),_0x18db16[_0x9f21('0x53')],_0x3777fc['id']);if(_0x1c59c0>0x6){_0x55f3c5=util[_0x9f21('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x18db16['remoteUri'],_0x3777fc['id']);}logger[_0x9f21('0xe')](_0x9f21('0x74'),_0x9f21('0x66'));emit(util['format'](_0x9f21('0x67'),_0x1da687[_0x9f21('0x17')]),_0x9f21('0x68'),{'uri':_0x55f3c5});})[_0x9f21('0x69')](function(_0x24a86a){logger[_0x9f21('0x6a')](_0x9f21('0x74'),JSON['stringify'](_0x24a86a));});};exports[_0x9f21('0x75')]=function(_0x4c395f,_0x348f1f,_0x9a01a1,_0x1b42ee,_0x20be9a,_0x43e350){var _0x20fe75,_0x4a0c21,_0x16b748,_0x106837;_0x43e350['remoteUri']=intUtil[_0x9f21('0x54')](_0x43e350[_0x9f21('0x53')]);_0x43e350[_0x9f21('0x55')]=intUtil[_0x9f21('0x54')](_0x43e350['serverUrl']);def[_0x9f21('0x76')]=util[_0x9f21('0x20')](_0x9f21('0x56'),_0x43e350['remoteUri']);if(_0x20be9a&&_0x20be9a[_0x9f21('0x57')]){logger['info']('['+_0x348f1f[_0x9f21('0x77')][_0x9f21('0x78')]()+']','Recording\x20is\x20enabled!');_0x348f1f[_0x9f21('0x59')]=util[_0x9f21('0x20')](_0x9f21('0x5a'),_0x43e350[_0x9f21('0x55')],_0x348f1f[_0x9f21('0x5b')],md5(_0x348f1f[_0x9f21('0x5b')]));}else{_0x348f1f[_0x9f21('0x59')]='';}return getConnection(_0x43e350)[_0x9f21('0x29')](function(_0x377452){_0x106837=_0x377452;if(!_['isNil'](_0x1b42ee)){return getUser(_0x43e350,_0x1b42ee['name'],_0x106837);}else{return getUser(_0x43e350,null,_0x106837);}})[_0x9f21('0x29')](function(_0x4887bf){_0x20fe75=_0x4887bf;logger['info'](_0x9f21('0x6e'),_0x20fe75['id']);return getEndUser(_0x43e350,_0x348f1f[_0x9f21('0x5c')],_0x348f1f[_0x9f21('0x5d')],_0x106837);})['then'](function(_0x109caf){_0x4a0c21=_0x109caf;logger[_0x9f21('0xe')](_0x9f21('0x5e'),_0x4a0c21['id']);return getTicket(_0x43e350,_0x20fe75,_0x4a0c21,_0x9a01a1,_0x348f1f,_0x9a01a1[_0x9f21('0x71')],_0x106837,_0x9f21('0x5f'));})[_0x9f21('0x29')](function(_0x3bb853){_0x16b748=_0x3bb853;logger[_0x9f21('0xe')]('Ticket\x20created!');logger[_0x9f21('0xe')]('The\x20Ticket\x20ID\x20is:',_0x16b748['id']);return setRelationship(_0x106837,_0x20fe75,_0x16b748,_0x9f21('0x62'));})[_0x9f21('0x29')](function(){return setRelationship(_0x106837,_0x4a0c21,_0x16b748,_0x9f21('0x63'));})[_0x9f21('0x29')](function(){return getServerInfo(_0x106837);})[_0x9f21('0x69')](function(_0x40bf2b){logger[_0x9f21('0x6a')]('['+_0x348f1f['lastevent'][_0x9f21('0x78')]()+']',JSON[_0x9f21('0x1e')](_0x40bf2b));});}; \ 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 4940189..1f7cc69 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 _0xc2b0=['Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','sortBy','length','type','string','push','variable','variableName','toString','customVariable'];(function(_0x5be8ed,_0x57b2f0){var _0x47475f=function(_0x40c4f6){while(--_0x40c4f6){_0x5be8ed['push'](_0x5be8ed['shift']());}};_0x47475f(++_0x57b2f0);}(_0xc2b0,0x103));var _0x0c2b=function(_0x4e4827,_0x4c1947){_0x4e4827=_0x4e4827-0x0;var _0x58d622=_0xc2b0[_0x4e4827];return _0x58d622;};'use strict';var _=require(_0x0c2b('0x0'));var util=require(_0x0c2b('0x1'));exports['getString']=function(_0x4aa4c3,_0x308a89,_0x5092b9){var _0x1261c3=[];if(_0x4aa4c3['length']>0x0){var _0x2f2598=_[_0x0c2b('0x2')](_0x4aa4c3,['id']);for(var _0x52b8c8=0x0;_0x52b8c8<_0x2f2598[_0x0c2b('0x3')];_0x52b8c8++){var _0x5ca4a4=_0x2f2598[_0x52b8c8];if(_0x5ca4a4[_0x0c2b('0x4')]===_0x0c2b('0x5')){_0x1261c3[_0x0c2b('0x6')](_0x5ca4a4['content']);}else if(_0x5ca4a4[_0x0c2b('0x4')]===_0x0c2b('0x7')&&_0x5ca4a4[_0x0c2b('0x8')]){_0x308a89[_0x5ca4a4[_0x0c2b('0x8')]]&&_0x1261c3['push'](_0x308a89[_0x5ca4a4[_0x0c2b('0x8')]][_0x0c2b('0x9')]());}else if(_0x5ca4a4[_0x0c2b('0x4')]===_0x0c2b('0xa')&&_0x5ca4a4['Variable']&&_0x5ca4a4['Variable']['name']){_0x308a89[_0x5ca4a4[_0x0c2b('0xb')][_0x0c2b('0xc')]['toLowerCase']()]&&_0x1261c3[_0x0c2b('0x6')](_0x308a89[_0x5ca4a4[_0x0c2b('0xb')][_0x0c2b('0xc')][_0x0c2b('0xd')]()][_0x0c2b('0x9')]());}else if(_0x5ca4a4[_0x0c2b('0x4')]===_0x0c2b('0xe')){if(_0x5ca4a4[_0x0c2b('0xf')]===_0x0c2b('0x5')&&_0x5ca4a4[_0x0c2b('0x10')]){_0x1261c3[_0x0c2b('0x6')](util[_0x0c2b('0x11')]('%s:\x20%s',_0x5ca4a4[_0x0c2b('0x10')],_0x5ca4a4[_0x0c2b('0x12')]));}else if(_0x5ca4a4[_0x0c2b('0xf')]===_0x0c2b('0x7')&&_0x5ca4a4['variableName']&&_0x5ca4a4[_0x0c2b('0x10')]){_0x308a89[_0x5ca4a4['variableName']]&&_0x1261c3[_0x0c2b('0x6')](util[_0x0c2b('0x11')](_0x0c2b('0x13'),_0x5ca4a4[_0x0c2b('0x10')],_0x308a89[_0x5ca4a4[_0x0c2b('0x8')]]));}else if(_0x5ca4a4[_0x0c2b('0xf')]===_0x0c2b('0xa')&&_0x5ca4a4[_0x0c2b('0xb')]&&_0x5ca4a4[_0x0c2b('0xb')]['name']&&_0x5ca4a4[_0x0c2b('0x10')]){_0x308a89[_0x5ca4a4[_0x0c2b('0xb')]['name'][_0x0c2b('0xd')]()]&&_0x1261c3[_0x0c2b('0x6')](util['format'](_0x0c2b('0x13'),_0x5ca4a4[_0x0c2b('0x10')],_0x308a89[_0x5ca4a4[_0x0c2b('0xb')][_0x0c2b('0xc')]['toLowerCase']()]));}}}}return _0x1261c3[_0x0c2b('0x14')](_0x5092b9);};exports[_0x0c2b('0x15')]=function(_0x3d0f44){var _0x55a248=_0x3d0f44[_0x0c2b('0x16')](-0x1);if(_0x55a248==='/'){_0x3d0f44=_0x3d0f44['substring'](0x0,_0x3d0f44[_0x0c2b('0x17')](_0x55a248));}return _0x3d0f44;};exports[_0x0c2b('0x18')]=function(_0x5ca732){if(!_[_0x0c2b('0x19')](_0x5ca732)&&_0x5ca732!==''){var _0x3ee6cc=/^(([^<>()\[\]\\.,;:\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 _0x3ee6cc[_0x0c2b('0x1a')](String(_0x5ca732)[_0x0c2b('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x3a56=['type','string','push','variable','variableName','toString','customVariable','name','Variable','toLowerCase','keyValue','keyType','format','key','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length'];(function(_0x278428,_0x39442c){var _0x3e04b0=function(_0x270895){while(--_0x270895){_0x278428['push'](_0x278428['shift']());}};_0x3e04b0(++_0x39442c);}(_0x3a56,0xd4));var _0x63a5=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0x3a56[_0x577519];return _0x5b12f7;};'use strict';var _=require(_0x63a5('0x0'));var util=require(_0x63a5('0x1'));exports[_0x63a5('0x2')]=function(_0x32f926,_0x3643bd,_0x893342){var _0x49ab64=[];if(_0x32f926[_0x63a5('0x3')]>0x0){var _0x4f7533=_['sortBy'](_0x32f926,['id']);for(var _0x21a24f=0x0;_0x21a24f<_0x4f7533[_0x63a5('0x3')];_0x21a24f++){var _0x4104e1=_0x4f7533[_0x21a24f];if(_0x4104e1[_0x63a5('0x4')]===_0x63a5('0x5')){_0x49ab64[_0x63a5('0x6')](_0x4104e1['content']);}else if(_0x4104e1[_0x63a5('0x4')]===_0x63a5('0x7')&&_0x4104e1[_0x63a5('0x8')]){_0x3643bd[_0x4104e1[_0x63a5('0x8')]]&&_0x49ab64[_0x63a5('0x6')](_0x3643bd[_0x4104e1['variableName']][_0x63a5('0x9')]());}else if(_0x4104e1[_0x63a5('0x4')]===_0x63a5('0xa')&&_0x4104e1['Variable']&&_0x4104e1['Variable']['name']){_0x3643bd[_0x4104e1['Variable'][_0x63a5('0xb')]['toLowerCase']()]&&_0x49ab64[_0x63a5('0x6')](_0x3643bd[_0x4104e1[_0x63a5('0xc')][_0x63a5('0xb')][_0x63a5('0xd')]()][_0x63a5('0x9')]());}else if(_0x4104e1[_0x63a5('0x4')]===_0x63a5('0xe')){if(_0x4104e1[_0x63a5('0xf')]==='string'&&_0x4104e1['key']){_0x49ab64[_0x63a5('0x6')](util[_0x63a5('0x10')]('%s:\x20%s',_0x4104e1['key'],_0x4104e1['keyContent']));}else if(_0x4104e1[_0x63a5('0xf')]===_0x63a5('0x7')&&_0x4104e1[_0x63a5('0x8')]&&_0x4104e1[_0x63a5('0x11')]){_0x3643bd[_0x4104e1[_0x63a5('0x8')]]&&_0x49ab64['push'](util['format']('%s:\x20%s',_0x4104e1[_0x63a5('0x11')],_0x3643bd[_0x4104e1[_0x63a5('0x8')]]));}else if(_0x4104e1[_0x63a5('0xf')]===_0x63a5('0xa')&&_0x4104e1[_0x63a5('0xc')]&&_0x4104e1[_0x63a5('0xc')][_0x63a5('0xb')]&&_0x4104e1[_0x63a5('0x11')]){_0x3643bd[_0x4104e1['Variable'][_0x63a5('0xb')][_0x63a5('0xd')]()]&&_0x49ab64['push'](util[_0x63a5('0x10')]('%s:\x20%s',_0x4104e1[_0x63a5('0x11')],_0x3643bd[_0x4104e1[_0x63a5('0xc')][_0x63a5('0xb')]['toLowerCase']()]));}}}}return _0x49ab64['join'](_0x893342);};exports[_0x63a5('0x12')]=function(_0x38ffc3){var _0x20812d=_0x38ffc3['slice'](-0x1);if(_0x20812d==='/'){_0x38ffc3=_0x38ffc3[_0x63a5('0x13')](0x0,_0x38ffc3[_0x63a5('0x14')](_0x20812d));}return _0x38ffc3;};exports[_0x63a5('0x15')]=function(_0x485e4c){if(!_[_0x63a5('0x16')](_0x485e4c)&&_0x485e4c!==''){var _0x87bcf=/^(([^<>()\[\]\\.,;:\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 _0x87bcf[_0x63a5('0x17')](String(_0x485e4c)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 841f322..09f50ba 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 9424953..eaf9604 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 _0x50eb=['variable','variableName','push','customVariable','Variable','name','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','uniqueid','destcalleridnum','The\x20Enduser\x20ID\x20is:','POST','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','results','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','customField','nameField','toLowerCase','content','idField','custom_fields','type'];(function(_0x55642b,_0x4ef2dd){var _0x148c16=function(_0x5c650a){while(--_0x5c650a){_0x55642b['push'](_0x55642b['shift']());}};_0x148c16(++_0x4ef2dd);}(_0x50eb,0x182));var _0xb50e=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x50eb[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0xb50e('0x0'));var rp=require(_0xb50e('0x1'));var md5=require(_0xb50e('0x2'));var util=require(_0xb50e('0x3'));var Redis=require(_0xb50e('0x4'));var intUtil=require(_0xb50e('0x5'));var config=require(_0xb50e('0x6'));var logger=require(_0xb50e('0x7'))(_0xb50e('0x8'));config[_0xb50e('0x9')]=_['defaults'](config[_0xb50e('0x9')],{'host':_0xb50e('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb50e('0x9')]));function emit(_0x44bb6e,_0x1eef4f,_0x4bb9e0){io['to'](_0x44bb6e)['emit'](_0x1eef4f,_0x4bb9e0);}var headers={'Content-Type':_0xb50e('0xb'),'Accept':_0xb50e('0xb')};function getTicket(_0x415df3,_0x5ca27b,_0x43b3e7,_0x562b47,_0x4eb867){logger[_0xb50e('0xc')](_0xb50e('0xd'));return request({'uri':util[_0xb50e('0xe')](_0xb50e('0xf'),_0x415df3[_0xb50e('0x10')]),'method':'POST','body':{'ticket':_[_0xb50e('0x11')]({'requester_id':_0x43b3e7['id'],'submitter_id':_0x5ca27b?_0x5ca27b['id']:undefined,'assignee_id':_0x5ca27b?_0x5ca27b['id']:undefined,'tags':getTags(_0x562b47[_0xb50e('0x12')],'name'),'subject':intUtil[_0xb50e('0x13')](_0x562b47[_0xb50e('0x14')],_0x4eb867,'\x20'),'description':intUtil[_0xb50e('0x13')](_0x562b47[_0xb50e('0x15')],_0x4eb867,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x562b47[_0xb50e('0x15')],_0x4eb867,'\x0a')}},getCustomFields(_0x562b47[_0xb50e('0x16')],_0x4eb867))}})[_0xb50e('0x17')](function(_0x47d0f3){logger[_0xb50e('0xc')](_0xb50e('0x18'));return _0x47d0f3[_0xb50e('0x19')];});}function getUser(_0x2c80e5,_0x1eb438){if(intUtil[_0xb50e('0x1a')](_0x1eb438)){logger[_0xb50e('0xc')]('Getting\x20agent\x20with\x20email',_0x1eb438);return request({'uri':util[_0xb50e('0xe')](_0xb50e('0x1b'),_0x2c80e5[_0xb50e('0x10')]),'qs':{'query':util[_0xb50e('0xe')](_0xb50e('0x1c'),_0x1eb438)}})[_0xb50e('0x17')](function(_0x3e1886){if(_0x3e1886['count']){logger[_0xb50e('0xc')](_0xb50e('0x1d'));return _[_0xb50e('0x1e')](_0x3e1886['results'],{'email':_0x1eb438,'role':_0xb50e('0x1f')});}else{logger[_0xb50e('0xc')](_0xb50e('0x20'));return request({'uri':util[_0xb50e('0xe')](_0xb50e('0x21'),_0x2c80e5[_0xb50e('0x10')])})[_0xb50e('0x17')](function(_0x1bba81){logger['info'](_0xb50e('0x22'));return _0x1bba81[_0xb50e('0x23')];});}});}else{logger[_0xb50e('0xc')](_0xb50e('0x20'));return request({'uri':util[_0xb50e('0xe')](_0xb50e('0x21'),_0x2c80e5[_0xb50e('0x10')])})[_0xb50e('0x17')](function(_0x2c39ba){logger[_0xb50e('0xc')]('Admin\x20account\x20selected.');return _0x2c39ba['user'];});}}function getEndUser(_0x1cb6c4,_0xf13dfe,_0x2d0cef){logger[_0xb50e('0xc')](_0xb50e('0x24'),_0x2d0cef);return request({'uri':util[_0xb50e('0xe')]('%s/search.json',_0x1cb6c4['remoteUri']),'qs':{'query':util['format'](_0xb50e('0x25'),_0x2d0cef)}})['then'](function(_0x500793){var _0x5d8fda;if(_0x500793['results'][_0xb50e('0x26')]){_0x500793[_0xb50e('0x27')]=_[_0xb50e('0x28')](_0x500793[_0xb50e('0x27')],{'suspended':![],'role':_0xb50e('0x29')});if(_0x500793[_0xb50e('0x27')][_0xb50e('0x26')]){_0x5d8fda=_['first'](_0x500793[_0xb50e('0x27')]);}}if(_0x5d8fda){logger[_0xb50e('0xc')](_0xb50e('0x2a'));return _0x5d8fda;}else{logger[_0xb50e('0xc')](_0xb50e('0x2b'));return request({'uri':util[_0xb50e('0xe')](_0xb50e('0x2c'),_0x1cb6c4[_0xb50e('0x10')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xb50e('0xe')](_0xb50e('0x2d'),_0xf13dfe||_0x2d0cef),'phone':_0x2d0cef}}})['then'](function(_0x20803d){logger[_0xb50e('0xc')](_0xb50e('0x2e'));return _0x20803d[_0xb50e('0x23')];});}});}function getAuth(_0x1961dd){var _0x944e9c;if(_0x1961dd[_0xb50e('0x2f')]===_0xb50e('0x30')){_0x944e9c=util['format'](_0xb50e('0x31'),_0x1961dd[_0xb50e('0x32')],_0x1961dd[_0xb50e('0x30')]);}else if(_0x1961dd['authType']===_0xb50e('0x33')){_0x944e9c=util['format'](_0xb50e('0x34'),_0x1961dd[_0xb50e('0x32')],_0x1961dd[_0xb50e('0x33')]);}return util[_0xb50e('0xe')]('Basic\x20%s',new Buffer(_0x944e9c)[_0xb50e('0x35')](_0xb50e('0x36')));}function request(_0xb45ca1){logger[_0xb50e('0x37')](_0xb50e('0x38'),JSON[_0xb50e('0x39')](_0xb45ca1));return rp(_['defaults'](_0xb45ca1,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5e001,_0x159c69){var _0x3fa9ff=[];if(_0x5e001&&_0x5e001[_0xb50e('0x26')]>0x0){_0x3fa9ff=_[_0xb50e('0x3a')](_0x5e001,_0x159c69);}return _0x3fa9ff;}function getCustomFields(_0x5346bc,_0x50ccea){var _0x47122e=[];var _0xd651d1={'custom_fields':[]};if(_0x5346bc[_0xb50e('0x26')]>0x0){_[_0xb50e('0x3b')](_0x5346bc,function(_0x3f53c4){if(_[_0xb50e('0x3c')]([_0xb50e('0x3d'),_0xb50e('0x3e')],_0x3f53c4['type'])&&_0x3f53c4['nameField']&&!_0x3f53c4[_0xb50e('0x3f')]){_0xd651d1[_0x3f53c4[_0xb50e('0x40')][_0xb50e('0x41')]()]=_0x3f53c4[_0xb50e('0x42')][_0xb50e('0x35')]();}else if(_['includes']([_0xb50e('0x3d'),_0xb50e('0x3e')],_0x3f53c4['type'])&&_0x3f53c4[_0xb50e('0x43')]&&_0x3f53c4[_0xb50e('0x3f')]){_0xd651d1[_0xb50e('0x44')]['push']({'id':_0x3f53c4[_0xb50e('0x43')],'value':_0x3f53c4[_0xb50e('0x42')]['toString']()});}else if(_0x3f53c4[_0xb50e('0x45')]===_0xb50e('0x46')&&_0x3f53c4[_0xb50e('0x47')]&&_0x3f53c4[_0xb50e('0x43')]&&_0x3f53c4[_0xb50e('0x3f')]){_0x50ccea[_0x3f53c4['variableName']]&&_0xd651d1[_0xb50e('0x44')][_0xb50e('0x48')]({'id':_0x3f53c4['idField'],'value':_0x50ccea[_0x3f53c4['variableName']][_0xb50e('0x35')]()});}else if(_0x3f53c4[_0xb50e('0x45')]===_0xb50e('0x49')&&_0x3f53c4[_0xb50e('0x4a')]&&_0x3f53c4[_0xb50e('0x4a')][_0xb50e('0x4b')]&&_0x3f53c4['idField']&&_0x3f53c4[_0xb50e('0x3f')]){_0x50ccea[_0x3f53c4[_0xb50e('0x4a')][_0xb50e('0x4b')][_0xb50e('0x41')]()]&&_0xd651d1[_0xb50e('0x44')][_0xb50e('0x48')]({'id':_0x3f53c4['idField'],'value':_0x50ccea[_0x3f53c4[_0xb50e('0x4a')][_0xb50e('0x4b')]['toLowerCase']()][_0xb50e('0x35')]()});}});}return _0xd651d1;}exports[_0xb50e('0x4c')]=function(_0x5dfa16,_0x53cf91,_0x267fb1,_0x50cf39,_0x15c842,_0x5e4a43){var _0x3fd5ae,_0x4b8810;_0x5e4a43['remoteUri']=intUtil['stripTrailingSlash'](_0x5e4a43[_0xb50e('0x10')]);_0x5e4a43[_0xb50e('0x4d')]=intUtil['stripTrailingSlash'](_0x5e4a43[_0xb50e('0x4d')]);if(_0x15c842&&_0x15c842[_0xb50e('0x4e')]){logger[_0xb50e('0xc')]('[QUEUE]',_0xb50e('0x4f'));_0x53cf91[_0xb50e('0x50')]=util[_0xb50e('0xe')](_0xb50e('0x51'),_0x5e4a43[_0xb50e('0x4d')],_0x53cf91['uniqueid'],md5(_0x53cf91['uniqueid']));}else{_0x53cf91[_0xb50e('0x50')]='';}headers[_0xb50e('0x52')]=getAuth(_0x5e4a43);return getUser(_0x5e4a43,_0x50cf39[_0xb50e('0x53')])['then'](function(_0xbd3ec3){_0x3fd5ae=_0xbd3ec3;logger[_0xb50e('0xc')](_0xb50e('0x54'),_0x3fd5ae['id']);return getEndUser(_0x5e4a43,_0x53cf91['calleridname'],_0x53cf91[_0xb50e('0x55')]);})[_0xb50e('0x17')](function(_0x2a15f5){_0x4b8810=_0x2a15f5;logger[_0xb50e('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4b8810['id']);return getTicket(_0x5e4a43,_0x3fd5ae,_0x4b8810,_0x267fb1,_0x53cf91);})[_0xb50e('0x17')](function(_0x11b4e3){if(_0x11b4e3){logger[_0xb50e('0xc')](_0xb50e('0x56'),_0x11b4e3['id']);switch(_0x5e4a43[_0xb50e('0x45')]){case _0xb50e('0x57'):logger['info'](_0xb50e('0x58'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xb50e('0x59'),_0x5e4a43[_0xb50e('0x10')],_0x3fd5ae['id'],_0x11b4e3['id']),'method':'POST'});case'newTab':logger[_0xb50e('0xc')](_0xb50e('0x58'),_0xb50e('0x5a'));emit(util[_0xb50e('0xe')](_0xb50e('0x5b'),_0x50cf39[_0xb50e('0x4b')]),_0xb50e('0x5c'),{'uri':util[_0xb50e('0xe')](_0xb50e('0x5d'),_0x5e4a43[_0xb50e('0x10')][_0xb50e('0x5e')](_0xb50e('0x5f'),''),_0x11b4e3['id'])});break;default:logger[_0xb50e('0x60')](_0xb50e('0x58'),_0xb50e('0x61'));}}})[_0xb50e('0x62')](function(_0x323aa3){logger[_0xb50e('0x60')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb50e('0x63')](_0x323aa3,{'showHidden':!![],'depth':null}));});};exports[_0xb50e('0x64')]=function(_0x411b15,_0x18fb21,_0x376946,_0x22bded,_0x312fb9,_0x10c2a5,_0x56acf8){var _0x2e6085,_0x412924;_0x10c2a5[_0xb50e('0x10')]=intUtil[_0xb50e('0x65')](_0x10c2a5[_0xb50e('0x10')]);_0x10c2a5[_0xb50e('0x4d')]=intUtil['stripTrailingSlash'](_0x10c2a5[_0xb50e('0x4d')]);if(_0x56acf8&&_0x56acf8[_0xb50e('0x66')]&&_0x56acf8['recordingFormat']!=='none'){logger[_0xb50e('0xc')](_0xb50e('0x67'),_0xb50e('0x4f'));_0x18fb21[_0xb50e('0x50')]=util[_0xb50e('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10c2a5['serverUrl'],_0x18fb21[_0xb50e('0x68')],md5(_0x18fb21['uniqueid']));}headers[_0xb50e('0x52')]=getAuth(_0x10c2a5);return getUser(_0x10c2a5,_0x22bded[_0xb50e('0x53')])[_0xb50e('0x17')](function(_0x1d5b48){_0x2e6085=_0x1d5b48;logger[_0xb50e('0xc')](_0xb50e('0x54'),_0x2e6085['id']);return getEndUser(_0x10c2a5,_0x18fb21['destcalleridname'],_0x18fb21[_0xb50e('0x69')]);})[_0xb50e('0x17')](function(_0x1b1642){_0x412924=_0x1b1642;logger[_0xb50e('0xc')](_0xb50e('0x6a'),_0x412924['id']);return getTicket(_0x10c2a5,_0x2e6085,_0x412924,_0x376946,_0x18fb21);})[_0xb50e('0x17')](function(_0x4829e0){if(_0x4829e0){logger[_0xb50e('0xc')](_0xb50e('0x56'),_0x4829e0['id']);switch(_0x10c2a5['type']){case _0xb50e('0x57'):logger[_0xb50e('0xc')](_0xb50e('0x67'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb50e('0xe')](_0xb50e('0x59'),_0x10c2a5[_0xb50e('0x10')],_0x2e6085['id'],_0x4829e0['id']),'method':_0xb50e('0x6b')});case _0xb50e('0x6c'):logger[_0xb50e('0xc')](_0xb50e('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb50e('0xe')](_0xb50e('0x5b'),_0x22bded['name']),_0xb50e('0x5c'),{'uri':util['format'](_0xb50e('0x5d'),_0x10c2a5[_0xb50e('0x10')][_0xb50e('0x5e')](_0xb50e('0x5f'),''),_0x4829e0['id'])});break;default:logger[_0xb50e('0x60')](_0xb50e('0x67'),_0xb50e('0x61'));}}})[_0xb50e('0x62')](function(_0x46add9){logger[_0xb50e('0x60')](_0xb50e('0x6d'),util[_0xb50e('0x63')](_0x46add9,{'showHidden':!![],'depth':null}));});};exports[_0xb50e('0x6e')]=function(_0x2af5ce,_0x5caa4c,_0x1238f5,_0x3570ad,_0x267bea,_0x1462ab){var _0xd1ca9b,_0x22a997;_0x1462ab[_0xb50e('0x10')]=intUtil[_0xb50e('0x65')](_0x1462ab[_0xb50e('0x10')]);_0x1462ab[_0xb50e('0x4d')]=intUtil[_0xb50e('0x65')](_0x1462ab[_0xb50e('0x4d')]);if(_0x267bea&&_0x267bea['monitor_format']){logger[_0xb50e('0xc')]('['+_0x5caa4c[_0xb50e('0x6f')][_0xb50e('0x70')]()+']',_0xb50e('0x4f'));_0x5caa4c[_0xb50e('0x50')]=util[_0xb50e('0xe')](_0xb50e('0x51'),_0x1462ab[_0xb50e('0x4d')],_0x5caa4c[_0xb50e('0x68')],md5(_0x5caa4c[_0xb50e('0x68')]));}else{_0x5caa4c['recordingURL']='';}headers['Authorization']=getAuth(_0x1462ab);return getUser(_0x1462ab)[_0xb50e('0x17')](function(_0x971f14){_0xd1ca9b=_0x971f14;logger['info'](_0xb50e('0x54'),_0xd1ca9b['id']);return getEndUser(_0x1462ab,_0x5caa4c[_0xb50e('0x71')],_0x5caa4c[_0xb50e('0x55')]);})[_0xb50e('0x17')](function(_0x4ab75a){_0x22a997=_0x4ab75a;logger['info'](_0xb50e('0x6a'),_0x22a997['id']);return getTicket(_0x1462ab,_0xd1ca9b,_0x22a997,_0x1238f5,_0x5caa4c);})[_0xb50e('0x17')](function(_0x3c13f4){if(_0x3c13f4){logger[_0xb50e('0xc')](_0xb50e('0x56'),_0x3c13f4['id']);}})[_0xb50e('0x62')](function(_0x21f4d1){logger[_0xb50e('0x60')]('['+_0x5caa4c[_0xb50e('0x6f')][_0xb50e('0x70')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xb50e('0x63')](_0x21f4d1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa264=['Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','authType','password','%s:%s','username','token','base64','debug','[HTTP]','defaults','GET','string','picklist','type','nameField','toLowerCase','content','idField','custom_fields','push','variableName','customField','toString','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[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','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','/api/v2','error','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','replace','Zendesk\x20account\x20type\x20not\x20recognized','monitor_format','toUpperCase','calleridname','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first'];(function(_0x343bac,_0x3d81fb){var _0x4435bf=function(_0x35620d){while(--_0x35620d){_0x343bac['push'](_0x343bac['shift']());}};_0x4435bf(++_0x3d81fb);}(_0xa264,0x183));var _0x4a26=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xa264[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x4a26('0x0'));var rp=require('request-promise');var md5=require(_0x4a26('0x1'));var util=require(_0x4a26('0x2'));var Redis=require('ioredis');var intUtil=require(_0x4a26('0x3'));var config=require(_0x4a26('0x4'));var logger=require(_0x4a26('0x5'))(_0x4a26('0x6'));config[_0x4a26('0x7')]=_['defaults'](config['redis'],{'host':_0x4a26('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x434bb8,_0x4c8e51,_0x2c0a65){io['to'](_0x434bb8)[_0x4a26('0x9')](_0x4c8e51,_0x2c0a65);}var headers={'Content-Type':_0x4a26('0xa'),'Accept':_0x4a26('0xa')};function getTicket(_0x407631,_0x4b0f72,_0x13c6b3,_0xe294f8,_0xf17a7d){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x4a26('0xb')](_0x4a26('0xc'),_0x407631[_0x4a26('0xd')]),'method':_0x4a26('0xe'),'body':{'ticket':_[_0x4a26('0xf')]({'requester_id':_0x13c6b3['id'],'submitter_id':_0x4b0f72?_0x4b0f72['id']:undefined,'assignee_id':_0x4b0f72?_0x4b0f72['id']:undefined,'tags':getTags(_0xe294f8[_0x4a26('0x10')],_0x4a26('0x11')),'subject':intUtil[_0x4a26('0x12')](_0xe294f8[_0x4a26('0x13')],_0xf17a7d,'\x20'),'description':intUtil[_0x4a26('0x12')](_0xe294f8['Descriptions'],_0xf17a7d,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4a26('0x12')](_0xe294f8[_0x4a26('0x14')],_0xf17a7d,'\x0a')}},getCustomFields(_0xe294f8['Fields'],_0xf17a7d))}})[_0x4a26('0x15')](function(_0x486d17){logger[_0x4a26('0x16')]('Ticket\x20created!');return _0x486d17[_0x4a26('0x17')];});}function getUser(_0x18f914,_0x1db843){if(intUtil[_0x4a26('0x18')](_0x1db843)){logger[_0x4a26('0x16')](_0x4a26('0x19'),_0x1db843);return request({'uri':util[_0x4a26('0xb')](_0x4a26('0x1a'),_0x18f914[_0x4a26('0xd')]),'qs':{'query':util[_0x4a26('0xb')](_0x4a26('0x1b'),_0x1db843)}})[_0x4a26('0x15')](function(_0x22d1fd){if(_0x22d1fd[_0x4a26('0x1c')]){logger['info']('Agent\x20found!');return _[_0x4a26('0x1d')](_0x22d1fd[_0x4a26('0x1e')],{'email':_0x1db843,'role':_0x4a26('0x1f')});}else{logger[_0x4a26('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4a26('0xb')](_0x4a26('0x20'),_0x18f914['remoteUri'])})['then'](function(_0x1f1348){logger[_0x4a26('0x16')](_0x4a26('0x21'));return _0x1f1348[_0x4a26('0x22')];});}});}else{logger['info'](_0x4a26('0x23'));return request({'uri':util[_0x4a26('0xb')]('%s/users/me.json',_0x18f914['remoteUri'])})[_0x4a26('0x15')](function(_0x1c9234){logger['info'](_0x4a26('0x21'));return _0x1c9234['user'];});}}function getEndUser(_0x4a3fec,_0x48aff9,_0x2888a8){logger[_0x4a26('0x16')]('Searching\x20enduser\x20with\x20phone',_0x2888a8);return request({'uri':util['format'](_0x4a26('0x1a'),_0x4a3fec[_0x4a26('0xd')]),'qs':{'query':util[_0x4a26('0xb')](_0x4a26('0x24'),_0x2888a8)}})[_0x4a26('0x15')](function(_0x3726f7){var _0x3fade3;if(_0x3726f7[_0x4a26('0x1e')][_0x4a26('0x25')]){_0x3726f7[_0x4a26('0x1e')]=_[_0x4a26('0x26')](_0x3726f7[_0x4a26('0x1e')],{'suspended':![],'role':_0x4a26('0x27')});if(_0x3726f7[_0x4a26('0x1e')]['length']){_0x3fade3=_[_0x4a26('0x28')](_0x3726f7[_0x4a26('0x1e')]);}}if(_0x3fade3){logger['info'](_0x4a26('0x29'));return _0x3fade3;}else{logger['info'](_0x4a26('0x2a'));return request({'uri':util['format']('%s/users.json',_0x4a3fec[_0x4a26('0xd')]),'method':_0x4a26('0xe'),'body':{'user':{'role':'end-user','name':util[_0x4a26('0xb')]('Caller\x20-\x20%s',_0x48aff9||_0x2888a8),'phone':_0x2888a8}}})['then'](function(_0x5e019c){logger[_0x4a26('0x16')](_0x4a26('0x2b'));return _0x5e019c[_0x4a26('0x22')];});}});}function getAuth(_0x66740c){var _0x2aea79;if(_0x66740c[_0x4a26('0x2c')]===_0x4a26('0x2d')){_0x2aea79=util[_0x4a26('0xb')](_0x4a26('0x2e'),_0x66740c[_0x4a26('0x2f')],_0x66740c['password']);}else if(_0x66740c[_0x4a26('0x2c')]===_0x4a26('0x30')){_0x2aea79=util[_0x4a26('0xb')]('%s/token:%s',_0x66740c[_0x4a26('0x2f')],_0x66740c[_0x4a26('0x30')]);}return util['format']('Basic\x20%s',new Buffer(_0x2aea79)['toString'](_0x4a26('0x31')));}function request(_0x6a4a12){logger[_0x4a26('0x32')](_0x4a26('0x33'),JSON['stringify'](_0x6a4a12));return rp(_[_0x4a26('0x34')](_0x6a4a12,{'method':_0x4a26('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x71683f,_0x2a8576){var _0x3219ea=[];if(_0x71683f&&_0x71683f[_0x4a26('0x25')]>0x0){_0x3219ea=_['map'](_0x71683f,_0x2a8576);}return _0x3219ea;}function getCustomFields(_0x240e0b,_0x66faea){var _0x4a50b1=[];var _0x507a1b={'custom_fields':[]};if(_0x240e0b['length']>0x0){_['forEach'](_0x240e0b,function(_0x323d11){if(_['includes']([_0x4a26('0x36'),_0x4a26('0x37')],_0x323d11[_0x4a26('0x38')])&&_0x323d11[_0x4a26('0x39')]&&!_0x323d11['customField']){_0x507a1b[_0x323d11[_0x4a26('0x39')][_0x4a26('0x3a')]()]=_0x323d11[_0x4a26('0x3b')]['toString']();}else if(_['includes']([_0x4a26('0x36'),_0x4a26('0x37')],_0x323d11[_0x4a26('0x38')])&&_0x323d11[_0x4a26('0x3c')]&&_0x323d11['customField']){_0x507a1b[_0x4a26('0x3d')][_0x4a26('0x3e')]({'id':_0x323d11['idField'],'value':_0x323d11['content']['toString']()});}else if(_0x323d11[_0x4a26('0x38')]==='variable'&&_0x323d11[_0x4a26('0x3f')]&&_0x323d11[_0x4a26('0x3c')]&&_0x323d11[_0x4a26('0x40')]){_0x66faea[_0x323d11[_0x4a26('0x3f')]]&&_0x507a1b['custom_fields'][_0x4a26('0x3e')]({'id':_0x323d11[_0x4a26('0x3c')],'value':_0x66faea[_0x323d11[_0x4a26('0x3f')]][_0x4a26('0x41')]()});}else if(_0x323d11[_0x4a26('0x38')]===_0x4a26('0x42')&&_0x323d11[_0x4a26('0x43')]&&_0x323d11[_0x4a26('0x43')][_0x4a26('0x11')]&&_0x323d11[_0x4a26('0x3c')]&&_0x323d11[_0x4a26('0x40')]){_0x66faea[_0x323d11['Variable'][_0x4a26('0x11')]['toLowerCase']()]&&_0x507a1b[_0x4a26('0x3d')][_0x4a26('0x3e')]({'id':_0x323d11[_0x4a26('0x3c')],'value':_0x66faea[_0x323d11[_0x4a26('0x43')][_0x4a26('0x11')]['toLowerCase']()][_0x4a26('0x41')]()});}});}return _0x507a1b;}exports[_0x4a26('0x44')]=function(_0x143978,_0x1f21b0,_0x5dd596,_0x2be207,_0x5b3eac,_0x269097){var _0x51188e,_0x1e7d5f;_0x269097['remoteUri']=intUtil[_0x4a26('0x45')](_0x269097[_0x4a26('0xd')]);_0x269097[_0x4a26('0x46')]=intUtil[_0x4a26('0x45')](_0x269097['serverUrl']);if(_0x5b3eac&&_0x5b3eac['monitor_format']){logger[_0x4a26('0x16')](_0x4a26('0x47'),_0x4a26('0x48'));_0x1f21b0['recordingURL']=util[_0x4a26('0xb')](_0x4a26('0x49'),_0x269097['serverUrl'],_0x1f21b0[_0x4a26('0x4a')],md5(_0x1f21b0['uniqueid']));}else{_0x1f21b0[_0x4a26('0x4b')]='';}headers[_0x4a26('0x4c')]=getAuth(_0x269097);return getUser(_0x269097,_0x2be207['email'])[_0x4a26('0x15')](function(_0x1e96d0){_0x51188e=_0x1e96d0;logger[_0x4a26('0x16')]('The\x20User\x20ID\x20is:',_0x51188e['id']);return getEndUser(_0x269097,_0x1f21b0['calleridname'],_0x1f21b0[_0x4a26('0x4d')]);})[_0x4a26('0x15')](function(_0xf11ee9){_0x1e7d5f=_0xf11ee9;logger[_0x4a26('0x16')](_0x4a26('0x4e'),_0x1e7d5f['id']);return getTicket(_0x269097,_0x51188e,_0x1e7d5f,_0x5dd596,_0x1f21b0);})['then'](function(_0x329396){if(_0x329396){logger[_0x4a26('0x16')](_0x4a26('0x4f'),_0x329396['id']);switch(_0x269097[_0x4a26('0x38')]){case _0x4a26('0x50'):logger[_0x4a26('0x16')](_0x4a26('0x47'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4a26('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x269097[_0x4a26('0xd')],_0x51188e['id'],_0x329396['id']),'method':'POST'});case _0x4a26('0x51'):logger[_0x4a26('0x16')](_0x4a26('0x47'),_0x4a26('0x52'));emit(util['format'](_0x4a26('0x53'),_0x2be207[_0x4a26('0x11')]),'trigger:browser:url',{'uri':util[_0x4a26('0xb')](_0x4a26('0x54'),_0x269097[_0x4a26('0xd')]['replace'](_0x4a26('0x55'),''),_0x329396['id'])});break;default:logger[_0x4a26('0x56')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x4a26('0x57')](function(_0x3c2d05){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4a26('0x58')](_0x3c2d05,{'showHidden':!![],'depth':null}));});};exports[_0x4a26('0x59')]=function(_0xddcbda,_0x3f7158,_0x279aa3,_0x478b56,_0xa702ac,_0x3d8b26,_0x54c318){var _0x91964f,_0x5ef49e;_0x3d8b26['remoteUri']=intUtil[_0x4a26('0x45')](_0x3d8b26[_0x4a26('0xd')]);_0x3d8b26['serverUrl']=intUtil['stripTrailingSlash'](_0x3d8b26[_0x4a26('0x46')]);if(_0x54c318&&_0x54c318['recordingFormat']&&_0x54c318[_0x4a26('0x5a')]!==_0x4a26('0x5b')){logger[_0x4a26('0x16')](_0x4a26('0x5c'),_0x4a26('0x48'));_0x3f7158['recordingURL']=util[_0x4a26('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3d8b26[_0x4a26('0x46')],_0x3f7158[_0x4a26('0x4a')],md5(_0x3f7158['uniqueid']));}headers[_0x4a26('0x4c')]=getAuth(_0x3d8b26);return getUser(_0x3d8b26,_0x478b56[_0x4a26('0x5d')])[_0x4a26('0x15')](function(_0x398e4a){_0x91964f=_0x398e4a;logger[_0x4a26('0x16')](_0x4a26('0x5e'),_0x91964f['id']);return getEndUser(_0x3d8b26,_0x3f7158[_0x4a26('0x5f')],_0x3f7158[_0x4a26('0x60')]);})['then'](function(_0x47edd0){_0x5ef49e=_0x47edd0;logger[_0x4a26('0x16')]('The\x20Enduser\x20ID\x20is:',_0x5ef49e['id']);return getTicket(_0x3d8b26,_0x91964f,_0x5ef49e,_0x279aa3,_0x3f7158);})[_0x4a26('0x15')](function(_0x296582){if(_0x296582){logger[_0x4a26('0x16')]('The\x20Ticket\x20ID\x20is:',_0x296582['id']);switch(_0x3d8b26[_0x4a26('0x38')]){case _0x4a26('0x50'):logger['info'](_0x4a26('0x5c'),_0x4a26('0x61'));return request({'uri':util[_0x4a26('0xb')](_0x4a26('0x62'),_0x3d8b26[_0x4a26('0xd')],_0x91964f['id'],_0x296582['id']),'method':'POST'});case'newTab':logger[_0x4a26('0x16')](_0x4a26('0x5c'),_0x4a26('0x52'));emit(util[_0x4a26('0xb')](_0x4a26('0x53'),_0x478b56['name']),_0x4a26('0x63'),{'uri':util['format'](_0x4a26('0x54'),_0x3d8b26['remoteUri'][_0x4a26('0x64')]('/api/v2',''),_0x296582['id'])});break;default:logger[_0x4a26('0x56')](_0x4a26('0x5c'),_0x4a26('0x65'));}}})[_0x4a26('0x57')](function(_0xa6f49d){logger[_0x4a26('0x56')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4a26('0x58')](_0xa6f49d,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0xd33978,_0xe791d2,_0x4757db,_0x1d0e35,_0x433807,_0x1ec1bc){var _0x490418,_0x3a03db;_0x1ec1bc['remoteUri']=intUtil[_0x4a26('0x45')](_0x1ec1bc[_0x4a26('0xd')]);_0x1ec1bc[_0x4a26('0x46')]=intUtil['stripTrailingSlash'](_0x1ec1bc[_0x4a26('0x46')]);if(_0x433807&&_0x433807[_0x4a26('0x66')]){logger['info']('['+_0xe791d2['lastevent'][_0x4a26('0x67')]()+']','Recording\x20is\x20enabled!');_0xe791d2['recordingURL']=util[_0x4a26('0xb')](_0x4a26('0x49'),_0x1ec1bc[_0x4a26('0x46')],_0xe791d2[_0x4a26('0x4a')],md5(_0xe791d2[_0x4a26('0x4a')]));}else{_0xe791d2[_0x4a26('0x4b')]='';}headers[_0x4a26('0x4c')]=getAuth(_0x1ec1bc);return getUser(_0x1ec1bc)['then'](function(_0x399244){_0x490418=_0x399244;logger[_0x4a26('0x16')](_0x4a26('0x5e'),_0x490418['id']);return getEndUser(_0x1ec1bc,_0xe791d2[_0x4a26('0x68')],_0xe791d2[_0x4a26('0x4d')]);})['then'](function(_0x36ea41){_0x3a03db=_0x36ea41;logger[_0x4a26('0x16')](_0x4a26('0x4e'),_0x3a03db['id']);return getTicket(_0x1ec1bc,_0x490418,_0x3a03db,_0x4757db,_0xe791d2);})[_0x4a26('0x15')](function(_0x317b7d){if(_0x317b7d){logger[_0x4a26('0x16')](_0x4a26('0x4f'),_0x317b7d['id']);}})[_0x4a26('0x57')](function(_0xeaa936){logger[_0x4a26('0x56')]('['+_0xe791d2[_0x4a26('0x69')]['toUpperCase']()+']'+_0x4a26('0x6a'),util[_0x4a26('0x58')](_0xeaa936,{'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 a34f6af..138254e 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 _0xf505=['lastevent','called','Call_Result','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/downloads?type=uniqueid&token=','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime'];(function(_0x1ac9be,_0x529cba){var _0x5482db=function(_0x47e6e5){while(--_0x47e6e5){_0x1ac9be['push'](_0x1ac9be['shift']());}};_0x5482db(++_0x529cba);}(_0xf505,0x172));var _0x5f50=function(_0x2a6501,_0x9c5a0e){_0x2a6501=_0x2a6501-0x0;var _0x34d3ae=_0xf505[_0x2a6501];return _0x34d3ae;};'use strict';var _=require(_0x5f50('0x0'));var rp=require('request-promise');var md5=require(_0x5f50('0x1'));var util=require(_0x5f50('0x2'));var intUtil=require(_0x5f50('0x3'));var moment=require(_0x5f50('0x4'));var Redis=require(_0x5f50('0x5'));var BPromise=require(_0x5f50('0x6'));var config=require(_0x5f50('0x7'));var logger=require('../../../../config/logger')('zoho');config[_0x5f50('0x8')]=_[_0x5f50('0x9')](config[_0x5f50('0x8')],{'host':_0x5f50('0xa'),'port':0x18eb});var io=require(_0x5f50('0xb'))(new Redis(config[_0x5f50('0x8')]));function emit(_0x157a3a,_0x4740e8,_0x7dcb7a){io['to'](_0x157a3a)[_0x5f50('0xc')](_0x4740e8,_0x7dcb7a);}function request(_0x4dbac5){logger[_0x5f50('0xd')](_0x5f50('0xe'),JSON[_0x5f50('0xf')](_0x4dbac5));return rp(_0x4dbac5);}function getCustomFields(_0x408cf9,_0x184cbb){var _0x593ec6={};if(_0x408cf9[_0x5f50('0x10')]>0x0){_[_0x5f50('0x11')](_0x408cf9,function(_0x5d0c0){if(_['includes']([_0x5f50('0x12'),_0x5f50('0x13')],_0x5d0c0['type'])&&_0x5d0c0['idField']){_0x593ec6[_0x5d0c0[_0x5f50('0x14')]]=_0x5d0c0['content'][_0x5f50('0x15')]();}else if(_0x5d0c0['type']===_0x5f50('0x16')&&_0x5d0c0[_0x5f50('0x17')]&&_0x5d0c0[_0x5f50('0x14')]&&_0x184cbb[_0x5d0c0[_0x5f50('0x17')]]){_0x593ec6[_0x5d0c0[_0x5f50('0x14')]]=_0x184cbb[_0x5d0c0[_0x5f50('0x17')]][_0x5f50('0x15')]();}else if(_0x5d0c0['type']===_0x5f50('0x18')&&_0x5d0c0[_0x5f50('0x19')]&&_0x5d0c0[_0x5f50('0x19')]['name']&&_0x5d0c0['idField']&&_0x184cbb[_0x5d0c0[_0x5f50('0x19')]['name']['toLowerCase']()]){_0x593ec6[_0x5d0c0[_0x5f50('0x14')]]=_0x184cbb[_0x5d0c0[_0x5f50('0x19')][_0x5f50('0x1a')][_0x5f50('0x1b')]()][_0x5f50('0x15')]();}});}return _0x593ec6;}function getName(_0x81fe12){if(_0x81fe12['indexOf']('\x20')>0x0){var _0x208ea0=_0x81fe12[_0x5f50('0x1c')](/ (.+)/);if(_0x208ea0[0x1]){return _0x208ea0;}}return[_0x81fe12,_0x81fe12];}var accountsTokens={};function getAccessToken(_0x30cfcf){return new Promise(function(_0x287af5,_0xb436be){if(!_[_0x5f50('0x1d')](accountsTokens[_0x30cfcf['id']])&&!_['isNil'](accountsTokens[_0x30cfcf['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x30cfcf['id']][_0x5f50('0x1e')])){_0x287af5(accountsTokens[_0x30cfcf['id']][_0x5f50('0x1f')]);}}var _0x4c6d49;switch(_0x30cfcf[_0x5f50('0x20')]){case'US':_0x4c6d49=_0x5f50('0x21');break;case'AU':_0x4c6d49=_0x5f50('0x22');break;case'EU':_0x4c6d49=_0x5f50('0x23');break;case'IN':_0x4c6d49=_0x5f50('0x24');break;case'CN':_0x4c6d49=_0x5f50('0x25');break;default:_0x4c6d49='https://accounts.zoho.eu';break;}var _0x346a2d={'method':_0x5f50('0x26'),'uri':_0x4c6d49+_0x5f50('0x27'),'qs':{'refresh_token':_0x30cfcf[_0x5f50('0x28')],'client_id':_0x30cfcf[_0x5f50('0x29')],'client_secret':_0x30cfcf[_0x5f50('0x2a')],'grant_type':_0x5f50('0x2b')},'json':!![]};return rp(_0x346a2d)[_0x5f50('0x2c')](function(_0x4dda3a){accountsTokens[_0x30cfcf['id']]={'access_token':_0x4dda3a[_0x5f50('0x1f')],'expires_in':moment()['add'](_0x4dda3a[_0x5f50('0x1e')],_0x5f50('0x2d'))};_0x287af5(_0x4dda3a['access_token']);})['catch'](function(_0x3aa8e1){logger[_0x5f50('0x2e')](_0x5f50('0x2f'),_0x3aa8e1[_0x5f50('0x30')]);_0xb436be(_0x3aa8e1);});});}function getUser(_0xa1f83b,_0x3ac3fd,_0x2e31d7,_0x151e01){logger['info'](_0x5f50('0x31'));return request({'method':'GET','uri':util[_0x5f50('0x32')](_0x5f50('0x33'),_0x3ac3fd),'qs':{'type':_0x5f50('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xa1f83b},'json':!![]})[_0x5f50('0x2c')](function(_0x5c8c52){if(_0x5c8c52[_0x5f50('0x35')]){var _0x5cf945=-0x1;if(_[_0x5f50('0x36')](_0x5c8c52[_0x5f50('0x35')])){if(!_[_0x5f50('0x1d')](_0x151e01)){_0x5cf945=_['findIndex'](_0x5c8c52[_0x5f50('0x35')],function(_0xd849ef){return _0xd849ef['email']===_0x151e01;});}if(_0x5cf945>=0x0){logger[_0x5f50('0x37')](_0x5f50('0x38'));}else{logger[_0x5f50('0x37')](_0x5f50('0x39'));_0x5cf945=_['findIndex'](_0x5c8c52[_0x5f50('0x35')],function(_0x14eaa4){return _0x14eaa4[_0x5f50('0x3a')][_0x5f50('0x1a')]===_0x5f50('0x3b');});}return _0x5c8c52[_0x5f50('0x35')][_0x5cf945];}else{if(_0x5c8c52[_0x5f50('0x3c')]['profile'][_0x5f50('0x1a')]===_0x5f50('0x3b')){logger[_0x5f50('0x37')]('Using\x20the\x20admin\x20account!');user=_0x5c8c52[_0x5f50('0x3c')];return user;}else{logger[_0x5f50('0x2e')](_0x5f50('0x3d'),JSON[_0x5f50('0xf')](_0x5c8c52));throw new Error(_0x5f50('0x3e')+JSON[_0x5f50('0xf')](_0x5c8c52));}}}else{logger[_0x5f50('0x2e')](_0x5f50('0x3d'),JSON[_0x5f50('0xf')](_0x5c8c52));throw new Error(_0x5f50('0x3e')+JSON['stringify'](_0x5c8c52));}})[_0x5f50('0x3f')](function(_0x391735){console[_0x5f50('0x2e')](_0x391735);});}function getZohoUser(_0x5b46fa,_0x10a647){return new BPromise(function(_0x1a3d9c,_0x299c23){request(_0x5b46fa)[_0x5f50('0x2c')](function(_0x44a678){var _0x568a13=null;if(_0x44a678){_0x568a13=_0x44a678[_0x5f50('0x40')][0x0];_0x568a13[_0x5f50('0x41')]=_0x10a647;}_0x1a3d9c(_0x568a13);})['catch'](function(_0x328c73){_0x299c23(_0x328c73);});});}function createEndUser(_0x5f4ced,_0x2275f1,_0x21b47,_0x45c6ad,_0x159c55,_0x45ad18){var _0x21b47=getName(_0x21b47);return request({'method':'POST','uri':_0x5f50('0x42')+_0x2275f1+_0x5f50('0x43')+_[_0x5f50('0x44')](_0x45ad18[_0x5f50('0x45')])+'s','body':{'data':[{'Last_Name':_0x21b47[0x1],'First_Name':_0x21b47[0x0],'Phone':_0x45c6ad,'Owner':{'name':!_[_0x5f50('0x1d')](_0x159c55[_0x5f50('0x46')][_0x5f50('0x1a')])?_0x159c55[_0x5f50('0x46')][_0x5f50('0x1a')]:!_[_0x5f50('0x1d')](_0x159c55[_0x5f50('0x47')])?_0x159c55[_0x5f50('0x47')]+'\x20'+_0x159c55[_0x5f50('0x48')]:_0x159c55[_0x5f50('0x48')],'id':_0x159c55['id']}}]},'headers':{'Authorization':_0x5f50('0x49')+_0x5f4ced},'json':!![]})[_0x5f50('0x2c')](function(_0x4e4a0d){if(_0x4e4a0d&&_0x4e4a0d[_0x5f50('0x40')][0x0][_0x5f50('0x4a')]===_0x5f50('0x4b')){var _0x320d34=_0x4e4a0d[_0x5f50('0x40')][0x0][_0x5f50('0x4c')];_0x320d34[_0x5f50('0x41')]=_[_0x5f50('0x44')](_0x45ad18[_0x5f50('0x45')])+'s';return _0x320d34;}logger['error'](_0x5f50('0x3d'),JSON[_0x5f50('0xf')](data));throw new Error(_0x5f50('0x4d')+JSON['stringify'](data));})[_0x5f50('0x3f')](function(_0x1ab118){console[_0x5f50('0x4e')](_0x5f50('0x4f'),_0x1ab118);});}function getEndUser(_0x1787b2,_0xd7b976,_0x46ee80,_0x5a7aff,_0x258d87,_0x5229ec,_0x5c6668){var _0x4a8a7b={'method':_0x5f50('0x50'),'uri':'','headers':{'Authorization':_0x5f50('0x49')+_0x1787b2},'json':!![]};switch(_0x5c6668[_0x5f50('0x51')]){case _0x5f50('0x52'):_0x4a8a7b[_0x5f50('0x53')]='https://www.zohoapis.'+_0xd7b976+_0x5f50('0x54')+_0x258d87+'))';return getZohoUser(_0x4a8a7b,'Contacts')[_0x5f50('0x2c')](function(_0x503b64){if(_0x503b64)return _0x503b64;_0x4a8a7b['uri']=_0x5f50('0x42')+_0xd7b976+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x258d87+'))';return getZohoUser(_0x4a8a7b,_0x5f50('0x55'))[_0x5f50('0x2c')](function(_0x5c9292){if(_0x5c9292)return _0x5c9292;if(_0x5c6668[_0x5f50('0x45')]!=_0x5f50('0x56')){return createEndUser(_0x1787b2,_0xd7b976,_0x5a7aff,_0x258d87,_0x5229ec,_0x5c6668);}else{return{};}});});break;case'contact':_0x4a8a7b[_0x5f50('0x53')]=_0x5f50('0x42')+_0xd7b976+_0x5f50('0x54')+_0x258d87+'))';return getZohoUser(_0x4a8a7b,_0x5f50('0x57'))[_0x5f50('0x2c')](function(_0x598da2){if(_0x598da2)return _0x598da2;if(_0x5c6668[_0x5f50('0x45')]!=_0x5f50('0x56')){return createEndUser(_0x1787b2,_0xd7b976,_0x5a7aff,_0x258d87,_0x5229ec,_0x5c6668);}else{return{};}});break;case _0x5f50('0x58'):_0x4a8a7b[_0x5f50('0x53')]=_0x5f50('0x42')+_0xd7b976+_0x5f50('0x59')+_0x258d87+'))';return getZohoUser(_0x4a8a7b,_0x5f50('0x55'))[_0x5f50('0x2c')](function(_0x4aebb1){if(_0x4aebb1)return _0x4aebb1;if(_0x5c6668[_0x5f50('0x45')]!=_0x5f50('0x56')){return createEndUser(_0x1787b2,_0xd7b976,_0x5a7aff,_0x258d87,_0x5229ec,_0x5c6668);}else{return{};}});break;}}function getCall(_0x224cea,_0x588490,_0x42f4be,_0x53f337,_0x288324,_0x2ebbee,_0x2ad1ba,_0x356c28){logger[_0x5f50('0x37')](_0x5f50('0x5a'));var _0x5bd7a2={};_0x5bd7a2[_0x5f50('0x5b')]={'name':!_[_0x5f50('0x1d')](_0x53f337[_0x5f50('0x46')][_0x5f50('0x1a')])&&!_['isNil'](_0x53f337['profile'][_0x5f50('0x1a')])&&_0x53f337[_0x5f50('0x3a')]['name']===_0x5f50('0x5c')?_0x53f337[_0x5f50('0x46')][_0x5f50('0x1a')]:!_['isNil'](_0x53f337[_0x5f50('0x47')])?_0x53f337['first_name']+'\x20'+_0x53f337[_0x5f50('0x48')]:_0x53f337[_0x5f50('0x48')],'id':_0x53f337['id']};_0x5bd7a2[_0x5f50('0x5d')]=intUtil[_0x5f50('0x5e')](_0x2ebbee[_0x5f50('0x5f')],_0x2ad1ba,'\x20');_0x5bd7a2[_0x5f50('0x60')]=intUtil[_0x5f50('0x5e')](_0x2ebbee[_0x5f50('0x61')],_0x2ad1ba,'\x0a');if(_0x288324[_0x5f50('0x41')]===_0x5f50('0x57')){_0x5bd7a2[_0x5f50('0x62')]={'name':!_[_0x5f50('0x1d')](_0x288324['Full_Name'])?_0x288324['Full_Name']:!_[_0x5f50('0x1d')](_0x288324['First_Name'])?_0x288324[_0x5f50('0x63')]+'\x20'+_0x288324[_0x5f50('0x64')]:_0x288324[_0x5f50('0x64')],'id':_0x288324['id']};}if(_0x288324['enduserType']===_0x5f50('0x55')){_0x5bd7a2[_0x5f50('0x65')]={'name':!_[_0x5f50('0x1d')](_0x288324[_0x5f50('0x66')])?_0x288324[_0x5f50('0x66')]:!_[_0x5f50('0x1d')](_0x288324[_0x5f50('0x63')])?_0x288324[_0x5f50('0x63')]+'\x20'+_0x288324[_0x5f50('0x64')]:_0x288324[_0x5f50('0x64')],'id':_0x288324['id']};_0x5bd7a2[_0x5f50('0x67')]=_[_0x5f50('0x44')](_0x288324[_0x5f50('0x41')]);}if(_0x2ad1ba[_0x5f50('0x68')]){_0x5bd7a2['Call_Duration']=moment[_0x5f50('0x69')](parseInt(_0x2ad1ba['talktime'])*0x3e8)[_0x5f50('0x32')](_0x5f50('0x6a'));}else if(_0x2ad1ba[_0x5f50('0x6b')]&&_0x2ad1ba[_0x5f50('0x6c')]){_0x5bd7a2[_0x5f50('0x6d')]=moment['utc'](moment(_0x2ad1ba[_0x5f50('0x6c')],_0x5f50('0x6e'))[_0x5f50('0x6f')](moment(_0x2ad1ba[_0x5f50('0x70')],_0x5f50('0x6e'))))[_0x5f50('0x32')](_0x5f50('0x6a'));}switch(_0x2ad1ba[_0x5f50('0x71')]){case _0x5f50('0x72'):_0x5bd7a2[_0x5f50('0x73')]='Called';break;case _0x5f50('0x74'):case _0x5f50('0x75'):_0x5bd7a2['Call_Result']=_0x5f50('0x76');break;case'rejected':_0x5bd7a2[_0x5f50('0x73')]=_0x5f50('0x77');break;case _0x5f50('0x78'):_0x5bd7a2[_0x5f50('0x73')]=_0x5f50('0x79');break;case _0x5f50('0x7a'):_0x5bd7a2['Call_Result']=_0x5f50('0x7b');default:}_0x5bd7a2['Call_Start_Time']=(_0x356c28===_0x5f50('0x7c')?moment(_0x2ad1ba['starttime'])[_0x5f50('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x2ad1ba[_0x5f50('0x7d')])['format'](_0x5f50('0x6e')))||moment()[_0x5f50('0x32')](_0x5f50('0x6e'));_0x5bd7a2['Call_Type']=_0x356c28||_0x5f50('0x7e');_0x5bd7a2=_['merge'](_0x5bd7a2,getCustomFields(_0x2ebbee[_0x5f50('0x7f')],_0x2ad1ba));return request({'method':_0x5f50('0x26'),'uri':'https://www.zohoapis.'+_0x588490+_0x5f50('0x80'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x224cea},'body':{'data':[_0x5bd7a2]},'json':!![]})[_0x5f50('0x2c')](function(_0x474355){if(_0x474355&&_0x474355[_0x5f50('0x40')][0x0]['code']===_0x5f50('0x4b')){logger[_0x5f50('0x37')](_0x5f50('0x81'));return{'id':_0x474355[_0x5f50('0x40')][0x0][_0x5f50('0x4c')]['id']};}})[_0x5f50('0x3f')](function(_0x45a2f0){logger['info'](_0x5f50('0x82'),_0x45a2f0[_0x5f50('0x30')]);console['log']('err',_0x45a2f0);});}exports[_0x5f50('0x83')]=function(_0x5d892e,_0x2b2266,_0x28bd2c,_0x48598e,_0x502a1a,_0x12459b){var _0x543b66,_0x628683,_0x1ac3c6;_0x12459b[_0x5f50('0x84')]=intUtil[_0x5f50('0x85')](_0x12459b[_0x5f50('0x84')]);_0x12459b[_0x5f50('0x86')]=intUtil['stripTrailingSlash'](_0x12459b[_0x5f50('0x86')]);if(_0x502a1a&&_0x502a1a['monitor_format']){logger[_0x5f50('0x37')](_0x5f50('0x87'),_0x5f50('0x88'));_0x2b2266['recordingURL']=_0x12459b[_0x5f50('0x86')]+_0x5f50('0x89')+_0x2b2266['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x2b2266[_0x5f50('0x8a')]);}else{_0x2b2266[_0x5f50('0x8b')]='';}var _0x2d6340=_0x12459b[_0x5f50('0x84')]===_0x5f50('0x8c')?'eu':_0x5f50('0x8d');return getAccessToken(_0x12459b)[_0x5f50('0x2c')](function(_0x3c4223){_0x1ac3c6=_0x3c4223;return getUser(_0x1ac3c6,_0x2d6340,_0x12459b,_0x48598e[_0x5f50('0x8e')]);})[_0x5f50('0x2c')](function(_0xc74a4b){_0x543b66=_0xc74a4b;logger[_0x5f50('0x37')](_0x5f50('0x8f'),_0x543b66['id']);return getEndUser(_0x1ac3c6,_0x2d6340,_0x12459b,_0x2b2266[_0x5f50('0x90')],_0x2b2266[_0x5f50('0x91')],_0x543b66,_0x28bd2c);})[_0x5f50('0x2c')](function(_0x1282eb){_0x628683=_0x1282eb;return getCall(_0x1ac3c6,_0x2d6340,_0x12459b,_0x543b66,_0x628683,_0x28bd2c,_0x2b2266,_0x5f50('0x7e'));})[_0x5f50('0x2c')](function(_0x309778){if(_0x309778){logger[_0x5f50('0x37')]('The\x20Call\x20ID\x20is:',_0x309778['id']);logger['info'](_0x5f50('0x87'),_0x5f50('0x92'));emit(util[_0x5f50('0x32')](_0x5f50('0x93'),_0x48598e[_0x5f50('0x1a')]),_0x5f50('0x94'),{'uri':_0x5f50('0x95')+_0x12459b[_0x5f50('0x84')]+_0x5f50('0x96')+_0x309778['id']});}})[_0x5f50('0x3f')](function(_0x10394a){logger[_0x5f50('0x2e')](_0x5f50('0x87'),JSON['stringify'](_0x10394a));});};exports[_0x5f50('0x7c')]=function(_0x40c402,_0x354d94,_0x487efe,_0x35e69e,_0x3773e4,_0x327c51,_0x5ebc14){var _0x189b10,_0x5c39cd,_0x1091f4;_0x327c51[_0x5f50('0x84')]=intUtil[_0x5f50('0x85')](_0x327c51[_0x5f50('0x84')]);_0x327c51[_0x5f50('0x86')]=intUtil['stripTrailingSlash'](_0x327c51[_0x5f50('0x86')]);if(_0x5ebc14&&_0x5ebc14[_0x5f50('0x97')]&&_0x5ebc14[_0x5f50('0x97')]!==_0x5f50('0x98')){logger[_0x5f50('0x37')]('[OUTBOUND]',_0x5f50('0x88'));_0x354d94[_0x5f50('0x8b')]=_0x327c51[_0x5f50('0x86')]+_0x5f50('0x89')+_0x354d94[_0x5f50('0x8a')]+_0x5f50('0x99')+md5(_0x354d94[_0x5f50('0x8a')]);}var _0x4f50d2=_0x327c51['host']===_0x5f50('0x8c')?'eu':_0x5f50('0x8d');return getAccessToken(_0x327c51)[_0x5f50('0x2c')](function(_0x451906){_0x1091f4=_0x451906;return getUser(_0x1091f4,_0x4f50d2,_0x327c51,_0x35e69e['email']);})[_0x5f50('0x2c')](function(_0xa95179){_0x189b10=_0xa95179;logger[_0x5f50('0x37')](_0x5f50('0x8f'),_0x189b10['id']);return getEndUser(_0x1091f4,_0x4f50d2,_0x327c51,_0x354d94['destcalleridname'],_0x354d94[_0x5f50('0x9a')],_0x189b10,_0x487efe);})[_0x5f50('0x2c')](function(_0x278aea){_0x5c39cd=_0x278aea;return getCall(_0x1091f4,_0x4f50d2,_0x327c51,_0x189b10,_0x5c39cd,_0x487efe,_0x354d94,_0x5f50('0x9b'));})[_0x5f50('0x2c')](function(_0x3efa0b){if(_0x3efa0b){logger[_0x5f50('0x37')](_0x5f50('0x9c'),_0x3efa0b['id']);logger[_0x5f50('0x37')](_0x5f50('0x9d'),_0x5f50('0x92'));emit(util['format']('user:%s',_0x35e69e[_0x5f50('0x1a')]),'trigger:browser:url',{'uri':_0x5f50('0x95')+_0x327c51[_0x5f50('0x84')]+_0x5f50('0x96')+_0x3efa0b['id']});}})['catch'](function(_0x3adc27){logger[_0x5f50('0x2e')]('[OUTBOUND]',JSON[_0x5f50('0xf')](_0x3adc27));});};exports[_0x5f50('0x9e')]=function(_0x4b788f,_0x351d7f,_0x40a1b9,_0x251038,_0x3eb7bb,_0x50cdbd){var _0x53bac8,_0x37cc85,_0x2fb5fe;_0x50cdbd['host']=intUtil[_0x5f50('0x85')](_0x50cdbd[_0x5f50('0x84')]);_0x50cdbd['serverUrl']=intUtil['stripTrailingSlash'](_0x50cdbd['serverUrl']);if(_0x3eb7bb&&_0x3eb7bb[_0x5f50('0x9f')]){logger[_0x5f50('0x37')]('['+_0x351d7f['lastevent'][_0x5f50('0xa0')]()+']',_0x5f50('0x88'));_0x351d7f[_0x5f50('0x8b')]=_0x50cdbd[_0x5f50('0x86')]+_0x5f50('0x89')+_0x351d7f[_0x5f50('0x8a')]+_0x5f50('0x99')+md5(_0x351d7f[_0x5f50('0x8a')]);}else{_0x351d7f[_0x5f50('0x8b')]='';}var _0x5d5764=_0x50cdbd[_0x5f50('0x84')]==='zoho.eu'?'eu':_0x5f50('0x8d');return getAccessToken(_0x50cdbd)[_0x5f50('0x2c')](function(_0x2e8902){_0x2fb5fe=_0x2e8902;return getUser(_0x2fb5fe,_0x5d5764,_0x50cdbd);})[_0x5f50('0x2c')](function(_0x5a8554){_0x53bac8=_0x5a8554;logger[_0x5f50('0x37')]('The\x20User\x20ID\x20is:',_0x53bac8['id']);return getEndUser(_0x2fb5fe,_0x5d5764,_0x50cdbd,_0x351d7f['calleridname'],_0x351d7f[_0x5f50('0x91')],_0x53bac8,_0x40a1b9);})[_0x5f50('0x2c')](function(_0x256470){_0x37cc85=_0x256470;return getCall(_0x2fb5fe,_0x5d5764,_0x50cdbd,_0x53bac8,_0x37cc85,_0x40a1b9,_0x351d7f,'Inbound');})[_0x5f50('0x2c')](function(_0x16647f){if(_0x16647f){logger[_0x5f50('0x37')]('The\x20Call\x20ID\x20is:',_0x16647f['id']);}})['catch'](function(_0x3df080){logger[_0x5f50('0x2e')]('['+_0x351d7f[_0x5f50('0x71')][_0x5f50('0xa0')]()+']',JSON[_0x5f50('0xf')](_0x3df080));});}; \ No newline at end of file +var _0xc411=['defaults','localhost','socket.io-emitter','emit','[HTTP]','forEach','includes','string','picklist','type','idField','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','info','Administrator','user','profile','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','code','SUCCESS','details','log','contact_lead','uri','Leads','nothing','contact','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','last_name','Subject','Subjects','Description','getString','Descriptions','Contacts','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','Call_Result','connect','Answered','abandoned','Abandoned','timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/downloads?type=uniqueid&token=','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/logger','redis'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc411,0x1b4));var _0x1c41=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0xc411[_0x41ee16];return _0x1f60de;};'use strict';var _=require('lodash');var rp=require(_0x1c41('0x0'));var md5=require(_0x1c41('0x1'));var util=require(_0x1c41('0x2'));var intUtil=require(_0x1c41('0x3'));var moment=require('moment');var Redis=require(_0x1c41('0x4'));var BPromise=require(_0x1c41('0x5'));var config=require('../../../../config/environment');var logger=require(_0x1c41('0x6'))('zoho');config[_0x1c41('0x7')]=_[_0x1c41('0x8')](config[_0x1c41('0x7')],{'host':_0x1c41('0x9'),'port':0x18eb});var io=require(_0x1c41('0xa'))(new Redis(config[_0x1c41('0x7')]));function emit(_0x23bca9,_0x258829,_0x2b1186){io['to'](_0x23bca9)[_0x1c41('0xb')](_0x258829,_0x2b1186);}function request(_0x128e04){logger['debug'](_0x1c41('0xc'),JSON['stringify'](_0x128e04));return rp(_0x128e04);}function getCustomFields(_0x705e4e,_0x48ddfe){var _0x403088={};if(_0x705e4e['length']>0x0){_[_0x1c41('0xd')](_0x705e4e,function(_0x13fb8c){if(_[_0x1c41('0xe')]([_0x1c41('0xf'),_0x1c41('0x10')],_0x13fb8c[_0x1c41('0x11')])&&_0x13fb8c[_0x1c41('0x12')]){_0x403088[_0x13fb8c[_0x1c41('0x12')]]=_0x13fb8c['content'][_0x1c41('0x13')]();}else if(_0x13fb8c[_0x1c41('0x11')]===_0x1c41('0x14')&&_0x13fb8c[_0x1c41('0x15')]&&_0x13fb8c['idField']&&_0x48ddfe[_0x13fb8c['variableName']]){_0x403088[_0x13fb8c['idField']]=_0x48ddfe[_0x13fb8c['variableName']][_0x1c41('0x13')]();}else if(_0x13fb8c['type']==='customVariable'&&_0x13fb8c[_0x1c41('0x16')]&&_0x13fb8c[_0x1c41('0x16')]['name']&&_0x13fb8c[_0x1c41('0x12')]&&_0x48ddfe[_0x13fb8c[_0x1c41('0x16')][_0x1c41('0x17')][_0x1c41('0x18')]()]){_0x403088[_0x13fb8c[_0x1c41('0x12')]]=_0x48ddfe[_0x13fb8c['Variable'][_0x1c41('0x17')][_0x1c41('0x18')]()][_0x1c41('0x13')]();}});}return _0x403088;}function getName(_0x11bea9){if(_0x11bea9[_0x1c41('0x19')]('\x20')>0x0){var _0x2922e8=_0x11bea9[_0x1c41('0x1a')](/ (.+)/);if(_0x2922e8[0x1]){return _0x2922e8;}}return[_0x11bea9,_0x11bea9];}var accountsTokens={};function getAccessToken(_0x4537f4){return new Promise(function(_0x1c9d30,_0x2c9d01){if(!_[_0x1c41('0x1b')](accountsTokens[_0x4537f4['id']])&&!_['isNil'](accountsTokens[_0x4537f4['id']][_0x1c41('0x1c')])){if(moment()[_0x1c41('0x1d')](accountsTokens[_0x4537f4['id']][_0x1c41('0x1e')])){_0x1c9d30(accountsTokens[_0x4537f4['id']][_0x1c41('0x1c')]);}}var _0x792ebb;switch(_0x4537f4[_0x1c41('0x1f')]){case'US':_0x792ebb=_0x1c41('0x20');break;case'AU':_0x792ebb='https://accounts.zoho.com.au';break;case'EU':_0x792ebb=_0x1c41('0x21');break;case'IN':_0x792ebb=_0x1c41('0x22');break;case'CN':_0x792ebb=_0x1c41('0x23');break;default:_0x792ebb=_0x1c41('0x21');break;}var _0x4b46af={'method':_0x1c41('0x24'),'uri':_0x792ebb+'/oauth/v2/token','qs':{'refresh_token':_0x4537f4[_0x1c41('0x25')],'client_id':_0x4537f4[_0x1c41('0x26')],'client_secret':_0x4537f4[_0x1c41('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4b46af)[_0x1c41('0x28')](function(_0x54b6e2){accountsTokens[_0x4537f4['id']]={'access_token':_0x54b6e2[_0x1c41('0x1c')],'expires_in':moment()['add'](_0x54b6e2[_0x1c41('0x1e')],_0x1c41('0x29'))};_0x1c9d30(_0x54b6e2[_0x1c41('0x1c')]);})[_0x1c41('0x2a')](function(_0x574c1d){logger[_0x1c41('0x2b')](_0x1c41('0x2c'),_0x574c1d['stack']);_0x2c9d01(_0x574c1d);});});}function getUser(_0x4237ca,_0x460cb8,_0x10dfb2,_0x1c35bf){logger['info'](_0x1c41('0x2d'));return request({'method':_0x1c41('0x2e'),'uri':util['format'](_0x1c41('0x2f'),_0x460cb8),'qs':{'type':_0x1c41('0x30')},'headers':{'Authorization':_0x1c41('0x31')+_0x4237ca},'json':!![]})[_0x1c41('0x28')](function(_0x59f85d){if(_0x59f85d[_0x1c41('0x32')]){var _0x454da5=-0x1;if(_[_0x1c41('0x33')](_0x59f85d[_0x1c41('0x32')])){if(!_[_0x1c41('0x1b')](_0x1c35bf)){_0x454da5=_[_0x1c41('0x34')](_0x59f85d['users'],function(_0x130df3){return _0x130df3['email']===_0x1c35bf;});}if(_0x454da5>=0x0){logger['info'](_0x1c41('0x35'));}else{logger[_0x1c41('0x36')]('Using\x20the\x20admin\x20account!');_0x454da5=_[_0x1c41('0x34')](_0x59f85d['users'],function(_0x285ef1){return _0x285ef1['profile'][_0x1c41('0x17')]===_0x1c41('0x37');});}return _0x59f85d['users'][_0x454da5];}else{if(_0x59f85d[_0x1c41('0x38')][_0x1c41('0x39')]['name']===_0x1c41('0x37')){logger[_0x1c41('0x36')](_0x1c41('0x3a'));user=_0x59f85d[_0x1c41('0x38')];return user;}else{logger[_0x1c41('0x2b')](_0x1c41('0x3b'),JSON[_0x1c41('0x3c')](_0x59f85d));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x1c41('0x3c')](_0x59f85d));}}}else{logger['error'](_0x1c41('0x3b'),JSON[_0x1c41('0x3c')](_0x59f85d));throw new Error(_0x1c41('0x3d')+JSON[_0x1c41('0x3c')](_0x59f85d));}})[_0x1c41('0x2a')](function(_0xb7233c){console[_0x1c41('0x2b')](_0xb7233c);});}function getZohoUser(_0x263444,_0x1d1b1f){return new BPromise(function(_0x567d76,_0xf6d797){request(_0x263444)[_0x1c41('0x28')](function(_0x2a67c2){var _0x437c8b=null;if(_0x2a67c2){_0x437c8b=_0x2a67c2[_0x1c41('0x3e')][0x0];_0x437c8b[_0x1c41('0x3f')]=_0x1d1b1f;}_0x567d76(_0x437c8b);})[_0x1c41('0x2a')](function(_0x111000){_0xf6d797(_0x111000);});});}function createEndUser(_0x4095c1,_0x3eab5e,_0x191785,_0x24a53d,_0x148676,_0xf530a1){var _0x191785=getName(_0x191785);return request({'method':_0x1c41('0x24'),'uri':'https://www.zohoapis.'+_0x3eab5e+_0x1c41('0x40')+_[_0x1c41('0x41')](_0xf530a1[_0x1c41('0x42')])+'s','body':{'data':[{'Last_Name':_0x191785[0x1],'First_Name':_0x191785[0x0],'Phone':_0x24a53d,'Owner':{'name':!_[_0x1c41('0x1b')](_0x148676[_0x1c41('0x43')][_0x1c41('0x17')])?_0x148676['role'][_0x1c41('0x17')]:!_[_0x1c41('0x1b')](_0x148676[_0x1c41('0x44')])?_0x148676[_0x1c41('0x44')]+'\x20'+_0x148676['last_name']:_0x148676['last_name'],'id':_0x148676['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4095c1},'json':!![]})[_0x1c41('0x28')](function(_0x5db160){if(_0x5db160&&_0x5db160[_0x1c41('0x3e')][0x0][_0x1c41('0x45')]===_0x1c41('0x46')){var _0x21382f=_0x5db160[_0x1c41('0x3e')][0x0][_0x1c41('0x47')];_0x21382f[_0x1c41('0x3f')]=_[_0x1c41('0x41')](_0xf530a1['moduleCreate'])+'s';return _0x21382f;}logger['error'](_0x1c41('0x3b'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x1c41('0x3c')](data));})[_0x1c41('0x2a')](function(_0x6ceac9){console[_0x1c41('0x48')]('CREATE\x20ERROR',_0x6ceac9);});}function getEndUser(_0xce318c,_0x578426,_0x595667,_0x29b76b,_0xe7eeea,_0x2f463d,_0x294ad9){var _0x411fd2={'method':_0x1c41('0x2e'),'uri':'','headers':{'Authorization':_0x1c41('0x31')+_0xce318c},'json':!![]};switch(_0x294ad9['moduleSearch']){case _0x1c41('0x49'):_0x411fd2['uri']='https://www.zohoapis.'+_0x578426+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xe7eeea+'))';return getZohoUser(_0x411fd2,'Contacts')['then'](function(_0x523012){if(_0x523012)return _0x523012;_0x411fd2[_0x1c41('0x4a')]='https://www.zohoapis.'+_0x578426+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xe7eeea+'))';return getZohoUser(_0x411fd2,_0x1c41('0x4b'))[_0x1c41('0x28')](function(_0x4a668f){if(_0x4a668f)return _0x4a668f;if(_0x294ad9[_0x1c41('0x42')]!=_0x1c41('0x4c')){return createEndUser(_0xce318c,_0x578426,_0x29b76b,_0xe7eeea,_0x2f463d,_0x294ad9);}else{return{};}});});break;case _0x1c41('0x4d'):_0x411fd2[_0x1c41('0x4a')]=_0x1c41('0x4e')+_0x578426+_0x1c41('0x4f')+_0xe7eeea+'))';return getZohoUser(_0x411fd2,'Contacts')[_0x1c41('0x28')](function(_0x334afb){if(_0x334afb)return _0x334afb;if(_0x294ad9[_0x1c41('0x42')]!=_0x1c41('0x4c')){return createEndUser(_0xce318c,_0x578426,_0x29b76b,_0xe7eeea,_0x2f463d,_0x294ad9);}else{return{};}});break;case'lead':_0x411fd2['uri']='https://www.zohoapis.'+_0x578426+_0x1c41('0x50')+_0xe7eeea+'))';return getZohoUser(_0x411fd2,_0x1c41('0x4b'))[_0x1c41('0x28')](function(_0x3ca837){if(_0x3ca837)return _0x3ca837;if(_0x294ad9['moduleCreate']!=_0x1c41('0x4c')){return createEndUser(_0xce318c,_0x578426,_0x29b76b,_0xe7eeea,_0x2f463d,_0x294ad9);}else{return{};}});break;}}function getCall(_0x2fd130,_0x33bdff,_0xa062a4,_0xb6e81f,_0x36fcaf,_0x1bb7d3,_0x1111f5,_0x44f56c){logger[_0x1c41('0x36')](_0x1c41('0x51'));var _0x5d7b13={};_0x5d7b13['Owner']={'name':!_[_0x1c41('0x1b')](_0xb6e81f[_0x1c41('0x43')][_0x1c41('0x17')])&&!_[_0x1c41('0x1b')](_0xb6e81f[_0x1c41('0x39')][_0x1c41('0x17')])&&_0xb6e81f['profile']['name']==='administrator'?_0xb6e81f[_0x1c41('0x43')][_0x1c41('0x17')]:!_[_0x1c41('0x1b')](_0xb6e81f['first_name'])?_0xb6e81f[_0x1c41('0x44')]+'\x20'+_0xb6e81f[_0x1c41('0x52')]:_0xb6e81f[_0x1c41('0x52')],'id':_0xb6e81f['id']};_0x5d7b13[_0x1c41('0x53')]=intUtil['getString'](_0x1bb7d3[_0x1c41('0x54')],_0x1111f5,'\x20');_0x5d7b13[_0x1c41('0x55')]=intUtil[_0x1c41('0x56')](_0x1bb7d3[_0x1c41('0x57')],_0x1111f5,'\x0a');if(_0x36fcaf['enduserType']===_0x1c41('0x58')){_0x5d7b13['Who_Id']={'name':!_[_0x1c41('0x1b')](_0x36fcaf[_0x1c41('0x59')])?_0x36fcaf[_0x1c41('0x59')]:!_[_0x1c41('0x1b')](_0x36fcaf[_0x1c41('0x5a')])?_0x36fcaf[_0x1c41('0x5a')]+'\x20'+_0x36fcaf[_0x1c41('0x5b')]:_0x36fcaf[_0x1c41('0x5b')],'id':_0x36fcaf['id']};}if(_0x36fcaf[_0x1c41('0x3f')]===_0x1c41('0x4b')){_0x5d7b13['What_Id']={'name':!_['isNil'](_0x36fcaf[_0x1c41('0x59')])?_0x36fcaf['Full_Name']:!_[_0x1c41('0x1b')](_0x36fcaf[_0x1c41('0x5a')])?_0x36fcaf['First_Name']+'\x20'+_0x36fcaf[_0x1c41('0x5b')]:_0x36fcaf[_0x1c41('0x5b')],'id':_0x36fcaf['id']};_0x5d7b13[_0x1c41('0x5c')]=_['startCase'](_0x36fcaf[_0x1c41('0x3f')]);}if(_0x1111f5[_0x1c41('0x5d')]){_0x5d7b13[_0x1c41('0x5e')]=moment[_0x1c41('0x5f')](parseInt(_0x1111f5[_0x1c41('0x5d')])*0x3e8)[_0x1c41('0x60')](_0x1c41('0x61'));}else if(_0x1111f5[_0x1c41('0x62')]&&_0x1111f5[_0x1c41('0x63')]){_0x5d7b13[_0x1c41('0x5e')]=moment[_0x1c41('0x5f')](moment(_0x1111f5[_0x1c41('0x63')],_0x1c41('0x64'))[_0x1c41('0x65')](moment(_0x1111f5[_0x1c41('0x66')],_0x1c41('0x64'))))[_0x1c41('0x60')]('mm:ss');}switch(_0x1111f5['lastevent']){case'called':_0x5d7b13[_0x1c41('0x67')]='Called';break;case'complete':case _0x1c41('0x68'):_0x5d7b13['Call_Result']=_0x1c41('0x69');break;case'rejected':_0x5d7b13[_0x1c41('0x67')]='Rejected';break;case _0x1c41('0x6a'):_0x5d7b13[_0x1c41('0x67')]=_0x1c41('0x6b');break;case _0x1c41('0x6c'):_0x5d7b13[_0x1c41('0x67')]='Timeout';default:}_0x5d7b13['Call_Start_Time']=(_0x44f56c===_0x1c41('0x6d')?moment(_0x1111f5['starttime'])[_0x1c41('0x60')](_0x1c41('0x64')):moment(_0x1111f5[_0x1c41('0x6e')])[_0x1c41('0x60')](_0x1c41('0x64')))||moment()[_0x1c41('0x60')]('YYYY-MM-DDTHH:mm:ss');_0x5d7b13[_0x1c41('0x6f')]=_0x44f56c||_0x1c41('0x70');_0x5d7b13=_[_0x1c41('0x71')](_0x5d7b13,getCustomFields(_0x1bb7d3['Fields'],_0x1111f5));return request({'method':_0x1c41('0x24'),'uri':_0x1c41('0x4e')+_0x33bdff+_0x1c41('0x72'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2fd130},'body':{'data':[_0x5d7b13]},'json':!![]})[_0x1c41('0x28')](function(_0x1859ad){if(_0x1859ad&&_0x1859ad['data'][0x0]['code']===_0x1c41('0x46')){logger[_0x1c41('0x36')](_0x1c41('0x73'));return{'id':_0x1859ad[_0x1c41('0x3e')][0x0][_0x1c41('0x47')]['id']};}})[_0x1c41('0x2a')](function(_0x115b67){logger['info'](_0x1c41('0x74'),_0x115b67[_0x1c41('0x75')]);console[_0x1c41('0x48')]('err',_0x115b67);});}exports[_0x1c41('0x76')]=function(_0x2f3f6e,_0x591b7d,_0x4a6e88,_0x3196ef,_0x5d7555,_0x35b410){var _0x1be399,_0x304f09,_0x515a53;_0x35b410[_0x1c41('0x77')]=intUtil[_0x1c41('0x78')](_0x35b410['host']);_0x35b410[_0x1c41('0x79')]=intUtil[_0x1c41('0x78')](_0x35b410[_0x1c41('0x79')]);if(_0x5d7555&&_0x5d7555['monitor_format']){logger['info'](_0x1c41('0x7a'),'Recording\x20is\x20enabled!');_0x591b7d[_0x1c41('0x7b')]=_0x35b410['serverUrl']+_0x1c41('0x7c')+_0x591b7d[_0x1c41('0x7d')]+'/downloads?type=uniqueid&token='+md5(_0x591b7d[_0x1c41('0x7d')]);}else{_0x591b7d[_0x1c41('0x7b')]='';}var _0xd7136e=_0x35b410['host']===_0x1c41('0x7e')?'eu':_0x1c41('0x7f');return getAccessToken(_0x35b410)[_0x1c41('0x28')](function(_0x3d54e8){_0x515a53=_0x3d54e8;return getUser(_0x515a53,_0xd7136e,_0x35b410,_0x3196ef['email']);})[_0x1c41('0x28')](function(_0x199010){_0x1be399=_0x199010;logger[_0x1c41('0x36')]('The\x20User\x20ID\x20is:',_0x1be399['id']);return getEndUser(_0x515a53,_0xd7136e,_0x35b410,_0x591b7d[_0x1c41('0x80')],_0x591b7d[_0x1c41('0x81')],_0x1be399,_0x4a6e88);})[_0x1c41('0x28')](function(_0x199a01){_0x304f09=_0x199a01;return getCall(_0x515a53,_0xd7136e,_0x35b410,_0x1be399,_0x304f09,_0x4a6e88,_0x591b7d,_0x1c41('0x70'));})['then'](function(_0x266c10){if(_0x266c10){logger[_0x1c41('0x36')](_0x1c41('0x82'),_0x266c10['id']);logger['info'](_0x1c41('0x7a'),_0x1c41('0x83'));emit(util[_0x1c41('0x60')]('user:%s',_0x3196ef[_0x1c41('0x17')]),_0x1c41('0x84'),{'uri':_0x1c41('0x85')+_0x35b410[_0x1c41('0x77')]+_0x1c41('0x86')+_0x266c10['id']});}})[_0x1c41('0x2a')](function(_0x3022fd){logger[_0x1c41('0x2b')](_0x1c41('0x7a'),JSON[_0x1c41('0x3c')](_0x3022fd));});};exports[_0x1c41('0x6d')]=function(_0x316eff,_0x586576,_0x56b983,_0x1cb9ce,_0x46d997,_0xaabbe8,_0x499f4a){var _0x33d7aa,_0x5c5ada,_0x42c100;_0xaabbe8[_0x1c41('0x77')]=intUtil[_0x1c41('0x78')](_0xaabbe8['host']);_0xaabbe8['serverUrl']=intUtil[_0x1c41('0x78')](_0xaabbe8[_0x1c41('0x79')]);if(_0x499f4a&&_0x499f4a[_0x1c41('0x87')]&&_0x499f4a[_0x1c41('0x87')]!==_0x1c41('0x88')){logger[_0x1c41('0x36')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x586576[_0x1c41('0x7b')]=_0xaabbe8[_0x1c41('0x79')]+'/api/voice/recordings/'+_0x586576['uniqueid']+_0x1c41('0x89')+md5(_0x586576[_0x1c41('0x7d')]);}var _0x312870=_0xaabbe8['host']===_0x1c41('0x7e')?'eu':_0x1c41('0x7f');return getAccessToken(_0xaabbe8)[_0x1c41('0x28')](function(_0x2d2a8f){_0x42c100=_0x2d2a8f;return getUser(_0x42c100,_0x312870,_0xaabbe8,_0x1cb9ce[_0x1c41('0x8a')]);})['then'](function(_0x5881f6){_0x33d7aa=_0x5881f6;logger[_0x1c41('0x36')](_0x1c41('0x8b'),_0x33d7aa['id']);return getEndUser(_0x42c100,_0x312870,_0xaabbe8,_0x586576[_0x1c41('0x8c')],_0x586576[_0x1c41('0x8d')],_0x33d7aa,_0x56b983);})[_0x1c41('0x28')](function(_0x2fb03e){_0x5c5ada=_0x2fb03e;return getCall(_0x42c100,_0x312870,_0xaabbe8,_0x33d7aa,_0x5c5ada,_0x56b983,_0x586576,_0x1c41('0x8e'));})[_0x1c41('0x28')](function(_0x496205){if(_0x496205){logger[_0x1c41('0x36')](_0x1c41('0x82'),_0x496205['id']);logger['info'](_0x1c41('0x8f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1c41('0x60')]('user:%s',_0x1cb9ce[_0x1c41('0x17')]),_0x1c41('0x84'),{'uri':_0x1c41('0x85')+_0xaabbe8[_0x1c41('0x77')]+_0x1c41('0x86')+_0x496205['id']});}})[_0x1c41('0x2a')](function(_0x96c19){logger[_0x1c41('0x2b')](_0x1c41('0x8f'),JSON[_0x1c41('0x3c')](_0x96c19));});};exports['unmanaged']=function(_0x2f5248,_0x650b55,_0x5c5116,_0x595ea5,_0x524a4c,_0x573b54){var _0x3dc3b3,_0xd314f9,_0x2a877e;_0x573b54['host']=intUtil[_0x1c41('0x78')](_0x573b54[_0x1c41('0x77')]);_0x573b54[_0x1c41('0x79')]=intUtil[_0x1c41('0x78')](_0x573b54['serverUrl']);if(_0x524a4c&&_0x524a4c[_0x1c41('0x90')]){logger['info']('['+_0x650b55[_0x1c41('0x91')][_0x1c41('0x92')]()+']',_0x1c41('0x93'));_0x650b55[_0x1c41('0x7b')]=_0x573b54[_0x1c41('0x79')]+_0x1c41('0x7c')+_0x650b55[_0x1c41('0x7d')]+_0x1c41('0x89')+md5(_0x650b55[_0x1c41('0x7d')]);}else{_0x650b55['recordingURL']='';}var _0x4b468d=_0x573b54[_0x1c41('0x77')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x573b54)[_0x1c41('0x28')](function(_0x3fbde2){_0x2a877e=_0x3fbde2;return getUser(_0x2a877e,_0x4b468d,_0x573b54);})[_0x1c41('0x28')](function(_0x2a0980){_0x3dc3b3=_0x2a0980;logger['info']('The\x20User\x20ID\x20is:',_0x3dc3b3['id']);return getEndUser(_0x2a877e,_0x4b468d,_0x573b54,_0x650b55[_0x1c41('0x80')],_0x650b55['calleridnum'],_0x3dc3b3,_0x5c5116);})[_0x1c41('0x28')](function(_0x57ba20){_0xd314f9=_0x57ba20;return getCall(_0x2a877e,_0x4b468d,_0x573b54,_0x3dc3b3,_0xd314f9,_0x5c5116,_0x650b55,'Inbound');})[_0x1c41('0x28')](function(_0x34bf8c){if(_0x34bf8c){logger[_0x1c41('0x36')](_0x1c41('0x82'),_0x34bf8c['id']);}})['catch'](function(_0x305da6){logger['error']('['+_0x650b55[_0x1c41('0x91')][_0x1c41('0x92')]()+']',JSON[_0x1c41('0x3c')](_0x305da6));});}; \ 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 2263845..4386980 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 _0xe676=['data2','data3','render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','shelljs','../../../../config/logger'];(function(_0x49b27e,_0x527d7a){var _0x112144=function(_0x209e70){while(--_0x209e70){_0x49b27e['push'](_0x49b27e['shift']());}};_0x112144(++_0x527d7a);}(_0xe676,0x85));var _0x6e67=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xe676[_0x172747];return _0x509692;};'use strict';var util=require('util');var sh=require(_0x6e67('0x0'));var Mustache=require('mustache');var logger=require(_0x6e67('0x1'))('trigger');exports['exec']=function(_0x28d2e7,_0x19f9aa){var _0x29e34f=_0x28d2e7[_0x6e67('0x2')]?_0x28d2e7[_0x6e67('0x2')]:'Script';var _0x4b0e33=_0x28d2e7[_0x6e67('0x3')]?Mustache[_0x6e67('0x4')](_0x28d2e7[_0x6e67('0x3')],_0x19f9aa):_0x19f9aa;sh[_0x6e67('0x5')](_0x4b0e33,function(_0x26874d,_0x59cb18,_0x214494){if(_0x26874d!==0x0){logger[_0x6e67('0x6')](util[_0x6e67('0x7')](_0x6e67('0x8'),_0x29e34f,_0x4b0e33,_0x26874d,_0x214494));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x29e34f,_0x4b0e33,_0x59cb18));}});}; \ No newline at end of file +var _0x45f7=['trigger','data2','Script','data3','render','exec','info','format','shelljs','mustache','../../../../config/logger'];(function(_0x41cb4b,_0x200468){var _0x1719c1=function(_0x53ad61){while(--_0x53ad61){_0x41cb4b['push'](_0x41cb4b['shift']());}};_0x1719c1(++_0x200468);}(_0x45f7,0x19f));var _0x745f=function(_0xc7348b,_0x145880){_0xc7348b=_0xc7348b-0x0;var _0x307cec=_0x45f7[_0xc7348b];return _0x307cec;};'use strict';var util=require('util');var sh=require(_0x745f('0x0'));var Mustache=require(_0x745f('0x1'));var logger=require(_0x745f('0x2'))(_0x745f('0x3'));exports['exec']=function(_0x3bd7eb,_0x249623){var _0x4abe83=_0x3bd7eb[_0x745f('0x4')]?_0x3bd7eb[_0x745f('0x4')]:_0x745f('0x5');var _0x5170b5=_0x3bd7eb[_0x745f('0x6')]?Mustache[_0x745f('0x7')](_0x3bd7eb[_0x745f('0x6')],_0x249623):_0x249623;sh[_0x745f('0x8')](_0x5170b5,function(_0x51773d,_0x44d33c,_0x539ef5){if(_0x51773d!==0x0){logger['error'](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x4abe83,_0x5170b5,_0x51773d,_0x539ef5));}else{logger[_0x745f('0x9')](util[_0x745f('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4abe83,_0x5170b5,_0x44d33c));}});}; \ 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 3238c3c..ce7cb29 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 _0xb81c=['POST','PUT','data7','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','trigger','exec','data1','render','data2','data5','number','data6','parse','error','stack','toUpperCase','GET','DELETE'];(function(_0x3919ed,_0x5b640b){var _0x87d716=function(_0xb97ece){while(--_0xb97ece){_0x3919ed['push'](_0x3919ed['shift']());}};_0x87d716(++_0x5b640b);}(_0xb81c,0x164));var _0xcb81=function(_0x109520,_0x5d2d1b){_0x109520=_0x109520-0x0;var _0x4b06b9=_0xb81c[_0x109520];return _0x4b06b9;};'use strict';var rp=require(_0xcb81('0x0'));var util=require(_0xcb81('0x1'));var _=require(_0xcb81('0x2'));var Mustache=require(_0xcb81('0x3'));var logger=require('../../../../config/logger')(_0xcb81('0x4'));exports[_0xcb81('0x5')]=function(_0x1325ff,_0x5dfb1f){var _0x3c460f,_0x522b56;var _0x2e8ada={'method':_0x1325ff[_0xcb81('0x6')]['toUpperCase'](),'uri':Mustache[_0xcb81('0x7')](_0x1325ff[_0xcb81('0x8')],_0x5dfb1f),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1325ff[_0xcb81('0x9')])===_0xcb81('0xa')&&parseInt(_0x1325ff[_0xcb81('0x9')])>=0x1&&parseInt(_0x1325ff['data5'])<=0xa?parseInt(_0x1325ff['data5'])*0x3e8:0x5*0x3e8};try{_0x2e8ada['headers']=_0x1325ff[_0xcb81('0xb')]?JSON[_0xcb81('0xc')](Mustache['render'](_0x1325ff[_0xcb81('0xb')],_0x5dfb1f)):{};}catch(_0x689b50){logger[_0xcb81('0xd')](_0x689b50[_0xcb81('0xe')]);}switch(_0x1325ff[_0xcb81('0x6')][_0xcb81('0xf')]()){case _0xcb81('0x10'):case _0xcb81('0x11'):_0x3c460f=null;_0x2e8ada['qs']=_0x5dfb1f;break;case _0xcb81('0x12'):case _0xcb81('0x13'):if(_0x1325ff[_0xcb81('0x14')]){try{_0x3c460f=JSON[_0xcb81('0xc')](Mustache[_0xcb81('0x7')](_0x1325ff[_0xcb81('0x14')],_0x5dfb1f));_0x2e8ada['body']=_0x3c460f;}catch(_0x5dbb31){logger['error'](_0x5dbb31[_0xcb81('0xe')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x3c460f=_0x5dfb1f;_0x2e8ada[_0xcb81('0x15')]=_0x3c460f;}break;}logger[_0xcb81('0x16')](util[_0xcb81('0x17')](_0xcb81('0x18'),_0x1325ff[_0xcb81('0x6')],_0x1325ff[_0xcb81('0x8')],JSON['stringify'](_0x2e8ada)));rp(_0x2e8ada)[_0xcb81('0x19')](function(_0x559bee){_0x3c460f=!_[_0xcb81('0x1a')](_0x3c460f)?_0xcb81('0x1b')+_0x3c460f:'';_0x522b56=typeof _0x559bee['body']==='object'?JSON[_0xcb81('0x1c')](_0x559bee[_0xcb81('0x15')]):_0x559bee[_0xcb81('0x15')];logger['info'](util['format'](_0xcb81('0x1d'),_0x1325ff[_0xcb81('0x6')],_0x1325ff['data2'],_0x559bee[_0xcb81('0x1e')],_0x522b56));})['catch'](function(_0x2912c2){logger['error'](util['format'](_0xcb81('0x1f'),_0x1325ff[_0xcb81('0x6')],_0x1325ff[_0xcb81('0x8')],_0x2912c2[_0xcb81('0x1e')],_0x2912c2[_0xcb81('0x20')],_0x2912c2[_0xcb81('0x21')]));});}; \ No newline at end of file +var _0x2d77=['mustache','trigger','data1','render','data2','number','data5','headers','parse','data6','error','toUpperCase','DELETE','POST','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','lodash'];(function(_0x27b528,_0x20ab53){var _0x5bf4da=function(_0xb1c7c){while(--_0xb1c7c){_0x27b528['push'](_0x27b528['shift']());}};_0x5bf4da(++_0x20ab53);}(_0x2d77,0xf7));var _0x72d7=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x2d77[_0x5c351c];return _0x26f3b3;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x72d7('0x0'));var Mustache=require(_0x72d7('0x1'));var logger=require('../../../../config/logger')(_0x72d7('0x2'));exports['exec']=function(_0x2367a6,_0x4ccce1){var _0x523389,_0x5829ac;var _0x594305={'method':_0x2367a6[_0x72d7('0x3')]['toUpperCase'](),'uri':Mustache[_0x72d7('0x4')](_0x2367a6[_0x72d7('0x5')],_0x4ccce1),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2367a6['data5'])===_0x72d7('0x6')&&parseInt(_0x2367a6[_0x72d7('0x7')])>=0x1&&parseInt(_0x2367a6['data5'])<=0xa?parseInt(_0x2367a6['data5'])*0x3e8:0x5*0x3e8};try{_0x594305[_0x72d7('0x8')]=_0x2367a6['data6']?JSON[_0x72d7('0x9')](Mustache['render'](_0x2367a6[_0x72d7('0xa')],_0x4ccce1)):{};}catch(_0x4fbd22){logger[_0x72d7('0xb')](_0x4fbd22['stack']);}switch(_0x2367a6['data1'][_0x72d7('0xc')]()){case'GET':case _0x72d7('0xd'):_0x523389=null;_0x594305['qs']=_0x4ccce1;break;case _0x72d7('0xe'):case _0x72d7('0xf'):if(_0x2367a6[_0x72d7('0x10')]){try{_0x523389=JSON[_0x72d7('0x9')](Mustache[_0x72d7('0x4')](_0x2367a6['data7'],_0x4ccce1));_0x594305[_0x72d7('0x11')]=_0x523389;}catch(_0xa0d530){logger[_0x72d7('0xb')](_0xa0d530[_0x72d7('0x12')]);logger[_0x72d7('0xb')](_0x72d7('0x13'));}}else{_0x523389=_0x4ccce1;_0x594305[_0x72d7('0x11')]=_0x523389;}break;}logger[_0x72d7('0x14')](util[_0x72d7('0x15')](_0x72d7('0x16'),_0x2367a6[_0x72d7('0x3')],_0x2367a6[_0x72d7('0x5')],JSON[_0x72d7('0x17')](_0x594305)));rp(_0x594305)[_0x72d7('0x18')](function(_0xa22f92){_0x523389=!_[_0x72d7('0x19')](_0x523389)?_0x72d7('0x1a')+_0x523389:'';_0x5829ac=typeof _0xa22f92[_0x72d7('0x11')]==='object'?JSON[_0x72d7('0x17')](_0xa22f92['body']):_0xa22f92[_0x72d7('0x11')];logger['info'](util[_0x72d7('0x15')](_0x72d7('0x1b'),_0x2367a6[_0x72d7('0x3')],_0x2367a6[_0x72d7('0x5')],_0xa22f92[_0x72d7('0x1c')],_0x5829ac));})['catch'](function(_0x1a197f){logger[_0x72d7('0xb')](util[_0x72d7('0x15')](_0x72d7('0x1d'),_0x2367a6[_0x72d7('0x3')],_0x2367a6[_0x72d7('0x5')],_0x1a197f[_0x72d7('0x1c')],_0x1a197f['name'],_0x1a197f[_0x72d7('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index ea5caa7..4af6bae 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 _0xe0a6=['debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then'];(function(_0x4a4b60,_0x2ce8ad){var _0x501fc4=function(_0x39c428){while(--_0x39c428){_0x4a4b60['push'](_0x4a4b60['shift']());}};_0x501fc4(++_0x2ce8ad);}(_0xe0a6,0x114));var _0x6e0a=function(_0xa53f5f,_0x339ebe){_0xa53f5f=_0xa53f5f-0x0;var _0x18b241=_0xe0a6[_0xa53f5f];return _0x18b241;};'use strict';var jayson=require(_0x6e0a('0x0'));var BPromise=require(_0x6e0a('0x1'));var logger=require(_0x6e0a('0x2'))(_0x6e0a('0x3'));var client=jayson[_0x6e0a('0x4')][_0x6e0a('0x5')]({'port':0x2329});client[_0x6e0a('0x6')]=function(_0x542f2c,_0x23d3a4){return new BPromise(function(_0x4961d8,_0x24af43){return client[_0x6e0a('0x7')](_0x542f2c,_0x23d3a4)[_0x6e0a('0x8')](function(_0x441866){logger[_0x6e0a('0x9')](_0x6e0a('0xa'),_0x6e0a('0x3'),_0x542f2c,_0x23d3a4,_0x441866);if(_0x441866[_0x6e0a('0xb')]){logger[_0x6e0a('0xb')](_0x6e0a('0xa'),'routing',_0x542f2c,_0x441866[_0x6e0a('0xb')]['message'],_0x23d3a4);return _0x24af43(_0x441866[_0x6e0a('0xb')][_0x6e0a('0xc')]);}else{return _0x4961d8(_0x441866[_0x6e0a('0xd')]);}})[_0x6e0a('0xe')](function(_0x471a3d){logger['error'](_0x6e0a('0xa'),_0x6e0a('0x3'),_0x542f2c,_0x471a3d,_0x23d3a4);return _0x24af43(_0x471a3d);});});};module['exports']=client; \ No newline at end of file +var _0x743a=['Request','request','then','debug','error','rpc','message','result','catch','exports','bluebird','../../config/logger','routing','client','http'];(function(_0x4b5aaa,_0x1308b6){var _0x46f9aa=function(_0x40be44){while(--_0x40be44){_0x4b5aaa['push'](_0x4b5aaa['shift']());}};_0x46f9aa(++_0x1308b6);}(_0x743a,0x181));var _0xa743=function(_0x14c5f2,_0x2c4449){_0x14c5f2=_0x14c5f2-0x0;var _0x2cfd14=_0x743a[_0x14c5f2];return _0x2cfd14;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa743('0x0'));var logger=require(_0xa743('0x1'))(_0xa743('0x2'));var client=jayson[_0xa743('0x3')][_0xa743('0x4')]({'port':0x2329});client[_0xa743('0x5')]=function(_0x403496,_0x1d5885){return new BPromise(function(_0x5a5664,_0x422295){return client[_0xa743('0x6')](_0x403496,_0x1d5885)[_0xa743('0x7')](function(_0x387d99){logger[_0xa743('0x8')]('rpc','routing',_0x403496,_0x1d5885,_0x387d99);if(_0x387d99[_0xa743('0x9')]){logger[_0xa743('0x9')](_0xa743('0xa'),'routing',_0x403496,_0x387d99[_0xa743('0x9')][_0xa743('0xb')],_0x1d5885);return _0x422295(_0x387d99[_0xa743('0x9')]['message']);}else{return _0x5a5664(_0x387d99[_0xa743('0xc')]);}})[_0xa743('0xd')](function(_0x1bbb1a){logger[_0xa743('0x9')](_0xa743('0xa'),_0xa743('0x2'),_0x403496,_0x1bbb1a,_0x1d5885);return _0x422295(_0x1bbb1a);});});};module[_0xa743('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 52a9870..5bdfa4c 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 _0x0bad=['then','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./realtime','../../config/logger','email'];(function(_0x1d196b,_0x1e4a01){var _0x23b6ae=function(_0x5cf9f1){while(--_0x5cf9f1){_0x1d196b['push'](_0x1d196b['shift']());}};_0x23b6ae(++_0x1e4a01);}(_0x0bad,0x17e));var _0xd0ba=function(_0x43a5ec,_0x2d24ea){_0x43a5ec=_0x43a5ec-0x0;var _0x60c3f9=_0x0bad[_0x43a5ec];return _0x60c3f9;};'use strict';var server=require('./server');var Realtime=require(_0xd0ba('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0xd0ba('0x1'))(_0xd0ba('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xd0ba('0x3')](mailAccount['getMailAccounts']())[_0xd0ba('0x3')](realtime['initMailAccounts']())[_0xd0ba('0x3')](function(){email[_0xd0ba('0x4')](realtime[_0xd0ba('0x5')]);return realtime;});}function main(){return server[_0xd0ba('0x6')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xd0ba('0x7')]();})['then'](function(_0x2cc925){return setInterval(initRealtime,_0x2cc925[_0xd0ba('0x8')]*0x3e8);})[_0xd0ba('0x9')](function(_0x136ba9){logger['error'](_0xd0ba('0xa'),_0x136ba9);});}main(); \ No newline at end of file +var _0x6889=['getMailAccounts','refresh','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','../../config/logger','email','resolve','then'];(function(_0x1fe6c2,_0xfbc822){var _0x417fa4=function(_0x19f28a){while(--_0x19f28a){_0x1fe6c2['push'](_0x1fe6c2['shift']());}};_0x417fa4(++_0xfbc822);}(_0x6889,0xd9));var _0x9688=function(_0x2f1ebe,_0x2e340a){_0x2f1ebe=_0x2f1ebe-0x0;var _0x522491=_0x6889[_0x2f1ebe];return _0x522491;};'use strict';var server=require(_0x9688('0x0'));var Realtime=require(_0x9688('0x1'));var EmailChannel=require(_0x9688('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x9688('0x3'));var logger=require(_0x9688('0x4'))(_0x9688('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x9688('0x6')]()[_0x9688('0x7')](mailAccount[_0x9688('0x8')]())[_0x9688('0x7')](realtime['initMailAccounts']())[_0x9688('0x7')](function(){email[_0x9688('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x9688('0xa')](realtime,email)[_0x9688('0x7')](function(){return initRealtime();})[_0x9688('0x7')](function(){return setting[_0x9688('0xb')]();})[_0x9688('0x7')](function(_0x45ec5f){return setInterval(initRealtime,_0x45ec5f[_0x9688('0xc')]*0x3e8);})['catch'](function(_0x4c272f){logger[_0x9688('0xd')](_0x9688('0xe'),_0x4c272f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 4c0b28d..d4e14dd 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 _0x592a=['notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','Smtp','verified','verify','exports','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','prototype','refresh','hasOwnProperty','service','custom','provider','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','connected','messages','from'];(function(_0x3e7dd5,_0x5e6857){var _0x815404=function(_0x179abe){while(--_0x179abe){_0x3e7dd5['push'](_0x3e7dd5['shift']());}};_0x815404(++_0x5e6857);}(_0x592a,0x17e));var _0xa592=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x592a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xa592('0x0'));var md5=require(_0xa592('0x1'));var Redis=require(_0xa592('0x2'));var config=require(_0xa592('0x3'));var logger=require(_0xa592('0x4'))(_0xa592('0x5'));config[_0xa592('0x6')]=_[_0xa592('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa592('0x8'))(new Redis(config[_0xa592('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xa592('0x9'));var mailAccount=require(_0xa592('0xa'));var md5Accounts={};function EmailChannel(_0x15cf85){logger[_0xa592('0xb')]('start\x20email\x20channel');this[_0xa592('0xc')]=_0x15cf85[_0xa592('0xc')];this[_0xa592('0xd')]={};this[_0xa592('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0xa592('0xf')]=function(_0x93b424){var _0x2583a1=this[_0xa592('0xc')][_0x93b424];var _0x1890b0={'id':_0x2583a1['id'],'name':_0x2583a1[_0xa592('0x10')],'key':_0x2583a1[_0xa592('0x11')],'active':_0x2583a1[_0xa592('0x12')],'Imap':{'status':_0x2583a1[_0xa592('0x13')][_0xa592('0x14')],'messageStatus':_0x2583a1[_0xa592('0x13')][_0xa592('0x15')],'total':_0x2583a1[_0xa592('0x13')][_0xa592('0x16')]}};if(_['isNil'](md5Accounts[_0x93b424])){md5Accounts[_0x93b424]={};}var _0x32badf=md5(JSON['stringify'](_0x1890b0));if(md5Accounts[_0x93b424][_0xa592('0x1')]!==_0x32badf){md5Accounts[_0x93b424][_0xa592('0x1')]=_0x32badf;io[_0xa592('0xf')]('mailAccount:update',_0x1890b0);}};EmailChannel[_0xa592('0x17')][_0xa592('0x18')]=function(_0x4f3f7f){for(var _0x2b34fe in _0x4f3f7f){if(_0x4f3f7f[_0xa592('0x19')](_0x2b34fe)){if(_0x4f3f7f[_0x2b34fe][_0xa592('0x13')]&&_0x4f3f7f[_0x2b34fe][_0xa592('0x12')]){var _0x244ac3=_0x4f3f7f[_0x2b34fe][_0xa592('0x13')];if(!_0x244ac3[_0xa592('0x1a')]&&_0x4f3f7f[_0x2b34fe]['provider']!==_0xa592('0x1b'))_0x244ac3['service']=_0x4f3f7f[_0x2b34fe][_0xa592('0x1c')];if(!this[_0xa592('0xd')][_0xa592('0x19')](_0x244ac3['id'])){this[_0xa592('0xd')][_0x244ac3['id']]=new EmailImap(_0x244ac3,_0x4f3f7f[_0x2b34fe][_0xa592('0x5')]);this['imapAccounts'][_0x244ac3['id']]['on'](_0xa592('0x1d'),this[_0xa592('0x1e')][_0xa592('0x1f')](this,_0x2b34fe));this[_0xa592('0xd')][_0x244ac3['id']]['on'](_0xa592('0x5'),this[_0xa592('0x20')][_0xa592('0x1f')](this,_0x2b34fe));this[_0xa592('0xd')][_0x244ac3['id']]['on'](_0xa592('0x21'),this[_0xa592('0x22')]['bind'](this,_0x2b34fe));this['imapAccounts'][_0x244ac3['id']]['on'](_0xa592('0x23'),this[_0xa592('0x24')]['bind'](this,_0x2b34fe));}}else{if(_[_0xa592('0x25')](this[_0xa592('0xc')][_0x2b34fe]['Imap'])){this[_0xa592('0xc')][_0x2b34fe][_0xa592('0x13')]={};}this[_0xa592('0xc')][_0x2b34fe][_0xa592('0x13')]['status']=_0xa592('0x26');this[_0xa592('0xc')][_0x2b34fe][_0xa592('0x13')]['messageStatus']='';this['emit'](_0x2b34fe);}}}};EmailChannel[_0xa592('0x17')][_0xa592('0x1e')]=function(_0x2435c9,_0x2db7dc){if(this[_0xa592('0xc')][_0x2435c9]){this[_0xa592('0xc')][_0x2435c9][_0xa592('0x13')]['status']=_0xa592('0x27');this[_0xa592('0xc')][_0x2435c9]['Imap'][_0xa592('0x15')]=_0x2db7dc[_0xa592('0x10')];if(_0x2db7dc[_0xa592('0x28')]){this['mailAccounts'][_0x2435c9][_0xa592('0x13')][_0xa592('0x16')]=_0x2db7dc[_0xa592('0x28')][_0xa592('0x16')];}return this['emit'](_0x2435c9);}};EmailChannel[_0xa592('0x17')]['handleImapEmail']=function(_0x5de0c0,_0x118f42){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x118f42['firstName'],_0x118f42['lastName'],_0x118f42[_0xa592('0x29')],_0x5de0c0);if(this[_0xa592('0xc')][_0x5de0c0]){return mailAccount[_0xa592('0x2a')](_0x5de0c0,_0x118f42)[_0xa592('0x2b')](function(_0x4b0fff){if(_0x4b0fff){logger[_0xa592('0xb')](_0xa592('0x2c'));}})['catch'](function(_0x3fc15b){logger[_0xa592('0x23')](_0xa592('0x2d'),JSON[_0xa592('0x2e')](_0x3fc15b));});}};EmailChannel[_0xa592('0x17')][_0xa592('0x22')]=function(_0x34a733){if(this[_0xa592('0xc')][_0x34a733]&&this[_0xa592('0xc')][_0x34a733][_0xa592('0x13')]){if(this[_0xa592('0xd')][this[_0xa592('0xc')][_0x34a733][_0xa592('0x13')]['id']]){delete this[_0xa592('0xd')][this['mailAccounts'][_0x34a733][_0xa592('0x13')]['id']];}this[_0xa592('0xc')][_0x34a733][_0xa592('0x13')][_0xa592('0x2f')]=moment();this[_0xa592('0xf')](_0x34a733);}};EmailChannel['prototype'][_0xa592('0x24')]=function(_0x3ed3d7,_0x5985f8){if(this[_0xa592('0xc')][_0x3ed3d7]){this[_0xa592('0xc')][_0x3ed3d7][_0xa592('0x13')][_0xa592('0x14')]='error';this[_0xa592('0xc')][_0x3ed3d7][_0xa592('0x13')][_0xa592('0x15')]=_0x5985f8;return this['emit'](_0x3ed3d7);}};EmailChannel[_0xa592('0x17')][_0xa592('0x30')]=function(_0x2080a5,_0xacf4bd){return this[_0xa592('0xe')]['send'](_0x2080a5,_0xacf4bd);};EmailChannel['prototype']['verifySmtp']=function(_0x57f42a){var _0x4b045e=this;if(this[_0xa592('0xc')][_0x57f42a['id']]){if(_[_0xa592('0x25')](this[_0xa592('0xc')][_0x57f42a['id']][_0xa592('0x31')])){this[_0xa592('0xc')][_0x57f42a['id']][_0xa592('0x31')]={};}this[_0xa592('0xc')][_0x57f42a['id']][_0xa592('0x31')][_0xa592('0x2f')]=moment();return new BPromise(function(_0x3bd556,_0xc2cece){return _0x4b045e[_0xa592('0xe')]['verify'](_0x57f42a)[_0xa592('0x2b')](function(_0x2c5ea4){_0x4b045e[_0xa592('0xc')][_0x57f42a['id']]['Smtp'][_0xa592('0x14')]=_0xa592('0x32');_0x4b045e[_0xa592('0xc')][_0x57f42a['id']][_0xa592('0x31')]['messageStatus']='';_0x4b045e[_0xa592('0xf')](_0x57f42a['id']);_0x3bd556(_0x2c5ea4);})['catch'](function(_0x40e364){_0x4b045e[_0xa592('0xc')][_0x57f42a['id']][_0xa592('0x31')][_0xa592('0x14')]='error';_0x4b045e[_0xa592('0xc')][_0x57f42a['id']]['Smtp']['messageStatus']=_0x40e364;_0x4b045e[_0xa592('0xf')](_0x57f42a['id']);_0xc2cece(_0x40e364);});});}return this['smtp'][_0xa592('0x33')](_0x57f42a);};module[_0xa592('0x34')]=EmailChannel; \ No newline at end of file +var _0x5e59=['mailAccounts','imapAccounts','smtp','prototype','emit','name','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','hasOwnProperty','active','service','provider','custom','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','verifySmtp','Smtp','verify','verified','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./smtp','start\x20email\x20channel'];(function(_0x13a293,_0x350e61){var _0x2dc554=function(_0x576499){while(--_0x576499){_0x13a293['push'](_0x13a293['shift']());}};_0x2dc554(++_0x350e61);}(_0x5e59,0xf9));var _0x95e5=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x5e59[_0x328534];return _0x2796c0;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x95e5('0x0'));var md5=require(_0x95e5('0x1'));var Redis=require(_0x95e5('0x2'));var config=require(_0x95e5('0x3'));var logger=require('../../../config/logger')(_0x95e5('0x4'));config[_0x95e5('0x5')]=_[_0x95e5('0x6')](config[_0x95e5('0x5')],{'host':_0x95e5('0x7'),'port':0x18eb});var io=require(_0x95e5('0x8'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x95e5('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3281bd){logger['info'](_0x95e5('0xa'));this[_0x95e5('0xb')]=_0x3281bd[_0x95e5('0xb')];this[_0x95e5('0xc')]={};this[_0x95e5('0xd')]=new EmailSmtp();}EmailChannel[_0x95e5('0xe')][_0x95e5('0xf')]=function(_0x3579ea){var _0x2f14df=this[_0x95e5('0xb')][_0x3579ea];var _0x209b8c={'id':_0x2f14df['id'],'name':_0x2f14df[_0x95e5('0x10')],'key':_0x2f14df['key'],'active':_0x2f14df['active'],'Imap':{'status':_0x2f14df[_0x95e5('0x11')][_0x95e5('0x12')],'messageStatus':_0x2f14df[_0x95e5('0x11')][_0x95e5('0x13')],'total':_0x2f14df[_0x95e5('0x11')][_0x95e5('0x14')]}};if(_[_0x95e5('0x15')](md5Accounts[_0x3579ea])){md5Accounts[_0x3579ea]={};}var _0x5bb103=md5(JSON[_0x95e5('0x16')](_0x209b8c));if(md5Accounts[_0x3579ea][_0x95e5('0x1')]!==_0x5bb103){md5Accounts[_0x3579ea][_0x95e5('0x1')]=_0x5bb103;io[_0x95e5('0xf')](_0x95e5('0x17'),_0x209b8c);}};EmailChannel[_0x95e5('0xe')]['refresh']=function(_0x496593){for(var _0xa925be in _0x496593){if(_0x496593[_0x95e5('0x18')](_0xa925be)){if(_0x496593[_0xa925be][_0x95e5('0x11')]&&_0x496593[_0xa925be][_0x95e5('0x19')]){var _0x21402d=_0x496593[_0xa925be]['Imap'];if(!_0x21402d[_0x95e5('0x1a')]&&_0x496593[_0xa925be][_0x95e5('0x1b')]!==_0x95e5('0x1c'))_0x21402d[_0x95e5('0x1a')]=_0x496593[_0xa925be][_0x95e5('0x1b')];if(!this[_0x95e5('0xc')][_0x95e5('0x18')](_0x21402d['id'])){this[_0x95e5('0xc')][_0x21402d['id']]=new EmailImap(_0x21402d,_0x496593[_0xa925be]['email']);this[_0x95e5('0xc')][_0x21402d['id']]['on']('box',this[_0x95e5('0x1d')]['bind'](this,_0xa925be));this[_0x95e5('0xc')][_0x21402d['id']]['on'](_0x95e5('0x4'),this[_0x95e5('0x1e')][_0x95e5('0x1f')](this,_0xa925be));this[_0x95e5('0xc')][_0x21402d['id']]['on'](_0x95e5('0x20'),this[_0x95e5('0x21')][_0x95e5('0x1f')](this,_0xa925be));this[_0x95e5('0xc')][_0x21402d['id']]['on'](_0x95e5('0x22'),this['handleImapError']['bind'](this,_0xa925be));}}else{if(_[_0x95e5('0x15')](this['mailAccounts'][_0xa925be][_0x95e5('0x11')])){this['mailAccounts'][_0xa925be][_0x95e5('0x11')]={};}this[_0x95e5('0xb')][_0xa925be]['Imap'][_0x95e5('0x12')]=_0x95e5('0x23');this[_0x95e5('0xb')][_0xa925be]['Imap'][_0x95e5('0x13')]='';this[_0x95e5('0xf')](_0xa925be);}}}};EmailChannel['prototype'][_0x95e5('0x1d')]=function(_0x41438e,_0x162841){if(this['mailAccounts'][_0x41438e]){this[_0x95e5('0xb')][_0x41438e][_0x95e5('0x11')]['status']=_0x95e5('0x24');this[_0x95e5('0xb')][_0x41438e][_0x95e5('0x11')][_0x95e5('0x13')]=_0x162841[_0x95e5('0x10')];if(_0x162841['messages']){this[_0x95e5('0xb')][_0x41438e][_0x95e5('0x11')][_0x95e5('0x14')]=_0x162841[_0x95e5('0x25')][_0x95e5('0x14')];}return this[_0x95e5('0xf')](_0x41438e);}};EmailChannel[_0x95e5('0xe')][_0x95e5('0x1e')]=function(_0x2f8c30,_0x14fe02){logger['info'](_0x95e5('0x26'),_0x14fe02[_0x95e5('0x27')],_0x14fe02[_0x95e5('0x28')],_0x14fe02['from'],_0x2f8c30);if(this[_0x95e5('0xb')][_0x2f8c30]){return mailAccount['notify'](_0x2f8c30,_0x14fe02)[_0x95e5('0x29')](function(_0x2c90fd){if(_0x2c90fd){logger[_0x95e5('0x2a')](_0x95e5('0x2b'));}})[_0x95e5('0x2c')](function(_0x2c0bd6){logger[_0x95e5('0x22')](_0x95e5('0x2d'),JSON[_0x95e5('0x16')](_0x2c0bd6));});}};EmailChannel[_0x95e5('0xe')][_0x95e5('0x21')]=function(_0x1e5872){if(this[_0x95e5('0xb')][_0x1e5872]&&this[_0x95e5('0xb')][_0x1e5872][_0x95e5('0x11')]){if(this[_0x95e5('0xc')][this[_0x95e5('0xb')][_0x1e5872][_0x95e5('0x11')]['id']]){delete this[_0x95e5('0xc')][this[_0x95e5('0xb')][_0x1e5872][_0x95e5('0x11')]['id']];}this[_0x95e5('0xb')][_0x1e5872]['Imap'][_0x95e5('0x2e')]=moment();this[_0x95e5('0xf')](_0x1e5872);}};EmailChannel[_0x95e5('0xe')][_0x95e5('0x2f')]=function(_0x136e26,_0x13088b){if(this[_0x95e5('0xb')][_0x136e26]){this[_0x95e5('0xb')][_0x136e26][_0x95e5('0x11')][_0x95e5('0x12')]='error';this['mailAccounts'][_0x136e26][_0x95e5('0x11')][_0x95e5('0x13')]=_0x13088b;return this[_0x95e5('0xf')](_0x136e26);}};EmailChannel[_0x95e5('0xe')]['sendMail']=function(_0x76e43e,_0x3c1b2f){return this[_0x95e5('0xd')]['send'](_0x76e43e,_0x3c1b2f);};EmailChannel[_0x95e5('0xe')][_0x95e5('0x30')]=function(_0x1df4f2){var _0x204a9d=this;if(this[_0x95e5('0xb')][_0x1df4f2['id']]){if(_['isNil'](this[_0x95e5('0xb')][_0x1df4f2['id']][_0x95e5('0x31')])){this['mailAccounts'][_0x1df4f2['id']][_0x95e5('0x31')]={};}this['mailAccounts'][_0x1df4f2['id']][_0x95e5('0x31')][_0x95e5('0x2e')]=moment();return new BPromise(function(_0x2393e8,_0x32baf7){return _0x204a9d[_0x95e5('0xd')][_0x95e5('0x32')](_0x1df4f2)['then'](function(_0x5150eb){_0x204a9d[_0x95e5('0xb')][_0x1df4f2['id']]['Smtp'][_0x95e5('0x12')]=_0x95e5('0x33');_0x204a9d[_0x95e5('0xb')][_0x1df4f2['id']]['Smtp'][_0x95e5('0x13')]='';_0x204a9d['emit'](_0x1df4f2['id']);_0x2393e8(_0x5150eb);})[_0x95e5('0x2c')](function(_0x3933c1){_0x204a9d['mailAccounts'][_0x1df4f2['id']]['Smtp'][_0x95e5('0x12')]=_0x95e5('0x22');_0x204a9d[_0x95e5('0xb')][_0x1df4f2['id']][_0x95e5('0x31')][_0x95e5('0x13')]=_0x3933c1;_0x204a9d[_0x95e5('0xf')](_0x1df4f2['id']);_0x32baf7(_0x3933c1);});});}return this[_0x95e5('0xd')][_0x95e5('0x32')](_0x1df4f2);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f52c68f..469d9d9 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 _0xd2ab=['prototype','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleError','UNSEEN','handleReadUnseen','length','fetch','slice','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','html','parser','warn','\x20bytes,\x20email\x20size:\x20','\x20bytes','\x20[Email\x20text\x20truncated\x20because\x20size\x20more\x20than\x20','\x20bytes]','substring','text','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','iconv','events','EventEmitter','./utils','../../../config/logger','email','../../../config/environment','emailMaxHTMLbytesLimit','mailbox','account','getAccount','once','ready','handleReady','end','handleEnd','bind','error','connect','inherits'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2ab,0x10d));var _0xbd2a=function(_0x4d79d4,_0x15d0f9){_0x4d79d4=_0x4d79d4-0x0;var _0x183551=_0xd2ab[_0x4d79d4];return _0x183551;};'use strict';var _=require(_0xbd2a('0x0'));var util=require(_0xbd2a('0x1'));var Imap=require(_0xbd2a('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0xbd2a('0x3'))['Iconv'];var EventEmitter=require(_0xbd2a('0x4'))[_0xbd2a('0x5')];var utils=require(_0xbd2a('0x6'));var logger=require(_0xbd2a('0x7'))(_0xbd2a('0x8'));var config=require(_0xbd2a('0x9'));const MAX_HTML_BYTES_SIZE=config[_0xbd2a('0xa')]||0xee6b2800;function EmailImap(_0xc94f2,_0x2d1a11){this[_0xbd2a('0xb')]=_0xc94f2[_0xbd2a('0xb')];this[_0xbd2a('0xc')]=this[_0xbd2a('0xd')](_0xc94f2,_0x2d1a11);this[_0xbd2a('0x2')]=new Imap(this[_0xbd2a('0xc')]);this[_0xbd2a('0x2')][_0xbd2a('0xe')](_0xbd2a('0xf'),this[_0xbd2a('0x10')]['bind'](this));this['imap']['once'](_0xbd2a('0x11'),this[_0xbd2a('0x12')][_0xbd2a('0x13')](this));this[_0xbd2a('0x2')]['on'](_0xbd2a('0x14'),this['handleError']['bind'](this));this[_0xbd2a('0x2')][_0xbd2a('0x15')]();}util[_0xbd2a('0x16')](EmailImap,EventEmitter);EmailImap[_0xbd2a('0x17')][_0xbd2a('0xd')]=function(_0x107fc6,_0x2af2a4){var _0x3e7a89={'connTimeout':_0x107fc6['connTimeout']?_0x107fc6['connTimeout']*0x3e8:0x2710,'authTimeout':_0x107fc6['authTimeout']?_0x107fc6[_0xbd2a('0x18')]*0x3e8:0x1388};if(_0x107fc6[_0xbd2a('0x19')]){_0x3e7a89[_0xbd2a('0x1a')]=_0x107fc6['user'];if(_0x107fc6[_0xbd2a('0x1b')]){_0x3e7a89['xoauth2']=utils[_0xbd2a('0x1c')](_0x107fc6['CloudProvider'][_0xbd2a('0x1d')],_0x107fc6[_0xbd2a('0x1a')]);}else{_0x3e7a89[_0xbd2a('0x1e')]=_0x107fc6[_0xbd2a('0x1e')];}}else{if(_0x107fc6[_0xbd2a('0x1f')]){_0x3e7a89[_0xbd2a('0x1a')]=_0x107fc6[_0xbd2a('0x1a')];_0x3e7a89[_0xbd2a('0x1e')]=_0x107fc6[_0xbd2a('0x1e')];}}_0x3e7a89[_0xbd2a('0x8')]=_0x2af2a4||_0x107fc6['user']||'anonymous@xcally.com';_0x3e7a89[_0xbd2a('0x20')]=_0x107fc6['host'];_0x3e7a89['port']=_0x107fc6[_0xbd2a('0x21')]||0x3e1;if(_0x107fc6[_0xbd2a('0x22')]){_0x3e7a89['tls']=!![];}else{_0x3e7a89[_0xbd2a('0x22')]=![];_0x3e7a89[_0xbd2a('0x23')]=_0xbd2a('0x24');}return _0x3e7a89;};EmailImap['prototype'][_0xbd2a('0x10')]=function(){this[_0xbd2a('0x2')][_0xbd2a('0x25')](this[_0xbd2a('0xb')],![],this[_0xbd2a('0x26')][_0xbd2a('0x13')](this));};EmailImap[_0xbd2a('0x17')][_0xbd2a('0x26')]=function(_0x3f88bc,_0xab8399){if(_0x3f88bc){this['handleError'](_0x3f88bc,!![]);}else{this[_0xbd2a('0x27')](_0xbd2a('0x28'),_0xab8399);this[_0xbd2a('0x29')]();}};EmailImap[_0xbd2a('0x17')]['handleCloseBox']=function(_0x59dd6d){if(_0x59dd6d){this[_0xbd2a('0x2a')](_0x59dd6d,!![]);}else{this[_0xbd2a('0x2')][_0xbd2a('0x11')]();this[_0xbd2a('0x27')](_0xbd2a('0x11'));}};EmailImap[_0xbd2a('0x17')]['readUnseen']=function(){this['imap']['search']([_0xbd2a('0x2b')],this[_0xbd2a('0x2c')][_0xbd2a('0x13')](this));};EmailImap[_0xbd2a('0x17')][_0xbd2a('0x2c')]=function(_0x42cf5a,_0x3c51f3){if(_0x42cf5a){this[_0xbd2a('0x2a')](_0x42cf5a,!![]);}else{if(_0x3c51f3[_0xbd2a('0x2d')]){try{var _0x1ba055=this[_0xbd2a('0x2')][_0xbd2a('0x2e')](_0x3c51f3[_0xbd2a('0x2f')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x1ba055['on'](_0xbd2a('0x30'),this[_0xbd2a('0x31')][_0xbd2a('0x13')](this));_0x1ba055[_0xbd2a('0xe')]('error',this[_0xbd2a('0x32')][_0xbd2a('0x13')](this));_0x1ba055[_0xbd2a('0xe')](_0xbd2a('0x11'),this[_0xbd2a('0x33')]['bind'](this));}catch(_0x18934b){logger[_0xbd2a('0x14')]('handleReadUnseen',this['account'][_0xbd2a('0x8')],_0x18934b);this['imap'][_0xbd2a('0x34')](!![],this[_0xbd2a('0x35')][_0xbd2a('0x13')](this));}}else{this[_0xbd2a('0x2')]['closeBox'](!![],this[_0xbd2a('0x35')]['bind'](this));}}};EmailImap[_0xbd2a('0x17')][_0xbd2a('0x31')]=function(_0xde1f98){_0xde1f98['on']('body',this[_0xbd2a('0x36')][_0xbd2a('0x13')](this));_0xde1f98[_0xbd2a('0xe')](_0xbd2a('0x37'),this[_0xbd2a('0x38')][_0xbd2a('0x13')](this));_0xde1f98[_0xbd2a('0xe')](_0xbd2a('0x11'),this['handleMessageEnd'][_0xbd2a('0x13')](this));};EmailImap[_0xbd2a('0x17')][_0xbd2a('0x36')]=function(_0x991e0f){simpleParser(_0x991e0f,{'Iconv':Iconv},this[_0xbd2a('0x39')][_0xbd2a('0x13')](this));};EmailImap[_0xbd2a('0x17')][_0xbd2a('0x38')]=function(){};EmailImap['prototype'][_0xbd2a('0x3a')]=function(){};EmailImap[_0xbd2a('0x17')][_0xbd2a('0x39')]=function(_0x4a97d3,_0x556fca){if(_0x4a97d3){logger[_0xbd2a('0x14')](_0x4a97d3);}else{const _0x1f46ff=_0x556fca[_0xbd2a('0x3b')]['length'];var _0x2b04c6=this;const _0x1f46ff=_0x556fca['html'][_0xbd2a('0x2d')];if(_0x1f46ffEmpty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','html','includes','\x20[Attachment:\x20','body','originTo','message','originCc','attachment','attachment-','%s-%s','now','root','server/files/attachments/'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xf85e,0x16f));var _0xef85=function(_0x3f1c21,_0x6c4dd3){_0x3f1c21=_0x3f1c21-0x0;var _0x3ebc10=_0xf85e[_0x3f1c21];return _0x3ebc10;};'use strict';var _=require(_0xef85('0x0'));var moment=require(_0xef85('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xef85('0x2'));var tnef=require(_0xef85('0x3'));var logger=require(_0xef85('0x4'))(_0xef85('0x5'));var config=require(_0xef85('0x6'));function getAddress(_0x2bb8fd){var _0x2f1ecf=_[_0xef85('0x7')](_0x2bb8fd[_0xef85('0x8')]);return _0x2f1ecf&&_0x2f1ecf[_0xef85('0x9')]?_0x2f1ecf[_0xef85('0x9')]:'anonymous'+random[_0xef85('0xa')](0x6)+_0xef85('0xb');}function getFirstName(_0xcd8b4b){var _0x373fa8=_[_0xef85('0x7')](_0xcd8b4b[_0xef85('0x8')]);if(_0x373fa8&&_0x373fa8[_0xef85('0xc')]){if(_0x373fa8[_0xef85('0xc')]==_0x373fa8['address']){return _0x373fa8['name'][_0xef85('0xd')](0x0,_0x373fa8[_0xef85('0xc')]['indexOf']('@'));}var _0x47846c=_0x373fa8[_0xef85('0xc')][_0xef85('0xe')](/\s+/);return _0x47846c[_0xef85('0xf')]>0x1?_0x47846c[_0xef85('0x10')](0x0,-0x1)[_0xef85('0x11')]('\x20'):_0x373fa8[_0xef85('0xc')];}return _0xef85('0x12');}function getLastName(_0x154608){var _0x126a3a=_['head'](_0x154608[_0xef85('0x8')]);if(_0x126a3a&&_0x126a3a[_0xef85('0xc')]){var _0x30b119=_0x126a3a[_0xef85('0xc')][_0xef85('0xe')](/\s+/);return _0x30b119['length']>0x1?_0x30b119[_0xef85('0x13')]():'';}return'';}function getMails(_0x32f220,_0x5c7f69){var _0x20c30b='';for(var _0x42bd4e=0x0;_0x42bd4e<_0x5c7f69[_0xef85('0x8')]['length'];_0x42bd4e+=0x1){if(_0x5c7f69[_0xef85('0x8')][_0x42bd4e]['address']!==_0x32f220){if(!_[_0xef85('0x14')](_0x20c30b)){_0x20c30b+=',';}_0x20c30b+=_0x5c7f69['value'][_0x42bd4e][_0xef85('0xc')]||_0x5c7f69[_0xef85('0x8')][_0x42bd4e][_0xef85('0x9')]||'';_0x20c30b+='\x20<';_0x20c30b+=_0x5c7f69[_0xef85('0x8')][_0x42bd4e][_0xef85('0x9')]?_0x5c7f69[_0xef85('0x8')][_0x42bd4e][_0xef85('0x9')]:'anonymous'+random[_0xef85('0xa')](0x6)+_0xef85('0xb');_0x20c30b+='>';}}return _0x20c30b;}function parseEmail(_0x1050b8,_0x2a4654,_0x32990b){if(_0x2a4654['html']){var _0x571556=/)<[^<]*)*<\/script>/gi;while(_0x571556['test'](_0x2a4654['html'])){_0x2a4654[_0xef85('0x15')]=_0x2a4654[_0xef85('0x15')]['replace'](_0x571556,'');}if(_0x2a4654[_0xef85('0x15')][_0xef85('0x16')](_0xef85('0x17'))){var _0x550fd3=[];_0x2a4654[_0xef85('0x18')][_0xef85('0x19')](_0x1fa1f1=>{_0x550fd3[_0xef85('0x1a')](_0x1fa1f1['filename']);});var _0x2a7f78=/]+>/g;var _0x2c251a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1f3577=_0x2a4654[_0xef85('0x15')][_0xef85('0x1b')](_0x2c251a,_0xef85('0x1c'));var _0x3bd153=_0x1f3577[_0xef85('0x1b')](_0x2a7f78,_0xef85('0x1d'));for(let _0xf3c949=0x0;_0xf3c949<_0x550fd3[_0xef85('0xf')];_0xf3c949++){var _0x384f01=_0x3bd153[_0xef85('0x1b')]('_IMG',_0xef85('0x1e')+_0x550fd3[_0xf3c949]+'\x20]');_0x3bd153=_0x384f01;}_0x2a4654['html']=_0x3bd153;}_0x32990b[_0xef85('0x1f')]=_0x2a4654['html'];}else{_0x32990b['body']=_0x2a4654['textAsHtml'];}if(_0x32990b[_0xef85('0x1f')]){_0x32990b[_0xef85('0x1f')]=_0x32990b[_0xef85('0x1f')][_0xef85('0x1b')](/0x0){var _0x5ae853=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0xa3d77c=0x0;_0xa3d77c<_0x2a4654[_0xef85('0x2c')]['length'];_0xa3d77c++){var _0x563250=_[_0xef85('0x2d')](_0x5ae853,_0x2a4654['headerLines'][_0xa3d77c]['line']);if(_0x563250>=0x0){_0x32990b[_0xef85('0x2e')]=!![];}}}return _0x32990b;}exports[_0xef85('0x2f')]=function(_0x226bf9,_0x1490f7,_0x5f2f45){var _0x1e1649={'from':getAddress(_0x1490f7[_0xef85('0x30')]),'firstName':getFirstName(_0x1490f7[_0xef85('0x30')]),'lastName':getLastName(_0x1490f7['from']),'mapKey':_0xef85('0x5'),'message':{'from':getMails(_0x226bf9[_0xef85('0x5')],_0x1490f7[_0xef85('0x30')]),'to':_0x226bf9['email'],'cc':'','subject':_0x1490f7[_0xef85('0x31')]||'','messageId':_0x1490f7['messageId'],'inReplyTo':_0x1490f7[_0xef85('0x32')],'sentAt':moment(_0x1490f7[_0xef85('0x33')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1490f7[_0xef85('0x15')]&&!_0x1490f7[_0xef85('0x34')]){var _0x5f0e5d=_[_0xef85('0x35')](_0x1490f7[_0xef85('0x18')],{'contentType':'application/ms-tnef'});if(_0x5f0e5d['length']){logger[_0xef85('0x36')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1490f7[_0xef85('0x37')]));tnef[_0xef85('0x38')](_[_0xef85('0x39')](_0x5f0e5d)['content'],function(_0x2402ec,_0x11f241){if(_0x11f241){_0x1490f7[_0xef85('0x15')]=_0x11f241[_0xef85('0x3a')]||_0xef85('0x3b');if(_0x11f241[_0xef85('0x3c')]){for(var _0x2b8134=0x0;_0x2b8134<_0x11f241[_0xef85('0x3c')]['length'];_0x2b8134++){var _0x28b2da=_0x11f241['Attachments'][_0x2b8134];_0x1e1649['message'][_0xef85('0x18')][_0xef85('0x1a')]({'filename':_0x28b2da['Title'],'content':Buffer[_0xef85('0x30')](_0x28b2da[_0xef85('0x3d')])});}}}_0x5f2f45(parseEmail(_0x226bf9,_0x1490f7,_0x1e1649));});}else{_0x1490f7[_0xef85('0x15')]='

Empty\x20message

';_0x5f2f45(parseEmail(_0x226bf9,_0x1490f7,_0x1e1649));}}else{_0x5f2f45(parseEmail(_0x226bf9,_0x1490f7,_0x1e1649));}};exports[_0xef85('0x3e')]=function(_0x2fce18,_0x494aa6){var _0x1ba302=[_0xef85('0x3f')+(_0x494aa6||''),_0xef85('0x40')+_0x2fce18,'',''];return Buffer[_0xef85('0x30')](_0x1ba302[_0xef85('0x11')](''),_0xef85('0x41'))[_0xef85('0x42')](_0xef85('0x43'));}; \ No newline at end of file +var _0x8c0b=['textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','moment','randomstring','path','email','head','address','@xcally.com','name','substring','split','length','join','Anonymous','value','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c0b,0xff));var _0xb8c0=function(_0x2b2858,_0x3f0832){_0x2b2858=_0x2b2858-0x0;var _0x12a1d8=_0x8c0b[_0x2b2858];return _0x12a1d8;};'use strict';var _=require('lodash');var moment=require(_0xb8c0('0x0'));var random=require(_0xb8c0('0x1'));var fs=require('fs');var path=require(_0xb8c0('0x2'));var util=require('util');var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0xb8c0('0x3'));var config=require('../../../config/environment');function getAddress(_0x4da1e1){var _0x43d0c0=_[_0xb8c0('0x4')](_0x4da1e1['value']);return _0x43d0c0&&_0x43d0c0[_0xb8c0('0x5')]?_0x43d0c0[_0xb8c0('0x5')]:'anonymous'+random['generate'](0x6)+_0xb8c0('0x6');}function getFirstName(_0x4c6c99){var _0x16dec9=_[_0xb8c0('0x4')](_0x4c6c99['value']);if(_0x16dec9&&_0x16dec9['name']){if(_0x16dec9[_0xb8c0('0x7')]==_0x16dec9['address']){return _0x16dec9[_0xb8c0('0x7')][_0xb8c0('0x8')](0x0,_0x16dec9[_0xb8c0('0x7')]['indexOf']('@'));}var _0x1677aa=_0x16dec9[_0xb8c0('0x7')][_0xb8c0('0x9')](/\s+/);return _0x1677aa[_0xb8c0('0xa')]>0x1?_0x1677aa['slice'](0x0,-0x1)[_0xb8c0('0xb')]('\x20'):_0x16dec9[_0xb8c0('0x7')];}return _0xb8c0('0xc');}function getLastName(_0xce78ca){var _0x92febb=_[_0xb8c0('0x4')](_0xce78ca[_0xb8c0('0xd')]);if(_0x92febb&&_0x92febb[_0xb8c0('0x7')]){var _0x228408=_0x92febb[_0xb8c0('0x7')][_0xb8c0('0x9')](/\s+/);return _0x228408[_0xb8c0('0xa')]>0x1?_0x228408[_0xb8c0('0xe')]():'';}return'';}function getMails(_0x5f36d0,_0x385e43){var _0x33305d='';for(var _0x1e1f8a=0x0;_0x1e1f8a<_0x385e43['value'][_0xb8c0('0xa')];_0x1e1f8a+=0x1){if(_0x385e43[_0xb8c0('0xd')][_0x1e1f8a][_0xb8c0('0x5')]!==_0x5f36d0){if(!_[_0xb8c0('0xf')](_0x33305d)){_0x33305d+=',';}_0x33305d+=_0x385e43['value'][_0x1e1f8a][_0xb8c0('0x7')]||_0x385e43[_0xb8c0('0xd')][_0x1e1f8a][_0xb8c0('0x5')]||'';_0x33305d+='\x20<';_0x33305d+=_0x385e43['value'][_0x1e1f8a][_0xb8c0('0x5')]?_0x385e43[_0xb8c0('0xd')][_0x1e1f8a][_0xb8c0('0x5')]:'anonymous'+random['generate'](0x6)+_0xb8c0('0x6');_0x33305d+='>';}}return _0x33305d;}function parseEmail(_0x162309,_0x550095,_0x1d729f){if(_0x550095[_0xb8c0('0x10')]){var _0x36ec39=/)<[^<]*)*<\/script>/gi;while(_0x36ec39[_0xb8c0('0x11')](_0x550095[_0xb8c0('0x10')])){_0x550095[_0xb8c0('0x10')]=_0x550095[_0xb8c0('0x10')]['replace'](_0x36ec39,'');}if(_0x550095[_0xb8c0('0x10')][_0xb8c0('0x12')](_0xb8c0('0x13'))){var _0x499cb0=[];_0x550095[_0xb8c0('0x14')][_0xb8c0('0x15')](_0x4a78b6=>{_0x499cb0[_0xb8c0('0x16')](_0x4a78b6[_0xb8c0('0x17')]);});var _0x1bcb36=/]+>/g;var _0x323d44=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xa95e36=_0x550095[_0xb8c0('0x10')][_0xb8c0('0x18')](_0x323d44,_0xb8c0('0x19'));var _0x52c6fb=_0xa95e36['replace'](_0x1bcb36,_0xb8c0('0x1a'));for(let _0x16bf4d=0x0;_0x16bf4d<_0x499cb0[_0xb8c0('0xa')];_0x16bf4d++){var _0x1b75f6=_0x52c6fb[_0xb8c0('0x18')](_0xb8c0('0x1a'),_0xb8c0('0x1b')+_0x499cb0[_0x16bf4d]+'\x20]');_0x52c6fb=_0x1b75f6;}_0x550095[_0xb8c0('0x10')]=_0x52c6fb;}_0x1d729f[_0xb8c0('0x1c')]=_0x550095[_0xb8c0('0x10')];}else{_0x1d729f['body']=_0x550095[_0xb8c0('0x1d')];}if(_0x1d729f[_0xb8c0('0x1c')]){_0x1d729f[_0xb8c0('0x1c')]=_0x1d729f['body']['replace'](/0x0){var _0x5f58d3=[_0xb8c0('0x2e'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x2bf47a=0x0;_0x2bf47a<_0x550095[_0xb8c0('0x2d')][_0xb8c0('0xa')];_0x2bf47a++){var _0x4ea910=_[_0xb8c0('0x2f')](_0x5f58d3,_0x550095['headerLines'][_0x2bf47a][_0xb8c0('0x30')]);if(_0x4ea910>=0x0){_0x1d729f[_0xb8c0('0x31')]=!![];}}}return _0x1d729f;}exports[_0xb8c0('0x32')]=function(_0x1209c6,_0x5c7700,_0x46a7f9){var _0x2aa71b={'from':getAddress(_0x5c7700['from']),'firstName':getFirstName(_0x5c7700[_0xb8c0('0x33')]),'lastName':getLastName(_0x5c7700['from']),'mapKey':_0xb8c0('0x3'),'message':{'from':getMails(_0x1209c6[_0xb8c0('0x3')],_0x5c7700['from']),'to':_0x1209c6[_0xb8c0('0x3')],'cc':'','subject':_0x5c7700[_0xb8c0('0x34')]||'','messageId':_0x5c7700[_0xb8c0('0x35')],'inReplyTo':_0x5c7700['inReplyTo'],'sentAt':moment(_0x5c7700[_0xb8c0('0x36')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x5c7700[_0xb8c0('0x10')]&&!_0x5c7700[_0xb8c0('0x1d')]){var _0x272453=_[_0xb8c0('0x37')](_0x5c7700[_0xb8c0('0x14')],{'contentType':_0xb8c0('0x38')});if(_0x272453[_0xb8c0('0xa')]){logger[_0xb8c0('0x39')](util[_0xb8c0('0x26')](_0xb8c0('0x3a'),_0x5c7700[_0xb8c0('0x35')]));tnef[_0xb8c0('0x3b')](_[_0xb8c0('0x3c')](_0x272453)[_0xb8c0('0x2c')],function(_0x431fd0,_0x556654){if(_0x556654){_0x5c7700[_0xb8c0('0x10')]=_0x556654['BodyHTML']||'

Empty\x20message

';if(_0x556654[_0xb8c0('0x3d')]){for(var _0x2f0a21=0x0;_0x2f0a21<_0x556654[_0xb8c0('0x3d')]['length'];_0x2f0a21++){var _0x40353b=_0x556654['Attachments'][_0x2f0a21];_0x2aa71b[_0xb8c0('0x1f')][_0xb8c0('0x14')][_0xb8c0('0x16')]({'filename':_0x40353b[_0xb8c0('0x3e')],'content':Buffer[_0xb8c0('0x33')](_0x40353b[_0xb8c0('0x3f')])});}}}_0x46a7f9(parseEmail(_0x1209c6,_0x5c7700,_0x2aa71b));});}else{_0x5c7700[_0xb8c0('0x10')]=_0xb8c0('0x40');_0x46a7f9(parseEmail(_0x1209c6,_0x5c7700,_0x2aa71b));}}else{_0x46a7f9(parseEmail(_0x1209c6,_0x5c7700,_0x2aa71b));}};exports[_0xb8c0('0x41')]=function(_0x9402c1,_0x6961d5){var _0x268699=[_0xb8c0('0x42')+(_0x6961d5||''),_0xb8c0('0x43')+_0x9402c1,'',''];return Buffer[_0xb8c0('0x33')](_0x268699[_0xb8c0('0xb')](''),_0xb8c0('0x44'))[_0xb8c0('0x45')](_0xb8c0('0x46'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 7742c64..e741094 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 _0xfba9=['active','Imap','Smtp','exports','lodash','name','key','SERV'];(function(_0x1aac1d,_0x1dca6c){var _0x140f0d=function(_0x3e4db4){while(--_0x3e4db4){_0x1aac1d['push'](_0x1aac1d['shift']());}};_0x140f0d(++_0x1dca6c);}(_0xfba9,0x1bc));var _0x9fba=function(_0x5b1097,_0x3ed62f){_0x5b1097=_0x5b1097-0x0;var _0x57979c=_0xfba9[_0x5b1097];return _0x57979c;};'use strict';var _=require(_0x9fba('0x0'));function MailAccount(_0x3d403a){this['id']=_0x3d403a['id']||0x0;this[_0x9fba('0x1')]=_0x3d403a[_0x9fba('0x1')]||'Service';this['key']=_0x3d403a[_0x9fba('0x2')]||_0x9fba('0x3');this[_0x9fba('0x4')]=_0x3d403a[_0x9fba('0x4')]||![];this[_0x9fba('0x5')]=_0x3d403a['Imap']||[];this[_0x9fba('0x6')]=_0x3d403a['Smtp']||[];}module[_0x9fba('0x7')]=MailAccount; \ No newline at end of file +var _0xa46d=['Service','key','SERV','active','Imap','exports','lodash','name'];(function(_0x459edb,_0x1e7fb9){var _0x3cc5c9=function(_0x2c01f4){while(--_0x2c01f4){_0x459edb['push'](_0x459edb['shift']());}};_0x3cc5c9(++_0x1e7fb9);}(_0xa46d,0x136));var _0xda46=function(_0x2b13,_0xbbacb7){_0x2b13=_0x2b13-0x0;var _0x3c553e=_0xa46d[_0x2b13];return _0x3c553e;};'use strict';var _=require(_0xda46('0x0'));function MailAccount(_0x4d10bb){this['id']=_0x4d10bb['id']||0x0;this['name']=_0x4d10bb[_0xda46('0x1')]||_0xda46('0x2');this[_0xda46('0x3')]=_0x4d10bb[_0xda46('0x3')]||_0xda46('0x4');this[_0xda46('0x5')]=_0x4d10bb[_0xda46('0x5')]||![];this[_0xda46('0x6')]=_0x4d10bb[_0xda46('0x6')]||[];this['Smtp']=_0x4d10bb['Smtp']||[];}module[_0xda46('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 57a4f07..813d356 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 _0x8e3d=['exports','lodash','../model/mailAccount','mailAccounts','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','merge'];(function(_0x1cdc9b,_0x3a97df){var _0x5c4ee7=function(_0x3a328e){while(--_0x3a328e){_0x1cdc9b['push'](_0x1cdc9b['shift']());}};_0x5c4ee7(++_0x3a97df);}(_0x8e3d,0x1a8));var _0xd8e3=function(_0x23cc7d,_0x553e85){_0x23cc7d=_0x23cc7d-0x0;var _0x41abb3=_0x8e3d[_0x23cc7d];return _0x41abb3;};'use strict';var _=require(_0xd8e3('0x0'));var MailAccount=require(_0xd8e3('0x1'));var Realtime=function(){this[_0xd8e3('0x2')]={};};function freeIsNotKey(_0x3a6c8c,_0x1866e1,_0xb34f62){var _0x5b1263=_['mapKeys'](_0x3a6c8c,function(_0x269dd4,_0x56547b){return _0x269dd4[_0xb34f62];});for(var _0x41844d in _0x1866e1){if(_0x1866e1['hasOwnProperty'](_0x41844d)){if(!_0x5b1263[_0x41844d]){delete _0x1866e1[_0x41844d];}}}}Realtime['prototype'][_0xd8e3('0x3')]=function(_0x51eb32,_0x372e8e){for(var _0x1d13cb in _0x372e8e){if(_0x51eb32[_0xd8e3('0x4')](_0x1d13cb)){_0x51eb32[_0x1d13cb]=_0x372e8e[_0x1d13cb];}}};Realtime['prototype'][_0xd8e3('0x5')]=function(){var _0x4bb8b8=this;return function(_0x3c8d31){if(_0x3c8d31){freeIsNotKey(_0x3c8d31,_0x4bb8b8[_0xd8e3('0x2')],'id');for(var _0x462836=0x0,_0x5d80a7={},_0x24353e={};_0x462836<_0x3c8d31[_0xd8e3('0x6')];_0x462836+=0x1){_0x5d80a7=_0x3c8d31[_0x462836];if(_['isUndefined'](_0x4bb8b8[_0xd8e3('0x2')][_0x5d80a7['id']])){_0x4bb8b8[_0xd8e3('0x2')][_0x5d80a7['id']]=new MailAccount(_0x5d80a7);}else{_[_0xd8e3('0x7')](_0x4bb8b8[_0xd8e3('0x2')][_0x5d80a7['id']],_0x5d80a7);}}}return _0x4bb8b8[_0xd8e3('0x2')];};};module[_0xd8e3('0x8')]=Realtime; \ No newline at end of file +var _0x67a1=['hasOwnProperty','prototype','initMailAccounts','mailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67a1,0x1a5));var _0x167a=function(_0xdd1503,_0x1f212d){_0xdd1503=_0xdd1503-0x0;var _0x5b82a0=_0x67a1[_0xdd1503];return _0x5b82a0;};'use strict';var _=require(_0x167a('0x0'));var MailAccount=require(_0x167a('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2efd81,_0x10fb6e,_0x416c67){var _0x4eafb3=_['mapKeys'](_0x2efd81,function(_0x3cf064,_0x324028){return _0x3cf064[_0x416c67];});for(var _0xd8b159 in _0x10fb6e){if(_0x10fb6e[_0x167a('0x2')](_0xd8b159)){if(!_0x4eafb3[_0xd8b159]){delete _0x10fb6e[_0xd8b159];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x6817c8,_0x2e63ba){for(var _0x150e77 in _0x2e63ba){if(_0x6817c8['hasOwnProperty'](_0x150e77)){_0x6817c8[_0x150e77]=_0x2e63ba[_0x150e77];}}};Realtime[_0x167a('0x3')][_0x167a('0x4')]=function(){var _0x243f32=this;return function(_0x2fccd3){if(_0x2fccd3){freeIsNotKey(_0x2fccd3,_0x243f32[_0x167a('0x5')],'id');for(var _0x34bfc9=0x0,_0x4beee1={},_0x3c641b={};_0x34bfc9<_0x2fccd3['length'];_0x34bfc9+=0x1){_0x4beee1=_0x2fccd3[_0x34bfc9];if(_[_0x167a('0x6')](_0x243f32[_0x167a('0x5')][_0x4beee1['id']])){_0x243f32['mailAccounts'][_0x4beee1['id']]=new MailAccount(_0x4beee1);}else{_[_0x167a('0x7')](_0x243f32[_0x167a('0x5')][_0x4beee1['id']],_0x4beee1);}}}return _0x243f32[_0x167a('0x5')];};};module[_0x167a('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 57e9e6e..00783f4 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 _0xd9ef=['name','service','type','data5','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider'];(function(_0x1835b3,_0x3c01f0){var _0x28d5c5=function(_0x273b11){while(--_0x273b11){_0x1835b3['push'](_0x1835b3['shift']());}};_0x28d5c5(++_0x3c01f0);}(_0xd9ef,0x95));var _0xfd9e=function(_0x211a65,_0x30d3a7){_0x211a65=_0x211a65-0x0;var _0x9c6615=_0xd9ef[_0x211a65];return _0x9c6615;};'use strict';var client=require(_0xfd9e('0x0'));exports[_0xfd9e('0x1')]=function(){return function(){return client['Request'](_0xfd9e('0x2'),{'options':{'attributes':['id','name','provider','service',_0xfd9e('0x3'),_0xfd9e('0x4'),_0xfd9e('0x5'),_0xfd9e('0x6'),_0xfd9e('0x7')],'raw':![],'include':[{'model':_0xfd9e('0x8'),'as':_0xfd9e('0x9'),'include':[{'model':_0xfd9e('0xa'),'attributes':['id',_0xfd9e('0xb'),_0xfd9e('0xc'),_0xfd9e('0xd'),_0xfd9e('0xe')],'as':_0xfd9e('0xa')}]},{'model':'MailServerOut','as':_0xfd9e('0xf'),'include':[{'model':_0xfd9e('0xa'),'attributes':['id','name',_0xfd9e('0xc'),_0xfd9e('0xd'),_0xfd9e('0xe')],'as':'CloudProvider'}]}]},'log':_0xfd9e('0x10')});};};exports[_0xfd9e('0x11')]=function(_0x339901,_0x44a97a){return client[_0xfd9e('0x12')]('NotifyMailAccount',{'account':{'id':_0x339901},'body':_0x44a97a,'log':_0xfd9e('0x13')});}; \ No newline at end of file +var _0xa1d2=['email','active','key','ListId','TemplateId','Imap','CloudProvider','type','data5','MailServerOut','Smtp','notify','NotifyMailAccount','getMailAccounts','GetMailAccount','name','provider','service'];(function(_0x3d0352,_0x33127c){var _0x2ad888=function(_0x50393e){while(--_0x50393e){_0x3d0352['push'](_0x3d0352['shift']());}};_0x2ad888(++_0x33127c);}(_0xa1d2,0x151));var _0x2a1d=function(_0x17e4d0,_0x2d354b){_0x17e4d0=_0x17e4d0-0x0;var _0x559fe2=_0xa1d2[_0x17e4d0];return _0x559fe2;};'use strict';var client=require('../client');exports[_0x2a1d('0x0')]=function(){return function(){return client['Request'](_0x2a1d('0x1'),{'options':{'attributes':['id',_0x2a1d('0x2'),_0x2a1d('0x3'),_0x2a1d('0x4'),_0x2a1d('0x5'),_0x2a1d('0x6'),_0x2a1d('0x7'),_0x2a1d('0x8'),_0x2a1d('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x2a1d('0xa'),'include':[{'model':_0x2a1d('0xb'),'attributes':['id',_0x2a1d('0x2'),_0x2a1d('0x4'),_0x2a1d('0xc'),_0x2a1d('0xd')],'as':_0x2a1d('0xb')}]},{'model':_0x2a1d('0xe'),'as':_0x2a1d('0xf'),'include':[{'model':_0x2a1d('0xb'),'attributes':['id','name',_0x2a1d('0x4'),'type',_0x2a1d('0xd')],'as':_0x2a1d('0xb')}]}]},'log':'getMailAccount'});};};exports[_0x2a1d('0x10')]=function(_0x2b443f,_0x21f1d3){return client['Request'](_0x2a1d('0x11'),{'account':{'id':_0x2b443f},'body':_0x21f1d3,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 6700976..a862392 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 _0x93d3=['getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x10b4f2,_0x2d4ec8){var _0x1d9640=function(_0x5a55ab){while(--_0x5a55ab){_0x10b4f2['push'](_0x10b4f2['shift']());}};_0x1d9640(++_0x2d4ec8);}(_0x93d3,0xd8));var _0x393d=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x93d3[_0x255d5b];return _0x3e141a;};'use strict';var client=require('../client');exports[_0x393d('0x0')]=function(){return client[_0x393d('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x393d('0x2')]},'log':_0x393d('0x3')});}; \ No newline at end of file +var _0x71c3=['loginMailFrequency','../client','Request'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x71c3,0x97));var _0x371c=function(_0x1418dc,_0x1cc11c){_0x1418dc=_0x1418dc-0x0;var _0x390791=_0x71c3[_0x1418dc];return _0x390791;};'use strict';var client=require(_0x371c('0x0'));exports['getSettings']=function(){return client[_0x371c('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x371c('0x2')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 94a7ffa..6b03128 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 ff4f70b..e21b067 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 _0xbf03=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','http','sticky-session','../../config/environment','createServer','timeout','listen','socket.io','websocket','redis','defaults','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening'];(function(_0x239f8b,_0x1ef629){var _0x5532f5=function(_0x48b5da){while(--_0x48b5da){_0x239f8b['push'](_0x239f8b['shift']());}};_0x5532f5(++_0x1ef629);}(_0xbf03,0xb4));var _0x3bf0=function(_0x2abb22,_0x67d69){_0x2abb22=_0x2abb22-0x0;var _0x5bde9b=_0xbf03[_0x2abb22];return _0x5bde9b;};'use strict';var _=require('lodash');var http=require(_0x3bf0('0x0'));var express=require('express');var sticky=require(_0x3bf0('0x1'));var Redis=require('ioredis');var config=require(_0x3bf0('0x2'));var app=express();var server=http[_0x3bf0('0x3')](app);server[_0x3bf0('0x4')]=0xdbba0;if(sticky[_0x3bf0('0x5')](server,config['port'])){var socketio=require(_0x3bf0('0x6'))(server,{'transports':[_0x3bf0('0x7'),'polling']});config[_0x3bf0('0x8')]=_[_0x3bf0('0x9')](config['redis'],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x3bf0('0xa'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x3bf0('0x8')])}));require(_0x3bf0('0xb'))[_0x3bf0('0xc')]();require(_0x3bf0('0xd'))[_0x3bf0('0xc')](socketio);require(_0x3bf0('0xe'))[_0x3bf0('0xc')](app);require(_0x3bf0('0xf'))[_0x3bf0('0xc')](app);}else{server[_0x3bf0('0x10')](_0x3bf0('0x11'),function(){console[_0x3bf0('0x12')](_0x3bf0('0x13'),config[_0x3bf0('0x14')]);});}exports=module[_0x3bf0('0x15')]=app; \ No newline at end of file +var _0x3506=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','timeout','listen','port','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening'];(function(_0x29051f,_0x2b1480){var _0x47d64c=function(_0x2c461d){while(--_0x2c461d){_0x29051f['push'](_0x29051f['shift']());}};_0x47d64c(++_0x2b1480);}(_0x3506,0x161));var _0x6350=function(_0x6ca944,_0x301be4){_0x6ca944=_0x6ca944-0x0;var _0x5965fe=_0x3506[_0x6ca944];return _0x5965fe;};'use strict';var _=require(_0x6350('0x0'));var http=require(_0x6350('0x1'));var express=require(_0x6350('0x2'));var sticky=require(_0x6350('0x3'));var Redis=require(_0x6350('0x4'));var config=require(_0x6350('0x5'));var app=express();var server=http['createServer'](app);server[_0x6350('0x6')]=0xdbba0;if(sticky[_0x6350('0x7')](server,config[_0x6350('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0x6350('0x9'),_0x6350('0xa')]});config[_0x6350('0xb')]=_[_0x6350('0xc')](config[_0x6350('0xb')],{'host':_0x6350('0xd'),'port':0x18eb});socketio[_0x6350('0xe')](require(_0x6350('0xf'))({'pubClient':new Redis(config[_0x6350('0xb')]),'subClient':new Redis(config[_0x6350('0xb')])}));require(_0x6350('0x10'))[_0x6350('0x11')]();require(_0x6350('0x12'))[_0x6350('0x11')](socketio);require(_0x6350('0x13'))[_0x6350('0x11')](app);require(_0x6350('0x14'))[_0x6350('0x11')](app);}else{server['once'](_0x6350('0x15'),function(){console[_0x6350('0x16')](_0x6350('0x17'),config['port']);});}exports=module[_0x6350('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index c411595..5806073 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 _0x8ea1=['../../config/logger','routing','http','Request','then','debug','rpc','error','message','result','exports','jayson/promise'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8ea1,0xa7));var _0x18ea=function(_0x3a441a,_0x43eb56){_0x3a441a=_0x3a441a-0x0;var _0x3128a2=_0x8ea1[_0x3a441a];return _0x3128a2;};'use strict';var jayson=require(_0x18ea('0x0'));var BPromise=require('bluebird');var logger=require(_0x18ea('0x1'))(_0x18ea('0x2'));var client=jayson['client'][_0x18ea('0x3')]({'port':0x2329});client[_0x18ea('0x4')]=function(_0x118df3,_0x1774f1){return new BPromise(function(_0xc421b7,_0x1644d4){return client['request'](_0x118df3,_0x1774f1)[_0x18ea('0x5')](function(_0x231610){logger[_0x18ea('0x6')](_0x18ea('0x7'),_0x18ea('0x2'),_0x118df3,_0x1774f1,_0x231610);if(_0x231610[_0x18ea('0x8')]){logger[_0x18ea('0x8')]('rpc','routing',_0x118df3,_0x231610[_0x18ea('0x8')][_0x18ea('0x9')],_0x1774f1);return _0x1644d4(_0x231610[_0x18ea('0x8')]['message']);}else{return _0xc421b7(_0x231610[_0x18ea('0xa')]);}})['catch'](function(_0x4f522b){logger[_0x18ea('0x8')]('rpc',_0x18ea('0x2'),_0x118df3,_0x4f522b,_0x1774f1);return _0x1644d4(_0x4f522b);});});};module[_0x18ea('0xb')]=client; \ No newline at end of file +var _0xeb3f=['error','rpc','routing','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','request','then'];(function(_0x4caf11,_0x46db74){var _0x3e27db=function(_0x3fab9a){while(--_0x3fab9a){_0x4caf11['push'](_0x4caf11['shift']());}};_0x3e27db(++_0x46db74);}(_0xeb3f,0x77));var _0xfeb3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xeb3f[_0x17d9e3];return _0x14192d;};'use strict';var jayson=require(_0xfeb3('0x0'));var BPromise=require(_0xfeb3('0x1'));var logger=require(_0xfeb3('0x2'))('routing');var client=jayson[_0xfeb3('0x3')][_0xfeb3('0x4')]({'port':0x2329});client['Request']=function(_0x385c9b,_0x1fa9ad){return new BPromise(function(_0x23edee,_0x178e4d){return client[_0xfeb3('0x5')](_0x385c9b,_0x1fa9ad)[_0xfeb3('0x6')](function(_0x1bff6e){logger['debug']('rpc','routing',_0x385c9b,_0x1fa9ad,_0x1bff6e);if(_0x1bff6e[_0xfeb3('0x7')]){logger[_0xfeb3('0x7')](_0xfeb3('0x8'),_0xfeb3('0x9'),_0x385c9b,_0x1bff6e[_0xfeb3('0x7')][_0xfeb3('0xa')],_0x1fa9ad);return _0x178e4d(_0x1bff6e[_0xfeb3('0x7')][_0xfeb3('0xa')]);}else{return _0x23edee(_0x1bff6e[_0xfeb3('0xb')]);}})[_0xfeb3('0xc')](function(_0x205449){logger[_0xfeb3('0x7')](_0xfeb3('0x8'),_0xfeb3('0x9'),_0x385c9b,_0x205449,_0x1fa9ad);return _0x178e4d(_0x205449);});});};module[_0xfeb3('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index a89cae9..fc35ea2 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 _0x2f2f=['getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x2f2f,0x7b));var _0xf2f2=function(_0x1d0a5e,_0xff21e7){_0x1d0a5e=_0x1d0a5e-0x0;var _0x1c3ed3=_0x2f2f[_0x1d0a5e];return _0x1c3ed3;};'use strict';var BPromise=require(_0xf2f2('0x0'));var server=require(_0xf2f2('0x1'));var Realtime=require(_0xf2f2('0x2'));var user=require(_0xf2f2('0x3'));var interval=require(_0xf2f2('0x4'));var openchannelQueue=require(_0xf2f2('0x5'));var chatQueue=require(_0xf2f2('0x6'));var smsQueue=require(_0xf2f2('0x7'));var mailQueue=require(_0xf2f2('0x8'));var faxQueue=require(_0xf2f2('0x9'));var whatsappQueue=require(_0xf2f2('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xf2f2('0xb')]()[_0xf2f2('0xc')](user[_0xf2f2('0xd')]())[_0xf2f2('0xc')](realtime[_0xf2f2('0xe')]())[_0xf2f2('0xc')](interval[_0xf2f2('0xf')]())[_0xf2f2('0xc')](realtime['initIntervals']())[_0xf2f2('0xc')](openchannelQueue[_0xf2f2('0x10')]())[_0xf2f2('0xc')](realtime['initOpenchannelQueues']())[_0xf2f2('0xc')](chatQueue[_0xf2f2('0x11')]())[_0xf2f2('0xc')](realtime[_0xf2f2('0x12')]())[_0xf2f2('0xc')](smsQueue[_0xf2f2('0x13')]())[_0xf2f2('0xc')](realtime[_0xf2f2('0x14')]())[_0xf2f2('0xc')](mailQueue[_0xf2f2('0x15')]())['then'](realtime['initMailQueues']())[_0xf2f2('0xc')](faxQueue[_0xf2f2('0x16')]())[_0xf2f2('0xc')](realtime[_0xf2f2('0x17')]())[_0xf2f2('0xc')](whatsappQueue['getWhatsappQueues']())[_0xf2f2('0xc')](realtime[_0xf2f2('0x18')]())[_0xf2f2('0xc')](function(){return realtime;});}function main(){return server[_0xf2f2('0x19')](realtime)['then'](function(_0x121a03){return initRealtime();})[_0xf2f2('0xc')](function(_0x398f5e){return setInterval(initRealtime,0x1388);})[_0xf2f2('0x1a')](function(_0x3ffee1){console[_0xf2f2('0x1b')](_0x3ffee1);});}main(); \ No newline at end of file +var _0x227d=['bluebird','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log'];(function(_0x566029,_0x5e152a){var _0x4d29f0=function(_0x56e8f7){while(--_0x56e8f7){_0x566029['push'](_0x566029['shift']());}};_0x4d29f0(++_0x5e152a);}(_0x227d,0x7d));var _0xd227=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x227d[_0x506d83];return _0x335e8b;};'use strict';var BPromise=require(_0xd227('0x0'));var server=require('./server');var Realtime=require(_0xd227('0x1'));var user=require(_0xd227('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xd227('0x3'));var chatQueue=require(_0xd227('0x4'));var smsQueue=require(_0xd227('0x5'));var mailQueue=require(_0xd227('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xd227('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd227('0x8')]()[_0xd227('0x9')](user['getAgents']())[_0xd227('0x9')](realtime['initAgents']())[_0xd227('0x9')](interval[_0xd227('0xa')]())[_0xd227('0x9')](realtime[_0xd227('0xb')]())['then'](openchannelQueue[_0xd227('0xc')]())[_0xd227('0x9')](realtime[_0xd227('0xd')]())['then'](chatQueue[_0xd227('0xe')]())[_0xd227('0x9')](realtime[_0xd227('0xf')]())[_0xd227('0x9')](smsQueue[_0xd227('0x10')]())[_0xd227('0x9')](realtime[_0xd227('0x11')]())[_0xd227('0x9')](mailQueue['getMailQueues']())[_0xd227('0x9')](realtime[_0xd227('0x12')]())[_0xd227('0x9')](faxQueue[_0xd227('0x13')]())[_0xd227('0x9')](realtime[_0xd227('0x14')]())[_0xd227('0x9')](whatsappQueue[_0xd227('0x15')]())[_0xd227('0x9')](realtime[_0xd227('0x16')]())[_0xd227('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xd227('0x9')](function(_0x295351){return initRealtime();})['then'](function(_0x42c962){return setInterval(initRealtime,0x1388);})[_0xd227('0x17')](function(_0x21e52a){console[_0xd227('0x18')](_0x21e52a);});}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 d3e47a9..f3457e5 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0x1261[_0x273f77];return _0x71e147;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x2b19fa,_0x133f6a){var _0x396c9f=function(_0x4711f4){while(--_0x4711f4){_0x2b19fa['push'](_0x2b19fa['shift']());}};_0x396c9f(++_0x133f6a);}(_0x7a54,0x106));var _0x47a5=function(_0x828fd,_0x40b6f8){_0x828fd=_0x828fd-0x0;var _0x3929c6=_0x7a54[_0x828fd];return _0x3929c6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 7573ef7..880046b 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 _0xb005=['bluebird','jayson/promise','client','request','then','error','message','catch','sendMailMessage'];(function(_0x17bb67,_0x4e0679){var _0x1782e0=function(_0x415cf1){while(--_0x415cf1){_0x17bb67['push'](_0x17bb67['shift']());}};_0x1782e0(++_0x4e0679);}(_0xb005,0x1d4));var _0x5b00=function(_0x5f5c9f,_0x43e6d1){_0x5f5c9f=_0x5f5c9f-0x0;var _0x5e3249=_0xb005[_0x5f5c9f];return _0x5e3249;};'use strict';var BPromise=require(_0x5b00('0x0'));var jayson=require(_0x5b00('0x1'));var client=jayson[_0x5b00('0x2')]['http']({'port':0x232b});function request(_0x2836a0,_0x2ac66c){return new BPromise(function(_0x50c3ea,_0x4f8c45){return client[_0x5b00('0x3')](_0x2836a0,_0x2ac66c)[_0x5b00('0x4')](function(_0xe17794){if(_0xe17794['error']){return _0x4f8c45(_0xe17794[_0x5b00('0x5')][_0x5b00('0x6')]);}else{return _0x50c3ea(_0xe17794['result']);}})[_0x5b00('0x7')](function(_0x3841f3){return _0x4f8c45(_0x3841f3);});});}exports[_0x5b00('0x8')]=function(_0x464f8a,_0x4e00c8){return request('SendMail',{'account':_0x464f8a,'message':_0x4e00c8});}; \ No newline at end of file +var _0x4837=['http','request','then','message','result','catch','sendMailMessage','SendMail','client'];(function(_0x3a45b6,_0x1b9079){var _0x397031=function(_0x4d543b){while(--_0x4d543b){_0x3a45b6['push'](_0x3a45b6['shift']());}};_0x397031(++_0x1b9079);}(_0x4837,0x1e5));var _0x7483=function(_0x704d75,_0x42305d){_0x704d75=_0x704d75-0x0;var _0xaba918=_0x4837[_0x704d75];return _0xaba918;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x7483('0x0')][_0x7483('0x1')]({'port':0x232b});function request(_0x11d518,_0x196135){return new BPromise(function(_0x2cad2c,_0x17daa6){return client[_0x7483('0x2')](_0x11d518,_0x196135)[_0x7483('0x3')](function(_0xf0a6d3){if(_0xf0a6d3['error']){return _0x17daa6(_0xf0a6d3['error'][_0x7483('0x4')]);}else{return _0x2cad2c(_0xf0a6d3[_0x7483('0x5')]);}})[_0x7483('0x6')](function(_0x58ef3b){return _0x17daa6(_0x58ef3b);});});}exports[_0x7483('0x7')]=function(_0x285370,_0xac0a4e){return request(_0x7483('0x8'),{'account':_0x285370,'message':_0xac0a4e});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 8b4988e..b197ce4 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 _0xb016=['fax','sms','length','Status','format','online','chatStatusTime','chatCurrentCapacity','faxStatus','faxCurrentCapacity','whatsappCurrentCapacity','stringify','emit','omit','exports','lodash','md5','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','openchannel'];(function(_0x11dd6e,_0x3460f2){var _0x31aa75=function(_0x36c111){while(--_0x36c111){_0x11dd6e['push'](_0x11dd6e['shift']());}};_0x31aa75(++_0x3460f2);}(_0xb016,0x159));var _0x6b01=function(_0x50a787,_0x3a1d1c){_0x50a787=_0x50a787-0x0;var _0x5bac37=_0xb016[_0x50a787];return _0x5bac37;};'use strict';var _=require(_0x6b01('0x0'));var md5=require(_0x6b01('0x1'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x6b01('0x2'));config['redis']=_[_0x6b01('0x3')](config[_0x6b01('0x4')],{'host':_0x6b01('0x5'),'port':0x18eb});var io=require(_0x6b01('0x6'))(new Redis(config['redis']));function Agent(_0x1b7dd6){this['id']=_0x1b7dd6['id']||0x0;this[_0x6b01('0x7')]=_0x1b7dd6[_0x6b01('0x7')]||'';this['online']=_0x1b7dd6['online']||!![];this[_0x6b01('0x8')]=_0x1b7dd6[_0x6b01('0x8')]||![];this['chatPause']=_0x1b7dd6['chatPause']||![];this[_0x6b01('0x9')]=_0x1b7dd6[_0x6b01('0x9')]||![];this[_0x6b01('0xa')]=_0x1b7dd6[_0x6b01('0xa')]||![];this[_0x6b01('0xb')]=_0x1b7dd6['smsPause']||![];this['openchannelPause']=_0x1b7dd6[_0x6b01('0xc')]||![];this[_0x6b01('0xd')]=_0x6b01('0xe');this['chatStatusTime']=0x0;this[_0x6b01('0xf')]=_0x1b7dd6['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x6b01('0x10')]='unknown';this[_0x6b01('0x11')]=0x0;this[_0x6b01('0x12')]=_0x1b7dd6['mailCapacity']||0x0;this[_0x6b01('0x13')]=0x0;this['faxStatus']='unknown';this['faxStatusTime']=0x0;this[_0x6b01('0x14')]=_0x1b7dd6['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x6b01('0x15')]=_0x6b01('0xe');this[_0x6b01('0x16')]=0x0;this[_0x6b01('0x17')]=_0x1b7dd6[_0x6b01('0x17')]||0x0;this[_0x6b01('0x18')]=0x0;this[_0x6b01('0x19')]=_0x6b01('0xe');this[_0x6b01('0x1a')]=0x0;this[_0x6b01('0x1b')]=_0x1b7dd6[_0x6b01('0x1b')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x6b01('0x1c')]=_0x6b01('0xe');this[_0x6b01('0x1d')]=0x0;this[_0x6b01('0x1e')]=_0x1b7dd6[_0x6b01('0x1e')]||0x0;this[_0x6b01('0x1f')]=0x0;this[_0x6b01('0x20')]=![];this[_0x6b01('0x21')]=undefined;this['md5']='';this[_0x6b01('0x22')]={};this[_0x6b01('0x23')]={};this[_0x6b01('0x24')]={};this[_0x6b01('0x25')]={};this[_0x6b01('0x26')]={};this[_0x6b01('0x27')]={};this[_0x6b01('0x28')]();}Agent['prototype'][_0x6b01('0x29')]=function(_0xcf9200){if(this[_0xcf9200+_0x6b01('0x2a')]>0x0){if(this[_0xcf9200+'Capacity']>0x0&&this[_0xcf9200+_0x6b01('0x2a')]>=this[_0xcf9200+_0x6b01('0x2b')]){return _0x6b01('0x2c');}else{return _0x6b01('0x2d');}}else{return _0x6b01('0x2e');}};Agent[_0x6b01('0x2f')][_0x6b01('0x28')]=function(){var _0x136452=[_0x6b01('0x30'),_0x6b01('0x31'),_0x6b01('0x32'),_0x6b01('0x33'),_0x6b01('0x34'),'whatsapp'];for(var _0x33d95d=0x0;_0x33d95d<_0x136452[_0x6b01('0x35')];_0x33d95d+=0x1){var _0x32128f=this[_0x6b01('0x29')](_0x136452[_0x33d95d]);if(this[_0x136452[_0x33d95d]+_0x6b01('0x36')]!==_0x32128f){this[_0x136452[_0x33d95d]+'StatusTime']=_['toNumber'](moment()[_0x6b01('0x37')]('x'));}this[_0x136452[_0x33d95d]+_0x6b01('0x36')]=_0x32128f;}var _0xc574c={'id':this['id'],'name':this[_0x6b01('0x7')],'online':this[_0x6b01('0x38')],'voicePause':this[_0x6b01('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0x6b01('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x6b01('0xa')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x6b01('0xd')],'chatStatusTime':this[_0x6b01('0x39')],'chatCapacity':this[_0x6b01('0xf')],'chatCurrentCapacity':this[_0x6b01('0x3a')],'mailStatus':this[_0x6b01('0x10')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x6b01('0x12')],'mailCurrentCapacity':this[_0x6b01('0x13')],'faxStatus':this[_0x6b01('0x3b')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x6b01('0x3c')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x6b01('0x16')],'smsCapacity':this[_0x6b01('0x17')],'smsCurrentCapacity':this[_0x6b01('0x18')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x6b01('0x1a')],'whatsappCapacity':this[_0x6b01('0x1b')],'whatsappCurrentCapacity':this[_0x6b01('0x3d')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x6b01('0x1d')],'openchannelCapacity':this[_0x6b01('0x1e')],'openchannelCurrentCapacity':this[_0x6b01('0x1f')],'busy':this[_0x6b01('0x20')],'busyQueue':this[_0x6b01('0x21')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x6b01('0x23')],'mailWaitingInteractions':this[_0x6b01('0x24')],'openchannelWaitingInteractions':this[_0x6b01('0x25')],'smsWaitingInteractions':this[_0x6b01('0x26')],'whatsappWaitingInteractions':this[_0x6b01('0x27')]};var _0xc644f2=md5(JSON[_0x6b01('0x3e')](_0xc574c));if(this[_0x6b01('0x1')]!==_0xc644f2){this['md5']=_0xc644f2;io[_0x6b01('0x3f')]('user:routing:update',_[_0x6b01('0x40')](_0xc574c,[_0x6b01('0x38')]));}};module[_0x6b01('0x41')]=Agent; \ No newline at end of file +var _0x3a6d=['faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','CurrentCapacity','Capacity','maxcapacity','idle','prototype','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','chatCapacity','chatCurrentCapacity','faxCurrentCapacity','smsCurrentCapacity','whatsappStatus','openchannelStatusTime','mailWaitingInteractions','stringify','omit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause'];(function(_0x39f624,_0x2f8a0b){var _0x5f3e08=function(_0x25e112){while(--_0x25e112){_0x39f624['push'](_0x39f624['shift']());}};_0x5f3e08(++_0x2f8a0b);}(_0x3a6d,0x143));var _0xd3a6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a6d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd3a6('0x0'));var md5=require(_0xd3a6('0x1'));var moment=require('moment');var Redis=require(_0xd3a6('0x2'));var config=require(_0xd3a6('0x3'));config[_0xd3a6('0x4')]=_[_0xd3a6('0x5')](config[_0xd3a6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd3a6('0x6'))(new Redis(config[_0xd3a6('0x4')]));function Agent(_0x1e44bd){this['id']=_0x1e44bd['id']||0x0;this[_0xd3a6('0x7')]=_0x1e44bd[_0xd3a6('0x7')]||'';this[_0xd3a6('0x8')]=_0x1e44bd['online']||!![];this[_0xd3a6('0x9')]=_0x1e44bd[_0xd3a6('0x9')]||![];this[_0xd3a6('0xa')]=_0x1e44bd[_0xd3a6('0xa')]||![];this[_0xd3a6('0xb')]=_0x1e44bd[_0xd3a6('0xb')]||![];this[_0xd3a6('0xc')]=_0x1e44bd[_0xd3a6('0xc')]||![];this[_0xd3a6('0xd')]=_0x1e44bd['smsPause']||![];this[_0xd3a6('0xe')]=_0x1e44bd[_0xd3a6('0xe')]||![];this[_0xd3a6('0xf')]=_0xd3a6('0x10');this[_0xd3a6('0x11')]=0x0;this['chatCapacity']=_0x1e44bd['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xd3a6('0x12')]=_0xd3a6('0x10');this[_0xd3a6('0x13')]=0x0;this[_0xd3a6('0x14')]=_0x1e44bd[_0xd3a6('0x14')]||0x0;this[_0xd3a6('0x15')]=0x0;this[_0xd3a6('0x16')]='unknown';this[_0xd3a6('0x17')]=0x0;this[_0xd3a6('0x18')]=_0x1e44bd[_0xd3a6('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xd3a6('0x19')]=_0xd3a6('0x10');this[_0xd3a6('0x1a')]=0x0;this['smsCapacity']=_0x1e44bd[_0xd3a6('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0xd3a6('0x10');this[_0xd3a6('0x1c')]=0x0;this[_0xd3a6('0x1d')]=_0x1e44bd[_0xd3a6('0x1d')]||0x0;this[_0xd3a6('0x1e')]=0x0;this[_0xd3a6('0x1f')]=_0xd3a6('0x10');this['openchannelStatusTime']=0x0;this[_0xd3a6('0x20')]=_0x1e44bd['openchannelCapacity']||0x0;this[_0xd3a6('0x21')]=0x0;this[_0xd3a6('0x22')]=![];this[_0xd3a6('0x23')]=undefined;this[_0xd3a6('0x1')]='';this[_0xd3a6('0x24')]={};this[_0xd3a6('0x25')]={};this['mailWaitingInteractions']={};this[_0xd3a6('0x26')]={};this[_0xd3a6('0x27')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent['prototype']['getChannelStatus']=function(_0x5c9075){if(this[_0x5c9075+_0xd3a6('0x28')]>0x0){if(this[_0x5c9075+_0xd3a6('0x29')]>0x0&&this[_0x5c9075+_0xd3a6('0x28')]>=this[_0x5c9075+'Capacity']){return _0xd3a6('0x2a');}else{return'working';}}else{return _0xd3a6('0x2b');}};Agent[_0xd3a6('0x2c')][_0xd3a6('0x2d')]=function(){var _0x4f6130=[_0xd3a6('0x2e'),_0xd3a6('0x2f'),_0xd3a6('0x30'),_0xd3a6('0x31'),_0xd3a6('0x32'),_0xd3a6('0x33')];for(var _0x5650d1=0x0;_0x5650d1<_0x4f6130[_0xd3a6('0x34')];_0x5650d1+=0x1){var _0x2b5448=this[_0xd3a6('0x35')](_0x4f6130[_0x5650d1]);if(this[_0x4f6130[_0x5650d1]+_0xd3a6('0x36')]!==_0x2b5448){this[_0x4f6130[_0x5650d1]+_0xd3a6('0x37')]=_[_0xd3a6('0x38')](moment()['format']('x'));}this[_0x4f6130[_0x5650d1]+'Status']=_0x2b5448;}var _0x1f4859={'id':this['id'],'name':this[_0xd3a6('0x7')],'online':this[_0xd3a6('0x8')],'voicePause':this[_0xd3a6('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xd3a6('0xb')],'smsPause':this[_0xd3a6('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xd3a6('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xd3a6('0x11')],'chatCapacity':this[_0xd3a6('0x39')],'chatCurrentCapacity':this[_0xd3a6('0x3a')],'mailStatus':this[_0xd3a6('0x12')],'mailStatusTime':this[_0xd3a6('0x13')],'mailCapacity':this[_0xd3a6('0x14')],'mailCurrentCapacity':this[_0xd3a6('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xd3a6('0x18')],'faxCurrentCapacity':this[_0xd3a6('0x3b')],'smsStatus':this[_0xd3a6('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xd3a6('0x1b')],'smsCurrentCapacity':this[_0xd3a6('0x3c')],'whatsappStatus':this[_0xd3a6('0x3d')],'whatsappStatusTime':this[_0xd3a6('0x1c')],'whatsappCapacity':this[_0xd3a6('0x1d')],'whatsappCurrentCapacity':this[_0xd3a6('0x1e')],'openchannelStatus':this[_0xd3a6('0x1f')],'openchannelStatusTime':this[_0xd3a6('0x3e')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xd3a6('0x21')],'busy':this[_0xd3a6('0x22')],'busyQueue':this[_0xd3a6('0x23')],'chatWaitingInteractions':this[_0xd3a6('0x24')],'faxWaitingInteractions':this[_0xd3a6('0x25')],'mailWaitingInteractions':this[_0xd3a6('0x3f')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xd3a6('0x27')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x263615=md5(JSON[_0xd3a6('0x40')](_0x1f4859));if(this[_0xd3a6('0x1')]!==_0x263615){this[_0xd3a6('0x1')]=_0x263615;io['emit']('user:routing:update',_[_0xd3a6('0x41')](_0x1f4859,[_0xd3a6('0x8')]));}};module[_0xd3a6('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 b8d0c4e..d2c4620 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 _0x4fc9=['updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting'];(function(_0x24b71a,_0x29bc7a){var _0x394485=function(_0x655d34){while(--_0x655d34){_0x24b71a['push'](_0x24b71a['shift']());}};_0x394485(++_0x29bc7a);}(_0x4fc9,0xe3));var _0x94fc=function(_0x331d70,_0x41de42){_0x331d70=_0x331d70-0x0;var _0x2337fc=_0x4fc9[_0x331d70];return _0x2337fc;};'use strict';var _=require(_0x94fc('0x0'));var md5=require(_0x94fc('0x1'));var util=require(_0x94fc('0x2'));var Redis=require(_0x94fc('0x3'));var config=require(_0x94fc('0x4'));config[_0x94fc('0x5')]=_['defaults'](config[_0x94fc('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x94fc('0x6'))(new Redis(config['redis']));function ChatQueue(_0x437df5){this['id']=_0x437df5['id']||0x0;this[_0x94fc('0x7')]=_0x437df5[_0x94fc('0x7')]||'';this[_0x94fc('0x8')]=_0x437df5['timeout']||0xa;this['strategy']=_0x437df5[_0x94fc('0x9')]||_0x94fc('0xa');this['Agents']=_0x437df5[_0x94fc('0xb')];this['mapAgentsId']={};this[_0x94fc('0xc')]=0x0;this[_0x94fc('0x1')]='';this['updateRouting']();this[_0x94fc('0xd')]();}ChatQueue[_0x94fc('0xe')]['updateRouting']=function(){var _0x17fefd=this['mapAgentsId']['_rr'];this[_0x94fc('0xf')]=_[_0x94fc('0x10')](this[_0x94fc('0xb')],'id');this[_0x94fc('0xf')][_0x94fc('0x11')]=_0x17fefd;};ChatQueue[_0x94fc('0xe')][_0x94fc('0xd')]=function(){this[_0x94fc('0x12')]=0x0;this[_0x94fc('0x13')]=0x0;for(var _0x47ee29=0x0;_0x47ee29=0x0?this[_0x94fc('0x17')]:0x0;var _0x41d4cb={'id':this['id'],'available':this[_0x94fc('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x94fc('0x7')],'paused':this[_0x94fc('0x13')],'waiting':this[_0x94fc('0xc')]};var _0x352d50=md5(JSON[_0x94fc('0x18')](_0x41d4cb));if(this['md5']!==_0x352d50){this[_0x94fc('0x1')]=_0x352d50;io['to'](util[_0x94fc('0x19')](_0x94fc('0x1a'),_0x41d4cb[_0x94fc('0x7')]))[_0x94fc('0x1b')](_0x94fc('0x1c'),_0x41d4cb);}};module[_0x94fc('0x1d')]=ChatQueue; \ No newline at end of file +var _0x4546=['../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','md5','ioredis'];(function(_0x48e885,_0x1b7f8a){var _0x3830a4=function(_0x27a583){while(--_0x27a583){_0x48e885['push'](_0x48e885['shift']());}};_0x3830a4(++_0x1b7f8a);}(_0x4546,0x1be));var _0x6454=function(_0x62826c,_0x4357c3){_0x62826c=_0x62826c-0x0;var _0x2d335a=_0x4546[_0x62826c];return _0x2d335a;};'use strict';var _=require('lodash');var md5=require(_0x6454('0x0'));var util=require('util');var Redis=require(_0x6454('0x1'));var config=require(_0x6454('0x2'));config['redis']=_[_0x6454('0x3')](config[_0x6454('0x4')],{'host':_0x6454('0x5'),'port':0x18eb});var io=require(_0x6454('0x6'))(new Redis(config[_0x6454('0x4')]));function ChatQueue(_0x299dc2){this['id']=_0x299dc2['id']||0x0;this[_0x6454('0x7')]=_0x299dc2['name']||'';this[_0x6454('0x8')]=_0x299dc2[_0x6454('0x8')]||0xa;this[_0x6454('0x9')]=_0x299dc2[_0x6454('0x9')]||_0x6454('0xa');this['Agents']=_0x299dc2[_0x6454('0xb')];this[_0x6454('0xc')]={};this[_0x6454('0xd')]=0x0;this[_0x6454('0x0')]='';this[_0x6454('0xe')]();this[_0x6454('0xf')]();}ChatQueue[_0x6454('0x10')]['updateRouting']=function(){var _0x40e4ae=this['mapAgentsId']['_rr'];this[_0x6454('0xc')]=_[_0x6454('0x11')](this['Agents'],'id');this[_0x6454('0xc')]['_rr']=_0x40e4ae;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x6454('0x12')]=0x0;this[_0x6454('0x13')]=0x0;for(var _0x4ee856=0x0;_0x4ee856=0x0?this[_0x6454('0x16')]:0x0;var _0x381a9e={'id':this['id'],'available':this[_0x6454('0x16')],'loggedIn':this[_0x6454('0x12')],'name':this[_0x6454('0x7')],'paused':this[_0x6454('0x13')],'waiting':this['waiting']};var _0x3d9a51=md5(JSON[_0x6454('0x17')](_0x381a9e));if(this[_0x6454('0x0')]!==_0x3d9a51){this[_0x6454('0x0')]=_0x3d9a51;io['to'](util[_0x6454('0x18')](_0x6454('0x19'),_0x381a9e[_0x6454('0x7')]))[_0x6454('0x1a')](_0x6454('0x1b'),_0x381a9e);}};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 43b2391..98d6679 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 _0xcac4=['_rr','map','loggedIn','paused','length','online','available','stringify','format','emit','fax_queue:save','exports','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting'];(function(_0x499e36,_0xc35951){var _0x95bf7b=function(_0x332fe1){while(--_0x332fe1){_0x499e36['push'](_0x499e36['shift']());}};_0x95bf7b(++_0xc35951);}(_0xcac4,0x1bc));var _0x4cac=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xcac4[_0x37a79c];return _0x561d89;};'use strict';var _=require('lodash');var md5=require(_0x4cac('0x0'));var util=require(_0x4cac('0x1'));var Redis=require(_0x4cac('0x2'));var config=require('../../../config/environment');config[_0x4cac('0x3')]=_['defaults'](config[_0x4cac('0x3')],{'host':_0x4cac('0x4'),'port':0x18eb});var io=require(_0x4cac('0x5'))(new Redis(config[_0x4cac('0x3')]));function FaxQueue(_0x458507){this['id']=_0x458507['id']||0x0;this[_0x4cac('0x6')]=_0x458507[_0x4cac('0x6')]||'';this[_0x4cac('0x7')]=_0x458507[_0x4cac('0x7')]||0xa;this['strategy']=_0x458507[_0x4cac('0x8')]||'beepall';this[_0x4cac('0x9')]=_0x458507['Agents'];this[_0x4cac('0xa')]={};this[_0x4cac('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x4cac('0xc')]();}FaxQueue[_0x4cac('0xd')][_0x4cac('0xe')]=function(){var _0x31592=this[_0x4cac('0xa')][_0x4cac('0xf')];this[_0x4cac('0xa')]=_[_0x4cac('0x10')](this[_0x4cac('0x9')],'id');this['mapAgentsId'][_0x4cac('0xf')]=_0x31592;};FaxQueue['prototype'][_0x4cac('0xc')]=function(){this[_0x4cac('0x11')]=0x0;this[_0x4cac('0x12')]=0x0;for(var _0x347f11=0x0;_0x347f11=0x0?this[_0x4cac('0x15')]:0x0;var _0x128cf0={'id':this['id'],'available':this[_0x4cac('0x15')],'loggedIn':this[_0x4cac('0x11')],'name':this['name'],'paused':this[_0x4cac('0x12')],'waiting':this[_0x4cac('0xb')]};var _0x228464=md5(JSON[_0x4cac('0x16')](_0x128cf0));if(this[_0x4cac('0x0')]!==_0x228464){this[_0x4cac('0x0')]=_0x228464;io['to'](util[_0x4cac('0x17')]('fax:queue:%s',_0x128cf0[_0x4cac('0x6')]))[_0x4cac('0x18')](_0x4cac('0x19'),_0x128cf0);}};module[_0x4cac('0x1a')]=FaxQueue; \ No newline at end of file +var _0x237d=['emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s'];(function(_0x14cdd1,_0x52baaf){var _0x233641=function(_0x4282eb){while(--_0x4282eb){_0x14cdd1['push'](_0x14cdd1['shift']());}};_0x233641(++_0x52baaf);}(_0x237d,0x188));var _0xd237=function(_0x22b725,_0x80e5f4){_0x22b725=_0x22b725-0x0;var _0x19e57a=_0x237d[_0x22b725];return _0x19e57a;};'use strict';var _=require(_0xd237('0x0'));var md5=require(_0xd237('0x1'));var util=require('util');var Redis=require(_0xd237('0x2'));var config=require(_0xd237('0x3'));config[_0xd237('0x4')]=_[_0xd237('0x5')](config[_0xd237('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd237('0x6'))(new Redis(config[_0xd237('0x4')]));function FaxQueue(_0x13732e){this['id']=_0x13732e['id']||0x0;this[_0xd237('0x7')]=_0x13732e['name']||'';this[_0xd237('0x8')]=_0x13732e[_0xd237('0x8')]||0xa;this[_0xd237('0x9')]=_0x13732e[_0xd237('0x9')]||_0xd237('0xa');this[_0xd237('0xb')]=_0x13732e['Agents'];this[_0xd237('0xc')]={};this[_0xd237('0xd')]=0x0;this['md5']='';this[_0xd237('0xe')]();this[_0xd237('0xf')]();}FaxQueue[_0xd237('0x10')]['updateRouting']=function(){var _0x406444=this[_0xd237('0xc')][_0xd237('0x11')];this['mapAgentsId']=_[_0xd237('0x12')](this[_0xd237('0xb')],'id');this[_0xd237('0xc')][_0xd237('0x11')]=_0x406444;};FaxQueue[_0xd237('0x10')][_0xd237('0xf')]=function(){this[_0xd237('0x13')]=0x0;this[_0xd237('0x14')]=0x0;for(var _0x2d49e0=0x0;_0x2d49e0=0x0?this[_0xd237('0x18')]:0x0;var _0x3e730b={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd237('0x13')],'name':this[_0xd237('0x7')],'paused':this[_0xd237('0x14')],'waiting':this[_0xd237('0xd')]};var _0x75ed5a=md5(JSON[_0xd237('0x19')](_0x3e730b));if(this[_0xd237('0x1')]!==_0x75ed5a){this[_0xd237('0x1')]=_0x75ed5a;io['to'](util[_0xd237('0x1a')](_0xd237('0x1b'),_0x3e730b[_0xd237('0x7')]))[_0xd237('0x1c')]('fax_queue:save',_0x3e730b);}};module[_0xd237('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index e79b1d4..374110f 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. * // * * // ************************************************************************* -'use strict';function Interval(_0x3511ae){this['id']=_0x3511ae['id']||0x0;this['name']=_0x3511ae['name']||'';this['Intervals']=_0x3511ae['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0xb01d=['Intervals','exports','name'];(function(_0x54c181,_0x4ee31f){var _0x336c25=function(_0x399617){while(--_0x399617){_0x54c181['push'](_0x54c181['shift']());}};_0x336c25(++_0x4ee31f);}(_0xb01d,0xb3));var _0xdb01=function(_0x4f2c17,_0x4719f8){_0x4f2c17=_0x4f2c17-0x0;var _0xc52a02=_0xb01d[_0x4f2c17];return _0xc52a02;};'use strict';function Interval(_0x501ebb){this['id']=_0x501ebb['id']||0x0;this[_0xdb01('0x0')]=_0x501ebb[_0xdb01('0x0')]||'';this[_0xdb01('0x1')]=_0x501ebb['Intervals']||{};}module[_0xdb01('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 0894a34..98c3ec9 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 _0xd08f=['prototype','_rr','map','updateRealtime','loggedIn','online','mailPause','paused','available','format','mail:queue:%s','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x2392c4,_0x6f8864){var _0x2a2ed5=function(_0x536390){while(--_0x536390){_0x2392c4['push'](_0x2392c4['shift']());}};_0x2a2ed5(++_0x6f8864);}(_0xd08f,0x177));var _0xfd08=function(_0x3a04e2,_0x538c49){_0x3a04e2=_0x3a04e2-0x0;var _0x4da265=_0xd08f[_0x3a04e2];return _0x4da265;};'use strict';var _=require(_0xfd08('0x0'));var md5=require(_0xfd08('0x1'));var util=require(_0xfd08('0x2'));var Redis=require(_0xfd08('0x3'));var config=require(_0xfd08('0x4'));config[_0xfd08('0x5')]=_['defaults'](config['redis'],{'host':_0xfd08('0x6'),'port':0x18eb});var io=require(_0xfd08('0x7'))(new Redis(config[_0xfd08('0x5')]));function MailQueue(_0xfe761c){this['id']=_0xfe761c['id']||0x0;this[_0xfd08('0x8')]=_0xfe761c[_0xfd08('0x8')]||'';this[_0xfd08('0x9')]=_0xfe761c[_0xfd08('0x9')]||0xa;this[_0xfd08('0xa')]=_0xfe761c[_0xfd08('0xa')]||_0xfd08('0xb');this[_0xfd08('0xc')]=_0xfe761c['Agents'];this[_0xfd08('0xd')]={};this[_0xfd08('0xe')]=0x0;this[_0xfd08('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0xfd08('0xf')]['updateRouting']=function(){var _0xa47cad=this[_0xfd08('0xd')][_0xfd08('0x10')];this[_0xfd08('0xd')]=_[_0xfd08('0x11')](this['Agents'],'id');this[_0xfd08('0xd')]['_rr']=_0xa47cad;};MailQueue['prototype'][_0xfd08('0x12')]=function(){this[_0xfd08('0x13')]=0x0;this['paused']=0x0;for(var _0x5f25a9=0x0;_0x5f25a9=0x0?this['available']:0x0;var _0xbd888f={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xfd08('0x8')],'paused':this[_0xfd08('0x16')],'waiting':this[_0xfd08('0xe')]};var _0x57e2d0=md5(JSON['stringify'](_0xbd888f));if(this[_0xfd08('0x1')]!==_0x57e2d0){this[_0xfd08('0x1')]=_0x57e2d0;io['to'](util[_0xfd08('0x18')](_0xfd08('0x19'),_0xbd888f[_0xfd08('0x8')]))['emit']('mail_queue:save',_0xbd888f);}};module['exports']=MailQueue; \ No newline at end of file +var _0x6da5=['beepall','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','Agents','length','online','mailPause','paused','available','loggedIn','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy'];(function(_0x459b01,_0x59ede4){var _0x2153aa=function(_0x5549b1){while(--_0x5549b1){_0x459b01['push'](_0x459b01['shift']());}};_0x2153aa(++_0x59ede4);}(_0x6da5,0xaf));var _0x56da=function(_0x4b8883,_0x5d6caf){_0x4b8883=_0x4b8883-0x0;var _0x289d14=_0x6da5[_0x4b8883];return _0x289d14;};'use strict';var _=require(_0x56da('0x0'));var md5=require(_0x56da('0x1'));var util=require(_0x56da('0x2'));var Redis=require(_0x56da('0x3'));var config=require(_0x56da('0x4'));config[_0x56da('0x5')]=_[_0x56da('0x6')](config[_0x56da('0x5')],{'host':_0x56da('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x56da('0x5')]));function MailQueue(_0x4e9ace){this['id']=_0x4e9ace['id']||0x0;this[_0x56da('0x8')]=_0x4e9ace[_0x56da('0x8')]||'';this[_0x56da('0x9')]=_0x4e9ace[_0x56da('0x9')]||0xa;this[_0x56da('0xa')]=_0x4e9ace[_0x56da('0xa')]||_0x56da('0xb');this['Agents']=_0x4e9ace['Agents'];this['mapAgentsId']={};this[_0x56da('0xc')]=0x0;this[_0x56da('0x1')]='';this[_0x56da('0xd')]();this[_0x56da('0xe')]();}MailQueue[_0x56da('0xf')][_0x56da('0xd')]=function(){var _0x1cd501=this[_0x56da('0x10')][_0x56da('0x11')];this[_0x56da('0x10')]=_[_0x56da('0x12')](this[_0x56da('0x13')],'id');this['mapAgentsId'][_0x56da('0x11')]=_0x1cd501;};MailQueue[_0x56da('0xf')][_0x56da('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4c87b7=0x0;_0x4c87b7=0x0?this[_0x56da('0x18')]:0x0;var _0x33a3b4={'id':this['id'],'available':this[_0x56da('0x18')],'loggedIn':this[_0x56da('0x19')],'name':this[_0x56da('0x8')],'paused':this[_0x56da('0x17')],'waiting':this[_0x56da('0xc')]};var _0x573cac=md5(JSON[_0x56da('0x1a')](_0x33a3b4));if(this['md5']!==_0x573cac){this[_0x56da('0x1')]=_0x573cac;io['to'](util['format'](_0x56da('0x1b'),_0x33a3b4[_0x56da('0x8')]))[_0x56da('0x1c')](_0x56da('0x1d'),_0x33a3b4);}};module[_0x56da('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 096505b..b0edd73 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0x2ef3,0xba));var _0x32ef=function(_0x5d54d4,_0x2ea95a){_0x5d54d4=_0x5d54d4-0x0;var _0x41e674=_0x2ef3[_0x5d54d4];return _0x41e674;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index e1f0e2c..d532105 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 _0x5636=['stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','paused','length','online','smsPause','available','waiting'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5636,0x102));var _0x6563=function(_0x3d13fc,_0x9b083d){_0x3d13fc=_0x3d13fc-0x0;var _0x15430=_0x5636[_0x3d13fc];return _0x15430;};'use strict';var _=require(_0x6563('0x0'));var md5=require(_0x6563('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6563('0x2')]=_[_0x6563('0x3')](config[_0x6563('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x6563('0x4'))(new Redis(config[_0x6563('0x2')]));function SmsQueue(_0x453da9){this['id']=_0x453da9['id']||0x0;this[_0x6563('0x5')]=_0x453da9[_0x6563('0x5')]||'';this[_0x6563('0x6')]=_0x453da9[_0x6563('0x6')]||0xa;this[_0x6563('0x7')]=_0x453da9[_0x6563('0x7')]||_0x6563('0x8');this[_0x6563('0x9')]=_0x453da9[_0x6563('0x9')];this[_0x6563('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0x6563('0xb')]();this[_0x6563('0xc')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x5da960=this[_0x6563('0xa')][_0x6563('0xd')];this[_0x6563('0xa')]=_[_0x6563('0xe')](this[_0x6563('0x9')],'id');this[_0x6563('0xa')][_0x6563('0xd')]=_0x5da960;};SmsQueue[_0x6563('0xf')][_0x6563('0xc')]=function(){this['loggedIn']=0x0;this[_0x6563('0x10')]=0x0;for(var _0x5e9329=0x0;_0x5e9329=0x0?this['available']:0x0;var _0x14c6a6={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x6563('0x5')],'paused':this[_0x6563('0x10')],'waiting':this[_0x6563('0x15')]};var _0x37f493=md5(JSON[_0x6563('0x16')](_0x14c6a6));if(this[_0x6563('0x1')]!==_0x37f493){this[_0x6563('0x1')]=_0x37f493;io['to'](util[_0x6563('0x17')](_0x6563('0x18'),_0x14c6a6['name']))[_0x6563('0x19')](_0x6563('0x1a'),_0x14c6a6);}};module[_0x6563('0x1b')]=SmsQueue; \ No newline at end of file +var _0x3b75=['updateRouting','updateRealtime','prototype','_rr','map','mapAgentsId','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','strategy','beepall','Agents','waiting'];(function(_0x5d269b,_0x3c9f75){var _0x59a8f3=function(_0x23e329){while(--_0x23e329){_0x5d269b['push'](_0x5d269b['shift']());}};_0x59a8f3(++_0x3c9f75);}(_0x3b75,0x144));var _0x53b7=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0x3b75[_0x249e96];return _0x17444c;};'use strict';var _=require(_0x53b7('0x0'));var md5=require(_0x53b7('0x1'));var util=require(_0x53b7('0x2'));var Redis=require(_0x53b7('0x3'));var config=require(_0x53b7('0x4'));config[_0x53b7('0x5')]=_[_0x53b7('0x6')](config[_0x53b7('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x53b7('0x5')]));function SmsQueue(_0x2f8b3d){this['id']=_0x2f8b3d['id']||0x0;this[_0x53b7('0x7')]=_0x2f8b3d[_0x53b7('0x7')]||'';this['timeout']=_0x2f8b3d['timeout']||0xa;this[_0x53b7('0x8')]=_0x2f8b3d[_0x53b7('0x8')]||_0x53b7('0x9');this[_0x53b7('0xa')]=_0x2f8b3d[_0x53b7('0xa')];this['mapAgentsId']={};this[_0x53b7('0xb')]=0x0;this[_0x53b7('0x1')]='';this[_0x53b7('0xc')]();this[_0x53b7('0xd')]();}SmsQueue[_0x53b7('0xe')][_0x53b7('0xc')]=function(){var _0x4d8a1f=this['mapAgentsId'][_0x53b7('0xf')];this['mapAgentsId']=_[_0x53b7('0x10')](this['Agents'],'id');this[_0x53b7('0x11')][_0x53b7('0xf')]=_0x4d8a1f;};SmsQueue[_0x53b7('0xe')]['updateRealtime']=function(){this[_0x53b7('0x12')]=0x0;this[_0x53b7('0x13')]=0x0;for(var _0x4a64f4=0x0;_0x4a64f4=0x0?this[_0x53b7('0x16')]:0x0;var _0x47da7c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x53b7('0x7')],'paused':this[_0x53b7('0x13')],'waiting':this[_0x53b7('0xb')]};var _0x113cb7=md5(JSON[_0x53b7('0x17')](_0x47da7c));if(this[_0x53b7('0x1')]!==_0x113cb7){this[_0x53b7('0x1')]=_0x113cb7;io['to'](util[_0x53b7('0x18')](_0x53b7('0x19'),_0x47da7c[_0x53b7('0x7')]))['emit'](_0x53b7('0x1a'),_0x47da7c);}};module[_0x53b7('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7cd48db..4daa98e 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 _0x2987=['paused','online','whatsappPause','available','stringify','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','map','prototype','updateRealtime','loggedIn'];(function(_0x42b384,_0x3bc376){var _0x57ca16=function(_0xbb454a){while(--_0xbb454a){_0x42b384['push'](_0x42b384['shift']());}};_0x57ca16(++_0x3bc376);}(_0x2987,0x1cf));var _0x7298=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x2987[_0x450bf9];return _0x268350;};'use strict';var _=require('lodash');var md5=require(_0x7298('0x0'));var util=require(_0x7298('0x1'));var Redis=require(_0x7298('0x2'));var config=require(_0x7298('0x3'));config[_0x7298('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7298('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x43b51c){this['id']=_0x43b51c['id']||0x0;this['name']=_0x43b51c[_0x7298('0x6')]||'';this[_0x7298('0x7')]=_0x43b51c['timeout']||0xa;this[_0x7298('0x8')]=_0x43b51c[_0x7298('0x8')]||'beepall';this[_0x7298('0x9')]=_0x43b51c['Agents'];this[_0x7298('0xa')]={};this[_0x7298('0xb')]=0x0;this['md5']='';this[_0x7298('0xc')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x7298('0xc')]=function(){var _0x1f1b39=this[_0x7298('0xa')]['_rr'];this[_0x7298('0xa')]=_[_0x7298('0xd')](this['Agents'],'id');this[_0x7298('0xa')]['_rr']=_0x1f1b39;};WhatsappQueue[_0x7298('0xe')][_0x7298('0xf')]=function(){this[_0x7298('0x10')]=0x0;this[_0x7298('0x11')]=0x0;for(var _0x379433=0x0;_0x379433=0x0?this[_0x7298('0x14')]:0x0;var _0x89634={'id':this['id'],'available':this[_0x7298('0x14')],'loggedIn':this[_0x7298('0x10')],'name':this['name'],'paused':this[_0x7298('0x11')],'waiting':this[_0x7298('0xb')]};var _0x5102ad=md5(JSON[_0x7298('0x15')](_0x89634));if(this[_0x7298('0x0')]!==_0x5102ad){this[_0x7298('0x0')]=_0x5102ad;io['to'](util['format']('whatsapp:queue:%s',_0x89634['name']))['emit'](_0x7298('0x16'),_0x89634);}};module[_0x7298('0x17')]=WhatsappQueue; \ No newline at end of file +var _0x1c48=['emit','whatsapp_queue:save','exports','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','md5','whatsapp:queue:%s'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0x1c48,0x111));var _0x81c4=function(_0x56bd3e,_0x26f679){_0x56bd3e=_0x56bd3e-0x0;var _0x1a5780=_0x1c48[_0x56bd3e];return _0x1a5780;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x81c4('0x0'));var Redis=require('ioredis');var config=require(_0x81c4('0x1'));config[_0x81c4('0x2')]=_[_0x81c4('0x3')](config[_0x81c4('0x2')],{'host':_0x81c4('0x4'),'port':0x18eb});var io=require(_0x81c4('0x5'))(new Redis(config[_0x81c4('0x2')]));function WhatsappQueue(_0x1ef98c){this['id']=_0x1ef98c['id']||0x0;this['name']=_0x1ef98c[_0x81c4('0x6')]||'';this[_0x81c4('0x7')]=_0x1ef98c[_0x81c4('0x7')]||0xa;this[_0x81c4('0x8')]=_0x1ef98c['strategy']||_0x81c4('0x9');this[_0x81c4('0xa')]=_0x1ef98c[_0x81c4('0xa')];this[_0x81c4('0xb')]={};this[_0x81c4('0xc')]=0x0;this['md5']='';this[_0x81c4('0xd')]();this[_0x81c4('0xe')]();}WhatsappQueue[_0x81c4('0xf')][_0x81c4('0xd')]=function(){var _0x26b282=this['mapAgentsId'][_0x81c4('0x10')];this[_0x81c4('0xb')]=_['map'](this[_0x81c4('0xa')],'id');this[_0x81c4('0xb')]['_rr']=_0x26b282;};WhatsappQueue[_0x81c4('0xf')]['updateRealtime']=function(){this[_0x81c4('0x11')]=0x0;this[_0x81c4('0x12')]=0x0;for(var _0x2a484f=0x0;_0x2a484f=0x0?this[_0x81c4('0x15')]:0x0;var _0x107a57={'id':this['id'],'available':this[_0x81c4('0x15')],'loggedIn':this[_0x81c4('0x11')],'name':this['name'],'paused':this[_0x81c4('0x12')],'waiting':this[_0x81c4('0xc')]};var _0x431687=md5(JSON['stringify'](_0x107a57));if(this[_0x81c4('0x16')]!==_0x431687){this[_0x81c4('0x16')]=_0x431687;io['to'](util['format'](_0x81c4('0x17'),_0x107a57[_0x81c4('0x6')]))[_0x81c4('0x18')](_0x81c4('0x19'),_0x107a57);}};module[_0x81c4('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 1be50ac..fc1de82 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(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 271dd61..3cb0b93 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 _0x1ba2=['addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ba2,0x1c1));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x21ba('0x0'));exports['update']=function(_0x4570fa,_0x2310f6){return client[_0x21ba('0x1')](_0x21ba('0x2'),{'body':_0x2310f6,'options':{'where':{'id':_0x4570fa}},'log':_0x21ba('0x3')});};exports[_0x21ba('0x4')]=function(_0x17c7bf,_0x21d45f){return client['Request'](_0x21ba('0x5'),{'body':_0x21d45f,'options':{'where':{'id':_0x17c7bf}},'log':_0x21ba('0x6')});}; \ No newline at end of file +var _0x2782=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x481d81,_0x3a0e30){var _0x3035ab=function(_0x8112e2){while(--_0x8112e2){_0x481d81['push'](_0x481d81['shift']());}};_0x3035ab(++_0x3a0e30);}(_0x2782,0xc3));var _0x2278=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x2782[_0x209ec9];return _0x129b1b;};'use strict';var client=require(_0x2278('0x0'));exports[_0x2278('0x1')]=function(_0x18353f,_0xfc4900){return client[_0x2278('0x2')](_0x2278('0x3'),{'body':_0xfc4900,'options':{'where':{'id':_0x18353f}},'log':_0x2278('0x4')});};exports[_0x2278('0x5')]=function(_0x457aa9,_0x5b13aa){return client[_0x2278('0x2')]('AddTagsToChatInteraction',{'body':_0x5b13aa,'options':{'where':{'id':_0x457aa9}},'log':_0x2278('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1d22b11..b53c294 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 _0x6e0a=['../client','create','CreateChatMessage'];(function(_0x19cf70,_0x1f36e5){var _0x9e0532=function(_0x1128a2){while(--_0x1128a2){_0x19cf70['push'](_0x19cf70['shift']());}};_0x9e0532(++_0x1f36e5);}(_0x6e0a,0x16b));var _0xa6e0=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x6e0a[_0x46ae5a];return _0x434986;};'use strict';var client=require(_0xa6e0('0x0'));exports[_0xa6e0('0x1')]=function(_0x2a4be1){return client['Request'](_0xa6e0('0x2'),{'body':_0x2a4be1,'log':'createChatMessage'});}; \ No newline at end of file +var _0x435f=['CreateChatMessage','../client','create'];(function(_0x2ccd45,_0x14363c){var _0x463dc4=function(_0x43c258){while(--_0x43c258){_0x2ccd45['push'](_0x2ccd45['shift']());}};_0x463dc4(++_0x14363c);}(_0x435f,0x15a));var _0xf435=function(_0x59a5b4,_0x17d273){_0x59a5b4=_0x59a5b4-0x0;var _0x46243d=_0x435f[_0x59a5b4];return _0x46243d;};'use strict';var client=require(_0xf435('0x0'));exports[_0xf435('0x1')]=function(_0x410e36){return client['Request'](_0xf435('0x2'),{'body':_0x410e36,'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 6500d8a..42ec7a6 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 _0x16cc=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','online','chatPause'];(function(_0x9a87df,_0x216aa4){var _0x4f64b4=function(_0x7685d6){while(--_0x7685d6){_0x9a87df['push'](_0x9a87df['shift']());}};_0x4f64b4(++_0x216aa4);}(_0x16cc,0x120));var _0xc16c=function(_0x3e81f9,_0xbf7a4a){_0x3e81f9=_0x3e81f9-0x0;var _0x370c40=_0x16cc[_0x3e81f9];return _0x370c40;};'use strict';var client=require('../client');exports[_0xc16c('0x0')]=function(){return function(){return client[_0xc16c('0x1')](_0xc16c('0x2'),{'options':{'raw':![],'attributes':['id',_0xc16c('0x3'),_0xc16c('0x4'),_0xc16c('0x5')],'include':[{'model':_0xc16c('0x6'),'as':'Agents','attributes':['id',_0xc16c('0x3'),_0xc16c('0x7'),_0xc16c('0x8')]}]},'log':_0xc16c('0x0')});};}; \ No newline at end of file +var _0xe4b8=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','online','chatPause','../client'];(function(_0xa375cd,_0x3c14ca){var _0x1217cd=function(_0xbb44be){while(--_0xbb44be){_0xa375cd['push'](_0xa375cd['shift']());}};_0x1217cd(++_0x3c14ca);}(_0xe4b8,0x179));var _0x8e4b=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe4b8[_0x2be8c2];return _0x97f531;};'use strict';var client=require(_0x8e4b('0x0'));exports[_0x8e4b('0x1')]=function(){return function(){return client[_0x8e4b('0x2')](_0x8e4b('0x3'),{'options':{'raw':![],'attributes':['id',_0x8e4b('0x4'),_0x8e4b('0x5'),_0x8e4b('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x8e4b('0x4'),_0x8e4b('0x7'),_0x8e4b('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index ea8a450..29fcf2c 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 _0x225c=['Request','UpdateChatQueueReport','DESC','../client','create','CreateChatQueueReport','update'];(function(_0x4356f2,_0x391262){var _0x3690d2=function(_0x152108){while(--_0x152108){_0x4356f2['push'](_0x4356f2['shift']());}};_0x3690d2(++_0x391262);}(_0x225c,0x106));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0xc225('0x0'));exports[_0xc225('0x1')]=function(_0x4882b7){return client['Request'](_0xc225('0x2'),{'body':_0x4882b7,'log':'CreateChatQueueReport'});};exports[_0xc225('0x3')]=function(_0xc96c33,_0x4778ea){return client[_0xc225('0x4')](_0xc225('0x5'),{'body':_0x4778ea,'options':{'where':{'uniqueid':_0xc96c33},'order':[['id',_0xc225('0x6')]],'limit':0x1},'log':_0xc225('0x5')});}; \ No newline at end of file +var _0x57d4=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x333806,_0x22743d){var _0x1063a4=function(_0x3481f7){while(--_0x3481f7){_0x333806['push'](_0x333806['shift']());}};_0x1063a4(++_0x22743d);}(_0x57d4,0x78));var _0x457d=function(_0x4ed10d,_0x20ef73){_0x4ed10d=_0x4ed10d-0x0;var _0x3c7f63=_0x57d4[_0x4ed10d];return _0x3c7f63;};'use strict';var client=require(_0x457d('0x0'));exports[_0x457d('0x1')]=function(_0x47a573){return client[_0x457d('0x2')](_0x457d('0x3'),{'body':_0x47a573,'log':_0x457d('0x3')});};exports[_0x457d('0x4')]=function(_0x1219e1,_0x3c89b2){return client[_0x457d('0x2')](_0x457d('0x5'),{'body':_0x3c89b2,'options':{'where':{'uniqueid':_0x1219e1},'order':[['id',_0x457d('0x6')]],'limit':0x1},'log':_0x457d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 5de3c91..17b4393 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0x7a54,0x106));var _0x47a5=function(_0x1e7cb7,_0x380b73){_0x1e7cb7=_0x1e7cb7-0x0;var _0x11998b=_0x7a54[_0x1e7cb7];return _0x11998b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x7a54,0x106));var _0x47a5=function(_0x2fc097,_0x4edd6d){_0x2fc097=_0x2fc097-0x0;var _0x22d5d=_0x7a54[_0x2fc097];return _0x22d5d;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index fdbb419..3cab2d2 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 _0xcfc2=['Request','CreateFaxMessage','../client','create'];(function(_0x47d400,_0x135670){var _0x340d94=function(_0x1625b5){while(--_0x1625b5){_0x47d400['push'](_0x47d400['shift']());}};_0x340d94(++_0x135670);}(_0xcfc2,0x8e));var _0x2cfc=function(_0xde94e8,_0x1a062b){_0xde94e8=_0xde94e8-0x0;var _0x538663=_0xcfc2[_0xde94e8];return _0x538663;};'use strict';var client=require(_0x2cfc('0x0'));exports[_0x2cfc('0x1')]=function(_0x273766){return client[_0x2cfc('0x2')](_0x2cfc('0x3'),{'body':_0x273766,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xddcd=['../client','create','Request','createFaxMessage'];(function(_0x129a63,_0x47489e){var _0x42751f=function(_0x4de638){while(--_0x4de638){_0x129a63['push'](_0x129a63['shift']());}};_0x42751f(++_0x47489e);}(_0xddcd,0xe4));var _0xdddc=function(_0x8a0201,_0x43c9a3){_0x8a0201=_0x8a0201-0x0;var _0x567440=_0xddcd[_0x8a0201];return _0x567440;};'use strict';var client=require(_0xdddc('0x0'));exports[_0xdddc('0x1')]=function(_0x28387f){return client[_0xdddc('0x2')]('CreateFaxMessage',{'body':_0x28387f,'log':_0xdddc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 5fa08a5..48d0a38 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 _0x7efb=['name','faxPause','getFaxQueues','../client','GetFaxQueue','timeout','strategy','User','Agents'];(function(_0x52c0db,_0xfbbbf4){var _0x1cda9f=function(_0x3e0acf){while(--_0x3e0acf){_0x52c0db['push'](_0x52c0db['shift']());}};_0x1cda9f(++_0xfbbbf4);}(_0x7efb,0x1e9));var _0xb7ef=function(_0x201701,_0x33c30c){_0x201701=_0x201701-0x0;var _0x536b03=_0x7efb[_0x201701];return _0x536b03;};'use strict';var client=require(_0xb7ef('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0xb7ef('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xb7ef('0x2'),_0xb7ef('0x3')],'include':[{'model':_0xb7ef('0x4'),'as':_0xb7ef('0x5'),'attributes':['id',_0xb7ef('0x6'),'online',_0xb7ef('0x7')]}]},'log':_0xb7ef('0x8')});};}; \ No newline at end of file +var _0x3da0=['GetFaxQueue','timeout','Agents','name','online','../client','Request'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x3da0,0xb4));var _0x03da=function(_0x564e9f,_0x225a15){_0x564e9f=_0x564e9f-0x0;var _0x3a9f3e=_0x3da0[_0x564e9f];return _0x3a9f3e;};'use strict';var client=require(_0x03da('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x03da('0x1')](_0x03da('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x03da('0x3'),'strategy'],'include':[{'model':'User','as':_0x03da('0x4'),'attributes':['id',_0x03da('0x5'),_0x03da('0x6'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d1fb9c2..653d065 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 _0x5a7e=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x46a55e,_0xe095bf){var _0x2648a8=function(_0x16616f){while(--_0x16616f){_0x46a55e['push'](_0x46a55e['shift']());}};_0x2648a8(++_0xe095bf);}(_0x5a7e,0x1be));var _0xe5a7=function(_0x378473,_0x540ea5){_0x378473=_0x378473-0x0;var _0x2606c6=_0x5a7e[_0x378473];return _0x2606c6;};'use strict';var client=require(_0xe5a7('0x0'));exports[_0xe5a7('0x1')]=function(_0x3113a5){return client[_0xe5a7('0x2')](_0xe5a7('0x3'),{'body':_0x3113a5,'log':_0xe5a7('0x3')});};exports[_0xe5a7('0x4')]=function(_0x43f3a8,_0x3270ad){return client['Request'](_0xe5a7('0x5'),{'body':_0x3270ad,'options':{'where':{'uniqueid':_0x43f3a8},'order':[['id',_0xe5a7('0x6')]],'limit':0x1},'log':_0xe5a7('0x5')});}; \ No newline at end of file +var _0x049d=['Request','CreateFaxQueueReport','DESC','create'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x049d,0xc3));var _0xd049=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x049d[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xd049('0x0')]=function(_0x4cdae8){return client[_0xd049('0x1')](_0xd049('0x2'),{'body':_0x4cdae8,'log':_0xd049('0x2')});};exports['update']=function(_0x329165,_0x44fa9c){return client['Request']('UpdateFaxQueueReport',{'body':_0x44fa9c,'options':{'where':{'uniqueid':_0x329165},'order':[['id',_0xd049('0x3')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 25ff1ac..7a3a0d1 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 _0x2b3a=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval','../client'];(function(_0x2da8e3,_0x397415){var _0x281fd5=function(_0x1d9db5){while(--_0x1d9db5){_0x2da8e3['push'](_0x2da8e3['shift']());}};_0x281fd5(++_0x397415);}(_0x2b3a,0x97));var _0xa2b3=function(_0x446520,_0x54752d){_0x446520=_0x446520-0x0;var _0x19d390=_0x2b3a[_0x446520];return _0x19d390;};'use strict';var client=require(_0xa2b3('0x0'));exports[_0xa2b3('0x1')]=function(){return function(){return client[_0xa2b3('0x2')](_0xa2b3('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa2b3('0x4')],'include':[{'model':_0xa2b3('0x5'),'as':_0xa2b3('0x6'),'attributes':['id','name',_0xa2b3('0x7')]}]},'log':_0xa2b3('0x1')});};}; \ No newline at end of file +var _0x637b=['Request','GetInterval','name','Intervals','interval','getIntervals'];(function(_0x48ab5e,_0x4f703c){var _0x578b0b=function(_0x3fdec7){while(--_0x3fdec7){_0x48ab5e['push'](_0x48ab5e['shift']());}};_0x578b0b(++_0x4f703c);}(_0x637b,0xad));var _0xb637=function(_0x296689,_0x48d426){_0x296689=_0x296689-0x0;var _0x387e28=_0x637b[_0x296689];return _0x387e28;};'use strict';var client=require('../client');exports[_0xb637('0x0')]=function(){return function(){return client[_0xb637('0x1')](_0xb637('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb637('0x3')],'include':[{'model':'Interval','as':_0xb637('0x4'),'attributes':['id','name',_0xb637('0x5')]}]},'log':_0xb637('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 81fa121..01c8e9e 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 _0x4325=['update','Request','UpdateMailInteraction','addTagsToChatInteraction','../client'];(function(_0x233385,_0x2bc576){var _0x4d016a=function(_0x5deb73){while(--_0x5deb73){_0x233385['push'](_0x233385['shift']());}};_0x4d016a(++_0x2bc576);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5432('0x0'));exports[_0x5432('0x1')]=function(_0x5aa4b8,_0x3f491f){return client[_0x5432('0x2')](_0x5432('0x3'),{'body':_0x3f491f,'options':{'where':{'id':_0x5aa4b8}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x20f704,_0x36ce53){return client[_0x5432('0x2')]('AddTagsToMailInteraction',{'body':_0x36ce53,'options':{'where':{'id':_0x20f704}},'log':_0x5432('0x4')});}; \ No newline at end of file +var _0x7096=['AddTagsToMailInteraction','addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x487702,_0x49f5d4){var _0x5e7150=function(_0x2b2b29){while(--_0x2b2b29){_0x487702['push'](_0x487702['shift']());}};_0x5e7150(++_0x49f5d4);}(_0x7096,0x10c));var _0x6709=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7096[_0xbb091];return _0x467a04;};'use strict';var client=require('../client');exports[_0x6709('0x0')]=function(_0x5035b7,_0x253760){return client['Request'](_0x6709('0x1'),{'body':_0x253760,'options':{'where':{'id':_0x5035b7}},'log':_0x6709('0x2')});};exports[_0x6709('0x3')]=function(_0xccdcb5,_0x3cd087){return client[_0x6709('0x4')](_0x6709('0x5'),{'body':_0x3cd087,'options':{'where':{'id':_0xccdcb5}},'log':_0x6709('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 88521fe..a322726 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 _0x66e1=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x4e0dda,_0x561be9){var _0x2a0a03=function(_0x2fcb72){while(--_0x2fcb72){_0x4e0dda['push'](_0x4e0dda['shift']());}};_0x2a0a03(++_0x561be9);}(_0x66e1,0x1a2));var _0x166e=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x66e1[_0x1e4360];return _0x31e6b4;};'use strict';var client=require(_0x166e('0x0'));exports[_0x166e('0x1')]=function(_0x45ccb0){return client[_0x166e('0x2')](_0x166e('0x3'),{'body':_0x45ccb0,'log':_0x166e('0x4')});}; \ No newline at end of file +var _0xe670=['CreateMailMessage','../client','create'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0xe670,0x193));var _0x0e67=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0xe670[_0x17882c];return _0x355a59;};'use strict';var client=require(_0x0e67('0x0'));exports[_0x0e67('0x1')]=function(_0x3a237d){return client['Request'](_0x0e67('0x2'),{'body':_0x3a237d,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 409d82f..4346073 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 _0xc281=['Agents','mailPause','../client','getMailQueues','name','timeout','strategy','User'];(function(_0x4c8d90,_0x2b7e1e){var _0xd4e588=function(_0x384a6c){while(--_0x384a6c){_0x4c8d90['push'](_0x4c8d90['shift']());}};_0xd4e588(++_0x2b7e1e);}(_0xc281,0x1b2));var _0x1c28=function(_0x8a0d94,_0x16fcee){_0x8a0d94=_0x8a0d94-0x0;var _0x48f382=_0xc281[_0x8a0d94];return _0x48f382;};'use strict';var client=require(_0x1c28('0x0'));exports[_0x1c28('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x1c28('0x2'),_0x1c28('0x3'),_0x1c28('0x4')],'include':[{'model':_0x1c28('0x5'),'as':_0x1c28('0x6'),'attributes':['id','name','online',_0x1c28('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xbb20=['User','Agents','online','mailPause','getMailQueues','GetMailQueue','name'];(function(_0x51a725,_0x163041){var _0x2167a8=function(_0x4a05ea){while(--_0x4a05ea){_0x51a725['push'](_0x51a725['shift']());}};_0x2167a8(++_0x163041);}(_0xbb20,0x17e));var _0x0bb2=function(_0x34f964,_0xbd4421){_0x34f964=_0x34f964-0x0;var _0x45a451=_0xbb20[_0x34f964];return _0x45a451;};'use strict';var client=require('../client');exports[_0x0bb2('0x0')]=function(){return function(){return client['Request'](_0x0bb2('0x1'),{'options':{'raw':![],'attributes':['id',_0x0bb2('0x2'),'timeout','strategy'],'include':[{'model':_0x0bb2('0x3'),'as':_0x0bb2('0x4'),'attributes':['id',_0x0bb2('0x2'),_0x0bb2('0x5'),_0x0bb2('0x6')]}]},'log':_0x0bb2('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7977776..7de8d08 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 _0xf53b=['../client','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x15cae3,_0x458cb9){var _0x20596f=function(_0x1ad3e6){while(--_0x1ad3e6){_0x15cae3['push'](_0x15cae3['shift']());}};_0x20596f(++_0x458cb9);}(_0xf53b,0xfa));var _0xbf53=function(_0x336b93,_0x314b62){_0x336b93=_0x336b93-0x0;var _0x3883e6=_0xf53b[_0x336b93];return _0x3883e6;};'use strict';var client=require(_0xbf53('0x0'));exports[_0xbf53('0x1')]=function(_0x242d3c){return client[_0xbf53('0x2')](_0xbf53('0x3'),{'body':_0x242d3c,'log':_0xbf53('0x3')});};exports['update']=function(_0x4758dc,_0x4f16b4){return client[_0xbf53('0x2')]('UpdateMailQueueReport',{'body':_0x4f16b4,'options':{'where':{'uniqueid':_0x4758dc},'order':[['id','DESC']],'limit':0x1},'log':_0xbf53('0x4')});}; \ No newline at end of file +var _0xfb57=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x1fe40d,_0x140a14){var _0xb67fea=function(_0x39d0fc){while(--_0x39d0fc){_0x1fe40d['push'](_0x1fe40d['shift']());}};_0xb67fea(++_0x140a14);}(_0xfb57,0x96));var _0x7fb5=function(_0x34d533,_0x161449){_0x34d533=_0x34d533-0x0;var _0x4731f5=_0xfb57[_0x34d533];return _0x4731f5;};'use strict';var client=require('../client');exports[_0x7fb5('0x0')]=function(_0x4d20f9){return client[_0x7fb5('0x1')](_0x7fb5('0x2'),{'body':_0x4d20f9,'log':_0x7fb5('0x2')});};exports[_0x7fb5('0x3')]=function(_0x55b8fa,_0x5d28a7){return client[_0x7fb5('0x1')](_0x7fb5('0x4'),{'body':_0x5d28a7,'options':{'where':{'uniqueid':_0x55b8fa},'order':[['id','DESC']],'limit':0x1},'log':_0x7fb5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e42ebf1..e0860fb 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 _0xc11d=['addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc11d,0x69));var _0xdc11=function(_0x2436f2,_0x31a124){_0x2436f2=_0x2436f2-0x0;var _0xd0812d=_0xc11d[_0x2436f2];return _0xd0812d;};'use strict';var client=require(_0xdc11('0x0'));exports[_0xdc11('0x1')]=function(_0x404844,_0x4b1bfd){return client['Request'](_0xdc11('0x2'),{'body':_0x4b1bfd,'options':{'where':{'id':_0x404844}},'log':_0xdc11('0x3')});};exports[_0xdc11('0x4')]=function(_0x26fdae,_0x52b686){return client[_0xdc11('0x5')](_0xdc11('0x6'),{'body':_0x52b686,'options':{'where':{'id':_0x26fdae}},'log':_0xdc11('0x7')});}; \ No newline at end of file +var _0x3965=['update','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client'];(function(_0x1a02dc,_0xe9dddd){var _0x12257e=function(_0x323a61){while(--_0x323a61){_0x1a02dc['push'](_0x1a02dc['shift']());}};_0x12257e(++_0xe9dddd);}(_0x3965,0xb3));var _0x5396=function(_0x4abc8f,_0xef597d){_0x4abc8f=_0x4abc8f-0x0;var _0x5d7939=_0x3965[_0x4abc8f];return _0x5d7939;};'use strict';var client=require(_0x5396('0x0'));exports[_0x5396('0x1')]=function(_0x58dea8,_0xa8f1cd){return client[_0x5396('0x2')](_0x5396('0x3'),{'body':_0xa8f1cd,'options':{'where':{'id':_0x58dea8}},'log':'updateOpenchannelInteraction'});};exports[_0x5396('0x4')]=function(_0x5d76a2,_0x3f0287){return client[_0x5396('0x2')](_0x5396('0x5'),{'body':_0x3f0287,'options':{'where':{'id':_0x5d76a2}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index ed8e06e..e3286ce 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 _0xcfa7=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x3d3a3f,_0x41d1cc){var _0x89ee48=function(_0x2a1e66){while(--_0x2a1e66){_0x3d3a3f['push'](_0x3d3a3f['shift']());}};_0x89ee48(++_0x41d1cc);}(_0xcfa7,0xdf));var _0x7cfa=function(_0x4bf0fe,_0x28f725){_0x4bf0fe=_0x4bf0fe-0x0;var _0x76279d=_0xcfa7[_0x4bf0fe];return _0x76279d;};'use strict';var client=require(_0x7cfa('0x0'));exports[_0x7cfa('0x1')]=function(_0x26b8e5){return client[_0x7cfa('0x2')](_0x7cfa('0x3'),{'body':_0x26b8e5,'log':_0x7cfa('0x4')});}; \ No newline at end of file +var _0x309b=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0xa743a6,_0x5b645a){var _0x24321c=function(_0x25ddac){while(--_0x25ddac){_0xa743a6['push'](_0xa743a6['shift']());}};_0x24321c(++_0x5b645a);}(_0x309b,0x10c));var _0xb309=function(_0x57288c,_0x1125ea){_0x57288c=_0x57288c-0x0;var _0x1987c2=_0x309b[_0x57288c];return _0x1987c2;};'use strict';var client=require(_0xb309('0x0'));exports[_0xb309('0x1')]=function(_0x4c1886){return client[_0xb309('0x2')](_0xb309('0x3'),{'body':_0x4c1886,'log':_0xb309('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 0fd9582..584a3a2 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 _0x85ff=['name','timeout','strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x85ff,0x1d1));var _0xf85f=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x85ff[_0x1d1779];return _0x2377e9;};'use strict';var client=require(_0xf85f('0x0'));exports[_0xf85f('0x1')]=function(){return function(){return client['Request'](_0xf85f('0x2'),{'options':{'raw':![],'attributes':['id',_0xf85f('0x3'),_0xf85f('0x4'),_0xf85f('0x5')],'include':[{'model':'User','as':_0xf85f('0x6'),'attributes':['id',_0xf85f('0x3'),_0xf85f('0x7'),_0xf85f('0x8')]}]},'log':_0xf85f('0x1')});};}; \ No newline at end of file +var _0xd5c9=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd5c9,0x175));var _0x9d5c=function(_0x1a8076,_0x270397){_0x1a8076=_0x1a8076-0x0;var _0x3df2d8=_0xd5c9[_0x1a8076];return _0x3df2d8;};'use strict';var client=require(_0x9d5c('0x0'));exports[_0x9d5c('0x1')]=function(){return function(){return client[_0x9d5c('0x2')](_0x9d5c('0x3'),{'options':{'raw':![],'attributes':['id',_0x9d5c('0x4'),_0x9d5c('0x5'),_0x9d5c('0x6')],'include':[{'model':_0x9d5c('0x7'),'as':_0x9d5c('0x8'),'attributes':['id',_0x9d5c('0x4'),_0x9d5c('0x9'),_0x9d5c('0xa')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1232ef3..a296927 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 _0x3077=['../client','CreateOpenchannelQueueReport','update'];(function(_0x5e570c,_0x233990){var _0xc62527=function(_0xd18777){while(--_0xd18777){_0x5e570c['push'](_0x5e570c['shift']());}};_0xc62527(++_0x233990);}(_0x3077,0x144));var _0x7307=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x3077[_0xf0bcac];return _0x4e4c65;};'use strict';var client=require(_0x7307('0x0'));exports['create']=function(_0x13e3e1){return client['Request'](_0x7307('0x1'),{'body':_0x13e3e1,'log':'CreateOpenchannelQueueReport'});};exports[_0x7307('0x2')]=function(_0x202e9c,_0x20fd79){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x20fd79,'options':{'where':{'uniqueid':_0x202e9c},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x3f9b=['UpdateOpenchannelQueueReport','DESC','CreateOpenchannelQueueReport','Request'];(function(_0x4d795f,_0x1c1d46){var _0x4dcaad=function(_0x5e911f){while(--_0x5e911f){_0x4d795f['push'](_0x4d795f['shift']());}};_0x4dcaad(++_0x1c1d46);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x3e9e76,_0x9b20c8){_0x3e9e76=_0x3e9e76-0x0;var _0x1d2d97=_0x3f9b[_0x3e9e76];return _0x1d2d97;};'use strict';var client=require('../client');exports['create']=function(_0x25e416){return client['Request'](_0xb3f9('0x0'),{'body':_0x25e416,'log':_0xb3f9('0x0')});};exports['update']=function(_0x55e5e8,_0x4970d5){return client[_0xb3f9('0x1')](_0xb3f9('0x2'),{'body':_0x4970d5,'options':{'where':{'uniqueid':_0x55e5e8},'order':[['id',_0xb3f9('0x3')]],'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 ca69fd4..79391f1 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 _0x684d=['update','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x205778,_0x330626){var _0x31403d=function(_0x35cc77){while(--_0x35cc77){_0x205778['push'](_0x205778['shift']());}};_0x31403d(++_0x330626);}(_0x684d,0x174));var _0xd684=function(_0x5ad1d8,_0x366305){_0x5ad1d8=_0x5ad1d8-0x0;var _0x441029=_0x684d[_0x5ad1d8];return _0x441029;};'use strict';var client=require('../client');exports[_0xd684('0x0')]=function(_0x33830c,_0x7a47a2){return client['Request'](_0xd684('0x1'),{'body':_0x7a47a2,'options':{'where':{'id':_0x33830c}},'log':'updateSmsInteraction'});};exports[_0xd684('0x2')]=function(_0x1d505b,_0x654972){return client['Request'](_0xd684('0x3'),{'body':_0x654972,'options':{'where':{'id':_0x1d505b}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x1e69=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x1e69,0x85));var _0x91e6=function(_0xdf72bd,_0x98d8fe){_0xdf72bd=_0xdf72bd-0x0;var _0x57febb=_0x1e69[_0xdf72bd];return _0x57febb;};'use strict';var client=require('../client');exports[_0x91e6('0x0')]=function(_0x28561c,_0x6605eb){return client[_0x91e6('0x1')]('UpdateSmsInteraction',{'body':_0x6605eb,'options':{'where':{'id':_0x28561c}},'log':'updateSmsInteraction'});};exports[_0x91e6('0x2')]=function(_0x351c1d,_0x2b53b6){return client[_0x91e6('0x1')](_0x91e6('0x3'),{'body':_0x2b53b6,'options':{'where':{'id':_0x351c1d}},'log':_0x91e6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 968ba29..f85b70a 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 _0x3d46=['CreateSmsMessage','createSmsMessage','create','Request'];(function(_0x30d22f,_0x933c88){var _0x21d6de=function(_0x7b7304){while(--_0x7b7304){_0x30d22f['push'](_0x30d22f['shift']());}};_0x21d6de(++_0x933c88);}(_0x3d46,0x86));var _0x63d4=function(_0x532332,_0x582937){_0x532332=_0x532332-0x0;var _0x34bca1=_0x3d46[_0x532332];return _0x34bca1;};'use strict';var client=require('../client');exports[_0x63d4('0x0')]=function(_0x76f658){return client[_0x63d4('0x1')](_0x63d4('0x2'),{'body':_0x76f658,'log':_0x63d4('0x3')});}; \ No newline at end of file +var _0x898c=['Request','../client','create'];(function(_0x1c3735,_0x2605cd){var _0x102e6a=function(_0x506ba1){while(--_0x506ba1){_0x1c3735['push'](_0x1c3735['shift']());}};_0x102e6a(++_0x2605cd);}(_0x898c,0x14b));var _0xc898=function(_0x381fa6,_0x5532d9){_0x381fa6=_0x381fa6-0x0;var _0x488bb5=_0x898c[_0x381fa6];return _0x488bb5;};'use strict';var client=require(_0xc898('0x0'));exports[_0xc898('0x1')]=function(_0x598b5d){return client[_0xc898('0x2')]('CreateSmsMessage',{'body':_0x598b5d,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index dfddbdb..31bf191 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x4078a7,_0x42610c){var _0x5c4e9e=function(_0x1dade2){while(--_0x1dade2){_0x4078a7['push'](_0x4078a7['shift']());}};_0x5c4e9e(++_0x42610c);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x8c8dd8,_0x8d604){var _0x50b349=function(_0x49217e){while(--_0x49217e){_0x8c8dd8['push'](_0x8c8dd8['shift']());}};_0x50b349(++_0x8d604);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb7e7[_0x1ccdf7];return _0x52a0ae;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 38f886a..91ea7a5 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(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xedd9,0xfc));var _0x9edd=function(_0x352c6c,_0x484ef2){_0x352c6c=_0x352c6c-0x0;var _0x650490=_0xedd9[_0x352c6c];return _0x650490;};'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(_0x4a0e49,_0x1929b5){var _0xd4fa5c=function(_0x2f3148){while(--_0x2f3148){_0x4a0e49['push'](_0x4a0e49['shift']());}};_0xd4fa5c(++_0x1929b5);}(_0x34e8,0x12c));var _0x834e=function(_0x38c832,_0x365533){_0x38c832=_0x38c832-0x0;var _0x4e06a7=_0x34e8[_0x38c832];return _0x4e06a7;};'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 dc5b3a7..44a6bbe 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(_0x3ab18e,_0x818654){var _0x504e9c=function(_0x2398dc){while(--_0x2398dc){_0x3ab18e['push'](_0x3ab18e['shift']());}};_0x504e9c(++_0x818654);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x5aa730,_0x1b9b9c){var _0x31f1bd=function(_0x1a557a){while(--_0x1a557a){_0x5aa730['push'](_0x5aa730['shift']());}};_0x31f1bd(++_0x1b9b9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 1c5133a..8d44367 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 _0xf69d=['addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x473abc,_0x1c7395){var _0x53b5db=function(_0x5aa4d3){while(--_0x5aa4d3){_0x473abc['push'](_0x473abc['shift']());}};_0x53b5db(++_0x1c7395);}(_0xf69d,0xd3));var _0xdf69=function(_0x2e75c6,_0x4db904){_0x2e75c6=_0x2e75c6-0x0;var _0x27d4e8=_0xf69d[_0x2e75c6];return _0x27d4e8;};'use strict';var client=require(_0xdf69('0x0'));exports[_0xdf69('0x1')]=function(_0x32d6ba,_0xe063fc){return client[_0xdf69('0x2')]('UpdateWhatsappInteraction',{'body':_0xe063fc,'options':{'where':{'id':_0x32d6ba}},'log':_0xdf69('0x3')});};exports[_0xdf69('0x4')]=function(_0x5b5eec,_0x13ecb6){return client[_0xdf69('0x2')](_0xdf69('0x5'),{'body':_0x13ecb6,'options':{'where':{'id':_0x5b5eec}},'log':_0xdf69('0x6')});}; \ No newline at end of file +var _0xb4c7=['Request','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','update'];(function(_0x18da32,_0x43de62){var _0x2ab5c6=function(_0x2a3735){while(--_0x2a3735){_0x18da32['push'](_0x18da32['shift']());}};_0x2ab5c6(++_0x43de62);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x32eecf,_0x2b2d50){_0x32eecf=_0x32eecf-0x0;var _0x3581b8=_0xb4c7[_0x32eecf];return _0x3581b8;};'use strict';var client=require(_0x7b4c('0x0'));exports[_0x7b4c('0x1')]=function(_0x144dc5,_0xa0d9f1){return client[_0x7b4c('0x2')]('UpdateWhatsappInteraction',{'body':_0xa0d9f1,'options':{'where':{'id':_0x144dc5}},'log':_0x7b4c('0x3')});};exports[_0x7b4c('0x4')]=function(_0x3ebc75,_0x17cea2){return client[_0x7b4c('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x17cea2,'options':{'where':{'id':_0x3ebc75}},'log':_0x7b4c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f1c25a3..ed7bfdb 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 _0xbe94=['create','Request','CreateWhatsappMessage','../client'];(function(_0x44540c,_0x3d3476){var _0x2e08d2=function(_0x22fbb3){while(--_0x22fbb3){_0x44540c['push'](_0x44540c['shift']());}};_0x2e08d2(++_0x3d3476);}(_0xbe94,0x12f));var _0x4be9=function(_0x5f483b,_0x5c306c){_0x5f483b=_0x5f483b-0x0;var _0x181167=_0xbe94[_0x5f483b];return _0x181167;};'use strict';var client=require(_0x4be9('0x0'));exports[_0x4be9('0x1')]=function(_0x4864dd){return client[_0x4be9('0x2')](_0x4be9('0x3'),{'body':_0x4864dd,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xfa12=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x1c10e7,_0x15ce40){var _0x1999af=function(_0x2f9f5c){while(--_0x2f9f5c){_0x1c10e7['push'](_0x1c10e7['shift']());}};_0x1999af(++_0x15ce40);}(_0xfa12,0x11a));var _0x2fa1=function(_0x22d541,_0xc01585){_0x22d541=_0x22d541-0x0;var _0x35cd83=_0xfa12[_0x22d541];return _0x35cd83;};'use strict';var client=require(_0x2fa1('0x0'));exports[_0x2fa1('0x1')]=function(_0x54a3ec){return client[_0x2fa1('0x2')](_0x2fa1('0x3'),{'body':_0x54a3ec,'log':_0x2fa1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 2381a06..7dcb24e 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 _0xf8a4=['getWhatsappQueues','Request','GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause','../client'];(function(_0x5cdfc6,_0x2dec4c){var _0x2faa21=function(_0x25681b){while(--_0x25681b){_0x5cdfc6['push'](_0x5cdfc6['shift']());}};_0x2faa21(++_0x2dec4c);}(_0xf8a4,0x13f));var _0x4f8a=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0xf8a4[_0x2dd390];return _0x3afe47;};'use strict';var client=require(_0x4f8a('0x0'));exports[_0x4f8a('0x1')]=function(){return function(){return client[_0x4f8a('0x2')](_0x4f8a('0x3'),{'options':{'raw':![],'attributes':['id',_0x4f8a('0x4'),'timeout',_0x4f8a('0x5')],'include':[{'model':_0x4f8a('0x6'),'as':_0x4f8a('0x7'),'attributes':['id',_0x4f8a('0x4'),_0x4f8a('0x8'),_0x4f8a('0x9')]}]},'log':_0x4f8a('0x1')});};}; \ No newline at end of file +var _0xb8b5=['name','timeout','strategy','User','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x244cac,_0x4da255){var _0x94653e=function(_0x5511bd){while(--_0x5511bd){_0x244cac['push'](_0x244cac['shift']());}};_0x94653e(++_0x4da255);}(_0xb8b5,0x10a));var _0x5b8b=function(_0x914c50,_0x2ba74c){_0x914c50=_0x914c50-0x0;var _0x1f557c=_0xb8b5[_0x914c50];return _0x1f557c;};'use strict';var client=require(_0x5b8b('0x0'));exports[_0x5b8b('0x1')]=function(){return function(){return client[_0x5b8b('0x2')](_0x5b8b('0x3'),{'options':{'raw':![],'attributes':['id',_0x5b8b('0x4'),_0x5b8b('0x5'),_0x5b8b('0x6')],'include':[{'model':_0x5b8b('0x7'),'as':'Agents','attributes':['id','name',_0x5b8b('0x8'),_0x5b8b('0x9')]}]},'log':_0x5b8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 4fa3af8..760a6e0 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 _0xea35=['../client','create','Request','update','DESC'];(function(_0x2e2eab,_0x2e609a){var _0x2357bc=function(_0x2235ad){while(--_0x2235ad){_0x2e2eab['push'](_0x2e2eab['shift']());}};_0x2357bc(++_0x2e609a);}(_0xea35,0x104));var _0x5ea3=function(_0x1ac38f,_0x1e0203){_0x1ac38f=_0x1ac38f-0x0;var _0x42c45e=_0xea35[_0x1ac38f];return _0x42c45e;};'use strict';var client=require(_0x5ea3('0x0'));exports[_0x5ea3('0x1')]=function(_0x3c4042){return client[_0x5ea3('0x2')]('CreateWhatsappQueueReport',{'body':_0x3c4042,'log':'CreateWhatsappQueueReport'});};exports[_0x5ea3('0x3')]=function(_0x354760,_0x3beb0e){return client[_0x5ea3('0x2')]('UpdateWhatsappQueueReport',{'body':_0x3beb0e,'options':{'where':{'uniqueid':_0x354760},'order':[['id',_0x5ea3('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xdf18=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdf18,0xe3));var _0x8df1=function(_0x4005e8,_0x4aefca){_0x4005e8=_0x4005e8-0x0;var _0xa7cdf7=_0xdf18[_0x4005e8];return _0xa7cdf7;};'use strict';var client=require(_0x8df1('0x0'));exports[_0x8df1('0x1')]=function(_0xeeb5b9){return client[_0x8df1('0x2')](_0x8df1('0x3'),{'body':_0xeeb5b9,'log':_0x8df1('0x3')});};exports['update']=function(_0x101a83,_0x6d721a){return client[_0x8df1('0x2')](_0x8df1('0x4'),{'body':_0x6d721a,'options':{'where':{'uniqueid':_0x101a83},'order':[['id',_0x8df1('0x5')]],'limit':0x1},'log':_0x8df1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 210cbf7..7044deb 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 _0x03f5=['close','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','length','error','map','stop','find','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0x453f00,_0x324e92){var _0x334ef4=function(_0x370bff){while(--_0x370bff){_0x453f00['push'](_0x453f00['shift']());}};_0x334ef4(++_0x324e92);}(_0x03f5,0xc9));var _0x503f=function(_0x331b0e,_0x7f21d){_0x331b0e=_0x331b0e-0x0;var _0x5a95eb=_0x03f5[_0x331b0e];return _0x5a95eb;};'use strict';var schema=require(_0x503f('0x0'));var _=require(_0x503f('0x1'));var util=require(_0x503f('0x2'));var seqqueue=require(_0x503f('0x3'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x503f('0x4'),'required':!![],'message':_0x503f('0x5')},'timeout':{'type':_0x503f('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x253fcc,_0x3038d3,_0x2d642f){return logger[_0x503f('0x7')](util[_0x503f('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x253fcc,_0x3038d3[_0x503f('0x9')],_0x2d642f));}function handleFindAgent(_0x4df59d){return function(_0x511dc){return _0x511dc[_0x503f('0x9')][_0x503f('0xa')]()===_0x4df59d[_0x503f('0xa')]();};}exports['consequence']=function(_0x5a796d,_0x41fca3,_0x27e610,_0x40e0e2){return function(_0x1afd36){try{var _0x54ffdc={'name':_0x41fca3[0x0],'timeout':_0x41fca3[0x1]};var _0x266843=queue[_0x503f('0x0')](_0x54ffdc,{'typecast':!![]});if(_0x266843[_0x503f('0xb')]){logger[_0x503f('0xc')]('[%s][AGENT]\x20%s',_0x5a796d,_[_0x503f('0xd')](_0x266843,'message')['join'](',\x20'));_0x1afd36[_0x503f('0xe')]();}else{var _0x51bdc3=_[_0x503f('0xf')](_0x27e610['agents'],handleFindAgent(_0x54ffdc[_0x503f('0x9')]));if(_0x51bdc3){var _0x21f486=(_0x54ffdc[_0x503f('0x10')]||0xa)*0x3e8;var _0x3dbfb3,_0x8b0e8c;var _0xb749=seqqueue[_0x503f('0x11')](_0x21f486);_0xb749['id']=_0x5a796d;_0xb749['atimeout']=_0x21f486;_0xb749[_0x503f('0x12')]=_0x40e0e2[_0x503f('0x12')];writeLog(_0x5a796d,_0x51bdc3,util[_0x503f('0x8')](_0x503f('0x13'),_0x21f486));_0x27e610[_0x503f('0x14')][_0x5a796d]['on'](_0x503f('0x15'),function(){logger[_0x503f('0x7')](_0x503f('0x16'),_0x5a796d);clearTimeout(_0x8b0e8c);_0x8b0e8c=undefined;_0xb749[_0x503f('0x17')]();if(_0x27e610[_0x503f('0x14')][_0x5a796d]){delete _0x27e610['rules'][_0x5a796d];}_0x1afd36[_0x503f('0xe')]();});_0x27e610[_0x503f('0x14')][_0x5a796d]['on']('complete',function(){if(_0x27e610['rules'][_0x5a796d]){delete _0x27e610[_0x503f('0x14')][_0x5a796d];}});_0x8b0e8c=setTimeout(function(){logger['info'](_0x503f('0x18'),_0x5a796d);clearTimeout(_0x8b0e8c);_0xb749[_0x503f('0x17')]();_0x1afd36[_0x503f('0x19')]();},_0x21f486);strategy['agent'](_0xb749,_0x51bdc3,_0x27e610,_0x40e0e2);}else{logger[_0x503f('0xc')](_0x503f('0x1a'),_0x5a796d,_0x54ffdc[_0x503f('0x9')]);_0x1afd36[_0x503f('0xe')]();}}}catch(_0x96e921){console['log'](_0x96e921);logger[_0x503f('0xc')]('[%s][QUEUE]\x20%s',_0x5a796d,_0x96e921[_0x503f('0x1b')]);_0x1afd36[_0x503f('0xe')]();}};}; \ No newline at end of file +var _0x1acf=['timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','map','message','join','agents'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x1acf,0x1b4));var _0xf1ac=function(_0x170bb4,_0x283dc4){_0x170bb4=_0x170bb4-0x0;var _0x15b620=_0x1acf[_0x170bb4];return _0x15b620;};'use strict';var schema=require(_0xf1ac('0x0'));var _=require(_0xf1ac('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0xf1ac('0x2'))(_0xf1ac('0x3'));var strategy=require(_0xf1ac('0x4'));var queue=schema({'name':{'type':_0xf1ac('0x5'),'required':!![],'message':_0xf1ac('0x6')},'timeout':{'type':_0xf1ac('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x3ee675,_0x4de5e8,_0x55845d){return logger[_0xf1ac('0x8')](util[_0xf1ac('0x9')](_0xf1ac('0xa'),_0x3ee675,_0x4de5e8['name'],_0x55845d));}function handleFindAgent(_0x1a9f69){return function(_0x9c6bc){return _0x9c6bc[_0xf1ac('0xb')]['toLowerCase']()===_0x1a9f69[_0xf1ac('0xc')]();};}exports[_0xf1ac('0xd')]=function(_0x16aa3c,_0x1d4510,_0x2ebb0a,_0xc73106){return function(_0x37a25f){try{var _0x3454b8={'name':_0x1d4510[0x0],'timeout':_0x1d4510[0x1]};var _0x60ffcd=queue[_0xf1ac('0x0')](_0x3454b8,{'typecast':!![]});if(_0x60ffcd['length']){logger[_0xf1ac('0xe')]('[%s][AGENT]\x20%s',_0x16aa3c,_[_0xf1ac('0xf')](_0x60ffcd,_0xf1ac('0x10'))[_0xf1ac('0x11')](',\x20'));_0x37a25f['stop']();}else{var _0x22ce0a=_['find'](_0x2ebb0a[_0xf1ac('0x12')],handleFindAgent(_0x3454b8[_0xf1ac('0xb')]));if(_0x22ce0a){var _0x33e632=(_0x3454b8[_0xf1ac('0x13')]||0xa)*0x3e8;var _0x3d7695,_0x447f74;var _0x515cf1=seqqueue[_0xf1ac('0x14')](_0x33e632);_0x515cf1['id']=_0x16aa3c;_0x515cf1[_0xf1ac('0x15')]=_0x33e632;_0x515cf1[_0xf1ac('0x16')]=_0xc73106['channel'];writeLog(_0x16aa3c,_0x22ce0a,util['format'](_0xf1ac('0x17'),_0x33e632));_0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c]['on'](_0xf1ac('0x19'),function(){logger[_0xf1ac('0x8')](_0xf1ac('0x1a'),_0x16aa3c);clearTimeout(_0x447f74);_0x447f74=undefined;_0x515cf1[_0xf1ac('0x1b')]();if(_0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c]){delete _0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c];}_0x37a25f[_0xf1ac('0x1c')]();});_0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c]['on'](_0xf1ac('0x1d'),function(){if(_0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c]){delete _0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c];}});_0x447f74=setTimeout(function(){logger[_0xf1ac('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x16aa3c);clearTimeout(_0x447f74);_0x515cf1['close']();_0x37a25f[_0xf1ac('0x1e')]();},_0x33e632);strategy['agent'](_0x515cf1,_0x22ce0a,_0x2ebb0a,_0xc73106);}else{logger[_0xf1ac('0xe')](_0xf1ac('0x1f'),_0x16aa3c,_0x3454b8[_0xf1ac('0xb')]);_0x37a25f[_0xf1ac('0x1c')]();}}}catch(_0x40e9ac){console[_0xf1ac('0x20')](_0x40e9ac);logger['error'](_0xf1ac('0x21'),_0x16aa3c,_0x40e9ac[_0xf1ac('0x22')]);_0x37a25f[_0xf1ac('0x1c')]();}};}; \ 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 2ad2180..430f697 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 _0x4fb3=['Failed','next','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','phone','channel','chat','account','AccountId','upperFirst','isEmpty','getMustacheRender','Message','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','body','toString','postText','message','amazonlex','create','dialogState'];(function(_0x146f1a,_0xb10622){var _0x325943=function(_0x12e47f){while(--_0x12e47f){_0x146f1a['push'](_0x146f1a['shift']());}};_0x325943(++_0xb10622);}(_0x4fb3,0xe3));var _0x34fb=function(_0x3b37c6,_0x14ec2d){_0x3b37c6=_0x3b37c6-0x0;var _0x511d49=_0x4fb3[_0x3b37c6];return _0x511d49;};'use strict';var _=require(_0x34fb('0x0'));var moment=require(_0x34fb('0x1'));var AWS=require(_0x34fb('0x2'));var utils=require(_0x34fb('0x3'));var logger=require(_0x34fb('0x4'))(_0x34fb('0x5'));var rpc={'chatMessage':require(_0x34fb('0x6')),'openchannelMessage':require(_0x34fb('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x653ff0,_0x2700c6){return function(_0x1b5b62){try{if(!_[_0x34fb('0x8')](this[_0x34fb('0x9')][_0x34fb('0xa')])){logger[_0x34fb('0xb')](_0x34fb('0xc'),_0x653ff0,_0x34fb('0xd'));return _0x1b5b62['next']();}var _0x48c111={'ContactId':this[_0x34fb('0xe')]['id'],'sentAt':moment()[_0x34fb('0xf')](_0x34fb('0x10')),'direction':'out'};if(this['channel']===_0x34fb('0x11')||this['channel']==='whatsapp'){_0x48c111[_0x34fb('0x12')]=this[_0x34fb('0x9')][_0x34fb('0x12')];}var _0x2abedd=this[_0x34fb('0x13')];if(_0x2abedd===_0x34fb('0x14')){_0x48c111['ChatWebsiteId']=this[_0x34fb('0x15')]['id'];}else{_0x48c111[_['upperFirst'](_0x2abedd)+_0x34fb('0x16')]=this[_0x34fb('0x15')]['id'];}_0x48c111[_[_0x34fb('0x17')](_0x2abedd)+'InteractionId']=this[_0x34fb('0x9')]['id'];if(this[_0x34fb('0x9')]['created']){var _0x2ee499=_0x2700c6[0x4];if(!_[_0x34fb('0x18')](_0x2ee499)){_0x48c111['body']=utils[_0x34fb('0x19')](_0x2ee499,this);return rpc[_0x2abedd+_0x34fb('0x1a')]['create'](_0x48c111)[_0x34fb('0x1b')](function(_0x4c9c30){logger[_0x34fb('0xb')](_0x34fb('0xc'),_0x653ff0,_0x48c111['body']);})[_0x34fb('0x1c')](function(_0x3a0de3){logger[_0x34fb('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x653ff0,JSON[_0x34fb('0x1e')](_0x3a0de3));})[_0x34fb('0x1f')](function(){logger[_0x34fb('0xb')](_0x34fb('0x20'),_0x653ff0);_0x1b5b62['stop']();});}else{logger[_0x34fb('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x653ff0);_0x1b5b62[_0x34fb('0x21')]();}}else{var _0x212479=this;var _0x497d97=new AWS[(_0x34fb('0x22'))]({'accessKeyId':_0x2700c6[0x0],'secretAccessKey':_0x2700c6[0x1],'region':_0x2700c6[0x2]});var _0xe89e5e={'botAlias':_0x34fb('0x23'),'botName':_0x2700c6[0x3],'inputText':this['message'][_0x34fb('0x24')],'userId':this['channel']+':'+this['interaction']['id'][_0x34fb('0x25')]()};_0x497d97[_0x34fb('0x26')](_0xe89e5e,function(_0x38c9a2,_0x4b69ca){if(_0x38c9a2){logger['error'](_0x34fb('0xc'),_0x653ff0,_0x38c9a2[_0x34fb('0x27')]);_0x1b5b62['next']();}else if(_0x4b69ca&&_0x4b69ca['message']){_0x212479[_0x34fb('0x24')][_0x34fb('0x28')]=_0x4b69ca;_0x48c111['body']=_0x4b69ca[_0x34fb('0x27')];_0x48c111['providerName']='amazonlex';_0x48c111['providerResponse']=JSON[_0x34fb('0x1e')](_0x4b69ca);return rpc[_0x2abedd+_0x34fb('0x1a')][_0x34fb('0x29')](_0x48c111)[_0x34fb('0x1b')](function(_0x42c678){logger[_0x34fb('0xb')](_0x34fb('0xc'),_0x653ff0,_0x48c111['body']);if(_0x4b69ca[_0x34fb('0x2a')]==_0x34fb('0x2b')){_0x1b5b62[_0x34fb('0x2c')]();}else{_0x1b5b62['stop']();}})[_0x34fb('0x1c')](function(_0x7fcc86){logger['error'](_0x34fb('0xc'),_0x653ff0,JSON[_0x34fb('0x1e')](_0x7fcc86));_0x1b5b62[_0x34fb('0x2c')]();});}else{_0x1b5b62[_0x34fb('0x2c')]();}});}}catch(_0x567445){logger[_0x34fb('0x1d')](_0x34fb('0xc'),_0x653ff0,JSON[_0x34fb('0x1e')](_0x567445));_0x1b5b62[_0x34fb('0x21')]();}};}; \ No newline at end of file +var _0x3173=['error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','providerName','amazonlex','providerResponse','Message','dialogState','Failed','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','sms','channel','phone','chat','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','create','then'];(function(_0x1dc445,_0x40fb63){var _0x18ee50=function(_0x44896f){while(--_0x44896f){_0x1dc445['push'](_0x1dc445['shift']());}};_0x18ee50(++_0x40fb63);}(_0x3173,0x161));var _0x3317=function(_0x2cd8ba,_0x3022ed){_0x2cd8ba=_0x2cd8ba-0x0;var _0x32ecf9=_0x3173[_0x2cd8ba];return _0x32ecf9;};'use strict';var _=require(_0x3317('0x0'));var moment=require(_0x3317('0x1'));var AWS=require(_0x3317('0x2'));var utils=require(_0x3317('0x3'));var logger=require(_0x3317('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3317('0x5')),'mailMessage':require(_0x3317('0x6')),'smsMessage':require(_0x3317('0x7')),'faxMessage':require(_0x3317('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x3317('0x9')]=function(_0x53250a,_0x368097){return function(_0x29ea5b){try{if(!_[_0x3317('0xa')](this[_0x3317('0xb')][_0x3317('0xc')])){logger[_0x3317('0xd')](_0x3317('0xe'),_0x53250a,_0x3317('0xf'));return _0x29ea5b[_0x3317('0x10')]();}var _0x5e15c3={'ContactId':this[_0x3317('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x3317('0x12')||this[_0x3317('0x13')]==='whatsapp'){_0x5e15c3[_0x3317('0x14')]=this['interaction'][_0x3317('0x14')];}var _0x523dd2=this[_0x3317('0x13')];if(_0x523dd2===_0x3317('0x15')){_0x5e15c3['ChatWebsiteId']=this[_0x3317('0x16')]['id'];}else{_0x5e15c3[_[_0x3317('0x17')](_0x523dd2)+_0x3317('0x18')]=this[_0x3317('0x16')]['id'];}_0x5e15c3[_[_0x3317('0x17')](_0x523dd2)+_0x3317('0x19')]=this[_0x3317('0xb')]['id'];if(this[_0x3317('0xb')][_0x3317('0x1a')]){var _0x27b87c=_0x368097[0x4];if(!_['isEmpty'](_0x27b87c)){_0x5e15c3[_0x3317('0x1b')]=utils[_0x3317('0x1c')](_0x27b87c,this);return rpc[_0x523dd2+'Message'][_0x3317('0x1d')](_0x5e15c3)[_0x3317('0x1e')](function(_0x3bed1d){logger[_0x3317('0xd')](_0x3317('0xe'),_0x53250a,_0x5e15c3[_0x3317('0x1b')]);})['catch'](function(_0x541313){logger[_0x3317('0x1f')](_0x3317('0xe'),_0x53250a,JSON[_0x3317('0x20')](_0x541313));})['finally'](function(){logger[_0x3317('0xd')](_0x3317('0x21'),_0x53250a);_0x29ea5b[_0x3317('0x22')]();});}else{logger[_0x3317('0xd')](_0x3317('0x23'),_0x53250a);_0x29ea5b[_0x3317('0x22')]();}}else{var _0x41f7d7=this;var _0x1a1800=new AWS[(_0x3317('0x24'))]({'accessKeyId':_0x368097[0x0],'secretAccessKey':_0x368097[0x1],'region':_0x368097[0x2]});var _0x2122d3={'botAlias':_0x3317('0x25'),'botName':_0x368097[0x3],'inputText':this[_0x3317('0x26')][_0x3317('0x1b')],'userId':this[_0x3317('0x13')]+':'+this[_0x3317('0xb')]['id'][_0x3317('0x27')]()};_0x1a1800[_0x3317('0x28')](_0x2122d3,function(_0x595cb6,_0x1de9d9){if(_0x595cb6){logger[_0x3317('0x1f')](_0x3317('0xe'),_0x53250a,_0x595cb6[_0x3317('0x26')]);_0x29ea5b[_0x3317('0x10')]();}else if(_0x1de9d9&&_0x1de9d9[_0x3317('0x26')]){_0x41f7d7[_0x3317('0x1b')]['amazonlex']=_0x1de9d9;_0x5e15c3[_0x3317('0x1b')]=_0x1de9d9[_0x3317('0x26')];_0x5e15c3[_0x3317('0x29')]=_0x3317('0x2a');_0x5e15c3[_0x3317('0x2b')]=JSON[_0x3317('0x20')](_0x1de9d9);return rpc[_0x523dd2+_0x3317('0x2c')]['create'](_0x5e15c3)[_0x3317('0x1e')](function(_0x492e58){logger[_0x3317('0xd')](_0x3317('0xe'),_0x53250a,_0x5e15c3[_0x3317('0x1b')]);if(_0x1de9d9[_0x3317('0x2d')]==_0x3317('0x2e')){_0x29ea5b[_0x3317('0x10')]();}else{_0x29ea5b[_0x3317('0x22')]();}})[_0x3317('0x2f')](function(_0x30f397){logger[_0x3317('0x1f')](_0x3317('0xe'),_0x53250a,JSON['stringify'](_0x30f397));_0x29ea5b[_0x3317('0x10')]();});}else{_0x29ea5b[_0x3317('0x10')]();}});}}catch(_0x293ddc){logger[_0x3317('0x1f')](_0x3317('0xe'),_0x53250a,JSON['stringify'](_0x293ddc));_0x29ea5b[_0x3317('0x22')]();}};}; \ 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 c0f4861..34b7083 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 _0xfe06=['One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','InteractionId','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','smtpOptions','then','Message','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stop','lodash','moment','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x21b400,_0x42f5a2){var _0x37f5a6=function(_0x2e3cc8){while(--_0x2e3cc8){_0x21b400['push'](_0x21b400['shift']());}};_0x37f5a6(++_0x42f5a2);}(_0xfe06,0x1cb));var _0x6fe0=function(_0x333974,_0x1d6e0c){_0x333974=_0x333974-0x0;var _0x3c45a5=_0xfe06[_0x333974];return _0x3c45a5;};'use strict';var _=require(_0x6fe0('0x0'));var moment=require(_0x6fe0('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x6fe0('0x2')),'openchannelMessage':require(_0x6fe0('0x3')),'mailMessage':require(_0x6fe0('0x4')),'smsMessage':require(_0x6fe0('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x6fe0('0x6')),'chatInteraction':require(_0x6fe0('0x7')),'openchannelInteraction':require(_0x6fe0('0x8')),'mailInteraction':require(_0x6fe0('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x6fe0('0xa')),'whatsappInteraction':require(_0x6fe0('0xb'))};var mailRpc=require(_0x6fe0('0xc'));exports['consequence']=function(_0x1febd6,_0x52ecf5,_0x594206,_0x3efc50){return function(_0x54b467){try{var _0x2007b1=this['channel'];if(_0x2007b1===_0x6fe0('0xd')&&_0x3efc50['body'][_0x6fe0('0xe')]){logger[_0x6fe0('0xf')](_0x6fe0('0x10'),_0x1febd6,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x54b467[_0x6fe0('0x11')]();}if(_0x52ecf5[0x0]==='1'&&(_[_0x6fe0('0x12')](this[_0x6fe0('0x13')][_0x6fe0('0x14')])||!this[_0x6fe0('0x13')][_0x6fe0('0x14')])){logger[_0x6fe0('0xf')](_0x6fe0('0x10'),_0x1febd6,_0x6fe0('0x15'));return _0x54b467[_0x6fe0('0x11')]();}if(_0x52ecf5[0x0]==='2'&&this[_0x6fe0('0x13')][_0x6fe0('0x16')]){logger['info'](_0x6fe0('0x17'),_0x1febd6,_0x6fe0('0x18'));return _0x54b467[_0x6fe0('0x11')]();}var _0x1b1503={'ContactId':this[_0x6fe0('0x19')]['id'],'sentAt':moment()[_0x6fe0('0x1a')](_0x6fe0('0x1b')),'direction':_0x6fe0('0x1c')};if(this[_0x6fe0('0x1d')]===_0x6fe0('0xd')){_0x1b1503[_0x6fe0('0x1e')]=utils[_0x6fe0('0x1f')](_0x52ecf5[0x2],this);}else{_0x1b1503[_0x6fe0('0x1e')]=utils[_0x6fe0('0x1f')](_0x52ecf5[0x1],this);}if(this[_0x6fe0('0x20')]){_0x1b1503['to']=this[_0x6fe0('0x20')][_0x6fe0('0x21')]||'';if(this[_0x6fe0('0x1d')]==='mail'&&_0x52ecf5[0x1]==='1'){_0x1b1503['cc']=this[_0x6fe0('0x20')]['cc']||'';}_0x1b1503['from']=this[_0x6fe0('0x20')]['to']||'';_0x1b1503[_0x6fe0('0x22')]=this[_0x6fe0('0x20')]['phone']||'';_0x1b1503[_0x6fe0('0x23')]=!![];if(this[_0x6fe0('0x20')]['subject']){_0x1b1503[_0x6fe0('0x24')]='';_0x1b1503[_0x6fe0('0x24')]+=_[_0x6fe0('0x25')](this[_0x6fe0('0x20')][_0x6fe0('0x24')],_0x6fe0('0x26'))?'':_0x6fe0('0x27');_0x1b1503[_0x6fe0('0x24')]+=this[_0x6fe0('0x20')]['subject'];}}if(this[_0x6fe0('0x1d')]===_0x6fe0('0x28')){_0x1b1503[_0x6fe0('0x29')]=this[_0x6fe0('0x2a')]['id'];}else{_0x1b1503[_['upperFirst'](this['channel'])+_0x6fe0('0x2b')]=this['account']['id'];}_0x1b1503[_['upperFirst'](this[_0x6fe0('0x1d')])+_0x6fe0('0x2c')]=this[_0x6fe0('0x13')]['id'];var _0x49fe7a=this[_0x6fe0('0x13')];if(rpc[this['channel']+'Message']){if(this[_0x6fe0('0x1d')]===_0x6fe0('0xd')){_0x1b1503[_0x6fe0('0x2d')]=this[_0x6fe0('0x20')][_0x6fe0('0x2e')];_0x1b1503[_0x6fe0('0x2f')]=_0x6fe0('0x30')+_[_0x6fe0('0x31')](_0x1b1503[_0x6fe0('0x1e')],_0x6fe0('0x32'),_0x6fe0('0x33'))+_0x6fe0('0x34');_0x1b1503[_0x6fe0('0x35')]={'Auto-Submitted':_0x6fe0('0x36'),'X-Auto-Response-Suppress':_0x6fe0('0x37'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x6fe0('0x2a')][_0x6fe0('0x38')],_0x1b1503)[_0x6fe0('0x39')](function(_0x128bbe){logger[_0x6fe0('0xf')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x1febd6);_0x1b1503['messageId']=_0x128bbe[_0x6fe0('0x20')]['messageId'];return rpc[_0x2007b1+_0x6fe0('0x3a')]['create'](_0x1b1503);})[_0x6fe0('0x39')](function(_0x4cdd2f){logger['info']('[%s][AUTOREPLY]\x20%s',_0x1febd6,JSON[_0x6fe0('0x3b')](_0x4cdd2f));})[_0x6fe0('0x3c')](function(_0x3b4d9e){logger[_0x6fe0('0x3d')](_0x6fe0('0x3e'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x3b4d9e));})[_0x6fe0('0x3f')](function(){Promise['resolve']()[_0x6fe0('0x39')](function(){if(_0x52ecf5[0x0]!=='2'||_0x49fe7a[_0x6fe0('0x16')])return;return rpc[_0x2007b1+_0x6fe0('0x40')][_0x6fe0('0x41')](_0x49fe7a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x56b83c){logger[_0x6fe0('0xf')](_0x6fe0('0x17'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x56b83c));})[_0x6fe0('0x3c')](function(_0x429722){logger[_0x6fe0('0x3d')](_0x6fe0('0x42'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x429722));});})[_0x6fe0('0x39')](function(){_0x54b467['next']();});});}else{return rpc[this[_0x6fe0('0x1d')]+'Message'][_0x6fe0('0x43')](_0x1b1503)[_0x6fe0('0x39')](function(){logger[_0x6fe0('0xf')](_0x6fe0('0x10'),_0x1febd6,_0x1b1503[_0x6fe0('0x1e')]);})[_0x6fe0('0x3c')](function(_0x2bcb09){logger[_0x6fe0('0x3d')](_0x6fe0('0x10'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x2bcb09));})[_0x6fe0('0x3f')](function(){Promise['resolve']()[_0x6fe0('0x39')](function(){if(_0x52ecf5[0x0]!=='2'||_0x49fe7a[_0x6fe0('0x16')])return;return rpc[_0x2007b1+_0x6fe0('0x40')][_0x6fe0('0x41')](_0x49fe7a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x156c2b){logger[_0x6fe0('0xf')](_0x6fe0('0x17'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x156c2b));})[_0x6fe0('0x3c')](function(_0x22c391){logger[_0x6fe0('0x3d')](_0x6fe0('0x42'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x22c391));});})[_0x6fe0('0x39')](function(){_0x54b467[_0x6fe0('0x11')]();});});}}}catch(_0xbb1398){logger['error']('[%s][AUTOREPLY]\x20%s',_0x1febd6,JSON[_0x6fe0('0x3b')](_0xbb1398));_0x54b467[_0x6fe0('0x44')]();}};}; \ No newline at end of file +var _0x1cf3=['sendMailMessage','smtpOptions','then','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','catch','update','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','channel','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','','All','auto_reply'];(function(_0x5a814d,_0x1181c1){var _0x4d622f=function(_0x4f0280){while(--_0x4f0280){_0x5a814d['push'](_0x5a814d['shift']());}};_0x4d622f(++_0x1181c1);}(_0x1cf3,0xca));var _0x31cf=function(_0x1b4894,_0xa922a6){_0x1b4894=_0x1b4894-0x0;var _0x45d1fa=_0x1cf3[_0x1b4894];return _0x45d1fa;};'use strict';var _=require(_0x31cf('0x0'));var moment=require('moment');var utils=require(_0x31cf('0x1'));var logger=require(_0x31cf('0x2'))('routing');var rpc={'chatMessage':require(_0x31cf('0x3')),'openchannelMessage':require(_0x31cf('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x31cf('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x31cf('0x6')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x31cf('0x7'))};var mailRpc=require(_0x31cf('0x8'));exports[_0x31cf('0x9')]=function(_0x319160,_0x4daa5a,_0x29194d,_0x3b70ae){return function(_0x8912cc){try{var _0xefa5d7=this['channel'];if(_0xefa5d7===_0x31cf('0xa')&&_0x3b70ae[_0x31cf('0xb')]['isAutoreply']){logger[_0x31cf('0xc')](_0x31cf('0xd'),_0x319160,_0x31cf('0xe'));return _0x8912cc[_0x31cf('0xf')]();}if(_0x4daa5a[0x0]==='1'&&(_[_0x31cf('0x10')](this['interaction'][_0x31cf('0x11')])||!this[_0x31cf('0x12')]['created'])){logger['info'](_0x31cf('0xd'),_0x319160,_0x31cf('0x13'));return _0x8912cc[_0x31cf('0xf')]();}if(_0x4daa5a[0x0]==='2'&&this[_0x31cf('0x12')][_0x31cf('0x14')]){logger[_0x31cf('0xc')](_0x31cf('0x15'),_0x319160,_0x31cf('0x16'));return _0x8912cc[_0x31cf('0xf')]();}var _0x1c7463={'ContactId':this[_0x31cf('0x17')]['id'],'sentAt':moment()['format'](_0x31cf('0x18')),'direction':_0x31cf('0x19')};if(this['channel']===_0x31cf('0xa')){_0x1c7463[_0x31cf('0xb')]=utils[_0x31cf('0x1a')](_0x4daa5a[0x2],this);}else{_0x1c7463['body']=utils['getMustacheRender'](_0x4daa5a[0x1],this);}if(this[_0x31cf('0x1b')]){_0x1c7463['to']=this['message'][_0x31cf('0x1c')]||'';if(this[_0x31cf('0x1d')]===_0x31cf('0xa')&&_0x4daa5a[0x1]==='1'){_0x1c7463['cc']=this['message']['cc']||'';}_0x1c7463['from']=this['message']['to']||'';_0x1c7463[_0x31cf('0x1e')]=this[_0x31cf('0x1b')]['phone']||'';_0x1c7463['read']=!![];if(this[_0x31cf('0x1b')]['subject']){_0x1c7463[_0x31cf('0x1f')]='';_0x1c7463['subject']+=_[_0x31cf('0x20')](this[_0x31cf('0x1b')][_0x31cf('0x1f')],_0x31cf('0x21'))?'':_0x31cf('0x22');_0x1c7463[_0x31cf('0x1f')]+=this[_0x31cf('0x1b')][_0x31cf('0x1f')];}}if(this['channel']===_0x31cf('0x23')){_0x1c7463[_0x31cf('0x24')]=this[_0x31cf('0x25')]['id'];}else{_0x1c7463[_[_0x31cf('0x26')](this[_0x31cf('0x1d')])+_0x31cf('0x27')]=this[_0x31cf('0x25')]['id'];}_0x1c7463[_[_0x31cf('0x26')](this[_0x31cf('0x1d')])+_0x31cf('0x28')]=this['interaction']['id'];var _0x1063eb=this[_0x31cf('0x12')];if(rpc[this[_0x31cf('0x1d')]+_0x31cf('0x29')]){if(this[_0x31cf('0x1d')]===_0x31cf('0xa')){_0x1c7463[_0x31cf('0x2a')]=this[_0x31cf('0x1b')][_0x31cf('0x2b')];_0x1c7463[_0x31cf('0x2c')]=_0x31cf('0x2d')+_[_0x31cf('0x2e')](_0x1c7463[_0x31cf('0xb')],']+(>|$)/g,''),'priorityTrue':_0xca44d1[0x1],'priorityFalse':_0xca44d1[0x2]};var _0x332273=gotoif[_0x55ea('0x0')](_0x38c418,{'typecast':!![]});if(_0x332273[_0x55ea('0xa')]){logger[_0x55ea('0xb')]('[%s][GOTOIF]\x20%s',_0x5cfd33,_[_0x55ea('0xc')](_0x332273,_0x55ea('0xd'))[_0x55ea('0xe')](',\x20'));_0x18971e[_0x55ea('0xf')]();}else{try{var _0x231aba=eval('('+_0x38c418[_0x55ea('0x10')]+')');var _0x2e10fb=_0x231aba?_0x38c418['priorityTrue']:_0x38c418['priorityFalse'];logger[_0x55ea('0x11')](_0x55ea('0x12'),_0x5cfd33,_0x38c418[_0x55ea('0x10')],_0x231aba,_0x2e10fb||_0x55ea('0x13'));if(_0x2e10fb){var _0x22e819=_[_0x55ea('0x14')](_0x18971e['rules'](),{'p':_0x2e10fb});if(_0x22e819>=0x0){logger[_0x55ea('0x11')](_0x55ea('0x15'),_0x5cfd33,_0x2e10fb||_0x55ea('0x13'),_0x22e819);_0x18971e[_0x55ea('0x13')](_0x22e819);}else{logger[_0x55ea('0x11')](_0x55ea('0x16'),_0x5cfd33,_0x2e10fb||'next');_0x18971e['stop']();}}else{_0x18971e[_0x55ea('0x13')]();}}catch(_0x230655){logger[_0x55ea('0xb')](_0x55ea('0x17'),_0x5cfd33,_0x230655[_0x55ea('0xd')]);_0x18971e['stop']();}}}catch(_0x1209a2){logger['error'](_0x55ea('0x18'),_0x5cfd33,JSON[_0x55ea('0x19')](_0x1209a2));_0x18971e[_0x55ea('0xf')]();}};}; \ No newline at end of file +var _0x4054=['priority\x20true\x20is\x20a\x20number','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x251f29,_0x285d22){var _0x188739=function(_0x564e8d){while(--_0x564e8d){_0x251f29['push'](_0x251f29['shift']());}};_0x188739(++_0x285d22);}(_0x4054,0x165));var _0x4405=function(_0x56d22c,_0x34f096){_0x56d22c=_0x56d22c-0x0;var _0x32768c=_0x4054[_0x56d22c];return _0x32768c;};'use strict';var schema=require(_0x4405('0x0'));var _=require(_0x4405('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x4405('0x2'));var logger=require(_0x4405('0x3'))(_0x4405('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x4405('0x5')},'priorityTrue':{'type':_0x4405('0x6'),'message':_0x4405('0x7')},'priorityFalse':{'type':_0x4405('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x18cda3,_0x4c7687){return function(_0x5f548a){try{var _0x33bc82={'condition':htmlToText['fromString'](utils[_0x4405('0x8')](_0x4c7687[0x0],this),{'wordwrap':![]})[_0x4405('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4c7687[0x1],'priorityFalse':_0x4c7687[0x2]};var _0x112af2=gotoif['validate'](_0x33bc82,{'typecast':!![]});if(_0x112af2[_0x4405('0xa')]){logger[_0x4405('0xb')](_0x4405('0xc'),_0x18cda3,_['map'](_0x112af2,'message')['join'](',\x20'));_0x5f548a[_0x4405('0xd')]();}else{try{var _0x28b59a=eval('('+_0x33bc82[_0x4405('0xe')]+')');var _0x4c47e3=_0x28b59a?_0x33bc82[_0x4405('0xf')]:_0x33bc82[_0x4405('0x10')];logger[_0x4405('0x11')](_0x4405('0x12'),_0x18cda3,_0x33bc82[_0x4405('0xe')],_0x28b59a,_0x4c47e3||_0x4405('0x13'));if(_0x4c47e3){var _0xf030c=_[_0x4405('0x14')](_0x5f548a['rules'](),{'p':_0x4c47e3});if(_0xf030c>=0x0){logger['info'](_0x4405('0x15'),_0x18cda3,_0x4c47e3||_0x4405('0x13'),_0xf030c);_0x5f548a[_0x4405('0x13')](_0xf030c);}else{logger[_0x4405('0x11')](_0x4405('0x16'),_0x18cda3,_0x4c47e3||_0x4405('0x13'));_0x5f548a['stop']();}}else{_0x5f548a[_0x4405('0x13')]();}}catch(_0x4e8578){logger[_0x4405('0xb')](_0x4405('0x17'),_0x18cda3,_0x4e8578[_0x4405('0x18')]);_0x5f548a['stop']();}}}catch(_0x5799a7){logger[_0x4405('0xb')](_0x4405('0xc'),_0x18cda3,JSON[_0x4405('0x19')](_0x5799a7));_0x5f548a[_0x4405('0xd')]();}};}; \ 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 ec215fc..7d936d5 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 _0x56f2=['priority','findIndex','rules','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','join','stop','[%s][GOTOP]\x20priority\x20%s'];(function(_0x2fcbce,_0x1d72c4){var _0x346691=function(_0x5dcb52){while(--_0x5dcb52){_0x2fcbce['push'](_0x2fcbce['shift']());}};_0x346691(++_0x1d72c4);}(_0x56f2,0x1ab));var _0x256f=function(_0x42e41d,_0x2c8ca4){_0x42e41d=_0x42e41d-0x0;var _0x3c220b=_0x56f2[_0x42e41d];return _0x3c220b;};'use strict';var schema=require(_0x256f('0x0'));var _=require(_0x256f('0x1'));var logger=require(_0x256f('0x2'))(_0x256f('0x3'));var gotop=schema({'priority':{'type':_0x256f('0x4'),'required':!![],'message':_0x256f('0x5')}});exports[_0x256f('0x6')]=function(_0xc2b878,_0x18387){return function(_0x2c87cc){try{var _0x472585={'priority':_0x18387[0x0]};var _0x5a3d54=gotop[_0x256f('0x0')](_0x472585,{'typecast':!![]});if(_0x5a3d54[_0x256f('0x7')]){logger['error'](_0x256f('0x8'),_0xc2b878,_[_0x256f('0x9')](_0x5a3d54,'message')[_0x256f('0xa')](',\x20'));_0x2c87cc[_0x256f('0xb')]();}else{logger['info'](_0x256f('0xc'),_0xc2b878,_0x472585[_0x256f('0xd')]);if(_0x472585['priority']){var _0x464556=_[_0x256f('0xe')](_0x2c87cc[_0x256f('0xf')](),{'p':_0x472585[_0x256f('0xd')]});if(_0x464556>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xc2b878,_0x472585[_0x256f('0xd')]||'next',_0x464556);_0x2c87cc[_0x256f('0x10')](_0x464556);}else{logger[_0x256f('0x11')](_0x256f('0x12'),_0xc2b878,_0x472585[_0x256f('0xd')]||_0x256f('0x10'));_0x2c87cc['stop']();}}else{_0x2c87cc['next']();}}}catch(_0x2e9ea){logger['error'](_0x256f('0x8'),_0xc2b878,JSON[_0x256f('0x13')](_0x2e9ea));_0x2c87cc['stop']();}};}; \ No newline at end of file +var _0xafe5=['message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','map'];(function(_0x513046,_0x570f8c){var _0x436406=function(_0x1dfb8e){while(--_0x1dfb8e){_0x513046['push'](_0x513046['shift']());}};_0x436406(++_0x570f8c);}(_0xafe5,0xd4));var _0x5afe=function(_0x4bf926,_0x139ab8){_0x4bf926=_0x4bf926-0x0;var _0x4894b3=_0xafe5[_0x4bf926];return _0x4894b3;};'use strict';var schema=require(_0x5afe('0x0'));var _=require('lodash');var logger=require(_0x5afe('0x1'))(_0x5afe('0x2'));var gotop=schema({'priority':{'type':_0x5afe('0x3'),'required':!![],'message':_0x5afe('0x4')}});exports[_0x5afe('0x5')]=function(_0x2ae8fa,_0x463fa2){return function(_0x5d37b3){try{var _0x25e562={'priority':_0x463fa2[0x0]};var _0x17f0d6=gotop['validate'](_0x25e562,{'typecast':!![]});if(_0x17f0d6['length']){logger['error'](_0x5afe('0x6'),_0x2ae8fa,_[_0x5afe('0x7')](_0x17f0d6,_0x5afe('0x8'))[_0x5afe('0x9')](',\x20'));_0x5d37b3[_0x5afe('0xa')]();}else{logger[_0x5afe('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x2ae8fa,_0x25e562[_0x5afe('0xc')]);if(_0x25e562[_0x5afe('0xc')]){var _0x43a54e=_[_0x5afe('0xd')](_0x5d37b3[_0x5afe('0xe')](),{'p':_0x25e562['priority']});if(_0x43a54e>=0x0){logger[_0x5afe('0xb')](_0x5afe('0xf'),_0x2ae8fa,_0x25e562[_0x5afe('0xc')]||_0x5afe('0x10'),_0x43a54e);_0x5d37b3[_0x5afe('0x10')](_0x43a54e);}else{logger[_0x5afe('0xb')](_0x5afe('0x11'),_0x2ae8fa,_0x25e562[_0x5afe('0xc')]||'next');_0x5d37b3['stop']();}}else{_0x5d37b3['next']();}}}catch(_0x347850){logger[_0x5afe('0x12')](_0x5afe('0x6'),_0x2ae8fa,JSON[_0x5afe('0x13')](_0x347850));_0x5d37b3[_0x5afe('0xa')]();}};}; \ 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 607a8b3..ee9ff4f 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 _0xa9ba=['../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat','ChatWebsiteId','channel','AccountId','account','upperFirst','InteractionId','interaction','then','info','[%s][MESSAGE]\x20%s','error','stringify','stop','lodash'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9ba,0x1e2));var _0xaa9b=function(_0x485128,_0xcd1787){_0x485128=_0x485128-0x0;var _0x4d4375=_0xa9ba[_0x485128];return _0x4d4375;};'use strict';var _=require(_0xaa9b('0x0'));var utils=require('./utils');var logger=require(_0xaa9b('0x1'))('routing');var rpc={'chatMessage':require(_0xaa9b('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xaa9b('0x3')),'smsMessage':require(_0xaa9b('0x4')),'faxMessage':require(_0xaa9b('0x5')),'whatsappMessage':require(_0xaa9b('0x6'))};exports['consequence']=function(_0x44a011,_0x9f0e1b){return function(_0x5e16fe){try{var _0x388d89={'body':utils[_0xaa9b('0x7')](_0x9f0e1b[0x0],this),'ContactId':this[_0xaa9b('0x8')]['id']};if(this['channel']===_0xaa9b('0x9')){_0x388d89[_0xaa9b('0xa')]=this['account']['id'];}else{_0x388d89[_['upperFirst'](this[_0xaa9b('0xb')])+_0xaa9b('0xc')]=this[_0xaa9b('0xd')]['id'];}_0x388d89[_[_0xaa9b('0xe')](this[_0xaa9b('0xb')])+_0xaa9b('0xf')]=this[_0xaa9b('0x10')]['id'];if(rpc[this[_0xaa9b('0xb')]+'Message']){return rpc[this[_0xaa9b('0xb')]+'Message']['create'](_0x388d89)[_0xaa9b('0x11')](function(_0x451771){logger[_0xaa9b('0x12')](_0xaa9b('0x13'),_0x44a011,_0x388d89['body']);_0x5e16fe['next']();})['catch'](function(_0x1f6a72){logger[_0xaa9b('0x14')]('[%s][MESSAGE]\x20%s',_0x44a011,JSON[_0xaa9b('0x15')](_0x1f6a72));_0x5e16fe[_0xaa9b('0x16')]();});}}catch(_0x466ae9){logger[_0xaa9b('0x14')](_0xaa9b('0x13'),_0x44a011,JSON['stringify'](_0x466ae9));_0x5e16fe[_0xaa9b('0x16')]();}};}; \ No newline at end of file +var _0x152f=['lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','chat','ChatWebsiteId','upperFirst','channel','account','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop'];(function(_0x3af62a,_0x3e13dd){var _0x1601df=function(_0x5addcd){while(--_0x5addcd){_0x3af62a['push'](_0x3af62a['shift']());}};_0x1601df(++_0x3e13dd);}(_0x152f,0x144));var _0xf152=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x152f[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xf152('0x0'));var utils=require(_0xf152('0x1'));var logger=require(_0xf152('0x2'))(_0xf152('0x3'));var rpc={'chatMessage':require(_0xf152('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf152('0x5')),'smsMessage':require(_0xf152('0x6')),'faxMessage':require(_0xf152('0x7')),'whatsappMessage':require(_0xf152('0x8'))};exports['consequence']=function(_0x286a5f,_0x542973){return function(_0xa9deff){try{var _0x504fb6={'body':utils[_0xf152('0x9')](_0x542973[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xf152('0xa')){_0x504fb6[_0xf152('0xb')]=this['account']['id'];}else{_0x504fb6[_[_0xf152('0xc')](this[_0xf152('0xd')])+'AccountId']=this[_0xf152('0xe')]['id'];}_0x504fb6[_[_0xf152('0xc')](this[_0xf152('0xd')])+_0xf152('0xf')]=this[_0xf152('0x10')]['id'];if(rpc[this[_0xf152('0xd')]+_0xf152('0x11')]){return rpc[this[_0xf152('0xd')]+_0xf152('0x11')][_0xf152('0x12')](_0x504fb6)[_0xf152('0x13')](function(_0x445e61){logger[_0xf152('0x14')](_0xf152('0x15'),_0x286a5f,_0x504fb6['body']);_0xa9deff[_0xf152('0x16')]();})[_0xf152('0x17')](function(_0x4cf355){logger[_0xf152('0x18')](_0xf152('0x15'),_0x286a5f,JSON[_0xf152('0x19')](_0x4cf355));_0xa9deff['stop']();});}}catch(_0x3bf2ab){logger[_0xf152('0x18')]('[%s][MESSAGE]\x20%s',_0x286a5f,JSON[_0xf152('0x19')](_0x3bf2ab));_0xa9deff[_0xf152('0x1a')]();}};}; \ 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 617e96f..19aee84 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 _0x9b61=['stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x9b61,0x1f0));var _0x19b6=function(_0xa834d7,_0x35afa4){_0xa834d7=_0xa834d7-0x0;var _0x3ffa0d=_0x9b61[_0xa834d7];return _0x3ffa0d;};'use strict';var utils=require('./utils');var logger=require(_0x19b6('0x0'))(_0x19b6('0x1'));exports[_0x19b6('0x2')]=function(_0x56238f,_0x51ce85){return function(_0x104cf2){try{logger[_0x19b6('0x3')](_0x19b6('0x4'),_0x56238f,utils[_0x19b6('0x5')](_0x51ce85[0x0],this));_0x104cf2['next']();}catch(_0x3ca80c){logger[_0x19b6('0x6')]('[%s][NOOP]\x20%s',_0x56238f,JSON[_0x19b6('0x7')](_0x3ca80c));_0x104cf2[_0x19b6('0x8')]();}};}; \ No newline at end of file +var _0xe3a9=['next','error','stringify','stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x3644b9,_0x5cd3a6){var _0x4d196d=function(_0x2bb4ef){while(--_0x2bb4ef){_0x3644b9['push'](_0x3644b9['shift']());}};_0x4d196d(++_0x5cd3a6);}(_0xe3a9,0xc2));var _0x9e3a=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xe3a9[_0xa8883];return _0x479426;};'use strict';var utils=require(_0x9e3a('0x0'));var logger=require(_0x9e3a('0x1'))('routing');exports[_0x9e3a('0x2')]=function(_0x2b772f,_0x460e65){return function(_0x232b08){try{logger[_0x9e3a('0x3')](_0x9e3a('0x4'),_0x2b772f,utils[_0x9e3a('0x5')](_0x460e65[0x0],this));_0x232b08[_0x9e3a('0x6')]();}catch(_0x3f8530){logger[_0x9e3a('0x7')](_0x9e3a('0x4'),_0x2b772f,JSON[_0x9e3a('0x8')](_0x3f8530));_0x232b08[_0x9e3a('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 2dd2571..bc8fb9c 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 _0x64d9=['name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','defaults','redis','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','push','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../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','list','upperFirst','QueueId','channel','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x64d9,0xcb));var _0x964d=function(_0x34e76b,_0x402494){_0x34e76b=_0x34e76b-0x0;var _0xdcb6bd=_0x64d9[_0x34e76b];return _0xdcb6bd;};'use strict';var schema=require(_0x964d('0x0'));var _=require(_0x964d('0x1'));var util=require(_0x964d('0x2'));var seqqueue=require(_0x964d('0x3'));var moment=require(_0x964d('0x4'));var Redis=require(_0x964d('0x5'));var config=require(_0x964d('0x6'));var logger=require(_0x964d('0x7'))(_0x964d('0x8'));var strategy=require('./strategy');config['redis']=_[_0x964d('0x9')](config[_0x964d('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x964d('0xb'))(new Redis(config['redis']));var attributes=['id',_0x964d('0xc'),_0x964d('0xd'),_0x964d('0xe'),_0x964d('0xf'),_0x964d('0x10')];function emit(_0x553560,_0x43b3a1,_0xc5f7f4){io['to'](_0x553560)['emit'](_0x43b3a1,_0xc5f7f4);}function emitChannelQueueInteraction(_0x6e72ec,_0x3fef2e,_0x5d55fe,_0x17484a,_0x3e90cb,_0x18addc,_0x31421d,_0x57827f){var _0x1d3cba=_[_0x964d('0x11')](_0x5d55fe);_0x1d3cba[_0x964d('0xc')]=_0x57827f;_0x1d3cba[_0x964d('0xe')]=_0x3fef2e;_0x1d3cba[_0x964d('0xd')]=_0x17484a;_0x1d3cba['id']=_0x3e90cb;if(_0x18addc){attributes[_0x964d('0x12')](_['capitalize'](_0x6e72ec)+_0x964d('0x13'));_0x31421d[util[_0x964d('0x14')](_0x964d('0x15'),_0x6e72ec)][_0x3e90cb]=_[_0x964d('0x16')](_0x1d3cba,attributes);}else{delete _0x31421d[util[_0x964d('0x14')](_0x964d('0x15'),_0x6e72ec)][_0x3e90cb];}emit(util[_0x964d('0x14')](_0x964d('0x17'),_0x6e72ec,_0x3fef2e),util[_0x964d('0x14')](_0x964d('0x18'),_0x6e72ec,_0x18addc?_0x964d('0x19'):_0x964d('0x1a')),_[_0x964d('0x16')](_0x1d3cba,attributes));}var rpc={'openchannelQueueReport':require(_0x964d('0x1b')),'mailQueueReport':require(_0x964d('0x1c')),'chatQueueReport':require(_0x964d('0x1d')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x964d('0x1e')),'whatsappQueueReport':require(_0x964d('0x1f')),'chatInteraction':require(_0x964d('0x20')),'faxInteraction':require(_0x964d('0x21')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x964d('0x22')),'whatsappInteraction':require(_0x964d('0x23'))};var queue=schema({'name':{'type':_0x964d('0x24'),'required':!![],'message':_0x964d('0x25')},'timeout':{'type':_0x964d('0x26'),'message':_0x964d('0x27')}});function startRouting(_0x17b1db,_0x4be4e7,_0x5e5404,_0x1aa0bb){if(_0x17b1db&&_0x4be4e7&&_0x5e5404){_0x4be4e7[_0x964d('0x28')]+=0x1;var _0x2b0791={'uniqueid':_0x17b1db,'from':_0x5e5404['body']?_0x5e5404[_0x964d('0x29')][_0x964d('0xf')]:'','joinAt':moment()[_0x964d('0x14')](_0x964d('0x2a')),'ContactId':_0x5e5404[_0x964d('0x2b')]?_0x5e5404['contact']['id']:null,'ListId':_0x5e5404[_0x964d('0x2c')]?_0x5e5404[_0x964d('0x2c')]['id']:null};_0x2b0791[_[_0x964d('0x2d')](_0x5e5404['channel'])+_0x964d('0x2e')]=_0x4be4e7['id']||null;_0x2b0791[_[_0x964d('0x2d')](_0x5e5404[_0x964d('0x2f')])+_0x964d('0x13')]=_0x5e5404[_0x964d('0x30')]?_0x5e5404[_0x964d('0x30')]['id']:null;_0x2b0791[_['upperFirst'](_0x5e5404[_0x964d('0x2f')])+_0x964d('0x31')]=_0x5e5404['message']?_0x5e5404[_0x964d('0x32')]['id']:null;_0x2b0791[_['upperFirst'](_0x5e5404['channel'])+(_0x5e5404['channel']!=='chat'?_0x964d('0x33'):_0x964d('0x34'))]=_0x5e5404[_0x964d('0xd')]?_0x5e5404[_0x964d('0xd')]['id']:null;logger[_0x964d('0x35')](util[_0x964d('0x14')](_0x964d('0x36'),_0x17b1db,_0x4be4e7['name']));emitChannelQueueInteraction(_0x5e5404['channel'],_0x4be4e7[_0x964d('0x37')],_0x2b0791,_0x5e5404[_0x964d('0xd')][_0x964d('0x37')],_0x5e5404[_0x964d('0x32')]['id'],!![],_0x1aa0bb,_0x4be4e7['id']);if(rpc[_0x5e5404[_0x964d('0x2f')]+_0x964d('0x38')]){return rpc[_0x5e5404[_0x964d('0x2f')]+_0x964d('0x38')][_0x964d('0x39')](_0x2b0791)[_0x964d('0x3a')](function(_0x134f60){logger[_0x964d('0x3b')]('create\x20queue\x20report',_0x134f60);});}}}function stopRouting(_0x57b545,_0x57e1c5,_0x2eedf1,_0x59ea3c){if(_0x57b545&&_0x57e1c5){_0x57e1c5['waiting']-=0x1;var _0x2e1b0f={'leaveAt':moment()[_0x964d('0x14')](_0x964d('0x2a')),'acceptAt':moment()[_0x964d('0x14')](_0x964d('0x2a')),'reason':_0x964d('0x3c')};logger[_0x964d('0x35')](util[_0x964d('0x14')](_0x964d('0x3d'),_0x57b545,_0x57e1c5[_0x964d('0x37')]));emitChannelQueueInteraction(_0x2eedf1[_0x964d('0x2f')],_0x57e1c5[_0x964d('0x37')],_0x2eedf1[_0x964d('0x29')],_0x2eedf1[_0x964d('0xd')]['name'],_0x2eedf1[_0x964d('0x32')]['id'],![],_0x59ea3c,_0x57e1c5['id']);return rpc[_0x2eedf1['channel']+_0x964d('0x3e')][_0x964d('0x3f')](_0x2eedf1[_0x964d('0x30')]['id'],{'queueId':_0x57e1c5['id']})[_0x964d('0x40')](function(){if(rpc[_0x2eedf1[_0x964d('0x2f')]+_0x964d('0x38')]){return rpc[_0x2eedf1['channel']+'QueueReport'][_0x964d('0x3f')](_0x57b545,_0x2e1b0f)[_0x964d('0x3a')](function(_0x40d840){logger[_0x964d('0x3b')](_0x964d('0x41'),_0x40d840);});}});}}function endRouting(_0x416919,_0x15aab8,_0x5358cc,_0x11ed4e){if(_0x416919&&_0x15aab8){_0x15aab8[_0x964d('0x28')]-=0x1;var _0x57c6cf={'leaveAt':moment()[_0x964d('0x14')](_0x964d('0x2a')),'exitAt':moment()[_0x964d('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x964d('0x42')};logger[_0x964d('0x35')](util['format'](_0x964d('0x43'),_0x416919,_0x15aab8[_0x964d('0x37')]));emitChannelQueueInteraction(_0x5358cc[_0x964d('0x2f')],_0x15aab8[_0x964d('0x37')],_0x5358cc[_0x964d('0x29')],_0x5358cc[_0x964d('0xd')][_0x964d('0x37')],_0x5358cc[_0x964d('0x32')]['id'],![],_0x11ed4e);if(rpc[_0x5358cc[_0x964d('0x2f')]+_0x964d('0x38')]){return rpc[_0x5358cc[_0x964d('0x2f')]+_0x964d('0x38')]['update'](_0x416919,_0x57c6cf)[_0x964d('0x3a')](function(_0x2139be){logger[_0x964d('0x3b')]('update\x20queue\x20report',_0x2139be);});}}}function handleFindQueue(_0x33acae){return function(_0x3974b3){return _0x3974b3['name']['toLowerCase']()===_0x33acae[_0x964d('0x44')]();};}exports[_0x964d('0x45')]=function(_0xc704d0,_0x86014e,_0x349670,_0x486e51){return function(_0x57eff3){try{var _0x4d4d9a={'name':_0x86014e[0x0],'timeout':_0x86014e[0x1]};var _0x1abbc9=queue[_0x964d('0x0')](_0x4d4d9a,{'typecast':!![]});if(_0x1abbc9[_0x964d('0x46')]){logger[_0x964d('0x3b')](_0x964d('0x47'),_0xc704d0,_[_0x964d('0x48')](_0x1abbc9,_0x964d('0x32'))[_0x964d('0x49')](',\x20'));_0x57eff3[_0x964d('0x4a')]();}else{var _0x51efbe=_[_0x964d('0x4b')](_0x349670[_0x486e51['channel']+_0x964d('0x4c')],handleFindQueue(_0x4d4d9a[_0x964d('0x37')]));if(_0x51efbe){startRouting(_0xc704d0,_0x51efbe,_0x486e51,_0x349670);var _0x4370e6=(_0x51efbe[_0x964d('0x42')]||0xa)*0x3e8;var _0x503b73=(_0x4d4d9a[_0x964d('0x42')]||0x14)*0x3e8;var _0x3c979e;if(_0x4370e6>_0x503b73){_0x503b73=_0x4370e6;}var _0x331216=seqqueue[_0x964d('0x4d')](_0x4370e6);_0x331216['id']=_0xc704d0;_0x331216['atimeout']=_0x4370e6;_0x331216[_0x964d('0x4e')]=_0x503b73;_0x331216['channel']=_0x486e51[_0x964d('0x2f')];_0x349670[_0x964d('0x4f')][_0xc704d0]['on'](_0x964d('0x50'),function(){logger[_0x964d('0x35')](_0x964d('0x51'),_0xc704d0);stopRouting(_0xc704d0,_0x51efbe,_0x486e51,_0x349670);clearTimeout(_0x3c979e);_0x3c979e=undefined;_0x331216['close'](!![]);if(_0x349670[_0x964d('0x4f')][_0xc704d0]){delete _0x349670[_0x964d('0x4f')][_0xc704d0];}_0x57eff3[_0x964d('0x4a')]();});_0x349670['rules'][_0xc704d0]['on']('complete',function(){if(_0x349670[_0x964d('0x4f')][_0xc704d0]){delete _0x349670[_0x964d('0x4f')][_0xc704d0];}});_0x3c979e=setTimeout(function(){logger[_0x964d('0x35')]('[%s][QUEUE]\x20APPLICATION\x20END',_0xc704d0);endRouting(_0xc704d0,_0x51efbe,_0x486e51,_0x349670);clearTimeout(_0x3c979e);_0x331216['close'](!![]);_0x57eff3[_0x964d('0x52')]();},_0x503b73);switch(_0x51efbe['strategy']){case _0x964d('0x53'):strategy[_0x964d('0x53')](_0x331216,_0x51efbe,_0x349670,_0x486e51);break;default:strategy[_0x964d('0x54')](_0x331216,_0x51efbe,_0x349670,_0x486e51);}}else{logger['error'](_0x964d('0x55'),_0xc704d0,_0x4d4d9a[_0x964d('0x37')]);_0x57eff3[_0x964d('0x4a')]();}}}catch(_0x36efa8){logger[_0x964d('0x3b')](_0x964d('0x47'),_0xc704d0,_0x36efa8['stack']);_0x57eff3[_0x964d('0x4a')]();}};}; \ No newline at end of file +var _0x54d5=['../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','error','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','stop','Queues','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','[%s][QUEUE]\x20APPLICATION\x20END','close','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0x54d5,0x1c9));var _0x554d=function(_0x240b3a,_0x1586aa){_0x240b3a=_0x240b3a-0x0;var _0x5a81ed=_0x54d5[_0x240b3a];return _0x5a81ed;};'use strict';var schema=require(_0x554d('0x0'));var _=require(_0x554d('0x1'));var util=require(_0x554d('0x2'));var seqqueue=require(_0x554d('0x3'));var moment=require(_0x554d('0x4'));var Redis=require(_0x554d('0x5'));var config=require(_0x554d('0x6'));var logger=require(_0x554d('0x7'))(_0x554d('0x8'));var strategy=require(_0x554d('0x9'));config[_0x554d('0xa')]=_[_0x554d('0xb')](config[_0x554d('0xa')],{'host':_0x554d('0xc'),'port':0x18eb});var io=require(_0x554d('0xd'))(new Redis(config[_0x554d('0xa')]));var attributes=['id',_0x554d('0xe'),_0x554d('0xf'),_0x554d('0x10'),_0x554d('0x11'),_0x554d('0x12')];function emit(_0x297ca0,_0x1a59b0,_0x2c4e2c){io['to'](_0x297ca0)[_0x554d('0x13')](_0x1a59b0,_0x2c4e2c);}function emitChannelQueueInteraction(_0x5e387a,_0x3912e6,_0x293ed4,_0x36dceb,_0x563535,_0x44f612,_0xd1822e,_0x5c1633){var _0x42214a=_[_0x554d('0x14')](_0x293ed4);_0x42214a['queue_id']=_0x5c1633;_0x42214a[_0x554d('0x10')]=_0x3912e6;_0x42214a[_0x554d('0xf')]=_0x36dceb;_0x42214a['id']=_0x563535;if(_0x44f612){attributes['push'](_['capitalize'](_0x5e387a)+_0x554d('0x15'));_0xd1822e[util[_0x554d('0x16')](_0x554d('0x17'),_0x5e387a)][_0x563535]=_[_0x554d('0x18')](_0x42214a,attributes);}else{delete _0xd1822e[util['format'](_0x554d('0x17'),_0x5e387a)][_0x563535];}emit(util[_0x554d('0x16')](_0x554d('0x19'),_0x5e387a,_0x3912e6),util[_0x554d('0x16')](_0x554d('0x1a'),_0x5e387a,_0x44f612?_0x554d('0x1b'):_0x554d('0x1c')),_[_0x554d('0x18')](_0x42214a,attributes));}var rpc={'openchannelQueueReport':require(_0x554d('0x1d')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x554d('0x1e')),'smsQueueReport':require(_0x554d('0x1f')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x554d('0x20')),'mailInteraction':require(_0x554d('0x21')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x554d('0x22')),'whatsappInteraction':require(_0x554d('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x554d('0x24')},'timeout':{'type':_0x554d('0x25'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x207178,_0x18aaa3,_0x306851,_0x43bd4e){if(_0x207178&&_0x18aaa3&&_0x306851){_0x18aaa3[_0x554d('0x26')]+=0x1;var _0x3195d0={'uniqueid':_0x207178,'from':_0x306851[_0x554d('0x27')]?_0x306851[_0x554d('0x27')][_0x554d('0x11')]:'','joinAt':moment()[_0x554d('0x16')](_0x554d('0x28')),'ContactId':_0x306851[_0x554d('0x29')]?_0x306851[_0x554d('0x29')]['id']:null,'ListId':_0x306851[_0x554d('0x2a')]?_0x306851['list']['id']:null};_0x3195d0[_['upperFirst'](_0x306851[_0x554d('0x2b')])+_0x554d('0x2c')]=_0x18aaa3['id']||null;_0x3195d0[_[_0x554d('0x2d')](_0x306851['channel'])+_0x554d('0x15')]=_0x306851[_0x554d('0x2e')]?_0x306851[_0x554d('0x2e')]['id']:null;_0x3195d0[_['upperFirst'](_0x306851[_0x554d('0x2b')])+_0x554d('0x2f')]=_0x306851[_0x554d('0x30')]?_0x306851[_0x554d('0x30')]['id']:null;_0x3195d0[_[_0x554d('0x2d')](_0x306851[_0x554d('0x2b')])+(_0x306851[_0x554d('0x2b')]!==_0x554d('0x31')?_0x554d('0x32'):'WebsiteId')]=_0x306851[_0x554d('0xf')]?_0x306851['account']['id']:null;logger[_0x554d('0x33')](util[_0x554d('0x16')](_0x554d('0x34'),_0x207178,_0x18aaa3[_0x554d('0x35')]));emitChannelQueueInteraction(_0x306851[_0x554d('0x2b')],_0x18aaa3[_0x554d('0x35')],_0x3195d0,_0x306851[_0x554d('0xf')][_0x554d('0x35')],_0x306851[_0x554d('0x30')]['id'],!![],_0x43bd4e,_0x18aaa3['id']);if(rpc[_0x306851[_0x554d('0x2b')]+_0x554d('0x36')]){return rpc[_0x306851['channel']+_0x554d('0x36')]['create'](_0x3195d0)['catch'](function(_0x5cb28d){logger['error'](_0x554d('0x37'),_0x5cb28d);});}}}function stopRouting(_0x523b8d,_0x150ff8,_0x1d0468,_0x107a24){if(_0x523b8d&&_0x150ff8){_0x150ff8[_0x554d('0x26')]-=0x1;var _0x389510={'leaveAt':moment()[_0x554d('0x16')](_0x554d('0x28')),'acceptAt':moment()['format'](_0x554d('0x28')),'reason':_0x554d('0x38')};logger[_0x554d('0x33')](util[_0x554d('0x16')](_0x554d('0x39'),_0x523b8d,_0x150ff8[_0x554d('0x35')]));emitChannelQueueInteraction(_0x1d0468['channel'],_0x150ff8[_0x554d('0x35')],_0x1d0468[_0x554d('0x27')],_0x1d0468[_0x554d('0xf')][_0x554d('0x35')],_0x1d0468[_0x554d('0x30')]['id'],![],_0x107a24,_0x150ff8['id']);return rpc[_0x1d0468[_0x554d('0x2b')]+'Interaction'][_0x554d('0x3a')](_0x1d0468[_0x554d('0x2e')]['id'],{'queueId':_0x150ff8['id']})[_0x554d('0x3b')](function(){if(rpc[_0x1d0468[_0x554d('0x2b')]+_0x554d('0x36')]){return rpc[_0x1d0468[_0x554d('0x2b')]+'QueueReport']['update'](_0x523b8d,_0x389510)[_0x554d('0x3c')](function(_0xc12129){logger['error'](_0x554d('0x3d'),_0xc12129);});}});}}function endRouting(_0x1869c1,_0x5ecd67,_0x438ce2,_0x350dd3){if(_0x1869c1&&_0x5ecd67){_0x5ecd67[_0x554d('0x26')]-=0x1;var _0x5bde4c={'leaveAt':moment()['format'](_0x554d('0x28')),'exitAt':moment()[_0x554d('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x554d('0x3e')};logger[_0x554d('0x33')](util[_0x554d('0x16')](_0x554d('0x3f'),_0x1869c1,_0x5ecd67['name']));emitChannelQueueInteraction(_0x438ce2[_0x554d('0x2b')],_0x5ecd67[_0x554d('0x35')],_0x438ce2[_0x554d('0x27')],_0x438ce2[_0x554d('0xf')][_0x554d('0x35')],_0x438ce2[_0x554d('0x30')]['id'],![],_0x350dd3);if(rpc[_0x438ce2[_0x554d('0x2b')]+_0x554d('0x36')]){return rpc[_0x438ce2['channel']+_0x554d('0x36')]['update'](_0x1869c1,_0x5bde4c)[_0x554d('0x3c')](function(_0x2e5f6e){logger[_0x554d('0x40')](_0x554d('0x3d'),_0x2e5f6e);});}}}function handleFindQueue(_0x4cbe01){return function(_0xf6d48d){return _0xf6d48d[_0x554d('0x35')][_0x554d('0x41')]()===_0x4cbe01[_0x554d('0x41')]();};}exports[_0x554d('0x42')]=function(_0x3394dc,_0x2543e7,_0x55af74,_0x528795){return function(_0x2da5db){try{var _0x39e34e={'name':_0x2543e7[0x0],'timeout':_0x2543e7[0x1]};var _0x41db09=queue[_0x554d('0x0')](_0x39e34e,{'typecast':!![]});if(_0x41db09[_0x554d('0x43')]){logger[_0x554d('0x40')](_0x554d('0x44'),_0x3394dc,_['map'](_0x41db09,_0x554d('0x30'))['join'](',\x20'));_0x2da5db[_0x554d('0x45')]();}else{var _0x18f135=_['find'](_0x55af74[_0x528795[_0x554d('0x2b')]+_0x554d('0x46')],handleFindQueue(_0x39e34e[_0x554d('0x35')]));if(_0x18f135){startRouting(_0x3394dc,_0x18f135,_0x528795,_0x55af74);var _0x402797=(_0x18f135[_0x554d('0x3e')]||0xa)*0x3e8;var _0x36d89f=(_0x39e34e[_0x554d('0x3e')]||0x14)*0x3e8;var _0x2b2c91;if(_0x402797>_0x36d89f){_0x36d89f=_0x402797;}var _0x21eec6=seqqueue['createQueue'](_0x402797);_0x21eec6['id']=_0x3394dc;_0x21eec6['atimeout']=_0x402797;_0x21eec6[_0x554d('0x47')]=_0x36d89f;_0x21eec6['channel']=_0x528795[_0x554d('0x2b')];_0x55af74['rules'][_0x3394dc]['on'](_0x554d('0x48'),function(){logger[_0x554d('0x33')](_0x554d('0x49'),_0x3394dc);stopRouting(_0x3394dc,_0x18f135,_0x528795,_0x55af74);clearTimeout(_0x2b2c91);_0x2b2c91=undefined;_0x21eec6['close'](!![]);if(_0x55af74[_0x554d('0x4a')][_0x3394dc]){delete _0x55af74['rules'][_0x3394dc];}_0x2da5db[_0x554d('0x45')]();});_0x55af74[_0x554d('0x4a')][_0x3394dc]['on']('complete',function(){if(_0x55af74[_0x554d('0x4a')][_0x3394dc]){delete _0x55af74[_0x554d('0x4a')][_0x3394dc];}});_0x2b2c91=setTimeout(function(){logger[_0x554d('0x33')](_0x554d('0x4b'),_0x3394dc);endRouting(_0x3394dc,_0x18f135,_0x528795,_0x55af74);clearTimeout(_0x2b2c91);_0x21eec6[_0x554d('0x4c')](!![]);_0x2da5db[_0x554d('0x4d')]();},_0x36d89f);switch(_0x18f135['strategy']){case _0x554d('0x4e'):strategy['rrmemory'](_0x21eec6,_0x18f135,_0x55af74,_0x528795);break;default:strategy[_0x554d('0x4f')](_0x21eec6,_0x18f135,_0x55af74,_0x528795);}}else{logger['error'](_0x554d('0x50'),_0x3394dc,_0x39e34e[_0x554d('0x35')]);_0x2da5db[_0x554d('0x45')]();}}}catch(_0x1fb624){logger[_0x554d('0x40')]('[%s][QUEUE]\x20%s',_0x3394dc,_0x1fb624[_0x554d('0x51')]);_0x2da5db[_0x554d('0x45')]();}};}; \ 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 92e7ce2..0d5f493 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 _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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x4c41c4,_0x75bc8a){_0x4c41c4=_0x4c41c4-0x0;var _0x2bdc48=_0xd0bb[_0x4c41c4];return _0x2bdc48;};'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 +var _0x7217=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog','RINGING'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x7217,0x19e));var _0x7721=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7217[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x7721('0x0'));var uuid=require('uuid');var util=require(_0x7721('0x1'));var logger=require(_0x7721('0x2'))(_0x7721('0x3'));var Agent=function(_0x2a78d8,_0x115ab3,_0x4d6446,_0x5bf160){this[_0x7721('0x4')]=uuid['v4']();this[_0x7721('0x5')]=_0x2a78d8;this[_0x7721('0x6')]=_0x115ab3;this[_0x7721('0x7')]=_0x4d6446;this[_0x7721('0x3')]=_0x5bf160;this[_0x7721('0x5')][_0x7721('0x8')](this[_0x7721('0x9')][_0x7721('0xa')](this),this[_0x7721('0xb')][_0x7721('0xa')](this));this[_0x7721('0x5')]['on'](_0x7721('0xc'),this[_0x7721('0xb')][_0x7721('0xa')](this));this['squeue']['on'](_0x7721('0xd'),this[_0x7721('0xe')][_0x7721('0xa')](this));};Agent[_0x7721('0xf')][_0x7721('0x8')]=function(){this[_0x7721('0x5')][_0x7721('0x8')](this[_0x7721('0x9')]['bind'](this),this[_0x7721('0xb')][_0x7721('0xa')](this));};Agent['prototype'][_0x7721('0xe')]=function(){this[_0x7721('0xb')](!![]);};Agent[_0x7721('0xf')][_0x7721('0x9')]=function(){logger['debug'](_0x7721('0x10'),this[_0x7721('0x5')]['id'],this['agent']['id']);if(_['isNil'](this['realtime'][_0x7721('0x11')][this[_0x7721('0x6')]['id']])){logger[_0x7721('0x12')](_0x7721('0x13'),this['squeue']['id'],this[_0x7721('0x6')]['id']);setTimeout(this['push'][_0x7721('0xa')](this),0x3e8);}else{if(this['routing'][_0x7721('0x14')]||util[_0x7721('0x15')](this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']],this[_0x7721('0x5')][_0x7721('0x16')],![])){this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']][_0x7721('0x17')]=!![];this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']]['busyQueue']=undefined;util[_0x7721('0x18')](this['realtime'],this[_0x7721('0x3')],this[_0x7721('0x6')],this[_0x7721('0x5')][_0x7721('0x16')]);util[_0x7721('0x19')](this[_0x7721('0x4')],this[_0x7721('0x5')]['id'],this['realtime'][_0x7721('0x11')][this[_0x7721('0x6')]['id']],null,this[_0x7721('0x3')]);util[_0x7721('0x1a')](this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']],_0x7721('0x1b')+(this['routing'][_0x7721('0x14')]?':FORCED':''));}else{logger['debug'](_0x7721('0x1c'),this[_0x7721('0x5')]['id'],this[_0x7721('0x6')]['id']);setTimeout(this[_0x7721('0x8')][_0x7721('0xa')](this),0x3e8);}}};Agent[_0x7721('0xf')][_0x7721('0xb')]=function(_0x1da2d8){if(_['isNil'](this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']])){return logger['debug'](_0x7721('0x13'),this[_0x7721('0x5')]['id'],this['agent']['id']);}else{logger[_0x7721('0x12')](_0x7721('0x1d'),this[_0x7721('0x5')]['id'],this['agent']['id']);util[_0x7721('0x1e')](this[_0x7721('0x4')],this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']],null,this[_0x7721('0x3')]);this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']][_0x7721('0x17')]=![];this[_0x7721('0x7')]['agents'][this[_0x7721('0x6')]['id']]['busyQueue']=undefined;util[_0x7721('0x1f')](this[_0x7721('0x7')],this[_0x7721('0x3')],this[_0x7721('0x6')],this[_0x7721('0x5')][_0x7721('0x16')]);util[_0x7721('0x1a')](this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']],_0x1da2d8?'STOP':_0x7721('0x20'));}if(!_0x1da2d8){setTimeout(this['push'][_0x7721('0xa')](this),0x3e8);}};function agent(_0x35614c,_0x7942f7,_0x1d03de,_0x3968f3){return new Agent(_0x35614c,_0x7942f7,_0x1d03de,_0x3968f3);}module[_0x7721('0x21')]=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 6e7183a..fd621ef 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 _0xa530=['routing','push','handleTimeout','bind','timeout','drained','handleDrained','handleRun','prototype','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busyQueue','name','saveWaitingNotification','channel','showNotification','debug','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','notificationId','squeue','queue','realtime'];(function(_0x58d291,_0x561f0a){var _0x4a3a5c=function(_0x4a88c0){while(--_0x4a88c0){_0x58d291['push'](_0x58d291['shift']());}};_0x4a3a5c(++_0x561f0a);}(_0xa530,0x111));var _0x0a53=function(_0x5869f5,_0x176fd5){_0x5869f5=_0x5869f5-0x0;var _0x6beba1=_0xa530[_0x5869f5];return _0x6beba1;};'use strict';var _=require(_0x0a53('0x0'));var uuid=require('uuid');var util=require(_0x0a53('0x1'));var logger=require(_0x0a53('0x2'))('routing');var Beepall=function(_0x492d03,_0x114d93,_0x2455fe,_0x210a8a){this[_0x0a53('0x3')]=uuid['v4']();this[_0x0a53('0x4')]=_0x492d03;this[_0x0a53('0x5')]=_0x114d93;this[_0x0a53('0x6')]=_0x2455fe;this[_0x0a53('0x7')]=_0x210a8a;this['squeue'][_0x0a53('0x8')](this['handleRun']['bind'](this),this[_0x0a53('0x9')][_0x0a53('0xa')](this));this[_0x0a53('0x4')]['on'](_0x0a53('0xb'),this['handleTimeout'][_0x0a53('0xa')](this));this[_0x0a53('0x4')]['on'](_0x0a53('0xc'),this[_0x0a53('0xd')][_0x0a53('0xa')](this));};Beepall['prototype']['push']=function(){this[_0x0a53('0x4')][_0x0a53('0x8')](this[_0x0a53('0xe')][_0x0a53('0xa')](this),this[_0x0a53('0x9')][_0x0a53('0xa')](this));};Beepall['prototype'][_0x0a53('0xd')]=function(){this[_0x0a53('0x9')](!![]);};Beepall[_0x0a53('0xf')][_0x0a53('0xe')]=function(){var _0x4ed91d=!![];if(!_[_0x0a53('0x10')](this[_0x0a53('0x5')])&&!_[_0x0a53('0x10')](this[_0x0a53('0x5')][_0x0a53('0x11')])&&this[_0x0a53('0x5')]['Agents'][_0x0a53('0x12')]>0x0){for(var _0x25e80b=0x0,_0x3852e3;_0x25e80b0x0){for(var _0xe27b64=0x0,_0xe24b93;_0xe27b640x0&&_0x34745d[_0x2c21fa+_0x4ef7('0x24')]>=_0x34745d[_0x2c21fa+'Capacity']){writeLog(_0x4faff3,_0x34745d,_0x2c21fa['toUpperCase']()+_0x4ef7('0x25'));return![];}}return!![];};exports[_0x4ef7('0x26')]=function(_0x596c1f,_0x1dde22,_0x60a27e,_0x6bf767,_0xfe558e){return sendNotification(!![],_0x596c1f,_0x1dde22,_0x60a27e,_0x6bf767,_0xfe558e);};exports[_0x4ef7('0x27')]=function(_0x4ab1bf,_0x4433c2,_0x132c4d,_0x467601,_0x289389){return sendNotification(![],_0x4ab1bf,_0x4433c2,_0x132c4d,_0x467601,_0x289389);};exports[_0x4ef7('0x28')]=function(_0x4ccf19,_0x345876,_0x21a84f){var _0x29d6a5=_0x345876[_0x4ef7('0x29')][_0x4ef7('0x2a')];if(!_0x29d6a5&&_0x21a84f){_0x29d6a5=_0x21a84f['id'];}var _0x2d1c05=_[_0x4ef7('0x2b')](_0x4ccf19[_0x345876[_0x4ef7('0x2c')]+'QueuesWaitingInteractions'],function(_0x182afe){var _0x32fbbb=_['capitalize'](_0x345876[_0x4ef7('0x2c')])+_0x4ef7('0x2d');return _0x182afe[_0x32fbbb]===_0x345876[_0x4ef7('0x29')]['id'];});if(!_0x2d1c05&&_0x29d6a5&&_0x4ccf19['agents'][_0x29d6a5]){_0x2d1c05=_['some'](_0x4ccf19[_0x4ef7('0x2e')][_0x29d6a5][_0x345876[_0x4ef7('0x2c')]+_0x4ef7('0x2f')],function(_0x18d42e){return _0x18d42e['id']===_0x345876['interaction']['id'];});}return _0x2d1c05;};exports[_0x4ef7('0x30')]=function(_0x1afe82,_0x57e649,_0x4c0052,_0x34cc30){if(_0x4c0052&&_0x4c0052['id']&&_0x1afe82[_0x4ef7('0x2e')]&&_0x1afe82[_0x4ef7('0x2e')][_0x4c0052['id']]){_0x1afe82[_0x4ef7('0x2e')][_0x4c0052['id']][_0x34cc30+'WaitingInteractions'][_0x57e649['message']['id']]={'id':_0x57e649['interaction']['id']};}};exports[_0x4ef7('0x31')]=function(_0x532341,_0x485c1d,_0x1e22aa,_0x1d9ca4){if(_0x1e22aa&&_0x1e22aa['id']&&_0x532341[_0x4ef7('0x2e')]&&_0x532341[_0x4ef7('0x2e')][_0x1e22aa['id']]){delete _0x532341['agents'][_0x1e22aa['id']][_0x1d9ca4+_0x4ef7('0x2f')][_0x485c1d[_0x4ef7('0x17')]['id']];}};exports[_0x4ef7('0x32')]=writeLog; \ No newline at end of file +var _0x8546=['capitalize','channel','InteractionId','interaction','agents','WaitingInteractions','writeLog','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','split','\x20interaction','name','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','message','user:%s','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','UserId','some','QueuesWaitingInteractions'];(function(_0x45feb0,_0x112cfd){var _0x33e7ac=function(_0x4b7119){while(--_0x4b7119){_0x45feb0['push'](_0x45feb0['shift']());}};_0x33e7ac(++_0x112cfd);}(_0x8546,0x75));var _0x6854=function(_0x78bf58,_0x558768){_0x78bf58=_0x78bf58-0x0;var _0x484113=_0x8546[_0x78bf58];return _0x484113;};'use strict';var _=require('lodash');var util=require(_0x6854('0x0'));var utils=require(_0x6854('0x1'));var Redis=require(_0x6854('0x2'));var config=require(_0x6854('0x3'));var logger=require(_0x6854('0x4'))(_0x6854('0x5'));config[_0x6854('0x6')]=_[_0x6854('0x7')](config[_0x6854('0x6')],{'host':_0x6854('0x8'),'port':0x18eb});var io=require(_0x6854('0x9'))(new Redis(config[_0x6854('0x6')]));function sendNotification(_0x38ab8f,_0x149138,_0x2f41e6,_0x180f79,_0x126d83,_0x67bc7e){var _0x4d3595=_0x67bc7e||{};var _0x316f9c=_0x2f41e6[_0x6854('0xa')]('.');var _0xb95a78={'uniqueid':_0x149138,'channel':_0x316f9c[0x0],'id':_0x316f9c[0x1],'title':_0x316f9c[0x0]+_0x6854('0xb'),'interactionId':_0x316f9c[0x2],'queue':_0x126d83?_0x126d83[_0x6854('0xc')]:null,'sound':_0x4d3595['account']['notificationSound'],'shake':_0x4d3595[_0x6854('0xd')][_0x6854('0xe')]};try{if(!_0x4d3595[_0x6854('0xf')]){_0x4d3595[_0x6854('0xf')]={};}if(_0x126d83){_0x4d3595[_0x6854('0xf')]['queue']=_0x126d83;}else if(_0x4d3595[_0x6854('0xf')][_0x6854('0x10')]){delete _0x4d3595[_0x6854('0xf')][_0x6854('0x10')];}_0xb95a78[_0x6854('0x11')]=utils[_0x6854('0x12')](_0x4d3595[_0x6854('0xd')][_0x6854('0x13')],_0x4d3595);}catch(_0x4da1ec){_0xb95a78[_0x6854('0x11')]=_0x6854('0x14');logger[_0x6854('0x15')](util[_0x6854('0x16')]('[%s][QUEUE]\x20%s',_0x149138,_0x4da1ec[_0x6854('0x17')]));}io['to'](util[_0x6854('0x16')](_0x6854('0x18'),_0x180f79[_0x6854('0xc')]))[_0x6854('0x19')](util[_0x6854('0x16')](_0x6854('0x1a'),_0x38ab8f?_0x6854('0x1b'):_0x6854('0x1c')),_0xb95a78);}function writeLog(_0x3e787d,_0x3b48e4,_0x2bc582){return logger[_0x6854('0x1d')](util[_0x6854('0x16')](_0x6854('0x1e'),_0x3e787d,_0x3b48e4[_0x6854('0xc')],_0x2bc582));}exports[_0x6854('0x1f')]=function(_0x3bd157,_0x23f31a,_0x37ef2c,_0x128119){if(_0x23f31a[_0x6854('0x20')]){writeLog(_0x3bd157,_0x23f31a,'BUSY');return![];}if(!_0x23f31a[_0x6854('0x21')]){writeLog(_0x3bd157,_0x23f31a,_0x6854('0x22'));return![];}if(_0x23f31a[_0x37ef2c+_0x6854('0x23')]){writeLog(_0x3bd157,_0x23f31a,_0x6854('0x24'));return![];}if(_0x128119&&_0x23f31a[_0x6854('0x25')](_0x37ef2c+_0x6854('0x26'))&&_0x23f31a[_0x6854('0x25')](_0x37ef2c+_0x6854('0x27'))){if(_0x23f31a[_0x37ef2c+_0x6854('0x26')]>0x0&&_0x23f31a[_0x37ef2c+_0x6854('0x27')]>=_0x23f31a[_0x37ef2c+_0x6854('0x26')]){writeLog(_0x3bd157,_0x23f31a,_0x37ef2c[_0x6854('0x28')]()+_0x6854('0x29'));return![];}}return!![];};exports[_0x6854('0x2a')]=function(_0x38b7dd,_0x4c1081,_0x4e647c,_0x250d49,_0x5b74cc){return sendNotification(!![],_0x38b7dd,_0x4c1081,_0x4e647c,_0x250d49,_0x5b74cc);};exports[_0x6854('0x2b')]=function(_0x3c35b4,_0x1c4f6,_0xcca868,_0x2e3cce,_0x3f3a63){return sendNotification(![],_0x3c35b4,_0x1c4f6,_0xcca868,_0x2e3cce,_0x3f3a63);};exports[_0x6854('0x2c')]=function(_0x4e7c33,_0x3043b3,_0x1a8fb6){var _0x34245b=_0x3043b3['interaction'][_0x6854('0x2d')];if(!_0x34245b&&_0x1a8fb6){_0x34245b=_0x1a8fb6['id'];}var _0x1586f2=_[_0x6854('0x2e')](_0x4e7c33[_0x3043b3['channel']+_0x6854('0x2f')],function(_0x5e1a23){var _0x156a48=_[_0x6854('0x30')](_0x3043b3[_0x6854('0x31')])+_0x6854('0x32');return _0x5e1a23[_0x156a48]===_0x3043b3[_0x6854('0x33')]['id'];});if(!_0x1586f2&&_0x34245b&&_0x4e7c33['agents'][_0x34245b]){_0x1586f2=_['some'](_0x4e7c33[_0x6854('0x34')][_0x34245b][_0x3043b3[_0x6854('0x31')]+_0x6854('0x35')],function(_0x169454){return _0x169454['id']===_0x3043b3[_0x6854('0x33')]['id'];});}return _0x1586f2;};exports['saveWaitingNotification']=function(_0x1bb6c6,_0x429f7c,_0x229d48,_0x34bcf5){if(_0x229d48&&_0x229d48['id']&&_0x1bb6c6[_0x6854('0x34')]&&_0x1bb6c6[_0x6854('0x34')][_0x229d48['id']]){_0x1bb6c6[_0x6854('0x34')][_0x229d48['id']][_0x34bcf5+_0x6854('0x35')][_0x429f7c[_0x6854('0x17')]['id']]={'id':_0x429f7c[_0x6854('0x33')]['id']};}};exports['removeWaitingNotification']=function(_0x2b8c9f,_0x135dee,_0x3ad3fa,_0x1deccd){if(_0x3ad3fa&&_0x3ad3fa['id']&&_0x2b8c9f['agents']&&_0x2b8c9f[_0x6854('0x34')][_0x3ad3fa['id']]){delete _0x2b8c9f[_0x6854('0x34')][_0x3ad3fa['id']][_0x1deccd+_0x6854('0x35')][_0x135dee[_0x6854('0x17')]['id']];}};exports[_0x6854('0x36')]=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 1987dca..fda827f 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 _0x7074=['validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','stringify'];(function(_0x588a5a,_0x141bff){var _0x34b660=function(_0x30916e){while(--_0x30916e){_0x588a5a['push'](_0x588a5a['shift']());}};_0x34b660(++_0x141bff);}(_0x7074,0xdc));var _0x4707=function(_0x4275fe,_0x3f88f5){_0x4275fe=_0x4275fe-0x0;var _0x349e7c=_0x7074[_0x4275fe];return _0x349e7c;};'use strict';var schema=require(_0x4707('0x0'));var sh=require(_0x4707('0x1'));var _=require(_0x4707('0x2'));var utils=require(_0x4707('0x3'));var logger=require(_0x4707('0x4'))('routing');var system=schema({'command':{'type':_0x4707('0x5'),'required':!![],'message':_0x4707('0x6')}});exports[_0x4707('0x7')]=function(_0x2ee1f4,_0x541505){return function(_0x54e950){try{var _0x506d85={'command':_0x541505[0x0]};var _0x392cc8=system[_0x4707('0x0')](_0x506d85,{'typecast':!![]});if(_0x392cc8['length']){logger[_0x4707('0x8')](_0x4707('0x9'),_0x2ee1f4,_[_0x4707('0xa')](_0x392cc8,_0x4707('0xb'))['join'](',\x20'));logger[_0x4707('0xc')](_0x4707('0xd'),_0x2ee1f4);_0x54e950['next']();}else{var _0x1ed731=this;var _0x4d6fa0=utils['getMustacheRender'](_0x541505[0x0],this);logger[_0x4707('0xc')](_0x4707('0xe'),_0x2ee1f4,_0x4d6fa0);sh['exec'](_['trim'](_0x4d6fa0),function(_0x1adea3,_0x467442){logger['info'](_0x4707('0xf'),_0x2ee1f4,_0x1adea3);if(_0x1adea3==0x0){var _0x2be748=_0x467442['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x4707('0x10')](_0x541505[0x1])||_['isEmpty'](_0x541505[0x1])){logger[_0x4707('0xc')](_0x4707('0x11'),_0x2ee1f4);_0x1ed731[_0x4707('0x12')][_0x541505[0x1]]=_0x2be748;}else{logger['info'](_0x4707('0x13'),_0x2ee1f4,_0x541505[0x1],_0x2be748);_0x1ed731[_0x4707('0x12')][_0x541505[0x1]]=_0x2be748;}}_0x54e950[_0x4707('0x14')]();});}}catch(_0x51f841){logger[_0x4707('0x8')]('[%s][SYSTEM]\x20%s',_0x2ee1f4,_['isObject'](_0x51f841)?JSON[_0x4707('0x15')](_0x51f841):_0x51f841);logger[_0x4707('0xc')](_0x4707('0xd'),_0x2ee1f4);_0x54e950[_0x4707('0x14')]();}};}; \ No newline at end of file +var _0xabf2=['routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','isObject','stringify','validate','shelljs','./utils','../../../../config/logger'];(function(_0x10f5b2,_0x1cda8b){var _0xb3f77c=function(_0x5dead6){while(--_0x5dead6){_0x10f5b2['push'](_0x10f5b2['shift']());}};_0xb3f77c(++_0x1cda8b);}(_0xabf2,0xe6));var _0x2abf=function(_0x3bf610,_0x3bdc43){_0x3bf610=_0x3bf610-0x0;var _0x143e12=_0xabf2[_0x3bf610];return _0x143e12;};'use strict';var schema=require(_0x2abf('0x0'));var sh=require(_0x2abf('0x1'));var _=require('lodash');var utils=require(_0x2abf('0x2'));var logger=require(_0x2abf('0x3'))(_0x2abf('0x4'));var system=schema({'command':{'type':_0x2abf('0x5'),'required':!![],'message':_0x2abf('0x6')}});exports[_0x2abf('0x7')]=function(_0x5cac4e,_0x113984){return function(_0x44030d){try{var _0x9f9c63={'command':_0x113984[0x0]};var _0x228ff1=system[_0x2abf('0x0')](_0x9f9c63,{'typecast':!![]});if(_0x228ff1[_0x2abf('0x8')]){logger[_0x2abf('0x9')](_0x2abf('0xa'),_0x5cac4e,_[_0x2abf('0xb')](_0x228ff1,_0x2abf('0xc'))['join'](',\x20'));logger[_0x2abf('0xd')](_0x2abf('0xe'),_0x5cac4e);_0x44030d[_0x2abf('0xf')]();}else{var _0xb580e0=this;var _0x15a85c=utils[_0x2abf('0x10')](_0x113984[0x0],this);logger[_0x2abf('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5cac4e,_0x15a85c);sh[_0x2abf('0x11')](_[_0x2abf('0x12')](_0x15a85c),function(_0x16ae20,_0x503c21){logger[_0x2abf('0xd')](_0x2abf('0x13'),_0x5cac4e,_0x16ae20);if(_0x16ae20==0x0){var _0x10aa3a=_0x503c21[_0x2abf('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x2abf('0x15')](_0x113984[0x1])||_[_0x2abf('0x16')](_0x113984[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x5cac4e);_0xb580e0[_0x2abf('0x17')][_0x113984[0x1]]=_0x10aa3a;}else{logger[_0x2abf('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5cac4e,_0x113984[0x1],_0x10aa3a);_0xb580e0[_0x2abf('0x17')][_0x113984[0x1]]=_0x10aa3a;}}_0x44030d[_0x2abf('0xf')]();});}}catch(_0x1b4339){logger[_0x2abf('0x9')](_0x2abf('0xa'),_0x5cac4e,_[_0x2abf('0x18')](_0x1b4339)?JSON[_0x2abf('0x19')](_0x1b4339):_0x1b4339);logger['info'](_0x2abf('0xe'),_0x5cac4e);_0x44030d['next']();}};}; \ 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 574d88b..84778d7 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 _0xd0a5=['interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','stringify','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','info','next','channel','addTags'];(function(_0x5d1df9,_0x4a95bf){var _0x5d4feb=function(_0x37b443){while(--_0x37b443){_0x5d1df9['push'](_0x5d1df9['shift']());}};_0x5d4feb(++_0x4a95bf);}(_0xd0a5,0xc5));var _0x5d0a=function(_0x209584,_0x48b48c){_0x209584=_0x209584-0x0;var _0x3b5ea6=_0xd0a5[_0x209584];return _0x3b5ea6;};'use strict';var schema=require(_0x5d0a('0x0'));var _=require(_0x5d0a('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x5d0a('0x2')),'smsInteraction':require(_0x5d0a('0x3')),'mailInteraction':require(_0x5d0a('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x5d0a('0x5'))(_0x5d0a('0x6'));var tag=schema({'tag':{'type':_0x5d0a('0x7'),'required':!![],'message':_0x5d0a('0x8')}});exports[_0x5d0a('0x9')]=function(_0x4b1a19,_0x5b5f44,_0x5679e8,_0x38d4ff){return function(_0x24edc5){try{var _0x53673c={'tag':_0x5b5f44[0x0]};var _0x524e86=tag[_0x5d0a('0x0')](_0x53673c,{'typecast':!![]});if(_0x524e86[_0x5d0a('0xa')]){logger[_0x5d0a('0xb')](_0x5d0a('0xc'),_0x4b1a19,_[_0x5d0a('0xd')](_0x524e86,_0x5d0a('0xe'))['join'](',\x20'));logger[_0x5d0a('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4b1a19);_0x24edc5[_0x5d0a('0x10')]();}else{var _0x378243={'ids':[_0x5b5f44[0x0]]};if(rpc[_0x38d4ff[_0x5d0a('0x11')]+'Interaction']){rpc[_0x38d4ff[_0x5d0a('0x11')]+'Interaction'][_0x5d0a('0x12')](_0x38d4ff[_0x5d0a('0x13')]['id'],_0x378243)[_0x5d0a('0x14')](function(_0x4252a6){logger['info'](_0x5d0a('0x15'),_0x4b1a19,_0x5b5f44[0x1],_0x38d4ff['channel'],_0x38d4ff[_0x5d0a('0x13')]['id']);})[_0x5d0a('0x16')](function(_0x15ff3c){logger[_0x5d0a('0xb')](_0x5d0a('0xc'),_0x4b1a19,JSON['stringify'](_0x15ff3c));logger[_0x5d0a('0xf')](_0x5d0a('0x17'),_0x4b1a19);})[_0x5d0a('0x18')](function(){_0x24edc5[_0x5d0a('0x10')]();});}}}catch(_0x1ab843){logger['error'](_0x5d0a('0xc'),_0x4b1a19,_[_0x5d0a('0x19')](_0x1ab843)?JSON[_0x5d0a('0x1a')](_0x1ab843):_0x1ab843);logger[_0x5d0a('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4b1a19);_0x24edc5['next']();}};}; \ No newline at end of file +var _0x0228=['../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','message','join','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x3bc265,_0x4f9c45){var _0x50f7ab=function(_0x7c39c9){while(--_0x7c39c9){_0x3bc265['push'](_0x3bc265['shift']());}};_0x50f7ab(++_0x4f9c45);}(_0x0228,0xc4));var _0x8022=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0x0228[_0x53a7a8];return _0x555f71;};'use strict';var schema=require(_0x8022('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x8022('0x1')),'openchannelInteraction':require(_0x8022('0x2')),'smsInteraction':require(_0x8022('0x3')),'mailInteraction':require(_0x8022('0x4')),'faxInteraction':require(_0x8022('0x5')),'whatsappInteraction':require(_0x8022('0x6'))};var logger=require(_0x8022('0x7'))(_0x8022('0x8'));var tag=schema({'tag':{'type':_0x8022('0x9'),'required':!![],'message':_0x8022('0xa')}});exports['consequence']=function(_0x154b50,_0x25e16e,_0x7f6265,_0xc3c1a2){return function(_0x19a423){try{var _0x27d141={'tag':_0x25e16e[0x0]};var _0x1b015d=tag[_0x8022('0x0')](_0x27d141,{'typecast':!![]});if(_0x1b015d[_0x8022('0xb')]){logger['error'](_0x8022('0xc'),_0x154b50,_['map'](_0x1b015d,_0x8022('0xd'))[_0x8022('0xe')](',\x20'));logger[_0x8022('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x154b50);_0x19a423[_0x8022('0x10')]();}else{var _0x28b6b2={'ids':[_0x25e16e[0x0]]};if(rpc[_0xc3c1a2[_0x8022('0x11')]+_0x8022('0x12')]){rpc[_0xc3c1a2['channel']+_0x8022('0x12')][_0x8022('0x13')](_0xc3c1a2[_0x8022('0x14')]['id'],_0x28b6b2)[_0x8022('0x15')](function(_0x29540a){logger['info'](_0x8022('0x16'),_0x154b50,_0x25e16e[0x1],_0xc3c1a2['channel'],_0xc3c1a2['interaction']['id']);})[_0x8022('0x17')](function(_0x45963b){logger[_0x8022('0x18')](_0x8022('0xc'),_0x154b50,JSON[_0x8022('0x19')](_0x45963b));logger[_0x8022('0xf')](_0x8022('0x1a'),_0x154b50);})[_0x8022('0x1b')](function(){_0x19a423[_0x8022('0x10')]();});}}}catch(_0x1d632e){logger[_0x8022('0x18')](_0x8022('0xc'),_0x154b50,_[_0x8022('0x1c')](_0x1d632e)?JSON[_0x8022('0x19')](_0x1d632e):_0x1d632e);logger[_0x8022('0xf')](_0x8022('0x1a'),_0x154b50);_0x19a423['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index a95d6e4..c86464a 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 _0xfcc3=['utf8','application/json-rpc','then','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','info','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','method','login','stringify'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0xfcc3,0xf7));var _0x3fcc=function(_0x13a410,_0x446eae){_0x13a410=_0x13a410-0x0;var _0x181bd9=_0xfcc3[_0x13a410];return _0x181bd9;};'use strict';var rp=require(_0x3fcc('0x0'));var logger=require(_0x3fcc('0x1'))(_0x3fcc('0x2'));var _=require(_0x3fcc('0x3'));var arr=[];exports[_0x3fcc('0x4')]=function(_0x137f6b,_0x201059){return function(_0x2d1675){var _0x2fd81a=_0x201059[0xa];var _0x1b30ed=_0x201059[0xb];var _0x8e151d=_0x201059[0xc];var _0x5f01bf=_0x201059[0xd];var _0x2f733e=_0x201059[0xe];var _0x5f4cf9=_0x201059[0xf][_0x3fcc('0x5')](/\n/g,_0x3fcc('0x6'));var _0x42a2c7=_0x201059[0x10][_0x3fcc('0x5')](/\n/g,'\x20');if(!arr[_0x3fcc('0x7')](_0x1b30ed)){arr[_0x3fcc('0x8')](_0x1b30ed);var _0x5c08c8=_0x201059[0x3];var _0x592b09=_0x201059[0x4];var _0x5f4f16=_0x201059[0x1];var _0x518a93=_0x201059[0x0];var _0x233c6f={};_0x233c6f[_0x3fcc('0x9')]=_0x201059[0x8]+_0x3fcc('0xa')+_0x8e151d+'|'+_0x2fd81a+'|'+_0x5f01bf+'|'+_0x1b30ed+'|'+_0x2f733e;_0x233c6f[_0x3fcc('0xb')]=_0x201059[0x7]+'?params='+_0x8e151d+'|'+_0x2fd81a+'|'+_0x5f01bf+'|'+_0x1b30ed+'|'+_0x2f733e+'|'+_0x5f4cf9+'|'+_0x42a2c7;_0x233c6f[_0x3fcc('0xc')]=_0x201059[0x9];var _0x525ace={};_0x525ace['jsonrpc']=_0x3fcc('0xd');_0x525ace[_0x3fcc('0xe')]=_0x3fcc('0xf');var _0x453404=[];_0x453404['push'](_0x201059[0x2]);_0x453404[_0x3fcc('0x8')](_0x201059[0x5]);_0x453404['push'](_0x201059[0x6]);_0x525ace['params']=_0x453404;_0x525ace['id']=0x1;var _0x1ad817=JSON[_0x3fcc('0x10')](_0x525ace);var _0x5d86db={'encoding':_0x3fcc('0x11'),'method':'POST','timeout':0x2710,'url':_0x5c08c8,'headers':{'Content-Type':_0x3fcc('0x12')},'body':_0x1ad817};return rp(_0x5d86db)[_0x3fcc('0x13')](function(_0x136e15){const _0x3d3157=JSON[_0x3fcc('0x14')](_0x136e15);if(!_0x3d3157[_0x3fcc('0x15')][_0x3fcc('0x16')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x122421=_0x1b30ed;var _0x85f82b=_0x3fcc('0x17')+_0x5f4f16+_0x3fcc('0x18')+_0x518a93+_0x3fcc('0x19')+_0x122421+_0x3fcc('0x1a')+JSON[_0x3fcc('0x10')](_0x233c6f);var _0xbbf6cc=_0x592b09+'?'+_0x85f82b;return rp(_0xbbf6cc);})['then'](function(_0x2dbd8d){logger['info'](_0x3fcc('0x1b'),_0x137f6b,_0x2dbd8d);_0x2d1675[_0x3fcc('0x1c')]();})['catch'](function(_0x5e9507){logger[_0x3fcc('0x1d')](_0x3fcc('0x1e'),_0x137f6b,_[_0x3fcc('0x1f')](_0x5e9507)?JSON[_0x3fcc('0x10')](_0x5e9507):_0x5e9507);_0x2d1675['stop']();});}else{logger[_0x3fcc('0x20')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x137f6b);_0x2d1675['next']();}};}; \ No newline at end of file +var _0xec1d=['&sessionId=','&data=','info','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','\x20-\x20','push','urlOnAnswer','urlOnRing','?params=','title','2.0','method','params','stringify','utf8','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId='];(function(_0x492e0d,_0x52a2d3){var _0x37930d=function(_0x50108d){while(--_0x50108d){_0x492e0d['push'](_0x492e0d['shift']());}};_0x37930d(++_0x52a2d3);}(_0xec1d,0x164));var _0xdec1=function(_0x1d1d28,_0xcf8aa1){_0x1d1d28=_0x1d1d28-0x0;var _0x5140ff=_0xec1d[_0x1d1d28];return _0x5140ff;};'use strict';var rp=require(_0xdec1('0x0'));var logger=require(_0xdec1('0x1'))('routing');var _=require(_0xdec1('0x2'));var arr=[];exports[_0xdec1('0x3')]=function(_0x381550,_0x51aef0){return function(_0x220dce){var _0x1c7be8=_0x51aef0[0xa];var _0x54b580=_0x51aef0[0xb];var _0x41507e=_0x51aef0[0xc];var _0x582d70=_0x51aef0[0xd];var _0x41b5ba=_0x51aef0[0xe];var _0x263e29=_0x51aef0[0xf]['replace'](/\n/g,_0xdec1('0x4'));var _0x1ac952=_0x51aef0[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x54b580)){arr[_0xdec1('0x5')](_0x54b580);var _0xde7189=_0x51aef0[0x3];var _0x42b362=_0x51aef0[0x4];var _0x36dceb=_0x51aef0[0x1];var _0x583f0e=_0x51aef0[0x0];var _0x1b959e={};_0x1b959e[_0xdec1('0x6')]=_0x51aef0[0x8]+'?params='+_0x41507e+'|'+_0x1c7be8+'|'+_0x582d70+'|'+_0x54b580+'|'+_0x41b5ba;_0x1b959e[_0xdec1('0x7')]=_0x51aef0[0x7]+_0xdec1('0x8')+_0x41507e+'|'+_0x1c7be8+'|'+_0x582d70+'|'+_0x54b580+'|'+_0x41b5ba+'|'+_0x263e29+'|'+_0x1ac952;_0x1b959e[_0xdec1('0x9')]=_0x51aef0[0x9];var _0xef2a0f={};_0xef2a0f['jsonrpc']=_0xdec1('0xa');_0xef2a0f[_0xdec1('0xb')]='login';var _0x51010d=[];_0x51010d[_0xdec1('0x5')](_0x51aef0[0x2]);_0x51010d[_0xdec1('0x5')](_0x51aef0[0x5]);_0x51010d[_0xdec1('0x5')](_0x51aef0[0x6]);_0xef2a0f[_0xdec1('0xc')]=_0x51010d;_0xef2a0f['id']=0x1;var _0x180637=JSON[_0xdec1('0xd')](_0xef2a0f);var _0x3c979e={'encoding':_0xdec1('0xe'),'method':'POST','timeout':0x2710,'url':_0xde7189,'headers':{'Content-Type':_0xdec1('0xf')},'body':_0x180637};return rp(_0x3c979e)[_0xdec1('0x10')](function(_0x2de965){const _0x1c9ea8=JSON[_0xdec1('0x11')](_0x2de965);if(!_0x1c9ea8['result'][_0xdec1('0x12')]){throw new Error(_0xdec1('0x13'));}var _0x38d55b=_0x54b580;var _0x2e60fe='channelId='+_0x36dceb+_0xdec1('0x14')+_0x583f0e+_0xdec1('0x15')+_0x38d55b+_0xdec1('0x16')+JSON[_0xdec1('0xd')](_0x1b959e);var _0x524e5d=_0x42b362+'?'+_0x2e60fe;return rp(_0x524e5d);})[_0xdec1('0x10')](function(_0xedad38){logger[_0xdec1('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x381550,_0xedad38);_0x220dce['stop']();})['catch'](function(_0x5acf3f){logger[_0xdec1('0x18')](_0xdec1('0x19'),_0x381550,_[_0xdec1('0x1a')](_0x5acf3f)?JSON[_0xdec1('0xd')](_0x5acf3f):_0x5acf3f);_0x220dce['stop']();});}else{logger[_0xdec1('0x17')](_0xdec1('0x1b'),_0x381550);_0x220dce[_0xdec1('0x1c')]();}};}; \ 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 0828e17..4bdc23a 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x75e394,_0x155d10){var _0x21f86e=function(_0x4d83fb){while(--_0x4d83fb){_0x75e394['push'](_0x75e394['shift']());}};_0x21f86e(++_0x155d10);}(_0xe706,0xa3));var _0x6e70=function(_0x402b7e,_0x35fdf7){_0x402b7e=_0x402b7e-0x0;var _0x55f359=_0xe706[_0x402b7e];return _0x55f359;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x3735f9,_0x21dd55){var _0x59cfd2=function(_0x509649){while(--_0x509649){_0x3735f9['push'](_0x3735f9['shift']());}};_0x59cfd2(++_0x21dd55);}(_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 7d1b71c..b15838e 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 _0x5204=['capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','.js','app','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','tag','TagId','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','condition','intervals','./applications/','priority','info','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','end'];(function(_0xb49d10,_0x103e8c){var _0x2a8e96=function(_0x11308f){while(--_0x11308f){_0xb49d10['push'](_0xb49d10['shift']());}};_0x2a8e96(++_0x103e8c);}(_0x5204,0xdf));var _0x4520=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x5204[_0x4aa838];return _0x3abff0;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x4520('0x2'));var BPromise=require(_0x4520('0x3'));var utils=require(_0x4520('0x4'));var sUtils=require(_0x4520('0x5'));var logger=require(_0x4520('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x4520('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x4520('0x8')),'smsQueueReport':require(_0x4520('0x9')),'faxQueueReport':require(_0x4520('0xa')),'whatsappQueueReport':require(_0x4520('0xb'))};var RuleEngine=require(_0x4520('0xc'));function getId(_0x446dc9,_0x27890f,_0x55b44f){return util[_0x4520('0xd')]('%s.%s.%s',_0x446dc9,_0x27890f||0x0,_0x55b44f||0x0);}function getIntervals(_0x168e62,_0x37a617){var _0x1a5324=[];if(!_[_0x4520('0xe')](_0x37a617[_0x4520('0xf')])&&!_[_0x4520('0xe')](_0x168e62[_0x37a617[_0x4520('0xf')]])&&!_[_0x4520('0xe')](_0x168e62[_0x37a617[_0x4520('0xf')]][_0x4520('0x10')])){_0x1a5324=_[_0x4520('0x11')](_0x168e62[_0x37a617[_0x4520('0xf')]][_0x4520('0x10')],_0x4520('0x12'));}else if(!_[_0x4520('0xe')](_0x37a617[_0x4520('0x12')])){_0x1a5324=[_0x37a617[_0x4520('0x12')]];}return _0x1a5324;}exports[_0x4520('0x13')]=function(_0x426836){_0x426836[_0x4520('0x14')]={};return new BPromise(function(_0x32950a,_0x48b3e7){var _0x3e53e5={'Start':function(_0x20de6b){var _0x1ab841=this;return new Promise(function(_0x15a31f,_0x32d8aa){if(_0x20de6b){try{var _0x51d85f=[];var _0x2c1805=getId(_0x20de6b[_0x4520('0x15')],_0x20de6b[_0x4520('0x16')]?_0x20de6b[_0x4520('0x16')]['id']:0x0,_0x20de6b[_0x4520('0x17')]?_0x20de6b[_0x4520('0x17')]['id']:0x0);var _0x1dcf51=sUtils[_0x4520('0x18')](_0x426836,_0x20de6b);if(_0x20de6b[_0x4520('0x19')]||!_0x1dcf51&&_0x20de6b[_0x4520('0x1a')]&&_[_0x4520('0x1b')](_0x20de6b[_0x4520('0x1a')])&&_0x20de6b['applications'][_0x4520('0x1c')]){for(var _0x52ca8c=0x0;_0x52ca8c<_0x20de6b['applications']['length'];_0x52ca8c+=0x1){var _0x2b9456=_0x20de6b['applications'][_0x52ca8c];if(fs[_0x4520('0x1d')](path[_0x4520('0x1e')](__dirname,_0x4520('0x1a'),_0x2b9456['app']+_0x4520('0x1f')))){var _0x4000d4=[];switch(_0x2b9456[_0x4520('0x20')]['toLowerCase']()){case _0x4520('0x21'):var _0x847d15=_0x2b9456[_0x4520('0x22')][_0x4520('0x23')](',');if(_0x20de6b[_0x4520('0x15')]==='mail'){_0x4000d4[_0x4520('0x24')](_0x847d15[0x0]);_0x4000d4[_0x4520('0x24')](_0x847d15[0x1]);_0x4000d4[_0x4520('0x24')](_0x847d15[_0x4520('0x25')](0x2,_0x847d15['length'])[_0x4520('0x1e')](','));}else{_0x4000d4[_0x4520('0x24')](_0x847d15[0x0]);_0x4000d4[_0x4520('0x24')](_0x847d15[_0x4520('0x25')](0x1,_0x847d15[_0x4520('0x1c')])[_0x4520('0x1e')](','));}break;case _0x4520('0x26'):var _0x195c58=_0x2b9456[_0x4520('0x22')][_0x4520('0x23')](',');_0x4000d4['push'](_0x195c58[0x0]);_0x4000d4[_0x4520('0x24')](_0x195c58[0x1]);_0x4000d4['push'](_0x195c58[_0x4520('0x25')](0x2,_0x195c58[_0x4520('0x1c')])[_0x4520('0x1e')](','));break;case _0x4520('0x27'):var _0x1da740=_0x2b9456[_0x4520('0x22')]['split'](',');_0x4000d4[_0x4520('0x24')](_0x1da740[0x0]);_0x4000d4['push'](_0x1da740[0x1]);_0x4000d4[_0x4520('0x24')](_0x1da740[0x2]);_0x4000d4['push'](_0x1da740[0x3]);_0x4000d4[_0x4520('0x24')](_0x1da740['slice'](0x4,_0x1da740[_0x4520('0x1c')])['join'](','));break;case'amazonlex':var _0x18d6e9=_0x2b9456[_0x4520('0x22')][_0x4520('0x23')](',');_0x4000d4['push'](_0x18d6e9[0x0]);_0x4000d4[_0x4520('0x24')](_0x18d6e9[0x1]);_0x4000d4[_0x4520('0x24')](_0x18d6e9[0x2]);_0x4000d4[_0x4520('0x24')](_0x18d6e9[0x3]);_0x4000d4[_0x4520('0x24')](_0x18d6e9['slice'](0x4,_0x18d6e9['length'])[_0x4520('0x1e')](','));break;case _0x4520('0x16'):_0x4000d4['push'](_0x2b9456[_0x4520('0x22')]);break;case _0x4520('0x28'):_0x4000d4[_0x4520('0x24')](_0x2b9456[_0x4520('0x29')]);_0x4000d4[_0x4520('0x24')](_0x2b9456[_0x4520('0x22')]);break;case'tvox':var _0x21e895=utils[_0x4520('0x2a')](_0x20de6b['account'][_0x4520('0x2b')],_0x20de6b);var _0x5ee87d=_0x2b9456[_0x4520('0x22')][_0x4520('0x23')](',');_0x4000d4['push'](_0x5ee87d[0x0]);_0x4000d4['push'](_0x5ee87d[0x1]);_0x4000d4['push'](_0x5ee87d[0x2]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x3]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x4]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x5]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x6]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x7]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x8]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x9]);_0x4000d4['push'](_0x5ee87d[0xa]);_0x4000d4[_0x4520('0x24')](_0x20de6b[_0x4520('0x17')]['id']);_0x4000d4[_0x4520('0x24')](_0x20de6b['message']['id']);_0x4000d4[_0x4520('0x24')](_0x2b9456[_0x4520('0x2c')]);_0x4000d4['push'](_0x20de6b['interaction'][_0x4520('0x2d')]);_0x4000d4[_0x4520('0x24')](_0x20de6b[_0x4520('0x2e')][_0x4520('0x2e')]);_0x4000d4[_0x4520('0x24')](_0x21e895);break;default:_0x4000d4=_['isNil'](_0x2b9456['appdata'])?[]:_0x2b9456['appdata'][_0x4520('0x23')](',');}var _0x516993={'id':util[_0x4520('0xd')]('%s:%s:%s',_0x2c1805,_0x2b9456['id'],_0x2b9456['app']),'condition':require(_0x4520('0x2f'))[_0x4520('0x30')](_0x2c1805,getIntervals(_0x426836[_0x4520('0x31')],_0x2b9456),_0x426836),'consequence':require(_0x4520('0x32')+_0x2b9456[_0x4520('0x20')])['consequence'](_0x2c1805,_0x4000d4,_0x426836,_0x20de6b),'p':_0x2b9456[_0x4520('0x33')]||0x0};logger[_0x4520('0x34')]('Push\x20new\x20rule',_0x516993['id'],'on\x20interval',getIntervals(_0x426836[_0x4520('0x31')],_0x2b9456)[_0x4520('0x1e')]('\x20|\x20'));_0x51d85f[_0x4520('0x24')](_0x516993);}else{logger[_0x4520('0x35')](_0x4520('0x36'),path[_0x4520('0x1e')](__dirname,'applications',_0x2b9456[_0x4520('0x20')]+_0x4520('0x1f')));}}_0x426836[_0x4520('0x14')][_0x2c1805]=new RuleEngine(_0x51d85f);_0x426836[_0x4520('0x14')][_0x2c1805][_0x4520('0x37')](_0x20de6b,function(_0x16630c){logger[_0x4520('0x34')](_0x4520('0x38'),JSON[_0x4520('0x39')](_0x16630c[_0x4520('0x3a')]));if(_0x426836[_0x4520('0x14')][_0x2c1805]){_0x426836[_0x4520('0x14')][_0x2c1805][_0x4520('0x3b')](_0x4520('0x3c'));}});return _0x15a31f({'code':0xc8,'message':_0x20de6b});}else{if(_0x1dcf51){logger[_0x4520('0x34')](util[_0x4520('0xd')](_0x4520('0x3d'),_0x2c1805));}else{logger['info'](_0x4520('0x3e'));}return _0x15a31f({'code':0xc8,'message':_0x20de6b});}}catch(_0x15d57e){logger['error'](_0x15d57e['stack']);return _0x32d8aa(_0x1ab841['error'](0x1f4,_0x15d57e));}}return _0x32d8aa('routing\x20is\x20empty');});},'AcceptMessage':function(_0x22e62d){var _0x5b96f8=this;return new Promise(function(_0x2f16f4,_0x23c421){if(_0x22e62d[_0x4520('0x3f')]&&_0x22e62d[_0x4520('0x3f')]['id']){if(_0x426836[_0x4520('0x40')][_0x22e62d[_0x4520('0x3f')]['id']]){_0x426836[_0x4520('0x40')][_0x22e62d[_0x4520('0x3f')]['id']][_0x4520('0x41')]=![];_0x426836[_0x4520('0x40')][_0x22e62d[_0x4520('0x3f')]['id']][_0x4520('0x42')]=undefined;}}if(_0x22e62d[_0x4520('0x16')]&&_0x22e62d[_0x4520('0x16')]['id']){try{var _0x17e353=getId(_0x22e62d[_0x4520('0x15')],_0x22e62d[_0x4520('0x16')]?_0x22e62d[_0x4520('0x16')]['id']:0x0,_0x22e62d['interaction']?_0x22e62d['interaction']['id']:0x0);if(_0x426836[_0x4520('0x14')][_0x17e353]){_0x426836[_0x4520('0x14')][_0x17e353][_0x4520('0x3b')]('end');if(rpc[_0x22e62d[_0x4520('0x15')]+_0x4520('0x43')]){rpc[_0x22e62d[_0x4520('0x15')]+'QueueReport'][_0x4520('0x44')](_0x17e353,{'UserId':_0x22e62d[_0x4520('0x16')][_0x4520('0x45')]})['catch'](function(){logger['error'](_0x4520('0x46'));});}}return _0x2f16f4({'code':0xc8,'message':_0x22e62d});}catch(_0x24a6a4){logger[_0x4520('0x35')](_0x24a6a4[_0x4520('0x47')]);return _0x23c421(_0x5b96f8[_0x4520('0x35')](0x1f4,_0x24a6a4));}}logger[_0x4520('0x35')](_0x4520('0x48'));return _0x23c421(_0x5b96f8[_0x4520('0x35')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x38a28d){var _0x293b46=this;return new Promise(function(_0x14e663,_0x8b1c3a){if(_0x38a28d[_0x4520('0x3f')]&&_0x38a28d[_0x4520('0x3f')]['id']){try{if(_0x426836[_0x4520('0x40')][_0x38a28d[_0x4520('0x3f')]['id']]){_0x426836[_0x4520('0x40')][_0x38a28d[_0x4520('0x3f')]['id']][_0x4520('0x41')]=![];_0x426836[_0x4520('0x40')][_0x38a28d[_0x4520('0x3f')]['id']][_0x4520('0x42')]=undefined;}return _0x14e663({'code':0xc8,'message':_0x38a28d});}catch(_0x2d2e04){logger[_0x4520('0x35')](_0x2d2e04[_0x4520('0x47')]);return _0x8b1c3a(_0x293b46['error'](0x1f4,_0x2d2e04));}}logger['error'](_0x4520('0x48'));return _0x8b1c3a(_0x293b46[_0x4520('0x35')](0x1f4,_0x4520('0x48')));});},'AbandonInteraction':function(_0x30e255){var _0x265bb4=this;return new Promise(function(_0x2f071e,_0x54372b){if(_0x30e255[_0x4520('0x15')]&&_0x30e255[_0x4520('0x17')]&&_0x30e255['interaction']['id']){try{var _0x3697c2=getId(_0x30e255[_0x4520('0x15')],_0x30e255[_0x4520('0x16')]?_0x30e255[_0x4520('0x16')]['id']:0x0,_0x30e255['interaction']?_0x30e255[_0x4520('0x17')]['id']:0x0);if(_0x426836[_0x4520('0x14')][_0x3697c2]){_0x426836['rules'][_0x3697c2]['emit'](_0x4520('0x49'));}return _0x2f071e({'code':0xc8,'message':_0x30e255});}catch(_0x83cac1){logger[_0x4520('0x35')](_0x83cac1[_0x4520('0x47')]);return _0x54372b(_0x265bb4[_0x4520('0x35')](0x1f4,_0x83cac1));}}logger[_0x4520('0x35')]('message\x20is\x20empty');return _0x54372b(_0x265bb4[_0x4520('0x35')](0x1f4,_0x4520('0x48')));});},'AgentCapacity':function(_0x2f4cb7){var _0x11966f=this;return new Promise(function(_0x4a1f1d,_0x3cf30d){if(_0x426836[_0x4520('0x40')]['hasOwnProperty'](_0x2f4cb7['id'])){for(var _0x20a517 in _0x2f4cb7['capacity']){if(_0x2f4cb7[_0x4520('0x4a')][_0x4520('0x4b')](_0x20a517)){if(_0x426836[_0x4520('0x40')][_0x2f4cb7['id']][_0x4520('0x4b')](_0x20a517+'CurrentCapacity')){_0x426836[_0x4520('0x40')][_0x2f4cb7['id']][_0x20a517+_0x4520('0x4c')]=parseInt(_0x2f4cb7[_0x4520('0x4a')][_0x20a517],0xa);}}}_0x426836[_0x4520('0x40')][_0x2f4cb7['id']]['updateRealtime']();return _0x4a1f1d({'code':0xc8,'message':_0x426836[_0x4520('0x40')][_0x2f4cb7['id']]});}else{return _0x3cf30d(_0x11966f[_0x4520('0x35')](0x1f4,_0x4520('0x4d')));}});},'Agents':function(_0x2d5bf6){return new Promise(function(_0x196763){var _0x8d166=_['values'](_0x426836[_0x4520('0x40')]);if(_0x2d5bf6&&_0x2d5bf6['id']){var _0x5aa552=_[_0x4520('0x4e')](_0x8d166,function(_0x22e363){return _0x22e363['id']===_0x2d5bf6['id'];});_0x196763(_0x5aa552);}else{_0x196763({'count':_0x8d166[_0x4520('0x1c')],'rows':_0x8d166});}});},'ChatQueues':function(){return new Promise(function(_0x22c06f){var _0x393da3=[];for(var _0x41a204 in _0x426836['chatQueues']){if(_0x426836['chatQueues'][_0x4520('0x4b')](_0x41a204)){var _0x4ee3aa=_0x426836[_0x4520('0x4f')][_0x41a204];var _0x2271f8={'id':_0x4ee3aa['id'],'available':_0x4ee3aa[_0x4520('0x50')],'loggedIn':_0x4ee3aa[_0x4520('0x51')],'name':_0x4ee3aa[_0x4520('0x52')],'paused':_0x4ee3aa[_0x4520('0x53')],'waiting':_0x4ee3aa[_0x4520('0x54')]};_0x393da3[_0x4520('0x24')](_0x2271f8);}}_0x22c06f({'count':_0x393da3[_0x4520('0x1c')],'rows':_0x393da3});});},'MailQueues':function(){return new Promise(function(_0x596404){var _0x199d4c=[];for(var _0x47b717 in _0x426836[_0x4520('0x55')]){if(_0x426836[_0x4520('0x55')][_0x4520('0x4b')](_0x47b717)){var _0x2cf7fc=_0x426836[_0x4520('0x55')][_0x47b717];var _0x5dff10={'id':_0x2cf7fc['id'],'available':_0x2cf7fc[_0x4520('0x50')],'loggedIn':_0x2cf7fc[_0x4520('0x51')],'name':_0x2cf7fc[_0x4520('0x52')],'paused':_0x2cf7fc[_0x4520('0x53')],'waiting':_0x2cf7fc['waiting']};_0x199d4c['push'](_0x5dff10);}}_0x596404({'count':_0x199d4c['length'],'rows':_0x199d4c});});},'OpenchannelQueues':function(){return new Promise(function(_0x2bf316){var _0x14bd13=[];for(var _0x390835 in _0x426836['openchannelQueues']){if(_0x426836[_0x4520('0x56')][_0x4520('0x4b')](_0x390835)){var _0x609b8e=_0x426836[_0x4520('0x56')][_0x390835];var _0x163ff6={'id':_0x609b8e['id'],'available':_0x609b8e['available'],'loggedIn':_0x609b8e[_0x4520('0x51')],'name':_0x609b8e[_0x4520('0x52')],'paused':_0x609b8e[_0x4520('0x53')],'waiting':_0x609b8e['waiting']};_0x14bd13[_0x4520('0x24')](_0x163ff6);}}_0x2bf316({'count':_0x14bd13[_0x4520('0x1c')],'rows':_0x14bd13});});},'SmsQueues':function(){return new Promise(function(_0x2ed1d7){var _0xcefdc7=[];for(var _0x2e8474 in _0x426836[_0x4520('0x57')]){if(_0x426836[_0x4520('0x57')][_0x4520('0x4b')](_0x2e8474)){var _0x524942=_0x426836['smsQueues'][_0x2e8474];var _0x2d9f05={'id':_0x524942['id'],'available':_0x524942[_0x4520('0x50')],'loggedIn':_0x524942['loggedIn'],'name':_0x524942[_0x4520('0x52')],'paused':_0x524942['paused'],'waiting':_0x524942[_0x4520('0x54')]};_0xcefdc7[_0x4520('0x24')](_0x2d9f05);}}_0x2ed1d7({'count':_0xcefdc7['length'],'rows':_0xcefdc7});});},'FaxQueues':function(){return new Promise(function(_0x112419){var _0x3844ba=[];for(var _0x5bacc8 in _0x426836[_0x4520('0x58')]){if(_0x426836[_0x4520('0x58')]['hasOwnProperty'](_0x5bacc8)){var _0x30ba25=_0x426836[_0x4520('0x58')][_0x5bacc8];var _0x23011d={'id':_0x30ba25['id'],'available':_0x30ba25['available'],'loggedIn':_0x30ba25[_0x4520('0x51')],'name':_0x30ba25[_0x4520('0x52')],'paused':_0x30ba25[_0x4520('0x53')],'waiting':_0x30ba25[_0x4520('0x54')]};_0x3844ba[_0x4520('0x24')](_0x23011d);}}_0x112419({'count':_0x3844ba[_0x4520('0x1c')],'rows':_0x3844ba});});},'WhatsappQueues':function(){return new Promise(function(_0x2f91c0){var _0x2a1503=[];for(var _0x2acde8 in _0x426836[_0x4520('0x59')]){if(_0x426836[_0x4520('0x59')][_0x4520('0x4b')](_0x2acde8)){var _0x519042=_0x426836['whatsappQueues'][_0x2acde8];var _0x3d4262={'id':_0x519042['id'],'available':_0x519042['available'],'loggedIn':_0x519042[_0x4520('0x51')],'name':_0x519042[_0x4520('0x52')],'paused':_0x519042[_0x4520('0x53')],'waiting':_0x519042[_0x4520('0x54')]};_0x2a1503[_0x4520('0x24')](_0x3d4262);}}_0x2f91c0({'count':_0x2a1503['length'],'rows':_0x2a1503});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4bff46){var _0x3f01c9=_[_0x4520('0x5a')](_0x426836[_0x4520('0x5b')]);_0x4bff46({'count':_0x3f01c9[_0x4520('0x1c')],'rows':_0x3f01c9});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x27fc96){var _0x2bfafb=_['values'](_0x426836[_0x4520('0x5c')]);_0x27fc96({'count':_0x2bfafb[_0x4520('0x1c')],'rows':_0x2bfafb});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x55f3ab){var _0x7e89d=_['values'](_0x426836['openchannelQueuesWaitingInteractions']);_0x55f3ab({'count':_0x7e89d['length'],'rows':_0x7e89d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x13dbd0){var _0xc0a9b2=_[_0x4520('0x5a')](_0x426836[_0x4520('0x5d')]);_0x13dbd0({'count':_0xc0a9b2[_0x4520('0x1c')],'rows':_0xc0a9b2});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5108cd){var _0x39f79b=_[_0x4520('0x5a')](_0x426836['faxQueuesWaitingInteractions']);_0x5108cd({'count':_0x39f79b['length'],'rows':_0x39f79b});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1fdd7a){var _0x1757fc=_[_0x4520('0x5a')](_0x426836['whatsappQueuesWaitingInteractions']);_0x1fdd7a({'count':_0x1757fc[_0x4520('0x1c')],'rows':_0x1757fc});});}};var _0x341b55=jayson[_0x4520('0x5e')](_0x3e53e5)['http']();_0x341b55['on'](_0x4520('0x35'),function(_0x468115){logger['error'](JSON[_0x4520('0x39')](_0x468115));return _0x48b3e7(_0x468115);});_0x341b55['listen'](0x232c,_0x4520('0x5f'),function(){console[_0x4520('0x60')](_0x4520('0x61'),0x232c);return _0x32950a(_0x4520('0x62')+0x232c);});});}; \ No newline at end of file +var _0xcf37=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','checkWaitingNotifications','transfer','isArray','applications','length','existsSync','join','app','.js','autoreply','appdata','push','slice','split','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','interaction','body','format','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','execute','Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues'];(function(_0x366322,_0x46f476){var _0x130c31=function(_0x137307){while(--_0x137307){_0x366322['push'](_0x366322['shift']());}};_0x130c31(++_0x46f476);}(_0xcf37,0xdc));var _0x7cf3=function(_0x2faeae,_0xef8825){_0x2faeae=_0x2faeae-0x0;var _0x4494c8=_0xcf37[_0x2faeae];return _0x4494c8;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var path=require(_0x7cf3('0x1'));var fs=require('fs');var jayson=require(_0x7cf3('0x2'));var BPromise=require(_0x7cf3('0x3'));var utils=require(_0x7cf3('0x4'));var sUtils=require('./applications/strategy/util');var logger=require(_0x7cf3('0x5'))(_0x7cf3('0x6'));var rpc={'openchannelQueueReport':require(_0x7cf3('0x7')),'mailQueueReport':require(_0x7cf3('0x8')),'chatQueueReport':require(_0x7cf3('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x78b9a4,_0x53502d,_0x110c99){return util['format'](_0x7cf3('0xa'),_0x78b9a4,_0x53502d||0x0,_0x110c99||0x0);}function getIntervals(_0x377577,_0x242ffc){var _0x2acdde=[];if(!_[_0x7cf3('0xb')](_0x242ffc[_0x7cf3('0xc')])&&!_['isNil'](_0x377577[_0x242ffc[_0x7cf3('0xc')]])&&!_[_0x7cf3('0xb')](_0x377577[_0x242ffc[_0x7cf3('0xc')]][_0x7cf3('0xd')])){_0x2acdde=_[_0x7cf3('0xe')](_0x377577[_0x242ffc['IntervalId']][_0x7cf3('0xd')],'interval');}else if(!_[_0x7cf3('0xb')](_0x242ffc['interval'])){_0x2acdde=[_0x242ffc[_0x7cf3('0xf')]];}return _0x2acdde;}exports[_0x7cf3('0x10')]=function(_0x5a9ead){_0x5a9ead[_0x7cf3('0x11')]={};return new BPromise(function(_0x2b477e,_0x3f4338){var _0x11b967={'Start':function(_0x5d763d){var _0x34d074=this;return new Promise(function(_0x5d38cd,_0x32c1d7){if(_0x5d763d){try{var _0x247406=[];var _0x346dae=getId(_0x5d763d[_0x7cf3('0x12')],_0x5d763d[_0x7cf3('0x13')]?_0x5d763d[_0x7cf3('0x13')]['id']:0x0,_0x5d763d['interaction']?_0x5d763d['interaction']['id']:0x0);var _0xd7e354=sUtils[_0x7cf3('0x14')](_0x5a9ead,_0x5d763d);if(_0x5d763d[_0x7cf3('0x15')]||!_0xd7e354&&_0x5d763d['applications']&&_[_0x7cf3('0x16')](_0x5d763d[_0x7cf3('0x17')])&&_0x5d763d[_0x7cf3('0x17')][_0x7cf3('0x18')]){for(var _0x369e30=0x0;_0x369e30<_0x5d763d['applications'][_0x7cf3('0x18')];_0x369e30+=0x1){var _0x10508f=_0x5d763d[_0x7cf3('0x17')][_0x369e30];if(fs[_0x7cf3('0x19')](path[_0x7cf3('0x1a')](__dirname,'applications',_0x10508f[_0x7cf3('0x1b')]+_0x7cf3('0x1c')))){var _0x57e177=[];switch(_0x10508f['app']['toLowerCase']()){case _0x7cf3('0x1d'):var _0x5b1f72=_0x10508f[_0x7cf3('0x1e')]['split'](',');if(_0x5d763d[_0x7cf3('0x12')]==='mail'){_0x57e177[_0x7cf3('0x1f')](_0x5b1f72[0x0]);_0x57e177['push'](_0x5b1f72[0x1]);_0x57e177[_0x7cf3('0x1f')](_0x5b1f72[_0x7cf3('0x20')](0x2,_0x5b1f72[_0x7cf3('0x18')])[_0x7cf3('0x1a')](','));}else{_0x57e177[_0x7cf3('0x1f')](_0x5b1f72[0x0]);_0x57e177[_0x7cf3('0x1f')](_0x5b1f72[_0x7cf3('0x20')](0x1,_0x5b1f72[_0x7cf3('0x18')])[_0x7cf3('0x1a')](','));}break;case'dialogflow':var _0x4cbd7c=_0x10508f[_0x7cf3('0x1e')][_0x7cf3('0x21')](',');_0x57e177[_0x7cf3('0x1f')](_0x4cbd7c[0x0]);_0x57e177['push'](_0x4cbd7c[0x1]);_0x57e177[_0x7cf3('0x1f')](_0x4cbd7c[_0x7cf3('0x20')](0x2,_0x4cbd7c['length'])[_0x7cf3('0x1a')](','));break;case _0x7cf3('0x22'):var _0x3cc17e=_0x10508f[_0x7cf3('0x1e')][_0x7cf3('0x21')](',');_0x57e177[_0x7cf3('0x1f')](_0x3cc17e[0x0]);_0x57e177[_0x7cf3('0x1f')](_0x3cc17e[0x1]);_0x57e177[_0x7cf3('0x1f')](_0x3cc17e[0x2]);_0x57e177[_0x7cf3('0x1f')](_0x3cc17e[0x3]);_0x57e177[_0x7cf3('0x1f')](_0x3cc17e['slice'](0x4,_0x3cc17e[_0x7cf3('0x18')])['join'](','));break;case _0x7cf3('0x23'):var _0x7fc6c0=_0x10508f[_0x7cf3('0x1e')]['split'](',');_0x57e177[_0x7cf3('0x1f')](_0x7fc6c0[0x0]);_0x57e177[_0x7cf3('0x1f')](_0x7fc6c0[0x1]);_0x57e177['push'](_0x7fc6c0[0x2]);_0x57e177[_0x7cf3('0x1f')](_0x7fc6c0[0x3]);_0x57e177[_0x7cf3('0x1f')](_0x7fc6c0[_0x7cf3('0x20')](0x4,_0x7fc6c0[_0x7cf3('0x18')])[_0x7cf3('0x1a')](','));break;case _0x7cf3('0x13'):_0x57e177['push'](_0x10508f[_0x7cf3('0x1e')]);break;case _0x7cf3('0x24'):_0x57e177[_0x7cf3('0x1f')](_0x10508f[_0x7cf3('0x25')]);_0x57e177['push'](_0x10508f[_0x7cf3('0x1e')]);break;case _0x7cf3('0x26'):var _0x5ce329=utils[_0x7cf3('0x27')](_0x5d763d[_0x7cf3('0x28')][_0x7cf3('0x29')],_0x5d763d);var _0x1e1634=_0x10508f[_0x7cf3('0x1e')][_0x7cf3('0x21')](',');_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x0]);_0x57e177['push'](_0x1e1634[0x1]);_0x57e177['push'](_0x1e1634[0x2]);_0x57e177['push'](_0x1e1634[0x3]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x4]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x5]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x6]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x7]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x8]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x9]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0xa]);_0x57e177[_0x7cf3('0x1f')](_0x5d763d[_0x7cf3('0x2a')]['id']);_0x57e177['push'](_0x5d763d['message']['id']);_0x57e177[_0x7cf3('0x1f')](_0x10508f['ChatWebsiteId']);_0x57e177['push'](_0x5d763d[_0x7cf3('0x2a')]['ContactId']);_0x57e177[_0x7cf3('0x1f')](_0x5d763d[_0x7cf3('0x2b')]['body']);_0x57e177[_0x7cf3('0x1f')](_0x5ce329);break;default:_0x57e177=_[_0x7cf3('0xb')](_0x10508f[_0x7cf3('0x1e')])?[]:_0x10508f[_0x7cf3('0x1e')]['split'](',');}var _0x2c7786={'id':util[_0x7cf3('0x2c')](_0x7cf3('0x2d'),_0x346dae,_0x10508f['id'],_0x10508f[_0x7cf3('0x1b')]),'condition':require(_0x7cf3('0x2e'))['condition'](_0x346dae,getIntervals(_0x5a9ead[_0x7cf3('0x2f')],_0x10508f),_0x5a9ead),'consequence':require(_0x7cf3('0x30')+_0x10508f['app'])[_0x7cf3('0x31')](_0x346dae,_0x57e177,_0x5a9ead,_0x5d763d),'p':_0x10508f[_0x7cf3('0x32')]||0x0};logger[_0x7cf3('0x33')](_0x7cf3('0x34'),_0x2c7786['id'],_0x7cf3('0x35'),getIntervals(_0x5a9ead[_0x7cf3('0x2f')],_0x10508f)[_0x7cf3('0x1a')]('\x20|\x20'));_0x247406[_0x7cf3('0x1f')](_0x2c7786);}else{logger[_0x7cf3('0x36')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x7cf3('0x1a')](__dirname,_0x7cf3('0x17'),_0x10508f[_0x7cf3('0x1b')]+_0x7cf3('0x1c')));}}_0x5a9ead[_0x7cf3('0x11')][_0x346dae]=new RuleEngine(_0x247406);_0x5a9ead[_0x7cf3('0x11')][_0x346dae][_0x7cf3('0x37')](_0x5d763d,function(_0x20c9ce){logger[_0x7cf3('0x33')](_0x7cf3('0x38'),JSON['stringify'](_0x20c9ce[_0x7cf3('0x39')]));if(_0x5a9ead['rules'][_0x346dae]){_0x5a9ead['rules'][_0x346dae][_0x7cf3('0x3a')](_0x7cf3('0x3b'));}});return _0x5d38cd({'code':0xc8,'message':_0x5d763d});}else{if(_0xd7e354){logger[_0x7cf3('0x33')](util[_0x7cf3('0x2c')]('Skipped\x20routing\x20for\x20%s',_0x346dae));}else{logger['info'](_0x7cf3('0x3c'));}return _0x5d38cd({'code':0xc8,'message':_0x5d763d});}}catch(_0x185c1b){logger[_0x7cf3('0x36')](_0x185c1b[_0x7cf3('0x3d')]);return _0x32c1d7(_0x34d074['error'](0x1f4,_0x185c1b));}}return _0x32c1d7(_0x7cf3('0x3e'));});},'AcceptMessage':function(_0x164a55){var _0x2b3346=this;return new Promise(function(_0x3164ef,_0x530cd4){if(_0x164a55[_0x7cf3('0x3f')]&&_0x164a55[_0x7cf3('0x3f')]['id']){if(_0x5a9ead[_0x7cf3('0x40')][_0x164a55[_0x7cf3('0x3f')]['id']]){_0x5a9ead[_0x7cf3('0x40')][_0x164a55[_0x7cf3('0x3f')]['id']][_0x7cf3('0x41')]=![];_0x5a9ead[_0x7cf3('0x40')][_0x164a55[_0x7cf3('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x164a55['message']&&_0x164a55[_0x7cf3('0x13')]['id']){try{var _0x1d8c03=getId(_0x164a55[_0x7cf3('0x12')],_0x164a55['message']?_0x164a55['message']['id']:0x0,_0x164a55[_0x7cf3('0x2a')]?_0x164a55[_0x7cf3('0x2a')]['id']:0x0);if(_0x5a9ead['rules'][_0x1d8c03]){_0x5a9ead[_0x7cf3('0x11')][_0x1d8c03][_0x7cf3('0x3a')](_0x7cf3('0x42'));if(rpc[_0x164a55[_0x7cf3('0x12')]+_0x7cf3('0x43')]){rpc[_0x164a55['channel']+_0x7cf3('0x43')][_0x7cf3('0x44')](_0x1d8c03,{'UserId':_0x164a55[_0x7cf3('0x13')][_0x7cf3('0x45')]})[_0x7cf3('0x46')](function(){logger[_0x7cf3('0x36')](_0x7cf3('0x47'));});}}return _0x3164ef({'code':0xc8,'message':_0x164a55});}catch(_0x29b752){logger[_0x7cf3('0x36')](_0x29b752[_0x7cf3('0x3d')]);return _0x530cd4(_0x2b3346[_0x7cf3('0x36')](0x1f4,_0x29b752));}}logger['error'](_0x7cf3('0x48'));return _0x530cd4(_0x2b3346[_0x7cf3('0x36')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2c4390){var _0x497308=this;return new Promise(function(_0x360bf1,_0x3df781){if(_0x2c4390[_0x7cf3('0x3f')]&&_0x2c4390['agent']['id']){try{if(_0x5a9ead[_0x7cf3('0x40')][_0x2c4390[_0x7cf3('0x3f')]['id']]){_0x5a9ead[_0x7cf3('0x40')][_0x2c4390[_0x7cf3('0x3f')]['id']][_0x7cf3('0x41')]=![];_0x5a9ead[_0x7cf3('0x40')][_0x2c4390[_0x7cf3('0x3f')]['id']]['busyQueue']=undefined;}return _0x360bf1({'code':0xc8,'message':_0x2c4390});}catch(_0x259c7e){logger['error'](_0x259c7e[_0x7cf3('0x3d')]);return _0x3df781(_0x497308[_0x7cf3('0x36')](0x1f4,_0x259c7e));}}logger[_0x7cf3('0x36')]('message\x20is\x20empty');return _0x3df781(_0x497308[_0x7cf3('0x36')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x158d71){var _0x3fd1cc=this;return new Promise(function(_0x449099,_0x188df8){if(_0x158d71[_0x7cf3('0x12')]&&_0x158d71[_0x7cf3('0x2a')]&&_0x158d71[_0x7cf3('0x2a')]['id']){try{var _0x40be43=getId(_0x158d71[_0x7cf3('0x12')],_0x158d71['message']?_0x158d71[_0x7cf3('0x13')]['id']:0x0,_0x158d71[_0x7cf3('0x2a')]?_0x158d71[_0x7cf3('0x2a')]['id']:0x0);if(_0x5a9ead[_0x7cf3('0x11')][_0x40be43]){_0x5a9ead['rules'][_0x40be43]['emit'](_0x7cf3('0x42'));}return _0x449099({'code':0xc8,'message':_0x158d71});}catch(_0x37bcc1){logger['error'](_0x37bcc1['stack']);return _0x188df8(_0x3fd1cc[_0x7cf3('0x36')](0x1f4,_0x37bcc1));}}logger['error'](_0x7cf3('0x48'));return _0x188df8(_0x3fd1cc[_0x7cf3('0x36')](0x1f4,_0x7cf3('0x48')));});},'AgentCapacity':function(_0x45f9bd){var _0x62d4d9=this;return new Promise(function(_0x31d32e,_0x18d519){if(_0x5a9ead[_0x7cf3('0x40')][_0x7cf3('0x49')](_0x45f9bd['id'])){for(var _0x4d41aa in _0x45f9bd[_0x7cf3('0x4a')]){if(_0x45f9bd[_0x7cf3('0x4a')][_0x7cf3('0x49')](_0x4d41aa)){if(_0x5a9ead[_0x7cf3('0x40')][_0x45f9bd['id']][_0x7cf3('0x49')](_0x4d41aa+_0x7cf3('0x4b'))){_0x5a9ead[_0x7cf3('0x40')][_0x45f9bd['id']][_0x4d41aa+'CurrentCapacity']=parseInt(_0x45f9bd[_0x7cf3('0x4a')][_0x4d41aa],0xa);}}}_0x5a9ead[_0x7cf3('0x40')][_0x45f9bd['id']][_0x7cf3('0x4c')]();return _0x31d32e({'code':0xc8,'message':_0x5a9ead['agents'][_0x45f9bd['id']]});}else{return _0x18d519(_0x62d4d9['error'](0x1f4,_0x7cf3('0x4d')));}});},'Agents':function(_0x2f0f94){return new Promise(function(_0x4f9017){var _0x18d262=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x40')]);if(_0x2f0f94&&_0x2f0f94['id']){var _0x50887d=_[_0x7cf3('0x4f')](_0x18d262,function(_0x525821){return _0x525821['id']===_0x2f0f94['id'];});_0x4f9017(_0x50887d);}else{_0x4f9017({'count':_0x18d262[_0x7cf3('0x18')],'rows':_0x18d262});}});},'ChatQueues':function(){return new Promise(function(_0x2fcdd9){var _0x136c5a=[];for(var _0x52ebc9 in _0x5a9ead[_0x7cf3('0x50')]){if(_0x5a9ead['chatQueues']['hasOwnProperty'](_0x52ebc9)){var _0x357707=_0x5a9ead['chatQueues'][_0x52ebc9];var _0x4047bd={'id':_0x357707['id'],'available':_0x357707[_0x7cf3('0x51')],'loggedIn':_0x357707[_0x7cf3('0x52')],'name':_0x357707[_0x7cf3('0x53')],'paused':_0x357707[_0x7cf3('0x54')],'waiting':_0x357707[_0x7cf3('0x55')]};_0x136c5a[_0x7cf3('0x1f')](_0x4047bd);}}_0x2fcdd9({'count':_0x136c5a[_0x7cf3('0x18')],'rows':_0x136c5a});});},'MailQueues':function(){return new Promise(function(_0x1358f8){var _0xbc93e0=[];for(var _0x20f80a in _0x5a9ead[_0x7cf3('0x56')]){if(_0x5a9ead['mailQueues']['hasOwnProperty'](_0x20f80a)){var _0x56f142=_0x5a9ead[_0x7cf3('0x56')][_0x20f80a];var _0xbdff85={'id':_0x56f142['id'],'available':_0x56f142[_0x7cf3('0x51')],'loggedIn':_0x56f142[_0x7cf3('0x52')],'name':_0x56f142[_0x7cf3('0x53')],'paused':_0x56f142['paused'],'waiting':_0x56f142[_0x7cf3('0x55')]};_0xbc93e0['push'](_0xbdff85);}}_0x1358f8({'count':_0xbc93e0[_0x7cf3('0x18')],'rows':_0xbc93e0});});},'OpenchannelQueues':function(){return new Promise(function(_0x5287e4){var _0x4e5dd0=[];for(var _0x3c1bdc in _0x5a9ead[_0x7cf3('0x57')]){if(_0x5a9ead[_0x7cf3('0x57')][_0x7cf3('0x49')](_0x3c1bdc)){var _0x442a6c=_0x5a9ead[_0x7cf3('0x57')][_0x3c1bdc];var _0x8bfa38={'id':_0x442a6c['id'],'available':_0x442a6c[_0x7cf3('0x51')],'loggedIn':_0x442a6c['loggedIn'],'name':_0x442a6c[_0x7cf3('0x53')],'paused':_0x442a6c[_0x7cf3('0x54')],'waiting':_0x442a6c['waiting']};_0x4e5dd0[_0x7cf3('0x1f')](_0x8bfa38);}}_0x5287e4({'count':_0x4e5dd0[_0x7cf3('0x18')],'rows':_0x4e5dd0});});},'SmsQueues':function(){return new Promise(function(_0x2f138f){var _0x546db7=[];for(var _0x5c8b19 in _0x5a9ead[_0x7cf3('0x58')]){if(_0x5a9ead[_0x7cf3('0x58')]['hasOwnProperty'](_0x5c8b19)){var _0x40b2d3=_0x5a9ead[_0x7cf3('0x58')][_0x5c8b19];var _0x548566={'id':_0x40b2d3['id'],'available':_0x40b2d3['available'],'loggedIn':_0x40b2d3[_0x7cf3('0x52')],'name':_0x40b2d3[_0x7cf3('0x53')],'paused':_0x40b2d3[_0x7cf3('0x54')],'waiting':_0x40b2d3['waiting']};_0x546db7[_0x7cf3('0x1f')](_0x548566);}}_0x2f138f({'count':_0x546db7['length'],'rows':_0x546db7});});},'FaxQueues':function(){return new Promise(function(_0xa2f72){var _0x1aac08=[];for(var _0x354547 in _0x5a9ead['faxQueues']){if(_0x5a9ead[_0x7cf3('0x59')]['hasOwnProperty'](_0x354547)){var _0x169b4a=_0x5a9ead['faxQueues'][_0x354547];var _0x3b2248={'id':_0x169b4a['id'],'available':_0x169b4a[_0x7cf3('0x51')],'loggedIn':_0x169b4a[_0x7cf3('0x52')],'name':_0x169b4a[_0x7cf3('0x53')],'paused':_0x169b4a[_0x7cf3('0x54')],'waiting':_0x169b4a[_0x7cf3('0x55')]};_0x1aac08[_0x7cf3('0x1f')](_0x3b2248);}}_0xa2f72({'count':_0x1aac08['length'],'rows':_0x1aac08});});},'WhatsappQueues':function(){return new Promise(function(_0x294471){var _0x18d367=[];for(var _0x51f60f in _0x5a9ead[_0x7cf3('0x5a')]){if(_0x5a9ead[_0x7cf3('0x5a')]['hasOwnProperty'](_0x51f60f)){var _0x3ac596=_0x5a9ead[_0x7cf3('0x5a')][_0x51f60f];var _0x9f5e34={'id':_0x3ac596['id'],'available':_0x3ac596[_0x7cf3('0x51')],'loggedIn':_0x3ac596['loggedIn'],'name':_0x3ac596['name'],'paused':_0x3ac596['paused'],'waiting':_0x3ac596[_0x7cf3('0x55')]};_0x18d367['push'](_0x9f5e34);}}_0x294471({'count':_0x18d367['length'],'rows':_0x18d367});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4847ea){var _0x2ccc86=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x5b')]);_0x4847ea({'count':_0x2ccc86[_0x7cf3('0x18')],'rows':_0x2ccc86});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2f0b15){var _0x4149ca=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x5c')]);_0x2f0b15({'count':_0x4149ca['length'],'rows':_0x4149ca});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x184ba1){var _0x267f38=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x5d')]);_0x184ba1({'count':_0x267f38['length'],'rows':_0x267f38});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x57ffbf){var _0x2e8b4e=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x5e')]);_0x57ffbf({'count':_0x2e8b4e['length'],'rows':_0x2e8b4e});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4b35a9){var _0x37eca9=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x5f')]);_0x4b35a9({'count':_0x37eca9[_0x7cf3('0x18')],'rows':_0x37eca9});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2df3f5){var _0xd19125=_['values'](_0x5a9ead[_0x7cf3('0x60')]);_0x2df3f5({'count':_0xd19125[_0x7cf3('0x18')],'rows':_0xd19125});});}};var _0x13f5c4=jayson[_0x7cf3('0x61')](_0x11b967)[_0x7cf3('0x62')]();_0x13f5c4['on'](_0x7cf3('0x36'),function(_0x21120f){logger[_0x7cf3('0x36')](JSON[_0x7cf3('0x63')](_0x21120f));return _0x3f4338(_0x21120f);});_0x13f5c4[_0x7cf3('0x10')](0x232c,_0x7cf3('0x64'),function(){console[_0x7cf3('0x65')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2b477e(_0x7cf3('0x66')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3bfbf65..c18f339 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 _0x3e16=['indexOf','[%s][INTERVAL]\x20%s','all','join','\x20|\x20','[%s][INTERVAL]\x20%s\x20%s','stack','util','jayson/promise','lodash','routing','client','http','request','then','error','message','result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x3e16,0x1ab));var _0x63e1=function(_0x3095c7,_0x4a7663){_0x3095c7=_0x3095c7-0x0;var _0x4c678c=_0x3e16[_0x3095c7];return _0x4c678c;};'use strict';var util=require(_0x63e1('0x0'));var BPromise=require('bluebird');var jayson=require(_0x63e1('0x1'));var _=require(_0x63e1('0x2'));var logger=require('../../../config/logger')(_0x63e1('0x3'));var client=jayson[_0x63e1('0x4')][_0x63e1('0x5')]({'port':0x232a});function request(_0x3099c5,_0x47024c){return new BPromise(function(_0x546178,_0x3cd035){return client[_0x63e1('0x6')](_0x3099c5,_0x47024c)[_0x63e1('0x7')](function(_0x53b7b5){if(_0x53b7b5['error']){return _0x3cd035(_0x53b7b5[_0x63e1('0x8')][_0x63e1('0x9')]);}else{return _0x546178(_0x53b7b5[_0x63e1('0xa')]);}})[_0x63e1('0xb')](function(_0x20caf4){return _0x3cd035(_0x20caf4);});});}exports[_0x63e1('0xc')]=function(_0x13d88b,_0x36deea,_0x20f687){return function(_0xc31648){if(_0x20f687['rules']&&!_0x20f687['rules'][_0x13d88b]){logger[_0x63e1('0xd')](_0x63e1('0xe'),_0x13d88b);return _0xc31648[_0x63e1('0xf')]();}var _0x530f82=[];for(var _0x59e4db=0x0;_0x59e4db<_0x36deea[_0x63e1('0x10')];_0x59e4db+=0x1){_0x530f82[_0x63e1('0x11')](request(_0x63e1('0x12'),{'command':util[_0x63e1('0x13')](_0x63e1('0x14'),_0x36deea[_0x59e4db])})['then'](function(_0x8123ae){return _0x8123ae&&_0x8123ae[_0x63e1('0x9')]&&_0x8123ae[_0x63e1('0x9')][_0x63e1('0x15')]('true')>=0x0?!![]:![];})[_0x63e1('0xb')](function(){logger[_0x63e1('0x8')](_0x63e1('0x16'),_0x13d88b,_0x36deea[_0x59e4db]);}));}BPromise[_0x63e1('0x17')](_0x530f82)[_0x63e1('0x7')](function(_0x5b197d){var _0x4a6a8e=_['some'](_0x5b197d);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x13d88b,_0x36deea[_0x63e1('0x18')](_0x63e1('0x19')),_0x4a6a8e);_0xc31648['when'](_0x4a6a8e);})[_0x63e1('0xb')](function(_0x408253){logger[_0x63e1('0x8')](_0x63e1('0x1a'),_0x13d88b,_0x36deea[_0x63e1('0x18')](_0x63e1('0x19')),_0x408253[_0x63e1('0x1b')]);_0xc31648[_0x63e1('0xf')]();});};}; \ No newline at end of file +var _0x9cbc=['routing','client','http','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join','stack','stop','util','jayson/promise'];(function(_0x4864f2,_0x2d13a5){var _0x34e355=function(_0x318ef4){while(--_0x318ef4){_0x4864f2['push'](_0x4864f2['shift']());}};_0x34e355(++_0x2d13a5);}(_0x9cbc,0x14e));var _0xc9cb=function(_0x41f55e,_0x264009){_0x41f55e=_0x41f55e-0x0;var _0x922b33=_0x9cbc[_0x41f55e];return _0x922b33;};'use strict';var util=require(_0xc9cb('0x0'));var BPromise=require('bluebird');var jayson=require(_0xc9cb('0x1'));var _=require('lodash');var logger=require('../../../config/logger')(_0xc9cb('0x2'));var client=jayson[_0xc9cb('0x3')][_0xc9cb('0x4')]({'port':0x232a});function request(_0x435567,_0x57c4cd){return new BPromise(function(_0x4c5a7d,_0x3d5a6d){return client['request'](_0x435567,_0x57c4cd)[_0xc9cb('0x5')](function(_0x4a9cce){if(_0x4a9cce[_0xc9cb('0x6')]){return _0x3d5a6d(_0x4a9cce[_0xc9cb('0x6')][_0xc9cb('0x7')]);}else{return _0x4c5a7d(_0x4a9cce[_0xc9cb('0x8')]);}})[_0xc9cb('0x9')](function(_0x26cc89){return _0x3d5a6d(_0x26cc89);});});}exports[_0xc9cb('0xa')]=function(_0x4297a1,_0x5a0e0e,_0xd7bfc8){return function(_0x271a0f){if(_0xd7bfc8[_0xc9cb('0xb')]&&!_0xd7bfc8[_0xc9cb('0xb')][_0x4297a1]){logger['info'](_0xc9cb('0xc'),_0x4297a1);return _0x271a0f['stop']();}var _0x1231b8=[];for(var _0x256830=0x0;_0x256830<_0x5a0e0e[_0xc9cb('0xd')];_0x256830+=0x1){_0x1231b8['push'](request('Command',{'command':util[_0xc9cb('0xe')](_0xc9cb('0xf'),_0x5a0e0e[_0x256830])})[_0xc9cb('0x5')](function(_0x2069d0){return _0x2069d0&&_0x2069d0[_0xc9cb('0x7')]&&_0x2069d0[_0xc9cb('0x7')][_0xc9cb('0x10')](_0xc9cb('0x11'))>=0x0?!![]:![];})[_0xc9cb('0x9')](function(){logger[_0xc9cb('0x6')](_0xc9cb('0x12'),_0x4297a1,_0x5a0e0e[_0x256830]);}));}BPromise[_0xc9cb('0x13')](_0x1231b8)[_0xc9cb('0x5')](function(_0x2b20b5){var _0x33e02e=_[_0xc9cb('0x14')](_0x2b20b5);logger[_0xc9cb('0x15')](_0xc9cb('0x16'),_0x4297a1,_0x5a0e0e['join'](_0xc9cb('0x17')),_0x33e02e);_0x271a0f[_0xc9cb('0x18')](_0x33e02e);})[_0xc9cb('0x9')](function(_0x31dd8b){logger[_0xc9cb('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x4297a1,_0x5a0e0e[_0xc9cb('0x19')](_0xc9cb('0x17')),_0x31dd8b[_0xc9cb('0x1a')]);_0x271a0f[_0xc9cb('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index adf556e..549f051 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 _0xae60=['transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','lodash','util','./utils','info','format','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten'];(function(_0x5d7cd4,_0x35470c){var _0x58b4b2=function(_0x47f8c7){while(--_0x47f8c7){_0x5d7cd4['push'](_0x5d7cd4['shift']());}};_0x58b4b2(++_0x35470c);}(_0xae60,0x1c7));var _0x0ae6=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xae60[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var utils=require(_0x0ae6('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x52d7cd,_0x267ad6){utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x52d7cd[_0x0ae6('0x5')],_0x52d7cd[_0x0ae6('0x6')],_0x52d7cd['queue'],_0x52d7cd[_0x0ae6('0x7')],_0x52d7cd[_0x0ae6('0x8')],_0x52d7cd[_0x0ae6('0x9')],_0x52d7cd[_0x0ae6('0xa')],_0x52d7cd[_0x0ae6('0xb')]));if(_0x52d7cd[_0x0ae6('0xc')]){utils[_0x0ae6('0xd')](_0x52d7cd[_0x0ae6('0xc')])['then'](function(_0x3b3fc3){if(_0x3b3fc3){_0x52d7cd[_0x0ae6('0xe')]=_0x3b3fc3[_0x0ae6('0xe')];_0x52d7cd[_0x0ae6('0xf')]=_0x52d7cd['agentcomplete']?_0x3b3fc3[_0x0ae6('0x10')]:![];_0x52d7cd[_0x0ae6('0x11')]=_0x52d7cd[_0x0ae6('0xf')]?_0x3b3fc3[_0x0ae6('0x12')]:0x0;}utils[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x52d7cd);});}else{utils[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x52d7cd);}if(_0x267ad6){delete transfers[_0x52d7cd[_0x0ae6('0x5')]];}else{delete agents[_0x52d7cd[_0x0ae6('0x15')]];}}exports[_0x0ae6('0x16')]=function(_0xf86cad){try{utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][agentcalled]',_0xf86cad[_0x0ae6('0x5')]),_0xf86cad);agents[_0xf86cad[_0x0ae6('0x15')]]=_0xf86cad;agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x18')]=utils[_0x0ae6('0x19')]();agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0xb')]=_0x0ae6('0x1a');agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0xa')]=null;agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x1b')]=null;utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x1c'),_0xf86cad[_0x0ae6('0x5')],agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x7')],_0xf86cad[_0x0ae6('0x15')]));}catch(_0x9e2c46){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][agentcalled]',_0xf86cad[_0x0ae6('0x5')]),_0x9e2c46);}};exports[_0x0ae6('0x1e')]=function(_0x140a3b){try{if(!_[_0x0ae6('0x1f')](agents[_0x140a3b[_0x0ae6('0x15')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')](_0x0ae6('0x20'),_0x140a3b['uniqueid']),_0x140a3b);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x21'),_0x140a3b[_0x0ae6('0x5')],agents[_0x140a3b[_0x0ae6('0x15')]]['membername'],_0x140a3b[_0x0ae6('0x15')]));agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x1e')]=!![];agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();agents[_0x140a3b['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x23');agents[_0x140a3b['destuniqueid']]['reason']=_0x0ae6('0x23');agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x24')]=_0x140a3b['ringtime']?parseInt(_0x140a3b[_0x0ae6('0x25')])/0x3e8:0x0;agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x26')]=0x0;unanswered['push'](_0x140a3b[_0x0ae6('0x15')]);}}catch(_0x29fef3){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x20'),_0x140a3b[_0x0ae6('0x5')]),_0x29fef3);}};exports['queuecallerabandon']=function(_0x5b2ad6){try{_[_0x0ae6('0x27')](agents,function(_0x419384,_0x4e6df8){if(_0x419384['uniqueid']==_0x5b2ad6[_0x0ae6('0x5')]&&!_[_0x0ae6('0x28')](unanswered,_0x419384[_0x0ae6('0x15')])){utils[_0x0ae6('0x17')](util['format'](_0x0ae6('0x29'),_0x5b2ad6[_0x0ae6('0x5')]),_0x5b2ad6);utils[_0x0ae6('0x3')](util['format'](_0x0ae6('0x2a'),_0x5b2ad6[_0x0ae6('0x5')],_0x419384[_0x0ae6('0x7')],_0x419384[_0x0ae6('0x15')]));_0x419384[_0x0ae6('0x1e')]=!![];_0x419384[_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();_0x419384[_0x0ae6('0xb')]=_0x0ae6('0x2b');_0x419384[_0x0ae6('0x2c')]='abandoned';_0x419384[_0x0ae6('0x24')]=_0x5b2ad6[_0x0ae6('0x24')];_0x419384['talktime']=0x0;writeDB(_0x419384);}});}catch(_0x3264d5){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][queuecallerabandon]',_0x5b2ad6[_0x0ae6('0x5')]),_0x3264d5);}};exports['agentconnect']=function(_0x59e388){try{if(agents[_0x59e388[_0x0ae6('0x15')]]){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')](_0x0ae6('0x2d'),_0x59e388[_0x0ae6('0x5')]),_0x59e388);utils['info'](util['format'](_0x0ae6('0x2e'),_0x59e388['uniqueid'],agents[_0x59e388[_0x0ae6('0x15')]]['membername'],_0x59e388[_0x0ae6('0x15')]));agents[_0x59e388['destuniqueid']][_0x0ae6('0x2f')]=utils[_0x0ae6('0x19')]();agents[_0x59e388[_0x0ae6('0x15')]][_0x0ae6('0xa')]=_0x59e388['connectedlinenum'];agents[_0x59e388['destuniqueid']][_0x0ae6('0x1b')]=_0x59e388[_0x0ae6('0x1b')];agents[_0x59e388[_0x0ae6('0x15')]]['holdtime']=_0x59e388[_0x0ae6('0x25')];agents[_0x59e388['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x30');_[_0x0ae6('0x27')](agents,function(_0x19403c,_0x450f00){if(_0x19403c[_0x0ae6('0x15')]!=_0x59e388['destuniqueid']&&_0x19403c[_0x0ae6('0x5')]==_0x59e388[_0x0ae6('0x5')]){_0x19403c[_0x0ae6('0x26')]=0x0;_0x19403c[_0x0ae6('0x24')]=_0x59e388[_0x0ae6('0x25')];_0x19403c[_0x0ae6('0x1e')]=!![];_0x19403c[_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();_0x19403c['lastevent']=_0x0ae6('0x31');_0x19403c[_0x0ae6('0x2c')]=_0x0ae6('0x31');_0x19403c[_0x0ae6('0x32')]=_0x59e388[_0x0ae6('0x15')];_0x19403c[_0x0ae6('0x33')]=_0x59e388[_0x0ae6('0x7')];writeDB(_0x19403c);}});}}catch(_0x21431e){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x2d'),_0x59e388[_0x0ae6('0x5')]),_0x21431e);}};exports[_0x0ae6('0x34')]=function(_0x85d9ce){try{if(!_[_0x0ae6('0x1f')](agents[_0x85d9ce[_0x0ae6('0x15')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][agentcomplete]',_0x85d9ce[_0x0ae6('0x5')]),_0x85d9ce);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x35'),_0x85d9ce[_0x0ae6('0x5')],agents[_0x85d9ce[_0x0ae6('0x15')]]['membername'],_0x85d9ce[_0x0ae6('0x15')]));agents[_0x85d9ce[_0x0ae6('0x15')]][_0x0ae6('0x34')]=!![];agents[_0x85d9ce[_0x0ae6('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x85d9ce['destuniqueid']][_0x0ae6('0x26')]=utils[_0x0ae6('0x36')](agents[_0x85d9ce[_0x0ae6('0x15')]]['agentcompleteAt'],agents[_0x85d9ce[_0x0ae6('0x15')]][_0x0ae6('0x2f')]);agents[_0x85d9ce['destuniqueid']][_0x0ae6('0x2c')]=_0x85d9ce[_0x0ae6('0x2c')];agents[_0x85d9ce['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x37');writeDB(agents[_0x85d9ce['destuniqueid']]);}}catch(_0x76e561){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][agentcomplete]',_0x85d9ce[_0x0ae6('0x5')]),_0x76e561);}};exports[_0x0ae6('0x38')]=function(_0x46075a){try{if(!_[_0x0ae6('0x1f')](agents[_0x46075a[_0x0ae6('0x39')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][blindtransfer]',_0x46075a['uniqueid']),_0x46075a);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x3a'),_0x46075a['uniqueid'],agents[_0x46075a[_0x0ae6('0x39')]]['membername'],agents[_0x46075a['transfereruniqueid']][_0x0ae6('0x5')]));agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x3b')]=!![];agents[_0x46075a['transfereruniqueid']][_0x0ae6('0x3c')]=_0x0ae6('0x3d');agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x3e')]=_0x46075a[_0x0ae6('0x3f')];agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x40')]=agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x5')];}}catch(_0x117d24){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x41'),_0x46075a[_0x0ae6('0x5')]),_0x117d24);}};exports[_0x0ae6('0x42')]=function(_0x5c4785){try{utils['debug'](util[_0x0ae6('0x4')](_0x0ae6('0x43'),_0x5c4785[_0x0ae6('0x44')]),_0x5c4785);if(_0x5c4785[_0x0ae6('0x44')]==_0x5c4785[_0x0ae6('0x45')]){if(!_[_0x0ae6('0x1f')](agents[_0x5c4785[_0x0ae6('0x46')]])){utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x47'),_0x5c4785[_0x0ae6('0x44')],agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x7')]));agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x3b')]=!![];agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x3c')]=_0x0ae6('0x48');agents[_0x5c4785['secondtransfereruniqueid']][_0x0ae6('0x3e')]=_0x5c4785[_0x0ae6('0x49')];agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x40')]=_0x5c4785[_0x0ae6('0x44')];}if(_0x5c4785[_0x0ae6('0x4a')]&&agents[_0x5c4785[_0x0ae6('0x4a')]]){agents[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4b')]=0x1;transfers[_0x5c4785[_0x0ae6('0x4a')]]=_['clone'](agents[_0x5c4785[_0x0ae6('0x4a')]]);transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x9')]=agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x9')];transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4c')]=agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x4c')];transfers[_0x5c4785['transfereeuniqueid']]['agentcalledAt']=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4a')]]['agentconnectAt']=utils['now']();transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x24')]=0x0;transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4b')]=0x2;}}else if(_0x5c4785[_0x0ae6('0x46')]==_0x5c4785[_0x0ae6('0x4d')]){if(!_[_0x0ae6('0x1f')](agents[_0x5c4785['origtransfereruniqueid']])){utils[_0x0ae6('0x3')](util['format'](_0x0ae6('0x47'),_0x5c4785[_0x0ae6('0x44')],agents[_0x5c4785['origtransfereruniqueid']][_0x0ae6('0x7')]));agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x3b')]=!![];agents[_0x5c4785['origtransfereruniqueid']][_0x0ae6('0x3c')]='ATTENDED';agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x3e')]=_0x5c4785[_0x0ae6('0x4e')];agents[_0x5c4785[_0x0ae6('0x44')]]['transferuniqueid']=_0x5c4785['secondtransfereruniqueid'];}if(_0x5c4785[_0x0ae6('0x4f')]&&agents[_0x5c4785[_0x0ae6('0x4f')]]){agents[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x4b')]=0x1;transfers[_0x5c4785[_0x0ae6('0x4f')]]=_[_0x0ae6('0x50')](agents[_0x5c4785['transfertargetuniqueid']]);transfers[_0x5c4785['transfertargetuniqueid']][_0x0ae6('0x9')]=agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x9')];transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x4c')]=agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x4c')];transfers[_0x5c4785[_0x0ae6('0x4f')]]['agentcalledAt']=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x2f')]=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x24')]=0x0;transfers[_0x5c4785['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x35068d){utils[_0x0ae6('0x1d')](util['format'](_0x0ae6('0x43'),_0x5c4785[_0x0ae6('0x44')]),_0x35068d);}};exports[_0x0ae6('0x51')]=function(_0x37ad9b){try{utils['debug'](util[_0x0ae6('0x4')](_0x0ae6('0x52'),_0x37ad9b[_0x0ae6('0x5')]),_0x37ad9b);if(agents[_0x37ad9b[_0x0ae6('0x5')]]&&agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')]===_0x0ae6('0x23')){if(_0x37ad9b[_0x0ae6('0x53')]==='21'){agents[_0x37ad9b['uniqueid']][_0x0ae6('0x2c')]=_0x0ae6('0x54');agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x54');}utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x55'),_0x37ad9b[_0x0ae6('0x5')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x7')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(agents[_0x37ad9b[_0x0ae6('0x5')]]);var _0x346d19=unanswered[_0x0ae6('0x56')](_0x37ad9b[_0x0ae6('0x5')]);if(_0x346d19>-0x1){unanswered[_0x0ae6('0x57')](_0x346d19,0x1);}}if(transfers[_0x37ad9b[_0x0ae6('0x5')]]){transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x34')]=!![];transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')]=utils[_0x0ae6('0x19')]();transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x26')]=utils[_0x0ae6('0x36')](transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2f')]);transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x2c')]='agent';transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x37');utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x55'),_0x37ad9b[_0x0ae6('0x5')],transfers[_0x37ad9b['uniqueid']]['membername'],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(transfers[_0x37ad9b['uniqueid']],!![]);}if(agents[_0x37ad9b[_0x0ae6('0x5')]]&&agents[_0x37ad9b[_0x0ae6('0x5')]]['agentconnectAt']){agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x34')]=!![];agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')]=utils[_0x0ae6('0x19')]();agents[_0x37ad9b[_0x0ae6('0x5')]]['talktime']=utils['diffTime'](agents[_0x37ad9b['uniqueid']][_0x0ae6('0x58')],agents[_0x37ad9b['uniqueid']]['agentconnectAt']);agents[_0x37ad9b['uniqueid']]['reason']=agents[_0x37ad9b[_0x0ae6('0x5')]]['transfer']?_0x0ae6('0x3b'):'agent';agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x37');utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x37ad9b[_0x0ae6('0x5')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x7')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(agents[_0x37ad9b['uniqueid']]);}}catch(_0x435707){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x52'),_0x37ad9b[_0x0ae6('0x5')]),_0x435707);}}; \ No newline at end of file +var _0xf109=['transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','now','called','info','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','error','queuecallerabandon','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','forIn','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer'];(function(_0x3e535b,_0x43d4e6){var _0x6887a2=function(_0x5bf467){while(--_0x5bf467){_0x3e535b['push'](_0x3e535b['shift']());}};_0x6887a2(++_0x43d4e6);}(_0xf109,0xce));var _0x9f10=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xf109[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var utils=require(_0x9f10('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5d2950,_0x5b381d){utils['info'](util[_0x9f10('0x3')](_0x9f10('0x4'),_0x5d2950[_0x9f10('0x5')],_0x5d2950[_0x9f10('0x6')],_0x5d2950[_0x9f10('0x7')],_0x5d2950[_0x9f10('0x8')],_0x5d2950[_0x9f10('0x9')],_0x5d2950[_0x9f10('0xa')],_0x5d2950[_0x9f10('0xb')],_0x5d2950[_0x9f10('0xc')]));if(_0x5d2950[_0x9f10('0x7')]){utils['getVoiceQueueByName'](_0x5d2950[_0x9f10('0x7')])[_0x9f10('0xd')](function(_0x1a0668){if(_0x1a0668){_0x5d2950[_0x9f10('0xe')]=_0x1a0668[_0x9f10('0xe')];_0x5d2950['agentacw']=_0x5d2950[_0x9f10('0xf')]?_0x1a0668[_0x9f10('0x10')]:![];_0x5d2950[_0x9f10('0x11')]=_0x5d2950['agentacw']?_0x1a0668['acwTimeout']:0x0;}utils[_0x9f10('0x12')](_0x9f10('0x13'),_0x5d2950);});}else{utils[_0x9f10('0x12')]('CreateVoiceAgentReport',_0x5d2950);}if(_0x5b381d){delete transfers[_0x5d2950[_0x9f10('0x5')]];}else{delete agents[_0x5d2950[_0x9f10('0x14')]];}}exports[_0x9f10('0x15')]=function(_0x58067f){try{utils[_0x9f10('0x16')](util[_0x9f10('0x3')]('[%s][agents][agentcalled]',_0x58067f[_0x9f10('0x5')]),_0x58067f);agents[_0x58067f[_0x9f10('0x14')]]=_0x58067f;agents[_0x58067f['destuniqueid']]['agentcalledAt']=utils[_0x9f10('0x17')]();agents[_0x58067f[_0x9f10('0x14')]]['lastevent']=_0x9f10('0x18');agents[_0x58067f['destuniqueid']][_0x9f10('0xb')]=null;agents[_0x58067f[_0x9f10('0x14')]]['connectedlinename']=null;utils[_0x9f10('0x19')](util[_0x9f10('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x58067f[_0x9f10('0x5')],agents[_0x58067f['destuniqueid']][_0x9f10('0x8')],_0x58067f['destuniqueid']));}catch(_0x2c5064){utils['error'](util['format'](_0x9f10('0x1a'),_0x58067f[_0x9f10('0x5')]),_0x2c5064);}};exports[_0x9f10('0x1b')]=function(_0x3a78be){try{if(!_[_0x9f10('0x1c')](agents[_0x3a78be[_0x9f10('0x14')]])){utils[_0x9f10('0x16')](util['format'](_0x9f10('0x1d'),_0x3a78be['uniqueid']),_0x3a78be);utils[_0x9f10('0x19')](util[_0x9f10('0x3')](_0x9f10('0x1e'),_0x3a78be['uniqueid'],agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0x8')],_0x3a78be[_0x9f10('0x14')]));agents[_0x3a78be['destuniqueid']][_0x9f10('0x1b')]=!![];agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0x1f')]=utils['now']();agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0xc')]=_0x9f10('0x20');agents[_0x3a78be[_0x9f10('0x14')]]['reason']='timeout';agents[_0x3a78be['destuniqueid']][_0x9f10('0x21')]=_0x3a78be['ringtime']?parseInt(_0x3a78be[_0x9f10('0x22')])/0x3e8:0x0;agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0x23')]=0x0;unanswered[_0x9f10('0x24')](_0x3a78be[_0x9f10('0x14')]);}}catch(_0x4f6b0c){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x1d'),_0x3a78be[_0x9f10('0x5')]),_0x4f6b0c);}};exports[_0x9f10('0x26')]=function(_0x2c4373){try{_['forIn'](agents,function(_0x358d3f,_0x501ee){if(_0x358d3f[_0x9f10('0x5')]==_0x2c4373[_0x9f10('0x5')]&&!_['includes'](unanswered,_0x358d3f[_0x9f10('0x14')])){utils[_0x9f10('0x16')](util[_0x9f10('0x3')]('[%s][agents][queuecallerabandon]',_0x2c4373[_0x9f10('0x5')]),_0x2c4373);utils['info'](util[_0x9f10('0x3')](_0x9f10('0x27'),_0x2c4373[_0x9f10('0x5')],_0x358d3f['membername'],_0x358d3f[_0x9f10('0x14')]));_0x358d3f[_0x9f10('0x1b')]=!![];_0x358d3f[_0x9f10('0x1f')]=utils[_0x9f10('0x17')]();_0x358d3f[_0x9f10('0xc')]='abandoned';_0x358d3f[_0x9f10('0x28')]='abandoned';_0x358d3f[_0x9f10('0x21')]=_0x2c4373[_0x9f10('0x21')];_0x358d3f[_0x9f10('0x23')]=0x0;writeDB(_0x358d3f);}});}catch(_0x11ee9c){utils[_0x9f10('0x25')](util[_0x9f10('0x3')]('[%s][agents][queuecallerabandon]',_0x2c4373[_0x9f10('0x5')]),_0x11ee9c);}};exports[_0x9f10('0x29')]=function(_0x1b8018){try{if(agents[_0x1b8018['destuniqueid']]){utils[_0x9f10('0x16')](util[_0x9f10('0x3')]('[%s][agents][agentconnect]',_0x1b8018[_0x9f10('0x5')]),_0x1b8018);utils['info'](util[_0x9f10('0x3')](_0x9f10('0x2a'),_0x1b8018[_0x9f10('0x5')],agents[_0x1b8018[_0x9f10('0x14')]][_0x9f10('0x8')],_0x1b8018[_0x9f10('0x14')]));agents[_0x1b8018[_0x9f10('0x14')]][_0x9f10('0x2b')]=utils['now']();agents[_0x1b8018[_0x9f10('0x14')]][_0x9f10('0xb')]=_0x1b8018[_0x9f10('0xb')];agents[_0x1b8018['destuniqueid']][_0x9f10('0x2c')]=_0x1b8018[_0x9f10('0x2c')];agents[_0x1b8018['destuniqueid']][_0x9f10('0x21')]=_0x1b8018[_0x9f10('0x22')];agents[_0x1b8018[_0x9f10('0x14')]]['lastevent']='connect';_[_0x9f10('0x2d')](agents,function(_0x2ff98d,_0x1deed4){if(_0x2ff98d[_0x9f10('0x14')]!=_0x1b8018[_0x9f10('0x14')]&&_0x2ff98d[_0x9f10('0x5')]==_0x1b8018[_0x9f10('0x5')]){_0x2ff98d[_0x9f10('0x23')]=0x0;_0x2ff98d[_0x9f10('0x21')]=_0x1b8018[_0x9f10('0x22')];_0x2ff98d[_0x9f10('0x1b')]=!![];_0x2ff98d[_0x9f10('0x1f')]=utils['now']();_0x2ff98d['lastevent']='answered_elsewhere';_0x2ff98d[_0x9f10('0x28')]='answered_elsewhere';_0x2ff98d[_0x9f10('0x2e')]=_0x1b8018[_0x9f10('0x14')];_0x2ff98d[_0x9f10('0x2f')]=_0x1b8018['membername'];writeDB(_0x2ff98d);}});}}catch(_0x3cfce6){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x30'),_0x1b8018[_0x9f10('0x5')]),_0x3cfce6);}};exports['agentcomplete']=function(_0x578368){try{if(!_['isNil'](agents[_0x578368[_0x9f10('0x14')]])){utils['debug'](util[_0x9f10('0x3')]('[%s][agents][agentcomplete]',_0x578368[_0x9f10('0x5')]),_0x578368);utils[_0x9f10('0x19')](util[_0x9f10('0x3')](_0x9f10('0x31'),_0x578368['uniqueid'],agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x8')],_0x578368['destuniqueid']));agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0xf')]=!![];agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x32')]=utils[_0x9f10('0x17')]();agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x23')]=utils[_0x9f10('0x33')](agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x32')],agents[_0x578368['destuniqueid']][_0x9f10('0x2b')]);agents[_0x578368[_0x9f10('0x14')]]['reason']=_0x578368[_0x9f10('0x28')];agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0xc')]=_0x9f10('0x34');writeDB(agents[_0x578368['destuniqueid']]);}}catch(_0x283f04){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x35'),_0x578368[_0x9f10('0x5')]),_0x283f04);}};exports[_0x9f10('0x36')]=function(_0x479b46){try{if(!_[_0x9f10('0x1c')](agents[_0x479b46[_0x9f10('0x37')]])){utils[_0x9f10('0x16')](util[_0x9f10('0x3')](_0x9f10('0x38'),_0x479b46[_0x9f10('0x5')]),_0x479b46);utils['info'](util[_0x9f10('0x3')](_0x9f10('0x39'),_0x479b46[_0x9f10('0x5')],agents[_0x479b46[_0x9f10('0x37')]][_0x9f10('0x8')],agents[_0x479b46[_0x9f10('0x37')]][_0x9f10('0x5')]));agents[_0x479b46[_0x9f10('0x37')]]['transfer']=!![];agents[_0x479b46[_0x9f10('0x37')]]['transfertype']=_0x9f10('0x3a');agents[_0x479b46['transfereruniqueid']][_0x9f10('0x3b')]=_0x479b46[_0x9f10('0x3c')];agents[_0x479b46[_0x9f10('0x37')]][_0x9f10('0x3d')]=agents[_0x479b46[_0x9f10('0x37')]]['uniqueid'];}}catch(_0x12cf34){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x38'),_0x479b46['uniqueid']),_0x12cf34);}};exports['attendedtransfer']=function(_0x265f69){try{utils[_0x9f10('0x16')](util['format']('[%s][agents][attendedtransfer]',_0x265f69[_0x9f10('0x3e')]),_0x265f69);if(_0x265f69[_0x9f10('0x3e')]==_0x265f69[_0x9f10('0x3f')]){if(!_['isNil'](agents[_0x265f69[_0x9f10('0x40')]])){utils[_0x9f10('0x19')](util[_0x9f10('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x265f69[_0x9f10('0x3e')],agents[_0x265f69[_0x9f10('0x40')]][_0x9f10('0x8')]));agents[_0x265f69['secondtransfereruniqueid']][_0x9f10('0x41')]=!![];agents[_0x265f69[_0x9f10('0x40')]]['transfertype']=_0x9f10('0x42');agents[_0x265f69[_0x9f10('0x40')]][_0x9f10('0x3b')]=_0x265f69[_0x9f10('0x43')];agents[_0x265f69[_0x9f10('0x40')]]['transferuniqueid']=_0x265f69[_0x9f10('0x3e')];}if(_0x265f69['transfereeuniqueid']&&agents[_0x265f69['transfereeuniqueid']]){agents[_0x265f69[_0x9f10('0x44')]][_0x9f10('0x45')]=0x1;transfers[_0x265f69[_0x9f10('0x44')]]=_[_0x9f10('0x46')](agents[_0x265f69[_0x9f10('0x44')]]);transfers[_0x265f69[_0x9f10('0x44')]][_0x9f10('0xa')]=agents[_0x265f69['secondtransfereruniqueid']]['calleridnum'];transfers[_0x265f69[_0x9f10('0x44')]][_0x9f10('0x47')]=agents[_0x265f69[_0x9f10('0x40')]][_0x9f10('0x47')];transfers[_0x265f69[_0x9f10('0x44')]][_0x9f10('0x48')]=utils[_0x9f10('0x17')]();transfers[_0x265f69['transfereeuniqueid']][_0x9f10('0x2b')]=utils[_0x9f10('0x17')]();transfers[_0x265f69['transfereeuniqueid']][_0x9f10('0x21')]=0x0;transfers[_0x265f69[_0x9f10('0x44')]]['agententerreason']=0x2;}}else if(_0x265f69[_0x9f10('0x40')]==_0x265f69[_0x9f10('0x49')]){if(!_['isNil'](agents[_0x265f69[_0x9f10('0x3e')]])){utils['info'](util[_0x9f10('0x3')](_0x9f10('0x4a'),_0x265f69[_0x9f10('0x3e')],agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x8')]));agents[_0x265f69['origtransfereruniqueid']][_0x9f10('0x41')]=!![];agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x4b')]='ATTENDED';agents[_0x265f69['origtransfereruniqueid']][_0x9f10('0x3b')]=_0x265f69[_0x9f10('0x4c')];agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x3d')]=_0x265f69[_0x9f10('0x40')];}if(_0x265f69[_0x9f10('0x4d')]&&agents[_0x265f69[_0x9f10('0x4d')]]){agents[_0x265f69['transfertargetuniqueid']][_0x9f10('0x45')]=0x1;transfers[_0x265f69[_0x9f10('0x4d')]]=_['clone'](agents[_0x265f69[_0x9f10('0x4d')]]);transfers[_0x265f69['transfertargetuniqueid']][_0x9f10('0xa')]=agents[_0x265f69[_0x9f10('0x3e')]]['calleridnum'];transfers[_0x265f69[_0x9f10('0x4d')]]['calleridname']=agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x47')];transfers[_0x265f69[_0x9f10('0x4d')]]['agentcalledAt']=utils[_0x9f10('0x17')]();transfers[_0x265f69['transfertargetuniqueid']][_0x9f10('0x2b')]=utils[_0x9f10('0x17')]();transfers[_0x265f69[_0x9f10('0x4d')]]['holdtime']=0x0;transfers[_0x265f69[_0x9f10('0x4d')]]['agententerreason']=0x2;}}}catch(_0x5708c1){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x4e'),_0x265f69['origtransfereruniqueid']),_0x5708c1);}};exports[_0x9f10('0x4f')]=function(_0x5a64ae){try{utils['debug'](util[_0x9f10('0x3')]('[%s][agents][hangup]',_0x5a64ae['uniqueid']),_0x5a64ae);if(agents[_0x5a64ae[_0x9f10('0x5')]]&&agents[_0x5a64ae['uniqueid']][_0x9f10('0x28')]===_0x9f10('0x20')){if(_0x5a64ae[_0x9f10('0x50')]==='21'){agents[_0x5a64ae['uniqueid']][_0x9f10('0x28')]=_0x9f10('0x51');agents[_0x5a64ae['uniqueid']][_0x9f10('0xc')]='rejected';}utils['info'](util[_0x9f10('0x3')](_0x9f10('0x52'),_0x5a64ae[_0x9f10('0x5')],agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x8')],agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x28')],agents[_0x5a64ae['uniqueid']][_0x9f10('0xc')]));writeDB(agents[_0x5a64ae[_0x9f10('0x5')]]);var _0x27f337=unanswered[_0x9f10('0x53')](_0x5a64ae[_0x9f10('0x5')]);if(_0x27f337>-0x1){unanswered[_0x9f10('0x54')](_0x27f337,0x1);}}if(transfers[_0x5a64ae[_0x9f10('0x5')]]){transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xf')]=!![];transfers[_0x5a64ae['uniqueid']][_0x9f10('0x32')]=utils[_0x9f10('0x17')]();transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x23')]=utils['diffTime'](transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x32')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x2b')]);transfers[_0x5a64ae['uniqueid']]['reason']=_0x9f10('0x55');transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xc')]=_0x9f10('0x34');utils[_0x9f10('0x19')](util[_0x9f10('0x3')](_0x9f10('0x52'),_0x5a64ae[_0x9f10('0x5')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x8')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x28')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xc')]));writeDB(transfers[_0x5a64ae[_0x9f10('0x5')]],!![]);}if(agents[_0x5a64ae['uniqueid']]&&agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x2b')]){agents[_0x5a64ae['uniqueid']][_0x9f10('0xf')]=!![];agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x32')]=utils[_0x9f10('0x17')]();agents[_0x5a64ae['uniqueid']][_0x9f10('0x23')]=utils['diffTime'](agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x32')],agents[_0x5a64ae[_0x9f10('0x5')]]['agentconnectAt']);agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x28')]=agents[_0x5a64ae[_0x9f10('0x5')]]['transfer']?_0x9f10('0x41'):_0x9f10('0x55');agents[_0x5a64ae[_0x9f10('0x5')]]['lastevent']='complete';utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5a64ae['uniqueid'],agents[_0x5a64ae['uniqueid']][_0x9f10('0x8')],agents[_0x5a64ae[_0x9f10('0x5')]]['reason'],agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xc')]));writeDB(agents[_0x5a64ae[_0x9f10('0x5')]]);}}catch(_0x3b3dd8){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x56'),_0x5a64ae[_0x9f10('0x5')]),_0x3b3dd8);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b9468e1..6d73d3b 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 _0xdbd9=['[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','toLowerCase','appdata','cdr','split','lastIndexOf','noop','set','gotoif','application','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','uniqueid','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','DOCUMENTATION','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','now','disposition','toNumber','channelstate','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','billableseconds','diffTime','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype'];(function(_0x2a416a,_0x2f0660){var _0x52bb59=function(_0x411290){while(--_0x411290){_0x2a416a['push'](_0x2a416a['shift']());}};_0x52bb59(++_0x2f0660);}(_0xdbd9,0x145));var _0x9dbd=function(_0x1dd35f,_0x2d5d24){_0x1dd35f=_0x1dd35f-0x0;var _0x5823dd=_0xdbd9[_0x1dd35f];return _0x5823dd;};'use strict';var _=require(_0x9dbd('0x0'));var util=require(_0x9dbd('0x1'));var utils=require(_0x9dbd('0x2'));var dispositions=[_0x9dbd('0x3'),_0x9dbd('0x4'),'FAILED',_0x9dbd('0x3'),'NO\x20ANSWER',_0x9dbd('0x3'),_0x9dbd('0x5'),_0x9dbd('0x6'),'FAILED','FAILED',_0x9dbd('0x4')];var channels={};function writeDB(_0x22c2fa){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x9'),_0x22c2fa['uniqueid'],_0x22c2fa[_0x9dbd('0xa')],_0x22c2fa[_0x9dbd('0xb')],_0x22c2fa[_0x9dbd('0xc')],_0x22c2fa[_0x9dbd('0xd')],_0x22c2fa[_0x9dbd('0xe')],_0x22c2fa[_0x9dbd('0xf')],_0x22c2fa['lastevent']));if(_0x22c2fa[_0x9dbd('0x10')]){utils[_0x9dbd('0x11')](_0x22c2fa[_0x9dbd('0x10')])[_0x9dbd('0x12')](function(_0x20e61d){if(_0x20e61d){_0x22c2fa[_0x9dbd('0x13')]=_0x20e61d['id'];}utils['request']('CreateVoiceCallReport',_0x22c2fa);});}else{utils[_0x9dbd('0x14')]('CreateVoiceCallReport',_0x22c2fa);}if(channels[_0x22c2fa[_0x9dbd('0x15')]]){delete channels[_0x22c2fa['uniqueid']];}}exports[_0x9dbd('0x16')]=function(_0x13bf07){try{utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')](_0x9dbd('0x18'),_0x13bf07[_0x9dbd('0x15')]),_0x13bf07);if(_0x13bf07['uniqueid']==_0x13bf07[_0x9dbd('0x19')]&&_0x13bf07[_0x9dbd('0xa')]!=_0x9dbd('0x1a')){utils['info'](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x13bf07[_0x9dbd('0x15')],_0x13bf07[_0x9dbd('0x1b')],_0x13bf07['exten']));channels[_0x13bf07['uniqueid']]={'uniqueid':_0x13bf07[_0x9dbd('0x15')],'accountcode':_0x13bf07[_0x9dbd('0x10')],'source':_0x13bf07[_0x9dbd('0xe')],'destination':_0x13bf07[_0x9dbd('0x1c')],'destinationcontext':_0x13bf07[_0x9dbd('0x1b')],'channel':_0x13bf07['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9dbd('0x3'),'amaflags':_0x9dbd('0x1d')};}}catch(_0x2af646){utils[_0x9dbd('0x1e')](util['format'](_0x9dbd('0x18'),_0x13bf07['uniqueid']),_0x2af646);}};exports['newstate']=function(_0xae35fd){try{utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')](_0x9dbd('0x1f'),_0xae35fd[_0x9dbd('0x15')]),_0xae35fd);if(!_[_0x9dbd('0x20')](channels[_0xae35fd['uniqueid']])&&_0xae35fd['channelstate']==0x6){utils[_0x9dbd('0x7')](util['format'](_0x9dbd('0x21'),_0xae35fd[_0x9dbd('0x15')],_0xae35fd['context'],_0xae35fd[_0x9dbd('0xa')]));if(_[_0x9dbd('0x20')](channels[_0xae35fd[_0x9dbd('0x15')]][_0x9dbd('0x22')])){channels[_0xae35fd[_0x9dbd('0x15')]]['systemanswertime']=utils['now']();}}else if(!_[_0x9dbd('0x20')](channels[_0xae35fd[_0x9dbd('0x19')]])&&_0xae35fd['channelstate']==0x6&&_0xae35fd[_0x9dbd('0x1b')]!='transfer'){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x23'),_0xae35fd[_0x9dbd('0x15')],_0xae35fd[_0x9dbd('0x19')],_0xae35fd[_0x9dbd('0x1b')],_0xae35fd[_0x9dbd('0xa')]));channels[_0xae35fd['linkedid']][_0x9dbd('0x10')]=_0xae35fd['accountcode'];channels[_0xae35fd[_0x9dbd('0x19')]][_0x9dbd('0x24')]=_0xae35fd[_0x9dbd('0xa')];if(_[_0x9dbd('0x20')](channels[_0xae35fd[_0x9dbd('0x19')]][_0x9dbd('0x25')])){channels[_0xae35fd['linkedid']][_0x9dbd('0x25')]=utils[_0x9dbd('0x26')]();}channels[_0xae35fd[_0x9dbd('0x19')]][_0x9dbd('0x27')]=dispositions[_[_0x9dbd('0x28')](_0xae35fd[_0x9dbd('0x29')])]||_0x9dbd('0x5');}}catch(_0x3bf888){utils[_0x9dbd('0x1e')](util[_0x9dbd('0x8')]('[%s][calls][newstate]',_0xae35fd[_0x9dbd('0x15')]),_0x3bf888);}};exports[_0x9dbd('0x2a')]=function(_0x36dd93){try{if(!_[_0x9dbd('0x20')](channels[_0x36dd93['uniqueid']])){utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')](_0x9dbd('0x2b'),_0x36dd93[_0x9dbd('0x15')]),_0x36dd93);if(_[_0x9dbd('0x20')](channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x2c')])){channels[_0x36dd93['uniqueid']]['callerid']=_0x36dd93[_0x9dbd('0x2d')]+'\x20<'+_0x36dd93['calleridnum']+'>';}utils['info'](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x36dd93['uniqueid'],channels[_0x36dd93['uniqueid']]['callerid'],_0x36dd93[_0x9dbd('0x2e')]));channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x2f')]=utils[_0x9dbd('0x26')]();channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x30')]=utils['diffTime'](channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x2f')],channels[_0x36dd93['uniqueid']]['starttime']);channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x31')]=channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x25')]?utils[_0x9dbd('0x32')](channels[_0x36dd93['uniqueid']][_0x9dbd('0x2f')],channels[_0x36dd93['uniqueid']][_0x9dbd('0x25')]):0x0;writeDB(channels[_0x36dd93[_0x9dbd('0x15')]]);}}catch(_0x354012){utils[_0x9dbd('0x1e')](util['format'](_0x9dbd('0x2b'),_0x36dd93['uniqueid']),_0x354012);}};exports['attendedtransfer']=function(_0x34c155){try{if(!_[_0x9dbd('0x20')](channels[_0x34c155[_0x9dbd('0x33')]])){utils['debug'](util[_0x9dbd('0x8')](_0x9dbd('0x34'),_0x34c155['origtransfereruniqueid']),_0x34c155);if(channels[_0x34c155['localtwolinkedid']]['channel']==_0x34c155[_0x9dbd('0x35')]){utils[_0x9dbd('0x7')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x34c155[_0x9dbd('0x36')],_0x34c155['localtwolinkedid'],_0x34c155[_0x9dbd('0x37')]));channels[_0x34c155[_0x9dbd('0x33')]]['destinationchannel']=_0x34c155[_0x9dbd('0x37')];channels[_0x34c155[_0x9dbd('0x33')]]['userfield']='_attended';}else if(channels[_0x34c155[_0x9dbd('0x33')]]['channel']=_0x34c155['transfertargetchannel']){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x38'),_0x34c155[_0x9dbd('0x36')],_0x34c155[_0x9dbd('0x33')],_0x34c155[_0x9dbd('0x39')]));channels[_0x34c155[_0x9dbd('0x33')]][_0x9dbd('0x24')]=_0x34c155['origtransfererchannel'];channels[_0x34c155[_0x9dbd('0x33')]]['userfield']=_0x9dbd('0x3a');}}}catch(_0x2d97a5){utils[_0x9dbd('0x1e')](util[_0x9dbd('0x8')](_0x9dbd('0x34'),_0x34c155[_0x9dbd('0x36')]),_0x2d97a5);}};exports['musiconholdstart']=function(_0x5c0286){try{if(!_[_0x9dbd('0x20')](channels[_0x5c0286[_0x9dbd('0x15')]])){utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')]('[%s][calls][musiconholdstart]',_0x5c0286[_0x9dbd('0x15')]),_0x5c0286);channels[_0x5c0286[_0x9dbd('0x15')]][_0x9dbd('0x3b')]=utils[_0x9dbd('0x26')]();utils['info'](util[_0x9dbd('0x8')](_0x9dbd('0x3c'),_0x5c0286[_0x9dbd('0x15')],channels[_0x5c0286[_0x9dbd('0x15')]][_0x9dbd('0x3b')]));}}catch(_0x207f34){utils[_0x9dbd('0x1e')](util[_0x9dbd('0x8')]('[%s][calls][musiconholdstart]',_0x5c0286[_0x9dbd('0x15')]),_0x207f34);}};exports[_0x9dbd('0x3d')]=function(_0x3870c8){try{if(!_[_0x9dbd('0x20')](channels[_0x3870c8[_0x9dbd('0x15')]])){utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')](_0x9dbd('0x3e'),_0x3870c8[_0x9dbd('0x15')]),_0x3870c8);if(!_[_0x9dbd('0x20')](channels[_0x3870c8['uniqueid']][_0x9dbd('0x3b')])){channels[_0x3870c8[_0x9dbd('0x15')]][_0x9dbd('0x3f')]+=utils[_0x9dbd('0x32')](utils['now'](),channels[_0x3870c8[_0x9dbd('0x15')]][_0x9dbd('0x3b')]);utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x40'),_0x3870c8[_0x9dbd('0x15')],channels[_0x3870c8[_0x9dbd('0x15')]][_0x9dbd('0x3f')]));delete channels[_0x3870c8[_0x9dbd('0x15')]][_0x9dbd('0x3b')];}}}catch(_0xd6c4fe){utils['error'](util[_0x9dbd('0x8')](_0x9dbd('0x3e'),_0x3870c8[_0x9dbd('0x15')]),_0xd6c4fe);}};exports[_0x9dbd('0x41')]=function(_0x13c70f){try{if(!_['isNil'](channels[_0x13c70f['uniqueid']])){utils[_0x9dbd('0x17')](util['format']('[%s][calls][varset]',_0x13c70f[_0x9dbd('0x15')]),_0x13c70f);if(!_[_0x9dbd('0x20')](_0x13c70f['variable']['xmd-originatecalleridnum'])){utils[_0x9dbd('0x7')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x13c70f[_0x9dbd('0x15')],_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f[_0x9dbd('0x15')]][_0x9dbd('0x43')]=_0x13c70f[_0x9dbd('0x42')];}if(!_['isNil'](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x45')])){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x46'),_0x13c70f[_0x9dbd('0x15')],_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f[_0x9dbd('0x15')]][_0x9dbd('0x47')]=_0x13c70f[_0x9dbd('0x42')];channels[_0x13c70f[_0x9dbd('0x15')]]['callerid']='\x22'+_0x13c70f[_0x9dbd('0x42')]+_0x9dbd('0x48')+_0x13c70f['value']+'>';}if(!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')]['xmd-callerid-preview'])||!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')]['xmd-callerid'])){utils[_0x9dbd('0x7')](util['format'](_0x9dbd('0x49'),_0x13c70f[_0x9dbd('0x15')],!_[_0x9dbd('0x20')](_0x13c70f['variable'][_0x9dbd('0x4a')])?_0x9dbd('0x4a'):_0x9dbd('0x4b'),_0x13c70f['value']));channels[_0x13c70f['uniqueid']]['callerid']=_0x13c70f[_0x9dbd('0x42')];}if(!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x4c')])||!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x4d')])){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x13c70f[_0x9dbd('0x15')],!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x4c')])?_0x9dbd('0x4c'):_0x9dbd('0x4d'),_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f['uniqueid']][_0x9dbd('0x4e')]=_0x9dbd('0x4f');channels[_0x13c70f['uniqueid']][_0x9dbd('0x50')]=_0x13c70f[_0x9dbd('0x42')];channels[_0x13c70f['uniqueid']][_0x9dbd('0xb')]=!![];}if(!_['isNil'](_0x13c70f[_0x9dbd('0x44')]['xmd-contactid'])){utils[_0x9dbd('0x7')](util['format'](_0x9dbd('0x51'),_0x13c70f[_0x9dbd('0x15')],_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f[_0x9dbd('0x15')]]['ContactId']=_0x13c70f['value'];}if(!_['isNil'](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x52')])){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x53'),_0x13c70f[_0x9dbd('0x15')],_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f[_0x9dbd('0x15')]][_0x9dbd('0x54')]=_0x13c70f[_0x9dbd('0x42')];}if(!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x55')])){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x56'),_0x13c70f[_0x9dbd('0x15')],_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f['uniqueid']][_0x9dbd('0x57')]=_0x13c70f[_0x9dbd('0x42')];}if(!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')]['sipcallid'])){utils[_0x9dbd('0x7')](util['format'](_0x9dbd('0x58'),_0x13c70f[_0x9dbd('0x15')],_0x13c70f['value']));channels[_0x13c70f['uniqueid']]['sipcallid']=_0x13c70f['value'];}}}catch(_0x38c71b){utils[_0x9dbd('0x1e')](util['format'](_0x9dbd('0x59'),_0x13c70f[_0x9dbd('0x15')]),_0x38c71b);}};exports[_0x9dbd('0x5a')]=function(_0x7c2e88){try{if(!_[_0x9dbd('0x20')](channels[_0x7c2e88[_0x9dbd('0x15')]])){utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')](_0x9dbd('0x5b'),_0x7c2e88[_0x9dbd('0x15')]),_0x7c2e88);utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x5c'),_0x7c2e88['uniqueid'],_0x7c2e88['application'],_0x7c2e88['appdata']));if(_0x7c2e88['application'][_0x9dbd('0x5d')]()=='set'&&_['startsWith'](_0x7c2e88[_0x9dbd('0x5e')][_0x9dbd('0x5d')](),_0x9dbd('0x5f'))){var _0x546981=_0x7c2e88[_0x9dbd('0x5e')][_0x9dbd('0x60')]('=');var _0x529db4=_0x546981[0x0]['substring'](_0x546981[0x0][_0x9dbd('0x61')]('(')+0x1,_0x546981[0x0]['lastIndexOf'](')'));var _0x42b099=_0x546981[0x1];channels[_0x7c2e88[_0x9dbd('0x15')]][_0x529db4]=_0x42b099;}if(!_['includes']([_0x9dbd('0x2a'),_0x9dbd('0x62'),'execif',_0x9dbd('0x63'),_0x9dbd('0x64')],_0x7c2e88['application'][_0x9dbd('0x5d')]())){channels[_0x7c2e88[_0x9dbd('0x15')]][_0x9dbd('0x4e')]=_0x7c2e88[_0x9dbd('0x65')];channels[_0x7c2e88[_0x9dbd('0x15')]]['lastdata']=_0x7c2e88['appdata'];}}}catch(_0x21e803){utils[_0x9dbd('0x1e')](util[_0x9dbd('0x8')](_0x9dbd('0x5b'),_0x7c2e88[_0x9dbd('0x15')]),_0x21e803);}}; \ No newline at end of file +var _0xb38e=['debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','newstate','[%s][calls][newstate]','isNil','channelstate','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','split','substring','lastIndexOf','execif','lodash','util','./utils','NO\x20ANSWER','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','request','CreateVoiceCallReport'];(function(_0x14b287,_0xf299d1){var _0x3c4d82=function(_0x333adb){while(--_0x333adb){_0x14b287['push'](_0x14b287['shift']());}};_0x3c4d82(++_0xf299d1);}(_0xb38e,0x11e));var _0xeb38=function(_0x70f30e,_0x4a954c){_0x70f30e=_0x70f30e-0x0;var _0x207f73=_0xb38e[_0x70f30e];return _0x207f73;};'use strict';var _=require(_0xeb38('0x0'));var util=require(_0xeb38('0x1'));var utils=require(_0xeb38('0x2'));var dispositions=[_0xeb38('0x3'),'FAILED',_0xeb38('0x4'),_0xeb38('0x3'),_0xeb38('0x3'),'NO\x20ANSWER','ANSWERED','BUSY','FAILED',_0xeb38('0x4'),'FAILED'];var channels={};function writeDB(_0x30d6c2){utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x7'),_0x30d6c2[_0xeb38('0x8')],_0x30d6c2[_0xeb38('0x9')],_0x30d6c2['queue'],_0x30d6c2[_0xeb38('0xa')],_0x30d6c2[_0xeb38('0xb')],_0x30d6c2[_0xeb38('0xc')],_0x30d6c2[_0xeb38('0xd')],_0x30d6c2[_0xeb38('0xe')]));if(_0x30d6c2['accountcode']){utils[_0xeb38('0xf')](_0x30d6c2[_0xeb38('0x10')])[_0xeb38('0x11')](function(_0x2640c0){if(_0x2640c0){_0x30d6c2['UserId']=_0x2640c0['id'];}utils[_0xeb38('0x12')](_0xeb38('0x13'),_0x30d6c2);});}else{utils['request'](_0xeb38('0x13'),_0x30d6c2);}if(channels[_0x30d6c2[_0xeb38('0x8')]]){delete channels[_0x30d6c2[_0xeb38('0x8')]];}}exports['newchannel']=function(_0x59f453){try{utils[_0xeb38('0x14')](util[_0xeb38('0x6')](_0xeb38('0x15'),_0x59f453['uniqueid']),_0x59f453);if(_0x59f453[_0xeb38('0x8')]==_0x59f453['linkedid']&&_0x59f453[_0xeb38('0x9')]!=_0xeb38('0x16')){utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x17'),_0x59f453[_0xeb38('0x8')],_0x59f453[_0xeb38('0x18')],_0x59f453[_0xeb38('0x19')]));channels[_0x59f453['uniqueid']]={'uniqueid':_0x59f453[_0xeb38('0x8')],'accountcode':_0x59f453[_0xeb38('0x10')],'source':_0x59f453[_0xeb38('0xc')],'destination':_0x59f453[_0xeb38('0x19')],'destinationcontext':_0x59f453['context'],'channel':_0x59f453[_0xeb38('0x9')],'starttime':utils[_0xeb38('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xeb38('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x4b5da8){utils['error'](util[_0xeb38('0x6')](_0xeb38('0x15'),_0x59f453[_0xeb38('0x8')]),_0x4b5da8);}};exports[_0xeb38('0x1b')]=function(_0xb4f33f){try{utils['debug'](util[_0xeb38('0x6')](_0xeb38('0x1c'),_0xb4f33f['uniqueid']),_0xb4f33f);if(!_[_0xeb38('0x1d')](channels[_0xb4f33f[_0xeb38('0x8')]])&&_0xb4f33f[_0xeb38('0x1e')]==0x6){utils[_0xeb38('0x5')](util[_0xeb38('0x6')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0xb4f33f[_0xeb38('0x8')],_0xb4f33f[_0xeb38('0x18')],_0xb4f33f[_0xeb38('0x9')]));if(_[_0xeb38('0x1d')](channels[_0xb4f33f[_0xeb38('0x8')]]['systemanswertime'])){channels[_0xb4f33f['uniqueid']]['systemanswertime']=utils[_0xeb38('0x1a')]();}}else if(!_[_0xeb38('0x1d')](channels[_0xb4f33f[_0xeb38('0x1f')]])&&_0xb4f33f['channelstate']==0x6&&_0xb4f33f[_0xeb38('0x18')]!=_0xeb38('0x20')){utils['info'](util[_0xeb38('0x6')](_0xeb38('0x21'),_0xb4f33f[_0xeb38('0x8')],_0xb4f33f['linkedid'],_0xb4f33f['context'],_0xb4f33f[_0xeb38('0x9')]));channels[_0xb4f33f['linkedid']][_0xeb38('0x10')]=_0xb4f33f[_0xeb38('0x10')];channels[_0xb4f33f[_0xeb38('0x1f')]]['destinationchannel']=_0xb4f33f[_0xeb38('0x9')];if(_[_0xeb38('0x1d')](channels[_0xb4f33f[_0xeb38('0x1f')]]['answertime'])){channels[_0xb4f33f['linkedid']][_0xeb38('0x22')]=utils['now']();}channels[_0xb4f33f[_0xeb38('0x1f')]][_0xeb38('0x23')]=dispositions[_[_0xeb38('0x24')](_0xb4f33f[_0xeb38('0x1e')])]||'ANSWERED';}}catch(_0x207731){utils[_0xeb38('0x25')](util[_0xeb38('0x6')]('[%s][calls][newstate]',_0xb4f33f[_0xeb38('0x8')]),_0x207731);}};exports[_0xeb38('0x26')]=function(_0x2aae34){try{if(!_[_0xeb38('0x1d')](channels[_0x2aae34[_0xeb38('0x8')]])){utils[_0xeb38('0x14')](util[_0xeb38('0x6')](_0xeb38('0x27'),_0x2aae34[_0xeb38('0x8')]),_0x2aae34);if(_[_0xeb38('0x1d')](channels[_0x2aae34[_0xeb38('0x8')]]['callerid'])){channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x28')]=_0x2aae34['calleridname']+'\x20<'+_0x2aae34[_0xeb38('0xc')]+'>';}utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x29'),_0x2aae34['uniqueid'],channels[_0x2aae34[_0xeb38('0x8')]]['callerid'],_0x2aae34[_0xeb38('0x2a')]));channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x2b')]=utils[_0xeb38('0x1a')]();channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x2c')]=utils[_0xeb38('0x2d')](channels[_0x2aae34['uniqueid']][_0xeb38('0x2b')],channels[_0x2aae34['uniqueid']][_0xeb38('0x2e')]);channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x2f')]=channels[_0x2aae34[_0xeb38('0x8')]]['answertime']?utils[_0xeb38('0x2d')](channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x2b')],channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x22')]):0x0;writeDB(channels[_0x2aae34[_0xeb38('0x8')]]);}}catch(_0x109b1a){utils[_0xeb38('0x25')](util[_0xeb38('0x6')](_0xeb38('0x27'),_0x2aae34[_0xeb38('0x8')]),_0x109b1a);}};exports[_0xeb38('0x30')]=function(_0x219406){try{if(!_[_0xeb38('0x1d')](channels[_0x219406[_0xeb38('0x31')]])){utils[_0xeb38('0x14')](util[_0xeb38('0x6')](_0xeb38('0x32'),_0x219406['origtransfereruniqueid']),_0x219406);if(channels[_0x219406[_0xeb38('0x31')]][_0xeb38('0x9')]==_0x219406[_0xeb38('0x33')]){utils[_0xeb38('0x5')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x219406[_0xeb38('0x34')],_0x219406[_0xeb38('0x31')],_0x219406[_0xeb38('0x35')]));channels[_0x219406[_0xeb38('0x31')]][_0xeb38('0x36')]=_0x219406[_0xeb38('0x35')];channels[_0x219406[_0xeb38('0x31')]][_0xeb38('0x37')]=_0xeb38('0x38');}else if(channels[_0x219406['localtwolinkedid']][_0xeb38('0x9')]=_0x219406[_0xeb38('0x39')]){utils['info'](util[_0xeb38('0x6')](_0xeb38('0x3a'),_0x219406[_0xeb38('0x34')],_0x219406[_0xeb38('0x31')],_0x219406['origtransfererchannel']));channels[_0x219406['localtwolinkedid']][_0xeb38('0x36')]=_0x219406[_0xeb38('0x3b')];channels[_0x219406[_0xeb38('0x31')]][_0xeb38('0x37')]=_0xeb38('0x38');}}}catch(_0x44ef52){utils[_0xeb38('0x25')](util['format']('[%s][calls][attendedtransfer]',_0x219406[_0xeb38('0x34')]),_0x44ef52);}};exports[_0xeb38('0x3c')]=function(_0x56f3ae){try{if(!_[_0xeb38('0x1d')](channels[_0x56f3ae[_0xeb38('0x8')]])){utils['debug'](util['format'](_0xeb38('0x3d'),_0x56f3ae['uniqueid']),_0x56f3ae);channels[_0x56f3ae[_0xeb38('0x8')]]['musiconholdstartAt']=utils['now']();utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x3e'),_0x56f3ae[_0xeb38('0x8')],channels[_0x56f3ae[_0xeb38('0x8')]][_0xeb38('0x3f')]));}}catch(_0x3f5c7b){utils[_0xeb38('0x25')](util['format'](_0xeb38('0x3d'),_0x56f3ae[_0xeb38('0x8')]),_0x3f5c7b);}};exports[_0xeb38('0x40')]=function(_0x1da5f5){try{if(!_[_0xeb38('0x1d')](channels[_0x1da5f5[_0xeb38('0x8')]])){utils['debug'](util[_0xeb38('0x6')](_0xeb38('0x41'),_0x1da5f5[_0xeb38('0x8')]),_0x1da5f5);if(!_[_0xeb38('0x1d')](channels[_0x1da5f5[_0xeb38('0x8')]][_0xeb38('0x3f')])){channels[_0x1da5f5[_0xeb38('0x8')]][_0xeb38('0x42')]+=utils[_0xeb38('0x2d')](utils[_0xeb38('0x1a')](),channels[_0x1da5f5[_0xeb38('0x8')]][_0xeb38('0x3f')]);utils[_0xeb38('0x5')](util['format'](_0xeb38('0x43'),_0x1da5f5[_0xeb38('0x8')],channels[_0x1da5f5['uniqueid']]['mohtime']));delete channels[_0x1da5f5[_0xeb38('0x8')]][_0xeb38('0x3f')];}}}catch(_0x268060){utils['error'](util[_0xeb38('0x6')]('[%s][calls][musiconholdstop]',_0x1da5f5[_0xeb38('0x8')]),_0x268060);}};exports[_0xeb38('0x44')]=function(_0x5341d3){try{if(!_[_0xeb38('0x1d')](channels[_0x5341d3[_0xeb38('0x8')]])){utils['debug'](util[_0xeb38('0x6')](_0xeb38('0x45'),_0x5341d3[_0xeb38('0x8')]),_0x5341d3);if(!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x47')])){utils['info'](util[_0xeb38('0x6')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5341d3[_0xeb38('0x8')],_0x5341d3[_0xeb38('0x48')]));channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x49')]=_0x5341d3[_0xeb38('0x48')];}if(!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')]['xmd-phone'])){utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x4a'),_0x5341d3['uniqueid'],_0x5341d3[_0xeb38('0x48')]));channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x4b')]=_0x5341d3[_0xeb38('0x48')];channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x28')]='\x22'+_0x5341d3['value']+_0xeb38('0x4c')+_0x5341d3[_0xeb38('0x48')]+'>';}if(!_['isNil'](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x4d')])||!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x4e')])){utils[_0xeb38('0x5')](util[_0xeb38('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5341d3[_0xeb38('0x8')],!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x4d')])?_0xeb38('0x4d'):'xmd-callerid',_0x5341d3['value']));channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x28')]=_0x5341d3[_0xeb38('0x48')];}if(!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')]['xmd-queue'])||!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x4f')])){utils[_0xeb38('0x5')](util[_0xeb38('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5341d3[_0xeb38('0x8')],!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')]['xmd-queue'])?_0xeb38('0x50'):_0xeb38('0x4f'),_0x5341d3[_0xeb38('0x48')]));channels[_0x5341d3['uniqueid']][_0xeb38('0x51')]=_0xeb38('0x52');channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x53')]=_0x5341d3[_0xeb38('0x48')];channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x54')]=!![];}if(!_[_0xeb38('0x1d')](_0x5341d3['variable'][_0xeb38('0x55')])){utils[_0xeb38('0x5')](util[_0xeb38('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5341d3[_0xeb38('0x8')],_0x5341d3['value']));channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x56')]=_0x5341d3['value'];}if(!_[_0xeb38('0x1d')](_0x5341d3['variable']['xmd-cdrtype'])){utils[_0xeb38('0x5')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5341d3['uniqueid'],_0x5341d3['value']));channels[_0x5341d3['uniqueid']][_0xeb38('0x57')]=_0x5341d3[_0xeb38('0x48')];}if(!_[_0xeb38('0x1d')](_0x5341d3['variable'][_0xeb38('0x58')])){utils['info'](util[_0xeb38('0x6')](_0xeb38('0x59'),_0x5341d3[_0xeb38('0x8')],_0x5341d3['value']));channels[_0x5341d3[_0xeb38('0x8')]]['routeid']=_0x5341d3[_0xeb38('0x48')];}if(!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x5a')])){utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x5b'),_0x5341d3[_0xeb38('0x8')],_0x5341d3[_0xeb38('0x48')]));channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x5a')]=_0x5341d3[_0xeb38('0x48')];}}}catch(_0x153493){utils['error'](util[_0xeb38('0x6')](_0xeb38('0x45'),_0x5341d3[_0xeb38('0x8')]),_0x153493);}};exports[_0xeb38('0x5c')]=function(_0xcd51df){try{if(!_[_0xeb38('0x1d')](channels[_0xcd51df[_0xeb38('0x8')]])){utils[_0xeb38('0x14')](util['format'](_0xeb38('0x5d'),_0xcd51df[_0xeb38('0x8')]),_0xcd51df);utils[_0xeb38('0x5')](util[_0xeb38('0x6')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0xcd51df[_0xeb38('0x8')],_0xcd51df[_0xeb38('0x5e')],_0xcd51df[_0xeb38('0x5f')]));if(_0xcd51df[_0xeb38('0x5e')][_0xeb38('0x60')]()==_0xeb38('0x61')&&_['startsWith'](_0xcd51df[_0xeb38('0x5f')][_0xeb38('0x60')](),'cdr')){var _0x920170=_0xcd51df[_0xeb38('0x5f')][_0xeb38('0x62')]('=');var _0x22de16=_0x920170[0x0][_0xeb38('0x63')](_0x920170[0x0][_0xeb38('0x64')]('(')+0x1,_0x920170[0x0][_0xeb38('0x64')](')'));var _0xb8377d=_0x920170[0x1];channels[_0xcd51df[_0xeb38('0x8')]][_0x22de16]=_0xb8377d;}if(!_['includes'](['hangup','noop',_0xeb38('0x65'),_0xeb38('0x61'),'gotoif'],_0xcd51df[_0xeb38('0x5e')][_0xeb38('0x60')]())){channels[_0xcd51df[_0xeb38('0x8')]][_0xeb38('0x51')]=_0xcd51df[_0xeb38('0x5e')];channels[_0xcd51df[_0xeb38('0x8')]][_0xeb38('0x53')]=_0xcd51df[_0xeb38('0x5f')];}}}catch(_0x113e89){utils[_0xeb38('0x25')](util[_0xeb38('0x6')](_0xeb38('0x5d'),_0xcd51df[_0xeb38('0x8')]),_0x113e89);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ca52bbb..6da3fac 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 _0xd2df=['managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','error','[core]\x20error','close'];(function(_0x778318,_0x5b29c3){var _0x12942e=function(_0x4d17c8){while(--_0x4d17c8){_0x778318['push'](_0x778318['shift']());}};_0x12942e(++_0x5b29c3);}(_0xd2df,0xc9));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xfd2d('0x0'));exports[_0xfd2d('0x1')]=function(){utils[_0xfd2d('0x2')](_0xfd2d('0x3'));};exports[_0xfd2d('0x4')]=function(){utils[_0xfd2d('0x2')](_0xfd2d('0x5'));};exports['fullybooted']=function(){utils[_0xfd2d('0x2')]('[core]\x20fullybooted');};exports[_0xfd2d('0x6')]=function(_0x2ed76b){utils['error'](_0xfd2d('0x7'),_0x2ed76b);};exports[_0xfd2d('0x8')]=function(){utils['info']('[core]\x20close');};exports[_0xfd2d('0x9')]=function(_0x414871){}; \ No newline at end of file +var _0x310b=['[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x24529e,_0x5e67cb){var _0x2072de=function(_0x1b8305){while(--_0x1b8305){_0x24529e['push'](_0x24529e['shift']());}};_0x2072de(++_0x5e67cb);}(_0x310b,0x10c));var _0xb310=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x310b[_0x4b369d];return _0x571a98;};'use strict';var utils=require(_0xb310('0x0'));exports[_0xb310('0x1')]=function(){utils[_0xb310('0x2')](_0xb310('0x3'));};exports['shutdown']=function(){utils[_0xb310('0x2')](_0xb310('0x4'));};exports[_0xb310('0x5')]=function(){utils[_0xb310('0x2')](_0xb310('0x6'));};exports[_0xb310('0x7')]=function(_0x15de4a){utils[_0xb310('0x7')](_0xb310('0x8'),_0x15de4a);};exports[_0xb310('0x9')]=function(){utils[_0xb310('0x2')](_0xb310('0xa'));};exports[_0xb310('0xb')]=function(_0x2294aa){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 2b2a565..d46d9a1 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 _0xf82d=['calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','[%s][dials][varset]','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','isNil','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf82d,0x13f));var _0xdf82=function(_0x201fb1,_0x3543fd){_0x201fb1=_0x201fb1-0x0;var _0x5d0968=_0xf82d[_0x201fb1];return _0x5d0968;};'use strict';var _=require(_0xdf82('0x0'));var util=require(_0xdf82('0x1'));var utils=require(_0xdf82('0x2'));var dials={};function writeDB(_0x5aa722){utils[_0xdf82('0x3')](util[_0xdf82('0x4')](_0xdf82('0x5'),_0x5aa722[_0xdf82('0x6')],_0x5aa722[_0xdf82('0x7')],_0x5aa722['dialstring'],_0x5aa722['calleridnum'],_0x5aa722[_0xdf82('0x8')],_0x5aa722[_0xdf82('0x9')]));utils[_0xdf82('0xa')](_0xdf82('0xb'),_0x5aa722);delete dials[_0x5aa722['uniqueid']];}exports[_0xdf82('0xc')]=function(_0x537f73){try{utils[_0xdf82('0xd')](util[_0xdf82('0x4')](_0xdf82('0xe'),_0x537f73['uniqueid']),_0x537f73);utils['info'](util[_0xdf82('0x4')](_0xdf82('0xf'),_0x537f73[_0xdf82('0x6')],_0x537f73[_0xdf82('0x10')],_0x537f73[_0xdf82('0x11')]));if(_0x537f73[_0xdf82('0x10')][_0xdf82('0x12')]()==_0xdf82('0x13')&&_[_0xdf82('0x14')](_0x537f73[_0xdf82('0x11')][_0xdf82('0x12')](),'cdr(routeid)')){var _0x905253=_0x537f73['appdata'][_0xdf82('0x15')]('=');dials[_0x537f73[_0xdf82('0x6')]]={'routeId':_0x905253[0x1]};}}catch(_0x479672){utils[_0xdf82('0x16')](util[_0xdf82('0x4')](_0xdf82('0xe'),_0x537f73[_0xdf82('0x6')]),_0x479672);}};exports['varset']=function(_0x274a13){try{utils['debug'](util['format'](_0xdf82('0x17'),_0x274a13[_0xdf82('0x6')]),_0x274a13);if(!_['isNil'](_0x274a13['variable'][_0xdf82('0x18')])){utils[_0xdf82('0x3')](util[_0xdf82('0x4')](_0xdf82('0x19'),_0x274a13[_0xdf82('0x6')],_0x274a13[_0xdf82('0x1a')]));dials[_0x274a13['uniqueid']]={'routeId':_0x274a13[_0xdf82('0x1a')]};}}catch(_0x2fc14a){utils['error'](util[_0xdf82('0x4')](_0xdf82('0x17'),_0x274a13[_0xdf82('0x6')]),_0x2fc14a);}};exports[_0xdf82('0x1b')]=function(_0x3cb5ed){try{if(!_['isNil'](dials[_0x3cb5ed['uniqueid']])){utils['debug'](util[_0xdf82('0x4')](_0xdf82('0x1c'),_0x3cb5ed[_0xdf82('0x6')]),_0x3cb5ed);dials[_0x3cb5ed[_0xdf82('0x6')]]=_[_0xdf82('0x1d')](dials[_0x3cb5ed[_0xdf82('0x6')]],_0x3cb5ed);dials[_0x3cb5ed[_0xdf82('0x6')]][_0xdf82('0x1e')]=utils['now']();dials[_0x3cb5ed['uniqueid']][_0xdf82('0x1f')]=_0xdf82('0x20');utils[_0xdf82('0x3')](util[_0xdf82('0x4')](_0xdf82('0x21'),_0x3cb5ed[_0xdf82('0x6')],dials[_0x3cb5ed['uniqueid']][_0xdf82('0x1e')]));}}catch(_0x5b53cf){utils[_0xdf82('0x16')](util[_0xdf82('0x4')](_0xdf82('0x1c'),_0x3cb5ed[_0xdf82('0x6')]),_0x5b53cf);}};exports[_0xdf82('0x22')]=function(_0x168dea){try{if(!_['isNil'](dials[_0x168dea[_0xdf82('0x6')]])){utils[_0xdf82('0xd')](util[_0xdf82('0x4')]('[%s][dials][dialend]',_0x168dea[_0xdf82('0x6')]),_0x168dea);dials[_0x168dea['uniqueid']]['dialstatus']=_0x168dea['dialstatus'];if(_0x168dea['dialstatus']=='ANSWER'){dials[_0x168dea[_0xdf82('0x6')]]=_['assign'](dials[_0x168dea['uniqueid']],_0x168dea);dials[_0x168dea[_0xdf82('0x6')]][_0xdf82('0x23')]=utils[_0xdf82('0x24')]();dials[_0x168dea[_0xdf82('0x6')]][_0xdf82('0x1f')]=_0xdf82('0x25');utils['info'](util[_0xdf82('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x168dea[_0xdf82('0x6')],_0x168dea[_0xdf82('0x9')],dials[_0x168dea[_0xdf82('0x6')]][_0xdf82('0x23')]));}else{utils[_0xdf82('0x3')](util['format'](_0xdf82('0x26'),_0x168dea[_0xdf82('0x6')],_0x168dea['dialstatus']));}}}catch(_0x598591){utils[_0xdf82('0x16')](util[_0xdf82('0x4')](_0xdf82('0x27'),_0x168dea['uniqueid']),_0x598591);}};exports[_0xdf82('0x28')]=function(_0x45475f){try{if(!_[_0xdf82('0x29')](dials[_0x45475f[_0xdf82('0x6')]])){utils[_0xdf82('0xd')](util[_0xdf82('0x4')](_0xdf82('0x2a'),_0x45475f[_0xdf82('0x6')]),_0x45475f);utils[_0xdf82('0x3')](util['format'](_0xdf82('0x2b'),_0x45475f['uniqueid'],_0x45475f[_0xdf82('0x2c')],_0x45475f[_0xdf82('0x2d')],_0x45475f[_0xdf82('0x2e')]));dials[_0x45475f[_0xdf82('0x6')]]=_['assign'](dials[_0x45475f[_0xdf82('0x6')]],{'endtime':utils[_0xdf82('0x24')](),'lastevent':'complete'});dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x2f')]=utils[_0xdf82('0x30')](dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x31')],dials[_0x45475f['uniqueid']]['starttime']);dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x32')]=utils[_0xdf82('0x30')](dials[_0x45475f['uniqueid']][_0xdf82('0x23')]||dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x31')],dials[_0x45475f[_0xdf82('0x6')]]['starttime']);dials[_0x45475f['uniqueid']][_0xdf82('0x33')]=dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x23')]?utils[_0xdf82('0x30')](dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x31')],dials[_0x45475f['uniqueid']][_0xdf82('0x23')]):0x0;writeDB(dials[_0x45475f[_0xdf82('0x6')]]);}}catch(_0x1122f6){utils[_0xdf82('0x16')](util[_0xdf82('0x4')](_0xdf82('0x2a'),_0x45475f['uniqueid']),_0x1122f6);}}; \ No newline at end of file +var _0x1ea0=['lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','application','appdata','toLowerCase','startsWith','[%s][dials][newexten]','debug','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','endtime','holdtime','diffTime'];(function(_0x3b95e2,_0x3d2dfb){var _0x1191c4=function(_0x4a18b3){while(--_0x4a18b3){_0x3b95e2['push'](_0x3b95e2['shift']());}};_0x1191c4(++_0x3d2dfb);}(_0x1ea0,0x1e0));var _0x01ea=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1ea0[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x01ea('0x0'));var util=require(_0x01ea('0x1'));var utils=require(_0x01ea('0x2'));var dials={};function writeDB(_0x1ea48d){utils[_0x01ea('0x3')](util[_0x01ea('0x4')](_0x01ea('0x5'),_0x1ea48d[_0x01ea('0x6')],_0x1ea48d[_0x01ea('0x7')],_0x1ea48d[_0x01ea('0x8')],_0x1ea48d[_0x01ea('0x9')],_0x1ea48d[_0x01ea('0xa')],_0x1ea48d[_0x01ea('0xb')]));utils['request'](_0x01ea('0xc'),_0x1ea48d);delete dials[_0x1ea48d[_0x01ea('0x6')]];}exports[_0x01ea('0xd')]=function(_0x14acd0){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x14acd0[_0x01ea('0x6')]),_0x14acd0);utils[_0x01ea('0x3')](util[_0x01ea('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x14acd0[_0x01ea('0x6')],_0x14acd0[_0x01ea('0xe')],_0x14acd0[_0x01ea('0xf')]));if(_0x14acd0[_0x01ea('0xe')][_0x01ea('0x10')]()=='set'&&_[_0x01ea('0x11')](_0x14acd0[_0x01ea('0xf')]['toLowerCase'](),'cdr(routeid)')){var _0x41b2f1=_0x14acd0[_0x01ea('0xf')]['split']('=');dials[_0x14acd0[_0x01ea('0x6')]]={'routeId':_0x41b2f1[0x1]};}}catch(_0x5a2a87){utils['error'](util['format'](_0x01ea('0x12'),_0x14acd0[_0x01ea('0x6')]),_0x5a2a87);}};exports['varset']=function(_0x2fa0bb){try{utils[_0x01ea('0x13')](util['format']('[%s][dials][varset]',_0x2fa0bb[_0x01ea('0x6')]),_0x2fa0bb);if(!_[_0x01ea('0x14')](_0x2fa0bb[_0x01ea('0x15')][_0x01ea('0x16')])){utils[_0x01ea('0x3')](util['format'](_0x01ea('0x17'),_0x2fa0bb['uniqueid'],_0x2fa0bb[_0x01ea('0x18')]));dials[_0x2fa0bb[_0x01ea('0x6')]]={'routeId':_0x2fa0bb[_0x01ea('0x18')]};}}catch(_0x58a82d){utils['error'](util[_0x01ea('0x4')]('[%s][dials][varset]',_0x2fa0bb[_0x01ea('0x6')]),_0x58a82d);}};exports[_0x01ea('0x19')]=function(_0x557c58){try{if(!_[_0x01ea('0x14')](dials[_0x557c58[_0x01ea('0x6')]])){utils[_0x01ea('0x13')](util[_0x01ea('0x4')](_0x01ea('0x1a'),_0x557c58[_0x01ea('0x6')]),_0x557c58);dials[_0x557c58[_0x01ea('0x6')]]=_[_0x01ea('0x1b')](dials[_0x557c58[_0x01ea('0x6')]],_0x557c58);dials[_0x557c58[_0x01ea('0x6')]][_0x01ea('0x1c')]=utils[_0x01ea('0x1d')]();dials[_0x557c58[_0x01ea('0x6')]][_0x01ea('0x1e')]=_0x01ea('0x1f');utils['info'](util[_0x01ea('0x4')](_0x01ea('0x20'),_0x557c58[_0x01ea('0x6')],dials[_0x557c58[_0x01ea('0x6')]][_0x01ea('0x1c')]));}}catch(_0xfb1915){utils[_0x01ea('0x21')](util[_0x01ea('0x4')]('[%s][dials][dialbegin]',_0x557c58[_0x01ea('0x6')]),_0xfb1915);}};exports[_0x01ea('0x22')]=function(_0x14025f){try{if(!_['isNil'](dials[_0x14025f[_0x01ea('0x6')]])){utils[_0x01ea('0x13')](util[_0x01ea('0x4')](_0x01ea('0x23'),_0x14025f[_0x01ea('0x6')]),_0x14025f);dials[_0x14025f['uniqueid']][_0x01ea('0xb')]=_0x14025f[_0x01ea('0xb')];if(_0x14025f['dialstatus']==_0x01ea('0x24')){dials[_0x14025f[_0x01ea('0x6')]]=_[_0x01ea('0x1b')](dials[_0x14025f[_0x01ea('0x6')]],_0x14025f);dials[_0x14025f[_0x01ea('0x6')]][_0x01ea('0x25')]=utils[_0x01ea('0x1d')]();dials[_0x14025f[_0x01ea('0x6')]][_0x01ea('0x1e')]=_0x01ea('0x26');utils[_0x01ea('0x3')](util[_0x01ea('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x14025f[_0x01ea('0x6')],_0x14025f['dialstatus'],dials[_0x14025f[_0x01ea('0x6')]][_0x01ea('0x25')]));}else{utils[_0x01ea('0x3')](util[_0x01ea('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x14025f[_0x01ea('0x6')],_0x14025f[_0x01ea('0xb')]));}}}catch(_0x1a6692){utils['error'](util[_0x01ea('0x4')](_0x01ea('0x23'),_0x14025f['uniqueid']),_0x1a6692);}};exports[_0x01ea('0x27')]=function(_0x186a0e){try{if(!_['isNil'](dials[_0x186a0e['uniqueid']])){utils[_0x01ea('0x13')](util[_0x01ea('0x4')](_0x01ea('0x28'),_0x186a0e['uniqueid']),_0x186a0e);utils['info'](util[_0x01ea('0x4')](_0x01ea('0x29'),_0x186a0e[_0x01ea('0x6')],_0x186a0e[_0x01ea('0x9')],_0x186a0e['calleridname'],_0x186a0e[_0x01ea('0x2a')]));dials[_0x186a0e[_0x01ea('0x6')]]=_[_0x01ea('0x1b')](dials[_0x186a0e[_0x01ea('0x6')]],{'endtime':utils[_0x01ea('0x1d')](),'lastevent':_0x01ea('0x2b')});dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x2c')]=utils['diffTime'](dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x2d')],dials[_0x186a0e[_0x01ea('0x6')]]['starttime']);dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x2e')]=utils['diffTime'](dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x25')]||dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x2d')],dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x1c')]);dials[_0x186a0e[_0x01ea('0x6')]]['billableseconds']=dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x25')]?utils[_0x01ea('0x2f')](dials[_0x186a0e['uniqueid']][_0x01ea('0x2d')],dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x25')]):0x0;writeDB(dials[_0x186a0e[_0x01ea('0x6')]]);}}catch(_0x22c5f0){utils[_0x01ea('0x21')](util[_0x01ea('0x4')](_0x01ea('0x28'),_0x186a0e['uniqueid']),_0x22c5f0);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index e9126a6..32116cc 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 _0x513f=['[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','production','local','asterisk','username','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]'];(function(_0x8895d8,_0x397458){var _0x16144b=function(_0x3d70ce){while(--_0x3d70ce){_0x8895d8['push'](_0x8895d8['shift']());}};_0x16144b(++_0x397458);}(_0x513f,0x13c));var _0xf513=function(_0x3b22e6,_0x3acc05){_0x3b22e6=_0x3b22e6-0x0;var _0x3809b0=_0x513f[_0x3b22e6];return _0x3809b0;};var AsteriskManager=require(_0xf513('0x0'));var config=require(_0xf513('0x1'));var utils=require('./utils');var util=require(_0xf513('0x2'));var isXDREnabled=config[_0xf513('0x3')]&&config[_0xf513('0x3')][_0xf513('0x4')]?!config[_0xf513('0x3')][_0xf513('0x4')]:!![];var isProduction=config[_0xf513('0x5')]===_0xf513('0x6')||![];var isLocalAsterisk=config[_0xf513('0x3')]&&config[_0xf513('0x3')][_0xf513('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xf513('0x8')]['port'],config[_0xf513('0x8')]['ip'],config['asterisk'][_0xf513('0x9')],config[_0xf513('0x8')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xf513('0xa')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xf513('0xa')](_0xf513('0xb'));}else{var agents=require(_0xf513('0xc'));var calls=require(_0xf513('0xd'));var queues=require('./queues.controller');var recordings=require(_0xf513('0xe'));var members=require(_0xf513('0xf'));var dials=require(_0xf513('0x10'));var transfers=require(_0xf513('0x11'));var core=require(_0xf513('0x12'));ami['on'](_0xf513('0x13'),core[_0xf513('0x13')]);ami['on'](_0xf513('0x14'),core[_0xf513('0x14')]);ami['on'](_0xf513('0x15'),core[_0xf513('0x15')]);ami['on'](_0xf513('0x16'),core[_0xf513('0x16')]);ami['on'](_0xf513('0x17'),core[_0xf513('0x17')]);ami['on'](_0xf513('0x18'),core[_0xf513('0x18')]);ami['on'](_0xf513('0x19'),function(_0x139b6a){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x1c'),_0x139b6a['device']),_0x139b6a);members[_0xf513('0x19')](_0x139b6a);}catch(_0x5c7034){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x1c'),_0x139b6a['device']),_0x5c7034);}});ami['on']('agentcalled',function(_0xded58a){try{utils['debug'](util[_0xf513('0x1b')](_0xf513('0x1d'),_0xded58a[_0xf513('0x1e')]),_0xded58a);agents[_0xf513('0x1f')](_0xded58a);}catch(_0x3a5d9e){utils['error'](util[_0xf513('0x1b')](_0xf513('0x1d'),_0xded58a[_0xf513('0x1e')]),_0x3a5d9e);}});ami['on'](_0xf513('0x20'),function(_0x313d40){try{utils[_0xf513('0x1a')](util['format'](_0xf513('0x21'),_0x313d40['uniqueid']),_0x313d40);agents[_0xf513('0x20')](_0x313d40);}catch(_0x4410d9){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x21'),_0x313d40[_0xf513('0x1e')]),_0x4410d9);}});ami['on'](_0xf513('0x22'),function(_0x25e8c3){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')]('[%s][index][agentconnect]',_0x25e8c3[_0xf513('0x1e')]),_0x25e8c3);agents[_0xf513('0x22')](_0x25e8c3);queues[_0xf513('0x22')](_0x25e8c3);}catch(_0x5c7f3a){utils['error'](util[_0xf513('0x1b')](_0xf513('0x23'),_0x25e8c3['uniqueid']),_0x5c7f3a);}});ami['on'](_0xf513('0x24'),function(_0x1b27f3){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x25'),_0x1b27f3[_0xf513('0x1e')]),_0x1b27f3);agents['agentcomplete'](_0x1b27f3);queues[_0xf513('0x24')](_0x1b27f3);members[_0xf513('0x24')](_0x1b27f3);}catch(_0x3cc9a1){utils[_0xf513('0x16')](util['format'](_0xf513('0x25'),_0x1b27f3[_0xf513('0x1e')]),_0x3cc9a1);}});ami['on'](_0xf513('0x26'),function(_0x1b805a){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')]('[%s][index][queuecallerabandon]',_0x1b805a['uniqueid']),_0x1b805a);agents['queuecallerabandon'](_0x1b805a);queues[_0xf513('0x26')](_0x1b805a);}catch(_0x27ebb6){utils[_0xf513('0x16')](util['format'](_0xf513('0x27'),_0x1b805a['uniqueid']),_0x27ebb6);}});ami['on']('queuecallerjoin',function(_0x2845df){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')]('[%s][index][queuecallerjoin]',_0x2845df['uniqueid']),_0x2845df);queues[_0xf513('0x28')](_0x2845df);recordings[_0xf513('0x28')](_0x2845df);}catch(_0x3fdc26){utils['error'](util[_0xf513('0x1b')](_0xf513('0x29'),_0x2845df[_0xf513('0x1e')]),_0x3fdc26);}});ami['on'](_0xf513('0x2a'),function(_0x144cfb){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x2b'),_0x144cfb['uniqueid']),_0x144cfb);queues[_0xf513('0x2a')](_0x144cfb);}catch(_0x410789){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x2b'),_0x144cfb['uniqueid']),_0x410789);}});ami['on'](_0xf513('0x2c'),function(_0x3f4755){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x2d'),_0x3f4755[_0xf513('0x1e')]),_0x3f4755);queues[_0xf513('0x2c')](_0x3f4755);calls[_0xf513('0x2c')](_0x3f4755);}catch(_0x5dd220){utils[_0xf513('0x16')](util['format'](_0xf513('0x2d'),_0x3f4755[_0xf513('0x1e')]),_0x5dd220);}});ami['on'](_0xf513('0x2e'),function(_0x223de2){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x2f'),_0x223de2[_0xf513('0x1e')]),_0x223de2);queues[_0xf513('0x2e')](_0x223de2);calls[_0xf513('0x2e')](_0x223de2);}catch(_0x59142b){utils[_0xf513('0x16')](util[_0xf513('0x1b')]('[%s][index][musiconholdstop]',_0x223de2[_0xf513('0x1e')]),_0x59142b);}});ami['on']('newstate',function(_0x362e09){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x30'),_0x362e09[_0xf513('0x1e')]),_0x362e09);calls[_0xf513('0x31')](_0x362e09);recordings[_0xf513('0x31')](_0x362e09);}catch(_0x32b5b7){utils[_0xf513('0x16')](util[_0xf513('0x1b')]('[%s][index][newstate]',_0x362e09[_0xf513('0x1e')]),_0x32b5b7);}});ami['on'](_0xf513('0x32'),function(_0x252fd8){try{utils['debug'](util[_0xf513('0x1b')]('[%s][index][hangup]',_0x252fd8[_0xf513('0x1e')]),_0x252fd8);calls[_0xf513('0x32')](_0x252fd8);recordings[_0xf513('0x32')](_0x252fd8);dials[_0xf513('0x32')](_0x252fd8);agents[_0xf513('0x32')](_0x252fd8);queues[_0xf513('0x32')](_0x252fd8);}catch(_0x2c4dbf){utils['error'](util[_0xf513('0x1b')](_0xf513('0x33'),_0x252fd8['uniqueid']),_0x2c4dbf);}});ami['on'](_0xf513('0x34'),function(_0x3ede9e){try{utils['debug'](util[_0xf513('0x1b')](_0xf513('0x35'),_0x3ede9e['uniqueid']),_0x3ede9e);members[_0xf513('0x34')](_0x3ede9e);}catch(_0x1ded9a){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x35'),_0x3ede9e[_0xf513('0x1e')]),_0x1ded9a);}});ami['on'](_0xf513('0x36'),function(_0x5d3b66){try{utils['debug'](util[_0xf513('0x1b')](_0xf513('0x37'),_0x5d3b66[_0xf513('0x1e')]),_0x5d3b66);queues[_0xf513('0x36')](_0x5d3b66);agents['blindtransfer'](_0x5d3b66);transfers['blindtransfer'](_0x5d3b66);}catch(_0x21f167){utils['error'](util['format'](_0xf513('0x37'),_0x5d3b66[_0xf513('0x1e')]),_0x21f167);}});ami['on']('attendedtransfer',function(_0x256e0e){try{utils['debug'](util[_0xf513('0x1b')]('[%s][index][attendedtransfer]',_0x256e0e['origtransfereruniqueid']),_0x256e0e);queues[_0xf513('0x38')](_0x256e0e);transfers[_0xf513('0x38')](_0x256e0e);agents[_0xf513('0x38')](_0x256e0e);calls[_0xf513('0x38')](_0x256e0e);}catch(_0x397816){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x39'),_0x256e0e[_0xf513('0x3a')]),_0x397816);}});ami['on'](_0xf513('0x3b'),function(_0x524d7f){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x3c'),_0x524d7f[_0xf513('0x1e')]),_0x524d7f);queues[_0xf513('0x3b')](_0x524d7f);recordings[_0xf513('0x3b')](_0x524d7f);calls[_0xf513('0x3b')](_0x524d7f);dials['varset'](_0x524d7f);}catch(_0x5b03e3){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x3c'),_0x524d7f[_0xf513('0x1e')]),_0x5b03e3);}});ami['on'](_0xf513('0x3d'),function(_0x2addf9){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x3e'),_0x2addf9[_0xf513('0x1e')]),_0x2addf9);calls['newexten'](_0x2addf9);recordings[_0xf513('0x3d')](_0x2addf9);dials[_0xf513('0x3d')](_0x2addf9);}catch(_0x22b09b){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x3e'),_0x2addf9[_0xf513('0x1e')]),_0x22b09b);}});ami['on']('newchannel',function(_0x58cc25){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x3f'),_0x58cc25[_0xf513('0x1e')]),_0x58cc25);calls[_0xf513('0x40')](_0x58cc25);recordings['newchannel'](_0x58cc25);}catch(_0x504481){utils['error'](util['format']('[%s][index][newchannel]',_0x58cc25[_0xf513('0x1e')]),_0x504481);}});ami['on']('dialbegin',function(_0x318e93){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x41'),_0x318e93['uniqueid']),_0x318e93);dials[_0xf513('0x42')](_0x318e93);}catch(_0x1ca99c){utils['error'](util['format']('[%s]dialbegin',_0x318e93[_0xf513('0x1e')]),_0x1ca99c);}});ami['on'](_0xf513('0x43'),function(_0x427760){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')]('[%s][index][dialend]',_0x427760[_0xf513('0x1e')]),_0x427760);dials[_0xf513('0x43')](_0x427760);}catch(_0x262346){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x44'),_0x427760[_0xf513('0x1e')]),_0x262346);}});} \ No newline at end of file +var _0x748b=['[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','device','devicestatechange','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentconnect','debug','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','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','varset','[%s][index][varset]'];(function(_0x42e9b4,_0x5819f2){var _0x2d836a=function(_0x362d3c){while(--_0x362d3c){_0x42e9b4['push'](_0x42e9b4['shift']());}};_0x2d836a(++_0x5819f2);}(_0x748b,0x1f2));var _0xb748=function(_0x2474cb,_0x5bdeba){_0x2474cb=_0x2474cb-0x0;var _0x42c824=_0x748b[_0x2474cb];return _0x42c824;};var AsteriskManager=require(_0xb748('0x0'));var config=require(_0xb748('0x1'));var utils=require(_0xb748('0x2'));var util=require(_0xb748('0x3'));var isXDREnabled=config[_0xb748('0x4')]&&config['xdr'][_0xb748('0x5')]?!config[_0xb748('0x4')][_0xb748('0x5')]:!![];var isProduction=config['env']===_0xb748('0x6')||![];var isLocalAsterisk=config[_0xb748('0x4')]&&config[_0xb748('0x4')][_0xb748('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xb748('0x8')][_0xb748('0x9')],config[_0xb748('0x8')]['ip'],config[_0xb748('0x8')][_0xb748('0xa')],config[_0xb748('0x8')][_0xb748('0xb')],!![]);ami[_0xb748('0xc')]();if(!isXDREnabled){utils[_0xb748('0xd')](_0xb748('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xb748('0xd')](_0xb748('0xf'));}else{var agents=require(_0xb748('0x10'));var calls=require('./calls.controller');var queues=require(_0xb748('0x11'));var recordings=require(_0xb748('0x12'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xb748('0x13'));var core=require(_0xb748('0x14'));ami['on'](_0xb748('0x15'),core[_0xb748('0x15')]);ami['on'](_0xb748('0x16'),core[_0xb748('0x16')]);ami['on'](_0xb748('0x17'),core[_0xb748('0x17')]);ami['on']('error',core[_0xb748('0x18')]);ami['on'](_0xb748('0x19'),core[_0xb748('0x19')]);ami['on'](_0xb748('0x1a'),core[_0xb748('0x1a')]);ami['on']('devicestatechange',function(_0x5705b3){try{utils['debug'](util[_0xb748('0x1b')]('[%s][index][devicestatechange]',_0x5705b3[_0xb748('0x1c')]),_0x5705b3);members[_0xb748('0x1d')](_0x5705b3);}catch(_0x3ab81d){utils['error'](util[_0xb748('0x1b')](_0xb748('0x1e'),_0x5705b3[_0xb748('0x1c')]),_0x3ab81d);}});ami['on'](_0xb748('0x1f'),function(_0x3726b2){try{utils['debug'](util['format'](_0xb748('0x20'),_0x3726b2[_0xb748('0x21')]),_0x3726b2);agents[_0xb748('0x1f')](_0x3726b2);}catch(_0xdae21f){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x20'),_0x3726b2[_0xb748('0x21')]),_0xdae21f);}});ami['on']('agentringnoanswer',function(_0x2b4a31){try{utils['debug'](util[_0xb748('0x1b')](_0xb748('0x22'),_0x2b4a31[_0xb748('0x21')]),_0x2b4a31);agents['agentringnoanswer'](_0x2b4a31);}catch(_0x47e866){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x22'),_0x2b4a31[_0xb748('0x21')]),_0x47e866);}});ami['on'](_0xb748('0x23'),function(_0x4d27c9){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x25'),_0x4d27c9[_0xb748('0x21')]),_0x4d27c9);agents[_0xb748('0x23')](_0x4d27c9);queues[_0xb748('0x23')](_0x4d27c9);}catch(_0x3975a4){utils[_0xb748('0x18')](util['format'](_0xb748('0x25'),_0x4d27c9[_0xb748('0x21')]),_0x3975a4);}});ami['on'](_0xb748('0x26'),function(_0x144428){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x27'),_0x144428[_0xb748('0x21')]),_0x144428);agents[_0xb748('0x26')](_0x144428);queues[_0xb748('0x26')](_0x144428);members[_0xb748('0x26')](_0x144428);}catch(_0x249a35){utils[_0xb748('0x18')](util['format'](_0xb748('0x27'),_0x144428['uniqueid']),_0x249a35);}});ami['on']('queuecallerabandon',function(_0x37023b){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x28'),_0x37023b['uniqueid']),_0x37023b);agents['queuecallerabandon'](_0x37023b);queues['queuecallerabandon'](_0x37023b);}catch(_0x287761){utils['error'](util['format']('[%s][index][queuecallerabandon]',_0x37023b[_0xb748('0x21')]),_0x287761);}});ami['on']('queuecallerjoin',function(_0x7006be){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x29'),_0x7006be['uniqueid']),_0x7006be);queues['queuecallerjoin'](_0x7006be);recordings[_0xb748('0x2a')](_0x7006be);}catch(_0x268f02){utils['error'](util['format'](_0xb748('0x29'),_0x7006be[_0xb748('0x21')]),_0x268f02);}});ami['on'](_0xb748('0x2b'),function(_0x110503){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x2c'),_0x110503[_0xb748('0x21')]),_0x110503);queues[_0xb748('0x2b')](_0x110503);}catch(_0x3a83ec){utils[_0xb748('0x18')](util[_0xb748('0x1b')]('[%s][index][queuecallerleave]',_0x110503[_0xb748('0x21')]),_0x3a83ec);}});ami['on']('musiconholdstart',function(_0x539a77){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')]('[%s][index][musiconholdstart]',_0x539a77[_0xb748('0x21')]),_0x539a77);queues[_0xb748('0x2d')](_0x539a77);calls['musiconholdstart'](_0x539a77);}catch(_0x48b825){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x2e'),_0x539a77[_0xb748('0x21')]),_0x48b825);}});ami['on'](_0xb748('0x2f'),function(_0x24e9a5){try{utils[_0xb748('0x24')](util['format'](_0xb748('0x30'),_0x24e9a5[_0xb748('0x21')]),_0x24e9a5);queues[_0xb748('0x2f')](_0x24e9a5);calls[_0xb748('0x2f')](_0x24e9a5);}catch(_0x216878){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x30'),_0x24e9a5[_0xb748('0x21')]),_0x216878);}});ami['on'](_0xb748('0x31'),function(_0xcd780c){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x32'),_0xcd780c['uniqueid']),_0xcd780c);calls[_0xb748('0x31')](_0xcd780c);recordings['newstate'](_0xcd780c);}catch(_0x274f8b){utils['error'](util[_0xb748('0x1b')](_0xb748('0x32'),_0xcd780c[_0xb748('0x21')]),_0x274f8b);}});ami['on'](_0xb748('0x33'),function(_0x5e8b8c){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x34'),_0x5e8b8c[_0xb748('0x21')]),_0x5e8b8c);calls[_0xb748('0x33')](_0x5e8b8c);recordings[_0xb748('0x33')](_0x5e8b8c);dials[_0xb748('0x33')](_0x5e8b8c);agents[_0xb748('0x33')](_0x5e8b8c);queues[_0xb748('0x33')](_0x5e8b8c);}catch(_0x34c6f4){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x34'),_0x5e8b8c['uniqueid']),_0x34c6f4);}});ami['on']('cdr',function(_0x100370){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')]('[%s][index][cdr]',_0x100370[_0xb748('0x21')]),_0x100370);members[_0xb748('0x35')](_0x100370);}catch(_0x98126f){utils[_0xb748('0x18')](util['format'](_0xb748('0x36'),_0x100370['uniqueid']),_0x98126f);}});ami['on'](_0xb748('0x37'),function(_0x5b1b75){try{utils[_0xb748('0x24')](util['format'](_0xb748('0x38'),_0x5b1b75[_0xb748('0x21')]),_0x5b1b75);queues[_0xb748('0x37')](_0x5b1b75);agents[_0xb748('0x37')](_0x5b1b75);transfers['blindtransfer'](_0x5b1b75);}catch(_0x5e7857){utils[_0xb748('0x18')](util[_0xb748('0x1b')]('[%s][index][blindtransfer]',_0x5b1b75[_0xb748('0x21')]),_0x5e7857);}});ami['on'](_0xb748('0x39'),function(_0x384022){try{utils['debug'](util[_0xb748('0x1b')](_0xb748('0x3a'),_0x384022[_0xb748('0x3b')]),_0x384022);queues[_0xb748('0x39')](_0x384022);transfers[_0xb748('0x39')](_0x384022);agents['attendedtransfer'](_0x384022);calls[_0xb748('0x39')](_0x384022);}catch(_0x485890){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x3a'),_0x384022[_0xb748('0x3b')]),_0x485890);}});ami['on'](_0xb748('0x3c'),function(_0x8c080){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x3d'),_0x8c080[_0xb748('0x21')]),_0x8c080);queues[_0xb748('0x3c')](_0x8c080);recordings['varset'](_0x8c080);calls[_0xb748('0x3c')](_0x8c080);dials[_0xb748('0x3c')](_0x8c080);}catch(_0x5c1944){utils[_0xb748('0x18')](util['format'](_0xb748('0x3d'),_0x8c080[_0xb748('0x21')]),_0x5c1944);}});ami['on']('newexten',function(_0x11a1f4){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x3e'),_0x11a1f4['uniqueid']),_0x11a1f4);calls[_0xb748('0x3f')](_0x11a1f4);recordings[_0xb748('0x3f')](_0x11a1f4);dials['newexten'](_0x11a1f4);}catch(_0x2ad6b7){utils[_0xb748('0x18')](util['format']('[%s][index][newexten]',_0x11a1f4[_0xb748('0x21')]),_0x2ad6b7);}});ami['on']('newchannel',function(_0x240ae6){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x40'),_0x240ae6[_0xb748('0x21')]),_0x240ae6);calls[_0xb748('0x41')](_0x240ae6);recordings['newchannel'](_0x240ae6);}catch(_0x260e01){utils[_0xb748('0x18')](util['format'](_0xb748('0x40'),_0x240ae6[_0xb748('0x21')]),_0x260e01);}});ami['on'](_0xb748('0x42'),function(_0x5a821d){try{utils['debug'](util[_0xb748('0x1b')]('[%s][index][dialbegin]',_0x5a821d[_0xb748('0x21')]),_0x5a821d);dials[_0xb748('0x42')](_0x5a821d);}catch(_0x584030){utils['error'](util[_0xb748('0x1b')](_0xb748('0x43'),_0x5a821d[_0xb748('0x21')]),_0x584030);}});ami['on'](_0xb748('0x44'),function(_0x2586a3){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x45'),_0x2586a3[_0xb748('0x21')]),_0x2586a3);dials[_0xb748('0x44')](_0x2586a3);}catch(_0x5f2e70){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x45'),_0x2586a3[_0xb748('0x21')]),_0x5f2e70);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index bcb57ff..10f1650 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 _0x14ac=['getUserByName','then','request','catch','error','[%s][members][writeDB]','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','diffTime','agentcomplete','[%s][members][agentcomplete]','queue','channel','assign','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','[%s][members][cdr]','util','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','name','internal','CreateMemberReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14ac,0x13b));var _0xc14a=function(_0x2e51f9,_0x320019){_0x2e51f9=_0x2e51f9-0x0;var _0xb560e3=_0x14ac[_0x2e51f9];return _0xb560e3;};'use strict';var _=require('lodash');var util=require(_0xc14a('0x0'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0xc14a('0x1')];function writeDB(_0x234a77){utils[_0xc14a('0x2')](util[_0xc14a('0x3')](_0xc14a('0x4'),_0x234a77[_0xc14a('0x5')],_0x234a77[_0xc14a('0x6')],_0x234a77['channel'],_0x234a77[_0xc14a('0x7')],_0x234a77[_0xc14a('0x8')],_0x234a77[_0xc14a('0x9')]));if(_0x234a77[_0xc14a('0x6')]){utils[_0xc14a('0xa')](_0x234a77[_0xc14a('0x6')])['then'](function(_0x6f7e14){if(_0x6f7e14){_0x234a77['membername']=_0x6f7e14[_0xc14a('0xb')];_0x234a77['internal']=_0x6f7e14[_0xc14a('0xc')];utils['request'](_0xc14a('0xd'),_0x234a77);}else{utils[_0xc14a('0xe')](_0x234a77['interface']['split']('/')[0x1])[_0xc14a('0xf')](function(_0x4399c9){if(_0x4399c9){_0x234a77[_0xc14a('0x8')]=_0x4399c9['name'];_0x234a77[_0xc14a('0xc')]=_0x4399c9[_0xc14a('0xc')];utils[_0xc14a('0x10')](_0xc14a('0xd'),_0x234a77);}});}})[_0xc14a('0x11')](function(_0x50ca6a){utils[_0xc14a('0x12')](util['format'](_0xc14a('0x13'),_0x234a77[_0xc14a('0x5')]),_0x50ca6a);});}delete members[_0x234a77['interface']];}function startsWith(_0x5e836a,_0x2dd203){return _['some'](_0x5e836a,function(_0x23f59b){return _[_0xc14a('0x14')](_0x2dd203,_0x23f59b);});}exports['devicestatechange']=function(_0x55b0d6){try{utils[_0xc14a('0x15')](util[_0xc14a('0x3')](_0xc14a('0x16'),members[_0x55b0d6[_0xc14a('0x17')]]?members[_0x55b0d6[_0xc14a('0x17')]][_0xc14a('0x5')]:_0x55b0d6[_0xc14a('0x17')]),_0x55b0d6);utils[_0xc14a('0x2')](util[_0xc14a('0x3')](_0xc14a('0x18'),members[_0x55b0d6[_0xc14a('0x17')]]?members[_0x55b0d6['device']][_0xc14a('0x5')]:_0x55b0d6['device'],_0x55b0d6[_0xc14a('0x19')],_0x55b0d6[_0xc14a('0x17')]));switch(_0x55b0d6[_0xc14a('0x19')]){case'INUSE':case _0xc14a('0x1a'):if(!startsWith(exclude,_0x55b0d6[_0xc14a('0x17')])){members[_0x55b0d6[_0xc14a('0x17')]]={'channel':_0xc14a('0x1b'),'interface':_0x55b0d6[_0xc14a('0x17')],'type':'TALKING','enterAt':utils[_0xc14a('0x1c')](),'role':_0xc14a('0x1d')};}break;case _0xc14a('0x1e'):if(!_[_0xc14a('0x1f')](members[_0x55b0d6['device']])){members[_0x55b0d6[_0xc14a('0x17')]][_0xc14a('0x20')]=utils[_0xc14a('0x1c')]();members[_0x55b0d6['device']]['duration']=utils[_0xc14a('0x21')](members[_0x55b0d6[_0xc14a('0x17')]][_0xc14a('0x20')],members[_0x55b0d6[_0xc14a('0x17')]]['enterAt']);if(members[_0x55b0d6['device']][_0xc14a('0x5')]){writeDB(members[_0x55b0d6[_0xc14a('0x17')]]);}}break;default:break;}}catch(_0x42a0b1){utils[_0xc14a('0x12')](util['format']('[%s][members][devicestatechange]',members[_0x55b0d6[_0xc14a('0x17')]]?members[_0x55b0d6[_0xc14a('0x17')]][_0xc14a('0x5')]:_0x55b0d6[_0xc14a('0x17')]),_0x42a0b1);}};exports[_0xc14a('0x22')]=function(_0x8aef2a){try{if(!_[_0xc14a('0x1f')](members[_0x8aef2a[_0xc14a('0x6')]])){utils[_0xc14a('0x15')](util[_0xc14a('0x3')](_0xc14a('0x23'),_0x8aef2a[_0xc14a('0x5')]),_0x8aef2a);utils[_0xc14a('0x2')](util[_0xc14a('0x3')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x8aef2a[_0xc14a('0x5')],_0x8aef2a[_0xc14a('0x6')],_0x8aef2a[_0xc14a('0x24')]));members[_0x8aef2a[_0xc14a('0x6')]]=_['assign'](members[_0x8aef2a[_0xc14a('0x6')]],{'data4':_0x8aef2a[_0xc14a('0x24')],'uniqueid':_0x8aef2a[_0xc14a('0x5')]});}}catch(_0x22c1c4){utils[_0xc14a('0x12')](util['format'](_0xc14a('0x23'),_0x8aef2a[_0xc14a('0x5')]),_0x22c1c4);}};exports['cdr']=function(_0x155e2){try{utils[_0xc14a('0x15')](util['format']('[%s][members][cdr]',_0x155e2[_0xc14a('0x5')]),_0x155e2);if(_0x155e2[_0xc14a('0x25')]){var _0x313aaa=_0x155e2['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x313aaa])){members[_0x313aaa]=_[_0xc14a('0x26')](members[_0x313aaa],{'data1':members[_0x313aaa][_0xc14a('0x27')]||_0x155e2[_0xc14a('0x9')],'data2':members[_0x313aaa][_0xc14a('0x7')]||_0x155e2[_0xc14a('0x28')],'data3':members[_0x313aaa][_0xc14a('0x29')]||_0x155e2[_0xc14a('0x2a')],'uniqueid':members[_0x313aaa]['uniqueid']||_0x155e2['uniqueid']});utils[_0xc14a('0x2')](util[_0xc14a('0x3')](_0xc14a('0x2b'),_0x155e2[_0xc14a('0x5')],members[_0x313aaa][_0xc14a('0x27')],members[_0x313aaa]['data2'],members[_0x313aaa][_0xc14a('0x29')]));if(members[_0x313aaa][_0xc14a('0x20')]){writeDB(members[_0x313aaa]);}}}if(_0x155e2[_0xc14a('0x2c')]){var _0x14ddcb=_0x155e2[_0xc14a('0x2c')][_0xc14a('0x2d')]('-')[0x0];if(!_['isNil'](members[_0x14ddcb])){members[_0x14ddcb]=_[_0xc14a('0x26')](members[_0x14ddcb],{'data1':members[_0x14ddcb]['data1']||_0x155e2[_0xc14a('0x9')],'data2':members[_0x14ddcb]['data2']||_0x155e2[_0xc14a('0x28')],'data3':members[_0x14ddcb]['data3']||_0x155e2['destination'],'uniqueid':members[_0x14ddcb][_0xc14a('0x5')]||_0x155e2[_0xc14a('0x5')]});utils['info'](util[_0xc14a('0x3')](_0xc14a('0x2b'),_0x155e2[_0xc14a('0x5')],members[_0x14ddcb][_0xc14a('0x27')],members[_0x14ddcb]['data2'],members[_0x14ddcb][_0xc14a('0x29')]));if(members[_0x14ddcb]['exitAt']){writeDB(members[_0x14ddcb]);}}}}catch(_0x3610ed){utils[_0xc14a('0x12')](util[_0xc14a('0x3')](_0xc14a('0x2e'),_0x155e2[_0xc14a('0x5')]),_0x3610ed);}}; \ No newline at end of file +var _0x5a89=['data1','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','destination','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','device','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','cdr','[%s][members][cdr]'];(function(_0x2fd3e8,_0x1c8ea9){var _0x46f0ee=function(_0x43274c){while(--_0x43274c){_0x2fd3e8['push'](_0x2fd3e8['shift']());}};_0x46f0ee(++_0x1c8ea9);}(_0x5a89,0x6a));var _0x95a8=function(_0x1a1036,_0x184bfb){_0x1a1036=_0x1a1036-0x0;var _0x2efad9=_0x5a89[_0x1a1036];return _0x2efad9;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x95a8('0x0'));var members={};var exclude=['Local/_attended@transfer',_0x95a8('0x1')];function writeDB(_0x27b97e){utils[_0x95a8('0x2')](util[_0x95a8('0x3')](_0x95a8('0x4'),_0x27b97e['uniqueid'],_0x27b97e[_0x95a8('0x5')],_0x27b97e[_0x95a8('0x6')],_0x27b97e[_0x95a8('0x7')],_0x27b97e[_0x95a8('0x8')],_0x27b97e[_0x95a8('0x9')]));if(_0x27b97e[_0x95a8('0x5')]){utils[_0x95a8('0xa')](_0x27b97e[_0x95a8('0x5')])[_0x95a8('0xb')](function(_0x3edf8e){if(_0x3edf8e){_0x27b97e[_0x95a8('0x8')]=_0x3edf8e[_0x95a8('0xc')];_0x27b97e[_0x95a8('0xd')]=_0x3edf8e[_0x95a8('0xd')];utils[_0x95a8('0xe')]('CreateMemberReport',_0x27b97e);}else{utils[_0x95a8('0xf')](_0x27b97e[_0x95a8('0x5')][_0x95a8('0x10')]('/')[0x1])[_0x95a8('0xb')](function(_0x4595ad){if(_0x4595ad){_0x27b97e[_0x95a8('0x8')]=_0x4595ad[_0x95a8('0xc')];_0x27b97e['internal']=_0x4595ad[_0x95a8('0xd')];utils[_0x95a8('0xe')](_0x95a8('0x11'),_0x27b97e);}});}})['catch'](function(_0x3bbbb3){utils[_0x95a8('0x12')](util[_0x95a8('0x3')](_0x95a8('0x13'),_0x27b97e[_0x95a8('0x14')]),_0x3bbbb3);});}delete members[_0x27b97e[_0x95a8('0x5')]];}function startsWith(_0x501ea0,_0x1912fc){return _[_0x95a8('0x15')](_0x501ea0,function(_0x5f2c2e){return _[_0x95a8('0x16')](_0x1912fc,_0x5f2c2e);});}exports[_0x95a8('0x17')]=function(_0x3cc7c6){try{utils[_0x95a8('0x18')](util['format']('[%s][members][devicestatechange]',members[_0x3cc7c6[_0x95a8('0x19')]]?members[_0x3cc7c6['device']][_0x95a8('0x14')]:_0x3cc7c6[_0x95a8('0x19')]),_0x3cc7c6);utils[_0x95a8('0x2')](util[_0x95a8('0x3')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3cc7c6[_0x95a8('0x19')]]?members[_0x3cc7c6[_0x95a8('0x19')]][_0x95a8('0x14')]:_0x3cc7c6[_0x95a8('0x19')],_0x3cc7c6[_0x95a8('0x1a')],_0x3cc7c6[_0x95a8('0x19')]));switch(_0x3cc7c6[_0x95a8('0x1a')]){case _0x95a8('0x1b'):case _0x95a8('0x1c'):if(!startsWith(exclude,_0x3cc7c6[_0x95a8('0x19')])){members[_0x3cc7c6['device']]={'channel':_0x95a8('0x1d'),'interface':_0x3cc7c6['device'],'type':_0x95a8('0x1e'),'enterAt':utils[_0x95a8('0x1f')](),'role':'agent'};}break;case _0x95a8('0x20'):if(!_[_0x95a8('0x21')](members[_0x3cc7c6[_0x95a8('0x19')]])){members[_0x3cc7c6['device']][_0x95a8('0x22')]=utils[_0x95a8('0x1f')]();members[_0x3cc7c6[_0x95a8('0x19')]][_0x95a8('0x23')]=utils[_0x95a8('0x24')](members[_0x3cc7c6[_0x95a8('0x19')]]['exitAt'],members[_0x3cc7c6['device']][_0x95a8('0x25')]);if(members[_0x3cc7c6[_0x95a8('0x19')]][_0x95a8('0x14')]){writeDB(members[_0x3cc7c6[_0x95a8('0x19')]]);}}break;default:break;}}catch(_0x1ef7a7){utils[_0x95a8('0x12')](util[_0x95a8('0x3')](_0x95a8('0x26'),members[_0x3cc7c6[_0x95a8('0x19')]]?members[_0x3cc7c6[_0x95a8('0x19')]][_0x95a8('0x14')]:_0x3cc7c6[_0x95a8('0x19')]),_0x1ef7a7);}};exports['agentcomplete']=function(_0x2f13fd){try{if(!_['isNil'](members[_0x2f13fd[_0x95a8('0x5')]])){utils[_0x95a8('0x18')](util[_0x95a8('0x3')](_0x95a8('0x27'),_0x2f13fd[_0x95a8('0x14')]),_0x2f13fd);utils[_0x95a8('0x2')](util[_0x95a8('0x3')](_0x95a8('0x28'),_0x2f13fd[_0x95a8('0x14')],_0x2f13fd['interface'],_0x2f13fd['queue']));members[_0x2f13fd[_0x95a8('0x5')]]=_[_0x95a8('0x29')](members[_0x2f13fd[_0x95a8('0x5')]],{'data4':_0x2f13fd['queue'],'uniqueid':_0x2f13fd[_0x95a8('0x14')]});}}catch(_0x4e0a9c){utils[_0x95a8('0x12')](util[_0x95a8('0x3')](_0x95a8('0x27'),_0x2f13fd['uniqueid']),_0x4e0a9c);}};exports[_0x95a8('0x2a')]=function(_0x57b1a4){try{utils['debug'](util['format'](_0x95a8('0x2b'),_0x57b1a4[_0x95a8('0x14')]),_0x57b1a4);if(_0x57b1a4[_0x95a8('0x6')]){var _0x3839f3=_0x57b1a4[_0x95a8('0x6')]['split']('-')[0x0];if(!_[_0x95a8('0x21')](members[_0x3839f3])){members[_0x3839f3]=_['assign'](members[_0x3839f3],{'data1':members[_0x3839f3][_0x95a8('0x2c')]||_0x57b1a4[_0x95a8('0x9')],'data2':members[_0x3839f3][_0x95a8('0x7')]||_0x57b1a4[_0x95a8('0x2d')],'data3':members[_0x3839f3]['data3']||_0x57b1a4['destination'],'uniqueid':members[_0x3839f3][_0x95a8('0x14')]||_0x57b1a4[_0x95a8('0x14')]});utils[_0x95a8('0x2')](util[_0x95a8('0x3')](_0x95a8('0x2e'),_0x57b1a4[_0x95a8('0x14')],members[_0x3839f3][_0x95a8('0x2c')],members[_0x3839f3][_0x95a8('0x7')],members[_0x3839f3][_0x95a8('0x2f')]));if(members[_0x3839f3][_0x95a8('0x22')]){writeDB(members[_0x3839f3]);}}}if(_0x57b1a4['destinationchannel']){var _0x11b932=_0x57b1a4[_0x95a8('0x30')][_0x95a8('0x10')]('-')[0x0];if(!_[_0x95a8('0x21')](members[_0x11b932])){members[_0x11b932]=_[_0x95a8('0x29')](members[_0x11b932],{'data1':members[_0x11b932][_0x95a8('0x2c')]||_0x57b1a4[_0x95a8('0x9')],'data2':members[_0x11b932][_0x95a8('0x7')]||_0x57b1a4[_0x95a8('0x2d')],'data3':members[_0x11b932][_0x95a8('0x2f')]||_0x57b1a4[_0x95a8('0x31')],'uniqueid':members[_0x11b932]['uniqueid']||_0x57b1a4['uniqueid']});utils[_0x95a8('0x2')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x57b1a4[_0x95a8('0x14')],members[_0x11b932][_0x95a8('0x2c')],members[_0x11b932]['data2'],members[_0x11b932][_0x95a8('0x2f')]));if(members[_0x11b932][_0x95a8('0x22')]){writeDB(members[_0x11b932]);}}}}catch(_0x798ab){utils[_0x95a8('0x12')](util[_0x95a8('0x3')](_0x95a8('0x2b'),_0x57b1a4[_0x95a8('0x14')]),_0x798ab);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f303da0..a9add70 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 _0xd3b9=['format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','type','CreateVoiceQueueReport','request','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','transfereduniqueid','queuecallerenterreason','varset','variable','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','queueposition','value','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xd3b9,0x184));var _0x9d3b=function(_0x25bcd4,_0x199c1c){_0x25bcd4=_0x25bcd4-0x0;var _0x41e804=_0xd3b9[_0x25bcd4];return _0x41e804;};'use strict';var _=require(_0x9d3b('0x0'));var util=require(_0x9d3b('0x1'));var utils=require(_0x9d3b('0x2'));var queues={};function writeDB(_0x3daaba){utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x5'),_0x3daaba[_0x9d3b('0x6')],_0x3daaba[_0x9d3b('0x7')],_0x3daaba[_0x9d3b('0x8')],_0x3daaba[_0x9d3b('0x9')],_0x3daaba[_0x9d3b('0xa')],_0x3daaba[_0x9d3b('0xb')],_0x3daaba['queuecallerexitreason']));if(_0x3daaba[_0x9d3b('0x8')]){utils[_0x9d3b('0xc')](_0x3daaba[_0x9d3b('0x8')])['then'](function(_0x16e83e){if(_0x16e83e){_0x3daaba[_0x9d3b('0xd')]=_0x16e83e[_0x9d3b('0xd')];}utils['request'](_0x9d3b('0xe'),_0x3daaba);});}else{utils[_0x9d3b('0xf')](_0x9d3b('0xe'),_0x3daaba);}if(_0x3daaba['transfereduniqueid']){delete queues[_0x3daaba['transfereduniqueid']];}else{delete queues[_0x3daaba[_0x9d3b('0x6')]];}}exports[_0x9d3b('0x10')]=function(_0x419b39){try{utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')](_0x9d3b('0x12'),_0x419b39['uniqueid']),_0x419b39);utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x13'),_0x419b39['uniqueid'],_0x419b39['queue'],_0x419b39[_0x9d3b('0x14')]));queues[_0x419b39[_0x9d3b('0x6')]]=_[_0x9d3b('0x15')](_0x419b39,{'originalposition':_0x419b39['position'],'queuecallerjoinAt':utils[_0x9d3b('0x16')](),'mohtime':0x0});}catch(_0x37cced){utils[_0x9d3b('0x17')](util[_0x9d3b('0x4')](_0x9d3b('0x12'),_0x419b39[_0x9d3b('0x6')]),_0x37cced);}};exports[_0x9d3b('0x18')]=function(_0x2ee704){try{if(!_[_0x9d3b('0x19')](queues[_0x2ee704[_0x9d3b('0x6')]])){utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')](_0x9d3b('0x1a'),_0x2ee704[_0x9d3b('0x6')]),_0x2ee704);if(queues[_0x2ee704[_0x9d3b('0x6')]]['queuecallerleaveAt']){if(!queues[_0x2ee704[_0x9d3b('0x6')]]['queuecallerabandon']&&!queues[_0x2ee704[_0x9d3b('0x6')]][_0x9d3b('0x1b')]){queues[_0x2ee704['uniqueid']][_0x9d3b('0x1c')]=!![];queues[_0x2ee704[_0x9d3b('0x6')]][_0x9d3b('0x1d')]=utils[_0x9d3b('0x16')]();queues[_0x2ee704['uniqueid']][_0x9d3b('0x1e')]=_0x9d3b('0x1f');}utils[_0x9d3b('0x3')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x2ee704['uniqueid'],queues[_0x2ee704[_0x9d3b('0x6')]]['name'],queues[_0x2ee704['uniqueid']][_0x9d3b('0x1e')]));writeDB(queues[_0x2ee704['uniqueid']]);}else if(queues[_0x2ee704[_0x9d3b('0x6')]]['transfereduniqueid']){utils['info'](util[_0x9d3b('0x4')](_0x9d3b('0x20'),_0x2ee704['uniqueid'],queues[_0x2ee704[_0x9d3b('0x6')]][_0x9d3b('0x21')],queues[_0x2ee704['uniqueid']][_0x9d3b('0x22')]));queues[queues[_0x2ee704[_0x9d3b('0x6')]]['transfereduniqueid']]=queues[_0x2ee704[_0x9d3b('0x6')]];queues[queues[_0x2ee704[_0x9d3b('0x6')]][_0x9d3b('0x22')]][_0x9d3b('0x23')]=0x2;delete queues[_0x2ee704['uniqueid']];}}}catch(_0x54a43a){utils[_0x9d3b('0x17')](util['format'](_0x9d3b('0x1a'),_0x2ee704[_0x9d3b('0x6')]),_0x54a43a);}};exports[_0x9d3b('0x24')]=function(_0x4b1b43){try{utils[_0x9d3b('0x11')](util['format']('[%s][queues][varset]',_0x4b1b43[_0x9d3b('0x6')]),_0x4b1b43);if(!_[_0x9d3b('0x19')](_0x4b1b43[_0x9d3b('0x25')]['queuestatus'])&&_0x4b1b43['value'][_0x9d3b('0x26')]()!==_0x9d3b('0x27')){if(!_[_0x9d3b('0x19')](queues[_0x4b1b43[_0x9d3b('0x6')]])){queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x28')]=![];queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x29')]=null;queues[_0x4b1b43['uniqueid']]['queuecallerexit']=!![];queues[_0x4b1b43['uniqueid']][_0x9d3b('0x2a')]=utils[_0x9d3b('0x16')]();queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x1e')]=_0x4b1b43['value'][_0x9d3b('0x26')]();utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4b1b43[_0x9d3b('0x6')],queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x21')],_0x4b1b43['value'],queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x1e')]));writeDB(queues[_0x4b1b43['uniqueid']]);}}else if(!_[_0x9d3b('0x19')](_0x4b1b43[_0x9d3b('0x25')][_0x9d3b('0x2b')])){if(!_['isNil'](queues[_0x4b1b43[_0x9d3b('0x6')]])&&!queues[_0x4b1b43[_0x9d3b('0x6')]]['queuecallerabandon']){queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x28')]=![];queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x29')]=null;queues[_0x4b1b43['uniqueid']]['queuecallerexit']=!![];queues[_0x4b1b43['uniqueid']][_0x9d3b('0x2a')]=utils[_0x9d3b('0x16')]();queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x1e')]='EXITWITHKEY';utils[_0x9d3b('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4b1b43[_0x9d3b('0x6')],queues[_0x4b1b43['uniqueid']][_0x9d3b('0x21')],_0x4b1b43[_0x9d3b('0x2c')],queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x1e')]));}}}catch(_0xbc3401){utils['error'](util[_0x9d3b('0x4')]('[%s][queues][varset]',_0x4b1b43[_0x9d3b('0x6')]),_0xbc3401);}};exports[_0x9d3b('0x28')]=function(_0x1e9562){try{if(!_['isNil'](queues[_0x1e9562[_0x9d3b('0x6')]])){utils[_0x9d3b('0x11')](util['format']('[%s][queues][queuecallerabandon]',_0x1e9562[_0x9d3b('0x6')]),_0x1e9562);queues[_0x1e9562[_0x9d3b('0x6')]]['queuecallerexit']=![];queues[_0x1e9562[_0x9d3b('0x6')]][_0x9d3b('0x2a')]=null;queues[_0x1e9562[_0x9d3b('0x6')]][_0x9d3b('0x28')]=!![];queues[_0x1e9562[_0x9d3b('0x6')]][_0x9d3b('0x29')]=utils[_0x9d3b('0x16')]();queues[_0x1e9562['uniqueid']][_0x9d3b('0x1e')]='ABANDONED';utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1e9562['uniqueid'],queues[_0x1e9562[_0x9d3b('0x6')]][_0x9d3b('0x21')],queues[_0x1e9562[_0x9d3b('0x6')]]['queuecallerexitreason']));}}catch(_0x496df4){utils[_0x9d3b('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x1e9562[_0x9d3b('0x6')]),_0x496df4);}};exports[_0x9d3b('0x2d')]=function(_0x37a5dd){try{if(!_['isNil'](queues[_0x37a5dd[_0x9d3b('0x6')]])){utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')](_0x9d3b('0x2e'),_0x37a5dd[_0x9d3b('0x6')]),_0x37a5dd);utils[_0x9d3b('0x3')](util['format'](_0x9d3b('0x2f'),_0x37a5dd[_0x9d3b('0x6')],queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x21')],_0x37a5dd[_0x9d3b('0x30')],_0x37a5dd[_0x9d3b('0x31')]));queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x2d')]=!![];queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x32')]=utils[_0x9d3b('0x16')]();queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x33')]=utils['diffTime'](queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x32')],queues[_0x37a5dd[_0x9d3b('0x6')]]['queuecallerjoinAt']);queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x14')]=_0x37a5dd[_0x9d3b('0x14')];queues[_0x37a5dd['uniqueid']][_0x9d3b('0x34')]=_0x37a5dd[_0x9d3b('0x34')];queues[_0x37a5dd[_0x9d3b('0x6')]]['connectedlinenum']=_0x37a5dd[_0x9d3b('0x30')];queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x31')]=_0x37a5dd[_0x9d3b('0x31')];}}catch(_0x4411f4){utils[_0x9d3b('0x17')](util[_0x9d3b('0x4')]('[%s][queues][queuecallerleave]',_0x37a5dd['uniqueid']),_0x4411f4);}};exports[_0x9d3b('0x35')]=function(_0x495503){try{if(!_[_0x9d3b('0x19')](queues[_0x495503['uniqueid']])){utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')](_0x9d3b('0x36'),_0x495503[_0x9d3b('0x6')]),_0x495503);utils[_0x9d3b('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x495503[_0x9d3b('0x6')],queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x21')],_0x495503[_0x9d3b('0x37')],_0x495503[_0x9d3b('0x38')]));queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x28')]=![];queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x28')]=![];queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x29')]=null;queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x1b')]=![];queues[_0x495503[_0x9d3b('0x6')]]['queuecallerexitreason']=null;queues[_0x495503['uniqueid']][_0x9d3b('0x2a')]=null;queues[_0x495503['uniqueid']][_0x9d3b('0x39')]=!![];queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0xb')]=_0x495503[_0x9d3b('0x38')];queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x9')]=_0x495503['membername'];}}catch(_0x4288e7){utils[_0x9d3b('0x17')](util[_0x9d3b('0x4')](_0x9d3b('0x36'),_0x495503[_0x9d3b('0x6')]),_0x4288e7);}};exports[_0x9d3b('0x3a')]=function(_0x21d218){try{if(!_[_0x9d3b('0x19')](queues[_0x21d218['uniqueid']])){if(queues[_0x21d218['uniqueid']][_0x9d3b('0x32')]){utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')](_0x9d3b('0x3b'),_0x21d218[_0x9d3b('0x6')]),_0x21d218);queues[_0x21d218['uniqueid']][_0x9d3b('0x28')]=![];queues[_0x21d218['uniqueid']][_0x9d3b('0x28')]=![];queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x29')]=null;queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x1b')]=![];queues[_0x21d218[_0x9d3b('0x6')]]['queuecallerexitAt']=null;queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x39')]=!![];queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x9')]=_0x21d218[_0x9d3b('0x37')];queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x1c')]=!![];queues[_0x21d218[_0x9d3b('0x6')]]['queuecallercompleteAt']=utils['now']();if(_0x21d218[_0x9d3b('0x3c')]=='transfer'){if(!queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x3d')]){queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x1e')]=_0x9d3b('0x3e');}}else{queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x1e')]=_0x9d3b('0x3f')+_0x21d218[_0x9d3b('0x3c')]['toUpperCase']();}utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x21d218[_0x9d3b('0x6')],queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x21')],_0x21d218[_0x9d3b('0x37')],queues[_0x21d218[_0x9d3b('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x21d218['uniqueid']]);}}}catch(_0xc784d3){utils['error'](util[_0x9d3b('0x4')](_0x9d3b('0x3b'),_0x21d218[_0x9d3b('0x6')]),_0xc784d3);}};exports[_0x9d3b('0x40')]=function(_0x4add60){try{if(!_[_0x9d3b('0x19')](queues[_0x4add60[_0x9d3b('0x41')]])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x4add60[_0x9d3b('0x6')]),_0x4add60);queues[_0x4add60[_0x9d3b('0x41')]][_0x9d3b('0x3d')]=!![];queues[_0x4add60[_0x9d3b('0x41')]][_0x9d3b('0x42')]='BLIND';queues[_0x4add60[_0x9d3b('0x41')]][_0x9d3b('0x43')]=_0x4add60[_0x9d3b('0x44')];queues[_0x4add60['transfereeuniqueid']][_0x9d3b('0x45')]=_0x4add60[_0x9d3b('0x41')];queues[_0x4add60[_0x9d3b('0x41')]][_0x9d3b('0x1e')]=_0x9d3b('0x46');utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x47'),_0x4add60[_0x9d3b('0x6')],queues[_0x4add60['transfereeuniqueid']][_0x9d3b('0x21')],_0x4add60[_0x9d3b('0x41')],_0x4add60['extension']));}}catch(_0xdcefb5){utils['error'](util[_0x9d3b('0x4')](_0x9d3b('0x48'),_0x4add60[_0x9d3b('0x6')]),_0xdcefb5);}};exports[_0x9d3b('0x49')]=function(_0x7977b9){try{utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')]('[%s][queues][attendedtransfer]',_0x7977b9[_0x9d3b('0x4a')]),_0x7977b9);if(_0x7977b9[_0x9d3b('0x4a')]==_0x7977b9['origtransfererlinkedid']){if(!_[_0x9d3b('0x19')](queues[_0x7977b9[_0x9d3b('0x4b')]])){utils[_0x9d3b('0x3')](util['format'](_0x9d3b('0x4c'),_0x7977b9[_0x9d3b('0x4a')],queues[_0x7977b9['secondtransfererlinkedid']][_0x9d3b('0x21')],_0x7977b9[_0x9d3b('0x4d')]));queues[_0x7977b9[_0x9d3b('0x4b')]]['transfer']=!![];queues[_0x7977b9[_0x9d3b('0x4b')]][_0x9d3b('0x42')]=_0x9d3b('0x4e');queues[_0x7977b9['secondtransfererlinkedid']]['transferexten']=_0x7977b9[_0x9d3b('0x4d')];queues[_0x7977b9[_0x9d3b('0x4b')]][_0x9d3b('0x45')]=_0x7977b9[_0x9d3b('0x4a')];queues[_0x7977b9[_0x9d3b('0x4b')]]['queuecallerexitreason']=_0x9d3b('0x4f');}if(!_[_0x9d3b('0x19')](queues[_0x7977b9['origtransfererlinkedid']])){if(_0x7977b9['transfereelinkedid']&&queues[_0x7977b9[_0x9d3b('0x50')]]){queues[_0x7977b9['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x7977b9['transfereeuniqueid']]=_[_0x9d3b('0x51')](queues[_0x7977b9[_0x9d3b('0x50')]]);queues[_0x7977b9[_0x9d3b('0x41')]][_0x9d3b('0x22')]=_0x7977b9[_0x9d3b('0x52')];queues[_0x7977b9[_0x9d3b('0x41')]][_0x9d3b('0x23')]=0x2;queues[_0x7977b9[_0x9d3b('0x41')]]['calleridnum']=queues[_0x7977b9[_0x9d3b('0x4b')]]['calleridnum'];queues[_0x7977b9['transfereeuniqueid']][_0x9d3b('0x53')]=queues[_0x7977b9[_0x9d3b('0x4b')]]['calleridname'];queues[_0x7977b9[_0x9d3b('0x41')]][_0x9d3b('0x54')]=utils[_0x9d3b('0x16')]();queues[_0x7977b9[_0x9d3b('0x41')]][_0x9d3b('0x32')]=utils['now']();queues[_0x7977b9['transfereeuniqueid']][_0x9d3b('0x33')]=0x0;queues[_0x7977b9[_0x9d3b('0x41')]]['mohtime']=0x0;utils['info'](util[_0x9d3b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x7977b9[_0x9d3b('0x4a')],queues[_0x7977b9[_0x9d3b('0x41')]]['name'],queues[_0x7977b9[_0x9d3b('0x41')]][_0x9d3b('0xa')],queues[_0x7977b9['transfereeuniqueid']][_0x9d3b('0x53')]));}else{utils['info'](util[_0x9d3b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x7977b9['origtransfereruniqueid'],queues[_0x7977b9[_0x9d3b('0x55')]][_0x9d3b('0x21')],_0x7977b9['secondtransfererlinkedid']));queues[_0x7977b9[_0x9d3b('0x55')]][_0x9d3b('0x22')]=_0x7977b9[_0x9d3b('0x4b')];}}}else if(_0x7977b9[_0x9d3b('0x56')]==_0x7977b9['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x7977b9['origtransfererlinkedid']])){utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x57'),_0x7977b9[_0x9d3b('0x4a')],queues[_0x7977b9['origtransfererlinkedid']][_0x9d3b('0x21')],_0x7977b9[_0x9d3b('0x56')],_0x7977b9['secondtransfererexten']));queues[_0x7977b9['origtransfererlinkedid']]['transfer']=!![];queues[_0x7977b9[_0x9d3b('0x55')]][_0x9d3b('0x42')]='ATTENDED';queues[_0x7977b9[_0x9d3b('0x55')]][_0x9d3b('0x43')]=_0x7977b9['secondtransfererexten'];queues[_0x7977b9[_0x9d3b('0x55')]][_0x9d3b('0x45')]=_0x7977b9['secondtransfereruniqueid'];queues[_0x7977b9['origtransfererlinkedid']][_0x9d3b('0x1e')]=_0x9d3b('0x4f');}if(!_[_0x9d3b('0x19')](queues[_0x7977b9[_0x9d3b('0x4b')]])){if(_0x7977b9[_0x9d3b('0x58')]&&queues[_0x7977b9[_0x9d3b('0x58')]]){queues[_0x7977b9[_0x9d3b('0x58')]][_0x9d3b('0x23')]=0x1;queues[_0x7977b9[_0x9d3b('0x52')]]=_[_0x9d3b('0x51')](queues[_0x7977b9[_0x9d3b('0x58')]]);queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x22')]=_0x7977b9[_0x9d3b('0x52')];queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x23')]=0x2;queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0xa')]=queues[_0x7977b9['origtransfererlinkedid']]['calleridnum'];queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x53')]=queues[_0x7977b9[_0x9d3b('0x55')]]['calleridname'];queues[_0x7977b9['transfertargetuniqueid']][_0x9d3b('0x54')]=utils[_0x9d3b('0x16')]();queues[_0x7977b9['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x9d3b('0x16')]();queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x33')]=0x0;queues[_0x7977b9['transfertargetuniqueid']][_0x9d3b('0x59')]=0x0;utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x7977b9['origtransfereruniqueid'],queues[_0x7977b9['transfertargetuniqueid']][_0x9d3b('0x21')],queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x22')],queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0xa')],queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x53')]));}else{utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x5a'),_0x7977b9[_0x9d3b('0x4a')],queues[_0x7977b9[_0x9d3b('0x4b')]][_0x9d3b('0x21')],_0x7977b9[_0x9d3b('0x55')]));queues[_0x7977b9[_0x9d3b('0x4b')]][_0x9d3b('0x22')]=_0x7977b9[_0x9d3b('0x55')];}}}}catch(_0x2961a1){utils[_0x9d3b('0x17')](util[_0x9d3b('0x4')](_0x9d3b('0x5b'),_0x7977b9['origtransfereruniqueid']),_0x2961a1);}};exports['musiconholdstart']=function(_0x57fc4c){try{if(!_[_0x9d3b('0x19')](queues[_0x57fc4c[_0x9d3b('0x6')]])){utils['debug'](util[_0x9d3b('0x4')]('[%s][queues][musiconholdstart]',_0x57fc4c[_0x9d3b('0x6')]),_0x57fc4c);queues[_0x57fc4c[_0x9d3b('0x6')]][_0x9d3b('0x5c')]=utils[_0x9d3b('0x16')]();utils['info'](util[_0x9d3b('0x4')](_0x9d3b('0x5d'),_0x57fc4c['uniqueid'],queues[_0x57fc4c[_0x9d3b('0x6')]][_0x9d3b('0x21')],queues[_0x57fc4c['uniqueid']][_0x9d3b('0x5c')]));}}catch(_0x4c51a6){utils[_0x9d3b('0x17')](util[_0x9d3b('0x4')]('[%s][queues][musiconholdstart]',_0x57fc4c[_0x9d3b('0x6')]),_0x4c51a6);}};exports[_0x9d3b('0x5e')]=function(_0x3f8d1e){try{if(!_[_0x9d3b('0x19')](queues[_0x3f8d1e[_0x9d3b('0x6')]])){if(!_['isNil'](queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x5c')])){utils['debug'](util[_0x9d3b('0x4')](_0x9d3b('0x5f'),_0x3f8d1e['uniqueid']),_0x3f8d1e);queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x59')]+=utils[_0x9d3b('0x60')](utils[_0x9d3b('0x16')](),queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x5c')]);utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x61'),_0x3f8d1e[_0x9d3b('0x6')],queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x21')],queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x59')]));delete queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x5c')];}}}catch(_0x2eed28){utils[_0x9d3b('0x17')](util['format']('[%s][queues][musiconholdstop]',_0x3f8d1e[_0x9d3b('0x6')]),_0x2eed28);}}; \ No newline at end of file +var _0x570c=['blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid','secondtransfereruniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','mohtime','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s'];(function(_0x2b03e4,_0x2f1646){var _0xc19987=function(_0x41ac92){while(--_0x41ac92){_0x2b03e4['push'](_0x2b03e4['shift']());}};_0xc19987(++_0x2f1646);}(_0x570c,0xf9));var _0xc570=function(_0xf8daaa,_0x4ae2fb){_0xf8daaa=_0xf8daaa-0x0;var _0x389c5c=_0x570c[_0xf8daaa];return _0x389c5c;};'use strict';var _=require(_0xc570('0x0'));var util=require(_0xc570('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x100400){utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x4'),_0x100400['uniqueid'],_0x100400['channel'],_0x100400[_0xc570('0x5')],_0x100400[_0xc570('0x6')],_0x100400[_0xc570('0x7')],_0x100400[_0xc570('0x8')],_0x100400[_0xc570('0x9')]));if(_0x100400[_0xc570('0x5')]){utils[_0xc570('0xa')](_0x100400['queue'])[_0xc570('0xb')](function(_0x2474d2){if(_0x2474d2){_0x100400[_0xc570('0xc')]=_0x2474d2[_0xc570('0xc')];}utils[_0xc570('0xd')](_0xc570('0xe'),_0x100400);});}else{utils[_0xc570('0xd')]('CreateVoiceQueueReport',_0x100400);}if(_0x100400['transfereduniqueid']){delete queues[_0x100400[_0xc570('0xf')]];}else{delete queues[_0x100400[_0xc570('0x10')]];}}exports['queuecallerjoin']=function(_0x5d1ed9){try{utils[_0xc570('0x11')](util[_0xc570('0x3')](_0xc570('0x12'),_0x5d1ed9[_0xc570('0x10')]),_0x5d1ed9);utils[_0xc570('0x2')](util['format'](_0xc570('0x13'),_0x5d1ed9['uniqueid'],_0x5d1ed9[_0xc570('0x5')],_0x5d1ed9[_0xc570('0x14')]));queues[_0x5d1ed9['uniqueid']]=_[_0xc570('0x15')](_0x5d1ed9,{'originalposition':_0x5d1ed9[_0xc570('0x14')],'queuecallerjoinAt':utils[_0xc570('0x16')](),'mohtime':0x0});}catch(_0x29e081){utils[_0xc570('0x17')](util['format'](_0xc570('0x12'),_0x5d1ed9['uniqueid']),_0x29e081);}};exports[_0xc570('0x18')]=function(_0x4ffa01){try{if(!_['isNil'](queues[_0x4ffa01[_0xc570('0x10')]])){utils['debug'](util[_0xc570('0x3')](_0xc570('0x19'),_0x4ffa01['uniqueid']),_0x4ffa01);if(queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x1a')]){if(!queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x1b')]&&!queues[_0x4ffa01['uniqueid']][_0xc570('0x1c')]){queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x1d')]=!![];queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x1e')]=utils[_0xc570('0x16')]();queues[_0x4ffa01['uniqueid']]['queuecallerexitreason']=_0xc570('0x1f');}utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x20'),_0x4ffa01[_0xc570('0x10')],queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x21')],queues[_0x4ffa01['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x4ffa01[_0xc570('0x10')]]);}else if(queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0xf')]){utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4ffa01[_0xc570('0x10')],queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x21')],queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0xf')]));queues[queues[_0x4ffa01['uniqueid']]['transfereduniqueid']]=queues[_0x4ffa01[_0xc570('0x10')]];queues[queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0xf')]][_0xc570('0x22')]=0x2;delete queues[_0x4ffa01[_0xc570('0x10')]];}}}catch(_0x449361){utils[_0xc570('0x17')](util[_0xc570('0x3')]('[%s][queues][hangup]',_0x4ffa01[_0xc570('0x10')]),_0x449361);}};exports[_0xc570('0x23')]=function(_0x4bc7db){try{utils[_0xc570('0x11')](util[_0xc570('0x3')](_0xc570('0x24'),_0x4bc7db['uniqueid']),_0x4bc7db);if(!_[_0xc570('0x25')](_0x4bc7db['variable']['queuestatus'])&&_0x4bc7db[_0xc570('0x26')]['toUpperCase']()!==_0xc570('0x27')){if(!_[_0xc570('0x25')](queues[_0x4bc7db[_0xc570('0x10')]])){queues[_0x4bc7db['uniqueid']][_0xc570('0x1b')]=![];queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x28')]=null;queues[_0x4bc7db['uniqueid']][_0xc570('0x1c')]=!![];queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x29')]=utils[_0xc570('0x16')]();queues[_0x4bc7db[_0xc570('0x10')]]['queuecallerexitreason']=_0x4bc7db[_0xc570('0x26')][_0xc570('0x2a')]();utils['info'](util[_0xc570('0x3')](_0xc570('0x2b'),_0x4bc7db[_0xc570('0x10')],queues[_0x4bc7db['uniqueid']][_0xc570('0x21')],_0x4bc7db[_0xc570('0x26')],queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x9')]));writeDB(queues[_0x4bc7db['uniqueid']]);}}else if(!_[_0xc570('0x25')](_0x4bc7db[_0xc570('0x2c')][_0xc570('0x2d')])){if(!_[_0xc570('0x25')](queues[_0x4bc7db[_0xc570('0x10')]])&&!queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x1b')]){queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x1b')]=![];queues[_0x4bc7db[_0xc570('0x10')]]['queuecallerabandonAt']=null;queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x1c')]=!![];queues[_0x4bc7db[_0xc570('0x10')]]['queuecallerexitAt']=utils[_0xc570('0x16')]();queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x9')]='EXITWITHKEY';utils['info'](util[_0xc570('0x3')](_0xc570('0x2e'),_0x4bc7db[_0xc570('0x10')],queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x21')],_0x4bc7db[_0xc570('0x26')],queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x9')]));}}}catch(_0x1fa6da){utils[_0xc570('0x17')](util[_0xc570('0x3')](_0xc570('0x24'),_0x4bc7db[_0xc570('0x10')]),_0x1fa6da);}};exports[_0xc570('0x1b')]=function(_0x5338cc){try{if(!_[_0xc570('0x25')](queues[_0x5338cc[_0xc570('0x10')]])){utils[_0xc570('0x11')](util['format'](_0xc570('0x2f'),_0x5338cc[_0xc570('0x10')]),_0x5338cc);queues[_0x5338cc[_0xc570('0x10')]]['queuecallerexit']=![];queues[_0x5338cc[_0xc570('0x10')]]['queuecallerexitAt']=null;queues[_0x5338cc[_0xc570('0x10')]]['queuecallerabandon']=!![];queues[_0x5338cc[_0xc570('0x10')]][_0xc570('0x28')]=utils['now']();queues[_0x5338cc[_0xc570('0x10')]][_0xc570('0x9')]=_0xc570('0x30');utils['info'](util['format'](_0xc570('0x31'),_0x5338cc['uniqueid'],queues[_0x5338cc[_0xc570('0x10')]][_0xc570('0x21')],queues[_0x5338cc[_0xc570('0x10')]][_0xc570('0x9')]));}}catch(_0x3286ac){utils[_0xc570('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x5338cc[_0xc570('0x10')]),_0x3286ac);}};exports[_0xc570('0x32')]=function(_0x1fef7f){try{if(!_[_0xc570('0x25')](queues[_0x1fef7f[_0xc570('0x10')]])){utils[_0xc570('0x11')](util[_0xc570('0x3')](_0xc570('0x33'),_0x1fef7f[_0xc570('0x10')]),_0x1fef7f);utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x34'),_0x1fef7f[_0xc570('0x10')],queues[_0x1fef7f[_0xc570('0x10')]]['name'],_0x1fef7f[_0xc570('0x35')],_0x1fef7f[_0xc570('0x36')]));queues[_0x1fef7f['uniqueid']]['queuecallerleave']=!![];queues[_0x1fef7f['uniqueid']]['queuecallerleaveAt']=utils[_0xc570('0x16')]();queues[_0x1fef7f[_0xc570('0x10')]][_0xc570('0x37')]=utils[_0xc570('0x38')](queues[_0x1fef7f[_0xc570('0x10')]][_0xc570('0x1a')],queues[_0x1fef7f[_0xc570('0x10')]][_0xc570('0x39')]);queues[_0x1fef7f[_0xc570('0x10')]]['position']=_0x1fef7f[_0xc570('0x14')];queues[_0x1fef7f[_0xc570('0x10')]][_0xc570('0x3a')]=_0x1fef7f[_0xc570('0x3a')];queues[_0x1fef7f[_0xc570('0x10')]]['connectedlinenum']=_0x1fef7f['connectedlinenum'];queues[_0x1fef7f[_0xc570('0x10')]][_0xc570('0x36')]=_0x1fef7f[_0xc570('0x36')];}}catch(_0x30e89e){utils['error'](util['format'](_0xc570('0x33'),_0x1fef7f[_0xc570('0x10')]),_0x30e89e);}};exports[_0xc570('0x3b')]=function(_0x5c4252){try{if(!_[_0xc570('0x25')](queues[_0x5c4252[_0xc570('0x10')]])){utils['debug'](util[_0xc570('0x3')](_0xc570('0x3c'),_0x5c4252['uniqueid']),_0x5c4252);utils['info'](util[_0xc570('0x3')](_0xc570('0x3d'),_0x5c4252['uniqueid'],queues[_0x5c4252['uniqueid']][_0xc570('0x21')],_0x5c4252[_0xc570('0x3e')],_0x5c4252[_0xc570('0x3f')]));queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x1b')]=![];queues[_0x5c4252[_0xc570('0x10')]]['queuecallerabandon']=![];queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x28')]=null;queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x1c')]=![];queues[_0x5c4252['uniqueid']][_0xc570('0x9')]=null;queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x29')]=null;queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x40')]=!![];queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x8')]=_0x5c4252['destaccountcode'];queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x6')]=_0x5c4252[_0xc570('0x3e')];}}catch(_0x334976){utils[_0xc570('0x17')](util['format']('[%s][queues][agentconnect]',_0x5c4252[_0xc570('0x10')]),_0x334976);}};exports[_0xc570('0x41')]=function(_0x12cc43){try{if(!_[_0xc570('0x25')](queues[_0x12cc43[_0xc570('0x10')]])){if(queues[_0x12cc43['uniqueid']][_0xc570('0x1a')]){utils[_0xc570('0x11')](util[_0xc570('0x3')](_0xc570('0x42'),_0x12cc43[_0xc570('0x10')]),_0x12cc43);queues[_0x12cc43['uniqueid']][_0xc570('0x1b')]=![];queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x1b')]=![];queues[_0x12cc43['uniqueid']]['queuecallerabandonAt']=null;queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x1c')]=![];queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x29')]=null;queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x40')]=!![];queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x6')]=_0x12cc43['membername'];queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x1d')]=!![];queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x1e')]=utils['now']();if(_0x12cc43[_0xc570('0x43')]==_0xc570('0x44')){if(!queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x44')]){queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x9')]=_0xc570('0x45');}}else{queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x9')]=_0xc570('0x46')+_0x12cc43['reason'][_0xc570('0x2a')]();}utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x47'),_0x12cc43[_0xc570('0x10')],queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x21')],_0x12cc43['membername'],queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x9')]));writeDB(queues[_0x12cc43['uniqueid']]);}}}catch(_0x336366){utils[_0xc570('0x17')](util['format'](_0xc570('0x42'),_0x12cc43[_0xc570('0x10')]),_0x336366);}};exports[_0xc570('0x48')]=function(_0x15c410){try{if(!_[_0xc570('0x25')](queues[_0x15c410[_0xc570('0x49')]])){utils['debug'](util[_0xc570('0x3')](_0xc570('0x4a'),_0x15c410[_0xc570('0x10')]),_0x15c410);queues[_0x15c410['transfereeuniqueid']][_0xc570('0x44')]=!![];queues[_0x15c410[_0xc570('0x49')]][_0xc570('0x4b')]=_0xc570('0x4c');queues[_0x15c410[_0xc570('0x49')]][_0xc570('0x4d')]=_0x15c410[_0xc570('0x4e')];queues[_0x15c410['transfereeuniqueid']]['transferuniqueid']=_0x15c410[_0xc570('0x49')];queues[_0x15c410[_0xc570('0x49')]]['queuecallerexitreason']=_0xc570('0x4f');utils[_0xc570('0x2')](util['format'](_0xc570('0x50'),_0x15c410['uniqueid'],queues[_0x15c410[_0xc570('0x49')]][_0xc570('0x21')],_0x15c410[_0xc570('0x49')],_0x15c410[_0xc570('0x4e')]));}}catch(_0x9afafb){utils['error'](util[_0xc570('0x3')](_0xc570('0x4a'),_0x15c410[_0xc570('0x10')]),_0x9afafb);}};exports[_0xc570('0x51')]=function(_0xbafd2f){try{utils[_0xc570('0x11')](util['format'](_0xc570('0x52'),_0xbafd2f[_0xc570('0x53')]),_0xbafd2f);if(_0xbafd2f['origtransfereruniqueid']==_0xbafd2f['origtransfererlinkedid']){if(!_['isNil'](queues[_0xbafd2f[_0xc570('0x54')]])){utils['info'](util['format'](_0xc570('0x55'),_0xbafd2f[_0xc570('0x53')],queues[_0xbafd2f[_0xc570('0x54')]][_0xc570('0x21')],_0xbafd2f[_0xc570('0x56')]));queues[_0xbafd2f['secondtransfererlinkedid']][_0xc570('0x44')]=!![];queues[_0xbafd2f[_0xc570('0x54')]][_0xc570('0x4b')]=_0xc570('0x57');queues[_0xbafd2f[_0xc570('0x54')]][_0xc570('0x4d')]=_0xbafd2f[_0xc570('0x56')];queues[_0xbafd2f['secondtransfererlinkedid']][_0xc570('0x58')]=_0xbafd2f['origtransfereruniqueid'];queues[_0xbafd2f[_0xc570('0x54')]]['queuecallerexitreason']=_0xc570('0x59');}if(!_[_0xc570('0x25')](queues[_0xbafd2f['origtransfererlinkedid']])){if(_0xbafd2f['transfereelinkedid']&&queues[_0xbafd2f[_0xc570('0x5a')]]){queues[_0xbafd2f['transfereelinkedid']][_0xc570('0x22')]=0x1;queues[_0xbafd2f[_0xc570('0x49')]]=_[_0xc570('0x5b')](queues[_0xbafd2f[_0xc570('0x5a')]]);queues[_0xbafd2f[_0xc570('0x49')]][_0xc570('0xf')]=_0xbafd2f[_0xc570('0x5c')];queues[_0xbafd2f[_0xc570('0x49')]]['queuecallerenterreason']=0x2;queues[_0xbafd2f[_0xc570('0x49')]]['calleridnum']=queues[_0xbafd2f['secondtransfererlinkedid']][_0xc570('0x7')];queues[_0xbafd2f[_0xc570('0x49')]][_0xc570('0x5d')]=queues[_0xbafd2f['secondtransfererlinkedid']]['calleridname'];queues[_0xbafd2f['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xc570('0x16')]();queues[_0xbafd2f[_0xc570('0x49')]][_0xc570('0x1a')]=utils[_0xc570('0x16')]();queues[_0xbafd2f[_0xc570('0x49')]][_0xc570('0x37')]=0x0;queues[_0xbafd2f['transfereeuniqueid']]['mohtime']=0x0;utils[_0xc570('0x2')](util['format'](_0xc570('0x5e'),_0xbafd2f['origtransfereruniqueid'],queues[_0xbafd2f[_0xc570('0x49')]][_0xc570('0x21')],queues[_0xbafd2f['transfereeuniqueid']][_0xc570('0x7')],queues[_0xbafd2f['transfereeuniqueid']][_0xc570('0x5d')]));}else{utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x5f'),_0xbafd2f[_0xc570('0x53')],queues[_0xbafd2f['origtransfererlinkedid']][_0xc570('0x21')],_0xbafd2f[_0xc570('0x54')]));queues[_0xbafd2f[_0xc570('0x60')]][_0xc570('0xf')]=_0xbafd2f[_0xc570('0x54')];}}}else if(_0xbafd2f[_0xc570('0x61')]==_0xbafd2f[_0xc570('0x54')]){if(!_[_0xc570('0x25')](queues[_0xbafd2f[_0xc570('0x60')]])){utils['info'](util[_0xc570('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xbafd2f[_0xc570('0x53')],queues[_0xbafd2f[_0xc570('0x60')]][_0xc570('0x21')],_0xbafd2f['secondtransfereruniqueid'],_0xbafd2f['secondtransfererexten']));queues[_0xbafd2f[_0xc570('0x60')]][_0xc570('0x44')]=!![];queues[_0xbafd2f[_0xc570('0x60')]][_0xc570('0x4b')]=_0xc570('0x57');queues[_0xbafd2f['origtransfererlinkedid']][_0xc570('0x4d')]=_0xbafd2f['secondtransfererexten'];queues[_0xbafd2f[_0xc570('0x60')]][_0xc570('0x58')]=_0xbafd2f['secondtransfereruniqueid'];queues[_0xbafd2f['origtransfererlinkedid']][_0xc570('0x9')]=_0xc570('0x59');}if(!_[_0xc570('0x25')](queues[_0xbafd2f[_0xc570('0x54')]])){if(_0xbafd2f['transfertargetlinkedid']&&queues[_0xbafd2f['transfertargetlinkedid']]){queues[_0xbafd2f[_0xc570('0x62')]][_0xc570('0x22')]=0x1;queues[_0xbafd2f[_0xc570('0x5c')]]=_[_0xc570('0x5b')](queues[_0xbafd2f['transfertargetlinkedid']]);queues[_0xbafd2f['transfertargetuniqueid']][_0xc570('0xf')]=_0xbafd2f['transfertargetuniqueid'];queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x22')]=0x2;queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x7')]=queues[_0xbafd2f[_0xc570('0x60')]]['calleridnum'];queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x5d')]=queues[_0xbafd2f[_0xc570('0x60')]]['calleridname'];queues[_0xbafd2f[_0xc570('0x5c')]]['queuecallerjoinAt']=utils[_0xc570('0x16')]();queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x1a')]=utils[_0xc570('0x16')]();queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x37')]=0x0;queues[_0xbafd2f[_0xc570('0x5c')]]['mohtime']=0x0;utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x63'),_0xbafd2f['origtransfereruniqueid'],queues[_0xbafd2f['transfertargetuniqueid']]['name'],queues[_0xbafd2f['transfertargetuniqueid']][_0xc570('0xf')],queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x7')],queues[_0xbafd2f[_0xc570('0x5c')]]['calleridname']));}else{utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x5f'),_0xbafd2f[_0xc570('0x53')],queues[_0xbafd2f['secondtransfererlinkedid']][_0xc570('0x21')],_0xbafd2f[_0xc570('0x60')]));queues[_0xbafd2f[_0xc570('0x54')]][_0xc570('0xf')]=_0xbafd2f['origtransfererlinkedid'];}}}}catch(_0x45b0ff){utils[_0xc570('0x17')](util[_0xc570('0x3')](_0xc570('0x52'),_0xbafd2f[_0xc570('0x53')]),_0x45b0ff);}};exports['musiconholdstart']=function(_0xf9bc1c){try{if(!_[_0xc570('0x25')](queues[_0xf9bc1c[_0xc570('0x10')]])){utils['debug'](util[_0xc570('0x3')](_0xc570('0x64'),_0xf9bc1c[_0xc570('0x10')]),_0xf9bc1c);queues[_0xf9bc1c[_0xc570('0x10')]][_0xc570('0x65')]=utils[_0xc570('0x16')]();utils['info'](util[_0xc570('0x3')](_0xc570('0x66'),_0xf9bc1c['uniqueid'],queues[_0xf9bc1c[_0xc570('0x10')]][_0xc570('0x21')],queues[_0xf9bc1c[_0xc570('0x10')]][_0xc570('0x65')]));}}catch(_0x442efd){utils[_0xc570('0x17')](util[_0xc570('0x3')](_0xc570('0x64'),_0xf9bc1c[_0xc570('0x10')]),_0x442efd);}};exports[_0xc570('0x67')]=function(_0xd1b918){try{if(!_['isNil'](queues[_0xd1b918['uniqueid']])){if(!_[_0xc570('0x25')](queues[_0xd1b918[_0xc570('0x10')]][_0xc570('0x65')])){utils[_0xc570('0x11')](util[_0xc570('0x3')](_0xc570('0x68'),_0xd1b918[_0xc570('0x10')]),_0xd1b918);queues[_0xd1b918[_0xc570('0x10')]]['mohtime']+=utils['diffTime'](utils[_0xc570('0x16')](),queues[_0xd1b918[_0xc570('0x10')]][_0xc570('0x65')]);utils['info'](util[_0xc570('0x3')](_0xc570('0x69'),_0xd1b918[_0xc570('0x10')],queues[_0xd1b918[_0xc570('0x10')]][_0xc570('0x21')],queues[_0xd1b918['uniqueid']][_0xc570('0x6a')]));delete queues[_0xd1b918[_0xc570('0x10')]][_0xc570('0x65')];}}}catch(_0x55302b){utils[_0xc570('0x17')](util[_0xc570('0x3')](_0xc570('0x68'),_0xd1b918[_0xc570('0x10')]),_0x55302b);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 74bc33b..f2c6aa1 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 _0xdc60=['application','toLowerCase','set','startsWith','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','isNil','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','appdata'];(function(_0x50eb3f,_0x44231f){var _0xcad21c=function(_0x52942a){while(--_0x52942a){_0x50eb3f['push'](_0x50eb3f['shift']());}};_0xcad21c(++_0x44231f);}(_0xdc60,0x168));var _0x0dc6=function(_0x2af0bd,_0x30c3ac){_0x2af0bd=_0x2af0bd-0x0;var _0x1f52cd=_0xdc60[_0x2af0bd];return _0x1f52cd;};'use strict';var _=require(_0x0dc6('0x0'));var util=require('util');var utils=require(_0x0dc6('0x1'));var recordings={};function writeDB(_0x2e86f5){utils[_0x0dc6('0x2')](util['format'](_0x0dc6('0x3'),_0x2e86f5[_0x0dc6('0x4')]));if(_0x2e86f5[_0x0dc6('0x5')]){utils[_0x0dc6('0x6')](_0x2e86f5['accountcode'])['then'](function(_0x37e5ea){if(_0x37e5ea){_0x2e86f5[_0x0dc6('0x7')]=_0x37e5ea['name'];_0x2e86f5['UserId']=_0x37e5ea['id'];}utils[_0x0dc6('0x8')](_0x0dc6('0x9'),_0x2e86f5);});}else{utils[_0x0dc6('0x8')](_0x0dc6('0x9'),_0x2e86f5);}}exports['newchannel']=function(_0x44764b){try{utils[_0x0dc6('0xa')](util['format'](_0x0dc6('0xb'),_0x44764b['uniqueid']),_0x44764b);if(_0x44764b[_0x0dc6('0x4')]==_0x44764b[_0x0dc6('0xc')]){utils[_0x0dc6('0x2')](util[_0x0dc6('0xd')](_0x0dc6('0xe'),_0x44764b[_0x0dc6('0x4')],_0x44764b[_0x0dc6('0xf')],_0x44764b[_0x0dc6('0x10')]));recordings[_0x44764b['uniqueid']]={'uniqueid':_0x44764b[_0x0dc6('0x4')],'accountcode':_0x44764b[_0x0dc6('0x5')],'exten':_0x44764b['exten'],'context':_0x44764b[_0x0dc6('0xf')],'channel':_0x44764b[_0x0dc6('0x11')],'monitors':[]};}}catch(_0x47983a){utils[_0x0dc6('0x12')](util[_0x0dc6('0xd')](_0x0dc6('0xb'),_0x44764b[_0x0dc6('0x4')]),_0x47983a);}};exports['newstate']=function(_0x23e8c0){try{utils[_0x0dc6('0xa')](util[_0x0dc6('0xd')]('[%s][recordings][newstate]',_0x23e8c0['uniqueid']),_0x23e8c0);if(!_[_0x0dc6('0x13')](recordings[_0x23e8c0['uniqueid']])&&_0x23e8c0[_0x0dc6('0x14')]==0x6){utils[_0x0dc6('0x2')](util[_0x0dc6('0xd')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x23e8c0[_0x0dc6('0x4')],_0x23e8c0[_0x0dc6('0xf')],_0x23e8c0['channel']));}else if(!_[_0x0dc6('0x13')](recordings[_0x23e8c0[_0x0dc6('0xc')]])&&_0x23e8c0[_0x0dc6('0x14')]==0x6&&_0x23e8c0[_0x0dc6('0xf')]!='transfer'){utils['info'](util['format'](_0x0dc6('0x15'),_0x23e8c0['uniqueid'],_0x23e8c0['linkedid'],_0x23e8c0[_0x0dc6('0xf')],_0x23e8c0[_0x0dc6('0x11')]));recordings[_0x23e8c0[_0x0dc6('0xc')]][_0x0dc6('0x5')]=_0x23e8c0['accountcode'];}}catch(_0x3811d8){utils[_0x0dc6('0x12')](util[_0x0dc6('0xd')]('[%s][recordings][newstate]',_0x23e8c0['uniqueid']),_0x3811d8);}};exports[_0x0dc6('0x16')]=function(_0x1da4e5){try{if(!_[_0x0dc6('0x13')](_0x1da4e5[_0x0dc6('0x17')])&&!_[_0x0dc6('0x13')](_0x1da4e5[_0x0dc6('0x17')][_0x0dc6('0x18')])){utils[_0x0dc6('0xa')](util['format'](_0x0dc6('0x19'),_0x1da4e5['uniqueid']),_0x1da4e5);utils[_0x0dc6('0x2')](util[_0x0dc6('0xd')](_0x0dc6('0x1a'),_0x1da4e5[_0x0dc6('0x4')],_0x1da4e5['variable'],_0x1da4e5[_0x0dc6('0x1b')]));if(_[_0x0dc6('0x1c')](_0x1da4e5[_0x0dc6('0x1b')],'.wav49')){_0x1da4e5['value']=_0x1da4e5['value'][_0x0dc6('0x1d')](_0x0dc6('0x1e'),_0x0dc6('0x1f'));}if(recordings[_0x1da4e5[_0x0dc6('0xc')]]){var _0x5d46cb=_[_0x0dc6('0x20')](recordings[_0x1da4e5[_0x0dc6('0xc')]]['monitors'],{'value':_0x1da4e5[_0x0dc6('0x1b')]});if(_[_0x0dc6('0x13')](_0x5d46cb)){recordings[_0x1da4e5[_0x0dc6('0xc')]][_0x0dc6('0x21')][_0x0dc6('0x22')]({'value':_0x1da4e5[_0x0dc6('0x1b')]});}}}}catch(_0x39d7c1){utils['error'](util['format'](_0x0dc6('0x19'),_0x1da4e5['uniqueid']),_0x39d7c1);}};exports['hangup']=function(_0x46b85e){try{if(!_['isNil'](recordings[_0x46b85e[_0x0dc6('0x4')]])){utils[_0x0dc6('0xa')](util[_0x0dc6('0xd')](_0x0dc6('0x23'),_0x46b85e['uniqueid']),_0x46b85e);utils[_0x0dc6('0x2')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x46b85e[_0x0dc6('0x4')],_0x46b85e[_0x0dc6('0x24')],_0x46b85e[_0x0dc6('0x25')],_0x46b85e[_0x0dc6('0x26')]));recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x24')]=_0x46b85e['calleridnum'];recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x25')]=_0x46b85e[_0x0dc6('0x25')];recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x27')]=_0x46b85e['connectedlinenum'];recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x28')]=_0x46b85e[_0x0dc6('0x28')];if(recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x29')]==_0x0dc6('0x2a')&&recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x5')]){recordings[_0x46b85e['uniqueid']][_0x0dc6('0x27')]=recordings[_0x46b85e['uniqueid']]['accountcode'];recordings[_0x46b85e['uniqueid']]['connectedlinename']='';}recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x21')][_0x0dc6('0x2b')](function(_0xd544b){var _0x4450f9=_['clone'](recordings[_0x46b85e[_0x0dc6('0x4')]]);_0x4450f9[_0x0dc6('0x1b')]=_0xd544b[_0x0dc6('0x1b')];writeDB(_0x4450f9);});delete recordings[_0x46b85e[_0x0dc6('0x4')]];}}catch(_0xafd0af){utils[_0x0dc6('0x12')](util[_0x0dc6('0xd')](_0x0dc6('0x23'),_0x46b85e['uniqueid']),_0xafd0af);}};exports[_0x0dc6('0x2c')]=function(_0x5a72fd){try{if(!_['isNil'](recordings[_0x5a72fd[_0x0dc6('0x4')]])){utils['debug'](util[_0x0dc6('0xd')]('[%s][recordings][newexten]',_0x5a72fd[_0x0dc6('0x4')]),_0x5a72fd);utils[_0x0dc6('0x2')](util[_0x0dc6('0xd')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x5a72fd[_0x0dc6('0x4')],_0x5a72fd['application'],_0x5a72fd[_0x0dc6('0x2d')]));if(_0x5a72fd[_0x0dc6('0x2e')][_0x0dc6('0x2f')]()==_0x0dc6('0x30')&&_[_0x0dc6('0x31')](_0x5a72fd[_0x0dc6('0x2d')][_0x0dc6('0x2f')](),'cdr')){var _0x1b1e52=_0x5a72fd[_0x0dc6('0x2d')][_0x0dc6('0x32')]('=');var _0x1a7ad4=_0x1b1e52[0x0][_0x0dc6('0x33')](_0x1b1e52[0x0][_0x0dc6('0x34')]('(')+0x1,_0x1b1e52[0x0][_0x0dc6('0x34')](')'));var _0x206d33=_0x1b1e52[0x1];recordings[_0x5a72fd[_0x0dc6('0x4')]][_0x1a7ad4]=_0x206d33;}}}catch(_0x4c783f){utils[_0x0dc6('0x12')](util['format'](_0x0dc6('0x35'),_0x5a72fd['uniqueid']),_0x4c783f);}};exports[_0x0dc6('0x36')]=function(_0x561870){try{if(!_[_0x0dc6('0x13')](recordings[_0x561870[_0x0dc6('0x4')]])){utils[_0x0dc6('0xa')](util[_0x0dc6('0xd')](_0x0dc6('0x37'),_0x561870[_0x0dc6('0x4')]),_0x561870);utils[_0x0dc6('0x2')](util[_0x0dc6('0xd')](_0x0dc6('0x38'),_0x561870['uniqueid'],_0x561870[_0x0dc6('0x39')]));recordings[_0x561870['uniqueid']][_0x0dc6('0x39')]=_0x561870[_0x0dc6('0x39')];}}catch(_0x51865c){utils[_0x0dc6('0x12')](util[_0x0dc6('0xd')]('[%s][recordings][queuecallerjoin]',_0x561870[_0x0dc6('0x4')]),_0x51865c);}}; \ No newline at end of file +var _0x5e95=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','membername','name','UserId','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','context','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x5e95,0x19a));var _0x55e9=function(_0x4c7c09,_0x22ece7){_0x4c7c09=_0x4c7c09-0x0;var _0x354454=_0x5e95[_0x4c7c09];return _0x354454;};'use strict';var _=require(_0x55e9('0x0'));var util=require(_0x55e9('0x1'));var utils=require(_0x55e9('0x2'));var recordings={};function writeDB(_0x3be46a){utils[_0x55e9('0x3')](util[_0x55e9('0x4')](_0x55e9('0x5'),_0x3be46a['uniqueid']));if(_0x3be46a[_0x55e9('0x6')]){utils[_0x55e9('0x7')](_0x3be46a[_0x55e9('0x6')])['then'](function(_0x37e78f){if(_0x37e78f){_0x3be46a[_0x55e9('0x8')]=_0x37e78f[_0x55e9('0x9')];_0x3be46a[_0x55e9('0xa')]=_0x37e78f['id'];}utils['request'](_0x55e9('0xb'),_0x3be46a);});}else{utils['request'](_0x55e9('0xb'),_0x3be46a);}}exports[_0x55e9('0xc')]=function(_0x470fc7){try{utils[_0x55e9('0xd')](util[_0x55e9('0x4')](_0x55e9('0xe'),_0x470fc7[_0x55e9('0xf')]),_0x470fc7);if(_0x470fc7[_0x55e9('0xf')]==_0x470fc7['linkedid']){utils['info'](util[_0x55e9('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x470fc7[_0x55e9('0xf')],_0x470fc7[_0x55e9('0x10')],_0x470fc7[_0x55e9('0x11')]));recordings[_0x470fc7[_0x55e9('0xf')]]={'uniqueid':_0x470fc7[_0x55e9('0xf')],'accountcode':_0x470fc7[_0x55e9('0x6')],'exten':_0x470fc7[_0x55e9('0x11')],'context':_0x470fc7[_0x55e9('0x10')],'channel':_0x470fc7[_0x55e9('0x12')],'monitors':[]};}}catch(_0x24d03c){utils[_0x55e9('0x13')](util['format'](_0x55e9('0xe'),_0x470fc7[_0x55e9('0xf')]),_0x24d03c);}};exports[_0x55e9('0x14')]=function(_0x309361){try{utils[_0x55e9('0xd')](util[_0x55e9('0x4')]('[%s][recordings][newstate]',_0x309361[_0x55e9('0xf')]),_0x309361);if(!_[_0x55e9('0x15')](recordings[_0x309361[_0x55e9('0xf')]])&&_0x309361[_0x55e9('0x16')]==0x6){utils[_0x55e9('0x3')](util[_0x55e9('0x4')](_0x55e9('0x17'),_0x309361[_0x55e9('0xf')],_0x309361[_0x55e9('0x10')],_0x309361[_0x55e9('0x12')]));}else if(!_[_0x55e9('0x15')](recordings[_0x309361[_0x55e9('0x18')]])&&_0x309361['channelstate']==0x6&&_0x309361[_0x55e9('0x10')]!=_0x55e9('0x19')){utils[_0x55e9('0x3')](util['format'](_0x55e9('0x1a'),_0x309361[_0x55e9('0xf')],_0x309361[_0x55e9('0x18')],_0x309361[_0x55e9('0x10')],_0x309361[_0x55e9('0x12')]));recordings[_0x309361[_0x55e9('0x18')]][_0x55e9('0x6')]=_0x309361['accountcode'];}}catch(_0x2daa13){utils[_0x55e9('0x13')](util[_0x55e9('0x4')](_0x55e9('0x1b'),_0x309361['uniqueid']),_0x2daa13);}};exports[_0x55e9('0x1c')]=function(_0x1ae53f){try{if(!_[_0x55e9('0x15')](_0x1ae53f[_0x55e9('0x1d')])&&!_[_0x55e9('0x15')](_0x1ae53f['variable'][_0x55e9('0x1e')])){utils[_0x55e9('0xd')](util[_0x55e9('0x4')](_0x55e9('0x1f'),_0x1ae53f[_0x55e9('0xf')]),_0x1ae53f);utils[_0x55e9('0x3')](util[_0x55e9('0x4')](_0x55e9('0x20'),_0x1ae53f[_0x55e9('0xf')],_0x1ae53f[_0x55e9('0x1d')],_0x1ae53f[_0x55e9('0x21')]));if(_[_0x55e9('0x22')](_0x1ae53f['value'],_0x55e9('0x23'))){_0x1ae53f[_0x55e9('0x21')]=_0x1ae53f['value'][_0x55e9('0x24')](_0x55e9('0x23'),_0x55e9('0x25'));}if(recordings[_0x1ae53f['linkedid']]){var _0x1b95c0=_[_0x55e9('0x26')](recordings[_0x1ae53f[_0x55e9('0x18')]]['monitors'],{'value':_0x1ae53f[_0x55e9('0x21')]});if(_[_0x55e9('0x15')](_0x1b95c0)){recordings[_0x1ae53f[_0x55e9('0x18')]][_0x55e9('0x27')][_0x55e9('0x28')]({'value':_0x1ae53f['value']});}}}}catch(_0x17af8f){utils[_0x55e9('0x13')](util[_0x55e9('0x4')]('[%s][recordings][varset]',_0x1ae53f[_0x55e9('0xf')]),_0x17af8f);}};exports[_0x55e9('0x29')]=function(_0x1559a6){try{if(!_['isNil'](recordings[_0x1559a6['uniqueid']])){utils[_0x55e9('0xd')](util[_0x55e9('0x4')](_0x55e9('0x2a'),_0x1559a6[_0x55e9('0xf')]),_0x1559a6);utils['info'](util[_0x55e9('0x4')](_0x55e9('0x2b'),_0x1559a6[_0x55e9('0xf')],_0x1559a6[_0x55e9('0x2c')],_0x1559a6[_0x55e9('0x2d')],_0x1559a6[_0x55e9('0x2e')]));recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x2c')]=_0x1559a6[_0x55e9('0x2c')];recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x2d')]=_0x1559a6[_0x55e9('0x2d')];recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x2f')]=_0x1559a6['connectedlinenum'];recordings[_0x1559a6[_0x55e9('0xf')]]['connectedlinename']=_0x1559a6[_0x55e9('0x30')];if(recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x31')]==_0x55e9('0x32')&&recordings[_0x1559a6['uniqueid']][_0x55e9('0x6')]){recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x2f')]=recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x6')];recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x30')]='';}recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x27')][_0x55e9('0x33')](function(_0x48d0e8){var _0x264d19=_['clone'](recordings[_0x1559a6[_0x55e9('0xf')]]);_0x264d19[_0x55e9('0x21')]=_0x48d0e8[_0x55e9('0x21')];writeDB(_0x264d19);});delete recordings[_0x1559a6[_0x55e9('0xf')]];}}catch(_0x237a6b){utils[_0x55e9('0x13')](util['format']('[%s][recordings][hangup]',_0x1559a6['uniqueid']),_0x237a6b);}};exports['newexten']=function(_0x45bd6e){try{if(!_[_0x55e9('0x15')](recordings[_0x45bd6e[_0x55e9('0xf')]])){utils[_0x55e9('0xd')](util[_0x55e9('0x4')]('[%s][recordings][newexten]',_0x45bd6e[_0x55e9('0xf')]),_0x45bd6e);utils[_0x55e9('0x3')](util[_0x55e9('0x4')](_0x55e9('0x34'),_0x45bd6e[_0x55e9('0xf')],_0x45bd6e[_0x55e9('0x35')],_0x45bd6e[_0x55e9('0x36')]));if(_0x45bd6e['application'][_0x55e9('0x37')]()==_0x55e9('0x38')&&_['startsWith'](_0x45bd6e[_0x55e9('0x36')][_0x55e9('0x37')](),_0x55e9('0x39'))){var _0x29590f=_0x45bd6e[_0x55e9('0x36')]['split']('=');var _0xf67e32=_0x29590f[0x0]['substring'](_0x29590f[0x0]['lastIndexOf']('(')+0x1,_0x29590f[0x0][_0x55e9('0x3a')](')'));var _0x10b27c=_0x29590f[0x1];recordings[_0x45bd6e[_0x55e9('0xf')]][_0xf67e32]=_0x10b27c;}}}catch(_0x173f73){utils[_0x55e9('0x13')](util[_0x55e9('0x4')](_0x55e9('0x3b'),_0x45bd6e[_0x55e9('0xf')]),_0x173f73);}};exports[_0x55e9('0x3c')]=function(_0x5c5098){try{if(!_['isNil'](recordings[_0x5c5098[_0x55e9('0xf')]])){utils[_0x55e9('0xd')](util['format']('[%s][recordings][queuecallerjoin]',_0x5c5098[_0x55e9('0xf')]),_0x5c5098);utils['info'](util['format'](_0x55e9('0x3d'),_0x5c5098[_0x55e9('0xf')],_0x5c5098[_0x55e9('0x3e')]));recordings[_0x5c5098['uniqueid']][_0x55e9('0x3e')]=_0x5c5098[_0x55e9('0x3e')];}}catch(_0x41fc23){utils[_0x55e9('0x13')](util[_0x55e9('0x4')]('[%s][recordings][queuecallerjoin]',_0x5c5098['uniqueid']),_0x41fc23);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 934af8f..5280ccb 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 _0xad13=['info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','lodash','./utils'];(function(_0x4805be,_0x459696){var _0x222db3=function(_0x446fff){while(--_0x446fff){_0x4805be['push'](_0x4805be['shift']());}};_0x222db3(++_0x459696);}(_0xad13,0x79));var _0x3ad1=function(_0x278bce,_0x3b0dee){_0x278bce=_0x278bce-0x0;var _0xf355d6=_0xad13[_0x278bce];return _0xf355d6;};'use strict';var _=require(_0x3ad1('0x0'));var util=require('util');var utils=require(_0x3ad1('0x1'));function writeDB(_0x201a15){utils[_0x3ad1('0x2')](util[_0x3ad1('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x201a15[_0x3ad1('0x4')]===_0x3ad1('0x5')?_0x201a15[_0x3ad1('0x6')]:_0x201a15[_0x3ad1('0x7')],_0x201a15[_0x3ad1('0x4')]));utils[_0x3ad1('0x8')](_0x3ad1('0x9'),_0x201a15);}exports[_0x3ad1('0xa')]=function(_0x44fd50){try{utils[_0x3ad1('0xb')](util['format'](_0x3ad1('0xc'),_0x44fd50[_0x3ad1('0x7')]),_0x44fd50);utils[_0x3ad1('0x2')](util['format'](_0x3ad1('0xd'),_0x44fd50[_0x3ad1('0x7')],_0x44fd50['transferercalleridnum'],_0x44fd50[_0x3ad1('0xe')],_0x44fd50[_0x3ad1('0xf')],_0x44fd50[_0x3ad1('0x10')]));_0x44fd50[_0x3ad1('0x4')]=_0x3ad1('0x11');writeDB(_0x44fd50);}catch(_0x3bcab7){utils['error'](util['format'](_0x3ad1('0xc'),_0x44fd50[_0x3ad1('0x7')]),_0x3bcab7);}};exports[_0x3ad1('0x12')]=function(_0x3eadf8){try{utils['debug'](util[_0x3ad1('0x3')]('[%s][transfers][attendedtransfer]',_0x3eadf8[_0x3ad1('0x6')]),_0x3eadf8);utils[_0x3ad1('0x2')](util[_0x3ad1('0x3')](_0x3ad1('0x13'),_0x3eadf8[_0x3ad1('0x6')],_0x3eadf8[_0x3ad1('0x14')],_0x3eadf8[_0x3ad1('0x15')],_0x3eadf8[_0x3ad1('0x16')],_0x3eadf8[_0x3ad1('0x17')]));_0x3eadf8=_[_0x3ad1('0x18')](_0x3eadf8,{'transfererchannel':_0x3eadf8[_0x3ad1('0x19')],'transferercalleridnum':_0x3eadf8[_0x3ad1('0x14')],'transferercalleridname':_0x3eadf8['origtransferercalleridname'],'transfererconnectedlinenum':_0x3eadf8[_0x3ad1('0x1a')],'transfererconnectedlinename':_0x3eadf8[_0x3ad1('0x1b')],'transfereraccountcode':_0x3eadf8[_0x3ad1('0x1c')],'transferercontext':_0x3eadf8[_0x3ad1('0x1d')],'transfererexten':_0x3eadf8[_0x3ad1('0x1e')],'transfererlinkedid':_0x3eadf8['origtransfererlinkedid'],'context':_0x3eadf8[_0x3ad1('0x1f')],'extension':_0x3eadf8[_0x3ad1('0x20')],'type':'attended'});if(_[_0x3ad1('0x21')](_0x3eadf8[_0x3ad1('0x22')])){_0x3eadf8=_[_0x3ad1('0x18')](_0x3eadf8,{'transfereechannel':_0x3eadf8[_0x3ad1('0x23')],'transfereecalleridnum':_0x3eadf8[_0x3ad1('0x16')],'transfereecalleridname':_0x3eadf8[_0x3ad1('0x17')],'transfereeconnectedlinenum':_0x3eadf8['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3eadf8[_0x3ad1('0x24')],'transfereeaccountcode':_0x3eadf8['transfertargetaccountcode'],'transfereecontext':_0x3eadf8[_0x3ad1('0x25')],'transfereeexten':_0x3eadf8['transfertargetexten'],'transfereelinkedid':_0x3eadf8[_0x3ad1('0x26')]});}writeDB(_0x3eadf8);}catch(_0x34df3d){utils[_0x3ad1('0x27')](util[_0x3ad1('0x3')](_0x3ad1('0x28'),_0x3eadf8[_0x3ad1('0x6')]),_0x34df3d);}}; \ No newline at end of file +var _0x4453=['origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererlinkedid','origtransferercontext','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','util','./utils','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blindtransfer','debug','format','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign'];(function(_0x2162c6,_0x2f9642){var _0x140e0d=function(_0x4b9df8){while(--_0x4b9df8){_0x2162c6['push'](_0x2162c6['shift']());}};_0x140e0d(++_0x2f9642);}(_0x4453,0x11d));var _0x3445=function(_0x42b931,_0x3b67f1){_0x42b931=_0x42b931-0x0;var _0x3cd6a2=_0x4453[_0x42b931];return _0x3cd6a2;};'use strict';var _=require('lodash');var util=require(_0x3445('0x0'));var utils=require(_0x3445('0x1'));function writeDB(_0x3f30cf){utils['info'](util['format'](_0x3445('0x2'),_0x3f30cf[_0x3445('0x3')]===_0x3445('0x4')?_0x3f30cf[_0x3445('0x5')]:_0x3f30cf[_0x3445('0x6')],_0x3f30cf[_0x3445('0x3')]));utils[_0x3445('0x7')]('CreateVoiceTransferReport',_0x3f30cf);}exports[_0x3445('0x8')]=function(_0x1cf230){try{utils[_0x3445('0x9')](util[_0x3445('0xa')]('[%s][transfers][blindtransfer]',_0x1cf230[_0x3445('0x6')]),_0x1cf230);utils[_0x3445('0xb')](util['format'](_0x3445('0xc'),_0x1cf230['uniqueid'],_0x1cf230[_0x3445('0xd')],_0x1cf230[_0x3445('0xe')],_0x1cf230['transfereecalleridnum'],_0x1cf230[_0x3445('0xf')]));_0x1cf230['type']=_0x3445('0x10');writeDB(_0x1cf230);}catch(_0x402df2){utils[_0x3445('0x11')](util[_0x3445('0xa')](_0x3445('0x12'),_0x1cf230['uniqueid']),_0x402df2);}};exports[_0x3445('0x13')]=function(_0x416fb9){try{utils[_0x3445('0x9')](util[_0x3445('0xa')](_0x3445('0x14'),_0x416fb9[_0x3445('0x5')]),_0x416fb9);utils[_0x3445('0xb')](util[_0x3445('0xa')](_0x3445('0x15'),_0x416fb9['origtransfereruniqueid'],_0x416fb9[_0x3445('0x16')],_0x416fb9[_0x3445('0x17')],_0x416fb9[_0x3445('0x18')],_0x416fb9[_0x3445('0x19')]));_0x416fb9=_[_0x3445('0x1a')](_0x416fb9,{'transfererchannel':_0x416fb9[_0x3445('0x1b')],'transferercalleridnum':_0x416fb9[_0x3445('0x16')],'transferercalleridname':_0x416fb9[_0x3445('0x17')],'transfererconnectedlinenum':_0x416fb9[_0x3445('0x1c')],'transfererconnectedlinename':_0x416fb9[_0x3445('0x1d')],'transfereraccountcode':_0x416fb9['origtransfereraccountcode'],'transferercontext':_0x416fb9['secondtransferercontext'],'transfererexten':_0x416fb9['secondtransfererexten'],'transfererlinkedid':_0x416fb9[_0x3445('0x1e')],'context':_0x416fb9[_0x3445('0x1f')],'extension':_0x416fb9['origtransfererexten'],'type':'attended'});if(_['isNil'](_0x416fb9[_0x3445('0x20')])){_0x416fb9=_[_0x3445('0x1a')](_0x416fb9,{'transfereechannel':_0x416fb9[_0x3445('0x21')],'transfereecalleridnum':_0x416fb9[_0x3445('0x18')],'transfereecalleridname':_0x416fb9[_0x3445('0x19')],'transfereeconnectedlinenum':_0x416fb9[_0x3445('0x22')],'transfereeconnectedlinename':_0x416fb9[_0x3445('0x23')],'transfereeaccountcode':_0x416fb9[_0x3445('0x24')],'transfereecontext':_0x416fb9['transfertargetcontext'],'transfereeexten':_0x416fb9[_0x3445('0x25')],'transfereelinkedid':_0x416fb9[_0x3445('0x26')]});}writeDB(_0x416fb9);}catch(_0xb598dd){utils[_0x3445('0x11')](util[_0x3445('0xa')](_0x3445('0x14'),_0x416fb9[_0x3445('0x5')]),_0xb598dd);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9f832db..3f1a243 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 _0xabec=['add','YYYY-MM-DD\x20HH:mm:ss','subtract','seconds','format','diffTime','sumTime','now','isAfter','isBefore','jayson/promise','client','http','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime'];(function(_0x4585ee,_0x2f4a68){var _0x14db51=function(_0x35f3f6){while(--_0x35f3f6){_0x4585ee['push'](_0x4585ee['shift']());}};_0x14db51(++_0x2f4a68);}(_0xabec,0x15a));var _0xcabe=function(_0x395928,_0x51afb0){_0x395928=_0x395928-0x0;var _0x4efda4=_0xabec[_0x395928];return _0x4efda4;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xcabe('0x0'));var moment=require('moment');var util=require('util');var client=jayson[_0xcabe('0x1')][_0xcabe('0x2')]({'port':0x2329});var logger=require('../../config/logger')(_0xcabe('0x3'));exports[_0xcabe('0x4')]=function(_0x54e505,_0x27c9fe){logger[_0xcabe('0x4')](_0x54e505,_0x27c9fe?util['inspect'](_0x27c9fe,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x31f103,_0x26099f){logger[_0xcabe('0x5')](_0x31f103,_0x26099f?util[_0xcabe('0x6')](_0x26099f,{'showHidden':![],'depth':null}):'');};exports[_0xcabe('0x7')]=function(_0x5ea1c5,_0x39aff9){logger[_0xcabe('0x7')](_0x5ea1c5,_0x39aff9?util[_0xcabe('0x6')](_0x39aff9,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4d9cdf,_0x4dddd0){return client[_0xcabe('0x8')](_0x4d9cdf,{'body':_0x4dddd0})[_0xcabe('0x9')](function(_0x860756){logger[_0xcabe('0x5')](_0xcabe('0xa'),_0x4d9cdf,_0x860756?util['inspect'](_0x860756,{'showHidden':![],'depth':null}):'');})[_0xcabe('0xb')](function(_0x8484cf){logger[_0xcabe('0x7')](_0xcabe('0xa'),_0x4d9cdf,_0x8484cf?util[_0xcabe('0x6')](_0x8484cf,{'showHidden':![],'depth':null}):'');});};function getUser(_0x41c205){return client[_0xcabe('0x8')](_0xcabe('0xc'),{'options':{'raw':!![],'attributes':['id',_0xcabe('0xd'),_0xcabe('0xe'),_0xcabe('0xf')],'where':_0x41c205,'limit':0x1}})[_0xcabe('0x9')](function(_0x2790fa){logger[_0xcabe('0x5')](_0xcabe('0x10'),JSON[_0xcabe('0x11')](_0x41c205),_0x2790fa?util[_0xcabe('0x6')](_0x2790fa,{'showHidden':![],'depth':null}):'');return _0x2790fa[_0xcabe('0x12')]['length']?_0x2790fa['result'][0x0]:null;});}exports[_0xcabe('0x13')]=function(_0x497c45){return new BPromise(function(_0x5ef260,_0xf8c687){if(_0x497c45){return getUser({'internal':_0x497c45})['then'](function(_0x445fe5){logger['info'](_0xcabe('0x14'),_0x497c45,_0x445fe5?_0xcabe('0x15'):'notfound');return _0x5ef260(_0x445fe5);})[_0xcabe('0xb')](function(_0xba0085){logger[_0xcabe('0x7')](_0xcabe('0x16'),_0xba0085?util[_0xcabe('0x6')](_0xba0085,{'showHidden':![],'depth':null}):'');return _0x5ef260(null);});}return _0x5ef260(null);});};exports[_0xcabe('0x17')]=function(_0x2a7432){return new BPromise(function(_0x28a672,_0x20c7fc){if(_0x2a7432){return getUser({'interface':_0x2a7432})[_0xcabe('0x9')](function(_0x5f3a1f){logger['info'](_0xcabe('0x18'),_0x2a7432,_0x5f3a1f?_0xcabe('0x15'):_0xcabe('0x19'));return _0x28a672(_0x5f3a1f);})[_0xcabe('0xb')](function(_0x495102){logger[_0xcabe('0x7')](_0xcabe('0x1a'),_0x495102?util[_0xcabe('0x6')](_0x495102,{'showHidden':![],'depth':null}):'');return _0x28a672(null);});}return _0x28a672(null);});};exports[_0xcabe('0x1b')]=function(_0x7e26e8){return new BPromise(function(_0x4fc2f9,_0x4240bd){if(_0x7e26e8){return getUser({'name':_0x7e26e8})[_0xcabe('0x9')](function(_0x341fa2){logger['info'](_0xcabe('0x1c'),_0x7e26e8,_0x341fa2?'found':_0xcabe('0x19'));return _0x4fc2f9(_0x341fa2);})['catch'](function(_0x1ecc74){logger[_0xcabe('0x7')](_0xcabe('0x1d'),_0x1ecc74?util['inspect'](_0x1ecc74,{'showHidden':![],'depth':null}):'');return _0x4fc2f9(null);});}return _0x4fc2f9(null);});};exports['getVoiceQueueByName']=function(_0x38a9c3){return new BPromise(function(_0x838bd8,_0x34b32f){if(_0x38a9c3){return client[_0xcabe('0x8')](_0xcabe('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xcabe('0xe'),_0xcabe('0x1f'),_0xcabe('0x20'),_0xcabe('0x21')],'where':{'name':_0x38a9c3},'limit':0x1}})[_0xcabe('0x9')](function(_0x257edd){logger[_0xcabe('0x5')]('[utils][getVoiceQueueByName]\x20name:%s',_0x38a9c3,_0x257edd?util['inspect'](_0x257edd,{'showHidden':![],'depth':null}):'');logger['info'](_0xcabe('0x22'),_0x38a9c3,_0x257edd?_0xcabe('0x15'):_0xcabe('0x19'));return _0x838bd8(_0x257edd['result'][_0xcabe('0x23')]?_0x257edd[_0xcabe('0x12')][0x0]:null);})[_0xcabe('0xb')](function(_0x39f0be){logger[_0xcabe('0x7')](_0xcabe('0x24'),_0x39f0be?util[_0xcabe('0x6')](_0x39f0be,{'showHidden':![],'depth':null}):'');return _0x838bd8(null);});}return _0x838bd8(null);});};exports[_0xcabe('0x25')]=function(_0x398e19,_0x47662f){return moment(_0x398e19)[_0xcabe('0x26')](_0x47662f,'seconds')['format'](_0xcabe('0x27'));};exports['subtractTime']=function(_0x59db8e,_0x334dae){return moment(_0x59db8e)[_0xcabe('0x28')](_0x334dae,_0xcabe('0x29'))[_0xcabe('0x2a')](_0xcabe('0x27'));};exports[_0xcabe('0x2b')]=function(_0xbee8be,_0x2ff90d){return moment(_0xbee8be)['diff'](moment(_0x2ff90d),_0xcabe('0x29'));};exports[_0xcabe('0x2c')]=function(_0x161399,_0x2ccf1d){return parseInt(_0x161399,0xa)+parseInt(_0x2ccf1d,0xa);};exports[_0xcabe('0x2d')]=function(){return moment()['format'](_0xcabe('0x27'));};exports[_0xcabe('0x2e')]=function(_0x1adfda,_0x6cc521){if(_0x6cc521){return moment(_0x1adfda)[_0xcabe('0x2e')](_0x6cc521);}return!![];};exports[_0xcabe('0x2f')]=function(_0x5612c4,_0x41c7e6){if(_0x41c7e6){return moment(_0x5612c4)[_0xcabe('0x2f')](_0x41c7e6);}else if(_0x5612c4){return!![];}return![];}; \ No newline at end of file +var _0xfde2=['addTime','subtractTime','subtract','seconds','format','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','request','catch','error','GetUser','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','then','[utils][getUserByInterface]','getUserByName','getVoiceQueueByName','name','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]'];(function(_0x39f679,_0x1095a9){var _0x28a9f8=function(_0x122a5b){while(--_0x122a5b){_0x39f679['push'](_0x39f679['shift']());}};_0x28a9f8(++_0x1095a9);}(_0xfde2,0x86));var _0x2fde=function(_0x13c2cf,_0x568ba5){_0x13c2cf=_0x13c2cf-0x0;var _0x237785=_0xfde2[_0x13c2cf];return _0x237785;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x2fde('0x0'));var moment=require(_0x2fde('0x1'));var util=require('util');var client=jayson[_0x2fde('0x2')][_0x2fde('0x3')]({'port':0x2329});var logger=require(_0x2fde('0x4'))(_0x2fde('0x5'));exports[_0x2fde('0x6')]=function(_0xeeba70,_0x31c175){logger['info'](_0xeeba70,_0x31c175?util[_0x2fde('0x7')](_0x31c175,{'showHidden':![],'depth':null}):'');};exports[_0x2fde('0x8')]=function(_0x332d57,_0x4a4854){logger[_0x2fde('0x8')](_0x332d57,_0x4a4854?util[_0x2fde('0x7')](_0x4a4854,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x269e5e,_0x599bf6){logger['error'](_0x269e5e,_0x599bf6?util[_0x2fde('0x7')](_0x599bf6,{'showHidden':![],'depth':null}):'');};exports[_0x2fde('0x9')]=function(_0x3f3e53,_0x2e724d){return client['request'](_0x3f3e53,{'body':_0x2e724d})['then'](function(_0x433a97){logger[_0x2fde('0x8')]('[utils][request]\x20name:%s',_0x3f3e53,_0x433a97?util[_0x2fde('0x7')](_0x433a97,{'showHidden':![],'depth':null}):'');})[_0x2fde('0xa')](function(_0xf4f7ec){logger[_0x2fde('0xb')]('[utils][request]\x20name:%s',_0x3f3e53,_0xf4f7ec?util[_0x2fde('0x7')](_0xf4f7ec,{'showHidden':![],'depth':null}):'');});};function getUser(_0x314774){return client[_0x2fde('0x9')](_0x2fde('0xc'),{'options':{'raw':!![],'attributes':['id','internal','name',_0x2fde('0xd')],'where':_0x314774,'limit':0x1}})['then'](function(_0xd629de){logger[_0x2fde('0x8')](_0x2fde('0xe'),JSON['stringify'](_0x314774),_0xd629de?util[_0x2fde('0x7')](_0xd629de,{'showHidden':![],'depth':null}):'');return _0xd629de[_0x2fde('0xf')][_0x2fde('0x10')]?_0xd629de[_0x2fde('0xf')][0x0]:null;});}exports[_0x2fde('0x11')]=function(_0x171c89){return new BPromise(function(_0x47a801,_0x379dd4){if(_0x171c89){return getUser({'internal':_0x171c89})['then'](function(_0x1f4fbf){logger[_0x2fde('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x171c89,_0x1f4fbf?_0x2fde('0x12'):_0x2fde('0x13'));return _0x47a801(_0x1f4fbf);})['catch'](function(_0x39d69d){logger['error'](_0x2fde('0x14'),_0x39d69d?util[_0x2fde('0x7')](_0x39d69d,{'showHidden':![],'depth':null}):'');return _0x47a801(null);});}return _0x47a801(null);});};exports[_0x2fde('0x15')]=function(_0x495278){return new BPromise(function(_0x18425c,_0x119886){if(_0x495278){return getUser({'interface':_0x495278})[_0x2fde('0x16')](function(_0x1ef013){logger[_0x2fde('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x495278,_0x1ef013?_0x2fde('0x12'):_0x2fde('0x13'));return _0x18425c(_0x1ef013);})[_0x2fde('0xa')](function(_0x19b09d){logger[_0x2fde('0xb')](_0x2fde('0x17'),_0x19b09d?util[_0x2fde('0x7')](_0x19b09d,{'showHidden':![],'depth':null}):'');return _0x18425c(null);});}return _0x18425c(null);});};exports[_0x2fde('0x18')]=function(_0x253165){return new BPromise(function(_0x3094a6,_0x39951e){if(_0x253165){return getUser({'name':_0x253165})[_0x2fde('0x16')](function(_0x548100){logger[_0x2fde('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x253165,_0x548100?'found':_0x2fde('0x13'));return _0x3094a6(_0x548100);})[_0x2fde('0xa')](function(_0x35c1e7){logger[_0x2fde('0xb')]('[utils][getUserByName]',_0x35c1e7?util[_0x2fde('0x7')](_0x35c1e7,{'showHidden':![],'depth':null}):'');return _0x3094a6(null);});}return _0x3094a6(null);});};exports[_0x2fde('0x19')]=function(_0x517d09){return new BPromise(function(_0x1530d3,_0x1cf6a4){if(_0x517d09){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x2fde('0x1a'),_0x2fde('0x1b'),'acw','acwTimeout'],'where':{'name':_0x517d09},'limit':0x1}})['then'](function(_0x4336c3){logger['debug'](_0x2fde('0x1c'),_0x517d09,_0x4336c3?util[_0x2fde('0x7')](_0x4336c3,{'showHidden':![],'depth':null}):'');logger[_0x2fde('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x517d09,_0x4336c3?_0x2fde('0x12'):_0x2fde('0x13'));return _0x1530d3(_0x4336c3['result'][_0x2fde('0x10')]?_0x4336c3[_0x2fde('0xf')][0x0]:null);})[_0x2fde('0xa')](function(_0x150f3c){logger['error'](_0x2fde('0x1d'),_0x150f3c?util[_0x2fde('0x7')](_0x150f3c,{'showHidden':![],'depth':null}):'');return _0x1530d3(null);});}return _0x1530d3(null);});};exports[_0x2fde('0x1e')]=function(_0x2e826a,_0x5d79a1){return moment(_0x2e826a)['add'](_0x5d79a1,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2fde('0x1f')]=function(_0x570196,_0x560a12){return moment(_0x570196)[_0x2fde('0x20')](_0x560a12,_0x2fde('0x21'))[_0x2fde('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2fde('0x23')]=function(_0x520fd9,_0x38f3f8){return moment(_0x520fd9)[_0x2fde('0x24')](moment(_0x38f3f8),_0x2fde('0x21'));};exports[_0x2fde('0x25')]=function(_0x2bbec7,_0x298f2f){return parseInt(_0x2bbec7,0xa)+parseInt(_0x298f2f,0xa);};exports[_0x2fde('0x26')]=function(){return moment()[_0x2fde('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2fde('0x27')]=function(_0x154e2b,_0x5357c7){if(_0x5357c7){return moment(_0x154e2b)[_0x2fde('0x27')](_0x5357c7);}return!![];};exports[_0x2fde('0x28')]=function(_0x53650f,_0x454f4b){if(_0x454f4b){return moment(_0x53650f)['isBefore'](_0x454f4b);}else if(_0x53650f){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 95c0a7f..40bff7d 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 _0x65ed=['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)','format','method','x-forwarded-for','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','client','name','user','data','api','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','headers','connection','remoteAddress','url','statusCode','responseTime','role'];(function(_0x2a610e,_0x22b737){var _0x257194=function(_0x271f9e){while(--_0x271f9e){_0x2a610e['push'](_0x2a610e['shift']());}};_0x257194(++_0x22b737);}(_0x65ed,0x131));var _0xd65e=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x65ed[_0x25fa5c];return _0x1bade2;};var fs=require(_0xd65e('0x0'));var _=require(_0xd65e('0x1'));var ewinston=require(_0xd65e('0x2'));var path=require(_0xd65e('0x3'));var util=require(_0xd65e('0x4'));var fileLogger=require(_0xd65e('0x5'))[_0xd65e('0x6')];var safeTemplate=require(_0xd65e('0x7'))[_0xd65e('0x8')];var maskSensitiveData=require(_0xd65e('0x9'))['maskSensitiveData'];function ClientSideLogger(){function _0x5d2239(_0x167175){var _0x276a0d=path[_0xd65e('0xa')](_0xd65e('0xb'),_0xd65e('0xc'),'xcally');var _0x55fdd5=path[_0xd65e('0xa')](_0xd65e('0xd'),_0x167175['role']+'-'+_0x167175[_0xd65e('0xe')]);return fs['ensureDir'](path[_0xd65e('0xa')](_0x276a0d,_0x55fdd5))['then'](function(){var _0x235ba6=fileLogger(_0xd65e('0xd'),path[_0xd65e('0xa')](_0x276a0d,_0x55fdd5));return _0x235ba6;})['catch'](function(_0x45022e){throw _0x45022e;});}this['log']=function(_0x585bb1,_0xceb5ec,_0x3b42e3,_0x215c12){return _0x5d2239(_0x585bb1[_0xd65e('0xf')])['then'](function(_0x36999b){var _0x341ba1=_0x36999b[_0xceb5ec];return _0x341ba1;})['then'](function(_0x3ff1b7){var _0x24fae2=_0x585bb1['user']?_0x585bb1['user']['id']:'no-user';var _0x3a016e=_0x215c12[_0xd65e('0x10')];var _0x489685=_0x215c12['timestamp'];var _0x5b7c3a=new Date(Number(_0x489685));return _0x3ff1b7(_0x24fae2,_0x5b7c3a,_0x3b42e3,_0x3a016e);})['catch'](function(_0x242b7d){fileLogger(_0xd65e('0xd'))['error'](_0x242b7d);});};}function setupLoggers(_0x13a4d3){return new Promise(function(_0x5563b9){var _0x266748=new ClientSideLogger();var _0x19e8f2=fileLogger(_0xd65e('0x11'));var _0x5993d5=fileLogger('auth');_0x13a4d3[_0xd65e('0x12')](_0xd65e('0x13'),_0x266748);_0x13a4d3[_0xd65e('0x14')](ewinston['logger']({'winstonInstance':_0x19e8f2,'meta':![],'statusLevels':!![],'msg':function(_0x187c83,_0x423457){var _0x594b72=_0xd65e('0x15');if(!_[_0xd65e('0x16')](_0x187c83[_0xd65e('0x17')])){_0x594b72+='\x20body=%s';var _0x1240f2=_0x187c83[_0xd65e('0x17')];maskSensitiveData(_0x1240f2);}return safeTemplate(util['format'](_0x594b72,_0x187c83['method'],_0x187c83[_0xd65e('0x18')]['x-forwarded-for']?_0x187c83[_0xd65e('0x18')]['x-forwarded-for']:_0x187c83[_0xd65e('0x19')][_0xd65e('0x1a')]||_0x187c83['ip'],_0x187c83[_0xd65e('0x1b')],_0x423457[_0xd65e('0x1c')],_0x423457[_0xd65e('0x1d')],_0x187c83[_0xd65e('0xf')]?_0x187c83['user']['id']:null,_0x187c83[_0xd65e('0xf')]?_0x187c83[_0xd65e('0xf')]['name']:null,_0x187c83[_0xd65e('0xf')]?_0x187c83[_0xd65e('0xf')][_0xd65e('0x1e')]:null,_0x1240f2?util['inspect'](_0x1240f2,![],null):''));}}));_0x13a4d3['use'](ewinston[_0xd65e('0x1f')]({'winstonInstance':_0x5993d5,'meta':![],'statusLevels':!![],'msg':function(_0x260eae,_0x1db0f2){var _0x14ff05=_0xd65e('0x20');if(_0x260eae[_0xd65e('0x17')]&&_0x260eae[_0xd65e('0x17')][_0xd65e('0x21')]&&_0x260eae['body'][_0xd65e('0x22')]){_0x14ff05=_0xd65e('0x23');}return util[_0xd65e('0x24')](_0x14ff05,_0x260eae[_0xd65e('0x25')],_0x260eae['headers'][_0xd65e('0x26')]?_0x260eae[_0xd65e('0x18')][_0xd65e('0x26')]:_0x260eae[_0xd65e('0x19')][_0xd65e('0x1a')]||_0x260eae['ip'],_0x260eae['url'],_0x1db0f2[_0xd65e('0x1c')],_0x1db0f2[_0xd65e('0x1d')],_0x260eae[_0xd65e('0xf')]?_0x260eae[_0xd65e('0xf')]['id']:null,_0x260eae[_0xd65e('0xf')]?_0x260eae['user'][_0xd65e('0xe')]:null,_0x260eae[_0xd65e('0xf')]?_0x260eae[_0xd65e('0xf')][_0xd65e('0x1e')]:null,_0x260eae[_0xd65e('0x17')]&&_0x260eae['body']['device']?_0x260eae['body'][_0xd65e('0x21')]:_0xd65e('0x27'),_0x260eae['body']&&_0x260eae[_0xd65e('0x17')][_0xd65e('0x22')]?_0x260eae[_0xd65e('0x17')][_0xd65e('0x22')]:'',_0x260eae['body']&&_0x260eae[_0xd65e('0x17')][_0xd65e('0x28')]?_0x260eae['body'][_0xd65e('0x28')]:'');},'ignoreRoute':function(_0x54b728){var _0x19e317=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x19e317['test'](_0x54b728[_0xd65e('0x1b')]);}}));return _0x5563b9();});}exports[_0xd65e('0x29')]=setupLoggers; \ No newline at end of file +var _0xa68d=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','remoteAddress','statusCode','role','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','ensureDir','then','catch','log','user','no-user','data','timestamp','api','auth','set','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','url','responseTime','name','inspect'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa68d,0x14b));var _0xda68=function(_0x37eb74,_0x3ada4c){_0x37eb74=_0x37eb74-0x0;var _0x5667b8=_0xa68d[_0x37eb74];return _0x5667b8;};var fs=require(_0xda68('0x0'));var _=require(_0xda68('0x1'));var ewinston=require(_0xda68('0x2'));var path=require(_0xda68('0x3'));var util=require(_0xda68('0x4'));var fileLogger=require('./loggers')[_0xda68('0x5')];var safeTemplate=require('./safe-template')[_0xda68('0x6')];var maskSensitiveData=require(_0xda68('0x7'))[_0xda68('0x8')];function ClientSideLogger(){function _0x29f8ab(_0xcf5997){var _0x40d418=path[_0xda68('0x9')](_0xda68('0xa'),'log',_0xda68('0xb'));var _0x135099=path['join'](_0xda68('0xc'),_0xcf5997['role']+'-'+_0xcf5997['name']);return fs[_0xda68('0xd')](path[_0xda68('0x9')](_0x40d418,_0x135099))[_0xda68('0xe')](function(){var _0x3e7445=fileLogger(_0xda68('0xc'),path[_0xda68('0x9')](_0x40d418,_0x135099));return _0x3e7445;})[_0xda68('0xf')](function(_0x26fb72){throw _0x26fb72;});}this[_0xda68('0x10')]=function(_0x2abece,_0x396030,_0x59d36b,_0x889841){return _0x29f8ab(_0x2abece['user'])[_0xda68('0xe')](function(_0x3eee3f){var _0x2e9da1=_0x3eee3f[_0x396030];return _0x2e9da1;})[_0xda68('0xe')](function(_0x40d91d){var _0x31012d=_0x2abece[_0xda68('0x11')]?_0x2abece[_0xda68('0x11')]['id']:_0xda68('0x12');var _0xe69951=_0x889841[_0xda68('0x13')];var _0x182c3f=_0x889841[_0xda68('0x14')];var _0x136f1c=new Date(Number(_0x182c3f));return _0x40d91d(_0x31012d,_0x136f1c,_0x59d36b,_0xe69951);})[_0xda68('0xf')](function(_0x34846d){fileLogger(_0xda68('0xc'))['error'](_0x34846d);});};}function setupLoggers(_0x4189b6){return new Promise(function(_0x5056cf){var _0x55d22d=new ClientSideLogger();var _0x9b636c=fileLogger(_0xda68('0x15'));var _0xe7a1f1=fileLogger(_0xda68('0x16'));_0x4189b6[_0xda68('0x17')]('client-side-logger',_0x55d22d);_0x4189b6['use'](ewinston[_0xda68('0x18')]({'winstonInstance':_0x9b636c,'meta':![],'statusLevels':!![],'msg':function(_0x2dd9a0,_0x50ab3e){var _0x1a5a03=_0xda68('0x19');if(!_[_0xda68('0x1a')](_0x2dd9a0[_0xda68('0x1b')])){_0x1a5a03+='\x20body=%s';var _0x48a4ad=_0x2dd9a0[_0xda68('0x1b')];maskSensitiveData(_0x48a4ad);}return safeTemplate(util[_0xda68('0x1c')](_0x1a5a03,_0x2dd9a0[_0xda68('0x1d')],_0x2dd9a0[_0xda68('0x1e')][_0xda68('0x1f')]?_0x2dd9a0[_0xda68('0x1e')][_0xda68('0x1f')]:_0x2dd9a0[_0xda68('0x20')]['remoteAddress']||_0x2dd9a0['ip'],_0x2dd9a0[_0xda68('0x21')],_0x50ab3e['statusCode'],_0x50ab3e[_0xda68('0x22')],_0x2dd9a0[_0xda68('0x11')]?_0x2dd9a0[_0xda68('0x11')]['id']:null,_0x2dd9a0[_0xda68('0x11')]?_0x2dd9a0[_0xda68('0x11')][_0xda68('0x23')]:null,_0x2dd9a0[_0xda68('0x11')]?_0x2dd9a0[_0xda68('0x11')]['role']:null,_0x48a4ad?util[_0xda68('0x24')](_0x48a4ad,![],null):''));}}));_0x4189b6['use'](ewinston[_0xda68('0x18')]({'winstonInstance':_0xe7a1f1,'meta':![],'statusLevels':!![],'msg':function(_0x5e33a7,_0x2e9df4){var _0x14837e=_0xda68('0x25');if(_0x5e33a7[_0xda68('0x1b')]&&_0x5e33a7[_0xda68('0x1b')][_0xda68('0x26')]&&_0x5e33a7[_0xda68('0x1b')][_0xda68('0x27')]){_0x14837e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x14837e,_0x5e33a7[_0xda68('0x1d')],_0x5e33a7[_0xda68('0x1e')][_0xda68('0x1f')]?_0x5e33a7['headers'][_0xda68('0x1f')]:_0x5e33a7['connection'][_0xda68('0x28')]||_0x5e33a7['ip'],_0x5e33a7['url'],_0x2e9df4[_0xda68('0x29')],_0x2e9df4[_0xda68('0x22')],_0x5e33a7[_0xda68('0x11')]?_0x5e33a7[_0xda68('0x11')]['id']:null,_0x5e33a7[_0xda68('0x11')]?_0x5e33a7[_0xda68('0x11')][_0xda68('0x23')]:null,_0x5e33a7['user']?_0x5e33a7['user'][_0xda68('0x2a')]:null,_0x5e33a7[_0xda68('0x1b')]&&_0x5e33a7[_0xda68('0x1b')][_0xda68('0x26')]?_0x5e33a7['body']['device']:'other',_0x5e33a7['body']&&_0x5e33a7[_0xda68('0x1b')][_0xda68('0x27')]?_0x5e33a7[_0xda68('0x1b')][_0xda68('0x27')]:'',_0x5e33a7[_0xda68('0x1b')]&&_0x5e33a7[_0xda68('0x1b')]['agent_name']?_0x5e33a7[_0xda68('0x1b')][_0xda68('0x2b')]:'');},'ignoreRoute':function(_0x3ca415){var _0x422891=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x422891[_0xda68('0x2c')](_0x3ca415[_0xda68('0x21')]);}}));return _0x5056cf();});}exports[_0xda68('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 65487f8..077e119 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x258f=['includes','date','daysInMonth','max','min','format','monthCompare','isMoment','split','padStart','length','iftime','lodash','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','toLowerCase','indexOf','slice','monthsShort','exports','clone','hours','minutes','isBefore','startOf','day','endOf','timeCompare','ddd'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x258f,0xd8));var _0xf258=function(_0x49e59d,_0x3c2a43){_0x49e59d=_0x49e59d-0x0;var _0x2e1f9e=_0x258f[_0x49e59d];return _0x2e1f9e;};var _=require(_0xf258('0x0'));var moment=require(_0xf258('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][_0xf258('0x2')](function(_0x56fb08){return _0x56fb08[_0xf258('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xf258('0x4');var EINVALID_DATE=_0xf258('0x5');function throwIfDateNotValid(_0x4373de){if(!_0x4373de[_0xf258('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xf81ffb){var _0x25811e=_0xf81ffb['split'](':')[_0xf258('0x2')](function(_0x47b9a9){return parseInt(_0x47b9a9,0xa);});var _0x1916cb=_0x25811e[0x0];var _0x151d87=_0x25811e[0x1];if(_0x1916cb<0x0||_0x1916cb>0x17||_0x151d87<0x0||_0x151d87>0x3b){throw new Error(EINVALID_DATE);}return[_0x1916cb,_0x151d87];}function circularDoWInterval(_0xb988e6,_0x43fe0e){if(_0xb988e6===_0x43fe0e){return[_0xb988e6];}else{var _0x504b94=moment[_0xf258('0x7')]();moment[_0xf258('0x7')]('en');var _0x541fec=moment['weekdaysShort']()['map'](function(_0x4bbdef){return _0x4bbdef[_0xf258('0x8')]();});moment[_0xf258('0x7')](_0x504b94);var _0x24e516=_0x541fec[_0xf258('0x9')](_0xb988e6);var _0x3974ed=_0x541fec[_0xf258('0x9')](_0x43fe0e);if(_0x3974ed>_0x24e516){return _0x541fec[_0xf258('0xa')](_0x24e516,_0x3974ed+0x1);}else{var _0x19c777=_0x541fec['slice'](0x0,_0x3974ed+0x1);var _0x5b0e35=_0x541fec[_0xf258('0xa')](_0x24e516);return _0x5b0e35['concat'](_0x19c777);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x356a52,_0x1fadd8){if(_0x356a52===_0x1fadd8){return[_0x356a52];}else{var _0x209dd9=moment[_0xf258('0x7')]();moment[_0xf258('0x7')]('en');var _0xfae27d=moment[_0xf258('0xb')]()[_0xf258('0x2')](function(_0x56c854){return _0x56c854['toLowerCase']();});moment['locale'](_0x209dd9);var _0x357d4f=_0xfae27d[_0xf258('0x9')](_0x356a52);var _0x1a4b6d=_0xfae27d[_0xf258('0x9')](_0x1fadd8);if(_0x1a4b6d>_0x357d4f){return _0xfae27d[_0xf258('0xa')](_0x357d4f,_0x1a4b6d+0x1);}else{var _0x4a62e8=_0xfae27d['slice'](0x0,_0x1a4b6d+0x1);var _0x728c72=_0xfae27d[_0xf258('0xa')](_0x357d4f);return _0x728c72['concat'](_0x4a62e8);}}}module[_0xf258('0xc')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x348739){var _0x2dfe6f=parseInt(_0x348739,0xa);if(_0x2dfe6f<0x1||_0x2dfe6f>0x1f){throw new Error(EINVALID_DATE);}return _0x2dfe6f;}function timeCompare(_0x55f965,_0x5b6c12,_0x8d25a4){var _0x5ada49=_0x55f965['clone']();var _0x462081=extractTime(_0x5b6c12);var _0x1e62b1=_0x462081[0x0];var _0x5b1bc3=_0x462081[0x1];var _0x2fc497=_0x55f965[_0xf258('0xd')]()[_0xf258('0xe')](_0x1e62b1)[_0xf258('0xf')](_0x5b1bc3);throwIfDateNotValid(_0x2fc497);var _0x1753df=extractTime(_0x8d25a4);var _0x52632c=_0x1753df[0x0];var _0x48848f=_0x1753df[0x1];var _0x359fb5=_0x55f965[_0xf258('0xd')]()['hours'](_0x52632c)['minutes'](_0x48848f);throwIfDateNotValid(_0x359fb5);if(_0x359fb5[_0xf258('0x10')](_0x2fc497)){var _0x1656c4=_0x5ada49['clone']()[_0xf258('0x11')](_0xf258('0x12'));var _0x433e3a=_0x5ada49[_0xf258('0xd')]()[_0xf258('0x13')](_0xf258('0x12'));return _0x5ada49['isBetween'](_0x2fc497,_0x433e3a,undefined,'[]')||_0x5ada49['isBetween'](_0x1656c4,_0x359fb5,undefined,'[]');}else{return _0x5ada49['isBetween'](_0x2fc497,_0x359fb5,undefined,'[]');}}module['exports'][_0xf258('0x14')]=timeCompare;function dowCompare(_0x5e55a6,_0xaa6811,_0x5cdaf2){var _0x484ad1=_0x5e55a6[_0xf258('0x7')]('en')['format'](_0xf258('0x15'))[_0xf258('0x8')]();return circularDoWInterval(_0xaa6811,_0x5cdaf2)[_0xf258('0x16')](_0x484ad1);}module[_0xf258('0xc')]['dowCompare']=dowCompare;function domCompare(_0x27c223,_0x4cf691,_0x4a900c){var _0x587ed9=_0x27c223[_0xf258('0x17')]();if(_0x4cf691===_0x4a900c){return _0x587ed9===_0x4cf691;}else{var _0xeb077d=_0x27c223[_0xf258('0x18')]();var _0x57daee=_0x4cf691<_0x4a900c;let _0x5786db=![];var _0x49be33=0x0;var _0x4f5d38=0x0;if(_0x57daee){_0x49be33=Math[_0xf258('0x19')](0x1,_0x4cf691);_0x4f5d38=Math[_0xf258('0x1a')](_0x4a900c,_0xeb077d);_0x5786db=_0x587ed9>=_0x49be33&&_0x587ed9<=_0x4f5d38;}else{_0x49be33=Math[_0xf258('0x1a')](_0x4cf691,_0xeb077d);_0x4f5d38=Math['max'](0x1,_0x4a900c);_0x5786db=_0x587ed9>=_0x49be33||_0x587ed9<=_0x4f5d38;}return _0x5786db;}}module[_0xf258('0xc')]['domCompare']=domCompare;function monthCompare(_0x2ab2c4,_0x4c83ea,_0x5e6e50){var _0x206c41=_0x2ab2c4[_0xf258('0x7')]('en')[_0xf258('0x1b')]('MMM')[_0xf258('0x8')]();return circularMonthInterval(_0x4c83ea,_0x5e6e50)[_0xf258('0x16')](_0x206c41);}module[_0xf258('0xc')][_0xf258('0x1c')]=monthCompare;function iftime(_0x313514,_0x1d5adf=moment['tz']['guess'](),_0x4887b7=moment()){if(!validateRx['test'](_0x313514)){throw new Error(EINVALID_STRING);}else{var _0x2c42a5=(moment[_0xf258('0x1d')](_0x4887b7)?_0x4887b7[_0xf258('0xd')]():moment(_0x4887b7))['tz'](_0x1d5adf)['locale']('en');throwIfDateNotValid(_0x2c42a5);var _0x2aa171=_0x313514[_0xf258('0x1e')](',');var _0x14037b=_0x2aa171[0x0];var _0x9a60ab=_0x2aa171[0x1];var _0x9f8d11=_0x2aa171[0x2];var _0x134141=_0x2aa171[0x3];let _0x3ad5c6=!![];if(_0x14037b!=='*'){var _0x3b10c9=_0x14037b[_0xf258('0x1e')]('-');var _0x1719cc=_[_0xf258('0x1f')](_0x3b10c9[0x0],0x5,'0');var _0x6c9c97=_0x3b10c9[_0xf258('0x20')]===0x2?_[_0xf258('0x1f')](_0x3b10c9[0x1],0x5,'0'):_0x1719cc;_0x3ad5c6=timeCompare(_0x2c42a5,_0x1719cc,_0x6c9c97);}let _0x2ae7a6=!![];if(_0x9a60ab!=='*'){var _0xa93b17=_0x9a60ab['split']('-');var _0x5c5b10=_0xa93b17[0x0];var _0x44c553=_0xa93b17[_0xf258('0x20')]===0x2?_0xa93b17[0x1]:_0x5c5b10;_0x2ae7a6=dowCompare(_0x2c42a5,_0x5c5b10,_0x44c553);}let _0x656507=!![];if(_0x9f8d11!=='*'){var _0x1ff1f7=_0x9f8d11[_0xf258('0x1e')]('-');var _0x26db11=parseDom(_0x1ff1f7[0x0]);var _0x591bb1=_0x1ff1f7[_0xf258('0x20')]===0x2?parseDom(_0x1ff1f7[0x1]):_0x26db11;_0x656507=domCompare(_0x2c42a5,_0x26db11,_0x591bb1);}let _0x33f7e4=!![];if(_0x134141!=='*'){var _0xa86300=_0x134141['split']('-');var _0x2947fd=_0xa86300[0x0];var _0x1e5ee4=_0xa86300[_0xf258('0x20')]===0x2?_0xa86300[0x1]:_0xa86300[0x0];_0x33f7e4=monthCompare(_0x2c42a5,_0x2947fd,_0x1e5ee4);}return _0x3ad5c6&&_0x2ae7a6&&_0x656507&&_0x33f7e4;}}module[_0xf258('0xc')][_0xf258('0x21')]=iftime; \ No newline at end of file +var _0x8e6c=['format','includes','dowCompare','daysInMonth','max','min','domCompare','MMM','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','indexOf','slice','concat','exports','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare'];(function(_0x1e05db,_0x4db865){var _0x2a50da=function(_0x498b08){while(--_0x498b08){_0x1e05db['push'](_0x1e05db['shift']());}};_0x2a50da(++_0x4db865);}(_0x8e6c,0xcb));var _0xc8e6=function(_0x2e09b0,_0x4ffaa1){_0x2e09b0=_0x2e09b0-0x0;var _0x838cb9=_0x8e6c[_0x2e09b0];return _0x838cb9;};var _=require(_0xc8e6('0x0'));var moment=require(_0xc8e6('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][_0xc8e6('0x2')](function(_0x1b706c){return _0x1b706c[_0xc8e6('0x3')];})[_0xc8e6('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xc8e6('0x5');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x3178b4){if(!_0x3178b4[_0xc8e6('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3bf5a6){var _0x2023e1=_0x3bf5a6[_0xc8e6('0x7')](':')[_0xc8e6('0x2')](function(_0x42a74e){return parseInt(_0x42a74e,0xa);});var _0x558c7d=_0x2023e1[0x0];var _0x2b735b=_0x2023e1[0x1];if(_0x558c7d<0x0||_0x558c7d>0x17||_0x2b735b<0x0||_0x2b735b>0x3b){throw new Error(EINVALID_DATE);}return[_0x558c7d,_0x2b735b];}function circularDoWInterval(_0x15bdf6,_0x45ce9b){if(_0x15bdf6===_0x45ce9b){return[_0x15bdf6];}else{var _0x3cb4e8=moment[_0xc8e6('0x8')]();moment['locale']('en');var _0x4822be=moment[_0xc8e6('0x9')]()[_0xc8e6('0x2')](function(_0x18da6c){return _0x18da6c['toLowerCase']();});moment[_0xc8e6('0x8')](_0x3cb4e8);var _0x291d3b=_0x4822be[_0xc8e6('0xa')](_0x15bdf6);var _0x344f21=_0x4822be[_0xc8e6('0xa')](_0x45ce9b);if(_0x344f21>_0x291d3b){return _0x4822be[_0xc8e6('0xb')](_0x291d3b,_0x344f21+0x1);}else{var _0x2a7bff=_0x4822be[_0xc8e6('0xb')](0x0,_0x344f21+0x1);var _0x5c1c42=_0x4822be[_0xc8e6('0xb')](_0x291d3b);return _0x5c1c42[_0xc8e6('0xc')](_0x2a7bff);}}}module[_0xc8e6('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x3f69b4,_0x418171){if(_0x3f69b4===_0x418171){return[_0x3f69b4];}else{var _0x5e9c94=moment[_0xc8e6('0x8')]();moment[_0xc8e6('0x8')]('en');var _0x3bbc5e=moment[_0xc8e6('0xe')]()[_0xc8e6('0x2')](function(_0x565172){return _0x565172[_0xc8e6('0xf')]();});moment[_0xc8e6('0x8')](_0x5e9c94);var _0x4eaeb5=_0x3bbc5e['indexOf'](_0x3f69b4);var _0x3803a9=_0x3bbc5e[_0xc8e6('0xa')](_0x418171);if(_0x3803a9>_0x4eaeb5){return _0x3bbc5e['slice'](_0x4eaeb5,_0x3803a9+0x1);}else{var _0x370757=_0x3bbc5e[_0xc8e6('0xb')](0x0,_0x3803a9+0x1);var _0x7cf86=_0x3bbc5e['slice'](_0x4eaeb5);return _0x7cf86['concat'](_0x370757);}}}module[_0xc8e6('0xd')][_0xc8e6('0x10')]=circularMonthInterval;function parseDom(_0x11ba38){var _0x44b70f=parseInt(_0x11ba38,0xa);if(_0x44b70f<0x1||_0x44b70f>0x1f){throw new Error(EINVALID_DATE);}return _0x44b70f;}function timeCompare(_0x2e2739,_0x280b1d,_0x236cd4){var _0x3051ce=_0x2e2739[_0xc8e6('0x11')]();var _0x4da51c=extractTime(_0x280b1d);var _0x1d7b42=_0x4da51c[0x0];var _0x1c3796=_0x4da51c[0x1];var _0x434507=_0x2e2739[_0xc8e6('0x11')]()[_0xc8e6('0x12')](_0x1d7b42)[_0xc8e6('0x13')](_0x1c3796);throwIfDateNotValid(_0x434507);var _0x2ccbb5=extractTime(_0x236cd4);var _0x1f1e29=_0x2ccbb5[0x0];var _0x13fb9f=_0x2ccbb5[0x1];var _0x5c1a9b=_0x2e2739['clone']()[_0xc8e6('0x12')](_0x1f1e29)['minutes'](_0x13fb9f);throwIfDateNotValid(_0x5c1a9b);if(_0x5c1a9b[_0xc8e6('0x14')](_0x434507)){var _0x2f4d58=_0x3051ce['clone']()[_0xc8e6('0x15')](_0xc8e6('0x16'));var _0x54d4c7=_0x3051ce[_0xc8e6('0x11')]()['endOf'](_0xc8e6('0x16'));return _0x3051ce['isBetween'](_0x434507,_0x54d4c7,undefined,'[]')||_0x3051ce[_0xc8e6('0x17')](_0x2f4d58,_0x5c1a9b,undefined,'[]');}else{return _0x3051ce['isBetween'](_0x434507,_0x5c1a9b,undefined,'[]');}}module[_0xc8e6('0xd')][_0xc8e6('0x18')]=timeCompare;function dowCompare(_0x19581c,_0x3ab14d,_0x1ec0f5){var _0x4a30f9=_0x19581c[_0xc8e6('0x8')]('en')[_0xc8e6('0x19')]('ddd')[_0xc8e6('0xf')]();return circularDoWInterval(_0x3ab14d,_0x1ec0f5)[_0xc8e6('0x1a')](_0x4a30f9);}module[_0xc8e6('0xd')][_0xc8e6('0x1b')]=dowCompare;function domCompare(_0x3f5c9a,_0x45e3c7,_0x414250){var _0x305a0a=_0x3f5c9a['date']();if(_0x45e3c7===_0x414250){return _0x305a0a===_0x45e3c7;}else{var _0x56c7b7=_0x3f5c9a[_0xc8e6('0x1c')]();var _0x24d4ad=_0x45e3c7<_0x414250;let _0x7a9767=![];var _0x5acf19=0x0;var _0x2d5891=0x0;if(_0x24d4ad){_0x5acf19=Math[_0xc8e6('0x1d')](0x1,_0x45e3c7);_0x2d5891=Math[_0xc8e6('0x1e')](_0x414250,_0x56c7b7);_0x7a9767=_0x305a0a>=_0x5acf19&&_0x305a0a<=_0x2d5891;}else{_0x5acf19=Math[_0xc8e6('0x1e')](_0x45e3c7,_0x56c7b7);_0x2d5891=Math[_0xc8e6('0x1d')](0x1,_0x414250);_0x7a9767=_0x305a0a>=_0x5acf19||_0x305a0a<=_0x2d5891;}return _0x7a9767;}}module[_0xc8e6('0xd')][_0xc8e6('0x1f')]=domCompare;function monthCompare(_0x3d2b6c,_0x5146b2,_0x11894c){var _0x1acb13=_0x3d2b6c[_0xc8e6('0x8')]('en')[_0xc8e6('0x19')](_0xc8e6('0x20'))['toLowerCase']();return circularMonthInterval(_0x5146b2,_0x11894c)[_0xc8e6('0x1a')](_0x1acb13);}module[_0xc8e6('0xd')]['monthCompare']=monthCompare;function iftime(_0x30ff69,_0x4b16fe=moment['tz']['guess'](),_0x23e65b=moment()){if(!validateRx[_0xc8e6('0x21')](_0x30ff69)){throw new Error(EINVALID_STRING);}else{var _0x4521d3=(moment[_0xc8e6('0x22')](_0x23e65b)?_0x23e65b[_0xc8e6('0x11')]():moment(_0x23e65b))['tz'](_0x4b16fe)[_0xc8e6('0x8')]('en');throwIfDateNotValid(_0x4521d3);var _0x1f4ec2=_0x30ff69[_0xc8e6('0x7')](',');var _0x55f308=_0x1f4ec2[0x0];var _0x247bdb=_0x1f4ec2[0x1];var _0x3607ea=_0x1f4ec2[0x2];var _0x4b7cb3=_0x1f4ec2[0x3];let _0x5caa2a=!![];if(_0x55f308!=='*'){var _0x4cd79e=_0x55f308[_0xc8e6('0x7')]('-');var _0x1f3035=_[_0xc8e6('0x23')](_0x4cd79e[0x0],0x5,'0');var _0x158506=_0x4cd79e[_0xc8e6('0x24')]===0x2?_[_0xc8e6('0x23')](_0x4cd79e[0x1],0x5,'0'):_0x1f3035;_0x5caa2a=timeCompare(_0x4521d3,_0x1f3035,_0x158506);}let _0x4acb42=!![];if(_0x247bdb!=='*'){var _0x854b9e=_0x247bdb['split']('-');var _0x1de40b=_0x854b9e[0x0];var _0x390716=_0x854b9e['length']===0x2?_0x854b9e[0x1]:_0x1de40b;_0x4acb42=dowCompare(_0x4521d3,_0x1de40b,_0x390716);}let _0x32fc48=!![];if(_0x3607ea!=='*'){var _0x220de0=_0x3607ea['split']('-');var _0x50241a=parseDom(_0x220de0[0x0]);var _0x2f754b=_0x220de0[_0xc8e6('0x24')]===0x2?parseDom(_0x220de0[0x1]):_0x50241a;_0x32fc48=domCompare(_0x4521d3,_0x50241a,_0x2f754b);}let _0x25d276=!![];if(_0x4b7cb3!=='*'){var _0x5f5d31=_0x4b7cb3['split']('-');var _0x308c6d=_0x5f5d31[0x0];var _0x487adb=_0x5f5d31[_0xc8e6('0x24')]===0x2?_0x5f5d31[0x1]:_0x5f5d31[0x0];_0x25d276=monthCompare(_0x4521d3,_0x308c6d,_0x487adb);}return _0x5caa2a&&_0x4acb42&&_0x32fc48&&_0x25d276;}}module[_0xc8e6('0xd')][_0xc8e6('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 3f8a293..03b5616 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c16=['fileLogger','path','moment','winston','debugLevel','toLowerCase','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','format','%s-%s.log','message','{{{','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','}}}','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','transports','Console','warn','File','%s-%s','error','consoleLogger'];(function(_0x2dbdc9,_0x8e3c4){var _0x4521ec=function(_0x4af19e){while(--_0x4af19e){_0x2dbdc9['push'](_0x2dbdc9['shift']());}};_0x4521ec(++_0x8e3c4);}(_0x5c16,0x1bd));var _0x65c1=function(_0xfd433d,_0x206aa2){_0xfd433d=_0xfd433d-0x0;var _0x318571=_0x5c16[_0xfd433d];return _0x318571;};'use strict';var path=require(_0x65c1('0x0'));var util=require('util');var moment=require(_0x65c1('0x1'));var winston=require(_0x65c1('0x2'));var config=require('../config/environment');var debugLevel=config[_0x65c1('0x3')]?config[_0x65c1('0x3')][_0x65c1('0x4')]():'info';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':_0x65c1('0x5'),'error':'red','warn':_0x65c1('0x6'),'info':_0x65c1('0x7'),'print':_0x65c1('0x8'),'success':_0x65c1('0x9'),'http':_0x65c1('0xa'),'verbose':_0x65c1('0xb'),'debug':_0x65c1('0xc'),'silly':'bold\x20cyan'};winston[_0x65c1('0xd')](XC_LOG_COLORS);function getLogFileName(_0x5af649,_0x35a555,_0x178941){var _0x1a062b=_0x5af649||_0x65c1('0xe');return path['join'](_0x1a062b,util[_0x65c1('0xf')](_0x65c1('0x10'),_0x35a555,_0x178941));}function formatter(_0x42f1ed,_0x1cf318){_0x1cf318[_0x65c1('0x11')]=_0x1cf318[_0x65c1('0x11')]['replace'](/@@{/g,_0x65c1('0x12'))[_0x65c1('0x13')](/}@@/g,'}}}')[_0x65c1('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x65c1('0x14'),moment()['format'](_0x65c1('0x15')),_0x1cf318['level'][_0x65c1('0x16')](),_0x42f1ed,_0x1cf318[_0x65c1('0x11')]);}function fileFormat(_0x2c4b2d,_0x22c442){_0x22c442['message']=_0x22c442[_0x65c1('0x11')]['replace'](/@@{/g,_0x65c1('0x12'))[_0x65c1('0x13')](/}@@/g,_0x65c1('0x17'))[_0x65c1('0x13')](/@{/g,'{{')[_0x65c1('0x13')](/}@/g,'}}');var _0x4165eb=_0x22c442[_0x65c1('0x18')]&&Object[_0x65c1('0x19')](_0x22c442['meta'])['length']?'\x0a\x09'+JSON[_0x65c1('0x1a')](_0x22c442[_0x65c1('0x18')]):'';return util[_0x65c1('0xf')](_0x65c1('0x1b'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x22c442[_0x65c1('0x1c')]['toUpperCase'](),_0x2c4b2d,_0x22c442[_0x65c1('0x11')],_0x4165eb);}function consoleLogger(){var _0x3673b6=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x65c1('0x1d'))][(_0x65c1('0x1e'))]({'level':_0x65c1('0x1f'),'json':![],'formatter':function(_0x3c6b98){return formatter('',_0x3c6b98);}})]});return _0x3673b6;}function fileLogger(_0x59d94,_0x2e3c6c){var _0x53d889=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x65c1('0x1d'))][(_0x65c1('0x20'))]({'name':util[_0x65c1('0xf')](_0x65c1('0x21'),_0x59d94,_0x65c1('0x22')),'filename':getLogFileName(_0x2e3c6c,_0x59d94,'error'),'level':_0x65c1('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x38faa2){return fileFormat(_0x59d94,_0x38faa2);}}),new winston[(_0x65c1('0x1d'))]['File']({'name':util[_0x65c1('0xf')](_0x65c1('0x21'),_0x59d94,debugLevel),'filename':getLogFileName(_0x2e3c6c,_0x59d94,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x53c7bc){return fileFormat(_0x59d94,_0x53c7bc);}}),new winston['transports'][(_0x65c1('0x1e'))]({'level':_0x65c1('0x1f'),'json':![],'formatter':function(_0x4d7172){return fileFormat(_0x59d94,_0x4d7172);}})]});return _0x53d889;}exports[_0x65c1('0x23')]=consoleLogger;exports[_0x65c1('0x24')]=fileLogger; \ No newline at end of file +var _0x5312=['join','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','}}}','meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','toUpperCase','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','debugLevel','toLowerCase','info','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0x5312,0x113));var _0x2531=function(_0x1ce30d,_0x415191){_0x1ce30d=_0x1ce30d-0x0;var _0x2e66e6=_0x5312[_0x1ce30d];return _0x2e66e6;};'use strict';var path=require(_0x2531('0x0'));var util=require(_0x2531('0x1'));var moment=require('moment');var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0x2531('0x2')]?config['debugLevel'][_0x2531('0x3')]():_0x2531('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x2531('0x5'),'warn':_0x2531('0x6'),'info':'white','print':_0x2531('0x7'),'success':_0x2531('0x8'),'http':_0x2531('0x9'),'verbose':_0x2531('0xa'),'debug':_0x2531('0xb'),'silly':_0x2531('0xc')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x380dac,_0x44e011,_0x18aa89){var _0x367aee=_0x380dac||'/var/log/xcally';return path[_0x2531('0xd')](_0x367aee,util['format'](_0x2531('0xe'),_0x44e011,_0x18aa89));}function formatter(_0x40329e,_0x23bfce){_0x23bfce['message']=_0x23bfce[_0x2531('0xf')][_0x2531('0x10')](/@@{/g,_0x2531('0x11'))[_0x2531('0x10')](/}@@/g,'}}}')[_0x2531('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x2531('0x12'),moment()[_0x2531('0x13')](_0x2531('0x14')),_0x23bfce['level']['toUpperCase'](),_0x40329e,_0x23bfce[_0x2531('0xf')]);}function fileFormat(_0x51b592,_0x36318f){_0x36318f[_0x2531('0xf')]=_0x36318f[_0x2531('0xf')][_0x2531('0x10')](/@@{/g,_0x2531('0x11'))[_0x2531('0x10')](/}@@/g,_0x2531('0x15'))[_0x2531('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x11fc4c=_0x36318f[_0x2531('0x16')]&&Object['keys'](_0x36318f[_0x2531('0x16')])[_0x2531('0x17')]?'\x0a\x09'+JSON['stringify'](_0x36318f[_0x2531('0x16')]):'';return util[_0x2531('0x13')](_0x2531('0x18'),moment()[_0x2531('0x13')](_0x2531('0x14')),_0x36318f[_0x2531('0x19')][_0x2531('0x1a')](),_0x51b592,_0x36318f[_0x2531('0xf')],_0x11fc4c);}function consoleLogger(){var _0x1c128c=new winston[(_0x2531('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2531('0x1c'))][(_0x2531('0x1d'))]({'level':_0x2531('0x1e'),'json':![],'formatter':function(_0x374658){return formatter('',_0x374658);}})]});return _0x1c128c;}function fileLogger(_0x45ff85,_0x43f652){var _0x81a882=new winston[(_0x2531('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2531('0x1c'))][(_0x2531('0x1f'))]({'name':util[_0x2531('0x13')](_0x2531('0x20'),_0x45ff85,_0x2531('0x21')),'filename':getLogFileName(_0x43f652,_0x45ff85,_0x2531('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2c3642){return fileFormat(_0x45ff85,_0x2c3642);}}),new winston[(_0x2531('0x1c'))]['File']({'name':util[_0x2531('0x13')]('%s-%s',_0x45ff85,debugLevel),'filename':getLogFileName(_0x43f652,_0x45ff85,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2f0d8b){return fileFormat(_0x45ff85,_0x2f0d8b);}}),new winston[(_0x2531('0x1c'))][(_0x2531('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x266ad9){return fileFormat(_0x45ff85,_0x266ad9);}})]});return _0x81a882;}exports[_0x2531('0x22')]=consoleLogger;exports[_0x2531('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 59bcf9a..1b74832 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(_0x3ed049,_0x19da21){var _0x3d9597=function(_0x874e1f){while(--_0x874e1f){_0x3ed049['push'](_0x3ed049['shift']());}};_0x3d9597(++_0x19da21);}(_0x1261,0x144));var _0x1126=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x1261[_0x4cbf20];return _0x582ae4;};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 _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x1a85,0x178));var _0x51a8=function(_0x4d0e8b,_0x25837e){_0x4d0e8b=_0x4d0e8b-0x0;var _0x1163d3=_0x1a85[_0x4d0e8b];return _0x1163d3;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index c522721..da1fd9c 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['exports','\x5c$&'];(function(_0x598667,_0x53bb03){var _0x3ac5cf=function(_0x571398){while(--_0x571398){_0x598667['push'](_0x598667['shift']());}};_0x3ac5cf(++_0x53bb03);}(_0x7a54,0x106));var _0x47a5=function(_0x1a4112,_0x15fccb){_0x1a4112=_0x1a4112-0x0;var _0x51b729=_0x7a54[_0x1a4112];return _0x51b729;};module[_0x47a5('0x0')]={'escapeRegExp'(_0x46f3fa,_0x44b31e=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x46f3fa['replace'](_0x44b31e,_0x47a5('0x1'));}}; \ No newline at end of file +var _0x66fa=['exports','replace','\x5c$&'];(function(_0x375bec,_0x2f32d9){var _0x3cb1f1=function(_0x45fff8){while(--_0x45fff8){_0x375bec['push'](_0x375bec['shift']());}};_0x3cb1f1(++_0x2f32d9);}(_0x66fa,0x117));var _0xa66f=function(_0x5c596,_0x3a918f){_0x5c596=_0x5c596-0x0;var _0x505af1=_0x66fa[_0x5c596];return _0x505af1;};module[_0xa66f('0x0')]={'escapeRegExp'(_0x3c905a,_0x52947a=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x3c905a[_0xa66f('0x1')](_0x52947a,_0xa66f('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 357625e..05e176c 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefda=['replace','isArray','map','isPlainObject','reduce','exports','lodash','\x20}\x20}','string'];(function(_0x326ff9,_0x51cf6d){var _0x2118fd=function(_0x1b93d5){while(--_0x1b93d5){_0x326ff9['push'](_0x326ff9['shift']());}};_0x2118fd(++_0x51cf6d);}(_0xefda,0x96));var _0xaefd=function(_0x59626f,_0x5d0ff5){_0x59626f=_0x59626f-0x0;var _0x291ae7=_0xefda[_0x59626f];return _0x291ae7;};var _=require(_0xaefd('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4ae616){return _0x4ae616==='{{'?'{\x20{\x20':_0xaefd('0x1');}function safeTemplate(_0x2ccc67){var _0x4ae272=_0x2ccc67;if(typeof _0x2ccc67===_0xaefd('0x2')){_0x4ae272=_0x2ccc67[_0xaefd('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xaefd('0x4')](_0x2ccc67)){_0x4ae272=_0x2ccc67[_0xaefd('0x5')](function(_0x1ef6b4){return safeTemplate(_0x1ef6b4);});}else if(_[_0xaefd('0x6')](_0x2ccc67)){_0x4ae272=Object['keys'](_0x2ccc67)[_0xaefd('0x7')](function(_0x3b9736,_0x24d10c){_0x3b9736[_0x24d10c]=safeTemplate(_0x2ccc67[_0x24d10c]);return _0x3b9736;},{});}return _0x4ae272;}module[_0xaefd('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x8952=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x5ec454,_0xfcd77e){var _0x5ebf50=function(_0x29de85){while(--_0x29de85){_0x5ec454['push'](_0x5ec454['shift']());}};_0x5ebf50(++_0xfcd77e);}(_0x8952,0x17e));var _0x2895=function(_0x54a935,_0x590d6e){_0x54a935=_0x54a935-0x0;var _0x24871f=_0x8952[_0x54a935];return _0x24871f;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2a7389){return _0x2a7389==='{{'?_0x2895('0x0'):_0x2895('0x1');}function safeTemplate(_0x2d485c){var _0x2454c5=_0x2d485c;if(typeof _0x2d485c==='string'){_0x2454c5=_0x2d485c[_0x2895('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2895('0x3')](_0x2d485c)){_0x2454c5=_0x2d485c[_0x2895('0x4')](function(_0x5b28c6){return safeTemplate(_0x5b28c6);});}else if(_[_0x2895('0x5')](_0x2d485c)){_0x2454c5=Object[_0x2895('0x6')](_0x2d485c)[_0x2895('0x7')](function(_0x4ea619,_0x526c32){_0x4ea619[_0x526c32]=safeTemplate(_0x2d485c[_0x526c32]);return _0x4ea619;},{});}return _0x2454c5;}module[_0x2895('0x8')][_0x2895('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index e63a8a3..d0b75f4 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 _0xa364=['Updating\x20app.json','writeJSON','exports','../config/environment','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','motion2','NODE_PATH','string','env','pathExists','then','readJSON','info'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xa364,0x135));var _0x4a36=function(_0x2f75b3,_0x588b53){_0x2f75b3=_0x2f75b3-0x0;var _0x3ba2fe=_0xa364[_0x2f75b3];return _0x3ba2fe;};var fs=require('fs-extra');var path=require('path');var config=require(_0x4a36('0x0'));var root=config['root'];var APP_JSON_PATH=path[_0x4a36('0x1')](root,_0x4a36('0x2'));var NODEPATH=path[_0x4a36('0x1')](root,_0x4a36('0x3'));function setLegacyLibsNodeEnvPath(_0x2562e4){let _0x55b0b9=![];if(Array[_0x4a36('0x4')](_0x2562e4[_0x4a36('0x5')])){var _0xeb2d22=_0x2562e4[_0x4a36('0x5')][_0x4a36('0x6')](function(_0x390ab4){return _0x390ab4['name']===_0x4a36('0x7');});if(_0xeb2d22>-0x1){var _0x797952=_0x2562e4[_0x4a36('0x5')][_0xeb2d22];if(typeof _0x797952['env'][_0x4a36('0x8')]!==_0x4a36('0x9')){_0x797952[_0x4a36('0xa')]['NODE_PATH']=NODEPATH;_0x55b0b9=!![];}}return{'appConfig':_0x2562e4,'updated':_0x55b0b9};}}function updateAppConfig(_0x4bb872){return fs[_0x4a36('0xb')](APP_JSON_PATH)[_0x4a36('0xc')](function(_0x34605){if(_0x34605){return fs[_0x4a36('0xd')](APP_JSON_PATH)[_0x4a36('0xc')](function(_0x2495df){var _0x540fe2=setLegacyLibsNodeEnvPath(_0x2495df);if(_0x540fe2['updated']){_0x4bb872[_0x4a36('0xe')](_0x4a36('0xf'));return fs[_0x4a36('0x10')](APP_JSON_PATH,_0x2495df,{'spaces':0x2});}else{return Promise[_0x4a36('0x1')]();}});}else{return Promise[_0x4a36('0x1')]();}});}module[_0x4a36('0x11')]=updateAppConfig; \ No newline at end of file +var _0xfe57=['NODE_PATH','string','then','readJSON','updated','info','exports','path','../config/environment','root','resolve','server/app.json','isArray','apps','findIndex','motion2','env'];(function(_0x55ea95,_0x542cc6){var _0x3f6508=function(_0x5f448d){while(--_0x5f448d){_0x55ea95['push'](_0x55ea95['shift']());}};_0x3f6508(++_0x542cc6);}(_0xfe57,0x7e));var _0x7fe5=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xfe57[_0x2fc012];return _0x2891f9;};var fs=require('fs-extra');var path=require(_0x7fe5('0x0'));var config=require(_0x7fe5('0x1'));var root=config[_0x7fe5('0x2')];var APP_JSON_PATH=path[_0x7fe5('0x3')](root,_0x7fe5('0x4'));var NODEPATH=path[_0x7fe5('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x31ebf7){let _0x1c1e91=![];if(Array[_0x7fe5('0x5')](_0x31ebf7[_0x7fe5('0x6')])){var _0x33327d=_0x31ebf7[_0x7fe5('0x6')][_0x7fe5('0x7')](function(_0x44e53d){return _0x44e53d['name']===_0x7fe5('0x8');});if(_0x33327d>-0x1){var _0x367bf1=_0x31ebf7[_0x7fe5('0x6')][_0x33327d];if(typeof _0x367bf1[_0x7fe5('0x9')][_0x7fe5('0xa')]!==_0x7fe5('0xb')){_0x367bf1[_0x7fe5('0x9')][_0x7fe5('0xa')]=NODEPATH;_0x1c1e91=!![];}}return{'appConfig':_0x31ebf7,'updated':_0x1c1e91};}}function updateAppConfig(_0x104ed0){return fs['pathExists'](APP_JSON_PATH)[_0x7fe5('0xc')](function(_0xb0fb40){if(_0xb0fb40){return fs[_0x7fe5('0xd')](APP_JSON_PATH)[_0x7fe5('0xc')](function(_0x5588e3){var _0x243f02=setLegacyLibsNodeEnvPath(_0x5588e3);if(_0x243f02[_0x7fe5('0xe')]){_0x104ed0[_0x7fe5('0xf')]('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x5588e3,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x7fe5('0x3')]();}});}module[_0x7fe5('0x10')]=updateAppConfig; \ No newline at end of file